From: Cris Di Sclafani Date: Fri, 30 Oct 2020 09:08:05 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=763f4380b5e2e0a41a4d59065b4252e93b651f55;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b9ac76f..2570afb 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T08:59:55.373Z", "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 40a08f7..3ffe8ac 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 _0x2eae=['jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2eae,0x19c));var _0xe2ea=function(_0x3a1df5,_0x50cd9d){_0x3a1df5=_0x3a1df5-0x0;var _0x23d4ae=_0x2eae[_0x3a1df5];return _0x23d4ae;};'use strict';var Sequelize=require(_0xe2ea('0x0'));module[_0xe2ea('0x1')]={'name':{'type':Sequelize[_0xe2ea('0x2')],'get':function(_0x43ab6a){return this['getDataValue'](_0xe2ea('0x3'));}},'action':{'type':Sequelize[_0xe2ea('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe2ea('0x5'),_0xe2ea('0x6'),_0xe2ea('0x7'),_0xe2ea('0x8'),'urlForward',_0xe2ea('0x9'),'bot',_0xe2ea('0xa')]],'msg':_0xe2ea('0xb')}},'comment':_0xe2ea('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xe2ea('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xe2ea('0x4')](0x1000),'comment':_0xe2ea('0xd')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xe2ea('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0193=['TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x1144c9,_0x4250e6){var _0x47cbe2=function(_0x41250f){while(--_0x41250f){_0x1144c9['push'](_0x1144c9['shift']());}};_0x47cbe2(++_0x4250e6);}(_0x0193,0xd3));var _0x3019=function(_0x155d7b,_0x3c49c6){_0x155d7b=_0x155d7b-0x0;var _0x58453f=_0x0193[_0x155d7b];return _0x58453f;};'use strict';var Sequelize=require(_0x3019('0x0'));module[_0x3019('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4f336f){return this[_0x3019('0x2')](_0x3019('0x3'));}},'action':{'type':Sequelize[_0x3019('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3019('0x5'),'integration',_0x3019('0x6'),_0x3019('0x7'),_0x3019('0x8'),'browser',_0x3019('0x9'),_0x3019('0xa')]],'msg':_0x3019('0xb')}},'comment':_0x3019('0xb')},'data1':{'type':Sequelize[_0x3019('0x4')](0x1000),'comment':_0x3019('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x3019('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x3019('0x4')](0x1000)},'data6':{'type':Sequelize[_0x3019('0x4')]},'data7':{'type':Sequelize[_0x3019('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1044d6b..fd7d3ab 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 _0xf610=['send','update','body','find','params','Action','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','name'];(function(_0x33ed88,_0x4edb55){var _0x5c4439=function(_0x58d3a3){while(--_0x58d3a3){_0x33ed88['push'](_0x33ed88['shift']());}};_0x5c4439(++_0x4edb55);}(_0xf610,0x187));var _0x0f61=function(_0xf1d1,_0xab6ed1){_0xf1d1=_0xf1d1-0x0;var _0x53d41e=_0xf610[_0xf1d1];return _0x53d41e;};'use strict';var pdf=require(_0x0f61('0x0'));var emlformat=require(_0x0f61('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f61('0x2'));var jsonpatch=require(_0x0f61('0x3'));var rp=require(_0x0f61('0x4'));var moment=require('moment');var BPromise=require(_0x0f61('0x5'));var Mustache=require(_0x0f61('0x6'));var util=require(_0x0f61('0x7'));var path=require(_0x0f61('0x8'));var sox=require(_0x0f61('0x9'));var csv=require(_0x0f61('0xa'));var ejs=require(_0x0f61('0xb'));var fs=require('fs');var _=require(_0x0f61('0xc'));var squel=require(_0x0f61('0xd'));var crypto=require(_0x0f61('0xe'));var jsforce=require(_0x0f61('0xf'));var deskjs=require(_0x0f61('0x10'));var toCsv=require(_0x0f61('0xa'));var querystring=require(_0x0f61('0x11'));var Papa=require(_0x0f61('0x12'));var Redis=require(_0x0f61('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f61('0x14'));var hardwareService=require(_0x0f61('0x15'));var logger=require(_0x0f61('0x16'))(_0x0f61('0x17'));var utils=require(_0x0f61('0x18'));var config=require(_0x0f61('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17c5e5,_0x18e2ac){_0x18e2ac=_0x18e2ac||0xcc;return function(_0x4a58c7){if(_0x4a58c7){return _0x17c5e5[_0x0f61('0x1a')](_0x18e2ac);}return _0x17c5e5[_0x0f61('0x1b')](_0x18e2ac)[_0x0f61('0x1c')]();};}function respondWithResult(_0x245077,_0x40b2fe){_0x40b2fe=_0x40b2fe||0xc8;return function(_0x17e0b8){if(_0x17e0b8){return _0x245077[_0x0f61('0x1b')](_0x40b2fe)[_0x0f61('0x1d')](_0x17e0b8);}};}function respondWithFilteredResult(_0x4bf795,_0x51e2d7){return function(_0x538bd8){if(_0x538bd8){var _0x251e18=_0x538bd8[_0x0f61('0x1e')],_0x820dd5=_0x51e2d7[_0x0f61('0x1f')],_0x14a283=_0x51e2d7[_0x0f61('0x1f')]+_0x51e2d7[_0x0f61('0x20')],_0x4052e2;if(_0x14a283>=_0x251e18){_0x14a283=_0x251e18;_0x4052e2=0xc8;}else{_0x4052e2=0xce;}_0x4bf795[_0x0f61('0x1b')](_0x4052e2);return _0x4bf795['set'](_0x0f61('0x21'),_0x820dd5+'-'+_0x14a283+'/'+_0x251e18)['json'](_0x538bd8);}return null;};}function patchUpdates(_0x24cfca){return function(_0x303559){try{jsonpatch[_0x0f61('0x22')](_0x303559,_0x24cfca,!![]);}catch(_0x2dc006){return BPromise[_0x0f61('0x23')](_0x2dc006);}return _0x303559[_0x0f61('0x24')]();};}function saveUpdates(_0x8a8cc1,_0x5812bb){return function(_0x2b7b82){if(_0x2b7b82){return _0x2b7b82['update'](_0x8a8cc1)['then'](function(_0x4517ea){return _0x4517ea;});}return null;};}function removeEntity(_0x64c8a1,_0x212a1c){return function(_0x4e5842){if(_0x4e5842){return _0x4e5842[_0x0f61('0x25')]()[_0x0f61('0x26')](function(){_0x64c8a1[_0x0f61('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a982e,_0x628acc){return function(_0x2579ea){if(!_0x2579ea){_0x3a982e[_0x0f61('0x1a')](0x194);}return _0x2579ea;};}function handleError(_0x48e277,_0x181b64){_0x181b64=_0x181b64||0x1f4;return function(_0x7f6e1){logger[_0x0f61('0x27')](_0x7f6e1['stack']);if(_0x7f6e1['name']){delete _0x7f6e1[_0x0f61('0x28')];}_0x48e277['status'](_0x181b64)[_0x0f61('0x29')](_0x7f6e1);};}exports[_0x0f61('0x2a')]=function(_0x3fb090,_0xeafac8){if(_0x3fb090[_0x0f61('0x2b')]['id']){delete _0x3fb090[_0x0f61('0x2b')]['id'];}return db['Action'][_0x0f61('0x2c')]({'where':{'id':_0x3fb090[_0x0f61('0x2d')]['id']}})[_0x0f61('0x26')](handleEntityNotFound(_0xeafac8,null))['then'](saveUpdates(_0x3fb090[_0x0f61('0x2b')],null))[_0x0f61('0x26')](respondWithResult(_0xeafac8,null))['catch'](handleError(_0xeafac8,null));};exports[_0x0f61('0x25')]=function(_0x31591d,_0x4ff00a){return db[_0x0f61('0x2e')][_0x0f61('0x2c')]({'where':{'id':_0x31591d[_0x0f61('0x2d')]['id']}})[_0x0f61('0x26')](handleEntityNotFound(_0x4ff00a,null))[_0x0f61('0x26')](removeEntity(_0x4ff00a,null))[_0x0f61('0x2f')](handleError(_0x4ff00a,null));}; \ No newline at end of file +var _0xe86c=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','body','find','params','Action','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3e9d79,_0x18a91e){var _0x3ab5c5=function(_0x5e6968){while(--_0x5e6968){_0x3e9d79['push'](_0x3e9d79['shift']());}};_0x3ab5c5(++_0x18a91e);}(_0xe86c,0xe2));var _0xce86=function(_0x21d96e,_0x2e01ab){_0x21d96e=_0x21d96e-0x0;var _0x3575fe=_0xe86c[_0x21d96e];return _0x3575fe;};'use strict';var pdf=require(_0xce86('0x0'));var emlformat=require(_0xce86('0x1'));var rimraf=require(_0xce86('0x2'));var zipdir=require(_0xce86('0x3'));var jsonpatch=require(_0xce86('0x4'));var rp=require(_0xce86('0x5'));var moment=require(_0xce86('0x6'));var BPromise=require(_0xce86('0x7'));var Mustache=require(_0xce86('0x8'));var util=require(_0xce86('0x9'));var path=require('path');var sox=require(_0xce86('0xa'));var csv=require(_0xce86('0xb'));var ejs=require(_0xce86('0xc'));var fs=require('fs');var _=require(_0xce86('0xd'));var squel=require(_0xce86('0xe'));var crypto=require(_0xce86('0xf'));var jsforce=require(_0xce86('0x10'));var deskjs=require(_0xce86('0x11'));var toCsv=require(_0xce86('0xb'));var querystring=require(_0xce86('0x12'));var Papa=require(_0xce86('0x13'));var Redis=require(_0xce86('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xce86('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce86('0x16'));var logger=require(_0xce86('0x17'))(_0xce86('0x18'));var utils=require(_0xce86('0x19'));var config=require(_0xce86('0x1a'));var db=require(_0xce86('0x1b'))['db'];function respondWithStatusCode(_0x5bbf7c,_0x38e94d){_0x38e94d=_0x38e94d||0xcc;return function(_0x1ba075){if(_0x1ba075){return _0x5bbf7c[_0xce86('0x1c')](_0x38e94d);}return _0x5bbf7c[_0xce86('0x1d')](_0x38e94d)[_0xce86('0x1e')]();};}function respondWithResult(_0x2d27ad,_0x177f54){_0x177f54=_0x177f54||0xc8;return function(_0x5d734c){if(_0x5d734c){return _0x2d27ad[_0xce86('0x1d')](_0x177f54)[_0xce86('0x1f')](_0x5d734c);}};}function respondWithFilteredResult(_0x3c8c78,_0x10a15c){return function(_0x114e1d){if(_0x114e1d){var _0xeba143=_0x114e1d[_0xce86('0x20')],_0x2e16bc=_0x10a15c[_0xce86('0x21')],_0x43fc41=_0x10a15c['offset']+_0x10a15c['limit'],_0x1113d5;if(_0x43fc41>=_0xeba143){_0x43fc41=_0xeba143;_0x1113d5=0xc8;}else{_0x1113d5=0xce;}_0x3c8c78[_0xce86('0x1d')](_0x1113d5);return _0x3c8c78[_0xce86('0x22')](_0xce86('0x23'),_0x2e16bc+'-'+_0x43fc41+'/'+_0xeba143)[_0xce86('0x1f')](_0x114e1d);}return null;};}function patchUpdates(_0x17821c){return function(_0xa530cf){try{jsonpatch['apply'](_0xa530cf,_0x17821c,!![]);}catch(_0x511cc7){return BPromise[_0xce86('0x24')](_0x511cc7);}return _0xa530cf[_0xce86('0x25')]();};}function saveUpdates(_0x35477b,_0x2721c5){return function(_0x54c29d){if(_0x54c29d){return _0x54c29d[_0xce86('0x26')](_0x35477b)['then'](function(_0xc09bd3){return _0xc09bd3;});}return null;};}function removeEntity(_0x4b133b,_0x17ae8e){return function(_0x235d46){if(_0x235d46){return _0x235d46['destroy']()[_0xce86('0x27')](function(){_0x4b133b[_0xce86('0x1d')](0xcc)[_0xce86('0x1e')]();});}};}function handleEntityNotFound(_0x10cc40,_0x3b0f3c){return function(_0x1b4d0e){if(!_0x1b4d0e){_0x10cc40[_0xce86('0x1c')](0x194);}return _0x1b4d0e;};}function handleError(_0x489045,_0x1b66d2){_0x1b66d2=_0x1b66d2||0x1f4;return function(_0x307549){logger[_0xce86('0x28')](_0x307549[_0xce86('0x29')]);if(_0x307549[_0xce86('0x2a')]){delete _0x307549[_0xce86('0x2a')];}_0x489045[_0xce86('0x1d')](_0x1b66d2)[_0xce86('0x2b')](_0x307549);};}exports['update']=function(_0x21558e,_0x1f72c4){if(_0x21558e[_0xce86('0x2c')]['id']){delete _0x21558e['body']['id'];}return db['Action'][_0xce86('0x2d')]({'where':{'id':_0x21558e[_0xce86('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1f72c4,null))[_0xce86('0x27')](saveUpdates(_0x21558e[_0xce86('0x2c')],null))[_0xce86('0x27')](respondWithResult(_0x1f72c4,null))['catch'](handleError(_0x1f72c4,null));};exports['destroy']=function(_0x357d14,_0x6699){return db[_0xce86('0x2f')]['find']({'where':{'id':_0x357d14[_0xce86('0x2e')]['id']}})['then'](handleEntityNotFound(_0x6699,null))[_0xce86('0x27')](removeEntity(_0x6699,null))[_0xce86('0x30')](handleError(_0x6699,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 69b63f9..60d1234 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 _0x8c07=['request-promise','path','rimraf','./action.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c07,0x1f2));var _0x78c0=function(_0x1e80de,_0x5989eb){_0x1e80de=_0x1e80de-0x0;var _0x225c77=_0x8c07[_0x1e80de];return _0x225c77;};'use strict';var _=require(_0x78c0('0x0'));var util=require(_0x78c0('0x1'));var logger=require(_0x78c0('0x2'))(_0x78c0('0x3'));var moment=require(_0x78c0('0x4'));var BPromise=require(_0x78c0('0x5'));var rp=require(_0x78c0('0x6'));var fs=require('fs');var path=require(_0x78c0('0x7'));var rimraf=require(_0x78c0('0x8'));var config=require('../../config/environment');var attributes=require(_0x78c0('0x9'));module[_0x78c0('0xa')]=function(_0x3ea591,_0x38eefc){return _0x3ea591[_0x78c0('0xb')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9c=['define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0a9c,0x92));var _0xc0a9=function(_0x544260,_0x145537){_0x544260=_0x544260-0x0;var _0x5e3f05=_0x0a9c[_0x544260];return _0x5e3f05;};'use strict';var _=require(_0xc0a9('0x0'));var util=require(_0xc0a9('0x1'));var logger=require(_0xc0a9('0x2'))(_0xc0a9('0x3'));var moment=require('moment');var BPromise=require(_0xc0a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a9('0x5'));var rimraf=require(_0xc0a9('0x6'));var config=require(_0xc0a9('0x7'));var attributes=require(_0xc0a9('0x8'));module[_0xc0a9('0x9')]=function(_0x51702c,_0x112ffd){return _0x51702c[_0xc0a9('0xa')](_0xc0a9('0xb'),attributes,{'tableName':_0xc0a9('0xc'),'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 a917d61..308bf5b 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 _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(_0x1281b5,_0x15d307){var _0x138902=function(_0x271830){while(--_0x271830){_0x1281b5['push'](_0x1281b5['shift']());}};_0x138902(++_0x15d307);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'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 +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 23f1252..2251d41 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 _0xf783=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x26dd9a,_0x28a8e1){var _0x32c5f8=function(_0x2c7f12){while(--_0x2c7f12){_0x26dd9a['push'](_0x26dd9a['shift']());}};_0x32c5f8(++_0x28a8e1);}(_0xf783,0x1cc));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var path=require(_0x3f78('0x2'));var timeout=require(_0x3f78('0x3'));var express=require(_0x3f78('0x4'));var router=express[_0x3f78('0x5')]();var auth=require(_0x3f78('0x6'));var interaction=require(_0x3f78('0x7'));var config=require(_0x3f78('0x8'));var controller=require(_0x3f78('0x9'));router[_0x3f78('0xa')]('/:id',auth[_0x3f78('0xb')](),controller['update']);router['delete'](_0x3f78('0xc'),auth[_0x3f78('0xb')](),controller[_0x3f78('0xd')]);module[_0x3f78('0xe')]=router; \ No newline at end of file +var _0x9565=['../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x182b41,_0x3710ca){var _0x39e4dc=function(_0x9bf120){while(--_0x9bf120){_0x182b41['push'](_0x182b41['shift']());}};_0x39e4dc(++_0x3710ca);}(_0x9565,0x1f3));var _0x5956=function(_0x4eb311,_0x1fe750){_0x4eb311=_0x4eb311-0x0;var _0x558024=_0x9565[_0x4eb311];return _0x558024;};'use strict';var multer=require(_0x5956('0x0'));var util=require(_0x5956('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5956('0x2'));var router=express[_0x5956('0x3')]();var auth=require(_0x5956('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5956('0x5'));var controller=require(_0x5956('0x6'));router[_0x5956('0x7')](_0x5956('0x8'),auth[_0x5956('0x9')](),controller[_0x5956('0xa')]);router[_0x5956('0xb')](_0x5956('0x8'),auth[_0x5956('0x9')](),controller[_0x5956('0xc')]);module[_0x5956('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1bcf5d3..ad64518 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 _0x6cde=['STRING'];(function(_0x47ece1,_0x378f80){var _0x52596f=function(_0x41f1b0){while(--_0x41f1b0){_0x47ece1['push'](_0x47ece1['shift']());}};_0x52596f(++_0x378f80);}(_0x6cde,0x1e8));var _0xe6cd=function(_0x212e21,_0x7e13be){_0x212e21=_0x212e21-0x0;var _0x35b3a8=_0x6cde[_0x212e21];return _0x35b3a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe6cd('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xe6cd('0x0')]},'table':{'type':Sequelize[_0xe6cd('0x0')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9871=['TEXT','sequelize','STRING'];(function(_0x52dd62,_0x1afc30){var _0x2bae20=function(_0x41d242){while(--_0x41d242){_0x52dd62['push'](_0x52dd62['shift']());}};_0x2bae20(++_0x1afc30);}(_0x9871,0x10c));var _0x1987=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x9871[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0x1987('0x0'));module['exports']={'name':{'type':Sequelize[_0x1987('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x1987('0x1')]},'table':{'type':Sequelize[_0x1987('0x1')]},'conditions':{'type':Sequelize[_0x1987('0x2')]},'joins':{'type':Sequelize[_0x1987('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d32da7f..ca908bd 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 _0x2242=['right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','group','rules','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','field','replace','function','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','QueryTypes','SELECT','SUM(%s)','ROUND(%s)','includes','select','groupBy','parentKey','sequelize','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','options','runReport','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','api','../../mysqldb','dbH','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','include','AnalyticCustomReport','findAll','rows','catch','rawAttributes','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join'];(function(_0x9abc99,_0xa86544){var _0x2b7afa=function(_0x1ff85f){while(--_0x1ff85f){_0x9abc99['push'](_0x9abc99['shift']());}};_0x2b7afa(++_0xa86544);}(_0x2242,0x1a3));var _0x2224=function(_0x4826aa,_0x1f8a1c){_0x4826aa=_0x4826aa-0x0;var _0x44e7d6=_0x2242[_0x4826aa];return _0x44e7d6;};'use strict';var pdf=require(_0x2224('0x0'));var emlformat=require(_0x2224('0x1'));var rimraf=require(_0x2224('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2224('0x3'));var rp=require(_0x2224('0x4'));var moment=require('moment');var BPromise=require(_0x2224('0x5'));var Mustache=require(_0x2224('0x6'));var util=require('util');var path=require(_0x2224('0x7'));var sox=require(_0x2224('0x8'));var csv=require(_0x2224('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2224('0xa'));var squel=require(_0x2224('0xb'));var crypto=require(_0x2224('0xc'));var jsforce=require(_0x2224('0xd'));var deskjs=require(_0x2224('0xe'));var toCsv=require(_0x2224('0x9'));var querystring=require(_0x2224('0xf'));var Papa=require(_0x2224('0x10'));var Redis=require(_0x2224('0x11'));var authService=require(_0x2224('0x12'));var qs=require(_0x2224('0x13'));var as=require(_0x2224('0x14'));var hardwareService=require(_0x2224('0x15'));var logger=require(_0x2224('0x16'))(_0x2224('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2224('0x18'))['db'];var dbH=require(_0x2224('0x18'))[_0x2224('0x19')];function respondWithStatusCode(_0x33582c,_0x49f1e2){_0x49f1e2=_0x49f1e2||0xcc;return function(_0x3b6ed4){if(_0x3b6ed4){return _0x33582c[_0x2224('0x1a')](_0x49f1e2);}return _0x33582c['status'](_0x49f1e2)['end']();};}function respondWithResult(_0x3fcb41,_0xd9ca18){_0xd9ca18=_0xd9ca18||0xc8;return function(_0x5f371e){if(_0x5f371e){return _0x3fcb41['status'](_0xd9ca18)[_0x2224('0x1b')](_0x5f371e);}};}function respondWithFilteredResult(_0x2596e0,_0x3c1ecd){return function(_0x28956b){if(_0x28956b){var _0x30d846=_0x28956b['count'],_0xebb5c9=_0x3c1ecd[_0x2224('0x1c')],_0x34d045=_0x3c1ecd[_0x2224('0x1c')]+_0x3c1ecd[_0x2224('0x1d')],_0x1327dc;if(_0x34d045>=_0x30d846){_0x34d045=_0x30d846;_0x1327dc=0xc8;}else{_0x1327dc=0xce;}_0x2596e0[_0x2224('0x1e')](_0x1327dc);return _0x2596e0[_0x2224('0x1f')](_0x2224('0x20'),_0xebb5c9+'-'+_0x34d045+'/'+_0x30d846)[_0x2224('0x1b')](_0x28956b);}return null;};}function patchUpdates(_0x238dc5){return function(_0x357b07){try{jsonpatch[_0x2224('0x21')](_0x357b07,_0x238dc5,!![]);}catch(_0x3cfc69){return BPromise[_0x2224('0x22')](_0x3cfc69);}return _0x357b07[_0x2224('0x23')]();};}function saveUpdates(_0x707cc3,_0x9979e5){return function(_0x5bdf57){if(_0x5bdf57){return _0x5bdf57['update'](_0x707cc3)[_0x2224('0x24')](function(_0x9a842a){return _0x9a842a;});}return null;};}function removeEntity(_0x14f837,_0x152f76){return function(_0x399a51){if(_0x399a51){return _0x399a51[_0x2224('0x25')]()[_0x2224('0x24')](function(){var _0x27cc8e=_0x399a51[_0x2224('0x26')]({'plain':!![]});var _0x5559ce=_0x2224('0x27');return db[_0x2224('0x28')]['destroy']({'where':{'type':_0x5559ce,'resourceId':_0x27cc8e['id']}})[_0x2224('0x24')](function(){return _0x399a51;});})['then'](function(){_0x14f837['status'](0xcc)[_0x2224('0x29')]();});}};}function handleEntityNotFound(_0x1e8e26,_0x4c4c64){return function(_0x4da4bd){if(!_0x4da4bd){_0x1e8e26[_0x2224('0x1a')](0x194);}return _0x4da4bd;};}function handleError(_0x3f800f,_0x58b6a0){_0x58b6a0=_0x58b6a0||0x1f4;return function(_0x408521){logger['error'](_0x408521[_0x2224('0x2a')]);if(_0x408521[_0x2224('0x2b')]){delete _0x408521[_0x2224('0x2b')];}_0x3f800f[_0x2224('0x1e')](_0x58b6a0)[_0x2224('0x2c')](_0x408521);};}exports['index']=function(_0x3b3843,_0x5bb00f){var _0x50ff72={},_0x2ebdd6={},_0x59258d={'count':0x0,'rows':[]};var _0x21acad=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x1b125c){return{'name':_0x1b125c[_0x2224('0x2d')],'type':_0x1b125c[_0x2224('0x2e')][_0x2224('0x2f')]};});_0x2ebdd6['model']=_[_0x2224('0x30')](_0x21acad,'name');_0x2ebdd6[_0x2224('0x31')]=_[_0x2224('0x32')](_0x3b3843[_0x2224('0x31')]);_0x2ebdd6['filters']=_[_0x2224('0x33')](_0x2ebdd6[_0x2224('0x34')],_0x2ebdd6[_0x2224('0x31')]);_0x50ff72[_0x2224('0x35')]=_[_0x2224('0x33')](_0x2ebdd6[_0x2224('0x34')],qs['fields'](_0x3b3843[_0x2224('0x31')][_0x2224('0x36')]));_0x50ff72['attributes']=_0x50ff72[_0x2224('0x35')][_0x2224('0x37')]?_0x50ff72[_0x2224('0x35')]:_0x2ebdd6[_0x2224('0x34')];if(!_0x3b3843[_0x2224('0x31')][_0x2224('0x38')](_0x2224('0x39'))){_0x50ff72['limit']=qs[_0x2224('0x1d')](_0x3b3843['query'][_0x2224('0x1d')]);_0x50ff72['offset']=qs[_0x2224('0x1c')](_0x3b3843[_0x2224('0x31')]['offset']);}_0x50ff72[_0x2224('0x3a')]=qs[_0x2224('0x3b')](_0x3b3843['query'][_0x2224('0x3b')]);_0x50ff72[_0x2224('0x3c')]=qs['filters'](_[_0x2224('0x3d')](_0x3b3843[_0x2224('0x31')],_0x2ebdd6['filters']),_0x21acad);if(_0x3b3843[_0x2224('0x31')]['filter']){_0x50ff72[_0x2224('0x3c')]=_[_0x2224('0x3e')](_0x50ff72[_0x2224('0x3c')],{'$or':_['map'](_0x21acad,function(_0x11c2a1){if(_0x11c2a1['type']!==_0x2224('0x3f')){var _0x199100={};_0x199100[_0x11c2a1[_0x2224('0x2b')]]={'$like':'%'+_0x3b3843[_0x2224('0x31')]['filter']+'%'};return _0x199100;}})});}_0x50ff72=_[_0x2224('0x3e')]({},_0x50ff72,_0x3b3843['options']);var _0x2a1425={'where':_0x50ff72[_0x2224('0x3c')]};return db['AnalyticCustomReport']['count'](_0x2a1425)[_0x2224('0x24')](function(_0x54f8ce){_0x59258d[_0x2224('0x40')]=_0x54f8ce;if(_0x3b3843[_0x2224('0x31')]['includeAll']){_0x50ff72[_0x2224('0x41')]=[{'all':!![]}];}return db[_0x2224('0x42')][_0x2224('0x43')](_0x50ff72);})['then'](function(_0x1175c5){_0x59258d[_0x2224('0x44')]=_0x1175c5;return _0x59258d;})[_0x2224('0x24')](respondWithFilteredResult(_0x5bb00f,_0x50ff72))[_0x2224('0x45')](handleError(_0x5bb00f,null));};exports['show']=function(_0x24c333,_0x4536a7){var _0x4ca1fb={'raw':![],'where':{'id':_0x24c333['params']['id']}},_0x5e7a75={};_0x5e7a75['model']=_[_0x2224('0x32')](db['AnalyticCustomReport'][_0x2224('0x46')]);_0x5e7a75['query']=_[_0x2224('0x32')](_0x24c333['query']);_0x5e7a75[_0x2224('0x47')]=_['intersection'](_0x5e7a75[_0x2224('0x34')],_0x5e7a75[_0x2224('0x31')]);_0x4ca1fb[_0x2224('0x35')]=_[_0x2224('0x33')](_0x5e7a75['model'],qs[_0x2224('0x36')](_0x24c333[_0x2224('0x31')]['fields']));_0x4ca1fb[_0x2224('0x35')]=_0x4ca1fb[_0x2224('0x35')][_0x2224('0x37')]?_0x4ca1fb[_0x2224('0x35')]:_0x5e7a75['model'];if(_0x24c333[_0x2224('0x31')]['includeAll']){_0x4ca1fb[_0x2224('0x41')]=[{'all':!![]}];}_0x4ca1fb=_[_0x2224('0x3e')]({},_0x4ca1fb,_0x24c333['options']);return db[_0x2224('0x42')][_0x2224('0x48')](_0x4ca1fb)[_0x2224('0x24')](handleEntityNotFound(_0x4536a7,null))[_0x2224('0x24')](respondWithResult(_0x4536a7,null))['catch'](handleError(_0x4536a7,null));};exports[_0x2224('0x49')]=function(_0xe90eab,_0x20496c){return db[_0x2224('0x42')][_0x2224('0x49')](_0xe90eab[_0x2224('0x4a')],{})['then'](function(_0x312401){var _0xaaa51c=_0xe90eab[_0x2224('0x4b')][_0x2224('0x26')]({'plain':!![]});if(!_0xaaa51c)throw new Error(_0x2224('0x4c'));if(_0xaaa51c[_0x2224('0x4d')]==='user'){var _0x30429f=_0x312401[_0x2224('0x26')]({'plain':!![]});var _0xb34467='Reports';return db[_0x2224('0x4e')][_0x2224('0x48')]({'where':{'name':_0xb34467,'userProfileId':_0xaaa51c[_0x2224('0x4f')]},'raw':!![]})['then'](function(_0x35e766){if(_0x35e766&&_0x35e766[_0x2224('0x50')]===0x0){return db[_0x2224('0x28')][_0x2224('0x49')]({'name':_0x30429f[_0x2224('0x2b')],'resourceId':_0x30429f['id'],'type':_0x2224('0x27'),'sectionId':_0x35e766['id']},{})[_0x2224('0x24')](function(){return _0x312401;});}else{return _0x312401;}})[_0x2224('0x45')](function(_0x15d074){logger[_0x2224('0x51')](_0x2224('0x52'),_0x15d074);throw _0x15d074;});}return _0x312401;})['then'](respondWithResult(_0x20496c,0xc9))[_0x2224('0x45')](handleError(_0x20496c,null));};exports[_0x2224('0x53')]=function(_0x1cad64,_0xf120f4){if(_0x1cad64[_0x2224('0x4a')]['id']){delete _0x1cad64[_0x2224('0x4a')]['id'];}return db[_0x2224('0x42')]['find']({'where':{'id':_0x1cad64[_0x2224('0x54')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0xf120f4,null))[_0x2224('0x24')](saveUpdates(_0x1cad64[_0x2224('0x4a')],null))[_0x2224('0x24')](respondWithResult(_0xf120f4,null))[_0x2224('0x45')](handleError(_0xf120f4,null));};exports[_0x2224('0x25')]=function(_0x16e714,_0x3ccf5f){return db[_0x2224('0x42')]['find']({'where':{'id':_0x16e714[_0x2224('0x54')]['id']}})[_0x2224('0x24')](handleEntityNotFound(_0x3ccf5f,null))[_0x2224('0x24')](removeEntity(_0x3ccf5f,null))['catch'](handleError(_0x3ccf5f,null));};exports[_0x2224('0x55')]=function(_0x2a7bfa,_0x2e8281){var _0x30dfcc=0xa;var _0x2dbd1d=[_0x2224('0x56'),_0x2224('0x57'),_0x2224('0x58'),_0x2224('0x59')];var _0x447658={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2224('0x5a'),'MAX':_0x2224('0x5b'),'MIN':_0x2224('0x5c'),'AVG':_0x2224('0x5d'),'GROUP_CONCAT':_0x2224('0x5e'),'GROUP_CONCAT ASC':_0x2224('0x5f'),'GROUP_CONCAT DESC':_0x2224('0x60')};var _0xed600={'SEC_TO_TIME':_0x2224('0x61'),'DATE':_0x2224('0x62'),'HOUR':_0x2224('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2224('0x64')};var _0x1f5a5f=function(_0x671bd4){return!_['includes']([_0x2224('0x65'),_0x2224('0x66'),_0x2224('0x67'),_0x2224('0x68')],_0x671bd4);};var _0x24959b=function(_0x4136cf){if(!_0x4136cf||!_0x4136cf['rules'][_0x2224('0x37')]){return'';}for(var _0xa134c='(',_0x85826a=0x0;_0x85826a<_0x4136cf['rules']['length'];_0x85826a+=0x1){_0x85826a>0x0&&(_0xa134c+='\x20'+_0x4136cf[_0x2224('0x69')]+'\x20');_0xa134c+=_0x4136cf['rules'][_0x85826a][_0x2224('0x6a')]?_0x24959b(_0x4136cf['rules'][_0x85826a][_0x2224('0x6a')]):_0x4136cf[_0x2224('0x6b')][_0x85826a]['field']+'\x20'+_0x4136cf['rules'][_0x85826a]['condition']+(_0x1f5a5f(_0x4136cf[_0x2224('0x6b')][_0x85826a][_0x2224('0x6c')])?'\x20'+_0x4136cf['rules'][_0x85826a][_0x2224('0x6d')]:'');}return _0xa134c+')';};var _0x6082a6={'where':{'id':_0x2a7bfa['params']['id']}},_0x5e33a4,_0xe56303,_0x3d17f5,_0x577005,_0x342e35;_0x6082a6=_[_0x2224('0x3e')]({},_0x6082a6,_0x2a7bfa['options']);return db[_0x2224('0x42')]['find'](_0x6082a6)[_0x2224('0x24')](function(_0x5b71fa){if(_0x5b71fa){_0x5e33a4=_0x5b71fa;return _0x5b71fa[_0x2224('0x6e')]();}return null;})[_0x2224('0x24')](function(_0x24eb91){if(_0x24eb91){if(!_0x24eb91[_0x2224('0x37')]){throw new db[(_0x2224('0x6f'))][(_0x2224('0x70'))](_0x2224('0x71'),0x193);}_0xe56303=_0x24eb91;return db[_0x2224('0x72')][_0x2224('0x43')]({'raw':!![]});}return null;})[_0x2224('0x24')](function(_0x4dbe99){if(_0x4dbe99){_0x3d17f5=_[_0x2224('0x73')](_0x4dbe99,'id');var _0x14acea;var _0x335458=squel['select']();_0x335458[_0x2224('0x74')](_0x5e33a4[_0x2224('0x75')]);for(var _0x226bc2=0x0;_0x226bc2<_0xe56303[_0x2224('0x37')];_0x226bc2+=0x1){_0x14acea=_0xe56303[_0x226bc2][_0x2224('0x76')]?_0x3d17f5[_0xe56303[_0x226bc2]['MetricId']][_0x2224('0x77')]:_0xe56303[_0x226bc2][_0x2224('0x78')];_0x14acea=_0xe56303[_0x226bc2]['function']?_[_0x2224('0x79')](_0x447658[_0xe56303[_0x226bc2][_0x2224('0x7a')]],'%s',_0x14acea):_0x14acea;_0x14acea=_0xe56303[_0x226bc2][_0x2224('0x7b')]?_['replace'](_0xed600[_0xe56303[_0x226bc2][_0x2224('0x7b')]],'%s',_0x14acea):_0x14acea;if(_0xe56303[_0x226bc2]['groupBy']){_0x335458[_0x2224('0x6a')](_0x14acea);}_0xe56303[_0x226bc2][_0x2224('0x7c')]&&_0x335458[_0x2224('0x3a')](_0x14acea,_0xe56303[_0x226bc2][_0x2224('0x7c')]===_0x2224('0x7d')?![]:!![]);_0x335458[_0x2224('0x78')](_0x14acea,_0xe56303[_0x226bc2][_0x2224('0x7e')]||_0x14acea);}if(_0x5e33a4['joins']){_0x5e33a4[_0x2224('0x7f')]=JSON['parse'](_0x5e33a4[_0x2224('0x7f')]);for(var _0x5ade67=0x0;_0x5ade67<_0x5e33a4[_0x2224('0x7f')][_0x2224('0x37')];_0x5ade67+=0x1){if(_0x5e33a4[_0x2224('0x7f')][_0x5ade67]['type']&&_['includes'](_0x2dbd1d,_0x5e33a4[_0x2224('0x7f')][_0x5ade67][_0x2224('0x2e')])&&_0x5e33a4['joins'][_0x5ade67]['parentKey']&&_0x5e33a4[_0x2224('0x7f')][_0x5ade67][_0x2224('0x80')]&&_0x5e33a4['joins'][_0x5ade67][_0x2224('0x81')]){_0x335458[_0x5e33a4[_0x2224('0x7f')][_0x5ade67][_0x2224('0x2e')]](_0x5e33a4[_0x2224('0x7f')][_0x5ade67]['foreignTable'],null,util[_0x2224('0x7b')](_0x2224('0x82'),_0x5e33a4[_0x2224('0x75')],_0x5e33a4['joins'][_0x5ade67]['parentKey'],_0x5e33a4[_0x2224('0x7f')][_0x5ade67][_0x2224('0x80')],_0x5e33a4['joins'][_0x5ade67]['foreignKey']));}}}if(_0x5e33a4[_0x2224('0x83')]){_0x5e33a4['conditions']=JSON[_0x2224('0x84')](_0x5e33a4[_0x2224('0x83')]);_0x335458['where'](_0x24959b(_0x5e33a4[_0x2224('0x83')]['group']));}_0x342e35=_0x335458[_0x2224('0x85')]();_0x335458[_0x2224('0x1d')](_0x30dfcc);_0x335458[_0x2224('0x1c')](0x0);logger[_0x2224('0x86')](_0x2224('0x87'),_0x335458['toString']());return db['sequelize'][_0x2224('0x31')](_0x335458[_0x2224('0x88')](),{'type':db['sequelize'][_0x2224('0x89')][_0x2224('0x8a')]});}})['then'](respondWithResult(_0x2e8281,null))[_0x2224('0x45')](handleError(_0x2e8281,null));};function runReport(_0x4a6f5d,_0x2e543a,_0x5ad048){var _0x3d2f35=_0x2e543a['name'];var _0x1043e6=0xa;var _0x21550f=[_0x2224('0x56'),_0x2224('0x57'),_0x2224('0x58'),_0x2224('0x59')];var _0x5467fd={'SUM':_0x2224('0x8b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2224('0x5a'),'MAX':_0x2224('0x5b'),'MIN':_0x2224('0x5c'),'AVG':_0x2224('0x5d'),'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 _0x574279={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2224('0x62'),'HOUR':_0x2224('0x63'),'ROUND':_0x2224('0x8c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x191eea=function(_0x4a7b12){return!_[_0x2224('0x8d')]([_0x2224('0x65'),_0x2224('0x66'),_0x2224('0x67'),'IS\x20NOT\x20EMPTY'],_0x4a7b12);};var _0x317713=function(_0x508ebd){if(!_0x508ebd||!_0x508ebd[_0x2224('0x6b')]['length']){return'';}for(var _0x20f70f='(',_0x270c96=0x0;_0x270c96<_0x508ebd[_0x2224('0x6b')][_0x2224('0x37')];_0x270c96+=0x1){_0x270c96>0x0&&(_0x20f70f+='\x20'+_0x508ebd['operator']+'\x20');_0x20f70f+=_0x508ebd['rules'][_0x270c96][_0x2224('0x6a')]?_0x317713(_0x508ebd[_0x2224('0x6b')][_0x270c96][_0x2224('0x6a')]):_0x508ebd[_0x2224('0x6b')][_0x270c96][_0x2224('0x78')]+'\x20'+_0x508ebd['rules'][_0x270c96][_0x2224('0x6c')]+(_0x191eea(_0x508ebd['rules'][_0x270c96]['condition'])?'\x20'+_0x508ebd[_0x2224('0x6b')][_0x270c96]['value']:'');}return _0x20f70f+')';};var _0x2a2276={'where':{'id':_0x4a6f5d['id']}},_0x48d420,_0x2142a7,_0xef0d1b,_0x38ff30,_0x3a59e9;_0x2a2276=_[_0x2224('0x3e')]({},_0x2a2276,_0x5ad048);return db[_0x2224('0x42')][_0x2224('0x48')](_0x2a2276)['then'](function(_0x1f4f65){if(_0x1f4f65){_0x48d420=_0x1f4f65;return _0x1f4f65['getFields']();}return null;})[_0x2224('0x24')](function(_0x14b081){if(_0x14b081){if(!_0x14b081[_0x2224('0x37')]){throw new db[(_0x2224('0x6f'))]['ValidationErrorItem'](_0x2224('0x71'),0x193);}_0x2142a7=_0x14b081;return db[_0x2224('0x72')][_0x2224('0x43')]({'raw':!![]});}return null;})[_0x2224('0x24')](function(_0x404b1b){if(_0x404b1b){_0xef0d1b=_[_0x2224('0x73')](_0x404b1b,'id');var _0x5e156d;var _0x98178=squel[_0x2224('0x8e')]();_0x98178[_0x2224('0x74')](_0x48d420[_0x2224('0x75')]);for(var _0x593d95=0x0;_0x593d95<_0x2142a7['length'];_0x593d95+=0x1){_0x5e156d=_0x2142a7[_0x593d95]['MetricId']?_0xef0d1b[_0x2142a7[_0x593d95][_0x2224('0x76')]][_0x2224('0x77')]:_0x2142a7[_0x593d95]['field'];_0x5e156d=_0x2142a7[_0x593d95][_0x2224('0x7a')]?_[_0x2224('0x79')](_0x5467fd[_0x2142a7[_0x593d95][_0x2224('0x7a')]],'%s',_0x5e156d):_0x5e156d;_0x5e156d=_0x2142a7[_0x593d95]['format']?_[_0x2224('0x79')](_0x574279[_0x2142a7[_0x593d95]['format']],'%s',_0x5e156d):_0x5e156d;if(_0x2142a7[_0x593d95][_0x2224('0x8f')]){_0x98178[_0x2224('0x6a')](_0x5e156d);}_0x2142a7[_0x593d95][_0x2224('0x7c')]&&_0x98178['order'](_0x5e156d,_0x2142a7[_0x593d95][_0x2224('0x7c')]===_0x2224('0x7d')?![]:!![]);_0x98178[_0x2224('0x78')](_0x5e156d,_0x2142a7[_0x593d95][_0x2224('0x7e')]||_0x5e156d);}if(_0x48d420[_0x2224('0x7f')]){_0x48d420['joins']=JSON[_0x2224('0x84')](_0x48d420['joins']);for(var _0x24030e=0x0;_0x24030e<_0x48d420[_0x2224('0x7f')]['length'];_0x24030e+=0x1){if(_0x48d420['joins'][_0x24030e][_0x2224('0x2e')]&&_['includes'](_0x21550f,_0x48d420[_0x2224('0x7f')][_0x24030e]['type'])&&_0x48d420[_0x2224('0x7f')][_0x24030e][_0x2224('0x90')]&&_0x48d420[_0x2224('0x7f')][_0x24030e][_0x2224('0x80')]&&_0x48d420['joins'][_0x24030e]['foreignKey']){_0x98178[_0x48d420[_0x2224('0x7f')][_0x24030e]['type']](_0x48d420[_0x2224('0x7f')][_0x24030e][_0x2224('0x80')],null,util[_0x2224('0x7b')](_0x2224('0x82'),_0x48d420[_0x2224('0x75')],_0x48d420['joins'][_0x24030e][_0x2224('0x90')],_0x48d420['joins'][_0x24030e][_0x2224('0x80')],_0x48d420[_0x2224('0x7f')][_0x24030e][_0x2224('0x81')]));}}}if(_0x48d420[_0x2224('0x83')]){_0x48d420[_0x2224('0x83')]=JSON[_0x2224('0x84')](_0x48d420['conditions']);_0x98178[_0x2224('0x3c')](_0x317713(_0x48d420[_0x2224('0x83')][_0x2224('0x6a')]));}_0x3a59e9=_0x98178['clone']();_0x98178[_0x2224('0x1d')](_0x1043e6);_0x98178[_0x2224('0x1c')](0x0);logger['debug'](_0x2224('0x87'),_0x98178[_0x2224('0x88')]());return db[_0x2224('0x91')][_0x2224('0x31')](_0x98178[_0x2224('0x88')](),{'type':db['sequelize'][_0x2224('0x89')]['SELECT']});}})[_0x2224('0x24')](function(_0x440e33){if(!_0x440e33[_0x2224('0x37')]){throw new db[(_0x2224('0x6f'))][(_0x2224('0x70'))](_0x2224('0x92'),0xcc);}if(_0x2e543a[_0x2224('0x93')]===_0x2224('0x94')){return null;}var _0x591b70=_[_0x2224('0x3e')](_0x2e543a,{'name':_0x2e543a[_0x2224('0x95')]||_0x2e543a[_0x2224('0x2b')]||_0x48d420[_0x2224('0x2b')],'basename':_0x3d2f35,'savename':util[_0x2224('0x7b')](_0x2224('0x96'),_0x2e543a[_0x2224('0x2b')]||_0x48d420[_0x2224('0x2b')],require(_0x2224('0x97'))[_0x2224('0x98')](0x4),_0x2e543a[_0x2224('0x93')]||_0x2224('0x99')),'reportId':_0x48d420['id'],'reportType':_0x2224('0x9a')});return db[_0x2224('0x9b')][_0x2224('0x49')](_0x591b70,{'raw':!![]});})[_0x2224('0x24')](function(_0xd261b6){if(_0x48d420[_0x2224('0x75')]===_0x2224('0x9c')){_0x3a59e9[_0x2224('0x3c')](_0x48d420['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2e543a[_0x2224('0x9d')],_0x2e543a[_0x2224('0x9e')]);}else{_0x3a59e9['where'](_0x48d420['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e543a[_0x2224('0x9d')],_0x2e543a[_0x2224('0x9e')]);}if(_0xd261b6){logger['info'](_0x2224('0x9f'),_0x3a59e9[_0x2224('0x88')]());require(_0x2224('0xa0'))['fork'](path['join'](__dirname,_0x2224('0xa1'),_0xd261b6['output']),[_0xd261b6['id'],_0x3a59e9['toString'](),path[_0x2224('0x56')](__dirname,_0x2224('0xa2'),_0xd261b6[_0x2224('0xa3')]),_0x3d2f35]);return _0xd261b6;}else{var _0x31df90=squel[_0x2224('0x8e')]();_0x31df90[_0x2224('0x74')]('('+_0x3a59e9[_0x2224('0x88')]()+')',_0x2224('0xa4'));_0x31df90[_0x2224('0x78')](_0x2224('0xa5'),_0x2224('0x40'));_0x3a59e9[_0x2224('0x1d')](_0x2e543a[_0x2224('0x1d')]||_0x1043e6);_0x3a59e9[_0x2224('0x1c')](_0x2e543a[_0x2224('0x1c')]||0x0);return dbH[_0x2224('0x91')][_0x2224('0x31')](_0x31df90[_0x2224('0x88')](),{'type':dbH[_0x2224('0x91')][_0x2224('0x89')][_0x2224('0x8a')]})['then'](function(_0x470b57){if(!_0x470b57[_0x2224('0x37')]){_0x38ff30=0x0;}else{_0x38ff30=_0x470b57[0x0][_0x2224('0x40')]||0x0;}return dbH[_0x2224('0x91')][_0x2224('0x31')](_0x3a59e9[_0x2224('0x88')](),{'type':dbH['sequelize']['QueryTypes'][_0x2224('0x8a')]});})[_0x2224('0x24')](function(_0x5da23f){return{'rows':_0x5da23f||[],'count':_0x38ff30};});}});}exports[_0x2224('0xa6')]=function(_0x4476f0,_0x13d924){return runReport(_0x4476f0[_0x2224('0x54')],_0x4476f0['query'],_0x4476f0[_0x2224('0xa7')])['then'](respondWithResult(_0x13d924,null))[_0x2224('0x45')](handleError(_0x13d924,null));};exports[_0x2224('0xa8')]=runReport;exports[_0x2224('0x31')]=function(_0x2a190c,_0x38d0f2){var _0x338f14=0xa;var _0x5ee9d1=[_0x2224('0x56'),_0x2224('0x57'),_0x2224('0x58'),'cross_join'];var _0x47fd0d={'SUM':_0x2224('0x8b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2224('0x5a'),'MAX':_0x2224('0x5b'),'MIN':_0x2224('0x5c'),'AVG':_0x2224('0x5d'),'GROUP_CONCAT':_0x2224('0x5e'),'GROUP_CONCAT ASC':_0x2224('0x5f'),'GROUP_CONCAT DESC':_0x2224('0x60')};var _0x5d94c2={'SEC_TO_TIME':_0x2224('0x61'),'DATE':_0x2224('0x62'),'HOUR':_0x2224('0x63'),'ROUND':_0x2224('0x8c'),'UNIX_TIMESTAMP':_0x2224('0x64')};var _0x2dee1b=function(_0x1fbac9){return!_['includes']([_0x2224('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1fbac9);};var _0x3e3659=function(_0x503817){if(!_0x503817||!_0x503817['rules'][_0x2224('0x37')]){return'';}for(var _0x4ca8a5='(',_0x4ae1a5=0x0;_0x4ae1a5<_0x503817[_0x2224('0x6b')][_0x2224('0x37')];_0x4ae1a5+=0x1){_0x4ae1a5>0x0&&(_0x4ca8a5+='\x20'+_0x503817[_0x2224('0x69')]+'\x20');_0x4ca8a5+=_0x503817[_0x2224('0x6b')][_0x4ae1a5][_0x2224('0x6a')]?_0x3e3659(_0x503817['rules'][_0x4ae1a5][_0x2224('0x6a')]):_0x503817[_0x2224('0x6b')][_0x4ae1a5][_0x2224('0x78')]+'\x20'+_0x503817[_0x2224('0x6b')][_0x4ae1a5]['condition']+(_0x2dee1b(_0x503817[_0x2224('0x6b')][_0x4ae1a5][_0x2224('0x6c')])?'\x20'+_0x503817[_0x2224('0x6b')][_0x4ae1a5][_0x2224('0x6d')]:'');}return _0x4ca8a5+')';};var _0x5082e4={'where':{'id':_0x2a190c[_0x2224('0x54')]['id']}},_0x32e373,_0x4135f4,_0x4d905d,_0x43a9c4,_0x26978d;_0x5082e4=_['merge']({},_0x5082e4,_0x2a190c['options']);return db[_0x2224('0x42')][_0x2224('0x48')](_0x5082e4)[_0x2224('0x24')](function(_0x404c36){if(_0x404c36){_0x32e373=_0x404c36;return _0x404c36[_0x2224('0x6e')]();}return null;})[_0x2224('0x24')](function(_0x4a8269){if(_0x4a8269){if(!_0x4a8269[_0x2224('0x37')]){throw new db[(_0x2224('0x6f'))][(_0x2224('0x70'))](_0x2224('0x71'),0x193);}_0x4135f4=_0x4a8269;return db[_0x2224('0x72')][_0x2224('0x43')]({'raw':!![]});}return null;})['then'](function(_0x354090){if(_0x354090){_0x4d905d=_[_0x2224('0x73')](_0x354090,'id');var _0x2ad4d0;var _0x60c966=squel[_0x2224('0x8e')]();_0x60c966['from'](_0x32e373['table']);for(var _0x137af4=0x0;_0x137af4<_0x4135f4[_0x2224('0x37')];_0x137af4+=0x1){_0x2ad4d0=_0x4135f4[_0x137af4][_0x2224('0x76')]?_0x4d905d[_0x4135f4[_0x137af4]['MetricId']][_0x2224('0x77')]:_0x4135f4[_0x137af4][_0x2224('0x78')];_0x2ad4d0=_0x4135f4[_0x137af4][_0x2224('0x7a')]?_[_0x2224('0x79')](_0x47fd0d[_0x4135f4[_0x137af4][_0x2224('0x7a')]],'%s',_0x2ad4d0):_0x2ad4d0;_0x2ad4d0=_0x4135f4[_0x137af4]['format']?_['replace'](_0x5d94c2[_0x4135f4[_0x137af4][_0x2224('0x7b')]],'%s',_0x2ad4d0):_0x2ad4d0;if(_0x4135f4[_0x137af4][_0x2224('0x8f')]){_0x60c966[_0x2224('0x6a')](_0x2ad4d0);}_0x4135f4[_0x137af4][_0x2224('0x7c')]&&_0x60c966[_0x2224('0x3a')](_0x2ad4d0,_0x4135f4[_0x137af4][_0x2224('0x7c')]===_0x2224('0x7d')?![]:!![]);_0x60c966[_0x2224('0x78')](_0x2ad4d0,_0x4135f4[_0x137af4][_0x2224('0x7e')]||_0x2ad4d0);}if(_0x32e373[_0x2224('0x7f')]){_0x32e373[_0x2224('0x7f')]=JSON['parse'](_0x32e373[_0x2224('0x7f')]);for(var _0xb3b07f=0x0;_0xb3b07f<_0x32e373['joins'][_0x2224('0x37')];_0xb3b07f+=0x1){if(_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x2e')]&&_[_0x2224('0x8d')](_0x5ee9d1,_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x2e')])&&_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x90')]&&_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x80')]&&_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x81')]){_0x60c966[_0x32e373[_0x2224('0x7f')][_0xb3b07f][_0x2224('0x2e')]](_0x32e373['joins'][_0xb3b07f][_0x2224('0x80')],null,util[_0x2224('0x7b')](_0x2224('0x82'),_0x32e373[_0x2224('0x75')],_0x32e373['joins'][_0xb3b07f][_0x2224('0x90')],_0x32e373['joins'][_0xb3b07f][_0x2224('0x80')],_0x32e373['joins'][_0xb3b07f][_0x2224('0x81')]));}}}if(_0x32e373[_0x2224('0x83')]){_0x32e373[_0x2224('0x83')]=JSON[_0x2224('0x84')](_0x32e373[_0x2224('0x83')]);_0x60c966[_0x2224('0x3c')](_0x3e3659(_0x32e373[_0x2224('0x83')][_0x2224('0x6a')]));}_0x26978d=_0x60c966[_0x2224('0x85')]();_0x60c966[_0x2224('0x1d')](_0x338f14);_0x60c966[_0x2224('0x1c')](0x0);logger[_0x2224('0x86')](_0x2224('0x87'),_0x60c966['toString']());return db['sequelize']['query'](_0x60c966[_0x2224('0x88')](),{'type':db[_0x2224('0x91')][_0x2224('0x89')][_0x2224('0x8a')]});}})['then'](function(){return{'sql':_0x26978d[_0x2224('0x88')]()};})[_0x2224('0x24')](respondWithResult(_0x38d0f2,null))[_0x2224('0x45')](handleError(_0x38d0f2,null));}; \ No newline at end of file +var _0x032a=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','toString','sequelize','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NOT\x20EMPTY','Sequelize','findAll','function','groupBy','Limited\x20Query:','QueryTypes','ValidationErrorItem','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','cross_join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','CustomReports','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x032a,0xf0));var _0xa032=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x032a[_0x35d8af];return _0x1d08b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa032('0x1'));var jsonpatch=require(_0xa032('0x2'));var rp=require(_0xa032('0x3'));var moment=require(_0xa032('0x4'));var BPromise=require(_0xa032('0x5'));var Mustache=require(_0xa032('0x6'));var util=require(_0xa032('0x7'));var path=require(_0xa032('0x8'));var sox=require(_0xa032('0x9'));var csv=require(_0xa032('0xa'));var ejs=require(_0xa032('0xb'));var fs=require('fs');var _=require(_0xa032('0xc'));var squel=require('squel');var crypto=require(_0xa032('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa032('0xa'));var querystring=require('querystring');var Papa=require(_0xa032('0xe'));var Redis=require(_0xa032('0xf'));var authService=require(_0xa032('0x10'));var qs=require(_0xa032('0x11'));var as=require(_0xa032('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa032('0x13'))(_0xa032('0x14'));var utils=require('../../config/utils');var config=require(_0xa032('0x15'));var db=require(_0xa032('0x16'))['db'];var dbH=require(_0xa032('0x16'))[_0xa032('0x17')];function respondWithStatusCode(_0x45fb4d,_0x502721){_0x502721=_0x502721||0xcc;return function(_0x358639){if(_0x358639){return _0x45fb4d[_0xa032('0x18')](_0x502721);}return _0x45fb4d[_0xa032('0x19')](_0x502721)[_0xa032('0x1a')]();};}function respondWithResult(_0x39ff1f,_0x18ceac){_0x18ceac=_0x18ceac||0xc8;return function(_0x3a330f){if(_0x3a330f){return _0x39ff1f[_0xa032('0x19')](_0x18ceac)[_0xa032('0x1b')](_0x3a330f);}};}function respondWithFilteredResult(_0x3d02b2,_0x4a7381){return function(_0x12e1ec){if(_0x12e1ec){var _0x2f5323=_0x12e1ec[_0xa032('0x1c')],_0x22a6bb=_0x4a7381[_0xa032('0x1d')],_0x2caacd=_0x4a7381['offset']+_0x4a7381[_0xa032('0x1e')],_0x27f079;if(_0x2caacd>=_0x2f5323){_0x2caacd=_0x2f5323;_0x27f079=0xc8;}else{_0x27f079=0xce;}_0x3d02b2['status'](_0x27f079);return _0x3d02b2[_0xa032('0x1f')](_0xa032('0x20'),_0x22a6bb+'-'+_0x2caacd+'/'+_0x2f5323)[_0xa032('0x1b')](_0x12e1ec);}return null;};}function patchUpdates(_0x491c64){return function(_0x196947){try{jsonpatch['apply'](_0x196947,_0x491c64,!![]);}catch(_0x45d333){return BPromise[_0xa032('0x21')](_0x45d333);}return _0x196947[_0xa032('0x22')]();};}function saveUpdates(_0x2a0f24,_0x281b6e){return function(_0x27772f){if(_0x27772f){return _0x27772f['update'](_0x2a0f24)[_0xa032('0x23')](function(_0x3f65c2){return _0x3f65c2;});}return null;};}function removeEntity(_0x5a817b,_0x3b5d0e){return function(_0x515a61){if(_0x515a61){return _0x515a61[_0xa032('0x24')]()['then'](function(){var _0x15291f=_0x515a61['get']({'plain':!![]});var _0x2ef8c8=_0xa032('0x25');return db['UserProfileResource'][_0xa032('0x24')]({'where':{'type':_0x2ef8c8,'resourceId':_0x15291f['id']}})[_0xa032('0x23')](function(){return _0x515a61;});})['then'](function(){_0x5a817b['status'](0xcc)[_0xa032('0x1a')]();});}};}function handleEntityNotFound(_0x2f290c,_0x3bf2ce){return function(_0x5889f4){if(!_0x5889f4){_0x2f290c['sendStatus'](0x194);}return _0x5889f4;};}function handleError(_0x2e63f6,_0x12ab93){_0x12ab93=_0x12ab93||0x1f4;return function(_0x282ce0){logger[_0xa032('0x26')](_0x282ce0['stack']);if(_0x282ce0[_0xa032('0x27')]){delete _0x282ce0[_0xa032('0x27')];}_0x2e63f6[_0xa032('0x19')](_0x12ab93)[_0xa032('0x28')](_0x282ce0);};}exports[_0xa032('0x29')]=function(_0x3b0161,_0x55f2f1){var _0x25da7c={},_0x189d63={},_0xcb3904={'count':0x0,'rows':[]};var _0x596c3d=_[_0xa032('0x2a')](db[_0xa032('0x2b')][_0xa032('0x2c')],function(_0x5b99ff){return{'name':_0x5b99ff[_0xa032('0x2d')],'type':_0x5b99ff[_0xa032('0x2e')][_0xa032('0x2f')]};});_0x189d63[_0xa032('0x30')]=_[_0xa032('0x2a')](_0x596c3d,_0xa032('0x27'));_0x189d63[_0xa032('0x31')]=_[_0xa032('0x32')](_0x3b0161['query']);_0x189d63['filters']=_[_0xa032('0x33')](_0x189d63[_0xa032('0x30')],_0x189d63['query']);_0x25da7c[_0xa032('0x34')]=_[_0xa032('0x33')](_0x189d63[_0xa032('0x30')],qs[_0xa032('0x35')](_0x3b0161[_0xa032('0x31')][_0xa032('0x35')]));_0x25da7c[_0xa032('0x34')]=_0x25da7c[_0xa032('0x34')][_0xa032('0x36')]?_0x25da7c[_0xa032('0x34')]:_0x189d63[_0xa032('0x30')];if(!_0x3b0161[_0xa032('0x31')][_0xa032('0x37')](_0xa032('0x38'))){_0x25da7c[_0xa032('0x1e')]=qs['limit'](_0x3b0161[_0xa032('0x31')][_0xa032('0x1e')]);_0x25da7c[_0xa032('0x1d')]=qs[_0xa032('0x1d')](_0x3b0161[_0xa032('0x31')][_0xa032('0x1d')]);}_0x25da7c[_0xa032('0x39')]=qs[_0xa032('0x3a')](_0x3b0161['query'][_0xa032('0x3a')]);_0x25da7c[_0xa032('0x3b')]=qs[_0xa032('0x3c')](_[_0xa032('0x3d')](_0x3b0161[_0xa032('0x31')],_0x189d63[_0xa032('0x3c')]),_0x596c3d);if(_0x3b0161[_0xa032('0x31')]['filter']){_0x25da7c[_0xa032('0x3b')]=_[_0xa032('0x3e')](_0x25da7c[_0xa032('0x3b')],{'$or':_['map'](_0x596c3d,function(_0x43f801){if(_0x43f801[_0xa032('0x2e')]!==_0xa032('0x3f')){var _0x5ce4f1={};_0x5ce4f1[_0x43f801[_0xa032('0x27')]]={'$like':'%'+_0x3b0161['query'][_0xa032('0x40')]+'%'};return _0x5ce4f1;}})});}_0x25da7c=_[_0xa032('0x3e')]({},_0x25da7c,_0x3b0161['options']);var _0x3cd9c7={'where':_0x25da7c[_0xa032('0x3b')]};return db[_0xa032('0x2b')][_0xa032('0x1c')](_0x3cd9c7)[_0xa032('0x23')](function(_0x5f410f){_0xcb3904[_0xa032('0x1c')]=_0x5f410f;if(_0x3b0161[_0xa032('0x31')][_0xa032('0x41')]){_0x25da7c['include']=[{'all':!![]}];}return db[_0xa032('0x2b')]['findAll'](_0x25da7c);})[_0xa032('0x23')](function(_0x10e99b){_0xcb3904[_0xa032('0x42')]=_0x10e99b;return _0xcb3904;})[_0xa032('0x23')](respondWithFilteredResult(_0x55f2f1,_0x25da7c))[_0xa032('0x43')](handleError(_0x55f2f1,null));};exports[_0xa032('0x44')]=function(_0x1df7b4,_0x3bcd09){var _0x5ddb25={'raw':![],'where':{'id':_0x1df7b4[_0xa032('0x45')]['id']}},_0x32a415={};_0x32a415[_0xa032('0x30')]=_[_0xa032('0x32')](db['AnalyticCustomReport'][_0xa032('0x2c')]);_0x32a415[_0xa032('0x31')]=_[_0xa032('0x32')](_0x1df7b4[_0xa032('0x31')]);_0x32a415[_0xa032('0x3c')]=_[_0xa032('0x33')](_0x32a415['model'],_0x32a415[_0xa032('0x31')]);_0x5ddb25['attributes']=_['intersection'](_0x32a415[_0xa032('0x30')],qs[_0xa032('0x35')](_0x1df7b4[_0xa032('0x31')][_0xa032('0x35')]));_0x5ddb25[_0xa032('0x34')]=_0x5ddb25[_0xa032('0x34')][_0xa032('0x36')]?_0x5ddb25[_0xa032('0x34')]:_0x32a415[_0xa032('0x30')];if(_0x1df7b4[_0xa032('0x31')][_0xa032('0x41')]){_0x5ddb25['include']=[{'all':!![]}];}_0x5ddb25=_[_0xa032('0x3e')]({},_0x5ddb25,_0x1df7b4[_0xa032('0x46')]);return db[_0xa032('0x2b')]['find'](_0x5ddb25)['then'](handleEntityNotFound(_0x3bcd09,null))['then'](respondWithResult(_0x3bcd09,null))[_0xa032('0x43')](handleError(_0x3bcd09,null));};exports['create']=function(_0x2a5369,_0x357668){return db[_0xa032('0x2b')][_0xa032('0x47')](_0x2a5369[_0xa032('0x48')],{})[_0xa032('0x23')](function(_0x3506b4){var _0x23d118=_0x2a5369['user'][_0xa032('0x49')]({'plain':!![]});if(!_0x23d118)throw new Error(_0xa032('0x4a'));if(_0x23d118[_0xa032('0x4b')]===_0xa032('0x4c')){var _0x251eb3=_0x3506b4[_0xa032('0x49')]({'plain':!![]});var _0x3d4d99=_0xa032('0x4d');return db[_0xa032('0x4e')][_0xa032('0x4f')]({'where':{'name':_0x3d4d99,'userProfileId':_0x23d118['userProfileId']},'raw':!![]})['then'](function(_0x528d4e){if(_0x528d4e&&_0x528d4e[_0xa032('0x50')]===0x0){return db[_0xa032('0x51')][_0xa032('0x47')]({'name':_0x251eb3[_0xa032('0x27')],'resourceId':_0x251eb3['id'],'type':'CustomReports','sectionId':_0x528d4e['id']},{})['then'](function(){return _0x3506b4;});}else{return _0x3506b4;}})[_0xa032('0x43')](function(_0x4796bf){logger['error'](_0xa032('0x52'),_0x4796bf);throw _0x4796bf;});}return _0x3506b4;})[_0xa032('0x23')](respondWithResult(_0x357668,0xc9))['catch'](handleError(_0x357668,null));};exports[_0xa032('0x53')]=function(_0x54602b,_0x170444){if(_0x54602b[_0xa032('0x48')]['id']){delete _0x54602b[_0xa032('0x48')]['id'];}return db['AnalyticCustomReport'][_0xa032('0x4f')]({'where':{'id':_0x54602b['params']['id']}})[_0xa032('0x23')](handleEntityNotFound(_0x170444,null))[_0xa032('0x23')](saveUpdates(_0x54602b['body'],null))[_0xa032('0x23')](respondWithResult(_0x170444,null))[_0xa032('0x43')](handleError(_0x170444,null));};exports[_0xa032('0x24')]=function(_0x5bc103,_0x2b6499){return db[_0xa032('0x2b')][_0xa032('0x4f')]({'where':{'id':_0x5bc103[_0xa032('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b6499,null))[_0xa032('0x23')](removeEntity(_0x2b6499,null))[_0xa032('0x43')](handleError(_0x2b6499,null));};exports['preview']=function(_0x2c1aa2,_0x34584d){var _0x4a893b=0xa;var _0x3d5c00=[_0xa032('0x54'),_0xa032('0x55'),_0xa032('0x56'),'cross_join'];var _0x1cde6e={'SUM':_0xa032('0x57'),'COUNT':_0xa032('0x58'),'COUNT DISTINCT':_0xa032('0x59'),'MAX':_0xa032('0x5a'),'MIN':_0xa032('0x5b'),'AVG':_0xa032('0x5c'),'GROUP_CONCAT':_0xa032('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa032('0x5e')};var _0x18ac40={'SEC_TO_TIME':_0xa032('0x5f'),'DATE':_0xa032('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xa032('0x61'),'UNIX_TIMESTAMP':_0xa032('0x62')};var _0x5e7fa1=function(_0x5ecf41){return!_[_0xa032('0x63')]([_0xa032('0x64'),_0xa032('0x65'),_0xa032('0x66'),'IS\x20NOT\x20EMPTY'],_0x5ecf41);};var _0x61bcb3=function(_0x20c789){if(!_0x20c789||!_0x20c789['rules'][_0xa032('0x36')]){return'';}for(var _0xf33bb5='(',_0x8ed32c=0x0;_0x8ed32c<_0x20c789['rules'][_0xa032('0x36')];_0x8ed32c+=0x1){_0x8ed32c>0x0&&(_0xf33bb5+='\x20'+_0x20c789[_0xa032('0x67')]+'\x20');_0xf33bb5+=_0x20c789[_0xa032('0x68')][_0x8ed32c][_0xa032('0x69')]?_0x61bcb3(_0x20c789['rules'][_0x8ed32c][_0xa032('0x69')]):_0x20c789['rules'][_0x8ed32c][_0xa032('0x6a')]+'\x20'+_0x20c789['rules'][_0x8ed32c][_0xa032('0x6b')]+(_0x5e7fa1(_0x20c789[_0xa032('0x68')][_0x8ed32c][_0xa032('0x6b')])?'\x20'+_0x20c789[_0xa032('0x68')][_0x8ed32c][_0xa032('0x6c')]:'');}return _0xf33bb5+')';};var _0x39f219={'where':{'id':_0x2c1aa2[_0xa032('0x45')]['id']}},_0x392f69,_0x19a96b,_0x304ca5,_0x44155e,_0x890c52;_0x39f219=_[_0xa032('0x3e')]({},_0x39f219,_0x2c1aa2[_0xa032('0x46')]);return db[_0xa032('0x2b')][_0xa032('0x4f')](_0x39f219)[_0xa032('0x23')](function(_0x466a59){if(_0x466a59){_0x392f69=_0x466a59;return _0x466a59[_0xa032('0x6d')]();}return null;})['then'](function(_0x4ea066){if(_0x4ea066){if(!_0x4ea066['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xa032('0x6e'),0x193);}_0x19a96b=_0x4ea066;return db[_0xa032('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xa032('0x23')](function(_0x5432d1){if(_0x5432d1){_0x304ca5=_[_0xa032('0x70')](_0x5432d1,'id');var _0x50916e;var _0x5e59f1=squel[_0xa032('0x71')]();_0x5e59f1[_0xa032('0x72')](_0x392f69[_0xa032('0x73')]);for(var _0x52cb83=0x0;_0x52cb83<_0x19a96b[_0xa032('0x36')];_0x52cb83+=0x1){_0x50916e=_0x19a96b[_0x52cb83][_0xa032('0x74')]?_0x304ca5[_0x19a96b[_0x52cb83][_0xa032('0x74')]][_0xa032('0x75')]:_0x19a96b[_0x52cb83][_0xa032('0x6a')];_0x50916e=_0x19a96b[_0x52cb83]['function']?_[_0xa032('0x76')](_0x1cde6e[_0x19a96b[_0x52cb83]['function']],'%s',_0x50916e):_0x50916e;_0x50916e=_0x19a96b[_0x52cb83][_0xa032('0x77')]?_['replace'](_0x18ac40[_0x19a96b[_0x52cb83][_0xa032('0x77')]],'%s',_0x50916e):_0x50916e;if(_0x19a96b[_0x52cb83]['groupBy']){_0x5e59f1['group'](_0x50916e);}_0x19a96b[_0x52cb83][_0xa032('0x78')]&&_0x5e59f1['order'](_0x50916e,_0x19a96b[_0x52cb83][_0xa032('0x78')]===_0xa032('0x79')?![]:!![]);_0x5e59f1[_0xa032('0x6a')](_0x50916e,_0x19a96b[_0x52cb83][_0xa032('0x7a')]||_0x50916e);}if(_0x392f69[_0xa032('0x7b')]){_0x392f69[_0xa032('0x7b')]=JSON[_0xa032('0x7c')](_0x392f69[_0xa032('0x7b')]);for(var _0x5b64d6=0x0;_0x5b64d6<_0x392f69['joins'][_0xa032('0x36')];_0x5b64d6+=0x1){if(_0x392f69[_0xa032('0x7b')][_0x5b64d6]['type']&&_['includes'](_0x3d5c00,_0x392f69[_0xa032('0x7b')][_0x5b64d6][_0xa032('0x2e')])&&_0x392f69['joins'][_0x5b64d6][_0xa032('0x7d')]&&_0x392f69['joins'][_0x5b64d6][_0xa032('0x7e')]&&_0x392f69['joins'][_0x5b64d6]['foreignKey']){_0x5e59f1[_0x392f69[_0xa032('0x7b')][_0x5b64d6][_0xa032('0x2e')]](_0x392f69['joins'][_0x5b64d6][_0xa032('0x7e')],null,util[_0xa032('0x77')](_0xa032('0x7f'),_0x392f69[_0xa032('0x73')],_0x392f69[_0xa032('0x7b')][_0x5b64d6][_0xa032('0x7d')],_0x392f69[_0xa032('0x7b')][_0x5b64d6][_0xa032('0x7e')],_0x392f69['joins'][_0x5b64d6][_0xa032('0x80')]));}}}if(_0x392f69[_0xa032('0x81')]){_0x392f69[_0xa032('0x81')]=JSON[_0xa032('0x7c')](_0x392f69[_0xa032('0x81')]);_0x5e59f1[_0xa032('0x3b')](_0x61bcb3(_0x392f69[_0xa032('0x81')][_0xa032('0x69')]));}_0x890c52=_0x5e59f1[_0xa032('0x82')]();_0x5e59f1[_0xa032('0x1e')](_0x4a893b);_0x5e59f1[_0xa032('0x1d')](0x0);logger[_0xa032('0x83')]('Limited\x20Query:',_0x5e59f1[_0xa032('0x84')]());return db[_0xa032('0x85')]['query'](_0x5e59f1[_0xa032('0x84')](),{'type':db[_0xa032('0x85')]['QueryTypes'][_0xa032('0x86')]});}})[_0xa032('0x23')](respondWithResult(_0x34584d,null))[_0xa032('0x43')](handleError(_0x34584d,null));};function runReport(_0x23e108,_0x162972,_0xbb62b3){var _0x58ffa3=_0x162972['name'];var _0x19b0a3=0xa;var _0x3974c9=[_0xa032('0x54'),_0xa032('0x55'),_0xa032('0x56'),'cross_join'];var _0x58edc3={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa032('0x59'),'MAX':'MAX(%s)','MIN':_0xa032('0x5b'),'AVG':_0xa032('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa032('0x87'),'GROUP_CONCAT DESC':_0xa032('0x5e')};var _0xe38fa7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa032('0x60'),'HOUR':_0xa032('0x88'),'ROUND':_0xa032('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a5ca0=function(_0x4bd4a5){return!_['includes']([_0xa032('0x64'),'IS\x20NOT\x20NULL',_0xa032('0x66'),_0xa032('0x89')],_0x4bd4a5);};var _0x4055f9=function(_0x3b9fa6){if(!_0x3b9fa6||!_0x3b9fa6[_0xa032('0x68')]['length']){return'';}for(var _0x35b913='(',_0xb44c79=0x0;_0xb44c79<_0x3b9fa6[_0xa032('0x68')][_0xa032('0x36')];_0xb44c79+=0x1){_0xb44c79>0x0&&(_0x35b913+='\x20'+_0x3b9fa6[_0xa032('0x67')]+'\x20');_0x35b913+=_0x3b9fa6[_0xa032('0x68')][_0xb44c79][_0xa032('0x69')]?_0x4055f9(_0x3b9fa6['rules'][_0xb44c79]['group']):_0x3b9fa6[_0xa032('0x68')][_0xb44c79][_0xa032('0x6a')]+'\x20'+_0x3b9fa6['rules'][_0xb44c79][_0xa032('0x6b')]+(_0x5a5ca0(_0x3b9fa6[_0xa032('0x68')][_0xb44c79][_0xa032('0x6b')])?'\x20'+_0x3b9fa6[_0xa032('0x68')][_0xb44c79]['value']:'');}return _0x35b913+')';};var _0x19ec51={'where':{'id':_0x23e108['id']}},_0x1a8d10,_0x4903cd,_0x426b78,_0x52b72f,_0x127f38;_0x19ec51=_[_0xa032('0x3e')]({},_0x19ec51,_0xbb62b3);return db[_0xa032('0x2b')][_0xa032('0x4f')](_0x19ec51)[_0xa032('0x23')](function(_0xfc12a9){if(_0xfc12a9){_0x1a8d10=_0xfc12a9;return _0xfc12a9[_0xa032('0x6d')]();}return null;})['then'](function(_0x5c5255){if(_0x5c5255){if(!_0x5c5255['length']){throw new db[(_0xa032('0x8a'))]['ValidationErrorItem'](_0xa032('0x6e'),0x193);}_0x4903cd=_0x5c5255;return db[_0xa032('0x6f')][_0xa032('0x8b')]({'raw':!![]});}return null;})[_0xa032('0x23')](function(_0x5d2672){if(_0x5d2672){_0x426b78=_[_0xa032('0x70')](_0x5d2672,'id');var _0x2778f2;var _0x98340e=squel[_0xa032('0x71')]();_0x98340e[_0xa032('0x72')](_0x1a8d10[_0xa032('0x73')]);for(var _0x523c28=0x0;_0x523c28<_0x4903cd[_0xa032('0x36')];_0x523c28+=0x1){_0x2778f2=_0x4903cd[_0x523c28]['MetricId']?_0x426b78[_0x4903cd[_0x523c28][_0xa032('0x74')]][_0xa032('0x75')]:_0x4903cd[_0x523c28][_0xa032('0x6a')];_0x2778f2=_0x4903cd[_0x523c28][_0xa032('0x8c')]?_[_0xa032('0x76')](_0x58edc3[_0x4903cd[_0x523c28][_0xa032('0x8c')]],'%s',_0x2778f2):_0x2778f2;_0x2778f2=_0x4903cd[_0x523c28][_0xa032('0x77')]?_[_0xa032('0x76')](_0xe38fa7[_0x4903cd[_0x523c28][_0xa032('0x77')]],'%s',_0x2778f2):_0x2778f2;if(_0x4903cd[_0x523c28][_0xa032('0x8d')]){_0x98340e[_0xa032('0x69')](_0x2778f2);}_0x4903cd[_0x523c28][_0xa032('0x78')]&&_0x98340e[_0xa032('0x39')](_0x2778f2,_0x4903cd[_0x523c28][_0xa032('0x78')]===_0xa032('0x79')?![]:!![]);_0x98340e['field'](_0x2778f2,_0x4903cd[_0x523c28]['alias']||_0x2778f2);}if(_0x1a8d10[_0xa032('0x7b')]){_0x1a8d10[_0xa032('0x7b')]=JSON[_0xa032('0x7c')](_0x1a8d10[_0xa032('0x7b')]);for(var _0x42de56=0x0;_0x42de56<_0x1a8d10[_0xa032('0x7b')][_0xa032('0x36')];_0x42de56+=0x1){if(_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x2e')]&&_[_0xa032('0x63')](_0x3974c9,_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x2e')])&&_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x7d')]&&_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x7e')]&&_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x80')]){_0x98340e[_0x1a8d10[_0xa032('0x7b')][_0x42de56]['type']](_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x7e')],null,util[_0xa032('0x77')](_0xa032('0x7f'),_0x1a8d10[_0xa032('0x73')],_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x7d')],_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x7e')],_0x1a8d10[_0xa032('0x7b')][_0x42de56][_0xa032('0x80')]));}}}if(_0x1a8d10[_0xa032('0x81')]){_0x1a8d10[_0xa032('0x81')]=JSON['parse'](_0x1a8d10['conditions']);_0x98340e[_0xa032('0x3b')](_0x4055f9(_0x1a8d10[_0xa032('0x81')][_0xa032('0x69')]));}_0x127f38=_0x98340e['clone']();_0x98340e[_0xa032('0x1e')](_0x19b0a3);_0x98340e['offset'](0x0);logger[_0xa032('0x83')](_0xa032('0x8e'),_0x98340e['toString']());return db[_0xa032('0x85')]['query'](_0x98340e['toString'](),{'type':db[_0xa032('0x85')][_0xa032('0x8f')][_0xa032('0x86')]});}})[_0xa032('0x23')](function(_0x17ce17){if(!_0x17ce17['length']){throw new db[(_0xa032('0x8a'))][(_0xa032('0x90'))](_0xa032('0x91'),0xcc);}if(_0x162972['output']===_0xa032('0x92')){return null;}var _0x4a30cf=_[_0xa032('0x3e')](_0x162972,{'name':_0x162972[_0xa032('0x93')]||_0x162972[_0xa032('0x27')]||_0x1a8d10[_0xa032('0x27')],'basename':_0x58ffa3,'savename':util[_0xa032('0x77')](_0xa032('0x94'),_0x162972[_0xa032('0x27')]||_0x1a8d10['name'],require(_0xa032('0x95'))[_0xa032('0x96')](0x4),_0x162972[_0xa032('0x97')]||_0xa032('0x98')),'reportId':_0x1a8d10['id'],'reportType':_0xa032('0x99')});return db[_0xa032('0x9a')][_0xa032('0x47')](_0x4a30cf,{'raw':!![]});})[_0xa032('0x23')](function(_0x48c35e){if(_0x1a8d10['table']==='cdr'){_0x127f38[_0xa032('0x3b')](_0x1a8d10[_0xa032('0x73')]+_0xa032('0x9b'),_0x162972[_0xa032('0x9c')],_0x162972[_0xa032('0x9d')]);}else{_0x127f38[_0xa032('0x3b')](_0x1a8d10[_0xa032('0x73')]+_0xa032('0x9e'),_0x162972[_0xa032('0x9c')],_0x162972['endDate']);}if(_0x48c35e){logger[_0xa032('0x9f')]('Run\x20Query:',_0x127f38[_0xa032('0x84')]());require('child_process')['fork'](path[_0xa032('0x54')](__dirname,_0xa032('0xa0'),_0x48c35e[_0xa032('0x97')]),[_0x48c35e['id'],_0x127f38['toString'](),path[_0xa032('0x54')](__dirname,_0xa032('0xa1'),_0x48c35e[_0xa032('0xa2')]),_0x58ffa3]);return _0x48c35e;}else{var _0x2982eb=squel[_0xa032('0x71')]();_0x2982eb[_0xa032('0x72')]('('+_0x127f38[_0xa032('0x84')]()+')','countTable');_0x2982eb['field'](_0xa032('0xa3'),_0xa032('0x1c'));_0x127f38[_0xa032('0x1e')](_0x162972[_0xa032('0x1e')]||_0x19b0a3);_0x127f38[_0xa032('0x1d')](_0x162972[_0xa032('0x1d')]||0x0);return dbH['sequelize'][_0xa032('0x31')](_0x2982eb[_0xa032('0x84')](),{'type':dbH[_0xa032('0x85')]['QueryTypes']['SELECT']})[_0xa032('0x23')](function(_0x37a59f){if(!_0x37a59f[_0xa032('0x36')]){_0x52b72f=0x0;}else{_0x52b72f=_0x37a59f[0x0][_0xa032('0x1c')]||0x0;}return dbH[_0xa032('0x85')][_0xa032('0x31')](_0x127f38['toString'](),{'type':dbH[_0xa032('0x85')][_0xa032('0x8f')][_0xa032('0x86')]});})['then'](function(_0x5a2e57){return{'rows':_0x5a2e57||[],'count':_0x52b72f};});}});}exports[_0xa032('0xa4')]=function(_0x2b5429,_0x27f651){return runReport(_0x2b5429[_0xa032('0x45')],_0x2b5429[_0xa032('0x31')],_0x2b5429['options'])[_0xa032('0x23')](respondWithResult(_0x27f651,null))[_0xa032('0x43')](handleError(_0x27f651,null));};exports[_0xa032('0xa5')]=runReport;exports[_0xa032('0x31')]=function(_0x535b02,_0x154f07){var _0x2c8e0d=0xa;var _0x53f865=['join',_0xa032('0x55'),'right_join',_0xa032('0xa6')];var _0xf3cbf8={'SUM':_0xa032('0x57'),'COUNT':_0xa032('0x58'),'COUNT DISTINCT':_0xa032('0x59'),'MAX':_0xa032('0x5a'),'MIN':'MIN(%s)','AVG':_0xa032('0x5c'),'GROUP_CONCAT':_0xa032('0x5d'),'GROUP_CONCAT ASC':_0xa032('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x502d8a={'SEC_TO_TIME':_0xa032('0x5f'),'DATE':_0xa032('0x60'),'HOUR':_0xa032('0x88'),'ROUND':_0xa032('0x61'),'UNIX_TIMESTAMP':_0xa032('0x62')};var _0x30aaa6=function(_0x343707){return!_[_0xa032('0x63')]([_0xa032('0x64'),_0xa032('0x65'),'IS\x20EMPTY',_0xa032('0x89')],_0x343707);};var _0x229477=function(_0x435fd5){if(!_0x435fd5||!_0x435fd5[_0xa032('0x68')][_0xa032('0x36')]){return'';}for(var _0x4fd3f8='(',_0x3b08cd=0x0;_0x3b08cd<_0x435fd5['rules'][_0xa032('0x36')];_0x3b08cd+=0x1){_0x3b08cd>0x0&&(_0x4fd3f8+='\x20'+_0x435fd5[_0xa032('0x67')]+'\x20');_0x4fd3f8+=_0x435fd5['rules'][_0x3b08cd][_0xa032('0x69')]?_0x229477(_0x435fd5[_0xa032('0x68')][_0x3b08cd][_0xa032('0x69')]):_0x435fd5[_0xa032('0x68')][_0x3b08cd][_0xa032('0x6a')]+'\x20'+_0x435fd5[_0xa032('0x68')][_0x3b08cd][_0xa032('0x6b')]+(_0x30aaa6(_0x435fd5[_0xa032('0x68')][_0x3b08cd]['condition'])?'\x20'+_0x435fd5[_0xa032('0x68')][_0x3b08cd]['value']:'');}return _0x4fd3f8+')';};var _0x3eab8d={'where':{'id':_0x535b02[_0xa032('0x45')]['id']}},_0x227937,_0x494690,_0x33b0fd,_0x8effc0,_0x13aa21;_0x3eab8d=_[_0xa032('0x3e')]({},_0x3eab8d,_0x535b02[_0xa032('0x46')]);return db[_0xa032('0x2b')]['find'](_0x3eab8d)[_0xa032('0x23')](function(_0x47657e){if(_0x47657e){_0x227937=_0x47657e;return _0x47657e[_0xa032('0x6d')]();}return null;})[_0xa032('0x23')](function(_0x1ad278){if(_0x1ad278){if(!_0x1ad278[_0xa032('0x36')]){throw new db[(_0xa032('0x8a'))][(_0xa032('0x90'))](_0xa032('0x6e'),0x193);}_0x494690=_0x1ad278;return db[_0xa032('0x6f')][_0xa032('0x8b')]({'raw':!![]});}return null;})[_0xa032('0x23')](function(_0x57b4a5){if(_0x57b4a5){_0x33b0fd=_[_0xa032('0x70')](_0x57b4a5,'id');var _0x521fa5;var _0x466497=squel[_0xa032('0x71')]();_0x466497[_0xa032('0x72')](_0x227937['table']);for(var _0x5077e0=0x0;_0x5077e0<_0x494690[_0xa032('0x36')];_0x5077e0+=0x1){_0x521fa5=_0x494690[_0x5077e0][_0xa032('0x74')]?_0x33b0fd[_0x494690[_0x5077e0]['MetricId']]['metric']:_0x494690[_0x5077e0][_0xa032('0x6a')];_0x521fa5=_0x494690[_0x5077e0][_0xa032('0x8c')]?_[_0xa032('0x76')](_0xf3cbf8[_0x494690[_0x5077e0][_0xa032('0x8c')]],'%s',_0x521fa5):_0x521fa5;_0x521fa5=_0x494690[_0x5077e0][_0xa032('0x77')]?_[_0xa032('0x76')](_0x502d8a[_0x494690[_0x5077e0]['format']],'%s',_0x521fa5):_0x521fa5;if(_0x494690[_0x5077e0]['groupBy']){_0x466497['group'](_0x521fa5);}_0x494690[_0x5077e0][_0xa032('0x78')]&&_0x466497[_0xa032('0x39')](_0x521fa5,_0x494690[_0x5077e0][_0xa032('0x78')]==='DESC'?![]:!![]);_0x466497[_0xa032('0x6a')](_0x521fa5,_0x494690[_0x5077e0][_0xa032('0x7a')]||_0x521fa5);}if(_0x227937[_0xa032('0x7b')]){_0x227937[_0xa032('0x7b')]=JSON[_0xa032('0x7c')](_0x227937[_0xa032('0x7b')]);for(var _0x3a2c6c=0x0;_0x3a2c6c<_0x227937['joins'][_0xa032('0x36')];_0x3a2c6c+=0x1){if(_0x227937[_0xa032('0x7b')][_0x3a2c6c][_0xa032('0x2e')]&&_[_0xa032('0x63')](_0x53f865,_0x227937[_0xa032('0x7b')][_0x3a2c6c][_0xa032('0x2e')])&&_0x227937['joins'][_0x3a2c6c]['parentKey']&&_0x227937['joins'][_0x3a2c6c][_0xa032('0x7e')]&&_0x227937[_0xa032('0x7b')][_0x3a2c6c][_0xa032('0x80')]){_0x466497[_0x227937[_0xa032('0x7b')][_0x3a2c6c]['type']](_0x227937[_0xa032('0x7b')][_0x3a2c6c][_0xa032('0x7e')],null,util[_0xa032('0x77')](_0xa032('0x7f'),_0x227937['table'],_0x227937['joins'][_0x3a2c6c][_0xa032('0x7d')],_0x227937[_0xa032('0x7b')][_0x3a2c6c]['foreignTable'],_0x227937[_0xa032('0x7b')][_0x3a2c6c][_0xa032('0x80')]));}}}if(_0x227937['conditions']){_0x227937[_0xa032('0x81')]=JSON[_0xa032('0x7c')](_0x227937[_0xa032('0x81')]);_0x466497[_0xa032('0x3b')](_0x229477(_0x227937[_0xa032('0x81')][_0xa032('0x69')]));}_0x13aa21=_0x466497['clone']();_0x466497[_0xa032('0x1e')](_0x2c8e0d);_0x466497[_0xa032('0x1d')](0x0);logger[_0xa032('0x83')](_0xa032('0x8e'),_0x466497[_0xa032('0x84')]());return db[_0xa032('0x85')][_0xa032('0x31')](_0x466497[_0xa032('0x84')](),{'type':db[_0xa032('0x85')][_0xa032('0x8f')][_0xa032('0x86')]});}})[_0xa032('0x23')](function(){return{'sql':_0x13aa21[_0xa032('0x84')]()};})['then'](respondWithResult(_0x154f07,null))[_0xa032('0x43')](handleError(_0x154f07,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 01017dd..bf3ac31 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 _0xb574=['define','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./analyticCustomReport.attributes'];(function(_0x3a2de2,_0x461cd0){var _0x2841ea=function(_0x2dfa41){while(--_0x2dfa41){_0x3a2de2['push'](_0x3a2de2['shift']());}};_0x2841ea(++_0x461cd0);}(_0xb574,0x17b));var _0x4b57=function(_0x53fea3,_0x10d4aa){_0x53fea3=_0x53fea3-0x0;var _0x4b4772=_0xb574[_0x53fea3];return _0x4b4772;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require(_0x4b57('0x2'))(_0x4b57('0x3'));var moment=require(_0x4b57('0x4'));var BPromise=require(_0x4b57('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b57('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b57('0x7'));module['exports']=function(_0x344676,_0x53a887){return _0x344676[_0x4b57('0x8')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eb3=['bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment'];(function(_0x4fb40e,_0x431f6e){var _0x355245=function(_0x3966d0){while(--_0x3966d0){_0x4fb40e['push'](_0x4fb40e['shift']());}};_0x355245(++_0x431f6e);}(_0x7eb3,0x105));var _0x37eb=function(_0x227c85,_0x5f016b){_0x227c85=_0x227c85-0x0;var _0x197a4d=_0x7eb3[_0x227c85];return _0x197a4d;};'use strict';var _=require(_0x37eb('0x0'));var util=require(_0x37eb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37eb('0x2'));var BPromise=require(_0x37eb('0x3'));var rp=require(_0x37eb('0x4'));var fs=require('fs');var path=require(_0x37eb('0x5'));var rimraf=require('rimraf');var config=require(_0x37eb('0x6'));var attributes=require(_0x37eb('0x7'));module[_0x37eb('0x8')]=function(_0x468cf8,_0x3dddb6){return _0x468cf8[_0x37eb('0x9')](_0x37eb('0xa'),attributes,{'tableName':_0x37eb('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 91ec986..741ac63 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 _0x95ac=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0xd72902,_0x2ab2f7){var _0x24d1b3=function(_0x33d506){while(--_0x33d506){_0xd72902['push'](_0xd72902['shift']());}};_0x24d1b3(++_0x2ab2f7);}(_0x95ac,0x1aa));var _0xc95a=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x95ac[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc95a('0x0'));var BPromise=require(_0xc95a('0x1'));var rs=require(_0xc95a('0x2'));var fs=require('fs');var Redis=require(_0xc95a('0x3'));var db=require(_0xc95a('0x4'))['db'];var utils=require(_0xc95a('0x5'));var logger=require(_0xc95a('0x6'))(_0xc95a('0x7'));var config=require(_0xc95a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc95a('0x9')][_0xc95a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3beadc,_0x1cefcd,_0xd4cc4){return new BPromise(function(_0x1e0704,_0x55aab0){return client[_0xc95a('0xb')](_0x3beadc,_0xd4cc4)[_0xc95a('0xc')](function(_0x5021f3){logger[_0xc95a('0xd')](_0xc95a('0xe'),_0x1cefcd,_0xc95a('0xf'));logger['debug'](_0xc95a('0x10'),_0x1cefcd,_0xc95a('0xf'),JSON[_0xc95a('0x11')](_0x5021f3));if(_0x5021f3[_0xc95a('0x12')]){if(_0x5021f3['error'][_0xc95a('0x13')]===0x1f4){logger[_0xc95a('0x12')](_0xc95a('0xe'),_0x1cefcd,_0x5021f3[_0xc95a('0x12')]['message']);return _0x55aab0(_0x5021f3[_0xc95a('0x12')][_0xc95a('0x14')]);}logger[_0xc95a('0x12')](_0xc95a('0xe'),_0x1cefcd,_0x5021f3[_0xc95a('0x12')][_0xc95a('0x14')]);return _0x1e0704(_0x5021f3[_0xc95a('0x12')][_0xc95a('0x14')]);}else{logger['info'](_0xc95a('0xe'),_0x1cefcd,_0xc95a('0xf'));_0x1e0704(_0x5021f3[_0xc95a('0x15')][_0xc95a('0x14')]);}})['catch'](function(_0x348961){logger[_0xc95a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1cefcd,_0x348961);_0x55aab0(_0x348961);});});} \ No newline at end of file +var _0x174b=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x22a866,_0xfe7c94){var _0xd1545a=function(_0x63862d){while(--_0x63862d){_0x22a866['push'](_0x22a866['shift']());}};_0xd1545a(++_0xfe7c94);}(_0x174b,0x148));var _0xb174=function(_0x1a2f0f,_0x4c7ca6){_0x1a2f0f=_0x1a2f0f-0x0;var _0x55710e=_0x174b[_0x1a2f0f];return _0x55710e;};'use strict';var _=require(_0xb174('0x0'));var util=require(_0xb174('0x1'));var moment=require(_0xb174('0x2'));var BPromise=require(_0xb174('0x3'));var rs=require(_0xb174('0x4'));var fs=require('fs');var Redis=require(_0xb174('0x5'));var db=require(_0xb174('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb174('0x7'))(_0xb174('0x8'));var config=require(_0xb174('0x9'));var jayson=require(_0xb174('0xa'));var client=jayson[_0xb174('0xb')][_0xb174('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cfc03,_0xa2602d,_0x4dfd56){return new BPromise(function(_0xca4eb9,_0x396262){return client['request'](_0x1cfc03,_0x4dfd56)[_0xb174('0xd')](function(_0x27fd24){logger[_0xb174('0xe')](_0xb174('0xf'),_0xa2602d,_0xb174('0x10'));logger[_0xb174('0x11')](_0xb174('0x12'),_0xa2602d,_0xb174('0x10'),JSON[_0xb174('0x13')](_0x27fd24));if(_0x27fd24[_0xb174('0x14')]){if(_0x27fd24['error'][_0xb174('0x15')]===0x1f4){logger[_0xb174('0x14')](_0xb174('0xf'),_0xa2602d,_0x27fd24[_0xb174('0x14')]['message']);return _0x396262(_0x27fd24['error'][_0xb174('0x16')]);}logger[_0xb174('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa2602d,_0x27fd24[_0xb174('0x14')][_0xb174('0x16')]);return _0xca4eb9(_0x27fd24[_0xb174('0x14')][_0xb174('0x16')]);}else{logger[_0xb174('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa2602d,_0xb174('0x10'));_0xca4eb9(_0x27fd24['result'][_0xb174('0x16')]);}})['catch'](function(_0x296bc0){logger[_0xb174('0x14')](_0xb174('0xf'),_0xa2602d,_0x296bc0);_0x396262(_0x296bc0);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c308d73..5514b5e 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 _0x5fc4=['exports','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','delete','destroy'];(function(_0x217761,_0x22f74d){var _0x360a62=function(_0x42416e){while(--_0x42416e){_0x217761['push'](_0x217761['shift']());}};_0x360a62(++_0x22f74d);}(_0x5fc4,0x109));var _0x45fc=function(_0x3cb223,_0x1a435f){_0x3cb223=_0x3cb223-0x0;var _0xe741df=_0x5fc4[_0x3cb223];return _0xe741df;};'use strict';var multer=require('multer');var util=require(_0x45fc('0x0'));var path=require('path');var timeout=require(_0x45fc('0x1'));var express=require(_0x45fc('0x2'));var router=express[_0x45fc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x45fc('0x4'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x45fc('0x5')]('/',auth[_0x45fc('0x6')](),controller[_0x45fc('0x7')]);router[_0x45fc('0x5')](_0x45fc('0x8'),auth[_0x45fc('0x6')](),controller[_0x45fc('0x9')]);router[_0x45fc('0x5')](_0x45fc('0xa'),auth[_0x45fc('0x6')](),controller[_0x45fc('0xb')]);router[_0x45fc('0x5')](_0x45fc('0xc'),auth[_0x45fc('0x6')](),controller[_0x45fc('0xd')]);router[_0x45fc('0x5')]('/:id/query',auth[_0x45fc('0x6')](),controller[_0x45fc('0xe')]);router[_0x45fc('0xf')]('/',auth['isAuthenticated'](),controller[_0x45fc('0x10')]);router[_0x45fc('0x11')](_0x45fc('0x8'),auth[_0x45fc('0x6')](),controller[_0x45fc('0x12')]);router[_0x45fc('0x13')](_0x45fc('0x8'),auth['isAuthenticated'](),controller[_0x45fc('0x14')]);module[_0x45fc('0x15')]=router; \ No newline at end of file +var _0x268c=['../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','update','delete','exports','multer','util','path','express'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x268c,0xb9));var _0xc268=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x268c[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0xc268('0x0'));var util=require(_0xc268('0x1'));var path=require(_0xc268('0x2'));var timeout=require('connect-timeout');var express=require(_0xc268('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc268('0x4'));var config=require('../../config/environment');var controller=require(_0xc268('0x5'));router[_0xc268('0x6')]('/',auth[_0xc268('0x7')](),controller[_0xc268('0x8')]);router['get'](_0xc268('0x9'),auth[_0xc268('0x7')](),controller[_0xc268('0xa')]);router[_0xc268('0x6')](_0xc268('0xb'),auth['isAuthenticated'](),controller[_0xc268('0xc')]);router[_0xc268('0x6')](_0xc268('0xd'),auth['isAuthenticated'](),controller[_0xc268('0xe')]);router['get'](_0xc268('0xf'),auth[_0xc268('0x7')](),controller[_0xc268('0x10')]);router[_0xc268('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc268('0x9'),auth[_0xc268('0x7')](),controller[_0xc268('0x12')]);router[_0xc268('0x13')]('/:id',auth[_0xc268('0x7')](),controller['destroy']);module[_0xc268('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 037dc1f..dbfa9fb 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 _0xa2fa=['TEXT','sequelize','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa2fa,0x1ba));var _0xaa2f=function(_0x28edf8,_0x3ab79f){_0x28edf8=_0x28edf8-0x0;var _0xb0bbba=_0xa2fa[_0x28edf8];return _0xb0bbba;};'use strict';var Sequelize=require(_0xaa2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa2f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xaa2f('0x1')]},'parent':{'type':Sequelize[_0xaa2f('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xaa2f('0x2')]},'joins':{'type':Sequelize[_0xaa2f('0x2')]}}; \ No newline at end of file +var _0xb498=['exports','STRING','TEXT','sequelize'];(function(_0x525367,_0x16a3ce){var _0x162cff=function(_0x183192){while(--_0x183192){_0x525367['push'](_0x525367['shift']());}};_0x162cff(++_0x16a3ce);}(_0xb498,0xd7));var _0x8b49=function(_0x4765ab,_0x481568){_0x4765ab=_0x4765ab-0x0;var _0x4775c4=_0xb498[_0x4765ab];return _0x4775c4;};'use strict';var Sequelize=require(_0x8b49('0x0'));module[_0x8b49('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8b49('0x2')]},'parent':{'type':Sequelize[_0x8b49('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8b49('0x3')]},'joins':{'type':Sequelize[_0x8b49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0a0f23c..6ef785f 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 _0xec6e=['send','index','AnalyticDefaultReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','MAX(%s)','GROUP_CONCAT(%s)','IS\x20NULL','IS\x20EMPTY','findAll','parse','%s.%s\x20=\x20%s.%s','clone','debug','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','cross_join','HOUR(%s)','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','DefaultReports','UserProfileResource','destroy','error','stack','name'];(function(_0x2163de,_0x37792c){var _0x4098f3=function(_0x10b889){while(--_0x10b889){_0x2163de['push'](_0x2163de['shift']());}};_0x4098f3(++_0x37792c);}(_0xec6e,0x1be));var _0xeec6=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0xec6e[_0x18546c];return _0x46ef43;};'use strict';var pdf=require(_0xeec6('0x0'));var emlformat=require(_0xeec6('0x1'));var rimraf=require(_0xeec6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeec6('0x3'));var rp=require('request-promise');var moment=require(_0xeec6('0x4'));var BPromise=require(_0xeec6('0x5'));var Mustache=require(_0xeec6('0x6'));var util=require(_0xeec6('0x7'));var path=require(_0xeec6('0x8'));var sox=require(_0xeec6('0x9'));var csv=require('to-csv');var ejs=require(_0xeec6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeec6('0xb'));var crypto=require(_0xeec6('0xc'));var jsforce=require(_0xeec6('0xd'));var deskjs=require(_0xeec6('0xe'));var toCsv=require(_0xeec6('0xf'));var querystring=require(_0xeec6('0x10'));var Papa=require(_0xeec6('0x11'));var Redis=require('ioredis');var authService=require(_0xeec6('0x12'));var qs=require(_0xeec6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeec6('0x14'));var logger=require(_0xeec6('0x15'))(_0xeec6('0x16'));var utils=require(_0xeec6('0x17'));var config=require(_0xeec6('0x18'));var db=require(_0xeec6('0x19'))['db'];var dbH=require(_0xeec6('0x19'))['dbH'];function respondWithStatusCode(_0xd0136d,_0xd538c9){_0xd538c9=_0xd538c9||0xcc;return function(_0x29cfb6){if(_0x29cfb6){return _0xd0136d[_0xeec6('0x1a')](_0xd538c9);}return _0xd0136d['status'](_0xd538c9)['end']();};}function respondWithResult(_0x421321,_0x162d5a){_0x162d5a=_0x162d5a||0xc8;return function(_0x5690dc){if(_0x5690dc){return _0x421321[_0xeec6('0x1b')](_0x162d5a)['json'](_0x5690dc);}};}function respondWithFilteredResult(_0xfddb7c,_0x207a9e){return function(_0xb399e9){if(_0xb399e9){var _0x146293=_0xb399e9[_0xeec6('0x1c')],_0x142e93=_0x207a9e[_0xeec6('0x1d')],_0x5f45a1=_0x207a9e[_0xeec6('0x1d')]+_0x207a9e[_0xeec6('0x1e')],_0x460cfb;if(_0x5f45a1>=_0x146293){_0x5f45a1=_0x146293;_0x460cfb=0xc8;}else{_0x460cfb=0xce;}_0xfddb7c[_0xeec6('0x1b')](_0x460cfb);return _0xfddb7c[_0xeec6('0x1f')]('Content-Range',_0x142e93+'-'+_0x5f45a1+'/'+_0x146293)[_0xeec6('0x20')](_0xb399e9);}return null;};}function patchUpdates(_0x393c06){return function(_0x3bdd17){try{jsonpatch[_0xeec6('0x21')](_0x3bdd17,_0x393c06,!![]);}catch(_0x36b8f7){return BPromise[_0xeec6('0x22')](_0x36b8f7);}return _0x3bdd17[_0xeec6('0x23')]();};}function saveUpdates(_0x3130fd,_0x2e0b16){return function(_0x283b53){if(_0x283b53){return _0x283b53[_0xeec6('0x24')](_0x3130fd)['then'](function(_0x1d39ce){return _0x1d39ce;});}return null;};}function removeEntity(_0x111390,_0x2a8feb){return function(_0x4839f9){if(_0x4839f9){return _0x4839f9['destroy']()['then'](function(){var _0x43fcd4=_0x4839f9['get']({'plain':!![]});var _0x211473=_0xeec6('0x25');return db[_0xeec6('0x26')][_0xeec6('0x27')]({'where':{'type':_0x211473,'resourceId':_0x43fcd4['id']}})['then'](function(){return _0x4839f9;});})['then'](function(){_0x111390[_0xeec6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8d81,_0x33b3ef){return function(_0x534c2b){if(!_0x534c2b){_0x2c8d81[_0xeec6('0x1a')](0x194);}return _0x534c2b;};}function handleError(_0x26a62d,_0x17dc24){_0x17dc24=_0x17dc24||0x1f4;return function(_0x104ee0){logger[_0xeec6('0x28')](_0x104ee0[_0xeec6('0x29')]);if(_0x104ee0['name']){delete _0x104ee0[_0xeec6('0x2a')];}_0x26a62d[_0xeec6('0x1b')](_0x17dc24)[_0xeec6('0x2b')](_0x104ee0);};}exports[_0xeec6('0x2c')]=function(_0x3a5067,_0x2feca2){var _0x223a50={},_0x563935={},_0xa9f673={'count':0x0,'rows':[]};var _0x1a0666=_['map'](db[_0xeec6('0x2d')][_0xeec6('0x2e')],function(_0x43f84f){return{'name':_0x43f84f['fieldName'],'type':_0x43f84f[_0xeec6('0x2f')][_0xeec6('0x30')]};});_0x563935[_0xeec6('0x31')]=_[_0xeec6('0x32')](_0x1a0666,_0xeec6('0x2a'));_0x563935[_0xeec6('0x33')]=_[_0xeec6('0x34')](_0x3a5067[_0xeec6('0x33')]);_0x563935[_0xeec6('0x35')]=_[_0xeec6('0x36')](_0x563935[_0xeec6('0x31')],_0x563935[_0xeec6('0x33')]);_0x223a50['attributes']=_[_0xeec6('0x36')](_0x563935[_0xeec6('0x31')],qs[_0xeec6('0x37')](_0x3a5067[_0xeec6('0x33')]['fields']));_0x223a50[_0xeec6('0x38')]=_0x223a50['attributes'][_0xeec6('0x39')]?_0x223a50[_0xeec6('0x38')]:_0x563935[_0xeec6('0x31')];if(!_0x3a5067[_0xeec6('0x33')]['hasOwnProperty'](_0xeec6('0x3a'))){_0x223a50[_0xeec6('0x1e')]=qs['limit'](_0x3a5067[_0xeec6('0x33')][_0xeec6('0x1e')]);_0x223a50[_0xeec6('0x1d')]=qs['offset'](_0x3a5067[_0xeec6('0x33')][_0xeec6('0x1d')]);}_0x223a50[_0xeec6('0x3b')]=qs['sort'](_0x3a5067[_0xeec6('0x33')][_0xeec6('0x3c')]);_0x223a50[_0xeec6('0x3d')]=qs[_0xeec6('0x35')](_[_0xeec6('0x3e')](_0x3a5067[_0xeec6('0x33')],_0x563935[_0xeec6('0x35')]),_0x1a0666);if(_0x3a5067[_0xeec6('0x33')][_0xeec6('0x3f')]){_0x223a50['where']=_[_0xeec6('0x40')](_0x223a50[_0xeec6('0x3d')],{'$or':_[_0xeec6('0x32')](_0x1a0666,function(_0x3c7ccd){if(_0x3c7ccd['type']!==_0xeec6('0x41')){var _0x6dd74a={};_0x6dd74a[_0x3c7ccd['name']]={'$like':'%'+_0x3a5067[_0xeec6('0x33')]['filter']+'%'};return _0x6dd74a;}})});}_0x223a50=_[_0xeec6('0x40')]({},_0x223a50,_0x3a5067[_0xeec6('0x42')]);var _0x18f47d={'where':_0x223a50[_0xeec6('0x3d')]};return db[_0xeec6('0x2d')][_0xeec6('0x1c')](_0x18f47d)[_0xeec6('0x43')](function(_0x547a6c){_0xa9f673[_0xeec6('0x1c')]=_0x547a6c;if(_0x3a5067[_0xeec6('0x33')]['includeAll']){_0x223a50[_0xeec6('0x44')]=[{'all':!![]}];}return db[_0xeec6('0x2d')]['findAll'](_0x223a50);})[_0xeec6('0x43')](function(_0x2f5de0){_0xa9f673['rows']=_0x2f5de0;return _0xa9f673;})['then'](respondWithFilteredResult(_0x2feca2,_0x223a50))[_0xeec6('0x45')](handleError(_0x2feca2,null));};exports['show']=function(_0x4a91ab,_0x4b79b3){var _0x4a2597={'raw':!![],'where':{'id':_0x4a91ab[_0xeec6('0x46')]['id']}},_0xf1697f={};_0xf1697f[_0xeec6('0x31')]=_[_0xeec6('0x34')](db['AnalyticDefaultReport'][_0xeec6('0x2e')]);_0xf1697f[_0xeec6('0x33')]=_[_0xeec6('0x34')](_0x4a91ab['query']);_0xf1697f[_0xeec6('0x35')]=_[_0xeec6('0x36')](_0xf1697f['model'],_0xf1697f['query']);_0x4a2597[_0xeec6('0x38')]=_[_0xeec6('0x36')](_0xf1697f[_0xeec6('0x31')],qs[_0xeec6('0x37')](_0x4a91ab[_0xeec6('0x33')]['fields']));_0x4a2597[_0xeec6('0x38')]=_0x4a2597[_0xeec6('0x38')][_0xeec6('0x39')]?_0x4a2597['attributes']:_0xf1697f[_0xeec6('0x31')];if(_0x4a91ab[_0xeec6('0x33')][_0xeec6('0x47')]){_0x4a2597['include']=[{'all':!![]}];}_0x4a2597=_[_0xeec6('0x40')]({},_0x4a2597,_0x4a91ab[_0xeec6('0x42')]);return db[_0xeec6('0x2d')][_0xeec6('0x48')](_0x4a2597)[_0xeec6('0x43')](handleEntityNotFound(_0x4b79b3,null))[_0xeec6('0x43')](respondWithResult(_0x4b79b3,null))['catch'](handleError(_0x4b79b3,null));};exports[_0xeec6('0x49')]=function(_0x310c78,_0x477a04){return db['AnalyticDefaultReport'][_0xeec6('0x49')](_0x310c78[_0xeec6('0x4a')],{})[_0xeec6('0x43')](function(_0x472916){var _0x18ad33=_0x310c78[_0xeec6('0x4b')][_0xeec6('0x4c')]({'plain':!![]});if(!_0x18ad33)throw new Error(_0xeec6('0x4d'));if(_0x18ad33[_0xeec6('0x4e')]===_0xeec6('0x4b')){var _0x362340=_0x472916[_0xeec6('0x4c')]({'plain':!![]});var _0x3d0884=_0xeec6('0x4f');return db[_0xeec6('0x50')][_0xeec6('0x48')]({'where':{'name':_0x3d0884,'userProfileId':_0x18ad33['userProfileId']},'raw':!![]})[_0xeec6('0x43')](function(_0x280d8e){if(_0x280d8e&&_0x280d8e['autoAssociation']===0x0){return db[_0xeec6('0x26')][_0xeec6('0x49')]({'name':_0x362340[_0xeec6('0x2a')],'resourceId':_0x362340['id'],'type':_0xeec6('0x25'),'sectionId':_0x280d8e['id']},{})[_0xeec6('0x43')](function(){return _0x472916;});}else{return _0x472916;}})['catch'](function(_0x379577){logger['error'](_0xeec6('0x51'),_0x379577);throw _0x379577;});}return _0x472916;})[_0xeec6('0x43')](respondWithResult(_0x477a04,0xc9))[_0xeec6('0x45')](handleError(_0x477a04,null));};exports[_0xeec6('0x24')]=function(_0x407c35,_0x4f3948){if(_0x407c35[_0xeec6('0x4a')]['id']){delete _0x407c35[_0xeec6('0x4a')]['id'];}return db[_0xeec6('0x2d')][_0xeec6('0x48')]({'where':{'id':_0x407c35[_0xeec6('0x46')]['id']}})[_0xeec6('0x43')](handleEntityNotFound(_0x4f3948,null))[_0xeec6('0x43')](saveUpdates(_0x407c35[_0xeec6('0x4a')],null))[_0xeec6('0x43')](respondWithResult(_0x4f3948,null))[_0xeec6('0x45')](handleError(_0x4f3948,null));};exports[_0xeec6('0x27')]=function(_0x1b69c5,_0x1978ba){return db[_0xeec6('0x2d')]['find']({'where':{'id':_0x1b69c5[_0xeec6('0x46')]['id']}})[_0xeec6('0x43')](handleEntityNotFound(_0x1978ba,null))[_0xeec6('0x43')](removeEntity(_0x1978ba,null))['catch'](handleError(_0x1978ba,null));};exports[_0xeec6('0x52')]=function(_0x1ced7c,_0x5682dd){var _0x42aed8=0xa;var _0x1deb2b=[_0xeec6('0x53'),_0xeec6('0x54'),_0xeec6('0x55'),'cross_join'];var _0x3a3e93={'SUM':_0xeec6('0x56'),'COUNT':_0xeec6('0x57'),'COUNT DISTINCT':_0xeec6('0x58'),'MAX':'MAX(%s)','MIN':_0xeec6('0x59'),'AVG':_0xeec6('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeec6('0x5b')};var _0xfe488={'SEC_TO_TIME':_0xeec6('0x5c'),'DATE':_0xeec6('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xeec6('0x5e'),'UNIX_TIMESTAMP':_0xeec6('0x5f')};var _0x27cc9a=function(_0x2e5cc2){return!_[_0xeec6('0x60')](['IS\x20NULL',_0xeec6('0x61'),'IS\x20EMPTY',_0xeec6('0x62')],_0x2e5cc2);};var _0x240c81=function(_0x3c508b){if(!_0x3c508b||!_0x3c508b[_0xeec6('0x63')][_0xeec6('0x39')]){return'';}for(var _0x5de597='(',_0x9e23f8=0x0;_0x9e23f8<_0x3c508b[_0xeec6('0x63')][_0xeec6('0x39')];_0x9e23f8+=0x1){_0x9e23f8>0x0&&(_0x5de597+='\x20'+_0x3c508b[_0xeec6('0x64')]+'\x20');_0x5de597+=_0x3c508b[_0xeec6('0x63')][_0x9e23f8][_0xeec6('0x65')]?_0x240c81(_0x3c508b[_0xeec6('0x63')][_0x9e23f8][_0xeec6('0x65')]):_0x3c508b[_0xeec6('0x63')][_0x9e23f8][_0xeec6('0x66')]+'\x20'+_0x3c508b[_0xeec6('0x63')][_0x9e23f8]['condition']+(_0x27cc9a(_0x3c508b['rules'][_0x9e23f8][_0xeec6('0x67')])?'\x20'+_0x3c508b[_0xeec6('0x63')][_0x9e23f8][_0xeec6('0x68')]:'');}return _0x5de597+')';};var _0x27eaa6={'where':{'id':_0x1ced7c[_0xeec6('0x46')]['id']}},_0x2c352e,_0xd59c2b,_0x1cb0cc,_0x2e39d4,_0x1ede23;_0x27eaa6=_['merge']({},_0x27eaa6,_0x1ced7c[_0xeec6('0x42')]);return db[_0xeec6('0x2d')][_0xeec6('0x48')](_0x27eaa6)[_0xeec6('0x43')](function(_0x39b1a7){if(_0x39b1a7){_0x2c352e=_0x39b1a7;return _0x39b1a7[_0xeec6('0x69')]();}return null;})[_0xeec6('0x43')](function(_0x20c5b6){if(_0x20c5b6){if(!_0x20c5b6[_0xeec6('0x39')]){throw new db[(_0xeec6('0x6a'))][(_0xeec6('0x6b'))](_0xeec6('0x6c'),0x193);}_0xd59c2b=_0x20c5b6;return db[_0xeec6('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xeec6('0x43')](function(_0x365cda){if(_0x365cda){_0x1cb0cc=_[_0xeec6('0x6e')](_0x365cda,'id');var _0x2ad00d;var _0x1e887c=squel[_0xeec6('0x6f')]();_0x1e887c[_0xeec6('0x70')](_0x2c352e[_0xeec6('0x71')]);for(var _0x5dfa9f=0x0;_0x5dfa9f<_0xd59c2b[_0xeec6('0x39')];_0x5dfa9f+=0x1){_0x2ad00d=_0xd59c2b[_0x5dfa9f][_0xeec6('0x72')]?_0x1cb0cc[_0xd59c2b[_0x5dfa9f][_0xeec6('0x72')]][_0xeec6('0x73')]:_0xd59c2b[_0x5dfa9f][_0xeec6('0x66')];_0x2ad00d=_0xd59c2b[_0x5dfa9f][_0xeec6('0x74')]?_[_0xeec6('0x75')](_0x3a3e93[_0xd59c2b[_0x5dfa9f][_0xeec6('0x74')]],'%s',_0x2ad00d):_0x2ad00d;_0x2ad00d=_0xd59c2b[_0x5dfa9f][_0xeec6('0x76')]?_[_0xeec6('0x75')](_0xfe488[_0xd59c2b[_0x5dfa9f][_0xeec6('0x76')]],'%s',_0x2ad00d):_0x2ad00d;if(_0xd59c2b[_0x5dfa9f][_0xeec6('0x77')]){_0x1e887c[_0xeec6('0x65')](_0x2ad00d);}_0xd59c2b[_0x5dfa9f]['orderBy']&&_0x1e887c[_0xeec6('0x3b')](_0x2ad00d,_0xd59c2b[_0x5dfa9f][_0xeec6('0x78')]===_0xeec6('0x79')?![]:!![]);_0x1e887c['field'](_0x2ad00d,_0xd59c2b[_0x5dfa9f][_0xeec6('0x7a')]||_0x2ad00d);}if(_0x2c352e[_0xeec6('0x7b')]){_0x2c352e[_0xeec6('0x7b')]=JSON['parse'](_0x2c352e['joins']);for(var _0x5d4f32=0x0;_0x5d4f32<_0x2c352e['joins']['length'];_0x5d4f32+=0x1){if(_0x2c352e[_0xeec6('0x7b')][_0x5d4f32]['type']&&_['includes'](_0x1deb2b,_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x2f')])&&_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x7c')]&&_0x2c352e['joins'][_0x5d4f32][_0xeec6('0x7d')]&&_0x2c352e[_0xeec6('0x7b')][_0x5d4f32]['foreignKey']){_0x1e887c[_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x2f')]](_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x7d')],null,util[_0xeec6('0x76')]('%s.%s\x20=\x20%s.%s',_0x2c352e[_0xeec6('0x71')],_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x7c')],_0x2c352e[_0xeec6('0x7b')][_0x5d4f32][_0xeec6('0x7d')],_0x2c352e['joins'][_0x5d4f32][_0xeec6('0x7e')]));}}}if(_0x2c352e[_0xeec6('0x7f')]){_0x2c352e[_0xeec6('0x7f')]=JSON['parse'](_0x2c352e['conditions']);_0x1e887c[_0xeec6('0x3d')](_0x240c81(_0x2c352e[_0xeec6('0x7f')]['group']));}_0x1ede23=_0x1e887c['clone']();_0x1e887c['limit'](_0x42aed8);_0x1e887c[_0xeec6('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x1e887c[_0xeec6('0x80')]());return db[_0xeec6('0x81')][_0xeec6('0x33')](_0x1e887c[_0xeec6('0x80')](),{'type':db[_0xeec6('0x81')][_0xeec6('0x82')][_0xeec6('0x83')]});}})[_0xeec6('0x43')](respondWithResult(_0x5682dd,null))[_0xeec6('0x45')](handleError(_0x5682dd,null));};function runReport(_0x8158f,_0x59c77c,_0x846780){var _0x13fe70=_0x59c77c[_0xeec6('0x2a')];var _0x3505ed=0xa;var _0x355482=['join',_0xeec6('0x54'),_0xeec6('0x55'),'cross_join'];var _0xc6ac22={'SUM':_0xeec6('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xeec6('0x58'),'MAX':_0xeec6('0x84'),'MIN':_0xeec6('0x59'),'AVG':_0xeec6('0x5a'),'GROUP_CONCAT':_0xeec6('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeec6('0x5b')};var _0x27d5b3={'SEC_TO_TIME':_0xeec6('0x5c'),'DATE':_0xeec6('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xeec6('0x5e'),'UNIX_TIMESTAMP':_0xeec6('0x5f')};var _0x4d22ed=function(_0x4139d6){return!_['includes']([_0xeec6('0x86'),_0xeec6('0x61'),_0xeec6('0x87'),_0xeec6('0x62')],_0x4139d6);};var _0x4d01ef=function(_0x593c70){if(!_0x593c70||!_0x593c70[_0xeec6('0x63')]['length']){return'';}for(var _0x4ea3b3='(',_0x284f17=0x0;_0x284f17<_0x593c70['rules'][_0xeec6('0x39')];_0x284f17+=0x1){_0x284f17>0x0&&(_0x4ea3b3+='\x20'+_0x593c70[_0xeec6('0x64')]+'\x20');_0x4ea3b3+=_0x593c70['rules'][_0x284f17][_0xeec6('0x65')]?_0x4d01ef(_0x593c70[_0xeec6('0x63')][_0x284f17]['group']):_0x593c70[_0xeec6('0x63')][_0x284f17][_0xeec6('0x66')]+'\x20'+_0x593c70['rules'][_0x284f17][_0xeec6('0x67')]+(_0x4d22ed(_0x593c70[_0xeec6('0x63')][_0x284f17]['condition'])?'\x20'+_0x593c70[_0xeec6('0x63')][_0x284f17][_0xeec6('0x68')]:'');}return _0x4ea3b3+')';};var _0x10bf54={'where':{'id':_0x8158f['id']}},_0x4a9e4a,_0x50b1cd,_0x428561,_0x1f4718,_0x4b871f;_0x10bf54=_['merge']({},_0x10bf54,_0x846780);return db['AnalyticDefaultReport'][_0xeec6('0x48')](_0x10bf54)[_0xeec6('0x43')](function(_0x9dbcf8){if(_0x9dbcf8){_0x4a9e4a=_0x9dbcf8;return _0x9dbcf8['getFields']();}return null;})[_0xeec6('0x43')](function(_0x2faf3a){if(_0x2faf3a){if(!_0x2faf3a[_0xeec6('0x39')]){throw new db[(_0xeec6('0x6a'))][(_0xeec6('0x6b'))](_0xeec6('0x6c'),0x193);}_0x50b1cd=_0x2faf3a;return db[_0xeec6('0x6d')][_0xeec6('0x88')]({'raw':!![]});}return null;})[_0xeec6('0x43')](function(_0x532b4b){if(_0x532b4b){_0x428561=_['keyBy'](_0x532b4b,'id');var _0x54f7aa;var _0x3ec0db=squel[_0xeec6('0x6f')]();_0x3ec0db[_0xeec6('0x70')](_0x4a9e4a[_0xeec6('0x71')]);for(var _0x48f8af=0x0;_0x48f8af<_0x50b1cd['length'];_0x48f8af+=0x1){_0x54f7aa=_0x50b1cd[_0x48f8af][_0xeec6('0x72')]?_0x428561[_0x50b1cd[_0x48f8af][_0xeec6('0x72')]][_0xeec6('0x73')]:_0x50b1cd[_0x48f8af][_0xeec6('0x66')];_0x54f7aa=_0x50b1cd[_0x48f8af][_0xeec6('0x74')]?_['replace'](_0xc6ac22[_0x50b1cd[_0x48f8af]['function']],'%s',_0x54f7aa):_0x54f7aa;_0x54f7aa=_0x50b1cd[_0x48f8af]['format']?_[_0xeec6('0x75')](_0x27d5b3[_0x50b1cd[_0x48f8af]['format']],'%s',_0x54f7aa):_0x54f7aa;if(_0x50b1cd[_0x48f8af][_0xeec6('0x77')]){_0x3ec0db[_0xeec6('0x65')](_0x54f7aa);}_0x50b1cd[_0x48f8af][_0xeec6('0x78')]&&_0x3ec0db[_0xeec6('0x3b')](_0x54f7aa,_0x50b1cd[_0x48f8af][_0xeec6('0x78')]===_0xeec6('0x79')?![]:!![]);_0x3ec0db['field'](_0x54f7aa,_0x50b1cd[_0x48f8af][_0xeec6('0x7a')]||_0x54f7aa);}if(_0x4a9e4a[_0xeec6('0x7b')]){_0x4a9e4a[_0xeec6('0x7b')]=JSON[_0xeec6('0x89')](_0x4a9e4a[_0xeec6('0x7b')]);for(var _0x5d21e2=0x0;_0x5d21e2<_0x4a9e4a[_0xeec6('0x7b')][_0xeec6('0x39')];_0x5d21e2+=0x1){if(_0x4a9e4a['joins'][_0x5d21e2][_0xeec6('0x2f')]&&_['includes'](_0x355482,_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x2f')])&&_0x4a9e4a['joins'][_0x5d21e2]['parentKey']&&_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2]['foreignTable']&&_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x7e')]){_0x3ec0db[_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2]['type']](_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x7d')],null,util[_0xeec6('0x76')](_0xeec6('0x8a'),_0x4a9e4a[_0xeec6('0x71')],_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x7c')],_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x7d')],_0x4a9e4a[_0xeec6('0x7b')][_0x5d21e2][_0xeec6('0x7e')]));}}}if(_0x4a9e4a[_0xeec6('0x7f')]){_0x4a9e4a['conditions']=JSON[_0xeec6('0x89')](_0x4a9e4a[_0xeec6('0x7f')]);_0x3ec0db[_0xeec6('0x3d')](_0x4d01ef(_0x4a9e4a['conditions'][_0xeec6('0x65')]));}_0x4b871f=_0x3ec0db[_0xeec6('0x8b')]();_0x3ec0db[_0xeec6('0x1e')](_0x3505ed);_0x3ec0db['offset'](0x0);logger[_0xeec6('0x8c')](_0xeec6('0x8d'),_0x3ec0db[_0xeec6('0x80')]());return db[_0xeec6('0x81')]['query'](_0x3ec0db[_0xeec6('0x80')](),{'type':db['sequelize'][_0xeec6('0x82')]['SELECT']});}})[_0xeec6('0x43')](function(_0x2065ed){if(!_0x2065ed[_0xeec6('0x39')]){throw new db[(_0xeec6('0x6a'))][(_0xeec6('0x6b'))](_0xeec6('0x8e'),0xcc);}if(_0x59c77c[_0xeec6('0x8f')]===_0xeec6('0x90')){return null;}var _0x54b92f=_[_0xeec6('0x40')](_0x59c77c,{'name':_0x59c77c[_0xeec6('0x91')]||_0x59c77c[_0xeec6('0x2a')]||_0x4a9e4a[_0xeec6('0x2a')],'basename':_0x13fe70,'savename':util[_0xeec6('0x76')]('%s-%s.%s',_0x59c77c[_0xeec6('0x2a')]||_0x4a9e4a[_0xeec6('0x2a')],require('randomstring')[_0xeec6('0x92')](0x4),_0x59c77c[_0xeec6('0x8f')]||'csv'),'reportId':_0x4a9e4a['id'],'reportType':_0xeec6('0x93')});return db[_0xeec6('0x94')]['create'](_0x54b92f,{'raw':!![]});})[_0xeec6('0x43')](function(_0x1df864){if(_0x4a9e4a[_0xeec6('0x71')]==='cdr'){_0x4b871f['where'](_0x4a9e4a[_0xeec6('0x71')]+_0xeec6('0x95'),_0x59c77c[_0xeec6('0x96')],_0x59c77c['endDate']);}else{_0x4b871f[_0xeec6('0x3d')](_0x4a9e4a['table']+_0xeec6('0x97'),_0x59c77c[_0xeec6('0x96')],_0x59c77c['endDate']);}if(_0x1df864){logger[_0xeec6('0x98')](_0xeec6('0x99'),_0x4b871f[_0xeec6('0x80')]());require(_0xeec6('0x9a'))[_0xeec6('0x9b')](path[_0xeec6('0x53')](__dirname,'../../components/export/',_0x1df864[_0xeec6('0x8f')]),[_0x1df864['id'],_0x4b871f['toString'](),path[_0xeec6('0x53')](__dirname,_0xeec6('0x9c'),_0x1df864[_0xeec6('0x9d')]),_0x13fe70]);return _0x1df864;}else{var _0xa4c6bc=squel[_0xeec6('0x6f')]();_0xa4c6bc[_0xeec6('0x70')]('('+_0x4b871f[_0xeec6('0x80')]()+')',_0xeec6('0x9e'));_0xa4c6bc[_0xeec6('0x66')](_0xeec6('0x9f'),_0xeec6('0x1c'));_0x4b871f[_0xeec6('0x1e')](_0x59c77c[_0xeec6('0x1e')]||_0x3505ed);_0x4b871f[_0xeec6('0x1d')](_0x59c77c[_0xeec6('0x1d')]||0x0);return dbH[_0xeec6('0x81')][_0xeec6('0x33')](_0xa4c6bc[_0xeec6('0x80')](),{'type':dbH['sequelize'][_0xeec6('0x82')][_0xeec6('0x83')]})[_0xeec6('0x43')](function(_0x266125){if(!_0x266125[_0xeec6('0x39')]){_0x1f4718=0x0;}else{_0x1f4718=_0x266125[0x0][_0xeec6('0x1c')]||0x0;}return dbH['sequelize'][_0xeec6('0x33')](_0x4b871f['toString'](),{'type':dbH['sequelize'][_0xeec6('0x82')][_0xeec6('0x83')]});})['then'](function(_0x2e5fd5){return{'rows':_0x2e5fd5||[],'count':_0x1f4718};});}});}exports[_0xeec6('0xa0')]=function(_0x266b17,_0x5ba42c){return runReport(_0x266b17[_0xeec6('0x46')],_0x266b17[_0xeec6('0x33')],_0x266b17[_0xeec6('0x42')])['then'](respondWithResult(_0x5ba42c,null))['catch'](handleError(_0x5ba42c,null));};exports['runReport']=runReport;exports[_0xeec6('0x33')]=function(_0x53614f,_0x42b7ff){var _0x4ecdeb=0xa;var _0x5322bf=['join',_0xeec6('0x54'),_0xeec6('0x55'),_0xeec6('0xa1')];var _0x10f6f9={'SUM':'SUM(%s)','COUNT':_0xeec6('0x57'),'COUNT DISTINCT':_0xeec6('0x58'),'MAX':'MAX(%s)','MIN':_0xeec6('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xeec6('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x229177={'SEC_TO_TIME':_0xeec6('0x5c'),'DATE':_0xeec6('0x5d'),'HOUR':_0xeec6('0xa2'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeec6('0x5f')};var _0x1185c2=function(_0x10edf6){return!_[_0xeec6('0x60')]([_0xeec6('0x86'),_0xeec6('0x61'),_0xeec6('0x87'),_0xeec6('0x62')],_0x10edf6);};var _0x4c672c=function(_0xe1616b){if(!_0xe1616b||!_0xe1616b[_0xeec6('0x63')][_0xeec6('0x39')]){return'';}for(var _0x456b50='(',_0x367b7b=0x0;_0x367b7b<_0xe1616b['rules'][_0xeec6('0x39')];_0x367b7b+=0x1){_0x367b7b>0x0&&(_0x456b50+='\x20'+_0xe1616b[_0xeec6('0x64')]+'\x20');_0x456b50+=_0xe1616b[_0xeec6('0x63')][_0x367b7b][_0xeec6('0x65')]?_0x4c672c(_0xe1616b[_0xeec6('0x63')][_0x367b7b]['group']):_0xe1616b['rules'][_0x367b7b][_0xeec6('0x66')]+'\x20'+_0xe1616b[_0xeec6('0x63')][_0x367b7b]['condition']+(_0x1185c2(_0xe1616b[_0xeec6('0x63')][_0x367b7b][_0xeec6('0x67')])?'\x20'+_0xe1616b['rules'][_0x367b7b][_0xeec6('0x68')]:'');}return _0x456b50+')';};var _0x20e792={'where':{'id':_0x53614f[_0xeec6('0x46')]['id']}},_0x3771e7,_0x4c9e75,_0x6c6e7a,_0x311525,_0x142f9d;_0x20e792=_[_0xeec6('0x40')]({},_0x20e792,_0x53614f[_0xeec6('0x42')]);return db[_0xeec6('0x2d')][_0xeec6('0x48')](_0x20e792)['then'](function(_0x443000){if(_0x443000){_0x3771e7=_0x443000;return _0x443000[_0xeec6('0x69')]();}return null;})[_0xeec6('0x43')](function(_0x21f8e3){if(_0x21f8e3){if(!_0x21f8e3[_0xeec6('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeec6('0x6c'),0x193);}_0x4c9e75=_0x21f8e3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeec6('0x43')](function(_0x767dc3){if(_0x767dc3){_0x6c6e7a=_[_0xeec6('0x6e')](_0x767dc3,'id');var _0x1eaad6;var _0x9cdd1c=squel[_0xeec6('0x6f')]();_0x9cdd1c['from'](_0x3771e7['table']);for(var _0x1eb589=0x0;_0x1eb589<_0x4c9e75[_0xeec6('0x39')];_0x1eb589+=0x1){_0x1eaad6=_0x4c9e75[_0x1eb589]['MetricId']?_0x6c6e7a[_0x4c9e75[_0x1eb589]['MetricId']][_0xeec6('0x73')]:_0x4c9e75[_0x1eb589][_0xeec6('0x66')];_0x1eaad6=_0x4c9e75[_0x1eb589][_0xeec6('0x74')]?_['replace'](_0x10f6f9[_0x4c9e75[_0x1eb589][_0xeec6('0x74')]],'%s',_0x1eaad6):_0x1eaad6;_0x1eaad6=_0x4c9e75[_0x1eb589][_0xeec6('0x76')]?_['replace'](_0x229177[_0x4c9e75[_0x1eb589][_0xeec6('0x76')]],'%s',_0x1eaad6):_0x1eaad6;if(_0x4c9e75[_0x1eb589][_0xeec6('0x77')]){_0x9cdd1c[_0xeec6('0x65')](_0x1eaad6);}_0x4c9e75[_0x1eb589][_0xeec6('0x78')]&&_0x9cdd1c[_0xeec6('0x3b')](_0x1eaad6,_0x4c9e75[_0x1eb589][_0xeec6('0x78')]==='DESC'?![]:!![]);_0x9cdd1c[_0xeec6('0x66')](_0x1eaad6,_0x4c9e75[_0x1eb589][_0xeec6('0x7a')]||_0x1eaad6);}if(_0x3771e7[_0xeec6('0x7b')]){_0x3771e7['joins']=JSON[_0xeec6('0x89')](_0x3771e7[_0xeec6('0x7b')]);for(var _0x2c2cbc=0x0;_0x2c2cbc<_0x3771e7[_0xeec6('0x7b')]['length'];_0x2c2cbc+=0x1){if(_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc]['type']&&_['includes'](_0x5322bf,_0x3771e7['joins'][_0x2c2cbc][_0xeec6('0x2f')])&&_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc][_0xeec6('0x7c')]&&_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc][_0xeec6('0x7d')]&&_0x3771e7['joins'][_0x2c2cbc][_0xeec6('0x7e')]){_0x9cdd1c[_0x3771e7['joins'][_0x2c2cbc][_0xeec6('0x2f')]](_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc][_0xeec6('0x7d')],null,util['format'](_0xeec6('0x8a'),_0x3771e7[_0xeec6('0x71')],_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc][_0xeec6('0x7c')],_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc]['foreignTable'],_0x3771e7[_0xeec6('0x7b')][_0x2c2cbc][_0xeec6('0x7e')]));}}}if(_0x3771e7[_0xeec6('0x7f')]){_0x3771e7[_0xeec6('0x7f')]=JSON[_0xeec6('0x89')](_0x3771e7[_0xeec6('0x7f')]);_0x9cdd1c[_0xeec6('0x3d')](_0x4c672c(_0x3771e7[_0xeec6('0x7f')][_0xeec6('0x65')]));}_0x142f9d=_0x9cdd1c[_0xeec6('0x8b')]();_0x9cdd1c['limit'](_0x4ecdeb);_0x9cdd1c['offset'](0x0);logger['debug'](_0xeec6('0x8d'),_0x9cdd1c[_0xeec6('0x80')]());return db[_0xeec6('0x81')]['query'](_0x9cdd1c[_0xeec6('0x80')](),{'type':db[_0xeec6('0x81')]['QueryTypes']['SELECT']});}})[_0xeec6('0x43')](function(){return{'sql':_0x142f9d[_0xeec6('0x80')]()};})[_0xeec6('0x43')](respondWithResult(_0x42b7ff,null))[_0xeec6('0x45')](handleError(_0x42b7ff,null));}; \ No newline at end of file +var _0xa7e2=['sox','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','map','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','IS\x20NOT\x20NULL','from','format','orderBy','foreignKey','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','count','run','SEC_TO_TIME(%s)','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0xbeb986,_0x5c0b8d){var _0x384ef3=function(_0x1eaca4){while(--_0x1eaca4){_0xbeb986['push'](_0xbeb986['shift']());}};_0x384ef3(++_0x5c0b8d);}(_0xa7e2,0x9c));var _0x2a7e=function(_0x13c1b6,_0x1b1a41){_0x13c1b6=_0x13c1b6-0x0;var _0x27ea2b=_0xa7e2[_0x13c1b6];return _0x27ea2b;};'use strict';var pdf=require(_0x2a7e('0x0'));var emlformat=require(_0x2a7e('0x1'));var rimraf=require(_0x2a7e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a7e('0x3'));var rp=require(_0x2a7e('0x4'));var moment=require(_0x2a7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2a7e('0x6'));var util=require(_0x2a7e('0x7'));var path=require(_0x2a7e('0x8'));var sox=require(_0x2a7e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2a7e('0xa'));var jsforce=require(_0x2a7e('0xb'));var deskjs=require(_0x2a7e('0xc'));var toCsv=require(_0x2a7e('0xd'));var querystring=require('querystring');var Papa=require(_0x2a7e('0xe'));var Redis=require('ioredis');var authService=require(_0x2a7e('0xf'));var qs=require(_0x2a7e('0x10'));var as=require(_0x2a7e('0x11'));var hardwareService=require(_0x2a7e('0x12'));var logger=require('../../config/logger')(_0x2a7e('0x13'));var utils=require(_0x2a7e('0x14'));var config=require('../../config/environment');var db=require(_0x2a7e('0x15'))['db'];var dbH=require(_0x2a7e('0x15'))['dbH'];function respondWithStatusCode(_0x1a1b54,_0x3ac69e){_0x3ac69e=_0x3ac69e||0xcc;return function(_0x1f172d){if(_0x1f172d){return _0x1a1b54['sendStatus'](_0x3ac69e);}return _0x1a1b54[_0x2a7e('0x16')](_0x3ac69e)[_0x2a7e('0x17')]();};}function respondWithResult(_0xd33157,_0x9a6dfb){_0x9a6dfb=_0x9a6dfb||0xc8;return function(_0x42d143){if(_0x42d143){return _0xd33157[_0x2a7e('0x16')](_0x9a6dfb)[_0x2a7e('0x18')](_0x42d143);}};}function respondWithFilteredResult(_0x3908ad,_0xc85d8b){return function(_0x5f385c){if(_0x5f385c){var _0x22bc60=_0x5f385c['count'],_0x12dd06=_0xc85d8b[_0x2a7e('0x19')],_0x2a0c5f=_0xc85d8b['offset']+_0xc85d8b[_0x2a7e('0x1a')],_0x464e21;if(_0x2a0c5f>=_0x22bc60){_0x2a0c5f=_0x22bc60;_0x464e21=0xc8;}else{_0x464e21=0xce;}_0x3908ad[_0x2a7e('0x16')](_0x464e21);return _0x3908ad[_0x2a7e('0x1b')](_0x2a7e('0x1c'),_0x12dd06+'-'+_0x2a0c5f+'/'+_0x22bc60)[_0x2a7e('0x18')](_0x5f385c);}return null;};}function patchUpdates(_0xcde1b4){return function(_0x14ac1a){try{jsonpatch[_0x2a7e('0x1d')](_0x14ac1a,_0xcde1b4,!![]);}catch(_0x464065){return BPromise[_0x2a7e('0x1e')](_0x464065);}return _0x14ac1a[_0x2a7e('0x1f')]();};}function saveUpdates(_0x429e1c,_0x3ea133){return function(_0x44c215){if(_0x44c215){return _0x44c215[_0x2a7e('0x20')](_0x429e1c)[_0x2a7e('0x21')](function(_0x3f0b33){return _0x3f0b33;});}return null;};}function removeEntity(_0x338d98,_0x48a3eb){return function(_0xaaedb5){if(_0xaaedb5){return _0xaaedb5[_0x2a7e('0x22')]()[_0x2a7e('0x21')](function(){var _0x258031=_0xaaedb5[_0x2a7e('0x23')]({'plain':!![]});var _0x44ecec=_0x2a7e('0x24');return db[_0x2a7e('0x25')][_0x2a7e('0x22')]({'where':{'type':_0x44ecec,'resourceId':_0x258031['id']}})['then'](function(){return _0xaaedb5;});})[_0x2a7e('0x21')](function(){_0x338d98[_0x2a7e('0x16')](0xcc)[_0x2a7e('0x17')]();});}};}function handleEntityNotFound(_0x1cd84c,_0x2436e9){return function(_0x5bbe9d){if(!_0x5bbe9d){_0x1cd84c[_0x2a7e('0x26')](0x194);}return _0x5bbe9d;};}function handleError(_0x25f851,_0xb7f684){_0xb7f684=_0xb7f684||0x1f4;return function(_0x2ae8db){logger[_0x2a7e('0x27')](_0x2ae8db[_0x2a7e('0x28')]);if(_0x2ae8db[_0x2a7e('0x29')]){delete _0x2ae8db['name'];}_0x25f851[_0x2a7e('0x16')](_0xb7f684)[_0x2a7e('0x2a')](_0x2ae8db);};}exports['index']=function(_0x7c4abe,_0xc6ce69){var _0x2340a6={},_0x3e666b={},_0x5f2075={'count':0x0,'rows':[]};var _0x185265=_[_0x2a7e('0x2b')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x37acdb){return{'name':_0x37acdb['fieldName'],'type':_0x37acdb[_0x2a7e('0x2c')]['key']};});_0x3e666b[_0x2a7e('0x2d')]=_[_0x2a7e('0x2b')](_0x185265,'name');_0x3e666b[_0x2a7e('0x2e')]=_[_0x2a7e('0x2f')](_0x7c4abe['query']);_0x3e666b[_0x2a7e('0x30')]=_[_0x2a7e('0x31')](_0x3e666b[_0x2a7e('0x2d')],_0x3e666b['query']);_0x2340a6[_0x2a7e('0x32')]=_[_0x2a7e('0x31')](_0x3e666b[_0x2a7e('0x2d')],qs[_0x2a7e('0x33')](_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x33')]));_0x2340a6[_0x2a7e('0x32')]=_0x2340a6[_0x2a7e('0x32')]['length']?_0x2340a6['attributes']:_0x3e666b['model'];if(!_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x34')](_0x2a7e('0x35'))){_0x2340a6[_0x2a7e('0x1a')]=qs[_0x2a7e('0x1a')](_0x7c4abe[_0x2a7e('0x2e')]['limit']);_0x2340a6['offset']=qs[_0x2a7e('0x19')](_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x19')]);}_0x2340a6[_0x2a7e('0x36')]=qs[_0x2a7e('0x37')](_0x7c4abe['query'][_0x2a7e('0x37')]);_0x2340a6[_0x2a7e('0x38')]=qs[_0x2a7e('0x30')](_['pick'](_0x7c4abe[_0x2a7e('0x2e')],_0x3e666b[_0x2a7e('0x30')]),_0x185265);if(_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x39')]){_0x2340a6[_0x2a7e('0x38')]=_[_0x2a7e('0x3a')](_0x2340a6[_0x2a7e('0x38')],{'$or':_['map'](_0x185265,function(_0x409ea1){if(_0x409ea1[_0x2a7e('0x2c')]!=='VIRTUAL'){var _0x3e8d74={};_0x3e8d74[_0x409ea1[_0x2a7e('0x29')]]={'$like':'%'+_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x39')]+'%'};return _0x3e8d74;}})});}_0x2340a6=_[_0x2a7e('0x3a')]({},_0x2340a6,_0x7c4abe[_0x2a7e('0x3b')]);var _0x171dbd={'where':_0x2340a6[_0x2a7e('0x38')]};return db[_0x2a7e('0x3c')]['count'](_0x171dbd)[_0x2a7e('0x21')](function(_0x11dbe8){_0x5f2075['count']=_0x11dbe8;if(_0x7c4abe[_0x2a7e('0x2e')][_0x2a7e('0x3d')]){_0x2340a6[_0x2a7e('0x3e')]=[{'all':!![]}];}return db[_0x2a7e('0x3c')][_0x2a7e('0x3f')](_0x2340a6);})['then'](function(_0x53b003){_0x5f2075[_0x2a7e('0x40')]=_0x53b003;return _0x5f2075;})['then'](respondWithFilteredResult(_0xc6ce69,_0x2340a6))[_0x2a7e('0x41')](handleError(_0xc6ce69,null));};exports[_0x2a7e('0x42')]=function(_0x549387,_0x1b6a5f){var _0x219191={'raw':!![],'where':{'id':_0x549387[_0x2a7e('0x43')]['id']}},_0x4a9f08={};_0x4a9f08[_0x2a7e('0x2d')]=_[_0x2a7e('0x2f')](db[_0x2a7e('0x3c')]['rawAttributes']);_0x4a9f08[_0x2a7e('0x2e')]=_[_0x2a7e('0x2f')](_0x549387['query']);_0x4a9f08['filters']=_[_0x2a7e('0x31')](_0x4a9f08[_0x2a7e('0x2d')],_0x4a9f08['query']);_0x219191[_0x2a7e('0x32')]=_[_0x2a7e('0x31')](_0x4a9f08[_0x2a7e('0x2d')],qs['fields'](_0x549387[_0x2a7e('0x2e')][_0x2a7e('0x33')]));_0x219191['attributes']=_0x219191['attributes'][_0x2a7e('0x44')]?_0x219191[_0x2a7e('0x32')]:_0x4a9f08[_0x2a7e('0x2d')];if(_0x549387['query']['includeAll']){_0x219191[_0x2a7e('0x3e')]=[{'all':!![]}];}_0x219191=_[_0x2a7e('0x3a')]({},_0x219191,_0x549387[_0x2a7e('0x3b')]);return db[_0x2a7e('0x3c')][_0x2a7e('0x45')](_0x219191)['then'](handleEntityNotFound(_0x1b6a5f,null))['then'](respondWithResult(_0x1b6a5f,null))[_0x2a7e('0x41')](handleError(_0x1b6a5f,null));};exports['create']=function(_0x736a0b,_0x2b93d4){return db[_0x2a7e('0x3c')][_0x2a7e('0x46')](_0x736a0b[_0x2a7e('0x47')],{})['then'](function(_0x17a38d){var _0x4311e8=_0x736a0b[_0x2a7e('0x48')][_0x2a7e('0x23')]({'plain':!![]});if(!_0x4311e8)throw new Error(_0x2a7e('0x49'));if(_0x4311e8[_0x2a7e('0x4a')]===_0x2a7e('0x48')){var _0x1c5d80=_0x17a38d['get']({'plain':!![]});var _0x3b75e9=_0x2a7e('0x4b');return db[_0x2a7e('0x4c')]['find']({'where':{'name':_0x3b75e9,'userProfileId':_0x4311e8[_0x2a7e('0x4d')]},'raw':!![]})['then'](function(_0x5752ff){if(_0x5752ff&&_0x5752ff['autoAssociation']===0x0){return db[_0x2a7e('0x25')][_0x2a7e('0x46')]({'name':_0x1c5d80['name'],'resourceId':_0x1c5d80['id'],'type':_0x2a7e('0x24'),'sectionId':_0x5752ff['id']},{})['then'](function(){return _0x17a38d;});}else{return _0x17a38d;}})['catch'](function(_0x11dfe0){logger[_0x2a7e('0x27')](_0x2a7e('0x4e'),_0x11dfe0);throw _0x11dfe0;});}return _0x17a38d;})[_0x2a7e('0x21')](respondWithResult(_0x2b93d4,0xc9))['catch'](handleError(_0x2b93d4,null));};exports[_0x2a7e('0x20')]=function(_0x55f558,_0x2a8f62){if(_0x55f558[_0x2a7e('0x47')]['id']){delete _0x55f558[_0x2a7e('0x47')]['id'];}return db[_0x2a7e('0x3c')][_0x2a7e('0x45')]({'where':{'id':_0x55f558[_0x2a7e('0x43')]['id']}})[_0x2a7e('0x21')](handleEntityNotFound(_0x2a8f62,null))['then'](saveUpdates(_0x55f558[_0x2a7e('0x47')],null))[_0x2a7e('0x21')](respondWithResult(_0x2a8f62,null))[_0x2a7e('0x41')](handleError(_0x2a8f62,null));};exports[_0x2a7e('0x22')]=function(_0x33084f,_0x46ec52){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x33084f[_0x2a7e('0x43')]['id']}})['then'](handleEntityNotFound(_0x46ec52,null))[_0x2a7e('0x21')](removeEntity(_0x46ec52,null))[_0x2a7e('0x41')](handleError(_0x46ec52,null));};exports[_0x2a7e('0x4f')]=function(_0x35cf13,_0x1374bf){var _0x1fbd34=0xa;var _0x1faa8b=[_0x2a7e('0x50'),_0x2a7e('0x51'),_0x2a7e('0x52'),'cross_join'];var _0x3e4229={'SUM':_0x2a7e('0x53'),'COUNT':_0x2a7e('0x54'),'COUNT DISTINCT':_0x2a7e('0x55'),'MAX':'MAX(%s)','MIN':_0x2a7e('0x56'),'AVG':_0x2a7e('0x57'),'GROUP_CONCAT':_0x2a7e('0x58'),'GROUP_CONCAT ASC':_0x2a7e('0x59'),'GROUP_CONCAT DESC':_0x2a7e('0x5a')};var _0x7ce94e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2a7e('0x5b'),'HOUR':_0x2a7e('0x5c'),'ROUND':_0x2a7e('0x5d'),'UNIX_TIMESTAMP':_0x2a7e('0x5e')};var _0x26a36c=function(_0x15b67f){return!_[_0x2a7e('0x5f')]([_0x2a7e('0x60'),'IS\x20NOT\x20NULL',_0x2a7e('0x61'),_0x2a7e('0x62')],_0x15b67f);};var _0xa84eca=function(_0x5f4a03){if(!_0x5f4a03||!_0x5f4a03['rules'][_0x2a7e('0x44')]){return'';}for(var _0x305754='(',_0x2fb89c=0x0;_0x2fb89c<_0x5f4a03['rules'][_0x2a7e('0x44')];_0x2fb89c+=0x1){_0x2fb89c>0x0&&(_0x305754+='\x20'+_0x5f4a03[_0x2a7e('0x63')]+'\x20');_0x305754+=_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x65')]?_0xa84eca(_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x65')]):_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x66')]+'\x20'+_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x67')]+(_0x26a36c(_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x67')])?'\x20'+_0x5f4a03[_0x2a7e('0x64')][_0x2fb89c][_0x2a7e('0x68')]:'');}return _0x305754+')';};var _0x12e59c={'where':{'id':_0x35cf13[_0x2a7e('0x43')]['id']}},_0x2a7c33,_0xe13e78,_0x34b9fa,_0x30fd67,_0x1bbe00;_0x12e59c=_['merge']({},_0x12e59c,_0x35cf13[_0x2a7e('0x3b')]);return db[_0x2a7e('0x3c')][_0x2a7e('0x45')](_0x12e59c)[_0x2a7e('0x21')](function(_0x44982d){if(_0x44982d){_0x2a7c33=_0x44982d;return _0x44982d[_0x2a7e('0x69')]();}return null;})[_0x2a7e('0x21')](function(_0x302eea){if(_0x302eea){if(!_0x302eea[_0x2a7e('0x44')]){throw new db[(_0x2a7e('0x6a'))][(_0x2a7e('0x6b'))](_0x2a7e('0x6c'),0x193);}_0xe13e78=_0x302eea;return db[_0x2a7e('0x6d')][_0x2a7e('0x3f')]({'raw':!![]});}return null;})[_0x2a7e('0x21')](function(_0x3e5075){if(_0x3e5075){_0x34b9fa=_[_0x2a7e('0x6e')](_0x3e5075,'id');var _0x82f842;var _0x31e423=squel[_0x2a7e('0x6f')]();_0x31e423['from'](_0x2a7c33[_0x2a7e('0x70')]);for(var _0xcb81c8=0x0;_0xcb81c8<_0xe13e78[_0x2a7e('0x44')];_0xcb81c8+=0x1){_0x82f842=_0xe13e78[_0xcb81c8][_0x2a7e('0x71')]?_0x34b9fa[_0xe13e78[_0xcb81c8][_0x2a7e('0x71')]][_0x2a7e('0x72')]:_0xe13e78[_0xcb81c8][_0x2a7e('0x66')];_0x82f842=_0xe13e78[_0xcb81c8][_0x2a7e('0x73')]?_[_0x2a7e('0x74')](_0x3e4229[_0xe13e78[_0xcb81c8][_0x2a7e('0x73')]],'%s',_0x82f842):_0x82f842;_0x82f842=_0xe13e78[_0xcb81c8]['format']?_[_0x2a7e('0x74')](_0x7ce94e[_0xe13e78[_0xcb81c8]['format']],'%s',_0x82f842):_0x82f842;if(_0xe13e78[_0xcb81c8][_0x2a7e('0x75')]){_0x31e423[_0x2a7e('0x65')](_0x82f842);}_0xe13e78[_0xcb81c8]['orderBy']&&_0x31e423[_0x2a7e('0x36')](_0x82f842,_0xe13e78[_0xcb81c8]['orderBy']===_0x2a7e('0x76')?![]:!![]);_0x31e423[_0x2a7e('0x66')](_0x82f842,_0xe13e78[_0xcb81c8][_0x2a7e('0x77')]||_0x82f842);}if(_0x2a7c33[_0x2a7e('0x78')]){_0x2a7c33[_0x2a7e('0x78')]=JSON[_0x2a7e('0x79')](_0x2a7c33[_0x2a7e('0x78')]);for(var _0x4265ee=0x0;_0x4265ee<_0x2a7c33[_0x2a7e('0x78')][_0x2a7e('0x44')];_0x4265ee+=0x1){if(_0x2a7c33[_0x2a7e('0x78')][_0x4265ee][_0x2a7e('0x2c')]&&_[_0x2a7e('0x5f')](_0x1faa8b,_0x2a7c33['joins'][_0x4265ee]['type'])&&_0x2a7c33['joins'][_0x4265ee][_0x2a7e('0x7a')]&&_0x2a7c33['joins'][_0x4265ee][_0x2a7e('0x7b')]&&_0x2a7c33[_0x2a7e('0x78')][_0x4265ee]['foreignKey']){_0x31e423[_0x2a7c33[_0x2a7e('0x78')][_0x4265ee]['type']](_0x2a7c33[_0x2a7e('0x78')][_0x4265ee][_0x2a7e('0x7b')],null,util['format'](_0x2a7e('0x7c'),_0x2a7c33[_0x2a7e('0x70')],_0x2a7c33[_0x2a7e('0x78')][_0x4265ee][_0x2a7e('0x7a')],_0x2a7c33[_0x2a7e('0x78')][_0x4265ee]['foreignTable'],_0x2a7c33[_0x2a7e('0x78')][_0x4265ee]['foreignKey']));}}}if(_0x2a7c33[_0x2a7e('0x7d')]){_0x2a7c33[_0x2a7e('0x7d')]=JSON[_0x2a7e('0x79')](_0x2a7c33[_0x2a7e('0x7d')]);_0x31e423[_0x2a7e('0x38')](_0xa84eca(_0x2a7c33[_0x2a7e('0x7d')][_0x2a7e('0x65')]));}_0x1bbe00=_0x31e423[_0x2a7e('0x7e')]();_0x31e423['limit'](_0x1fbd34);_0x31e423[_0x2a7e('0x19')](0x0);logger[_0x2a7e('0x7f')]('Limited\x20Query:',_0x31e423[_0x2a7e('0x80')]());return db[_0x2a7e('0x81')][_0x2a7e('0x2e')](_0x31e423[_0x2a7e('0x80')](),{'type':db[_0x2a7e('0x81')][_0x2a7e('0x82')][_0x2a7e('0x83')]});}})[_0x2a7e('0x21')](respondWithResult(_0x1374bf,null))[_0x2a7e('0x41')](handleError(_0x1374bf,null));};function runReport(_0x524c4e,_0x4ff699,_0x203d0a){var _0x47258f=_0x4ff699[_0x2a7e('0x29')];var _0x5a1b9f=0xa;var _0x8ca50b=[_0x2a7e('0x50'),'left_join',_0x2a7e('0x52'),_0x2a7e('0x84')];var _0x58943b={'SUM':_0x2a7e('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2a7e('0x55'),'MAX':_0x2a7e('0x85'),'MIN':_0x2a7e('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2a7e('0x59'),'GROUP_CONCAT DESC':_0x2a7e('0x5a')};var _0x5f62d0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2a7e('0x5b'),'HOUR':_0x2a7e('0x5c'),'ROUND':_0x2a7e('0x5d'),'UNIX_TIMESTAMP':_0x2a7e('0x5e')};var _0x3572ec=function(_0x1a509f){return!_[_0x2a7e('0x5f')](['IS\x20NULL',_0x2a7e('0x86'),_0x2a7e('0x61'),_0x2a7e('0x62')],_0x1a509f);};var _0x1341b8=function(_0x4074d0){if(!_0x4074d0||!_0x4074d0[_0x2a7e('0x64')][_0x2a7e('0x44')]){return'';}for(var _0x451b54='(',_0x319216=0x0;_0x319216<_0x4074d0['rules'][_0x2a7e('0x44')];_0x319216+=0x1){_0x319216>0x0&&(_0x451b54+='\x20'+_0x4074d0[_0x2a7e('0x63')]+'\x20');_0x451b54+=_0x4074d0[_0x2a7e('0x64')][_0x319216][_0x2a7e('0x65')]?_0x1341b8(_0x4074d0['rules'][_0x319216][_0x2a7e('0x65')]):_0x4074d0[_0x2a7e('0x64')][_0x319216][_0x2a7e('0x66')]+'\x20'+_0x4074d0[_0x2a7e('0x64')][_0x319216]['condition']+(_0x3572ec(_0x4074d0[_0x2a7e('0x64')][_0x319216]['condition'])?'\x20'+_0x4074d0[_0x2a7e('0x64')][_0x319216][_0x2a7e('0x68')]:'');}return _0x451b54+')';};var _0x12bca5={'where':{'id':_0x524c4e['id']}},_0x3ca113,_0x4c0aaf,_0x54ad8c,_0x22433f,_0x100f69;_0x12bca5=_[_0x2a7e('0x3a')]({},_0x12bca5,_0x203d0a);return db[_0x2a7e('0x3c')][_0x2a7e('0x45')](_0x12bca5)['then'](function(_0x2a8967){if(_0x2a8967){_0x3ca113=_0x2a8967;return _0x2a8967['getFields']();}return null;})[_0x2a7e('0x21')](function(_0x2245c1){if(_0x2245c1){if(!_0x2245c1[_0x2a7e('0x44')]){throw new db['Sequelize']['ValidationErrorItem'](_0x2a7e('0x6c'),0x193);}_0x4c0aaf=_0x2245c1;return db[_0x2a7e('0x6d')][_0x2a7e('0x3f')]({'raw':!![]});}return null;})[_0x2a7e('0x21')](function(_0x441131){if(_0x441131){_0x54ad8c=_[_0x2a7e('0x6e')](_0x441131,'id');var _0x50190f;var _0x4c41c6=squel[_0x2a7e('0x6f')]();_0x4c41c6[_0x2a7e('0x87')](_0x3ca113[_0x2a7e('0x70')]);for(var _0x5622cb=0x0;_0x5622cb<_0x4c0aaf[_0x2a7e('0x44')];_0x5622cb+=0x1){_0x50190f=_0x4c0aaf[_0x5622cb]['MetricId']?_0x54ad8c[_0x4c0aaf[_0x5622cb][_0x2a7e('0x71')]][_0x2a7e('0x72')]:_0x4c0aaf[_0x5622cb][_0x2a7e('0x66')];_0x50190f=_0x4c0aaf[_0x5622cb][_0x2a7e('0x73')]?_[_0x2a7e('0x74')](_0x58943b[_0x4c0aaf[_0x5622cb][_0x2a7e('0x73')]],'%s',_0x50190f):_0x50190f;_0x50190f=_0x4c0aaf[_0x5622cb][_0x2a7e('0x88')]?_[_0x2a7e('0x74')](_0x5f62d0[_0x4c0aaf[_0x5622cb][_0x2a7e('0x88')]],'%s',_0x50190f):_0x50190f;if(_0x4c0aaf[_0x5622cb][_0x2a7e('0x75')]){_0x4c41c6['group'](_0x50190f);}_0x4c0aaf[_0x5622cb][_0x2a7e('0x89')]&&_0x4c41c6[_0x2a7e('0x36')](_0x50190f,_0x4c0aaf[_0x5622cb][_0x2a7e('0x89')]===_0x2a7e('0x76')?![]:!![]);_0x4c41c6[_0x2a7e('0x66')](_0x50190f,_0x4c0aaf[_0x5622cb][_0x2a7e('0x77')]||_0x50190f);}if(_0x3ca113['joins']){_0x3ca113[_0x2a7e('0x78')]=JSON[_0x2a7e('0x79')](_0x3ca113['joins']);for(var _0x18270d=0x0;_0x18270d<_0x3ca113[_0x2a7e('0x78')]['length'];_0x18270d+=0x1){if(_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x2c')]&&_[_0x2a7e('0x5f')](_0x8ca50b,_0x3ca113['joins'][_0x18270d]['type'])&&_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x7a')]&&_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x7b')]&&_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x8a')]){_0x4c41c6[_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x2c')]](_0x3ca113[_0x2a7e('0x78')][_0x18270d]['foreignTable'],null,util[_0x2a7e('0x88')](_0x2a7e('0x7c'),_0x3ca113[_0x2a7e('0x70')],_0x3ca113[_0x2a7e('0x78')][_0x18270d]['parentKey'],_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x7b')],_0x3ca113[_0x2a7e('0x78')][_0x18270d][_0x2a7e('0x8a')]));}}}if(_0x3ca113['conditions']){_0x3ca113['conditions']=JSON['parse'](_0x3ca113[_0x2a7e('0x7d')]);_0x4c41c6[_0x2a7e('0x38')](_0x1341b8(_0x3ca113[_0x2a7e('0x7d')]['group']));}_0x100f69=_0x4c41c6[_0x2a7e('0x7e')]();_0x4c41c6[_0x2a7e('0x1a')](_0x5a1b9f);_0x4c41c6[_0x2a7e('0x19')](0x0);logger[_0x2a7e('0x7f')](_0x2a7e('0x8b'),_0x4c41c6[_0x2a7e('0x80')]());return db['sequelize'][_0x2a7e('0x2e')](_0x4c41c6[_0x2a7e('0x80')](),{'type':db[_0x2a7e('0x81')][_0x2a7e('0x82')][_0x2a7e('0x83')]});}})[_0x2a7e('0x21')](function(_0x2e7e40){if(!_0x2e7e40['length']){throw new db['Sequelize'][(_0x2a7e('0x6b'))](_0x2a7e('0x8c'),0xcc);}if(_0x4ff699[_0x2a7e('0x8d')]===_0x2a7e('0x8e')){return null;}var _0x5e95aa=_[_0x2a7e('0x3a')](_0x4ff699,{'name':_0x4ff699[_0x2a7e('0x8f')]||_0x4ff699[_0x2a7e('0x29')]||_0x3ca113[_0x2a7e('0x29')],'basename':_0x47258f,'savename':util[_0x2a7e('0x88')](_0x2a7e('0x90'),_0x4ff699[_0x2a7e('0x29')]||_0x3ca113[_0x2a7e('0x29')],require(_0x2a7e('0x91'))[_0x2a7e('0x92')](0x4),_0x4ff699[_0x2a7e('0x8d')]||_0x2a7e('0x93')),'reportId':_0x3ca113['id'],'reportType':_0x2a7e('0x94')});return db[_0x2a7e('0x95')][_0x2a7e('0x46')](_0x5e95aa,{'raw':!![]});})[_0x2a7e('0x21')](function(_0x22dfb5){if(_0x3ca113[_0x2a7e('0x70')]==='cdr'){_0x100f69[_0x2a7e('0x38')](_0x3ca113[_0x2a7e('0x70')]+_0x2a7e('0x96'),_0x4ff699[_0x2a7e('0x97')],_0x4ff699[_0x2a7e('0x98')]);}else{_0x100f69[_0x2a7e('0x38')](_0x3ca113[_0x2a7e('0x70')]+_0x2a7e('0x99'),_0x4ff699[_0x2a7e('0x97')],_0x4ff699[_0x2a7e('0x98')]);}if(_0x22dfb5){logger[_0x2a7e('0x9a')]('Run\x20Query:',_0x100f69[_0x2a7e('0x80')]());require(_0x2a7e('0x9b'))[_0x2a7e('0x9c')](path[_0x2a7e('0x50')](__dirname,_0x2a7e('0x9d'),_0x22dfb5['output']),[_0x22dfb5['id'],_0x100f69[_0x2a7e('0x80')](),path['join'](__dirname,_0x2a7e('0x9e'),_0x22dfb5[_0x2a7e('0x9f')]),_0x47258f]);return _0x22dfb5;}else{var _0x1543a6=squel[_0x2a7e('0x6f')]();_0x1543a6[_0x2a7e('0x87')]('('+_0x100f69[_0x2a7e('0x80')]()+')',_0x2a7e('0xa0'));_0x1543a6['field'](_0x2a7e('0xa1'),_0x2a7e('0xa2'));_0x100f69[_0x2a7e('0x1a')](_0x4ff699[_0x2a7e('0x1a')]||_0x5a1b9f);_0x100f69[_0x2a7e('0x19')](_0x4ff699[_0x2a7e('0x19')]||0x0);return dbH[_0x2a7e('0x81')]['query'](_0x1543a6[_0x2a7e('0x80')](),{'type':dbH[_0x2a7e('0x81')][_0x2a7e('0x82')][_0x2a7e('0x83')]})[_0x2a7e('0x21')](function(_0x2a8fc8){if(!_0x2a8fc8[_0x2a7e('0x44')]){_0x22433f=0x0;}else{_0x22433f=_0x2a8fc8[0x0]['count']||0x0;}return dbH[_0x2a7e('0x81')][_0x2a7e('0x2e')](_0x100f69[_0x2a7e('0x80')](),{'type':dbH[_0x2a7e('0x81')]['QueryTypes'][_0x2a7e('0x83')]});})[_0x2a7e('0x21')](function(_0x3936f2){return{'rows':_0x3936f2||[],'count':_0x22433f};});}});}exports[_0x2a7e('0xa3')]=function(_0x100289,_0x514287){return runReport(_0x100289[_0x2a7e('0x43')],_0x100289[_0x2a7e('0x2e')],_0x100289[_0x2a7e('0x3b')])[_0x2a7e('0x21')](respondWithResult(_0x514287,null))[_0x2a7e('0x41')](handleError(_0x514287,null));};exports['runReport']=runReport;exports[_0x2a7e('0x2e')]=function(_0x14b279,_0x11eb4a){var _0x54d2e3=0xa;var _0x26f33b=[_0x2a7e('0x50'),_0x2a7e('0x51'),_0x2a7e('0x52'),'cross_join'];var _0x24148b={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2a7e('0x55'),'MAX':'MAX(%s)','MIN':_0x2a7e('0x56'),'AVG':_0x2a7e('0x57'),'GROUP_CONCAT':_0x2a7e('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2a7e('0x5a')};var _0x422f1d={'SEC_TO_TIME':_0x2a7e('0xa4'),'DATE':'DATE(%s)','HOUR':_0x2a7e('0x5c'),'ROUND':_0x2a7e('0x5d'),'UNIX_TIMESTAMP':_0x2a7e('0x5e')};var _0x43ec57=function(_0x406c49){return!_['includes'](['IS\x20NULL',_0x2a7e('0x86'),_0x2a7e('0x61'),_0x2a7e('0x62')],_0x406c49);};var _0x27158d=function(_0x14b265){if(!_0x14b265||!_0x14b265['rules'][_0x2a7e('0x44')]){return'';}for(var _0x51b8d1='(',_0x3c43bf=0x0;_0x3c43bf<_0x14b265[_0x2a7e('0x64')][_0x2a7e('0x44')];_0x3c43bf+=0x1){_0x3c43bf>0x0&&(_0x51b8d1+='\x20'+_0x14b265['operator']+'\x20');_0x51b8d1+=_0x14b265[_0x2a7e('0x64')][_0x3c43bf][_0x2a7e('0x65')]?_0x27158d(_0x14b265[_0x2a7e('0x64')][_0x3c43bf][_0x2a7e('0x65')]):_0x14b265[_0x2a7e('0x64')][_0x3c43bf][_0x2a7e('0x66')]+'\x20'+_0x14b265['rules'][_0x3c43bf][_0x2a7e('0x67')]+(_0x43ec57(_0x14b265[_0x2a7e('0x64')][_0x3c43bf][_0x2a7e('0x67')])?'\x20'+_0x14b265['rules'][_0x3c43bf]['value']:'');}return _0x51b8d1+')';};var _0x3a8c52={'where':{'id':_0x14b279[_0x2a7e('0x43')]['id']}},_0x41046a,_0x42d229,_0x51672a,_0x27cf1e,_0x54b19a;_0x3a8c52=_['merge']({},_0x3a8c52,_0x14b279[_0x2a7e('0x3b')]);return db[_0x2a7e('0x3c')][_0x2a7e('0x45')](_0x3a8c52)[_0x2a7e('0x21')](function(_0x42a510){if(_0x42a510){_0x41046a=_0x42a510;return _0x42a510[_0x2a7e('0x69')]();}return null;})[_0x2a7e('0x21')](function(_0x15785e){if(_0x15785e){if(!_0x15785e[_0x2a7e('0x44')]){throw new db[(_0x2a7e('0x6a'))][(_0x2a7e('0x6b'))](_0x2a7e('0x6c'),0x193);}_0x42d229=_0x15785e;return db[_0x2a7e('0x6d')][_0x2a7e('0x3f')]({'raw':!![]});}return null;})[_0x2a7e('0x21')](function(_0x214d7e){if(_0x214d7e){_0x51672a=_[_0x2a7e('0x6e')](_0x214d7e,'id');var _0x3f877b;var _0x1c6a67=squel[_0x2a7e('0x6f')]();_0x1c6a67[_0x2a7e('0x87')](_0x41046a[_0x2a7e('0x70')]);for(var _0x498380=0x0;_0x498380<_0x42d229[_0x2a7e('0x44')];_0x498380+=0x1){_0x3f877b=_0x42d229[_0x498380][_0x2a7e('0x71')]?_0x51672a[_0x42d229[_0x498380][_0x2a7e('0x71')]]['metric']:_0x42d229[_0x498380]['field'];_0x3f877b=_0x42d229[_0x498380][_0x2a7e('0x73')]?_['replace'](_0x24148b[_0x42d229[_0x498380][_0x2a7e('0x73')]],'%s',_0x3f877b):_0x3f877b;_0x3f877b=_0x42d229[_0x498380]['format']?_[_0x2a7e('0x74')](_0x422f1d[_0x42d229[_0x498380]['format']],'%s',_0x3f877b):_0x3f877b;if(_0x42d229[_0x498380][_0x2a7e('0x75')]){_0x1c6a67[_0x2a7e('0x65')](_0x3f877b);}_0x42d229[_0x498380][_0x2a7e('0x89')]&&_0x1c6a67[_0x2a7e('0x36')](_0x3f877b,_0x42d229[_0x498380]['orderBy']===_0x2a7e('0x76')?![]:!![]);_0x1c6a67[_0x2a7e('0x66')](_0x3f877b,_0x42d229[_0x498380][_0x2a7e('0x77')]||_0x3f877b);}if(_0x41046a['joins']){_0x41046a[_0x2a7e('0x78')]=JSON[_0x2a7e('0x79')](_0x41046a[_0x2a7e('0x78')]);for(var _0x680995=0x0;_0x680995<_0x41046a[_0x2a7e('0x78')][_0x2a7e('0x44')];_0x680995+=0x1){if(_0x41046a['joins'][_0x680995][_0x2a7e('0x2c')]&&_[_0x2a7e('0x5f')](_0x26f33b,_0x41046a['joins'][_0x680995]['type'])&&_0x41046a[_0x2a7e('0x78')][_0x680995]['parentKey']&&_0x41046a[_0x2a7e('0x78')][_0x680995]['foreignTable']&&_0x41046a[_0x2a7e('0x78')][_0x680995][_0x2a7e('0x8a')]){_0x1c6a67[_0x41046a[_0x2a7e('0x78')][_0x680995][_0x2a7e('0x2c')]](_0x41046a['joins'][_0x680995]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x41046a['table'],_0x41046a[_0x2a7e('0x78')][_0x680995][_0x2a7e('0x7a')],_0x41046a[_0x2a7e('0x78')][_0x680995][_0x2a7e('0x7b')],_0x41046a[_0x2a7e('0x78')][_0x680995][_0x2a7e('0x8a')]));}}}if(_0x41046a[_0x2a7e('0x7d')]){_0x41046a['conditions']=JSON[_0x2a7e('0x79')](_0x41046a[_0x2a7e('0x7d')]);_0x1c6a67[_0x2a7e('0x38')](_0x27158d(_0x41046a[_0x2a7e('0x7d')]['group']));}_0x54b19a=_0x1c6a67['clone']();_0x1c6a67[_0x2a7e('0x1a')](_0x54d2e3);_0x1c6a67[_0x2a7e('0x19')](0x0);logger[_0x2a7e('0x7f')](_0x2a7e('0x8b'),_0x1c6a67[_0x2a7e('0x80')]());return db[_0x2a7e('0x81')]['query'](_0x1c6a67[_0x2a7e('0x80')](),{'type':db[_0x2a7e('0x81')][_0x2a7e('0x82')][_0x2a7e('0x83')]});}})['then'](function(){return{'sql':_0x54b19a[_0x2a7e('0x80')]()};})[_0x2a7e('0x21')](respondWithResult(_0x11eb4a,null))[_0x2a7e('0x41')](handleError(_0x11eb4a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d082e6d..9888cbf 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports'];(function(_0x6661c6,_0xc77046){var _0x27733d=function(_0x3fc9b7){while(--_0x3fc9b7){_0x6661c6['push'](_0x6661c6['shift']());}};_0x27733d(++_0xc77046);}(_0x1261,0x144));var _0x1126=function(_0x35b07d,_0x3d0ae7){_0x35b07d=_0x35b07d-0x0;var _0x2868bc=_0x1261[_0x35b07d];return _0x2868bc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x1405bd,_0x132b84){var _0x193ac3=function(_0x4edbd6){while(--_0x4edbd6){_0x1405bd['push'](_0x1405bd['shift']());}};_0x193ac3(++_0x132b84);}(_0x326f,0xd1));var _0xf326=function(_0x1dcf01,_0xdb2ff8){_0x1dcf01=_0x1dcf01-0x0;var _0x221386=_0x326f[_0x1dcf01];return _0x221386;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a63466e..649d62f 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 _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7d13,0x6c));var _0x37d1=function(_0x1d0b3e,_0x3d9963){_0x1d0b3e=_0x1d0b3e-0x0;var _0x59ac4c=_0x7d13[_0x1d0b3e];return _0x59ac4c;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file +var _0x7b37=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x44b5d9,_0xe28bb1){var _0x25d599=function(_0x33d5ed){while(--_0x33d5ed){_0x44b5d9['push'](_0x44b5d9['shift']());}};_0x25d599(++_0xe28bb1);}(_0x7b37,0xd9));var _0x77b3=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x7b37[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 195acf1..d341ef3 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 _0x2d58=['/:id/run','/:id/query','query','post','create','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview'];(function(_0x90f97c,_0x5eee02){var _0x44f221=function(_0x192ddb){while(--_0x192ddb){_0x90f97c['push'](_0x90f97c['shift']());}};_0x44f221(++_0x5eee02);}(_0x2d58,0x17e));var _0x82d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d58[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x82d5('0x0'));var util=require(_0x82d5('0x1'));var path=require(_0x82d5('0x2'));var timeout=require(_0x82d5('0x3'));var express=require('express');var router=express[_0x82d5('0x4')]();var auth=require(_0x82d5('0x5'));var interaction=require(_0x82d5('0x6'));var config=require(_0x82d5('0x7'));var controller=require(_0x82d5('0x8'));router['get']('/',auth[_0x82d5('0x9')](),controller[_0x82d5('0xa')]);router[_0x82d5('0xb')]('/:id',auth[_0x82d5('0x9')](),controller[_0x82d5('0xc')]);router[_0x82d5('0xb')](_0x82d5('0xd'),auth[_0x82d5('0x9')](),controller['preview']);router[_0x82d5('0xb')](_0x82d5('0xe'),auth[_0x82d5('0x9')](),controller['run']);router['get'](_0x82d5('0xf'),auth['isAuthenticated'](),controller[_0x82d5('0x10')]);router[_0x82d5('0x11')]('/',auth[_0x82d5('0x9')](),controller[_0x82d5('0x12')]);router['put']('/:id',auth[_0x82d5('0x9')](),controller['update']);router[_0x82d5('0x13')](_0x82d5('0x14'),auth[_0x82d5('0x9')](),controller[_0x82d5('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7a66=['../../config/environment','./analyticDefaultReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','/:id/run','run','query','post','create','put','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f868a,_0x32c223){var _0x42fb01=function(_0x1a1ea0){while(--_0x1a1ea0){_0x3f868a['push'](_0x3f868a['shift']());}};_0x42fb01(++_0x32c223);}(_0x7a66,0x93));var _0x67a6=function(_0x148819,_0x659d02){_0x148819=_0x148819-0x0;var _0x46cd45=_0x7a66[_0x148819];return _0x46cd45;};'use strict';var multer=require(_0x67a6('0x0'));var util=require(_0x67a6('0x1'));var path=require(_0x67a6('0x2'));var timeout=require(_0x67a6('0x3'));var express=require('express');var router=express[_0x67a6('0x4')]();var auth=require(_0x67a6('0x5'));var interaction=require(_0x67a6('0x6'));var config=require(_0x67a6('0x7'));var controller=require(_0x67a6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x67a6('0x9')]);router[_0x67a6('0xa')](_0x67a6('0xb'),auth[_0x67a6('0xc')](),controller[_0x67a6('0xd')]);router[_0x67a6('0xa')](_0x67a6('0xe'),auth[_0x67a6('0xc')](),controller['preview']);router[_0x67a6('0xa')](_0x67a6('0xf'),auth[_0x67a6('0xc')](),controller[_0x67a6('0x10')]);router[_0x67a6('0xa')]('/:id/query',auth[_0x67a6('0xc')](),controller[_0x67a6('0x11')]);router[_0x67a6('0x12')]('/',auth[_0x67a6('0xc')](),controller[_0x67a6('0x13')]);router[_0x67a6('0x14')](_0x67a6('0xb'),auth[_0x67a6('0xc')](),controller['update']);router[_0x67a6('0x15')](_0x67a6('0xb'),auth[_0x67a6('0xc')](),controller['destroy']);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 9682c28..1d27c77 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 _0xc91b=['moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0xc91b,0xe9));var _0xbc91=function(_0x49a9d6,_0x3ad825){_0x49a9d6=_0x49a9d6-0x0;var _0x1b5a6c=_0xc91b[_0x49a9d6];return _0x1b5a6c;};'use strict';var Sequelize=require(_0xbc91('0x0'));var moment=require(_0xbc91('0x1'));module[_0xbc91('0x2')]={'name':{'type':Sequelize[_0xbc91('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xbc91('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xbc91('0x4')](_0xbc91('0x5'),_0xbc91('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xbc91('0x5')},'savename':{'type':Sequelize[_0xbc91('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbc91('0x7')]},'endDate':{'type':Sequelize[_0xbc91('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xbc91('0x8')},'type':{'type':Sequelize[_0xbc91('0x4')]('manual',_0xbc91('0x9')),'allowNull':![],'defaultValue':_0xbc91('0xa')},'reportId':{'type':Sequelize[_0xbc91('0xb')](0xb)[_0xbc91('0xc')]},'reportType':{'type':Sequelize[_0xbc91('0x3')]}}; \ No newline at end of file +var _0xe9b8=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x1849fe,_0x20dca1){var _0x14b356=function(_0x1ae392){while(--_0x1ae392){_0x1849fe['push'](_0x1849fe['shift']());}};_0x14b356(++_0x20dca1);}(_0xe9b8,0x83));var _0x8e9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9b8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8e9b('0x0'));var moment=require('moment');module[_0x8e9b('0x1')]={'name':{'type':Sequelize[_0x8e9b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8e9b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8e9b('0x3')](_0x8e9b('0x4'),_0x8e9b('0x5'),_0x8e9b('0x6')),'allowNull':![],'defaultValue':_0x8e9b('0x4')},'savename':{'type':Sequelize[_0x8e9b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8e9b('0x7')]},'endDate':{'type':Sequelize[_0x8e9b('0x7')]},'status':{'type':Sequelize[_0x8e9b('0x2')],'defaultValue':_0x8e9b('0x8')},'type':{'type':Sequelize[_0x8e9b('0x3')](_0x8e9b('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8e9b('0x9')},'reportId':{'type':Sequelize[_0x8e9b('0xa')](0xb)[_0x8e9b('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d91d8a5..31f7cd0 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 _0xe15e=['map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','join','server/files/reports','ValidationError','exists','%s.%s','output','toLowerCase','html-pdf','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','index'];(function(_0x141b50,_0x1d6823){var _0x85097b=function(_0x15eb0b){while(--_0x15eb0b){_0x141b50['push'](_0x141b50['shift']());}};_0x85097b(++_0x1d6823);}(_0xe15e,0x131));var _0xee15=function(_0x50c154,_0x4e08a2){_0x50c154=_0x50c154-0x0;var _0x23aad4=_0xe15e[_0x50c154];return _0x23aad4;};'use strict';var pdf=require(_0xee15('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee15('0x1'));var zipdir=require(_0xee15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xee15('0x3'));var Mustache=require(_0xee15('0x4'));var util=require('util');var path=require(_0xee15('0x5'));var sox=require(_0xee15('0x6'));var csv=require('to-csv');var ejs=require(_0xee15('0x7'));var fs=require('fs');var _=require(_0xee15('0x8'));var squel=require(_0xee15('0x9'));var crypto=require(_0xee15('0xa'));var jsforce=require(_0xee15('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee15('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xee15('0xd'));var as=require(_0xee15('0xe'));var hardwareService=require(_0xee15('0xf'));var logger=require(_0xee15('0x10'))(_0xee15('0x11'));var utils=require(_0xee15('0x12'));var config=require(_0xee15('0x13'));var db=require(_0xee15('0x14'))['db'];function respondWithStatusCode(_0x9c3cdf,_0x300f89){_0x300f89=_0x300f89||0xcc;return function(_0x5c4e19){if(_0x5c4e19){return _0x9c3cdf[_0xee15('0x15')](_0x300f89);}return _0x9c3cdf[_0xee15('0x16')](_0x300f89)[_0xee15('0x17')]();};}function respondWithResult(_0x353a5b,_0x526e37){_0x526e37=_0x526e37||0xc8;return function(_0x32cb98){if(_0x32cb98){return _0x353a5b['status'](_0x526e37)[_0xee15('0x18')](_0x32cb98);}};}function respondWithFilteredResult(_0x1e737f,_0x1682d3){return function(_0x2d8f68){if(_0x2d8f68){var _0x3cde0f=_0x2d8f68['count'],_0x4788bd=_0x1682d3[_0xee15('0x19')],_0x3f3bac=_0x1682d3[_0xee15('0x19')]+_0x1682d3[_0xee15('0x1a')],_0x3b7daf;if(_0x3f3bac>=_0x3cde0f){_0x3f3bac=_0x3cde0f;_0x3b7daf=0xc8;}else{_0x3b7daf=0xce;}_0x1e737f[_0xee15('0x16')](_0x3b7daf);return _0x1e737f['set']('Content-Range',_0x4788bd+'-'+_0x3f3bac+'/'+_0x3cde0f)[_0xee15('0x18')](_0x2d8f68);}return null;};}function patchUpdates(_0x534cda){return function(_0x44be95){try{jsonpatch['apply'](_0x44be95,_0x534cda,!![]);}catch(_0x27dff6){return BPromise[_0xee15('0x1b')](_0x27dff6);}return _0x44be95[_0xee15('0x1c')]();};}function saveUpdates(_0x1de510,_0x39293b){return function(_0x3f94fb){if(_0x3f94fb){return _0x3f94fb[_0xee15('0x1d')](_0x1de510)[_0xee15('0x1e')](function(_0x400845){return _0x400845;});}return null;};}function removeEntity(_0x46b5d1,_0x4c1f5b){return function(_0xf707d5){if(_0xf707d5){return _0xf707d5['destroy']()[_0xee15('0x1e')](function(){var _0x40f2ef=_0xf707d5[_0xee15('0x1f')]({'plain':!![]});var _0x5334a8=_0xee15('0x20');return db['UserProfileResource'][_0xee15('0x21')]({'where':{'type':_0x5334a8,'resourceId':_0x40f2ef['id']}})[_0xee15('0x1e')](function(){return _0xf707d5;});})['then'](function(){_0x46b5d1[_0xee15('0x16')](0xcc)[_0xee15('0x17')]();});}};}function handleEntityNotFound(_0x23c792,_0x3622c0){return function(_0xfe6ca7){if(!_0xfe6ca7){_0x23c792[_0xee15('0x15')](0x194);}return _0xfe6ca7;};}function handleError(_0x6a7654,_0x2fb1e0){_0x2fb1e0=_0x2fb1e0||0x1f4;return function(_0x1812f0){logger[_0xee15('0x22')](_0x1812f0[_0xee15('0x23')]);if(_0x1812f0[_0xee15('0x24')]){delete _0x1812f0['name'];}_0x6a7654['status'](_0x2fb1e0)[_0xee15('0x25')](_0x1812f0);};}exports[_0xee15('0x26')]=function(_0x186018,_0x561a59){var _0x1be75a={},_0x1e1757={},_0x14e918={'count':0x0,'rows':[]};var _0x73c0bb=_[_0xee15('0x27')](db[_0xee15('0x28')]['rawAttributes'],function(_0x19a31b){return{'name':_0x19a31b[_0xee15('0x29')],'type':_0x19a31b['type'][_0xee15('0x2a')]};});_0x1e1757[_0xee15('0x2b')]=_['map'](_0x73c0bb,_0xee15('0x24'));_0x1e1757[_0xee15('0x2c')]=_[_0xee15('0x2d')](_0x186018[_0xee15('0x2c')]);_0x1e1757[_0xee15('0x2e')]=_[_0xee15('0x2f')](_0x1e1757[_0xee15('0x2b')],_0x1e1757[_0xee15('0x2c')]);_0x1be75a[_0xee15('0x30')]=_[_0xee15('0x2f')](_0x1e1757[_0xee15('0x2b')],qs[_0xee15('0x31')](_0x186018[_0xee15('0x2c')][_0xee15('0x31')]));_0x1be75a[_0xee15('0x30')]=_0x1be75a[_0xee15('0x30')][_0xee15('0x32')]?_0x1be75a[_0xee15('0x30')]:_0x1e1757[_0xee15('0x2b')];if(!_0x186018[_0xee15('0x2c')][_0xee15('0x33')]('nolimit')){_0x1be75a[_0xee15('0x1a')]=qs[_0xee15('0x1a')](_0x186018[_0xee15('0x2c')]['limit']);_0x1be75a['offset']=qs[_0xee15('0x19')](_0x186018[_0xee15('0x2c')][_0xee15('0x19')]);}_0x1be75a['order']=qs[_0xee15('0x34')](_0x186018[_0xee15('0x2c')]['sort']);_0x1be75a[_0xee15('0x35')]=qs[_0xee15('0x2e')](_[_0xee15('0x36')](_0x186018[_0xee15('0x2c')],_0x1e1757[_0xee15('0x2e')]),_0x73c0bb);if(_0x186018[_0xee15('0x2c')][_0xee15('0x37')]){_0x1be75a[_0xee15('0x35')]=_[_0xee15('0x38')](_0x1be75a['where'],{'$or':_['map'](_0x73c0bb,function(_0x11f8b3){if(_0x11f8b3['type']!==_0xee15('0x39')){var _0x49ff53={};_0x49ff53[_0x11f8b3['name']]={'$like':'%'+_0x186018[_0xee15('0x2c')][_0xee15('0x37')]+'%'};return _0x49ff53;}})});}_0x1be75a=_['merge']({},_0x1be75a,_0x186018[_0xee15('0x3a')]);var _0x40cd28={'where':_0x1be75a[_0xee15('0x35')]};return db[_0xee15('0x28')][_0xee15('0x3b')](_0x40cd28)[_0xee15('0x1e')](function(_0x24d22c){_0x14e918['count']=_0x24d22c;if(_0x186018[_0xee15('0x2c')]['includeAll']){_0x1be75a[_0xee15('0x3c')]=[{'all':!![]}];}return db[_0xee15('0x28')][_0xee15('0x3d')](_0x1be75a);})[_0xee15('0x1e')](function(_0x405a0d){_0x14e918[_0xee15('0x3e')]=_0x405a0d;return _0x14e918;})['then'](respondWithFilteredResult(_0x561a59,_0x1be75a))['catch'](handleError(_0x561a59,null));};exports[_0xee15('0x3f')]=function(_0x1d47b7,_0x136094){var _0x5883fd={'raw':!![],'where':{'id':_0x1d47b7[_0xee15('0x40')]['id']}},_0x4a06dc={};_0x4a06dc[_0xee15('0x2b')]=_[_0xee15('0x2d')](db[_0xee15('0x28')][_0xee15('0x41')]);_0x4a06dc['query']=_[_0xee15('0x2d')](_0x1d47b7[_0xee15('0x2c')]);_0x4a06dc[_0xee15('0x2e')]=_['intersection'](_0x4a06dc[_0xee15('0x2b')],_0x4a06dc['query']);_0x5883fd[_0xee15('0x30')]=_[_0xee15('0x2f')](_0x4a06dc['model'],qs[_0xee15('0x31')](_0x1d47b7['query'][_0xee15('0x31')]));_0x5883fd['attributes']=_0x5883fd[_0xee15('0x30')][_0xee15('0x32')]?_0x5883fd[_0xee15('0x30')]:_0x4a06dc[_0xee15('0x2b')];if(_0x1d47b7[_0xee15('0x2c')][_0xee15('0x42')]){_0x5883fd['include']=[{'all':!![]}];}_0x5883fd=_[_0xee15('0x38')]({},_0x5883fd,_0x1d47b7['options']);return db['AnalyticExtractedReport'][_0xee15('0x43')](_0x5883fd)[_0xee15('0x1e')](handleEntityNotFound(_0x136094,null))[_0xee15('0x1e')](respondWithResult(_0x136094,null))[_0xee15('0x44')](handleError(_0x136094,null));};exports[_0xee15('0x45')]=function(_0x943af4,_0x2d70b9){return db[_0xee15('0x28')][_0xee15('0x45')](_0x943af4['body'],{})[_0xee15('0x1e')](function(_0x29306f){var _0x1a0403=_0x943af4[_0xee15('0x46')][_0xee15('0x1f')]({'plain':!![]});if(!_0x1a0403)throw new Error(_0xee15('0x47'));if(_0x1a0403[_0xee15('0x48')]==='user'){var _0x52ad40=_0x29306f[_0xee15('0x1f')]({'plain':!![]});var _0x2c6815='ExtractedReports';return db['UserProfileSection'][_0xee15('0x43')]({'where':{'name':_0x2c6815,'userProfileId':_0x1a0403['userProfileId']},'raw':!![]})[_0xee15('0x1e')](function(_0x33476c){if(_0x33476c&&_0x33476c[_0xee15('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x52ad40['name'],'resourceId':_0x52ad40['id'],'type':_0x33476c[_0xee15('0x24')],'sectionId':_0x33476c['id']},{})[_0xee15('0x1e')](function(){return _0x29306f;});}else{return _0x29306f;}})['catch'](function(_0x45256a){logger[_0xee15('0x22')](_0xee15('0x4a'),_0x45256a);throw _0x45256a;});}return _0x29306f;})['then'](respondWithResult(_0x2d70b9,0xc9))[_0xee15('0x44')](handleError(_0x2d70b9,null));};exports[_0xee15('0x1d')]=function(_0x11ba5d,_0x304738){if(_0x11ba5d[_0xee15('0x4b')]['id']){delete _0x11ba5d[_0xee15('0x4b')]['id'];}return db[_0xee15('0x28')][_0xee15('0x43')]({'where':{'id':_0x11ba5d[_0xee15('0x40')]['id']}})[_0xee15('0x1e')](handleEntityNotFound(_0x304738,null))['then'](saveUpdates(_0x11ba5d[_0xee15('0x4b')],null))[_0xee15('0x1e')](respondWithResult(_0x304738,null))[_0xee15('0x44')](handleError(_0x304738,null));};exports[_0xee15('0x21')]=function(_0x5aa3f2,_0x1bbeea){return db[_0xee15('0x28')]['find']({'where':{'id':_0x5aa3f2[_0xee15('0x40')]['id']}})[_0xee15('0x1e')](handleEntityNotFound(_0x1bbeea,null))[_0xee15('0x1e')](removeEntity(_0x1bbeea,null))[_0xee15('0x44')](handleError(_0x1bbeea,null));};exports[_0xee15('0x4c')]=function(_0x295361,_0x317a2a,_0x3f3e28){return db['AnalyticExtractedReport'][_0xee15('0x43')]({'where':{'id':_0x295361[_0xee15('0x40')]['id']},'attributes':[_0xee15('0x24'),_0xee15('0x4d'),_0xee15('0x4e'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x317a2a,null))[_0xee15('0x1e')](function(_0x1351a9){if(_0x1351a9){if(!fs['existsSync'](path[_0xee15('0x4f')](config['root'],_0xee15('0x50'),_0x1351a9[_0xee15('0x4e')]))){throw new db['Sequelize'][(_0xee15('0x51'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x295361[_0xee15('0x2c')][_0xee15('0x52')]){return _0x317a2a[_0xee15('0x15')](0xc8);}return _0x317a2a[_0xee15('0x4c')](path[_0xee15('0x4f')](config['root'],_0xee15('0x50'),_0x1351a9[_0xee15('0x4e')]),util['format'](_0xee15('0x53'),_0x1351a9[_0xee15('0x4d')]||_0x1351a9[_0xee15('0x24')],_0x1351a9[_0xee15('0x54')][_0xee15('0x55')]()));}})[_0xee15('0x44')](handleError(_0x317a2a,null));}; \ No newline at end of file +var _0xd4fe=['join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','show','params','attributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','existsSync'];(function(_0x57db55,_0xfb85a2){var _0x40d063=function(_0x2078ed){while(--_0x2078ed){_0x57db55['push'](_0x57db55['shift']());}};_0x40d063(++_0xfb85a2);}(_0xd4fe,0x12d));var _0xed4f=function(_0x4a1468,_0x3a2edf){_0x4a1468=_0x4a1468-0x0;var _0x298f98=_0xd4fe[_0x4a1468];return _0x298f98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed4f('0x0'));var rimraf=require(_0xed4f('0x1'));var zipdir=require(_0xed4f('0x2'));var jsonpatch=require(_0xed4f('0x3'));var rp=require('request-promise');var moment=require(_0xed4f('0x4'));var BPromise=require(_0xed4f('0x5'));var Mustache=require(_0xed4f('0x6'));var util=require('util');var path=require(_0xed4f('0x7'));var sox=require(_0xed4f('0x8'));var csv=require(_0xed4f('0x9'));var ejs=require(_0xed4f('0xa'));var fs=require('fs');var _=require(_0xed4f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed4f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xed4f('0x9'));var querystring=require(_0xed4f('0xd'));var Papa=require(_0xed4f('0xe'));var Redis=require(_0xed4f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xed4f('0x10'));var as=require(_0xed4f('0x11'));var hardwareService=require(_0xed4f('0x12'));var logger=require(_0xed4f('0x13'))(_0xed4f('0x14'));var utils=require(_0xed4f('0x15'));var config=require('../../config/environment');var db=require(_0xed4f('0x16'))['db'];function respondWithStatusCode(_0x219380,_0x2b9939){_0x2b9939=_0x2b9939||0xcc;return function(_0x11ec2c){if(_0x11ec2c){return _0x219380['sendStatus'](_0x2b9939);}return _0x219380[_0xed4f('0x17')](_0x2b9939)[_0xed4f('0x18')]();};}function respondWithResult(_0x51d98d,_0x59a0d3){_0x59a0d3=_0x59a0d3||0xc8;return function(_0x104c26){if(_0x104c26){return _0x51d98d[_0xed4f('0x17')](_0x59a0d3)[_0xed4f('0x19')](_0x104c26);}};}function respondWithFilteredResult(_0x11f480,_0x5cafe3){return function(_0x6d5f51){if(_0x6d5f51){var _0x11de05=_0x6d5f51[_0xed4f('0x1a')],_0x3864c7=_0x5cafe3[_0xed4f('0x1b')],_0x4b1bed=_0x5cafe3['offset']+_0x5cafe3[_0xed4f('0x1c')],_0x2b6dc6;if(_0x4b1bed>=_0x11de05){_0x4b1bed=_0x11de05;_0x2b6dc6=0xc8;}else{_0x2b6dc6=0xce;}_0x11f480[_0xed4f('0x17')](_0x2b6dc6);return _0x11f480[_0xed4f('0x1d')](_0xed4f('0x1e'),_0x3864c7+'-'+_0x4b1bed+'/'+_0x11de05)['json'](_0x6d5f51);}return null;};}function patchUpdates(_0x23ddf7){return function(_0x998232){try{jsonpatch[_0xed4f('0x1f')](_0x998232,_0x23ddf7,!![]);}catch(_0x4c62b0){return BPromise[_0xed4f('0x20')](_0x4c62b0);}return _0x998232[_0xed4f('0x21')]();};}function saveUpdates(_0x3c0a47,_0x21b986){return function(_0x528fbf){if(_0x528fbf){return _0x528fbf[_0xed4f('0x22')](_0x3c0a47)['then'](function(_0x1dcf6f){return _0x1dcf6f;});}return null;};}function removeEntity(_0x102edd,_0x10ebc8){return function(_0x6e5b35){if(_0x6e5b35){return _0x6e5b35['destroy']()[_0xed4f('0x23')](function(){var _0x13287e=_0x6e5b35[_0xed4f('0x24')]({'plain':!![]});var _0xb2fd19='ExtractedReports';return db[_0xed4f('0x25')][_0xed4f('0x26')]({'where':{'type':_0xb2fd19,'resourceId':_0x13287e['id']}})['then'](function(){return _0x6e5b35;});})['then'](function(){_0x102edd[_0xed4f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250193,_0x16e225){return function(_0x4d3032){if(!_0x4d3032){_0x250193[_0xed4f('0x27')](0x194);}return _0x4d3032;};}function handleError(_0x57105f,_0x38d9aa){_0x38d9aa=_0x38d9aa||0x1f4;return function(_0x42ee52){logger[_0xed4f('0x28')](_0x42ee52[_0xed4f('0x29')]);if(_0x42ee52[_0xed4f('0x2a')]){delete _0x42ee52['name'];}_0x57105f[_0xed4f('0x17')](_0x38d9aa)[_0xed4f('0x2b')](_0x42ee52);};}exports[_0xed4f('0x2c')]=function(_0x437ea9,_0x2593ba){var _0x3d494d={},_0x53ea63={},_0xdc950c={'count':0x0,'rows':[]};var _0x10fcff=_[_0xed4f('0x2d')](db['AnalyticExtractedReport'][_0xed4f('0x2e')],function(_0x59fbc2){return{'name':_0x59fbc2[_0xed4f('0x2f')],'type':_0x59fbc2['type'][_0xed4f('0x30')]};});_0x53ea63[_0xed4f('0x31')]=_[_0xed4f('0x2d')](_0x10fcff,'name');_0x53ea63[_0xed4f('0x32')]=_[_0xed4f('0x33')](_0x437ea9[_0xed4f('0x32')]);_0x53ea63[_0xed4f('0x34')]=_[_0xed4f('0x35')](_0x53ea63[_0xed4f('0x31')],_0x53ea63[_0xed4f('0x32')]);_0x3d494d['attributes']=_[_0xed4f('0x35')](_0x53ea63['model'],qs[_0xed4f('0x36')](_0x437ea9[_0xed4f('0x32')][_0xed4f('0x36')]));_0x3d494d['attributes']=_0x3d494d['attributes'][_0xed4f('0x37')]?_0x3d494d['attributes']:_0x53ea63['model'];if(!_0x437ea9['query'][_0xed4f('0x38')]('nolimit')){_0x3d494d[_0xed4f('0x1c')]=qs['limit'](_0x437ea9[_0xed4f('0x32')]['limit']);_0x3d494d[_0xed4f('0x1b')]=qs[_0xed4f('0x1b')](_0x437ea9[_0xed4f('0x32')][_0xed4f('0x1b')]);}_0x3d494d[_0xed4f('0x39')]=qs[_0xed4f('0x3a')](_0x437ea9[_0xed4f('0x32')]['sort']);_0x3d494d['where']=qs['filters'](_[_0xed4f('0x3b')](_0x437ea9[_0xed4f('0x32')],_0x53ea63[_0xed4f('0x34')]),_0x10fcff);if(_0x437ea9[_0xed4f('0x32')][_0xed4f('0x3c')]){_0x3d494d[_0xed4f('0x3d')]=_[_0xed4f('0x3e')](_0x3d494d[_0xed4f('0x3d')],{'$or':_[_0xed4f('0x2d')](_0x10fcff,function(_0x4ce90d){if(_0x4ce90d[_0xed4f('0x3f')]!==_0xed4f('0x40')){var _0x3ba6ba={};_0x3ba6ba[_0x4ce90d['name']]={'$like':'%'+_0x437ea9[_0xed4f('0x32')][_0xed4f('0x3c')]+'%'};return _0x3ba6ba;}})});}_0x3d494d=_[_0xed4f('0x3e')]({},_0x3d494d,_0x437ea9['options']);var _0x459acf={'where':_0x3d494d[_0xed4f('0x3d')]};return db['AnalyticExtractedReport'][_0xed4f('0x1a')](_0x459acf)['then'](function(_0x5ee63e){_0xdc950c['count']=_0x5ee63e;if(_0x437ea9['query'][_0xed4f('0x41')]){_0x3d494d[_0xed4f('0x42')]=[{'all':!![]}];}return db[_0xed4f('0x43')][_0xed4f('0x44')](_0x3d494d);})[_0xed4f('0x23')](function(_0x267d91){_0xdc950c[_0xed4f('0x45')]=_0x267d91;return _0xdc950c;})[_0xed4f('0x23')](respondWithFilteredResult(_0x2593ba,_0x3d494d))[_0xed4f('0x46')](handleError(_0x2593ba,null));};exports[_0xed4f('0x47')]=function(_0xa08f19,_0x52062d){var _0x52bca5={'raw':!![],'where':{'id':_0xa08f19[_0xed4f('0x48')]['id']}},_0x3444fc={};_0x3444fc[_0xed4f('0x31')]=_[_0xed4f('0x33')](db[_0xed4f('0x43')]['rawAttributes']);_0x3444fc['query']=_[_0xed4f('0x33')](_0xa08f19[_0xed4f('0x32')]);_0x3444fc['filters']=_[_0xed4f('0x35')](_0x3444fc[_0xed4f('0x31')],_0x3444fc[_0xed4f('0x32')]);_0x52bca5[_0xed4f('0x49')]=_[_0xed4f('0x35')](_0x3444fc[_0xed4f('0x31')],qs[_0xed4f('0x36')](_0xa08f19[_0xed4f('0x32')]['fields']));_0x52bca5[_0xed4f('0x49')]=_0x52bca5['attributes'][_0xed4f('0x37')]?_0x52bca5[_0xed4f('0x49')]:_0x3444fc['model'];if(_0xa08f19['query']['includeAll']){_0x52bca5['include']=[{'all':!![]}];}_0x52bca5=_[_0xed4f('0x3e')]({},_0x52bca5,_0xa08f19['options']);return db[_0xed4f('0x43')][_0xed4f('0x4a')](_0x52bca5)[_0xed4f('0x23')](handleEntityNotFound(_0x52062d,null))[_0xed4f('0x23')](respondWithResult(_0x52062d,null))[_0xed4f('0x46')](handleError(_0x52062d,null));};exports['create']=function(_0x207c02,_0x47abdd){return db[_0xed4f('0x43')][_0xed4f('0x4b')](_0x207c02['body'],{})[_0xed4f('0x23')](function(_0x5f2ee2){var _0x25b1da=_0x207c02[_0xed4f('0x4c')]['get']({'plain':!![]});if(!_0x25b1da)throw new Error(_0xed4f('0x4d'));if(_0x25b1da[_0xed4f('0x4e')]===_0xed4f('0x4c')){var _0x1604f8=_0x5f2ee2[_0xed4f('0x24')]({'plain':!![]});var _0x1de381='ExtractedReports';return db[_0xed4f('0x4f')][_0xed4f('0x4a')]({'where':{'name':_0x1de381,'userProfileId':_0x25b1da[_0xed4f('0x50')]},'raw':!![]})[_0xed4f('0x23')](function(_0x53aad4){if(_0x53aad4&&_0x53aad4[_0xed4f('0x51')]===0x0){return db[_0xed4f('0x25')][_0xed4f('0x4b')]({'name':_0x1604f8[_0xed4f('0x2a')],'resourceId':_0x1604f8['id'],'type':_0x53aad4['name'],'sectionId':_0x53aad4['id']},{})[_0xed4f('0x23')](function(){return _0x5f2ee2;});}else{return _0x5f2ee2;}})['catch'](function(_0x23ea26){logger[_0xed4f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ea26);throw _0x23ea26;});}return _0x5f2ee2;})[_0xed4f('0x23')](respondWithResult(_0x47abdd,0xc9))[_0xed4f('0x46')](handleError(_0x47abdd,null));};exports[_0xed4f('0x22')]=function(_0x55287a,_0x3ae1bf){if(_0x55287a['body']['id']){delete _0x55287a['body']['id'];}return db[_0xed4f('0x43')][_0xed4f('0x4a')]({'where':{'id':_0x55287a[_0xed4f('0x48')]['id']}})[_0xed4f('0x23')](handleEntityNotFound(_0x3ae1bf,null))[_0xed4f('0x23')](saveUpdates(_0x55287a['body'],null))[_0xed4f('0x23')](respondWithResult(_0x3ae1bf,null))[_0xed4f('0x46')](handleError(_0x3ae1bf,null));};exports[_0xed4f('0x26')]=function(_0x58d97e,_0x20a396){return db['AnalyticExtractedReport'][_0xed4f('0x4a')]({'where':{'id':_0x58d97e['params']['id']}})[_0xed4f('0x23')](handleEntityNotFound(_0x20a396,null))['then'](removeEntity(_0x20a396,null))[_0xed4f('0x46')](handleError(_0x20a396,null));};exports[_0xed4f('0x52')]=function(_0x33245b,_0x3b85a5,_0x416faf){return db[_0xed4f('0x43')][_0xed4f('0x4a')]({'where':{'id':_0x33245b['params']['id']},'attributes':['name',_0xed4f('0x53'),_0xed4f('0x54'),_0xed4f('0x55')],'raw':!![]})[_0xed4f('0x23')](handleEntityNotFound(_0x3b85a5,null))['then'](function(_0x18872b){if(_0x18872b){if(!fs[_0xed4f('0x56')](path[_0xed4f('0x57')](config[_0xed4f('0x58')],_0xed4f('0x59'),_0x18872b['savename']))){throw new db[(_0xed4f('0x5a'))][(_0xed4f('0x5b'))](_0xed4f('0x5c'));}if(_0x33245b[_0xed4f('0x32')][_0xed4f('0x5d')]){return _0x3b85a5[_0xed4f('0x27')](0xc8);}return _0x3b85a5[_0xed4f('0x52')](path[_0xed4f('0x57')](config['root'],_0xed4f('0x59'),_0x18872b[_0xed4f('0x54')]),util[_0xed4f('0x5e')](_0xed4f('0x5f'),_0x18872b[_0xed4f('0x53')]||_0x18872b[_0xed4f('0x2a')],_0x18872b[_0xed4f('0x55')][_0xed4f('0x60')]()));}})[_0xed4f('0x46')](handleError(_0x3b85a5,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c4f90e1..0140d95 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 _0x6acc=['request-promise','path','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird'];(function(_0x404ab9,_0x29ab1d){var _0x53b3b6=function(_0x7b3642){while(--_0x7b3642){_0x404ab9['push'](_0x404ab9['shift']());}};_0x53b3b6(++_0x29ab1d);}(_0x6acc,0xc2));var _0xc6ac=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x6acc[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc6ac('0x0'))(_0xc6ac('0x1'));var moment=require(_0xc6ac('0x2'));var BPromise=require(_0xc6ac('0x3'));var rp=require(_0xc6ac('0x4'));var fs=require('fs');var path=require(_0xc6ac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc6ac('0x6'));module[_0xc6ac('0x7')]=function(_0x538fef,_0x388737){return _0x538fef[_0xc6ac('0x8')](_0xc6ac('0x9'),attributes,{'tableName':_0xc6ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x033b=['../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x033b,0x74));var _0xb033=function(_0x373338,_0x55150a){_0x373338=_0x373338-0x0;var _0x18822f=_0x033b[_0x373338];return _0x18822f;};'use strict';var _=require('lodash');var util=require(_0xb033('0x0'));var logger=require(_0xb033('0x1'))(_0xb033('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb033('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb033('0x4'));var config=require(_0xb033('0x5'));var attributes=require(_0xb033('0x6'));module['exports']=function(_0x5cbd30,_0x380f9e){return _0x5cbd30['define'](_0xb033('0x7'),attributes,{'tableName':_0xb033('0x8'),'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 0595d1f..bdf95bf 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 _0x9df8=['AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x231c2a,_0x1b5364){var _0x3d68ee=function(_0x16e9c4){while(--_0x16e9c4){_0x231c2a['push'](_0x231c2a['shift']());}};_0x3d68ee(++_0x1b5364);}(_0x9df8,0x12f));var _0x89df=function(_0x3aac51,_0x59d0be){_0x3aac51=_0x3aac51-0x0;var _0x568f21=_0x9df8[_0x3aac51];return _0x568f21;};'use strict';var _=require(_0x89df('0x0'));var util=require(_0x89df('0x1'));var moment=require(_0x89df('0x2'));var BPromise=require(_0x89df('0x3'));var rs=require(_0x89df('0x4'));var fs=require('fs');var Redis=require(_0x89df('0x5'));var db=require(_0x89df('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x89df('0x7'))(_0x89df('0x8'));var config=require(_0x89df('0x9'));var jayson=require(_0x89df('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b91a6,_0x19bbab,_0x2d675b){return new BPromise(function(_0x1a1b8c,_0xd2d8c0){return client[_0x89df('0xb')](_0x1b91a6,_0x2d675b)[_0x89df('0xc')](function(_0x3e9a09){logger[_0x89df('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x19bbab,_0x89df('0xe'));logger[_0x89df('0xf')](_0x89df('0x10'),_0x19bbab,_0x89df('0xe'),JSON['stringify'](_0x3e9a09));if(_0x3e9a09[_0x89df('0x11')]){if(_0x3e9a09['error'][_0x89df('0x12')]===0x1f4){logger[_0x89df('0x11')](_0x89df('0x13'),_0x19bbab,_0x3e9a09[_0x89df('0x11')][_0x89df('0x14')]);return _0xd2d8c0(_0x3e9a09[_0x89df('0x11')][_0x89df('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x19bbab,_0x3e9a09[_0x89df('0x11')][_0x89df('0x14')]);return _0x1a1b8c(_0x3e9a09[_0x89df('0x11')]['message']);}else{logger[_0x89df('0xd')](_0x89df('0x13'),_0x19bbab,'request\x20sent');_0x1a1b8c(_0x3e9a09[_0x89df('0x15')][_0x89df('0x14')]);}})[_0x89df('0x16')](function(_0xb40286){logger['error'](_0x89df('0x13'),_0x19bbab,_0xb40286);_0xd2d8c0(_0xb40286);});});} \ No newline at end of file +var _0x8317=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0x3d8b36,_0x43a4c7){var _0x340486=function(_0x338971){while(--_0x338971){_0x3d8b36['push'](_0x3d8b36['shift']());}};_0x340486(++_0x43a4c7);}(_0x8317,0xd9));var _0x7831=function(_0x4a9a99,_0x2ef8a6){_0x4a9a99=_0x4a9a99-0x0;var _0x21415f=_0x8317[_0x4a9a99];return _0x21415f;};'use strict';var _=require('lodash');var util=require(_0x7831('0x0'));var moment=require(_0x7831('0x1'));var BPromise=require(_0x7831('0x2'));var rs=require(_0x7831('0x3'));var fs=require('fs');var Redis=require(_0x7831('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7831('0x5'))(_0x7831('0x6'));var config=require(_0x7831('0x7'));var jayson=require(_0x7831('0x8'));var client=jayson[_0x7831('0x9')][_0x7831('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x388a3b,_0x2071d8,_0x313839){return new BPromise(function(_0x1c2a89,_0x19a633){return client['request'](_0x388a3b,_0x313839)[_0x7831('0xb')](function(_0x36d909){logger[_0x7831('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2071d8,_0x7831('0xd'));logger[_0x7831('0xe')](_0x7831('0xf'),_0x2071d8,_0x7831('0xd'),JSON[_0x7831('0x10')](_0x36d909));if(_0x36d909[_0x7831('0x11')]){if(_0x36d909[_0x7831('0x11')]['code']===0x1f4){logger[_0x7831('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2071d8,_0x36d909[_0x7831('0x11')][_0x7831('0x12')]);return _0x19a633(_0x36d909[_0x7831('0x11')][_0x7831('0x12')]);}logger[_0x7831('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2071d8,_0x36d909[_0x7831('0x11')][_0x7831('0x12')]);return _0x1c2a89(_0x36d909[_0x7831('0x11')][_0x7831('0x12')]);}else{logger[_0x7831('0xc')](_0x7831('0x13'),_0x2071d8,_0x7831('0xd'));_0x1c2a89(_0x36d909[_0x7831('0x14')][_0x7831('0x12')]);}})[_0x7831('0x15')](function(_0x2469f7){logger[_0x7831('0x11')](_0x7831('0x13'),_0x2071d8,_0x2469f7);_0x19a633(_0x2469f7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7f683ae..36a5e04 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 _0x7ad8=['connect-timeout','express','Router','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','put','update','delete','exports','util','path'];(function(_0x79b272,_0x49532c){var _0xe3238d=function(_0x3d092c){while(--_0x3d092c){_0x79b272['push'](_0x79b272['shift']());}};_0xe3238d(++_0x49532c);}(_0x7ad8,0xb9));var _0x87ad=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x7ad8[_0x461886];return _0x295e0a;};'use strict';var multer=require('multer');var util=require(_0x87ad('0x0'));var path=require(_0x87ad('0x1'));var timeout=require(_0x87ad('0x2'));var express=require(_0x87ad('0x3'));var router=express[_0x87ad('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x87ad('0x5'));router[_0x87ad('0x6')]('/',auth[_0x87ad('0x7')](),controller[_0x87ad('0x8')]);router[_0x87ad('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x87ad('0x9')]);router[_0x87ad('0x6')](_0x87ad('0xa'),auth[_0x87ad('0x7')](),controller[_0x87ad('0xb')]);router[_0x87ad('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x87ad('0xd')]('/:id',auth[_0x87ad('0x7')](),controller[_0x87ad('0xe')]);router[_0x87ad('0xf')]('/:id',auth[_0x87ad('0x7')](),controller['destroy']);module[_0x87ad('0x10')]=router; \ No newline at end of file +var _0x04cc=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x2c29e0,_0x4debb1){var _0x53336d=function(_0x41878d){while(--_0x41878d){_0x2c29e0['push'](_0x2c29e0['shift']());}};_0x53336d(++_0x4debb1);}(_0x04cc,0x1bf));var _0xc04c=function(_0x3242f8,_0x452998){_0x3242f8=_0x3242f8-0x0;var _0x47e17f=_0x04cc[_0x3242f8];return _0x47e17f;};'use strict';var multer=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var path=require(_0xc04c('0x2'));var timeout=require(_0xc04c('0x3'));var express=require(_0xc04c('0x4'));var router=express['Router']();var auth=require(_0xc04c('0x5'));var interaction=require(_0xc04c('0x6'));var config=require(_0xc04c('0x7'));var controller=require(_0xc04c('0x8'));router[_0xc04c('0x9')]('/',auth[_0xc04c('0xa')](),controller[_0xc04c('0xb')]);router[_0xc04c('0x9')](_0xc04c('0xc'),auth[_0xc04c('0xa')](),controller[_0xc04c('0xd')]);router['get'](_0xc04c('0xe'),auth[_0xc04c('0xa')](),controller[_0xc04c('0xf')]);router[_0xc04c('0x10')]('/',auth[_0xc04c('0xa')](),controller['create']);router[_0xc04c('0x11')](_0xc04c('0xc'),auth[_0xc04c('0xa')](),controller['update']);router['delete'](_0xc04c('0xc'),auth[_0xc04c('0xa')](),controller['destroy']);module[_0xc04c('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 5349ced..a0370fa 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x4c0708,_0x58cdbd){var _0x4e2ddd=function(_0x242f47){while(--_0x242f47){_0x4c0708['push'](_0x4c0708['shift']());}};_0x4e2ddd(++_0x58cdbd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x22aefb,_0x21d6dc){var _0x31e52c=function(_0x186b55){while(--_0x186b55){_0x22aefb['push'](_0x22aefb['shift']());}};_0x31e52c(++_0x21d6dc);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index dfa21bf..bbdb424 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 _0xd8ca=['save','update','then','destroy','sendStatus','error','name','send','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4fa669,_0x254b42){var _0x5e2aad=function(_0x18379e){while(--_0x18379e){_0x4fa669['push'](_0x4fa669['shift']());}};_0x5e2aad(++_0x254b42);}(_0xd8ca,0x178));var _0xad8c=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xd8ca[_0x191154];return _0x3dcd73;};'use strict';var pdf=require(_0xad8c('0x0'));var emlformat=require(_0xad8c('0x1'));var rimraf=require(_0xad8c('0x2'));var zipdir=require(_0xad8c('0x3'));var jsonpatch=require(_0xad8c('0x4'));var rp=require('request-promise');var moment=require(_0xad8c('0x5'));var BPromise=require(_0xad8c('0x6'));var Mustache=require(_0xad8c('0x7'));var util=require('util');var path=require(_0xad8c('0x8'));var sox=require(_0xad8c('0x9'));var csv=require(_0xad8c('0xa'));var ejs=require(_0xad8c('0xb'));var fs=require('fs');var _=require(_0xad8c('0xc'));var squel=require('squel');var crypto=require(_0xad8c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xad8c('0xe'));var toCsv=require(_0xad8c('0xa'));var querystring=require(_0xad8c('0xf'));var Papa=require('papaparse');var Redis=require(_0xad8c('0x10'));var authService=require(_0xad8c('0x11'));var qs=require(_0xad8c('0x12'));var as=require(_0xad8c('0x13'));var hardwareService=require(_0xad8c('0x14'));var logger=require(_0xad8c('0x15'))(_0xad8c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xad8c('0x17'))['db'];function respondWithStatusCode(_0x1dddef,_0x8e5f82){_0x8e5f82=_0x8e5f82||0xcc;return function(_0x11da1b){if(_0x11da1b){return _0x1dddef['sendStatus'](_0x8e5f82);}return _0x1dddef[_0xad8c('0x18')](_0x8e5f82)[_0xad8c('0x19')]();};}function respondWithResult(_0x155e09,_0x1749cd){_0x1749cd=_0x1749cd||0xc8;return function(_0x206932){if(_0x206932){return _0x155e09[_0xad8c('0x18')](_0x1749cd)[_0xad8c('0x1a')](_0x206932);}};}function respondWithFilteredResult(_0x77ff85,_0x1e8803){return function(_0xb889fb){if(_0xb889fb){var _0xceffc=_0xb889fb[_0xad8c('0x1b')],_0x5c3385=_0x1e8803['offset'],_0x35d41e=_0x1e8803[_0xad8c('0x1c')]+_0x1e8803[_0xad8c('0x1d')],_0x252567;if(_0x35d41e>=_0xceffc){_0x35d41e=_0xceffc;_0x252567=0xc8;}else{_0x252567=0xce;}_0x77ff85['status'](_0x252567);return _0x77ff85[_0xad8c('0x1e')](_0xad8c('0x1f'),_0x5c3385+'-'+_0x35d41e+'/'+_0xceffc)[_0xad8c('0x1a')](_0xb889fb);}return null;};}function patchUpdates(_0x402a07){return function(_0xdc0a3b){try{jsonpatch[_0xad8c('0x20')](_0xdc0a3b,_0x402a07,!![]);}catch(_0x135046){return BPromise[_0xad8c('0x21')](_0x135046);}return _0xdc0a3b[_0xad8c('0x22')]();};}function saveUpdates(_0x1de468,_0x4b1ee4){return function(_0x566d78){if(_0x566d78){return _0x566d78[_0xad8c('0x23')](_0x1de468)[_0xad8c('0x24')](function(_0x4e6f7d){return _0x4e6f7d;});}return null;};}function removeEntity(_0x29e42c,_0x499f82){return function(_0x59a77c){if(_0x59a77c){return _0x59a77c[_0xad8c('0x25')]()['then'](function(){_0x29e42c[_0xad8c('0x18')](0xcc)[_0xad8c('0x19')]();});}};}function handleEntityNotFound(_0x3b02c2,_0x7b5dd9){return function(_0x77a5b){if(!_0x77a5b){_0x3b02c2[_0xad8c('0x26')](0x194);}return _0x77a5b;};}function handleError(_0x2a9525,_0x541dcf){_0x541dcf=_0x541dcf||0x1f4;return function(_0xd96d6f){logger[_0xad8c('0x27')](_0xd96d6f['stack']);if(_0xd96d6f[_0xad8c('0x28')]){delete _0xd96d6f[_0xad8c('0x28')];}_0x2a9525[_0xad8c('0x18')](_0x541dcf)[_0xad8c('0x29')](_0xd96d6f);};}exports['index']=function(_0x5790e0,_0x22fdfc){var _0x437d0e={},_0xf1bcab={},_0x4a69ef={'count':0x0,'rows':[]};var _0x587aeb=_[_0xad8c('0x2a')](db[_0xad8c('0x2b')]['rawAttributes'],function(_0x5657d8){return{'name':_0x5657d8[_0xad8c('0x2c')],'type':_0x5657d8['type'][_0xad8c('0x2d')]};});_0xf1bcab[_0xad8c('0x2e')]=_[_0xad8c('0x2a')](_0x587aeb,_0xad8c('0x28'));_0xf1bcab[_0xad8c('0x2f')]=_[_0xad8c('0x30')](_0x5790e0['query']);_0xf1bcab[_0xad8c('0x31')]=_[_0xad8c('0x32')](_0xf1bcab[_0xad8c('0x2e')],_0xf1bcab['query']);_0x437d0e[_0xad8c('0x33')]=_[_0xad8c('0x32')](_0xf1bcab[_0xad8c('0x2e')],qs[_0xad8c('0x34')](_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x34')]));_0x437d0e['attributes']=_0x437d0e[_0xad8c('0x33')][_0xad8c('0x35')]?_0x437d0e[_0xad8c('0x33')]:_0xf1bcab['model'];if(!_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x36')](_0xad8c('0x37'))){_0x437d0e[_0xad8c('0x1d')]=qs[_0xad8c('0x1d')](_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x1d')]);_0x437d0e[_0xad8c('0x1c')]=qs[_0xad8c('0x1c')](_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x1c')]);}_0x437d0e['order']=qs[_0xad8c('0x38')](_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x38')]);_0x437d0e[_0xad8c('0x39')]=qs[_0xad8c('0x31')](_[_0xad8c('0x3a')](_0x5790e0[_0xad8c('0x2f')],_0xf1bcab['filters']),_0x587aeb);if(_0x5790e0['query']['filter']){_0x437d0e['where']=_[_0xad8c('0x3b')](_0x437d0e['where'],{'$or':_[_0xad8c('0x2a')](_0x587aeb,function(_0x13d18){if(_0x13d18[_0xad8c('0x3c')]!==_0xad8c('0x3d')){var _0xc0a9e8={};_0xc0a9e8[_0x13d18[_0xad8c('0x28')]]={'$like':'%'+_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x3e')]+'%'};return _0xc0a9e8;}})});}_0x437d0e=_['merge']({},_0x437d0e,_0x5790e0[_0xad8c('0x3f')]);var _0x1c8bc={'where':_0x437d0e[_0xad8c('0x39')]};return db[_0xad8c('0x2b')]['count'](_0x1c8bc)[_0xad8c('0x24')](function(_0x321ad5){_0x4a69ef[_0xad8c('0x1b')]=_0x321ad5;if(_0x5790e0[_0xad8c('0x2f')][_0xad8c('0x40')]){_0x437d0e[_0xad8c('0x41')]=[{'all':!![]}];}return db[_0xad8c('0x2b')][_0xad8c('0x42')](_0x437d0e);})['then'](function(_0x1b7cde){_0x4a69ef['rows']=_0x1b7cde;return _0x4a69ef;})[_0xad8c('0x24')](respondWithFilteredResult(_0x22fdfc,_0x437d0e))[_0xad8c('0x43')](handleError(_0x22fdfc,null));};exports[_0xad8c('0x44')]=function(_0x39d74c,_0x296cba){var _0x4b822e={'raw':![],'where':{'id':_0x39d74c[_0xad8c('0x45')]['id']}},_0x431c5b={};_0x431c5b[_0xad8c('0x2e')]=_[_0xad8c('0x30')](db[_0xad8c('0x2b')][_0xad8c('0x46')]);_0x431c5b[_0xad8c('0x2f')]=_[_0xad8c('0x30')](_0x39d74c[_0xad8c('0x2f')]);_0x431c5b[_0xad8c('0x31')]=_[_0xad8c('0x32')](_0x431c5b[_0xad8c('0x2e')],_0x431c5b[_0xad8c('0x2f')]);_0x4b822e[_0xad8c('0x33')]=_['intersection'](_0x431c5b[_0xad8c('0x2e')],qs[_0xad8c('0x34')](_0x39d74c['query']['fields']));_0x4b822e[_0xad8c('0x33')]=_0x4b822e[_0xad8c('0x33')]['length']?_0x4b822e[_0xad8c('0x33')]:_0x431c5b['model'];if(_0x39d74c['query'][_0xad8c('0x40')]){_0x4b822e[_0xad8c('0x41')]=[{'all':!![]}];}_0x4b822e=_[_0xad8c('0x3b')]({},_0x4b822e,_0x39d74c[_0xad8c('0x3f')]);return db[_0xad8c('0x2b')][_0xad8c('0x47')](_0x4b822e)[_0xad8c('0x24')](handleEntityNotFound(_0x296cba,null))[_0xad8c('0x24')](respondWithResult(_0x296cba,null))[_0xad8c('0x43')](handleError(_0x296cba,null));};exports[_0xad8c('0x48')]=function(_0x573a32,_0x415206){return db[_0xad8c('0x2b')][_0xad8c('0x48')](_0x573a32[_0xad8c('0x49')],{})[_0xad8c('0x24')](respondWithResult(_0x415206,0xc9))[_0xad8c('0x43')](handleError(_0x415206,null));};exports[_0xad8c('0x4a')]=function(_0x210fec,_0xb0d64){return db[_0xad8c('0x2b')][_0xad8c('0x4a')](_0x210fec[_0xad8c('0x49')],{'raw':![],'individualHooks':!![]})[_0xad8c('0x24')](respondWithResult(_0xb0d64,0xc9))[_0xad8c('0x43')](handleError(_0xb0d64,null));};exports['update']=function(_0x388d55,_0x17dc45){if(_0x388d55[_0xad8c('0x49')]['id']){delete _0x388d55[_0xad8c('0x49')]['id'];}return db[_0xad8c('0x2b')][_0xad8c('0x47')]({'where':{'id':_0x388d55[_0xad8c('0x45')]['id']}})[_0xad8c('0x24')](handleEntityNotFound(_0x17dc45,null))[_0xad8c('0x24')](saveUpdates(_0x388d55['body'],null))['then'](respondWithResult(_0x17dc45,null))[_0xad8c('0x43')](handleError(_0x17dc45,null));};exports['destroy']=function(_0x5dd268,_0x54f39f){return db[_0xad8c('0x2b')][_0xad8c('0x47')]({'where':{'id':_0x5dd268[_0xad8c('0x45')]['id']}})[_0xad8c('0x24')](handleEntityNotFound(_0x54f39f,null))[_0xad8c('0x24')](removeEntity(_0x54f39f,null))[_0xad8c('0x43')](handleError(_0x54f39f,null));};exports[_0xad8c('0x4b')]=function(_0xbd535b,_0x4528e2){return db[_0xad8c('0x2b')]['destroy']({'where':{'id':_0xbd535b[_0xad8c('0x2f')][_0xad8c('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xad8c('0x24')](respondWithResult(_0x4528e2,0xcc))['catch'](handleError(_0x4528e2,null));};exports[_0xad8c('0x4d')]=function(_0x81f470,_0xb25583,_0x384ddc){return db[_0xad8c('0x4e')][_0xad8c('0x4f')]({'where':{'id':_0x81f470[_0xad8c('0x45')]['id']}})[_0xad8c('0x24')](handleEntityNotFound(_0xb25583,null))[_0xad8c('0x24')](function(_0x5005dc){if(_0x5005dc){return db['sequelize'][_0xad8c('0x50')](function(_0x56a664){return db[_0xad8c('0x2b')][_0xad8c('0x25')]({'where':{'CustomReportId':_0x81f470[_0xad8c('0x45')]['id']},'transaction':_0x56a664})[_0xad8c('0x24')](function(_0x1b1de5){var _0x126dd2=_[_0xad8c('0x2a')](_0x81f470['body'],function(_0x3983bb){delete _0x3983bb['id'];_0x3983bb[_0xad8c('0x51')]=_0x81f470['params']['id'];return _0x3983bb;});return db[_0xad8c('0x2b')][_0xad8c('0x4a')](_0x126dd2,{'transaction':_0x56a664});});})[_0xad8c('0x24')](function(){return db['AnalyticFieldReport'][_0xad8c('0x42')]({'where':{'CustomReportId':_0x81f470[_0xad8c('0x45')]['id']}});});}})[_0xad8c('0x24')](respondWithResult(_0xb25583,null))[_0xad8c('0x43')](handleError(_0xb25583,null));}; \ No newline at end of file +var _0x9f8b=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','bulkCreate','body','params','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f8b,0x9a));var _0xb9f8=function(_0x59f7e4,_0x2bf748){_0x59f7e4=_0x59f7e4-0x0;var _0x16af8d=_0x9f8b[_0x59f7e4];return _0x16af8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9f8('0x0'));var rimraf=require(_0xb9f8('0x1'));var zipdir=require(_0xb9f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb9f8('0x3'));var BPromise=require(_0xb9f8('0x4'));var Mustache=require(_0xb9f8('0x5'));var util=require(_0xb9f8('0x6'));var path=require(_0xb9f8('0x7'));var sox=require(_0xb9f8('0x8'));var csv=require(_0xb9f8('0x9'));var ejs=require(_0xb9f8('0xa'));var fs=require('fs');var _=require(_0xb9f8('0xb'));var squel=require(_0xb9f8('0xc'));var crypto=require(_0xb9f8('0xd'));var jsforce=require(_0xb9f8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb9f8('0x9'));var querystring=require('querystring');var Papa=require(_0xb9f8('0xf'));var Redis=require(_0xb9f8('0x10'));var authService=require(_0xb9f8('0x11'));var qs=require(_0xb9f8('0x12'));var as=require(_0xb9f8('0x13'));var hardwareService=require(_0xb9f8('0x14'));var logger=require(_0xb9f8('0x15'))(_0xb9f8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb9f8('0x17'))['db'];function respondWithStatusCode(_0x11c8cd,_0xebbe5){_0xebbe5=_0xebbe5||0xcc;return function(_0x452eb4){if(_0x452eb4){return _0x11c8cd['sendStatus'](_0xebbe5);}return _0x11c8cd[_0xb9f8('0x18')](_0xebbe5)[_0xb9f8('0x19')]();};}function respondWithResult(_0x4dd480,_0x12d515){_0x12d515=_0x12d515||0xc8;return function(_0x58eff6){if(_0x58eff6){return _0x4dd480[_0xb9f8('0x18')](_0x12d515)[_0xb9f8('0x1a')](_0x58eff6);}};}function respondWithFilteredResult(_0x5f5bd4,_0x13fe36){return function(_0x551411){if(_0x551411){var _0x175b30=_0x551411[_0xb9f8('0x1b')],_0x1c40ef=_0x13fe36[_0xb9f8('0x1c')],_0x57b55a=_0x13fe36['offset']+_0x13fe36[_0xb9f8('0x1d')],_0x38bcf9;if(_0x57b55a>=_0x175b30){_0x57b55a=_0x175b30;_0x38bcf9=0xc8;}else{_0x38bcf9=0xce;}_0x5f5bd4[_0xb9f8('0x18')](_0x38bcf9);return _0x5f5bd4[_0xb9f8('0x1e')](_0xb9f8('0x1f'),_0x1c40ef+'-'+_0x57b55a+'/'+_0x175b30)[_0xb9f8('0x1a')](_0x551411);}return null;};}function patchUpdates(_0x5cac18){return function(_0x160ee1){try{jsonpatch[_0xb9f8('0x20')](_0x160ee1,_0x5cac18,!![]);}catch(_0x7c614c){return BPromise[_0xb9f8('0x21')](_0x7c614c);}return _0x160ee1['save']();};}function saveUpdates(_0x3c0c44,_0x539afc){return function(_0x4d224c){if(_0x4d224c){return _0x4d224c[_0xb9f8('0x22')](_0x3c0c44)[_0xb9f8('0x23')](function(_0x49a151){return _0x49a151;});}return null;};}function removeEntity(_0x577aaf,_0x264294){return function(_0x543253){if(_0x543253){return _0x543253[_0xb9f8('0x24')]()[_0xb9f8('0x23')](function(){_0x577aaf[_0xb9f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3028,_0x14bb0d){return function(_0x29915f){if(!_0x29915f){_0x4a3028[_0xb9f8('0x25')](0x194);}return _0x29915f;};}function handleError(_0x3af14e,_0x15faef){_0x15faef=_0x15faef||0x1f4;return function(_0x1836cf){logger[_0xb9f8('0x26')](_0x1836cf[_0xb9f8('0x27')]);if(_0x1836cf[_0xb9f8('0x28')]){delete _0x1836cf[_0xb9f8('0x28')];}_0x3af14e[_0xb9f8('0x18')](_0x15faef)[_0xb9f8('0x29')](_0x1836cf);};}exports['index']=function(_0x423063,_0x2b9ed2){var _0x374f87={},_0x101a07={},_0x19982b={'count':0x0,'rows':[]};var _0x450717=_['map'](db[_0xb9f8('0x2a')][_0xb9f8('0x2b')],function(_0x237e63){return{'name':_0x237e63[_0xb9f8('0x2c')],'type':_0x237e63[_0xb9f8('0x2d')]['key']};});_0x101a07[_0xb9f8('0x2e')]=_[_0xb9f8('0x2f')](_0x450717,_0xb9f8('0x28'));_0x101a07[_0xb9f8('0x30')]=_[_0xb9f8('0x31')](_0x423063[_0xb9f8('0x30')]);_0x101a07[_0xb9f8('0x32')]=_['intersection'](_0x101a07[_0xb9f8('0x2e')],_0x101a07[_0xb9f8('0x30')]);_0x374f87[_0xb9f8('0x33')]=_[_0xb9f8('0x34')](_0x101a07[_0xb9f8('0x2e')],qs[_0xb9f8('0x35')](_0x423063[_0xb9f8('0x30')][_0xb9f8('0x35')]));_0x374f87[_0xb9f8('0x33')]=_0x374f87[_0xb9f8('0x33')][_0xb9f8('0x36')]?_0x374f87[_0xb9f8('0x33')]:_0x101a07[_0xb9f8('0x2e')];if(!_0x423063[_0xb9f8('0x30')][_0xb9f8('0x37')]('nolimit')){_0x374f87[_0xb9f8('0x1d')]=qs[_0xb9f8('0x1d')](_0x423063['query'][_0xb9f8('0x1d')]);_0x374f87[_0xb9f8('0x1c')]=qs[_0xb9f8('0x1c')](_0x423063[_0xb9f8('0x30')][_0xb9f8('0x1c')]);}_0x374f87[_0xb9f8('0x38')]=qs['sort'](_0x423063[_0xb9f8('0x30')][_0xb9f8('0x39')]);_0x374f87[_0xb9f8('0x3a')]=qs[_0xb9f8('0x32')](_[_0xb9f8('0x3b')](_0x423063[_0xb9f8('0x30')],_0x101a07[_0xb9f8('0x32')]),_0x450717);if(_0x423063[_0xb9f8('0x30')]['filter']){_0x374f87[_0xb9f8('0x3a')]=_[_0xb9f8('0x3c')](_0x374f87[_0xb9f8('0x3a')],{'$or':_[_0xb9f8('0x2f')](_0x450717,function(_0x4a8e3e){if(_0x4a8e3e[_0xb9f8('0x2d')]!=='VIRTUAL'){var _0x643667={};_0x643667[_0x4a8e3e[_0xb9f8('0x28')]]={'$like':'%'+_0x423063[_0xb9f8('0x30')][_0xb9f8('0x3d')]+'%'};return _0x643667;}})});}_0x374f87=_[_0xb9f8('0x3c')]({},_0x374f87,_0x423063[_0xb9f8('0x3e')]);var _0x3b0cbb={'where':_0x374f87['where']};return db['AnalyticFieldReport']['count'](_0x3b0cbb)[_0xb9f8('0x23')](function(_0x5ef4f6){_0x19982b[_0xb9f8('0x1b')]=_0x5ef4f6;if(_0x423063[_0xb9f8('0x30')][_0xb9f8('0x3f')]){_0x374f87[_0xb9f8('0x40')]=[{'all':!![]}];}return db[_0xb9f8('0x2a')][_0xb9f8('0x41')](_0x374f87);})[_0xb9f8('0x23')](function(_0x245ef4){_0x19982b[_0xb9f8('0x42')]=_0x245ef4;return _0x19982b;})[_0xb9f8('0x23')](respondWithFilteredResult(_0x2b9ed2,_0x374f87))[_0xb9f8('0x43')](handleError(_0x2b9ed2,null));};exports[_0xb9f8('0x44')]=function(_0x290bc4,_0x5a7901){var _0x188ce7={'raw':![],'where':{'id':_0x290bc4['params']['id']}},_0x1e60b9={};_0x1e60b9[_0xb9f8('0x2e')]=_[_0xb9f8('0x31')](db['AnalyticFieldReport'][_0xb9f8('0x2b')]);_0x1e60b9[_0xb9f8('0x30')]=_[_0xb9f8('0x31')](_0x290bc4[_0xb9f8('0x30')]);_0x1e60b9['filters']=_[_0xb9f8('0x34')](_0x1e60b9['model'],_0x1e60b9[_0xb9f8('0x30')]);_0x188ce7[_0xb9f8('0x33')]=_[_0xb9f8('0x34')](_0x1e60b9[_0xb9f8('0x2e')],qs[_0xb9f8('0x35')](_0x290bc4['query']['fields']));_0x188ce7['attributes']=_0x188ce7[_0xb9f8('0x33')][_0xb9f8('0x36')]?_0x188ce7[_0xb9f8('0x33')]:_0x1e60b9['model'];if(_0x290bc4[_0xb9f8('0x30')]['includeAll']){_0x188ce7[_0xb9f8('0x40')]=[{'all':!![]}];}_0x188ce7=_['merge']({},_0x188ce7,_0x290bc4[_0xb9f8('0x3e')]);return db[_0xb9f8('0x2a')][_0xb9f8('0x45')](_0x188ce7)[_0xb9f8('0x23')](handleEntityNotFound(_0x5a7901,null))[_0xb9f8('0x23')](respondWithResult(_0x5a7901,null))[_0xb9f8('0x43')](handleError(_0x5a7901,null));};exports[_0xb9f8('0x46')]=function(_0x4741e9,_0x43057c){return db[_0xb9f8('0x2a')]['create'](_0x4741e9['body'],{})[_0xb9f8('0x23')](respondWithResult(_0x43057c,0xc9))[_0xb9f8('0x43')](handleError(_0x43057c,null));};exports[_0xb9f8('0x47')]=function(_0x49d777,_0x20867e){return db['AnalyticFieldReport'][_0xb9f8('0x47')](_0x49d777['body'],{'raw':![],'individualHooks':!![]})[_0xb9f8('0x23')](respondWithResult(_0x20867e,0xc9))[_0xb9f8('0x43')](handleError(_0x20867e,null));};exports[_0xb9f8('0x22')]=function(_0xd279ed,_0x2d48a5){if(_0xd279ed[_0xb9f8('0x48')]['id']){delete _0xd279ed['body']['id'];}return db[_0xb9f8('0x2a')][_0xb9f8('0x45')]({'where':{'id':_0xd279ed['params']['id']}})[_0xb9f8('0x23')](handleEntityNotFound(_0x2d48a5,null))[_0xb9f8('0x23')](saveUpdates(_0xd279ed[_0xb9f8('0x48')],null))[_0xb9f8('0x23')](respondWithResult(_0x2d48a5,null))[_0xb9f8('0x43')](handleError(_0x2d48a5,null));};exports[_0xb9f8('0x24')]=function(_0x40f3f2,_0x1d2b86){return db['AnalyticFieldReport'][_0xb9f8('0x45')]({'where':{'id':_0x40f3f2[_0xb9f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d2b86,null))[_0xb9f8('0x23')](removeEntity(_0x1d2b86,null))[_0xb9f8('0x43')](handleError(_0x1d2b86,null));};exports[_0xb9f8('0x4a')]=function(_0x28912a,_0x4bc403){return db['AnalyticFieldReport'][_0xb9f8('0x24')]({'where':{'id':_0x28912a[_0xb9f8('0x30')][_0xb9f8('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xb9f8('0x23')](respondWithResult(_0x4bc403,0xcc))[_0xb9f8('0x43')](handleError(_0x4bc403,null));};exports[_0xb9f8('0x4c')]=function(_0x3eed56,_0x41d88b,_0x1cb27e){return db['AnalyticCustomReport'][_0xb9f8('0x4d')]({'where':{'id':_0x3eed56[_0xb9f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x41d88b,null))['then'](function(_0x16205c){if(_0x16205c){return db[_0xb9f8('0x4e')]['transaction'](function(_0x2cbd5e){return db[_0xb9f8('0x2a')][_0xb9f8('0x24')]({'where':{'CustomReportId':_0x3eed56[_0xb9f8('0x49')]['id']},'transaction':_0x2cbd5e})[_0xb9f8('0x23')](function(_0x38792c){var _0x3fe30f=_['map'](_0x3eed56[_0xb9f8('0x48')],function(_0xaa634f){delete _0xaa634f['id'];_0xaa634f[_0xb9f8('0x4f')]=_0x3eed56[_0xb9f8('0x49')]['id'];return _0xaa634f;});return db[_0xb9f8('0x2a')]['bulkCreate'](_0x3fe30f,{'transaction':_0x2cbd5e});});})['then'](function(){return db[_0xb9f8('0x2a')]['findAll']({'where':{'CustomReportId':_0x3eed56[_0xb9f8('0x49')]['id']}});});}})[_0xb9f8('0x23')](respondWithResult(_0x41d88b,null))[_0xb9f8('0x43')](handleError(_0x41d88b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d1a50b3..62bf86e 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 _0x9383=['AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x57703d,_0x24d70a){var _0x169ba5=function(_0x5296d6){while(--_0x5296d6){_0x57703d['push'](_0x57703d['shift']());}};_0x169ba5(++_0x24d70a);}(_0x9383,0x146));var _0x3938=function(_0x28c74d,_0x5ad011){_0x28c74d=_0x28c74d-0x0;var _0x5d6dd2=_0x9383[_0x28c74d];return _0x5d6dd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3938('0x0'))(_0x3938('0x1'));var moment=require(_0x3938('0x2'));var BPromise=require(_0x3938('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3938('0x4'));var rimraf=require(_0x3938('0x5'));var config=require(_0x3938('0x6'));var attributes=require(_0x3938('0x7'));module[_0x3938('0x8')]=function(_0x18d2c2,_0x1c616c){return _0x18d2c2[_0x3938('0x9')](_0x3938('0xa'),attributes,{'tableName':_0x3938('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc033=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc033,0x1d1));var _0x3c03=function(_0x371892,_0x4e511c){_0x371892=_0x371892-0x0;var _0xccb104=_0xc033[_0x371892];return _0xccb104;};'use strict';var _=require(_0x3c03('0x0'));var util=require(_0x3c03('0x1'));var logger=require('../../config/logger')(_0x3c03('0x2'));var moment=require(_0x3c03('0x3'));var BPromise=require(_0x3c03('0x4'));var rp=require(_0x3c03('0x5'));var fs=require('fs');var path=require(_0x3c03('0x6'));var rimraf=require(_0x3c03('0x7'));var config=require(_0x3c03('0x8'));var attributes=require(_0x3c03('0x9'));module['exports']=function(_0x13caac,_0x5d4512){return _0x13caac[_0x3c03('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x3c03('0xb'),'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 0bb30b2..77f63aa 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 _0x573f=['then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0xda2f5d,_0x1bd3d0){var _0x390b80=function(_0x8a9201){while(--_0x8a9201){_0xda2f5d['push'](_0xda2f5d['shift']());}};_0x390b80(++_0x1bd3d0);}(_0x573f,0x121));var _0xf573=function(_0x269142,_0x19afd2){_0x269142=_0x269142-0x0;var _0x3202f5=_0x573f[_0x269142];return _0x3202f5;};'use strict';var _=require(_0xf573('0x0'));var util=require(_0xf573('0x1'));var moment=require(_0xf573('0x2'));var BPromise=require(_0xf573('0x3'));var rs=require(_0xf573('0x4'));var fs=require('fs');var Redis=require(_0xf573('0x5'));var db=require(_0xf573('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf573('0x7'))(_0xf573('0x8'));var config=require(_0xf573('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf573('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f3bc6,_0x488627,_0x78c698){return new BPromise(function(_0x319963,_0x45a249){return client['request'](_0x4f3bc6,_0x78c698)[_0xf573('0xb')](function(_0x2f4156){logger[_0xf573('0xc')](_0xf573('0xd'),_0x488627,'request\x20sent');logger[_0xf573('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x488627,'request\x20sent',JSON[_0xf573('0xf')](_0x2f4156));if(_0x2f4156[_0xf573('0x10')]){if(_0x2f4156[_0xf573('0x10')]['code']===0x1f4){logger[_0xf573('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x488627,_0x2f4156[_0xf573('0x10')][_0xf573('0x11')]);return _0x45a249(_0x2f4156[_0xf573('0x10')][_0xf573('0x11')]);}logger[_0xf573('0x10')](_0xf573('0xd'),_0x488627,_0x2f4156[_0xf573('0x10')][_0xf573('0x11')]);return _0x319963(_0x2f4156[_0xf573('0x10')][_0xf573('0x11')]);}else{logger[_0xf573('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x488627,_0xf573('0x12'));_0x319963(_0x2f4156[_0xf573('0x13')]['message']);}})['catch'](function(_0x535a5d){logger[_0xf573('0x10')](_0xf573('0xd'),_0x488627,_0x535a5d);_0x45a249(_0x535a5d);});});} \ No newline at end of file +var _0xec12=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message'];(function(_0x279de4,_0x5d552d){var _0x104a16=function(_0x365e5a){while(--_0x365e5a){_0x279de4['push'](_0x279de4['shift']());}};_0x104a16(++_0x5d552d);}(_0xec12,0x7f));var _0x2ec1=function(_0x2cf7c3,_0x5f4ef8){_0x2cf7c3=_0x2cf7c3-0x0;var _0x292680=_0xec12[_0x2cf7c3];return _0x292680;};'use strict';var _=require(_0x2ec1('0x0'));var util=require(_0x2ec1('0x1'));var moment=require(_0x2ec1('0x2'));var BPromise=require(_0x2ec1('0x3'));var rs=require(_0x2ec1('0x4'));var fs=require('fs');var Redis=require(_0x2ec1('0x5'));var db=require(_0x2ec1('0x6'))['db'];var utils=require(_0x2ec1('0x7'));var logger=require(_0x2ec1('0x8'))(_0x2ec1('0x9'));var config=require(_0x2ec1('0xa'));var jayson=require(_0x2ec1('0xb'));var client=jayson[_0x2ec1('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba6adb,_0x59098a,_0x3485bf){return new BPromise(function(_0x2ecce8,_0x4dd693){return client[_0x2ec1('0xd')](_0xba6adb,_0x3485bf)[_0x2ec1('0xe')](function(_0x5bb860){logger[_0x2ec1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x59098a,_0x2ec1('0x10'));logger['debug'](_0x2ec1('0x11'),_0x59098a,_0x2ec1('0x10'),JSON[_0x2ec1('0x12')](_0x5bb860));if(_0x5bb860[_0x2ec1('0x13')]){if(_0x5bb860[_0x2ec1('0x13')][_0x2ec1('0x14')]===0x1f4){logger['error'](_0x2ec1('0x15'),_0x59098a,_0x5bb860[_0x2ec1('0x13')][_0x2ec1('0x16')]);return _0x4dd693(_0x5bb860[_0x2ec1('0x13')][_0x2ec1('0x16')]);}logger[_0x2ec1('0x13')](_0x2ec1('0x15'),_0x59098a,_0x5bb860['error'][_0x2ec1('0x16')]);return _0x2ecce8(_0x5bb860[_0x2ec1('0x13')][_0x2ec1('0x16')]);}else{logger['info'](_0x2ec1('0x15'),_0x59098a,'request\x20sent');_0x2ecce8(_0x5bb860[_0x2ec1('0x17')][_0x2ec1('0x16')]);}})[_0x2ec1('0x18')](function(_0x32cfa2){logger[_0x2ec1('0x13')](_0x2ec1('0x15'),_0x59098a,_0x32cfa2);_0x4dd693(_0x32cfa2);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ca7ffda..26af554 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x38dd70,_0x458fb0){var _0x5dec80=function(_0x4ba44f){while(--_0x4ba44f){_0x38dd70['push'](_0x38dd70['shift']());}};_0x5dec80(++_0x458fb0);}(_0x3e74,0x175));var _0x43e7=function(_0x116ff4,_0x35edba){_0x116ff4=_0x116ff4-0x0;var _0x4ff436=_0x3e74[_0x116ff4];return _0x4ff436;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x280bef,_0x5e1bd3){_0x280bef=_0x280bef-0x0;var _0x56dc85=_0x55ca[_0x280bef];return _0x56dc85;};'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('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',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/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 73b6265..54526a4 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 _0xd027=['STRING','TEXT','exports'];(function(_0x5aba56,_0x17f8bb){var _0x273611=function(_0x341702){while(--_0x341702){_0x5aba56['push'](_0x5aba56['shift']());}};_0x273611(++_0x17f8bb);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x7d02('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7d02('0x1')]},'metric':{'type':Sequelize[_0x7d02('0x2')]},'description':{'type':Sequelize[_0x7d02('0x1')]}}; \ No newline at end of file +var _0x8201=['name','TEXT','sequelize'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x8201,0x71));var _0x1820=function(_0x46863a,_0x5cd9c8){_0x46863a=_0x46863a-0x0;var _0x2278ca=_0x8201[_0x46863a];return _0x2278ca;};'use strict';var Sequelize=require(_0x1820('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1820('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x1820('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cc6ad31..86c9154 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 _0x84a0=['VIRTUAL','options','count','includeAll','AnalyticMetric','findAll','rows','show','length','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x508657,_0x2016c5){var _0x415f66=function(_0x47ed6e){while(--_0x47ed6e){_0x508657['push'](_0x508657['shift']());}};_0x415f66(++_0x2016c5);}(_0x84a0,0x66));var _0x084a=function(_0x320401,_0x4836fb){_0x320401=_0x320401-0x0;var _0x3ec105=_0x84a0[_0x320401];return _0x3ec105;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var Redis=require(_0x084a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x11'));var hardwareService=require(_0x084a('0x12'));var logger=require(_0x084a('0x13'))(_0x084a('0x14'));var utils=require(_0x084a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc451b1,_0x3ca72f){_0x3ca72f=_0x3ca72f||0xcc;return function(_0xec90a5){if(_0xec90a5){return _0xc451b1[_0x084a('0x16')](_0x3ca72f);}return _0xc451b1[_0x084a('0x17')](_0x3ca72f)[_0x084a('0x18')]();};}function respondWithResult(_0x3ff351,_0x3a76d1){_0x3a76d1=_0x3a76d1||0xc8;return function(_0x5aef40){if(_0x5aef40){return _0x3ff351[_0x084a('0x17')](_0x3a76d1)['json'](_0x5aef40);}};}function respondWithFilteredResult(_0x225de0,_0x3ccaca){return function(_0x366624){if(_0x366624){var _0x2d35b8=_0x366624['count'],_0xd20527=_0x3ccaca[_0x084a('0x19')],_0x4cbd16=_0x3ccaca[_0x084a('0x19')]+_0x3ccaca['limit'],_0x443ebb;if(_0x4cbd16>=_0x2d35b8){_0x4cbd16=_0x2d35b8;_0x443ebb=0xc8;}else{_0x443ebb=0xce;}_0x225de0[_0x084a('0x17')](_0x443ebb);return _0x225de0[_0x084a('0x1a')](_0x084a('0x1b'),_0xd20527+'-'+_0x4cbd16+'/'+_0x2d35b8)[_0x084a('0x1c')](_0x366624);}return null;};}function patchUpdates(_0x33d3a6){return function(_0x145636){try{jsonpatch[_0x084a('0x1d')](_0x145636,_0x33d3a6,!![]);}catch(_0x34e86e){return BPromise[_0x084a('0x1e')](_0x34e86e);}return _0x145636[_0x084a('0x1f')]();};}function saveUpdates(_0x3c7fd6,_0x279e25){return function(_0x116328){if(_0x116328){return _0x116328[_0x084a('0x20')](_0x3c7fd6)[_0x084a('0x21')](function(_0x506f71){return _0x506f71;});}return null;};}function removeEntity(_0x343c5c,_0x1ad257){return function(_0x41a90f){if(_0x41a90f){return _0x41a90f[_0x084a('0x22')]()[_0x084a('0x21')](function(){var _0x4865c8=_0x41a90f[_0x084a('0x23')]({'plain':!![]});var _0x288e9e=_0x084a('0x24');return db[_0x084a('0x25')][_0x084a('0x22')]({'where':{'type':_0x288e9e,'resourceId':_0x4865c8['id']}})[_0x084a('0x21')](function(){return _0x41a90f;});})['then'](function(){_0x343c5c[_0x084a('0x17')](0xcc)[_0x084a('0x18')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x16')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x26')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x27')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x28')](db['AnalyticMetric'][_0x084a('0x29')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2a')][_0x084a('0x2b')]};});_0x3be7a6[_0x084a('0x2c')]=_[_0x084a('0x28')](_0x378de6,_0x084a('0x26'));_0x3be7a6[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x4651e6[_0x084a('0x2d')]);_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x3be7a6[_0x084a('0x2c')],_0x3be7a6[_0x084a('0x2d')]);_0x2c4149[_0x084a('0x31')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x32')](_0x4651e6[_0x084a('0x2d')][_0x084a('0x32')]));_0x2c4149[_0x084a('0x31')]=_0x2c4149[_0x084a('0x31')]['length']?_0x2c4149[_0x084a('0x31')]:_0x3be7a6[_0x084a('0x2c')];if(!_0x4651e6[_0x084a('0x2d')]['hasOwnProperty'](_0x084a('0x33'))){_0x2c4149[_0x084a('0x34')]=qs[_0x084a('0x34')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x19')](_0x4651e6[_0x084a('0x2d')][_0x084a('0x19')]);}_0x2c4149['order']=qs[_0x084a('0x35')](_0x4651e6[_0x084a('0x2d')][_0x084a('0x35')]);_0x2c4149[_0x084a('0x36')]=qs[_0x084a('0x2f')](_[_0x084a('0x37')](_0x4651e6[_0x084a('0x2d')],_0x3be7a6[_0x084a('0x2f')]),_0x378de6);if(_0x4651e6[_0x084a('0x2d')][_0x084a('0x38')]){_0x2c4149[_0x084a('0x36')]=_[_0x084a('0x39')](_0x2c4149[_0x084a('0x36')],{'$or':_[_0x084a('0x28')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3a')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x26')]]={'$like':'%'+_0x4651e6[_0x084a('0x2d')][_0x084a('0x38')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x39')]({},_0x2c4149,_0x4651e6[_0x084a('0x3b')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x36')]};return db['AnalyticMetric'][_0x084a('0x3c')](_0x183e10)[_0x084a('0x21')](function(_0x25a081){_0x25a2a1[_0x084a('0x3c')]=_0x25a081;if(_0x4651e6[_0x084a('0x2d')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x21')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':!![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x2e')](db[_0x084a('0x3e')][_0x084a('0x29')]);_0xfb565c[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0xba1081[_0x084a('0x2d')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xfb565c[_0x084a('0x2c')],_0xfb565c[_0x084a('0x2d')]);_0x3e2b92[_0x084a('0x31')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x32')](_0xba1081[_0x084a('0x2d')][_0x084a('0x32')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x31')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x31')]:_0xfb565c[_0x084a('0x2c')];if(_0xba1081[_0x084a('0x2d')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3b')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](function(_0x343bfa){var _0x865368=_0x505965[_0x084a('0x48')][_0x084a('0x23')]({'plain':!![]});if(!_0x865368)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x865368[_0x084a('0x49')]===_0x084a('0x48')){var _0x411fa9=_0x343bfa[_0x084a('0x23')]({'plain':!![]});var _0x5a718c='Metrics';return db[_0x084a('0x4a')][_0x084a('0x44')]({'where':{'name':_0x5a718c,'userProfileId':_0x865368[_0x084a('0x4b')]},'raw':!![]})[_0x084a('0x21')](function(_0xf936e){if(_0xf936e&&_0xf936e[_0x084a('0x4c')]===0x0){return db[_0x084a('0x25')][_0x084a('0x46')]({'name':_0x411fa9[_0x084a('0x26')],'resourceId':_0x411fa9['id'],'type':_0xf936e[_0x084a('0x26')],'sectionId':_0xf936e['id']},{})[_0x084a('0x21')](function(){return _0x343bfa;});}else{return _0x343bfa;}})[_0x084a('0x45')](function(_0x4fe1b5){logger[_0x084a('0x4d')](_0x084a('0x4e'),_0x4fe1b5);throw _0x4fe1b5;});}return _0x343bfa;})[_0x084a('0x21')](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x20')]=function(_0x1c972c,_0xa5362){if(_0x1c972c['body']['id']){delete _0x1c972c[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x1c972c['params']['id']}})['then'](handleEntityNotFound(_0xa5362,null))[_0x084a('0x21')](saveUpdates(_0x1c972c['body'],null))[_0x084a('0x21')](respondWithResult(_0xa5362,null))[_0x084a('0x45')](handleError(_0xa5362,null));};exports['destroy']=function(_0x36a3d3,_0x54e9a5){return db['AnalyticMetric'][_0x084a('0x44')]({'where':{'id':_0x36a3d3[_0x084a('0x4f')]['id']}})[_0x084a('0x21')](handleEntityNotFound(_0x54e9a5,null))[_0x084a('0x21')](removeEntity(_0x54e9a5,null))[_0x084a('0x45')](handleError(_0x54e9a5,null));}; \ No newline at end of file +var _0x06ef=['nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticMetric','findAll','rows','params','includeAll','include','create','body','user','role','UserProfileSection','find','autoAssociation','catch','update','rimraf','bluebird','mustache','util','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x28164e,_0x23611e){var _0x1b2102=function(_0x309d6c){while(--_0x309d6c){_0x28164e['push'](_0x28164e['shift']());}};_0x1b2102(++_0x23611e);}(_0x06ef,0x185));var _0xf06e=function(_0x21602d,_0x4b30ab){_0x21602d=_0x21602d-0x0;var _0x4ceba6=_0x06ef[_0x21602d];return _0x4ceba6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf06e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf06e('0x1'));var Mustache=require(_0xf06e('0x2'));var util=require(_0xf06e('0x3'));var path=require('path');var sox=require(_0xf06e('0x4'));var csv=require(_0xf06e('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf06e('0x6'));var toCsv=require(_0xf06e('0x5'));var querystring=require(_0xf06e('0x7'));var Papa=require(_0xf06e('0x8'));var Redis=require(_0xf06e('0x9'));var authService=require('../../components/auth/service');var qs=require(_0xf06e('0xa'));var as=require(_0xf06e('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf06e('0xc'))(_0xf06e('0xd'));var utils=require(_0xf06e('0xe'));var config=require(_0xf06e('0xf'));var db=require(_0xf06e('0x10'))['db'];function respondWithStatusCode(_0x7b4c4,_0x49fe5d){_0x49fe5d=_0x49fe5d||0xcc;return function(_0x3daa50){if(_0x3daa50){return _0x7b4c4[_0xf06e('0x11')](_0x49fe5d);}return _0x7b4c4['status'](_0x49fe5d)[_0xf06e('0x12')]();};}function respondWithResult(_0x17ea4f,_0x59f60b){_0x59f60b=_0x59f60b||0xc8;return function(_0x4e6dd8){if(_0x4e6dd8){return _0x17ea4f['status'](_0x59f60b)[_0xf06e('0x13')](_0x4e6dd8);}};}function respondWithFilteredResult(_0x6a8948,_0x36f38f){return function(_0x55dce1){if(_0x55dce1){var _0x3fdacc=_0x55dce1[_0xf06e('0x14')],_0x375f90=_0x36f38f[_0xf06e('0x15')],_0x3629f3=_0x36f38f[_0xf06e('0x15')]+_0x36f38f['limit'],_0xab4288;if(_0x3629f3>=_0x3fdacc){_0x3629f3=_0x3fdacc;_0xab4288=0xc8;}else{_0xab4288=0xce;}_0x6a8948[_0xf06e('0x16')](_0xab4288);return _0x6a8948[_0xf06e('0x17')](_0xf06e('0x18'),_0x375f90+'-'+_0x3629f3+'/'+_0x3fdacc)[_0xf06e('0x13')](_0x55dce1);}return null;};}function patchUpdates(_0x5c1a80){return function(_0x54c08d){try{jsonpatch[_0xf06e('0x19')](_0x54c08d,_0x5c1a80,!![]);}catch(_0x3fbee3){return BPromise['reject'](_0x3fbee3);}return _0x54c08d['save']();};}function saveUpdates(_0x5fcefb,_0x211590){return function(_0x167ad3){if(_0x167ad3){return _0x167ad3['update'](_0x5fcefb)[_0xf06e('0x1a')](function(_0x3ff738){return _0x3ff738;});}return null;};}function removeEntity(_0x5ecd73,_0x3c3796){return function(_0x1ba130){if(_0x1ba130){return _0x1ba130[_0xf06e('0x1b')]()['then'](function(){var _0x1106d2=_0x1ba130[_0xf06e('0x1c')]({'plain':!![]});var _0x9e06b5=_0xf06e('0x1d');return db[_0xf06e('0x1e')]['destroy']({'where':{'type':_0x9e06b5,'resourceId':_0x1106d2['id']}})[_0xf06e('0x1a')](function(){return _0x1ba130;});})['then'](function(){_0x5ecd73[_0xf06e('0x16')](0xcc)[_0xf06e('0x12')]();});}};}function handleEntityNotFound(_0x8d3493,_0x322f4c){return function(_0x1a7f5e){if(!_0x1a7f5e){_0x8d3493[_0xf06e('0x11')](0x194);}return _0x1a7f5e;};}function handleError(_0x5c09e5,_0xc6dfd){_0xc6dfd=_0xc6dfd||0x1f4;return function(_0x169539){logger[_0xf06e('0x1f')](_0x169539[_0xf06e('0x20')]);if(_0x169539[_0xf06e('0x21')]){delete _0x169539['name'];}_0x5c09e5[_0xf06e('0x16')](_0xc6dfd)[_0xf06e('0x22')](_0x169539);};}exports[_0xf06e('0x23')]=function(_0x89a74f,_0x373709){var _0x25bacb={},_0x4b5185={},_0x17c427={'count':0x0,'rows':[]};var _0x7870d6=_[_0xf06e('0x24')](db['AnalyticMetric'][_0xf06e('0x25')],function(_0x11580e){return{'name':_0x11580e[_0xf06e('0x26')],'type':_0x11580e[_0xf06e('0x27')][_0xf06e('0x28')]};});_0x4b5185[_0xf06e('0x29')]=_[_0xf06e('0x24')](_0x7870d6,_0xf06e('0x21'));_0x4b5185[_0xf06e('0x2a')]=_['keys'](_0x89a74f['query']);_0x4b5185[_0xf06e('0x2b')]=_[_0xf06e('0x2c')](_0x4b5185['model'],_0x4b5185[_0xf06e('0x2a')]);_0x25bacb[_0xf06e('0x2d')]=_[_0xf06e('0x2c')](_0x4b5185[_0xf06e('0x29')],qs[_0xf06e('0x2e')](_0x89a74f[_0xf06e('0x2a')]['fields']));_0x25bacb[_0xf06e('0x2d')]=_0x25bacb[_0xf06e('0x2d')][_0xf06e('0x2f')]?_0x25bacb['attributes']:_0x4b5185[_0xf06e('0x29')];if(!_0x89a74f[_0xf06e('0x2a')][_0xf06e('0x30')](_0xf06e('0x31'))){_0x25bacb[_0xf06e('0x32')]=qs[_0xf06e('0x32')](_0x89a74f[_0xf06e('0x2a')]['limit']);_0x25bacb['offset']=qs[_0xf06e('0x15')](_0x89a74f['query'][_0xf06e('0x15')]);}_0x25bacb['order']=qs[_0xf06e('0x33')](_0x89a74f['query'][_0xf06e('0x33')]);_0x25bacb[_0xf06e('0x34')]=qs[_0xf06e('0x2b')](_[_0xf06e('0x35')](_0x89a74f[_0xf06e('0x2a')],_0x4b5185[_0xf06e('0x2b')]),_0x7870d6);if(_0x89a74f['query'][_0xf06e('0x36')]){_0x25bacb[_0xf06e('0x34')]=_[_0xf06e('0x37')](_0x25bacb[_0xf06e('0x34')],{'$or':_[_0xf06e('0x24')](_0x7870d6,function(_0x2e98e9){if(_0x2e98e9[_0xf06e('0x27')]!==_0xf06e('0x38')){var _0xf8828a={};_0xf8828a[_0x2e98e9[_0xf06e('0x21')]]={'$like':'%'+_0x89a74f[_0xf06e('0x2a')]['filter']+'%'};return _0xf8828a;}})});}_0x25bacb=_[_0xf06e('0x37')]({},_0x25bacb,_0x89a74f[_0xf06e('0x39')]);var _0x2dfbb4={'where':_0x25bacb[_0xf06e('0x34')]};return db[_0xf06e('0x3a')][_0xf06e('0x14')](_0x2dfbb4)[_0xf06e('0x1a')](function(_0x5101cc){_0x17c427[_0xf06e('0x14')]=_0x5101cc;if(_0x89a74f[_0xf06e('0x2a')]['includeAll']){_0x25bacb['include']=[{'all':!![]}];}return db[_0xf06e('0x3a')][_0xf06e('0x3b')](_0x25bacb);})[_0xf06e('0x1a')](function(_0x7fc745){_0x17c427[_0xf06e('0x3c')]=_0x7fc745;return _0x17c427;})[_0xf06e('0x1a')](respondWithFilteredResult(_0x373709,_0x25bacb))['catch'](handleError(_0x373709,null));};exports['show']=function(_0x14fe45,_0x563225){var _0x548186={'raw':!![],'where':{'id':_0x14fe45[_0xf06e('0x3d')]['id']}},_0x494974={};_0x494974[_0xf06e('0x29')]=_['keys'](db['AnalyticMetric'][_0xf06e('0x25')]);_0x494974[_0xf06e('0x2a')]=_['keys'](_0x14fe45[_0xf06e('0x2a')]);_0x494974['filters']=_[_0xf06e('0x2c')](_0x494974[_0xf06e('0x29')],_0x494974[_0xf06e('0x2a')]);_0x548186[_0xf06e('0x2d')]=_['intersection'](_0x494974[_0xf06e('0x29')],qs[_0xf06e('0x2e')](_0x14fe45['query'][_0xf06e('0x2e')]));_0x548186[_0xf06e('0x2d')]=_0x548186[_0xf06e('0x2d')][_0xf06e('0x2f')]?_0x548186[_0xf06e('0x2d')]:_0x494974[_0xf06e('0x29')];if(_0x14fe45[_0xf06e('0x2a')][_0xf06e('0x3e')]){_0x548186[_0xf06e('0x3f')]=[{'all':!![]}];}_0x548186=_[_0xf06e('0x37')]({},_0x548186,_0x14fe45[_0xf06e('0x39')]);return db['AnalyticMetric']['find'](_0x548186)[_0xf06e('0x1a')](handleEntityNotFound(_0x563225,null))['then'](respondWithResult(_0x563225,null))['catch'](handleError(_0x563225,null));};exports[_0xf06e('0x40')]=function(_0x3e403e,_0x324aaf){return db[_0xf06e('0x3a')][_0xf06e('0x40')](_0x3e403e[_0xf06e('0x41')],{})[_0xf06e('0x1a')](function(_0x252629){var _0x4f7ce2=_0x3e403e[_0xf06e('0x42')][_0xf06e('0x1c')]({'plain':!![]});if(!_0x4f7ce2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f7ce2[_0xf06e('0x43')]===_0xf06e('0x42')){var _0x44030c=_0x252629['get']({'plain':!![]});var _0x544319=_0xf06e('0x1d');return db[_0xf06e('0x44')][_0xf06e('0x45')]({'where':{'name':_0x544319,'userProfileId':_0x4f7ce2['userProfileId']},'raw':!![]})[_0xf06e('0x1a')](function(_0x338d1c){if(_0x338d1c&&_0x338d1c[_0xf06e('0x46')]===0x0){return db[_0xf06e('0x1e')]['create']({'name':_0x44030c['name'],'resourceId':_0x44030c['id'],'type':_0x338d1c[_0xf06e('0x21')],'sectionId':_0x338d1c['id']},{})['then'](function(){return _0x252629;});}else{return _0x252629;}})['catch'](function(_0x3b6d4b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b6d4b);throw _0x3b6d4b;});}return _0x252629;})[_0xf06e('0x1a')](respondWithResult(_0x324aaf,0xc9))[_0xf06e('0x47')](handleError(_0x324aaf,null));};exports[_0xf06e('0x48')]=function(_0x319dcc,_0x4aca1){if(_0x319dcc[_0xf06e('0x41')]['id']){delete _0x319dcc[_0xf06e('0x41')]['id'];}return db['AnalyticMetric'][_0xf06e('0x45')]({'where':{'id':_0x319dcc['params']['id']}})[_0xf06e('0x1a')](handleEntityNotFound(_0x4aca1,null))['then'](saveUpdates(_0x319dcc[_0xf06e('0x41')],null))[_0xf06e('0x1a')](respondWithResult(_0x4aca1,null))[_0xf06e('0x47')](handleError(_0x4aca1,null));};exports[_0xf06e('0x1b')]=function(_0x321354,_0x437764){return db['AnalyticMetric'][_0xf06e('0x45')]({'where':{'id':_0x321354[_0xf06e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x437764,null))['then'](removeEntity(_0x437764,null))['catch'](handleError(_0x437764,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 20157fb..a73c954 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 _0x7216=['moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api'];(function(_0x15ecd1,_0x415fea){var _0x257ddf=function(_0x330f84){while(--_0x330f84){_0x15ecd1['push'](_0x15ecd1['shift']());}};_0x257ddf(++_0x415fea);}(_0x7216,0xbd));var _0x6721=function(_0x1c5c3b,_0x2031f5){_0x1c5c3b=_0x1c5c3b-0x0;var _0x18486c=_0x7216[_0x1c5c3b];return _0x18486c;};'use strict';var _=require(_0x6721('0x0'));var util=require('util');var logger=require(_0x6721('0x1'))(_0x6721('0x2'));var moment=require(_0x6721('0x3'));var BPromise=require(_0x6721('0x4'));var rp=require(_0x6721('0x5'));var fs=require('fs');var path=require(_0x6721('0x6'));var rimraf=require(_0x6721('0x7'));var config=require('../../config/environment');var attributes=require(_0x6721('0x8'));module['exports']=function(_0x163d04,_0x5eb675){return _0x163d04[_0x6721('0x9')](_0x6721('0xa'),attributes,{'tableName':_0x6721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd94a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_metrics','lodash','util','moment'];(function(_0x3b449c,_0x1b2e0d){var _0x14aa36=function(_0x1819c1){while(--_0x1819c1){_0x3b449c['push'](_0x3b449c['shift']());}};_0x14aa36(++_0x1b2e0d);}(_0xd94a,0x1c0));var _0xad94=function(_0x451b31,_0x180854){_0x451b31=_0x451b31-0x0;var _0xb75225=_0xd94a[_0x451b31];return _0xb75225;};'use strict';var _=require(_0xad94('0x0'));var util=require(_0xad94('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad94('0x2'));var BPromise=require(_0xad94('0x3'));var rp=require(_0xad94('0x4'));var fs=require('fs');var path=require(_0xad94('0x5'));var rimraf=require(_0xad94('0x6'));var config=require(_0xad94('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xad94('0x8')]=function(_0xed3d24,_0x591026){return _0xed3d24[_0xad94('0x9')]('AnalyticMetric',attributes,{'tableName':_0xad94('0xa'),'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 887d00a..c8a7de4 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 _0x1e11=['client','request','then','info','debug','request\x20sent','error','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x30827e,_0xa2c956){var _0x13a0e3=function(_0x1f1c8b){while(--_0x1f1c8b){_0x30827e['push'](_0x30827e['shift']());}};_0x13a0e3(++_0xa2c956);}(_0x1e11,0x1bf));var _0x11e1=function(_0x2c64e7,_0x322872){_0x2c64e7=_0x2c64e7-0x0;var _0x416fdf=_0x1e11[_0x2c64e7];return _0x416fdf;};'use strict';var _=require(_0x11e1('0x0'));var util=require(_0x11e1('0x1'));var moment=require('moment');var BPromise=require(_0x11e1('0x2'));var rs=require(_0x11e1('0x3'));var fs=require('fs');var Redis=require(_0x11e1('0x4'));var db=require(_0x11e1('0x5'))['db'];var utils=require(_0x11e1('0x6'));var logger=require('../../config/logger')(_0x11e1('0x7'));var config=require(_0x11e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc4b888,_0x5322cd,_0x13b646){return new BPromise(function(_0x1deb61,_0x1f2f10){return client[_0x11e1('0xa')](_0xc4b888,_0x13b646)[_0x11e1('0xb')](function(_0x5b7a1a){logger[_0x11e1('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x5322cd,'request\x20sent');logger[_0x11e1('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5322cd,_0x11e1('0xe'),JSON['stringify'](_0x5b7a1a));if(_0x5b7a1a[_0x11e1('0xf')]){if(_0x5b7a1a['error']['code']===0x1f4){logger[_0x11e1('0xf')](_0x11e1('0x10'),_0x5322cd,_0x5b7a1a['error'][_0x11e1('0x11')]);return _0x1f2f10(_0x5b7a1a[_0x11e1('0xf')][_0x11e1('0x11')]);}logger['error'](_0x11e1('0x10'),_0x5322cd,_0x5b7a1a[_0x11e1('0xf')][_0x11e1('0x11')]);return _0x1deb61(_0x5b7a1a['error'][_0x11e1('0x11')]);}else{logger[_0x11e1('0xc')](_0x11e1('0x10'),_0x5322cd,_0x11e1('0xe'));_0x1deb61(_0x5b7a1a['result'][_0x11e1('0x11')]);}})[_0x11e1('0x12')](function(_0x3bb257){logger[_0x11e1('0xf')](_0x11e1('0x10'),_0x5322cd,_0x3bb257);_0x1f2f10(_0x3bb257);});});} \ No newline at end of file +var _0x95ec=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3a9418,_0x4406cb){var _0x37bb1c=function(_0x5cd4f0){while(--_0x5cd4f0){_0x3a9418['push'](_0x3a9418['shift']());}};_0x37bb1c(++_0x4406cb);}(_0x95ec,0x75));var _0xc95e=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x95ec[_0x507403];return _0x1327c;};'use strict';var _=require('lodash');var util=require(_0xc95e('0x0'));var moment=require(_0xc95e('0x1'));var BPromise=require(_0xc95e('0x2'));var rs=require(_0xc95e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc95e('0x4'))['db'];var utils=require(_0xc95e('0x5'));var logger=require(_0xc95e('0x6'))(_0xc95e('0x7'));var config=require(_0xc95e('0x8'));var jayson=require(_0xc95e('0x9'));var client=jayson[_0xc95e('0xa')][_0xc95e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16bd0f,_0x492912,_0x3fc62d){return new BPromise(function(_0x75665,_0x17a247){return client[_0xc95e('0xc')](_0x16bd0f,_0x3fc62d)[_0xc95e('0xd')](function(_0x213d8d){logger[_0xc95e('0xe')](_0xc95e('0xf'),_0x492912,_0xc95e('0x10'));logger[_0xc95e('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x492912,_0xc95e('0x10'),JSON[_0xc95e('0x12')](_0x213d8d));if(_0x213d8d[_0xc95e('0x13')]){if(_0x213d8d[_0xc95e('0x13')]['code']===0x1f4){logger[_0xc95e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x492912,_0x213d8d[_0xc95e('0x13')]['message']);return _0x17a247(_0x213d8d[_0xc95e('0x13')][_0xc95e('0x14')]);}logger[_0xc95e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x492912,_0x213d8d[_0xc95e('0x13')][_0xc95e('0x14')]);return _0x75665(_0x213d8d['error'][_0xc95e('0x14')]);}else{logger['info'](_0xc95e('0xf'),_0x492912,_0xc95e('0x10'));_0x75665(_0x213d8d[_0xc95e('0x15')][_0xc95e('0x14')]);}})[_0xc95e('0x16')](function(_0x1caa7a){logger[_0xc95e('0x13')](_0xc95e('0xf'),_0x492912,_0x1caa7a);_0x17a247(_0x1caa7a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index de776dc..0fc3bee 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 _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./analyticMetric.controller'];(function(_0x4b5e67,_0x7a6ab1){var _0x4ecdcf=function(_0x2979e2){while(--_0x2979e2){_0x4b5e67['push'](_0x4b5e67['shift']());}};_0x4ecdcf(++_0x7a6ab1);}(_0xba34,0x119));var _0x4ba3=function(_0x956069,_0x4b897c){_0x956069=_0x956069-0x0;var _0x48ee95=_0xba34[_0x956069];return _0x48ee95;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('0x11')]=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(_0x2bc1e7,_0xb34499){var _0x2ae878=function(_0x174c23){while(--_0x174c23){_0x2bc1e7['push'](_0x2bc1e7['shift']());}};_0x2ae878(++_0xb34499);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'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 0bd324e..8daa0ff 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 _0xfa40=['sequelize','exports'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xfa40,0x170));var _0x0fa4=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xfa40[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module[_0x0fa4('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x95ad=['exports','TEXT','sequelize'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x95ad,0x179));var _0xd95a=function(_0x4c145a,_0x2bd1ab){_0x4c145a=_0x4c145a-0x0;var _0x62f655=_0x95ad[_0x4c145a];return _0x62f655;};'use strict';var Sequelize=require(_0xd95a('0x0'));module[_0xd95a('0x1')]={'tree':{'type':Sequelize[_0xd95a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 343630c..8be7dde 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 _0x6eab=['update','then','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x6eab,0x147));var _0xb6ea=function(_0x30ba85,_0x503490){_0x30ba85=_0x30ba85-0x0;var _0x58b533=_0x6eab[_0x30ba85];return _0x58b533;};'use strict';var pdf=require(_0xb6ea('0x0'));var emlformat=require(_0xb6ea('0x1'));var rimraf=require(_0xb6ea('0x2'));var zipdir=require(_0xb6ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6ea('0x4'));var moment=require(_0xb6ea('0x5'));var BPromise=require(_0xb6ea('0x6'));var Mustache=require(_0xb6ea('0x7'));var util=require(_0xb6ea('0x8'));var path=require(_0xb6ea('0x9'));var sox=require(_0xb6ea('0xa'));var csv=require(_0xb6ea('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb6ea('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb6ea('0xd'));var deskjs=require(_0xb6ea('0xe'));var toCsv=require(_0xb6ea('0xb'));var querystring=require('querystring');var Papa=require(_0xb6ea('0xf'));var Redis=require(_0xb6ea('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb6ea('0x11'));var as=require(_0xb6ea('0x12'));var hardwareService=require(_0xb6ea('0x13'));var logger=require('../../config/logger')(_0xb6ea('0x14'));var utils=require(_0xb6ea('0x15'));var config=require('../../config/environment');var db=require(_0xb6ea('0x16'))['db'];function respondWithStatusCode(_0x46994f,_0x3733fd){_0x3733fd=_0x3733fd||0xcc;return function(_0x273cd){if(_0x273cd){return _0x46994f[_0xb6ea('0x17')](_0x3733fd);}return _0x46994f[_0xb6ea('0x18')](_0x3733fd)[_0xb6ea('0x19')]();};}function respondWithResult(_0x290f9a,_0x40c62b){_0x40c62b=_0x40c62b||0xc8;return function(_0x3b351b){if(_0x3b351b){return _0x290f9a[_0xb6ea('0x18')](_0x40c62b)[_0xb6ea('0x1a')](_0x3b351b);}};}function respondWithFilteredResult(_0x57a40f,_0x18148f){return function(_0x2d7cf1){if(_0x2d7cf1){var _0x523a74=_0x2d7cf1[_0xb6ea('0x1b')],_0x1c10f9=_0x18148f[_0xb6ea('0x1c')],_0x3571ad=_0x18148f[_0xb6ea('0x1c')]+_0x18148f['limit'],_0x34e317;if(_0x3571ad>=_0x523a74){_0x3571ad=_0x523a74;_0x34e317=0xc8;}else{_0x34e317=0xce;}_0x57a40f[_0xb6ea('0x18')](_0x34e317);return _0x57a40f[_0xb6ea('0x1d')](_0xb6ea('0x1e'),_0x1c10f9+'-'+_0x3571ad+'/'+_0x523a74)[_0xb6ea('0x1a')](_0x2d7cf1);}return null;};}function patchUpdates(_0x37a812){return function(_0x4f88fd){try{jsonpatch['apply'](_0x4f88fd,_0x37a812,!![]);}catch(_0x3d73ac){return BPromise[_0xb6ea('0x1f')](_0x3d73ac);}return _0x4f88fd[_0xb6ea('0x20')]();};}function saveUpdates(_0x1e06cc,_0x2e8d82){return function(_0x3006fb){if(_0x3006fb){return _0x3006fb[_0xb6ea('0x21')](_0x1e06cc)['then'](function(_0x27d10c){return _0x27d10c;});}return null;};}function removeEntity(_0x474f5e,_0x576500){return function(_0x30ab2c){if(_0x30ab2c){return _0x30ab2c['destroy']()[_0xb6ea('0x22')](function(){_0x474f5e[_0xb6ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33dd96,_0x498463){return function(_0x394c11){if(!_0x394c11){_0x33dd96['sendStatus'](0x194);}return _0x394c11;};}function handleError(_0x4dcd2d,_0x2f5dd1){_0x2f5dd1=_0x2f5dd1||0x1f4;return function(_0x2bed12){logger[_0xb6ea('0x23')](_0x2bed12['stack']);if(_0x2bed12[_0xb6ea('0x24')]){delete _0x2bed12[_0xb6ea('0x24')];}_0x4dcd2d['status'](_0x2f5dd1)['send'](_0x2bed12);};}exports[_0xb6ea('0x25')]=function(_0x2b25ce,_0x33e180){var _0x5c9415={},_0x1290fa={},_0x47e818={'count':0x0,'rows':[]};var _0x59fca3=_[_0xb6ea('0x26')](db[_0xb6ea('0x27')][_0xb6ea('0x28')],function(_0x13e961){return{'name':_0x13e961[_0xb6ea('0x29')],'type':_0x13e961[_0xb6ea('0x2a')][_0xb6ea('0x2b')]};});_0x1290fa['model']=_['map'](_0x59fca3,_0xb6ea('0x24'));_0x1290fa[_0xb6ea('0x2c')]=_[_0xb6ea('0x2d')](_0x2b25ce[_0xb6ea('0x2c')]);_0x1290fa[_0xb6ea('0x2e')]=_[_0xb6ea('0x2f')](_0x1290fa['model'],_0x1290fa[_0xb6ea('0x2c')]);_0x5c9415[_0xb6ea('0x30')]=_[_0xb6ea('0x2f')](_0x1290fa[_0xb6ea('0x31')],qs[_0xb6ea('0x32')](_0x2b25ce['query'][_0xb6ea('0x32')]));_0x5c9415[_0xb6ea('0x30')]=_0x5c9415[_0xb6ea('0x30')][_0xb6ea('0x33')]?_0x5c9415['attributes']:_0x1290fa[_0xb6ea('0x31')];if(!_0x2b25ce[_0xb6ea('0x2c')][_0xb6ea('0x34')](_0xb6ea('0x35'))){_0x5c9415[_0xb6ea('0x36')]=qs[_0xb6ea('0x36')](_0x2b25ce[_0xb6ea('0x2c')][_0xb6ea('0x36')]);_0x5c9415[_0xb6ea('0x1c')]=qs[_0xb6ea('0x1c')](_0x2b25ce['query'][_0xb6ea('0x1c')]);}_0x5c9415[_0xb6ea('0x37')]=qs[_0xb6ea('0x38')](_0x2b25ce[_0xb6ea('0x2c')][_0xb6ea('0x38')]);_0x5c9415[_0xb6ea('0x39')]=qs['filters'](_[_0xb6ea('0x3a')](_0x2b25ce['query'],_0x1290fa[_0xb6ea('0x2e')]),_0x59fca3);if(_0x2b25ce['query']['filter']){_0x5c9415[_0xb6ea('0x39')]=_[_0xb6ea('0x3b')](_0x5c9415[_0xb6ea('0x39')],{'$or':_[_0xb6ea('0x26')](_0x59fca3,function(_0x4715e8){if(_0x4715e8[_0xb6ea('0x2a')]!==_0xb6ea('0x3c')){var _0x53d65a={};_0x53d65a[_0x4715e8[_0xb6ea('0x24')]]={'$like':'%'+_0x2b25ce['query'][_0xb6ea('0x3d')]+'%'};return _0x53d65a;}})});}_0x5c9415=_[_0xb6ea('0x3b')]({},_0x5c9415,_0x2b25ce[_0xb6ea('0x3e')]);var _0x24c587={'where':_0x5c9415['where']};return db['AnalyticTreeReport'][_0xb6ea('0x1b')](_0x24c587)[_0xb6ea('0x22')](function(_0xe1d12d){_0x47e818[_0xb6ea('0x1b')]=_0xe1d12d;if(_0x2b25ce[_0xb6ea('0x2c')][_0xb6ea('0x3f')]){_0x5c9415[_0xb6ea('0x40')]=[{'all':!![]}];}return db[_0xb6ea('0x27')]['findAll'](_0x5c9415);})['then'](function(_0x4ef95d){_0x47e818['rows']=_0x4ef95d;return _0x47e818;})['then'](respondWithFilteredResult(_0x33e180,_0x5c9415))[_0xb6ea('0x41')](handleError(_0x33e180,null));};exports[_0xb6ea('0x42')]=function(_0x48db9f,_0x4f3e89){var _0x3f774d={'raw':!![],'where':{'id':_0x48db9f[_0xb6ea('0x43')]['id']}},_0x3091f2={};_0x3091f2[_0xb6ea('0x31')]=_[_0xb6ea('0x2d')](db[_0xb6ea('0x27')][_0xb6ea('0x28')]);_0x3091f2[_0xb6ea('0x2c')]=_['keys'](_0x48db9f['query']);_0x3091f2[_0xb6ea('0x2e')]=_[_0xb6ea('0x2f')](_0x3091f2[_0xb6ea('0x31')],_0x3091f2['query']);_0x3f774d[_0xb6ea('0x30')]=_[_0xb6ea('0x2f')](_0x3091f2['model'],qs[_0xb6ea('0x32')](_0x48db9f[_0xb6ea('0x2c')]['fields']));_0x3f774d[_0xb6ea('0x30')]=_0x3f774d[_0xb6ea('0x30')][_0xb6ea('0x33')]?_0x3f774d[_0xb6ea('0x30')]:_0x3091f2[_0xb6ea('0x31')];if(_0x48db9f[_0xb6ea('0x2c')][_0xb6ea('0x3f')]){_0x3f774d[_0xb6ea('0x40')]=[{'all':!![]}];}_0x3f774d=_[_0xb6ea('0x3b')]({},_0x3f774d,_0x48db9f['options']);return db[_0xb6ea('0x27')][_0xb6ea('0x44')](_0x3f774d)[_0xb6ea('0x22')](handleEntityNotFound(_0x4f3e89,null))['then'](respondWithResult(_0x4f3e89,null))[_0xb6ea('0x41')](handleError(_0x4f3e89,null));};exports[_0xb6ea('0x45')]=function(_0x5f0dd9,_0x1c8432){return db['AnalyticTreeReport'][_0xb6ea('0x45')](_0x5f0dd9[_0xb6ea('0x46')],{})[_0xb6ea('0x22')](respondWithResult(_0x1c8432,0xc9))[_0xb6ea('0x41')](handleError(_0x1c8432,null));};exports['update']=function(_0x2234d2,_0x45bf30){if(_0x2234d2[_0xb6ea('0x46')]['id']){delete _0x2234d2[_0xb6ea('0x46')]['id'];}return db[_0xb6ea('0x27')][_0xb6ea('0x44')]({'where':{'id':_0x2234d2[_0xb6ea('0x43')]['id']}})[_0xb6ea('0x22')](handleEntityNotFound(_0x45bf30,null))[_0xb6ea('0x22')](saveUpdates(_0x2234d2[_0xb6ea('0x46')],null))[_0xb6ea('0x22')](respondWithResult(_0x45bf30,null))['catch'](handleError(_0x45bf30,null));};exports[_0xb6ea('0x47')]=function(_0x4f1e89,_0x49e625){return db[_0xb6ea('0x27')][_0xb6ea('0x44')]({'where':{'id':_0x4f1e89['params']['id']}})['then'](handleEntityNotFound(_0x49e625,null))[_0xb6ea('0x22')](removeEntity(_0x49e625,null))[_0xb6ea('0x41')](handleError(_0x49e625,null));}; \ No newline at end of file +var _0x20d5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x498c71,_0x36155d){var _0x5cf10e=function(_0x23b726){while(--_0x23b726){_0x498c71['push'](_0x498c71['shift']());}};_0x5cf10e(++_0x36155d);}(_0x20d5,0x82));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x520d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x520d('0x1'));var zipdir=require(_0x520d('0x2'));var jsonpatch=require(_0x520d('0x3'));var rp=require(_0x520d('0x4'));var moment=require(_0x520d('0x5'));var BPromise=require(_0x520d('0x6'));var Mustache=require(_0x520d('0x7'));var util=require(_0x520d('0x8'));var path=require(_0x520d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x520d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x520d('0xb'));var deskjs=require(_0x520d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x520d('0xd'));var Redis=require('ioredis');var authService=require(_0x520d('0xe'));var qs=require(_0x520d('0xf'));var as=require(_0x520d('0x10'));var hardwareService=require(_0x520d('0x11'));var logger=require(_0x520d('0x12'))(_0x520d('0x13'));var utils=require(_0x520d('0x14'));var config=require(_0x520d('0x15'));var db=require(_0x520d('0x16'))['db'];function respondWithStatusCode(_0x142945,_0x2ae180){_0x2ae180=_0x2ae180||0xcc;return function(_0x575bc6){if(_0x575bc6){return _0x142945[_0x520d('0x17')](_0x2ae180);}return _0x142945[_0x520d('0x18')](_0x2ae180)[_0x520d('0x19')]();};}function respondWithResult(_0x42154e,_0x2059ea){_0x2059ea=_0x2059ea||0xc8;return function(_0xecd408){if(_0xecd408){return _0x42154e['status'](_0x2059ea)[_0x520d('0x1a')](_0xecd408);}};}function respondWithFilteredResult(_0x40bd9b,_0xef3a47){return function(_0x53fe23){if(_0x53fe23){var _0x3a67c9=_0x53fe23['count'],_0x57486e=_0xef3a47['offset'],_0x16ab90=_0xef3a47[_0x520d('0x1b')]+_0xef3a47[_0x520d('0x1c')],_0x462b17;if(_0x16ab90>=_0x3a67c9){_0x16ab90=_0x3a67c9;_0x462b17=0xc8;}else{_0x462b17=0xce;}_0x40bd9b[_0x520d('0x18')](_0x462b17);return _0x40bd9b['set'](_0x520d('0x1d'),_0x57486e+'-'+_0x16ab90+'/'+_0x3a67c9)[_0x520d('0x1a')](_0x53fe23);}return null;};}function patchUpdates(_0xc1293a){return function(_0x44cac1){try{jsonpatch['apply'](_0x44cac1,_0xc1293a,!![]);}catch(_0x300688){return BPromise[_0x520d('0x1e')](_0x300688);}return _0x44cac1[_0x520d('0x1f')]();};}function saveUpdates(_0x3e94ea,_0x55e2ab){return function(_0x18372c){if(_0x18372c){return _0x18372c[_0x520d('0x20')](_0x3e94ea)['then'](function(_0x57715b){return _0x57715b;});}return null;};}function removeEntity(_0x5f378f,_0x273d0f){return function(_0x494f6f){if(_0x494f6f){return _0x494f6f[_0x520d('0x21')]()[_0x520d('0x22')](function(){_0x5f378f[_0x520d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379e41,_0x5c6605){return function(_0x54f691){if(!_0x54f691){_0x379e41['sendStatus'](0x194);}return _0x54f691;};}function handleError(_0x39498b,_0x977a68){_0x977a68=_0x977a68||0x1f4;return function(_0x119e62){logger[_0x520d('0x23')](_0x119e62[_0x520d('0x24')]);if(_0x119e62[_0x520d('0x25')]){delete _0x119e62[_0x520d('0x25')];}_0x39498b[_0x520d('0x18')](_0x977a68)[_0x520d('0x26')](_0x119e62);};}exports[_0x520d('0x27')]=function(_0x1d0216,_0x4af780){var _0x35efc5={},_0x4c1cee={},_0x528db2={'count':0x0,'rows':[]};var _0x98ce29=_[_0x520d('0x28')](db[_0x520d('0x29')][_0x520d('0x2a')],function(_0x5ece03){return{'name':_0x5ece03[_0x520d('0x2b')],'type':_0x5ece03['type'][_0x520d('0x2c')]};});_0x4c1cee[_0x520d('0x2d')]=_[_0x520d('0x28')](_0x98ce29,'name');_0x4c1cee[_0x520d('0x2e')]=_[_0x520d('0x2f')](_0x1d0216[_0x520d('0x2e')]);_0x4c1cee[_0x520d('0x30')]=_[_0x520d('0x31')](_0x4c1cee[_0x520d('0x2d')],_0x4c1cee[_0x520d('0x2e')]);_0x35efc5[_0x520d('0x32')]=_[_0x520d('0x31')](_0x4c1cee['model'],qs[_0x520d('0x33')](_0x1d0216['query']['fields']));_0x35efc5[_0x520d('0x32')]=_0x35efc5['attributes'][_0x520d('0x34')]?_0x35efc5[_0x520d('0x32')]:_0x4c1cee['model'];if(!_0x1d0216[_0x520d('0x2e')][_0x520d('0x35')](_0x520d('0x36'))){_0x35efc5[_0x520d('0x1c')]=qs[_0x520d('0x1c')](_0x1d0216['query'][_0x520d('0x1c')]);_0x35efc5[_0x520d('0x1b')]=qs[_0x520d('0x1b')](_0x1d0216[_0x520d('0x2e')][_0x520d('0x1b')]);}_0x35efc5['order']=qs['sort'](_0x1d0216[_0x520d('0x2e')][_0x520d('0x37')]);_0x35efc5[_0x520d('0x38')]=qs[_0x520d('0x30')](_[_0x520d('0x39')](_0x1d0216[_0x520d('0x2e')],_0x4c1cee['filters']),_0x98ce29);if(_0x1d0216[_0x520d('0x2e')][_0x520d('0x3a')]){_0x35efc5[_0x520d('0x38')]=_[_0x520d('0x3b')](_0x35efc5['where'],{'$or':_['map'](_0x98ce29,function(_0x2acbfc){if(_0x2acbfc[_0x520d('0x3c')]!==_0x520d('0x3d')){var _0x5dab74={};_0x5dab74[_0x2acbfc[_0x520d('0x25')]]={'$like':'%'+_0x1d0216[_0x520d('0x2e')]['filter']+'%'};return _0x5dab74;}})});}_0x35efc5=_[_0x520d('0x3b')]({},_0x35efc5,_0x1d0216[_0x520d('0x3e')]);var _0x2c2c1e={'where':_0x35efc5[_0x520d('0x38')]};return db[_0x520d('0x29')][_0x520d('0x3f')](_0x2c2c1e)['then'](function(_0x284326){_0x528db2[_0x520d('0x3f')]=_0x284326;if(_0x1d0216['query'][_0x520d('0x40')]){_0x35efc5['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x520d('0x41')](_0x35efc5);})[_0x520d('0x22')](function(_0x242f3f){_0x528db2[_0x520d('0x42')]=_0x242f3f;return _0x528db2;})['then'](respondWithFilteredResult(_0x4af780,_0x35efc5))[_0x520d('0x43')](handleError(_0x4af780,null));};exports['show']=function(_0x51d479,_0x100517){var _0x335839={'raw':!![],'where':{'id':_0x51d479['params']['id']}},_0x6fcd2f={};_0x6fcd2f[_0x520d('0x2d')]=_[_0x520d('0x2f')](db['AnalyticTreeReport'][_0x520d('0x2a')]);_0x6fcd2f[_0x520d('0x2e')]=_[_0x520d('0x2f')](_0x51d479['query']);_0x6fcd2f[_0x520d('0x30')]=_['intersection'](_0x6fcd2f[_0x520d('0x2d')],_0x6fcd2f[_0x520d('0x2e')]);_0x335839[_0x520d('0x32')]=_[_0x520d('0x31')](_0x6fcd2f[_0x520d('0x2d')],qs[_0x520d('0x33')](_0x51d479[_0x520d('0x2e')][_0x520d('0x33')]));_0x335839[_0x520d('0x32')]=_0x335839[_0x520d('0x32')][_0x520d('0x34')]?_0x335839['attributes']:_0x6fcd2f[_0x520d('0x2d')];if(_0x51d479[_0x520d('0x2e')][_0x520d('0x40')]){_0x335839[_0x520d('0x44')]=[{'all':!![]}];}_0x335839=_['merge']({},_0x335839,_0x51d479[_0x520d('0x3e')]);return db[_0x520d('0x29')][_0x520d('0x45')](_0x335839)[_0x520d('0x22')](handleEntityNotFound(_0x100517,null))[_0x520d('0x22')](respondWithResult(_0x100517,null))[_0x520d('0x43')](handleError(_0x100517,null));};exports[_0x520d('0x46')]=function(_0x23def8,_0x592786){return db['AnalyticTreeReport'][_0x520d('0x46')](_0x23def8[_0x520d('0x47')],{})[_0x520d('0x22')](respondWithResult(_0x592786,0xc9))[_0x520d('0x43')](handleError(_0x592786,null));};exports[_0x520d('0x20')]=function(_0x3612a2,_0x12b0a0){if(_0x3612a2[_0x520d('0x47')]['id']){delete _0x3612a2[_0x520d('0x47')]['id'];}return db[_0x520d('0x29')][_0x520d('0x45')]({'where':{'id':_0x3612a2[_0x520d('0x48')]['id']}})[_0x520d('0x22')](handleEntityNotFound(_0x12b0a0,null))['then'](saveUpdates(_0x3612a2[_0x520d('0x47')],null))[_0x520d('0x22')](respondWithResult(_0x12b0a0,null))[_0x520d('0x43')](handleError(_0x12b0a0,null));};exports[_0x520d('0x21')]=function(_0xdd7019,_0x511649){return db[_0x520d('0x29')][_0x520d('0x45')]({'where':{'id':_0xdd7019[_0x520d('0x48')]['id']}})['then'](handleEntityNotFound(_0x511649,null))['then'](removeEntity(_0x511649,null))[_0x520d('0x43')](handleError(_0x511649,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index b7a599c..e47759b 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 _0xe45c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe45c,0x178));var _0xce45=function(_0x204a29,_0x1de6cb){_0x204a29=_0x204a29-0x0;var _0x3a1bf2=_0xe45c[_0x204a29];return _0x3a1bf2;};'use strict';var _=require(_0xce45('0x0'));var util=require(_0xce45('0x1'));var logger=require(_0xce45('0x2'))(_0xce45('0x3'));var moment=require(_0xce45('0x4'));var BPromise=require(_0xce45('0x5'));var rp=require(_0xce45('0x6'));var fs=require('fs');var path=require(_0xce45('0x7'));var rimraf=require('rimraf');var config=require(_0xce45('0x8'));var attributes=require(_0xce45('0x9'));module[_0xce45('0xa')]=function(_0x4ecd9d,_0x98fff){return _0x4ecd9d[_0xce45('0xb')](_0xce45('0xc'),attributes,{'tableName':_0xce45('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3f9=['./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d6161,_0x186a59){var _0x563990=function(_0xa3b9f7){while(--_0xa3b9f7){_0x4d6161['push'](_0x4d6161['shift']());}};_0x563990(++_0x186a59);}(_0xb3f9,0x18f));var _0x9b3f=function(_0x44c67e,_0x39d944){_0x44c67e=_0x44c67e-0x0;var _0x28bf78=_0xb3f9[_0x44c67e];return _0x28bf78;};'use strict';var _=require(_0x9b3f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9b3f('0x1'));var BPromise=require(_0x9b3f('0x2'));var rp=require(_0x9b3f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b3f('0x4'));var config=require(_0x9b3f('0x5'));var attributes=require(_0x9b3f('0x6'));module[_0x9b3f('0x7')]=function(_0x3a8672,_0x4a9311){return _0x3a8672['define']('AnalyticTreeReport',attributes,{'tableName':_0x9b3f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 334f434..402e003 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 _0x32ab=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','info','result'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x32ab,0x177));var _0xb32a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x32ab[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb32a('0x0'));var util=require(_0xb32a('0x1'));var moment=require(_0xb32a('0x2'));var BPromise=require(_0xb32a('0x3'));var rs=require(_0xb32a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb32a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb32a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb32a('0x7'));var client=jayson[_0xb32a('0x8')][_0xb32a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3413a1,_0x5c54e5,_0x6140c7){return new BPromise(function(_0x550b62,_0x5d4854){return client[_0xb32a('0xa')](_0x3413a1,_0x6140c7)[_0xb32a('0xb')](function(_0x111e14){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x5c54e5,_0xb32a('0xc'));logger[_0xb32a('0xd')](_0xb32a('0xe'),_0x5c54e5,_0xb32a('0xc'),JSON['stringify'](_0x111e14));if(_0x111e14[_0xb32a('0xf')]){if(_0x111e14[_0xb32a('0xf')][_0xb32a('0x10')]===0x1f4){logger[_0xb32a('0xf')](_0xb32a('0x11'),_0x5c54e5,_0x111e14[_0xb32a('0xf')][_0xb32a('0x12')]);return _0x5d4854(_0x111e14[_0xb32a('0xf')][_0xb32a('0x12')]);}logger[_0xb32a('0xf')](_0xb32a('0x11'),_0x5c54e5,_0x111e14['error'][_0xb32a('0x12')]);return _0x550b62(_0x111e14[_0xb32a('0xf')]['message']);}else{logger[_0xb32a('0x13')](_0xb32a('0x11'),_0x5c54e5,_0xb32a('0xc'));_0x550b62(_0x111e14[_0xb32a('0x14')]['message']);}})[_0xb32a('0x15')](function(_0x5e586e){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x5c54e5,_0x5e586e);_0x5d4854(_0x5e586e);});});} \ No newline at end of file +var _0xa5a0=['AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x2b5317,_0x324578){var _0xe40ec2=function(_0x20b506){while(--_0x20b506){_0x2b5317['push'](_0x2b5317['shift']());}};_0xe40ec2(++_0x324578);}(_0xa5a0,0xff));var _0x0a5a=function(_0x4cc8f0,_0xa5073c){_0x4cc8f0=_0x4cc8f0-0x0;var _0x3b91b1=_0xa5a0[_0x4cc8f0];return _0x3b91b1;};'use strict';var _=require(_0x0a5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a5a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a5a('0x2'));var logger=require(_0x0a5a('0x3'))('rpc');var config=require(_0x0a5a('0x4'));var jayson=require(_0x0a5a('0x5'));var client=jayson[_0x0a5a('0x6')][_0x0a5a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27c2ac,_0x4fa27d,_0x1bfddf){return new BPromise(function(_0x143dae,_0x545250){return client[_0x0a5a('0x8')](_0x27c2ac,_0x1bfddf)['then'](function(_0x2ceac0){logger[_0x0a5a('0x9')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4fa27d,'request\x20sent');logger[_0x0a5a('0xa')](_0x0a5a('0xb'),_0x4fa27d,'request\x20sent',JSON[_0x0a5a('0xc')](_0x2ceac0));if(_0x2ceac0[_0x0a5a('0xd')]){if(_0x2ceac0[_0x0a5a('0xd')][_0x0a5a('0xe')]===0x1f4){logger[_0x0a5a('0xd')](_0x0a5a('0xf'),_0x4fa27d,_0x2ceac0[_0x0a5a('0xd')][_0x0a5a('0x10')]);return _0x545250(_0x2ceac0['error'][_0x0a5a('0x10')]);}logger[_0x0a5a('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4fa27d,_0x2ceac0[_0x0a5a('0xd')][_0x0a5a('0x10')]);return _0x143dae(_0x2ceac0[_0x0a5a('0xd')]['message']);}else{logger[_0x0a5a('0x9')](_0x0a5a('0xf'),_0x4fa27d,'request\x20sent');_0x143dae(_0x2ceac0[_0x0a5a('0x11')]['message']);}})[_0x0a5a('0x12')](function(_0x1cbf40){logger[_0x0a5a('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4fa27d,_0x1cbf40);_0x545250(_0x1cbf40);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5d6dc18..cf10b82 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 _0x9157=['/:id','isAuthenticated','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','get','index'];(function(_0x12662e,_0x1cd206){var _0x150891=function(_0x310d6f){while(--_0x310d6f){_0x12662e['push'](_0x12662e['shift']());}};_0x150891(++_0x1cd206);}(_0x9157,0xa0));var _0x7915=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x9157[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x7915('0x0'));var util=require(_0x7915('0x1'));var path=require(_0x7915('0x2'));var timeout=require(_0x7915('0x3'));var express=require(_0x7915('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7915('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x7915('0x6')]('/',auth['isAuthenticated'](),controller[_0x7915('0x7')]);router[_0x7915('0x6')](_0x7915('0x8'),auth[_0x7915('0x9')](),controller['show']);router[_0x7915('0xa')]('/',auth[_0x7915('0x9')](),controller[_0x7915('0xb')]);router['put'](_0x7915('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7915('0xc')]('/:id',auth[_0x7915('0x9')](),controller['destroy']);module[_0x7915('0xd')]=router; \ No newline at end of file +var _0xd6f1=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd6f1,0xef));var _0x1d6f=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xd6f1[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x1d6f('0x0'));var util=require(_0x1d6f('0x1'));var path=require(_0x1d6f('0x2'));var timeout=require(_0x1d6f('0x3'));var express=require(_0x1d6f('0x4'));var router=express['Router']();var auth=require(_0x1d6f('0x5'));var interaction=require(_0x1d6f('0x6'));var config=require(_0x1d6f('0x7'));var controller=require(_0x1d6f('0x8'));router[_0x1d6f('0x9')]('/',auth[_0x1d6f('0xa')](),controller[_0x1d6f('0xb')]);router[_0x1d6f('0x9')]('/:id',auth[_0x1d6f('0xa')](),controller['show']);router[_0x1d6f('0xc')]('/',auth[_0x1d6f('0xa')](),controller['create']);router[_0x1d6f('0xd')](_0x1d6f('0xe'),auth[_0x1d6f('0xa')](),controller[_0x1d6f('0xf')]);router[_0x1d6f('0x10')](_0x1d6f('0xe'),auth[_0x1d6f('0xa')](),controller[_0x1d6f('0x11')]);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 41c26c4..2ac781b 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 _0x2cd4=['sequelize','exports','STRING'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x2cd4,0x180));var _0x42cd=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x2cd4[_0x2cc569];return _0x1bfc2e;};'use strict';var Sequelize=require(_0x42cd('0x0'));module[_0x42cd('0x1')]={'name':{'type':Sequelize[_0x42cd('0x2')]},'basename':{'type':Sequelize[_0x42cd('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaba=['exports','STRING'];(function(_0x5907fb,_0x4ffd36){var _0x54e27c=function(_0x16a808){while(--_0x16a808){_0x5907fb['push'](_0x5907fb['shift']());}};_0x54e27c(++_0x4ffd36);}(_0xbaba,0x116));var _0xabab=function(_0x1e56aa,_0x4fd0df){_0x1e56aa=_0x1e56aa-0x0;var _0x18e4bd=_0xbaba[_0x1e56aa];return _0x18e4bd;};'use strict';var Sequelize=require('sequelize');module[_0xabab('0x0')]={'name':{'type':Sequelize[_0xabab('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xabab('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ee794c6..e822816 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 _0x66c4=['stack','name','send','index','map','Attachment','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','where','filter','merge','options','count','include','findAll','rows','params','includeAll','catch','find','get','createdAt','updatedAt','body','omit','create','filename','mimetype','download','findOne','join','server/files/attachments/','basename','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','Content-Range','reject','save','update','then','destroy','error'];(function(_0x27ebe8,_0x21dd01){var _0x431778=function(_0xcf97c6){while(--_0xcf97c6){_0x27ebe8['push'](_0x27ebe8['shift']());}};_0x431778(++_0x21dd01);}(_0x66c4,0x1b2));var _0x466c=function(_0xa86c12,_0x581c3e){_0xa86c12=_0xa86c12-0x0;var _0x371379=_0x66c4[_0xa86c12];return _0x371379;};'use strict';var pdf=require(_0x466c('0x0'));var emlformat=require(_0x466c('0x1'));var rimraf=require(_0x466c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x466c('0x3'));var moment=require('moment');var BPromise=require(_0x466c('0x4'));var Mustache=require('mustache');var util=require(_0x466c('0x5'));var path=require(_0x466c('0x6'));var sox=require(_0x466c('0x7'));var csv=require('to-csv');var ejs=require(_0x466c('0x8'));var fs=require('fs');var _=require(_0x466c('0x9'));var squel=require(_0x466c('0xa'));var crypto=require('crypto');var jsforce=require(_0x466c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x466c('0xc'));var querystring=require('querystring');var Papa=require(_0x466c('0xd'));var Redis=require(_0x466c('0xe'));var authService=require(_0x466c('0xf'));var qs=require(_0x466c('0x10'));var as=require(_0x466c('0x11'));var hardwareService=require(_0x466c('0x12'));var logger=require('../../config/logger')(_0x466c('0x13'));var utils=require(_0x466c('0x14'));var config=require(_0x466c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c0f4,_0x23b4dd){_0x23b4dd=_0x23b4dd||0xcc;return function(_0xb63ca4){if(_0xb63ca4){return _0x49c0f4[_0x466c('0x16')](_0x23b4dd);}return _0x49c0f4['status'](_0x23b4dd)[_0x466c('0x17')]();};}function respondWithResult(_0x170d57,_0x49a7e6){_0x49a7e6=_0x49a7e6||0xc8;return function(_0x20d3bd){if(_0x20d3bd){return _0x170d57[_0x466c('0x18')](_0x49a7e6)[_0x466c('0x19')](_0x20d3bd);}};}function respondWithFilteredResult(_0x53eddc,_0x13502){return function(_0x6a33f5){if(_0x6a33f5){var _0x699313=_0x6a33f5['count'],_0x4543d6=_0x13502[_0x466c('0x1a')],_0x2f7b1f=_0x13502[_0x466c('0x1a')]+_0x13502['limit'],_0x23e984;if(_0x2f7b1f>=_0x699313){_0x2f7b1f=_0x699313;_0x23e984=0xc8;}else{_0x23e984=0xce;}_0x53eddc[_0x466c('0x18')](_0x23e984);return _0x53eddc['set'](_0x466c('0x1b'),_0x4543d6+'-'+_0x2f7b1f+'/'+_0x699313)[_0x466c('0x19')](_0x6a33f5);}return null;};}function patchUpdates(_0x471959){return function(_0x482ae7){try{jsonpatch['apply'](_0x482ae7,_0x471959,!![]);}catch(_0x2d89ac){return BPromise[_0x466c('0x1c')](_0x2d89ac);}return _0x482ae7[_0x466c('0x1d')]();};}function saveUpdates(_0x8a389f,_0x15fe13){return function(_0x4fc2e8){if(_0x4fc2e8){return _0x4fc2e8[_0x466c('0x1e')](_0x8a389f)[_0x466c('0x1f')](function(_0x2786b7){return _0x2786b7;});}return null;};}function removeEntity(_0x5b509a,_0x3d65d3){return function(_0x2199dd){if(_0x2199dd){return _0x2199dd[_0x466c('0x20')]()[_0x466c('0x1f')](function(){_0x5b509a[_0x466c('0x18')](0xcc)[_0x466c('0x17')]();});}};}function handleEntityNotFound(_0xa8f686,_0x386411){return function(_0x1026ce){if(!_0x1026ce){_0xa8f686[_0x466c('0x16')](0x194);}return _0x1026ce;};}function handleError(_0x7ff2a0,_0x1844b3){_0x1844b3=_0x1844b3||0x1f4;return function(_0x4df3ac){logger[_0x466c('0x21')](_0x4df3ac[_0x466c('0x22')]);if(_0x4df3ac[_0x466c('0x23')]){delete _0x4df3ac[_0x466c('0x23')];}_0x7ff2a0[_0x466c('0x18')](_0x1844b3)[_0x466c('0x24')](_0x4df3ac);};}exports[_0x466c('0x25')]=function(_0x4315c2,_0x2943d9){var _0x6d35dc={},_0x3ae3b7={},_0x5f31b1={'count':0x0,'rows':[]};var _0x11d68c=_[_0x466c('0x26')](db[_0x466c('0x27')][_0x466c('0x28')],function(_0x5f60a3){return{'name':_0x5f60a3['fieldName'],'type':_0x5f60a3[_0x466c('0x29')]['key']};});_0x3ae3b7[_0x466c('0x2a')]=_[_0x466c('0x26')](_0x11d68c,_0x466c('0x23'));_0x3ae3b7[_0x466c('0x2b')]=_[_0x466c('0x2c')](_0x4315c2[_0x466c('0x2b')]);_0x3ae3b7[_0x466c('0x2d')]=_[_0x466c('0x2e')](_0x3ae3b7[_0x466c('0x2a')],_0x3ae3b7[_0x466c('0x2b')]);_0x6d35dc['attributes']=_[_0x466c('0x2e')](_0x3ae3b7['model'],qs[_0x466c('0x2f')](_0x4315c2[_0x466c('0x2b')][_0x466c('0x2f')]));_0x6d35dc[_0x466c('0x30')]=_0x6d35dc['attributes'][_0x466c('0x31')]?_0x6d35dc[_0x466c('0x30')]:_0x3ae3b7[_0x466c('0x2a')];if(!_0x4315c2[_0x466c('0x2b')][_0x466c('0x32')]('nolimit')){_0x6d35dc[_0x466c('0x33')]=qs[_0x466c('0x33')](_0x4315c2[_0x466c('0x2b')]['limit']);_0x6d35dc[_0x466c('0x1a')]=qs[_0x466c('0x1a')](_0x4315c2[_0x466c('0x2b')][_0x466c('0x1a')]);}_0x6d35dc[_0x466c('0x34')]=qs['sort'](_0x4315c2['query']['sort']);_0x6d35dc[_0x466c('0x35')]=qs['filters'](_['pick'](_0x4315c2[_0x466c('0x2b')],_0x3ae3b7[_0x466c('0x2d')]),_0x11d68c);if(_0x4315c2[_0x466c('0x2b')][_0x466c('0x36')]){_0x6d35dc[_0x466c('0x35')]=_[_0x466c('0x37')](_0x6d35dc[_0x466c('0x35')],{'$or':_[_0x466c('0x26')](_0x11d68c,function(_0x56f171){if(_0x56f171[_0x466c('0x29')]!=='VIRTUAL'){var _0x3f0329={};_0x3f0329[_0x56f171[_0x466c('0x23')]]={'$like':'%'+_0x4315c2[_0x466c('0x2b')][_0x466c('0x36')]+'%'};return _0x3f0329;}})});}_0x6d35dc=_[_0x466c('0x37')]({},_0x6d35dc,_0x4315c2[_0x466c('0x38')]);var _0x24f28b={'where':_0x6d35dc[_0x466c('0x35')]};return db[_0x466c('0x27')][_0x466c('0x39')](_0x24f28b)['then'](function(_0x1096bf){_0x5f31b1[_0x466c('0x39')]=_0x1096bf;if(_0x4315c2[_0x466c('0x2b')]['includeAll']){_0x6d35dc[_0x466c('0x3a')]=[{'all':!![]}];}return db[_0x466c('0x27')][_0x466c('0x3b')](_0x6d35dc);})[_0x466c('0x1f')](function(_0xbca211){_0x5f31b1[_0x466c('0x3c')]=_0xbca211;return _0x5f31b1;})[_0x466c('0x1f')](respondWithFilteredResult(_0x2943d9,_0x6d35dc))['catch'](handleError(_0x2943d9,null));};exports['show']=function(_0x123717,_0x358b95){var _0x504a5b={'raw':!![],'where':{'id':_0x123717[_0x466c('0x3d')]['id']}},_0x4c592c={};_0x4c592c[_0x466c('0x2a')]=_['keys'](db[_0x466c('0x27')]['rawAttributes']);_0x4c592c['query']=_[_0x466c('0x2c')](_0x123717['query']);_0x4c592c[_0x466c('0x2d')]=_[_0x466c('0x2e')](_0x4c592c[_0x466c('0x2a')],_0x4c592c[_0x466c('0x2b')]);_0x504a5b[_0x466c('0x30')]=_[_0x466c('0x2e')](_0x4c592c[_0x466c('0x2a')],qs[_0x466c('0x2f')](_0x123717[_0x466c('0x2b')][_0x466c('0x2f')]));_0x504a5b[_0x466c('0x30')]=_0x504a5b[_0x466c('0x30')][_0x466c('0x31')]?_0x504a5b[_0x466c('0x30')]:_0x4c592c[_0x466c('0x2a')];if(_0x123717[_0x466c('0x2b')][_0x466c('0x3e')]){_0x504a5b[_0x466c('0x3a')]=[{'all':!![]}];}_0x504a5b=_['merge']({},_0x504a5b,_0x123717['options']);return db[_0x466c('0x27')]['find'](_0x504a5b)[_0x466c('0x1f')](handleEntityNotFound(_0x358b95,null))[_0x466c('0x1f')](respondWithResult(_0x358b95,null))[_0x466c('0x3f')](handleError(_0x358b95,null));};exports['clone']=function(_0x39cb9d,_0x35d04e){var _0x94ab4={'where':{'id':_0x39cb9d[_0x466c('0x3d')]['id']}},_0x225bbc={};_0x225bbc[_0x466c('0x2a')]=_[_0x466c('0x2c')](db['Attachment'][_0x466c('0x28')]);_0x94ab4[_0x466c('0x30')]=_[_0x466c('0x2e')](_0x225bbc[_0x466c('0x2a')],qs[_0x466c('0x2f')](_0x39cb9d[_0x466c('0x2b')]['fields']));_0x94ab4[_0x466c('0x30')]=_0x94ab4['attributes']['length']?_0x94ab4[_0x466c('0x30')]:_0x225bbc[_0x466c('0x2a')];if(_0x39cb9d[_0x466c('0x2b')][_0x466c('0x3e')]){_0x94ab4[_0x466c('0x3a')]=[{'all':!![]}];}_0x94ab4=_[_0x466c('0x37')]({},_0x94ab4,_0x39cb9d[_0x466c('0x38')]);return db[_0x466c('0x27')][_0x466c('0x40')](_0x94ab4)['then'](handleEntityNotFound(_0x35d04e,null))[_0x466c('0x1f')](function(_0x4af5df){if(_0x4af5df){var _0x2f5451=_0x4af5df[_0x466c('0x41')]({'plain':!![]});_0x2f5451=qs['omit'](_0x2f5451,['id',_0x466c('0x42'),_0x466c('0x43')]);_0x39cb9d[_0x466c('0x44')]=_[_0x466c('0x45')](_0x39cb9d[_0x466c('0x44')],['id',_0x466c('0x42'),_0x466c('0x43')]);return db[_0x466c('0x27')]['create'](_[_0x466c('0x37')](_0x2f5451,_0x39cb9d[_0x466c('0x44')]),{'include':_0x39cb9d[_0x466c('0x2b')][_0x466c('0x3e')]?[{'all':!![]}]:undefined});}})[_0x466c('0x1f')](respondWithResult(_0x35d04e,0xc9))[_0x466c('0x3f')](handleError(_0x35d04e,null));};exports['update']=function(_0x5e411a,_0x1a5453){if(_0x5e411a[_0x466c('0x44')]['id']){delete _0x5e411a[_0x466c('0x44')]['id'];}return db[_0x466c('0x27')]['find']({'where':{'id':_0x5e411a[_0x466c('0x3d')]['id']}})[_0x466c('0x1f')](handleEntityNotFound(_0x1a5453,null))[_0x466c('0x1f')](saveUpdates(_0x5e411a['body'],null))['then'](respondWithResult(_0x1a5453,null))[_0x466c('0x3f')](handleError(_0x1a5453,null));};exports['destroy']=function(_0x14d829,_0x111ea6){return db[_0x466c('0x27')][_0x466c('0x40')]({'where':{'id':_0x14d829[_0x466c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x111ea6,null))[_0x466c('0x1f')](removeEntity(_0x111ea6,null))[_0x466c('0x3f')](handleError(_0x111ea6,null));};exports[_0x466c('0x46')]=function(_0x2adde8,_0x3bd076,_0x63b679){_0x2adde8[_0x466c('0x44')][_0x466c('0x23')]=_0x2adde8['file']['originalname'];_0x2adde8[_0x466c('0x44')]['basename']=_0x2adde8['file'][_0x466c('0x47')];_0x2adde8[_0x466c('0x44')][_0x466c('0x29')]=_0x2adde8['file'][_0x466c('0x48')];return db[_0x466c('0x27')][_0x466c('0x46')](_0x2adde8[_0x466c('0x44')])[_0x466c('0x1f')](respondWithResult(_0x3bd076,0xc9))[_0x466c('0x3f')](handleError(_0x3bd076,null));};exports[_0x466c('0x49')]=function(_0x3e6850,_0x1429d8,_0x143c39){return db[_0x466c('0x27')][_0x466c('0x4a')]({'where':{'id':_0x3e6850[_0x466c('0x3d')]['id']},'raw':!![]})[_0x466c('0x1f')](handleEntityNotFound(_0x1429d8,null))[_0x466c('0x1f')](function(_0x4a1cef){if(_0x4a1cef){return _0x1429d8[_0x466c('0x49')](path[_0x466c('0x4b')](config['root'],_0x466c('0x4c'),_0x4a1cef[_0x466c('0x4d')]));}})[_0x466c('0x3f')](handleError(_0x1429d8,null));}; \ No newline at end of file +var _0x654d=['show','params','keys','fields','find','clone','get','createdAt','body','omit','updatedAt','create','file','basename','filename','mimetype','download','findOne','join','root','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','Attachment','rows','catch'];(function(_0x3e274d,_0x35f95f){var _0x352bf9=function(_0x3e0e40){while(--_0x3e0e40){_0x3e274d['push'](_0x3e274d['shift']());}};_0x352bf9(++_0x35f95f);}(_0x654d,0xba));var _0xd654=function(_0xd36220,_0x528c48){_0xd36220=_0xd36220-0x0;var _0x1793ce=_0x654d[_0xd36220];return _0x1793ce;};'use strict';var pdf=require(_0xd654('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd654('0x1'));var jsonpatch=require(_0xd654('0x2'));var rp=require(_0xd654('0x3'));var moment=require(_0xd654('0x4'));var BPromise=require(_0xd654('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd654('0x6'));var sox=require(_0xd654('0x7'));var csv=require(_0xd654('0x8'));var ejs=require(_0xd654('0x9'));var fs=require('fs');var _=require(_0xd654('0xa'));var squel=require('squel');var crypto=require(_0xd654('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd654('0xc'));var Papa=require(_0xd654('0xd'));var Redis=require(_0xd654('0xe'));var authService=require(_0xd654('0xf'));var qs=require(_0xd654('0x10'));var as=require(_0xd654('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd654('0x12'))(_0xd654('0x13'));var utils=require(_0xd654('0x14'));var config=require(_0xd654('0x15'));var db=require(_0xd654('0x16'))['db'];function respondWithStatusCode(_0x165d8f,_0x219120){_0x219120=_0x219120||0xcc;return function(_0x583013){if(_0x583013){return _0x165d8f[_0xd654('0x17')](_0x219120);}return _0x165d8f[_0xd654('0x18')](_0x219120)[_0xd654('0x19')]();};}function respondWithResult(_0x9db66f,_0x3d67aa){_0x3d67aa=_0x3d67aa||0xc8;return function(_0x2cc2e1){if(_0x2cc2e1){return _0x9db66f[_0xd654('0x18')](_0x3d67aa)[_0xd654('0x1a')](_0x2cc2e1);}};}function respondWithFilteredResult(_0x2d0cb3,_0x35c40c){return function(_0x595c5c){if(_0x595c5c){var _0x49a096=_0x595c5c[_0xd654('0x1b')],_0x12b16a=_0x35c40c['offset'],_0x4122a5=_0x35c40c[_0xd654('0x1c')]+_0x35c40c[_0xd654('0x1d')],_0x156100;if(_0x4122a5>=_0x49a096){_0x4122a5=_0x49a096;_0x156100=0xc8;}else{_0x156100=0xce;}_0x2d0cb3[_0xd654('0x18')](_0x156100);return _0x2d0cb3['set'](_0xd654('0x1e'),_0x12b16a+'-'+_0x4122a5+'/'+_0x49a096)[_0xd654('0x1a')](_0x595c5c);}return null;};}function patchUpdates(_0x1e6a72){return function(_0x38b63f){try{jsonpatch[_0xd654('0x1f')](_0x38b63f,_0x1e6a72,!![]);}catch(_0x458256){return BPromise[_0xd654('0x20')](_0x458256);}return _0x38b63f['save']();};}function saveUpdates(_0x4adbe6,_0x59eb75){return function(_0x59ad26){if(_0x59ad26){return _0x59ad26[_0xd654('0x21')](_0x4adbe6)[_0xd654('0x22')](function(_0x5a8028){return _0x5a8028;});}return null;};}function removeEntity(_0x58ae88,_0x309265){return function(_0x43d227){if(_0x43d227){return _0x43d227['destroy']()[_0xd654('0x22')](function(){_0x58ae88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5559c5,_0x812acb){return function(_0x41d61f){if(!_0x41d61f){_0x5559c5['sendStatus'](0x194);}return _0x41d61f;};}function handleError(_0xdf820d,_0x4c92e0){_0x4c92e0=_0x4c92e0||0x1f4;return function(_0x247aa5){logger[_0xd654('0x23')](_0x247aa5[_0xd654('0x24')]);if(_0x247aa5[_0xd654('0x25')]){delete _0x247aa5[_0xd654('0x25')];}_0xdf820d[_0xd654('0x18')](_0x4c92e0)[_0xd654('0x26')](_0x247aa5);};}exports[_0xd654('0x27')]=function(_0x5deb77,_0x454122){var _0x449e4c={},_0x161c47={},_0x13712c={'count':0x0,'rows':[]};var _0xe5b592=_['map'](db['Attachment'][_0xd654('0x28')],function(_0x1989c2){return{'name':_0x1989c2[_0xd654('0x29')],'type':_0x1989c2['type'][_0xd654('0x2a')]};});_0x161c47[_0xd654('0x2b')]=_['map'](_0xe5b592,_0xd654('0x25'));_0x161c47[_0xd654('0x2c')]=_['keys'](_0x5deb77[_0xd654('0x2c')]);_0x161c47[_0xd654('0x2d')]=_['intersection'](_0x161c47[_0xd654('0x2b')],_0x161c47['query']);_0x449e4c[_0xd654('0x2e')]=_[_0xd654('0x2f')](_0x161c47[_0xd654('0x2b')],qs['fields'](_0x5deb77['query']['fields']));_0x449e4c[_0xd654('0x2e')]=_0x449e4c[_0xd654('0x2e')][_0xd654('0x30')]?_0x449e4c[_0xd654('0x2e')]:_0x161c47[_0xd654('0x2b')];if(!_0x5deb77[_0xd654('0x2c')][_0xd654('0x31')](_0xd654('0x32'))){_0x449e4c[_0xd654('0x1d')]=qs[_0xd654('0x1d')](_0x5deb77[_0xd654('0x2c')][_0xd654('0x1d')]);_0x449e4c[_0xd654('0x1c')]=qs['offset'](_0x5deb77['query']['offset']);}_0x449e4c['order']=qs[_0xd654('0x33')](_0x5deb77[_0xd654('0x2c')]['sort']);_0x449e4c['where']=qs[_0xd654('0x2d')](_[_0xd654('0x34')](_0x5deb77['query'],_0x161c47['filters']),_0xe5b592);if(_0x5deb77[_0xd654('0x2c')][_0xd654('0x35')]){_0x449e4c[_0xd654('0x36')]=_[_0xd654('0x37')](_0x449e4c['where'],{'$or':_['map'](_0xe5b592,function(_0x4613a1){if(_0x4613a1[_0xd654('0x38')]!=='VIRTUAL'){var _0x5e41e1={};_0x5e41e1[_0x4613a1[_0xd654('0x25')]]={'$like':'%'+_0x5deb77[_0xd654('0x2c')][_0xd654('0x35')]+'%'};return _0x5e41e1;}})});}_0x449e4c=_['merge']({},_0x449e4c,_0x5deb77[_0xd654('0x39')]);var _0x8b7bbc={'where':_0x449e4c['where']};return db['Attachment']['count'](_0x8b7bbc)[_0xd654('0x22')](function(_0x1fe83c){_0x13712c[_0xd654('0x1b')]=_0x1fe83c;if(_0x5deb77[_0xd654('0x2c')][_0xd654('0x3a')]){_0x449e4c[_0xd654('0x3b')]=[{'all':!![]}];}return db[_0xd654('0x3c')]['findAll'](_0x449e4c);})[_0xd654('0x22')](function(_0x3ef303){_0x13712c[_0xd654('0x3d')]=_0x3ef303;return _0x13712c;})[_0xd654('0x22')](respondWithFilteredResult(_0x454122,_0x449e4c))[_0xd654('0x3e')](handleError(_0x454122,null));};exports[_0xd654('0x3f')]=function(_0x56b578,_0x50058a){var _0x5ba3a4={'raw':!![],'where':{'id':_0x56b578[_0xd654('0x40')]['id']}},_0x1847c3={};_0x1847c3['model']=_[_0xd654('0x41')](db[_0xd654('0x3c')][_0xd654('0x28')]);_0x1847c3[_0xd654('0x2c')]=_['keys'](_0x56b578[_0xd654('0x2c')]);_0x1847c3[_0xd654('0x2d')]=_[_0xd654('0x2f')](_0x1847c3[_0xd654('0x2b')],_0x1847c3[_0xd654('0x2c')]);_0x5ba3a4[_0xd654('0x2e')]=_['intersection'](_0x1847c3['model'],qs[_0xd654('0x42')](_0x56b578[_0xd654('0x2c')][_0xd654('0x42')]));_0x5ba3a4[_0xd654('0x2e')]=_0x5ba3a4[_0xd654('0x2e')][_0xd654('0x30')]?_0x5ba3a4['attributes']:_0x1847c3[_0xd654('0x2b')];if(_0x56b578[_0xd654('0x2c')][_0xd654('0x3a')]){_0x5ba3a4[_0xd654('0x3b')]=[{'all':!![]}];}_0x5ba3a4=_[_0xd654('0x37')]({},_0x5ba3a4,_0x56b578[_0xd654('0x39')]);return db[_0xd654('0x3c')][_0xd654('0x43')](_0x5ba3a4)[_0xd654('0x22')](handleEntityNotFound(_0x50058a,null))[_0xd654('0x22')](respondWithResult(_0x50058a,null))['catch'](handleError(_0x50058a,null));};exports[_0xd654('0x44')]=function(_0x4ea29e,_0x4a907a){var _0x4ef5da={'where':{'id':_0x4ea29e['params']['id']}},_0x3e113d={};_0x3e113d[_0xd654('0x2b')]=_[_0xd654('0x41')](db[_0xd654('0x3c')][_0xd654('0x28')]);_0x4ef5da[_0xd654('0x2e')]=_[_0xd654('0x2f')](_0x3e113d[_0xd654('0x2b')],qs[_0xd654('0x42')](_0x4ea29e['query'][_0xd654('0x42')]));_0x4ef5da[_0xd654('0x2e')]=_0x4ef5da[_0xd654('0x2e')][_0xd654('0x30')]?_0x4ef5da['attributes']:_0x3e113d[_0xd654('0x2b')];if(_0x4ea29e[_0xd654('0x2c')][_0xd654('0x3a')]){_0x4ef5da[_0xd654('0x3b')]=[{'all':!![]}];}_0x4ef5da=_['merge']({},_0x4ef5da,_0x4ea29e[_0xd654('0x39')]);return db[_0xd654('0x3c')][_0xd654('0x43')](_0x4ef5da)[_0xd654('0x22')](handleEntityNotFound(_0x4a907a,null))['then'](function(_0x48681a){if(_0x48681a){var _0x308e0a=_0x48681a[_0xd654('0x45')]({'plain':!![]});_0x308e0a=qs['omit'](_0x308e0a,['id',_0xd654('0x46'),'updatedAt']);_0x4ea29e[_0xd654('0x47')]=_[_0xd654('0x48')](_0x4ea29e[_0xd654('0x47')],['id',_0xd654('0x46'),_0xd654('0x49')]);return db[_0xd654('0x3c')]['create'](_[_0xd654('0x37')](_0x308e0a,_0x4ea29e['body']),{'include':_0x4ea29e[_0xd654('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xd654('0x22')](respondWithResult(_0x4a907a,0xc9))[_0xd654('0x3e')](handleError(_0x4a907a,null));};exports[_0xd654('0x21')]=function(_0xe432c5,_0x395da5){if(_0xe432c5[_0xd654('0x47')]['id']){delete _0xe432c5['body']['id'];}return db['Attachment'][_0xd654('0x43')]({'where':{'id':_0xe432c5[_0xd654('0x40')]['id']}})[_0xd654('0x22')](handleEntityNotFound(_0x395da5,null))[_0xd654('0x22')](saveUpdates(_0xe432c5[_0xd654('0x47')],null))['then'](respondWithResult(_0x395da5,null))[_0xd654('0x3e')](handleError(_0x395da5,null));};exports['destroy']=function(_0x3d08ed,_0x40b4af){return db[_0xd654('0x3c')][_0xd654('0x43')]({'where':{'id':_0x3d08ed[_0xd654('0x40')]['id']}})[_0xd654('0x22')](handleEntityNotFound(_0x40b4af,null))['then'](removeEntity(_0x40b4af,null))['catch'](handleError(_0x40b4af,null));};exports[_0xd654('0x4a')]=function(_0x592e20,_0x5680c3,_0x10fcf2){_0x592e20['body'][_0xd654('0x25')]=_0x592e20[_0xd654('0x4b')]['originalname'];_0x592e20[_0xd654('0x47')][_0xd654('0x4c')]=_0x592e20[_0xd654('0x4b')][_0xd654('0x4d')];_0x592e20['body'][_0xd654('0x38')]=_0x592e20['file'][_0xd654('0x4e')];return db[_0xd654('0x3c')][_0xd654('0x4a')](_0x592e20[_0xd654('0x47')])['then'](respondWithResult(_0x5680c3,0xc9))[_0xd654('0x3e')](handleError(_0x5680c3,null));};exports[_0xd654('0x4f')]=function(_0x6382f6,_0x5c8bbf,_0x59924e){return db[_0xd654('0x3c')][_0xd654('0x50')]({'where':{'id':_0x6382f6[_0xd654('0x40')]['id']},'raw':!![]})[_0xd654('0x22')](handleEntityNotFound(_0x5c8bbf,null))['then'](function(_0x2fb138){if(_0x2fb138){return _0x5c8bbf[_0xd654('0x4f')](path[_0xd654('0x51')](config[_0xd654('0x52')],'server/files/attachments/',_0x2fb138['basename']));}})[_0xd654('0x3e')](handleError(_0x5c8bbf,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0fa709f..b870ddd 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 _0x55e0=['./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x55e0,0xdc));var _0x055e=function(_0x4947e3,_0x21f2ee){_0x4947e3=_0x4947e3-0x0;var _0x1911e5=_0x55e0[_0x4947e3];return _0x1911e5;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('Attachment',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc6=['./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger','path','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2bc6,0x163));var _0x62bc=function(_0x48b3c1,_0x412059){_0x48b3c1=_0x48b3c1-0x0;var _0x303d08=_0x2bc6[_0x48b3c1];return _0x303d08;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x62bc('0x3'));var rimraf=require('rimraf');var config=require(_0x62bc('0x4'));var attributes=require(_0x62bc('0x5'));module['exports']=function(_0x3cce26,_0x450cb6){return _0x3cce26[_0x62bc('0x6')](_0x62bc('0x7'),attributes,{'tableName':_0x62bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7ed4dbb..eb61cd7 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 _0xd517=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','error','message','catch','Attachment','create','body','options','CreateAttachment','debug','stringify'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xd517,0x96));var _0x7d51=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xd517[_0x2e914];return _0x936e45;};'use strict';var _=require(_0x7d51('0x0'));var util=require('util');var moment=require(_0x7d51('0x1'));var BPromise=require(_0x7d51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d51('0x3'));var db=require(_0x7d51('0x4'))['db'];var utils=require(_0x7d51('0x5'));var logger=require('../../config/logger')(_0x7d51('0x6'));var config=require(_0x7d51('0x7'));var jayson=require(_0x7d51('0x8'));var client=jayson[_0x7d51('0x9')][_0x7d51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24cec5,_0xee68fb,_0x5574a6){return new BPromise(function(_0x199d12,_0x277a6d){return client['request'](_0x24cec5,_0x5574a6)[_0x7d51('0xb')](function(_0x1b756a){logger[_0x7d51('0xc')](_0x7d51('0xd'),_0xee68fb,_0x7d51('0xe'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0xee68fb,_0x7d51('0xe'),JSON['stringify'](_0x1b756a));if(_0x1b756a[_0x7d51('0xf')]){if(_0x1b756a['error']['code']===0x1f4){logger[_0x7d51('0xf')](_0x7d51('0xd'),_0xee68fb,_0x1b756a[_0x7d51('0xf')]['message']);return _0x277a6d(_0x1b756a[_0x7d51('0xf')]['message']);}logger[_0x7d51('0xf')](_0x7d51('0xd'),_0xee68fb,_0x1b756a[_0x7d51('0xf')][_0x7d51('0x10')]);return _0x199d12(_0x1b756a[_0x7d51('0xf')][_0x7d51('0x10')]);}else{logger[_0x7d51('0xc')]('Attachment,\x20%s,\x20%s',_0xee68fb,_0x7d51('0xe'));_0x199d12(_0x1b756a['result'][_0x7d51('0x10')]);}})[_0x7d51('0x11')](function(_0x388c6e){logger['error'](_0x7d51('0xd'),_0xee68fb,_0x388c6e);_0x277a6d(_0x388c6e);});});}exports['CreateAttachment']=function(_0x5a27da){var _0x3c931d=this;return new Promise(function(_0x20da1c,_0x529001){return db[_0x7d51('0x12')][_0x7d51('0x13')](_0x5a27da[_0x7d51('0x14')],{'raw':_0x5a27da[_0x7d51('0x15')]?_0x5a27da['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3690b9){logger['info'](_0x7d51('0x16'),_0x5a27da);logger[_0x7d51('0x17')](_0x7d51('0x16'),_0x5a27da,JSON[_0x7d51('0x18')](_0x3690b9));_0x20da1c(_0x3690b9);})[_0x7d51('0x11')](function(_0x483d0f){logger[_0x7d51('0xf')](_0x7d51('0x16'),_0x483d0f[_0x7d51('0x10')],_0x5a27da);_0x529001(_0x3c931d[_0x7d51('0xf')](0x1f4,_0x483d0f[_0x7d51('0x10')]));});});}; \ No newline at end of file +var _0x869c=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','stringify','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x1c5261,_0x1b33a0){var _0x424a96=function(_0x14a5e8){while(--_0x14a5e8){_0x1c5261['push'](_0x1c5261['shift']());}};_0x424a96(++_0x1b33a0);}(_0x869c,0xef));var _0xc869=function(_0x7cf666,_0xa42930){_0x7cf666=_0x7cf666-0x0;var _0x293258=_0x869c[_0x7cf666];return _0x293258;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc869('0x0'));var BPromise=require(_0xc869('0x1'));var rs=require(_0xc869('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc869('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc869('0x4'))(_0xc869('0x5'));var config=require('../../config/environment');var jayson=require(_0xc869('0x6'));var client=jayson[_0xc869('0x7')][_0xc869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x158f68,_0x4f6202,_0x46a3b1){return new BPromise(function(_0x1c955d,_0x39a6a5){return client[_0xc869('0x9')](_0x158f68,_0x46a3b1)[_0xc869('0xa')](function(_0x3f9570){logger[_0xc869('0xb')](_0xc869('0xc'),_0x4f6202,_0xc869('0xd'));logger[_0xc869('0xe')](_0xc869('0xf'),_0x4f6202,_0xc869('0xd'),JSON['stringify'](_0x3f9570));if(_0x3f9570[_0xc869('0x10')]){if(_0x3f9570[_0xc869('0x10')][_0xc869('0x11')]===0x1f4){logger[_0xc869('0x10')](_0xc869('0xc'),_0x4f6202,_0x3f9570[_0xc869('0x10')][_0xc869('0x12')]);return _0x39a6a5(_0x3f9570[_0xc869('0x10')]['message']);}logger[_0xc869('0x10')](_0xc869('0xc'),_0x4f6202,_0x3f9570[_0xc869('0x10')][_0xc869('0x12')]);return _0x1c955d(_0x3f9570['error'][_0xc869('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x4f6202,_0xc869('0xd'));_0x1c955d(_0x3f9570[_0xc869('0x13')][_0xc869('0x12')]);}})['catch'](function(_0x30914d){logger['error'](_0xc869('0xc'),_0x4f6202,_0x30914d);_0x39a6a5(_0x30914d);});});}exports[_0xc869('0x14')]=function(_0x1adb43){var _0x2385da=this;return new Promise(function(_0x2166de,_0x4d96b1){return db[_0xc869('0x15')][_0xc869('0x16')](_0x1adb43[_0xc869('0x17')],{'raw':_0x1adb43[_0xc869('0x18')]?_0x1adb43[_0xc869('0x18')][_0xc869('0x19')]===undefined?!![]:![]:!![]})[_0xc869('0xa')](function(_0x500b2b){logger[_0xc869('0xb')]('CreateAttachment',_0x1adb43);logger[_0xc869('0xe')]('CreateAttachment',_0x1adb43,JSON[_0xc869('0x1a')](_0x500b2b));_0x2166de(_0x500b2b);})[_0xc869('0x1b')](function(_0x285e04){logger[_0xc869('0x10')](_0xc869('0x14'),_0x285e04[_0xc869('0x12')],_0x1adb43);_0x4d96b1(_0x2385da[_0xc869('0x10')](0x1f4,_0x285e04['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c42ddca..6a9246f 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 _0x8c7d=['isAuthenticated','index','show','/:id/download','post','/:id/clone','clone','join','root','format','%s-%s','now','replace','file','create','/:id','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get'];(function(_0x3bc3e1,_0x37c073){var _0x11326b=function(_0xbe759c){while(--_0xbe759c){_0x3bc3e1['push'](_0x3bc3e1['shift']());}};_0x11326b(++_0x37c073);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x44c74d,_0x3e8091){_0x44c74d=_0x44c74d-0x0;var _0x504b2e=_0x8c7d[_0x44c74d];return _0x504b2e;};'use strict';var multer=require(_0xd8c7('0x0'));var util=require('util');var path=require(_0xd8c7('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8c7('0x2'));var router=express[_0xd8c7('0x3')]();var auth=require(_0xd8c7('0x4'));var interaction=require(_0xd8c7('0x5'));var config=require(_0xd8c7('0x6'));var controller=require(_0xd8c7('0x7'));router[_0xd8c7('0x8')]('/',auth[_0xd8c7('0x9')](),controller[_0xd8c7('0xa')]);router['get']('/:id',auth[_0xd8c7('0x9')](),controller[_0xd8c7('0xb')]);router['get'](_0xd8c7('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xd8c7('0xd')](_0xd8c7('0xe'),auth[_0xd8c7('0x9')](),controller[_0xd8c7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8cd919,_0x48406a,_0x15ea62){_0x15ea62(null,path[_0xd8c7('0x10')](config[_0xd8c7('0x11')],'server/files/attachments/'));},'filename':function(_0x5a0516,_0x45fa42,_0x192d95){_0x192d95(null,util[_0xd8c7('0x12')](_0xd8c7('0x13'),Date[_0xd8c7('0x14')](),_0x45fa42['originalname'][_0xd8c7('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0xd8c7('0x16')),controller[_0xd8c7('0x17')]);router['put'](_0xd8c7('0x18'),auth['isAuthenticated'](),controller['update']);router[_0xd8c7('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb749=['isAuthenticated','index','/:id','show','/:id/download','download','/:id/clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','post','single','file','create','put','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xb749,0xac));var _0x9b74=function(_0x1c84cd,_0x47e634){_0x1c84cd=_0x1c84cd-0x0;var _0x4e2b23=_0xb749[_0x1c84cd];return _0x4e2b23;};'use strict';var multer=require(_0x9b74('0x0'));var util=require('util');var path=require(_0x9b74('0x1'));var timeout=require(_0x9b74('0x2'));var express=require('express');var router=express[_0x9b74('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b74('0x4'));var config=require(_0x9b74('0x5'));var controller=require(_0x9b74('0x6'));router[_0x9b74('0x7')]('/',auth[_0x9b74('0x8')](),controller[_0x9b74('0x9')]);router['get'](_0x9b74('0xa'),auth['isAuthenticated'](),controller[_0x9b74('0xb')]);router[_0x9b74('0x7')](_0x9b74('0xc'),auth[_0x9b74('0x8')](),controller[_0x9b74('0xd')]);router['post'](_0x9b74('0xe'),auth[_0x9b74('0x8')](),controller['clone']);var upload=multer({'storage':multer[_0x9b74('0xf')]({'destination':function(_0xfc8a79,_0x2d72a9,_0x5dd91a){_0x5dd91a(null,path[_0x9b74('0x10')](config[_0x9b74('0x11')],_0x9b74('0x12')));},'filename':function(_0x319fd1,_0x55491e,_0x4ef4c0){_0x4ef4c0(null,util[_0x9b74('0x13')](_0x9b74('0x14'),Date[_0x9b74('0x15')](),_0x55491e[_0x9b74('0x16')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9b74('0x17')]('/',upload[_0x9b74('0x18')](_0x9b74('0x19')),controller[_0x9b74('0x1a')]);router[_0x9b74('0x1b')](_0x9b74('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9b74('0x1c')](_0x9b74('0xa'),auth[_0x9b74('0x8')](),controller[_0x9b74('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5795708..94dac56 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 _0x999a=['email','callback','use','secret','callbackURL','Setting','blockDuration','then','find','map','value','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile'];(function(_0x3e5355,_0x55cb38){var _0xb7e3ce=function(_0x22d427){while(--_0x22d427){_0x3e5355['push'](_0x3e5355['shift']());}};_0xb7e3ce(++_0x55cb38);}(_0x999a,0x82));var _0xa999=function(_0x513f86,_0x3b7a6f){_0x513f86=_0x513f86-0x0;var _0x4b47a3=_0x999a[_0x513f86];return _0x4b47a3;};'use strict';var _=require(_0xa999('0x0'));var passport=require(_0xa999('0x1'));var GoogleStrategy=require(_0xa999('0x2'))[_0xa999('0x3')];var moment=require('moment');var db=require(_0xa999('0x4'))['db'];var config=require(_0xa999('0x5'));var signToken=require(_0xa999('0x6'))[_0xa999('0x7')];var utils=require(_0xa999('0x8'));exports[_0xa999('0x9')]=passport[_0xa999('0xa')](_0xa999('0xb'),{'failureRedirect':_0xa999('0xc'),'scope':[_0xa999('0xd'),_0xa999('0xe')],'session':![]});exports[_0xa999('0xf')]=passport[_0xa999('0xa')](_0xa999('0xb'),{'failureRedirect':_0xa999('0xc'),'session':![]});passport[_0xa999('0x10')](new GoogleStrategy({'clientID':config[_0xa999('0xb')]?config[_0xa999('0xb')]['clientID']:'id','clientSecret':config[_0xa999('0xb')]?config[_0xa999('0xb')]['clientSecret']:_0xa999('0x11'),'callbackURL':config[_0xa999('0xb')]?config[_0xa999('0xb')][_0xa999('0x12')]:''},function(_0x4c128e,_0x48e9a6,_0x543ae0,_0xa48bf8){var _0x1a6311,_0x220f4e;return db[_0xa999('0x13')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa999('0x14')],'raw':!![]})[_0xa999('0x15')](function(_0x276601){_0x1a6311=_0x276601;return db['User'][_0xa999('0x16')]({'where':{'email':_[_0xa999('0x17')](_0x543ae0['emails'],_0xa999('0x18')),'role':{'$or':[_0xa999('0x19'),_0xa999('0x1a'),'agent']}}});})[_0xa999('0x15')](function(_0x3fc0cd){_0x220f4e=_0x3fc0cd;if(_0x220f4e){if(_0x220f4e[_0xa999('0x1b')]){return _0xa48bf8(_0xa999('0x1c'));}else if(_0x1a6311[_0xa999('0x14')]>0x0){if(_0x220f4e[_0xa999('0x1d')]){if(moment(_0x220f4e[_0xa999('0x1e')])[_0xa999('0x1f')](_0x1a6311[_0xa999('0x14')],_0xa999('0x20'))>moment()){return _0xa48bf8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xa999('0x21')](_0x220f4e,0x0,![],null)[_0xa999('0x15')](function(){return utils[_0xa999('0x22')](_0x220f4e);})[_0xa999('0x15')](function(){return _0xa48bf8(null,_0x220f4e);});}}else{return utils[_0xa999('0x22')](_0x220f4e)[_0xa999('0x15')](function(){return _0xa48bf8(null,_0x220f4e);});}}else{return utils[_0xa999('0x22')](_0x220f4e)[_0xa999('0x15')](function(){return _0xa48bf8(null,_0x220f4e);});}}return _0xa48bf8(_0xa999('0x1c'));})[_0xa999('0x23')](function(_0x175f15){_0xa48bf8(_0x175f15);});})); \ No newline at end of file +var _0xe8ca=['then','getLicense','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','/login','profile','callback','google','use','clientID','clientSecret','secret','findOne','allowedLoginAttempts','blockDuration','User','map','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser'];(function(_0x52a806,_0x2439a0){var _0x15315f=function(_0x10ad11){while(--_0x10ad11){_0x52a806['push'](_0x52a806['shift']());}};_0x15315f(++_0x2439a0);}(_0xe8ca,0x156));var _0xae8c=function(_0x509390,_0x145174){_0x509390=_0x509390-0x0;var _0xb8864c=_0xe8ca[_0x509390];return _0xb8864c;};'use strict';var _=require(_0xae8c('0x0'));var passport=require(_0xae8c('0x1'));var GoogleStrategy=require(_0xae8c('0x2'))[_0xae8c('0x3')];var moment=require('moment');var db=require(_0xae8c('0x4'))['db'];var config=require(_0xae8c('0x5'));var signToken=require(_0xae8c('0x6'))[_0xae8c('0x7')];var utils=require(_0xae8c('0x8'));exports['login']=passport[_0xae8c('0x9')]('google',{'failureRedirect':_0xae8c('0xa'),'scope':[_0xae8c('0xb'),'email'],'session':![]});exports[_0xae8c('0xc')]=passport[_0xae8c('0x9')](_0xae8c('0xd'),{'failureRedirect':'/login','session':![]});passport[_0xae8c('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0xae8c('0xd')][_0xae8c('0xf')]:'id','clientSecret':config['google']?config[_0xae8c('0xd')][_0xae8c('0x10')]:_0xae8c('0x11'),'callbackURL':config['google']?config[_0xae8c('0xd')]['callbackURL']:''},function(_0x1bfc95,_0xc7de46,_0x29dc32,_0x4a9009){var _0x1a13fe,_0x5da2d3;return db['Setting'][_0xae8c('0x12')]({'where':{'id':0x1},'attributes':[_0xae8c('0x13'),_0xae8c('0x14')],'raw':!![]})['then'](function(_0x89aa81){_0x1a13fe=_0x89aa81;return db[_0xae8c('0x15')]['find']({'where':{'email':_[_0xae8c('0x16')](_0x29dc32['emails'],_0xae8c('0x17')),'role':{'$or':['admin',_0xae8c('0x18'),_0xae8c('0x19')]}}});})['then'](function(_0xd3b46c){_0x5da2d3=_0xd3b46c;if(_0x5da2d3){if(_0x5da2d3[_0xae8c('0x1a')]){return _0x4a9009(_0xae8c('0x1b'));}else if(_0x1a13fe[_0xae8c('0x14')]>0x0){if(_0x5da2d3['blocked']){if(moment(_0x5da2d3[_0xae8c('0x1c')])[_0xae8c('0x1d')](_0x1a13fe[_0xae8c('0x14')],_0xae8c('0x1e'))>moment()){return _0x4a9009(_0xae8c('0x1b'));}else{return utils[_0xae8c('0x1f')](_0x5da2d3,0x0,![],null)[_0xae8c('0x20')](function(){return utils[_0xae8c('0x21')](_0x5da2d3);})[_0xae8c('0x20')](function(){return _0x4a9009(null,_0x5da2d3);});}}else{return utils[_0xae8c('0x21')](_0x5da2d3)['then'](function(){return _0x4a9009(null,_0x5da2d3);});}}else{return utils[_0xae8c('0x21')](_0x5da2d3)[_0xae8c('0x20')](function(){return _0x4a9009(null,_0x5da2d3);});}}return _0x4a9009(_0xae8c('0x1b'));})['catch'](function(_0x2f900a){_0x4a9009(_0x2f900a);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6017eae..d61a0e7 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 _0x1789=['../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports','express','passport','Router','../user/user.controller.js'];(function(_0x1de950,_0x325139){var _0x12dc31=function(_0x57409b){while(--_0x57409b){_0x1de950['push'](_0x1de950['shift']());}};_0x12dc31(++_0x325139);}(_0x1789,0x92));var _0x9178=function(_0x4f57e4,_0x18914d){_0x4f57e4=_0x4f57e4-0x0;var _0x4a584c=_0x1789[_0x4f57e4];return _0x4a584c;};'use strict';var express=require(_0x9178('0x0'));var passport=require(_0x9178('0x1'));var router=express[_0x9178('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x9178('0x3'));var authService=require(_0x9178('0x4'));router[_0x9178('0x5')]('/',controller[_0x9178('0x6')]);router[_0x9178('0x5')]('/callback',controller['callback'],authService[_0x9178('0x7')],userController[_0x9178('0x6')],authService[_0x9178('0x8')]);module[_0x9178('0x9')]=router; \ No newline at end of file +var _0x6364=['isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x353caa,_0x4f934a){var _0x4e9b56=function(_0xbba612){while(--_0xbba612){_0x353caa['push'](_0x353caa['shift']());}};_0x4e9b56(++_0x4f934a);}(_0x6364,0x8f));var _0x4636=function(_0x1037c0,_0x4973ff){_0x1037c0=_0x1037c0-0x0;var _0x87dde0=_0x6364[_0x1037c0];return _0x87dde0;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x4636('0x0')]();var controller=require(_0x4636('0x1'));var userController=require(_0x4636('0x2'));var authService=require(_0x4636('0x3'));router[_0x4636('0x4')]('/',controller[_0x4636('0x5')]);router[_0x4636('0x4')](_0x4636('0x6'),controller['callback'],authService[_0x4636('0x7')],userController[_0x4636('0x5')],authService[_0x4636('0x8')]);module[_0x4636('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 fc0a92d..c8453d6 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 _0xb50f=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','Password\x20reset!','use','passport-local','Strategy','jayson/promise','lodash','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','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~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','email','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add'];(function(_0x3261ed,_0x1f06ad){var _0xbea3c3=function(_0x1481ec){while(--_0x1481ec){_0x3261ed['push'](_0x3261ed['shift']());}};_0xbea3c3(++_0x1f06ad);}(_0xb50f,0x66));var _0xfb50=function(_0x6c75da,_0x1b96d6){_0x6c75da=_0x6c75da-0x0;var _0x5f5d21=_0xb50f[_0x6c75da];return _0x5f5d21;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0xfb50('0x0'))[_0xfb50('0x1')];var jayson=require(_0xfb50('0x2'));var _=require(_0xfb50('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xfb50('0x4'));var client=jayson[_0xfb50('0x5')][_0xfb50('0x6')]({'port':0x232b});function localAuthenticate(_0x30a1bd,_0x12ea42,_0x2a9172,_0x134e4f){var _0x4406c0,_0x2ca3d1;return db[_0xfb50('0x7')][_0xfb50('0x8')]({'where':{'id':0x1},'attributes':[_0xfb50('0x9'),_0xfb50('0xa')],'raw':!![]})[_0xfb50('0xb')](function(_0x217bec){_0x4406c0=_0x217bec;return _0x30a1bd['findOne']({'attributes':['id','name','password',_0xfb50('0xc'),_0xfb50('0xd'),_0xfb50('0xe'),_0xfb50('0xf'),_0xfb50('0x10'),_0xfb50('0x11')],'where':{'name':_0x12ea42,'role':{'$or':['admin',_0xfb50('0x12'),_0xfb50('0x13')]}}});})[_0xfb50('0xb')](function(_0x423ff0){if(!_0x423ff0||_0x423ff0&&_0x423ff0[_0xfb50('0x14')]!==_0x12ea42){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2ca3d1=_0x423ff0;return _0x2ca3d1;}})[_0xfb50('0xb')](function(){_0x2ca3d1[_0xfb50('0x15')](_0x2a9172,function(_0x241427,_0x3de2ea){var _0x301cfc=_0x2ca3d1[_0xfb50('0x11')]+0x1;if(_0x241427){return _0x134e4f(_0x241427);}else if(!_0x3de2ea){if(_0x2ca3d1['disabled']){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}else if(_0x4406c0[_0xfb50('0x9')]>0x0){if(_0x2ca3d1[_0xfb50('0xf')]){if(_0x4406c0[_0xfb50('0xa')]>0x0){if(moment(_0x2ca3d1[_0xfb50('0x10')])['add'](_0x4406c0[_0xfb50('0xa')],_0xfb50('0x17'))>moment()){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}else{return utils['clearBlockUser'](_0x2ca3d1,_0x301cfc,![],null)[_0xfb50('0xb')](function(){return _0x134e4f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}}else{if(_0x301cfc>=_0x4406c0[_0xfb50('0x9')]){return utils['clearBlockUser'](_0x2ca3d1,0x0,!![],moment())[_0xfb50('0xb')](function(){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});});}else{return utils[_0xfb50('0x18')](_0x2ca3d1,_0x301cfc,![],null)[_0xfb50('0xb')](function(){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});});}}}else{return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}}else{if(_0x2ca3d1[_0xfb50('0xe')]){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}else if(_0x4406c0[_0xfb50('0x9')]>0x0){if(_0x2ca3d1[_0xfb50('0xf')]){if(_0x4406c0['blockDuration']>0x0){if(moment(_0x2ca3d1[_0xfb50('0x10')])['add'](_0x4406c0[_0xfb50('0xa')],_0xfb50('0x17'))>moment()){return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}else{return utils['clearBlockUser'](_0x2ca3d1,0x0,![],null)[_0xfb50('0xb')](function(){return utils[_0xfb50('0x19')](_0x2ca3d1);})[_0xfb50('0xb')](function(){return _0x134e4f(null,_0x2ca3d1);});}}else{return _0x134e4f(null,![],{'message':_0xfb50('0x16')});}}else{return utils[_0xfb50('0x18')](_0x2ca3d1,0x0,![],null)[_0xfb50('0xb')](function(){return utils[_0xfb50('0x19')](_0x2ca3d1);})[_0xfb50('0xb')](function(){return _0x134e4f(null,_0x2ca3d1);})['catch'](function(_0x3eef5c){return _0x134e4f(null,![],_0x3eef5c);});}}else{if(_0x2ca3d1[_0xfb50('0xf')]){return _0x134e4f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfb50('0x19')](_0x2ca3d1)[_0xfb50('0xb')](function(){return _0x134e4f(null,_0x2ca3d1);});}}}});})[_0xfb50('0x1a')](function(_0x34773e){return _0x134e4f(null,![],_0x34773e);});}function sendServiceMail(_0x48cebc){return db[_0xfb50('0x1b')][_0xfb50('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xfb50('0x14'),'email'],'include':[{'model':db[_0xfb50('0x1d')],'as':_0xfb50('0x1e')}]})[_0xfb50('0xb')](function(_0x16e689){if(!_0x16e689){throw new Error(_0xfb50('0x1f'));}var _0xd81580={'tls':{'rejectUnauthorized':![]}};if(_0x16e689['Smtp'][_0xfb50('0x20')]){_0xd81580['service']=_0x16e689[_0xfb50('0x1e')]['service'];}else{_0xd81580[_0xfb50('0x21')]=_0x16e689[_0xfb50('0x1e')][_0xfb50('0x21')];_0xd81580[_0xfb50('0x22')]=_0x16e689['Smtp'][_0xfb50('0x22')];_0xd81580[_0xfb50('0x23')]=_0x16e689['Smtp'][_0xfb50('0x23')];}if(_0x16e689[_0xfb50('0x1e')][_0xfb50('0x24')]){_0xd81580[_0xfb50('0x25')]={'user':_0x16e689[_0xfb50('0x1e')][_0xfb50('0x12')],'pass':_0x16e689[_0xfb50('0x1e')][_0xfb50('0x26')]};}var _0x3d2f30={'account':_0xd81580,'message':_[_0xfb50('0x27')]({'from':util[_0xfb50('0x28')](_0xfb50('0x29'),_0x16e689[_0xfb50('0x14')],_0x16e689['email']||_0x16e689[_0xfb50('0x1e')][_0xfb50('0x12')])},_0x48cebc)};return client['request'](_0xfb50('0x2a'),_0x3d2f30);})['then'](function(_0x412d69){if(_0x412d69[_0xfb50('0x2b')]){throw new Error(util['format'](_0xfb50('0x2c'),_0x412d69[_0xfb50('0x2b')][_0xfb50('0x2d')]||JSON['stringify'](_0x412d69[_0xfb50('0x2b')])));}return!![];});}function handleError(_0x47ba17,_0x356e81,_0x112d86){return _0x47ba17[_0xfb50('0x2e')](_0x356e81||0x1f4)[_0xfb50('0x2f')]({'message':_0x112d86?_0x112d86[_0xfb50('0x2d')]||_0x112d86:''});}function checkPasswordPattern(_0x595804,_0x279ba0,_0x20ebe4){if(_0x20ebe4){var _0x25599f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25599f[_0xfb50('0x30')](_0x279ba0)){return _0x595804;}else{throw new Error(_0xfb50('0x31'));}}else{return _0x595804;}}exports[_0xfb50('0x32')]=function(_0x17af0a,_0x26cec9,_0x33cca6){passport[_0xfb50('0x15')](_0xfb50('0x33'),function(_0x13fb29,_0x5e7117,_0x1ba4fe){var _0x2eb6cf=_0x13fb29||_0x1ba4fe;if(_0x2eb6cf){return handleError(_0x26cec9,0x191,_0x2eb6cf);}if(!_0x5e7117){return handleError(_0x26cec9,0x194,{'message':_0xfb50('0x34')});}else{var _0xd187d={'payload':{'id':_0x5e7117['id'],'role':_0x5e7117[_0xfb50('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xfb50('0x35')](_0xd187d)[_0xfb50('0xb')](function(_0x50508f){_0x26cec9['json']({'id':_0x5e7117['id'],'token':_0x50508f,'statusCall':'','isAlreadyLogged':_0x5e7117[_0xfb50('0x36')]});});}})(_0x17af0a,_0x26cec9,_0x33cca6);};exports['forgot']=function(_0x130230,_0x104bd6,_0x177d07){if(!_0x130230[_0xfb50('0x37')][_0xfb50('0x38')]){return handleError(_0x104bd6,0x1f4,{'message':_0xfb50('0x39')});}var _0x413aa9=rs[_0xfb50('0x3a')]();_0x130230[_0xfb50('0x37')][_0xfb50('0x38')]=_0x130230['body'][_0xfb50('0x38')][_0xfb50('0x3b')]()[_0xfb50('0x3c')]();var _0x3feb33;return db[_0xfb50('0x7')]['findOne']({'where':{'id':0x1},'attributes':[_0xfb50('0x9'),_0xfb50('0xa')],'raw':!![]})[_0xfb50('0xb')](function(_0x1c5062){_0x3feb33=_0x1c5062;return db['User'][_0xfb50('0x1c')]({'where':{'email':_0x130230[_0xfb50('0x37')][_0xfb50('0x38')]}});})['then'](function(_0x3222dc){if(!_0x3222dc){throw new Error(_0xfb50('0x3d'));}if(_0x3222dc[_0xfb50('0xe')]){throw new Error(_0xfb50('0x3e'));}if(_0x3222dc[_0xfb50('0xf')]){if(moment(_0x3222dc[_0xfb50('0x10')])[_0xfb50('0x3f')](_0x3feb33[_0xfb50('0xa')],_0xfb50('0x17'))>moment()){throw new Error(_0xfb50('0x40'));}else{_0x3222dc['blocked']=![];_0x3222dc['blockedAt']=null;}}_0x3222dc[_0xfb50('0x41')]=_0x413aa9;_0x3222dc[_0xfb50('0x42')]=Date['now']()+0x36ee80;return _0x3222dc[_0xfb50('0x43')]();})[_0xfb50('0xb')](function(){return sendServiceMail({'to':_0x130230[_0xfb50('0x37')][_0xfb50('0x38')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xfb50('0x44')+_0xfb50('0x45')+_0xfb50('0x46')+_0x130230['headers'][_0xfb50('0x21')]+_0xfb50('0x47')+_0x413aa9+'\x0a\x0a'+_0xfb50('0x48')});})[_0xfb50('0xb')](function(){_0x104bd6[_0xfb50('0x2e')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x22dc40){return handleError(_0x104bd6,0x1f4,_0x22dc40);});};exports[_0xfb50('0x49')]=function(_0x51c392,_0x38f0d2,_0x192708){var _0x1452b1;return db[_0xfb50('0x4a')][_0xfb50('0x1c')]({'where':{'resetPasswordToken':_0x51c392[_0xfb50('0x4b')][_0xfb50('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xfb50('0x4d')]()}}})['then'](function(_0xce0b7c){_0x1452b1=_0xce0b7c;if(!_0x1452b1){throw new Error(_0xfb50('0x4e'));}return db[_0xfb50('0x7')][_0xfb50('0x8')]({'attributes':['id',_0xfb50('0x4f')]});})[_0xfb50('0xb')](function(_0xcce188){return checkPasswordPattern(_0xcce188,_0x51c392[_0xfb50('0x37')][_0xfb50('0x50')],_0xcce188[_0xfb50('0x4f')]);})[_0xfb50('0xb')](function(){_0x1452b1[_0xfb50('0x50')]=_0x51c392[_0xfb50('0x37')][_0xfb50('0x50')];_0x1452b1[_0xfb50('0x41')]=null;_0x1452b1[_0xfb50('0x42')]=null;return _0x1452b1[_0xfb50('0x43')]();})['then'](function(){_0x38f0d2[_0xfb50('0x2e')](0xc8)[_0xfb50('0x2f')]({'message':_0xfb50('0x51')});})[_0xfb50('0x1a')](function(_0x34a24d){return handleError(_0x38f0d2,0x1f4,_0x34a24d);});};passport[_0xfb50('0x52')](new LocalStrategy({'usernameField':_0xfb50('0x14'),'passwordField':'password'},function(_0x3d36c3,_0x41035b,_0x16a4f4){return localAuthenticate(db['User'],_0x3d36c3,_0x41035b,_0x16a4f4);})); \ No newline at end of file +var _0x5766=['Reset\x20Email\x20sent!','reset','token','now','securePassword','Password\x20reset!','use','User','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../config/utils','Setting','allowedLoginAttempts','then','findOne','name','password','salt','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','message','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','generate','body','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','status','send'];(function(_0xa3a76e,_0x55edec){var _0x125fce=function(_0x1f5af7){while(--_0x1f5af7){_0xa3a76e['push'](_0xa3a76e['shift']());}};_0x125fce(++_0x55edec);}(_0x5766,0xfb));var _0x6576=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5766[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6576('0x0'));var passport=require(_0x6576('0x1'));var LocalStrategy=require(_0x6576('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x6576('0x3'));var rs=require(_0x6576('0x4'));var moment=require(_0x6576('0x5'));var db=require(_0x6576('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x6576('0x7'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x75f2ff,_0x156ce9,_0x236658,_0x4af30e){var _0x57128a,_0x38c121;return db[_0x6576('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x6576('0x9'),'blockDuration'],'raw':!![]})[_0x6576('0xa')](function(_0x5122a5){_0x57128a=_0x5122a5;return _0x75f2ff[_0x6576('0xb')]({'attributes':['id',_0x6576('0xc'),_0x6576('0xd'),_0x6576('0xe'),'role',_0x6576('0xf'),_0x6576('0x10'),'blockedAt','loginAttempts'],'where':{'name':_0x156ce9,'role':{'$or':[_0x6576('0x11'),_0x6576('0x12'),_0x6576('0x13')]}}});})['then'](function(_0x373dcd){if(!_0x373dcd||_0x373dcd&&_0x373dcd[_0x6576('0xc')]!==_0x156ce9){throw new Error(_0x6576('0x14'));}else{_0x38c121=_0x373dcd;return _0x38c121;}})[_0x6576('0xa')](function(){_0x38c121[_0x6576('0x15')](_0x236658,function(_0x37dc79,_0x3b549d){var _0xf84429=_0x38c121[_0x6576('0x16')]+0x1;if(_0x37dc79){return _0x4af30e(_0x37dc79);}else if(!_0x3b549d){if(_0x38c121['disabled']){return _0x4af30e(null,![],{'message':_0x6576('0x14')});}else if(_0x57128a[_0x6576('0x9')]>0x0){if(_0x38c121[_0x6576('0x10')]){if(_0x57128a[_0x6576('0x17')]>0x0){if(moment(_0x38c121[_0x6576('0x18')])[_0x6576('0x19')](_0x57128a[_0x6576('0x17')],_0x6576('0x1a'))>moment()){return _0x4af30e(null,![],{'message':_0x6576('0x14')});}else{return utils['clearBlockUser'](_0x38c121,_0xf84429,![],null)['then'](function(){return _0x4af30e(null,![],{'message':_0x6576('0x14')});});}}else{return _0x4af30e(null,![],{'message':_0x6576('0x14')});}}else{if(_0xf84429>=_0x57128a[_0x6576('0x9')]){return utils[_0x6576('0x1b')](_0x38c121,0x0,!![],moment())['then'](function(){return _0x4af30e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x6576('0x1b')](_0x38c121,_0xf84429,![],null)[_0x6576('0xa')](function(){return _0x4af30e(null,![],{'message':_0x6576('0x14')});});}}}else{return _0x4af30e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x38c121[_0x6576('0xf')]){return _0x4af30e(null,![],{'message':_0x6576('0x14')});}else if(_0x57128a[_0x6576('0x9')]>0x0){if(_0x38c121['blocked']){if(_0x57128a[_0x6576('0x17')]>0x0){if(moment(_0x38c121[_0x6576('0x18')])[_0x6576('0x19')](_0x57128a[_0x6576('0x17')],_0x6576('0x1a'))>moment()){return _0x4af30e(null,![],{'message':_0x6576('0x14')});}else{return utils['clearBlockUser'](_0x38c121,0x0,![],null)[_0x6576('0xa')](function(){return utils[_0x6576('0x1c')](_0x38c121);})[_0x6576('0xa')](function(){return _0x4af30e(null,_0x38c121);});}}else{return _0x4af30e(null,![],{'message':_0x6576('0x14')});}}else{return utils[_0x6576('0x1b')](_0x38c121,0x0,![],null)[_0x6576('0xa')](function(){return utils[_0x6576('0x1c')](_0x38c121);})[_0x6576('0xa')](function(){return _0x4af30e(null,_0x38c121);})[_0x6576('0x1d')](function(_0x457a08){return _0x4af30e(null,![],_0x457a08);});}}else{if(_0x38c121[_0x6576('0x10')]){return _0x4af30e(null,![],{'message':_0x6576('0x14')});}else{return utils[_0x6576('0x1c')](_0x38c121)[_0x6576('0xa')](function(){return _0x4af30e(null,_0x38c121);});}}}});})['catch'](function(_0x5e731b){return _0x4af30e(null,![],_0x5e731b);});}function sendServiceMail(_0x4d7656){return db['MailAccount'][_0x6576('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x6576('0xc'),_0x6576('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x6576('0x20')}]})[_0x6576('0xa')](function(_0x31aa71){if(!_0x31aa71){throw new Error(_0x6576('0x21'));}var _0x2a1a63={'tls':{'rejectUnauthorized':![]}};if(_0x31aa71[_0x6576('0x20')][_0x6576('0x22')]){_0x2a1a63['service']=_0x31aa71[_0x6576('0x20')]['service'];}else{_0x2a1a63['host']=_0x31aa71[_0x6576('0x20')][_0x6576('0x23')];_0x2a1a63[_0x6576('0x24')]=_0x31aa71[_0x6576('0x20')][_0x6576('0x24')];_0x2a1a63['secure']=_0x31aa71[_0x6576('0x20')][_0x6576('0x25')];}if(_0x31aa71[_0x6576('0x20')][_0x6576('0x26')]){_0x2a1a63[_0x6576('0x27')]={'user':_0x31aa71[_0x6576('0x20')][_0x6576('0x12')],'pass':_0x31aa71[_0x6576('0x20')]['pass']};}var _0x4681a9={'account':_0x2a1a63,'message':_[_0x6576('0x28')]({'from':util[_0x6576('0x29')](_0x6576('0x2a'),_0x31aa71[_0x6576('0xc')],_0x31aa71[_0x6576('0x1f')]||_0x31aa71['Smtp'][_0x6576('0x12')])},_0x4d7656)};return client[_0x6576('0x2b')]('SendMail',_0x4681a9);})['then'](function(_0x7dbb89){if(_0x7dbb89['error']){throw new Error(util[_0x6576('0x29')](_0x6576('0x2c'),_0x7dbb89['error']['message']||JSON[_0x6576('0x2d')](_0x7dbb89['error'])));}return!![];});}function handleError(_0x4d39a1,_0x47c2d2,_0x21b14d){return _0x4d39a1['status'](_0x47c2d2||0x1f4)['send']({'message':_0x21b14d?_0x21b14d[_0x6576('0x2e')]||_0x21b14d:''});}function checkPasswordPattern(_0xa64e47,_0x11e642,_0xc391c0){if(_0xc391c0){var _0x44304d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44304d['test'](_0x11e642)){return _0xa64e47;}else{throw new Error(_0x6576('0x2f'));}}else{return _0xa64e47;}}exports[_0x6576('0x30')]=function(_0x422376,_0x197150,_0x465563){passport[_0x6576('0x15')](_0x6576('0x31'),function(_0x24f875,_0xb5caf7,_0x239d50){var _0xb87bae=_0x24f875||_0x239d50;if(_0xb87bae){return handleError(_0x197150,0x191,_0xb87bae);}if(!_0xb5caf7){return handleError(_0x197150,0x194,{'message':_0x6576('0x32')});}else{var _0x3c2dc4={'payload':{'id':_0xb5caf7['id'],'role':_0xb5caf7[_0x6576('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x6576('0x34')](_0x3c2dc4)[_0x6576('0xa')](function(_0x41675a){_0x197150[_0x6576('0x35')]({'id':_0xb5caf7['id'],'token':_0x41675a,'statusCall':'','isAlreadyLogged':_0xb5caf7[_0x6576('0x36')]});});}})(_0x422376,_0x197150,_0x465563);};exports[_0x6576('0x37')]=function(_0x2e03f6,_0x59cf6b,_0x57f799){if(!_0x2e03f6['body'][_0x6576('0x1f')]){return handleError(_0x59cf6b,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x30afaa=rs[_0x6576('0x38')]();_0x2e03f6[_0x6576('0x39')][_0x6576('0x1f')]=_0x2e03f6[_0x6576('0x39')]['email'][_0x6576('0x3a')]()[_0x6576('0x3b')]();var _0x5f0e4c;return db[_0x6576('0x8')][_0x6576('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6576('0x17')],'raw':!![]})[_0x6576('0xa')](function(_0x41b751){_0x5f0e4c=_0x41b751;return db['User'][_0x6576('0x1e')]({'where':{'email':_0x2e03f6[_0x6576('0x39')][_0x6576('0x1f')]}});})[_0x6576('0xa')](function(_0x3fbc53){if(!_0x3fbc53){throw new Error(_0x6576('0x3c'));}if(_0x3fbc53[_0x6576('0xf')]){throw new Error(_0x6576('0x3d'));}if(_0x3fbc53[_0x6576('0x10')]){if(moment(_0x3fbc53['blockedAt'])[_0x6576('0x19')](_0x5f0e4c[_0x6576('0x17')],_0x6576('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3fbc53[_0x6576('0x10')]=![];_0x3fbc53['blockedAt']=null;}}_0x3fbc53[_0x6576('0x3e')]=_0x30afaa;_0x3fbc53[_0x6576('0x3f')]=Date['now']()+0x36ee80;return _0x3fbc53[_0x6576('0x40')]();})[_0x6576('0xa')](function(){return sendServiceMail({'to':_0x2e03f6[_0x6576('0x39')][_0x6576('0x1f')],'subject':_0x6576('0x41'),'text':_0x6576('0x42')+_0x6576('0x43')+_0x6576('0x44')+_0x2e03f6[_0x6576('0x45')][_0x6576('0x23')]+_0x6576('0x46')+_0x30afaa+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6576('0xa')](function(){_0x59cf6b[_0x6576('0x47')](0xc8)[_0x6576('0x48')]({'message':_0x6576('0x49')});})[_0x6576('0x1d')](function(_0x175ba0){return handleError(_0x59cf6b,0x1f4,_0x175ba0);});};exports[_0x6576('0x4a')]=function(_0x5ec853,_0x3d3dae,_0x2500be){var _0x280275;return db['User'][_0x6576('0x1e')]({'where':{'resetPasswordToken':_0x5ec853['params'][_0x6576('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x6576('0x4c')]()}}})['then'](function(_0x2010eb){_0x280275=_0x2010eb;if(!_0x280275){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x6576('0x8')][_0x6576('0xb')]({'attributes':['id',_0x6576('0x4d')]});})[_0x6576('0xa')](function(_0x3b7b46){return checkPasswordPattern(_0x3b7b46,_0x5ec853[_0x6576('0x39')][_0x6576('0xd')],_0x3b7b46[_0x6576('0x4d')]);})['then'](function(){_0x280275['password']=_0x5ec853[_0x6576('0x39')][_0x6576('0xd')];_0x280275['resetPasswordToken']=null;_0x280275[_0x6576('0x3f')]=null;return _0x280275[_0x6576('0x40')]();})['then'](function(){_0x3d3dae[_0x6576('0x47')](0xc8)[_0x6576('0x48')]({'message':_0x6576('0x4e')});})[_0x6576('0x1d')](function(_0xfa6ca2){return handleError(_0x3d3dae,0x1f4,_0xfa6ca2);});};passport[_0x6576('0x4f')](new LocalStrategy({'usernameField':_0x6576('0xc'),'passwordField':_0x6576('0xd')},function(_0x5e6418,_0x50d05c,_0x50f438){return localAuthenticate(db[_0x6576('0x50')],_0x5e6418,_0x50d05c,_0x50f438);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4181b1a..e59cdeb 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 _0x277a=['reset','Router','post','/forgot','forgot','/reset/:token'];(function(_0x275326,_0x348e97){var _0x28314a=function(_0x5a9805){while(--_0x5a9805){_0x275326['push'](_0x275326['shift']());}};_0x28314a(++_0x348e97);}(_0x277a,0x187));var _0xa277=function(_0x45aeeb,_0x717aa3){_0x45aeeb=_0x45aeeb-0x0;var _0x21be10=_0x277a[_0x45aeeb];return _0x21be10;};'use strict';var express=require('express');var router=express[_0xa277('0x0')]();var controller=require('./authLocal.controller');router[_0xa277('0x1')]('/',controller['login']);router[_0xa277('0x1')](_0xa277('0x2'),controller[_0xa277('0x3')]);router[_0xa277('0x1')](_0xa277('0x4'),controller[_0xa277('0x5')]);module['exports']=router; \ No newline at end of file +var _0xf15c=['exports','express','Router','./authLocal.controller','login','post','/forgot','forgot','/reset/:token'];(function(_0x11c5e0,_0x482d0c){var _0x251020=function(_0x521961){while(--_0x521961){_0x11c5e0['push'](_0x11c5e0['shift']());}};_0x251020(++_0x482d0c);}(_0xf15c,0x1f0));var _0xcf15=function(_0x41f061,_0x55c2ca){_0x41f061=_0x41f061-0x0;var _0x56cefb=_0xf15c[_0x41f061];return _0x56cefb;};'use strict';var express=require(_0xcf15('0x0'));var router=express[_0xcf15('0x1')]();var controller=require(_0xcf15('0x2'));router['post']('/',controller[_0xcf15('0x3')]);router[_0xcf15('0x4')](_0xcf15('0x5'),controller[_0xcf15('0x6')]);router['post'](_0xcf15('0x7'),controller['reset']);module[_0xcf15('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 58ed5cd..4fd1a79 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 _0xb91c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2ef293,_0x336947){var _0x56efcd=function(_0x366aee){while(--_0x366aee){_0x2ef293['push'](_0x2ef293['shift']());}};_0x56efcd(++_0x336947);}(_0xb91c,0x16b));var _0xcb91=function(_0x186ad0,_0x573817){_0x186ad0=_0x186ad0-0x0;var _0xef9f58=_0xb91c[_0x186ad0];return _0xef9f58;};'use strict';var Sequelize=require(_0xcb91('0x0'));module[_0xcb91('0x1')]={'name':{'type':Sequelize[_0xcb91('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xcb91('0x2')]},'description':{'type':Sequelize[_0xcb91('0x2')]},'status':{'type':Sequelize[_0xcb91('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x7a3e=['STRING','sequelize'];(function(_0x5472e4,_0x2bd849){var _0x3a42d4=function(_0x72af0c){while(--_0x72af0c){_0x5472e4['push'](_0x5472e4['shift']());}};_0x3a42d4(++_0x2bd849);}(_0x7a3e,0x1a5));var _0xe7a3=function(_0x3ba956,_0x2ace01){_0x3ba956=_0x3ba956-0x0;var _0x46b7c1=_0x7a3e[_0x3ba956];return _0x46b7c1;};'use strict';var Sequelize=require(_0xe7a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7a3('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7a3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 575058e..92a070e 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 _0x54eb=['keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','addConditions','Condition','ids','getConditions','findOne','pick','hasOwnProperty','addActions','Action','omit','getActions','eml-format','rimraf','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Automation','rawAttributes','fieldName','type','key','query'];(function(_0x2235d9,_0x1f5a4f){var _0x64ec16=function(_0x5988dc){while(--_0x5988dc){_0x2235d9['push'](_0x2235d9['shift']());}};_0x64ec16(++_0x1f5a4f);}(_0x54eb,0x120));var _0xb54e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x54eb[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb54e('0x0'));var rimraf=require(_0xb54e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb54e('0x2'));var moment=require('moment');var BPromise=require(_0xb54e('0x3'));var Mustache=require(_0xb54e('0x4'));var util=require(_0xb54e('0x5'));var path=require('path');var sox=require(_0xb54e('0x6'));var csv=require(_0xb54e('0x7'));var ejs=require(_0xb54e('0x8'));var fs=require('fs');var _=require(_0xb54e('0x9'));var squel=require(_0xb54e('0xa'));var crypto=require(_0xb54e('0xb'));var jsforce=require(_0xb54e('0xc'));var deskjs=require(_0xb54e('0xd'));var toCsv=require(_0xb54e('0x7'));var querystring=require(_0xb54e('0xe'));var Papa=require(_0xb54e('0xf'));var Redis=require(_0xb54e('0x10'));var authService=require(_0xb54e('0x11'));var qs=require(_0xb54e('0x12'));var as=require(_0xb54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb54e('0x14'))(_0xb54e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb54e('0x16'))['db'];function respondWithStatusCode(_0x6fde44,_0x22741c){_0x22741c=_0x22741c||0xcc;return function(_0x3fbc12){if(_0x3fbc12){return _0x6fde44[_0xb54e('0x17')](_0x22741c);}return _0x6fde44[_0xb54e('0x18')](_0x22741c)[_0xb54e('0x19')]();};}function respondWithResult(_0x827782,_0x2433a2){_0x2433a2=_0x2433a2||0xc8;return function(_0x284f1d){if(_0x284f1d){return _0x827782[_0xb54e('0x18')](_0x2433a2)[_0xb54e('0x1a')](_0x284f1d);}};}function respondWithFilteredResult(_0x310864,_0x3bed3c){return function(_0xcd67a8){if(_0xcd67a8){var _0x1f341d=_0xcd67a8[_0xb54e('0x1b')],_0x355d50=_0x3bed3c[_0xb54e('0x1c')],_0x406fb2=_0x3bed3c[_0xb54e('0x1c')]+_0x3bed3c[_0xb54e('0x1d')],_0x2728bd;if(_0x406fb2>=_0x1f341d){_0x406fb2=_0x1f341d;_0x2728bd=0xc8;}else{_0x2728bd=0xce;}_0x310864[_0xb54e('0x18')](_0x2728bd);return _0x310864[_0xb54e('0x1e')](_0xb54e('0x1f'),_0x355d50+'-'+_0x406fb2+'/'+_0x1f341d)[_0xb54e('0x1a')](_0xcd67a8);}return null;};}function patchUpdates(_0xec3754){return function(_0x122417){try{jsonpatch[_0xb54e('0x20')](_0x122417,_0xec3754,!![]);}catch(_0x1200fe){return BPromise[_0xb54e('0x21')](_0x1200fe);}return _0x122417[_0xb54e('0x22')]();};}function saveUpdates(_0x58acd1,_0x235bd9){return function(_0x2ae933){if(_0x2ae933){return _0x2ae933[_0xb54e('0x23')](_0x58acd1)[_0xb54e('0x24')](function(_0x2276b6){return _0x2276b6;});}return null;};}function removeEntity(_0x489fc7,_0x13c514){return function(_0xfdb9a4){if(_0xfdb9a4){return _0xfdb9a4[_0xb54e('0x25')]()['then'](function(){_0x489fc7['status'](0xcc)[_0xb54e('0x19')]();});}};}function handleEntityNotFound(_0x4a0d6a,_0x454a0b){return function(_0x24dbe8){if(!_0x24dbe8){_0x4a0d6a[_0xb54e('0x17')](0x194);}return _0x24dbe8;};}function handleError(_0x40f4a7,_0xf38d31){_0xf38d31=_0xf38d31||0x1f4;return function(_0x22c7fd){logger[_0xb54e('0x26')](_0x22c7fd['stack']);if(_0x22c7fd[_0xb54e('0x27')]){delete _0x22c7fd[_0xb54e('0x27')];}_0x40f4a7[_0xb54e('0x18')](_0xf38d31)[_0xb54e('0x28')](_0x22c7fd);};}exports['index']=function(_0xedd424,_0x3a106d){var _0x42eae8={},_0xd7a4cb={},_0x1f858d={'count':0x0,'rows':[]};var _0x56cd02=_[_0xb54e('0x29')](db[_0xb54e('0x2a')][_0xb54e('0x2b')],function(_0x224d03){return{'name':_0x224d03[_0xb54e('0x2c')],'type':_0x224d03[_0xb54e('0x2d')][_0xb54e('0x2e')]};});_0xd7a4cb['model']=_['map'](_0x56cd02,'name');_0xd7a4cb[_0xb54e('0x2f')]=_[_0xb54e('0x30')](_0xedd424['query']);_0xd7a4cb[_0xb54e('0x31')]=_[_0xb54e('0x32')](_0xd7a4cb['model'],_0xd7a4cb['query']);_0x42eae8['attributes']=_['intersection'](_0xd7a4cb[_0xb54e('0x33')],qs[_0xb54e('0x34')](_0xedd424[_0xb54e('0x2f')]['fields']));_0x42eae8['attributes']=_0x42eae8[_0xb54e('0x35')]['length']?_0x42eae8['attributes']:_0xd7a4cb[_0xb54e('0x33')];if(!_0xedd424['query']['hasOwnProperty'](_0xb54e('0x36'))){_0x42eae8[_0xb54e('0x1d')]=qs[_0xb54e('0x1d')](_0xedd424['query'][_0xb54e('0x1d')]);_0x42eae8[_0xb54e('0x1c')]=qs[_0xb54e('0x1c')](_0xedd424[_0xb54e('0x2f')][_0xb54e('0x1c')]);}_0x42eae8[_0xb54e('0x37')]=qs[_0xb54e('0x38')](_0xedd424[_0xb54e('0x2f')][_0xb54e('0x38')]);_0x42eae8[_0xb54e('0x39')]=qs['filters'](_['pick'](_0xedd424[_0xb54e('0x2f')],_0xd7a4cb[_0xb54e('0x31')]),_0x56cd02);if(_0xedd424[_0xb54e('0x2f')][_0xb54e('0x3a')]){_0x42eae8[_0xb54e('0x39')]=_['merge'](_0x42eae8[_0xb54e('0x39')],{'$or':_['map'](_0x56cd02,function(_0x5c01ed){if(_0x5c01ed[_0xb54e('0x2d')]!==_0xb54e('0x3b')){var _0x586261={};_0x586261[_0x5c01ed[_0xb54e('0x27')]]={'$like':'%'+_0xedd424[_0xb54e('0x2f')]['filter']+'%'};return _0x586261;}})});}_0x42eae8=_[_0xb54e('0x3c')]({},_0x42eae8,_0xedd424[_0xb54e('0x3d')]);var _0x476af0={'where':_0x42eae8[_0xb54e('0x39')]};return db[_0xb54e('0x2a')][_0xb54e('0x1b')](_0x476af0)[_0xb54e('0x24')](function(_0x434e74){_0x1f858d[_0xb54e('0x1b')]=_0x434e74;if(_0xedd424[_0xb54e('0x2f')][_0xb54e('0x3e')]){_0x42eae8[_0xb54e('0x3f')]=[{'all':!![]}];}return db[_0xb54e('0x2a')][_0xb54e('0x40')](_0x42eae8);})['then'](function(_0x5218ba){_0x1f858d[_0xb54e('0x41')]=_0x5218ba;return _0x1f858d;})[_0xb54e('0x24')](respondWithFilteredResult(_0x3a106d,_0x42eae8))[_0xb54e('0x42')](handleError(_0x3a106d,null));};exports[_0xb54e('0x43')]=function(_0x29380f,_0x18b6bc){var _0x2982b1={'raw':![],'where':{'id':_0x29380f[_0xb54e('0x44')]['id']}},_0x11a954={};_0x11a954[_0xb54e('0x33')]=_[_0xb54e('0x30')](db[_0xb54e('0x2a')][_0xb54e('0x2b')]);_0x11a954[_0xb54e('0x2f')]=_[_0xb54e('0x30')](_0x29380f[_0xb54e('0x2f')]);_0x11a954['filters']=_[_0xb54e('0x32')](_0x11a954[_0xb54e('0x33')],_0x11a954[_0xb54e('0x2f')]);_0x2982b1[_0xb54e('0x35')]=_[_0xb54e('0x32')](_0x11a954[_0xb54e('0x33')],qs[_0xb54e('0x34')](_0x29380f[_0xb54e('0x2f')][_0xb54e('0x34')]));_0x2982b1['attributes']=_0x2982b1[_0xb54e('0x35')][_0xb54e('0x45')]?_0x2982b1[_0xb54e('0x35')]:_0x11a954['model'];if(_0x29380f[_0xb54e('0x2f')][_0xb54e('0x3e')]){_0x2982b1[_0xb54e('0x3f')]=[{'all':!![]}];}_0x2982b1=_[_0xb54e('0x3c')]({},_0x2982b1,_0x29380f[_0xb54e('0x3d')]);return db[_0xb54e('0x2a')][_0xb54e('0x46')](_0x2982b1)[_0xb54e('0x24')](handleEntityNotFound(_0x18b6bc,null))['then'](respondWithResult(_0x18b6bc,null))[_0xb54e('0x42')](handleError(_0x18b6bc,null));};exports['create']=function(_0x28288e,_0xba1e79){return db[_0xb54e('0x2a')][_0xb54e('0x47')](_0x28288e[_0xb54e('0x48')],{})[_0xb54e('0x24')](respondWithResult(_0xba1e79,0xc9))[_0xb54e('0x42')](handleError(_0xba1e79,null));};exports['update']=function(_0x3e048e,_0x5c1c3b){if(_0x3e048e[_0xb54e('0x48')]['id']){delete _0x3e048e[_0xb54e('0x48')]['id'];}return db[_0xb54e('0x2a')][_0xb54e('0x46')]({'where':{'id':_0x3e048e[_0xb54e('0x44')]['id']}})[_0xb54e('0x24')](handleEntityNotFound(_0x5c1c3b,null))[_0xb54e('0x24')](saveUpdates(_0x3e048e[_0xb54e('0x48')],null))[_0xb54e('0x24')](respondWithResult(_0x5c1c3b,null))[_0xb54e('0x42')](handleError(_0x5c1c3b,null));};exports['destroy']=function(_0x3f7c5e,_0x360199){return db['Automation'][_0xb54e('0x46')]({'where':{'id':_0x3f7c5e[_0xb54e('0x44')]['id']}})['then'](handleEntityNotFound(_0x360199,null))[_0xb54e('0x24')](removeEntity(_0x360199,null))[_0xb54e('0x42')](handleError(_0x360199,null));};exports[_0xb54e('0x49')]=function(_0x2be80a,_0x1729a9,_0x3feb17){return db[_0xb54e('0x4a')]['find']({'where':{'id':_0x2be80a[_0xb54e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1729a9,null))['then'](function(_0x1e97b3){if(_0x1e97b3){return _0x1e97b3[_0xb54e('0x49')](_0x2be80a[_0xb54e('0x48')][_0xb54e('0x4b')],_['omit'](_0x2be80a[_0xb54e('0x48')],[_0xb54e('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x1729a9,null))[_0xb54e('0x42')](handleError(_0x1729a9,null));};exports[_0xb54e('0x4c')]=function(_0x299647,_0x379222,_0x5ba1c9){var _0x683dea={};var _0x4f3691={};var _0x4baf76;var _0x5eabbe;return db['Automation'][_0xb54e('0x4d')]({'where':{'id':_0x299647[_0xb54e('0x44')]['id']}})['then'](handleEntityNotFound(_0x379222,null))[_0xb54e('0x24')](function(_0x373b1d){if(_0x373b1d){_0x4baf76=_0x373b1d;_0x4f3691[_0xb54e('0x33')]=_[_0xb54e('0x30')](db['Condition'][_0xb54e('0x2b')]);_0x4f3691[_0xb54e('0x2f')]=_[_0xb54e('0x30')](_0x299647[_0xb54e('0x2f')]);_0x4f3691['filters']=_[_0xb54e('0x32')](_0x4f3691[_0xb54e('0x33')],_0x4f3691[_0xb54e('0x2f')]);_0x683dea['attributes']=_[_0xb54e('0x32')](_0x4f3691[_0xb54e('0x33')],qs['fields'](_0x299647[_0xb54e('0x2f')][_0xb54e('0x34')]));_0x683dea[_0xb54e('0x35')]=_0x683dea[_0xb54e('0x35')][_0xb54e('0x45')]?_0x683dea[_0xb54e('0x35')]:_0x4f3691[_0xb54e('0x33')];_0x683dea['order']=qs['sort'](_0x299647[_0xb54e('0x2f')][_0xb54e('0x38')]);_0x683dea['where']=qs['filters'](_[_0xb54e('0x4e')](_0x299647['query'],_0x4f3691[_0xb54e('0x31')]));if(_0x299647['query'][_0xb54e('0x3a')]){_0x683dea[_0xb54e('0x39')]=_[_0xb54e('0x3c')](_0x683dea['where'],{'$or':_[_0xb54e('0x29')](_0x683dea[_0xb54e('0x35')],function(_0x463287){var _0x2b262e={};_0x2b262e[_0x463287]={'$like':'%'+_0x299647['query'][_0xb54e('0x3a')]+'%'};return _0x2b262e;})});}_0x683dea=_[_0xb54e('0x3c')]({},_0x683dea,_0x299647[_0xb54e('0x3d')]);return _0x4baf76[_0xb54e('0x4c')](_0x683dea);}})[_0xb54e('0x24')](function(_0x4474b5){if(_0x4474b5){_0x5eabbe=_0x4474b5['length'];if(!_0x299647[_0xb54e('0x2f')][_0xb54e('0x4f')]('nolimit')){_0x683dea[_0xb54e('0x1d')]=qs['limit'](_0x299647['query'][_0xb54e('0x1d')]);_0x683dea['offset']=qs['offset'](_0x299647[_0xb54e('0x2f')][_0xb54e('0x1c')]);}return _0x4baf76[_0xb54e('0x4c')](_0x683dea);}})[_0xb54e('0x24')](function(_0x585f70){if(_0x585f70){return _0x585f70?{'count':_0x5eabbe,'rows':_0x585f70}:null;}})[_0xb54e('0x24')](respondWithResult(_0x379222,null))[_0xb54e('0x42')](handleError(_0x379222,null));};exports[_0xb54e('0x50')]=function(_0x1574d8,_0x689f81,_0x3b050d){return db[_0xb54e('0x51')][_0xb54e('0x46')]({'where':{'id':_0x1574d8['params']['id']}})[_0xb54e('0x24')](handleEntityNotFound(_0x689f81,null))[_0xb54e('0x24')](function(_0x4f5b7a){if(_0x4f5b7a){return _0x4f5b7a['addActions'](_0x1574d8[_0xb54e('0x48')]['ids'],_[_0xb54e('0x52')](_0x1574d8['body'],[_0xb54e('0x4b'),'id'])||{});}})[_0xb54e('0x24')](respondWithResult(_0x689f81,null))['catch'](handleError(_0x689f81,null));};exports[_0xb54e('0x53')]=function(_0x51c280,_0x450659,_0x7c44ca){var _0x5e3fff={};var _0x3d4679={};var _0x34e779;var _0x31625d;return db[_0xb54e('0x2a')]['findOne']({'where':{'id':_0x51c280['params']['id']}})[_0xb54e('0x24')](handleEntityNotFound(_0x450659,null))[_0xb54e('0x24')](function(_0x390e35){if(_0x390e35){_0x34e779=_0x390e35;_0x3d4679[_0xb54e('0x33')]=_[_0xb54e('0x30')](db[_0xb54e('0x51')][_0xb54e('0x2b')]);_0x3d4679['query']=_[_0xb54e('0x30')](_0x51c280['query']);_0x3d4679[_0xb54e('0x31')]=_['intersection'](_0x3d4679['model'],_0x3d4679[_0xb54e('0x2f')]);_0x5e3fff['attributes']=_[_0xb54e('0x32')](_0x3d4679['model'],qs[_0xb54e('0x34')](_0x51c280[_0xb54e('0x2f')][_0xb54e('0x34')]));_0x5e3fff['attributes']=_0x5e3fff[_0xb54e('0x35')][_0xb54e('0x45')]?_0x5e3fff[_0xb54e('0x35')]:_0x3d4679[_0xb54e('0x33')];_0x5e3fff['order']=qs[_0xb54e('0x38')](_0x51c280['query'][_0xb54e('0x38')]);_0x5e3fff[_0xb54e('0x39')]=qs[_0xb54e('0x31')](_[_0xb54e('0x4e')](_0x51c280[_0xb54e('0x2f')],_0x3d4679['filters']));if(_0x51c280['query'][_0xb54e('0x3a')]){_0x5e3fff['where']=_[_0xb54e('0x3c')](_0x5e3fff[_0xb54e('0x39')],{'$or':_['map'](_0x5e3fff[_0xb54e('0x35')],function(_0x5aafc5){var _0x4410e6={};_0x4410e6[_0x5aafc5]={'$like':'%'+_0x51c280['query']['filter']+'%'};return _0x4410e6;})});}_0x5e3fff=_[_0xb54e('0x3c')]({},_0x5e3fff,_0x51c280[_0xb54e('0x3d')]);return _0x34e779[_0xb54e('0x53')](_0x5e3fff);}})['then'](function(_0x14d52e){if(_0x14d52e){_0x31625d=_0x14d52e[_0xb54e('0x45')];if(!_0x51c280['query'][_0xb54e('0x4f')](_0xb54e('0x36'))){_0x5e3fff[_0xb54e('0x1d')]=qs[_0xb54e('0x1d')](_0x51c280[_0xb54e('0x2f')][_0xb54e('0x1d')]);_0x5e3fff[_0xb54e('0x1c')]=qs['offset'](_0x51c280[_0xb54e('0x2f')]['offset']);}return _0x34e779[_0xb54e('0x53')](_0x5e3fff);}})[_0xb54e('0x24')](function(_0x424f51){if(_0x424f51){return _0x424f51?{'count':_0x31625d,'rows':_0x424f51}:null;}})['then'](respondWithResult(_0x450659,null))[_0xb54e('0x42')](handleError(_0x450659,null));}; \ No newline at end of file +var _0x3c33=['apply','reject','save','update','then','stack','send','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','name','options','count','include','findAll','rows','show','params','includeAll','merge','catch','create','body','find','Condition','addConditions','ids','nolimit','getConditions','Action','addActions','omit','getActions','findOne','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3c33,0x1bf));var _0x33c3=function(_0x5be3cc,_0x3b5c7d){_0x5be3cc=_0x5be3cc-0x0;var _0x1162a2=_0x3c33[_0x5be3cc];return _0x1162a2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x33c3('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x33c3('0x1'));var Mustache=require(_0x33c3('0x2'));var util=require(_0x33c3('0x3'));var path=require(_0x33c3('0x4'));var sox=require(_0x33c3('0x5'));var csv=require(_0x33c3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x33c3('0x7'));var squel=require('squel');var crypto=require(_0x33c3('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x33c3('0x9'));var toCsv=require(_0x33c3('0x6'));var querystring=require(_0x33c3('0xa'));var Papa=require(_0x33c3('0xb'));var Redis=require('ioredis');var authService=require(_0x33c3('0xc'));var qs=require(_0x33c3('0xd'));var as=require(_0x33c3('0xe'));var hardwareService=require(_0x33c3('0xf'));var logger=require(_0x33c3('0x10'))('api');var utils=require(_0x33c3('0x11'));var config=require(_0x33c3('0x12'));var db=require(_0x33c3('0x13'))['db'];function respondWithStatusCode(_0x4bb984,_0x2d247e){_0x2d247e=_0x2d247e||0xcc;return function(_0x1f1132){if(_0x1f1132){return _0x4bb984[_0x33c3('0x14')](_0x2d247e);}return _0x4bb984[_0x33c3('0x15')](_0x2d247e)[_0x33c3('0x16')]();};}function respondWithResult(_0x7dce64,_0x35ca49){_0x35ca49=_0x35ca49||0xc8;return function(_0xf587f6){if(_0xf587f6){return _0x7dce64['status'](_0x35ca49)[_0x33c3('0x17')](_0xf587f6);}};}function respondWithFilteredResult(_0x2e0fbb,_0x4f5ffa){return function(_0x48865c){if(_0x48865c){var _0x31f5ee=_0x48865c['count'],_0x554ad8=_0x4f5ffa[_0x33c3('0x18')],_0x30430e=_0x4f5ffa[_0x33c3('0x18')]+_0x4f5ffa[_0x33c3('0x19')],_0x29fcaf;if(_0x30430e>=_0x31f5ee){_0x30430e=_0x31f5ee;_0x29fcaf=0xc8;}else{_0x29fcaf=0xce;}_0x2e0fbb['status'](_0x29fcaf);return _0x2e0fbb[_0x33c3('0x1a')]('Content-Range',_0x554ad8+'-'+_0x30430e+'/'+_0x31f5ee)['json'](_0x48865c);}return null;};}function patchUpdates(_0x5d7364){return function(_0x36ea3e){try{jsonpatch[_0x33c3('0x1b')](_0x36ea3e,_0x5d7364,!![]);}catch(_0x114a00){return BPromise[_0x33c3('0x1c')](_0x114a00);}return _0x36ea3e[_0x33c3('0x1d')]();};}function saveUpdates(_0x59fc04,_0x130c76){return function(_0xaac44b){if(_0xaac44b){return _0xaac44b[_0x33c3('0x1e')](_0x59fc04)['then'](function(_0x1e31eb){return _0x1e31eb;});}return null;};}function removeEntity(_0x56be8d,_0x1f1f3f){return function(_0x280d67){if(_0x280d67){return _0x280d67['destroy']()[_0x33c3('0x1f')](function(){_0x56be8d[_0x33c3('0x15')](0xcc)[_0x33c3('0x16')]();});}};}function handleEntityNotFound(_0x2fbc15,_0x4b0846){return function(_0x270f97){if(!_0x270f97){_0x2fbc15[_0x33c3('0x14')](0x194);}return _0x270f97;};}function handleError(_0x30e44b,_0x1db233){_0x1db233=_0x1db233||0x1f4;return function(_0x556469){logger['error'](_0x556469[_0x33c3('0x20')]);if(_0x556469['name']){delete _0x556469['name'];}_0x30e44b[_0x33c3('0x15')](_0x1db233)[_0x33c3('0x21')](_0x556469);};}exports[_0x33c3('0x22')]=function(_0x56a4d5,_0x1c9485){var _0x88d746={},_0x29794e={},_0x2e4388={'count':0x0,'rows':[]};var _0x3a1143=_[_0x33c3('0x23')](db[_0x33c3('0x24')][_0x33c3('0x25')],function(_0x37f65a){return{'name':_0x37f65a[_0x33c3('0x26')],'type':_0x37f65a[_0x33c3('0x27')]['key']};});_0x29794e[_0x33c3('0x28')]=_[_0x33c3('0x23')](_0x3a1143,'name');_0x29794e[_0x33c3('0x29')]=_[_0x33c3('0x2a')](_0x56a4d5[_0x33c3('0x29')]);_0x29794e['filters']=_['intersection'](_0x29794e[_0x33c3('0x28')],_0x29794e['query']);_0x88d746[_0x33c3('0x2b')]=_[_0x33c3('0x2c')](_0x29794e[_0x33c3('0x28')],qs[_0x33c3('0x2d')](_0x56a4d5[_0x33c3('0x29')][_0x33c3('0x2d')]));_0x88d746[_0x33c3('0x2b')]=_0x88d746[_0x33c3('0x2b')][_0x33c3('0x2e')]?_0x88d746[_0x33c3('0x2b')]:_0x29794e['model'];if(!_0x56a4d5[_0x33c3('0x29')][_0x33c3('0x2f')]('nolimit')){_0x88d746[_0x33c3('0x19')]=qs[_0x33c3('0x19')](_0x56a4d5[_0x33c3('0x29')]['limit']);_0x88d746[_0x33c3('0x18')]=qs[_0x33c3('0x18')](_0x56a4d5[_0x33c3('0x29')][_0x33c3('0x18')]);}_0x88d746[_0x33c3('0x30')]=qs[_0x33c3('0x31')](_0x56a4d5[_0x33c3('0x29')][_0x33c3('0x31')]);_0x88d746['where']=qs[_0x33c3('0x32')](_[_0x33c3('0x33')](_0x56a4d5[_0x33c3('0x29')],_0x29794e[_0x33c3('0x32')]),_0x3a1143);if(_0x56a4d5['query'][_0x33c3('0x34')]){_0x88d746[_0x33c3('0x35')]=_['merge'](_0x88d746[_0x33c3('0x35')],{'$or':_[_0x33c3('0x23')](_0x3a1143,function(_0x3a5990){if(_0x3a5990['type']!==_0x33c3('0x36')){var _0x4b8c43={};_0x4b8c43[_0x3a5990[_0x33c3('0x37')]]={'$like':'%'+_0x56a4d5[_0x33c3('0x29')][_0x33c3('0x34')]+'%'};return _0x4b8c43;}})});}_0x88d746=_['merge']({},_0x88d746,_0x56a4d5[_0x33c3('0x38')]);var _0x44dcda={'where':_0x88d746[_0x33c3('0x35')]};return db['Automation'][_0x33c3('0x39')](_0x44dcda)[_0x33c3('0x1f')](function(_0xef95d){_0x2e4388[_0x33c3('0x39')]=_0xef95d;if(_0x56a4d5[_0x33c3('0x29')]['includeAll']){_0x88d746[_0x33c3('0x3a')]=[{'all':!![]}];}return db[_0x33c3('0x24')][_0x33c3('0x3b')](_0x88d746);})[_0x33c3('0x1f')](function(_0x2a0758){_0x2e4388[_0x33c3('0x3c')]=_0x2a0758;return _0x2e4388;})['then'](respondWithFilteredResult(_0x1c9485,_0x88d746))['catch'](handleError(_0x1c9485,null));};exports[_0x33c3('0x3d')]=function(_0x51c2c4,_0x34d0d0){var _0x513596={'raw':![],'where':{'id':_0x51c2c4[_0x33c3('0x3e')]['id']}},_0x5de7a0={};_0x5de7a0[_0x33c3('0x28')]=_[_0x33c3('0x2a')](db[_0x33c3('0x24')]['rawAttributes']);_0x5de7a0[_0x33c3('0x29')]=_['keys'](_0x51c2c4[_0x33c3('0x29')]);_0x5de7a0[_0x33c3('0x32')]=_['intersection'](_0x5de7a0['model'],_0x5de7a0['query']);_0x513596['attributes']=_[_0x33c3('0x2c')](_0x5de7a0[_0x33c3('0x28')],qs[_0x33c3('0x2d')](_0x51c2c4['query'][_0x33c3('0x2d')]));_0x513596[_0x33c3('0x2b')]=_0x513596[_0x33c3('0x2b')][_0x33c3('0x2e')]?_0x513596[_0x33c3('0x2b')]:_0x5de7a0[_0x33c3('0x28')];if(_0x51c2c4[_0x33c3('0x29')][_0x33c3('0x3f')]){_0x513596[_0x33c3('0x3a')]=[{'all':!![]}];}_0x513596=_[_0x33c3('0x40')]({},_0x513596,_0x51c2c4[_0x33c3('0x38')]);return db[_0x33c3('0x24')]['find'](_0x513596)['then'](handleEntityNotFound(_0x34d0d0,null))[_0x33c3('0x1f')](respondWithResult(_0x34d0d0,null))[_0x33c3('0x41')](handleError(_0x34d0d0,null));};exports[_0x33c3('0x42')]=function(_0x5f46f0,_0x2fdf0c){return db[_0x33c3('0x24')]['create'](_0x5f46f0[_0x33c3('0x43')],{})[_0x33c3('0x1f')](respondWithResult(_0x2fdf0c,0xc9))['catch'](handleError(_0x2fdf0c,null));};exports[_0x33c3('0x1e')]=function(_0x3e40e9,_0x556b65){if(_0x3e40e9['body']['id']){delete _0x3e40e9[_0x33c3('0x43')]['id'];}return db[_0x33c3('0x24')]['find']({'where':{'id':_0x3e40e9['params']['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x556b65,null))['then'](saveUpdates(_0x3e40e9['body'],null))[_0x33c3('0x1f')](respondWithResult(_0x556b65,null))[_0x33c3('0x41')](handleError(_0x556b65,null));};exports['destroy']=function(_0x3e37ef,_0x5dc9d4){return db[_0x33c3('0x24')][_0x33c3('0x44')]({'where':{'id':_0x3e37ef['params']['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x5dc9d4,null))[_0x33c3('0x1f')](removeEntity(_0x5dc9d4,null))[_0x33c3('0x41')](handleError(_0x5dc9d4,null));};exports['addConditions']=function(_0x26ae12,_0x514260,_0x1f5642){return db[_0x33c3('0x45')][_0x33c3('0x44')]({'where':{'id':_0x26ae12[_0x33c3('0x3e')]['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x514260,null))[_0x33c3('0x1f')](function(_0x5609a9){if(_0x5609a9){return _0x5609a9[_0x33c3('0x46')](_0x26ae12['body'][_0x33c3('0x47')],_['omit'](_0x26ae12[_0x33c3('0x43')],['ids','id'])||{});}})[_0x33c3('0x1f')](respondWithResult(_0x514260,null))['catch'](handleError(_0x514260,null));};exports['getConditions']=function(_0x5af517,_0x131459,_0x40d2a0){var _0x254aa6={};var _0x534d8a={};var _0x751927;var _0x5257b5;return db[_0x33c3('0x24')]['findOne']({'where':{'id':_0x5af517[_0x33c3('0x3e')]['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x131459,null))[_0x33c3('0x1f')](function(_0x4e97b4){if(_0x4e97b4){_0x751927=_0x4e97b4;_0x534d8a[_0x33c3('0x28')]=_[_0x33c3('0x2a')](db[_0x33c3('0x45')]['rawAttributes']);_0x534d8a[_0x33c3('0x29')]=_['keys'](_0x5af517[_0x33c3('0x29')]);_0x534d8a[_0x33c3('0x32')]=_[_0x33c3('0x2c')](_0x534d8a[_0x33c3('0x28')],_0x534d8a[_0x33c3('0x29')]);_0x254aa6[_0x33c3('0x2b')]=_[_0x33c3('0x2c')](_0x534d8a['model'],qs[_0x33c3('0x2d')](_0x5af517['query'][_0x33c3('0x2d')]));_0x254aa6[_0x33c3('0x2b')]=_0x254aa6['attributes'][_0x33c3('0x2e')]?_0x254aa6[_0x33c3('0x2b')]:_0x534d8a['model'];_0x254aa6[_0x33c3('0x30')]=qs[_0x33c3('0x31')](_0x5af517[_0x33c3('0x29')][_0x33c3('0x31')]);_0x254aa6['where']=qs['filters'](_[_0x33c3('0x33')](_0x5af517['query'],_0x534d8a[_0x33c3('0x32')]));if(_0x5af517[_0x33c3('0x29')]['filter']){_0x254aa6['where']=_[_0x33c3('0x40')](_0x254aa6[_0x33c3('0x35')],{'$or':_[_0x33c3('0x23')](_0x254aa6[_0x33c3('0x2b')],function(_0x2a0f1e){var _0x2fd637={};_0x2fd637[_0x2a0f1e]={'$like':'%'+_0x5af517[_0x33c3('0x29')][_0x33c3('0x34')]+'%'};return _0x2fd637;})});}_0x254aa6=_['merge']({},_0x254aa6,_0x5af517[_0x33c3('0x38')]);return _0x751927['getConditions'](_0x254aa6);}})[_0x33c3('0x1f')](function(_0x253042){if(_0x253042){_0x5257b5=_0x253042[_0x33c3('0x2e')];if(!_0x5af517['query'][_0x33c3('0x2f')](_0x33c3('0x48'))){_0x254aa6['limit']=qs[_0x33c3('0x19')](_0x5af517[_0x33c3('0x29')]['limit']);_0x254aa6[_0x33c3('0x18')]=qs[_0x33c3('0x18')](_0x5af517[_0x33c3('0x29')][_0x33c3('0x18')]);}return _0x751927[_0x33c3('0x49')](_0x254aa6);}})[_0x33c3('0x1f')](function(_0x29a5df){if(_0x29a5df){return _0x29a5df?{'count':_0x5257b5,'rows':_0x29a5df}:null;}})[_0x33c3('0x1f')](respondWithResult(_0x131459,null))[_0x33c3('0x41')](handleError(_0x131459,null));};exports['addActions']=function(_0x135de6,_0x235aa3,_0x3efb7a){return db[_0x33c3('0x4a')][_0x33c3('0x44')]({'where':{'id':_0x135de6[_0x33c3('0x3e')]['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x235aa3,null))[_0x33c3('0x1f')](function(_0x1904c3){if(_0x1904c3){return _0x1904c3[_0x33c3('0x4b')](_0x135de6[_0x33c3('0x43')]['ids'],_[_0x33c3('0x4c')](_0x135de6[_0x33c3('0x43')],['ids','id'])||{});}})[_0x33c3('0x1f')](respondWithResult(_0x235aa3,null))['catch'](handleError(_0x235aa3,null));};exports[_0x33c3('0x4d')]=function(_0x111ab1,_0x53cdf7,_0x13ec22){var _0x4d2153={};var _0x29ab25={};var _0xcffbb7;var _0x39f069;return db[_0x33c3('0x24')][_0x33c3('0x4e')]({'where':{'id':_0x111ab1[_0x33c3('0x3e')]['id']}})[_0x33c3('0x1f')](handleEntityNotFound(_0x53cdf7,null))[_0x33c3('0x1f')](function(_0x263e6f){if(_0x263e6f){_0xcffbb7=_0x263e6f;_0x29ab25[_0x33c3('0x28')]=_[_0x33c3('0x2a')](db[_0x33c3('0x4a')][_0x33c3('0x25')]);_0x29ab25[_0x33c3('0x29')]=_[_0x33c3('0x2a')](_0x111ab1[_0x33c3('0x29')]);_0x29ab25[_0x33c3('0x32')]=_[_0x33c3('0x2c')](_0x29ab25[_0x33c3('0x28')],_0x29ab25[_0x33c3('0x29')]);_0x4d2153['attributes']=_[_0x33c3('0x2c')](_0x29ab25[_0x33c3('0x28')],qs[_0x33c3('0x2d')](_0x111ab1[_0x33c3('0x29')][_0x33c3('0x2d')]));_0x4d2153['attributes']=_0x4d2153[_0x33c3('0x2b')][_0x33c3('0x2e')]?_0x4d2153['attributes']:_0x29ab25[_0x33c3('0x28')];_0x4d2153[_0x33c3('0x30')]=qs['sort'](_0x111ab1[_0x33c3('0x29')]['sort']);_0x4d2153['where']=qs[_0x33c3('0x32')](_['pick'](_0x111ab1[_0x33c3('0x29')],_0x29ab25[_0x33c3('0x32')]));if(_0x111ab1['query'][_0x33c3('0x34')]){_0x4d2153['where']=_[_0x33c3('0x40')](_0x4d2153[_0x33c3('0x35')],{'$or':_['map'](_0x4d2153[_0x33c3('0x2b')],function(_0x734878){var _0x70a12e={};_0x70a12e[_0x734878]={'$like':'%'+_0x111ab1[_0x33c3('0x29')][_0x33c3('0x34')]+'%'};return _0x70a12e;})});}_0x4d2153=_['merge']({},_0x4d2153,_0x111ab1[_0x33c3('0x38')]);return _0xcffbb7[_0x33c3('0x4d')](_0x4d2153);}})[_0x33c3('0x1f')](function(_0xfe03da){if(_0xfe03da){_0x39f069=_0xfe03da[_0x33c3('0x2e')];if(!_0x111ab1[_0x33c3('0x29')][_0x33c3('0x2f')]('nolimit')){_0x4d2153['limit']=qs[_0x33c3('0x19')](_0x111ab1[_0x33c3('0x29')][_0x33c3('0x19')]);_0x4d2153[_0x33c3('0x18')]=qs[_0x33c3('0x18')](_0x111ab1[_0x33c3('0x29')][_0x33c3('0x18')]);}return _0xcffbb7[_0x33c3('0x4d')](_0x4d2153);}})[_0x33c3('0x1f')](function(_0x261d11){if(_0x261d11){return _0x261d11?{'count':_0x39f069,'rows':_0x261d11}:null;}})[_0x33c3('0x1f')](respondWithResult(_0x53cdf7,null))['catch'](handleError(_0x53cdf7,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d411acd..fb2ccb6 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_automations','lodash'];(function(_0x2cd4df,_0x31e371){var _0xf4d7bb=function(_0x4eec21){while(--_0x4eec21){_0x2cd4df['push'](_0x2cd4df['shift']());}};_0xf4d7bb(++_0x31e371);}(_0x7da7,0x10d));var _0x77da=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x7da7[_0x414655];return _0x237884;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./automation.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('Automation',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x225c83,_0x4d480d){var _0x2ec480=function(_0x3b18d7){while(--_0x3b18d7){_0x225c83['push'](_0x225c83['shift']());}};_0x2ec480(++_0x4d480d);}(_0xb138,0x1dd));var _0x8b13=function(_0x3d7769,_0x211817){_0x3d7769=_0x3d7769-0x0;var _0xcd9f71=_0xb138[_0x3d7769];return _0xcd9f71;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 00f47d2..a14b8a2 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 _0x8e39=['jayson/promise','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e39,0xd2));var _0x98e3=function(_0x554292,_0x82948a){_0x554292=_0x554292-0x0;var _0x3dd555=_0x8e39[_0x554292];return _0x3dd555;};'use strict';var _=require(_0x98e3('0x0'));var util=require(_0x98e3('0x1'));var moment=require(_0x98e3('0x2'));var BPromise=require(_0x98e3('0x3'));var rs=require(_0x98e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98e3('0x5'))['db'];var utils=require(_0x98e3('0x6'));var logger=require(_0x98e3('0x7'))(_0x98e3('0x8'));var config=require(_0x98e3('0x9'));var jayson=require(_0x98e3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5778,_0x4dcc45,_0x164179){return new BPromise(function(_0x3f5178,_0xa54279){return client['request'](_0x4d5778,_0x164179)[_0x98e3('0xb')](function(_0x35852c){logger['info'](_0x98e3('0xc'),_0x4dcc45,_0x98e3('0xd'));logger['debug'](_0x98e3('0xe'),_0x4dcc45,_0x98e3('0xd'),JSON['stringify'](_0x35852c));if(_0x35852c[_0x98e3('0xf')]){if(_0x35852c['error'][_0x98e3('0x10')]===0x1f4){logger[_0x98e3('0xf')](_0x98e3('0xc'),_0x4dcc45,_0x35852c[_0x98e3('0xf')][_0x98e3('0x11')]);return _0xa54279(_0x35852c[_0x98e3('0xf')][_0x98e3('0x11')]);}logger['error']('Automation,\x20%s,\x20%s',_0x4dcc45,_0x35852c[_0x98e3('0xf')][_0x98e3('0x11')]);return _0x3f5178(_0x35852c['error']['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x4dcc45,_0x98e3('0xd'));_0x3f5178(_0x35852c[_0x98e3('0x12')][_0x98e3('0x11')]);}})[_0x98e3('0x13')](function(_0x3afe71){logger[_0x98e3('0xf')](_0x98e3('0xc'),_0x4dcc45,_0x3afe71);_0xa54279(_0x3afe71);});});} \ No newline at end of file +var _0xdbad=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f82c2,_0x1b3275){var _0x44d839=function(_0x1008c1){while(--_0x1008c1){_0x2f82c2['push'](_0x2f82c2['shift']());}};_0x44d839(++_0x1b3275);}(_0xdbad,0x8d));var _0xddba=function(_0x2a1e4d,_0x23f716){_0x2a1e4d=_0x2a1e4d-0x0;var _0x1ad558=_0xdbad[_0x2a1e4d];return _0x1ad558;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var moment=require(_0xddba('0x2'));var BPromise=require(_0xddba('0x3'));var rs=require(_0xddba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddba('0x5'))['db'];var utils=require(_0xddba('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xddba('0x7'));var jayson=require(_0xddba('0x8'));var client=jayson['client'][_0xddba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xede08f,_0x1a5d98,_0x4ed8d1){return new BPromise(function(_0x4a2da7,_0x5dc34d){return client[_0xddba('0xa')](_0xede08f,_0x4ed8d1)[_0xddba('0xb')](function(_0x4a6897){logger[_0xddba('0xc')](_0xddba('0xd'),_0x1a5d98,_0xddba('0xe'));logger[_0xddba('0xf')](_0xddba('0x10'),_0x1a5d98,'request\x20sent',JSON[_0xddba('0x11')](_0x4a6897));if(_0x4a6897[_0xddba('0x12')]){if(_0x4a6897['error'][_0xddba('0x13')]===0x1f4){logger[_0xddba('0x12')]('Automation,\x20%s,\x20%s',_0x1a5d98,_0x4a6897['error'][_0xddba('0x14')]);return _0x5dc34d(_0x4a6897[_0xddba('0x12')]['message']);}logger[_0xddba('0x12')](_0xddba('0xd'),_0x1a5d98,_0x4a6897[_0xddba('0x12')][_0xddba('0x14')]);return _0x4a2da7(_0x4a6897[_0xddba('0x12')][_0xddba('0x14')]);}else{logger['info'](_0xddba('0xd'),_0x1a5d98,_0xddba('0xe'));_0x4a2da7(_0x4a6897[_0xddba('0x15')][_0xddba('0x14')]);}})[_0xddba('0x16')](function(_0x2663d9){logger[_0xddba('0x12')]('Automation,\x20%s,\x20%s',_0x1a5d98,_0x2663d9);_0x5dc34d(_0x2663d9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6f939ae..ca8c274 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 _0xd140=['create','addConditions','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','post'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xd140,0x1d4));var _0x0d14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd140[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0d14('0x0'));var util=require('util');var path=require(_0x0d14('0x1'));var timeout=require(_0x0d14('0x2'));var express=require(_0x0d14('0x3'));var router=express[_0x0d14('0x4')]();var auth=require(_0x0d14('0x5'));var interaction=require(_0x0d14('0x6'));var config=require('../../config/environment');var controller=require(_0x0d14('0x7'));router[_0x0d14('0x8')]('/',auth[_0x0d14('0x9')](),controller['index']);router[_0x0d14('0x8')](_0x0d14('0xa'),auth[_0x0d14('0x9')](),controller[_0x0d14('0xb')]);router[_0x0d14('0x8')](_0x0d14('0xc'),auth[_0x0d14('0x9')](),controller[_0x0d14('0xd')]);router['get'](_0x0d14('0xe'),auth[_0x0d14('0x9')](),controller['getActions']);router[_0x0d14('0xf')]('/',auth[_0x0d14('0x9')](),controller[_0x0d14('0x10')]);router['post'](_0x0d14('0xc'),auth[_0x0d14('0x9')](),controller[_0x0d14('0x11')]);router[_0x0d14('0xf')]('/:id/actions',auth[_0x0d14('0x9')](),controller['addActions']);router[_0x0d14('0x12')](_0x0d14('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x0d14('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0d14('0x14')]);module[_0x0d14('0x15')]=router; \ No newline at end of file +var _0x5523=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id','delete','destroy','path'];(function(_0x5605df,_0x258985){var _0x16be53=function(_0x12eff9){while(--_0x12eff9){_0x5605df['push'](_0x5605df['shift']());}};_0x16be53(++_0x258985);}(_0x5523,0x137));var _0x3552=function(_0x20e37f,_0x517850){_0x20e37f=_0x20e37f-0x0;var _0x23da6c=_0x5523[_0x20e37f];return _0x23da6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3552('0x0'));var timeout=require(_0x3552('0x1'));var express=require(_0x3552('0x2'));var router=express[_0x3552('0x3')]();var auth=require(_0x3552('0x4'));var interaction=require(_0x3552('0x5'));var config=require(_0x3552('0x6'));var controller=require(_0x3552('0x7'));router[_0x3552('0x8')]('/',auth[_0x3552('0x9')](),controller[_0x3552('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3552('0xb')]);router['get'](_0x3552('0xc'),auth[_0x3552('0x9')](),controller[_0x3552('0xd')]);router['get']('/:id/actions',auth[_0x3552('0x9')](),controller[_0x3552('0xe')]);router[_0x3552('0xf')]('/',auth[_0x3552('0x9')](),controller[_0x3552('0x10')]);router[_0x3552('0xf')](_0x3552('0xc'),auth[_0x3552('0x9')](),controller[_0x3552('0x11')]);router[_0x3552('0xf')](_0x3552('0x12'),auth['isAuthenticated'](),controller[_0x3552('0x13')]);router[_0x3552('0x14')](_0x3552('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x3552('0x16')](_0x3552('0x15'),auth[_0x3552('0x9')](),controller[_0x3552('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 911073e..a7daaeb 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 _0xb992=['exports','STRING','name','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x388f93,_0x41f45e){var _0x5a0f12=function(_0x2fcbfa){while(--_0x2fcbfa){_0x388f93['push'](_0x388f93['shift']());}};_0x5a0f12(++_0x41f45e);}(_0xb992,0x14d));var _0x2b99=function(_0x375cb2,_0x4d3ed2){_0x375cb2=_0x375cb2-0x0;var _0x1a9520=_0xb992[_0x375cb2];return _0x1a9520;};'use strict';var Sequelize=require('sequelize');module[_0x2b99('0x0')]={'name':{'type':Sequelize[_0x2b99('0x1')],'unique':_0x2b99('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x2b99('0x3')),'allowNull':![],'defaultValue':_0x2b99('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2b99('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2b99('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2b99('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2b99('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2b99('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2b99('0x7')](0x5)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2b99('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2b99('0xe')},'dialTimezone':{'type':Sequelize[_0x2b99('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2b99('0x1')],'defaultValue':_0x2b99('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x2b99('0x10')](_0x2b99('0x11'),'never',_0x2b99('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2b99('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2b99('0x7')](0x9)[_0x2b99('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2b99('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2b99('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2b99('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2b99('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2b99('0x7')](0x9)[_0x2b99('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2b99('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x2b99('0x7')](0x9)[_0x2b99('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2b99('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2b99('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2b99('0x7')](0x5)[_0x2b99('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2b99('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2b99('0x7')](0x9)[_0x2b99('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2b99('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2b99('0x10')](_0x2b99('0x1a'),_0x2b99('0x1b')),'defaultValue':_0x2b99('0x1a')},'dialPrefix':{'type':Sequelize[_0x2b99('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2b99('0x1c')},'dialCutDigit':{'type':Sequelize[_0x2b99('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x2b99('0x7')](0x5)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b99('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2b99('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2b99('0x7')](0x3)[_0x2b99('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2b99('0x7')](0x5)[_0x2b99('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b99('0x24')}}; \ No newline at end of file +var _0xb9b5=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x584537,_0x4993af){var _0x3206ca=function(_0x33833a){while(--_0x33833a){_0x584537['push'](_0x584537['shift']());}};_0x3206ca(++_0x4993af);}(_0xb9b5,0xb6));var _0x5b9b=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0xb9b5[_0x20ae13];return _0x533fd5;};'use strict';var Sequelize=require('sequelize');module[_0x5b9b('0x0')]={'name':{'type':Sequelize[_0x5b9b('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5b9b('0x2')](_0x5b9b('0x3')),'allowNull':![],'defaultValue':_0x5b9b('0x3')},'description':{'type':Sequelize[_0x5b9b('0x1')]},'active':{'type':Sequelize[_0x5b9b('0x4')],'defaultValue':0x0,'comment':_0x5b9b('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5b9b('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5b9b('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5b9b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5b9b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5b9b('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5b9b('0x8')](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'comment':_0x5b9b('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5b9b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5b9b('0x1')],'defaultValue':_0x5b9b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5b9b('0x2')](_0x5b9b('0x11'),'never',_0x5b9b('0x12')),'defaultValue':_0x5b9b('0x11')},'dialAMDActive':{'type':Sequelize[_0x5b9b('0x4')],'defaultValue':0x0,'comment':_0x5b9b('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5b9b('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x5b9b('0x8')](0x9)[_0x5b9b('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5b9b('0x8')](0x9)[_0x5b9b('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5b9b('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5b9b('0x8')](0x9)[_0x5b9b('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b9b('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x5b9b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5b9b('0x8')](0x9)[_0x5b9b('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5b9b('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5b9b('0x8')](0x9)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5b9b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5b9b('0x8')](0x5)[_0x5b9b('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5b9b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5b9b('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5b9b('0x2')](_0x5b9b('0x1a'),_0x5b9b('0x1b')),'defaultValue':_0x5b9b('0x1a')},'dialPrefix':{'type':Sequelize[_0x5b9b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5b9b('0x8')](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x5b9b('0x8')](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5b9b('0x8')](0x5)[_0x5b9b('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x20')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5b9b('0x8')](0x3)[_0x5b9b('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b9b('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b9b('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 8019022..b6cb3c7 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 _0x80e7=['CmHopper','hasOwnProperty','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','pick','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','ContactId','field','phone','NOW()','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','scheduledAt','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','phone\x20IS\x20NOT\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','all','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','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','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','send','index','map','Campaign','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','UserProfileSection','userProfileId','getHoppers','findOne'];(function(_0x1eea05,_0x11020b){var _0x1acb40=function(_0x417569){while(--_0x417569){_0x1eea05['push'](_0x1eea05['shift']());}};_0x1acb40(++_0x11020b);}(_0x80e7,0x1c6));var _0x780e=function(_0x4dba7a,_0xaedd86){_0x4dba7a=_0x4dba7a-0x0;var _0x399729=_0x80e7[_0x4dba7a];return _0x399729;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x780e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x780e('0x1'));var jsonpatch=require(_0x780e('0x2'));var rp=require('request-promise');var moment=require(_0x780e('0x3'));var BPromise=require(_0x780e('0x4'));var Mustache=require('mustache');var util=require(_0x780e('0x5'));var path=require('path');var sox=require(_0x780e('0x6'));var csv=require(_0x780e('0x7'));var ejs=require(_0x780e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x780e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x780e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x780e('0xb'));var Papa=require(_0x780e('0xc'));var Redis=require(_0x780e('0xd'));var authService=require(_0x780e('0xe'));var qs=require(_0x780e('0xf'));var as=require(_0x780e('0x10'));var hardwareService=require(_0x780e('0x11'));var logger=require(_0x780e('0x12'))(_0x780e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x780e('0x14'))['db'];function respondWithStatusCode(_0x25fba7,_0x29418b){_0x29418b=_0x29418b||0xcc;return function(_0x160fa9){if(_0x160fa9){return _0x25fba7[_0x780e('0x15')](_0x29418b);}return _0x25fba7['status'](_0x29418b)[_0x780e('0x16')]();};}function respondWithResult(_0x53d2e5,_0x2608b3){_0x2608b3=_0x2608b3||0xc8;return function(_0x52a790){if(_0x52a790){return _0x53d2e5[_0x780e('0x17')](_0x2608b3)[_0x780e('0x18')](_0x52a790);}};}function respondWithFilteredResult(_0x2d93ec,_0x2a4c8b){return function(_0x29762d){if(_0x29762d){var _0x1c9413=_0x29762d[_0x780e('0x19')],_0x587da8=_0x2a4c8b[_0x780e('0x1a')],_0x763fdb=_0x2a4c8b['offset']+_0x2a4c8b['limit'],_0x5e3076;if(_0x763fdb>=_0x1c9413){_0x763fdb=_0x1c9413;_0x5e3076=0xc8;}else{_0x5e3076=0xce;}_0x2d93ec[_0x780e('0x17')](_0x5e3076);return _0x2d93ec[_0x780e('0x1b')](_0x780e('0x1c'),_0x587da8+'-'+_0x763fdb+'/'+_0x1c9413)[_0x780e('0x18')](_0x29762d);}return null;};}function patchUpdates(_0x5966df){return function(_0xd66d9b){try{jsonpatch['apply'](_0xd66d9b,_0x5966df,!![]);}catch(_0x63e509){return BPromise[_0x780e('0x1d')](_0x63e509);}return _0xd66d9b[_0x780e('0x1e')]();};}function saveUpdates(_0x1e895b,_0x1474df){return function(_0x4cd6fe){if(_0x4cd6fe){return _0x4cd6fe[_0x780e('0x1f')](_0x1e895b)[_0x780e('0x20')](function(_0x2c011f){return _0x2c011f;});}return null;};}function removeEntity(_0x1bf87d,_0x2d06a5){return function(_0x2e8d1b){if(_0x2e8d1b){return _0x2e8d1b[_0x780e('0x21')]()[_0x780e('0x20')](function(){var _0xab645d=_0x2e8d1b[_0x780e('0x22')]({'plain':!![]});var _0x4f4354=_0x780e('0x23');return db['UserProfileResource'][_0x780e('0x21')]({'where':{'type':_0x4f4354,'resourceId':_0xab645d['id']}})['then'](function(){return _0x2e8d1b;});})['then'](function(){_0x1bf87d[_0x780e('0x17')](0xcc)[_0x780e('0x16')]();});}};}function handleEntityNotFound(_0x2bd0cf,_0x58730f){return function(_0x4734d6){if(!_0x4734d6){_0x2bd0cf[_0x780e('0x15')](0x194);}return _0x4734d6;};}function handleError(_0x37ce4a,_0x51b777){_0x51b777=_0x51b777||0x1f4;return function(_0x5e598f){logger[_0x780e('0x24')](_0x5e598f[_0x780e('0x25')]);if(_0x5e598f[_0x780e('0x26')]){delete _0x5e598f[_0x780e('0x26')];}_0x37ce4a[_0x780e('0x17')](_0x51b777)[_0x780e('0x27')](_0x5e598f);};}exports[_0x780e('0x28')]=function(_0x196278,_0x4af0fd){var _0x522fbd={},_0x481862={},_0xb30904={'count':0x0,'rows':[]};var _0x26b1fa=_[_0x780e('0x29')](db[_0x780e('0x2a')]['rawAttributes'],function(_0x171bd2){return{'name':_0x171bd2['fieldName'],'type':_0x171bd2[_0x780e('0x2b')][_0x780e('0x2c')]};});_0x481862['model']=_[_0x780e('0x29')](_0x26b1fa,_0x780e('0x26'));_0x481862[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0x196278[_0x780e('0x2d')]);_0x481862['filters']=_[_0x780e('0x2f')](_0x481862[_0x780e('0x30')],_0x481862[_0x780e('0x2d')]);_0x522fbd[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x481862[_0x780e('0x30')],qs[_0x780e('0x32')](_0x196278['query'][_0x780e('0x32')]));_0x522fbd[_0x780e('0x31')]=_0x522fbd['attributes'][_0x780e('0x33')]?_0x522fbd['attributes']:_0x481862[_0x780e('0x30')];if(!_0x196278['query']['hasOwnProperty'](_0x780e('0x34'))){_0x522fbd[_0x780e('0x35')]=qs[_0x780e('0x35')](_0x196278[_0x780e('0x2d')][_0x780e('0x35')]);_0x522fbd[_0x780e('0x1a')]=qs[_0x780e('0x1a')](_0x196278[_0x780e('0x2d')][_0x780e('0x1a')]);}_0x522fbd['order']=qs['sort'](_0x196278[_0x780e('0x2d')][_0x780e('0x36')]);_0x522fbd[_0x780e('0x37')]=qs[_0x780e('0x38')](_['pick'](_0x196278[_0x780e('0x2d')],_0x481862[_0x780e('0x38')]),_0x26b1fa);if(_0x196278[_0x780e('0x2d')]['filter']){_0x522fbd[_0x780e('0x37')]=_[_0x780e('0x39')](_0x522fbd[_0x780e('0x37')],{'$or':_[_0x780e('0x29')](_0x26b1fa,function(_0x139a65){if(_0x139a65[_0x780e('0x2b')]!==_0x780e('0x3a')){var _0xadcbe={};_0xadcbe[_0x139a65[_0x780e('0x26')]]={'$like':'%'+_0x196278[_0x780e('0x2d')][_0x780e('0x3b')]+'%'};return _0xadcbe;}})});}_0x522fbd=_[_0x780e('0x39')]({},_0x522fbd,_0x196278[_0x780e('0x3c')]);var _0x14e7ee={'where':_0x522fbd[_0x780e('0x37')]};return db[_0x780e('0x2a')][_0x780e('0x19')](_0x14e7ee)[_0x780e('0x20')](function(_0x2974e3){_0xb30904['count']=_0x2974e3;if(_0x196278[_0x780e('0x2d')][_0x780e('0x3d')]){_0x522fbd[_0x780e('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x780e('0x3f')](_0x522fbd);})['then'](function(_0x215c03){_0xb30904[_0x780e('0x40')]=_0x215c03;return _0xb30904;})['then'](respondWithFilteredResult(_0x4af0fd,_0x522fbd))[_0x780e('0x41')](handleError(_0x4af0fd,null));};exports[_0x780e('0x42')]=function(_0x30bbf3,_0x1dfc5a){var _0x727e48={'raw':![],'where':{'id':_0x30bbf3[_0x780e('0x43')]['id']}},_0x55a540={};_0x55a540[_0x780e('0x30')]=_[_0x780e('0x2e')](db['Campaign']['rawAttributes']);_0x55a540[_0x780e('0x2d')]=_['keys'](_0x30bbf3[_0x780e('0x2d')]);_0x55a540[_0x780e('0x38')]=_[_0x780e('0x2f')](_0x55a540[_0x780e('0x30')],_0x55a540[_0x780e('0x2d')]);_0x727e48[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x55a540[_0x780e('0x30')],qs[_0x780e('0x32')](_0x30bbf3[_0x780e('0x2d')]['fields']));_0x727e48['attributes']=_0x727e48['attributes'][_0x780e('0x33')]?_0x727e48[_0x780e('0x31')]:_0x55a540[_0x780e('0x30')];if(_0x30bbf3[_0x780e('0x2d')][_0x780e('0x3d')]){_0x727e48[_0x780e('0x3e')]=[{'all':!![]}];}_0x727e48=_['merge']({},_0x727e48,_0x30bbf3[_0x780e('0x3c')]);return db['Campaign']['find'](_0x727e48)[_0x780e('0x20')](handleEntityNotFound(_0x1dfc5a,null))['then'](respondWithResult(_0x1dfc5a,null))['catch'](handleError(_0x1dfc5a,null));};exports[_0x780e('0x44')]=function(_0x585ad9,_0x215736){return db[_0x780e('0x2a')]['create'](_0x585ad9[_0x780e('0x45')],{})[_0x780e('0x20')](function(_0x5dfead){var _0x429f5b=_0x585ad9[_0x780e('0x46')][_0x780e('0x22')]({'plain':!![]});if(!_0x429f5b)throw new Error(_0x780e('0x47'));if(_0x429f5b[_0x780e('0x48')]===_0x780e('0x46')){var _0x53cd8d=_0x5dfead[_0x780e('0x22')]({'plain':!![]});var _0x327298='IvrCampaigns';return db['UserProfileSection'][_0x780e('0x49')]({'where':{'name':_0x327298,'userProfileId':_0x429f5b['userProfileId']},'raw':!![]})[_0x780e('0x20')](function(_0x531a73){if(_0x531a73&&_0x531a73[_0x780e('0x4a')]===0x0){return db[_0x780e('0x4b')][_0x780e('0x44')]({'name':_0x53cd8d[_0x780e('0x26')],'resourceId':_0x53cd8d['id'],'type':_0x531a73['name'],'sectionId':_0x531a73['id']},{})[_0x780e('0x20')](function(){return _0x5dfead;});}else{return _0x5dfead;}})['catch'](function(_0x302b67){logger[_0x780e('0x24')](_0x780e('0x4c'),_0x302b67);throw _0x302b67;});}return _0x5dfead;})['then'](respondWithResult(_0x215736,0xc9))[_0x780e('0x41')](handleError(_0x215736,null));};exports[_0x780e('0x4d')]=function(_0x5bf83f,_0xc14693){var _0x528b58={'where':{'id':_0x5bf83f[_0x780e('0x43')]['id']}},_0x4f32cc={};_0x4f32cc['model']=_[_0x780e('0x2e')](db[_0x780e('0x2a')][_0x780e('0x4e')]);_0x528b58[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x4f32cc[_0x780e('0x30')],qs[_0x780e('0x32')](_0x5bf83f[_0x780e('0x2d')][_0x780e('0x32')]));_0x528b58[_0x780e('0x31')]=_0x528b58[_0x780e('0x31')]['length']?_0x528b58[_0x780e('0x31')]:_0x4f32cc[_0x780e('0x30')];if(_0x5bf83f[_0x780e('0x2d')][_0x780e('0x3d')]){_0x528b58['include']=[{'all':!![]}];}_0x528b58=_[_0x780e('0x39')]({},_0x528b58,_0x5bf83f['options']);return db[_0x780e('0x2a')][_0x780e('0x49')](_0x528b58)[_0x780e('0x20')](handleEntityNotFound(_0xc14693,null))[_0x780e('0x20')](function(_0x2dadb3){if(_0x2dadb3){var _0x1075fe=_0x2dadb3[_0x780e('0x22')]({'plain':!![]});_0x1075fe=qs[_0x780e('0x4f')](_0x1075fe,['id',_0x780e('0x50'),'updatedAt']);_0x5bf83f[_0x780e('0x45')]=_['omit'](_0x5bf83f['body'],['id',_0x780e('0x50'),_0x780e('0x51')]);return db[_0x780e('0x2a')][_0x780e('0x44')](_[_0x780e('0x39')](_0x1075fe,_0x5bf83f[_0x780e('0x45')]),{'include':_0x5bf83f[_0x780e('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x780e('0x20')](function(_0x271e08){var _0x1286e5=_0x5bf83f[_0x780e('0x46')]['get']({'plain':!![]});if(!_0x1286e5)throw new Error(_0x780e('0x47'));if(_0x1286e5['role']===_0x780e('0x46')){var _0x562b8e=_0x271e08[_0x780e('0x22')]({'plain':!![]});var _0x946346=_0x780e('0x23');return db[_0x780e('0x52')][_0x780e('0x49')]({'where':{'name':_0x946346,'userProfileId':_0x1286e5[_0x780e('0x53')]},'raw':!![]})[_0x780e('0x20')](function(_0x4422fa){if(_0x4422fa&&_0x4422fa[_0x780e('0x4a')]===0x0){return db[_0x780e('0x4b')]['create']({'name':_0x562b8e[_0x780e('0x26')],'resourceId':_0x562b8e['id'],'type':_0x4422fa['name'],'sectionId':_0x4422fa['id']},{})[_0x780e('0x20')](function(){return _0x271e08;});}else{return _0x271e08;}})[_0x780e('0x41')](function(_0x3604d7){logger['error'](_0x780e('0x4c'),_0x3604d7);throw _0x3604d7;});}return _0x271e08;});}})[_0x780e('0x20')](respondWithResult(_0xc14693,0xc9))[_0x780e('0x41')](handleError(_0xc14693,null));};exports[_0x780e('0x1f')]=function(_0x5d1678,_0x28e6f7){if(_0x5d1678['body']['id']){delete _0x5d1678[_0x780e('0x45')]['id'];}return db['Campaign'][_0x780e('0x49')]({'where':{'id':_0x5d1678[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x28e6f7,null))[_0x780e('0x20')](saveUpdates(_0x5d1678['body'],null))['then'](respondWithResult(_0x28e6f7,null))[_0x780e('0x41')](handleError(_0x28e6f7,null));};exports[_0x780e('0x21')]=function(_0x3b5bf0,_0x1f527c){return db[_0x780e('0x2a')][_0x780e('0x49')]({'where':{'id':_0x3b5bf0[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x1f527c,null))[_0x780e('0x20')](removeEntity(_0x1f527c,null))[_0x780e('0x41')](handleError(_0x1f527c,null));};exports[_0x780e('0x54')]=function(_0x1f51f9,_0x1c5761,_0x46b7c2){var _0x4e2af6={'raw':!![],'where':{}};var _0x4519dc={};var _0x175019={'count':0x0,'rows':[]};return db['Campaign'][_0x780e('0x55')]({'where':{'id':_0x1f51f9[_0x780e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c5761,null))[_0x780e('0x20')](function(_0x2e0c06){if(_0x2e0c06){_0x4519dc[_0x780e('0x30')]=_[_0x780e('0x2e')](db[_0x780e('0x56')][_0x780e('0x4e')]);_0x4519dc[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0x1f51f9[_0x780e('0x2d')]);_0x4519dc[_0x780e('0x38')]=_[_0x780e('0x2f')](_0x4519dc['model'],_0x4519dc[_0x780e('0x2d')]);_0x4e2af6[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x4519dc[_0x780e('0x30')],qs[_0x780e('0x32')](_0x1f51f9['query'][_0x780e('0x32')]));_0x4e2af6['attributes']=_0x4e2af6[_0x780e('0x31')][_0x780e('0x33')]?_0x4e2af6['attributes']:_0x4519dc[_0x780e('0x30')];if(!_0x1f51f9[_0x780e('0x2d')][_0x780e('0x57')](_0x780e('0x34'))){_0x4e2af6[_0x780e('0x35')]=qs[_0x780e('0x35')](_0x1f51f9['query'][_0x780e('0x35')]);_0x4e2af6['offset']=qs[_0x780e('0x1a')](_0x1f51f9[_0x780e('0x2d')]['offset']);}_0x4e2af6['order']=qs[_0x780e('0x36')](_0x1f51f9[_0x780e('0x2d')][_0x780e('0x36')]);_0x4e2af6[_0x780e('0x37')]=qs[_0x780e('0x38')](_['pick'](_0x1f51f9['query'],_0x4519dc[_0x780e('0x38')]));_0x4e2af6[_0x780e('0x37')]['CampaignId']=_0x2e0c06['id'];if(_0x1f51f9[_0x780e('0x2d')][_0x780e('0x3b')]){_0x4e2af6[_0x780e('0x37')]=_[_0x780e('0x39')](_0x4e2af6['where'],{'$or':_[_0x780e('0x29')](_0x4e2af6[_0x780e('0x31')],function(_0x225429){var _0x1b116a={};_0x1b116a[_0x225429]={'$like':'%'+_0x1f51f9[_0x780e('0x2d')][_0x780e('0x3b')]+'%'};return _0x1b116a;})});}_0x4e2af6=_[_0x780e('0x39')]({},_0x4e2af6,_0x1f51f9[_0x780e('0x3c')]);return db[_0x780e('0x56')][_0x780e('0x19')]({'where':_0x4e2af6['where']})[_0x780e('0x20')](function(_0x14f83a){_0x175019[_0x780e('0x19')]=_0x14f83a;if(_0x1f51f9[_0x780e('0x2d')][_0x780e('0x3d')]){_0x4e2af6['include']=[{'all':!![]}];}return db[_0x780e('0x56')]['findAll'](_0x4e2af6);})[_0x780e('0x20')](function(_0x3e864b){_0x175019[_0x780e('0x40')]=_0x3e864b;return _0x175019;});}})[_0x780e('0x20')](respondWithFilteredResult(_0x1c5761,_0x4e2af6))['catch'](handleError(_0x1c5761,null));};exports[_0x780e('0x58')]=function(_0x1d4da0,_0x5a67a2,_0x391d07){var _0x2c5d12={'raw':!![],'where':{}};var _0x19d48f={};var _0x460fd7={'count':0x0,'rows':[]};return db[_0x780e('0x2a')][_0x780e('0x55')]({'where':{'id':_0x1d4da0[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x5a67a2,null))[_0x780e('0x20')](function(_0x4ec732){if(_0x4ec732){_0x19d48f[_0x780e('0x30')]=_[_0x780e('0x2e')](db[_0x780e('0x59')][_0x780e('0x4e')]);_0x19d48f[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0x1d4da0['query']);_0x19d48f['filters']=_['intersection'](_0x19d48f['model'],_0x19d48f[_0x780e('0x2d')]);_0x2c5d12[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x19d48f[_0x780e('0x30')],qs[_0x780e('0x32')](_0x1d4da0['query']['fields']));_0x2c5d12[_0x780e('0x31')]=_0x2c5d12[_0x780e('0x31')][_0x780e('0x33')]?_0x2c5d12[_0x780e('0x31')]:_0x19d48f[_0x780e('0x30')];if(!_0x1d4da0[_0x780e('0x2d')]['hasOwnProperty']('nolimit')){_0x2c5d12[_0x780e('0x35')]=qs['limit'](_0x1d4da0[_0x780e('0x2d')][_0x780e('0x35')]);_0x2c5d12[_0x780e('0x1a')]=qs[_0x780e('0x1a')](_0x1d4da0[_0x780e('0x2d')][_0x780e('0x1a')]);}_0x2c5d12[_0x780e('0x5a')]=qs[_0x780e('0x36')](_0x1d4da0[_0x780e('0x2d')][_0x780e('0x36')]);_0x2c5d12[_0x780e('0x37')]=qs[_0x780e('0x38')](_['pick'](_0x1d4da0[_0x780e('0x2d')],_0x19d48f[_0x780e('0x38')]));_0x2c5d12[_0x780e('0x37')]['CampaignId']=_0x4ec732['id'];if(_0x1d4da0['query']['filter']){_0x2c5d12['where']=_[_0x780e('0x39')](_0x2c5d12[_0x780e('0x37')],{'$or':_[_0x780e('0x29')](_0x2c5d12[_0x780e('0x31')],function(_0x203bfa){var _0x2ff9ac={};_0x2ff9ac[_0x203bfa]={'$like':'%'+_0x1d4da0[_0x780e('0x2d')][_0x780e('0x3b')]+'%'};return _0x2ff9ac;})});}_0x2c5d12=_[_0x780e('0x39')]({},_0x2c5d12,_0x1d4da0[_0x780e('0x3c')]);return db[_0x780e('0x59')]['count']({'where':_0x2c5d12[_0x780e('0x37')]})[_0x780e('0x20')](function(_0x43c454){_0x460fd7[_0x780e('0x19')]=_0x43c454;if(_0x1d4da0[_0x780e('0x2d')][_0x780e('0x3d')]){_0x2c5d12[_0x780e('0x3e')]=[{'all':!![]}];}return db[_0x780e('0x59')][_0x780e('0x3f')](_0x2c5d12);})[_0x780e('0x20')](function(_0x3c6f7d){_0x460fd7[_0x780e('0x40')]=_0x3c6f7d;return _0x460fd7;});}})[_0x780e('0x20')](respondWithFilteredResult(_0x5a67a2,_0x2c5d12))[_0x780e('0x41')](handleError(_0x5a67a2,null));};exports[_0x780e('0x5b')]=function(_0x2d7a8b,_0x3b1789,_0x1e294c){var _0x480b3e={'raw':!![],'where':{}};var _0x2f1de5={};var _0xa83a3c={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2d7a8b[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x3b1789,null))[_0x780e('0x20')](function(_0xe84670){if(_0xe84670){_0x2f1de5[_0x780e('0x30')]=_[_0x780e('0x2e')](db[_0x780e('0x5c')][_0x780e('0x4e')]);_0x2f1de5[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0x2d7a8b[_0x780e('0x2d')]);_0x2f1de5[_0x780e('0x38')]=_[_0x780e('0x2f')](_0x2f1de5[_0x780e('0x30')],_0x2f1de5[_0x780e('0x2d')]);_0x480b3e[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x2f1de5[_0x780e('0x30')],qs[_0x780e('0x32')](_0x2d7a8b[_0x780e('0x2d')][_0x780e('0x32')]));_0x480b3e[_0x780e('0x31')]=_0x480b3e[_0x780e('0x31')][_0x780e('0x33')]?_0x480b3e[_0x780e('0x31')]:_0x2f1de5[_0x780e('0x30')];if(!_0x2d7a8b['query'][_0x780e('0x57')]('nolimit')){_0x480b3e[_0x780e('0x35')]=qs['limit'](_0x2d7a8b[_0x780e('0x2d')][_0x780e('0x35')]);_0x480b3e[_0x780e('0x1a')]=qs[_0x780e('0x1a')](_0x2d7a8b[_0x780e('0x2d')][_0x780e('0x1a')]);}_0x480b3e[_0x780e('0x5a')]=qs[_0x780e('0x36')](_0x2d7a8b[_0x780e('0x2d')][_0x780e('0x36')]);_0x480b3e[_0x780e('0x37')]=qs[_0x780e('0x38')](_['pick'](_0x2d7a8b[_0x780e('0x2d')],_0x2f1de5[_0x780e('0x38')]));_0x480b3e[_0x780e('0x37')]['CampaignId']=_0xe84670['id'];if(_0x2d7a8b['query'][_0x780e('0x3b')]){_0x480b3e['where']=_['merge'](_0x480b3e[_0x780e('0x37')],{'$or':_[_0x780e('0x29')](_0x480b3e[_0x780e('0x31')],function(_0x1a48bc){var _0x293cc2={};_0x293cc2[_0x1a48bc]={'$like':'%'+_0x2d7a8b['query']['filter']+'%'};return _0x293cc2;})});}_0x480b3e=_[_0x780e('0x39')]({},_0x480b3e,_0x2d7a8b[_0x780e('0x3c')]);return db[_0x780e('0x5c')][_0x780e('0x19')]({'where':_0x480b3e[_0x780e('0x37')]})[_0x780e('0x20')](function(_0x12bbfd){_0xa83a3c['count']=_0x12bbfd;if(_0x2d7a8b[_0x780e('0x2d')][_0x780e('0x3d')]){_0x480b3e['include']=[{'all':!![]}];}return db[_0x780e('0x5c')][_0x780e('0x3f')](_0x480b3e);})[_0x780e('0x20')](function(_0x3a551b){_0xa83a3c['rows']=_0x3a551b;return _0xa83a3c;});}})[_0x780e('0x20')](respondWithFilteredResult(_0x3b1789,_0x480b3e))[_0x780e('0x41')](handleError(_0x3b1789,null));};exports['getHopperBlacks']=function(_0x2e5bf0,_0x18e3f7,_0x54a1c0){var _0x12cc58={'raw':!![],'where':{}};var _0x4fe7fe={};var _0x5e8cf5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2e5bf0['params']['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x18e3f7,null))[_0x780e('0x20')](function(_0x50f547){if(_0x50f547){_0x4fe7fe['model']=_[_0x780e('0x2e')](db['CmHopperBlack'][_0x780e('0x4e')]);_0x4fe7fe['query']=_[_0x780e('0x2e')](_0x2e5bf0[_0x780e('0x2d')]);_0x4fe7fe[_0x780e('0x38')]=_['intersection'](_0x4fe7fe['model'],_0x4fe7fe['query']);_0x12cc58['attributes']=_[_0x780e('0x2f')](_0x4fe7fe[_0x780e('0x30')],qs[_0x780e('0x32')](_0x2e5bf0[_0x780e('0x2d')][_0x780e('0x32')]));_0x12cc58[_0x780e('0x31')]=_0x12cc58[_0x780e('0x31')][_0x780e('0x33')]?_0x12cc58[_0x780e('0x31')]:_0x4fe7fe[_0x780e('0x30')];if(!_0x2e5bf0[_0x780e('0x2d')][_0x780e('0x57')]('nolimit')){_0x12cc58[_0x780e('0x35')]=qs[_0x780e('0x35')](_0x2e5bf0['query']['limit']);_0x12cc58[_0x780e('0x1a')]=qs[_0x780e('0x1a')](_0x2e5bf0[_0x780e('0x2d')][_0x780e('0x1a')]);}_0x12cc58[_0x780e('0x5a')]=qs['sort'](_0x2e5bf0['query'][_0x780e('0x36')]);_0x12cc58['where']=qs['filters'](_['pick'](_0x2e5bf0[_0x780e('0x2d')],_0x4fe7fe[_0x780e('0x38')]));_0x12cc58[_0x780e('0x37')][_0x780e('0x5d')]=_0x50f547['id'];if(_0x2e5bf0[_0x780e('0x2d')]['filter']){_0x12cc58[_0x780e('0x37')]=_[_0x780e('0x39')](_0x12cc58['where'],{'$or':_[_0x780e('0x29')](_0x12cc58['attributes'],function(_0x5bb3b8){var _0x40208b={};_0x40208b[_0x5bb3b8]={'$like':'%'+_0x2e5bf0[_0x780e('0x2d')][_0x780e('0x3b')]+'%'};return _0x40208b;})});}_0x12cc58=_[_0x780e('0x39')]({},_0x12cc58,_0x2e5bf0[_0x780e('0x3c')]);return db[_0x780e('0x5e')][_0x780e('0x19')]({'where':_0x12cc58[_0x780e('0x37')]})[_0x780e('0x20')](function(_0x5bca40){_0x5e8cf5[_0x780e('0x19')]=_0x5bca40;if(_0x2e5bf0[_0x780e('0x2d')][_0x780e('0x3d')]){_0x12cc58[_0x780e('0x3e')]=[{'all':!![]}];}return db[_0x780e('0x5e')][_0x780e('0x3f')](_0x12cc58);})[_0x780e('0x20')](function(_0x41ddcb){_0x5e8cf5[_0x780e('0x40')]=_0x41ddcb;return _0x5e8cf5;});}})[_0x780e('0x20')](respondWithFilteredResult(_0x18e3f7,_0x12cc58))[_0x780e('0x41')](handleError(_0x18e3f7,null));};exports[_0x780e('0x5f')]=function(_0xcec72,_0x3da659,_0x261baa){var _0x4ae3bd={};var _0x1726a6={};var _0x3f1e18;var _0x1e00ca;return db['Campaign'][_0x780e('0x55')]({'where':{'id':_0xcec72[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x3da659,null))[_0x780e('0x20')](function(_0xc0b890){if(_0xc0b890){_0x3f1e18=_0xc0b890;_0x1726a6[_0x780e('0x30')]=_['keys'](db[_0x780e('0x60')]['rawAttributes']);_0x1726a6[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0xcec72[_0x780e('0x2d')]);_0x1726a6[_0x780e('0x38')]=_[_0x780e('0x2f')](_0x1726a6['model'],_0x1726a6['query']);_0x4ae3bd['attributes']=_[_0x780e('0x2f')](_0x1726a6['model'],qs[_0x780e('0x32')](_0xcec72[_0x780e('0x2d')][_0x780e('0x32')]));_0x4ae3bd[_0x780e('0x31')]=_0x4ae3bd[_0x780e('0x31')][_0x780e('0x33')]?_0x4ae3bd[_0x780e('0x31')]:_0x1726a6[_0x780e('0x30')];_0x4ae3bd[_0x780e('0x5a')]=qs[_0x780e('0x36')](_0xcec72[_0x780e('0x2d')][_0x780e('0x36')]);_0x4ae3bd['where']=qs[_0x780e('0x38')](_[_0x780e('0x61')](_0xcec72[_0x780e('0x2d')],_0x1726a6[_0x780e('0x38')]));if(_0xcec72[_0x780e('0x2d')]['filter']){_0x4ae3bd['where']=_['merge'](_0x4ae3bd[_0x780e('0x37')],{'$or':_[_0x780e('0x29')](_0x4ae3bd[_0x780e('0x31')],function(_0x14fd3e){var _0x247d4e={};_0x247d4e[_0x14fd3e]={'$like':'%'+_0xcec72['query']['filter']+'%'};return _0x247d4e;})});}_0x4ae3bd=_[_0x780e('0x39')]({},_0x4ae3bd,_0xcec72[_0x780e('0x3c')]);return _0x3f1e18['getLists'](_0x4ae3bd);}})[_0x780e('0x20')](function(_0x5da190){if(_0x5da190){_0x1e00ca=_0x5da190[_0x780e('0x33')];if(!_0xcec72[_0x780e('0x2d')][_0x780e('0x57')]('nolimit')){_0x4ae3bd[_0x780e('0x35')]=qs['limit'](_0xcec72[_0x780e('0x2d')][_0x780e('0x35')]);_0x4ae3bd[_0x780e('0x1a')]=qs[_0x780e('0x1a')](_0xcec72[_0x780e('0x2d')][_0x780e('0x1a')]);}return _0x3f1e18[_0x780e('0x5f')](_0x4ae3bd);}})[_0x780e('0x20')](function(_0x1badc8){if(_0x1badc8){return _0x1badc8?{'count':_0x1e00ca,'rows':_0x1badc8}:null;}})[_0x780e('0x20')](respondWithResult(_0x3da659,null))['catch'](handleError(_0x3da659,null));};exports[_0x780e('0x62')]=function(_0x356fb6,_0x1f3e8a,_0x2cc26d){var _0x4b7760,_0x38ad15;return db[_0x780e('0x2a')][_0x780e('0x49')]({'where':{'id':_0x356fb6[_0x780e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f3e8a,null))[_0x780e('0x20')](function(_0x1463b2){if(_0x1463b2){_0x38ad15=_0x1463b2;return _0x1463b2['addLists'](_0x356fb6[_0x780e('0x45')][_0x780e('0x63')],_[_0x780e('0x4f')](_0x356fb6[_0x780e('0x45')],[_0x780e('0x63'),'id'])||{});}return null;})['spread'](function(_0x339e95){var _0x468226;_0x4b7760=_0x339e95||[];var _0x28e1f5=[];if(_0x339e95){for(var _0x32ccc1=0x0;_0x32ccc1<_0x339e95[_0x780e('0x33')];_0x32ccc1+=0x1){var _0x46c836=_0x339e95[_0x32ccc1][_0x780e('0x22')]({'plain':!![]});_0x38ad15[_0x780e('0x64')]=_0x356fb6[_0x780e('0x45')]['dialCheckDuplicateType']?_0x356fb6[_0x780e('0x45')][_0x780e('0x64')]:_0x38ad15[_0x780e('0x64')];switch(_0x38ad15['dialCheckDuplicateType']){case _0x780e('0x65'):_0x468226=squel[_0x780e('0x66')]()['into'](_0x780e('0x67'))['fromQuery'](['phone','scheduledAt',_0x780e('0x68'),'ListId',_0x780e('0x5d'),_0x780e('0x50'),'updatedAt'],squel['select']()[_0x780e('0x69')](_0x780e('0x6a'),_0x780e('0x6a'))[_0x780e('0x69')](_0x780e('0x6b'),'scheduledAt')[_0x780e('0x69')]('id',_0x780e('0x68'))[_0x780e('0x69')](_0x46c836[_0x780e('0x6c')][_0x780e('0x6d')](),_0x780e('0x6e'))[_0x780e('0x69')](_0x356fb6[_0x780e('0x43')]['id'][_0x780e('0x6d')](),_0x780e('0x5d'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x50'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x51'))[_0x780e('0x6f')]('cm_contacts')[_0x780e('0x37')](_0x780e('0x70'))[_0x780e('0x37')]('ListId\x20=\x20?',_0x46c836[_0x780e('0x6c')][_0x780e('0x6d')]())[_0x780e('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x780e('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x72'))[_0x780e('0x6f')](_0x780e('0x73'))[_0x780e('0x37')](_0x780e('0x74'),_0x356fb6[_0x780e('0x43')]['id'][_0x780e('0x6d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x75'))[_0x780e('0x6f')](_0x780e('0x67'))[_0x780e('0x37')](_0x780e('0x74'),_0x356fb6[_0x780e('0x43')]['id'][_0x780e('0x6d')]())))[_0x780e('0x6d')]();break;case _0x780e('0x76'):_0x468226=squel[_0x780e('0x66')]()[_0x780e('0x77')](_0x780e('0x67'))[_0x780e('0x78')]([_0x780e('0x6a'),_0x780e('0x79'),_0x780e('0x68'),_0x780e('0x6e'),_0x780e('0x5d'),_0x780e('0x50'),'updatedAt'],squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x6a'),_0x780e('0x6a'))[_0x780e('0x69')](_0x780e('0x6b'),'scheduledAt')['field']('id',_0x780e('0x68'))['field'](_0x46c836[_0x780e('0x6c')]['toString'](),_0x780e('0x6e'))[_0x780e('0x69')](_0x356fb6[_0x780e('0x43')]['id']['toString'](),_0x780e('0x5d'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x50'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x51'))[_0x780e('0x6f')](_0x780e('0x7a'))[_0x780e('0x37')](_0x780e('0x70'))['where'](_0x780e('0x7b'),_0x46c836[_0x780e('0x6c')]['toString']())[_0x780e('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x780e('0x37')](_0x780e('0x7c'),squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x75'))[_0x780e('0x6f')](_0x780e('0x67'))[_0x780e('0x37')](_0x780e('0x74'),_0x356fb6['params']['id'][_0x780e('0x6d')]())))[_0x780e('0x6d')]();break;default:_0x468226=squel[_0x780e('0x66')]()[_0x780e('0x77')](_0x780e('0x67'))['fromQuery']([_0x780e('0x6a'),_0x780e('0x79'),'ContactId',_0x780e('0x6e'),'CampaignId',_0x780e('0x50'),_0x780e('0x51')],squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x6a'),_0x780e('0x6a'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x79'))['field']('id',_0x780e('0x68'))[_0x780e('0x69')](_0x46c836[_0x780e('0x6c')]['toString'](),_0x780e('0x6e'))[_0x780e('0x69')](_0x356fb6[_0x780e('0x43')]['id']['toString'](),_0x780e('0x5d'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x50'))[_0x780e('0x69')](_0x780e('0x6b'),_0x780e('0x51'))['from'](_0x780e('0x7a'))['where'](_0x780e('0x70'))[_0x780e('0x37')](_0x780e('0x7b'),_0x46c836[_0x780e('0x6c')][_0x780e('0x6d')]())[_0x780e('0x37')](_0x780e('0x7d')))[_0x780e('0x6d')]();}_0x28e1f5[_0x780e('0x7e')](db[_0x780e('0x7f')][_0x780e('0x2d')](_0x468226));}return BPromise['all'](_0x28e1f5);}})[_0x780e('0x20')](function(){return _0x4b7760;})[_0x780e('0x20')](respondWithResult(_0x1f3e8a,null))[_0x780e('0x41')](handleError(_0x1f3e8a,null));};exports[_0x780e('0x80')]=function(_0xb2fc9a,_0x19a4ea,_0x11586e){return db[_0x780e('0x2a')]['find']({'where':{'id':_0xb2fc9a[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x19a4ea,null))['then'](function(_0x613ba2){if(_0x613ba2){return _0x613ba2[_0x780e('0x80')](_0xb2fc9a[_0x780e('0x2d')]['ids']);}})[_0x780e('0x20')](function(_0x3babc8){if(_0x3babc8){return db[_0x780e('0x56')][_0x780e('0x21')]({'where':{'ListId':_0xb2fc9a['query'][_0x780e('0x63')],'CampaignId':_0xb2fc9a[_0x780e('0x43')]['id']}})[_0x780e('0x20')](function(){return _0x3babc8;});}})[_0x780e('0x20')](respondWithStatusCode(_0x19a4ea,null))[_0x780e('0x41')](handleError(_0x19a4ea,null));};exports[_0x780e('0x81')]=function(_0x4f1b2b,_0x2373b7,_0x2c2592){var _0x6b1ca={'raw':!![],'where':{}};var _0x48c3dc={};var _0x1ed1c4={'count':0x0,'rows':[]};return db[_0x780e('0x2a')]['findOne']({'where':{'id':_0x4f1b2b['params']['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x2373b7,null))[_0x780e('0x20')](function(_0x561035){if(_0x561035){_0x48c3dc[_0x780e('0x30')]=_['keys'](db[_0x780e('0x60')][_0x780e('0x4e')]);_0x48c3dc[_0x780e('0x2d')]=_[_0x780e('0x2e')](_0x4f1b2b[_0x780e('0x2d')]);_0x48c3dc['filters']=_[_0x780e('0x2f')](_0x48c3dc[_0x780e('0x30')],_0x48c3dc[_0x780e('0x2d')]);_0x6b1ca[_0x780e('0x31')]=_[_0x780e('0x2f')](_0x48c3dc[_0x780e('0x30')],qs['fields'](_0x4f1b2b[_0x780e('0x2d')][_0x780e('0x32')]));_0x6b1ca[_0x780e('0x31')]=_0x6b1ca['attributes'][_0x780e('0x33')]?_0x6b1ca[_0x780e('0x31')]:_0x48c3dc[_0x780e('0x30')];if(!_0x4f1b2b['query']['hasOwnProperty']('nolimit')){_0x6b1ca['limit']=qs['limit'](_0x4f1b2b[_0x780e('0x2d')][_0x780e('0x35')]);_0x6b1ca['offset']=qs[_0x780e('0x1a')](_0x4f1b2b['query'][_0x780e('0x1a')]);}_0x6b1ca[_0x780e('0x5a')]=qs['sort'](_0x4f1b2b[_0x780e('0x2d')][_0x780e('0x36')]);_0x6b1ca['where']=qs[_0x780e('0x38')](_['pick'](_0x4f1b2b['query'],_0x48c3dc[_0x780e('0x38')]));_0x6b1ca[_0x780e('0x37')][_0x780e('0x5d')]=_0x561035['id'];if(_0x4f1b2b[_0x780e('0x2d')][_0x780e('0x3b')]){_0x6b1ca[_0x780e('0x37')]=_[_0x780e('0x39')](_0x6b1ca[_0x780e('0x37')],{'$or':_['map'](_0x6b1ca[_0x780e('0x31')],function(_0x7ca755){var _0x5159b2={};_0x5159b2[_0x7ca755]={'$like':'%'+_0x4f1b2b['query'][_0x780e('0x3b')]+'%'};return _0x5159b2;})});}_0x6b1ca=_[_0x780e('0x39')]({},_0x6b1ca,_0x4f1b2b[_0x780e('0x3c')]);return db[_0x780e('0x60')][_0x780e('0x19')]({'where':_0x6b1ca[_0x780e('0x37')]})[_0x780e('0x20')](function(_0x327d24){_0x1ed1c4[_0x780e('0x19')]=_0x327d24;if(_0x4f1b2b[_0x780e('0x2d')]['includeAll']){_0x6b1ca[_0x780e('0x3e')]=[{'all':!![]}];}return db[_0x780e('0x60')][_0x780e('0x3f')](_0x6b1ca);})['then'](function(_0x174446){_0x1ed1c4[_0x780e('0x40')]=_0x174446;return _0x1ed1c4;});}})[_0x780e('0x20')](respondWithFilteredResult(_0x2373b7,_0x6b1ca))[_0x780e('0x41')](handleError(_0x2373b7,null));};exports[_0x780e('0x82')]=function(_0x44804e,_0x5ad302,_0x181faf){var _0x4eb5ae,_0x3083c9;return db[_0x780e('0x2a')]['find']({'where':{'id':_0x44804e['params']['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x5ad302,null))[_0x780e('0x20')](function(_0x3bea40){if(_0x3bea40){_0x3083c9=_0x3bea40;return _0x3bea40[_0x780e('0x82')](_0x44804e[_0x780e('0x45')][_0x780e('0x63')],_[_0x780e('0x4f')](_0x44804e[_0x780e('0x45')],[_0x780e('0x63'),'id'])||{});}return null;})[_0x780e('0x83')](function(_0x3b3b19){var _0x4c7fdc;_0x4eb5ae=_0x3b3b19||[];var _0x47978d=[];if(_0x3b3b19){for(var _0xaeec61=0x0;_0xaeec61<_0x3b3b19[_0x780e('0x33')];_0xaeec61+=0x1){var _0x20f156=_0x3b3b19[_0xaeec61]['get']({'plain':!![]});_0x4c7fdc=squel[_0x780e('0x66')]()[_0x780e('0x77')](_0x780e('0x84'))[_0x780e('0x78')]([_0x780e('0x6a'),_0x780e('0x68'),_0x780e('0x6e'),_0x780e('0x5d'),'createdAt','updatedAt'],squel[_0x780e('0x71')]()[_0x780e('0x69')](_0x780e('0x6a'),_0x780e('0x6a'))[_0x780e('0x69')]('id',_0x780e('0x68'))[_0x780e('0x69')](_0x20f156['CmListId'][_0x780e('0x6d')](),_0x780e('0x6e'))['field'](_0x44804e[_0x780e('0x43')]['id'][_0x780e('0x6d')](),'CampaignId')[_0x780e('0x69')]('NOW()',_0x780e('0x50'))['field'](_0x780e('0x6b'),'updatedAt')[_0x780e('0x6f')](_0x780e('0x7a'))[_0x780e('0x37')](_0x780e('0x70'))[_0x780e('0x37')](_0x780e('0x7b'),_0x20f156[_0x780e('0x6c')][_0x780e('0x6d')]())[_0x780e('0x37')](_0x780e('0x7d')))[_0x780e('0x6d')]();_0x47978d[_0x780e('0x7e')](db[_0x780e('0x7f')][_0x780e('0x2d')](_0x4c7fdc));}return BPromise[_0x780e('0x85')](_0x47978d);}})[_0x780e('0x20')](function(){return _0x4eb5ae;})[_0x780e('0x20')](respondWithResult(_0x5ad302,null))[_0x780e('0x41')](handleError(_0x5ad302,null));};exports[_0x780e('0x86')]=function(_0xfe22ad,_0x4da8a1,_0x4c89ad){return db[_0x780e('0x2a')][_0x780e('0x49')]({'where':{'id':_0xfe22ad[_0x780e('0x43')]['id']}})[_0x780e('0x20')](handleEntityNotFound(_0x4da8a1,null))[_0x780e('0x20')](function(_0x4b57f1){if(_0x4b57f1){return _0x4b57f1[_0x780e('0x86')](_0xfe22ad[_0x780e('0x2d')][_0x780e('0x63')]);}})[_0x780e('0x20')](function(_0x4e18b1){if(_0x4e18b1){return db['CmHopperBlack'][_0x780e('0x21')]({'where':{'ListId':_0xfe22ad['query'][_0x780e('0x63')],'CampaignId':_0xfe22ad[_0x780e('0x43')]['id']}})['then'](function(){return _0x4e18b1;});}})[_0x780e('0x20')](respondWithStatusCode(_0x4da8a1,null))[_0x780e('0x41')](handleError(_0x4da8a1,null));}; \ No newline at end of file +var _0x0cf5=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','filter','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','toString','from','ListId\x20=\x20?','CmListId','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','sendStatus','status','json','count','offset','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options'];(function(_0x5def6b,_0x34dab3){var _0x510621=function(_0x2da0bb){while(--_0x2da0bb){_0x5def6b['push'](_0x5def6b['shift']());}};_0x510621(++_0x34dab3);}(_0x0cf5,0xc0));var _0x50cf=function(_0x4ad077,_0xee2ce7){_0x4ad077=_0x4ad077-0x0;var _0x2d0c8e=_0x0cf5[_0x4ad077];return _0x2d0c8e;};'use strict';var pdf=require(_0x50cf('0x0'));var emlformat=require(_0x50cf('0x1'));var rimraf=require(_0x50cf('0x2'));var zipdir=require(_0x50cf('0x3'));var jsonpatch=require(_0x50cf('0x4'));var rp=require(_0x50cf('0x5'));var moment=require(_0x50cf('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x50cf('0x7'));var util=require('util');var path=require(_0x50cf('0x8'));var sox=require(_0x50cf('0x9'));var csv=require(_0x50cf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x50cf('0xb'));var squel=require(_0x50cf('0xc'));var crypto=require(_0x50cf('0xd'));var jsforce=require(_0x50cf('0xe'));var deskjs=require(_0x50cf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x50cf('0x10'));var Papa=require(_0x50cf('0x11'));var Redis=require(_0x50cf('0x12'));var authService=require(_0x50cf('0x13'));var qs=require(_0x50cf('0x14'));var as=require(_0x50cf('0x15'));var hardwareService=require(_0x50cf('0x16'));var logger=require(_0x50cf('0x17'))('api');var utils=require(_0x50cf('0x18'));var config=require(_0x50cf('0x19'));var db=require(_0x50cf('0x1a'))['db'];function respondWithStatusCode(_0x4dec5d,_0x565305){_0x565305=_0x565305||0xcc;return function(_0x4dd53c){if(_0x4dd53c){return _0x4dec5d[_0x50cf('0x1b')](_0x565305);}return _0x4dec5d[_0x50cf('0x1c')](_0x565305)['end']();};}function respondWithResult(_0x1c7a66,_0x3b1286){_0x3b1286=_0x3b1286||0xc8;return function(_0x4184ac){if(_0x4184ac){return _0x1c7a66['status'](_0x3b1286)[_0x50cf('0x1d')](_0x4184ac);}};}function respondWithFilteredResult(_0x1020f4,_0x1f4db3){return function(_0x329af7){if(_0x329af7){var _0x40de69=_0x329af7[_0x50cf('0x1e')],_0x2cae61=_0x1f4db3[_0x50cf('0x1f')],_0x5a49a8=_0x1f4db3[_0x50cf('0x1f')]+_0x1f4db3['limit'],_0x20330a;if(_0x5a49a8>=_0x40de69){_0x5a49a8=_0x40de69;_0x20330a=0xc8;}else{_0x20330a=0xce;}_0x1020f4[_0x50cf('0x1c')](_0x20330a);return _0x1020f4['set']('Content-Range',_0x2cae61+'-'+_0x5a49a8+'/'+_0x40de69)[_0x50cf('0x1d')](_0x329af7);}return null;};}function patchUpdates(_0x8b46c1){return function(_0x316f7d){try{jsonpatch[_0x50cf('0x20')](_0x316f7d,_0x8b46c1,!![]);}catch(_0x4aac21){return BPromise[_0x50cf('0x21')](_0x4aac21);}return _0x316f7d[_0x50cf('0x22')]();};}function saveUpdates(_0x392798,_0x389267){return function(_0x3988ae){if(_0x3988ae){return _0x3988ae[_0x50cf('0x23')](_0x392798)[_0x50cf('0x24')](function(_0x141b0b){return _0x141b0b;});}return null;};}function removeEntity(_0x1d4e9f,_0x401cac){return function(_0x369867){if(_0x369867){return _0x369867[_0x50cf('0x25')]()['then'](function(){var _0x771d65=_0x369867[_0x50cf('0x26')]({'plain':!![]});var _0xc57fde=_0x50cf('0x27');return db[_0x50cf('0x28')][_0x50cf('0x25')]({'where':{'type':_0xc57fde,'resourceId':_0x771d65['id']}})[_0x50cf('0x24')](function(){return _0x369867;});})[_0x50cf('0x24')](function(){_0x1d4e9f['status'](0xcc)[_0x50cf('0x29')]();});}};}function handleEntityNotFound(_0x33487a,_0xc393b5){return function(_0x36b40e){if(!_0x36b40e){_0x33487a[_0x50cf('0x1b')](0x194);}return _0x36b40e;};}function handleError(_0x256f86,_0x252293){_0x252293=_0x252293||0x1f4;return function(_0x211ed2){logger[_0x50cf('0x2a')](_0x211ed2['stack']);if(_0x211ed2[_0x50cf('0x2b')]){delete _0x211ed2['name'];}_0x256f86['status'](_0x252293)[_0x50cf('0x2c')](_0x211ed2);};}exports[_0x50cf('0x2d')]=function(_0x3e1bdc,_0x389637){var _0x1e1316={},_0x4e042d={},_0x5c5d62={'count':0x0,'rows':[]};var _0x5a2ba1=_[_0x50cf('0x2e')](db[_0x50cf('0x2f')][_0x50cf('0x30')],function(_0x44d922){return{'name':_0x44d922[_0x50cf('0x31')],'type':_0x44d922[_0x50cf('0x32')][_0x50cf('0x33')]};});_0x4e042d[_0x50cf('0x34')]=_['map'](_0x5a2ba1,'name');_0x4e042d[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x3e1bdc[_0x50cf('0x35')]);_0x4e042d[_0x50cf('0x37')]=_[_0x50cf('0x38')](_0x4e042d[_0x50cf('0x34')],_0x4e042d['query']);_0x1e1316[_0x50cf('0x39')]=_[_0x50cf('0x38')](_0x4e042d[_0x50cf('0x34')],qs[_0x50cf('0x3a')](_0x3e1bdc[_0x50cf('0x35')]['fields']));_0x1e1316[_0x50cf('0x39')]=_0x1e1316[_0x50cf('0x39')][_0x50cf('0x3b')]?_0x1e1316[_0x50cf('0x39')]:_0x4e042d[_0x50cf('0x34')];if(!_0x3e1bdc['query']['hasOwnProperty'](_0x50cf('0x3c'))){_0x1e1316['limit']=qs[_0x50cf('0x3d')](_0x3e1bdc[_0x50cf('0x35')]['limit']);_0x1e1316['offset']=qs['offset'](_0x3e1bdc[_0x50cf('0x35')][_0x50cf('0x1f')]);}_0x1e1316[_0x50cf('0x3e')]=qs['sort'](_0x3e1bdc[_0x50cf('0x35')][_0x50cf('0x3f')]);_0x1e1316[_0x50cf('0x40')]=qs[_0x50cf('0x37')](_[_0x50cf('0x41')](_0x3e1bdc['query'],_0x4e042d[_0x50cf('0x37')]),_0x5a2ba1);if(_0x3e1bdc[_0x50cf('0x35')]['filter']){_0x1e1316[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x1e1316['where'],{'$or':_[_0x50cf('0x2e')](_0x5a2ba1,function(_0x50a274){if(_0x50a274[_0x50cf('0x32')]!==_0x50cf('0x43')){var _0x2eeca0={};_0x2eeca0[_0x50a274[_0x50cf('0x2b')]]={'$like':'%'+_0x3e1bdc[_0x50cf('0x35')]['filter']+'%'};return _0x2eeca0;}})});}_0x1e1316=_[_0x50cf('0x42')]({},_0x1e1316,_0x3e1bdc['options']);var _0x4f8ae5={'where':_0x1e1316[_0x50cf('0x40')]};return db[_0x50cf('0x2f')][_0x50cf('0x1e')](_0x4f8ae5)[_0x50cf('0x24')](function(_0x10b896){_0x5c5d62[_0x50cf('0x1e')]=_0x10b896;if(_0x3e1bdc[_0x50cf('0x35')][_0x50cf('0x44')]){_0x1e1316['include']=[{'all':!![]}];}return db[_0x50cf('0x2f')][_0x50cf('0x45')](_0x1e1316);})[_0x50cf('0x24')](function(_0x1ccccf){_0x5c5d62[_0x50cf('0x46')]=_0x1ccccf;return _0x5c5d62;})[_0x50cf('0x24')](respondWithFilteredResult(_0x389637,_0x1e1316))[_0x50cf('0x47')](handleError(_0x389637,null));};exports[_0x50cf('0x48')]=function(_0x3ad4f7,_0x482423){var _0x3d45a5={'raw':![],'where':{'id':_0x3ad4f7[_0x50cf('0x49')]['id']}},_0x28353c={};_0x28353c[_0x50cf('0x34')]=_[_0x50cf('0x36')](db[_0x50cf('0x2f')][_0x50cf('0x30')]);_0x28353c[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x3ad4f7[_0x50cf('0x35')]);_0x28353c[_0x50cf('0x37')]=_[_0x50cf('0x38')](_0x28353c['model'],_0x28353c[_0x50cf('0x35')]);_0x3d45a5['attributes']=_['intersection'](_0x28353c[_0x50cf('0x34')],qs[_0x50cf('0x3a')](_0x3ad4f7[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x3d45a5['attributes']=_0x3d45a5[_0x50cf('0x39')]['length']?_0x3d45a5[_0x50cf('0x39')]:_0x28353c[_0x50cf('0x34')];if(_0x3ad4f7[_0x50cf('0x35')][_0x50cf('0x44')]){_0x3d45a5[_0x50cf('0x4a')]=[{'all':!![]}];}_0x3d45a5=_['merge']({},_0x3d45a5,_0x3ad4f7[_0x50cf('0x4b')]);return db[_0x50cf('0x2f')][_0x50cf('0x4c')](_0x3d45a5)['then'](handleEntityNotFound(_0x482423,null))[_0x50cf('0x24')](respondWithResult(_0x482423,null))[_0x50cf('0x47')](handleError(_0x482423,null));};exports[_0x50cf('0x4d')]=function(_0x5d9eb1,_0x22c1bb){return db[_0x50cf('0x2f')][_0x50cf('0x4d')](_0x5d9eb1[_0x50cf('0x4e')],{})[_0x50cf('0x24')](function(_0x4d0485){var _0x579a83=_0x5d9eb1[_0x50cf('0x4f')][_0x50cf('0x26')]({'plain':!![]});if(!_0x579a83)throw new Error(_0x50cf('0x50'));if(_0x579a83[_0x50cf('0x51')]===_0x50cf('0x4f')){var _0x4e1ad9=_0x4d0485[_0x50cf('0x26')]({'plain':!![]});var _0x1c7efb='IvrCampaigns';return db['UserProfileSection'][_0x50cf('0x4c')]({'where':{'name':_0x1c7efb,'userProfileId':_0x579a83[_0x50cf('0x52')]},'raw':!![]})[_0x50cf('0x24')](function(_0x37b914){if(_0x37b914&&_0x37b914[_0x50cf('0x53')]===0x0){return db[_0x50cf('0x28')][_0x50cf('0x4d')]({'name':_0x4e1ad9[_0x50cf('0x2b')],'resourceId':_0x4e1ad9['id'],'type':_0x37b914[_0x50cf('0x2b')],'sectionId':_0x37b914['id']},{})[_0x50cf('0x24')](function(){return _0x4d0485;});}else{return _0x4d0485;}})[_0x50cf('0x47')](function(_0x44cb6c){logger['error'](_0x50cf('0x54'),_0x44cb6c);throw _0x44cb6c;});}return _0x4d0485;})['then'](respondWithResult(_0x22c1bb,0xc9))[_0x50cf('0x47')](handleError(_0x22c1bb,null));};exports[_0x50cf('0x55')]=function(_0x428ebc,_0x2b0ab8){var _0x45790f={'where':{'id':_0x428ebc[_0x50cf('0x49')]['id']}},_0x53b8b4={};_0x53b8b4[_0x50cf('0x34')]=_[_0x50cf('0x36')](db['Campaign'][_0x50cf('0x30')]);_0x45790f[_0x50cf('0x39')]=_['intersection'](_0x53b8b4[_0x50cf('0x34')],qs[_0x50cf('0x3a')](_0x428ebc[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x45790f['attributes']=_0x45790f['attributes'][_0x50cf('0x3b')]?_0x45790f[_0x50cf('0x39')]:_0x53b8b4['model'];if(_0x428ebc['query'][_0x50cf('0x44')]){_0x45790f[_0x50cf('0x4a')]=[{'all':!![]}];}_0x45790f=_[_0x50cf('0x42')]({},_0x45790f,_0x428ebc['options']);return db[_0x50cf('0x2f')][_0x50cf('0x4c')](_0x45790f)[_0x50cf('0x24')](handleEntityNotFound(_0x2b0ab8,null))['then'](function(_0x8a5e2d){if(_0x8a5e2d){var _0x3f1f15=_0x8a5e2d[_0x50cf('0x26')]({'plain':!![]});_0x3f1f15=qs[_0x50cf('0x56')](_0x3f1f15,['id',_0x50cf('0x57'),'updatedAt']);_0x428ebc[_0x50cf('0x4e')]=_[_0x50cf('0x56')](_0x428ebc[_0x50cf('0x4e')],['id',_0x50cf('0x57'),_0x50cf('0x58')]);return db[_0x50cf('0x2f')][_0x50cf('0x4d')](_['merge'](_0x3f1f15,_0x428ebc[_0x50cf('0x4e')]),{'include':_0x428ebc[_0x50cf('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x50cf('0x24')](function(_0x42ff48){var _0x1d7030=_0x428ebc['user'][_0x50cf('0x26')]({'plain':!![]});if(!_0x1d7030)throw new Error(_0x50cf('0x50'));if(_0x1d7030[_0x50cf('0x51')]===_0x50cf('0x4f')){var _0xae19d=_0x42ff48[_0x50cf('0x26')]({'plain':!![]});var _0x12f178=_0x50cf('0x27');return db['UserProfileSection'][_0x50cf('0x4c')]({'where':{'name':_0x12f178,'userProfileId':_0x1d7030['userProfileId']},'raw':!![]})[_0x50cf('0x24')](function(_0x14f7ae){if(_0x14f7ae&&_0x14f7ae[_0x50cf('0x53')]===0x0){return db[_0x50cf('0x28')][_0x50cf('0x4d')]({'name':_0xae19d[_0x50cf('0x2b')],'resourceId':_0xae19d['id'],'type':_0x14f7ae[_0x50cf('0x2b')],'sectionId':_0x14f7ae['id']},{})[_0x50cf('0x24')](function(){return _0x42ff48;});}else{return _0x42ff48;}})[_0x50cf('0x47')](function(_0x39d6ce){logger[_0x50cf('0x2a')](_0x50cf('0x54'),_0x39d6ce);throw _0x39d6ce;});}return _0x42ff48;});}})[_0x50cf('0x24')](respondWithResult(_0x2b0ab8,0xc9))['catch'](handleError(_0x2b0ab8,null));};exports['update']=function(_0x563a0d,_0x1b27c5){if(_0x563a0d['body']['id']){delete _0x563a0d[_0x50cf('0x4e')]['id'];}return db[_0x50cf('0x2f')][_0x50cf('0x4c')]({'where':{'id':_0x563a0d[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x1b27c5,null))[_0x50cf('0x24')](saveUpdates(_0x563a0d[_0x50cf('0x4e')],null))[_0x50cf('0x24')](respondWithResult(_0x1b27c5,null))[_0x50cf('0x47')](handleError(_0x1b27c5,null));};exports['destroy']=function(_0x35bf4f,_0x28b62b){return db[_0x50cf('0x2f')]['find']({'where':{'id':_0x35bf4f[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x28b62b,null))[_0x50cf('0x24')](removeEntity(_0x28b62b,null))[_0x50cf('0x47')](handleError(_0x28b62b,null));};exports[_0x50cf('0x59')]=function(_0x544fab,_0x41115d,_0x539ebc){var _0x110806={'raw':!![],'where':{}};var _0x30fa80={};var _0x39401d={'count':0x0,'rows':[]};return db[_0x50cf('0x2f')][_0x50cf('0x5a')]({'where':{'id':_0x544fab[_0x50cf('0x49')]['id']}})['then'](handleEntityNotFound(_0x41115d,null))['then'](function(_0x439f17){if(_0x439f17){_0x30fa80[_0x50cf('0x34')]=_['keys'](db[_0x50cf('0x5b')]['rawAttributes']);_0x30fa80[_0x50cf('0x35')]=_['keys'](_0x544fab[_0x50cf('0x35')]);_0x30fa80[_0x50cf('0x37')]=_['intersection'](_0x30fa80[_0x50cf('0x34')],_0x30fa80[_0x50cf('0x35')]);_0x110806['attributes']=_[_0x50cf('0x38')](_0x30fa80[_0x50cf('0x34')],qs[_0x50cf('0x3a')](_0x544fab[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x110806[_0x50cf('0x39')]=_0x110806[_0x50cf('0x39')][_0x50cf('0x3b')]?_0x110806[_0x50cf('0x39')]:_0x30fa80[_0x50cf('0x34')];if(!_0x544fab[_0x50cf('0x35')][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0x110806[_0x50cf('0x3d')]=qs['limit'](_0x544fab[_0x50cf('0x35')][_0x50cf('0x3d')]);_0x110806[_0x50cf('0x1f')]=qs['offset'](_0x544fab[_0x50cf('0x35')][_0x50cf('0x1f')]);}_0x110806[_0x50cf('0x3e')]=qs[_0x50cf('0x3f')](_0x544fab['query'][_0x50cf('0x3f')]);_0x110806['where']=qs[_0x50cf('0x37')](_['pick'](_0x544fab['query'],_0x30fa80['filters']));_0x110806[_0x50cf('0x40')][_0x50cf('0x5d')]=_0x439f17['id'];if(_0x544fab['query'][_0x50cf('0x5e')]){_0x110806[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x110806['where'],{'$or':_[_0x50cf('0x2e')](_0x110806[_0x50cf('0x39')],function(_0x12c921){var _0x1c99d3={};_0x1c99d3[_0x12c921]={'$like':'%'+_0x544fab[_0x50cf('0x35')][_0x50cf('0x5e')]+'%'};return _0x1c99d3;})});}_0x110806=_[_0x50cf('0x42')]({},_0x110806,_0x544fab['options']);return db[_0x50cf('0x5b')]['count']({'where':_0x110806[_0x50cf('0x40')]})[_0x50cf('0x24')](function(_0x575d71){_0x39401d[_0x50cf('0x1e')]=_0x575d71;if(_0x544fab['query'][_0x50cf('0x44')]){_0x110806[_0x50cf('0x4a')]=[{'all':!![]}];}return db[_0x50cf('0x5b')][_0x50cf('0x45')](_0x110806);})[_0x50cf('0x24')](function(_0xc738e9){_0x39401d[_0x50cf('0x46')]=_0xc738e9;return _0x39401d;});}})[_0x50cf('0x24')](respondWithFilteredResult(_0x41115d,_0x110806))[_0x50cf('0x47')](handleError(_0x41115d,null));};exports['getHopperHistories']=function(_0x489b0a,_0x58bfe0,_0x2a3aa7){var _0xf89524={'raw':!![],'where':{}};var _0x5f2994={};var _0x4e7c36={'count':0x0,'rows':[]};return db[_0x50cf('0x2f')][_0x50cf('0x5a')]({'where':{'id':_0x489b0a['params']['id']}})['then'](handleEntityNotFound(_0x58bfe0,null))['then'](function(_0x32a44d){if(_0x32a44d){_0x5f2994[_0x50cf('0x34')]=_[_0x50cf('0x36')](db[_0x50cf('0x5f')][_0x50cf('0x30')]);_0x5f2994[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x489b0a['query']);_0x5f2994[_0x50cf('0x37')]=_[_0x50cf('0x38')](_0x5f2994['model'],_0x5f2994[_0x50cf('0x35')]);_0xf89524[_0x50cf('0x39')]=_[_0x50cf('0x38')](_0x5f2994[_0x50cf('0x34')],qs['fields'](_0x489b0a[_0x50cf('0x35')]['fields']));_0xf89524[_0x50cf('0x39')]=_0xf89524[_0x50cf('0x39')]['length']?_0xf89524[_0x50cf('0x39')]:_0x5f2994[_0x50cf('0x34')];if(!_0x489b0a['query'][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0xf89524[_0x50cf('0x3d')]=qs[_0x50cf('0x3d')](_0x489b0a[_0x50cf('0x35')]['limit']);_0xf89524['offset']=qs[_0x50cf('0x1f')](_0x489b0a[_0x50cf('0x35')][_0x50cf('0x1f')]);}_0xf89524[_0x50cf('0x3e')]=qs[_0x50cf('0x3f')](_0x489b0a[_0x50cf('0x35')][_0x50cf('0x3f')]);_0xf89524[_0x50cf('0x40')]=qs[_0x50cf('0x37')](_[_0x50cf('0x41')](_0x489b0a[_0x50cf('0x35')],_0x5f2994[_0x50cf('0x37')]));_0xf89524[_0x50cf('0x40')]['CampaignId']=_0x32a44d['id'];if(_0x489b0a['query'][_0x50cf('0x5e')]){_0xf89524[_0x50cf('0x40')]=_['merge'](_0xf89524['where'],{'$or':_['map'](_0xf89524['attributes'],function(_0x5e884f){var _0x5ac4c5={};_0x5ac4c5[_0x5e884f]={'$like':'%'+_0x489b0a[_0x50cf('0x35')][_0x50cf('0x5e')]+'%'};return _0x5ac4c5;})});}_0xf89524=_['merge']({},_0xf89524,_0x489b0a[_0x50cf('0x4b')]);return db['CmHopperHistory'][_0x50cf('0x1e')]({'where':_0xf89524[_0x50cf('0x40')]})[_0x50cf('0x24')](function(_0x31c82d){_0x4e7c36[_0x50cf('0x1e')]=_0x31c82d;if(_0x489b0a[_0x50cf('0x35')]['includeAll']){_0xf89524['include']=[{'all':!![]}];}return db[_0x50cf('0x5f')]['findAll'](_0xf89524);})[_0x50cf('0x24')](function(_0x486b25){_0x4e7c36[_0x50cf('0x46')]=_0x486b25;return _0x4e7c36;});}})[_0x50cf('0x24')](respondWithFilteredResult(_0x58bfe0,_0xf89524))[_0x50cf('0x47')](handleError(_0x58bfe0,null));};exports[_0x50cf('0x60')]=function(_0x2fee6b,_0x3ff39b,_0x2568fe){var _0x2597d7={'raw':!![],'where':{}};var _0x4f5c40={};var _0x540143={'count':0x0,'rows':[]};return db[_0x50cf('0x2f')][_0x50cf('0x5a')]({'where':{'id':_0x2fee6b[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x3ff39b,null))[_0x50cf('0x24')](function(_0x254227){if(_0x254227){_0x4f5c40[_0x50cf('0x34')]=_[_0x50cf('0x36')](db[_0x50cf('0x61')][_0x50cf('0x30')]);_0x4f5c40[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x2fee6b['query']);_0x4f5c40['filters']=_[_0x50cf('0x38')](_0x4f5c40['model'],_0x4f5c40[_0x50cf('0x35')]);_0x2597d7[_0x50cf('0x39')]=_[_0x50cf('0x38')](_0x4f5c40[_0x50cf('0x34')],qs['fields'](_0x2fee6b[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x2597d7[_0x50cf('0x39')]=_0x2597d7['attributes'][_0x50cf('0x3b')]?_0x2597d7[_0x50cf('0x39')]:_0x4f5c40[_0x50cf('0x34')];if(!_0x2fee6b['query'][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0x2597d7[_0x50cf('0x3d')]=qs[_0x50cf('0x3d')](_0x2fee6b[_0x50cf('0x35')]['limit']);_0x2597d7[_0x50cf('0x1f')]=qs[_0x50cf('0x1f')](_0x2fee6b[_0x50cf('0x35')][_0x50cf('0x1f')]);}_0x2597d7[_0x50cf('0x3e')]=qs[_0x50cf('0x3f')](_0x2fee6b[_0x50cf('0x35')][_0x50cf('0x3f')]);_0x2597d7[_0x50cf('0x40')]=qs[_0x50cf('0x37')](_['pick'](_0x2fee6b[_0x50cf('0x35')],_0x4f5c40[_0x50cf('0x37')]));_0x2597d7[_0x50cf('0x40')]['CampaignId']=_0x254227['id'];if(_0x2fee6b[_0x50cf('0x35')][_0x50cf('0x5e')]){_0x2597d7[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x2597d7[_0x50cf('0x40')],{'$or':_[_0x50cf('0x2e')](_0x2597d7[_0x50cf('0x39')],function(_0x276ebc){var _0x12c842={};_0x12c842[_0x276ebc]={'$like':'%'+_0x2fee6b[_0x50cf('0x35')][_0x50cf('0x5e')]+'%'};return _0x12c842;})});}_0x2597d7=_['merge']({},_0x2597d7,_0x2fee6b[_0x50cf('0x4b')]);return db[_0x50cf('0x61')]['count']({'where':_0x2597d7[_0x50cf('0x40')]})['then'](function(_0x5a47ba){_0x540143['count']=_0x5a47ba;if(_0x2fee6b['query']['includeAll']){_0x2597d7['include']=[{'all':!![]}];}return db[_0x50cf('0x61')][_0x50cf('0x45')](_0x2597d7);})[_0x50cf('0x24')](function(_0x1df74e){_0x540143[_0x50cf('0x46')]=_0x1df74e;return _0x540143;});}})[_0x50cf('0x24')](respondWithFilteredResult(_0x3ff39b,_0x2597d7))[_0x50cf('0x47')](handleError(_0x3ff39b,null));};exports[_0x50cf('0x62')]=function(_0x2334fb,_0x294d52,_0x4cdb66){var _0x2fae70={'raw':!![],'where':{}};var _0x8294c5={};var _0x168cbc={'count':0x0,'rows':[]};return db[_0x50cf('0x2f')][_0x50cf('0x5a')]({'where':{'id':_0x2334fb[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x294d52,null))['then'](function(_0x481504){if(_0x481504){_0x8294c5[_0x50cf('0x34')]=_[_0x50cf('0x36')](db[_0x50cf('0x63')][_0x50cf('0x30')]);_0x8294c5[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x2334fb['query']);_0x8294c5['filters']=_[_0x50cf('0x38')](_0x8294c5[_0x50cf('0x34')],_0x8294c5['query']);_0x2fae70[_0x50cf('0x39')]=_[_0x50cf('0x38')](_0x8294c5[_0x50cf('0x34')],qs[_0x50cf('0x3a')](_0x2334fb[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x2fae70[_0x50cf('0x39')]=_0x2fae70[_0x50cf('0x39')][_0x50cf('0x3b')]?_0x2fae70[_0x50cf('0x39')]:_0x8294c5[_0x50cf('0x34')];if(!_0x2334fb[_0x50cf('0x35')][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0x2fae70[_0x50cf('0x3d')]=qs[_0x50cf('0x3d')](_0x2334fb[_0x50cf('0x35')][_0x50cf('0x3d')]);_0x2fae70[_0x50cf('0x1f')]=qs['offset'](_0x2334fb[_0x50cf('0x35')]['offset']);}_0x2fae70[_0x50cf('0x3e')]=qs[_0x50cf('0x3f')](_0x2334fb[_0x50cf('0x35')][_0x50cf('0x3f')]);_0x2fae70[_0x50cf('0x40')]=qs[_0x50cf('0x37')](_['pick'](_0x2334fb[_0x50cf('0x35')],_0x8294c5[_0x50cf('0x37')]));_0x2fae70['where'][_0x50cf('0x5d')]=_0x481504['id'];if(_0x2334fb[_0x50cf('0x35')][_0x50cf('0x5e')]){_0x2fae70[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x2fae70[_0x50cf('0x40')],{'$or':_[_0x50cf('0x2e')](_0x2fae70['attributes'],function(_0x2e6e75){var _0x496d34={};_0x496d34[_0x2e6e75]={'$like':'%'+_0x2334fb[_0x50cf('0x35')][_0x50cf('0x5e')]+'%'};return _0x496d34;})});}_0x2fae70=_[_0x50cf('0x42')]({},_0x2fae70,_0x2334fb[_0x50cf('0x4b')]);return db['CmHopperBlack'][_0x50cf('0x1e')]({'where':_0x2fae70[_0x50cf('0x40')]})['then'](function(_0x3e223c){_0x168cbc[_0x50cf('0x1e')]=_0x3e223c;if(_0x2334fb[_0x50cf('0x35')][_0x50cf('0x44')]){_0x2fae70[_0x50cf('0x4a')]=[{'all':!![]}];}return db[_0x50cf('0x63')][_0x50cf('0x45')](_0x2fae70);})[_0x50cf('0x24')](function(_0xfa73a2){_0x168cbc['rows']=_0xfa73a2;return _0x168cbc;});}})['then'](respondWithFilteredResult(_0x294d52,_0x2fae70))[_0x50cf('0x47')](handleError(_0x294d52,null));};exports[_0x50cf('0x64')]=function(_0x10736d,_0x25f6da,_0x3e789e){var _0x49d983={};var _0xcfa075={};var _0xa4a16a;var _0x416313;return db[_0x50cf('0x2f')][_0x50cf('0x5a')]({'where':{'id':_0x10736d[_0x50cf('0x49')]['id']}})['then'](handleEntityNotFound(_0x25f6da,null))['then'](function(_0x4c0165){if(_0x4c0165){_0xa4a16a=_0x4c0165;_0xcfa075[_0x50cf('0x34')]=_['keys'](db[_0x50cf('0x65')]['rawAttributes']);_0xcfa075[_0x50cf('0x35')]=_[_0x50cf('0x36')](_0x10736d[_0x50cf('0x35')]);_0xcfa075[_0x50cf('0x37')]=_[_0x50cf('0x38')](_0xcfa075[_0x50cf('0x34')],_0xcfa075[_0x50cf('0x35')]);_0x49d983['attributes']=_['intersection'](_0xcfa075[_0x50cf('0x34')],qs['fields'](_0x10736d['query'][_0x50cf('0x3a')]));_0x49d983[_0x50cf('0x39')]=_0x49d983[_0x50cf('0x39')][_0x50cf('0x3b')]?_0x49d983[_0x50cf('0x39')]:_0xcfa075[_0x50cf('0x34')];_0x49d983[_0x50cf('0x3e')]=qs[_0x50cf('0x3f')](_0x10736d[_0x50cf('0x35')][_0x50cf('0x3f')]);_0x49d983['where']=qs[_0x50cf('0x37')](_[_0x50cf('0x41')](_0x10736d[_0x50cf('0x35')],_0xcfa075[_0x50cf('0x37')]));if(_0x10736d[_0x50cf('0x35')][_0x50cf('0x5e')]){_0x49d983[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x49d983[_0x50cf('0x40')],{'$or':_['map'](_0x49d983['attributes'],function(_0x641826){var _0x304b05={};_0x304b05[_0x641826]={'$like':'%'+_0x10736d['query'][_0x50cf('0x5e')]+'%'};return _0x304b05;})});}_0x49d983=_[_0x50cf('0x42')]({},_0x49d983,_0x10736d['options']);return _0xa4a16a[_0x50cf('0x64')](_0x49d983);}})['then'](function(_0x28809b){if(_0x28809b){_0x416313=_0x28809b[_0x50cf('0x3b')];if(!_0x10736d[_0x50cf('0x35')][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0x49d983[_0x50cf('0x3d')]=qs[_0x50cf('0x3d')](_0x10736d['query'][_0x50cf('0x3d')]);_0x49d983[_0x50cf('0x1f')]=qs[_0x50cf('0x1f')](_0x10736d[_0x50cf('0x35')]['offset']);}return _0xa4a16a[_0x50cf('0x64')](_0x49d983);}})[_0x50cf('0x24')](function(_0x23fdc0){if(_0x23fdc0){return _0x23fdc0?{'count':_0x416313,'rows':_0x23fdc0}:null;}})[_0x50cf('0x24')](respondWithResult(_0x25f6da,null))[_0x50cf('0x47')](handleError(_0x25f6da,null));};exports[_0x50cf('0x66')]=function(_0x594541,_0x20f155,_0x5c65fa){var _0x20910c,_0x2a9da7;return db[_0x50cf('0x2f')]['find']({'where':{'id':_0x594541[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x20f155,null))[_0x50cf('0x24')](function(_0x3446f4){if(_0x3446f4){_0x2a9da7=_0x3446f4;return _0x3446f4[_0x50cf('0x66')](_0x594541[_0x50cf('0x4e')][_0x50cf('0x67')],_['omit'](_0x594541[_0x50cf('0x4e')],[_0x50cf('0x67'),'id'])||{});}return null;})[_0x50cf('0x68')](function(_0x5a6685){var _0x49e8e2;_0x20910c=_0x5a6685||[];var _0x51766c=[];if(_0x5a6685){for(var _0x35a32c=0x0;_0x35a32c<_0x5a6685[_0x50cf('0x3b')];_0x35a32c+=0x1){var _0x337d07=_0x5a6685[_0x35a32c][_0x50cf('0x26')]({'plain':!![]});_0x2a9da7[_0x50cf('0x69')]=_0x594541[_0x50cf('0x4e')][_0x50cf('0x69')]?_0x594541[_0x50cf('0x4e')]['dialCheckDuplicateType']:_0x2a9da7[_0x50cf('0x69')];switch(_0x2a9da7[_0x50cf('0x69')]){case'always':_0x49e8e2=squel[_0x50cf('0x6a')]()[_0x50cf('0x6b')](_0x50cf('0x6c'))[_0x50cf('0x6d')]([_0x50cf('0x6e'),'scheduledAt',_0x50cf('0x6f'),_0x50cf('0x70'),'CampaignId','createdAt',_0x50cf('0x58')],squel[_0x50cf('0x71')]()['field']('phone',_0x50cf('0x6e'))[_0x50cf('0x72')](_0x50cf('0x73'),_0x50cf('0x74'))['field']('id',_0x50cf('0x6f'))[_0x50cf('0x72')](_0x337d07['CmListId'][_0x50cf('0x75')](),'ListId')[_0x50cf('0x72')](_0x594541[_0x50cf('0x49')]['id'][_0x50cf('0x75')](),_0x50cf('0x5d'))[_0x50cf('0x72')](_0x50cf('0x73'),_0x50cf('0x57'))[_0x50cf('0x72')](_0x50cf('0x73'),_0x50cf('0x58'))[_0x50cf('0x76')]('cm_contacts')[_0x50cf('0x40')]('deletedAt\x20IS\x20NULL')[_0x50cf('0x40')](_0x50cf('0x77'),_0x337d07[_0x50cf('0x78')]['toString']())[_0x50cf('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x50cf('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x50cf('0x71')]()[_0x50cf('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x50cf('0x76')](_0x50cf('0x79'))[_0x50cf('0x40')](_0x50cf('0x7a'),_0x594541[_0x50cf('0x49')]['id']['toString']()))['where'](_0x50cf('0x7b'),squel[_0x50cf('0x71')]()[_0x50cf('0x72')](_0x50cf('0x7c'))[_0x50cf('0x76')](_0x50cf('0x6c'))['where'](_0x50cf('0x7a'),_0x594541[_0x50cf('0x49')]['id']['toString']())))[_0x50cf('0x75')]();break;case _0x50cf('0x7d'):_0x49e8e2=squel[_0x50cf('0x6a')]()[_0x50cf('0x6b')](_0x50cf('0x6c'))[_0x50cf('0x6d')]([_0x50cf('0x6e'),_0x50cf('0x74'),_0x50cf('0x6f'),_0x50cf('0x70'),_0x50cf('0x5d'),'createdAt',_0x50cf('0x58')],squel['select']()['field'](_0x50cf('0x6e'),_0x50cf('0x6e'))['field'](_0x50cf('0x73'),_0x50cf('0x74'))['field']('id','ContactId')['field'](_0x337d07[_0x50cf('0x78')]['toString'](),_0x50cf('0x70'))[_0x50cf('0x72')](_0x594541['params']['id']['toString'](),_0x50cf('0x5d'))['field'](_0x50cf('0x73'),_0x50cf('0x57'))['field'](_0x50cf('0x73'),_0x50cf('0x58'))[_0x50cf('0x76')]('cm_contacts')['where'](_0x50cf('0x7e'))[_0x50cf('0x40')](_0x50cf('0x77'),_0x337d07[_0x50cf('0x78')][_0x50cf('0x75')]())[_0x50cf('0x40')](_0x50cf('0x7f'))['where'](_0x50cf('0x7b'),squel[_0x50cf('0x71')]()[_0x50cf('0x72')](_0x50cf('0x7c'))[_0x50cf('0x76')](_0x50cf('0x6c'))['where'](_0x50cf('0x7a'),_0x594541[_0x50cf('0x49')]['id'][_0x50cf('0x75')]())))['toString']();break;default:_0x49e8e2=squel[_0x50cf('0x6a')]()[_0x50cf('0x6b')](_0x50cf('0x6c'))['fromQuery']([_0x50cf('0x6e'),_0x50cf('0x74'),_0x50cf('0x6f'),'ListId',_0x50cf('0x5d'),_0x50cf('0x57'),_0x50cf('0x58')],squel[_0x50cf('0x71')]()[_0x50cf('0x72')](_0x50cf('0x6e'),_0x50cf('0x6e'))[_0x50cf('0x72')](_0x50cf('0x73'),_0x50cf('0x74'))[_0x50cf('0x72')]('id',_0x50cf('0x6f'))[_0x50cf('0x72')](_0x337d07['CmListId']['toString'](),'ListId')[_0x50cf('0x72')](_0x594541[_0x50cf('0x49')]['id'][_0x50cf('0x75')](),_0x50cf('0x5d'))[_0x50cf('0x72')](_0x50cf('0x73'),'createdAt')['field']('NOW()','updatedAt')['from']('cm_contacts')[_0x50cf('0x40')](_0x50cf('0x7e'))['where']('ListId\x20=\x20?',_0x337d07[_0x50cf('0x78')]['toString']())[_0x50cf('0x40')](_0x50cf('0x7f')))[_0x50cf('0x75')]();}_0x51766c[_0x50cf('0x80')](db[_0x50cf('0x81')][_0x50cf('0x35')](_0x49e8e2));}return BPromise[_0x50cf('0x82')](_0x51766c);}})['then'](function(){return _0x20910c;})[_0x50cf('0x24')](respondWithResult(_0x20f155,null))['catch'](handleError(_0x20f155,null));};exports[_0x50cf('0x83')]=function(_0x5b0e10,_0x3f27ef,_0x5ca7fa){return db[_0x50cf('0x2f')][_0x50cf('0x4c')]({'where':{'id':_0x5b0e10['params']['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x3f27ef,null))[_0x50cf('0x24')](function(_0x5242de){if(_0x5242de){return _0x5242de[_0x50cf('0x83')](_0x5b0e10[_0x50cf('0x35')][_0x50cf('0x67')]);}})[_0x50cf('0x24')](function(_0x247bb2){if(_0x247bb2){return db['CmHopper']['destroy']({'where':{'ListId':_0x5b0e10[_0x50cf('0x35')][_0x50cf('0x67')],'CampaignId':_0x5b0e10[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](function(){return _0x247bb2;});}})[_0x50cf('0x24')](respondWithStatusCode(_0x3f27ef,null))[_0x50cf('0x47')](handleError(_0x3f27ef,null));};exports['getBlackLists']=function(_0x4fef11,_0xa45961,_0x13b25f){var _0x461c35={'raw':!![],'where':{}};var _0x1de970={};var _0x14c409={'count':0x0,'rows':[]};return db['Campaign'][_0x50cf('0x5a')]({'where':{'id':_0x4fef11['params']['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0xa45961,null))[_0x50cf('0x24')](function(_0x12ed70){if(_0x12ed70){_0x1de970[_0x50cf('0x34')]=_['keys'](db['CmList'][_0x50cf('0x30')]);_0x1de970[_0x50cf('0x35')]=_['keys'](_0x4fef11['query']);_0x1de970[_0x50cf('0x37')]=_[_0x50cf('0x38')](_0x1de970[_0x50cf('0x34')],_0x1de970[_0x50cf('0x35')]);_0x461c35[_0x50cf('0x39')]=_['intersection'](_0x1de970['model'],qs[_0x50cf('0x3a')](_0x4fef11[_0x50cf('0x35')][_0x50cf('0x3a')]));_0x461c35[_0x50cf('0x39')]=_0x461c35[_0x50cf('0x39')][_0x50cf('0x3b')]?_0x461c35[_0x50cf('0x39')]:_0x1de970['model'];if(!_0x4fef11[_0x50cf('0x35')][_0x50cf('0x5c')](_0x50cf('0x3c'))){_0x461c35[_0x50cf('0x3d')]=qs[_0x50cf('0x3d')](_0x4fef11[_0x50cf('0x35')][_0x50cf('0x3d')]);_0x461c35[_0x50cf('0x1f')]=qs[_0x50cf('0x1f')](_0x4fef11[_0x50cf('0x35')][_0x50cf('0x1f')]);}_0x461c35['order']=qs[_0x50cf('0x3f')](_0x4fef11['query'][_0x50cf('0x3f')]);_0x461c35[_0x50cf('0x40')]=qs['filters'](_[_0x50cf('0x41')](_0x4fef11['query'],_0x1de970['filters']));_0x461c35[_0x50cf('0x40')]['CampaignId']=_0x12ed70['id'];if(_0x4fef11[_0x50cf('0x35')]['filter']){_0x461c35[_0x50cf('0x40')]=_[_0x50cf('0x42')](_0x461c35[_0x50cf('0x40')],{'$or':_[_0x50cf('0x2e')](_0x461c35[_0x50cf('0x39')],function(_0x5ac003){var _0x51cb8d={};_0x51cb8d[_0x5ac003]={'$like':'%'+_0x4fef11[_0x50cf('0x35')][_0x50cf('0x5e')]+'%'};return _0x51cb8d;})});}_0x461c35=_[_0x50cf('0x42')]({},_0x461c35,_0x4fef11[_0x50cf('0x4b')]);return db[_0x50cf('0x65')][_0x50cf('0x1e')]({'where':_0x461c35[_0x50cf('0x40')]})[_0x50cf('0x24')](function(_0x2aa2ef){_0x14c409['count']=_0x2aa2ef;if(_0x4fef11[_0x50cf('0x35')][_0x50cf('0x44')]){_0x461c35[_0x50cf('0x4a')]=[{'all':!![]}];}return db[_0x50cf('0x65')][_0x50cf('0x45')](_0x461c35);})['then'](function(_0x5d1a2e){_0x14c409[_0x50cf('0x46')]=_0x5d1a2e;return _0x14c409;});}})[_0x50cf('0x24')](respondWithFilteredResult(_0xa45961,_0x461c35))[_0x50cf('0x47')](handleError(_0xa45961,null));};exports[_0x50cf('0x84')]=function(_0x297d20,_0x3e1802,_0x3244c4){var _0x3690e3,_0x29e4c8;return db[_0x50cf('0x2f')][_0x50cf('0x4c')]({'where':{'id':_0x297d20['params']['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x3e1802,null))['then'](function(_0x21bde0){if(_0x21bde0){_0x29e4c8=_0x21bde0;return _0x21bde0['addBlackLists'](_0x297d20[_0x50cf('0x4e')][_0x50cf('0x67')],_[_0x50cf('0x56')](_0x297d20[_0x50cf('0x4e')],[_0x50cf('0x67'),'id'])||{});}return null;})['spread'](function(_0x446dc6){var _0x2932eb;_0x3690e3=_0x446dc6||[];var _0x3b825=[];if(_0x446dc6){for(var _0x395cb8=0x0;_0x395cb8<_0x446dc6[_0x50cf('0x3b')];_0x395cb8+=0x1){var _0x3f5180=_0x446dc6[_0x395cb8][_0x50cf('0x26')]({'plain':!![]});_0x2932eb=squel[_0x50cf('0x6a')]()[_0x50cf('0x6b')]('cm_hopper_black')[_0x50cf('0x6d')]([_0x50cf('0x6e'),'ContactId',_0x50cf('0x70'),_0x50cf('0x5d'),_0x50cf('0x57'),_0x50cf('0x58')],squel['select']()[_0x50cf('0x72')](_0x50cf('0x6e'),_0x50cf('0x6e'))[_0x50cf('0x72')]('id',_0x50cf('0x6f'))[_0x50cf('0x72')](_0x3f5180['CmListId']['toString'](),_0x50cf('0x70'))['field'](_0x297d20['params']['id'][_0x50cf('0x75')](),_0x50cf('0x5d'))['field']('NOW()','createdAt')['field'](_0x50cf('0x73'),_0x50cf('0x58'))['from']('cm_contacts')[_0x50cf('0x40')](_0x50cf('0x7e'))[_0x50cf('0x40')](_0x50cf('0x77'),_0x3f5180[_0x50cf('0x78')][_0x50cf('0x75')]())[_0x50cf('0x40')](_0x50cf('0x7f')))[_0x50cf('0x75')]();_0x3b825['push'](db[_0x50cf('0x81')][_0x50cf('0x35')](_0x2932eb));}return BPromise[_0x50cf('0x82')](_0x3b825);}})[_0x50cf('0x24')](function(){return _0x3690e3;})[_0x50cf('0x24')](respondWithResult(_0x3e1802,null))[_0x50cf('0x47')](handleError(_0x3e1802,null));};exports[_0x50cf('0x85')]=function(_0x3922d1,_0x283ba5,_0x51187a){return db[_0x50cf('0x2f')][_0x50cf('0x4c')]({'where':{'id':_0x3922d1[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](handleEntityNotFound(_0x283ba5,null))['then'](function(_0x305d9a){if(_0x305d9a){return _0x305d9a[_0x50cf('0x85')](_0x3922d1[_0x50cf('0x35')]['ids']);}})['then'](function(_0x834209){if(_0x834209){return db[_0x50cf('0x63')][_0x50cf('0x25')]({'where':{'ListId':_0x3922d1[_0x50cf('0x35')]['ids'],'CampaignId':_0x3922d1[_0x50cf('0x49')]['id']}})[_0x50cf('0x24')](function(){return _0x834209;});}})[_0x50cf('0x24')](respondWithStatusCode(_0x283ba5,null))['catch'](handleError(_0x283ba5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d8de720..54592f4 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x15eef1,_0x32590d){var _0x99c0f4=function(_0x4470e5){while(--_0x4470e5){_0x15eef1['push'](_0x15eef1['shift']());}};_0x99c0f4(++_0x32590d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x38c12f,_0x4510b0){var _0x150af7=function(_0x133825){while(--_0x133825){_0x38c12f['push'](_0x38c12f['shift']());}};_0x150af7(++_0x4510b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a8e38aa..73fc0ce 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(_0x1906c1,_0x5ed839){var _0x32d21c=function(_0x596b9d){while(--_0x596b9d){_0x1906c1['push'](_0x1906c1['shift']());}};_0x32d21c(++_0x5ed839);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x16a550,_0x1aa1d8){var _0x26659f=function(_0xa2164){while(--_0xa2164){_0x16a550['push'](_0x16a550['shift']());}};_0x26659f(++_0x1aa1d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index eede53b..8c1ab57 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 _0xd663=['getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','/:id','get','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists'];(function(_0x3d9e38,_0x2b5648){var _0x5fd32a=function(_0x5c57d3){while(--_0x5c57d3){_0x3d9e38['push'](_0x3d9e38['shift']());}};_0x5fd32a(++_0x2b5648);}(_0xd663,0x1ed));var _0x3d66=function(_0x22bfdd,_0x18239d){_0x22bfdd=_0x22bfdd-0x0;var _0x391451=_0xd663[_0x22bfdd];return _0x391451;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var auth=require(_0x3d66('0x5'));var interaction=require(_0x3d66('0x6'));var config=require('../../config/environment');var controller=require(_0x3d66('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3d66('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3d66('0x9')](_0x3d66('0xa'),auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0x9')](_0x3d66('0xd'),auth[_0x3d66('0xb')](),controller['getHopperHistories']);router[_0x3d66('0x9')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['getHopperFinals']);router[_0x3d66('0x9')](_0x3d66('0xf'),auth[_0x3d66('0xb')](),controller['getHopperBlacks']);router[_0x3d66('0x9')](_0x3d66('0x10'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x11')]);router['get'](_0x3d66('0x12'),auth['isAuthenticated'](),controller[_0x3d66('0x13')]);router[_0x3d66('0x14')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0x15')]);router[_0x3d66('0x14')](_0x3d66('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0x3d66('0x14')](_0x3d66('0x10'),auth['isAuthenticated'](),controller[_0x3d66('0x17')]);router[_0x3d66('0x14')](_0x3d66('0x12'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x18')]);router[_0x3d66('0x19')](_0x3d66('0x8'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x1a')]);router[_0x3d66('0x1b')](_0x3d66('0x8'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x1c')]);router[_0x3d66('0x1b')](_0x3d66('0x10'),auth['isAuthenticated'](),controller[_0x3d66('0x1d')]);router['delete'](_0x3d66('0x12'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x1e')]);module[_0x3d66('0x1f')]=router; \ No newline at end of file +var _0x34c5=['getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','update','destroy','removeLists','delete','removeBlackLists','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/lists'];(function(_0x45d999,_0x172695){var _0x25ca87=function(_0x18606a){while(--_0x18606a){_0x45d999['push'](_0x45d999['shift']());}};_0x25ca87(++_0x172695);}(_0x34c5,0x11b));var _0x534c=function(_0x519dff,_0x4c2e60){_0x519dff=_0x519dff-0x0;var _0xe7ba04=_0x34c5[_0x519dff];return _0xe7ba04;};'use strict';var multer=require(_0x534c('0x0'));var util=require('util');var path=require(_0x534c('0x1'));var timeout=require('connect-timeout');var express=require(_0x534c('0x2'));var router=express[_0x534c('0x3')]();var auth=require(_0x534c('0x4'));var interaction=require(_0x534c('0x5'));var config=require(_0x534c('0x6'));var controller=require('./campaign.controller');router[_0x534c('0x7')]('/',auth[_0x534c('0x8')](),controller[_0x534c('0x9')]);router[_0x534c('0x7')](_0x534c('0xa'),auth['isAuthenticated'](),controller[_0x534c('0xb')]);router[_0x534c('0x7')]('/:id/hoppers',auth[_0x534c('0x8')](),controller[_0x534c('0xc')]);router[_0x534c('0x7')](_0x534c('0xd'),auth[_0x534c('0x8')](),controller[_0x534c('0xe')]);router[_0x534c('0x7')]('/:id/hopper_finals',auth[_0x534c('0x8')](),controller[_0x534c('0xf')]);router[_0x534c('0x7')]('/:id/hopper_black',auth[_0x534c('0x8')](),controller['getHopperBlacks']);router[_0x534c('0x7')](_0x534c('0x10'),auth['isAuthenticated'](),controller[_0x534c('0x11')]);router[_0x534c('0x7')](_0x534c('0x12'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x534c('0x13')]('/',auth[_0x534c('0x8')](),controller[_0x534c('0x14')]);router[_0x534c('0x13')](_0x534c('0x15'),auth[_0x534c('0x8')](),controller[_0x534c('0x16')]);router[_0x534c('0x13')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x534c('0x13')]('/:id/blacklists',auth[_0x534c('0x8')](),controller[_0x534c('0x17')]);router[_0x534c('0x18')](_0x534c('0xa'),auth['isAuthenticated'](),controller[_0x534c('0x19')]);router['delete'](_0x534c('0xa'),auth[_0x534c('0x8')](),controller[_0x534c('0x1a')]);router['delete'](_0x534c('0x10'),auth['isAuthenticated'](),controller[_0x534c('0x1b')]);router[_0x534c('0x1c')]('/:id/blacklists',auth[_0x534c('0x8')](),controller[_0x534c('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4141cdd..5f63af0 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 _0x95ae=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x1d9642,_0x2a6719){var _0x180ec6=function(_0x3d1861){while(--_0x3d1861){_0x1d9642['push'](_0x1d9642['shift']());}};_0x180ec6(++_0x2a6719);}(_0x95ae,0x129));var _0xe95a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x95ae[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xe95a('0x0'));module[_0xe95a('0x1')]={'key':{'type':Sequelize[_0xe95a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe95a('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xe95a('0x2')]},'name':{'type':Sequelize[_0xe95a('0x4')],'get':function(){return this[_0xe95a('0x5')](_0xe95a('0x6'));}}}; \ No newline at end of file +var _0xd0d0=['VIRTUAL','key','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0d0,0xe6));var _0x0d0d=function(_0x2455fa,_0x53083d){_0x2455fa=_0x2455fa-0x0;var _0x4a532e=_0xd0d0[_0x2455fa];return _0x4a532e;};'use strict';var Sequelize=require('sequelize');module[_0x0d0d('0x0')]={'key':{'type':Sequelize[_0x0d0d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x0d0d('0x1')]},'name':{'type':Sequelize[_0x0d0d('0x2')],'get':function(){return this['getDataValue'](_0x0d0d('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2f98483..4aa315c 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 _0x3589=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','include','find','catch','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x3589,0x154));var _0x9358=function(_0x5cba10,_0x38a732){_0x5cba10=_0x5cba10-0x0;var _0x58eea8=_0x3589[_0x5cba10];return _0x58eea8;};'use strict';var pdf=require(_0x9358('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9358('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9358('0x2'));var rp=require(_0x9358('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9358('0x4'));var util=require(_0x9358('0x5'));var path=require(_0x9358('0x6'));var sox=require(_0x9358('0x7'));var csv=require(_0x9358('0x8'));var ejs=require(_0x9358('0x9'));var fs=require('fs');var _=require(_0x9358('0xa'));var squel=require(_0x9358('0xb'));var crypto=require(_0x9358('0xc'));var jsforce=require(_0x9358('0xd'));var deskjs=require(_0x9358('0xe'));var toCsv=require(_0x9358('0x8'));var querystring=require(_0x9358('0xf'));var Papa=require(_0x9358('0x10'));var Redis=require(_0x9358('0x11'));var authService=require(_0x9358('0x12'));var qs=require(_0x9358('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9358('0x14'));var logger=require(_0x9358('0x15'))(_0x9358('0x16'));var utils=require(_0x9358('0x17'));var config=require(_0x9358('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x242ca3,_0x590be9){_0x590be9=_0x590be9||0xcc;return function(_0x1b29a7){if(_0x1b29a7){return _0x242ca3[_0x9358('0x19')](_0x590be9);}return _0x242ca3['status'](_0x590be9)[_0x9358('0x1a')]();};}function respondWithResult(_0x210878,_0x37043c){_0x37043c=_0x37043c||0xc8;return function(_0x49a35e){if(_0x49a35e){return _0x210878[_0x9358('0x1b')](_0x37043c)[_0x9358('0x1c')](_0x49a35e);}};}function respondWithFilteredResult(_0x2d7c02,_0x16b846){return function(_0xd50983){if(_0xd50983){var _0x45b808=_0xd50983[_0x9358('0x1d')],_0x5ed815=_0x16b846['offset'],_0xdcd8e3=_0x16b846[_0x9358('0x1e')]+_0x16b846[_0x9358('0x1f')],_0x45cc41;if(_0xdcd8e3>=_0x45b808){_0xdcd8e3=_0x45b808;_0x45cc41=0xc8;}else{_0x45cc41=0xce;}_0x2d7c02['status'](_0x45cc41);return _0x2d7c02['set'](_0x9358('0x20'),_0x5ed815+'-'+_0xdcd8e3+'/'+_0x45b808)['json'](_0xd50983);}return null;};}function patchUpdates(_0x3cbb68){return function(_0x48d5d4){try{jsonpatch[_0x9358('0x21')](_0x48d5d4,_0x3cbb68,!![]);}catch(_0x320147){return BPromise[_0x9358('0x22')](_0x320147);}return _0x48d5d4[_0x9358('0x23')]();};}function saveUpdates(_0x49d7ce,_0x4c38f0){return function(_0x27b379){if(_0x27b379){return _0x27b379[_0x9358('0x24')](_0x49d7ce)[_0x9358('0x25')](function(_0x25cdb1){return _0x25cdb1;});}return null;};}function removeEntity(_0x3111e8,_0x353702){return function(_0x367895){if(_0x367895){return _0x367895[_0x9358('0x26')]()[_0x9358('0x25')](function(){var _0x293d64=_0x367895[_0x9358('0x27')]({'plain':!![]});var _0x3bea7a=_0x9358('0x28');return db[_0x9358('0x29')]['destroy']({'where':{'type':_0x3bea7a,'resourceId':_0x293d64['id']}})[_0x9358('0x25')](function(){return _0x367895;});})[_0x9358('0x25')](function(){_0x3111e8[_0x9358('0x1b')](0xcc)[_0x9358('0x1a')]();});}};}function handleEntityNotFound(_0x8fba7d,_0x2df94a){return function(_0x16b843){if(!_0x16b843){_0x8fba7d[_0x9358('0x19')](0x194);}return _0x16b843;};}function handleError(_0x43c5ba,_0x22c449){_0x22c449=_0x22c449||0x1f4;return function(_0x137939){logger[_0x9358('0x2a')](_0x137939['stack']);if(_0x137939[_0x9358('0x2b')]){delete _0x137939[_0x9358('0x2b')];}_0x43c5ba[_0x9358('0x1b')](_0x22c449)[_0x9358('0x2c')](_0x137939);};}exports[_0x9358('0x2d')]=function(_0x5c8f94,_0x2132eb){var _0x103fdf={},_0x2520bc={},_0x5ab314={'count':0x0,'rows':[]};var _0x52b120=_[_0x9358('0x2e')](db[_0x9358('0x2f')][_0x9358('0x30')],function(_0x86c1bd){return{'name':_0x86c1bd[_0x9358('0x31')],'type':_0x86c1bd[_0x9358('0x32')][_0x9358('0x33')]};});_0x2520bc['model']=_[_0x9358('0x2e')](_0x52b120,'name');_0x2520bc[_0x9358('0x34')]=_[_0x9358('0x35')](_0x5c8f94['query']);_0x2520bc[_0x9358('0x36')]=_[_0x9358('0x37')](_0x2520bc[_0x9358('0x38')],_0x2520bc[_0x9358('0x34')]);_0x103fdf[_0x9358('0x39')]=_[_0x9358('0x37')](_0x2520bc[_0x9358('0x38')],qs[_0x9358('0x3a')](_0x5c8f94[_0x9358('0x34')]['fields']));_0x103fdf[_0x9358('0x39')]=_0x103fdf[_0x9358('0x39')][_0x9358('0x3b')]?_0x103fdf[_0x9358('0x39')]:_0x2520bc['model'];if(!_0x5c8f94[_0x9358('0x34')][_0x9358('0x3c')](_0x9358('0x3d'))){_0x103fdf[_0x9358('0x1f')]=qs[_0x9358('0x1f')](_0x5c8f94['query'][_0x9358('0x1f')]);_0x103fdf[_0x9358('0x1e')]=qs[_0x9358('0x1e')](_0x5c8f94['query']['offset']);}_0x103fdf[_0x9358('0x3e')]=qs[_0x9358('0x3f')](_0x5c8f94[_0x9358('0x34')][_0x9358('0x3f')]);_0x103fdf['where']=qs[_0x9358('0x36')](_[_0x9358('0x40')](_0x5c8f94[_0x9358('0x34')],_0x2520bc[_0x9358('0x36')]),_0x52b120);if(_0x5c8f94[_0x9358('0x34')][_0x9358('0x41')]){_0x103fdf[_0x9358('0x42')]=_[_0x9358('0x43')](_0x103fdf[_0x9358('0x42')],{'$or':_['map'](_0x52b120,function(_0x2a5895){if(_0x2a5895[_0x9358('0x32')]!==_0x9358('0x44')){var _0x131367={};_0x131367[_0x2a5895['name']]={'$like':'%'+_0x5c8f94['query'][_0x9358('0x41')]+'%'};return _0x131367;}})});}_0x103fdf=_['merge']({},_0x103fdf,_0x5c8f94[_0x9358('0x45')]);var _0x5765ca={'where':_0x103fdf[_0x9358('0x42')]};return db[_0x9358('0x2f')][_0x9358('0x1d')](_0x5765ca)[_0x9358('0x25')](function(_0x1627bb){_0x5ab314['count']=_0x1627bb;if(_0x5c8f94[_0x9358('0x34')][_0x9358('0x46')]){_0x103fdf['include']=[{'all':!![]}];}return db[_0x9358('0x2f')][_0x9358('0x47')](_0x103fdf);})[_0x9358('0x25')](function(_0x5a3331){_0x5ab314['rows']=_0x5a3331;return _0x5ab314;})[_0x9358('0x25')](respondWithFilteredResult(_0x2132eb,_0x103fdf))['catch'](handleError(_0x2132eb,null));};exports[_0x9358('0x48')]=function(_0x512430,_0x8414e6){var _0x5b2ed8={'raw':!![],'where':{'id':_0x512430['params']['id']}},_0x2c0d60={};_0x2c0d60[_0x9358('0x38')]=_[_0x9358('0x35')](db[_0x9358('0x2f')][_0x9358('0x30')]);_0x2c0d60['query']=_[_0x9358('0x35')](_0x512430[_0x9358('0x34')]);_0x2c0d60[_0x9358('0x36')]=_['intersection'](_0x2c0d60[_0x9358('0x38')],_0x2c0d60[_0x9358('0x34')]);_0x5b2ed8[_0x9358('0x39')]=_[_0x9358('0x37')](_0x2c0d60[_0x9358('0x38')],qs[_0x9358('0x3a')](_0x512430[_0x9358('0x34')][_0x9358('0x3a')]));_0x5b2ed8[_0x9358('0x39')]=_0x5b2ed8[_0x9358('0x39')][_0x9358('0x3b')]?_0x5b2ed8[_0x9358('0x39')]:_0x2c0d60[_0x9358('0x38')];if(_0x512430[_0x9358('0x34')][_0x9358('0x46')]){_0x5b2ed8[_0x9358('0x49')]=[{'all':!![]}];}_0x5b2ed8=_['merge']({},_0x5b2ed8,_0x512430['options']);return db[_0x9358('0x2f')][_0x9358('0x4a')](_0x5b2ed8)[_0x9358('0x25')](handleEntityNotFound(_0x8414e6,null))['then'](respondWithResult(_0x8414e6,null))[_0x9358('0x4b')](handleError(_0x8414e6,null));};exports[_0x9358('0x24')]=function(_0x592b10,_0x91e7d7){if(_0x592b10[_0x9358('0x4c')]['id']){delete _0x592b10[_0x9358('0x4c')]['id'];}return db[_0x9358('0x2f')]['find']({'where':{'id':_0x592b10[_0x9358('0x4d')]['id']}})[_0x9358('0x25')](handleEntityNotFound(_0x91e7d7,null))[_0x9358('0x25')](saveUpdates(_0x592b10['body'],null))[_0x9358('0x25')](respondWithResult(_0x91e7d7,null))[_0x9358('0x4b')](handleError(_0x91e7d7,null));};exports[_0x9358('0x26')]=function(_0x23c931,_0x445ef5){return db[_0x9358('0x2f')]['find']({'where':{'id':_0x23c931[_0x9358('0x4d')]['id']}})[_0x9358('0x25')](handleEntityNotFound(_0x445ef5,null))[_0x9358('0x25')](removeEntity(_0x445ef5,null))['catch'](handleError(_0x445ef5,null));};exports['create']=function(_0x47ff8a,_0x227e67){var _0x1b70b2={'key':_0x47ff8a[_0x9358('0x4c')][_0x9358('0x33')]};if(_0x47ff8a[_0x9358('0x4c')][_0x9358('0x4e')]){_0x1b70b2[_0x9358('0x4e')]=_0x47ff8a[_0x9358('0x4c')][_0x9358('0x4e')];}else if(_0x47ff8a[_0x9358('0x4c')][_0x9358('0x4f')]){_0x1b70b2['SmsAccountId']=_0x47ff8a['body'][_0x9358('0x4f')];}else if(_0x47ff8a['body']['OpenchannelAccountId']){_0x1b70b2['OpenchannelAccountId']=_0x47ff8a[_0x9358('0x4c')][_0x9358('0x50')];}else if(_0x47ff8a[_0x9358('0x4c')][_0x9358('0x51')]){_0x1b70b2[_0x9358('0x51')]=_0x47ff8a[_0x9358('0x4c')][_0x9358('0x51')];}return db[_0x9358('0x2f')][_0x9358('0x4a')]({'where':_0x1b70b2})[_0x9358('0x25')](function(_0x263143){if(_0x263143){throw new db[(_0x9358('0x52'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x9358('0x53')](_0x47ff8a['body']);})[_0x9358('0x25')](function(_0x9231f1){var _0x4f918b=_0x47ff8a['user'][_0x9358('0x27')]({'plain':!![]});if(!_0x4f918b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f918b[_0x9358('0x54')]==='user'){var _0x2f01ee=_0x9231f1[_0x9358('0x27')]({'plain':!![]});return db[_0x9358('0x55')][_0x9358('0x4a')]({'where':{'name':_0x9358('0x28'),'userProfileId':_0x4f918b['userProfileId']},'raw':!![]})['then'](function(_0xed1552){if(_0xed1552&&_0xed1552[_0x9358('0x56')]===0x0){return db[_0x9358('0x29')][_0x9358('0x53')]({'name':_0x2f01ee[_0x9358('0x2b')],'resourceId':_0x2f01ee['id'],'type':_0xed1552[_0x9358('0x2b')],'sectionId':_0xed1552['id']},{})[_0x9358('0x25')](function(){return _0x9231f1;});}else{return _0x9231f1;}})[_0x9358('0x4b')](function(_0x2e93f3){logger[_0x9358('0x2a')](_0x9358('0x57'),_0x2e93f3);throw _0x2e93f3;});}return _0x9231f1;})[_0x9358('0x25')](respondWithResult(_0x227e67,0xc9))[_0x9358('0x4b')](handleError(_0x227e67,null));}; \ No newline at end of file +var _0x9f56=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','CannedAnswer','includeAll','include','rows','catch','params','length','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','desk.js','to-csv'];(function(_0x5b0f4e,_0x3f4978){var _0x58f77c=function(_0x3ee90f){while(--_0x3ee90f){_0x5b0f4e['push'](_0x5b0f4e['shift']());}};_0x58f77c(++_0x3f4978);}(_0x9f56,0x153));var _0x69f5=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x9f56[_0x2d364e];return _0x1b9312;};'use strict';var pdf=require(_0x69f5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x69f5('0x1'));var jsonpatch=require(_0x69f5('0x2'));var rp=require(_0x69f5('0x3'));var moment=require(_0x69f5('0x4'));var BPromise=require(_0x69f5('0x5'));var Mustache=require(_0x69f5('0x6'));var util=require('util');var path=require(_0x69f5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x69f5('0x8'));var fs=require('fs');var _=require(_0x69f5('0x9'));var squel=require(_0x69f5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x69f5('0xb'));var toCsv=require(_0x69f5('0xc'));var querystring=require(_0x69f5('0xd'));var Papa=require(_0x69f5('0xe'));var Redis=require(_0x69f5('0xf'));var authService=require(_0x69f5('0x10'));var qs=require(_0x69f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69f5('0x12'));var logger=require(_0x69f5('0x13'))('api');var utils=require(_0x69f5('0x14'));var config=require('../../config/environment');var db=require(_0x69f5('0x15'))['db'];function respondWithStatusCode(_0x45ec9f,_0x546f93){_0x546f93=_0x546f93||0xcc;return function(_0x49dbcf){if(_0x49dbcf){return _0x45ec9f['sendStatus'](_0x546f93);}return _0x45ec9f[_0x69f5('0x16')](_0x546f93)['end']();};}function respondWithResult(_0x2c64fd,_0x293620){_0x293620=_0x293620||0xc8;return function(_0x58f2b3){if(_0x58f2b3){return _0x2c64fd['status'](_0x293620)[_0x69f5('0x17')](_0x58f2b3);}};}function respondWithFilteredResult(_0x2bf8f3,_0x1d1004){return function(_0x26a450){if(_0x26a450){var _0x58d9d9=_0x26a450[_0x69f5('0x18')],_0x2da2ea=_0x1d1004[_0x69f5('0x19')],_0x2dd99f=_0x1d1004[_0x69f5('0x19')]+_0x1d1004[_0x69f5('0x1a')],_0x1bf149;if(_0x2dd99f>=_0x58d9d9){_0x2dd99f=_0x58d9d9;_0x1bf149=0xc8;}else{_0x1bf149=0xce;}_0x2bf8f3[_0x69f5('0x16')](_0x1bf149);return _0x2bf8f3[_0x69f5('0x1b')](_0x69f5('0x1c'),_0x2da2ea+'-'+_0x2dd99f+'/'+_0x58d9d9)[_0x69f5('0x17')](_0x26a450);}return null;};}function patchUpdates(_0x5ea2c9){return function(_0x12cea1){try{jsonpatch[_0x69f5('0x1d')](_0x12cea1,_0x5ea2c9,!![]);}catch(_0x49a9c5){return BPromise[_0x69f5('0x1e')](_0x49a9c5);}return _0x12cea1[_0x69f5('0x1f')]();};}function saveUpdates(_0xb5a100,_0x3604aa){return function(_0x15e074){if(_0x15e074){return _0x15e074[_0x69f5('0x20')](_0xb5a100)[_0x69f5('0x21')](function(_0x251e8f){return _0x251e8f;});}return null;};}function removeEntity(_0x3889b6,_0x274b34){return function(_0x3c5433){if(_0x3c5433){return _0x3c5433[_0x69f5('0x22')]()['then'](function(){var _0x2c3dbf=_0x3c5433[_0x69f5('0x23')]({'plain':!![]});var _0x5beb96='CannedAnswers';return db[_0x69f5('0x24')][_0x69f5('0x22')]({'where':{'type':_0x5beb96,'resourceId':_0x2c3dbf['id']}})[_0x69f5('0x21')](function(){return _0x3c5433;});})[_0x69f5('0x21')](function(){_0x3889b6[_0x69f5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad65d,_0x1d0596){return function(_0x6b9a66){if(!_0x6b9a66){_0x3ad65d[_0x69f5('0x25')](0x194);}return _0x6b9a66;};}function handleError(_0x48556a,_0xbee6ca){_0xbee6ca=_0xbee6ca||0x1f4;return function(_0x329e4d){logger[_0x69f5('0x26')](_0x329e4d[_0x69f5('0x27')]);if(_0x329e4d[_0x69f5('0x28')]){delete _0x329e4d[_0x69f5('0x28')];}_0x48556a[_0x69f5('0x16')](_0xbee6ca)['send'](_0x329e4d);};}exports[_0x69f5('0x29')]=function(_0x537d82,_0x24ff69){var _0x227622={},_0x59be32={},_0x50ae17={'count':0x0,'rows':[]};var _0x3fab4b=_[_0x69f5('0x2a')](db['CannedAnswer'][_0x69f5('0x2b')],function(_0x369470){return{'name':_0x369470[_0x69f5('0x2c')],'type':_0x369470['type']['key']};});_0x59be32[_0x69f5('0x2d')]=_[_0x69f5('0x2a')](_0x3fab4b,_0x69f5('0x28'));_0x59be32['query']=_[_0x69f5('0x2e')](_0x537d82[_0x69f5('0x2f')]);_0x59be32[_0x69f5('0x30')]=_[_0x69f5('0x31')](_0x59be32['model'],_0x59be32[_0x69f5('0x2f')]);_0x227622['attributes']=_[_0x69f5('0x31')](_0x59be32[_0x69f5('0x2d')],qs[_0x69f5('0x32')](_0x537d82['query'][_0x69f5('0x32')]));_0x227622['attributes']=_0x227622[_0x69f5('0x33')]['length']?_0x227622[_0x69f5('0x33')]:_0x59be32[_0x69f5('0x2d')];if(!_0x537d82[_0x69f5('0x2f')][_0x69f5('0x34')](_0x69f5('0x35'))){_0x227622[_0x69f5('0x1a')]=qs[_0x69f5('0x1a')](_0x537d82[_0x69f5('0x2f')]['limit']);_0x227622[_0x69f5('0x19')]=qs['offset'](_0x537d82[_0x69f5('0x2f')]['offset']);}_0x227622[_0x69f5('0x36')]=qs[_0x69f5('0x37')](_0x537d82['query'][_0x69f5('0x37')]);_0x227622['where']=qs[_0x69f5('0x30')](_[_0x69f5('0x38')](_0x537d82['query'],_0x59be32['filters']),_0x3fab4b);if(_0x537d82[_0x69f5('0x2f')][_0x69f5('0x39')]){_0x227622[_0x69f5('0x3a')]=_[_0x69f5('0x3b')](_0x227622[_0x69f5('0x3a')],{'$or':_[_0x69f5('0x2a')](_0x3fab4b,function(_0x125dae){if(_0x125dae[_0x69f5('0x3c')]!==_0x69f5('0x3d')){var _0x1a7f47={};_0x1a7f47[_0x125dae[_0x69f5('0x28')]]={'$like':'%'+_0x537d82[_0x69f5('0x2f')][_0x69f5('0x39')]+'%'};return _0x1a7f47;}})});}_0x227622=_[_0x69f5('0x3b')]({},_0x227622,_0x537d82[_0x69f5('0x3e')]);var _0x2075b2={'where':_0x227622[_0x69f5('0x3a')]};return db[_0x69f5('0x3f')][_0x69f5('0x18')](_0x2075b2)[_0x69f5('0x21')](function(_0xab570e){_0x50ae17[_0x69f5('0x18')]=_0xab570e;if(_0x537d82[_0x69f5('0x2f')][_0x69f5('0x40')]){_0x227622[_0x69f5('0x41')]=[{'all':!![]}];}return db[_0x69f5('0x3f')]['findAll'](_0x227622);})['then'](function(_0x3b5973){_0x50ae17[_0x69f5('0x42')]=_0x3b5973;return _0x50ae17;})['then'](respondWithFilteredResult(_0x24ff69,_0x227622))[_0x69f5('0x43')](handleError(_0x24ff69,null));};exports['show']=function(_0x51e220,_0xa618d3){var _0x46ace8={'raw':!![],'where':{'id':_0x51e220[_0x69f5('0x44')]['id']}},_0x2d6039={};_0x2d6039[_0x69f5('0x2d')]=_['keys'](db[_0x69f5('0x3f')][_0x69f5('0x2b')]);_0x2d6039['query']=_['keys'](_0x51e220[_0x69f5('0x2f')]);_0x2d6039[_0x69f5('0x30')]=_[_0x69f5('0x31')](_0x2d6039[_0x69f5('0x2d')],_0x2d6039[_0x69f5('0x2f')]);_0x46ace8[_0x69f5('0x33')]=_[_0x69f5('0x31')](_0x2d6039[_0x69f5('0x2d')],qs[_0x69f5('0x32')](_0x51e220[_0x69f5('0x2f')][_0x69f5('0x32')]));_0x46ace8[_0x69f5('0x33')]=_0x46ace8[_0x69f5('0x33')][_0x69f5('0x45')]?_0x46ace8[_0x69f5('0x33')]:_0x2d6039[_0x69f5('0x2d')];if(_0x51e220['query'][_0x69f5('0x40')]){_0x46ace8[_0x69f5('0x41')]=[{'all':!![]}];}_0x46ace8=_[_0x69f5('0x3b')]({},_0x46ace8,_0x51e220[_0x69f5('0x3e')]);return db[_0x69f5('0x3f')][_0x69f5('0x46')](_0x46ace8)[_0x69f5('0x21')](handleEntityNotFound(_0xa618d3,null))['then'](respondWithResult(_0xa618d3,null))[_0x69f5('0x43')](handleError(_0xa618d3,null));};exports[_0x69f5('0x20')]=function(_0xd721a3,_0x526337){if(_0xd721a3[_0x69f5('0x47')]['id']){delete _0xd721a3['body']['id'];}return db[_0x69f5('0x3f')][_0x69f5('0x46')]({'where':{'id':_0xd721a3[_0x69f5('0x44')]['id']}})[_0x69f5('0x21')](handleEntityNotFound(_0x526337,null))['then'](saveUpdates(_0xd721a3[_0x69f5('0x47')],null))[_0x69f5('0x21')](respondWithResult(_0x526337,null))['catch'](handleError(_0x526337,null));};exports[_0x69f5('0x22')]=function(_0x8fb18d,_0xd8f60e){return db['CannedAnswer'][_0x69f5('0x46')]({'where':{'id':_0x8fb18d[_0x69f5('0x44')]['id']}})[_0x69f5('0x21')](handleEntityNotFound(_0xd8f60e,null))['then'](removeEntity(_0xd8f60e,null))[_0x69f5('0x43')](handleError(_0xd8f60e,null));};exports[_0x69f5('0x48')]=function(_0x21e8ee,_0x316cfb){var _0x3caa70={'key':_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x49')]};if(_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4a')]){_0x3caa70[_0x69f5('0x4a')]=_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4a')];}else if(_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4b')]){_0x3caa70[_0x69f5('0x4b')]=_0x21e8ee['body'][_0x69f5('0x4b')];}else if(_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4c')]){_0x3caa70[_0x69f5('0x4c')]=_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4c')];}else if(_0x21e8ee[_0x69f5('0x47')][_0x69f5('0x4d')]){_0x3caa70[_0x69f5('0x4d')]=_0x21e8ee['body'][_0x69f5('0x4d')];}return db[_0x69f5('0x3f')][_0x69f5('0x46')]({'where':_0x3caa70})[_0x69f5('0x21')](function(_0x3d4cec){if(_0x3d4cec){throw new db[(_0x69f5('0x4e'))][(_0x69f5('0x4f'))](_0x69f5('0x50'));}return db[_0x69f5('0x3f')][_0x69f5('0x48')](_0x21e8ee['body']);})['then'](function(_0x427abb){var _0x2da366=_0x21e8ee[_0x69f5('0x51')][_0x69f5('0x23')]({'plain':!![]});if(!_0x2da366)throw new Error(_0x69f5('0x52'));if(_0x2da366[_0x69f5('0x53')]===_0x69f5('0x51')){var _0x48bae5=_0x427abb['get']({'plain':!![]});return db[_0x69f5('0x54')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x2da366[_0x69f5('0x55')]},'raw':!![]})[_0x69f5('0x21')](function(_0x869b3){if(_0x869b3&&_0x869b3[_0x69f5('0x56')]===0x0){return db[_0x69f5('0x24')][_0x69f5('0x48')]({'name':_0x48bae5[_0x69f5('0x28')],'resourceId':_0x48bae5['id'],'type':_0x869b3[_0x69f5('0x28')],'sectionId':_0x869b3['id']},{})[_0x69f5('0x21')](function(){return _0x427abb;});}else{return _0x427abb;}})[_0x69f5('0x43')](function(_0x51f570){logger[_0x69f5('0x26')](_0x69f5('0x57'),_0x51f570);throw _0x51f570;});}return _0x427abb;})[_0x69f5('0x21')](respondWithResult(_0x316cfb,0xc9))[_0x69f5('0x43')](handleError(_0x316cfb,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b2df47f..c4fe00d 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 _0x5447=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4530a8,_0x31e4fc){var _0x1adbce=function(_0xb7ccaa){while(--_0xb7ccaa){_0x4530a8['push'](_0x4530a8['shift']());}};_0x1adbce(++_0x31e4fc);}(_0x5447,0xf1));var _0x7544=function(_0x62af7b,_0x2bddf2){_0x62af7b=_0x62af7b-0x0;var _0x5f22b4=_0x5447[_0x62af7b];return _0x5f22b4;};'use strict';var _=require(_0x7544('0x0'));var util=require('util');var logger=require(_0x7544('0x1'))(_0x7544('0x2'));var moment=require('moment');var BPromise=require(_0x7544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module[_0x7544('0x8')]=function(_0x7e80,_0x3feef7){return _0x7e80[_0x7544('0x9')](_0x7544('0xa'),attributes,{'tableName':_0x7544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7544('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xab29=['CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x41cb9c,_0x49e06b){var _0x5a3f1e=function(_0x2870e8){while(--_0x2870e8){_0x41cb9c['push'](_0x41cb9c['shift']());}};_0x5a3f1e(++_0x49e06b);}(_0xab29,0x145));var _0x9ab2=function(_0x2fd6ad,_0x262f05){_0x2fd6ad=_0x2fd6ad-0x0;var _0x5d0498=_0xab29[_0x2fd6ad];return _0x5d0498;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))(_0x9ab2('0x3'));var moment=require('moment');var BPromise=require(_0x9ab2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab2('0x5'));var rimraf=require(_0x9ab2('0x6'));var config=require(_0x9ab2('0x7'));var attributes=require(_0x9ab2('0x8'));module[_0x9ab2('0x9')]=function(_0x47cc4f,_0x3c3e85){return _0x47cc4f[_0x9ab2('0xa')](_0x9ab2('0xb'),attributes,{'tableName':_0x9ab2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ab2('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 073dfa9..6e42bd6 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 _0x526d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','stringify','error','CannedAnswer,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x3e8e2a,_0x360a3e){var _0x43be76=function(_0x294929){while(--_0x294929){_0x3e8e2a['push'](_0x3e8e2a['shift']());}};_0x43be76(++_0x360a3e);}(_0x526d,0x102));var _0xd526=function(_0x4522b6,_0x5a9f00){_0x4522b6=_0x4522b6-0x0;var _0x2103cc=_0x526d[_0x4522b6];return _0x2103cc;};'use strict';var _=require(_0xd526('0x0'));var util=require(_0xd526('0x1'));var moment=require(_0xd526('0x2'));var BPromise=require(_0xd526('0x3'));var rs=require(_0xd526('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd526('0x5'))['db'];var utils=require(_0xd526('0x6'));var logger=require('../../config/logger')(_0xd526('0x7'));var config=require(_0xd526('0x8'));var jayson=require(_0xd526('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12e38a,_0x1220b4,_0x54b9ee){return new BPromise(function(_0x31f059,_0x3fc4f8){return client[_0xd526('0xa')](_0x12e38a,_0x54b9ee)[_0xd526('0xb')](function(_0x425fed){logger['info']('CannedAnswer,\x20%s,\x20%s',_0x1220b4,_0xd526('0xc'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x1220b4,'request\x20sent',JSON[_0xd526('0xd')](_0x425fed));if(_0x425fed[_0xd526('0xe')]){if(_0x425fed[_0xd526('0xe')]['code']===0x1f4){logger[_0xd526('0xe')](_0xd526('0xf'),_0x1220b4,_0x425fed[_0xd526('0xe')]['message']);return _0x3fc4f8(_0x425fed['error'][_0xd526('0x10')]);}logger[_0xd526('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x1220b4,_0x425fed['error'][_0xd526('0x10')]);return _0x31f059(_0x425fed[_0xd526('0xe')][_0xd526('0x10')]);}else{logger[_0xd526('0x11')](_0xd526('0xf'),_0x1220b4,_0xd526('0xc'));_0x31f059(_0x425fed[_0xd526('0x12')][_0xd526('0x10')]);}})[_0xd526('0x13')](function(_0x4b79ff){logger['error'](_0xd526('0xf'),_0x1220b4,_0x4b79ff);_0x3fc4f8(_0x4b79ff);});});} \ No newline at end of file +var _0x0fb8=['CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x0fb8,0x1ea));var _0x80fb=function(_0x2d1965,_0x5811b0){_0x2d1965=_0x2d1965-0x0;var _0x38f880=_0x0fb8[_0x2d1965];return _0x38f880;};'use strict';var _=require(_0x80fb('0x0'));var util=require('util');var moment=require(_0x80fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x80fb('0x2'));var fs=require('fs');var Redis=require(_0x80fb('0x3'));var db=require(_0x80fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x80fb('0x5'))('rpc');var config=require(_0x80fb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80fb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3ed9,_0x3681ca,_0x211b0f){return new BPromise(function(_0x3031ee,_0x48f4e4){return client[_0x80fb('0x8')](_0x4c3ed9,_0x211b0f)[_0x80fb('0x9')](function(_0x52904c){logger[_0x80fb('0xa')](_0x80fb('0xb'),_0x3681ca,_0x80fb('0xc'));logger[_0x80fb('0xd')](_0x80fb('0xe'),_0x3681ca,_0x80fb('0xc'),JSON[_0x80fb('0xf')](_0x52904c));if(_0x52904c['error']){if(_0x52904c[_0x80fb('0x10')][_0x80fb('0x11')]===0x1f4){logger[_0x80fb('0x10')](_0x80fb('0xb'),_0x3681ca,_0x52904c[_0x80fb('0x10')]['message']);return _0x48f4e4(_0x52904c[_0x80fb('0x10')][_0x80fb('0x12')]);}logger[_0x80fb('0x10')](_0x80fb('0xb'),_0x3681ca,_0x52904c['error'][_0x80fb('0x12')]);return _0x3031ee(_0x52904c[_0x80fb('0x10')]['message']);}else{logger[_0x80fb('0xa')](_0x80fb('0xb'),_0x3681ca,_0x80fb('0xc'));_0x3031ee(_0x52904c[_0x80fb('0x13')][_0x80fb('0x12')]);}})[_0x80fb('0x14')](function(_0x15c95a){logger[_0x80fb('0x10')](_0x80fb('0xb'),_0x3681ca,_0x15c95a);_0x48f4e4(_0x15c95a);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 97f0fee..aa1287e 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 _0x37a2=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x37a2,0x78));var _0x237a=function(_0x115f2f,_0x106f3d){_0x115f2f=_0x115f2f-0x0;var _0x19b485=_0x37a2[_0x115f2f];return _0x19b485;};'use strict';var multer=require(_0x237a('0x0'));var util=require(_0x237a('0x1'));var path=require(_0x237a('0x2'));var timeout=require(_0x237a('0x3'));var express=require('express');var router=express[_0x237a('0x4')]();var auth=require(_0x237a('0x5'));var interaction=require(_0x237a('0x6'));var config=require(_0x237a('0x7'));var controller=require(_0x237a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x237a('0x9')]);router[_0x237a('0xa')](_0x237a('0xb'),auth[_0x237a('0xc')](),controller[_0x237a('0xd')]);router[_0x237a('0xe')]('/',auth[_0x237a('0xc')](),controller[_0x237a('0xf')]);router[_0x237a('0x10')](_0x237a('0xb'),auth[_0x237a('0xc')](),controller[_0x237a('0x11')]);router[_0x237a('0x12')](_0x237a('0xb'),auth['isAuthenticated'](),controller[_0x237a('0x13')]);module[_0x237a('0x14')]=router; \ No newline at end of file +var _0x4724=['path','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0x36d4ea,_0x1fdf3d){var _0x8bb59f=function(_0x22c58f){while(--_0x22c58f){_0x36d4ea['push'](_0x36d4ea['shift']());}};_0x8bb59f(++_0x1fdf3d);}(_0x4724,0xfe));var _0x4472=function(_0x2d51cc,_0x2ca3e2){_0x2d51cc=_0x2d51cc-0x0;var _0x3dc46b=_0x4724[_0x2d51cc];return _0x3dc46b;};'use strict';var multer=require(_0x4472('0x0'));var util=require(_0x4472('0x1'));var path=require(_0x4472('0x2'));var timeout=require(_0x4472('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4472('0x4'));var config=require(_0x4472('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x4472('0x6')](),controller[_0x4472('0x7')]);router[_0x4472('0x8')](_0x4472('0x9'),auth[_0x4472('0x6')](),controller[_0x4472('0xa')]);router[_0x4472('0xb')]('/',auth['isAuthenticated'](),controller[_0x4472('0xc')]);router['put'](_0x4472('0x9'),auth[_0x4472('0x6')](),controller[_0x4472('0xd')]);router['delete'](_0x4472('0x9'),auth[_0x4472('0x6')](),controller[_0x4472('0xe')]);module[_0x4472('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 545f0e9..6f99e9f 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 _0xfe98=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x47ceb8,_0x313150){var _0x7df114=function(_0x1957b5){while(--_0x1957b5){_0x47ceb8['push'](_0x47ceb8['shift']());}};_0x7df114(++_0x313150);}(_0xfe98,0x12c));var _0x8fe9=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xfe98[_0x56d1ed];return _0x1b282b;};'use strict';var Sequelize=require(_0x8fe9('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8fe9('0x1')],'allowNull':![],'defaultValue':_0x8fe9('0x2')},'clid':{'type':Sequelize[_0x8fe9('0x3')]},'src':{'type':Sequelize[_0x8fe9('0x3')]},'dst':{'type':Sequelize[_0x8fe9('0x3')]},'dcontext':{'type':Sequelize[_0x8fe9('0x3')]},'channel':{'type':Sequelize[_0x8fe9('0x3')]},'dstchannel':{'type':Sequelize[_0x8fe9('0x3')]},'lastapp':{'type':Sequelize[_0x8fe9('0x3')]},'lastdata':{'type':Sequelize[_0x8fe9('0x3')]},'duration':{'type':Sequelize[_0x8fe9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8fe9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8fe9('0x3')]},'amaflags':{'type':Sequelize[_0x8fe9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8fe9('0x3')]},'userfield':{'type':Sequelize[_0x8fe9('0x3')]},'uniqueid':{'type':Sequelize[_0x8fe9('0x3')]},'linkedid':{'type':Sequelize[_0x8fe9('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8fe9('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x8fe9('0x3')]}}; \ No newline at end of file +var _0xe48b=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0xe48b,0x1ea));var _0xbe48=function(_0x3680c1,_0x3378fc){_0x3680c1=_0x3680c1-0x0;var _0x2bb894=_0xe48b[_0x3680c1];return _0x2bb894;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xbe48('0x0')},'clid':{'type':Sequelize[_0xbe48('0x1')]},'src':{'type':Sequelize[_0xbe48('0x1')]},'dst':{'type':Sequelize[_0xbe48('0x1')]},'dcontext':{'type':Sequelize[_0xbe48('0x1')]},'channel':{'type':Sequelize[_0xbe48('0x1')]},'dstchannel':{'type':Sequelize[_0xbe48('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xbe48('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbe48('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbe48('0x1')]},'amaflags':{'type':Sequelize[_0xbe48('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbe48('0x1')]},'userfield':{'type':Sequelize[_0xbe48('0x1')]},'uniqueid':{'type':Sequelize[_0xbe48('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xbe48('0x1')]},'peeraccount':{'type':Sequelize[_0xbe48('0x1')]},'type':{'type':Sequelize[_0xbe48('0x1')]},'tag':{'type':Sequelize[_0xbe48('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 97e6d65..677a08e 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 _0x8b37=['count','includeAll','rows','catch','show','include','create','body','find','params','describe','html-pdf','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1d3fbf,_0x159027){var _0xd9e6e8=function(_0x1c059e){while(--_0x1c059e){_0x1d3fbf['push'](_0x1d3fbf['shift']());}};_0xd9e6e8(++_0x159027);}(_0x8b37,0x1b5));var _0x78b3=function(_0x573278,_0x33bd9e){_0x573278=_0x573278-0x0;var _0x3f44d5=_0x8b37[_0x573278];return _0x3f44d5;};'use strict';var pdf=require(_0x78b3('0x0'));var emlformat=require(_0x78b3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x78b3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78b3('0x3'));var Mustache=require(_0x78b3('0x4'));var util=require('util');var path=require(_0x78b3('0x5'));var sox=require(_0x78b3('0x6'));var csv=require(_0x78b3('0x7'));var ejs=require(_0x78b3('0x8'));var fs=require('fs');var _=require(_0x78b3('0x9'));var squel=require(_0x78b3('0xa'));var crypto=require(_0x78b3('0xb'));var jsforce=require(_0x78b3('0xc'));var deskjs=require(_0x78b3('0xd'));var toCsv=require(_0x78b3('0x7'));var querystring=require('querystring');var Papa=require(_0x78b3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x78b3('0xf'));var as=require(_0x78b3('0x10'));var hardwareService=require(_0x78b3('0x11'));var logger=require('../../config/logger')(_0x78b3('0x12'));var utils=require('../../config/utils');var config=require(_0x78b3('0x13'));var db=require(_0x78b3('0x14'))['db'];function respondWithStatusCode(_0x5233b3,_0x2ea95c){_0x2ea95c=_0x2ea95c||0xcc;return function(_0x3a5818){if(_0x3a5818){return _0x5233b3[_0x78b3('0x15')](_0x2ea95c);}return _0x5233b3['status'](_0x2ea95c)[_0x78b3('0x16')]();};}function respondWithResult(_0x56f3a0,_0x5acf54){_0x5acf54=_0x5acf54||0xc8;return function(_0x3aab97){if(_0x3aab97){return _0x56f3a0[_0x78b3('0x17')](_0x5acf54)[_0x78b3('0x18')](_0x3aab97);}};}function respondWithFilteredResult(_0x5065d9,_0x388260){return function(_0x39762c){if(_0x39762c){var _0x4c0d92=_0x39762c['count'],_0x16b69b=_0x388260['offset'],_0xb512db=_0x388260[_0x78b3('0x19')]+_0x388260[_0x78b3('0x1a')],_0x40861c;if(_0xb512db>=_0x4c0d92){_0xb512db=_0x4c0d92;_0x40861c=0xc8;}else{_0x40861c=0xce;}_0x5065d9[_0x78b3('0x17')](_0x40861c);return _0x5065d9[_0x78b3('0x1b')](_0x78b3('0x1c'),_0x16b69b+'-'+_0xb512db+'/'+_0x4c0d92)[_0x78b3('0x18')](_0x39762c);}return null;};}function patchUpdates(_0x5245c1){return function(_0x37eff4){try{jsonpatch[_0x78b3('0x1d')](_0x37eff4,_0x5245c1,!![]);}catch(_0x32d73f){return BPromise['reject'](_0x32d73f);}return _0x37eff4[_0x78b3('0x1e')]();};}function saveUpdates(_0x4966c6,_0x52b6f5){return function(_0x5f3db5){if(_0x5f3db5){return _0x5f3db5[_0x78b3('0x1f')](_0x4966c6)[_0x78b3('0x20')](function(_0x2d2ccd){return _0x2d2ccd;});}return null;};}function removeEntity(_0x78855a,_0xec6ab6){return function(_0x2e0c64){if(_0x2e0c64){return _0x2e0c64[_0x78b3('0x21')]()[_0x78b3('0x20')](function(){_0x78855a[_0x78b3('0x17')](0xcc)[_0x78b3('0x16')]();});}};}function handleEntityNotFound(_0x2f8014,_0x2335b6){return function(_0x256e37){if(!_0x256e37){_0x2f8014[_0x78b3('0x15')](0x194);}return _0x256e37;};}function handleError(_0x576335,_0x1bdce1){_0x1bdce1=_0x1bdce1||0x1f4;return function(_0x280b55){logger[_0x78b3('0x22')](_0x280b55['stack']);if(_0x280b55[_0x78b3('0x23')]){delete _0x280b55[_0x78b3('0x23')];}_0x576335[_0x78b3('0x17')](_0x1bdce1)[_0x78b3('0x24')](_0x280b55);};}exports['index']=function(_0x486e06,_0x4b4de3){var _0x551c5f={},_0x5a8c55={},_0x2f75ad={'count':0x0,'rows':[]};var _0x470850=_[_0x78b3('0x25')](db[_0x78b3('0x26')][_0x78b3('0x27')],function(_0x5691d2){return{'name':_0x5691d2[_0x78b3('0x28')],'type':_0x5691d2[_0x78b3('0x29')][_0x78b3('0x2a')]};});_0x5a8c55['model']=_['map'](_0x470850,_0x78b3('0x23'));_0x5a8c55[_0x78b3('0x2b')]=_[_0x78b3('0x2c')](_0x486e06['query']);_0x5a8c55[_0x78b3('0x2d')]=_[_0x78b3('0x2e')](_0x5a8c55[_0x78b3('0x2f')],_0x5a8c55[_0x78b3('0x2b')]);_0x551c5f[_0x78b3('0x30')]=_[_0x78b3('0x2e')](_0x5a8c55[_0x78b3('0x2f')],qs['fields'](_0x486e06['query'][_0x78b3('0x31')]));_0x551c5f['attributes']=_0x551c5f[_0x78b3('0x30')][_0x78b3('0x32')]?_0x551c5f[_0x78b3('0x30')]:_0x5a8c55['model'];if(!_0x486e06[_0x78b3('0x2b')]['hasOwnProperty'](_0x78b3('0x33'))){_0x551c5f['limit']=qs[_0x78b3('0x1a')](_0x486e06[_0x78b3('0x2b')][_0x78b3('0x1a')]);_0x551c5f[_0x78b3('0x19')]=qs['offset'](_0x486e06[_0x78b3('0x2b')]['offset']);}_0x551c5f[_0x78b3('0x34')]=qs[_0x78b3('0x35')](_0x486e06[_0x78b3('0x2b')][_0x78b3('0x35')]);_0x551c5f['where']=qs[_0x78b3('0x2d')](_[_0x78b3('0x36')](_0x486e06[_0x78b3('0x2b')],_0x5a8c55[_0x78b3('0x2d')]),_0x470850);if(_0x486e06['query'][_0x78b3('0x37')]){_0x551c5f[_0x78b3('0x38')]=_[_0x78b3('0x39')](_0x551c5f[_0x78b3('0x38')],{'$or':_[_0x78b3('0x25')](_0x470850,function(_0x439d65){if(_0x439d65[_0x78b3('0x29')]!==_0x78b3('0x3a')){var _0x44628c={};_0x44628c[_0x439d65['name']]={'$like':'%'+_0x486e06[_0x78b3('0x2b')][_0x78b3('0x37')]+'%'};return _0x44628c;}})});}_0x551c5f=_[_0x78b3('0x39')]({},_0x551c5f,_0x486e06[_0x78b3('0x3b')]);var _0x3ee479={'where':_0x551c5f[_0x78b3('0x38')]};return db[_0x78b3('0x26')][_0x78b3('0x3c')](_0x3ee479)['then'](function(_0x2dcc62){_0x2f75ad['count']=_0x2dcc62;if(_0x486e06[_0x78b3('0x2b')][_0x78b3('0x3d')]){_0x551c5f['include']=[{'all':!![]}];}return db[_0x78b3('0x26')]['findAll'](_0x551c5f);})[_0x78b3('0x20')](function(_0x2632e5){_0x2f75ad[_0x78b3('0x3e')]=_0x2632e5;return _0x2f75ad;})[_0x78b3('0x20')](respondWithFilteredResult(_0x4b4de3,_0x551c5f))[_0x78b3('0x3f')](handleError(_0x4b4de3,null));};exports[_0x78b3('0x40')]=function(_0x5593aa,_0x35aa18){var _0x17c24f={'raw':!![],'where':{'id':_0x5593aa['params']['id']}},_0x286993={};_0x286993['model']=_['keys'](db[_0x78b3('0x26')]['rawAttributes']);_0x286993['query']=_[_0x78b3('0x2c')](_0x5593aa['query']);_0x286993[_0x78b3('0x2d')]=_['intersection'](_0x286993[_0x78b3('0x2f')],_0x286993[_0x78b3('0x2b')]);_0x17c24f[_0x78b3('0x30')]=_[_0x78b3('0x2e')](_0x286993[_0x78b3('0x2f')],qs['fields'](_0x5593aa[_0x78b3('0x2b')][_0x78b3('0x31')]));_0x17c24f[_0x78b3('0x30')]=_0x17c24f[_0x78b3('0x30')][_0x78b3('0x32')]?_0x17c24f[_0x78b3('0x30')]:_0x286993[_0x78b3('0x2f')];if(_0x5593aa[_0x78b3('0x2b')][_0x78b3('0x3d')]){_0x17c24f[_0x78b3('0x41')]=[{'all':!![]}];}_0x17c24f=_['merge']({},_0x17c24f,_0x5593aa[_0x78b3('0x3b')]);return db[_0x78b3('0x26')]['find'](_0x17c24f)[_0x78b3('0x20')](handleEntityNotFound(_0x35aa18,null))['then'](respondWithResult(_0x35aa18,null))[_0x78b3('0x3f')](handleError(_0x35aa18,null));};exports['create']=function(_0x209283,_0x54440c){return db[_0x78b3('0x26')][_0x78b3('0x42')](_0x209283[_0x78b3('0x43')],{})['then'](respondWithResult(_0x54440c,0xc9))[_0x78b3('0x3f')](handleError(_0x54440c,null));};exports[_0x78b3('0x1f')]=function(_0x1c54a8,_0x29143c){if(_0x1c54a8[_0x78b3('0x43')]['id']){delete _0x1c54a8[_0x78b3('0x43')]['id'];}return db['Cdr'][_0x78b3('0x44')]({'where':{'id':_0x1c54a8[_0x78b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x29143c,null))[_0x78b3('0x20')](saveUpdates(_0x1c54a8['body'],null))[_0x78b3('0x20')](respondWithResult(_0x29143c,null))['catch'](handleError(_0x29143c,null));};exports[_0x78b3('0x21')]=function(_0x4be58c,_0x2360b8){return db[_0x78b3('0x26')][_0x78b3('0x44')]({'where':{'id':_0x4be58c[_0x78b3('0x45')]['id']}})[_0x78b3('0x20')](handleEntityNotFound(_0x2360b8,null))[_0x78b3('0x20')](removeEntity(_0x2360b8,null))[_0x78b3('0x3f')](handleError(_0x2360b8,null));};exports[_0x78b3('0x46')]=function(_0x19716f,_0x254249){return db['Cdr'][_0x78b3('0x46')]()[_0x78b3('0x20')](respondWithResult(_0x254249,null))[_0x78b3('0x3f')](handleError(_0x254249,null));}; \ No newline at end of file +var _0x26f2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','catch','show','params','options','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4301c7,_0x34373b){var _0x167782=function(_0x5e9ede){while(--_0x5e9ede){_0x4301c7['push'](_0x4301c7['shift']());}};_0x167782(++_0x34373b);}(_0x26f2,0x1ac));var _0x226f=function(_0x127b05,_0x5525e1){_0x127b05=_0x127b05-0x0;var _0x3d79f4=_0x26f2[_0x127b05];return _0x3d79f4;};'use strict';var pdf=require(_0x226f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x226f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x226f('0x2'));var rp=require(_0x226f('0x3'));var moment=require(_0x226f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x226f('0x5'));var util=require(_0x226f('0x6'));var path=require(_0x226f('0x7'));var sox=require(_0x226f('0x8'));var csv=require(_0x226f('0x9'));var ejs=require(_0x226f('0xa'));var fs=require('fs');var _=require(_0x226f('0xb'));var squel=require(_0x226f('0xc'));var crypto=require(_0x226f('0xd'));var jsforce=require(_0x226f('0xe'));var deskjs=require(_0x226f('0xf'));var toCsv=require(_0x226f('0x9'));var querystring=require(_0x226f('0x10'));var Papa=require(_0x226f('0x11'));var Redis=require(_0x226f('0x12'));var authService=require(_0x226f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x226f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x226f('0x15'))(_0x226f('0x16'));var utils=require(_0x226f('0x17'));var config=require(_0x226f('0x18'));var db=require(_0x226f('0x19'))['db'];function respondWithStatusCode(_0x26a291,_0x36559b){_0x36559b=_0x36559b||0xcc;return function(_0x3ed0c4){if(_0x3ed0c4){return _0x26a291['sendStatus'](_0x36559b);}return _0x26a291[_0x226f('0x1a')](_0x36559b)[_0x226f('0x1b')]();};}function respondWithResult(_0x393ef5,_0x2c632f){_0x2c632f=_0x2c632f||0xc8;return function(_0x3093d4){if(_0x3093d4){return _0x393ef5[_0x226f('0x1a')](_0x2c632f)['json'](_0x3093d4);}};}function respondWithFilteredResult(_0x3e3306,_0x1809e9){return function(_0x4e12dc){if(_0x4e12dc){var _0x5bcda1=_0x4e12dc[_0x226f('0x1c')],_0x35a3ae=_0x1809e9[_0x226f('0x1d')],_0xaf7996=_0x1809e9[_0x226f('0x1d')]+_0x1809e9[_0x226f('0x1e')],_0x50e53a;if(_0xaf7996>=_0x5bcda1){_0xaf7996=_0x5bcda1;_0x50e53a=0xc8;}else{_0x50e53a=0xce;}_0x3e3306['status'](_0x50e53a);return _0x3e3306[_0x226f('0x1f')]('Content-Range',_0x35a3ae+'-'+_0xaf7996+'/'+_0x5bcda1)['json'](_0x4e12dc);}return null;};}function patchUpdates(_0x572966){return function(_0x1ca136){try{jsonpatch['apply'](_0x1ca136,_0x572966,!![]);}catch(_0x4d4d8b){return BPromise[_0x226f('0x20')](_0x4d4d8b);}return _0x1ca136[_0x226f('0x21')]();};}function saveUpdates(_0x337f4f,_0x46fca2){return function(_0x1defa3){if(_0x1defa3){return _0x1defa3[_0x226f('0x22')](_0x337f4f)[_0x226f('0x23')](function(_0x15405e){return _0x15405e;});}return null;};}function removeEntity(_0x14e208,_0x140be1){return function(_0x2af262){if(_0x2af262){return _0x2af262[_0x226f('0x24')]()['then'](function(){_0x14e208[_0x226f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c42c6,_0x85f0fe){return function(_0x10163d){if(!_0x10163d){_0x2c42c6[_0x226f('0x25')](0x194);}return _0x10163d;};}function handleError(_0xf17fbc,_0x213cbf){_0x213cbf=_0x213cbf||0x1f4;return function(_0x71e3d4){logger[_0x226f('0x26')](_0x71e3d4['stack']);if(_0x71e3d4['name']){delete _0x71e3d4[_0x226f('0x27')];}_0xf17fbc[_0x226f('0x1a')](_0x213cbf)[_0x226f('0x28')](_0x71e3d4);};}exports[_0x226f('0x29')]=function(_0x4a50b7,_0x48d4b9){var _0x516309={},_0x8763b9={},_0x1d8b57={'count':0x0,'rows':[]};var _0x539431=_[_0x226f('0x2a')](db[_0x226f('0x2b')][_0x226f('0x2c')],function(_0x40fbf7){return{'name':_0x40fbf7[_0x226f('0x2d')],'type':_0x40fbf7['type'][_0x226f('0x2e')]};});_0x8763b9[_0x226f('0x2f')]=_[_0x226f('0x2a')](_0x539431,'name');_0x8763b9[_0x226f('0x30')]=_[_0x226f('0x31')](_0x4a50b7[_0x226f('0x30')]);_0x8763b9[_0x226f('0x32')]=_[_0x226f('0x33')](_0x8763b9[_0x226f('0x2f')],_0x8763b9[_0x226f('0x30')]);_0x516309[_0x226f('0x34')]=_[_0x226f('0x33')](_0x8763b9[_0x226f('0x2f')],qs['fields'](_0x4a50b7['query'][_0x226f('0x35')]));_0x516309['attributes']=_0x516309[_0x226f('0x34')][_0x226f('0x36')]?_0x516309[_0x226f('0x34')]:_0x8763b9[_0x226f('0x2f')];if(!_0x4a50b7[_0x226f('0x30')][_0x226f('0x37')](_0x226f('0x38'))){_0x516309[_0x226f('0x1e')]=qs['limit'](_0x4a50b7[_0x226f('0x30')][_0x226f('0x1e')]);_0x516309['offset']=qs[_0x226f('0x1d')](_0x4a50b7[_0x226f('0x30')][_0x226f('0x1d')]);}_0x516309[_0x226f('0x39')]=qs[_0x226f('0x3a')](_0x4a50b7[_0x226f('0x30')][_0x226f('0x3a')]);_0x516309[_0x226f('0x3b')]=qs[_0x226f('0x32')](_[_0x226f('0x3c')](_0x4a50b7[_0x226f('0x30')],_0x8763b9[_0x226f('0x32')]),_0x539431);if(_0x4a50b7[_0x226f('0x30')][_0x226f('0x3d')]){_0x516309[_0x226f('0x3b')]=_[_0x226f('0x3e')](_0x516309['where'],{'$or':_[_0x226f('0x2a')](_0x539431,function(_0x59c232){if(_0x59c232[_0x226f('0x3f')]!=='VIRTUAL'){var _0xe2df41={};_0xe2df41[_0x59c232[_0x226f('0x27')]]={'$like':'%'+_0x4a50b7[_0x226f('0x30')]['filter']+'%'};return _0xe2df41;}})});}_0x516309=_[_0x226f('0x3e')]({},_0x516309,_0x4a50b7['options']);var _0x204b06={'where':_0x516309['where']};return db[_0x226f('0x2b')][_0x226f('0x1c')](_0x204b06)[_0x226f('0x23')](function(_0x18451a){_0x1d8b57[_0x226f('0x1c')]=_0x18451a;if(_0x4a50b7[_0x226f('0x30')][_0x226f('0x40')]){_0x516309['include']=[{'all':!![]}];}return db[_0x226f('0x2b')][_0x226f('0x41')](_0x516309);})[_0x226f('0x23')](function(_0x323d03){_0x1d8b57['rows']=_0x323d03;return _0x1d8b57;})['then'](respondWithFilteredResult(_0x48d4b9,_0x516309))[_0x226f('0x42')](handleError(_0x48d4b9,null));};exports[_0x226f('0x43')]=function(_0x43436b,_0xffb4e1){var _0x59a235={'raw':!![],'where':{'id':_0x43436b[_0x226f('0x44')]['id']}},_0x25133b={};_0x25133b[_0x226f('0x2f')]=_[_0x226f('0x31')](db['Cdr'][_0x226f('0x2c')]);_0x25133b[_0x226f('0x30')]=_[_0x226f('0x31')](_0x43436b[_0x226f('0x30')]);_0x25133b[_0x226f('0x32')]=_[_0x226f('0x33')](_0x25133b[_0x226f('0x2f')],_0x25133b['query']);_0x59a235[_0x226f('0x34')]=_[_0x226f('0x33')](_0x25133b[_0x226f('0x2f')],qs[_0x226f('0x35')](_0x43436b['query']['fields']));_0x59a235[_0x226f('0x34')]=_0x59a235[_0x226f('0x34')][_0x226f('0x36')]?_0x59a235['attributes']:_0x25133b[_0x226f('0x2f')];if(_0x43436b['query'][_0x226f('0x40')]){_0x59a235['include']=[{'all':!![]}];}_0x59a235=_[_0x226f('0x3e')]({},_0x59a235,_0x43436b[_0x226f('0x45')]);return db[_0x226f('0x2b')][_0x226f('0x46')](_0x59a235)[_0x226f('0x23')](handleEntityNotFound(_0xffb4e1,null))[_0x226f('0x23')](respondWithResult(_0xffb4e1,null))[_0x226f('0x42')](handleError(_0xffb4e1,null));};exports[_0x226f('0x47')]=function(_0x249b66,_0x2fb835){return db['Cdr'][_0x226f('0x47')](_0x249b66['body'],{})[_0x226f('0x23')](respondWithResult(_0x2fb835,0xc9))['catch'](handleError(_0x2fb835,null));};exports[_0x226f('0x22')]=function(_0x17317d,_0x35cd38){if(_0x17317d[_0x226f('0x48')]['id']){delete _0x17317d[_0x226f('0x48')]['id'];}return db['Cdr'][_0x226f('0x46')]({'where':{'id':_0x17317d[_0x226f('0x44')]['id']}})[_0x226f('0x23')](handleEntityNotFound(_0x35cd38,null))[_0x226f('0x23')](saveUpdates(_0x17317d['body'],null))[_0x226f('0x23')](respondWithResult(_0x35cd38,null))[_0x226f('0x42')](handleError(_0x35cd38,null));};exports[_0x226f('0x24')]=function(_0x551799,_0x5d7eb6){return db[_0x226f('0x2b')][_0x226f('0x46')]({'where':{'id':_0x551799[_0x226f('0x44')]['id']}})[_0x226f('0x23')](handleEntityNotFound(_0x5d7eb6,null))['then'](removeEntity(_0x5d7eb6,null))[_0x226f('0x42')](handleError(_0x5d7eb6,null));};exports[_0x226f('0x49')]=function(_0x2f2b40,_0x242902){return db[_0x226f('0x2b')][_0x226f('0x49')]()[_0x226f('0x23')](respondWithResult(_0x242902,null))[_0x226f('0x42')](handleError(_0x242902,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 12c631b..4dda97c 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 _0x01af=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x15db9e,_0x3c2403){var _0x45e4e2=function(_0x39bd1b){while(--_0x39bd1b){_0x15db9e['push'](_0x15db9e['shift']());}};_0x45e4e2(++_0x3c2403);}(_0x01af,0x12c));var _0xf01a=function(_0x4c3932,_0xbd80e5){_0x4c3932=_0x4c3932-0x0;var _0x226628=_0x01af[_0x4c3932];return _0x226628;};'use strict';var _=require(_0xf01a('0x0'));var util=require(_0xf01a('0x1'));var logger=require(_0xf01a('0x2'))(_0xf01a('0x3'));var moment=require(_0xf01a('0x4'));var BPromise=require(_0xf01a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf01a('0x6'));var rimraf=require(_0xf01a('0x7'));var config=require(_0xf01a('0x8'));var attributes=require(_0xf01a('0x9'));module[_0xf01a('0xa')]=function(_0x21ecc8,_0x5db4e5){return _0x21ecc8[_0xf01a('0xb')](_0xf01a('0xc'),attributes,{'tableName':_0xf01a('0xd'),'paranoid':![],'indexes':[{'name':_0xf01a('0xe'),'fields':[_0xf01a('0xe')]},{'name':'calldate','fields':[_0xf01a('0xf')]},{'name':_0xf01a('0x10'),'fields':[_0xf01a('0x10')]},{'name':_0xf01a('0x11'),'fields':['dst']},{'name':_0xf01a('0x12'),'fields':[_0xf01a('0x12')]},{'name':_0xf01a('0x13'),'fields':[_0xf01a('0x13')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6191=['src','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst'];(function(_0x576d39,_0x5daba9){var _0x5f3350=function(_0x22af49){while(--_0x22af49){_0x576d39['push'](_0x576d39['shift']());}};_0x5f3350(++_0x5daba9);}(_0x6191,0x6e));var _0x1619=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x6191[_0x208505];return _0x1a985f;};'use strict';var _=require('lodash');var util=require(_0x1619('0x0'));var logger=require('../../config/logger')(_0x1619('0x1'));var moment=require(_0x1619('0x2'));var BPromise=require('bluebird');var rp=require(_0x1619('0x3'));var fs=require('fs');var path=require(_0x1619('0x4'));var rimraf=require(_0x1619('0x5'));var config=require(_0x1619('0x6'));var attributes=require(_0x1619('0x7'));module[_0x1619('0x8')]=function(_0x4df404,_0x36dab8){return _0x4df404[_0x1619('0x9')](_0x1619('0xa'),attributes,{'tableName':_0x1619('0xb'),'paranoid':![],'indexes':[{'name':_0x1619('0xc'),'fields':[_0x1619('0xc')]},{'name':_0x1619('0xd'),'fields':['calldate']},{'name':_0x1619('0xe'),'fields':['disposition']},{'name':'dst','fields':[_0x1619('0xf')]},{'name':_0x1619('0x10'),'fields':[_0x1619('0x10')]},{'name':_0x1619('0x11'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 4137530..955d5cb 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 _0x7512=['error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x20d024,_0x3f9666){var _0x3dc07e=function(_0x1eab3e){while(--_0x1eab3e){_0x20d024['push'](_0x20d024['shift']());}};_0x3dc07e(++_0x3f9666);}(_0x7512,0xaf));var _0x2751=function(_0x34c542,_0x220b05){_0x34c542=_0x34c542-0x0;var _0x5b9ec2=_0x7512[_0x34c542];return _0x5b9ec2;};'use strict';var _=require(_0x2751('0x0'));var util=require(_0x2751('0x1'));var moment=require(_0x2751('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2751('0x3'));var db=require(_0x2751('0x4'))['db'];var utils=require(_0x2751('0x5'));var logger=require('../../config/logger')(_0x2751('0x6'));var config=require('../../config/environment');var jayson=require(_0x2751('0x7'));var client=jayson['client'][_0x2751('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b8dcb,_0x42a3fe,_0x16dcde){return new BPromise(function(_0x42bfb6,_0x528766){return client['request'](_0x3b8dcb,_0x16dcde)[_0x2751('0x9')](function(_0x4d5349){logger[_0x2751('0xa')](_0x2751('0xb'),_0x42a3fe,'request\x20sent');logger[_0x2751('0xc')](_0x2751('0xd'),_0x42a3fe,_0x2751('0xe'),JSON['stringify'](_0x4d5349));if(_0x4d5349[_0x2751('0xf')]){if(_0x4d5349[_0x2751('0xf')][_0x2751('0x10')]===0x1f4){logger[_0x2751('0xf')](_0x2751('0xb'),_0x42a3fe,_0x4d5349['error'][_0x2751('0x11')]);return _0x528766(_0x4d5349[_0x2751('0xf')]['message']);}logger[_0x2751('0xf')](_0x2751('0xb'),_0x42a3fe,_0x4d5349[_0x2751('0xf')]['message']);return _0x42bfb6(_0x4d5349[_0x2751('0xf')][_0x2751('0x11')]);}else{logger[_0x2751('0xa')](_0x2751('0xb'),_0x42a3fe,_0x2751('0xe'));_0x42bfb6(_0x4d5349[_0x2751('0x12')][_0x2751('0x11')]);}})['catch'](function(_0x2d00e2){logger['error'](_0x2751('0xb'),_0x42a3fe,_0x2d00e2);_0x528766(_0x2d00e2);});});} \ No newline at end of file +var _0x8075=['code','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x304c16,_0x217728){var _0x526883=function(_0x53e82d){while(--_0x53e82d){_0x304c16['push'](_0x304c16['shift']());}};_0x526883(++_0x217728);}(_0x8075,0x11e));var _0x5807=function(_0x2a0154,_0x18ec3a){_0x2a0154=_0x2a0154-0x0;var _0x257304=_0x8075[_0x2a0154];return _0x257304;};'use strict';var _=require(_0x5807('0x0'));var util=require('util');var moment=require(_0x5807('0x1'));var BPromise=require(_0x5807('0x2'));var rs=require(_0x5807('0x3'));var fs=require('fs');var Redis=require(_0x5807('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5807('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5807('0x6'));var jayson=require(_0x5807('0x7'));var client=jayson[_0x5807('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e92d7,_0x8b3c8f,_0x8147ef){return new BPromise(function(_0x85929,_0x1b16f5){return client[_0x5807('0x9')](_0x1e92d7,_0x8147ef)['then'](function(_0xf11250){logger[_0x5807('0xa')]('Cdr,\x20%s,\x20%s',_0x8b3c8f,'request\x20sent');logger[_0x5807('0xb')](_0x5807('0xc'),_0x8b3c8f,_0x5807('0xd'),JSON['stringify'](_0xf11250));if(_0xf11250['error']){if(_0xf11250['error'][_0x5807('0xe')]===0x1f4){logger[_0x5807('0xf')](_0x5807('0x10'),_0x8b3c8f,_0xf11250['error'][_0x5807('0x11')]);return _0x1b16f5(_0xf11250[_0x5807('0xf')][_0x5807('0x11')]);}logger['error'](_0x5807('0x10'),_0x8b3c8f,_0xf11250[_0x5807('0xf')]['message']);return _0x85929(_0xf11250[_0x5807('0xf')]['message']);}else{logger[_0x5807('0xa')]('Cdr,\x20%s,\x20%s',_0x8b3c8f,_0x5807('0xd'));_0x85929(_0xf11250[_0x5807('0x12')][_0x5807('0x11')]);}})[_0x5807('0x13')](function(_0x405a00){logger[_0x5807('0xf')](_0x5807('0x10'),_0x8b3c8f,_0x405a00);_0x1b16f5(_0x405a00);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 26bea6b..7274e90 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 _0xea04=['destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete'];(function(_0x100761,_0x9090e5){var _0x3ac2f1=function(_0x1687f5){while(--_0x1687f5){_0x100761['push'](_0x100761['shift']());}};_0x3ac2f1(++_0x9090e5);}(_0xea04,0x157));var _0x4ea0=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xea04[_0x2e8418];return _0x548fe6;};'use strict';var multer=require('multer');var util=require(_0x4ea0('0x0'));var path=require(_0x4ea0('0x1'));var timeout=require(_0x4ea0('0x2'));var express=require(_0x4ea0('0x3'));var router=express[_0x4ea0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ea0('0x5'));var config=require('../../config/environment');var controller=require(_0x4ea0('0x6'));router[_0x4ea0('0x7')]('/',auth[_0x4ea0('0x8')](),controller[_0x4ea0('0x9')]);router[_0x4ea0('0x7')](_0x4ea0('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4ea0('0xb'),auth['isAuthenticated'](),controller[_0x4ea0('0xc')]);router[_0x4ea0('0xd')]('/',auth[_0x4ea0('0x8')](),controller['create']);router[_0x4ea0('0xe')](_0x4ea0('0xb'),auth[_0x4ea0('0x8')](),controller[_0x4ea0('0xf')]);router[_0x4ea0('0x10')](_0x4ea0('0xb'),auth[_0x4ea0('0x8')](),controller[_0x4ea0('0x11')]);module['exports']=router; \ No newline at end of file +var _0xca15=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x5d3223,_0x49e33b){var _0x3e3064=function(_0x1a737d){while(--_0x1a737d){_0x5d3223['push'](_0x5d3223['shift']());}};_0x3e3064(++_0x49e33b);}(_0xca15,0xbb));var _0x5ca1=function(_0x472ee7,_0x302242){_0x472ee7=_0x472ee7-0x0;var _0x6aa3f3=_0xca15[_0x472ee7];return _0x6aa3f3;};'use strict';var multer=require(_0x5ca1('0x0'));var util=require(_0x5ca1('0x1'));var path=require(_0x5ca1('0x2'));var timeout=require(_0x5ca1('0x3'));var express=require(_0x5ca1('0x4'));var router=express['Router']();var auth=require(_0x5ca1('0x5'));var interaction=require(_0x5ca1('0x6'));var config=require(_0x5ca1('0x7'));var controller=require(_0x5ca1('0x8'));router[_0x5ca1('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ca1('0xa')]);router['get']('/describe',auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xc')]);router['get']('/:id',auth[_0x5ca1('0xb')](),controller['show']);router['post']('/',auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xd')]);router['put'](_0x5ca1('0xe'),auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xf')]);router[_0x5ca1('0x10')](_0x5ca1('0xe'),auth[_0x5ca1('0xb')](),controller[_0x5ca1('0x11')]);module[_0x5ca1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7e4cfd9..3d0af17 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 _0xf922=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf922,0x174));var _0x2f92=function(_0x15c9bc,_0x8fe268){_0x15c9bc=_0x15c9bc-0x0;var _0x3e1ddb=_0xf922[_0x15c9bc];return _0x3e1ddb;};'use strict';var Sequelize=require(_0x2f92('0x0'));module[_0x2f92('0x1')]={'priority':{'type':Sequelize[_0x2f92('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2f92('0x3')],'allowNull':![],'defaultValue':_0x2f92('0x4')},'appdata':{'type':Sequelize[_0x2f92('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2f92('0x6')}}; \ No newline at end of file +var _0xfa53=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x415a26,_0x4f7726){var _0x4d2e97=function(_0x16a88b){while(--_0x16a88b){_0x415a26['push'](_0x415a26['shift']());}};_0x4d2e97(++_0x4f7726);}(_0xfa53,0xb6));var _0x3fa5=function(_0x22c5fa,_0x1f0c3f){_0x22c5fa=_0x22c5fa-0x0;var _0x3f79b5=_0xfa53[_0x22c5fa];return _0x3f79b5;};'use strict';var Sequelize=require(_0x3fa5('0x0'));module[_0x3fa5('0x1')]={'priority':{'type':Sequelize[_0x3fa5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3fa5('0x3')],'allowNull':![],'defaultValue':_0x3fa5('0x4')},'appdata':{'type':Sequelize[_0x3fa5('0x5')]()},'description':{'type':Sequelize[_0x3fa5('0x3')]},'interval':{'type':Sequelize[_0x3fa5('0x3')],'defaultValue':_0x3fa5('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2b439d5..e3eba8f 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 _0x10ff=['params','model','keys','rawAttributes','filters','intersection','attributes','fields','query','length','includeAll','include','options','catch','body','ChatApplication','find','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x1a2bf5,_0x304694){var _0x1ed552=function(_0x2830ce){while(--_0x2830ce){_0x1a2bf5['push'](_0x1a2bf5['shift']());}};_0x1ed552(++_0x304694);}(_0x10ff,0x7f));var _0xf10f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x10ff[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xf10f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf10f('0x1'));var jsonpatch=require(_0xf10f('0x2'));var rp=require('request-promise');var moment=require(_0xf10f('0x3'));var BPromise=require(_0xf10f('0x4'));var Mustache=require(_0xf10f('0x5'));var util=require(_0xf10f('0x6'));var path=require(_0xf10f('0x7'));var sox=require('sox');var csv=require(_0xf10f('0x8'));var ejs=require(_0xf10f('0x9'));var fs=require('fs');var _=require(_0xf10f('0xa'));var squel=require(_0xf10f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf10f('0xc'));var toCsv=require(_0xf10f('0x8'));var querystring=require(_0xf10f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf10f('0xe'));var as=require(_0xf10f('0xf'));var hardwareService=require(_0xf10f('0x10'));var logger=require(_0xf10f('0x11'))('api');var utils=require(_0xf10f('0x12'));var config=require(_0xf10f('0x13'));var db=require(_0xf10f('0x14'))['db'];function respondWithStatusCode(_0x16315e,_0x2e756e){_0x2e756e=_0x2e756e||0xcc;return function(_0x1910e6){if(_0x1910e6){return _0x16315e[_0xf10f('0x15')](_0x2e756e);}return _0x16315e[_0xf10f('0x16')](_0x2e756e)[_0xf10f('0x17')]();};}function respondWithResult(_0x446ca6,_0x4d4918){_0x4d4918=_0x4d4918||0xc8;return function(_0x2b72f2){if(_0x2b72f2){return _0x446ca6[_0xf10f('0x16')](_0x4d4918)[_0xf10f('0x18')](_0x2b72f2);}};}function respondWithFilteredResult(_0x2b5956,_0x6cd3c){return function(_0x35fd27){if(_0x35fd27){var _0x3fb50e=_0x35fd27['count'],_0x2a256e=_0x6cd3c[_0xf10f('0x19')],_0x30ae70=_0x6cd3c[_0xf10f('0x19')]+_0x6cd3c[_0xf10f('0x1a')],_0x44bead;if(_0x30ae70>=_0x3fb50e){_0x30ae70=_0x3fb50e;_0x44bead=0xc8;}else{_0x44bead=0xce;}_0x2b5956[_0xf10f('0x16')](_0x44bead);return _0x2b5956[_0xf10f('0x1b')](_0xf10f('0x1c'),_0x2a256e+'-'+_0x30ae70+'/'+_0x3fb50e)[_0xf10f('0x18')](_0x35fd27);}return null;};}function patchUpdates(_0x396387){return function(_0x299d68){try{jsonpatch[_0xf10f('0x1d')](_0x299d68,_0x396387,!![]);}catch(_0x3813e1){return BPromise['reject'](_0x3813e1);}return _0x299d68[_0xf10f('0x1e')]();};}function saveUpdates(_0x4e3e7f,_0x282f36){return function(_0x37bf65){if(_0x37bf65){return _0x37bf65[_0xf10f('0x1f')](_0x4e3e7f)['then'](function(_0x53078b){return _0x53078b;});}return null;};}function removeEntity(_0x57267e,_0x56293e){return function(_0x3d0f60){if(_0x3d0f60){return _0x3d0f60[_0xf10f('0x20')]()[_0xf10f('0x21')](function(){_0x57267e[_0xf10f('0x16')](0xcc)[_0xf10f('0x17')]();});}};}function handleEntityNotFound(_0xb06fae,_0x4e7672){return function(_0x53e33c){if(!_0x53e33c){_0xb06fae['sendStatus'](0x194);}return _0x53e33c;};}function handleError(_0x3a67df,_0x3a4661){_0x3a4661=_0x3a4661||0x1f4;return function(_0x2e37aa){logger[_0xf10f('0x22')](_0x2e37aa[_0xf10f('0x23')]);if(_0x2e37aa[_0xf10f('0x24')]){delete _0x2e37aa[_0xf10f('0x24')];}_0x3a67df[_0xf10f('0x16')](_0x3a4661)[_0xf10f('0x25')](_0x2e37aa);};}exports['show']=function(_0x88fcc9,_0x27a646){var _0x392cec={'raw':!![],'where':{'id':_0x88fcc9[_0xf10f('0x26')]['id']}},_0x401688={};_0x401688[_0xf10f('0x27')]=_[_0xf10f('0x28')](db['ChatApplication'][_0xf10f('0x29')]);_0x401688['query']=_['keys'](_0x88fcc9['query']);_0x401688[_0xf10f('0x2a')]=_[_0xf10f('0x2b')](_0x401688[_0xf10f('0x27')],_0x401688['query']);_0x392cec[_0xf10f('0x2c')]=_[_0xf10f('0x2b')](_0x401688[_0xf10f('0x27')],qs[_0xf10f('0x2d')](_0x88fcc9[_0xf10f('0x2e')][_0xf10f('0x2d')]));_0x392cec[_0xf10f('0x2c')]=_0x392cec[_0xf10f('0x2c')][_0xf10f('0x2f')]?_0x392cec[_0xf10f('0x2c')]:_0x401688[_0xf10f('0x27')];if(_0x88fcc9[_0xf10f('0x2e')][_0xf10f('0x30')]){_0x392cec[_0xf10f('0x31')]=[{'all':!![]}];}_0x392cec=_['merge']({},_0x392cec,_0x88fcc9[_0xf10f('0x32')]);return db['ChatApplication']['find'](_0x392cec)['then'](handleEntityNotFound(_0x27a646,null))[_0xf10f('0x21')](respondWithResult(_0x27a646,null))[_0xf10f('0x33')](handleError(_0x27a646,null));};exports[_0xf10f('0x1f')]=function(_0x59ffa7,_0x5db82b){if(_0x59ffa7[_0xf10f('0x34')]['id']){delete _0x59ffa7[_0xf10f('0x34')]['id'];}return db[_0xf10f('0x35')][_0xf10f('0x36')]({'where':{'id':_0x59ffa7[_0xf10f('0x26')]['id']}})[_0xf10f('0x21')](handleEntityNotFound(_0x5db82b,null))[_0xf10f('0x21')](saveUpdates(_0x59ffa7[_0xf10f('0x34')],null))[_0xf10f('0x21')](respondWithResult(_0x5db82b,null))['catch'](handleError(_0x5db82b,null));};exports[_0xf10f('0x20')]=function(_0x2ce23c,_0x19d242){return db[_0xf10f('0x35')][_0xf10f('0x36')]({'where':{'id':_0x2ce23c['params']['id']}})['then'](handleEntityNotFound(_0x19d242,null))['then'](removeEntity(_0x19d242,null))[_0xf10f('0x33')](handleError(_0x19d242,null));}; \ No newline at end of file +var _0x5d43=['json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','include','merge','find','then','catch','body','destroy','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end'];(function(_0x48a31a,_0x4e6ee2){var _0x2f64d0=function(_0x356e50){while(--_0x356e50){_0x48a31a['push'](_0x48a31a['shift']());}};_0x2f64d0(++_0x4e6ee2);}(_0x5d43,0xb7));var _0x35d4=function(_0x315f60,_0x1e94ca){_0x315f60=_0x315f60-0x0;var _0x578149=_0x5d43[_0x315f60];return _0x578149;};'use strict';var pdf=require(_0x35d4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x35d4('0x1'));var jsonpatch=require(_0x35d4('0x2'));var rp=require('request-promise');var moment=require(_0x35d4('0x3'));var BPromise=require(_0x35d4('0x4'));var Mustache=require(_0x35d4('0x5'));var util=require('util');var path=require(_0x35d4('0x6'));var sox=require(_0x35d4('0x7'));var csv=require(_0x35d4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x35d4('0x9'));var squel=require(_0x35d4('0xa'));var crypto=require(_0x35d4('0xb'));var jsforce=require(_0x35d4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x35d4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x35d4('0xd'));var authService=require(_0x35d4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x35d4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35d4('0x10'))('api');var utils=require(_0x35d4('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39a983,_0x4abda9){_0x4abda9=_0x4abda9||0xcc;return function(_0x2b8d5f){if(_0x2b8d5f){return _0x39a983[_0x35d4('0x12')](_0x4abda9);}return _0x39a983[_0x35d4('0x13')](_0x4abda9)[_0x35d4('0x14')]();};}function respondWithResult(_0x497a11,_0x550158){_0x550158=_0x550158||0xc8;return function(_0x27fdee){if(_0x27fdee){return _0x497a11[_0x35d4('0x13')](_0x550158)[_0x35d4('0x15')](_0x27fdee);}};}function respondWithFilteredResult(_0x16ecb4,_0x55e885){return function(_0x1c6622){if(_0x1c6622){var _0x268cb4=_0x1c6622[_0x35d4('0x16')],_0xd92e00=_0x55e885[_0x35d4('0x17')],_0x1b853b=_0x55e885['offset']+_0x55e885[_0x35d4('0x18')],_0x1af6b6;if(_0x1b853b>=_0x268cb4){_0x1b853b=_0x268cb4;_0x1af6b6=0xc8;}else{_0x1af6b6=0xce;}_0x16ecb4[_0x35d4('0x13')](_0x1af6b6);return _0x16ecb4[_0x35d4('0x19')](_0x35d4('0x1a'),_0xd92e00+'-'+_0x1b853b+'/'+_0x268cb4)[_0x35d4('0x15')](_0x1c6622);}return null;};}function patchUpdates(_0x48cdd2){return function(_0x5d9431){try{jsonpatch[_0x35d4('0x1b')](_0x5d9431,_0x48cdd2,!![]);}catch(_0x44e374){return BPromise[_0x35d4('0x1c')](_0x44e374);}return _0x5d9431[_0x35d4('0x1d')]();};}function saveUpdates(_0x16ff33,_0x59b374){return function(_0x31a9d2){if(_0x31a9d2){return _0x31a9d2['update'](_0x16ff33)['then'](function(_0x303620){return _0x303620;});}return null;};}function removeEntity(_0x201d56,_0x43e3e3){return function(_0x54fe77){if(_0x54fe77){return _0x54fe77['destroy']()['then'](function(){_0x201d56[_0x35d4('0x13')](0xcc)[_0x35d4('0x14')]();});}};}function handleEntityNotFound(_0x5f03e9,_0x3d9c50){return function(_0x2ea0b7){if(!_0x2ea0b7){_0x5f03e9[_0x35d4('0x12')](0x194);}return _0x2ea0b7;};}function handleError(_0x460512,_0x24510c){_0x24510c=_0x24510c||0x1f4;return function(_0x4e1f55){logger['error'](_0x4e1f55[_0x35d4('0x1e')]);if(_0x4e1f55[_0x35d4('0x1f')]){delete _0x4e1f55['name'];}_0x460512[_0x35d4('0x13')](_0x24510c)[_0x35d4('0x20')](_0x4e1f55);};}exports[_0x35d4('0x21')]=function(_0x201e28,_0x179834){var _0x3637f7={'raw':!![],'where':{'id':_0x201e28[_0x35d4('0x22')]['id']}},_0x10ce34={};_0x10ce34[_0x35d4('0x23')]=_[_0x35d4('0x24')](db[_0x35d4('0x25')][_0x35d4('0x26')]);_0x10ce34[_0x35d4('0x27')]=_[_0x35d4('0x24')](_0x201e28[_0x35d4('0x27')]);_0x10ce34['filters']=_[_0x35d4('0x28')](_0x10ce34[_0x35d4('0x23')],_0x10ce34[_0x35d4('0x27')]);_0x3637f7[_0x35d4('0x29')]=_[_0x35d4('0x28')](_0x10ce34[_0x35d4('0x23')],qs[_0x35d4('0x2a')](_0x201e28[_0x35d4('0x27')][_0x35d4('0x2a')]));_0x3637f7[_0x35d4('0x29')]=_0x3637f7[_0x35d4('0x29')][_0x35d4('0x2b')]?_0x3637f7[_0x35d4('0x29')]:_0x10ce34['model'];if(_0x201e28['query']['includeAll']){_0x3637f7[_0x35d4('0x2c')]=[{'all':!![]}];}_0x3637f7=_[_0x35d4('0x2d')]({},_0x3637f7,_0x201e28['options']);return db[_0x35d4('0x25')][_0x35d4('0x2e')](_0x3637f7)['then'](handleEntityNotFound(_0x179834,null))[_0x35d4('0x2f')](respondWithResult(_0x179834,null))[_0x35d4('0x30')](handleError(_0x179834,null));};exports['update']=function(_0x175966,_0xa0536){if(_0x175966['body']['id']){delete _0x175966[_0x35d4('0x31')]['id'];}return db[_0x35d4('0x25')][_0x35d4('0x2e')]({'where':{'id':_0x175966['params']['id']}})[_0x35d4('0x2f')](handleEntityNotFound(_0xa0536,null))[_0x35d4('0x2f')](saveUpdates(_0x175966[_0x35d4('0x31')],null))[_0x35d4('0x2f')](respondWithResult(_0xa0536,null))[_0x35d4('0x30')](handleError(_0xa0536,null));};exports[_0x35d4('0x32')]=function(_0x5d6969,_0x1443a9){return db[_0x35d4('0x25')][_0x35d4('0x2e')]({'where':{'id':_0x5d6969[_0x35d4('0x22')]['id']}})[_0x35d4('0x2f')](handleEntityNotFound(_0x1443a9,null))[_0x35d4('0x2f')](removeEntity(_0x1443a9,null))[_0x35d4('0x30')](handleError(_0x1443a9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4dd0890..aa79df2 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 _0x36e2=['exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4fc435,_0x45eddf){var _0x3c5db1=function(_0x1d18c1){while(--_0x1d18c1){_0x4fc435['push'](_0x4fc435['shift']());}};_0x3c5db1(++_0x45eddf);}(_0x36e2,0x64));var _0x236e=function(_0x12c093,_0x41cc4b){_0x12c093=_0x12c093-0x0;var _0x540a57=_0x36e2[_0x12c093];return _0x540a57;};'use strict';var _=require('lodash');var util=require(_0x236e('0x0'));var logger=require(_0x236e('0x1'))(_0x236e('0x2'));var moment=require(_0x236e('0x3'));var BPromise=require(_0x236e('0x4'));var rp=require(_0x236e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x236e('0x6'));var config=require(_0x236e('0x7'));var attributes=require('./chatApplication.attributes');module[_0x236e('0x8')]=function(_0x4a328f,_0x39cbe6){return _0x4a328f['define']('ChatApplication',attributes,{'tableName':_0x236e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x236e('0xa'),'collate':_0x236e('0xb')});}; \ No newline at end of file +var _0xdeb6=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x290eef,_0x4635a3){var _0x21c635=function(_0x43957a){while(--_0x43957a){_0x290eef['push'](_0x290eef['shift']());}};_0x21c635(++_0x4635a3);}(_0xdeb6,0x114));var _0x6deb=function(_0x549bf0,_0x545544){_0x549bf0=_0x549bf0-0x0;var _0x583eca=_0xdeb6[_0x549bf0];return _0x583eca;};'use strict';var _=require(_0x6deb('0x0'));var util=require(_0x6deb('0x1'));var logger=require(_0x6deb('0x2'))(_0x6deb('0x3'));var moment=require(_0x6deb('0x4'));var BPromise=require(_0x6deb('0x5'));var rp=require(_0x6deb('0x6'));var fs=require('fs');var path=require(_0x6deb('0x7'));var rimraf=require(_0x6deb('0x8'));var config=require(_0x6deb('0x9'));var attributes=require(_0x6deb('0xa'));module[_0x6deb('0xb')]=function(_0x1295e0,_0x27a56f){return _0x1295e0[_0x6deb('0xc')](_0x6deb('0xd'),attributes,{'tableName':_0x6deb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9160ffd..aa89cac 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 _0xddaa=['then','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0xddaa,0x1d8));var _0xadda=function(_0x1f9c8c,_0x45cdc6){_0x1f9c8c=_0x1f9c8c-0x0;var _0x24263c=_0xddaa[_0x1f9c8c];return _0x24263c;};'use strict';var _=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var moment=require(_0xadda('0x2'));var BPromise=require('bluebird');var rs=require(_0xadda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadda('0x4'))['db'];var utils=require(_0xadda('0x5'));var logger=require('../../config/logger')(_0xadda('0x6'));var config=require(_0xadda('0x7'));var jayson=require(_0xadda('0x8'));var client=jayson[_0xadda('0x9')][_0xadda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193daa,_0x36abda,_0x32707f){return new BPromise(function(_0x31f5f7,_0x2b8b66){return client['request'](_0x193daa,_0x32707f)[_0xadda('0xb')](function(_0x1f1818){logger['info']('ChatApplication,\x20%s,\x20%s',_0x36abda,'request\x20sent');logger[_0xadda('0xc')](_0xadda('0xd'),_0x36abda,_0xadda('0xe'),JSON[_0xadda('0xf')](_0x1f1818));if(_0x1f1818[_0xadda('0x10')]){if(_0x1f1818['error'][_0xadda('0x11')]===0x1f4){logger[_0xadda('0x10')](_0xadda('0x12'),_0x36abda,_0x1f1818['error'][_0xadda('0x13')]);return _0x2b8b66(_0x1f1818[_0xadda('0x10')]['message']);}logger[_0xadda('0x10')](_0xadda('0x12'),_0x36abda,_0x1f1818[_0xadda('0x10')][_0xadda('0x13')]);return _0x31f5f7(_0x1f1818['error'][_0xadda('0x13')]);}else{logger[_0xadda('0x14')](_0xadda('0x12'),_0x36abda,_0xadda('0xe'));_0x31f5f7(_0x1f1818[_0xadda('0x15')]['message']);}})[_0xadda('0x16')](function(_0x334ea7){logger[_0xadda('0x10')]('ChatApplication,\x20%s,\x20%s',_0x36abda,_0x334ea7);_0x2b8b66(_0x334ea7);});});} \ No newline at end of file +var _0xd95f=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x28aca0,_0x2f9e99){var _0x27fcf6=function(_0x234302){while(--_0x234302){_0x28aca0['push'](_0x28aca0['shift']());}};_0x27fcf6(++_0x2f9e99);}(_0xd95f,0xc1));var _0xfd95=function(_0x5cc40c,_0x2ca2d1){_0x5cc40c=_0x5cc40c-0x0;var _0x2406e2=_0xd95f[_0x5cc40c];return _0x2406e2;};'use strict';var _=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var moment=require(_0xfd95('0x2'));var BPromise=require(_0xfd95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd95('0x5'));var logger=require('../../config/logger')(_0xfd95('0x6'));var config=require('../../config/environment');var jayson=require(_0xfd95('0x7'));var client=jayson[_0xfd95('0x8')][_0xfd95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa67844,_0x194132,_0x2d3ab3){return new BPromise(function(_0x2eb317,_0x2b07eb){return client[_0xfd95('0xa')](_0xa67844,_0x2d3ab3)[_0xfd95('0xb')](function(_0x5e7dcd){logger[_0xfd95('0xc')](_0xfd95('0xd'),_0x194132,_0xfd95('0xe'));logger[_0xfd95('0xf')](_0xfd95('0x10'),_0x194132,'request\x20sent',JSON[_0xfd95('0x11')](_0x5e7dcd));if(_0x5e7dcd['error']){if(_0x5e7dcd[_0xfd95('0x12')][_0xfd95('0x13')]===0x1f4){logger[_0xfd95('0x12')](_0xfd95('0xd'),_0x194132,_0x5e7dcd[_0xfd95('0x12')][_0xfd95('0x14')]);return _0x2b07eb(_0x5e7dcd[_0xfd95('0x12')][_0xfd95('0x14')]);}logger[_0xfd95('0x12')](_0xfd95('0xd'),_0x194132,_0x5e7dcd['error'][_0xfd95('0x14')]);return _0x2eb317(_0x5e7dcd['error'][_0xfd95('0x14')]);}else{logger[_0xfd95('0xc')](_0xfd95('0xd'),_0x194132,_0xfd95('0xe'));_0x2eb317(_0x5e7dcd[_0xfd95('0x15')]['message']);}})[_0xfd95('0x16')](function(_0x4cb790){logger['error'](_0xfd95('0xd'),_0x194132,_0x4cb790);_0x2b07eb(_0x4cb790);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5663d8f..64ea686 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 _0xd8ae=['express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3194b2,_0x2120ef){var _0x31501d=function(_0x21c16f){while(--_0x21c16f){_0x3194b2['push'](_0x3194b2['shift']());}};_0x31501d(++_0x2120ef);}(_0xd8ae,0x183));var _0xed8a=function(_0x498889,_0x547993){_0x498889=_0x498889-0x0;var _0xd6cb2d=_0xd8ae[_0x498889];return _0xd6cb2d;};'use strict';var multer=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var path=require(_0xed8a('0x2'));var timeout=require(_0xed8a('0x3'));var express=require(_0xed8a('0x4'));var router=express[_0xed8a('0x5')]();var auth=require(_0xed8a('0x6'));var interaction=require(_0xed8a('0x7'));var config=require('../../config/environment');var controller=require(_0xed8a('0x8'));router[_0xed8a('0x9')](_0xed8a('0xa'),auth[_0xed8a('0xb')](),controller['show']);router[_0xed8a('0xc')](_0xed8a('0xa'),auth[_0xed8a('0xb')](),controller[_0xed8a('0xd')]);router[_0xed8a('0xe')](_0xed8a('0xa'),auth[_0xed8a('0xb')](),controller[_0xed8a('0xf')]);module[_0xed8a('0x10')]=router; \ No newline at end of file +var _0xb20e=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete'];(function(_0x2d6991,_0x515956){var _0x5c9e40=function(_0x1c6aaf){while(--_0x1c6aaf){_0x2d6991['push'](_0x2d6991['shift']());}};_0x5c9e40(++_0x515956);}(_0xb20e,0x71));var _0xeb20=function(_0x243d61,_0xaaf81d){_0x243d61=_0x243d61-0x0;var _0x46886f=_0xb20e[_0x243d61];return _0x46886f;};'use strict';var multer=require(_0xeb20('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeb20('0x1'));var express=require(_0xeb20('0x2'));var router=express[_0xeb20('0x3')]();var auth=require(_0xeb20('0x4'));var interaction=require(_0xeb20('0x5'));var config=require(_0xeb20('0x6'));var controller=require('./chatApplication.controller');router[_0xeb20('0x7')](_0xeb20('0x8'),auth[_0xeb20('0x9')](),controller['show']);router[_0xeb20('0xa')](_0xeb20('0x8'),auth[_0xeb20('0x9')](),controller[_0xeb20('0xb')]);router[_0xeb20('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeb20('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 2ebdb77..13fdeda 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 _0xf2e9=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3f2ff5,_0x3347d9){var _0xe68338=function(_0x3b655c){while(--_0x3b655c){_0x3f2ff5['push'](_0x3f2ff5['shift']());}};_0xe68338(++_0x3347d9);}(_0xf2e9,0xc7));var _0x9f2e=function(_0x5ba1b6,_0x555dc4){_0x5ba1b6=_0x5ba1b6-0x0;var _0x36d25b=_0xf2e9[_0x5ba1b6];return _0x36d25b;};'use strict';var Sequelize=require(_0x9f2e('0x0'));module[_0x9f2e('0x1')]={'name':{'type':Sequelize[_0x9f2e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9f2e('0x2')]},'write':{'type':Sequelize[_0x9f2e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2b28=['exports','STRING','BOOLEAN','sequelize'];(function(_0x53f191,_0x304e86){var _0xa3f794=function(_0x3c4107){while(--_0x3c4107){_0x53f191['push'](_0x53f191['shift']());}};_0xa3f794(++_0x304e86);}(_0x2b28,0xfb));var _0x82b2=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x2b28[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0x82b2('0x0'));module[_0x82b2('0x1')]={'name':{'type':Sequelize[_0x82b2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x82b2('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 812ab6f..164293c 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 _0x5881=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','test','Sequelize','request','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','describe','getUnread','addMembers','omit','ids','findOne','User','intersection','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5c6310,_0x57afac){var _0x3e6db4=function(_0x5a88e3){while(--_0x5a88e3){_0x5c6310['push'](_0x5c6310['shift']());}};_0x3e6db4(++_0x57afac);}(_0x5881,0x65));var _0x1588=function(_0x29d7d6,_0x598aea){_0x29d7d6=_0x29d7d6-0x0;var _0x2449f6=_0x5881[_0x29d7d6];return _0x2449f6;};'use strict';var pdf=require(_0x1588('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1588('0x1'));var zipdir=require(_0x1588('0x2'));var jsonpatch=require(_0x1588('0x3'));var rp=require(_0x1588('0x4'));var moment=require(_0x1588('0x5'));var BPromise=require(_0x1588('0x6'));var Mustache=require(_0x1588('0x7'));var util=require(_0x1588('0x8'));var path=require(_0x1588('0x9'));var sox=require(_0x1588('0xa'));var csv=require(_0x1588('0xb'));var ejs=require(_0x1588('0xc'));var fs=require('fs');var _=require(_0x1588('0xd'));var squel=require(_0x1588('0xe'));var crypto=require('crypto');var jsforce=require(_0x1588('0xf'));var deskjs=require(_0x1588('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1588('0x11'));var Papa=require(_0x1588('0x12'));var Redis=require(_0x1588('0x13'));var authService=require(_0x1588('0x14'));var qs=require(_0x1588('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1588('0x16'));var logger=require(_0x1588('0x17'))(_0x1588('0x18'));var utils=require(_0x1588('0x19'));var config=require('../../config/environment');var db=require(_0x1588('0x1a'))['db'];config[_0x1588('0x1b')]=_['defaults'](config[_0x1588('0x1b')],{'host':_0x1588('0x1c'),'port':0x18eb});var socket=require(_0x1588('0x1d'))(new Redis(config[_0x1588('0x1b')]));require(_0x1588('0x1e'))[_0x1588('0x1f')](socket);var jayson=require(_0x1588('0x20'));var client=jayson['client'][_0x1588('0x21')]({'port':0x232a});function checkPasswordPattern(_0x3697b3,_0x14ac9e,_0x56d17b){if(_0x56d17b){var _0x4ef767=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ef767[_0x1588('0x22')](_0x14ac9e)){return _0x3697b3;}else{throw new db[(_0x1588('0x23'))]['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 _0x3697b3;}}function respondWithRpcPromise(_0x503b8a,_0x1fec4c,_0x242d41,_0x5002f1){return new BPromise(function(_0x59765f,_0x313df3){var _0x5beeaa=_0x5002f1||client;return _0x5beeaa[_0x1588('0x24')](_0x503b8a,_0x242d41)['then'](function(_0x340ad8){logger[_0x1588('0x25')]('ChatGroup,\x20%s,\x20%s',_0x1fec4c,_0x1588('0x26'));logger['debug'](_0x1588('0x27'),_0x1fec4c,_0x1588('0x26'),JSON[_0x1588('0x28')](_0x340ad8));if(_0x340ad8[_0x1588('0x29')]){if(_0x340ad8[_0x1588('0x29')][_0x1588('0x2a')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1fec4c,_0x340ad8['error']['message']);return _0x313df3(_0x340ad8['error']['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1fec4c,_0x340ad8[_0x1588('0x29')][_0x1588('0x2b')]);return _0x59765f(_0x340ad8['error'][_0x1588('0x2b')]);}else{logger['info'](_0x1588('0x2c'),_0x1fec4c,'request\x20sent');_0x59765f(_0x340ad8[_0x1588('0x2d')][_0x1588('0x2b')]);}})[_0x1588('0x2e')](function(_0x27788f){logger[_0x1588('0x29')]('ChatGroup,\x20%s,\x20%s',_0x1fec4c,_0x27788f);_0x313df3(_0x27788f);});});}function respondWithStatusCode(_0x2db8b6,_0x2233ce){_0x2233ce=_0x2233ce||0xcc;return function(_0x1f0831){if(_0x1f0831){return _0x2db8b6[_0x1588('0x2f')](_0x2233ce);}return _0x2db8b6[_0x1588('0x30')](_0x2233ce)[_0x1588('0x31')]();};}function respondWithResult(_0x1bc1f3,_0x1ce8c6){_0x1ce8c6=_0x1ce8c6||0xc8;return function(_0x24bbc9){if(_0x24bbc9){return _0x1bc1f3['status'](_0x1ce8c6)['json'](_0x24bbc9);}};}function respondWithFilteredResult(_0x21f6e8,_0x18fca1){return function(_0x45b4f0){if(_0x45b4f0){var _0x55680b=_0x45b4f0['count'],_0x4cd0af=_0x18fca1[_0x1588('0x32')],_0x5e4cb8=_0x18fca1[_0x1588('0x32')]+_0x18fca1[_0x1588('0x33')],_0x1dd7b5;if(_0x5e4cb8>=_0x55680b){_0x5e4cb8=_0x55680b;_0x1dd7b5=0xc8;}else{_0x1dd7b5=0xce;}_0x21f6e8[_0x1588('0x30')](_0x1dd7b5);return _0x21f6e8[_0x1588('0x34')](_0x1588('0x35'),_0x4cd0af+'-'+_0x5e4cb8+'/'+_0x55680b)['json'](_0x45b4f0);}return null;};}function patchUpdates(_0x2f5d7f){return function(_0x377c7b){try{jsonpatch[_0x1588('0x36')](_0x377c7b,_0x2f5d7f,!![]);}catch(_0x577a97){return BPromise[_0x1588('0x37')](_0x577a97);}return _0x377c7b[_0x1588('0x38')]();};}function saveUpdates(_0x3de165,_0x517d87){return function(_0xac1974){if(_0xac1974){return _0xac1974['update'](_0x3de165)[_0x1588('0x39')](function(_0x339d12){return _0x339d12;});}return null;};}function removeEntity(_0x279583,_0x5703a3){return function(_0x5897c2){if(_0x5897c2){return _0x5897c2[_0x1588('0x3a')]()[_0x1588('0x39')](function(){_0x279583['status'](0xcc)[_0x1588('0x31')]();});}};}function handleEntityNotFound(_0x308872,_0x545927){return function(_0x41a687){if(!_0x41a687){_0x308872['sendStatus'](0x194);}return _0x41a687;};}function handleError(_0x441cde,_0x49cf56){_0x49cf56=_0x49cf56||0x1f4;return function(_0xfa7eb6){logger['error'](_0xfa7eb6[_0x1588('0x3b')]);if(_0xfa7eb6[_0x1588('0x3c')]){delete _0xfa7eb6[_0x1588('0x3c')];}_0x441cde[_0x1588('0x30')](_0x49cf56)[_0x1588('0x3d')](_0xfa7eb6);};}exports[_0x1588('0x3e')]=function(_0x62c48,_0x12c16b){var _0x398085={},_0x478381={},_0x1b4f38={'count':0x0,'rows':[]};var _0x375f12=_['map'](db[_0x1588('0x3f')][_0x1588('0x40')],function(_0x15a466){return{'name':_0x15a466[_0x1588('0x41')],'type':_0x15a466[_0x1588('0x42')]['key']};});_0x478381[_0x1588('0x43')]=_['map'](_0x375f12,_0x1588('0x3c'));_0x478381[_0x1588('0x44')]=_[_0x1588('0x45')](_0x62c48['query']);_0x478381[_0x1588('0x46')]=_['intersection'](_0x478381[_0x1588('0x43')],_0x478381[_0x1588('0x44')]);_0x398085[_0x1588('0x47')]=_['intersection'](_0x478381['model'],qs[_0x1588('0x48')](_0x62c48[_0x1588('0x44')][_0x1588('0x48')]));_0x398085['attributes']=_0x398085[_0x1588('0x47')][_0x1588('0x49')]?_0x398085['attributes']:_0x478381[_0x1588('0x43')];if(!_0x62c48['query']['hasOwnProperty'](_0x1588('0x4a'))){_0x398085[_0x1588('0x33')]=qs[_0x1588('0x33')](_0x62c48[_0x1588('0x44')]['limit']);_0x398085[_0x1588('0x32')]=qs[_0x1588('0x32')](_0x62c48[_0x1588('0x44')][_0x1588('0x32')]);}_0x398085[_0x1588('0x4b')]=qs[_0x1588('0x4c')](_0x62c48[_0x1588('0x44')][_0x1588('0x4c')]);_0x398085[_0x1588('0x4d')]=qs[_0x1588('0x46')](_[_0x1588('0x4e')](_0x62c48[_0x1588('0x44')],_0x478381[_0x1588('0x46')]),_0x375f12);if(_0x62c48[_0x1588('0x44')][_0x1588('0x4f')]){_0x398085[_0x1588('0x4d')]=_['merge'](_0x398085[_0x1588('0x4d')],{'$or':_[_0x1588('0x50')](_0x375f12,function(_0x4f310f){if(_0x4f310f[_0x1588('0x42')]!=='VIRTUAL'){var _0x1f0bb9={};_0x1f0bb9[_0x4f310f['name']]={'$like':'%'+_0x62c48['query'][_0x1588('0x4f')]+'%'};return _0x1f0bb9;}})});}_0x398085=_[_0x1588('0x51')]({},_0x398085,_0x62c48[_0x1588('0x52')]);var _0x41e296={'where':_0x398085[_0x1588('0x4d')]};return db['ChatGroup'][_0x1588('0x53')](_0x41e296)[_0x1588('0x39')](function(_0x277c63){_0x1b4f38[_0x1588('0x53')]=_0x277c63;if(_0x62c48[_0x1588('0x44')][_0x1588('0x54')]){_0x398085[_0x1588('0x55')]=[{'all':!![]}];}return db[_0x1588('0x3f')][_0x1588('0x56')](_0x398085);})[_0x1588('0x39')](function(_0x4c5203){_0x1b4f38[_0x1588('0x57')]=_0x4c5203;return _0x1b4f38;})[_0x1588('0x39')](respondWithFilteredResult(_0x12c16b,_0x398085))[_0x1588('0x2e')](handleError(_0x12c16b,null));};exports[_0x1588('0x58')]=function(_0x34df6,_0x54caf7){var _0xa5cf9b={'raw':!![],'where':{'id':_0x34df6[_0x1588('0x59')]['id']}},_0x133162={};_0x133162[_0x1588('0x43')]=_[_0x1588('0x45')](db['ChatGroup'][_0x1588('0x40')]);_0x133162[_0x1588('0x44')]=_[_0x1588('0x45')](_0x34df6[_0x1588('0x44')]);_0x133162[_0x1588('0x46')]=_['intersection'](_0x133162['model'],_0x133162[_0x1588('0x44')]);_0xa5cf9b[_0x1588('0x47')]=_['intersection'](_0x133162['model'],qs[_0x1588('0x48')](_0x34df6[_0x1588('0x44')][_0x1588('0x48')]));_0xa5cf9b[_0x1588('0x47')]=_0xa5cf9b[_0x1588('0x47')][_0x1588('0x49')]?_0xa5cf9b[_0x1588('0x47')]:_0x133162[_0x1588('0x43')];if(_0x34df6[_0x1588('0x44')][_0x1588('0x54')]){_0xa5cf9b[_0x1588('0x55')]=[{'all':!![]}];}_0xa5cf9b=_[_0x1588('0x51')]({},_0xa5cf9b,_0x34df6['options']);return db[_0x1588('0x3f')][_0x1588('0x5a')](_0xa5cf9b)['then'](handleEntityNotFound(_0x54caf7,null))[_0x1588('0x39')](respondWithResult(_0x54caf7,null))['catch'](handleError(_0x54caf7,null));};exports['create']=function(_0x32c3ff,_0x23cb92){return db[_0x1588('0x3f')][_0x1588('0x5b')](_0x32c3ff['body'],{})[_0x1588('0x39')](respondWithResult(_0x23cb92,0xc9))[_0x1588('0x2e')](handleError(_0x23cb92,null));};exports['update']=function(_0x1958a8,_0x3fc568){if(_0x1958a8[_0x1588('0x5c')]['id']){delete _0x1958a8[_0x1588('0x5c')]['id'];}return db['ChatGroup'][_0x1588('0x5a')]({'where':{'id':_0x1958a8[_0x1588('0x59')]['id']}})[_0x1588('0x39')](handleEntityNotFound(_0x3fc568,null))['then'](saveUpdates(_0x1958a8['body'],null))[_0x1588('0x39')](respondWithResult(_0x3fc568,null))['catch'](handleError(_0x3fc568,null));};exports['destroy']=function(_0x329b12,_0x37fd70){return db[_0x1588('0x3f')]['find']({'where':{'id':_0x329b12[_0x1588('0x59')]['id']}})[_0x1588('0x39')](handleEntityNotFound(_0x37fd70,null))[_0x1588('0x39')](removeEntity(_0x37fd70,null))['catch'](handleError(_0x37fd70,null));};exports[_0x1588('0x5d')]=function(_0x39d699,_0x1bba56){return db[_0x1588('0x3f')]['describe']()[_0x1588('0x39')](respondWithResult(_0x1bba56,null))['catch'](handleError(_0x1bba56,null));};exports[_0x1588('0x5e')]=function(_0x51fc0d,_0x304aa6,_0x254f13){return db['ChatInternalMessage'][_0x1588('0x53')]({'where':{'ChatGroupId':_0x51fc0d[_0x1588('0x59')]['id'],'ToId':_0x51fc0d['user']['id'],'read':![]}})[_0x1588('0x39')](function(_0x3627cf){return{'id':_['toInteger'](_0x51fc0d[_0x1588('0x59')]['id']),'count':_0x3627cf};})[_0x1588('0x39')](respondWithResult(_0x304aa6,null))[_0x1588('0x2e')](handleError(_0x304aa6,null));};exports[_0x1588('0x5f')]=function(_0x2b9117,_0x278229,_0x5cad88){return db[_0x1588('0x3f')][_0x1588('0x5a')]({'where':{'id':_0x2b9117[_0x1588('0x59')]['id']}})[_0x1588('0x39')](handleEntityNotFound(_0x278229,null))['then'](function(_0x53c953){if(_0x53c953){return _0x53c953['addMembers'](_0x2b9117[_0x1588('0x5c')]['ids'],_[_0x1588('0x60')](_0x2b9117[_0x1588('0x5c')],[_0x1588('0x61'),'id'])||{});}})[_0x1588('0x39')](respondWithResult(_0x278229,null))[_0x1588('0x2e')](handleError(_0x278229,null));};exports['getMembers']=function(_0x546187,_0x127170,_0x2554b5){var _0x4533df={};var _0x56bb2b={};var _0x531d00;var _0x2f4bad;return db[_0x1588('0x3f')][_0x1588('0x62')]({'where':{'id':_0x546187[_0x1588('0x59')]['id']}})[_0x1588('0x39')](handleEntityNotFound(_0x127170,null))['then'](function(_0x598227){if(_0x598227){_0x531d00=_0x598227;_0x56bb2b['model']=_['keys'](db[_0x1588('0x63')][_0x1588('0x40')]);_0x56bb2b[_0x1588('0x44')]=_[_0x1588('0x45')](_0x546187[_0x1588('0x44')]);_0x56bb2b[_0x1588('0x46')]=_[_0x1588('0x64')](_0x56bb2b[_0x1588('0x43')],_0x56bb2b[_0x1588('0x44')]);_0x4533df['attributes']=_['intersection'](_0x56bb2b[_0x1588('0x43')],qs['fields'](_0x546187[_0x1588('0x44')][_0x1588('0x48')]));_0x4533df['attributes']=_0x4533df[_0x1588('0x47')][_0x1588('0x49')]?_0x4533df['attributes']:_0x56bb2b['model'];_0x4533df[_0x1588('0x4b')]=qs[_0x1588('0x4c')](_0x546187[_0x1588('0x44')]['sort']);_0x4533df['where']=qs[_0x1588('0x46')](_[_0x1588('0x4e')](_0x546187[_0x1588('0x44')],_0x56bb2b[_0x1588('0x46')]));if(_0x546187['query'][_0x1588('0x4f')]){_0x4533df['where']=_[_0x1588('0x51')](_0x4533df[_0x1588('0x4d')],{'$or':_['map'](_0x4533df[_0x1588('0x47')],function(_0xe6a90d){var _0x26d6cd={};_0x26d6cd[_0xe6a90d]={'$like':'%'+_0x546187[_0x1588('0x44')]['filter']+'%'};return _0x26d6cd;})});}_0x4533df=_[_0x1588('0x51')]({},_0x4533df,_0x546187[_0x1588('0x52')]);return _0x531d00[_0x1588('0x65')](_0x4533df);}})[_0x1588('0x39')](function(_0x56ad0f){if(_0x56ad0f){_0x2f4bad=_0x56ad0f[_0x1588('0x49')];if(!_0x546187[_0x1588('0x44')]['hasOwnProperty'](_0x1588('0x4a'))){_0x4533df[_0x1588('0x33')]=qs[_0x1588('0x33')](_0x546187['query']['limit']);_0x4533df[_0x1588('0x32')]=qs['offset'](_0x546187['query']['offset']);}return _0x531d00['getMembers'](_0x4533df);}})[_0x1588('0x39')](function(_0x24a991){if(_0x24a991){return _0x24a991?{'count':_0x2f4bad,'rows':_0x24a991}:null;}})[_0x1588('0x39')](respondWithResult(_0x127170,null))[_0x1588('0x2e')](handleError(_0x127170,null));};exports[_0x1588('0x66')]=function(_0x502215,_0x13090b,_0x506d0e){return db[_0x1588('0x3f')][_0x1588('0x5a')]({'where':{'id':_0x502215['params']['id']}})['then'](handleEntityNotFound(_0x13090b,null))['then'](function(_0x1839f9){if(_0x1839f9){return _0x1839f9['removeMembers'](_0x502215[_0x1588('0x44')][_0x1588('0x61')]);}})['then'](respondWithStatusCode(_0x13090b,null))['catch'](handleError(_0x13090b,null));};exports[_0x1588('0x67')]=function(_0x2b9f35,_0x4ec242,_0x17cc9c){if(_0x2b9f35[_0x1588('0x5c')]['id']){delete _0x2b9f35['body']['id'];}return db[_0x1588('0x3f')][_0x1588('0x5a')]({'where':{'id':_0x2b9f35['params']['id']}})[_0x1588('0x39')](handleEntityNotFound(_0x4ec242,null))['then'](function(_0x5c175e){if(_0x5c175e){_0x2b9f35[_0x1588('0x5c')][_0x1588('0x68')]=_0x5c175e['id'];return db['ChatInternalMessage']['create'](_0x2b9f35[_0x1588('0x5c')]);}})[_0x1588('0x39')](respondWithResult(_0x4ec242,null))[_0x1588('0x2e')](handleError(_0x4ec242,null));};exports[_0x1588('0x69')]=function(_0x567257,_0x548809,_0x5b467d){var _0x3eeda3={};var _0x3d5281={};var _0x24a249;var _0x46cfcc;return db[_0x1588('0x3f')][_0x1588('0x62')]({'where':{'id':_0x567257[_0x1588('0x59')]['id']}})['then'](handleEntityNotFound(_0x548809,null))[_0x1588('0x39')](function(_0x14e957){if(_0x14e957){_0x24a249=_0x14e957;_0x3d5281[_0x1588('0x43')]=_[_0x1588('0x45')](db['ChatInternalMessage']['rawAttributes']);_0x3d5281['query']=_['keys'](_0x567257[_0x1588('0x44')]);_0x3d5281[_0x1588('0x46')]=_['intersection'](_0x3d5281['model'],_0x3d5281[_0x1588('0x44')]);_0x3eeda3['attributes']=_[_0x1588('0x64')](_0x3d5281[_0x1588('0x43')],qs[_0x1588('0x48')](_0x567257[_0x1588('0x44')][_0x1588('0x48')]));_0x3eeda3['attributes']=_0x3eeda3['attributes']['length']?_0x3eeda3[_0x1588('0x47')]:_0x3d5281[_0x1588('0x43')];_0x3eeda3[_0x1588('0x4b')]=qs[_0x1588('0x4c')](_0x567257['query']['sort']);_0x3eeda3[_0x1588('0x4d')]=qs['filters'](_['pick'](_0x567257[_0x1588('0x44')],_0x3d5281['filters']));if(_0x567257[_0x1588('0x44')][_0x1588('0x4f')]){_0x3eeda3['where']=_[_0x1588('0x51')](_0x3eeda3['where'],{'$or':_[_0x1588('0x50')](_0x3eeda3[_0x1588('0x47')],function(_0x466603){var _0x4a9cad={};_0x4a9cad[_0x466603]={'$like':'%'+_0x567257[_0x1588('0x44')][_0x1588('0x4f')]+'%'};return _0x4a9cad;})});}if(_0x567257[_0x1588('0x44')][_0x1588('0x6a')]){var _0x1b7bbd=_0x567257[_0x1588('0x44')][_0x1588('0x6a')][_0x1588('0x6b')](',');var _0x3f62c0={};_0x3f62c0[_0x1b7bbd[0x0]]={'$gte':moment(_0x1b7bbd[0x1])[_0x1588('0x6c')](_0x1588('0x6d'))};_0x3eeda3[_0x1588('0x4d')]=_[_0x1588('0x51')](_0x3eeda3[_0x1588('0x4d')],_0x3f62c0);}_0x3eeda3=_[_0x1588('0x51')]({},_0x3eeda3,_0x567257[_0x1588('0x52')]);return _0x24a249['getMessages'](_0x3eeda3);}})[_0x1588('0x39')](function(_0x199ecf){if(_0x199ecf){_0x46cfcc=_0x199ecf['length'];if(!_0x567257[_0x1588('0x44')][_0x1588('0x6e')]('nolimit')){_0x3eeda3[_0x1588('0x33')]=qs[_0x1588('0x33')](_0x567257[_0x1588('0x44')][_0x1588('0x33')]);_0x3eeda3[_0x1588('0x32')]=qs['offset'](_0x567257[_0x1588('0x44')][_0x1588('0x32')]);}return _0x24a249[_0x1588('0x69')](_0x3eeda3);}})['then'](function(_0x28e988){if(_0x28e988){return _0x28e988?{'count':_0x46cfcc,'rows':_0x28e988}:null;}})[_0x1588('0x39')](respondWithResult(_0x548809,null))[_0x1588('0x2e')](handleError(_0x548809,null));}; \ No newline at end of file +var _0x5908=['sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','destroy','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','pick','filter','nolimit','removeMembers','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','register','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x38e956,_0x1f22b2){var _0x3e1942=function(_0x2c74f8){while(--_0x2c74f8){_0x38e956['push'](_0x38e956['shift']());}};_0x3e1942(++_0x1f22b2);}(_0x5908,0x8c));var _0x8590=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5908[_0x5f09c5];return _0x426ad9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8590('0x0'));var rimraf=require(_0x8590('0x1'));var zipdir=require(_0x8590('0x2'));var jsonpatch=require(_0x8590('0x3'));var rp=require('request-promise');var moment=require(_0x8590('0x4'));var BPromise=require(_0x8590('0x5'));var Mustache=require('mustache');var util=require(_0x8590('0x6'));var path=require(_0x8590('0x7'));var sox=require('sox');var csv=require(_0x8590('0x8'));var ejs=require(_0x8590('0x9'));var fs=require('fs');var _=require(_0x8590('0xa'));var squel=require(_0x8590('0xb'));var crypto=require(_0x8590('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8590('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8590('0xe'));var Papa=require(_0x8590('0xf'));var Redis=require(_0x8590('0x10'));var authService=require(_0x8590('0x11'));var qs=require(_0x8590('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8590('0x13'));var logger=require(_0x8590('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8590('0x15'));var db=require(_0x8590('0x16'))['db'];config[_0x8590('0x17')]=_[_0x8590('0x18')](config[_0x8590('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8590('0x17')]));require('./chatGroup.socket')[_0x8590('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8590('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3df261,_0x51700e,_0x192588){if(_0x192588){var _0x12312a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12312a[_0x8590('0x1b')](_0x51700e)){return _0x3df261;}else{throw new db['Sequelize'][(_0x8590('0x1c'))](_0x8590('0x1d'));}}else{return _0x3df261;}}function respondWithRpcPromise(_0x3f34ff,_0x15ffde,_0x269784,_0x28700a){return new BPromise(function(_0x2ae463,_0x4a61fb){var _0x1fa445=_0x28700a||client;return _0x1fa445[_0x8590('0x1e')](_0x3f34ff,_0x269784)[_0x8590('0x1f')](function(_0x30d9d2){logger[_0x8590('0x20')](_0x8590('0x21'),_0x15ffde,_0x8590('0x22'));logger[_0x8590('0x23')](_0x8590('0x24'),_0x15ffde,'request\x20sent',JSON[_0x8590('0x25')](_0x30d9d2));if(_0x30d9d2[_0x8590('0x26')]){if(_0x30d9d2[_0x8590('0x26')][_0x8590('0x27')]===0x1f4){logger['error'](_0x8590('0x21'),_0x15ffde,_0x30d9d2['error']['message']);return _0x4a61fb(_0x30d9d2[_0x8590('0x26')]['message']);}logger['error'](_0x8590('0x21'),_0x15ffde,_0x30d9d2[_0x8590('0x26')][_0x8590('0x28')]);return _0x2ae463(_0x30d9d2[_0x8590('0x26')][_0x8590('0x28')]);}else{logger[_0x8590('0x20')]('ChatGroup,\x20%s,\x20%s',_0x15ffde,_0x8590('0x22'));_0x2ae463(_0x30d9d2['result'][_0x8590('0x28')]);}})['catch'](function(_0x5582a8){logger['error'](_0x8590('0x21'),_0x15ffde,_0x5582a8);_0x4a61fb(_0x5582a8);});});}function respondWithStatusCode(_0x6170d3,_0x3a2485){_0x3a2485=_0x3a2485||0xcc;return function(_0x27fd7b){if(_0x27fd7b){return _0x6170d3[_0x8590('0x29')](_0x3a2485);}return _0x6170d3[_0x8590('0x2a')](_0x3a2485)[_0x8590('0x2b')]();};}function respondWithResult(_0x27a112,_0x3b31e2){_0x3b31e2=_0x3b31e2||0xc8;return function(_0x18af76){if(_0x18af76){return _0x27a112[_0x8590('0x2a')](_0x3b31e2)[_0x8590('0x2c')](_0x18af76);}};}function respondWithFilteredResult(_0x3b3f39,_0x18e468){return function(_0x2e0463){if(_0x2e0463){var _0x44b6ca=_0x2e0463[_0x8590('0x2d')],_0x2ba96e=_0x18e468[_0x8590('0x2e')],_0x5db78c=_0x18e468['offset']+_0x18e468['limit'],_0x978da;if(_0x5db78c>=_0x44b6ca){_0x5db78c=_0x44b6ca;_0x978da=0xc8;}else{_0x978da=0xce;}_0x3b3f39[_0x8590('0x2a')](_0x978da);return _0x3b3f39['set'](_0x8590('0x2f'),_0x2ba96e+'-'+_0x5db78c+'/'+_0x44b6ca)[_0x8590('0x2c')](_0x2e0463);}return null;};}function patchUpdates(_0x1c0479){return function(_0x4e32d6){try{jsonpatch[_0x8590('0x30')](_0x4e32d6,_0x1c0479,!![]);}catch(_0x3fd396){return BPromise[_0x8590('0x31')](_0x3fd396);}return _0x4e32d6['save']();};}function saveUpdates(_0x1b7723,_0x56d67a){return function(_0x2f26dc){if(_0x2f26dc){return _0x2f26dc['update'](_0x1b7723)[_0x8590('0x1f')](function(_0x3693d2){return _0x3693d2;});}return null;};}function removeEntity(_0x226c13,_0x11de7b){return function(_0x5c005e){if(_0x5c005e){return _0x5c005e['destroy']()[_0x8590('0x1f')](function(){_0x226c13[_0x8590('0x2a')](0xcc)[_0x8590('0x2b')]();});}};}function handleEntityNotFound(_0x14a120,_0x21add4){return function(_0x2b1419){if(!_0x2b1419){_0x14a120[_0x8590('0x29')](0x194);}return _0x2b1419;};}function handleError(_0x54b677,_0x2de3e3){_0x2de3e3=_0x2de3e3||0x1f4;return function(_0x42482a){logger[_0x8590('0x26')](_0x42482a[_0x8590('0x32')]);if(_0x42482a[_0x8590('0x33')]){delete _0x42482a[_0x8590('0x33')];}_0x54b677['status'](_0x2de3e3)[_0x8590('0x34')](_0x42482a);};}exports['index']=function(_0x4945c2,_0x4175ca){var _0x410cef={},_0x57e47a={},_0x4602f9={'count':0x0,'rows':[]};var _0x28474e=_[_0x8590('0x35')](db[_0x8590('0x36')][_0x8590('0x37')],function(_0x5bdd86){return{'name':_0x5bdd86[_0x8590('0x38')],'type':_0x5bdd86[_0x8590('0x39')][_0x8590('0x3a')]};});_0x57e47a['model']=_[_0x8590('0x35')](_0x28474e,'name');_0x57e47a[_0x8590('0x3b')]=_[_0x8590('0x3c')](_0x4945c2[_0x8590('0x3b')]);_0x57e47a[_0x8590('0x3d')]=_[_0x8590('0x3e')](_0x57e47a[_0x8590('0x3f')],_0x57e47a['query']);_0x410cef[_0x8590('0x40')]=_[_0x8590('0x3e')](_0x57e47a[_0x8590('0x3f')],qs[_0x8590('0x41')](_0x4945c2[_0x8590('0x3b')][_0x8590('0x41')]));_0x410cef[_0x8590('0x40')]=_0x410cef['attributes'][_0x8590('0x42')]?_0x410cef[_0x8590('0x40')]:_0x57e47a[_0x8590('0x3f')];if(!_0x4945c2[_0x8590('0x3b')][_0x8590('0x43')]('nolimit')){_0x410cef[_0x8590('0x44')]=qs['limit'](_0x4945c2[_0x8590('0x3b')][_0x8590('0x44')]);_0x410cef['offset']=qs[_0x8590('0x2e')](_0x4945c2[_0x8590('0x3b')]['offset']);}_0x410cef[_0x8590('0x45')]=qs[_0x8590('0x46')](_0x4945c2[_0x8590('0x3b')][_0x8590('0x46')]);_0x410cef[_0x8590('0x47')]=qs[_0x8590('0x3d')](_['pick'](_0x4945c2[_0x8590('0x3b')],_0x57e47a[_0x8590('0x3d')]),_0x28474e);if(_0x4945c2[_0x8590('0x3b')]['filter']){_0x410cef[_0x8590('0x47')]=_[_0x8590('0x48')](_0x410cef['where'],{'$or':_[_0x8590('0x35')](_0x28474e,function(_0x2806af){if(_0x2806af['type']!==_0x8590('0x49')){var _0x4e327c={};_0x4e327c[_0x2806af[_0x8590('0x33')]]={'$like':'%'+_0x4945c2[_0x8590('0x3b')]['filter']+'%'};return _0x4e327c;}})});}_0x410cef=_[_0x8590('0x48')]({},_0x410cef,_0x4945c2[_0x8590('0x4a')]);var _0x20bfad={'where':_0x410cef[_0x8590('0x47')]};return db[_0x8590('0x36')][_0x8590('0x2d')](_0x20bfad)[_0x8590('0x1f')](function(_0x43ee50){_0x4602f9[_0x8590('0x2d')]=_0x43ee50;if(_0x4945c2[_0x8590('0x3b')][_0x8590('0x4b')]){_0x410cef[_0x8590('0x4c')]=[{'all':!![]}];}return db['ChatGroup'][_0x8590('0x4d')](_0x410cef);})[_0x8590('0x1f')](function(_0x483338){_0x4602f9[_0x8590('0x4e')]=_0x483338;return _0x4602f9;})['then'](respondWithFilteredResult(_0x4175ca,_0x410cef))[_0x8590('0x4f')](handleError(_0x4175ca,null));};exports[_0x8590('0x50')]=function(_0x2d4a16,_0xd95b0e){var _0x394e7d={'raw':!![],'where':{'id':_0x2d4a16['params']['id']}},_0x3e7378={};_0x3e7378['model']=_[_0x8590('0x3c')](db['ChatGroup'][_0x8590('0x37')]);_0x3e7378['query']=_['keys'](_0x2d4a16[_0x8590('0x3b')]);_0x3e7378['filters']=_[_0x8590('0x3e')](_0x3e7378['model'],_0x3e7378[_0x8590('0x3b')]);_0x394e7d[_0x8590('0x40')]=_[_0x8590('0x3e')](_0x3e7378[_0x8590('0x3f')],qs['fields'](_0x2d4a16['query'][_0x8590('0x41')]));_0x394e7d[_0x8590('0x40')]=_0x394e7d[_0x8590('0x40')][_0x8590('0x42')]?_0x394e7d['attributes']:_0x3e7378[_0x8590('0x3f')];if(_0x2d4a16[_0x8590('0x3b')][_0x8590('0x4b')]){_0x394e7d[_0x8590('0x4c')]=[{'all':!![]}];}_0x394e7d=_[_0x8590('0x48')]({},_0x394e7d,_0x2d4a16[_0x8590('0x4a')]);return db['ChatGroup']['find'](_0x394e7d)[_0x8590('0x1f')](handleEntityNotFound(_0xd95b0e,null))['then'](respondWithResult(_0xd95b0e,null))[_0x8590('0x4f')](handleError(_0xd95b0e,null));};exports[_0x8590('0x51')]=function(_0xc1d115,_0x591de7){return db[_0x8590('0x36')]['create'](_0xc1d115[_0x8590('0x52')],{})[_0x8590('0x1f')](respondWithResult(_0x591de7,0xc9))['catch'](handleError(_0x591de7,null));};exports[_0x8590('0x53')]=function(_0x51ff5b,_0x16ab4c){if(_0x51ff5b[_0x8590('0x52')]['id']){delete _0x51ff5b[_0x8590('0x52')]['id'];}return db[_0x8590('0x36')][_0x8590('0x54')]({'where':{'id':_0x51ff5b[_0x8590('0x55')]['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x16ab4c,null))[_0x8590('0x1f')](saveUpdates(_0x51ff5b[_0x8590('0x52')],null))[_0x8590('0x1f')](respondWithResult(_0x16ab4c,null))[_0x8590('0x4f')](handleError(_0x16ab4c,null));};exports[_0x8590('0x56')]=function(_0x33e527,_0x266181){return db[_0x8590('0x36')][_0x8590('0x54')]({'where':{'id':_0x33e527['params']['id']}})['then'](handleEntityNotFound(_0x266181,null))[_0x8590('0x1f')](removeEntity(_0x266181,null))[_0x8590('0x4f')](handleError(_0x266181,null));};exports[_0x8590('0x57')]=function(_0x3ff32f,_0x43e283){return db[_0x8590('0x36')][_0x8590('0x57')]()[_0x8590('0x1f')](respondWithResult(_0x43e283,null))['catch'](handleError(_0x43e283,null));};exports[_0x8590('0x58')]=function(_0x50ffdc,_0x4ec0d1,_0x42691a){return db[_0x8590('0x59')][_0x8590('0x2d')]({'where':{'ChatGroupId':_0x50ffdc['params']['id'],'ToId':_0x50ffdc[_0x8590('0x5a')]['id'],'read':![]}})[_0x8590('0x1f')](function(_0xd6b07e){return{'id':_['toInteger'](_0x50ffdc[_0x8590('0x55')]['id']),'count':_0xd6b07e};})[_0x8590('0x1f')](respondWithResult(_0x4ec0d1,null))[_0x8590('0x4f')](handleError(_0x4ec0d1,null));};exports['addMembers']=function(_0x3d2124,_0x3d74d9,_0x142f4b){return db['ChatGroup'][_0x8590('0x54')]({'where':{'id':_0x3d2124[_0x8590('0x55')]['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x3d74d9,null))['then'](function(_0x4a8549){if(_0x4a8549){return _0x4a8549[_0x8590('0x5b')](_0x3d2124[_0x8590('0x52')]['ids'],_[_0x8590('0x5c')](_0x3d2124['body'],[_0x8590('0x5d'),'id'])||{});}})[_0x8590('0x1f')](respondWithResult(_0x3d74d9,null))['catch'](handleError(_0x3d74d9,null));};exports[_0x8590('0x5e')]=function(_0xdcbd03,_0x4b0bd8,_0x36135d){var _0x1a3eb9={};var _0x1dfc3a={};var _0x215bc9;var _0x1ad63f;return db[_0x8590('0x36')][_0x8590('0x5f')]({'where':{'id':_0xdcbd03['params']['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x4b0bd8,null))[_0x8590('0x1f')](function(_0x234aaf){if(_0x234aaf){_0x215bc9=_0x234aaf;_0x1dfc3a[_0x8590('0x3f')]=_[_0x8590('0x3c')](db['User'][_0x8590('0x37')]);_0x1dfc3a[_0x8590('0x3b')]=_[_0x8590('0x3c')](_0xdcbd03[_0x8590('0x3b')]);_0x1dfc3a['filters']=_['intersection'](_0x1dfc3a['model'],_0x1dfc3a['query']);_0x1a3eb9[_0x8590('0x40')]=_[_0x8590('0x3e')](_0x1dfc3a['model'],qs['fields'](_0xdcbd03['query'][_0x8590('0x41')]));_0x1a3eb9['attributes']=_0x1a3eb9[_0x8590('0x40')][_0x8590('0x42')]?_0x1a3eb9[_0x8590('0x40')]:_0x1dfc3a[_0x8590('0x3f')];_0x1a3eb9['order']=qs[_0x8590('0x46')](_0xdcbd03[_0x8590('0x3b')]['sort']);_0x1a3eb9[_0x8590('0x47')]=qs[_0x8590('0x3d')](_[_0x8590('0x60')](_0xdcbd03[_0x8590('0x3b')],_0x1dfc3a[_0x8590('0x3d')]));if(_0xdcbd03[_0x8590('0x3b')][_0x8590('0x61')]){_0x1a3eb9[_0x8590('0x47')]=_[_0x8590('0x48')](_0x1a3eb9[_0x8590('0x47')],{'$or':_[_0x8590('0x35')](_0x1a3eb9['attributes'],function(_0x419587){var _0x3e18c3={};_0x3e18c3[_0x419587]={'$like':'%'+_0xdcbd03[_0x8590('0x3b')]['filter']+'%'};return _0x3e18c3;})});}_0x1a3eb9=_[_0x8590('0x48')]({},_0x1a3eb9,_0xdcbd03['options']);return _0x215bc9['getMembers'](_0x1a3eb9);}})[_0x8590('0x1f')](function(_0x20d5e3){if(_0x20d5e3){_0x1ad63f=_0x20d5e3['length'];if(!_0xdcbd03[_0x8590('0x3b')][_0x8590('0x43')](_0x8590('0x62'))){_0x1a3eb9[_0x8590('0x44')]=qs['limit'](_0xdcbd03[_0x8590('0x3b')]['limit']);_0x1a3eb9[_0x8590('0x2e')]=qs[_0x8590('0x2e')](_0xdcbd03[_0x8590('0x3b')][_0x8590('0x2e')]);}return _0x215bc9['getMembers'](_0x1a3eb9);}})[_0x8590('0x1f')](function(_0x5bfcec){if(_0x5bfcec){return _0x5bfcec?{'count':_0x1ad63f,'rows':_0x5bfcec}:null;}})[_0x8590('0x1f')](respondWithResult(_0x4b0bd8,null))['catch'](handleError(_0x4b0bd8,null));};exports[_0x8590('0x63')]=function(_0x529ccf,_0x4bddf2,_0x5495d7){return db[_0x8590('0x36')]['find']({'where':{'id':_0x529ccf['params']['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x4bddf2,null))[_0x8590('0x1f')](function(_0x35a645){if(_0x35a645){return _0x35a645[_0x8590('0x63')](_0x529ccf[_0x8590('0x3b')]['ids']);}})[_0x8590('0x1f')](respondWithStatusCode(_0x4bddf2,null))[_0x8590('0x4f')](handleError(_0x4bddf2,null));};exports['addMessage']=function(_0x59dd82,_0x30faec,_0xbdd5ce){if(_0x59dd82[_0x8590('0x52')]['id']){delete _0x59dd82[_0x8590('0x52')]['id'];}return db[_0x8590('0x36')][_0x8590('0x54')]({'where':{'id':_0x59dd82[_0x8590('0x55')]['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x30faec,null))[_0x8590('0x1f')](function(_0x455b44){if(_0x455b44){_0x59dd82[_0x8590('0x52')][_0x8590('0x64')]=_0x455b44['id'];return db[_0x8590('0x59')][_0x8590('0x51')](_0x59dd82[_0x8590('0x52')]);}})[_0x8590('0x1f')](respondWithResult(_0x30faec,null))['catch'](handleError(_0x30faec,null));};exports[_0x8590('0x65')]=function(_0xa56ab0,_0x5418e9,_0x14a451){var _0x4ad145={};var _0xe3f7ad={};var _0x4d061c;var _0x4386fe;return db['ChatGroup'][_0x8590('0x5f')]({'where':{'id':_0xa56ab0[_0x8590('0x55')]['id']}})[_0x8590('0x1f')](handleEntityNotFound(_0x5418e9,null))[_0x8590('0x1f')](function(_0x5f1f6){if(_0x5f1f6){_0x4d061c=_0x5f1f6;_0xe3f7ad[_0x8590('0x3f')]=_['keys'](db[_0x8590('0x59')][_0x8590('0x37')]);_0xe3f7ad[_0x8590('0x3b')]=_[_0x8590('0x3c')](_0xa56ab0[_0x8590('0x3b')]);_0xe3f7ad[_0x8590('0x3d')]=_['intersection'](_0xe3f7ad[_0x8590('0x3f')],_0xe3f7ad['query']);_0x4ad145[_0x8590('0x40')]=_[_0x8590('0x3e')](_0xe3f7ad[_0x8590('0x3f')],qs[_0x8590('0x41')](_0xa56ab0[_0x8590('0x3b')][_0x8590('0x41')]));_0x4ad145[_0x8590('0x40')]=_0x4ad145['attributes'][_0x8590('0x42')]?_0x4ad145[_0x8590('0x40')]:_0xe3f7ad['model'];_0x4ad145['order']=qs[_0x8590('0x46')](_0xa56ab0[_0x8590('0x3b')][_0x8590('0x46')]);_0x4ad145['where']=qs[_0x8590('0x3d')](_[_0x8590('0x60')](_0xa56ab0[_0x8590('0x3b')],_0xe3f7ad[_0x8590('0x3d')]));if(_0xa56ab0[_0x8590('0x3b')][_0x8590('0x61')]){_0x4ad145[_0x8590('0x47')]=_[_0x8590('0x48')](_0x4ad145['where'],{'$or':_[_0x8590('0x35')](_0x4ad145[_0x8590('0x40')],function(_0x44088c){var _0x2ebc31={};_0x2ebc31[_0x44088c]={'$like':'%'+_0xa56ab0[_0x8590('0x3b')][_0x8590('0x61')]+'%'};return _0x2ebc31;})});}if(_0xa56ab0[_0x8590('0x3b')][_0x8590('0x66')]){var _0x4a9bdc=_0xa56ab0[_0x8590('0x3b')]['$gte'][_0x8590('0x67')](',');var _0x5d8d48={};_0x5d8d48[_0x4a9bdc[0x0]]={'$gte':moment(_0x4a9bdc[0x1])[_0x8590('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4ad145['where']=_['merge'](_0x4ad145[_0x8590('0x47')],_0x5d8d48);}_0x4ad145=_[_0x8590('0x48')]({},_0x4ad145,_0xa56ab0['options']);return _0x4d061c['getMessages'](_0x4ad145);}})[_0x8590('0x1f')](function(_0x190717){if(_0x190717){_0x4386fe=_0x190717[_0x8590('0x42')];if(!_0xa56ab0['query']['hasOwnProperty'](_0x8590('0x62'))){_0x4ad145[_0x8590('0x44')]=qs[_0x8590('0x44')](_0xa56ab0['query'][_0x8590('0x44')]);_0x4ad145[_0x8590('0x2e')]=qs[_0x8590('0x2e')](_0xa56ab0[_0x8590('0x3b')]['offset']);}return _0x4d061c[_0x8590('0x65')](_0x4ad145);}})[_0x8590('0x1f')](function(_0x39662f){if(_0x39662f){return _0x39662f?{'count':_0x4386fe,'rows':_0x39662f}:null;}})[_0x8590('0x1f')](respondWithResult(_0x5418e9,null))[_0x8590('0x4f')](handleError(_0x5418e9,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4d3a64e..f3d17ff 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2032,0xd9));var _0x2203=function(_0x1f3d7b,_0x517521){_0x1f3d7b=_0x1f3d7b-0x0;var _0x444dad=_0x2032[_0x1f3d7b];return _0x444dad;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x214b79,_0x2b7146){var _0x38bfdc=function(_0x3b1698){while(--_0x3b1698){_0x214b79['push'](_0x214b79['shift']());}};_0x38bfdc(++_0x2b7146);}(_0x2ef3,0xba));var _0x32ef=function(_0x36acfb,_0x2944e9){_0x36acfb=_0x36acfb-0x0;var _0x5ca5f1=_0x2ef3[_0x36acfb];return _0x5ca5f1;};'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 a066141..ffc695f 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 _0xe714=['path','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','../../config/logger','api','moment','bluebird'];(function(_0x260865,_0x2905e4){var _0x577126=function(_0x45d5c9){while(--_0x45d5c9){_0x260865['push'](_0x260865['shift']());}};_0x577126(++_0x2905e4);}(_0xe714,0xe2));var _0x4e71=function(_0x496af8,_0x1b6c1b){_0x496af8=_0x496af8-0x0;var _0x105fae=_0xe714[_0x496af8];return _0x105fae;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require(_0x4e71('0x3'));var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e71('0x5'));var rimraf=require('rimraf');var config=require(_0x4e71('0x6'));var attributes=require(_0x4e71('0x7'));module[_0x4e71('0x8')]=function(_0x204a19,_0xfe1559){return _0x204a19[_0x4e71('0x9')]('ChatGroup',attributes,{'tableName':_0x4e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatGroup.attributes','exports','chat_groups'];(function(_0x467d80,_0x58ed5a){var _0x23fc9e=function(_0x878f69){while(--_0x878f69){_0x467d80['push'](_0x467d80['shift']());}};_0x23fc9e(++_0x58ed5a);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x4e9182,_0x3b49b1){_0x4e9182=_0x4e9182-0x0;var _0x17aef7=_0x5f6f[_0x4e9182];return _0x17aef7;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var logger=require(_0xf5f6('0x2'))(_0xf5f6('0x3'));var moment=require(_0xf5f6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5f6('0x5'));var fs=require('fs');var path=require(_0xf5f6('0x6'));var rimraf=require(_0xf5f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5f6('0x8'));module[_0xf5f6('0x9')]=function(_0x390b1a,_0xfda1c7){return _0x390b1a['define']('ChatGroup',attributes,{'tableName':_0xf5f6('0xa'),'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 0f23d9a..1228ae7 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 _0x27bd=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x27bd,0x12d));var _0xd27b=function(_0x135b4e,_0x55f469){_0x135b4e=_0x135b4e-0x0;var _0x2c9793=_0x27bd[_0x135b4e];return _0x2c9793;};'use strict';var _=require(_0xd27b('0x0'));var util=require(_0xd27b('0x1'));var moment=require(_0xd27b('0x2'));var BPromise=require(_0xd27b('0x3'));var rs=require(_0xd27b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd27b('0x5'));var logger=require(_0xd27b('0x6'))(_0xd27b('0x7'));var config=require(_0xd27b('0x8'));var jayson=require(_0xd27b('0x9'));var client=jayson['client'][_0xd27b('0xa')]({'port':0x232a});config[_0xd27b('0xb')]=_[_0xd27b('0xc')](config['redis'],{'host':_0xd27b('0xd'),'port':0x18eb});var socket=require(_0xd27b('0xe'))(new Redis(config['redis']));require(_0xd27b('0xf'))[_0xd27b('0x10')](socket);function respondWithRpcPromise(_0x2b993f,_0x113005,_0x44671e){return new BPromise(function(_0x11e538,_0x2c7008){return client['request'](_0x2b993f,_0x44671e)[_0xd27b('0x11')](function(_0x502e8f){logger[_0xd27b('0x12')](_0xd27b('0x13'),_0x113005,_0xd27b('0x14'));logger[_0xd27b('0x15')](_0xd27b('0x16'),_0x113005,_0xd27b('0x14'),JSON[_0xd27b('0x17')](_0x502e8f));if(_0x502e8f['error']){if(_0x502e8f['error']['code']===0x1f4){logger['error'](_0xd27b('0x13'),_0x113005,_0x502e8f[_0xd27b('0x18')][_0xd27b('0x19')]);return _0x2c7008(_0x502e8f['error'][_0xd27b('0x19')]);}logger[_0xd27b('0x18')](_0xd27b('0x13'),_0x113005,_0x502e8f[_0xd27b('0x18')]['message']);return _0x11e538(_0x502e8f[_0xd27b('0x18')][_0xd27b('0x19')]);}else{logger['info'](_0xd27b('0x13'),_0x113005,_0xd27b('0x14'));_0x11e538(_0x502e8f['result'][_0xd27b('0x19')]);}})[_0xd27b('0x1a')](function(_0x1f223b){logger[_0xd27b('0x18')](_0xd27b('0x13'),_0x113005,_0x1f223b);_0x2c7008(_0x1f223b);});});} \ No newline at end of file +var _0xdabf=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x21d419,_0x3995f1){var _0x5c65ce=function(_0x42519c){while(--_0x42519c){_0x21d419['push'](_0x21d419['shift']());}};_0x5c65ce(++_0x3995f1);}(_0xdabf,0x1e3));var _0xfdab=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xdabf[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xfdab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfdab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdab('0x2'));var db=require(_0xfdab('0x3'))['db'];var utils=require(_0xfdab('0x4'));var logger=require(_0xfdab('0x5'))(_0xfdab('0x6'));var config=require('../../config/environment');var jayson=require(_0xfdab('0x7'));var client=jayson[_0xfdab('0x8')][_0xfdab('0x9')]({'port':0x232a});config[_0xfdab('0xa')]=_['defaults'](config[_0xfdab('0xa')],{'host':_0xfdab('0xb'),'port':0x18eb});var socket=require(_0xfdab('0xc'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xfdab('0xd')](socket);function respondWithRpcPromise(_0x11c2f9,_0xe3f54a,_0x2590bd){return new BPromise(function(_0x30ee57,_0xa12eda){return client[_0xfdab('0xe')](_0x11c2f9,_0x2590bd)[_0xfdab('0xf')](function(_0x13d0b6){logger[_0xfdab('0x10')](_0xfdab('0x11'),_0xe3f54a,_0xfdab('0x12'));logger[_0xfdab('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xe3f54a,_0xfdab('0x12'),JSON[_0xfdab('0x14')](_0x13d0b6));if(_0x13d0b6['error']){if(_0x13d0b6['error']['code']===0x1f4){logger[_0xfdab('0x15')]('ChatGroup,\x20%s,\x20%s',_0xe3f54a,_0x13d0b6['error'][_0xfdab('0x16')]);return _0xa12eda(_0x13d0b6[_0xfdab('0x15')][_0xfdab('0x16')]);}logger['error'](_0xfdab('0x11'),_0xe3f54a,_0x13d0b6[_0xfdab('0x15')]['message']);return _0x30ee57(_0x13d0b6[_0xfdab('0x15')][_0xfdab('0x16')]);}else{logger[_0xfdab('0x10')](_0xfdab('0x11'),_0xe3f54a,_0xfdab('0x12'));_0x30ee57(_0x13d0b6[_0xfdab('0x17')][_0xfdab('0x16')]);}})[_0xfdab('0x18')](function(_0x54535d){logger['error']('ChatGroup,\x20%s,\x20%s',_0xe3f54a,_0x54535d);_0xa12eda(_0x54535d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f65b2d4..f396a39 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 _0xcae7=['save','remove','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x2bf76a,_0xb01832){var _0x1ec759=function(_0x660558){while(--_0x660558){_0x2bf76a['push'](_0x2bf76a['shift']());}};_0x1ec759(++_0xb01832);}(_0xcae7,0x156));var _0x7cae=function(_0x1510c5,_0xde9022){_0x1510c5=_0x1510c5-0x0;var _0x433a86=_0xcae7[_0x1510c5];return _0x433a86;};'use strict';var ChatGroupEvents=require(_0x7cae('0x0'));var events=[_0x7cae('0x1'),_0x7cae('0x2'),'update'];function createListener(_0x11a576,_0x2080dc){return function(_0x9f71b5){_0x2080dc['emit'](_0x11a576,_0x9f71b5);};}function removeListener(_0x175d82,_0x202924){return function(){ChatGroupEvents[_0x7cae('0x3')](_0x175d82,_0x202924);};}exports[_0x7cae('0x4')]=function(_0x588498){for(var _0x483b63=0x0,_0x12fe92=events[_0x7cae('0x5')];_0x483b63<_0x12fe92;_0x483b63++){var _0x50fc6a=events[_0x483b63];var _0x2f8f2f=createListener(_0x7cae('0x6')+_0x50fc6a,_0x588498);ChatGroupEvents['on'](_0x50fc6a,_0x2f8f2f);}}; \ No newline at end of file +var _0x2709=['chatGroup:','./chatGroup.events','update','removeListener','register','length'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x2709,0x157));var _0x9270=function(_0x2e2f3d,_0x2a4a55){_0x2e2f3d=_0x2e2f3d-0x0;var _0x48a6df=_0x2709[_0x2e2f3d];return _0x48a6df;};'use strict';var ChatGroupEvents=require(_0x9270('0x0'));var events=['save','remove',_0x9270('0x1')];function createListener(_0x43eba9,_0x36d5b9){return function(_0x1ad15a){_0x36d5b9['emit'](_0x43eba9,_0x1ad15a);};}function removeListener(_0x8e86d1,_0x159f00){return function(){ChatGroupEvents[_0x9270('0x2')](_0x8e86d1,_0x159f00);};}exports[_0x9270('0x3')]=function(_0x136752){for(var _0x4be1a8=0x0,_0x531d99=events[_0x9270('0x4')];_0x4be1a8<_0x531d99;_0x4be1a8++){var _0x56d7f3=events[_0x4be1a8];var _0x468104=createListener(_0x9270('0x5')+_0x56d7f3,_0x136752);ChatGroupEvents['on'](_0x56d7f3,_0x468104);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a3cb18b..81afbdd 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 _0x8fb9=['post','addMembers','/:id/messages','put','update','delete','destroy','removeMembers','exports','multer','util','path','express','Router','./chatGroup.controller','index','get','/describe','/:id','show','isAuthenticated','/:id/members','getMembers','getMessages'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x8fb9,0x69));var _0x98fb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x8fb9[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x98fb('0x0'));var util=require(_0x98fb('0x1'));var path=require(_0x98fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x98fb('0x3'));var router=express[_0x98fb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x98fb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x98fb('0x6')]);router[_0x98fb('0x7')](_0x98fb('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x98fb('0x7')](_0x98fb('0x9'),auth['isAuthenticated'](),controller[_0x98fb('0xa')]);router[_0x98fb('0x7')]('/:id/unread',auth[_0x98fb('0xb')](),controller['getUnread']);router[_0x98fb('0x7')](_0x98fb('0xc'),auth[_0x98fb('0xb')](),controller[_0x98fb('0xd')]);router[_0x98fb('0x7')]('/:id/messages',auth[_0x98fb('0xb')](),controller[_0x98fb('0xe')]);router['post']('/',auth[_0x98fb('0xb')](),controller['create']);router[_0x98fb('0xf')]('/:id/members',auth[_0x98fb('0xb')](),controller[_0x98fb('0x10')]);router['post'](_0x98fb('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0x98fb('0x12')](_0x98fb('0x9'),auth['isAuthenticated'](),controller[_0x98fb('0x13')]);router[_0x98fb('0x14')](_0x98fb('0x9'),auth[_0x98fb('0xb')](),controller[_0x98fb('0x15')]);router[_0x98fb('0x14')](_0x98fb('0xc'),auth[_0x98fb('0xb')](),controller[_0x98fb('0x16')]);module[_0x98fb('0x17')]=router; \ No newline at end of file +var _0x8169=['create','addMembers','put','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8169,0x197));var _0x9816=function(_0x4130ae,_0xfbc3cf){_0x4130ae=_0x4130ae-0x0;var _0x30baad=_0x8169[_0x4130ae];return _0x30baad;};'use strict';var multer=require(_0x9816('0x0'));var util=require(_0x9816('0x1'));var path=require(_0x9816('0x2'));var timeout=require(_0x9816('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9816('0x4'));var interaction=require(_0x9816('0x5'));var config=require('../../config/environment');var controller=require(_0x9816('0x6'));router[_0x9816('0x7')]('/',auth[_0x9816('0x8')](),controller['index']);router[_0x9816('0x7')](_0x9816('0x9'),auth[_0x9816('0x8')](),controller[_0x9816('0xa')]);router[_0x9816('0x7')](_0x9816('0xb'),auth[_0x9816('0x8')](),controller[_0x9816('0xc')]);router[_0x9816('0x7')](_0x9816('0xd'),auth['isAuthenticated'](),controller[_0x9816('0xe')]);router['get'](_0x9816('0xf'),auth[_0x9816('0x8')](),controller[_0x9816('0x10')]);router['get']('/:id/messages',auth[_0x9816('0x8')](),controller['getMessages']);router[_0x9816('0x11')]('/',auth[_0x9816('0x8')](),controller[_0x9816('0x12')]);router['post'](_0x9816('0xf'),auth[_0x9816('0x8')](),controller[_0x9816('0x13')]);router[_0x9816('0x11')]('/:id/messages',auth[_0x9816('0x8')](),controller['addMessage']);router[_0x9816('0x14')](_0x9816('0xb'),auth[_0x9816('0x8')](),controller[_0x9816('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9816('0x16')]);router[_0x9816('0x17')](_0x9816('0xf'),auth[_0x9816('0x8')](),controller[_0x9816('0x18')]);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 1712e93..177e84a 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 _0x6c97=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN'];(function(_0x570447,_0x4f628f){var _0x30aeb4=function(_0x52ad19){while(--_0x52ad19){_0x570447['push'](_0x570447['shift']());}};_0x30aeb4(++_0x4f628f);}(_0x6c97,0xd5));var _0x76c9=function(_0x303ee3,_0x140838){_0x303ee3=_0x303ee3-0x0;var _0x2d47ab=_0x6c97[_0x303ee3];return _0x2d47ab;};'use strict';var Sequelize=require(_0x76c9('0x0'));module[_0x76c9('0x1')]={'closed':{'type':Sequelize[_0x76c9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x76c9('0x3')]},'ratingType':{'type':Sequelize[_0x76c9('0x4')](_0x76c9('0x5'),_0x76c9('0x6')),'defaultValue':_0x76c9('0x5')},'ratingMessage':{'type':Sequelize[_0x76c9('0x7')]},'pathTranscript':{'type':Sequelize[_0x76c9('0x7')]},'mailTranscript':{'type':Sequelize[_0x76c9('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x76c9('0x9')]},'disposition':{'type':Sequelize[_0x76c9('0x8')]},'note':{'type':Sequelize[_0x76c9('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x76c9('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x76c9('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x76c9('0x8')]},'deviceType':{'type':Sequelize[_0x76c9('0x8')]},'referer':{'type':Sequelize[_0x76c9('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x76c9('0x7')](_0x76c9('0xa'))},'read1stAt':{'type':Sequelize[_0x76c9('0x9')]},'lastMsgAt':{'type':Sequelize[_0x76c9('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x76c9('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x76c9('0x8')]},'customerPort':{'type':Sequelize[_0x76c9('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x76c9('0x7')]}}; \ No newline at end of file +var _0x0108=['exports','INTEGER','ENUM','thumb','star','TEXT','STRING','long','DATE'];(function(_0x575e00,_0x559d6e){var _0x199f97=function(_0xd65d89){while(--_0xd65d89){_0x575e00['push'](_0x575e00['shift']());}};_0x199f97(++_0x559d6e);}(_0x0108,0x129));var _0x8010=function(_0x491c1e,_0x32710a){_0x491c1e=_0x491c1e-0x0;var _0x30d20b=_0x0108[_0x491c1e];return _0x30d20b;};'use strict';var Sequelize=require('sequelize');module[_0x8010('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8010('0x1')]},'ratingType':{'type':Sequelize[_0x8010('0x2')]('star',_0x8010('0x3')),'defaultValue':_0x8010('0x4')},'ratingMessage':{'type':Sequelize[_0x8010('0x5')]},'pathTranscript':{'type':Sequelize[_0x8010('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8010('0x6')]},'browserName':{'type':Sequelize[_0x8010('0x6')]},'browserVersion':{'type':Sequelize[_0x8010('0x6')]},'osName':{'type':Sequelize[_0x8010('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8010('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8010('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x8010('0x6')]},'formData':{'type':Sequelize[_0x8010('0x5')](_0x8010('0x7'))},'read1stAt':{'type':Sequelize[_0x8010('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8010('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8010('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 985fc5b..2e8fd58 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 _0x1a37=['ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','params','ChatInteraction','include','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','download','join','root','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','agentAlias','customer','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','filter','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','options','includeAgent','addTags','setTags','omit','spread','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','firstName','lastName','Account','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./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','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','fullname','TagIds','forEach','Tags','push','catch','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty'];(function(_0x356b06,_0x57eba8){var _0x348c9b=function(_0x941495){while(--_0x941495){_0x356b06['push'](_0x356b06['shift']());}};_0x348c9b(++_0x57eba8);}(_0x1a37,0xb4));var _0x71a3=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x1a37[_0x21549c];return _0x426cbd;};'use strict';var pdf=require(_0x71a3('0x0'));var emlformat=require(_0x71a3('0x1'));var rimraf=require(_0x71a3('0x2'));var zipdir=require(_0x71a3('0x3'));var jsonpatch=require(_0x71a3('0x4'));var rp=require(_0x71a3('0x5'));var moment=require(_0x71a3('0x6'));var BPromise=require(_0x71a3('0x7'));var Mustache=require(_0x71a3('0x8'));var util=require(_0x71a3('0x9'));var path=require('path');var sox=require(_0x71a3('0xa'));var csv=require('to-csv');var ejs=require(_0x71a3('0xb'));var fs=require('fs');var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x71a3('0x17')]=_[_0x71a3('0x18')](config[_0x71a3('0x17')],{'host':_0x71a3('0x19'),'port':0x18eb});var socket=require(_0x71a3('0x1a'))(new Redis(config[_0x71a3('0x17')]));require(_0x71a3('0x1b'))[_0x71a3('0x1c')](socket);var jayson=require(_0x71a3('0x1d'));var client=jayson[_0x71a3('0x1e')][_0x71a3('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0x71a3('0x1f')]({'port':0x232c});function checkPasswordPattern(_0x32591a,_0x59021f,_0x4aa918){if(_0x4aa918){var _0x41fe1c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41fe1c[_0x71a3('0x20')](_0x59021f)){return _0x32591a;}else{throw new db[(_0x71a3('0x21'))][(_0x71a3('0x22'))](_0x71a3('0x23'));}}else{return _0x32591a;}}function respondWithRpcPromise(_0x318ff6,_0x5d4dee,_0x656cd2,_0x27bfb4){return new BPromise(function(_0x5b955a,_0x5f4562){var _0x410a65=_0x27bfb4||client;return _0x410a65[_0x71a3('0x24')](_0x318ff6,_0x656cd2)[_0x71a3('0x25')](function(_0x1c4ec2){logger[_0x71a3('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x5d4dee,_0x71a3('0x27'));logger[_0x71a3('0x28')](_0x71a3('0x29'),_0x5d4dee,_0x71a3('0x27'),JSON[_0x71a3('0x2a')](_0x1c4ec2));if(_0x1c4ec2['error']){if(_0x1c4ec2[_0x71a3('0x2b')]['code']===0x1f4){logger[_0x71a3('0x2b')](_0x71a3('0x2c'),_0x5d4dee,_0x1c4ec2[_0x71a3('0x2b')][_0x71a3('0x2d')]);return _0x5f4562(_0x1c4ec2[_0x71a3('0x2b')][_0x71a3('0x2d')]);}logger['error'](_0x71a3('0x2c'),_0x5d4dee,_0x1c4ec2[_0x71a3('0x2b')][_0x71a3('0x2d')]);return _0x5b955a(_0x1c4ec2[_0x71a3('0x2b')][_0x71a3('0x2d')]);}else{logger['info'](_0x71a3('0x2c'),_0x5d4dee,_0x71a3('0x27'));_0x5b955a(_0x1c4ec2['result'][_0x71a3('0x2d')]);}})['catch'](function(_0x46f1ff){logger[_0x71a3('0x2b')](_0x71a3('0x2c'),_0x5d4dee,_0x46f1ff);_0x5f4562(_0x46f1ff);});});}function respondWithStatusCode(_0x35b5c7,_0x25f351){_0x25f351=_0x25f351||0xcc;return function(_0x314439){if(_0x314439){return _0x35b5c7[_0x71a3('0x2e')](_0x25f351);}return _0x35b5c7[_0x71a3('0x2f')](_0x25f351)[_0x71a3('0x30')]();};}function respondWithResult(_0x3fc578,_0x3ea7aa){_0x3ea7aa=_0x3ea7aa||0xc8;return function(_0x228afa){if(_0x228afa){return _0x3fc578['status'](_0x3ea7aa)[_0x71a3('0x31')](_0x228afa);}};}function respondWithFilteredResult(_0x1719e6,_0x334db0){return function(_0x23ae85){if(_0x23ae85){var _0x4a750c=_0x23ae85[_0x71a3('0x32')],_0x18a8fe=_0x334db0[_0x71a3('0x33')],_0x216d84=_0x334db0[_0x71a3('0x33')]+_0x334db0[_0x71a3('0x34')],_0x45d13d;if(_0x216d84>=_0x4a750c){_0x216d84=_0x4a750c;_0x45d13d=0xc8;}else{_0x45d13d=0xce;}_0x1719e6['status'](_0x45d13d);return _0x1719e6[_0x71a3('0x35')](_0x71a3('0x36'),_0x18a8fe+'-'+_0x216d84+'/'+_0x4a750c)[_0x71a3('0x31')](_0x23ae85);}return null;};}function patchUpdates(_0x168e9b){return function(_0x2154d1){try{jsonpatch[_0x71a3('0x37')](_0x2154d1,_0x168e9b,!![]);}catch(_0x425d83){return BPromise[_0x71a3('0x38')](_0x425d83);}return _0x2154d1[_0x71a3('0x39')]();};}function saveUpdates(_0x3eda28,_0x2376e5){return function(_0x219815){if(_0x219815){return _0x219815[_0x71a3('0x3a')](_0x3eda28)['then'](function(_0x5a3043){return _0x5a3043;});}return null;};}function removeEntity(_0x2e7c00,_0xcd1106){return function(_0x564fd2){if(_0x564fd2){return _0x564fd2[_0x71a3('0x3b')]()[_0x71a3('0x25')](function(){_0x2e7c00['status'](0xcc)[_0x71a3('0x30')]();});}};}function handleEntityNotFound(_0x1a7bb7,_0x26f3a7){return function(_0x250572){if(!_0x250572){_0x1a7bb7[_0x71a3('0x2e')](0x194);}return _0x250572;};}function handleError(_0x255098,_0x197fa2){_0x197fa2=_0x197fa2||0x1f4;return function(_0x541840){logger[_0x71a3('0x2b')](_0x541840[_0x71a3('0x3c')]);if(_0x541840[_0x71a3('0x3d')]){delete _0x541840['name'];}_0x255098[_0x71a3('0x2f')](_0x197fa2)[_0x71a3('0x3e')](_0x541840);};}function getInteractionUsers(_0x3dc1de,_0x171902){return new BPromise(function(_0x6cea55,_0x54d03b){try{if(_0x171902[_0x3dc1de['id']]){_0x3dc1de['Users']=_[_0x71a3('0x3f')](_0x171902[_0x3dc1de['id']],function(_0x2b3197){return{'id':_0x2b3197['id'],'fullname':_0x2b3197[_0x71a3('0x40')]};});}}catch(_0x1d7353){_0x54d03b(_0x1d7353);}_0x6cea55(_0x3dc1de);});}function getInteractionTags(_0x36ed2e,_0x4e7d61){return new BPromise(function(_0x223cfd,_0x16d23c){try{if(_0x36ed2e[_0x71a3('0x41')]){_0x36ed2e['Tags']=[];_0x36ed2e[_0x71a3('0x41')]['split'](',')[_0x71a3('0x42')](function(_0x2928dc){_0x36ed2e[_0x71a3('0x43')][_0x71a3('0x44')](_0x4e7d61[_0x2928dc]);});}delete _0x36ed2e[_0x71a3('0x41')];}catch(_0x38912c){_0x16d23c(_0x38912c);}_0x223cfd(_0x36ed2e);});}function updateChatInteraction(_0x468ca4,_0x40a18f,_0x31ba66){return new BPromise(function(_0x5e5626,_0x4bc5c8){return getInteractionUsers(_0x468ca4,_0x31ba66)[_0x71a3('0x25')](function(_0x49affd){return getInteractionTags(_0x49affd,_0x40a18f);})[_0x71a3('0x25')](function(_0x1ed84d){_0x5e5626(_0x1ed84d);})[_0x71a3('0x45')](function(_0x18974c){_0x4bc5c8(_0x18974c);});});}exports['index']=function(_0x412bce,_0x4b4fde){var _0x5e0532={},_0x3abfe7={},_0x8c731={'count':0x0,'rows':[]};var _0x1e66dc=_[_0x71a3('0x3f')](db['ChatInteraction'][_0x71a3('0x46')],function(_0x615c6f){return{'name':_0x615c6f[_0x71a3('0x47')],'type':_0x615c6f[_0x71a3('0x48')][_0x71a3('0x49')]};});_0x3abfe7[_0x71a3('0x4a')]=_[_0x71a3('0x3f')](_0x1e66dc,_0x71a3('0x3d'));_0x3abfe7[_0x71a3('0x4b')]=_[_0x71a3('0x4c')](_0x412bce[_0x71a3('0x4b')]);_0x3abfe7[_0x71a3('0x4d')]=_[_0x71a3('0x4e')](_0x3abfe7[_0x71a3('0x4a')],_0x3abfe7[_0x71a3('0x4b')]);_0x5e0532[_0x71a3('0x4f')]=_['intersection'](_0x3abfe7[_0x71a3('0x4a')],qs[_0x71a3('0x50')](_0x412bce['query'][_0x71a3('0x50')]));_0x5e0532[_0x71a3('0x4f')]=_0x5e0532[_0x71a3('0x4f')][_0x71a3('0x51')]?_0x5e0532[_0x71a3('0x4f')]:_0x3abfe7['model'];if(!_0x412bce['query'][_0x71a3('0x52')](_0x71a3('0x53'))){_0x5e0532['limit']=qs[_0x71a3('0x34')](_0x412bce[_0x71a3('0x4b')][_0x71a3('0x34')]);_0x5e0532[_0x71a3('0x33')]=qs[_0x71a3('0x33')](_0x412bce[_0x71a3('0x4b')]['offset']);}_0x5e0532[_0x71a3('0x54')]=qs['sort'](_0x412bce[_0x71a3('0x4b')][_0x71a3('0x55')]);_0x5e0532[_0x71a3('0x56')]=qs[_0x71a3('0x4d')](_[_0x71a3('0x57')](_0x412bce['query'],_0x3abfe7[_0x71a3('0x4d')]),_0x1e66dc);var _0x144872=[];var _0xa0e8aa=squel['select']()[_0x71a3('0x58')]('id')['field'](_0x71a3('0x3d'))[_0x71a3('0x58')]('color')[_0x71a3('0x59')](_0x71a3('0x5a'));var _0xa62a74=squel[_0x71a3('0x5b')]()[_0x71a3('0x58')](_0x71a3('0x5c'))[_0x71a3('0x58')]('u.fullname')[_0x71a3('0x58')]('ui.ChatInteractionId')[_0x71a3('0x59')]('user_has_chat_interactions','ui')[_0x71a3('0x5d')](_0x71a3('0x5e'),'u',_0x71a3('0x5f'));var _0x45c42b=squel['select']()['from'](_0x71a3('0x60'),'i')[_0x71a3('0x5d')](_0x71a3('0x61'),'c',_0x71a3('0x62'))['left_join']('users','o',_0x71a3('0x63'))[_0x71a3('0x5d')](_0x71a3('0x64'),'a',_0x71a3('0x65'))[_0x71a3('0x5d')]('chat_messages','me',_0x71a3('0x66'))[_0x71a3('0x5d')](_0x71a3('0x67'),'it',_0x71a3('0x68'))[_0x71a3('0x5d')](_0x71a3('0x5a'),'t',_0x71a3('0x69'));var _0x43a276=squel['expr']();var _0x384199=[];var _0xf40cb0=squel[_0x71a3('0x6a')]();var _0x56dea4;if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x6b')]){_0x56dea4=as[_0x71a3('0x6c')](_0x412bce[_0x71a3('0x4b')][_0x71a3('0x6b')]);var _0x2b7c00=_0x56dea4[_0x71a3('0x6d')];for(var _0x302dab=0x0;_0x302dab<_0x56dea4[_0x71a3('0x6e')][_0x71a3('0x51')];_0x302dab++){var _0x532714=_0x56dea4[_0x71a3('0x6e')][_0x302dab];var _0x324ee7='i';var _0x56177c=_[_0x71a3('0x6f')](_0x1e66dc,['name',_0x532714['field']]);if(!_0x56177c){switch(_0x532714[_0x71a3('0x58')]){case _0x71a3('0x70'):if(_0x532714[_0x71a3('0x71')]==0x1){_0x45c42b[_0x71a3('0x72')]('`'+_0x532714[_0x71a3('0x58')]+'`\x20=\x200');}else{_0x45c42b[_0x71a3('0x72')]('`'+_0x532714[_0x71a3('0x58')]+'`\x20>\x200');}break;case _0x71a3('0x73'):if(_0x532714['operator']===_0x71a3('0x74')){if(_0x532714[_0x71a3('0x71')]['split']('\x20')['length']>0x1){_0x43a276[_0x2b7c00](_0x71a3('0x75'),qs[_0x71a3('0x76')](_0x532714['value']),null);}else{var _0x150219='%'+_0x532714[_0x71a3('0x71')]+'%';_0x43a276[_0x2b7c00](_0x71a3('0x77'),_0x150219,_0x150219,_0x150219);}}else{_0x56177c=_['find'](_0x1e66dc,[_0x71a3('0x3d'),_0x71a3('0x78')]);_0x532714[_0x71a3('0x58')]=_0x71a3('0x78');_0x30eb3c=as[_0x71a3('0x79')](_0x324ee7,_0x56177c[_0x71a3('0x48')],_0x532714);_0x43a276[_0x2b7c00](_0x30eb3c[_0x71a3('0x7a')],_0x30eb3c[_0x71a3('0x71')][_0x71a3('0x7b')],_0x30eb3c['value'][_0x71a3('0x30')]);}break;case _0x71a3('0x7c'):var _0x84b636=_0x532714['value'][_0x71a3('0x7d')](',')[_0x71a3('0x3f')](function(_0x203175){return Number(_0x203175);});_0x84b636[_0x71a3('0x42')](function(_0x265cd5){_0xf40cb0['or'](_0x71a3('0x7e'),'%,'+_0x265cd5+',%');});_0x384199=_[_0x71a3('0x7f')](_0x384199,_0x84b636);break;case _0x71a3('0x80'):if(_0x532714[_0x71a3('0x81')]==='$substring'){_0x43a276[_0x2b7c00](_0x71a3('0x82'),'%'+_0x532714['value']+'%',null);}else{_0x56177c=_[_0x71a3('0x6f')](_0x1e66dc,['name','UserId']);_0x532714[_0x71a3('0x58')]='UserId';_0x30eb3c=as[_0x71a3('0x79')](_0x324ee7,_0x56177c[_0x71a3('0x48')],_0x532714);_0x43a276[_0x2b7c00](_0x30eb3c[_0x71a3('0x7a')],_0x30eb3c['value'][_0x71a3('0x7b')],_0x30eb3c[_0x71a3('0x71')]['end']);}break;case _0x71a3('0x83'):_0x30eb3c=as[_0x71a3('0x79')]('me',null,_0x532714);_0x43a276[_0x2b7c00](_0x30eb3c[_0x71a3('0x7a')],_0x30eb3c[_0x71a3('0x71')][_0x71a3('0x7b')],_0x30eb3c[_0x71a3('0x71')][_0x71a3('0x30')]);break;}}else{var _0x30eb3c=as['buildExpression'](_0x324ee7,_0x56177c['type'],_0x532714);_0x43a276[_0x2b7c00](_0x30eb3c[_0x71a3('0x7a')],_0x30eb3c[_0x71a3('0x71')][_0x71a3('0x7b')],_0x30eb3c['value'][_0x71a3('0x30')]);}}}else{var _0x789f2a=_(_0x412bce['query'])[_0x71a3('0x4c')]()['map'](function(_0x4294d5){return _[_0x71a3('0x84')](_0x1e66dc,[_0x71a3('0x3d'),_0x4294d5])?_0x4294d5:undefined;})[_0x71a3('0x85')]()['value']();if(!_[_0x71a3('0x86')](_0x789f2a)){_0x789f2a[_0x71a3('0x42')](function(_0x505c68){if(_0x505c68===_0x71a3('0x87')){_0x45c42b[_0x71a3('0x56')](_0x71a3('0x88'),[][_0x71a3('0x89')](_0x412bce[_0x71a3('0x4b')][_0x505c68]));}else if(_0x505c68===_0x71a3('0x8a')){var _0x3fbbec=JSON[_0x71a3('0x8b')](_0x412bce[_0x71a3('0x4b')][_0x505c68])[_0x71a3('0x8c')];var _0x3dce03=JSON[_0x71a3('0x8b')](_0x412bce['query'][_0x505c68])[_0x71a3('0x8d')];_0x45c42b['where'](_0x71a3('0x8e'),_0x3fbbec,_0x3dce03);}else{if(_0x412bce[_0x71a3('0x4b')][_0x505c68]===_0x71a3('0x8f')){_0x45c42b[_0x71a3('0x56')]('i.'+_0x505c68+_0x71a3('0x90'));}else{_0x45c42b[_0x71a3('0x56')]('i.'+_0x505c68+_0x71a3('0x91'),_0x412bce[_0x71a3('0x4b')][_0x505c68]);}}});}if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x92')]){if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x92')]==0x1){_0x45c42b[_0x71a3('0x72')](_0x71a3('0x93'));}else{_0x45c42b[_0x71a3('0x72')](_0x71a3('0x94'));}}if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x95')]){_0x384199=_[_0x71a3('0x96')](_0x412bce['query'][_0x71a3('0x95')])?_0x412bce[_0x71a3('0x4b')][_0x71a3('0x95')]:new Array(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x95')]);_0x384199[_0x71a3('0x42')](function(_0x35e802){_0xf40cb0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35e802+',%');});}if(_0x412bce[_0x71a3('0x4b')]['filter']){var _0x552ff7=_0x412bce['query']['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x71a3('0x97'));if(qs[_0x71a3('0x98')](_0x552ff7)){_0x43a276['or'](_0x71a3('0x99'),_0x552ff7+'%');}else{_0x43a276['or'](_0x71a3('0x9a'),qs[_0x71a3('0x76')](_0x552ff7))['or'](_0x71a3('0x9b'),_0x552ff7+'%');}}}_0x45c42b[_0x71a3('0x56')](_0x43a276);_0x45c42b[_0x71a3('0x9c')](_0x71a3('0x9d'));var _0x291c32={'type':db[_0x71a3('0x21')][_0x71a3('0x9e')][_0x71a3('0x9f')],'raw':!![]};var _0x5a5066=_0x45c42b[_0x71a3('0xa0')]();_0x5a5066[_0x71a3('0x58')](_0x71a3('0x9d'));_0x5a5066[_0x71a3('0x58')](_0x71a3('0xa1'),_0x71a3('0x70'));if(_0x5e0532['order']){_0x5e0532['order']['forEach'](function(_0xc8166a){_0x45c42b[_0x71a3('0x54')]('i.'+_0xc8166a[0x0],_0xc8166a[0x1]===_0x71a3('0xa2')?![]:!![]);});}if(!_['isEmpty'](_0x384199)){_0x45c42b[_0x71a3('0x72')](_0xf40cb0);_0x5a5066[_0x71a3('0x56')](_0x71a3('0xa3'),_0x384199);}BPromise[_0x71a3('0xa4')]()[_0x71a3('0x25')](function(){if(!_0x56dea4){if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x87')]||_0x412bce[_0x71a3('0x4b')][_0x71a3('0xa5')])return;_0x5a5066['where'](_0x71a3('0xa6'));_0x45c42b[_0x71a3('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x412bce[_0x71a3('0xa7')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x71a3('0x25')](function(_0x387165){if(_[_0x71a3('0x86')](_0x387165)){_0x5a5066[_0x71a3('0x56')](_0x71a3('0xa8'));_0x45c42b['where'](_0x71a3('0xa8'));}else{_0x5a5066[_0x71a3('0x56')]('i.ChatWebsiteId\x20IN\x20?',_[_0x71a3('0x3f')](_0x387165,'id'));_0x45c42b[_0x71a3('0x56')](_0x71a3('0x88'),_['map'](_0x387165,'id'));}});})[_0x71a3('0x25')](function(){db[_0x71a3('0xa9')][_0x71a3('0x4b')](_0x5a5066['toString'](),_0x291c32)['then'](function(_0x2295f3){_0x8c731[_0x71a3('0x32')]=_0x2295f3[_0x71a3('0x51')];if(_0x8c731['count']===0x0)return[];return db[_0x71a3('0xa9')]['query'](_0xa0e8aa[_0x71a3('0xaa')](),_0x291c32)[_0x71a3('0x25')](function(_0x2eff6d){_0x144872=_['keyBy'](_0x2eff6d,'id');_0x291c32=_[_0x71a3('0xab')](_0x291c32,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x412bce[_0x71a3('0x4b')][_0x71a3('0x50')]){_0x5e0532[_0x71a3('0x4f')][_0x71a3('0x42')](function(_0x4713a3){_0x45c42b['field']('i.'+_0x4713a3);});}else{_0x45c42b[_0x71a3('0x58')](_0x71a3('0xa1'),'unreadMessages');_0x45c42b['field'](_0x71a3('0xac'),_0x71a3('0xad'));_0x45c42b[_0x71a3('0x58')]('a.mandatoryDisposition',_0x71a3('0xae'));_0x45c42b[_0x71a3('0x58')](_0x71a3('0xaf'));_0x45c42b[_0x71a3('0x58')](_0x71a3('0xb0'),_0x71a3('0xb1'));_0x45c42b[_0x71a3('0x58')]('c.lastName',_0x71a3('0xb2'));_0x45c42b[_0x71a3('0x58')](_0x71a3('0xb3'),_0x71a3('0xb4'));_0x45c42b['field'](_0x71a3('0xb5'),_0x71a3('0xb6'));_0x45c42b[_0x71a3('0x58')](_0x71a3('0xb7'),_0x71a3('0xb8'));_0x45c42b[_0x71a3('0x58')](_0x71a3('0xb9'),_0x71a3('0xba'));_0x45c42b['field'](_0x71a3('0xbb'),'Owner.fullname');_0x45c42b[_0x71a3('0x58')](_0x71a3('0xbc'),_0x71a3('0xbd'));_0x45c42b[_0x71a3('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5e0532['limit'])_0x45c42b[_0x71a3('0x34')](_0x5e0532[_0x71a3('0x34')]);if(_0x5e0532[_0x71a3('0x33')])_0x45c42b[_0x71a3('0x33')](_0x5e0532[_0x71a3('0x33')]);return db[_0x71a3('0xa9')][_0x71a3('0x4b')](_0x45c42b[_0x71a3('0xaa')](),_0x291c32);})[_0x71a3('0x25')](function(_0x253a0c){_0xa62a74['where'](_0x71a3('0xbe'),_[_0x71a3('0x3f')](_0x253a0c,'id'));return db[_0x71a3('0xa9')][_0x71a3('0x4b')](_0xa62a74[_0x71a3('0xaa')](),_0x291c32)[_0x71a3('0x25')](function(_0x58c6be){var _0x47560c=_['groupBy'](_0x58c6be,_0x71a3('0xbf'));var _0x529d64=[];_0x253a0c[_0x71a3('0x42')](function(_0x6ceaee){_0x529d64['push'](updateChatInteraction(_0x6ceaee,_0x144872,_0x47560c));});return BPromise[_0x71a3('0xc0')](_0x529d64);});});})['then'](function(_0x3d59f8){_0x8c731['rows']=_0x3d59f8;return _0x8c731;})[_0x71a3('0x25')](respondWithFilteredResult(_0x4b4fde,_0x5e0532));})[_0x71a3('0x45')](handleError(_0x4b4fde,null));};exports['show']=function(_0x2a620a,_0x421602){var _0x31bbd9={'raw':![],'where':{'id':_0x2a620a[_0x71a3('0xc1')]['id']}},_0xf0bded={};_0xf0bded[_0x71a3('0x4a')]=_[_0x71a3('0x4c')](db[_0x71a3('0xc2')]['rawAttributes']);_0xf0bded[_0x71a3('0x4b')]=_[_0x71a3('0x4c')](_0x2a620a[_0x71a3('0x4b')]);_0xf0bded['filters']=_[_0x71a3('0x4e')](_0xf0bded[_0x71a3('0x4a')],_0xf0bded[_0x71a3('0x4b')]);_0x31bbd9['attributes']=_['intersection'](_0xf0bded[_0x71a3('0x4a')],qs[_0x71a3('0x50')](_0x2a620a['query'][_0x71a3('0x50')]));_0x31bbd9[_0x71a3('0x4f')]=_0x31bbd9[_0x71a3('0x4f')][_0x71a3('0x51')]?_0x31bbd9[_0x71a3('0x4f')]:_0xf0bded[_0x71a3('0x4a')];if(_0x2a620a[_0x71a3('0x4b')]['includeAll']){_0x31bbd9[_0x71a3('0xc3')]=[{'all':!![]}];}_0x31bbd9=_[_0x71a3('0xab')]({},_0x31bbd9,_0x2a620a['options']);return db['ChatInteraction'][_0x71a3('0x6f')](_0x31bbd9)[_0x71a3('0x25')](handleEntityNotFound(_0x421602,null))['then'](respondWithResult(_0x421602,null))[_0x71a3('0x45')](handleError(_0x421602,null));};exports[_0x71a3('0xc4')]=function(_0x32f347,_0x57b620){return db['ChatInteraction'][_0x71a3('0xc4')](_0x32f347[_0x71a3('0x83')],{})[_0x71a3('0x25')](respondWithResult(_0x57b620,0xc9))[_0x71a3('0x45')](handleError(_0x57b620,null));};exports[_0x71a3('0x3a')]=function(_0x2b5a8c,_0x266c3f){if(_0x2b5a8c[_0x71a3('0x83')]['id']){delete _0x2b5a8c[_0x71a3('0x83')]['id'];}return db['ChatInteraction'][_0x71a3('0x6f')]({'where':{'id':_0x2b5a8c['params']['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x266c3f,null))[_0x71a3('0x25')](saveUpdates(_0x2b5a8c[_0x71a3('0x83')],null))[_0x71a3('0x25')](respondWithResult(_0x266c3f,null))['catch'](handleError(_0x266c3f,null));};exports[_0x71a3('0x3b')]=function(_0x2acec5,_0x173f05){return db[_0x71a3('0xc2')][_0x71a3('0x6f')]({'where':{'id':_0x2acec5['params']['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x173f05,null))[_0x71a3('0x25')](removeEntity(_0x173f05,null))['catch'](handleError(_0x173f05,null));};exports[_0x71a3('0xc5')]=function(_0x4cde32,_0x5c9315){return db[_0x71a3('0xc2')][_0x71a3('0xc5')]()[_0x71a3('0x25')](respondWithResult(_0x5c9315,null))[_0x71a3('0x45')](handleError(_0x5c9315,null));};exports['createVidaooSession']=function(_0x3b8781,_0x5b6dac){var _0x2383b3=_0x3b8781[_0x71a3('0xc1')]['id'];var _0xc412eb;var _0x183514;var _0x2a6d88;return db[_0x71a3('0xc2')][_0x71a3('0xc6')]({'where':{'id':_0x2383b3}})[_0x71a3('0x25')](function(_0x408b2a){_0xc412eb=_0x408b2a;return db[_0x71a3('0xc7')][_0x71a3('0xc6')]({'where':{'id':_0x408b2a[_0x71a3('0x87')]},'attributes':['id',_0x71a3('0xc8'),_0x71a3('0xc9')],'raw':!![]});})['then'](function(_0x4c944e){if(_0x4c944e&&_0x4c944e['vidaooApiKey']&&_0x4c944e[_0x71a3('0xc9')]){_0x183514=_0x4c944e;var _0x4a8e27={'rejectUnauthorized':![],'method':_0x71a3('0xca'),'uri':_0x71a3('0xcb'),'headers':{'X-APIKEY':_0x4c944e[_0x71a3('0xc8')]},'body':{'name':_0x71a3('0xcc')+_0x2383b3},'redirect':'follow','json':!![]};return rp(_0x4a8e27);}else{throw new db[(_0x71a3('0x21'))][(_0x71a3('0x22'))](_0x71a3('0xcd'));}})[_0x71a3('0x25')](function(_0x29e932){_0x2a6d88=_0x29e932;if(_0x2a6d88['id']){var _0x4687e0={'body':_0x2a6d88[_0x71a3('0xce')],'ChatWebsiteId':_0x183514['id'],'ChatInteractionId':_0xc412eb['id'],'direction':_0x71a3('0xcf'),'UserId':_0x3b8781[_0x71a3('0xa7')]['id']};return db['ChatMessage'][_0x71a3('0xc4')](_0x4687e0,{});}else{throw new db['Sequelize']['ValidationError'](_0x71a3('0xd0'));}})[_0x71a3('0x25')](function(){return _0xc412eb[_0x71a3('0xd1')]({'vidaooSessionId':_0x2a6d88['id']});})[_0x71a3('0x25')](respondWithResult(_0x5b6dac,null))[_0x71a3('0x45')](handleError(_0x5b6dac,null));};exports[_0x71a3('0xd2')]=function(_0x57edb2,_0x299f2b){if(_0x57edb2[_0x71a3('0x83')]['id']){delete _0x57edb2[_0x71a3('0x83')]['id'];}return db[_0x71a3('0xc2')][_0x71a3('0x6f')]({'where':{'id':_0x57edb2[_0x71a3('0xc1')]['id']}})['then'](handleEntityNotFound(_0x299f2b,null))['then'](saveUpdates(_0x57edb2[_0x71a3('0x83')],null))[_0x71a3('0x25')](respondWithResult(_0x299f2b,null))[_0x71a3('0x45')](handleError(_0x299f2b,null));};exports['abandon']=function(_0xa39f20,_0x2ee76a,_0x1cb43b){if(_0xa39f20['body']['id']){delete _0xa39f20['body']['id'];}return db[_0x71a3('0xc2')][_0x71a3('0x6f')]({'where':{'id':_0xa39f20[_0x71a3('0xc1')]['id']}})[_0x71a3('0x25')](function(_0x31e248){if(!_0x31e248){logger[_0x71a3('0x2b')](_0x71a3('0xd3'),'abandon',0x194,_0x71a3('0xd4'));_0x2ee76a[_0x71a3('0x2e')](0x194);}else{if(_0x31e248[_0x71a3('0xd5')]){throw new db[(_0x71a3('0x21'))][(_0x71a3('0x22'))](_0x71a3('0xd6'));}}return _0x31e248;})[_0x71a3('0x25')](function(_0x3b43ab){if(_0x3b43ab){return _0x3b43ab[_0x71a3('0x3a')]({'closed':_0xa39f20[_0x71a3('0x83')][_0x71a3('0xd7')],'disposition':_0xa39f20[_0x71a3('0x83')][_0x71a3('0xd8')]})[_0x71a3('0x25')](function(_0x358ba9){return _0x358ba9;});}})['then'](function(_0xd60faf){return respondWithRpcPromise(_0x71a3('0xd9'),_0x71a3('0xda'),_0xa39f20[_0x71a3('0x83')],client9004);})[_0x71a3('0x25')](respondWithResult(_0x2ee76a,null))[_0x71a3('0x45')](handleError(_0x2ee76a,null));};exports[_0x71a3('0xdb')]=function(_0x3a3f2d,_0x9312e3,_0x41f888){_0x3a3f2d[_0x71a3('0x83')][_0x71a3('0x3d')]=_0x3a3f2d[_0x71a3('0xdc')][_0x71a3('0xdd')];_0x3a3f2d[_0x71a3('0x83')][_0x71a3('0xde')]=_0x3a3f2d['file'][_0x71a3('0xdf')];_0x3a3f2d[_0x71a3('0x83')][_0x71a3('0x48')]=_0x3a3f2d[_0x71a3('0xdc')]['mimetype'];return db[_0x71a3('0xe0')][_0x71a3('0xc4')](_0x3a3f2d[_0x71a3('0x83')])[_0x71a3('0x25')](respondWithResult(_0x9312e3,0xc9))[_0x71a3('0x45')](handleError(_0x9312e3,null));};exports[_0x71a3('0xe1')]=function(_0x537a06,_0x55ad02,_0x457e88){return db['ChatInteraction']['findOne']({'where':{'id':_0x537a06[_0x71a3('0xc1')]['id']},'raw':!![]})[_0x71a3('0x25')](handleEntityNotFound(_0x55ad02,null))[_0x71a3('0x25')](function(_0x10353f){if(_0x10353f){if(_0x10353f['closed']){return _0x55ad02[_0x71a3('0x2f')](0x193)[_0x71a3('0x31')]({'status':0x193,'message':'Unauthorized'});}return db[_0x71a3('0xe0')][_0x71a3('0xc6')]({'where':{'id':_0x537a06[_0x71a3('0x4b')][_0x71a3('0xe2')]},'raw':!![]})[_0x71a3('0x25')](handleEntityNotFound(_0x55ad02,null));}})[_0x71a3('0x25')](function(_0x334e5b){if(_0x334e5b){return _0x55ad02[_0x71a3('0xe3')](path[_0x71a3('0xe4')](config[_0x71a3('0xe5')],'server/files/attachments/',_0x334e5b[_0x71a3('0xde')]));}})[_0x71a3('0x45')](handleError(_0x55ad02,null));};exports[_0x71a3('0xe6')]=function(_0x37df41,_0x2d685b){var _0x531756=null;var _0x121c1b=null;var _0x5d7fa4=null;var _0x4c57b8=null;if(_0x37df41[_0x71a3('0x83')]['id']){delete _0x37df41[_0x71a3('0x83')]['id'];}if(_0x37df41[_0x71a3('0x83')]['mailTranscript']){_0x4c57b8=path['join'](config[_0x71a3('0xe5')],_0x71a3('0xe7'),util[_0x71a3('0xe8')](_0x71a3('0xe9'),Date[_0x71a3('0xea')]()));_0x37df41[_0x71a3('0x83')][_0x71a3('0xeb')]=_0x4c57b8;}return db[_0x71a3('0xc2')]['find']({'where':{'id':_0x37df41[_0x71a3('0xc1')]['id']},'include':[{'model':db[_0x71a3('0xec')],'as':_0x71a3('0xed'),'include':[{'model':db[_0x71a3('0x80')],'as':'User'}]}]})[_0x71a3('0x25')](handleEntityNotFound(_0x2d685b,null))[_0x71a3('0x25')](saveUpdates(_0x37df41['body'],null))[_0x71a3('0x25')](function(_0xa0b3ae){if(_0xa0b3ae){_0x531756=_0xa0b3ae;return db[_0x71a3('0xc7')]['find']({'where':{'id':_0x531756[_0x71a3('0x87')]}});}})[_0x71a3('0x25')](function(_0x4c795d){if(_0x4c795d){_0x5d7fa4=_0x4c795d;return db[_0x71a3('0xee')][_0x71a3('0x6f')]({'where':{'id':_0x531756[_0x71a3('0x78')]}});}})[_0x71a3('0x25')](function(_0x167158){if(_0x167158){_0x121c1b=_0x167158;if(_0x4c57b8){var _0x46d79d=null;for(var _0x28abce=0x1;_0x28abce<_0x531756[_0x71a3('0xed')][_0x71a3('0x51')];++_0x28abce){_0x46d79d=_0x531756[_0x71a3('0xed')][_0x28abce];var _0x457d41=_0x46d79d[_0x71a3('0xd5')]?util[_0x71a3('0xe8')](_0x71a3('0xef'),_0x5d7fa4[_0x71a3('0xf0')],_0x46d79d[_0x71a3('0xd5')]):'System';var _0x3a3f78=_0x37df41[_0x71a3('0x83')][_0x71a3('0xf1')]||util['format'](_0x71a3('0xef'),'Visitor',_0x46d79d['ContactId']);switch(_0x5d7fa4['agentIdentifier']){case _0x71a3('0xf2'):_0x457d41=_0x46d79d[_0x71a3('0xd5')]?util[_0x71a3('0xe8')](_0x71a3('0xef'),_0x5d7fa4[_0x71a3('0xf0')],_0x46d79d[_0x71a3('0xd5')]):_0x71a3('0xf3');break;case _0x71a3('0xf4'):_0x457d41=_0x46d79d[_0x71a3('0xd5')]?_0x46d79d[_0x71a3('0x80')][_0x71a3('0xf5')]||_0x46d79d[_0x71a3('0x80')][_0x71a3('0x40')]:_0x71a3('0xf3');break;case _0x71a3('0xf6'):_0x457d41=_0x46d79d['UserId']?_0x46d79d[_0x71a3('0x80')][_0x71a3('0x40')]:_0x71a3('0xf3');break;default:_0x457d41=_0x46d79d[_0x71a3('0xd5')]?util['format'](_0x71a3('0xef'),_0x5d7fa4[_0x71a3('0xf0')],_0x46d79d[_0x71a3('0xd5')]):_0x71a3('0xf3');}var _0x3548f8=util['format'](_0x71a3('0xf7'),moment(_0x46d79d[_0x71a3('0x8a')])[_0x71a3('0xe8')](_0x71a3('0xf8')),_0x46d79d[_0x71a3('0xf9')]==='in'?_0x3a3f78:_0x457d41,_0x46d79d[_0x71a3('0x83')]);if(!_0x46d79d[_0x71a3('0xfa')]){fs['appendFileSync'](_0x4c57b8,_0x3548f8);}}return db[_0x71a3('0xfb')][_0x71a3('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x71a3('0xfc')],'as':_0x71a3('0xfd'),'raw':!![]}]});}}})[_0x71a3('0x25')](function(_0x411fa0){if(_0x411fa0&&_0x411fa0[_0x71a3('0xfd')]&&_0x37df41['body']){var _0x5b803b={'tls':{'rejectUnauthorized':![]}};if(_0x411fa0[_0x71a3('0xfd')][_0x71a3('0xfe')]){_0x5b803b[_0x71a3('0xfe')]=_0x411fa0[_0x71a3('0xfd')][_0x71a3('0xfe')];}else{_0x5b803b['host']=_0x411fa0['Smtp'][_0x71a3('0xff')];_0x5b803b[_0x71a3('0x100')]=_0x411fa0[_0x71a3('0xfd')][_0x71a3('0x100')];_0x5b803b['secure']=_0x411fa0[_0x71a3('0xfd')][_0x71a3('0x101')];}if(_0x411fa0[_0x71a3('0xfd')][_0x71a3('0x102')]){_0x5b803b['auth']={'user':_0x411fa0[_0x71a3('0xfd')]['user'],'pass':_0x411fa0['Smtp'][_0x71a3('0x103')]};}return respondWithRpcPromise(_0x71a3('0x104'),'sendMail',{'account':_0x5b803b,'message':{'from':util['format'](_0x71a3('0x105'),_0x411fa0['name'],_0x411fa0[_0x71a3('0x106')]||_0x411fa0[_0x71a3('0xfd')][_0x71a3('0xa7')]),'to':_0x37df41[_0x71a3('0x83')][_0x71a3('0x107')],'subject':_0x71a3('0x108'),'text':util[_0x71a3('0xe8')](_0x71a3('0x109'),_0x37df41[_0x71a3('0x83')][_0x71a3('0x107')]),'attachments':[{'path':_0x4c57b8}]}})['then'](function(){return _0x531756;})[_0x71a3('0x45')](function(_0x497a85){console[_0x71a3('0x2b')](_0x497a85);});}else{return _0x531756;}})[_0x71a3('0x25')](respondWithStatusCode(_0x2d685b,0xc8))[_0x71a3('0x45')](handleError(_0x2d685b,null));};exports['addMessage']=function(_0x1c6241,_0x44568f,_0x56b043){return db[_0x71a3('0xec')][_0x71a3('0x6f')]({'where':{'id':_0x1c6241[_0x71a3('0xc1')]['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x44568f,null))[_0x71a3('0x25')](function(_0x5553ff){if(_0x5553ff){return _0x5553ff[_0x71a3('0x10a')](_0x1c6241[_0x71a3('0x83')][_0x71a3('0x10b')],_['omit'](_0x1c6241[_0x71a3('0x83')],[_0x71a3('0x10b'),'id'])||{});}})[_0x71a3('0x25')](respondWithResult(_0x44568f,null))[_0x71a3('0x45')](handleError(_0x44568f,null));};exports['getMessages']=function(_0xf94586,_0x1102c4,_0xa2363e){var _0x27003b={'raw':![],'where':{}};var _0x300692={};var _0x118a8c={'count':0x0,'rows':[]};return db[_0x71a3('0xc2')][_0x71a3('0xc6')]({'where':{'id':_0xf94586['params']['id']}})['then'](handleEntityNotFound(_0x1102c4,null))['then'](function(_0x450006){if(_0x450006){_0x300692['model']=_[_0x71a3('0x4c')](db[_0x71a3('0xec')][_0x71a3('0x46')]);_0x300692['query']=_[_0x71a3('0x4c')](_0xf94586[_0x71a3('0x4b')]);_0x300692[_0x71a3('0x4d')]=_[_0x71a3('0x4e')](_0x300692[_0x71a3('0x4a')],_0x300692[_0x71a3('0x4b')]);_0x27003b[_0x71a3('0x4f')]=_['intersection'](_0x300692[_0x71a3('0x4a')],qs[_0x71a3('0x50')](_0xf94586['query'][_0x71a3('0x50')]));_0x27003b[_0x71a3('0x4f')]=_0x27003b[_0x71a3('0x4f')]['length']?_0x27003b['attributes']:_0x300692[_0x71a3('0x4a')];if(!_0xf94586[_0x71a3('0x4b')][_0x71a3('0x52')]('nolimit')){_0x27003b[_0x71a3('0x34')]=qs['limit'](_0xf94586[_0x71a3('0x4b')][_0x71a3('0x34')]);_0x27003b['offset']=qs[_0x71a3('0x33')](_0xf94586['query'][_0x71a3('0x33')]);}_0x27003b['order']=qs[_0x71a3('0x55')](_0xf94586['query'][_0x71a3('0x55')]);_0x27003b['where']=qs[_0x71a3('0x4d')](_[_0x71a3('0x57')](_0xf94586['query'],_0x300692[_0x71a3('0x4d')]));_0x27003b[_0x71a3('0x56')][_0x71a3('0xbf')]=_0x450006['id'];if(_0xf94586['query'][_0x71a3('0x10c')]){_0x27003b[_0x71a3('0x56')]=_[_0x71a3('0xab')](_0x27003b[_0x71a3('0x56')],{'$or':_[_0x71a3('0x3f')](_0x27003b['attributes'],function(_0x1e3cd1){var _0x179cbb={};_0x179cbb[_0x1e3cd1]={'$like':'%'+_0xf94586[_0x71a3('0x4b')][_0x71a3('0x10c')]+'%'};return _0x179cbb;})});}if(_0xf94586[_0x71a3('0x4b')]['$gte']){var _0x1a80e7=_0xf94586[_0x71a3('0x4b')][_0x71a3('0x8c')][_0x71a3('0x7d')](',');var _0x479761={};_0x479761[_0x1a80e7[0x0]]={'$gte':moment(_0x1a80e7[0x1])[_0x71a3('0xe8')](_0x71a3('0x10d'))};_0x27003b[_0x71a3('0x56')]=_[_0x71a3('0xab')](_0x27003b[_0x71a3('0x56')],_0x479761);}_0x27003b=_[_0x71a3('0xab')]({},_0x27003b,_0xf94586['options']);return db[_0x71a3('0xec')]['count']({'where':_0x27003b[_0x71a3('0x56')]})[_0x71a3('0x25')](function(_0x345140){_0x118a8c['count']=_0x345140;if(_0xf94586[_0x71a3('0x4b')][_0x71a3('0x10e')]){_0x27003b[_0x71a3('0xc3')]=[{'all':!![]}];}return db[_0x71a3('0xec')]['findAll'](_0x27003b);})[_0x71a3('0x25')](function(_0x14d927){_0x118a8c[_0x71a3('0x10f')]=_0x14d927;return _0x118a8c;});}})['then'](respondWithFilteredResult(_0x1102c4,_0x27003b))[_0x71a3('0x45')](handleError(_0x1102c4,null));};exports[_0x71a3('0x110')]=function(_0x3ba1f3,_0x5ba504,_0x252a4f){var _0xc097c7={'where':{}},_0x50b158={},_0x4568fc={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x71a3('0xc6')]({'where':{'id':_0x3ba1f3['params']['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x5ba504,null))[_0x71a3('0x25')](function(_0x31fb23){if(_0x31fb23){_0x50b158['model']=_[_0x71a3('0x4c')](db[_0x71a3('0xec')][_0x71a3('0x46')]);_0x50b158[_0x71a3('0x4b')]=_[_0x71a3('0x4c')](_0x3ba1f3['query']);_0x50b158['filters']=_['intersection'](_0x50b158[_0x71a3('0x4a')],_0x50b158[_0x71a3('0x4b')]);_0xc097c7['attributes']=_['intersection'](_0x50b158['model'],qs[_0x71a3('0x50')](_0x3ba1f3['query'][_0x71a3('0x50')]));_0xc097c7[_0x71a3('0x4f')]=_0xc097c7['attributes'][_0x71a3('0x51')]?_0xc097c7[_0x71a3('0x4f')]:_0x50b158['model'];if(!_0x3ba1f3['query']['hasOwnProperty'](_0x71a3('0x53'))){_0xc097c7[_0x71a3('0x34')]=qs['limit'](_0x3ba1f3[_0x71a3('0x4b')]['limit']);_0xc097c7[_0x71a3('0x33')]=qs[_0x71a3('0x33')](_0x3ba1f3['query'][_0x71a3('0x33')]);}_0xc097c7[_0x71a3('0x54')]=qs[_0x71a3('0x55')](_0x3ba1f3[_0x71a3('0x4b')][_0x71a3('0x55')]);_0xc097c7[_0x71a3('0x56')]=qs[_0x71a3('0x4d')](_['pick'](_0x3ba1f3[_0x71a3('0x4b')],_0x50b158['filters']));_0xc097c7[_0x71a3('0x56')]['ChatInteractionId']=_0x31fb23['id'];if(_0x3ba1f3[_0x71a3('0x4b')][_0x71a3('0x10c')]){_0xc097c7[_0x71a3('0x56')]=_[_0x71a3('0xab')](_0xc097c7[_0x71a3('0x56')],{'$or':_[_0x71a3('0x3f')](_0xc097c7[_0x71a3('0x4f')],function(_0x217d80){var _0xf45cb6={};_0xf45cb6[_0x217d80]={'$like':'%'+_0x3ba1f3[_0x71a3('0x4b')][_0x71a3('0x10c')]+'%'};return _0xf45cb6;})});}_0xc097c7[_0x71a3('0x56')][_0x71a3('0xfa')]=![];if(_0x3ba1f3[_0x71a3('0x4b')]['id']){_0xc097c7['where']['id']={'$gt':_0x3ba1f3[_0x71a3('0x4b')]['id']};}_0xc097c7=_[_0x71a3('0xab')]({},_0xc097c7,_0x3ba1f3[_0x71a3('0x111')]);return db[_0x71a3('0xec')]['count']({'where':_0xc097c7['where']})[_0x71a3('0x25')](function(_0x8e6793){_0x4568fc[_0x71a3('0x32')]=_0x8e6793;_0xc097c7[_0x71a3('0xc3')]=[];if(_0x3ba1f3['query'][_0x71a3('0x112')]){_0xc097c7[_0x71a3('0xc3')]['push']({'model':db[_0x71a3('0x80')],'as':'User','attributes':['id',_0x71a3('0x40'),_0x71a3('0xf5')]});}if(_0x3ba1f3[_0x71a3('0x4b')][_0x71a3('0x10e')]){_0xc097c7[_0x71a3('0xc3')]=[{'all':!![]}];}return db[_0x71a3('0xec')]['findAll'](_0xc097c7);})[_0x71a3('0x25')](function(_0xb00463){_0x4568fc[_0x71a3('0x10f')]=_0xb00463;return _0x4568fc;});}})[_0x71a3('0x25')](respondWithFilteredResult(_0x5ba504,_0xc097c7))[_0x71a3('0x45')](handleError(_0x5ba504,null));};exports[_0x71a3('0x113')]=function(_0x12c7a5,_0x339cfb,_0x488168){return db[_0x71a3('0xc2')][_0x71a3('0x6f')]({'where':{'id':_0x12c7a5[_0x71a3('0xc1')]['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x339cfb,null))[_0x71a3('0x25')](function(_0x3adba2){if(_0x3adba2){return _0x3adba2[_0x71a3('0x114')](_0x12c7a5[_0x71a3('0x83')][_0x71a3('0x10b')],_[_0x71a3('0x115')](_0x12c7a5[_0x71a3('0x83')],['ids','id'])||{})[_0x71a3('0x116')](function(){return db[_0x71a3('0x7c')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x12c7a5[_0x71a3('0x83')][_0x71a3('0x10b')]}});})[_0x71a3('0x25')](function(_0x178670){socket['emit'](_0x71a3('0x117'),{'id':Number(_0x12c7a5[_0x71a3('0xc1')]['id']),'tags':_0x178670||[]});return{'id':Number(_0x12c7a5[_0x71a3('0xc1')]['id']),'tags':_0x178670||[]};});}})[_0x71a3('0x25')](respondWithResult(_0x339cfb,null))[_0x71a3('0x45')](handleError(_0x339cfb,null));};exports[_0x71a3('0x118')]=function(_0x551ef0,_0x56fbe7,_0x1e6b09){return db[_0x71a3('0xc2')]['find']({'where':{'id':_0x551ef0[_0x71a3('0xc1')]['id']}})[_0x71a3('0x25')](handleEntityNotFound(_0x56fbe7,null))[_0x71a3('0x25')](function(_0x39750a){if(_0x39750a){return _0x39750a[_0x71a3('0x118')](_0x551ef0[_0x71a3('0x4b')][_0x71a3('0x10b')]);}})[_0x71a3('0x25')](respondWithStatusCode(_0x56fbe7,null))[_0x71a3('0x45')](handleError(_0x56fbe7,null));};exports['download']=function(_0xf6d780,_0x4468af){var _0x4d393b=moment()[_0x71a3('0x119')]()[_0x71a3('0xaa')]();var _0x259975=path[_0x71a3('0xe4')](config[_0x71a3('0xe5')],'server',_0x71a3('0x11a'),_0x71a3('0x11b'));var _0x2d2382=path[_0x71a3('0xe4')](config[_0x71a3('0xe5')],_0x71a3('0x11c'),_0x71a3('0x11a'),_0x71a3('0x11d'));var _0x78955e=path[_0x71a3('0xe4')](_0x259975,_0x4d393b);var _0x2688dc=util[_0x71a3('0xe8')]('transcript-%d-%s.zip',_0xf6d780['params']['id'],_0x4d393b);var _0x578a03=path[_0x71a3('0xe4')](_0x259975,_0x2688dc);var _0x572e02=[];_0x572e02[_0x71a3('0x44')]({'model':db[_0x71a3('0x80')],'as':_0x71a3('0x80'),'attributes':['id',_0x71a3('0x40')],'raw':!![]});_0x572e02[_0x71a3('0x44')]({'model':db[_0x71a3('0xee')],'as':_0x71a3('0x73'),'attributes':['id',_0x71a3('0x11e'),_0x71a3('0x11f')],'raw':!![]});if(_0xf6d780[_0x71a3('0x4b')][_0x71a3('0x11d')]){_0x572e02['push']({'model':db[_0x71a3('0xe0')],'as':_0x71a3('0xe0'),'raw':!![]});}var _0x2db7cf=[{'model':db[_0x71a3('0xec')],'as':_0x71a3('0xed'),'attributes':['id',_0x71a3('0x83'),_0x71a3('0x8a'),_0x71a3('0xf9'),_0x71a3('0xfa'),_0x71a3('0x92')],'include':_0x572e02}];_0x2db7cf['push']({'model':db[_0x71a3('0xc7')],'as':_0x71a3('0x120'),'attributes':['id','name']});_0x2db7cf[_0x71a3('0x44')]({'model':db[_0x71a3('0x80')],'as':_0x71a3('0x121'),'attributes':['id',_0x71a3('0x40')]});return db[_0x71a3('0xc2')][_0x71a3('0x6f')]({'where':{'id':_0xf6d780[_0x71a3('0xc1')]['id']},'include':_0x2db7cf})[_0x71a3('0x25')](handleEntityNotFound(_0x4468af,null))[_0x71a3('0x25')](function(_0x307f5f){if(_0x307f5f){var _0x7599d8=_0x307f5f[_0x71a3('0x122')]({'plain':!![]});fs[_0x71a3('0x123')](_0x78955e);var _0x1c4fe2={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x71a3('0x124')}},'footer':{'height':_0x71a3('0x125'),'contents':{'default':util[_0x71a3('0xe8')]('\x0a\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[_0x71a3('0xe8')](_0x71a3('0x126'),_0x71a3('0x127'),_0x7599d8['id']),moment()[_0x71a3('0xe8')](_0x71a3('0x128'))['toString']())}}};var _0x3ed9ef={'channel':_0x71a3('0x127'),'account':_0x7599d8['Account'][_0x71a3('0x3d')],'agent':_0x7599d8['Owner']?_0x7599d8[_0x71a3('0x121')][_0x71a3('0x40')]:_0x71a3('0x129'),'createdAt':moment(_0x7599d8[_0x71a3('0x8a')])[_0x71a3('0xe8')](_0x71a3('0x10d'))[_0x71a3('0xaa')](),'closedAt':_0x7599d8[_0x71a3('0xd7')]?moment(_0x7599d8[_0x71a3('0x12a')])[_0x71a3('0xe8')](_0x71a3('0x10d'))[_0x71a3('0xaa')]():'','disposition':_0x7599d8[_0x71a3('0xd8')],'chatInfo':{'browser':_0x7599d8[_0x71a3('0x12b')],'os':_0x7599d8[_0x71a3('0x12c')],'referer':_0x7599d8[_0x71a3('0x12d')],'customerIp':_0x7599d8[_0x71a3('0x12e')],'customerPort':_0x7599d8['customerPort']?_0x7599d8[_0x71a3('0x12f')]:'N.A.'},'messages':_(_0x7599d8['Messages'])[_0x71a3('0x130')]()[_0x71a3('0x10c')]({'secret':![]})[_0x71a3('0x3f')](function(_0x542fae){if(_0x542fae[_0x71a3('0xe0')]){var _0x4501bf=path[_0x71a3('0xe4')](_0x2d2382,_0x542fae['Attachment']['basename']);if(fs[_0x71a3('0x131')](_0x4501bf)){fs['createReadStream'](_0x4501bf)['pipe'](fs['createWriteStream'](path[_0x71a3('0xe4')](_0x78955e,_0x542fae['Attachment'][_0x71a3('0xde')])));}}return{'date':moment(_0x542fae[_0x71a3('0x8a')])[_0x71a3('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x71a3('0xaa')](),'sender':_0x542fae[_0x71a3('0xf9')]===_0x71a3('0xcf')?_0x542fae[_0x71a3('0x80')]?_0x542fae['User'][_0x71a3('0x40')]:_0x71a3('0xf3'):_0x542fae[_0x71a3('0x73')][_0x71a3('0x11e')]+(_0x542fae[_0x71a3('0x73')][_0x71a3('0x11f')]?'\x20'+_0x542fae[_0x71a3('0x73')][_0x71a3('0x11f')]:''),'body':_0x542fae[_0x71a3('0xe0')]?_0x542fae[_0x71a3('0xe0')][_0x71a3('0xde')]:_0x542fae[_0x71a3('0x83')],'direction':_0x542fae[_0x71a3('0xf9')]===_0x71a3('0xcf')?'A':'C','secret':_0x542fae[_0x71a3('0xfa')],'read':_0x542fae['read'],'attachment':_0x542fae[_0x71a3('0xe0')]};})['value']()};return ejs[_0x71a3('0x132')](path['join'](config[_0x71a3('0xe5')],_0x71a3('0x11c'),_0x71a3('0x133'),_0x71a3('0x134')),{'interaction':_0x3ed9ef})[_0x71a3('0x25')](function(_0xbcc05e){return new BPromise(function(_0x13163f,_0x1b557c){pdf[_0x71a3('0xc4')](_0xbcc05e,_0x1c4fe2)[_0x71a3('0x135')](path['join'](_0x78955e,_0x71a3('0x136')+_0x7599d8['id']+'-'+_0x4d393b+_0x71a3('0x137')),function(_0x1286a6,_0x127176){if(_0x1286a6)return _0x1b557c(_0x1286a6);_0x13163f(_0x127176);});});})['then'](function(){return new BPromise(function(_0x5382f2,_0xdf8f1a){zipdir(_0x78955e,{'saveTo':_0x578a03},function(_0x29154f,_0x4d4bff){if(_0x29154f)return _0xdf8f1a(_0x29154f);return _0x5382f2(_0x4d4bff);});})[_0x71a3('0x25')](function(){return new BPromise(function(_0x5d330e,_0x5c55e8){rimraf(_0x78955e,function(_0x5ec5a0){if(_0x5ec5a0)_0x5c55e8(_0x5ec5a0);return _0x5d330e();});});})[_0x71a3('0x25')](function(){return _0x4468af[_0x71a3('0xe3')](_0x578a03,_0x2688dc,function(_0x24e407){if(_0x24e407){console[_0x71a3('0x138')](_0x71a3('0x139'),_0x24e407);}else{fs[_0x71a3('0x13a')](_0x578a03);}});});});}else{return _0x4468af[_0x71a3('0x2e')](0xc8);}})['catch'](handleError(_0x4468af,null));}; \ No newline at end of file +var _0xfb11=['params','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','Unauthorized','Attachment','join','root','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','ChatInteractionId','$gte','getMyMessages','findAll','addTags','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Owner','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.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','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','field','color','from','select','u.id','ui.ChatInteractionId','user_has_chat_interactions','users','chat_interactions','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','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','type','body','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.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.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','rawAttributes','includeAll','include','options','create'];(function(_0x316fba,_0x2ddcb5){var _0x2ee42d=function(_0x582419){while(--_0x582419){_0x316fba['push'](_0x316fba['shift']());}};_0x2ee42d(++_0x2ddcb5);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xfb11[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0x1fb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1fb1('0x1'));var zipdir=require(_0x1fb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb1('0x3'));var moment=require('moment');var BPromise=require(_0x1fb1('0x4'));var Mustache=require('mustache');var util=require(_0x1fb1('0x5'));var path=require(_0x1fb1('0x6'));var sox=require('sox');var csv=require(_0x1fb1('0x7'));var ejs=require(_0x1fb1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0x7'));var querystring=require(_0x1fb1('0xd'));var Papa=require(_0x1fb1('0xe'));var Redis=require(_0x1fb1('0xf'));var authService=require(_0x1fb1('0x10'));var qs=require(_0x1fb1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x12'));var logger=require('../../config/logger')(_0x1fb1('0x13'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x14'));var db=require(_0x1fb1('0x15'))['db'];config[_0x1fb1('0x16')]=_[_0x1fb1('0x17')](config[_0x1fb1('0x16')],{'host':_0x1fb1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fb1('0x16')]));require(_0x1fb1('0x19'))[_0x1fb1('0x1a')](socket);var jayson=require(_0x1fb1('0x1b'));var client=jayson[_0x1fb1('0x1c')][_0x1fb1('0x1d')]({'port':0x232b});var client9004=jayson[_0x1fb1('0x1c')][_0x1fb1('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x358b58,_0x4cbe42,_0x5c8d23){if(_0x5c8d23){var _0x34045e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34045e[_0x1fb1('0x1e')](_0x4cbe42)){return _0x358b58;}else{throw new db[(_0x1fb1('0x1f'))]['ValidationError'](_0x1fb1('0x20'));}}else{return _0x358b58;}}function respondWithRpcPromise(_0x23f1f5,_0x24d4df,_0x34076b,_0x33c6b6){return new BPromise(function(_0x27d71f,_0x10df7b){var _0x373e3c=_0x33c6b6||client;return _0x373e3c[_0x1fb1('0x21')](_0x23f1f5,_0x34076b)['then'](function(_0xa6d7b8){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x24d4df,_0x1fb1('0x22'));logger[_0x1fb1('0x23')](_0x1fb1('0x24'),_0x24d4df,'request\x20sent',JSON[_0x1fb1('0x25')](_0xa6d7b8));if(_0xa6d7b8['error']){if(_0xa6d7b8['error']['code']===0x1f4){logger[_0x1fb1('0x26')](_0x1fb1('0x27'),_0x24d4df,_0xa6d7b8[_0x1fb1('0x26')][_0x1fb1('0x28')]);return _0x10df7b(_0xa6d7b8[_0x1fb1('0x26')]['message']);}logger[_0x1fb1('0x26')](_0x1fb1('0x27'),_0x24d4df,_0xa6d7b8[_0x1fb1('0x26')][_0x1fb1('0x28')]);return _0x27d71f(_0xa6d7b8[_0x1fb1('0x26')][_0x1fb1('0x28')]);}else{logger[_0x1fb1('0x29')](_0x1fb1('0x27'),_0x24d4df,'request\x20sent');_0x27d71f(_0xa6d7b8[_0x1fb1('0x2a')][_0x1fb1('0x28')]);}})[_0x1fb1('0x2b')](function(_0xc5188b){logger[_0x1fb1('0x26')](_0x1fb1('0x27'),_0x24d4df,_0xc5188b);_0x10df7b(_0xc5188b);});});}function respondWithStatusCode(_0x1a74c4,_0x15992c){_0x15992c=_0x15992c||0xcc;return function(_0xa7bba){if(_0xa7bba){return _0x1a74c4[_0x1fb1('0x2c')](_0x15992c);}return _0x1a74c4[_0x1fb1('0x2d')](_0x15992c)[_0x1fb1('0x2e')]();};}function respondWithResult(_0x39fc43,_0xe8ec0a){_0xe8ec0a=_0xe8ec0a||0xc8;return function(_0x2f6c88){if(_0x2f6c88){return _0x39fc43['status'](_0xe8ec0a)[_0x1fb1('0x2f')](_0x2f6c88);}};}function respondWithFilteredResult(_0x316f7c,_0x90d8ef){return function(_0x1b71cb){if(_0x1b71cb){var _0x5402e9=_0x1b71cb[_0x1fb1('0x30')],_0x245f84=_0x90d8ef['offset'],_0x30c8eb=_0x90d8ef['offset']+_0x90d8ef[_0x1fb1('0x31')],_0x5d45a5;if(_0x30c8eb>=_0x5402e9){_0x30c8eb=_0x5402e9;_0x5d45a5=0xc8;}else{_0x5d45a5=0xce;}_0x316f7c[_0x1fb1('0x2d')](_0x5d45a5);return _0x316f7c['set'](_0x1fb1('0x32'),_0x245f84+'-'+_0x30c8eb+'/'+_0x5402e9)[_0x1fb1('0x2f')](_0x1b71cb);}return null;};}function patchUpdates(_0x109bf9){return function(_0x2ebb82){try{jsonpatch[_0x1fb1('0x33')](_0x2ebb82,_0x109bf9,!![]);}catch(_0x4f6e45){return BPromise[_0x1fb1('0x34')](_0x4f6e45);}return _0x2ebb82[_0x1fb1('0x35')]();};}function saveUpdates(_0x9ad059,_0x300000){return function(_0x16fceb){if(_0x16fceb){return _0x16fceb[_0x1fb1('0x36')](_0x9ad059)[_0x1fb1('0x37')](function(_0x2a9a57){return _0x2a9a57;});}return null;};}function removeEntity(_0x72a80d,_0x4d49a4){return function(_0x2d74b9){if(_0x2d74b9){return _0x2d74b9['destroy']()[_0x1fb1('0x37')](function(){_0x72a80d['status'](0xcc)[_0x1fb1('0x2e')]();});}};}function handleEntityNotFound(_0x4f5020,_0x5dcce7){return function(_0x25ac36){if(!_0x25ac36){_0x4f5020[_0x1fb1('0x2c')](0x194);}return _0x25ac36;};}function handleError(_0x30df85,_0x4700b4){_0x4700b4=_0x4700b4||0x1f4;return function(_0x564ed9){logger[_0x1fb1('0x26')](_0x564ed9[_0x1fb1('0x38')]);if(_0x564ed9[_0x1fb1('0x39')]){delete _0x564ed9['name'];}_0x30df85[_0x1fb1('0x2d')](_0x4700b4)[_0x1fb1('0x3a')](_0x564ed9);};}function getInteractionUsers(_0x228235,_0x314381){return new BPromise(function(_0x2fe697,_0xccc5bf){try{if(_0x314381[_0x228235['id']]){_0x228235[_0x1fb1('0x3b')]=_['map'](_0x314381[_0x228235['id']],function(_0x3a8a63){return{'id':_0x3a8a63['id'],'fullname':_0x3a8a63[_0x1fb1('0x3c')]};});}}catch(_0x55d7ea){_0xccc5bf(_0x55d7ea);}_0x2fe697(_0x228235);});}function getInteractionTags(_0x473894,_0x51c83f){return new BPromise(function(_0x369146,_0x28e8ef){try{if(_0x473894[_0x1fb1('0x3d')]){_0x473894[_0x1fb1('0x3e')]=[];_0x473894[_0x1fb1('0x3d')][_0x1fb1('0x3f')](',')[_0x1fb1('0x40')](function(_0x582003){_0x473894[_0x1fb1('0x3e')][_0x1fb1('0x41')](_0x51c83f[_0x582003]);});}delete _0x473894[_0x1fb1('0x3d')];}catch(_0x291f7f){_0x28e8ef(_0x291f7f);}_0x369146(_0x473894);});}function updateChatInteraction(_0xafc9a7,_0x3b3ea7,_0x398c87){return new BPromise(function(_0x5184eb,_0x1fd5f8){return getInteractionUsers(_0xafc9a7,_0x398c87)[_0x1fb1('0x37')](function(_0x2ff635){return getInteractionTags(_0x2ff635,_0x3b3ea7);})[_0x1fb1('0x37')](function(_0x5a4bfd){_0x5184eb(_0x5a4bfd);})['catch'](function(_0xf6f17d){_0x1fd5f8(_0xf6f17d);});});}exports[_0x1fb1('0x42')]=function(_0x307faf,_0x3edc8a){var _0x66651e={},_0x116fe9={},_0x3db779={'count':0x0,'rows':[]};var _0x3795bd=_[_0x1fb1('0x43')](db[_0x1fb1('0x44')]['rawAttributes'],function(_0x44ccbe){return{'name':_0x44ccbe['fieldName'],'type':_0x44ccbe['type'][_0x1fb1('0x45')]};});_0x116fe9[_0x1fb1('0x46')]=_[_0x1fb1('0x43')](_0x3795bd,_0x1fb1('0x39'));_0x116fe9['query']=_['keys'](_0x307faf[_0x1fb1('0x47')]);_0x116fe9[_0x1fb1('0x48')]=_[_0x1fb1('0x49')](_0x116fe9[_0x1fb1('0x46')],_0x116fe9[_0x1fb1('0x47')]);_0x66651e[_0x1fb1('0x4a')]=_[_0x1fb1('0x49')](_0x116fe9[_0x1fb1('0x46')],qs[_0x1fb1('0x4b')](_0x307faf['query']['fields']));_0x66651e[_0x1fb1('0x4a')]=_0x66651e['attributes'][_0x1fb1('0x4c')]?_0x66651e[_0x1fb1('0x4a')]:_0x116fe9[_0x1fb1('0x46')];if(!_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x4d')](_0x1fb1('0x4e'))){_0x66651e['limit']=qs[_0x1fb1('0x31')](_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x31')]);_0x66651e['offset']=qs[_0x1fb1('0x4f')](_0x307faf['query'][_0x1fb1('0x4f')]);}_0x66651e[_0x1fb1('0x50')]=qs[_0x1fb1('0x51')](_0x307faf['query'][_0x1fb1('0x51')]);_0x66651e[_0x1fb1('0x52')]=qs['filters'](_[_0x1fb1('0x53')](_0x307faf[_0x1fb1('0x47')],_0x116fe9[_0x1fb1('0x48')]),_0x3795bd);var _0x5771d5=[];var _0x58a576=squel['select']()[_0x1fb1('0x54')]('id')[_0x1fb1('0x54')](_0x1fb1('0x39'))[_0x1fb1('0x54')](_0x1fb1('0x55'))[_0x1fb1('0x56')]('tools_tags');var _0x556529=squel[_0x1fb1('0x57')]()[_0x1fb1('0x54')](_0x1fb1('0x58'))[_0x1fb1('0x54')]('u.fullname')['field'](_0x1fb1('0x59'))['from'](_0x1fb1('0x5a'),'ui')['left_join'](_0x1fb1('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x12a42d=squel[_0x1fb1('0x57')]()[_0x1fb1('0x56')](_0x1fb1('0x5c'),'i')[_0x1fb1('0x5d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1fb1('0x5d')](_0x1fb1('0x5b'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x1fb1('0x5e'),'a',_0x1fb1('0x5f'))[_0x1fb1('0x5d')](_0x1fb1('0x60'),'me',_0x1fb1('0x61'))[_0x1fb1('0x5d')]('chat_interaction_has_tags','it',_0x1fb1('0x62'))[_0x1fb1('0x5d')](_0x1fb1('0x63'),'t',_0x1fb1('0x64'));var _0x12949f=squel[_0x1fb1('0x65')]();var _0x32899f=[];var _0x5527ef=squel[_0x1fb1('0x65')]();var _0x2557a9;if(_0x307faf[_0x1fb1('0x47')]['search']){_0x2557a9=as[_0x1fb1('0x66')](_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x67')]);var _0x5ecccb=_0x2557a9[_0x1fb1('0x68')];for(var _0x2b232b=0x0;_0x2b232b<_0x2557a9[_0x1fb1('0x69')][_0x1fb1('0x4c')];_0x2b232b++){var _0x2e949e=_0x2557a9[_0x1fb1('0x69')][_0x2b232b];var _0x58fb7a='i';var _0x59fe71=_[_0x1fb1('0x6a')](_0x3795bd,[_0x1fb1('0x39'),_0x2e949e[_0x1fb1('0x54')]]);if(!_0x59fe71){switch(_0x2e949e[_0x1fb1('0x54')]){case _0x1fb1('0x6b'):if(_0x2e949e[_0x1fb1('0x6c')]==0x1){_0x12a42d[_0x1fb1('0x6d')]('`'+_0x2e949e['field']+_0x1fb1('0x6e'));}else{_0x12a42d[_0x1fb1('0x6d')]('`'+_0x2e949e[_0x1fb1('0x54')]+_0x1fb1('0x6f'));}break;case _0x1fb1('0x70'):if(_0x2e949e[_0x1fb1('0x71')]==='$substring'){if(_0x2e949e[_0x1fb1('0x6c')][_0x1fb1('0x3f')]('\x20')[_0x1fb1('0x4c')]>0x1){_0x12949f[_0x5ecccb](_0x1fb1('0x72'),qs[_0x1fb1('0x73')](_0x2e949e['value']),null);}else{var _0x441fcb='%'+_0x2e949e[_0x1fb1('0x6c')]+'%';_0x12949f[_0x5ecccb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x441fcb,_0x441fcb,_0x441fcb);}}else{_0x59fe71=_[_0x1fb1('0x6a')](_0x3795bd,['name',_0x1fb1('0x74')]);_0x2e949e[_0x1fb1('0x54')]=_0x1fb1('0x74');_0x517397=as[_0x1fb1('0x75')](_0x58fb7a,_0x59fe71['type'],_0x2e949e);_0x12949f[_0x5ecccb](_0x517397[_0x1fb1('0x76')],_0x517397[_0x1fb1('0x6c')][_0x1fb1('0x77')],_0x517397[_0x1fb1('0x6c')]['end']);}break;case _0x1fb1('0x78'):var _0x4874aa=_0x2e949e[_0x1fb1('0x6c')][_0x1fb1('0x3f')](',')['map'](function(_0x3df5fa){return Number(_0x3df5fa);});_0x4874aa[_0x1fb1('0x40')](function(_0xfcb803){_0x5527ef['or'](_0x1fb1('0x79'),'%,'+_0xfcb803+',%');});_0x32899f=_[_0x1fb1('0x7a')](_0x32899f,_0x4874aa);break;case _0x1fb1('0x7b'):if(_0x2e949e[_0x1fb1('0x71')]==='$substring'){_0x12949f[_0x5ecccb](_0x1fb1('0x7c'),'%'+_0x2e949e[_0x1fb1('0x6c')]+'%',null);}else{_0x59fe71=_['find'](_0x3795bd,['name',_0x1fb1('0x7d')]);_0x2e949e[_0x1fb1('0x54')]=_0x1fb1('0x7d');_0x517397=as[_0x1fb1('0x75')](_0x58fb7a,_0x59fe71[_0x1fb1('0x7e')],_0x2e949e);_0x12949f[_0x5ecccb](_0x517397[_0x1fb1('0x76')],_0x517397[_0x1fb1('0x6c')]['start'],_0x517397[_0x1fb1('0x6c')][_0x1fb1('0x2e')]);}break;case _0x1fb1('0x7f'):_0x517397=as[_0x1fb1('0x75')]('me',null,_0x2e949e);_0x12949f[_0x5ecccb](_0x517397[_0x1fb1('0x76')],_0x517397[_0x1fb1('0x6c')][_0x1fb1('0x77')],_0x517397[_0x1fb1('0x6c')][_0x1fb1('0x2e')]);break;}}else{var _0x517397=as[_0x1fb1('0x75')](_0x58fb7a,_0x59fe71[_0x1fb1('0x7e')],_0x2e949e);_0x12949f[_0x5ecccb](_0x517397['text'],_0x517397[_0x1fb1('0x6c')][_0x1fb1('0x77')],_0x517397[_0x1fb1('0x6c')]['end']);}}}else{var _0x153ed5=_(_0x307faf[_0x1fb1('0x47')])[_0x1fb1('0x80')]()[_0x1fb1('0x43')](function(_0x362452){return _[_0x1fb1('0x81')](_0x3795bd,[_0x1fb1('0x39'),_0x362452])?_0x362452:undefined;})[_0x1fb1('0x82')]()[_0x1fb1('0x6c')]();if(!_[_0x1fb1('0x83')](_0x153ed5)){_0x153ed5[_0x1fb1('0x40')](function(_0x4421bd){if(_0x4421bd===_0x1fb1('0x84')){_0x12a42d[_0x1fb1('0x52')](_0x1fb1('0x85'),[][_0x1fb1('0x86')](_0x307faf[_0x1fb1('0x47')][_0x4421bd]));}else if(_0x4421bd===_0x1fb1('0x87')){var _0x18e041=JSON[_0x1fb1('0x88')](_0x307faf[_0x1fb1('0x47')][_0x4421bd])['$gte'];var _0x507b59=JSON[_0x1fb1('0x88')](_0x307faf['query'][_0x4421bd])[_0x1fb1('0x89')];_0x12a42d[_0x1fb1('0x52')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x18e041,_0x507b59);}else{if(_0x307faf['query'][_0x4421bd]==='null'){_0x12a42d['where']('i.'+_0x4421bd+_0x1fb1('0x8a'));}else{_0x12a42d[_0x1fb1('0x52')]('i.'+_0x4421bd+_0x1fb1('0x8b'),_0x307faf[_0x1fb1('0x47')][_0x4421bd]);}}});}if(_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x8c')]){if(_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x8c')]==0x1){_0x12a42d['having']('`unreadMessages`\x20=\x200');}else{_0x12a42d[_0x1fb1('0x6d')](_0x1fb1('0x8d'));}}if(_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x8e')]){_0x32899f=_[_0x1fb1('0x8f')](_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x8e')])?_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x8e')]:new Array(_0x307faf[_0x1fb1('0x47')]['tag']);_0x32899f[_0x1fb1('0x40')](function(_0x27dc3e){_0x5527ef['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x27dc3e+',%');});}if(_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x90')]){var _0x48e66f=_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x90')][_0x1fb1('0x91')]('\x5c','\x5c\x5c')[_0x1fb1('0x91')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x1fb1('0x92')](_0x48e66f)){_0x12949f['or'](_0x1fb1('0x93'),_0x48e66f+'%');}else{_0x12949f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1fb1('0x73')](_0x48e66f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x48e66f+'%');}}}_0x12a42d['where'](_0x12949f);_0x12a42d[_0x1fb1('0x94')](_0x1fb1('0x95'));var _0x9fc0ae={'type':db[_0x1fb1('0x1f')][_0x1fb1('0x96')][_0x1fb1('0x97')],'raw':!![]};var _0x56efbc=_0x12a42d[_0x1fb1('0x98')]();_0x56efbc[_0x1fb1('0x54')](_0x1fb1('0x95'));_0x56efbc[_0x1fb1('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1fb1('0x6b'));if(_0x66651e[_0x1fb1('0x50')]){_0x66651e['order']['forEach'](function(_0x7fa740){_0x12a42d[_0x1fb1('0x50')]('i.'+_0x7fa740[0x0],_0x7fa740[0x1]===_0x1fb1('0x99')?![]:!![]);});}if(!_[_0x1fb1('0x83')](_0x32899f)){_0x12a42d['having'](_0x5527ef);_0x56efbc[_0x1fb1('0x52')]('t.id\x20IN\x20?',_0x32899f);}BPromise['resolve']()['then'](function(){if(!_0x2557a9){if(_0x307faf['query'][_0x1fb1('0x84')]||_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x9a')])return;_0x56efbc[_0x1fb1('0x52')](_0x1fb1('0x9b'));_0x12a42d[_0x1fb1('0x52')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x307faf[_0x1fb1('0x9c')][_0x1fb1('0x9d')]({'attributes':['id'],'raw':!![]})[_0x1fb1('0x37')](function(_0xa704b7){if(_[_0x1fb1('0x83')](_0xa704b7)){_0x56efbc[_0x1fb1('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');_0x12a42d[_0x1fb1('0x52')](_0x1fb1('0x9e'));}else{_0x56efbc[_0x1fb1('0x52')](_0x1fb1('0x85'),_[_0x1fb1('0x43')](_0xa704b7,'id'));_0x12a42d['where'](_0x1fb1('0x85'),_[_0x1fb1('0x43')](_0xa704b7,'id'));}});})[_0x1fb1('0x37')](function(){db[_0x1fb1('0x9f')][_0x1fb1('0x47')](_0x56efbc[_0x1fb1('0xa0')](),_0x9fc0ae)['then'](function(_0x5087de){_0x3db779['count']=_0x5087de[_0x1fb1('0x4c')];if(_0x3db779['count']===0x0)return[];return db['sequelize'][_0x1fb1('0x47')](_0x58a576[_0x1fb1('0xa0')](),_0x9fc0ae)[_0x1fb1('0x37')](function(_0x283594){_0x5771d5=_[_0x1fb1('0xa1')](_0x283594,'id');_0x9fc0ae=_[_0x1fb1('0xa2')](_0x9fc0ae,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x307faf[_0x1fb1('0x47')][_0x1fb1('0x4b')]){_0x66651e[_0x1fb1('0x4a')][_0x1fb1('0x40')](function(_0x364f00){_0x12a42d[_0x1fb1('0x54')]('i.'+_0x364f00);});}else{_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xa3'),_0x1fb1('0x6b'));_0x12a42d['field'](_0x1fb1('0xa4'),_0x1fb1('0xa5'));_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xa6'),_0x1fb1('0xa7'));_0x12a42d['field'](_0x1fb1('0xa8'));_0x12a42d['field'](_0x1fb1('0xa9'),'Contact.firstName');_0x12a42d['field'](_0x1fb1('0xaa'),'Contact.lastName');_0x12a42d['field']('c.email',_0x1fb1('0xab'));_0x12a42d['field'](_0x1fb1('0xac'),_0x1fb1('0xad'));_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xae'),_0x1fb1('0xaf'));_0x12a42d['field'](_0x1fb1('0xb0'),_0x1fb1('0xb1'));_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xb2'),_0x1fb1('0xb3'));_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xb4'),_0x1fb1('0xb5'));_0x12a42d[_0x1fb1('0x54')](_0x1fb1('0xb6'),_0x1fb1('0x3d'));}if(_0x66651e[_0x1fb1('0x31')])_0x12a42d['limit'](_0x66651e['limit']);if(_0x66651e[_0x1fb1('0x4f')])_0x12a42d[_0x1fb1('0x4f')](_0x66651e[_0x1fb1('0x4f')]);return db[_0x1fb1('0x9f')]['query'](_0x12a42d[_0x1fb1('0xa0')](),_0x9fc0ae);})[_0x1fb1('0x37')](function(_0xa0bd9c){_0x556529[_0x1fb1('0x52')](_0x1fb1('0xb7'),_['map'](_0xa0bd9c,'id'));return db[_0x1fb1('0x9f')][_0x1fb1('0x47')](_0x556529[_0x1fb1('0xa0')](),_0x9fc0ae)[_0x1fb1('0x37')](function(_0x1cb1bd){var _0x49a091=_[_0x1fb1('0xb8')](_0x1cb1bd,'ChatInteractionId');var _0x187540=[];_0xa0bd9c['forEach'](function(_0xbd178a){_0x187540[_0x1fb1('0x41')](updateChatInteraction(_0xbd178a,_0x5771d5,_0x49a091));});return BPromise[_0x1fb1('0xb9')](_0x187540);});});})['then'](function(_0x3c8e90){_0x3db779[_0x1fb1('0xba')]=_0x3c8e90;return _0x3db779;})[_0x1fb1('0x37')](respondWithFilteredResult(_0x3edc8a,_0x66651e));})[_0x1fb1('0x2b')](handleError(_0x3edc8a,null));};exports[_0x1fb1('0xbb')]=function(_0x1d7462,_0x2188c6){var _0x614e0d={'raw':![],'where':{'id':_0x1d7462['params']['id']}},_0x508dda={};_0x508dda[_0x1fb1('0x46')]=_[_0x1fb1('0x80')](db['ChatInteraction'][_0x1fb1('0xbc')]);_0x508dda[_0x1fb1('0x47')]=_[_0x1fb1('0x80')](_0x1d7462[_0x1fb1('0x47')]);_0x508dda[_0x1fb1('0x48')]=_[_0x1fb1('0x49')](_0x508dda[_0x1fb1('0x46')],_0x508dda[_0x1fb1('0x47')]);_0x614e0d['attributes']=_['intersection'](_0x508dda['model'],qs[_0x1fb1('0x4b')](_0x1d7462[_0x1fb1('0x47')][_0x1fb1('0x4b')]));_0x614e0d[_0x1fb1('0x4a')]=_0x614e0d['attributes'][_0x1fb1('0x4c')]?_0x614e0d[_0x1fb1('0x4a')]:_0x508dda['model'];if(_0x1d7462[_0x1fb1('0x47')][_0x1fb1('0xbd')]){_0x614e0d[_0x1fb1('0xbe')]=[{'all':!![]}];}_0x614e0d=_[_0x1fb1('0xa2')]({},_0x614e0d,_0x1d7462[_0x1fb1('0xbf')]);return db[_0x1fb1('0x44')]['find'](_0x614e0d)['then'](handleEntityNotFound(_0x2188c6,null))[_0x1fb1('0x37')](respondWithResult(_0x2188c6,null))[_0x1fb1('0x2b')](handleError(_0x2188c6,null));};exports[_0x1fb1('0xc0')]=function(_0x55eb2a,_0x459398){return db[_0x1fb1('0x44')][_0x1fb1('0xc0')](_0x55eb2a['body'],{})[_0x1fb1('0x37')](respondWithResult(_0x459398,0xc9))[_0x1fb1('0x2b')](handleError(_0x459398,null));};exports['update']=function(_0x48518f,_0x1c57cd){if(_0x48518f[_0x1fb1('0x7f')]['id']){delete _0x48518f[_0x1fb1('0x7f')]['id'];}return db[_0x1fb1('0x44')]['find']({'where':{'id':_0x48518f[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x1c57cd,null))[_0x1fb1('0x37')](saveUpdates(_0x48518f['body'],null))[_0x1fb1('0x37')](respondWithResult(_0x1c57cd,null))[_0x1fb1('0x2b')](handleError(_0x1c57cd,null));};exports[_0x1fb1('0xc2')]=function(_0x1f3d3f,_0x352b3b){return db[_0x1fb1('0x44')][_0x1fb1('0x6a')]({'where':{'id':_0x1f3d3f[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x352b3b,null))[_0x1fb1('0x37')](removeEntity(_0x352b3b,null))[_0x1fb1('0x2b')](handleError(_0x352b3b,null));};exports[_0x1fb1('0xc3')]=function(_0x4ad4f7,_0x53bf95){return db[_0x1fb1('0x44')][_0x1fb1('0xc3')]()[_0x1fb1('0x37')](respondWithResult(_0x53bf95,null))[_0x1fb1('0x2b')](handleError(_0x53bf95,null));};exports[_0x1fb1('0xc4')]=function(_0x4bef5a,_0x472981){var _0x4e938a=_0x4bef5a[_0x1fb1('0xc1')]['id'];var _0x54e73b;var _0x4bf4ce;var _0x29e803;return db['ChatInteraction'][_0x1fb1('0xc5')]({'where':{'id':_0x4e938a}})[_0x1fb1('0x37')](function(_0x2f033d){_0x54e73b=_0x2f033d;return db[_0x1fb1('0xc6')][_0x1fb1('0xc5')]({'where':{'id':_0x2f033d[_0x1fb1('0x84')]},'attributes':['id',_0x1fb1('0xc7'),'vidaooEscalation'],'raw':!![]});})[_0x1fb1('0x37')](function(_0x3c78ec){if(_0x3c78ec&&_0x3c78ec[_0x1fb1('0xc7')]&&_0x3c78ec[_0x1fb1('0xc8')]){_0x4bf4ce=_0x3c78ec;var _0x53f65c={'rejectUnauthorized':![],'method':_0x1fb1('0xc9'),'uri':_0x1fb1('0xca'),'headers':{'X-APIKEY':_0x3c78ec[_0x1fb1('0xc7')]},'body':{'name':_0x1fb1('0xcb')+_0x4e938a},'redirect':'follow','json':!![]};return rp(_0x53f65c);}else{throw new db['Sequelize'][(_0x1fb1('0xcc'))](_0x1fb1('0xcd'));}})[_0x1fb1('0x37')](function(_0x5e4330){_0x29e803=_0x5e4330;if(_0x29e803['id']){var _0x8ede2c={'body':_0x29e803[_0x1fb1('0xce')],'ChatWebsiteId':_0x4bf4ce['id'],'ChatInteractionId':_0x54e73b['id'],'direction':_0x1fb1('0xcf'),'UserId':_0x4bef5a['user']['id']};return db[_0x1fb1('0xd0')][_0x1fb1('0xc0')](_0x8ede2c,{});}else{throw new db[(_0x1fb1('0x1f'))][(_0x1fb1('0xcc'))](_0x1fb1('0xd1'));}})[_0x1fb1('0x37')](function(){return _0x54e73b[_0x1fb1('0xd2')]({'vidaooSessionId':_0x29e803['id']});})[_0x1fb1('0x37')](respondWithResult(_0x472981,null))[_0x1fb1('0x2b')](handleError(_0x472981,null));};exports[_0x1fb1('0xd3')]=function(_0x56e7c6,_0x1e708a){if(_0x56e7c6[_0x1fb1('0x7f')]['id']){delete _0x56e7c6[_0x1fb1('0x7f')]['id'];}return db[_0x1fb1('0x44')][_0x1fb1('0x6a')]({'where':{'id':_0x56e7c6[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x1e708a,null))[_0x1fb1('0x37')](saveUpdates(_0x56e7c6['body'],null))[_0x1fb1('0x37')](respondWithResult(_0x1e708a,null))['catch'](handleError(_0x1e708a,null));};exports[_0x1fb1('0xd4')]=function(_0x141d6a,_0x5a1336,_0x430a9b){if(_0x141d6a[_0x1fb1('0x7f')]['id']){delete _0x141d6a[_0x1fb1('0x7f')]['id'];}return db['ChatInteraction'][_0x1fb1('0x6a')]({'where':{'id':_0x141d6a[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](function(_0x37c74c){if(!_0x37c74c){logger[_0x1fb1('0x26')](_0x1fb1('0xd5'),'abandon',0x194,_0x1fb1('0xd6'));_0x5a1336[_0x1fb1('0x2c')](0x194);}else{if(_0x37c74c[_0x1fb1('0x7d')]){throw new db[(_0x1fb1('0x1f'))]['ValidationError'](_0x1fb1('0xd7'));}}return _0x37c74c;})[_0x1fb1('0x37')](function(_0x3c2c34){if(_0x3c2c34){return _0x3c2c34[_0x1fb1('0x36')]({'closed':_0x141d6a[_0x1fb1('0x7f')]['closed'],'disposition':_0x141d6a[_0x1fb1('0x7f')][_0x1fb1('0xd8')]})[_0x1fb1('0x37')](function(_0x513605){return _0x513605;});}})['then'](function(_0xaf73e6){return respondWithRpcPromise(_0x1fb1('0xd9'),_0x1fb1('0xd4'),_0x141d6a['body'],client9004);})['then'](respondWithResult(_0x5a1336,null))['catch'](handleError(_0x5a1336,null));};exports[_0x1fb1('0xda')]=function(_0x59b234,_0x3411e9,_0x531876){_0x59b234[_0x1fb1('0x7f')][_0x1fb1('0x39')]=_0x59b234['file'][_0x1fb1('0xdb')];_0x59b234['body'][_0x1fb1('0xdc')]=_0x59b234[_0x1fb1('0xdd')][_0x1fb1('0xde')];_0x59b234[_0x1fb1('0x7f')][_0x1fb1('0x7e')]=_0x59b234[_0x1fb1('0xdd')][_0x1fb1('0xdf')];return db['Attachment'][_0x1fb1('0xc0')](_0x59b234[_0x1fb1('0x7f')])[_0x1fb1('0x37')](respondWithResult(_0x3411e9,0xc9))[_0x1fb1('0x2b')](handleError(_0x3411e9,null));};exports[_0x1fb1('0xe0')]=function(_0x1defa8,_0x18cfcc,_0x196c46){return db['ChatInteraction'][_0x1fb1('0xc5')]({'where':{'id':_0x1defa8['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x18cfcc,null))[_0x1fb1('0x37')](function(_0x13cdb3){if(_0x13cdb3){if(_0x13cdb3['closed']){return _0x18cfcc[_0x1fb1('0x2d')](0x193)[_0x1fb1('0x2f')]({'status':0x193,'message':_0x1fb1('0xe1')});}return db[_0x1fb1('0xe2')][_0x1fb1('0xc5')]({'where':{'id':_0x1defa8[_0x1fb1('0x47')]['attachId']},'raw':!![]})[_0x1fb1('0x37')](handleEntityNotFound(_0x18cfcc,null));}})['then'](function(_0x1b5483){if(_0x1b5483){return _0x18cfcc['download'](path['join'](config['root'],'server/files/attachments/',_0x1b5483[_0x1fb1('0xdc')]));}})['catch'](handleError(_0x18cfcc,null));};exports['close']=function(_0x2a8248,_0x2dd33e){var _0x4d5517=null;var _0x3446b5=null;var _0x5796cd=null;var _0x19d0a4=null;if(_0x2a8248[_0x1fb1('0x7f')]['id']){delete _0x2a8248[_0x1fb1('0x7f')]['id'];}if(_0x2a8248['body']['mailTranscript']){_0x19d0a4=path[_0x1fb1('0xe3')](config[_0x1fb1('0xe4')],_0x1fb1('0xe5'),util[_0x1fb1('0xe6')]('transcript-%s.txt',Date[_0x1fb1('0xe7')]()));_0x2a8248['body']['pathTranscript']=_0x19d0a4;}return db[_0x1fb1('0x44')]['find']({'where':{'id':_0x2a8248[_0x1fb1('0xc1')]['id']},'include':[{'model':db[_0x1fb1('0xd0')],'as':_0x1fb1('0xe8'),'include':[{'model':db[_0x1fb1('0x7b')],'as':_0x1fb1('0x7b')}]}]})[_0x1fb1('0x37')](handleEntityNotFound(_0x2dd33e,null))['then'](saveUpdates(_0x2a8248['body'],null))['then'](function(_0x55589e){if(_0x55589e){_0x4d5517=_0x55589e;return db[_0x1fb1('0xc6')][_0x1fb1('0x6a')]({'where':{'id':_0x4d5517[_0x1fb1('0x84')]}});}})[_0x1fb1('0x37')](function(_0x545683){if(_0x545683){_0x5796cd=_0x545683;return db['CmContact'][_0x1fb1('0x6a')]({'where':{'id':_0x4d5517['ContactId']}});}})['then'](function(_0x268be3){if(_0x268be3){_0x3446b5=_0x268be3;if(_0x19d0a4){var _0xe11119=null;for(var _0x4216eb=0x1;_0x4216eb<_0x4d5517['Messages'][_0x1fb1('0x4c')];++_0x4216eb){_0xe11119=_0x4d5517[_0x1fb1('0xe8')][_0x4216eb];var _0x5b13c0=_0xe11119[_0x1fb1('0x7d')]?util[_0x1fb1('0xe6')](_0x1fb1('0xe9'),_0x5796cd[_0x1fb1('0xea')],_0xe11119[_0x1fb1('0x7d')]):_0x1fb1('0xeb');var _0x203e08=_0x2a8248['body'][_0x1fb1('0xec')]||util[_0x1fb1('0xe6')](_0x1fb1('0xe9'),_0x1fb1('0xed'),_0xe11119['ContactId']);switch(_0x5796cd[_0x1fb1('0xee')]){case _0x1fb1('0xef'):_0x5b13c0=_0xe11119['UserId']?util[_0x1fb1('0xe6')](_0x1fb1('0xe9'),_0x5796cd[_0x1fb1('0xea')],_0xe11119[_0x1fb1('0x7d')]):'System';break;case'agent_alias':_0x5b13c0=_0xe11119[_0x1fb1('0x7d')]?_0xe11119[_0x1fb1('0x7b')][_0x1fb1('0xf0')]||_0xe11119['User']['fullname']:_0x1fb1('0xeb');break;case'agent_fullname':_0x5b13c0=_0xe11119[_0x1fb1('0x7d')]?_0xe11119['User'][_0x1fb1('0x3c')]:_0x1fb1('0xeb');break;default:_0x5b13c0=_0xe11119[_0x1fb1('0x7d')]?util[_0x1fb1('0xe6')]('%s%d',_0x5796cd[_0x1fb1('0xea')],_0xe11119[_0x1fb1('0x7d')]):_0x1fb1('0xeb');}var _0xd747b3=util[_0x1fb1('0xe6')](_0x1fb1('0xf1'),moment(_0xe11119[_0x1fb1('0x87')])[_0x1fb1('0xe6')](_0x1fb1('0xf2')),_0xe11119[_0x1fb1('0xf3')]==='in'?_0x203e08:_0x5b13c0,_0xe11119[_0x1fb1('0x7f')]);if(!_0xe11119[_0x1fb1('0xf4')]){fs[_0x1fb1('0xf5')](_0x19d0a4,_0xd747b3);}}return db[_0x1fb1('0xf6')][_0x1fb1('0xc5')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1fb1('0xf7'),'raw':!![]}]});}}})[_0x1fb1('0x37')](function(_0x4e3692){if(_0x4e3692&&_0x4e3692['Smtp']&&_0x2a8248[_0x1fb1('0x7f')]){var _0x5dc9a2={'tls':{'rejectUnauthorized':![]}};if(_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0xf8')]){_0x5dc9a2[_0x1fb1('0xf8')]=_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0xf8')];}else{_0x5dc9a2['host']=_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0xf9')];_0x5dc9a2[_0x1fb1('0xfa')]=_0x4e3692[_0x1fb1('0xf7')]['port'];_0x5dc9a2[_0x1fb1('0xfb')]=_0x4e3692[_0x1fb1('0xf7')]['secure'];}if(_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0xfc')]){_0x5dc9a2[_0x1fb1('0xfd')]={'user':_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0x9c')],'pass':_0x4e3692['Smtp'][_0x1fb1('0xfe')]};}return respondWithRpcPromise(_0x1fb1('0xff'),_0x1fb1('0x100'),{'account':_0x5dc9a2,'message':{'from':util[_0x1fb1('0xe6')]('\x22%s\x22\x20<%s>',_0x4e3692[_0x1fb1('0x39')],_0x4e3692['email']||_0x4e3692[_0x1fb1('0xf7')][_0x1fb1('0x9c')]),'to':_0x2a8248['body'][_0x1fb1('0x101')],'subject':_0x1fb1('0x102'),'text':util[_0x1fb1('0xe6')](_0x1fb1('0x103'),_0x2a8248['body'][_0x1fb1('0x101')]),'attachments':[{'path':_0x19d0a4}]}})['then'](function(){return _0x4d5517;})[_0x1fb1('0x2b')](function(_0x5bb3ab){console[_0x1fb1('0x26')](_0x5bb3ab);});}else{return _0x4d5517;}})[_0x1fb1('0x37')](respondWithStatusCode(_0x2dd33e,0xc8))[_0x1fb1('0x2b')](handleError(_0x2dd33e,null));};exports['addMessage']=function(_0x51c156,_0x11e31c,_0x118cc4){return db[_0x1fb1('0xd0')][_0x1fb1('0x6a')]({'where':{'id':_0x51c156[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x11e31c,null))[_0x1fb1('0x37')](function(_0x5c535d){if(_0x5c535d){return _0x5c535d[_0x1fb1('0x104')](_0x51c156[_0x1fb1('0x7f')]['ids'],_[_0x1fb1('0x105')](_0x51c156['body'],[_0x1fb1('0x106'),'id'])||{});}})[_0x1fb1('0x37')](respondWithResult(_0x11e31c,null))[_0x1fb1('0x2b')](handleError(_0x11e31c,null));};exports[_0x1fb1('0x107')]=function(_0xfc8c80,_0x2458e5,_0x18c651){var _0xfb9e43={'raw':![],'where':{}};var _0x24b9bc={};var _0x3fa5c1={'count':0x0,'rows':[]};return db[_0x1fb1('0x44')]['findOne']({'where':{'id':_0xfc8c80[_0x1fb1('0xc1')]['id']}})['then'](handleEntityNotFound(_0x2458e5,null))[_0x1fb1('0x37')](function(_0x1208ae){if(_0x1208ae){_0x24b9bc[_0x1fb1('0x46')]=_[_0x1fb1('0x80')](db[_0x1fb1('0xd0')][_0x1fb1('0xbc')]);_0x24b9bc['query']=_[_0x1fb1('0x80')](_0xfc8c80['query']);_0x24b9bc[_0x1fb1('0x48')]=_[_0x1fb1('0x49')](_0x24b9bc[_0x1fb1('0x46')],_0x24b9bc['query']);_0xfb9e43[_0x1fb1('0x4a')]=_[_0x1fb1('0x49')](_0x24b9bc[_0x1fb1('0x46')],qs[_0x1fb1('0x4b')](_0xfc8c80[_0x1fb1('0x47')]['fields']));_0xfb9e43[_0x1fb1('0x4a')]=_0xfb9e43[_0x1fb1('0x4a')]['length']?_0xfb9e43[_0x1fb1('0x4a')]:_0x24b9bc['model'];if(!_0xfc8c80['query'][_0x1fb1('0x4d')](_0x1fb1('0x4e'))){_0xfb9e43[_0x1fb1('0x31')]=qs[_0x1fb1('0x31')](_0xfc8c80[_0x1fb1('0x47')]['limit']);_0xfb9e43[_0x1fb1('0x4f')]=qs['offset'](_0xfc8c80['query'][_0x1fb1('0x4f')]);}_0xfb9e43[_0x1fb1('0x50')]=qs[_0x1fb1('0x51')](_0xfc8c80[_0x1fb1('0x47')][_0x1fb1('0x51')]);_0xfb9e43[_0x1fb1('0x52')]=qs[_0x1fb1('0x48')](_['pick'](_0xfc8c80[_0x1fb1('0x47')],_0x24b9bc['filters']));_0xfb9e43[_0x1fb1('0x52')][_0x1fb1('0x108')]=_0x1208ae['id'];if(_0xfc8c80['query'][_0x1fb1('0x90')]){_0xfb9e43['where']=_[_0x1fb1('0xa2')](_0xfb9e43[_0x1fb1('0x52')],{'$or':_[_0x1fb1('0x43')](_0xfb9e43[_0x1fb1('0x4a')],function(_0x30355f){var _0x420302={};_0x420302[_0x30355f]={'$like':'%'+_0xfc8c80[_0x1fb1('0x47')][_0x1fb1('0x90')]+'%'};return _0x420302;})});}if(_0xfc8c80['query'][_0x1fb1('0x109')]){var _0x1e9124=_0xfc8c80[_0x1fb1('0x47')][_0x1fb1('0x109')][_0x1fb1('0x3f')](',');var _0x417ebd={};_0x417ebd[_0x1e9124[0x0]]={'$gte':moment(_0x1e9124[0x1])[_0x1fb1('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')};_0xfb9e43['where']=_[_0x1fb1('0xa2')](_0xfb9e43[_0x1fb1('0x52')],_0x417ebd);}_0xfb9e43=_['merge']({},_0xfb9e43,_0xfc8c80[_0x1fb1('0xbf')]);return db[_0x1fb1('0xd0')][_0x1fb1('0x30')]({'where':_0xfb9e43[_0x1fb1('0x52')]})['then'](function(_0x36c38e){_0x3fa5c1[_0x1fb1('0x30')]=_0x36c38e;if(_0xfc8c80[_0x1fb1('0x47')][_0x1fb1('0xbd')]){_0xfb9e43[_0x1fb1('0xbe')]=[{'all':!![]}];}return db[_0x1fb1('0xd0')]['findAll'](_0xfb9e43);})[_0x1fb1('0x37')](function(_0x20a98c){_0x3fa5c1[_0x1fb1('0xba')]=_0x20a98c;return _0x3fa5c1;});}})[_0x1fb1('0x37')](respondWithFilteredResult(_0x2458e5,_0xfb9e43))[_0x1fb1('0x2b')](handleError(_0x2458e5,null));};exports[_0x1fb1('0x10a')]=function(_0x590533,_0x2f9692,_0x5908fe){var _0x577c82={'where':{}},_0x67d59b={},_0x2b7185={'count':0x0,'rows':[]};return db[_0x1fb1('0x44')][_0x1fb1('0xc5')]({'where':{'id':_0x590533['params']['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x2f9692,null))[_0x1fb1('0x37')](function(_0x81ac06){if(_0x81ac06){_0x67d59b[_0x1fb1('0x46')]=_[_0x1fb1('0x80')](db[_0x1fb1('0xd0')][_0x1fb1('0xbc')]);_0x67d59b[_0x1fb1('0x47')]=_[_0x1fb1('0x80')](_0x590533[_0x1fb1('0x47')]);_0x67d59b[_0x1fb1('0x48')]=_['intersection'](_0x67d59b[_0x1fb1('0x46')],_0x67d59b[_0x1fb1('0x47')]);_0x577c82[_0x1fb1('0x4a')]=_[_0x1fb1('0x49')](_0x67d59b[_0x1fb1('0x46')],qs[_0x1fb1('0x4b')](_0x590533[_0x1fb1('0x47')][_0x1fb1('0x4b')]));_0x577c82[_0x1fb1('0x4a')]=_0x577c82[_0x1fb1('0x4a')]['length']?_0x577c82[_0x1fb1('0x4a')]:_0x67d59b['model'];if(!_0x590533[_0x1fb1('0x47')]['hasOwnProperty']('nolimit')){_0x577c82[_0x1fb1('0x31')]=qs[_0x1fb1('0x31')](_0x590533['query'][_0x1fb1('0x31')]);_0x577c82['offset']=qs[_0x1fb1('0x4f')](_0x590533[_0x1fb1('0x47')][_0x1fb1('0x4f')]);}_0x577c82[_0x1fb1('0x50')]=qs[_0x1fb1('0x51')](_0x590533[_0x1fb1('0x47')]['sort']);_0x577c82['where']=qs[_0x1fb1('0x48')](_['pick'](_0x590533[_0x1fb1('0x47')],_0x67d59b[_0x1fb1('0x48')]));_0x577c82[_0x1fb1('0x52')]['ChatInteractionId']=_0x81ac06['id'];if(_0x590533[_0x1fb1('0x47')][_0x1fb1('0x90')]){_0x577c82['where']=_['merge'](_0x577c82[_0x1fb1('0x52')],{'$or':_['map'](_0x577c82[_0x1fb1('0x4a')],function(_0x1f4d0a){var _0x162ec6={};_0x162ec6[_0x1f4d0a]={'$like':'%'+_0x590533[_0x1fb1('0x47')][_0x1fb1('0x90')]+'%'};return _0x162ec6;})});}_0x577c82['where']['secret']=![];if(_0x590533[_0x1fb1('0x47')]['id']){_0x577c82[_0x1fb1('0x52')]['id']={'$gt':_0x590533[_0x1fb1('0x47')]['id']};}_0x577c82=_[_0x1fb1('0xa2')]({},_0x577c82,_0x590533[_0x1fb1('0xbf')]);return db[_0x1fb1('0xd0')]['count']({'where':_0x577c82[_0x1fb1('0x52')]})[_0x1fb1('0x37')](function(_0x37bddc){_0x2b7185[_0x1fb1('0x30')]=_0x37bddc;_0x577c82[_0x1fb1('0xbe')]=[];if(_0x590533[_0x1fb1('0x47')]['includeAgent']){_0x577c82[_0x1fb1('0xbe')]['push']({'model':db[_0x1fb1('0x7b')],'as':_0x1fb1('0x7b'),'attributes':['id',_0x1fb1('0x3c'),_0x1fb1('0xf0')]});}if(_0x590533[_0x1fb1('0x47')][_0x1fb1('0xbd')]){_0x577c82['include']=[{'all':!![]}];}return db['ChatMessage'][_0x1fb1('0x10b')](_0x577c82);})[_0x1fb1('0x37')](function(_0x57ca8d){_0x2b7185['rows']=_0x57ca8d;return _0x2b7185;});}})[_0x1fb1('0x37')](respondWithFilteredResult(_0x2f9692,_0x577c82))['catch'](handleError(_0x2f9692,null));};exports[_0x1fb1('0x10c')]=function(_0x1c6272,_0x414fbb,_0x5b70f2){return db['ChatInteraction'][_0x1fb1('0x6a')]({'where':{'id':_0x1c6272[_0x1fb1('0xc1')]['id']}})['then'](handleEntityNotFound(_0x414fbb,null))[_0x1fb1('0x37')](function(_0x421bb2){if(_0x421bb2){return _0x421bb2['setTags'](_0x1c6272[_0x1fb1('0x7f')]['ids'],_[_0x1fb1('0x105')](_0x1c6272[_0x1fb1('0x7f')],[_0x1fb1('0x106'),'id'])||{})[_0x1fb1('0x10d')](function(){return db[_0x1fb1('0x78')][_0x1fb1('0x10b')]({'attributes':['id',_0x1fb1('0x39'),'color'],'where':{'id':_0x1c6272[_0x1fb1('0x7f')][_0x1fb1('0x106')]}});})[_0x1fb1('0x37')](function(_0x323648){socket[_0x1fb1('0x10e')](_0x1fb1('0x10f'),{'id':Number(_0x1c6272[_0x1fb1('0xc1')]['id']),'tags':_0x323648||[]});return{'id':Number(_0x1c6272[_0x1fb1('0xc1')]['id']),'tags':_0x323648||[]};});}})[_0x1fb1('0x37')](respondWithResult(_0x414fbb,null))[_0x1fb1('0x2b')](handleError(_0x414fbb,null));};exports[_0x1fb1('0x110')]=function(_0xd775ce,_0x5209ba,_0x52dcfd){return db[_0x1fb1('0x44')][_0x1fb1('0x6a')]({'where':{'id':_0xd775ce[_0x1fb1('0xc1')]['id']}})[_0x1fb1('0x37')](handleEntityNotFound(_0x5209ba,null))[_0x1fb1('0x37')](function(_0xabc53b){if(_0xabc53b){return _0xabc53b[_0x1fb1('0x110')](_0xd775ce[_0x1fb1('0x47')]['ids']);}})[_0x1fb1('0x37')](respondWithStatusCode(_0x5209ba,null))[_0x1fb1('0x2b')](handleError(_0x5209ba,null));};exports[_0x1fb1('0x111')]=function(_0x2817b4,_0x26021c){var _0xb802a3=moment()[_0x1fb1('0x112')]()[_0x1fb1('0xa0')]();var _0x520d0b=path[_0x1fb1('0xe3')](config[_0x1fb1('0xe4')],_0x1fb1('0x113'),_0x1fb1('0x114'),_0x1fb1('0x115'));var _0x55d65f=path[_0x1fb1('0xe3')](config[_0x1fb1('0xe4')],_0x1fb1('0x113'),_0x1fb1('0x114'),_0x1fb1('0x116'));var _0x5bc8a5=path['join'](_0x520d0b,_0xb802a3);var _0x13aa8d=util[_0x1fb1('0xe6')](_0x1fb1('0x117'),_0x2817b4[_0x1fb1('0xc1')]['id'],_0xb802a3);var _0x42e069=path[_0x1fb1('0xe3')](_0x520d0b,_0x13aa8d);var _0x533227=[];_0x533227[_0x1fb1('0x41')]({'model':db['User'],'as':_0x1fb1('0x7b'),'attributes':['id',_0x1fb1('0x3c')],'raw':!![]});_0x533227['push']({'model':db[_0x1fb1('0x118')],'as':_0x1fb1('0x70'),'attributes':['id',_0x1fb1('0x119'),'lastName'],'raw':!![]});if(_0x2817b4[_0x1fb1('0x47')][_0x1fb1('0x116')]){_0x533227[_0x1fb1('0x41')]({'model':db['Attachment'],'as':_0x1fb1('0xe2'),'raw':!![]});}var _0x5e3ee6=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x1fb1('0x7f'),_0x1fb1('0x87'),_0x1fb1('0xf3'),'secret',_0x1fb1('0x8c')],'include':_0x533227}];_0x5e3ee6[_0x1fb1('0x41')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x1fb1('0x39')]});_0x5e3ee6[_0x1fb1('0x41')]({'model':db[_0x1fb1('0x7b')],'as':_0x1fb1('0x11a'),'attributes':['id','fullname']});return db[_0x1fb1('0x44')][_0x1fb1('0x6a')]({'where':{'id':_0x2817b4[_0x1fb1('0xc1')]['id']},'include':_0x5e3ee6})[_0x1fb1('0x37')](handleEntityNotFound(_0x26021c,null))[_0x1fb1('0x37')](function(_0x16e511){if(_0x16e511){var _0x289d13=_0x16e511['get']({'plain':!![]});fs['mkdirSync'](_0x5bc8a5);var _0x275a80={'format':'A4','border':_0x1fb1('0x11b'),'header':{'height':'40px','contents':{'first':_0x1fb1('0x11c')}},'footer':{'height':_0x1fb1('0x11d'),'contents':{'default':util[_0x1fb1('0xe6')]('\x0a\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[_0x1fb1('0xe6')](_0x1fb1('0x11e'),_0x1fb1('0x11f'),_0x289d13['id']),moment()['format'](_0x1fb1('0x120'))[_0x1fb1('0xa0')]())}}};var _0x16a016={'channel':_0x1fb1('0x11f'),'account':_0x289d13[_0x1fb1('0x121')][_0x1fb1('0x39')],'agent':_0x289d13['Owner']?_0x289d13[_0x1fb1('0x11a')][_0x1fb1('0x3c')]:_0x1fb1('0x122'),'createdAt':moment(_0x289d13[_0x1fb1('0x87')])[_0x1fb1('0xe6')](_0x1fb1('0x123'))['toString'](),'closedAt':_0x289d13[_0x1fb1('0x124')]?moment(_0x289d13[_0x1fb1('0x125')])[_0x1fb1('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1fb1('0xa0')]():'','disposition':_0x289d13[_0x1fb1('0xd8')],'chatInfo':{'browser':_0x289d13[_0x1fb1('0x126')],'os':_0x289d13[_0x1fb1('0x127')],'referer':_0x289d13[_0x1fb1('0x128')],'customerIp':_0x289d13[_0x1fb1('0x129')],'customerPort':_0x289d13['customerPort']?_0x289d13[_0x1fb1('0x12a')]:_0x1fb1('0x122')},'messages':_(_0x289d13[_0x1fb1('0xe8')])[_0x1fb1('0x12b')]()[_0x1fb1('0x90')]({'secret':![]})['map'](function(_0x819b0a){if(_0x819b0a[_0x1fb1('0xe2')]){var _0x4c4d91=path[_0x1fb1('0xe3')](_0x55d65f,_0x819b0a[_0x1fb1('0xe2')][_0x1fb1('0xdc')]);if(fs[_0x1fb1('0x12c')](_0x4c4d91)){fs[_0x1fb1('0x12d')](_0x4c4d91)['pipe'](fs[_0x1fb1('0x12e')](path[_0x1fb1('0xe3')](_0x5bc8a5,_0x819b0a['Attachment'][_0x1fb1('0xdc')])));}}return{'date':moment(_0x819b0a[_0x1fb1('0x87')])['format'](_0x1fb1('0x123'))[_0x1fb1('0xa0')](),'sender':_0x819b0a[_0x1fb1('0xf3')]===_0x1fb1('0xcf')?_0x819b0a[_0x1fb1('0x7b')]?_0x819b0a[_0x1fb1('0x7b')]['fullname']:'System':_0x819b0a['Contact'][_0x1fb1('0x119')]+(_0x819b0a[_0x1fb1('0x70')][_0x1fb1('0x12f')]?'\x20'+_0x819b0a['Contact'][_0x1fb1('0x12f')]:''),'body':_0x819b0a[_0x1fb1('0xe2')]?_0x819b0a['Attachment']['basename']:_0x819b0a[_0x1fb1('0x7f')],'direction':_0x819b0a[_0x1fb1('0xf3')]===_0x1fb1('0xcf')?'A':'C','secret':_0x819b0a[_0x1fb1('0xf4')],'read':_0x819b0a[_0x1fb1('0x8c')],'attachment':_0x819b0a[_0x1fb1('0xe2')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x1fb1('0xe4')],_0x1fb1('0x113'),_0x1fb1('0x130'),_0x1fb1('0x131')),{'interaction':_0x16a016})[_0x1fb1('0x37')](function(_0x113a93){return new BPromise(function(_0x59e39e,_0x27f379){pdf[_0x1fb1('0xc0')](_0x113a93,_0x275a80)[_0x1fb1('0x132')](path[_0x1fb1('0xe3')](_0x5bc8a5,'transcript-'+_0x289d13['id']+'-'+_0xb802a3+_0x1fb1('0x133')),function(_0x56a3e5,_0x3b454c){if(_0x56a3e5)return _0x27f379(_0x56a3e5);_0x59e39e(_0x3b454c);});});})['then'](function(){return new BPromise(function(_0x2401e1,_0xaf86f6){zipdir(_0x5bc8a5,{'saveTo':_0x42e069},function(_0x4aa396,_0x41ea14){if(_0x4aa396)return _0xaf86f6(_0x4aa396);return _0x2401e1(_0x41ea14);});})[_0x1fb1('0x37')](function(){return new BPromise(function(_0x3ef605,_0x4d6746){rimraf(_0x5bc8a5,function(_0x174be9){if(_0x174be9)_0x4d6746(_0x174be9);return _0x3ef605();});});})[_0x1fb1('0x37')](function(){return _0x26021c[_0x1fb1('0x111')](_0x42e069,_0x13aa8d,function(_0x15cccf){if(_0x15cccf){console[_0x1fb1('0x134')](_0x1fb1('0x135'),_0x15cccf);}else{fs[_0x1fb1('0x136')](_0x42e069);}});});});}else{return _0x26021c[_0x1fb1('0x2c')](0xc8);}})[_0x1fb1('0x2b')](handleError(_0x26021c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8a0e053..eef8557 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 _0x30b6=['ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x437370,_0x5446d9){var _0xf8189f=function(_0x51b7a4){while(--_0x51b7a4){_0x437370['push'](_0x437370['shift']());}};_0xf8189f(++_0x5446d9);}(_0x30b6,0x16f));var _0x630b=function(_0x27adce,_0x11e854){_0x27adce=_0x27adce-0x0;var _0x1beb73=_0x30b6[_0x27adce];return _0x1beb73;};'use strict';var EventEmitter=require(_0x630b('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x630b('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x630b('0x2')](0x0);var events={'afterCreate':_0x630b('0x3'),'afterUpdate':_0x630b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56e038){return function(_0x1a3abe,_0x56a572,_0x34e2b9){_0x1a3abe[_0x630b('0x5')]({'attributes':['id'],'raw':!![]})[_0x630b('0x6')](function(_0x2212e0){_0x1a3abe[_0x630b('0x7')](_0x630b('0x8'),_0x2212e0[_0x630b('0x9')](function(_0x2d8b60){return{'id':_0x2d8b60['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1a3abe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4ade90){_0x1a3abe[_0x630b('0x7')](_0x630b('0xa'),_0x4ade90[_0x630b('0xb')]);ChatInteractionEvents[_0x630b('0xc')](_0x56e038+':'+_0x1a3abe['id'],_0x1a3abe);ChatInteractionEvents['emit'](_0x56e038,_0x1a3abe);_0x34e2b9(null);})[_0x630b('0xd')](_0x34e2b9(null));};}for(var e in events){if(events[_0x630b('0xe')](e)){var event=events[e];ChatInteraction[_0x630b('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3e6f=['events','../../mysqldb','ChatInteraction','setMaxListeners','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x42c21d,_0x2f1cb4){var _0x336077=function(_0x385084){while(--_0x385084){_0x42c21d['push'](_0x42c21d['shift']());}};_0x336077(++_0x2f1cb4);}(_0x3e6f,0x88));var _0xf3e6=function(_0x4a2eb3,_0x2dcbea){_0x4a2eb3=_0x4a2eb3-0x0;var _0x27b232=_0x3e6f[_0x4a2eb3];return _0x27b232;};'use strict';var EventEmitter=require(_0xf3e6('0x0'));var ChatInteraction=require(_0xf3e6('0x1'))['db'][_0xf3e6('0x2')];var ChatMessage=require(_0xf3e6('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf3e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3e6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a1266){return function(_0x21f369,_0x1b53f4,_0x1ce632){_0x21f369[_0xf3e6('0x5')]({'attributes':['id'],'raw':!![]})[_0xf3e6('0x6')](function(_0x188737){_0x21f369[_0xf3e6('0x7')]('Users',_0x188737[_0xf3e6('0x8')](function(_0x1f7ab5){return{'id':_0x1f7ab5['id']};}));return ChatMessage[_0xf3e6('0x9')]({'where':{'ChatInteractionId':_0x21f369['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf3e6('0x6')](function(_0x32e158){_0x21f369['setDataValue'](_0xf3e6('0xa'),_0x32e158[_0xf3e6('0xb')]);ChatInteractionEvents[_0xf3e6('0xc')](_0x2a1266+':'+_0x21f369['id'],_0x21f369);ChatInteractionEvents[_0xf3e6('0xc')](_0x2a1266,_0x21f369);_0x1ce632(null);})[_0xf3e6('0xd')](_0x1ce632(null));};}for(var e in events){if(events[_0xf3e6('0xe')](e)){var event=events[e];ChatInteraction[_0xf3e6('0xf')](e,emitEvent(event));}}module[_0xf3e6('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index f6b5e8b..21e1da4 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 _0xb10e=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xb10e,0xe5));var _0xeb10=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb10e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xeb10('0x0'));var util=require('util');var logger=require(_0xeb10('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeb10('0x2'));var rp=require(_0xeb10('0x3'));var fs=require('fs');var path=require(_0xeb10('0x4'));var rimraf=require('rimraf');var config=require(_0xeb10('0x5'));var attributes=require(_0xeb10('0x6'));module[_0xeb10('0x7')]=function(_0x2097da,_0x3454ab){return _0x2097da[_0xeb10('0x8')](_0xeb10('0x9'),attributes,{'tableName':_0xeb10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45fcd2,_0x2bbc4d,_0x180e8a){if(_0x45fcd2[_0xeb10('0xb')](_0xeb10('0xc'))){_0x45fcd2[_0xeb10('0xd')]=moment()[_0xeb10('0xe')](_0xeb10('0xf'));}_0x180e8a(null,_0x45fcd2);}},'charset':_0xeb10('0x10'),'collate':_0xeb10('0x11')});}; \ No newline at end of file +var _0xde35=['define','ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x4ac580,_0x344580){var _0x41a6be=function(_0x19e3e6){while(--_0x19e3e6){_0x4ac580['push'](_0x4ac580['shift']());}};_0x41a6be(++_0x344580);}(_0xde35,0x1db));var _0x5de3=function(_0x3a2035,_0x5898c2){_0x3a2035=_0x3a2035-0x0;var _0x19b843=_0xde35[_0x3a2035];return _0x19b843;};'use strict';var _=require('lodash');var util=require(_0x5de3('0x0'));var logger=require(_0x5de3('0x1'))(_0x5de3('0x2'));var moment=require(_0x5de3('0x3'));var BPromise=require(_0x5de3('0x4'));var rp=require(_0x5de3('0x5'));var fs=require('fs');var path=require(_0x5de3('0x6'));var rimraf=require(_0x5de3('0x7'));var config=require(_0x5de3('0x8'));var attributes=require(_0x5de3('0x9'));module[_0x5de3('0xa')]=function(_0x46fe13,_0x2f18eb){return _0x46fe13[_0x5de3('0xb')](_0x5de3('0xc'),attributes,{'tableName':_0x5de3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x400629,_0x388a2e,_0x89401e){if(_0x400629['changed']('closed')){_0x400629['closedAt']=moment()[_0x5de3('0xe')](_0x5de3('0xf'));}_0x89401e(null,_0x400629);}},'charset':_0x5de3('0x10'),'collate':_0x5de3('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c0a25ba..fd269b6 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 _0xacfa=['ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','./chatInteraction.socket','request','then'];(function(_0x2e5a17,_0x558f0e){var _0x24f53d=function(_0x564eb5){while(--_0x564eb5){_0x2e5a17['push'](_0x2e5a17['shift']());}};_0x24f53d(++_0x558f0e);}(_0xacfa,0xdf));var _0xaacf=function(_0x5d0a06,_0x2f8043){_0x5d0a06=_0x5d0a06-0x0;var _0x2350ca=_0xacfa[_0x5d0a06];return _0x2350ca;};'use strict';var _=require(_0xaacf('0x0'));var util=require(_0xaacf('0x1'));var moment=require(_0xaacf('0x2'));var BPromise=require(_0xaacf('0x3'));var rs=require(_0xaacf('0x4'));var fs=require('fs');var Redis=require(_0xaacf('0x5'));var db=require(_0xaacf('0x6'))['db'];var utils=require(_0xaacf('0x7'));var logger=require(_0xaacf('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaacf('0x9'));var client=jayson[_0xaacf('0xa')][_0xaacf('0xb')]({'port':0x232a});config['redis']=_[_0xaacf('0xc')](config['redis'],{'host':_0xaacf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaacf('0xe'))['register'](socket);function respondWithRpcPromise(_0xcda731,_0x88bd13,_0x339c8d){return new BPromise(function(_0x3d3418,_0x2041fd){return client[_0xaacf('0xf')](_0xcda731,_0x339c8d)[_0xaacf('0x10')](function(_0xc6c6aa){logger['info'](_0xaacf('0x11'),_0x88bd13,'request\x20sent');logger[_0xaacf('0x12')](_0xaacf('0x13'),_0x88bd13,'request\x20sent',JSON[_0xaacf('0x14')](_0xc6c6aa));if(_0xc6c6aa[_0xaacf('0x15')]){if(_0xc6c6aa[_0xaacf('0x15')]['code']===0x1f4){logger[_0xaacf('0x15')](_0xaacf('0x11'),_0x88bd13,_0xc6c6aa[_0xaacf('0x15')][_0xaacf('0x16')]);return _0x2041fd(_0xc6c6aa[_0xaacf('0x15')][_0xaacf('0x16')]);}logger[_0xaacf('0x15')](_0xaacf('0x11'),_0x88bd13,_0xc6c6aa[_0xaacf('0x15')][_0xaacf('0x16')]);return _0x3d3418(_0xc6c6aa[_0xaacf('0x15')][_0xaacf('0x16')]);}else{logger[_0xaacf('0x17')](_0xaacf('0x11'),_0x88bd13,'request\x20sent');_0x3d3418(_0xc6c6aa[_0xaacf('0x18')][_0xaacf('0x16')]);}})['catch'](function(_0x18368a){logger['error'](_0xaacf('0x11'),_0x88bd13,_0x18368a);_0x2041fd(_0x18368a);});});}exports[_0xaacf('0x19')]=function(_0x47e4a){var _0x200354=this;return new Promise(function(_0x1b90d0,_0x49e84f){return db[_0xaacf('0x1a')][_0xaacf('0x1b')](_0x47e4a[_0xaacf('0x1c')],{'raw':_0x47e4a['options']?_0x47e4a[_0xaacf('0x1d')][_0xaacf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47e4a[_0xaacf('0x1d')]?_0x47e4a[_0xaacf('0x1d')][_0xaacf('0x1f')]||null:null,'attributes':_0x47e4a[_0xaacf('0x1d')]?_0x47e4a[_0xaacf('0x1d')][_0xaacf('0x20')]||null:null,'limit':_0x47e4a[_0xaacf('0x1d')]?_0x47e4a[_0xaacf('0x1d')][_0xaacf('0x21')]||null:null})['then'](function(_0xe01471){logger['info'](_0xaacf('0x19'),_0x47e4a);logger[_0xaacf('0x12')](_0xaacf('0x19'),_0x47e4a,JSON[_0xaacf('0x14')](_0xe01471));_0x1b90d0(_0xe01471);})['catch'](function(_0x3891b2){logger[_0xaacf('0x15')](_0xaacf('0x19'),_0x3891b2[_0xaacf('0x16')],_0x47e4a);_0x49e84f(_0x200354['error'](0x1f4,_0x3891b2[_0xaacf('0x16')]));});});};exports[_0xaacf('0x22')]=function(_0x4a9501){return new Promise(function(_0x4da9ba,_0x49eab2){return db['ChatInteraction'][_0xaacf('0x23')]({'where':_0x4a9501[_0xaacf('0x1d')]?_0x4a9501['options'][_0xaacf('0x1f')]||null:null})['then'](function(_0x41f768){if(_0x41f768){return _0x41f768[_0xaacf('0x24')](_0x4a9501[_0xaacf('0x1c')][_0xaacf('0x25')],_['omit'](_0x4a9501[_0xaacf('0x1c')],[_0xaacf('0x25'),'id'])||{});}})['spread'](function(_0x20162f){logger[_0xaacf('0x17')](_0xaacf('0x26'),_0x4a9501);logger[_0xaacf('0x12')](_0xaacf('0x26'),_0x4a9501,JSON[_0xaacf('0x14')](_0x20162f));_0x4da9ba(_0x20162f);})[_0xaacf('0x27')](function(_0x3a0426){logger[_0xaacf('0x15')](_0xaacf('0x26'),_0x3a0426['message'],_0x4a9501);_0x49eab2(_this[_0xaacf('0x15')](0x1f4,_0x3a0426['message']));});});}; \ No newline at end of file +var _0xf6e9=['raw','where','limit','UpdateChatInteraction','debug','stringify','find','then','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatInteraction','update','body','options'];(function(_0x5cdd65,_0xdda6bc){var _0x4a09cc=function(_0x4c725a){while(--_0x4c725a){_0x5cdd65['push'](_0x5cdd65['shift']());}};_0x4a09cc(++_0xdda6bc);}(_0xf6e9,0x14c));var _0x9f6e=function(_0x1291d2,_0x1851b6){_0x1291d2=_0x1291d2-0x0;var _0x17eb37=_0xf6e9[_0x1291d2];return _0x17eb37;};'use strict';var _=require(_0x9f6e('0x0'));var util=require(_0x9f6e('0x1'));var moment=require(_0x9f6e('0x2'));var BPromise=require(_0x9f6e('0x3'));var rs=require(_0x9f6e('0x4'));var fs=require('fs');var Redis=require(_0x9f6e('0x5'));var db=require(_0x9f6e('0x6'))['db'];var utils=require(_0x9f6e('0x7'));var logger=require('../../config/logger')(_0x9f6e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f6e('0x9')]['http']({'port':0x232a});config[_0x9f6e('0xa')]=_[_0x9f6e('0xb')](config['redis'],{'host':_0x9f6e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f6e('0xa')]));require(_0x9f6e('0xd'))['register'](socket);function respondWithRpcPromise(_0x3361f4,_0x1cba55,_0x2f109a){return new BPromise(function(_0x187196,_0x311976){return client[_0x9f6e('0xe')](_0x3361f4,_0x2f109a)['then'](function(_0x492117){logger[_0x9f6e('0xf')](_0x9f6e('0x10'),_0x1cba55,_0x9f6e('0x11'));logger['debug'](_0x9f6e('0x12'),_0x1cba55,_0x9f6e('0x11'),JSON['stringify'](_0x492117));if(_0x492117['error']){if(_0x492117[_0x9f6e('0x13')][_0x9f6e('0x14')]===0x1f4){logger['error'](_0x9f6e('0x10'),_0x1cba55,_0x492117[_0x9f6e('0x13')]['message']);return _0x311976(_0x492117[_0x9f6e('0x13')][_0x9f6e('0x15')]);}logger[_0x9f6e('0x13')](_0x9f6e('0x10'),_0x1cba55,_0x492117[_0x9f6e('0x13')][_0x9f6e('0x15')]);return _0x187196(_0x492117[_0x9f6e('0x13')][_0x9f6e('0x15')]);}else{logger[_0x9f6e('0xf')](_0x9f6e('0x10'),_0x1cba55,_0x9f6e('0x11'));_0x187196(_0x492117[_0x9f6e('0x16')][_0x9f6e('0x15')]);}})[_0x9f6e('0x17')](function(_0x47c648){logger[_0x9f6e('0x13')](_0x9f6e('0x10'),_0x1cba55,_0x47c648);_0x311976(_0x47c648);});});}exports['UpdateChatInteraction']=function(_0x1a5f13){var _0x12f84e=this;return new Promise(function(_0x432c00,_0x2a5e32){return db[_0x9f6e('0x18')][_0x9f6e('0x19')](_0x1a5f13[_0x9f6e('0x1a')],{'raw':_0x1a5f13[_0x9f6e('0x1b')]?_0x1a5f13[_0x9f6e('0x1b')][_0x9f6e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a5f13[_0x9f6e('0x1b')]?_0x1a5f13['options'][_0x9f6e('0x1d')]||null:null,'attributes':_0x1a5f13[_0x9f6e('0x1b')]?_0x1a5f13['options']['attributes']||null:null,'limit':_0x1a5f13[_0x9f6e('0x1b')]?_0x1a5f13['options'][_0x9f6e('0x1e')]||null:null})['then'](function(_0x22c313){logger[_0x9f6e('0xf')](_0x9f6e('0x1f'),_0x1a5f13);logger[_0x9f6e('0x20')](_0x9f6e('0x1f'),_0x1a5f13,JSON[_0x9f6e('0x21')](_0x22c313));_0x432c00(_0x22c313);})[_0x9f6e('0x17')](function(_0x3af0a3){logger['error']('UpdateChatInteraction',_0x3af0a3[_0x9f6e('0x15')],_0x1a5f13);_0x2a5e32(_0x12f84e[_0x9f6e('0x13')](0x1f4,_0x3af0a3[_0x9f6e('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x2c9241){return new Promise(function(_0x10a009,_0x19ad6a){return db[_0x9f6e('0x18')][_0x9f6e('0x22')]({'where':_0x2c9241['options']?_0x2c9241[_0x9f6e('0x1b')][_0x9f6e('0x1d')]||null:null})[_0x9f6e('0x23')](function(_0x5b20a9){if(_0x5b20a9){return _0x5b20a9[_0x9f6e('0x24')](_0x2c9241[_0x9f6e('0x1a')][_0x9f6e('0x25')],_['omit'](_0x2c9241[_0x9f6e('0x1a')],[_0x9f6e('0x25'),'id'])||{});}})[_0x9f6e('0x26')](function(_0x4b3d14){logger['info'](_0x9f6e('0x27'),_0x2c9241);logger[_0x9f6e('0x20')]('AddTags',_0x2c9241,JSON[_0x9f6e('0x21')](_0x4b3d14));_0x10a009(_0x4b3d14);})[_0x9f6e('0x17')](function(_0x1e4cf4){logger['error'](_0x9f6e('0x27'),_0x1e4cf4[_0x9f6e('0x15')],_0x2c9241);_0x19ad6a(_this[_0x9f6e('0x13')](0x1f4,_0x1e4cf4[_0x9f6e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 60305f3..0da08c4 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 _0x1838=['./chatInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x12bbc0,_0x38f566){var _0x27d715=function(_0x3b9e89){while(--_0x3b9e89){_0x12bbc0['push'](_0x12bbc0['shift']());}};_0x27d715(++_0x38f566);}(_0x1838,0xbd));var _0x8183=function(_0x569e38,_0x9da69d){_0x569e38=_0x569e38-0x0;var _0x4646a6=_0x1838[_0x569e38];return _0x4646a6;};'use strict';var ChatInteractionEvents=require(_0x8183('0x0'));var events=[_0x8183('0x1'),'remove',_0x8183('0x2')];function createListener(_0x5489f4,_0x2b4c2c){return function(_0x5c2897){_0x2b4c2c[_0x8183('0x3')](_0x5489f4,_0x5c2897);};}function removeListener(_0x20febc,_0x2fd7c9){return function(){ChatInteractionEvents[_0x8183('0x4')](_0x20febc,_0x2fd7c9);};}exports[_0x8183('0x5')]=function(_0x328782){for(var _0x55b2e8=0x0,_0x2e5836=events[_0x8183('0x6')];_0x55b2e8<_0x2e5836;_0x55b2e8++){var _0x332905=events[_0x55b2e8];var _0xcf7cb7=createListener('chatInteraction:'+_0x332905,_0x328782);ChatInteractionEvents['on'](_0x332905,_0xcf7cb7);}}; \ No newline at end of file +var _0x7c17=['remove','removeListener','register','length','chatInteraction:','save'];(function(_0x3e49ca,_0xf68b0f){var _0x39a9ea=function(_0x374fe7){while(--_0x374fe7){_0x3e49ca['push'](_0x3e49ca['shift']());}};_0x39a9ea(++_0xf68b0f);}(_0x7c17,0x15b));var _0x77c1=function(_0x55b55c,_0x21305e){_0x55b55c=_0x55b55c-0x0;var _0x553277=_0x7c17[_0x55b55c];return _0x553277;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x77c1('0x0'),_0x77c1('0x1'),'update'];function createListener(_0x4a3f81,_0x394868){return function(_0x4a4ad6){_0x394868['emit'](_0x4a3f81,_0x4a4ad6);};}function removeListener(_0x44145d,_0x3d2287){return function(){ChatInteractionEvents[_0x77c1('0x2')](_0x44145d,_0x3d2287);};}exports[_0x77c1('0x3')]=function(_0x1ade97){for(var _0x20e96b=0x0,_0x5b78de=events[_0x77c1('0x4')];_0x20e96b<_0x5b78de;_0x20e96b++){var _0x210e95=events[_0x20e96b];var _0x44bf7f=createListener(_0x77c1('0x5')+_0x210e95,_0x1ade97);ChatInteractionEvents['on'](_0x210e95,_0x44bf7f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d61dc09..5cd3e97 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 _0xa71a=['index','get','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','addTags','/:id','chat','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated'];(function(_0x37cfa4,_0x5cb945){var _0x595e60=function(_0x394b8a){while(--_0x394b8a){_0x37cfa4['push'](_0x37cfa4['shift']());}};_0x595e60(++_0x5cb945);}(_0xa71a,0xf1));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var path=require(_0xaa71('0x2'));var timeout=require(_0xaa71('0x3'));var express=require('express');var router=express[_0xaa71('0x4')]();var auth=require(_0xaa71('0x5'));var interaction=require(_0xaa71('0x6'));var config=require('../../config/environment');var controller=require(_0xaa71('0x7'));router['get']('/',auth[_0xaa71('0x8')](),controller[_0xaa71('0x9')]);router[_0xaa71('0xa')]('/describe',auth[_0xaa71('0x8')](),controller[_0xaa71('0xb')]);router['get']('/:id',auth[_0xaa71('0xc')](),controller[_0xaa71('0xd')]);router[_0xaa71('0xa')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xaa71('0xe')]);router[_0xaa71('0xa')](_0xaa71('0xf'),auth[_0xaa71('0x8')](),controller[_0xaa71('0x10')]);router[_0xaa71('0xa')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xaa71('0xa')](_0xaa71('0x11'),auth[_0xaa71('0x8')](),controller['download']);router[_0xaa71('0x12')]('/',auth[_0xaa71('0x8')](),controller[_0xaa71('0x13')]);router[_0xaa71('0x12')](_0xaa71('0x14'),auth[_0xaa71('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xaa71('0x15')]({'destination':function(_0x400021,_0x33b581,_0x5b4f5a){_0x5b4f5a(null,path[_0xaa71('0x16')](config[_0xaa71('0x17')],_0xaa71('0x18')));},'filename':function(_0xc6d72c,_0x23b9e7,_0x16f406){_0x16f406(null,util[_0xaa71('0x19')](_0xaa71('0x1a'),Date[_0xaa71('0x1b')](),_0x23b9e7[_0xaa71('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaa71('0x12')](_0xaa71('0x1d'),upload[_0xaa71('0x1e')](_0xaa71('0x1f')),controller[_0xaa71('0x20')]);router['post'](_0xaa71('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xaa71('0x21')]);router[_0xaa71('0x12')](_0xaa71('0x22'),auth[_0xaa71('0x8')](),interaction[_0xaa71('0x23')]('chat','chatinteraction:addtags'),controller[_0xaa71('0x24')]);router['put'](_0xaa71('0x25'),auth[_0xaa71('0x8')](),interaction[_0xaa71('0x23')](_0xaa71('0x26'),_0xaa71('0x27')),controller[_0xaa71('0x28')]);router[_0xaa71('0x29')](_0xaa71('0x2a'),controller[_0xaa71('0x2b')]);router[_0xaa71('0x29')](_0xaa71('0x2c'),auth[_0xaa71('0xc')](),controller[_0xaa71('0x2d')]);router['put']('/:id/close',controller[_0xaa71('0x2e')]);router[_0xaa71('0x2f')](_0xaa71('0x25'),auth['isAuthenticated'](),interaction['tracked'](_0xaa71('0x26'),'chatinteraction:destroy'),controller[_0xaa71('0x30')]);router['delete']('/:id/tags',auth[_0xaa71('0x8')](),controller['removeTags']);module[_0xaa71('0x31')]=router; \ No newline at end of file +var _0xb7e2=['put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','/:id','chatinteraction:destroy','delete','removeTags','multer','path','express','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','chat','addTags'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xb7e2,0x103));var _0x2b7e=function(_0x581ebd,_0x4016dc){_0x581ebd=_0x581ebd-0x0;var _0x475b1a=_0xb7e2[_0x581ebd];return _0x475b1a;};'use strict';var multer=require(_0x2b7e('0x0'));var util=require('util');var path=require(_0x2b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b7e('0x2'));var router=express['Router']();var auth=require(_0x2b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2b7e('0x4'));var controller=require(_0x2b7e('0x5'));router[_0x2b7e('0x6')]('/',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x8')]);router[_0x2b7e('0x6')]('/describe',auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x9')]);router[_0x2b7e('0x6')]('/:id',auth[_0x2b7e('0xa')](),controller[_0x2b7e('0xb')]);router[_0x2b7e('0x6')](_0x2b7e('0xc'),auth[_0x2b7e('0xa')](),controller['attachmentDownload']);router['get'](_0x2b7e('0xd'),auth[_0x2b7e('0x7')](),controller[_0x2b7e('0xe')]);router[_0x2b7e('0x6')](_0x2b7e('0xf'),auth[_0x2b7e('0xa')](),controller[_0x2b7e('0x10')]);router['get'](_0x2b7e('0x11'),auth[_0x2b7e('0x7')](),controller[_0x2b7e('0x12')]);router[_0x2b7e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2b7e('0x14'),auth['isAuthenticated'](),controller[_0x2b7e('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f5682,_0x4b84b2,_0x181aec){_0x181aec(null,path[_0x2b7e('0x16')](config[_0x2b7e('0x17')],'server/files/attachments/'));},'filename':function(_0x3d5abe,_0x27a30a,_0x5f3b8f){_0x5f3b8f(null,util[_0x2b7e('0x18')](_0x2b7e('0x19'),Date[_0x2b7e('0x1a')](),_0x27a30a['originalname'][_0x2b7e('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2b7e('0x13')](_0x2b7e('0x1c'),upload[_0x2b7e('0x1d')](_0x2b7e('0x1e')),controller['attachmentUpload']);router[_0x2b7e('0x13')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x2b7e('0x1f')]);router['post'](_0x2b7e('0x20'),auth[_0x2b7e('0x7')](),interaction['tracked'](_0x2b7e('0x21'),'chatinteraction:addtags'),controller[_0x2b7e('0x22')]);router[_0x2b7e('0x23')]('/:id',auth['isAuthenticated'](),interaction[_0x2b7e('0x24')](_0x2b7e('0x21'),_0x2b7e('0x25')),controller[_0x2b7e('0x26')]);router[_0x2b7e('0x23')](_0x2b7e('0x27'),controller[_0x2b7e('0x28')]);router[_0x2b7e('0x23')](_0x2b7e('0x29'),auth[_0x2b7e('0xa')](),controller[_0x2b7e('0x2a')]);router[_0x2b7e('0x23')](_0x2b7e('0x2b'),controller[_0x2b7e('0x2c')]);router['delete'](_0x2b7e('0x2d'),auth[_0x2b7e('0x7')](),interaction[_0x2b7e('0x24')](_0x2b7e('0x21'),_0x2b7e('0x2e')),controller['destroy']);router[_0x2b7e('0x2f')](_0x2b7e('0x20'),auth['isAuthenticated'](),controller[_0x2b7e('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 8fd635a..71ad5d9 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 _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4c4ade,_0x1c82c8){var _0x4845dd=function(_0x455923){while(--_0x455923){_0x4c4ade['push'](_0x4c4ade['shift']());}};_0x4845dd(++_0x1c82c8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24e7f2,_0x2149e8){_0x24e7f2=_0x24e7f2-0x0;var _0x37b7b1=_0x5f2f[_0x24e7f2];return _0x37b7b1;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x7a54,0x106));var _0x47a5=function(_0x78318e,_0x5ad33d){_0x78318e=_0x78318e-0x0;var _0x3dde26=_0x7a54[_0x78318e];return _0x3dde26;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f116496..f24be2c 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 _0xf8f6=['squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','error','index','map','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','name','options','ChatInternalMessage','findAll','then','rows','catch','params','rawAttributes','intersection','includeAll','include','create','body','find','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','UserProfileSection','Agents','autoAssociation','filter','push','-createdAt','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0xf8f6,0xbe));var _0x6f8f=function(_0x583946,_0xc8aca4){_0x583946=_0x583946-0x0;var _0x1b138a=_0xf8f6[_0x583946];return _0x1b138a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f8f('0x0'));var rimraf=require(_0x6f8f('0x1'));var zipdir=require(_0x6f8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f8f('0x3'));var BPromise=require(_0x6f8f('0x4'));var Mustache=require(_0x6f8f('0x5'));var util=require(_0x6f8f('0x6'));var path=require(_0x6f8f('0x7'));var sox=require(_0x6f8f('0x8'));var csv=require('to-csv');var ejs=require(_0x6f8f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f8f('0xa'));var crypto=require(_0x6f8f('0xb'));var jsforce=require(_0x6f8f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f8f('0xd'));var querystring=require(_0x6f8f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f8f('0xf'));var as=require(_0x6f8f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f8f('0x11'))(_0x6f8f('0x12'));var utils=require(_0x6f8f('0x13'));var config=require(_0x6f8f('0x14'));var db=require(_0x6f8f('0x15'))['db'];config[_0x6f8f('0x16')]=_[_0x6f8f('0x17')](config[_0x6f8f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f8f('0x18'))(new Redis(config[_0x6f8f('0x16')]));require('./chatInternalMessage.socket')[_0x6f8f('0x19')](socket);function respondWithStatusCode(_0x4e2b9b,_0x9356ef){_0x9356ef=_0x9356ef||0xcc;return function(_0x5247c1){if(_0x5247c1){return _0x4e2b9b[_0x6f8f('0x1a')](_0x9356ef);}return _0x4e2b9b[_0x6f8f('0x1b')](_0x9356ef)[_0x6f8f('0x1c')]();};}function respondWithResult(_0x8cbf8,_0x17019a){_0x17019a=_0x17019a||0xc8;return function(_0x25ed06){if(_0x25ed06){return _0x8cbf8[_0x6f8f('0x1b')](_0x17019a)[_0x6f8f('0x1d')](_0x25ed06);}};}function respondWithFilteredResult(_0x35d2c6,_0x3d11e0){return function(_0x3b82c6){if(_0x3b82c6){var _0x9614a9=_0x3b82c6[_0x6f8f('0x1e')],_0x41cf28=_0x3d11e0[_0x6f8f('0x1f')],_0xc6d0e5=_0x3d11e0[_0x6f8f('0x1f')]+_0x3d11e0['limit'],_0x39ad5a;if(_0xc6d0e5>=_0x9614a9){_0xc6d0e5=_0x9614a9;_0x39ad5a=0xc8;}else{_0x39ad5a=0xce;}_0x35d2c6[_0x6f8f('0x1b')](_0x39ad5a);return _0x35d2c6['set'](_0x6f8f('0x20'),_0x41cf28+'-'+_0xc6d0e5+'/'+_0x9614a9)[_0x6f8f('0x1d')](_0x3b82c6);}return null;};}function patchUpdates(_0x45a3ee){return function(_0x33c871){try{jsonpatch[_0x6f8f('0x21')](_0x33c871,_0x45a3ee,!![]);}catch(_0x52a165){return BPromise['reject'](_0x52a165);}return _0x33c871[_0x6f8f('0x22')]();};}function saveUpdates(_0x3cd43b,_0x5c1279){return function(_0x5ac37e){if(_0x5ac37e){return _0x5ac37e[_0x6f8f('0x23')](_0x3cd43b)['then'](function(_0x1892a7){return _0x1892a7;});}return null;};}function removeEntity(_0x22ee8a,_0x2b90a2){return function(_0x113cc5){if(_0x113cc5){return _0x113cc5[_0x6f8f('0x24')]()['then'](function(){_0x22ee8a['status'](0xcc)[_0x6f8f('0x1c')]();});}};}function handleEntityNotFound(_0x4756e1,_0xfccab2){return function(_0x43d0d7){if(!_0x43d0d7){_0x4756e1['sendStatus'](0x194);}return _0x43d0d7;};}function handleError(_0x1a1c48,_0x4d1ad9){_0x4d1ad9=_0x4d1ad9||0x1f4;return function(_0x25cbd8){logger[_0x6f8f('0x25')](_0x25cbd8['stack']);if(_0x25cbd8['name']){delete _0x25cbd8['name'];}_0x1a1c48[_0x6f8f('0x1b')](_0x4d1ad9)['send'](_0x25cbd8);};}exports[_0x6f8f('0x26')]=function(_0x499b40,_0x3bcaac){var _0x282cc8={},_0x592479={},_0x5ea552={'count':0x0,'rows':[]};var _0x4abeca=_[_0x6f8f('0x27')](db['ChatInternalMessage']['rawAttributes'],function(_0x200ac6){return{'name':_0x200ac6[_0x6f8f('0x28')],'type':_0x200ac6[_0x6f8f('0x29')][_0x6f8f('0x2a')]};});_0x592479[_0x6f8f('0x2b')]=_['map'](_0x4abeca,'name');_0x592479[_0x6f8f('0x2c')]=_[_0x6f8f('0x2d')](_0x499b40[_0x6f8f('0x2c')]);_0x592479['filters']=_['intersection'](_0x592479[_0x6f8f('0x2b')],_0x592479[_0x6f8f('0x2c')]);_0x282cc8['attributes']=_['intersection'](_0x592479[_0x6f8f('0x2b')],qs['fields'](_0x499b40[_0x6f8f('0x2c')][_0x6f8f('0x2e')]));_0x282cc8[_0x6f8f('0x2f')]=_0x282cc8['attributes'][_0x6f8f('0x30')]?_0x282cc8[_0x6f8f('0x2f')]:_0x592479[_0x6f8f('0x2b')];if(!_0x499b40[_0x6f8f('0x2c')][_0x6f8f('0x31')](_0x6f8f('0x32'))){_0x282cc8[_0x6f8f('0x33')]=qs[_0x6f8f('0x33')](_0x499b40[_0x6f8f('0x2c')][_0x6f8f('0x33')]);_0x282cc8[_0x6f8f('0x1f')]=qs[_0x6f8f('0x1f')](_0x499b40[_0x6f8f('0x2c')]['offset']);}_0x282cc8[_0x6f8f('0x34')]=qs['sort'](_0x499b40[_0x6f8f('0x2c')][_0x6f8f('0x35')]);_0x282cc8[_0x6f8f('0x36')]=qs['filters'](_[_0x6f8f('0x37')](_0x499b40[_0x6f8f('0x2c')],_0x592479[_0x6f8f('0x38')]),_0x4abeca);if(_0x499b40[_0x6f8f('0x2c')]['filter']){_0x282cc8[_0x6f8f('0x36')]=_[_0x6f8f('0x39')](_0x282cc8[_0x6f8f('0x36')],{'$or':_[_0x6f8f('0x27')](_0x4abeca,function(_0x294852){if(_0x294852['type']!==_0x6f8f('0x3a')){var _0x1bf01d={};_0x1bf01d[_0x294852[_0x6f8f('0x3b')]]={'$like':'%'+_0x499b40[_0x6f8f('0x2c')]['filter']+'%'};return _0x1bf01d;}})});}_0x282cc8=_[_0x6f8f('0x39')]({},_0x282cc8,_0x499b40[_0x6f8f('0x3c')]);var _0x34c0db={'where':_0x282cc8[_0x6f8f('0x36')]};return db[_0x6f8f('0x3d')][_0x6f8f('0x1e')](_0x34c0db)['then'](function(_0x6e17af){_0x5ea552[_0x6f8f('0x1e')]=_0x6e17af;if(_0x499b40[_0x6f8f('0x2c')]['includeAll']){_0x282cc8['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x6f8f('0x3e')](_0x282cc8);})[_0x6f8f('0x3f')](function(_0x1867fe){_0x5ea552[_0x6f8f('0x40')]=_0x1867fe;return _0x5ea552;})[_0x6f8f('0x3f')](respondWithFilteredResult(_0x3bcaac,_0x282cc8))[_0x6f8f('0x41')](handleError(_0x3bcaac,null));};exports['show']=function(_0x58a876,_0x4ed9f1){var _0x4d0a89={'raw':!![],'where':{'id':_0x58a876[_0x6f8f('0x42')]['id']}},_0x2c50fd={};_0x2c50fd['model']=_[_0x6f8f('0x2d')](db[_0x6f8f('0x3d')][_0x6f8f('0x43')]);_0x2c50fd[_0x6f8f('0x2c')]=_[_0x6f8f('0x2d')](_0x58a876['query']);_0x2c50fd[_0x6f8f('0x38')]=_[_0x6f8f('0x44')](_0x2c50fd[_0x6f8f('0x2b')],_0x2c50fd[_0x6f8f('0x2c')]);_0x4d0a89['attributes']=_['intersection'](_0x2c50fd['model'],qs[_0x6f8f('0x2e')](_0x58a876[_0x6f8f('0x2c')]['fields']));_0x4d0a89['attributes']=_0x4d0a89[_0x6f8f('0x2f')][_0x6f8f('0x30')]?_0x4d0a89[_0x6f8f('0x2f')]:_0x2c50fd[_0x6f8f('0x2b')];if(_0x58a876['query'][_0x6f8f('0x45')]){_0x4d0a89[_0x6f8f('0x46')]=[{'all':!![]}];}_0x4d0a89=_[_0x6f8f('0x39')]({},_0x4d0a89,_0x58a876[_0x6f8f('0x3c')]);return db[_0x6f8f('0x3d')]['find'](_0x4d0a89)[_0x6f8f('0x3f')](handleEntityNotFound(_0x4ed9f1,null))['then'](respondWithResult(_0x4ed9f1,null))[_0x6f8f('0x41')](handleError(_0x4ed9f1,null));};exports[_0x6f8f('0x47')]=function(_0x115f07,_0xb86c47){return db[_0x6f8f('0x3d')][_0x6f8f('0x47')](_0x115f07[_0x6f8f('0x48')],{})[_0x6f8f('0x3f')](respondWithResult(_0xb86c47,0xc9))[_0x6f8f('0x41')](handleError(_0xb86c47,null));};exports[_0x6f8f('0x23')]=function(_0x54c1d7,_0x273f05){if(_0x54c1d7['body']['id']){delete _0x54c1d7[_0x6f8f('0x48')]['id'];}return db[_0x6f8f('0x3d')][_0x6f8f('0x49')]({'where':{'id':_0x54c1d7[_0x6f8f('0x42')]['id']}})[_0x6f8f('0x3f')](handleEntityNotFound(_0x273f05,null))[_0x6f8f('0x3f')](saveUpdates(_0x54c1d7[_0x6f8f('0x48')],null))[_0x6f8f('0x3f')](respondWithResult(_0x273f05,null))[_0x6f8f('0x41')](handleError(_0x273f05,null));};exports[_0x6f8f('0x24')]=function(_0x3084a5,_0x4e25bf){return db['ChatInternalMessage'][_0x6f8f('0x49')]({'where':{'id':_0x3084a5[_0x6f8f('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e25bf,null))[_0x6f8f('0x3f')](removeEntity(_0x4e25bf,null))['catch'](handleError(_0x4e25bf,null));};exports[_0x6f8f('0x4a')]=function(_0x408b2a,_0x531d5d){return db[_0x6f8f('0x3d')][_0x6f8f('0x4a')]()[_0x6f8f('0x3f')](respondWithResult(_0x531d5d,null))[_0x6f8f('0x41')](handleError(_0x531d5d,null));};function wrapUser(_0x33cda3){return function(_0x5165ce){var _0x191e84=_0x33cda3['get']({'plain':!![]});_0x191e84[_0x6f8f('0x4b')]=[];if(_0x5165ce){_0x191e84[_0x6f8f('0x4c')]=_0x5165ce[_0x6f8f('0x4d')];_0x191e84[_0x6f8f('0x4e')]=_0x5165ce;}else{_0x191e84[_0x6f8f('0x4c')]=moment(0x0)['format'](_0x6f8f('0x4f'));_0x191e84[_0x6f8f('0x4e')]={};}return _0x191e84;};}exports[_0x6f8f('0x50')]=function(_0x14dbf2,_0x2a7f9b,_0x406125){var _0x13018a=[];return db[_0x6f8f('0x51')]['findAll']({'where':{'role':[_0x6f8f('0x52'),'admin','user']},'attributes':['id',_0x6f8f('0x53'),_0x6f8f('0x3b'),_0x6f8f('0x54'),'userpic',_0x6f8f('0x55'),'online',_0x6f8f('0x56'),_0x6f8f('0x57'),_0x6f8f('0x58')],'order':qs[_0x6f8f('0x35')](_0x6f8f('0x59')),'include':[{'model':db[_0x6f8f('0x5a')],'as':_0x6f8f('0x5b'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})['then'](function(_0x4d7014){if(_0x4d7014){var _0x59e3d7=_0x14dbf2[_0x6f8f('0x5c')][_0x6f8f('0x5d')]({'plain':!![]});if(!_0x59e3d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59e3d7[_0x6f8f('0x54')]===_0x6f8f('0x5c')){return db[_0x6f8f('0x5e')][_0x6f8f('0x49')]({'where':{'name':_0x6f8f('0x5f'),'userProfileId':_0x59e3d7['userProfileId']},'raw':!![]})[_0x6f8f('0x3f')](function(_0x571646){if(_0x571646){if(_0x571646[_0x6f8f('0x60')]===0x0){return db['UserProfileResource'][_0x6f8f('0x3e')]({'where':{'sectionId':_0x571646['id']},'raw':!![]})['then'](function(_0x36a811){var _0x2856a6=[];if(_['isEmpty'](_0x36a811)){_0x2856a6=_[_0x6f8f('0x61')](_0x4d7014,function(_0x5a3de4){if(_0x5a3de4[_0x6f8f('0x54')]!==_0x6f8f('0x52')){return _0x5a3de4;}});return _0x2856a6;}else{for(var _0xc0da78=0x0;_0xc0da78<_0x4d7014[_0x6f8f('0x30')];_0xc0da78++){var _0x29e31b=_0x4d7014[_0xc0da78];if(_0x29e31b[_0x6f8f('0x54')]===_0x6f8f('0x52')){var _0x54a9fe=_[_0x6f8f('0x49')](_0x36a811,function(_0x1bbcec){return _0x1bbcec['resourceId']===_0x29e31b['id'];});if(_0x54a9fe)_0x2856a6[_0x6f8f('0x62')](_0x29e31b);}else{_0x2856a6['push'](_0x29e31b);}}return _0x2856a6;}});}else{return _0x4d7014;}}else{var _0x506bf5=_['filter'](_0x4d7014,function(_0x20fe7e){if(_0x20fe7e['role']!==_0x6f8f('0x52')){return _0x20fe7e;}});return _0x506bf5;}});}else{return _0x4d7014;}}})['then'](function(_0x1c9471){var _0x41465e=[];if(_0x1c9471){_0x13018a=_0x1c9471;for(var _0x30892a=0x0;_0x30892a<_0x1c9471[_0x6f8f('0x30')];_0x30892a+=0x1){_0x13018a[_0x30892a]['messages']=[];_0x41465e[_0x6f8f('0x62')](db[_0x6f8f('0x3d')][_0x6f8f('0x49')]({'where':{'FromId':[_0x14dbf2[_0x6f8f('0x5c')]['id'],_0x1c9471[_0x30892a]['id']],'ToId':[_0x14dbf2[_0x6f8f('0x5c')]['id'],_0x1c9471[_0x30892a]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId','read','body'],'order':qs['sort'](_0x6f8f('0x63')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6f8f('0x3f')](wrapUser(_0x1c9471[_0x30892a])));}return BPromise['all'](_0x41465e);}return[];})[_0x6f8f('0x3f')](function(_0x3192f4){return{'rows':_0x3192f4,'count':_0x3192f4['length']};})['then'](respondWithResult(_0x2a7f9b,null))[_0x6f8f('0x41')](handleError(_0x2a7f9b,null));}; \ No newline at end of file +var _0xe940=['UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe','get','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','user','UserProfileSection','Agents','autoAssociation'];(function(_0x235aef,_0x5c56d6){var _0x86263c=function(_0x4f3c65){while(--_0x4f3c65){_0x235aef['push'](_0x235aef['shift']());}};_0x86263c(++_0x5c56d6);}(_0xe940,0x152));var _0x0e94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe940[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x0e94('0x0'));var emlformat=require(_0x0e94('0x1'));var rimraf=require(_0x0e94('0x2'));var zipdir=require(_0x0e94('0x3'));var jsonpatch=require(_0x0e94('0x4'));var rp=require(_0x0e94('0x5'));var moment=require(_0x0e94('0x6'));var BPromise=require(_0x0e94('0x7'));var Mustache=require('mustache');var util=require(_0x0e94('0x8'));var path=require(_0x0e94('0x9'));var sox=require(_0x0e94('0xa'));var csv=require(_0x0e94('0xb'));var ejs=require(_0x0e94('0xc'));var fs=require('fs');var _=require(_0x0e94('0xd'));var squel=require(_0x0e94('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e94('0xf'));var Papa=require(_0x0e94('0x10'));var Redis=require('ioredis');var authService=require(_0x0e94('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0e94('0x12'));var hardwareService=require(_0x0e94('0x13'));var logger=require(_0x0e94('0x14'))(_0x0e94('0x15'));var utils=require(_0x0e94('0x16'));var config=require(_0x0e94('0x17'));var db=require('../../mysqldb')['db'];config[_0x0e94('0x18')]=_[_0x0e94('0x19')](config[_0x0e94('0x18')],{'host':_0x0e94('0x1a'),'port':0x18eb});var socket=require(_0x0e94('0x1b'))(new Redis(config['redis']));require(_0x0e94('0x1c'))[_0x0e94('0x1d')](socket);function respondWithStatusCode(_0x1cb8d8,_0x3972af){_0x3972af=_0x3972af||0xcc;return function(_0x16a1a3){if(_0x16a1a3){return _0x1cb8d8[_0x0e94('0x1e')](_0x3972af);}return _0x1cb8d8[_0x0e94('0x1f')](_0x3972af)[_0x0e94('0x20')]();};}function respondWithResult(_0x5660c3,_0x1040e9){_0x1040e9=_0x1040e9||0xc8;return function(_0x3a1feb){if(_0x3a1feb){return _0x5660c3[_0x0e94('0x1f')](_0x1040e9)[_0x0e94('0x21')](_0x3a1feb);}};}function respondWithFilteredResult(_0x30f46c,_0x4a6559){return function(_0x4f75f0){if(_0x4f75f0){var _0x23dc2a=_0x4f75f0[_0x0e94('0x22')],_0x22e447=_0x4a6559[_0x0e94('0x23')],_0x5d40eb=_0x4a6559['offset']+_0x4a6559['limit'],_0x295a6a;if(_0x5d40eb>=_0x23dc2a){_0x5d40eb=_0x23dc2a;_0x295a6a=0xc8;}else{_0x295a6a=0xce;}_0x30f46c[_0x0e94('0x1f')](_0x295a6a);return _0x30f46c['set'](_0x0e94('0x24'),_0x22e447+'-'+_0x5d40eb+'/'+_0x23dc2a)['json'](_0x4f75f0);}return null;};}function patchUpdates(_0x319c0b){return function(_0x10e500){try{jsonpatch[_0x0e94('0x25')](_0x10e500,_0x319c0b,!![]);}catch(_0x47a360){return BPromise[_0x0e94('0x26')](_0x47a360);}return _0x10e500[_0x0e94('0x27')]();};}function saveUpdates(_0x3a0f,_0x34b2f9){return function(_0x4effda){if(_0x4effda){return _0x4effda['update'](_0x3a0f)[_0x0e94('0x28')](function(_0x2dfcf0){return _0x2dfcf0;});}return null;};}function removeEntity(_0x24e4e4,_0x1253e9){return function(_0x321c97){if(_0x321c97){return _0x321c97['destroy']()[_0x0e94('0x28')](function(){_0x24e4e4[_0x0e94('0x1f')](0xcc)[_0x0e94('0x20')]();});}};}function handleEntityNotFound(_0x1e3f07,_0x6ebc9f){return function(_0x30e189){if(!_0x30e189){_0x1e3f07[_0x0e94('0x1e')](0x194);}return _0x30e189;};}function handleError(_0x5382c2,_0x1fadb4){_0x1fadb4=_0x1fadb4||0x1f4;return function(_0x4766a0){logger[_0x0e94('0x29')](_0x4766a0[_0x0e94('0x2a')]);if(_0x4766a0[_0x0e94('0x2b')]){delete _0x4766a0[_0x0e94('0x2b')];}_0x5382c2[_0x0e94('0x1f')](_0x1fadb4)[_0x0e94('0x2c')](_0x4766a0);};}exports['index']=function(_0x3c9b55,_0x34f3e7){var _0x2924be={},_0x14a0d6={},_0x4ee173={'count':0x0,'rows':[]};var _0x5ef976=_[_0x0e94('0x2d')](db[_0x0e94('0x2e')]['rawAttributes'],function(_0xeadacf){return{'name':_0xeadacf[_0x0e94('0x2f')],'type':_0xeadacf[_0x0e94('0x30')][_0x0e94('0x31')]};});_0x14a0d6[_0x0e94('0x32')]=_[_0x0e94('0x2d')](_0x5ef976,_0x0e94('0x2b'));_0x14a0d6[_0x0e94('0x33')]=_[_0x0e94('0x34')](_0x3c9b55[_0x0e94('0x33')]);_0x14a0d6[_0x0e94('0x35')]=_[_0x0e94('0x36')](_0x14a0d6[_0x0e94('0x32')],_0x14a0d6[_0x0e94('0x33')]);_0x2924be['attributes']=_[_0x0e94('0x36')](_0x14a0d6[_0x0e94('0x32')],qs[_0x0e94('0x37')](_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x37')]));_0x2924be[_0x0e94('0x38')]=_0x2924be[_0x0e94('0x38')]['length']?_0x2924be[_0x0e94('0x38')]:_0x14a0d6[_0x0e94('0x32')];if(!_0x3c9b55[_0x0e94('0x33')]['hasOwnProperty'](_0x0e94('0x39'))){_0x2924be[_0x0e94('0x3a')]=qs[_0x0e94('0x3a')](_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x3a')]);_0x2924be[_0x0e94('0x23')]=qs[_0x0e94('0x23')](_0x3c9b55['query'][_0x0e94('0x23')]);}_0x2924be[_0x0e94('0x3b')]=qs[_0x0e94('0x3c')](_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x3c')]);_0x2924be[_0x0e94('0x3d')]=qs[_0x0e94('0x35')](_['pick'](_0x3c9b55[_0x0e94('0x33')],_0x14a0d6[_0x0e94('0x35')]),_0x5ef976);if(_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x3e')]){_0x2924be[_0x0e94('0x3d')]=_['merge'](_0x2924be[_0x0e94('0x3d')],{'$or':_[_0x0e94('0x2d')](_0x5ef976,function(_0xdfb9f7){if(_0xdfb9f7[_0x0e94('0x30')]!==_0x0e94('0x3f')){var _0x153891={};_0x153891[_0xdfb9f7[_0x0e94('0x2b')]]={'$like':'%'+_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x3e')]+'%'};return _0x153891;}})});}_0x2924be=_['merge']({},_0x2924be,_0x3c9b55[_0x0e94('0x40')]);var _0x4176db={'where':_0x2924be[_0x0e94('0x3d')]};return db[_0x0e94('0x2e')][_0x0e94('0x22')](_0x4176db)[_0x0e94('0x28')](function(_0x101a92){_0x4ee173[_0x0e94('0x22')]=_0x101a92;if(_0x3c9b55[_0x0e94('0x33')][_0x0e94('0x41')]){_0x2924be[_0x0e94('0x42')]=[{'all':!![]}];}return db[_0x0e94('0x2e')][_0x0e94('0x43')](_0x2924be);})['then'](function(_0x5e61bb){_0x4ee173[_0x0e94('0x44')]=_0x5e61bb;return _0x4ee173;})[_0x0e94('0x28')](respondWithFilteredResult(_0x34f3e7,_0x2924be))[_0x0e94('0x45')](handleError(_0x34f3e7,null));};exports[_0x0e94('0x46')]=function(_0x2e67a7,_0x22316a){var _0x2e90d8={'raw':!![],'where':{'id':_0x2e67a7[_0x0e94('0x47')]['id']}},_0x468e2d={};_0x468e2d[_0x0e94('0x32')]=_[_0x0e94('0x34')](db[_0x0e94('0x2e')][_0x0e94('0x48')]);_0x468e2d[_0x0e94('0x33')]=_[_0x0e94('0x34')](_0x2e67a7['query']);_0x468e2d[_0x0e94('0x35')]=_[_0x0e94('0x36')](_0x468e2d[_0x0e94('0x32')],_0x468e2d[_0x0e94('0x33')]);_0x2e90d8[_0x0e94('0x38')]=_['intersection'](_0x468e2d[_0x0e94('0x32')],qs[_0x0e94('0x37')](_0x2e67a7[_0x0e94('0x33')][_0x0e94('0x37')]));_0x2e90d8[_0x0e94('0x38')]=_0x2e90d8[_0x0e94('0x38')][_0x0e94('0x49')]?_0x2e90d8[_0x0e94('0x38')]:_0x468e2d[_0x0e94('0x32')];if(_0x2e67a7[_0x0e94('0x33')][_0x0e94('0x41')]){_0x2e90d8['include']=[{'all':!![]}];}_0x2e90d8=_['merge']({},_0x2e90d8,_0x2e67a7[_0x0e94('0x40')]);return db[_0x0e94('0x2e')][_0x0e94('0x4a')](_0x2e90d8)[_0x0e94('0x28')](handleEntityNotFound(_0x22316a,null))[_0x0e94('0x28')](respondWithResult(_0x22316a,null))[_0x0e94('0x45')](handleError(_0x22316a,null));};exports[_0x0e94('0x4b')]=function(_0x76f132,_0xce38b8){return db[_0x0e94('0x2e')][_0x0e94('0x4b')](_0x76f132['body'],{})[_0x0e94('0x28')](respondWithResult(_0xce38b8,0xc9))[_0x0e94('0x45')](handleError(_0xce38b8,null));};exports['update']=function(_0x5963b8,_0x340def){if(_0x5963b8[_0x0e94('0x4c')]['id']){delete _0x5963b8[_0x0e94('0x4c')]['id'];}return db['ChatInternalMessage'][_0x0e94('0x4a')]({'where':{'id':_0x5963b8[_0x0e94('0x47')]['id']}})['then'](handleEntityNotFound(_0x340def,null))[_0x0e94('0x28')](saveUpdates(_0x5963b8[_0x0e94('0x4c')],null))[_0x0e94('0x28')](respondWithResult(_0x340def,null))['catch'](handleError(_0x340def,null));};exports[_0x0e94('0x4d')]=function(_0x59c84e,_0xbeb3cf){return db[_0x0e94('0x2e')][_0x0e94('0x4a')]({'where':{'id':_0x59c84e['params']['id']}})['then'](handleEntityNotFound(_0xbeb3cf,null))[_0x0e94('0x28')](removeEntity(_0xbeb3cf,null))[_0x0e94('0x45')](handleError(_0xbeb3cf,null));};exports['describe']=function(_0x1b6319,_0x5e9fb4){return db[_0x0e94('0x2e')][_0x0e94('0x4e')]()['then'](respondWithResult(_0x5e9fb4,null))['catch'](handleError(_0x5e9fb4,null));};function wrapUser(_0x20d215){return function(_0x5d808f){var _0x158a0e=_0x20d215[_0x0e94('0x4f')]({'plain':!![]});_0x158a0e[_0x0e94('0x50')]=[];if(_0x5d808f){_0x158a0e['lastMessageAt']=_0x5d808f[_0x0e94('0x51')];_0x158a0e[_0x0e94('0x52')]=_0x5d808f;}else{_0x158a0e[_0x0e94('0x53')]=moment(0x0)['format'](_0x0e94('0x54'));_0x158a0e[_0x0e94('0x52')]={};}return _0x158a0e;};}exports[_0x0e94('0x55')]=function(_0x43fa1c,_0x58eff8,_0xe51dd4){var _0x2c77c8=[];return db[_0x0e94('0x56')]['findAll']({'where':{'role':[_0x0e94('0x57'),'admin','user']},'attributes':['id',_0x0e94('0x58'),_0x0e94('0x2b'),_0x0e94('0x59'),_0x0e94('0x5a'),_0x0e94('0x5b'),_0x0e94('0x5c'),_0x0e94('0x5d'),_0x0e94('0x5e'),_0x0e94('0x5f')],'order':qs[_0x0e94('0x3c')](_0x0e94('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x0e94('0x61'),'attributes':['id',_0x0e94('0x2b'),_0x0e94('0x30')],'through':{'attributes':[]}}]})[_0x0e94('0x28')](function(_0x221897){if(_0x221897){var _0x2fc3b6=_0x43fa1c[_0x0e94('0x62')][_0x0e94('0x4f')]({'plain':!![]});if(!_0x2fc3b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fc3b6['role']===_0x0e94('0x62')){return db[_0x0e94('0x63')][_0x0e94('0x4a')]({'where':{'name':_0x0e94('0x64'),'userProfileId':_0x2fc3b6['userProfileId']},'raw':!![]})['then'](function(_0x16ddf4){if(_0x16ddf4){if(_0x16ddf4[_0x0e94('0x65')]===0x0){return db[_0x0e94('0x66')][_0x0e94('0x43')]({'where':{'sectionId':_0x16ddf4['id']},'raw':!![]})[_0x0e94('0x28')](function(_0x4c6fb4){var _0x2f2a54=[];if(_[_0x0e94('0x67')](_0x4c6fb4)){_0x2f2a54=_[_0x0e94('0x3e')](_0x221897,function(_0x49f2bf){if(_0x49f2bf[_0x0e94('0x59')]!==_0x0e94('0x57')){return _0x49f2bf;}});return _0x2f2a54;}else{for(var _0x22d471=0x0;_0x22d471<_0x221897[_0x0e94('0x49')];_0x22d471++){var _0x95c4a7=_0x221897[_0x22d471];if(_0x95c4a7[_0x0e94('0x59')]===_0x0e94('0x57')){var _0x4bf572=_[_0x0e94('0x4a')](_0x4c6fb4,function(_0x2fd2f2){return _0x2fd2f2[_0x0e94('0x68')]===_0x95c4a7['id'];});if(_0x4bf572)_0x2f2a54[_0x0e94('0x69')](_0x95c4a7);}else{_0x2f2a54['push'](_0x95c4a7);}}return _0x2f2a54;}});}else{return _0x221897;}}else{var _0x14d125=_[_0x0e94('0x3e')](_0x221897,function(_0x45a691){if(_0x45a691[_0x0e94('0x59')]!==_0x0e94('0x57')){return _0x45a691;}});return _0x14d125;}});}else{return _0x221897;}}})['then'](function(_0x2b5dea){var _0x5a59f1=[];if(_0x2b5dea){_0x2c77c8=_0x2b5dea;for(var _0x5ba9ee=0x0;_0x5ba9ee<_0x2b5dea[_0x0e94('0x49')];_0x5ba9ee+=0x1){_0x2c77c8[_0x5ba9ee]['messages']=[];_0x5a59f1[_0x0e94('0x69')](db[_0x0e94('0x2e')]['find']({'where':{'FromId':[_0x43fa1c[_0x0e94('0x62')]['id'],_0x2b5dea[_0x5ba9ee]['id']],'ToId':[_0x43fa1c[_0x0e94('0x62')]['id'],_0x2b5dea[_0x5ba9ee]['id']],'ChatGroupId':null},'attributes':['id',_0x0e94('0x51'),'FromId',_0x0e94('0x6a'),_0x0e94('0x6b'),_0x0e94('0x4c')],'order':qs[_0x0e94('0x3c')](_0x0e94('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0e94('0x28')](wrapUser(_0x2b5dea[_0x5ba9ee])));}return BPromise[_0x0e94('0x6d')](_0x5a59f1);}return[];})[_0x0e94('0x28')](function(_0x889e2){return{'rows':_0x889e2,'count':_0x889e2[_0x0e94('0x49')]};})['then'](respondWithResult(_0x58eff8,null))[_0x0e94('0x45')](handleError(_0x58eff8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 68416eb..4003e28 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 _0x34ec=['events','ChatInternalMessage','setMaxListeners','update','remove','emit','hook','exports'];(function(_0xcb9b8c,_0x2d843a){var _0x161cdd=function(_0x423a1e){while(--_0x423a1e){_0xcb9b8c['push'](_0xcb9b8c['shift']());}};_0x161cdd(++_0x2d843a);}(_0x34ec,0x180));var _0xc34e=function(_0x3b506a,_0x5960f5){_0x3b506a=_0x3b506a-0x0;var _0x4e12a2=_0x34ec[_0x3b506a];return _0x4e12a2;};'use strict';var EventEmitter=require(_0xc34e('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xc34e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc34e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc34e('0x3'),'afterDestroy':_0xc34e('0x4')};function emitEvent(_0x2ae20f){return function(_0x3b8c8e,_0x1fd0fc,_0x490110){ChatInternalMessageEvents[_0xc34e('0x5')](_0x2ae20f+':'+_0x3b8c8e['id'],_0x3b8c8e);ChatInternalMessageEvents['emit'](_0x2ae20f,_0x3b8c8e);_0x490110(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xc34e('0x6')](e,emitEvent(event));}}module[_0xc34e('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x746f=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x37cd8d,_0xfd4344){var _0x78e0e0=function(_0x569b72){while(--_0x569b72){_0x37cd8d['push'](_0x37cd8d['shift']());}};_0x78e0e0(++_0xfd4344);}(_0x746f,0x9c));var _0xf746=function(_0x2e34eb,_0x4a4a5d){_0x2e34eb=_0x2e34eb-0x0;var _0x13d3a9=_0x746f[_0x2e34eb];return _0x13d3a9;};'use strict';var EventEmitter=require(_0xf746('0x0'));var ChatInternalMessage=require(_0xf746('0x1'))['db'][_0xf746('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf746('0x3')](0x0);var events={'afterCreate':_0xf746('0x4'),'afterUpdate':_0xf746('0x5'),'afterDestroy':_0xf746('0x6')};function emitEvent(_0x1be178){return function(_0x357b8e,_0x150d39,_0x10974f){ChatInternalMessageEvents[_0xf746('0x7')](_0x1be178+':'+_0x357b8e['id'],_0x357b8e);ChatInternalMessageEvents[_0xf746('0x7')](_0x1be178,_0x357b8e);_0x10974f(null);};}for(var e in events){if(events[_0xf746('0x8')](e)){var event=events[e];ChatInternalMessage[_0xf746('0x9')](e,emitEvent(event));}}module[_0xf746('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4329a03..57784a0 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 _0x8be9=['./chatInternalMessage.attributes','chat_internal_messages','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb6da2d,_0x9dbbba){var _0x155572=function(_0x2ebdd3){while(--_0x2ebdd3){_0xb6da2d['push'](_0xb6da2d['shift']());}};_0x155572(++_0x9dbbba);}(_0x8be9,0x66));var _0x98be=function(_0x38de09,_0x171c51){_0x38de09=_0x38de09-0x0;var _0x1446ec=_0x8be9[_0x38de09];return _0x1446ec;};'use strict';var _=require('lodash');var util=require(_0x98be('0x0'));var logger=require(_0x98be('0x1'))(_0x98be('0x2'));var moment=require(_0x98be('0x3'));var BPromise=require(_0x98be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98be('0x5'));var rimraf=require(_0x98be('0x6'));var config=require(_0x98be('0x7'));var attributes=require(_0x98be('0x8'));module['exports']=function(_0x34d7b3,_0x34161b){return _0x34d7b3['define']('ChatInternalMessage',attributes,{'tableName':_0x98be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x14da=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x358802,_0x2e6e8d){var _0x4e46e2=function(_0x462a5d){while(--_0x462a5d){_0x358802['push'](_0x358802['shift']());}};_0x4e46e2(++_0x2e6e8d);}(_0x14da,0x106));var _0xa14d=function(_0x2409ad,_0x5f4078){_0x2409ad=_0x2409ad-0x0;var _0x2c24c9=_0x14da[_0x2409ad];return _0x2c24c9;};'use strict';var _=require(_0xa14d('0x0'));var util=require(_0xa14d('0x1'));var logger=require(_0xa14d('0x2'))('api');var moment=require(_0xa14d('0x3'));var BPromise=require(_0xa14d('0x4'));var rp=require(_0xa14d('0x5'));var fs=require('fs');var path=require(_0xa14d('0x6'));var rimraf=require(_0xa14d('0x7'));var config=require(_0xa14d('0x8'));var attributes=require(_0xa14d('0x9'));module['exports']=function(_0x100c9b,_0x561393){return _0x100c9b[_0xa14d('0xa')](_0xa14d('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa14d('0xc'),'collate':_0xa14d('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 73d1398..6057b57 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 _0x46f5=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x3d247a,_0x25d35e){var _0x40d987=function(_0x408628){while(--_0x408628){_0x3d247a['push'](_0x3d247a['shift']());}};_0x40d987(++_0x25d35e);}(_0x46f5,0x16a));var _0x546f=function(_0x8969a3,_0x125fee){_0x8969a3=_0x8969a3-0x0;var _0x11390e=_0x46f5[_0x8969a3];return _0x11390e;};'use strict';var _=require(_0x546f('0x0'));var util=require(_0x546f('0x1'));var moment=require(_0x546f('0x2'));var BPromise=require(_0x546f('0x3'));var rs=require(_0x546f('0x4'));var fs=require('fs');var Redis=require(_0x546f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x546f('0x6'))(_0x546f('0x7'));var config=require(_0x546f('0x8'));var jayson=require(_0x546f('0x9'));var client=jayson[_0x546f('0xa')]['http']({'port':0x232a});config[_0x546f('0xb')]=_[_0x546f('0xc')](config[_0x546f('0xb')],{'host':_0x546f('0xd'),'port':0x18eb});var socket=require(_0x546f('0xe'))(new Redis(config[_0x546f('0xb')]));require(_0x546f('0xf'))[_0x546f('0x10')](socket);function respondWithRpcPromise(_0x45f487,_0x523dec,_0x2ca912){return new BPromise(function(_0x4b429a,_0x281ab5){return client[_0x546f('0x11')](_0x45f487,_0x2ca912)[_0x546f('0x12')](function(_0x2a7447){logger[_0x546f('0x13')](_0x546f('0x14'),_0x523dec,_0x546f('0x15'));logger['debug'](_0x546f('0x16'),_0x523dec,_0x546f('0x15'),JSON['stringify'](_0x2a7447));if(_0x2a7447[_0x546f('0x17')]){if(_0x2a7447[_0x546f('0x17')][_0x546f('0x18')]===0x1f4){logger[_0x546f('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x523dec,_0x2a7447[_0x546f('0x17')]['message']);return _0x281ab5(_0x2a7447[_0x546f('0x17')]['message']);}logger[_0x546f('0x17')](_0x546f('0x14'),_0x523dec,_0x2a7447[_0x546f('0x17')][_0x546f('0x19')]);return _0x4b429a(_0x2a7447[_0x546f('0x17')][_0x546f('0x19')]);}else{logger[_0x546f('0x13')](_0x546f('0x14'),_0x523dec,_0x546f('0x15'));_0x4b429a(_0x2a7447[_0x546f('0x1a')][_0x546f('0x19')]);}})['catch'](function(_0x472729){logger[_0x546f('0x17')](_0x546f('0x14'),_0x523dec,_0x472729);_0x281ab5(_0x472729);});});} \ No newline at end of file +var _0xaa50=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5e5605,_0x478243){var _0x5371b4=function(_0x30420b){while(--_0x30420b){_0x5e5605['push'](_0x5e5605['shift']());}};_0x5371b4(++_0x478243);}(_0xaa50,0xd9));var _0x0aa5=function(_0x4d262f,_0x347e51){_0x4d262f=_0x4d262f-0x0;var _0x49caaf=_0xaa50[_0x4d262f];return _0x49caaf;};'use strict';var _=require(_0x0aa5('0x0'));var util=require(_0x0aa5('0x1'));var moment=require('moment');var BPromise=require(_0x0aa5('0x2'));var rs=require(_0x0aa5('0x3'));var fs=require('fs');var Redis=require(_0x0aa5('0x4'));var db=require(_0x0aa5('0x5'))['db'];var utils=require(_0x0aa5('0x6'));var logger=require('../../config/logger')(_0x0aa5('0x7'));var config=require(_0x0aa5('0x8'));var jayson=require(_0x0aa5('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0aa5('0xa')]=_[_0x0aa5('0xb')](config[_0x0aa5('0xa')],{'host':_0x0aa5('0xc'),'port':0x18eb});var socket=require(_0x0aa5('0xd'))(new Redis(config['redis']));require(_0x0aa5('0xe'))[_0x0aa5('0xf')](socket);function respondWithRpcPromise(_0x4e3ad5,_0x337fd3,_0x42de86){return new BPromise(function(_0x54f431,_0x837609){return client['request'](_0x4e3ad5,_0x42de86)[_0x0aa5('0x10')](function(_0x9bd777){logger[_0x0aa5('0x11')](_0x0aa5('0x12'),_0x337fd3,_0x0aa5('0x13'));logger['debug'](_0x0aa5('0x14'),_0x337fd3,_0x0aa5('0x13'),JSON[_0x0aa5('0x15')](_0x9bd777));if(_0x9bd777[_0x0aa5('0x16')]){if(_0x9bd777[_0x0aa5('0x16')]['code']===0x1f4){logger[_0x0aa5('0x16')](_0x0aa5('0x12'),_0x337fd3,_0x9bd777[_0x0aa5('0x16')]['message']);return _0x837609(_0x9bd777[_0x0aa5('0x16')]['message']);}logger[_0x0aa5('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x337fd3,_0x9bd777[_0x0aa5('0x16')][_0x0aa5('0x17')]);return _0x54f431(_0x9bd777[_0x0aa5('0x16')]['message']);}else{logger[_0x0aa5('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x337fd3,'request\x20sent');_0x54f431(_0x9bd777['result'][_0x0aa5('0x17')]);}})['catch'](function(_0x4e3b45){logger[_0x0aa5('0x16')](_0x0aa5('0x12'),_0x337fd3,_0x4e3b45);_0x837609(_0x4e3b45);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ef18bee..6ff3b28 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 _0x447b=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit'];(function(_0x19bccb,_0x319cf4){var _0x1e3314=function(_0x2250c4){while(--_0x2250c4){_0x19bccb['push'](_0x19bccb['shift']());}};_0x1e3314(++_0x319cf4);}(_0x447b,0xe4));var _0xb447=function(_0x1a819a,_0xfd267b){_0x1a819a=_0x1a819a-0x0;var _0x17d527=_0x447b[_0x1a819a];return _0x17d527;};'use strict';var ChatInternalMessageEvents=require(_0xb447('0x0'));var events=[_0xb447('0x1'),'remove',_0xb447('0x2')];function createListener(_0x253864,_0x2a45d2){return function(_0x2108f4){_0x2a45d2[_0xb447('0x3')](_0x253864,_0x2108f4);};}function removeListener(_0xf8a88b,_0x161c5d){return function(){ChatInternalMessageEvents[_0xb447('0x4')](_0xf8a88b,_0x161c5d);};}exports[_0xb447('0x5')]=function(_0x1f132a){for(var _0x514a91=0x0,_0x4e0f42=events[_0xb447('0x6')];_0x514a91<_0x4e0f42;_0x514a91++){var _0x588700=events[_0x514a91];var _0x3ea00b=createListener(_0xb447('0x7')+_0x588700,_0x1f132a);ChatInternalMessageEvents['on'](_0x588700,_0x3ea00b);}}; \ No newline at end of file +var _0xafe6=['register','length','./chatInternalMessage.events','save','removeListener'];(function(_0x1d5381,_0xe152e3){var _0xa548b1=function(_0x1949cc){while(--_0x1949cc){_0x1d5381['push'](_0x1d5381['shift']());}};_0xa548b1(++_0xe152e3);}(_0xafe6,0xac));var _0x6afe=function(_0x5ad7bd,_0x2af00f){_0x5ad7bd=_0x5ad7bd-0x0;var _0x168b76=_0xafe6[_0x5ad7bd];return _0x168b76;};'use strict';var ChatInternalMessageEvents=require(_0x6afe('0x0'));var events=[_0x6afe('0x1'),'remove','update'];function createListener(_0x45de15,_0xa75765){return function(_0x5a03a1){_0xa75765['emit'](_0x45de15,_0x5a03a1);};}function removeListener(_0x40d720,_0x176f85){return function(){ChatInternalMessageEvents[_0x6afe('0x2')](_0x40d720,_0x176f85);};}exports[_0x6afe('0x3')]=function(_0x2ce302){for(var _0x4898bb=0x0,_0x302747=events[_0x6afe('0x4')];_0x4898bb<_0x302747;_0x4898bb++){var _0x59badb=events[_0x4898bb];var _0x1d3c11=createListener('chatInternalMessage:'+_0x59badb,_0x2ce302);ChatInternalMessageEvents['on'](_0x59badb,_0x1d3c11);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4c77479..b26d421 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x57b205,_0x48a4a1){var _0x4548ca=function(_0x17ac4c){while(--_0x17ac4c){_0x57b205['push'](_0x57b205['shift']());}};_0x4548ca(++_0x48a4a1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x4e9cef,_0x192ebe){var _0x11bd98=function(_0x1140fc){while(--_0x1140fc){_0x4e9cef['push'](_0x4e9cef['shift']());}};_0x11bd98(++_0x192ebe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ccfd0a9..b81c1d8 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 _0x29d2=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x4fc212,_0x1087aa){var _0x252317=function(_0x6facac){while(--_0x6facac){_0x4fc212['push'](_0x4fc212['shift']());}};_0x252317(++_0x1087aa);}(_0x29d2,0x18c));var _0x229d=function(_0x3f8746,_0x3361c1){_0x3f8746=_0x3f8746-0x0;var _0x39496a=_0x29d2[_0x3f8746];return _0x39496a;};'use strict';var Sequelize=require(_0x229d('0x0'));module[_0x229d('0x1')]={'body':{'type':Sequelize[_0x229d('0x2')](_0x229d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x229d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x229d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x229d('0x5')]('in',_0x229d('0x6')),'defaultValue':_0x229d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x229d('0x7')]}}; \ No newline at end of file +var _0x5fae=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x5fae,0x9c));var _0xe5fa=function(_0x5084fd,_0x5427dc){_0x5084fd=_0x5084fd-0x0;var _0x4ad1c5=_0x5fae[_0x5084fd];return _0x4ad1c5;};'use strict';var Sequelize=require(_0xe5fa('0x0'));module[_0xe5fa('0x1')]={'body':{'type':Sequelize[_0xe5fa('0x2')](_0xe5fa('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe5fa('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe5fa('0x5')]('in','out'),'defaultValue':_0xe5fa('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe5fa('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 61b2e44..966504b 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 _0x308f=['filter','merge','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','params','filters','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteractionId','isNil','read1stAt','interaction','role','null','manual','channel','acceptmessage','parse','agent','ChatInteraction','RejectMessage','rejectMessage','interface','SIP/%s','event','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','http','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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','json','apply','reject','update','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x308f,0x19f));var _0xf308=function(_0x39e45c,_0x2d8816){_0x39e45c=_0x39e45c-0x0;var _0x212aae=_0x308f[_0x39e45c];return _0x212aae;};'use strict';var pdf=require(_0xf308('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf308('0x1'));var zipdir=require(_0xf308('0x2'));var jsonpatch=require(_0xf308('0x3'));var rp=require('request-promise');var moment=require(_0xf308('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf308('0x5'));var util=require(_0xf308('0x6'));var path=require(_0xf308('0x7'));var sox=require(_0xf308('0x8'));var csv=require('to-csv');var ejs=require(_0xf308('0x9'));var fs=require('fs');var _=require(_0xf308('0xa'));var squel=require(_0xf308('0xb'));var crypto=require(_0xf308('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf308('0xd'));var toCsv=require(_0xf308('0xe'));var querystring=require(_0xf308('0xf'));var Papa=require(_0xf308('0x10'));var Redis=require('ioredis');var authService=require(_0xf308('0x11'));var qs=require(_0xf308('0x12'));var as=require(_0xf308('0x13'));var hardwareService=require(_0xf308('0x14'));var logger=require(_0xf308('0x15'))(_0xf308('0x16'));var utils=require(_0xf308('0x17'));var config=require('../../config/environment');var db=require(_0xf308('0x18'))['db'];config[_0xf308('0x19')]=_[_0xf308('0x1a')](config[_0xf308('0x19')],{'host':_0xf308('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf308('0x19')]));require(_0xf308('0x1c'))[_0xf308('0x1d')](socket);var jayson=require(_0xf308('0x1e'));var client=jayson['client'][_0xf308('0x1f')]({'port':0x232c});var client9002=jayson[_0xf308('0x20')][_0xf308('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x31199b,_0x1b7019,_0x1ba60d){if(_0x1ba60d){var _0x51d5f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51d5f1[_0xf308('0x21')](_0x1b7019)){return _0x31199b;}else{throw new db[(_0xf308('0x22'))][(_0xf308('0x23'))](_0xf308('0x24'));}}else{return _0x31199b;}}function respondWithRpcPromise(_0x18674f,_0x1a08c7,_0x56ed64,_0x4461ac){return new BPromise(function(_0x5ef9da,_0x1df22d){var _0x5282f4=_0x4461ac||client;return _0x5282f4[_0xf308('0x25')](_0x18674f,_0x56ed64)[_0xf308('0x26')](function(_0x267e6a){logger[_0xf308('0x27')](_0xf308('0x28'),_0x1a08c7,_0xf308('0x29'));logger[_0xf308('0x2a')](_0xf308('0x2b'),_0x1a08c7,'request\x20sent',JSON[_0xf308('0x2c')](_0x267e6a));if(_0x267e6a[_0xf308('0x2d')]){if(_0x267e6a['error'][_0xf308('0x2e')]===0x1f4){logger[_0xf308('0x2d')](_0xf308('0x28'),_0x1a08c7,_0x267e6a[_0xf308('0x2d')][_0xf308('0x2f')]);return _0x1df22d(_0x267e6a[_0xf308('0x2d')]['message']);}logger['error'](_0xf308('0x28'),_0x1a08c7,_0x267e6a[_0xf308('0x2d')]['message']);return _0x5ef9da(_0x267e6a[_0xf308('0x2d')][_0xf308('0x2f')]);}else{logger['info'](_0xf308('0x28'),_0x1a08c7,_0xf308('0x29'));_0x5ef9da(_0x267e6a[_0xf308('0x30')][_0xf308('0x2f')]);}})[_0xf308('0x31')](function(_0x625c02){logger[_0xf308('0x2d')](_0xf308('0x28'),_0x1a08c7,_0x625c02);_0x1df22d(_0x625c02);});});}function respondWithStatusCode(_0xf30733,_0x3777b2){_0x3777b2=_0x3777b2||0xcc;return function(_0x55e255){if(_0x55e255){return _0xf30733[_0xf308('0x32')](_0x3777b2);}return _0xf30733[_0xf308('0x33')](_0x3777b2)[_0xf308('0x34')]();};}function respondWithResult(_0x32acc5,_0x47a451){_0x47a451=_0x47a451||0xc8;return function(_0x535404){if(_0x535404){return _0x32acc5['status'](_0x47a451)['json'](_0x535404);}};}function respondWithFilteredResult(_0x518aca,_0x457e8c){return function(_0x299e6b){if(_0x299e6b){var _0x52ec87=_0x299e6b[_0xf308('0x35')],_0x542663=_0x457e8c[_0xf308('0x36')],_0x27ffb2=_0x457e8c[_0xf308('0x36')]+_0x457e8c[_0xf308('0x37')],_0x2b6830;if(_0x27ffb2>=_0x52ec87){_0x27ffb2=_0x52ec87;_0x2b6830=0xc8;}else{_0x2b6830=0xce;}_0x518aca[_0xf308('0x33')](_0x2b6830);return _0x518aca['set']('Content-Range',_0x542663+'-'+_0x27ffb2+'/'+_0x52ec87)[_0xf308('0x38')](_0x299e6b);}return null;};}function patchUpdates(_0x41b394){return function(_0x469457){try{jsonpatch[_0xf308('0x39')](_0x469457,_0x41b394,!![]);}catch(_0x3c1c6a){return BPromise[_0xf308('0x3a')](_0x3c1c6a);}return _0x469457['save']();};}function saveUpdates(_0x390ef6,_0x4862ed){return function(_0x3cf270){if(_0x3cf270){return _0x3cf270[_0xf308('0x3b')](_0x390ef6)[_0xf308('0x26')](function(_0x2eea1f){return _0x2eea1f;});}return null;};}function removeEntity(_0x5c663a,_0x342bc9){return function(_0x261605){if(_0x261605){return _0x261605['destroy']()['then'](function(){_0x5c663a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x130db5,_0x2a41d9){return function(_0x2a773a){if(!_0x2a773a){_0x130db5['sendStatus'](0x194);}return _0x2a773a;};}function handleError(_0x2f6db6,_0x36ba2b){_0x36ba2b=_0x36ba2b||0x1f4;return function(_0x23ba4d){logger[_0xf308('0x2d')](_0x23ba4d[_0xf308('0x3c')]);if(_0x23ba4d[_0xf308('0x3d')]){delete _0x23ba4d[_0xf308('0x3d')];}_0x2f6db6[_0xf308('0x33')](_0x36ba2b)[_0xf308('0x3e')](_0x23ba4d);};}exports[_0xf308('0x3f')]=function(_0x1d4f6d,_0x2209ca){var _0x3729c4={},_0x311094={},_0x517e5f={'count':0x0,'rows':[]};var _0x5bdbff=_['map'](db['ChatMessage'][_0xf308('0x40')],function(_0x122c26){return{'name':_0x122c26[_0xf308('0x41')],'type':_0x122c26[_0xf308('0x42')][_0xf308('0x43')]};});_0x311094['model']=_[_0xf308('0x44')](_0x5bdbff,_0xf308('0x3d'));_0x311094[_0xf308('0x45')]=_[_0xf308('0x46')](_0x1d4f6d[_0xf308('0x45')]);_0x311094['filters']=_[_0xf308('0x47')](_0x311094[_0xf308('0x48')],_0x311094['query']);_0x3729c4[_0xf308('0x49')]=_['intersection'](_0x311094['model'],qs['fields'](_0x1d4f6d[_0xf308('0x45')][_0xf308('0x4a')]));_0x3729c4[_0xf308('0x49')]=_0x3729c4['attributes'][_0xf308('0x4b')]?_0x3729c4['attributes']:_0x311094[_0xf308('0x48')];if(!_0x1d4f6d[_0xf308('0x45')]['hasOwnProperty'](_0xf308('0x4c'))){_0x3729c4[_0xf308('0x37')]=qs[_0xf308('0x37')](_0x1d4f6d[_0xf308('0x45')][_0xf308('0x37')]);_0x3729c4[_0xf308('0x36')]=qs[_0xf308('0x36')](_0x1d4f6d[_0xf308('0x45')]['offset']);}_0x3729c4[_0xf308('0x4d')]=qs[_0xf308('0x4e')](_0x1d4f6d[_0xf308('0x45')][_0xf308('0x4e')]);_0x3729c4[_0xf308('0x4f')]=qs['filters'](_[_0xf308('0x50')](_0x1d4f6d[_0xf308('0x45')],_0x311094['filters']),_0x5bdbff);if(_0x1d4f6d['query'][_0xf308('0x51')]){_0x3729c4[_0xf308('0x4f')]=_[_0xf308('0x52')](_0x3729c4[_0xf308('0x4f')],{'$or':_['map'](_0x5bdbff,function(_0x4b3961){if(_0x4b3961['type']!==_0xf308('0x53')){var _0x833eb2={};_0x833eb2[_0x4b3961[_0xf308('0x3d')]]={'$like':'%'+_0x1d4f6d[_0xf308('0x45')][_0xf308('0x51')]+'%'};return _0x833eb2;}})});}_0x3729c4=_[_0xf308('0x52')]({},_0x3729c4,_0x1d4f6d['options']);var _0x513937={'where':_0x3729c4[_0xf308('0x4f')]};return db[_0xf308('0x54')][_0xf308('0x35')](_0x513937)[_0xf308('0x26')](function(_0x559bb6){_0x517e5f[_0xf308('0x35')]=_0x559bb6;if(_0x1d4f6d[_0xf308('0x45')][_0xf308('0x55')]){_0x3729c4[_0xf308('0x56')]=[{'all':!![]}];}return db['ChatMessage'][_0xf308('0x57')](_0x3729c4);})[_0xf308('0x26')](function(_0x6ffcc9){_0x517e5f[_0xf308('0x58')]=_0x6ffcc9;return _0x517e5f;})[_0xf308('0x26')](respondWithFilteredResult(_0x2209ca,_0x3729c4))['catch'](handleError(_0x2209ca,null));};exports[_0xf308('0x59')]=function(_0x524f60,_0x302a62){var _0x1c9507={'raw':!![],'where':{'id':_0x524f60[_0xf308('0x5a')]['id']}},_0x379242={};_0x379242[_0xf308('0x48')]=_['keys'](db[_0xf308('0x54')]['rawAttributes']);_0x379242[_0xf308('0x45')]=_['keys'](_0x524f60[_0xf308('0x45')]);_0x379242[_0xf308('0x5b')]=_[_0xf308('0x47')](_0x379242[_0xf308('0x48')],_0x379242[_0xf308('0x45')]);_0x1c9507[_0xf308('0x49')]=_[_0xf308('0x47')](_0x379242[_0xf308('0x48')],qs['fields'](_0x524f60[_0xf308('0x45')][_0xf308('0x4a')]));_0x1c9507['attributes']=_0x1c9507[_0xf308('0x49')][_0xf308('0x4b')]?_0x1c9507['attributes']:_0x379242['model'];if(_0x524f60[_0xf308('0x45')][_0xf308('0x55')]){_0x1c9507[_0xf308('0x56')]=[{'all':!![]}];}_0x1c9507=_[_0xf308('0x52')]({},_0x1c9507,_0x524f60['options']);return db[_0xf308('0x54')][_0xf308('0x5c')](_0x1c9507)[_0xf308('0x26')](handleEntityNotFound(_0x302a62,null))[_0xf308('0x26')](respondWithResult(_0x302a62,null))['catch'](handleError(_0x302a62,null));};exports[_0xf308('0x5d')]=function(_0x502baa,_0x5b1b63){return db[_0xf308('0x54')][_0xf308('0x5d')](_0x502baa[_0xf308('0x5e')],{})['then'](respondWithResult(_0x5b1b63,0xc9))['catch'](handleError(_0x5b1b63,null));};exports['update']=function(_0x36e20c,_0xa0e499){if(_0x36e20c['body']['id']){delete _0x36e20c['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x36e20c[_0xf308('0x5a')]['id']}})['then'](handleEntityNotFound(_0xa0e499,null))[_0xf308('0x26')](saveUpdates(_0x36e20c['body'],null))['then'](respondWithResult(_0xa0e499,null))[_0xf308('0x31')](handleError(_0xa0e499,null));};exports['destroy']=function(_0x243ccd,_0x3d4f29){return db[_0xf308('0x54')][_0xf308('0x5c')]({'where':{'id':_0x243ccd[_0xf308('0x5a')]['id']}})[_0xf308('0x26')](handleEntityNotFound(_0x3d4f29,null))[_0xf308('0x26')](removeEntity(_0x3d4f29,null))[_0xf308('0x31')](handleError(_0x3d4f29,null));};exports[_0xf308('0x5f')]=function(_0x4d251a,_0x470bdb){return db[_0xf308('0x54')][_0xf308('0x5f')]()[_0xf308('0x26')](respondWithResult(_0x470bdb,null))[_0xf308('0x31')](handleError(_0x470bdb,null));};var interaction_log=require(_0xf308('0x15'))(_0xf308('0x60'));exports[_0xf308('0x61')]=function(_0x438797,_0x1c977d,_0xa33cc3){var _0x3b2a41={'channel':_0xf308('0x62')};if(_0x438797[_0xf308('0x5e')]['id']){delete _0x438797[_0xf308('0x5e')]['id'];}_0x438797[_0xf308('0x5e')][_0xf308('0x63')]=!![];_0x438797['body']['readAt']=moment()[_0xf308('0x64')](_0xf308('0x65'));_0x438797[_0xf308('0x5e')][_0xf308('0x66')]=_0x438797[_0xf308('0x5e')][_0xf308('0x66')]||_0x438797[_0xf308('0x67')]['id'];return db[_0xf308('0x54')][_0xf308('0x5c')]({'where':{'id':_0x438797[_0xf308('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xf308('0x68')],'as':'Contact'}]})[_0xf308('0x26')](handleEntityNotFound(_0x1c977d,null))[_0xf308('0x26')](saveUpdates(_0x438797['body'],null))[_0xf308('0x26')](function(_0xc5e5f2){if(_0xc5e5f2){_0x3b2a41[_0xf308('0x2f')]=_0xc5e5f2[_0xf308('0x69')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0xc5e5f2[_0xf308('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x1c977d,null))[_0xf308('0x26')](function(_0xb59429){if(_0xb59429){return _0xb59429[_0xf308('0x3b')]({'UserId':_0x438797[_0xf308('0x5e')]['UserId'],'read1stAt':_[_0xf308('0x6b')](_0xb59429[_0xf308('0x6c')])?moment()['format'](_0xf308('0x65')):undefined});}return null;})['then'](function(_0x1da777){if(_0x1da777){_0x3b2a41[_0xf308('0x6d')]=_0x1da777[_0xf308('0x69')]({'plain':!![]});interaction_log[_0xf308('0x27')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x438797['user']['id'],_0x438797[_0xf308('0x67')][_0xf308('0x3d')],_0x438797[_0xf308('0x67')][_0xf308('0x6e')],_0x3b2a41[_0xf308('0x6d')]['id'],_0x438797['body']?JSON[_0xf308('0x2c')](_0x438797[_0xf308('0x5e')]):_0xf308('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3b2a41);}return null;})[_0xf308('0x26')](function(_0x192630){if(_0x192630){if(_0x438797[_0xf308('0x5e')][_0xf308('0x70')]){_0x3b2a41['message']['interface']=util[_0xf308('0x64')]('SIP/%s',_0x438797[_0xf308('0x67')][_0xf308('0x3d')]);_0x3b2a41[_0xf308('0x2f')][_0xf308('0x71')]=_0x3b2a41[_0xf308('0x71')];_0x3b2a41[_0xf308('0x2f')]['event']=_0xf308('0x61');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xf308('0x72'),'message':_[_0xf308('0x52')](_0x3b2a41[_0xf308('0x2f')],JSON[_0xf308('0x73')](_0x3b2a41[_0xf308('0x6d')]['formData']))},client9002)[_0xf308('0x26')](function(){return _0x3b2a41;});}return _0x3b2a41;}return null;})[_0xf308('0x26')](respondWithResult(_0x1c977d,null))['catch'](handleError(_0x1c977d,null));};var interaction_log=require(_0xf308('0x15'))(_0xf308('0x60'));exports[_0xf308('0x3a')]=function(_0x40d403,_0x2414f0,_0x1645f9){var _0x16d399={'agent':{},'channel':_0xf308('0x62')};if(_0x40d403[_0xf308('0x5e')]['id']){delete _0x40d403[_0xf308('0x5e')]['id'];}_0x40d403['body'][_0xf308('0x66')]=_0x40d403[_0xf308('0x5e')][_0xf308('0x66')]||_0x40d403[_0xf308('0x67')]['id'];_0x16d399[_0xf308('0x74')]['id']=_0x40d403['body'][_0xf308('0x66')];return db[_0xf308('0x54')][_0xf308('0x5c')]({'where':{'id':_0x40d403[_0xf308('0x5a')]['id'],'UserId':null}})[_0xf308('0x26')](handleEntityNotFound(_0x2414f0,null))[_0xf308('0x26')](function(_0x176d73){if(_0x176d73){_0x16d399[_0xf308('0x2f')]=_0x176d73['get']({'plain':!![]});return db[_0xf308('0x75')][_0xf308('0x5c')]({'where':{'id':_0x176d73['ChatInteractionId']}});}return null;})[_0xf308('0x26')](handleEntityNotFound(_0x2414f0,null))['then'](function(_0x3d54c9){if(_0x3d54c9){_0x16d399['interaction']=_0x3d54c9[_0xf308('0x69')]({'plain':!![]});interaction_log[_0xf308('0x27')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40d403['user']['id'],_0x40d403['user'][_0xf308('0x3d')],_0x40d403[_0xf308('0x67')]['role'],_0x16d399['interaction']['id'],_0x40d403['body']?JSON[_0xf308('0x2c')](_0x40d403[_0xf308('0x5e')]):_0xf308('0x6f'));return respondWithRpcPromise(_0xf308('0x76'),_0xf308('0x77'),_0x16d399);}return null;})[_0xf308('0x26')](function(_0x44e718){if(_0x44e718){_0x44e718['message'][_0xf308('0x78')]=util[_0xf308('0x64')](_0xf308('0x79'),_0x40d403[_0xf308('0x67')][_0xf308('0x3d')]);_0x44e718['message'][_0xf308('0x71')]=_0x16d399[_0xf308('0x71')];_0x44e718[_0xf308('0x2f')][_0xf308('0x7a')]=_0xf308('0x3a');respondWithRpcPromise('EventManager','EventManager',{'event':_0xf308('0x7b'),'message':_0x44e718[_0xf308('0x2f')]},client9002);return _0x16d399;}return null;})[_0xf308('0x26')](respondWithResult(_0x2414f0,null))[_0xf308('0x31')](handleError(_0x2414f0,null));}; \ No newline at end of file +var _0xf809=['index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteractionId','isNil','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','formData','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','name'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xf809,0x1b3));var _0x9f80=function(_0x4ddcec,_0x42870a){_0x4ddcec=_0x4ddcec-0x0;var _0x47fb0f=_0xf809[_0x4ddcec];return _0x47fb0f;};'use strict';var pdf=require(_0x9f80('0x0'));var emlformat=require(_0x9f80('0x1'));var rimraf=require(_0x9f80('0x2'));var zipdir=require(_0x9f80('0x3'));var jsonpatch=require(_0x9f80('0x4'));var rp=require(_0x9f80('0x5'));var moment=require('moment');var BPromise=require(_0x9f80('0x6'));var Mustache=require('mustache');var util=require(_0x9f80('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9f80('0x8'));var ejs=require(_0x9f80('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f80('0xa'));var crypto=require(_0x9f80('0xb'));var jsforce=require(_0x9f80('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9f80('0xd'));var Papa=require(_0x9f80('0xe'));var Redis=require('ioredis');var authService=require(_0x9f80('0xf'));var qs=require(_0x9f80('0x10'));var as=require(_0x9f80('0x11'));var hardwareService=require(_0x9f80('0x12'));var logger=require(_0x9f80('0x13'))(_0x9f80('0x14'));var utils=require(_0x9f80('0x15'));var config=require(_0x9f80('0x16'));var db=require(_0x9f80('0x17'))['db'];config['redis']=_[_0x9f80('0x18')](config[_0x9f80('0x19')],{'host':_0x9f80('0x1a'),'port':0x18eb});var socket=require(_0x9f80('0x1b'))(new Redis(config['redis']));require(_0x9f80('0x1c'))[_0x9f80('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9f80('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1cad35,_0x33747c,_0xed2efc){if(_0xed2efc){var _0x2f6fb0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f6fb0[_0x9f80('0x1f')](_0x33747c)){return _0x1cad35;}else{throw new db[(_0x9f80('0x20'))][(_0x9f80('0x21'))](_0x9f80('0x22'));}}else{return _0x1cad35;}}function respondWithRpcPromise(_0x4bc9f2,_0x5ba27b,_0x59d4ad,_0x5da970){return new BPromise(function(_0xcfbc72,_0x3d3520){var _0x41a4fa=_0x5da970||client;return _0x41a4fa['request'](_0x4bc9f2,_0x59d4ad)['then'](function(_0x4d05eb){logger['info'](_0x9f80('0x23'),_0x5ba27b,_0x9f80('0x24'));logger['debug'](_0x9f80('0x25'),_0x5ba27b,_0x9f80('0x24'),JSON['stringify'](_0x4d05eb));if(_0x4d05eb[_0x9f80('0x26')]){if(_0x4d05eb['error'][_0x9f80('0x27')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5ba27b,_0x4d05eb[_0x9f80('0x26')][_0x9f80('0x28')]);return _0x3d3520(_0x4d05eb['error'][_0x9f80('0x28')]);}logger[_0x9f80('0x26')]('ChatMessage,\x20%s,\x20%s',_0x5ba27b,_0x4d05eb[_0x9f80('0x26')][_0x9f80('0x28')]);return _0xcfbc72(_0x4d05eb[_0x9f80('0x26')]['message']);}else{logger[_0x9f80('0x29')](_0x9f80('0x23'),_0x5ba27b,_0x9f80('0x24'));_0xcfbc72(_0x4d05eb[_0x9f80('0x2a')][_0x9f80('0x28')]);}})[_0x9f80('0x2b')](function(_0x5f3d4e){logger[_0x9f80('0x26')](_0x9f80('0x23'),_0x5ba27b,_0x5f3d4e);_0x3d3520(_0x5f3d4e);});});}function respondWithStatusCode(_0x417507,_0x2fcaf8){_0x2fcaf8=_0x2fcaf8||0xcc;return function(_0x5dc7b5){if(_0x5dc7b5){return _0x417507[_0x9f80('0x2c')](_0x2fcaf8);}return _0x417507[_0x9f80('0x2d')](_0x2fcaf8)[_0x9f80('0x2e')]();};}function respondWithResult(_0x1fa3e4,_0x4a03b4){_0x4a03b4=_0x4a03b4||0xc8;return function(_0x1c3f8d){if(_0x1c3f8d){return _0x1fa3e4['status'](_0x4a03b4)[_0x9f80('0x2f')](_0x1c3f8d);}};}function respondWithFilteredResult(_0x5a8372,_0x2d6cdf){return function(_0x4e4363){if(_0x4e4363){var _0x4ed3e1=_0x4e4363['count'],_0x7b3856=_0x2d6cdf['offset'],_0x597c00=_0x2d6cdf[_0x9f80('0x30')]+_0x2d6cdf['limit'],_0x2b4244;if(_0x597c00>=_0x4ed3e1){_0x597c00=_0x4ed3e1;_0x2b4244=0xc8;}else{_0x2b4244=0xce;}_0x5a8372['status'](_0x2b4244);return _0x5a8372[_0x9f80('0x31')](_0x9f80('0x32'),_0x7b3856+'-'+_0x597c00+'/'+_0x4ed3e1)[_0x9f80('0x2f')](_0x4e4363);}return null;};}function patchUpdates(_0x471ad9){return function(_0x3ad64c){try{jsonpatch['apply'](_0x3ad64c,_0x471ad9,!![]);}catch(_0x5a9916){return BPromise[_0x9f80('0x33')](_0x5a9916);}return _0x3ad64c[_0x9f80('0x34')]();};}function saveUpdates(_0x4ebf63,_0x59bb88){return function(_0x5a8ced){if(_0x5a8ced){return _0x5a8ced[_0x9f80('0x35')](_0x4ebf63)[_0x9f80('0x36')](function(_0x4699c4){return _0x4699c4;});}return null;};}function removeEntity(_0x444403,_0x10c37c){return function(_0x53cc7b){if(_0x53cc7b){return _0x53cc7b[_0x9f80('0x37')]()['then'](function(){_0x444403[_0x9f80('0x2d')](0xcc)[_0x9f80('0x2e')]();});}};}function handleEntityNotFound(_0x3f5982,_0x8a6600){return function(_0x4639b3){if(!_0x4639b3){_0x3f5982['sendStatus'](0x194);}return _0x4639b3;};}function handleError(_0x593242,_0x1cc428){_0x1cc428=_0x1cc428||0x1f4;return function(_0x2d457d){logger[_0x9f80('0x26')](_0x2d457d['stack']);if(_0x2d457d[_0x9f80('0x38')]){delete _0x2d457d[_0x9f80('0x38')];}_0x593242[_0x9f80('0x2d')](_0x1cc428)['send'](_0x2d457d);};}exports[_0x9f80('0x39')]=function(_0x1ed35d,_0xdd09dd){var _0x20f9ac={},_0x172870={},_0x4afc04={'count':0x0,'rows':[]};var _0x5be54d=_[_0x9f80('0x3a')](db[_0x9f80('0x3b')][_0x9f80('0x3c')],function(_0x174caa){return{'name':_0x174caa[_0x9f80('0x3d')],'type':_0x174caa[_0x9f80('0x3e')][_0x9f80('0x3f')]};});_0x172870[_0x9f80('0x40')]=_[_0x9f80('0x3a')](_0x5be54d,'name');_0x172870[_0x9f80('0x41')]=_[_0x9f80('0x42')](_0x1ed35d[_0x9f80('0x41')]);_0x172870[_0x9f80('0x43')]=_[_0x9f80('0x44')](_0x172870[_0x9f80('0x40')],_0x172870['query']);_0x20f9ac['attributes']=_[_0x9f80('0x44')](_0x172870['model'],qs[_0x9f80('0x45')](_0x1ed35d['query'][_0x9f80('0x45')]));_0x20f9ac[_0x9f80('0x46')]=_0x20f9ac[_0x9f80('0x46')]['length']?_0x20f9ac[_0x9f80('0x46')]:_0x172870[_0x9f80('0x40')];if(!_0x1ed35d[_0x9f80('0x41')]['hasOwnProperty'](_0x9f80('0x47'))){_0x20f9ac[_0x9f80('0x48')]=qs[_0x9f80('0x48')](_0x1ed35d[_0x9f80('0x41')][_0x9f80('0x48')]);_0x20f9ac['offset']=qs[_0x9f80('0x30')](_0x1ed35d['query'][_0x9f80('0x30')]);}_0x20f9ac[_0x9f80('0x49')]=qs[_0x9f80('0x4a')](_0x1ed35d[_0x9f80('0x41')]['sort']);_0x20f9ac[_0x9f80('0x4b')]=qs[_0x9f80('0x43')](_['pick'](_0x1ed35d[_0x9f80('0x41')],_0x172870[_0x9f80('0x43')]),_0x5be54d);if(_0x1ed35d[_0x9f80('0x41')][_0x9f80('0x4c')]){_0x20f9ac[_0x9f80('0x4b')]=_[_0x9f80('0x4d')](_0x20f9ac['where'],{'$or':_[_0x9f80('0x3a')](_0x5be54d,function(_0x5abc94){if(_0x5abc94['type']!=='VIRTUAL'){var _0x59a367={};_0x59a367[_0x5abc94[_0x9f80('0x38')]]={'$like':'%'+_0x1ed35d[_0x9f80('0x41')][_0x9f80('0x4c')]+'%'};return _0x59a367;}})});}_0x20f9ac=_[_0x9f80('0x4d')]({},_0x20f9ac,_0x1ed35d[_0x9f80('0x4e')]);var _0x894bda={'where':_0x20f9ac[_0x9f80('0x4b')]};return db[_0x9f80('0x3b')][_0x9f80('0x4f')](_0x894bda)[_0x9f80('0x36')](function(_0x3c3388){_0x4afc04[_0x9f80('0x4f')]=_0x3c3388;if(_0x1ed35d[_0x9f80('0x41')][_0x9f80('0x50')]){_0x20f9ac[_0x9f80('0x51')]=[{'all':!![]}];}return db[_0x9f80('0x3b')][_0x9f80('0x52')](_0x20f9ac);})[_0x9f80('0x36')](function(_0x1ca7bb){_0x4afc04[_0x9f80('0x53')]=_0x1ca7bb;return _0x4afc04;})[_0x9f80('0x36')](respondWithFilteredResult(_0xdd09dd,_0x20f9ac))[_0x9f80('0x2b')](handleError(_0xdd09dd,null));};exports[_0x9f80('0x54')]=function(_0x27c47e,_0x22500d){var _0x493e65={'raw':!![],'where':{'id':_0x27c47e[_0x9f80('0x55')]['id']}},_0x15f112={};_0x15f112['model']=_[_0x9f80('0x42')](db['ChatMessage']['rawAttributes']);_0x15f112[_0x9f80('0x41')]=_[_0x9f80('0x42')](_0x27c47e[_0x9f80('0x41')]);_0x15f112['filters']=_[_0x9f80('0x44')](_0x15f112[_0x9f80('0x40')],_0x15f112[_0x9f80('0x41')]);_0x493e65['attributes']=_[_0x9f80('0x44')](_0x15f112['model'],qs[_0x9f80('0x45')](_0x27c47e[_0x9f80('0x41')]['fields']));_0x493e65[_0x9f80('0x46')]=_0x493e65['attributes'][_0x9f80('0x56')]?_0x493e65[_0x9f80('0x46')]:_0x15f112[_0x9f80('0x40')];if(_0x27c47e[_0x9f80('0x41')][_0x9f80('0x50')]){_0x493e65[_0x9f80('0x51')]=[{'all':!![]}];}_0x493e65=_[_0x9f80('0x4d')]({},_0x493e65,_0x27c47e[_0x9f80('0x4e')]);return db[_0x9f80('0x3b')]['find'](_0x493e65)[_0x9f80('0x36')](handleEntityNotFound(_0x22500d,null))[_0x9f80('0x36')](respondWithResult(_0x22500d,null))['catch'](handleError(_0x22500d,null));};exports[_0x9f80('0x57')]=function(_0x4ec8d7,_0x6abed4){return db[_0x9f80('0x3b')][_0x9f80('0x57')](_0x4ec8d7[_0x9f80('0x58')],{})['then'](respondWithResult(_0x6abed4,0xc9))[_0x9f80('0x2b')](handleError(_0x6abed4,null));};exports[_0x9f80('0x35')]=function(_0x461db4,_0x249141){if(_0x461db4[_0x9f80('0x58')]['id']){delete _0x461db4[_0x9f80('0x58')]['id'];}return db[_0x9f80('0x3b')]['find']({'where':{'id':_0x461db4[_0x9f80('0x55')]['id']}})[_0x9f80('0x36')](handleEntityNotFound(_0x249141,null))[_0x9f80('0x36')](saveUpdates(_0x461db4[_0x9f80('0x58')],null))[_0x9f80('0x36')](respondWithResult(_0x249141,null))[_0x9f80('0x2b')](handleError(_0x249141,null));};exports[_0x9f80('0x37')]=function(_0x27cce1,_0x4764aa){return db[_0x9f80('0x3b')][_0x9f80('0x59')]({'where':{'id':_0x27cce1['params']['id']}})['then'](handleEntityNotFound(_0x4764aa,null))[_0x9f80('0x36')](removeEntity(_0x4764aa,null))[_0x9f80('0x2b')](handleError(_0x4764aa,null));};exports['describe']=function(_0xc7f8d4,_0x518a95){return db['ChatMessage'][_0x9f80('0x5a')]()['then'](respondWithResult(_0x518a95,null))['catch'](handleError(_0x518a95,null));};var interaction_log=require('../../config/logger')(_0x9f80('0x5b'));exports['accept']=function(_0x20ff62,_0x280cc6,_0xae54b6){var _0x4e50dc={'channel':_0x9f80('0x5c')};if(_0x20ff62[_0x9f80('0x58')]['id']){delete _0x20ff62[_0x9f80('0x58')]['id'];}_0x20ff62['body'][_0x9f80('0x5d')]=!![];_0x20ff62['body'][_0x9f80('0x5e')]=moment()[_0x9f80('0x5f')](_0x9f80('0x60'));_0x20ff62['body'][_0x9f80('0x61')]=_0x20ff62[_0x9f80('0x58')]['UserId']||_0x20ff62[_0x9f80('0x62')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x20ff62['params']['id'],'UserId':null},'include':[{'model':db[_0x9f80('0x63')],'as':_0x9f80('0x64')}]})[_0x9f80('0x36')](handleEntityNotFound(_0x280cc6,null))[_0x9f80('0x36')](saveUpdates(_0x20ff62[_0x9f80('0x58')],null))[_0x9f80('0x36')](function(_0xe89546){if(_0xe89546){_0x4e50dc['message']=_0xe89546[_0x9f80('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x9f80('0x59')]({'where':{'id':_0xe89546[_0x9f80('0x66')]}});}return null;})[_0x9f80('0x36')](handleEntityNotFound(_0x280cc6,null))[_0x9f80('0x36')](function(_0x4b7742){if(_0x4b7742){return _0x4b7742['update']({'UserId':_0x20ff62[_0x9f80('0x58')][_0x9f80('0x61')],'read1stAt':_[_0x9f80('0x67')](_0x4b7742['read1stAt'])?moment()['format'](_0x9f80('0x60')):undefined});}return null;})['then'](function(_0x449571){if(_0x449571){_0x4e50dc['interaction']=_0x449571[_0x9f80('0x65')]({'plain':!![]});interaction_log[_0x9f80('0x29')](_0x9f80('0x68'),_0x20ff62['user']['id'],_0x20ff62['user'][_0x9f80('0x38')],_0x20ff62['user'][_0x9f80('0x69')],_0x4e50dc[_0x9f80('0x6a')]['id'],_0x20ff62[_0x9f80('0x58')]?JSON[_0x9f80('0x6b')](_0x20ff62[_0x9f80('0x58')]):_0x9f80('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x9f80('0x6d'),_0x4e50dc);}return null;})['then'](function(_0x257b95){if(_0x257b95){if(_0x20ff62[_0x9f80('0x58')]['manual']){_0x4e50dc['message'][_0x9f80('0x6e')]=util[_0x9f80('0x5f')](_0x9f80('0x6f'),_0x20ff62['user'][_0x9f80('0x38')]);_0x4e50dc[_0x9f80('0x28')][_0x9f80('0x70')]=_0x4e50dc['channel'];_0x4e50dc[_0x9f80('0x28')]['event']='accept';return respondWithRpcPromise(_0x9f80('0x71'),_0x9f80('0x71'),{'event':_0x9f80('0x72'),'message':_[_0x9f80('0x4d')](_0x4e50dc[_0x9f80('0x28')],JSON['parse'](_0x4e50dc[_0x9f80('0x6a')][_0x9f80('0x73')]))},client9002)[_0x9f80('0x36')](function(){return _0x4e50dc;});}return _0x4e50dc;}return null;})[_0x9f80('0x36')](respondWithResult(_0x280cc6,null))['catch'](handleError(_0x280cc6,null));};var interaction_log=require(_0x9f80('0x13'))('chat-interactions');exports['reject']=function(_0x25dc36,_0x1fce09,_0x2f8010){var _0x3c0f88={'agent':{},'channel':_0x9f80('0x5c')};if(_0x25dc36[_0x9f80('0x58')]['id']){delete _0x25dc36[_0x9f80('0x58')]['id'];}_0x25dc36[_0x9f80('0x58')][_0x9f80('0x61')]=_0x25dc36[_0x9f80('0x58')]['UserId']||_0x25dc36[_0x9f80('0x62')]['id'];_0x3c0f88[_0x9f80('0x74')]['id']=_0x25dc36[_0x9f80('0x58')][_0x9f80('0x61')];return db[_0x9f80('0x3b')][_0x9f80('0x59')]({'where':{'id':_0x25dc36['params']['id'],'UserId':null}})[_0x9f80('0x36')](handleEntityNotFound(_0x1fce09,null))[_0x9f80('0x36')](function(_0x4d1ac9){if(_0x4d1ac9){_0x3c0f88[_0x9f80('0x28')]=_0x4d1ac9['get']({'plain':!![]});return db[_0x9f80('0x75')]['find']({'where':{'id':_0x4d1ac9['ChatInteractionId']}});}return null;})[_0x9f80('0x36')](handleEntityNotFound(_0x1fce09,null))[_0x9f80('0x36')](function(_0x1290f8){if(_0x1290f8){_0x3c0f88[_0x9f80('0x6a')]=_0x1290f8[_0x9f80('0x65')]({'plain':!![]});interaction_log[_0x9f80('0x29')](_0x9f80('0x76'),_0x25dc36[_0x9f80('0x62')]['id'],_0x25dc36[_0x9f80('0x62')][_0x9f80('0x38')],_0x25dc36[_0x9f80('0x62')]['role'],_0x3c0f88[_0x9f80('0x6a')]['id'],_0x25dc36['body']?JSON[_0x9f80('0x6b')](_0x25dc36[_0x9f80('0x58')]):_0x9f80('0x6c'));return respondWithRpcPromise(_0x9f80('0x77'),_0x9f80('0x78'),_0x3c0f88);}return null;})[_0x9f80('0x36')](function(_0x20f6b0){if(_0x20f6b0){_0x20f6b0[_0x9f80('0x28')]['interface']=util['format']('SIP/%s',_0x25dc36['user'][_0x9f80('0x38')]);_0x20f6b0[_0x9f80('0x28')][_0x9f80('0x70')]=_0x3c0f88[_0x9f80('0x70')];_0x20f6b0[_0x9f80('0x28')][_0x9f80('0x79')]=_0x9f80('0x33');respondWithRpcPromise(_0x9f80('0x71'),_0x9f80('0x71'),{'event':_0x9f80('0x7a'),'message':_0x20f6b0[_0x9f80('0x28')]},client9002);return _0x3c0f88;}return null;})[_0x9f80('0x36')](respondWithResult(_0x1fce09,null))['catch'](handleError(_0x1fce09,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 75a6794..fb33933 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 _0xf9ab=['remove','emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x41fe10,_0x32c6ef){var _0x4f2477=function(_0x1ac31a){while(--_0x1ac31a){_0x41fe10['push'](_0x41fe10['shift']());}};_0x4f2477(++_0x32c6ef);}(_0xf9ab,0x1d8));var _0xbf9a=function(_0x3e301d,_0x4160f7){_0x3e301d=_0x3e301d-0x0;var _0x2e717a=_0xf9ab[_0x3e301d];return _0x2e717a;};'use strict';var EventEmitter=require(_0xbf9a('0x0'));var ChatMessage=require(_0xbf9a('0x1'))['db'][_0xbf9a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbf9a('0x3')](0x0);var events={'afterCreate':_0xbf9a('0x4'),'afterUpdate':'update','afterDestroy':_0xbf9a('0x5')};function emitEvent(_0x5e7bf2){return function(_0x418c29,_0x365aba,_0x327d44){ChatMessageEvents[_0xbf9a('0x6')](_0x5e7bf2+':'+_0x418c29['id'],_0x418c29);ChatMessageEvents['emit'](_0x5e7bf2,_0x418c29);_0x327d44(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xbf9a('0x7')](e,emitEvent(event));}}module[_0xbf9a('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x14f9=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x14f9,0x9c));var _0x914f=function(_0x48e8c8,_0x4a322a){_0x48e8c8=_0x48e8c8-0x0;var _0x120c86=_0x14f9[_0x48e8c8];return _0x120c86;};'use strict';var EventEmitter=require(_0x914f('0x0'));var ChatMessage=require(_0x914f('0x1'))['db'][_0x914f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x914f('0x3'),'afterUpdate':'update','afterDestroy':_0x914f('0x4')};function emitEvent(_0x3b58ea){return function(_0x5587b5,_0x379d17,_0x497182){ChatMessageEvents[_0x914f('0x5')](_0x3b58ea+':'+_0x5587b5['id'],_0x5587b5);ChatMessageEvents[_0x914f('0x5')](_0x3b58ea,_0x5587b5);_0x497182(null);};}for(var e in events){if(events[_0x914f('0x6')](e)){var event=events[e];ChatMessage[_0x914f('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c712002..bfc16d9 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 _0x58a7=['models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body'];(function(_0x141b9f,_0xacfc28){var _0x3a660c=function(_0x3df085){while(--_0x3df085){_0x141b9f['push'](_0x141b9f['shift']());}};_0x3a660c(++_0xacfc28);}(_0x58a7,0xb1));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x758a('0x0'));var util=require('util');var logger=require(_0x758a('0x1'))('api');var moment=require(_0x758a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x758a('0x3'));var rimraf=require(_0x758a('0x4'));var config=require(_0x758a('0x5'));var attributes=require(_0x758a('0x6'));module[_0x758a('0x7')]=function(_0x15df31,_0x5f639f){return _0x15df31[_0x758a('0x8')](_0x758a('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x758a('0xa'),'fields':[_0x758a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bfa53,_0x99f291,_0x3867ef){var _0x17f33e=_0x15df31[_0x758a('0xc')];var _0x19bd81=_0x5bfa53['get']({'plain':!![]});if(_0x19bd81[_0x758a('0xd')][_0x758a('0xe')]()==='in'||_0x19bd81[_0x758a('0xd')][_0x758a('0xe')]()===_0x758a('0xf')&&!_0x19bd81[_0x758a('0x10')]&&!_[_0x758a('0x11')](_0x19bd81[_0x758a('0x12')])){_0x17f33e[_0x758a('0x13')][_0x758a('0x14')]({'where':{'id':_0x19bd81[_0x758a('0x15')]}})[_0x758a('0x16')](function(_0x3b5c77){if(_0x3b5c77){_0x3b5c77[_0x758a('0x17')]({'lastMsgAt':_0x19bd81[_0x758a('0x18')],'lastMsgDirection':_0x19bd81['direction'][_0x758a('0xe')]()});}})['catch'](function(_0x11d7b0){console[_0x758a('0x19')](_0x11d7b0);});}_0x3867ef();}},'charset':_0x758a('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9c72=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x9c72,0x1ca));var _0x29c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x29c7('0x0'));var logger=require(_0x29c7('0x1'))(_0x29c7('0x2'));var moment=require('moment');var BPromise=require(_0x29c7('0x3'));var rp=require(_0x29c7('0x4'));var fs=require('fs');var path=require(_0x29c7('0x5'));var rimraf=require(_0x29c7('0x6'));var config=require(_0x29c7('0x7'));var attributes=require('./chatMessage.attributes');module[_0x29c7('0x8')]=function(_0x4c7ee8,_0x49b1c4){return _0x4c7ee8[_0x29c7('0x9')]('ChatMessage',attributes,{'tableName':_0x29c7('0xa'),'paranoid':![],'indexes':[{'name':_0x29c7('0xb'),'fields':[_0x29c7('0xc')],'type':_0x29c7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4eaad1,_0xe03932,_0x1c4f32){var _0x3fea81=_0x4c7ee8['models'];var _0x3a0f15=_0x4eaad1[_0x29c7('0xe')]({'plain':!![]});if(_0x3a0f15['direction']['toLowerCase']()==='in'||_0x3a0f15[_0x29c7('0xf')]['toLowerCase']()===_0x29c7('0x10')&&!_0x3a0f15['secret']&&!_[_0x29c7('0x11')](_0x3a0f15[_0x29c7('0x12')])){_0x3fea81[_0x29c7('0x13')][_0x29c7('0x14')]({'where':{'id':_0x3a0f15[_0x29c7('0x15')]}})[_0x29c7('0x16')](function(_0x332f3c){if(_0x332f3c){_0x332f3c['update']({'lastMsgAt':_0x3a0f15[_0x29c7('0x17')],'lastMsgDirection':_0x3a0f15['direction']['toLowerCase']()});}})[_0x29c7('0x18')](function(_0x1ded85){console['error'](_0x1ded85);});}_0x1c4f32();}},'charset':_0x29c7('0x19'),'collate':_0x29c7('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7e212dd..73114cb 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 _0xbfd4=['message','result','catch','CreateChatMessage','ChatMessage','body','raw','then','info','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24c4cd,_0x54ff07){var _0xad115c=function(_0x1b5c61){while(--_0x1b5c61){_0x24c4cd['push'](_0x24c4cd['shift']());}};_0xad115c(++_0x54ff07);}(_0xbfd4,0x1e9));var _0x4bfd=function(_0x3b4e32,_0x5c0475){_0x3b4e32=_0x3b4e32-0x0;var _0xad708=_0xbfd4[_0x3b4e32];return _0xad708;};'use strict';var _=require(_0x4bfd('0x0'));var util=require(_0x4bfd('0x1'));var moment=require(_0x4bfd('0x2'));var BPromise=require(_0x4bfd('0x3'));var rs=require(_0x4bfd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4bfd('0x5'));var logger=require(_0x4bfd('0x6'))('rpc');var config=require(_0x4bfd('0x7'));var jayson=require(_0x4bfd('0x8'));var client=jayson[_0x4bfd('0x9')][_0x4bfd('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4bfd('0xb'),'port':0x18eb});var socket=require(_0x4bfd('0xc'))(new Redis(config['redis']));require(_0x4bfd('0xd'))[_0x4bfd('0xe')](socket);function respondWithRpcPromise(_0x4d9d9f,_0x6b80cf,_0x5cd2dc){return new BPromise(function(_0x1d4025,_0x1fe86d){return client[_0x4bfd('0xf')](_0x4d9d9f,_0x5cd2dc)['then'](function(_0x9facfc){logger['info'](_0x4bfd('0x10'),_0x6b80cf,_0x4bfd('0x11'));logger[_0x4bfd('0x12')](_0x4bfd('0x13'),_0x6b80cf,_0x4bfd('0x11'),JSON[_0x4bfd('0x14')](_0x9facfc));if(_0x9facfc['error']){if(_0x9facfc[_0x4bfd('0x15')][_0x4bfd('0x16')]===0x1f4){logger[_0x4bfd('0x15')]('ChatMessage,\x20%s,\x20%s',_0x6b80cf,_0x9facfc[_0x4bfd('0x15')][_0x4bfd('0x17')]);return _0x1fe86d(_0x9facfc[_0x4bfd('0x15')]['message']);}logger[_0x4bfd('0x15')](_0x4bfd('0x10'),_0x6b80cf,_0x9facfc['error'][_0x4bfd('0x17')]);return _0x1d4025(_0x9facfc[_0x4bfd('0x15')][_0x4bfd('0x17')]);}else{logger['info'](_0x4bfd('0x10'),_0x6b80cf,_0x4bfd('0x11'));_0x1d4025(_0x9facfc[_0x4bfd('0x18')][_0x4bfd('0x17')]);}})[_0x4bfd('0x19')](function(_0x2a2ec9){logger[_0x4bfd('0x15')]('ChatMessage,\x20%s,\x20%s',_0x6b80cf,_0x2a2ec9);_0x1fe86d(_0x2a2ec9);});});}exports[_0x4bfd('0x1a')]=function(_0x2a6a07){var _0x44909a=this;return new Promise(function(_0x4d15e8,_0x3ac32b){return db[_0x4bfd('0x1b')]['create'](_0x2a6a07[_0x4bfd('0x1c')],{'raw':_0x2a6a07['options']?_0x2a6a07['options'][_0x4bfd('0x1d')]===undefined?!![]:![]:!![]})[_0x4bfd('0x1e')](function(_0x3f0468){logger[_0x4bfd('0x1f')](_0x4bfd('0x1a'),_0x2a6a07);logger[_0x4bfd('0x12')](_0x4bfd('0x1a'),_0x2a6a07,JSON[_0x4bfd('0x14')](_0x3f0468));_0x4d15e8(_0x3f0468);})[_0x4bfd('0x19')](function(_0x49db5d){logger[_0x4bfd('0x15')]('CreateChatMessage',_0x49db5d[_0x4bfd('0x17')],_0x2a6a07);_0x3ac32b(_0x44909a[_0x4bfd('0x15')](0x1f4,_0x49db5d[_0x4bfd('0x17')]));});});}; \ No newline at end of file +var _0x417c=['create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x417c,0xd0));var _0xc417=function(_0x1918a2,_0x39f55a){_0x1918a2=_0x1918a2-0x0;var _0x401137=_0x417c[_0x1918a2];return _0x401137;};'use strict';var _=require('lodash');var util=require(_0xc417('0x0'));var moment=require(_0xc417('0x1'));var BPromise=require(_0xc417('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc417('0x3'));var db=require(_0xc417('0x4'))['db'];var utils=require(_0xc417('0x5'));var logger=require(_0xc417('0x6'))(_0xc417('0x7'));var config=require(_0xc417('0x8'));var jayson=require(_0xc417('0x9'));var client=jayson['client'][_0xc417('0xa')]({'port':0x232a});config[_0xc417('0xb')]=_[_0xc417('0xc')](config[_0xc417('0xb')],{'host':_0xc417('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc417('0xb')]));require(_0xc417('0xe'))[_0xc417('0xf')](socket);function respondWithRpcPromise(_0x325c81,_0x15f726,_0x269f23){return new BPromise(function(_0x5d88a9,_0x44d5f1){return client[_0xc417('0x10')](_0x325c81,_0x269f23)['then'](function(_0x267af0){logger[_0xc417('0x11')](_0xc417('0x12'),_0x15f726,_0xc417('0x13'));logger[_0xc417('0x14')](_0xc417('0x15'),_0x15f726,'request\x20sent',JSON[_0xc417('0x16')](_0x267af0));if(_0x267af0['error']){if(_0x267af0[_0xc417('0x17')][_0xc417('0x18')]===0x1f4){logger['error'](_0xc417('0x12'),_0x15f726,_0x267af0[_0xc417('0x17')][_0xc417('0x19')]);return _0x44d5f1(_0x267af0[_0xc417('0x17')][_0xc417('0x19')]);}logger['error'](_0xc417('0x12'),_0x15f726,_0x267af0[_0xc417('0x17')]['message']);return _0x5d88a9(_0x267af0[_0xc417('0x17')][_0xc417('0x19')]);}else{logger['info'](_0xc417('0x12'),_0x15f726,_0xc417('0x13'));_0x5d88a9(_0x267af0[_0xc417('0x1a')]['message']);}})[_0xc417('0x1b')](function(_0x3f4965){logger['error'](_0xc417('0x12'),_0x15f726,_0x3f4965);_0x44d5f1(_0x3f4965);});});}exports[_0xc417('0x1c')]=function(_0x5cb286){var _0x1b3ef7=this;return new Promise(function(_0xaaa709,_0x27d3b9){return db[_0xc417('0x1d')][_0xc417('0x1e')](_0x5cb286[_0xc417('0x1f')],{'raw':_0x5cb286[_0xc417('0x20')]?_0x5cb286[_0xc417('0x20')][_0xc417('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3383c7){logger[_0xc417('0x11')](_0xc417('0x1c'),_0x5cb286);logger[_0xc417('0x14')](_0xc417('0x1c'),_0x5cb286,JSON[_0xc417('0x16')](_0x3383c7));_0xaaa709(_0x3383c7);})['catch'](function(_0x448b2f){logger['error'](_0xc417('0x1c'),_0x448b2f[_0xc417('0x19')],_0x5cb286);_0x27d3b9(_0x1b3ef7[_0xc417('0x17')](0x1f4,_0x448b2f[_0xc417('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 48ca5e4..69fd86e 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 _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0xeda8,0x104));var _0x8eda=function(_0x85b16c,_0x3c09b3){_0x85b16c=_0x85b16c-0x0;var _0x1b4e3e=_0xeda8[_0x85b16c];return _0x1b4e3e;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file +var _0xf61e=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0xed01eb,_0x275edb){var _0x25b9de=function(_0x3c331c){while(--_0x3c331c){_0xed01eb['push'](_0xed01eb['shift']());}};_0x25b9de(++_0x275edb);}(_0xf61e,0x191));var _0xef61=function(_0x2e6f58,_0x2014c8){_0x2e6f58=_0x2e6f58-0x0;var _0x15e25c=_0xf61e[_0x2e6f58];return _0x15e25c;};'use strict';var ChatMessageEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){ChatMessageEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);ChatMessageEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e1a1f42..feb6aa2 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 _0xd57e=['../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x6485b9,_0x9c91df){var _0x1eea5d=function(_0x2066f3){while(--_0x2066f3){_0x6485b9['push'](_0x6485b9['shift']());}};_0x1eea5d(++_0x9c91df);}(_0xd57e,0x100));var _0xed57=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xd57e[_0xdd82b4];return _0x549bb2;};'use strict';var multer=require(_0xed57('0x0'));var util=require(_0xed57('0x1'));var path=require('path');var timeout=require(_0xed57('0x2'));var express=require('express');var router=express[_0xed57('0x3')]();var auth=require(_0xed57('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xed57('0x5'));var controller=require(_0xed57('0x6'));router[_0xed57('0x7')]('/',auth[_0xed57('0x8')](),controller[_0xed57('0x9')]);router[_0xed57('0x7')](_0xed57('0xa'),auth[_0xed57('0x8')](),controller[_0xed57('0xb')]);router['get'](_0xed57('0xc'),auth[_0xed57('0x8')](),controller[_0xed57('0xd')]);router['post']('/',auth[_0xed57('0x8')](),interaction[_0xed57('0xe')](_0xed57('0xf'),_0xed57('0x10')),controller[_0xed57('0x11')]);router[_0xed57('0x12')](_0xed57('0xc'),controller[_0xed57('0x13')]);router['put'](_0xed57('0x14'),auth[_0xed57('0x8')](),controller[_0xed57('0x15')]);router[_0xed57('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0xed57('0x16')]);router[_0xed57('0x17')](_0xed57('0xc'),auth['isAuthenticated'](),controller[_0xed57('0x18')]);module[_0xed57('0x19')]=router; \ No newline at end of file +var _0xdf4b=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','tracked','chat','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xdf4b,0x176));var _0xbdf4=function(_0x2dcb27,_0x37430f){_0x2dcb27=_0x2dcb27-0x0;var _0x214283=_0xdf4b[_0x2dcb27];return _0x214283;};'use strict';var multer=require(_0xbdf4('0x0'));var util=require(_0xbdf4('0x1'));var path=require(_0xbdf4('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdf4('0x3'));var router=express['Router']();var auth=require(_0xbdf4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbdf4('0x5'));var controller=require('./chatMessage.controller');router[_0xbdf4('0x6')]('/',auth[_0xbdf4('0x7')](),controller['index']);router[_0xbdf4('0x6')]('/describe',auth[_0xbdf4('0x7')](),controller['describe']);router[_0xbdf4('0x6')](_0xbdf4('0x8'),auth[_0xbdf4('0x7')](),controller[_0xbdf4('0x9')]);router['post']('/',auth[_0xbdf4('0x7')](),interaction[_0xbdf4('0xa')](_0xbdf4('0xb'),'chatmessage:create'),controller[_0xbdf4('0xc')]);router['put'](_0xbdf4('0x8'),controller[_0xbdf4('0xd')]);router[_0xbdf4('0xe')](_0xbdf4('0xf'),auth[_0xbdf4('0x7')](),controller['accept']);router[_0xbdf4('0xe')](_0xbdf4('0x10'),auth['isAuthenticated'](),controller[_0xbdf4('0x11')]);router[_0xbdf4('0x12')](_0xbdf4('0x8'),auth[_0xbdf4('0x7')](),controller[_0xbdf4('0x13')]);module[_0xbdf4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 6895dde..df4efa7 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 _0x2d9b=['medium','sequelize','exports','TEXT'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0x2d9b,0x1ed));var _0xb2d9=function(_0x482030,_0x1d9a20){_0x482030=_0x482030-0x0;var _0x402430=_0x2d9b[_0x482030];return _0x402430;};'use strict';var Sequelize=require(_0xb2d9('0x0'));module[_0xb2d9('0x1')]={'body':{'type':Sequelize[_0xb2d9('0x2')](_0xb2d9('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xe638=['exports','TEXT','medium','sequelize'];(function(_0x321026,_0x1972cf){var _0x59092c=function(_0x4cbe6e){while(--_0x4cbe6e){_0x321026['push'](_0x321026['shift']());}};_0x59092c(++_0x1972cf);}(_0xe638,0x1d7));var _0x8e63=function(_0x319886,_0x34085f){_0x319886=_0x319886-0x0;var _0x1a2c07=_0xe638[_0x319886];return _0x1a2c07;};'use strict';var Sequelize=require(_0x8e63('0x0'));module[_0x8e63('0x1')]={'body':{'type':Sequelize[_0x8e63('0x2')](_0x8e63('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 6e67fa8..04278bc 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 _0x27a0=['../../mysqldb','sendStatus','end','status','offset','limit','set','json','save','then','destroy','error','stack','send','index','map','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','count','includeAll','include','ChatOfflineMessage','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/environment'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0x27a0,0xbf));var _0x027a=function(_0x5515d7,_0x4a47b9){_0x5515d7=_0x5515d7-0x0;var _0x4e02b5=_0x27a0[_0x5515d7];return _0x4e02b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x027a('0x0'));var rimraf=require(_0x027a('0x1'));var zipdir=require(_0x027a('0x2'));var jsonpatch=require(_0x027a('0x3'));var rp=require(_0x027a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x027a('0x5'));var sox=require(_0x027a('0x6'));var csv=require(_0x027a('0x7'));var ejs=require(_0x027a('0x8'));var fs=require('fs');var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x7'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var db=require(_0x027a('0x16'))['db'];function respondWithStatusCode(_0x874d2d,_0x351d7e){_0x351d7e=_0x351d7e||0xcc;return function(_0x3e0c1e){if(_0x3e0c1e){return _0x874d2d[_0x027a('0x17')](_0x351d7e);}return _0x874d2d['status'](_0x351d7e)[_0x027a('0x18')]();};}function respondWithResult(_0x30b9a4,_0x2d27f8){_0x2d27f8=_0x2d27f8||0xc8;return function(_0x21da53){if(_0x21da53){return _0x30b9a4[_0x027a('0x19')](_0x2d27f8)['json'](_0x21da53);}};}function respondWithFilteredResult(_0x5b6165,_0x1d680d){return function(_0x5cfc6d){if(_0x5cfc6d){var _0x2b3870=_0x5cfc6d['count'],_0x559d13=_0x1d680d['offset'],_0x432007=_0x1d680d[_0x027a('0x1a')]+_0x1d680d[_0x027a('0x1b')],_0x5a1224;if(_0x432007>=_0x2b3870){_0x432007=_0x2b3870;_0x5a1224=0xc8;}else{_0x5a1224=0xce;}_0x5b6165[_0x027a('0x19')](_0x5a1224);return _0x5b6165[_0x027a('0x1c')]('Content-Range',_0x559d13+'-'+_0x432007+'/'+_0x2b3870)[_0x027a('0x1d')](_0x5cfc6d);}return null;};}function patchUpdates(_0x2fccf6){return function(_0x4ad813){try{jsonpatch['apply'](_0x4ad813,_0x2fccf6,!![]);}catch(_0x3a6868){return BPromise['reject'](_0x3a6868);}return _0x4ad813[_0x027a('0x1e')]();};}function saveUpdates(_0x5b8fae,_0x59511c){return function(_0x58b129){if(_0x58b129){return _0x58b129['update'](_0x5b8fae)[_0x027a('0x1f')](function(_0x11e254){return _0x11e254;});}return null;};}function removeEntity(_0x266c9e,_0xdf8756){return function(_0x51b870){if(_0x51b870){return _0x51b870[_0x027a('0x20')]()[_0x027a('0x1f')](function(){_0x266c9e[_0x027a('0x19')](0xcc)[_0x027a('0x18')]();});}};}function handleEntityNotFound(_0x178ed8,_0x3bbd46){return function(_0x595f0e){if(!_0x595f0e){_0x178ed8[_0x027a('0x17')](0x194);}return _0x595f0e;};}function handleError(_0x5c281f,_0x3dd7ad){_0x3dd7ad=_0x3dd7ad||0x1f4;return function(_0x2e97c5){logger[_0x027a('0x21')](_0x2e97c5[_0x027a('0x22')]);if(_0x2e97c5['name']){delete _0x2e97c5['name'];}_0x5c281f[_0x027a('0x19')](_0x3dd7ad)[_0x027a('0x23')](_0x2e97c5);};}exports[_0x027a('0x24')]=function(_0x129d5f,_0x511c7a){var _0x1b5325={},_0x55a8cd={},_0x953887={'count':0x0,'rows':[]};var _0x488920=_[_0x027a('0x25')](db['ChatOfflineMessage']['rawAttributes'],function(_0x31385d){return{'name':_0x31385d['fieldName'],'type':_0x31385d['type'][_0x027a('0x26')]};});_0x55a8cd['model']=_[_0x027a('0x25')](_0x488920,'name');_0x55a8cd[_0x027a('0x27')]=_[_0x027a('0x28')](_0x129d5f['query']);_0x55a8cd[_0x027a('0x29')]=_['intersection'](_0x55a8cd[_0x027a('0x2a')],_0x55a8cd[_0x027a('0x27')]);_0x1b5325[_0x027a('0x2b')]=_[_0x027a('0x2c')](_0x55a8cd[_0x027a('0x2a')],qs[_0x027a('0x2d')](_0x129d5f['query'][_0x027a('0x2d')]));_0x1b5325['attributes']=_0x1b5325[_0x027a('0x2b')]['length']?_0x1b5325[_0x027a('0x2b')]:_0x55a8cd[_0x027a('0x2a')];if(!_0x129d5f[_0x027a('0x27')][_0x027a('0x2e')](_0x027a('0x2f'))){_0x1b5325['limit']=qs[_0x027a('0x1b')](_0x129d5f[_0x027a('0x27')][_0x027a('0x1b')]);_0x1b5325[_0x027a('0x1a')]=qs[_0x027a('0x1a')](_0x129d5f[_0x027a('0x27')][_0x027a('0x1a')]);}_0x1b5325[_0x027a('0x30')]=qs[_0x027a('0x31')](_0x129d5f[_0x027a('0x27')][_0x027a('0x31')]);_0x1b5325['where']=qs[_0x027a('0x29')](_[_0x027a('0x32')](_0x129d5f[_0x027a('0x27')],_0x55a8cd[_0x027a('0x29')]),_0x488920);if(_0x129d5f[_0x027a('0x27')][_0x027a('0x33')]){_0x1b5325[_0x027a('0x34')]=_['merge'](_0x1b5325[_0x027a('0x34')],{'$or':_[_0x027a('0x25')](_0x488920,function(_0xb646de){if(_0xb646de['type']!==_0x027a('0x35')){var _0x5b7602={};_0x5b7602[_0xb646de[_0x027a('0x36')]]={'$like':'%'+_0x129d5f[_0x027a('0x27')][_0x027a('0x33')]+'%'};return _0x5b7602;}})});}_0x1b5325=_['merge']({},_0x1b5325,_0x129d5f['options']);var _0x32a44e={'where':_0x1b5325[_0x027a('0x34')]};return db['ChatOfflineMessage'][_0x027a('0x37')](_0x32a44e)[_0x027a('0x1f')](function(_0x3094f8){_0x953887[_0x027a('0x37')]=_0x3094f8;if(_0x129d5f[_0x027a('0x27')][_0x027a('0x38')]){_0x1b5325[_0x027a('0x39')]=[{'all':!![]}];}return db[_0x027a('0x3a')][_0x027a('0x3b')](_0x1b5325);})[_0x027a('0x1f')](function(_0x293343){_0x953887[_0x027a('0x3c')]=_0x293343;return _0x953887;})[_0x027a('0x1f')](respondWithFilteredResult(_0x511c7a,_0x1b5325))[_0x027a('0x3d')](handleError(_0x511c7a,null));};exports[_0x027a('0x3e')]=function(_0x2cc152,_0x46685e){var _0x5a3dee={'raw':!![],'where':{'id':_0x2cc152[_0x027a('0x3f')]['id']}},_0x275692={};_0x275692[_0x027a('0x2a')]=_[_0x027a('0x28')](db[_0x027a('0x3a')][_0x027a('0x40')]);_0x275692['query']=_[_0x027a('0x28')](_0x2cc152[_0x027a('0x27')]);_0x275692['filters']=_[_0x027a('0x2c')](_0x275692['model'],_0x275692['query']);_0x5a3dee[_0x027a('0x2b')]=_['intersection'](_0x275692[_0x027a('0x2a')],qs[_0x027a('0x2d')](_0x2cc152[_0x027a('0x27')][_0x027a('0x2d')]));_0x5a3dee[_0x027a('0x2b')]=_0x5a3dee['attributes'][_0x027a('0x41')]?_0x5a3dee[_0x027a('0x2b')]:_0x275692[_0x027a('0x2a')];if(_0x2cc152['query']['includeAll']){_0x5a3dee['include']=[{'all':!![]}];}_0x5a3dee=_['merge']({},_0x5a3dee,_0x2cc152[_0x027a('0x42')]);return db[_0x027a('0x3a')][_0x027a('0x43')](_0x5a3dee)[_0x027a('0x1f')](handleEntityNotFound(_0x46685e,null))[_0x027a('0x1f')](respondWithResult(_0x46685e,null))[_0x027a('0x3d')](handleError(_0x46685e,null));};exports['create']=function(_0x4e4cb3,_0x2a9f24){return db[_0x027a('0x3a')][_0x027a('0x44')](_0x4e4cb3[_0x027a('0x45')],{})[_0x027a('0x1f')](respondWithResult(_0x2a9f24,0xc9))[_0x027a('0x3d')](handleError(_0x2a9f24,null));};exports[_0x027a('0x46')]=function(_0x1bddc1,_0x1fb7ee){if(_0x1bddc1['body']['id']){delete _0x1bddc1[_0x027a('0x45')]['id'];}return db[_0x027a('0x3a')][_0x027a('0x43')]({'where':{'id':_0x1bddc1[_0x027a('0x3f')]['id']}})[_0x027a('0x1f')](handleEntityNotFound(_0x1fb7ee,null))[_0x027a('0x1f')](saveUpdates(_0x1bddc1[_0x027a('0x45')],null))[_0x027a('0x1f')](respondWithResult(_0x1fb7ee,null))['catch'](handleError(_0x1fb7ee,null));};exports[_0x027a('0x20')]=function(_0x1244a6,_0x556b2b){return db[_0x027a('0x3a')][_0x027a('0x43')]({'where':{'id':_0x1244a6['params']['id']}})['then'](handleEntityNotFound(_0x556b2b,null))['then'](removeEntity(_0x556b2b,null))[_0x027a('0x3d')](handleError(_0x556b2b,null));};exports['describe']=function(_0x3a7374,_0x49ffc8){return db['ChatOfflineMessage']['describe']()['then'](respondWithResult(_0x49ffc8,null))[_0x027a('0x3d')](handleError(_0x49ffc8,null));}; \ No newline at end of file +var _0x326f=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','type','filter','options','ChatOfflineMessage','include','rows','catch','show','params','includeAll','create','body','update','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x16f0b7,_0x178637){var _0xfe2a5a=function(_0x36d67e){while(--_0x36d67e){_0x16f0b7['push'](_0x16f0b7['shift']());}};_0xfe2a5a(++_0x178637);}(_0x326f,0xd1));var _0xf326=function(_0x5bb3d9,_0x2912cb){_0x5bb3d9=_0x5bb3d9-0x0;var _0x5dcdae=_0x326f[_0x5bb3d9];return _0x5dcdae;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];function respondWithStatusCode(_0x518ab5,_0x3162f9){_0x3162f9=_0x3162f9||0xcc;return function(_0x9ed463){if(_0x9ed463){return _0x518ab5['sendStatus'](_0x3162f9);}return _0x518ab5[_0xf326('0x17')](_0x3162f9)[_0xf326('0x18')]();};}function respondWithResult(_0x3504eb,_0x17a098){_0x17a098=_0x17a098||0xc8;return function(_0x5c8483){if(_0x5c8483){return _0x3504eb[_0xf326('0x17')](_0x17a098)['json'](_0x5c8483);}};}function respondWithFilteredResult(_0x54bd1a,_0xdf21d9){return function(_0x11f6d2){if(_0x11f6d2){var _0x1f2e5a=_0x11f6d2[_0xf326('0x19')],_0xa63d1a=_0xdf21d9[_0xf326('0x1a')],_0x292f4b=_0xdf21d9['offset']+_0xdf21d9[_0xf326('0x1b')],_0x287a2a;if(_0x292f4b>=_0x1f2e5a){_0x292f4b=_0x1f2e5a;_0x287a2a=0xc8;}else{_0x287a2a=0xce;}_0x54bd1a[_0xf326('0x17')](_0x287a2a);return _0x54bd1a[_0xf326('0x1c')](_0xf326('0x1d'),_0xa63d1a+'-'+_0x292f4b+'/'+_0x1f2e5a)[_0xf326('0x1e')](_0x11f6d2);}return null;};}function patchUpdates(_0x311af0){return function(_0x4d3d41){try{jsonpatch['apply'](_0x4d3d41,_0x311af0,!![]);}catch(_0x56ad41){return BPromise[_0xf326('0x1f')](_0x56ad41);}return _0x4d3d41[_0xf326('0x20')]();};}function saveUpdates(_0x484cbe,_0x4cabce){return function(_0x128c68){if(_0x128c68){return _0x128c68['update'](_0x484cbe)['then'](function(_0x448b92){return _0x448b92;});}return null;};}function removeEntity(_0x18ead3,_0x549b46){return function(_0x5aa184){if(_0x5aa184){return _0x5aa184[_0xf326('0x21')]()[_0xf326('0x22')](function(){_0x18ead3['status'](0xcc)[_0xf326('0x18')]();});}};}function handleEntityNotFound(_0x1b9039,_0x43c53e){return function(_0x295752){if(!_0x295752){_0x1b9039[_0xf326('0x23')](0x194);}return _0x295752;};}function handleError(_0x2049ec,_0x5ce532){_0x5ce532=_0x5ce532||0x1f4;return function(_0x55b9f4){logger['error'](_0x55b9f4[_0xf326('0x24')]);if(_0x55b9f4[_0xf326('0x25')]){delete _0x55b9f4[_0xf326('0x25')];}_0x2049ec[_0xf326('0x17')](_0x5ce532)[_0xf326('0x26')](_0x55b9f4);};}exports[_0xf326('0x27')]=function(_0x5217d4,_0x201d28){var _0xa3c0b={},_0x212d5d={},_0x581531={'count':0x0,'rows':[]};var _0x1617d2=_['map'](db['ChatOfflineMessage'][_0xf326('0x28')],function(_0x1ae23a){return{'name':_0x1ae23a[_0xf326('0x29')],'type':_0x1ae23a['type'][_0xf326('0x2a')]};});_0x212d5d[_0xf326('0x2b')]=_['map'](_0x1617d2,_0xf326('0x25'));_0x212d5d[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5217d4[_0xf326('0x2c')]);_0x212d5d[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x212d5d[_0xf326('0x2b')],_0x212d5d[_0xf326('0x2c')]);_0xa3c0b[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x212d5d['model'],qs[_0xf326('0x31')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x31')]));_0xa3c0b['attributes']=_0xa3c0b[_0xf326('0x30')][_0xf326('0x32')]?_0xa3c0b[_0xf326('0x30')]:_0x212d5d['model'];if(!_0x5217d4['query'][_0xf326('0x33')](_0xf326('0x34'))){_0xa3c0b[_0xf326('0x1b')]=qs[_0xf326('0x1b')](_0x5217d4[_0xf326('0x2c')][_0xf326('0x1b')]);_0xa3c0b[_0xf326('0x1a')]=qs[_0xf326('0x1a')](_0x5217d4['query'][_0xf326('0x1a')]);}_0xa3c0b[_0xf326('0x35')]=qs['sort'](_0x5217d4[_0xf326('0x2c')]['sort']);_0xa3c0b[_0xf326('0x36')]=qs['filters'](_['pick'](_0x5217d4[_0xf326('0x2c')],_0x212d5d['filters']),_0x1617d2);if(_0x5217d4[_0xf326('0x2c')]['filter']){_0xa3c0b[_0xf326('0x36')]=_[_0xf326('0x37')](_0xa3c0b[_0xf326('0x36')],{'$or':_['map'](_0x1617d2,function(_0x3dcc7e){if(_0x3dcc7e[_0xf326('0x38')]!=='VIRTUAL'){var _0x13932b={};_0x13932b[_0x3dcc7e[_0xf326('0x25')]]={'$like':'%'+_0x5217d4[_0xf326('0x2c')][_0xf326('0x39')]+'%'};return _0x13932b;}})});}_0xa3c0b=_['merge']({},_0xa3c0b,_0x5217d4[_0xf326('0x3a')]);var _0xb1ef35={'where':_0xa3c0b[_0xf326('0x36')]};return db[_0xf326('0x3b')][_0xf326('0x19')](_0xb1ef35)['then'](function(_0x3e830d){_0x581531[_0xf326('0x19')]=_0x3e830d;if(_0x5217d4['query']['includeAll']){_0xa3c0b[_0xf326('0x3c')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0xa3c0b);})[_0xf326('0x22')](function(_0x5d6ae2){_0x581531[_0xf326('0x3d')]=_0x5d6ae2;return _0x581531;})[_0xf326('0x22')](respondWithFilteredResult(_0x201d28,_0xa3c0b))[_0xf326('0x3e')](handleError(_0x201d28,null));};exports[_0xf326('0x3f')]=function(_0x49112d,_0x9dda89){var _0x45d344={'raw':!![],'where':{'id':_0x49112d[_0xf326('0x40')]['id']}},_0x347e7b={};_0x347e7b[_0xf326('0x2b')]=_[_0xf326('0x2d')](db[_0xf326('0x3b')][_0xf326('0x28')]);_0x347e7b[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x49112d[_0xf326('0x2c')]);_0x347e7b[_0xf326('0x2e')]=_['intersection'](_0x347e7b[_0xf326('0x2b')],_0x347e7b[_0xf326('0x2c')]);_0x45d344[_0xf326('0x30')]=_[_0xf326('0x2f')](_0x347e7b[_0xf326('0x2b')],qs[_0xf326('0x31')](_0x49112d['query'][_0xf326('0x31')]));_0x45d344[_0xf326('0x30')]=_0x45d344['attributes'][_0xf326('0x32')]?_0x45d344[_0xf326('0x30')]:_0x347e7b[_0xf326('0x2b')];if(_0x49112d[_0xf326('0x2c')][_0xf326('0x41')]){_0x45d344['include']=[{'all':!![]}];}_0x45d344=_['merge']({},_0x45d344,_0x49112d[_0xf326('0x3a')]);return db[_0xf326('0x3b')]['find'](_0x45d344)['then'](handleEntityNotFound(_0x9dda89,null))[_0xf326('0x22')](respondWithResult(_0x9dda89,null))[_0xf326('0x3e')](handleError(_0x9dda89,null));};exports[_0xf326('0x42')]=function(_0x5b3705,_0x301e65){return db[_0xf326('0x3b')][_0xf326('0x42')](_0x5b3705[_0xf326('0x43')],{})[_0xf326('0x22')](respondWithResult(_0x301e65,0xc9))[_0xf326('0x3e')](handleError(_0x301e65,null));};exports[_0xf326('0x44')]=function(_0x3b90dc,_0x3df9a8){if(_0x3b90dc[_0xf326('0x43')]['id']){delete _0x3b90dc[_0xf326('0x43')]['id'];}return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x3b90dc[_0xf326('0x40')]['id']}})[_0xf326('0x22')](handleEntityNotFound(_0x3df9a8,null))['then'](saveUpdates(_0x3b90dc[_0xf326('0x43')],null))[_0xf326('0x22')](respondWithResult(_0x3df9a8,null))[_0xf326('0x3e')](handleError(_0x3df9a8,null));};exports[_0xf326('0x21')]=function(_0x5f1829,_0x10f437){return db[_0xf326('0x3b')][_0xf326('0x45')]({'where':{'id':_0x5f1829[_0xf326('0x40')]['id']}})['then'](handleEntityNotFound(_0x10f437,null))[_0xf326('0x22')](removeEntity(_0x10f437,null))[_0xf326('0x3e')](handleError(_0x10f437,null));};exports[_0xf326('0x46')]=function(_0x451ac7,_0x39ba25){return db['ChatOfflineMessage']['describe']()[_0xf326('0x22')](respondWithResult(_0x39ba25,null))[_0xf326('0x3e')](handleError(_0x39ba25,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 68a931d..b7e5b13 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 _0xb095=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x3e33da,_0x44daf9){var _0x3a968f=function(_0x1fa29f){while(--_0x1fa29f){_0x3e33da['push'](_0x3e33da['shift']());}};_0x3a968f(++_0x44daf9);}(_0xb095,0x71));var _0x5b09=function(_0x177878,_0x4976c4){_0x177878=_0x177878-0x0;var _0x295f17=_0xb095[_0x177878];return _0x295f17;};'use strict';var _=require('lodash');var util=require(_0x5b09('0x0'));var logger=require(_0x5b09('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5b09('0x2'));var fs=require('fs');var path=require(_0x5b09('0x3'));var rimraf=require('rimraf');var config=require(_0x5b09('0x4'));var attributes=require(_0x5b09('0x5'));module[_0x5b09('0x6')]=function(_0x22aa1b,_0x24dfbe){return _0x22aa1b[_0x5b09('0x7')](_0x5b09('0x8'),attributes,{'tableName':_0x5b09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b09('0xa'),'collate':_0x5b09('0xb')});}; \ No newline at end of file +var _0x5b64=['exports','define','ChatOfflineMessage','chat_offline_messages','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5b64,0x190));var _0x45b6=function(_0x55ba56,_0x4405fe){_0x55ba56=_0x55ba56-0x0;var _0x28159e=_0x5b64[_0x55ba56];return _0x28159e;};'use strict';var _=require(_0x45b6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x45b6('0x1'));var BPromise=require(_0x45b6('0x2'));var rp=require(_0x45b6('0x3'));var fs=require('fs');var path=require(_0x45b6('0x4'));var rimraf=require(_0x45b6('0x5'));var config=require(_0x45b6('0x6'));var attributes=require(_0x45b6('0x7'));module[_0x45b6('0x8')]=function(_0x48c835,_0x2f17f8){return _0x48c835[_0x45b6('0x9')](_0x45b6('0xa'),attributes,{'tableName':_0x45b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8116d5d..8f0a25a 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 _0xba77=['http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x135b81,_0x39db4b){var _0x5d8a8e=function(_0x3a7614){while(--_0x3a7614){_0x135b81['push'](_0x135b81['shift']());}};_0x5d8a8e(++_0x39db4b);}(_0xba77,0x187));var _0x7ba7=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xba77[_0x545bed];return _0x16c79c;};'use strict';var _=require(_0x7ba7('0x0'));var util=require('util');var moment=require(_0x7ba7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ba7('0x2'));var db=require(_0x7ba7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ba7('0x4'))('rpc');var config=require(_0x7ba7('0x5'));var jayson=require(_0x7ba7('0x6'));var client=jayson[_0x7ba7('0x7')][_0x7ba7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10cd13,_0x271d99,_0x3b1ee8){return new BPromise(function(_0x1f4677,_0x1a4a08){return client[_0x7ba7('0x9')](_0x10cd13,_0x3b1ee8)[_0x7ba7('0xa')](function(_0x383b4c){logger[_0x7ba7('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x271d99,'request\x20sent');logger[_0x7ba7('0xc')](_0x7ba7('0xd'),_0x271d99,_0x7ba7('0xe'),JSON[_0x7ba7('0xf')](_0x383b4c));if(_0x383b4c['error']){if(_0x383b4c[_0x7ba7('0x10')][_0x7ba7('0x11')]===0x1f4){logger[_0x7ba7('0x10')](_0x7ba7('0x12'),_0x271d99,_0x383b4c['error'][_0x7ba7('0x13')]);return _0x1a4a08(_0x383b4c['error']['message']);}logger[_0x7ba7('0x10')](_0x7ba7('0x12'),_0x271d99,_0x383b4c[_0x7ba7('0x10')][_0x7ba7('0x13')]);return _0x1f4677(_0x383b4c[_0x7ba7('0x10')][_0x7ba7('0x13')]);}else{logger[_0x7ba7('0xb')](_0x7ba7('0x12'),_0x271d99,_0x7ba7('0xe'));_0x1f4677(_0x383b4c[_0x7ba7('0x14')][_0x7ba7('0x13')]);}})['catch'](function(_0x137098){logger['error'](_0x7ba7('0x12'),_0x271d99,_0x137098);_0x1a4a08(_0x137098);});});} \ No newline at end of file +var _0xb9c1=['rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x1229de,_0x1cbe05){var _0x10c9f9=function(_0x1644fa){while(--_0x1644fa){_0x1229de['push'](_0x1229de['shift']());}};_0x10c9f9(++_0x1cbe05);}(_0xb9c1,0x1c9));var _0x1b9c=function(_0x4594cc,_0x563946){_0x4594cc=_0x4594cc-0x0;var _0x52e4d4=_0xb9c1[_0x4594cc];return _0x52e4d4;};'use strict';var _=require(_0x1b9c('0x0'));var util=require('util');var moment=require(_0x1b9c('0x1'));var BPromise=require(_0x1b9c('0x2'));var rs=require(_0x1b9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b9c('0x4'));var logger=require('../../config/logger')(_0x1b9c('0x5'));var config=require(_0x1b9c('0x6'));var jayson=require(_0x1b9c('0x7'));var client=jayson[_0x1b9c('0x8')][_0x1b9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x425116,_0x5a4d1a,_0x14b720){return new BPromise(function(_0x39d3f4,_0x1bfd78){return client[_0x1b9c('0xa')](_0x425116,_0x14b720)['then'](function(_0x1f8312){logger[_0x1b9c('0xb')](_0x1b9c('0xc'),_0x5a4d1a,_0x1b9c('0xd'));logger[_0x1b9c('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5a4d1a,_0x1b9c('0xd'),JSON[_0x1b9c('0xf')](_0x1f8312));if(_0x1f8312[_0x1b9c('0x10')]){if(_0x1f8312[_0x1b9c('0x10')][_0x1b9c('0x11')]===0x1f4){logger['error'](_0x1b9c('0xc'),_0x5a4d1a,_0x1f8312[_0x1b9c('0x10')][_0x1b9c('0x12')]);return _0x1bfd78(_0x1f8312[_0x1b9c('0x10')][_0x1b9c('0x12')]);}logger['error'](_0x1b9c('0xc'),_0x5a4d1a,_0x1f8312['error'][_0x1b9c('0x12')]);return _0x39d3f4(_0x1f8312[_0x1b9c('0x10')][_0x1b9c('0x12')]);}else{logger[_0x1b9c('0xb')](_0x1b9c('0xc'),_0x5a4d1a,_0x1b9c('0xd'));_0x39d3f4(_0x1f8312[_0x1b9c('0x13')][_0x1b9c('0x12')]);}})[_0x1b9c('0x14')](function(_0x9b5d0){logger[_0x1b9c('0x10')](_0x1b9c('0xc'),_0x5a4d1a,_0x9b5d0);_0x1bfd78(_0x9b5d0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index dc707d2..1f341f9 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 _0x291d=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x291d,0x144));var _0xd291=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x291d[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0xd291('0x0'));var util=require(_0xd291('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd291('0x2'));var router=express[_0xd291('0x3')]();var auth=require(_0xd291('0x4'));var interaction=require(_0xd291('0x5'));var config=require(_0xd291('0x6'));var controller=require(_0xd291('0x7'));router[_0xd291('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd291('0x8')](_0xd291('0x9'),auth['isAuthenticated'](),controller[_0xd291('0xa')]);router['get'](_0xd291('0xb'),auth['isAuthenticated'](),controller[_0xd291('0xc')]);router[_0xd291('0xd')]('/',auth[_0xd291('0xe')](),controller[_0xd291('0xf')]);router[_0xd291('0x10')](_0xd291('0xb'),auth[_0xd291('0xe')](),controller[_0xd291('0x11')]);router['delete'](_0xd291('0xb'),auth[_0xd291('0xe')](),controller['destroy']);module[_0xd291('0x12')]=router; \ No newline at end of file +var _0x4db5=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','index','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x4db5,0x92));var _0x54db=function(_0x120030,_0x34bc7b){_0x120030=_0x120030-0x0;var _0x451d24=_0x4db5[_0x120030];return _0x451d24;};'use strict';var multer=require(_0x54db('0x0'));var util=require('util');var path=require(_0x54db('0x1'));var timeout=require(_0x54db('0x2'));var express=require(_0x54db('0x3'));var router=express[_0x54db('0x4')]();var auth=require(_0x54db('0x5'));var interaction=require(_0x54db('0x6'));var config=require('../../config/environment');var controller=require(_0x54db('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x54db('0x8')]);router[_0x54db('0x9')]('/describe',auth[_0x54db('0xa')](),controller['describe']);router[_0x54db('0x9')](_0x54db('0xb'),auth[_0x54db('0xa')](),controller[_0x54db('0xc')]);router[_0x54db('0xd')]('/',auth[_0x54db('0xa')](),controller[_0x54db('0xe')]);router['put'](_0x54db('0xb'),auth[_0x54db('0xa')](),controller[_0x54db('0xf')]);router[_0x54db('0x10')](_0x54db('0xb'),auth[_0x54db('0xa')](),controller[_0x54db('0x11')]);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 d92a828..b55d445 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 _0x5a17=['sequelize','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x1daad3,_0x3d060a){var _0x2483dd=function(_0x4c4328){while(--_0x4c4328){_0x1daad3['push'](_0x1daad3['shift']());}};_0x2483dd(++_0x3d060a);}(_0x5a17,0x156));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x75a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x75a1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x75a1('0x2')](_0x75a1('0x3'),_0x75a1('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x75a1('0x5')]}}; \ No newline at end of file +var _0xbe05=['ENUM','mouseOver','timeout','STRING','sequelize','exports'];(function(_0x294f57,_0x53078b){var _0x390b9a=function(_0x22ab60){while(--_0x22ab60){_0x294f57['push'](_0x294f57['shift']());}};_0x390b9a(++_0x53078b);}(_0xbe05,0x1a8));var _0x5be0=function(_0x503b09,_0x2032c2){_0x503b09=_0x503b09-0x0;var _0x32044b=_0xbe05[_0x503b09];return _0x32044b;};'use strict';var Sequelize=require(_0x5be0('0x0'));module[_0x5be0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5be0('0x2')](_0x5be0('0x3'),_0x5be0('0x4')),'defaultValue':_0x5be0('0x3')},'selector':{'type':Sequelize[_0x5be0('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c6b1df4..e43ce32 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(_0x32d5d3,_0x1ec421){var _0x49e4fc=function(_0x35769a){while(--_0x35769a){_0x32d5d3['push'](_0x32d5d3['shift']());}};_0x49e4fc(++_0x1ec421);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var 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 _0xd8b0=['eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','filters','model','attributes','intersection','length','query','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf'];(function(_0x4313c5,_0x52f90d){var _0x42fe42=function(_0x134508){while(--_0x134508){_0x4313c5['push'](_0x4313c5['shift']());}};_0x42fe42(++_0x52f90d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={'raw':!![],'where':{'id':_0xa2af02[_0x0d8b('0x28')]['id']}},_0x28f639={};_0x28f639['model']=_[_0x0d8b('0x29')](db['ChatProactiveAction'][_0x0d8b('0x2a')]);_0x28f639['query']=_[_0x0d8b('0x29')](_0xa2af02['query']);_0x28f639[_0x0d8b('0x2b')]=_['intersection'](_0x28f639[_0x0d8b('0x2c')],_0x28f639['query']);_0x59a905[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x28f639[_0x0d8b('0x2c')],qs['fields'](_0xa2af02['query']['fields']));_0x59a905[_0x0d8b('0x2d')]=_0x59a905['attributes'][_0x0d8b('0x2f')]?_0x59a905['attributes']:_0x28f639['model'];if(_0xa2af02[_0x0d8b('0x30')][_0x0d8b('0x31')]){_0x59a905[_0x0d8b('0x32')]=[{'all':!![]}];}_0x59a905=_[_0x0d8b('0x33')]({},_0x59a905,_0xa2af02[_0x0d8b('0x34')]);return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x59a905)[_0x0d8b('0x22')](handleEntityNotFound(_0x4fe6f9,null))['then'](respondWithResult(_0x4fe6f9,null))[_0x0d8b('0x37')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x38')]=function(_0x4b3ea0,_0xb18586){return db[_0x0d8b('0x35')][_0x0d8b('0x38')](_0x4b3ea0['body'],{})[_0x0d8b('0x22')](respondWithResult(_0xb18586,0xc9))[_0x0d8b('0x37')](handleError(_0xb18586,null));};exports[_0x0d8b('0x21')]=function(_0x31ceba,_0x933e01){if(_0x31ceba['body']['id']){delete _0x31ceba[_0x0d8b('0x39')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x31ceba[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x933e01,null))[_0x0d8b('0x22')](saveUpdates(_0x31ceba[_0x0d8b('0x39')],null))[_0x0d8b('0x22')](respondWithResult(_0x933e01,null))['catch'](handleError(_0x933e01,null));};exports['destroy']=function(_0x41b4f9,_0x5c2c04){return db['ChatProactiveAction'][_0x0d8b('0x36')]({'where':{'id':_0x41b4f9[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x5c2c04,null))[_0x0d8b('0x22')](removeEntity(_0x5c2c04,null))[_0x0d8b('0x37')](handleError(_0x5c2c04,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c3c5132..204c550 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 _0x944b=['request-promise','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird'];(function(_0x5740f8,_0x310c7f){var _0x162a45=function(_0x40788b){while(--_0x40788b){_0x5740f8['push'](_0x5740f8['shift']());}};_0x162a45(++_0x310c7f);}(_0x944b,0x150));var _0xb944=function(_0xb31ff3,_0x28aee8){_0xb31ff3=_0xb31ff3-0x0;var _0x569a70=_0x944b[_0xb31ff3];return _0x569a70;};'use strict';var _=require(_0xb944('0x0'));var util=require(_0xb944('0x1'));var logger=require('../../config/logger')(_0xb944('0x2'));var moment=require(_0xb944('0x3'));var BPromise=require(_0xb944('0x4'));var rp=require(_0xb944('0x5'));var fs=require('fs');var path=require(_0xb944('0x6'));var rimraf=require(_0xb944('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xb944('0x8')]=function(_0x54d1b7,_0x7b3ddb){return _0x54d1b7['define'](_0xb944('0x9'),attributes,{'tableName':_0xb944('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88e5=['bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','util','../../config/logger','api'];(function(_0x5371d1,_0x1fb8f6){var _0xd85f6a=function(_0x1e3c1c){while(--_0x1e3c1c){_0x5371d1['push'](_0x5371d1['shift']());}};_0xd85f6a(++_0x1fb8f6);}(_0x88e5,0x129));var _0x588e=function(_0x109517,_0x5ef786){_0x109517=_0x109517-0x0;var _0x5c24e9=_0x88e5[_0x109517];return _0x5c24e9;};'use strict';var _=require('lodash');var util=require(_0x588e('0x0'));var logger=require(_0x588e('0x1'))(_0x588e('0x2'));var moment=require('moment');var BPromise=require(_0x588e('0x3'));var rp=require(_0x588e('0x4'));var fs=require('fs');var path=require(_0x588e('0x5'));var rimraf=require('rimraf');var config=require(_0x588e('0x6'));var attributes=require(_0x588e('0x7'));module['exports']=function(_0x4b1c4e,_0x1d8ab7){return _0x4b1c4e[_0x588e('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x588e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ffb6f8b..0dd281c 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 _0x1604=['stringify','error','code','message','request\x20sent','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','info','ChatProactiveAction,\x20%s,\x20%s','debug'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x1604,0xa9));var _0x4160=function(_0x3e6f87,_0x4376d7){_0x3e6f87=_0x3e6f87-0x0;var _0x17f785=_0x1604[_0x3e6f87];return _0x17f785;};'use strict';var _=require('lodash');var util=require(_0x4160('0x0'));var moment=require(_0x4160('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4160('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4160('0x3'));var logger=require(_0x4160('0x4'))('rpc');var config=require(_0x4160('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4160('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x271557,_0x18d89e,_0x1839ae){return new BPromise(function(_0x2537c6,_0x1aa4d7){return client[_0x4160('0x7')](_0x271557,_0x1839ae)['then'](function(_0x4ac0f6){logger[_0x4160('0x8')](_0x4160('0x9'),_0x18d89e,'request\x20sent');logger[_0x4160('0xa')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x18d89e,'request\x20sent',JSON[_0x4160('0xb')](_0x4ac0f6));if(_0x4ac0f6[_0x4160('0xc')]){if(_0x4ac0f6[_0x4160('0xc')][_0x4160('0xd')]===0x1f4){logger[_0x4160('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x18d89e,_0x4ac0f6['error'][_0x4160('0xe')]);return _0x1aa4d7(_0x4ac0f6[_0x4160('0xc')][_0x4160('0xe')]);}logger[_0x4160('0xc')](_0x4160('0x9'),_0x18d89e,_0x4ac0f6[_0x4160('0xc')][_0x4160('0xe')]);return _0x2537c6(_0x4ac0f6[_0x4160('0xc')][_0x4160('0xe')]);}else{logger[_0x4160('0x8')](_0x4160('0x9'),_0x18d89e,_0x4160('0xf'));_0x2537c6(_0x4ac0f6[_0x4160('0x10')][_0x4160('0xe')]);}})[_0x4160('0x11')](function(_0x49a512){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x18d89e,_0x49a512);_0x1aa4d7(_0x49a512);});});} \ No newline at end of file +var _0x5a5c=['message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x14411,_0xd0431f){var _0x171a46=function(_0x10a431){while(--_0x10a431){_0x14411['push'](_0x14411['shift']());}};_0x171a46(++_0xd0431f);}(_0x5a5c,0x1e7));var _0xc5a5=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x5a5c[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xc5a5('0x0'));var util=require('util');var moment=require(_0xc5a5('0x1'));var BPromise=require('bluebird');var rs=require(_0xc5a5('0x2'));var fs=require('fs');var Redis=require(_0xc5a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5a5('0x4'));var logger=require(_0xc5a5('0x5'))(_0xc5a5('0x6'));var config=require(_0xc5a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5a5('0x8')][_0xc5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ca717,_0x24580f,_0x3d0a00){return new BPromise(function(_0x3ae939,_0x465e6f){return client[_0xc5a5('0xa')](_0x2ca717,_0x3d0a00)[_0xc5a5('0xb')](function(_0x206807){logger[_0xc5a5('0xc')](_0xc5a5('0xd'),_0x24580f,_0xc5a5('0xe'));logger[_0xc5a5('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x24580f,_0xc5a5('0xe'),JSON[_0xc5a5('0x10')](_0x206807));if(_0x206807[_0xc5a5('0x11')]){if(_0x206807[_0xc5a5('0x11')][_0xc5a5('0x12')]===0x1f4){logger['error'](_0xc5a5('0xd'),_0x24580f,_0x206807['error']['message']);return _0x465e6f(_0x206807['error'][_0xc5a5('0x13')]);}logger[_0xc5a5('0x11')](_0xc5a5('0xd'),_0x24580f,_0x206807[_0xc5a5('0x11')][_0xc5a5('0x13')]);return _0x3ae939(_0x206807['error'][_0xc5a5('0x13')]);}else{logger['info'](_0xc5a5('0xd'),_0x24580f,_0xc5a5('0xe'));_0x3ae939(_0x206807[_0xc5a5('0x14')][_0xc5a5('0x13')]);}})[_0xc5a5('0x15')](function(_0x4829ea){logger[_0xc5a5('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x24580f,_0x4829ea);_0x465e6f(_0x4829ea);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a431f9f..d8a06ab 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 _0xa1d5=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','path','Router','../../components/auth/service'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa1d5,0x191));var _0x5a1d=function(_0x2f610e,_0x392a47){_0x2f610e=_0x2f610e-0x0;var _0x31fff3=_0xa1d5[_0x2f610e];return _0x31fff3;};'use strict';var multer=require(_0x5a1d('0x0'));var util=require('util');var path=require(_0x5a1d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a1d('0x2')]();var auth=require(_0x5a1d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5a1d('0x4'));var controller=require(_0x5a1d('0x5'));router[_0x5a1d('0x6')](_0x5a1d('0x7'),auth[_0x5a1d('0x8')](),controller[_0x5a1d('0x9')]);router[_0x5a1d('0xa')]('/',auth[_0x5a1d('0x8')](),controller[_0x5a1d('0xb')]);router['put'](_0x5a1d('0x7'),auth[_0x5a1d('0x8')](),controller[_0x5a1d('0xc')]);router[_0x5a1d('0xd')](_0x5a1d('0x7'),auth[_0x5a1d('0x8')](),controller[_0x5a1d('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcba9=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcba9,0x1ca));var _0x9cba=function(_0x593952,_0x2b1e56){_0x593952=_0x593952-0x0;var _0x1947d1=_0xcba9[_0x593952];return _0x1947d1;};'use strict';var multer=require(_0x9cba('0x0'));var util=require(_0x9cba('0x1'));var path=require(_0x9cba('0x2'));var timeout=require(_0x9cba('0x3'));var express=require(_0x9cba('0x4'));var router=express[_0x9cba('0x5')]();var auth=require(_0x9cba('0x6'));var interaction=require(_0x9cba('0x7'));var config=require(_0x9cba('0x8'));var controller=require(_0x9cba('0x9'));router['get']('/:id',auth[_0x9cba('0xa')](),controller[_0x9cba('0xb')]);router[_0x9cba('0xc')]('/',auth[_0x9cba('0xa')](),controller[_0x9cba('0xd')]);router[_0x9cba('0xe')](_0x9cba('0xf'),auth[_0x9cba('0xa')](),controller[_0x9cba('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cba('0x11')]);module[_0x9cba('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b03c6b2..fa7718c 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 _0x6a26=['exports','STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x42ec43,_0xbd4536){var _0x48db6c=function(_0x3ddb1b){while(--_0x3ddb1b){_0x42ec43['push'](_0x42ec43['shift']());}};_0x48db6c(++_0xbd4536);}(_0x6a26,0x1e9));var _0x66a2=function(_0xb0abee,_0x3773e2){_0xb0abee=_0xb0abee-0x0;var _0x2f61b5=_0x6a26[_0xb0abee];return _0x2f61b5;};'use strict';var Sequelize=require(_0x66a2('0x0'));module[_0x66a2('0x1')]={'name':{'type':Sequelize[_0x66a2('0x2')],'unique':_0x66a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x66a2('0x2')]},'timeout':{'type':Sequelize[_0x66a2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x66a2('0x5'),_0x66a2('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xfc4d=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x181484,_0x913a1c){var _0x35a853=function(_0xfa7d18){while(--_0xfa7d18){_0x181484['push'](_0x181484['shift']());}};_0x35a853(++_0x913a1c);}(_0xfc4d,0xb0));var _0xdfc4=function(_0x545d44,_0x405d26){_0x545d44=_0x545d44-0x0;var _0x2492d8=_0xfc4d[_0x545d44];return _0x2492d8;};'use strict';var Sequelize=require(_0xdfc4('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfc4('0x1')],'unique':_0xdfc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdfc4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdfc4('0x4')](_0xdfc4('0x5'),_0xdfc4('0x6'),_0xdfc4('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1ca5efb..d63c7a4 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 _0xc423=['spread','userChatQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','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','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','get','ChatQueues','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','ChatQueue','count','include','findAll','rawAttributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','UserId','agent','createdAt','rows','format','%s/%s','SIP','chatPause','updatedAt','getTeams','order','addTeams','Team','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit'];(function(_0x2b060e,_0x37e026){var _0x282f5a=function(_0x360d2e){while(--_0x360d2e){_0x2b060e['push'](_0x2b060e['shift']());}};_0x282f5a(++_0x37e026);}(_0xc423,0x131));var _0x3c42=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc423[_0x178e48];return _0x440d7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c42('0x0'));var rimraf=require(_0x3c42('0x1'));var zipdir=require(_0x3c42('0x2'));var jsonpatch=require(_0x3c42('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c42('0x4'));var util=require(_0x3c42('0x5'));var path=require(_0x3c42('0x6'));var sox=require(_0x3c42('0x7'));var csv=require('to-csv');var ejs=require(_0x3c42('0x8'));var fs=require('fs');var _=require(_0x3c42('0x9'));var squel=require(_0x3c42('0xa'));var crypto=require(_0x3c42('0xb'));var jsforce=require(_0x3c42('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c42('0xd'));var querystring=require('querystring');var Papa=require(_0x3c42('0xe'));var Redis=require(_0x3c42('0xf'));var authService=require(_0x3c42('0x10'));var qs=require(_0x3c42('0x11'));var as=require(_0x3c42('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c42('0x13'))(_0x3c42('0x14'));var utils=require('../../config/utils');var config=require(_0x3c42('0x15'));var db=require(_0x3c42('0x16'))['db'];config[_0x3c42('0x17')]=_[_0x3c42('0x18')](config[_0x3c42('0x17')],{'host':_0x3c42('0x19'),'port':0x18eb});var socket=require(_0x3c42('0x1a'))(new Redis(config[_0x3c42('0x17')]));require(_0x3c42('0x1b'))[_0x3c42('0x1c')](socket);var jayson=require(_0x3c42('0x1d'));var client=jayson[_0x3c42('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x721885,_0x230f0b,_0x412e50){if(_0x412e50){var _0x270bf8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x270bf8[_0x3c42('0x1f')](_0x230f0b)){return _0x721885;}else{throw new db['Sequelize'][(_0x3c42('0x20'))](_0x3c42('0x21'));}}else{return _0x721885;}}function respondWithRpcPromise(_0x397f71,_0x3a76ad,_0xc4ed75,_0x59dc72){return new BPromise(function(_0x3e3893,_0x2f2190){var _0xdcd0cc=_0x59dc72||client;return _0xdcd0cc[_0x3c42('0x22')](_0x397f71,_0xc4ed75)[_0x3c42('0x23')](function(_0x5a0f68){logger[_0x3c42('0x24')](_0x3c42('0x25'),_0x3a76ad,'request\x20sent');logger[_0x3c42('0x26')](_0x3c42('0x27'),_0x3a76ad,_0x3c42('0x28'),JSON[_0x3c42('0x29')](_0x5a0f68));if(_0x5a0f68[_0x3c42('0x2a')]){if(_0x5a0f68['error']['code']===0x1f4){logger[_0x3c42('0x2a')](_0x3c42('0x25'),_0x3a76ad,_0x5a0f68[_0x3c42('0x2a')][_0x3c42('0x2b')]);return _0x2f2190(_0x5a0f68[_0x3c42('0x2a')][_0x3c42('0x2b')]);}logger[_0x3c42('0x2a')](_0x3c42('0x25'),_0x3a76ad,_0x5a0f68[_0x3c42('0x2a')][_0x3c42('0x2b')]);return _0x3e3893(_0x5a0f68[_0x3c42('0x2a')][_0x3c42('0x2b')]);}else{logger[_0x3c42('0x24')](_0x3c42('0x25'),_0x3a76ad,_0x3c42('0x28'));_0x3e3893(_0x5a0f68[_0x3c42('0x2c')][_0x3c42('0x2b')]);}})[_0x3c42('0x2d')](function(_0x2a769b){logger[_0x3c42('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x3a76ad,_0x2a769b);_0x2f2190(_0x2a769b);});});}function respondWithStatusCode(_0x1f67a7,_0x331b5f){_0x331b5f=_0x331b5f||0xcc;return function(_0x3bad43){if(_0x3bad43){return _0x1f67a7[_0x3c42('0x2e')](_0x331b5f);}return _0x1f67a7[_0x3c42('0x2f')](_0x331b5f)[_0x3c42('0x30')]();};}function respondWithResult(_0x96bb96,_0x170a68){_0x170a68=_0x170a68||0xc8;return function(_0x58b5a0){if(_0x58b5a0){return _0x96bb96[_0x3c42('0x2f')](_0x170a68)[_0x3c42('0x31')](_0x58b5a0);}};}function respondWithFilteredResult(_0x23e551,_0x2ef1e3){return function(_0x42e64f){if(_0x42e64f){var _0x363e58=_0x42e64f['count'],_0x179945=_0x2ef1e3[_0x3c42('0x32')],_0x19064c=_0x2ef1e3[_0x3c42('0x32')]+_0x2ef1e3[_0x3c42('0x33')],_0x5f5acb;if(_0x19064c>=_0x363e58){_0x19064c=_0x363e58;_0x5f5acb=0xc8;}else{_0x5f5acb=0xce;}_0x23e551[_0x3c42('0x2f')](_0x5f5acb);return _0x23e551[_0x3c42('0x34')]('Content-Range',_0x179945+'-'+_0x19064c+'/'+_0x363e58)[_0x3c42('0x31')](_0x42e64f);}return null;};}function patchUpdates(_0x2fbba8){return function(_0x3b8334){try{jsonpatch[_0x3c42('0x35')](_0x3b8334,_0x2fbba8,!![]);}catch(_0x18dee2){return BPromise[_0x3c42('0x36')](_0x18dee2);}return _0x3b8334[_0x3c42('0x37')]();};}function saveUpdates(_0x430d05,_0x48e7c){return function(_0x4f25fe){if(_0x4f25fe){return _0x4f25fe[_0x3c42('0x38')](_0x430d05)[_0x3c42('0x23')](function(_0x14ac8c){return _0x14ac8c;});}return null;};}function removeEntity(_0x35a2bc,_0x3404db){return function(_0x15f722){if(_0x15f722){return _0x15f722[_0x3c42('0x39')]()['then'](function(){var _0x5b2636=_0x15f722[_0x3c42('0x3a')]({'plain':!![]});var _0x353e3c=_0x3c42('0x3b');return db['UserProfileResource'][_0x3c42('0x39')]({'where':{'type':_0x353e3c,'resourceId':_0x5b2636['id']}})['then'](function(){return _0x15f722;});})[_0x3c42('0x23')](function(){_0x35a2bc[_0x3c42('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16146e,_0x1ccc3b){return function(_0x530f8e){if(!_0x530f8e){_0x16146e[_0x3c42('0x2e')](0x194);}return _0x530f8e;};}function handleError(_0x737652,_0x517e3a){_0x517e3a=_0x517e3a||0x1f4;return function(_0x3c2fff){logger[_0x3c42('0x2a')](_0x3c2fff['stack']);if(_0x3c2fff['name']){delete _0x3c2fff[_0x3c42('0x3c')];}_0x737652[_0x3c42('0x2f')](_0x517e3a)['send'](_0x3c2fff);};}exports[_0x3c42('0x3d')]=function(_0x3465ec,_0x5f1fba){var _0x307cbf={},_0x4b2a03={},_0x2ec91f={'count':0x0,'rows':[]};var _0x2a20a3=_['map'](db['ChatQueue']['rawAttributes'],function(_0x1ef041){return{'name':_0x1ef041[_0x3c42('0x3e')],'type':_0x1ef041[_0x3c42('0x3f')][_0x3c42('0x40')]};});_0x4b2a03[_0x3c42('0x41')]=_[_0x3c42('0x42')](_0x2a20a3,_0x3c42('0x3c'));_0x4b2a03[_0x3c42('0x43')]=_[_0x3c42('0x44')](_0x3465ec[_0x3c42('0x43')]);_0x4b2a03[_0x3c42('0x45')]=_[_0x3c42('0x46')](_0x4b2a03[_0x3c42('0x41')],_0x4b2a03[_0x3c42('0x43')]);_0x307cbf['attributes']=_['intersection'](_0x4b2a03['model'],qs[_0x3c42('0x47')](_0x3465ec['query'][_0x3c42('0x47')]));_0x307cbf[_0x3c42('0x48')]=_0x307cbf[_0x3c42('0x48')][_0x3c42('0x49')]?_0x307cbf[_0x3c42('0x48')]:_0x4b2a03[_0x3c42('0x41')];if(!_0x3465ec[_0x3c42('0x43')][_0x3c42('0x4a')](_0x3c42('0x4b'))){_0x307cbf['limit']=qs[_0x3c42('0x33')](_0x3465ec[_0x3c42('0x43')][_0x3c42('0x33')]);_0x307cbf[_0x3c42('0x32')]=qs[_0x3c42('0x32')](_0x3465ec[_0x3c42('0x43')][_0x3c42('0x32')]);}_0x307cbf['order']=qs[_0x3c42('0x4c')](_0x3465ec[_0x3c42('0x43')][_0x3c42('0x4c')]);_0x307cbf[_0x3c42('0x4d')]=qs[_0x3c42('0x45')](_[_0x3c42('0x4e')](_0x3465ec[_0x3c42('0x43')],_0x4b2a03[_0x3c42('0x45')]),_0x2a20a3);if(_0x3465ec[_0x3c42('0x43')]['filter']){_0x307cbf[_0x3c42('0x4d')]=_['merge'](_0x307cbf[_0x3c42('0x4d')],{'$or':_[_0x3c42('0x42')](_0x2a20a3,function(_0x248974){if(_0x248974[_0x3c42('0x3f')]!==_0x3c42('0x4f')){var _0x1bd066={};_0x1bd066[_0x248974['name']]={'$like':'%'+_0x3465ec[_0x3c42('0x43')][_0x3c42('0x50')]+'%'};return _0x1bd066;}})});}_0x307cbf=_['merge']({},_0x307cbf,_0x3465ec['options']);var _0x3ba2a1={'where':_0x307cbf[_0x3c42('0x4d')]};return db[_0x3c42('0x51')][_0x3c42('0x52')](_0x3ba2a1)[_0x3c42('0x23')](function(_0x538c85){_0x2ec91f[_0x3c42('0x52')]=_0x538c85;if(_0x3465ec['query']['includeAll']){_0x307cbf[_0x3c42('0x53')]=[{'all':!![]}];}return db[_0x3c42('0x51')][_0x3c42('0x54')](_0x307cbf);})[_0x3c42('0x23')](function(_0x227e6d){_0x2ec91f['rows']=_0x227e6d;return _0x2ec91f;})['then'](respondWithFilteredResult(_0x5f1fba,_0x307cbf))[_0x3c42('0x2d')](handleError(_0x5f1fba,null));};exports['show']=function(_0x4191dd,_0x188404){var _0x1e3045={'raw':!![],'where':{'id':_0x4191dd['params']['id']}},_0x16c98e={};_0x16c98e[_0x3c42('0x41')]=_[_0x3c42('0x44')](db[_0x3c42('0x51')][_0x3c42('0x55')]);_0x16c98e[_0x3c42('0x43')]=_[_0x3c42('0x44')](_0x4191dd[_0x3c42('0x43')]);_0x16c98e[_0x3c42('0x45')]=_['intersection'](_0x16c98e[_0x3c42('0x41')],_0x16c98e['query']);_0x1e3045[_0x3c42('0x48')]=_[_0x3c42('0x46')](_0x16c98e[_0x3c42('0x41')],qs[_0x3c42('0x47')](_0x4191dd[_0x3c42('0x43')][_0x3c42('0x47')]));_0x1e3045[_0x3c42('0x48')]=_0x1e3045[_0x3c42('0x48')]['length']?_0x1e3045['attributes']:_0x16c98e[_0x3c42('0x41')];if(_0x4191dd['query'][_0x3c42('0x56')]){_0x1e3045[_0x3c42('0x53')]=[{'all':!![]}];}_0x1e3045=_[_0x3c42('0x57')]({},_0x1e3045,_0x4191dd[_0x3c42('0x58')]);return db[_0x3c42('0x51')][_0x3c42('0x59')](_0x1e3045)['then'](handleEntityNotFound(_0x188404,null))[_0x3c42('0x23')](respondWithResult(_0x188404,null))['catch'](handleError(_0x188404,null));};exports[_0x3c42('0x5a')]=function(_0x33f90b,_0x2f98b4){return db[_0x3c42('0x51')][_0x3c42('0x5a')](_0x33f90b['body'],{})[_0x3c42('0x23')](function(_0x499da7){var _0x39cf7a=_0x33f90b[_0x3c42('0x5b')][_0x3c42('0x3a')]({'plain':!![]});if(!_0x39cf7a)throw new Error(_0x3c42('0x5c'));if(_0x39cf7a[_0x3c42('0x5d')]===_0x3c42('0x5b')){var _0x4d833e=_0x499da7[_0x3c42('0x3a')]({'plain':!![]});var _0x1b9d01=_0x3c42('0x3b');return db[_0x3c42('0x5e')][_0x3c42('0x59')]({'where':{'name':_0x1b9d01,'userProfileId':_0x39cf7a['userProfileId']},'raw':!![]})[_0x3c42('0x23')](function(_0x28d787){if(_0x28d787&&_0x28d787[_0x3c42('0x5f')]===0x0){return db[_0x3c42('0x60')][_0x3c42('0x5a')]({'name':_0x4d833e[_0x3c42('0x3c')],'resourceId':_0x4d833e['id'],'type':_0x28d787[_0x3c42('0x3c')],'sectionId':_0x28d787['id']},{})[_0x3c42('0x23')](function(){return _0x499da7;});}else{return _0x499da7;}})[_0x3c42('0x2d')](function(_0x305e10){logger['error'](_0x3c42('0x61'),_0x305e10);throw _0x305e10;});}return _0x499da7;})['then'](respondWithResult(_0x2f98b4,0xc9))['catch'](handleError(_0x2f98b4,null));};exports[_0x3c42('0x38')]=function(_0x555888,_0x203cac){if(_0x555888[_0x3c42('0x62')]['id']){delete _0x555888[_0x3c42('0x62')]['id'];}return db[_0x3c42('0x51')]['find']({'where':{'id':_0x555888[_0x3c42('0x63')]['id']}})['then'](handleEntityNotFound(_0x203cac,null))[_0x3c42('0x23')](saveUpdates(_0x555888[_0x3c42('0x62')],null))['then'](respondWithResult(_0x203cac,null))['catch'](handleError(_0x203cac,null));};exports[_0x3c42('0x39')]=function(_0x57980b,_0x497058){return db[_0x3c42('0x51')][_0x3c42('0x59')]({'where':{'id':_0x57980b[_0x3c42('0x63')]['id']}})['then'](handleEntityNotFound(_0x497058,null))[_0x3c42('0x23')](removeEntity(_0x497058,null))[_0x3c42('0x2d')](handleError(_0x497058,null));};exports[_0x3c42('0x64')]=function(_0x315e9f,_0x1c618d){return db[_0x3c42('0x51')][_0x3c42('0x64')]()[_0x3c42('0x23')](respondWithResult(_0x1c618d,null))[_0x3c42('0x2d')](handleError(_0x1c618d,null));};exports[_0x3c42('0x65')]=function(_0x4a04e9,_0x5a132a,_0x49885f){var _0x3d7949={'raw':!![],'where':{}},_0x50574a={},_0x2cf2f4;return db[_0x3c42('0x51')][_0x3c42('0x66')]({'where':{'id':_0x4a04e9['params']['id']}})[_0x3c42('0x23')](handleEntityNotFound(_0x5a132a,null))[_0x3c42('0x23')](function(_0x988ee6){if(_0x988ee6){_0x2cf2f4=_0x988ee6[_0x3c42('0x3a')]({'plain':!![]});_0x50574a[_0x3c42('0x41')]=_[_0x3c42('0x44')](db[_0x3c42('0x67')][_0x3c42('0x55')]);_0x50574a['query']=_[_0x3c42('0x44')](_0x4a04e9[_0x3c42('0x43')]);_0x50574a[_0x3c42('0x45')]=_[_0x3c42('0x46')](_0x50574a['model'],_0x50574a['query']);_0x3d7949['attributes']=_[_0x3c42('0x46')](_0x50574a[_0x3c42('0x41')],qs[_0x3c42('0x47')](_0x4a04e9[_0x3c42('0x43')]['fields']));_0x3d7949['attributes']=_0x3d7949[_0x3c42('0x48')][_0x3c42('0x49')]?_0x3d7949['attributes']:_0x50574a['model'];if(!_0x4a04e9[_0x3c42('0x43')][_0x3c42('0x4a')](_0x3c42('0x4b'))){_0x3d7949['limit']=qs[_0x3c42('0x33')](_0x4a04e9['query'][_0x3c42('0x33')]);_0x3d7949[_0x3c42('0x32')]=qs['offset'](_0x4a04e9[_0x3c42('0x43')][_0x3c42('0x32')]);}_0x3d7949['order']=qs[_0x3c42('0x4c')](_0x4a04e9[_0x3c42('0x43')][_0x3c42('0x4c')]);_0x3d7949[_0x3c42('0x4d')]=qs[_0x3c42('0x45')](_[_0x3c42('0x4e')](_0x4a04e9[_0x3c42('0x43')],_0x50574a[_0x3c42('0x45')]));_0x3d7949[_0x3c42('0x4d')][_0x3c42('0x68')]=_0x988ee6['id'];if(_0x4a04e9['query'][_0x3c42('0x50')]){_0x3d7949[_0x3c42('0x4d')]=_[_0x3c42('0x57')](_0x3d7949[_0x3c42('0x4d')],{'$or':_[_0x3c42('0x42')](_0x3d7949[_0x3c42('0x48')],function(_0x18d22a){var _0x1d181b={};_0x1d181b[_0x18d22a]={'$like':'%'+_0x4a04e9[_0x3c42('0x43')][_0x3c42('0x50')]+'%'};return _0x1d181b;})});}_0x3d7949=_[_0x3c42('0x57')]({},_0x3d7949,_0x4a04e9[_0x3c42('0x58')]);return db[_0x3c42('0x67')][_0x3c42('0x54')](_0x3d7949);}})[_0x3c42('0x23')](function(_0x2f89){if(_0x2f89){return db[_0x3c42('0x69')]['findAndCountAll']({'where':{'id':_[_0x3c42('0x42')](_0x2f89,_0x3c42('0x6a')),'role':_0x3c42('0x6b')},'attributes':['id',_0x3c42('0x3c'),'chatPause','updatedAt',_0x3c42('0x6c')]});}})['then'](function(_0x5698b3){if(_0x5698b3){return{'count':_0x5698b3[_0x3c42('0x52')],'rows':_['map'](_0x5698b3[_0x3c42('0x6d')],function(_0x32e97a){return{'membername':_0x32e97a[_0x3c42('0x3c')],'UserId':_0x32e97a['id'],'queue_name':_0x2cf2f4[_0x3c42('0x3c')],'ChatQueueId':_0x2cf2f4['id'],'interface':util[_0x3c42('0x6e')](_0x3c42('0x6f'),_0x3c42('0x70'),_0x32e97a[_0x3c42('0x3c')]),'penalty':0x0,'paused':_0x32e97a[_0x3c42('0x71')],'createdAt':_0x32e97a[_0x3c42('0x6c')],'updatedAt':_0x32e97a[_0x3c42('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5a132a,_0x3d7949))[_0x3c42('0x2d')](handleError(_0x5a132a,null));};exports[_0x3c42('0x73')]=function(_0x26dc57,_0xd7a435,_0x5c544e){var _0x357ee2={};var _0x219d8c={};var _0x1690ca;var _0x4ad129;return db['ChatQueue'][_0x3c42('0x66')]({'where':{'id':_0x26dc57[_0x3c42('0x63')]['id']}})[_0x3c42('0x23')](handleEntityNotFound(_0xd7a435,null))['then'](function(_0x4e9611){if(_0x4e9611){_0x1690ca=_0x4e9611;_0x219d8c[_0x3c42('0x41')]=_['keys'](db['Team'][_0x3c42('0x55')]);_0x219d8c[_0x3c42('0x43')]=_['keys'](_0x26dc57[_0x3c42('0x43')]);_0x219d8c[_0x3c42('0x45')]=_[_0x3c42('0x46')](_0x219d8c[_0x3c42('0x41')],_0x219d8c[_0x3c42('0x43')]);_0x357ee2[_0x3c42('0x48')]=_[_0x3c42('0x46')](_0x219d8c[_0x3c42('0x41')],qs[_0x3c42('0x47')](_0x26dc57[_0x3c42('0x43')][_0x3c42('0x47')]));_0x357ee2['attributes']=_0x357ee2['attributes'][_0x3c42('0x49')]?_0x357ee2[_0x3c42('0x48')]:_0x219d8c['model'];_0x357ee2[_0x3c42('0x74')]=qs['sort'](_0x26dc57[_0x3c42('0x43')][_0x3c42('0x4c')]);_0x357ee2[_0x3c42('0x4d')]=qs[_0x3c42('0x45')](_[_0x3c42('0x4e')](_0x26dc57[_0x3c42('0x43')],_0x219d8c['filters']));if(_0x26dc57['query']['filter']){_0x357ee2[_0x3c42('0x4d')]=_[_0x3c42('0x57')](_0x357ee2[_0x3c42('0x4d')],{'$or':_[_0x3c42('0x42')](_0x357ee2[_0x3c42('0x48')],function(_0x39edbf){var _0x485e99={};_0x485e99[_0x39edbf]={'$like':'%'+_0x26dc57[_0x3c42('0x43')][_0x3c42('0x50')]+'%'};return _0x485e99;})});}_0x357ee2=_[_0x3c42('0x57')]({},_0x357ee2,_0x26dc57[_0x3c42('0x58')]);return _0x1690ca[_0x3c42('0x73')](_0x357ee2);}})[_0x3c42('0x23')](function(_0x388bed){if(_0x388bed){_0x4ad129=_0x388bed[_0x3c42('0x49')];if(!_0x26dc57[_0x3c42('0x43')][_0x3c42('0x4a')](_0x3c42('0x4b'))){_0x357ee2[_0x3c42('0x33')]=qs[_0x3c42('0x33')](_0x26dc57['query']['limit']);_0x357ee2[_0x3c42('0x32')]=qs[_0x3c42('0x32')](_0x26dc57[_0x3c42('0x43')][_0x3c42('0x32')]);}return _0x1690ca[_0x3c42('0x73')](_0x357ee2);}})[_0x3c42('0x23')](function(_0x3382ca){if(_0x3382ca){return _0x3382ca?{'count':_0x4ad129,'rows':_0x3382ca}:null;}})[_0x3c42('0x23')](respondWithResult(_0xd7a435,null))[_0x3c42('0x2d')](handleError(_0xd7a435,null));};exports[_0x3c42('0x75')]=function(_0x2b4506,_0x111006,_0x363884){var _0x52215e=_0x2b4506['body']['ids'];return db[_0x3c42('0x76')][_0x3c42('0x54')]({'where':{'id':_0x52215e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3c42('0x77'),'attributes':['id','name',_0x3c42('0x78'),'voicePause',_0x3c42('0x79')],'raw':!![]}]})[_0x3c42('0x23')](function(_0x2eed4c){if(_0x2eed4c){var _0x3e44bc=_[_0x3c42('0x7a')](_0x2eed4c,function(_0x4866a1){var _0x3a1f47=_0x4866a1['get']({'plain':!![]});return _0x3a1f47[_0x3c42('0x77')];});return db[_0x3c42('0x51')]['find']({'where':{'id':_0x2b4506[_0x3c42('0x63')]['id']}})[_0x3c42('0x23')](function(_0xeb4005){return db[_0x3c42('0x7b')]['transaction'](function(_0x17e470){return _0xeb4005['addTeams'](_0x52215e,{'transaction':_0x17e470})['then'](function(){return BPromise[_0x3c42('0x7c')](_0x3e44bc,function(_0x12665c){return db[_0x3c42('0x67')][_0x3c42('0x7d')]({'where':{'UserId':_0x12665c['id'],'ChatQueueId':_0x2b4506['params']['id']},'transaction':_0x17e470});});})[_0x3c42('0x23')](function(){_0x3e44bc[_0x3c42('0x7e')](function(_0x3f31df){socket[_0x3c42('0x7f')]('userChatQueue:save',{'UserId':_0x3f31df['id'],'ChatQueueId':_0xeb4005['id']});});});});});}})[_0x3c42('0x23')](respondWithStatusCode(_0x111006,null))[_0x3c42('0x2d')](handleError(_0x111006,null));};exports[_0x3c42('0x80')]=function(_0x5f2ef6,_0x58067f,_0x542a8c){return db[_0x3c42('0x76')][_0x3c42('0x54')]({'where':{'id':_0x5f2ef6[_0x3c42('0x43')][_0x3c42('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3c42('0x77'),'attributes':['id'],'raw':!![]}]})[_0x3c42('0x23')](handleEntityNotFound(_0x58067f,null))[_0x3c42('0x23')](function(_0x33475f){var _0x21f91c=_['map'](_0x33475f,'id');var _0x5b9a03=[];var _0x28391c=[];var _0x3f5bbf=squel['select']();_0x3f5bbf[_0x3c42('0x82')](_0x3c42('0x83'))['from'](_0x3c42('0x84'),'tq')[_0x3c42('0x85')]('user_has_teams','ut',_0x3c42('0x86'))[_0x3c42('0x4d')](_0x3c42('0x87'),_0x5f2ef6[_0x3c42('0x63')]['id']);for(var _0x1b84ef=0x0;_0x1b84ef<_0x33475f[_0x3c42('0x49')];_0x1b84ef+=0x1){let _0xca3175=_0x33475f[_0x1b84ef];for(var _0x59f3d2=0x0;_0x59f3d2<_0xca3175[_0x3c42('0x77')][_0x3c42('0x49')];_0x59f3d2+=0x1){let _0x13e493=_0xca3175[_0x3c42('0x77')][_0x59f3d2];var _0x1355d1=_0x3f5bbf[_0x3c42('0x88')]();_0x1355d1[_0x3c42('0x4d')]('ut.UserId\x20=\x20?',_0x13e493['id']);_0x28391c[_0x3c42('0x89')](db['sequelize']['query'](_0x1355d1['toString'](),{'type':db[_0x3c42('0x7b')][_0x3c42('0x8a')][_0x3c42('0x8b')]})['then'](function(_0x4356fe){if(_0x4356fe[_0x3c42('0x49')]===0x1){return _0x13e493['id'];}else{var _0xc84071=_['every'](_[_0x3c42('0x42')](_0x4356fe,_0x3c42('0x8c')),function(_0xa76555){return _['includes'](_0x21f91c,_0xa76555);});if(_0xc84071){return _0x13e493['id'];}}}));}}return BPromise['all'](_0x28391c)['then'](function(_0x4f80ac){_0x5b9a03=_(_0x5b9a03)['union'](_0x4f80ac)[_0x3c42('0x8d')]()[_0x3c42('0x8e')]();return db[_0x3c42('0x51')][_0x3c42('0x59')]({'where':{'id':_0x5f2ef6[_0x3c42('0x63')]['id']}})['then'](function(_0x5c6f38){return db[_0x3c42('0x7b')]['transaction'](function(_0x40fae7){return _0x5c6f38[_0x3c42('0x80')](_0x5f2ef6['query']['ids'],{'transaction':_0x40fae7})[_0x3c42('0x23')](function(){if(!_[_0x3c42('0x8f')](_0x5b9a03)){return _0x5c6f38[_0x3c42('0x90')](_0x5b9a03,{'transaction':_0x40fae7});}})[_0x3c42('0x23')](function(){_0x5b9a03['forEach'](function(_0x49b26e){socket[_0x3c42('0x7f')](_0x3c42('0x91'),{'UserId':_0x49b26e,'ChatQueueId':_0x5c6f38['id']});});});});});});})[_0x3c42('0x23')](respondWithStatusCode(_0x58067f,null))[_0x3c42('0x2d')](handleError(_0x58067f,null));};exports['addAgents']=function(_0x276332,_0x509d93,_0x4f1cbd){return db[_0x3c42('0x51')]['find']({'where':{'id':_0x276332['params']['id']}})[_0x3c42('0x23')](handleEntityNotFound(_0x509d93,null))[_0x3c42('0x23')](function(_0x49a95b){if(_0x49a95b){return _0x49a95b[_0x3c42('0x92')](_0x276332[_0x3c42('0x62')][_0x3c42('0x81')],_[_0x3c42('0x93')](_0x276332[_0x3c42('0x62')],[_0x3c42('0x81'),'id'])||{})[_0x3c42('0x94')](function(_0x18b444){for(var _0x5af2e1=0x0;_0x5af2e1<_0x276332['body'][_0x3c42('0x81')][_0x3c42('0x49')];_0x5af2e1+=0x1){socket['emit'](_0x3c42('0x95'),{'UserId':_0x276332[_0x3c42('0x62')][_0x3c42('0x81')][_0x5af2e1],'ChatQueueId':_0x276332[_0x3c42('0x63')]['id']});}return _0x18b444;});}})[_0x3c42('0x23')](respondWithResult(_0x509d93,null))[_0x3c42('0x2d')](handleError(_0x509d93,null));};exports[_0x3c42('0x90')]=function(_0x50d6a2,_0x11db54,_0x1399d2){return db[_0x3c42('0x51')][_0x3c42('0x59')]({'where':{'id':_0x50d6a2[_0x3c42('0x63')]['id']}})[_0x3c42('0x23')](handleEntityNotFound(_0x11db54,null))['then'](function(_0x1f1c03){if(_0x1f1c03){return _0x1f1c03[_0x3c42('0x90')](_0x50d6a2['query'][_0x3c42('0x81')])[_0x3c42('0x23')](function(){if(_['isArray'](_0x50d6a2[_0x3c42('0x43')][_0x3c42('0x81')])){for(var _0x701446=0x0;_0x701446<_0x50d6a2[_0x3c42('0x43')][_0x3c42('0x81')][_0x3c42('0x49')];_0x701446+=0x1){socket[_0x3c42('0x7f')](_0x3c42('0x91'),{'UserId':Number(_0x50d6a2[_0x3c42('0x43')][_0x3c42('0x81')][_0x701446]),'ChatQueueId':Number(_0x50d6a2[_0x3c42('0x63')]['id'])});}}else{socket[_0x3c42('0x7f')](_0x3c42('0x91'),{'UserId':Number(_0x50d6a2[_0x3c42('0x43')][_0x3c42('0x81')]),'ChatQueueId':Number(_0x50d6a2[_0x3c42('0x63')]['id'])});}});}})[_0x3c42('0x23')](respondWithStatusCode(_0x11db54,null))[_0x3c42('0x2d')](handleError(_0x11db54,null));};exports['getAgents']=function(_0x4334bc,_0x549b49,_0x30cd50){var _0x191ce0={};var _0x254d1f={};var _0x50ef57;var _0xaacf79;return db[_0x3c42('0x51')]['findOne']({'where':{'id':_0x4334bc[_0x3c42('0x63')]['id']}})[_0x3c42('0x23')](handleEntityNotFound(_0x549b49,null))['then'](function(_0x1a9a43){if(_0x1a9a43){_0x50ef57=_0x1a9a43;_0x254d1f[_0x3c42('0x41')]=_[_0x3c42('0x44')](db[_0x3c42('0x69')][_0x3c42('0x55')]);_0x254d1f[_0x3c42('0x43')]=_[_0x3c42('0x44')](_0x4334bc[_0x3c42('0x43')]);_0x254d1f[_0x3c42('0x45')]=_[_0x3c42('0x46')](_0x254d1f['model'],_0x254d1f[_0x3c42('0x43')]);_0x191ce0['attributes']=_['intersection'](_0x254d1f[_0x3c42('0x41')],qs['fields'](_0x4334bc[_0x3c42('0x43')][_0x3c42('0x47')]));_0x191ce0[_0x3c42('0x48')]=_0x191ce0[_0x3c42('0x48')][_0x3c42('0x49')]?_0x191ce0[_0x3c42('0x48')]:_0x254d1f[_0x3c42('0x41')];_0x191ce0[_0x3c42('0x74')]=qs[_0x3c42('0x4c')](_0x4334bc[_0x3c42('0x43')][_0x3c42('0x4c')]);_0x191ce0[_0x3c42('0x4d')]=qs[_0x3c42('0x45')](_['pick'](_0x4334bc[_0x3c42('0x43')],_0x254d1f[_0x3c42('0x45')]));if(_0x4334bc['query'][_0x3c42('0x50')]){_0x191ce0['where']=_[_0x3c42('0x57')](_0x191ce0[_0x3c42('0x4d')],{'$or':_[_0x3c42('0x42')](_0x191ce0[_0x3c42('0x48')],function(_0x4e67f6){var _0xfc16ae={};_0xfc16ae[_0x4e67f6]={'$like':'%'+_0x4334bc[_0x3c42('0x43')][_0x3c42('0x50')]+'%'};return _0xfc16ae;})});}_0x191ce0=_['merge']({},_0x191ce0,_0x4334bc['options']);return _0x50ef57[_0x3c42('0x96')](_0x191ce0);}})[_0x3c42('0x23')](function(_0x552954){if(_0x552954){_0xaacf79=_0x552954[_0x3c42('0x49')];if(!_0x4334bc[_0x3c42('0x43')]['hasOwnProperty'](_0x3c42('0x4b'))){_0x191ce0['limit']=qs[_0x3c42('0x33')](_0x4334bc['query'][_0x3c42('0x33')]);_0x191ce0[_0x3c42('0x32')]=qs[_0x3c42('0x32')](_0x4334bc[_0x3c42('0x43')][_0x3c42('0x32')]);}return _0x50ef57[_0x3c42('0x96')](_0x191ce0);}})[_0x3c42('0x23')](function(_0x54795f){if(_0x54795f){return _0x54795f?{'count':_0xaacf79,'rows':_0x54795f}:null;}})['then'](respondWithResult(_0x549b49,null))['catch'](handleError(_0x549b49,null));}; \ No newline at end of file +var _0x6b8b=['rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','name','options','includeAll','include','findAll','rows','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','ids','Team','Agents','online','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatQueue.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','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue'];(function(_0x1526fa,_0x4123d6){var _0x4fb2d5=function(_0x51e1ea){while(--_0x51e1ea){_0x1526fa['push'](_0x1526fa['shift']());}};_0x4fb2d5(++_0x4123d6);}(_0x6b8b,0x193));var _0xb6b8=function(_0x512dfd,_0x3201d3){_0x512dfd=_0x512dfd-0x0;var _0x264ceb=_0x6b8b[_0x512dfd];return _0x264ceb;};'use strict';var pdf=require(_0xb6b8('0x0'));var emlformat=require(_0xb6b8('0x1'));var rimraf=require(_0xb6b8('0x2'));var zipdir=require(_0xb6b8('0x3'));var jsonpatch=require(_0xb6b8('0x4'));var rp=require(_0xb6b8('0x5'));var moment=require(_0xb6b8('0x6'));var BPromise=require(_0xb6b8('0x7'));var Mustache=require('mustache');var util=require(_0xb6b8('0x8'));var path=require(_0xb6b8('0x9'));var sox=require('sox');var csv=require(_0xb6b8('0xa'));var ejs=require(_0xb6b8('0xb'));var fs=require('fs');var _=require(_0xb6b8('0xc'));var squel=require(_0xb6b8('0xd'));var crypto=require(_0xb6b8('0xe'));var jsforce=require(_0xb6b8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6b8('0x10'));var Papa=require('papaparse');var Redis=require(_0xb6b8('0x11'));var authService=require(_0xb6b8('0x12'));var qs=require(_0xb6b8('0x13'));var as=require(_0xb6b8('0x14'));var hardwareService=require(_0xb6b8('0x15'));var logger=require(_0xb6b8('0x16'))(_0xb6b8('0x17'));var utils=require(_0xb6b8('0x18'));var config=require('../../config/environment');var db=require(_0xb6b8('0x19'))['db'];config[_0xb6b8('0x1a')]=_[_0xb6b8('0x1b')](config[_0xb6b8('0x1a')],{'host':_0xb6b8('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6b8('0x1a')]));require(_0xb6b8('0x1d'))['register'](socket);var jayson=require(_0xb6b8('0x1e'));var client=jayson[_0xb6b8('0x1f')][_0xb6b8('0x20')]({'port':0x232a});function checkPasswordPattern(_0x21072a,_0x1ab21b,_0x43cc28){if(_0x43cc28){var _0x1902d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1902d4[_0xb6b8('0x21')](_0x1ab21b)){return _0x21072a;}else{throw new db[(_0xb6b8('0x22'))]['ValidationError'](_0xb6b8('0x23'));}}else{return _0x21072a;}}function respondWithRpcPromise(_0x427532,_0x20fe18,_0x897ff0,_0x271d0d){return new BPromise(function(_0x2c1dd0,_0x15cb56){var _0x1bd40d=_0x271d0d||client;return _0x1bd40d[_0xb6b8('0x24')](_0x427532,_0x897ff0)[_0xb6b8('0x25')](function(_0x1eb782){logger[_0xb6b8('0x26')](_0xb6b8('0x27'),_0x20fe18,_0xb6b8('0x28'));logger[_0xb6b8('0x29')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x20fe18,_0xb6b8('0x28'),JSON[_0xb6b8('0x2a')](_0x1eb782));if(_0x1eb782[_0xb6b8('0x2b')]){if(_0x1eb782['error'][_0xb6b8('0x2c')]===0x1f4){logger[_0xb6b8('0x2b')](_0xb6b8('0x27'),_0x20fe18,_0x1eb782['error'][_0xb6b8('0x2d')]);return _0x15cb56(_0x1eb782[_0xb6b8('0x2b')][_0xb6b8('0x2d')]);}logger['error'](_0xb6b8('0x27'),_0x20fe18,_0x1eb782[_0xb6b8('0x2b')][_0xb6b8('0x2d')]);return _0x2c1dd0(_0x1eb782[_0xb6b8('0x2b')][_0xb6b8('0x2d')]);}else{logger[_0xb6b8('0x26')](_0xb6b8('0x27'),_0x20fe18,_0xb6b8('0x28'));_0x2c1dd0(_0x1eb782[_0xb6b8('0x2e')][_0xb6b8('0x2d')]);}})[_0xb6b8('0x2f')](function(_0x6af570){logger[_0xb6b8('0x2b')](_0xb6b8('0x27'),_0x20fe18,_0x6af570);_0x15cb56(_0x6af570);});});}function respondWithStatusCode(_0x2885bb,_0x39484f){_0x39484f=_0x39484f||0xcc;return function(_0x3671cc){if(_0x3671cc){return _0x2885bb[_0xb6b8('0x30')](_0x39484f);}return _0x2885bb['status'](_0x39484f)[_0xb6b8('0x31')]();};}function respondWithResult(_0x49344e,_0x451aff){_0x451aff=_0x451aff||0xc8;return function(_0x5d33fc){if(_0x5d33fc){return _0x49344e[_0xb6b8('0x32')](_0x451aff)['json'](_0x5d33fc);}};}function respondWithFilteredResult(_0x3e10a8,_0x26801f){return function(_0x5c29b6){if(_0x5c29b6){var _0x519a0c=_0x5c29b6[_0xb6b8('0x33')],_0x4ad2ab=_0x26801f[_0xb6b8('0x34')],_0x386b04=_0x26801f['offset']+_0x26801f[_0xb6b8('0x35')],_0x5df5e7;if(_0x386b04>=_0x519a0c){_0x386b04=_0x519a0c;_0x5df5e7=0xc8;}else{_0x5df5e7=0xce;}_0x3e10a8[_0xb6b8('0x32')](_0x5df5e7);return _0x3e10a8[_0xb6b8('0x36')](_0xb6b8('0x37'),_0x4ad2ab+'-'+_0x386b04+'/'+_0x519a0c)[_0xb6b8('0x38')](_0x5c29b6);}return null;};}function patchUpdates(_0x1bfd94){return function(_0x3f8e7c){try{jsonpatch[_0xb6b8('0x39')](_0x3f8e7c,_0x1bfd94,!![]);}catch(_0x5a1343){return BPromise[_0xb6b8('0x3a')](_0x5a1343);}return _0x3f8e7c['save']();};}function saveUpdates(_0x25d363,_0x13a98e){return function(_0x57bc2f){if(_0x57bc2f){return _0x57bc2f[_0xb6b8('0x3b')](_0x25d363)[_0xb6b8('0x25')](function(_0x15a862){return _0x15a862;});}return null;};}function removeEntity(_0x3fc98e,_0x4f7a02){return function(_0x4de627){if(_0x4de627){return _0x4de627[_0xb6b8('0x3c')]()['then'](function(){var _0x32df24=_0x4de627['get']({'plain':!![]});var _0x4817e9=_0xb6b8('0x3d');return db[_0xb6b8('0x3e')]['destroy']({'where':{'type':_0x4817e9,'resourceId':_0x32df24['id']}})[_0xb6b8('0x25')](function(){return _0x4de627;});})[_0xb6b8('0x25')](function(){_0x3fc98e[_0xb6b8('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509645,_0xcdc732){return function(_0x3076bc){if(!_0x3076bc){_0x509645['sendStatus'](0x194);}return _0x3076bc;};}function handleError(_0x56faa0,_0x2ce697){_0x2ce697=_0x2ce697||0x1f4;return function(_0x4c41a0){logger[_0xb6b8('0x2b')](_0x4c41a0[_0xb6b8('0x3f')]);if(_0x4c41a0['name']){delete _0x4c41a0['name'];}_0x56faa0[_0xb6b8('0x32')](_0x2ce697)[_0xb6b8('0x40')](_0x4c41a0);};}exports[_0xb6b8('0x41')]=function(_0x32612e,_0x934506){var _0x8d185f={},_0x13dc4a={},_0x3af1c8={'count':0x0,'rows':[]};var _0x1eb418=_[_0xb6b8('0x42')](db[_0xb6b8('0x43')][_0xb6b8('0x44')],function(_0x3397be){return{'name':_0x3397be['fieldName'],'type':_0x3397be[_0xb6b8('0x45')][_0xb6b8('0x46')]};});_0x13dc4a['model']=_[_0xb6b8('0x42')](_0x1eb418,'name');_0x13dc4a[_0xb6b8('0x47')]=_[_0xb6b8('0x48')](_0x32612e['query']);_0x13dc4a['filters']=_[_0xb6b8('0x49')](_0x13dc4a[_0xb6b8('0x4a')],_0x13dc4a[_0xb6b8('0x47')]);_0x8d185f[_0xb6b8('0x4b')]=_[_0xb6b8('0x49')](_0x13dc4a[_0xb6b8('0x4a')],qs[_0xb6b8('0x4c')](_0x32612e['query'][_0xb6b8('0x4c')]));_0x8d185f[_0xb6b8('0x4b')]=_0x8d185f[_0xb6b8('0x4b')]['length']?_0x8d185f[_0xb6b8('0x4b')]:_0x13dc4a[_0xb6b8('0x4a')];if(!_0x32612e[_0xb6b8('0x47')][_0xb6b8('0x4d')](_0xb6b8('0x4e'))){_0x8d185f[_0xb6b8('0x35')]=qs[_0xb6b8('0x35')](_0x32612e[_0xb6b8('0x47')][_0xb6b8('0x35')]);_0x8d185f[_0xb6b8('0x34')]=qs[_0xb6b8('0x34')](_0x32612e[_0xb6b8('0x47')]['offset']);}_0x8d185f[_0xb6b8('0x4f')]=qs[_0xb6b8('0x50')](_0x32612e['query'][_0xb6b8('0x50')]);_0x8d185f['where']=qs[_0xb6b8('0x51')](_[_0xb6b8('0x52')](_0x32612e['query'],_0x13dc4a[_0xb6b8('0x51')]),_0x1eb418);if(_0x32612e['query'][_0xb6b8('0x53')]){_0x8d185f['where']=_[_0xb6b8('0x54')](_0x8d185f[_0xb6b8('0x55')],{'$or':_[_0xb6b8('0x42')](_0x1eb418,function(_0xc62814){if(_0xc62814[_0xb6b8('0x45')]!==_0xb6b8('0x56')){var _0x4fb8db={};_0x4fb8db[_0xc62814[_0xb6b8('0x57')]]={'$like':'%'+_0x32612e[_0xb6b8('0x47')][_0xb6b8('0x53')]+'%'};return _0x4fb8db;}})});}_0x8d185f=_[_0xb6b8('0x54')]({},_0x8d185f,_0x32612e[_0xb6b8('0x58')]);var _0xf578a4={'where':_0x8d185f[_0xb6b8('0x55')]};return db['ChatQueue'][_0xb6b8('0x33')](_0xf578a4)[_0xb6b8('0x25')](function(_0x161a2e){_0x3af1c8['count']=_0x161a2e;if(_0x32612e[_0xb6b8('0x47')][_0xb6b8('0x59')]){_0x8d185f[_0xb6b8('0x5a')]=[{'all':!![]}];}return db[_0xb6b8('0x43')][_0xb6b8('0x5b')](_0x8d185f);})['then'](function(_0x116f7f){_0x3af1c8[_0xb6b8('0x5c')]=_0x116f7f;return _0x3af1c8;})[_0xb6b8('0x25')](respondWithFilteredResult(_0x934506,_0x8d185f))['catch'](handleError(_0x934506,null));};exports['show']=function(_0x3e30a7,_0x4a4057){var _0x756620={'raw':!![],'where':{'id':_0x3e30a7[_0xb6b8('0x5d')]['id']}},_0x29d2de={};_0x29d2de[_0xb6b8('0x4a')]=_[_0xb6b8('0x48')](db[_0xb6b8('0x43')][_0xb6b8('0x44')]);_0x29d2de['query']=_[_0xb6b8('0x48')](_0x3e30a7['query']);_0x29d2de[_0xb6b8('0x51')]=_['intersection'](_0x29d2de[_0xb6b8('0x4a')],_0x29d2de[_0xb6b8('0x47')]);_0x756620[_0xb6b8('0x4b')]=_[_0xb6b8('0x49')](_0x29d2de[_0xb6b8('0x4a')],qs[_0xb6b8('0x4c')](_0x3e30a7[_0xb6b8('0x47')]['fields']));_0x756620[_0xb6b8('0x4b')]=_0x756620['attributes'][_0xb6b8('0x5e')]?_0x756620[_0xb6b8('0x4b')]:_0x29d2de[_0xb6b8('0x4a')];if(_0x3e30a7[_0xb6b8('0x47')]['includeAll']){_0x756620[_0xb6b8('0x5a')]=[{'all':!![]}];}_0x756620=_['merge']({},_0x756620,_0x3e30a7[_0xb6b8('0x58')]);return db[_0xb6b8('0x43')][_0xb6b8('0x5f')](_0x756620)[_0xb6b8('0x25')](handleEntityNotFound(_0x4a4057,null))['then'](respondWithResult(_0x4a4057,null))[_0xb6b8('0x2f')](handleError(_0x4a4057,null));};exports[_0xb6b8('0x60')]=function(_0x49c141,_0x218163){return db[_0xb6b8('0x43')]['create'](_0x49c141[_0xb6b8('0x61')],{})[_0xb6b8('0x25')](function(_0x519c9f){var _0x58cdff=_0x49c141[_0xb6b8('0x62')][_0xb6b8('0x63')]({'plain':!![]});if(!_0x58cdff)throw new Error(_0xb6b8('0x64'));if(_0x58cdff[_0xb6b8('0x65')]==='user'){var _0x4799f0=_0x519c9f[_0xb6b8('0x63')]({'plain':!![]});var _0x11efff=_0xb6b8('0x3d');return db[_0xb6b8('0x66')][_0xb6b8('0x5f')]({'where':{'name':_0x11efff,'userProfileId':_0x58cdff['userProfileId']},'raw':!![]})['then'](function(_0x511629){if(_0x511629&&_0x511629[_0xb6b8('0x67')]===0x0){return db['UserProfileResource'][_0xb6b8('0x60')]({'name':_0x4799f0[_0xb6b8('0x57')],'resourceId':_0x4799f0['id'],'type':_0x511629['name'],'sectionId':_0x511629['id']},{})[_0xb6b8('0x25')](function(){return _0x519c9f;});}else{return _0x519c9f;}})[_0xb6b8('0x2f')](function(_0x409be3){logger[_0xb6b8('0x2b')](_0xb6b8('0x68'),_0x409be3);throw _0x409be3;});}return _0x519c9f;})[_0xb6b8('0x25')](respondWithResult(_0x218163,0xc9))['catch'](handleError(_0x218163,null));};exports[_0xb6b8('0x3b')]=function(_0x186e8d,_0x4df112){if(_0x186e8d[_0xb6b8('0x61')]['id']){delete _0x186e8d[_0xb6b8('0x61')]['id'];}return db[_0xb6b8('0x43')][_0xb6b8('0x5f')]({'where':{'id':_0x186e8d[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x4df112,null))[_0xb6b8('0x25')](saveUpdates(_0x186e8d['body'],null))['then'](respondWithResult(_0x4df112,null))['catch'](handleError(_0x4df112,null));};exports['destroy']=function(_0x39c660,_0x5f0d08){return db[_0xb6b8('0x43')][_0xb6b8('0x5f')]({'where':{'id':_0x39c660[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x5f0d08,null))['then'](removeEntity(_0x5f0d08,null))[_0xb6b8('0x2f')](handleError(_0x5f0d08,null));};exports[_0xb6b8('0x69')]=function(_0x1fb817,_0x691e7b){return db[_0xb6b8('0x43')][_0xb6b8('0x69')]()[_0xb6b8('0x25')](respondWithResult(_0x691e7b,null))['catch'](handleError(_0x691e7b,null));};exports['getMembers']=function(_0x4ab954,_0x26ae1b,_0x12d33d){var _0x5d6718={'raw':!![],'where':{}},_0x5b01ff={},_0x17df58;return db[_0xb6b8('0x43')][_0xb6b8('0x6a')]({'where':{'id':_0x4ab954[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x26ae1b,null))['then'](function(_0x6d1cb4){if(_0x6d1cb4){_0x17df58=_0x6d1cb4[_0xb6b8('0x63')]({'plain':!![]});_0x5b01ff[_0xb6b8('0x4a')]=_[_0xb6b8('0x48')](db[_0xb6b8('0x6b')][_0xb6b8('0x44')]);_0x5b01ff[_0xb6b8('0x47')]=_[_0xb6b8('0x48')](_0x4ab954[_0xb6b8('0x47')]);_0x5b01ff['filters']=_['intersection'](_0x5b01ff[_0xb6b8('0x4a')],_0x5b01ff['query']);_0x5d6718['attributes']=_[_0xb6b8('0x49')](_0x5b01ff[_0xb6b8('0x4a')],qs[_0xb6b8('0x4c')](_0x4ab954[_0xb6b8('0x47')][_0xb6b8('0x4c')]));_0x5d6718[_0xb6b8('0x4b')]=_0x5d6718[_0xb6b8('0x4b')][_0xb6b8('0x5e')]?_0x5d6718['attributes']:_0x5b01ff[_0xb6b8('0x4a')];if(!_0x4ab954[_0xb6b8('0x47')][_0xb6b8('0x4d')](_0xb6b8('0x4e'))){_0x5d6718[_0xb6b8('0x35')]=qs['limit'](_0x4ab954['query'][_0xb6b8('0x35')]);_0x5d6718[_0xb6b8('0x34')]=qs[_0xb6b8('0x34')](_0x4ab954['query'][_0xb6b8('0x34')]);}_0x5d6718[_0xb6b8('0x4f')]=qs[_0xb6b8('0x50')](_0x4ab954['query']['sort']);_0x5d6718[_0xb6b8('0x55')]=qs[_0xb6b8('0x51')](_[_0xb6b8('0x52')](_0x4ab954['query'],_0x5b01ff[_0xb6b8('0x51')]));_0x5d6718[_0xb6b8('0x55')][_0xb6b8('0x6c')]=_0x6d1cb4['id'];if(_0x4ab954[_0xb6b8('0x47')][_0xb6b8('0x53')]){_0x5d6718[_0xb6b8('0x55')]=_[_0xb6b8('0x54')](_0x5d6718[_0xb6b8('0x55')],{'$or':_[_0xb6b8('0x42')](_0x5d6718[_0xb6b8('0x4b')],function(_0x2525ea){var _0x489ad9={};_0x489ad9[_0x2525ea]={'$like':'%'+_0x4ab954[_0xb6b8('0x47')][_0xb6b8('0x53')]+'%'};return _0x489ad9;})});}_0x5d6718=_[_0xb6b8('0x54')]({},_0x5d6718,_0x4ab954[_0xb6b8('0x58')]);return db[_0xb6b8('0x6b')]['findAll'](_0x5d6718);}})[_0xb6b8('0x25')](function(_0x39ee1c){if(_0x39ee1c){return db[_0xb6b8('0x6d')][_0xb6b8('0x6e')]({'where':{'id':_['map'](_0x39ee1c,'UserId'),'role':_0xb6b8('0x6f')},'attributes':['id',_0xb6b8('0x57'),_0xb6b8('0x70'),_0xb6b8('0x71'),'createdAt']});}})[_0xb6b8('0x25')](function(_0x4970fb){if(_0x4970fb){return{'count':_0x4970fb[_0xb6b8('0x33')],'rows':_[_0xb6b8('0x42')](_0x4970fb[_0xb6b8('0x5c')],function(_0x37bb48){return{'membername':_0x37bb48['name'],'UserId':_0x37bb48['id'],'queue_name':_0x17df58['name'],'ChatQueueId':_0x17df58['id'],'interface':util[_0xb6b8('0x72')](_0xb6b8('0x73'),_0xb6b8('0x74'),_0x37bb48[_0xb6b8('0x57')]),'penalty':0x0,'paused':_0x37bb48[_0xb6b8('0x70')],'createdAt':_0x37bb48[_0xb6b8('0x75')],'updatedAt':_0x37bb48[_0xb6b8('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x26ae1b,_0x5d6718))[_0xb6b8('0x2f')](handleError(_0x26ae1b,null));};exports[_0xb6b8('0x76')]=function(_0x5c3514,_0x532ca5,_0x59c73b){var _0x548302={};var _0x1f390d={};var _0x5879d4;var _0x31599d;return db[_0xb6b8('0x43')]['findOne']({'where':{'id':_0x5c3514[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x532ca5,null))[_0xb6b8('0x25')](function(_0x2aef7f){if(_0x2aef7f){_0x5879d4=_0x2aef7f;_0x1f390d['model']=_[_0xb6b8('0x48')](db['Team'][_0xb6b8('0x44')]);_0x1f390d[_0xb6b8('0x47')]=_[_0xb6b8('0x48')](_0x5c3514['query']);_0x1f390d['filters']=_['intersection'](_0x1f390d[_0xb6b8('0x4a')],_0x1f390d[_0xb6b8('0x47')]);_0x548302[_0xb6b8('0x4b')]=_['intersection'](_0x1f390d[_0xb6b8('0x4a')],qs[_0xb6b8('0x4c')](_0x5c3514[_0xb6b8('0x47')][_0xb6b8('0x4c')]));_0x548302[_0xb6b8('0x4b')]=_0x548302[_0xb6b8('0x4b')]['length']?_0x548302[_0xb6b8('0x4b')]:_0x1f390d['model'];_0x548302[_0xb6b8('0x4f')]=qs[_0xb6b8('0x50')](_0x5c3514[_0xb6b8('0x47')][_0xb6b8('0x50')]);_0x548302['where']=qs['filters'](_['pick'](_0x5c3514['query'],_0x1f390d['filters']));if(_0x5c3514['query'][_0xb6b8('0x53')]){_0x548302[_0xb6b8('0x55')]=_['merge'](_0x548302['where'],{'$or':_[_0xb6b8('0x42')](_0x548302[_0xb6b8('0x4b')],function(_0x15ee7f){var _0x69893e={};_0x69893e[_0x15ee7f]={'$like':'%'+_0x5c3514[_0xb6b8('0x47')]['filter']+'%'};return _0x69893e;})});}_0x548302=_[_0xb6b8('0x54')]({},_0x548302,_0x5c3514[_0xb6b8('0x58')]);return _0x5879d4['getTeams'](_0x548302);}})[_0xb6b8('0x25')](function(_0x73436){if(_0x73436){_0x31599d=_0x73436[_0xb6b8('0x5e')];if(!_0x5c3514[_0xb6b8('0x47')][_0xb6b8('0x4d')](_0xb6b8('0x4e'))){_0x548302[_0xb6b8('0x35')]=qs[_0xb6b8('0x35')](_0x5c3514[_0xb6b8('0x47')][_0xb6b8('0x35')]);_0x548302[_0xb6b8('0x34')]=qs[_0xb6b8('0x34')](_0x5c3514[_0xb6b8('0x47')][_0xb6b8('0x34')]);}return _0x5879d4['getTeams'](_0x548302);}})[_0xb6b8('0x25')](function(_0x2a8dc8){if(_0x2a8dc8){return _0x2a8dc8?{'count':_0x31599d,'rows':_0x2a8dc8}:null;}})[_0xb6b8('0x25')](respondWithResult(_0x532ca5,null))[_0xb6b8('0x2f')](handleError(_0x532ca5,null));};exports['addTeams']=function(_0x12e214,_0x133b22,_0x3e1304){var _0x52b013=_0x12e214[_0xb6b8('0x61')][_0xb6b8('0x77')];return db[_0xb6b8('0x78')]['findAll']({'where':{'id':_0x52b013},'attributes':['id'],'include':[{'model':db[_0xb6b8('0x6d')],'as':_0xb6b8('0x79'),'attributes':['id',_0xb6b8('0x57'),_0xb6b8('0x7a'),'voicePause',_0xb6b8('0x7b')],'raw':!![]}]})['then'](function(_0x45a430){if(_0x45a430){var _0x6247a4=_['flatMap'](_0x45a430,function(_0x5835df){var _0x4d99bf=_0x5835df[_0xb6b8('0x63')]({'plain':!![]});return _0x4d99bf[_0xb6b8('0x79')];});return db[_0xb6b8('0x43')][_0xb6b8('0x5f')]({'where':{'id':_0x12e214[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](function(_0x145452){return db[_0xb6b8('0x7c')]['transaction'](function(_0x43e2b0){return _0x145452[_0xb6b8('0x7d')](_0x52b013,{'transaction':_0x43e2b0})[_0xb6b8('0x25')](function(){return BPromise[_0xb6b8('0x7e')](_0x6247a4,function(_0x20c756){return db['UserChatQueue'][_0xb6b8('0x7f')]({'where':{'UserId':_0x20c756['id'],'ChatQueueId':_0x12e214[_0xb6b8('0x5d')]['id']},'transaction':_0x43e2b0});});})['then'](function(){_0x6247a4[_0xb6b8('0x80')](function(_0x2b41b3){socket[_0xb6b8('0x81')](_0xb6b8('0x82'),{'UserId':_0x2b41b3['id'],'ChatQueueId':_0x145452['id']});});});});});}})[_0xb6b8('0x25')](respondWithStatusCode(_0x133b22,null))[_0xb6b8('0x2f')](handleError(_0x133b22,null));};exports['removeTeams']=function(_0x5792bb,_0x2b970e,_0x1bc885){return db[_0xb6b8('0x78')][_0xb6b8('0x5b')]({'where':{'id':_0x5792bb[_0xb6b8('0x47')][_0xb6b8('0x77')]},'attributes':['id'],'include':[{'model':db[_0xb6b8('0x6d')],'as':_0xb6b8('0x79'),'attributes':['id'],'raw':!![]}]})[_0xb6b8('0x25')](handleEntityNotFound(_0x2b970e,null))['then'](function(_0x2a9906){var _0x1ea758=_[_0xb6b8('0x42')](_0x2a9906,'id');var _0xaa93bb=[];var _0x11b6bb=[];var _0x24817d=squel[_0xb6b8('0x83')]();_0x24817d[_0xb6b8('0x84')](_0xb6b8('0x85'))['from'](_0xb6b8('0x86'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb6b8('0x55')](_0xb6b8('0x87'),_0x5792bb[_0xb6b8('0x5d')]['id']);for(var _0x3b0b4b=0x0;_0x3b0b4b<_0x2a9906[_0xb6b8('0x5e')];_0x3b0b4b+=0x1){let _0x5625fb=_0x2a9906[_0x3b0b4b];for(var _0x502547=0x0;_0x502547<_0x5625fb[_0xb6b8('0x79')][_0xb6b8('0x5e')];_0x502547+=0x1){let _0x484358=_0x5625fb[_0xb6b8('0x79')][_0x502547];var _0x33f4e7=_0x24817d['clone']();_0x33f4e7[_0xb6b8('0x55')](_0xb6b8('0x88'),_0x484358['id']);_0x11b6bb[_0xb6b8('0x89')](db[_0xb6b8('0x7c')][_0xb6b8('0x47')](_0x33f4e7[_0xb6b8('0x8a')](),{'type':db['sequelize'][_0xb6b8('0x8b')][_0xb6b8('0x8c')]})[_0xb6b8('0x25')](function(_0x123677){if(_0x123677[_0xb6b8('0x5e')]===0x1){return _0x484358['id'];}else{var _0x7fbb73=_[_0xb6b8('0x8d')](_['map'](_0x123677,_0xb6b8('0x8e')),function(_0x11ae51){return _[_0xb6b8('0x8f')](_0x1ea758,_0x11ae51);});if(_0x7fbb73){return _0x484358['id'];}}}));}}return BPromise['all'](_0x11b6bb)[_0xb6b8('0x25')](function(_0x368901){_0xaa93bb=_(_0xaa93bb)[_0xb6b8('0x90')](_0x368901)[_0xb6b8('0x91')]()[_0xb6b8('0x92')]();return db[_0xb6b8('0x43')][_0xb6b8('0x5f')]({'where':{'id':_0x5792bb['params']['id']}})[_0xb6b8('0x25')](function(_0x1d372d){return db[_0xb6b8('0x7c')][_0xb6b8('0x93')](function(_0xb7ec9){return _0x1d372d[_0xb6b8('0x94')](_0x5792bb[_0xb6b8('0x47')][_0xb6b8('0x77')],{'transaction':_0xb7ec9})[_0xb6b8('0x25')](function(){if(!_[_0xb6b8('0x95')](_0xaa93bb)){return _0x1d372d[_0xb6b8('0x96')](_0xaa93bb,{'transaction':_0xb7ec9});}})[_0xb6b8('0x25')](function(){_0xaa93bb[_0xb6b8('0x80')](function(_0x481dd3){socket[_0xb6b8('0x81')]('userChatQueue:remove',{'UserId':_0x481dd3,'ChatQueueId':_0x1d372d['id']});});});});});});})[_0xb6b8('0x25')](respondWithStatusCode(_0x2b970e,null))['catch'](handleError(_0x2b970e,null));};exports[_0xb6b8('0x97')]=function(_0x127eef,_0x361065,_0x8a7ef8){return db['ChatQueue'][_0xb6b8('0x5f')]({'where':{'id':_0x127eef[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x361065,null))['then'](function(_0x8c7abb){if(_0x8c7abb){return _0x8c7abb[_0xb6b8('0x97')](_0x127eef['body'][_0xb6b8('0x77')],_[_0xb6b8('0x98')](_0x127eef['body'],['ids','id'])||{})[_0xb6b8('0x99')](function(_0x1cf11e){for(var _0x364fab=0x0;_0x364fab<_0x127eef[_0xb6b8('0x61')][_0xb6b8('0x77')][_0xb6b8('0x5e')];_0x364fab+=0x1){socket[_0xb6b8('0x81')](_0xb6b8('0x82'),{'UserId':_0x127eef[_0xb6b8('0x61')][_0xb6b8('0x77')][_0x364fab],'ChatQueueId':_0x127eef[_0xb6b8('0x5d')]['id']});}return _0x1cf11e;});}})[_0xb6b8('0x25')](respondWithResult(_0x361065,null))['catch'](handleError(_0x361065,null));};exports['removeAgents']=function(_0x304951,_0x242cfe,_0x4b08df){return db['ChatQueue'][_0xb6b8('0x5f')]({'where':{'id':_0x304951[_0xb6b8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x242cfe,null))[_0xb6b8('0x25')](function(_0x95d762){if(_0x95d762){return _0x95d762[_0xb6b8('0x96')](_0x304951['query'][_0xb6b8('0x77')])[_0xb6b8('0x25')](function(){if(_[_0xb6b8('0x9a')](_0x304951['query'][_0xb6b8('0x77')])){for(var _0x8423ae=0x0;_0x8423ae<_0x304951['query'][_0xb6b8('0x77')][_0xb6b8('0x5e')];_0x8423ae+=0x1){socket['emit'](_0xb6b8('0x9b'),{'UserId':Number(_0x304951['query'][_0xb6b8('0x77')][_0x8423ae]),'ChatQueueId':Number(_0x304951['params']['id'])});}}else{socket[_0xb6b8('0x81')](_0xb6b8('0x9b'),{'UserId':Number(_0x304951[_0xb6b8('0x47')][_0xb6b8('0x77')]),'ChatQueueId':Number(_0x304951[_0xb6b8('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x242cfe,null))[_0xb6b8('0x2f')](handleError(_0x242cfe,null));};exports[_0xb6b8('0x9c')]=function(_0x20c6e6,_0x2a5a99,_0x2d9855){var _0x70804a={};var _0x52fc43={};var _0x43f774;var _0xd1e662;return db[_0xb6b8('0x43')][_0xb6b8('0x6a')]({'where':{'id':_0x20c6e6[_0xb6b8('0x5d')]['id']}})[_0xb6b8('0x25')](handleEntityNotFound(_0x2a5a99,null))[_0xb6b8('0x25')](function(_0x14da1c){if(_0x14da1c){_0x43f774=_0x14da1c;_0x52fc43[_0xb6b8('0x4a')]=_[_0xb6b8('0x48')](db[_0xb6b8('0x6d')][_0xb6b8('0x44')]);_0x52fc43[_0xb6b8('0x47')]=_[_0xb6b8('0x48')](_0x20c6e6[_0xb6b8('0x47')]);_0x52fc43[_0xb6b8('0x51')]=_[_0xb6b8('0x49')](_0x52fc43[_0xb6b8('0x4a')],_0x52fc43[_0xb6b8('0x47')]);_0x70804a['attributes']=_[_0xb6b8('0x49')](_0x52fc43[_0xb6b8('0x4a')],qs[_0xb6b8('0x4c')](_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x4c')]));_0x70804a[_0xb6b8('0x4b')]=_0x70804a['attributes'][_0xb6b8('0x5e')]?_0x70804a[_0xb6b8('0x4b')]:_0x52fc43[_0xb6b8('0x4a')];_0x70804a['order']=qs[_0xb6b8('0x50')](_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x50')]);_0x70804a[_0xb6b8('0x55')]=qs['filters'](_[_0xb6b8('0x52')](_0x20c6e6[_0xb6b8('0x47')],_0x52fc43[_0xb6b8('0x51')]));if(_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x53')]){_0x70804a[_0xb6b8('0x55')]=_['merge'](_0x70804a[_0xb6b8('0x55')],{'$or':_['map'](_0x70804a[_0xb6b8('0x4b')],function(_0x4a960a){var _0x433b21={};_0x433b21[_0x4a960a]={'$like':'%'+_0x20c6e6['query'][_0xb6b8('0x53')]+'%'};return _0x433b21;})});}_0x70804a=_[_0xb6b8('0x54')]({},_0x70804a,_0x20c6e6[_0xb6b8('0x58')]);return _0x43f774[_0xb6b8('0x9c')](_0x70804a);}})[_0xb6b8('0x25')](function(_0x67b7a7){if(_0x67b7a7){_0xd1e662=_0x67b7a7['length'];if(!_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x4d')](_0xb6b8('0x4e'))){_0x70804a[_0xb6b8('0x35')]=qs[_0xb6b8('0x35')](_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x35')]);_0x70804a[_0xb6b8('0x34')]=qs[_0xb6b8('0x34')](_0x20c6e6[_0xb6b8('0x47')][_0xb6b8('0x34')]);}return _0x43f774[_0xb6b8('0x9c')](_0x70804a);}})[_0xb6b8('0x25')](function(_0x15ca3e){if(_0x15ca3e){return _0x15ca3e?{'count':_0xd1e662,'rows':_0x15ca3e}:null;}})[_0xb6b8('0x25')](respondWithResult(_0x2a5a99,null))[_0xb6b8('0x2f')](handleError(_0x2a5a99,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f36e20e..d8dd5ce 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x92751e,_0x5a3549){var _0x528f51=function(_0x32e7c7){while(--_0x32e7c7){_0x92751e['push'](_0x92751e['shift']());}};_0x528f51(++_0x5a3549);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47f2bc,_0x310401){_0x47f2bc=_0x47f2bc-0x0;var _0x5ca2c5=_0x5f2f[_0x47f2bc];return _0x5ca2c5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 4390eba..3d89135 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 _0x5eed=['../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','api','moment','bluebird','request-promise','path'];(function(_0x186020,_0x1fc7f9){var _0x30380a=function(_0x59a22d){while(--_0x59a22d){_0x186020['push'](_0x186020['shift']());}};_0x30380a(++_0x1fc7f9);}(_0x5eed,0x11d));var _0xd5ee=function(_0x420f0c,_0x525cf0){_0x420f0c=_0x420f0c-0x0;var _0x51f7db=_0x5eed[_0x420f0c];return _0x51f7db;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd5ee('0x0'));var moment=require(_0xd5ee('0x1'));var BPromise=require(_0xd5ee('0x2'));var rp=require(_0xd5ee('0x3'));var fs=require('fs');var path=require(_0xd5ee('0x4'));var rimraf=require('rimraf');var config=require(_0xd5ee('0x5'));var attributes=require(_0xd5ee('0x6'));module[_0xd5ee('0x7')]=function(_0x7e1eb4,_0x381a1d){return _0x7e1eb4['define'](_0xd5ee('0x8'),attributes,{'tableName':_0xd5ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bb1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3bb1,0x175));var _0x13bb=function(_0x5bc517,_0x4b8903){_0x5bc517=_0x5bc517-0x0;var _0x1f536e=_0x3bb1[_0x5bc517];return _0x1f536e;};'use strict';var _=require(_0x13bb('0x0'));var util=require('util');var logger=require(_0x13bb('0x1'))(_0x13bb('0x2'));var moment=require(_0x13bb('0x3'));var BPromise=require(_0x13bb('0x4'));var rp=require(_0x13bb('0x5'));var fs=require('fs');var path=require(_0x13bb('0x6'));var rimraf=require(_0x13bb('0x7'));var config=require(_0x13bb('0x8'));var attributes=require(_0x13bb('0x9'));module['exports']=function(_0x4ed11e,_0x3470b9){return _0x4ed11e['define'](_0x13bb('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 084ae2a..4600a53 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 _0xf5b6=['code','message','info','result','catch','findAll','options','raw','where','attributes','limit','model','include','map','GetChatQueue','ShowChatQueue','ChatQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1cddc7,_0x1843ea){var _0x51d6af=function(_0x521e6f){while(--_0x521e6f){_0x1cddc7['push'](_0x1cddc7['shift']());}};_0x51d6af(++_0x1843ea);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x39c5ea,_0x5856cd){_0x39c5ea=_0x39c5ea-0x0;var _0x351cd3=_0xf5b6[_0x39c5ea];return _0x351cd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f5b('0x0'));var BPromise=require(_0x6f5b('0x1'));var rs=require(_0x6f5b('0x2'));var fs=require('fs');var Redis=require(_0x6f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5b('0x4'));var logger=require(_0x6f5b('0x5'))(_0x6f5b('0x6'));var config=require(_0x6f5b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f5b('0x8')]({'port':0x232a});config[_0x6f5b('0x9')]=_['defaults'](config['redis'],{'host':_0x6f5b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f5b('0x9')]));require(_0x6f5b('0xb'))[_0x6f5b('0xc')](socket);function respondWithRpcPromise(_0x484da9,_0x39748e,_0x4ce327){return new BPromise(function(_0x2fde5b,_0xc629e){return client[_0x6f5b('0xd')](_0x484da9,_0x4ce327)[_0x6f5b('0xe')](function(_0x3aa611){logger['info'](_0x6f5b('0xf'),_0x39748e,_0x6f5b('0x10'));logger[_0x6f5b('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x39748e,'request\x20sent',JSON[_0x6f5b('0x12')](_0x3aa611));if(_0x3aa611[_0x6f5b('0x13')]){if(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x14')]===0x1f4){logger[_0x6f5b('0x13')](_0x6f5b('0xf'),_0x39748e,_0x3aa611[_0x6f5b('0x13')]['message']);return _0xc629e(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);}logger['error'](_0x6f5b('0xf'),_0x39748e,_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);return _0x2fde5b(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);}else{logger[_0x6f5b('0x16')](_0x6f5b('0xf'),_0x39748e,_0x6f5b('0x10'));_0x2fde5b(_0x3aa611[_0x6f5b('0x17')][_0x6f5b('0x15')]);}})[_0x6f5b('0x18')](function(_0x2739b1){logger[_0x6f5b('0x13')](_0x6f5b('0xf'),_0x39748e,_0x2739b1);_0xc629e(_0x2739b1);});});}exports['GetChatQueue']=function(_0x297d04){var _0x13362f=this;return new Promise(function(_0x3c18fd,_0x448a8a){return db['ChatQueue'][_0x6f5b('0x19')]({'raw':_0x297d04[_0x6f5b('0x1a')]?_0x297d04['options'][_0x6f5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x297d04[_0x6f5b('0x1a')]?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1c')]||null:null,'attributes':_0x297d04['options']?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1d')]||null:null,'limit':_0x297d04[_0x6f5b('0x1a')]?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1e')]||null:null,'include':_0x297d04[_0x6f5b('0x1a')]?_0x297d04['options']['include']?_['map'](_0x297d04['options']['include'],function(_0x4fc1d6){return{'model':db[_0x4fc1d6[_0x6f5b('0x1f')]],'as':_0x4fc1d6['as'],'attributes':_0x4fc1d6['attributes'],'include':_0x4fc1d6[_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x4fc1d6[_0x6f5b('0x20')],function(_0x5347cc){return{'model':db[_0x5347cc[_0x6f5b('0x1f')]],'as':_0x5347cc['as'],'attributes':_0x5347cc[_0x6f5b('0x1d')],'include':_0x5347cc['include']?_[_0x6f5b('0x21')](_0x5347cc[_0x6f5b('0x20')],function(_0x4fa5de){return{'model':db[_0x4fa5de[_0x6f5b('0x1f')]],'as':_0x4fa5de['as'],'attributes':_0x4fa5de[_0x6f5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5835c1){logger[_0x6f5b('0x16')](_0x6f5b('0x22'),_0x297d04);logger[_0x6f5b('0x11')](_0x6f5b('0x22'),_0x297d04,JSON[_0x6f5b('0x12')](_0x5835c1));_0x3c18fd(_0x5835c1);})[_0x6f5b('0x18')](function(_0x40aef8){logger['error'](_0x6f5b('0x22'),_0x40aef8[_0x6f5b('0x15')],_0x297d04);_0x448a8a(_0x13362f[_0x6f5b('0x13')](0x1f4,_0x40aef8[_0x6f5b('0x15')]));});});};exports[_0x6f5b('0x23')]=function(_0x30c349){var _0x5d609c=this;return new Promise(function(_0x487334,_0x19499c){return db[_0x6f5b('0x24')][_0x6f5b('0x25')]({'raw':_0x30c349['options']?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x30c349[_0x6f5b('0x1a')]?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x1c')]||null:null,'attributes':_0x30c349[_0x6f5b('0x1a')]?_0x30c349['options'][_0x6f5b('0x1d')]||null:null,'include':_0x30c349[_0x6f5b('0x1a')]?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x30c349['options'][_0x6f5b('0x20')],function(_0x4b7cbb){return{'model':db[_0x4b7cbb[_0x6f5b('0x1f')]],'as':_0x4b7cbb['as'],'attributes':_0x4b7cbb['attributes'],'include':_0x4b7cbb['include']?_[_0x6f5b('0x21')](_0x4b7cbb['include'],function(_0x393f54){return{'model':db[_0x393f54[_0x6f5b('0x1f')]],'as':_0x393f54['as'],'attributes':_0x393f54['attributes'],'include':_0x393f54[_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x393f54[_0x6f5b('0x20')],function(_0x4e70ac){return{'model':db[_0x4e70ac['model']],'as':_0x4e70ac['as'],'attributes':_0x4e70ac[_0x6f5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bb1f9){logger['info'](_0x6f5b('0x23'),_0x30c349);logger[_0x6f5b('0x11')](_0x6f5b('0x23'),_0x30c349,JSON['stringify'](_0x2bb1f9));_0x487334(_0x2bb1f9);})[_0x6f5b('0x18')](function(_0x5175d5){logger[_0x6f5b('0x13')](_0x6f5b('0x23'),_0x5175d5[_0x6f5b('0x15')],_0x30c349);_0x19499c(_0x5d609c[_0x6f5b('0x13')](0x1f4,_0x5175d5[_0x6f5b('0x15')]));});});}; \ No newline at end of file +var _0x5276=['findAll','options','raw','where','attributes','limit','include','map','model','then','GetChatQueue','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueue'];(function(_0xa7e201,_0x65f64b){var _0x12d7e0=function(_0x19968b){while(--_0x19968b){_0xa7e201['push'](_0xa7e201['shift']());}};_0x12d7e0(++_0x65f64b);}(_0x5276,0x163));var _0x6527=function(_0x38f00d,_0x477d4c){_0x38f00d=_0x38f00d-0x0;var _0x2df7c9=_0x5276[_0x38f00d];return _0x2df7c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6527('0x0'));var BPromise=require(_0x6527('0x1'));var rs=require(_0x6527('0x2'));var fs=require('fs');var Redis=require(_0x6527('0x3'));var db=require(_0x6527('0x4'))['db'];var utils=require(_0x6527('0x5'));var logger=require(_0x6527('0x6'))(_0x6527('0x7'));var config=require(_0x6527('0x8'));var jayson=require(_0x6527('0x9'));var client=jayson[_0x6527('0xa')][_0x6527('0xb')]({'port':0x232a});config[_0x6527('0xc')]=_['defaults'](config[_0x6527('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6527('0xd'))(new Redis(config[_0x6527('0xc')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4f096a,_0x523ce2,_0x1ad99b){return new BPromise(function(_0x1169a4,_0x270ecb){return client[_0x6527('0xe')](_0x4f096a,_0x1ad99b)['then'](function(_0x4a106b){logger[_0x6527('0xf')](_0x6527('0x10'),_0x523ce2,_0x6527('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x523ce2,'request\x20sent',JSON[_0x6527('0x12')](_0x4a106b));if(_0x4a106b[_0x6527('0x13')]){if(_0x4a106b['error'][_0x6527('0x14')]===0x1f4){logger['error'](_0x6527('0x10'),_0x523ce2,_0x4a106b[_0x6527('0x13')][_0x6527('0x15')]);return _0x270ecb(_0x4a106b[_0x6527('0x13')][_0x6527('0x15')]);}logger[_0x6527('0x13')]('ChatQueue,\x20%s,\x20%s',_0x523ce2,_0x4a106b[_0x6527('0x13')]['message']);return _0x1169a4(_0x4a106b[_0x6527('0x13')][_0x6527('0x15')]);}else{logger[_0x6527('0xf')](_0x6527('0x10'),_0x523ce2,'request\x20sent');_0x1169a4(_0x4a106b[_0x6527('0x16')][_0x6527('0x15')]);}})[_0x6527('0x17')](function(_0x9c1ecb){logger[_0x6527('0x13')]('ChatQueue,\x20%s,\x20%s',_0x523ce2,_0x9c1ecb);_0x270ecb(_0x9c1ecb);});});}exports['GetChatQueue']=function(_0x1e0a28){var _0x1be412=this;return new Promise(function(_0x7af757,_0x20ef21){return db[_0x6527('0x18')][_0x6527('0x19')]({'raw':_0x1e0a28[_0x6527('0x1a')]?_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0a28[_0x6527('0x1a')]?_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1c')]||null:null,'attributes':_0x1e0a28['options']?_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1d')]||null:null,'limit':_0x1e0a28['options']?_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1e')]||null:null,'include':_0x1e0a28[_0x6527('0x1a')]?_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1f')]?_[_0x6527('0x20')](_0x1e0a28[_0x6527('0x1a')][_0x6527('0x1f')],function(_0x553537){return{'model':db[_0x553537[_0x6527('0x21')]],'as':_0x553537['as'],'attributes':_0x553537[_0x6527('0x1d')],'include':_0x553537[_0x6527('0x1f')]?_[_0x6527('0x20')](_0x553537['include'],function(_0xcc7305){return{'model':db[_0xcc7305['model']],'as':_0xcc7305['as'],'attributes':_0xcc7305['attributes'],'include':_0xcc7305[_0x6527('0x1f')]?_[_0x6527('0x20')](_0xcc7305[_0x6527('0x1f')],function(_0x4e3616){return{'model':db[_0x4e3616[_0x6527('0x21')]],'as':_0x4e3616['as'],'attributes':_0x4e3616[_0x6527('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6527('0x22')](function(_0xc2cbad){logger[_0x6527('0xf')](_0x6527('0x23'),_0x1e0a28);logger['debug'](_0x6527('0x23'),_0x1e0a28,JSON[_0x6527('0x12')](_0xc2cbad));_0x7af757(_0xc2cbad);})[_0x6527('0x17')](function(_0x22e2dd){logger[_0x6527('0x13')]('GetChatQueue',_0x22e2dd[_0x6527('0x15')],_0x1e0a28);_0x20ef21(_0x1be412[_0x6527('0x13')](0x1f4,_0x22e2dd['message']));});});};exports[_0x6527('0x24')]=function(_0x28afa5){var _0x125f17=this;return new Promise(function(_0xdaa3a7,_0x3b2e5c){return db[_0x6527('0x18')][_0x6527('0x25')]({'raw':_0x28afa5[_0x6527('0x1a')]?_0x28afa5[_0x6527('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28afa5[_0x6527('0x1a')]?_0x28afa5[_0x6527('0x1a')][_0x6527('0x1c')]||null:null,'attributes':_0x28afa5[_0x6527('0x1a')]?_0x28afa5['options']['attributes']||null:null,'include':_0x28afa5[_0x6527('0x1a')]?_0x28afa5['options'][_0x6527('0x1f')]?_['map'](_0x28afa5['options'][_0x6527('0x1f')],function(_0x463305){return{'model':db[_0x463305['model']],'as':_0x463305['as'],'attributes':_0x463305[_0x6527('0x1d')],'include':_0x463305[_0x6527('0x1f')]?_[_0x6527('0x20')](_0x463305[_0x6527('0x1f')],function(_0x31a79a){return{'model':db[_0x31a79a[_0x6527('0x21')]],'as':_0x31a79a['as'],'attributes':_0x31a79a[_0x6527('0x1d')],'include':_0x31a79a[_0x6527('0x1f')]?_[_0x6527('0x20')](_0x31a79a[_0x6527('0x1f')],function(_0x549b96){return{'model':db[_0x549b96[_0x6527('0x21')]],'as':_0x549b96['as'],'attributes':_0x549b96[_0x6527('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3630c3){logger[_0x6527('0xf')](_0x6527('0x24'),_0x28afa5);logger['debug'](_0x6527('0x24'),_0x28afa5,JSON[_0x6527('0x12')](_0x3630c3));_0xdaa3a7(_0x3630c3);})[_0x6527('0x17')](function(_0x12ab59){logger['error']('ShowChatQueue',_0x12ab59['message'],_0x28afa5);_0x3b2e5c(_0x125f17[_0x6527('0x13')](0x1f4,_0x12ab59[_0x6527('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 54030ce..acc3849 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x631577,_0x38e35d){var _0x517397=function(_0x4f9228){while(--_0x4f9228){_0x631577['push'](_0x631577['shift']());}};_0x517397(++_0x38e35d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xee27f9,_0x51c4d5){_0xee27f9=_0xee27f9-0x0;var _0x1918df=_0x5f2f[_0xee27f9];return _0x1918df;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0xb10b,0x12a));var _0xbb10=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0xb10b[_0x5de818];return _0x345670;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 80ba1ed..0136d47 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 _0x3088=['express','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addAgents','put','destroy','delete','removeTeams','/:id/users','exports','multer','util','path'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x3088,0x115));var _0x8308=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x3088[_0x19ac6e];return _0x1cdcf3;};'use strict';var multer=require(_0x8308('0x0'));var util=require(_0x8308('0x1'));var path=require(_0x8308('0x2'));var timeout=require('connect-timeout');var express=require(_0x8308('0x3'));var router=express['Router']();var auth=require(_0x8308('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8308('0x5'));var controller=require(_0x8308('0x6'));router[_0x8308('0x7')]('/',auth[_0x8308('0x8')](),controller[_0x8308('0x9')]);router[_0x8308('0x7')](_0x8308('0xa'),auth[_0x8308('0x8')](),controller[_0x8308('0xb')]);router[_0x8308('0x7')](_0x8308('0xc'),auth[_0x8308('0x8')](),controller[_0x8308('0xd')]);router[_0x8308('0x7')](_0x8308('0xe'),auth['isAuthenticated'](),controller[_0x8308('0xf')]);router['get'](_0x8308('0x10'),auth[_0x8308('0x8')](),controller[_0x8308('0x11')]);router[_0x8308('0x7')]('/:id/users',auth[_0x8308('0x8')](),controller[_0x8308('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8308('0x13')]);router['post'](_0x8308('0x10'),auth[_0x8308('0x8')](),controller['addTeams']);router[_0x8308('0x14')]('/:id/users',auth[_0x8308('0x8')](),controller[_0x8308('0x15')]);router[_0x8308('0x16')](_0x8308('0xc'),auth[_0x8308('0x8')](),controller['update']);router['delete'](_0x8308('0xc'),auth[_0x8308('0x8')](),controller[_0x8308('0x17')]);router[_0x8308('0x18')](_0x8308('0x10'),auth[_0x8308('0x8')](),controller[_0x8308('0x19')]);router[_0x8308('0x18')](_0x8308('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x8308('0x1b')]=router; \ No newline at end of file +var _0x26a9=['get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller'];(function(_0x222e7f,_0x384389){var _0x4797d4=function(_0x5a72b6){while(--_0x5a72b6){_0x222e7f['push'](_0x222e7f['shift']());}};_0x4797d4(++_0x384389);}(_0x26a9,0x1ee));var _0x926a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x26a9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x926a('0x0'));var router=express[_0x926a('0x1')]();var auth=require(_0x926a('0x2'));var interaction=require(_0x926a('0x3'));var config=require(_0x926a('0x4'));var controller=require(_0x926a('0x5'));router[_0x926a('0x6')]('/',auth[_0x926a('0x7')](),controller[_0x926a('0x8')]);router['get'](_0x926a('0x9'),auth[_0x926a('0x7')](),controller['describe']);router[_0x926a('0x6')](_0x926a('0xa'),auth['isAuthenticated'](),controller[_0x926a('0xb')]);router['get'](_0x926a('0xc'),auth[_0x926a('0x7')](),controller['getMembers']);router[_0x926a('0x6')](_0x926a('0xd'),auth[_0x926a('0x7')](),controller[_0x926a('0xe')]);router['get'](_0x926a('0xf'),auth[_0x926a('0x7')](),controller[_0x926a('0x10')]);router['post']('/',auth[_0x926a('0x7')](),controller['create']);router[_0x926a('0x11')](_0x926a('0xd'),auth[_0x926a('0x7')](),controller[_0x926a('0x12')]);router[_0x926a('0x11')](_0x926a('0xf'),auth[_0x926a('0x7')](),controller['addAgents']);router[_0x926a('0x13')]('/:id',auth[_0x926a('0x7')](),controller[_0x926a('0x14')]);router[_0x926a('0x15')](_0x926a('0xa'),auth[_0x926a('0x7')](),controller[_0x926a('0x16')]);router[_0x926a('0x15')](_0x926a('0xd'),auth['isAuthenticated'](),controller[_0x926a('0x17')]);router[_0x926a('0x15')](_0x926a('0xf'),auth['isAuthenticated'](),controller[_0x926a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f60c01a..d799a21 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 _0xc13a=['sequelize','exports','STRING','DATE','moment'];(function(_0x347a0c,_0x6624e7){var _0x184eec=function(_0x3af716){while(--_0x3af716){_0x347a0c['push'](_0x347a0c['shift']());}};_0x184eec(++_0x6624e7);}(_0xc13a,0x9f));var _0xac13=function(_0x1e8233,_0x3555a6){_0x1e8233=_0x1e8233-0x0;var _0x841eb4=_0xc13a[_0x1e8233];return _0x841eb4;};'use strict';var moment=require(_0xac13('0x0'));var Sequelize=require(_0xac13('0x1'));module[_0xac13('0x2')]={'uniqueid':{'type':Sequelize[_0xac13('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xac13('0x3')]},'joinAt':{'type':Sequelize[_0xac13('0x4')]},'leaveAt':{'type':Sequelize[_0xac13('0x4')]},'acceptAt':{'type':Sequelize[_0xac13('0x4')]},'exitAt':{'type':Sequelize[_0xac13('0x4')]},'reason':{'type':Sequelize[_0xac13('0x3')]}}; \ No newline at end of file +var _0xe07d=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe07d,0x1ea));var _0xde07=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xe07d[_0x1d24eb];return _0x1dc576;};'use strict';var moment=require(_0xde07('0x0'));var Sequelize=require(_0xde07('0x1'));module[_0xde07('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xde07('0x3')]},'joinAt':{'type':Sequelize[_0xde07('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xde07('0x4')]},'exitAt':{'type':Sequelize[_0xde07('0x4')]},'reason':{'type':Sequelize[_0xde07('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 1cceb5c..85199c8 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 _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x423540,_0x5ad695){var _0x56be75=function(_0x12a670){while(--_0x12a670){_0x423540['push'](_0x423540['shift']());}};_0x56be75(++_0x5ad695);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xcb91[_0x2064e5];return _0x21a233;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['ChatQueueReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['ChatQueueReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','ChatQueueReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x6477fb,_0x120c21){var _0x33acab=function(_0x41c2c0){while(--_0x41c2c0){_0x6477fb['push'](_0x6477fb['shift']());}};_0x33acab(++_0x120c21);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['ChatQueueReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['ChatQueueReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['ChatQueueReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['ChatQueueReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 902f4d9..1efa746 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 _0x0f0a=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0f0a,0x1eb));var _0xa0f0=function(_0x3f3f1f,_0x28b7ea){_0x3f3f1f=_0x3f3f1f-0x0;var _0x16872b=_0x0f0a[_0x3f3f1f];return _0x16872b;};'use strict';var _=require(_0xa0f0('0x0'));var util=require(_0xa0f0('0x1'));var logger=require(_0xa0f0('0x2'))(_0xa0f0('0x3'));var moment=require(_0xa0f0('0x4'));var BPromise=require(_0xa0f0('0x5'));var rp=require(_0xa0f0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0f0('0x7'));var config=require(_0xa0f0('0x8'));var attributes=require(_0xa0f0('0x9'));module[_0xa0f0('0xa')]=function(_0x1c1354,_0x5dd1de){return _0x1c1354[_0xa0f0('0xb')](_0xa0f0('0xc'),attributes,{'tableName':_0xa0f0('0xd'),'paranoid':![],'indexes':[{'name':_0xa0f0('0xe'),'fields':[_0xa0f0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe13b=['rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3605be,_0x51b5a4){var _0x3788fe=function(_0x446e42){while(--_0x446e42){_0x3605be['push'](_0x3605be['shift']());}};_0x3788fe(++_0x51b5a4);}(_0xe13b,0x156));var _0xbe13=function(_0x3cc046,_0x456eec){_0x3cc046=_0x3cc046-0x0;var _0x548587=_0xe13b[_0x3cc046];return _0x548587;};'use strict';var _=require(_0xbe13('0x0'));var util=require(_0xbe13('0x1'));var logger=require(_0xbe13('0x2'))(_0xbe13('0x3'));var moment=require(_0xbe13('0x4'));var BPromise=require(_0xbe13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe13('0x6'));var config=require(_0xbe13('0x7'));var attributes=require(_0xbe13('0x8'));module['exports']=function(_0x1b9763,_0xa28114){return _0x1b9763[_0xbe13('0x9')](_0xbe13('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xbe13('0xb'),'fields':[_0xbe13('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 8b2624f..1555006 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 _0x3c75=['http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x8d2172,_0x30fbbc){var _0x528f62=function(_0x5be86c){while(--_0x5be86c){_0x8d2172['push'](_0x8d2172['shift']());}};_0x528f62(++_0x30fbbc);}(_0x3c75,0x1b0));var _0x53c7=function(_0x147967,_0x544c81){_0x147967=_0x147967-0x0;var _0x47d338=_0x3c75[_0x147967];return _0x47d338;};'use strict';var _=require('lodash');var util=require(_0x53c7('0x0'));var moment=require(_0x53c7('0x1'));var BPromise=require(_0x53c7('0x2'));var rs=require(_0x53c7('0x3'));var fs=require('fs');var Redis=require(_0x53c7('0x4'));var db=require(_0x53c7('0x5'))['db'];var utils=require(_0x53c7('0x6'));var logger=require(_0x53c7('0x7'))(_0x53c7('0x8'));var config=require(_0x53c7('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x53c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d597d,_0x2538db,_0x44f83d){return new BPromise(function(_0x1b1943,_0x25f2dc){return client[_0x53c7('0xb')](_0x2d597d,_0x44f83d)[_0x53c7('0xc')](function(_0x2a8fdf){logger[_0x53c7('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x2538db,_0x53c7('0xe'));logger[_0x53c7('0xf')](_0x53c7('0x10'),_0x2538db,'request\x20sent',JSON['stringify'](_0x2a8fdf));if(_0x2a8fdf[_0x53c7('0x11')]){if(_0x2a8fdf[_0x53c7('0x11')]['code']===0x1f4){logger[_0x53c7('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2538db,_0x2a8fdf[_0x53c7('0x11')]['message']);return _0x25f2dc(_0x2a8fdf[_0x53c7('0x11')][_0x53c7('0x12')]);}logger[_0x53c7('0x11')](_0x53c7('0x13'),_0x2538db,_0x2a8fdf[_0x53c7('0x11')]['message']);return _0x1b1943(_0x2a8fdf[_0x53c7('0x11')]['message']);}else{logger[_0x53c7('0xd')](_0x53c7('0x13'),_0x2538db,'request\x20sent');_0x1b1943(_0x2a8fdf[_0x53c7('0x14')][_0x53c7('0x12')]);}})[_0x53c7('0x15')](function(_0x19c9ed){logger[_0x53c7('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2538db,_0x19c9ed);_0x25f2dc(_0x19c9ed);});});}exports[_0x53c7('0x16')]=function(_0x3294f0){var _0x4c820f=this;return new Promise(function(_0xd1bfd1,_0x5d2c07){return db[_0x53c7('0x17')][_0x53c7('0x18')](_0x3294f0[_0x53c7('0x19')],{'raw':_0x3294f0[_0x53c7('0x1a')]?_0x3294f0[_0x53c7('0x1a')][_0x53c7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5e0a7a){logger[_0x53c7('0xd')](_0x53c7('0x16'),_0x3294f0);logger[_0x53c7('0xf')](_0x53c7('0x16'),_0x3294f0,JSON[_0x53c7('0x1c')](_0x5e0a7a));_0xd1bfd1(_0x5e0a7a);})['catch'](function(_0x13a225){logger[_0x53c7('0x11')](_0x53c7('0x16'),_0x13a225[_0x53c7('0x12')],_0x3294f0);_0x5d2c07(_0x4c820f[_0x53c7('0x11')](0x1f4,_0x13a225['message']));});});};exports[_0x53c7('0x1d')]=function(_0x50a952){var _0x20086b=this;return new Promise(function(_0xe037b2,_0xb5d7cd){return db['ChatQueueReport'][_0x53c7('0x1e')](_0x50a952['body'],{'raw':_0x50a952[_0x53c7('0x1a')]?_0x50a952[_0x53c7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50a952[_0x53c7('0x1a')]?_0x50a952[_0x53c7('0x1a')][_0x53c7('0x1f')]||null:null,'attributes':_0x50a952[_0x53c7('0x1a')]?_0x50a952[_0x53c7('0x1a')][_0x53c7('0x20')]||null:null,'limit':_0x50a952[_0x53c7('0x1a')]?_0x50a952['options'][_0x53c7('0x21')]||null:null})[_0x53c7('0xc')](function(_0x1ae9bb){logger[_0x53c7('0xd')]('UpdateChatQueueReport',_0x50a952);logger[_0x53c7('0xf')](_0x53c7('0x1d'),_0x50a952,JSON[_0x53c7('0x1c')](_0x1ae9bb));_0xe037b2(_0x1ae9bb);})[_0x53c7('0x15')](function(_0x41f3ce){logger[_0x53c7('0x11')](_0x53c7('0x1d'),_0x41f3ce[_0x53c7('0x12')],_0x50a952);_0xb5d7cd(_0x20086b[_0x53c7('0x11')](0x1f4,_0x41f3ce[_0x53c7('0x12')]));});});}; \ No newline at end of file +var _0x14a6=['attributes','limit','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','body','options','catch','UpdateChatQueueReport','raw','where'];(function(_0x51cd2b,_0x36af29){var _0x253dbb=function(_0x4b349f){while(--_0x4b349f){_0x51cd2b['push'](_0x51cd2b['shift']());}};_0x253dbb(++_0x36af29);}(_0x14a6,0x198));var _0x614a=function(_0x9b163,_0x5d8c8f){_0x9b163=_0x9b163-0x0;var _0x824910=_0x14a6[_0x9b163];return _0x824910;};'use strict';var _=require(_0x614a('0x0'));var util=require(_0x614a('0x1'));var moment=require(_0x614a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x614a('0x3'))['db'];var utils=require(_0x614a('0x4'));var logger=require(_0x614a('0x5'))(_0x614a('0x6'));var config=require('../../config/environment');var jayson=require(_0x614a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x205efc,_0x569d55,_0x3b22ee){return new BPromise(function(_0x2c9d16,_0x25a13c){return client[_0x614a('0x8')](_0x205efc,_0x3b22ee)[_0x614a('0x9')](function(_0x2e5bec){logger[_0x614a('0xa')](_0x614a('0xb'),_0x569d55,_0x614a('0xc'));logger[_0x614a('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x569d55,'request\x20sent',JSON[_0x614a('0xe')](_0x2e5bec));if(_0x2e5bec[_0x614a('0xf')]){if(_0x2e5bec['error'][_0x614a('0x10')]===0x1f4){logger[_0x614a('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x569d55,_0x2e5bec[_0x614a('0xf')][_0x614a('0x11')]);return _0x25a13c(_0x2e5bec['error']['message']);}logger['error'](_0x614a('0xb'),_0x569d55,_0x2e5bec['error'][_0x614a('0x11')]);return _0x2c9d16(_0x2e5bec[_0x614a('0xf')][_0x614a('0x11')]);}else{logger[_0x614a('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x569d55,_0x614a('0xc'));_0x2c9d16(_0x2e5bec[_0x614a('0x12')][_0x614a('0x11')]);}})['catch'](function(_0x47dd79){logger[_0x614a('0xf')](_0x614a('0xb'),_0x569d55,_0x47dd79);_0x25a13c(_0x47dd79);});});}exports[_0x614a('0x13')]=function(_0xed8a29){var _0x22d822=this;return new Promise(function(_0x27b764,_0x113603){return db[_0x614a('0x14')]['create'](_0xed8a29[_0x614a('0x15')],{'raw':_0xed8a29[_0x614a('0x16')]?_0xed8a29[_0x614a('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4abbad){logger[_0x614a('0xa')](_0x614a('0x13'),_0xed8a29);logger[_0x614a('0xd')](_0x614a('0x13'),_0xed8a29,JSON['stringify'](_0x4abbad));_0x27b764(_0x4abbad);})[_0x614a('0x17')](function(_0x4b13f0){logger[_0x614a('0xf')](_0x614a('0x13'),_0x4b13f0[_0x614a('0x11')],_0xed8a29);_0x113603(_0x22d822[_0x614a('0xf')](0x1f4,_0x4b13f0[_0x614a('0x11')]));});});};exports[_0x614a('0x18')]=function(_0x3e148c){var _0x1953f5=this;return new Promise(function(_0x5bc322,_0x4a4386){return db[_0x614a('0x14')]['update'](_0x3e148c[_0x614a('0x15')],{'raw':_0x3e148c[_0x614a('0x16')]?_0x3e148c[_0x614a('0x16')][_0x614a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e148c['options']?_0x3e148c[_0x614a('0x16')][_0x614a('0x1a')]||null:null,'attributes':_0x3e148c[_0x614a('0x16')]?_0x3e148c[_0x614a('0x16')][_0x614a('0x1b')]||null:null,'limit':_0x3e148c['options']?_0x3e148c[_0x614a('0x16')][_0x614a('0x1c')]||null:null})[_0x614a('0x9')](function(_0x1ad0d7){logger[_0x614a('0xa')](_0x614a('0x18'),_0x3e148c);logger[_0x614a('0xd')]('UpdateChatQueueReport',_0x3e148c,JSON['stringify'](_0x1ad0d7));_0x5bc322(_0x1ad0d7);})[_0x614a('0x17')](function(_0x55d6bb){logger[_0x614a('0xf')](_0x614a('0x18'),_0x55d6bb[_0x614a('0x11')],_0x3e148c);_0x4a4386(_0x1953f5[_0x614a('0xf')](0x1f4,_0x55d6bb[_0x614a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1a6fc91..2e46d64 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 _0xcaaa=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x165d6e,_0x4601ff){var _0x5a7f4e=function(_0x56d12f){while(--_0x56d12f){_0x165d6e['push'](_0x165d6e['shift']());}};_0x5a7f4e(++_0x4601ff);}(_0xcaaa,0xac));var _0xacaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaaa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xacaa('0x0'));var path=require('path');var timeout=require(_0xacaa('0x1'));var express=require(_0xacaa('0x2'));var router=express[_0xacaa('0x3')]();var auth=require(_0xacaa('0x4'));var interaction=require(_0xacaa('0x5'));var config=require(_0xacaa('0x6'));var controller=require(_0xacaa('0x7'));router[_0xacaa('0x8')]('/',auth[_0xacaa('0x9')](),controller[_0xacaa('0xa')]);router[_0xacaa('0x8')](_0xacaa('0xb'),auth[_0xacaa('0x9')](),controller[_0xacaa('0xc')]);router['get'](_0xacaa('0xd'),auth[_0xacaa('0x9')](),controller['show']);router[_0xacaa('0xe')]('/',auth['isAuthenticated'](),controller[_0xacaa('0xf')]);router[_0xacaa('0x10')](_0xacaa('0xd'),auth[_0xacaa('0x9')](),controller[_0xacaa('0x11')]);router['delete'](_0xacaa('0xd'),auth[_0xacaa('0x9')](),controller['destroy']);module[_0xacaa('0x12')]=router; \ No newline at end of file +var _0x588f=['update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xcd4f5d,_0x511f91){var _0x4671c0=function(_0x491697){while(--_0x491697){_0xcd4f5d['push'](_0xcd4f5d['shift']());}};_0x4671c0(++_0x511f91);}(_0x588f,0xbe));var _0xf588=function(_0x503f4d,_0x476e97){_0x503f4d=_0x503f4d-0x0;var _0x4ce6d1=_0x588f[_0x503f4d];return _0x4ce6d1;};'use strict';var multer=require(_0xf588('0x0'));var util=require('util');var path=require(_0xf588('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf588('0x2')]();var auth=require(_0xf588('0x3'));var interaction=require(_0xf588('0x4'));var config=require(_0xf588('0x5'));var controller=require(_0xf588('0x6'));router[_0xf588('0x7')]('/',auth[_0xf588('0x8')](),controller[_0xf588('0x9')]);router[_0xf588('0x7')]('/describe',auth[_0xf588('0x8')](),controller['describe']);router['get'](_0xf588('0xa'),auth[_0xf588('0x8')](),controller[_0xf588('0xb')]);router[_0xf588('0xc')]('/',auth['isAuthenticated'](),controller[_0xf588('0xd')]);router['put'](_0xf588('0xa'),auth[_0xf588('0x8')](),controller[_0xf588('0xe')]);router[_0xf588('0xf')](_0xf588('0xa'),auth[_0xf588('0x8')](),controller['destroy']);module[_0xf588('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9c0343f..5ee24df 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 _0x5c11=['DATE','NOW','sequelize','STRING','ENUM','account','queue'];(function(_0x2525b9,_0x5267b1){var _0x40bbe6=function(_0x26baed){while(--_0x26baed){_0x2525b9['push'](_0x2525b9['shift']());}};_0x40bbe6(++_0x5267b1);}(_0x5c11,0xd4));var _0x15c1=function(_0x288db3,_0x3a88a0){_0x288db3=_0x288db3-0x0;var _0x2a476e=_0x5c11[_0x288db3];return _0x2a476e;};'use strict';var moment=require('moment');var Sequelize=require(_0x15c1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15c1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x15c1('0x2')](_0x15c1('0x3'),'agent',_0x15c1('0x4')),'allowNull':![],'defaultValue':_0x15c1('0x4')},'transferredAt':{'type':Sequelize[_0x15c1('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x15c1('0x6')]}}; \ No newline at end of file +var _0x6e86=['account','agent','queue','moment','sequelize','exports','STRING'];(function(_0x5d7c33,_0x4e96e2){var _0x376f06=function(_0x483e07){while(--_0x483e07){_0x5d7c33['push'](_0x5d7c33['shift']());}};_0x376f06(++_0x4e96e2);}(_0x6e86,0x96));var _0x66e8=function(_0x285680,_0x18ce0e){_0x285680=_0x285680-0x0;var _0x4140ae=_0x6e86[_0x285680];return _0x4140ae;};'use strict';var moment=require(_0x66e8('0x0'));var Sequelize=require(_0x66e8('0x1'));module[_0x66e8('0x2')]={'uniqueid':{'type':Sequelize[_0x66e8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x66e8('0x4'),_0x66e8('0x5'),'queue'),'allowNull':![],'defaultValue':_0x66e8('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b1d06b4..d823044 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 _0x1ac3=['show','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','count','includeAll','include','findAll','rows','catch'];(function(_0x3b0ea6,_0x451182){var _0x419f88=function(_0x5f0f49){while(--_0x5f0f49){_0x3b0ea6['push'](_0x3b0ea6['shift']());}};_0x419f88(++_0x451182);}(_0x1ac3,0xdf));var _0x31ac=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1ac3[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0x31ac('0x0'));var emlformat=require(_0x31ac('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31ac('0x3'));var BPromise=require(_0x31ac('0x4'));var Mustache=require(_0x31ac('0x5'));var util=require(_0x31ac('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31ac('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x31ac('0x8'));var jsforce=require(_0x31ac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x31ac('0x7'));var querystring=require(_0x31ac('0xa'));var Papa=require(_0x31ac('0xb'));var Redis=require(_0x31ac('0xc'));var authService=require(_0x31ac('0xd'));var qs=require(_0x31ac('0xe'));var as=require(_0x31ac('0xf'));var hardwareService=require(_0x31ac('0x10'));var logger=require(_0x31ac('0x11'))(_0x31ac('0x12'));var utils=require(_0x31ac('0x13'));var config=require(_0x31ac('0x14'));var db=require(_0x31ac('0x15'))['db'];function respondWithStatusCode(_0x53c6b7,_0x269e04){_0x269e04=_0x269e04||0xcc;return function(_0x4e6c07){if(_0x4e6c07){return _0x53c6b7[_0x31ac('0x16')](_0x269e04);}return _0x53c6b7[_0x31ac('0x17')](_0x269e04)[_0x31ac('0x18')]();};}function respondWithResult(_0x5c7b5c,_0x5a7562){_0x5a7562=_0x5a7562||0xc8;return function(_0x207dd7){if(_0x207dd7){return _0x5c7b5c[_0x31ac('0x17')](_0x5a7562)[_0x31ac('0x19')](_0x207dd7);}};}function respondWithFilteredResult(_0x32331c,_0x1285fb){return function(_0x288ba7){if(_0x288ba7){var _0x582316=_0x288ba7['count'],_0x459b07=_0x1285fb['offset'],_0x497411=_0x1285fb[_0x31ac('0x1a')]+_0x1285fb[_0x31ac('0x1b')],_0x2c227c;if(_0x497411>=_0x582316){_0x497411=_0x582316;_0x2c227c=0xc8;}else{_0x2c227c=0xce;}_0x32331c[_0x31ac('0x17')](_0x2c227c);return _0x32331c[_0x31ac('0x1c')](_0x31ac('0x1d'),_0x459b07+'-'+_0x497411+'/'+_0x582316)[_0x31ac('0x19')](_0x288ba7);}return null;};}function patchUpdates(_0x58b9d0){return function(_0x568272){try{jsonpatch['apply'](_0x568272,_0x58b9d0,!![]);}catch(_0x2f0a4a){return BPromise[_0x31ac('0x1e')](_0x2f0a4a);}return _0x568272[_0x31ac('0x1f')]();};}function saveUpdates(_0x13217c,_0x2dd278){return function(_0x3e9eec){if(_0x3e9eec){return _0x3e9eec['update'](_0x13217c)[_0x31ac('0x20')](function(_0x185429){return _0x185429;});}return null;};}function removeEntity(_0x80158b,_0x2fed0c){return function(_0x4ce258){if(_0x4ce258){return _0x4ce258[_0x31ac('0x21')]()[_0x31ac('0x20')](function(){_0x80158b[_0x31ac('0x17')](0xcc)[_0x31ac('0x18')]();});}};}function handleEntityNotFound(_0x20e15f,_0x3a951d){return function(_0x2d504f){if(!_0x2d504f){_0x20e15f['sendStatus'](0x194);}return _0x2d504f;};}function handleError(_0xcb7f59,_0x396c47){_0x396c47=_0x396c47||0x1f4;return function(_0x44cdab){logger['error'](_0x44cdab[_0x31ac('0x22')]);if(_0x44cdab[_0x31ac('0x23')]){delete _0x44cdab['name'];}_0xcb7f59['status'](_0x396c47)['send'](_0x44cdab);};}exports['index']=function(_0x5ea27b,_0x32d397){var _0xe8b0bd={},_0x47332f={},_0xb90d73={'count':0x0,'rows':[]};var _0x1c96be=_[_0x31ac('0x24')](db['ChatTransferReport']['rawAttributes'],function(_0x32c2ab){return{'name':_0x32c2ab[_0x31ac('0x25')],'type':_0x32c2ab[_0x31ac('0x26')][_0x31ac('0x27')]};});_0x47332f[_0x31ac('0x28')]=_[_0x31ac('0x24')](_0x1c96be,_0x31ac('0x23'));_0x47332f[_0x31ac('0x29')]=_[_0x31ac('0x2a')](_0x5ea27b[_0x31ac('0x29')]);_0x47332f[_0x31ac('0x2b')]=_['intersection'](_0x47332f[_0x31ac('0x28')],_0x47332f['query']);_0xe8b0bd[_0x31ac('0x2c')]=_[_0x31ac('0x2d')](_0x47332f['model'],qs['fields'](_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x2e')]));_0xe8b0bd[_0x31ac('0x2c')]=_0xe8b0bd['attributes'][_0x31ac('0x2f')]?_0xe8b0bd[_0x31ac('0x2c')]:_0x47332f[_0x31ac('0x28')];if(!_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x30')](_0x31ac('0x31'))){_0xe8b0bd[_0x31ac('0x1b')]=qs[_0x31ac('0x1b')](_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x1b')]);_0xe8b0bd['offset']=qs[_0x31ac('0x1a')](_0x5ea27b[_0x31ac('0x29')]['offset']);}_0xe8b0bd[_0x31ac('0x32')]=qs['sort'](_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x33')]);_0xe8b0bd[_0x31ac('0x34')]=qs[_0x31ac('0x2b')](_[_0x31ac('0x35')](_0x5ea27b[_0x31ac('0x29')],_0x47332f[_0x31ac('0x2b')]),_0x1c96be);if(_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x36')]){_0xe8b0bd[_0x31ac('0x34')]=_[_0x31ac('0x37')](_0xe8b0bd[_0x31ac('0x34')],{'$or':_[_0x31ac('0x24')](_0x1c96be,function(_0xb8016d){if(_0xb8016d[_0x31ac('0x26')]!==_0x31ac('0x38')){var _0x1b7ef0={};_0x1b7ef0[_0xb8016d[_0x31ac('0x23')]]={'$like':'%'+_0x5ea27b[_0x31ac('0x29')][_0x31ac('0x36')]+'%'};return _0x1b7ef0;}})});}_0xe8b0bd=_[_0x31ac('0x37')]({},_0xe8b0bd,_0x5ea27b[_0x31ac('0x39')]);var _0x4dae72={'where':_0xe8b0bd[_0x31ac('0x34')]};return db[_0x31ac('0x3a')][_0x31ac('0x3b')](_0x4dae72)[_0x31ac('0x20')](function(_0x4121b3){_0xb90d73[_0x31ac('0x3b')]=_0x4121b3;if(_0x5ea27b['query'][_0x31ac('0x3c')]){_0xe8b0bd[_0x31ac('0x3d')]=[{'all':!![]}];}return db[_0x31ac('0x3a')][_0x31ac('0x3e')](_0xe8b0bd);})['then'](function(_0x4217c1){_0xb90d73[_0x31ac('0x3f')]=_0x4217c1;return _0xb90d73;})[_0x31ac('0x20')](respondWithFilteredResult(_0x32d397,_0xe8b0bd))[_0x31ac('0x40')](handleError(_0x32d397,null));};exports[_0x31ac('0x41')]=function(_0x1319f4,_0x5d0f5d){var _0x36607e={'raw':!![],'where':{'id':_0x1319f4['params']['id']}},_0x333f25={};_0x333f25[_0x31ac('0x28')]=_[_0x31ac('0x2a')](db[_0x31ac('0x3a')]['rawAttributes']);_0x333f25['query']=_[_0x31ac('0x2a')](_0x1319f4['query']);_0x333f25[_0x31ac('0x2b')]=_['intersection'](_0x333f25['model'],_0x333f25[_0x31ac('0x29')]);_0x36607e[_0x31ac('0x2c')]=_[_0x31ac('0x2d')](_0x333f25[_0x31ac('0x28')],qs['fields'](_0x1319f4['query'][_0x31ac('0x2e')]));_0x36607e[_0x31ac('0x2c')]=_0x36607e[_0x31ac('0x2c')][_0x31ac('0x2f')]?_0x36607e[_0x31ac('0x2c')]:_0x333f25[_0x31ac('0x28')];if(_0x1319f4['query']['includeAll']){_0x36607e[_0x31ac('0x3d')]=[{'all':!![]}];}_0x36607e=_[_0x31ac('0x37')]({},_0x36607e,_0x1319f4[_0x31ac('0x39')]);return db['ChatTransferReport'][_0x31ac('0x42')](_0x36607e)[_0x31ac('0x20')](handleEntityNotFound(_0x5d0f5d,null))[_0x31ac('0x20')](respondWithResult(_0x5d0f5d,null))[_0x31ac('0x40')](handleError(_0x5d0f5d,null));};exports[_0x31ac('0x43')]=function(_0x25cc5e,_0x953ea){return db['ChatTransferReport'][_0x31ac('0x43')](_0x25cc5e[_0x31ac('0x44')],{})[_0x31ac('0x20')](respondWithResult(_0x953ea,0xc9))[_0x31ac('0x40')](handleError(_0x953ea,null));};exports[_0x31ac('0x45')]=function(_0x2ab6cf,_0x2a4218){if(_0x2ab6cf[_0x31ac('0x44')]['id']){delete _0x2ab6cf[_0x31ac('0x44')]['id'];}return db['ChatTransferReport'][_0x31ac('0x42')]({'where':{'id':_0x2ab6cf[_0x31ac('0x46')]['id']}})[_0x31ac('0x20')](handleEntityNotFound(_0x2a4218,null))[_0x31ac('0x20')](saveUpdates(_0x2ab6cf[_0x31ac('0x44')],null))[_0x31ac('0x20')](respondWithResult(_0x2a4218,null))[_0x31ac('0x40')](handleError(_0x2a4218,null));};exports['destroy']=function(_0x386c59,_0xc1ae66){return db[_0x31ac('0x3a')][_0x31ac('0x42')]({'where':{'id':_0x386c59[_0x31ac('0x46')]['id']}})[_0x31ac('0x20')](handleEntityNotFound(_0xc1ae66,null))['then'](removeEntity(_0xc1ae66,null))[_0x31ac('0x40')](handleError(_0xc1ae66,null));};exports[_0x31ac('0x47')]=function(_0x3faddb,_0x162f79){return db[_0x31ac('0x3a')][_0x31ac('0x47')]()[_0x31ac('0x20')](respondWithResult(_0x162f79,null))[_0x31ac('0x40')](handleError(_0x162f79,null));}; \ No newline at end of file +var _0x9a08=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','findAll','rows','catch','params','length','include','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','set','Content-Range'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9a08,0x1ac));var _0x89a0=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0x9a08[_0x1e9e56];return _0x5d5e2e;};'use strict';var pdf=require(_0x89a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89a0('0x1'));var zipdir=require(_0x89a0('0x2'));var jsonpatch=require(_0x89a0('0x3'));var rp=require(_0x89a0('0x4'));var moment=require(_0x89a0('0x5'));var BPromise=require(_0x89a0('0x6'));var Mustache=require(_0x89a0('0x7'));var util=require(_0x89a0('0x8'));var path=require(_0x89a0('0x9'));var sox=require(_0x89a0('0xa'));var csv=require('to-csv');var ejs=require(_0x89a0('0xb'));var fs=require('fs');var _=require(_0x89a0('0xc'));var squel=require(_0x89a0('0xd'));var crypto=require(_0x89a0('0xe'));var jsforce=require(_0x89a0('0xf'));var deskjs=require(_0x89a0('0x10'));var toCsv=require(_0x89a0('0x11'));var querystring=require(_0x89a0('0x12'));var Papa=require('papaparse');var Redis=require(_0x89a0('0x13'));var authService=require(_0x89a0('0x14'));var qs=require(_0x89a0('0x15'));var as=require(_0x89a0('0x16'));var hardwareService=require(_0x89a0('0x17'));var logger=require('../../config/logger')(_0x89a0('0x18'));var utils=require(_0x89a0('0x19'));var config=require(_0x89a0('0x1a'));var db=require(_0x89a0('0x1b'))['db'];function respondWithStatusCode(_0xe96d06,_0x4d31ef){_0x4d31ef=_0x4d31ef||0xcc;return function(_0x891963){if(_0x891963){return _0xe96d06['sendStatus'](_0x4d31ef);}return _0xe96d06[_0x89a0('0x1c')](_0x4d31ef)[_0x89a0('0x1d')]();};}function respondWithResult(_0x53ffa1,_0x43a488){_0x43a488=_0x43a488||0xc8;return function(_0x24290b){if(_0x24290b){return _0x53ffa1[_0x89a0('0x1c')](_0x43a488)[_0x89a0('0x1e')](_0x24290b);}};}function respondWithFilteredResult(_0xdc294d,_0x861029){return function(_0x385ace){if(_0x385ace){var _0x58080d=_0x385ace[_0x89a0('0x1f')],_0x18f7dc=_0x861029['offset'],_0x41b8b8=_0x861029['offset']+_0x861029['limit'],_0x5c8498;if(_0x41b8b8>=_0x58080d){_0x41b8b8=_0x58080d;_0x5c8498=0xc8;}else{_0x5c8498=0xce;}_0xdc294d['status'](_0x5c8498);return _0xdc294d[_0x89a0('0x20')](_0x89a0('0x21'),_0x18f7dc+'-'+_0x41b8b8+'/'+_0x58080d)[_0x89a0('0x1e')](_0x385ace);}return null;};}function patchUpdates(_0x12031a){return function(_0x776fc3){try{jsonpatch[_0x89a0('0x22')](_0x776fc3,_0x12031a,!![]);}catch(_0x3a5b86){return BPromise[_0x89a0('0x23')](_0x3a5b86);}return _0x776fc3[_0x89a0('0x24')]();};}function saveUpdates(_0x8282a3,_0xa63382){return function(_0x4280c0){if(_0x4280c0){return _0x4280c0[_0x89a0('0x25')](_0x8282a3)[_0x89a0('0x26')](function(_0x56c766){return _0x56c766;});}return null;};}function removeEntity(_0x227f9c,_0x24890e){return function(_0x413a16){if(_0x413a16){return _0x413a16[_0x89a0('0x27')]()['then'](function(){_0x227f9c[_0x89a0('0x1c')](0xcc)[_0x89a0('0x1d')]();});}};}function handleEntityNotFound(_0x149f41,_0x3b9931){return function(_0x234b98){if(!_0x234b98){_0x149f41['sendStatus'](0x194);}return _0x234b98;};}function handleError(_0x49d15c,_0xc8d558){_0xc8d558=_0xc8d558||0x1f4;return function(_0x43c5c1){logger[_0x89a0('0x28')](_0x43c5c1[_0x89a0('0x29')]);if(_0x43c5c1[_0x89a0('0x2a')]){delete _0x43c5c1['name'];}_0x49d15c[_0x89a0('0x1c')](_0xc8d558)[_0x89a0('0x2b')](_0x43c5c1);};}exports[_0x89a0('0x2c')]=function(_0x219074,_0x105a9f){var _0x58b6d7={},_0x2fcd12={},_0x51b5a2={'count':0x0,'rows':[]};var _0x502c0e=_[_0x89a0('0x2d')](db[_0x89a0('0x2e')][_0x89a0('0x2f')],function(_0x2148da){return{'name':_0x2148da['fieldName'],'type':_0x2148da[_0x89a0('0x30')]['key']};});_0x2fcd12['model']=_[_0x89a0('0x2d')](_0x502c0e,'name');_0x2fcd12[_0x89a0('0x31')]=_[_0x89a0('0x32')](_0x219074[_0x89a0('0x31')]);_0x2fcd12[_0x89a0('0x33')]=_['intersection'](_0x2fcd12['model'],_0x2fcd12[_0x89a0('0x31')]);_0x58b6d7[_0x89a0('0x34')]=_[_0x89a0('0x35')](_0x2fcd12[_0x89a0('0x36')],qs['fields'](_0x219074[_0x89a0('0x31')][_0x89a0('0x37')]));_0x58b6d7[_0x89a0('0x34')]=_0x58b6d7[_0x89a0('0x34')]['length']?_0x58b6d7[_0x89a0('0x34')]:_0x2fcd12['model'];if(!_0x219074[_0x89a0('0x31')][_0x89a0('0x38')](_0x89a0('0x39'))){_0x58b6d7[_0x89a0('0x3a')]=qs[_0x89a0('0x3a')](_0x219074[_0x89a0('0x31')]['limit']);_0x58b6d7[_0x89a0('0x3b')]=qs[_0x89a0('0x3b')](_0x219074[_0x89a0('0x31')][_0x89a0('0x3b')]);}_0x58b6d7[_0x89a0('0x3c')]=qs['sort'](_0x219074[_0x89a0('0x31')][_0x89a0('0x3d')]);_0x58b6d7[_0x89a0('0x3e')]=qs[_0x89a0('0x33')](_[_0x89a0('0x3f')](_0x219074[_0x89a0('0x31')],_0x2fcd12[_0x89a0('0x33')]),_0x502c0e);if(_0x219074[_0x89a0('0x31')][_0x89a0('0x40')]){_0x58b6d7[_0x89a0('0x3e')]=_[_0x89a0('0x41')](_0x58b6d7[_0x89a0('0x3e')],{'$or':_['map'](_0x502c0e,function(_0x2868de){if(_0x2868de['type']!=='VIRTUAL'){var _0x4f67d5={};_0x4f67d5[_0x2868de[_0x89a0('0x2a')]]={'$like':'%'+_0x219074['query'][_0x89a0('0x40')]+'%'};return _0x4f67d5;}})});}_0x58b6d7=_[_0x89a0('0x41')]({},_0x58b6d7,_0x219074['options']);var _0x581ae9={'where':_0x58b6d7[_0x89a0('0x3e')]};return db[_0x89a0('0x2e')]['count'](_0x581ae9)['then'](function(_0x3ddd5d){_0x51b5a2[_0x89a0('0x1f')]=_0x3ddd5d;if(_0x219074[_0x89a0('0x31')]['includeAll']){_0x58b6d7['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x89a0('0x42')](_0x58b6d7);})[_0x89a0('0x26')](function(_0x4f2794){_0x51b5a2[_0x89a0('0x43')]=_0x4f2794;return _0x51b5a2;})[_0x89a0('0x26')](respondWithFilteredResult(_0x105a9f,_0x58b6d7))[_0x89a0('0x44')](handleError(_0x105a9f,null));};exports['show']=function(_0x29ce0b,_0x24fa2d){var _0x5b1034={'raw':!![],'where':{'id':_0x29ce0b[_0x89a0('0x45')]['id']}},_0x49bf63={};_0x49bf63[_0x89a0('0x36')]=_[_0x89a0('0x32')](db[_0x89a0('0x2e')][_0x89a0('0x2f')]);_0x49bf63[_0x89a0('0x31')]=_[_0x89a0('0x32')](_0x29ce0b[_0x89a0('0x31')]);_0x49bf63['filters']=_['intersection'](_0x49bf63[_0x89a0('0x36')],_0x49bf63['query']);_0x5b1034[_0x89a0('0x34')]=_['intersection'](_0x49bf63['model'],qs[_0x89a0('0x37')](_0x29ce0b[_0x89a0('0x31')][_0x89a0('0x37')]));_0x5b1034[_0x89a0('0x34')]=_0x5b1034[_0x89a0('0x34')][_0x89a0('0x46')]?_0x5b1034[_0x89a0('0x34')]:_0x49bf63['model'];if(_0x29ce0b['query']['includeAll']){_0x5b1034[_0x89a0('0x47')]=[{'all':!![]}];}_0x5b1034=_[_0x89a0('0x41')]({},_0x5b1034,_0x29ce0b[_0x89a0('0x48')]);return db[_0x89a0('0x2e')][_0x89a0('0x49')](_0x5b1034)[_0x89a0('0x26')](handleEntityNotFound(_0x24fa2d,null))[_0x89a0('0x26')](respondWithResult(_0x24fa2d,null))[_0x89a0('0x44')](handleError(_0x24fa2d,null));};exports[_0x89a0('0x4a')]=function(_0x4a199d,_0x377332){return db[_0x89a0('0x2e')][_0x89a0('0x4a')](_0x4a199d[_0x89a0('0x4b')],{})[_0x89a0('0x26')](respondWithResult(_0x377332,0xc9))['catch'](handleError(_0x377332,null));};exports[_0x89a0('0x25')]=function(_0x4c146d,_0x2be76e){if(_0x4c146d[_0x89a0('0x4b')]['id']){delete _0x4c146d[_0x89a0('0x4b')]['id'];}return db[_0x89a0('0x2e')]['find']({'where':{'id':_0x4c146d[_0x89a0('0x45')]['id']}})[_0x89a0('0x26')](handleEntityNotFound(_0x2be76e,null))['then'](saveUpdates(_0x4c146d['body'],null))['then'](respondWithResult(_0x2be76e,null))[_0x89a0('0x44')](handleError(_0x2be76e,null));};exports[_0x89a0('0x27')]=function(_0x206682,_0x4ee2d1){return db['ChatTransferReport'][_0x89a0('0x49')]({'where':{'id':_0x206682[_0x89a0('0x45')]['id']}})[_0x89a0('0x26')](handleEntityNotFound(_0x4ee2d1,null))[_0x89a0('0x26')](removeEntity(_0x4ee2d1,null))[_0x89a0('0x44')](handleError(_0x4ee2d1,null));};exports[_0x89a0('0x4c')]=function(_0xcdfb89,_0x492d26){return db[_0x89a0('0x2e')]['describe']()[_0x89a0('0x26')](respondWithResult(_0x492d26,null))['catch'](handleError(_0x492d26,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ac80d93..ec90c1f 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 _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x00bb[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x1534a7,_0x28dc30){var _0x4735ce=function(_0x367b23){while(--_0x367b23){_0x1534a7['push'](_0x1534a7['shift']());}};_0x4735ce(++_0x28dc30);}(_0x54ef,0x112));var _0xf54e=function(_0x678b83,_0x5e4f67){_0x678b83=_0x678b83-0x0;var _0x565639=_0x54ef[_0x678b83];return _0x565639;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 469709b..175ddd2 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 _0xbf76=['rpc','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35a53a,_0x100249){var _0x246480=function(_0x39993d){while(--_0x39993d){_0x35a53a['push'](_0x35a53a['shift']());}};_0x246480(++_0x100249);}(_0xbf76,0x6c));var _0x6bf7=function(_0x5014d8,_0x176247){_0x5014d8=_0x5014d8-0x0;var _0x5ddb02=_0xbf76[_0x5014d8];return _0x5ddb02;};'use strict';var _=require(_0x6bf7('0x0'));var util=require('util');var moment=require(_0x6bf7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bf7('0x2'));var db=require(_0x6bf7('0x3'))['db'];var utils=require(_0x6bf7('0x4'));var logger=require(_0x6bf7('0x5'))(_0x6bf7('0x6'));var config=require('../../config/environment');var jayson=require(_0x6bf7('0x7'));var client=jayson[_0x6bf7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47f2f7,_0x17fa17,_0x334abc){return new BPromise(function(_0x4b1e2c,_0x181b37){return client[_0x6bf7('0x9')](_0x47f2f7,_0x334abc)['then'](function(_0xc30967){logger[_0x6bf7('0xa')](_0x6bf7('0xb'),_0x17fa17,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x17fa17,_0x6bf7('0xc'),JSON[_0x6bf7('0xd')](_0xc30967));if(_0xc30967[_0x6bf7('0xe')]){if(_0xc30967[_0x6bf7('0xe')][_0x6bf7('0xf')]===0x1f4){logger[_0x6bf7('0xe')](_0x6bf7('0xb'),_0x17fa17,_0xc30967['error'][_0x6bf7('0x10')]);return _0x181b37(_0xc30967[_0x6bf7('0xe')][_0x6bf7('0x10')]);}logger[_0x6bf7('0xe')](_0x6bf7('0xb'),_0x17fa17,_0xc30967[_0x6bf7('0xe')][_0x6bf7('0x10')]);return _0x4b1e2c(_0xc30967[_0x6bf7('0xe')][_0x6bf7('0x10')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x17fa17,_0x6bf7('0xc'));_0x4b1e2c(_0xc30967[_0x6bf7('0x11')][_0x6bf7('0x10')]);}})[_0x6bf7('0x12')](function(_0x1d5fe6){logger[_0x6bf7('0xe')](_0x6bf7('0xb'),_0x17fa17,_0x1d5fe6);_0x181b37(_0x1d5fe6);});});} \ No newline at end of file +var _0x7f1b=['error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x571339,_0x5bcafb){var _0x5af8a6=function(_0x389251){while(--_0x389251){_0x571339['push'](_0x571339['shift']());}};_0x5af8a6(++_0x5bcafb);}(_0x7f1b,0x12b));var _0xb7f1=function(_0x319e24,_0xa29e9c){_0x319e24=_0x319e24-0x0;var _0x8b9853=_0x7f1b[_0x319e24];return _0x8b9853;};'use strict';var _=require(_0xb7f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb7f1('0x2'));var logger=require(_0xb7f1('0x3'))(_0xb7f1('0x4'));var config=require(_0xb7f1('0x5'));var jayson=require(_0xb7f1('0x6'));var client=jayson['client'][_0xb7f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29e686,_0x7a94a1,_0x2504b3){return new BPromise(function(_0x3bee91,_0x463026){return client[_0xb7f1('0x8')](_0x29e686,_0x2504b3)[_0xb7f1('0x9')](function(_0x435f32){logger[_0xb7f1('0xa')](_0xb7f1('0xb'),_0x7a94a1,_0xb7f1('0xc'));logger[_0xb7f1('0xd')](_0xb7f1('0xe'),_0x7a94a1,_0xb7f1('0xc'),JSON[_0xb7f1('0xf')](_0x435f32));if(_0x435f32['error']){if(_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x11')]===0x1f4){logger[_0xb7f1('0x10')](_0xb7f1('0xb'),_0x7a94a1,_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x12')]);return _0x463026(_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x12')]);}logger[_0xb7f1('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x7a94a1,_0x435f32['error'][_0xb7f1('0x12')]);return _0x3bee91(_0x435f32['error']['message']);}else{logger[_0xb7f1('0xa')](_0xb7f1('0xb'),_0x7a94a1,'request\x20sent');_0x3bee91(_0x435f32[_0xb7f1('0x13')][_0xb7f1('0x12')]);}})[_0xb7f1('0x14')](function(_0x3ced85){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x7a94a1,_0x3ced85);_0x463026(_0x3ced85);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 261db73..4ddca0d 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(_0x185deb,_0x20e36f){var _0x37436e=function(_0x541270){while(--_0x541270){_0x185deb['push'](_0x185deb['shift']());}};_0x37436e(++_0x20e36f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3902b8,_0x4b013a){_0x3902b8=_0x3902b8-0x0;var _0x345127=_0xb10b[_0x3902b8];return _0x345127;};'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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_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('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 39a6498..2ea7f1a 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 _0xadc5=['stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','parse','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','Feedback','star'];(function(_0x56eb70,_0x2bd75c){var _0x47f1fe=function(_0x1fbb17){while(--_0x1fbb17){_0x56eb70['push'](_0x56eb70['shift']());}};_0x47f1fe(++_0x2bd75c);}(_0xadc5,0x1bd));var _0x5adc=function(_0x16f3ef,_0x338e22){_0x16f3ef=_0x16f3ef-0x0;var _0x3e5402=_0xadc5[_0x16f3ef];return _0x3e5402;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5adc('0x0')]={'name':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![],'unique':_0x5adc('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x3')},'mapKeyOffline':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x3')},'key':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x4')},'customerAlias':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![],'defaultValue':_0x5adc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![],'defaultValue':_0x5adc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![],'defaultValue':_0x5adc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5adc('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5adc('0x1')]},'animation':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5adc('0x9')](_0x5adc('0xa'),_0x5adc('0xb')),'defaultValue':_0x5adc('0xa')},'header_online':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0xc')},'start_chat_button':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0xd')},'offline_chat_button':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0xe')},'download_transcript':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5adc('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5adc('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x12')},'noteTitle':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x13')},'placeholderMessage':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x14')},'closingMessage':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x16')},'conditionAgreement':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x17')},'ratingType':{'type':Sequelize[_0x5adc('0x9')]('star','thumb'),'defaultValue':_0x5adc('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x5adc('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5adc('0xf')],'defaultValue':function(){return JSON[_0x5adc('0x19')]({'items':[{'type':_0x5adc('0x1a'),'variable':null,'config':{'placeholder':_0x5adc('0x1b'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5adc('0x1a'),'props':{'title':_0x5adc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5adc('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5adc('0x1c')](_0x5adc('0x1d'))?JSON['parse'](this[_0x5adc('0x1c')]('onlineForm')):{};},'set':function(_0x48b984){return this[_0x5adc('0x1e')](_0x5adc('0x1d'),JSON[_0x5adc('0x19')](_0x48b984));}},'offlineForm':{'type':Sequelize[_0x5adc('0xf')],'defaultValue':function(){return JSON[_0x5adc('0x19')]({'items':[{'type':_0x5adc('0x1a'),'props':{'title':_0x5adc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x5adc('0x3'),'type':_0x5adc('0x3')},'variable':null},{'type':_0x5adc('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x5adc('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5adc('0x1c')]('offlineForm')?JSON[_0x5adc('0x21')](this[_0x5adc('0x1c')]('offlineForm')):{};},'set':function(_0x3a2f77){return this['setDataValue'](_0x5adc('0x22'),JSON[_0x5adc('0x19')](_0x3a2f77));}},'token':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5adc('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5adc('0x1')]},'waitingTitle':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x16')},'sendUnmanaged':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5adc('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5adc('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5adc('0xf')],'defaultValue':function(){return _0x5adc('0x27');}},'notificationSound':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x5adc('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x2a')},'defaultTitle':{'type':Sequelize[_0x5adc('0x1')]},'customerAvatar':{'type':Sequelize[_0x5adc('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5adc('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5adc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5adc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':_0x5adc('0x2b')},'systemAvatar':{'type':Sequelize[_0x5adc('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5adc('0x7')],'comment':_0x5adc('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![],'comment':_0x5adc('0x2d'),'set':function(_0x18761d){if(!_0x18761d)this[_0x5adc('0x1e')](_0x5adc('0x2e'),null);this[_0x5adc('0x1e')]('mandatoryDisposition',_0x18761d);}},'vidaooEscalation':{'type':Sequelize[_0x5adc('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5adc('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc82=['BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','email','Agent','#011F6A','#ffffff','squared','rounded','We\x20are\x20here!','Chat','Send'];(function(_0x302f83,_0x564c17){var _0x4d003b=function(_0x471f83){while(--_0x471f83){_0x302f83['push'](_0x302f83['shift']());}};_0x4d003b(++_0x564c17);}(_0xbc82,0x13e));var _0x2bc8=function(_0x4d2329,_0x5c505a){_0x4d2329=_0x4d2329-0x0;var _0x37233b=_0xbc82[_0x4d2329];return _0x37233b;};'use strict';var Sequelize=require(_0x2bc8('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x2bc8('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x2')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2bc8('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2bc8('0x1')],'allowNull':![],'defaultValue':_0x2bc8('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2bc8('0x1')],'allowNull':![],'defaultValue':_0x2bc8('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2bc8('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x2bc8('0x6')),'defaultValue':_0x2bc8('0x7')},'header_online':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x8')},'start_chat_button':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x9')},'offline_chat_button':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0xa')},'header_offline':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2bc8('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2bc8('0xe')]},'closingQuestion':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x10')},'noteTitle':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x14')},'ratingType':{'type':Sequelize[_0x2bc8('0x15')](_0x2bc8('0x16'),_0x2bc8('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2bc8('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2bc8('0xe')],'defaultValue':function(){return JSON[_0x2bc8('0x18')]({'items':[{'type':_0x2bc8('0x19'),'variable':null,'config':{'placeholder':_0x2bc8('0x1a'),'type':_0x2bc8('0x1b'),'required':!![]},'props':{'title':_0x2bc8('0x1a'),'helpText':''}},{'type':_0x2bc8('0x19'),'props':{'title':_0x2bc8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2bc8('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2bc8('0x1c')](_0x2bc8('0x1d'))?JSON[_0x2bc8('0x1e')](this[_0x2bc8('0x1c')](_0x2bc8('0x1d'))):{};},'set':function(_0x1ff914){return this['setDataValue'](_0x2bc8('0x1d'),JSON[_0x2bc8('0x18')](_0x1ff914));}},'offlineForm':{'type':Sequelize[_0x2bc8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2bc8('0x19'),'props':{'title':_0x2bc8('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x2bc8('0x2'),'type':_0x2bc8('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':_0x2bc8('0x1f')},'props':{'title':'Comments','helpText':_0x2bc8('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x2bc8('0x1c')](_0x2bc8('0x21'))?JSON[_0x2bc8('0x1e')](this[_0x2bc8('0x1c')]('offlineForm')):{};},'set':function(_0x45dd94){return this['setDataValue']('offlineForm',JSON[_0x2bc8('0x18')](_0x45dd94));}},'token':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':function(){return rs[_0x2bc8('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2bc8('0x1')]},'forwardOffline':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2bc8('0x1')]},'waitingTitle':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x23')},'offlineMessageBody':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x13')},'sendUnmanaged':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0xa')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2bc8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2bc8('0x1')]},'notificationTemplate':{'type':Sequelize[_0x2bc8('0xe')],'defaultValue':function(){return _0x2bc8('0x26');}},'notificationSound':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2bc8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x2bc8('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x2bc8('0x28')},'defaultTitle':{'type':Sequelize[_0x2bc8('0x1')]},'customerAvatar':{'type':Sequelize[_0x2bc8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2bc8('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2bc8('0x1')],'allowNull':![],'defaultValue':_0x2bc8('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2bc8('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2bc8('0x1')],'defaultValue':_0x2bc8('0x2a')},'systemAvatar':{'type':Sequelize[_0x2bc8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2bc8('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![],'comment':_0x2bc8('0x2c'),'set':function(_0x5025f0){if(!_0x5025f0)this[_0x2bc8('0x2d')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x2bc8('0x2e'),_0x5025f0);}},'vidaooEscalation':{'type':Sequelize[_0x2bc8('0xb')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d04e766..3798f11 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 _0x5be2=['stack','name','send','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','count','findAll','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','include','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','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','pick','includeAll','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','headers','user-agent','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','Contacts','DESC','ChatApplication','Applications','account','applications','list','List','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','MailAccount','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','email','offlineMessageSubject','getInteractions','Contact','Owner','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s','interval','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','virtual','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','ChatWebsites','UserProfileResource','destroy'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x5be2,0xe0));var _0x25be=function(_0x19a3f6,_0x4c2908){_0x19a3f6=_0x19a3f6-0x0;var _0x506c12=_0x5be2[_0x19a3f6];return _0x506c12;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25be('0x0'));var rimraf=require(_0x25be('0x1'));var zipdir=require(_0x25be('0x2'));var jsonpatch=require(_0x25be('0x3'));var rp=require('request-promise');var moment=require(_0x25be('0x4'));var BPromise=require(_0x25be('0x5'));var Mustache=require(_0x25be('0x6'));var util=require('util');var path=require(_0x25be('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25be('0x8'));var fs=require('fs');var _=require(_0x25be('0x9'));var squel=require(_0x25be('0xa'));var crypto=require(_0x25be('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25be('0xc'));var Papa=require(_0x25be('0xd'));var Redis=require(_0x25be('0xe'));var authService=require(_0x25be('0xf'));var qs=require(_0x25be('0x10'));var as=require(_0x25be('0x11'));var hardwareService=require(_0x25be('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x25be('0x13'));var config=require(_0x25be('0x14'));var db=require(_0x25be('0x15'))['db'];config['redis']=_[_0x25be('0x16')](config[_0x25be('0x17')],{'host':_0x25be('0x18'),'port':0x18eb});var socket=require(_0x25be('0x19'))(new Redis(config[_0x25be('0x17')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0x25be('0x1a'));var client=jayson['client'][_0x25be('0x1b')]({'port':0x232c});var client9002=jayson[_0x25be('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0x25be('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0x2ee37c,_0x180e28,_0x46ce3a){if(_0x46ce3a){var _0x1279d0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1279d0[_0x25be('0x1d')](_0x180e28)){return _0x2ee37c;}else{throw new db['Sequelize'][(_0x25be('0x1e'))](_0x25be('0x1f'));}}else{return _0x2ee37c;}}function respondWithRpcPromise(_0x5c1b72,_0x28bbdc,_0x2b41e0,_0x332898){return new BPromise(function(_0x104615,_0x47deea){var _0x1431bd=_0x332898||client;return _0x1431bd['request'](_0x5c1b72,_0x2b41e0)[_0x25be('0x20')](function(_0x5a67e6){logger[_0x25be('0x21')](_0x25be('0x22'),_0x28bbdc,'request\x20sent');logger[_0x25be('0x23')](_0x25be('0x24'),_0x28bbdc,_0x25be('0x25'),JSON[_0x25be('0x26')](_0x5a67e6));if(_0x5a67e6[_0x25be('0x27')]){if(_0x5a67e6['error']['code']===0x1f4){logger[_0x25be('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x28bbdc,_0x5a67e6[_0x25be('0x27')][_0x25be('0x28')]);return _0x47deea(_0x5a67e6[_0x25be('0x27')]['message']);}logger[_0x25be('0x27')](_0x25be('0x22'),_0x28bbdc,_0x5a67e6[_0x25be('0x27')]['message']);return _0x104615(_0x5a67e6[_0x25be('0x27')][_0x25be('0x28')]);}else{logger[_0x25be('0x21')](_0x25be('0x22'),_0x28bbdc,_0x25be('0x25'));_0x104615(_0x5a67e6['result'][_0x25be('0x28')]);}})[_0x25be('0x29')](function(_0x317588){logger['error'](_0x25be('0x22'),_0x28bbdc,_0x317588);_0x47deea(_0x317588);});});}function respondWithStatusCode(_0x14f574,_0x11c15a){_0x11c15a=_0x11c15a||0xcc;return function(_0x15863d){if(_0x15863d){return _0x14f574[_0x25be('0x2a')](_0x11c15a);}return _0x14f574[_0x25be('0x2b')](_0x11c15a)[_0x25be('0x2c')]();};}function respondWithResult(_0x55c4df,_0x573c9f){_0x573c9f=_0x573c9f||0xc8;return function(_0x485c1d){if(_0x485c1d){return _0x55c4df[_0x25be('0x2b')](_0x573c9f)[_0x25be('0x2d')](_0x485c1d);}};}function respondWithFilteredResult(_0x18bf70,_0x5aa1d7){return function(_0x212ab8){if(_0x212ab8){var _0x369a02=_0x212ab8['count'],_0x143196=_0x5aa1d7[_0x25be('0x2e')],_0x5c07fe=_0x5aa1d7[_0x25be('0x2e')]+_0x5aa1d7[_0x25be('0x2f')],_0x2d8d2f;if(_0x5c07fe>=_0x369a02){_0x5c07fe=_0x369a02;_0x2d8d2f=0xc8;}else{_0x2d8d2f=0xce;}_0x18bf70[_0x25be('0x2b')](_0x2d8d2f);return _0x18bf70[_0x25be('0x30')]('Content-Range',_0x143196+'-'+_0x5c07fe+'/'+_0x369a02)[_0x25be('0x2d')](_0x212ab8);}return null;};}function patchUpdates(_0x26b85e){return function(_0x4380f7){try{jsonpatch[_0x25be('0x31')](_0x4380f7,_0x26b85e,!![]);}catch(_0x153103){return BPromise[_0x25be('0x32')](_0x153103);}return _0x4380f7['save']();};}function saveUpdates(_0x3e70ab,_0x100fb1){return function(_0x52ee80){if(_0x52ee80){return _0x52ee80[_0x25be('0x33')](_0x3e70ab)[_0x25be('0x20')](function(_0xeaf1ea){return _0xeaf1ea;});}return null;};}function removeEntity(_0x4d3390,_0x215012){return function(_0x974cb9){if(_0x974cb9){return _0x974cb9['destroy']()[_0x25be('0x20')](function(){var _0x4c6a05=_0x974cb9['get']({'plain':!![]});var _0xd7f065=_0x25be('0x34');return db[_0x25be('0x35')][_0x25be('0x36')]({'where':{'type':_0xd7f065,'resourceId':_0x4c6a05['id']}})[_0x25be('0x20')](function(){return _0x974cb9;});})[_0x25be('0x20')](function(){_0x4d3390[_0x25be('0x2b')](0xcc)[_0x25be('0x2c')]();});}};}function handleEntityNotFound(_0x4c091c,_0x300fae){return function(_0x3b7cdc){if(!_0x3b7cdc){_0x4c091c[_0x25be('0x2a')](0x194);}return _0x3b7cdc;};}function handleError(_0x4a24f0,_0x42c555){_0x42c555=_0x42c555||0x1f4;return function(_0x3a6bc0){logger['error'](_0x3a6bc0[_0x25be('0x37')]);if(_0x3a6bc0['name']){delete _0x3a6bc0[_0x25be('0x38')];}_0x4a24f0[_0x25be('0x2b')](_0x42c555)[_0x25be('0x39')](_0x3a6bc0);};}exports['index']=function(_0x2d3171,_0x48deea){var _0x2ba323={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x29a358={},_0x4d320d={'count':0x0,'rows':[]};var _0x5b9ad7=_['map'](db[_0x25be('0x3a')]['rawAttributes'],function(_0x468be9){return{'name':_0x468be9[_0x25be('0x3b')],'type':_0x468be9[_0x25be('0x3c')][_0x25be('0x3d')]};});_0x29a358[_0x25be('0x3e')]=_['map'](_0x5b9ad7,_0x25be('0x38'));_0x29a358[_0x25be('0x3f')]=_[_0x25be('0x40')](_0x2d3171[_0x25be('0x3f')]);_0x29a358[_0x25be('0x41')]=_[_0x25be('0x42')](_0x29a358['model'],_0x29a358[_0x25be('0x3f')]);_0x2ba323[_0x25be('0x43')]=_[_0x25be('0x42')](_0x29a358['model'],qs['fields'](_0x2d3171[_0x25be('0x3f')][_0x25be('0x44')]));_0x2ba323[_0x25be('0x43')]=_0x2ba323[_0x25be('0x43')][_0x25be('0x45')]?_0x2ba323[_0x25be('0x43')]:_0x29a358['model'];if(!_0x2d3171[_0x25be('0x3f')]['hasOwnProperty'](_0x25be('0x46'))){_0x2ba323['limit']=qs[_0x25be('0x2f')](_0x2d3171['query'][_0x25be('0x2f')]);_0x2ba323[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x2d3171[_0x25be('0x3f')][_0x25be('0x2e')]);}_0x2ba323[_0x25be('0x47')]=qs['sort'](_0x2d3171[_0x25be('0x3f')][_0x25be('0x48')]);_0x2ba323['where']=qs['filters'](_['pick'](_0x2d3171['query'],_0x29a358[_0x25be('0x41')]),_0x5b9ad7);if(_0x2d3171[_0x25be('0x3f')][_0x25be('0x49')]){_0x2ba323[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x2ba323[_0x25be('0x4a')],{'$or':_[_0x25be('0x4c')](_0x5b9ad7,function(_0x1d5e3b){if(_0x1d5e3b[_0x25be('0x3c')]!==_0x25be('0x4d')){var _0x39990a={};_0x39990a[_0x1d5e3b['name']]={'$like':'%'+_0x2d3171['query'][_0x25be('0x49')]+'%'};return _0x39990a;}})});}_0x2ba323=_['merge']({},_0x2ba323,_0x2d3171[_0x25be('0x4e')]);var _0x173036={'where':_0x2ba323[_0x25be('0x4a')]};return db['ChatWebsite'][_0x25be('0x4f')](_0x173036)[_0x25be('0x20')](function(_0x1d66ec){_0x4d320d[_0x25be('0x4f')]=_0x1d66ec;if(_0x2d3171[_0x25be('0x3f')]['includeAll']){_0x2ba323['include']=[{'all':!![]}];}return db[_0x25be('0x3a')][_0x25be('0x50')](_0x2ba323);})['then'](function(_0x5e68c7){_0x4d320d[_0x25be('0x51')]=_0x5e68c7;return _0x4d320d;})[_0x25be('0x20')](respondWithFilteredResult(_0x48deea,_0x2ba323))[_0x25be('0x29')](handleError(_0x48deea,null));};exports[_0x25be('0x52')]=function(_0x5bccba,_0x11f20e){var _0x58b265={'raw':![],'where':{'id':_0x5bccba[_0x25be('0x53')]['id']},'include':[{'model':db[_0x25be('0x54')],'as':_0x25be('0x55')}]},_0x1db4dd={};_0x1db4dd['model']=_[_0x25be('0x40')](db[_0x25be('0x3a')][_0x25be('0x56')]);_0x1db4dd['query']=_[_0x25be('0x40')](_0x5bccba[_0x25be('0x3f')]);_0x1db4dd[_0x25be('0x41')]=_[_0x25be('0x42')](_0x1db4dd['model'],_0x1db4dd[_0x25be('0x3f')]);_0x58b265[_0x25be('0x43')]=_[_0x25be('0x42')](_0x1db4dd[_0x25be('0x3e')],qs[_0x25be('0x44')](_0x5bccba['query'][_0x25be('0x44')]));_0x58b265[_0x25be('0x43')]=_0x58b265[_0x25be('0x43')][_0x25be('0x45')]?_0x58b265[_0x25be('0x43')]:_0x1db4dd[_0x25be('0x3e')];if(_0x5bccba[_0x25be('0x3f')]['includeAll']){_0x58b265[_0x25be('0x57')]=[{'all':!![]}];}_0x58b265=_[_0x25be('0x4b')]({},_0x58b265,_0x5bccba[_0x25be('0x4e')]);return db[_0x25be('0x3a')][_0x25be('0x58')](_0x58b265)['then'](handleEntityNotFound(_0x11f20e,null))[_0x25be('0x20')](respondWithResult(_0x11f20e,null))[_0x25be('0x29')](handleError(_0x11f20e,null));};exports[_0x25be('0x59')]=function(_0x5793ec,_0x246451){return db[_0x25be('0x3a')][_0x25be('0x59')](_0x5793ec[_0x25be('0x5a')],{})[_0x25be('0x20')](function(_0x97fbb3){var _0x53dc7b=_0x5793ec['user'][_0x25be('0x5b')]({'plain':!![]});if(!_0x53dc7b)throw new Error(_0x25be('0x5c'));if(_0x53dc7b[_0x25be('0x5d')]===_0x25be('0x5e')){var _0x2e9118=_0x97fbb3[_0x25be('0x5b')]({'plain':!![]});var _0x11bf4c=_0x25be('0x34');return db[_0x25be('0x5f')][_0x25be('0x58')]({'where':{'name':_0x11bf4c,'userProfileId':_0x53dc7b[_0x25be('0x60')]},'raw':!![]})[_0x25be('0x20')](function(_0x17a072){if(_0x17a072&&_0x17a072[_0x25be('0x61')]===0x0){return db[_0x25be('0x35')][_0x25be('0x59')]({'name':_0x2e9118[_0x25be('0x38')],'resourceId':_0x2e9118['id'],'type':_0x17a072[_0x25be('0x38')],'sectionId':_0x17a072['id']},{})[_0x25be('0x20')](function(){return _0x97fbb3;});}else{return _0x97fbb3;}})['catch'](function(_0x2c00b3){logger[_0x25be('0x27')](_0x25be('0x62'),_0x2c00b3);throw _0x2c00b3;});}return _0x97fbb3;})['then'](respondWithResult(_0x246451,0xc9))[_0x25be('0x29')](handleError(_0x246451,null));};exports[_0x25be('0x33')]=function(_0x583533,_0x388457){if(_0x583533[_0x25be('0x5a')]['id']){delete _0x583533['body']['id'];}return db[_0x25be('0x3a')]['find']({'where':{'id':_0x583533['params']['id']},'include':[{'model':db[_0x25be('0x54')],'as':_0x25be('0x55')}]})[_0x25be('0x20')](handleEntityNotFound(_0x388457,null))[_0x25be('0x20')](saveUpdates(_0x583533['body'],null))['then'](respondWithResult(_0x388457,null))[_0x25be('0x29')](handleError(_0x388457,null));};exports['destroy']=function(_0x5a7394,_0x15d3e9){return db['ChatWebsite'][_0x25be('0x58')]({'where':{'id':_0x5a7394[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x15d3e9,null))[_0x25be('0x20')](removeEntity(_0x15d3e9,null))['catch'](handleError(_0x15d3e9,null));};exports[_0x25be('0x63')]=function(_0x19bd9c,_0x4a72c0){return db[_0x25be('0x3a')][_0x25be('0x63')]()[_0x25be('0x20')](respondWithResult(_0x4a72c0,null))[_0x25be('0x29')](handleError(_0x4a72c0,null));};exports[_0x25be('0x64')]=function(_0x59ad6a,_0x1b0b29,_0x2f112a){if(_0x59ad6a['body']['id']){delete _0x59ad6a[_0x25be('0x5a')]['id'];}return db[_0x25be('0x3a')]['find']({'where':{'id':_0x59ad6a[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x1b0b29,null))[_0x25be('0x20')](function(_0x8aa488){if(_0x8aa488){_0x59ad6a[_0x25be('0x5a')][_0x25be('0x65')]=_0x8aa488['id'];return db[_0x25be('0x66')]['create'](_0x59ad6a['body']);}})[_0x25be('0x20')](respondWithResult(_0x1b0b29,null))['catch'](handleError(_0x1b0b29,null));};exports[_0x25be('0x67')]=function(_0x540e8d,_0x3df13e,_0x101c6c){var _0x3700b4={'raw':![],'where':{}};var _0x3affed={};var _0x14dca8={'count':0x0,'rows':[]};return db[_0x25be('0x3a')][_0x25be('0x68')]({'where':{'id':_0x540e8d['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x3df13e,null))[_0x25be('0x20')](function(_0x48a53b){if(_0x48a53b){_0x3affed[_0x25be('0x3e')]=_[_0x25be('0x40')](db[_0x25be('0x66')][_0x25be('0x56')]);_0x3affed['query']=_[_0x25be('0x40')](_0x540e8d[_0x25be('0x3f')]);_0x3affed[_0x25be('0x41')]=_['intersection'](_0x3affed[_0x25be('0x3e')],_0x3affed[_0x25be('0x3f')]);_0x3700b4[_0x25be('0x43')]=_[_0x25be('0x42')](_0x3affed[_0x25be('0x3e')],qs[_0x25be('0x44')](_0x540e8d[_0x25be('0x3f')][_0x25be('0x44')]));_0x3700b4[_0x25be('0x43')]=_0x3700b4[_0x25be('0x43')]['length']?_0x3700b4[_0x25be('0x43')]:_0x3affed[_0x25be('0x3e')];if(!_0x540e8d[_0x25be('0x3f')][_0x25be('0x69')](_0x25be('0x46'))){_0x3700b4[_0x25be('0x2f')]=qs[_0x25be('0x2f')](_0x540e8d[_0x25be('0x3f')][_0x25be('0x2f')]);_0x3700b4[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x540e8d[_0x25be('0x3f')][_0x25be('0x2e')]);}_0x3700b4[_0x25be('0x47')]=qs[_0x25be('0x48')](_0x540e8d[_0x25be('0x3f')][_0x25be('0x48')]);_0x3700b4[_0x25be('0x4a')]=qs[_0x25be('0x41')](_[_0x25be('0x6a')](_0x540e8d[_0x25be('0x3f')],_0x3affed[_0x25be('0x41')]));_0x3700b4[_0x25be('0x4a')][_0x25be('0x65')]=_0x48a53b['id'];if(_0x540e8d['query'][_0x25be('0x49')]){_0x3700b4[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x3700b4[_0x25be('0x4a')],{'$or':_[_0x25be('0x4c')](_0x3700b4[_0x25be('0x43')],function(_0x725124){var _0x10998b={};_0x10998b[_0x725124]={'$like':'%'+_0x540e8d['query']['filter']+'%'};return _0x10998b;})});}_0x3700b4=_[_0x25be('0x4b')]({},_0x3700b4,_0x540e8d[_0x25be('0x4e')]);return db['Disposition']['count']({'where':_0x3700b4[_0x25be('0x4a')]})[_0x25be('0x20')](function(_0x1be419){_0x14dca8[_0x25be('0x4f')]=_0x1be419;if(_0x540e8d[_0x25be('0x3f')][_0x25be('0x6b')]){_0x3700b4[_0x25be('0x57')]=[{'all':!![]}];}return db[_0x25be('0x66')][_0x25be('0x50')](_0x3700b4);})[_0x25be('0x20')](function(_0x26afcd){_0x14dca8[_0x25be('0x51')]=_0x26afcd;return _0x14dca8;});}})[_0x25be('0x20')](respondWithFilteredResult(_0x3df13e,_0x3700b4))['catch'](handleError(_0x3df13e,null));};exports['removeDispositions']=function(_0x1d79b8,_0x5db9bc,_0x130096){return db[_0x25be('0x3a')]['find']({'where':{'id':_0x1d79b8[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x5db9bc,null))[_0x25be('0x20')](function(_0x9d14a7){if(_0x9d14a7){return _0x9d14a7[_0x25be('0x6c')](_0x1d79b8[_0x25be('0x3f')][_0x25be('0x6d')]);}})[_0x25be('0x20')](respondWithStatusCode(_0x5db9bc,null))[_0x25be('0x29')](handleError(_0x5db9bc,null));};exports['addAnswer']=function(_0x1ed6b7,_0x9c5332,_0x46775f){if(_0x1ed6b7[_0x25be('0x5a')]['id']){delete _0x1ed6b7[_0x25be('0x5a')]['id'];}return db[_0x25be('0x3a')]['find']({'where':{'id':_0x1ed6b7['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x9c5332,null))['then'](function(_0x17ec1c){if(_0x17ec1c){_0x1ed6b7[_0x25be('0x5a')][_0x25be('0x65')]=_0x17ec1c['id'];return db[_0x25be('0x6e')]['create'](_0x1ed6b7[_0x25be('0x5a')]);}})[_0x25be('0x20')](respondWithResult(_0x9c5332,null))[_0x25be('0x29')](handleError(_0x9c5332,null));};exports['getAnswers']=function(_0x4b2c2b,_0x2a27b3,_0x58122a){var _0x363e34={'raw':![],'where':{}};var _0x4415c6={};var _0x5b981a={'count':0x0,'rows':[]};return db[_0x25be('0x3a')]['findOne']({'where':{'id':_0x4b2c2b[_0x25be('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a27b3,null))[_0x25be('0x20')](function(_0x25f578){if(_0x25f578){_0x4415c6['model']=_['keys'](db[_0x25be('0x6e')][_0x25be('0x56')]);_0x4415c6[_0x25be('0x3f')]=_[_0x25be('0x40')](_0x4b2c2b['query']);_0x4415c6[_0x25be('0x41')]=_[_0x25be('0x42')](_0x4415c6[_0x25be('0x3e')],_0x4415c6[_0x25be('0x3f')]);_0x363e34[_0x25be('0x43')]=_[_0x25be('0x42')](_0x4415c6['model'],qs[_0x25be('0x44')](_0x4b2c2b[_0x25be('0x3f')][_0x25be('0x44')]));_0x363e34[_0x25be('0x43')]=_0x363e34[_0x25be('0x43')][_0x25be('0x45')]?_0x363e34[_0x25be('0x43')]:_0x4415c6[_0x25be('0x3e')];if(!_0x4b2c2b[_0x25be('0x3f')][_0x25be('0x69')](_0x25be('0x46'))){_0x363e34[_0x25be('0x2f')]=qs[_0x25be('0x2f')](_0x4b2c2b[_0x25be('0x3f')][_0x25be('0x2f')]);_0x363e34[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x4b2c2b[_0x25be('0x3f')][_0x25be('0x2e')]);}_0x363e34[_0x25be('0x47')]=qs[_0x25be('0x48')](_0x4b2c2b['query'][_0x25be('0x48')]);_0x363e34[_0x25be('0x4a')]=qs[_0x25be('0x41')](_[_0x25be('0x6a')](_0x4b2c2b['query'],_0x4415c6[_0x25be('0x41')]));_0x363e34['where'][_0x25be('0x65')]=_0x25f578['id'];if(_0x4b2c2b['query'][_0x25be('0x49')]){_0x363e34[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x363e34['where'],{'$or':_[_0x25be('0x4c')](_0x363e34['attributes'],function(_0x512f6f){var _0x474dd6={};_0x474dd6[_0x512f6f]={'$like':'%'+_0x4b2c2b[_0x25be('0x3f')][_0x25be('0x49')]+'%'};return _0x474dd6;})});}_0x363e34=_['merge']({},_0x363e34,_0x4b2c2b[_0x25be('0x4e')]);return db[_0x25be('0x6e')][_0x25be('0x4f')]({'where':_0x363e34[_0x25be('0x4a')]})[_0x25be('0x20')](function(_0x3c383b){_0x5b981a[_0x25be('0x4f')]=_0x3c383b;if(_0x4b2c2b[_0x25be('0x3f')]['includeAll']){_0x363e34[_0x25be('0x57')]=[{'all':!![]}];}return db[_0x25be('0x6e')][_0x25be('0x50')](_0x363e34);})[_0x25be('0x20')](function(_0x24efa1){_0x5b981a[_0x25be('0x51')]=_0x24efa1;return _0x5b981a;});}})[_0x25be('0x20')](respondWithFilteredResult(_0x2a27b3,_0x363e34))['catch'](handleError(_0x2a27b3,null));};exports[_0x25be('0x6f')]=function(_0x3af984,_0x655320,_0x9e5d46){return db[_0x25be('0x3a')]['find']({'where':{'id':_0x3af984['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x655320,null))[_0x25be('0x20')](function(_0x2e6396){if(_0x2e6396){return _0x2e6396[_0x25be('0x6f')](_0x3af984['query']['ids']);}})['then'](respondWithStatusCode(_0x655320,null))[_0x25be('0x29')](handleError(_0x655320,null));};exports[_0x25be('0x70')]=function(_0x16c0e6,_0x395883,_0x13cc84){_0x16c0e6[_0x25be('0x5a')][_0x25be('0x71')]=_0x16c0e6[_0x25be('0x72')][_0x25be('0x73')];return db['ChatWebsite'][_0x25be('0x58')]({'where':{'id':_0x16c0e6[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x395883,null))[_0x25be('0x20')](saveUpdates(_0x16c0e6[_0x25be('0x5a')],null))['then'](respondWithResult(_0x395883,null))[_0x25be('0x29')](handleError(_0x395883,null));};exports['addAvatar']=function(_0x10cb5e,_0x18f5ea,_0x4ed417){_0x10cb5e[_0x25be('0x5a')][_0x25be('0x74')]=_0x10cb5e['file'][_0x25be('0x73')];return db[_0x25be('0x3a')]['find']({'where':{'id':_0x10cb5e[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x18f5ea,null))[_0x25be('0x20')](saveUpdates(_0x10cb5e['body'],null))[_0x25be('0x20')](respondWithResult(_0x18f5ea,null))[_0x25be('0x29')](handleError(_0x18f5ea,null));};exports[_0x25be('0x75')]=function(_0x5c09b2,_0x32d4cd,_0x3d5036){_0x5c09b2[_0x25be('0x5a')]['customerAvatar']=_0x5c09b2[_0x25be('0x72')][_0x25be('0x73')];return db[_0x25be('0x3a')][_0x25be('0x58')]({'where':{'id':_0x5c09b2['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x32d4cd,null))[_0x25be('0x20')](saveUpdates(_0x5c09b2[_0x25be('0x5a')],null))[_0x25be('0x20')](respondWithResult(_0x32d4cd,null))[_0x25be('0x29')](handleError(_0x32d4cd,null));};exports['addSystemAvatar']=function(_0x53ab78,_0x302cd2,_0x10aa02){_0x53ab78['body'][_0x25be('0x76')]=_0x53ab78[_0x25be('0x72')][_0x25be('0x73')];return db['ChatWebsite'][_0x25be('0x58')]({'where':{'id':_0x53ab78[_0x25be('0x53')]['id']}})['then'](handleEntityNotFound(_0x302cd2,null))[_0x25be('0x20')](saveUpdates(_0x53ab78[_0x25be('0x5a')],null))[_0x25be('0x20')](respondWithResult(_0x302cd2,null))[_0x25be('0x29')](handleError(_0x302cd2,null));};exports['getLogo']=function(_0x28e6e9,_0x6d5ce3,_0x48ba6b){var _0x1097bc=path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0x79'));var _0x13b781={'where':{'id':_0x28e6e9[_0x25be('0x53')]['id']},'attributes':['id',_0x25be('0x71')],'raw':!![]};var _0x296c8f=![];return require(_0x25be('0x7a'))[_0x25be('0x7b')]()[_0x25be('0x20')](function(_0x25a505){if(_0x25a505){_0x296c8f=_0x25a505['custom'];}})[_0x25be('0x20')](function(){return db[_0x25be('0x3a')][_0x25be('0x58')](_0x13b781);})['then'](handleEntityNotFound(_0x6d5ce3,null))['then'](function(_0x15ae53){if(_0x15ae53){if(!_['isNil'](_0x15ae53['sitepic'])){if(fs[_0x25be('0x7c')](path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0x7d'),_0x15ae53[_0x25be('0x71')]))&&_0x296c8f){_0x1097bc=path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0x7d'),_0x15ae53[_0x25be('0x71')]);}}return _0x6d5ce3[_0x25be('0x7e')](_0x1097bc);}})['catch'](handleError(_0x6d5ce3,null));};exports[_0x25be('0x7f')]=function(_0x51192b,_0x34c449,_0x41e852){var _0x5c085e=path['join'](config['root'],_0x25be('0x80'));var _0x2ba6ee={'where':{'id':_0x51192b[_0x25be('0x53')]['id']},'attributes':['id',_0x25be('0x74')],'raw':!![]};return db['ChatWebsite'][_0x25be('0x58')](_0x2ba6ee)[_0x25be('0x20')](handleEntityNotFound(_0x34c449,null))['then'](function(_0x20ce04){if(_0x20ce04){if(!_[_0x25be('0x81')](_0x20ce04[_0x25be('0x74')])){if(fs[_0x25be('0x7c')](path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0x82'),_0x20ce04['agentAvatar']))){_0x5c085e=path[_0x25be('0x77')](config[_0x25be('0x78')],'server/files/images/avatars/',_0x20ce04[_0x25be('0x74')]);}}return _0x34c449[_0x25be('0x7e')](_0x5c085e);}})[_0x25be('0x29')](handleError(_0x34c449,null));};exports[_0x25be('0x83')]=function(_0x156693,_0x9c907,_0x2e68f7){var _0x3c0fdf=path['join'](config[_0x25be('0x78')],_0x25be('0x84'));var _0x1eda5f={'where':{'id':_0x156693['params']['id']},'attributes':['id',_0x25be('0x85'),_0x25be('0x86')],'raw':!![]};return db[_0x25be('0x3a')][_0x25be('0x58')](_0x1eda5f)['then'](handleEntityNotFound(_0x9c907,null))['then'](function(_0x20addf){if(_0x20addf){if(!_['isNil'](_0x20addf[_0x25be('0x85')])){if(fs[_0x25be('0x7c')](path[_0x25be('0x77')](config['root'],'server/files/images/avatars/',_0x20addf[_0x25be('0x85')]))&&_0x20addf[_0x25be('0x86')]){_0x3c0fdf=path['join'](config[_0x25be('0x78')],_0x25be('0x82'),_0x20addf['customerAvatar']);}}return _0x9c907[_0x25be('0x7e')](_0x3c0fdf);}})[_0x25be('0x29')](handleError(_0x9c907,null));};exports[_0x25be('0x87')]=function(_0x1b1e4a,_0x33a6a0,_0x499ed3){var _0x9440ef=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x18ff33={'where':{'id':_0x1b1e4a['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x25be('0x58')](_0x18ff33)['then'](handleEntityNotFound(_0x33a6a0,null))['then'](function(_0xc367d8){if(_0xc367d8){if(!_[_0x25be('0x81')](_0xc367d8[_0x25be('0x76')])){if(fs[_0x25be('0x7c')](path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0x82'),_0xc367d8['systemAvatar']))){_0x9440ef=path['join'](config['root'],_0x25be('0x82'),_0xc367d8['systemAvatar']);}}return _0x33a6a0['download'](_0x9440ef);}})['catch'](handleError(_0x33a6a0,null));};exports[_0x25be('0x88')]=function(_0x304077,_0x316eab,_0x5e32a6){var _0x232e24=require(_0x25be('0x89'));var _0xb7c70=new _0x232e24();var _0x27e9ff=_0xb7c70['setUA'](_0x304077[_0x25be('0x8a')][_0x25be('0x8b')])['getResult']();var _0x17257e={'body':_0x304077[_0x25be('0x5a')],'channel':_0x25be('0x8c')};var _0x4b49cc=[];var _0x2d13b9=[];var _0xb756d2={};var _0x448d8d=![];return db[_0x25be('0x8d')][_0x25be('0x63')]()[_0x25be('0x20')](function(_0x17d6a5){if(!_0x17d6a5){throw new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))](_0x25be('0x8f'));}_0x4b49cc=_[_0x25be('0x90')](_[_0x25be('0x40')](_0x17d6a5),[_0x25be('0x91'),_0x25be('0x92')]);_0x2d13b9=_[_0x25be('0x90')](_['keys'](_0x17d6a5),[_0x25be('0x91'),_0x25be('0x92'),_0x25be('0x93'),_0x25be('0x94')]);if(_0x304077[_0x25be('0x5a')]['id']){delete _0x304077[_0x25be('0x5a')]['id'];}if(_['isNil'](_0x304077[_0x25be('0x5a')]['from'])){throw new db[(_0x25be('0x8e'))]['ValidationError'](_0x25be('0x95'));}if(_[_0x25be('0x81')](_0x304077['body']['body'])||_0x304077[_0x25be('0x5a')][_0x25be('0x5a')]===''){throw new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))](_0x25be('0x96'));}if(_[_0x25be('0x81')](_0x304077[_0x25be('0x5a')][_0x25be('0x97')])){throw new db['Sequelize']['ValidationError'](_0x25be('0x98')+_0x2d13b9);}if(!_[_0x25be('0x99')](_0x2d13b9,_0x304077[_0x25be('0x5a')][_0x25be('0x97')])){throw new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d13b9);}_0xb756d2[_0x304077[_0x25be('0x5a')][_0x25be('0x97')]]=_0x304077[_0x25be('0x5a')][_0x25be('0x9a')];})[_0x25be('0x20')](function(){return db[_0x25be('0x3a')]['find']({'where':{'id':_0x304077['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x25be('0x9b'),'where':_0xb756d2,'limit':0x1,'order':[['updatedAt',_0x25be('0x9c')]]}]},{'model':db[_0x25be('0x9d')],'as':_0x25be('0x9e')}]});})[_0x25be('0x20')](handleEntityNotFound(_0x316eab,null))[_0x25be('0x20')](function(_0x2c1546){if(_0x2c1546&&_0x2c1546['List']){_0x17257e[_0x25be('0x9f')]=_0x2c1546;_0x17257e[_0x25be('0xa0')]=_0x2c1546[_0x25be('0x9e')];_0x17257e[_0x25be('0xa1')]=_0x2c1546[_0x25be('0xa2')];_0x17257e[_0x25be('0xa0')]=_[_0x25be('0xa3')](_0x17257e[_0x25be('0xa0')],[_0x25be('0xa4')],[_0x25be('0xa5')]);if(_0x17257e['account'][_0x25be('0x9e')]){delete _0x17257e[_0x25be('0x9f')][_0x25be('0x9e')];}if(_0x17257e[_0x25be('0x9f')][_0x25be('0xa2')]&&_0x17257e[_0x25be('0x9f')][_0x25be('0xa2')][_0x25be('0x9b')]['length']){return _0x17257e[_0x25be('0x9f')][_0x25be('0xa2')][_0x25be('0x9b')][0x0];}var _0x2d2d86=_[_0x25be('0x16')](_0x304077[_0x25be('0x5a')],{'firstName':_0x304077['body'][_0x25be('0x9a')],'ListId':_0x2c1546[_0x25be('0x94')]});_0x2d2d86[_0x304077[_0x25be('0x5a')]['mapKey']]=_0x304077[_0x25be('0x5a')][_0x25be('0x9a')];return db[_0x25be('0x8d')][_0x25be('0x59')](_0x2d2d86,{'fields':_0x4b49cc,'raw':!![]});}})[_0x25be('0x20')](handleEntityNotFound(_0x316eab,null))[_0x25be('0x20')](function(_0x10d433){_0x17257e[_0x25be('0xa6')]=_0x10d433;var _0x3c0b09=_0x304077[_0x25be('0x5a')]['customerIp'];if(_0x304077['headers'][_0x25be('0xa7')]){_0x3c0b09=_0x304077[_0x25be('0x8a')][_0x25be('0xa7')];}else if(_0x304077['headers'][_0x25be('0xa8')]){_0x3c0b09=_[_0x25be('0xa9')](_0x304077[_0x25be('0x8a')][_0x25be('0xa8')][_0x25be('0xaa')](','));}if(_0x10d433){var _0x3d12f1={'ContactId':_0x10d433['id'],'ChatWebsiteId':_0x304077[_0x25be('0x53')]['id'],'from':(_0x10d433[_0x25be('0xab')]||'')+'\x20'+(_0x10d433[_0x25be('0xac')]||''),'customerIp':_0x3c0b09,'customerPort':_0x304077[_0x25be('0x8a')]['x-real-port']?_0x304077[_0x25be('0x8a')][_0x25be('0xad')]:null,'referer':_0x304077[_0x25be('0x5a')]['referer'],'browserName':_0x27e9ff[_0x25be('0xae')][_0x25be('0x38')]&&_0x27e9ff['browser'][_0x25be('0xaf')]?util['format'](_0x25be('0xb0'),_0x27e9ff['browser'][_0x25be('0x38')],_0x27e9ff[_0x25be('0xae')]['version']):_0x25be('0xb1'),'browserVersion':_0x27e9ff[_0x25be('0xae')][_0x25be('0xaf')]||_0x25be('0xb1'),'osName':util[_0x25be('0xb2')](_0x25be('0xb0'),_0x27e9ff['os'][_0x25be('0x38')],_0x27e9ff['os'][_0x25be('0xaf')]),'osVersion':_0x27e9ff['os'][_0x25be('0xaf')],'deviceModel':_0x27e9ff[_0x25be('0xb3')][_0x25be('0x3e')]&&_0x27e9ff[_0x25be('0xb3')][_0x25be('0xb4')]?util['format']('%s\x20%s\x20%s',_0x27e9ff[_0x25be('0xb3')][_0x25be('0x3e')],_0x27e9ff['device']['vendor'],_0x27e9ff[_0x25be('0xb3')][_0x25be('0x3c')]):null,'deviceVendor':_0x27e9ff[_0x25be('0xb3')][_0x25be('0xb4')],'deviceType':_0x27e9ff[_0x25be('0xb3')][_0x25be('0x3c')],'formData':JSON[_0x25be('0x26')](_0x304077[_0x25be('0x5a')])};var _0x15447b={'ChatWebsiteId':_0x304077[_0x25be('0x53')]['id'],'closed':![]};if(_0x304077[_0x25be('0x5a')][_0x25be('0xb5')]){_0x15447b[_0x25be('0xb5')]=_0x304077[_0x25be('0x5a')][_0x25be('0xb5')];return db[_0x25be('0xb6')]['find']({'where':_0x15447b})[_0x25be('0x20')](function(_0x15caf0){if(_0x15caf0){return[_0x15caf0,![]];}_0x3d12f1[_0x25be('0xb5')]=_0x304077[_0x25be('0x5a')]['threadId'];_0x3d12f1[_0x25be('0xb7')]=_0x304077[_0x25be('0x5a')][_0x25be('0xb7')];return db['ChatInteraction'][_0x25be('0x59')](_0x3d12f1)['then'](function(_0x3cd64c){return[_0x3cd64c,!![]];});});}_0x15447b[_0x25be('0xb8')]=_0x10d433['id'];if(_0x304077[_0x25be('0x5a')][_0x25be('0xb9')]&&_0x304077[_0x25be('0x5a')][_0x25be('0xb9')]['id']){_0x15447b['id']=_0x304077[_0x25be('0x5a')]['interaction']['id'];return db['ChatInteraction'][_0x25be('0x58')]({'where':_0x15447b})[_0x25be('0x20')](function(_0x5426c7){if(_0x5426c7){return[_0x5426c7,![]];}return db['ChatInteraction'][_0x25be('0x59')](_0x3d12f1)['then'](function(_0x410bf9){return[_0x410bf9,!![]];});});}return db['ChatInteraction'][_0x25be('0x59')](_0x3d12f1)[_0x25be('0x20')](function(_0xfd68db){return[_0xfd68db,!![]];});}})['spread'](function(_0xc958cc,_0x31ec52){if(_0xc958cc){_0x448d8d=_0x31ec52;if(!_0x31ec52){var _0x404c26={'from':(_0x17257e[_0x25be('0xa6')][_0x25be('0xab')]||'')+'\x20'+(_0x17257e['contact']['lastName']||'')};if(_0x304077['body'][_0x25be('0xb5')]&&_0x304077[_0x25be('0x5a')]['messageId']&&_0x304077[_0x25be('0x5a')][_0x25be('0xb5')]!=_0x304077[_0x25be('0x5a')][_0x25be('0xba')]){_0x404c26[_0x25be('0xb5')]=_0x304077[_0x25be('0x5a')]['messageId'];}return _0xc958cc[_0x25be('0x33')](_0x404c26);}else{return _0xc958cc;}}})[_0x25be('0x20')](function(_0x515833){_0x17257e[_0x25be('0xb9')]=_0x515833['get']({'plain':!![]});_0x17257e[_0x25be('0xb9')][_0x25be('0xbb')]=_0x448d8d;if(_0x17257e[_0x25be('0xb9')][_0x25be('0xbb')]){if(_0x17257e['account']['autoclose']){_0x17257e[_0x25be('0xa0')][_0x25be('0xbc')]({'id':0x0,'priority':_0x17257e[_0x25be('0xa0')][_0x25be('0x45')]+0x1,'app':'close','appdata':_0x25be('0xbd'),'interval':_0x25be('0xbe')});}}return db[_0x25be('0xbf')][_0x25be('0x59')]({'body':_0x304077[_0x25be('0x5a')][_0x25be('0x5a')],'ChatWebsiteId':_0x304077[_0x25be('0x53')]['id'],'ChatInteractionId':_0x515833['id'],'direction':'in','ContactId':_0x17257e[_0x25be('0xa6')]['id'],'AttachmentId':_0x304077[_0x25be('0x5a')][_0x25be('0xc0')]});})['then'](function(_0x1df64f){_0x17257e[_0x25be('0x28')]=_0x1df64f;if(_0x17257e[_0x25be('0xb9')]['UserId']){return db[_0x25be('0xc1')][_0x25be('0x58')]({'attributes':['id',_0x25be('0x38')],'where':{'id':_0x17257e[_0x25be('0xb9')][_0x25be('0xc2')]}})[_0x25be('0x20')](function(_0xbe326a){if(_0xbe326a){_0x17257e[_0x25be('0xa0')][_0x25be('0xc3')]({'id':0x0,'priority':0x0,'app':_0x25be('0xc4'),'appdata':_0xbe326a[_0x25be('0x38')]+','+(_0x17257e['account'][_0x25be('0xc5')]||0xa),'interval':'*,*,*,*'});_0x17257e[_0x25be('0xc6')]=!![];}return respondWithRpcPromise('Start',_0x25be('0xc7'),_0x17257e);});}return respondWithRpcPromise(_0x25be('0xc8'),_0x25be('0xc7'),_0x17257e);})[_0x25be('0x20')](function(_0xfa4f3d){respondWithRpcPromise('EventManager',_0x25be('0xc9'),{'event':_0x25be('0x88'),'message':_0xfa4f3d},client9002);return _0xfa4f3d;})[_0x25be('0x20')](respondWithResult(_0x316eab,null))[_0x25be('0x29')](handleError(_0x316eab,null));};exports['offline']=function(_0x592c95,_0x3a335e,_0xae004){var _0x43487f,_0xa3b765,_0x3d185f;var _0x4fe09a=[];var _0x27e50b=[];var _0xd16c51={};return db[_0x25be('0x8d')]['describe']()[_0x25be('0x20')](function(_0x38cfa5){if(!_0x38cfa5){throw new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))](_0x25be('0x8f'));}_0x27e50b=_[_0x25be('0x90')](_[_0x25be('0x40')](_0x38cfa5),[_0x25be('0x91'),_0x25be('0x92')]);_0x4fe09a=_[_0x25be('0x90')](_['keys'](_0x38cfa5),['createdAt',_0x25be('0x92'),_0x25be('0x93'),_0x25be('0x94')]);if(_0x592c95[_0x25be('0x5a')]['id']){delete _0x592c95[_0x25be('0x5a')]['id'];}if(_['isNil'](_0x592c95[_0x25be('0x5a')][_0x25be('0x9a')])){throw _0x3a335e[_0x25be('0x2b')](0x1f4)[_0x25be('0x39')](new db[(_0x25be('0x8e'))]['ValidationError'](_0x25be('0x95')));}if(_['isNil'](_0x592c95[_0x25be('0x5a')][_0x25be('0x5a')])||_0x592c95[_0x25be('0x5a')][_0x25be('0x5a')]===''){throw _0x3a335e['status'](0x1f4)['send'](new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))](_0x25be('0x96')));}if(_[_0x25be('0x81')](_0x592c95[_0x25be('0x5a')]['mapKeyOffline'])){throw _0x3a335e[_0x25be('0x2b')](0x1f4)[_0x25be('0x39')](new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))](_0x25be('0xca')+_0x4fe09a));}if(!_[_0x25be('0x99')](_0x4fe09a,_0x592c95[_0x25be('0x5a')]['mapKeyOffline'])){throw _0x3a335e[_0x25be('0x2b')](0x1f4)[_0x25be('0x39')](new db[(_0x25be('0x8e'))][(_0x25be('0x1e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fe09a));}_0xd16c51[_0x592c95[_0x25be('0x5a')]['mapKeyOffline']]=_0x592c95['body'][_0x25be('0x9a')];})[_0x25be('0x20')](function(){return db[_0x25be('0x3a')][_0x25be('0x58')]({'where':{'id':_0x592c95[_0x25be('0x53')]['id']},'include':[{'model':db[_0x25be('0xcb')],'as':_0x25be('0xa2')}]});})[_0x25be('0x20')](handleEntityNotFound(_0x3a335e,null))[_0x25be('0x20')](function(_0x241539){if(_0x241539&&_0x241539[_0x25be('0xa2')]){_0xa3b765=_0x241539;var _0x6556e3=_[_0x25be('0x16')](_0x592c95['body'],{'firstName':_0x592c95[_0x25be('0x5a')][_0x25be('0x9a')],'phone':_0x592c95[_0x25be('0x5a')]['from'],'ListId':_0x241539['ListId']});_0x6556e3[_0x592c95[_0x25be('0x5a')]['mapKeyOffline']]=_0x592c95['body'][_0x25be('0x9a')];return db[_0x25be('0x8d')]['findOrCreate']({'where':_0xd16c51,'defaults':_0x6556e3});}})[_0x25be('0xcc')](function(_0x39c248){if(_0x39c248){_0x3d185f=_0x39c248;var _0x35b557=fs[_0x25be('0xcd')](path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0xce')),_0x25be('0xcf'));var _0x289750=ejs[_0x25be('0xd0')](_0x35b557,{'body':_[_0x25be('0xd1')](_0x592c95[_0x25be('0x5a')][_0x25be('0x5a')]),'bodyTitle':_0xa3b765['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x289750,'ContactId':_0x39c248['id'],'ChatWebsiteId':_0xa3b765['id']});}})[_0x25be('0x20')](function(_0x39d70e){if(_0x39d70e){_0x43487f=_0x39d70e;return db[_0x25be('0xd2')][_0x25be('0x68')]({'where':{'service':!![]},'include':[{'model':db[_0x25be('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x25be('0x20')](function(_0x7b7a15){if(_0x7b7a15&&_0x7b7a15['Smtp']&&_0xa3b765[_0x25be('0xd4')]){var _0x553ba9={'tls':{'rejectUnauthorized':![]}};if(_0x7b7a15[_0x25be('0xd5')][_0x25be('0xd6')]){_0x553ba9['service']=_0x7b7a15[_0x25be('0xd5')][_0x25be('0xd6')];}else{_0x553ba9[_0x25be('0xd7')]=_0x7b7a15[_0x25be('0xd5')]['host'];_0x553ba9[_0x25be('0xd8')]=_0x7b7a15[_0x25be('0xd5')]['port'];_0x553ba9['secure']=_0x7b7a15[_0x25be('0xd5')][_0x25be('0xd9')];}if(_0x7b7a15[_0x25be('0xd5')][_0x25be('0xda')]){_0x553ba9[_0x25be('0xdb')]={'user':_0x7b7a15[_0x25be('0xd5')][_0x25be('0x5e')],'pass':_0x7b7a15[_0x25be('0xd5')][_0x25be('0xdc')]};}return respondWithRpcPromise(_0x25be('0xdd'),'sendMail',{'account':_0x553ba9,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x7b7a15[_0x25be('0x38')],_0x7b7a15[_0x25be('0xde')]||_0x7b7a15[_0x25be('0xd5')]['user']),'to':_0xa3b765['forwardOfflineAddress'],'subject':_0xa3b765[_0x25be('0xdf')],'text':_0x43487f[_0x25be('0x5a')]}},client9003)[_0x25be('0x20')](function(){return _0x43487f;})['catch'](function(_0x245271){console['error'](_0x245271);});}})['then'](function(){if(_0x43487f){return _0x43487f;}})[_0x25be('0x20')](respondWithResult(_0x3a335e,null))[_0x25be('0x29')](handleError(_0x3a335e,null));};exports['addInteraction']=function(_0x438bd8,_0x4147c2,_0x5868e3){return db['ChatInteraction'][_0x25be('0x58')]({'where':{'id':_0x438bd8[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x4147c2,null))[_0x25be('0x20')](function(_0x36b65e){if(_0x36b65e){return _0x36b65e['addInteraction'](_0x438bd8[_0x25be('0x5a')][_0x25be('0x6d')],_['omit'](_0x438bd8[_0x25be('0x5a')],[_0x25be('0x6d'),'id'])||{});}})[_0x25be('0x20')](respondWithResult(_0x4147c2,null))['catch'](handleError(_0x4147c2,null));};exports[_0x25be('0xe0')]=function(_0x345a79,_0x12041c,_0x4f8e23){var _0x42a194={'raw':![],'where':{}};var _0x9f4b3={};var _0x2485b2={'count':0x0,'rows':[]};return db[_0x25be('0x3a')][_0x25be('0x68')]({'where':{'id':_0x345a79[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x12041c,null))['then'](function(_0x59f7b6){if(_0x59f7b6){_0x9f4b3[_0x25be('0x3e')]=_['keys'](db[_0x25be('0xb6')][_0x25be('0x56')]);_0x9f4b3[_0x25be('0x3f')]=_[_0x25be('0x40')](_0x345a79['query']);_0x9f4b3[_0x25be('0x41')]=_[_0x25be('0x42')](_0x9f4b3[_0x25be('0x3e')],_0x9f4b3[_0x25be('0x3f')]);_0x42a194[_0x25be('0x43')]=_[_0x25be('0x42')](_0x9f4b3['model'],qs[_0x25be('0x44')](_0x345a79[_0x25be('0x3f')][_0x25be('0x44')]));_0x42a194['attributes']=_0x42a194[_0x25be('0x43')][_0x25be('0x45')]?_0x42a194[_0x25be('0x43')]:_0x9f4b3[_0x25be('0x3e')];if(!_0x345a79['query']['hasOwnProperty']('nolimit')){_0x42a194['limit']=qs['limit'](_0x345a79[_0x25be('0x3f')][_0x25be('0x2f')]);_0x42a194[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x345a79[_0x25be('0x3f')][_0x25be('0x2e')]);}_0x42a194['order']=qs['sort'](_0x345a79[_0x25be('0x3f')][_0x25be('0x48')]);_0x42a194[_0x25be('0x4a')]=qs[_0x25be('0x41')](_['pick'](_0x345a79[_0x25be('0x3f')],_0x9f4b3[_0x25be('0x41')]));_0x42a194['where']['ChatWebsiteId']=_0x59f7b6['id'];if(_0x345a79[_0x25be('0x3f')][_0x25be('0x49')]){_0x42a194[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x42a194['where'],{'$or':_['map'](_0x42a194['attributes'],function(_0x1178b6){var _0x38b28a={};_0x38b28a[_0x1178b6]={'$like':'%'+_0x345a79[_0x25be('0x3f')][_0x25be('0x49')]+'%'};return _0x38b28a;})});}_0x42a194=_[_0x25be('0x4b')]({},_0x42a194,_0x345a79[_0x25be('0x4e')]);return db[_0x25be('0xb6')]['count']({'where':_0x42a194[_0x25be('0x4a')]})[_0x25be('0x20')](function(_0x30e080){_0x2485b2['count']=_0x30e080;if(_0x345a79['query']['includeAll']){_0x42a194[_0x25be('0x57')]=[{'model':db[_0x25be('0x8d')],'as':_0x25be('0xe1'),'required':![]},{'model':db[_0x25be('0xc1')],'as':_0x25be('0xe2'),'attributes':[_0x25be('0x38'),'fullname',_0x25be('0xe3')],'required':![]},{'model':db[_0x25be('0xe4')],'as':'Tags','attributes':['id',_0x25be('0x38'),_0x25be('0xe5')],'where':_0x345a79[_0x25be('0x3f')][_0x25be('0xe6')]?{'id':_0x345a79[_0x25be('0x3f')][_0x25be('0xe6')]}:undefined,'required':_0x345a79[_0x25be('0x3f')]['tag']?!![]:![]}];}return db[_0x25be('0xb6')][_0x25be('0x50')](_0x42a194);})['then'](function(_0x38841c){_0x2485b2['rows']=_0x38841c;return _0x2485b2;});}})[_0x25be('0x20')](respondWithFilteredResult(_0x12041c,_0x42a194))['catch'](handleError(_0x12041c,null));};function iftimePromise(_0x5a17cd,_0x3139c7){return respondWithRpcPromise(_0x25be('0xe7'),_0x25be('0xe8'),{'command':_0x3139c7[_0x25be('0xe9')]?util[_0x25be('0xb2')]('iftime\x20%s,%s',_0x5a17cd['interval'],_0x3139c7[_0x25be('0xe9')]):util['format'](_0x25be('0xea'),_0x5a17cd[_0x25be('0xeb')])},client9002)['then'](function(_0x37d918){var _0x4ad2e2=_0x37d918&&_0x37d918['indexOf']('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3139c7['id'],_0x5a17cd['id'],_0x5a17cd[_0x25be('0xeb')],_0x4ad2e2?_0x25be('0xec'):_0x25be('0xed'),_0x3139c7[_0x25be('0xe9')]?_0x3139c7['timezone']:_0x25be('0xee'));return _0x4ad2e2;})[_0x25be('0x29')](function(_0x4db2ca){logger[_0x25be('0x27')](_0x25be('0xef'),_0x3139c7['id'],_0x5a17cd['id'],_0x5a17cd[_0x25be('0xeb')],util[_0x25be('0xf0')](_0x4db2ca,{'showHidden':![],'depth':null}),_0x3139c7[_0x25be('0xe9')]?_0x3139c7[_0x25be('0xe9')]:_0x25be('0xee'));return![];});}exports[_0x25be('0xe8')]=function(_0x4a7a51,_0x2be365,_0x44c1fc){var _0x4ef598=0x0;var _0x4ef577=0x0;var _0x30f4f0=![];var _0x194d32;var _0x18b1e3;return db[_0x25be('0x3a')][_0x25be('0x58')]({'where':{'id':_0x4a7a51['params']['id']},'include':[{'model':db['Interval'],'as':_0x25be('0xf1'),'include':[{'model':db[_0x25be('0xf1')],'as':_0x25be('0xf2'),'attributes':['id',_0x25be('0xeb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2be365,null))['then'](function(_0x4fbdaf){if(_0x4fbdaf){_0x194d32=_0x4fbdaf;return _0x4fbdaf[_0x25be('0xf3')]({'raw':!![]});}})[_0x25be('0x20')](function(_0x24d8eb){if(_0x194d32){if(_0x24d8eb){_0x18b1e3=_0x24d8eb;}}return require(_0x25be('0x7a'))['getLicense']();})[_0x25be('0x20')](function(_0x4d4088){if(_0x4d4088){_0x4ef577=_0x4d4088['virtual'];_0x30f4f0=_0x4d4088['custom'];}})[_0x25be('0x20')](function(){return db[_0x25be('0xb6')][_0x25be('0x4f')]({'where':{'closed':![]}});})[_0x25be('0x20')](function(_0x18f811){_0x4ef598=_0x18f811;if(_0x4ef577&&_0x18f811>_0x4ef577){return db[_0x25be('0xf4')]['findOne']({'where':{'id':0x1}})[_0x25be('0x20')](function(_0x10f396){if(_0x10f396){_0x10f396[_0x25be('0xf5')](_0x25be('0xf6'));}});}})[_0x25be('0x20')](function(){if(_0x194d32[_0x25be('0xf1')]&&_0x194d32[_0x25be('0xf1')]['Intervals']){var _0x5c14e6=[];for(var _0x425b27=0x0;_0x425b27<_0x194d32[_0x25be('0xf1')][_0x25be('0xf2')][_0x25be('0x45')];_0x425b27++){var _0x25b1c2=_0x194d32[_0x25be('0xf1')][_0x25be('0xf2')][_0x425b27][_0x25be('0x5b')]({'plain':!![]});_0x5c14e6[_0x25be('0xbc')](iftimePromise(_0x25b1c2,_0x194d32));}return BPromise[_0x25be('0xf7')](_0x5c14e6)[_0x25be('0x20')](function(_0x491f8b){return _[_0x25be('0xf8')](_0x491f8b);});}else{return!![];}})[_0x25be('0x20')](function(_0x38c6e8){var _0x3c16cd=fs[_0x25be('0xcd')](path[_0x25be('0x77')](config[_0x25be('0x78')],_0x25be('0xf9')),_0x25be('0xcf'));var _0x1537b8={'remote':_0x194d32[_0x25be('0xfa')],'query':querystring['stringify'](_[_0x25be('0x4b')](_0x194d32['get']({'plain':!![]}),{'customerIp':_0x4a7a51[_0x25be('0x8a')][_0x25be('0xa8')]||_0x4a7a51[_0x25be('0x8a')]['x-real-ip']||_0x4a7a51[_0x25be('0xfb')][_0x25be('0xfc')]||_0x4a7a51['ip'],'referer':_0x4a7a51[_0x25be('0x8a')][_0x25be('0xfd')],'openedInteractions':_0x4ef598,'maxInteractions':_0x4ef577,'virtual':_0x30f4f0[_0x25be('0xfe')],'online':_0x38c6e8,'custom':_0x30f4f0}))['replace'](/'/g,'\x5c\x27')};_0x2be365[_0x25be('0x39')](ejs[_0x25be('0xd0')](Mustache[_0x25be('0xd0')](_0x3c16cd,_0x1537b8),{'proactiveActions':_0x18b1e3,'alignment':_0x194d32[_0x25be('0xff')],'verticalAlignment':_0x194d32[_0x25be('0x100')],'div_color':_0x194d32[_0x25be('0xe5')],'text_color':_0x194d32[_0x25be('0x101')]}));})[_0x25be('0x29')](handleError(_0x2be365,null));};exports[_0x25be('0x102')]=function(_0x7eedb1,_0x226197,_0x1449cf){return db['ChatWebsite'][_0x25be('0x68')]({'where':{'id':_0x7eedb1['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x226197,null))[_0x25be('0x20')](function(_0x181e06){if(_0x181e06){return db[_0x25be('0x103')]['transaction'](function(_0x2cee82){return db[_0x25be('0x9d')][_0x25be('0x36')]({'where':{'ChatWebsiteId':_0x7eedb1[_0x25be('0x53')]['id']},'transaction':_0x2cee82})['then'](function(_0x353f33){var _0x4ef4fd=_[_0x25be('0x4c')](_0x7eedb1[_0x25be('0x5a')],function(_0x1f5770){_0x1f5770[_0x25be('0x65')]=_0x7eedb1[_0x25be('0x53')]['id'];return _0x1f5770;});return db[_0x25be('0x9d')][_0x25be('0x104')](_0x4ef4fd,{'transaction':_0x2cee82});});})[_0x25be('0x20')](function(){return db[_0x25be('0x9d')][_0x25be('0x105')]({'where':{'ChatWebsiteId':_0x7eedb1[_0x25be('0x53')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x226197,null))[_0x25be('0x29')](handleError(_0x226197,null));};exports[_0x25be('0x106')]=function(_0x4c66d5,_0x491dee,_0x5dcc13){var _0x2288bd={};var _0x577b75={};var _0x469f88;var _0x4f7e4c;return db['ChatWebsite'][_0x25be('0x68')]({'where':{'id':_0x4c66d5[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x491dee,null))[_0x25be('0x20')](function(_0x2d4ef0){if(_0x2d4ef0){_0x469f88=_0x2d4ef0;_0x577b75[_0x25be('0x3e')]=_[_0x25be('0x40')](db[_0x25be('0x9d')][_0x25be('0x56')]);_0x577b75['query']=_['keys'](_0x4c66d5[_0x25be('0x3f')]);_0x577b75[_0x25be('0x41')]=_[_0x25be('0x42')](_0x577b75['model'],_0x577b75[_0x25be('0x3f')]);_0x2288bd[_0x25be('0x43')]=_[_0x25be('0x42')](_0x577b75[_0x25be('0x3e')],qs[_0x25be('0x44')](_0x4c66d5['query'][_0x25be('0x44')]));_0x2288bd[_0x25be('0x43')]=_0x2288bd['attributes'][_0x25be('0x45')]?_0x2288bd[_0x25be('0x43')]:_0x577b75[_0x25be('0x3e')];_0x2288bd[_0x25be('0x47')]=qs[_0x25be('0x48')](_0x4c66d5[_0x25be('0x3f')]['sort']);_0x2288bd[_0x25be('0x4a')]=qs[_0x25be('0x41')](_['pick'](_0x4c66d5['query'],_0x577b75[_0x25be('0x41')]));if(_0x4c66d5['query']['filter']){_0x2288bd['where']=_[_0x25be('0x4b')](_0x2288bd[_0x25be('0x4a')],{'$or':_[_0x25be('0x4c')](_0x2288bd[_0x25be('0x43')],function(_0x1d9e94){var _0x4e82c2={};_0x4e82c2[_0x1d9e94]={'$like':'%'+_0x4c66d5[_0x25be('0x3f')]['filter']+'%'};return _0x4e82c2;})});}_0x2288bd=_[_0x25be('0x4b')]({},_0x2288bd,_0x4c66d5['options']);return _0x469f88['getApplications'](_0x2288bd);}})[_0x25be('0x20')](function(_0xbd45b3){if(_0xbd45b3){_0x4f7e4c=_0xbd45b3[_0x25be('0x45')];if(!_0x4c66d5['query'][_0x25be('0x69')]('nolimit')){_0x2288bd[_0x25be('0x2f')]=qs['limit'](_0x4c66d5[_0x25be('0x3f')][_0x25be('0x2f')]);_0x2288bd[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x4c66d5[_0x25be('0x3f')][_0x25be('0x2e')]);}return _0x469f88[_0x25be('0x106')](_0x2288bd);}})['then'](function(_0x24ef97){if(_0x24ef97){return _0x24ef97?{'count':_0x4f7e4c,'rows':_0x24ef97}:null;}})[_0x25be('0x20')](respondWithResult(_0x491dee,null))[_0x25be('0x29')](handleError(_0x491dee,null));};exports[_0x25be('0x107')]=function(_0x262152,_0x571be6,_0xd6f722){return db['chatProactiveAction'][_0x25be('0x58')]({'where':{'id':_0x262152[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x571be6,null))[_0x25be('0x20')](function(_0x527623){if(_0x527623){return _0x527623[_0x25be('0x107')](_0x262152[_0x25be('0x5a')]['ids'],_['omit'](_0x262152[_0x25be('0x5a')],['ids','id'])||{});}})[_0x25be('0x20')](respondWithResult(_0x571be6,null))[_0x25be('0x29')](handleError(_0x571be6,null));};exports[_0x25be('0xf3')]=function(_0x3b6cc6,_0xa77471,_0x5185d9){var _0x4e0e69={};var _0x2d85c9={};var _0x40ec39;var _0xe8036d;return db['ChatWebsite'][_0x25be('0x68')]({'where':{'id':_0x3b6cc6[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0xa77471,null))[_0x25be('0x20')](function(_0x11e5b1){if(_0x11e5b1){_0x40ec39=_0x11e5b1;_0x2d85c9[_0x25be('0x3e')]=_[_0x25be('0x40')](db['ChatProactiveAction'][_0x25be('0x56')]);_0x2d85c9[_0x25be('0x3f')]=_[_0x25be('0x40')](_0x3b6cc6[_0x25be('0x3f')]);_0x2d85c9[_0x25be('0x41')]=_[_0x25be('0x42')](_0x2d85c9[_0x25be('0x3e')],_0x2d85c9[_0x25be('0x3f')]);_0x4e0e69[_0x25be('0x43')]=_[_0x25be('0x42')](_0x2d85c9['model'],qs[_0x25be('0x44')](_0x3b6cc6[_0x25be('0x3f')]['fields']));_0x4e0e69[_0x25be('0x43')]=_0x4e0e69[_0x25be('0x43')][_0x25be('0x45')]?_0x4e0e69['attributes']:_0x2d85c9['model'];_0x4e0e69['order']=qs['sort'](_0x3b6cc6[_0x25be('0x3f')][_0x25be('0x48')]);_0x4e0e69['where']=qs[_0x25be('0x41')](_[_0x25be('0x6a')](_0x3b6cc6['query'],_0x2d85c9[_0x25be('0x41')]));if(_0x3b6cc6['query'][_0x25be('0x49')]){_0x4e0e69['where']=_[_0x25be('0x4b')](_0x4e0e69[_0x25be('0x4a')],{'$or':_[_0x25be('0x4c')](_0x4e0e69[_0x25be('0x43')],function(_0x14ee75){var _0x14c109={};_0x14c109[_0x14ee75]={'$like':'%'+_0x3b6cc6[_0x25be('0x3f')][_0x25be('0x49')]+'%'};return _0x14c109;})});}_0x4e0e69=_[_0x25be('0x4b')]({},_0x4e0e69,_0x3b6cc6[_0x25be('0x4e')]);return _0x40ec39[_0x25be('0xf3')](_0x4e0e69);}})[_0x25be('0x20')](function(_0x5958e8){if(_0x5958e8){_0xe8036d=_0x5958e8['length'];if(!_0x3b6cc6[_0x25be('0x3f')][_0x25be('0x69')](_0x25be('0x46'))){_0x4e0e69['limit']=qs[_0x25be('0x2f')](_0x3b6cc6[_0x25be('0x3f')][_0x25be('0x2f')]);_0x4e0e69[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x3b6cc6[_0x25be('0x3f')][_0x25be('0x2e')]);}return _0x40ec39[_0x25be('0xf3')](_0x4e0e69);}})[_0x25be('0x20')](function(_0x4b0d24){if(_0x4b0d24){return _0x4b0d24?{'count':_0xe8036d,'rows':_0x4b0d24}:null;}})[_0x25be('0x20')](respondWithResult(_0xa77471,null))[_0x25be('0x29')](handleError(_0xa77471,null));};exports['getFields']=function(_0x46cfe2,_0xc6c93c,_0x2b93ab){var _0x56e745=_0x46cfe2[_0x25be('0x3f')]['online']===_0x25be('0x108')?_0x25be('0x109'):_0x25be('0x10a');return db[_0x25be('0x3a')][_0x25be('0x58')]({'attributes':['id',_0x56e745],'where':{'id':_0x46cfe2[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0xc6c93c,null))[_0x25be('0x20')](function(_0x5eef49){if(_0x5eef49){var _0x3ee3ca=_0x5eef49[_0x56e745];var _0x7ee266=_0x3ee3ca&&_0x3ee3ca[_0x25be('0x10b')]?_0x3ee3ca[_0x25be('0x10b')]:[];_0xc6c93c[_0x25be('0x39')]({'fromKey':_['isNil'](_0x3ee3ca[_0x25be('0x10c')])?undefined:_0x3ee3ca[_0x25be('0x10c')],'count':_0x7ee266[_0x25be('0x45')],'rows':_0x7ee266});}})['catch'](handleError(_0xc6c93c,null));};exports[_0x25be('0x10d')]=function(_0x5cfa84,_0x260523,_0x16165b){var _0x3e608b={'raw':![],'where':{}};var _0x54911d={};var _0x5e726d={'count':0x0,'rows':[]};return db[_0x25be('0x3a')][_0x25be('0x68')]({'where':{'id':_0x5cfa84[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x260523,null))[_0x25be('0x20')](function(_0x1f5e79){if(_0x1f5e79){_0x54911d['model']=_[_0x25be('0x40')](db[_0x25be('0x10e')][_0x25be('0x56')]);_0x54911d[_0x25be('0x3f')]=_['keys'](_0x5cfa84[_0x25be('0x3f')]);_0x54911d[_0x25be('0x41')]=_[_0x25be('0x42')](_0x54911d[_0x25be('0x3e')],_0x54911d[_0x25be('0x3f')]);_0x3e608b[_0x25be('0x43')]=_[_0x25be('0x42')](_0x54911d[_0x25be('0x3e')],qs[_0x25be('0x44')](_0x5cfa84[_0x25be('0x3f')][_0x25be('0x44')]));_0x3e608b[_0x25be('0x43')]=_0x3e608b[_0x25be('0x43')][_0x25be('0x45')]?_0x3e608b['attributes']:_0x54911d['model'];if(!_0x5cfa84['query'][_0x25be('0x69')]('nolimit')){_0x3e608b[_0x25be('0x2f')]=qs[_0x25be('0x2f')](_0x5cfa84['query'][_0x25be('0x2f')]);_0x3e608b['offset']=qs[_0x25be('0x2e')](_0x5cfa84[_0x25be('0x3f')][_0x25be('0x2e')]);}_0x3e608b[_0x25be('0x47')]=qs['sort'](_0x5cfa84[_0x25be('0x3f')][_0x25be('0x48')]);_0x3e608b['where']=qs[_0x25be('0x41')](_['pick'](_0x5cfa84[_0x25be('0x3f')],_0x54911d[_0x25be('0x41')]));_0x3e608b[_0x25be('0x4a')][_0x25be('0x65')]=_0x1f5e79['id'];if(_0x5cfa84['query'][_0x25be('0x49')]){_0x3e608b[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x3e608b['where'],{'$or':_[_0x25be('0x4c')](_0x3e608b[_0x25be('0x43')],function(_0x4511ee){var _0x15eaac={};_0x15eaac[_0x4511ee]={'$like':'%'+_0x5cfa84['query'][_0x25be('0x49')]+'%'};return _0x15eaac;})});}_0x3e608b=_['merge']({},_0x3e608b,_0x5cfa84['options']);return db[_0x25be('0x10e')][_0x25be('0x4f')]({'where':_0x3e608b['where']})['then'](function(_0x19f78c){_0x5e726d[_0x25be('0x4f')]=_0x19f78c;if(_0x5cfa84[_0x25be('0x3f')][_0x25be('0x6b')]){_0x3e608b[_0x25be('0x57')]=[{'all':!![]}];}else{_0x3e608b[_0x25be('0x57')]=[{'model':db[_0x25be('0x8d')],'as':_0x25be('0xe1'),'required':![]}];}return db[_0x25be('0x10e')]['findAll'](_0x3e608b);})[_0x25be('0x20')](function(_0x5d4719){_0x5e726d[_0x25be('0x51')]=_0x5d4719;return _0x5e726d;});}})['then'](respondWithFilteredResult(_0x260523,_0x3e608b))[_0x25be('0x29')](handleError(_0x260523,null));};exports[_0x25be('0x10f')]=function(_0x1506bd,_0x25032f,_0x40d2d4){return db[_0x25be('0x3a')]['find']({'where':{'id':_0x1506bd[_0x25be('0x53')]['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x25032f,null))[_0x25be('0x20')](function(_0x548e2d){if(_0x548e2d){return _0x548e2d[_0x25be('0x10f')](_0x1506bd['body'][_0x25be('0x6d')],_[_0x25be('0x110')](_0x1506bd['body'],[_0x25be('0x6d'),'id'])||{})[_0x25be('0xcc')](function(_0x160f61){for(var _0xcbb80a=0x0;_0xcbb80a<_0x1506bd[_0x25be('0x5a')]['ids'][_0x25be('0x45')];_0xcbb80a+=0x1){socket[_0x25be('0x111')](_0x25be('0x112'),{'UserId':_0x1506bd['body'][_0x25be('0x6d')][_0xcbb80a],'ChatWebsiteId':_0x1506bd[_0x25be('0x53')]['id']});}return _0x160f61;});}})[_0x25be('0x20')](respondWithResult(_0x25032f,null))[_0x25be('0x29')](handleError(_0x25032f,null));};exports[_0x25be('0x113')]=function(_0x53f3f8,_0x1f45f5,_0x4cb8f){return db[_0x25be('0x3a')][_0x25be('0x58')]({'where':{'id':_0x53f3f8[_0x25be('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f45f5,null))[_0x25be('0x20')](function(_0x375baf){if(_0x375baf){return _0x375baf[_0x25be('0x113')](_0x53f3f8[_0x25be('0x3f')][_0x25be('0x6d')])['then'](function(){if(_[_0x25be('0x114')](_0x53f3f8[_0x25be('0x3f')]['ids'])){for(var _0x2275f3=0x0;_0x2275f3<_0x53f3f8[_0x25be('0x3f')][_0x25be('0x6d')][_0x25be('0x45')];_0x2275f3+=0x1){socket['emit'](_0x25be('0x115'),{'UserId':Number(_0x53f3f8['query'][_0x25be('0x6d')][_0x2275f3]),'ChatWebsiteId':Number(_0x53f3f8[_0x25be('0x53')]['id'])});}}else{socket[_0x25be('0x111')](_0x25be('0x115'),{'UserId':Number(_0x53f3f8[_0x25be('0x3f')][_0x25be('0x6d')]),'ChatWebsiteId':Number(_0x53f3f8[_0x25be('0x53')]['id'])});}});}})[_0x25be('0x20')](respondWithStatusCode(_0x1f45f5,null))[_0x25be('0x29')](handleError(_0x1f45f5,null));};exports['getAgents']=function(_0x98de5d,_0x445131,_0x13ddc6){var _0x4f0e16={};var _0x885a5f={};var _0x124db7;var _0x202696;return db['ChatWebsite'][_0x25be('0x68')]({'where':{'id':_0x98de5d['params']['id']}})[_0x25be('0x20')](handleEntityNotFound(_0x445131,null))['then'](function(_0x40fcbb){if(_0x40fcbb){_0x124db7=_0x40fcbb;_0x885a5f[_0x25be('0x3e')]=_[_0x25be('0x40')](db[_0x25be('0xc1')][_0x25be('0x56')]);_0x885a5f[_0x25be('0x3f')]=_[_0x25be('0x40')](_0x98de5d['query']);_0x885a5f[_0x25be('0x41')]=_[_0x25be('0x42')](_0x885a5f['model'],_0x885a5f[_0x25be('0x3f')]);_0x4f0e16[_0x25be('0x43')]=_['intersection'](_0x885a5f['model'],qs['fields'](_0x98de5d[_0x25be('0x3f')][_0x25be('0x44')]));_0x4f0e16['attributes']=_0x4f0e16[_0x25be('0x43')]['length']?_0x4f0e16[_0x25be('0x43')]:_0x885a5f[_0x25be('0x3e')];_0x4f0e16['order']=qs['sort'](_0x98de5d[_0x25be('0x3f')][_0x25be('0x48')]);_0x4f0e16[_0x25be('0x4a')]=qs[_0x25be('0x41')](_[_0x25be('0x6a')](_0x98de5d[_0x25be('0x3f')],_0x885a5f['filters']));if(_0x98de5d[_0x25be('0x3f')][_0x25be('0x49')]){_0x4f0e16[_0x25be('0x4a')]=_[_0x25be('0x4b')](_0x4f0e16[_0x25be('0x4a')],{'$or':_[_0x25be('0x4c')](_0x4f0e16[_0x25be('0x43')],function(_0x287681){var _0x58ea1f={};_0x58ea1f[_0x287681]={'$like':'%'+_0x98de5d['query'][_0x25be('0x49')]+'%'};return _0x58ea1f;})});}_0x4f0e16=_[_0x25be('0x4b')]({},_0x4f0e16,_0x98de5d['options']);return _0x124db7[_0x25be('0x116')](_0x4f0e16);}})[_0x25be('0x20')](function(_0x2d7322){if(_0x2d7322){_0x202696=_0x2d7322[_0x25be('0x45')];if(!_0x98de5d['query']['hasOwnProperty'](_0x25be('0x46'))){_0x4f0e16['limit']=qs[_0x25be('0x2f')](_0x98de5d['query']['limit']);_0x4f0e16[_0x25be('0x2e')]=qs[_0x25be('0x2e')](_0x98de5d['query'][_0x25be('0x2e')]);}return _0x124db7['getAgents'](_0x4f0e16);}})[_0x25be('0x20')](function(_0x55beb8){if(_0x55beb8){return _0x55beb8?{'count':_0x202696,'rows':_0x55beb8}:null;}})[_0x25be('0x20')](respondWithResult(_0x445131,null))[_0x25be('0x29')](handleError(_0x445131,null));}; \ No newline at end of file +var _0x747b=['../../config/environment','../../mysqldb','defaults','localhost','./chatWebsite.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','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','ChatWebsites','UserProfileResource','name','send','index','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ChatWebsite','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','addDisposition','ChatWebsiteId','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','join','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','CmContact','Contacts','DESC','Applications','list','orderBy','applications','priority','asc','account','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','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','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','remoteAddress','referer','replace','verticalAlignment','textColor','addApplications','ChatApplication','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x24f799,_0x1223f1){var _0x3979bf=function(_0x5608e2){while(--_0x5608e2){_0x24f799['push'](_0x24f799['shift']());}};_0x3979bf(++_0x1223f1);}(_0x747b,0x10c));var _0xb747=function(_0x2eaa8b,_0x3b815f){_0x2eaa8b=_0x2eaa8b-0x0;var _0x3f3b41=_0x747b[_0x2eaa8b];return _0x3f3b41;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb747('0x0'));var zipdir=require(_0xb747('0x1'));var jsonpatch=require(_0xb747('0x2'));var rp=require(_0xb747('0x3'));var moment=require(_0xb747('0x4'));var BPromise=require(_0xb747('0x5'));var Mustache=require(_0xb747('0x6'));var util=require(_0xb747('0x7'));var path=require(_0xb747('0x8'));var sox=require('sox');var csv=require(_0xb747('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb747('0xa'));var squel=require(_0xb747('0xb'));var crypto=require(_0xb747('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb747('0x9'));var querystring=require('querystring');var Papa=require(_0xb747('0xd'));var Redis=require(_0xb747('0xe'));var authService=require(_0xb747('0xf'));var qs=require(_0xb747('0x10'));var as=require(_0xb747('0x11'));var hardwareService=require(_0xb747('0x12'));var logger=require(_0xb747('0x13'))(_0xb747('0x14'));var utils=require(_0xb747('0x15'));var config=require(_0xb747('0x16'));var db=require(_0xb747('0x17'))['db'];config['redis']=_[_0xb747('0x18')](config['redis'],{'host':_0xb747('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb747('0x1a'))[_0xb747('0x1b')](socket);var jayson=require(_0xb747('0x1c'));var client=jayson[_0xb747('0x1d')][_0xb747('0x1e')]({'port':0x232c});var client9002=jayson[_0xb747('0x1d')]['http']({'port':0x232a});var client9003=jayson[_0xb747('0x1d')][_0xb747('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x41732f,_0x828ede,_0x3a4d23){if(_0x3a4d23){var _0x119808=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x119808['test'](_0x828ede)){return _0x41732f;}else{throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x21'));}}else{return _0x41732f;}}function respondWithRpcPromise(_0x2dcb5b,_0x49e462,_0x526cb9,_0x443c46){return new BPromise(function(_0x2d46e5,_0x5312eb){var _0x5de4c3=_0x443c46||client;return _0x5de4c3[_0xb747('0x22')](_0x2dcb5b,_0x526cb9)['then'](function(_0x43694d){logger[_0xb747('0x23')](_0xb747('0x24'),_0x49e462,_0xb747('0x25'));logger[_0xb747('0x26')](_0xb747('0x27'),_0x49e462,_0xb747('0x25'),JSON['stringify'](_0x43694d));if(_0x43694d[_0xb747('0x28')]){if(_0x43694d[_0xb747('0x28')][_0xb747('0x29')]===0x1f4){logger[_0xb747('0x28')](_0xb747('0x24'),_0x49e462,_0x43694d['error'][_0xb747('0x2a')]);return _0x5312eb(_0x43694d[_0xb747('0x28')][_0xb747('0x2a')]);}logger['error'](_0xb747('0x24'),_0x49e462,_0x43694d[_0xb747('0x28')]['message']);return _0x2d46e5(_0x43694d[_0xb747('0x28')][_0xb747('0x2a')]);}else{logger['info'](_0xb747('0x24'),_0x49e462,_0xb747('0x25'));_0x2d46e5(_0x43694d['result']['message']);}})[_0xb747('0x2b')](function(_0x409089){logger[_0xb747('0x28')](_0xb747('0x24'),_0x49e462,_0x409089);_0x5312eb(_0x409089);});});}function respondWithStatusCode(_0x6e9ac5,_0x383b32){_0x383b32=_0x383b32||0xcc;return function(_0x10c266){if(_0x10c266){return _0x6e9ac5[_0xb747('0x2c')](_0x383b32);}return _0x6e9ac5[_0xb747('0x2d')](_0x383b32)[_0xb747('0x2e')]();};}function respondWithResult(_0x38b1ea,_0x257d1f){_0x257d1f=_0x257d1f||0xc8;return function(_0xdb82d3){if(_0xdb82d3){return _0x38b1ea[_0xb747('0x2d')](_0x257d1f)[_0xb747('0x2f')](_0xdb82d3);}};}function respondWithFilteredResult(_0x553bb1,_0x8bc8f2){return function(_0x313083){if(_0x313083){var _0x416f7d=_0x313083[_0xb747('0x30')],_0x2d737c=_0x8bc8f2[_0xb747('0x31')],_0x9dee41=_0x8bc8f2[_0xb747('0x31')]+_0x8bc8f2[_0xb747('0x32')],_0x54cb40;if(_0x9dee41>=_0x416f7d){_0x9dee41=_0x416f7d;_0x54cb40=0xc8;}else{_0x54cb40=0xce;}_0x553bb1[_0xb747('0x2d')](_0x54cb40);return _0x553bb1[_0xb747('0x33')](_0xb747('0x34'),_0x2d737c+'-'+_0x9dee41+'/'+_0x416f7d)[_0xb747('0x2f')](_0x313083);}return null;};}function patchUpdates(_0x31f216){return function(_0x5865c7){try{jsonpatch['apply'](_0x5865c7,_0x31f216,!![]);}catch(_0xacbb4a){return BPromise[_0xb747('0x35')](_0xacbb4a);}return _0x5865c7[_0xb747('0x36')]();};}function saveUpdates(_0x59389e,_0x143782){return function(_0x4316bd){if(_0x4316bd){return _0x4316bd['update'](_0x59389e)['then'](function(_0x23509b){return _0x23509b;});}return null;};}function removeEntity(_0x222f60,_0x216b33){return function(_0x3a9db0){if(_0x3a9db0){return _0x3a9db0[_0xb747('0x37')]()[_0xb747('0x38')](function(){var _0x34321e=_0x3a9db0[_0xb747('0x39')]({'plain':!![]});var _0x287450=_0xb747('0x3a');return db[_0xb747('0x3b')][_0xb747('0x37')]({'where':{'type':_0x287450,'resourceId':_0x34321e['id']}})[_0xb747('0x38')](function(){return _0x3a9db0;});})['then'](function(){_0x222f60[_0xb747('0x2d')](0xcc)[_0xb747('0x2e')]();});}};}function handleEntityNotFound(_0x2742c6,_0xbfb911){return function(_0x3a46ab){if(!_0x3a46ab){_0x2742c6[_0xb747('0x2c')](0x194);}return _0x3a46ab;};}function handleError(_0x300d0f,_0x249495){_0x249495=_0x249495||0x1f4;return function(_0x4e9bcd){logger[_0xb747('0x28')](_0x4e9bcd['stack']);if(_0x4e9bcd[_0xb747('0x3c')]){delete _0x4e9bcd[_0xb747('0x3c')];}_0x300d0f[_0xb747('0x2d')](_0x249495)[_0xb747('0x3d')](_0x4e9bcd);};}exports[_0xb747('0x3e')]=function(_0x217148,_0x5da1e3){var _0x86d355={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3e37c2={},_0x3f008d={'count':0x0,'rows':[]};var _0x52c5b1=_['map'](db['ChatWebsite'][_0xb747('0x3f')],function(_0x98304a){return{'name':_0x98304a['fieldName'],'type':_0x98304a[_0xb747('0x40')][_0xb747('0x41')]};});_0x3e37c2['model']=_[_0xb747('0x42')](_0x52c5b1,'name');_0x3e37c2['query']=_['keys'](_0x217148[_0xb747('0x43')]);_0x3e37c2[_0xb747('0x44')]=_[_0xb747('0x45')](_0x3e37c2[_0xb747('0x46')],_0x3e37c2[_0xb747('0x43')]);_0x86d355[_0xb747('0x47')]=_[_0xb747('0x45')](_0x3e37c2[_0xb747('0x46')],qs[_0xb747('0x48')](_0x217148[_0xb747('0x43')][_0xb747('0x48')]));_0x86d355['attributes']=_0x86d355[_0xb747('0x47')][_0xb747('0x49')]?_0x86d355['attributes']:_0x3e37c2['model'];if(!_0x217148[_0xb747('0x43')][_0xb747('0x4a')](_0xb747('0x4b'))){_0x86d355['limit']=qs['limit'](_0x217148[_0xb747('0x43')][_0xb747('0x32')]);_0x86d355[_0xb747('0x31')]=qs[_0xb747('0x31')](_0x217148[_0xb747('0x43')][_0xb747('0x31')]);}_0x86d355[_0xb747('0x4c')]=qs[_0xb747('0x4d')](_0x217148[_0xb747('0x43')][_0xb747('0x4d')]);_0x86d355['where']=qs[_0xb747('0x44')](_[_0xb747('0x4e')](_0x217148['query'],_0x3e37c2[_0xb747('0x44')]),_0x52c5b1);if(_0x217148['query'][_0xb747('0x4f')]){_0x86d355[_0xb747('0x50')]=_[_0xb747('0x51')](_0x86d355[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x52c5b1,function(_0x11ee04){if(_0x11ee04[_0xb747('0x40')]!==_0xb747('0x52')){var _0x21ea61={};_0x21ea61[_0x11ee04['name']]={'$like':'%'+_0x217148[_0xb747('0x43')][_0xb747('0x4f')]+'%'};return _0x21ea61;}})});}_0x86d355=_[_0xb747('0x51')]({},_0x86d355,_0x217148[_0xb747('0x53')]);var _0x2210df={'where':_0x86d355[_0xb747('0x50')]};return db['ChatWebsite'][_0xb747('0x30')](_0x2210df)[_0xb747('0x38')](function(_0x5c525a){_0x3f008d[_0xb747('0x30')]=_0x5c525a;if(_0x217148[_0xb747('0x43')][_0xb747('0x54')]){_0x86d355[_0xb747('0x55')]=[{'all':!![]}];}return db[_0xb747('0x56')][_0xb747('0x57')](_0x86d355);})[_0xb747('0x38')](function(_0x27875c){_0x3f008d[_0xb747('0x58')]=_0x27875c;return _0x3f008d;})[_0xb747('0x38')](respondWithFilteredResult(_0x5da1e3,_0x86d355))[_0xb747('0x2b')](handleError(_0x5da1e3,null));};exports[_0xb747('0x59')]=function(_0x248b5f,_0x3a2068){var _0x3bb54a={'raw':![],'where':{'id':_0x248b5f[_0xb747('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xb747('0x5b')}]},_0x5a3504={};_0x5a3504[_0xb747('0x46')]=_[_0xb747('0x5c')](db[_0xb747('0x56')][_0xb747('0x3f')]);_0x5a3504['query']=_[_0xb747('0x5c')](_0x248b5f[_0xb747('0x43')]);_0x5a3504['filters']=_[_0xb747('0x45')](_0x5a3504[_0xb747('0x46')],_0x5a3504[_0xb747('0x43')]);_0x3bb54a[_0xb747('0x47')]=_[_0xb747('0x45')](_0x5a3504[_0xb747('0x46')],qs[_0xb747('0x48')](_0x248b5f['query'][_0xb747('0x48')]));_0x3bb54a['attributes']=_0x3bb54a[_0xb747('0x47')][_0xb747('0x49')]?_0x3bb54a[_0xb747('0x47')]:_0x5a3504[_0xb747('0x46')];if(_0x248b5f[_0xb747('0x43')][_0xb747('0x54')]){_0x3bb54a[_0xb747('0x55')]=[{'all':!![]}];}_0x3bb54a=_[_0xb747('0x51')]({},_0x3bb54a,_0x248b5f['options']);return db[_0xb747('0x56')][_0xb747('0x5d')](_0x3bb54a)[_0xb747('0x38')](handleEntityNotFound(_0x3a2068,null))[_0xb747('0x38')](respondWithResult(_0x3a2068,null))[_0xb747('0x2b')](handleError(_0x3a2068,null));};exports['create']=function(_0x137da8,_0x35dc76){return db[_0xb747('0x56')][_0xb747('0x5e')](_0x137da8[_0xb747('0x5f')],{})['then'](function(_0x47c5c5){var _0x52e9c1=_0x137da8[_0xb747('0x60')][_0xb747('0x39')]({'plain':!![]});if(!_0x52e9c1)throw new Error(_0xb747('0x61'));if(_0x52e9c1['role']==='user'){var _0x424eaf=_0x47c5c5[_0xb747('0x39')]({'plain':!![]});var _0x49393e='ChatWebsites';return db['UserProfileSection']['find']({'where':{'name':_0x49393e,'userProfileId':_0x52e9c1[_0xb747('0x62')]},'raw':!![]})['then'](function(_0x25fed2){if(_0x25fed2&&_0x25fed2['autoAssociation']===0x0){return db[_0xb747('0x3b')][_0xb747('0x5e')]({'name':_0x424eaf[_0xb747('0x3c')],'resourceId':_0x424eaf['id'],'type':_0x25fed2[_0xb747('0x3c')],'sectionId':_0x25fed2['id']},{})[_0xb747('0x38')](function(){return _0x47c5c5;});}else{return _0x47c5c5;}})['catch'](function(_0x2c958d){logger[_0xb747('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c958d);throw _0x2c958d;});}return _0x47c5c5;})[_0xb747('0x38')](respondWithResult(_0x35dc76,0xc9))[_0xb747('0x2b')](handleError(_0x35dc76,null));};exports[_0xb747('0x63')]=function(_0x54977a,_0x39f80d){if(_0x54977a['body']['id']){delete _0x54977a[_0xb747('0x5f')]['id'];}return db[_0xb747('0x56')]['find']({'where':{'id':_0x54977a[_0xb747('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xb747('0x5b')}]})['then'](handleEntityNotFound(_0x39f80d,null))[_0xb747('0x38')](saveUpdates(_0x54977a[_0xb747('0x5f')],null))[_0xb747('0x38')](respondWithResult(_0x39f80d,null))['catch'](handleError(_0x39f80d,null));};exports[_0xb747('0x37')]=function(_0x51bf53,_0x12a242){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x51bf53[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x12a242,null))[_0xb747('0x38')](removeEntity(_0x12a242,null))['catch'](handleError(_0x12a242,null));};exports['describe']=function(_0x30931d,_0x52f745){return db['ChatWebsite']['describe']()[_0xb747('0x38')](respondWithResult(_0x52f745,null))[_0xb747('0x2b')](handleError(_0x52f745,null));};exports[_0xb747('0x64')]=function(_0x155ff7,_0x24729a,_0x48846d){if(_0x155ff7[_0xb747('0x5f')]['id']){delete _0x155ff7[_0xb747('0x5f')]['id'];}return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x155ff7[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x24729a,null))[_0xb747('0x38')](function(_0xd03ce1){if(_0xd03ce1){_0x155ff7[_0xb747('0x5f')][_0xb747('0x65')]=_0xd03ce1['id'];return db['Disposition'][_0xb747('0x5e')](_0x155ff7[_0xb747('0x5f')]);}})['then'](respondWithResult(_0x24729a,null))['catch'](handleError(_0x24729a,null));};exports['getDispositions']=function(_0x46c830,_0x635764,_0x5fcdee){var _0x2e9e55={'raw':![],'where':{}};var _0x5966be={};var _0x526126={'count':0x0,'rows':[]};return db[_0xb747('0x56')][_0xb747('0x66')]({'where':{'id':_0x46c830[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x635764,null))['then'](function(_0x2527c8){if(_0x2527c8){_0x5966be['model']=_['keys'](db['Disposition'][_0xb747('0x3f')]);_0x5966be[_0xb747('0x43')]=_['keys'](_0x46c830[_0xb747('0x43')]);_0x5966be[_0xb747('0x44')]=_[_0xb747('0x45')](_0x5966be[_0xb747('0x46')],_0x5966be[_0xb747('0x43')]);_0x2e9e55['attributes']=_['intersection'](_0x5966be['model'],qs[_0xb747('0x48')](_0x46c830[_0xb747('0x43')][_0xb747('0x48')]));_0x2e9e55['attributes']=_0x2e9e55['attributes']['length']?_0x2e9e55[_0xb747('0x47')]:_0x5966be['model'];if(!_0x46c830[_0xb747('0x43')][_0xb747('0x4a')](_0xb747('0x4b'))){_0x2e9e55[_0xb747('0x32')]=qs[_0xb747('0x32')](_0x46c830[_0xb747('0x43')][_0xb747('0x32')]);_0x2e9e55[_0xb747('0x31')]=qs[_0xb747('0x31')](_0x46c830[_0xb747('0x43')][_0xb747('0x31')]);}_0x2e9e55[_0xb747('0x4c')]=qs['sort'](_0x46c830['query'][_0xb747('0x4d')]);_0x2e9e55[_0xb747('0x50')]=qs[_0xb747('0x44')](_[_0xb747('0x4e')](_0x46c830['query'],_0x5966be[_0xb747('0x44')]));_0x2e9e55['where']['ChatWebsiteId']=_0x2527c8['id'];if(_0x46c830['query'][_0xb747('0x4f')]){_0x2e9e55[_0xb747('0x50')]=_[_0xb747('0x51')](_0x2e9e55[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x2e9e55['attributes'],function(_0x5bbce9){var _0x4a5b2d={};_0x4a5b2d[_0x5bbce9]={'$like':'%'+_0x46c830['query'][_0xb747('0x4f')]+'%'};return _0x4a5b2d;})});}_0x2e9e55=_['merge']({},_0x2e9e55,_0x46c830[_0xb747('0x53')]);return db['Disposition'][_0xb747('0x30')]({'where':_0x2e9e55[_0xb747('0x50')]})[_0xb747('0x38')](function(_0x3cbd73){_0x526126['count']=_0x3cbd73;if(_0x46c830[_0xb747('0x43')][_0xb747('0x54')]){_0x2e9e55['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2e9e55);})[_0xb747('0x38')](function(_0x205038){_0x526126['rows']=_0x205038;return _0x526126;});}})[_0xb747('0x38')](respondWithFilteredResult(_0x635764,_0x2e9e55))[_0xb747('0x2b')](handleError(_0x635764,null));};exports[_0xb747('0x67')]=function(_0x480384,_0x448e2e,_0x3c484c){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x480384[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x448e2e,null))[_0xb747('0x38')](function(_0x110c19){if(_0x110c19){return _0x110c19['removeDispositions'](_0x480384[_0xb747('0x43')]['ids']);}})[_0xb747('0x38')](respondWithStatusCode(_0x448e2e,null))[_0xb747('0x2b')](handleError(_0x448e2e,null));};exports[_0xb747('0x68')]=function(_0x2eb632,_0x364549,_0x2e0332){if(_0x2eb632[_0xb747('0x5f')]['id']){delete _0x2eb632[_0xb747('0x5f')]['id'];}return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x2eb632['params']['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x364549,null))[_0xb747('0x38')](function(_0x50a2fb){if(_0x50a2fb){_0x2eb632['body'][_0xb747('0x65')]=_0x50a2fb['id'];return db[_0xb747('0x69')][_0xb747('0x5e')](_0x2eb632[_0xb747('0x5f')]);}})['then'](respondWithResult(_0x364549,null))[_0xb747('0x2b')](handleError(_0x364549,null));};exports['getAnswers']=function(_0x35fab0,_0x2ae360,_0x174537){var _0x7bde7c={'raw':![],'where':{}};var _0x3ce48a={};var _0x2c282f={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x35fab0[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x2ae360,null))[_0xb747('0x38')](function(_0x427f5f){if(_0x427f5f){_0x3ce48a[_0xb747('0x46')]=_['keys'](db['CannedAnswer'][_0xb747('0x3f')]);_0x3ce48a['query']=_[_0xb747('0x5c')](_0x35fab0[_0xb747('0x43')]);_0x3ce48a['filters']=_[_0xb747('0x45')](_0x3ce48a['model'],_0x3ce48a[_0xb747('0x43')]);_0x7bde7c['attributes']=_['intersection'](_0x3ce48a[_0xb747('0x46')],qs['fields'](_0x35fab0[_0xb747('0x43')][_0xb747('0x48')]));_0x7bde7c[_0xb747('0x47')]=_0x7bde7c[_0xb747('0x47')]['length']?_0x7bde7c['attributes']:_0x3ce48a[_0xb747('0x46')];if(!_0x35fab0[_0xb747('0x43')][_0xb747('0x4a')](_0xb747('0x4b'))){_0x7bde7c[_0xb747('0x32')]=qs[_0xb747('0x32')](_0x35fab0[_0xb747('0x43')]['limit']);_0x7bde7c['offset']=qs[_0xb747('0x31')](_0x35fab0[_0xb747('0x43')][_0xb747('0x31')]);}_0x7bde7c[_0xb747('0x4c')]=qs['sort'](_0x35fab0['query'][_0xb747('0x4d')]);_0x7bde7c['where']=qs[_0xb747('0x44')](_[_0xb747('0x4e')](_0x35fab0['query'],_0x3ce48a[_0xb747('0x44')]));_0x7bde7c[_0xb747('0x50')]['ChatWebsiteId']=_0x427f5f['id'];if(_0x35fab0[_0xb747('0x43')][_0xb747('0x4f')]){_0x7bde7c[_0xb747('0x50')]=_['merge'](_0x7bde7c[_0xb747('0x50')],{'$or':_['map'](_0x7bde7c[_0xb747('0x47')],function(_0x49f5f6){var _0x527646={};_0x527646[_0x49f5f6]={'$like':'%'+_0x35fab0[_0xb747('0x43')]['filter']+'%'};return _0x527646;})});}_0x7bde7c=_[_0xb747('0x51')]({},_0x7bde7c,_0x35fab0[_0xb747('0x53')]);return db[_0xb747('0x69')][_0xb747('0x30')]({'where':_0x7bde7c['where']})[_0xb747('0x38')](function(_0xdfd839){_0x2c282f[_0xb747('0x30')]=_0xdfd839;if(_0x35fab0[_0xb747('0x43')][_0xb747('0x54')]){_0x7bde7c[_0xb747('0x55')]=[{'all':!![]}];}return db[_0xb747('0x69')][_0xb747('0x57')](_0x7bde7c);})[_0xb747('0x38')](function(_0x45386d){_0x2c282f[_0xb747('0x58')]=_0x45386d;return _0x2c282f;});}})[_0xb747('0x38')](respondWithFilteredResult(_0x2ae360,_0x7bde7c))[_0xb747('0x2b')](handleError(_0x2ae360,null));};exports[_0xb747('0x6a')]=function(_0x55c5a2,_0x8017f8,_0x479e42){return db[_0xb747('0x56')]['find']({'where':{'id':_0x55c5a2[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x8017f8,null))[_0xb747('0x38')](function(_0x37f5ba){if(_0x37f5ba){return _0x37f5ba['removeAnswers'](_0x55c5a2['query'][_0xb747('0x6b')]);}})[_0xb747('0x38')](respondWithStatusCode(_0x8017f8,null))[_0xb747('0x2b')](handleError(_0x8017f8,null));};exports[_0xb747('0x6c')]=function(_0x31b184,_0x36762a,_0x135bea){_0x31b184[_0xb747('0x5f')]['sitepic']=_0x31b184[_0xb747('0x6d')][_0xb747('0x6e')];return db[_0xb747('0x56')]['find']({'where':{'id':_0x31b184[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x36762a,null))[_0xb747('0x38')](saveUpdates(_0x31b184[_0xb747('0x5f')],null))[_0xb747('0x38')](respondWithResult(_0x36762a,null))['catch'](handleError(_0x36762a,null));};exports['addAvatar']=function(_0x2f652c,_0x5c23c4,_0x937975){_0x2f652c[_0xb747('0x5f')]['agentAvatar']=_0x2f652c['file'][_0xb747('0x6e')];return db[_0xb747('0x56')]['find']({'where':{'id':_0x2f652c[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x5c23c4,null))['then'](saveUpdates(_0x2f652c[_0xb747('0x5f')],null))[_0xb747('0x38')](respondWithResult(_0x5c23c4,null))[_0xb747('0x2b')](handleError(_0x5c23c4,null));};exports[_0xb747('0x6f')]=function(_0x2ce9f,_0x2a39b8,_0x1a94bc){_0x2ce9f[_0xb747('0x5f')][_0xb747('0x70')]=_0x2ce9f[_0xb747('0x6d')]['filename'];return db['ChatWebsite'][_0xb747('0x5d')]({'where':{'id':_0x2ce9f[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a39b8,null))[_0xb747('0x38')](saveUpdates(_0x2ce9f[_0xb747('0x5f')],null))[_0xb747('0x38')](respondWithResult(_0x2a39b8,null))['catch'](handleError(_0x2a39b8,null));};exports[_0xb747('0x71')]=function(_0x522cad,_0xc8315b,_0xa3d3f5){_0x522cad[_0xb747('0x5f')][_0xb747('0x72')]=_0x522cad['file'][_0xb747('0x6e')];return db[_0xb747('0x56')]['find']({'where':{'id':_0x522cad[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0xc8315b,null))['then'](saveUpdates(_0x522cad[_0xb747('0x5f')],null))['then'](respondWithResult(_0xc8315b,null))['catch'](handleError(_0xc8315b,null));};exports[_0xb747('0x73')]=function(_0x27f299,_0x2d5480,_0x432231){var _0x56708d=path['join'](config[_0xb747('0x74')],_0xb747('0x75'));var _0xad6a5d={'where':{'id':_0x27f299[_0xb747('0x5a')]['id']},'attributes':['id',_0xb747('0x76')],'raw':!![]};var _0xf588fa=![];return require(_0xb747('0x77'))[_0xb747('0x78')]()[_0xb747('0x38')](function(_0x205a7a){if(_0x205a7a){_0xf588fa=_0x205a7a[_0xb747('0x79')];}})[_0xb747('0x38')](function(){return db[_0xb747('0x56')][_0xb747('0x5d')](_0xad6a5d);})[_0xb747('0x38')](handleEntityNotFound(_0x2d5480,null))['then'](function(_0x29520d){if(_0x29520d){if(!_[_0xb747('0x7a')](_0x29520d[_0xb747('0x76')])){if(fs[_0xb747('0x7b')](path['join'](config['root'],_0xb747('0x7c'),_0x29520d['sitepic']))&&_0xf588fa){_0x56708d=path[_0xb747('0x7d')](config['root'],'server/files/images/logos/',_0x29520d[_0xb747('0x76')]);}}return _0x2d5480['download'](_0x56708d);}})[_0xb747('0x2b')](handleError(_0x2d5480,null));};exports[_0xb747('0x7e')]=function(_0x4c8f97,_0x1106a5,_0x15fc0e){var _0xdabe05=path[_0xb747('0x7d')](config['root'],_0xb747('0x7f'));var _0x883ed3={'where':{'id':_0x4c8f97[_0xb747('0x5a')]['id']},'attributes':['id',_0xb747('0x80')],'raw':!![]};return db[_0xb747('0x56')][_0xb747('0x5d')](_0x883ed3)[_0xb747('0x38')](handleEntityNotFound(_0x1106a5,null))[_0xb747('0x38')](function(_0x409d3e){if(_0x409d3e){if(!_[_0xb747('0x7a')](_0x409d3e['agentAvatar'])){if(fs[_0xb747('0x7b')](path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x81'),_0x409d3e[_0xb747('0x80')]))){_0xdabe05=path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x81'),_0x409d3e['agentAvatar']);}}return _0x1106a5[_0xb747('0x82')](_0xdabe05);}})[_0xb747('0x2b')](handleError(_0x1106a5,null));};exports[_0xb747('0x83')]=function(_0x173ad2,_0x5f1e16,_0x9ddd5e){var _0x1892c1=path[_0xb747('0x7d')](config['root'],_0xb747('0x84'));var _0xe48b3c={'where':{'id':_0x173ad2[_0xb747('0x5a')]['id']},'attributes':['id','customerAvatar',_0xb747('0x85')],'raw':!![]};return db['ChatWebsite'][_0xb747('0x5d')](_0xe48b3c)['then'](handleEntityNotFound(_0x5f1e16,null))['then'](function(_0x5cab69){if(_0x5cab69){if(!_[_0xb747('0x7a')](_0x5cab69[_0xb747('0x70')])){if(fs['existsSync'](path[_0xb747('0x7d')](config['root'],_0xb747('0x81'),_0x5cab69[_0xb747('0x70')]))&&_0x5cab69[_0xb747('0x85')]){_0x1892c1=path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x81'),_0x5cab69[_0xb747('0x70')]);}}return _0x5f1e16[_0xb747('0x82')](_0x1892c1);}})[_0xb747('0x2b')](handleError(_0x5f1e16,null));};exports[_0xb747('0x86')]=function(_0x18cdf2,_0x55bc52,_0x904a71){var _0xd5757d=path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x87'));var _0x303fb0={'where':{'id':_0x18cdf2[_0xb747('0x5a')]['id']},'attributes':['id',_0xb747('0x72')],'raw':!![]};return db[_0xb747('0x56')]['find'](_0x303fb0)['then'](handleEntityNotFound(_0x55bc52,null))[_0xb747('0x38')](function(_0x1013d1){if(_0x1013d1){if(!_['isNil'](_0x1013d1[_0xb747('0x72')])){if(fs[_0xb747('0x7b')](path[_0xb747('0x7d')](config[_0xb747('0x74')],'server/files/images/avatars/',_0x1013d1[_0xb747('0x72')]))){_0xd5757d=path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x81'),_0x1013d1[_0xb747('0x72')]);}}return _0x55bc52[_0xb747('0x82')](_0xd5757d);}})[_0xb747('0x2b')](handleError(_0x55bc52,null));};exports[_0xb747('0x88')]=function(_0x450b24,_0x1daf30,_0xb82728){var _0x45f459=require(_0xb747('0x89'));var _0x4e40f9=new _0x45f459();var _0x4eabf4=_0x4e40f9[_0xb747('0x8a')](_0x450b24[_0xb747('0x8b')][_0xb747('0x8c')])[_0xb747('0x8d')]();var _0xd3beae={'body':_0x450b24['body'],'channel':_0xb747('0x8e')};var _0x3d9b38=[];var _0x4c9ef2=[];var _0x512586={};var _0x53291d=![];return db['CmContact']['describe']()[_0xb747('0x38')](function(_0x19e192){if(!_0x19e192){throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x8f'));}_0x3d9b38=_[_0xb747('0x90')](_[_0xb747('0x5c')](_0x19e192),[_0xb747('0x91'),_0xb747('0x92')]);_0x4c9ef2=_['difference'](_[_0xb747('0x5c')](_0x19e192),[_0xb747('0x91'),_0xb747('0x92'),_0xb747('0x93'),_0xb747('0x94')]);if(_0x450b24[_0xb747('0x5f')]['id']){delete _0x450b24[_0xb747('0x5f')]['id'];}if(_[_0xb747('0x7a')](_0x450b24['body']['from'])){throw new db['Sequelize'][(_0xb747('0x20'))](_0xb747('0x95'));}if(_[_0xb747('0x7a')](_0x450b24['body']['body'])||_0x450b24['body'][_0xb747('0x5f')]===''){throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x96'));}if(_[_0xb747('0x7a')](_0x450b24[_0xb747('0x5f')][_0xb747('0x97')])){throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x98')+_0x4c9ef2);}if(!_[_0xb747('0x99')](_0x4c9ef2,_0x450b24[_0xb747('0x5f')][_0xb747('0x97')])){throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c9ef2);}_0x512586[_0x450b24[_0xb747('0x5f')][_0xb747('0x97')]]=_0x450b24[_0xb747('0x5f')][_0xb747('0x9a')];})[_0xb747('0x38')](function(){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x450b24[_0xb747('0x5a')]['id']},'include':[{'model':db[_0xb747('0x9b')],'as':_0xb747('0x9c'),'include':[{'model':db[_0xb747('0x9d')],'as':_0xb747('0x9e'),'where':_0x512586,'limit':0x1,'order':[[_0xb747('0x92'),_0xb747('0x9f')]]}]},{'model':db['ChatApplication'],'as':_0xb747('0xa0')}]});})[_0xb747('0x38')](handleEntityNotFound(_0x1daf30,null))[_0xb747('0x38')](function(_0x12eeb){if(_0x12eeb&&_0x12eeb[_0xb747('0x9c')]){_0xd3beae['account']=_0x12eeb;_0xd3beae['applications']=_0x12eeb[_0xb747('0xa0')];_0xd3beae[_0xb747('0xa1')]=_0x12eeb[_0xb747('0x9c')];_0xd3beae['applications']=_[_0xb747('0xa2')](_0xd3beae[_0xb747('0xa3')],[_0xb747('0xa4')],[_0xb747('0xa5')]);if(_0xd3beae[_0xb747('0xa6')][_0xb747('0xa0')]){delete _0xd3beae[_0xb747('0xa6')][_0xb747('0xa0')];}if(_0xd3beae['account']['List']&&_0xd3beae[_0xb747('0xa6')][_0xb747('0x9c')][_0xb747('0x9e')][_0xb747('0x49')]){return _0xd3beae[_0xb747('0xa6')][_0xb747('0x9c')][_0xb747('0x9e')][0x0];}var _0x59329f=_[_0xb747('0x18')](_0x450b24['body'],{'firstName':_0x450b24[_0xb747('0x5f')][_0xb747('0x9a')],'ListId':_0x12eeb[_0xb747('0x94')]});_0x59329f[_0x450b24[_0xb747('0x5f')]['mapKey']]=_0x450b24[_0xb747('0x5f')][_0xb747('0x9a')];return db['CmContact'][_0xb747('0x5e')](_0x59329f,{'fields':_0x3d9b38,'raw':!![]});}})['then'](handleEntityNotFound(_0x1daf30,null))[_0xb747('0x38')](function(_0x450c60){_0xd3beae[_0xb747('0xa7')]=_0x450c60;var _0x26a421=_0x450b24[_0xb747('0x5f')][_0xb747('0xa8')];if(_0x450b24['headers'][_0xb747('0xa9')]){_0x26a421=_0x450b24[_0xb747('0x8b')][_0xb747('0xa9')];}else if(_0x450b24[_0xb747('0x8b')]['x-forwarded-for']){_0x26a421=_[_0xb747('0xaa')](_0x450b24[_0xb747('0x8b')][_0xb747('0xab')][_0xb747('0xac')](','));}if(_0x450c60){var _0x25ed8b={'ContactId':_0x450c60['id'],'ChatWebsiteId':_0x450b24[_0xb747('0x5a')]['id'],'from':(_0x450c60[_0xb747('0xad')]||'')+'\x20'+(_0x450c60[_0xb747('0xae')]||''),'customerIp':_0x26a421,'customerPort':_0x450b24[_0xb747('0x8b')][_0xb747('0xaf')]?_0x450b24[_0xb747('0x8b')]['x-real-port']:null,'referer':_0x450b24[_0xb747('0x5f')]['referer'],'browserName':_0x4eabf4['browser']['name']&&_0x4eabf4[_0xb747('0xb0')][_0xb747('0xb1')]?util[_0xb747('0xb2')](_0xb747('0xb3'),_0x4eabf4['browser'][_0xb747('0x3c')],_0x4eabf4[_0xb747('0xb0')][_0xb747('0xb1')]):_0xb747('0xb4'),'browserVersion':_0x4eabf4[_0xb747('0xb0')][_0xb747('0xb1')]||_0xb747('0xb4'),'osName':util[_0xb747('0xb2')](_0xb747('0xb3'),_0x4eabf4['os'][_0xb747('0x3c')],_0x4eabf4['os'][_0xb747('0xb1')]),'osVersion':_0x4eabf4['os'][_0xb747('0xb1')],'deviceModel':_0x4eabf4['device']['model']&&_0x4eabf4[_0xb747('0xb5')]['vendor']?util[_0xb747('0xb2')](_0xb747('0xb6'),_0x4eabf4[_0xb747('0xb5')][_0xb747('0x46')],_0x4eabf4[_0xb747('0xb5')][_0xb747('0xb7')],_0x4eabf4[_0xb747('0xb5')][_0xb747('0x40')]):null,'deviceVendor':_0x4eabf4[_0xb747('0xb5')][_0xb747('0xb7')],'deviceType':_0x4eabf4['device'][_0xb747('0x40')],'formData':JSON[_0xb747('0xb8')](_0x450b24[_0xb747('0x5f')])};var _0x127c65={'ChatWebsiteId':_0x450b24[_0xb747('0x5a')]['id'],'closed':![]};if(_0x450b24['body']['threadId']){_0x127c65[_0xb747('0xb9')]=_0x450b24[_0xb747('0x5f')][_0xb747('0xb9')];return db[_0xb747('0xba')]['find']({'where':_0x127c65})[_0xb747('0x38')](function(_0x2df8d6){if(_0x2df8d6){return[_0x2df8d6,![]];}_0x25ed8b[_0xb747('0xb9')]=_0x450b24[_0xb747('0x5f')]['threadId'];_0x25ed8b[_0xb747('0xbb')]=_0x450b24[_0xb747('0x5f')]['externalUrl'];return db[_0xb747('0xba')][_0xb747('0x5e')](_0x25ed8b)[_0xb747('0x38')](function(_0x3d5df4){return[_0x3d5df4,!![]];});});}_0x127c65[_0xb747('0xbc')]=_0x450c60['id'];if(_0x450b24['body'][_0xb747('0xbd')]&&_0x450b24['body']['interaction']['id']){_0x127c65['id']=_0x450b24[_0xb747('0x5f')][_0xb747('0xbd')]['id'];return db[_0xb747('0xba')][_0xb747('0x5d')]({'where':_0x127c65})['then'](function(_0x24684f){if(_0x24684f){return[_0x24684f,![]];}return db['ChatInteraction']['create'](_0x25ed8b)[_0xb747('0x38')](function(_0x40c5c2){return[_0x40c5c2,!![]];});});}return db[_0xb747('0xba')][_0xb747('0x5e')](_0x25ed8b)[_0xb747('0x38')](function(_0xa5abcb){return[_0xa5abcb,!![]];});}})[_0xb747('0xbe')](function(_0x4a149b,_0x28959d){if(_0x4a149b){_0x53291d=_0x28959d;if(!_0x28959d){var _0x4951f3={'from':(_0xd3beae[_0xb747('0xa7')][_0xb747('0xad')]||'')+'\x20'+(_0xd3beae[_0xb747('0xa7')]['lastName']||'')};if(_0x450b24['body']['threadId']&&_0x450b24[_0xb747('0x5f')]['messageId']&&_0x450b24['body'][_0xb747('0xb9')]!=_0x450b24['body'][_0xb747('0xbf')]){_0x4951f3['threadId']=_0x450b24[_0xb747('0x5f')][_0xb747('0xbf')];}return _0x4a149b[_0xb747('0x63')](_0x4951f3);}else{return _0x4a149b;}}})[_0xb747('0x38')](function(_0x1d2a56){_0xd3beae[_0xb747('0xbd')]=_0x1d2a56[_0xb747('0x39')]({'plain':!![]});_0xd3beae[_0xb747('0xbd')]['created']=_0x53291d;if(_0xd3beae[_0xb747('0xbd')][_0xb747('0xc0')]){if(_0xd3beae[_0xb747('0xa6')][_0xb747('0xc1')]){_0xd3beae[_0xb747('0xa3')][_0xb747('0xc2')]({'id':0x0,'priority':_0xd3beae[_0xb747('0xa3')][_0xb747('0x49')]+0x1,'app':_0xb747('0xc3'),'appdata':_0xb747('0xc4'),'interval':'*,*,*,*'});}}return db[_0xb747('0xc5')][_0xb747('0x5e')]({'body':_0x450b24[_0xb747('0x5f')][_0xb747('0x5f')],'ChatWebsiteId':_0x450b24[_0xb747('0x5a')]['id'],'ChatInteractionId':_0x1d2a56['id'],'direction':'in','ContactId':_0xd3beae[_0xb747('0xa7')]['id'],'AttachmentId':_0x450b24[_0xb747('0x5f')][_0xb747('0xc6')]});})[_0xb747('0x38')](function(_0x3bdb7e){_0xd3beae['message']=_0x3bdb7e;if(_0xd3beae[_0xb747('0xbd')][_0xb747('0xc7')]){return db['User'][_0xb747('0x5d')]({'attributes':['id','name'],'where':{'id':_0xd3beae['interaction']['UserId']}})[_0xb747('0x38')](function(_0xa17f7d){if(_0xa17f7d){_0xd3beae[_0xb747('0xa3')][_0xb747('0xc8')]({'id':0x0,'priority':0x0,'app':_0xb747('0xc9'),'appdata':_0xa17f7d[_0xb747('0x3c')]+','+(_0xd3beae[_0xb747('0xa6')][_0xb747('0xca')]||0xa),'interval':_0xb747('0xcb')});_0xd3beae[_0xb747('0xcc')]=!![];}return respondWithRpcPromise(_0xb747('0xcd'),'startRouting',_0xd3beae);});}return respondWithRpcPromise('Start','startRouting',_0xd3beae);})['then'](function(_0x484175){respondWithRpcPromise(_0xb747('0xce'),'EventManager',{'event':_0xb747('0x88'),'message':_0x484175},client9002);return _0x484175;})['then'](respondWithResult(_0x1daf30,null))[_0xb747('0x2b')](handleError(_0x1daf30,null));};exports['offline']=function(_0xfb1ea5,_0x5168dd,_0x499f8d){var _0x2931c7,_0x20b5ac,_0x4390d8;var _0x48a55d=[];var _0x1b6938=[];var _0x4d3cc9={};return db[_0xb747('0x9d')]['describe']()['then'](function(_0x4133f2){if(!_0x4133f2){throw new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x8f'));}_0x1b6938=_['difference'](_['keys'](_0x4133f2),[_0xb747('0x91'),_0xb747('0x92')]);_0x48a55d=_[_0xb747('0x90')](_['keys'](_0x4133f2),['createdAt',_0xb747('0x92'),_0xb747('0x93'),'ListId']);if(_0xfb1ea5[_0xb747('0x5f')]['id']){delete _0xfb1ea5['body']['id'];}if(_[_0xb747('0x7a')](_0xfb1ea5[_0xb747('0x5f')][_0xb747('0x9a')])){throw _0x5168dd['status'](0x1f4)['send'](new db[(_0xb747('0x1f'))]['ValidationError'](_0xb747('0x95')));}if(_[_0xb747('0x7a')](_0xfb1ea5[_0xb747('0x5f')]['body'])||_0xfb1ea5[_0xb747('0x5f')][_0xb747('0x5f')]===''){throw _0x5168dd[_0xb747('0x2d')](0x1f4)[_0xb747('0x3d')](new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0x96')));}if(_[_0xb747('0x7a')](_0xfb1ea5[_0xb747('0x5f')][_0xb747('0xcf')])){throw _0x5168dd[_0xb747('0x2d')](0x1f4)[_0xb747('0x3d')](new db['Sequelize']['ValidationError'](_0xb747('0xd0')+_0x48a55d));}if(!_['includes'](_0x48a55d,_0xfb1ea5['body'][_0xb747('0xcf')])){throw _0x5168dd[_0xb747('0x2d')](0x1f4)[_0xb747('0x3d')](new db[(_0xb747('0x1f'))][(_0xb747('0x20'))](_0xb747('0xd1')+_0x48a55d));}_0x4d3cc9[_0xfb1ea5[_0xb747('0x5f')][_0xb747('0xcf')]]=_0xfb1ea5['body'][_0xb747('0x9a')];})['then'](function(){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0xfb1ea5[_0xb747('0x5a')]['id']},'include':[{'model':db[_0xb747('0x9b')],'as':_0xb747('0x9c')}]});})[_0xb747('0x38')](handleEntityNotFound(_0x5168dd,null))[_0xb747('0x38')](function(_0x3c8672){if(_0x3c8672&&_0x3c8672[_0xb747('0x9c')]){_0x20b5ac=_0x3c8672;var _0x300c9d=_[_0xb747('0x18')](_0xfb1ea5[_0xb747('0x5f')],{'firstName':_0xfb1ea5[_0xb747('0x5f')][_0xb747('0x9a')],'phone':_0xfb1ea5[_0xb747('0x5f')]['from'],'ListId':_0x3c8672[_0xb747('0x94')]});_0x300c9d[_0xfb1ea5['body']['mapKeyOffline']]=_0xfb1ea5[_0xb747('0x5f')][_0xb747('0x9a')];return db[_0xb747('0x9d')][_0xb747('0xd2')]({'where':_0x4d3cc9,'defaults':_0x300c9d});}})[_0xb747('0xbe')](function(_0x4233f3){if(_0x4233f3){_0x4390d8=_0x4233f3;var _0x551f5a=fs[_0xb747('0xd3')](path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0xd4')),'utf8');var _0x4f9229=ejs[_0xb747('0xd5')](_0x551f5a,{'body':_[_0xb747('0xd6')](_0xfb1ea5[_0xb747('0x5f')][_0xb747('0x5f')]),'bodyTitle':_0x20b5ac[_0xb747('0xd7')]});return db[_0xb747('0xd8')]['create']({'body':_0x4f9229,'ContactId':_0x4233f3['id'],'ChatWebsiteId':_0x20b5ac['id']});}})['then'](function(_0x21e2c1){if(_0x21e2c1){_0x2931c7=_0x21e2c1;return db[_0xb747('0xd9')][_0xb747('0x66')]({'where':{'service':!![]},'include':[{'model':db[_0xb747('0xda')],'as':_0xb747('0xdb'),'raw':!![]}]});}})[_0xb747('0x38')](function(_0x1ec2d7){if(_0x1ec2d7&&_0x1ec2d7[_0xb747('0xdb')]&&_0x20b5ac[_0xb747('0xdc')]){var _0x13a976={'tls':{'rejectUnauthorized':![]}};if(_0x1ec2d7['Smtp'][_0xb747('0xdd')]){_0x13a976['service']=_0x1ec2d7['Smtp'][_0xb747('0xdd')];}else{_0x13a976['host']=_0x1ec2d7['Smtp'][_0xb747('0xde')];_0x13a976[_0xb747('0xdf')]=_0x1ec2d7[_0xb747('0xdb')][_0xb747('0xdf')];_0x13a976['secure']=_0x1ec2d7['Smtp']['secure'];}if(_0x1ec2d7['Smtp'][_0xb747('0xe0')]){_0x13a976[_0xb747('0xe1')]={'user':_0x1ec2d7[_0xb747('0xdb')]['user'],'pass':_0x1ec2d7[_0xb747('0xdb')]['pass']};}return respondWithRpcPromise('SendMail',_0xb747('0xe2'),{'account':_0x13a976,'message':{'from':util[_0xb747('0xb2')](_0xb747('0xe3'),_0x1ec2d7[_0xb747('0x3c')],_0x1ec2d7[_0xb747('0xe4')]||_0x1ec2d7[_0xb747('0xdb')][_0xb747('0x60')]),'to':_0x20b5ac[_0xb747('0xdc')],'subject':_0x20b5ac['offlineMessageSubject'],'text':_0x2931c7[_0xb747('0x5f')]}},client9003)[_0xb747('0x38')](function(){return _0x2931c7;})[_0xb747('0x2b')](function(_0x23f741){console[_0xb747('0x28')](_0x23f741);});}})[_0xb747('0x38')](function(){if(_0x2931c7){return _0x2931c7;}})[_0xb747('0x38')](respondWithResult(_0x5168dd,null))[_0xb747('0x2b')](handleError(_0x5168dd,null));};exports[_0xb747('0xe5')]=function(_0x437b56,_0x4598b2,_0x5a61d3){return db[_0xb747('0xba')][_0xb747('0x5d')]({'where':{'id':_0x437b56[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x4598b2,null))[_0xb747('0x38')](function(_0x46ebab){if(_0x46ebab){return _0x46ebab[_0xb747('0xe5')](_0x437b56[_0xb747('0x5f')][_0xb747('0x6b')],_[_0xb747('0xe6')](_0x437b56['body'],['ids','id'])||{});}})[_0xb747('0x38')](respondWithResult(_0x4598b2,null))['catch'](handleError(_0x4598b2,null));};exports[_0xb747('0xe7')]=function(_0x288bf5,_0x15615b,_0x23f64c){var _0x5347a9={'raw':![],'where':{}};var _0x5eee04={};var _0x14277a={'count':0x0,'rows':[]};return db[_0xb747('0x56')]['findOne']({'where':{'id':_0x288bf5[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15615b,null))['then'](function(_0x33cec0){if(_0x33cec0){_0x5eee04[_0xb747('0x46')]=_[_0xb747('0x5c')](db[_0xb747('0xba')][_0xb747('0x3f')]);_0x5eee04[_0xb747('0x43')]=_[_0xb747('0x5c')](_0x288bf5[_0xb747('0x43')]);_0x5eee04['filters']=_[_0xb747('0x45')](_0x5eee04[_0xb747('0x46')],_0x5eee04[_0xb747('0x43')]);_0x5347a9[_0xb747('0x47')]=_[_0xb747('0x45')](_0x5eee04['model'],qs[_0xb747('0x48')](_0x288bf5[_0xb747('0x43')]['fields']));_0x5347a9[_0xb747('0x47')]=_0x5347a9[_0xb747('0x47')][_0xb747('0x49')]?_0x5347a9[_0xb747('0x47')]:_0x5eee04['model'];if(!_0x288bf5['query'][_0xb747('0x4a')](_0xb747('0x4b'))){_0x5347a9[_0xb747('0x32')]=qs['limit'](_0x288bf5[_0xb747('0x43')][_0xb747('0x32')]);_0x5347a9[_0xb747('0x31')]=qs[_0xb747('0x31')](_0x288bf5[_0xb747('0x43')][_0xb747('0x31')]);}_0x5347a9[_0xb747('0x4c')]=qs['sort'](_0x288bf5[_0xb747('0x43')][_0xb747('0x4d')]);_0x5347a9[_0xb747('0x50')]=qs['filters'](_[_0xb747('0x4e')](_0x288bf5[_0xb747('0x43')],_0x5eee04[_0xb747('0x44')]));_0x5347a9['where'][_0xb747('0x65')]=_0x33cec0['id'];if(_0x288bf5[_0xb747('0x43')][_0xb747('0x4f')]){_0x5347a9[_0xb747('0x50')]=_[_0xb747('0x51')](_0x5347a9[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x5347a9[_0xb747('0x47')],function(_0x4782e2){var _0x4f56da={};_0x4f56da[_0x4782e2]={'$like':'%'+_0x288bf5['query'][_0xb747('0x4f')]+'%'};return _0x4f56da;})});}_0x5347a9=_[_0xb747('0x51')]({},_0x5347a9,_0x288bf5['options']);return db['ChatInteraction']['count']({'where':_0x5347a9['where']})[_0xb747('0x38')](function(_0x3fcbdb){_0x14277a[_0xb747('0x30')]=_0x3fcbdb;if(_0x288bf5[_0xb747('0x43')][_0xb747('0x54')]){_0x5347a9[_0xb747('0x55')]=[{'model':db[_0xb747('0x9d')],'as':'Contact','required':![]},{'model':db[_0xb747('0xe8')],'as':_0xb747('0xe9'),'attributes':[_0xb747('0x3c'),_0xb747('0xea'),_0xb747('0xeb')],'required':![]},{'model':db['Tag'],'as':_0xb747('0xec'),'attributes':['id',_0xb747('0x3c'),_0xb747('0xed')],'where':_0x288bf5[_0xb747('0x43')][_0xb747('0xee')]?{'id':_0x288bf5[_0xb747('0x43')][_0xb747('0xee')]}:undefined,'required':_0x288bf5[_0xb747('0x43')]['tag']?!![]:![]}];}return db[_0xb747('0xba')]['findAll'](_0x5347a9);})['then'](function(_0xb3417a){_0x14277a[_0xb747('0x58')]=_0xb3417a;return _0x14277a;});}})[_0xb747('0x38')](respondWithFilteredResult(_0x15615b,_0x5347a9))[_0xb747('0x2b')](handleError(_0x15615b,null));};function iftimePromise(_0x3f45f7,_0x3657df){return respondWithRpcPromise(_0xb747('0xef'),'getSnippet',{'command':_0x3657df[_0xb747('0xf0')]?util['format'](_0xb747('0xf1'),_0x3f45f7[_0xb747('0xf2')],_0x3657df[_0xb747('0xf0')]):util['format'](_0xb747('0xf3'),_0x3f45f7[_0xb747('0xf2')])},client9002)[_0xb747('0x38')](function(_0x40bfd5){var _0x1565f7=_0x40bfd5&&_0x40bfd5[_0xb747('0xf4')](_0xb747('0xf5'))>=0x0?!![]:![];logger['info'](_0xb747('0xf6'),_0x3657df['id'],_0x3f45f7['id'],_0x3f45f7[_0xb747('0xf2')],_0x1565f7?_0xb747('0xf7'):_0xb747('0xf8'),_0x3657df['timezone']?_0x3657df[_0xb747('0xf0')]:_0xb747('0xf9'));return _0x1565f7;})[_0xb747('0x2b')](function(_0x596748){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3657df['id'],_0x3f45f7['id'],_0x3f45f7[_0xb747('0xf2')],util[_0xb747('0xfa')](_0x596748,{'showHidden':![],'depth':null}),_0x3657df[_0xb747('0xf0')]?_0x3657df[_0xb747('0xf0')]:_0xb747('0xf9'));return![];});}exports[_0xb747('0xfb')]=function(_0x2c00d6,_0xf829a4,_0x579b26){var _0x57d17b=0x0;var _0xd8a768=0x0;var _0x57ec46=![];var _0x1863e7;var _0x51709a;return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x2c00d6['params']['id']},'include':[{'model':db[_0xb747('0xfc')],'as':_0xb747('0xfc'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xb747('0xf2')],'raw':!![]}]}]})[_0xb747('0x38')](handleEntityNotFound(_0xf829a4,null))['then'](function(_0x395ffd){if(_0x395ffd){_0x1863e7=_0x395ffd;return _0x395ffd[_0xb747('0xfd')]({'raw':!![]});}})[_0xb747('0x38')](function(_0x327dbf){if(_0x1863e7){if(_0x327dbf){_0x51709a=_0x327dbf;}}return require('../../config/license/util')[_0xb747('0x78')]();})[_0xb747('0x38')](function(_0x5cc1b6){if(_0x5cc1b6){_0xd8a768=_0x5cc1b6[_0xb747('0xfe')];_0x57ec46=_0x5cc1b6[_0xb747('0x79')];}})[_0xb747('0x38')](function(){return db[_0xb747('0xba')][_0xb747('0x30')]({'where':{'closed':![]}});})['then'](function(_0x53206d){_0x57d17b=_0x53206d;if(_0xd8a768&&_0x53206d>_0xd8a768){return db[_0xb747('0xff')][_0xb747('0x66')]({'where':{'id':0x1}})[_0xb747('0x38')](function(_0x3a4daf){if(_0x3a4daf){_0x3a4daf[_0xb747('0x100')](_0xb747('0x101'));}});}})['then'](function(){if(_0x1863e7[_0xb747('0xfc')]&&_0x1863e7[_0xb747('0xfc')][_0xb747('0x102')]){var _0xa5fe78=[];for(var _0x399318=0x0;_0x399318<_0x1863e7[_0xb747('0xfc')][_0xb747('0x102')][_0xb747('0x49')];_0x399318++){var _0x32bc57=_0x1863e7[_0xb747('0xfc')][_0xb747('0x102')][_0x399318][_0xb747('0x39')]({'plain':!![]});_0xa5fe78[_0xb747('0xc2')](iftimePromise(_0x32bc57,_0x1863e7));}return BPromise[_0xb747('0x103')](_0xa5fe78)[_0xb747('0x38')](function(_0x5d0d5e){return _[_0xb747('0x104')](_0x5d0d5e);});}else{return!![];}})[_0xb747('0x38')](function(_0x2aa010){var _0x2b29d2=fs[_0xb747('0xd3')](path[_0xb747('0x7d')](config[_0xb747('0x74')],_0xb747('0x105')),_0xb747('0x106'));var _0x2fe17e={'remote':_0x1863e7[_0xb747('0x107')],'query':querystring[_0xb747('0xb8')](_[_0xb747('0x51')](_0x1863e7['get']({'plain':!![]}),{'customerIp':_0x2c00d6[_0xb747('0x8b')]['x-forwarded-for']||_0x2c00d6['headers'][_0xb747('0x108')]||_0x2c00d6['connection'][_0xb747('0x109')]||_0x2c00d6['ip'],'referer':_0x2c00d6['headers'][_0xb747('0x10a')],'openedInteractions':_0x57d17b,'maxInteractions':_0xd8a768,'virtual':_0x57ec46['virtual'],'online':_0x2aa010,'custom':_0x57ec46}))[_0xb747('0x10b')](/'/g,'\x5c\x27')};_0xf829a4[_0xb747('0x3d')](ejs[_0xb747('0xd5')](Mustache[_0xb747('0xd5')](_0x2b29d2,_0x2fe17e),{'proactiveActions':_0x51709a,'alignment':_0x1863e7['alignment'],'verticalAlignment':_0x1863e7[_0xb747('0x10c')],'div_color':_0x1863e7['color'],'text_color':_0x1863e7[_0xb747('0x10d')]}));})[_0xb747('0x2b')](handleError(_0xf829a4,null));};exports[_0xb747('0x10e')]=function(_0x48e9b6,_0x1af454,_0x4c0daf){return db[_0xb747('0x56')]['findOne']({'where':{'id':_0x48e9b6[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x1af454,null))[_0xb747('0x38')](function(_0x5e5890){if(_0x5e5890){return db['sequelize']['transaction'](function(_0x58a90e){return db[_0xb747('0x10f')][_0xb747('0x37')]({'where':{'ChatWebsiteId':_0x48e9b6[_0xb747('0x5a')]['id']},'transaction':_0x58a90e})[_0xb747('0x38')](function(_0x173fe5){var _0x201d2d=_[_0xb747('0x42')](_0x48e9b6[_0xb747('0x5f')],function(_0x4d2740){_0x4d2740['ChatWebsiteId']=_0x48e9b6[_0xb747('0x5a')]['id'];return _0x4d2740;});return db[_0xb747('0x10f')]['bulkCreate'](_0x201d2d,{'transaction':_0x58a90e});});})[_0xb747('0x38')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x48e9b6[_0xb747('0x5a')]['id']},'order':_0xb747('0xa4')});});}})[_0xb747('0x38')](respondWithResult(_0x1af454,null))[_0xb747('0x2b')](handleError(_0x1af454,null));};exports[_0xb747('0x110')]=function(_0x1eb665,_0x2e8fbc,_0x249c3b){var _0x4a55c9={};var _0x48b30e={};var _0x5165ac;var _0x52b556;return db[_0xb747('0x56')]['findOne']({'where':{'id':_0x1eb665['params']['id']}})['then'](handleEntityNotFound(_0x2e8fbc,null))[_0xb747('0x38')](function(_0x4f9d57){if(_0x4f9d57){_0x5165ac=_0x4f9d57;_0x48b30e[_0xb747('0x46')]=_[_0xb747('0x5c')](db['ChatApplication'][_0xb747('0x3f')]);_0x48b30e['query']=_[_0xb747('0x5c')](_0x1eb665[_0xb747('0x43')]);_0x48b30e[_0xb747('0x44')]=_[_0xb747('0x45')](_0x48b30e['model'],_0x48b30e['query']);_0x4a55c9[_0xb747('0x47')]=_[_0xb747('0x45')](_0x48b30e[_0xb747('0x46')],qs[_0xb747('0x48')](_0x1eb665[_0xb747('0x43')][_0xb747('0x48')]));_0x4a55c9[_0xb747('0x47')]=_0x4a55c9[_0xb747('0x47')]['length']?_0x4a55c9['attributes']:_0x48b30e[_0xb747('0x46')];_0x4a55c9['order']=qs[_0xb747('0x4d')](_0x1eb665[_0xb747('0x43')]['sort']);_0x4a55c9[_0xb747('0x50')]=qs[_0xb747('0x44')](_['pick'](_0x1eb665[_0xb747('0x43')],_0x48b30e[_0xb747('0x44')]));if(_0x1eb665[_0xb747('0x43')]['filter']){_0x4a55c9['where']=_[_0xb747('0x51')](_0x4a55c9[_0xb747('0x50')],{'$or':_['map'](_0x4a55c9[_0xb747('0x47')],function(_0x593c35){var _0x837dae={};_0x837dae[_0x593c35]={'$like':'%'+_0x1eb665[_0xb747('0x43')][_0xb747('0x4f')]+'%'};return _0x837dae;})});}_0x4a55c9=_[_0xb747('0x51')]({},_0x4a55c9,_0x1eb665[_0xb747('0x53')]);return _0x5165ac['getApplications'](_0x4a55c9);}})[_0xb747('0x38')](function(_0x2601b6){if(_0x2601b6){_0x52b556=_0x2601b6[_0xb747('0x49')];if(!_0x1eb665[_0xb747('0x43')][_0xb747('0x4a')]('nolimit')){_0x4a55c9[_0xb747('0x32')]=qs['limit'](_0x1eb665[_0xb747('0x43')][_0xb747('0x32')]);_0x4a55c9[_0xb747('0x31')]=qs[_0xb747('0x31')](_0x1eb665['query'][_0xb747('0x31')]);}return _0x5165ac[_0xb747('0x110')](_0x4a55c9);}})[_0xb747('0x38')](function(_0x552e46){if(_0x552e46){return _0x552e46?{'count':_0x52b556,'rows':_0x552e46}:null;}})[_0xb747('0x38')](respondWithResult(_0x2e8fbc,null))[_0xb747('0x2b')](handleError(_0x2e8fbc,null));};exports[_0xb747('0x111')]=function(_0x55ec,_0x16e0ce,_0x2c00f8){return db[_0xb747('0x112')][_0xb747('0x5d')]({'where':{'id':_0x55ec['params']['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x16e0ce,null))[_0xb747('0x38')](function(_0x21092c){if(_0x21092c){return _0x21092c[_0xb747('0x111')](_0x55ec['body'][_0xb747('0x6b')],_[_0xb747('0xe6')](_0x55ec[_0xb747('0x5f')],['ids','id'])||{});}})[_0xb747('0x38')](respondWithResult(_0x16e0ce,null))[_0xb747('0x2b')](handleError(_0x16e0ce,null));};exports[_0xb747('0xfd')]=function(_0x39a4c9,_0x4e7dca,_0x26a2c5){var _0x14ecc7={};var _0x3a6a36={};var _0x299c98;var _0x26024c;return db[_0xb747('0x56')][_0xb747('0x66')]({'where':{'id':_0x39a4c9[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x4e7dca,null))[_0xb747('0x38')](function(_0x25b206){if(_0x25b206){_0x299c98=_0x25b206;_0x3a6a36['model']=_[_0xb747('0x5c')](db[_0xb747('0x113')]['rawAttributes']);_0x3a6a36[_0xb747('0x43')]=_[_0xb747('0x5c')](_0x39a4c9[_0xb747('0x43')]);_0x3a6a36[_0xb747('0x44')]=_[_0xb747('0x45')](_0x3a6a36[_0xb747('0x46')],_0x3a6a36[_0xb747('0x43')]);_0x14ecc7[_0xb747('0x47')]=_[_0xb747('0x45')](_0x3a6a36[_0xb747('0x46')],qs[_0xb747('0x48')](_0x39a4c9['query'][_0xb747('0x48')]));_0x14ecc7[_0xb747('0x47')]=_0x14ecc7[_0xb747('0x47')]['length']?_0x14ecc7[_0xb747('0x47')]:_0x3a6a36[_0xb747('0x46')];_0x14ecc7['order']=qs[_0xb747('0x4d')](_0x39a4c9['query'][_0xb747('0x4d')]);_0x14ecc7['where']=qs['filters'](_['pick'](_0x39a4c9[_0xb747('0x43')],_0x3a6a36['filters']));if(_0x39a4c9[_0xb747('0x43')][_0xb747('0x4f')]){_0x14ecc7[_0xb747('0x50')]=_[_0xb747('0x51')](_0x14ecc7[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x14ecc7[_0xb747('0x47')],function(_0x3ed44b){var _0x45bcfb={};_0x45bcfb[_0x3ed44b]={'$like':'%'+_0x39a4c9[_0xb747('0x43')]['filter']+'%'};return _0x45bcfb;})});}_0x14ecc7=_[_0xb747('0x51')]({},_0x14ecc7,_0x39a4c9[_0xb747('0x53')]);return _0x299c98[_0xb747('0xfd')](_0x14ecc7);}})[_0xb747('0x38')](function(_0xd822fc){if(_0xd822fc){_0x26024c=_0xd822fc[_0xb747('0x49')];if(!_0x39a4c9[_0xb747('0x43')][_0xb747('0x4a')](_0xb747('0x4b'))){_0x14ecc7[_0xb747('0x32')]=qs[_0xb747('0x32')](_0x39a4c9['query'][_0xb747('0x32')]);_0x14ecc7[_0xb747('0x31')]=qs[_0xb747('0x31')](_0x39a4c9[_0xb747('0x43')][_0xb747('0x31')]);}return _0x299c98[_0xb747('0xfd')](_0x14ecc7);}})[_0xb747('0x38')](function(_0x2742ed){if(_0x2742ed){return _0x2742ed?{'count':_0x26024c,'rows':_0x2742ed}:null;}})['then'](respondWithResult(_0x4e7dca,null))[_0xb747('0x2b')](handleError(_0x4e7dca,null));};exports[_0xb747('0x114')]=function(_0x5300d3,_0x26aee3,_0x221d84){var _0x28deba=_0x5300d3['query'][_0xb747('0x115')]==='false'?'offlineForm':_0xb747('0x116');return db[_0xb747('0x56')][_0xb747('0x5d')]({'attributes':['id',_0x28deba],'where':{'id':_0x5300d3['params']['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x26aee3,null))[_0xb747('0x38')](function(_0xf754db){if(_0xf754db){var _0x484989=_0xf754db[_0x28deba];var _0x27d52c=_0x484989&&_0x484989[_0xb747('0x117')]?_0x484989[_0xb747('0x117')]:[];_0x26aee3[_0xb747('0x3d')]({'fromKey':_[_0xb747('0x7a')](_0x484989[_0xb747('0x118')])?undefined:_0x484989['fromKey'],'count':_0x27d52c[_0xb747('0x49')],'rows':_0x27d52c});}})[_0xb747('0x2b')](handleError(_0x26aee3,null));};exports[_0xb747('0x119')]=function(_0x363797,_0x2241b7,_0x41038f){var _0x4deaec={'raw':![],'where':{}};var _0x56ded4={};var _0x541be6={'count':0x0,'rows':[]};return db[_0xb747('0x56')][_0xb747('0x66')]({'where':{'id':_0x363797[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x2241b7,null))[_0xb747('0x38')](function(_0x2c2e4b){if(_0x2c2e4b){_0x56ded4[_0xb747('0x46')]=_[_0xb747('0x5c')](db[_0xb747('0xd8')]['rawAttributes']);_0x56ded4[_0xb747('0x43')]=_[_0xb747('0x5c')](_0x363797[_0xb747('0x43')]);_0x56ded4[_0xb747('0x44')]=_['intersection'](_0x56ded4[_0xb747('0x46')],_0x56ded4[_0xb747('0x43')]);_0x4deaec['attributes']=_['intersection'](_0x56ded4['model'],qs['fields'](_0x363797[_0xb747('0x43')][_0xb747('0x48')]));_0x4deaec['attributes']=_0x4deaec[_0xb747('0x47')][_0xb747('0x49')]?_0x4deaec[_0xb747('0x47')]:_0x56ded4[_0xb747('0x46')];if(!_0x363797[_0xb747('0x43')]['hasOwnProperty'](_0xb747('0x4b'))){_0x4deaec[_0xb747('0x32')]=qs[_0xb747('0x32')](_0x363797[_0xb747('0x43')][_0xb747('0x32')]);_0x4deaec[_0xb747('0x31')]=qs['offset'](_0x363797[_0xb747('0x43')][_0xb747('0x31')]);}_0x4deaec[_0xb747('0x4c')]=qs['sort'](_0x363797[_0xb747('0x43')][_0xb747('0x4d')]);_0x4deaec['where']=qs[_0xb747('0x44')](_[_0xb747('0x4e')](_0x363797[_0xb747('0x43')],_0x56ded4[_0xb747('0x44')]));_0x4deaec[_0xb747('0x50')][_0xb747('0x65')]=_0x2c2e4b['id'];if(_0x363797['query'][_0xb747('0x4f')]){_0x4deaec[_0xb747('0x50')]=_[_0xb747('0x51')](_0x4deaec[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x4deaec['attributes'],function(_0x5960a1){var _0xd371e5={};_0xd371e5[_0x5960a1]={'$like':'%'+_0x363797[_0xb747('0x43')][_0xb747('0x4f')]+'%'};return _0xd371e5;})});}_0x4deaec=_['merge']({},_0x4deaec,_0x363797['options']);return db[_0xb747('0xd8')][_0xb747('0x30')]({'where':_0x4deaec[_0xb747('0x50')]})[_0xb747('0x38')](function(_0x3a5e05){_0x541be6['count']=_0x3a5e05;if(_0x363797[_0xb747('0x43')][_0xb747('0x54')]){_0x4deaec['include']=[{'all':!![]}];}else{_0x4deaec['include']=[{'model':db['CmContact'],'as':_0xb747('0x11a'),'required':![]}];}return db[_0xb747('0xd8')][_0xb747('0x57')](_0x4deaec);})[_0xb747('0x38')](function(_0x53e5b6){_0x541be6[_0xb747('0x58')]=_0x53e5b6;return _0x541be6;});}})[_0xb747('0x38')](respondWithFilteredResult(_0x2241b7,_0x4deaec))[_0xb747('0x2b')](handleError(_0x2241b7,null));};exports[_0xb747('0x11b')]=function(_0xdbcadb,_0xe8626f,_0x4db92d){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0xdbcadb[_0xb747('0x5a')]['id']}})['then'](handleEntityNotFound(_0xe8626f,null))[_0xb747('0x38')](function(_0x1ca748){if(_0x1ca748){return _0x1ca748[_0xb747('0x11b')](_0xdbcadb['body'][_0xb747('0x6b')],_['omit'](_0xdbcadb[_0xb747('0x5f')],[_0xb747('0x6b'),'id'])||{})[_0xb747('0xbe')](function(_0x43509c){for(var _0x5394c9=0x0;_0x5394c9<_0xdbcadb['body'][_0xb747('0x6b')][_0xb747('0x49')];_0x5394c9+=0x1){socket['emit'](_0xb747('0x11c'),{'UserId':_0xdbcadb[_0xb747('0x5f')]['ids'][_0x5394c9],'ChatWebsiteId':_0xdbcadb[_0xb747('0x5a')]['id']});}return _0x43509c;});}})[_0xb747('0x38')](respondWithResult(_0xe8626f,null))[_0xb747('0x2b')](handleError(_0xe8626f,null));};exports[_0xb747('0x11d')]=function(_0x1ecbde,_0x7ddaa5,_0x5bb0a0){return db[_0xb747('0x56')][_0xb747('0x5d')]({'where':{'id':_0x1ecbde[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x7ddaa5,null))[_0xb747('0x38')](function(_0xe54c37){if(_0xe54c37){return _0xe54c37[_0xb747('0x11d')](_0x1ecbde[_0xb747('0x43')][_0xb747('0x6b')])[_0xb747('0x38')](function(){if(_[_0xb747('0x11e')](_0x1ecbde[_0xb747('0x43')]['ids'])){for(var _0x2c1982=0x0;_0x2c1982<_0x1ecbde[_0xb747('0x43')][_0xb747('0x6b')][_0xb747('0x49')];_0x2c1982+=0x1){socket[_0xb747('0x11f')](_0xb747('0x120'),{'UserId':Number(_0x1ecbde[_0xb747('0x43')]['ids'][_0x2c1982]),'ChatWebsiteId':Number(_0x1ecbde[_0xb747('0x5a')]['id'])});}}else{socket[_0xb747('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x1ecbde[_0xb747('0x43')][_0xb747('0x6b')]),'ChatWebsiteId':Number(_0x1ecbde[_0xb747('0x5a')]['id'])});}});}})[_0xb747('0x38')](respondWithStatusCode(_0x7ddaa5,null))[_0xb747('0x2b')](handleError(_0x7ddaa5,null));};exports[_0xb747('0x121')]=function(_0x82cb3c,_0x5ce578,_0x32a53e){var _0x186a74={};var _0x4ca230={};var _0x10ea3d;var _0x43d3e1;return db[_0xb747('0x56')][_0xb747('0x66')]({'where':{'id':_0x82cb3c[_0xb747('0x5a')]['id']}})[_0xb747('0x38')](handleEntityNotFound(_0x5ce578,null))[_0xb747('0x38')](function(_0x535924){if(_0x535924){_0x10ea3d=_0x535924;_0x4ca230[_0xb747('0x46')]=_[_0xb747('0x5c')](db['User'][_0xb747('0x3f')]);_0x4ca230[_0xb747('0x43')]=_[_0xb747('0x5c')](_0x82cb3c[_0xb747('0x43')]);_0x4ca230[_0xb747('0x44')]=_[_0xb747('0x45')](_0x4ca230['model'],_0x4ca230['query']);_0x186a74['attributes']=_['intersection'](_0x4ca230[_0xb747('0x46')],qs[_0xb747('0x48')](_0x82cb3c[_0xb747('0x43')][_0xb747('0x48')]));_0x186a74[_0xb747('0x47')]=_0x186a74[_0xb747('0x47')]['length']?_0x186a74[_0xb747('0x47')]:_0x4ca230[_0xb747('0x46')];_0x186a74['order']=qs[_0xb747('0x4d')](_0x82cb3c[_0xb747('0x43')][_0xb747('0x4d')]);_0x186a74[_0xb747('0x50')]=qs['filters'](_[_0xb747('0x4e')](_0x82cb3c[_0xb747('0x43')],_0x4ca230[_0xb747('0x44')]));if(_0x82cb3c['query'][_0xb747('0x4f')]){_0x186a74[_0xb747('0x50')]=_[_0xb747('0x51')](_0x186a74[_0xb747('0x50')],{'$or':_[_0xb747('0x42')](_0x186a74[_0xb747('0x47')],function(_0x12af7f){var _0x2232fe={};_0x2232fe[_0x12af7f]={'$like':'%'+_0x82cb3c[_0xb747('0x43')][_0xb747('0x4f')]+'%'};return _0x2232fe;})});}_0x186a74=_[_0xb747('0x51')]({},_0x186a74,_0x82cb3c[_0xb747('0x53')]);return _0x10ea3d[_0xb747('0x121')](_0x186a74);}})[_0xb747('0x38')](function(_0x1bc52f){if(_0x1bc52f){_0x43d3e1=_0x1bc52f[_0xb747('0x49')];if(!_0x82cb3c['query'][_0xb747('0x4a')](_0xb747('0x4b'))){_0x186a74['limit']=qs['limit'](_0x82cb3c[_0xb747('0x43')][_0xb747('0x32')]);_0x186a74[_0xb747('0x31')]=qs['offset'](_0x82cb3c[_0xb747('0x43')][_0xb747('0x31')]);}return _0x10ea3d['getAgents'](_0x186a74);}})[_0xb747('0x38')](function(_0x492552){if(_0x492552){return _0x492552?{'count':_0x43d3e1,'rows':_0x492552}:null;}})[_0xb747('0x38')](respondWithResult(_0x5ce578,null))[_0xb747('0x2b')](handleError(_0x5ce578,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ea85bb8..535d2bf 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 _0x851e=['hook','exports','events','../../mysqldb','ChatWebsite','update','remove','emit','hasOwnProperty'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x851e,0x1e8));var _0xe851=function(_0x53d934,_0x346ce2){_0x53d934=_0x53d934-0x0;var _0x190dfc=_0x851e[_0x53d934];return _0x190dfc;};'use strict';var EventEmitter=require(_0xe851('0x0'));var ChatWebsite=require(_0xe851('0x1'))['db'][_0xe851('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe851('0x3'),'afterDestroy':_0xe851('0x4')};function emitEvent(_0x16b38a){return function(_0x326b34,_0xe50306,_0x52b67b){ChatWebsiteEvents[_0xe851('0x5')](_0x16b38a+':'+_0x326b34['id'],_0x326b34);ChatWebsiteEvents[_0xe851('0x5')](_0x16b38a,_0x326b34);_0x52b67b(null);};}for(var e in events){if(events[_0xe851('0x6')](e)){var event=events[e];ChatWebsite[_0xe851('0x7')](e,emitEvent(event));}}module[_0xe851('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7ec7=['ChatWebsite','save','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ec7,0x19b));var _0x77ec=function(_0x5d0097,_0x3f8f85){_0x5d0097=_0x5d0097-0x0;var _0x1141ba=_0x7ec7[_0x5d0097];return _0x1141ba;};'use strict';var EventEmitter=require(_0x77ec('0x0'));var ChatWebsite=require(_0x77ec('0x1'))['db'][_0x77ec('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77ec('0x3'),'afterUpdate':'update','afterDestroy':_0x77ec('0x4')};function emitEvent(_0x452ea4){return function(_0x5a928f,_0x4c4fca,_0x18c2af){ChatWebsiteEvents['emit'](_0x452ea4+':'+_0x5a928f['id'],_0x5a928f);ChatWebsiteEvents['emit'](_0x452ea4,_0x5a928f);_0x18c2af(null);};}for(var e in events){if(events[_0x77ec('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x77ec('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9628cd8..395a5d2 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 _0xc7e9=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','ChatWebsite','chat_websites'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xc7e9[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a4=['util','api','moment','bluebird','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x14fee3,_0x3d5673){var _0x38b9a6=function(_0x4484fe){while(--_0x4484fe){_0x14fee3['push'](_0x14fee3['shift']());}};_0x38b9a6(++_0x3d5673);}(_0x33a4,0x88));var _0x433a=function(_0x190e81,_0x5f53b7){_0x190e81=_0x190e81-0x0;var _0x26d685=_0x33a4[_0x190e81];return _0x26d685;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var logger=require('../../config/logger')(_0x433a('0x1'));var moment=require(_0x433a('0x2'));var BPromise=require(_0x433a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x433a('0x4'));var attributes=require(_0x433a('0x5'));module[_0x433a('0x6')]=function(_0x60b6b3,_0x1b6f5a){return _0x60b6b3['define'](_0x433a('0x7'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5ac6d8b..66f38d8 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 _0xef0f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5476a1,_0x14fbc9){var _0x26fdd7=function(_0x42980d){while(--_0x42980d){_0x5476a1['push'](_0x5476a1['shift']());}};_0x26fdd7(++_0x14fbc9);}(_0xef0f,0x168));var _0xfef0=function(_0x59ad08,_0x108500){_0x59ad08=_0x59ad08-0x0;var _0x351f58=_0xef0f[_0x59ad08];return _0x351f58;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});} \ No newline at end of file +var _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5989d0,_0xc3901b){var _0x552fc5=function(_0x4f36bb){while(--_0x4f36bb){_0x5989d0['push'](_0x5989d0['shift']());}};_0x552fc5(++_0xc3901b);}(_0x33af,0xec));var _0xf33a=function(_0x52a592,_0x2926b4){_0x52a592=_0x52a592-0x0;var _0x511e55=_0x33af[_0x52a592];return _0x511e55;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 54edd7b..aca9e5a 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x37161f,_0x454e57){var _0x4c3e17=function(_0x2fbb97){while(--_0x2fbb97){_0x37161f['push'](_0x37161f['shift']());}};_0x4c3e17(++_0x454e57);}(_0x7a54,0x106));var _0x47a5=function(_0x1c608b,_0x4245ec){_0x1c608b=_0x1c608b-0x0;var _0x310139=_0x7a54[_0x1c608b];return _0x310139;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x9b1a91,_0x576584){var _0x82a805=function(_0x8ba672){while(--_0x8ba672){_0x9b1a91['push'](_0x9b1a91['shift']());}};_0x82a805(++_0x576584);}(_0x7a54,0x106));var _0x47a5=function(_0x53158b,_0x559273){_0x53158b=_0x53158b-0x0;var _0x57b9b5=_0x7a54[_0x53158b];return _0x57b9b5;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 087edbf..cb67b7b 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 _0x89f5=['/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','format','now','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages'];(function(_0xe5eb29,_0x2c13b0){var _0x43224d=function(_0x18040a){while(--_0x18040a){_0xe5eb29['push'](_0xe5eb29['shift']());}};_0x43224d(++_0x2c13b0);}(_0x89f5,0x1b8));var _0x589f=function(_0x3f1470,_0x23be18){_0x3f1470=_0x3f1470-0x0;var _0x269691=_0x89f5[_0x3f1470];return _0x269691;};'use strict';var multer=require(_0x589f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x589f('0x1'));var router=express[_0x589f('0x2')]();var auth=require(_0x589f('0x3'));var interaction=require(_0x589f('0x4'));var config=require(_0x589f('0x5'));var controller=require(_0x589f('0x6'));router[_0x589f('0x7')]('/',auth['isAuthenticated'](),controller[_0x589f('0x8')]);router['get'](_0x589f('0x9'),auth[_0x589f('0xa')](),controller['describe']);router[_0x589f('0x7')](_0x589f('0xb'),auth[_0x589f('0xa')](),controller[_0x589f('0xc')]);router[_0x589f('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x589f('0xd')]);router[_0x589f('0x7')]('/:id/canned_answers',auth[_0x589f('0xa')](),controller[_0x589f('0xe')]);router[_0x589f('0x7')](_0x589f('0xf'),controller[_0x589f('0x10')]);router[_0x589f('0x7')](_0x589f('0x11'),controller['getAvatar']);router[_0x589f('0x7')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x589f('0x7')](_0x589f('0x12'),controller['getSystemAvatar']);router[_0x589f('0x7')](_0x589f('0x13'),auth[_0x589f('0xa')](),controller[_0x589f('0x14')]);router[_0x589f('0x7')](_0x589f('0x15'),controller[_0x589f('0x16')]);router[_0x589f('0x7')](_0x589f('0x17'),auth[_0x589f('0xa')](),controller[_0x589f('0x18')]);router['get'](_0x589f('0x19'),auth[_0x589f('0xa')](),controller[_0x589f('0x1a')]);router[_0x589f('0x7')](_0x589f('0x1b'),controller['getFields']);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x589f('0x1c')]);router[_0x589f('0x7')](_0x589f('0x1d'),auth[_0x589f('0xa')](),controller[_0x589f('0x1e')]);router[_0x589f('0x1f')]('/',auth[_0x589f('0xa')](),controller[_0x589f('0x20')]);router[_0x589f('0x1f')](_0x589f('0x21'),auth[_0x589f('0xa')](),controller[_0x589f('0x22')]);router[_0x589f('0x1f')](_0x589f('0x23'),auth[_0x589f('0xa')](),controller[_0x589f('0x24')]);var upload=multer({'storage':multer[_0x589f('0x25')]({'destination':function(_0x14c1c2,_0x531d35,_0x59d9f4){_0x59d9f4(null,path[_0x589f('0x26')](config[_0x589f('0x27')],_0x589f('0x28')));},'filename':function(_0x561797,_0x10b56e,_0xec3c4f){_0xec3c4f(null,util['format'](_0x589f('0x29'),Date['now'](),_0x10b56e[_0x589f('0x2a')]));}})});router[_0x589f('0x1f')](_0x589f('0xf'),upload[_0x589f('0x2b')](_0x589f('0x2c')),controller[_0x589f('0x2d')]);var upload=multer({'storage':multer[_0x589f('0x25')]({'destination':function(_0x5e3c38,_0x1e294a,_0x2f4254){_0x2f4254(null,path[_0x589f('0x26')](config[_0x589f('0x27')],'server/files/images/avatars/'));},'filename':function(_0x25b316,_0x2b9caa,_0xc6fe16){_0xc6fe16(null,util[_0x589f('0x2e')](_0x589f('0x29'),Date[_0x589f('0x2f')](),_0x2b9caa[_0x589f('0x2a')]));}})});router[_0x589f('0x1f')]('/:id/avatar',upload[_0x589f('0x2b')](_0x589f('0x2c')),controller[_0x589f('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d0296,_0x16c70b,_0x2f52ea){_0x2f52ea(null,path['join'](config[_0x589f('0x27')],_0x589f('0x31')));},'filename':function(_0x35b4d6,_0x584bcc,_0x3f32e3){_0x3f32e3(null,util[_0x589f('0x2e')]('%s-%s',Date[_0x589f('0x2f')](),_0x584bcc[_0x589f('0x2a')]));}})});router[_0x589f('0x1f')](_0x589f('0x32'),upload[_0x589f('0x2b')](_0x589f('0x2c')),controller[_0x589f('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bd625,_0x546f36,_0x68f053){_0x68f053(null,path[_0x589f('0x26')](config[_0x589f('0x27')],_0x589f('0x31')));},'filename':function(_0x1d03ad,_0x1b3455,_0x245516){_0x245516(null,util['format']('%s-%s',Date[_0x589f('0x2f')](),_0x1b3455[_0x589f('0x2a')]));}})});router[_0x589f('0x1f')]('/:id/system_avatar',upload[_0x589f('0x2b')]('file'),controller[_0x589f('0x34')]);router[_0x589f('0x1f')](_0x589f('0x35'),controller[_0x589f('0x36')]);router[_0x589f('0x1f')](_0x589f('0x37'),controller['offline']);router[_0x589f('0x1f')](_0x589f('0x13'),auth['isAuthenticated'](),controller[_0x589f('0x38')]);router['post'](_0x589f('0x17'),auth[_0x589f('0xa')](),controller[_0x589f('0x39')]);router[_0x589f('0x1f')](_0x589f('0x19'),auth[_0x589f('0xa')](),controller[_0x589f('0x3a')]);router[_0x589f('0x1f')](_0x589f('0x1d'),auth[_0x589f('0xa')](),controller[_0x589f('0x3b')]);router[_0x589f('0x3c')](_0x589f('0xb'),auth[_0x589f('0xa')](),controller[_0x589f('0x3d')]);router[_0x589f('0x3e')](_0x589f('0xb'),auth['isAuthenticated'](),controller[_0x589f('0x3f')]);router[_0x589f('0x3e')](_0x589f('0x21'),auth[_0x589f('0xa')](),controller['removeDispositions']);router[_0x589f('0x3e')](_0x589f('0x23'),auth[_0x589f('0xa')](),controller[_0x589f('0x40')]);router['delete'](_0x589f('0x1d'),auth[_0x589f('0xa')](),controller[_0x589f('0x41')]);module[_0x589f('0x42')]=router; \ No newline at end of file +var _0x169a=['/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','join','server/files/images/avatars/','/:id/avatar','file','addAvatar','addCustomerAvatar','diskStorage','addSystemAvatar','notify','/:id/offline','offline','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields'];(function(_0x2c976f,_0x4bd2c4){var _0x1a1227=function(_0x24597e){while(--_0x24597e){_0x2c976f['push'](_0x2c976f['shift']());}};_0x1a1227(++_0x4bd2c4);}(_0x169a,0xa2));var _0xa169=function(_0x14f17f,_0xb479d0){_0x14f17f=_0x14f17f-0x0;var _0x214f56=_0x169a[_0x14f17f];return _0x214f56;};'use strict';var multer=require(_0xa169('0x0'));var util=require(_0xa169('0x1'));var path=require('path');var timeout=require(_0xa169('0x2'));var express=require(_0xa169('0x3'));var router=express['Router']();var auth=require(_0xa169('0x4'));var interaction=require(_0xa169('0x5'));var config=require('../../config/environment');var controller=require(_0xa169('0x6'));router[_0xa169('0x7')]('/',auth['isAuthenticated'](),controller[_0xa169('0x8')]);router[_0xa169('0x7')](_0xa169('0x9'),auth[_0xa169('0xa')](),controller[_0xa169('0xb')]);router['get'](_0xa169('0xc'),auth[_0xa169('0xa')](),controller[_0xa169('0xd')]);router[_0xa169('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa169('0x7')](_0xa169('0xe'),auth[_0xa169('0xa')](),controller[_0xa169('0xf')]);router['get'](_0xa169('0x10'),controller['getLogo']);router[_0xa169('0x7')]('/:id/avatar',controller[_0xa169('0x11')]);router[_0xa169('0x7')](_0xa169('0x12'),controller[_0xa169('0x13')]);router[_0xa169('0x7')](_0xa169('0x14'),controller[_0xa169('0x15')]);router[_0xa169('0x7')](_0xa169('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa169('0x17'),controller[_0xa169('0x18')]);router[_0xa169('0x7')](_0xa169('0x19'),auth[_0xa169('0xa')](),controller[_0xa169('0x1a')]);router[_0xa169('0x7')](_0xa169('0x1b'),auth[_0xa169('0xa')](),controller[_0xa169('0x1c')]);router[_0xa169('0x7')]('/:id/fields',controller[_0xa169('0x1d')]);router['get'](_0xa169('0x1e'),auth[_0xa169('0xa')](),controller['getOfflineMessages']);router[_0xa169('0x7')](_0xa169('0x1f'),auth[_0xa169('0xa')](),controller[_0xa169('0x20')]);router[_0xa169('0x21')]('/',auth[_0xa169('0xa')](),controller[_0xa169('0x22')]);router[_0xa169('0x21')](_0xa169('0x23'),auth[_0xa169('0xa')](),controller['addDisposition']);router[_0xa169('0x21')](_0xa169('0xe'),auth[_0xa169('0xa')](),controller[_0xa169('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x50ecd6,_0x56ca30,_0x5a454f){_0x5a454f(null,path['join'](config[_0xa169('0x25')],_0xa169('0x26')));},'filename':function(_0x30bb87,_0xba230b,_0x4d06ba){_0x4d06ba(null,util[_0xa169('0x27')](_0xa169('0x28'),Date[_0xa169('0x29')](),_0xba230b[_0xa169('0x2a')]));}})});router[_0xa169('0x21')]('/:id/logo',upload[_0xa169('0x2b')]('file'),controller[_0xa169('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x128f08,_0x5bc76e,_0x56a6d3){_0x56a6d3(null,path[_0xa169('0x2d')](config[_0xa169('0x25')],_0xa169('0x2e')));},'filename':function(_0x11eae1,_0x5d7c72,_0x1bacf6){_0x1bacf6(null,util[_0xa169('0x27')]('%s-%s',Date[_0xa169('0x29')](),_0x5d7c72[_0xa169('0x2a')]));}})});router[_0xa169('0x21')](_0xa169('0x2f'),upload[_0xa169('0x2b')](_0xa169('0x30')),controller[_0xa169('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd74563,_0x48a599,_0x1f04f0){_0x1f04f0(null,path[_0xa169('0x2d')](config['root'],_0xa169('0x2e')));},'filename':function(_0x4854c1,_0x2f374f,_0x4f0c32){_0x4f0c32(null,util[_0xa169('0x27')](_0xa169('0x28'),Date['now'](),_0x2f374f[_0xa169('0x2a')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0xa169('0x30')),controller[_0xa169('0x32')]);var upload=multer({'storage':multer[_0xa169('0x33')]({'destination':function(_0x5f3e67,_0x2ee891,_0x339c9a){_0x339c9a(null,path['join'](config['root'],_0xa169('0x2e')));},'filename':function(_0x2bc883,_0x1d0186,_0x24eed6){_0x24eed6(null,util[_0xa169('0x27')](_0xa169('0x28'),Date['now'](),_0x1d0186[_0xa169('0x2a')]));}})});router[_0xa169('0x21')](_0xa169('0x14'),upload[_0xa169('0x2b')](_0xa169('0x30')),controller[_0xa169('0x34')]);router[_0xa169('0x21')]('/:id/notify',controller[_0xa169('0x35')]);router[_0xa169('0x21')](_0xa169('0x36'),controller[_0xa169('0x37')]);router[_0xa169('0x21')](_0xa169('0x16'),auth[_0xa169('0xa')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xa169('0x38')]);router[_0xa169('0x21')](_0xa169('0x1b'),auth[_0xa169('0xa')](),controller['addProactiveActions']);router['post'](_0xa169('0x1f'),auth[_0xa169('0xa')](),controller[_0xa169('0x39')]);router[_0xa169('0x3a')](_0xa169('0xc'),auth['isAuthenticated'](),controller[_0xa169('0x3b')]);router[_0xa169('0x3c')](_0xa169('0xc'),auth[_0xa169('0xa')](),controller[_0xa169('0x3d')]);router['delete'](_0xa169('0x23'),auth[_0xa169('0xa')](),controller[_0xa169('0x3e')]);router[_0xa169('0x3c')](_0xa169('0xe'),auth['isAuthenticated'](),controller[_0xa169('0x3f')]);router[_0xa169('0x3c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 00a39ab..9a35424 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 _0x4489=['Google','STRING','sequelize','exports','ENUM','AmazonAWS'];(function(_0x548576,_0x58f120){var _0xa58b26=function(_0x4e5c3f){while(--_0x4e5c3f){_0x548576['push'](_0x548576['shift']());}};_0xa58b26(++_0x58f120);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9448('0x0'));module[_0x9448('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9448('0x2')](_0x9448('0x3'),_0x9448('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9448('0x5')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f47=['AmazonAWS','exports','STRING'];(function(_0x52097b,_0x57d483){var _0x314b0a=function(_0x408306){while(--_0x408306){_0x52097b['push'](_0x52097b['shift']());}};_0x314b0a(++_0x57d483);}(_0x6f47,0xc7));var _0x76f4=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x6f47[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x76f4('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x76f4('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a59a343..cf7717c 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 _0xd54b=['findAll','rows','catch','show','params','rawAttributes','includeAll','merge','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','CloudProvider','type','key','keys','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','options','include'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xd54b,0x127));var _0xbd54=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd54b[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xbd54('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd54('0x1'));var zipdir=require(_0xbd54('0x2'));var jsonpatch=require(_0xbd54('0x3'));var rp=require(_0xbd54('0x4'));var moment=require(_0xbd54('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbd54('0x6'));var path=require(_0xbd54('0x7'));var sox=require(_0xbd54('0x8'));var csv=require(_0xbd54('0x9'));var ejs=require(_0xbd54('0xa'));var fs=require('fs');var _=require(_0xbd54('0xb'));var squel=require(_0xbd54('0xc'));var crypto=require(_0xbd54('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd54('0x9'));var querystring=require(_0xbd54('0xe'));var Papa=require(_0xbd54('0xf'));var Redis=require('ioredis');var authService=require(_0xbd54('0x10'));var qs=require(_0xbd54('0x11'));var as=require(_0xbd54('0x12'));var hardwareService=require(_0xbd54('0x13'));var logger=require('../../config/logger')(_0xbd54('0x14'));var utils=require(_0xbd54('0x15'));var config=require(_0xbd54('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b2af4,_0x1b68ca){_0x1b68ca=_0x1b68ca||0xcc;return function(_0x406a97){if(_0x406a97){return _0x3b2af4[_0xbd54('0x17')](_0x1b68ca);}return _0x3b2af4['status'](_0x1b68ca)[_0xbd54('0x18')]();};}function respondWithResult(_0x56cb4c,_0x56c35d){_0x56c35d=_0x56c35d||0xc8;return function(_0x42c144){if(_0x42c144){return _0x56cb4c[_0xbd54('0x19')](_0x56c35d)[_0xbd54('0x1a')](_0x42c144);}};}function respondWithFilteredResult(_0x28ed42,_0x4784d4){return function(_0x21c7ef){if(_0x21c7ef){var _0xc4e0cb=_0x21c7ef[_0xbd54('0x1b')],_0x43dc14=_0x4784d4[_0xbd54('0x1c')],_0x1c3cbd=_0x4784d4[_0xbd54('0x1c')]+_0x4784d4[_0xbd54('0x1d')],_0x31054f;if(_0x1c3cbd>=_0xc4e0cb){_0x1c3cbd=_0xc4e0cb;_0x31054f=0xc8;}else{_0x31054f=0xce;}_0x28ed42['status'](_0x31054f);return _0x28ed42[_0xbd54('0x1e')](_0xbd54('0x1f'),_0x43dc14+'-'+_0x1c3cbd+'/'+_0xc4e0cb)[_0xbd54('0x1a')](_0x21c7ef);}return null;};}function patchUpdates(_0x2b73bc){return function(_0x517a9b){try{jsonpatch[_0xbd54('0x20')](_0x517a9b,_0x2b73bc,!![]);}catch(_0x2ccae5){return BPromise['reject'](_0x2ccae5);}return _0x517a9b[_0xbd54('0x21')]();};}function saveUpdates(_0x1ae4ae,_0x365b5f){return function(_0x3a6017){if(_0x3a6017){return _0x3a6017[_0xbd54('0x22')](_0x1ae4ae)[_0xbd54('0x23')](function(_0x69a054){return _0x69a054;});}return null;};}function removeEntity(_0x34e5e2,_0x3dc445){return function(_0x2d3e80){if(_0x2d3e80){return _0x2d3e80[_0xbd54('0x24')]()[_0xbd54('0x23')](function(){_0x34e5e2[_0xbd54('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d573,_0x336d68){return function(_0x457576){if(!_0x457576){_0x49d573[_0xbd54('0x17')](0x194);}return _0x457576;};}function handleError(_0x1e4047,_0x1533f8){_0x1533f8=_0x1533f8||0x1f4;return function(_0x3e2e07){logger[_0xbd54('0x25')](_0x3e2e07['stack']);if(_0x3e2e07[_0xbd54('0x26')]){delete _0x3e2e07['name'];}_0x1e4047[_0xbd54('0x19')](_0x1533f8)[_0xbd54('0x27')](_0x3e2e07);};}exports[_0xbd54('0x28')]=function(_0x28f93f,_0x1d4f57){var _0x220f86={},_0x110f7a={},_0x13338b={'count':0x0,'rows':[]};var _0xd09227=_[_0xbd54('0x29')](db[_0xbd54('0x2a')]['rawAttributes'],function(_0x2123e4){return{'name':_0x2123e4['fieldName'],'type':_0x2123e4[_0xbd54('0x2b')][_0xbd54('0x2c')]};});_0x110f7a['model']=_[_0xbd54('0x29')](_0xd09227,_0xbd54('0x26'));_0x110f7a['query']=_[_0xbd54('0x2d')](_0x28f93f[_0xbd54('0x2e')]);_0x110f7a['filters']=_['intersection'](_0x110f7a[_0xbd54('0x2f')],_0x110f7a[_0xbd54('0x2e')]);_0x220f86[_0xbd54('0x30')]=_[_0xbd54('0x31')](_0x110f7a[_0xbd54('0x2f')],qs[_0xbd54('0x32')](_0x28f93f['query'][_0xbd54('0x32')]));_0x220f86[_0xbd54('0x30')]=_0x220f86[_0xbd54('0x30')][_0xbd54('0x33')]?_0x220f86[_0xbd54('0x30')]:_0x110f7a[_0xbd54('0x2f')];if(!_0x28f93f[_0xbd54('0x2e')]['hasOwnProperty'](_0xbd54('0x34'))){_0x220f86[_0xbd54('0x1d')]=qs['limit'](_0x28f93f[_0xbd54('0x2e')]['limit']);_0x220f86['offset']=qs['offset'](_0x28f93f[_0xbd54('0x2e')]['offset']);}_0x220f86[_0xbd54('0x35')]=qs[_0xbd54('0x36')](_0x28f93f[_0xbd54('0x2e')][_0xbd54('0x36')]);_0x220f86[_0xbd54('0x37')]=qs['filters'](_['pick'](_0x28f93f[_0xbd54('0x2e')],_0x110f7a[_0xbd54('0x38')]),_0xd09227);if(_0x28f93f[_0xbd54('0x2e')][_0xbd54('0x39')]){_0x220f86['where']=_['merge'](_0x220f86[_0xbd54('0x37')],{'$or':_[_0xbd54('0x29')](_0xd09227,function(_0x1889d0){if(_0x1889d0[_0xbd54('0x2b')]!=='VIRTUAL'){var _0x413d1a={};_0x413d1a[_0x1889d0['name']]={'$like':'%'+_0x28f93f[_0xbd54('0x2e')]['filter']+'%'};return _0x413d1a;}})});}_0x220f86=_['merge']({},_0x220f86,_0x28f93f[_0xbd54('0x3a')]);var _0x2be2db={'where':_0x220f86[_0xbd54('0x37')]};return db[_0xbd54('0x2a')]['count'](_0x2be2db)[_0xbd54('0x23')](function(_0x4a1d88){_0x13338b['count']=_0x4a1d88;if(_0x28f93f[_0xbd54('0x2e')]['includeAll']){_0x220f86[_0xbd54('0x3b')]=[{'all':!![]}];}return db[_0xbd54('0x2a')][_0xbd54('0x3c')](_0x220f86);})[_0xbd54('0x23')](function(_0x354b05){_0x13338b[_0xbd54('0x3d')]=_0x354b05;return _0x13338b;})['then'](respondWithFilteredResult(_0x1d4f57,_0x220f86))[_0xbd54('0x3e')](handleError(_0x1d4f57,null));};exports[_0xbd54('0x3f')]=function(_0x27b178,_0x40b012){var _0x58ff5c={'raw':!![],'where':{'id':_0x27b178[_0xbd54('0x40')]['id']}},_0x56fa2f={};_0x56fa2f[_0xbd54('0x2f')]=_[_0xbd54('0x2d')](db[_0xbd54('0x2a')][_0xbd54('0x41')]);_0x56fa2f[_0xbd54('0x2e')]=_[_0xbd54('0x2d')](_0x27b178[_0xbd54('0x2e')]);_0x56fa2f[_0xbd54('0x38')]=_[_0xbd54('0x31')](_0x56fa2f[_0xbd54('0x2f')],_0x56fa2f[_0xbd54('0x2e')]);_0x58ff5c['attributes']=_[_0xbd54('0x31')](_0x56fa2f[_0xbd54('0x2f')],qs[_0xbd54('0x32')](_0x27b178['query']['fields']));_0x58ff5c[_0xbd54('0x30')]=_0x58ff5c[_0xbd54('0x30')][_0xbd54('0x33')]?_0x58ff5c[_0xbd54('0x30')]:_0x56fa2f[_0xbd54('0x2f')];if(_0x27b178['query'][_0xbd54('0x42')]){_0x58ff5c['include']=[{'all':!![]}];}_0x58ff5c=_[_0xbd54('0x43')]({},_0x58ff5c,_0x27b178[_0xbd54('0x3a')]);return db[_0xbd54('0x2a')]['find'](_0x58ff5c)[_0xbd54('0x23')](handleEntityNotFound(_0x40b012,null))['then'](respondWithResult(_0x40b012,null))[_0xbd54('0x3e')](handleError(_0x40b012,null));};exports[_0xbd54('0x44')]=function(_0x283cab,_0x241e60){return db[_0xbd54('0x2a')][_0xbd54('0x44')](_0x283cab['body'],{})['then'](respondWithResult(_0x241e60,0xc9))['catch'](handleError(_0x241e60,null));};exports[_0xbd54('0x22')]=function(_0x441abc,_0x41d843){if(_0x441abc[_0xbd54('0x45')]['id']){delete _0x441abc[_0xbd54('0x45')]['id'];}return db[_0xbd54('0x2a')][_0xbd54('0x46')]({'where':{'id':_0x441abc[_0xbd54('0x40')]['id']}})[_0xbd54('0x23')](handleEntityNotFound(_0x41d843,null))[_0xbd54('0x23')](saveUpdates(_0x441abc[_0xbd54('0x45')],null))[_0xbd54('0x23')](respondWithResult(_0x41d843,null))[_0xbd54('0x3e')](handleError(_0x41d843,null));};exports[_0xbd54('0x24')]=function(_0x4c8ad0,_0x466ce8){return db[_0xbd54('0x2a')][_0xbd54('0x46')]({'where':{'id':_0x4c8ad0['params']['id']}})[_0xbd54('0x23')](handleEntityNotFound(_0x466ce8,null))[_0xbd54('0x23')](removeEntity(_0x466ce8,null))[_0xbd54('0x3e')](handleError(_0x466ce8,null));}; \ No newline at end of file +var _0x7755=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x7755,0xb1));var _0x5775=function(_0x5d963e,_0x5edbfe){_0x5d963e=_0x5d963e-0x0;var _0x523c8e=_0x7755[_0x5d963e];return _0x523c8e;};'use strict';var pdf=require(_0x5775('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5775('0x1'));var zipdir=require(_0x5775('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5775('0x3'));var moment=require(_0x5775('0x4'));var BPromise=require(_0x5775('0x5'));var Mustache=require(_0x5775('0x6'));var util=require(_0x5775('0x7'));var path=require(_0x5775('0x8'));var sox=require(_0x5775('0x9'));var csv=require('to-csv');var ejs=require(_0x5775('0xa'));var fs=require('fs');var _=require(_0x5775('0xb'));var squel=require(_0x5775('0xc'));var crypto=require(_0x5775('0xd'));var jsforce=require(_0x5775('0xe'));var deskjs=require(_0x5775('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5775('0x10'));var Papa=require(_0x5775('0x11'));var Redis=require(_0x5775('0x12'));var authService=require(_0x5775('0x13'));var qs=require(_0x5775('0x14'));var as=require(_0x5775('0x15'));var hardwareService=require(_0x5775('0x16'));var logger=require(_0x5775('0x17'))('api');var utils=require(_0x5775('0x18'));var config=require(_0x5775('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25779b,_0x34588d){_0x34588d=_0x34588d||0xcc;return function(_0x2a366c){if(_0x2a366c){return _0x25779b[_0x5775('0x1a')](_0x34588d);}return _0x25779b[_0x5775('0x1b')](_0x34588d)[_0x5775('0x1c')]();};}function respondWithResult(_0x2158ab,_0x3de1c6){_0x3de1c6=_0x3de1c6||0xc8;return function(_0xc32bb7){if(_0xc32bb7){return _0x2158ab[_0x5775('0x1b')](_0x3de1c6)[_0x5775('0x1d')](_0xc32bb7);}};}function respondWithFilteredResult(_0x2023d5,_0x4f9195){return function(_0x4b1985){if(_0x4b1985){var _0x59549e=_0x4b1985[_0x5775('0x1e')],_0x3dc33d=_0x4f9195[_0x5775('0x1f')],_0x58e26c=_0x4f9195[_0x5775('0x1f')]+_0x4f9195['limit'],_0x48e987;if(_0x58e26c>=_0x59549e){_0x58e26c=_0x59549e;_0x48e987=0xc8;}else{_0x48e987=0xce;}_0x2023d5[_0x5775('0x1b')](_0x48e987);return _0x2023d5[_0x5775('0x20')](_0x5775('0x21'),_0x3dc33d+'-'+_0x58e26c+'/'+_0x59549e)[_0x5775('0x1d')](_0x4b1985);}return null;};}function patchUpdates(_0x4f3917){return function(_0x172f57){try{jsonpatch[_0x5775('0x22')](_0x172f57,_0x4f3917,!![]);}catch(_0x2510cd){return BPromise[_0x5775('0x23')](_0x2510cd);}return _0x172f57['save']();};}function saveUpdates(_0x34bb38,_0x4560be){return function(_0x5e81de){if(_0x5e81de){return _0x5e81de[_0x5775('0x24')](_0x34bb38)[_0x5775('0x25')](function(_0x5ef93a){return _0x5ef93a;});}return null;};}function removeEntity(_0x529e56,_0x2d5d2f){return function(_0x2932af){if(_0x2932af){return _0x2932af[_0x5775('0x26')]()['then'](function(){_0x529e56[_0x5775('0x1b')](0xcc)[_0x5775('0x1c')]();});}};}function handleEntityNotFound(_0x1f19b6,_0x1f6032){return function(_0x28e10f){if(!_0x28e10f){_0x1f19b6[_0x5775('0x1a')](0x194);}return _0x28e10f;};}function handleError(_0x1c7064,_0x30316c){_0x30316c=_0x30316c||0x1f4;return function(_0x3033bb){logger[_0x5775('0x27')](_0x3033bb[_0x5775('0x28')]);if(_0x3033bb[_0x5775('0x29')]){delete _0x3033bb[_0x5775('0x29')];}_0x1c7064[_0x5775('0x1b')](_0x30316c)[_0x5775('0x2a')](_0x3033bb);};}exports[_0x5775('0x2b')]=function(_0x14b393,_0x207017){var _0x3bd5f8={},_0x2d583d={},_0x1da5f2={'count':0x0,'rows':[]};var _0x169964=_[_0x5775('0x2c')](db[_0x5775('0x2d')][_0x5775('0x2e')],function(_0x3c27ae){return{'name':_0x3c27ae[_0x5775('0x2f')],'type':_0x3c27ae['type']['key']};});_0x2d583d[_0x5775('0x30')]=_[_0x5775('0x2c')](_0x169964,'name');_0x2d583d[_0x5775('0x31')]=_[_0x5775('0x32')](_0x14b393[_0x5775('0x31')]);_0x2d583d[_0x5775('0x33')]=_[_0x5775('0x34')](_0x2d583d[_0x5775('0x30')],_0x2d583d[_0x5775('0x31')]);_0x3bd5f8[_0x5775('0x35')]=_[_0x5775('0x34')](_0x2d583d[_0x5775('0x30')],qs[_0x5775('0x36')](_0x14b393['query']['fields']));_0x3bd5f8['attributes']=_0x3bd5f8[_0x5775('0x35')][_0x5775('0x37')]?_0x3bd5f8['attributes']:_0x2d583d[_0x5775('0x30')];if(!_0x14b393[_0x5775('0x31')][_0x5775('0x38')]('nolimit')){_0x3bd5f8[_0x5775('0x39')]=qs[_0x5775('0x39')](_0x14b393[_0x5775('0x31')][_0x5775('0x39')]);_0x3bd5f8[_0x5775('0x1f')]=qs['offset'](_0x14b393[_0x5775('0x31')]['offset']);}_0x3bd5f8[_0x5775('0x3a')]=qs[_0x5775('0x3b')](_0x14b393[_0x5775('0x31')][_0x5775('0x3b')]);_0x3bd5f8['where']=qs[_0x5775('0x33')](_[_0x5775('0x3c')](_0x14b393[_0x5775('0x31')],_0x2d583d[_0x5775('0x33')]),_0x169964);if(_0x14b393[_0x5775('0x31')]['filter']){_0x3bd5f8['where']=_[_0x5775('0x3d')](_0x3bd5f8[_0x5775('0x3e')],{'$or':_[_0x5775('0x2c')](_0x169964,function(_0x54a2c8){if(_0x54a2c8[_0x5775('0x3f')]!==_0x5775('0x40')){var _0x66d96c={};_0x66d96c[_0x54a2c8['name']]={'$like':'%'+_0x14b393[_0x5775('0x31')][_0x5775('0x41')]+'%'};return _0x66d96c;}})});}_0x3bd5f8=_['merge']({},_0x3bd5f8,_0x14b393[_0x5775('0x42')]);var _0x293136={'where':_0x3bd5f8[_0x5775('0x3e')]};return db[_0x5775('0x2d')]['count'](_0x293136)[_0x5775('0x25')](function(_0x86aa4d){_0x1da5f2['count']=_0x86aa4d;if(_0x14b393[_0x5775('0x31')][_0x5775('0x43')]){_0x3bd5f8[_0x5775('0x44')]=[{'all':!![]}];}return db[_0x5775('0x2d')][_0x5775('0x45')](_0x3bd5f8);})[_0x5775('0x25')](function(_0x4753ce){_0x1da5f2['rows']=_0x4753ce;return _0x1da5f2;})[_0x5775('0x25')](respondWithFilteredResult(_0x207017,_0x3bd5f8))[_0x5775('0x46')](handleError(_0x207017,null));};exports['show']=function(_0x335b34,_0xbb4bcb){var _0xc92ce5={'raw':!![],'where':{'id':_0x335b34[_0x5775('0x47')]['id']}},_0x3ce1c0={};_0x3ce1c0['model']=_[_0x5775('0x32')](db[_0x5775('0x2d')]['rawAttributes']);_0x3ce1c0['query']=_[_0x5775('0x32')](_0x335b34[_0x5775('0x31')]);_0x3ce1c0[_0x5775('0x33')]=_['intersection'](_0x3ce1c0[_0x5775('0x30')],_0x3ce1c0[_0x5775('0x31')]);_0xc92ce5[_0x5775('0x35')]=_['intersection'](_0x3ce1c0[_0x5775('0x30')],qs['fields'](_0x335b34['query'][_0x5775('0x36')]));_0xc92ce5[_0x5775('0x35')]=_0xc92ce5[_0x5775('0x35')][_0x5775('0x37')]?_0xc92ce5[_0x5775('0x35')]:_0x3ce1c0[_0x5775('0x30')];if(_0x335b34[_0x5775('0x31')][_0x5775('0x43')]){_0xc92ce5['include']=[{'all':!![]}];}_0xc92ce5=_['merge']({},_0xc92ce5,_0x335b34[_0x5775('0x42')]);return db[_0x5775('0x2d')][_0x5775('0x48')](_0xc92ce5)[_0x5775('0x25')](handleEntityNotFound(_0xbb4bcb,null))[_0x5775('0x25')](respondWithResult(_0xbb4bcb,null))[_0x5775('0x46')](handleError(_0xbb4bcb,null));};exports[_0x5775('0x49')]=function(_0x53da60,_0x5aab73){return db[_0x5775('0x2d')][_0x5775('0x49')](_0x53da60[_0x5775('0x4a')],{})['then'](respondWithResult(_0x5aab73,0xc9))[_0x5775('0x46')](handleError(_0x5aab73,null));};exports[_0x5775('0x24')]=function(_0x1aec47,_0x419aa4){if(_0x1aec47[_0x5775('0x4a')]['id']){delete _0x1aec47['body']['id'];}return db[_0x5775('0x2d')][_0x5775('0x48')]({'where':{'id':_0x1aec47[_0x5775('0x47')]['id']}})[_0x5775('0x25')](handleEntityNotFound(_0x419aa4,null))[_0x5775('0x25')](saveUpdates(_0x1aec47[_0x5775('0x4a')],null))[_0x5775('0x25')](respondWithResult(_0x419aa4,null))[_0x5775('0x46')](handleError(_0x419aa4,null));};exports['destroy']=function(_0x542562,_0x1ffe9b){return db[_0x5775('0x2d')][_0x5775('0x48')]({'where':{'id':_0x542562[_0x5775('0x47')]['id']}})[_0x5775('0x25')](handleEntityNotFound(_0x1ffe9b,null))[_0x5775('0x25')](removeEntity(_0x1ffe9b,null))['catch'](handleError(_0x1ffe9b,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index be3f355..610b16f 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 _0xb7d3=['./cloudProvider.attributes','exports','define','cloud_providers','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x285964,_0x69be67){var _0x308e04=function(_0x4e0201){while(--_0x4e0201){_0x285964['push'](_0x285964['shift']());}};_0x308e04(++_0x69be67);}(_0xb7d3,0xb8));var _0x3b7d=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0xb7d3[_0x5cfa35];return _0xf7dffb;};'use strict';var _=require('lodash');var util=require(_0x3b7d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3b7d('0x1'));var BPromise=require(_0x3b7d('0x2'));var rp=require(_0x3b7d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b7d('0x4'));var config=require(_0x3b7d('0x5'));var attributes=require(_0x3b7d('0x6'));module[_0x3b7d('0x7')]=function(_0x2a844c,_0x45d2a3){return _0x2a844c[_0x3b7d('0x8')]('CloudProvider',attributes,{'tableName':_0x3b7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa659=['path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger'];(function(_0x5d1b59,_0x3b29c2){var _0x3ec1ac=function(_0x4cd5ab){while(--_0x4cd5ab){_0x5d1b59['push'](_0x5d1b59['shift']());}};_0x3ec1ac(++_0x3b29c2);}(_0xa659,0x178));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a65('0x0'));var util=require('util');var logger=require(_0x9a65('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a65('0x2'));var rimraf=require(_0x9a65('0x3'));var config=require('../../config/environment');var attributes=require(_0x9a65('0x4'));module[_0x9a65('0x5')]=function(_0x5d8c72,_0x14eaa9){return _0x5d8c72[_0x9a65('0x6')](_0x9a65('0x7'),attributes,{'tableName':_0x9a65('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 e52b762..cf68b72 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 _0x189c=['rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x303372,_0x4e3541){var _0x326952=function(_0x4f594d){while(--_0x4f594d){_0x303372['push'](_0x303372['shift']());}};_0x326952(++_0x4e3541);}(_0x189c,0x1dc));var _0xc189=function(_0x8299dc,_0x1204fd){_0x8299dc=_0x8299dc-0x0;var _0x28f0cf=_0x189c[_0x8299dc];return _0x28f0cf;};'use strict';var _=require(_0xc189('0x0'));var util=require(_0xc189('0x1'));var moment=require(_0xc189('0x2'));var BPromise=require(_0xc189('0x3'));var rs=require(_0xc189('0x4'));var fs=require('fs');var Redis=require(_0xc189('0x5'));var db=require(_0xc189('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc189('0x7'));var config=require(_0xc189('0x8'));var jayson=require(_0xc189('0x9'));var client=jayson[_0xc189('0xa')][_0xc189('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x146285,_0x2c04c0,_0x1c47cf){return new BPromise(function(_0x1270a0,_0x34a91){return client['request'](_0x146285,_0x1c47cf)[_0xc189('0xc')](function(_0x1c4c24){logger[_0xc189('0xd')]('CloudProvider,\x20%s,\x20%s',_0x2c04c0,'request\x20sent');logger['debug'](_0xc189('0xe'),_0x2c04c0,'request\x20sent',JSON[_0xc189('0xf')](_0x1c4c24));if(_0x1c4c24[_0xc189('0x10')]){if(_0x1c4c24[_0xc189('0x10')][_0xc189('0x11')]===0x1f4){logger[_0xc189('0x10')](_0xc189('0x12'),_0x2c04c0,_0x1c4c24['error'][_0xc189('0x13')]);return _0x34a91(_0x1c4c24[_0xc189('0x10')][_0xc189('0x13')]);}logger[_0xc189('0x10')](_0xc189('0x12'),_0x2c04c0,_0x1c4c24[_0xc189('0x10')][_0xc189('0x13')]);return _0x1270a0(_0x1c4c24[_0xc189('0x10')][_0xc189('0x13')]);}else{logger[_0xc189('0xd')](_0xc189('0x12'),_0x2c04c0,_0xc189('0x14'));_0x1270a0(_0x1c4c24[_0xc189('0x15')]['message']);}})[_0xc189('0x16')](function(_0x28c9a3){logger[_0xc189('0x10')](_0xc189('0x12'),_0x2c04c0,_0x28c9a3);_0x34a91(_0x28c9a3);});});} \ No newline at end of file +var _0x7b09=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util'];(function(_0x560964,_0x2c0ad6){var _0xe78f82=function(_0x19e15a){while(--_0x19e15a){_0x560964['push'](_0x560964['shift']());}};_0xe78f82(++_0x2c0ad6);}(_0x7b09,0x1b3));var _0x97b0=function(_0x5afe39,_0x1a9e76){_0x5afe39=_0x5afe39-0x0;var _0x5c142b=_0x7b09[_0x5afe39];return _0x5c142b;};'use strict';var _=require(_0x97b0('0x0'));var util=require(_0x97b0('0x1'));var moment=require(_0x97b0('0x2'));var BPromise=require(_0x97b0('0x3'));var rs=require(_0x97b0('0x4'));var fs=require('fs');var Redis=require(_0x97b0('0x5'));var db=require(_0x97b0('0x6'))['db'];var utils=require(_0x97b0('0x7'));var logger=require(_0x97b0('0x8'))('rpc');var config=require(_0x97b0('0x9'));var jayson=require(_0x97b0('0xa'));var client=jayson['client'][_0x97b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2318bb,_0x6cf42,_0x350cf7){return new BPromise(function(_0x7aeaec,_0x351fe7){return client['request'](_0x2318bb,_0x350cf7)['then'](function(_0xc78f69){logger['info'](_0x97b0('0xc'),_0x6cf42,_0x97b0('0xd'));logger[_0x97b0('0xe')](_0x97b0('0xf'),_0x6cf42,_0x97b0('0xd'),JSON[_0x97b0('0x10')](_0xc78f69));if(_0xc78f69['error']){if(_0xc78f69['error'][_0x97b0('0x11')]===0x1f4){logger[_0x97b0('0x12')](_0x97b0('0xc'),_0x6cf42,_0xc78f69[_0x97b0('0x12')]['message']);return _0x351fe7(_0xc78f69[_0x97b0('0x12')][_0x97b0('0x13')]);}logger['error'](_0x97b0('0xc'),_0x6cf42,_0xc78f69[_0x97b0('0x12')][_0x97b0('0x13')]);return _0x7aeaec(_0xc78f69['error'][_0x97b0('0x13')]);}else{logger[_0x97b0('0x14')](_0x97b0('0xc'),_0x6cf42,'request\x20sent');_0x7aeaec(_0xc78f69[_0x97b0('0x15')][_0x97b0('0x13')]);}})[_0x97b0('0x16')](function(_0x9a6830){logger[_0x97b0('0x12')](_0x97b0('0xc'),_0x6cf42,_0x9a6830);_0x351fe7(_0x9a6830);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 718db71..763cfd6 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 _0xceed=['Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xceed,0x74));var _0xdcee=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xceed[_0x52e363];return _0x3fc2b5;};'use strict';var multer=require('multer');var util=require(_0xdcee('0x0'));var path=require(_0xdcee('0x1'));var timeout=require(_0xdcee('0x2'));var express=require('express');var router=express[_0xdcee('0x3')]();var auth=require(_0xdcee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdcee('0x5'));var controller=require(_0xdcee('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdcee('0x7')]);router[_0xdcee('0x8')](_0xdcee('0x9'),auth['isAuthenticated'](),controller[_0xdcee('0xa')]);router[_0xdcee('0xb')]('/',auth[_0xdcee('0xc')](),controller['create']);router[_0xdcee('0xd')](_0xdcee('0x9'),auth[_0xdcee('0xc')](),controller[_0xdcee('0xe')]);router[_0xdcee('0xf')](_0xdcee('0x9'),auth[_0xdcee('0xc')](),controller[_0xdcee('0x10')]);module['exports']=router; \ No newline at end of file +var _0xef0d=['Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x499ccc,_0x45b1a1){var _0x1fcbf7=function(_0x4d3ad3){while(--_0x4d3ad3){_0x499ccc['push'](_0x499ccc['shift']());}};_0x1fcbf7(++_0x45b1a1);}(_0xef0d,0xc3));var _0xdef0=function(_0x24e98b,_0x536f67){_0x24e98b=_0x24e98b-0x0;var _0x277629=_0xef0d[_0x24e98b];return _0x277629;};'use strict';var multer=require(_0xdef0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdef0('0x1'));var express=require(_0xdef0('0x2'));var router=express[_0xdef0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdef0('0x4'));var config=require(_0xdef0('0x5'));var controller=require(_0xdef0('0x6'));router[_0xdef0('0x7')]('/',auth[_0xdef0('0x8')](),controller[_0xdef0('0x9')]);router[_0xdef0('0x7')](_0xdef0('0xa'),auth[_0xdef0('0x8')](),controller[_0xdef0('0xb')]);router[_0xdef0('0xc')]('/',auth[_0xdef0('0x8')](),controller[_0xdef0('0xd')]);router[_0xdef0('0xe')](_0xdef0('0xa'),auth[_0xdef0('0x8')](),controller['update']);router[_0xdef0('0xf')](_0xdef0('0xa'),auth[_0xdef0('0x8')](),controller[_0xdef0('0x10')]);module[_0xdef0('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 69f067d..c38cbcd 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 _0x1b16=['name','STRING'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x1b16,0x10d));var _0x61b1=function(_0x418630,_0x67e4ec){_0x418630=_0x418630-0x0;var _0x8bb2cb=_0x1b16[_0x418630];return _0x8bb2cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x61b1('0x0')],'unique':_0x61b1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x61b1('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x61b1('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x61b1('0x0')]},'city':{'type':Sequelize[_0x61b1('0x0')]},'country':{'type':Sequelize[_0x61b1('0x0')]},'email':{'type':Sequelize[_0x61b1('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x61b1('0x0')]},'sPostalCode':{'type':Sequelize[_0x61b1('0x0')]},'sCity':{'type':Sequelize[_0x61b1('0x0')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x61b1('0x0')]}}; \ No newline at end of file +var _0xb002=['sequelize','exports','name','STRING'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0xb002,0x1ec));var _0x2b00=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb002[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x2b00('0x0'));module[_0x2b00('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b00('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2b00('0x3')]},'companyId':{'type':Sequelize[_0x2b00('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x2b00('0x3')]},'type':{'type':Sequelize[_0x2b00('0x3')]},'street':{'type':Sequelize[_0x2b00('0x3')]},'postalCode':{'type':Sequelize[_0x2b00('0x3')]},'city':{'type':Sequelize[_0x2b00('0x3')]},'country':{'type':Sequelize[_0x2b00('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2b00('0x3')]},'sStreet':{'type':Sequelize[_0x2b00('0x3')]},'sPostalCode':{'type':Sequelize[_0x2b00('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x2b00('0x3')]},'description':{'type':Sequelize[_0x2b00('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9238889..6078deb 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 _0xe653=['path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','stack','name','send','CmCompany','describe','keys','query','model','attributes','intersection','fields','length','limit','sort','where','filter','map','merge','count','includeAll','include','rows','catch','show','rawAttributes','filters','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','CmContact','addContacts','ids','omit','getContacts','findOne','pick','options','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x22d57e,_0x4aba81){var _0x3d0ad4=function(_0x271113){while(--_0x271113){_0x22d57e['push'](_0x22d57e['shift']());}};_0x3d0ad4(++_0x4aba81);}(_0xe653,0xf8));var _0x3e65=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xe653[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0x3e65('0x0'));var emlformat=require(_0x3e65('0x1'));var rimraf=require(_0x3e65('0x2'));var zipdir=require(_0x3e65('0x3'));var jsonpatch=require(_0x3e65('0x4'));var rp=require(_0x3e65('0x5'));var moment=require(_0x3e65('0x6'));var BPromise=require(_0x3e65('0x7'));var Mustache=require(_0x3e65('0x8'));var util=require(_0x3e65('0x9'));var path=require(_0x3e65('0xa'));var sox=require('sox');var csv=require(_0x3e65('0xb'));var ejs=require(_0x3e65('0xc'));var fs=require('fs');var _=require(_0x3e65('0xd'));var squel=require(_0x3e65('0xe'));var crypto=require('crypto');var jsforce=require(_0x3e65('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3e65('0xb'));var querystring=require(_0x3e65('0x10'));var Papa=require(_0x3e65('0x11'));var Redis=require('ioredis');var authService=require(_0x3e65('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3e65('0x13'));var hardwareService=require(_0x3e65('0x14'));var logger=require('../../config/logger')(_0x3e65('0x15'));var utils=require(_0x3e65('0x16'));var config=require(_0x3e65('0x17'));var db=require(_0x3e65('0x18'))['db'];function respondWithStatusCode(_0xc5ffe5,_0xc950e0){_0xc950e0=_0xc950e0||0xcc;return function(_0x3e5b22){if(_0x3e5b22){return _0xc5ffe5[_0x3e65('0x19')](_0xc950e0);}return _0xc5ffe5[_0x3e65('0x1a')](_0xc950e0)[_0x3e65('0x1b')]();};}function respondWithResult(_0x37b303,_0x48aa0d){_0x48aa0d=_0x48aa0d||0xc8;return function(_0x1a297c){if(_0x1a297c){return _0x37b303[_0x3e65('0x1a')](_0x48aa0d)[_0x3e65('0x1c')](_0x1a297c);}};}function respondWithFilteredResult(_0x3eb772,_0x3eeff6){return function(_0x5c39d4){if(_0x5c39d4){var _0x3d6242=_0x5c39d4['count'],_0x6dd615=_0x3eeff6['offset'],_0x217267=_0x3eeff6[_0x3e65('0x1d')]+_0x3eeff6['limit'],_0x1eb9c8;if(_0x217267>=_0x3d6242){_0x217267=_0x3d6242;_0x1eb9c8=0xc8;}else{_0x1eb9c8=0xce;}_0x3eb772[_0x3e65('0x1a')](_0x1eb9c8);return _0x3eb772[_0x3e65('0x1e')](_0x3e65('0x1f'),_0x6dd615+'-'+_0x217267+'/'+_0x3d6242)[_0x3e65('0x1c')](_0x5c39d4);}return null;};}function patchUpdates(_0x36eab7){return function(_0x586c5e){try{jsonpatch[_0x3e65('0x20')](_0x586c5e,_0x36eab7,!![]);}catch(_0x4a0f0f){return BPromise[_0x3e65('0x21')](_0x4a0f0f);}return _0x586c5e[_0x3e65('0x22')]();};}function saveUpdates(_0x4a4a46,_0x1ce398){return function(_0x542f43){if(_0x542f43){return _0x542f43[_0x3e65('0x23')](_0x4a4a46)['then'](function(_0x196e8d){return _0x196e8d;});}return null;};}function removeEntity(_0x31c468,_0x22ce30){return function(_0x12053a){if(_0x12053a){return _0x12053a[_0x3e65('0x24')]()[_0x3e65('0x25')](function(){var _0x1007a5=_0x12053a[_0x3e65('0x26')]({'plain':!![]});var _0x2b7e46=_0x3e65('0x27');return db[_0x3e65('0x28')]['destroy']({'where':{'type':_0x2b7e46,'resourceId':_0x1007a5['id']}})[_0x3e65('0x25')](function(){return _0x12053a;});})['then'](function(){_0x31c468[_0x3e65('0x1a')](0xcc)[_0x3e65('0x1b')]();});}};}function handleEntityNotFound(_0xc8f8d8,_0x20f20b){return function(_0x525b41){if(!_0x525b41){_0xc8f8d8[_0x3e65('0x19')](0x194);}return _0x525b41;};}function handleError(_0x41a5d9,_0x55aa7b){_0x55aa7b=_0x55aa7b||0x1f4;return function(_0x5ca9a0){logger['error'](_0x5ca9a0[_0x3e65('0x29')]);if(_0x5ca9a0[_0x3e65('0x2a')]){delete _0x5ca9a0[_0x3e65('0x2a')];}_0x41a5d9[_0x3e65('0x1a')](_0x55aa7b)[_0x3e65('0x2b')](_0x5ca9a0);};}exports['index']=function(_0x323336,_0x129b18){var _0x139006={},_0x1017ab={},_0x5b5dcf={'count':0x0,'rows':[]};return db[_0x3e65('0x2c')][_0x3e65('0x2d')]()[_0x3e65('0x25')](function(_0x787f16){_0x1017ab['model']=_[_0x3e65('0x2e')](_0x787f16);_0x1017ab[_0x3e65('0x2f')]=_[_0x3e65('0x2e')](_0x323336[_0x3e65('0x2f')]);_0x1017ab['filters']=_['intersection'](_0x1017ab[_0x3e65('0x30')],_0x1017ab[_0x3e65('0x2f')]);_0x139006[_0x3e65('0x31')]=_[_0x3e65('0x32')](_0x1017ab[_0x3e65('0x30')],qs[_0x3e65('0x33')](_0x323336['query']['fields']));_0x139006[_0x3e65('0x31')]=_0x139006['attributes'][_0x3e65('0x34')]?_0x139006[_0x3e65('0x31')]:_0x1017ab['model'];if(!_0x323336[_0x3e65('0x2f')]['hasOwnProperty']('nolimit')){_0x139006['limit']=qs[_0x3e65('0x35')](_0x323336['query'][_0x3e65('0x35')]);_0x139006[_0x3e65('0x1d')]=qs[_0x3e65('0x1d')](_0x323336['query'][_0x3e65('0x1d')]);}_0x139006['order']=qs[_0x3e65('0x36')](_0x323336[_0x3e65('0x2f')][_0x3e65('0x36')]);_0x139006[_0x3e65('0x37')]=qs['filters'](_['pick'](_0x323336[_0x3e65('0x2f')],_0x1017ab['filters']),_0x787f16);if(_0x323336[_0x3e65('0x2f')][_0x3e65('0x38')]){_0x139006['where']=_['merge'](_0x139006[_0x3e65('0x37')],{'$or':_[_0x3e65('0x39')](_0x139006['attributes'],function(_0x661876){var _0x33e1a2={};_0x33e1a2[_0x661876]={'$like':'%'+_0x323336[_0x3e65('0x2f')]['filter']+'%'};return _0x33e1a2;})});}_0x139006=_[_0x3e65('0x3a')]({},_0x139006,_0x323336['options']);var _0x195df4={'where':_0x139006[_0x3e65('0x37')]};return db[_0x3e65('0x2c')]['count'](_0x195df4)[_0x3e65('0x25')](function(_0x3a79c1){_0x5b5dcf[_0x3e65('0x3b')]=_0x3a79c1;if(_0x323336[_0x3e65('0x2f')][_0x3e65('0x3c')]){_0x139006[_0x3e65('0x3d')]=[{'all':!![]}];}return db[_0x3e65('0x2c')]['findAll'](_0x139006);})[_0x3e65('0x25')](function(_0x483571){_0x5b5dcf[_0x3e65('0x3e')]=_0x483571;return _0x5b5dcf;})[_0x3e65('0x25')](respondWithFilteredResult(_0x129b18,_0x139006))['catch'](handleError(_0x129b18,null));})[_0x3e65('0x3f')](handleError(_0x129b18,null));};exports[_0x3e65('0x40')]=function(_0x24bab3,_0x4038c4){var _0xf14a31={'raw':![],'where':{'id':_0x24bab3['params']['id']}},_0x3b53ad={};_0x3b53ad[_0x3e65('0x30')]=_[_0x3e65('0x2e')](db[_0x3e65('0x2c')][_0x3e65('0x41')]);_0x3b53ad[_0x3e65('0x2f')]=_[_0x3e65('0x2e')](_0x24bab3[_0x3e65('0x2f')]);_0x3b53ad[_0x3e65('0x42')]=_['intersection'](_0x3b53ad['model'],_0x3b53ad['query']);_0xf14a31['attributes']=_[_0x3e65('0x32')](_0x3b53ad['model'],qs[_0x3e65('0x33')](_0x24bab3[_0x3e65('0x2f')][_0x3e65('0x33')]));_0xf14a31[_0x3e65('0x31')]=_0xf14a31[_0x3e65('0x31')][_0x3e65('0x34')]?_0xf14a31[_0x3e65('0x31')]:_0x3b53ad['model'];if(_0x24bab3[_0x3e65('0x2f')][_0x3e65('0x3c')]){_0xf14a31[_0x3e65('0x3d')]=[{'all':!![]}];}_0xf14a31=_[_0x3e65('0x3a')]({},_0xf14a31,_0x24bab3['options']);return db[_0x3e65('0x2c')][_0x3e65('0x43')](_0xf14a31)[_0x3e65('0x25')](handleEntityNotFound(_0x4038c4,null))['then'](respondWithResult(_0x4038c4,null))[_0x3e65('0x3f')](handleError(_0x4038c4,null));};exports[_0x3e65('0x44')]=function(_0x162091,_0x4917c6){return db[_0x3e65('0x2c')][_0x3e65('0x44')](_0x162091['body'],{})['then'](function(_0x124c5d){var _0x574c64=_0x162091[_0x3e65('0x45')][_0x3e65('0x26')]({'plain':!![]});if(!_0x574c64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x574c64[_0x3e65('0x46')]===_0x3e65('0x45')){var _0x54518d=_0x124c5d[_0x3e65('0x26')]({'plain':!![]});var _0xa6f466=_0x3e65('0x27');return db[_0x3e65('0x47')][_0x3e65('0x43')]({'where':{'name':_0xa6f466,'userProfileId':_0x574c64[_0x3e65('0x48')]},'raw':!![]})[_0x3e65('0x25')](function(_0x5d1efb){if(_0x5d1efb&&_0x5d1efb[_0x3e65('0x49')]===0x0){return db[_0x3e65('0x28')][_0x3e65('0x44')]({'name':_0x54518d[_0x3e65('0x2a')],'resourceId':_0x54518d['id'],'type':_0x5d1efb[_0x3e65('0x2a')],'sectionId':_0x5d1efb['id']},{})[_0x3e65('0x25')](function(){return _0x124c5d;});}else{return _0x124c5d;}})['catch'](function(_0x5eb129){logger[_0x3e65('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eb129);throw _0x5eb129;});}return _0x124c5d;})[_0x3e65('0x25')](respondWithResult(_0x4917c6,0xc9))[_0x3e65('0x3f')](handleError(_0x4917c6,null));};exports[_0x3e65('0x23')]=function(_0x52e37c,_0x100c42){if(_0x52e37c[_0x3e65('0x4b')]['id']){delete _0x52e37c[_0x3e65('0x4b')]['id'];}return db[_0x3e65('0x2c')]['find']({'where':{'id':_0x52e37c[_0x3e65('0x4c')]['id']}})[_0x3e65('0x25')](handleEntityNotFound(_0x100c42,null))['then'](saveUpdates(_0x52e37c[_0x3e65('0x4b')],null))['then'](respondWithResult(_0x100c42,null))[_0x3e65('0x3f')](handleError(_0x100c42,null));};exports[_0x3e65('0x24')]=function(_0x32e573,_0x17d2a8){return db[_0x3e65('0x2c')][_0x3e65('0x43')]({'where':{'id':_0x32e573['params']['id']}})['then'](handleEntityNotFound(_0x17d2a8,null))['then'](removeEntity(_0x17d2a8,null))[_0x3e65('0x3f')](handleError(_0x17d2a8,null));};exports[_0x3e65('0x2d')]=function(_0x249253,_0x285a17){return db[_0x3e65('0x2c')]['describe']()[_0x3e65('0x25')](respondWithResult(_0x285a17,null))[_0x3e65('0x3f')](handleError(_0x285a17,null));};exports['addContacts']=function(_0x59f7a8,_0x1496fa,_0x4fa8a0){return db[_0x3e65('0x4d')][_0x3e65('0x43')]({'where':{'id':_0x59f7a8[_0x3e65('0x4c')]['id']}})[_0x3e65('0x25')](handleEntityNotFound(_0x1496fa,null))[_0x3e65('0x25')](function(_0x3856b2){if(_0x3856b2){return _0x3856b2[_0x3e65('0x4e')](_0x59f7a8[_0x3e65('0x4b')][_0x3e65('0x4f')],_[_0x3e65('0x50')](_0x59f7a8[_0x3e65('0x4b')],[_0x3e65('0x4f'),'id'])||{});}})[_0x3e65('0x25')](respondWithResult(_0x1496fa,null))[_0x3e65('0x3f')](handleError(_0x1496fa,null));};exports[_0x3e65('0x51')]=function(_0x60827c,_0xe87629,_0x37b89a){var _0x561cf6={};var _0x6c5f4a={};var _0x4d1ee0;var _0x1fa02c;return db[_0x3e65('0x2c')][_0x3e65('0x52')]({'where':{'id':_0x60827c[_0x3e65('0x4c')]['id']}})[_0x3e65('0x25')](handleEntityNotFound(_0xe87629,null))[_0x3e65('0x25')](function(_0x342e54){if(_0x342e54){_0x4d1ee0=_0x342e54;_0x6c5f4a[_0x3e65('0x30')]=_[_0x3e65('0x2e')](db[_0x3e65('0x4d')][_0x3e65('0x41')]);_0x6c5f4a[_0x3e65('0x2f')]=_['keys'](_0x60827c[_0x3e65('0x2f')]);_0x6c5f4a[_0x3e65('0x42')]=_[_0x3e65('0x32')](_0x6c5f4a[_0x3e65('0x30')],_0x6c5f4a[_0x3e65('0x2f')]);_0x561cf6[_0x3e65('0x31')]=_[_0x3e65('0x32')](_0x6c5f4a[_0x3e65('0x30')],qs[_0x3e65('0x33')](_0x60827c[_0x3e65('0x2f')][_0x3e65('0x33')]));_0x561cf6['attributes']=_0x561cf6[_0x3e65('0x31')][_0x3e65('0x34')]?_0x561cf6[_0x3e65('0x31')]:_0x6c5f4a[_0x3e65('0x30')];_0x561cf6['order']=qs[_0x3e65('0x36')](_0x60827c[_0x3e65('0x2f')]['sort']);_0x561cf6['where']=qs[_0x3e65('0x42')](_[_0x3e65('0x53')](_0x60827c[_0x3e65('0x2f')],_0x6c5f4a[_0x3e65('0x42')]));if(_0x60827c[_0x3e65('0x2f')][_0x3e65('0x38')]){_0x561cf6[_0x3e65('0x37')]=_[_0x3e65('0x3a')](_0x561cf6[_0x3e65('0x37')],{'$or':_[_0x3e65('0x39')](_0x561cf6[_0x3e65('0x31')],function(_0xf15391){var _0x5132dc={};_0x5132dc[_0xf15391]={'$like':'%'+_0x60827c[_0x3e65('0x2f')][_0x3e65('0x38')]+'%'};return _0x5132dc;})});}_0x561cf6=_['merge']({},_0x561cf6,_0x60827c[_0x3e65('0x54')]);return _0x4d1ee0[_0x3e65('0x51')](_0x561cf6);}})[_0x3e65('0x25')](function(_0x3aefaf){if(_0x3aefaf){_0x1fa02c=_0x3aefaf[_0x3e65('0x34')];if(!_0x60827c[_0x3e65('0x2f')]['hasOwnProperty'](_0x3e65('0x55'))){_0x561cf6['limit']=qs['limit'](_0x60827c[_0x3e65('0x2f')][_0x3e65('0x35')]);_0x561cf6[_0x3e65('0x1d')]=qs[_0x3e65('0x1d')](_0x60827c[_0x3e65('0x2f')][_0x3e65('0x1d')]);}return _0x4d1ee0[_0x3e65('0x51')](_0x561cf6);}})[_0x3e65('0x25')](function(_0x5ddcf1){if(_0x5ddcf1){return _0x5ddcf1?{'count':_0x1fa02c,'rows':_0x5ddcf1}:null;}})[_0x3e65('0x25')](respondWithResult(_0xe87629,null))[_0x3e65('0x3f')](handleError(_0xe87629,null));}; \ No newline at end of file +var _0x0ddc=['filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','findOne','map','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','send','index','CmCompany','describe','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x206915,_0x5d88cf){var _0x446548=function(_0xc83cf0){while(--_0xc83cf0){_0x206915['push'](_0x206915['shift']());}};_0x446548(++_0x5d88cf);}(_0x0ddc,0x1da));var _0xc0dd=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x0ddc[_0x243b2f];return _0xcb3c2d;};'use strict';var pdf=require(_0xc0dd('0x0'));var emlformat=require(_0xc0dd('0x1'));var rimraf=require(_0xc0dd('0x2'));var zipdir=require(_0xc0dd('0x3'));var jsonpatch=require(_0xc0dd('0x4'));var rp=require(_0xc0dd('0x5'));var moment=require(_0xc0dd('0x6'));var BPromise=require(_0xc0dd('0x7'));var Mustache=require(_0xc0dd('0x8'));var util=require('util');var path=require(_0xc0dd('0x9'));var sox=require(_0xc0dd('0xa'));var csv=require(_0xc0dd('0xb'));var ejs=require(_0xc0dd('0xc'));var fs=require('fs');var _=require(_0xc0dd('0xd'));var squel=require(_0xc0dd('0xe'));var crypto=require('crypto');var jsforce=require(_0xc0dd('0xf'));var deskjs=require(_0xc0dd('0x10'));var toCsv=require(_0xc0dd('0xb'));var querystring=require(_0xc0dd('0x11'));var Papa=require(_0xc0dd('0x12'));var Redis=require(_0xc0dd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc0dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0dd('0x15'))(_0xc0dd('0x16'));var utils=require(_0xc0dd('0x17'));var config=require(_0xc0dd('0x18'));var db=require(_0xc0dd('0x19'))['db'];function respondWithStatusCode(_0xfefa9e,_0x1a4259){_0x1a4259=_0x1a4259||0xcc;return function(_0x34366f){if(_0x34366f){return _0xfefa9e[_0xc0dd('0x1a')](_0x1a4259);}return _0xfefa9e[_0xc0dd('0x1b')](_0x1a4259)[_0xc0dd('0x1c')]();};}function respondWithResult(_0x5794c7,_0x4918ed){_0x4918ed=_0x4918ed||0xc8;return function(_0x1793fb){if(_0x1793fb){return _0x5794c7[_0xc0dd('0x1b')](_0x4918ed)['json'](_0x1793fb);}};}function respondWithFilteredResult(_0x27a58f,_0x3996f0){return function(_0x51ffba){if(_0x51ffba){var _0x309bda=_0x51ffba[_0xc0dd('0x1d')],_0x445911=_0x3996f0[_0xc0dd('0x1e')],_0x6aada9=_0x3996f0['offset']+_0x3996f0[_0xc0dd('0x1f')],_0x5d046f;if(_0x6aada9>=_0x309bda){_0x6aada9=_0x309bda;_0x5d046f=0xc8;}else{_0x5d046f=0xce;}_0x27a58f[_0xc0dd('0x1b')](_0x5d046f);return _0x27a58f[_0xc0dd('0x20')](_0xc0dd('0x21'),_0x445911+'-'+_0x6aada9+'/'+_0x309bda)[_0xc0dd('0x22')](_0x51ffba);}return null;};}function patchUpdates(_0x3b92fb){return function(_0x4ff507){try{jsonpatch['apply'](_0x4ff507,_0x3b92fb,!![]);}catch(_0x3a241f){return BPromise['reject'](_0x3a241f);}return _0x4ff507[_0xc0dd('0x23')]();};}function saveUpdates(_0x4bf346,_0x2444fe){return function(_0x8faa8c){if(_0x8faa8c){return _0x8faa8c[_0xc0dd('0x24')](_0x4bf346)[_0xc0dd('0x25')](function(_0x364091){return _0x364091;});}return null;};}function removeEntity(_0x4ca29,_0x36395f){return function(_0x1f2989){if(_0x1f2989){return _0x1f2989['destroy']()['then'](function(){var _0x37b2eb=_0x1f2989[_0xc0dd('0x26')]({'plain':!![]});var _0x2f7b70=_0xc0dd('0x27');return db[_0xc0dd('0x28')][_0xc0dd('0x29')]({'where':{'type':_0x2f7b70,'resourceId':_0x37b2eb['id']}})['then'](function(){return _0x1f2989;});})[_0xc0dd('0x25')](function(){_0x4ca29['status'](0xcc)[_0xc0dd('0x1c')]();});}};}function handleEntityNotFound(_0x528470,_0x2e3719){return function(_0x457efe){if(!_0x457efe){_0x528470[_0xc0dd('0x1a')](0x194);}return _0x457efe;};}function handleError(_0x1b7d8e,_0x273ec3){_0x273ec3=_0x273ec3||0x1f4;return function(_0x1eb8fc){logger[_0xc0dd('0x2a')](_0x1eb8fc[_0xc0dd('0x2b')]);if(_0x1eb8fc['name']){delete _0x1eb8fc['name'];}_0x1b7d8e[_0xc0dd('0x1b')](_0x273ec3)[_0xc0dd('0x2c')](_0x1eb8fc);};}exports[_0xc0dd('0x2d')]=function(_0x1fe6f0,_0x5afa55){var _0x392f2e={},_0x11d582={},_0x456f42={'count':0x0,'rows':[]};return db[_0xc0dd('0x2e')][_0xc0dd('0x2f')]()['then'](function(_0x37ce4d){_0x11d582[_0xc0dd('0x30')]=_['keys'](_0x37ce4d);_0x11d582['query']=_[_0xc0dd('0x31')](_0x1fe6f0[_0xc0dd('0x32')]);_0x11d582['filters']=_['intersection'](_0x11d582['model'],_0x11d582['query']);_0x392f2e[_0xc0dd('0x33')]=_[_0xc0dd('0x34')](_0x11d582[_0xc0dd('0x30')],qs[_0xc0dd('0x35')](_0x1fe6f0['query'][_0xc0dd('0x35')]));_0x392f2e[_0xc0dd('0x33')]=_0x392f2e[_0xc0dd('0x33')]['length']?_0x392f2e[_0xc0dd('0x33')]:_0x11d582['model'];if(!_0x1fe6f0[_0xc0dd('0x32')][_0xc0dd('0x36')]('nolimit')){_0x392f2e[_0xc0dd('0x1f')]=qs['limit'](_0x1fe6f0[_0xc0dd('0x32')][_0xc0dd('0x1f')]);_0x392f2e[_0xc0dd('0x1e')]=qs[_0xc0dd('0x1e')](_0x1fe6f0['query'][_0xc0dd('0x1e')]);}_0x392f2e[_0xc0dd('0x37')]=qs[_0xc0dd('0x38')](_0x1fe6f0[_0xc0dd('0x32')]['sort']);_0x392f2e[_0xc0dd('0x39')]=qs[_0xc0dd('0x3a')](_[_0xc0dd('0x3b')](_0x1fe6f0['query'],_0x11d582[_0xc0dd('0x3a')]),_0x37ce4d);if(_0x1fe6f0['query'][_0xc0dd('0x3c')]){_0x392f2e[_0xc0dd('0x39')]=_[_0xc0dd('0x3d')](_0x392f2e['where'],{'$or':_['map'](_0x392f2e['attributes'],function(_0x4b1fa2){var _0x3d58c7={};_0x3d58c7[_0x4b1fa2]={'$like':'%'+_0x1fe6f0[_0xc0dd('0x32')][_0xc0dd('0x3c')]+'%'};return _0x3d58c7;})});}_0x392f2e=_['merge']({},_0x392f2e,_0x1fe6f0[_0xc0dd('0x3e')]);var _0x23f1fc={'where':_0x392f2e[_0xc0dd('0x39')]};return db[_0xc0dd('0x2e')][_0xc0dd('0x1d')](_0x23f1fc)[_0xc0dd('0x25')](function(_0x48a71f){_0x456f42[_0xc0dd('0x1d')]=_0x48a71f;if(_0x1fe6f0[_0xc0dd('0x32')]['includeAll']){_0x392f2e[_0xc0dd('0x3f')]=[{'all':!![]}];}return db[_0xc0dd('0x2e')][_0xc0dd('0x40')](_0x392f2e);})['then'](function(_0x31e26c){_0x456f42[_0xc0dd('0x41')]=_0x31e26c;return _0x456f42;})['then'](respondWithFilteredResult(_0x5afa55,_0x392f2e))[_0xc0dd('0x42')](handleError(_0x5afa55,null));})[_0xc0dd('0x42')](handleError(_0x5afa55,null));};exports[_0xc0dd('0x43')]=function(_0x2d6a90,_0x213ad0){var _0x40c4e8={'raw':![],'where':{'id':_0x2d6a90[_0xc0dd('0x44')]['id']}},_0x588a38={};_0x588a38[_0xc0dd('0x30')]=_[_0xc0dd('0x31')](db['CmCompany']['rawAttributes']);_0x588a38[_0xc0dd('0x32')]=_[_0xc0dd('0x31')](_0x2d6a90[_0xc0dd('0x32')]);_0x588a38[_0xc0dd('0x3a')]=_[_0xc0dd('0x34')](_0x588a38['model'],_0x588a38['query']);_0x40c4e8[_0xc0dd('0x33')]=_[_0xc0dd('0x34')](_0x588a38['model'],qs[_0xc0dd('0x35')](_0x2d6a90[_0xc0dd('0x32')][_0xc0dd('0x35')]));_0x40c4e8[_0xc0dd('0x33')]=_0x40c4e8[_0xc0dd('0x33')][_0xc0dd('0x45')]?_0x40c4e8[_0xc0dd('0x33')]:_0x588a38[_0xc0dd('0x30')];if(_0x2d6a90[_0xc0dd('0x32')][_0xc0dd('0x46')]){_0x40c4e8[_0xc0dd('0x3f')]=[{'all':!![]}];}_0x40c4e8=_[_0xc0dd('0x3d')]({},_0x40c4e8,_0x2d6a90[_0xc0dd('0x3e')]);return db[_0xc0dd('0x2e')][_0xc0dd('0x47')](_0x40c4e8)[_0xc0dd('0x25')](handleEntityNotFound(_0x213ad0,null))['then'](respondWithResult(_0x213ad0,null))[_0xc0dd('0x42')](handleError(_0x213ad0,null));};exports['create']=function(_0x11f9f0,_0x532a05){return db[_0xc0dd('0x2e')][_0xc0dd('0x48')](_0x11f9f0[_0xc0dd('0x49')],{})[_0xc0dd('0x25')](function(_0x443777){var _0x25925c=_0x11f9f0[_0xc0dd('0x4a')][_0xc0dd('0x26')]({'plain':!![]});if(!_0x25925c)throw new Error(_0xc0dd('0x4b'));if(_0x25925c[_0xc0dd('0x4c')]===_0xc0dd('0x4a')){var _0x27f616=_0x443777[_0xc0dd('0x26')]({'plain':!![]});var _0x152da1='Companies';return db[_0xc0dd('0x4d')][_0xc0dd('0x47')]({'where':{'name':_0x152da1,'userProfileId':_0x25925c[_0xc0dd('0x4e')]},'raw':!![]})[_0xc0dd('0x25')](function(_0x3b77fe){if(_0x3b77fe&&_0x3b77fe[_0xc0dd('0x4f')]===0x0){return db[_0xc0dd('0x28')][_0xc0dd('0x48')]({'name':_0x27f616[_0xc0dd('0x50')],'resourceId':_0x27f616['id'],'type':_0x3b77fe[_0xc0dd('0x50')],'sectionId':_0x3b77fe['id']},{})[_0xc0dd('0x25')](function(){return _0x443777;});}else{return _0x443777;}})[_0xc0dd('0x42')](function(_0xec31b6){logger[_0xc0dd('0x2a')](_0xc0dd('0x51'),_0xec31b6);throw _0xec31b6;});}return _0x443777;})['then'](respondWithResult(_0x532a05,0xc9))[_0xc0dd('0x42')](handleError(_0x532a05,null));};exports[_0xc0dd('0x24')]=function(_0x2c021a,_0x51af24){if(_0x2c021a[_0xc0dd('0x49')]['id']){delete _0x2c021a[_0xc0dd('0x49')]['id'];}return db[_0xc0dd('0x2e')][_0xc0dd('0x47')]({'where':{'id':_0x2c021a['params']['id']}})[_0xc0dd('0x25')](handleEntityNotFound(_0x51af24,null))['then'](saveUpdates(_0x2c021a[_0xc0dd('0x49')],null))['then'](respondWithResult(_0x51af24,null))[_0xc0dd('0x42')](handleError(_0x51af24,null));};exports['destroy']=function(_0x22a937,_0xe6139b){return db[_0xc0dd('0x2e')][_0xc0dd('0x47')]({'where':{'id':_0x22a937[_0xc0dd('0x44')]['id']}})[_0xc0dd('0x25')](handleEntityNotFound(_0xe6139b,null))[_0xc0dd('0x25')](removeEntity(_0xe6139b,null))['catch'](handleError(_0xe6139b,null));};exports[_0xc0dd('0x2f')]=function(_0x490d25,_0x28137c){return db[_0xc0dd('0x2e')]['describe']()['then'](respondWithResult(_0x28137c,null))[_0xc0dd('0x42')](handleError(_0x28137c,null));};exports[_0xc0dd('0x52')]=function(_0x327822,_0x2f8025,_0x4ee184){return db[_0xc0dd('0x53')][_0xc0dd('0x47')]({'where':{'id':_0x327822[_0xc0dd('0x44')]['id']}})[_0xc0dd('0x25')](handleEntityNotFound(_0x2f8025,null))[_0xc0dd('0x25')](function(_0x151307){if(_0x151307){return _0x151307[_0xc0dd('0x52')](_0x327822['body'][_0xc0dd('0x54')],_['omit'](_0x327822[_0xc0dd('0x49')],[_0xc0dd('0x54'),'id'])||{});}})[_0xc0dd('0x25')](respondWithResult(_0x2f8025,null))[_0xc0dd('0x42')](handleError(_0x2f8025,null));};exports[_0xc0dd('0x55')]=function(_0x3fdabe,_0x3be96e,_0x10bafc){var _0x2991ac={};var _0x22aa10={};var _0xc4ef13;var _0x1575e5;return db[_0xc0dd('0x2e')][_0xc0dd('0x56')]({'where':{'id':_0x3fdabe['params']['id']}})[_0xc0dd('0x25')](handleEntityNotFound(_0x3be96e,null))['then'](function(_0x37a139){if(_0x37a139){_0xc4ef13=_0x37a139;_0x22aa10['model']=_[_0xc0dd('0x31')](db[_0xc0dd('0x53')]['rawAttributes']);_0x22aa10['query']=_[_0xc0dd('0x31')](_0x3fdabe[_0xc0dd('0x32')]);_0x22aa10[_0xc0dd('0x3a')]=_[_0xc0dd('0x34')](_0x22aa10[_0xc0dd('0x30')],_0x22aa10['query']);_0x2991ac['attributes']=_[_0xc0dd('0x34')](_0x22aa10[_0xc0dd('0x30')],qs[_0xc0dd('0x35')](_0x3fdabe[_0xc0dd('0x32')][_0xc0dd('0x35')]));_0x2991ac['attributes']=_0x2991ac[_0xc0dd('0x33')][_0xc0dd('0x45')]?_0x2991ac[_0xc0dd('0x33')]:_0x22aa10[_0xc0dd('0x30')];_0x2991ac[_0xc0dd('0x37')]=qs[_0xc0dd('0x38')](_0x3fdabe[_0xc0dd('0x32')]['sort']);_0x2991ac[_0xc0dd('0x39')]=qs['filters'](_['pick'](_0x3fdabe[_0xc0dd('0x32')],_0x22aa10[_0xc0dd('0x3a')]));if(_0x3fdabe[_0xc0dd('0x32')][_0xc0dd('0x3c')]){_0x2991ac[_0xc0dd('0x39')]=_[_0xc0dd('0x3d')](_0x2991ac[_0xc0dd('0x39')],{'$or':_[_0xc0dd('0x57')](_0x2991ac[_0xc0dd('0x33')],function(_0x3f587a){var _0x221044={};_0x221044[_0x3f587a]={'$like':'%'+_0x3fdabe[_0xc0dd('0x32')][_0xc0dd('0x3c')]+'%'};return _0x221044;})});}_0x2991ac=_[_0xc0dd('0x3d')]({},_0x2991ac,_0x3fdabe[_0xc0dd('0x3e')]);return _0xc4ef13['getContacts'](_0x2991ac);}})[_0xc0dd('0x25')](function(_0x593ecc){if(_0x593ecc){_0x1575e5=_0x593ecc[_0xc0dd('0x45')];if(!_0x3fdabe[_0xc0dd('0x32')]['hasOwnProperty'](_0xc0dd('0x58'))){_0x2991ac['limit']=qs['limit'](_0x3fdabe['query'][_0xc0dd('0x1f')]);_0x2991ac[_0xc0dd('0x1e')]=qs[_0xc0dd('0x1e')](_0x3fdabe['query']['offset']);}return _0xc4ef13[_0xc0dd('0x55')](_0x2991ac);}})['then'](function(_0x47b2cb){if(_0x47b2cb){return _0x47b2cb?{'count':_0x1575e5,'rows':_0x47b2cb}:null;}})['then'](respondWithResult(_0x3be96e,null))['catch'](handleError(_0x3be96e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8095c2d..0e77b7b 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 _0xf51f=['define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x5afbc2,_0x29aab5){var _0xe98381=function(_0x33038f){while(--_0x33038f){_0x5afbc2['push'](_0x5afbc2['shift']());}};_0xe98381(++_0x29aab5);}(_0xf51f,0x195));var _0xff51=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xf51f[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0xff51('0x0'));var util=require(_0xff51('0x1'));var logger=require(_0xff51('0x2'))(_0xff51('0x3'));var moment=require(_0xff51('0x4'));var BPromise=require('bluebird');var rp=require(_0xff51('0x5'));var fs=require('fs');var path=require(_0xff51('0x6'));var rimraf=require(_0xff51('0x7'));var config=require(_0xff51('0x8'));var attributes=require(_0xff51('0x9'));module[_0xff51('0xa')]=function(_0x2a221a,_0x166851){return _0x2a221a[_0xff51('0xb')]('CmCompany',attributes,{'tableName':_0xff51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87eb=['../../config/environment','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x122fbb,_0x42e04e){var _0x1882c7=function(_0x2cabd5){while(--_0x2cabd5){_0x122fbb['push'](_0x122fbb['shift']());}};_0x1882c7(++_0x42e04e);}(_0x87eb,0xc5));var _0xb87e=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x87eb[_0x599e60];return _0x468e19;};'use strict';var _=require(_0xb87e('0x0'));var util=require('util');var logger=require(_0xb87e('0x1'))(_0xb87e('0x2'));var moment=require(_0xb87e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb87e('0x4'));var fs=require('fs');var path=require(_0xb87e('0x5'));var rimraf=require(_0xb87e('0x6'));var config=require(_0xb87e('0x7'));var attributes=require('./cmCompany.attributes');module[_0xb87e('0x8')]=function(_0x3177be,_0xde2ea){return _0x3177be[_0xb87e('0x9')](_0xb87e('0xa'),attributes,{'tableName':_0xb87e('0xb'),'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 a308037..5b66387 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 _0xd0fb=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xd0fb,0x114));var _0xbd0f=function(_0xff5fce,_0x92139){_0xff5fce=_0xff5fce-0x0;var _0x377246=_0xd0fb[_0xff5fce];return _0x377246;};'use strict';var _=require(_0xbd0f('0x0'));var util=require(_0xbd0f('0x1'));var moment=require(_0xbd0f('0x2'));var BPromise=require(_0xbd0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0f('0x4'))['db'];var utils=require(_0xbd0f('0x5'));var logger=require(_0xbd0f('0x6'))('rpc');var config=require(_0xbd0f('0x7'));var jayson=require(_0xbd0f('0x8'));var client=jayson[_0xbd0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20e4c8,_0x2f2801,_0x573084){return new BPromise(function(_0x43ce8b,_0x59d92b){return client[_0xbd0f('0xa')](_0x20e4c8,_0x573084)[_0xbd0f('0xb')](function(_0x42d33d){logger[_0xbd0f('0xc')](_0xbd0f('0xd'),_0x2f2801,_0xbd0f('0xe'));logger[_0xbd0f('0xf')](_0xbd0f('0x10'),_0x2f2801,_0xbd0f('0xe'),JSON[_0xbd0f('0x11')](_0x42d33d));if(_0x42d33d[_0xbd0f('0x12')]){if(_0x42d33d[_0xbd0f('0x12')][_0xbd0f('0x13')]===0x1f4){logger[_0xbd0f('0x12')](_0xbd0f('0xd'),_0x2f2801,_0x42d33d[_0xbd0f('0x12')][_0xbd0f('0x14')]);return _0x59d92b(_0x42d33d['error'][_0xbd0f('0x14')]);}logger['error'](_0xbd0f('0xd'),_0x2f2801,_0x42d33d[_0xbd0f('0x12')]['message']);return _0x43ce8b(_0x42d33d[_0xbd0f('0x12')]['message']);}else{logger[_0xbd0f('0xc')](_0xbd0f('0xd'),_0x2f2801,_0xbd0f('0xe'));_0x43ce8b(_0x42d33d[_0xbd0f('0x15')][_0xbd0f('0x14')]);}})[_0xbd0f('0x16')](function(_0xa09641){logger['error'](_0xbd0f('0xd'),_0x2f2801,_0xa09641);_0x59d92b(_0xa09641);});});} \ No newline at end of file +var _0x1d33=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','CmCompany,\x20%s,\x20%s'];(function(_0x28b7a2,_0x40aa58){var _0x404e08=function(_0x5e2894){while(--_0x5e2894){_0x28b7a2['push'](_0x28b7a2['shift']());}};_0x404e08(++_0x40aa58);}(_0x1d33,0x119));var _0x31d3=function(_0x1720aa,_0x2c7368){_0x1720aa=_0x1720aa-0x0;var _0x476dc6=_0x1d33[_0x1720aa];return _0x476dc6;};'use strict';var _=require(_0x31d3('0x0'));var util=require(_0x31d3('0x1'));var moment=require(_0x31d3('0x2'));var BPromise=require(_0x31d3('0x3'));var rs=require(_0x31d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d3('0x5'))['db'];var utils=require(_0x31d3('0x6'));var logger=require(_0x31d3('0x7'))('rpc');var config=require(_0x31d3('0x8'));var jayson=require(_0x31d3('0x9'));var client=jayson[_0x31d3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249e1b,_0x42dbb9,_0x51f577){return new BPromise(function(_0x57f5a6,_0x1e6ebb){return client['request'](_0x249e1b,_0x51f577)['then'](function(_0x306200){logger[_0x31d3('0xb')](_0x31d3('0xc'),_0x42dbb9,'request\x20sent');logger['debug'](_0x31d3('0xd'),_0x42dbb9,_0x31d3('0xe'),JSON[_0x31d3('0xf')](_0x306200));if(_0x306200[_0x31d3('0x10')]){if(_0x306200['error'][_0x31d3('0x11')]===0x1f4){logger['error'](_0x31d3('0xc'),_0x42dbb9,_0x306200[_0x31d3('0x10')][_0x31d3('0x12')]);return _0x1e6ebb(_0x306200[_0x31d3('0x10')]['message']);}logger[_0x31d3('0x10')](_0x31d3('0xc'),_0x42dbb9,_0x306200[_0x31d3('0x10')][_0x31d3('0x12')]);return _0x57f5a6(_0x306200[_0x31d3('0x10')][_0x31d3('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x42dbb9,_0x31d3('0xe'));_0x57f5a6(_0x306200[_0x31d3('0x13')][_0x31d3('0x12')]);}})[_0x31d3('0x14')](function(_0x1f6bc0){logger[_0x31d3('0x10')](_0x31d3('0xc'),_0x42dbb9,_0x1f6bc0);_0x1e6ebb(_0x1f6bc0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b193d81..480495f 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 _0x34e8=['getContacts','post','create','addContacts','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','show','/:id/contacts'];(function(_0x2b84a3,_0x5bf282){var _0x35eadd=function(_0x3b92fa){while(--_0x3b92fa){_0x2b84a3['push'](_0x2b84a3['shift']());}};_0x35eadd(++_0x5bf282);}(_0x34e8,0x12c));var _0x834e=function(_0x6ee9f8,_0xd1cb53){_0x6ee9f8=_0x6ee9f8-0x0;var _0x303951=_0x34e8[_0x6ee9f8];return _0x303951;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x10')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0xc'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util'];(function(_0x104539,_0x508ec4){var _0x294ffa=function(_0x1ddd64){while(--_0x1ddd64){_0x104539['push'](_0x104539['shift']());}};_0x294ffa(++_0x508ec4);}(_0xedd9,0xfc));var _0x9edd=function(_0x5225c2,_0x3999c2){_0x5225c2=_0x5225c2-0x0;var _0x5a98f2=_0xedd9[_0x5225c2];return _0x5a98f2;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./cmCompany.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xf')]('/:id/contacts',auth[_0x9edd('0x9')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x14')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0x15')]);module[_0x9edd('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6986486..e317a0b 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 _0xff28=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0xff28,0x8f));var _0x8ff2=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0xff28[_0x5224ba];return _0x459bd2;};'use strict';var _=require(_0x8ff2('0x0'));var Sequelize=require(_0x8ff2('0x1'));module[_0x8ff2('0x2')]={'firstName':{'type':Sequelize[_0x8ff2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8ff2('0x3')]},'street':{'type':Sequelize[_0x8ff2('0x3')]},'postalCode':{'type':Sequelize[_0x8ff2('0x3')]},'city':{'type':Sequelize[_0x8ff2('0x3')]},'country':{'type':Sequelize[_0x8ff2('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8ff2('0x3')]},'description':{'type':Sequelize[_0x8ff2('0x4')]},'phone':{'type':Sequelize[_0x8ff2('0x3')]},'mobile':{'type':Sequelize[_0x8ff2('0x3')]},'fax':{'type':Sequelize[_0x8ff2('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8ff2('0x3')]},'facebook':{'type':Sequelize[_0x8ff2('0x3')]},'fb_data':{'type':Sequelize[_0x8ff2('0x3')]},'twitter':{'type':Sequelize[_0x8ff2('0x3')]},'skype':{'type':Sequelize[_0x8ff2('0x3')]},'teams':{'type':Sequelize[_0x8ff2('0x3')]},'viber':{'type':Sequelize[_0x8ff2('0x3')]},'line':{'type':Sequelize[_0x8ff2('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x8ff2('0x5')]},'priority':{'type':Sequelize[_0x8ff2('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8ff2('0x6')],'defaultValue':Sequelize[_0x8ff2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x8ff2('0x5')]}}; \ No newline at end of file +var _0xd1f2=['UNSIGNED','DATE','INTEGER','exports','STRING','TEXT'];(function(_0x372d30,_0x2a2770){var _0x19e29b=function(_0x2fd29c){while(--_0x2fd29c){_0x372d30['push'](_0x372d30['shift']());}};_0x19e29b(++_0x2a2770);}(_0xd1f2,0xed));var _0x2d1f=function(_0x5b702c,_0x42eaf3){_0x5b702c=_0x5b702c-0x0;var _0x29eb56=_0xd1f2[_0x5b702c];return _0x29eb56;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x2d1f('0x0')]={'firstName':{'type':Sequelize[_0x2d1f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2d1f('0x1')]},'postalCode':{'type':Sequelize[_0x2d1f('0x1')]},'city':{'type':Sequelize[_0x2d1f('0x1')]},'country':{'type':Sequelize[_0x2d1f('0x1')]},'dateOfBirth':{'type':Sequelize[_0x2d1f('0x1')]},'description':{'type':Sequelize[_0x2d1f('0x2')]},'phone':{'type':Sequelize[_0x2d1f('0x1')]},'mobile':{'type':Sequelize[_0x2d1f('0x1')]},'fax':{'type':Sequelize[_0x2d1f('0x1')]},'email':{'type':Sequelize[_0x2d1f('0x1')]},'url':{'type':Sequelize[_0x2d1f('0x1')]},'facebook':{'type':Sequelize[_0x2d1f('0x1')]},'fb_data':{'type':Sequelize[_0x2d1f('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x2d1f('0x1')]},'teams':{'type':Sequelize[_0x2d1f('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x2d1f('0x1')]},'wechat':{'type':Sequelize[_0x2d1f('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2d1f('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2d1f('0x4')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2d1f('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bb40b29..7189275 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 _0xff7c=['find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','castTo','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','tag','isArray','replace','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','User','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.firstName','c.lastName','c.fax','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','describe','tags','startsWith','displayName','CmCustomField','findAll','values','columnName','body','get','join','info','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','create','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','params','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','root','server/files/tmp','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','json','pid','upload','createReadStream','file','parse','meta','import','agent','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','CmContact','keys','length','cf_','push','findOne','all','type','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions'];(function(_0x9f27a8,_0x43168f){var _0x13b49a=function(_0x597e8f){while(--_0x597e8f){_0x9f27a8['push'](_0x9f27a8['shift']());}};_0x13b49a(++_0x43168f);}(_0xff7c,0x17e));var _0xcff7=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xff7c[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xcff7('0x0'));var emlformat=require(_0xcff7('0x1'));var rimraf=require(_0xcff7('0x2'));var zipdir=require(_0xcff7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcff7('0x4'));var moment=require(_0xcff7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcff7('0x6'));var util=require(_0xcff7('0x7'));var path=require(_0xcff7('0x8'));var sox=require(_0xcff7('0x9'));var csv=require(_0xcff7('0xa'));var ejs=require(_0xcff7('0xb'));var fs=require('fs');var _=require(_0xcff7('0xc'));var squel=require(_0xcff7('0xd'));var crypto=require(_0xcff7('0xe'));var jsforce=require(_0xcff7('0xf'));var deskjs=require(_0xcff7('0x10'));var toCsv=require(_0xcff7('0xa'));var querystring=require('querystring');var Papa=require(_0xcff7('0x11'));var Redis=require(_0xcff7('0x12'));var authService=require(_0xcff7('0x13'));var qs=require(_0xcff7('0x14'));var as=require(_0xcff7('0x15'));var hardwareService=require(_0xcff7('0x16'));var logger=require(_0xcff7('0x17'))(_0xcff7('0x18'));var utils=require(_0xcff7('0x19'));var config=require(_0xcff7('0x1a'));var db=require('../../mysqldb')['db'];config[_0xcff7('0x1b')]=_[_0xcff7('0x1c')](config[_0xcff7('0x1b')],{'host':_0xcff7('0x1d'),'port':0x18eb});var socket=require(_0xcff7('0x1e'))(new Redis(config['redis']));require(_0xcff7('0x1f'))[_0xcff7('0x20')](socket);function respondWithStatusCode(_0x194360,_0x30fba0){_0x30fba0=_0x30fba0||0xcc;return function(_0x59f76f){if(_0x59f76f){return _0x194360[_0xcff7('0x21')](_0x30fba0);}return _0x194360[_0xcff7('0x22')](_0x30fba0)[_0xcff7('0x23')]();};}function respondWithResult(_0xe13c80,_0x1c0795){_0x1c0795=_0x1c0795||0xc8;return function(_0x5b4328){if(_0x5b4328){return _0xe13c80['status'](_0x1c0795)['json'](_0x5b4328);}};}function respondWithFilteredResult(_0x562fa5,_0x10c0e2){return function(_0x50820c){if(_0x50820c){var _0x4c24c4=_0x50820c[_0xcff7('0x24')],_0x1bf4e4=_0x10c0e2[_0xcff7('0x25')],_0xaf75e7=_0x10c0e2[_0xcff7('0x25')]+_0x10c0e2['limit'],_0x90fed0;if(_0xaf75e7>=_0x4c24c4){_0xaf75e7=_0x4c24c4;_0x90fed0=0xc8;}else{_0x90fed0=0xce;}_0x562fa5[_0xcff7('0x22')](_0x90fed0);return _0x562fa5[_0xcff7('0x26')](_0xcff7('0x27'),_0x1bf4e4+'-'+_0xaf75e7+'/'+_0x4c24c4)['json'](_0x50820c);}return null;};}function patchUpdates(_0x54e0c7){return function(_0x34cf6b){try{jsonpatch[_0xcff7('0x28')](_0x34cf6b,_0x54e0c7,!![]);}catch(_0x12e1e1){return BPromise[_0xcff7('0x29')](_0x12e1e1);}return _0x34cf6b['save']();};}function saveUpdates(_0x55efe8,_0x35855e){return function(_0x372264){if(_0x372264){return _0x372264[_0xcff7('0x2a')](_0x55efe8)['then'](function(_0x12db3e){return _0x12db3e;});}return null;};}function removeEntity(_0x588950,_0x5ee199){return function(_0x450e06){if(_0x450e06){return _0x450e06[_0xcff7('0x2b')]()[_0xcff7('0x2c')](function(){_0x588950['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e0127,_0x4d8a46){return function(_0x35bf94){if(!_0x35bf94){_0x1e0127['sendStatus'](0x194);}return _0x35bf94;};}function handleError(_0x110702,_0xe462e7){_0xe462e7=_0xe462e7||0x1f4;return function(_0x416af9){logger[_0xcff7('0x2d')](_0x416af9[_0xcff7('0x2e')]);if(_0x416af9[_0xcff7('0x2f')]){delete _0x416af9['name'];}_0x110702['status'](_0xe462e7)[_0xcff7('0x30')](_0x416af9);};}exports[_0xcff7('0x31')]=function(_0x1ea6d0,_0x9fd756){var _0x3ea8a6={},_0x64b237={},_0x515426={'count':0x0,'rows':[]};return db[_0xcff7('0x32')]['describe']()['then'](function(_0x3237c3){var _0x6a5d09=[];for(var _0x303b1a=0x0;_0x303b1a0x1){_0x5b254a['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2d3dc8),null);}else{if(qs[_0xcff7('0x6f')](_0x2d3dc8)){_0x5b254a['or']('c.id\x20LIKE\x20?',_0x2d3dc8+'%');_0x5b254a['or']('c.phone\x20LIKE\x20?',_0x2d3dc8+'%');_0x5b254a['or'](_0xcff7('0x70'),_0x2d3dc8+'%');_0x5b254a['or'](_0xcff7('0x71'),_0x2d3dc8+'%');}else if(qs[_0xcff7('0x72')](_0x2d3dc8)){_0x5b254a['or'](_0xcff7('0x73'),_0x2d3dc8+'%');}else{_0x5b254a['or'](_0xcff7('0x74'),'%'+_0x2d3dc8+'%');_0x5b254a['or'](_0xcff7('0x75'),'%'+_0x2d3dc8+'%');_0x5b254a['or'](_0xcff7('0x73'),'%'+_0x2d3dc8+'%');}}}}_0xb748[_0xcff7('0x45')](_0x5b254a);_0xb748[_0xcff7('0x76')](_0xcff7('0x77'));var _0x2d10a3={'type':db[_0xcff7('0x78')]['QueryTypes']['SELECT'],'raw':!![]};var _0x49d215=_0xb748['clone']()['field'](_0xcff7('0x77'));if(_0x3ea8a6[_0xcff7('0x43')]){_0x3ea8a6[_0xcff7('0x43')]['forEach'](function(_0x6b16df){_0xb748[_0xcff7('0x43')]('c.'+_0x6b16df[0x0],_0x6b16df[0x1]===_0xcff7('0x79')?![]:!![]);});}if(!_[_0xcff7('0x7a')](_0x24f19d)){_0xb748[_0xcff7('0x7b')](_0x34956a);_0x49d215['where'](_0xcff7('0x7c'),_0x24f19d);}BPromise[_0xcff7('0x7d')]()[_0xcff7('0x2c')](function(){if(_0x9aeffb&&!_['some'](_0x9aeffb['conditions'],['field',_0xcff7('0x7e')])){return _0x1ea6d0[_0xcff7('0x7f')][_0xcff7('0x80')]({'attributes':['id'],'raw':!![]})[_0xcff7('0x2c')](function(_0x24a9f2){if(_[_0xcff7('0x7a')](_0x24a9f2)){_0x49d215[_0xcff7('0x45')](_0xcff7('0x81'));_0xb748[_0xcff7('0x45')](_0xcff7('0x81'));}else{_0x49d215['where'](_0xcff7('0x6a'),_[_0xcff7('0x5c')](_0x24a9f2,'id'));_0xb748[_0xcff7('0x45')](_0xcff7('0x6a'),_['map'](_0x24a9f2,'id'));}});}else{return;}})[_0xcff7('0x2c')](function(){db[_0xcff7('0x82')]['query'](_0x49d215[_0xcff7('0x83')](),_0x2d10a3)[_0xcff7('0x2c')](function(_0xf62a4f){_0x515426[_0xcff7('0x24')]=_0xf62a4f['length'];if(_0x515426[_0xcff7('0x24')]===0x0)return[];return db[_0xcff7('0x82')][_0xcff7('0x3a')](_0x4a1bd3[_0xcff7('0x83')](),_0x2d10a3);})[_0xcff7('0x2c')](function(_0x3e240e){_0x2b2953=_['keyBy'](_0x3e240e,'id');_0x2d10a3=_[_0xcff7('0x84')](_0x2d10a3,{'model':db[_0xcff7('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ea6d0['query']['fields']){_0x3ea8a6[_0xcff7('0x3f')][_0xcff7('0x5d')](function(_0x569d2c){_0xb748[_0xcff7('0x47')]('c.'+_0x569d2c);});}else{_0xb748[_0xcff7('0x47')](_0xcff7('0x77'));_0xb748[_0xcff7('0x47')](_0xcff7('0x85'));_0xb748[_0xcff7('0x47')](_0xcff7('0x86'));_0xb748[_0xcff7('0x47')]('c.phone');_0xb748[_0xcff7('0x47')]('c.mobile');_0xb748[_0xcff7('0x47')](_0xcff7('0x87'));_0xb748[_0xcff7('0x47')]('c.email');_0xb748['field'](_0xcff7('0x88'));_0xb748[_0xcff7('0x47')](_0xcff7('0x89'));_0xb748['field'](_0xcff7('0x8a'),_0xcff7('0x8b'));}if(_0x3ea8a6['limit'])_0xb748[_0xcff7('0x42')](_0x3ea8a6[_0xcff7('0x42')]);if(_0x3ea8a6[_0xcff7('0x25')])_0xb748['offset'](_0x3ea8a6[_0xcff7('0x25')]);return db['sequelize']['query'](_0xb748['toString'](),_0x2d10a3);})[_0xcff7('0x2c')](function(_0xe279ec){_0xe279ec[_0xcff7('0x5d')](function(_0xf21d42){if(_0xf21d42['TagIds']){_0xf21d42[_0xcff7('0x8c')]=[];_0xf21d42['TagIds'][_0xcff7('0x5b')](',')['forEach'](function(_0x3b3096){_0xf21d42[_0xcff7('0x8c')][_0xcff7('0x36')](_0x2b2953[_0x3b3096]);});}delete _0xf21d42[_0xcff7('0x8b')];});_0x515426[_0xcff7('0x8d')]=_0xe279ec;return _0x515426;})[_0xcff7('0x2c')](respondWithFilteredResult(_0x9fd756,_0x3ea8a6));});})[_0xcff7('0x8e')](handleError(_0x9fd756,null));};exports[_0xcff7('0x2b')]=function(_0x1e89bd,_0x108f3e){return db[_0xcff7('0x32')][_0xcff7('0x58')]({'where':{'id':_0x1e89bd['params']['id']}})[_0xcff7('0x2c')](handleEntityNotFound(_0x108f3e,null))[_0xcff7('0x2c')](removeEntity(_0x108f3e,null))['catch'](handleError(_0x108f3e,null));};exports[_0xcff7('0x8f')]=function(_0x2b56e4,_0x1a2def){return db[_0xcff7('0x32')][_0xcff7('0x8f')]()[_0xcff7('0x2c')](function(_0x48e2f2){delete _0x48e2f2[_0xcff7('0x90')];for(var _0x1e7279=0x0;_0x1e7279=_0x42914f){_0xf3a8=_0x42914f;_0x5a8b05=0xc8;}else{_0x5a8b05=0xce;}_0x44c13d[_0x1257('0x1c')](_0x5a8b05);return _0x44c13d['set'](_0x1257('0x22'),_0x3c7d00+'-'+_0xf3a8+'/'+_0x42914f)['json'](_0x2bb93a);}return null;};}function patchUpdates(_0x2c1916){return function(_0x2be8cb){try{jsonpatch[_0x1257('0x23')](_0x2be8cb,_0x2c1916,!![]);}catch(_0x1ca2a1){return BPromise[_0x1257('0x24')](_0x1ca2a1);}return _0x2be8cb[_0x1257('0x25')]();};}function saveUpdates(_0x5e3bf5,_0x42194f){return function(_0x3aeafa){if(_0x3aeafa){return _0x3aeafa['update'](_0x5e3bf5)['then'](function(_0x1f740a){return _0x1f740a;});}return null;};}function removeEntity(_0x123ebf,_0x4f27c1){return function(_0x194b81){if(_0x194b81){return _0x194b81[_0x1257('0x26')]()['then'](function(){_0x123ebf[_0x1257('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fdd0,_0x17780d){return function(_0x170af6){if(!_0x170af6){_0x38fdd0['sendStatus'](0x194);}return _0x170af6;};}function handleError(_0x165c54,_0x1f15c5){_0x1f15c5=_0x1f15c5||0x1f4;return function(_0x272b47){logger[_0x1257('0x27')](_0x272b47[_0x1257('0x28')]);if(_0x272b47['name']){delete _0x272b47[_0x1257('0x29')];}_0x165c54[_0x1257('0x1c')](_0x1f15c5)[_0x1257('0x2a')](_0x272b47);};}exports[_0x1257('0x2b')]=function(_0x1598f2,_0x18c21d){var _0xa2731e={},_0x430227={},_0x107fea={'count':0x0,'rows':[]};return db[_0x1257('0x2c')][_0x1257('0x2d')]()[_0x1257('0x2e')](function(_0x10be1c){var _0x39a312=[];for(var _0x3214a8=0x0;_0x3214a80x1){_0x23fbcf['or'](_0x1257('0x67'),qs[_0x1257('0x68')](_0x38bf4d),null);}else{if(qs['isNumeric'](_0x38bf4d)){_0x23fbcf['or'](_0x1257('0x69'),_0x38bf4d+'%');_0x23fbcf['or']('c.phone\x20LIKE\x20?',_0x38bf4d+'%');_0x23fbcf['or']('c.mobile\x20LIKE\x20?',_0x38bf4d+'%');_0x23fbcf['or'](_0x1257('0x6a'),_0x38bf4d+'%');}else if(qs[_0x1257('0x6b')](_0x38bf4d)){_0x23fbcf['or'](_0x1257('0x6c'),_0x38bf4d+'%');}else{_0x23fbcf['or'](_0x1257('0x6d'),'%'+_0x38bf4d+'%');_0x23fbcf['or'](_0x1257('0x6e'),'%'+_0x38bf4d+'%');_0x23fbcf['or'](_0x1257('0x6c'),'%'+_0x38bf4d+'%');}}}}_0xf0077['where'](_0x23fbcf);_0xf0077['group'](_0x1257('0x6f'));var _0xeefcef={'type':db[_0x1257('0x70')]['QueryTypes'][_0x1257('0x71')],'raw':!![]};var _0x110913=_0xf0077[_0x1257('0x72')]()[_0x1257('0x44')](_0x1257('0x6f'));if(_0xa2731e[_0x1257('0x73')]){_0xa2731e[_0x1257('0x73')][_0x1257('0x5e')](function(_0x3eb806){_0xf0077[_0x1257('0x73')]('c.'+_0x3eb806[0x0],_0x3eb806[0x1]===_0x1257('0x74')?![]:!![]);});}if(!_[_0x1257('0x5d')](_0x1b98cd)){_0xf0077[_0x1257('0x75')](_0x2344b7);_0x110913[_0x1257('0x41')](_0x1257('0x76'),_0x1b98cd);}BPromise[_0x1257('0x77')]()[_0x1257('0x2e')](function(){if(_0x1c4269&&!_[_0x1257('0x78')](_0x1c4269[_0x1257('0x51')],[_0x1257('0x44'),_0x1257('0x79')])){return _0x1598f2['user'][_0x1257('0x7a')]({'attributes':['id'],'raw':!![]})[_0x1257('0x2e')](function(_0x1017e2){if(_[_0x1257('0x5d')](_0x1017e2)){_0x110913[_0x1257('0x41')](_0x1257('0x7b'));_0xf0077['where'](_0x1257('0x7b'));}else{_0x110913[_0x1257('0x41')]('c.ListId\x20IN\x20?',_['map'](_0x1017e2,'id'));_0xf0077[_0x1257('0x41')](_0x1257('0x60'),_['map'](_0x1017e2,'id'));}});}else{return;}})[_0x1257('0x2e')](function(){db['sequelize']['query'](_0x110913[_0x1257('0x7c')](),_0xeefcef)['then'](function(_0x375c34){_0x107fea[_0x1257('0x1f')]=_0x375c34[_0x1257('0x30')];if(_0x107fea[_0x1257('0x1f')]===0x0)return[];return db[_0x1257('0x7d')][_0x1257('0x3a')](_0x380068[_0x1257('0x7c')](),_0xeefcef);})[_0x1257('0x2e')](function(_0x1cd97c){_0xa692e6=_[_0x1257('0x7e')](_0x1cd97c,'id');_0xeefcef=_[_0x1257('0x7f')](_0xeefcef,{'model':db[_0x1257('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1598f2[_0x1257('0x3a')][_0x1257('0x3e')]){_0xa2731e[_0x1257('0x3c')][_0x1257('0x5e')](function(_0x35511c){_0xf0077[_0x1257('0x44')]('c.'+_0x35511c);});}else{_0xf0077[_0x1257('0x44')](_0x1257('0x6f'));_0xf0077[_0x1257('0x44')](_0x1257('0x80'));_0xf0077[_0x1257('0x44')](_0x1257('0x81'));_0xf0077[_0x1257('0x44')](_0x1257('0x82'));_0xf0077[_0x1257('0x44')](_0x1257('0x83'));_0xf0077[_0x1257('0x44')](_0x1257('0x84'));_0xf0077['field']('c.email');_0xf0077[_0x1257('0x44')](_0x1257('0x85'));_0xf0077[_0x1257('0x44')](_0x1257('0x86'));_0xf0077['field'](_0x1257('0x87'),_0x1257('0x88'));}if(_0xa2731e['limit'])_0xf0077['limit'](_0xa2731e[_0x1257('0x21')]);if(_0xa2731e[_0x1257('0x20')])_0xf0077[_0x1257('0x20')](_0xa2731e[_0x1257('0x20')]);return db[_0x1257('0x7d')][_0x1257('0x3a')](_0xf0077[_0x1257('0x7c')](),_0xeefcef);})[_0x1257('0x2e')](function(_0x1fec6a){_0x1fec6a[_0x1257('0x5e')](function(_0x127a82){if(_0x127a82[_0x1257('0x88')]){_0x127a82[_0x1257('0x89')]=[];_0x127a82[_0x1257('0x88')][_0x1257('0x66')](',')[_0x1257('0x5e')](function(_0x3afa4a){_0x127a82[_0x1257('0x89')]['push'](_0xa692e6[_0x3afa4a]);});}delete _0x127a82[_0x1257('0x88')];});_0x107fea[_0x1257('0x8a')]=_0x1fec6a;return _0x107fea;})[_0x1257('0x2e')](respondWithFilteredResult(_0x18c21d,_0xa2731e));});})[_0x1257('0x8b')](handleError(_0x18c21d,null));};exports[_0x1257('0x26')]=function(_0x35ac3d,_0x4df918){return db[_0x1257('0x2c')][_0x1257('0x8c')]({'where':{'id':_0x35ac3d[_0x1257('0x8d')]['id']}})[_0x1257('0x2e')](handleEntityNotFound(_0x4df918,null))['then'](removeEntity(_0x4df918,null))[_0x1257('0x8b')](handleError(_0x4df918,null));};exports[_0x1257('0x2d')]=function(_0x25fc2f,_0x2334c0){return db['CmContact'][_0x1257('0x2d')]()[_0x1257('0x2e')](function(_0x19236d){delete _0x19236d[_0x1257('0x8e')];for(var _0x339f49=0x0;_0x339f49{}\s\\|]/g,'-');_0x4a1bbd(null,util['format'](_0xbe14('0x1e'),path['basename'](_0x24f820[_0xbe14('0x1c')],path['extname'](_0x24f820[_0xbe14('0x1c')])),Date['now'](),path[_0xbe14('0x1f')](_0x24f820[_0xbe14('0x1c')])));}})});router['post'](_0xbe14('0x20'),upload['single'](_0xbe14('0x21')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xbe14('0x22')]({'destination':function(_0x5fa043,_0x1ee9c1,_0x39cc81){_0x39cc81(null,path[_0xbe14('0x19')](config[_0xbe14('0x1a')],'server/files/tmp'));},'filename':function(_0x1822e0,_0x1ba46a,_0x391556){_0x1ba46a[_0xbe14('0x1c')]=_0x1ba46a['originalname'][_0xbe14('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x391556(null,util[_0xbe14('0x23')]('%s-%s%s',path[_0xbe14('0x24')](_0x1ba46a[_0xbe14('0x1c')],path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])),Date[_0xbe14('0x25')](),path[_0xbe14('0x1f')](_0x1ba46a[_0xbe14('0x1c')])));}})});router[_0xbe14('0x13')](_0xbe14('0x26'),upload[_0xbe14('0x27')](_0xbe14('0x21')),controller[_0xbe14('0x28')]);router[_0xbe14('0x13')](_0xbe14('0x29'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2a')]);router[_0xbe14('0x2b')](_0xbe14('0x2c'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x2d')]);router['delete'](_0xbe14('0x2c'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe14('0x2e')]=router; \ No newline at end of file +var _0x038b=['/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','join','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','/csv','file','uploadCsv','diskStorage','/upload','single','upload','/upload/:id','import','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x038b,0x114));var _0xb038=function(_0x15b717,_0x3de5c5){_0x15b717=_0x15b717-0x0;var _0x190d7c=_0x038b[_0x15b717];return _0x190d7c;};'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('./cmContact.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['get']('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xa')]);router['get']('/:id/tags',auth[_0xb038('0x7')](),controller[_0xb038('0xb')]);router['get'](_0xb038('0xc'),auth[_0xb038('0x7')](),controller[_0xb038('0xd')]);router[_0xb038('0x6')](_0xb038('0xe'),auth[_0xb038('0x7')](),controller[_0xb038('0xf')]);router[_0xb038('0x6')](_0xb038('0x10'),auth[_0xb038('0x7')](),controller[_0xb038('0x11')]);router[_0xb038('0x6')](_0xb038('0x12'),auth[_0xb038('0x7')](),controller[_0xb038('0x13')]);router[_0xb038('0x14')](_0xb038('0x15'),auth['isAuthenticated'](),controller[_0xb038('0x16')]);router[_0xb038('0x14')]('/',auth[_0xb038('0x7')](),controller[_0xb038('0x17')]);router[_0xb038('0x14')](_0xb038('0x18'),auth['isAuthenticated'](),controller[_0xb038('0x19')]);router[_0xb038('0x14')](_0xb038('0x1a'),auth[_0xb038('0x7')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20cea2,_0x3f48e6,_0x3e06ef){_0x3e06ef(null,path[_0xb038('0x1b')](config['root'],_0xb038('0x1c')));},'filename':function(_0x42c8ee,_0x3e0ea0,_0x33a377){_0x3e0ea0[_0xb038('0x1d')]=_0x3e0ea0['originalname'][_0xb038('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33a377(null,util[_0xb038('0x1f')](_0xb038('0x20'),path[_0xb038('0x21')](_0x3e0ea0['originalname'],path[_0xb038('0x22')](_0x3e0ea0[_0xb038('0x1d')])),Date['now'](),path[_0xb038('0x22')](_0x3e0ea0[_0xb038('0x1d')])));}})});router['post'](_0xb038('0x23'),upload['single'](_0xb038('0x24')),controller[_0xb038('0x25')]);var upload=multer({'storage':multer[_0xb038('0x26')]({'destination':function(_0x1df7c4,_0x5d4343,_0xe4ceda){_0xe4ceda(null,path[_0xb038('0x1b')](config['root'],_0xb038('0x1c')));},'filename':function(_0x33cf3c,_0x226631,_0x5d18c8){_0x226631[_0xb038('0x1d')]=_0x226631[_0xb038('0x1d')][_0xb038('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d18c8(null,util['format'](_0xb038('0x20'),path[_0xb038('0x21')](_0x226631[_0xb038('0x1d')],path[_0xb038('0x22')](_0x226631[_0xb038('0x1d')])),Date['now'](),path[_0xb038('0x22')](_0x226631[_0xb038('0x1d')])));}})});router[_0xb038('0x14')](_0xb038('0x27'),upload[_0xb038('0x28')](_0xb038('0x24')),controller[_0xb038('0x29')]);router[_0xb038('0x14')](_0xb038('0x2a'),auth[_0xb038('0x7')](),controller[_0xb038('0x2b')]);router[_0xb038('0x2c')](_0xb038('0x2d'),auth['isAuthenticated'](),controller[_0xb038('0x2e')]);router['delete'](_0xb038('0x2d'),auth[_0xb038('0x7')](),controller[_0xb038('0x2f')]);module[_0xb038('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index ab9a39e..e542c72 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f1c=['sequelize','STRING','PHONE','INTEGER'];(function(_0x3af770,_0x1a957a){var _0x42c9a9=function(_0x2afac3){while(--_0x2afac3){_0x3af770['push'](_0x3af770['shift']());}};_0x42c9a9(++_0x1a957a);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x3afac0,_0x249f5e){_0x3afac0=_0x3afac0-0x0;var _0x4772d3=_0x3f1c[_0x3afac0];return _0x4772d3;};'use strict';var Sequelize=require(_0xc3f1('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc3f1('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xc3f1('0x2')},'OrderBy':{'type':Sequelize[_0xc3f1('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x4553=['STRING','PHONE','exports','INTEGER'];(function(_0xc474e5,_0x5368db){var _0x49cfa0=function(_0x1a3871){while(--_0x1a3871){_0xc474e5['push'](_0xc474e5['shift']());}};_0x49cfa0(++_0x5368db);}(_0x4553,0x1be));var _0x3455=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x4553[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0x3455('0x0')]={'CmContactId':{'type':Sequelize[_0x3455('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3455('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x3455('0x3')},'OrderBy':{'type':Sequelize[_0x3455('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 7abdec1..40805c7 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bc5=['then','status','sendStatus','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems'];(function(_0x5201a9,_0x4250dc){var _0xaa7d8b=function(_0x57af0b){while(--_0x57af0b){_0x5201a9['push'](_0x5201a9['shift']());}};_0xaa7d8b(++_0x4250dc);}(_0x6bc5,0x11c));var _0x56bc=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x6bc5[_0x2e6e12];return _0x4bebf6;};'use strict';var pdf=require(_0x56bc('0x0'));var emlformat=require(_0x56bc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56bc('0x2'));var BPromise=require(_0x56bc('0x3'));var Mustache=require(_0x56bc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x56bc('0x5'));var csv=require(_0x56bc('0x6'));var ejs=require(_0x56bc('0x7'));var fs=require('fs');var _=require(_0x56bc('0x8'));var squel=require(_0x56bc('0x9'));var crypto=require('crypto');var jsforce=require(_0x56bc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56bc('0xb'));var Redis=require(_0x56bc('0xc'));var authService=require(_0x56bc('0xd'));var qs=require(_0x56bc('0xe'));var as=require(_0x56bc('0xf'));var hardwareService=require(_0x56bc('0x10'));var logger=require(_0x56bc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x56bc('0x12'));var db=require(_0x56bc('0x13'))['db'];function respondWithStatusCode(_0x1a63e6,_0x132ef8){_0x132ef8=_0x132ef8||0xcc;return function(_0x138ac6){if(_0x138ac6){return _0x1a63e6['sendStatus'](_0x132ef8);}return _0x1a63e6['status'](_0x132ef8)[_0x56bc('0x14')]();};}function respondWithResult(_0xbf7955,_0x30da96){_0x30da96=_0x30da96||0xc8;return function(_0x38fae4){if(_0x38fae4){return _0xbf7955['status'](_0x30da96)[_0x56bc('0x15')](_0x38fae4);}};}function respondWithFilteredResult(_0x30741f,_0x50c3fa){return function(_0x2f914c){if(_0x2f914c){var _0x10c0fc=_0x2f914c['count'],_0x85833=_0x50c3fa[_0x56bc('0x16')],_0x25656d=_0x50c3fa[_0x56bc('0x16')]+_0x50c3fa['limit'],_0x53ea4a;if(_0x25656d>=_0x10c0fc){_0x25656d=_0x10c0fc;_0x53ea4a=0xc8;}else{_0x53ea4a=0xce;}_0x30741f['status'](_0x53ea4a);return _0x30741f[_0x56bc('0x17')](_0x56bc('0x18'),_0x85833+'-'+_0x25656d+'/'+_0x10c0fc)['json'](_0x2f914c);}return null;};}function patchUpdates(_0x1e6f88){return function(_0x442ae0){try{jsonpatch[_0x56bc('0x19')](_0x442ae0,_0x1e6f88,!![]);}catch(_0x1f776d){return BPromise[_0x56bc('0x1a')](_0x1f776d);}return _0x442ae0[_0x56bc('0x1b')]();};}function saveUpdates(_0x169ed8,_0x4230da){return function(_0x1d538e){if(_0x1d538e){return _0x1d538e[_0x56bc('0x1c')](_0x169ed8)['then'](function(_0x3141f2){return _0x3141f2;});}return null;};}function removeEntity(_0x11f617,_0x51bbac){return function(_0x32f4c7){if(_0x32f4c7){return _0x32f4c7[_0x56bc('0x1d')]()['then'](function(){var _0x706ec=_0x32f4c7[_0x56bc('0x1e')]({'plain':!![]});var _0xc2c454=_0x56bc('0x1f');return db['UserProfileResource'][_0x56bc('0x1d')]({'where':{'type':_0xc2c454,'resourceId':_0x706ec['id']}})[_0x56bc('0x20')](function(){return _0x32f4c7;});})[_0x56bc('0x20')](function(){_0x11f617[_0x56bc('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321364,_0x26421e){return function(_0x537c4a){if(!_0x537c4a){_0x321364[_0x56bc('0x22')](0x194);}return _0x537c4a;};}function handleError(_0x46ef99,_0x4fc734){_0x4fc734=_0x4fc734||0x1f4;return function(_0x20db32){logger[_0x56bc('0x23')](_0x20db32['stack']);if(_0x20db32['name']){delete _0x20db32[_0x56bc('0x24')];}_0x46ef99[_0x56bc('0x21')](_0x4fc734)[_0x56bc('0x25')](_0x20db32);};}exports[_0x56bc('0x26')]=function(_0x4f9adf,_0x294239){var _0x5c93a6={},_0x3666d1={},_0x5e8d67={'count':0x0,'rows':[]};var _0x4a26c8=_[_0x56bc('0x27')](db[_0x56bc('0x28')][_0x56bc('0x29')],function(_0x504422){return{'name':_0x504422[_0x56bc('0x2a')],'type':_0x504422[_0x56bc('0x2b')][_0x56bc('0x2c')]};});_0x3666d1['model']=_[_0x56bc('0x27')](_0x4a26c8,'name');_0x3666d1['query']=_[_0x56bc('0x2d')](_0x4f9adf['query']);_0x3666d1[_0x56bc('0x2e')]=_['intersection'](_0x3666d1[_0x56bc('0x2f')],_0x3666d1[_0x56bc('0x30')]);_0x5c93a6['attributes']=_[_0x56bc('0x31')](_0x3666d1[_0x56bc('0x2f')],qs[_0x56bc('0x32')](_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x32')]));_0x5c93a6[_0x56bc('0x33')]=_0x5c93a6['attributes'][_0x56bc('0x34')]?_0x5c93a6[_0x56bc('0x33')]:_0x3666d1[_0x56bc('0x2f')];if(!_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x35')](_0x56bc('0x36'))){_0x5c93a6[_0x56bc('0x37')]=qs[_0x56bc('0x37')](_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x37')]);_0x5c93a6[_0x56bc('0x16')]=qs[_0x56bc('0x16')](_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x16')]);}_0x5c93a6[_0x56bc('0x38')]=qs['sort'](_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x39')]);_0x5c93a6[_0x56bc('0x3a')]=qs['filters'](_['pick'](_0x4f9adf[_0x56bc('0x30')],_0x3666d1[_0x56bc('0x2e')]),_0x4a26c8);if(_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x3b')]){_0x5c93a6[_0x56bc('0x3a')]=_[_0x56bc('0x3c')](_0x5c93a6[_0x56bc('0x3a')],{'$or':_[_0x56bc('0x27')](_0x4a26c8,function(_0x463219){if(_0x463219[_0x56bc('0x2b')]!==_0x56bc('0x3d')){var _0x1197ff={};_0x1197ff[_0x463219[_0x56bc('0x24')]]={'$like':'%'+_0x4f9adf[_0x56bc('0x30')][_0x56bc('0x3b')]+'%'};return _0x1197ff;}})});}_0x5c93a6=_[_0x56bc('0x3c')]({},_0x5c93a6,_0x4f9adf['options']);var _0x422f7b={'where':_0x5c93a6[_0x56bc('0x3a')]};return db[_0x56bc('0x28')]['count'](_0x422f7b)[_0x56bc('0x20')](function(_0x2567b9){_0x5e8d67['count']=_0x2567b9;if(_0x4f9adf[_0x56bc('0x30')]['includeAll']){_0x5c93a6[_0x56bc('0x3e')]=[{'all':!![]}];}return db[_0x56bc('0x28')][_0x56bc('0x3f')](_0x5c93a6);})[_0x56bc('0x20')](function(_0x397365){_0x5e8d67['rows']=_0x397365;return _0x5e8d67;})[_0x56bc('0x20')](respondWithFilteredResult(_0x294239,_0x5c93a6))['catch'](handleError(_0x294239,null));};exports[_0x56bc('0x40')]=function(_0x3e96e3,_0x1bb976){var _0x274752={'raw':!![],'where':{'id':_0x3e96e3[_0x56bc('0x41')]['id']}},_0x536673={};_0x536673[_0x56bc('0x2f')]=_[_0x56bc('0x2d')](db[_0x56bc('0x28')][_0x56bc('0x29')]);_0x536673[_0x56bc('0x30')]=_[_0x56bc('0x2d')](_0x3e96e3[_0x56bc('0x30')]);_0x536673[_0x56bc('0x2e')]=_[_0x56bc('0x31')](_0x536673[_0x56bc('0x2f')],_0x536673[_0x56bc('0x30')]);_0x274752['attributes']=_['intersection'](_0x536673[_0x56bc('0x2f')],qs[_0x56bc('0x32')](_0x3e96e3[_0x56bc('0x30')][_0x56bc('0x32')]));_0x274752['attributes']=_0x274752[_0x56bc('0x33')]['length']?_0x274752['attributes']:_0x536673[_0x56bc('0x2f')];if(_0x3e96e3['query'][_0x56bc('0x42')]){_0x274752[_0x56bc('0x3e')]=[{'all':!![]}];}_0x274752=_[_0x56bc('0x3c')]({},_0x274752,_0x3e96e3[_0x56bc('0x43')]);return db[_0x56bc('0x28')][_0x56bc('0x44')](_0x274752)[_0x56bc('0x20')](handleEntityNotFound(_0x1bb976,null))[_0x56bc('0x20')](respondWithResult(_0x1bb976,null))[_0x56bc('0x45')](handleError(_0x1bb976,null));};exports[_0x56bc('0x46')]=function(_0x49487e,_0x6c7f0b){return db[_0x56bc('0x28')]['create'](_0x49487e[_0x56bc('0x47')],{})[_0x56bc('0x20')](function(_0x32bd61){var _0x54c853=_0x49487e[_0x56bc('0x48')][_0x56bc('0x1e')]({'plain':!![]});if(!_0x54c853)throw new Error(_0x56bc('0x49'));if(_0x54c853[_0x56bc('0x4a')]===_0x56bc('0x48')){var _0x3e2143=_0x32bd61[_0x56bc('0x1e')]({'plain':!![]});var _0x2b4a23=_0x56bc('0x1f');return db[_0x56bc('0x4b')][_0x56bc('0x44')]({'where':{'name':_0x2b4a23,'userProfileId':_0x54c853[_0x56bc('0x4c')]},'raw':!![]})['then'](function(_0x26f3a7){if(_0x26f3a7&&_0x26f3a7[_0x56bc('0x4d')]===0x0){return db[_0x56bc('0x4e')]['create']({'name':_0x3e2143[_0x56bc('0x24')],'resourceId':_0x3e2143['id'],'type':_0x26f3a7[_0x56bc('0x24')],'sectionId':_0x26f3a7['id']},{})[_0x56bc('0x20')](function(){return _0x32bd61;});}else{return _0x32bd61;}})[_0x56bc('0x45')](function(_0x458288){logger[_0x56bc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458288);throw _0x458288;});}return _0x32bd61;})[_0x56bc('0x20')](respondWithResult(_0x6c7f0b,0xc9))[_0x56bc('0x45')](handleError(_0x6c7f0b,null));};exports[_0x56bc('0x1c')]=function(_0x2c1787,_0x4d945a){if(_0x2c1787['body']['id']){delete _0x2c1787[_0x56bc('0x47')]['id'];}return db[_0x56bc('0x28')][_0x56bc('0x44')]({'where':{'id':_0x2c1787[_0x56bc('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d945a,null))[_0x56bc('0x20')](saveUpdates(_0x2c1787[_0x56bc('0x47')],null))[_0x56bc('0x20')](respondWithResult(_0x4d945a,null))[_0x56bc('0x45')](handleError(_0x4d945a,null));};exports[_0x56bc('0x1d')]=function(_0x7c0bfa,_0x4c35bf){return db[_0x56bc('0x28')][_0x56bc('0x44')]({'where':{'id':_0x7c0bfa[_0x56bc('0x41')]['id']}})[_0x56bc('0x20')](handleEntityNotFound(_0x4c35bf,null))[_0x56bc('0x20')](removeEntity(_0x4c35bf,null))[_0x56bc('0x45')](handleError(_0x4c35bf,null));}; \ No newline at end of file +var _0x98f7=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','name','options','CmContactHasItem','findAll','catch','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','get','CmContactHasItems','error','stack','send','index','rawAttributes','key','map'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x98f7,0x116));var _0x798f=function(_0x308c7e,_0x35875c){_0x308c7e=_0x308c7e-0x0;var _0xa75795=_0x98f7[_0x308c7e];return _0xa75795;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x798f('0x0'));var rimraf=require(_0x798f('0x1'));var zipdir=require(_0x798f('0x2'));var jsonpatch=require(_0x798f('0x3'));var rp=require(_0x798f('0x4'));var moment=require('moment');var BPromise=require(_0x798f('0x5'));var Mustache=require(_0x798f('0x6'));var util=require(_0x798f('0x7'));var path=require(_0x798f('0x8'));var sox=require(_0x798f('0x9'));var csv=require(_0x798f('0xa'));var ejs=require(_0x798f('0xb'));var fs=require('fs');var _=require(_0x798f('0xc'));var squel=require('squel');var crypto=require(_0x798f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x798f('0xe'));var toCsv=require(_0x798f('0xa'));var querystring=require(_0x798f('0xf'));var Papa=require('papaparse');var Redis=require(_0x798f('0x10'));var authService=require(_0x798f('0x11'));var qs=require(_0x798f('0x12'));var as=require(_0x798f('0x13'));var hardwareService=require(_0x798f('0x14'));var logger=require(_0x798f('0x15'))(_0x798f('0x16'));var utils=require(_0x798f('0x17'));var config=require(_0x798f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9987,_0x146ec6){_0x146ec6=_0x146ec6||0xcc;return function(_0x5ed923){if(_0x5ed923){return _0x1e9987[_0x798f('0x19')](_0x146ec6);}return _0x1e9987[_0x798f('0x1a')](_0x146ec6)[_0x798f('0x1b')]();};}function respondWithResult(_0x4d634f,_0x44bf83){_0x44bf83=_0x44bf83||0xc8;return function(_0x478941){if(_0x478941){return _0x4d634f[_0x798f('0x1a')](_0x44bf83)[_0x798f('0x1c')](_0x478941);}};}function respondWithFilteredResult(_0x21bbf8,_0x31f64b){return function(_0x3828ec){if(_0x3828ec){var _0xcc00fa=_0x3828ec[_0x798f('0x1d')],_0x3d7f80=_0x31f64b[_0x798f('0x1e')],_0x34bd56=_0x31f64b['offset']+_0x31f64b[_0x798f('0x1f')],_0x20e8ef;if(_0x34bd56>=_0xcc00fa){_0x34bd56=_0xcc00fa;_0x20e8ef=0xc8;}else{_0x20e8ef=0xce;}_0x21bbf8[_0x798f('0x1a')](_0x20e8ef);return _0x21bbf8['set']('Content-Range',_0x3d7f80+'-'+_0x34bd56+'/'+_0xcc00fa)[_0x798f('0x1c')](_0x3828ec);}return null;};}function patchUpdates(_0x3b89dc){return function(_0xe6820e){try{jsonpatch[_0x798f('0x20')](_0xe6820e,_0x3b89dc,!![]);}catch(_0x3b0160){return BPromise[_0x798f('0x21')](_0x3b0160);}return _0xe6820e[_0x798f('0x22')]();};}function saveUpdates(_0x22744d,_0x59856c){return function(_0x52fc72){if(_0x52fc72){return _0x52fc72[_0x798f('0x23')](_0x22744d)[_0x798f('0x24')](function(_0x48e8a5){return _0x48e8a5;});}return null;};}function removeEntity(_0x3af402,_0x19d9d7){return function(_0x4beffe){if(_0x4beffe){return _0x4beffe['destroy']()['then'](function(){var _0x3bcb0b=_0x4beffe[_0x798f('0x25')]({'plain':!![]});var _0x3db718=_0x798f('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3db718,'resourceId':_0x3bcb0b['id']}})[_0x798f('0x24')](function(){return _0x4beffe;});})[_0x798f('0x24')](function(){_0x3af402[_0x798f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d138,_0x115aed){return function(_0x4abb70){if(!_0x4abb70){_0x52d138['sendStatus'](0x194);}return _0x4abb70;};}function handleError(_0xd1bef1,_0x2ae155){_0x2ae155=_0x2ae155||0x1f4;return function(_0x57412d){logger[_0x798f('0x27')](_0x57412d[_0x798f('0x28')]);if(_0x57412d['name']){delete _0x57412d['name'];}_0xd1bef1[_0x798f('0x1a')](_0x2ae155)[_0x798f('0x29')](_0x57412d);};}exports[_0x798f('0x2a')]=function(_0x3e6a70,_0x4254dd){var _0x591d77={},_0x3bc81c={},_0x2cead4={'count':0x0,'rows':[]};var _0x20f222=_['map'](db['CmContactHasItem'][_0x798f('0x2b')],function(_0x44598d){return{'name':_0x44598d['fieldName'],'type':_0x44598d['type'][_0x798f('0x2c')]};});_0x3bc81c['model']=_[_0x798f('0x2d')](_0x20f222,'name');_0x3bc81c[_0x798f('0x2e')]=_[_0x798f('0x2f')](_0x3e6a70['query']);_0x3bc81c[_0x798f('0x30')]=_[_0x798f('0x31')](_0x3bc81c[_0x798f('0x32')],_0x3bc81c['query']);_0x591d77[_0x798f('0x33')]=_[_0x798f('0x31')](_0x3bc81c['model'],qs[_0x798f('0x34')](_0x3e6a70[_0x798f('0x2e')][_0x798f('0x34')]));_0x591d77[_0x798f('0x33')]=_0x591d77['attributes'][_0x798f('0x35')]?_0x591d77['attributes']:_0x3bc81c['model'];if(!_0x3e6a70['query'][_0x798f('0x36')](_0x798f('0x37'))){_0x591d77[_0x798f('0x1f')]=qs[_0x798f('0x1f')](_0x3e6a70['query'][_0x798f('0x1f')]);_0x591d77['offset']=qs[_0x798f('0x1e')](_0x3e6a70[_0x798f('0x2e')][_0x798f('0x1e')]);}_0x591d77[_0x798f('0x38')]=qs['sort'](_0x3e6a70[_0x798f('0x2e')][_0x798f('0x39')]);_0x591d77[_0x798f('0x3a')]=qs['filters'](_['pick'](_0x3e6a70[_0x798f('0x2e')],_0x3bc81c[_0x798f('0x30')]),_0x20f222);if(_0x3e6a70[_0x798f('0x2e')][_0x798f('0x3b')]){_0x591d77[_0x798f('0x3a')]=_[_0x798f('0x3c')](_0x591d77['where'],{'$or':_[_0x798f('0x2d')](_0x20f222,function(_0x18d214){if(_0x18d214[_0x798f('0x3d')]!==_0x798f('0x3e')){var _0x4c58d5={};_0x4c58d5[_0x18d214[_0x798f('0x3f')]]={'$like':'%'+_0x3e6a70[_0x798f('0x2e')][_0x798f('0x3b')]+'%'};return _0x4c58d5;}})});}_0x591d77=_['merge']({},_0x591d77,_0x3e6a70[_0x798f('0x40')]);var _0x299a96={'where':_0x591d77[_0x798f('0x3a')]};return db[_0x798f('0x41')]['count'](_0x299a96)[_0x798f('0x24')](function(_0x268e9e){_0x2cead4['count']=_0x268e9e;if(_0x3e6a70['query']['includeAll']){_0x591d77['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x798f('0x42')](_0x591d77);})[_0x798f('0x24')](function(_0x1b75a8){_0x2cead4['rows']=_0x1b75a8;return _0x2cead4;})[_0x798f('0x24')](respondWithFilteredResult(_0x4254dd,_0x591d77))[_0x798f('0x43')](handleError(_0x4254dd,null));};exports['show']=function(_0x5584b5,_0x439e3d){var _0x52900d={'raw':!![],'where':{'id':_0x5584b5[_0x798f('0x44')]['id']}},_0x374436={};_0x374436[_0x798f('0x32')]=_[_0x798f('0x2f')](db['CmContactHasItem']['rawAttributes']);_0x374436[_0x798f('0x2e')]=_[_0x798f('0x2f')](_0x5584b5[_0x798f('0x2e')]);_0x374436['filters']=_[_0x798f('0x31')](_0x374436[_0x798f('0x32')],_0x374436['query']);_0x52900d[_0x798f('0x33')]=_['intersection'](_0x374436[_0x798f('0x32')],qs[_0x798f('0x34')](_0x5584b5[_0x798f('0x2e')]['fields']));_0x52900d['attributes']=_0x52900d['attributes']['length']?_0x52900d['attributes']:_0x374436['model'];if(_0x5584b5[_0x798f('0x2e')][_0x798f('0x45')]){_0x52900d[_0x798f('0x46')]=[{'all':!![]}];}_0x52900d=_[_0x798f('0x3c')]({},_0x52900d,_0x5584b5[_0x798f('0x40')]);return db[_0x798f('0x41')][_0x798f('0x47')](_0x52900d)[_0x798f('0x24')](handleEntityNotFound(_0x439e3d,null))['then'](respondWithResult(_0x439e3d,null))[_0x798f('0x43')](handleError(_0x439e3d,null));};exports[_0x798f('0x48')]=function(_0x547496,_0x57b709){return db[_0x798f('0x41')][_0x798f('0x48')](_0x547496['body'],{})[_0x798f('0x24')](function(_0x3bd1fe){var _0x1ca1ab=_0x547496[_0x798f('0x49')][_0x798f('0x25')]({'plain':!![]});if(!_0x1ca1ab)throw new Error(_0x798f('0x4a'));if(_0x1ca1ab[_0x798f('0x4b')]===_0x798f('0x49')){var _0x2b5c06=_0x3bd1fe['get']({'plain':!![]});var _0x388254=_0x798f('0x26');return db[_0x798f('0x4c')][_0x798f('0x47')]({'where':{'name':_0x388254,'userProfileId':_0x1ca1ab['userProfileId']},'raw':!![]})[_0x798f('0x24')](function(_0x260b13){if(_0x260b13&&_0x260b13[_0x798f('0x4d')]===0x0){return db['UserProfileResource'][_0x798f('0x48')]({'name':_0x2b5c06[_0x798f('0x3f')],'resourceId':_0x2b5c06['id'],'type':_0x260b13[_0x798f('0x3f')],'sectionId':_0x260b13['id']},{})['then'](function(){return _0x3bd1fe;});}else{return _0x3bd1fe;}})[_0x798f('0x43')](function(_0x4edf7e){logger[_0x798f('0x27')](_0x798f('0x4e'),_0x4edf7e);throw _0x4edf7e;});}return _0x3bd1fe;})[_0x798f('0x24')](respondWithResult(_0x57b709,0xc9))[_0x798f('0x43')](handleError(_0x57b709,null));};exports[_0x798f('0x23')]=function(_0x13894a,_0x3b7079){if(_0x13894a[_0x798f('0x4f')]['id']){delete _0x13894a[_0x798f('0x4f')]['id'];}return db[_0x798f('0x41')][_0x798f('0x47')]({'where':{'id':_0x13894a[_0x798f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b7079,null))[_0x798f('0x24')](saveUpdates(_0x13894a['body'],null))[_0x798f('0x24')](respondWithResult(_0x3b7079,null))['catch'](handleError(_0x3b7079,null));};exports[_0x798f('0x50')]=function(_0x933c1c,_0x58e0cd){return db['CmContactHasItem'][_0x798f('0x47')]({'where':{'id':_0x933c1c[_0x798f('0x44')]['id']}})[_0x798f('0x24')](handleEntityNotFound(_0x58e0cd,null))['then'](removeEntity(_0x58e0cd,null))[_0x798f('0x43')](handleError(_0x58e0cd,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index ca8bded..2bd56b4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27a0=['define','CmContactHasItem','util','../../config/logger','api','moment','bluebird','./cmContactHasItem.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27a0,0xbf));var _0x027a=function(_0x32c79f,_0x4438ae){_0x32c79f=_0x32c79f-0x0;var _0x37c93c=_0x27a0[_0x32c79f];return _0x37c93c;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','./cmContactHasItem.attributes'];(function(_0x552b1a,_0x45e88d){var _0x2031b6=function(_0xdef539){while(--_0xdef539){_0x552b1a['push'](_0x552b1a['shift']());}};_0x2031b6(++_0x45e88d);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3a4e3a,_0x939b79){_0x3a4e3a=_0x3a4e3a-0x0;var _0x41de59=_0xbd51[_0x3a4e3a];return _0x41de59;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9f14ac5..c3d6914 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80aa=['request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x3209f2,_0x5c51e2){var _0x56aabc=function(_0x429ab1){while(--_0x429ab1){_0x3209f2['push'](_0x3209f2['shift']());}};_0x56aabc(++_0x5c51e2);}(_0x80aa,0x1ec));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa80a('0x0'));var moment=require(_0xa80a('0x1'));var BPromise=require(_0xa80a('0x2'));var rs=require(_0xa80a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa80a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa80a('0x5'))(_0xa80a('0x6'));var config=require(_0xa80a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa80a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8ae467,_0x4ce50e,_0x325926){return new BPromise(function(_0x3b933f,_0x36810f){return client['request'](_0x8ae467,_0x325926)[_0xa80a('0x9')](function(_0x41aeff){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4ce50e,'request\x20sent');logger[_0xa80a('0xa')](_0xa80a('0xb'),_0x4ce50e,_0xa80a('0xc'),JSON[_0xa80a('0xd')](_0x41aeff));if(_0x41aeff[_0xa80a('0xe')]){if(_0x41aeff[_0xa80a('0xe')][_0xa80a('0xf')]===0x1f4){logger[_0xa80a('0xe')](_0xa80a('0x10'),_0x4ce50e,_0x41aeff[_0xa80a('0xe')]['message']);return _0x36810f(_0x41aeff[_0xa80a('0xe')][_0xa80a('0x11')]);}logger[_0xa80a('0xe')](_0xa80a('0x10'),_0x4ce50e,_0x41aeff[_0xa80a('0xe')][_0xa80a('0x11')]);return _0x3b933f(_0x41aeff[_0xa80a('0xe')][_0xa80a('0x11')]);}else{logger[_0xa80a('0x12')](_0xa80a('0x10'),_0x4ce50e,'request\x20sent');_0x3b933f(_0x41aeff[_0xa80a('0x13')]['message']);}})[_0xa80a('0x14')](function(_0x40ae0b){logger[_0xa80a('0xe')](_0xa80a('0x10'),_0x4ce50e,_0x40ae0b);_0x36810f(_0x40ae0b);});});} \ No newline at end of file +var _0x76ed=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x105161,_0x3f0dbd){var _0x1bce8e=function(_0x342c26){while(--_0x342c26){_0x105161['push'](_0x105161['shift']());}};_0x1bce8e(++_0x3f0dbd);}(_0x76ed,0x1d0));var _0xd76e=function(_0x189e14,_0x28775e){_0x189e14=_0x189e14-0x0;var _0x3a0f5a=_0x76ed[_0x189e14];return _0x3a0f5a;};'use strict';var _=require(_0xd76e('0x0'));var util=require(_0xd76e('0x1'));var moment=require('moment');var BPromise=require(_0xd76e('0x2'));var rs=require(_0xd76e('0x3'));var fs=require('fs');var Redis=require(_0xd76e('0x4'));var db=require(_0xd76e('0x5'))['db'];var utils=require(_0xd76e('0x6'));var logger=require(_0xd76e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd76e('0x8'));var client=jayson[_0xd76e('0x9')][_0xd76e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb3682c,_0x3e4c93,_0x1fe2e2){return new BPromise(function(_0xb23af2,_0x249dff){return client['request'](_0xb3682c,_0x1fe2e2)[_0xd76e('0xb')](function(_0x35f986){logger[_0xd76e('0xc')](_0xd76e('0xd'),_0x3e4c93,'request\x20sent');logger[_0xd76e('0xe')](_0xd76e('0xf'),_0x3e4c93,'request\x20sent',JSON[_0xd76e('0x10')](_0x35f986));if(_0x35f986[_0xd76e('0x11')]){if(_0x35f986[_0xd76e('0x11')]['code']===0x1f4){logger['error'](_0xd76e('0xd'),_0x3e4c93,_0x35f986['error']['message']);return _0x249dff(_0x35f986[_0xd76e('0x11')][_0xd76e('0x12')]);}logger[_0xd76e('0x11')](_0xd76e('0xd'),_0x3e4c93,_0x35f986[_0xd76e('0x11')][_0xd76e('0x12')]);return _0xb23af2(_0x35f986['error'][_0xd76e('0x12')]);}else{logger[_0xd76e('0xc')](_0xd76e('0xd'),_0x3e4c93,'request\x20sent');_0xb23af2(_0x35f986[_0xd76e('0x13')]['message']);}})[_0xd76e('0x14')](function(_0x54cede){logger[_0xd76e('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x3e4c93,_0x54cede);_0x249dff(_0x54cede);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4663dfa..ebb7b59 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc05f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','multer','util','connect-timeout','../../components/auth/service'];(function(_0x1e1fd5,_0x1173d8){var _0x397946=function(_0x5c2e42){while(--_0x5c2e42){_0x1e1fd5['push'](_0x1e1fd5['shift']());}};_0x397946(++_0x1173d8);}(_0xc05f,0x1b8));var _0xfc05=function(_0x312dbd,_0xd61a46){_0x312dbd=_0x312dbd-0x0;var _0x285a3d=_0xc05f[_0x312dbd];return _0x285a3d;};'use strict';var multer=require(_0xfc05('0x0'));var util=require(_0xfc05('0x1'));var path=require('path');var timeout=require(_0xfc05('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xfc05('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfc05('0x4'));var controller=require('./cmContactHasItem.controller');router[_0xfc05('0x5')]('/',auth[_0xfc05('0x6')](),controller['index']);router['get'](_0xfc05('0x7'),auth[_0xfc05('0x6')](),controller[_0xfc05('0x8')]);router[_0xfc05('0x9')]('/',auth[_0xfc05('0x6')](),controller[_0xfc05('0xa')]);router[_0xfc05('0xb')](_0xfc05('0x7'),auth[_0xfc05('0x6')](),controller['update']);router['delete'](_0xfc05('0x7'),auth[_0xfc05('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8039=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3e0e6c,_0x4757cd){var _0xad2be9=function(_0x366658){while(--_0x366658){_0x3e0e6c['push'](_0x3e0e6c['shift']());}};_0xad2be9(++_0x4757cd);}(_0x8039,0x1a6));var _0x9803=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x8039[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x9803('0x0'));var util=require(_0x9803('0x1'));var path=require(_0x9803('0x2'));var timeout=require(_0x9803('0x3'));var express=require(_0x9803('0x4'));var router=express[_0x9803('0x5')]();var auth=require(_0x9803('0x6'));var interaction=require(_0x9803('0x7'));var config=require('../../config/environment');var controller=require(_0x9803('0x8'));router[_0x9803('0x9')]('/',auth[_0x9803('0xa')](),controller[_0x9803('0xb')]);router[_0x9803('0x9')](_0x9803('0xc'),auth[_0x9803('0xa')](),controller[_0x9803('0xd')]);router[_0x9803('0xe')]('/',auth[_0x9803('0xa')](),controller[_0x9803('0xf')]);router[_0x9803('0x10')]('/:id',auth[_0x9803('0xa')](),controller[_0x9803('0x11')]);router[_0x9803('0x12')]('/:id',auth[_0x9803('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 8acc34e..bf90b65 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x832f=['INTEGER','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x832f,0x145));var _0xf832=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x832f[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require(_0xf832('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xf832('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xe117=['STRING','sequelize','INTEGER'];(function(_0x285e35,_0x5e6ebd){var _0x169f37=function(_0x2e4484){while(--_0x2e4484){_0x285e35['push'](_0x285e35['shift']());}};_0x169f37(++_0x5e6ebd);}(_0xe117,0xa6));var _0x7e11=function(_0x594102,_0x5443e8){_0x594102=_0x594102-0x0;var _0x3cbc27=_0xe117[_0x594102];return _0x3cbc27;};'use strict';var Sequelize=require(_0x7e11('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x7e11('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x7e11('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 2f58d74..b26288d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53b4=['then','destroy','get','CmContactHasPhones','UserProfileResource','error','name','send','map','CmContactHasPhone','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','catch','params','rawAttributes','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update'];(function(_0x2f8ae5,_0x2ee374){var _0xdf46c4=function(_0x7e4026){while(--_0x7e4026){_0x2f8ae5['push'](_0x2f8ae5['shift']());}};_0xdf46c4(++_0x2ee374);}(_0x53b4,0xc5));var _0x453b=function(_0x1549a3,_0x5c3777){_0x1549a3=_0x1549a3-0x0;var _0x5a820f=_0x53b4[_0x1549a3];return _0x5a820f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x453b('0x0'));var rimraf=require(_0x453b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x453b('0x2'));var rp=require('request-promise');var moment=require(_0x453b('0x3'));var BPromise=require(_0x453b('0x4'));var Mustache=require(_0x453b('0x5'));var util=require(_0x453b('0x6'));var path=require(_0x453b('0x7'));var sox=require(_0x453b('0x8'));var csv=require(_0x453b('0x9'));var ejs=require(_0x453b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x453b('0xb'));var crypto=require(_0x453b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x453b('0xd'));var toCsv=require(_0x453b('0x9'));var querystring=require(_0x453b('0xe'));var Papa=require(_0x453b('0xf'));var Redis=require(_0x453b('0x10'));var authService=require(_0x453b('0x11'));var qs=require(_0x453b('0x12'));var as=require(_0x453b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x453b('0x14'))('api');var utils=require(_0x453b('0x15'));var config=require(_0x453b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358615,_0x7932e8){_0x7932e8=_0x7932e8||0xcc;return function(_0x23e4da){if(_0x23e4da){return _0x358615[_0x453b('0x17')](_0x7932e8);}return _0x358615[_0x453b('0x18')](_0x7932e8)[_0x453b('0x19')]();};}function respondWithResult(_0x13dafd,_0x9c8e33){_0x9c8e33=_0x9c8e33||0xc8;return function(_0x47fe40){if(_0x47fe40){return _0x13dafd['status'](_0x9c8e33)[_0x453b('0x1a')](_0x47fe40);}};}function respondWithFilteredResult(_0x584213,_0x2e1eb){return function(_0xd00191){if(_0xd00191){var _0x420b43=_0xd00191[_0x453b('0x1b')],_0xe95ecb=_0x2e1eb['offset'],_0x2506c3=_0x2e1eb[_0x453b('0x1c')]+_0x2e1eb[_0x453b('0x1d')],_0x57e870;if(_0x2506c3>=_0x420b43){_0x2506c3=_0x420b43;_0x57e870=0xc8;}else{_0x57e870=0xce;}_0x584213[_0x453b('0x18')](_0x57e870);return _0x584213[_0x453b('0x1e')]('Content-Range',_0xe95ecb+'-'+_0x2506c3+'/'+_0x420b43)[_0x453b('0x1a')](_0xd00191);}return null;};}function patchUpdates(_0x35a452){return function(_0x2ab051){try{jsonpatch[_0x453b('0x1f')](_0x2ab051,_0x35a452,!![]);}catch(_0x250439){return BPromise[_0x453b('0x20')](_0x250439);}return _0x2ab051['save']();};}function saveUpdates(_0x2c1e01,_0x41b138){return function(_0x2dad2a){if(_0x2dad2a){return _0x2dad2a[_0x453b('0x21')](_0x2c1e01)[_0x453b('0x22')](function(_0x4e6102){return _0x4e6102;});}return null;};}function removeEntity(_0x1e7130,_0x471fbe){return function(_0xf01161){if(_0xf01161){return _0xf01161[_0x453b('0x23')]()['then'](function(){var _0x3ac7c7=_0xf01161[_0x453b('0x24')]({'plain':!![]});var _0x34a3b9=_0x453b('0x25');return db[_0x453b('0x26')][_0x453b('0x23')]({'where':{'type':_0x34a3b9,'resourceId':_0x3ac7c7['id']}})[_0x453b('0x22')](function(){return _0xf01161;});})[_0x453b('0x22')](function(){_0x1e7130['status'](0xcc)[_0x453b('0x19')]();});}};}function handleEntityNotFound(_0x555bfb,_0x47f10a){return function(_0x23109c){if(!_0x23109c){_0x555bfb[_0x453b('0x17')](0x194);}return _0x23109c;};}function handleError(_0x48c2fa,_0x273371){_0x273371=_0x273371||0x1f4;return function(_0x51a351){logger[_0x453b('0x27')](_0x51a351['stack']);if(_0x51a351[_0x453b('0x28')]){delete _0x51a351[_0x453b('0x28')];}_0x48c2fa[_0x453b('0x18')](_0x273371)[_0x453b('0x29')](_0x51a351);};}exports['index']=function(_0xab4c75,_0x2ae5a2){var _0x4d068a={},_0x2fcf9c={},_0x42a3f3={'count':0x0,'rows':[]};var _0x557c8e=_[_0x453b('0x2a')](db[_0x453b('0x2b')]['rawAttributes'],function(_0x1245ec){return{'name':_0x1245ec[_0x453b('0x2c')],'type':_0x1245ec[_0x453b('0x2d')][_0x453b('0x2e')]};});_0x2fcf9c[_0x453b('0x2f')]=_[_0x453b('0x2a')](_0x557c8e,_0x453b('0x28'));_0x2fcf9c['query']=_[_0x453b('0x30')](_0xab4c75[_0x453b('0x31')]);_0x2fcf9c[_0x453b('0x32')]=_[_0x453b('0x33')](_0x2fcf9c['model'],_0x2fcf9c[_0x453b('0x31')]);_0x4d068a[_0x453b('0x34')]=_[_0x453b('0x33')](_0x2fcf9c[_0x453b('0x2f')],qs[_0x453b('0x35')](_0xab4c75[_0x453b('0x31')][_0x453b('0x35')]));_0x4d068a[_0x453b('0x34')]=_0x4d068a[_0x453b('0x34')][_0x453b('0x36')]?_0x4d068a['attributes']:_0x2fcf9c['model'];if(!_0xab4c75[_0x453b('0x31')][_0x453b('0x37')](_0x453b('0x38'))){_0x4d068a[_0x453b('0x1d')]=qs[_0x453b('0x1d')](_0xab4c75[_0x453b('0x31')]['limit']);_0x4d068a['offset']=qs[_0x453b('0x1c')](_0xab4c75[_0x453b('0x31')]['offset']);}_0x4d068a[_0x453b('0x39')]=qs[_0x453b('0x3a')](_0xab4c75[_0x453b('0x31')][_0x453b('0x3a')]);_0x4d068a[_0x453b('0x3b')]=qs[_0x453b('0x32')](_[_0x453b('0x3c')](_0xab4c75['query'],_0x2fcf9c[_0x453b('0x32')]),_0x557c8e);if(_0xab4c75['query'][_0x453b('0x3d')]){_0x4d068a['where']=_['merge'](_0x4d068a[_0x453b('0x3b')],{'$or':_[_0x453b('0x2a')](_0x557c8e,function(_0x5e9f2c){if(_0x5e9f2c[_0x453b('0x2d')]!==_0x453b('0x3e')){var _0x3a7aa2={};_0x3a7aa2[_0x5e9f2c['name']]={'$like':'%'+_0xab4c75['query'][_0x453b('0x3d')]+'%'};return _0x3a7aa2;}})});}_0x4d068a=_['merge']({},_0x4d068a,_0xab4c75['options']);var _0x5cc33b={'where':_0x4d068a[_0x453b('0x3b')]};return db['CmContactHasPhone']['count'](_0x5cc33b)['then'](function(_0x167726){_0x42a3f3['count']=_0x167726;if(_0xab4c75[_0x453b('0x31')][_0x453b('0x3f')]){_0x4d068a[_0x453b('0x40')]=[{'all':!![]}];}return db['CmContactHasPhone']['findAll'](_0x4d068a);})[_0x453b('0x22')](function(_0x6651a7){_0x42a3f3['rows']=_0x6651a7;return _0x42a3f3;})[_0x453b('0x22')](respondWithFilteredResult(_0x2ae5a2,_0x4d068a))[_0x453b('0x41')](handleError(_0x2ae5a2,null));};exports['show']=function(_0x1541db,_0x21a7b1){var _0x4fee90={'raw':!![],'where':{'id':_0x1541db[_0x453b('0x42')]['id']}},_0x41cc3e={};_0x41cc3e[_0x453b('0x2f')]=_['keys'](db['CmContactHasPhone'][_0x453b('0x43')]);_0x41cc3e[_0x453b('0x31')]=_[_0x453b('0x30')](_0x1541db[_0x453b('0x31')]);_0x41cc3e['filters']=_[_0x453b('0x33')](_0x41cc3e[_0x453b('0x2f')],_0x41cc3e[_0x453b('0x31')]);_0x4fee90['attributes']=_['intersection'](_0x41cc3e['model'],qs[_0x453b('0x35')](_0x1541db[_0x453b('0x31')]['fields']));_0x4fee90['attributes']=_0x4fee90[_0x453b('0x34')]['length']?_0x4fee90['attributes']:_0x41cc3e[_0x453b('0x2f')];if(_0x1541db[_0x453b('0x31')]['includeAll']){_0x4fee90[_0x453b('0x40')]=[{'all':!![]}];}_0x4fee90=_[_0x453b('0x44')]({},_0x4fee90,_0x1541db[_0x453b('0x45')]);return db[_0x453b('0x2b')][_0x453b('0x46')](_0x4fee90)['then'](handleEntityNotFound(_0x21a7b1,null))[_0x453b('0x22')](respondWithResult(_0x21a7b1,null))[_0x453b('0x41')](handleError(_0x21a7b1,null));};exports[_0x453b('0x47')]=function(_0x2c0bf2,_0x484149){return db[_0x453b('0x2b')]['create'](_0x2c0bf2[_0x453b('0x48')],{})['then'](function(_0x109afd){var _0x58af7d=_0x2c0bf2['user']['get']({'plain':!![]});if(!_0x58af7d)throw new Error(_0x453b('0x49'));if(_0x58af7d['role']===_0x453b('0x4a')){var _0x19a635=_0x109afd[_0x453b('0x24')]({'plain':!![]});var _0x2a764c='CmContactHasPhones';return db['UserProfileSection'][_0x453b('0x46')]({'where':{'name':_0x2a764c,'userProfileId':_0x58af7d['userProfileId']},'raw':!![]})[_0x453b('0x22')](function(_0x26bfd1){if(_0x26bfd1&&_0x26bfd1[_0x453b('0x4b')]===0x0){return db['UserProfileResource'][_0x453b('0x47')]({'name':_0x19a635['name'],'resourceId':_0x19a635['id'],'type':_0x26bfd1[_0x453b('0x28')],'sectionId':_0x26bfd1['id']},{})[_0x453b('0x22')](function(){return _0x109afd;});}else{return _0x109afd;}})[_0x453b('0x41')](function(_0x164601){logger['error'](_0x453b('0x4c'),_0x164601);throw _0x164601;});}return _0x109afd;})[_0x453b('0x22')](respondWithResult(_0x484149,0xc9))[_0x453b('0x41')](handleError(_0x484149,null));};exports[_0x453b('0x21')]=function(_0x26bada,_0xea2b50){if(_0x26bada['body']['id']){delete _0x26bada[_0x453b('0x48')]['id'];}return db[_0x453b('0x2b')][_0x453b('0x46')]({'where':{'id':_0x26bada[_0x453b('0x42')]['id']}})[_0x453b('0x22')](handleEntityNotFound(_0xea2b50,null))[_0x453b('0x22')](saveUpdates(_0x26bada['body'],null))['then'](respondWithResult(_0xea2b50,null))[_0x453b('0x41')](handleError(_0xea2b50,null));};exports['destroy']=function(_0x2a5b62,_0x1ddc1e){return db[_0x453b('0x2b')]['find']({'where':{'id':_0x2a5b62[_0x453b('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ddc1e,null))[_0x453b('0x22')](removeEntity(_0x1ddc1e,null))['catch'](handleError(_0x1ddc1e,null));}; \ No newline at end of file +var _0x5fcb=['nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','json','count','offset','set','reject','save','update','then','destroy','get','CmContactHasPhones','UserProfileResource','sendStatus','error','name','send','index','map','CmContactHasPhone','fieldName','type','key','model','query','keys','filters','intersection','attributes','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5fcb,0x105));var _0xb5fc=function(_0x3af7fd,_0x239e8a){_0x3af7fd=_0x3af7fd-0x0;var _0x13e160=_0x5fcb[_0x3af7fd];return _0x13e160;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb5fc('0x0'));var rimraf=require(_0xb5fc('0x1'));var zipdir=require(_0xb5fc('0x2'));var jsonpatch=require(_0xb5fc('0x3'));var rp=require(_0xb5fc('0x4'));var moment=require(_0xb5fc('0x5'));var BPromise=require(_0xb5fc('0x6'));var Mustache=require('mustache');var util=require(_0xb5fc('0x7'));var path=require(_0xb5fc('0x8'));var sox=require(_0xb5fc('0x9'));var csv=require(_0xb5fc('0xa'));var ejs=require(_0xb5fc('0xb'));var fs=require('fs');var _=require(_0xb5fc('0xc'));var squel=require(_0xb5fc('0xd'));var crypto=require(_0xb5fc('0xe'));var jsforce=require(_0xb5fc('0xf'));var deskjs=require(_0xb5fc('0x10'));var toCsv=require(_0xb5fc('0xa'));var querystring=require('querystring');var Papa=require(_0xb5fc('0x11'));var Redis=require('ioredis');var authService=require(_0xb5fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb5fc('0x13'));var hardwareService=require(_0xb5fc('0x14'));var logger=require(_0xb5fc('0x15'))(_0xb5fc('0x16'));var utils=require(_0xb5fc('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126716,_0x2d8777){_0x2d8777=_0x2d8777||0xcc;return function(_0x51b488){if(_0x51b488){return _0x126716['sendStatus'](_0x2d8777);}return _0x126716['status'](_0x2d8777)[_0xb5fc('0x18')]();};}function respondWithResult(_0x550dfb,_0x2a7593){_0x2a7593=_0x2a7593||0xc8;return function(_0x165032){if(_0x165032){return _0x550dfb[_0xb5fc('0x19')](_0x2a7593)[_0xb5fc('0x1a')](_0x165032);}};}function respondWithFilteredResult(_0x2d8fc7,_0x3d59c7){return function(_0x41f01a){if(_0x41f01a){var _0x4f8de4=_0x41f01a[_0xb5fc('0x1b')],_0x13d14c=_0x3d59c7[_0xb5fc('0x1c')],_0x1584eb=_0x3d59c7[_0xb5fc('0x1c')]+_0x3d59c7['limit'],_0x1e0081;if(_0x1584eb>=_0x4f8de4){_0x1584eb=_0x4f8de4;_0x1e0081=0xc8;}else{_0x1e0081=0xce;}_0x2d8fc7[_0xb5fc('0x19')](_0x1e0081);return _0x2d8fc7[_0xb5fc('0x1d')]('Content-Range',_0x13d14c+'-'+_0x1584eb+'/'+_0x4f8de4)[_0xb5fc('0x1a')](_0x41f01a);}return null;};}function patchUpdates(_0x4c3cfc){return function(_0x555cd8){try{jsonpatch['apply'](_0x555cd8,_0x4c3cfc,!![]);}catch(_0x4914b6){return BPromise[_0xb5fc('0x1e')](_0x4914b6);}return _0x555cd8[_0xb5fc('0x1f')]();};}function saveUpdates(_0x24cb02,_0x20deee){return function(_0x2329d1){if(_0x2329d1){return _0x2329d1[_0xb5fc('0x20')](_0x24cb02)[_0xb5fc('0x21')](function(_0x34e6bc){return _0x34e6bc;});}return null;};}function removeEntity(_0x44a0fb,_0x31a402){return function(_0x2d128a){if(_0x2d128a){return _0x2d128a[_0xb5fc('0x22')]()[_0xb5fc('0x21')](function(){var _0x436b6c=_0x2d128a[_0xb5fc('0x23')]({'plain':!![]});var _0x11a6f7=_0xb5fc('0x24');return db[_0xb5fc('0x25')][_0xb5fc('0x22')]({'where':{'type':_0x11a6f7,'resourceId':_0x436b6c['id']}})[_0xb5fc('0x21')](function(){return _0x2d128a;});})[_0xb5fc('0x21')](function(){_0x44a0fb[_0xb5fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d783d,_0x7e0450){return function(_0xc2154f){if(!_0xc2154f){_0x4d783d[_0xb5fc('0x26')](0x194);}return _0xc2154f;};}function handleError(_0x37c715,_0x38969f){_0x38969f=_0x38969f||0x1f4;return function(_0x432e1b){logger[_0xb5fc('0x27')](_0x432e1b['stack']);if(_0x432e1b['name']){delete _0x432e1b[_0xb5fc('0x28')];}_0x37c715[_0xb5fc('0x19')](_0x38969f)[_0xb5fc('0x29')](_0x432e1b);};}exports[_0xb5fc('0x2a')]=function(_0x58290c,_0x26ce7a){var _0x2a1f5f={},_0x4ad71b={},_0x51278={'count':0x0,'rows':[]};var _0x2c6b6d=_[_0xb5fc('0x2b')](db[_0xb5fc('0x2c')]['rawAttributes'],function(_0x28b916){return{'name':_0x28b916[_0xb5fc('0x2d')],'type':_0x28b916[_0xb5fc('0x2e')][_0xb5fc('0x2f')]};});_0x4ad71b[_0xb5fc('0x30')]=_[_0xb5fc('0x2b')](_0x2c6b6d,_0xb5fc('0x28'));_0x4ad71b[_0xb5fc('0x31')]=_[_0xb5fc('0x32')](_0x58290c[_0xb5fc('0x31')]);_0x4ad71b[_0xb5fc('0x33')]=_[_0xb5fc('0x34')](_0x4ad71b['model'],_0x4ad71b[_0xb5fc('0x31')]);_0x2a1f5f[_0xb5fc('0x35')]=_['intersection'](_0x4ad71b[_0xb5fc('0x30')],qs['fields'](_0x58290c[_0xb5fc('0x31')]['fields']));_0x2a1f5f[_0xb5fc('0x35')]=_0x2a1f5f[_0xb5fc('0x35')][_0xb5fc('0x36')]?_0x2a1f5f[_0xb5fc('0x35')]:_0x4ad71b[_0xb5fc('0x30')];if(!_0x58290c[_0xb5fc('0x31')]['hasOwnProperty'](_0xb5fc('0x37'))){_0x2a1f5f[_0xb5fc('0x38')]=qs[_0xb5fc('0x38')](_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x38')]);_0x2a1f5f['offset']=qs[_0xb5fc('0x1c')](_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x1c')]);}_0x2a1f5f['order']=qs[_0xb5fc('0x39')](_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x39')]);_0x2a1f5f[_0xb5fc('0x3a')]=qs[_0xb5fc('0x33')](_[_0xb5fc('0x3b')](_0x58290c['query'],_0x4ad71b[_0xb5fc('0x33')]),_0x2c6b6d);if(_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x3c')]){_0x2a1f5f[_0xb5fc('0x3a')]=_[_0xb5fc('0x3d')](_0x2a1f5f[_0xb5fc('0x3a')],{'$or':_[_0xb5fc('0x2b')](_0x2c6b6d,function(_0x550040){if(_0x550040[_0xb5fc('0x2e')]!=='VIRTUAL'){var _0x4dfa45={};_0x4dfa45[_0x550040[_0xb5fc('0x28')]]={'$like':'%'+_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x3c')]+'%'};return _0x4dfa45;}})});}_0x2a1f5f=_[_0xb5fc('0x3d')]({},_0x2a1f5f,_0x58290c[_0xb5fc('0x3e')]);var _0x2ee153={'where':_0x2a1f5f[_0xb5fc('0x3a')]};return db['CmContactHasPhone'][_0xb5fc('0x1b')](_0x2ee153)[_0xb5fc('0x21')](function(_0x41985c){_0x51278[_0xb5fc('0x1b')]=_0x41985c;if(_0x58290c[_0xb5fc('0x31')][_0xb5fc('0x3f')]){_0x2a1f5f[_0xb5fc('0x40')]=[{'all':!![]}];}return db[_0xb5fc('0x2c')][_0xb5fc('0x41')](_0x2a1f5f);})[_0xb5fc('0x21')](function(_0x1c3b06){_0x51278[_0xb5fc('0x42')]=_0x1c3b06;return _0x51278;})[_0xb5fc('0x21')](respondWithFilteredResult(_0x26ce7a,_0x2a1f5f))[_0xb5fc('0x43')](handleError(_0x26ce7a,null));};exports[_0xb5fc('0x44')]=function(_0x375ced,_0x253a56){var _0x41ac4e={'raw':!![],'where':{'id':_0x375ced[_0xb5fc('0x45')]['id']}},_0x1a525b={};_0x1a525b['model']=_[_0xb5fc('0x32')](db[_0xb5fc('0x2c')][_0xb5fc('0x46')]);_0x1a525b[_0xb5fc('0x31')]=_[_0xb5fc('0x32')](_0x375ced[_0xb5fc('0x31')]);_0x1a525b['filters']=_['intersection'](_0x1a525b[_0xb5fc('0x30')],_0x1a525b[_0xb5fc('0x31')]);_0x41ac4e['attributes']=_[_0xb5fc('0x34')](_0x1a525b[_0xb5fc('0x30')],qs[_0xb5fc('0x47')](_0x375ced['query'][_0xb5fc('0x47')]));_0x41ac4e[_0xb5fc('0x35')]=_0x41ac4e['attributes'][_0xb5fc('0x36')]?_0x41ac4e[_0xb5fc('0x35')]:_0x1a525b['model'];if(_0x375ced[_0xb5fc('0x31')][_0xb5fc('0x3f')]){_0x41ac4e[_0xb5fc('0x40')]=[{'all':!![]}];}_0x41ac4e=_[_0xb5fc('0x3d')]({},_0x41ac4e,_0x375ced[_0xb5fc('0x3e')]);return db[_0xb5fc('0x2c')][_0xb5fc('0x48')](_0x41ac4e)[_0xb5fc('0x21')](handleEntityNotFound(_0x253a56,null))[_0xb5fc('0x21')](respondWithResult(_0x253a56,null))[_0xb5fc('0x43')](handleError(_0x253a56,null));};exports[_0xb5fc('0x49')]=function(_0x1a5755,_0xa7972c){return db[_0xb5fc('0x2c')][_0xb5fc('0x49')](_0x1a5755['body'],{})[_0xb5fc('0x21')](function(_0x21fe47){var _0x5ee632=_0x1a5755['user']['get']({'plain':!![]});if(!_0x5ee632)throw new Error(_0xb5fc('0x4a'));if(_0x5ee632[_0xb5fc('0x4b')]==='user'){var _0x2dd3e1=_0x21fe47['get']({'plain':!![]});var _0x59c523=_0xb5fc('0x24');return db['UserProfileSection'][_0xb5fc('0x48')]({'where':{'name':_0x59c523,'userProfileId':_0x5ee632[_0xb5fc('0x4c')]},'raw':!![]})[_0xb5fc('0x21')](function(_0x5c558e){if(_0x5c558e&&_0x5c558e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2dd3e1[_0xb5fc('0x28')],'resourceId':_0x2dd3e1['id'],'type':_0x5c558e['name'],'sectionId':_0x5c558e['id']},{})[_0xb5fc('0x21')](function(){return _0x21fe47;});}else{return _0x21fe47;}})['catch'](function(_0x3b2329){logger[_0xb5fc('0x27')](_0xb5fc('0x4d'),_0x3b2329);throw _0x3b2329;});}return _0x21fe47;})[_0xb5fc('0x21')](respondWithResult(_0xa7972c,0xc9))[_0xb5fc('0x43')](handleError(_0xa7972c,null));};exports[_0xb5fc('0x20')]=function(_0x359e43,_0x49f4d4){if(_0x359e43[_0xb5fc('0x4e')]['id']){delete _0x359e43['body']['id'];}return db[_0xb5fc('0x2c')][_0xb5fc('0x48')]({'where':{'id':_0x359e43[_0xb5fc('0x45')]['id']}})[_0xb5fc('0x21')](handleEntityNotFound(_0x49f4d4,null))[_0xb5fc('0x21')](saveUpdates(_0x359e43[_0xb5fc('0x4e')],null))['then'](respondWithResult(_0x49f4d4,null))[_0xb5fc('0x43')](handleError(_0x49f4d4,null));};exports[_0xb5fc('0x22')]=function(_0x244228,_0x3e2ea7){return db[_0xb5fc('0x2c')][_0xb5fc('0x48')]({'where':{'id':_0x244228[_0xb5fc('0x45')]['id']}})[_0xb5fc('0x21')](handleEntityNotFound(_0x3e2ea7,null))['then'](removeEntity(_0x3e2ea7,null))[_0xb5fc('0x43')](handleError(_0x3e2ea7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 8814b47..c7711c1 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4b7=['exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','api','moment','bluebird','request-promise','rimraf','./cmContactHasPhone.attributes'];(function(_0x1b64dc,_0x53064c){var _0x3385ec=function(_0x4520ad){while(--_0x4520ad){_0x1b64dc['push'](_0x1b64dc['shift']());}};_0x3385ec(++_0x53064c);}(_0xa4b7,0xbf));var _0x7a4b=function(_0x59dbe1,_0x31d776){_0x59dbe1=_0x59dbe1-0x0;var _0x457197=_0xa4b7[_0x59dbe1];return _0x457197;};'use strict';var _=require(_0x7a4b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7a4b('0x1'));var moment=require(_0x7a4b('0x2'));var BPromise=require(_0x7a4b('0x3'));var rp=require(_0x7a4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a4b('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a4b('0x6'));module[_0x7a4b('0x7')]=function(_0x2ab276,_0x1622c3){return _0x2ab276[_0x7a4b('0x8')](_0x7a4b('0x9'),attributes,{'tableName':_0x7a4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2467=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x1ab59b,_0x143c66){var _0x38361d=function(_0x285aa3){while(--_0x285aa3){_0x1ab59b['push'](_0x1ab59b['shift']());}};_0x38361d(++_0x143c66);}(_0x2467,0xfc));var _0x7246=function(_0x5f3021,_0x1f37b2){_0x5f3021=_0x5f3021-0x0;var _0x33f41d=_0x2467[_0x5f3021];return _0x33f41d;};'use strict';var _=require(_0x7246('0x0'));var util=require('util');var logger=require(_0x7246('0x1'))('api');var moment=require(_0x7246('0x2'));var BPromise=require(_0x7246('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7246('0x4'));var rimraf=require(_0x7246('0x5'));var config=require(_0x7246('0x6'));var attributes=require('./cmContactHasPhone.attributes');module[_0x7246('0x7')]=function(_0x499f18,_0x4d70a2){return _0x499f18[_0x7246('0x8')](_0x7246('0x9'),attributes,{'tableName':_0x7246('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index cec3d91..be2087f 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa583=['message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xed6564,_0x15d60c){var _0xe18d48=function(_0x2d4291){while(--_0x2d4291){_0xed6564['push'](_0xed6564['shift']());}};_0xe18d48(++_0x15d60c);}(_0xa583,0x158));var _0x3a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa583[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a58('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a58('0x1'));var fs=require('fs');var Redis=require(_0x3a58('0x2'));var db=require(_0x3a58('0x3'))['db'];var utils=require(_0x3a58('0x4'));var logger=require(_0x3a58('0x5'))(_0x3a58('0x6'));var config=require(_0x3a58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3a58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cdf5a,_0x58a301,_0x1660a3){return new BPromise(function(_0x5a90d8,_0xb81d63){return client[_0x3a58('0x9')](_0x2cdf5a,_0x1660a3)['then'](function(_0x15469e){logger[_0x3a58('0xa')](_0x3a58('0xb'),_0x58a301,_0x3a58('0xc'));logger[_0x3a58('0xd')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x58a301,_0x3a58('0xc'),JSON[_0x3a58('0xe')](_0x15469e));if(_0x15469e['error']){if(_0x15469e[_0x3a58('0xf')][_0x3a58('0x10')]===0x1f4){logger['error'](_0x3a58('0xb'),_0x58a301,_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);return _0xb81d63(_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);}logger[_0x3a58('0xf')](_0x3a58('0xb'),_0x58a301,_0x15469e[_0x3a58('0xf')][_0x3a58('0x11')]);return _0x5a90d8(_0x15469e['error'][_0x3a58('0x11')]);}else{logger[_0x3a58('0xa')](_0x3a58('0xb'),_0x58a301,_0x3a58('0xc'));_0x5a90d8(_0x15469e[_0x3a58('0x12')][_0x3a58('0x11')]);}})['catch'](function(_0x16b84e){logger[_0x3a58('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x58a301,_0x16b84e);_0xb81d63(_0x16b84e);});});} \ No newline at end of file +var _0x3daf=['client','http','request','then','info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5e797c,_0x1fcd8b){var _0x527c56=function(_0x561760){while(--_0x561760){_0x5e797c['push'](_0x5e797c['shift']());}};_0x527c56(++_0x1fcd8b);}(_0x3daf,0x195));var _0xf3da=function(_0xbf6bde,_0x28a2b0){_0xbf6bde=_0xbf6bde-0x0;var _0x3a25c1=_0x3daf[_0xbf6bde];return _0x3a25c1;};'use strict';var _=require(_0xf3da('0x0'));var util=require(_0xf3da('0x1'));var moment=require('moment');var BPromise=require(_0xf3da('0x2'));var rs=require(_0xf3da('0x3'));var fs=require('fs');var Redis=require(_0xf3da('0x4'));var db=require(_0xf3da('0x5'))['db'];var utils=require(_0xf3da('0x6'));var logger=require(_0xf3da('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf3da('0x8'));var client=jayson[_0xf3da('0x9')][_0xf3da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51dc5a,_0x13b21c,_0x2156de){return new BPromise(function(_0x212417,_0x38e406){return client[_0xf3da('0xb')](_0x51dc5a,_0x2156de)[_0xf3da('0xc')](function(_0xa825c6){logger[_0xf3da('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x13b21c,_0xf3da('0xe'));logger[_0xf3da('0xf')](_0xf3da('0x10'),_0x13b21c,'request\x20sent',JSON['stringify'](_0xa825c6));if(_0xa825c6[_0xf3da('0x11')]){if(_0xa825c6[_0xf3da('0x11')][_0xf3da('0x12')]===0x1f4){logger['error'](_0xf3da('0x13'),_0x13b21c,_0xa825c6[_0xf3da('0x11')]['message']);return _0x38e406(_0xa825c6['error'][_0xf3da('0x14')]);}logger[_0xf3da('0x11')](_0xf3da('0x13'),_0x13b21c,_0xa825c6[_0xf3da('0x11')][_0xf3da('0x14')]);return _0x212417(_0xa825c6[_0xf3da('0x11')][_0xf3da('0x14')]);}else{logger[_0xf3da('0xd')](_0xf3da('0x13'),_0x13b21c,_0xf3da('0xe'));_0x212417(_0xa825c6[_0xf3da('0x15')]['message']);}})[_0xf3da('0x16')](function(_0x232f00){logger[_0xf3da('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x13b21c,_0x232f00);_0x38e406(_0x232f00);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index ac3edc3..eac82e4 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0c6=['show','create','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x412863,_0x5487ea){var _0x4022c6=function(_0x44585f){while(--_0x44585f){_0x412863['push'](_0x412863['shift']());}};_0x4022c6(++_0x5487ea);}(_0xe0c6,0x137));var _0x6e0c=function(_0xebb004,_0x3cbb47){_0xebb004=_0xebb004-0x0;var _0x3d8820=_0xe0c6[_0xebb004];return _0x3d8820;};'use strict';var multer=require(_0x6e0c('0x0'));var util=require('util');var path=require(_0x6e0c('0x1'));var timeout=require(_0x6e0c('0x2'));var express=require(_0x6e0c('0x3'));var router=express[_0x6e0c('0x4')]();var auth=require(_0x6e0c('0x5'));var interaction=require(_0x6e0c('0x6'));var config=require(_0x6e0c('0x7'));var controller=require(_0x6e0c('0x8'));router[_0x6e0c('0x9')]('/',auth[_0x6e0c('0xa')](),controller[_0x6e0c('0xb')]);router['get'](_0x6e0c('0xc'),auth[_0x6e0c('0xa')](),controller[_0x6e0c('0xd')]);router['post']('/',auth[_0x6e0c('0xa')](),controller[_0x6e0c('0xe')]);router['put'](_0x6e0c('0xc'),auth[_0x6e0c('0xa')](),controller[_0x6e0c('0xf')]);router[_0x6e0c('0x10')](_0x6e0c('0xc'),auth[_0x6e0c('0xa')](),controller[_0x6e0c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7d3a=['../../config/environment','./cmContactHasPhone.controller','isAuthenticated','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d3a,0x180));var _0xa7d3=function(_0x44c19c,_0x4843f5){_0x44c19c=_0x44c19c-0x0;var _0x364e38=_0x7d3a[_0x44c19c];return _0x364e38;};'use strict';var multer=require(_0xa7d3('0x0'));var util=require(_0xa7d3('0x1'));var path=require(_0xa7d3('0x2'));var timeout=require(_0xa7d3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa7d3('0x4'));var interaction=require(_0xa7d3('0x5'));var config=require(_0xa7d3('0x6'));var controller=require(_0xa7d3('0x7'));router['get']('/',auth[_0xa7d3('0x8')](),controller['index']);router['get'](_0xa7d3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa7d3('0xa')]('/',auth['isAuthenticated'](),controller[_0xa7d3('0xb')]);router['put'](_0xa7d3('0x9'),auth[_0xa7d3('0x8')](),controller['update']);router[_0xa7d3('0xc')](_0xa7d3('0x9'),auth[_0xa7d3('0x8')](),controller[_0xa7d3('0xd')]);module[_0xa7d3('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b03f2c0..0f87340 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 _0x6f18=['select','parse','values','stringify','BOOLEAN','sequelize','lodash','VIRTUAL','alias','STRING','setDataValue','getDataValue','TEXT','type'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x6f18,0xf3));var _0x86f1=function(_0x399fcb,_0x302cad){_0x399fcb=_0x399fcb-0x0;var _0x4d5f0f=_0x6f18[_0x399fcb];return _0x4d5f0f;};'use strict';var Sequelize=require(_0x86f1('0x0'));var _=require(_0x86f1('0x1'));module['exports']={'name':{'type':Sequelize[_0x86f1('0x2')],'get':function(_0x429f4b){return this['getDataValue'](_0x86f1('0x3'));}},'alias':{'type':Sequelize[_0x86f1('0x4')],'allowNull':![],'set':function(_0x1b8d6c){this[_0x86f1('0x5')](_0x86f1('0x3'),_0x1b8d6c?_0x1b8d6c:this[_0x86f1('0x6')]('name'));}},'type':{'type':Sequelize[_0x86f1('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x86f1('0x7')]('long'),'get':function(){if(this[_0x86f1('0x6')](_0x86f1('0x8'))===_0x86f1('0x9')){return JSON[_0x86f1('0xa')](this[_0x86f1('0x6')]('values'));}else{return this[_0x86f1('0x6')](_0x86f1('0xb'));}},'set':function(_0x1fad3f){if(Array['isArray'](_0x1fad3f)){this[_0x86f1('0x5')](_0x86f1('0xb'),JSON[_0x86f1('0xc')](_0x1fad3f));}else{this[_0x86f1('0x5')]('values',_0x1fad3f);}}},'required':{'type':Sequelize[_0x86f1('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3de=['lodash','exports','VIRTUAL','getDataValue','setDataValue','name','STRING','type','select','values','isArray','BOOLEAN'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xb3de,0x15c));var _0xeb3d=function(_0xc62c47,_0x1fc388){_0xc62c47=_0xc62c47-0x0;var _0x396522=_0xb3de[_0xc62c47];return _0x396522;};'use strict';var Sequelize=require('sequelize');var _=require(_0xeb3d('0x0'));module[_0xeb3d('0x1')]={'name':{'type':Sequelize[_0xeb3d('0x2')],'get':function(_0x45cce7){return this[_0xeb3d('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x27a6b2){this[_0xeb3d('0x4')]('alias',_0x27a6b2?_0x27a6b2:this[_0xeb3d('0x3')](_0xeb3d('0x5')));}},'type':{'type':Sequelize[_0xeb3d('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xeb3d('0x3')](_0xeb3d('0x7'))===_0xeb3d('0x8')){return JSON['parse'](this[_0xeb3d('0x3')](_0xeb3d('0x9')));}else{return this[_0xeb3d('0x3')](_0xeb3d('0x9'));}},'set':function(_0x351fc8){if(Array[_0xeb3d('0xa')](_0x351fc8)){this[_0xeb3d('0x4')](_0xeb3d('0x9'),JSON['stringify'](_0x351fc8));}else{this[_0xeb3d('0x4')](_0xeb3d('0x9'),_0x351fc8);}}},'required':{'type':Sequelize[_0xeb3d('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 fb3eaed..ebbab7e 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 _0x7475=['query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','reject','save','update','then','error','stack','name','send','index','CmCustomField','fieldName','type','differenceBy','map'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7475,0xd0));var _0x5747=function(_0x4c5227,_0x5da181){_0x4c5227=_0x4c5227-0x0;var _0x3f03fa=_0x7475[_0x4c5227];return _0x3f03fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5747('0x0'));var rimraf=require(_0x5747('0x1'));var zipdir=require(_0x5747('0x2'));var jsonpatch=require(_0x5747('0x3'));var rp=require(_0x5747('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5747('0x5'));var util=require(_0x5747('0x6'));var path=require('path');var sox=require(_0x5747('0x7'));var csv=require(_0x5747('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5747('0x9'));var squel=require(_0x5747('0xa'));var crypto=require('crypto');var jsforce=require(_0x5747('0xb'));var deskjs=require(_0x5747('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5747('0xd'));var Papa=require(_0x5747('0xe'));var Redis=require('ioredis');var authService=require(_0x5747('0xf'));var qs=require(_0x5747('0x10'));var as=require(_0x5747('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5747('0x12'))(_0x5747('0x13'));var utils=require(_0x5747('0x14'));var config=require(_0x5747('0x15'));var db=require(_0x5747('0x16'))['db'];function respondWithStatusCode(_0x534e63,_0x500ee2){_0x500ee2=_0x500ee2||0xcc;return function(_0x5d79d3){if(_0x5d79d3){return _0x534e63[_0x5747('0x17')](_0x500ee2);}return _0x534e63['status'](_0x500ee2)[_0x5747('0x18')]();};}function respondWithResult(_0x46b26d,_0x4b8dff){_0x4b8dff=_0x4b8dff||0xc8;return function(_0x531662){if(_0x531662){return _0x46b26d[_0x5747('0x19')](_0x4b8dff)[_0x5747('0x1a')](_0x531662);}};}function respondWithFilteredResult(_0x4a4480,_0x247736){return function(_0x4cff1d){if(_0x4cff1d){var _0x53d4ee=_0x4cff1d[_0x5747('0x1b')],_0x1d5e9f=_0x247736[_0x5747('0x1c')],_0x3e2b14=_0x247736[_0x5747('0x1c')]+_0x247736['limit'],_0x396652;if(_0x3e2b14>=_0x53d4ee){_0x3e2b14=_0x53d4ee;_0x396652=0xc8;}else{_0x396652=0xce;}_0x4a4480['status'](_0x396652);return _0x4a4480[_0x5747('0x1d')]('Content-Range',_0x1d5e9f+'-'+_0x3e2b14+'/'+_0x53d4ee)[_0x5747('0x1a')](_0x4cff1d);}return null;};}function patchUpdates(_0x422376){return function(_0x217d61){try{jsonpatch['apply'](_0x217d61,_0x422376,!![]);}catch(_0x247254){return BPromise[_0x5747('0x1e')](_0x247254);}return _0x217d61[_0x5747('0x1f')]();};}function saveUpdates(_0x5a5272,_0x15b34a){return function(_0x4674a5){if(_0x4674a5){return _0x4674a5[_0x5747('0x20')](_0x5a5272)[_0x5747('0x21')](function(_0x400561){return _0x400561;});}return null;};}function removeEntity(_0x206a6b,_0x532c22){return function(_0x4519da){if(_0x4519da){return _0x4519da['destroy']()[_0x5747('0x21')](function(){_0x206a6b['status'](0xcc)[_0x5747('0x18')]();});}};}function handleEntityNotFound(_0x432359,_0xdd69be){return function(_0x444454){if(!_0x444454){_0x432359[_0x5747('0x17')](0x194);}return _0x444454;};}function handleError(_0x43d6d7,_0x4990cc){_0x4990cc=_0x4990cc||0x1f4;return function(_0x41e6db){logger[_0x5747('0x22')](_0x41e6db[_0x5747('0x23')]);if(_0x41e6db['name']){delete _0x41e6db[_0x5747('0x24')];}_0x43d6d7[_0x5747('0x19')](_0x4990cc)[_0x5747('0x25')](_0x41e6db);};}exports[_0x5747('0x26')]=function(_0x16f3a3,_0x1dd151){var _0x431c85={},_0xf8cd05={},_0x3278a6={'count':0x0,'rows':[]};var _0x3864d5=_['map'](db[_0x5747('0x27')]['rawAttributes'],function(_0x26dd1f){return{'name':_0x26dd1f[_0x5747('0x28')],'type':_0x26dd1f[_0x5747('0x29')]['key']};});_0xf8cd05['model']=_[_0x5747('0x2a')](_[_0x5747('0x2b')](_0x3864d5,_0x5747('0x24')),[_0x5747('0x24')]);_0xf8cd05[_0x5747('0x2c')]=_[_0x5747('0x2d')](_0x16f3a3['query']);_0xf8cd05[_0x5747('0x2e')]=_[_0x5747('0x2f')](_0xf8cd05[_0x5747('0x30')],_0xf8cd05[_0x5747('0x2c')]);_0x431c85['attributes']=_['intersection'](_0xf8cd05['model'],qs['fields'](_0x16f3a3['query'][_0x5747('0x31')]));_0x431c85[_0x5747('0x32')]=_0x431c85[_0x5747('0x32')][_0x5747('0x33')]?_0x431c85['attributes']:_0xf8cd05[_0x5747('0x30')];if(!_0x16f3a3[_0x5747('0x2c')]['hasOwnProperty'](_0x5747('0x34'))){_0x431c85[_0x5747('0x35')]=qs['limit'](_0x16f3a3[_0x5747('0x2c')]['limit']);_0x431c85[_0x5747('0x1c')]=qs[_0x5747('0x1c')](_0x16f3a3[_0x5747('0x2c')][_0x5747('0x1c')]);}_0x431c85[_0x5747('0x36')]=qs['sort'](_0x16f3a3['query'][_0x5747('0x37')]);_0x431c85[_0x5747('0x38')]=qs[_0x5747('0x2e')](_[_0x5747('0x39')](_0x16f3a3[_0x5747('0x2c')],_0xf8cd05[_0x5747('0x2e')]),_0x3864d5);if(_0x16f3a3[_0x5747('0x2c')][_0x5747('0x3a')]){_0x431c85['where']=_[_0x5747('0x3b')](_0x431c85[_0x5747('0x38')],{'$or':_[_0x5747('0x2b')](_0x3864d5,function(_0x183e6b){if(_0x183e6b[_0x5747('0x29')]!==_0x5747('0x3c')){var _0x19c6f4={};_0x19c6f4[_0x183e6b[_0x5747('0x24')]]={'$like':'%'+_0x16f3a3[_0x5747('0x2c')][_0x5747('0x3a')]+'%'};return _0x19c6f4;}})});}_0x431c85=_['merge']({},_0x431c85,_0x16f3a3[_0x5747('0x3d')]);var _0x27f94a={'where':_0x431c85['where']};return db[_0x5747('0x27')][_0x5747('0x1b')](_0x27f94a)['then'](function(_0xb6568e){_0x3278a6[_0x5747('0x1b')]=_0xb6568e;if(_0x16f3a3[_0x5747('0x2c')][_0x5747('0x3e')]){_0x431c85[_0x5747('0x3f')]=[{'all':!![]}];}return db[_0x5747('0x27')]['findAll'](_0x431c85);})[_0x5747('0x21')](function(_0x396d66){_0x3278a6[_0x5747('0x40')]=_0x396d66;return _0x3278a6;})[_0x5747('0x21')](respondWithFilteredResult(_0x1dd151,_0x431c85))['catch'](handleError(_0x1dd151,null));};exports[_0x5747('0x41')]=function(_0xfab494,_0x799ade){var _0xcfea16={'raw':!![],'where':{'id':_0xfab494['params']['id']}},_0x15e1cc={};_0x15e1cc[_0x5747('0x30')]=_[_0x5747('0x2d')](db['CmCustomField'][_0x5747('0x42')]);_0x15e1cc[_0x5747('0x2c')]=_[_0x5747('0x2d')](_0xfab494[_0x5747('0x2c')]);_0x15e1cc[_0x5747('0x2e')]=_[_0x5747('0x2f')](_0x15e1cc[_0x5747('0x30')],_0x15e1cc[_0x5747('0x2c')]);_0xcfea16['attributes']=_[_0x5747('0x2f')](_0x15e1cc[_0x5747('0x30')],qs[_0x5747('0x31')](_0xfab494[_0x5747('0x2c')][_0x5747('0x31')]));_0xcfea16[_0x5747('0x32')]=_0xcfea16['attributes']['length']?_0xcfea16[_0x5747('0x32')]:_0x15e1cc[_0x5747('0x30')];if(_0xfab494[_0x5747('0x2c')]['includeAll']){_0xcfea16[_0x5747('0x3f')]=[{'all':!![]}];}_0xcfea16=_[_0x5747('0x3b')]({},_0xcfea16,_0xfab494[_0x5747('0x3d')]);return db[_0x5747('0x27')][_0x5747('0x43')](_0xcfea16)[_0x5747('0x21')](handleEntityNotFound(_0x799ade,null))['then'](respondWithResult(_0x799ade,null))[_0x5747('0x44')](handleError(_0x799ade,null));};exports['update']=function(_0x24cc7d,_0x40c10d){if(_0x24cc7d['body']['id']){delete _0x24cc7d[_0x5747('0x45')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x24cc7d['params']['id']}})['then'](handleEntityNotFound(_0x40c10d,null))[_0x5747('0x21')](saveUpdates(_0x24cc7d['body'],null))['then'](respondWithResult(_0x40c10d,null))['catch'](handleError(_0x40c10d,null));};exports[_0x5747('0x46')]=function(_0x41e4db,_0x48762c){return db[_0x5747('0x27')][_0x5747('0x43')]({'where':{'id':_0x41e4db['params']['id']}})[_0x5747('0x21')](handleEntityNotFound(_0x48762c,null))[_0x5747('0x21')](removeEntity(_0x48762c,null))[_0x5747('0x44')](handleError(_0x48762c,null));};exports[_0x5747('0x47')]=function(_0x5b0964,_0x48ceef){var _0x4b05b6;return db[_0x5747('0x48')][_0x5747('0x49')](function(_0x425e08){return db[_0x5747('0x27')][_0x5747('0x47')](_0x5b0964[_0x5747('0x45')],{'transaction':_0x425e08})[_0x5747('0x21')](function(_0x4ab7b5){_0x4b05b6=_0x4ab7b5;var _0x56ee86={'type':db[_0x5747('0x4a')][_0x5747('0x4b')],'transaction':_0x425e08};switch(_0x5b0964[_0x5747('0x45')][_0x5747('0x29')]){case _0x5747('0x4c'):_0x56ee86[_0x5747('0x29')]=db[_0x5747('0x4a')][_0x5747('0x4b')];break;case _0x5747('0x4d'):_0x56ee86['type']=db[_0x5747('0x4a')][_0x5747('0x4e')];break;case'switch':_0x56ee86[_0x5747('0x29')]=db[_0x5747('0x4a')][_0x5747('0x4f')];_0x56ee86['defaultValue']=![];break;default:}return db[_0x5747('0x48')][_0x5747('0x50')][_0x5747('0x51')]('cm_contacts',util[_0x5747('0x52')](_0x5747('0x53'),_0x4b05b6['id']),_0x56ee86);})[_0x5747('0x21')](function(){return _0x4b05b6;});})[_0x5747('0x21')](respondWithResult(_0x48ceef,0xc9))[_0x5747('0x44')](handleError(_0x48ceef,null));}; \ No newline at end of file +var _0xf747=['findAll','rows','catch','params','keys','length','find','body','create','sequelize','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x5601a1,_0x5aba57){var _0x473d46=function(_0x45ea82){while(--_0x45ea82){_0x5601a1['push'](_0x5601a1['shift']());}};_0x473d46(++_0x5aba57);}(_0xf747,0x195));var _0x7f74=function(_0x35d488,_0x188bdb){_0x35d488=_0x35d488-0x0;var _0x734b0e=_0xf747[_0x35d488];return _0x734b0e;};'use strict';var pdf=require(_0x7f74('0x0'));var emlformat=require(_0x7f74('0x1'));var rimraf=require(_0x7f74('0x2'));var zipdir=require(_0x7f74('0x3'));var jsonpatch=require(_0x7f74('0x4'));var rp=require(_0x7f74('0x5'));var moment=require('moment');var BPromise=require(_0x7f74('0x6'));var Mustache=require('mustache');var util=require(_0x7f74('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7f74('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f74('0x9'));var squel=require('squel');var crypto=require(_0x7f74('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7f74('0xb'));var toCsv=require(_0x7f74('0x8'));var querystring=require(_0x7f74('0xc'));var Papa=require('papaparse');var Redis=require(_0x7f74('0xd'));var authService=require(_0x7f74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7f74('0xf'));var hardwareService=require(_0x7f74('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7f74('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59c6e7,_0x9ad136){_0x9ad136=_0x9ad136||0xcc;return function(_0x28d75e){if(_0x28d75e){return _0x59c6e7['sendStatus'](_0x9ad136);}return _0x59c6e7[_0x7f74('0x12')](_0x9ad136)[_0x7f74('0x13')]();};}function respondWithResult(_0x4af84f,_0x3075a4){_0x3075a4=_0x3075a4||0xc8;return function(_0x5a1304){if(_0x5a1304){return _0x4af84f['status'](_0x3075a4)['json'](_0x5a1304);}};}function respondWithFilteredResult(_0x928f44,_0x16643f){return function(_0x23cc98){if(_0x23cc98){var _0x3b92a8=_0x23cc98[_0x7f74('0x14')],_0x5576fc=_0x16643f[_0x7f74('0x15')],_0x281c2d=_0x16643f['offset']+_0x16643f[_0x7f74('0x16')],_0x5b5969;if(_0x281c2d>=_0x3b92a8){_0x281c2d=_0x3b92a8;_0x5b5969=0xc8;}else{_0x5b5969=0xce;}_0x928f44[_0x7f74('0x12')](_0x5b5969);return _0x928f44[_0x7f74('0x17')](_0x7f74('0x18'),_0x5576fc+'-'+_0x281c2d+'/'+_0x3b92a8)[_0x7f74('0x19')](_0x23cc98);}return null;};}function patchUpdates(_0x2010f1){return function(_0x16cc96){try{jsonpatch[_0x7f74('0x1a')](_0x16cc96,_0x2010f1,!![]);}catch(_0x509e88){return BPromise[_0x7f74('0x1b')](_0x509e88);}return _0x16cc96['save']();};}function saveUpdates(_0x3d47c2,_0x1988aa){return function(_0x5c4557){if(_0x5c4557){return _0x5c4557[_0x7f74('0x1c')](_0x3d47c2)[_0x7f74('0x1d')](function(_0x5054fe){return _0x5054fe;});}return null;};}function removeEntity(_0x1b9efc,_0x113736){return function(_0x3320e5){if(_0x3320e5){return _0x3320e5[_0x7f74('0x1e')]()[_0x7f74('0x1d')](function(){_0x1b9efc[_0x7f74('0x12')](0xcc)[_0x7f74('0x13')]();});}};}function handleEntityNotFound(_0xbaf570,_0x5d5135){return function(_0x4c4900){if(!_0x4c4900){_0xbaf570['sendStatus'](0x194);}return _0x4c4900;};}function handleError(_0x44a470,_0x4dcaf3){_0x4dcaf3=_0x4dcaf3||0x1f4;return function(_0x558f5d){logger[_0x7f74('0x1f')](_0x558f5d[_0x7f74('0x20')]);if(_0x558f5d[_0x7f74('0x21')]){delete _0x558f5d[_0x7f74('0x21')];}_0x44a470['status'](_0x4dcaf3)['send'](_0x558f5d);};}exports[_0x7f74('0x22')]=function(_0x11a170,_0x584124){var _0x182ad3={},_0x43a993={},_0x29bbb6={'count':0x0,'rows':[]};var _0x29c168=_[_0x7f74('0x23')](db[_0x7f74('0x24')][_0x7f74('0x25')],function(_0x3a536e){return{'name':_0x3a536e['fieldName'],'type':_0x3a536e[_0x7f74('0x26')][_0x7f74('0x27')]};});_0x43a993[_0x7f74('0x28')]=_[_0x7f74('0x29')](_[_0x7f74('0x23')](_0x29c168,_0x7f74('0x21')),[_0x7f74('0x21')]);_0x43a993[_0x7f74('0x2a')]=_['keys'](_0x11a170['query']);_0x43a993[_0x7f74('0x2b')]=_[_0x7f74('0x2c')](_0x43a993[_0x7f74('0x28')],_0x43a993['query']);_0x182ad3['attributes']=_[_0x7f74('0x2c')](_0x43a993[_0x7f74('0x28')],qs[_0x7f74('0x2d')](_0x11a170[_0x7f74('0x2a')][_0x7f74('0x2d')]));_0x182ad3[_0x7f74('0x2e')]=_0x182ad3[_0x7f74('0x2e')]['length']?_0x182ad3[_0x7f74('0x2e')]:_0x43a993[_0x7f74('0x28')];if(!_0x11a170[_0x7f74('0x2a')][_0x7f74('0x2f')](_0x7f74('0x30'))){_0x182ad3[_0x7f74('0x16')]=qs[_0x7f74('0x16')](_0x11a170[_0x7f74('0x2a')][_0x7f74('0x16')]);_0x182ad3[_0x7f74('0x15')]=qs[_0x7f74('0x15')](_0x11a170[_0x7f74('0x2a')][_0x7f74('0x15')]);}_0x182ad3['order']=qs[_0x7f74('0x31')](_0x11a170[_0x7f74('0x2a')]['sort']);_0x182ad3[_0x7f74('0x32')]=qs[_0x7f74('0x2b')](_[_0x7f74('0x33')](_0x11a170[_0x7f74('0x2a')],_0x43a993[_0x7f74('0x2b')]),_0x29c168);if(_0x11a170[_0x7f74('0x2a')][_0x7f74('0x34')]){_0x182ad3['where']=_['merge'](_0x182ad3[_0x7f74('0x32')],{'$or':_[_0x7f74('0x23')](_0x29c168,function(_0x8282f6){if(_0x8282f6[_0x7f74('0x26')]!=='VIRTUAL'){var _0x2ca0d6={};_0x2ca0d6[_0x8282f6[_0x7f74('0x21')]]={'$like':'%'+_0x11a170['query'][_0x7f74('0x34')]+'%'};return _0x2ca0d6;}})});}_0x182ad3=_[_0x7f74('0x35')]({},_0x182ad3,_0x11a170[_0x7f74('0x36')]);var _0x1a9781={'where':_0x182ad3['where']};return db[_0x7f74('0x24')][_0x7f74('0x14')](_0x1a9781)[_0x7f74('0x1d')](function(_0x4ec34d){_0x29bbb6['count']=_0x4ec34d;if(_0x11a170[_0x7f74('0x2a')][_0x7f74('0x37')]){_0x182ad3[_0x7f74('0x38')]=[{'all':!![]}];}return db[_0x7f74('0x24')][_0x7f74('0x39')](_0x182ad3);})[_0x7f74('0x1d')](function(_0x318914){_0x29bbb6[_0x7f74('0x3a')]=_0x318914;return _0x29bbb6;})[_0x7f74('0x1d')](respondWithFilteredResult(_0x584124,_0x182ad3))[_0x7f74('0x3b')](handleError(_0x584124,null));};exports['show']=function(_0x5e3a4a,_0x306388){var _0xf1d05a={'raw':!![],'where':{'id':_0x5e3a4a[_0x7f74('0x3c')]['id']}},_0x361816={};_0x361816['model']=_[_0x7f74('0x3d')](db[_0x7f74('0x24')][_0x7f74('0x25')]);_0x361816[_0x7f74('0x2a')]=_[_0x7f74('0x3d')](_0x5e3a4a[_0x7f74('0x2a')]);_0x361816[_0x7f74('0x2b')]=_['intersection'](_0x361816[_0x7f74('0x28')],_0x361816[_0x7f74('0x2a')]);_0xf1d05a[_0x7f74('0x2e')]=_[_0x7f74('0x2c')](_0x361816[_0x7f74('0x28')],qs[_0x7f74('0x2d')](_0x5e3a4a['query']['fields']));_0xf1d05a['attributes']=_0xf1d05a[_0x7f74('0x2e')][_0x7f74('0x3e')]?_0xf1d05a[_0x7f74('0x2e')]:_0x361816[_0x7f74('0x28')];if(_0x5e3a4a[_0x7f74('0x2a')]['includeAll']){_0xf1d05a[_0x7f74('0x38')]=[{'all':!![]}];}_0xf1d05a=_[_0x7f74('0x35')]({},_0xf1d05a,_0x5e3a4a[_0x7f74('0x36')]);return db[_0x7f74('0x24')][_0x7f74('0x3f')](_0xf1d05a)[_0x7f74('0x1d')](handleEntityNotFound(_0x306388,null))['then'](respondWithResult(_0x306388,null))['catch'](handleError(_0x306388,null));};exports['update']=function(_0x4a3b9a,_0x57832d){if(_0x4a3b9a[_0x7f74('0x40')]['id']){delete _0x4a3b9a[_0x7f74('0x40')]['id'];}return db[_0x7f74('0x24')][_0x7f74('0x3f')]({'where':{'id':_0x4a3b9a[_0x7f74('0x3c')]['id']}})[_0x7f74('0x1d')](handleEntityNotFound(_0x57832d,null))[_0x7f74('0x1d')](saveUpdates(_0x4a3b9a['body'],null))[_0x7f74('0x1d')](respondWithResult(_0x57832d,null))[_0x7f74('0x3b')](handleError(_0x57832d,null));};exports['destroy']=function(_0x45187c,_0x136080){return db['CmCustomField']['find']({'where':{'id':_0x45187c[_0x7f74('0x3c')]['id']}})['then'](handleEntityNotFound(_0x136080,null))['then'](removeEntity(_0x136080,null))[_0x7f74('0x3b')](handleError(_0x136080,null));};exports[_0x7f74('0x41')]=function(_0x3d4d4b,_0x32c1ea){var _0x2a1168;return db[_0x7f74('0x42')]['transaction'](function(_0x41e532){return db[_0x7f74('0x24')][_0x7f74('0x41')](_0x3d4d4b['body'],{'transaction':_0x41e532})[_0x7f74('0x1d')](function(_0x239e81){_0x2a1168=_0x239e81;var _0x20ee23={'type':db[_0x7f74('0x43')][_0x7f74('0x44')],'transaction':_0x41e532};switch(_0x3d4d4b[_0x7f74('0x40')][_0x7f74('0x26')]){case'text':_0x20ee23[_0x7f74('0x26')]=db[_0x7f74('0x43')][_0x7f74('0x44')];break;case _0x7f74('0x45'):_0x20ee23[_0x7f74('0x26')]=db[_0x7f74('0x43')]['INTEGER'];break;case'switch':_0x20ee23[_0x7f74('0x26')]=db[_0x7f74('0x43')][_0x7f74('0x46')];_0x20ee23[_0x7f74('0x47')]=![];break;default:}return db[_0x7f74('0x42')][_0x7f74('0x48')][_0x7f74('0x49')](_0x7f74('0x4a'),util[_0x7f74('0x4b')](_0x7f74('0x4c'),_0x2a1168['id']),_0x20ee23);})['then'](function(){return _0x2a1168;});})[_0x7f74('0x1d')](respondWithResult(_0x32c1ea,0xc9))[_0x7f74('0x3b')](handleError(_0x32c1ea,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6239a10..33c0b08 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 _0xf69c=['define','CmCustomField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x17dd55,_0x1f3e2e){var _0x13921b=function(_0x5f0b14){while(--_0x5f0b14){_0x17dd55['push'](_0x17dd55['shift']());}};_0x13921b(++_0x1f3e2e);}(_0xf69c,0x1e2));var _0xcf69=function(_0x43a954,_0x1d73d7){_0x43a954=_0x43a954-0x0;var _0x1973f6=_0xf69c[_0x43a954];return _0x1973f6;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));module[_0xcf69('0x9')]=function(_0x2e8d3,_0x2ec528){return _0x2e8d3[_0xcf69('0xa')](_0xcf69('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x988c=['bluebird','request-promise','./cmCustomField.attributes','exports','define','CmCustomField','lodash','moment'];(function(_0x377d4c,_0x3dcbcb){var _0x3c298c=function(_0x3150a7){while(--_0x3150a7){_0x377d4c['push'](_0x377d4c['shift']());}};_0x3c298c(++_0x3dcbcb);}(_0x988c,0x19e));var _0xc988=function(_0x15621e,_0xad621c){_0x15621e=_0x15621e-0x0;var _0x587cb6=_0x988c[_0x15621e];return _0x587cb6;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rp=require(_0xc988('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc988('0x4'));module[_0xc988('0x5')]=function(_0x17fa32,_0x56317c){return _0x17fa32[_0xc988('0x6')](_0xc988('0x7'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 744a35e..f1b6b2e 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 _0xc368=['client','request','then','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x47174e,_0xaa43d1){var _0x777962=function(_0x185cb2){while(--_0x185cb2){_0x47174e['push'](_0x47174e['shift']());}};_0x777962(++_0xaa43d1);}(_0xc368,0x7b));var _0x8c36=function(_0x20b14a,_0x397835){_0x20b14a=_0x20b14a-0x0;var _0x358d8f=_0xc368[_0x20b14a];return _0x358d8f;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554022,_0x8ed437,_0x384867){return new BPromise(function(_0x3e76be,_0x26bad1){return client[_0x8c36('0xa')](_0x554022,_0x384867)[_0x8c36('0xb')](function(_0x569f29){logger['info']('CmCustomField,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'));logger[_0x8c36('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'),JSON[_0x8c36('0xe')](_0x569f29));if(_0x569f29[_0x8c36('0xf')]){if(_0x569f29[_0x8c36('0xf')][_0x8c36('0x10')]===0x1f4){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);return _0x26bad1(_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);}logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')]['message']);return _0x3e76be(_0x569f29[_0x8c36('0xf')]['message']);}else{logger[_0x8c36('0x13')](_0x8c36('0x11'),_0x8ed437,_0x8c36('0xc'));_0x3e76be(_0x569f29[_0x8c36('0x14')][_0x8c36('0x12')]);}})[_0x8c36('0x15')](function(_0x3c10eb){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x3c10eb);_0x26bad1(_0x3c10eb);});});} \ No newline at end of file +var _0x6f0d=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x1db592,_0x36fb93){var _0x579123=function(_0x442a07){while(--_0x442a07){_0x1db592['push'](_0x1db592['shift']());}};_0x579123(++_0x36fb93);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x45f095,_0x2b24b7){_0x45f095=_0x45f095-0x0;var _0x1f7365=_0x6f0d[_0x45f095];return _0x1f7365;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6c2021a..d56ce0d 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 _0x6462=['./cmCustomField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0x6462,0x65));var _0x2646=function(_0x5ae349,_0x96dd5d){_0x5ae349=_0x5ae349-0x0;var _0x985f44=_0x6462[_0x5ae349];return _0x985f44;};'use strict';var multer=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var path=require(_0x2646('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2646('0x3')]();var auth=require(_0x2646('0x4'));var interaction=require(_0x2646('0x5'));var config=require(_0x2646('0x6'));var controller=require(_0x2646('0x7'));router[_0x2646('0x8')]('/',auth[_0x2646('0x9')](),controller['index']);router[_0x2646('0x8')]('/:id',auth[_0x2646('0x9')](),controller[_0x2646('0xa')]);router[_0x2646('0xb')]('/',auth['isAuthenticated'](),controller[_0x2646('0xc')]);router[_0x2646('0xd')](_0x2646('0xe'),auth[_0x2646('0x9')](),controller[_0x2646('0xf')]);router[_0x2646('0x10')](_0x2646('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x2646('0x11')]=router; \ No newline at end of file +var _0x936d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x936d,0x183));var _0xd936=function(_0x29f697,_0x595c91){_0x29f697=_0x29f697-0x0;var _0x120872=_0x936d[_0x29f697];return _0x120872;};'use strict';var multer=require(_0xd936('0x0'));var util=require(_0xd936('0x1'));var path=require(_0xd936('0x2'));var timeout=require(_0xd936('0x3'));var express=require('express');var router=express[_0xd936('0x4')]();var auth=require(_0xd936('0x5'));var interaction=require(_0xd936('0x6'));var config=require(_0xd936('0x7'));var controller=require(_0xd936('0x8'));router[_0xd936('0x9')]('/',auth[_0xd936('0xa')](),controller['index']);router[_0xd936('0x9')](_0xd936('0xb'),auth[_0xd936('0xa')](),controller[_0xd936('0xc')]);router['post']('/',auth[_0xd936('0xa')](),controller[_0xd936('0xd')]);router['put'](_0xd936('0xb'),auth[_0xd936('0xa')](),controller['update']);router[_0xd936('0xe')]('/:id',auth[_0xd936('0xa')](),controller[_0xd936('0xf')]);module[_0xd936('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ee6d769..aaa796e 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 _0x326f=['UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x326f,0xd1));var _0xf326=function(_0x1495c1,_0x2e8274){_0x1495c1=_0x1495c1-0x0;var _0x461718=_0x326f[_0x1495c1];return _0x461718;};'use strict';var moment=require(_0xf326('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf326('0x3')],'defaultValue':moment()[_0xf326('0x4')](_0xf326('0x5'))},'countbusyretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf326('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xf326('0x6')](0x2)[_0xf326('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf326('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xf326('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf326('0x6')],'unique':_0xf326('0x8')},'CampaignId':{'type':Sequelize[_0xf326('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba34=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','INTEGER','DATE'];(function(_0x473a84,_0xbacf55){var _0x523213=function(_0x1f8bb1){while(--_0x1f8bb1){_0x473a84['push'](_0x473a84['shift']());}};_0x523213(++_0xbacf55);}(_0xba34,0x119));var _0x4ba3=function(_0x312d12,_0x63f6d4){_0x312d12=_0x312d12-0x0;var _0x51ff71=_0xba34[_0x312d12];return _0x51ff71;};'use strict';var moment=require(_0x4ba3('0x0'));var Sequelize=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'phone':{'type':Sequelize[_0x4ba3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ba3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ba3('0x6')]},'priority':{'type':Sequelize[_0x4ba3('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'ListId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'UserId':{'type':Sequelize[_0x4ba3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'CampaignId':{'type':Sequelize[_0x4ba3('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 472e65f..2c8c11f 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 _0xe1ea=['bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','type','key','model','query','keys','intersection','filters','concat','$and','$gt','$gte','$lt','$eq','$not','$between','$in','$notLike','$notILike','$like','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','create','body','params','describe','destroy','find','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmContact','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x289cf5,_0x501dfc){var _0x1f316d=function(_0x4180c4){while(--_0x4180c4){_0x289cf5['push'](_0x289cf5['shift']());}};_0x1f316d(++_0x501dfc);}(_0xe1ea,0x120));var _0xae1e=function(_0x28f35,_0x327f7b){_0x28f35=_0x28f35-0x0;var _0x53cc46=_0xe1ea[_0x28f35];return _0x53cc46;};'use strict';var pdf=require(_0xae1e('0x0'));var emlformat=require(_0xae1e('0x1'));var rimraf=require(_0xae1e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae1e('0x3'));var rp=require(_0xae1e('0x4'));var moment=require(_0xae1e('0x5'));var BPromise=require(_0xae1e('0x6'));var Mustache=require(_0xae1e('0x7'));var util=require(_0xae1e('0x8'));var path=require(_0xae1e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xae1e('0xa'));var crypto=require(_0xae1e('0xb'));var jsforce=require(_0xae1e('0xc'));var deskjs=require(_0xae1e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xae1e('0xe'));var Papa=require('papaparse');var Redis=require(_0xae1e('0xf'));var shared=require('../../config/environment');var authService=require(_0xae1e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xae1e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae1e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xae1e('0x13'));var db=require(_0xae1e('0x14'))['db'];function respondWithStatusCode(_0x133f4a,_0x38f379){_0x38f379=_0x38f379||0xcc;return function(_0x2a8015){if(_0x2a8015){return _0x133f4a['sendStatus'](_0x38f379);}return _0x133f4a[_0xae1e('0x15')](_0x38f379)[_0xae1e('0x16')]();};}function respondWithResult(_0x1e0be8,_0x4f3ef4){_0x4f3ef4=_0x4f3ef4||0xc8;return function(_0x34f451){if(_0x34f451){return _0x1e0be8[_0xae1e('0x15')](_0x4f3ef4)[_0xae1e('0x17')](_0x34f451);}};}function respondWithFilteredResult(_0x37d4f0,_0x2ed058){return function(_0x21cde9){if(_0x21cde9){var _0xae2758=_0x21cde9['count'],_0x46344e=_0x2ed058[_0xae1e('0x18')],_0x1ab912=_0x2ed058[_0xae1e('0x18')]+_0x2ed058['limit'],_0x404cb9;if(_0x1ab912>=_0xae2758){_0x1ab912=_0xae2758;_0x404cb9=0xc8;}else{_0x404cb9=0xce;}_0x37d4f0[_0xae1e('0x15')](_0x404cb9);return _0x37d4f0[_0xae1e('0x19')](_0xae1e('0x1a'),_0x46344e+'-'+_0x1ab912+'/'+_0xae2758)[_0xae1e('0x17')](_0x21cde9);}return null;};}function patchUpdates(_0x3f8894){return function(_0x237ece){try{jsonpatch[_0xae1e('0x1b')](_0x237ece,_0x3f8894,!![]);}catch(_0x12f9c7){return BPromise[_0xae1e('0x1c')](_0x12f9c7);}return _0x237ece[_0xae1e('0x1d')]();};}function saveUpdates(_0x504d25,_0x332d05){return function(_0xe80e80){if(_0xe80e80){return _0xe80e80[_0xae1e('0x1e')](_0x504d25)['then'](function(_0x6a893f){return _0x6a893f;});}return null;};}function removeEntity(_0x3249fc,_0x8a40c){return function(_0x54b738){if(_0x54b738){return _0x54b738['destroy']()[_0xae1e('0x1f')](function(){_0x3249fc[_0xae1e('0x15')](0xcc)[_0xae1e('0x16')]();});}};}function handleEntityNotFound(_0xae7ab6,_0x52474a){return function(_0x5287d1){if(!_0x5287d1){_0xae7ab6[_0xae1e('0x20')](0x194);}return _0x5287d1;};}function handleError(_0x4a0cc4,_0x2548c6){_0x2548c6=_0x2548c6||0x1f4;return function(_0x2a9001){logger[_0xae1e('0x21')](_0x2a9001[_0xae1e('0x22')]);if(_0x2a9001[_0xae1e('0x23')]){delete _0x2a9001[_0xae1e('0x23')];}_0x4a0cc4[_0xae1e('0x15')](_0x2548c6)[_0xae1e('0x24')](_0x2a9001);};}exports[_0xae1e('0x25')]=function(_0x1e9d87,_0x1635d4){var _0x346765={},_0xfff6d1={},_0x16b750={'count':0x0,'rows':[]};var _0x437b89=_[_0xae1e('0x26')](db[_0xae1e('0x27')]['rawAttributes'],function(_0x205478){return{'name':_0x205478['fieldName'],'type':_0x205478[_0xae1e('0x28')][_0xae1e('0x29')]};});_0xfff6d1[_0xae1e('0x2a')]=_['map'](_0x437b89,'name');_0xfff6d1[_0xae1e('0x2b')]=_[_0xae1e('0x2c')](_0x1e9d87[_0xae1e('0x2b')]);_0xfff6d1['filters']=_[_0xae1e('0x2d')](_0xfff6d1['model'],_0xfff6d1[_0xae1e('0x2b')]);_0xfff6d1[_0xae1e('0x2e')]=_[_0xae1e('0x2f')](_0xfff6d1[_0xae1e('0x2e')],[_0xae1e('0x30'),'$or',_0xae1e('0x31'),_0xae1e('0x32'),_0xae1e('0x33'),'$lte','$ne',_0xae1e('0x34'),_0xae1e('0x35'),_0xae1e('0x36'),'$notBetween',_0xae1e('0x37'),'$notIn','$like',_0xae1e('0x38'),'$iLike',_0xae1e('0x39'),_0xae1e('0x3a'),_0xae1e('0x3b'),_0xae1e('0x3c'),_0xae1e('0x3d'),'$any']);_0x346765[_0xae1e('0x3e')]=_['intersection'](_0xfff6d1[_0xae1e('0x2a')],qs[_0xae1e('0x3f')](_0x1e9d87[_0xae1e('0x2b')]['fields']));_0x346765[_0xae1e('0x3e')]=_0x346765['attributes'][_0xae1e('0x40')]?_0x346765[_0xae1e('0x3e')]:_0xfff6d1['model'];if(!_0x1e9d87['query'][_0xae1e('0x41')](_0xae1e('0x42'))){_0x346765[_0xae1e('0x43')]=qs[_0xae1e('0x43')](_0x1e9d87['query'][_0xae1e('0x43')]);_0x346765[_0xae1e('0x18')]=qs[_0xae1e('0x18')](_0x1e9d87['query'][_0xae1e('0x18')]);}_0x346765[_0xae1e('0x44')]=qs[_0xae1e('0x45')](_0x1e9d87['query']['sort']);_0x346765[_0xae1e('0x46')]=qs[_0xae1e('0x2e')](_[_0xae1e('0x47')](_0x1e9d87['query'],_0xfff6d1[_0xae1e('0x2e')]),_0x437b89);if(_0x1e9d87[_0xae1e('0x2b')]['filter']){_0x346765[_0xae1e('0x46')]=_[_0xae1e('0x48')](_0x346765['where'],{'$or':_[_0xae1e('0x26')](_0x437b89,function(_0x1a801b){if(_0x1a801b[_0xae1e('0x28')]!=='VIRTUAL'){var _0x18b0b6={};_0x18b0b6[_0x1a801b['name']]={'$like':'%'+_0x1e9d87[_0xae1e('0x2b')][_0xae1e('0x49')]+'%'};return _0x18b0b6;}})});}_0x346765=_['merge']({},_0x346765,_0x1e9d87[_0xae1e('0x4a')]);var _0xf10aa1={'where':_0x346765[_0xae1e('0x46')]};return db['CmHopper'][_0xae1e('0x4b')](_0xf10aa1)[_0xae1e('0x1f')](function(_0x4725b2){_0x16b750['count']=_0x4725b2;if(_0x1e9d87['query'][_0xae1e('0x4c')]){_0x346765[_0xae1e('0x4d')]=[{'all':!![]}];}return db[_0xae1e('0x27')][_0xae1e('0x4e')](_0x346765);})[_0xae1e('0x1f')](function(_0x40ae38){_0x16b750[_0xae1e('0x4f')]=_0x40ae38;return _0x16b750;})['then'](respondWithFilteredResult(_0x1635d4,_0x346765))[_0xae1e('0x50')](handleError(_0x1635d4,null));};exports[_0xae1e('0x51')]=function(_0x5b10c6,_0x584e11){var _0x5759d5={'raw':!![],'where':{'id':_0x5b10c6['params']['id']}},_0x5cde40={};_0x5cde40['model']=_[_0xae1e('0x2c')](db['CmHopper']['rawAttributes']);_0x5cde40[_0xae1e('0x2b')]=_[_0xae1e('0x2c')](_0x5b10c6[_0xae1e('0x2b')]);_0x5cde40[_0xae1e('0x2e')]=_[_0xae1e('0x2d')](_0x5cde40[_0xae1e('0x2a')],_0x5cde40[_0xae1e('0x2b')]);_0x5759d5[_0xae1e('0x3e')]=_[_0xae1e('0x2d')](_0x5cde40[_0xae1e('0x2a')],qs[_0xae1e('0x3f')](_0x5b10c6['query'][_0xae1e('0x3f')]));_0x5759d5['attributes']=_0x5759d5[_0xae1e('0x3e')][_0xae1e('0x40')]?_0x5759d5[_0xae1e('0x3e')]:_0x5cde40[_0xae1e('0x2a')];if(_0x5b10c6[_0xae1e('0x2b')][_0xae1e('0x4c')]){_0x5759d5['include']=[{'all':!![]}];}_0x5759d5=_[_0xae1e('0x48')]({},_0x5759d5,_0x5b10c6[_0xae1e('0x4a')]);return db[_0xae1e('0x27')]['find'](_0x5759d5)[_0xae1e('0x1f')](handleEntityNotFound(_0x584e11,null))['then'](respondWithResult(_0x584e11,null))[_0xae1e('0x50')](handleError(_0x584e11,null));};exports['create']=function(_0x5cba77,_0xb714b8){return db['CmHopper'][_0xae1e('0x52')](_0x5cba77[_0xae1e('0x53')],{})[_0xae1e('0x1f')](respondWithResult(_0xb714b8,0xc9))['catch'](handleError(_0xb714b8,null));};exports['update']=function(_0x65e091,_0x54764e){if(_0x65e091[_0xae1e('0x53')]['id']){delete _0x65e091[_0xae1e('0x53')]['id'];}return db[_0xae1e('0x27')]['find']({'where':{'id':_0x65e091[_0xae1e('0x54')]['id']}})[_0xae1e('0x1f')](handleEntityNotFound(_0x54764e,null))[_0xae1e('0x1f')](saveUpdates(_0x65e091[_0xae1e('0x53')],null))['then'](respondWithResult(_0x54764e,null))[_0xae1e('0x50')](handleError(_0x54764e,null));};exports[_0xae1e('0x55')]=function(_0x4a5e64,_0x49f4c7){return db[_0xae1e('0x27')]['describe']()['then'](respondWithResult(_0x49f4c7,null))[_0xae1e('0x50')](handleError(_0x49f4c7,null));};exports[_0xae1e('0x56')]=function(_0x5bd7be,_0x703d78){var _0x17843f;return db[_0xae1e('0x27')][_0xae1e('0x57')]({'where':{'id':_0x5bd7be[_0xae1e('0x54')]['id']}})[_0xae1e('0x1f')](handleEntityNotFound(_0x703d78,null))[_0xae1e('0x1f')](function(_0x18ffa7){if(_0x18ffa7){return _0x18ffa7[_0xae1e('0x56')]()[_0xae1e('0x1f')](function(_0x4be2c4){return _0x4be2c4;});}})['then'](function(_0x4f29af){_0x17843f=_0x4f29af;if(_0x4f29af){if(_0x4f29af['VoiceQueueId']||_0x4f29af[_0xae1e('0x58')]){return db[_0x4f29af['VoiceQueueId']?_0xae1e('0x59'):'Campaign']['find']({'where':{'id':_0x4f29af['VoiceQueueId']?_0x4f29af['VoiceQueueId']:_0x4f29af['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xae1e('0x1f')](function(_0x56b1b0){var _0x1d2112={};if(_0x56b1b0){_['merge'](_0x1d2112,_[_0xae1e('0x5a')](_0x17843f[_0xae1e('0x5b')],[_0xae1e('0x5c'),_0xae1e('0x5d'),'id']));_0x1d2112[_0xae1e('0x5e')]=0x15;_0x1d2112['statedesc']=_0xae1e('0x5f');_0x1d2112[_0xae1e('0x60')]=_0x56b1b0[_0xae1e('0x23')];_0x1d2112[_0xae1e('0x61')]=_0x5bd7be[_0xae1e('0x62')][_0xae1e('0x23')];_0x1d2112[_0xae1e('0x63')]=_0x5bd7be[_0xae1e('0x62')]['id'];_0x1d2112[_0xae1e('0x5f')]=!![];_0x1d2112[_0xae1e('0x64')]=moment()[_0xae1e('0x65')](_0xae1e('0x66'));_0x1d2112['calleridnum']=_0x17843f[_0xae1e('0x67')];_0x1d2112['campaigntype']=_0x17843f['VoiceQueueId']?_0xae1e('0x68'):'ivr';return db['CmContact'][_0xae1e('0x57')]({'where':{'id':_0x1d2112[_0xae1e('0x69')]},'attributes':[_0xae1e('0x6a'),'lastName']})[_0xae1e('0x1f')](function(_0x2313d0){if(!_[_0xae1e('0x6b')](_0x703d78)&&!_['isNil'](_0x2313d0['firstName'])){_0x1d2112[_0xae1e('0x6c')]=_0x2313d0[_0xae1e('0x6a')];if(!_[_0xae1e('0x6b')](_0x2313d0[_0xae1e('0x6d')])){_0x1d2112[_0xae1e('0x6c')]+='\x20'+_0x2313d0[_0xae1e('0x6d')];}}})['finally'](function(){return db[_0xae1e('0x6e')][_0xae1e('0x52')](_0x1d2112);});}})[_0xae1e('0x1f')](function(){return _0x703d78[_0xae1e('0x15')](0xcc)['end']();})[_0xae1e('0x50')](handleError(_0x703d78,null));};exports[_0xae1e('0x6f')]=function(_0x184052,_0x211eb2,_0x31ba80){var _0x28c7fc=[];return db['CmContact'][_0xae1e('0x55')]()['then'](function(_0x361f31){_0x28c7fc=_['keys'](_0x361f31);return _0x184052[_0xae1e('0x62')][_0xae1e('0x70')]({'where':{'type':_0xae1e('0x71'),'dialActive':!![],'dialMethod':_0xae1e('0x72')},'attributes':['id',_0xae1e('0x73')],'raw':!![]});})[_0xae1e('0x1f')](function(_0x38a989){if(_0x38a989&&_0x38a989[_0xae1e('0x40')]){return db[_0xae1e('0x74')][_0xae1e('0x75')](function(_0x3c62a0){var _0x5a2ade={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xae1e('0x66'))},'VoiceQueueId':{'$in':_[_0xae1e('0x26')](_0x38a989,'id')},'$or':[{'UserId':null},{'UserId':_0x184052[_0xae1e('0x62')]['id']}]};var _0xf50a31=[];if(_0x184052[_0xae1e('0x53')][_0xae1e('0x76')]&&_0x184052['body']['direction']===_0xae1e('0x77')){if(!_[_0xae1e('0x78')](_0x184052['body'][_0xae1e('0x79')])){_0x5a2ade['id']={'$in':_0x184052[_0xae1e('0x53')][_0xae1e('0x79')]};}_0xf50a31=[[_0xae1e('0x7a'),_0xae1e('0x7b')],['scheduledAt',_0x38a989[0x0][_0xae1e('0x73')]===_0xae1e('0x7b')?_0xae1e('0x7c'):_0xae1e('0x7b')],db[_0xae1e('0x74')][_0xae1e('0x7d')](_0xae1e('0x7e')),['id',_0xae1e('0x7c')]];}else{if(!_[_0xae1e('0x78')](_0x184052[_0xae1e('0x53')][_0xae1e('0x79')])){_0x5a2ade['id']={'$notIn':_0x184052[_0xae1e('0x53')][_0xae1e('0x79')]};}_0xf50a31=[['priority',_0xae1e('0x7c')],[_0xae1e('0x7f'),_0x38a989[0x0][_0xae1e('0x73')]],db[_0xae1e('0x74')][_0xae1e('0x7d')](_0xae1e('0x80')),['id',_0xae1e('0x7b')]];}return db['CmHopper'][_0xae1e('0x81')]({'attributes':['id',_0xae1e('0x82')],'where':_0x5a2ade,'order':_0xf50a31,'transaction':_0x3c62a0,'lock':_0x3c62a0['LOCK'][_0xae1e('0x83')],'include':[{'model':db[_0xae1e('0x84')],'as':_0xae1e('0x85'),'attributes':_0x28c7fc,'include':[{'model':db[_0xae1e('0x86')],'as':_0xae1e('0x87'),'attributes':['id','name']}]},{'model':db[_0xae1e('0x88')],'as':_0xae1e('0x89'),'attributes':['id',_0xae1e('0x23')]},{'model':db['VoiceQueue'],'as':_0xae1e('0x8a'),'attributes':['id',_0xae1e('0x23'),_0xae1e('0x8b')]}]})[_0xae1e('0x1f')](function(_0x2d9c6b){if(_0x2d9c6b){return _0x2d9c6b[_0xae1e('0x1e')]({'UserId':_0x184052[_0xae1e('0x62')]['id']},{'transaction':_0x3c62a0});}});});}})['then'](handleEntityNotFound(_0x211eb2,null))['then'](respondWithResult(_0x211eb2,null))[_0xae1e('0x50')](handleError(_0x211eb2,null));};exports[_0xae1e('0x8c')]=function(_0x1d747,_0x396fdc,_0x4fcbb7){return _0x1d747['user']['getVoiceQueues']({'where':{'type':_0xae1e('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xae1e('0x1f')](function(_0x555725){if(_0x555725&&_0x555725[_0xae1e('0x40')]){return db[_0xae1e('0x27')][_0xae1e('0x4b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xae1e('0x65')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xae1e('0x26')](_0x555725,'id')},'$or':[{'UserId':null},{'UserId':_0x1d747['user']['id']}]}});}return 0x0;})['then'](function(_0x46c5ca){if(!_['isNil'](_0x46c5ca)&&_[_0xae1e('0x8d')](_0x46c5ca)){return _0x396fdc['status'](0xc8)['json']({'contacts':_0x46c5ca});}else{logger[_0xae1e('0x21')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xae1e('0x8c'),0x194,_0xae1e('0x8e'));_0x396fdc['sendStatus'](0x194);}})['catch'](handleError(_0x396fdc,null));};exports['getTimezones']=function(_0x33a7db,_0x527a8b,_0x820fb8){var _0x347ef8=shared[_0xae1e('0x8f')];var _0x448b5a=[];_[_0xae1e('0x26')](_0x347ef8,function(_0x36aa98){_0x448b5a[_0xae1e('0x90')]({'id':_0x36aa98['name'],'name':_0x36aa98[_0xae1e('0x23')],'utcOffset':_0x36aa98[_0xae1e('0x91')]});});return _0x527a8b[_0xae1e('0x15')](0xc8)[_0xae1e('0x17')]({'tz':_0x448b5a});};exports[_0xae1e('0x92')]=function(_0x2b4a96,_0x199fef,_0x3be36d){var _0x327ab3=shared[_0xae1e('0x8f')];var _0x23301c={};if(!_[_0xae1e('0x6b')](_0x327ab3[_0x2b4a96[_0xae1e('0x53')]['id']]))_0x23301c=_0x327ab3[_0x2b4a96[_0xae1e('0x53')]['id']];return _0x199fef[_0xae1e('0x15')](0xc8)[_0xae1e('0x17')](_0x23301c);}; \ No newline at end of file +var _0x050a=['scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','json','getTimezones','timezones','utcOffset','getTimezone','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','model','filters','query','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','keys','find','create','body','catch','params','describe','VoiceQueueId','VoiceQueue','CampaignId','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x050a,0x1c9));var _0xa050=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x050a[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa050('0x0'));var rimraf=require(_0xa050('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa050('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa050('0x3'));var util=require(_0xa050('0x4'));var path=require('path');var sox=require(_0xa050('0x5'));var csv=require(_0xa050('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa050('0x7'));var squel=require(_0xa050('0x8'));var crypto=require(_0xa050('0x9'));var jsforce=require(_0xa050('0xa'));var deskjs=require(_0xa050('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa050('0xc'));var Redis=require('ioredis');var shared=require(_0xa050('0xd'));var authService=require(_0xa050('0xe'));var qs=require(_0xa050('0xf'));var as=require(_0xa050('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa050('0x11'))(_0xa050('0x12'));var utils=require(_0xa050('0x13'));var config=require('../../config/environment');var db=require(_0xa050('0x14'))['db'];function respondWithStatusCode(_0x42a5a8,_0x4ff1ef){_0x4ff1ef=_0x4ff1ef||0xcc;return function(_0x13f9d2){if(_0x13f9d2){return _0x42a5a8['sendStatus'](_0x4ff1ef);}return _0x42a5a8[_0xa050('0x15')](_0x4ff1ef)['end']();};}function respondWithResult(_0x408c22,_0x38461d){_0x38461d=_0x38461d||0xc8;return function(_0x54d97e){if(_0x54d97e){return _0x408c22[_0xa050('0x15')](_0x38461d)['json'](_0x54d97e);}};}function respondWithFilteredResult(_0x6f4364,_0x5145a4){return function(_0x14e35f){if(_0x14e35f){var _0x333265=_0x14e35f['count'],_0xd0120=_0x5145a4[_0xa050('0x16')],_0x57ace5=_0x5145a4[_0xa050('0x16')]+_0x5145a4[_0xa050('0x17')],_0x2ba1c0;if(_0x57ace5>=_0x333265){_0x57ace5=_0x333265;_0x2ba1c0=0xc8;}else{_0x2ba1c0=0xce;}_0x6f4364[_0xa050('0x15')](_0x2ba1c0);return _0x6f4364[_0xa050('0x18')](_0xa050('0x19'),_0xd0120+'-'+_0x57ace5+'/'+_0x333265)['json'](_0x14e35f);}return null;};}function patchUpdates(_0x563805){return function(_0x4554e0){try{jsonpatch[_0xa050('0x1a')](_0x4554e0,_0x563805,!![]);}catch(_0x458850){return BPromise[_0xa050('0x1b')](_0x458850);}return _0x4554e0[_0xa050('0x1c')]();};}function saveUpdates(_0x35f56e,_0x1b298e){return function(_0x2da315){if(_0x2da315){return _0x2da315[_0xa050('0x1d')](_0x35f56e)[_0xa050('0x1e')](function(_0x344a76){return _0x344a76;});}return null;};}function removeEntity(_0x59dcf7,_0x28bade){return function(_0x1eae7f){if(_0x1eae7f){return _0x1eae7f[_0xa050('0x1f')]()[_0xa050('0x1e')](function(){_0x59dcf7[_0xa050('0x15')](0xcc)[_0xa050('0x20')]();});}};}function handleEntityNotFound(_0x319f65,_0x454bc3){return function(_0x5dc205){if(!_0x5dc205){_0x319f65[_0xa050('0x21')](0x194);}return _0x5dc205;};}function handleError(_0x4373da,_0x54460e){_0x54460e=_0x54460e||0x1f4;return function(_0x339dba){logger[_0xa050('0x22')](_0x339dba[_0xa050('0x23')]);if(_0x339dba[_0xa050('0x24')]){delete _0x339dba[_0xa050('0x24')];}_0x4373da[_0xa050('0x15')](_0x54460e)[_0xa050('0x25')](_0x339dba);};}exports[_0xa050('0x26')]=function(_0x46bf0c,_0x9e1b5c){var _0xb4cba6={},_0x1c412d={},_0x257143={'count':0x0,'rows':[]};var _0x2f2c6a=_[_0xa050('0x27')](db[_0xa050('0x28')][_0xa050('0x29')],function(_0x44b187){return{'name':_0x44b187[_0xa050('0x2a')],'type':_0x44b187['type']['key']};});_0x1c412d[_0xa050('0x2b')]=_['map'](_0x2f2c6a,'name');_0x1c412d['query']=_['keys'](_0x46bf0c['query']);_0x1c412d[_0xa050('0x2c')]=_['intersection'](_0x1c412d['model'],_0x1c412d[_0xa050('0x2d')]);_0x1c412d['filters']=_[_0xa050('0x2e')](_0x1c412d[_0xa050('0x2c')],[_0xa050('0x2f'),_0xa050('0x30'),_0xa050('0x31'),_0xa050('0x32'),_0xa050('0x33'),_0xa050('0x34'),_0xa050('0x35'),_0xa050('0x36'),_0xa050('0x37'),'$between',_0xa050('0x38'),_0xa050('0x39'),_0xa050('0x3a'),_0xa050('0x3b'),_0xa050('0x3c'),_0xa050('0x3d'),_0xa050('0x3e'),_0xa050('0x3b'),_0xa050('0x3f'),_0xa050('0x40'),'$contained',_0xa050('0x41')]);_0xb4cba6[_0xa050('0x42')]=_[_0xa050('0x43')](_0x1c412d[_0xa050('0x2b')],qs[_0xa050('0x44')](_0x46bf0c['query']['fields']));_0xb4cba6[_0xa050('0x42')]=_0xb4cba6[_0xa050('0x42')][_0xa050('0x45')]?_0xb4cba6[_0xa050('0x42')]:_0x1c412d[_0xa050('0x2b')];if(!_0x46bf0c['query']['hasOwnProperty'](_0xa050('0x46'))){_0xb4cba6['limit']=qs[_0xa050('0x17')](_0x46bf0c[_0xa050('0x2d')][_0xa050('0x17')]);_0xb4cba6[_0xa050('0x16')]=qs[_0xa050('0x16')](_0x46bf0c['query'][_0xa050('0x16')]);}_0xb4cba6[_0xa050('0x47')]=qs[_0xa050('0x48')](_0x46bf0c[_0xa050('0x2d')]['sort']);_0xb4cba6[_0xa050('0x49')]=qs[_0xa050('0x2c')](_[_0xa050('0x4a')](_0x46bf0c['query'],_0x1c412d[_0xa050('0x2c')]),_0x2f2c6a);if(_0x46bf0c['query'][_0xa050('0x4b')]){_0xb4cba6[_0xa050('0x49')]=_['merge'](_0xb4cba6[_0xa050('0x49')],{'$or':_['map'](_0x2f2c6a,function(_0x30752d){if(_0x30752d['type']!==_0xa050('0x4c')){var _0x14c28a={};_0x14c28a[_0x30752d[_0xa050('0x24')]]={'$like':'%'+_0x46bf0c[_0xa050('0x2d')][_0xa050('0x4b')]+'%'};return _0x14c28a;}})});}_0xb4cba6=_[_0xa050('0x4d')]({},_0xb4cba6,_0x46bf0c[_0xa050('0x4e')]);var _0x434dd5={'where':_0xb4cba6[_0xa050('0x49')]};return db[_0xa050('0x28')][_0xa050('0x4f')](_0x434dd5)[_0xa050('0x1e')](function(_0x804afd){_0x257143[_0xa050('0x4f')]=_0x804afd;if(_0x46bf0c[_0xa050('0x2d')][_0xa050('0x50')]){_0xb4cba6[_0xa050('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0xa050('0x52')](_0xb4cba6);})[_0xa050('0x1e')](function(_0x3c9ade){_0x257143[_0xa050('0x53')]=_0x3c9ade;return _0x257143;})['then'](respondWithFilteredResult(_0x9e1b5c,_0xb4cba6))['catch'](handleError(_0x9e1b5c,null));};exports[_0xa050('0x54')]=function(_0x4986a3,_0x4fd6fb){var _0x441fa5={'raw':!![],'where':{'id':_0x4986a3['params']['id']}},_0x21b052={};_0x21b052['model']=_[_0xa050('0x55')](db[_0xa050('0x28')][_0xa050('0x29')]);_0x21b052[_0xa050('0x2d')]=_[_0xa050('0x55')](_0x4986a3[_0xa050('0x2d')]);_0x21b052[_0xa050('0x2c')]=_[_0xa050('0x43')](_0x21b052['model'],_0x21b052['query']);_0x441fa5[_0xa050('0x42')]=_[_0xa050('0x43')](_0x21b052[_0xa050('0x2b')],qs[_0xa050('0x44')](_0x4986a3['query']['fields']));_0x441fa5['attributes']=_0x441fa5[_0xa050('0x42')]['length']?_0x441fa5['attributes']:_0x21b052['model'];if(_0x4986a3['query'][_0xa050('0x50')]){_0x441fa5[_0xa050('0x51')]=[{'all':!![]}];}_0x441fa5=_[_0xa050('0x4d')]({},_0x441fa5,_0x4986a3[_0xa050('0x4e')]);return db['CmHopper'][_0xa050('0x56')](_0x441fa5)['then'](handleEntityNotFound(_0x4fd6fb,null))[_0xa050('0x1e')](respondWithResult(_0x4fd6fb,null))['catch'](handleError(_0x4fd6fb,null));};exports[_0xa050('0x57')]=function(_0x5607b7,_0x29775e){return db[_0xa050('0x28')]['create'](_0x5607b7[_0xa050('0x58')],{})[_0xa050('0x1e')](respondWithResult(_0x29775e,0xc9))[_0xa050('0x59')](handleError(_0x29775e,null));};exports[_0xa050('0x1d')]=function(_0x4d83fd,_0x3f0b4e){if(_0x4d83fd[_0xa050('0x58')]['id']){delete _0x4d83fd[_0xa050('0x58')]['id'];}return db[_0xa050('0x28')][_0xa050('0x56')]({'where':{'id':_0x4d83fd[_0xa050('0x5a')]['id']}})[_0xa050('0x1e')](handleEntityNotFound(_0x3f0b4e,null))[_0xa050('0x1e')](saveUpdates(_0x4d83fd[_0xa050('0x58')],null))[_0xa050('0x1e')](respondWithResult(_0x3f0b4e,null))[_0xa050('0x59')](handleError(_0x3f0b4e,null));};exports[_0xa050('0x5b')]=function(_0x4bf462,_0x227b48){return db[_0xa050('0x28')][_0xa050('0x5b')]()[_0xa050('0x1e')](respondWithResult(_0x227b48,null))['catch'](handleError(_0x227b48,null));};exports[_0xa050('0x1f')]=function(_0x38ebca,_0x25ba24){var _0xfad29c;return db[_0xa050('0x28')][_0xa050('0x56')]({'where':{'id':_0x38ebca[_0xa050('0x5a')]['id']}})[_0xa050('0x1e')](handleEntityNotFound(_0x25ba24,null))[_0xa050('0x1e')](function(_0x54832f){if(_0x54832f){return _0x54832f[_0xa050('0x1f')]()[_0xa050('0x1e')](function(_0x1d3934){return _0x1d3934;});}})[_0xa050('0x1e')](function(_0x2f1b44){_0xfad29c=_0x2f1b44;if(_0x2f1b44){if(_0x2f1b44[_0xa050('0x5c')]||_0x2f1b44['CampaignId']){return db[_0x2f1b44[_0xa050('0x5c')]?_0xa050('0x5d'):'Campaign'][_0xa050('0x56')]({'where':{'id':_0x2f1b44[_0xa050('0x5c')]?_0x2f1b44[_0xa050('0x5c')]:_0x2f1b44[_0xa050('0x5e')]},'attributes':['id',_0xa050('0x24')],'raw':!![]});}}})[_0xa050('0x1e')](function(_0x9a8407){var _0x522af6={};if(_0x9a8407){_[_0xa050('0x4d')](_0x522af6,_[_0xa050('0x5f')](_0xfad29c[_0xa050('0x60')],['createdAt',_0xa050('0x61'),'id']));_0x522af6[_0xa050('0x62')]=0x15;_0x522af6['statedesc']=_0xa050('0x63');_0x522af6[_0xa050('0x64')]=_0x9a8407[_0xa050('0x24')];_0x522af6[_0xa050('0x65')]=_0x38ebca[_0xa050('0x66')][_0xa050('0x24')];_0x522af6['UserId']=_0x38ebca['user']['id'];_0x522af6[_0xa050('0x63')]=!![];_0x522af6['deletedat']=moment()[_0xa050('0x67')](_0xa050('0x68'));_0x522af6[_0xa050('0x69')]=_0xfad29c['phone'];_0x522af6[_0xa050('0x6a')]=_0xfad29c[_0xa050('0x5c')]?'queue':_0xa050('0x6b');return db[_0xa050('0x6c')][_0xa050('0x56')]({'where':{'id':_0x522af6['ContactId']},'attributes':['firstName',_0xa050('0x6d')]})[_0xa050('0x1e')](function(_0x57fbf3){if(!_['isNil'](_0x25ba24)&&!_[_0xa050('0x6e')](_0x57fbf3[_0xa050('0x6f')])){_0x522af6[_0xa050('0x70')]=_0x57fbf3['firstName'];if(!_['isNil'](_0x57fbf3[_0xa050('0x6d')])){_0x522af6[_0xa050('0x70')]+='\x20'+_0x57fbf3[_0xa050('0x6d')];}}})[_0xa050('0x71')](function(){return db[_0xa050('0x72')][_0xa050('0x57')](_0x522af6);});}})[_0xa050('0x1e')](function(){return _0x25ba24[_0xa050('0x15')](0xcc)[_0xa050('0x20')]();})['catch'](handleError(_0x25ba24,null));};exports[_0xa050('0x73')]=function(_0x3baf76,_0x4443fe,_0x501887){var _0x938cc0=[];return db[_0xa050('0x6c')][_0xa050('0x5b')]()['then'](function(_0xdec59b){_0x938cc0=_[_0xa050('0x55')](_0xdec59b);return _0x3baf76[_0xa050('0x66')][_0xa050('0x74')]({'where':{'type':_0xa050('0x75'),'dialActive':!![],'dialMethod':_0xa050('0x76')},'attributes':['id',_0xa050('0x77')],'raw':!![]});})[_0xa050('0x1e')](function(_0x419253){if(_0x419253&&_0x419253[_0xa050('0x45')]){return db[_0xa050('0x78')]['transaction'](function(_0xb31451){var _0x510afc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa050('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x419253,'id')},'$or':[{'UserId':null},{'UserId':_0x3baf76[_0xa050('0x66')]['id']}]};var _0x508013=[];if(_0x3baf76[_0xa050('0x58')][_0xa050('0x79')]&&_0x3baf76[_0xa050('0x58')][_0xa050('0x79')]===_0xa050('0x7a')){if(!_['isEmpty'](_0x3baf76[_0xa050('0x58')][_0xa050('0x7b')])){_0x510afc['id']={'$in':_0x3baf76[_0xa050('0x58')][_0xa050('0x7b')]};}_0x508013=[['priority',_0xa050('0x7c')],[_0xa050('0x7d'),_0x419253[0x0][_0xa050('0x77')]===_0xa050('0x7c')?_0xa050('0x7e'):_0xa050('0x7c')],db[_0xa050('0x78')][_0xa050('0x7f')](_0xa050('0x80')),['id',_0xa050('0x7e')]];}else{if(!_['isEmpty'](_0x3baf76[_0xa050('0x58')][_0xa050('0x7b')])){_0x510afc['id']={'$notIn':_0x3baf76['body'][_0xa050('0x7b')]};}_0x508013=[[_0xa050('0x81'),'DESC'],[_0xa050('0x7d'),_0x419253[0x0][_0xa050('0x77')]],db[_0xa050('0x78')][_0xa050('0x7f')](_0xa050('0x82')),['id','ASC']];}return db[_0xa050('0x28')]['findOne']({'attributes':['id',_0xa050('0x83')],'where':_0x510afc,'order':_0x508013,'transaction':_0xb31451,'lock':_0xb31451[_0xa050('0x84')][_0xa050('0x85')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x938cc0,'include':[{'model':db[_0xa050('0x86')],'as':_0xa050('0x87'),'attributes':['id','name']}]},{'model':db[_0xa050('0x88')],'as':_0xa050('0x89'),'attributes':['id',_0xa050('0x24')]},{'model':db['VoiceQueue'],'as':_0xa050('0x8a'),'attributes':['id',_0xa050('0x24'),_0xa050('0x8b')]}]})[_0xa050('0x1e')](function(_0x28eee1){if(_0x28eee1){return _0x28eee1[_0xa050('0x1d')]({'UserId':_0x3baf76['user']['id']},{'transaction':_0xb31451});}});});}})[_0xa050('0x1e')](handleEntityNotFound(_0x4443fe,null))[_0xa050('0x1e')](respondWithResult(_0x4443fe,null))['catch'](handleError(_0x4443fe,null));};exports[_0xa050('0x8c')]=function(_0xa8c017,_0x5d25b8,_0x329389){return _0xa8c017[_0xa050('0x66')]['getVoiceQueues']({'where':{'type':_0xa050('0x75'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x25280a){if(_0x25280a&&_0x25280a[_0xa050('0x45')]){return db['CmHopper'][_0xa050('0x4f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa050('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x25280a,'id')},'$or':[{'UserId':null},{'UserId':_0xa8c017[_0xa050('0x66')]['id']}]}});}return 0x0;})[_0xa050('0x1e')](function(_0x5be787){if(!_['isNil'](_0x5be787)&&_[_0xa050('0x8d')](_0x5be787)){return _0x5d25b8['status'](0xc8)[_0xa050('0x8e')]({'contacts':_0x5be787});}else{logger[_0xa050('0x22')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xa050('0x8c'),0x194,'entity\x20not\x20found');_0x5d25b8[_0xa050('0x21')](0x194);}})[_0xa050('0x59')](handleError(_0x5d25b8,null));};exports[_0xa050('0x8f')]=function(_0x503930,_0x44e7b0,_0x1e3bba){var _0x1a3e78=shared[_0xa050('0x90')];var _0x17e1eb=[];_['map'](_0x1a3e78,function(_0x55d570){_0x17e1eb['push']({'id':_0x55d570['name'],'name':_0x55d570[_0xa050('0x24')],'utcOffset':_0x55d570[_0xa050('0x91')]});});return _0x44e7b0['status'](0xc8)['json']({'tz':_0x17e1eb});};exports[_0xa050('0x92')]=function(_0x4b4379,_0x538711,_0x4af7c5){var _0x301992=shared[_0xa050('0x90')];var _0x32eb6a={};if(!_[_0xa050('0x6e')](_0x301992[_0x4b4379[_0xa050('0x58')]['id']]))_0x32eb6a=_0x301992[_0x4b4379[_0xa050('0x58')]['id']];return _0x538711[_0xa050('0x15')](0xc8)['json'](_0x32eb6a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 987b556..9125ffb 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 _0xb49d=['path','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','lodash','util','moment','bluebird','request-promise'];(function(_0x3541e4,_0x4dcf9a){var _0x3ca5d9=function(_0x3eaac2){while(--_0x3eaac2){_0x3541e4['push'](_0x3541e4['shift']());}};_0x3ca5d9(++_0x4dcf9a);}(_0xb49d,0x121));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb49('0x0'));var util=require(_0xdb49('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdb49('0x2'));var BPromise=require(_0xdb49('0x3'));var rp=require(_0xdb49('0x4'));var fs=require('fs');var path=require(_0xdb49('0x5'));var rimraf=require(_0xdb49('0x6'));var config=require(_0xdb49('0x7'));var attributes=require(_0xdb49('0x8'));module[_0xdb49('0x9')]=function(_0x4e75fe,_0x3c7301){return _0x4e75fe['define'](_0xdb49('0xa'),attributes,{'tableName':_0xdb49('0xb'),'paranoid':![],'indexes':[{'name':_0xdb49('0xc'),'fields':[_0xdb49('0xc')]},{'name':_0xdb49('0xd'),'fields':[_0xdb49('0xd')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x99a3=['define','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x99a3,0x86));var _0x399a=function(_0x56a705,_0x3a165b){_0x56a705=_0x56a705-0x0;var _0x1166a1=_0x99a3[_0x56a705];return _0x1166a1;};'use strict';var _=require(_0x399a('0x0'));var util=require(_0x399a('0x1'));var logger=require('../../config/logger')(_0x399a('0x2'));var moment=require(_0x399a('0x3'));var BPromise=require(_0x399a('0x4'));var rp=require(_0x399a('0x5'));var fs=require('fs');var path=require(_0x399a('0x6'));var rimraf=require(_0x399a('0x7'));var config=require(_0x399a('0x8'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5e4bf9,_0x6304d5){return _0x5e4bf9[_0x399a('0x9')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x399a('0xa')]},{'name':_0x399a('0xb'),'fields':[_0x399a('0xb')]},{'name':_0x399a('0xc'),'fields':[_0x399a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f16f4f7..f2620be 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 _0x2fbd=['CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','message','CmHopper','findAll','options','raw','where','attributes','limit','include','map','GetCmHopper','stringify','catch','ShowCmHopper','find','model','debug','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','Contact','Agent','name','voicePause','includes','UserId','all','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','order','UPDATE','length','push','keys','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info'];(function(_0x5d9be4,_0x5df4b6){var _0x44650b=function(_0x105191){while(--_0x105191){_0x5d9be4['push'](_0x5d9be4['shift']());}};_0x44650b(++_0x5df4b6);}(_0x2fbd,0xf6));var _0xd2fb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2fbd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd2fb('0x0'));var BPromise=require('bluebird');var rs=require(_0xd2fb('0x1'));var fs=require('fs');var Redis=require(_0xd2fb('0x2'));var db=require(_0xd2fb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd2fb('0x4'));var config=require(_0xd2fb('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd2fb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x524639,_0x54f415,_0x559f22){return new BPromise(function(_0x24ace5,_0xf348e0){return client[_0xd2fb('0x7')](_0x524639,_0x559f22)[_0xd2fb('0x8')](function(_0x5e51ce){logger[_0xd2fb('0x9')](_0xd2fb('0xa'),_0x54f415,_0xd2fb('0xb'));logger['debug'](_0xd2fb('0xc'),_0x54f415,_0xd2fb('0xb'),JSON['stringify'](_0x5e51ce));if(_0x5e51ce[_0xd2fb('0xd')]){if(_0x5e51ce['error']['code']===0x1f4){logger[_0xd2fb('0xd')](_0xd2fb('0xa'),_0x54f415,_0x5e51ce[_0xd2fb('0xd')][_0xd2fb('0xe')]);return _0xf348e0(_0x5e51ce[_0xd2fb('0xd')]['message']);}logger[_0xd2fb('0xd')](_0xd2fb('0xa'),_0x54f415,_0x5e51ce[_0xd2fb('0xd')][_0xd2fb('0xe')]);return _0x24ace5(_0x5e51ce[_0xd2fb('0xd')][_0xd2fb('0xe')]);}else{logger[_0xd2fb('0x9')]('CmHopper,\x20%s,\x20%s',_0x54f415,_0xd2fb('0xb'));_0x24ace5(_0x5e51ce['result']['message']);}})['catch'](function(_0x43ef76){logger[_0xd2fb('0xd')](_0xd2fb('0xa'),_0x54f415,_0x43ef76);_0xf348e0(_0x43ef76);});});}exports['GetCmHopper']=function(_0x289cb5){var _0x16d052=this;return new Promise(function(_0x4c4cba,_0x39359f){return db[_0xd2fb('0xf')][_0xd2fb('0x10')]({'raw':_0x289cb5[_0xd2fb('0x11')]?_0x289cb5[_0xd2fb('0x11')][_0xd2fb('0x12')]===undefined?!![]:![]:!![],'where':_0x289cb5['options']?_0x289cb5[_0xd2fb('0x11')][_0xd2fb('0x13')]||null:null,'attributes':_0x289cb5['options']?_0x289cb5[_0xd2fb('0x11')][_0xd2fb('0x14')]||null:null,'limit':_0x289cb5[_0xd2fb('0x11')]?_0x289cb5[_0xd2fb('0x11')][_0xd2fb('0x15')]||null:null,'include':_0x289cb5[_0xd2fb('0x11')]?_0x289cb5['options'][_0xd2fb('0x16')]?_[_0xd2fb('0x17')](_0x289cb5[_0xd2fb('0x11')][_0xd2fb('0x16')],function(_0x23f883){return{'model':db[_0x23f883['model']],'as':_0x23f883['as'],'attributes':_0x23f883[_0xd2fb('0x14')],'include':_0x23f883['include']?_[_0xd2fb('0x17')](_0x23f883[_0xd2fb('0x16')],function(_0x4f9be9){return{'model':db[_0x4f9be9['model']],'as':_0x4f9be9['as'],'attributes':_0x4f9be9['attributes'],'include':_0x4f9be9[_0xd2fb('0x16')]?_[_0xd2fb('0x17')](_0x4f9be9[_0xd2fb('0x16')],function(_0x2decaa){return{'model':db[_0x2decaa['model']],'as':_0x2decaa['as'],'attributes':_0x2decaa[_0xd2fb('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd2fb('0x8')](function(_0x580889){logger[_0xd2fb('0x9')](_0xd2fb('0x18'),_0x289cb5);logger['debug'](_0xd2fb('0x18'),_0x289cb5,JSON[_0xd2fb('0x19')](_0x580889));_0x4c4cba(_0x580889);})[_0xd2fb('0x1a')](function(_0x1adc3a){logger[_0xd2fb('0xd')]('GetCmHopper',_0x1adc3a[_0xd2fb('0xe')],_0x289cb5);_0x39359f(_0x16d052['error'](0x1f4,_0x1adc3a['message']));});});};exports[_0xd2fb('0x1b')]=function(_0x141f45){var _0x2fc241=this;return new Promise(function(_0x2d5b7c,_0x1c4626){return db[_0xd2fb('0xf')][_0xd2fb('0x1c')]({'raw':_0x141f45[_0xd2fb('0x11')]?_0x141f45['options'][_0xd2fb('0x12')]===undefined?!![]:![]:!![],'where':_0x141f45[_0xd2fb('0x11')]?_0x141f45['options'][_0xd2fb('0x13')]||null:null,'attributes':_0x141f45[_0xd2fb('0x11')]?_0x141f45[_0xd2fb('0x11')]['attributes']||null:null,'include':_0x141f45['options']?_0x141f45[_0xd2fb('0x11')][_0xd2fb('0x16')]?_[_0xd2fb('0x17')](_0x141f45['options'][_0xd2fb('0x16')],function(_0x2cf71f){return{'model':db[_0x2cf71f[_0xd2fb('0x1d')]],'as':_0x2cf71f['as'],'attributes':_0x2cf71f[_0xd2fb('0x14')],'include':_0x2cf71f[_0xd2fb('0x16')]?_['map'](_0x2cf71f[_0xd2fb('0x16')],function(_0x9e4a76){return{'model':db[_0x9e4a76[_0xd2fb('0x1d')]],'as':_0x9e4a76['as'],'attributes':_0x9e4a76[_0xd2fb('0x14')],'include':_0x9e4a76['include']?_[_0xd2fb('0x17')](_0x9e4a76[_0xd2fb('0x16')],function(_0x38e0c5){return{'model':db[_0x38e0c5[_0xd2fb('0x1d')]],'as':_0x38e0c5['as'],'attributes':_0x38e0c5[_0xd2fb('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x81abbd){logger['info'](_0xd2fb('0x1b'),_0x141f45);logger[_0xd2fb('0x1e')](_0xd2fb('0x1b'),_0x141f45,JSON[_0xd2fb('0x19')](_0x81abbd));_0x2d5b7c(_0x81abbd);})[_0xd2fb('0x1a')](function(_0x451338){logger[_0xd2fb('0xd')](_0xd2fb('0x1b'),_0x451338[_0xd2fb('0xe')],_0x141f45);_0x1c4626(_0x2fc241[_0xd2fb('0xd')](0x1f4,_0x451338[_0xd2fb('0xe')]));});});};exports[_0xd2fb('0x1f')]=function(_0x322e27){var _0x22145d=this;return new Promise(function(_0x542fce,_0x13d92b){return db[_0xd2fb('0xf')][_0xd2fb('0x20')](_0x322e27[_0xd2fb('0x21')],{'raw':_0x322e27[_0xd2fb('0x11')]?_0x322e27[_0xd2fb('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xd2fb('0x8')](function(_0x1e8c21){logger[_0xd2fb('0x9')](_0xd2fb('0x1f'),_0x322e27);logger['debug']('CreateCmHopper',_0x322e27,JSON[_0xd2fb('0x19')](_0x1e8c21));_0x542fce(_0x1e8c21);})[_0xd2fb('0x1a')](function(_0x16c47b){logger['error'](_0xd2fb('0x1f'),_0x16c47b[_0xd2fb('0xe')],_0x322e27);_0x13d92b(_0x22145d[_0xd2fb('0xd')](0x1f4,_0x16c47b[_0xd2fb('0xe')]));});});};exports[_0xd2fb('0x22')]=function(_0x3056ef){var _0x1be928=this;return new Promise(function(_0x4bbb5e,_0x1e9513){return db[_0xd2fb('0xf')][_0xd2fb('0x23')](_0x3056ef[_0xd2fb('0x21')],{'raw':_0x3056ef[_0xd2fb('0x11')]?_0x3056ef[_0xd2fb('0x11')][_0xd2fb('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3056ef[_0xd2fb('0x11')]?_0x3056ef[_0xd2fb('0x11')][_0xd2fb('0x13')]||null:null,'attributes':_0x3056ef[_0xd2fb('0x11')]?_0x3056ef[_0xd2fb('0x11')][_0xd2fb('0x14')]||null:null,'limit':_0x3056ef[_0xd2fb('0x11')]?_0x3056ef[_0xd2fb('0x11')][_0xd2fb('0x15')]||null:null})[_0xd2fb('0x8')](function(_0xfa7083){logger[_0xd2fb('0x9')](_0xd2fb('0x22'),_0x3056ef);logger[_0xd2fb('0x1e')](_0xd2fb('0x22'),_0x3056ef,JSON[_0xd2fb('0x19')](_0xfa7083));_0x4bbb5e(_0xfa7083);})[_0xd2fb('0x1a')](function(_0x27763a){logger[_0xd2fb('0xd')](_0xd2fb('0x22'),_0x27763a[_0xd2fb('0xe')],_0x3056ef);_0x1e9513(_0x1be928[_0xd2fb('0xd')](0x1f4,_0x27763a[_0xd2fb('0xe')]));});});};exports[_0xd2fb('0x24')]=function(_0x12ee4a){var _0x124534=this;return new Promise(function(_0x4c2249,_0x543b07){return db[_0xd2fb('0xf')][_0xd2fb('0x25')]({'where':_0x12ee4a['options']?_0x12ee4a[_0xd2fb('0x11')]['where']||null:null})[_0xd2fb('0x8')](function(_0xb6b07d){logger['info'](_0xd2fb('0x24'),_0x12ee4a);logger[_0xd2fb('0x1e')]('DestroyCmHopper',_0x12ee4a,JSON[_0xd2fb('0x19')](_0xb6b07d));_0x4c2249(_0xb6b07d);})[_0xd2fb('0x1a')](function(_0x5e6d5c){logger[_0xd2fb('0xd')](_0xd2fb('0x24'),_0x5e6d5c['message'],_0x12ee4a);_0x543b07(_0x124534[_0xd2fb('0xd')](0x1f4,_0x5e6d5c['message']));});});};exports[_0xd2fb('0x26')]=function(_0x336876){var _0x480729=this;return new Promise(function(_0x4101c8,_0x1d911e){return db[_0xd2fb('0x27')][_0xd2fb('0x28')]()['then'](function(_0x295ffc){return db[_0xd2fb('0x29')]['transaction'](function(_0x1b0d25){return db[_0xd2fb('0xf')][_0xd2fb('0x10')]({'where':_0x336876[_0xd2fb('0x11')]?_0x336876[_0xd2fb('0x11')][_0xd2fb('0x13')]||null:null,'attributes':_0x336876['options']?_0x336876['options']['attributes']||null:null,'limit':_0x336876[_0xd2fb('0x11')]?_0x336876[_0xd2fb('0x11')][_0xd2fb('0x15')]||null:null,'order':_0x336876['options']?_0x336876[_0xd2fb('0x11')]['order']||null:null,'transaction':_0x1b0d25,'lock':_0x1b0d25[_0xd2fb('0x2a')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xd2fb('0x2b'),'attributes':_['keys'](_0x295ffc)},{'model':db['User'],'as':_0xd2fb('0x2c'),'attributes':['id',_0xd2fb('0x2d'),_0xd2fb('0x2e')]}]})['then'](function(_0x53e353){var _0x115bfd=[];var _0x55dce5=[];for(var _0x85f971=0x0;_0x85f971<_0x53e353['length'];_0x85f971+=0x1){if(!_0x55dce5[_0xd2fb('0x2f')](_0x53e353[_0x85f971][_0xd2fb('0x30')])){_0x55dce5['push'](_0x53e353[_0x85f971]['UserId']);_0x115bfd['push'](_0x53e353[_0x85f971]['update'](_0x336876[_0xd2fb('0x21')],{'transaction':_0x1b0d25}));}}return BPromise[_0xd2fb('0x31')](_0x115bfd);});})[_0xd2fb('0x8')](function(_0x286811){logger[_0xd2fb('0x9')](_0xd2fb('0x26'),_0x336876);logger[_0xd2fb('0x1e')]('GetContactDialer',_0x336876,JSON[_0xd2fb('0x19')](_0x286811));_0x4101c8(_0x286811);})['catch'](function(_0x3fa241){logger[_0xd2fb('0xd')](_0xd2fb('0x26'),_0x3fa241['message'],_0x336876);_0x1d911e(_0x480729[_0xd2fb('0xd')](0x1f4,_0x3fa241['message']));});});});};exports[_0xd2fb('0x32')]=function(_0x48b32d){var _0x19aa88=this;return new Promise(function(_0x111290,_0x546575){return db[_0xd2fb('0x29')][_0xd2fb('0x33')](function(_0x25fc9d){return db[_0xd2fb('0x34')][_0xd2fb('0x20')](_0x48b32d[_0xd2fb('0x21')],{'raw':_0x48b32d[_0xd2fb('0x11')]?_0x48b32d['options'][_0xd2fb('0x12')]===undefined?!![]:![]:!![],'transaction':_0x25fc9d})[_0xd2fb('0x8')](function(){return db['CmHopper'][_0xd2fb('0x25')]({'where':_0x48b32d[_0xd2fb('0x11')]?_0x48b32d[_0xd2fb('0x11')][_0xd2fb('0x13')]||null:null,'transaction':_0x25fc9d});});})[_0xd2fb('0x8')](function(_0x4ca196){logger[_0xd2fb('0x9')](_0xd2fb('0x32'),_0x48b32d);logger[_0xd2fb('0x1e')](_0xd2fb('0x32'),_0x48b32d,JSON[_0xd2fb('0x19')](_0x4ca196));_0x111290(_0x4ca196);})[_0xd2fb('0x1a')](function(_0x2dd818){logger[_0xd2fb('0xd')](_0xd2fb('0x32'),_0x2dd818[_0xd2fb('0xe')],_0x48b32d);_0x546575(_0x19aa88[_0xd2fb('0xd')](0x1f4,_0x2dd818[_0xd2fb('0xe')]));});});};exports[_0xd2fb('0x35')]=function(_0x3b4dd8){var _0x415c76=this;return new Promise(function(_0x56b6d7,_0x319f03){return db['CmHopper'][_0xd2fb('0x10')]({'raw':_0x3b4dd8[_0xd2fb('0x11')]?_0x3b4dd8[_0xd2fb('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x3b4dd8['options']?_0x3b4dd8['options'][_0xd2fb('0x13')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd2fb('0x36'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xd2fb('0x37')+util[_0xd2fb('0x38')](_0xd2fb('0x39'),moment()[_0xd2fb('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xd2fb('0x3a')]]})[_0xd2fb('0x8')](function(_0x2d0df5){logger[_0xd2fb('0x9')]('CountReScheduled',_0x3b4dd8);logger[_0xd2fb('0x1e')]('CountReScheduled',_0x3b4dd8,JSON[_0xd2fb('0x19')](_0x2d0df5));_0x56b6d7(_0x2d0df5);})[_0xd2fb('0x1a')](function(_0xaeb8e9){logger['error']('CountReScheduled',_0xaeb8e9[_0xd2fb('0xe')],_0x3b4dd8);_0x319f03(_0x415c76['error'](0x1f4,_0xaeb8e9[_0xd2fb('0xe')]));});});};exports['GetContactRecallMe']=function(_0x34940e){var _0x4325b5=this;return new Promise(function(_0x1761e8,_0x35eb15){return db[_0xd2fb('0x27')][_0xd2fb('0x28')]()[_0xd2fb('0x8')](function(_0x4f1003){return db[_0xd2fb('0x29')][_0xd2fb('0x33')](function(_0x29c8a9){return db[_0xd2fb('0xf')][_0xd2fb('0x10')]({'where':_0x34940e[_0xd2fb('0x11')]?_0x34940e[_0xd2fb('0x11')]['where']||null:null,'attributes':_0x34940e['options']?_0x34940e[_0xd2fb('0x11')]['attributes']||null:null,'limit':0x1,'order':_0x34940e[_0xd2fb('0x11')]?_0x34940e[_0xd2fb('0x11')][_0xd2fb('0x3b')]||null:null,'group':db['CmHopper'][_0xd2fb('0x30')],'transaction':_0x29c8a9,'lock':_0x29c8a9[_0xd2fb('0x2a')][_0xd2fb('0x3c')],'include':_0x34940e[_0xd2fb('0x11')]?_0x34940e[_0xd2fb('0x11')][_0xd2fb('0x16')]?_[_0xd2fb('0x17')](_0x34940e['options']['include'],function(_0xc84b1a){return{'model':db[_0xc84b1a[_0xd2fb('0x1d')]],'as':_0xc84b1a['as'],'attributes':_0xc84b1a[_0xd2fb('0x14')],'include':_0xc84b1a[_0xd2fb('0x16')]?_['map'](_0xc84b1a[_0xd2fb('0x16')],function(_0x45dccf){return{'model':db[_0x45dccf[_0xd2fb('0x1d')]],'as':_0x45dccf['as'],'attributes':_0x45dccf['attributes'],'include':_0x45dccf['include']?_[_0xd2fb('0x17')](_0x45dccf['include'],function(_0x26134d){return{'model':db[_0x26134d[_0xd2fb('0x1d')]],'as':_0x26134d['as'],'attributes':_0x26134d[_0xd2fb('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd2fb('0x8')](function(_0x3c5736){var _0x2bc7bb=[];for(var _0x2833c7=0x0;_0x2833c7<_0x3c5736[_0xd2fb('0x3d')];_0x2833c7+=0x1){_0x2bc7bb[_0xd2fb('0x3e')](_0x3c5736[_0x2833c7]['update'](_0x34940e['body'],{'transaction':_0x29c8a9}));}return BPromise[_0xd2fb('0x31')](_0x2bc7bb);});})[_0xd2fb('0x8')](function(_0x1f8857){logger['info']('GetContactRecallMe',_0x34940e);logger[_0xd2fb('0x1e')]('GetContactRecallMe',_0x34940e,JSON[_0xd2fb('0x19')](_0x1f8857));_0x1761e8(_0x1f8857);})[_0xd2fb('0x1a')](function(_0x284fa6){logger[_0xd2fb('0xd')]('GetContactRecallMe',_0x284fa6[_0xd2fb('0xe')],_0x34940e);_0x35eb15(_0x4325b5['error'](0x1f4,_0x284fa6['message']));});});});};exports['GetCmHopperPreview']=function(_0x561b5e){var _0x25c110=this;return new Promise(function(_0x1b91c5,_0x14487c){db['CmContact'][_0xd2fb('0x28')]()[_0xd2fb('0x8')](function(_0x23fd18){return db[_0xd2fb('0xf')][_0xd2fb('0x10')]({'raw':_0x561b5e[_0xd2fb('0x11')]?_0x561b5e[_0xd2fb('0x11')][_0xd2fb('0x12')]===undefined?!![]:![]:!![],'where':_0x561b5e[_0xd2fb('0x11')]?_0x561b5e[_0xd2fb('0x11')]['where']||null:null,'attributes':_0x561b5e[_0xd2fb('0x11')]?_0x561b5e[_0xd2fb('0x11')][_0xd2fb('0x14')]||null:null,'limit':_0x561b5e[_0xd2fb('0x11')]?_0x561b5e[_0xd2fb('0x11')]['limit']||null:null,'include':_0x561b5e['options']?_0x561b5e[_0xd2fb('0x11')]['include']?_[_0xd2fb('0x17')](_0x561b5e[_0xd2fb('0x11')]['include'],function(_0x89a31d){return{'model':db[_0x89a31d['model']],'as':_0x89a31d['as'],'attributes':_0x89a31d['as']==='Contact'?_[_0xd2fb('0x3f')](_0x23fd18):_0x89a31d[_0xd2fb('0x14')],'include':_0x89a31d[_0xd2fb('0x16')]?_[_0xd2fb('0x17')](_0x89a31d[_0xd2fb('0x16')],function(_0x2f343e){return{'model':db[_0x2f343e[_0xd2fb('0x1d')]],'as':_0x2f343e['as'],'attributes':_0x2f343e[_0xd2fb('0x14')],'include':_0x2f343e['include']?_['map'](_0x2f343e[_0xd2fb('0x16')],function(_0x458e30){return{'model':db[_0x458e30['model']],'as':_0x458e30['as'],'attributes':_0x458e30[_0xd2fb('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd2fb('0x8')](function(_0x291a31){logger[_0xd2fb('0x9')](_0xd2fb('0x18'),_0x561b5e);logger[_0xd2fb('0x1e')](_0xd2fb('0x18'),_0x561b5e,JSON[_0xd2fb('0x19')](_0x291a31));_0x1b91c5(_0x291a31);})['catch'](function(_0x56a6a5){logger['error'](_0xd2fb('0x18'),_0x56a6a5[_0xd2fb('0xe')],_0x561b5e);_0x14487c(_0x25c110[_0xd2fb('0xd')](0x1f4,_0x56a6a5[_0xd2fb('0xe')]));});});});}; \ No newline at end of file +var _0x757a=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find','raw','create','CreateCmHopper','update','body','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','name','length','includes','UserId','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','getContactByPhone','log','reqbody','findOne','phone','DESC','getcontactbyohone'];(function(_0x3d3aaa,_0x32f239){var _0x205667=function(_0x9e7b97){while(--_0x9e7b97){_0x3d3aaa['push'](_0x3d3aaa['shift']());}};_0x205667(++_0x32f239);}(_0x757a,0xde));var _0xa757=function(_0x3fb94c,_0x62ec50){_0x3fb94c=_0x3fb94c-0x0;var _0x47860a=_0x757a[_0x3fb94c];return _0x47860a;};'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']('CmHopper,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetCmHopper',_0x4d9f58);logger['debug']('GetCmHopper',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetCmHopper',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});};exports['CreateCmHopper']=function(_0x300be4){var _0x34fba8=this;return new Promise(function(_0x9f73c6,_0x35c15a){return db[_0xa757('0x16')][_0xa757('0x22')](_0x300be4['body'],{'raw':_0x300be4[_0xa757('0x18')]?_0x300be4[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x9607af){logger[_0xa757('0xb')]('CreateCmHopper',_0x300be4);logger['debug'](_0xa757('0x23'),_0x300be4,JSON[_0xa757('0x10')](_0x9607af));_0x9f73c6(_0x9607af);})[_0xa757('0x14')](function(_0x59d699){logger[_0xa757('0x11')](_0xa757('0x23'),_0x59d699[_0xa757('0x12')],_0x300be4);_0x35c15a(_0x34fba8[_0xa757('0x11')](0x1f4,_0x59d699[_0xa757('0x12')]));});});};exports['UpdateCmHopper']=function(_0x1f9af){var _0x52c728=this;return new Promise(function(_0x564d40,_0x43329c){return db[_0xa757('0x16')][_0xa757('0x24')](_0x1f9af[_0xa757('0x25')],{'raw':_0x1f9af[_0xa757('0x18')]?_0x1f9af['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9af[_0xa757('0x18')]?_0x1f9af[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x1f9af[_0xa757('0x18')]?_0x1f9af[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x1f9af['options']?_0x1f9af[_0xa757('0x18')][_0xa757('0x1b')]||null:null})['then'](function(_0x40e291){logger['info'](_0xa757('0x26'),_0x1f9af);logger[_0xa757('0xe')]('UpdateCmHopper',_0x1f9af,JSON[_0xa757('0x10')](_0x40e291));_0x564d40(_0x40e291);})[_0xa757('0x14')](function(_0x4bee69){logger[_0xa757('0x11')](_0xa757('0x26'),_0x4bee69[_0xa757('0x12')],_0x1f9af);_0x43329c(_0x52c728[_0xa757('0x11')](0x1f4,_0x4bee69['message']));});});};exports[_0xa757('0x27')]=function(_0x1be3bb){var _0x450815=this;return new Promise(function(_0xec4610,_0x4d7493){return db[_0xa757('0x16')]['destroy']({'where':_0x1be3bb['options']?_0x1be3bb[_0xa757('0x18')][_0xa757('0x19')]||null:null})[_0xa757('0xa')](function(_0x5e13cf){logger[_0xa757('0xb')]('DestroyCmHopper',_0x1be3bb);logger[_0xa757('0xe')](_0xa757('0x27'),_0x1be3bb,JSON[_0xa757('0x10')](_0x5e13cf));_0xec4610(_0x5e13cf);})[_0xa757('0x14')](function(_0x18b0ca){logger[_0xa757('0x11')](_0xa757('0x27'),_0x18b0ca[_0xa757('0x12')],_0x1be3bb);_0x4d7493(_0x450815['error'](0x1f4,_0x18b0ca[_0xa757('0x12')]));});});};exports[_0xa757('0x28')]=function(_0x33347a){var _0x29434d=this;return new Promise(function(_0x319988,_0x1f10cf){return db[_0xa757('0x29')][_0xa757('0x2a')]()[_0xa757('0xa')](function(_0x1d05d7){return db[_0xa757('0x2b')][_0xa757('0x2c')](function(_0x2367c7){return db[_0xa757('0x16')][_0xa757('0x17')]({'where':_0x33347a[_0xa757('0x18')]?_0x33347a['options'][_0xa757('0x19')]||null:null,'attributes':_0x33347a['options']?_0x33347a[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x33347a[_0xa757('0x18')]?_0x33347a[_0xa757('0x18')]['limit']||null:null,'order':_0x33347a[_0xa757('0x18')]?_0x33347a[_0xa757('0x18')][_0xa757('0x2d')]||null:null,'transaction':_0x2367c7,'lock':_0x2367c7[_0xa757('0x2e')]['UPDATE'],'include':[{'model':db[_0xa757('0x29')],'as':_0xa757('0x2f'),'attributes':_[_0xa757('0x30')](_0x1d05d7)},{'model':db[_0xa757('0x31')],'as':_0xa757('0x32'),'attributes':['id',_0xa757('0x33'),'voicePause']}]})['then'](function(_0x5d21c1){var _0x5a49d0=[];var _0x1d8742=[];for(var _0x9b3779=0x0;_0x9b3779<_0x5d21c1[_0xa757('0x34')];_0x9b3779+=0x1){if(!_0x1d8742[_0xa757('0x35')](_0x5d21c1[_0x9b3779][_0xa757('0x36')])){_0x1d8742[_0xa757('0x37')](_0x5d21c1[_0x9b3779]['UserId']);_0x5a49d0[_0xa757('0x37')](_0x5d21c1[_0x9b3779][_0xa757('0x24')](_0x33347a[_0xa757('0x25')],{'transaction':_0x2367c7}));}}return BPromise[_0xa757('0x38')](_0x5a49d0);});})['then'](function(_0x26c74e){logger[_0xa757('0xb')]('GetContactDialer',_0x33347a);logger[_0xa757('0xe')]('GetContactDialer',_0x33347a,JSON[_0xa757('0x10')](_0x26c74e));_0x319988(_0x26c74e);})['catch'](function(_0x51be6e){logger['error']('GetContactDialer',_0x51be6e[_0xa757('0x12')],_0x33347a);_0x1f10cf(_0x29434d[_0xa757('0x11')](0x1f4,_0x51be6e[_0xa757('0x12')]));});});});};exports[_0xa757('0x39')]=function(_0x14e226){var _0xc5ae37=this;return new Promise(function(_0x4c19a6,_0x4f0d7b){return db[_0xa757('0x2b')][_0xa757('0x2c')](function(_0x3ca1ef){return db['CmHopperFinal']['create'](_0x14e226[_0xa757('0x25')],{'raw':_0x14e226[_0xa757('0x18')]?_0x14e226[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'transaction':_0x3ca1ef})[_0xa757('0xa')](function(){return db[_0xa757('0x16')]['destroy']({'where':_0x14e226[_0xa757('0x18')]?_0x14e226[_0xa757('0x18')][_0xa757('0x19')]||null:null,'transaction':_0x3ca1ef});});})[_0xa757('0xa')](function(_0x1291df){logger[_0xa757('0xb')](_0xa757('0x39'),_0x14e226);logger[_0xa757('0xe')](_0xa757('0x39'),_0x14e226,JSON[_0xa757('0x10')](_0x1291df));_0x4c19a6(_0x1291df);})['catch'](function(_0x9e96e6){logger['error']('MoveContactManagedDialer',_0x9e96e6[_0xa757('0x12')],_0x14e226);_0x4f0d7b(_0xc5ae37[_0xa757('0x11')](0x1f4,_0x9e96e6[_0xa757('0x12')]));});});};exports[_0xa757('0x3a')]=function(_0x3c3ff1){var _0x3672a7=this;return new Promise(function(_0x1b34ad,_0x32e0b9){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x3c3ff1[_0xa757('0x18')]?_0x3c3ff1['options'][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x3c3ff1[_0xa757('0x18')]?_0x3c3ff1['options'][_0xa757('0x19')]||null:null,'attributes':[[db[_0xa757('0x2b')]['fn'](_0xa757('0x3b'),db[_0xa757('0x2b')]['fn']('IF',db[_0xa757('0x2b')][_0xa757('0x3c')]('`scheduledat`\x20>=\x20'+util[_0xa757('0x3d')]('\x22%s\x22',moment()[_0xa757('0x3d')](_0xa757('0x3e')))+_0xa757('0x3f')))),_0xa757('0x40')]]})[_0xa757('0xa')](function(_0x5c0870){logger['info'](_0xa757('0x3a'),_0x3c3ff1);logger[_0xa757('0xe')](_0xa757('0x3a'),_0x3c3ff1,JSON['stringify'](_0x5c0870));_0x1b34ad(_0x5c0870);})[_0xa757('0x14')](function(_0x55bc0f){logger[_0xa757('0x11')](_0xa757('0x3a'),_0x55bc0f[_0xa757('0x12')],_0x3c3ff1);_0x32e0b9(_0x3672a7[_0xa757('0x11')](0x1f4,_0x55bc0f[_0xa757('0x12')]));});});};exports[_0xa757('0x41')]=function(_0x54730c){var _0xa28144=this;return new Promise(function(_0x193233,_0x1e15ee){return db[_0xa757('0x29')][_0xa757('0x2a')]()['then'](function(_0x2586f9){return db[_0xa757('0x2b')][_0xa757('0x2c')](function(_0x38724c){return db[_0xa757('0x16')]['findAll']({'where':_0x54730c[_0xa757('0x18')]?_0x54730c[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x54730c['options']?_0x54730c[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':0x1,'order':_0x54730c[_0xa757('0x18')]?_0x54730c[_0xa757('0x18')][_0xa757('0x2d')]||null:null,'group':db[_0xa757('0x16')][_0xa757('0x36')],'transaction':_0x38724c,'lock':_0x38724c[_0xa757('0x2e')][_0xa757('0x42')],'include':_0x54730c[_0xa757('0x18')]?_0x54730c[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x54730c[_0xa757('0x18')]['include'],function(_0x24dd89){return{'model':db[_0x24dd89[_0xa757('0x1e')]],'as':_0x24dd89['as'],'attributes':_0x24dd89['attributes'],'include':_0x24dd89[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x24dd89['include'],function(_0x29aea2){return{'model':db[_0x29aea2[_0xa757('0x1e')]],'as':_0x29aea2['as'],'attributes':_0x29aea2[_0xa757('0x1a')],'include':_0x29aea2[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x29aea2[_0xa757('0x1c')],function(_0xdb2ac6){return{'model':db[_0xdb2ac6[_0xa757('0x1e')]],'as':_0xdb2ac6['as'],'attributes':_0xdb2ac6[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2649a2){var _0x189195=[];for(var _0x2c2b40=0x0;_0x2c2b40<_0x2649a2[_0xa757('0x34')];_0x2c2b40+=0x1){_0x189195[_0xa757('0x37')](_0x2649a2[_0x2c2b40][_0xa757('0x24')](_0x54730c['body'],{'transaction':_0x38724c}));}return BPromise[_0xa757('0x38')](_0x189195);});})['then'](function(_0x39357f){logger[_0xa757('0xb')](_0xa757('0x41'),_0x54730c);logger[_0xa757('0xe')](_0xa757('0x41'),_0x54730c,JSON['stringify'](_0x39357f));_0x193233(_0x39357f);})[_0xa757('0x14')](function(_0x67a58b){logger[_0xa757('0x11')]('GetContactRecallMe',_0x67a58b[_0xa757('0x12')],_0x54730c);_0x1e15ee(_0xa28144[_0xa757('0x11')](0x1f4,_0x67a58b[_0xa757('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x501134){var _0x1f437d=this;return new Promise(function(_0x351e0e,_0x388e6d){db['CmContact'][_0xa757('0x2a')]()['then'](function(_0x4cfc69){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x501134[_0xa757('0x18')]?_0x501134['options'][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x501134[_0xa757('0x18')]?_0x501134[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x501134[_0xa757('0x18')]?_0x501134[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x501134[_0xa757('0x18')]?_0x501134[_0xa757('0x18')][_0xa757('0x1b')]||null:null,'include':_0x501134[_0xa757('0x18')]?_0x501134[_0xa757('0x18')]['include']?_[_0xa757('0x1d')](_0x501134[_0xa757('0x18')][_0xa757('0x1c')],function(_0x346a4a){return{'model':db[_0x346a4a[_0xa757('0x1e')]],'as':_0x346a4a['as'],'attributes':_0x346a4a['as']===_0xa757('0x2f')?_[_0xa757('0x30')](_0x4cfc69):_0x346a4a[_0xa757('0x1a')],'include':_0x346a4a[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x346a4a[_0xa757('0x1c')],function(_0x2f5a0f){return{'model':db[_0x2f5a0f[_0xa757('0x1e')]],'as':_0x2f5a0f['as'],'attributes':_0x2f5a0f[_0xa757('0x1a')],'include':_0x2f5a0f[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x2f5a0f[_0xa757('0x1c')],function(_0x3c4e41){return{'model':db[_0x3c4e41[_0xa757('0x1e')]],'as':_0x3c4e41['as'],'attributes':_0x3c4e41[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x20ea21){logger['info'](_0xa757('0x15'),_0x501134);logger[_0xa757('0xe')]('GetCmHopper',_0x501134,JSON[_0xa757('0x10')](_0x20ea21));_0x351e0e(_0x20ea21);})['catch'](function(_0x433c20){logger[_0xa757('0x11')]('GetCmHopper',_0x433c20[_0xa757('0x12')],_0x501134);_0x388e6d(_0x1f437d[_0xa757('0x11')](0x1f4,_0x433c20[_0xa757('0x12')]));});});});};exports[_0xa757('0x43')]=function(_0x535ff7){console[_0xa757('0x44')](_0xa757('0x45'),_0x535ff7['body']);var _0x30716a=this;return new Promise(function(_0x271698,_0x4e699e){return db[_0xa757('0x29')][_0xa757('0x46')]({'raw':!![],'where':{'phone':_0x535ff7[_0xa757('0x25')][_0xa757('0x47')]},'attributes':['id'],'order':[['id',_0xa757('0x48')]]})[_0xa757('0xa')](function(_0x3e63f9){console[_0xa757('0x44')](_0xa757('0x49'),_0x3e63f9);logger['info']('getContactByPhone',_0x535ff7);logger[_0xa757('0xe')](_0xa757('0x43'),_0x535ff7,JSON[_0xa757('0x10')](_0x3e63f9));_0x271698(_0x3e63f9);})[_0xa757('0x14')](function(_0x38d0f8){logger[_0xa757('0x11')](_0xa757('0x43'),_0x38d0f8['message'],_0x535ff7);_0x4e699e(_0x30716a[_0xa757('0x11')](0x1f4,_0x38d0f8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c7bac8f..debd3d1 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 _0xd0bb=['get','/describe','/opencontacts','getOpenContacts','getTimezones','show','create','post','/preview','getPreview','/timezone','getTimezone','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index'];(function(_0xd13171,_0xc54453){var _0x452bd0=function(_0x3c0628){while(--_0x3c0628){_0xd13171['push'](_0xd13171['shift']());}};_0x452bd0(++_0xc54453);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0xd0bb[_0x452968];return _0xb6f9ae;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['describe']);router[_0xbd0b('0x9')](_0xbd0b('0xb'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0x9')]('/timezones',auth['isAuthenticated'](),controller[_0xbd0b('0xd')]);router[_0xbd0b('0x9')]('/:id',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xe')]);router['post']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xf')]);router[_0xbd0b('0x10')](_0xbd0b('0x11'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x12')]);router[_0xbd0b('0x10')](_0xbd0b('0x13'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x14')]);router[_0xbd0b('0x15')]('/:id',auth[_0xbd0b('0x7')](),controller['update']);router['delete'](_0xbd0b('0x16'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x17')]);module[_0xbd0b('0x18')]=router; \ No newline at end of file +var _0xee14=['/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','post','create','/preview','/timezone','getTimezone','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xee14,0x13a));var _0x4ee1=function(_0x3c90be,_0x46cb71){_0x3c90be=_0x3c90be-0x0;var _0x11f3d4=_0xee14[_0x3c90be];return _0x11f3d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var auth=require(_0x4ee1('0x4'));var interaction=require(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var controller=require(_0x4ee1('0x7'));router[_0x4ee1('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x9')]);router['get'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0x8')](_0x4ee1('0xd'),auth[_0x4ee1('0xb')](),controller['getOpenContacts']);router[_0x4ee1('0x8')](_0x4ee1('0xe'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x8')](_0x4ee1('0x10'),auth[_0x4ee1('0xb')](),controller['show']);router[_0x4ee1('0x11')]('/',auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x12')]);router[_0x4ee1('0x11')](_0x4ee1('0x13'),auth[_0x4ee1('0xb')](),controller['getPreview']);router[_0x4ee1('0x11')](_0x4ee1('0x14'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x15')]);router[_0x4ee1('0x16')](_0x4ee1('0x10'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x17')]);router[_0x4ee1('0x18')]('/:id',auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x19')]);module[_0x4ee1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 3cf0fb4..edbf7bb 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x719d=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment','exports','STRING'];(function(_0x2221e0,_0x395537){var _0x5ad484=function(_0x26aff6){while(--_0x26aff6){_0x2221e0['push'](_0x2221e0['shift']());}};_0x5ad484(++_0x395537);}(_0x719d,0xa5));var _0xd719=function(_0x1b3c05,_0x555db6){_0x1b3c05=_0x1b3c05-0x0;var _0x1a297f=_0x719d[_0x1b3c05];return _0x1a297f;};'use strict';var moment=require(_0xd719('0x0'));var Sequelize=require('sequelize');module[_0xd719('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xd719('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xd719('0x3')],'defaultValue':moment()['format'](_0xd719('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd719('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd719('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd719('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd719('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd719('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c15=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING','INTEGER','DATE'];(function(_0x3d2723,_0x3ef5b2){var _0x2fdeb3=function(_0x4dd3d1){while(--_0x4dd3d1){_0x3d2723['push'](_0x3d2723['shift']());}};_0x2fdeb3(++_0x3ef5b2);}(_0x0c15,0xa4));var _0x50c1=function(_0x368507,_0x2c1e83){_0x368507=_0x368507-0x0;var _0x11ecf4=_0x0c15[_0x368507];return _0x11ecf4;};'use strict';var moment=require('moment');var Sequelize=require(_0x50c1('0x0'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x50c1('0x1')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x50c1('0x3')],'defaultValue':moment()[_0x50c1('0x4')](_0x50c1('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x50c1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index f251b9c..e559eec 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92be=['fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1ca0c9,_0x260a55){var _0x481e61=function(_0x136d52){while(--_0x136d52){_0x1ca0c9['push'](_0x1ca0c9['shift']());}};_0x481e61(++_0x260a55);}(_0x92be,0xa8));var _0xe92b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x92be[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xe92b('0x0'));var emlformat=require(_0xe92b('0x1'));var rimraf=require(_0xe92b('0x2'));var zipdir=require(_0xe92b('0x3'));var jsonpatch=require(_0xe92b('0x4'));var rp=require(_0xe92b('0x5'));var moment=require(_0xe92b('0x6'));var BPromise=require(_0xe92b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe92b('0x8'));var sox=require(_0xe92b('0x9'));var csv=require(_0xe92b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe92b('0xb'));var squel=require(_0xe92b('0xc'));var crypto=require(_0xe92b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe92b('0xe'));var toCsv=require(_0xe92b('0xa'));var querystring=require(_0xe92b('0xf'));var Papa=require(_0xe92b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe92b('0x11'));var hardwareService=require(_0xe92b('0x12'));var logger=require(_0xe92b('0x13'))(_0xe92b('0x14'));var utils=require('../../config/utils');var config=require(_0xe92b('0x15'));var db=require(_0xe92b('0x16'))['db'];function respondWithStatusCode(_0x426871,_0x26193b){_0x26193b=_0x26193b||0xcc;return function(_0x50ab57){if(_0x50ab57){return _0x426871[_0xe92b('0x17')](_0x26193b);}return _0x426871[_0xe92b('0x18')](_0x26193b)[_0xe92b('0x19')]();};}function respondWithResult(_0x417574,_0xb65ae4){_0xb65ae4=_0xb65ae4||0xc8;return function(_0x4d478a){if(_0x4d478a){return _0x417574[_0xe92b('0x18')](_0xb65ae4)[_0xe92b('0x1a')](_0x4d478a);}};}function respondWithFilteredResult(_0x3c47e2,_0x4ffcc7){return function(_0x4f840a){if(_0x4f840a){var _0x5363ba=_0x4f840a[_0xe92b('0x1b')],_0x4a0aa4=_0x4ffcc7[_0xe92b('0x1c')],_0x4f885d=_0x4ffcc7[_0xe92b('0x1c')]+_0x4ffcc7[_0xe92b('0x1d')],_0x2f4a7f;if(_0x4f885d>=_0x5363ba){_0x4f885d=_0x5363ba;_0x2f4a7f=0xc8;}else{_0x2f4a7f=0xce;}_0x3c47e2[_0xe92b('0x18')](_0x2f4a7f);return _0x3c47e2[_0xe92b('0x1e')](_0xe92b('0x1f'),_0x4a0aa4+'-'+_0x4f885d+'/'+_0x5363ba)[_0xe92b('0x1a')](_0x4f840a);}return null;};}function patchUpdates(_0x430d87){return function(_0x2e2c47){try{jsonpatch[_0xe92b('0x20')](_0x2e2c47,_0x430d87,!![]);}catch(_0x5181ca){return BPromise[_0xe92b('0x21')](_0x5181ca);}return _0x2e2c47[_0xe92b('0x22')]();};}function saveUpdates(_0xaf01f5,_0x25f2bc){return function(_0x570175){if(_0x570175){return _0x570175[_0xe92b('0x23')](_0xaf01f5)[_0xe92b('0x24')](function(_0x5394b5){return _0x5394b5;});}return null;};}function removeEntity(_0xd1943c,_0x24b64a){return function(_0xf22d13){if(_0xf22d13){return _0xf22d13[_0xe92b('0x25')]()['then'](function(){var _0x91fd4c=_0xf22d13[_0xe92b('0x26')]({'plain':!![]});var _0x42251a=_0xe92b('0x27');return db[_0xe92b('0x28')][_0xe92b('0x25')]({'where':{'type':_0x42251a,'resourceId':_0x91fd4c['id']}})[_0xe92b('0x24')](function(){return _0xf22d13;});})[_0xe92b('0x24')](function(){_0xd1943c[_0xe92b('0x18')](0xcc)[_0xe92b('0x19')]();});}};}function handleEntityNotFound(_0x5ca2b8,_0x515dae){return function(_0x4bf543){if(!_0x4bf543){_0x5ca2b8[_0xe92b('0x17')](0x194);}return _0x4bf543;};}function handleError(_0xc10c98,_0xd38941){_0xd38941=_0xd38941||0x1f4;return function(_0x549671){logger[_0xe92b('0x29')](_0x549671[_0xe92b('0x2a')]);if(_0x549671[_0xe92b('0x2b')]){delete _0x549671[_0xe92b('0x2b')];}_0xc10c98[_0xe92b('0x18')](_0xd38941)[_0xe92b('0x2c')](_0x549671);};}exports[_0xe92b('0x2d')]=function(_0x28e9b7,_0x1276fb){var _0xf3d04c={},_0x268397={},_0x4ef1a4={'count':0x0,'rows':[]};var _0x272d66=_[_0xe92b('0x2e')](db[_0xe92b('0x2f')][_0xe92b('0x30')],function(_0x5ae5a7){return{'name':_0x5ae5a7['fieldName'],'type':_0x5ae5a7['type'][_0xe92b('0x31')]};});_0x268397[_0xe92b('0x32')]=_['map'](_0x272d66,_0xe92b('0x2b'));_0x268397[_0xe92b('0x33')]=_['keys'](_0x28e9b7[_0xe92b('0x33')]);_0x268397[_0xe92b('0x34')]=_[_0xe92b('0x35')](_0x268397[_0xe92b('0x32')],_0x268397['query']);_0xf3d04c[_0xe92b('0x36')]=_['intersection'](_0x268397[_0xe92b('0x32')],qs[_0xe92b('0x37')](_0x28e9b7[_0xe92b('0x33')]['fields']));_0xf3d04c['attributes']=_0xf3d04c[_0xe92b('0x36')][_0xe92b('0x38')]?_0xf3d04c['attributes']:_0x268397[_0xe92b('0x32')];if(!_0x28e9b7[_0xe92b('0x33')][_0xe92b('0x39')](_0xe92b('0x3a'))){_0xf3d04c[_0xe92b('0x1d')]=qs[_0xe92b('0x1d')](_0x28e9b7[_0xe92b('0x33')][_0xe92b('0x1d')]);_0xf3d04c[_0xe92b('0x1c')]=qs[_0xe92b('0x1c')](_0x28e9b7[_0xe92b('0x33')]['offset']);}_0xf3d04c[_0xe92b('0x3b')]=qs[_0xe92b('0x3c')](_0x28e9b7[_0xe92b('0x33')]['sort']);_0xf3d04c[_0xe92b('0x3d')]=qs[_0xe92b('0x34')](_[_0xe92b('0x3e')](_0x28e9b7[_0xe92b('0x33')],_0x268397['filters']),_0x272d66);if(_0x28e9b7['query'][_0xe92b('0x3f')]){_0xf3d04c[_0xe92b('0x3d')]=_[_0xe92b('0x40')](_0xf3d04c['where'],{'$or':_[_0xe92b('0x2e')](_0x272d66,function(_0x22ae6c){if(_0x22ae6c[_0xe92b('0x41')]!==_0xe92b('0x42')){var _0x15223d={};_0x15223d[_0x22ae6c[_0xe92b('0x2b')]]={'$like':'%'+_0x28e9b7['query'][_0xe92b('0x3f')]+'%'};return _0x15223d;}})});}_0xf3d04c=_[_0xe92b('0x40')]({},_0xf3d04c,_0x28e9b7[_0xe92b('0x43')]);var _0x509576={'where':_0xf3d04c[_0xe92b('0x3d')]};return db[_0xe92b('0x2f')][_0xe92b('0x1b')](_0x509576)[_0xe92b('0x24')](function(_0x5914fb){_0x4ef1a4[_0xe92b('0x1b')]=_0x5914fb;if(_0x28e9b7[_0xe92b('0x33')][_0xe92b('0x44')]){_0xf3d04c['include']=[{'all':!![]}];}return db[_0xe92b('0x2f')][_0xe92b('0x45')](_0xf3d04c);})[_0xe92b('0x24')](function(_0x1bad10){_0x4ef1a4[_0xe92b('0x46')]=_0x1bad10;return _0x4ef1a4;})[_0xe92b('0x24')](respondWithFilteredResult(_0x1276fb,_0xf3d04c))[_0xe92b('0x47')](handleError(_0x1276fb,null));};exports[_0xe92b('0x48')]=function(_0x3c71c9,_0x3117bf){var _0x1886d2={'raw':!![],'where':{'id':_0x3c71c9[_0xe92b('0x49')]['id']}},_0x436411={};_0x436411[_0xe92b('0x32')]=_[_0xe92b('0x4a')](db[_0xe92b('0x2f')][_0xe92b('0x30')]);_0x436411[_0xe92b('0x33')]=_[_0xe92b('0x4a')](_0x3c71c9[_0xe92b('0x33')]);_0x436411[_0xe92b('0x34')]=_[_0xe92b('0x35')](_0x436411[_0xe92b('0x32')],_0x436411[_0xe92b('0x33')]);_0x1886d2['attributes']=_[_0xe92b('0x35')](_0x436411[_0xe92b('0x32')],qs[_0xe92b('0x37')](_0x3c71c9[_0xe92b('0x33')]['fields']));_0x1886d2[_0xe92b('0x36')]=_0x1886d2[_0xe92b('0x36')][_0xe92b('0x38')]?_0x1886d2['attributes']:_0x436411[_0xe92b('0x32')];if(_0x3c71c9[_0xe92b('0x33')][_0xe92b('0x44')]){_0x1886d2[_0xe92b('0x4b')]=[{'all':!![]}];}_0x1886d2=_[_0xe92b('0x40')]({},_0x1886d2,_0x3c71c9[_0xe92b('0x43')]);return db['CmHopperAdditionalPhone'][_0xe92b('0x4c')](_0x1886d2)['then'](handleEntityNotFound(_0x3117bf,null))[_0xe92b('0x24')](respondWithResult(_0x3117bf,null))['catch'](handleError(_0x3117bf,null));};exports[_0xe92b('0x4d')]=function(_0x7bb45c,_0x45eaf6){return db[_0xe92b('0x2f')][_0xe92b('0x4d')](_0x7bb45c[_0xe92b('0x4e')],{})['then'](function(_0x443695){var _0x3b2bc8=_0x7bb45c[_0xe92b('0x4f')][_0xe92b('0x26')]({'plain':!![]});if(!_0x3b2bc8)throw new Error(_0xe92b('0x50'));if(_0x3b2bc8[_0xe92b('0x51')]===_0xe92b('0x4f')){var _0x3a56fe=_0x443695[_0xe92b('0x26')]({'plain':!![]});var _0x1bf914=_0xe92b('0x27');return db[_0xe92b('0x52')][_0xe92b('0x4c')]({'where':{'name':_0x1bf914,'userProfileId':_0x3b2bc8[_0xe92b('0x53')]},'raw':!![]})[_0xe92b('0x24')](function(_0x1f741a){if(_0x1f741a&&_0x1f741a[_0xe92b('0x54')]===0x0){return db[_0xe92b('0x28')]['create']({'name':_0x3a56fe[_0xe92b('0x2b')],'resourceId':_0x3a56fe['id'],'type':_0x1f741a['name'],'sectionId':_0x1f741a['id']},{})[_0xe92b('0x24')](function(){return _0x443695;});}else{return _0x443695;}})['catch'](function(_0xe1e608){logger[_0xe92b('0x29')](_0xe92b('0x55'),_0xe1e608);throw _0xe1e608;});}return _0x443695;})['then'](respondWithResult(_0x45eaf6,0xc9))['catch'](handleError(_0x45eaf6,null));};exports['update']=function(_0x2fb1c7,_0x154dd0){if(_0x2fb1c7[_0xe92b('0x4e')]['id']){delete _0x2fb1c7[_0xe92b('0x4e')]['id'];}return db[_0xe92b('0x2f')][_0xe92b('0x4c')]({'where':{'id':_0x2fb1c7[_0xe92b('0x49')]['id']}})['then'](handleEntityNotFound(_0x154dd0,null))[_0xe92b('0x24')](saveUpdates(_0x2fb1c7['body'],null))[_0xe92b('0x24')](respondWithResult(_0x154dd0,null))[_0xe92b('0x47')](handleError(_0x154dd0,null));};exports[_0xe92b('0x25')]=function(_0x16b604,_0x2881cd){return db[_0xe92b('0x2f')]['find']({'where':{'id':_0x16b604['params']['id']}})[_0xe92b('0x24')](handleEntityNotFound(_0x2881cd,null))[_0xe92b('0x24')](removeEntity(_0x2881cd,null))['catch'](handleError(_0x2881cd,null));}; \ No newline at end of file +var _0x8344=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf'];(function(_0x57d9e8,_0x2a8d72){var _0xf195c3=function(_0x40ff78){while(--_0x40ff78){_0x57d9e8['push'](_0x57d9e8['shift']());}};_0xf195c3(++_0x2a8d72);}(_0x8344,0xef));var _0x4834=function(_0xb96939,_0x52d57d){_0xb96939=_0xb96939-0x0;var _0x4e2142=_0x8344[_0xb96939];return _0x4e2142;};'use strict';var pdf=require(_0x4834('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4834('0x1'));var zipdir=require(_0x4834('0x2'));var jsonpatch=require(_0x4834('0x3'));var rp=require('request-promise');var moment=require(_0x4834('0x4'));var BPromise=require(_0x4834('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4834('0x6'));var sox=require(_0x4834('0x7'));var csv=require(_0x4834('0x8'));var ejs=require(_0x4834('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4834('0xa'));var jsforce=require(_0x4834('0xb'));var deskjs=require(_0x4834('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4834('0xd'));var Papa=require(_0x4834('0xe'));var Redis=require(_0x4834('0xf'));var authService=require(_0x4834('0x10'));var qs=require(_0x4834('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4834('0x12'));var logger=require('../../config/logger')(_0x4834('0x13'));var utils=require(_0x4834('0x14'));var config=require(_0x4834('0x15'));var db=require(_0x4834('0x16'))['db'];function respondWithStatusCode(_0x38a9f0,_0x4548ef){_0x4548ef=_0x4548ef||0xcc;return function(_0x269833){if(_0x269833){return _0x38a9f0[_0x4834('0x17')](_0x4548ef);}return _0x38a9f0['status'](_0x4548ef)[_0x4834('0x18')]();};}function respondWithResult(_0x1e31ef,_0x4297f8){_0x4297f8=_0x4297f8||0xc8;return function(_0x1b52be){if(_0x1b52be){return _0x1e31ef[_0x4834('0x19')](_0x4297f8)[_0x4834('0x1a')](_0x1b52be);}};}function respondWithFilteredResult(_0x2e655f,_0x4cd9a1){return function(_0x40f4d7){if(_0x40f4d7){var _0x3b9ce6=_0x40f4d7[_0x4834('0x1b')],_0x42a7d2=_0x4cd9a1[_0x4834('0x1c')],_0x1cad4e=_0x4cd9a1[_0x4834('0x1c')]+_0x4cd9a1[_0x4834('0x1d')],_0x4814ab;if(_0x1cad4e>=_0x3b9ce6){_0x1cad4e=_0x3b9ce6;_0x4814ab=0xc8;}else{_0x4814ab=0xce;}_0x2e655f[_0x4834('0x19')](_0x4814ab);return _0x2e655f[_0x4834('0x1e')](_0x4834('0x1f'),_0x42a7d2+'-'+_0x1cad4e+'/'+_0x3b9ce6)[_0x4834('0x1a')](_0x40f4d7);}return null;};}function patchUpdates(_0x2a6421){return function(_0xdae0af){try{jsonpatch[_0x4834('0x20')](_0xdae0af,_0x2a6421,!![]);}catch(_0x437799){return BPromise[_0x4834('0x21')](_0x437799);}return _0xdae0af[_0x4834('0x22')]();};}function saveUpdates(_0x30f086,_0x4cca95){return function(_0x768276){if(_0x768276){return _0x768276[_0x4834('0x23')](_0x30f086)['then'](function(_0x4731db){return _0x4731db;});}return null;};}function removeEntity(_0x49e095,_0x4fe8f4){return function(_0x3a2144){if(_0x3a2144){return _0x3a2144[_0x4834('0x24')]()[_0x4834('0x25')](function(){var _0x37b878=_0x3a2144[_0x4834('0x26')]({'plain':!![]});var _0x3596bb='CmHopperAdditionalPhones';return db[_0x4834('0x27')]['destroy']({'where':{'type':_0x3596bb,'resourceId':_0x37b878['id']}})[_0x4834('0x25')](function(){return _0x3a2144;});})[_0x4834('0x25')](function(){_0x49e095[_0x4834('0x19')](0xcc)[_0x4834('0x18')]();});}};}function handleEntityNotFound(_0x294179,_0x5ded27){return function(_0x5659cc){if(!_0x5659cc){_0x294179[_0x4834('0x17')](0x194);}return _0x5659cc;};}function handleError(_0x52e05c,_0x104dbc){_0x104dbc=_0x104dbc||0x1f4;return function(_0x340c99){logger[_0x4834('0x28')](_0x340c99[_0x4834('0x29')]);if(_0x340c99[_0x4834('0x2a')]){delete _0x340c99[_0x4834('0x2a')];}_0x52e05c[_0x4834('0x19')](_0x104dbc)[_0x4834('0x2b')](_0x340c99);};}exports[_0x4834('0x2c')]=function(_0x2acf06,_0x5adaa0){var _0x3e13d5={},_0x3ccaac={},_0x3b192d={'count':0x0,'rows':[]};var _0x45da36=_[_0x4834('0x2d')](db[_0x4834('0x2e')][_0x4834('0x2f')],function(_0x1a84b0){return{'name':_0x1a84b0['fieldName'],'type':_0x1a84b0[_0x4834('0x30')][_0x4834('0x31')]};});_0x3ccaac[_0x4834('0x32')]=_[_0x4834('0x2d')](_0x45da36,_0x4834('0x2a'));_0x3ccaac[_0x4834('0x33')]=_['keys'](_0x2acf06[_0x4834('0x33')]);_0x3ccaac['filters']=_[_0x4834('0x34')](_0x3ccaac[_0x4834('0x32')],_0x3ccaac[_0x4834('0x33')]);_0x3e13d5[_0x4834('0x35')]=_[_0x4834('0x34')](_0x3ccaac[_0x4834('0x32')],qs['fields'](_0x2acf06[_0x4834('0x33')][_0x4834('0x36')]));_0x3e13d5['attributes']=_0x3e13d5['attributes'][_0x4834('0x37')]?_0x3e13d5[_0x4834('0x35')]:_0x3ccaac[_0x4834('0x32')];if(!_0x2acf06[_0x4834('0x33')]['hasOwnProperty'](_0x4834('0x38'))){_0x3e13d5[_0x4834('0x1d')]=qs[_0x4834('0x1d')](_0x2acf06['query'][_0x4834('0x1d')]);_0x3e13d5[_0x4834('0x1c')]=qs[_0x4834('0x1c')](_0x2acf06[_0x4834('0x33')]['offset']);}_0x3e13d5[_0x4834('0x39')]=qs[_0x4834('0x3a')](_0x2acf06[_0x4834('0x33')][_0x4834('0x3a')]);_0x3e13d5[_0x4834('0x3b')]=qs[_0x4834('0x3c')](_[_0x4834('0x3d')](_0x2acf06[_0x4834('0x33')],_0x3ccaac[_0x4834('0x3c')]),_0x45da36);if(_0x2acf06[_0x4834('0x33')][_0x4834('0x3e')]){_0x3e13d5[_0x4834('0x3b')]=_['merge'](_0x3e13d5['where'],{'$or':_['map'](_0x45da36,function(_0x223a24){if(_0x223a24[_0x4834('0x30')]!==_0x4834('0x3f')){var _0x4b8812={};_0x4b8812[_0x223a24[_0x4834('0x2a')]]={'$like':'%'+_0x2acf06[_0x4834('0x33')][_0x4834('0x3e')]+'%'};return _0x4b8812;}})});}_0x3e13d5=_[_0x4834('0x40')]({},_0x3e13d5,_0x2acf06[_0x4834('0x41')]);var _0x49efed={'where':_0x3e13d5['where']};return db[_0x4834('0x2e')][_0x4834('0x1b')](_0x49efed)['then'](function(_0x18c9a1){_0x3b192d[_0x4834('0x1b')]=_0x18c9a1;if(_0x2acf06['query']['includeAll']){_0x3e13d5['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x3e13d5);})[_0x4834('0x25')](function(_0x5ed9f0){_0x3b192d['rows']=_0x5ed9f0;return _0x3b192d;})[_0x4834('0x25')](respondWithFilteredResult(_0x5adaa0,_0x3e13d5))[_0x4834('0x42')](handleError(_0x5adaa0,null));};exports[_0x4834('0x43')]=function(_0x3b5728,_0x34c6fd){var _0x57b6fb={'raw':!![],'where':{'id':_0x3b5728[_0x4834('0x44')]['id']}},_0x9fa0bd={};_0x9fa0bd[_0x4834('0x32')]=_['keys'](db['CmHopperAdditionalPhone'][_0x4834('0x2f')]);_0x9fa0bd[_0x4834('0x33')]=_[_0x4834('0x45')](_0x3b5728[_0x4834('0x33')]);_0x9fa0bd['filters']=_[_0x4834('0x34')](_0x9fa0bd['model'],_0x9fa0bd[_0x4834('0x33')]);_0x57b6fb[_0x4834('0x35')]=_[_0x4834('0x34')](_0x9fa0bd[_0x4834('0x32')],qs[_0x4834('0x36')](_0x3b5728[_0x4834('0x33')][_0x4834('0x36')]));_0x57b6fb[_0x4834('0x35')]=_0x57b6fb[_0x4834('0x35')][_0x4834('0x37')]?_0x57b6fb['attributes']:_0x9fa0bd[_0x4834('0x32')];if(_0x3b5728[_0x4834('0x33')][_0x4834('0x46')]){_0x57b6fb['include']=[{'all':!![]}];}_0x57b6fb=_[_0x4834('0x40')]({},_0x57b6fb,_0x3b5728[_0x4834('0x41')]);return db['CmHopperAdditionalPhone'][_0x4834('0x47')](_0x57b6fb)[_0x4834('0x25')](handleEntityNotFound(_0x34c6fd,null))[_0x4834('0x25')](respondWithResult(_0x34c6fd,null))[_0x4834('0x42')](handleError(_0x34c6fd,null));};exports[_0x4834('0x48')]=function(_0x3f9576,_0x28ab61){return db[_0x4834('0x2e')]['create'](_0x3f9576[_0x4834('0x49')],{})[_0x4834('0x25')](function(_0x3b3a54){var _0x3c5e29=_0x3f9576[_0x4834('0x4a')]['get']({'plain':!![]});if(!_0x3c5e29)throw new Error(_0x4834('0x4b'));if(_0x3c5e29[_0x4834('0x4c')]==='user'){var _0x2cb5fc=_0x3b3a54[_0x4834('0x26')]({'plain':!![]});var _0x1a793b=_0x4834('0x4d');return db[_0x4834('0x4e')][_0x4834('0x47')]({'where':{'name':_0x1a793b,'userProfileId':_0x3c5e29['userProfileId']},'raw':!![]})[_0x4834('0x25')](function(_0x149e25){if(_0x149e25&&_0x149e25['autoAssociation']===0x0){return db[_0x4834('0x27')][_0x4834('0x48')]({'name':_0x2cb5fc[_0x4834('0x2a')],'resourceId':_0x2cb5fc['id'],'type':_0x149e25[_0x4834('0x2a')],'sectionId':_0x149e25['id']},{})[_0x4834('0x25')](function(){return _0x3b3a54;});}else{return _0x3b3a54;}})[_0x4834('0x42')](function(_0x3a9ec7){logger[_0x4834('0x28')](_0x4834('0x4f'),_0x3a9ec7);throw _0x3a9ec7;});}return _0x3b3a54;})[_0x4834('0x25')](respondWithResult(_0x28ab61,0xc9))['catch'](handleError(_0x28ab61,null));};exports[_0x4834('0x23')]=function(_0x466a43,_0x22094b){if(_0x466a43[_0x4834('0x49')]['id']){delete _0x466a43[_0x4834('0x49')]['id'];}return db[_0x4834('0x2e')][_0x4834('0x47')]({'where':{'id':_0x466a43[_0x4834('0x44')]['id']}})[_0x4834('0x25')](handleEntityNotFound(_0x22094b,null))[_0x4834('0x25')](saveUpdates(_0x466a43[_0x4834('0x49')],null))[_0x4834('0x25')](respondWithResult(_0x22094b,null))['catch'](handleError(_0x22094b,null));};exports['destroy']=function(_0xfc1125,_0x4472cc){return db['CmHopperAdditionalPhone'][_0x4834('0x47')]({'where':{'id':_0xfc1125['params']['id']}})[_0x4834('0x25')](handleEntityNotFound(_0x4472cc,null))[_0x4834('0x25')](removeEntity(_0x4472cc,null))[_0x4834('0x42')](handleError(_0x4472cc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 28d3aca..4642780 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ce1=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5896a3,_0x184215){var _0xf2cea4=function(_0x398cfa){while(--_0x398cfa){_0x5896a3['push'](_0x5896a3['shift']());}};_0xf2cea4(++_0x184215);}(_0x0ce1,0x17a));var _0x10ce=function(_0x24afdc,_0x523845){_0x24afdc=_0x24afdc-0x0;var _0x57a9e6=_0x0ce1[_0x24afdc];return _0x57a9e6;};'use strict';var _=require(_0x10ce('0x0'));var util=require(_0x10ce('0x1'));var logger=require('../../config/logger')(_0x10ce('0x2'));var moment=require(_0x10ce('0x3'));var BPromise=require(_0x10ce('0x4'));var rp=require(_0x10ce('0x5'));var fs=require('fs');var path=require(_0x10ce('0x6'));var rimraf=require(_0x10ce('0x7'));var config=require(_0x10ce('0x8'));var attributes=require(_0x10ce('0x9'));module['exports']=function(_0x48985c,_0x28f2b0){return _0x48985c[_0x10ce('0xa')](_0x10ce('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a25=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone'];(function(_0xef8372,_0x428d77){var _0x3d73db=function(_0x5ebee3){while(--_0x5ebee3){_0xef8372['push'](_0xef8372['shift']());}};_0x3d73db(++_0x428d77);}(_0x7a25,0x1ce));var _0x57a2=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x7a25[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0x57a2('0x0'));var util=require(_0x57a2('0x1'));var logger=require(_0x57a2('0x2'))('api');var moment=require(_0x57a2('0x3'));var BPromise=require(_0x57a2('0x4'));var rp=require(_0x57a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57a2('0x6'));var config=require(_0x57a2('0x7'));var attributes=require(_0x57a2('0x8'));module[_0x57a2('0x9')]=function(_0x480ad3,_0x40387b){return _0x480ad3['define'](_0x57a2('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 3b583c4..6c9c378 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e33=['then','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','createdAt','phone','isNil','updatedAt','sequelize','transaction','update','field','IncrementPreviewCounters','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC'];(function(_0x5c9019,_0x3bd3a3){var _0x5c99c8=function(_0x306dbc){while(--_0x306dbc){_0x5c9019['push'](_0x5c9019['shift']());}};_0x5c99c8(++_0x3bd3a3);}(_0x6e33,0xc2));var _0x36e3=function(_0x83a3a4,_0x186e74){_0x83a3a4=_0x83a3a4-0x0;var _0xf868f9=_0x6e33[_0x83a3a4];return _0xf868f9;};'use strict';var _=require(_0x36e3('0x0'));var util=require(_0x36e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36e3('0x2'));var fs=require('fs');var Redis=require(_0x36e3('0x3'));var db=require(_0x36e3('0x4'))['db'];var utils=require(_0x36e3('0x5'));var logger=require('../../config/logger')(_0x36e3('0x6'));var config=require(_0x36e3('0x7'));var jayson=require(_0x36e3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59c192,_0x281e26,_0x4be95a){return new BPromise(function(_0x22f36f,_0x54c8ce){return client[_0x36e3('0x9')](_0x59c192,_0x4be95a)['then'](function(_0x2f68c8){logger[_0x36e3('0xa')](_0x36e3('0xb'),_0x281e26,_0x36e3('0xc'));logger[_0x36e3('0xd')](_0x36e3('0xe'),_0x281e26,_0x36e3('0xc'),JSON['stringify'](_0x2f68c8));if(_0x2f68c8[_0x36e3('0xf')]){if(_0x2f68c8[_0x36e3('0xf')]['code']===0x1f4){logger[_0x36e3('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x281e26,_0x2f68c8[_0x36e3('0xf')][_0x36e3('0x10')]);return _0x54c8ce(_0x2f68c8[_0x36e3('0xf')][_0x36e3('0x10')]);}logger[_0x36e3('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x281e26,_0x2f68c8[_0x36e3('0xf')][_0x36e3('0x10')]);return _0x22f36f(_0x2f68c8[_0x36e3('0xf')]['message']);}else{logger[_0x36e3('0xa')](_0x36e3('0xb'),_0x281e26,_0x36e3('0xc'));_0x22f36f(_0x2f68c8[_0x36e3('0x11')][_0x36e3('0x10')]);}})[_0x36e3('0x12')](function(_0x8663ba){logger['error'](_0x36e3('0xb'),_0x281e26,_0x8663ba);_0x54c8ce(_0x8663ba);});});}exports[_0x36e3('0x13')]=function(_0x5946d9){var _0x7db3dd=this;return new Promise(function(_0x2bcf35,_0x36da18){return db[_0x36e3('0x14')][_0x36e3('0x15')]({'raw':!![],'where':{'ContactId':_0x5946d9[_0x36e3('0x16')][_0x36e3('0x17')],'ListId':_0x5946d9[_0x36e3('0x16')][_0x36e3('0x18')],'VoiceQueueId':_0x5946d9[_0x36e3('0x16')][_0x36e3('0x19')]===undefined?null:_0x5946d9[_0x36e3('0x16')]['VoiceQueueId'],'CampaignId':_0x5946d9[_0x36e3('0x16')][_0x36e3('0x1a')]===undefined?null:_0x5946d9[_0x36e3('0x16')][_0x36e3('0x1a')]}})['then'](function(_0x32f258){if(_0x32f258!=null){return db[_0x36e3('0x1b')][_0x36e3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x32f258['id'],'OrderBy':{'$gt':_0x32f258[_0x36e3('0x1c')]}},'order':[[_0x36e3('0x1c'),_0x36e3('0x1d')]]})[_0x36e3('0x1e')](function(_0x471f48){var _0x3ceaeb=0x0;if(_0x471f48){if(_0x471f48[_0x36e3('0x1f')]+_0x471f48[_0x36e3('0x20')]+_0x471f48['countnoanswerretry']+_0x471f48[_0x36e3('0x21')]+_0x471f48[_0x36e3('0x22')]+_0x471f48[_0x36e3('0x23')]+_0x471f48[_0x36e3('0x24')]+_0x471f48[_0x36e3('0x25')]<_0x5946d9[_0x36e3('0x26')][_0x36e3('0x27')])_0x3ceaeb=0x1;_0x2bcf35({'additional':_0x3ceaeb});}else{return db[_0x36e3('0x1b')][_0x36e3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x32f258['id']},'order':[[_0x36e3('0x1c'),'ASC']]})[_0x36e3('0x1e')](function(_0x61b9f1){var _0x4b62c8=0x0;if(_0x61b9f1){if(_0x61b9f1['countbusyretry']+_0x61b9f1[_0x36e3('0x20')]+_0x61b9f1[_0x36e3('0x28')]+_0x61b9f1[_0x36e3('0x21')]+_0x61b9f1[_0x36e3('0x22')]+_0x61b9f1['countabandonedretry']+_0x61b9f1[_0x36e3('0x24')]+_0x61b9f1[_0x36e3('0x25')]<_0x5946d9[_0x36e3('0x26')]['dialGlobalMaxRetry'])_0x4b62c8=0x1;_0x2bcf35({'additional':_0x4b62c8});}else{_0x2bcf35({'additional':0x0});}})[_0x36e3('0x12')](function(_0x264385){logger['error']('VerifyAdditionalPhones',_0x264385[_0x36e3('0x10')],_0x5946d9);_0x36da18(_0x7db3dd[_0x36e3('0xf')](0x1f4,_0x264385['message']));});}})[_0x36e3('0x12')](function(_0x4ce251){logger['error']('VerifyAdditionalPhones',_0x4ce251[_0x36e3('0x10')],_0x5946d9);_0x36da18(_0x7db3dd[_0x36e3('0xf')](0x1f4,_0x4ce251['message']));});}else _0x2bcf35({'additional':0x0});});});};exports[_0x36e3('0x29')]=function(_0x5b9220){var _0x6cada=this;return new Promise(function(_0x368b72,_0x3a64a2){return db[_0x36e3('0x14')][_0x36e3('0x15')]({'raw':!![],'where':{'ContactId':_0x5b9220[_0x36e3('0x16')]['ContactId'],'ListId':_0x5b9220[_0x36e3('0x16')][_0x36e3('0x18')],'VoiceQueueId':_0x5b9220[_0x36e3('0x16')][_0x36e3('0x19')]===undefined?null:_0x5b9220[_0x36e3('0x16')][_0x36e3('0x19')],'CampaignId':_0x5b9220['body'][_0x36e3('0x1a')]===undefined?null:_0x5b9220[_0x36e3('0x16')][_0x36e3('0x1a')]}})['then'](function(_0x2d9685){if(_0x2d9685!=null){return db[_0x36e3('0x1b')][_0x36e3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2d9685['id'],'OrderBy':{'$gt':_0x2d9685[_0x36e3('0x1c')]}},'order':[[_0x36e3('0x1c'),'ASC']]})[_0x36e3('0x1e')](function(_0x4e1eec){if(_0x4e1eec)return activateAdditionalPhone(_0x2d9685,_0x5b9220[_0x36e3('0x16')],_0x4e1eec,_0x5b9220[_0x36e3('0x2a')],_0x5b9220['waitTime'])[_0x36e3('0x1e')](function(_0xbe199c){_0x368b72(_0xbe199c);});else{return db['CmHopperAdditionalPhone'][_0x36e3('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2d9685['id']},'order':[[_0x36e3('0x1c'),_0x36e3('0x1d')]]})[_0x36e3('0x1e')](function(_0x56fac8){if(_0x56fac8)return activateAdditionalPhone(_0x2d9685,_0x5b9220[_0x36e3('0x16')],_0x56fac8,_0x5b9220['duration'],_0x5b9220[_0x36e3('0x2b')])[_0x36e3('0x1e')](function(_0x22ed2e){_0x368b72(_0x22ed2e);});else{_0x368b72({'id':_0x2d9685['id'],'phone':''});}})['catch'](function(_0x452c93){logger['error']('VerifyAdditionalPhones',_0x452c93[_0x36e3('0x10')],_0x5b9220);_0x3a64a2(_0x6cada[_0x36e3('0xf')](0x1f4,_0x452c93[_0x36e3('0x10')]));});}})[_0x36e3('0x12')](function(_0x3cf32b){logger[_0x36e3('0xf')](_0x36e3('0x13'),_0x3cf32b[_0x36e3('0x10')],_0x5b9220);_0x3a64a2(_0x6cada[_0x36e3('0xf')](0x1f4,_0x3cf32b[_0x36e3('0x10')]));});}else _0x368b72(0x1);});});};function activateAdditionalPhone(_0x3aab0a,_0x4b56dc,_0x355989,_0x5342a7,_0x362ed9){return new Promise(function(_0x11df60,_0x324170){logger[_0x36e3('0xa')](_0x36e3('0x13'),_0x355989);var _0x10b58e;if(moment()>moment(_0x355989[_0x36e3('0x2c')])){_0x10b58e=moment()[_0x36e3('0x2d')](_0x362ed9||0x3,_0x36e3('0x2e'));}else{if(_0x355989[_0x36e3('0x1c')]==0x0){_0x10b58e=moment(_0x355989[_0x36e3('0x2c')]);}else{_0x10b58e=moment()[_0x36e3('0x2d')](_0x362ed9||0x3,_0x36e3('0x2e'));}}var _0x5a5c5d={'phone':_0x3aab0a['phone'],'active':0x0,'OrderBy':_['isNil'](_0x3aab0a[_0x36e3('0x1c')])?0x0:_0x3aab0a[_0x36e3('0x1c')],'scheduledat':moment()[_0x36e3('0x2d')](_0x5342a7||0x1,_0x36e3('0x2e')),'countbusyretry':_0x4b56dc[_0x36e3('0x1f')],'countcongestionretry':_0x4b56dc['countcongestionretry'],'countnoanswerretry':_0x4b56dc[_0x36e3('0x28')],'countnosuchnumberretry':_0x4b56dc[_0x36e3('0x21')],'countdropretry':_0x4b56dc[_0x36e3('0x22')],'countabandonedretry':_0x4b56dc['countabandonedretry'],'countmachineretry':_0x4b56dc['countmachineretry'],'countagentrejectretry':_0x4b56dc[_0x36e3('0x25')],'createdAt':_0x4b56dc[_0x36e3('0x2f')],'updatedAt':_0x4b56dc['updatedAt']};var _0x5d3a8f={'CmHopperId':_0x3aab0a['id'],'phone':_0x355989[_0x36e3('0x30')],'active':0x0,'OrderBy':_[_0x36e3('0x31')](_0x355989[_0x36e3('0x1c')])?0x0:_0x355989['OrderBy'],'scheduledat':_0x10b58e,'countbusyretry':_0x355989['countbusyretry'],'countcongestionretry':_0x355989[_0x36e3('0x20')],'countnoanswerretry':_0x355989[_0x36e3('0x28')],'countnosuchnumberretry':_0x4b56dc[_0x36e3('0x21')],'countdropretry':_0x4b56dc[_0x36e3('0x22')],'countabandonedretry':_0x4b56dc[_0x36e3('0x23')],'countmachineretry':_0x4b56dc['countmachineretry'],'countagentrejectretry':_0x4b56dc['countagentrejectretry'],'createdAt':_0x355989['createdAt'],'updatedAt':_0x355989[_0x36e3('0x32')]};logger[_0x36e3('0xa')]('hopperToAdd',_0x5a5c5d);logger[_0x36e3('0xa')]('additionalToHop',_0x5d3a8f);return db[_0x36e3('0x33')][_0x36e3('0x34')](function(_0x36fbf6){return db[_0x36e3('0x1b')]['update'](_0x5a5c5d,{'where':{'id':_0x355989['id']}},{'transaction':_0x36fbf6})[_0x36e3('0x1e')](function(){return db['CmHopper'][_0x36e3('0x35')](_0x5d3a8f,{'where':{'id':_0x3aab0a['id']}},{'transaction':_0x36fbf6});});})[_0x36e3('0x1e')](function(_0x4b837c){_0x11df60({'id':_0x3aab0a['id'],'phone':_0x355989[_0x36e3('0x30')]});})[_0x36e3('0x12')](function(_0xd039e8){logger['error'](_0x36e3('0x13'),_0xd039e8[_0x36e3('0x10')],req);_0x324170(_this[_0x36e3('0xf')](0x1f4,_0xd039e8[_0x36e3('0x10')]));});});}exports['IncrementPreviewCounters']=function(_0x156c6e){var _0x2494f7=this;return new Promise(function(_0x2266b2,_0x1b40d0){return db[_0x36e3('0x14')]['update'](_0x156c6e[_0x36e3('0x16')][_0x36e3('0x36')],{'where':{'id':_0x156c6e[_0x36e3('0x16')]['id']}})['then'](function(_0x3ee4cb){_0x2266b2(_0x3ee4cb);})[_0x36e3('0x12')](function(_0x1b6400){logger['error'](_0x36e3('0x37'),_0x1b6400[_0x36e3('0x10')],_0x156c6e);_0x1b40d0(_0x2494f7[_0x36e3('0xf')](0x1f4,_0x1b6400['message']));});});}; \ No newline at end of file +var _0x538a=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','entity','dialGlobalMaxRetry','countmachineretry','SwapAdditionalPhones','waitTime','scheduledat','add','minutes','phone','isNil','countagentrejectretry','createdAt','updatedAt','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x538a,0x196));var _0xa538=function(_0x1b071c,_0x21baa8){_0x1b071c=_0x1b071c-0x0;var _0x4d3cc5=_0x538a[_0x1b071c];return _0x4d3cc5;};'use strict';var _=require(_0xa538('0x0'));var util=require(_0xa538('0x1'));var moment=require(_0xa538('0x2'));var BPromise=require(_0xa538('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa538('0x4'));var db=require(_0xa538('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa538('0x6'))(_0xa538('0x7'));var config=require('../../config/environment');var jayson=require(_0xa538('0x8'));var client=jayson[_0xa538('0x9')][_0xa538('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a3d17,_0x42ddfa,_0x1384c1){return new BPromise(function(_0x4e8f2d,_0x35efc7){return client[_0xa538('0xb')](_0x4a3d17,_0x1384c1)[_0xa538('0xc')](function(_0x2b94bf){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42ddfa,_0xa538('0xd'));logger['debug'](_0xa538('0xe'),_0x42ddfa,_0xa538('0xd'),JSON[_0xa538('0xf')](_0x2b94bf));if(_0x2b94bf[_0xa538('0x10')]){if(_0x2b94bf[_0xa538('0x10')][_0xa538('0x11')]===0x1f4){logger[_0xa538('0x10')](_0xa538('0x12'),_0x42ddfa,_0x2b94bf[_0xa538('0x10')]['message']);return _0x35efc7(_0x2b94bf[_0xa538('0x10')][_0xa538('0x13')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42ddfa,_0x2b94bf['error'][_0xa538('0x13')]);return _0x4e8f2d(_0x2b94bf[_0xa538('0x10')][_0xa538('0x13')]);}else{logger[_0xa538('0x14')](_0xa538('0x12'),_0x42ddfa,'request\x20sent');_0x4e8f2d(_0x2b94bf[_0xa538('0x15')]['message']);}})[_0xa538('0x16')](function(_0x1f9564){logger[_0xa538('0x10')](_0xa538('0x12'),_0x42ddfa,_0x1f9564);_0x35efc7(_0x1f9564);});});}exports[_0xa538('0x17')]=function(_0x2d89c5){var _0x5b7649=this;return new Promise(function(_0x27f326,_0x561426){return db[_0xa538('0x18')][_0xa538('0x19')]({'raw':!![],'where':{'ContactId':_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1b')],'ListId':_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1c')],'VoiceQueueId':_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1d')]===undefined?null:_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1d')],'CampaignId':_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1e')]===undefined?null:_0x2d89c5[_0xa538('0x1a')][_0xa538('0x1e')]}})['then'](function(_0x19228e){if(_0x19228e!=null){return db[_0xa538('0x1f')][_0xa538('0x19')]({'raw':!![],'where':{'CmHopperId':_0x19228e['id'],'OrderBy':{'$gt':_0x19228e['OrderBy']}},'order':[[_0xa538('0x20'),_0xa538('0x21')]]})[_0xa538('0xc')](function(_0x108d8d){var _0x5ef2e9=0x0;if(_0x108d8d){if(_0x108d8d[_0xa538('0x22')]+_0x108d8d[_0xa538('0x23')]+_0x108d8d[_0xa538('0x24')]+_0x108d8d[_0xa538('0x25')]+_0x108d8d[_0xa538('0x26')]+_0x108d8d[_0xa538('0x27')]+_0x108d8d['countmachineretry']+_0x108d8d['countagentrejectretry']<_0x2d89c5[_0xa538('0x28')][_0xa538('0x29')])_0x5ef2e9=0x1;_0x27f326({'additional':_0x5ef2e9});}else{return db['CmHopperAdditionalPhone'][_0xa538('0x19')]({'raw':!![],'where':{'CmHopperId':_0x19228e['id']},'order':[['OrderBy',_0xa538('0x21')]]})[_0xa538('0xc')](function(_0x5bd5db){var _0xb67074=0x0;if(_0x5bd5db){if(_0x5bd5db['countbusyretry']+_0x5bd5db[_0xa538('0x23')]+_0x5bd5db[_0xa538('0x24')]+_0x5bd5db[_0xa538('0x25')]+_0x5bd5db[_0xa538('0x26')]+_0x5bd5db[_0xa538('0x27')]+_0x5bd5db[_0xa538('0x2a')]+_0x5bd5db['countagentrejectretry']<_0x2d89c5[_0xa538('0x28')][_0xa538('0x29')])_0xb67074=0x1;_0x27f326({'additional':_0xb67074});}else{_0x27f326({'additional':0x0});}})['catch'](function(_0x5c72ab){logger[_0xa538('0x10')](_0xa538('0x17'),_0x5c72ab[_0xa538('0x13')],_0x2d89c5);_0x561426(_0x5b7649[_0xa538('0x10')](0x1f4,_0x5c72ab[_0xa538('0x13')]));});}})[_0xa538('0x16')](function(_0x1a32d3){logger[_0xa538('0x10')](_0xa538('0x17'),_0x1a32d3[_0xa538('0x13')],_0x2d89c5);_0x561426(_0x5b7649[_0xa538('0x10')](0x1f4,_0x1a32d3[_0xa538('0x13')]));});}else _0x27f326({'additional':0x0});});});};exports[_0xa538('0x2b')]=function(_0x5d34a7){var _0x3d6d82=this;return new Promise(function(_0x408ebb,_0xc3d053){return db[_0xa538('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x5d34a7['body'][_0xa538('0x1b')],'ListId':_0x5d34a7[_0xa538('0x1a')][_0xa538('0x1c')],'VoiceQueueId':_0x5d34a7['body'][_0xa538('0x1d')]===undefined?null:_0x5d34a7[_0xa538('0x1a')][_0xa538('0x1d')],'CampaignId':_0x5d34a7[_0xa538('0x1a')][_0xa538('0x1e')]===undefined?null:_0x5d34a7[_0xa538('0x1a')]['CampaignId']}})[_0xa538('0xc')](function(_0x526eba){if(_0x526eba!=null){return db[_0xa538('0x1f')][_0xa538('0x19')]({'raw':!![],'where':{'CmHopperId':_0x526eba['id'],'OrderBy':{'$gt':_0x526eba[_0xa538('0x20')]}},'order':[[_0xa538('0x20'),_0xa538('0x21')]]})[_0xa538('0xc')](function(_0x4581e0){if(_0x4581e0)return activateAdditionalPhone(_0x526eba,_0x5d34a7[_0xa538('0x1a')],_0x4581e0,_0x5d34a7['duration'],_0x5d34a7[_0xa538('0x2c')])[_0xa538('0xc')](function(_0x273a55){_0x408ebb(_0x273a55);});else{return db[_0xa538('0x1f')][_0xa538('0x19')]({'raw':!![],'where':{'CmHopperId':_0x526eba['id']},'order':[[_0xa538('0x20'),_0xa538('0x21')]]})[_0xa538('0xc')](function(_0x563481){if(_0x563481)return activateAdditionalPhone(_0x526eba,_0x5d34a7['body'],_0x563481,_0x5d34a7['duration'],_0x5d34a7[_0xa538('0x2c')])['then'](function(_0x358688){_0x408ebb(_0x358688);});else{_0x408ebb({'id':_0x526eba['id'],'phone':''});}})[_0xa538('0x16')](function(_0x555e36){logger[_0xa538('0x10')](_0xa538('0x17'),_0x555e36[_0xa538('0x13')],_0x5d34a7);_0xc3d053(_0x3d6d82[_0xa538('0x10')](0x1f4,_0x555e36[_0xa538('0x13')]));});}})['catch'](function(_0x3f9515){logger[_0xa538('0x10')](_0xa538('0x17'),_0x3f9515[_0xa538('0x13')],_0x5d34a7);_0xc3d053(_0x3d6d82[_0xa538('0x10')](0x1f4,_0x3f9515[_0xa538('0x13')]));});}else _0x408ebb(0x1);});});};function activateAdditionalPhone(_0x5ba7b3,_0xe24956,_0xe55669,_0x46b039,_0x36491c){return new Promise(function(_0x5b7845,_0xa7daf4){logger['info']('VerifyAdditionalPhones',_0xe55669);var _0x3392d9;if(moment()>moment(_0xe55669[_0xa538('0x2d')])){_0x3392d9=moment()[_0xa538('0x2e')](_0x36491c||0x3,_0xa538('0x2f'));}else{if(_0xe55669[_0xa538('0x20')]==0x0){_0x3392d9=moment(_0xe55669[_0xa538('0x2d')]);}else{_0x3392d9=moment()[_0xa538('0x2e')](_0x36491c||0x3,'minutes');}}var _0x36126a={'phone':_0x5ba7b3[_0xa538('0x30')],'active':0x0,'OrderBy':_[_0xa538('0x31')](_0x5ba7b3[_0xa538('0x20')])?0x0:_0x5ba7b3[_0xa538('0x20')],'scheduledat':moment()[_0xa538('0x2e')](_0x46b039||0x1,_0xa538('0x2f')),'countbusyretry':_0xe24956['countbusyretry'],'countcongestionretry':_0xe24956[_0xa538('0x23')],'countnoanswerretry':_0xe24956['countnoanswerretry'],'countnosuchnumberretry':_0xe24956[_0xa538('0x25')],'countdropretry':_0xe24956[_0xa538('0x26')],'countabandonedretry':_0xe24956[_0xa538('0x27')],'countmachineretry':_0xe24956[_0xa538('0x2a')],'countagentrejectretry':_0xe24956[_0xa538('0x32')],'createdAt':_0xe24956[_0xa538('0x33')],'updatedAt':_0xe24956[_0xa538('0x34')]};var _0x11ce92={'CmHopperId':_0x5ba7b3['id'],'phone':_0xe55669[_0xa538('0x30')],'active':0x0,'OrderBy':_[_0xa538('0x31')](_0xe55669['OrderBy'])?0x0:_0xe55669[_0xa538('0x20')],'scheduledat':_0x3392d9,'countbusyretry':_0xe55669[_0xa538('0x22')],'countcongestionretry':_0xe55669[_0xa538('0x23')],'countnoanswerretry':_0xe55669[_0xa538('0x24')],'countnosuchnumberretry':_0xe24956[_0xa538('0x25')],'countdropretry':_0xe24956[_0xa538('0x26')],'countabandonedretry':_0xe24956['countabandonedretry'],'countmachineretry':_0xe24956[_0xa538('0x2a')],'countagentrejectretry':_0xe24956['countagentrejectretry'],'createdAt':_0xe55669[_0xa538('0x33')],'updatedAt':_0xe55669[_0xa538('0x34')]};logger['info']('hopperToAdd',_0x36126a);logger[_0xa538('0x14')](_0xa538('0x35'),_0x11ce92);return db[_0xa538('0x36')][_0xa538('0x37')](function(_0x1aac27){return db[_0xa538('0x1f')]['update'](_0x36126a,{'where':{'id':_0xe55669['id']}},{'transaction':_0x1aac27})[_0xa538('0xc')](function(){return db[_0xa538('0x18')][_0xa538('0x38')](_0x11ce92,{'where':{'id':_0x5ba7b3['id']}},{'transaction':_0x1aac27});});})[_0xa538('0xc')](function(_0x48bae1){_0x5b7845({'id':_0x5ba7b3['id'],'phone':_0xe55669[_0xa538('0x30')]});})[_0xa538('0x16')](function(_0x29f8e6){logger[_0xa538('0x10')](_0xa538('0x17'),_0x29f8e6[_0xa538('0x13')],req);_0xa7daf4(_this[_0xa538('0x10')](0x1f4,_0x29f8e6['message']));});});}exports[_0xa538('0x39')]=function(_0x85c709){var _0x30cff5=this;return new Promise(function(_0x1a696d,_0x41bd66){return db[_0xa538('0x18')][_0xa538('0x38')](_0x85c709[_0xa538('0x1a')]['field'],{'where':{'id':_0x85c709[_0xa538('0x1a')]['id']}})[_0xa538('0xc')](function(_0x59f977){_0x1a696d(_0x59f977);})[_0xa538('0x16')](function(_0x4ddb33){logger[_0xa538('0x10')](_0xa538('0x39'),_0x4ddb33['message'],_0x85c709);_0x41bd66(_0x30cff5['error'](0x1f4,_0x4ddb33[_0xa538('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9c6ed0a..35ba219 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e3b=['post','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','isAuthenticated'];(function(_0x5d4db8,_0x4ad01b){var _0x415548=function(_0x7ae456){while(--_0x7ae456){_0x5d4db8['push'](_0x5d4db8['shift']());}};_0x415548(++_0x4ad01b);}(_0x7e3b,0xd8));var _0xb7e3=function(_0x3cd38a,_0x2c63e6){_0x3cd38a=_0x3cd38a-0x0;var _0x180b4e=_0x7e3b[_0x3cd38a];return _0x180b4e;};'use strict';var multer=require('multer');var util=require(_0xb7e3('0x0'));var path=require(_0xb7e3('0x1'));var timeout=require(_0xb7e3('0x2'));var express=require(_0xb7e3('0x3'));var router=express[_0xb7e3('0x4')]();var auth=require(_0xb7e3('0x5'));var interaction=require(_0xb7e3('0x6'));var config=require(_0xb7e3('0x7'));var controller=require(_0xb7e3('0x8'));router[_0xb7e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb7e3('0xa')]);router[_0xb7e3('0x9')]('/:id',auth[_0xb7e3('0xb')](),controller['show']);router[_0xb7e3('0xc')]('/',auth[_0xb7e3('0xb')](),controller['create']);router[_0xb7e3('0xd')]('/:id',auth[_0xb7e3('0xb')](),controller[_0xb7e3('0xe')]);router[_0xb7e3('0xf')](_0xb7e3('0x10'),auth[_0xb7e3('0xb')](),controller[_0xb7e3('0x11')]);module[_0xb7e3('0x12')]=router; \ No newline at end of file +var _0x29f1=['Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express'];(function(_0x49aa4e,_0x560eb7){var _0x58ed43=function(_0x2a483c){while(--_0x2a483c){_0x49aa4e['push'](_0x49aa4e['shift']());}};_0x58ed43(++_0x560eb7);}(_0x29f1,0x195));var _0x129f=function(_0x202b7c,_0x143753){_0x202b7c=_0x202b7c-0x0;var _0x3b5401=_0x29f1[_0x202b7c];return _0x3b5401;};'use strict';var multer=require('multer');var util=require(_0x129f('0x0'));var path=require('path');var timeout=require(_0x129f('0x1'));var express=require(_0x129f('0x2'));var router=express[_0x129f('0x3')]();var auth=require(_0x129f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x129f('0x5'));var controller=require(_0x129f('0x6'));router[_0x129f('0x7')]('/',auth[_0x129f('0x8')](),controller[_0x129f('0x9')]);router[_0x129f('0x7')](_0x129f('0xa'),auth[_0x129f('0x8')](),controller[_0x129f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x129f('0xc')]);router[_0x129f('0xd')](_0x129f('0xa'),auth[_0x129f('0x8')](),controller['update']);router[_0x129f('0xe')](_0x129f('0xa'),auth['isAuthenticated'](),controller[_0x129f('0xf')]);module[_0x129f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f2a9f77..34de329 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 _0x4b72=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x417f59,_0x41854f){var _0x3e6a30=function(_0x41bcc7){while(--_0x41bcc7){_0x417f59['push'](_0x417f59['shift']());}};_0x3e6a30(++_0x41854f);}(_0x4b72,0x16f));var _0x24b7=function(_0x589360,_0x16d650){_0x589360=_0x589360-0x0;var _0x5293d2=_0x4b72[_0x589360];return _0x5293d2;};'use strict';var moment=require(_0x24b7('0x0'));var Sequelize=require(_0x24b7('0x1'));module[_0x24b7('0x2')]={'phone':{'type':Sequelize[_0x24b7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x24b7('0x4')],'unique':_0x24b7('0x5')},'ListId':{'type':Sequelize[_0x24b7('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x24b7('0x4')],'unique':_0x24b7('0x5')}}; \ No newline at end of file +var _0x7ab6=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ab6,0xc3));var _0x67ab=function(_0xfaac8b,_0x4dc946){_0xfaac8b=_0xfaac8b-0x0;var _0x5bf089=_0x7ab6[_0xfaac8b];return _0x5bf089;};'use strict';var moment=require(_0x67ab('0x0'));var Sequelize=require('sequelize');module[_0x67ab('0x1')]={'phone':{'type':Sequelize[_0x67ab('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x67ab('0x3')],'unique':_0x67ab('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x67ab('0x3')],'unique':_0x67ab('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4fb4f0f..d9566bc 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3b3958,_0x14ecee){var _0x2dceb4=function(_0x51311e){while(--_0x51311e){_0x3b3958['push'](_0x3b3958['shift']());}};_0x2dceb4(++_0x14ecee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x26ca7d,_0x4b96a3){var _0x357d9d=function(_0x549a25){while(--_0x549a25){_0x26ca7d['push'](_0x26ca7d['shift']());}};_0x357d9d(++_0x4b96a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6321fab..0aec4c7 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x1e096c,_0x156fa1){var _0x1ccef6=function(_0x1c3446){while(--_0x1c3446){_0x1e096c['push'](_0x1e096c['shift']());}};_0x1ccef6(++_0x156fa1);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e4f88,_0x2be77c){_0x4e4f88=_0x4e4f88-0x0;var _0x51ec61=_0xedd9[_0x4e4f88];return _0x51ec61;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x531eb1,_0x1aef94){var _0x417d06=function(_0x2c9eb3){while(--_0x2c9eb3){_0x531eb1['push'](_0x531eb1['shift']());}};_0x417d06(++_0x1aef94);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index caa9115..cd59989 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 _0x41ed=['stringify','error','code','message','result','CmHopperBlack','options','raw','attributes','limit','map','include','model','GetCmHopperBlack','debug','update','where','UpdateCmHopperBlack','catch','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x155f0c,_0x449fb2){var _0x36571a=function(_0x2a485e){while(--_0x2a485e){_0x155f0c['push'](_0x155f0c['shift']());}};_0x36571a(++_0x449fb2);}(_0x41ed,0x118));var _0xd41e=function(_0x295acf,_0x105881){_0x295acf=_0x295acf-0x0;var _0x1ba48d=_0x41ed[_0x295acf];return _0x1ba48d;};'use strict';var _=require(_0xd41e('0x0'));var util=require(_0xd41e('0x1'));var moment=require(_0xd41e('0x2'));var BPromise=require(_0xd41e('0x3'));var rs=require(_0xd41e('0x4'));var fs=require('fs');var Redis=require(_0xd41e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd41e('0x6'));var logger=require(_0xd41e('0x7'))(_0xd41e('0x8'));var config=require(_0xd41e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd41e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dbfcf,_0x213713,_0x16698c){return new BPromise(function(_0x5e2446,_0x32ebfc){return client['request'](_0x2dbfcf,_0x16698c)[_0xd41e('0xb')](function(_0x3aa416){logger[_0xd41e('0xc')](_0xd41e('0xd'),_0x213713,_0xd41e('0xe'));logger['debug'](_0xd41e('0xf'),_0x213713,_0xd41e('0xe'),JSON[_0xd41e('0x10')](_0x3aa416));if(_0x3aa416[_0xd41e('0x11')]){if(_0x3aa416[_0xd41e('0x11')][_0xd41e('0x12')]===0x1f4){logger[_0xd41e('0x11')](_0xd41e('0xd'),_0x213713,_0x3aa416[_0xd41e('0x11')][_0xd41e('0x13')]);return _0x32ebfc(_0x3aa416[_0xd41e('0x11')][_0xd41e('0x13')]);}logger['error'](_0xd41e('0xd'),_0x213713,_0x3aa416[_0xd41e('0x11')]['message']);return _0x5e2446(_0x3aa416[_0xd41e('0x11')][_0xd41e('0x13')]);}else{logger[_0xd41e('0xc')](_0xd41e('0xd'),_0x213713,'request\x20sent');_0x5e2446(_0x3aa416[_0xd41e('0x14')][_0xd41e('0x13')]);}})['catch'](function(_0x575e17){logger[_0xd41e('0x11')](_0xd41e('0xd'),_0x213713,_0x575e17);_0x32ebfc(_0x575e17);});});}exports['GetCmHopperBlack']=function(_0x2beba5){var _0x1ea48b=this;return new Promise(function(_0x37bdfe,_0x16741b){return db[_0xd41e('0x15')]['findAll']({'raw':_0x2beba5['options']?_0x2beba5[_0xd41e('0x16')][_0xd41e('0x17')]===undefined?!![]:![]:!![],'where':_0x2beba5[_0xd41e('0x16')]?_0x2beba5[_0xd41e('0x16')]['where']||null:null,'attributes':_0x2beba5[_0xd41e('0x16')]?_0x2beba5[_0xd41e('0x16')][_0xd41e('0x18')]||null:null,'limit':_0x2beba5['options']?_0x2beba5['options'][_0xd41e('0x19')]||null:null,'include':_0x2beba5[_0xd41e('0x16')]?_0x2beba5['options']['include']?_[_0xd41e('0x1a')](_0x2beba5[_0xd41e('0x16')][_0xd41e('0x1b')],function(_0x4a69a4){return{'model':db[_0x4a69a4[_0xd41e('0x1c')]],'as':_0x4a69a4['as'],'attributes':_0x4a69a4['attributes'],'include':_0x4a69a4[_0xd41e('0x1b')]?_['map'](_0x4a69a4[_0xd41e('0x1b')],function(_0x23b9f3){return{'model':db[_0x23b9f3[_0xd41e('0x1c')]],'as':_0x23b9f3['as'],'attributes':_0x23b9f3[_0xd41e('0x18')],'include':_0x23b9f3[_0xd41e('0x1b')]?_[_0xd41e('0x1a')](_0x23b9f3[_0xd41e('0x1b')],function(_0x4058e2){return{'model':db[_0x4058e2[_0xd41e('0x1c')]],'as':_0x4058e2['as'],'attributes':_0x4058e2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55e55e){logger[_0xd41e('0xc')](_0xd41e('0x1d'),_0x2beba5);logger[_0xd41e('0x1e')](_0xd41e('0x1d'),_0x2beba5,JSON[_0xd41e('0x10')](_0x55e55e));_0x37bdfe(_0x55e55e);})['catch'](function(_0x380f02){logger[_0xd41e('0x11')](_0xd41e('0x1d'),_0x380f02[_0xd41e('0x13')],_0x2beba5);_0x16741b(_0x1ea48b[_0xd41e('0x11')](0x1f4,_0x380f02[_0xd41e('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x533946){var _0x455251=this;return new Promise(function(_0x3cd387,_0x1fb238){return db[_0xd41e('0x15')][_0xd41e('0x1f')](_0x533946['body'],{'raw':_0x533946[_0xd41e('0x16')]?_0x533946[_0xd41e('0x16')][_0xd41e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x533946[_0xd41e('0x16')]?_0x533946[_0xd41e('0x16')][_0xd41e('0x20')]||null:null,'attributes':_0x533946[_0xd41e('0x16')]?_0x533946['options'][_0xd41e('0x18')]||null:null,'limit':_0x533946[_0xd41e('0x16')]?_0x533946[_0xd41e('0x16')]['limit']||null:null})[_0xd41e('0xb')](function(_0x412348){logger[_0xd41e('0xc')](_0xd41e('0x21'),_0x533946);logger[_0xd41e('0x1e')](_0xd41e('0x21'),_0x533946,JSON[_0xd41e('0x10')](_0x412348));_0x3cd387(_0x412348);})[_0xd41e('0x22')](function(_0x34b4ac){logger[_0xd41e('0x11')](_0xd41e('0x21'),_0x34b4ac[_0xd41e('0x13')],_0x533946);_0x1fb238(_0x455251[_0xd41e('0x11')](0x1f4,_0x34b4ac[_0xd41e('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x2fcede){var _0x35b109=this;return new Promise(function(_0x2c5473,_0x20ddbb){return db[_0xd41e('0x15')][_0xd41e('0x23')]({'where':_0x2fcede['options']?_0x2fcede[_0xd41e('0x16')][_0xd41e('0x20')]||null:null})[_0xd41e('0xb')](function(_0x199b50){logger[_0xd41e('0xc')](_0xd41e('0x24'),_0x2fcede);logger['debug'](_0xd41e('0x24'),_0x2fcede,JSON['stringify'](_0x199b50));_0x2c5473(_0x199b50);})[_0xd41e('0x22')](function(_0x17c927){logger[_0xd41e('0x11')](_0xd41e('0x24'),_0x17c927['message'],_0x2fcede);_0x20ddbb(_0x35b109[_0xd41e('0x11')](0x1f4,_0x17c927[_0xd41e('0x13')]));});});}; \ No newline at end of file +var _0xc9a4=['message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xc9a4,0x18f));var _0x4c9a=function(_0xe8fa75,_0x2fed65){_0xe8fa75=_0xe8fa75-0x0;var _0x762b37=_0xc9a4[_0xe8fa75];return _0x762b37;};'use strict';var _=require(_0x4c9a('0x0'));var util=require(_0x4c9a('0x1'));var moment=require(_0x4c9a('0x2'));var BPromise=require(_0x4c9a('0x3'));var rs=require(_0x4c9a('0x4'));var fs=require('fs');var Redis=require(_0x4c9a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c9a('0x6'));var logger=require('../../config/logger')(_0x4c9a('0x7'));var config=require(_0x4c9a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4c9a('0x9')][_0x4c9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa5f486,_0x5e6560,_0x978628){return new BPromise(function(_0x997509,_0xb02573){return client[_0x4c9a('0xb')](_0xa5f486,_0x978628)[_0x4c9a('0xc')](function(_0x47a5ad){logger[_0x4c9a('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x5e6560,_0x4c9a('0xe'));logger[_0x4c9a('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5e6560,_0x4c9a('0xe'),JSON[_0x4c9a('0x10')](_0x47a5ad));if(_0x47a5ad['error']){if(_0x47a5ad[_0x4c9a('0x11')][_0x4c9a('0x12')]===0x1f4){logger[_0x4c9a('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x5e6560,_0x47a5ad[_0x4c9a('0x11')][_0x4c9a('0x13')]);return _0xb02573(_0x47a5ad[_0x4c9a('0x11')][_0x4c9a('0x13')]);}logger[_0x4c9a('0x11')](_0x4c9a('0x14'),_0x5e6560,_0x47a5ad[_0x4c9a('0x11')]['message']);return _0x997509(_0x47a5ad[_0x4c9a('0x11')][_0x4c9a('0x13')]);}else{logger[_0x4c9a('0xd')](_0x4c9a('0x14'),_0x5e6560,_0x4c9a('0xe'));_0x997509(_0x47a5ad[_0x4c9a('0x15')][_0x4c9a('0x13')]);}})[_0x4c9a('0x16')](function(_0x4f4260){logger[_0x4c9a('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x5e6560,_0x4f4260);_0xb02573(_0x4f4260);});});}exports[_0x4c9a('0x17')]=function(_0x53b82f){var _0x56800a=this;return new Promise(function(_0x3e44db,_0x2c2ac4){return db['CmHopperBlack']['findAll']({'raw':_0x53b82f['options']?_0x53b82f[_0x4c9a('0x18')][_0x4c9a('0x19')]===undefined?!![]:![]:!![],'where':_0x53b82f['options']?_0x53b82f[_0x4c9a('0x18')]['where']||null:null,'attributes':_0x53b82f[_0x4c9a('0x18')]?_0x53b82f[_0x4c9a('0x18')][_0x4c9a('0x1a')]||null:null,'limit':_0x53b82f[_0x4c9a('0x18')]?_0x53b82f[_0x4c9a('0x18')][_0x4c9a('0x1b')]||null:null,'include':_0x53b82f['options']?_0x53b82f[_0x4c9a('0x18')][_0x4c9a('0x1c')]?_[_0x4c9a('0x1d')](_0x53b82f[_0x4c9a('0x18')][_0x4c9a('0x1c')],function(_0xe6f7b0){return{'model':db[_0xe6f7b0['model']],'as':_0xe6f7b0['as'],'attributes':_0xe6f7b0[_0x4c9a('0x1a')],'include':_0xe6f7b0[_0x4c9a('0x1c')]?_[_0x4c9a('0x1d')](_0xe6f7b0[_0x4c9a('0x1c')],function(_0x11d074){return{'model':db[_0x11d074[_0x4c9a('0x1e')]],'as':_0x11d074['as'],'attributes':_0x11d074[_0x4c9a('0x1a')],'include':_0x11d074[_0x4c9a('0x1c')]?_[_0x4c9a('0x1d')](_0x11d074[_0x4c9a('0x1c')],function(_0x484503){return{'model':db[_0x484503['model']],'as':_0x484503['as'],'attributes':_0x484503[_0x4c9a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4c9a('0xc')](function(_0x557b21){logger[_0x4c9a('0xd')](_0x4c9a('0x17'),_0x53b82f);logger['debug'](_0x4c9a('0x17'),_0x53b82f,JSON[_0x4c9a('0x10')](_0x557b21));_0x3e44db(_0x557b21);})[_0x4c9a('0x16')](function(_0x3ef22e){logger['error'](_0x4c9a('0x17'),_0x3ef22e[_0x4c9a('0x13')],_0x53b82f);_0x2c2ac4(_0x56800a['error'](0x1f4,_0x3ef22e['message']));});});};exports[_0x4c9a('0x1f')]=function(_0x90e24c){var _0x3129d5=this;return new Promise(function(_0x1dc3bf,_0x33b033){return db[_0x4c9a('0x20')][_0x4c9a('0x21')](_0x90e24c[_0x4c9a('0x22')],{'raw':_0x90e24c[_0x4c9a('0x18')]?_0x90e24c[_0x4c9a('0x18')][_0x4c9a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x90e24c[_0x4c9a('0x18')]?_0x90e24c[_0x4c9a('0x18')][_0x4c9a('0x23')]||null:null,'attributes':_0x90e24c[_0x4c9a('0x18')]?_0x90e24c['options']['attributes']||null:null,'limit':_0x90e24c['options']?_0x90e24c['options']['limit']||null:null})[_0x4c9a('0xc')](function(_0x839ce0){logger['info'](_0x4c9a('0x1f'),_0x90e24c);logger[_0x4c9a('0xf')](_0x4c9a('0x1f'),_0x90e24c,JSON['stringify'](_0x839ce0));_0x1dc3bf(_0x839ce0);})[_0x4c9a('0x16')](function(_0x172dfa){logger[_0x4c9a('0x11')]('UpdateCmHopperBlack',_0x172dfa[_0x4c9a('0x13')],_0x90e24c);_0x33b033(_0x3129d5[_0x4c9a('0x11')](0x1f4,_0x172dfa['message']));});});};exports[_0x4c9a('0x24')]=function(_0x2f467f){var _0x3bd4c2=this;return new Promise(function(_0x5baae4,_0x255d86){return db[_0x4c9a('0x20')][_0x4c9a('0x25')]({'where':_0x2f467f[_0x4c9a('0x18')]?_0x2f467f[_0x4c9a('0x18')][_0x4c9a('0x23')]||null:null})[_0x4c9a('0xc')](function(_0xe5675a){logger['info'](_0x4c9a('0x24'),_0x2f467f);logger[_0x4c9a('0xf')]('DestroyCmHopperBlack',_0x2f467f,JSON['stringify'](_0xe5675a));_0x5baae4(_0xe5675a);})[_0x4c9a('0x16')](function(_0x49d555){logger[_0x4c9a('0x11')](_0x4c9a('0x24'),_0x49d555['message'],_0x2f467f);_0x255d86(_0x3bd4c2['error'](0x1f4,_0x49d555[_0x4c9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c948199..26337db 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','put','update','delete','exports','multer','path'];(function(_0x2d719c,_0x59b346){var _0x16c7e8=function(_0x2cd5a8){while(--_0x2cd5a8){_0x2d719c['push'](_0x2d719c['shift']());}};_0x16c7e8(++_0x59b346);}(_0x3e74,0x175));var _0x43e7=function(_0x10cfb5,_0x44df3b){_0x10cfb5=_0x10cfb5-0x0;var _0x2a4cff=_0x3e74[_0x10cfb5];return _0x2a4cff;};'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('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router[_0x43e7('0xd')]('/:id',auth[_0x43e7('0x7')](),controller['destroy']);module[_0x43e7('0xe')]=router; \ No newline at end of file +var _0xe5b3=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','update','delete'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5f3446,_0x41bdb8){_0x5f3446=_0x5f3446-0x0;var _0x575c3f=_0xe5b3[_0x5f3446];return _0x575c3f;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xe')]);router[_0x3e5b('0xf')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 646d81e..82b1ec7 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 _0x191b=['moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize'];(function(_0x2d7acc,_0x3e5591){var _0x57a002=function(_0x20335a){while(--_0x20335a){_0x2d7acc['push'](_0x2d7acc['shift']());}};_0x57a002(++_0x3e5591);}(_0x191b,0x14f));var _0xb191=function(_0x578e51,_0x25725a){_0x578e51=_0x578e51-0x0;var _0x264be=_0x191b[_0x578e51];return _0x264be;};'use strict';var Sequelize=require(_0xb191('0x0'));var moment=require(_0xb191('0x1'));module['exports']={'state':{'type':Sequelize[_0xb191('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb191('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb191('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb191('0x4')]},'responsetime':{'type':Sequelize[_0xb191('0x4')]},'answertime':{'type':Sequelize[_0xb191('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb191('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb191('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb191('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb191('0x4')],'set':function(_0x51fc15){var _0x16ff4b=this[_0xb191('0x5')](_0xb191('0x6'));if(_0x16ff4b&&_0x51fc15){this[_0xb191('0x7')](_0xb191('0x8'),moment(_0x51fc15)[_0xb191('0x9')](moment(_0x16ff4b),_0xb191('0xa')));}return this[_0xb191('0x7')]('dispositionat',_0x51fc15);}},'amd':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb191('0x4')]},'callback':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb191('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb191('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb191('0x4')]},'recallme':{'type':Sequelize[_0xb191('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb191('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb191('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeaf4=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','seconds','setDataValue'];(function(_0x23e7bc,_0x3d0933){var _0x440a87=function(_0x1c40da){while(--_0x1c40da){_0x23e7bc['push'](_0x23e7bc['shift']());}};_0x440a87(++_0x3d0933);}(_0xeaf4,0xe8));var _0x4eaf=function(_0xd816c2,_0x4edc8e){_0xd816c2=_0xd816c2-0x0;var _0x50490a=_0xeaf4[_0xd816c2];return _0x50490a;};'use strict';var Sequelize=require(_0x4eaf('0x0'));var moment=require(_0x4eaf('0x1'));module[_0x4eaf('0x2')]={'state':{'type':Sequelize[_0x4eaf('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x4eaf('0x4')]},'scheduledat':{'type':Sequelize[_0x4eaf('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4eaf('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x4eaf('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4eaf('0x4')]},'starttime':{'type':Sequelize[_0x4eaf('0x5')]},'responsetime':{'type':Sequelize[_0x4eaf('0x5')]},'answertime':{'type':Sequelize[_0x4eaf('0x5')]},'droptime':{'type':Sequelize[_0x4eaf('0x5')]},'endtime':{'type':Sequelize[_0x4eaf('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4eaf('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4eaf('0x4')]},'membername':{'type':Sequelize[_0x4eaf('0x4')]},'reason':{'type':Sequelize[_0x4eaf('0x4')]},'disposition':{'type':Sequelize[_0x4eaf('0x4')]},'dispositionat':{'type':Sequelize[_0x4eaf('0x5')],'set':function(_0x2fa20b){var _0x5ab99b=this[_0x4eaf('0x6')](_0x4eaf('0x7'));if(_0x5ab99b&&_0x2fa20b){this['setDataValue']('followuptime',moment(_0x2fa20b)['diff'](moment(_0x5ab99b),_0x4eaf('0x8')));}return this[_0x4eaf('0x9')]('dispositionat',_0x2fa20b);}},'amd':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4eaf('0x5')]},'callback':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4eaf('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4eaf('0x5')]},'deleted':{'type':Sequelize[_0x4eaf('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4eaf('0x5')]},'recallme':{'type':Sequelize[_0x4eaf('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4eaf('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4eaf('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 10a06c1..24942eb 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 _0xb44a=['rows','params','keys','find','describe','catch','update','uniqueid','body','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','from','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','cm_hopper_final','state\x20=\x204','group','Campaign','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','CmHopper','findOne','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb44a,0x1c2));var _0xab44=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0xb44a[_0x136e17];return _0x5099c9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xab44('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab44('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab44('0x2'));var Mustache=require('mustache');var util=require(_0xab44('0x3'));var path=require(_0xab44('0x4'));var sox=require(_0xab44('0x5'));var csv=require(_0xab44('0x6'));var ejs=require(_0xab44('0x7'));var fs=require('fs');var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x6'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var db=require(_0xab44('0x14'))['db'];function respondWithStatusCode(_0x2208fb,_0x237c26){_0x237c26=_0x237c26||0xcc;return function(_0x52d282){if(_0x52d282){return _0x2208fb['sendStatus'](_0x237c26);}return _0x2208fb[_0xab44('0x15')](_0x237c26)['end']();};}function respondWithResult(_0x15db10,_0x5ae369){_0x5ae369=_0x5ae369||0xc8;return function(_0x25f611){if(_0x25f611){return _0x15db10[_0xab44('0x15')](_0x5ae369)[_0xab44('0x16')](_0x25f611);}};}function respondWithFilteredResult(_0x384f02,_0x31404d){return function(_0x41701b){if(_0x41701b){var _0x4875df=_0x41701b[_0xab44('0x17')],_0x51251b=_0x31404d[_0xab44('0x18')],_0x44c85e=_0x31404d[_0xab44('0x18')]+_0x31404d[_0xab44('0x19')],_0x272a5b;if(_0x44c85e>=_0x4875df){_0x44c85e=_0x4875df;_0x272a5b=0xc8;}else{_0x272a5b=0xce;}_0x384f02[_0xab44('0x15')](_0x272a5b);return _0x384f02[_0xab44('0x1a')](_0xab44('0x1b'),_0x51251b+'-'+_0x44c85e+'/'+_0x4875df)[_0xab44('0x16')](_0x41701b);}return null;};}function patchUpdates(_0x27fc7f){return function(_0x5cc897){try{jsonpatch[_0xab44('0x1c')](_0x5cc897,_0x27fc7f,!![]);}catch(_0x401379){return BPromise[_0xab44('0x1d')](_0x401379);}return _0x5cc897[_0xab44('0x1e')]();};}function saveUpdates(_0x29bb73,_0x5123b1){return function(_0xcd426){if(_0xcd426){return _0xcd426['update'](_0x29bb73)[_0xab44('0x1f')](function(_0x2917bf){return _0x2917bf;});}return null;};}function removeEntity(_0x193b66,_0x355083){return function(_0x486317){if(_0x486317){return _0x486317[_0xab44('0x20')]()[_0xab44('0x1f')](function(){_0x193b66[_0xab44('0x15')](0xcc)[_0xab44('0x21')]();});}};}function handleEntityNotFound(_0x11f0b,_0x402950){return function(_0x43f1c6){if(!_0x43f1c6){_0x11f0b['sendStatus'](0x194);}return _0x43f1c6;};}function handleError(_0x595761,_0x1d4a2f){_0x1d4a2f=_0x1d4a2f||0x1f4;return function(_0x572e0b){logger[_0xab44('0x22')](_0x572e0b['stack']);if(_0x572e0b[_0xab44('0x23')]){delete _0x572e0b['name'];}_0x595761['status'](_0x1d4a2f)[_0xab44('0x24')](_0x572e0b);};}exports[_0xab44('0x25')]=function(_0x259192,_0x4620ed){var _0x132bf6={},_0x4e820c={},_0x2f86ac={'count':0x0,'rows':[]};var _0x5587fe=_['map'](db[_0xab44('0x26')][_0xab44('0x27')],function(_0x21131e){return{'name':_0x21131e[_0xab44('0x28')],'type':_0x21131e[_0xab44('0x29')][_0xab44('0x2a')]};});_0x4e820c['model']=_[_0xab44('0x2b')](_0x5587fe,_0xab44('0x23'));_0x4e820c[_0xab44('0x2c')]=_['keys'](_0x259192['query']);_0x4e820c[_0xab44('0x2d')]=_['intersection'](_0x4e820c['model'],_0x4e820c[_0xab44('0x2c')]);_0x132bf6[_0xab44('0x2e')]=_[_0xab44('0x2f')](_0x4e820c[_0xab44('0x30')],qs[_0xab44('0x31')](_0x259192[_0xab44('0x2c')][_0xab44('0x31')]));_0x132bf6[_0xab44('0x2e')]=_0x132bf6[_0xab44('0x2e')][_0xab44('0x32')]?_0x132bf6[_0xab44('0x2e')]:_0x4e820c[_0xab44('0x30')];if(!_0x259192[_0xab44('0x2c')][_0xab44('0x33')]('nolimit')){_0x132bf6['limit']=qs[_0xab44('0x19')](_0x259192[_0xab44('0x2c')]['limit']);_0x132bf6[_0xab44('0x18')]=qs[_0xab44('0x18')](_0x259192[_0xab44('0x2c')][_0xab44('0x18')]);}_0x132bf6[_0xab44('0x34')]=qs[_0xab44('0x35')](_0x259192[_0xab44('0x2c')][_0xab44('0x35')]);_0x132bf6[_0xab44('0x36')]=qs[_0xab44('0x2d')](_[_0xab44('0x37')](_0x259192[_0xab44('0x2c')],_0x4e820c[_0xab44('0x2d')]),_0x5587fe);if(_0x259192[_0xab44('0x2c')][_0xab44('0x38')]){_0x132bf6[_0xab44('0x36')]=_[_0xab44('0x39')](_0x132bf6[_0xab44('0x36')],{'$or':_['map'](_0x5587fe,function(_0x643dec){if(_0x643dec[_0xab44('0x29')]!==_0xab44('0x3a')){var _0x21a1ed={};_0x21a1ed[_0x643dec['name']]={'$like':'%'+_0x259192[_0xab44('0x2c')][_0xab44('0x38')]+'%'};return _0x21a1ed;}})});}_0x132bf6=_[_0xab44('0x39')]({},_0x132bf6,_0x259192[_0xab44('0x3b')]);var _0x411d6c={'where':_0x132bf6['where']};return db[_0xab44('0x26')][_0xab44('0x17')](_0x411d6c)[_0xab44('0x1f')](function(_0x5b4f4d){_0x2f86ac[_0xab44('0x17')]=_0x5b4f4d;if(_0x259192[_0xab44('0x2c')][_0xab44('0x3c')]){_0x132bf6[_0xab44('0x3d')]=[{'all':!![]}];}return db[_0xab44('0x26')]['findAll'](_0x132bf6);})[_0xab44('0x1f')](function(_0x4aaee9){_0x2f86ac[_0xab44('0x3e')]=_0x4aaee9;return _0x2f86ac;})['then'](respondWithFilteredResult(_0x4620ed,_0x132bf6))['catch'](handleError(_0x4620ed,null));};exports['show']=function(_0x540102,_0x52e3de){var _0x120585={'raw':!![],'where':{'id':_0x540102[_0xab44('0x3f')]['id']}},_0x6131f2={};_0x6131f2[_0xab44('0x30')]=_[_0xab44('0x40')](db[_0xab44('0x26')][_0xab44('0x27')]);_0x6131f2[_0xab44('0x2c')]=_[_0xab44('0x40')](_0x540102[_0xab44('0x2c')]);_0x6131f2['filters']=_[_0xab44('0x2f')](_0x6131f2[_0xab44('0x30')],_0x6131f2[_0xab44('0x2c')]);_0x120585[_0xab44('0x2e')]=_['intersection'](_0x6131f2[_0xab44('0x30')],qs[_0xab44('0x31')](_0x540102[_0xab44('0x2c')][_0xab44('0x31')]));_0x120585[_0xab44('0x2e')]=_0x120585[_0xab44('0x2e')]['length']?_0x120585['attributes']:_0x6131f2[_0xab44('0x30')];if(_0x540102[_0xab44('0x2c')][_0xab44('0x3c')]){_0x120585[_0xab44('0x3d')]=[{'all':!![]}];}_0x120585=_[_0xab44('0x39')]({},_0x120585,_0x540102['options']);return db[_0xab44('0x26')][_0xab44('0x41')](_0x120585)[_0xab44('0x1f')](handleEntityNotFound(_0x52e3de,null))[_0xab44('0x1f')](respondWithResult(_0x52e3de,null))['catch'](handleError(_0x52e3de,null));};exports[_0xab44('0x42')]=function(_0x1ab92d,_0x3e2ba1){return db['CmHopperFinal'][_0xab44('0x42')]()[_0xab44('0x1f')](respondWithResult(_0x3e2ba1,null))[_0xab44('0x43')](handleError(_0x3e2ba1,null));};exports[_0xab44('0x44')]=function(_0x4eeb65,_0x13892d){if(_0x4eeb65['body'][_0xab44('0x45')]){delete _0x4eeb65[_0xab44('0x46')][_0xab44('0x45')];}return db[_0xab44('0x26')]['find']({'where':{'uniqueid':_0x4eeb65[_0xab44('0x3f')]['id']}})['then'](handleEntityNotFound(_0x13892d,null))[_0xab44('0x1f')](saveUpdates(_0x4eeb65[_0xab44('0x46')],null))[_0xab44('0x1f')](respondWithResult(_0x13892d,null))[_0xab44('0x43')](handleError(_0x13892d,null));};exports[_0xab44('0x47')]=function(_0x4eeef0,_0x4736fd,_0x53ef06){return db[_0xab44('0x26')][_0xab44('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x4eeef0[_0xab44('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x4c')))),'noSuchContacts'],[db['sequelize']['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')]['literal'](_0xab44('0x4d')))),_0xab44('0x4e')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0xab44('0x4b')](_0xab44('0x4f')))),_0xab44('0x50')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x51')))),_0xab44('0x52')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db['sequelize']['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x53')))),_0xab44('0x54')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xab44('0x55')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x56')))),_0xab44('0x57')]]})['then'](handleEntityNotFound(_0x4736fd,null))['then'](respondWithResult(_0x4736fd,null))['catch'](handleError(_0x4736fd,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3d1f88,_0xd21513,_0x1ee863){return db[_0xab44('0x26')][_0xab44('0x48')]({'raw':![],'where':{'CampaignId':_0x3d1f88['params']['id']},'attributes':[[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x4c')))),_0xab44('0x58')],[db[_0xab44('0x4a')]['fn']('COUNT',db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x4d')))),'noAnswerContacts'],[db[_0xab44('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xab44('0x4a')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xab44('0x50')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')]['literal'](_0xab44('0x59')))),_0xab44('0x5a')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db['sequelize']['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x53')))),_0xab44('0x54')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x5b')))),_0xab44('0x55')],[db[_0xab44('0x4a')]['fn'](_0xab44('0x49'),db[_0xab44('0x4a')]['fn']('IF',db[_0xab44('0x4a')][_0xab44('0x4b')](_0xab44('0x56')))),_0xab44('0x57')]]})[_0xab44('0x1f')](handleEntityNotFound(_0xd21513,null))[_0xab44('0x1f')](respondWithResult(_0xd21513,null))[_0xab44('0x43')](handleError(_0xd21513,null));};exports[_0xab44('0x5c')]=function(_0x11a5cd,_0x24055f,_0x315b00){return db[_0xab44('0x5d')][_0xab44('0x41')]({'where':{'id':_0x11a5cd['params']['id']}})[_0xab44('0x1f')](handleEntityNotFound(_0x24055f,null))['then'](function(_0x15c6a1){var _0xc56597;if(_0x15c6a1){_0xc56597=squel[_0xab44('0x5e')]()[_0xab44('0x5f')](_0xab44('0x60'))[_0xab44('0x61')]([_0xab44('0x62'),_0xab44('0x63'),_0xab44('0x64'),_0xab44('0x65'),_0xab44('0x66'),'createdAt',_0xab44('0x67')],squel[_0xab44('0x68')]()['field'](_0xab44('0x69'),'phone')[_0xab44('0x6a')](_0xab44('0x6b'),_0xab44('0x63'))[_0xab44('0x6a')](_0xab44('0x6c'),_0xab44('0x64'))[_0xab44('0x6a')]('ANY_VALUE(ListId)',_0xab44('0x65'))['field'](_0xab44('0x6d'),'VoiceQueueId')[_0xab44('0x6a')](_0xab44('0x6b'),_0xab44('0x6e'))[_0xab44('0x6a')](_0xab44('0x6b'),_0xab44('0x67'))[_0xab44('0x6f')]('cm_hopper_final')[_0xab44('0x36')]('VoiceQueueId\x20=\x20?',_0x11a5cd[_0xab44('0x3f')]['id']['toString']())[_0xab44('0x36')](_0xab44('0x70'),_0x11a5cd[_0xab44('0x46')][_0xab44('0x71')][_0xab44('0x72')]())['where'](_0xab44('0x73'))[_0xab44('0x36')](_0xab44('0x74'),squel['select']()[_0xab44('0x6a')]('phone')[_0xab44('0x6f')](_0xab44('0x60'))[_0xab44('0x36')](_0xab44('0x75'),_0x11a5cd[_0xab44('0x3f')]['id'][_0xab44('0x72')]()))[_0xab44('0x36')](_0xab44('0x74'),squel[_0xab44('0x68')]()[_0xab44('0x6a')](_0xab44('0x76'))[_0xab44('0x6f')](_0xab44('0x77'))['where']('VoiceQueueId\x20=\x20?',_0x11a5cd[_0xab44('0x3f')]['id'][_0xab44('0x72')]())['where'](_0xab44('0x78')))[_0xab44('0x79')](_0xab44('0x64')))[_0xab44('0x72')]();return db[_0xab44('0x4a')]['query'](_0xc56597);}return[];})[_0xab44('0x1f')](respondWithResult(_0x24055f,null))[_0xab44('0x43')](handleError(_0x24055f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x48238c,_0x48b6d4,_0x560499){return db[_0xab44('0x7a')][_0xab44('0x41')]({'where':{'id':_0x48238c[_0xab44('0x3f')]['id']}})[_0xab44('0x1f')](handleEntityNotFound(_0x48b6d4,null))[_0xab44('0x1f')](function(_0x4338dd){var _0x4fc173;if(_0x4338dd){_0x4fc173=squel[_0xab44('0x5e')]()[_0xab44('0x5f')]('cm_hopper')['fromQuery']([_0xab44('0x62'),_0xab44('0x63'),'ContactId',_0xab44('0x65'),_0xab44('0x7b'),_0xab44('0x6e'),'updatedAt'],squel[_0xab44('0x68')]()[_0xab44('0x6a')](_0xab44('0x69'),_0xab44('0x62'))[_0xab44('0x6a')](_0xab44('0x6b'),_0xab44('0x63'))['field']('ANY_VALUE(ContactId)',_0xab44('0x64'))[_0xab44('0x6a')](_0xab44('0x7c'),_0xab44('0x65'))[_0xab44('0x6a')]('ANY_VALUE(CampaignId)',_0xab44('0x7b'))[_0xab44('0x6a')]('NOW()','createdAt')[_0xab44('0x6a')](_0xab44('0x6b'),_0xab44('0x67'))[_0xab44('0x6f')](_0xab44('0x77'))['where'](_0xab44('0x7d'),_0x48238c[_0xab44('0x3f')]['id'][_0xab44('0x72')]())[_0xab44('0x36')](_0xab44('0x70'),_0x48238c['body'][_0xab44('0x71')][_0xab44('0x72')]())['where'](_0xab44('0x73'))[_0xab44('0x36')](_0xab44('0x74'),squel['select']()[_0xab44('0x6a')](_0xab44('0x62'))[_0xab44('0x6f')](_0xab44('0x60'))[_0xab44('0x36')](_0xab44('0x7d'),_0x48238c[_0xab44('0x3f')]['id']['toString']()))[_0xab44('0x36')](_0xab44('0x74'),squel['select']()[_0xab44('0x6a')](_0xab44('0x76'))[_0xab44('0x6f')](_0xab44('0x77'))[_0xab44('0x36')](_0xab44('0x7d'),_0x48238c[_0xab44('0x3f')]['id'][_0xab44('0x72')]())[_0xab44('0x36')](_0xab44('0x78')))[_0xab44('0x79')](_0xab44('0x64')))[_0xab44('0x72')]();return db['sequelize'][_0xab44('0x2c')](_0x4fc173);}return[];})['then'](respondWithResult(_0x48b6d4,null))[_0xab44('0x43')](handleError(_0x48b6d4,null));};exports['checkContactHopper']=function(_0x3d6be6,_0x361dac,_0x3b8813){return db[_0xab44('0x7e')][_0xab44('0x7f')]({'where':{'VoiceQueueId':_0x3d6be6[_0xab44('0x46')][_0xab44('0x66')],'CampaignId':_0x3d6be6[_0xab44('0x46')]['CampaignId'],'ContactId':_0x3d6be6['body']['ContactId']}})['then'](handleEntityNotFound(_0x361dac,null))[_0xab44('0x1f')](function(_0x27341d){if(_0x27341d){return _0x27341d;}return null;})[_0xab44('0x1f')](respondWithResult(_0x361dac,null))['catch'](handleError(_0x361dac,null));}; \ No newline at end of file +var _0x7a2f=['select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum','Campaign','insert','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','save','update','then','sendStatus','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','catch','show','params','includeAll','options','find','describe','body','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt'];(function(_0x510ec3,_0x28cae4){var _0x11df25=function(_0x486099){while(--_0x486099){_0x510ec3['push'](_0x510ec3['shift']());}};_0x11df25(++_0x28cae4);}(_0x7a2f,0x99));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xf7a2('0x0'));var emlformat=require(_0xf7a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf7a2('0x2'));var jsonpatch=require(_0xf7a2('0x3'));var rp=require(_0xf7a2('0x4'));var moment=require('moment');var BPromise=require(_0xf7a2('0x5'));var Mustache=require(_0xf7a2('0x6'));var util=require(_0xf7a2('0x7'));var path=require(_0xf7a2('0x8'));var sox=require(_0xf7a2('0x9'));var csv=require(_0xf7a2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf7a2('0xb'));var squel=require(_0xf7a2('0xc'));var crypto=require(_0xf7a2('0xd'));var jsforce=require(_0xf7a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf7a2('0xa'));var querystring=require(_0xf7a2('0xf'));var Papa=require(_0xf7a2('0x10'));var Redis=require(_0xf7a2('0x11'));var authService=require(_0xf7a2('0x12'));var qs=require(_0xf7a2('0x13'));var as=require(_0xf7a2('0x14'));var hardwareService=require(_0xf7a2('0x15'));var logger=require('../../config/logger')(_0xf7a2('0x16'));var utils=require(_0xf7a2('0x17'));var config=require(_0xf7a2('0x18'));var db=require(_0xf7a2('0x19'))['db'];function respondWithStatusCode(_0x18c35c,_0x4f960f){_0x4f960f=_0x4f960f||0xcc;return function(_0x4bf293){if(_0x4bf293){return _0x18c35c['sendStatus'](_0x4f960f);}return _0x18c35c[_0xf7a2('0x1a')](_0x4f960f)[_0xf7a2('0x1b')]();};}function respondWithResult(_0x4227b1,_0x35a006){_0x35a006=_0x35a006||0xc8;return function(_0x3b46f1){if(_0x3b46f1){return _0x4227b1[_0xf7a2('0x1a')](_0x35a006)[_0xf7a2('0x1c')](_0x3b46f1);}};}function respondWithFilteredResult(_0x4e66ea,_0x4eedb3){return function(_0x53c32e){if(_0x53c32e){var _0x16b0dc=_0x53c32e[_0xf7a2('0x1d')],_0x5ef0aa=_0x4eedb3[_0xf7a2('0x1e')],_0x51999f=_0x4eedb3[_0xf7a2('0x1e')]+_0x4eedb3[_0xf7a2('0x1f')],_0x29d384;if(_0x51999f>=_0x16b0dc){_0x51999f=_0x16b0dc;_0x29d384=0xc8;}else{_0x29d384=0xce;}_0x4e66ea['status'](_0x29d384);return _0x4e66ea['set']('Content-Range',_0x5ef0aa+'-'+_0x51999f+'/'+_0x16b0dc)[_0xf7a2('0x1c')](_0x53c32e);}return null;};}function patchUpdates(_0xfbd717){return function(_0x2ccf84){try{jsonpatch[_0xf7a2('0x20')](_0x2ccf84,_0xfbd717,!![]);}catch(_0x3f5e77){return BPromise['reject'](_0x3f5e77);}return _0x2ccf84[_0xf7a2('0x21')]();};}function saveUpdates(_0x52a43e,_0x1f2b26){return function(_0x3a0334){if(_0x3a0334){return _0x3a0334[_0xf7a2('0x22')](_0x52a43e)[_0xf7a2('0x23')](function(_0x23fa4f){return _0x23fa4f;});}return null;};}function removeEntity(_0x163210,_0x39c941){return function(_0x5265e0){if(_0x5265e0){return _0x5265e0['destroy']()[_0xf7a2('0x23')](function(){_0x163210[_0xf7a2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31349c,_0x2bbffd){return function(_0x3592ba){if(!_0x3592ba){_0x31349c[_0xf7a2('0x24')](0x194);}return _0x3592ba;};}function handleError(_0x478111,_0x510add){_0x510add=_0x510add||0x1f4;return function(_0x2d7998){logger['error'](_0x2d7998[_0xf7a2('0x25')]);if(_0x2d7998[_0xf7a2('0x26')]){delete _0x2d7998[_0xf7a2('0x26')];}_0x478111['status'](_0x510add)[_0xf7a2('0x27')](_0x2d7998);};}exports['index']=function(_0x8846a3,_0x496f46){var _0x1f1a79={},_0x20b702={},_0x2a9c48={'count':0x0,'rows':[]};var _0x41d80b=_[_0xf7a2('0x28')](db[_0xf7a2('0x29')][_0xf7a2('0x2a')],function(_0x5d64d1){return{'name':_0x5d64d1[_0xf7a2('0x2b')],'type':_0x5d64d1[_0xf7a2('0x2c')]['key']};});_0x20b702['model']=_['map'](_0x41d80b,_0xf7a2('0x26'));_0x20b702[_0xf7a2('0x2d')]=_[_0xf7a2('0x2e')](_0x8846a3[_0xf7a2('0x2d')]);_0x20b702[_0xf7a2('0x2f')]=_['intersection'](_0x20b702[_0xf7a2('0x30')],_0x20b702[_0xf7a2('0x2d')]);_0x1f1a79['attributes']=_['intersection'](_0x20b702[_0xf7a2('0x30')],qs[_0xf7a2('0x31')](_0x8846a3[_0xf7a2('0x2d')]['fields']));_0x1f1a79[_0xf7a2('0x32')]=_0x1f1a79[_0xf7a2('0x32')][_0xf7a2('0x33')]?_0x1f1a79[_0xf7a2('0x32')]:_0x20b702[_0xf7a2('0x30')];if(!_0x8846a3[_0xf7a2('0x2d')][_0xf7a2('0x34')](_0xf7a2('0x35'))){_0x1f1a79[_0xf7a2('0x1f')]=qs[_0xf7a2('0x1f')](_0x8846a3[_0xf7a2('0x2d')][_0xf7a2('0x1f')]);_0x1f1a79[_0xf7a2('0x1e')]=qs[_0xf7a2('0x1e')](_0x8846a3[_0xf7a2('0x2d')][_0xf7a2('0x1e')]);}_0x1f1a79[_0xf7a2('0x36')]=qs['sort'](_0x8846a3['query'][_0xf7a2('0x37')]);_0x1f1a79[_0xf7a2('0x38')]=qs[_0xf7a2('0x2f')](_[_0xf7a2('0x39')](_0x8846a3['query'],_0x20b702[_0xf7a2('0x2f')]),_0x41d80b);if(_0x8846a3[_0xf7a2('0x2d')][_0xf7a2('0x3a')]){_0x1f1a79['where']=_[_0xf7a2('0x3b')](_0x1f1a79[_0xf7a2('0x38')],{'$or':_['map'](_0x41d80b,function(_0x5184da){if(_0x5184da[_0xf7a2('0x2c')]!=='VIRTUAL'){var _0x14013f={};_0x14013f[_0x5184da[_0xf7a2('0x26')]]={'$like':'%'+_0x8846a3['query']['filter']+'%'};return _0x14013f;}})});}_0x1f1a79=_[_0xf7a2('0x3b')]({},_0x1f1a79,_0x8846a3['options']);var _0x36d996={'where':_0x1f1a79[_0xf7a2('0x38')]};return db[_0xf7a2('0x29')]['count'](_0x36d996)['then'](function(_0x154e97){_0x2a9c48[_0xf7a2('0x1d')]=_0x154e97;if(_0x8846a3[_0xf7a2('0x2d')]['includeAll']){_0x1f1a79[_0xf7a2('0x3c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x1f1a79);})['then'](function(_0x2c86f8){_0x2a9c48['rows']=_0x2c86f8;return _0x2a9c48;})[_0xf7a2('0x23')](respondWithFilteredResult(_0x496f46,_0x1f1a79))[_0xf7a2('0x3d')](handleError(_0x496f46,null));};exports[_0xf7a2('0x3e')]=function(_0xe3dea3,_0x10a4a4){var _0xca3996={'raw':!![],'where':{'id':_0xe3dea3[_0xf7a2('0x3f')]['id']}},_0x449843={};_0x449843[_0xf7a2('0x30')]=_['keys'](db['CmHopperFinal'][_0xf7a2('0x2a')]);_0x449843[_0xf7a2('0x2d')]=_[_0xf7a2('0x2e')](_0xe3dea3[_0xf7a2('0x2d')]);_0x449843['filters']=_['intersection'](_0x449843['model'],_0x449843['query']);_0xca3996['attributes']=_['intersection'](_0x449843[_0xf7a2('0x30')],qs[_0xf7a2('0x31')](_0xe3dea3[_0xf7a2('0x2d')][_0xf7a2('0x31')]));_0xca3996[_0xf7a2('0x32')]=_0xca3996['attributes'][_0xf7a2('0x33')]?_0xca3996['attributes']:_0x449843[_0xf7a2('0x30')];if(_0xe3dea3[_0xf7a2('0x2d')][_0xf7a2('0x40')]){_0xca3996[_0xf7a2('0x3c')]=[{'all':!![]}];}_0xca3996=_['merge']({},_0xca3996,_0xe3dea3[_0xf7a2('0x41')]);return db[_0xf7a2('0x29')][_0xf7a2('0x42')](_0xca3996)[_0xf7a2('0x23')](handleEntityNotFound(_0x10a4a4,null))[_0xf7a2('0x23')](respondWithResult(_0x10a4a4,null))[_0xf7a2('0x3d')](handleError(_0x10a4a4,null));};exports[_0xf7a2('0x43')]=function(_0x2174e2,_0x9cd394){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x9cd394,null))[_0xf7a2('0x3d')](handleError(_0x9cd394,null));};exports[_0xf7a2('0x22')]=function(_0x1b8ce0,_0x2e4dac){if(_0x1b8ce0[_0xf7a2('0x44')]['uniqueid']){delete _0x1b8ce0[_0xf7a2('0x44')]['uniqueid'];}return db[_0xf7a2('0x29')][_0xf7a2('0x42')]({'where':{'uniqueid':_0x1b8ce0[_0xf7a2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e4dac,null))['then'](saveUpdates(_0x1b8ce0[_0xf7a2('0x44')],null))[_0xf7a2('0x23')](respondWithResult(_0x2e4dac,null))[_0xf7a2('0x3d')](handleError(_0x2e4dac,null));};exports[_0xf7a2('0x45')]=function(_0x405547,_0x1fabc1,_0x2c30d6){return db[_0xf7a2('0x29')][_0xf7a2('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x405547[_0xf7a2('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0xf7a2('0x47'),db['sequelize']['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x4a')))),_0xf7a2('0x4b')],[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xf7a2('0x49')](_0xf7a2('0x4c')))),_0xf7a2('0x4d')],[db[_0xf7a2('0x48')]['fn']('COUNT',db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0xf7a2('0x4e')],[db['sequelize']['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x4f')))),_0xf7a2('0x50')],[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xf7a2('0x51')],[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x52')))),_0xf7a2('0x53')],[db[_0xf7a2('0x48')]['fn']('COUNT',db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x54')))),'reCallContacts'],[db['sequelize']['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x55')))),'answeringMachine']]})[_0xf7a2('0x23')](handleEntityNotFound(_0x1fabc1,null))['then'](respondWithResult(_0x1fabc1,null))[_0xf7a2('0x3d')](handleError(_0x1fabc1,null));};exports[_0xf7a2('0x56')]=function(_0x2dd4d3,_0x15b7c1,_0x226c65){return db[_0xf7a2('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0x2dd4d3[_0xf7a2('0x3f')]['id']},'attributes':[[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x4a')))),'noSuchContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xf7a2('0x4d')],[db[_0xf7a2('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x57')))),'busyContacts'],[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db[_0xf7a2('0x48')]['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xf7a2('0x50')],[db['sequelize']['fn'](_0xf7a2('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xf7a2('0x49')](_0xf7a2('0x58')))),_0xf7a2('0x51')],[db['sequelize']['fn'](_0xf7a2('0x47'),db['sequelize']['fn']('IF',db[_0xf7a2('0x48')][_0xf7a2('0x49')](_0xf7a2('0x52')))),_0xf7a2('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf7a2('0x49')](_0xf7a2('0x54')))),_0xf7a2('0x59')],[db[_0xf7a2('0x48')]['fn'](_0xf7a2('0x47'),db['sequelize']['fn']('IF',db[_0xf7a2('0x48')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xf7a2('0x5a')]]})['then'](handleEntityNotFound(_0x15b7c1,null))[_0xf7a2('0x23')](respondWithResult(_0x15b7c1,null))[_0xf7a2('0x3d')](handleError(_0x15b7c1,null));};exports[_0xf7a2('0x5b')]=function(_0x16b654,_0x370d31,_0x56c2b7){return db[_0xf7a2('0x5c')]['find']({'where':{'id':_0x16b654['params']['id']}})[_0xf7a2('0x23')](handleEntityNotFound(_0x370d31,null))[_0xf7a2('0x23')](function(_0x131f23){var _0x2b1214;if(_0x131f23){_0x2b1214=squel['insert']()['into'](_0xf7a2('0x5d'))[_0xf7a2('0x5e')]([_0xf7a2('0x5f'),_0xf7a2('0x60'),'ContactId',_0xf7a2('0x61'),_0xf7a2('0x62'),_0xf7a2('0x63'),_0xf7a2('0x64')],squel[_0xf7a2('0x65')]()[_0xf7a2('0x66')](_0xf7a2('0x67'),_0xf7a2('0x5f'))['field'](_0xf7a2('0x68'),_0xf7a2('0x60'))[_0xf7a2('0x66')](_0xf7a2('0x69'),_0xf7a2('0x6a'))[_0xf7a2('0x66')](_0xf7a2('0x6b'),_0xf7a2('0x61'))[_0xf7a2('0x66')](_0xf7a2('0x6c'),_0xf7a2('0x62'))['field'](_0xf7a2('0x68'),_0xf7a2('0x63'))[_0xf7a2('0x66')](_0xf7a2('0x68'),_0xf7a2('0x64'))[_0xf7a2('0x6d')](_0xf7a2('0x6e'))['where'](_0xf7a2('0x6f'),_0x16b654[_0xf7a2('0x3f')]['id'][_0xf7a2('0x70')]())[_0xf7a2('0x38')](_0xf7a2('0x71'),_0x16b654[_0xf7a2('0x44')][_0xf7a2('0x72')][_0xf7a2('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0xf7a2('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xf7a2('0x5f'))[_0xf7a2('0x6d')](_0xf7a2('0x5d'))['where'](_0xf7a2('0x6f'),_0x16b654[_0xf7a2('0x3f')]['id'][_0xf7a2('0x70')]()))[_0xf7a2('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xf7a2('0x73'))['from']('cm_hopper_final')[_0xf7a2('0x38')](_0xf7a2('0x6f'),_0x16b654[_0xf7a2('0x3f')]['id'][_0xf7a2('0x70')]())[_0xf7a2('0x38')]('state\x20=\x204'))['group']('ContactId'))[_0xf7a2('0x70')]();return db[_0xf7a2('0x48')][_0xf7a2('0x2d')](_0x2b1214);}return[];})[_0xf7a2('0x23')](respondWithResult(_0x370d31,null))[_0xf7a2('0x3d')](handleError(_0x370d31,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x147d15,_0x2f319c,_0x2ac639){return db[_0xf7a2('0x74')]['find']({'where':{'id':_0x147d15[_0xf7a2('0x3f')]['id']}})[_0xf7a2('0x23')](handleEntityNotFound(_0x2f319c,null))['then'](function(_0x76dc24){var _0x2b0541;if(_0x76dc24){_0x2b0541=squel[_0xf7a2('0x75')]()[_0xf7a2('0x76')](_0xf7a2('0x5d'))[_0xf7a2('0x5e')]([_0xf7a2('0x5f'),_0xf7a2('0x60'),'ContactId',_0xf7a2('0x61'),_0xf7a2('0x77'),_0xf7a2('0x63'),'updatedAt'],squel[_0xf7a2('0x65')]()[_0xf7a2('0x66')](_0xf7a2('0x67'),_0xf7a2('0x5f'))[_0xf7a2('0x66')](_0xf7a2('0x68'),_0xf7a2('0x60'))[_0xf7a2('0x66')]('ANY_VALUE(ContactId)',_0xf7a2('0x6a'))[_0xf7a2('0x66')]('ANY_VALUE(ListId)',_0xf7a2('0x61'))['field'](_0xf7a2('0x78'),'CampaignId')[_0xf7a2('0x66')](_0xf7a2('0x68'),_0xf7a2('0x63'))[_0xf7a2('0x66')](_0xf7a2('0x68'),_0xf7a2('0x64'))['from'](_0xf7a2('0x6e'))[_0xf7a2('0x38')](_0xf7a2('0x79'),_0x147d15['params']['id']['toString']())['where'](_0xf7a2('0x71'),_0x147d15[_0xf7a2('0x44')][_0xf7a2('0x72')][_0xf7a2('0x70')]())['where'](_0xf7a2('0x7a'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xf7a2('0x66')]('phone')['from']('cm_hopper')[_0xf7a2('0x38')](_0xf7a2('0x79'),_0x147d15[_0xf7a2('0x3f')]['id'][_0xf7a2('0x70')]()))[_0xf7a2('0x38')](_0xf7a2('0x7b'),squel['select']()[_0xf7a2('0x66')]('calleridnum')['from'](_0xf7a2('0x6e'))[_0xf7a2('0x38')](_0xf7a2('0x79'),_0x147d15['params']['id']['toString']())[_0xf7a2('0x38')]('state\x20=\x204'))[_0xf7a2('0x7c')](_0xf7a2('0x6a')))['toString']();return db[_0xf7a2('0x48')]['query'](_0x2b0541);}return[];})['then'](respondWithResult(_0x2f319c,null))[_0xf7a2('0x3d')](handleError(_0x2f319c,null));};exports['checkContactHopper']=function(_0x7f7aee,_0x496320,_0x596b70){return db[_0xf7a2('0x7d')][_0xf7a2('0x7e')]({'where':{'VoiceQueueId':_0x7f7aee[_0xf7a2('0x44')]['VoiceQueueId'],'CampaignId':_0x7f7aee[_0xf7a2('0x44')][_0xf7a2('0x77')],'ContactId':_0x7f7aee[_0xf7a2('0x44')]['ContactId']}})[_0xf7a2('0x23')](handleEntityNotFound(_0x496320,null))[_0xf7a2('0x23')](function(_0x6099cd){if(_0x6099cd){return _0x6099cd;}return null;})[_0xf7a2('0x23')](respondWithResult(_0x496320,null))[_0xf7a2('0x3d')](handleError(_0x496320,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 1ecd78d..85f9b09 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 _0x5f10=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','bluebird'];(function(_0x54aa2a,_0x570528){var _0x4e0964=function(_0x16f26f){while(--_0x16f26f){_0x54aa2a['push'](_0x54aa2a['shift']());}};_0x4e0964(++_0x570528);}(_0x5f10,0xd5));var _0x05f1=function(_0x58428c,_0x435751){_0x58428c=_0x58428c-0x0;var _0x4bebd4=_0x5f10[_0x58428c];return _0x4bebd4;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x05f1('0x2'));var rp=require(_0x05f1('0x3'));var fs=require('fs');var path=require(_0x05f1('0x4'));var rimraf=require(_0x05f1('0x5'));var config=require(_0x05f1('0x6'));var attributes=require(_0x05f1('0x7'));module['exports']=function(_0x126662,_0x462faa){return _0x126662[_0x05f1('0x8')]('CmHopperFinal',attributes,{'tableName':_0x05f1('0x9'),'paranoid':![],'indexes':[{'name':_0x05f1('0xa'),'fields':[_0x05f1('0xa')]},{'name':_0x05f1('0xb'),'fields':[_0x05f1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55e0=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55e0,0xdc));var _0x055e=function(_0x1fab70,_0x7d8841){_0x1fab70=_0x1fab70-0x0;var _0x1ce2d2=_0x55e0[_0x1fab70];return _0x1ce2d2;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmHopperFinal',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[{'name':_0x055e('0xc'),'fields':[_0x055e('0xc')]},{'name':_0x055e('0xd'),'fields':[_0x055e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 19c6094..cafe0d8 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 _0x5f71=['request','then','info','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c387d,_0x45a0a4){var _0x4b68de=function(_0x20ab2b){while(--_0x20ab2b){_0x5c387d['push'](_0x5c387d['shift']());}};_0x4b68de(++_0x45a0a4);}(_0x5f71,0xf9));var _0x15f7=function(_0x3a2f99,_0x4a2109){_0x3a2f99=_0x3a2f99-0x0;var _0x48774f=_0x5f71[_0x3a2f99];return _0x48774f;};'use strict';var _=require(_0x15f7('0x0'));var util=require(_0x15f7('0x1'));var moment=require(_0x15f7('0x2'));var BPromise=require(_0x15f7('0x3'));var rs=require(_0x15f7('0x4'));var fs=require('fs');var Redis=require(_0x15f7('0x5'));var db=require(_0x15f7('0x6'))['db'];var utils=require(_0x15f7('0x7'));var logger=require('../../config/logger')(_0x15f7('0x8'));var config=require(_0x15f7('0x9'));var jayson=require(_0x15f7('0xa'));var client=jayson[_0x15f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29e694,_0x5dc0ec,_0x23a537){return new BPromise(function(_0xdfb5c4,_0x367b40){return client[_0x15f7('0xc')](_0x29e694,_0x23a537)[_0x15f7('0xd')](function(_0x1e0cb0){logger[_0x15f7('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x5dc0ec,'request\x20sent');logger[_0x15f7('0xf')](_0x15f7('0x10'),_0x5dc0ec,_0x15f7('0x11'),JSON[_0x15f7('0x12')](_0x1e0cb0));if(_0x1e0cb0['error']){if(_0x1e0cb0[_0x15f7('0x13')]['code']===0x1f4){logger[_0x15f7('0x13')](_0x15f7('0x14'),_0x5dc0ec,_0x1e0cb0['error'][_0x15f7('0x15')]);return _0x367b40(_0x1e0cb0['error']['message']);}logger[_0x15f7('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x5dc0ec,_0x1e0cb0[_0x15f7('0x13')][_0x15f7('0x15')]);return _0xdfb5c4(_0x1e0cb0['error'][_0x15f7('0x15')]);}else{logger[_0x15f7('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x5dc0ec,_0x15f7('0x11'));_0xdfb5c4(_0x1e0cb0[_0x15f7('0x16')][_0x15f7('0x15')]);}})[_0x15f7('0x17')](function(_0x9744d2){logger['error'](_0x15f7('0x14'),_0x5dc0ec,_0x9744d2);_0x367b40(_0x9744d2);});});}exports[_0x15f7('0x18')]=function(_0x3d7633){var _0x41efe3=this;return new Promise(function(_0xdf5dfd,_0x1a50bc){return db[_0x15f7('0x19')]['create'](_0x3d7633[_0x15f7('0x1a')],{'raw':_0x3d7633['options']?_0x3d7633[_0x15f7('0x1b')][_0x15f7('0x1c')]===undefined?!![]:![]:!![]})[_0x15f7('0xd')](function(_0x4f72d2){logger[_0x15f7('0xe')]('CreateCmHopperFinal',_0x3d7633);logger[_0x15f7('0xf')]('CreateCmHopperFinal',_0x3d7633,JSON['stringify'](_0x4f72d2));_0xdf5dfd(_0x4f72d2);})[_0x15f7('0x17')](function(_0x4eb8e3){logger[_0x15f7('0x13')](_0x15f7('0x18'),_0x4eb8e3[_0x15f7('0x15')],_0x3d7633);_0x1a50bc(_0x41efe3['error'](0x1f4,_0x4eb8e3[_0x15f7('0x15')]));});});}; \ No newline at end of file +var _0xe8ac=['info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe8ac,0xea));var _0xce8a=function(_0x487b28,_0x44bc34){_0x487b28=_0x487b28-0x0;var _0x5e8e18=_0xe8ac[_0x487b28];return _0x5e8e18;};'use strict';var _=require(_0xce8a('0x0'));var util=require(_0xce8a('0x1'));var moment=require(_0xce8a('0x2'));var BPromise=require(_0xce8a('0x3'));var rs=require(_0xce8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce8a('0x5'))['db'];var utils=require(_0xce8a('0x6'));var logger=require(_0xce8a('0x7'))(_0xce8a('0x8'));var config=require(_0xce8a('0x9'));var jayson=require(_0xce8a('0xa'));var client=jayson[_0xce8a('0xb')][_0xce8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f6f82,_0x70b92b,_0xff9272){return new BPromise(function(_0x28f007,_0x5e23ad){return client[_0xce8a('0xd')](_0x3f6f82,_0xff9272)['then'](function(_0xb9a307){logger[_0xce8a('0xe')](_0xce8a('0xf'),_0x70b92b,_0xce8a('0x10'));logger[_0xce8a('0x11')](_0xce8a('0x12'),_0x70b92b,_0xce8a('0x10'),JSON['stringify'](_0xb9a307));if(_0xb9a307[_0xce8a('0x13')]){if(_0xb9a307[_0xce8a('0x13')][_0xce8a('0x14')]===0x1f4){logger[_0xce8a('0x13')](_0xce8a('0xf'),_0x70b92b,_0xb9a307[_0xce8a('0x13')][_0xce8a('0x15')]);return _0x5e23ad(_0xb9a307[_0xce8a('0x13')][_0xce8a('0x15')]);}logger[_0xce8a('0x13')](_0xce8a('0xf'),_0x70b92b,_0xb9a307[_0xce8a('0x13')][_0xce8a('0x15')]);return _0x28f007(_0xb9a307[_0xce8a('0x13')][_0xce8a('0x15')]);}else{logger[_0xce8a('0xe')](_0xce8a('0xf'),_0x70b92b,'request\x20sent');_0x28f007(_0xb9a307[_0xce8a('0x16')][_0xce8a('0x15')]);}})[_0xce8a('0x17')](function(_0x2ec86a){logger['error'](_0xce8a('0xf'),_0x70b92b,_0x2ec86a);_0x5e23ad(_0x2ec86a);});});}exports[_0xce8a('0x18')]=function(_0x2d7985){var _0x5d07a5=this;return new Promise(function(_0x548faf,_0x80a32a){return db[_0xce8a('0x19')][_0xce8a('0x1a')](_0x2d7985[_0xce8a('0x1b')],{'raw':_0x2d7985['options']?_0x2d7985[_0xce8a('0x1c')][_0xce8a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2a5ad5){logger[_0xce8a('0xe')]('CreateCmHopperFinal',_0x2d7985);logger['debug'](_0xce8a('0x18'),_0x2d7985,JSON[_0xce8a('0x1e')](_0x2a5ad5));_0x548faf(_0x2a5ad5);})[_0xce8a('0x17')](function(_0x5617fe){logger[_0xce8a('0x13')](_0xce8a('0x18'),_0x5617fe[_0xce8a('0x15')],_0x2d7985);_0x80a32a(_0x5d07a5['error'](0x1f4,_0x5617fe[_0xce8a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 24197c5..dce773a 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 _0xb463=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x5e58bb,_0x3be45d){var _0x445d7b=function(_0x284a0c){while(--_0x284a0c){_0x5e58bb['push'](_0x5e58bb['shift']());}};_0x445d7b(++_0x3be45d);}(_0xb463,0x90));var _0x3b46=function(_0x4940a6,_0x448570){_0x4940a6=_0x4940a6-0x0;var _0x101ffe=_0xb463[_0x4940a6];return _0x101ffe;};'use strict';var multer=require(_0x3b46('0x0'));var util=require(_0x3b46('0x1'));var path=require(_0x3b46('0x2'));var timeout=require(_0x3b46('0x3'));var express=require('express');var router=express[_0x3b46('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b46('0x5'));var controller=require(_0x3b46('0x6'));router[_0x3b46('0x7')]('/',auth[_0x3b46('0x8')](),controller[_0x3b46('0x9')]);router['get'](_0x3b46('0xa'),auth[_0x3b46('0x8')](),controller[_0x3b46('0xb')]);router[_0x3b46('0x7')](_0x3b46('0xc'),auth['isAuthenticated'](),controller[_0x3b46('0xd')]);router[_0x3b46('0x7')]('/voice/queue/countAttributes/:id',auth[_0x3b46('0x8')](),controller[_0x3b46('0xe')]);router[_0x3b46('0x7')]('/campaign/countAttributes/:id',auth[_0x3b46('0x8')](),controller[_0x3b46('0xf')]);router[_0x3b46('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x3b46('0x11')]);router[_0x3b46('0x10')](_0x3b46('0x12'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x3b46('0x10')]('/checkContactHopper',auth[_0x3b46('0x8')](),controller[_0x3b46('0x13')]);router[_0x3b46('0x14')](_0x3b46('0xc'),auth[_0x3b46('0x8')](),controller[_0x3b46('0x15')]);module[_0x3b46('0x16')]=router; \ No newline at end of file +var _0x29fa=['isAuthenticated','index','get','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x2efee6,_0x52a587){var _0x45b5f3=function(_0x2102a0){while(--_0x2102a0){_0x2efee6['push'](_0x2efee6['shift']());}};_0x45b5f3(++_0x52a587);}(_0x29fa,0x88));var _0xa29f=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x29fa[_0x271060];return _0x40540b;};'use strict';var multer=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var path=require(_0xa29f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa29f('0x3')]();var auth=require(_0xa29f('0x4'));var interaction=require(_0xa29f('0x5'));var config=require(_0xa29f('0x6'));var controller=require(_0xa29f('0x7'));router['get']('/',auth[_0xa29f('0x8')](),controller[_0xa29f('0x9')]);router[_0xa29f('0xa')](_0xa29f('0xb'),auth[_0xa29f('0x8')](),controller['describe']);router[_0xa29f('0xa')](_0xa29f('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa29f('0xd'),auth['isAuthenticated'](),controller[_0xa29f('0xe')]);router['get'](_0xa29f('0xf'),auth[_0xa29f('0x8')](),controller[_0xa29f('0x10')]);router['post'](_0xa29f('0x11'),auth[_0xa29f('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xa29f('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xa29f('0x8')](),controller[_0xa29f('0x13')]);router['post'](_0xa29f('0x14'),auth[_0xa29f('0x8')](),controller[_0xa29f('0x15')]);router[_0xa29f('0x16')](_0xa29f('0xc'),auth[_0xa29f('0x8')](),controller['update']);module[_0xa29f('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d5e26be..0e6dfd1 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 _0x35f2=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x35f2,0x6e));var _0x235f=function(_0x1bd856,_0x54dc72){_0x1bd856=_0x1bd856-0x0;var _0x4bc1d3=_0x35f2[_0x1bd856];return _0x4bc1d3;};'use strict';var Sequelize=require(_0x235f('0x0'));module[_0x235f('0x1')]={'state':{'type':Sequelize[_0x235f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x235f('0x3')]},'scheduledat':{'type':Sequelize[_0x235f('0x4')]},'countbusyretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x235f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x235f('0x3')]},'originatecalleridname':{'type':Sequelize[_0x235f('0x3')]},'calleridnum':{'type':Sequelize[_0x235f('0x3')]},'calleridname':{'type':Sequelize[_0x235f('0x3')]},'starttime':{'type':Sequelize[_0x235f('0x4')]},'responsetime':{'type':Sequelize[_0x235f('0x4')]},'answertime':{'type':Sequelize[_0x235f('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x235f('0x4')]},'ringtime':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x235f('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x235f('0x3')]},'membername':{'type':Sequelize[_0x235f('0x3')]},'reason':{'type':Sequelize[_0x235f('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x235f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x235f('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x235f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x235f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x235f('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x235f('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x235f('0x3')]}}; \ No newline at end of file +var _0x5766=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x529cfe,_0x3b03aa){var _0x2f27bd=function(_0x274fe9){while(--_0x274fe9){_0x529cfe['push'](_0x529cfe['shift']());}};_0x2f27bd(++_0x3b03aa);}(_0x5766,0x99));var _0x6576=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5766[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6576('0x0'));module[_0x6576('0x1')]={'state':{'type':Sequelize[_0x6576('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6576('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6576('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6576('0x3')]},'calleridnum':{'type':Sequelize[_0x6576('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6576('0x4')]},'responsetime':{'type':Sequelize[_0x6576('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6576('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6576('0x3')]},'campaign':{'type':Sequelize[_0x6576('0x3')]},'campaigntype':{'type':Sequelize[_0x6576('0x3')]},'membername':{'type':Sequelize[_0x6576('0x3')]},'reason':{'type':Sequelize[_0x6576('0x3')]},'amd':{'type':Sequelize[_0x6576('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6576('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6576('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6576('0x4')]},'recallme':{'type':Sequelize[_0x6576('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6576('0x4')]},'edited':{'type':Sequelize[_0x6576('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6576('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6576('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b8fe6bf..eed0c0c 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 _0xb37d=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','json','count','limit','apply','reject','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','pick','where','merge','VIRTUAL','filter','options','CmHopperHistory','includeAll','include','findAll','show','params','find','catch','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x37bb74,_0xde8ca2){var _0x3e2989=function(_0x1e86f7){while(--_0x1e86f7){_0x37bb74['push'](_0x37bb74['shift']());}};_0x3e2989(++_0xde8ca2);}(_0xb37d,0x193));var _0xdb37=function(_0xf8e173,_0x519a9a){_0xf8e173=_0xf8e173-0x0;var _0x5efdf0=_0xb37d[_0xf8e173];return _0x5efdf0;};'use strict';var pdf=require(_0xdb37('0x0'));var emlformat=require(_0xdb37('0x1'));var rimraf=require(_0xdb37('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb37('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdb37('0x4'));var util=require(_0xdb37('0x5'));var path=require(_0xdb37('0x6'));var sox=require(_0xdb37('0x7'));var csv=require(_0xdb37('0x8'));var ejs=require(_0xdb37('0x9'));var fs=require('fs');var _=require(_0xdb37('0xa'));var squel=require(_0xdb37('0xb'));var crypto=require(_0xdb37('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb37('0xd'));var toCsv=require(_0xdb37('0x8'));var querystring=require(_0xdb37('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb37('0xf'));var authService=require(_0xdb37('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdb37('0x11'));var hardwareService=require(_0xdb37('0x12'));var logger=require('../../config/logger')(_0xdb37('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xdb37('0x14'))['db'];function respondWithStatusCode(_0x4a3f99,_0x31ff78){_0x31ff78=_0x31ff78||0xcc;return function(_0x2f42cc){if(_0x2f42cc){return _0x4a3f99[_0xdb37('0x15')](_0x31ff78);}return _0x4a3f99['status'](_0x31ff78)[_0xdb37('0x16')]();};}function respondWithResult(_0x4dd7c9,_0x338de0){_0x338de0=_0x338de0||0xc8;return function(_0x64c85){if(_0x64c85){return _0x4dd7c9[_0xdb37('0x17')](_0x338de0)[_0xdb37('0x18')](_0x64c85);}};}function respondWithFilteredResult(_0x19c93f,_0xda9387){return function(_0x2c82e7){if(_0x2c82e7){var _0x2db1af=_0x2c82e7[_0xdb37('0x19')],_0x19fff6=_0xda9387['offset'],_0x585ae6=_0xda9387['offset']+_0xda9387[_0xdb37('0x1a')],_0x3d17b0;if(_0x585ae6>=_0x2db1af){_0x585ae6=_0x2db1af;_0x3d17b0=0xc8;}else{_0x3d17b0=0xce;}_0x19c93f['status'](_0x3d17b0);return _0x19c93f['set']('Content-Range',_0x19fff6+'-'+_0x585ae6+'/'+_0x2db1af)[_0xdb37('0x18')](_0x2c82e7);}return null;};}function patchUpdates(_0xc227c0){return function(_0x34da4c){try{jsonpatch[_0xdb37('0x1b')](_0x34da4c,_0xc227c0,!![]);}catch(_0x60c573){return BPromise[_0xdb37('0x1c')](_0x60c573);}return _0x34da4c['save']();};}function saveUpdates(_0x533e3c,_0x1fe0e4){return function(_0x491cd9){if(_0x491cd9){return _0x491cd9[_0xdb37('0x1d')](_0x533e3c)[_0xdb37('0x1e')](function(_0x423916){return _0x423916;});}return null;};}function removeEntity(_0x21d413,_0x12f156){return function(_0x56280d){if(_0x56280d){return _0x56280d['destroy']()[_0xdb37('0x1e')](function(){_0x21d413[_0xdb37('0x17')](0xcc)[_0xdb37('0x16')]();});}};}function handleEntityNotFound(_0x409644,_0x437021){return function(_0x3f8e53){if(!_0x3f8e53){_0x409644[_0xdb37('0x15')](0x194);}return _0x3f8e53;};}function handleError(_0x230137,_0x351d6f){_0x351d6f=_0x351d6f||0x1f4;return function(_0x4c9e28){logger['error'](_0x4c9e28['stack']);if(_0x4c9e28['name']){delete _0x4c9e28[_0xdb37('0x1f')];}_0x230137['status'](_0x351d6f)[_0xdb37('0x20')](_0x4c9e28);};}exports[_0xdb37('0x21')]=function(_0x31faa1,_0x25628d){var _0x4f4597={},_0x213991={},_0x321ab3={'count':0x0,'rows':[]};var _0x47959e=_[_0xdb37('0x22')](db['CmHopperHistory'][_0xdb37('0x23')],function(_0x219cc0){return{'name':_0x219cc0[_0xdb37('0x24')],'type':_0x219cc0[_0xdb37('0x25')][_0xdb37('0x26')]};});_0x213991[_0xdb37('0x27')]=_[_0xdb37('0x22')](_0x47959e,_0xdb37('0x1f'));_0x213991[_0xdb37('0x28')]=_[_0xdb37('0x29')](_0x31faa1[_0xdb37('0x28')]);_0x213991[_0xdb37('0x2a')]=_[_0xdb37('0x2b')](_0x213991[_0xdb37('0x27')],_0x213991['query']);_0x4f4597[_0xdb37('0x2c')]=_[_0xdb37('0x2b')](_0x213991['model'],qs[_0xdb37('0x2d')](_0x31faa1['query'][_0xdb37('0x2d')]));_0x4f4597[_0xdb37('0x2c')]=_0x4f4597['attributes'][_0xdb37('0x2e')]?_0x4f4597[_0xdb37('0x2c')]:_0x213991['model'];if(!_0x31faa1[_0xdb37('0x28')][_0xdb37('0x2f')](_0xdb37('0x30'))){_0x4f4597[_0xdb37('0x1a')]=qs[_0xdb37('0x1a')](_0x31faa1[_0xdb37('0x28')][_0xdb37('0x1a')]);_0x4f4597[_0xdb37('0x31')]=qs['offset'](_0x31faa1[_0xdb37('0x28')][_0xdb37('0x31')]);}_0x4f4597[_0xdb37('0x32')]=qs['sort'](_0x31faa1['query']['sort']);_0x4f4597['where']=qs['filters'](_[_0xdb37('0x33')](_0x31faa1[_0xdb37('0x28')],_0x213991['filters']),_0x47959e);if(_0x31faa1[_0xdb37('0x28')]['filter']){_0x4f4597[_0xdb37('0x34')]=_[_0xdb37('0x35')](_0x4f4597['where'],{'$or':_[_0xdb37('0x22')](_0x47959e,function(_0x2d63ba){if(_0x2d63ba[_0xdb37('0x25')]!==_0xdb37('0x36')){var _0x467fbc={};_0x467fbc[_0x2d63ba[_0xdb37('0x1f')]]={'$like':'%'+_0x31faa1[_0xdb37('0x28')][_0xdb37('0x37')]+'%'};return _0x467fbc;}})});}_0x4f4597=_[_0xdb37('0x35')]({},_0x4f4597,_0x31faa1[_0xdb37('0x38')]);var _0x4b98f5={'where':_0x4f4597[_0xdb37('0x34')]};return db[_0xdb37('0x39')]['count'](_0x4b98f5)[_0xdb37('0x1e')](function(_0x11eb96){_0x321ab3[_0xdb37('0x19')]=_0x11eb96;if(_0x31faa1[_0xdb37('0x28')][_0xdb37('0x3a')]){_0x4f4597[_0xdb37('0x3b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdb37('0x3c')](_0x4f4597);})[_0xdb37('0x1e')](function(_0x3ef9bf){_0x321ab3['rows']=_0x3ef9bf;return _0x321ab3;})['then'](respondWithFilteredResult(_0x25628d,_0x4f4597))['catch'](handleError(_0x25628d,null));};exports[_0xdb37('0x3d')]=function(_0xf95d74,_0x469197){var _0x590c58={'raw':!![],'where':{'id':_0xf95d74[_0xdb37('0x3e')]['id']}},_0x49ea20={};_0x49ea20[_0xdb37('0x27')]=_[_0xdb37('0x29')](db['CmHopperHistory'][_0xdb37('0x23')]);_0x49ea20[_0xdb37('0x28')]=_[_0xdb37('0x29')](_0xf95d74[_0xdb37('0x28')]);_0x49ea20['filters']=_[_0xdb37('0x2b')](_0x49ea20[_0xdb37('0x27')],_0x49ea20[_0xdb37('0x28')]);_0x590c58['attributes']=_[_0xdb37('0x2b')](_0x49ea20[_0xdb37('0x27')],qs[_0xdb37('0x2d')](_0xf95d74['query'][_0xdb37('0x2d')]));_0x590c58['attributes']=_0x590c58[_0xdb37('0x2c')][_0xdb37('0x2e')]?_0x590c58[_0xdb37('0x2c')]:_0x49ea20[_0xdb37('0x27')];if(_0xf95d74[_0xdb37('0x28')][_0xdb37('0x3a')]){_0x590c58[_0xdb37('0x3b')]=[{'all':!![]}];}_0x590c58=_[_0xdb37('0x35')]({},_0x590c58,_0xf95d74[_0xdb37('0x38')]);return db['CmHopperHistory'][_0xdb37('0x3f')](_0x590c58)[_0xdb37('0x1e')](handleEntityNotFound(_0x469197,null))[_0xdb37('0x1e')](respondWithResult(_0x469197,null))[_0xdb37('0x40')](handleError(_0x469197,null));};exports[_0xdb37('0x41')]=function(_0xd72c8d,_0x4d02ae){return db['CmHopperHistory']['create'](_0xd72c8d[_0xdb37('0x42')],{})['then'](respondWithResult(_0x4d02ae,0xc9))['catch'](handleError(_0x4d02ae,null));};exports['describe']=function(_0x25125e,_0x3732a7){return db[_0xdb37('0x39')][_0xdb37('0x43')]()[_0xdb37('0x1e')](respondWithResult(_0x3732a7,null))[_0xdb37('0x40')](handleError(_0x3732a7,null));};exports['update']=function(_0x3a78c6,_0x352ccf){if(_0x3a78c6[_0xdb37('0x42')]['uniqueid']){delete _0x3a78c6['body'][_0xdb37('0x44')];}return db[_0xdb37('0x39')][_0xdb37('0x3f')]({'where':{'uniqueid':_0x3a78c6['params']['id']}})[_0xdb37('0x1e')](handleEntityNotFound(_0x352ccf,null))[_0xdb37('0x1e')](saveUpdates(_0x3a78c6['body'],null))['then'](respondWithResult(_0x352ccf,null))[_0xdb37('0x40')](handleError(_0x352ccf,null));}; \ No newline at end of file +var _0xa5af=['rawAttributes','keys','length','options','find','create','body','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','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','json','count','limit','set','apply','save','update','destroy','stack','name','send','index','CmHopperHistory','fieldName','key','model','map','query','attributes','intersection','fields','nolimit','offset','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','then','catch','show','params'];(function(_0x7d1351,_0x4d4dcf){var _0x2c35e8=function(_0xa17765){while(--_0xa17765){_0x7d1351['push'](_0x7d1351['shift']());}};_0x2c35e8(++_0x4d4dcf);}(_0xa5af,0x1b8));var _0xfa5a=function(_0x289f06,_0x3b9bbe){_0x289f06=_0x289f06-0x0;var _0x152c89=_0xa5af[_0x289f06];return _0x152c89;};'use strict';var pdf=require(_0xfa5a('0x0'));var emlformat=require(_0xfa5a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfa5a('0x2'));var jsonpatch=require(_0xfa5a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa5a('0x4'));var Mustache=require(_0xfa5a('0x5'));var util=require(_0xfa5a('0x6'));var path=require(_0xfa5a('0x7'));var sox=require(_0xfa5a('0x8'));var csv=require(_0xfa5a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfa5a('0xa'));var crypto=require(_0xfa5a('0xb'));var jsforce=require(_0xfa5a('0xc'));var deskjs=require(_0xfa5a('0xd'));var toCsv=require(_0xfa5a('0x9'));var querystring=require(_0xfa5a('0xe'));var Papa=require(_0xfa5a('0xf'));var Redis=require(_0xfa5a('0x10'));var authService=require(_0xfa5a('0x11'));var qs=require(_0xfa5a('0x12'));var as=require(_0xfa5a('0x13'));var hardwareService=require(_0xfa5a('0x14'));var logger=require(_0xfa5a('0x15'))(_0xfa5a('0x16'));var utils=require(_0xfa5a('0x17'));var config=require('../../config/environment');var db=require(_0xfa5a('0x18'))['db'];function respondWithStatusCode(_0x504417,_0x1102a8){_0x1102a8=_0x1102a8||0xcc;return function(_0x268436){if(_0x268436){return _0x504417[_0xfa5a('0x19')](_0x1102a8);}return _0x504417[_0xfa5a('0x1a')](_0x1102a8)['end']();};}function respondWithResult(_0x1673aa,_0x522d2a){_0x522d2a=_0x522d2a||0xc8;return function(_0x189415){if(_0x189415){return _0x1673aa['status'](_0x522d2a)[_0xfa5a('0x1b')](_0x189415);}};}function respondWithFilteredResult(_0x26286f,_0x474a64){return function(_0x179c1c){if(_0x179c1c){var _0x41566d=_0x179c1c[_0xfa5a('0x1c')],_0x1d73aa=_0x474a64['offset'],_0x1cb352=_0x474a64['offset']+_0x474a64[_0xfa5a('0x1d')],_0x10b9c9;if(_0x1cb352>=_0x41566d){_0x1cb352=_0x41566d;_0x10b9c9=0xc8;}else{_0x10b9c9=0xce;}_0x26286f['status'](_0x10b9c9);return _0x26286f[_0xfa5a('0x1e')]('Content-Range',_0x1d73aa+'-'+_0x1cb352+'/'+_0x41566d)[_0xfa5a('0x1b')](_0x179c1c);}return null;};}function patchUpdates(_0x194dc2){return function(_0x2b653a){try{jsonpatch[_0xfa5a('0x1f')](_0x2b653a,_0x194dc2,!![]);}catch(_0x18ee67){return BPromise['reject'](_0x18ee67);}return _0x2b653a[_0xfa5a('0x20')]();};}function saveUpdates(_0x485b78,_0x24a258){return function(_0x137e79){if(_0x137e79){return _0x137e79[_0xfa5a('0x21')](_0x485b78)['then'](function(_0x1fe32d){return _0x1fe32d;});}return null;};}function removeEntity(_0x1ea80d,_0x9bfbf){return function(_0x1e4cad){if(_0x1e4cad){return _0x1e4cad[_0xfa5a('0x22')]()['then'](function(){_0x1ea80d[_0xfa5a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524e12,_0x2644ac){return function(_0xcc918){if(!_0xcc918){_0x524e12[_0xfa5a('0x19')](0x194);}return _0xcc918;};}function handleError(_0x180dd4,_0x405c0a){_0x405c0a=_0x405c0a||0x1f4;return function(_0x163652){logger['error'](_0x163652[_0xfa5a('0x23')]);if(_0x163652[_0xfa5a('0x24')]){delete _0x163652[_0xfa5a('0x24')];}_0x180dd4['status'](_0x405c0a)[_0xfa5a('0x25')](_0x163652);};}exports[_0xfa5a('0x26')]=function(_0x26980a,_0x26390c){var _0x5f0e90={},_0x2111ee={},_0x777d4={'count':0x0,'rows':[]};var _0x16950d=_['map'](db[_0xfa5a('0x27')]['rawAttributes'],function(_0x10ca64){return{'name':_0x10ca64[_0xfa5a('0x28')],'type':_0x10ca64['type'][_0xfa5a('0x29')]};});_0x2111ee[_0xfa5a('0x2a')]=_[_0xfa5a('0x2b')](_0x16950d,_0xfa5a('0x24'));_0x2111ee[_0xfa5a('0x2c')]=_['keys'](_0x26980a[_0xfa5a('0x2c')]);_0x2111ee['filters']=_['intersection'](_0x2111ee[_0xfa5a('0x2a')],_0x2111ee[_0xfa5a('0x2c')]);_0x5f0e90[_0xfa5a('0x2d')]=_[_0xfa5a('0x2e')](_0x2111ee[_0xfa5a('0x2a')],qs[_0xfa5a('0x2f')](_0x26980a[_0xfa5a('0x2c')][_0xfa5a('0x2f')]));_0x5f0e90['attributes']=_0x5f0e90[_0xfa5a('0x2d')]['length']?_0x5f0e90[_0xfa5a('0x2d')]:_0x2111ee[_0xfa5a('0x2a')];if(!_0x26980a['query']['hasOwnProperty'](_0xfa5a('0x30'))){_0x5f0e90[_0xfa5a('0x1d')]=qs[_0xfa5a('0x1d')](_0x26980a[_0xfa5a('0x2c')]['limit']);_0x5f0e90[_0xfa5a('0x31')]=qs['offset'](_0x26980a[_0xfa5a('0x2c')][_0xfa5a('0x31')]);}_0x5f0e90[_0xfa5a('0x32')]=qs[_0xfa5a('0x33')](_0x26980a[_0xfa5a('0x2c')][_0xfa5a('0x33')]);_0x5f0e90[_0xfa5a('0x34')]=qs[_0xfa5a('0x35')](_[_0xfa5a('0x36')](_0x26980a['query'],_0x2111ee[_0xfa5a('0x35')]),_0x16950d);if(_0x26980a[_0xfa5a('0x2c')][_0xfa5a('0x37')]){_0x5f0e90[_0xfa5a('0x34')]=_[_0xfa5a('0x38')](_0x5f0e90['where'],{'$or':_['map'](_0x16950d,function(_0x2b38f5){if(_0x2b38f5['type']!=='VIRTUAL'){var _0x577fc9={};_0x577fc9[_0x2b38f5[_0xfa5a('0x24')]]={'$like':'%'+_0x26980a[_0xfa5a('0x2c')][_0xfa5a('0x37')]+'%'};return _0x577fc9;}})});}_0x5f0e90=_[_0xfa5a('0x38')]({},_0x5f0e90,_0x26980a['options']);var _0x3f0a41={'where':_0x5f0e90[_0xfa5a('0x34')]};return db[_0xfa5a('0x27')][_0xfa5a('0x1c')](_0x3f0a41)['then'](function(_0xb160c0){_0x777d4['count']=_0xb160c0;if(_0x26980a['query'][_0xfa5a('0x39')]){_0x5f0e90[_0xfa5a('0x3a')]=[{'all':!![]}];}return db[_0xfa5a('0x27')][_0xfa5a('0x3b')](_0x5f0e90);})['then'](function(_0xf295f1){_0x777d4['rows']=_0xf295f1;return _0x777d4;})[_0xfa5a('0x3c')](respondWithFilteredResult(_0x26390c,_0x5f0e90))[_0xfa5a('0x3d')](handleError(_0x26390c,null));};exports[_0xfa5a('0x3e')]=function(_0x46a380,_0x1c7acf){var _0x332856={'raw':!![],'where':{'id':_0x46a380[_0xfa5a('0x3f')]['id']}},_0x485a95={};_0x485a95[_0xfa5a('0x2a')]=_['keys'](db[_0xfa5a('0x27')][_0xfa5a('0x40')]);_0x485a95[_0xfa5a('0x2c')]=_[_0xfa5a('0x41')](_0x46a380[_0xfa5a('0x2c')]);_0x485a95['filters']=_[_0xfa5a('0x2e')](_0x485a95['model'],_0x485a95['query']);_0x332856['attributes']=_[_0xfa5a('0x2e')](_0x485a95[_0xfa5a('0x2a')],qs['fields'](_0x46a380['query'][_0xfa5a('0x2f')]));_0x332856['attributes']=_0x332856['attributes'][_0xfa5a('0x42')]?_0x332856[_0xfa5a('0x2d')]:_0x485a95[_0xfa5a('0x2a')];if(_0x46a380[_0xfa5a('0x2c')][_0xfa5a('0x39')]){_0x332856['include']=[{'all':!![]}];}_0x332856=_[_0xfa5a('0x38')]({},_0x332856,_0x46a380[_0xfa5a('0x43')]);return db[_0xfa5a('0x27')][_0xfa5a('0x44')](_0x332856)[_0xfa5a('0x3c')](handleEntityNotFound(_0x1c7acf,null))[_0xfa5a('0x3c')](respondWithResult(_0x1c7acf,null))[_0xfa5a('0x3d')](handleError(_0x1c7acf,null));};exports['create']=function(_0x4974ad,_0x5106e9){return db['CmHopperHistory'][_0xfa5a('0x45')](_0x4974ad[_0xfa5a('0x46')],{})[_0xfa5a('0x3c')](respondWithResult(_0x5106e9,0xc9))[_0xfa5a('0x3d')](handleError(_0x5106e9,null));};exports['describe']=function(_0x541d3d,_0x236683){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x236683,null))['catch'](handleError(_0x236683,null));};exports['update']=function(_0x8f2cb6,_0x30e68a){if(_0x8f2cb6[_0xfa5a('0x46')][_0xfa5a('0x47')]){delete _0x8f2cb6[_0xfa5a('0x46')]['uniqueid'];}return db[_0xfa5a('0x27')]['find']({'where':{'uniqueid':_0x8f2cb6[_0xfa5a('0x3f')]['id']}})[_0xfa5a('0x3c')](handleEntityNotFound(_0x30e68a,null))[_0xfa5a('0x3c')](saveUpdates(_0x8f2cb6['body'],null))[_0xfa5a('0x3c')](respondWithResult(_0x30e68a,null))['catch'](handleError(_0x30e68a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ae5fbcc..5323a20 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 _0x3c5f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x42b931,_0x3b67f1){var _0x3cd6a2=function(_0x1043d2){while(--_0x1043d2){_0x42b931['push'](_0x42b931['shift']());}};_0x3cd6a2(++_0x3b67f1);}(_0x3c5f,0xdd));var _0xf3c5=function(_0xd3a228,_0x56e8f2){_0xd3a228=_0xd3a228-0x0;var _0x2e58a5=_0x3c5f[_0xd3a228];return _0x2e58a5;};'use strict';var _=require(_0xf3c5('0x0'));var util=require(_0xf3c5('0x1'));var logger=require(_0xf3c5('0x2'))(_0xf3c5('0x3'));var moment=require(_0xf3c5('0x4'));var BPromise=require('bluebird');var rp=require(_0xf3c5('0x5'));var fs=require('fs');var path=require(_0xf3c5('0x6'));var rimraf=require(_0xf3c5('0x7'));var config=require(_0xf3c5('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xf3c5('0x9')]=function(_0x5b8892,_0x20a38d){return _0x5b8892['define'](_0xf3c5('0xa'),attributes,{'tableName':_0xf3c5('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf3c5('0xc')]},{'name':_0xf3c5('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2529=['endtime','uniqueid','../../config/logger','api','moment','path','rimraf','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history'];(function(_0x2b5c54,_0xd1be91){var _0x443e70=function(_0xf8d3ef){while(--_0xf8d3ef){_0x2b5c54['push'](_0x2b5c54['shift']());}};_0x443e70(++_0xd1be91);}(_0x2529,0x98));var _0x9252=function(_0x47591d,_0x4bf216){_0x47591d=_0x47591d-0x0;var _0x409312=_0x2529[_0x47591d];return _0x409312;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9252('0x0'))(_0x9252('0x1'));var moment=require(_0x9252('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9252('0x3'));var rimraf=require(_0x9252('0x4'));var config=require('../../config/environment');var attributes=require(_0x9252('0x5'));module['exports']=function(_0x210fc3,_0x172e89){return _0x210fc3['define'](_0x9252('0x6'),attributes,{'tableName':_0x9252('0x7'),'paranoid':![],'indexes':[{'name':_0x9252('0x8'),'fields':['endtime']},{'name':_0x9252('0x9'),'fields':[_0x9252('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1043a7d..dc30bca 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 _0xbdb7=['`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xbdb7[_0x4cee4b];return _0x4d891d;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['create'](_0x5723f4[_0x7bdb('0x17')],{'raw':_0x5723f4[_0x7bdb('0x18')]?_0x5723f4[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![]})[_0x7bdb('0x1a')](function(_0x5bfc35){logger['info'](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')]('CreateCmHopperHistory',_0x5723f4,JSON[_0x7bdb('0x10')](_0x5bfc35));_0x4ffd4b(_0x5bfc35);})[_0x7bdb('0x14')](function(_0x346c72){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0x346c72['message'],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0x346c72[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x1b')]=function(_0x3a456f){var _0x481f4b=this;return new Promise(function(_0x4d6e44,_0x3c423f){return db['CmHopperHistory']['findAll']({'raw':_0x3a456f['options']?_0x3a456f[_0x7bdb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a456f[_0x7bdb('0x18')]?_0x3a456f[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize'][_0x7bdb('0x1f')]('id')),_0x7bdb('0x20')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x23')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x24')))),_0x7bdb('0x25')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x26')))),_0x7bdb('0x27')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x29'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x7bdb('0x1a')](function(_0x5611f5){logger[_0x7bdb('0xb')]('AvgHandleTime',_0x3a456f);logger['debug'](_0x7bdb('0x1b'),_0x3a456f,JSON[_0x7bdb('0x10')](_0x5611f5));_0x4d6e44(_0x5611f5);})[_0x7bdb('0x14')](function(_0x62e562){logger[_0x7bdb('0x11')](_0x7bdb('0x1b'),_0x62e562['message'],_0x3a456f);_0x3c423f(_0x481f4b[_0x7bdb('0x11')](0x1f4,_0x62e562[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x2a')]=function(_0x3d1537){var _0x26de16=this;return new Promise(function(_0x14c522,_0x228340){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x3d1537['options']?_0x3d1537['options'][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x3d1537[_0x7bdb('0x18')]?_0x3d1537[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),'name'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x2e')))),_0x7bdb('0x2f')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x30')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x31')))),_0x7bdb('0x32')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x33')))),_0x7bdb('0x34')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x35')))),_0x7bdb('0x36')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7bdb('0x37')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x38')))),_0x7bdb('0x39')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3a')))),_0x7bdb('0x3b')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x3c')))),_0x7bdb('0x3d')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3e')))),'outboundRejectCallsDay'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x3f')))),_0x7bdb('0x40')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x41')))),_0x7bdb('0x42')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x43')))),_0x7bdb('0x44')]],'group':[_0x7bdb('0x2c')]})['then'](function(_0x258f29){logger['info']('GetVoiceQueueHopperHistory',_0x3d1537);logger[_0x7bdb('0xe')](_0x7bdb('0x2a'),_0x3d1537,JSON['stringify'](_0x258f29));_0x14c522(_0x258f29);})['catch'](function(_0x49bb3f){logger[_0x7bdb('0x11')]('GetVoiceQueueHopperHistory',_0x49bb3f['message'],_0x3d1537);_0x228340(_0x26de16[_0x7bdb('0x11')](0x1f4,_0x49bb3f[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x45')]=function(_0x148280){var _0x49c313=this;return new Promise(function(_0x1d444c,_0x4c5c8c){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x148280[_0x7bdb('0x18')]?_0x148280[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x148280[_0x7bdb('0x18')]?_0x148280['options'][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),_0x7bdb('0x46')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['col']('id')),_0x7bdb('0x47')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x22')))),_0x7bdb('0x48')]],'group':['campaign']})[_0x7bdb('0x1a')](function(_0x567993){logger[_0x7bdb('0xb')]('GetCampaignHopperHistory',_0x148280);logger['debug'](_0x7bdb('0x45'),_0x148280,JSON[_0x7bdb('0x10')](_0x567993));_0x1d444c(_0x567993);})[_0x7bdb('0x14')](function(_0x26f1f5){logger[_0x7bdb('0x11')](_0x7bdb('0x45'),_0x26f1f5[_0x7bdb('0x12')],_0x148280);_0x4c5c8c(_0x49c313[_0x7bdb('0x11')](0x1f4,_0x26f1f5[_0x7bdb('0x12')]));});});}; \ No newline at end of file +var _0xefda=['`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','campaign','GetCampaignHopperHistory','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay'];(function(_0x5853c1,_0x5e3aba){var _0x962df6=function(_0x25afd8){while(--_0x25afd8){_0x5853c1['push'](_0x5853c1['shift']());}};_0x962df6(++_0x5e3aba);}(_0xefda,0x96));var _0xaefd=function(_0x404093,_0x4fd27c){_0x404093=_0x404093-0x0;var _0x1e56fc=_0xefda[_0x404093];return _0x1e56fc;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['CmHopperHistory'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});};exports[_0xaefd('0x1c')]=function(_0x4cd9b2){var _0x3deec8=this;return new Promise(function(_0x3caa99,_0x1a05eb){return db['CmHopperHistory'][_0xaefd('0x1d')]({'raw':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![],'where':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2['options'][_0xaefd('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['col']('id')),_0xaefd('0x21')],[db[_0xaefd('0x20')]['fn']('COUNT',db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xaefd('0x23')],[db['sequelize']['fn'](_0xaefd('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xaefd('0x22')](_0xaefd('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xaefd('0x25')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x26'),db[_0xaefd('0x20')]['fn']('IF',db['sequelize'][_0xaefd('0x22')](_0xaefd('0x27')))),_0xaefd('0x28')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x26'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x29')))),_0xaefd('0x2a')]]})[_0xaefd('0xb')](function(_0x195571){logger[_0xaefd('0x14')](_0xaefd('0x1c'),_0x4cd9b2);logger[_0xaefd('0xd')](_0xaefd('0x1c'),_0x4cd9b2,JSON['stringify'](_0x195571));_0x3caa99(_0x195571);})[_0xaefd('0x16')](function(_0xcb4be8){logger[_0xaefd('0x10')]('AvgHandleTime',_0xcb4be8[_0xaefd('0x13')],_0x4cd9b2);_0x1a05eb(_0x3deec8['error'](0x1f4,_0xcb4be8[_0xaefd('0x13')]));});});};exports[_0xaefd('0x2b')]=function(_0x99a883){var _0xbbbf6d=this;return new Promise(function(_0x2c0d72,_0x2f1548){return db[_0xaefd('0x2c')][_0xaefd('0x1d')]({'raw':_0x99a883[_0xaefd('0x1a')]?_0x99a883[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![],'where':_0x99a883[_0xaefd('0x1a')]?_0x99a883[_0xaefd('0x1a')][_0xaefd('0x1e')]||null:null,'attributes':[['campaign',_0xaefd('0x2d')],[db['sequelize']['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x2e')))),_0xaefd('0x2f')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal'](_0xaefd('0x30')))),_0xaefd('0x31')],[db['sequelize']['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xaefd('0x32')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x33')))),_0xaefd('0x34')],[db['sequelize']['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x35')))),_0xaefd('0x36')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xaefd('0x22')](_0xaefd('0x37')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x38')))),_0xaefd('0x39')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db['sequelize'][_0xaefd('0x22')](_0xaefd('0x3a')))),_0xaefd('0x3b')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal'](_0xaefd('0x3c')))),'outboundBlacklistCallsDay'],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0xaefd('0x3d')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db['sequelize']['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0xaefd('0x3e')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x3f')))),_0xaefd('0x40')],[db['sequelize']['fn']('COUNT',db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')]['literal'](_0xaefd('0x41')))),'outboundRejectCallsDay'],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x42')))),'outboundReCallsDay']],'group':['campaign']})[_0xaefd('0xb')](function(_0x338823){logger['info'](_0xaefd('0x2b'),_0x99a883);logger[_0xaefd('0xd')](_0xaefd('0x2b'),_0x99a883,JSON[_0xaefd('0xf')](_0x338823));_0x2c0d72(_0x338823);})['catch'](function(_0x583caa){logger[_0xaefd('0x10')](_0xaefd('0x2b'),_0x583caa[_0xaefd('0x13')],_0x99a883);_0x2f1548(_0xbbbf6d[_0xaefd('0x10')](0x1f4,_0x583caa[_0xaefd('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x377c28){var _0x3b6290=this;return new Promise(function(_0x5a54fb,_0xbeca29){return db[_0xaefd('0x2c')]['findAll']({'raw':_0x377c28[_0xaefd('0x1a')]?_0x377c28[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![],'where':_0x377c28['options']?_0x377c28[_0xaefd('0x1a')][_0xaefd('0x1e')]||null:null,'attributes':[['campaign',_0xaefd('0x2d')],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['col']('id')),'ivrTotalCallsDays'],[db[_0xaefd('0x20')]['fn'](_0xaefd('0x1f'),db[_0xaefd('0x20')]['fn']('IF',db[_0xaefd('0x20')][_0xaefd('0x22')](_0xaefd('0x43')))),_0xaefd('0x44')]],'group':[_0xaefd('0x45')]})[_0xaefd('0xb')](function(_0x133c4f){logger['info']('GetCampaignHopperHistory',_0x377c28);logger[_0xaefd('0xd')](_0xaefd('0x46'),_0x377c28,JSON[_0xaefd('0xf')](_0x133c4f));_0x5a54fb(_0x133c4f);})[_0xaefd('0x16')](function(_0x542161){logger[_0xaefd('0x10')](_0xaefd('0x46'),_0x542161[_0xaefd('0x13')],_0x377c28);_0xbeca29(_0x3b6290[_0xaefd('0x10')](0x1f4,_0x542161[_0xaefd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ce7af27..63db6ad 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 _0x62dd=['express','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','exports','multer','util','connect-timeout'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x62dd,0x10d));var _0xd62d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var path=require('path');var timeout=require(_0xd62d('0x2'));var express=require(_0xd62d('0x3'));var router=express['Router']();var auth=require(_0xd62d('0x4'));var interaction=require(_0xd62d('0x5'));var config=require('../../config/environment');var controller=require(_0xd62d('0x6'));router[_0xd62d('0x7')]('/',auth[_0xd62d('0x8')](),controller['index']);router[_0xd62d('0x7')](_0xd62d('0x9'),auth[_0xd62d('0x8')](),controller[_0xd62d('0xa')]);router[_0xd62d('0x7')](_0xd62d('0xb'),auth[_0xd62d('0x8')](),controller[_0xd62d('0xc')]);router['post']('/',auth[_0xd62d('0x8')](),controller[_0xd62d('0xd')]);router[_0xd62d('0xe')](_0xd62d('0xb'),auth[_0xd62d('0x8')](),controller['update']);module[_0xd62d('0xf')]=router; \ No newline at end of file +var _0xf014=['/describe','/:id','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x61bb05,_0x47421f){var _0x3ceb3e=function(_0x54b8f7){while(--_0x54b8f7){_0x61bb05['push'](_0x61bb05['shift']());}};_0x3ceb3e(++_0x47421f);}(_0xf014,0x126));var _0x4f01=function(_0x4b60cc,_0x2e5e22){_0x4b60cc=_0x4b60cc-0x0;var _0x116ffe=_0xf014[_0x4b60cc];return _0x116ffe;};'use strict';var multer=require(_0x4f01('0x0'));var util=require(_0x4f01('0x1'));var path=require(_0x4f01('0x2'));var timeout=require(_0x4f01('0x3'));var express=require(_0x4f01('0x4'));var router=express[_0x4f01('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f01('0x6'));var config=require(_0x4f01('0x7'));var controller=require(_0x4f01('0x8'));router[_0x4f01('0x9')]('/',auth[_0x4f01('0xa')](),controller[_0x4f01('0xb')]);router['get'](_0x4f01('0xc'),auth[_0x4f01('0xa')](),controller['describe']);router[_0x4f01('0x9')](_0x4f01('0xd'),auth[_0x4f01('0xa')](),controller['show']);router[_0x4f01('0xe')]('/',auth[_0x4f01('0xa')](),controller[_0x4f01('0xf')]);router['put'](_0x4f01('0xd'),auth[_0x4f01('0xa')](),controller[_0x4f01('0x10')]);module[_0x4f01('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 46ba6d0..1d5ca91 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 _0xe99f=['STRING','sequelize','exports','name'];(function(_0x535ea3,_0xec7bb6){var _0x5265d4=function(_0x241f7f){while(--_0x241f7f){_0x535ea3['push'](_0x535ea3['shift']());}};_0x5265d4(++_0xec7bb6);}(_0xe99f,0xe1));var _0xfe99=function(_0xf21445,_0x28e649){_0xf21445=_0xf21445-0x0;var _0xc15e3d=_0xe99f[_0xf21445];return _0xc15e3d;};'use strict';var Sequelize=require(_0xfe99('0x0'));module[_0xfe99('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfe99('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfe99('0x3')]},'dialPrefix':{'type':Sequelize[_0xfe99('0x3')]}}; \ No newline at end of file +var _0xd545=['exports','name','sequelize'];(function(_0x1f790c,_0x2ed497){var _0x10b729=function(_0x3f5c8e){while(--_0x3f5c8e){_0x1f790c['push'](_0x1f790c['shift']());}};_0x10b729(++_0x2ed497);}(_0xd545,0xc2));var _0x5d54=function(_0x5ed99b,_0xe977c1){_0x5ed99b=_0x5ed99b-0x0;var _0x52d3e0=_0xd545[_0x5ed99b];return _0x52d3e0;};'use strict';var Sequelize=require(_0x5d54('0x0'));module[_0x5d54('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5d54('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a2ed6a5..34a742c 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 _0xeb45=['api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','error','stack','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','VIRTUAL','merge','options','CmList','includeAll','include','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','catch','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','errors','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x197de8,_0x4d40f0){var _0x2785ee=function(_0x22b572){while(--_0x22b572){_0x197de8['push'](_0x197de8['shift']());}};_0x2785ee(++_0x4d40f0);}(_0xeb45,0x79));var _0x5eb4=function(_0x88fbc1,_0x59e2d1){_0x88fbc1=_0x88fbc1-0x0;var _0x52da8b=_0xeb45[_0x88fbc1];return _0x52da8b;};'use strict';var pdf=require(_0x5eb4('0x0'));var emlformat=require(_0x5eb4('0x1'));var rimraf=require(_0x5eb4('0x2'));var zipdir=require(_0x5eb4('0x3'));var jsonpatch=require(_0x5eb4('0x4'));var rp=require('request-promise');var moment=require(_0x5eb4('0x5'));var BPromise=require(_0x5eb4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5eb4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5eb4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5eb4('0x9'));var crypto=require(_0x5eb4('0xa'));var jsforce=require(_0x5eb4('0xb'));var deskjs=require(_0x5eb4('0xc'));var toCsv=require(_0x5eb4('0xd'));var querystring=require(_0x5eb4('0xe'));var Papa=require(_0x5eb4('0xf'));var Redis=require(_0x5eb4('0x10'));var authService=require(_0x5eb4('0x11'));var qs=require(_0x5eb4('0x12'));var as=require(_0x5eb4('0x13'));var hardwareService=require(_0x5eb4('0x14'));var logger=require('../../config/logger')(_0x5eb4('0x15'));var utils=require(_0x5eb4('0x16'));var config=require('../../config/environment');var db=require(_0x5eb4('0x17'))['db'];config['redis']=_[_0x5eb4('0x18')](config['redis'],{'host':_0x5eb4('0x19'),'port':0x18eb});var socket=require(_0x5eb4('0x1a'))(new Redis(config[_0x5eb4('0x1b')]));require(_0x5eb4('0x1c'))[_0x5eb4('0x1d')](socket);function respondWithStatusCode(_0x30b1a6,_0x131f47){_0x131f47=_0x131f47||0xcc;return function(_0x21e3ec){if(_0x21e3ec){return _0x30b1a6[_0x5eb4('0x1e')](_0x131f47);}return _0x30b1a6[_0x5eb4('0x1f')](_0x131f47)[_0x5eb4('0x20')]();};}function respondWithResult(_0x4fd498,_0xf2bde5){_0xf2bde5=_0xf2bde5||0xc8;return function(_0x149bac){if(_0x149bac){return _0x4fd498[_0x5eb4('0x1f')](_0xf2bde5)[_0x5eb4('0x21')](_0x149bac);}};}function respondWithFilteredResult(_0x1439d2,_0x5b6d3b){return function(_0x15c935){if(_0x15c935){var _0x5837cc=_0x15c935[_0x5eb4('0x22')],_0x6011b6=_0x5b6d3b[_0x5eb4('0x23')],_0x423e5f=_0x5b6d3b[_0x5eb4('0x23')]+_0x5b6d3b[_0x5eb4('0x24')],_0xa9b01e;if(_0x423e5f>=_0x5837cc){_0x423e5f=_0x5837cc;_0xa9b01e=0xc8;}else{_0xa9b01e=0xce;}_0x1439d2[_0x5eb4('0x1f')](_0xa9b01e);return _0x1439d2[_0x5eb4('0x25')](_0x5eb4('0x26'),_0x6011b6+'-'+_0x423e5f+'/'+_0x5837cc)['json'](_0x15c935);}return null;};}function patchUpdates(_0x2e1c23){return function(_0x56dbed){try{jsonpatch['apply'](_0x56dbed,_0x2e1c23,!![]);}catch(_0x181676){return BPromise[_0x5eb4('0x27')](_0x181676);}return _0x56dbed[_0x5eb4('0x28')]();};}function saveUpdates(_0x2466c8,_0x12dcaa){return function(_0x23e314){if(_0x23e314){return _0x23e314[_0x5eb4('0x29')](_0x2466c8)['then'](function(_0x35db7d){return _0x35db7d;});}return null;};}function removeEntity(_0x431328,_0x4c8e5a){return function(_0x58dc9c){if(_0x58dc9c){return _0x58dc9c[_0x5eb4('0x2a')]()[_0x5eb4('0x2b')](function(){var _0x39a4d1=_0x58dc9c[_0x5eb4('0x2c')]({'plain':!![]});var _0x39557b='Lists';return db['UserProfileResource'][_0x5eb4('0x2a')]({'where':{'type':_0x39557b,'resourceId':_0x39a4d1['id']}})[_0x5eb4('0x2b')](function(){return _0x58dc9c;});})[_0x5eb4('0x2b')](function(){_0x431328['status'](0xcc)[_0x5eb4('0x20')]();});}};}function handleEntityNotFound(_0x5334f7,_0x141c14){return function(_0x2fa17f){if(!_0x2fa17f){_0x5334f7[_0x5eb4('0x1e')](0x194);}return _0x2fa17f;};}function handleError(_0x368b1d,_0x57bb53){_0x57bb53=_0x57bb53||0x1f4;return function(_0x18317a){logger[_0x5eb4('0x2d')](_0x18317a[_0x5eb4('0x2e')]);if(_0x18317a[_0x5eb4('0x2f')]){delete _0x18317a['name'];}_0x368b1d['status'](_0x57bb53)[_0x5eb4('0x30')](_0x18317a);};}exports[_0x5eb4('0x31')]=function(_0xae6575,_0x184409){var _0x4d586d={},_0x364785={},_0x405247={'count':0x0,'rows':[]};var _0x3d8e48=_['map'](db['CmList'][_0x5eb4('0x32')],function(_0x188f36){return{'name':_0x188f36['fieldName'],'type':_0x188f36['type'][_0x5eb4('0x33')]};});_0x364785[_0x5eb4('0x34')]=_['map'](_0x3d8e48,_0x5eb4('0x2f'));_0x364785[_0x5eb4('0x35')]=_[_0x5eb4('0x36')](_0xae6575['query']);_0x364785[_0x5eb4('0x37')]=_[_0x5eb4('0x38')](_0x364785['model'],_0x364785[_0x5eb4('0x35')]);_0x4d586d[_0x5eb4('0x39')]=_['intersection'](_0x364785[_0x5eb4('0x34')],qs[_0x5eb4('0x3a')](_0xae6575[_0x5eb4('0x35')][_0x5eb4('0x3a')]));_0x4d586d[_0x5eb4('0x39')]=_0x4d586d[_0x5eb4('0x39')][_0x5eb4('0x3b')]?_0x4d586d['attributes']:_0x364785[_0x5eb4('0x34')];if(!_0xae6575['query'][_0x5eb4('0x3c')](_0x5eb4('0x3d'))){_0x4d586d[_0x5eb4('0x24')]=qs['limit'](_0xae6575[_0x5eb4('0x35')][_0x5eb4('0x24')]);_0x4d586d['offset']=qs[_0x5eb4('0x23')](_0xae6575[_0x5eb4('0x35')]['offset']);}_0x4d586d['order']=qs[_0x5eb4('0x3e')](_0xae6575[_0x5eb4('0x35')]['sort']);_0x4d586d[_0x5eb4('0x3f')]=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0xae6575[_0x5eb4('0x35')],_0x364785[_0x5eb4('0x37')]),_0x3d8e48);if(_0xae6575[_0x5eb4('0x35')][_0x5eb4('0x41')]){_0x4d586d[_0x5eb4('0x3f')]=_['merge'](_0x4d586d[_0x5eb4('0x3f')],{'$or':_[_0x5eb4('0x42')](_0x3d8e48,function(_0x22e2b1){if(_0x22e2b1[_0x5eb4('0x43')]!==_0x5eb4('0x44')){var _0x576a8a={};_0x576a8a[_0x22e2b1['name']]={'$like':'%'+_0xae6575[_0x5eb4('0x35')][_0x5eb4('0x41')]+'%'};return _0x576a8a;}})});}_0x4d586d=_[_0x5eb4('0x45')]({},_0x4d586d,_0xae6575[_0x5eb4('0x46')]);var _0x41b850={'where':_0x4d586d['where']};return db[_0x5eb4('0x47')]['count'](_0x41b850)[_0x5eb4('0x2b')](function(_0x1956ca){_0x405247[_0x5eb4('0x22')]=_0x1956ca;if(_0xae6575[_0x5eb4('0x35')][_0x5eb4('0x48')]){_0x4d586d[_0x5eb4('0x49')]=[{'all':!![]}];}return db[_0x5eb4('0x47')][_0x5eb4('0x4a')](_0x4d586d);})[_0x5eb4('0x2b')](function(_0x657fb){_0x405247[_0x5eb4('0x4b')]=_0x657fb;return _0x405247;})[_0x5eb4('0x2b')](respondWithFilteredResult(_0x184409,_0x4d586d))['catch'](handleError(_0x184409,null));};exports[_0x5eb4('0x4c')]=function(_0x1cc362,_0x5470f1){var _0x455286={'raw':![],'where':{'id':_0x1cc362['params']['id']}},_0x54e575={};_0x54e575['model']=_['keys'](db[_0x5eb4('0x47')][_0x5eb4('0x32')]);_0x54e575[_0x5eb4('0x35')]=_['keys'](_0x1cc362[_0x5eb4('0x35')]);_0x54e575[_0x5eb4('0x37')]=_[_0x5eb4('0x38')](_0x54e575['model'],_0x54e575[_0x5eb4('0x35')]);_0x455286[_0x5eb4('0x39')]=_[_0x5eb4('0x38')](_0x54e575[_0x5eb4('0x34')],qs['fields'](_0x1cc362[_0x5eb4('0x35')][_0x5eb4('0x3a')]));_0x455286['attributes']=_0x455286[_0x5eb4('0x39')][_0x5eb4('0x3b')]?_0x455286[_0x5eb4('0x39')]:_0x54e575[_0x5eb4('0x34')];if(_0x1cc362[_0x5eb4('0x35')][_0x5eb4('0x48')]){_0x455286[_0x5eb4('0x49')]=[{'all':!![]}];}_0x455286=_['merge']({},_0x455286,_0x1cc362[_0x5eb4('0x46')]);return db[_0x5eb4('0x47')][_0x5eb4('0x4d')](_0x455286)[_0x5eb4('0x2b')](handleEntityNotFound(_0x5470f1,null))[_0x5eb4('0x2b')](respondWithResult(_0x5470f1,null))['catch'](handleError(_0x5470f1,null));};exports[_0x5eb4('0x4e')]=function(_0x3e7cd6,_0x45ee75){return db['CmList'][_0x5eb4('0x4e')](_0x3e7cd6[_0x5eb4('0x4f')],{})[_0x5eb4('0x2b')](function(_0x27990f){var _0x5681b=_0x3e7cd6[_0x5eb4('0x50')][_0x5eb4('0x2c')]({'plain':!![]});if(!_0x5681b)throw new Error(_0x5eb4('0x51'));if(_0x5681b[_0x5eb4('0x52')]===_0x5eb4('0x50')){var _0x32869f=_0x27990f['get']({'plain':!![]});var _0x44738a=_0x5eb4('0x53');return db[_0x5eb4('0x54')][_0x5eb4('0x4d')]({'where':{'name':_0x44738a,'userProfileId':_0x5681b[_0x5eb4('0x55')]},'raw':!![]})[_0x5eb4('0x2b')](function(_0x395052){if(_0x395052&&_0x395052['autoAssociation']===0x0){return db['UserProfileResource'][_0x5eb4('0x4e')]({'name':_0x32869f[_0x5eb4('0x2f')],'resourceId':_0x32869f['id'],'type':_0x395052[_0x5eb4('0x2f')],'sectionId':_0x395052['id']},{})[_0x5eb4('0x2b')](function(){return _0x27990f;});}else{return _0x27990f;}})['catch'](function(_0x1b6074){logger[_0x5eb4('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b6074);throw _0x1b6074;});}return _0x27990f;})[_0x5eb4('0x2b')](respondWithResult(_0x45ee75,0xc9))['catch'](handleError(_0x45ee75,null));};exports[_0x5eb4('0x29')]=function(_0xb25d38,_0x36df73){if(_0xb25d38['body']['id']){delete _0xb25d38[_0x5eb4('0x4f')]['id'];}return db[_0x5eb4('0x47')][_0x5eb4('0x4d')]({'where':{'id':_0xb25d38['params']['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x36df73,null))[_0x5eb4('0x2b')](saveUpdates(_0xb25d38['body'],null))['then'](respondWithResult(_0x36df73,null))[_0x5eb4('0x56')](handleError(_0x36df73,null));};exports['destroy']=function(_0x153b74,_0x4662a3){return db[_0x5eb4('0x47')][_0x5eb4('0x4d')]({'where':{'id':_0x153b74[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x4662a3,null))['then'](removeEntity(_0x4662a3,null))[_0x5eb4('0x56')](handleError(_0x4662a3,null));};exports['describe']=function(_0x413307,_0x254f87){return db[_0x5eb4('0x47')][_0x5eb4('0x58')]()[_0x5eb4('0x2b')](respondWithResult(_0x254f87,null))['catch'](handleError(_0x254f87,null));};exports[_0x5eb4('0x59')]=function(_0x1a5116,_0x221144,_0xef75d8){if(_0x1a5116[_0x5eb4('0x4f')]['id']){delete _0x1a5116['body']['id'];}return db[_0x5eb4('0x47')]['find']({'where':{'id':_0x1a5116[_0x5eb4('0x57')]['id']}})['then'](handleEntityNotFound(_0x221144,null))[_0x5eb4('0x2b')](function(_0x179801){if(_0x179801){_0x1a5116['body'][_0x5eb4('0x5a')]=_0x179801['id'];return db['Disposition'][_0x5eb4('0x4e')](_0x1a5116[_0x5eb4('0x4f')]);}})[_0x5eb4('0x2b')](respondWithResult(_0x221144,null))[_0x5eb4('0x56')](handleError(_0x221144,null));};exports[_0x5eb4('0x5b')]=function(_0x539bf8,_0x1d0e9c,_0x5807da){var _0x299528={'raw':![],'where':{}};var _0x25fbc3={};var _0x5b0258={'count':0x0,'rows':[]};return db[_0x5eb4('0x47')][_0x5eb4('0x5c')]({'where':{'id':_0x539bf8['params']['id']}})['then'](handleEntityNotFound(_0x1d0e9c,null))['then'](function(_0x583b40){if(_0x583b40){_0x25fbc3[_0x5eb4('0x34')]=_[_0x5eb4('0x36')](db[_0x5eb4('0x5d')][_0x5eb4('0x32')]);_0x25fbc3['query']=_['keys'](_0x539bf8[_0x5eb4('0x35')]);_0x25fbc3['filters']=_['intersection'](_0x25fbc3[_0x5eb4('0x34')],_0x25fbc3[_0x5eb4('0x35')]);_0x299528['attributes']=_[_0x5eb4('0x38')](_0x25fbc3[_0x5eb4('0x34')],qs[_0x5eb4('0x3a')](_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x3a')]));_0x299528[_0x5eb4('0x39')]=_0x299528[_0x5eb4('0x39')]['length']?_0x299528[_0x5eb4('0x39')]:_0x25fbc3[_0x5eb4('0x34')];if(!_0x539bf8[_0x5eb4('0x35')]['hasOwnProperty']('nolimit')){_0x299528[_0x5eb4('0x24')]=qs[_0x5eb4('0x24')](_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x24')]);_0x299528[_0x5eb4('0x23')]=qs['offset'](_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x23')]);}_0x299528[_0x5eb4('0x5e')]=qs['sort'](_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x3e')]);_0x299528[_0x5eb4('0x3f')]=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0x539bf8[_0x5eb4('0x35')],_0x25fbc3[_0x5eb4('0x37')]));_0x299528[_0x5eb4('0x3f')]['ListId']=_0x583b40['id'];if(_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x41')]){_0x299528[_0x5eb4('0x3f')]=_[_0x5eb4('0x45')](_0x299528[_0x5eb4('0x3f')],{'$or':_[_0x5eb4('0x42')](_0x299528[_0x5eb4('0x39')],function(_0x5f5820){var _0x579554={};_0x579554[_0x5f5820]={'$like':'%'+_0x539bf8[_0x5eb4('0x35')][_0x5eb4('0x41')]+'%'};return _0x579554;})});}_0x299528=_['merge']({},_0x299528,_0x539bf8['options']);return db['Disposition'][_0x5eb4('0x22')]({'where':_0x299528[_0x5eb4('0x3f')]})[_0x5eb4('0x2b')](function(_0x14b04c){_0x5b0258[_0x5eb4('0x22')]=_0x14b04c;if(_0x539bf8['query'][_0x5eb4('0x48')]){_0x299528[_0x5eb4('0x49')]=[{'all':!![]}];}return db[_0x5eb4('0x5d')]['findAll'](_0x299528);})[_0x5eb4('0x2b')](function(_0x2cc475){_0x5b0258[_0x5eb4('0x4b')]=_0x2cc475;return _0x5b0258;});}})[_0x5eb4('0x2b')](respondWithFilteredResult(_0x1d0e9c,_0x299528))[_0x5eb4('0x56')](handleError(_0x1d0e9c,null));};exports[_0x5eb4('0x5f')]=function(_0x55c5a7,_0x3eccaf,_0x4fe28b){return db[_0x5eb4('0x47')]['find']({'where':{'id':_0x55c5a7['params']['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x3eccaf,null))[_0x5eb4('0x2b')](function(_0x5f59d1){if(_0x5f59d1){return _0x5f59d1[_0x5eb4('0x5f')](_0x55c5a7[_0x5eb4('0x35')][_0x5eb4('0x60')]);}})[_0x5eb4('0x2b')](respondWithStatusCode(_0x3eccaf,null))[_0x5eb4('0x56')](handleError(_0x3eccaf,null));};exports[_0x5eb4('0x61')]=function(_0x220756,_0x39b974,_0x4f33ec){return db[_0x5eb4('0x47')][_0x5eb4('0x4d')]({'where':{'id':_0x220756['params']['id']}})['then'](handleEntityNotFound(_0x39b974,null))[_0x5eb4('0x2b')](function(_0x168405){if(_0x168405){var _0x5da4af=[];var _0x4ccc33={'success':[],'errors':[]};return db[_0x5eb4('0x62')][_0x5eb4('0x58')]()[_0x5eb4('0x2b')](function(_0x591687){if(_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')]&&_['isArray'](_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')])){if(_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')]['length']){_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')]=_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')][_0x5eb4('0x64')](';')+';';}else{_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x63')]=null;}}else{_0x220756[_0x5eb4('0x4f')]['tags']=null;}if(_0x220756['body']&&_[_0x5eb4('0x65')](_0x220756[_0x5eb4('0x4f')])){for(var _0x4c9c46=0x0;_0x4c9c46<_0x220756[_0x5eb4('0x4f')][_0x5eb4('0x3b')];_0x4c9c46+=0x1){_0x220756[_0x5eb4('0x4f')][_0x4c9c46]['ListId']=_0x220756[_0x5eb4('0x57')]['id'];_0x5da4af[_0x5eb4('0x66')](_0x220756[_0x5eb4('0x4f')][_0x4c9c46]);}return BPromise[_0x5eb4('0x67')](_0x5da4af,function(_0x5984f9){return db[_0x5eb4('0x62')][_0x5eb4('0x4e')](_['omit'](_0x5984f9,[_0x5eb4('0x60'),'id'])||{},{'fields':_['keys'](_0x591687),'raw':!![]})[_0x5eb4('0x2b')](function(_0x5436f6){_0x4ccc33['success']['push'](_0x5436f6['dataValues']);})[_0x5eb4('0x56')](function(_0x41769d){_0x4ccc33[_0x5eb4('0x68')][_0x5eb4('0x66')]({'data':_0x5984f9,'error':_0x41769d['message']});});})[_0x5eb4('0x2b')](function(_0x2514bd){return _0x4ccc33;})[_0x5eb4('0x56')](function(_0x9bf3df){return _0x9bf3df;});}else{_0x39b974[_0x5eb4('0x1f')](0x190)[_0x5eb4('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x5eb4('0x2b')](respondWithResult(_0x39b974,null))['catch'](handleError(_0x39b974,null));};exports[_0x5eb4('0x69')]=function(_0x6db6ad,_0x255735,_0x568ef4){var _0x1f520b;return db[_0x5eb4('0x47')]['find']({'where':{'id':_0x6db6ad[_0x5eb4('0x57')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5eb4('0x6a')}]})[_0x5eb4('0x2b')](handleEntityNotFound(_0x255735,null))[_0x5eb4('0x2b')](function(_0xa401c5){if(_0xa401c5){_0x1f520b=_0xa401c5;return db[_0x5eb4('0x62')][_0x5eb4('0x32')];}})[_0x5eb4('0x2b')](function(_0x38337b){if(_0x38337b){var _0x58cdfb={};var _0x3b765c={};_0x3b765c[_0x5eb4('0x34')]=_[_0x5eb4('0x6b')](_[_0x5eb4('0x36')](_0x38337b),_[_0x5eb4('0x42')](_0x1f520b[_0x5eb4('0x6a')],function(_0x1f308c){return util[_0x5eb4('0x6c')](_0x5eb4('0x6d'),_0x1f308c['id']);}));_0x3b765c[_0x5eb4('0x35')]=_['keys'](_0x6db6ad[_0x5eb4('0x35')]);_0x3b765c[_0x5eb4('0x37')]=_[_0x5eb4('0x38')](_0x3b765c[_0x5eb4('0x34')],_0x3b765c[_0x5eb4('0x35')]);_0x58cdfb[_0x5eb4('0x39')]=_[_0x5eb4('0x38')](_0x3b765c[_0x5eb4('0x34')],qs[_0x5eb4('0x3a')](_0x6db6ad['query'][_0x5eb4('0x3a')]));_0x58cdfb[_0x5eb4('0x39')]=_0x58cdfb[_0x5eb4('0x39')][_0x5eb4('0x3b')]?_0x58cdfb[_0x5eb4('0x39')]:_0x3b765c[_0x5eb4('0x34')];if(!_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x3c')]('nolimit')){_0x58cdfb[_0x5eb4('0x24')]=qs[_0x5eb4('0x24')](_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x24')]);_0x58cdfb[_0x5eb4('0x23')]=qs[_0x5eb4('0x23')](_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x23')]);}_0x58cdfb[_0x5eb4('0x5e')]=qs[_0x5eb4('0x3e')](_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x3e')]);_0x58cdfb[_0x5eb4('0x3f')]=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0x6db6ad[_0x5eb4('0x35')],_0x3b765c['filters']));_0x58cdfb[_0x5eb4('0x6e')]=!![];if(_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x41')]){_0x58cdfb[_0x5eb4('0x3f')]=_[_0x5eb4('0x45')](_0x58cdfb[_0x5eb4('0x3f')],{'$or':_[_0x5eb4('0x42')](_0x58cdfb[_0x5eb4('0x39')],function(_0x4a3b95){var _0x4a9581={};_0x4a9581[_0x4a3b95]={'$like':'%'+_0x6db6ad[_0x5eb4('0x35')][_0x5eb4('0x41')]+'%'};return _0x4a9581;})});}_0x58cdfb=_[_0x5eb4('0x45')]({},_0x58cdfb,_0x6db6ad['options']);return _0x1f520b[_0x5eb4('0x69')](_0x58cdfb);}})['then'](respondWithResult(_0x255735,null))[_0x5eb4('0x56')](handleError(_0x255735,null));};exports[_0x5eb4('0x6f')]=function(_0x1d02a8,_0x1e4d00,_0x2e9cdf){var _0x278273;return db[_0x5eb4('0x47')][_0x5eb4('0x4d')]({'where':{'id':_0x1d02a8[_0x5eb4('0x57')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5eb4('0x6a')}]})[_0x5eb4('0x2b')](handleEntityNotFound(_0x1e4d00,null))[_0x5eb4('0x2b')](function(_0x570d55){if(_0x570d55){_0x278273=_0x570d55;return db[_0x5eb4('0x62')][_0x5eb4('0x32')];}})[_0x5eb4('0x2b')](function(_0x261469){if(_0x261469){var _0x39c634={};var _0x28fe0e={};_0x28fe0e['model']=_[_0x5eb4('0x6b')](_[_0x5eb4('0x36')](_0x261469),_['map'](_0x278273[_0x5eb4('0x6a')],function(_0x26b6ce){return util[_0x5eb4('0x6c')](_0x5eb4('0x6d'),_0x26b6ce['id']);}));_0x28fe0e[_0x5eb4('0x35')]=_['keys'](_0x1d02a8['query']);_0x28fe0e[_0x5eb4('0x37')]=_['intersection'](_0x28fe0e[_0x5eb4('0x34')],_0x28fe0e['query']);_0x39c634[_0x5eb4('0x39')]=_[_0x5eb4('0x38')](_0x28fe0e[_0x5eb4('0x34')],qs['fields'](_0x1d02a8['query'][_0x5eb4('0x3a')]));_0x39c634[_0x5eb4('0x39')]=_0x39c634[_0x5eb4('0x39')][_0x5eb4('0x3b')]?_0x39c634['attributes']:_0x28fe0e[_0x5eb4('0x34')];if(!_0x1d02a8[_0x5eb4('0x35')]['hasOwnProperty']('nolimit')){_0x39c634[_0x5eb4('0x24')]=qs[_0x5eb4('0x24')](_0x1d02a8[_0x5eb4('0x35')][_0x5eb4('0x24')]);_0x39c634[_0x5eb4('0x23')]=qs[_0x5eb4('0x23')](_0x1d02a8['query'][_0x5eb4('0x23')]);}_0x39c634[_0x5eb4('0x5e')]=qs['sort'](_0x1d02a8[_0x5eb4('0x35')][_0x5eb4('0x3e')]);_0x39c634[_0x5eb4('0x3f')]=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0x1d02a8[_0x5eb4('0x35')],_0x28fe0e['filters']));_0x39c634[_0x5eb4('0x6e')]=!![];if(_0x1d02a8['query'][_0x5eb4('0x41')]){_0x39c634['where']=_[_0x5eb4('0x45')](_0x39c634[_0x5eb4('0x3f')],{'$or':_[_0x5eb4('0x42')](_0x39c634['attributes'],function(_0x7b5638){var _0x1c9c0d={};_0x1c9c0d[_0x7b5638]={'$like':'%'+_0x1d02a8['query']['filter']+'%'};return _0x1c9c0d;})});}_0x39c634=_['merge']({},_0x39c634,_0x1d02a8[_0x5eb4('0x46')]);return _0x278273['getContacts'](_0x39c634);}})[_0x5eb4('0x2b')](function(_0x47943d){if(!_[_0x5eb4('0x70')](_0x47943d)){var _0x5b0295=toCsv(_0x47943d);var _0x19e010=Date['now']();fs[_0x5eb4('0x71')](util['format'](_0x5eb4('0x72'),_0x278273['id'],_0x19e010),_0x5b0295);_0x1e4d00[_0x5eb4('0x73')](_0x5eb4('0x74'),_0x5eb4('0x75')+util[_0x5eb4('0x6c')](_0x5eb4('0x76'),_0x278273['id'],_0x19e010));_0x1e4d00[_0x5eb4('0x73')](_0x5eb4('0x77'),'text/csv');return _0x1e4d00[_0x5eb4('0x78')](util[_0x5eb4('0x6c')]('/tmp/list_%d_%s.csv',_0x278273['id'],_0x19e010));}else{return _0x1e4d00[_0x5eb4('0x1e')](0xcc);}})[_0x5eb4('0x56')](handleError(_0x1e4d00,null));};exports['addCustomField']=function(_0x3f2d2c,_0x5e9f9d,_0x53e323){var _0x2a576b;delete _0x3f2d2c[_0x5eb4('0x4f')]['id'];return db[_0x5eb4('0x47')][_0x5eb4('0x5c')]({'where':{'id':_0x3f2d2c[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x5e9f9d,null))[_0x5eb4('0x2b')](function(_0x2ae028){if(_0x2ae028){return db['sequelize'][_0x5eb4('0x79')](function(_0x512a77){return db[_0x5eb4('0x7a')]['create'](_0x3f2d2c[_0x5eb4('0x4f')],{'transaction':_0x512a77})[_0x5eb4('0x2b')](function(_0x55a43f){_0x2a576b=_0x55a43f;return _0x2ae028[_0x5eb4('0x7b')](_0x55a43f,{'transaction':_0x512a77});})[_0x5eb4('0x2b')](function(){var _0x1c3249={'type':db[_0x5eb4('0x7c')][_0x5eb4('0x7d')],'transaction':_0x512a77};switch(_0x3f2d2c[_0x5eb4('0x4f')][_0x5eb4('0x43')]){case _0x5eb4('0x7e'):_0x1c3249[_0x5eb4('0x43')]=db[_0x5eb4('0x7c')][_0x5eb4('0x7d')];break;case'number':_0x1c3249[_0x5eb4('0x43')]=db[_0x5eb4('0x7c')][_0x5eb4('0x7f')];break;case _0x5eb4('0x80'):_0x1c3249[_0x5eb4('0x43')]=db['Sequelize']['BOOLEAN'];_0x1c3249[_0x5eb4('0x81')]=![];break;default:}return db[_0x5eb4('0x82')][_0x5eb4('0x83')][_0x5eb4('0x84')]('cm_contacts',util[_0x5eb4('0x6c')](_0x5eb4('0x85'),_0x2a576b['id']),_0x1c3249);})[_0x5eb4('0x2b')](function(){return _0x2a576b;});});}})[_0x5eb4('0x2b')](respondWithResult(_0x5e9f9d,null))[_0x5eb4('0x56')](handleError(_0x5e9f9d,null));};exports['getCustomFields']=function(_0x34bbfd,_0x2c4110,_0x1748c1){var _0x34d9cd={};var _0x861fa7={};var _0x2a3d46;var _0x2487da;return db['CmList']['findOne']({'where':{'id':_0x34bbfd[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x2c4110,null))[_0x5eb4('0x2b')](function(_0x730be3){if(_0x730be3){_0x2a3d46=_0x730be3;_0x861fa7['model']=_[_0x5eb4('0x36')](db['CmCustomField'][_0x5eb4('0x32')]);_0x861fa7[_0x5eb4('0x35')]=_[_0x5eb4('0x36')](_0x34bbfd[_0x5eb4('0x35')]);_0x861fa7[_0x5eb4('0x37')]=_['intersection'](_0x861fa7[_0x5eb4('0x34')],_0x861fa7[_0x5eb4('0x35')]);_0x34d9cd[_0x5eb4('0x39')]=_[_0x5eb4('0x38')](_0x861fa7[_0x5eb4('0x34')],qs['fields'](_0x34bbfd[_0x5eb4('0x35')][_0x5eb4('0x3a')]));_0x34d9cd[_0x5eb4('0x39')]=_0x34d9cd[_0x5eb4('0x39')][_0x5eb4('0x3b')]?_0x34d9cd['attributes']:_0x861fa7[_0x5eb4('0x34')];_0x34d9cd[_0x5eb4('0x5e')]=qs[_0x5eb4('0x3e')](_0x34bbfd[_0x5eb4('0x35')][_0x5eb4('0x3e')]);_0x34d9cd['where']=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0x34bbfd[_0x5eb4('0x35')],_0x861fa7[_0x5eb4('0x37')]));_0x34d9cd[_0x5eb4('0x3f')]=_[_0x5eb4('0x45')](_0x34d9cd[_0x5eb4('0x3f')],{'$or':[{'ListId':_0x730be3['id']},{'ListId':null}]});if(_0x34bbfd[_0x5eb4('0x35')][_0x5eb4('0x41')]){_0x34d9cd['where']=_[_0x5eb4('0x45')](_0x34d9cd[_0x5eb4('0x3f')],{'$or':_['map'](_0x34d9cd[_0x5eb4('0x39')],function(_0x227aa2){var _0x7bb1d2={};_0x7bb1d2[_0x227aa2]={'$like':'%'+_0x34bbfd[_0x5eb4('0x35')]['filter']+'%'};return _0x7bb1d2;})});}_0x34d9cd=_[_0x5eb4('0x45')]({},_0x34d9cd,_0x34bbfd[_0x5eb4('0x46')]);return db['CmCustomField'][_0x5eb4('0x86')](_0x34d9cd);}})[_0x5eb4('0x2b')](respondWithResult(_0x2c4110,null))[_0x5eb4('0x56')](handleError(_0x2c4110,null));};exports[_0x5eb4('0x87')]=function(_0xb86e9c,_0xa31e21,_0x93c4ad){return db['CmList'][_0x5eb4('0x4d')]({'where':{'id':_0xb86e9c[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0xa31e21,null))[_0x5eb4('0x2b')](function(_0x14d831){if(_0x14d831){return _0x14d831[_0x5eb4('0x87')](_0xb86e9c[_0x5eb4('0x4f')]['ids'],_['omit'](_0xb86e9c[_0x5eb4('0x4f')],[_0x5eb4('0x60'),'id'])||{})[_0x5eb4('0x88')](function(_0x398dc3){for(var _0x3c4a57=0x0;_0x3c4a57<_0xb86e9c['body'][_0x5eb4('0x60')][_0x5eb4('0x3b')];_0x3c4a57+=0x1){socket[_0x5eb4('0x89')](_0x5eb4('0x8a'),{'UserId':_0xb86e9c[_0x5eb4('0x4f')][_0x5eb4('0x60')][_0x3c4a57],'CmListId':_0xb86e9c[_0x5eb4('0x57')]['id']});}return _0x398dc3;});}})[_0x5eb4('0x2b')](respondWithResult(_0xa31e21,null))[_0x5eb4('0x56')](handleError(_0xa31e21,null));};exports[_0x5eb4('0x8b')]=function(_0x26eec8,_0x283568,_0x59d351){return db[_0x5eb4('0x47')][_0x5eb4('0x4d')]({'where':{'id':_0x26eec8[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x283568,null))[_0x5eb4('0x2b')](function(_0xbe7ae2){if(_0xbe7ae2){return _0xbe7ae2[_0x5eb4('0x8b')](_0x26eec8['query'][_0x5eb4('0x60')])[_0x5eb4('0x2b')](function(){if(_[_0x5eb4('0x65')](_0x26eec8['query'][_0x5eb4('0x60')])){for(var _0x23c98f=0x0;_0x23c98f<_0x26eec8[_0x5eb4('0x35')]['ids'][_0x5eb4('0x3b')];_0x23c98f+=0x1){socket[_0x5eb4('0x89')]('userCmList:remove',{'UserId':Number(_0x26eec8[_0x5eb4('0x35')][_0x5eb4('0x60')][_0x23c98f]),'CmListId':Number(_0x26eec8[_0x5eb4('0x57')]['id'])});}}else{socket[_0x5eb4('0x89')](_0x5eb4('0x8c'),{'UserId':Number(_0x26eec8[_0x5eb4('0x35')][_0x5eb4('0x60')]),'CmListId':Number(_0x26eec8[_0x5eb4('0x57')]['id'])});}});}})[_0x5eb4('0x2b')](respondWithStatusCode(_0x283568,null))[_0x5eb4('0x56')](handleError(_0x283568,null));};exports[_0x5eb4('0x8d')]=function(_0x2cdbee,_0x923cd5,_0x548b12){var _0xdd3528={};var _0x223e31={};var _0x1a1855;var _0x610f65;return db[_0x5eb4('0x47')][_0x5eb4('0x5c')]({'where':{'id':_0x2cdbee[_0x5eb4('0x57')]['id']}})[_0x5eb4('0x2b')](handleEntityNotFound(_0x923cd5,null))[_0x5eb4('0x2b')](function(_0x2063ff){if(_0x2063ff){_0x1a1855=_0x2063ff;_0x223e31[_0x5eb4('0x34')]=_['keys'](db['User'][_0x5eb4('0x32')]);_0x223e31['query']=_[_0x5eb4('0x36')](_0x2cdbee[_0x5eb4('0x35')]);_0x223e31['filters']=_[_0x5eb4('0x38')](_0x223e31[_0x5eb4('0x34')],_0x223e31[_0x5eb4('0x35')]);_0xdd3528[_0x5eb4('0x39')]=_[_0x5eb4('0x38')](_0x223e31[_0x5eb4('0x34')],qs[_0x5eb4('0x3a')](_0x2cdbee[_0x5eb4('0x35')][_0x5eb4('0x3a')]));_0xdd3528[_0x5eb4('0x39')]=_0xdd3528['attributes'][_0x5eb4('0x3b')]?_0xdd3528[_0x5eb4('0x39')]:_0x223e31[_0x5eb4('0x34')];_0xdd3528[_0x5eb4('0x5e')]=qs[_0x5eb4('0x3e')](_0x2cdbee['query'][_0x5eb4('0x3e')]);_0xdd3528[_0x5eb4('0x3f')]=qs[_0x5eb4('0x37')](_[_0x5eb4('0x40')](_0x2cdbee[_0x5eb4('0x35')],_0x223e31['filters']));if(_0x2cdbee[_0x5eb4('0x35')][_0x5eb4('0x41')]){_0xdd3528[_0x5eb4('0x3f')]=_[_0x5eb4('0x45')](_0xdd3528['where'],{'$or':_[_0x5eb4('0x42')](_0xdd3528[_0x5eb4('0x39')],function(_0x1d88a7){var _0x116b5a={};_0x116b5a[_0x1d88a7]={'$like':'%'+_0x2cdbee['query']['filter']+'%'};return _0x116b5a;})});}_0xdd3528=_[_0x5eb4('0x45')]({},_0xdd3528,_0x2cdbee['options']);return _0x1a1855[_0x5eb4('0x8d')](_0xdd3528);}})[_0x5eb4('0x2b')](function(_0x434f73){if(_0x434f73){_0x610f65=_0x434f73[_0x5eb4('0x3b')];if(!_0x2cdbee[_0x5eb4('0x35')][_0x5eb4('0x3c')](_0x5eb4('0x3d'))){_0xdd3528[_0x5eb4('0x24')]=qs[_0x5eb4('0x24')](_0x2cdbee[_0x5eb4('0x35')][_0x5eb4('0x24')]);_0xdd3528[_0x5eb4('0x23')]=qs[_0x5eb4('0x23')](_0x2cdbee['query'][_0x5eb4('0x23')]);}return _0x1a1855['getAgents'](_0xdd3528);}})[_0x5eb4('0x2b')](function(_0x1adfd0){if(_0x1adfd0){return _0x1adfd0?{'count':_0x610f65,'rows':_0x1adfd0}:null;}})['then'](respondWithResult(_0x923cd5,null))[_0x5eb4('0x56')](handleError(_0x923cd5,null));}; \ No newline at end of file +var _0x9627=['localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Lists','end','error','stack','name','index','CmList','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','count','removeDispositions','CmContact','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','getContactsCsv','cf_%d','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','number','switch','BOOLEAN','queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9627,0x79));var _0x7962=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x9627[_0x88cd7b];return _0x56fcc8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7962('0x0'));var zipdir=require(_0x7962('0x1'));var jsonpatch=require(_0x7962('0x2'));var rp=require(_0x7962('0x3'));var moment=require(_0x7962('0x4'));var BPromise=require(_0x7962('0x5'));var Mustache=require(_0x7962('0x6'));var util=require(_0x7962('0x7'));var path=require(_0x7962('0x8'));var sox=require(_0x7962('0x9'));var csv=require(_0x7962('0xa'));var ejs=require(_0x7962('0xb'));var fs=require('fs');var _=require(_0x7962('0xc'));var squel=require(_0x7962('0xd'));var crypto=require('crypto');var jsforce=require(_0x7962('0xe'));var deskjs=require(_0x7962('0xf'));var toCsv=require(_0x7962('0xa'));var querystring=require(_0x7962('0x10'));var Papa=require(_0x7962('0x11'));var Redis=require(_0x7962('0x12'));var authService=require(_0x7962('0x13'));var qs=require(_0x7962('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7962('0x15'));var logger=require(_0x7962('0x16'))('api');var utils=require(_0x7962('0x17'));var config=require(_0x7962('0x18'));var db=require('../../mysqldb')['db'];config[_0x7962('0x19')]=_[_0x7962('0x1a')](config['redis'],{'host':_0x7962('0x1b'),'port':0x18eb});var socket=require(_0x7962('0x1c'))(new Redis(config[_0x7962('0x19')]));require(_0x7962('0x1d'))[_0x7962('0x1e')](socket);function respondWithStatusCode(_0x16fa13,_0x3d8750){_0x3d8750=_0x3d8750||0xcc;return function(_0x37a360){if(_0x37a360){return _0x16fa13[_0x7962('0x1f')](_0x3d8750);}return _0x16fa13[_0x7962('0x20')](_0x3d8750)['end']();};}function respondWithResult(_0x292829,_0x21a7d2){_0x21a7d2=_0x21a7d2||0xc8;return function(_0xbd1ab1){if(_0xbd1ab1){return _0x292829[_0x7962('0x20')](_0x21a7d2)[_0x7962('0x21')](_0xbd1ab1);}};}function respondWithFilteredResult(_0x43595d,_0x25b66d){return function(_0x445561){if(_0x445561){var _0x193fa9=_0x445561['count'],_0x1f9e4b=_0x25b66d[_0x7962('0x22')],_0x29592a=_0x25b66d[_0x7962('0x22')]+_0x25b66d[_0x7962('0x23')],_0x52ad26;if(_0x29592a>=_0x193fa9){_0x29592a=_0x193fa9;_0x52ad26=0xc8;}else{_0x52ad26=0xce;}_0x43595d[_0x7962('0x20')](_0x52ad26);return _0x43595d['set'](_0x7962('0x24'),_0x1f9e4b+'-'+_0x29592a+'/'+_0x193fa9)[_0x7962('0x21')](_0x445561);}return null;};}function patchUpdates(_0x5b86d2){return function(_0x3fb9c4){try{jsonpatch[_0x7962('0x25')](_0x3fb9c4,_0x5b86d2,!![]);}catch(_0x2599c1){return BPromise[_0x7962('0x26')](_0x2599c1);}return _0x3fb9c4[_0x7962('0x27')]();};}function saveUpdates(_0x2c37a6,_0x39bfd2){return function(_0x2253e0){if(_0x2253e0){return _0x2253e0[_0x7962('0x28')](_0x2c37a6)[_0x7962('0x29')](function(_0x1760b0){return _0x1760b0;});}return null;};}function removeEntity(_0x2d4081,_0x156b24){return function(_0x53ec8b){if(_0x53ec8b){return _0x53ec8b[_0x7962('0x2a')]()['then'](function(){var _0x4dc36b=_0x53ec8b['get']({'plain':!![]});var _0x2e7c65=_0x7962('0x2b');return db['UserProfileResource'][_0x7962('0x2a')]({'where':{'type':_0x2e7c65,'resourceId':_0x4dc36b['id']}})[_0x7962('0x29')](function(){return _0x53ec8b;});})['then'](function(){_0x2d4081['status'](0xcc)[_0x7962('0x2c')]();});}};}function handleEntityNotFound(_0x16b3f0,_0x4e8e8b){return function(_0x57c90f){if(!_0x57c90f){_0x16b3f0[_0x7962('0x1f')](0x194);}return _0x57c90f;};}function handleError(_0x15c904,_0x4f21fe){_0x4f21fe=_0x4f21fe||0x1f4;return function(_0x122721){logger[_0x7962('0x2d')](_0x122721[_0x7962('0x2e')]);if(_0x122721['name']){delete _0x122721[_0x7962('0x2f')];}_0x15c904[_0x7962('0x20')](_0x4f21fe)['send'](_0x122721);};}exports[_0x7962('0x30')]=function(_0x5ec795,_0x57363f){var _0x564864={},_0x22a82a={},_0x13124b={'count':0x0,'rows':[]};var _0x282af9=_['map'](db[_0x7962('0x31')][_0x7962('0x32')],function(_0x4ca82e){return{'name':_0x4ca82e[_0x7962('0x33')],'type':_0x4ca82e['type']['key']};});_0x22a82a[_0x7962('0x34')]=_[_0x7962('0x35')](_0x282af9,_0x7962('0x2f'));_0x22a82a[_0x7962('0x36')]=_[_0x7962('0x37')](_0x5ec795[_0x7962('0x36')]);_0x22a82a['filters']=_[_0x7962('0x38')](_0x22a82a[_0x7962('0x34')],_0x22a82a[_0x7962('0x36')]);_0x564864[_0x7962('0x39')]=_[_0x7962('0x38')](_0x22a82a[_0x7962('0x34')],qs[_0x7962('0x3a')](_0x5ec795['query'][_0x7962('0x3a')]));_0x564864[_0x7962('0x39')]=_0x564864[_0x7962('0x39')][_0x7962('0x3b')]?_0x564864['attributes']:_0x22a82a['model'];if(!_0x5ec795[_0x7962('0x36')][_0x7962('0x3c')](_0x7962('0x3d'))){_0x564864[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x5ec795[_0x7962('0x36')][_0x7962('0x23')]);_0x564864['offset']=qs['offset'](_0x5ec795[_0x7962('0x36')]['offset']);}_0x564864[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0x5ec795['query'][_0x7962('0x3f')]);_0x564864[_0x7962('0x40')]=qs[_0x7962('0x41')](_[_0x7962('0x42')](_0x5ec795[_0x7962('0x36')],_0x22a82a[_0x7962('0x41')]),_0x282af9);if(_0x5ec795[_0x7962('0x36')][_0x7962('0x43')]){_0x564864['where']=_[_0x7962('0x44')](_0x564864['where'],{'$or':_[_0x7962('0x35')](_0x282af9,function(_0x33e0ef){if(_0x33e0ef['type']!==_0x7962('0x45')){var _0x142050={};_0x142050[_0x33e0ef['name']]={'$like':'%'+_0x5ec795['query'][_0x7962('0x43')]+'%'};return _0x142050;}})});}_0x564864=_['merge']({},_0x564864,_0x5ec795[_0x7962('0x46')]);var _0x5169c9={'where':_0x564864[_0x7962('0x40')]};return db[_0x7962('0x31')]['count'](_0x5169c9)[_0x7962('0x29')](function(_0x4571a7){_0x13124b['count']=_0x4571a7;if(_0x5ec795['query'][_0x7962('0x47')]){_0x564864['include']=[{'all':!![]}];}return db[_0x7962('0x31')][_0x7962('0x48')](_0x564864);})[_0x7962('0x29')](function(_0x5d08a6){_0x13124b[_0x7962('0x49')]=_0x5d08a6;return _0x13124b;})[_0x7962('0x29')](respondWithFilteredResult(_0x57363f,_0x564864))[_0x7962('0x4a')](handleError(_0x57363f,null));};exports[_0x7962('0x4b')]=function(_0x1c464c,_0x2fce5e){var _0x125aa1={'raw':![],'where':{'id':_0x1c464c[_0x7962('0x4c')]['id']}},_0x1d8046={};_0x1d8046[_0x7962('0x34')]=_[_0x7962('0x37')](db[_0x7962('0x31')][_0x7962('0x32')]);_0x1d8046[_0x7962('0x36')]=_[_0x7962('0x37')](_0x1c464c[_0x7962('0x36')]);_0x1d8046[_0x7962('0x41')]=_[_0x7962('0x38')](_0x1d8046[_0x7962('0x34')],_0x1d8046[_0x7962('0x36')]);_0x125aa1['attributes']=_[_0x7962('0x38')](_0x1d8046[_0x7962('0x34')],qs[_0x7962('0x3a')](_0x1c464c['query'][_0x7962('0x3a')]));_0x125aa1[_0x7962('0x39')]=_0x125aa1[_0x7962('0x39')][_0x7962('0x3b')]?_0x125aa1[_0x7962('0x39')]:_0x1d8046[_0x7962('0x34')];if(_0x1c464c[_0x7962('0x36')]['includeAll']){_0x125aa1[_0x7962('0x4d')]=[{'all':!![]}];}_0x125aa1=_['merge']({},_0x125aa1,_0x1c464c[_0x7962('0x46')]);return db[_0x7962('0x31')][_0x7962('0x4e')](_0x125aa1)[_0x7962('0x29')](handleEntityNotFound(_0x2fce5e,null))['then'](respondWithResult(_0x2fce5e,null))['catch'](handleError(_0x2fce5e,null));};exports[_0x7962('0x4f')]=function(_0x47c9ed,_0x4a287a){return db[_0x7962('0x31')]['create'](_0x47c9ed[_0x7962('0x50')],{})[_0x7962('0x29')](function(_0x1d8480){var _0x4a0e9d=_0x47c9ed['user']['get']({'plain':!![]});if(!_0x4a0e9d)throw new Error(_0x7962('0x51'));if(_0x4a0e9d[_0x7962('0x52')]===_0x7962('0x53')){var _0x2d92f9=_0x1d8480[_0x7962('0x54')]({'plain':!![]});var _0x138c84=_0x7962('0x2b');return db[_0x7962('0x55')]['find']({'where':{'name':_0x138c84,'userProfileId':_0x4a0e9d[_0x7962('0x56')]},'raw':!![]})[_0x7962('0x29')](function(_0x3fc3b7){if(_0x3fc3b7&&_0x3fc3b7['autoAssociation']===0x0){return db[_0x7962('0x57')][_0x7962('0x4f')]({'name':_0x2d92f9[_0x7962('0x2f')],'resourceId':_0x2d92f9['id'],'type':_0x3fc3b7[_0x7962('0x2f')],'sectionId':_0x3fc3b7['id']},{})[_0x7962('0x29')](function(){return _0x1d8480;});}else{return _0x1d8480;}})[_0x7962('0x4a')](function(_0x4e0199){logger[_0x7962('0x2d')](_0x7962('0x58'),_0x4e0199);throw _0x4e0199;});}return _0x1d8480;})[_0x7962('0x29')](respondWithResult(_0x4a287a,0xc9))[_0x7962('0x4a')](handleError(_0x4a287a,null));};exports[_0x7962('0x28')]=function(_0x4c48c8,_0x60ccac){if(_0x4c48c8['body']['id']){delete _0x4c48c8['body']['id'];}return db['CmList'][_0x7962('0x4e')]({'where':{'id':_0x4c48c8[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x60ccac,null))['then'](saveUpdates(_0x4c48c8[_0x7962('0x50')],null))[_0x7962('0x29')](respondWithResult(_0x60ccac,null))[_0x7962('0x4a')](handleError(_0x60ccac,null));};exports['destroy']=function(_0x386687,_0x51e2f8){return db[_0x7962('0x31')][_0x7962('0x4e')]({'where':{'id':_0x386687[_0x7962('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51e2f8,null))['then'](removeEntity(_0x51e2f8,null))[_0x7962('0x4a')](handleError(_0x51e2f8,null));};exports[_0x7962('0x59')]=function(_0x560e83,_0x4cff91){return db['CmList'][_0x7962('0x59')]()[_0x7962('0x29')](respondWithResult(_0x4cff91,null))[_0x7962('0x4a')](handleError(_0x4cff91,null));};exports[_0x7962('0x5a')]=function(_0xf53f0a,_0xe6b918,_0x62faf8){if(_0xf53f0a[_0x7962('0x50')]['id']){delete _0xf53f0a['body']['id'];}return db[_0x7962('0x31')][_0x7962('0x4e')]({'where':{'id':_0xf53f0a[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0xe6b918,null))[_0x7962('0x29')](function(_0x28e353){if(_0x28e353){_0xf53f0a['body'][_0x7962('0x5b')]=_0x28e353['id'];return db[_0x7962('0x5c')][_0x7962('0x4f')](_0xf53f0a[_0x7962('0x50')]);}})[_0x7962('0x29')](respondWithResult(_0xe6b918,null))[_0x7962('0x4a')](handleError(_0xe6b918,null));};exports[_0x7962('0x5d')]=function(_0x35ac76,_0x4f3dab,_0x17f73d){var _0x4c78dc={'raw':![],'where':{}};var _0x4f964b={};var _0x23a09f={'count':0x0,'rows':[]};return db[_0x7962('0x31')][_0x7962('0x5e')]({'where':{'id':_0x35ac76['params']['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x4f3dab,null))[_0x7962('0x29')](function(_0x10f043){if(_0x10f043){_0x4f964b['model']=_[_0x7962('0x37')](db[_0x7962('0x5c')][_0x7962('0x32')]);_0x4f964b['query']=_[_0x7962('0x37')](_0x35ac76[_0x7962('0x36')]);_0x4f964b[_0x7962('0x41')]=_[_0x7962('0x38')](_0x4f964b['model'],_0x4f964b[_0x7962('0x36')]);_0x4c78dc[_0x7962('0x39')]=_['intersection'](_0x4f964b[_0x7962('0x34')],qs[_0x7962('0x3a')](_0x35ac76[_0x7962('0x36')][_0x7962('0x3a')]));_0x4c78dc[_0x7962('0x39')]=_0x4c78dc[_0x7962('0x39')][_0x7962('0x3b')]?_0x4c78dc['attributes']:_0x4f964b[_0x7962('0x34')];if(!_0x35ac76[_0x7962('0x36')][_0x7962('0x3c')]('nolimit')){_0x4c78dc[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x35ac76['query'][_0x7962('0x23')]);_0x4c78dc['offset']=qs[_0x7962('0x22')](_0x35ac76[_0x7962('0x36')][_0x7962('0x22')]);}_0x4c78dc[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0x35ac76[_0x7962('0x36')][_0x7962('0x3f')]);_0x4c78dc[_0x7962('0x40')]=qs[_0x7962('0x41')](_[_0x7962('0x42')](_0x35ac76['query'],_0x4f964b[_0x7962('0x41')]));_0x4c78dc['where'][_0x7962('0x5b')]=_0x10f043['id'];if(_0x35ac76['query'][_0x7962('0x43')]){_0x4c78dc[_0x7962('0x40')]=_[_0x7962('0x44')](_0x4c78dc['where'],{'$or':_[_0x7962('0x35')](_0x4c78dc[_0x7962('0x39')],function(_0x82a8ae){var _0x31e89d={};_0x31e89d[_0x82a8ae]={'$like':'%'+_0x35ac76[_0x7962('0x36')][_0x7962('0x43')]+'%'};return _0x31e89d;})});}_0x4c78dc=_[_0x7962('0x44')]({},_0x4c78dc,_0x35ac76['options']);return db[_0x7962('0x5c')][_0x7962('0x5f')]({'where':_0x4c78dc[_0x7962('0x40')]})[_0x7962('0x29')](function(_0x529831){_0x23a09f[_0x7962('0x5f')]=_0x529831;if(_0x35ac76['query'][_0x7962('0x47')]){_0x4c78dc[_0x7962('0x4d')]=[{'all':!![]}];}return db[_0x7962('0x5c')][_0x7962('0x48')](_0x4c78dc);})['then'](function(_0x33b51c){_0x23a09f[_0x7962('0x49')]=_0x33b51c;return _0x23a09f;});}})[_0x7962('0x29')](respondWithFilteredResult(_0x4f3dab,_0x4c78dc))[_0x7962('0x4a')](handleError(_0x4f3dab,null));};exports[_0x7962('0x60')]=function(_0x29f003,_0xbebdd2,_0x118813){return db['CmList'][_0x7962('0x4e')]({'where':{'id':_0x29f003[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0xbebdd2,null))[_0x7962('0x29')](function(_0x306b10){if(_0x306b10){return _0x306b10[_0x7962('0x60')](_0x29f003[_0x7962('0x36')]['ids']);}})[_0x7962('0x29')](respondWithStatusCode(_0xbebdd2,null))[_0x7962('0x4a')](handleError(_0xbebdd2,null));};exports['addContacts']=function(_0x410c0d,_0x2fd666,_0x4e1b71){return db[_0x7962('0x31')][_0x7962('0x4e')]({'where':{'id':_0x410c0d['params']['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x2fd666,null))[_0x7962('0x29')](function(_0x1b7e31){if(_0x1b7e31){var _0x799af9=[];var _0x176d01={'success':[],'errors':[]};return db[_0x7962('0x61')][_0x7962('0x59')]()[_0x7962('0x29')](function(_0x4d964f){if(_0x410c0d[_0x7962('0x50')][_0x7962('0x62')]&&_[_0x7962('0x63')](_0x410c0d[_0x7962('0x50')]['tags'])){if(_0x410c0d[_0x7962('0x50')][_0x7962('0x62')][_0x7962('0x3b')]){_0x410c0d[_0x7962('0x50')]['tags']=_0x410c0d[_0x7962('0x50')][_0x7962('0x62')][_0x7962('0x64')](';')+';';}else{_0x410c0d['body'][_0x7962('0x62')]=null;}}else{_0x410c0d[_0x7962('0x50')][_0x7962('0x62')]=null;}if(_0x410c0d['body']&&_[_0x7962('0x63')](_0x410c0d['body'])){for(var _0xda44c=0x0;_0xda44c<_0x410c0d[_0x7962('0x50')][_0x7962('0x3b')];_0xda44c+=0x1){_0x410c0d[_0x7962('0x50')][_0xda44c][_0x7962('0x5b')]=_0x410c0d[_0x7962('0x4c')]['id'];_0x799af9[_0x7962('0x65')](_0x410c0d[_0x7962('0x50')][_0xda44c]);}return BPromise[_0x7962('0x66')](_0x799af9,function(_0xc96f3c){return db[_0x7962('0x61')]['create'](_[_0x7962('0x67')](_0xc96f3c,['ids','id'])||{},{'fields':_['keys'](_0x4d964f),'raw':!![]})[_0x7962('0x29')](function(_0xb6f256){_0x176d01[_0x7962('0x68')]['push'](_0xb6f256[_0x7962('0x69')]);})[_0x7962('0x4a')](function(_0xb155c8){_0x176d01['errors']['push']({'data':_0xc96f3c,'error':_0xb155c8[_0x7962('0x6a')]});});})['then'](function(_0x24c3c3){return _0x176d01;})[_0x7962('0x4a')](function(_0x3d569d){return _0x3d569d;});}else{_0x2fd666[_0x7962('0x20')](0x190)[_0x7962('0x21')]({'message':_0x7962('0x6b')});}});}})[_0x7962('0x29')](respondWithResult(_0x2fd666,null))['catch'](handleError(_0x2fd666,null));};exports[_0x7962('0x6c')]=function(_0xc4d0b7,_0x3153b8,_0x36422d){var _0xf503b;return db[_0x7962('0x31')][_0x7962('0x4e')]({'where':{'id':_0xc4d0b7['params']['id']},'include':[{'model':db[_0x7962('0x6d')],'as':'CustomFields'}]})[_0x7962('0x29')](handleEntityNotFound(_0x3153b8,null))[_0x7962('0x29')](function(_0x173677){if(_0x173677){_0xf503b=_0x173677;return db[_0x7962('0x61')][_0x7962('0x32')];}})['then'](function(_0x2d3be7){if(_0x2d3be7){var _0x57f22a={};var _0xc08ea2={};_0xc08ea2['model']=_['concat'](_[_0x7962('0x37')](_0x2d3be7),_[_0x7962('0x35')](_0xf503b[_0x7962('0x6e')],function(_0x83cb47){return util[_0x7962('0x6f')]('cf_%d',_0x83cb47['id']);}));_0xc08ea2[_0x7962('0x36')]=_[_0x7962('0x37')](_0xc4d0b7[_0x7962('0x36')]);_0xc08ea2['filters']=_['intersection'](_0xc08ea2['model'],_0xc08ea2['query']);_0x57f22a[_0x7962('0x39')]=_[_0x7962('0x38')](_0xc08ea2['model'],qs['fields'](_0xc4d0b7[_0x7962('0x36')][_0x7962('0x3a')]));_0x57f22a['attributes']=_0x57f22a[_0x7962('0x39')]['length']?_0x57f22a['attributes']:_0xc08ea2['model'];if(!_0xc4d0b7[_0x7962('0x36')][_0x7962('0x3c')](_0x7962('0x3d'))){_0x57f22a['limit']=qs[_0x7962('0x23')](_0xc4d0b7[_0x7962('0x36')][_0x7962('0x23')]);_0x57f22a[_0x7962('0x22')]=qs[_0x7962('0x22')](_0xc4d0b7[_0x7962('0x36')][_0x7962('0x22')]);}_0x57f22a[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0xc4d0b7[_0x7962('0x36')]['sort']);_0x57f22a[_0x7962('0x40')]=qs['filters'](_[_0x7962('0x42')](_0xc4d0b7[_0x7962('0x36')],_0xc08ea2[_0x7962('0x41')]));_0x57f22a['raw']=!![];if(_0xc4d0b7['query'][_0x7962('0x43')]){_0x57f22a[_0x7962('0x40')]=_['merge'](_0x57f22a[_0x7962('0x40')],{'$or':_[_0x7962('0x35')](_0x57f22a[_0x7962('0x39')],function(_0x42d305){var _0x2c9765={};_0x2c9765[_0x42d305]={'$like':'%'+_0xc4d0b7['query'][_0x7962('0x43')]+'%'};return _0x2c9765;})});}_0x57f22a=_['merge']({},_0x57f22a,_0xc4d0b7[_0x7962('0x46')]);return _0xf503b['getContacts'](_0x57f22a);}})[_0x7962('0x29')](respondWithResult(_0x3153b8,null))[_0x7962('0x4a')](handleError(_0x3153b8,null));};exports[_0x7962('0x70')]=function(_0x3ab24e,_0x411333,_0x953eca){var _0x57a2ff;return db['CmList'][_0x7962('0x4e')]({'where':{'id':_0x3ab24e[_0x7962('0x4c')]['id']},'include':[{'model':db[_0x7962('0x6d')],'as':_0x7962('0x6e')}]})['then'](handleEntityNotFound(_0x411333,null))[_0x7962('0x29')](function(_0x42f984){if(_0x42f984){_0x57a2ff=_0x42f984;return db[_0x7962('0x61')][_0x7962('0x32')];}})[_0x7962('0x29')](function(_0x2e4fb9){if(_0x2e4fb9){var _0x571190={};var _0x373946={};_0x373946['model']=_['concat'](_['keys'](_0x2e4fb9),_[_0x7962('0x35')](_0x57a2ff[_0x7962('0x6e')],function(_0x1771bf){return util[_0x7962('0x6f')](_0x7962('0x71'),_0x1771bf['id']);}));_0x373946[_0x7962('0x36')]=_['keys'](_0x3ab24e['query']);_0x373946[_0x7962('0x41')]=_['intersection'](_0x373946['model'],_0x373946[_0x7962('0x36')]);_0x571190[_0x7962('0x39')]=_[_0x7962('0x38')](_0x373946['model'],qs[_0x7962('0x3a')](_0x3ab24e[_0x7962('0x36')][_0x7962('0x3a')]));_0x571190[_0x7962('0x39')]=_0x571190['attributes'][_0x7962('0x3b')]?_0x571190['attributes']:_0x373946[_0x7962('0x34')];if(!_0x3ab24e['query'][_0x7962('0x3c')](_0x7962('0x3d'))){_0x571190[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x3ab24e[_0x7962('0x36')]['limit']);_0x571190[_0x7962('0x22')]=qs['offset'](_0x3ab24e['query'][_0x7962('0x22')]);}_0x571190[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0x3ab24e[_0x7962('0x36')][_0x7962('0x3f')]);_0x571190['where']=qs[_0x7962('0x41')](_[_0x7962('0x42')](_0x3ab24e[_0x7962('0x36')],_0x373946[_0x7962('0x41')]));_0x571190[_0x7962('0x72')]=!![];if(_0x3ab24e[_0x7962('0x36')][_0x7962('0x43')]){_0x571190['where']=_[_0x7962('0x44')](_0x571190[_0x7962('0x40')],{'$or':_['map'](_0x571190[_0x7962('0x39')],function(_0x177689){var _0x673577={};_0x673577[_0x177689]={'$like':'%'+_0x3ab24e['query'][_0x7962('0x43')]+'%'};return _0x673577;})});}_0x571190=_[_0x7962('0x44')]({},_0x571190,_0x3ab24e['options']);return _0x57a2ff['getContacts'](_0x571190);}})[_0x7962('0x29')](function(_0x470b5e){if(!_[_0x7962('0x73')](_0x470b5e)){var _0x80bbb7=toCsv(_0x470b5e);var _0x4410ba=Date[_0x7962('0x74')]();fs[_0x7962('0x75')](util[_0x7962('0x6f')](_0x7962('0x76'),_0x57a2ff['id'],_0x4410ba),_0x80bbb7);_0x411333[_0x7962('0x77')](_0x7962('0x78'),_0x7962('0x79')+util[_0x7962('0x6f')](_0x7962('0x7a'),_0x57a2ff['id'],_0x4410ba));_0x411333[_0x7962('0x77')](_0x7962('0x7b'),_0x7962('0x7c'));return _0x411333[_0x7962('0x7d')](util[_0x7962('0x6f')](_0x7962('0x76'),_0x57a2ff['id'],_0x4410ba));}else{return _0x411333['sendStatus'](0xcc);}})[_0x7962('0x4a')](handleError(_0x411333,null));};exports[_0x7962('0x7e')]=function(_0x45c716,_0x2dc395,_0x2fb936){var _0x29ab90;delete _0x45c716[_0x7962('0x50')]['id'];return db['CmList'][_0x7962('0x5e')]({'where':{'id':_0x45c716[_0x7962('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dc395,null))[_0x7962('0x29')](function(_0x365eba){if(_0x365eba){return db[_0x7962('0x7f')][_0x7962('0x80')](function(_0x3b66e5){return db[_0x7962('0x6d')][_0x7962('0x4f')](_0x45c716[_0x7962('0x50')],{'transaction':_0x3b66e5})[_0x7962('0x29')](function(_0xa50432){_0x29ab90=_0xa50432;return _0x365eba[_0x7962('0x81')](_0xa50432,{'transaction':_0x3b66e5});})[_0x7962('0x29')](function(){var _0x56e909={'type':db[_0x7962('0x82')][_0x7962('0x83')],'transaction':_0x3b66e5};switch(_0x45c716[_0x7962('0x50')]['type']){case'text':_0x56e909[_0x7962('0x84')]=db[_0x7962('0x82')][_0x7962('0x83')];break;case _0x7962('0x85'):_0x56e909[_0x7962('0x84')]=db[_0x7962('0x82')]['INTEGER'];break;case _0x7962('0x86'):_0x56e909[_0x7962('0x84')]=db[_0x7962('0x82')][_0x7962('0x87')];_0x56e909['defaultValue']=![];break;default:}return db[_0x7962('0x7f')][_0x7962('0x88')]['addColumn'](_0x7962('0x89'),util[_0x7962('0x6f')](_0x7962('0x8a'),_0x29ab90['id']),_0x56e909);})[_0x7962('0x29')](function(){return _0x29ab90;});});}})[_0x7962('0x29')](respondWithResult(_0x2dc395,null))[_0x7962('0x4a')](handleError(_0x2dc395,null));};exports['getCustomFields']=function(_0x145154,_0x5404f9,_0x53558b){var _0x566502={};var _0x29116b={};var _0x22e7ea;var _0x507c79;return db[_0x7962('0x31')]['findOne']({'where':{'id':_0x145154[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x5404f9,null))[_0x7962('0x29')](function(_0x26e97f){if(_0x26e97f){_0x22e7ea=_0x26e97f;_0x29116b[_0x7962('0x34')]=_[_0x7962('0x37')](db['CmCustomField']['rawAttributes']);_0x29116b['query']=_[_0x7962('0x37')](_0x145154[_0x7962('0x36')]);_0x29116b[_0x7962('0x41')]=_[_0x7962('0x38')](_0x29116b['model'],_0x29116b[_0x7962('0x36')]);_0x566502['attributes']=_[_0x7962('0x38')](_0x29116b[_0x7962('0x34')],qs[_0x7962('0x3a')](_0x145154['query'][_0x7962('0x3a')]));_0x566502[_0x7962('0x39')]=_0x566502[_0x7962('0x39')][_0x7962('0x3b')]?_0x566502[_0x7962('0x39')]:_0x29116b[_0x7962('0x34')];_0x566502[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0x145154[_0x7962('0x36')][_0x7962('0x3f')]);_0x566502[_0x7962('0x40')]=qs[_0x7962('0x41')](_[_0x7962('0x42')](_0x145154['query'],_0x29116b[_0x7962('0x41')]));_0x566502['where']=_['merge'](_0x566502[_0x7962('0x40')],{'$or':[{'ListId':_0x26e97f['id']},{'ListId':null}]});if(_0x145154[_0x7962('0x36')][_0x7962('0x43')]){_0x566502[_0x7962('0x40')]=_[_0x7962('0x44')](_0x566502[_0x7962('0x40')],{'$or':_[_0x7962('0x35')](_0x566502[_0x7962('0x39')],function(_0x555fe3){var _0x29bc26={};_0x29bc26[_0x555fe3]={'$like':'%'+_0x145154[_0x7962('0x36')][_0x7962('0x43')]+'%'};return _0x29bc26;})});}_0x566502=_['merge']({},_0x566502,_0x145154[_0x7962('0x46')]);return db['CmCustomField'][_0x7962('0x8b')](_0x566502);}})['then'](respondWithResult(_0x5404f9,null))[_0x7962('0x4a')](handleError(_0x5404f9,null));};exports[_0x7962('0x8c')]=function(_0x52cdf9,_0x5ebcab,_0x22cadd){return db['CmList'][_0x7962('0x4e')]({'where':{'id':_0x52cdf9[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x5ebcab,null))[_0x7962('0x29')](function(_0x37f4f6){if(_0x37f4f6){return _0x37f4f6[_0x7962('0x8c')](_0x52cdf9['body'][_0x7962('0x8d')],_[_0x7962('0x67')](_0x52cdf9[_0x7962('0x50')],[_0x7962('0x8d'),'id'])||{})[_0x7962('0x8e')](function(_0x1fe4ab){for(var _0x430d3b=0x0;_0x430d3b<_0x52cdf9['body'][_0x7962('0x8d')][_0x7962('0x3b')];_0x430d3b+=0x1){socket[_0x7962('0x8f')](_0x7962('0x90'),{'UserId':_0x52cdf9['body']['ids'][_0x430d3b],'CmListId':_0x52cdf9[_0x7962('0x4c')]['id']});}return _0x1fe4ab;});}})[_0x7962('0x29')](respondWithResult(_0x5ebcab,null))[_0x7962('0x4a')](handleError(_0x5ebcab,null));};exports['removeAgents']=function(_0x12e700,_0xb36d62,_0x5a96af){return db[_0x7962('0x31')]['find']({'where':{'id':_0x12e700[_0x7962('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb36d62,null))[_0x7962('0x29')](function(_0x508dd9){if(_0x508dd9){return _0x508dd9[_0x7962('0x91')](_0x12e700['query'][_0x7962('0x8d')])[_0x7962('0x29')](function(){if(_[_0x7962('0x63')](_0x12e700[_0x7962('0x36')][_0x7962('0x8d')])){for(var _0x302737=0x0;_0x302737<_0x12e700['query'][_0x7962('0x8d')][_0x7962('0x3b')];_0x302737+=0x1){socket['emit'](_0x7962('0x92'),{'UserId':Number(_0x12e700[_0x7962('0x36')]['ids'][_0x302737]),'CmListId':Number(_0x12e700['params']['id'])});}}else{socket[_0x7962('0x8f')](_0x7962('0x92'),{'UserId':Number(_0x12e700[_0x7962('0x36')][_0x7962('0x8d')]),'CmListId':Number(_0x12e700[_0x7962('0x4c')]['id'])});}});}})[_0x7962('0x29')](respondWithStatusCode(_0xb36d62,null))['catch'](handleError(_0xb36d62,null));};exports[_0x7962('0x93')]=function(_0x55f9a8,_0x3cd3f9,_0x24e327){var _0x1f8cc9={};var _0x396a13={};var _0x305392;var _0x5ed5a7;return db[_0x7962('0x31')][_0x7962('0x5e')]({'where':{'id':_0x55f9a8[_0x7962('0x4c')]['id']}})[_0x7962('0x29')](handleEntityNotFound(_0x3cd3f9,null))['then'](function(_0x12ffca){if(_0x12ffca){_0x305392=_0x12ffca;_0x396a13['model']=_[_0x7962('0x37')](db['User'][_0x7962('0x32')]);_0x396a13['query']=_[_0x7962('0x37')](_0x55f9a8[_0x7962('0x36')]);_0x396a13['filters']=_['intersection'](_0x396a13[_0x7962('0x34')],_0x396a13[_0x7962('0x36')]);_0x1f8cc9[_0x7962('0x39')]=_[_0x7962('0x38')](_0x396a13[_0x7962('0x34')],qs[_0x7962('0x3a')](_0x55f9a8[_0x7962('0x36')]['fields']));_0x1f8cc9[_0x7962('0x39')]=_0x1f8cc9['attributes'][_0x7962('0x3b')]?_0x1f8cc9[_0x7962('0x39')]:_0x396a13[_0x7962('0x34')];_0x1f8cc9[_0x7962('0x3e')]=qs[_0x7962('0x3f')](_0x55f9a8['query']['sort']);_0x1f8cc9['where']=qs[_0x7962('0x41')](_[_0x7962('0x42')](_0x55f9a8[_0x7962('0x36')],_0x396a13[_0x7962('0x41')]));if(_0x55f9a8['query']['filter']){_0x1f8cc9[_0x7962('0x40')]=_[_0x7962('0x44')](_0x1f8cc9[_0x7962('0x40')],{'$or':_[_0x7962('0x35')](_0x1f8cc9[_0x7962('0x39')],function(_0x589a00){var _0x1a709d={};_0x1a709d[_0x589a00]={'$like':'%'+_0x55f9a8[_0x7962('0x36')][_0x7962('0x43')]+'%'};return _0x1a709d;})});}_0x1f8cc9=_[_0x7962('0x44')]({},_0x1f8cc9,_0x55f9a8[_0x7962('0x46')]);return _0x305392[_0x7962('0x93')](_0x1f8cc9);}})[_0x7962('0x29')](function(_0x535fba){if(_0x535fba){_0x5ed5a7=_0x535fba[_0x7962('0x3b')];if(!_0x55f9a8[_0x7962('0x36')][_0x7962('0x3c')](_0x7962('0x3d'))){_0x1f8cc9[_0x7962('0x23')]=qs[_0x7962('0x23')](_0x55f9a8[_0x7962('0x36')][_0x7962('0x23')]);_0x1f8cc9[_0x7962('0x22')]=qs[_0x7962('0x22')](_0x55f9a8[_0x7962('0x36')]['offset']);}return _0x305392[_0x7962('0x93')](_0x1f8cc9);}})[_0x7962('0x29')](function(_0x338c12){if(_0x338c12){return _0x338c12?{'count':_0x5ed5a7,'rows':_0x338c12}:null;}})[_0x7962('0x29')](respondWithResult(_0x3cd3f9,null))[_0x7962('0x4a')](handleError(_0x3cd3f9,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 02b0726..19e936c 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 _0xe7a9=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','CmList','setMaxListeners'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xe7a9,0x17f));var _0x9e7a=function(_0x32368c,_0x1cd20c){_0x32368c=_0x32368c-0x0;var _0x27c84e=_0xe7a9[_0x32368c];return _0x27c84e;};'use strict';var EventEmitter=require(_0x9e7a('0x0'));var CmList=require(_0x9e7a('0x1'))['db'][_0x9e7a('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x9e7a('0x3')](0x0);var events={'afterCreate':_0x9e7a('0x4'),'afterUpdate':_0x9e7a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1aab65){return function(_0x216eb7,_0x31c27c,_0x475c71){CmListEvents[_0x9e7a('0x6')](_0x1aab65+':'+_0x216eb7['id'],_0x216eb7);CmListEvents[_0x9e7a('0x6')](_0x1aab65,_0x216eb7);_0x475c71(null);};}for(var e in events){if(events[_0x9e7a('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x9e7a('0x8')]=CmListEvents; \ No newline at end of file +var _0xf0d5=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','remove'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xf0d5,0x80));var _0x5f0d=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xf0d5[_0x164760];return _0x8b91b2;};'use strict';var EventEmitter=require(_0x5f0d('0x0'));var CmList=require(_0x5f0d('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x5f0d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5f0d('0x3')};function emitEvent(_0x560b4b){return function(_0xb15a47,_0x33c4e8,_0xf6f281){CmListEvents['emit'](_0x560b4b+':'+_0xb15a47['id'],_0xb15a47);CmListEvents[_0x5f0d('0x4')](_0x560b4b,_0xb15a47);_0xf6f281(null);};}for(var e in events){if(events[_0x5f0d('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4abd852..65abda1 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 _0x01a5=['request-promise','path','../../config/environment','./cmList.attributes','exports','CmList','cm_lists','lodash','util','../../config/logger','api','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x01a5,0x103));var _0x501a=function(_0x2f2dae,_0x335276){_0x2f2dae=_0x2f2dae-0x0;var _0x456deb=_0x01a5[_0x2f2dae];return _0x456deb;};'use strict';var _=require(_0x501a('0x0'));var util=require(_0x501a('0x1'));var logger=require(_0x501a('0x2'))(_0x501a('0x3'));var moment=require(_0x501a('0x4'));var BPromise=require('bluebird');var rp=require(_0x501a('0x5'));var fs=require('fs');var path=require(_0x501a('0x6'));var rimraf=require('rimraf');var config=require(_0x501a('0x7'));var attributes=require(_0x501a('0x8'));module[_0x501a('0x9')]=function(_0x3a4ce1,_0x57c2a){return _0x3a4ce1['define'](_0x501a('0xa'),attributes,{'tableName':_0x501a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d7=['request-promise','path','rimraf','../../config/environment','CmList','cm_lists','../../config/logger','api','bluebird'];(function(_0x25111f,_0x316380){var _0x36526f=function(_0x9ff320){while(--_0x9ff320){_0x25111f['push'](_0x25111f['shift']());}};_0x36526f(++_0x316380);}(_0xe7d7,0x153));var _0x7e7d=function(_0x6fbad5,_0x138e7d){_0x6fbad5=_0x6fbad5-0x0;var _0x3baf1b=_0xe7d7[_0x6fbad5];return _0x3baf1b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e7d('0x0'))(_0x7e7d('0x1'));var moment=require('moment');var BPromise=require(_0x7e7d('0x2'));var rp=require(_0x7e7d('0x3'));var fs=require('fs');var path=require(_0x7e7d('0x4'));var rimraf=require(_0x7e7d('0x5'));var config=require(_0x7e7d('0x6'));var attributes=require('./cmList.attributes');module['exports']=function(_0x1c1727,_0x5c5a3f){return _0x1c1727['define'](_0x7e7d('0x7'),attributes,{'tableName':_0x7e7d('0x8'),'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 a971b72..9b82fa6 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 _0x9f44=['jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x26eb9e,_0x5acbc3){var _0x3f4505=function(_0x414084){while(--_0x414084){_0x26eb9e['push'](_0x26eb9e['shift']());}};_0x3f4505(++_0x5acbc3);}(_0x9f44,0x15f));var _0x49f4=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x9f44[_0x9c2427];return _0x51984f;};'use strict';var _=require('lodash');var util=require(_0x49f4('0x0'));var moment=require(_0x49f4('0x1'));var BPromise=require(_0x49f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49f4('0x3'));var db=require(_0x49f4('0x4'))['db'];var utils=require(_0x49f4('0x5'));var logger=require(_0x49f4('0x6'))(_0x49f4('0x7'));var config=require(_0x49f4('0x8'));var jayson=require(_0x49f4('0x9'));var client=jayson[_0x49f4('0xa')][_0x49f4('0xb')]({'port':0x232a});config[_0x49f4('0xc')]=_[_0x49f4('0xd')](config['redis'],{'host':_0x49f4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49f4('0xf'))[_0x49f4('0x10')](socket);function respondWithRpcPromise(_0x42b5a3,_0x2d3162,_0x371c71){return new BPromise(function(_0x1d87b8,_0x388b88){return client[_0x49f4('0x11')](_0x42b5a3,_0x371c71)[_0x49f4('0x12')](function(_0x55b93f){logger[_0x49f4('0x13')](_0x49f4('0x14'),_0x2d3162,_0x49f4('0x15'));logger[_0x49f4('0x16')](_0x49f4('0x17'),_0x2d3162,'request\x20sent',JSON[_0x49f4('0x18')](_0x55b93f));if(_0x55b93f[_0x49f4('0x19')]){if(_0x55b93f['error'][_0x49f4('0x1a')]===0x1f4){logger[_0x49f4('0x19')](_0x49f4('0x14'),_0x2d3162,_0x55b93f['error'][_0x49f4('0x1b')]);return _0x388b88(_0x55b93f[_0x49f4('0x19')]['message']);}logger[_0x49f4('0x19')](_0x49f4('0x14'),_0x2d3162,_0x55b93f[_0x49f4('0x19')][_0x49f4('0x1b')]);return _0x1d87b8(_0x55b93f[_0x49f4('0x19')]['message']);}else{logger['info'](_0x49f4('0x14'),_0x2d3162,_0x49f4('0x15'));_0x1d87b8(_0x55b93f[_0x49f4('0x1c')][_0x49f4('0x1b')]);}})[_0x49f4('0x1d')](function(_0x225e7f){logger[_0x49f4('0x19')](_0x49f4('0x14'),_0x2d3162,_0x225e7f);_0x388b88(_0x225e7f);});});} \ No newline at end of file +var _0x2fa9=['error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x159ef2,_0x5e11a2){var _0x1e227b=function(_0x45d059){while(--_0x45d059){_0x159ef2['push'](_0x159ef2['shift']());}};_0x1e227b(++_0x5e11a2);}(_0x2fa9,0x91));var _0x92fa=function(_0x46d06b,_0xd35a32){_0x46d06b=_0x46d06b-0x0;var _0x44882a=_0x2fa9[_0x46d06b];return _0x44882a;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var moment=require('moment');var BPromise=require(_0x92fa('0x2'));var rs=require(_0x92fa('0x3'));var fs=require('fs');var Redis=require(_0x92fa('0x4'));var db=require(_0x92fa('0x5'))['db'];var utils=require(_0x92fa('0x6'));var logger=require('../../config/logger')(_0x92fa('0x7'));var config=require(_0x92fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92fa('0x9')]['http']({'port':0x232a});config['redis']=_[_0x92fa('0xa')](config[_0x92fa('0xb')],{'host':_0x92fa('0xc'),'port':0x18eb});var socket=require(_0x92fa('0xd'))(new Redis(config['redis']));require(_0x92fa('0xe'))[_0x92fa('0xf')](socket);function respondWithRpcPromise(_0x2e5048,_0x500198,_0x306b70){return new BPromise(function(_0x538b91,_0x29fcdf){return client[_0x92fa('0x10')](_0x2e5048,_0x306b70)[_0x92fa('0x11')](function(_0x2be15f){logger['info'](_0x92fa('0x12'),_0x500198,_0x92fa('0x13'));logger[_0x92fa('0x14')](_0x92fa('0x15'),_0x500198,_0x92fa('0x13'),JSON[_0x92fa('0x16')](_0x2be15f));if(_0x2be15f[_0x92fa('0x17')]){if(_0x2be15f[_0x92fa('0x17')][_0x92fa('0x18')]===0x1f4){logger[_0x92fa('0x17')](_0x92fa('0x12'),_0x500198,_0x2be15f[_0x92fa('0x17')][_0x92fa('0x19')]);return _0x29fcdf(_0x2be15f[_0x92fa('0x17')][_0x92fa('0x19')]);}logger[_0x92fa('0x17')](_0x92fa('0x12'),_0x500198,_0x2be15f[_0x92fa('0x17')][_0x92fa('0x19')]);return _0x538b91(_0x2be15f[_0x92fa('0x17')][_0x92fa('0x19')]);}else{logger[_0x92fa('0x1a')](_0x92fa('0x12'),_0x500198,_0x92fa('0x13'));_0x538b91(_0x2be15f[_0x92fa('0x1b')][_0x92fa('0x19')]);}})['catch'](function(_0x555602){logger[_0x92fa('0x17')](_0x92fa('0x12'),_0x500198,_0x555602);_0x29fcdf(_0x555602);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6e69143..8446e28 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 _0xc627=['length','save','remove','update','emit','removeListener','register'];(function(_0x5a51c1,_0x394c67){var _0x38f5fb=function(_0xa5d3d0){while(--_0xa5d3d0){_0x5a51c1['push'](_0x5a51c1['shift']());}};_0x38f5fb(++_0x394c67);}(_0xc627,0x14a));var _0x7c62=function(_0x11e8ac,_0x23811f){_0x11e8ac=_0x11e8ac-0x0;var _0x3e562a=_0xc627[_0x11e8ac];return _0x3e562a;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x7c62('0x0'),_0x7c62('0x1'),_0x7c62('0x2')];function createListener(_0x55c85f,_0x311a10){return function(_0x1e7490){_0x311a10[_0x7c62('0x3')](_0x55c85f,_0x1e7490);};}function removeListener(_0x313d80,_0x121766){return function(){CmListEvents[_0x7c62('0x4')](_0x313d80,_0x121766);};}exports[_0x7c62('0x5')]=function(_0x448f4b){for(var _0x25a5c8=0x0,_0x43f964=events[_0x7c62('0x6')];_0x25a5c8<_0x43f964;_0x25a5c8++){var _0x29705f=events[_0x25a5c8];var _0x58c31c=createListener('cmList:'+_0x29705f,_0x448f4b);CmListEvents['on'](_0x29705f,_0x58c31c);}}; \ No newline at end of file +var _0xe953=['length','cmList:','removeListener'];(function(_0x175d2d,_0x5ddeb5){var _0x2d1017=function(_0xe46a71){while(--_0xe46a71){_0x175d2d['push'](_0x175d2d['shift']());}};_0x2d1017(++_0x5ddeb5);}(_0xe953,0x1d0));var _0x3e95=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xe953[_0x11ce46];return _0x368a1e;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove','update'];function createListener(_0x56947e,_0x1afca4){return function(_0x31b87e){_0x1afca4['emit'](_0x56947e,_0x31b87e);};}function removeListener(_0x46f343,_0x5a0541){return function(){CmListEvents[_0x3e95('0x0')](_0x46f343,_0x5a0541);};}exports['register']=function(_0x30637c){for(var _0x3faa2b=0x0,_0x45f703=events[_0x3e95('0x1')];_0x3faa2b<_0x45f703;_0x3faa2b++){var _0x421e13=events[_0x3faa2b];var _0x5bb380=createListener(_0x3e95('0x2')+_0x421e13,_0x30637c);CmListEvents['on'](_0x421e13,_0x5bb380);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 716d0e6..8b43247 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 _0xeeb8=['addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition','addContacts'];(function(_0x1dc294,_0x3a7cf1){var _0x16522d=function(_0xb4b129){while(--_0xb4b129){_0x1dc294['push'](_0x1dc294['shift']());}};_0x16522d(++_0x3a7cf1);}(_0xeeb8,0x168));var _0x8eeb=function(_0x6b3574,_0x27e60e){_0x6b3574=_0x6b3574-0x0;var _0x31f825=_0xeeb8[_0x6b3574];return _0x31f825;};'use strict';var multer=require('multer');var util=require(_0x8eeb('0x0'));var path=require(_0x8eeb('0x1'));var timeout=require(_0x8eeb('0x2'));var express=require(_0x8eeb('0x3'));var router=express[_0x8eeb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8eeb('0x5'));var config=require(_0x8eeb('0x6'));var controller=require(_0x8eeb('0x7'));router['get']('/',auth[_0x8eeb('0x8')](),controller['index']);router[_0x8eeb('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8eeb('0xa')]);router[_0x8eeb('0x9')](_0x8eeb('0xb'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0xc')]);router[_0x8eeb('0x9')](_0x8eeb('0xd'),auth[_0x8eeb('0x8')](),controller['getDispositions']);router['get'](_0x8eeb('0xe'),auth['isAuthenticated'](),controller[_0x8eeb('0xf')]);router[_0x8eeb('0x9')](_0x8eeb('0x10'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x11')]);router[_0x8eeb('0x9')](_0x8eeb('0x12'),auth[_0x8eeb('0x8')](),controller['getCustomFields']);router[_0x8eeb('0x9')](_0x8eeb('0x13'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x14')]);router['post']('/',auth[_0x8eeb('0x8')](),controller['create']);router[_0x8eeb('0x15')](_0x8eeb('0xd'),auth['isAuthenticated'](),controller[_0x8eeb('0x16')]);router[_0x8eeb('0x15')](_0x8eeb('0xe'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x17')]);router[_0x8eeb('0x15')](_0x8eeb('0x12'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x18')]);router[_0x8eeb('0x15')](_0x8eeb('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8eeb('0x19')](_0x8eeb('0xb'),auth['isAuthenticated'](),controller[_0x8eeb('0x1a')]);router[_0x8eeb('0x1b')]('/:id',auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x1c')]);router['delete'](_0x8eeb('0xd'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x1d')]);router[_0x8eeb('0x1b')](_0x8eeb('0x13'),auth[_0x8eeb('0x8')](),controller[_0x8eeb('0x1e')]);module[_0x8eeb('0x1f')]=router; \ No newline at end of file +var _0x771c=['post','create','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','/describe','describe','get','show','/:id/dispositions','isAuthenticated','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x771c,0x6d));var _0xc771=function(_0x3b7499,_0x5602a6){_0x3b7499=_0x3b7499-0x0;var _0x5a5499=_0x771c[_0x3b7499];return _0x5a5499;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc771('0x0'));var timeout=require(_0xc771('0x1'));var express=require(_0xc771('0x2'));var router=express[_0xc771('0x3')]();var auth=require(_0xc771('0x4'));var interaction=require(_0xc771('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc771('0x6'),auth['isAuthenticated'](),controller[_0xc771('0x7')]);router[_0xc771('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc771('0x9')]);router[_0xc771('0x8')](_0xc771('0xa'),auth[_0xc771('0xb')](),controller['getDispositions']);router[_0xc771('0x8')](_0xc771('0xc'),auth['isAuthenticated'](),controller[_0xc771('0xd')]);router[_0xc771('0x8')](_0xc771('0xe'),auth[_0xc771('0xb')](),controller['getContactsCsv']);router[_0xc771('0x8')](_0xc771('0xf'),auth['isAuthenticated'](),controller[_0xc771('0x10')]);router[_0xc771('0x8')](_0xc771('0x11'),auth[_0xc771('0xb')](),controller[_0xc771('0x12')]);router[_0xc771('0x13')]('/',auth[_0xc771('0xb')](),controller[_0xc771('0x14')]);router[_0xc771('0x13')](_0xc771('0xa'),auth['isAuthenticated'](),controller[_0xc771('0x15')]);router[_0xc771('0x13')](_0xc771('0xc'),auth['isAuthenticated'](),controller[_0xc771('0x16')]);router[_0xc771('0x13')](_0xc771('0xf'),auth[_0xc771('0xb')](),controller[_0xc771('0x17')]);router[_0xc771('0x13')]('/:id/users',auth[_0xc771('0xb')](),controller[_0xc771('0x18')]);router[_0xc771('0x19')](_0xc771('0x1a'),auth['isAuthenticated'](),controller[_0xc771('0x1b')]);router[_0xc771('0x1c')]('/:id',auth[_0xc771('0xb')](),controller[_0xc771('0x1d')]);router['delete'](_0xc771('0xa'),auth[_0xc771('0xb')](),controller[_0xc771('0x1e')]);router[_0xc771('0x1c')](_0xc771('0x11'),auth['isAuthenticated'](),controller[_0xc771('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index adba881..84396f1 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(_0x3eb95b,_0x2381c9){var _0x52b9a4=function(_0x2ba974){while(--_0x2ba974){_0x3eb95b['push'](_0x3eb95b['shift']());}};_0x52b9a4(++_0x2381c9);}(_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')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0xfc1360,_0x1fb66d){var _0x3bd494=function(_0x5b32c7){while(--_0x5b32c7){_0xfc1360['push'](_0xfc1360['shift']());}};_0x3bd494(++_0x1fb66d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index eb3cfbc..63fbda3 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 _0x84e7=['end','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','update','body','params','Condition','find','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x398ced,_0x8e1a16){var _0x44062a=function(_0x176879){while(--_0x176879){_0x398ced['push'](_0x398ced['shift']());}};_0x44062a(++_0x8e1a16);}(_0x84e7,0x171));var _0x784e=function(_0x452dc0,_0x45dbbd){_0x452dc0=_0x452dc0-0x0;var _0x2742b0=_0x84e7[_0x452dc0];return _0x2742b0;};'use strict';var pdf=require(_0x784e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x784e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x784e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x784e('0x3'));var Mustache=require(_0x784e('0x4'));var util=require(_0x784e('0x5'));var path=require(_0x784e('0x6'));var sox=require('sox');var csv=require(_0x784e('0x7'));var ejs=require(_0x784e('0x8'));var fs=require('fs');var _=require(_0x784e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x784e('0xa'));var toCsv=require(_0x784e('0x7'));var querystring=require(_0x784e('0xb'));var Papa=require(_0x784e('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x784e('0xd'));var hardwareService=require(_0x784e('0xe'));var logger=require(_0x784e('0xf'))(_0x784e('0x10'));var utils=require(_0x784e('0x11'));var config=require('../../config/environment');var db=require(_0x784e('0x12'))['db'];function respondWithStatusCode(_0x149be9,_0xffda3b){_0xffda3b=_0xffda3b||0xcc;return function(_0x45e560){if(_0x45e560){return _0x149be9[_0x784e('0x13')](_0xffda3b);}return _0x149be9[_0x784e('0x14')](_0xffda3b)[_0x784e('0x15')]();};}function respondWithResult(_0x118509,_0x123848){_0x123848=_0x123848||0xc8;return function(_0x14ecbe){if(_0x14ecbe){return _0x118509['status'](_0x123848)[_0x784e('0x16')](_0x14ecbe);}};}function respondWithFilteredResult(_0x188cc9,_0x4d9d0c){return function(_0x2207bf){if(_0x2207bf){var _0x5e0c9b=_0x2207bf[_0x784e('0x17')],_0x3058ca=_0x4d9d0c[_0x784e('0x18')],_0x4cca13=_0x4d9d0c['offset']+_0x4d9d0c[_0x784e('0x19')],_0x3241a1;if(_0x4cca13>=_0x5e0c9b){_0x4cca13=_0x5e0c9b;_0x3241a1=0xc8;}else{_0x3241a1=0xce;}_0x188cc9[_0x784e('0x14')](_0x3241a1);return _0x188cc9[_0x784e('0x1a')]('Content-Range',_0x3058ca+'-'+_0x4cca13+'/'+_0x5e0c9b)[_0x784e('0x16')](_0x2207bf);}return null;};}function patchUpdates(_0x3c7370){return function(_0x169627){try{jsonpatch[_0x784e('0x1b')](_0x169627,_0x3c7370,!![]);}catch(_0xf94862){return BPromise[_0x784e('0x1c')](_0xf94862);}return _0x169627[_0x784e('0x1d')]();};}function saveUpdates(_0x5ce403,_0x21eb3f){return function(_0x50a67e){if(_0x50a67e){return _0x50a67e['update'](_0x5ce403)[_0x784e('0x1e')](function(_0x50e5ea){return _0x50e5ea;});}return null;};}function removeEntity(_0x5d0848,_0xd85a7){return function(_0x21127f){if(_0x21127f){return _0x21127f[_0x784e('0x1f')]()[_0x784e('0x1e')](function(){_0x5d0848['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15fbbd,_0x48f446){return function(_0x462710){if(!_0x462710){_0x15fbbd[_0x784e('0x13')](0x194);}return _0x462710;};}function handleError(_0x1a2dba,_0x1decd3){_0x1decd3=_0x1decd3||0x1f4;return function(_0x828985){logger['error'](_0x828985[_0x784e('0x20')]);if(_0x828985[_0x784e('0x21')]){delete _0x828985['name'];}_0x1a2dba[_0x784e('0x14')](_0x1decd3)['send'](_0x828985);};}exports[_0x784e('0x22')]=function(_0x1c3a80,_0x49bda6){if(_0x1c3a80[_0x784e('0x23')]['id']){delete _0x1c3a80[_0x784e('0x23')]['id'];}return db['Condition']['find']({'where':{'id':_0x1c3a80[_0x784e('0x24')]['id']}})[_0x784e('0x1e')](handleEntityNotFound(_0x49bda6,null))[_0x784e('0x1e')](saveUpdates(_0x1c3a80['body'],null))[_0x784e('0x1e')](respondWithResult(_0x49bda6,null))['catch'](handleError(_0x49bda6,null));};exports[_0x784e('0x1f')]=function(_0x15974a,_0x3ccf5d){return db[_0x784e('0x25')][_0x784e('0x26')]({'where':{'id':_0x15974a[_0x784e('0x24')]['id']}})[_0x784e('0x1e')](handleEntityNotFound(_0x3ccf5d,null))[_0x784e('0x1e')](removeEntity(_0x3ccf5d,null))['catch'](handleError(_0x3ccf5d,null));}; \ No newline at end of file +var _0xaee2=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','body','Condition','params','catch','destroy','find'];(function(_0x22c3e0,_0x1c36a0){var _0x1abe69=function(_0x742cbb){while(--_0x742cbb){_0x22c3e0['push'](_0x22c3e0['shift']());}};_0x1abe69(++_0x1c36a0);}(_0xaee2,0x150));var _0x2aee=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xaee2[_0xd7b0a4];return _0x184e9e;};'use strict';var pdf=require(_0x2aee('0x0'));var emlformat=require(_0x2aee('0x1'));var rimraf=require(_0x2aee('0x2'));var zipdir=require(_0x2aee('0x3'));var jsonpatch=require(_0x2aee('0x4'));var rp=require(_0x2aee('0x5'));var moment=require(_0x2aee('0x6'));var BPromise=require(_0x2aee('0x7'));var Mustache=require(_0x2aee('0x8'));var util=require(_0x2aee('0x9'));var path=require(_0x2aee('0xa'));var sox=require(_0x2aee('0xb'));var csv=require(_0x2aee('0xc'));var ejs=require(_0x2aee('0xd'));var fs=require('fs');var _=require(_0x2aee('0xe'));var squel=require(_0x2aee('0xf'));var crypto=require('crypto');var jsforce=require(_0x2aee('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2aee('0xc'));var querystring=require('querystring');var Papa=require(_0x2aee('0x11'));var Redis=require(_0x2aee('0x12'));var authService=require(_0x2aee('0x13'));var qs=require(_0x2aee('0x14'));var as=require(_0x2aee('0x15'));var hardwareService=require(_0x2aee('0x16'));var logger=require('../../config/logger')(_0x2aee('0x17'));var utils=require(_0x2aee('0x18'));var config=require(_0x2aee('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47343a,_0x51ff74){_0x51ff74=_0x51ff74||0xcc;return function(_0x542df0){if(_0x542df0){return _0x47343a[_0x2aee('0x1a')](_0x51ff74);}return _0x47343a[_0x2aee('0x1b')](_0x51ff74)['end']();};}function respondWithResult(_0x1a1b6e,_0x2707f2){_0x2707f2=_0x2707f2||0xc8;return function(_0x22f9c9){if(_0x22f9c9){return _0x1a1b6e[_0x2aee('0x1b')](_0x2707f2)['json'](_0x22f9c9);}};}function respondWithFilteredResult(_0xd90706,_0x129774){return function(_0xe9f083){if(_0xe9f083){var _0x41aabd=_0xe9f083[_0x2aee('0x1c')],_0x4b6660=_0x129774[_0x2aee('0x1d')],_0x4eac23=_0x129774[_0x2aee('0x1d')]+_0x129774[_0x2aee('0x1e')],_0x504d9a;if(_0x4eac23>=_0x41aabd){_0x4eac23=_0x41aabd;_0x504d9a=0xc8;}else{_0x504d9a=0xce;}_0xd90706[_0x2aee('0x1b')](_0x504d9a);return _0xd90706[_0x2aee('0x1f')](_0x2aee('0x20'),_0x4b6660+'-'+_0x4eac23+'/'+_0x41aabd)[_0x2aee('0x21')](_0xe9f083);}return null;};}function patchUpdates(_0x1745af){return function(_0x407302){try{jsonpatch['apply'](_0x407302,_0x1745af,!![]);}catch(_0x4f2e9c){return BPromise[_0x2aee('0x22')](_0x4f2e9c);}return _0x407302[_0x2aee('0x23')]();};}function saveUpdates(_0x19adb1,_0x53ec1b){return function(_0x122d3d){if(_0x122d3d){return _0x122d3d[_0x2aee('0x24')](_0x19adb1)[_0x2aee('0x25')](function(_0x3ddd26){return _0x3ddd26;});}return null;};}function removeEntity(_0x11afb0,_0x1b0e08){return function(_0x536a26){if(_0x536a26){return _0x536a26['destroy']()[_0x2aee('0x25')](function(){_0x11afb0[_0x2aee('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30866b,_0x2dd4c3){return function(_0x50017a){if(!_0x50017a){_0x30866b[_0x2aee('0x1a')](0x194);}return _0x50017a;};}function handleError(_0x3f2636,_0x29a696){_0x29a696=_0x29a696||0x1f4;return function(_0x1c7eb5){logger[_0x2aee('0x26')](_0x1c7eb5[_0x2aee('0x27')]);if(_0x1c7eb5['name']){delete _0x1c7eb5[_0x2aee('0x28')];}_0x3f2636[_0x2aee('0x1b')](_0x29a696)[_0x2aee('0x29')](_0x1c7eb5);};}exports[_0x2aee('0x24')]=function(_0x45e3f2,_0x5e8ae5){if(_0x45e3f2[_0x2aee('0x2a')]['id']){delete _0x45e3f2[_0x2aee('0x2a')]['id'];}return db[_0x2aee('0x2b')]['find']({'where':{'id':_0x45e3f2[_0x2aee('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5e8ae5,null))[_0x2aee('0x25')](saveUpdates(_0x45e3f2[_0x2aee('0x2a')],null))[_0x2aee('0x25')](respondWithResult(_0x5e8ae5,null))[_0x2aee('0x2d')](handleError(_0x5e8ae5,null));};exports[_0x2aee('0x2e')]=function(_0xa265cc,_0x8f1217){return db['Condition'][_0x2aee('0x2f')]({'where':{'id':_0xa265cc[_0x2aee('0x2c')]['id']}})[_0x2aee('0x25')](handleEntityNotFound(_0x8f1217,null))[_0x2aee('0x25')](removeEntity(_0x8f1217,null))[_0x2aee('0x2d')](handleError(_0x8f1217,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0da7b3d..07a1c0b 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 _0x47a3=['exports','Condition','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x47a3,0xe0));var _0x347a=function(_0x5170cc,_0x2645a0){_0x5170cc=_0x5170cc-0x0;var _0x792c81=_0x47a3[_0x5170cc];return _0x792c81;};'use strict';var _=require(_0x347a('0x0'));var util=require(_0x347a('0x1'));var logger=require(_0x347a('0x2'))('api');var moment=require(_0x347a('0x3'));var BPromise=require(_0x347a('0x4'));var rp=require(_0x347a('0x5'));var fs=require('fs');var path=require(_0x347a('0x6'));var rimraf=require(_0x347a('0x7'));var config=require(_0x347a('0x8'));var attributes=require(_0x347a('0x9'));module[_0x347a('0xa')]=function(_0xc2b4b7,_0x1a49df){return _0xc2b4b7['define'](_0x347a('0xb'),attributes,{'tableName':_0x347a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4823=['bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','util','../../config/logger','api'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x4823,0x76));var _0x3482=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x4823[_0x15b399];return _0x199f2d;};'use strict';var _=require('lodash');var util=require(_0x3482('0x0'));var logger=require(_0x3482('0x1'))(_0x3482('0x2'));var moment=require('moment');var BPromise=require(_0x3482('0x3'));var rp=require(_0x3482('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3482('0x5'));var config=require(_0x3482('0x6'));var attributes=require(_0x3482('0x7'));module[_0x3482('0x8')]=function(_0x52f6e9,_0x3cd2d0){return _0x52f6e9[_0x3482('0x9')](_0x3482('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 0a16121..9b63b1f 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 _0xbf7e=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d34f1,_0x4f8db1){var _0x37b8e1=function(_0x34499a){while(--_0x34499a){_0x4d34f1['push'](_0x4d34f1['shift']());}};_0x37b8e1(++_0x4f8db1);}(_0xbf7e,0xb7));var _0xebf7=function(_0x5df8f1,_0x49e5fa){_0x5df8f1=_0x5df8f1-0x0;var _0x160eed=_0xbf7e[_0x5df8f1];return _0x160eed;};'use strict';var _=require(_0xebf7('0x0'));var util=require(_0xebf7('0x1'));var moment=require(_0xebf7('0x2'));var BPromise=require(_0xebf7('0x3'));var rs=require(_0xebf7('0x4'));var fs=require('fs');var Redis=require(_0xebf7('0x5'));var db=require(_0xebf7('0x6'))['db'];var utils=require(_0xebf7('0x7'));var logger=require(_0xebf7('0x8'))('rpc');var config=require(_0xebf7('0x9'));var jayson=require(_0xebf7('0xa'));var client=jayson[_0xebf7('0xb')][_0xebf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f91a,_0x56b2a1,_0x1999d5){return new BPromise(function(_0x3dc43a,_0x4f2c80){return client[_0xebf7('0xd')](_0x3f91a,_0x1999d5)[_0xebf7('0xe')](function(_0x4de073){logger[_0xebf7('0xf')]('Condition,\x20%s,\x20%s',_0x56b2a1,_0xebf7('0x10'));logger[_0xebf7('0x11')](_0xebf7('0x12'),_0x56b2a1,_0xebf7('0x10'),JSON[_0xebf7('0x13')](_0x4de073));if(_0x4de073[_0xebf7('0x14')]){if(_0x4de073[_0xebf7('0x14')][_0xebf7('0x15')]===0x1f4){logger[_0xebf7('0x14')](_0xebf7('0x16'),_0x56b2a1,_0x4de073[_0xebf7('0x14')][_0xebf7('0x17')]);return _0x4f2c80(_0x4de073['error']['message']);}logger[_0xebf7('0x14')](_0xebf7('0x16'),_0x56b2a1,_0x4de073[_0xebf7('0x14')]['message']);return _0x3dc43a(_0x4de073[_0xebf7('0x14')][_0xebf7('0x17')]);}else{logger[_0xebf7('0xf')](_0xebf7('0x16'),_0x56b2a1,_0xebf7('0x10'));_0x3dc43a(_0x4de073['result'][_0xebf7('0x17')]);}})['catch'](function(_0x315af7){logger[_0xebf7('0x14')](_0xebf7('0x16'),_0x56b2a1,_0x315af7);_0x4f2c80(_0x315af7);});});} \ No newline at end of file +var _0xaf1c=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf1c,0x190));var _0xcaf1=function(_0x343fca,_0x2d0c0b){_0x343fca=_0x343fca-0x0;var _0xc687aa=_0xaf1c[_0x343fca];return _0xc687aa;};'use strict';var _=require(_0xcaf1('0x0'));var util=require(_0xcaf1('0x1'));var moment=require(_0xcaf1('0x2'));var BPromise=require(_0xcaf1('0x3'));var rs=require(_0xcaf1('0x4'));var fs=require('fs');var Redis=require(_0xcaf1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaf1('0x6'));var logger=require('../../config/logger')(_0xcaf1('0x7'));var config=require(_0xcaf1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcaf1('0x9')][_0xcaf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c63d0,_0x58968e,_0x9d2c00){return new BPromise(function(_0x5c4765,_0x4225e4){return client[_0xcaf1('0xb')](_0x9c63d0,_0x9d2c00)[_0xcaf1('0xc')](function(_0x19859a){logger['info']('Condition,\x20%s,\x20%s',_0x58968e,_0xcaf1('0xd'));logger[_0xcaf1('0xe')](_0xcaf1('0xf'),_0x58968e,'request\x20sent',JSON[_0xcaf1('0x10')](_0x19859a));if(_0x19859a[_0xcaf1('0x11')]){if(_0x19859a[_0xcaf1('0x11')][_0xcaf1('0x12')]===0x1f4){logger['error'](_0xcaf1('0x13'),_0x58968e,_0x19859a[_0xcaf1('0x11')][_0xcaf1('0x14')]);return _0x4225e4(_0x19859a[_0xcaf1('0x11')][_0xcaf1('0x14')]);}logger[_0xcaf1('0x11')](_0xcaf1('0x13'),_0x58968e,_0x19859a[_0xcaf1('0x11')]['message']);return _0x5c4765(_0x19859a[_0xcaf1('0x11')][_0xcaf1('0x14')]);}else{logger[_0xcaf1('0x15')](_0xcaf1('0x13'),_0x58968e,_0xcaf1('0xd'));_0x5c4765(_0x19859a[_0xcaf1('0x16')][_0xcaf1('0x14')]);}})['catch'](function(_0x29be5e){logger[_0xcaf1('0x11')](_0xcaf1('0x13'),_0x58968e,_0x29be5e);_0x4225e4(_0x29be5e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7e73e38..84a24e7 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 _0x3833=['put','/:id','isAuthenticated','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./condition.controller'];(function(_0x281a04,_0x21f405){var _0x548f71=function(_0x9f8e7c){while(--_0x9f8e7c){_0x281a04['push'](_0x281a04['shift']());}};_0x548f71(++_0x21f405);}(_0x3833,0x14b));var _0x3383=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3833[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require(_0x3383('0x0'));var path=require(_0x3383('0x1'));var timeout=require(_0x3383('0x2'));var express=require('express');var router=express[_0x3383('0x3')]();var auth=require(_0x3383('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3383('0x5'));var controller=require(_0x3383('0x6'));router[_0x3383('0x7')](_0x3383('0x8'),auth[_0x3383('0x9')](),controller[_0x3383('0xa')]);router[_0x3383('0xb')](_0x3383('0x8'),auth[_0x3383('0x9')](),controller['destroy']);module[_0x3383('0xc')]=router; \ No newline at end of file +var _0x320e=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put'];(function(_0x365bf5,_0x5def80){var _0x1219a7=function(_0x29a3ff){while(--_0x29a3ff){_0x365bf5['push'](_0x365bf5['shift']());}};_0x1219a7(++_0x5def80);}(_0x320e,0x9c));var _0xe320=function(_0x4ab4a2,_0x41b416){_0x4ab4a2=_0x4ab4a2-0x0;var _0x57f331=_0x320e[_0x4ab4a2];return _0x57f331;};'use strict';var multer=require(_0xe320('0x0'));var util=require(_0xe320('0x1'));var path=require(_0xe320('0x2'));var timeout=require(_0xe320('0x3'));var express=require(_0xe320('0x4'));var router=express[_0xe320('0x5')]();var auth=require(_0xe320('0x6'));var interaction=require(_0xe320('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xe320('0x8')](_0xe320('0x9'),auth[_0xe320('0xa')](),controller[_0xe320('0xb')]);router[_0xe320('0xc')](_0xe320('0x9'),auth[_0xe320('0xa')](),controller[_0xe320('0xd')]);module[_0xe320('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 0831759..dd119ae 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf23b=['name','INTEGER','sequelize','exports','STRING'];(function(_0x59cb6c,_0x2eb410){var _0x8ac9ad=function(_0x45c04e){while(--_0x45c04e){_0x59cb6c['push'](_0x59cb6c['shift']());}};_0x8ac9ad(++_0x2eb410);}(_0xf23b,0x133));var _0xbf23=function(_0xf1b5c9,_0x120a78){_0xf1b5c9=_0xf1b5c9-0x0;var _0x261573=_0xf23b[_0xf1b5c9];return _0x261573;};'use strict';var Sequelize=require(_0xbf23('0x0'));module[_0xbf23('0x1')]={'name':{'type':Sequelize[_0xbf23('0x2')],'allowNull':![],'unique':_0xbf23('0x3')},'OrderBy':{'type':Sequelize[_0xbf23('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb903=['name','sequelize','exports','STRING'];(function(_0x2e4a24,_0x38892a){var _0xe8b21b=function(_0x343fec){while(--_0x343fec){_0x2e4a24['push'](_0x2e4a24['shift']());}};_0xe8b21b(++_0x38892a);}(_0xb903,0x185));var _0x3b90=function(_0x3f94e1,_0x3add2b){_0x3f94e1=_0x3f94e1-0x0;var _0x128b91=_0xb903[_0x3f94e1];return _0x128b91;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'name':{'type':Sequelize[_0x3b90('0x2')],'allowNull':![],'unique':_0x3b90('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3b90('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 684ee93..891dc98 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['include','rows','show','params','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0xedd9,0xfc));var _0x9edd=function(_0xf4770b,_0xe68669){_0xf4770b=_0xf4770b-0x0;var _0x4a672b=_0xedd9[_0xf4770b];return _0x4a672b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){var _0x3741c8=_0x186186[_0x9edd('0x23')]({'plain':!![]});var _0x44a6c1=_0x9edd('0x24');return db[_0x9edd('0x25')]['destroy']({'where':{'type':_0x44a6c1,'resourceId':_0x3741c8['id']}})[_0x9edd('0x21')](function(){return _0x186186;});})[_0x9edd('0x21')](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x310a4d,_0x4d507f){return function(_0x4b3d1b){if(!_0x4b3d1b){_0x310a4d[_0x9edd('0x17')](0x194);}return _0x4b3d1b;};}function handleError(_0xfeca7b,_0x8d67aa){_0x8d67aa=_0x8d67aa||0x1f4;return function(_0x25e135){logger[_0x9edd('0x26')](_0x25e135['stack']);if(_0x25e135['name']){delete _0x25e135[_0x9edd('0x27')];}_0xfeca7b[_0x9edd('0x18')](_0x8d67aa)[_0x9edd('0x28')](_0x25e135);};}exports['index']=function(_0x238b22,_0x28cfae){var _0x2ae8dd={},_0x41af53={},_0x5eccfb={'count':0x0,'rows':[]};var _0x2155a1=_[_0x9edd('0x29')](db[_0x9edd('0x2a')][_0x9edd('0x2b')],function(_0xbbf08f){return{'name':_0xbbf08f[_0x9edd('0x2c')],'type':_0xbbf08f[_0x9edd('0x2d')][_0x9edd('0x2e')]};});_0x41af53[_0x9edd('0x2f')]=_[_0x9edd('0x29')](_0x2155a1,_0x9edd('0x27'));_0x41af53[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x238b22[_0x9edd('0x30')]);_0x41af53[_0x9edd('0x32')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],_0x41af53[_0x9edd('0x30')]);_0x2ae8dd[_0x9edd('0x33')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x34')]));_0x2ae8dd[_0x9edd('0x33')]=_0x2ae8dd[_0x9edd('0x33')][_0x9edd('0x35')]?_0x2ae8dd[_0x9edd('0x33')]:_0x41af53[_0x9edd('0x2f')];if(!_0x238b22[_0x9edd('0x30')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x2ae8dd[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x238b22['query'][_0x9edd('0x1d')]);_0x2ae8dd['offset']=qs[_0x9edd('0x1c')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x1c')]);}_0x2ae8dd[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x238b22['query'][_0x9edd('0x39')]);_0x2ae8dd[_0x9edd('0x3a')]=qs[_0x9edd('0x32')](_[_0x9edd('0x3b')](_0x238b22[_0x9edd('0x30')],_0x41af53[_0x9edd('0x32')]),_0x2155a1);if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3c')]){_0x2ae8dd[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x2ae8dd['where'],{'$or':_[_0x9edd('0x29')](_0x2155a1,function(_0x56a228){if(_0x56a228[_0x9edd('0x2d')]!=='VIRTUAL'){var _0x30883e={};_0x30883e[_0x56a228[_0x9edd('0x27')]]={'$like':'%'+_0x238b22[_0x9edd('0x30')]['filter']+'%'};return _0x30883e;}})});}_0x2ae8dd=_[_0x9edd('0x3d')]({},_0x2ae8dd,_0x238b22[_0x9edd('0x3e')]);var _0x2f8f61={'where':_0x2ae8dd['where']};return db[_0x9edd('0x2a')]['count'](_0x2f8f61)[_0x9edd('0x21')](function(_0xfbc492){_0x5eccfb['count']=_0xfbc492;if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3f')]){_0x2ae8dd[_0x9edd('0x40')]=[{'all':!![]}];}return db[_0x9edd('0x2a')]['findAll'](_0x2ae8dd);})[_0x9edd('0x21')](function(_0x5bbdf8){_0x5eccfb[_0x9edd('0x41')]=_0x5bbdf8;return _0x5eccfb;})[_0x9edd('0x21')](respondWithFilteredResult(_0x28cfae,_0x2ae8dd))['catch'](handleError(_0x28cfae,null));};exports[_0x9edd('0x42')]=function(_0x49a128,_0x548299){var _0x369b69={'raw':!![],'where':{'id':_0x49a128[_0x9edd('0x43')]['id']}},_0x9cab86={};_0x9cab86[_0x9edd('0x2f')]=_[_0x9edd('0x31')](db[_0x9edd('0x2a')][_0x9edd('0x2b')]);_0x9cab86[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x49a128[_0x9edd('0x30')]);_0x9cab86[_0x9edd('0x32')]=_[_0x9edd('0x44')](_0x9cab86[_0x9edd('0x2f')],_0x9cab86[_0x9edd('0x30')]);_0x369b69[_0x9edd('0x33')]=_['intersection'](_0x9cab86[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x49a128[_0x9edd('0x30')][_0x9edd('0x34')]));_0x369b69[_0x9edd('0x33')]=_0x369b69[_0x9edd('0x33')][_0x9edd('0x35')]?_0x369b69['attributes']:_0x9cab86['model'];if(_0x49a128['query'][_0x9edd('0x3f')]){_0x369b69['include']=[{'all':!![]}];}_0x369b69=_[_0x9edd('0x3d')]({},_0x369b69,_0x49a128[_0x9edd('0x3e')]);return db[_0x9edd('0x2a')][_0x9edd('0x45')](_0x369b69)[_0x9edd('0x21')](handleEntityNotFound(_0x548299,null))['then'](respondWithResult(_0x548299,null))[_0x9edd('0x46')](handleError(_0x548299,null));};exports[_0x9edd('0x47')]=function(_0x40e33d,_0x4a89ae){return db[_0x9edd('0x2a')][_0x9edd('0x47')](_0x40e33d[_0x9edd('0x48')],{})[_0x9edd('0x21')](function(_0x1d78c4){var _0x35bdec=_0x40e33d['user'][_0x9edd('0x23')]({'plain':!![]});if(!_0x35bdec)throw new Error(_0x9edd('0x49'));if(_0x35bdec['role']===_0x9edd('0x4a')){var _0x8d8701=_0x1d78c4['get']({'plain':!![]});var _0x2bd089=_0x9edd('0x24');return db[_0x9edd('0x4b')]['find']({'where':{'name':_0x2bd089,'userProfileId':_0x35bdec[_0x9edd('0x4c')]},'raw':!![]})[_0x9edd('0x21')](function(_0x317a60){if(_0x317a60&&_0x317a60[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x47')]({'name':_0x8d8701[_0x9edd('0x27')],'resourceId':_0x8d8701['id'],'type':_0x317a60[_0x9edd('0x27')],'sectionId':_0x317a60['id']},{})['then'](function(){return _0x1d78c4;});}else{return _0x1d78c4;}})[_0x9edd('0x46')](function(_0x21f6ce){logger['error'](_0x9edd('0x4e'),_0x21f6ce);throw _0x21f6ce;});}return _0x1d78c4;})['then'](respondWithResult(_0x4a89ae,0xc9))[_0x9edd('0x46')](handleError(_0x4a89ae,null));};exports[_0x9edd('0x20')]=function(_0x24245f,_0x3fcdf5){if(_0x24245f[_0x9edd('0x48')]['id']){delete _0x24245f[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x2a')][_0x9edd('0x45')]({'where':{'id':_0x24245f[_0x9edd('0x43')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x21')](saveUpdates(_0x24245f['body'],null))[_0x9edd('0x21')](respondWithResult(_0x3fcdf5,null))[_0x9edd('0x46')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x22')]=function(_0x58fe29,_0xe96d6a){return db['ContactItemType']['find']({'where':{'id':_0x58fe29['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0xe96d6a,null))[_0x9edd('0x21')](removeEntity(_0xe96d6a,null))[_0x9edd('0x46')](handleError(_0xe96d6a,null));}; \ No newline at end of file +var _0x55ca=['apply','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','ContactItemType','includeAll','include','findAll','rows','show','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range'];(function(_0x17b0ec,_0x194f51){var _0x37ce6b=function(_0x473ad5){while(--_0x473ad5){_0x17b0ec['push'](_0x17b0ec['shift']());}};_0x37ce6b(++_0x194f51);}(_0x55ca,0x126));var _0xa55c=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x55ca[_0x34c027];return _0x47bff0;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];function respondWithStatusCode(_0x15eec8,_0x5d47ff){_0x5d47ff=_0x5d47ff||0xcc;return function(_0x59d84a){if(_0x59d84a){return _0x15eec8[_0xa55c('0x17')](_0x5d47ff);}return _0x15eec8['status'](_0x5d47ff)['end']();};}function respondWithResult(_0x59ea8d,_0x18ee85){_0x18ee85=_0x18ee85||0xc8;return function(_0x3930e4){if(_0x3930e4){return _0x59ea8d[_0xa55c('0x18')](_0x18ee85)[_0xa55c('0x19')](_0x3930e4);}};}function respondWithFilteredResult(_0x458480,_0x247e77){return function(_0x4e0b2f){if(_0x4e0b2f){var _0x3ccf65=_0x4e0b2f[_0xa55c('0x1a')],_0x3dcf4f=_0x247e77[_0xa55c('0x1b')],_0x25934f=_0x247e77[_0xa55c('0x1b')]+_0x247e77[_0xa55c('0x1c')],_0x31e10d;if(_0x25934f>=_0x3ccf65){_0x25934f=_0x3ccf65;_0x31e10d=0xc8;}else{_0x31e10d=0xce;}_0x458480[_0xa55c('0x18')](_0x31e10d);return _0x458480['set'](_0xa55c('0x1d'),_0x3dcf4f+'-'+_0x25934f+'/'+_0x3ccf65)[_0xa55c('0x19')](_0x4e0b2f);}return null;};}function patchUpdates(_0x461284){return function(_0x358b61){try{jsonpatch[_0xa55c('0x1e')](_0x358b61,_0x461284,!![]);}catch(_0x5426e5){return BPromise['reject'](_0x5426e5);}return _0x358b61['save']();};}function saveUpdates(_0xd643cc,_0x3776ac){return function(_0xade4c4){if(_0xade4c4){return _0xade4c4['update'](_0xd643cc)[_0xa55c('0x1f')](function(_0x2fcb90){return _0x2fcb90;});}return null;};}function removeEntity(_0x54945a,_0x187a87){return function(_0x133096){if(_0x133096){return _0x133096[_0xa55c('0x20')]()[_0xa55c('0x1f')](function(){var _0x234372=_0x133096['get']({'plain':!![]});var _0x1fc828='ContactItemTypes';return db['UserProfileResource']['destroy']({'where':{'type':_0x1fc828,'resourceId':_0x234372['id']}})[_0xa55c('0x1f')](function(){return _0x133096;});})['then'](function(){_0x54945a[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x3f64de,_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0x3f64de[_0xa55c('0x17')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x22')](_0x192df2[_0xa55c('0x23')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x24')];}_0x1da633[_0xa55c('0x18')](_0x11e7f7)[_0xa55c('0x25')](_0x192df2);};}exports[_0xa55c('0x26')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={},_0x1b8388={},_0x201941={'count':0x0,'rows':[]};var _0x45ee8d=_[_0xa55c('0x27')](db['ContactItemType'][_0xa55c('0x28')],function(_0x490b7d){return{'name':_0x490b7d[_0xa55c('0x29')],'type':_0x490b7d[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x1b8388[_0xa55c('0x2c')]=_['map'](_0x45ee8d,_0xa55c('0x24'));_0x1b8388[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x5d940d[_0xa55c('0x2d')]);_0x1b8388[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x1b8388[_0xa55c('0x2c')],_0x1b8388[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x1b8388[_0xa55c('0x2c')],qs['fields'](_0x5d940d['query'][_0xa55c('0x32')]));_0x22f6b6[_0xa55c('0x31')]=_0x22f6b6['attributes'][_0xa55c('0x33')]?_0x22f6b6[_0xa55c('0x31')]:_0x1b8388[_0xa55c('0x2c')];if(!_0x5d940d[_0xa55c('0x2d')][_0xa55c('0x34')](_0xa55c('0x35'))){_0x22f6b6[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x5d940d[_0xa55c('0x2d')]['limit']);_0x22f6b6['offset']=qs['offset'](_0x5d940d[_0xa55c('0x2d')][_0xa55c('0x1b')]);}_0x22f6b6[_0xa55c('0x36')]=qs['sort'](_0x5d940d[_0xa55c('0x2d')]['sort']);_0x22f6b6[_0xa55c('0x37')]=qs['filters'](_[_0xa55c('0x38')](_0x5d940d[_0xa55c('0x2d')],_0x1b8388[_0xa55c('0x2f')]),_0x45ee8d);if(_0x5d940d['query'][_0xa55c('0x39')]){_0x22f6b6[_0xa55c('0x37')]=_['merge'](_0x22f6b6[_0xa55c('0x37')],{'$or':_[_0xa55c('0x27')](_0x45ee8d,function(_0x4d9083){if(_0x4d9083['type']!==_0xa55c('0x3a')){var _0x5d3960={};_0x5d3960[_0x4d9083[_0xa55c('0x24')]]={'$like':'%'+_0x5d940d[_0xa55c('0x2d')]['filter']+'%'};return _0x5d3960;}})});}_0x22f6b6=_['merge']({},_0x22f6b6,_0x5d940d['options']);var _0x4de781={'where':_0x22f6b6[_0xa55c('0x37')]};return db[_0xa55c('0x3b')][_0xa55c('0x1a')](_0x4de781)[_0xa55c('0x1f')](function(_0x2d8cbf){_0x201941['count']=_0x2d8cbf;if(_0x5d940d[_0xa55c('0x2d')][_0xa55c('0x3c')]){_0x22f6b6[_0xa55c('0x3d')]=[{'all':!![]}];}return db[_0xa55c('0x3b')][_0xa55c('0x3e')](_0x22f6b6);})[_0xa55c('0x1f')](function(_0x554620){_0x201941[_0xa55c('0x3f')]=_0x554620;return _0x201941;})['then'](respondWithFilteredResult(_0x1377b0,_0x22f6b6))['catch'](handleError(_0x1377b0,null));};exports[_0xa55c('0x40')]=function(_0x1f63d8,_0x496920){var _0x2bd98b={'raw':!![],'where':{'id':_0x1f63d8['params']['id']}},_0x508bd3={};_0x508bd3[_0xa55c('0x2c')]=_[_0xa55c('0x2e')](db[_0xa55c('0x3b')]['rawAttributes']);_0x508bd3[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x1f63d8['query']);_0x508bd3[_0xa55c('0x2f')]=_['intersection'](_0x508bd3[_0xa55c('0x2c')],_0x508bd3[_0xa55c('0x2d')]);_0x2bd98b['attributes']=_[_0xa55c('0x30')](_0x508bd3[_0xa55c('0x2c')],qs['fields'](_0x1f63d8[_0xa55c('0x2d')][_0xa55c('0x32')]));_0x2bd98b[_0xa55c('0x31')]=_0x2bd98b['attributes'][_0xa55c('0x33')]?_0x2bd98b['attributes']:_0x508bd3[_0xa55c('0x2c')];if(_0x1f63d8[_0xa55c('0x2d')][_0xa55c('0x3c')]){_0x2bd98b['include']=[{'all':!![]}];}_0x2bd98b=_[_0xa55c('0x41')]({},_0x2bd98b,_0x1f63d8[_0xa55c('0x42')]);return db['ContactItemType'][_0xa55c('0x43')](_0x2bd98b)[_0xa55c('0x1f')](handleEntityNotFound(_0x496920,null))['then'](respondWithResult(_0x496920,null))[_0xa55c('0x44')](handleError(_0x496920,null));};exports[_0xa55c('0x45')]=function(_0x52f9a7,_0x46f839){return db[_0xa55c('0x3b')][_0xa55c('0x45')](_0x52f9a7[_0xa55c('0x46')],{})['then'](function(_0x143989){var _0x58a7ea=_0x52f9a7[_0xa55c('0x47')][_0xa55c('0x48')]({'plain':!![]});if(!_0x58a7ea)throw new Error(_0xa55c('0x49'));if(_0x58a7ea['role']===_0xa55c('0x47')){var _0x250b00=_0x143989['get']({'plain':!![]});var _0x5be06=_0xa55c('0x4a');return db[_0xa55c('0x4b')][_0xa55c('0x43')]({'where':{'name':_0x5be06,'userProfileId':_0x58a7ea[_0xa55c('0x4c')]},'raw':!![]})[_0xa55c('0x1f')](function(_0x1e1293){if(_0x1e1293&&_0x1e1293[_0xa55c('0x4d')]===0x0){return db[_0xa55c('0x4e')][_0xa55c('0x45')]({'name':_0x250b00['name'],'resourceId':_0x250b00['id'],'type':_0x1e1293[_0xa55c('0x24')],'sectionId':_0x1e1293['id']},{})[_0xa55c('0x1f')](function(){return _0x143989;});}else{return _0x143989;}})[_0xa55c('0x44')](function(_0x4f73b6){logger[_0xa55c('0x22')](_0xa55c('0x4f'),_0x4f73b6);throw _0x4f73b6;});}return _0x143989;})['then'](respondWithResult(_0x46f839,0xc9))[_0xa55c('0x44')](handleError(_0x46f839,null));};exports['update']=function(_0x2b6a0e,_0x228df4){if(_0x2b6a0e[_0xa55c('0x46')]['id']){delete _0x2b6a0e[_0xa55c('0x46')]['id'];}return db[_0xa55c('0x3b')]['find']({'where':{'id':_0x2b6a0e[_0xa55c('0x50')]['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x228df4,null))['then'](saveUpdates(_0x2b6a0e[_0xa55c('0x46')],null))[_0xa55c('0x1f')](respondWithResult(_0x228df4,null))[_0xa55c('0x44')](handleError(_0x228df4,null));};exports[_0xa55c('0x20')]=function(_0x50176b,_0x4def35){return db[_0xa55c('0x3b')][_0xa55c('0x43')]({'where':{'id':_0x50176b[_0xa55c('0x50')]['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x4def35,null))['then'](removeEntity(_0x4def35,null))[_0xa55c('0x44')](handleError(_0x4def35,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 7583d5e..77e495a 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','ContactItemType','tools_contact_item_types','util','../../config/logger','api'];(function(_0x422f85,_0x524b76){var _0x5a12c1=function(_0x16d96a){while(--_0x16d96a){_0x422f85['push'](_0x422f85['shift']());}};_0x5a12c1(++_0x524b76);}(_0x2eb2,0x19f));var _0x22eb=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2eb2[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb073=['rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','util','api','moment','bluebird','path'];(function(_0x4cb1c8,_0x394fe7){var _0x10513b=function(_0x178bb0){while(--_0x178bb0){_0x4cb1c8['push'](_0x4cb1c8['shift']());}};_0x10513b(++_0x394fe7);}(_0xb073,0x187));var _0x3b07=function(_0x4981d8,_0x4796f8){_0x4981d8=_0x4981d8-0x0;var _0x4e2060=_0xb073[_0x4981d8];return _0x4e2060;};'use strict';var _=require('lodash');var util=require(_0x3b07('0x0'));var logger=require('../../config/logger')(_0x3b07('0x1'));var moment=require(_0x3b07('0x2'));var BPromise=require(_0x3b07('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b07('0x4'));var rimraf=require(_0x3b07('0x5'));var config=require(_0x3b07('0x6'));var attributes=require('./contactItemType.attributes');module[_0x3b07('0x7')]=function(_0x27d168,_0x1d3082){return _0x27d168[_0x3b07('0x8')](_0x3b07('0x9'),attributes,{'tableName':_0x3b07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 7b3f56f..6e6171b 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae0=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6ae0,0x192));var _0x06ae=function(_0x4232f0,_0x2bd888){_0x4232f0=_0x4232f0-0x0;var _0x2d7ee0=_0x6ae0[_0x4232f0];return _0x2d7ee0;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var moment=require(_0x06ae('0x2'));var BPromise=require(_0x06ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x06ae('0x5'))('rpc');var config=require(_0x06ae('0x6'));var jayson=require(_0x06ae('0x7'));var client=jayson['client'][_0x06ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bac4,_0x26167c,_0x2bc2ad){return new BPromise(function(_0x591c0f,_0x269be5){return client[_0x06ae('0x9')](_0x51bac4,_0x2bc2ad)[_0x06ae('0xa')](function(_0x39f10e){logger[_0x06ae('0xb')](_0x06ae('0xc'),_0x26167c,_0x06ae('0xd'));logger['debug'](_0x06ae('0xe'),_0x26167c,_0x06ae('0xd'),JSON[_0x06ae('0xf')](_0x39f10e));if(_0x39f10e[_0x06ae('0x10')]){if(_0x39f10e[_0x06ae('0x10')][_0x06ae('0x11')]===0x1f4){logger[_0x06ae('0x10')]('ContactItemType,\x20%s,\x20%s',_0x26167c,_0x39f10e['error']['message']);return _0x269be5(_0x39f10e[_0x06ae('0x10')]['message']);}logger[_0x06ae('0x10')](_0x06ae('0xc'),_0x26167c,_0x39f10e[_0x06ae('0x10')][_0x06ae('0x12')]);return _0x591c0f(_0x39f10e['error']['message']);}else{logger[_0x06ae('0xb')]('ContactItemType,\x20%s,\x20%s',_0x26167c,_0x06ae('0xd'));_0x591c0f(_0x39f10e[_0x06ae('0x13')][_0x06ae('0x12')]);}})['catch'](function(_0x4ec020){logger['error'](_0x06ae('0xc'),_0x26167c,_0x4ec020);_0x269be5(_0x4ec020);});});} \ No newline at end of file +var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x14fd36,_0x6c4dcb){var _0x4cc0ad=function(_0x2f64bc){while(--_0x2f64bc){_0x14fd36['push'](_0x14fd36['shift']());}};_0x4cc0ad(++_0x6c4dcb);}(_0xda55,0x6d));var _0x5da5=function(_0x3add96,_0x1e76f8){_0x3add96=_0x3add96-0x0;var _0x2f43fb=_0xda55[_0x3add96];return _0x2f43fb;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('ContactItemType,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 53f70f8..c7546eb 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf16a=['index','show','post','create','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf16a,0x1c2));var _0xaf16=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xf16a[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0xaf16('0x0'));var util=require(_0xaf16('0x1'));var path=require(_0xaf16('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf16('0x3'));var router=express[_0xaf16('0x4')]();var auth=require(_0xaf16('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf16('0x6'));var controller=require('./contactItemType.controller');router[_0xaf16('0x7')]('/',auth[_0xaf16('0x8')](),controller[_0xaf16('0x9')]);router[_0xaf16('0x7')]('/:id',auth[_0xaf16('0x8')](),controller[_0xaf16('0xa')]);router[_0xaf16('0xb')]('/',auth[_0xaf16('0x8')](),controller[_0xaf16('0xc')]);router['put'](_0xaf16('0xd'),auth['isAuthenticated'](),controller[_0xaf16('0xe')]);router[_0xaf16('0xf')]('/:id',auth[_0xaf16('0x8')](),controller[_0xaf16('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9b38=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9b38,0x193));var _0x89b3=function(_0x1eb728,_0x4c3303){_0x1eb728=_0x1eb728-0x0;var _0x490b89=_0x9b38[_0x1eb728];return _0x490b89;};'use strict';var multer=require(_0x89b3('0x0'));var util=require(_0x89b3('0x1'));var path=require('path');var timeout=require(_0x89b3('0x2'));var express=require(_0x89b3('0x3'));var router=express[_0x89b3('0x4')]();var auth=require(_0x89b3('0x5'));var interaction=require(_0x89b3('0x6'));var config=require(_0x89b3('0x7'));var controller=require('./contactItemType.controller');router[_0x89b3('0x8')]('/',auth[_0x89b3('0x9')](),controller['index']);router[_0x89b3('0x8')]('/:id',auth[_0x89b3('0x9')](),controller['show']);router[_0x89b3('0xa')]('/',auth[_0x89b3('0x9')](),controller[_0x89b3('0xb')]);router['put'](_0x89b3('0xc'),auth[_0x89b3('0x9')](),controller[_0x89b3('0xd')]);router[_0x89b3('0xe')]('/:id',auth[_0x89b3('0x9')](),controller[_0x89b3('0xf')]);module[_0x89b3('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 09f675e..97a2bee 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 _0x8f2d=['STRING','sequelize','exports','name'];(function(_0x21448b,_0x14dee3){var _0x2956e2=function(_0x5623a5){while(--_0x5623a5){_0x21448b['push'](_0x21448b['shift']());}};_0x2956e2(++_0x14dee3);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x4dc9a9,_0x28c9de){_0x4dc9a9=_0x4dc9a9-0x0;var _0x29c238=_0x8f2d[_0x4dc9a9];return _0x29c238;};'use strict';var Sequelize=require(_0xd8f2('0x0'));module[_0xd8f2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd8f2('0x2')},'description':{'type':Sequelize[_0xd8f2('0x3')]}}; \ No newline at end of file +var _0x2675=['STRING','sequelize'];(function(_0x3979d3,_0x2994b3){var _0x60d445=function(_0x3eeace){while(--_0x3eeace){_0x3979d3['push'](_0x3979d3['shift']());}};_0x60d445(++_0x2994b3);}(_0x2675,0x75));var _0x5267=function(_0x3bcc36,_0x32f3fd){_0x3bcc36=_0x3bcc36-0x0;var _0x53d800=_0x2675[_0x3bcc36];return _0x53d800;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x5267('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ddf4e6a..3b0d6ec 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 _0x18e6=['../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','index','Dashboard','fieldName','model','name','query','keys','filters','attributes','intersection','fields','order','sort','filter','merge','where','map','options','include','findAll','catch','show','includeAll','find','create','body','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','length','omit','updatedAt','createdAt','user','params','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardItem','getItems','findOne','pick','hasOwnProperty','nolimit','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4c3d8a,_0x4d792b){var _0x355bc9=function(_0xaeb4dc){while(--_0xaeb4dc){_0x4c3d8a['push'](_0x4c3d8a['shift']());}};_0x355bc9(++_0x4d792b);}(_0x18e6,0x1c4));var _0x618e=function(_0x2161d4,_0x34f5d5){_0x2161d4=_0x2161d4-0x0;var _0x21bce8=_0x18e6[_0x2161d4];return _0x21bce8;};'use strict';var pdf=require(_0x618e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x618e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x618e('0x2'));var moment=require(_0x618e('0x3'));var BPromise=require(_0x618e('0x4'));var Mustache=require(_0x618e('0x5'));var util=require(_0x618e('0x6'));var path=require(_0x618e('0x7'));var sox=require('sox');var csv=require(_0x618e('0x8'));var ejs=require(_0x618e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x618e('0xa'));var crypto=require(_0x618e('0xb'));var jsforce=require(_0x618e('0xc'));var deskjs=require(_0x618e('0xd'));var toCsv=require(_0x618e('0x8'));var querystring=require(_0x618e('0xe'));var Papa=require(_0x618e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x618e('0x10'));var as=require(_0x618e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x618e('0x12'))(_0x618e('0x13'));var utils=require(_0x618e('0x14'));var config=require('../../config/environment');var db=require(_0x618e('0x15'))['db'];config[_0x618e('0x16')]=_[_0x618e('0x17')](config[_0x618e('0x16')],{'host':_0x618e('0x18'),'port':0x18eb});var socket=require(_0x618e('0x19'))(new Redis(config['redis']));require(_0x618e('0x1a'))[_0x618e('0x1b')](socket);function respondWithStatusCode(_0x374438,_0x50970a){_0x50970a=_0x50970a||0xcc;return function(_0x4f43d4){if(_0x4f43d4){return _0x374438[_0x618e('0x1c')](_0x50970a);}return _0x374438[_0x618e('0x1d')](_0x50970a)[_0x618e('0x1e')]();};}function respondWithResult(_0x317309,_0x11a867){_0x11a867=_0x11a867||0xc8;return function(_0xef26ae){if(_0xef26ae){return _0x317309[_0x618e('0x1d')](_0x11a867)[_0x618e('0x1f')](_0xef26ae);}};}function respondWithFilteredResult(_0x38cc09,_0xf2d0c4){return function(_0x2e3c8d){if(_0x2e3c8d){var _0x468fe9=_0x2e3c8d[_0x618e('0x20')],_0x53d7cb=_0xf2d0c4[_0x618e('0x21')],_0x44bf7e=_0xf2d0c4['offset']+_0xf2d0c4[_0x618e('0x22')],_0x55a0e2;if(_0x44bf7e>=_0x468fe9){_0x44bf7e=_0x468fe9;_0x55a0e2=0xc8;}else{_0x55a0e2=0xce;}_0x38cc09[_0x618e('0x1d')](_0x55a0e2);return _0x38cc09['set'](_0x618e('0x23'),_0x53d7cb+'-'+_0x44bf7e+'/'+_0x468fe9)['json'](_0x2e3c8d);}return null;};}function patchUpdates(_0x4fe791){return function(_0x3f11f7){try{jsonpatch[_0x618e('0x24')](_0x3f11f7,_0x4fe791,!![]);}catch(_0x2b6144){return BPromise[_0x618e('0x25')](_0x2b6144);}return _0x3f11f7[_0x618e('0x26')]();};}function saveUpdates(_0x25823f,_0x34fdbe){return function(_0x2ed6a6){if(_0x2ed6a6){return _0x2ed6a6['update'](_0x25823f)[_0x618e('0x27')](function(_0x2b923f){return _0x2b923f;});}return null;};}function removeEntity(_0x58bc0e,_0x5b6ed6){return function(_0x401a3c){if(_0x401a3c){return _0x401a3c['destroy']()[_0x618e('0x27')](function(){var _0x2d7edc=_0x401a3c[_0x618e('0x28')]({'plain':!![]});var _0xd218b2=_0x618e('0x29');return db[_0x618e('0x2a')][_0x618e('0x2b')]({'where':{'type':_0xd218b2,'resourceId':_0x2d7edc['id']}})[_0x618e('0x27')](function(){return _0x401a3c;});})['then'](function(){_0x58bc0e[_0x618e('0x1d')](0xcc)[_0x618e('0x1e')]();});}};}function handleEntityNotFound(_0x535568,_0x4c52b8){return function(_0x5a008d){if(!_0x5a008d){_0x535568[_0x618e('0x1c')](0x194);}return _0x5a008d;};}function handleError(_0x5e5347,_0x30d7ff){_0x30d7ff=_0x30d7ff||0x1f4;return function(_0x33c310){logger[_0x618e('0x2c')](_0x33c310[_0x618e('0x2d')]);if(_0x33c310['name']){delete _0x33c310['name'];}_0x5e5347['status'](_0x30d7ff)['send'](_0x33c310);};}exports[_0x618e('0x2e')]=function(_0x1ff3b3,_0x361fe3){var _0x51d1e={},_0x523bd9={},_0x24129a={'count':0x0,'rows':[]};var _0x4d9efb=_['map'](db[_0x618e('0x2f')]['rawAttributes'],function(_0x582cd2){return{'name':_0x582cd2[_0x618e('0x30')],'type':_0x582cd2['type']['key']};});_0x523bd9[_0x618e('0x31')]=_['map'](_0x4d9efb,_0x618e('0x32'));_0x523bd9[_0x618e('0x33')]=_[_0x618e('0x34')](_0x1ff3b3['query']);_0x523bd9[_0x618e('0x35')]=_['intersection'](_0x523bd9[_0x618e('0x31')],_0x523bd9[_0x618e('0x33')]);_0x51d1e[_0x618e('0x36')]=_[_0x618e('0x37')](_0x523bd9[_0x618e('0x31')],qs[_0x618e('0x38')](_0x1ff3b3[_0x618e('0x33')]['fields']));_0x51d1e['attributes']=_0x51d1e[_0x618e('0x36')]['length']?_0x51d1e['attributes']:_0x523bd9[_0x618e('0x31')];if(!_0x1ff3b3[_0x618e('0x33')]['hasOwnProperty']('nolimit')){_0x51d1e[_0x618e('0x22')]=qs[_0x618e('0x22')](_0x1ff3b3[_0x618e('0x33')][_0x618e('0x22')]);_0x51d1e['offset']=qs[_0x618e('0x21')](_0x1ff3b3[_0x618e('0x33')][_0x618e('0x21')]);}_0x51d1e[_0x618e('0x39')]=qs[_0x618e('0x3a')](_0x1ff3b3[_0x618e('0x33')][_0x618e('0x3a')]);_0x51d1e['where']=qs['filters'](_['pick'](_0x1ff3b3[_0x618e('0x33')],_0x523bd9[_0x618e('0x35')]),_0x4d9efb);if(_0x1ff3b3[_0x618e('0x33')][_0x618e('0x3b')]){_0x51d1e['where']=_[_0x618e('0x3c')](_0x51d1e[_0x618e('0x3d')],{'$or':_[_0x618e('0x3e')](_0x4d9efb,function(_0x5a8c1d){if(_0x5a8c1d['type']!=='VIRTUAL'){var _0x209c96={};_0x209c96[_0x5a8c1d[_0x618e('0x32')]]={'$like':'%'+_0x1ff3b3[_0x618e('0x33')][_0x618e('0x3b')]+'%'};return _0x209c96;}})});}_0x51d1e=_[_0x618e('0x3c')]({},_0x51d1e,_0x1ff3b3[_0x618e('0x3f')]);var _0x4b8ee1={'where':_0x51d1e[_0x618e('0x3d')]};return db[_0x618e('0x2f')][_0x618e('0x20')](_0x4b8ee1)[_0x618e('0x27')](function(_0x3269d7){_0x24129a[_0x618e('0x20')]=_0x3269d7;if(_0x1ff3b3[_0x618e('0x33')]['includeAll']){_0x51d1e[_0x618e('0x40')]=[{'all':!![]}];}return db[_0x618e('0x2f')][_0x618e('0x41')](_0x51d1e);})[_0x618e('0x27')](function(_0x1896ef){_0x24129a['rows']=_0x1896ef;return _0x24129a;})['then'](respondWithFilteredResult(_0x361fe3,_0x51d1e))[_0x618e('0x42')](handleError(_0x361fe3,null));};exports[_0x618e('0x43')]=function(_0xe09739,_0x1d1c13){var _0x2916bc={'raw':![],'where':{'id':_0xe09739['params']['id']}},_0x170b0b={};_0x170b0b['model']=_[_0x618e('0x34')](db[_0x618e('0x2f')]['rawAttributes']);_0x170b0b[_0x618e('0x33')]=_['keys'](_0xe09739[_0x618e('0x33')]);_0x170b0b[_0x618e('0x35')]=_['intersection'](_0x170b0b['model'],_0x170b0b['query']);_0x2916bc['attributes']=_[_0x618e('0x37')](_0x170b0b[_0x618e('0x31')],qs[_0x618e('0x38')](_0xe09739[_0x618e('0x33')]['fields']));_0x2916bc[_0x618e('0x36')]=_0x2916bc[_0x618e('0x36')]['length']?_0x2916bc[_0x618e('0x36')]:_0x170b0b[_0x618e('0x31')];if(_0xe09739[_0x618e('0x33')][_0x618e('0x44')]){_0x2916bc['include']=[{'all':!![]}];}_0x2916bc=_[_0x618e('0x3c')]({},_0x2916bc,_0xe09739[_0x618e('0x3f')]);return db[_0x618e('0x2f')][_0x618e('0x45')](_0x2916bc)['then'](handleEntityNotFound(_0x1d1c13,null))[_0x618e('0x27')](respondWithResult(_0x1d1c13,null))[_0x618e('0x42')](handleError(_0x1d1c13,null));};exports[_0x618e('0x46')]=function(_0x350557,_0x1c8b82){return db[_0x618e('0x2f')]['create'](_0x350557[_0x618e('0x47')],{})[_0x618e('0x27')](function(_0x22cdc0){var _0x410583=_0x350557['user'][_0x618e('0x28')]({'plain':!![]});if(!_0x410583)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410583[_0x618e('0x48')]==='user'){var _0x3e256c=_0x22cdc0[_0x618e('0x28')]({'plain':!![]});var _0x513f97=_0x618e('0x29');return db[_0x618e('0x49')]['find']({'where':{'name':_0x513f97,'userProfileId':_0x410583[_0x618e('0x4a')]},'raw':!![]})[_0x618e('0x27')](function(_0x4de954){if(_0x4de954&&_0x4de954['autoAssociation']===0x0){return db[_0x618e('0x2a')][_0x618e('0x46')]({'name':_0x3e256c[_0x618e('0x32')],'resourceId':_0x3e256c['id'],'type':_0x4de954[_0x618e('0x32')],'sectionId':_0x4de954['id']},{})[_0x618e('0x27')](function(){return _0x22cdc0;});}else{return _0x22cdc0;}})['catch'](function(_0x58d3a5){logger[_0x618e('0x2c')](_0x618e('0x4b'),_0x58d3a5);throw _0x58d3a5;});}return _0x22cdc0;})[_0x618e('0x27')](respondWithResult(_0x1c8b82,0xc9))['catch'](handleError(_0x1c8b82,null));};exports[_0x618e('0x4c')]=function(_0x184d28,_0x4b0965){var _0x4ca030={'where':{'id':_0x184d28['params']['id']}},_0x4dce4f={};_0x4dce4f[_0x618e('0x31')]=_[_0x618e('0x34')](db['Dashboard'][_0x618e('0x4d')]);_0x4ca030['attributes']=_['intersection'](_0x4dce4f[_0x618e('0x31')],qs[_0x618e('0x38')](_0x184d28['query'][_0x618e('0x38')]));_0x4ca030[_0x618e('0x36')]=_0x4ca030[_0x618e('0x36')][_0x618e('0x4e')]?_0x4ca030[_0x618e('0x36')]:_0x4dce4f['model'];if(_0x184d28[_0x618e('0x33')]['includeAll']){_0x4ca030['include']=[{'all':!![]}];}_0x4ca030=_[_0x618e('0x3c')]({},_0x4ca030,_0x184d28[_0x618e('0x3f')]);return db[_0x618e('0x2f')][_0x618e('0x45')](_0x4ca030)[_0x618e('0x27')](handleEntityNotFound(_0x4b0965,null))[_0x618e('0x27')](function(_0x3905e6){if(_0x3905e6){var _0x16852e=_0x3905e6[_0x618e('0x28')]({'plain':!![]});_0x16852e=qs[_0x618e('0x4f')](_0x16852e,['id','createdAt',_0x618e('0x50')]);_0x184d28[_0x618e('0x47')]=_[_0x618e('0x4f')](_0x184d28['body'],['id',_0x618e('0x51'),_0x618e('0x50')]);return db[_0x618e('0x2f')][_0x618e('0x46')](_[_0x618e('0x3c')](_0x16852e,_0x184d28[_0x618e('0x47')]),{'include':_0x184d28['query'][_0x618e('0x44')]?[{'all':!![]}]:undefined})[_0x618e('0x27')](function(_0x2c78cc){var _0x2f6934=_0x184d28['user']['get']({'plain':!![]});if(!_0x2f6934)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f6934[_0x618e('0x48')]===_0x618e('0x52')){var _0x364c6c=_0x2c78cc['get']({'plain':!![]});var _0x51be2c=_0x618e('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x51be2c,'userProfileId':_0x2f6934[_0x618e('0x4a')]},'raw':!![]})[_0x618e('0x27')](function(_0x5276c5){if(_0x5276c5&&_0x5276c5['autoAssociation']===0x0){return db[_0x618e('0x2a')][_0x618e('0x46')]({'name':_0x364c6c['name'],'resourceId':_0x364c6c['id'],'type':_0x5276c5[_0x618e('0x32')],'sectionId':_0x5276c5['id']},{})[_0x618e('0x27')](function(){return _0x2c78cc;});}else{return _0x2c78cc;}})[_0x618e('0x42')](function(_0xb5b689){logger[_0x618e('0x2c')](_0x618e('0x4b'),_0xb5b689);throw _0xb5b689;});}return _0x2c78cc;});}})[_0x618e('0x27')](respondWithResult(_0x4b0965,0xc9))[_0x618e('0x42')](handleError(_0x4b0965,null));};exports['update']=function(_0x584d58,_0x2b5b22){if(_0x584d58[_0x618e('0x47')]['id']){delete _0x584d58[_0x618e('0x47')]['id'];}return db[_0x618e('0x2f')]['find']({'where':{'id':_0x584d58[_0x618e('0x53')]['id']}})[_0x618e('0x27')](handleEntityNotFound(_0x2b5b22,null))[_0x618e('0x27')](saveUpdates(_0x584d58[_0x618e('0x47')],null))['then'](respondWithResult(_0x2b5b22,null))['catch'](handleError(_0x2b5b22,null));};exports['destroy']=function(_0x830c52,_0x28e379){return db[_0x618e('0x2f')][_0x618e('0x45')]({'where':{'id':_0x830c52['params']['id']}})[_0x618e('0x27')](handleEntityNotFound(_0x28e379,null))[_0x618e('0x27')](removeEntity(_0x28e379,null))[_0x618e('0x42')](handleError(_0x28e379,null));};function widgetAttributes(_0x33271c){try{switch(_0x33271c[_0x618e('0x54')]){case _0x618e('0x55'):return[{'name':_0x618e('0x56'),'value':_0x33271c['attrUrl']||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c[_0x618e('0x57')][0x0]['value']:undefined)||_0x618e('0x58')}];case _0x618e('0x59'):return[{'name':'attrPath','value':_0x33271c[_0x618e('0x5a')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c['attrs'][0x0][_0x618e('0x5b')]:undefined)||''}];case _0x618e('0x5c'):return[{'name':_0x618e('0x5d'),'value':_0x33271c['attrHourFormat']||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c[_0x618e('0x57')][0x0]['value']:undefined)||_0x618e('0x5e')},{'name':_0x618e('0x5f'),'value':_0x33271c[_0x618e('0x5f')]||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x1]?_0x33271c[_0x618e('0x57')][0x1][_0x618e('0x5b')]:undefined)||_0x618e('0x60')},{'name':_0x618e('0x61'),'value':_0x33271c[_0x618e('0x61')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x2]?_0x33271c[_0x618e('0x57')][0x2][_0x618e('0x5b')]:undefined)||0xc}];case _0x618e('0x62'):return[{'name':_0x618e('0x63'),'value':_0x33271c['attrMetric']||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c[_0x618e('0x57')][0x0][_0x618e('0x5b')]:undefined)||_0x618e('0x64')},{'name':_0x618e('0x65'),'value':_0x33271c[_0x618e('0x65')]||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x1]?_0x33271c[_0x618e('0x57')][0x1][_0x618e('0x5b')]:undefined)||[]},{'name':_0x618e('0x61'),'value':_0x33271c[_0x618e('0x61')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x2]?_0x33271c[_0x618e('0x57')][0x2][_0x618e('0x5b')]:undefined)||0x14}];case _0x618e('0x66'):case _0x618e('0x67'):return[{'name':_0x618e('0x68'),'value':_0x33271c[_0x618e('0x68')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c['attrs'][0x0]?_0x33271c[_0x618e('0x57')][0x0][_0x618e('0x5b')]:undefined)||'total'},{'name':_0x618e('0x69'),'value':_0x33271c[_0x618e('0x69')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c['attrs'][0x1]?_0x33271c[_0x618e('0x57')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x33271c[_0x618e('0x6a')]||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x2]?_0x33271c[_0x618e('0x57')][0x2][_0x618e('0x5b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x33271c[_0x618e('0x65')]||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x3]?_0x33271c[_0x618e('0x57')][0x3][_0x618e('0x5b')]:undefined)||[]}];case _0x618e('0x6b'):return[{'name':_0x618e('0x6c'),'type':_0x33271c[_0x618e('0x6d')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c[_0x618e('0x57')][0x0][_0x618e('0x54')]:undefined)||null,'value':_0x33271c[_0x618e('0x6c')]||(_0x33271c[_0x618e('0x57')]&&_0x33271c[_0x618e('0x57')][0x0]?_0x33271c[_0x618e('0x57')][0x0][_0x618e('0x5b')]:undefined)||null},{'name':_0x618e('0x6e'),'value':_0x33271c[_0x618e('0x6e')]||(_0x33271c['attrs']&&_0x33271c[_0x618e('0x57')][0x1]?_0x33271c[_0x618e('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xe8d9a4){logger[_0x618e('0x2c')](_0x618e('0x6f'),JSON['stringify'](_0xe8d9a4));return[];}}exports['addItem']=function(_0x3124e7,_0x5bfb5d,_0x5c47c4){if(_0x3124e7['body']['id']){delete _0x3124e7[_0x618e('0x47')]['id'];}return db[_0x618e('0x2f')][_0x618e('0x45')]({'where':{'id':_0x3124e7[_0x618e('0x53')]['id']}})[_0x618e('0x27')](handleEntityNotFound(_0x5bfb5d,null))[_0x618e('0x27')](function(_0x562a88){if(_0x562a88){_0x3124e7[_0x618e('0x47')]['DashboardId']=_0x562a88['id'];_0x3124e7[_0x618e('0x47')]['attrs']=widgetAttributes(_0x3124e7['body']);return db[_0x618e('0x70')][_0x618e('0x46')](_0x3124e7['body']);}})['then'](respondWithResult(_0x5bfb5d,null))[_0x618e('0x42')](handleError(_0x5bfb5d,null));};exports[_0x618e('0x71')]=function(_0x2cccb6,_0x2776bc,_0x5f3ca4){var _0x203f4e={};var _0x107a00={};var _0x4d89dd;var _0x2aa4f5;return db[_0x618e('0x2f')][_0x618e('0x72')]({'where':{'id':_0x2cccb6[_0x618e('0x53')]['id']}})['then'](handleEntityNotFound(_0x2776bc,null))['then'](function(_0x31b916){if(_0x31b916){_0x4d89dd=_0x31b916;_0x107a00[_0x618e('0x31')]=_[_0x618e('0x34')](db[_0x618e('0x70')][_0x618e('0x4d')]);_0x107a00['query']=_[_0x618e('0x34')](_0x2cccb6[_0x618e('0x33')]);_0x107a00[_0x618e('0x35')]=_['intersection'](_0x107a00['model'],_0x107a00[_0x618e('0x33')]);_0x203f4e[_0x618e('0x36')]=_[_0x618e('0x37')](_0x107a00[_0x618e('0x31')],qs['fields'](_0x2cccb6['query'][_0x618e('0x38')]));_0x203f4e[_0x618e('0x36')]=_0x203f4e['attributes'][_0x618e('0x4e')]?_0x203f4e['attributes']:_0x107a00['model'];_0x203f4e[_0x618e('0x39')]=qs['sort'](_0x2cccb6[_0x618e('0x33')][_0x618e('0x3a')]);_0x203f4e[_0x618e('0x3d')]=qs['filters'](_[_0x618e('0x73')](_0x2cccb6[_0x618e('0x33')],_0x107a00['filters']));if(_0x2cccb6[_0x618e('0x33')][_0x618e('0x3b')]){_0x203f4e[_0x618e('0x3d')]=_['merge'](_0x203f4e[_0x618e('0x3d')],{'$or':_[_0x618e('0x3e')](_0x203f4e[_0x618e('0x36')],function(_0x1957d4){var _0x27717d={};_0x27717d[_0x1957d4]={'$like':'%'+_0x2cccb6[_0x618e('0x33')][_0x618e('0x3b')]+'%'};return _0x27717d;})});}_0x203f4e=_[_0x618e('0x3c')]({},_0x203f4e,_0x2cccb6['options']);return _0x4d89dd[_0x618e('0x71')](_0x203f4e);}})[_0x618e('0x27')](function(_0x526b80){if(_0x526b80){_0x2aa4f5=_0x526b80[_0x618e('0x4e')];if(!_0x2cccb6[_0x618e('0x33')][_0x618e('0x74')](_0x618e('0x75'))){_0x203f4e[_0x618e('0x22')]=qs[_0x618e('0x22')](_0x2cccb6['query'][_0x618e('0x22')]);_0x203f4e[_0x618e('0x21')]=qs[_0x618e('0x21')](_0x2cccb6[_0x618e('0x33')][_0x618e('0x21')]);}return _0x4d89dd[_0x618e('0x71')](_0x203f4e);}})[_0x618e('0x27')](function(_0x34a381){if(_0x34a381){return _0x34a381?{'count':_0x2aa4f5,'rows':_0x34a381}:null;}})[_0x618e('0x27')](respondWithResult(_0x2776bc,null))['catch'](handleError(_0x2776bc,null));}; \ No newline at end of file +var _0x4a6d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','json','limit','Content-Range','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','VIRTUAL','options','Dashboard','count','findAll','rows','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','params','length','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xe4e01c,_0x221957){var _0x1c644d=function(_0x5cc5c8){while(--_0x5cc5c8){_0xe4e01c['push'](_0xe4e01c['shift']());}};_0x1c644d(++_0x221957);}(_0x4a6d,0x168));var _0xd4a6=function(_0x1930b9,_0xeb4e43){_0x1930b9=_0x1930b9-0x0;var _0x5be371=_0x4a6d[_0x1930b9];return _0x5be371;};'use strict';var pdf=require(_0xd4a6('0x0'));var emlformat=require(_0xd4a6('0x1'));var rimraf=require(_0xd4a6('0x2'));var zipdir=require(_0xd4a6('0x3'));var jsonpatch=require(_0xd4a6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd4a6('0x5'));var Mustache=require(_0xd4a6('0x6'));var util=require(_0xd4a6('0x7'));var path=require(_0xd4a6('0x8'));var sox=require('sox');var csv=require(_0xd4a6('0x9'));var ejs=require(_0xd4a6('0xa'));var fs=require('fs');var _=require(_0xd4a6('0xb'));var squel=require(_0xd4a6('0xc'));var crypto=require(_0xd4a6('0xd'));var jsforce=require(_0xd4a6('0xe'));var deskjs=require(_0xd4a6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd4a6('0x10'));var Papa=require(_0xd4a6('0x11'));var Redis=require(_0xd4a6('0x12'));var authService=require(_0xd4a6('0x13'));var qs=require(_0xd4a6('0x14'));var as=require(_0xd4a6('0x15'));var hardwareService=require(_0xd4a6('0x16'));var logger=require(_0xd4a6('0x17'))(_0xd4a6('0x18'));var utils=require(_0xd4a6('0x19'));var config=require(_0xd4a6('0x1a'));var db=require(_0xd4a6('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4a6('0x1c'),'port':0x18eb});var socket=require(_0xd4a6('0x1d'))(new Redis(config[_0xd4a6('0x1e')]));require(_0xd4a6('0x1f'))[_0xd4a6('0x20')](socket);function respondWithStatusCode(_0x6a974a,_0x36be96){_0x36be96=_0x36be96||0xcc;return function(_0x3ac8a7){if(_0x3ac8a7){return _0x6a974a[_0xd4a6('0x21')](_0x36be96);}return _0x6a974a[_0xd4a6('0x22')](_0x36be96)[_0xd4a6('0x23')]();};}function respondWithResult(_0x10b459,_0x5e8aab){_0x5e8aab=_0x5e8aab||0xc8;return function(_0x51f9ae){if(_0x51f9ae){return _0x10b459[_0xd4a6('0x22')](_0x5e8aab)[_0xd4a6('0x24')](_0x51f9ae);}};}function respondWithFilteredResult(_0x4f48b0,_0x475d9b){return function(_0x162584){if(_0x162584){var _0x3b0999=_0x162584['count'],_0x24a26c=_0x475d9b['offset'],_0x338f3d=_0x475d9b['offset']+_0x475d9b[_0xd4a6('0x25')],_0x242554;if(_0x338f3d>=_0x3b0999){_0x338f3d=_0x3b0999;_0x242554=0xc8;}else{_0x242554=0xce;}_0x4f48b0['status'](_0x242554);return _0x4f48b0['set'](_0xd4a6('0x26'),_0x24a26c+'-'+_0x338f3d+'/'+_0x3b0999)[_0xd4a6('0x24')](_0x162584);}return null;};}function patchUpdates(_0x3fa396){return function(_0x52fe71){try{jsonpatch[_0xd4a6('0x27')](_0x52fe71,_0x3fa396,!![]);}catch(_0x501a12){return BPromise['reject'](_0x501a12);}return _0x52fe71[_0xd4a6('0x28')]();};}function saveUpdates(_0x3af3ef,_0x49e0f5){return function(_0x5f4a88){if(_0x5f4a88){return _0x5f4a88['update'](_0x3af3ef)[_0xd4a6('0x29')](function(_0x1081ac){return _0x1081ac;});}return null;};}function removeEntity(_0x415d0f,_0x54493e){return function(_0x58e1e0){if(_0x58e1e0){return _0x58e1e0[_0xd4a6('0x2a')]()[_0xd4a6('0x29')](function(){var _0x2ed1f9=_0x58e1e0[_0xd4a6('0x2b')]({'plain':!![]});var _0x2cb1c0=_0xd4a6('0x2c');return db[_0xd4a6('0x2d')][_0xd4a6('0x2a')]({'where':{'type':_0x2cb1c0,'resourceId':_0x2ed1f9['id']}})[_0xd4a6('0x29')](function(){return _0x58e1e0;});})['then'](function(){_0x415d0f[_0xd4a6('0x22')](0xcc)[_0xd4a6('0x23')]();});}};}function handleEntityNotFound(_0x1d5870,_0x33e5a1){return function(_0x28b156){if(!_0x28b156){_0x1d5870[_0xd4a6('0x21')](0x194);}return _0x28b156;};}function handleError(_0x5bb823,_0x83bc0f){_0x83bc0f=_0x83bc0f||0x1f4;return function(_0x4737e2){logger[_0xd4a6('0x2e')](_0x4737e2['stack']);if(_0x4737e2['name']){delete _0x4737e2[_0xd4a6('0x2f')];}_0x5bb823[_0xd4a6('0x22')](_0x83bc0f)[_0xd4a6('0x30')](_0x4737e2);};}exports[_0xd4a6('0x31')]=function(_0x2c639f,_0x1e9cb4){var _0x4e8d93={},_0x5b4379={},_0x2804af={'count':0x0,'rows':[]};var _0x3e3923=_[_0xd4a6('0x32')](db['Dashboard'][_0xd4a6('0x33')],function(_0x21e388){return{'name':_0x21e388[_0xd4a6('0x34')],'type':_0x21e388[_0xd4a6('0x35')][_0xd4a6('0x36')]};});_0x5b4379[_0xd4a6('0x37')]=_['map'](_0x3e3923,_0xd4a6('0x2f'));_0x5b4379[_0xd4a6('0x38')]=_[_0xd4a6('0x39')](_0x2c639f[_0xd4a6('0x38')]);_0x5b4379[_0xd4a6('0x3a')]=_['intersection'](_0x5b4379[_0xd4a6('0x37')],_0x5b4379[_0xd4a6('0x38')]);_0x4e8d93[_0xd4a6('0x3b')]=_[_0xd4a6('0x3c')](_0x5b4379['model'],qs[_0xd4a6('0x3d')](_0x2c639f[_0xd4a6('0x38')][_0xd4a6('0x3d')]));_0x4e8d93[_0xd4a6('0x3b')]=_0x4e8d93[_0xd4a6('0x3b')]['length']?_0x4e8d93[_0xd4a6('0x3b')]:_0x5b4379[_0xd4a6('0x37')];if(!_0x2c639f[_0xd4a6('0x38')][_0xd4a6('0x3e')](_0xd4a6('0x3f'))){_0x4e8d93[_0xd4a6('0x25')]=qs[_0xd4a6('0x25')](_0x2c639f[_0xd4a6('0x38')][_0xd4a6('0x25')]);_0x4e8d93['offset']=qs[_0xd4a6('0x40')](_0x2c639f['query'][_0xd4a6('0x40')]);}_0x4e8d93[_0xd4a6('0x41')]=qs['sort'](_0x2c639f['query'][_0xd4a6('0x42')]);_0x4e8d93[_0xd4a6('0x43')]=qs[_0xd4a6('0x3a')](_['pick'](_0x2c639f[_0xd4a6('0x38')],_0x5b4379[_0xd4a6('0x3a')]),_0x3e3923);if(_0x2c639f[_0xd4a6('0x38')]['filter']){_0x4e8d93[_0xd4a6('0x43')]=_[_0xd4a6('0x44')](_0x4e8d93['where'],{'$or':_[_0xd4a6('0x32')](_0x3e3923,function(_0x56f083){if(_0x56f083[_0xd4a6('0x35')]!==_0xd4a6('0x45')){var _0x26c185={};_0x26c185[_0x56f083[_0xd4a6('0x2f')]]={'$like':'%'+_0x2c639f['query']['filter']+'%'};return _0x26c185;}})});}_0x4e8d93=_['merge']({},_0x4e8d93,_0x2c639f[_0xd4a6('0x46')]);var _0x762ec6={'where':_0x4e8d93[_0xd4a6('0x43')]};return db[_0xd4a6('0x47')][_0xd4a6('0x48')](_0x762ec6)['then'](function(_0x2d83e3){_0x2804af[_0xd4a6('0x48')]=_0x2d83e3;if(_0x2c639f[_0xd4a6('0x38')]['includeAll']){_0x4e8d93['include']=[{'all':!![]}];}return db[_0xd4a6('0x47')][_0xd4a6('0x49')](_0x4e8d93);})[_0xd4a6('0x29')](function(_0x5c4847){_0x2804af[_0xd4a6('0x4a')]=_0x5c4847;return _0x2804af;})[_0xd4a6('0x29')](respondWithFilteredResult(_0x1e9cb4,_0x4e8d93))['catch'](handleError(_0x1e9cb4,null));};exports['show']=function(_0x3fbd2b,_0x15b50a){var _0x4ff58a={'raw':![],'where':{'id':_0x3fbd2b['params']['id']}},_0x3e00c6={};_0x3e00c6[_0xd4a6('0x37')]=_[_0xd4a6('0x39')](db['Dashboard'][_0xd4a6('0x33')]);_0x3e00c6['query']=_[_0xd4a6('0x39')](_0x3fbd2b['query']);_0x3e00c6[_0xd4a6('0x3a')]=_['intersection'](_0x3e00c6[_0xd4a6('0x37')],_0x3e00c6[_0xd4a6('0x38')]);_0x4ff58a[_0xd4a6('0x3b')]=_[_0xd4a6('0x3c')](_0x3e00c6[_0xd4a6('0x37')],qs[_0xd4a6('0x3d')](_0x3fbd2b['query']['fields']));_0x4ff58a[_0xd4a6('0x3b')]=_0x4ff58a[_0xd4a6('0x3b')]['length']?_0x4ff58a['attributes']:_0x3e00c6[_0xd4a6('0x37')];if(_0x3fbd2b[_0xd4a6('0x38')][_0xd4a6('0x4b')]){_0x4ff58a[_0xd4a6('0x4c')]=[{'all':!![]}];}_0x4ff58a=_['merge']({},_0x4ff58a,_0x3fbd2b[_0xd4a6('0x46')]);return db[_0xd4a6('0x47')][_0xd4a6('0x4d')](_0x4ff58a)['then'](handleEntityNotFound(_0x15b50a,null))[_0xd4a6('0x29')](respondWithResult(_0x15b50a,null))[_0xd4a6('0x4e')](handleError(_0x15b50a,null));};exports[_0xd4a6('0x4f')]=function(_0x16bddc,_0x455da1){return db['Dashboard']['create'](_0x16bddc[_0xd4a6('0x50')],{})[_0xd4a6('0x29')](function(_0x4c3f9c){var _0x57e776=_0x16bddc[_0xd4a6('0x51')][_0xd4a6('0x2b')]({'plain':!![]});if(!_0x57e776)throw new Error(_0xd4a6('0x52'));if(_0x57e776[_0xd4a6('0x53')]==='user'){var _0x7e5cca=_0x4c3f9c[_0xd4a6('0x2b')]({'plain':!![]});var _0x46217f=_0xd4a6('0x2c');return db[_0xd4a6('0x54')]['find']({'where':{'name':_0x46217f,'userProfileId':_0x57e776['userProfileId']},'raw':!![]})['then'](function(_0x464581){if(_0x464581&&_0x464581[_0xd4a6('0x55')]===0x0){return db[_0xd4a6('0x2d')][_0xd4a6('0x4f')]({'name':_0x7e5cca[_0xd4a6('0x2f')],'resourceId':_0x7e5cca['id'],'type':_0x464581[_0xd4a6('0x2f')],'sectionId':_0x464581['id']},{})[_0xd4a6('0x29')](function(){return _0x4c3f9c;});}else{return _0x4c3f9c;}})[_0xd4a6('0x4e')](function(_0x5c41f8){logger[_0xd4a6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c41f8);throw _0x5c41f8;});}return _0x4c3f9c;})[_0xd4a6('0x29')](respondWithResult(_0x455da1,0xc9))[_0xd4a6('0x4e')](handleError(_0x455da1,null));};exports[_0xd4a6('0x56')]=function(_0x19e8cf,_0x2aef74){var _0x55ae28={'where':{'id':_0x19e8cf[_0xd4a6('0x57')]['id']}},_0xc40f82={};_0xc40f82['model']=_['keys'](db['Dashboard'][_0xd4a6('0x33')]);_0x55ae28[_0xd4a6('0x3b')]=_[_0xd4a6('0x3c')](_0xc40f82['model'],qs[_0xd4a6('0x3d')](_0x19e8cf[_0xd4a6('0x38')]['fields']));_0x55ae28[_0xd4a6('0x3b')]=_0x55ae28[_0xd4a6('0x3b')][_0xd4a6('0x58')]?_0x55ae28[_0xd4a6('0x3b')]:_0xc40f82[_0xd4a6('0x37')];if(_0x19e8cf['query'][_0xd4a6('0x4b')]){_0x55ae28[_0xd4a6('0x4c')]=[{'all':!![]}];}_0x55ae28=_[_0xd4a6('0x44')]({},_0x55ae28,_0x19e8cf['options']);return db[_0xd4a6('0x47')][_0xd4a6('0x4d')](_0x55ae28)['then'](handleEntityNotFound(_0x2aef74,null))[_0xd4a6('0x29')](function(_0x23930f){if(_0x23930f){var _0x435570=_0x23930f[_0xd4a6('0x2b')]({'plain':!![]});_0x435570=qs[_0xd4a6('0x59')](_0x435570,['id',_0xd4a6('0x5a'),'updatedAt']);_0x19e8cf['body']=_['omit'](_0x19e8cf[_0xd4a6('0x50')],['id',_0xd4a6('0x5a'),_0xd4a6('0x5b')]);return db[_0xd4a6('0x47')]['create'](_[_0xd4a6('0x44')](_0x435570,_0x19e8cf['body']),{'include':_0x19e8cf[_0xd4a6('0x38')][_0xd4a6('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x10bcb6){var _0x1ac02b=_0x19e8cf[_0xd4a6('0x51')][_0xd4a6('0x2b')]({'plain':!![]});if(!_0x1ac02b)throw new Error(_0xd4a6('0x52'));if(_0x1ac02b['role']===_0xd4a6('0x51')){var _0x2a24a8=_0x10bcb6[_0xd4a6('0x2b')]({'plain':!![]});var _0x2bc475=_0xd4a6('0x2c');return db[_0xd4a6('0x54')][_0xd4a6('0x4d')]({'where':{'name':_0x2bc475,'userProfileId':_0x1ac02b[_0xd4a6('0x5c')]},'raw':!![]})[_0xd4a6('0x29')](function(_0x5e548b){if(_0x5e548b&&_0x5e548b[_0xd4a6('0x55')]===0x0){return db[_0xd4a6('0x2d')][_0xd4a6('0x4f')]({'name':_0x2a24a8[_0xd4a6('0x2f')],'resourceId':_0x2a24a8['id'],'type':_0x5e548b[_0xd4a6('0x2f')],'sectionId':_0x5e548b['id']},{})[_0xd4a6('0x29')](function(){return _0x10bcb6;});}else{return _0x10bcb6;}})['catch'](function(_0x3b3870){logger['error'](_0xd4a6('0x5d'),_0x3b3870);throw _0x3b3870;});}return _0x10bcb6;});}})[_0xd4a6('0x29')](respondWithResult(_0x2aef74,0xc9))['catch'](handleError(_0x2aef74,null));};exports[_0xd4a6('0x5e')]=function(_0x2e912e,_0x87c20d){if(_0x2e912e[_0xd4a6('0x50')]['id']){delete _0x2e912e[_0xd4a6('0x50')]['id'];}return db['Dashboard'][_0xd4a6('0x4d')]({'where':{'id':_0x2e912e[_0xd4a6('0x57')]['id']}})['then'](handleEntityNotFound(_0x87c20d,null))[_0xd4a6('0x29')](saveUpdates(_0x2e912e[_0xd4a6('0x50')],null))[_0xd4a6('0x29')](respondWithResult(_0x87c20d,null))[_0xd4a6('0x4e')](handleError(_0x87c20d,null));};exports[_0xd4a6('0x2a')]=function(_0x2b190a,_0x3244a5){return db[_0xd4a6('0x47')]['find']({'where':{'id':_0x2b190a[_0xd4a6('0x57')]['id']}})[_0xd4a6('0x29')](handleEntityNotFound(_0x3244a5,null))['then'](removeEntity(_0x3244a5,null))[_0xd4a6('0x4e')](handleError(_0x3244a5,null));};function widgetAttributes(_0x4e7045){try{switch(_0x4e7045[_0xd4a6('0x35')]){case _0xd4a6('0x5f'):return[{'name':'attrUrl','value':_0x4e7045[_0xd4a6('0x60')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045['attrs'][0x0]?_0x4e7045[_0xd4a6('0x61')][0x0][_0xd4a6('0x62')]:undefined)||'https://'}];case'custom':return[{'name':_0xd4a6('0x63'),'value':_0x4e7045[_0xd4a6('0x63')]||(_0x4e7045['attrs']&&_0x4e7045[_0xd4a6('0x61')][0x0]?_0x4e7045['attrs'][0x0][_0xd4a6('0x62')]:undefined)||''}];case _0xd4a6('0x64'):return[{'name':_0xd4a6('0x65'),'value':_0x4e7045[_0xd4a6('0x65')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x0]?_0x4e7045[_0xd4a6('0x61')][0x0][_0xd4a6('0x62')]:undefined)||_0xd4a6('0x66')},{'name':_0xd4a6('0x67'),'value':_0x4e7045[_0xd4a6('0x67')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x1]?_0x4e7045['attrs'][0x1][_0xd4a6('0x62')]:undefined)||_0xd4a6('0x68')},{'name':_0xd4a6('0x69'),'value':_0x4e7045[_0xd4a6('0x69')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045['attrs'][0x2]?_0x4e7045[_0xd4a6('0x61')][0x2][_0xd4a6('0x62')]:undefined)||0xc}];case _0xd4a6('0x6a'):return[{'name':_0xd4a6('0x6b'),'value':_0x4e7045[_0xd4a6('0x6b')]||(_0x4e7045['attrs']&&_0x4e7045[_0xd4a6('0x61')][0x0]?_0x4e7045[_0xd4a6('0x61')][0x0][_0xd4a6('0x62')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4e7045[_0xd4a6('0x6c')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045['attrs'][0x1]?_0x4e7045[_0xd4a6('0x61')][0x1][_0xd4a6('0x62')]:undefined)||[]},{'name':_0xd4a6('0x69'),'value':_0x4e7045[_0xd4a6('0x69')]||(_0x4e7045['attrs']&&_0x4e7045[_0xd4a6('0x61')][0x2]?_0x4e7045[_0xd4a6('0x61')][0x2][_0xd4a6('0x62')]:undefined)||0x14}];case _0xd4a6('0x6d'):case _0xd4a6('0x6e'):return[{'name':_0xd4a6('0x6f'),'value':_0x4e7045['attrSerie1']||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x0]?_0x4e7045[_0xd4a6('0x61')][0x0]['value']:undefined)||_0xd4a6('0x70')},{'name':'attrSerie2','value':_0x4e7045[_0xd4a6('0x71')]||(_0x4e7045['attrs']&&_0x4e7045[_0xd4a6('0x61')][0x1]?_0x4e7045['attrs'][0x1][_0xd4a6('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x4e7045[_0xd4a6('0x72')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x2]?_0x4e7045[_0xd4a6('0x61')][0x2][_0xd4a6('0x62')]:undefined)||null},{'name':_0xd4a6('0x6c'),'value':_0x4e7045[_0xd4a6('0x6c')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x3]?_0x4e7045[_0xd4a6('0x61')][0x3][_0xd4a6('0x62')]:undefined)||[]}];case _0xd4a6('0x73'):return[{'name':_0xd4a6('0x74'),'type':_0x4e7045[_0xd4a6('0x75')]||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x0]?_0x4e7045['attrs'][0x0]['type']:undefined)||null,'value':_0x4e7045['attrReport']||(_0x4e7045['attrs']&&_0x4e7045['attrs'][0x0]?_0x4e7045[_0xd4a6('0x61')][0x0]['value']:undefined)||null},{'name':_0xd4a6('0x76'),'value':_0x4e7045['attrRefresh']||(_0x4e7045[_0xd4a6('0x61')]&&_0x4e7045[_0xd4a6('0x61')][0x1]?_0x4e7045[_0xd4a6('0x61')][0x1][_0xd4a6('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x574634){logger[_0xd4a6('0x2e')](_0xd4a6('0x77'),JSON[_0xd4a6('0x78')](_0x574634));return[];}}exports[_0xd4a6('0x79')]=function(_0x7ae409,_0x4ed67e,_0x23ad76){if(_0x7ae409[_0xd4a6('0x50')]['id']){delete _0x7ae409['body']['id'];}return db[_0xd4a6('0x47')][_0xd4a6('0x4d')]({'where':{'id':_0x7ae409[_0xd4a6('0x57')]['id']}})[_0xd4a6('0x29')](handleEntityNotFound(_0x4ed67e,null))[_0xd4a6('0x29')](function(_0x41bfd5){if(_0x41bfd5){_0x7ae409[_0xd4a6('0x50')]['DashboardId']=_0x41bfd5['id'];_0x7ae409[_0xd4a6('0x50')][_0xd4a6('0x61')]=widgetAttributes(_0x7ae409[_0xd4a6('0x50')]);return db[_0xd4a6('0x7a')][_0xd4a6('0x4f')](_0x7ae409[_0xd4a6('0x50')]);}})['then'](respondWithResult(_0x4ed67e,null))[_0xd4a6('0x4e')](handleError(_0x4ed67e,null));};exports[_0xd4a6('0x7b')]=function(_0x435773,_0x4c5a99,_0x47d46e){var _0x2688b8={};var _0x447275={};var _0x35ab1a;var _0x291608;return db[_0xd4a6('0x47')][_0xd4a6('0x7c')]({'where':{'id':_0x435773[_0xd4a6('0x57')]['id']}})[_0xd4a6('0x29')](handleEntityNotFound(_0x4c5a99,null))[_0xd4a6('0x29')](function(_0x56dbc0){if(_0x56dbc0){_0x35ab1a=_0x56dbc0;_0x447275[_0xd4a6('0x37')]=_[_0xd4a6('0x39')](db[_0xd4a6('0x7a')]['rawAttributes']);_0x447275[_0xd4a6('0x38')]=_[_0xd4a6('0x39')](_0x435773[_0xd4a6('0x38')]);_0x447275[_0xd4a6('0x3a')]=_[_0xd4a6('0x3c')](_0x447275[_0xd4a6('0x37')],_0x447275['query']);_0x2688b8[_0xd4a6('0x3b')]=_[_0xd4a6('0x3c')](_0x447275[_0xd4a6('0x37')],qs[_0xd4a6('0x3d')](_0x435773[_0xd4a6('0x38')]['fields']));_0x2688b8[_0xd4a6('0x3b')]=_0x2688b8[_0xd4a6('0x3b')][_0xd4a6('0x58')]?_0x2688b8[_0xd4a6('0x3b')]:_0x447275[_0xd4a6('0x37')];_0x2688b8[_0xd4a6('0x41')]=qs[_0xd4a6('0x42')](_0x435773[_0xd4a6('0x38')][_0xd4a6('0x42')]);_0x2688b8[_0xd4a6('0x43')]=qs[_0xd4a6('0x3a')](_[_0xd4a6('0x7d')](_0x435773['query'],_0x447275[_0xd4a6('0x3a')]));if(_0x435773[_0xd4a6('0x38')]['filter']){_0x2688b8[_0xd4a6('0x43')]=_['merge'](_0x2688b8[_0xd4a6('0x43')],{'$or':_[_0xd4a6('0x32')](_0x2688b8[_0xd4a6('0x3b')],function(_0x85067d){var _0x44ca0e={};_0x44ca0e[_0x85067d]={'$like':'%'+_0x435773['query'][_0xd4a6('0x7e')]+'%'};return _0x44ca0e;})});}_0x2688b8=_['merge']({},_0x2688b8,_0x435773[_0xd4a6('0x46')]);return _0x35ab1a['getItems'](_0x2688b8);}})[_0xd4a6('0x29')](function(_0x1b61ee){if(_0x1b61ee){_0x291608=_0x1b61ee['length'];if(!_0x435773[_0xd4a6('0x38')][_0xd4a6('0x3e')](_0xd4a6('0x3f'))){_0x2688b8['limit']=qs[_0xd4a6('0x25')](_0x435773['query'][_0xd4a6('0x25')]);_0x2688b8['offset']=qs[_0xd4a6('0x40')](_0x435773['query'][_0xd4a6('0x40')]);}return _0x35ab1a[_0xd4a6('0x7b')](_0x2688b8);}})[_0xd4a6('0x29')](function(_0x13be91){if(_0x13be91){return _0x13be91?{'count':_0x291608,'rows':_0x13be91}:null;}})['then'](respondWithResult(_0x4c5a99,null))[_0xd4a6('0x4e')](handleError(_0x4c5a99,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b2f7cbc..244ef88 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 _0x6024=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x53516f,_0x4eda4b){var _0x249b08=function(_0x5e0b4e){while(--_0x5e0b4e){_0x53516f['push'](_0x53516f['shift']());}};_0x249b08(++_0x4eda4b);}(_0x6024,0x1e7));var _0x4602=function(_0x523141,_0x1d64d3){_0x523141=_0x523141-0x0;var _0x2a1533=_0x6024[_0x523141];return _0x2a1533;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x4602('0x0'))['db'][_0x4602('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4602('0x2')](0x0);var events={'afterCreate':_0x4602('0x3'),'afterUpdate':_0x4602('0x4'),'afterDestroy':_0x4602('0x5')};function emitEvent(_0x3d82ad){return function(_0x42ef65,_0x4bc86d,_0x5e1932){DashboardEvents[_0x4602('0x6')](_0x3d82ad+':'+_0x42ef65['id'],_0x42ef65);DashboardEvents[_0x4602('0x6')](_0x3d82ad,_0x42ef65);_0x5e1932(null);};}for(var e in events){if(events[_0x4602('0x7')](e)){var event=events[e];Dashboard[_0x4602('0x8')](e,emitEvent(event));}}module[_0x4602('0x9')]=DashboardEvents; \ No newline at end of file +var _0xd399=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','save'];(function(_0x334dd5,_0x41cf95){var _0x36874c=function(_0x38acca){while(--_0x38acca){_0x334dd5['push'](_0x334dd5['shift']());}};_0x36874c(++_0x41cf95);}(_0xd399,0x9c));var _0x9d39=function(_0x476ffe,_0x5cee95){_0x476ffe=_0x476ffe-0x0;var _0x2c5120=_0xd399[_0x476ffe];return _0x2c5120;};'use strict';var EventEmitter=require(_0x9d39('0x0'));var Dashboard=require(_0x9d39('0x1'))['db'][_0x9d39('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d39('0x3'),'afterUpdate':_0x9d39('0x4'),'afterDestroy':_0x9d39('0x5')};function emitEvent(_0x2a2cef){return function(_0xc5c54b,_0x209d24,_0x291efa){DashboardEvents[_0x9d39('0x6')](_0x2a2cef+':'+_0xc5c54b['id'],_0xc5c54b);DashboardEvents[_0x9d39('0x6')](_0x2a2cef,_0xc5c54b);_0x291efa(null);};}for(var e in events){if(events[_0x9d39('0x7')](e)){var event=events[e];Dashboard[_0x9d39('0x8')](e,emitEvent(event));}}module[_0x9d39('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 345a51f..8244a4a 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 _0x5474=['../../config/logger','moment','bluebird','path','exports','dashboards','lodash','util'];(function(_0x5dfcc5,_0x96babc){var _0x201a06=function(_0x187002){while(--_0x187002){_0x5dfcc5['push'](_0x5dfcc5['shift']());}};_0x201a06(++_0x96babc);}(_0x5474,0x1c6));var _0x4547=function(_0x532fd5,_0x4bc2ea){_0x532fd5=_0x532fd5-0x0;var _0x598059=_0x5474[_0x532fd5];return _0x598059;};'use strict';var _=require(_0x4547('0x0'));var util=require(_0x4547('0x1'));var logger=require(_0x4547('0x2'))('api');var moment=require(_0x4547('0x3'));var BPromise=require(_0x4547('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4547('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x4547('0x6')]=function(_0x2f053f,_0x3b6cdc){return _0x2f053f['define']('Dashboard',attributes,{'tableName':_0x4547('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c08=['util','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x3c08,0x79));var _0x83c0=function(_0x1a87c0,_0x4bcde2){_0x1a87c0=_0x1a87c0-0x0;var _0xab90c0=_0x3c08[_0x1a87c0];return _0xab90c0;};'use strict';var _=require('lodash');var util=require(_0x83c0('0x0'));var logger=require('../../config/logger')(_0x83c0('0x1'));var moment=require(_0x83c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x83c0('0x3'));var fs=require('fs');var path=require(_0x83c0('0x4'));var rimraf=require(_0x83c0('0x5'));var config=require(_0x83c0('0x6'));var attributes=require(_0x83c0('0x7'));module[_0x83c0('0x8')]=function(_0x20c7cb,_0x474d71){return _0x20c7cb[_0x83c0('0x9')]('Dashboard',attributes,{'tableName':_0x83c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ab68891..beb394e 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 _0xf804=['code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x4db92c,_0x7e032d){var _0x42d4c3=function(_0x4b7510){while(--_0x4b7510){_0x4db92c['push'](_0x4db92c['shift']());}};_0x42d4c3(++_0x7e032d);}(_0xf804,0x1f2));var _0x4f80=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf804[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var moment=require(_0x4f80('0x2'));var BPromise=require(_0x4f80('0x3'));var rs=require(_0x4f80('0x4'));var fs=require('fs');var Redis=require(_0x4f80('0x5'));var db=require(_0x4f80('0x6'))['db'];var utils=require(_0x4f80('0x7'));var logger=require(_0x4f80('0x8'))(_0x4f80('0x9'));var config=require('../../config/environment');var jayson=require(_0x4f80('0xa'));var client=jayson[_0x4f80('0xb')]['http']({'port':0x232a});config[_0x4f80('0xc')]=_['defaults'](config[_0x4f80('0xc')],{'host':_0x4f80('0xd'),'port':0x18eb});var socket=require(_0x4f80('0xe'))(new Redis(config[_0x4f80('0xc')]));require(_0x4f80('0xf'))[_0x4f80('0x10')](socket);function respondWithRpcPromise(_0x326d8e,_0x3ba454,_0x4fe7e8){return new BPromise(function(_0x6e121a,_0x56d88e){return client[_0x4f80('0x11')](_0x326d8e,_0x4fe7e8)[_0x4f80('0x12')](function(_0x194f42){logger[_0x4f80('0x13')]('Dashboard,\x20%s,\x20%s',_0x3ba454,_0x4f80('0x14'));logger[_0x4f80('0x15')](_0x4f80('0x16'),_0x3ba454,'request\x20sent',JSON['stringify'](_0x194f42));if(_0x194f42[_0x4f80('0x17')]){if(_0x194f42[_0x4f80('0x17')][_0x4f80('0x18')]===0x1f4){logger[_0x4f80('0x17')](_0x4f80('0x19'),_0x3ba454,_0x194f42[_0x4f80('0x17')][_0x4f80('0x1a')]);return _0x56d88e(_0x194f42[_0x4f80('0x17')][_0x4f80('0x1a')]);}logger[_0x4f80('0x17')](_0x4f80('0x19'),_0x3ba454,_0x194f42[_0x4f80('0x17')][_0x4f80('0x1a')]);return _0x6e121a(_0x194f42[_0x4f80('0x17')][_0x4f80('0x1a')]);}else{logger[_0x4f80('0x13')]('Dashboard,\x20%s,\x20%s',_0x3ba454,_0x4f80('0x14'));_0x6e121a(_0x194f42[_0x4f80('0x1b')][_0x4f80('0x1a')]);}})[_0x4f80('0x1c')](function(_0x17a28f){logger['error'](_0x4f80('0x19'),_0x3ba454,_0x17a28f);_0x56d88e(_0x17a28f);});});} \ No newline at end of file +var _0x0787=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0xca416b,_0x2f83a9){var _0x5ec982=function(_0x50013c){while(--_0x50013c){_0xca416b['push'](_0xca416b['shift']());}};_0x5ec982(++_0x2f83a9);}(_0x0787,0x1e2));var _0x7078=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x0787[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var util=require(_0x7078('0x0'));var moment=require(_0x7078('0x1'));var BPromise=require(_0x7078('0x2'));var rs=require(_0x7078('0x3'));var fs=require('fs');var Redis=require(_0x7078('0x4'));var db=require(_0x7078('0x5'))['db'];var utils=require(_0x7078('0x6'));var logger=require(_0x7078('0x7'))(_0x7078('0x8'));var config=require(_0x7078('0x9'));var jayson=require(_0x7078('0xa'));var client=jayson[_0x7078('0xb')][_0x7078('0xc')]({'port':0x232a});config[_0x7078('0xd')]=_['defaults'](config[_0x7078('0xd')],{'host':_0x7078('0xe'),'port':0x18eb});var socket=require(_0x7078('0xf'))(new Redis(config[_0x7078('0xd')]));require(_0x7078('0x10'))[_0x7078('0x11')](socket);function respondWithRpcPromise(_0x23df87,_0x52bb98,_0x3847eb){return new BPromise(function(_0x34fe6e,_0x2940fc){return client['request'](_0x23df87,_0x3847eb)['then'](function(_0x5e1f01){logger[_0x7078('0x12')]('Dashboard,\x20%s,\x20%s',_0x52bb98,_0x7078('0x13'));logger[_0x7078('0x14')](_0x7078('0x15'),_0x52bb98,_0x7078('0x13'),JSON['stringify'](_0x5e1f01));if(_0x5e1f01[_0x7078('0x16')]){if(_0x5e1f01[_0x7078('0x16')][_0x7078('0x17')]===0x1f4){logger['error'](_0x7078('0x18'),_0x52bb98,_0x5e1f01[_0x7078('0x16')][_0x7078('0x19')]);return _0x2940fc(_0x5e1f01[_0x7078('0x16')][_0x7078('0x19')]);}logger[_0x7078('0x16')]('Dashboard,\x20%s,\x20%s',_0x52bb98,_0x5e1f01[_0x7078('0x16')][_0x7078('0x19')]);return _0x34fe6e(_0x5e1f01[_0x7078('0x16')]['message']);}else{logger[_0x7078('0x12')](_0x7078('0x18'),_0x52bb98,_0x7078('0x13'));_0x34fe6e(_0x5e1f01['result'][_0x7078('0x19')]);}})[_0x7078('0x1a')](function(_0x4d7a58){logger[_0x7078('0x16')](_0x7078('0x18'),_0x52bb98,_0x4d7a58);_0x2940fc(_0x4d7a58);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a424e44..cc5ac66 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 _0x3ad5=['removeListener','register','length','save','remove','emit'];(function(_0x1558b6,_0x203cfd){var _0x2028b8=function(_0x1d7024){while(--_0x1d7024){_0x1558b6['push'](_0x1558b6['shift']());}};_0x2028b8(++_0x203cfd);}(_0x3ad5,0x11d));var _0x53ad=function(_0x312512,_0x47d926){_0x312512=_0x312512-0x0;var _0x1b6f3d=_0x3ad5[_0x312512];return _0x1b6f3d;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x53ad('0x0'),_0x53ad('0x1'),'update'];function createListener(_0x20d788,_0x4abed7){return function(_0x2c3c57){_0x4abed7[_0x53ad('0x2')](_0x20d788,_0x2c3c57);};}function removeListener(_0x5956ad,_0xec3eca){return function(){DashboardEvents[_0x53ad('0x3')](_0x5956ad,_0xec3eca);};}exports[_0x53ad('0x4')]=function(_0x383f97){for(var _0x21c0f9=0x0,_0x5236e9=events[_0x53ad('0x5')];_0x21c0f9<_0x5236e9;_0x21c0f9++){var _0x32afd3=events[_0x21c0f9];var _0x5a2083=createListener('dashboard:'+_0x32afd3,_0x383f97);DashboardEvents['on'](_0x32afd3,_0x5a2083);}}; \ No newline at end of file +var _0x7ee2=['./dashboard.events','save','remove','emit','removeListener','length','dashboard:'];(function(_0x291a0b,_0x29dcd1){var _0x326ce3=function(_0x143dfd){while(--_0x143dfd){_0x291a0b['push'](_0x291a0b['shift']());}};_0x326ce3(++_0x29dcd1);}(_0x7ee2,0x103));var _0x27ee=function(_0x496f41,_0x166c02){_0x496f41=_0x496f41-0x0;var _0x3d98d5=_0x7ee2[_0x496f41];return _0x3d98d5;};'use strict';var DashboardEvents=require(_0x27ee('0x0'));var events=[_0x27ee('0x1'),_0x27ee('0x2'),'update'];function createListener(_0x356d2c,_0x4973b8){return function(_0x2b184b){_0x4973b8[_0x27ee('0x3')](_0x356d2c,_0x2b184b);};}function removeListener(_0xb43256,_0x2b4e8e){return function(){DashboardEvents[_0x27ee('0x4')](_0xb43256,_0x2b4e8e);};}exports['register']=function(_0x1e152e){for(var _0x3c482c=0x0,_0x47a6c3=events[_0x27ee('0x5')];_0x3c482c<_0x47a6c3;_0x3c482c++){var _0x843a97=events[_0x3c482c];var _0x1b709d=createListener(_0x27ee('0x6')+_0x843a97,_0x1e152e);DashboardEvents['on'](_0x843a97,_0x1b709d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 15cf687..746c3a4 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(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'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(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 3e37552..6541acd 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 _0x0f1e=['exports','STRING','long','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','sequelize','squel','lodash'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x0f1e,0xed));var _0xe0f1=function(_0x16e14d,_0xb90fad){_0x16e14d=_0x16e14d-0x0;var _0x505c41=_0x0f1e[_0x16e14d];return _0x505c41;};'use strict';var Sequelize=require(_0xe0f1('0x0'));var squel=require(_0xe0f1('0x1'));var _=require(_0xe0f1('0x2'));module[_0xe0f1('0x3')]={'title':{'type':Sequelize[_0xe0f1('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xe0f1('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xe0f1('0x5')),'get':function(){try{return JSON[_0xe0f1('0x6')](this['getDataValue']('attrs'));}catch(_0x3301f0){return[];}},'set':function(_0xbff83e){try{this[_0xe0f1('0x7')](_0xe0f1('0x8'),JSON[_0xe0f1('0x9')](_0xbff83e));}catch(_0x4f4ac9){this[_0xe0f1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xe0f1('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe0f1('0xa')]},'col':{'type':Sequelize[_0xe0f1('0xa')]},'background':{'type':Sequelize[_0xe0f1('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe0f1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe0f1('0x4')]}}; \ No newline at end of file +var _0x9d13=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','STRING','TEXT','long','parse','attrs','stringify'];(function(_0x140c6d,_0x54af36){var _0x40323b=function(_0xa05839){while(--_0xa05839){_0x140c6d['push'](_0x140c6d['shift']());}};_0x40323b(++_0x54af36);}(_0x9d13,0x17d));var _0x39d1=function(_0x2a0556,_0x324ea3){_0x2a0556=_0x2a0556-0x0;var _0x74ee67=_0x9d13[_0x2a0556];return _0x74ee67;};'use strict';var Sequelize=require(_0x39d1('0x0'));var squel=require(_0x39d1('0x1'));var _=require(_0x39d1('0x2'));module['exports']={'title':{'type':Sequelize[_0x39d1('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x39d1('0x4')](_0x39d1('0x5')),'get':function(){try{return JSON[_0x39d1('0x6')](this['getDataValue'](_0x39d1('0x7')));}catch(_0x28bfa2){return[];}},'set':function(_0x28f943){try{this['setDataValue'](_0x39d1('0x7'),JSON[_0x39d1('0x8')](_0x28f943));}catch(_0x100a40){this[_0x39d1('0x9')]('attrs',JSON[_0x39d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x39d1('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x39d1('0xa')]},'background':{'type':Sequelize[_0x39d1('0x3')],'allowNull':![],'defaultValue':_0x39d1('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x39d1('0x3')],'allowNull':![],'defaultValue':_0x39d1('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a0bf589..6745a32 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 _0xdd22=['create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','end','sendStatus','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','catch','destroy','find','params','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0x349080,_0x485b71){var _0x1ef849=function(_0x591d4d){while(--_0x591d4d){_0x349080['push'](_0x349080['shift']());}};_0x1ef849(++_0x485b71);}(_0xdd22,0xb4));var _0x2dd2=function(_0xbf1cd8,_0x17c080){_0xbf1cd8=_0xbf1cd8-0x0;var _0x29267f=_0xdd22[_0xbf1cd8];return _0x29267f;};'use strict';var pdf=require(_0x2dd2('0x0'));var emlformat=require(_0x2dd2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2dd2('0x2'));var jsonpatch=require(_0x2dd2('0x3'));var rp=require(_0x2dd2('0x4'));var moment=require(_0x2dd2('0x5'));var BPromise=require(_0x2dd2('0x6'));var Mustache=require(_0x2dd2('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2dd2('0x8'));var csv=require(_0x2dd2('0x9'));var ejs=require(_0x2dd2('0xa'));var fs=require('fs');var _=require(_0x2dd2('0xb'));var squel=require('squel');var crypto=require(_0x2dd2('0xc'));var jsforce=require(_0x2dd2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2dd2('0x9'));var querystring=require('querystring');var Papa=require(_0x2dd2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2dd2('0xf'));var hardwareService=require(_0x2dd2('0x10'));var logger=require(_0x2dd2('0x11'))(_0x2dd2('0x12'));var utils=require(_0x2dd2('0x13'));var config=require(_0x2dd2('0x14'));var db=require(_0x2dd2('0x15'))['db'];config[_0x2dd2('0x16')]=_[_0x2dd2('0x17')](config[_0x2dd2('0x16')],{'host':_0x2dd2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2dd2('0x16')]));require('./dashboardItem.socket')[_0x2dd2('0x19')](socket);function respondWithStatusCode(_0x2a6704,_0x4a980a){_0x4a980a=_0x4a980a||0xcc;return function(_0xd469fb){if(_0xd469fb){return _0x2a6704['sendStatus'](_0x4a980a);}return _0x2a6704[_0x2dd2('0x1a')](_0x4a980a)['end']();};}function respondWithResult(_0x20e5b9,_0x26445b){_0x26445b=_0x26445b||0xc8;return function(_0x2e7bef){if(_0x2e7bef){return _0x20e5b9['status'](_0x26445b)['json'](_0x2e7bef);}};}function respondWithFilteredResult(_0x2c8623,_0x216762){return function(_0x3dfaab){if(_0x3dfaab){var _0x39ccdd=_0x3dfaab[_0x2dd2('0x1b')],_0x5b17d2=_0x216762['offset'],_0x118de0=_0x216762[_0x2dd2('0x1c')]+_0x216762[_0x2dd2('0x1d')],_0xf9a95b;if(_0x118de0>=_0x39ccdd){_0x118de0=_0x39ccdd;_0xf9a95b=0xc8;}else{_0xf9a95b=0xce;}_0x2c8623[_0x2dd2('0x1a')](_0xf9a95b);return _0x2c8623[_0x2dd2('0x1e')](_0x2dd2('0x1f'),_0x5b17d2+'-'+_0x118de0+'/'+_0x39ccdd)[_0x2dd2('0x20')](_0x3dfaab);}return null;};}function patchUpdates(_0x6e10da){return function(_0x27d3bd){try{jsonpatch[_0x2dd2('0x21')](_0x27d3bd,_0x6e10da,!![]);}catch(_0x2cb993){return BPromise['reject'](_0x2cb993);}return _0x27d3bd[_0x2dd2('0x22')]();};}function saveUpdates(_0x2cb348,_0x2d7d9e){return function(_0x2c03f2){if(_0x2c03f2){return _0x2c03f2[_0x2dd2('0x23')](_0x2cb348)['then'](function(_0x5544e5){return _0x5544e5;});}return null;};}function removeEntity(_0xabf80f,_0x5099ef){return function(_0x1b82e8){if(_0x1b82e8){return _0x1b82e8['destroy']()[_0x2dd2('0x24')](function(){_0xabf80f[_0x2dd2('0x1a')](0xcc)[_0x2dd2('0x25')]();});}};}function handleEntityNotFound(_0x21dc0c,_0x415074){return function(_0x680659){if(!_0x680659){_0x21dc0c[_0x2dd2('0x26')](0x194);}return _0x680659;};}function handleError(_0x193782,_0xbcc990){_0xbcc990=_0xbcc990||0x1f4;return function(_0x4d729f){logger[_0x2dd2('0x27')](_0x4d729f[_0x2dd2('0x28')]);if(_0x4d729f[_0x2dd2('0x29')]){delete _0x4d729f[_0x2dd2('0x29')];}_0x193782[_0x2dd2('0x1a')](_0xbcc990)[_0x2dd2('0x2a')](_0x4d729f);};}exports[_0x2dd2('0x2b')]=function(_0x3753ad,_0xd30479){var _0x27ecc1={'raw':![],'where':{'id':_0x3753ad['params']['id']}},_0x5a25a4={};_0x5a25a4['model']=_[_0x2dd2('0x2c')](db[_0x2dd2('0x2d')][_0x2dd2('0x2e')]);_0x5a25a4[_0x2dd2('0x2f')]=_[_0x2dd2('0x2c')](_0x3753ad[_0x2dd2('0x2f')]);_0x5a25a4[_0x2dd2('0x30')]=_[_0x2dd2('0x31')](_0x5a25a4[_0x2dd2('0x32')],_0x5a25a4[_0x2dd2('0x2f')]);_0x27ecc1[_0x2dd2('0x33')]=_[_0x2dd2('0x31')](_0x5a25a4[_0x2dd2('0x32')],qs[_0x2dd2('0x34')](_0x3753ad[_0x2dd2('0x2f')][_0x2dd2('0x34')]));_0x27ecc1['attributes']=_0x27ecc1[_0x2dd2('0x33')][_0x2dd2('0x35')]?_0x27ecc1[_0x2dd2('0x33')]:_0x5a25a4[_0x2dd2('0x32')];if(_0x3753ad[_0x2dd2('0x2f')][_0x2dd2('0x36')]){_0x27ecc1[_0x2dd2('0x37')]=[{'all':!![]}];}_0x27ecc1=_['merge']({},_0x27ecc1,_0x3753ad['options']);return db['DashboardItem']['find'](_0x27ecc1)[_0x2dd2('0x24')](handleEntityNotFound(_0xd30479,null))[_0x2dd2('0x24')](respondWithResult(_0xd30479,null))[_0x2dd2('0x38')](handleError(_0xd30479,null));};exports[_0x2dd2('0x39')]=function(_0x3b3f1f,_0x162f6e){return db[_0x2dd2('0x2d')][_0x2dd2('0x3a')]({'where':{'id':_0x3b3f1f[_0x2dd2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x162f6e,null))[_0x2dd2('0x24')](removeEntity(_0x162f6e,null))['catch'](handleError(_0x162f6e,null));};function widgetAttributes(_0x1c8b57){try{switch(_0x1c8b57[_0x2dd2('0x3c')]){case _0x2dd2('0x3d'):return[{'name':_0x2dd2('0x3e'),'value':_0x1c8b57[_0x2dd2('0x3e')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57['attrs'][0x0]?_0x1c8b57[_0x2dd2('0x3f')][0x0][_0x2dd2('0x40')]:undefined)||'https://'}];case _0x2dd2('0x41'):return[{'name':_0x2dd2('0x42'),'value':_0x1c8b57[_0x2dd2('0x42')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x0]?_0x1c8b57['attrs'][0x0][_0x2dd2('0x40')]:undefined)||''}];case _0x2dd2('0x43'):return[{'name':_0x2dd2('0x44'),'value':_0x1c8b57[_0x2dd2('0x44')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57['attrs'][0x0]?_0x1c8b57['attrs'][0x0][_0x2dd2('0x40')]:undefined)||_0x2dd2('0x45')},{'name':_0x2dd2('0x46'),'value':_0x1c8b57[_0x2dd2('0x46')]||(_0x1c8b57['attrs']&&_0x1c8b57[_0x2dd2('0x3f')][0x1]?_0x1c8b57[_0x2dd2('0x3f')][0x1][_0x2dd2('0x40')]:undefined)||'0.00'},{'name':_0x2dd2('0x47'),'value':_0x1c8b57[_0x2dd2('0x47')]||(_0x1c8b57['attrs']&&_0x1c8b57[_0x2dd2('0x3f')][0x2]?_0x1c8b57['attrs'][0x2][_0x2dd2('0x40')]:undefined)||0xc}];case _0x2dd2('0x48'):return[{'name':_0x2dd2('0x49'),'value':_0x1c8b57['attrMetric']||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x0]?_0x1c8b57['attrs'][0x0][_0x2dd2('0x40')]:undefined)||_0x2dd2('0x4a')},{'name':_0x2dd2('0x4b'),'value':_0x1c8b57[_0x2dd2('0x4b')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x1]?_0x1c8b57[_0x2dd2('0x3f')][0x1]['value']:undefined)||[]},{'name':_0x2dd2('0x47'),'value':_0x1c8b57[_0x2dd2('0x47')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x2]?_0x1c8b57[_0x2dd2('0x3f')][0x2][_0x2dd2('0x40')]:undefined)||0x14}];case _0x2dd2('0x4c'):case _0x2dd2('0x4d'):return[{'name':_0x2dd2('0x4e'),'value':_0x1c8b57['attrSerie1']||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x0]?_0x1c8b57[_0x2dd2('0x3f')][0x0][_0x2dd2('0x40')]:undefined)||'total'},{'name':_0x2dd2('0x4f'),'value':_0x1c8b57[_0x2dd2('0x4f')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x1]?_0x1c8b57[_0x2dd2('0x3f')][0x1][_0x2dd2('0x40')]:undefined)||null},{'name':_0x2dd2('0x50'),'value':_0x1c8b57[_0x2dd2('0x50')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57['attrs'][0x2]?_0x1c8b57['attrs'][0x2][_0x2dd2('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1c8b57[_0x2dd2('0x4b')]||(_0x1c8b57['attrs']&&_0x1c8b57['attrs'][0x3]?_0x1c8b57[_0x2dd2('0x3f')][0x3][_0x2dd2('0x40')]:undefined)||[]}];case _0x2dd2('0x51'):return[{'name':_0x2dd2('0x52'),'type':_0x1c8b57[_0x2dd2('0x53')]||(_0x1c8b57[_0x2dd2('0x3f')]&&_0x1c8b57[_0x2dd2('0x3f')][0x0]?_0x1c8b57['attrs'][0x0][_0x2dd2('0x3c')]:undefined)||null,'value':_0x1c8b57[_0x2dd2('0x52')]||(_0x1c8b57['attrs']&&_0x1c8b57[_0x2dd2('0x3f')][0x0]?_0x1c8b57[_0x2dd2('0x3f')][0x0][_0x2dd2('0x40')]:undefined)||null},{'name':_0x2dd2('0x54'),'value':_0x1c8b57[_0x2dd2('0x54')]||(_0x1c8b57['attrs']&&_0x1c8b57[_0x2dd2('0x3f')][0x1]?_0x1c8b57[_0x2dd2('0x3f')][0x1][_0x2dd2('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x25d6b7){logger['error'](_0x2dd2('0x55'),JSON[_0x2dd2('0x56')](_0x25d6b7));return[];}}exports[_0x2dd2('0x57')]=function(_0x36ca50,_0x14c0f3){if(_0x36ca50[_0x2dd2('0x58')]){_0x36ca50[_0x2dd2('0x58')]['attrs']=widgetAttributes(_0x36ca50[_0x2dd2('0x58')]);}return db[_0x2dd2('0x2d')][_0x2dd2('0x57')](_0x36ca50[_0x2dd2('0x58')],{})[_0x2dd2('0x24')](respondWithResult(_0x14c0f3,0xc9))['catch'](handleError(_0x14c0f3,null));};exports[_0x2dd2('0x23')]=function(_0x5b35c2,_0xb4c630){if(_0x5b35c2[_0x2dd2('0x58')]['id']){delete _0x5b35c2[_0x2dd2('0x58')]['id'];}_0x5b35c2[_0x2dd2('0x58')]['attrs']=widgetAttributes(_0x5b35c2['body']);return db[_0x2dd2('0x2d')][_0x2dd2('0x3a')]({'where':{'id':_0x5b35c2[_0x2dd2('0x3b')]['id']}})[_0x2dd2('0x24')](handleEntityNotFound(_0xb4c630,null))[_0x2dd2('0x24')](saveUpdates(_0x5b35c2[_0x2dd2('0x58')],null))[_0x2dd2('0x24')](respondWithResult(_0xb4c630,null))[_0x2dd2('0x38')](handleError(_0xb4c630,null));}; \ No newline at end of file +var _0x8298=['find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem'];(function(_0x1b3a7e,_0x3938d6){var _0x528a5a=function(_0x2e9c36){while(--_0x2e9c36){_0x1b3a7e['push'](_0x1b3a7e['shift']());}};_0x528a5a(++_0x3938d6);}(_0x8298,0x76));var _0x8829=function(_0x50a935,_0x5c73e7){_0x50a935=_0x50a935-0x0;var _0x323025=_0x8298[_0x50a935];return _0x323025;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8829('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8829('0x1'));var jsonpatch=require(_0x8829('0x2'));var rp=require(_0x8829('0x3'));var moment=require('moment');var BPromise=require(_0x8829('0x4'));var Mustache=require(_0x8829('0x5'));var util=require(_0x8829('0x6'));var path=require(_0x8829('0x7'));var sox=require(_0x8829('0x8'));var csv=require(_0x8829('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8829('0xa'));var crypto=require(_0x8829('0xb'));var jsforce=require(_0x8829('0xc'));var deskjs=require(_0x8829('0xd'));var toCsv=require(_0x8829('0x9'));var querystring=require(_0x8829('0xe'));var Papa=require(_0x8829('0xf'));var Redis=require(_0x8829('0x10'));var authService=require(_0x8829('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8829('0x12'));var hardwareService=require(_0x8829('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8829('0x14'));var config=require('../../config/environment');var db=require(_0x8829('0x15'))['db'];config[_0x8829('0x16')]=_[_0x8829('0x17')](config['redis'],{'host':_0x8829('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8829('0x19'))[_0x8829('0x1a')](socket);function respondWithStatusCode(_0x20c8a4,_0x1176d3){_0x1176d3=_0x1176d3||0xcc;return function(_0x1087bd){if(_0x1087bd){return _0x20c8a4[_0x8829('0x1b')](_0x1176d3);}return _0x20c8a4[_0x8829('0x1c')](_0x1176d3)[_0x8829('0x1d')]();};}function respondWithResult(_0x2816f8,_0x46d7a0){_0x46d7a0=_0x46d7a0||0xc8;return function(_0x3e768a){if(_0x3e768a){return _0x2816f8[_0x8829('0x1c')](_0x46d7a0)[_0x8829('0x1e')](_0x3e768a);}};}function respondWithFilteredResult(_0x3c976e,_0x28e685){return function(_0x335ca4){if(_0x335ca4){var _0x49efe5=_0x335ca4[_0x8829('0x1f')],_0x250955=_0x28e685[_0x8829('0x20')],_0x3286bf=_0x28e685[_0x8829('0x20')]+_0x28e685[_0x8829('0x21')],_0x114a5a;if(_0x3286bf>=_0x49efe5){_0x3286bf=_0x49efe5;_0x114a5a=0xc8;}else{_0x114a5a=0xce;}_0x3c976e[_0x8829('0x1c')](_0x114a5a);return _0x3c976e['set']('Content-Range',_0x250955+'-'+_0x3286bf+'/'+_0x49efe5)[_0x8829('0x1e')](_0x335ca4);}return null;};}function patchUpdates(_0x315dc6){return function(_0x225836){try{jsonpatch['apply'](_0x225836,_0x315dc6,!![]);}catch(_0x4c710e){return BPromise[_0x8829('0x22')](_0x4c710e);}return _0x225836[_0x8829('0x23')]();};}function saveUpdates(_0x43407d,_0x7cdf60){return function(_0x53d4f1){if(_0x53d4f1){return _0x53d4f1[_0x8829('0x24')](_0x43407d)[_0x8829('0x25')](function(_0x1ff77c){return _0x1ff77c;});}return null;};}function removeEntity(_0x1e5ede,_0x22c1ad){return function(_0x436538){if(_0x436538){return _0x436538['destroy']()[_0x8829('0x25')](function(){_0x1e5ede['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x419ddc,_0x49660c){return function(_0xb56e8d){if(!_0xb56e8d){_0x419ddc[_0x8829('0x1b')](0x194);}return _0xb56e8d;};}function handleError(_0x146e87,_0xc8179f){_0xc8179f=_0xc8179f||0x1f4;return function(_0x19df22){logger['error'](_0x19df22['stack']);if(_0x19df22[_0x8829('0x26')]){delete _0x19df22[_0x8829('0x26')];}_0x146e87['status'](_0xc8179f)[_0x8829('0x27')](_0x19df22);};}exports[_0x8829('0x28')]=function(_0x5b4ac4,_0x5cb381){var _0x5025d2={'raw':![],'where':{'id':_0x5b4ac4[_0x8829('0x29')]['id']}},_0x2e9575={};_0x2e9575[_0x8829('0x2a')]=_[_0x8829('0x2b')](db['DashboardItem'][_0x8829('0x2c')]);_0x2e9575['query']=_['keys'](_0x5b4ac4[_0x8829('0x2d')]);_0x2e9575[_0x8829('0x2e')]=_[_0x8829('0x2f')](_0x2e9575[_0x8829('0x2a')],_0x2e9575[_0x8829('0x2d')]);_0x5025d2[_0x8829('0x30')]=_[_0x8829('0x2f')](_0x2e9575[_0x8829('0x2a')],qs[_0x8829('0x31')](_0x5b4ac4[_0x8829('0x2d')][_0x8829('0x31')]));_0x5025d2['attributes']=_0x5025d2[_0x8829('0x30')][_0x8829('0x32')]?_0x5025d2[_0x8829('0x30')]:_0x2e9575[_0x8829('0x2a')];if(_0x5b4ac4[_0x8829('0x2d')][_0x8829('0x33')]){_0x5025d2[_0x8829('0x34')]=[{'all':!![]}];}_0x5025d2=_[_0x8829('0x35')]({},_0x5025d2,_0x5b4ac4[_0x8829('0x36')]);return db[_0x8829('0x37')][_0x8829('0x38')](_0x5025d2)[_0x8829('0x25')](handleEntityNotFound(_0x5cb381,null))[_0x8829('0x25')](respondWithResult(_0x5cb381,null))['catch'](handleError(_0x5cb381,null));};exports[_0x8829('0x39')]=function(_0x211814,_0x307575){return db[_0x8829('0x37')][_0x8829('0x38')]({'where':{'id':_0x211814[_0x8829('0x29')]['id']}})[_0x8829('0x25')](handleEntityNotFound(_0x307575,null))[_0x8829('0x25')](removeEntity(_0x307575,null))[_0x8829('0x3a')](handleError(_0x307575,null));};function widgetAttributes(_0x3bf99f){try{switch(_0x3bf99f[_0x8829('0x3b')]){case _0x8829('0x3c'):return[{'name':_0x8829('0x3d'),'value':_0x3bf99f[_0x8829('0x3d')]||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f[_0x8829('0x3e')][0x0]?_0x3bf99f['attrs'][0x0][_0x8829('0x3f')]:undefined)||_0x8829('0x40')}];case'custom':return[{'name':_0x8829('0x41'),'value':_0x3bf99f[_0x8829('0x41')]||(_0x3bf99f['attrs']&&_0x3bf99f[_0x8829('0x3e')][0x0]?_0x3bf99f['attrs'][0x0][_0x8829('0x3f')]:undefined)||''}];case _0x8829('0x42'):return[{'name':_0x8829('0x43'),'value':_0x3bf99f[_0x8829('0x43')]||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x0]?_0x3bf99f[_0x8829('0x3e')][0x0][_0x8829('0x3f')]:undefined)||_0x8829('0x44')},{'name':_0x8829('0x45'),'value':_0x3bf99f['attrTimezone']||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x1]?_0x3bf99f['attrs'][0x1][_0x8829('0x3f')]:undefined)||_0x8829('0x46')},{'name':_0x8829('0x47'),'value':_0x3bf99f[_0x8829('0x47')]||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x2]?_0x3bf99f[_0x8829('0x3e')][0x2]['value']:undefined)||0xc}];case _0x8829('0x48'):return[{'name':'attrMetric','value':_0x3bf99f[_0x8829('0x49')]||(_0x3bf99f['attrs']&&_0x3bf99f[_0x8829('0x3e')][0x0]?_0x3bf99f['attrs'][0x0][_0x8829('0x3f')]:undefined)||_0x8829('0x4a')},{'name':_0x8829('0x4b'),'value':_0x3bf99f['attrVoiceQueues']||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f[_0x8829('0x3e')][0x1]?_0x3bf99f[_0x8829('0x3e')][0x1][_0x8829('0x3f')]:undefined)||[]},{'name':_0x8829('0x47'),'value':_0x3bf99f[_0x8829('0x47')]||(_0x3bf99f['attrs']&&_0x3bf99f[_0x8829('0x3e')][0x2]?_0x3bf99f[_0x8829('0x3e')][0x2][_0x8829('0x3f')]:undefined)||0x14}];case _0x8829('0x4c'):case _0x8829('0x4d'):return[{'name':_0x8829('0x4e'),'value':_0x3bf99f[_0x8829('0x4e')]||(_0x3bf99f['attrs']&&_0x3bf99f[_0x8829('0x3e')][0x0]?_0x3bf99f[_0x8829('0x3e')][0x0][_0x8829('0x3f')]:undefined)||_0x8829('0x4a')},{'name':_0x8829('0x4f'),'value':_0x3bf99f['attrSerie2']||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f[_0x8829('0x3e')][0x1]?_0x3bf99f[_0x8829('0x3e')][0x1][_0x8829('0x3f')]:undefined)||null},{'name':_0x8829('0x50'),'value':_0x3bf99f['attrSerie3']||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x2]?_0x3bf99f[_0x8829('0x3e')][0x2][_0x8829('0x3f')]:undefined)||null},{'name':_0x8829('0x4b'),'value':_0x3bf99f[_0x8829('0x4b')]||(_0x3bf99f['attrs']&&_0x3bf99f['attrs'][0x3]?_0x3bf99f[_0x8829('0x3e')][0x3][_0x8829('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x8829('0x51'),'type':_0x3bf99f[_0x8829('0x52')]||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x0]?_0x3bf99f['attrs'][0x0][_0x8829('0x3b')]:undefined)||null,'value':_0x3bf99f['attrReport']||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f['attrs'][0x0]?_0x3bf99f[_0x8829('0x3e')][0x0][_0x8829('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x3bf99f[_0x8829('0x53')]||(_0x3bf99f[_0x8829('0x3e')]&&_0x3bf99f[_0x8829('0x3e')][0x1]?_0x3bf99f[_0x8829('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4a0d1a){logger['error']('widgetAttributes:\x20%s',JSON[_0x8829('0x54')](_0x4a0d1a));return[];}}exports[_0x8829('0x55')]=function(_0x47fb18,_0x151e2c){if(_0x47fb18[_0x8829('0x56')]){_0x47fb18[_0x8829('0x56')][_0x8829('0x3e')]=widgetAttributes(_0x47fb18['body']);}return db['DashboardItem'][_0x8829('0x55')](_0x47fb18[_0x8829('0x56')],{})[_0x8829('0x25')](respondWithResult(_0x151e2c,0xc9))['catch'](handleError(_0x151e2c,null));};exports['update']=function(_0x4228a2,_0x25fecd){if(_0x4228a2['body']['id']){delete _0x4228a2[_0x8829('0x56')]['id'];}_0x4228a2[_0x8829('0x56')][_0x8829('0x3e')]=widgetAttributes(_0x4228a2[_0x8829('0x56')]);return db[_0x8829('0x37')]['find']({'where':{'id':_0x4228a2[_0x8829('0x29')]['id']}})[_0x8829('0x25')](handleEntityNotFound(_0x25fecd,null))[_0x8829('0x25')](saveUpdates(_0x4228a2[_0x8829('0x56')],null))[_0x8829('0x25')](respondWithResult(_0x25fecd,null))[_0x8829('0x3a')](handleError(_0x25fecd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index cdaee5c..c886ea0 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 _0x5a17=['save','update','remove','emit','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a17,0x140));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x75a1('0x0'));var DashboardItem=require(_0x75a1('0x1'))['db'][_0x75a1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x75a1('0x3')](0x0);var events={'afterCreate':_0x75a1('0x4'),'afterUpdate':_0x75a1('0x5'),'afterDestroy':_0x75a1('0x6')};function emitEvent(_0xc1c4af){return function(_0x255af7,_0x908f46,_0x1b86db){DashboardItemEvents['emit'](_0xc1c4af+':'+_0x255af7['id'],_0x255af7);DashboardItemEvents[_0x75a1('0x7')](_0xc1c4af,_0x255af7);_0x1b86db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x75a1('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x1b8a=['hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x1b8a,0xc8));var _0xa1b8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b8a[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xa1b8('0x0'));var DashboardItem=require(_0xa1b8('0x1'))['db'][_0xa1b8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa1b8('0x3')](0x0);var events={'afterCreate':_0xa1b8('0x4'),'afterUpdate':'update','afterDestroy':_0xa1b8('0x5')};function emitEvent(_0x4fb779){return function(_0x572a88,_0x3c1d36,_0x5f2e57){DashboardItemEvents['emit'](_0x4fb779+':'+_0x572a88['id'],_0x572a88);DashboardItemEvents[_0xa1b8('0x6')](_0x4fb779,_0x572a88);_0x5f2e57(null);};}for(var e in events){if(events[_0xa1b8('0x7')](e)){var event=events[e];DashboardItem[_0xa1b8('0x8')](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 9e4bbbd..f8b9130 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 _0x48a4=['DashboardItem','dashboard_items','lodash','util','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x9c058b,_0x55e984){var _0x45cd27=function(_0x1be340){while(--_0x1be340){_0x9c058b['push'](_0x9c058b['shift']());}};_0x45cd27(++_0x55e984);}(_0x48a4,0x157));var _0x448a=function(_0x30483f,_0x40b870){_0x30483f=_0x30483f-0x0;var _0x3849d2=_0x48a4[_0x30483f];return _0x3849d2;};'use strict';var _=require(_0x448a('0x0'));var util=require(_0x448a('0x1'));var logger=require('../../config/logger')(_0x448a('0x2'));var moment=require(_0x448a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x448a('0x4'));var rimraf=require(_0x448a('0x5'));var config=require(_0x448a('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x448a('0x7')]=function(_0x2b2bc7,_0x5cfa3){return _0x2b2bc7[_0x448a('0x8')](_0x448a('0x9'),attributes,{'tableName':_0x448a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x288c=['../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','api','moment','path','rimraf'];(function(_0x146887,_0x42583a){var _0x141bf6=function(_0x16899d){while(--_0x16899d){_0x146887['push'](_0x146887['shift']());}};_0x141bf6(++_0x42583a);}(_0x288c,0x131));var _0xc288=function(_0x57de35,_0x2ef99a){_0x57de35=_0x57de35-0x0;var _0x2a94eb=_0x288c[_0x57de35];return _0x2a94eb;};'use strict';var _=require(_0xc288('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc288('0x1'));var moment=require(_0xc288('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc288('0x3'));var rimraf=require(_0xc288('0x4'));var config=require(_0xc288('0x5'));var attributes=require(_0xc288('0x6'));module[_0xc288('0x7')]=function(_0x131021,_0x503043){return _0x131021[_0xc288('0x8')]('DashboardItem',attributes,{'tableName':_0xc288('0x9'),'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 6a0f607..556d046 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 _0x67bd=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x67bd,0x17b));var _0xd67b=function(_0x3ee740,_0x299a89){_0x3ee740=_0x3ee740-0x0;var _0x11ecda=_0x67bd[_0x3ee740];return _0x11ecda;};'use strict';var _=require(_0xd67b('0x0'));var util=require(_0xd67b('0x1'));var moment=require(_0xd67b('0x2'));var BPromise=require(_0xd67b('0x3'));var rs=require(_0xd67b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd67b('0x5'))['db'];var utils=require(_0xd67b('0x6'));var logger=require(_0xd67b('0x7'))(_0xd67b('0x8'));var config=require(_0xd67b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd67b('0xa')][_0xd67b('0xb')]({'port':0x232a});config[_0xd67b('0xc')]=_[_0xd67b('0xd')](config[_0xd67b('0xc')],{'host':_0xd67b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd67b('0xc')]));require(_0xd67b('0xf'))[_0xd67b('0x10')](socket);function respondWithRpcPromise(_0x3a6749,_0x30b299,_0x5d63ae){return new BPromise(function(_0x3c9b68,_0x4c9d77){return client[_0xd67b('0x11')](_0x3a6749,_0x5d63ae)[_0xd67b('0x12')](function(_0x108d48){logger[_0xd67b('0x13')](_0xd67b('0x14'),_0x30b299,_0xd67b('0x15'));logger[_0xd67b('0x16')](_0xd67b('0x17'),_0x30b299,_0xd67b('0x15'),JSON[_0xd67b('0x18')](_0x108d48));if(_0x108d48['error']){if(_0x108d48[_0xd67b('0x19')][_0xd67b('0x1a')]===0x1f4){logger['error'](_0xd67b('0x14'),_0x30b299,_0x108d48[_0xd67b('0x19')][_0xd67b('0x1b')]);return _0x4c9d77(_0x108d48['error'][_0xd67b('0x1b')]);}logger[_0xd67b('0x19')](_0xd67b('0x14'),_0x30b299,_0x108d48['error'][_0xd67b('0x1b')]);return _0x3c9b68(_0x108d48[_0xd67b('0x19')][_0xd67b('0x1b')]);}else{logger[_0xd67b('0x13')](_0xd67b('0x14'),_0x30b299,_0xd67b('0x15'));_0x3c9b68(_0x108d48[_0xd67b('0x1c')]['message']);}})['catch'](function(_0x32f180){logger[_0xd67b('0x19')]('DashboardItem,\x20%s,\x20%s',_0x30b299,_0x32f180);_0x4c9d77(_0x32f180);});});} \ No newline at end of file +var _0xb683=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xb683,0x183));var _0x3b68=function(_0xac3aa1,_0x2c961f){_0xac3aa1=_0xac3aa1-0x0;var _0x9f98bc=_0xb683[_0xac3aa1];return _0x9f98bc;};'use strict';var _=require(_0x3b68('0x0'));var util=require(_0x3b68('0x1'));var moment=require(_0x3b68('0x2'));var BPromise=require(_0x3b68('0x3'));var rs=require(_0x3b68('0x4'));var fs=require('fs');var Redis=require(_0x3b68('0x5'));var db=require(_0x3b68('0x6'))['db'];var utils=require(_0x3b68('0x7'));var logger=require('../../config/logger')(_0x3b68('0x8'));var config=require(_0x3b68('0x9'));var jayson=require(_0x3b68('0xa'));var client=jayson['client'][_0x3b68('0xb')]({'port':0x232a});config[_0x3b68('0xc')]=_[_0x3b68('0xd')](config['redis'],{'host':_0x3b68('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b68('0xc')]));require(_0x3b68('0xf'))[_0x3b68('0x10')](socket);function respondWithRpcPromise(_0x556296,_0x4e3757,_0x357987){return new BPromise(function(_0x1c117f,_0x54ba1f){return client[_0x3b68('0x11')](_0x556296,_0x357987)[_0x3b68('0x12')](function(_0x35faa0){logger[_0x3b68('0x13')](_0x3b68('0x14'),_0x4e3757,_0x3b68('0x15'));logger[_0x3b68('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4e3757,'request\x20sent',JSON[_0x3b68('0x17')](_0x35faa0));if(_0x35faa0[_0x3b68('0x18')]){if(_0x35faa0[_0x3b68('0x18')][_0x3b68('0x19')]===0x1f4){logger[_0x3b68('0x18')](_0x3b68('0x14'),_0x4e3757,_0x35faa0[_0x3b68('0x18')][_0x3b68('0x1a')]);return _0x54ba1f(_0x35faa0[_0x3b68('0x18')][_0x3b68('0x1a')]);}logger[_0x3b68('0x18')](_0x3b68('0x14'),_0x4e3757,_0x35faa0['error'][_0x3b68('0x1a')]);return _0x1c117f(_0x35faa0['error'][_0x3b68('0x1a')]);}else{logger[_0x3b68('0x13')](_0x3b68('0x14'),_0x4e3757,_0x3b68('0x15'));_0x1c117f(_0x35faa0[_0x3b68('0x1b')][_0x3b68('0x1a')]);}})[_0x3b68('0x1c')](function(_0xdc8ecb){logger[_0x3b68('0x18')]('DashboardItem,\x20%s,\x20%s',_0x4e3757,_0xdc8ecb);_0x54ba1f(_0xdc8ecb);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b922ed4..805c622 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 _0xb144=['update','emit','removeListener','length','./dashboardItem.events','save','remove'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0xb144,0xf9));var _0x4b14=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb144[_0x122ef9];return _0x42fba0;};'use strict';var DashboardItemEvents=require(_0x4b14('0x0'));var events=[_0x4b14('0x1'),_0x4b14('0x2'),_0x4b14('0x3')];function createListener(_0x63e389,_0x134775){return function(_0x35ade4){_0x134775[_0x4b14('0x4')](_0x63e389,_0x35ade4);};}function removeListener(_0x2b9898,_0x11d7d1){return function(){DashboardItemEvents[_0x4b14('0x5')](_0x2b9898,_0x11d7d1);};}exports['register']=function(_0x15e0b3){for(var _0x351548=0x0,_0x276c14=events[_0x4b14('0x6')];_0x351548<_0x276c14;_0x351548++){var _0x1eab1d=events[_0x351548];var _0xf8cc1a=createListener('dashboardItem:'+_0x1eab1d,_0x15e0b3);DashboardItemEvents['on'](_0x1eab1d,_0xf8cc1a);}}; \ No newline at end of file +var _0xeed5=['remove','removeListener','register','dashboardItem:','./dashboardItem.events','save'];(function(_0x22d891,_0x329b4b){var _0x522ce8=function(_0x5f31f1){while(--_0x5f31f1){_0x22d891['push'](_0x22d891['shift']());}};_0x522ce8(++_0x329b4b);}(_0xeed5,0xe2));var _0x5eed=function(_0x2e7987,_0x30ff3f){_0x2e7987=_0x2e7987-0x0;var _0x5ca20c=_0xeed5[_0x2e7987];return _0x5ca20c;};'use strict';var DashboardItemEvents=require(_0x5eed('0x0'));var events=[_0x5eed('0x1'),_0x5eed('0x2'),'update'];function createListener(_0x4e1205,_0x549236){return function(_0x5b7f20){_0x549236['emit'](_0x4e1205,_0x5b7f20);};}function removeListener(_0x168165,_0x66a7a4){return function(){DashboardItemEvents[_0x5eed('0x3')](_0x168165,_0x66a7a4);};}exports[_0x5eed('0x4')]=function(_0x296d25){for(var _0x3ff6b7=0x0,_0x58b47f=events['length'];_0x3ff6b7<_0x58b47f;_0x3ff6b7++){var _0x140468=events[_0x3ff6b7];var _0x1f2b8b=createListener(_0x5eed('0x5')+_0x140468,_0x296d25);DashboardItemEvents['on'](_0x140468,_0x1f2b8b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1e89dfa..a96f6ca 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 _0x46ed=['/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./dashboardItem.controller');router[_0xd46e('0x7')](_0xd46e('0x8'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0xb')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0xd')](_0xd46e('0x8'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xe')]);router['delete'](_0xd46e('0x8'),auth[_0xd46e('0x9')](),controller['destroy']);module[_0xd46e('0xf')]=router; \ No newline at end of file +var _0x31f0=['create','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','post'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0x31f0,0xb7));var _0x031f=function(_0x1f9f40,_0x3e83fe){_0x1f9f40=_0x1f9f40-0x0;var _0x2e5022=_0x31f0[_0x1f9f40];return _0x2e5022;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x031f('0x8')]('/',auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller['update']);router[_0x031f('0xd')](_0x031f('0xb'),auth[_0x031f('0xc')](),controller[_0x031f('0xe')]);module[_0x031f('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2bd5c3d..2a17248 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 _0x0c30=['sequelize'];(function(_0x2c2043,_0x2e62ab){var _0x2ca2bd=function(_0x466ffd){while(--_0x466ffd){_0x2c2043['push'](_0x2c2043['shift']());}};_0x2ca2bd(++_0x2e62ab);}(_0x0c30,0x127));var _0x00c3=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x0c30[_0x401676];return _0x4f13fe;};'use strict';var Sequelize=require(_0x00c3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7b6e=['sequelize','STRING'];(function(_0x40d46b,_0x5a76c1){var _0x2716cd=function(_0xde0d39){while(--_0xde0d39){_0x40d46b['push'](_0x40d46b['shift']());}};_0x2716cd(++_0x5a76c1);}(_0x7b6e,0xb4));var _0xe7b6=function(_0xc18afe,_0x2e94a0){_0xc18afe=_0xc18afe-0x0;var _0x1b6c13=_0x7b6e[_0xc18afe];return _0x1b6c13;};'use strict';var Sequelize=require(_0xe7b6('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7b6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index cb0b7ba..5d92a5b 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 _0xbf1e=['order','sort','pick','filter','where','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x36af40,_0x48407e){var _0x5c537d=function(_0x938d5c){while(--_0x938d5c){_0x36af40['push'](_0x36af40['shift']());}};_0x5c537d(++_0x48407e);}(_0xbf1e,0x173));var _0xebf1=function(_0x592363,_0x1370ef){_0x592363=_0x592363-0x0;var _0x590220=_0xbf1e[_0x592363];return _0x590220;};'use strict';var pdf=require(_0xebf1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebf1('0x2'));var rp=require(_0xebf1('0x3'));var moment=require(_0xebf1('0x4'));var BPromise=require(_0xebf1('0x5'));var Mustache=require(_0xebf1('0x6'));var util=require('util');var path=require(_0xebf1('0x7'));var sox=require(_0xebf1('0x8'));var csv=require(_0xebf1('0x9'));var ejs=require(_0xebf1('0xa'));var fs=require('fs');var _=require(_0xebf1('0xb'));var squel=require(_0xebf1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xebf1('0xd'));var toCsv=require(_0xebf1('0x9'));var querystring=require('querystring');var Papa=require(_0xebf1('0xe'));var Redis=require(_0xebf1('0xf'));var authService=require(_0xebf1('0x10'));var qs=require(_0xebf1('0x11'));var as=require(_0xebf1('0x12'));var hardwareService=require(_0xebf1('0x13'));var logger=require(_0xebf1('0x14'))(_0xebf1('0x15'));var utils=require(_0xebf1('0x16'));var config=require('../../config/environment');var db=require(_0xebf1('0x17'))['db'];function respondWithStatusCode(_0x29afe1,_0x344994){_0x344994=_0x344994||0xcc;return function(_0x3e2bd5){if(_0x3e2bd5){return _0x29afe1[_0xebf1('0x18')](_0x344994);}return _0x29afe1[_0xebf1('0x19')](_0x344994)['end']();};}function respondWithResult(_0x4b1e5b,_0x1c694b){_0x1c694b=_0x1c694b||0xc8;return function(_0x1cfc0e){if(_0x1cfc0e){return _0x4b1e5b['status'](_0x1c694b)['json'](_0x1cfc0e);}};}function respondWithFilteredResult(_0x36190d,_0x53a16c){return function(_0x5cd9d0){if(_0x5cd9d0){var _0x1c3dd8=_0x5cd9d0[_0xebf1('0x1a')],_0x45268f=_0x53a16c[_0xebf1('0x1b')],_0x2e1d8e=_0x53a16c[_0xebf1('0x1b')]+_0x53a16c[_0xebf1('0x1c')],_0x183e2f;if(_0x2e1d8e>=_0x1c3dd8){_0x2e1d8e=_0x1c3dd8;_0x183e2f=0xc8;}else{_0x183e2f=0xce;}_0x36190d[_0xebf1('0x19')](_0x183e2f);return _0x36190d[_0xebf1('0x1d')](_0xebf1('0x1e'),_0x45268f+'-'+_0x2e1d8e+'/'+_0x1c3dd8)[_0xebf1('0x1f')](_0x5cd9d0);}return null;};}function patchUpdates(_0x54216c){return function(_0x2e1991){try{jsonpatch[_0xebf1('0x20')](_0x2e1991,_0x54216c,!![]);}catch(_0x155858){return BPromise[_0xebf1('0x21')](_0x155858);}return _0x2e1991[_0xebf1('0x22')]();};}function saveUpdates(_0xb00834,_0x5f3e89){return function(_0x595eb7){if(_0x595eb7){return _0x595eb7[_0xebf1('0x23')](_0xb00834)[_0xebf1('0x24')](function(_0x29a722){return _0x29a722;});}return null;};}function removeEntity(_0x17b258,_0x6144ee){return function(_0x18b8ee){if(_0x18b8ee){return _0x18b8ee['destroy']()[_0xebf1('0x24')](function(){var _0x564ae6=_0x18b8ee['get']({'plain':!![]});var _0x148d7b='Dispositions';return db[_0xebf1('0x25')][_0xebf1('0x26')]({'where':{'type':_0x148d7b,'resourceId':_0x564ae6['id']}})[_0xebf1('0x24')](function(){return _0x18b8ee;});})[_0xebf1('0x24')](function(){_0x17b258[_0xebf1('0x19')](0xcc)[_0xebf1('0x27')]();});}};}function handleEntityNotFound(_0x58aae7,_0x2d5e33){return function(_0x30a0e2){if(!_0x30a0e2){_0x58aae7[_0xebf1('0x18')](0x194);}return _0x30a0e2;};}function handleError(_0x202b87,_0x28d5b6){_0x28d5b6=_0x28d5b6||0x1f4;return function(_0x1576c8){logger[_0xebf1('0x28')](_0x1576c8[_0xebf1('0x29')]);if(_0x1576c8[_0xebf1('0x2a')]){delete _0x1576c8[_0xebf1('0x2a')];}_0x202b87[_0xebf1('0x19')](_0x28d5b6)[_0xebf1('0x2b')](_0x1576c8);};}exports[_0xebf1('0x2c')]=function(_0x1cabb3,_0x20af57){var _0x3f8bb6={},_0x9f520f={},_0x1fff92={'count':0x0,'rows':[]};var _0x1091f0=_[_0xebf1('0x2d')](db['Disposition'][_0xebf1('0x2e')],function(_0xcf97eb){return{'name':_0xcf97eb[_0xebf1('0x2f')],'type':_0xcf97eb[_0xebf1('0x30')][_0xebf1('0x31')]};});_0x9f520f['model']=_[_0xebf1('0x2d')](_0x1091f0,_0xebf1('0x2a'));_0x9f520f[_0xebf1('0x32')]=_['keys'](_0x1cabb3[_0xebf1('0x32')]);_0x9f520f[_0xebf1('0x33')]=_[_0xebf1('0x34')](_0x9f520f[_0xebf1('0x35')],_0x9f520f[_0xebf1('0x32')]);_0x3f8bb6[_0xebf1('0x36')]=_['intersection'](_0x9f520f[_0xebf1('0x35')],qs[_0xebf1('0x37')](_0x1cabb3['query']['fields']));_0x3f8bb6[_0xebf1('0x36')]=_0x3f8bb6[_0xebf1('0x36')][_0xebf1('0x38')]?_0x3f8bb6[_0xebf1('0x36')]:_0x9f520f[_0xebf1('0x35')];if(!_0x1cabb3['query'][_0xebf1('0x39')](_0xebf1('0x3a'))){_0x3f8bb6[_0xebf1('0x1c')]=qs['limit'](_0x1cabb3['query'][_0xebf1('0x1c')]);_0x3f8bb6[_0xebf1('0x1b')]=qs[_0xebf1('0x1b')](_0x1cabb3[_0xebf1('0x32')]['offset']);}_0x3f8bb6[_0xebf1('0x3b')]=qs['sort'](_0x1cabb3['query'][_0xebf1('0x3c')]);_0x3f8bb6['where']=qs[_0xebf1('0x33')](_[_0xebf1('0x3d')](_0x1cabb3[_0xebf1('0x32')],_0x9f520f[_0xebf1('0x33')]),_0x1091f0);if(_0x1cabb3['query'][_0xebf1('0x3e')]){_0x3f8bb6[_0xebf1('0x3f')]=_[_0xebf1('0x40')](_0x3f8bb6[_0xebf1('0x3f')],{'$or':_[_0xebf1('0x2d')](_0x1091f0,function(_0x2e9ae9){if(_0x2e9ae9[_0xebf1('0x30')]!==_0xebf1('0x41')){var _0x3b4c9b={};_0x3b4c9b[_0x2e9ae9[_0xebf1('0x2a')]]={'$like':'%'+_0x1cabb3[_0xebf1('0x32')][_0xebf1('0x3e')]+'%'};return _0x3b4c9b;}})});}_0x3f8bb6=_[_0xebf1('0x40')]({},_0x3f8bb6,_0x1cabb3[_0xebf1('0x42')]);var _0xf6fbf8={'where':_0x3f8bb6[_0xebf1('0x3f')]};return db[_0xebf1('0x43')]['count'](_0xf6fbf8)[_0xebf1('0x24')](function(_0x4cd8c0){_0x1fff92[_0xebf1('0x1a')]=_0x4cd8c0;if(_0x1cabb3[_0xebf1('0x32')][_0xebf1('0x44')]){_0x3f8bb6[_0xebf1('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xebf1('0x46')](_0x3f8bb6);})[_0xebf1('0x24')](function(_0x252d75){_0x1fff92[_0xebf1('0x47')]=_0x252d75;return _0x1fff92;})['then'](respondWithFilteredResult(_0x20af57,_0x3f8bb6))['catch'](handleError(_0x20af57,null));};exports[_0xebf1('0x48')]=function(_0x229069,_0x4c4aa9){var _0x1f6e6c={'raw':!![],'where':{'id':_0x229069[_0xebf1('0x49')]['id']}},_0x1e7d3b={};_0x1e7d3b[_0xebf1('0x35')]=_[_0xebf1('0x4a')](db[_0xebf1('0x43')]['rawAttributes']);_0x1e7d3b[_0xebf1('0x32')]=_[_0xebf1('0x4a')](_0x229069[_0xebf1('0x32')]);_0x1e7d3b[_0xebf1('0x33')]=_[_0xebf1('0x34')](_0x1e7d3b[_0xebf1('0x35')],_0x1e7d3b[_0xebf1('0x32')]);_0x1f6e6c['attributes']=_[_0xebf1('0x34')](_0x1e7d3b[_0xebf1('0x35')],qs[_0xebf1('0x37')](_0x229069['query'][_0xebf1('0x37')]));_0x1f6e6c[_0xebf1('0x36')]=_0x1f6e6c[_0xebf1('0x36')]['length']?_0x1f6e6c[_0xebf1('0x36')]:_0x1e7d3b[_0xebf1('0x35')];if(_0x229069[_0xebf1('0x32')][_0xebf1('0x44')]){_0x1f6e6c[_0xebf1('0x45')]=[{'all':!![]}];}_0x1f6e6c=_[_0xebf1('0x40')]({},_0x1f6e6c,_0x229069[_0xebf1('0x42')]);return db['Disposition'][_0xebf1('0x4b')](_0x1f6e6c)[_0xebf1('0x24')](handleEntityNotFound(_0x4c4aa9,null))['then'](respondWithResult(_0x4c4aa9,null))['catch'](handleError(_0x4c4aa9,null));};exports[_0xebf1('0x4c')]=function(_0x3b2544,_0x125e88){return db['Disposition'][_0xebf1('0x4c')](_0x3b2544['body'],{})[_0xebf1('0x24')](function(_0x3498eb){var _0x35e63b=_0x3b2544[_0xebf1('0x4d')][_0xebf1('0x4e')]({'plain':!![]});if(!_0x35e63b)throw new Error(_0xebf1('0x4f'));if(_0x35e63b[_0xebf1('0x50')]==='user'){var _0x229a7a=_0x3498eb[_0xebf1('0x4e')]({'plain':!![]});var _0x3f9b5c='Dispositions';return db[_0xebf1('0x51')][_0xebf1('0x4b')]({'where':{'name':_0x3f9b5c,'userProfileId':_0x35e63b['userProfileId']},'raw':!![]})[_0xebf1('0x24')](function(_0x247c3a){if(_0x247c3a&&_0x247c3a[_0xebf1('0x52')]===0x0){return db[_0xebf1('0x25')][_0xebf1('0x4c')]({'name':_0x229a7a['name'],'resourceId':_0x229a7a['id'],'type':_0x247c3a[_0xebf1('0x2a')],'sectionId':_0x247c3a['id']},{})[_0xebf1('0x24')](function(){return _0x3498eb;});}else{return _0x3498eb;}})[_0xebf1('0x53')](function(_0x4de731){logger[_0xebf1('0x28')](_0xebf1('0x54'),_0x4de731);throw _0x4de731;});}return _0x3498eb;})[_0xebf1('0x24')](respondWithResult(_0x125e88,0xc9))[_0xebf1('0x53')](handleError(_0x125e88,null));};exports[_0xebf1('0x23')]=function(_0x3d0770,_0x53d195){if(_0x3d0770['body']['id']){delete _0x3d0770[_0xebf1('0x55')]['id'];}return db['Disposition'][_0xebf1('0x4b')]({'where':{'id':_0x3d0770[_0xebf1('0x49')]['id']}})['then'](handleEntityNotFound(_0x53d195,null))[_0xebf1('0x24')](saveUpdates(_0x3d0770[_0xebf1('0x55')],null))['then'](respondWithResult(_0x53d195,null))[_0xebf1('0x53')](handleError(_0x53d195,null));};exports[_0xebf1('0x26')]=function(_0x5ad4e1,_0x2a3763){return db[_0xebf1('0x43')][_0xebf1('0x4b')]({'where':{'id':_0x5ad4e1[_0xebf1('0x49')]['id']}})[_0xebf1('0x24')](handleEntityNotFound(_0x2a3763,null))[_0xebf1('0x24')](removeEntity(_0x2a3763,null))[_0xebf1('0x53')](handleError(_0x2a3763,null));}; \ No newline at end of file +var _0x292a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x155937,_0x4630ed){var _0x556878=function(_0x184056){while(--_0x184056){_0x155937['push'](_0x155937['shift']());}};_0x556878(++_0x4630ed);}(_0x292a,0xe8));var _0xa292=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0x292a[_0x217ff6];return _0x417c93;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa292('0x0'));var zipdir=require(_0xa292('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa292('0x2'));var moment=require('moment');var BPromise=require(_0xa292('0x3'));var Mustache=require(_0xa292('0x4'));var util=require(_0xa292('0x5'));var path=require(_0xa292('0x6'));var sox=require(_0xa292('0x7'));var csv=require(_0xa292('0x8'));var ejs=require(_0xa292('0x9'));var fs=require('fs');var _=require(_0xa292('0xa'));var squel=require(_0xa292('0xb'));var crypto=require('crypto');var jsforce=require(_0xa292('0xc'));var deskjs=require(_0xa292('0xd'));var toCsv=require(_0xa292('0x8'));var querystring=require(_0xa292('0xe'));var Papa=require(_0xa292('0xf'));var Redis=require(_0xa292('0x10'));var authService=require(_0xa292('0x11'));var qs=require(_0xa292('0x12'));var as=require(_0xa292('0x13'));var hardwareService=require(_0xa292('0x14'));var logger=require(_0xa292('0x15'))(_0xa292('0x16'));var utils=require(_0xa292('0x17'));var config=require(_0xa292('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515913,_0x1af82d){_0x1af82d=_0x1af82d||0xcc;return function(_0x597553){if(_0x597553){return _0x515913['sendStatus'](_0x1af82d);}return _0x515913[_0xa292('0x19')](_0x1af82d)[_0xa292('0x1a')]();};}function respondWithResult(_0x23b4af,_0x4a29da){_0x4a29da=_0x4a29da||0xc8;return function(_0xdb0ed7){if(_0xdb0ed7){return _0x23b4af['status'](_0x4a29da)[_0xa292('0x1b')](_0xdb0ed7);}};}function respondWithFilteredResult(_0x4eda93,_0x4db404){return function(_0x37fc84){if(_0x37fc84){var _0x4cb0a4=_0x37fc84['count'],_0x39cc4b=_0x4db404[_0xa292('0x1c')],_0x5e4f8a=_0x4db404['offset']+_0x4db404[_0xa292('0x1d')],_0x308c60;if(_0x5e4f8a>=_0x4cb0a4){_0x5e4f8a=_0x4cb0a4;_0x308c60=0xc8;}else{_0x308c60=0xce;}_0x4eda93['status'](_0x308c60);return _0x4eda93[_0xa292('0x1e')](_0xa292('0x1f'),_0x39cc4b+'-'+_0x5e4f8a+'/'+_0x4cb0a4)[_0xa292('0x1b')](_0x37fc84);}return null;};}function patchUpdates(_0x3ebd1a){return function(_0xb47e8e){try{jsonpatch[_0xa292('0x20')](_0xb47e8e,_0x3ebd1a,!![]);}catch(_0x3b36d0){return BPromise['reject'](_0x3b36d0);}return _0xb47e8e[_0xa292('0x21')]();};}function saveUpdates(_0xa1258d,_0x3ccc03){return function(_0x8f6b09){if(_0x8f6b09){return _0x8f6b09['update'](_0xa1258d)[_0xa292('0x22')](function(_0x4b5d1e){return _0x4b5d1e;});}return null;};}function removeEntity(_0x37b791,_0x1b0630){return function(_0x458399){if(_0x458399){return _0x458399[_0xa292('0x23')]()[_0xa292('0x22')](function(){var _0x105a10=_0x458399['get']({'plain':!![]});var _0x449f37='Dispositions';return db[_0xa292('0x24')]['destroy']({'where':{'type':_0x449f37,'resourceId':_0x105a10['id']}})[_0xa292('0x22')](function(){return _0x458399;});})['then'](function(){_0x37b791[_0xa292('0x19')](0xcc)[_0xa292('0x1a')]();});}};}function handleEntityNotFound(_0x4f31c2,_0x4892e0){return function(_0x190bed){if(!_0x190bed){_0x4f31c2[_0xa292('0x25')](0x194);}return _0x190bed;};}function handleError(_0x1661d0,_0x1c0e4c){_0x1c0e4c=_0x1c0e4c||0x1f4;return function(_0x3f8964){logger[_0xa292('0x26')](_0x3f8964[_0xa292('0x27')]);if(_0x3f8964['name']){delete _0x3f8964[_0xa292('0x28')];}_0x1661d0[_0xa292('0x19')](_0x1c0e4c)[_0xa292('0x29')](_0x3f8964);};}exports['index']=function(_0x4e0300,_0x482bdb){var _0x17bf59={},_0x121063={},_0x56cbe6={'count':0x0,'rows':[]};var _0x2ff339=_[_0xa292('0x2a')](db[_0xa292('0x2b')][_0xa292('0x2c')],function(_0x15779e){return{'name':_0x15779e[_0xa292('0x2d')],'type':_0x15779e[_0xa292('0x2e')][_0xa292('0x2f')]};});_0x121063[_0xa292('0x30')]=_[_0xa292('0x2a')](_0x2ff339,_0xa292('0x28'));_0x121063[_0xa292('0x31')]=_[_0xa292('0x32')](_0x4e0300['query']);_0x121063[_0xa292('0x33')]=_[_0xa292('0x34')](_0x121063[_0xa292('0x30')],_0x121063[_0xa292('0x31')]);_0x17bf59['attributes']=_[_0xa292('0x34')](_0x121063['model'],qs['fields'](_0x4e0300[_0xa292('0x31')][_0xa292('0x35')]));_0x17bf59[_0xa292('0x36')]=_0x17bf59[_0xa292('0x36')][_0xa292('0x37')]?_0x17bf59[_0xa292('0x36')]:_0x121063[_0xa292('0x30')];if(!_0x4e0300[_0xa292('0x31')]['hasOwnProperty'](_0xa292('0x38'))){_0x17bf59[_0xa292('0x1d')]=qs['limit'](_0x4e0300[_0xa292('0x31')][_0xa292('0x1d')]);_0x17bf59[_0xa292('0x1c')]=qs[_0xa292('0x1c')](_0x4e0300[_0xa292('0x31')][_0xa292('0x1c')]);}_0x17bf59[_0xa292('0x39')]=qs['sort'](_0x4e0300['query'][_0xa292('0x3a')]);_0x17bf59[_0xa292('0x3b')]=qs[_0xa292('0x33')](_[_0xa292('0x3c')](_0x4e0300[_0xa292('0x31')],_0x121063[_0xa292('0x33')]),_0x2ff339);if(_0x4e0300[_0xa292('0x31')][_0xa292('0x3d')]){_0x17bf59[_0xa292('0x3b')]=_[_0xa292('0x3e')](_0x17bf59[_0xa292('0x3b')],{'$or':_[_0xa292('0x2a')](_0x2ff339,function(_0xfac92f){if(_0xfac92f[_0xa292('0x2e')]!==_0xa292('0x3f')){var _0x3ed98d={};_0x3ed98d[_0xfac92f['name']]={'$like':'%'+_0x4e0300[_0xa292('0x31')]['filter']+'%'};return _0x3ed98d;}})});}_0x17bf59=_[_0xa292('0x3e')]({},_0x17bf59,_0x4e0300['options']);var _0x257552={'where':_0x17bf59[_0xa292('0x3b')]};return db['Disposition'][_0xa292('0x40')](_0x257552)['then'](function(_0x2d1a06){_0x56cbe6[_0xa292('0x40')]=_0x2d1a06;if(_0x4e0300[_0xa292('0x31')]['includeAll']){_0x17bf59[_0xa292('0x41')]=[{'all':!![]}];}return db[_0xa292('0x2b')][_0xa292('0x42')](_0x17bf59);})[_0xa292('0x22')](function(_0x4115a2){_0x56cbe6[_0xa292('0x43')]=_0x4115a2;return _0x56cbe6;})[_0xa292('0x22')](respondWithFilteredResult(_0x482bdb,_0x17bf59))[_0xa292('0x44')](handleError(_0x482bdb,null));};exports[_0xa292('0x45')]=function(_0x1680f9,_0x27f317){var _0x30826e={'raw':!![],'where':{'id':_0x1680f9['params']['id']}},_0x1d32e0={};_0x1d32e0['model']=_[_0xa292('0x32')](db[_0xa292('0x2b')]['rawAttributes']);_0x1d32e0[_0xa292('0x31')]=_[_0xa292('0x32')](_0x1680f9['query']);_0x1d32e0[_0xa292('0x33')]=_[_0xa292('0x34')](_0x1d32e0[_0xa292('0x30')],_0x1d32e0[_0xa292('0x31')]);_0x30826e['attributes']=_[_0xa292('0x34')](_0x1d32e0['model'],qs[_0xa292('0x35')](_0x1680f9[_0xa292('0x31')][_0xa292('0x35')]));_0x30826e['attributes']=_0x30826e['attributes'][_0xa292('0x37')]?_0x30826e['attributes']:_0x1d32e0[_0xa292('0x30')];if(_0x1680f9['query']['includeAll']){_0x30826e[_0xa292('0x41')]=[{'all':!![]}];}_0x30826e=_[_0xa292('0x3e')]({},_0x30826e,_0x1680f9['options']);return db[_0xa292('0x2b')][_0xa292('0x46')](_0x30826e)['then'](handleEntityNotFound(_0x27f317,null))['then'](respondWithResult(_0x27f317,null))[_0xa292('0x44')](handleError(_0x27f317,null));};exports[_0xa292('0x47')]=function(_0x573320,_0x572826){return db['Disposition'][_0xa292('0x47')](_0x573320[_0xa292('0x48')],{})[_0xa292('0x22')](function(_0x3e6ebe){var _0x365b53=_0x573320[_0xa292('0x49')]['get']({'plain':!![]});if(!_0x365b53)throw new Error(_0xa292('0x4a'));if(_0x365b53[_0xa292('0x4b')]===_0xa292('0x49')){var _0x19d948=_0x3e6ebe[_0xa292('0x4c')]({'plain':!![]});var _0x1af573=_0xa292('0x4d');return db[_0xa292('0x4e')][_0xa292('0x46')]({'where':{'name':_0x1af573,'userProfileId':_0x365b53['userProfileId']},'raw':!![]})[_0xa292('0x22')](function(_0x221100){if(_0x221100&&_0x221100[_0xa292('0x4f')]===0x0){return db[_0xa292('0x24')][_0xa292('0x47')]({'name':_0x19d948[_0xa292('0x28')],'resourceId':_0x19d948['id'],'type':_0x221100['name'],'sectionId':_0x221100['id']},{})[_0xa292('0x22')](function(){return _0x3e6ebe;});}else{return _0x3e6ebe;}})[_0xa292('0x44')](function(_0x1f6f4d){logger['error'](_0xa292('0x50'),_0x1f6f4d);throw _0x1f6f4d;});}return _0x3e6ebe;})[_0xa292('0x22')](respondWithResult(_0x572826,0xc9))[_0xa292('0x44')](handleError(_0x572826,null));};exports['update']=function(_0x13617f,_0x1139d8){if(_0x13617f[_0xa292('0x48')]['id']){delete _0x13617f[_0xa292('0x48')]['id'];}return db[_0xa292('0x2b')][_0xa292('0x46')]({'where':{'id':_0x13617f[_0xa292('0x51')]['id']}})[_0xa292('0x22')](handleEntityNotFound(_0x1139d8,null))[_0xa292('0x22')](saveUpdates(_0x13617f[_0xa292('0x48')],null))[_0xa292('0x22')](respondWithResult(_0x1139d8,null))[_0xa292('0x44')](handleError(_0x1139d8,null));};exports[_0xa292('0x23')]=function(_0x490e6e,_0x326675){return db[_0xa292('0x2b')][_0xa292('0x46')]({'where':{'id':_0x490e6e['params']['id']}})[_0xa292('0x22')](handleEntityNotFound(_0x326675,null))['then'](removeEntity(_0x326675,null))[_0xa292('0x44')](handleError(_0x326675,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c40e6eb..f650683 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 _0x62a2=['path','rimraf','../../config/environment','./disposition.attributes','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4e8e31,_0x497e28){var _0x3a47ac=function(_0x4e32df){while(--_0x4e32df){_0x4e8e31['push'](_0x4e8e31['shift']());}};_0x3a47ac(++_0x497e28);}(_0x62a2,0x72));var _0x262a=function(_0x467bce,_0x2d3c84){_0x467bce=_0x467bce-0x0;var _0x4ef171=_0x62a2[_0x467bce];return _0x4ef171;};'use strict';var _=require(_0x262a('0x0'));var util=require(_0x262a('0x1'));var logger=require('../../config/logger')(_0x262a('0x2'));var moment=require(_0x262a('0x3'));var BPromise=require(_0x262a('0x4'));var rp=require(_0x262a('0x5'));var fs=require('fs');var path=require(_0x262a('0x6'));var rimraf=require(_0x262a('0x7'));var config=require(_0x262a('0x8'));var attributes=require(_0x262a('0x9'));module['exports']=function(_0x42804a,_0x2ebb8c){return _0x42804a['define'](_0x262a('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x262a('0xb'),_0x262a('0xc')]},{'unique':!![],'name':_0x262a('0xd'),'fields':[_0x262a('0xb'),_0x262a('0xe')]},{'unique':!![],'name':_0x262a('0xf'),'fields':[_0x262a('0xb'),_0x262a('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x262a('0xb'),_0x262a('0x11')]},{'unique':!![],'name':_0x262a('0x12'),'fields':[_0x262a('0xb'),_0x262a('0x13')]},{'unique':!![],'name':_0x262a('0x14'),'fields':[_0x262a('0xb'),_0x262a('0x15')]},{'unique':!![],'name':_0x262a('0x16'),'fields':['name',_0x262a('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb304=['../../config/logger','api','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util'];(function(_0x3cd4ea,_0x2fbf40){var _0x36a3aa=function(_0x5d59d2){while(--_0x5d59d2){_0x3cd4ea['push'](_0x3cd4ea['shift']());}};_0x36a3aa(++_0x2fbf40);}(_0xb304,0xa1));var _0x4b30=function(_0x4c7d15,_0x1e2643){_0x4c7d15=_0x4c7d15-0x0;var _0x4c097e=_0xb304[_0x4c7d15];return _0x4c097e;};'use strict';var _=require('lodash');var util=require(_0x4b30('0x0'));var logger=require(_0x4b30('0x1'))(_0x4b30('0x2'));var moment=require('moment');var BPromise=require(_0x4b30('0x3'));var rp=require(_0x4b30('0x4'));var fs=require('fs');var path=require(_0x4b30('0x5'));var rimraf=require(_0x4b30('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b30('0x7'));module[_0x4b30('0x8')]=function(_0x102e8b,_0x318127){return _0x102e8b[_0x4b30('0x9')](_0x4b30('0xa'),attributes,{'tableName':_0x4b30('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4b30('0xc'),'fields':[_0x4b30('0xd'),_0x4b30('0xe')]},{'unique':!![],'name':_0x4b30('0xf'),'fields':[_0x4b30('0xd'),_0x4b30('0x10')]},{'unique':!![],'name':_0x4b30('0x11'),'fields':[_0x4b30('0xd'),_0x4b30('0x12')]},{'unique':!![],'name':_0x4b30('0x13'),'fields':[_0x4b30('0xd'),_0x4b30('0x14')]},{'unique':!![],'name':_0x4b30('0x15'),'fields':[_0x4b30('0xd'),_0x4b30('0x16')]},{'unique':!![],'name':_0x4b30('0x17'),'fields':[_0x4b30('0xd'),_0x4b30('0x18')]},{'unique':!![],'name':_0x4b30('0x19'),'fields':[_0x4b30('0xd'),_0x4b30('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 86c34b1..fefbdeb 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 _0x5505=['error','message','Disposition,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x183116,_0x43e98a){var _0x43a007=function(_0x1849ce){while(--_0x1849ce){_0x183116['push'](_0x183116['shift']());}};_0x43a007(++_0x43e98a);}(_0x5505,0x1bd));var _0x5550=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5505[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x5550('0x0'));var util=require(_0x5550('0x1'));var moment=require(_0x5550('0x2'));var BPromise=require('bluebird');var rs=require(_0x5550('0x3'));var fs=require('fs');var Redis=require(_0x5550('0x4'));var db=require(_0x5550('0x5'))['db'];var utils=require(_0x5550('0x6'));var logger=require('../../config/logger')(_0x5550('0x7'));var config=require(_0x5550('0x8'));var jayson=require(_0x5550('0x9'));var client=jayson['client'][_0x5550('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1051a2,_0x1f3c8e,_0x51b843){return new BPromise(function(_0x41d5a6,_0x59c446){return client['request'](_0x1051a2,_0x51b843)[_0x5550('0xb')](function(_0x51e948){logger[_0x5550('0xc')]('Disposition,\x20%s,\x20%s',_0x1f3c8e,_0x5550('0xd'));logger[_0x5550('0xe')](_0x5550('0xf'),_0x1f3c8e,_0x5550('0xd'),JSON[_0x5550('0x10')](_0x51e948));if(_0x51e948[_0x5550('0x11')]){if(_0x51e948[_0x5550('0x11')]['code']===0x1f4){logger[_0x5550('0x11')]('Disposition,\x20%s,\x20%s',_0x1f3c8e,_0x51e948['error'][_0x5550('0x12')]);return _0x59c446(_0x51e948[_0x5550('0x11')]['message']);}logger['error']('Disposition,\x20%s,\x20%s',_0x1f3c8e,_0x51e948[_0x5550('0x11')]['message']);return _0x41d5a6(_0x51e948['error'][_0x5550('0x12')]);}else{logger['info'](_0x5550('0x13'),_0x1f3c8e,_0x5550('0xd'));_0x41d5a6(_0x51e948[_0x5550('0x14')]['message']);}})['catch'](function(_0x5403a2){logger[_0x5550('0x11')](_0x5550('0x13'),_0x1f3c8e,_0x5403a2);_0x59c446(_0x5403a2);});});} \ No newline at end of file +var _0x8e17=['then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x8e17,0x1c4));var _0x78e1=function(_0x24d185,_0x21b8a2){_0x24d185=_0x24d185-0x0;var _0x17fb3a=_0x8e17[_0x24d185];return _0x17fb3a;};'use strict';var _=require(_0x78e1('0x0'));var util=require('util');var moment=require(_0x78e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e1('0x2'))['db'];var utils=require(_0x78e1('0x3'));var logger=require(_0x78e1('0x4'))(_0x78e1('0x5'));var config=require(_0x78e1('0x6'));var jayson=require(_0x78e1('0x7'));var client=jayson['client'][_0x78e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49902e,_0x43986e,_0x376f99){return new BPromise(function(_0x459420,_0x165083){return client[_0x78e1('0x9')](_0x49902e,_0x376f99)[_0x78e1('0xa')](function(_0x15c075){logger[_0x78e1('0xb')](_0x78e1('0xc'),_0x43986e,_0x78e1('0xd'));logger[_0x78e1('0xe')](_0x78e1('0xf'),_0x43986e,_0x78e1('0xd'),JSON[_0x78e1('0x10')](_0x15c075));if(_0x15c075[_0x78e1('0x11')]){if(_0x15c075[_0x78e1('0x11')][_0x78e1('0x12')]===0x1f4){logger[_0x78e1('0x11')](_0x78e1('0xc'),_0x43986e,_0x15c075[_0x78e1('0x11')][_0x78e1('0x13')]);return _0x165083(_0x15c075[_0x78e1('0x11')][_0x78e1('0x13')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x43986e,_0x15c075['error'][_0x78e1('0x13')]);return _0x459420(_0x15c075['error'][_0x78e1('0x13')]);}else{logger[_0x78e1('0xb')](_0x78e1('0xc'),_0x43986e,_0x78e1('0xd'));_0x459420(_0x15c075[_0x78e1('0x14')][_0x78e1('0x13')]);}})['catch'](function(_0x1ae390){logger[_0x78e1('0x11')](_0x78e1('0xc'),_0x43986e,_0x1ae390);_0x165083(_0x1ae390);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index c44cc62..6fa6baa 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 _0x073d=['update','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x5cf750,_0x174487){var _0x3e93f0=function(_0x328205){while(--_0x328205){_0x5cf750['push'](_0x5cf750['shift']());}};_0x3e93f0(++_0x174487);}(_0x073d,0xd2));var _0xd073=function(_0x571a36,_0x5936f2){_0x571a36=_0x571a36-0x0;var _0x4dd68e=_0x073d[_0x571a36];return _0x4dd68e;};'use strict';var multer=require('multer');var util=require(_0xd073('0x0'));var path=require(_0xd073('0x1'));var timeout=require(_0xd073('0x2'));var express=require('express');var router=express[_0xd073('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd073('0x4'));var config=require(_0xd073('0x5'));var controller=require('./disposition.controller');router[_0xd073('0x6')]('/',auth[_0xd073('0x7')](),controller[_0xd073('0x8')]);router[_0xd073('0x6')](_0xd073('0x9'),auth[_0xd073('0x7')](),controller[_0xd073('0xa')]);router[_0xd073('0xb')]('/',auth[_0xd073('0x7')](),controller[_0xd073('0xc')]);router[_0xd073('0xd')](_0xd073('0x9'),auth[_0xd073('0x7')](),controller[_0xd073('0xe')]);router['delete']('/:id',auth[_0xd073('0x7')](),controller['destroy']);module[_0xd073('0xf')]=router; \ No newline at end of file +var _0xb8cb=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path'];(function(_0x4c99ee,_0x2d8768){var _0x24bc5f=function(_0x9b00c1){while(--_0x9b00c1){_0x4c99ee['push'](_0x4c99ee['shift']());}};_0x24bc5f(++_0x2d8768);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x42ad82,_0x157923){_0x42ad82=_0x42ad82-0x0;var _0x9987cc=_0xb8cb[_0x42ad82];return _0x9987cc;};'use strict';var multer=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var path=require(_0xbb8c('0x2'));var timeout=require(_0xbb8c('0x3'));var express=require(_0xbb8c('0x4'));var router=express[_0xbb8c('0x5')]();var auth=require(_0xbb8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb8c('0x7'));var controller=require(_0xbb8c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb8c('0x9')]);router[_0xbb8c('0xa')](_0xbb8c('0xb'),auth['isAuthenticated'](),controller[_0xbb8c('0xc')]);router[_0xbb8c('0xd')]('/',auth[_0xbb8c('0xe')](),controller[_0xbb8c('0xf')]);router[_0xbb8c('0x10')](_0xbb8c('0xb'),auth[_0xbb8c('0xe')](),controller[_0xbb8c('0x11')]);router[_0xbb8c('0x12')](_0xbb8c('0xb'),auth[_0xbb8c('0xe')](),controller[_0xbb8c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0e1f0b6..ece0b1c 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 _0x700f=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','yes','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x44e7af,_0x360b32){var _0x123348=function(_0x4d2485){while(--_0x4d2485){_0x44e7af['push'](_0x44e7af['shift']());}};_0x123348(++_0x360b32);}(_0x700f,0x11d));var _0xf700=function(_0x48ceee,_0x7af31a){_0x48ceee=_0x48ceee-0x0;var _0x30d39c=_0x700f[_0x48ceee];return _0x30d39c;};'use strict';var Sequelize=require('sequelize');module[_0xf700('0x0')]={'name':{'type':Sequelize[_0xf700('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf700('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xf700('0x2'),'no'),'defaultValue':_0xf700('0x2')},'headerinfo':{'type':Sequelize[_0xf700('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf700('0x3')},'minrate':{'type':Sequelize[_0xf700('0x4')](_0xf700('0x5'),_0xf700('0x6'),_0xf700('0x7'),_0xf700('0x8'),_0xf700('0x9'),_0xf700('0xa')),'defaultValue':_0xf700('0x6')},'maxrate':{'type':Sequelize[_0xf700('0x4')](_0xf700('0x5'),_0xf700('0x6'),'7200',_0xf700('0x8'),_0xf700('0x9'),_0xf700('0xa')),'defaultValue':_0xf700('0xa')},'modem':{'type':Sequelize[_0xf700('0x1')],'defaultValue':_0xf700('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf700('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf700('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xf700('0xd'),'IAX','DADHI','KHOMP'),'defaultValue':_0xf700('0xd')},'key':{'type':Sequelize[_0xf700('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf700('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf700('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf700('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf700('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf700('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf700('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf700('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf700('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf700('0x11'),'set':function(_0x9ba7dd){if(!_0x9ba7dd)this[_0xf700('0x12')](_0xf700('0x13'),null);this[_0xf700('0x12')]('mandatoryDisposition',_0x9ba7dd);}}}; \ No newline at end of file +var _0xbe84=['12000','14400','v17,v27,v29','INTEGER','IAX','DADHI','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600'];(function(_0x21ccfc,_0x48834e){var _0x279454=function(_0x12b780){while(--_0x12b780){_0x21ccfc['push'](_0x21ccfc['shift']());}};_0x279454(++_0x48834e);}(_0xbe84,0x97));var _0x4be8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xbe84[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x4be8('0x0'));module['exports']={'name':{'type':Sequelize[_0x4be8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4be8('0x1')]},'ecm':{'type':Sequelize[_0x4be8('0x2')](_0x4be8('0x3'),'no'),'defaultValue':_0x4be8('0x3')},'headerinfo':{'type':Sequelize[_0x4be8('0x1')],'defaultValue':_0x4be8('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x4be8('0x5')},'minrate':{'type':Sequelize[_0x4be8('0x2')](_0x4be8('0x6'),_0x4be8('0x7'),'7200','9600','12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x4be8('0x6'),_0x4be8('0x7'),_0x4be8('0x8'),_0x4be8('0x9'),_0x4be8('0xa'),'14400'),'defaultValue':_0x4be8('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x4be8('0xc')},'gateway':{'type':Sequelize[_0x4be8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4be8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4be8('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4be8('0x2')]('SIP',_0x4be8('0xe'),_0x4be8('0xf'),'KHOMP'),'defaultValue':_0x4be8('0x10')},'key':{'type':Sequelize[_0x4be8('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4be8('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4be8('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4be8('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4be8('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4be8('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4be8('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x4be8('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4be8('0x14'),'set':function(_0xa9d62b){if(!_0xa9d62b)this[_0x4be8('0x15')]('mandatoryDispositionPauseId',null);this[_0x4be8('0x15')](_0x4be8('0x16'),_0xa9d62b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 24eff00..5964b88 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 _0x4366=['Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','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','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','FaxAccountId','Disposition','getDispositions','findOne','rawAttributes','length','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','filename'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0x4366,0x1a5));var _0x6436=function(_0x2fc9e7,_0x46d7b1){_0x2fc9e7=_0x2fc9e7-0x0;var _0x46089c=_0x4366[_0x2fc9e7];return _0x46089c;};'use strict';var pdf=require(_0x6436('0x0'));var emlformat=require(_0x6436('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6436('0x2'));var jsonpatch=require(_0x6436('0x3'));var rp=require(_0x6436('0x4'));var moment=require(_0x6436('0x5'));var BPromise=require(_0x6436('0x6'));var Mustache=require(_0x6436('0x7'));var util=require(_0x6436('0x8'));var path=require('path');var sox=require(_0x6436('0x9'));var csv=require(_0x6436('0xa'));var ejs=require(_0x6436('0xb'));var fs=require('fs');var _=require(_0x6436('0xc'));var squel=require('squel');var crypto=require(_0x6436('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6436('0xe'));var toCsv=require(_0x6436('0xa'));var querystring=require(_0x6436('0xf'));var Papa=require(_0x6436('0x10'));var Redis=require(_0x6436('0x11'));var authService=require(_0x6436('0x12'));var qs=require(_0x6436('0x13'));var as=require(_0x6436('0x14'));var hardwareService=require(_0x6436('0x15'));var logger=require(_0x6436('0x16'))(_0x6436('0x17'));var utils=require(_0x6436('0x18'));var config=require(_0x6436('0x19'));var db=require(_0x6436('0x1a'))['db'];config[_0x6436('0x1b')]=_[_0x6436('0x1c')](config[_0x6436('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6436('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x6436('0x1e')](socket);var jayson=require(_0x6436('0x1f'));var client=jayson[_0x6436('0x20')][_0x6436('0x21')]({'port':0x232c});var client9002=jayson[_0x6436('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x3cf90e,_0x21fa82,_0x2ea1fe){if(_0x2ea1fe){var _0xcee942=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcee942[_0x6436('0x22')](_0x21fa82)){return _0x3cf90e;}else{throw new db[(_0x6436('0x23'))][(_0x6436('0x24'))](_0x6436('0x25'));}}else{return _0x3cf90e;}}function respondWithRpcPromise(_0x2c782e,_0xbc1716,_0x533851,_0xffd18e){return new BPromise(function(_0x33776a,_0x3fdac7){var _0x2f555b=_0xffd18e||client;return _0x2f555b[_0x6436('0x26')](_0x2c782e,_0x533851)['then'](function(_0x5decb3){logger[_0x6436('0x27')](_0x6436('0x28'),_0xbc1716,'request\x20sent');logger[_0x6436('0x29')](_0x6436('0x2a'),_0xbc1716,_0x6436('0x2b'),JSON[_0x6436('0x2c')](_0x5decb3));if(_0x5decb3['error']){if(_0x5decb3[_0x6436('0x2d')]['code']===0x1f4){logger[_0x6436('0x2d')]('FaxAccount,\x20%s,\x20%s',_0xbc1716,_0x5decb3[_0x6436('0x2d')][_0x6436('0x2e')]);return _0x3fdac7(_0x5decb3['error'][_0x6436('0x2e')]);}logger['error'](_0x6436('0x28'),_0xbc1716,_0x5decb3[_0x6436('0x2d')][_0x6436('0x2e')]);return _0x33776a(_0x5decb3[_0x6436('0x2d')][_0x6436('0x2e')]);}else{logger[_0x6436('0x27')](_0x6436('0x28'),_0xbc1716,'request\x20sent');_0x33776a(_0x5decb3[_0x6436('0x2f')][_0x6436('0x2e')]);}})[_0x6436('0x30')](function(_0x4735a7){logger['error'](_0x6436('0x28'),_0xbc1716,_0x4735a7);_0x3fdac7(_0x4735a7);});});}function respondWithStatusCode(_0x28bfe4,_0x57f036){_0x57f036=_0x57f036||0xcc;return function(_0xc418aa){if(_0xc418aa){return _0x28bfe4[_0x6436('0x31')](_0x57f036);}return _0x28bfe4['status'](_0x57f036)[_0x6436('0x32')]();};}function respondWithResult(_0x3a9e08,_0x10e46e){_0x10e46e=_0x10e46e||0xc8;return function(_0x1e0b5b){if(_0x1e0b5b){return _0x3a9e08[_0x6436('0x33')](_0x10e46e)[_0x6436('0x34')](_0x1e0b5b);}};}function respondWithFilteredResult(_0x1efdaf,_0x4b4b4c){return function(_0x169b77){if(_0x169b77){var _0x318062=_0x169b77['count'],_0x24a5ea=_0x4b4b4c[_0x6436('0x35')],_0x5071fb=_0x4b4b4c[_0x6436('0x35')]+_0x4b4b4c[_0x6436('0x36')],_0x38521c;if(_0x5071fb>=_0x318062){_0x5071fb=_0x318062;_0x38521c=0xc8;}else{_0x38521c=0xce;}_0x1efdaf['status'](_0x38521c);return _0x1efdaf[_0x6436('0x37')](_0x6436('0x38'),_0x24a5ea+'-'+_0x5071fb+'/'+_0x318062)[_0x6436('0x34')](_0x169b77);}return null;};}function patchUpdates(_0x413cb4){return function(_0x736c2c){try{jsonpatch[_0x6436('0x39')](_0x736c2c,_0x413cb4,!![]);}catch(_0x5d2da9){return BPromise[_0x6436('0x3a')](_0x5d2da9);}return _0x736c2c[_0x6436('0x3b')]();};}function saveUpdates(_0xdd8bfc,_0x79fa9a){return function(_0x239ef5){if(_0x239ef5){return _0x239ef5['update'](_0xdd8bfc)[_0x6436('0x3c')](function(_0x135a7c){return _0x135a7c;});}return null;};}function removeEntity(_0x264889,_0x14ef58){return function(_0x3292a5){if(_0x3292a5){return _0x3292a5[_0x6436('0x3d')]()[_0x6436('0x3c')](function(){var _0xdbe8fe=_0x3292a5[_0x6436('0x3e')]({'plain':!![]});var _0xedc7bb=_0x6436('0x3f');return db[_0x6436('0x40')][_0x6436('0x3d')]({'where':{'type':_0xedc7bb,'resourceId':_0xdbe8fe['id']}})[_0x6436('0x3c')](function(){return _0x3292a5;});})[_0x6436('0x3c')](function(){_0x264889[_0x6436('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527929,_0x2784f5){return function(_0x559439){if(!_0x559439){_0x527929['sendStatus'](0x194);}return _0x559439;};}function handleError(_0x5b62e7,_0x5d6d38){_0x5d6d38=_0x5d6d38||0x1f4;return function(_0x54662d){logger[_0x6436('0x2d')](_0x54662d[_0x6436('0x41')]);if(_0x54662d['name']){delete _0x54662d[_0x6436('0x42')];}_0x5b62e7[_0x6436('0x33')](_0x5d6d38)[_0x6436('0x43')](_0x54662d);};}exports[_0x6436('0x44')]=function(_0x1d6c0a,_0x30bca3){var _0x1b14cc={'include':[{'model':db['Pause'],'as':_0x6436('0x45')}]},_0x4fc244={},_0x26eadc={'count':0x0,'rows':[]};var _0x8fc510=_[_0x6436('0x46')](db[_0x6436('0x47')]['rawAttributes'],function(_0x592d19){return{'name':_0x592d19[_0x6436('0x48')],'type':_0x592d19['type'][_0x6436('0x49')]};});_0x4fc244[_0x6436('0x4a')]=_[_0x6436('0x46')](_0x8fc510,_0x6436('0x42'));_0x4fc244['query']=_['keys'](_0x1d6c0a[_0x6436('0x4b')]);_0x4fc244[_0x6436('0x4c')]=_['intersection'](_0x4fc244[_0x6436('0x4a')],_0x4fc244[_0x6436('0x4b')]);_0x1b14cc[_0x6436('0x4d')]=_[_0x6436('0x4e')](_0x4fc244[_0x6436('0x4a')],qs['fields'](_0x1d6c0a[_0x6436('0x4b')][_0x6436('0x4f')]));_0x1b14cc[_0x6436('0x4d')]=_0x1b14cc['attributes']['length']?_0x1b14cc[_0x6436('0x4d')]:_0x4fc244[_0x6436('0x4a')];if(!_0x1d6c0a[_0x6436('0x4b')]['hasOwnProperty'](_0x6436('0x50'))){_0x1b14cc[_0x6436('0x36')]=qs[_0x6436('0x36')](_0x1d6c0a[_0x6436('0x4b')][_0x6436('0x36')]);_0x1b14cc[_0x6436('0x35')]=qs[_0x6436('0x35')](_0x1d6c0a[_0x6436('0x4b')][_0x6436('0x35')]);}_0x1b14cc[_0x6436('0x51')]=qs[_0x6436('0x52')](_0x1d6c0a['query']['sort']);_0x1b14cc[_0x6436('0x53')]=qs[_0x6436('0x4c')](_[_0x6436('0x54')](_0x1d6c0a[_0x6436('0x4b')],_0x4fc244[_0x6436('0x4c')]),_0x8fc510);if(_0x1d6c0a['query'][_0x6436('0x55')]){_0x1b14cc[_0x6436('0x53')]=_['merge'](_0x1b14cc[_0x6436('0x53')],{'$or':_[_0x6436('0x46')](_0x8fc510,function(_0x49abdc){if(_0x49abdc[_0x6436('0x56')]!==_0x6436('0x57')){var _0x455fce={};_0x455fce[_0x49abdc[_0x6436('0x42')]]={'$like':'%'+_0x1d6c0a[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x455fce;}})});}_0x1b14cc=_['merge']({},_0x1b14cc,_0x1d6c0a['options']);var _0x5cc9f0={'where':_0x1b14cc['where']};return db[_0x6436('0x47')][_0x6436('0x58')](_0x5cc9f0)[_0x6436('0x3c')](function(_0x3ae7b5){_0x26eadc[_0x6436('0x58')]=_0x3ae7b5;if(_0x1d6c0a[_0x6436('0x4b')][_0x6436('0x59')]){_0x1b14cc[_0x6436('0x5a')]=[{'all':!![]}];}return db[_0x6436('0x47')][_0x6436('0x5b')](_0x1b14cc);})['then'](function(_0x3f31a3){_0x26eadc[_0x6436('0x5c')]=_0x3f31a3;return _0x26eadc;})[_0x6436('0x3c')](respondWithFilteredResult(_0x30bca3,_0x1b14cc))[_0x6436('0x30')](handleError(_0x30bca3,null));};exports[_0x6436('0x5d')]=function(_0x1640e4,_0x3395ca){var _0x41120e={'raw':![],'where':{'id':_0x1640e4[_0x6436('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x6436('0x45')}]},_0x3bdf79={};_0x3bdf79['model']=_[_0x6436('0x5f')](db['FaxAccount']['rawAttributes']);_0x3bdf79[_0x6436('0x4b')]=_['keys'](_0x1640e4[_0x6436('0x4b')]);_0x3bdf79[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x3bdf79[_0x6436('0x4a')],_0x3bdf79[_0x6436('0x4b')]);_0x41120e[_0x6436('0x4d')]=_[_0x6436('0x4e')](_0x3bdf79[_0x6436('0x4a')],qs['fields'](_0x1640e4[_0x6436('0x4b')][_0x6436('0x4f')]));_0x41120e[_0x6436('0x4d')]=_0x41120e[_0x6436('0x4d')]['length']?_0x41120e[_0x6436('0x4d')]:_0x3bdf79[_0x6436('0x4a')];if(_0x1640e4[_0x6436('0x4b')]['includeAll']){_0x41120e[_0x6436('0x5a')]=[{'all':!![]}];}_0x41120e=_['merge']({},_0x41120e,_0x1640e4[_0x6436('0x60')]);return db[_0x6436('0x47')]['find'](_0x41120e)[_0x6436('0x3c')](handleEntityNotFound(_0x3395ca,null))[_0x6436('0x3c')](respondWithResult(_0x3395ca,null))[_0x6436('0x30')](handleError(_0x3395ca,null));};exports[_0x6436('0x61')]=function(_0x2030f6,_0x40cc66){return db[_0x6436('0x47')][_0x6436('0x61')](_0x2030f6[_0x6436('0x62')],{})[_0x6436('0x3c')](function(_0x189aef){var _0x24c65d=_0x2030f6['user']['get']({'plain':!![]});if(!_0x24c65d)throw new Error(_0x6436('0x63'));if(_0x24c65d['role']===_0x6436('0x64')){var _0x222c70=_0x189aef[_0x6436('0x3e')]({'plain':!![]});var _0x408b5c=_0x6436('0x3f');return db[_0x6436('0x65')][_0x6436('0x66')]({'where':{'name':_0x408b5c,'userProfileId':_0x24c65d[_0x6436('0x67')]},'raw':!![]})[_0x6436('0x3c')](function(_0x457e66){if(_0x457e66&&_0x457e66['autoAssociation']===0x0){return db[_0x6436('0x40')]['create']({'name':_0x222c70['name'],'resourceId':_0x222c70['id'],'type':_0x457e66[_0x6436('0x42')],'sectionId':_0x457e66['id']},{})[_0x6436('0x3c')](function(){return _0x189aef;});}else{return _0x189aef;}})['catch'](function(_0xa71375){logger[_0x6436('0x2d')](_0x6436('0x68'),_0xa71375);throw _0xa71375;});}return _0x189aef;})[_0x6436('0x3c')](respondWithResult(_0x40cc66,0xc9))[_0x6436('0x30')](handleError(_0x40cc66,null));};exports[_0x6436('0x69')]=function(_0x2fc06d,_0x55b44a){if(_0x2fc06d[_0x6436('0x62')]['id']){delete _0x2fc06d['body']['id'];}return db[_0x6436('0x47')][_0x6436('0x66')]({'where':{'id':_0x2fc06d['params']['id']},'include':[{'model':db[_0x6436('0x6a')],'as':_0x6436('0x45')}]})['then'](handleEntityNotFound(_0x55b44a,null))['then'](saveUpdates(_0x2fc06d[_0x6436('0x62')],null))[_0x6436('0x3c')](respondWithResult(_0x55b44a,null))[_0x6436('0x30')](handleError(_0x55b44a,null));};exports[_0x6436('0x3d')]=function(_0x1eba1b,_0x4d5600){return db[_0x6436('0x47')]['find']({'where':{'id':_0x1eba1b[_0x6436('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4d5600,null))[_0x6436('0x3c')](removeEntity(_0x4d5600,null))[_0x6436('0x30')](handleError(_0x4d5600,null));};exports[_0x6436('0x6b')]=function(_0x38e0f9,_0x493177){return db[_0x6436('0x47')]['describe']()[_0x6436('0x3c')](respondWithResult(_0x493177,null))[_0x6436('0x30')](handleError(_0x493177,null));};exports['addDisposition']=function(_0x280005,_0x1422ab,_0x597a46){if(_0x280005[_0x6436('0x62')]['id']){delete _0x280005['body']['id'];}return db[_0x6436('0x47')][_0x6436('0x66')]({'where':{'id':_0x280005[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x1422ab,null))[_0x6436('0x3c')](function(_0x5adfdb){if(_0x5adfdb){_0x280005[_0x6436('0x62')][_0x6436('0x6c')]=_0x5adfdb['id'];return db[_0x6436('0x6d')][_0x6436('0x61')](_0x280005[_0x6436('0x62')]);}})[_0x6436('0x3c')](respondWithResult(_0x1422ab,null))['catch'](handleError(_0x1422ab,null));};exports[_0x6436('0x6e')]=function(_0x26dd7f,_0x1b0f91,_0x4cd4b1){var _0x3dc43e={'raw':![],'where':{}};var _0x3acb45={};var _0x609afd={'count':0x0,'rows':[]};return db[_0x6436('0x47')][_0x6436('0x6f')]({'where':{'id':_0x26dd7f['params']['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x1b0f91,null))[_0x6436('0x3c')](function(_0x8aaa28){if(_0x8aaa28){_0x3acb45[_0x6436('0x4a')]=_[_0x6436('0x5f')](db[_0x6436('0x6d')][_0x6436('0x70')]);_0x3acb45[_0x6436('0x4b')]=_[_0x6436('0x5f')](_0x26dd7f[_0x6436('0x4b')]);_0x3acb45[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x3acb45['model'],_0x3acb45[_0x6436('0x4b')]);_0x3dc43e['attributes']=_[_0x6436('0x4e')](_0x3acb45[_0x6436('0x4a')],qs[_0x6436('0x4f')](_0x26dd7f['query']['fields']));_0x3dc43e[_0x6436('0x4d')]=_0x3dc43e['attributes'][_0x6436('0x71')]?_0x3dc43e['attributes']:_0x3acb45['model'];if(!_0x26dd7f[_0x6436('0x4b')]['hasOwnProperty']('nolimit')){_0x3dc43e[_0x6436('0x36')]=qs[_0x6436('0x36')](_0x26dd7f[_0x6436('0x4b')][_0x6436('0x36')]);_0x3dc43e[_0x6436('0x35')]=qs[_0x6436('0x35')](_0x26dd7f['query']['offset']);}_0x3dc43e[_0x6436('0x51')]=qs[_0x6436('0x52')](_0x26dd7f[_0x6436('0x4b')][_0x6436('0x52')]);_0x3dc43e['where']=qs['filters'](_['pick'](_0x26dd7f[_0x6436('0x4b')],_0x3acb45[_0x6436('0x4c')]));_0x3dc43e[_0x6436('0x53')]['FaxAccountId']=_0x8aaa28['id'];if(_0x26dd7f['query'][_0x6436('0x55')]){_0x3dc43e['where']=_[_0x6436('0x72')](_0x3dc43e[_0x6436('0x53')],{'$or':_[_0x6436('0x46')](_0x3dc43e[_0x6436('0x4d')],function(_0x34754f){var _0x177a65={};_0x177a65[_0x34754f]={'$like':'%'+_0x26dd7f[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x177a65;})});}_0x3dc43e=_[_0x6436('0x72')]({},_0x3dc43e,_0x26dd7f[_0x6436('0x60')]);return db['Disposition'][_0x6436('0x58')]({'where':_0x3dc43e[_0x6436('0x53')]})[_0x6436('0x3c')](function(_0x12d7ca){_0x609afd[_0x6436('0x58')]=_0x12d7ca;if(_0x26dd7f[_0x6436('0x4b')][_0x6436('0x59')]){_0x3dc43e['include']=[{'all':!![]}];}return db[_0x6436('0x6d')][_0x6436('0x5b')](_0x3dc43e);})[_0x6436('0x3c')](function(_0x1c8c20){_0x609afd['rows']=_0x1c8c20;return _0x609afd;});}})['then'](respondWithFilteredResult(_0x1b0f91,_0x3dc43e))[_0x6436('0x30')](handleError(_0x1b0f91,null));};exports['removeDispositions']=function(_0x1bcbf0,_0xa8f214,_0x559944){return db[_0x6436('0x47')][_0x6436('0x66')]({'where':{'id':_0x1bcbf0['params']['id']}})['then'](handleEntityNotFound(_0xa8f214,null))[_0x6436('0x3c')](function(_0xbfd48d){if(_0xbfd48d){return _0xbfd48d[_0x6436('0x73')](_0x1bcbf0[_0x6436('0x4b')][_0x6436('0x74')]);}})['then'](respondWithStatusCode(_0xa8f214,null))[_0x6436('0x30')](handleError(_0xa8f214,null));};exports[_0x6436('0x75')]=function(_0x57df62,_0x30f9f9,_0xf10113){if(_0x57df62[_0x6436('0x62')]['id']){delete _0x57df62[_0x6436('0x62')]['id'];}return db['FaxAccount'][_0x6436('0x66')]({'where':{'id':_0x57df62[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x30f9f9,null))[_0x6436('0x3c')](function(_0x17c946){if(_0x17c946){_0x57df62[_0x6436('0x62')][_0x6436('0x6c')]=_0x17c946['id'];return db[_0x6436('0x76')]['create'](_0x57df62[_0x6436('0x62')]);}})['then'](respondWithResult(_0x30f9f9,null))[_0x6436('0x30')](handleError(_0x30f9f9,null));};exports[_0x6436('0x77')]=function(_0x2e6565,_0x5a0279,_0x20f822){var _0x1313e0={'raw':![],'where':{}};var _0x2a5adb={};var _0x25e962={'count':0x0,'rows':[]};return db[_0x6436('0x47')][_0x6436('0x6f')]({'where':{'id':_0x2e6565['params']['id']}})['then'](handleEntityNotFound(_0x5a0279,null))[_0x6436('0x3c')](function(_0x2e9781){if(_0x2e9781){_0x2a5adb[_0x6436('0x4a')]=_[_0x6436('0x5f')](db[_0x6436('0x76')]['rawAttributes']);_0x2a5adb['query']=_['keys'](_0x2e6565['query']);_0x2a5adb[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x2a5adb[_0x6436('0x4a')],_0x2a5adb[_0x6436('0x4b')]);_0x1313e0[_0x6436('0x4d')]=_[_0x6436('0x4e')](_0x2a5adb[_0x6436('0x4a')],qs[_0x6436('0x4f')](_0x2e6565['query'][_0x6436('0x4f')]));_0x1313e0[_0x6436('0x4d')]=_0x1313e0['attributes'][_0x6436('0x71')]?_0x1313e0['attributes']:_0x2a5adb['model'];if(!_0x2e6565[_0x6436('0x4b')][_0x6436('0x78')]('nolimit')){_0x1313e0['limit']=qs['limit'](_0x2e6565[_0x6436('0x4b')][_0x6436('0x36')]);_0x1313e0[_0x6436('0x35')]=qs['offset'](_0x2e6565[_0x6436('0x4b')][_0x6436('0x35')]);}_0x1313e0[_0x6436('0x51')]=qs[_0x6436('0x52')](_0x2e6565['query']['sort']);_0x1313e0[_0x6436('0x53')]=qs[_0x6436('0x4c')](_[_0x6436('0x54')](_0x2e6565['query'],_0x2a5adb[_0x6436('0x4c')]));_0x1313e0[_0x6436('0x53')]['FaxAccountId']=_0x2e9781['id'];if(_0x2e6565['query'][_0x6436('0x55')]){_0x1313e0[_0x6436('0x53')]=_[_0x6436('0x72')](_0x1313e0[_0x6436('0x53')],{'$or':_[_0x6436('0x46')](_0x1313e0[_0x6436('0x4d')],function(_0x844b86){var _0x5e216b={};_0x5e216b[_0x844b86]={'$like':'%'+_0x2e6565[_0x6436('0x4b')]['filter']+'%'};return _0x5e216b;})});}_0x1313e0=_[_0x6436('0x72')]({},_0x1313e0,_0x2e6565[_0x6436('0x60')]);return db['CannedAnswer'][_0x6436('0x58')]({'where':_0x1313e0['where']})['then'](function(_0x14942d){_0x25e962['count']=_0x14942d;if(_0x2e6565[_0x6436('0x4b')][_0x6436('0x59')]){_0x1313e0[_0x6436('0x5a')]=[{'all':!![]}];}return db[_0x6436('0x76')]['findAll'](_0x1313e0);})[_0x6436('0x3c')](function(_0x92703b){_0x25e962[_0x6436('0x5c')]=_0x92703b;return _0x25e962;});}})[_0x6436('0x3c')](respondWithFilteredResult(_0x5a0279,_0x1313e0))[_0x6436('0x30')](handleError(_0x5a0279,null));};exports[_0x6436('0x79')]=function(_0x2800ff,_0x573a70,_0x286272){return db[_0x6436('0x47')][_0x6436('0x66')]({'where':{'id':_0x2800ff['params']['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x573a70,null))[_0x6436('0x3c')](function(_0x4a4a55){if(_0x4a4a55){return _0x4a4a55['removeAnswers'](_0x2800ff[_0x6436('0x4b')][_0x6436('0x74')]);}})[_0x6436('0x3c')](respondWithStatusCode(_0x573a70,null))[_0x6436('0x30')](handleError(_0x573a70,null));};exports[_0x6436('0x7a')]=function(_0x9791aa,_0x3d93db,_0x1c39cd){return db[_0x6436('0x7b')][_0x6436('0x66')]({'where':{'id':_0x9791aa[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x3d93db,null))[_0x6436('0x3c')](function(_0x1013ef){if(_0x1013ef){return _0x1013ef['addInteraction'](_0x9791aa[_0x6436('0x62')][_0x6436('0x74')],_['omit'](_0x9791aa['body'],['ids','id'])||{});}})[_0x6436('0x3c')](respondWithResult(_0x3d93db,null))[_0x6436('0x30')](handleError(_0x3d93db,null));};exports[_0x6436('0x7c')]=function(_0x4a3357,_0x2c4b1a,_0x4cd88b){var _0x3a910c={'raw':![],'where':{}};var _0x29ecb8={};var _0x228623={'count':0x0,'rows':[]};return db[_0x6436('0x47')][_0x6436('0x6f')]({'where':{'id':_0x4a3357[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x2c4b1a,null))[_0x6436('0x3c')](function(_0x3bdf4c){if(_0x3bdf4c){_0x29ecb8['model']=_['keys'](db[_0x6436('0x7b')]['rawAttributes']);_0x29ecb8[_0x6436('0x4b')]=_[_0x6436('0x5f')](_0x4a3357[_0x6436('0x4b')]);_0x29ecb8[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x29ecb8[_0x6436('0x4a')],_0x29ecb8[_0x6436('0x4b')]);_0x3a910c['attributes']=_[_0x6436('0x4e')](_0x29ecb8['model'],qs[_0x6436('0x4f')](_0x4a3357[_0x6436('0x4b')][_0x6436('0x4f')]));_0x3a910c['attributes']=_0x3a910c[_0x6436('0x4d')][_0x6436('0x71')]?_0x3a910c[_0x6436('0x4d')]:_0x29ecb8[_0x6436('0x4a')];if(!_0x4a3357[_0x6436('0x4b')]['hasOwnProperty'](_0x6436('0x50'))){_0x3a910c['limit']=qs[_0x6436('0x36')](_0x4a3357['query'][_0x6436('0x36')]);_0x3a910c[_0x6436('0x35')]=qs['offset'](_0x4a3357[_0x6436('0x4b')]['offset']);}_0x3a910c[_0x6436('0x51')]=qs['sort'](_0x4a3357[_0x6436('0x4b')][_0x6436('0x52')]);_0x3a910c[_0x6436('0x53')]=qs[_0x6436('0x4c')](_['pick'](_0x4a3357[_0x6436('0x4b')],_0x29ecb8[_0x6436('0x4c')]));_0x3a910c[_0x6436('0x53')]['FaxAccountId']=_0x3bdf4c['id'];if(_0x4a3357[_0x6436('0x4b')][_0x6436('0x55')]){_0x3a910c[_0x6436('0x53')]=_['merge'](_0x3a910c['where'],{'$or':_[_0x6436('0x46')](_0x3a910c['attributes'],function(_0x46d90f){var _0x3b5ac5={};_0x3b5ac5[_0x46d90f]={'$like':'%'+_0x4a3357[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x3b5ac5;})});}_0x3a910c=_[_0x6436('0x72')]({},_0x3a910c,_0x4a3357[_0x6436('0x60')]);return db[_0x6436('0x7b')][_0x6436('0x58')]({'where':_0x3a910c[_0x6436('0x53')]})[_0x6436('0x3c')](function(_0x1a3329){_0x228623[_0x6436('0x58')]=_0x1a3329;if(_0x4a3357[_0x6436('0x4b')][_0x6436('0x59')]){_0x3a910c[_0x6436('0x5a')]=[{'model':db[_0x6436('0x7d')],'as':'Contact','required':![]},{'model':db[_0x6436('0x7e')],'as':'Owner','attributes':[_0x6436('0x42'),_0x6436('0x7f'),_0x6436('0x80')],'required':![]},{'model':db[_0x6436('0x81')],'as':_0x6436('0x82'),'attributes':['id',_0x6436('0x42'),_0x6436('0x83')],'where':_0x4a3357[_0x6436('0x4b')]['tag']?{'id':_0x4a3357[_0x6436('0x4b')]['tag']}:undefined,'required':_0x4a3357[_0x6436('0x4b')][_0x6436('0x84')]?!![]:![]}];}return db[_0x6436('0x7b')][_0x6436('0x5b')](_0x3a910c);})[_0x6436('0x3c')](function(_0x51e03f){_0x228623[_0x6436('0x5c')]=_0x51e03f;return _0x228623;});}})[_0x6436('0x3c')](respondWithFilteredResult(_0x2c4b1a,_0x3a910c))[_0x6436('0x30')](handleError(_0x2c4b1a,null));};exports[_0x6436('0x85')]=function(_0x134793,_0x11c632,_0x26cf50){return db['FaxAccount'][_0x6436('0x6f')]({'where':{'id':_0x134793[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x11c632,null))[_0x6436('0x3c')](function(_0x28ba6a){if(_0x28ba6a){return db[_0x6436('0x86')]['transaction'](function(_0x44ac63){return db[_0x6436('0x87')][_0x6436('0x3d')]({'where':{'FaxAccountId':_0x134793[_0x6436('0x5e')]['id']},'transaction':_0x44ac63})[_0x6436('0x3c')](function(_0xcdd93d){var _0xfe4908=_['map'](_0x134793['body'],function(_0xcb2720){_0xcb2720[_0x6436('0x6c')]=_0x134793[_0x6436('0x5e')]['id'];return _0xcb2720;});return db[_0x6436('0x87')][_0x6436('0x88')](_0xfe4908,{'transaction':_0x44ac63});});})[_0x6436('0x3c')](function(){return db[_0x6436('0x87')]['findAndCountAll']({'where':{'FaxAccountId':_0x134793[_0x6436('0x5e')]['id']},'order':'priority'});});}})[_0x6436('0x3c')](respondWithResult(_0x11c632,null))[_0x6436('0x30')](handleError(_0x11c632,null));};exports[_0x6436('0x89')]=function(_0x1a1066,_0x17b68a,_0x19b85a){var _0x4f5d28={};var _0x33b18c={};var _0xc99997;var _0x286af4;return db[_0x6436('0x47')][_0x6436('0x6f')]({'where':{'id':_0x1a1066[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x17b68a,null))['then'](function(_0x4ddf1d){if(_0x4ddf1d){_0xc99997=_0x4ddf1d;_0x33b18c[_0x6436('0x4a')]=_['keys'](db[_0x6436('0x87')][_0x6436('0x70')]);_0x33b18c[_0x6436('0x4b')]=_[_0x6436('0x5f')](_0x1a1066[_0x6436('0x4b')]);_0x33b18c[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x33b18c[_0x6436('0x4a')],_0x33b18c[_0x6436('0x4b')]);_0x4f5d28['attributes']=_['intersection'](_0x33b18c[_0x6436('0x4a')],qs[_0x6436('0x4f')](_0x1a1066[_0x6436('0x4b')]['fields']));_0x4f5d28['attributes']=_0x4f5d28[_0x6436('0x4d')][_0x6436('0x71')]?_0x4f5d28[_0x6436('0x4d')]:_0x33b18c[_0x6436('0x4a')];_0x4f5d28[_0x6436('0x51')]=qs[_0x6436('0x52')](_0x1a1066[_0x6436('0x4b')][_0x6436('0x52')]);_0x4f5d28[_0x6436('0x53')]=qs[_0x6436('0x4c')](_[_0x6436('0x54')](_0x1a1066[_0x6436('0x4b')],_0x33b18c[_0x6436('0x4c')]));if(_0x1a1066[_0x6436('0x4b')][_0x6436('0x55')]){_0x4f5d28[_0x6436('0x53')]=_[_0x6436('0x72')](_0x4f5d28[_0x6436('0x53')],{'$or':_['map'](_0x4f5d28[_0x6436('0x4d')],function(_0x5a98b2){var _0x405ae5={};_0x405ae5[_0x5a98b2]={'$like':'%'+_0x1a1066[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x405ae5;})});}_0x4f5d28=_[_0x6436('0x72')]({},_0x4f5d28,_0x1a1066[_0x6436('0x60')]);return _0xc99997[_0x6436('0x89')](_0x4f5d28);}})['then'](function(_0x582de5){if(_0x582de5){_0x286af4=_0x582de5[_0x6436('0x71')];if(!_0x1a1066['query'][_0x6436('0x78')](_0x6436('0x50'))){_0x4f5d28[_0x6436('0x36')]=qs[_0x6436('0x36')](_0x1a1066['query']['limit']);_0x4f5d28[_0x6436('0x35')]=qs[_0x6436('0x35')](_0x1a1066[_0x6436('0x4b')][_0x6436('0x35')]);}return _0xc99997['getApplications'](_0x4f5d28);}})[_0x6436('0x3c')](function(_0x3340a7){if(_0x3340a7){return _0x3340a7?{'count':_0x286af4,'rows':_0x3340a7}:null;}})[_0x6436('0x3c')](respondWithResult(_0x17b68a,null))['catch'](handleError(_0x17b68a,null));};function Extension(_0x2de3f6,_0x13ed17,_0x48cffe,_0x58671f){this[_0x6436('0x8a')]=_0x6436('0x8b');this[_0x6436('0x8c')]=_0x2de3f6[_0x6436('0x8d')];this[_0x6436('0x8e')]=_0x58671f;this[_0x6436('0x56')]=_0x6436('0x8f');this[_0x6436('0x90')]=_0x6436('0x91');this[_0x6436('0x6c')]=_0x2de3f6['id'];this[_0x6436('0x92')]=_0x13ed17;this[_0x6436('0x93')]=_0x48cffe;}function createExtensionsReciveFax(_0x29194a){var _0x22cc8c=0x1;var _0x32c9b6=[];_0x32c9b6[_0x6436('0x94')](new Extension(_0x29194a,_0x22cc8c,'',_0x6436('0x95')));_0x22cc8c+=0x1;_0x32c9b6[_0x6436('0x94')](new Extension(_0x29194a,_0x22cc8c,'CDR(type)=inbound-fax',_0x6436('0x96')));_0x22cc8c+=0x1;for(var _0x3b61bd in _0x29194a){if(_0x29194a[_0x6436('0x78')](_0x3b61bd)&&(_0x3b61bd===_0x6436('0x97')||_0x3b61bd===_0x6436('0x8d')||_0x3b61bd===_0x6436('0x98')||_0x3b61bd==='faxdetect'||_0x3b61bd===_0x6436('0x99')||_0x3b61bd===_0x6436('0x9a')||_0x3b61bd===_0x6436('0x9b')||_0x3b61bd===_0x6436('0x9c')||_0x3b61bd===_0x6436('0x9d'))){_0x32c9b6[_0x6436('0x94')](new Extension(_0x29194a,_0x22cc8c,_0x6436('0x9e')+_0x3b61bd+')='+_0x29194a[_0x3b61bd],'Set'));_0x22cc8c+=0x1;}}_0x32c9b6[_0x6436('0x94')](new Extension(_0x29194a,_0x22cc8c,'6',_0x6436('0x9f')));_0x22cc8c+=0x1;_0x32c9b6[_0x6436('0x94')](new Extension(_0x29194a,_0x22cc8c,_0x6436('0xa0'),_0x6436('0xa1')));_0x22cc8c=0x0;return _0x32c9b6;}exports[_0x6436('0xa2')]=function(_0x215de6,_0x32be02,_0x39917e){var _0x336dd0;return db[_0x6436('0x86')][_0x6436('0xa3')](function(_0x1ec8c5){return db[_0x6436('0x47')]['create'](_0x215de6[_0x6436('0x62')],{'transaction':_0x1ec8c5})['then'](function(_0x1b4f40){_0x336dd0=_0x1b4f40['get']({'plain':!![]});return db[_0x6436('0xa4')][_0x6436('0x88')](createExtensionsReciveFax(_0x336dd0),{'transaction':_0x1ec8c5});});})[_0x6436('0x3c')](function(){return _0x336dd0;})[_0x6436('0x3c')](respondWithResult(_0x32be02,null))[_0x6436('0x30')](handleError(_0x32be02,null));};exports[_0x6436('0xa5')]=function(_0x31d01a,_0x3219be,_0x2d7134){var _0x3dc34e;return db[_0x6436('0x86')]['transaction'](function(_0xc56c2a){return db[_0x6436('0x47')][_0x6436('0x69')](_0x31d01a[_0x6436('0x62')],{'where':{'id':_0x31d01a[_0x6436('0x62')]['id']},'transaction':_0xc56c2a})[_0x6436('0x3c')](function(_0x403529){return db[_0x6436('0xa4')][_0x6436('0x3d')]({'where':{'FaxAccountId':_0x31d01a['body']['id']},'transaction':_0xc56c2a})[_0x6436('0x3c')](function(_0x3afc84){return db[_0x6436('0xa4')]['bulkCreate'](createExtensionsReciveFax(_[_0x6436('0xa6')](_0x31d01a[_0x6436('0x62')],['tech',_0x6436('0x49'),_0x6436('0xa7'),_0x6436('0xa8'),'TrunkId',_0x6436('0xa9')])),{'transaction':_0xc56c2a});});});})[_0x6436('0x3c')](function(){return db['FaxAccount']['findById'](_0x31d01a[_0x6436('0x62')]['id']);})[_0x6436('0x3c')](respondWithResult(_0x3219be,null))['catch'](handleError(_0x3219be,null));};exports[_0x6436('0xaa')]=function(_0x254f8a,_0x54fe20,_0x3d9d6b){var _0xf461bb={'raw':!![],'where':{}};var _0x460951={};var _0x4fac67={'count':0x0,'rows':[]};return db[_0x6436('0x47')][_0x6436('0x6f')]({'where':{'id':_0x254f8a[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x54fe20,null))[_0x6436('0x3c')](function(_0x2b807b){if(_0x2b807b){_0x460951['model']=_['keys'](db[_0x6436('0xab')]['rawAttributes']);_0x460951[_0x6436('0x4b')]=_[_0x6436('0x5f')](_0x254f8a[_0x6436('0x4b')]);_0x460951[_0x6436('0x4c')]=_[_0x6436('0x4e')](_0x460951[_0x6436('0x4a')],_0x460951['query']);_0xf461bb[_0x6436('0x4d')]=_[_0x6436('0x4e')](_0x460951[_0x6436('0x4a')],qs['fields'](_0x254f8a[_0x6436('0x4b')]['fields']));_0xf461bb[_0x6436('0x4d')]=_0xf461bb[_0x6436('0x4d')]['length']?_0xf461bb['attributes']:_0x460951['model'];if(!_0x254f8a[_0x6436('0x4b')][_0x6436('0x78')](_0x6436('0x50'))){_0xf461bb[_0x6436('0x36')]=qs[_0x6436('0x36')](_0x254f8a[_0x6436('0x4b')]['limit']);_0xf461bb[_0x6436('0x35')]=qs[_0x6436('0x35')](_0x254f8a[_0x6436('0x4b')][_0x6436('0x35')]);}_0xf461bb[_0x6436('0x51')]=qs['sort'](_0x254f8a[_0x6436('0x4b')]['sort']);_0xf461bb[_0x6436('0x53')]=qs[_0x6436('0x4c')](_[_0x6436('0x54')](_0x254f8a[_0x6436('0x4b')],_0x460951[_0x6436('0x4c')]));_0xf461bb['where'][_0x6436('0x6c')]=_0x2b807b['id'];if(_0x254f8a[_0x6436('0x4b')]['filter']){_0xf461bb[_0x6436('0x53')]=_[_0x6436('0x72')](_0xf461bb[_0x6436('0x53')],{'$or':_[_0x6436('0x46')](_0xf461bb[_0x6436('0x4d')],function(_0x5b245a){var _0x90e7f={};_0x90e7f[_0x5b245a]={'$like':'%'+_0x254f8a[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x90e7f;})});}if(_0x254f8a[_0x6436('0x4b')][_0x6436('0xac')]){var _0x18fb7a=_0x254f8a[_0x6436('0x4b')]['$gte'][_0x6436('0xad')](',');var _0x440830={};_0x440830[_0x18fb7a[0x0]]={'$gte':moment(_0x18fb7a[0x1])[_0x6436('0xae')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf461bb['where']=_['merge'](_0xf461bb[_0x6436('0x53')],_0x440830);}_0xf461bb=_[_0x6436('0x72')]({},_0xf461bb,_0x254f8a['options']);return db[_0x6436('0xab')][_0x6436('0x58')]({'where':_0xf461bb['where']})['then'](function(_0x281fe2){_0x4fac67[_0x6436('0x58')]=_0x281fe2;if(_0x254f8a[_0x6436('0x4b')]['includeAll']){_0xf461bb[_0x6436('0x5a')]=[{'all':!![]}];}return db[_0x6436('0xab')][_0x6436('0x5b')](_0xf461bb);})[_0x6436('0x3c')](function(_0x266f3a){_0x4fac67['rows']=_0x266f3a;return _0x4fac67;});}})[_0x6436('0x3c')](respondWithFilteredResult(_0x54fe20,_0xf461bb))['catch'](handleError(_0x54fe20,null));};exports[_0x6436('0x43')]=function(_0x342209,_0x3a1e0f,_0x6c40c9){var _0x36f717,_0x766529={},_0x4af47b;if(_0x342209['body']['to']){_0x4af47b=_0x342209[_0x6436('0x62')]['to'][0x0];}return db[_0x6436('0x47')][_0x6436('0x66')]({'where':{'id':_0x342209[_0x6436('0x5e')]['id']},'include':[{'model':db[_0x6436('0xaf')],'as':_0x6436('0xb0'),'include':[{'model':db['CmContact'],'as':_0x6436('0xb1'),'where':{'fax':_0x4af47b},'limit':0x1,'order':[[_0x6436('0xa8'),_0x6436('0xb2')]]}]}]})[_0x6436('0x3c')](handleEntityNotFound(_0x3a1e0f,null))[_0x6436('0x3c')](function(_0x583936){_0x36f717=_0x583936;if(_0x342209['body']['attachments']&&_0x342209[_0x6436('0x62')]['attachments'][_0x6436('0x71')]){for(var _0x5cdc43=0x0;_0x5cdc43<_0x342209[_0x6436('0x62')][_0x6436('0xb3')][_0x6436('0x71')];_0x5cdc43+=0x1){_0x342209[_0x6436('0x62')][_0x6436('0xb3')][_0x5cdc43]={'filename':_0x342209[_0x6436('0x62')][_0x6436('0xb3')][_0x5cdc43]['name'],'id':_0x342209[_0x6436('0x62')]['attachments'][_0x5cdc43]['id'],'path':path[_0x6436('0xb4')](config[_0x6436('0xb5')],_0x6436('0xb6'),_0x342209['body'][_0x6436('0xb3')][_0x5cdc43][_0x6436('0xb7')])};}}return respondWithRpcPromise('CheckAfterSend',_0x6436('0xb8'),{'FaxAccountId':_['isNil'](_0x342209[_0x6436('0x5e')]['id'])?undefined:_0x342209[_0x6436('0x5e')]['id'],'path':_[_0x6436('0xb9')](_0x342209['body']['attachments'][0x0][_0x6436('0xba')])?undefined:_0x342209[_0x6436('0x62')][_0x6436('0xb3')][0x0][_0x6436('0xba')],'fax':_[_0x6436('0xb9')](_0x342209['body']['to'][0x0])?undefined:_0x342209[_0x6436('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x36f717){if(_['isNil'](_0x342209['body']['from'])){_0x342209[_0x6436('0x62')][_0x6436('0xbb')]=util[_0x6436('0xae')](_0x6436('0xbc'),_0x36f717['name'],_0x36f717['fax']);}if(_0x36f717['List']){if(_0x36f717['List'][_0x6436('0xb1')][_0x6436('0x71')]){return _0x36f717[_0x6436('0xb0')]['Contacts'][0x0];}else{return db[_0x6436('0x7d')][_0x6436('0x61')](_[_0x6436('0x1c')](_0x342209[_0x6436('0x62')],{'firstName':_0x342209[_0x6436('0x62')]['to'][0x0],'phone':_0x342209['body']['to'][0x0],'fax':_0x342209[_0x6436('0x62')]['to'][0x0],'ListId':_0x36f717[_0x6436('0xa9')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6436('0xbd'));}})[_0x6436('0x3c')](function(_0x543d42){if(_0x543d42){return db[_0x6436('0x7b')][_0x6436('0x66')]({'where':{'ContactId':_0x543d42['id'],'closed':![],'FaxAccountId':_0x36f717['id']}})[_0x6436('0x3c')](function(_0x57aec2){if(_0x57aec2){return[_0x57aec2,![]];}return db[_0x6436('0x7b')]['create']({'UserId':_0x342209[_0x6436('0x64')]['id'],'ContactId':_0x543d42['id'],'FaxAccountId':_0x36f717['id'],'fax':_0x342209[_0x6436('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x6436('0x72')](_0x342209[_0x6436('0x62')],{'read':![],'body':_0x342209[_0x6436('0x62')]['attachments'][0x0][_0x6436('0xbe')],'FaxAccountId':_0x36f717['id'],'UserId':_0x342209[_0x6436('0x64')]['id'],'ContactId':_0x543d42['id'],'AttachmentId':_0x342209[_0x6436('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x6436('0xab')],'as':_0x6436('0xbf')}]})['then'](function(_0xf1bd55){return[_0xf1bd55,!![]];});});}else{throw new Error(_0x6436('0xc0'));}})[_0x6436('0xc1')](function(_0x21ee06,_0x19e99e){if(_0x19e99e){return _0x21ee06;}return db[_0x6436('0xab')][_0x6436('0x61')]({'direction':_0x6436('0xc2'),'read':![],'body':_0x342209[_0x6436('0x62')][_0x6436('0xb3')][0x0][_0x6436('0xbe')],'FaxAccountId':_0x36f717['id'],'FaxInteractionId':_0x21ee06['id'],'UserId':_0x342209[_0x6436('0x64')]['id'],'ContactId':_0x21ee06[_0x6436('0xc3')],'AttachmentId':_0x342209['body'][_0x6436('0xb3')][0x0]['id']})[_0x6436('0x3c')](function(_0x50e23e){_0x21ee06[_0x6436('0xc4')][_0x6436('0xbf')]=[];_0x21ee06[_0x6436('0xc4')]['Messages'][_0x6436('0x94')](_0x50e23e[_0x6436('0xc4')]);return _0x21ee06;});})[_0x6436('0x3c')](function(_0x1e1437){respondWithRpcPromise(_0x6436('0xc5'),_0x6436('0xc5'),{'FaxAccountId':_[_0x6436('0xb9')](_0x342209[_0x6436('0x5e')]['id'])?undefined:_0x342209[_0x6436('0x5e')]['id'],'path':_[_0x6436('0xb9')](_0x342209[_0x6436('0x62')][_0x6436('0xb3')][0x0][_0x6436('0xba')])?undefined:_0x342209['body'][_0x6436('0xb3')][0x0]['path'],'fax':_[_0x6436('0xb9')](_0x342209[_0x6436('0x62')]['to'][0x0])?undefined:_0x342209[_0x6436('0x62')]['to'][0x0],'AttachmentId':_0x342209[_0x6436('0x62')]['attachments'][0x0]['id']},client9002)['then'](function(_0x4efc3d){logger[_0x6436('0x27')](_0x6436('0xc6'),_0x4efc3d);})[_0x6436('0x30')](function(_0x1beaef){logger[_0x6436('0x27')](_0x6436('0xc6'),_0x1beaef);});return _0x1e1437;})[_0x6436('0x3c')](respondWithResult(_0x3a1e0f,null))[_0x6436('0x30')](handleError(_0x3a1e0f,null));};exports['addAgents']=function(_0x5ed0f2,_0x4c606a,_0x3a459b){return db['FaxAccount'][_0x6436('0x66')]({'where':{'id':_0x5ed0f2[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x4c606a,null))[_0x6436('0x3c')](function(_0x4efa5c){if(_0x4efa5c){return _0x4efa5c[_0x6436('0xc7')](_0x5ed0f2[_0x6436('0x62')][_0x6436('0x74')],_[_0x6436('0xa6')](_0x5ed0f2[_0x6436('0x62')],[_0x6436('0x74'),'id'])||{})[_0x6436('0xc1')](function(_0x152e9a){for(var _0x51d30e=0x0;_0x51d30e<_0x5ed0f2[_0x6436('0x62')][_0x6436('0x74')][_0x6436('0x71')];_0x51d30e+=0x1){socket['emit'](_0x6436('0xc8'),{'UserId':_0x5ed0f2[_0x6436('0x62')][_0x6436('0x74')][_0x51d30e],'FaxAccountId':_0x5ed0f2['params']['id']});}return _0x152e9a;});}})[_0x6436('0x3c')](respondWithResult(_0x4c606a,null))['catch'](handleError(_0x4c606a,null));};exports['removeAgents']=function(_0x4a4103,_0x5965e2,_0x1d5339){return db['FaxAccount']['find']({'where':{'id':_0x4a4103[_0x6436('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5965e2,null))[_0x6436('0x3c')](function(_0x5e7842){if(_0x5e7842){return _0x5e7842[_0x6436('0xc9')](_0x4a4103[_0x6436('0x4b')]['ids'])[_0x6436('0x3c')](function(){if(_['isArray'](_0x4a4103[_0x6436('0x4b')][_0x6436('0x74')])){for(var _0x21d537=0x0;_0x21d537<_0x4a4103['query']['ids']['length'];_0x21d537+=0x1){socket[_0x6436('0xca')]('userFaxAccount:remove',{'UserId':Number(_0x4a4103[_0x6436('0x4b')][_0x6436('0x74')][_0x21d537]),'FaxAccountId':Number(_0x4a4103[_0x6436('0x5e')]['id'])});}}else{socket[_0x6436('0xca')]('userFaxAccount:remove',{'UserId':Number(_0x4a4103[_0x6436('0x4b')][_0x6436('0x74')]),'FaxAccountId':Number(_0x4a4103['params']['id'])});}});}})[_0x6436('0x3c')](respondWithStatusCode(_0x5965e2,null))[_0x6436('0x30')](handleError(_0x5965e2,null));};exports[_0x6436('0xcb')]=function(_0x5a687b,_0x444c73,_0x1b89d4){var _0x407a51={};var _0x2adb9d={};var _0x4aa8ce;var _0xe70f34;return db[_0x6436('0x47')]['findOne']({'where':{'id':_0x5a687b[_0x6436('0x5e')]['id']}})[_0x6436('0x3c')](handleEntityNotFound(_0x444c73,null))[_0x6436('0x3c')](function(_0x39f81d){if(_0x39f81d){_0x4aa8ce=_0x39f81d;_0x2adb9d[_0x6436('0x4a')]=_['keys'](db['User']['rawAttributes']);_0x2adb9d[_0x6436('0x4b')]=_[_0x6436('0x5f')](_0x5a687b[_0x6436('0x4b')]);_0x2adb9d[_0x6436('0x4c')]=_['intersection'](_0x2adb9d[_0x6436('0x4a')],_0x2adb9d[_0x6436('0x4b')]);_0x407a51[_0x6436('0x4d')]=_['intersection'](_0x2adb9d[_0x6436('0x4a')],qs[_0x6436('0x4f')](_0x5a687b[_0x6436('0x4b')][_0x6436('0x4f')]));_0x407a51[_0x6436('0x4d')]=_0x407a51[_0x6436('0x4d')][_0x6436('0x71')]?_0x407a51['attributes']:_0x2adb9d[_0x6436('0x4a')];_0x407a51[_0x6436('0x51')]=qs['sort'](_0x5a687b[_0x6436('0x4b')][_0x6436('0x52')]);_0x407a51[_0x6436('0x53')]=qs['filters'](_[_0x6436('0x54')](_0x5a687b[_0x6436('0x4b')],_0x2adb9d['filters']));if(_0x5a687b[_0x6436('0x4b')]['filter']){_0x407a51[_0x6436('0x53')]=_[_0x6436('0x72')](_0x407a51[_0x6436('0x53')],{'$or':_['map'](_0x407a51[_0x6436('0x4d')],function(_0x2834ec){var _0x2bb7bb={};_0x2bb7bb[_0x2834ec]={'$like':'%'+_0x5a687b[_0x6436('0x4b')][_0x6436('0x55')]+'%'};return _0x2bb7bb;})});}_0x407a51=_[_0x6436('0x72')]({},_0x407a51,_0x5a687b[_0x6436('0x60')]);return _0x4aa8ce['getAgents'](_0x407a51);}})['then'](function(_0x242dbd){if(_0x242dbd){_0xe70f34=_0x242dbd[_0x6436('0x71')];if(!_0x5a687b['query'][_0x6436('0x78')](_0x6436('0x50'))){_0x407a51['limit']=qs[_0x6436('0x36')](_0x5a687b[_0x6436('0x4b')][_0x6436('0x36')]);_0x407a51['offset']=qs['offset'](_0x5a687b[_0x6436('0x4b')][_0x6436('0x35')]);}return _0x4aa8ce[_0x6436('0xcb')](_0x407a51);}})['then'](function(_0x364e92){if(_0x364e92){return _0x364e92?{'count':_0xe70f34,'rows':_0x364e92}:null;}})[_0x6436('0x3c')](respondWithResult(_0x444c73,null))[_0x6436('0x30')](handleError(_0x444c73,null));}; \ No newline at end of file +var _0xad65=['localstationid','app','system','description','Fax\x20Extension','priority','appdata','Answer','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','user','filename','Contact\x20not\x20found','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','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','jayson/promise','client','http','test','Sequelize','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','count','offset','Content-Range','save','update','get','FaxAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','rows','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','tag','addApplications','transaction','FaxApplication','findAndCountAll','getApplications','context','from-voip-provider','exten'];(function(_0xeb31d6,_0x36dda8){var _0x2f7189=function(_0x5dd436){while(--_0x5dd436){_0xeb31d6['push'](_0xeb31d6['shift']());}};_0x2f7189(++_0x36dda8);}(_0xad65,0x106));var _0x5ad6=function(_0x2a213b,_0x1adcd8){_0x2a213b=_0x2a213b-0x0;var _0x2bfc3b=_0xad65[_0x2a213b];return _0x2bfc3b;};'use strict';var pdf=require(_0x5ad6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ad6('0x1'));var zipdir=require(_0x5ad6('0x2'));var jsonpatch=require(_0x5ad6('0x3'));var rp=require(_0x5ad6('0x4'));var moment=require(_0x5ad6('0x5'));var BPromise=require(_0x5ad6('0x6'));var Mustache=require(_0x5ad6('0x7'));var util=require('util');var path=require(_0x5ad6('0x8'));var sox=require(_0x5ad6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ad6('0xa'));var squel=require('squel');var crypto=require(_0x5ad6('0xb'));var jsforce=require(_0x5ad6('0xc'));var deskjs=require(_0x5ad6('0xd'));var toCsv=require(_0x5ad6('0xe'));var querystring=require(_0x5ad6('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ad6('0x10'));var authService=require(_0x5ad6('0x11'));var qs=require(_0x5ad6('0x12'));var as=require(_0x5ad6('0x13'));var hardwareService=require(_0x5ad6('0x14'));var logger=require(_0x5ad6('0x15'))(_0x5ad6('0x16'));var utils=require(_0x5ad6('0x17'));var config=require('../../config/environment');var db=require(_0x5ad6('0x18'))['db'];config['redis']=_[_0x5ad6('0x19')](config[_0x5ad6('0x1a')],{'host':_0x5ad6('0x1b'),'port':0x18eb});var socket=require(_0x5ad6('0x1c'))(new Redis(config[_0x5ad6('0x1a')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x5ad6('0x1d'));var client=jayson[_0x5ad6('0x1e')][_0x5ad6('0x1f')]({'port':0x232c});var client9002=jayson[_0x5ad6('0x1e')][_0x5ad6('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x3ccb89,_0x347138,_0x1d2b9e){if(_0x1d2b9e){var _0x425715=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x425715[_0x5ad6('0x20')](_0x347138)){return _0x3ccb89;}else{throw new db[(_0x5ad6('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 _0x3ccb89;}}function respondWithRpcPromise(_0x5af9f7,_0x1421ec,_0x4bbf68,_0x3c3abb){return new BPromise(function(_0x3df2dd,_0x8b2adb){var _0x44cadd=_0x3c3abb||client;return _0x44cadd[_0x5ad6('0x22')](_0x5af9f7,_0x4bbf68)[_0x5ad6('0x23')](function(_0x1d58c5){logger[_0x5ad6('0x24')](_0x5ad6('0x25'),_0x1421ec,_0x5ad6('0x26'));logger[_0x5ad6('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1421ec,_0x5ad6('0x26'),JSON['stringify'](_0x1d58c5));if(_0x1d58c5[_0x5ad6('0x28')]){if(_0x1d58c5[_0x5ad6('0x28')][_0x5ad6('0x29')]===0x1f4){logger['error'](_0x5ad6('0x25'),_0x1421ec,_0x1d58c5[_0x5ad6('0x28')][_0x5ad6('0x2a')]);return _0x8b2adb(_0x1d58c5[_0x5ad6('0x28')][_0x5ad6('0x2a')]);}logger[_0x5ad6('0x28')]('FaxAccount,\x20%s,\x20%s',_0x1421ec,_0x1d58c5['error'][_0x5ad6('0x2a')]);return _0x3df2dd(_0x1d58c5['error'][_0x5ad6('0x2a')]);}else{logger['info'](_0x5ad6('0x25'),_0x1421ec,_0x5ad6('0x26'));_0x3df2dd(_0x1d58c5[_0x5ad6('0x2b')][_0x5ad6('0x2a')]);}})[_0x5ad6('0x2c')](function(_0x194bdc){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1421ec,_0x194bdc);_0x8b2adb(_0x194bdc);});});}function respondWithStatusCode(_0x3fac05,_0x3c6088){_0x3c6088=_0x3c6088||0xcc;return function(_0xd558f9){if(_0xd558f9){return _0x3fac05[_0x5ad6('0x2d')](_0x3c6088);}return _0x3fac05[_0x5ad6('0x2e')](_0x3c6088)[_0x5ad6('0x2f')]();};}function respondWithResult(_0x503447,_0x1d3cc5){_0x1d3cc5=_0x1d3cc5||0xc8;return function(_0x42f0ad){if(_0x42f0ad){return _0x503447[_0x5ad6('0x2e')](_0x1d3cc5)['json'](_0x42f0ad);}};}function respondWithFilteredResult(_0x4990b9,_0x154d8c){return function(_0x321d0f){if(_0x321d0f){var _0xd65088=_0x321d0f[_0x5ad6('0x30')],_0x35fa17=_0x154d8c[_0x5ad6('0x31')],_0x9d991b=_0x154d8c['offset']+_0x154d8c['limit'],_0x255421;if(_0x9d991b>=_0xd65088){_0x9d991b=_0xd65088;_0x255421=0xc8;}else{_0x255421=0xce;}_0x4990b9[_0x5ad6('0x2e')](_0x255421);return _0x4990b9['set'](_0x5ad6('0x32'),_0x35fa17+'-'+_0x9d991b+'/'+_0xd65088)['json'](_0x321d0f);}return null;};}function patchUpdates(_0x2613e0){return function(_0x190f33){try{jsonpatch['apply'](_0x190f33,_0x2613e0,!![]);}catch(_0x130d8d){return BPromise['reject'](_0x130d8d);}return _0x190f33[_0x5ad6('0x33')]();};}function saveUpdates(_0x3cc15a,_0x24f29c){return function(_0x4a5d46){if(_0x4a5d46){return _0x4a5d46[_0x5ad6('0x34')](_0x3cc15a)[_0x5ad6('0x23')](function(_0x5bdc05){return _0x5bdc05;});}return null;};}function removeEntity(_0x1eb6ee,_0x33898a){return function(_0x4a5fdb){if(_0x4a5fdb){return _0x4a5fdb['destroy']()[_0x5ad6('0x23')](function(){var _0x49c858=_0x4a5fdb[_0x5ad6('0x35')]({'plain':!![]});var _0x497b21=_0x5ad6('0x36');return db[_0x5ad6('0x37')][_0x5ad6('0x38')]({'where':{'type':_0x497b21,'resourceId':_0x49c858['id']}})[_0x5ad6('0x23')](function(){return _0x4a5fdb;});})[_0x5ad6('0x23')](function(){_0x1eb6ee[_0x5ad6('0x2e')](0xcc)[_0x5ad6('0x2f')]();});}};}function handleEntityNotFound(_0x31aa33,_0x5d9dff){return function(_0x2c2b1e){if(!_0x2c2b1e){_0x31aa33[_0x5ad6('0x2d')](0x194);}return _0x2c2b1e;};}function handleError(_0x29d3ee,_0x2be611){_0x2be611=_0x2be611||0x1f4;return function(_0x3b30d6){logger[_0x5ad6('0x28')](_0x3b30d6['stack']);if(_0x3b30d6['name']){delete _0x3b30d6[_0x5ad6('0x39')];}_0x29d3ee[_0x5ad6('0x2e')](_0x2be611)[_0x5ad6('0x3a')](_0x3b30d6);};}exports['index']=function(_0x138305,_0xfc23b6){var _0x3f6600={'include':[{'model':db[_0x5ad6('0x3b')],'as':_0x5ad6('0x3c')}]},_0x4acbc6={},_0x41da09={'count':0x0,'rows':[]};var _0x126ce0=_[_0x5ad6('0x3d')](db['FaxAccount'][_0x5ad6('0x3e')],function(_0x234b10){return{'name':_0x234b10[_0x5ad6('0x3f')],'type':_0x234b10[_0x5ad6('0x40')][_0x5ad6('0x41')]};});_0x4acbc6[_0x5ad6('0x42')]=_[_0x5ad6('0x3d')](_0x126ce0,_0x5ad6('0x39'));_0x4acbc6['query']=_[_0x5ad6('0x43')](_0x138305[_0x5ad6('0x44')]);_0x4acbc6['filters']=_[_0x5ad6('0x45')](_0x4acbc6['model'],_0x4acbc6[_0x5ad6('0x44')]);_0x3f6600['attributes']=_[_0x5ad6('0x45')](_0x4acbc6[_0x5ad6('0x42')],qs[_0x5ad6('0x46')](_0x138305[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x3f6600[_0x5ad6('0x47')]=_0x3f6600['attributes'][_0x5ad6('0x48')]?_0x3f6600[_0x5ad6('0x47')]:_0x4acbc6[_0x5ad6('0x42')];if(!_0x138305[_0x5ad6('0x44')][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x3f6600[_0x5ad6('0x4b')]=qs['limit'](_0x138305['query'][_0x5ad6('0x4b')]);_0x3f6600[_0x5ad6('0x31')]=qs['offset'](_0x138305[_0x5ad6('0x44')][_0x5ad6('0x31')]);}_0x3f6600['order']=qs[_0x5ad6('0x4c')](_0x138305[_0x5ad6('0x44')][_0x5ad6('0x4c')]);_0x3f6600[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x138305[_0x5ad6('0x44')],_0x4acbc6[_0x5ad6('0x4e')]),_0x126ce0);if(_0x138305[_0x5ad6('0x44')][_0x5ad6('0x50')]){_0x3f6600[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x3f6600[_0x5ad6('0x4d')],{'$or':_[_0x5ad6('0x3d')](_0x126ce0,function(_0x1044be){if(_0x1044be[_0x5ad6('0x40')]!==_0x5ad6('0x52')){var _0x37641d={};_0x37641d[_0x1044be['name']]={'$like':'%'+_0x138305[_0x5ad6('0x44')][_0x5ad6('0x50')]+'%'};return _0x37641d;}})});}_0x3f6600=_[_0x5ad6('0x51')]({},_0x3f6600,_0x138305['options']);var _0x9508ac={'where':_0x3f6600[_0x5ad6('0x4d')]};return db[_0x5ad6('0x53')]['count'](_0x9508ac)['then'](function(_0x477fbd){_0x41da09[_0x5ad6('0x30')]=_0x477fbd;if(_0x138305[_0x5ad6('0x44')][_0x5ad6('0x54')]){_0x3f6600[_0x5ad6('0x55')]=[{'all':!![]}];}return db[_0x5ad6('0x53')]['findAll'](_0x3f6600);})[_0x5ad6('0x23')](function(_0x32a110){_0x41da09[_0x5ad6('0x56')]=_0x32a110;return _0x41da09;})['then'](respondWithFilteredResult(_0xfc23b6,_0x3f6600))[_0x5ad6('0x2c')](handleError(_0xfc23b6,null));};exports[_0x5ad6('0x57')]=function(_0x5d1d73,_0xc1555d){var _0x578d39={'raw':![],'where':{'id':_0x5d1d73[_0x5ad6('0x58')]['id']},'include':[{'model':db[_0x5ad6('0x3b')],'as':_0x5ad6('0x3c')}]},_0x14a3f4={};_0x14a3f4[_0x5ad6('0x42')]=_[_0x5ad6('0x43')](db['FaxAccount'][_0x5ad6('0x3e')]);_0x14a3f4[_0x5ad6('0x44')]=_[_0x5ad6('0x43')](_0x5d1d73[_0x5ad6('0x44')]);_0x14a3f4[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x14a3f4[_0x5ad6('0x42')],_0x14a3f4[_0x5ad6('0x44')]);_0x578d39[_0x5ad6('0x47')]=_['intersection'](_0x14a3f4['model'],qs['fields'](_0x5d1d73[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x578d39[_0x5ad6('0x47')]=_0x578d39[_0x5ad6('0x47')]['length']?_0x578d39['attributes']:_0x14a3f4['model'];if(_0x5d1d73[_0x5ad6('0x44')][_0x5ad6('0x54')]){_0x578d39[_0x5ad6('0x55')]=[{'all':!![]}];}_0x578d39=_[_0x5ad6('0x51')]({},_0x578d39,_0x5d1d73[_0x5ad6('0x59')]);return db['FaxAccount'][_0x5ad6('0x5a')](_0x578d39)['then'](handleEntityNotFound(_0xc1555d,null))[_0x5ad6('0x23')](respondWithResult(_0xc1555d,null))['catch'](handleError(_0xc1555d,null));};exports[_0x5ad6('0x5b')]=function(_0x24574f,_0x1ebc93){return db[_0x5ad6('0x53')][_0x5ad6('0x5b')](_0x24574f['body'],{})['then'](function(_0x2371c9){var _0x3434b0=_0x24574f['user'][_0x5ad6('0x35')]({'plain':!![]});if(!_0x3434b0)throw new Error(_0x5ad6('0x5c'));if(_0x3434b0[_0x5ad6('0x5d')]==='user'){var _0x85779e=_0x2371c9[_0x5ad6('0x35')]({'plain':!![]});var _0x4c6ce2=_0x5ad6('0x36');return db[_0x5ad6('0x5e')][_0x5ad6('0x5a')]({'where':{'name':_0x4c6ce2,'userProfileId':_0x3434b0[_0x5ad6('0x5f')]},'raw':!![]})[_0x5ad6('0x23')](function(_0x2c0481){if(_0x2c0481&&_0x2c0481['autoAssociation']===0x0){return db[_0x5ad6('0x37')]['create']({'name':_0x85779e[_0x5ad6('0x39')],'resourceId':_0x85779e['id'],'type':_0x2c0481[_0x5ad6('0x39')],'sectionId':_0x2c0481['id']},{})[_0x5ad6('0x23')](function(){return _0x2371c9;});}else{return _0x2371c9;}})[_0x5ad6('0x2c')](function(_0x47085e){logger[_0x5ad6('0x28')](_0x5ad6('0x60'),_0x47085e);throw _0x47085e;});}return _0x2371c9;})[_0x5ad6('0x23')](respondWithResult(_0x1ebc93,0xc9))['catch'](handleError(_0x1ebc93,null));};exports[_0x5ad6('0x34')]=function(_0x5cad26,_0x428c7d){if(_0x5cad26[_0x5ad6('0x61')]['id']){delete _0x5cad26[_0x5ad6('0x61')]['id'];}return db[_0x5ad6('0x53')][_0x5ad6('0x5a')]({'where':{'id':_0x5cad26[_0x5ad6('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x5ad6('0x23')](handleEntityNotFound(_0x428c7d,null))['then'](saveUpdates(_0x5cad26[_0x5ad6('0x61')],null))[_0x5ad6('0x23')](respondWithResult(_0x428c7d,null))['catch'](handleError(_0x428c7d,null));};exports['destroy']=function(_0x81c173,_0x251a77){return db[_0x5ad6('0x53')][_0x5ad6('0x5a')]({'where':{'id':_0x81c173[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x251a77,null))[_0x5ad6('0x23')](removeEntity(_0x251a77,null))[_0x5ad6('0x2c')](handleError(_0x251a77,null));};exports[_0x5ad6('0x62')]=function(_0x2e2e26,_0x1c7d0e){return db[_0x5ad6('0x53')][_0x5ad6('0x62')]()[_0x5ad6('0x23')](respondWithResult(_0x1c7d0e,null))['catch'](handleError(_0x1c7d0e,null));};exports[_0x5ad6('0x63')]=function(_0x364ad6,_0x53b5e0,_0x41702d){if(_0x364ad6[_0x5ad6('0x61')]['id']){delete _0x364ad6[_0x5ad6('0x61')]['id'];}return db[_0x5ad6('0x53')][_0x5ad6('0x5a')]({'where':{'id':_0x364ad6[_0x5ad6('0x58')]['id']}})['then'](handleEntityNotFound(_0x53b5e0,null))['then'](function(_0x23a801){if(_0x23a801){_0x364ad6[_0x5ad6('0x61')]['FaxAccountId']=_0x23a801['id'];return db[_0x5ad6('0x64')][_0x5ad6('0x5b')](_0x364ad6['body']);}})[_0x5ad6('0x23')](respondWithResult(_0x53b5e0,null))['catch'](handleError(_0x53b5e0,null));};exports[_0x5ad6('0x65')]=function(_0x42361f,_0x5aca8f,_0x47e2a8){var _0x3fde03={'raw':![],'where':{}};var _0x159b55={};var _0x12cee6={'count':0x0,'rows':[]};return db[_0x5ad6('0x53')][_0x5ad6('0x66')]({'where':{'id':_0x42361f['params']['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x5aca8f,null))[_0x5ad6('0x23')](function(_0x404e7b){if(_0x404e7b){_0x159b55[_0x5ad6('0x42')]=_[_0x5ad6('0x43')](db[_0x5ad6('0x64')][_0x5ad6('0x3e')]);_0x159b55[_0x5ad6('0x44')]=_[_0x5ad6('0x43')](_0x42361f[_0x5ad6('0x44')]);_0x159b55[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x159b55['model'],_0x159b55['query']);_0x3fde03[_0x5ad6('0x47')]=_[_0x5ad6('0x45')](_0x159b55[_0x5ad6('0x42')],qs[_0x5ad6('0x46')](_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x3fde03[_0x5ad6('0x47')]=_0x3fde03[_0x5ad6('0x47')][_0x5ad6('0x48')]?_0x3fde03[_0x5ad6('0x47')]:_0x159b55[_0x5ad6('0x42')];if(!_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x3fde03['limit']=qs[_0x5ad6('0x4b')](_0x42361f[_0x5ad6('0x44')]['limit']);_0x3fde03['offset']=qs[_0x5ad6('0x31')](_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x31')]);}_0x3fde03[_0x5ad6('0x67')]=qs[_0x5ad6('0x4c')](_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x4c')]);_0x3fde03[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_['pick'](_0x42361f['query'],_0x159b55[_0x5ad6('0x4e')]));_0x3fde03[_0x5ad6('0x4d')]['FaxAccountId']=_0x404e7b['id'];if(_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x50')]){_0x3fde03[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x3fde03['where'],{'$or':_[_0x5ad6('0x3d')](_0x3fde03[_0x5ad6('0x47')],function(_0x56c168){var _0x2d739d={};_0x2d739d[_0x56c168]={'$like':'%'+_0x42361f[_0x5ad6('0x44')][_0x5ad6('0x50')]+'%'};return _0x2d739d;})});}_0x3fde03=_[_0x5ad6('0x51')]({},_0x3fde03,_0x42361f[_0x5ad6('0x59')]);return db[_0x5ad6('0x64')]['count']({'where':_0x3fde03[_0x5ad6('0x4d')]})[_0x5ad6('0x23')](function(_0x1481e7){_0x12cee6['count']=_0x1481e7;if(_0x42361f['query'][_0x5ad6('0x54')]){_0x3fde03[_0x5ad6('0x55')]=[{'all':!![]}];}return db[_0x5ad6('0x64')][_0x5ad6('0x68')](_0x3fde03);})[_0x5ad6('0x23')](function(_0x1aceda){_0x12cee6['rows']=_0x1aceda;return _0x12cee6;});}})[_0x5ad6('0x23')](respondWithFilteredResult(_0x5aca8f,_0x3fde03))[_0x5ad6('0x2c')](handleError(_0x5aca8f,null));};exports['removeDispositions']=function(_0x1ded46,_0x43d946,_0x67e49){return db[_0x5ad6('0x53')][_0x5ad6('0x5a')]({'where':{'id':_0x1ded46['params']['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x43d946,null))[_0x5ad6('0x23')](function(_0x151357){if(_0x151357){return _0x151357[_0x5ad6('0x69')](_0x1ded46[_0x5ad6('0x44')][_0x5ad6('0x6a')]);}})[_0x5ad6('0x23')](respondWithStatusCode(_0x43d946,null))['catch'](handleError(_0x43d946,null));};exports[_0x5ad6('0x6b')]=function(_0x299fab,_0x4aea50,_0x7b2efb){if(_0x299fab['body']['id']){delete _0x299fab[_0x5ad6('0x61')]['id'];}return db[_0x5ad6('0x53')]['find']({'where':{'id':_0x299fab['params']['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x4aea50,null))[_0x5ad6('0x23')](function(_0x2118a1){if(_0x2118a1){_0x299fab[_0x5ad6('0x61')][_0x5ad6('0x6c')]=_0x2118a1['id'];return db[_0x5ad6('0x6d')][_0x5ad6('0x5b')](_0x299fab[_0x5ad6('0x61')]);}})[_0x5ad6('0x23')](respondWithResult(_0x4aea50,null))[_0x5ad6('0x2c')](handleError(_0x4aea50,null));};exports[_0x5ad6('0x6e')]=function(_0x531116,_0x33a9be,_0x386b6f){var _0x4e1ba7={'raw':![],'where':{}};var _0x412e7c={};var _0x33ed65={'count':0x0,'rows':[]};return db[_0x5ad6('0x53')][_0x5ad6('0x66')]({'where':{'id':_0x531116[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x33a9be,null))['then'](function(_0x545c65){if(_0x545c65){_0x412e7c[_0x5ad6('0x42')]=_['keys'](db[_0x5ad6('0x6d')]['rawAttributes']);_0x412e7c[_0x5ad6('0x44')]=_['keys'](_0x531116[_0x5ad6('0x44')]);_0x412e7c[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x412e7c[_0x5ad6('0x42')],_0x412e7c['query']);_0x4e1ba7[_0x5ad6('0x47')]=_['intersection'](_0x412e7c[_0x5ad6('0x42')],qs[_0x5ad6('0x46')](_0x531116['query'][_0x5ad6('0x46')]));_0x4e1ba7[_0x5ad6('0x47')]=_0x4e1ba7['attributes'][_0x5ad6('0x48')]?_0x4e1ba7[_0x5ad6('0x47')]:_0x412e7c['model'];if(!_0x531116[_0x5ad6('0x44')]['hasOwnProperty'](_0x5ad6('0x4a'))){_0x4e1ba7['limit']=qs['limit'](_0x531116['query']['limit']);_0x4e1ba7[_0x5ad6('0x31')]=qs[_0x5ad6('0x31')](_0x531116['query'][_0x5ad6('0x31')]);}_0x4e1ba7[_0x5ad6('0x67')]=qs['sort'](_0x531116[_0x5ad6('0x44')]['sort']);_0x4e1ba7[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x531116['query'],_0x412e7c[_0x5ad6('0x4e')]));_0x4e1ba7[_0x5ad6('0x4d')][_0x5ad6('0x6c')]=_0x545c65['id'];if(_0x531116['query'][_0x5ad6('0x50')]){_0x4e1ba7[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x4e1ba7['where'],{'$or':_[_0x5ad6('0x3d')](_0x4e1ba7[_0x5ad6('0x47')],function(_0x5cedaa){var _0xe4574={};_0xe4574[_0x5cedaa]={'$like':'%'+_0x531116[_0x5ad6('0x44')]['filter']+'%'};return _0xe4574;})});}_0x4e1ba7=_[_0x5ad6('0x51')]({},_0x4e1ba7,_0x531116[_0x5ad6('0x59')]);return db['CannedAnswer'][_0x5ad6('0x30')]({'where':_0x4e1ba7[_0x5ad6('0x4d')]})['then'](function(_0x5e15c6){_0x33ed65[_0x5ad6('0x30')]=_0x5e15c6;if(_0x531116[_0x5ad6('0x44')][_0x5ad6('0x54')]){_0x4e1ba7[_0x5ad6('0x55')]=[{'all':!![]}];}return db[_0x5ad6('0x6d')][_0x5ad6('0x68')](_0x4e1ba7);})[_0x5ad6('0x23')](function(_0x409d59){_0x33ed65[_0x5ad6('0x56')]=_0x409d59;return _0x33ed65;});}})[_0x5ad6('0x23')](respondWithFilteredResult(_0x33a9be,_0x4e1ba7))[_0x5ad6('0x2c')](handleError(_0x33a9be,null));};exports['removeAnswers']=function(_0x479c43,_0x426444,_0x56b23a){return db[_0x5ad6('0x53')]['find']({'where':{'id':_0x479c43['params']['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x426444,null))[_0x5ad6('0x23')](function(_0x13584e){if(_0x13584e){return _0x13584e[_0x5ad6('0x6f')](_0x479c43[_0x5ad6('0x44')][_0x5ad6('0x6a')]);}})['then'](respondWithStatusCode(_0x426444,null))[_0x5ad6('0x2c')](handleError(_0x426444,null));};exports[_0x5ad6('0x70')]=function(_0x19f388,_0x3b8678,_0x5a3d91){return db[_0x5ad6('0x71')][_0x5ad6('0x5a')]({'where':{'id':_0x19f388[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x3b8678,null))[_0x5ad6('0x23')](function(_0x2c8626){if(_0x2c8626){return _0x2c8626['addInteraction'](_0x19f388[_0x5ad6('0x61')][_0x5ad6('0x6a')],_[_0x5ad6('0x72')](_0x19f388[_0x5ad6('0x61')],['ids','id'])||{});}})[_0x5ad6('0x23')](respondWithResult(_0x3b8678,null))[_0x5ad6('0x2c')](handleError(_0x3b8678,null));};exports[_0x5ad6('0x73')]=function(_0x21abbd,_0x59b549,_0x12c663){var _0x5d6720={'raw':![],'where':{}};var _0x123892={};var _0x77f2d1={'count':0x0,'rows':[]};return db[_0x5ad6('0x53')][_0x5ad6('0x66')]({'where':{'id':_0x21abbd[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x59b549,null))['then'](function(_0x325536){if(_0x325536){_0x123892[_0x5ad6('0x42')]=_['keys'](db[_0x5ad6('0x71')]['rawAttributes']);_0x123892['query']=_[_0x5ad6('0x43')](_0x21abbd[_0x5ad6('0x44')]);_0x123892[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x123892[_0x5ad6('0x42')],_0x123892[_0x5ad6('0x44')]);_0x5d6720[_0x5ad6('0x47')]=_[_0x5ad6('0x45')](_0x123892[_0x5ad6('0x42')],qs['fields'](_0x21abbd[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x5d6720[_0x5ad6('0x47')]=_0x5d6720[_0x5ad6('0x47')][_0x5ad6('0x48')]?_0x5d6720[_0x5ad6('0x47')]:_0x123892[_0x5ad6('0x42')];if(!_0x21abbd[_0x5ad6('0x44')][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x5d6720['limit']=qs[_0x5ad6('0x4b')](_0x21abbd[_0x5ad6('0x44')][_0x5ad6('0x4b')]);_0x5d6720[_0x5ad6('0x31')]=qs['offset'](_0x21abbd['query'][_0x5ad6('0x31')]);}_0x5d6720[_0x5ad6('0x67')]=qs[_0x5ad6('0x4c')](_0x21abbd[_0x5ad6('0x44')]['sort']);_0x5d6720[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x21abbd[_0x5ad6('0x44')],_0x123892['filters']));_0x5d6720[_0x5ad6('0x4d')][_0x5ad6('0x6c')]=_0x325536['id'];if(_0x21abbd['query'][_0x5ad6('0x50')]){_0x5d6720[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x5d6720[_0x5ad6('0x4d')],{'$or':_['map'](_0x5d6720[_0x5ad6('0x47')],function(_0x42c2f0){var _0x1b00e0={};_0x1b00e0[_0x42c2f0]={'$like':'%'+_0x21abbd[_0x5ad6('0x44')][_0x5ad6('0x50')]+'%'};return _0x1b00e0;})});}_0x5d6720=_[_0x5ad6('0x51')]({},_0x5d6720,_0x21abbd[_0x5ad6('0x59')]);return db[_0x5ad6('0x71')][_0x5ad6('0x30')]({'where':_0x5d6720[_0x5ad6('0x4d')]})[_0x5ad6('0x23')](function(_0x236509){_0x77f2d1['count']=_0x236509;if(_0x21abbd[_0x5ad6('0x44')]['includeAll']){_0x5d6720[_0x5ad6('0x55')]=[{'model':db[_0x5ad6('0x74')],'as':_0x5ad6('0x75'),'required':![]},{'model':db['User'],'as':_0x5ad6('0x76'),'attributes':[_0x5ad6('0x39'),_0x5ad6('0x77'),_0x5ad6('0x78')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5ad6('0x39'),'color'],'where':_0x21abbd['query'][_0x5ad6('0x79')]?{'id':_0x21abbd[_0x5ad6('0x44')][_0x5ad6('0x79')]}:undefined,'required':_0x21abbd[_0x5ad6('0x44')]['tag']?!![]:![]}];}return db[_0x5ad6('0x71')][_0x5ad6('0x68')](_0x5d6720);})[_0x5ad6('0x23')](function(_0x4d7c8e){_0x77f2d1['rows']=_0x4d7c8e;return _0x77f2d1;});}})[_0x5ad6('0x23')](respondWithFilteredResult(_0x59b549,_0x5d6720))[_0x5ad6('0x2c')](handleError(_0x59b549,null));};exports[_0x5ad6('0x7a')]=function(_0x48cd3d,_0x5ef05e,_0x25b135){return db[_0x5ad6('0x53')]['findOne']({'where':{'id':_0x48cd3d[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x5ef05e,null))[_0x5ad6('0x23')](function(_0x2ea453){if(_0x2ea453){return db['sequelize'][_0x5ad6('0x7b')](function(_0x254921){return db['FaxApplication'][_0x5ad6('0x38')]({'where':{'FaxAccountId':_0x48cd3d[_0x5ad6('0x58')]['id']},'transaction':_0x254921})[_0x5ad6('0x23')](function(_0x3e34e2){var _0x2a8bcd=_[_0x5ad6('0x3d')](_0x48cd3d[_0x5ad6('0x61')],function(_0x3a4de0){_0x3a4de0[_0x5ad6('0x6c')]=_0x48cd3d[_0x5ad6('0x58')]['id'];return _0x3a4de0;});return db['FaxApplication']['bulkCreate'](_0x2a8bcd,{'transaction':_0x254921});});})[_0x5ad6('0x23')](function(){return db[_0x5ad6('0x7c')][_0x5ad6('0x7d')]({'where':{'FaxAccountId':_0x48cd3d[_0x5ad6('0x58')]['id']},'order':'priority'});});}})[_0x5ad6('0x23')](respondWithResult(_0x5ef05e,null))['catch'](handleError(_0x5ef05e,null));};exports[_0x5ad6('0x7e')]=function(_0x387820,_0x20d289,_0x52755f){var _0x2242d5={};var _0x174417={};var _0x2e3bab;var _0x56dfb9;return db[_0x5ad6('0x53')][_0x5ad6('0x66')]({'where':{'id':_0x387820[_0x5ad6('0x58')]['id']}})[_0x5ad6('0x23')](handleEntityNotFound(_0x20d289,null))[_0x5ad6('0x23')](function(_0x4cce87){if(_0x4cce87){_0x2e3bab=_0x4cce87;_0x174417[_0x5ad6('0x42')]=_[_0x5ad6('0x43')](db['FaxApplication']['rawAttributes']);_0x174417['query']=_['keys'](_0x387820[_0x5ad6('0x44')]);_0x174417[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x174417[_0x5ad6('0x42')],_0x174417[_0x5ad6('0x44')]);_0x2242d5[_0x5ad6('0x47')]=_['intersection'](_0x174417['model'],qs['fields'](_0x387820[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x2242d5[_0x5ad6('0x47')]=_0x2242d5[_0x5ad6('0x47')][_0x5ad6('0x48')]?_0x2242d5[_0x5ad6('0x47')]:_0x174417[_0x5ad6('0x42')];_0x2242d5[_0x5ad6('0x67')]=qs[_0x5ad6('0x4c')](_0x387820[_0x5ad6('0x44')][_0x5ad6('0x4c')]);_0x2242d5[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x387820[_0x5ad6('0x44')],_0x174417[_0x5ad6('0x4e')]));if(_0x387820['query']['filter']){_0x2242d5[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x2242d5[_0x5ad6('0x4d')],{'$or':_['map'](_0x2242d5[_0x5ad6('0x47')],function(_0x337e95){var _0x416f44={};_0x416f44[_0x337e95]={'$like':'%'+_0x387820[_0x5ad6('0x44')]['filter']+'%'};return _0x416f44;})});}_0x2242d5=_[_0x5ad6('0x51')]({},_0x2242d5,_0x387820[_0x5ad6('0x59')]);return _0x2e3bab['getApplications'](_0x2242d5);}})[_0x5ad6('0x23')](function(_0x1122b6){if(_0x1122b6){_0x56dfb9=_0x1122b6['length'];if(!_0x387820[_0x5ad6('0x44')][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x2242d5[_0x5ad6('0x4b')]=qs[_0x5ad6('0x4b')](_0x387820[_0x5ad6('0x44')]['limit']);_0x2242d5[_0x5ad6('0x31')]=qs['offset'](_0x387820['query'][_0x5ad6('0x31')]);}return _0x2e3bab[_0x5ad6('0x7e')](_0x2242d5);}})['then'](function(_0x3713b7){if(_0x3713b7){return _0x3713b7?{'count':_0x56dfb9,'rows':_0x3713b7}:null;}})[_0x5ad6('0x23')](respondWithResult(_0x20d289,null))[_0x5ad6('0x2c')](handleError(_0x20d289,null));};function Extension(_0x2908d4,_0x5791cd,_0xeaae79,_0x324160){this[_0x5ad6('0x7f')]=_0x5ad6('0x80');this[_0x5ad6('0x81')]=_0x2908d4[_0x5ad6('0x82')];this[_0x5ad6('0x83')]=_0x324160;this[_0x5ad6('0x40')]=_0x5ad6('0x84');this[_0x5ad6('0x85')]=_0x5ad6('0x86');this[_0x5ad6('0x6c')]=_0x2908d4['id'];this[_0x5ad6('0x87')]=_0x5791cd;this[_0x5ad6('0x88')]=_0xeaae79;}function createExtensionsReciveFax(_0x2cf325){var _0x568363=0x1;var _0x4fb2de=[];_0x4fb2de['push'](new Extension(_0x2cf325,_0x568363,'',_0x5ad6('0x89')));_0x568363+=0x1;_0x4fb2de[_0x5ad6('0x8a')](new Extension(_0x2cf325,_0x568363,'CDR(type)=inbound-fax',_0x5ad6('0x8b')));_0x568363+=0x1;for(var _0x579800 in _0x2cf325){if(_0x2cf325[_0x5ad6('0x49')](_0x579800)&&(_0x579800===_0x5ad6('0x8c')||_0x579800==='localstationid'||_0x579800===_0x5ad6('0x8d')||_0x579800===_0x5ad6('0x8e')||_0x579800===_0x5ad6('0x8f')||_0x579800===_0x5ad6('0x90')||_0x579800===_0x5ad6('0x91')||_0x579800==='modem'||_0x579800===_0x5ad6('0x92'))){_0x4fb2de[_0x5ad6('0x8a')](new Extension(_0x2cf325,_0x568363,_0x5ad6('0x93')+_0x579800+')='+_0x2cf325[_0x579800],_0x5ad6('0x8b')));_0x568363+=0x1;}}_0x4fb2de[_0x5ad6('0x8a')](new Extension(_0x2cf325,_0x568363,'6',_0x5ad6('0x94')));_0x568363+=0x1;_0x4fb2de['push'](new Extension(_0x2cf325,_0x568363,_0x5ad6('0x95'),'ReceiveFax'));_0x568363=0x0;return _0x4fb2de;}exports[_0x5ad6('0x96')]=function(_0x5646d5,_0x2aba4c,_0xc635c1){var _0x4f9183;return db['sequelize'][_0x5ad6('0x7b')](function(_0x2daf86){return db[_0x5ad6('0x53')][_0x5ad6('0x5b')](_0x5646d5[_0x5ad6('0x61')],{'transaction':_0x2daf86})['then'](function(_0x125ad8){_0x4f9183=_0x125ad8[_0x5ad6('0x35')]({'plain':!![]});return db['VoiceExtension'][_0x5ad6('0x97')](createExtensionsReciveFax(_0x4f9183),{'transaction':_0x2daf86});});})[_0x5ad6('0x23')](function(){return _0x4f9183;})[_0x5ad6('0x23')](respondWithResult(_0x2aba4c,null))['catch'](handleError(_0x2aba4c,null));};exports[_0x5ad6('0x98')]=function(_0x3eacd2,_0x4f637f,_0x5928d1){var _0xe03392;return db['sequelize']['transaction'](function(_0x187a6f){return db[_0x5ad6('0x53')]['update'](_0x3eacd2[_0x5ad6('0x61')],{'where':{'id':_0x3eacd2['body']['id']},'transaction':_0x187a6f})['then'](function(_0x34f3d7){return db['VoiceExtension'][_0x5ad6('0x38')]({'where':{'FaxAccountId':_0x3eacd2[_0x5ad6('0x61')]['id']},'transaction':_0x187a6f})[_0x5ad6('0x23')](function(_0x509d61){return db[_0x5ad6('0x99')][_0x5ad6('0x97')](createExtensionsReciveFax(_['omit'](_0x3eacd2[_0x5ad6('0x61')],['tech',_0x5ad6('0x41'),'createdAt',_0x5ad6('0x9a'),_0x5ad6('0x9b'),_0x5ad6('0x9c')])),{'transaction':_0x187a6f});});});})[_0x5ad6('0x23')](function(){return db[_0x5ad6('0x53')][_0x5ad6('0x9d')](_0x3eacd2[_0x5ad6('0x61')]['id']);})[_0x5ad6('0x23')](respondWithResult(_0x4f637f,null))[_0x5ad6('0x2c')](handleError(_0x4f637f,null));};exports[_0x5ad6('0x9e')]=function(_0x4665af,_0x34b7f9,_0x2a3bdf){var _0x397cec={'raw':!![],'where':{}};var _0x1fd017={};var _0x180ec4={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5ad6('0x66')]({'where':{'id':_0x4665af[_0x5ad6('0x58')]['id']}})['then'](handleEntityNotFound(_0x34b7f9,null))[_0x5ad6('0x23')](function(_0x3eb441){if(_0x3eb441){_0x1fd017['model']=_[_0x5ad6('0x43')](db[_0x5ad6('0x9f')]['rawAttributes']);_0x1fd017[_0x5ad6('0x44')]=_[_0x5ad6('0x43')](_0x4665af[_0x5ad6('0x44')]);_0x1fd017[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x1fd017['model'],_0x1fd017['query']);_0x397cec['attributes']=_['intersection'](_0x1fd017['model'],qs[_0x5ad6('0x46')](_0x4665af[_0x5ad6('0x44')][_0x5ad6('0x46')]));_0x397cec[_0x5ad6('0x47')]=_0x397cec[_0x5ad6('0x47')]['length']?_0x397cec[_0x5ad6('0x47')]:_0x1fd017['model'];if(!_0x4665af['query'][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x397cec[_0x5ad6('0x4b')]=qs['limit'](_0x4665af[_0x5ad6('0x44')][_0x5ad6('0x4b')]);_0x397cec['offset']=qs['offset'](_0x4665af[_0x5ad6('0x44')]['offset']);}_0x397cec[_0x5ad6('0x67')]=qs[_0x5ad6('0x4c')](_0x4665af[_0x5ad6('0x44')][_0x5ad6('0x4c')]);_0x397cec['where']=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x4665af[_0x5ad6('0x44')],_0x1fd017[_0x5ad6('0x4e')]));_0x397cec[_0x5ad6('0x4d')][_0x5ad6('0x6c')]=_0x3eb441['id'];if(_0x4665af[_0x5ad6('0x44')][_0x5ad6('0x50')]){_0x397cec[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x397cec['where'],{'$or':_[_0x5ad6('0x3d')](_0x397cec[_0x5ad6('0x47')],function(_0x56966a){var _0x463949={};_0x463949[_0x56966a]={'$like':'%'+_0x4665af['query'][_0x5ad6('0x50')]+'%'};return _0x463949;})});}if(_0x4665af[_0x5ad6('0x44')][_0x5ad6('0xa0')]){var _0x2303d5=_0x4665af[_0x5ad6('0x44')]['$gte'][_0x5ad6('0xa1')](',');var _0x267744={};_0x267744[_0x2303d5[0x0]]={'$gte':moment(_0x2303d5[0x1])[_0x5ad6('0xa2')](_0x5ad6('0xa3'))};_0x397cec[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x397cec[_0x5ad6('0x4d')],_0x267744);}_0x397cec=_[_0x5ad6('0x51')]({},_0x397cec,_0x4665af[_0x5ad6('0x59')]);return db[_0x5ad6('0x9f')][_0x5ad6('0x30')]({'where':_0x397cec[_0x5ad6('0x4d')]})['then'](function(_0x59bb24){_0x180ec4[_0x5ad6('0x30')]=_0x59bb24;if(_0x4665af[_0x5ad6('0x44')][_0x5ad6('0x54')]){_0x397cec[_0x5ad6('0x55')]=[{'all':!![]}];}return db[_0x5ad6('0x9f')][_0x5ad6('0x68')](_0x397cec);})[_0x5ad6('0x23')](function(_0x458a60){_0x180ec4[_0x5ad6('0x56')]=_0x458a60;return _0x180ec4;});}})[_0x5ad6('0x23')](respondWithFilteredResult(_0x34b7f9,_0x397cec))[_0x5ad6('0x2c')](handleError(_0x34b7f9,null));};exports[_0x5ad6('0x3a')]=function(_0x3e4331,_0x387244,_0x5c7c33){var _0x81a207,_0x4f086b={},_0x4abf8a;if(_0x3e4331[_0x5ad6('0x61')]['to']){_0x4abf8a=_0x3e4331[_0x5ad6('0x61')]['to'][0x0];}return db['FaxAccount'][_0x5ad6('0x5a')]({'where':{'id':_0x3e4331[_0x5ad6('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5ad6('0x74')],'as':_0x5ad6('0xa4'),'where':{'fax':_0x4abf8a},'limit':0x1,'order':[[_0x5ad6('0x9a'),_0x5ad6('0xa5')]]}]}]})[_0x5ad6('0x23')](handleEntityNotFound(_0x387244,null))['then'](function(_0x48cf30){_0x81a207=_0x48cf30;if(_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')]&&_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][_0x5ad6('0x48')]){for(var _0x2493d1=0x0;_0x2493d1<_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][_0x5ad6('0x48')];_0x2493d1+=0x1){_0x3e4331[_0x5ad6('0x61')]['attachments'][_0x2493d1]={'filename':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][_0x2493d1][_0x5ad6('0x39')],'id':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][_0x2493d1]['id'],'path':path[_0x5ad6('0xa7')](config[_0x5ad6('0xa8')],_0x5ad6('0xa9'),_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][_0x2493d1][_0x5ad6('0xaa')])};}}return respondWithRpcPromise(_0x5ad6('0xab'),_0x5ad6('0xab'),{'FaxAccountId':_[_0x5ad6('0xac')](_0x3e4331[_0x5ad6('0x58')]['id'])?undefined:_0x3e4331[_0x5ad6('0x58')]['id'],'path':_[_0x5ad6('0xac')](_0x3e4331[_0x5ad6('0x61')]['attachments'][0x0][_0x5ad6('0x8')])?undefined:_0x3e4331['body'][_0x5ad6('0xa6')][0x0][_0x5ad6('0x8')],'fax':_[_0x5ad6('0xac')](_0x3e4331[_0x5ad6('0x61')]['to'][0x0])?undefined:_0x3e4331[_0x5ad6('0x61')]['to'][0x0]},client9002);})[_0x5ad6('0x23')](function(){if(_0x81a207){if(_[_0x5ad6('0xac')](_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xad')])){_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xad')]=util[_0x5ad6('0xa2')](_0x5ad6('0xae'),_0x81a207[_0x5ad6('0x39')],_0x81a207[_0x5ad6('0xaf')]);}if(_0x81a207[_0x5ad6('0xb0')]){if(_0x81a207[_0x5ad6('0xb0')][_0x5ad6('0xa4')][_0x5ad6('0x48')]){return _0x81a207[_0x5ad6('0xb0')][_0x5ad6('0xa4')][0x0];}else{return db[_0x5ad6('0x74')][_0x5ad6('0x5b')](_[_0x5ad6('0x19')](_0x3e4331['body'],{'firstName':_0x3e4331[_0x5ad6('0x61')]['to'][0x0],'phone':_0x3e4331[_0x5ad6('0x61')]['to'][0x0],'fax':_0x3e4331[_0x5ad6('0x61')]['to'][0x0],'ListId':_0x81a207['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x5ad6('0xb1'));}})[_0x5ad6('0x23')](function(_0x4b9531){if(_0x4b9531){return db[_0x5ad6('0x71')][_0x5ad6('0x5a')]({'where':{'ContactId':_0x4b9531['id'],'closed':![],'FaxAccountId':_0x81a207['id']}})[_0x5ad6('0x23')](function(_0x466af0){if(_0x466af0){return[_0x466af0,![]];}return db[_0x5ad6('0x71')][_0x5ad6('0x5b')]({'UserId':_0x3e4331[_0x5ad6('0xb2')]['id'],'ContactId':_0x4b9531['id'],'FaxAccountId':_0x81a207['id'],'fax':_0x3e4331['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x5ad6('0x51')](_0x3e4331[_0x5ad6('0x61')],{'read':![],'body':_0x3e4331[_0x5ad6('0x61')]['attachments'][0x0][_0x5ad6('0xb3')],'FaxAccountId':_0x81a207['id'],'UserId':_0x3e4331['user']['id'],'ContactId':_0x4b9531['id'],'AttachmentId':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x5ad6('0x9f')],'as':'Messages'}]})[_0x5ad6('0x23')](function(_0x22cc06){return[_0x22cc06,!![]];});});}else{throw new Error(_0x5ad6('0xb4'));}})[_0x5ad6('0xb5')](function(_0x11e9c2,_0x1db805){if(_0x1db805){return _0x11e9c2;}return db[_0x5ad6('0x9f')][_0x5ad6('0x5b')]({'direction':_0x5ad6('0xb6'),'read':![],'body':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][0x0][_0x5ad6('0xb3')],'FaxAccountId':_0x81a207['id'],'FaxInteractionId':_0x11e9c2['id'],'UserId':_0x3e4331[_0x5ad6('0xb2')]['id'],'ContactId':_0x11e9c2[_0x5ad6('0xb7')],'AttachmentId':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][0x0]['id']})[_0x5ad6('0x23')](function(_0x214d5b){_0x11e9c2[_0x5ad6('0xb8')][_0x5ad6('0xb9')]=[];_0x11e9c2[_0x5ad6('0xb8')][_0x5ad6('0xb9')][_0x5ad6('0x8a')](_0x214d5b['dataValues']);return _0x11e9c2;});})[_0x5ad6('0x23')](function(_0x385599){respondWithRpcPromise(_0x5ad6('0xba'),_0x5ad6('0xba'),{'FaxAccountId':_[_0x5ad6('0xac')](_0x3e4331['params']['id'])?undefined:_0x3e4331['params']['id'],'path':_[_0x5ad6('0xac')](_0x3e4331[_0x5ad6('0x61')]['attachments'][0x0][_0x5ad6('0x8')])?undefined:_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][0x0][_0x5ad6('0x8')],'fax':_['isNil'](_0x3e4331[_0x5ad6('0x61')]['to'][0x0])?undefined:_0x3e4331[_0x5ad6('0x61')]['to'][0x0],'AttachmentId':_0x3e4331[_0x5ad6('0x61')][_0x5ad6('0xa6')][0x0]['id']},client9002)[_0x5ad6('0x23')](function(_0x39c15b){logger[_0x5ad6('0x24')](_0x5ad6('0xbb'),_0x39c15b);})[_0x5ad6('0x2c')](function(_0xaeaf92){logger[_0x5ad6('0x24')](_0x5ad6('0xbb'),_0xaeaf92);});return _0x385599;})[_0x5ad6('0x23')](respondWithResult(_0x387244,null))[_0x5ad6('0x2c')](handleError(_0x387244,null));};exports[_0x5ad6('0xbc')]=function(_0x536ecb,_0x1d0488,_0x505e4e){return db[_0x5ad6('0x53')]['find']({'where':{'id':_0x536ecb[_0x5ad6('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d0488,null))[_0x5ad6('0x23')](function(_0x22541e){if(_0x22541e){return _0x22541e[_0x5ad6('0xbc')](_0x536ecb[_0x5ad6('0x61')][_0x5ad6('0x6a')],_[_0x5ad6('0x72')](_0x536ecb[_0x5ad6('0x61')],[_0x5ad6('0x6a'),'id'])||{})[_0x5ad6('0xb5')](function(_0x3a1fda){for(var _0x53e508=0x0;_0x53e508<_0x536ecb['body']['ids'][_0x5ad6('0x48')];_0x53e508+=0x1){socket[_0x5ad6('0xbd')](_0x5ad6('0xbe'),{'UserId':_0x536ecb[_0x5ad6('0x61')][_0x5ad6('0x6a')][_0x53e508],'FaxAccountId':_0x536ecb[_0x5ad6('0x58')]['id']});}return _0x3a1fda;});}})[_0x5ad6('0x23')](respondWithResult(_0x1d0488,null))[_0x5ad6('0x2c')](handleError(_0x1d0488,null));};exports['removeAgents']=function(_0x4ea20b,_0x59935a,_0x53e27e){return db[_0x5ad6('0x53')]['find']({'where':{'id':_0x4ea20b[_0x5ad6('0x58')]['id']}})['then'](handleEntityNotFound(_0x59935a,null))[_0x5ad6('0x23')](function(_0x57146c){if(_0x57146c){return _0x57146c[_0x5ad6('0xbf')](_0x4ea20b[_0x5ad6('0x44')][_0x5ad6('0x6a')])['then'](function(){if(_[_0x5ad6('0xc0')](_0x4ea20b[_0x5ad6('0x44')][_0x5ad6('0x6a')])){for(var _0x296224=0x0;_0x296224<_0x4ea20b[_0x5ad6('0x44')][_0x5ad6('0x6a')]['length'];_0x296224+=0x1){socket['emit'](_0x5ad6('0xc1'),{'UserId':Number(_0x4ea20b['query'][_0x5ad6('0x6a')][_0x296224]),'FaxAccountId':Number(_0x4ea20b[_0x5ad6('0x58')]['id'])});}}else{socket[_0x5ad6('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x4ea20b[_0x5ad6('0x44')][_0x5ad6('0x6a')]),'FaxAccountId':Number(_0x4ea20b[_0x5ad6('0x58')]['id'])});}});}})[_0x5ad6('0x23')](respondWithStatusCode(_0x59935a,null))[_0x5ad6('0x2c')](handleError(_0x59935a,null));};exports['getAgents']=function(_0x40c509,_0x377602,_0x58a97f){var _0x4c557e={};var _0x34be77={};var _0x1a8829;var _0x1970ba;return db[_0x5ad6('0x53')]['findOne']({'where':{'id':_0x40c509[_0x5ad6('0x58')]['id']}})['then'](handleEntityNotFound(_0x377602,null))['then'](function(_0x46500e){if(_0x46500e){_0x1a8829=_0x46500e;_0x34be77[_0x5ad6('0x42')]=_[_0x5ad6('0x43')](db[_0x5ad6('0xc2')][_0x5ad6('0x3e')]);_0x34be77['query']=_['keys'](_0x40c509['query']);_0x34be77[_0x5ad6('0x4e')]=_[_0x5ad6('0x45')](_0x34be77['model'],_0x34be77[_0x5ad6('0x44')]);_0x4c557e[_0x5ad6('0x47')]=_['intersection'](_0x34be77[_0x5ad6('0x42')],qs['fields'](_0x40c509['query'][_0x5ad6('0x46')]));_0x4c557e[_0x5ad6('0x47')]=_0x4c557e[_0x5ad6('0x47')][_0x5ad6('0x48')]?_0x4c557e[_0x5ad6('0x47')]:_0x34be77[_0x5ad6('0x42')];_0x4c557e['order']=qs[_0x5ad6('0x4c')](_0x40c509[_0x5ad6('0x44')][_0x5ad6('0x4c')]);_0x4c557e[_0x5ad6('0x4d')]=qs[_0x5ad6('0x4e')](_[_0x5ad6('0x4f')](_0x40c509[_0x5ad6('0x44')],_0x34be77['filters']));if(_0x40c509['query'][_0x5ad6('0x50')]){_0x4c557e[_0x5ad6('0x4d')]=_[_0x5ad6('0x51')](_0x4c557e[_0x5ad6('0x4d')],{'$or':_[_0x5ad6('0x3d')](_0x4c557e[_0x5ad6('0x47')],function(_0xc82812){var _0xced669={};_0xced669[_0xc82812]={'$like':'%'+_0x40c509[_0x5ad6('0x44')][_0x5ad6('0x50')]+'%'};return _0xced669;})});}_0x4c557e=_[_0x5ad6('0x51')]({},_0x4c557e,_0x40c509['options']);return _0x1a8829[_0x5ad6('0xc3')](_0x4c557e);}})[_0x5ad6('0x23')](function(_0x5f5bac){if(_0x5f5bac){_0x1970ba=_0x5f5bac['length'];if(!_0x40c509[_0x5ad6('0x44')][_0x5ad6('0x49')](_0x5ad6('0x4a'))){_0x4c557e['limit']=qs[_0x5ad6('0x4b')](_0x40c509[_0x5ad6('0x44')][_0x5ad6('0x4b')]);_0x4c557e[_0x5ad6('0x31')]=qs[_0x5ad6('0x31')](_0x40c509['query'][_0x5ad6('0x31')]);}return _0x1a8829[_0x5ad6('0xc3')](_0x4c557e);}})[_0x5ad6('0x23')](function(_0x361032){if(_0x361032){return _0x361032?{'count':_0x1970ba,'rows':_0x361032}:null;}})[_0x5ad6('0x23')](respondWithResult(_0x377602,null))[_0x5ad6('0x2c')](handleError(_0x377602,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cd98f34..8cce28c 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 _0x01a4=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1987fe,_0x5c785c){var _0x34905f=function(_0x2ae9da){while(--_0x2ae9da){_0x1987fe['push'](_0x1987fe['shift']());}};_0x34905f(++_0x5c785c);}(_0x01a4,0xa0));var _0x401a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x01a4[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x401a('0x0'));var FaxAccount=require(_0x401a('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x401a('0x2')](0x0);var events={'afterCreate':_0x401a('0x3'),'afterUpdate':_0x401a('0x4'),'afterDestroy':_0x401a('0x5')};function emitEvent(_0x4ab27a){return function(_0x24b597,_0x33189a,_0x3588bd){FaxAccountEvents[_0x401a('0x6')](_0x4ab27a+':'+_0x24b597['id'],_0x24b597);FaxAccountEvents[_0x401a('0x6')](_0x4ab27a,_0x24b597);_0x3588bd(null);};}for(var e in events){if(events[_0x401a('0x7')](e)){var event=events[e];FaxAccount[_0x401a('0x8')](e,emitEvent(event));}}module[_0x401a('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x1893=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x4f60d8,_0xbcf38f){var _0xfdfc26=function(_0x1f769a){while(--_0x1f769a){_0x4f60d8['push'](_0x4f60d8['shift']());}};_0xfdfc26(++_0xbcf38f);}(_0x1893,0x186));var _0x3189=function(_0x51ece4,_0x39165c){_0x51ece4=_0x51ece4-0x0;var _0x2b7e27=_0x1893[_0x51ece4];return _0x2b7e27;};'use strict';var EventEmitter=require(_0x3189('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3189('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3189('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3189('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10bf49){return function(_0x40721e,_0x503867,_0x6a29e){FaxAccountEvents[_0x3189('0x4')](_0x10bf49+':'+_0x40721e['id'],_0x40721e);FaxAccountEvents[_0x3189('0x4')](_0x10bf49,_0x40721e);_0x6a29e(null);};}for(var e in events){if(events[_0x3189('0x5')](e)){var event=events[e];FaxAccount[_0x3189('0x6')](e,emitEvent(event));}}module[_0x3189('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0c9cf70..8063f81 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 _0x1895=['exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxAccount.attributes'];(function(_0x32ee59,_0xd80b78){var _0x50cd09=function(_0x2ef9c5){while(--_0x2ef9c5){_0x32ee59['push'](_0x32ee59['shift']());}};_0x50cd09(++_0xd80b78);}(_0x1895,0x10b));var _0x5189=function(_0x2ca226,_0x3f48cb){_0x2ca226=_0x2ca226-0x0;var _0x24d6c2=_0x1895[_0x2ca226];return _0x24d6c2;};'use strict';var _=require(_0x5189('0x0'));var util=require(_0x5189('0x1'));var logger=require(_0x5189('0x2'))(_0x5189('0x3'));var moment=require(_0x5189('0x4'));var BPromise=require(_0x5189('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5189('0x6'));var rimraf=require(_0x5189('0x7'));var config=require('../../config/environment');var attributes=require(_0x5189('0x8'));module[_0x5189('0x9')]=function(_0x389e7e,_0x108e5){return _0x389e7e[_0x5189('0xa')]('FaxAccount',attributes,{'tableName':_0x5189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f98=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./faxAccount.attributes'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x0f98,0x1c0));var _0x80f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f98[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x80f9('0x0'));var util=require(_0x80f9('0x1'));var logger=require(_0x80f9('0x2'))(_0x80f9('0x3'));var moment=require(_0x80f9('0x4'));var BPromise=require(_0x80f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80f9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80f9('0x7'));module[_0x80f9('0x8')]=function(_0x2aafe6,_0x2d93ad){return _0x2aafe6[_0x80f9('0x9')](_0x80f9('0xa'),attributes,{'tableName':_0x80f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 52f6ce9..eefd274 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 _0xc4ed=['spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','difference','keys','createdAt','updatedAt','CompanyId','from','Sequelize','ValidationError','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','length','Contacts','create','FaxInteraction','Contact\x20not\x20found'];(function(_0x3ac381,_0x309a4e){var _0x125e22=function(_0xf84283){while(--_0xf84283){_0x3ac381['push'](_0x3ac381['shift']());}};_0x125e22(++_0x309a4e);}(_0xc4ed,0x67));var _0xdc4e=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xc4ed[_0x339129];return _0x1570df;};'use strict';var _=require(_0xdc4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc4e('0x1'));var rs=require(_0xdc4e('0x2'));var fs=require('fs');var Redis=require(_0xdc4e('0x3'));var db=require(_0xdc4e('0x4'))['db'];var utils=require(_0xdc4e('0x5'));var logger=require(_0xdc4e('0x6'))(_0xdc4e('0x7'));var config=require(_0xdc4e('0x8'));var jayson=require(_0xdc4e('0x9'));var client=jayson[_0xdc4e('0xa')]['http']({'port':0x232c});config[_0xdc4e('0xb')]=_[_0xdc4e('0xc')](config[_0xdc4e('0xb')],{'host':_0xdc4e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc4e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3b8319,_0x410552,_0x4dd6fc){return new BPromise(function(_0x4b3b47,_0x53a039){return client['request'](_0x3b8319,_0x4dd6fc)[_0xdc4e('0xf')](function(_0x4eb0bf){logger[_0xdc4e('0x10')](_0xdc4e('0x11'),_0x410552,_0xdc4e('0x12'));logger[_0xdc4e('0x13')](_0xdc4e('0x14'),_0x410552,_0xdc4e('0x12'),JSON['stringify'](_0x4eb0bf));if(_0x4eb0bf[_0xdc4e('0x15')]){if(_0x4eb0bf[_0xdc4e('0x15')][_0xdc4e('0x16')]===0x1f4){logger[_0xdc4e('0x15')](_0xdc4e('0x11'),_0x410552,_0x4eb0bf[_0xdc4e('0x15')]['message']);return _0x53a039(_0x4eb0bf[_0xdc4e('0x15')][_0xdc4e('0x17')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x410552,_0x4eb0bf['error'][_0xdc4e('0x17')]);return _0x4b3b47(_0x4eb0bf[_0xdc4e('0x15')][_0xdc4e('0x17')]);}else{logger[_0xdc4e('0x10')](_0xdc4e('0x11'),_0x410552,_0xdc4e('0x12'));_0x4b3b47(_0x4eb0bf[_0xdc4e('0x18')][_0xdc4e('0x17')]);}})['catch'](function(_0x42fc14){logger[_0xdc4e('0x15')](_0xdc4e('0x11'),_0x410552,_0x42fc14);_0x53a039(_0x42fc14);});});}exports[_0xdc4e('0x19')]=function(_0x143472){var _0x1fc7a1=this;return new Promise(function(_0x3059b9,_0x311f54){return db[_0xdc4e('0x1a')][_0xdc4e('0x1b')]({'raw':_0x143472['options']?_0x143472['options'][_0xdc4e('0x1c')]===undefined?!![]:![]:!![],'where':_0x143472[_0xdc4e('0x1d')]?_0x143472[_0xdc4e('0x1d')][_0xdc4e('0x1e')]||null:null,'attributes':_0x143472['options']?_0x143472['options'][_0xdc4e('0x1f')]||null:null,'limit':_0x143472[_0xdc4e('0x1d')]?_0x143472['options'][_0xdc4e('0x20')]||null:null,'include':_0x143472['options']?_0x143472[_0xdc4e('0x1d')][_0xdc4e('0x21')]?_[_0xdc4e('0x22')](_0x143472['options'][_0xdc4e('0x21')],function(_0x47a99c){return{'model':db[_0x47a99c[_0xdc4e('0x23')]],'as':_0x47a99c['as'],'attributes':_0x47a99c[_0xdc4e('0x1f')],'include':_0x47a99c[_0xdc4e('0x21')]?_[_0xdc4e('0x22')](_0x47a99c[_0xdc4e('0x21')],function(_0xc5ef56){return{'model':db[_0xc5ef56[_0xdc4e('0x23')]],'as':_0xc5ef56['as'],'attributes':_0xc5ef56['attributes'],'include':_0xc5ef56['include']?_[_0xdc4e('0x22')](_0xc5ef56['include'],function(_0x41204f){return{'model':db[_0x41204f[_0xdc4e('0x23')]],'as':_0x41204f['as'],'attributes':_0x41204f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc4e('0xf')](function(_0x1058be){logger[_0xdc4e('0x10')]('GetFaxAccount',_0x143472);logger[_0xdc4e('0x13')](_0xdc4e('0x19'),_0x143472,JSON['stringify'](_0x1058be));_0x3059b9(_0x1058be);})[_0xdc4e('0x24')](function(_0x50dea8){logger[_0xdc4e('0x15')](_0xdc4e('0x19'),_0x50dea8[_0xdc4e('0x17')],_0x143472);_0x311f54(_0x1fc7a1['error'](0x1f4,_0x50dea8[_0xdc4e('0x17')]));});});};exports[_0xdc4e('0x25')]=function(_0x427426,_0x41a925,_0x14f275){var _0x513397=this;return new Promise(function(_0x5c521f,_0x304b85){var _0x3fca89={'body':_0x427426[_0xdc4e('0x26')],'channel':_0xdc4e('0x27')};var _0x56b0=[];var _0x5a1227=[];var _0x15dff4={};return db[_0xdc4e('0x28')]['describe']()[_0xdc4e('0xf')](function(_0x476cc8){if(!_0x476cc8){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x56b0=_[_0xdc4e('0x29')](_[_0xdc4e('0x2a')](_0x476cc8),[_0xdc4e('0x2b'),_0xdc4e('0x2c')]);_0x5a1227=_[_0xdc4e('0x29')](_[_0xdc4e('0x2a')](_0x476cc8),[_0xdc4e('0x2b'),_0xdc4e('0x2c'),_0xdc4e('0x2d'),'ListId']);if(_0x427426[_0xdc4e('0x26')]['id']){delete _0x427426[_0xdc4e('0x26')]['id'];}if(_['isNil'](_0x427426[_0xdc4e('0x26')][_0xdc4e('0x2e')])){throw new db[(_0xdc4e('0x2f'))][(_0xdc4e('0x30'))]('from\x20is\x20mandatory');}if(_[_0xdc4e('0x31')](_0x427426[_0xdc4e('0x26')]['body'])||_0x427426[_0xdc4e('0x26')]['body']===''){throw new db['Sequelize'][(_0xdc4e('0x30'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x427426['body'][_0xdc4e('0x32')])){throw new db[(_0xdc4e('0x2f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a1227);}if(!_[_0xdc4e('0x33')](_0x5a1227,_0x427426['body'][_0xdc4e('0x32')])){throw new db[(_0xdc4e('0x2f'))]['ValidationError'](_0xdc4e('0x34')+_0x5a1227);}_0x15dff4[_0x427426['body'][_0xdc4e('0x32')]]=_0x427426[_0xdc4e('0x26')][_0xdc4e('0x2e')];})['then'](function(){return db[_0xdc4e('0x1a')][_0xdc4e('0x35')]({'where':{'id':_0x427426[_0xdc4e('0x36')]['id']},'include':[{'model':db[_0xdc4e('0x37')],'as':_0xdc4e('0x38'),'include':[{'model':db[_0xdc4e('0x28')],'as':'Contacts','where':_0x15dff4,'limit':0x1,'order':[[_0xdc4e('0x2c'),_0xdc4e('0x39')]]}]},{'model':db[_0xdc4e('0x3a')],'as':'Applications'}]});})[_0xdc4e('0xf')](function(_0x5d072d){if(_0x5d072d&&_0x5d072d[_0xdc4e('0x38')]){var _0x14dd71=_0x5d072d[_0xdc4e('0x3b')]({'plain':!![]});_0x3fca89[_0xdc4e('0x36')]=_0x14dd71;_0x3fca89[_0xdc4e('0x3c')]=_0x14dd71[_0xdc4e('0x3d')];_0x3fca89[_0xdc4e('0x3e')]=_0x14dd71[_0xdc4e('0x38')];_0x3fca89[_0xdc4e('0x3c')]=_[_0xdc4e('0x3f')](_0x3fca89[_0xdc4e('0x3c')],[_0xdc4e('0x40')],[_0xdc4e('0x41')]);if(_0x3fca89[_0xdc4e('0x36')]['Applications']){delete _0x3fca89[_0xdc4e('0x36')][_0xdc4e('0x3d')];}if(_0x3fca89[_0xdc4e('0x36')]['List']&&_0x3fca89['account']['List']['Contacts'][_0xdc4e('0x42')]){return _0x3fca89[_0xdc4e('0x36')][_0xdc4e('0x38')][_0xdc4e('0x43')][0x0];}var _0x54db2f=_[_0xdc4e('0xc')](_0x427426['body'],{'firstName':_0x427426['body'][_0xdc4e('0x2e')],'ListId':_0x14dd71['ListId']});_0x54db2f[_0x427426['body'][_0xdc4e('0x32')]]=_0x427426[_0xdc4e('0x26')][_0xdc4e('0x2e')];return db[_0xdc4e('0x28')][_0xdc4e('0x44')](_0x54db2f,{'fields':_0x56b0,'raw':!![]});}})[_0xdc4e('0xf')](function(_0x2e3267){_0x3fca89['contact']=_0x2e3267;if(_0x2e3267){var _0x519e93={'ContactId':_0x2e3267['id'],'FaxAccountId':_0x427426[_0xdc4e('0x36')]['id'],'fax':_0x2e3267[_0xdc4e('0x27')]};return db[_0xdc4e('0x45')][_0xdc4e('0x35')]({'where':{'ContactId':_0x2e3267['id'],'closed':![],'FaxAccountId':_0x427426[_0xdc4e('0x36')]['id']}})[_0xdc4e('0xf')](function(_0xb54d7f){if(_0xb54d7f){return[_0xb54d7f,![]];}return db[_0xdc4e('0x45')][_0xdc4e('0x44')](_0x519e93)[_0xdc4e('0xf')](function(_0x53bd0d){return[_0x53bd0d,!![]];});});}else{throw new Error(_0xdc4e('0x46'));}})[_0xdc4e('0x47')](function(_0x2c0db1,_0x29fa11){var _0x3c6655=_0x2c0db1[_0xdc4e('0x3b')]({'plain':!![]});if(_0x29fa11){if(_0x3fca89[_0xdc4e('0x36')][_0xdc4e('0x48')]){_0x3fca89[_0xdc4e('0x3c')][_0xdc4e('0x49')]({'id':0x0,'priority':_0x3fca89[_0xdc4e('0x3c')]['length']+0x1,'app':_0xdc4e('0x4a'),'appdata':_0xdc4e('0x4b'),'interval':_0xdc4e('0x4c')});}_0x3c6655['created']=!![];}else{_0x3c6655[_0xdc4e('0x4d')]=![];}_0x3fca89[_0xdc4e('0x4e')]=_0x3c6655;return db[_0xdc4e('0x4f')][_0xdc4e('0x44')]({'body':_0x427426[_0xdc4e('0x26')][_0xdc4e('0x26')],'FaxAccountId':_0x427426[_0xdc4e('0x36')]['id'],'FaxInteractionId':_0x2c0db1['id'],'direction':'in','ContactId':_0x2c0db1[_0xdc4e('0x50')],'AttachmentId':_0x427426[_0xdc4e('0x26')]['AttachmentId']});})[_0xdc4e('0xf')](function(_0x55c349){_0x3fca89[_0xdc4e('0x17')]=_0x55c349;if(_0x3fca89[_0xdc4e('0x4e')][_0xdc4e('0x51')]){return db[_0xdc4e('0x52')][_0xdc4e('0x35')]({'attributes':['id',_0xdc4e('0x53')],'where':{'id':_0x3fca89[_0xdc4e('0x4e')][_0xdc4e('0x51')]}})[_0xdc4e('0xf')](function(_0x521541){if(_0x521541){_0x3fca89[_0xdc4e('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x521541[_0xdc4e('0x53')]+','+(_0x3fca89[_0xdc4e('0x36')][_0xdc4e('0x54')]||0xa),'interval':_0xdc4e('0x4c')});}return respondWithRpcPromise(_0xdc4e('0x55'),_0xdc4e('0x56'),_0x3fca89);});}return respondWithRpcPromise(_0xdc4e('0x55'),_0xdc4e('0x56'),_0x3fca89);})[_0xdc4e('0xf')](function(_0x5211d2){_0x5c521f(_0x5211d2);})[_0xdc4e('0x24')](function(_0x201582){_0x304b85(_0x513397['error'](0x1f4,_0x201582[_0xdc4e('0x17')]));});});}; \ No newline at end of file +var _0xa994=['Contacts','ListId','create','contact','FaxInteraction','find','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','options','raw','where','limit','include','map','attributes','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','FaxAccount','account','CmList','DESC','FaxApplication','Applications','get','applications','list','priority','asc','List','length'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa994,0x173));var _0x4a99=function(_0x1169ab,_0x32c312){_0x1169ab=_0x1169ab-0x0;var _0xa6c730=_0xa994[_0x1169ab];return _0xa6c730;};'use strict';var _=require(_0x4a99('0x0'));var util=require(_0x4a99('0x1'));var moment=require(_0x4a99('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a99('0x3'))['db'];var utils=require(_0x4a99('0x4'));var logger=require(_0x4a99('0x5'))(_0x4a99('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4a99('0x7')]['http']({'port':0x232c});config[_0x4a99('0x8')]=_[_0x4a99('0x9')](config[_0x4a99('0x8')],{'host':_0x4a99('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a99('0x8')]));require('./faxAccount.socket')[_0x4a99('0xb')](socket);function respondWithRpcPromise(_0x51f8cf,_0x16c0f5,_0x5ecf0c){return new BPromise(function(_0x28d983,_0x4f92e2){return client[_0x4a99('0xc')](_0x51f8cf,_0x5ecf0c)[_0x4a99('0xd')](function(_0x2bfbda){logger[_0x4a99('0xe')]('FaxAccount,\x20%s,\x20%s',_0x16c0f5,_0x4a99('0xf'));logger[_0x4a99('0x10')](_0x4a99('0x11'),_0x16c0f5,_0x4a99('0xf'),JSON['stringify'](_0x2bfbda));if(_0x2bfbda['error']){if(_0x2bfbda[_0x4a99('0x12')][_0x4a99('0x13')]===0x1f4){logger['error'](_0x4a99('0x14'),_0x16c0f5,_0x2bfbda[_0x4a99('0x12')][_0x4a99('0x15')]);return _0x4f92e2(_0x2bfbda[_0x4a99('0x12')][_0x4a99('0x15')]);}logger[_0x4a99('0x12')](_0x4a99('0x14'),_0x16c0f5,_0x2bfbda[_0x4a99('0x12')]['message']);return _0x28d983(_0x2bfbda[_0x4a99('0x12')][_0x4a99('0x15')]);}else{logger[_0x4a99('0xe')]('FaxAccount,\x20%s,\x20%s',_0x16c0f5,_0x4a99('0xf'));_0x28d983(_0x2bfbda['result'][_0x4a99('0x15')]);}})[_0x4a99('0x16')](function(_0x4822e2){logger[_0x4a99('0x12')](_0x4a99('0x14'),_0x16c0f5,_0x4822e2);_0x4f92e2(_0x4822e2);});});}exports[_0x4a99('0x17')]=function(_0x39db5b){var _0xb81959=this;return new Promise(function(_0x14cbe8,_0x14b615){return db['FaxAccount']['findAll']({'raw':_0x39db5b[_0x4a99('0x18')]?_0x39db5b[_0x4a99('0x18')][_0x4a99('0x19')]===undefined?!![]:![]:!![],'where':_0x39db5b[_0x4a99('0x18')]?_0x39db5b[_0x4a99('0x18')][_0x4a99('0x1a')]||null:null,'attributes':_0x39db5b[_0x4a99('0x18')]?_0x39db5b[_0x4a99('0x18')]['attributes']||null:null,'limit':_0x39db5b[_0x4a99('0x18')]?_0x39db5b[_0x4a99('0x18')][_0x4a99('0x1b')]||null:null,'include':_0x39db5b[_0x4a99('0x18')]?_0x39db5b[_0x4a99('0x18')][_0x4a99('0x1c')]?_[_0x4a99('0x1d')](_0x39db5b['options'][_0x4a99('0x1c')],function(_0x35f217){return{'model':db[_0x35f217['model']],'as':_0x35f217['as'],'attributes':_0x35f217[_0x4a99('0x1e')],'include':_0x35f217[_0x4a99('0x1c')]?_[_0x4a99('0x1d')](_0x35f217['include'],function(_0xa689be){return{'model':db[_0xa689be['model']],'as':_0xa689be['as'],'attributes':_0xa689be['attributes'],'include':_0xa689be['include']?_[_0x4a99('0x1d')](_0xa689be[_0x4a99('0x1c')],function(_0x2e665d){return{'model':db[_0x2e665d[_0x4a99('0x1f')]],'as':_0x2e665d['as'],'attributes':_0x2e665d[_0x4a99('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4a99('0xd')](function(_0x31952){logger[_0x4a99('0xe')](_0x4a99('0x17'),_0x39db5b);logger[_0x4a99('0x10')]('GetFaxAccount',_0x39db5b,JSON['stringify'](_0x31952));_0x14cbe8(_0x31952);})[_0x4a99('0x16')](function(_0x1241ba){logger[_0x4a99('0x12')](_0x4a99('0x17'),_0x1241ba[_0x4a99('0x15')],_0x39db5b);_0x14b615(_0xb81959['error'](0x1f4,_0x1241ba['message']));});});};exports[_0x4a99('0x20')]=function(_0xec7af4,_0x46ee5d,_0x50b014){var _0x3cbdcb=this;return new Promise(function(_0x36585e,_0x5de5d2){var _0x173e60={'body':_0xec7af4['body'],'channel':_0x4a99('0x21')};var _0x2a60b0=[];var _0x4c21e7=[];var _0x1291ce={};return db[_0x4a99('0x22')][_0x4a99('0x23')]()['then'](function(_0x5b1667){if(!_0x5b1667){throw new db[(_0x4a99('0x24'))]['ValidationError']('no\x20available\x20attributes');}_0x2a60b0=_[_0x4a99('0x25')](_[_0x4a99('0x26')](_0x5b1667),[_0x4a99('0x27'),_0x4a99('0x28')]);_0x4c21e7=_[_0x4a99('0x25')](_[_0x4a99('0x26')](_0x5b1667),[_0x4a99('0x27'),_0x4a99('0x28'),_0x4a99('0x29'),'ListId']);if(_0xec7af4[_0x4a99('0x2a')]['id']){delete _0xec7af4[_0x4a99('0x2a')]['id'];}if(_[_0x4a99('0x2b')](_0xec7af4[_0x4a99('0x2a')]['from'])){throw new db['Sequelize'][(_0x4a99('0x2c'))](_0x4a99('0x2d'));}if(_[_0x4a99('0x2b')](_0xec7af4[_0x4a99('0x2a')][_0x4a99('0x2a')])||_0xec7af4['body'][_0x4a99('0x2a')]===''){throw new db['Sequelize'][(_0x4a99('0x2c'))](_0x4a99('0x2e'));}if(_[_0x4a99('0x2b')](_0xec7af4['body'][_0x4a99('0x2f')])){throw new db[(_0x4a99('0x24'))]['ValidationError'](_0x4a99('0x30')+_0x4c21e7);}if(!_[_0x4a99('0x31')](_0x4c21e7,_0xec7af4[_0x4a99('0x2a')]['mapKey'])){throw new db[(_0x4a99('0x24'))][(_0x4a99('0x2c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c21e7);}_0x1291ce[_0xec7af4[_0x4a99('0x2a')][_0x4a99('0x2f')]]=_0xec7af4['body'][_0x4a99('0x32')];})[_0x4a99('0xd')](function(){return db[_0x4a99('0x33')]['find']({'where':{'id':_0xec7af4[_0x4a99('0x34')]['id']},'include':[{'model':db[_0x4a99('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1291ce,'limit':0x1,'order':[[_0x4a99('0x28'),_0x4a99('0x36')]]}]},{'model':db[_0x4a99('0x37')],'as':_0x4a99('0x38')}]});})['then'](function(_0x43a017){if(_0x43a017&&_0x43a017['List']){var _0x2d35c2=_0x43a017[_0x4a99('0x39')]({'plain':!![]});_0x173e60[_0x4a99('0x34')]=_0x2d35c2;_0x173e60[_0x4a99('0x3a')]=_0x2d35c2[_0x4a99('0x38')];_0x173e60[_0x4a99('0x3b')]=_0x2d35c2['List'];_0x173e60[_0x4a99('0x3a')]=_['orderBy'](_0x173e60[_0x4a99('0x3a')],[_0x4a99('0x3c')],[_0x4a99('0x3d')]);if(_0x173e60[_0x4a99('0x34')][_0x4a99('0x38')]){delete _0x173e60[_0x4a99('0x34')][_0x4a99('0x38')];}if(_0x173e60[_0x4a99('0x34')][_0x4a99('0x3e')]&&_0x173e60['account'][_0x4a99('0x3e')]['Contacts'][_0x4a99('0x3f')]){return _0x173e60['account'][_0x4a99('0x3e')][_0x4a99('0x40')][0x0];}var _0x3947ee=_[_0x4a99('0x9')](_0xec7af4[_0x4a99('0x2a')],{'firstName':_0xec7af4[_0x4a99('0x2a')][_0x4a99('0x32')],'ListId':_0x2d35c2[_0x4a99('0x41')]});_0x3947ee[_0xec7af4[_0x4a99('0x2a')]['mapKey']]=_0xec7af4['body'][_0x4a99('0x32')];return db[_0x4a99('0x22')][_0x4a99('0x42')](_0x3947ee,{'fields':_0x2a60b0,'raw':!![]});}})['then'](function(_0x272cf4){_0x173e60[_0x4a99('0x43')]=_0x272cf4;if(_0x272cf4){var _0x42b45b={'ContactId':_0x272cf4['id'],'FaxAccountId':_0xec7af4['account']['id'],'fax':_0x272cf4[_0x4a99('0x21')]};return db[_0x4a99('0x44')][_0x4a99('0x45')]({'where':{'ContactId':_0x272cf4['id'],'closed':![],'FaxAccountId':_0xec7af4[_0x4a99('0x34')]['id']}})[_0x4a99('0xd')](function(_0x59e7f){if(_0x59e7f){return[_0x59e7f,![]];}return db[_0x4a99('0x44')][_0x4a99('0x42')](_0x42b45b)[_0x4a99('0xd')](function(_0x234a02){return[_0x234a02,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4a99('0x46')](function(_0x359875,_0x524240){var _0x39fda9=_0x359875[_0x4a99('0x39')]({'plain':!![]});if(_0x524240){if(_0x173e60[_0x4a99('0x34')][_0x4a99('0x47')]){_0x173e60[_0x4a99('0x3a')]['push']({'id':0x0,'priority':_0x173e60[_0x4a99('0x3a')]['length']+0x1,'app':_0x4a99('0x48'),'appdata':_0x4a99('0x49'),'interval':_0x4a99('0x4a')});}_0x39fda9[_0x4a99('0x4b')]=!![];}else{_0x39fda9[_0x4a99('0x4b')]=![];}_0x173e60[_0x4a99('0x4c')]=_0x39fda9;return db[_0x4a99('0x4d')]['create']({'body':_0xec7af4[_0x4a99('0x2a')]['body'],'FaxAccountId':_0xec7af4[_0x4a99('0x34')]['id'],'FaxInteractionId':_0x359875['id'],'direction':'in','ContactId':_0x359875['ContactId'],'AttachmentId':_0xec7af4['body'][_0x4a99('0x4e')]});})[_0x4a99('0xd')](function(_0x550132){_0x173e60[_0x4a99('0x15')]=_0x550132;if(_0x173e60[_0x4a99('0x4c')]['UserId']){return db[_0x4a99('0x4f')][_0x4a99('0x45')]({'attributes':['id',_0x4a99('0x50')],'where':{'id':_0x173e60[_0x4a99('0x4c')][_0x4a99('0x51')]}})[_0x4a99('0xd')](function(_0x3a48b4){if(_0x3a48b4){_0x173e60[_0x4a99('0x3a')][_0x4a99('0x52')]({'id':0x0,'priority':0x0,'app':_0x4a99('0x53'),'appdata':_0x3a48b4[_0x4a99('0x50')]+','+(_0x173e60['account'][_0x4a99('0x54')]||0xa),'interval':_0x4a99('0x4a')});}return respondWithRpcPromise(_0x4a99('0x55'),_0x4a99('0x56'),_0x173e60);});}return respondWithRpcPromise(_0x4a99('0x55'),_0x4a99('0x56'),_0x173e60);})[_0x4a99('0xd')](function(_0x1dcfc0){_0x36585e(_0x1dcfc0);})[_0x4a99('0x16')](function(_0x23089d){_0x5de5d2(_0x3cbdcb['error'](0x1f4,_0x23089d[_0x4a99('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 93559ed..2af41ed 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 _0xd046=['removeListener','faxAccount:','save','remove','update'];(function(_0x5f0a80,_0x1b38c4){var _0xb7817a=function(_0x38df50){while(--_0x38df50){_0x5f0a80['push'](_0x5f0a80['shift']());}};_0xb7817a(++_0x1b38c4);}(_0xd046,0x129));var _0x6d04=function(_0x2890c7,_0x5be494){_0x2890c7=_0x2890c7-0x0;var _0x26b726=_0xd046[_0x2890c7];return _0x26b726;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6d04('0x0'),_0x6d04('0x1'),_0x6d04('0x2')];function createListener(_0x4b78e1,_0xedb518){return function(_0x55be3b){_0xedb518['emit'](_0x4b78e1,_0x55be3b);};}function removeListener(_0x33720a,_0x4d2121){return function(){FaxAccountEvents[_0x6d04('0x3')](_0x33720a,_0x4d2121);};}exports['register']=function(_0x4bacb1){for(var _0xf3b4e7=0x0,_0x1968c4=events['length'];_0xf3b4e7<_0x1968c4;_0xf3b4e7++){var _0x569c7b=events[_0xf3b4e7];var _0x2e2c01=createListener(_0x6d04('0x4')+_0x569c7b,_0x4bacb1);FaxAccountEvents['on'](_0x569c7b,_0x2e2c01);}}; \ No newline at end of file +var _0x27a0=['length','faxAccount:','save','remove','update','removeListener','register'];(function(_0x8d8917,_0x504e20){var _0x55bd93=function(_0x24db56){while(--_0x24db56){_0x8d8917['push'](_0x8d8917['shift']());}};_0x55bd93(++_0x504e20);}(_0x27a0,0xbf));var _0x027a=function(_0x3ff3cc,_0x259368){_0x3ff3cc=_0x3ff3cc-0x0;var _0x58fced=_0x27a0[_0x3ff3cc];return _0x58fced;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x027a('0x0'),_0x027a('0x1'),_0x027a('0x2')];function createListener(_0x352dd7,_0x32e5e0){return function(_0x59cd58){_0x32e5e0['emit'](_0x352dd7,_0x59cd58);};}function removeListener(_0x4e8d6b,_0x47cd65){return function(){FaxAccountEvents[_0x027a('0x3')](_0x4e8d6b,_0x47cd65);};}exports[_0x027a('0x4')]=function(_0x137b09){for(var _0x639bec=0x0,_0xe233ed=events[_0x027a('0x5')];_0x639bec<_0xe233ed;_0x639bec++){var _0x550fbb=events[_0x639bec];var _0x3d1429=createListener(_0x027a('0x6')+_0x550fbb,_0x137b09);FaxAccountEvents['on'](_0x550fbb,_0x3d1429);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 58e416e..47d682b 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 _0x7276=['updateAccountApplications','/:id/send','send','addAgents','put','/:id','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','addInteraction','addApplications','/addaccountapplications'];(function(_0x3fd584,_0x3d84ad){var _0xe4b60b=function(_0x24f265){while(--_0x24f265){_0x3fd584['push'](_0x3fd584['shift']());}};_0xe4b60b(++_0x3d84ad);}(_0x7276,0x186));var _0x6727=function(_0x11a4d8,_0xb83290){_0x11a4d8=_0x11a4d8-0x0;var _0x7e9b04=_0x7276[_0x11a4d8];return _0x7e9b04;};'use strict';var multer=require('multer');var util=require(_0x6727('0x0'));var path=require(_0x6727('0x1'));var timeout=require(_0x6727('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6727('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6727('0x4'));var controller=require('./faxAccount.controller');router[_0x6727('0x5')]('/',auth['isAuthenticated'](),controller[_0x6727('0x6')]);router['get']('/describe',auth[_0x6727('0x7')](),controller[_0x6727('0x8')]);router[_0x6727('0x5')]('/:id',auth[_0x6727('0x7')](),controller[_0x6727('0x9')]);router[_0x6727('0x5')]('/:id/dispositions',auth[_0x6727('0x7')](),controller[_0x6727('0xa')]);router[_0x6727('0x5')](_0x6727('0xb'),auth['isAuthenticated'](),controller[_0x6727('0xc')]);router[_0x6727('0x5')](_0x6727('0xd'),auth[_0x6727('0x7')](),controller[_0x6727('0xe')]);router[_0x6727('0x5')](_0x6727('0xf'),auth['isAuthenticated'](),controller[_0x6727('0x10')]);router[_0x6727('0x5')](_0x6727('0x11'),auth['isAuthenticated'](),controller[_0x6727('0x12')]);router[_0x6727('0x5')](_0x6727('0x13'),auth[_0x6727('0x7')](),controller[_0x6727('0x14')]);router[_0x6727('0x15')]('/',auth['isAuthenticated'](),controller[_0x6727('0x16')]);router[_0x6727('0x15')](_0x6727('0x17'),auth[_0x6727('0x7')](),controller['addDisposition']);router[_0x6727('0x15')](_0x6727('0xb'),auth[_0x6727('0x7')](),controller[_0x6727('0x18')]);router['post']('/:id/interactions',auth[_0x6727('0x7')](),controller[_0x6727('0x19')]);router[_0x6727('0x15')](_0x6727('0xf'),auth[_0x6727('0x7')](),controller[_0x6727('0x1a')]);router['post'](_0x6727('0x1b'),auth[_0x6727('0x7')](),controller['addAccountApplications']);router[_0x6727('0x15')]('/updateaccountapplications',auth[_0x6727('0x7')](),controller[_0x6727('0x1c')]);router[_0x6727('0x15')](_0x6727('0x1d'),auth['isAuthenticated'](),controller[_0x6727('0x1e')]);router[_0x6727('0x15')]('/:id/users',auth[_0x6727('0x7')](),controller[_0x6727('0x1f')]);router[_0x6727('0x20')](_0x6727('0x21'),auth[_0x6727('0x7')](),controller['update']);router[_0x6727('0x22')](_0x6727('0x21'),auth[_0x6727('0x7')](),controller['destroy']);router['delete'](_0x6727('0x17'),auth[_0x6727('0x7')](),controller[_0x6727('0x23')]);router[_0x6727('0x22')]('/:id/canned_answers',auth[_0x6727('0x7')](),controller['removeAnswers']);router[_0x6727('0x22')](_0x6727('0x13'),auth[_0x6727('0x7')](),controller[_0x6727('0x24')]);module[_0x6727('0x25')]=router; \ No newline at end of file +var _0x1836=['/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','/:id','destroy','delete','removeDispositions','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x538ed3,_0x458b45){var _0xc74828=function(_0x2e8cf9){while(--_0x2e8cf9){_0x538ed3['push'](_0x538ed3['shift']());}};_0xc74828(++_0x458b45);}(_0x1836,0x96));var _0x6183=function(_0x1a566d,_0x305de4){_0x1a566d=_0x1a566d-0x0;var _0x1ccc35=_0x1836[_0x1a566d];return _0x1ccc35;};'use strict';var multer=require(_0x6183('0x0'));var util=require(_0x6183('0x1'));var path=require(_0x6183('0x2'));var timeout=require(_0x6183('0x3'));var express=require(_0x6183('0x4'));var router=express[_0x6183('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6183('0x6'));var config=require(_0x6183('0x7'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0x6183('0x8')](),controller['index']);router[_0x6183('0x9')](_0x6183('0xa'),auth['isAuthenticated'](),controller[_0x6183('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6183('0xc')]);router[_0x6183('0x9')](_0x6183('0xd'),auth[_0x6183('0x8')](),controller[_0x6183('0xe')]);router['get'](_0x6183('0xf'),auth[_0x6183('0x8')](),controller[_0x6183('0x10')]);router[_0x6183('0x9')](_0x6183('0x11'),auth['isAuthenticated'](),controller[_0x6183('0x12')]);router[_0x6183('0x9')](_0x6183('0x13'),auth[_0x6183('0x8')](),controller[_0x6183('0x14')]);router['get'](_0x6183('0x15'),auth[_0x6183('0x8')](),controller[_0x6183('0x16')]);router[_0x6183('0x9')](_0x6183('0x17'),auth[_0x6183('0x8')](),controller['getAgents']);router[_0x6183('0x18')]('/',auth[_0x6183('0x8')](),controller['create']);router[_0x6183('0x18')](_0x6183('0xd'),auth['isAuthenticated'](),controller[_0x6183('0x19')]);router['post'](_0x6183('0xf'),auth[_0x6183('0x8')](),controller[_0x6183('0x1a')]);router[_0x6183('0x18')](_0x6183('0x11'),auth[_0x6183('0x8')](),controller[_0x6183('0x1b')]);router[_0x6183('0x18')]('/:id/applications',auth[_0x6183('0x8')](),controller[_0x6183('0x1c')]);router[_0x6183('0x18')]('/addaccountapplications',auth[_0x6183('0x8')](),controller[_0x6183('0x1d')]);router[_0x6183('0x18')](_0x6183('0x1e'),auth['isAuthenticated'](),controller[_0x6183('0x1f')]);router[_0x6183('0x18')](_0x6183('0x20'),auth[_0x6183('0x8')](),controller['send']);router[_0x6183('0x18')](_0x6183('0x17'),auth[_0x6183('0x8')](),controller[_0x6183('0x21')]);router[_0x6183('0x22')]('/:id',auth[_0x6183('0x8')](),controller[_0x6183('0x23')]);router['delete'](_0x6183('0x24'),auth['isAuthenticated'](),controller[_0x6183('0x25')]);router[_0x6183('0x26')](_0x6183('0xd'),auth[_0x6183('0x8')](),controller[_0x6183('0x27')]);router[_0x6183('0x26')](_0x6183('0xf'),auth[_0x6183('0x8')](),controller['removeAnswers']);router[_0x6183('0x26')](_0x6183('0x17'),auth['isAuthenticated'](),controller['removeAgents']);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 908917d..084699d 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 _0xe47d=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4d2ec7,_0x197ee8){var _0x11853c=function(_0x34ecfd){while(--_0x34ecfd){_0x4d2ec7['push'](_0x4d2ec7['shift']());}};_0x11853c(++_0x197ee8);}(_0xe47d,0x1c5));var _0xde47=function(_0x13cbfb,_0x5b397d){_0x13cbfb=_0x13cbfb-0x0;var _0x2b4439=_0xe47d[_0x13cbfb];return _0x2b4439;};'use strict';var Sequelize=require(_0xde47('0x0'));module[_0xde47('0x1')]={'priority':{'type':Sequelize[_0xde47('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xde47('0x3')],'allowNull':![],'defaultValue':_0xde47('0x4')},'appdata':{'type':Sequelize[_0xde47('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xde47('0x3')],'defaultValue':_0xde47('0x6')}}; \ No newline at end of file +var _0xc6a2=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xc6a2,0x69));var _0x2c6a=function(_0x4502eb,_0x34f778){_0x4502eb=_0x4502eb-0x0;var _0x5e1844=_0xc6a2[_0x4502eb];return _0x5e1844;};'use strict';var Sequelize=require(_0x2c6a('0x0'));module[_0x2c6a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2c6a('0x2')],'allowNull':![],'defaultValue':_0x2c6a('0x3')},'appdata':{'type':Sequelize[_0x2c6a('0x4')]()},'description':{'type':Sequelize[_0x2c6a('0x2')]},'interval':{'type':Sequelize[_0x2c6a('0x2')],'defaultValue':_0x2c6a('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c64c0ca..f4074fa 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 _0xe14b=['options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','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','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL'];(function(_0x1d5dc4,_0x218b6a){var _0x3bf5aa=function(_0x562a7d){while(--_0x562a7d){_0x1d5dc4['push'](_0x1d5dc4['shift']());}};_0x3bf5aa(++_0x218b6a);}(_0xe14b,0x93));var _0xbe14=function(_0x30d605,_0xf7689b){_0x30d605=_0x30d605-0x0;var _0x33d07b=_0xe14b[_0x30d605];return _0x33d07b;};'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'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['FaxApplication'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['FaxApplication'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));}; \ No newline at end of file +var _0x53ec=['stack','name','index','FaxApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','rawAttributes','options','find','catch','create','body','params','destroy','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','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x290e43,_0x3ec0c0){var _0x254e0c=function(_0x341256){while(--_0x341256){_0x290e43['push'](_0x290e43['shift']());}};_0x254e0c(++_0x3ec0c0);}(_0x53ec,0x192));var _0xc53e=function(_0x45fa67,_0x54f9c8){_0x45fa67=_0x45fa67-0x0;var _0x2eddaf=_0x53ec[_0x45fa67];return _0x2eddaf;};'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'];function respondWithStatusCode(_0x9ffbcb,_0x863fa){_0x863fa=_0x863fa||0xcc;return function(_0x4203aa){if(_0x4203aa){return _0x9ffbcb['sendStatus'](_0x863fa);}return _0x9ffbcb['status'](_0x863fa)[_0xc53e('0x16')]();};}function respondWithResult(_0x19a772,_0x7cd798){_0x7cd798=_0x7cd798||0xc8;return function(_0x3d2e17){if(_0x3d2e17){return _0x19a772[_0xc53e('0x17')](_0x7cd798)[_0xc53e('0x18')](_0x3d2e17);}};}function respondWithFilteredResult(_0x3dc2fa,_0x19c0d1){return function(_0x455e4d){if(_0x455e4d){var _0x2ad6eb=_0x455e4d[_0xc53e('0x19')],_0x5b0a88=_0x19c0d1[_0xc53e('0x1a')],_0x8a522e=_0x19c0d1[_0xc53e('0x1a')]+_0x19c0d1[_0xc53e('0x1b')],_0x191567;if(_0x8a522e>=_0x2ad6eb){_0x8a522e=_0x2ad6eb;_0x191567=0xc8;}else{_0x191567=0xce;}_0x3dc2fa[_0xc53e('0x17')](_0x191567);return _0x3dc2fa[_0xc53e('0x1c')](_0xc53e('0x1d'),_0x5b0a88+'-'+_0x8a522e+'/'+_0x2ad6eb)['json'](_0x455e4d);}return null;};}function patchUpdates(_0x546fab){return function(_0x35b7b2){try{jsonpatch[_0xc53e('0x1e')](_0x35b7b2,_0x546fab,!![]);}catch(_0x421641){return BPromise[_0xc53e('0x1f')](_0x421641);}return _0x35b7b2[_0xc53e('0x20')]();};}function saveUpdates(_0x2cfe2b,_0x15a015){return function(_0x25702b){if(_0x25702b){return _0x25702b[_0xc53e('0x21')](_0x2cfe2b)[_0xc53e('0x22')](function(_0x17d825){return _0x17d825;});}return null;};}function removeEntity(_0x44fd93,_0x426467){return function(_0x4fb695){if(_0x4fb695){return _0x4fb695['destroy']()['then'](function(){_0x44fd93[_0xc53e('0x17')](0xcc)[_0xc53e('0x16')]();});}};}function handleEntityNotFound(_0x7591c1,_0x4015c8){return function(_0x180811){if(!_0x180811){_0x7591c1['sendStatus'](0x194);}return _0x180811;};}function handleError(_0x5e5377,_0xe06e42){_0xe06e42=_0xe06e42||0x1f4;return function(_0x496167){logger[_0xc53e('0x23')](_0x496167[_0xc53e('0x24')]);if(_0x496167[_0xc53e('0x25')]){delete _0x496167[_0xc53e('0x25')];}_0x5e5377[_0xc53e('0x17')](_0xe06e42)['send'](_0x496167);};}exports[_0xc53e('0x26')]=function(_0x4b9f6a,_0x4d9a68){var _0x5c65d3={},_0x3c5056={},_0x57a1f5={'count':0x0,'rows':[]};var _0x28240a=_['map'](db[_0xc53e('0x27')]['rawAttributes'],function(_0x5ce216){return{'name':_0x5ce216[_0xc53e('0x28')],'type':_0x5ce216[_0xc53e('0x29')][_0xc53e('0x2a')]};});_0x3c5056[_0xc53e('0x2b')]=_[_0xc53e('0x2c')](_0x28240a,_0xc53e('0x25'));_0x3c5056[_0xc53e('0x2d')]=_[_0xc53e('0x2e')](_0x4b9f6a['query']);_0x3c5056[_0xc53e('0x2f')]=_[_0xc53e('0x30')](_0x3c5056[_0xc53e('0x2b')],_0x3c5056['query']);_0x5c65d3[_0xc53e('0x31')]=_['intersection'](_0x3c5056[_0xc53e('0x2b')],qs[_0xc53e('0x32')](_0x4b9f6a['query']['fields']));_0x5c65d3[_0xc53e('0x31')]=_0x5c65d3[_0xc53e('0x31')][_0xc53e('0x33')]?_0x5c65d3[_0xc53e('0x31')]:_0x3c5056[_0xc53e('0x2b')];if(!_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5c65d3['limit']=qs[_0xc53e('0x1b')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1b')]);_0x5c65d3[_0xc53e('0x1a')]=qs[_0xc53e('0x1a')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1a')]);}_0x5c65d3[_0xc53e('0x36')]=qs[_0xc53e('0x37')](_0x4b9f6a['query'][_0xc53e('0x37')]);_0x5c65d3['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x38')](_0x4b9f6a['query'],_0x3c5056[_0xc53e('0x2f')]),_0x28240a);if(_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]){_0x5c65d3['where']=_[_0xc53e('0x3a')](_0x5c65d3[_0xc53e('0x3b')],{'$or':_[_0xc53e('0x2c')](_0x28240a,function(_0x78eb5e){if(_0x78eb5e[_0xc53e('0x29')]!==_0xc53e('0x3c')){var _0x312c1b={};_0x312c1b[_0x78eb5e['name']]={'$like':'%'+_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]+'%'};return _0x312c1b;}})});}_0x5c65d3=_[_0xc53e('0x3a')]({},_0x5c65d3,_0x4b9f6a['options']);var _0x70b6c3={'where':_0x5c65d3['where']};return db[_0xc53e('0x27')][_0xc53e('0x19')](_0x70b6c3)[_0xc53e('0x22')](function(_0xad1232){_0x57a1f5[_0xc53e('0x19')]=_0xad1232;if(_0x4b9f6a['query'][_0xc53e('0x3d')]){_0x5c65d3[_0xc53e('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5c65d3);})['then'](function(_0x52cf0a){_0x57a1f5[_0xc53e('0x3f')]=_0x52cf0a;return _0x57a1f5;})[_0xc53e('0x22')](respondWithFilteredResult(_0x4d9a68,_0x5c65d3))['catch'](handleError(_0x4d9a68,null));};exports[_0xc53e('0x40')]=function(_0x574983,_0x55d07d){var _0x53447e={'raw':!![],'where':{'id':_0x574983['params']['id']}},_0x255794={};_0x255794['model']=_[_0xc53e('0x2e')](db['FaxApplication'][_0xc53e('0x41')]);_0x255794[_0xc53e('0x2d')]=_['keys'](_0x574983[_0xc53e('0x2d')]);_0x255794[_0xc53e('0x2f')]=_['intersection'](_0x255794[_0xc53e('0x2b')],_0x255794['query']);_0x53447e['attributes']=_['intersection'](_0x255794['model'],qs[_0xc53e('0x32')](_0x574983[_0xc53e('0x2d')][_0xc53e('0x32')]));_0x53447e['attributes']=_0x53447e[_0xc53e('0x31')][_0xc53e('0x33')]?_0x53447e['attributes']:_0x255794['model'];if(_0x574983[_0xc53e('0x2d')][_0xc53e('0x3d')]){_0x53447e[_0xc53e('0x3e')]=[{'all':!![]}];}_0x53447e=_['merge']({},_0x53447e,_0x574983[_0xc53e('0x42')]);return db[_0xc53e('0x27')][_0xc53e('0x43')](_0x53447e)[_0xc53e('0x22')](handleEntityNotFound(_0x55d07d,null))[_0xc53e('0x22')](respondWithResult(_0x55d07d,null))[_0xc53e('0x44')](handleError(_0x55d07d,null));};exports[_0xc53e('0x45')]=function(_0x49b2e8,_0xed757e){return db[_0xc53e('0x27')][_0xc53e('0x45')](_0x49b2e8['body'],{})[_0xc53e('0x22')](respondWithResult(_0xed757e,0xc9))[_0xc53e('0x44')](handleError(_0xed757e,null));};exports[_0xc53e('0x21')]=function(_0x15e744,_0xa7d256){if(_0x15e744[_0xc53e('0x46')]['id']){delete _0x15e744['body']['id'];}return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x15e744[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0xa7d256,null))[_0xc53e('0x22')](saveUpdates(_0x15e744[_0xc53e('0x46')],null))[_0xc53e('0x22')](respondWithResult(_0xa7d256,null))[_0xc53e('0x44')](handleError(_0xa7d256,null));};exports[_0xc53e('0x48')]=function(_0x1ac62e,_0x1a5a8f){return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x1ac62e[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a5a8f,null))[_0xc53e('0x22')](removeEntity(_0x1a5a8f,null))[_0xc53e('0x44')](handleError(_0x1a5a8f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 07805a1..10d404c 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 _0x93c6=['request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x5554a2,_0x2aeb5c){var _0x4af0e4=function(_0x202bb2){while(--_0x202bb2){_0x5554a2['push'](_0x5554a2['shift']());}};_0x4af0e4(++_0x2aeb5c);}(_0x93c6,0xec));var _0x693c=function(_0x28a83b,_0x590948){_0x28a83b=_0x28a83b-0x0;var _0x55b99d=_0x93c6[_0x28a83b];return _0x55b99d;};'use strict';var _=require(_0x693c('0x0'));var util=require('util');var logger=require(_0x693c('0x1'))(_0x693c('0x2'));var moment=require('moment');var BPromise=require(_0x693c('0x3'));var rp=require(_0x693c('0x4'));var fs=require('fs');var path=require(_0x693c('0x5'));var rimraf=require(_0x693c('0x6'));var config=require(_0x693c('0x7'));var attributes=require(_0x693c('0x8'));module[_0x693c('0x9')]=function(_0x2795e3,_0x1f4657){return _0x2795e3['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x693c('0xa'),'collate':_0x693c('0xb')});}; \ No newline at end of file +var _0x180a=['request-promise','path','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x180a,0x89));var _0xa180=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x180a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa180('0x0'));var util=require(_0xa180('0x1'));var logger=require(_0xa180('0x2'))(_0xa180('0x3'));var moment=require(_0xa180('0x4'));var BPromise=require(_0xa180('0x5'));var rp=require(_0xa180('0x6'));var fs=require('fs');var path=require(_0xa180('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa180('0x8'));module[_0xa180('0x9')]=function(_0x10199c,_0x105bee){return _0x10199c[_0xa180('0xa')](_0xa180('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa180('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b731d81..f9f7bba 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 _0x2f4e=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x412e71,_0x51f7d2){var _0x2d0cc6=function(_0xb9a839){while(--_0xb9a839){_0x412e71['push'](_0x412e71['shift']());}};_0x2d0cc6(++_0x51f7d2);}(_0x2f4e,0x68));var _0xe2f4=function(_0x467139,_0x2f8602){_0x467139=_0x467139-0x0;var _0x559a39=_0x2f4e[_0x467139];return _0x559a39;};'use strict';var _=require(_0xe2f4('0x0'));var util=require(_0xe2f4('0x1'));var moment=require(_0xe2f4('0x2'));var BPromise=require(_0xe2f4('0x3'));var rs=require(_0xe2f4('0x4'));var fs=require('fs');var Redis=require(_0xe2f4('0x5'));var db=require(_0xe2f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2f4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2f4('0x8'));var client=jayson['client'][_0xe2f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44595e,_0x2df5a3,_0x3b9f69){return new BPromise(function(_0x6b9b8c,_0x5136f0){return client[_0xe2f4('0xa')](_0x44595e,_0x3b9f69)[_0xe2f4('0xb')](function(_0x3880a8){logger[_0xe2f4('0xc')](_0xe2f4('0xd'),_0x2df5a3,_0xe2f4('0xe'));logger[_0xe2f4('0xf')](_0xe2f4('0x10'),_0x2df5a3,'request\x20sent',JSON[_0xe2f4('0x11')](_0x3880a8));if(_0x3880a8[_0xe2f4('0x12')]){if(_0x3880a8['error'][_0xe2f4('0x13')]===0x1f4){logger['error'](_0xe2f4('0xd'),_0x2df5a3,_0x3880a8[_0xe2f4('0x12')][_0xe2f4('0x14')]);return _0x5136f0(_0x3880a8[_0xe2f4('0x12')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2df5a3,_0x3880a8[_0xe2f4('0x12')][_0xe2f4('0x14')]);return _0x6b9b8c(_0x3880a8[_0xe2f4('0x12')][_0xe2f4('0x14')]);}else{logger['info'](_0xe2f4('0xd'),_0x2df5a3,_0xe2f4('0xe'));_0x6b9b8c(_0x3880a8['result'][_0xe2f4('0x14')]);}})[_0xe2f4('0x15')](function(_0x1407b2){logger[_0xe2f4('0x12')](_0xe2f4('0xd'),_0x2df5a3,_0x1407b2);_0x5136f0(_0x1407b2);});});}exports['UpdateFaxApplication']=function(_0x274cd3){var _0xa37bcd=this;return new Promise(function(_0x5240f6,_0x1717fb){return db[_0xe2f4('0x16')]['update'](_0x274cd3[_0xe2f4('0x17')],{'raw':_0x274cd3[_0xe2f4('0x18')]?_0x274cd3[_0xe2f4('0x18')][_0xe2f4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x274cd3[_0xe2f4('0x18')]?_0x274cd3[_0xe2f4('0x18')][_0xe2f4('0x1a')]||null:null,'attributes':_0x274cd3[_0xe2f4('0x18')]?_0x274cd3[_0xe2f4('0x18')][_0xe2f4('0x1b')]||null:null,'limit':_0x274cd3[_0xe2f4('0x18')]?_0x274cd3[_0xe2f4('0x18')][_0xe2f4('0x1c')]||null:null})['then'](function(_0x57ed22){logger[_0xe2f4('0xc')](_0xe2f4('0x1d'),_0x274cd3);logger[_0xe2f4('0xf')](_0xe2f4('0x1d'),_0x274cd3,JSON[_0xe2f4('0x11')](_0x57ed22));_0x5240f6(_0x57ed22);})['catch'](function(_0x562dc1){logger[_0xe2f4('0x12')]('UpdateFaxApplication',_0x562dc1[_0xe2f4('0x14')],_0x274cd3);_0x1717fb(_0xa37bcd['error'](0x1f4,_0x562dc1[_0xe2f4('0x14')]));});});}; \ No newline at end of file +var _0xd44c=['http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateFaxApplication','update','body','raw','options','where','attributes','limit','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26d741,_0x18409b){var _0x564540=function(_0x23250b){while(--_0x23250b){_0x26d741['push'](_0x26d741['shift']());}};_0x564540(++_0x18409b);}(_0xd44c,0xc9));var _0xcd44=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0xd44c[_0x4706a6];return _0x1bb705;};'use strict';var _=require(_0xcd44('0x0'));var util=require(_0xcd44('0x1'));var moment=require(_0xcd44('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd44('0x3'));var db=require(_0xcd44('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd44('0x5'))(_0xcd44('0x6'));var config=require(_0xcd44('0x7'));var jayson=require(_0xcd44('0x8'));var client=jayson['client'][_0xcd44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x949940,_0x38d9c8,_0x7ba692){return new BPromise(function(_0x5c8e08,_0x9a4291){return client[_0xcd44('0xa')](_0x949940,_0x7ba692)[_0xcd44('0xb')](function(_0x366487){logger['info'](_0xcd44('0xc'),_0x38d9c8,_0xcd44('0xd'));logger[_0xcd44('0xe')](_0xcd44('0xf'),_0x38d9c8,_0xcd44('0xd'),JSON['stringify'](_0x366487));if(_0x366487[_0xcd44('0x10')]){if(_0x366487['error'][_0xcd44('0x11')]===0x1f4){logger[_0xcd44('0x10')](_0xcd44('0xc'),_0x38d9c8,_0x366487[_0xcd44('0x10')][_0xcd44('0x12')]);return _0x9a4291(_0x366487[_0xcd44('0x10')][_0xcd44('0x12')]);}logger[_0xcd44('0x10')]('FaxApplication,\x20%s,\x20%s',_0x38d9c8,_0x366487['error']['message']);return _0x5c8e08(_0x366487['error']['message']);}else{logger[_0xcd44('0x13')](_0xcd44('0xc'),_0x38d9c8,'request\x20sent');_0x5c8e08(_0x366487[_0xcd44('0x14')]['message']);}})['catch'](function(_0x56d0a0){logger[_0xcd44('0x10')](_0xcd44('0xc'),_0x38d9c8,_0x56d0a0);_0x9a4291(_0x56d0a0);});});}exports[_0xcd44('0x15')]=function(_0xcf7cfc){var _0x43e780=this;return new Promise(function(_0x34af75,_0x3382de){return db['FaxApplication'][_0xcd44('0x16')](_0xcf7cfc[_0xcd44('0x17')],{'raw':_0xcf7cfc['options']?_0xcf7cfc['options'][_0xcd44('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf7cfc[_0xcd44('0x19')]?_0xcf7cfc[_0xcd44('0x19')][_0xcd44('0x1a')]||null:null,'attributes':_0xcf7cfc[_0xcd44('0x19')]?_0xcf7cfc['options'][_0xcd44('0x1b')]||null:null,'limit':_0xcf7cfc['options']?_0xcf7cfc[_0xcd44('0x19')][_0xcd44('0x1c')]||null:null})[_0xcd44('0xb')](function(_0x2d7cb2){logger[_0xcd44('0x13')](_0xcd44('0x15'),_0xcf7cfc);logger['debug'](_0xcd44('0x15'),_0xcf7cfc,JSON[_0xcd44('0x1d')](_0x2d7cb2));_0x34af75(_0x2d7cb2);})['catch'](function(_0x20f2c0){logger[_0xcd44('0x10')](_0xcd44('0x15'),_0x20f2c0['message'],_0xcf7cfc);_0x3382de(_0x43e780[_0xcd44('0x10')](0x1f4,_0x20f2c0[_0xcd44('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b2a0c4a..011c7b0 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 _0xf2ca=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x128ac0,_0x27d016){var _0x30027d=function(_0x34fa70){while(--_0x34fa70){_0x128ac0['push'](_0x128ac0['shift']());}};_0x30027d(++_0x27d016);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xf2ca[_0x54f7c0];return _0x245d03;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router['put'](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0x10')]);router[_0xaf2c('0x11')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ef6=['Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x16aab6,_0xcfa21){var _0x4a0618=function(_0x2fff29){while(--_0x2fff29){_0x16aab6['push'](_0x16aab6['shift']());}};_0x4a0618(++_0xcfa21);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1894f7,_0x4e4fa6){_0x1894f7=_0x1894f7-0x0;var _0x3784dd=_0x8ef6[_0x1894f7];return _0x3784dd;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['post']('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0xd')]);router[_0x68ef('0xe')](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xf')]);router[_0x68ef('0x10')](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x11')]);module[_0x68ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index bb8eceb..e464d14 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 _0xb1d2=['out','sequelize','STRING','DATE','ENUM'];(function(_0x2c7095,_0xbe1c5f){var _0x3a1290=function(_0x146047){while(--_0x146047){_0x2c7095['push'](_0x2c7095['shift']());}};_0x3a1290(++_0xbe1c5f);}(_0xb1d2,0x7e));var _0x2b1d=function(_0x21ab19,_0x542dfe){_0x21ab19=_0x21ab19-0x0;var _0x5b438b=_0xb1d2[_0x21ab19];return _0x5b438b;};'use strict';var Sequelize=require(_0x2b1d('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2b1d('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2b1d('0x2')]},'fax':{'type':Sequelize[_0x2b1d('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x2b1d('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2b1d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2b1d('0x3')]('in',_0x2b1d('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4977=['sequelize','exports','DATE','STRING','out','ENUM'];(function(_0x47c28c,_0x52f17e){var _0x13c2ec=function(_0xf21752){while(--_0xf21752){_0x47c28c['push'](_0x47c28c['shift']());}};_0x13c2ec(++_0x52f17e);}(_0x4977,0x19e));var _0x7497=function(_0x29de81,_0x19f061){_0x29de81=_0x29de81-0x0;var _0x3c4d2e=_0x4977[_0x29de81];return _0x3c4d2e;};'use strict';var Sequelize=require(_0x7497('0x0'));module[_0x7497('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7497('0x2')]},'disposition':{'type':Sequelize[_0x7497('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7497('0x2')]},'fax':{'type':Sequelize[_0x7497('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7497('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7497('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7497('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index dbef55a..ccac820 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 _0x94df=['catch','index','FaxInteraction','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','select','field','name','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$substring','value','split','length','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','start','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','groupBy','FaxInteractionId','push','all','rows','show','params','rawAttributes','includeAll','merge','options','create','body','describe','addMessage','ids','getMessages','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','FaxMessage','findAll','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','Users','map','fullname','Tags','TagIds'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x94df,0xa3));var _0xf94d=function(_0x3fb24e,_0x2eb5db){_0x3fb24e=_0x3fb24e-0x0;var _0x48cbce=_0x94df[_0x3fb24e];return _0x48cbce;};'use strict';var pdf=require(_0xf94d('0x0'));var emlformat=require(_0xf94d('0x1'));var rimraf=require(_0xf94d('0x2'));var zipdir=require(_0xf94d('0x3'));var jsonpatch=require(_0xf94d('0x4'));var rp=require(_0xf94d('0x5'));var moment=require('moment');var BPromise=require(_0xf94d('0x6'));var Mustache=require(_0xf94d('0x7'));var util=require(_0xf94d('0x8'));var path=require(_0xf94d('0x9'));var sox=require(_0xf94d('0xa'));var csv=require(_0xf94d('0xb'));var ejs=require(_0xf94d('0xc'));var fs=require('fs');var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xb'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf94d('0x1b')](config[_0xf94d('0x1c')],{'host':_0xf94d('0x1d'),'port':0x18eb});var socket=require(_0xf94d('0x1e'))(new Redis(config[_0xf94d('0x1c')]));require(_0xf94d('0x1f'))['register'](socket);function respondWithStatusCode(_0x596da8,_0x36ff94){_0x36ff94=_0x36ff94||0xcc;return function(_0x17234f){if(_0x17234f){return _0x596da8[_0xf94d('0x20')](_0x36ff94);}return _0x596da8[_0xf94d('0x21')](_0x36ff94)[_0xf94d('0x22')]();};}function respondWithResult(_0x14020b,_0x2c557b){_0x2c557b=_0x2c557b||0xc8;return function(_0x4fa8bf){if(_0x4fa8bf){return _0x14020b[_0xf94d('0x21')](_0x2c557b)['json'](_0x4fa8bf);}};}function respondWithFilteredResult(_0x192a58,_0x4c6ef6){return function(_0x29f4bc){if(_0x29f4bc){var _0x559e0c=_0x29f4bc[_0xf94d('0x23')],_0x30d231=_0x4c6ef6['offset'],_0x3bf001=_0x4c6ef6[_0xf94d('0x24')]+_0x4c6ef6['limit'],_0x510eef;if(_0x3bf001>=_0x559e0c){_0x3bf001=_0x559e0c;_0x510eef=0xc8;}else{_0x510eef=0xce;}_0x192a58[_0xf94d('0x21')](_0x510eef);return _0x192a58[_0xf94d('0x25')](_0xf94d('0x26'),_0x30d231+'-'+_0x3bf001+'/'+_0x559e0c)[_0xf94d('0x27')](_0x29f4bc);}return null;};}function patchUpdates(_0x5f261c){return function(_0x4325ff){try{jsonpatch['apply'](_0x4325ff,_0x5f261c,!![]);}catch(_0x39f75d){return BPromise[_0xf94d('0x28')](_0x39f75d);}return _0x4325ff[_0xf94d('0x29')]();};}function saveUpdates(_0x56e5f5,_0x3f6b24){return function(_0x8f50){if(_0x8f50){return _0x8f50[_0xf94d('0x2a')](_0x56e5f5)[_0xf94d('0x2b')](function(_0x47470d){return _0x47470d;});}return null;};}function removeEntity(_0x533714,_0x301d2e){return function(_0x51f7f8){if(_0x51f7f8){return _0x51f7f8[_0xf94d('0x2c')]()[_0xf94d('0x2b')](function(){_0x533714[_0xf94d('0x21')](0xcc)[_0xf94d('0x22')]();});}};}function handleEntityNotFound(_0x997b6c,_0x1c4bdf){return function(_0x2804dc){if(!_0x2804dc){_0x997b6c[_0xf94d('0x20')](0x194);}return _0x2804dc;};}function handleError(_0x3c9fe3,_0x13c229){_0x13c229=_0x13c229||0x1f4;return function(_0x18ccd7){logger[_0xf94d('0x2d')](_0x18ccd7[_0xf94d('0x2e')]);if(_0x18ccd7['name']){delete _0x18ccd7['name'];}_0x3c9fe3['status'](_0x13c229)['send'](_0x18ccd7);};}function getInteractionUsers(_0xbb4a6,_0x1e8242){return new BPromise(function(_0x56ab8c,_0x167585){try{if(_0x1e8242[_0xbb4a6['id']]){_0xbb4a6[_0xf94d('0x2f')]=_[_0xf94d('0x30')](_0x1e8242[_0xbb4a6['id']],function(_0x59c273){return{'id':_0x59c273['id'],'fullname':_0x59c273[_0xf94d('0x31')]};});}}catch(_0x5ab0c8){_0x167585(_0x5ab0c8);}_0x56ab8c(_0xbb4a6);});}function getInteractionTags(_0x1b46d6,_0x1d15c5){return new BPromise(function(_0x51b69a,_0x2378b0){try{if(_0x1b46d6['TagIds']){_0x1b46d6[_0xf94d('0x32')]=[];_0x1b46d6['TagIds']['split'](',')['forEach'](function(_0x20a270){_0x1b46d6[_0xf94d('0x32')]['push'](_0x1d15c5[_0x20a270]);});}delete _0x1b46d6[_0xf94d('0x33')];}catch(_0x5619d5){_0x2378b0(_0x5619d5);}_0x51b69a(_0x1b46d6);});}function updateFaxInteraction(_0x42a266,_0x251608,_0x56bfa4){return new BPromise(function(_0x458f27,_0x496157){return getInteractionUsers(_0x42a266,_0x56bfa4)[_0xf94d('0x2b')](function(_0x4c702d){return getInteractionTags(_0x4c702d,_0x251608);})[_0xf94d('0x2b')](function(_0x48c214){_0x458f27(_0x48c214);})[_0xf94d('0x34')](function(_0x1ada36){_0x496157(_0x1ada36);});});}exports[_0xf94d('0x35')]=function(_0x162163,_0x580939){var _0x5c9b2e={},_0x4e2427={},_0x40c2ab={'count':0x0,'rows':[]};var _0x3f9f3d=_[_0xf94d('0x30')](db[_0xf94d('0x36')]['rawAttributes'],function(_0x47efbc){return{'name':_0x47efbc['fieldName'],'type':_0x47efbc[_0xf94d('0x37')][_0xf94d('0x38')]};});_0x4e2427[_0xf94d('0x39')]=_[_0xf94d('0x30')](_0x3f9f3d,'name');_0x4e2427[_0xf94d('0x3a')]=_[_0xf94d('0x3b')](_0x162163[_0xf94d('0x3a')]);_0x4e2427[_0xf94d('0x3c')]=_['intersection'](_0x4e2427[_0xf94d('0x39')],_0x4e2427[_0xf94d('0x3a')]);_0x5c9b2e[_0xf94d('0x3d')]=_[_0xf94d('0x3e')](_0x4e2427[_0xf94d('0x39')],qs[_0xf94d('0x3f')](_0x162163[_0xf94d('0x3a')][_0xf94d('0x3f')]));_0x5c9b2e[_0xf94d('0x3d')]=_0x5c9b2e[_0xf94d('0x3d')]['length']?_0x5c9b2e['attributes']:_0x4e2427[_0xf94d('0x39')];if(!_0x162163['query'][_0xf94d('0x40')]('nolimit')){_0x5c9b2e[_0xf94d('0x41')]=qs[_0xf94d('0x41')](_0x162163[_0xf94d('0x3a')][_0xf94d('0x41')]);_0x5c9b2e[_0xf94d('0x24')]=qs['offset'](_0x162163[_0xf94d('0x3a')]['offset']);}_0x5c9b2e[_0xf94d('0x42')]=qs['sort'](_0x162163[_0xf94d('0x3a')][_0xf94d('0x43')]);_0x5c9b2e[_0xf94d('0x44')]=qs[_0xf94d('0x3c')](_[_0xf94d('0x45')](_0x162163[_0xf94d('0x3a')],_0x4e2427[_0xf94d('0x3c')]),_0x3f9f3d);var _0x598e2b=[];var _0x36ac14=squel[_0xf94d('0x46')]()[_0xf94d('0x47')]('id')['field'](_0xf94d('0x48'))[_0xf94d('0x47')](_0xf94d('0x49'))[_0xf94d('0x4a')](_0xf94d('0x4b'));var _0x30b99b=squel[_0xf94d('0x46')]()['field'](_0xf94d('0x4c'))[_0xf94d('0x47')](_0xf94d('0x4d'))[_0xf94d('0x47')](_0xf94d('0x4e'))[_0xf94d('0x4a')]('user_has_fax_interactions','ui')['left_join'](_0xf94d('0x4f'),'u',_0xf94d('0x50'));var _0x3f661d=squel[_0xf94d('0x46')]()[_0xf94d('0x4a')]('fax_interactions','i')[_0xf94d('0x51')]('cm_contacts','c',_0xf94d('0x52'))[_0xf94d('0x51')](_0xf94d('0x4f'),'o',_0xf94d('0x53'))[_0xf94d('0x51')]('fax_accounts','a',_0xf94d('0x54'))[_0xf94d('0x51')](_0xf94d('0x55'),'me',_0xf94d('0x56'))['left_join'](_0xf94d('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0xf94d('0x4b'),'t',_0xf94d('0x58'));var _0x38d70d=squel['expr']();var _0x336a47=[];var _0x560a26=squel[_0xf94d('0x59')]();var _0xb1b984;if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x5a')]){_0xb1b984=as[_0xf94d('0x5b')](_0x162163[_0xf94d('0x3a')]['search']);var _0x213c7=_0xb1b984[_0xf94d('0x5c')];for(var _0x3b63da=0x0;_0x3b63da<_0xb1b984[_0xf94d('0x5d')]['length'];_0x3b63da++){var _0x48c00b=_0xb1b984['conditions'][_0x3b63da];var _0x3072c4='i';var _0x4ee9b4=_[_0xf94d('0x5e')](_0x3f9f3d,[_0xf94d('0x48'),_0x48c00b[_0xf94d('0x47')]]);if(!_0x4ee9b4){switch(_0x48c00b[_0xf94d('0x47')]){case _0xf94d('0x5f'):if(_0x48c00b['value']==0x1){_0x3f661d['having']('`'+_0x48c00b[_0xf94d('0x47')]+_0xf94d('0x60'));}else{_0x3f661d[_0xf94d('0x61')]('`'+_0x48c00b[_0xf94d('0x47')]+_0xf94d('0x62'));}break;case _0xf94d('0x63'):if(_0x48c00b['operator']===_0xf94d('0x64')){if(_0x48c00b[_0xf94d('0x65')][_0xf94d('0x66')]('\x20')[_0xf94d('0x67')]>0x1){_0x38d70d[_0x213c7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x48c00b[_0xf94d('0x65')]),null);}else{var _0x404b06='%'+_0x48c00b[_0xf94d('0x65')]+'%';_0x38d70d[_0x213c7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x404b06,_0x404b06,_0x404b06);}}else{_0x4ee9b4=_[_0xf94d('0x5e')](_0x3f9f3d,[_0xf94d('0x48'),_0xf94d('0x68')]);_0x48c00b[_0xf94d('0x47')]=_0xf94d('0x68');_0x28123e=as[_0xf94d('0x69')](_0x3072c4,_0x4ee9b4[_0xf94d('0x37')],_0x48c00b);_0x38d70d[_0x213c7](_0x28123e[_0xf94d('0x6a')],_0x28123e[_0xf94d('0x65')]['start'],_0x28123e[_0xf94d('0x65')]['end']);}break;case _0xf94d('0x6b'):var _0x4c8812=_0x48c00b[_0xf94d('0x65')][_0xf94d('0x66')](',')[_0xf94d('0x30')](function(_0x596797){return Number(_0x596797);});_0x4c8812[_0xf94d('0x6c')](function(_0x3a55e9){_0x560a26['or'](_0xf94d('0x6d'),'%,'+_0x3a55e9+',%');});_0x336a47=_[_0xf94d('0x6e')](_0x336a47,_0x4c8812);break;case'User':if(_0x48c00b['operator']===_0xf94d('0x64')){_0x38d70d[_0x213c7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x48c00b['value']+'%',null);}else{_0x4ee9b4=_[_0xf94d('0x5e')](_0x3f9f3d,[_0xf94d('0x48'),'UserId']);_0x48c00b[_0xf94d('0x47')]='UserId';_0x28123e=as['buildExpression'](_0x3072c4,_0x4ee9b4['type'],_0x48c00b);_0x38d70d[_0x213c7](_0x28123e[_0xf94d('0x6a')],_0x28123e['value'][_0xf94d('0x6f')],_0x28123e['value']['end']);}break;case'body':_0x28123e=as[_0xf94d('0x69')]('me',null,_0x48c00b);_0x38d70d[_0x213c7](_0x28123e['text'],_0x28123e['value'][_0xf94d('0x6f')],_0x28123e['value'][_0xf94d('0x22')]);break;}}else{var _0x28123e=as['buildExpression'](_0x3072c4,_0x4ee9b4[_0xf94d('0x37')],_0x48c00b);_0x38d70d[_0x213c7](_0x28123e['text'],_0x28123e['value'][_0xf94d('0x6f')],_0x28123e['value'][_0xf94d('0x22')]);}}}else{var _0x2f349f=_(_0x162163[_0xf94d('0x3a')])[_0xf94d('0x3b')]()['map'](function(_0x298f33){return _[_0xf94d('0x70')](_0x3f9f3d,[_0xf94d('0x48'),_0x298f33])?_0x298f33:undefined;})[_0xf94d('0x71')]()[_0xf94d('0x65')]();if(!_[_0xf94d('0x72')](_0x2f349f)){_0x2f349f['forEach'](function(_0x294063){if(_0x294063===_0xf94d('0x73')){_0x3f661d[_0xf94d('0x44')](_0xf94d('0x74'),[][_0xf94d('0x75')](_0x162163['query'][_0x294063]));}else if(_0x294063===_0xf94d('0x76')){var _0x2ac022=JSON[_0xf94d('0x77')](_0x162163[_0xf94d('0x3a')][_0x294063])['$gte'];var _0x17de08=JSON[_0xf94d('0x77')](_0x162163[_0xf94d('0x3a')][_0x294063])[_0xf94d('0x78')];_0x3f661d[_0xf94d('0x44')](_0xf94d('0x79'),_0x2ac022,_0x17de08);}else{if(_0x162163[_0xf94d('0x3a')][_0x294063]===_0xf94d('0x7a')){_0x3f661d[_0xf94d('0x44')]('i.'+_0x294063+_0xf94d('0x7b'));}else{_0x3f661d[_0xf94d('0x44')]('i.'+_0x294063+_0xf94d('0x7c'),_0x162163[_0xf94d('0x3a')][_0x294063]);}}});}if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x7d')]){if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x7d')]==0x1){_0x3f661d[_0xf94d('0x61')](_0xf94d('0x7e'));}else{_0x3f661d[_0xf94d('0x61')](_0xf94d('0x7f'));}}if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x80')]){_0x336a47=_['isArray'](_0x162163['query'][_0xf94d('0x80')])?_0x162163[_0xf94d('0x3a')][_0xf94d('0x80')]:new Array(_0x162163[_0xf94d('0x3a')]['tag']);_0x336a47[_0xf94d('0x6c')](function(_0x14bfae){_0x560a26['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14bfae+',%');});}if(_0x162163[_0xf94d('0x3a')]['filter']){var _0x4383dd=_0x162163[_0xf94d('0x3a')][_0xf94d('0x81')][_0xf94d('0x82')]('\x5c','\x5c\x5c')[_0xf94d('0x82')]('\x27\x27',_0xf94d('0x83'));if(qs[_0xf94d('0x84')](_0x4383dd)){_0x38d70d['or'](_0xf94d('0x85'),_0x4383dd+'%')['or']('i.fax\x20LIKE\x20?',_0x4383dd+'%');}_0x38d70d['or'](_0xf94d('0x86'),_0x4383dd+'%');}}_0x3f661d[_0xf94d('0x44')](_0x38d70d);_0x3f661d[_0xf94d('0x87')](_0xf94d('0x88'));var _0x326177={'type':db[_0xf94d('0x89')][_0xf94d('0x8a')][_0xf94d('0x8b')],'raw':!![]};var _0x52fda4=_0x3f661d[_0xf94d('0x8c')]();_0x52fda4[_0xf94d('0x47')]('i.id');_0x52fda4[_0xf94d('0x47')](_0xf94d('0x8d'),_0xf94d('0x5f'));if(_0x5c9b2e['order']){_0x5c9b2e['order'][_0xf94d('0x6c')](function(_0x184153){_0x3f661d[_0xf94d('0x42')]('i.'+_0x184153[0x0],_0x184153[0x1]===_0xf94d('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x336a47)){_0x3f661d[_0xf94d('0x61')](_0x560a26);_0x52fda4[_0xf94d('0x44')](_0xf94d('0x8f'),_0x336a47);}BPromise[_0xf94d('0x90')]()['then'](function(){if(!_0xb1b984){if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x73')]||_0x162163[_0xf94d('0x3a')][_0xf94d('0x91')])return;_0x52fda4[_0xf94d('0x44')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3f661d[_0xf94d('0x44')](_0xf94d('0x92'));return;}return _0x162163['user'][_0xf94d('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x19cad4){if(_[_0xf94d('0x72')](_0x19cad4)){_0x52fda4[_0xf94d('0x44')](_0xf94d('0x94'));_0x3f661d[_0xf94d('0x44')](_0xf94d('0x94'));}else{_0x52fda4[_0xf94d('0x44')](_0xf94d('0x74'),_[_0xf94d('0x30')](_0x19cad4,'id'));_0x3f661d[_0xf94d('0x44')](_0xf94d('0x74'),_[_0xf94d('0x30')](_0x19cad4,'id'));}});})['then'](function(){db[_0xf94d('0x95')][_0xf94d('0x3a')](_0x52fda4[_0xf94d('0x96')](),_0x326177)[_0xf94d('0x2b')](function(_0x15f5b9){_0x40c2ab[_0xf94d('0x23')]=_0x15f5b9[_0xf94d('0x67')];if(_0x40c2ab[_0xf94d('0x23')]===0x0)return[];return db[_0xf94d('0x95')][_0xf94d('0x3a')](_0x36ac14[_0xf94d('0x96')](),_0x326177)[_0xf94d('0x2b')](function(_0x40438e){_0x598e2b=_['keyBy'](_0x40438e,'id');_0x326177=_['merge'](_0x326177,{'model':db[_0xf94d('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x162163[_0xf94d('0x3a')][_0xf94d('0x3f')]){_0x5c9b2e['attributes']['forEach'](function(_0x2fc907){_0x3f661d[_0xf94d('0x47')]('i.'+_0x2fc907);});}else{_0x3f661d[_0xf94d('0x47')](_0xf94d('0x8d'),'unreadMessages');_0x3f661d['field'](_0xf94d('0x97'),_0xf94d('0x98'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0x99'),_0xf94d('0x9a'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0x9b'));_0x3f661d['field']('c.firstName','Contact.firstName');_0x3f661d[_0xf94d('0x47')](_0xf94d('0x9c'),_0xf94d('0x9d'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0x9e'),_0xf94d('0x9f'));_0x3f661d[_0xf94d('0x47')]('c.phone',_0xf94d('0xa0'));_0x3f661d[_0xf94d('0x47')]('c.mobile',_0xf94d('0xa1'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0xa2'),_0xf94d('0xa3'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0xa4'),_0xf94d('0xa5'));_0x3f661d[_0xf94d('0x47')](_0xf94d('0xa6'),'Owner.internal');_0x3f661d[_0xf94d('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5c9b2e['limit'])_0x3f661d['limit'](_0x5c9b2e[_0xf94d('0x41')]);if(_0x5c9b2e[_0xf94d('0x24')])_0x3f661d[_0xf94d('0x24')](_0x5c9b2e['offset']);return db['sequelize'][_0xf94d('0x3a')](_0x3f661d[_0xf94d('0x96')](),_0x326177);})[_0xf94d('0x2b')](function(_0x4c19ce){_0x30b99b['where']('ui.FaxInteractionId\x20IN\x20?',_[_0xf94d('0x30')](_0x4c19ce,'id'));return db[_0xf94d('0x95')][_0xf94d('0x3a')](_0x30b99b[_0xf94d('0x96')](),_0x326177)[_0xf94d('0x2b')](function(_0x373b71){var _0x1e2e99=_[_0xf94d('0xa7')](_0x373b71,_0xf94d('0xa8'));var _0x34649a=[];_0x4c19ce[_0xf94d('0x6c')](function(_0x57b9d9){_0x34649a[_0xf94d('0xa9')](updateFaxInteraction(_0x57b9d9,_0x598e2b,_0x1e2e99));});return BPromise[_0xf94d('0xaa')](_0x34649a);});});})[_0xf94d('0x2b')](function(_0x6f28a1){_0x40c2ab[_0xf94d('0xab')]=_0x6f28a1;return _0x40c2ab;})[_0xf94d('0x2b')](respondWithFilteredResult(_0x580939,_0x5c9b2e));})[_0xf94d('0x34')](handleError(_0x580939,null));};exports[_0xf94d('0xac')]=function(_0x4f24db,_0x17c48d){var _0x38ba32={'raw':![],'where':{'id':_0x4f24db[_0xf94d('0xad')]['id']}},_0x387f9e={};_0x387f9e['model']=_[_0xf94d('0x3b')](db[_0xf94d('0x36')][_0xf94d('0xae')]);_0x387f9e['query']=_[_0xf94d('0x3b')](_0x4f24db['query']);_0x387f9e[_0xf94d('0x3c')]=_[_0xf94d('0x3e')](_0x387f9e[_0xf94d('0x39')],_0x387f9e[_0xf94d('0x3a')]);_0x38ba32[_0xf94d('0x3d')]=_[_0xf94d('0x3e')](_0x387f9e['model'],qs[_0xf94d('0x3f')](_0x4f24db[_0xf94d('0x3a')][_0xf94d('0x3f')]));_0x38ba32['attributes']=_0x38ba32[_0xf94d('0x3d')]['length']?_0x38ba32['attributes']:_0x387f9e['model'];if(_0x4f24db[_0xf94d('0x3a')][_0xf94d('0xaf')]){_0x38ba32['include']=[{'all':!![]}];}_0x38ba32=_[_0xf94d('0xb0')]({},_0x38ba32,_0x4f24db[_0xf94d('0xb1')]);return db[_0xf94d('0x36')][_0xf94d('0x5e')](_0x38ba32)[_0xf94d('0x2b')](handleEntityNotFound(_0x17c48d,null))[_0xf94d('0x2b')](respondWithResult(_0x17c48d,null))[_0xf94d('0x34')](handleError(_0x17c48d,null));};exports['create']=function(_0x4744e4,_0x2b4d21){return db['FaxInteraction'][_0xf94d('0xb2')](_0x4744e4[_0xf94d('0xb3')],{})[_0xf94d('0x2b')](respondWithResult(_0x2b4d21,0xc9))[_0xf94d('0x34')](handleError(_0x2b4d21,null));};exports[_0xf94d('0x2a')]=function(_0x3f1c48,_0x13add1){if(_0x3f1c48['body']['id']){delete _0x3f1c48['body']['id'];}return db['FaxInteraction'][_0xf94d('0x5e')]({'where':{'id':_0x3f1c48['params']['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x13add1,null))[_0xf94d('0x2b')](saveUpdates(_0x3f1c48[_0xf94d('0xb3')],null))[_0xf94d('0x2b')](respondWithResult(_0x13add1,null))['catch'](handleError(_0x13add1,null));};exports['destroy']=function(_0x256409,_0x1be14a){return db[_0xf94d('0x36')]['find']({'where':{'id':_0x256409[_0xf94d('0xad')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x1be14a,null))['then'](removeEntity(_0x1be14a,null))[_0xf94d('0x34')](handleError(_0x1be14a,null));};exports[_0xf94d('0xb4')]=function(_0x1a87d7,_0xd41ebf){return db[_0xf94d('0x36')][_0xf94d('0xb4')]()[_0xf94d('0x2b')](respondWithResult(_0xd41ebf,null))[_0xf94d('0x34')](handleError(_0xd41ebf,null));};exports[_0xf94d('0xb5')]=function(_0x12df5d,_0x56c413,_0x1ba7a1){return db['FaxMessage'][_0xf94d('0x5e')]({'where':{'id':_0x12df5d[_0xf94d('0xad')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x56c413,null))[_0xf94d('0x2b')](function(_0x188a91){if(_0x188a91){return _0x188a91['addMessage'](_0x12df5d[_0xf94d('0xb3')][_0xf94d('0xb6')],_['omit'](_0x12df5d[_0xf94d('0xb3')],[_0xf94d('0xb6'),'id'])||{});}})[_0xf94d('0x2b')](respondWithResult(_0x56c413,null))['catch'](handleError(_0x56c413,null));};exports[_0xf94d('0xb7')]=function(_0x371d77,_0x1b5d77,_0x4301da){var _0x29f8d5={'raw':![],'where':{}};var _0x190db3={};var _0x51defc={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xf94d('0xb8')]({'where':{'id':_0x371d77[_0xf94d('0xad')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x1b5d77,null))[_0xf94d('0x2b')](function(_0x30f591){if(_0x30f591){_0x190db3[_0xf94d('0x39')]=_[_0xf94d('0x3b')](db['FaxMessage']['rawAttributes']);_0x190db3[_0xf94d('0x3a')]=_[_0xf94d('0x3b')](_0x371d77['query']);_0x190db3[_0xf94d('0x3c')]=_[_0xf94d('0x3e')](_0x190db3['model'],_0x190db3[_0xf94d('0x3a')]);_0x29f8d5[_0xf94d('0x3d')]=_[_0xf94d('0x3e')](_0x190db3[_0xf94d('0x39')],qs[_0xf94d('0x3f')](_0x371d77['query']['fields']));_0x29f8d5[_0xf94d('0x3d')]=_0x29f8d5['attributes']['length']?_0x29f8d5[_0xf94d('0x3d')]:_0x190db3[_0xf94d('0x39')];if(!_0x371d77[_0xf94d('0x3a')][_0xf94d('0x40')](_0xf94d('0xb9'))){_0x29f8d5[_0xf94d('0x41')]=qs[_0xf94d('0x41')](_0x371d77[_0xf94d('0x3a')]['limit']);_0x29f8d5[_0xf94d('0x24')]=qs['offset'](_0x371d77['query'][_0xf94d('0x24')]);}_0x29f8d5['order']=qs[_0xf94d('0x43')](_0x371d77[_0xf94d('0x3a')][_0xf94d('0x43')]);_0x29f8d5[_0xf94d('0x44')]=qs[_0xf94d('0x3c')](_[_0xf94d('0x45')](_0x371d77['query'],_0x190db3[_0xf94d('0x3c')]));_0x29f8d5[_0xf94d('0x44')][_0xf94d('0xa8')]=_0x30f591['id'];if(_0x371d77[_0xf94d('0x3a')][_0xf94d('0x81')]){_0x29f8d5[_0xf94d('0x44')]=_[_0xf94d('0xb0')](_0x29f8d5['where'],{'$or':_['map'](_0x29f8d5[_0xf94d('0x3d')],function(_0x58f6e8){var _0x403733={};_0x403733[_0x58f6e8]={'$like':'%'+_0x371d77[_0xf94d('0x3a')][_0xf94d('0x81')]+'%'};return _0x403733;})});}if(_0x371d77['query'][_0xf94d('0xba')]){var _0x32ce1f=_0x371d77['query'][_0xf94d('0xba')]['split'](',');var _0x3102c7={};_0x3102c7[_0x32ce1f[0x0]]={'$gte':moment(_0x32ce1f[0x1])[_0xf94d('0xbb')](_0xf94d('0xbc'))};_0x29f8d5['where']=_['merge'](_0x29f8d5[_0xf94d('0x44')],_0x3102c7);}_0x29f8d5=_[_0xf94d('0xb0')]({},_0x29f8d5,_0x371d77[_0xf94d('0xb1')]);return db['FaxMessage'][_0xf94d('0x23')]({'where':_0x29f8d5[_0xf94d('0x44')]})['then'](function(_0x3de0c8){_0x51defc[_0xf94d('0x23')]=_0x3de0c8;if(_0x371d77['query'][_0xf94d('0xaf')]){_0x29f8d5[_0xf94d('0xbd')]=[{'all':!![]}];}return db[_0xf94d('0xbe')][_0xf94d('0xbf')](_0x29f8d5);})[_0xf94d('0x2b')](function(_0x49bd34){_0x51defc[_0xf94d('0xab')]=_0x49bd34;return _0x51defc;});}})[_0xf94d('0x2b')](respondWithFilteredResult(_0x1b5d77,_0x29f8d5))[_0xf94d('0x34')](handleError(_0x1b5d77,null));};exports['addTags']=function(_0x375f3a,_0x29b0fb,_0xca86ce){return db['FaxInteraction']['find']({'where':{'id':_0x375f3a[_0xf94d('0xad')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x29b0fb,null))[_0xf94d('0x2b')](function(_0x2acb1f){if(_0x2acb1f){return _0x2acb1f[_0xf94d('0xc0')](_0x375f3a[_0xf94d('0xb3')][_0xf94d('0xb6')],_[_0xf94d('0xc1')](_0x375f3a[_0xf94d('0xb3')],[_0xf94d('0xb6'),'id'])||{})[_0xf94d('0xc2')](function(){return db['Tag'][_0xf94d('0xbf')]({'attributes':['id',_0xf94d('0x48'),_0xf94d('0x49')],'where':{'id':_0x375f3a['body'][_0xf94d('0xb6')]}});})['then'](function(_0x2637e4){socket[_0xf94d('0xc3')](_0xf94d('0xc4'),{'id':Number(_0x375f3a[_0xf94d('0xad')]['id']),'tags':_0x2637e4||[]});return{'id':Number(_0x375f3a[_0xf94d('0xad')]['id']),'tags':_0x2637e4||[]};});}})[_0xf94d('0x2b')](respondWithResult(_0x29b0fb,null))[_0xf94d('0x34')](handleError(_0x29b0fb,null));};exports[_0xf94d('0xc5')]=function(_0x172f65,_0x3d0b6c,_0x37b0d5){return db[_0xf94d('0x36')]['find']({'where':{'id':_0x172f65[_0xf94d('0xad')]['id']}})[_0xf94d('0x2b')](handleEntityNotFound(_0x3d0b6c,null))['then'](function(_0x14a27e){if(_0x14a27e){return _0x14a27e[_0xf94d('0xc5')](_0x172f65[_0xf94d('0x3a')][_0xf94d('0xb6')]);}})['then'](respondWithStatusCode(_0x3d0b6c,null))[_0xf94d('0x34')](handleError(_0x3d0b6c,null));};exports[_0xf94d('0xc6')]=function(_0x333f46,_0x2279f0){var _0x92ad35=moment()[_0xf94d('0xc7')]()[_0xf94d('0x96')]();var _0xfeb74=path[_0xf94d('0xc8')](config[_0xf94d('0xc9')],'server',_0xf94d('0xca'),_0xf94d('0xcb'));var _0x1b6aaa=path[_0xf94d('0xc8')](config[_0xf94d('0xc9')],'server',_0xf94d('0xca'),_0xf94d('0xcc'));var _0x2ce0bc=path[_0xf94d('0xc8')](_0xfeb74,_0x92ad35);var _0x584f9a=util[_0xf94d('0xbb')]('transcript-%d-%s.zip',_0x333f46['params']['id'],_0x92ad35);var _0x2b5ad5=path[_0xf94d('0xc8')](_0xfeb74,_0x584f9a);var _0x182994=[];_0x182994[_0xf94d('0xa9')]({'model':db[_0xf94d('0xcd')],'as':_0xf94d('0xcd'),'raw':!![]});var _0x325b9f=[{'model':db[_0xf94d('0xbe')],'as':_0xf94d('0xce'),'attributes':['id',_0xf94d('0xb3'),_0xf94d('0x76')],'include':_0x182994}];return db['FaxInteraction'][_0xf94d('0x5e')]({'where':{'id':_0x333f46[_0xf94d('0xad')]['id']},'include':_0x325b9f})['then'](handleEntityNotFound(_0x2279f0,null))[_0xf94d('0x2b')](function(_0x5b7c93){if(_0x5b7c93&&_0x5b7c93[_0xf94d('0xce')]){var _0x3b6ec7=_0x5b7c93[_0xf94d('0xcf')]({'plain':!![]});fs[_0xf94d('0xd0')](_0x2ce0bc);for(var _0x200921=0x0;_0x200921<_0x3b6ec7[_0xf94d('0xce')]['length'];_0x200921++){var _0x16a8c9=_0x3b6ec7[_0xf94d('0xce')][_0x200921]['Attachment'];if(_0x16a8c9){var _0x263ed8=path[_0xf94d('0xc8')](_0x1b6aaa,_0x16a8c9[_0xf94d('0xd1')]);if(fs[_0xf94d('0xd2')](_0x263ed8)){fs[_0xf94d('0xd3')](_0x263ed8)[_0xf94d('0xd4')](fs[_0xf94d('0xd5')](path[_0xf94d('0xc8')](_0x2ce0bc,_0x16a8c9['basename'])));}}}return BPromise[_0xf94d('0x90')]()[_0xf94d('0x2b')](function(){return new BPromise(function(_0x57fefa,_0x56755e){zipdir(_0x2ce0bc,{'saveTo':_0x2b5ad5},function(_0x32d272,_0x1bb3e2){if(_0x32d272)return _0x56755e(_0x32d272);return _0x57fefa(_0x1bb3e2);});})[_0xf94d('0x2b')](function(){return new BPromise(function(_0x185418,_0x11a55b){rimraf(_0x2ce0bc,function(_0x1bd11b){if(_0x1bd11b)_0x11a55b(_0x1bd11b);return _0x185418();});});})[_0xf94d('0x2b')](function(){return _0x2279f0[_0xf94d('0xc6')](_0x2b5ad5,_0x584f9a,function(_0x589bde){if(_0x589bde){console[_0xf94d('0xd6')]('err',_0x589bde);}else{fs['unlinkSync'](_0x2b5ad5);}});});});}else{return _0x2279f0[_0xf94d('0x20')](0xc8);}})[_0xf94d('0x34')](handleError(_0x2279f0,null));}; \ No newline at end of file +var _0x9f4d=['status','end','count','offset','Content-Range','json','apply','update','then','destroy','error','stack','name','Users','fullname','TagIds','Tags','split','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','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','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','pick','$gte','format','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','Attachment','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus'];(function(_0x54b0f3,_0x1fe2f7){var _0x5ae957=function(_0x2749eb){while(--_0x2749eb){_0x54b0f3['push'](_0x54b0f3['shift']());}};_0x5ae957(++_0x1fe2f7);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x35c506,_0x18351c){_0x35c506=_0x35c506-0x0;var _0x4d025c=_0x9f4d[_0x35c506];return _0x4d025c;};'use strict';var pdf=require(_0xd9f4('0x0'));var emlformat=require(_0xd9f4('0x1'));var rimraf=require(_0xd9f4('0x2'));var zipdir=require(_0xd9f4('0x3'));var jsonpatch=require(_0xd9f4('0x4'));var rp=require(_0xd9f4('0x5'));var moment=require(_0xd9f4('0x6'));var BPromise=require(_0xd9f4('0x7'));var Mustache=require(_0xd9f4('0x8'));var util=require('util');var path=require(_0xd9f4('0x9'));var sox=require('sox');var csv=require(_0xd9f4('0xa'));var ejs=require(_0xd9f4('0xb'));var fs=require('fs');var _=require(_0xd9f4('0xc'));var squel=require(_0xd9f4('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9f4('0xe'));var deskjs=require(_0xd9f4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9f4('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9f4('0x11'));var authService=require(_0xd9f4('0x12'));var qs=require(_0xd9f4('0x13'));var as=require(_0xd9f4('0x14'));var hardwareService=require(_0xd9f4('0x15'));var logger=require('../../config/logger')(_0xd9f4('0x16'));var utils=require(_0xd9f4('0x17'));var config=require(_0xd9f4('0x18'));var db=require(_0xd9f4('0x19'))['db'];config[_0xd9f4('0x1a')]=_[_0xd9f4('0x1b')](config[_0xd9f4('0x1a')],{'host':_0xd9f4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9f4('0x1a')]));require(_0xd9f4('0x1d'))[_0xd9f4('0x1e')](socket);function respondWithStatusCode(_0xef7729,_0x8a035d){_0x8a035d=_0x8a035d||0xcc;return function(_0x23a216){if(_0x23a216){return _0xef7729[_0xd9f4('0x1f')](_0x8a035d);}return _0xef7729[_0xd9f4('0x20')](_0x8a035d)[_0xd9f4('0x21')]();};}function respondWithResult(_0x2ca827,_0xfd15a4){_0xfd15a4=_0xfd15a4||0xc8;return function(_0x14c78e){if(_0x14c78e){return _0x2ca827[_0xd9f4('0x20')](_0xfd15a4)['json'](_0x14c78e);}};}function respondWithFilteredResult(_0x4dc76f,_0x48ecd3){return function(_0x5e07f9){if(_0x5e07f9){var _0x25a7fe=_0x5e07f9[_0xd9f4('0x22')],_0x2d7cb2=_0x48ecd3[_0xd9f4('0x23')],_0xc01934=_0x48ecd3[_0xd9f4('0x23')]+_0x48ecd3['limit'],_0x4a5ecf;if(_0xc01934>=_0x25a7fe){_0xc01934=_0x25a7fe;_0x4a5ecf=0xc8;}else{_0x4a5ecf=0xce;}_0x4dc76f[_0xd9f4('0x20')](_0x4a5ecf);return _0x4dc76f['set'](_0xd9f4('0x24'),_0x2d7cb2+'-'+_0xc01934+'/'+_0x25a7fe)[_0xd9f4('0x25')](_0x5e07f9);}return null;};}function patchUpdates(_0x7ec2ce){return function(_0x56d63a){try{jsonpatch[_0xd9f4('0x26')](_0x56d63a,_0x7ec2ce,!![]);}catch(_0x252c68){return BPromise['reject'](_0x252c68);}return _0x56d63a['save']();};}function saveUpdates(_0x7196ab,_0x59c8f6){return function(_0x1d555d){if(_0x1d555d){return _0x1d555d[_0xd9f4('0x27')](_0x7196ab)[_0xd9f4('0x28')](function(_0x2a89b6){return _0x2a89b6;});}return null;};}function removeEntity(_0x101e86,_0x33ddd6){return function(_0x3bd2c8){if(_0x3bd2c8){return _0x3bd2c8[_0xd9f4('0x29')]()[_0xd9f4('0x28')](function(){_0x101e86['status'](0xcc)[_0xd9f4('0x21')]();});}};}function handleEntityNotFound(_0x1814eb,_0x1fe43b){return function(_0x3ee51c){if(!_0x3ee51c){_0x1814eb[_0xd9f4('0x1f')](0x194);}return _0x3ee51c;};}function handleError(_0x2ed32c,_0x12958b){_0x12958b=_0x12958b||0x1f4;return function(_0x4f088a){logger[_0xd9f4('0x2a')](_0x4f088a[_0xd9f4('0x2b')]);if(_0x4f088a[_0xd9f4('0x2c')]){delete _0x4f088a[_0xd9f4('0x2c')];}_0x2ed32c['status'](_0x12958b)['send'](_0x4f088a);};}function getInteractionUsers(_0x478bc6,_0x261903){return new BPromise(function(_0x4b453b,_0x2ca69a){try{if(_0x261903[_0x478bc6['id']]){_0x478bc6[_0xd9f4('0x2d')]=_['map'](_0x261903[_0x478bc6['id']],function(_0x5c4986){return{'id':_0x5c4986['id'],'fullname':_0x5c4986[_0xd9f4('0x2e')]};});}}catch(_0x30e009){_0x2ca69a(_0x30e009);}_0x4b453b(_0x478bc6);});}function getInteractionTags(_0x5f6cb9,_0xa2339a){return new BPromise(function(_0x8c3e50,_0x326ba9){try{if(_0x5f6cb9[_0xd9f4('0x2f')]){_0x5f6cb9[_0xd9f4('0x30')]=[];_0x5f6cb9[_0xd9f4('0x2f')][_0xd9f4('0x31')](',')[_0xd9f4('0x32')](function(_0x40b489){_0x5f6cb9['Tags'][_0xd9f4('0x33')](_0xa2339a[_0x40b489]);});}delete _0x5f6cb9['TagIds'];}catch(_0x1eeae3){_0x326ba9(_0x1eeae3);}_0x8c3e50(_0x5f6cb9);});}function updateFaxInteraction(_0x255cd2,_0x55f332,_0x427e62){return new BPromise(function(_0x380163,_0x3debfe){return getInteractionUsers(_0x255cd2,_0x427e62)[_0xd9f4('0x28')](function(_0x307592){return getInteractionTags(_0x307592,_0x55f332);})[_0xd9f4('0x28')](function(_0x174b25){_0x380163(_0x174b25);})[_0xd9f4('0x34')](function(_0x261a30){_0x3debfe(_0x261a30);});});}exports[_0xd9f4('0x35')]=function(_0x595cf9,_0x53f4e8){var _0x5eaca6={},_0xc8fa9e={},_0x9c3f8b={'count':0x0,'rows':[]};var _0x4310e0=_[_0xd9f4('0x36')](db[_0xd9f4('0x37')][_0xd9f4('0x38')],function(_0x3d7a34){return{'name':_0x3d7a34[_0xd9f4('0x39')],'type':_0x3d7a34[_0xd9f4('0x3a')][_0xd9f4('0x3b')]};});_0xc8fa9e[_0xd9f4('0x3c')]=_['map'](_0x4310e0,'name');_0xc8fa9e[_0xd9f4('0x3d')]=_[_0xd9f4('0x3e')](_0x595cf9[_0xd9f4('0x3d')]);_0xc8fa9e[_0xd9f4('0x3f')]=_[_0xd9f4('0x40')](_0xc8fa9e[_0xd9f4('0x3c')],_0xc8fa9e[_0xd9f4('0x3d')]);_0x5eaca6[_0xd9f4('0x41')]=_[_0xd9f4('0x40')](_0xc8fa9e[_0xd9f4('0x3c')],qs[_0xd9f4('0x42')](_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x42')]));_0x5eaca6['attributes']=_0x5eaca6['attributes'][_0xd9f4('0x43')]?_0x5eaca6[_0xd9f4('0x41')]:_0xc8fa9e[_0xd9f4('0x3c')];if(!_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x44')]('nolimit')){_0x5eaca6[_0xd9f4('0x45')]=qs[_0xd9f4('0x45')](_0x595cf9['query'][_0xd9f4('0x45')]);_0x5eaca6[_0xd9f4('0x23')]=qs['offset'](_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x23')]);}_0x5eaca6[_0xd9f4('0x46')]=qs[_0xd9f4('0x47')](_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x47')]);_0x5eaca6[_0xd9f4('0x48')]=qs[_0xd9f4('0x3f')](_['pick'](_0x595cf9[_0xd9f4('0x3d')],_0xc8fa9e['filters']),_0x4310e0);var _0x48e236=[];var _0x353a01=squel['select']()[_0xd9f4('0x49')]('id')[_0xd9f4('0x49')](_0xd9f4('0x2c'))[_0xd9f4('0x49')](_0xd9f4('0x4a'))[_0xd9f4('0x4b')](_0xd9f4('0x4c'));var _0x4b2cb9=squel[_0xd9f4('0x4d')]()[_0xd9f4('0x49')]('u.id')[_0xd9f4('0x49')](_0xd9f4('0x4e'))[_0xd9f4('0x49')](_0xd9f4('0x4f'))['from'](_0xd9f4('0x50'),'ui')[_0xd9f4('0x51')](_0xd9f4('0x52'),'u',_0xd9f4('0x53'));var _0x34bb6d=squel['select']()[_0xd9f4('0x4b')](_0xd9f4('0x54'),'i')[_0xd9f4('0x51')](_0xd9f4('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd9f4('0x51')](_0xd9f4('0x52'),'o','o.id\x20=\x20i.UserId')[_0xd9f4('0x51')](_0xd9f4('0x56'),'a',_0xd9f4('0x57'))[_0xd9f4('0x51')](_0xd9f4('0x58'),'me',_0xd9f4('0x59'))[_0xd9f4('0x51')](_0xd9f4('0x5a'),'it',_0xd9f4('0x5b'))[_0xd9f4('0x51')](_0xd9f4('0x4c'),'t',_0xd9f4('0x5c'));var _0x360248=squel[_0xd9f4('0x5d')]();var _0x33cdac=[];var _0x50b41e=squel[_0xd9f4('0x5d')]();var _0x372947;if(_0x595cf9['query'][_0xd9f4('0x5e')]){_0x372947=as[_0xd9f4('0x5f')](_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x5e')]);var _0x13429c=_0x372947[_0xd9f4('0x60')];for(var _0x215df5=0x0;_0x215df5<_0x372947[_0xd9f4('0x61')][_0xd9f4('0x43')];_0x215df5++){var _0x5e422a=_0x372947['conditions'][_0x215df5];var _0x3c061d='i';var _0x189d0f=_['find'](_0x4310e0,[_0xd9f4('0x2c'),_0x5e422a['field']]);if(!_0x189d0f){switch(_0x5e422a['field']){case _0xd9f4('0x62'):if(_0x5e422a['value']==0x1){_0x34bb6d[_0xd9f4('0x63')]('`'+_0x5e422a[_0xd9f4('0x49')]+_0xd9f4('0x64'));}else{_0x34bb6d[_0xd9f4('0x63')]('`'+_0x5e422a['field']+_0xd9f4('0x65'));}break;case _0xd9f4('0x66'):if(_0x5e422a[_0xd9f4('0x67')]===_0xd9f4('0x68')){if(_0x5e422a[_0xd9f4('0x69')]['split']('\x20')[_0xd9f4('0x43')]>0x1){_0x360248[_0x13429c](_0xd9f4('0x6a'),qs[_0xd9f4('0x6b')](_0x5e422a[_0xd9f4('0x69')]),null);}else{var _0x8a6e58='%'+_0x5e422a[_0xd9f4('0x69')]+'%';_0x360248[_0x13429c](_0xd9f4('0x6c'),_0x8a6e58,_0x8a6e58,_0x8a6e58);}}else{_0x189d0f=_[_0xd9f4('0x6d')](_0x4310e0,[_0xd9f4('0x2c'),'ContactId']);_0x5e422a['field']=_0xd9f4('0x6e');_0x176093=as[_0xd9f4('0x6f')](_0x3c061d,_0x189d0f[_0xd9f4('0x3a')],_0x5e422a);_0x360248[_0x13429c](_0x176093['text'],_0x176093[_0xd9f4('0x69')]['start'],_0x176093[_0xd9f4('0x69')]['end']);}break;case _0xd9f4('0x70'):var _0x3b9f5c=_0x5e422a[_0xd9f4('0x69')][_0xd9f4('0x31')](',')['map'](function(_0x38a61c){return Number(_0x38a61c);});_0x3b9f5c[_0xd9f4('0x32')](function(_0x848887){_0x50b41e['or'](_0xd9f4('0x71'),'%,'+_0x848887+',%');});_0x33cdac=_['union'](_0x33cdac,_0x3b9f5c);break;case _0xd9f4('0x72'):if(_0x5e422a[_0xd9f4('0x67')]===_0xd9f4('0x68')){_0x360248[_0x13429c](_0xd9f4('0x73'),'%'+_0x5e422a[_0xd9f4('0x69')]+'%',null);}else{_0x189d0f=_[_0xd9f4('0x6d')](_0x4310e0,['name','UserId']);_0x5e422a['field']='UserId';_0x176093=as[_0xd9f4('0x6f')](_0x3c061d,_0x189d0f[_0xd9f4('0x3a')],_0x5e422a);_0x360248[_0x13429c](_0x176093[_0xd9f4('0x74')],_0x176093[_0xd9f4('0x69')]['start'],_0x176093['value']['end']);}break;case _0xd9f4('0x75'):_0x176093=as[_0xd9f4('0x6f')]('me',null,_0x5e422a);_0x360248[_0x13429c](_0x176093[_0xd9f4('0x74')],_0x176093[_0xd9f4('0x69')]['start'],_0x176093[_0xd9f4('0x69')][_0xd9f4('0x21')]);break;}}else{var _0x176093=as['buildExpression'](_0x3c061d,_0x189d0f[_0xd9f4('0x3a')],_0x5e422a);_0x360248[_0x13429c](_0x176093[_0xd9f4('0x74')],_0x176093[_0xd9f4('0x69')]['start'],_0x176093[_0xd9f4('0x69')][_0xd9f4('0x21')]);}}}else{var _0xe00861=_(_0x595cf9[_0xd9f4('0x3d')])[_0xd9f4('0x3e')]()['map'](function(_0x26f6c3){return _[_0xd9f4('0x76')](_0x4310e0,[_0xd9f4('0x2c'),_0x26f6c3])?_0x26f6c3:undefined;})[_0xd9f4('0x77')]()[_0xd9f4('0x69')]();if(!_[_0xd9f4('0x78')](_0xe00861)){_0xe00861['forEach'](function(_0x2096cd){if(_0x2096cd===_0xd9f4('0x79')){_0x34bb6d[_0xd9f4('0x48')]('i.FaxAccountId\x20IN\x20?',[][_0xd9f4('0x7a')](_0x595cf9['query'][_0x2096cd]));}else if(_0x2096cd===_0xd9f4('0x7b')){var _0xa7c091=JSON[_0xd9f4('0x7c')](_0x595cf9[_0xd9f4('0x3d')][_0x2096cd])['$gte'];var _0x290b1b=JSON[_0xd9f4('0x7c')](_0x595cf9[_0xd9f4('0x3d')][_0x2096cd])[_0xd9f4('0x7d')];_0x34bb6d['where'](_0xd9f4('0x7e'),_0xa7c091,_0x290b1b);}else{if(_0x595cf9[_0xd9f4('0x3d')][_0x2096cd]===_0xd9f4('0x7f')){_0x34bb6d['where']('i.'+_0x2096cd+_0xd9f4('0x80'));}else{_0x34bb6d[_0xd9f4('0x48')]('i.'+_0x2096cd+_0xd9f4('0x81'),_0x595cf9[_0xd9f4('0x3d')][_0x2096cd]);}}});}if(_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x82')]){if(_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x82')]==0x1){_0x34bb6d[_0xd9f4('0x63')]('`unreadMessages`\x20=\x200');}else{_0x34bb6d[_0xd9f4('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x595cf9[_0xd9f4('0x3d')]['tag']){_0x33cdac=_['isArray'](_0x595cf9['query'][_0xd9f4('0x83')])?_0x595cf9['query'][_0xd9f4('0x83')]:new Array(_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x83')]);_0x33cdac[_0xd9f4('0x32')](function(_0x115b27){_0x50b41e['or'](_0xd9f4('0x71'),'%,'+_0x115b27+',%');});}if(_0x595cf9[_0xd9f4('0x3d')]['filter']){var _0x7b311f=_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x84')][_0xd9f4('0x85')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xd9f4('0x86')](_0x7b311f)){_0x360248['or'](_0xd9f4('0x87'),_0x7b311f+'%')['or'](_0xd9f4('0x88'),_0x7b311f+'%');}_0x360248['or'](_0xd9f4('0x89'),_0x7b311f+'%');}}_0x34bb6d[_0xd9f4('0x48')](_0x360248);_0x34bb6d[_0xd9f4('0x8a')]('i.id');var _0x25d718={'type':db[_0xd9f4('0x8b')][_0xd9f4('0x8c')][_0xd9f4('0x8d')],'raw':!![]};var _0x418475=_0x34bb6d[_0xd9f4('0x8e')]();_0x418475['field']('i.id');_0x418475[_0xd9f4('0x49')](_0xd9f4('0x8f'),'unreadMessages');if(_0x5eaca6[_0xd9f4('0x46')]){_0x5eaca6[_0xd9f4('0x46')]['forEach'](function(_0x4131c8){_0x34bb6d[_0xd9f4('0x46')]('i.'+_0x4131c8[0x0],_0x4131c8[0x1]===_0xd9f4('0x90')?![]:!![]);});}if(!_[_0xd9f4('0x78')](_0x33cdac)){_0x34bb6d[_0xd9f4('0x63')](_0x50b41e);_0x418475['where']('t.id\x20IN\x20?',_0x33cdac);}BPromise['resolve']()[_0xd9f4('0x28')](function(){if(!_0x372947){if(_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x79')]||_0x595cf9[_0xd9f4('0x3d')][_0xd9f4('0x91')])return;_0x418475[_0xd9f4('0x48')](_0xd9f4('0x92'));_0x34bb6d['where'](_0xd9f4('0x92'));return;}return _0x595cf9[_0xd9f4('0x93')][_0xd9f4('0x94')]({'attributes':['id'],'raw':!![]})[_0xd9f4('0x28')](function(_0x28a039){if(_[_0xd9f4('0x78')](_0x28a039)){_0x418475[_0xd9f4('0x48')](_0xd9f4('0x95'));_0x34bb6d[_0xd9f4('0x48')](_0xd9f4('0x95'));}else{_0x418475[_0xd9f4('0x48')](_0xd9f4('0x96'),_[_0xd9f4('0x36')](_0x28a039,'id'));_0x34bb6d[_0xd9f4('0x48')](_0xd9f4('0x96'),_[_0xd9f4('0x36')](_0x28a039,'id'));}});})[_0xd9f4('0x28')](function(){db['sequelize'][_0xd9f4('0x3d')](_0x418475[_0xd9f4('0x97')](),_0x25d718)[_0xd9f4('0x28')](function(_0x6d18f5){_0x9c3f8b[_0xd9f4('0x22')]=_0x6d18f5[_0xd9f4('0x43')];if(_0x9c3f8b[_0xd9f4('0x22')]===0x0)return[];return db[_0xd9f4('0x98')][_0xd9f4('0x3d')](_0x353a01[_0xd9f4('0x97')](),_0x25d718)['then'](function(_0x2891dc){_0x48e236=_[_0xd9f4('0x99')](_0x2891dc,'id');_0x25d718=_[_0xd9f4('0x9a')](_0x25d718,{'model':db[_0xd9f4('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x595cf9[_0xd9f4('0x3d')]['fields']){_0x5eaca6[_0xd9f4('0x41')][_0xd9f4('0x32')](function(_0x79cbd7){_0x34bb6d[_0xd9f4('0x49')]('i.'+_0x79cbd7);});}else{_0x34bb6d[_0xd9f4('0x49')](_0xd9f4('0x8f'),_0xd9f4('0x62'));_0x34bb6d[_0xd9f4('0x49')](_0xd9f4('0x9b'),_0xd9f4('0x9c'));_0x34bb6d[_0xd9f4('0x49')]('a.mandatoryDisposition',_0xd9f4('0x9d'));_0x34bb6d[_0xd9f4('0x49')]('i.*');_0x34bb6d['field']('c.firstName','Contact.firstName');_0x34bb6d[_0xd9f4('0x49')]('c.lastName',_0xd9f4('0x9e'));_0x34bb6d[_0xd9f4('0x49')](_0xd9f4('0x9f'),'Contact.email');_0x34bb6d[_0xd9f4('0x49')]('c.phone',_0xd9f4('0xa0'));_0x34bb6d[_0xd9f4('0x49')]('c.mobile',_0xd9f4('0xa1'));_0x34bb6d['field'](_0xd9f4('0xa2'),_0xd9f4('0xa3'));_0x34bb6d['field'](_0xd9f4('0xa4'),_0xd9f4('0xa5'));_0x34bb6d[_0xd9f4('0x49')]('o.internal','Owner.internal');_0x34bb6d[_0xd9f4('0x49')](_0xd9f4('0xa6'),_0xd9f4('0x2f'));}if(_0x5eaca6[_0xd9f4('0x45')])_0x34bb6d[_0xd9f4('0x45')](_0x5eaca6[_0xd9f4('0x45')]);if(_0x5eaca6[_0xd9f4('0x23')])_0x34bb6d[_0xd9f4('0x23')](_0x5eaca6['offset']);return db[_0xd9f4('0x98')][_0xd9f4('0x3d')](_0x34bb6d['toString'](),_0x25d718);})[_0xd9f4('0x28')](function(_0x273dd9){_0x4b2cb9[_0xd9f4('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0xd9f4('0x36')](_0x273dd9,'id'));return db[_0xd9f4('0x98')][_0xd9f4('0x3d')](_0x4b2cb9[_0xd9f4('0x97')](),_0x25d718)['then'](function(_0x51074b){var _0x5ccca2=_[_0xd9f4('0xa7')](_0x51074b,_0xd9f4('0xa8'));var _0x395f44=[];_0x273dd9[_0xd9f4('0x32')](function(_0x52f5d1){_0x395f44[_0xd9f4('0x33')](updateFaxInteraction(_0x52f5d1,_0x48e236,_0x5ccca2));});return BPromise['all'](_0x395f44);});});})[_0xd9f4('0x28')](function(_0x3cdeab){_0x9c3f8b[_0xd9f4('0xa9')]=_0x3cdeab;return _0x9c3f8b;})[_0xd9f4('0x28')](respondWithFilteredResult(_0x53f4e8,_0x5eaca6));})[_0xd9f4('0x34')](handleError(_0x53f4e8,null));};exports[_0xd9f4('0xaa')]=function(_0x7dfcdc,_0x2f48af){var _0x22a98e={'raw':![],'where':{'id':_0x7dfcdc[_0xd9f4('0xab')]['id']}},_0x5a3502={};_0x5a3502[_0xd9f4('0x3c')]=_[_0xd9f4('0x3e')](db[_0xd9f4('0x37')]['rawAttributes']);_0x5a3502['query']=_[_0xd9f4('0x3e')](_0x7dfcdc[_0xd9f4('0x3d')]);_0x5a3502[_0xd9f4('0x3f')]=_[_0xd9f4('0x40')](_0x5a3502[_0xd9f4('0x3c')],_0x5a3502['query']);_0x22a98e[_0xd9f4('0x41')]=_['intersection'](_0x5a3502[_0xd9f4('0x3c')],qs[_0xd9f4('0x42')](_0x7dfcdc[_0xd9f4('0x3d')][_0xd9f4('0x42')]));_0x22a98e[_0xd9f4('0x41')]=_0x22a98e[_0xd9f4('0x41')][_0xd9f4('0x43')]?_0x22a98e[_0xd9f4('0x41')]:_0x5a3502[_0xd9f4('0x3c')];if(_0x7dfcdc[_0xd9f4('0x3d')][_0xd9f4('0xac')]){_0x22a98e[_0xd9f4('0xad')]=[{'all':!![]}];}_0x22a98e=_[_0xd9f4('0x9a')]({},_0x22a98e,_0x7dfcdc['options']);return db[_0xd9f4('0x37')]['find'](_0x22a98e)['then'](handleEntityNotFound(_0x2f48af,null))[_0xd9f4('0x28')](respondWithResult(_0x2f48af,null))[_0xd9f4('0x34')](handleError(_0x2f48af,null));};exports[_0xd9f4('0xae')]=function(_0x43ad9d,_0x1d696e){return db['FaxInteraction']['create'](_0x43ad9d[_0xd9f4('0x75')],{})[_0xd9f4('0x28')](respondWithResult(_0x1d696e,0xc9))[_0xd9f4('0x34')](handleError(_0x1d696e,null));};exports[_0xd9f4('0x27')]=function(_0x1ae1b7,_0x2a760f){if(_0x1ae1b7[_0xd9f4('0x75')]['id']){delete _0x1ae1b7[_0xd9f4('0x75')]['id'];}return db[_0xd9f4('0x37')][_0xd9f4('0x6d')]({'where':{'id':_0x1ae1b7[_0xd9f4('0xab')]['id']}})[_0xd9f4('0x28')](handleEntityNotFound(_0x2a760f,null))['then'](saveUpdates(_0x1ae1b7[_0xd9f4('0x75')],null))[_0xd9f4('0x28')](respondWithResult(_0x2a760f,null))[_0xd9f4('0x34')](handleError(_0x2a760f,null));};exports[_0xd9f4('0x29')]=function(_0x4e9be9,_0x55ea9e){return db[_0xd9f4('0x37')]['find']({'where':{'id':_0x4e9be9[_0xd9f4('0xab')]['id']}})[_0xd9f4('0x28')](handleEntityNotFound(_0x55ea9e,null))[_0xd9f4('0x28')](removeEntity(_0x55ea9e,null))[_0xd9f4('0x34')](handleError(_0x55ea9e,null));};exports[_0xd9f4('0xaf')]=function(_0x3a5f9e,_0x135dcf){return db[_0xd9f4('0x37')][_0xd9f4('0xaf')]()[_0xd9f4('0x28')](respondWithResult(_0x135dcf,null))['catch'](handleError(_0x135dcf,null));};exports[_0xd9f4('0xb0')]=function(_0xfe8d5d,_0x4abbbb,_0x4f32fb){return db[_0xd9f4('0xb1')]['find']({'where':{'id':_0xfe8d5d[_0xd9f4('0xab')]['id']}})[_0xd9f4('0x28')](handleEntityNotFound(_0x4abbbb,null))[_0xd9f4('0x28')](function(_0x55507f){if(_0x55507f){return _0x55507f[_0xd9f4('0xb0')](_0xfe8d5d['body'][_0xd9f4('0xb2')],_['omit'](_0xfe8d5d[_0xd9f4('0x75')],[_0xd9f4('0xb2'),'id'])||{});}})[_0xd9f4('0x28')](respondWithResult(_0x4abbbb,null))[_0xd9f4('0x34')](handleError(_0x4abbbb,null));};exports[_0xd9f4('0xb3')]=function(_0x56af53,_0x549fa6,_0x3ff790){var _0x34e6ba={'raw':![],'where':{}};var _0xeabf4a={};var _0x802860={'count':0x0,'rows':[]};return db[_0xd9f4('0x37')][_0xd9f4('0xb4')]({'where':{'id':_0x56af53[_0xd9f4('0xab')]['id']}})['then'](handleEntityNotFound(_0x549fa6,null))[_0xd9f4('0x28')](function(_0x2e2ca4){if(_0x2e2ca4){_0xeabf4a[_0xd9f4('0x3c')]=_['keys'](db[_0xd9f4('0xb1')][_0xd9f4('0x38')]);_0xeabf4a[_0xd9f4('0x3d')]=_['keys'](_0x56af53[_0xd9f4('0x3d')]);_0xeabf4a[_0xd9f4('0x3f')]=_[_0xd9f4('0x40')](_0xeabf4a['model'],_0xeabf4a[_0xd9f4('0x3d')]);_0x34e6ba[_0xd9f4('0x41')]=_[_0xd9f4('0x40')](_0xeabf4a['model'],qs[_0xd9f4('0x42')](_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0x42')]));_0x34e6ba[_0xd9f4('0x41')]=_0x34e6ba[_0xd9f4('0x41')][_0xd9f4('0x43')]?_0x34e6ba[_0xd9f4('0x41')]:_0xeabf4a['model'];if(!_0x56af53['query'][_0xd9f4('0x44')]('nolimit')){_0x34e6ba['limit']=qs['limit'](_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0x45')]);_0x34e6ba['offset']=qs[_0xd9f4('0x23')](_0x56af53['query'][_0xd9f4('0x23')]);}_0x34e6ba[_0xd9f4('0x46')]=qs[_0xd9f4('0x47')](_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0x47')]);_0x34e6ba[_0xd9f4('0x48')]=qs['filters'](_[_0xd9f4('0xb5')](_0x56af53[_0xd9f4('0x3d')],_0xeabf4a[_0xd9f4('0x3f')]));_0x34e6ba[_0xd9f4('0x48')][_0xd9f4('0xa8')]=_0x2e2ca4['id'];if(_0x56af53['query'][_0xd9f4('0x84')]){_0x34e6ba['where']=_[_0xd9f4('0x9a')](_0x34e6ba[_0xd9f4('0x48')],{'$or':_[_0xd9f4('0x36')](_0x34e6ba[_0xd9f4('0x41')],function(_0x1faa91){var _0x1852e7={};_0x1852e7[_0x1faa91]={'$like':'%'+_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0x84')]+'%'};return _0x1852e7;})});}if(_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0xb6')]){var _0x19680a=_0x56af53[_0xd9f4('0x3d')][_0xd9f4('0xb6')][_0xd9f4('0x31')](',');var _0x1e6a86={};_0x1e6a86[_0x19680a[0x0]]={'$gte':moment(_0x19680a[0x1])[_0xd9f4('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x34e6ba['where']=_['merge'](_0x34e6ba['where'],_0x1e6a86);}_0x34e6ba=_[_0xd9f4('0x9a')]({},_0x34e6ba,_0x56af53['options']);return db['FaxMessage'][_0xd9f4('0x22')]({'where':_0x34e6ba[_0xd9f4('0x48')]})[_0xd9f4('0x28')](function(_0x473731){_0x802860[_0xd9f4('0x22')]=_0x473731;if(_0x56af53[_0xd9f4('0x3d')]['includeAll']){_0x34e6ba['include']=[{'all':!![]}];}return db[_0xd9f4('0xb1')]['findAll'](_0x34e6ba);})[_0xd9f4('0x28')](function(_0xf50fa3){_0x802860[_0xd9f4('0xa9')]=_0xf50fa3;return _0x802860;});}})[_0xd9f4('0x28')](respondWithFilteredResult(_0x549fa6,_0x34e6ba))['catch'](handleError(_0x549fa6,null));};exports['addTags']=function(_0x1e6634,_0x3e081d,_0x2a1192){return db['FaxInteraction'][_0xd9f4('0x6d')]({'where':{'id':_0x1e6634[_0xd9f4('0xab')]['id']}})['then'](handleEntityNotFound(_0x3e081d,null))[_0xd9f4('0x28')](function(_0x50ee0d){if(_0x50ee0d){return _0x50ee0d['setTags'](_0x1e6634['body'][_0xd9f4('0xb2')],_[_0xd9f4('0xb8')](_0x1e6634[_0xd9f4('0x75')],['ids','id'])||{})[_0xd9f4('0xb9')](function(){return db[_0xd9f4('0x70')]['findAll']({'attributes':['id',_0xd9f4('0x2c'),_0xd9f4('0x4a')],'where':{'id':_0x1e6634['body'][_0xd9f4('0xb2')]}});})[_0xd9f4('0x28')](function(_0xcbad5c){socket[_0xd9f4('0xba')](_0xd9f4('0xbb'),{'id':Number(_0x1e6634[_0xd9f4('0xab')]['id']),'tags':_0xcbad5c||[]});return{'id':Number(_0x1e6634[_0xd9f4('0xab')]['id']),'tags':_0xcbad5c||[]};});}})[_0xd9f4('0x28')](respondWithResult(_0x3e081d,null))[_0xd9f4('0x34')](handleError(_0x3e081d,null));};exports[_0xd9f4('0xbc')]=function(_0x37ce63,_0x2add67,_0x3a29f2){return db[_0xd9f4('0x37')][_0xd9f4('0x6d')]({'where':{'id':_0x37ce63[_0xd9f4('0xab')]['id']}})['then'](handleEntityNotFound(_0x2add67,null))[_0xd9f4('0x28')](function(_0x2a6ebc){if(_0x2a6ebc){return _0x2a6ebc[_0xd9f4('0xbc')](_0x37ce63[_0xd9f4('0x3d')][_0xd9f4('0xb2')]);}})[_0xd9f4('0x28')](respondWithStatusCode(_0x2add67,null))[_0xd9f4('0x34')](handleError(_0x2add67,null));};exports[_0xd9f4('0xbd')]=function(_0x330a7e,_0xf6db6d){var _0x7f3688=moment()[_0xd9f4('0xbe')]()[_0xd9f4('0x97')]();var _0x4ae9f9=path[_0xd9f4('0xbf')](config[_0xd9f4('0xc0')],_0xd9f4('0xc1'),'files',_0xd9f4('0xc2'));var _0x4638db=path[_0xd9f4('0xbf')](config[_0xd9f4('0xc0')],'server',_0xd9f4('0xc3'),_0xd9f4('0xc4'));var _0x380758=path[_0xd9f4('0xbf')](_0x4ae9f9,_0x7f3688);var _0x23f81f=util[_0xd9f4('0xb7')]('transcript-%d-%s.zip',_0x330a7e[_0xd9f4('0xab')]['id'],_0x7f3688);var _0x4fbf0f=path[_0xd9f4('0xbf')](_0x4ae9f9,_0x23f81f);var _0x16e10c=[];_0x16e10c['push']({'model':db[_0xd9f4('0xc5')],'as':_0xd9f4('0xc5'),'raw':!![]});var _0x208c05=[{'model':db[_0xd9f4('0xb1')],'as':_0xd9f4('0xc6'),'attributes':['id',_0xd9f4('0x75'),_0xd9f4('0x7b')],'include':_0x16e10c}];return db[_0xd9f4('0x37')]['find']({'where':{'id':_0x330a7e[_0xd9f4('0xab')]['id']},'include':_0x208c05})[_0xd9f4('0x28')](handleEntityNotFound(_0xf6db6d,null))[_0xd9f4('0x28')](function(_0x126bb1){if(_0x126bb1&&_0x126bb1[_0xd9f4('0xc6')]){var _0x302af4=_0x126bb1['get']({'plain':!![]});fs['mkdirSync'](_0x380758);for(var _0x2e1e94=0x0;_0x2e1e94<_0x302af4[_0xd9f4('0xc6')][_0xd9f4('0x43')];_0x2e1e94++){var _0xdcd29f=_0x302af4[_0xd9f4('0xc6')][_0x2e1e94]['Attachment'];if(_0xdcd29f){var _0x42b46f=path[_0xd9f4('0xbf')](_0x4638db,_0xdcd29f['basename']);if(fs[_0xd9f4('0xc7')](_0x42b46f)){fs[_0xd9f4('0xc8')](_0x42b46f)[_0xd9f4('0xc9')](fs[_0xd9f4('0xca')](path[_0xd9f4('0xbf')](_0x380758,_0xdcd29f[_0xd9f4('0xcb')])));}}}return BPromise[_0xd9f4('0xcc')]()[_0xd9f4('0x28')](function(){return new BPromise(function(_0x257e56,_0x511d7d){zipdir(_0x380758,{'saveTo':_0x4fbf0f},function(_0x1818e3,_0x337301){if(_0x1818e3)return _0x511d7d(_0x1818e3);return _0x257e56(_0x337301);});})[_0xd9f4('0x28')](function(){return new BPromise(function(_0xc6dda,_0x5cb8ea){rimraf(_0x380758,function(_0x21ecbb){if(_0x21ecbb)_0x5cb8ea(_0x21ecbb);return _0xc6dda();});});})['then'](function(){return _0xf6db6d[_0xd9f4('0xbd')](_0x4fbf0f,_0x23f81f,function(_0x325c1d){if(_0x325c1d){console[_0xd9f4('0xcd')](_0xd9f4('0xce'),_0x325c1d);}else{fs[_0xd9f4('0xcf')](_0x4fbf0f);}});});});}else{return _0xf6db6d['sendStatus'](0xc8);}})[_0xd9f4('0x34')](handleError(_0xf6db6d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f1cc0a8..b15e469 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x40b9eb,_0x2aa2aa){var _0xd44350=function(_0x55a5a1){while(--_0x55a5a1){_0x40b9eb['push'](_0x40b9eb['shift']());}};_0xd44350(++_0x2aa2aa);}(_0x1261,0x144));var _0x1126=function(_0x577acd,_0x2dddb2){_0x577acd=_0x577acd-0x0;var _0x2bfd74=_0x1261[_0x577acd];return _0x2bfd74;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 47ff16f..f4c1462 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt','format','lodash'];(function(_0xd9fd90,_0x4923a8){var _0x3c5a08=function(_0x3544f6){while(--_0x3544f6){_0xd9fd90['push'](_0xd9fd90['shift']());}};_0x3c5a08(++_0x4923a8);}(_0xe14d,0x1ee));var _0xde14=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe14d[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('FaxInteraction',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x115b7d,_0x2b0e7c,_0x9f13dc){if(_0x115b7d[_0xde14('0xb')](_0xde14('0xc'))){_0x115b7d[_0xde14('0xd')]=moment()[_0xde14('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x9f13dc(null,_0x115b7d);}}});}; \ No newline at end of file +var _0xa75b=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x58b8d5,_0x4bca7c){var _0x43a5e6=function(_0x5f3e81){while(--_0x5f3e81){_0x58b8d5['push'](_0x58b8d5['shift']());}};_0x43a5e6(++_0x4bca7c);}(_0xa75b,0x170));var _0xba75=function(_0x4bd4b,_0x327193){_0x4bd4b=_0x4bd4b-0x0;var _0x5075d8=_0xa75b[_0x4bd4b];return _0x5075d8;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b842d,_0x731cae,_0x52669f){if(_0x4b842d['changed'](_0xba75('0xc'))){_0x4b842d['closedAt']=moment()[_0xba75('0xd')](_0xba75('0xe'));}_0x52669f(null,_0x4b842d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2f3ebf6..3fe7791 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 _0x64f2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','FaxInteraction','body','options','raw','attributes','stringify','UpdateFaxInteraction','AddTagsToFaxInteraction','where','ids','omit','spread','AddTags','lodash','util','bluebird'];(function(_0x43c878,_0x13cb9e){var _0x4d09de=function(_0x5ae119){while(--_0x5ae119){_0x43c878['push'](_0x43c878['shift']());}};_0x4d09de(++_0x13cb9e);}(_0x64f2,0x78));var _0x264f=function(_0x3c8ddf,_0x1c3aac){_0x3c8ddf=_0x3c8ddf-0x0;var _0x19d944=_0x64f2[_0x3c8ddf];return _0x19d944;};'use strict';var _=require(_0x264f('0x0'));var util=require(_0x264f('0x1'));var moment=require('moment');var BPromise=require(_0x264f('0x2'));var rs=require(_0x264f('0x3'));var fs=require('fs');var Redis=require(_0x264f('0x4'));var db=require(_0x264f('0x5'))['db'];var utils=require(_0x264f('0x6'));var logger=require(_0x264f('0x7'))(_0x264f('0x8'));var config=require(_0x264f('0x9'));var jayson=require(_0x264f('0xa'));var client=jayson[_0x264f('0xb')][_0x264f('0xc')]({'port':0x232a});config[_0x264f('0xd')]=_['defaults'](config[_0x264f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x264f('0xe'))(new Redis(config[_0x264f('0xd')]));require(_0x264f('0xf'))[_0x264f('0x10')](socket);function respondWithRpcPromise(_0x1685cc,_0x12fb00,_0x2311e2){return new BPromise(function(_0x3b563e,_0x1cf8c3){return client[_0x264f('0x11')](_0x1685cc,_0x2311e2)[_0x264f('0x12')](function(_0x18bca8){logger[_0x264f('0x13')](_0x264f('0x14'),_0x12fb00,_0x264f('0x15'));logger[_0x264f('0x16')](_0x264f('0x17'),_0x12fb00,'request\x20sent',JSON['stringify'](_0x18bca8));if(_0x18bca8[_0x264f('0x18')]){if(_0x18bca8['error']['code']===0x1f4){logger[_0x264f('0x18')](_0x264f('0x14'),_0x12fb00,_0x18bca8[_0x264f('0x18')][_0x264f('0x19')]);return _0x1cf8c3(_0x18bca8[_0x264f('0x18')]['message']);}logger['error'](_0x264f('0x14'),_0x12fb00,_0x18bca8[_0x264f('0x18')][_0x264f('0x19')]);return _0x3b563e(_0x18bca8[_0x264f('0x18')][_0x264f('0x19')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x12fb00,_0x264f('0x15'));_0x3b563e(_0x18bca8[_0x264f('0x1a')][_0x264f('0x19')]);}})[_0x264f('0x1b')](function(_0x27c3ce){logger[_0x264f('0x18')](_0x264f('0x14'),_0x12fb00,_0x27c3ce);_0x1cf8c3(_0x27c3ce);});});}exports['UpdateFaxInteraction']=function(_0x2a71ef){var _0x4d9a7a=this;return new Promise(function(_0x506544,_0x1fa26d){return db[_0x264f('0x1c')]['update'](_0x2a71ef[_0x264f('0x1d')],{'raw':_0x2a71ef['options']?_0x2a71ef[_0x264f('0x1e')][_0x264f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a71ef[_0x264f('0x1e')]?_0x2a71ef[_0x264f('0x1e')]['where']||null:null,'attributes':_0x2a71ef[_0x264f('0x1e')]?_0x2a71ef[_0x264f('0x1e')][_0x264f('0x20')]||null:null,'limit':_0x2a71ef[_0x264f('0x1e')]?_0x2a71ef['options']['limit']||null:null})['then'](function(_0x19e48c){logger[_0x264f('0x13')]('UpdateFaxInteraction',_0x2a71ef);logger[_0x264f('0x16')]('UpdateFaxInteraction',_0x2a71ef,JSON[_0x264f('0x21')](_0x19e48c));_0x506544(_0x19e48c);})[_0x264f('0x1b')](function(_0x24e04b){logger['error'](_0x264f('0x22'),_0x24e04b[_0x264f('0x19')],_0x2a71ef);_0x1fa26d(_0x4d9a7a[_0x264f('0x18')](0x1f4,_0x24e04b[_0x264f('0x19')]));});});};exports[_0x264f('0x23')]=function(_0x38f152){return new Promise(function(_0x883eaf,_0x1838da){return db[_0x264f('0x1c')]['find']({'where':_0x38f152[_0x264f('0x1e')]?_0x38f152[_0x264f('0x1e')][_0x264f('0x24')]||null:null})['then'](function(_0x3404ff){if(_0x3404ff){return _0x3404ff['addTags'](_0x38f152[_0x264f('0x1d')][_0x264f('0x25')],_[_0x264f('0x26')](_0x38f152[_0x264f('0x1d')],[_0x264f('0x25'),'id'])||{});}})[_0x264f('0x27')](function(_0x59a123){logger['info']('AddTags',_0x38f152);logger[_0x264f('0x16')](_0x264f('0x28'),_0x38f152,JSON[_0x264f('0x21')](_0x59a123));_0x883eaf(_0x59a123);})[_0x264f('0x1b')](function(_0x23025a){logger[_0x264f('0x18')](_0x264f('0x28'),_0x23025a[_0x264f('0x19')],_0x38f152);_0x1838da(_this[_0x264f('0x18')](0x1f4,_0x23025a[_0x264f('0x19')]));});});}; \ No newline at end of file +var _0x6fef=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','ids','omit'];(function(_0x17e485,_0x452860){var _0x482b10=function(_0x3debef){while(--_0x3debef){_0x17e485['push'](_0x17e485['shift']());}};_0x482b10(++_0x452860);}(_0x6fef,0x110));var _0xf6fe=function(_0x1d6d48,_0xf847fd){_0x1d6d48=_0x1d6d48-0x0;var _0x3cb1f5=_0x6fef[_0x1d6d48];return _0x3cb1f5;};'use strict';var _=require(_0xf6fe('0x0'));var util=require(_0xf6fe('0x1'));var moment=require(_0xf6fe('0x2'));var BPromise=require(_0xf6fe('0x3'));var rs=require(_0xf6fe('0x4'));var fs=require('fs');var Redis=require(_0xf6fe('0x5'));var db=require(_0xf6fe('0x6'))['db'];var utils=require(_0xf6fe('0x7'));var logger=require(_0xf6fe('0x8'))(_0xf6fe('0x9'));var config=require(_0xf6fe('0xa'));var jayson=require(_0xf6fe('0xb'));var client=jayson[_0xf6fe('0xc')]['http']({'port':0x232a});config[_0xf6fe('0xd')]=_[_0xf6fe('0xe')](config[_0xf6fe('0xd')],{'host':_0xf6fe('0xf'),'port':0x18eb});var socket=require(_0xf6fe('0x10'))(new Redis(config[_0xf6fe('0xd')]));require(_0xf6fe('0x11'))[_0xf6fe('0x12')](socket);function respondWithRpcPromise(_0x1af0d5,_0x4a93e7,_0xf584a9){return new BPromise(function(_0x1993e4,_0x1d76da){return client[_0xf6fe('0x13')](_0x1af0d5,_0xf584a9)[_0xf6fe('0x14')](function(_0x44cc55){logger['info'](_0xf6fe('0x15'),_0x4a93e7,_0xf6fe('0x16'));logger[_0xf6fe('0x17')](_0xf6fe('0x18'),_0x4a93e7,'request\x20sent',JSON[_0xf6fe('0x19')](_0x44cc55));if(_0x44cc55[_0xf6fe('0x1a')]){if(_0x44cc55[_0xf6fe('0x1a')]['code']===0x1f4){logger[_0xf6fe('0x1a')](_0xf6fe('0x15'),_0x4a93e7,_0x44cc55[_0xf6fe('0x1a')][_0xf6fe('0x1b')]);return _0x1d76da(_0x44cc55[_0xf6fe('0x1a')][_0xf6fe('0x1b')]);}logger[_0xf6fe('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x4a93e7,_0x44cc55[_0xf6fe('0x1a')]['message']);return _0x1993e4(_0x44cc55[_0xf6fe('0x1a')][_0xf6fe('0x1b')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4a93e7,_0xf6fe('0x16'));_0x1993e4(_0x44cc55[_0xf6fe('0x1c')][_0xf6fe('0x1b')]);}})[_0xf6fe('0x1d')](function(_0x92d60e){logger[_0xf6fe('0x1a')](_0xf6fe('0x15'),_0x4a93e7,_0x92d60e);_0x1d76da(_0x92d60e);});});}exports['UpdateFaxInteraction']=function(_0x2d53b7){var _0x2f48f5=this;return new Promise(function(_0x3ec3d2,_0x1bc448){return db[_0xf6fe('0x1e')][_0xf6fe('0x1f')](_0x2d53b7[_0xf6fe('0x20')],{'raw':_0x2d53b7[_0xf6fe('0x21')]?_0x2d53b7[_0xf6fe('0x21')][_0xf6fe('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d53b7['options']?_0x2d53b7[_0xf6fe('0x21')][_0xf6fe('0x23')]||null:null,'attributes':_0x2d53b7[_0xf6fe('0x21')]?_0x2d53b7[_0xf6fe('0x21')][_0xf6fe('0x24')]||null:null,'limit':_0x2d53b7[_0xf6fe('0x21')]?_0x2d53b7[_0xf6fe('0x21')][_0xf6fe('0x25')]||null:null})[_0xf6fe('0x14')](function(_0x5d861e){logger['info'](_0xf6fe('0x26'),_0x2d53b7);logger[_0xf6fe('0x17')](_0xf6fe('0x26'),_0x2d53b7,JSON[_0xf6fe('0x19')](_0x5d861e));_0x3ec3d2(_0x5d861e);})['catch'](function(_0x2133f1){logger[_0xf6fe('0x1a')]('UpdateFaxInteraction',_0x2133f1[_0xf6fe('0x1b')],_0x2d53b7);_0x1bc448(_0x2f48f5[_0xf6fe('0x1a')](0x1f4,_0x2133f1['message']));});});};exports[_0xf6fe('0x27')]=function(_0x4d0bfc){return new Promise(function(_0x361c05,_0x5d399b){return db['FaxInteraction'][_0xf6fe('0x28')]({'where':_0x4d0bfc[_0xf6fe('0x21')]?_0x4d0bfc[_0xf6fe('0x21')][_0xf6fe('0x23')]||null:null})[_0xf6fe('0x14')](function(_0x5bf296){if(_0x5bf296){return _0x5bf296['addTags'](_0x4d0bfc[_0xf6fe('0x20')][_0xf6fe('0x29')],_[_0xf6fe('0x2a')](_0x4d0bfc[_0xf6fe('0x20')],['ids','id'])||{});}})[_0xf6fe('0x2b')](function(_0x102d4f){logger['info'](_0xf6fe('0x2c'),_0x4d0bfc);logger[_0xf6fe('0x17')](_0xf6fe('0x2c'),_0x4d0bfc,JSON[_0xf6fe('0x19')](_0x102d4f));_0x361c05(_0x102d4f);})[_0xf6fe('0x1d')](function(_0x20a934){logger[_0xf6fe('0x1a')](_0xf6fe('0x2c'),_0x20a934[_0xf6fe('0x1b')],_0x4d0bfc);_0x5d399b(_this['error'](0x1f4,_0x20a934['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 613d01e..82dab97 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 _0x85f6=['save','remove','update','emit','removeListener','length','./faxInteraction.events'];(function(_0x54b677,_0x21ee34){var _0x27eb0e=function(_0x350500){while(--_0x350500){_0x54b677['push'](_0x54b677['shift']());}};_0x27eb0e(++_0x21ee34);}(_0x85f6,0xdf));var _0x685f=function(_0x5a425c,_0x575774){_0x5a425c=_0x5a425c-0x0;var _0x295469=_0x85f6[_0x5a425c];return _0x295469;};'use strict';var FaxInteractionEvents=require(_0x685f('0x0'));var events=[_0x685f('0x1'),_0x685f('0x2'),_0x685f('0x3')];function createListener(_0x465bad,_0x39b453){return function(_0x27abc2){_0x39b453[_0x685f('0x4')](_0x465bad,_0x27abc2);};}function removeListener(_0x54f8ec,_0x4a76d8){return function(){FaxInteractionEvents[_0x685f('0x5')](_0x54f8ec,_0x4a76d8);};}exports['register']=function(_0x98c767){for(var _0xc77b8e=0x0,_0x818bb=events[_0x685f('0x6')];_0xc77b8e<_0x818bb;_0xc77b8e++){var _0x2a42f0=events[_0xc77b8e];var _0x2ca81d=createListener('faxInteraction:'+_0x2a42f0,_0x98c767);FaxInteractionEvents['on'](_0x2a42f0,_0x2ca81d);}}; \ No newline at end of file +var _0x6546=['length','faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register'];(function(_0x1ecd1d,_0x296b4d){var _0x406ef1=function(_0xf20c33){while(--_0xf20c33){_0x1ecd1d['push'](_0x1ecd1d['shift']());}};_0x406ef1(++_0x296b4d);}(_0x6546,0x1e2));var _0x6654=function(_0x5867da,_0x10af6a){_0x5867da=_0x5867da-0x0;var _0x2e3cc4=_0x6546[_0x5867da];return _0x2e3cc4;};'use strict';var FaxInteractionEvents=require(_0x6654('0x0'));var events=[_0x6654('0x1'),'remove',_0x6654('0x2')];function createListener(_0x3e63e8,_0x12e042){return function(_0x2547e3){_0x12e042[_0x6654('0x3')](_0x3e63e8,_0x2547e3);};}function removeListener(_0x49fedd,_0x35426b){return function(){FaxInteractionEvents[_0x6654('0x4')](_0x49fedd,_0x35426b);};}exports[_0x6654('0x5')]=function(_0x9dcfde){for(var _0x2b84c0=0x0,_0x306158=events[_0x6654('0x6')];_0x2b84c0<_0x306158;_0x2b84c0++){var _0x3b20b6=events[_0x2b84c0];var _0x4166c3=createListener(_0x6654('0x7')+_0x3b20b6,_0x9dcfde);FaxInteractionEvents['on'](_0x3b20b6,_0x4166c3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fd93e78..abd3c84 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 _0x1d5c=['/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','fax','faxinteraction:addtags','tracked','faxinteraction:update','update','faxinteraction:destroy','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x289fd4,_0xd34ba6){_0x289fd4=_0x289fd4-0x0;var _0x3d4a88=_0x1d5c[_0x289fd4];return _0x3d4a88;};'use strict';var multer=require(_0xc1d5('0x0'));var util=require(_0xc1d5('0x1'));var path=require(_0xc1d5('0x2'));var timeout=require(_0xc1d5('0x3'));var express=require(_0xc1d5('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1d5('0x5'));var controller=require('./faxInteraction.controller');router[_0xc1d5('0x6')]('/',auth[_0xc1d5('0x7')](),controller['index']);router[_0xc1d5('0x6')](_0xc1d5('0x8'),auth[_0xc1d5('0x7')](),controller[_0xc1d5('0x9')]);router[_0xc1d5('0x6')](_0xc1d5('0xa'),auth['isAuthenticated'](),controller[_0xc1d5('0xb')]);router[_0xc1d5('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc1d5('0xc')]);router[_0xc1d5('0x6')](_0xc1d5('0xd'),auth[_0xc1d5('0x7')](),controller[_0xc1d5('0xe')]);router[_0xc1d5('0xf')]('/',auth[_0xc1d5('0x7')](),controller[_0xc1d5('0x10')]);router[_0xc1d5('0xf')](_0xc1d5('0x11'),auth['isAuthenticated'](),controller[_0xc1d5('0x12')]);router[_0xc1d5('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xc1d5('0x13'),_0xc1d5('0x14')),controller['addTags']);router['put']('/:id',auth[_0xc1d5('0x7')](),interaction[_0xc1d5('0x15')](_0xc1d5('0x13'),_0xc1d5('0x16')),controller[_0xc1d5('0x17')]);router['delete']('/:id',auth[_0xc1d5('0x7')](),interaction[_0xc1d5('0x15')](_0xc1d5('0x13'),_0xc1d5('0x18')),controller['destroy']);router[_0xc1d5('0x19')]('/:id/tags',auth[_0xc1d5('0x7')](),controller['removeTags']);module[_0xc1d5('0x1a')]=router; \ No newline at end of file +var _0x313c=['faxinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete'];(function(_0x427715,_0x20386e){var _0x4a5802=function(_0x166821){while(--_0x166821){_0x427715['push'](_0x427715['shift']());}};_0x4a5802(++_0x20386e);}(_0x313c,0x1f3));var _0xc313=function(_0x16ab86,_0x12474a){_0x16ab86=_0x16ab86-0x0;var _0xf37a61=_0x313c[_0x16ab86];return _0xf37a61;};'use strict';var multer=require(_0xc313('0x0'));var util=require('util');var path=require(_0xc313('0x1'));var timeout=require(_0xc313('0x2'));var express=require(_0xc313('0x3'));var router=express[_0xc313('0x4')]();var auth=require(_0xc313('0x5'));var interaction=require(_0xc313('0x6'));var config=require(_0xc313('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc313('0x8')]);router[_0xc313('0x9')](_0xc313('0xa'),auth[_0xc313('0xb')](),controller[_0xc313('0xc')]);router[_0xc313('0x9')]('/:id',auth[_0xc313('0xb')](),controller[_0xc313('0xd')]);router[_0xc313('0x9')](_0xc313('0xe'),auth[_0xc313('0xb')](),controller['getMessages']);router['get'](_0xc313('0xf'),auth['isAuthenticated'](),controller[_0xc313('0x10')]);router[_0xc313('0x11')]('/',auth[_0xc313('0xb')](),controller[_0xc313('0x12')]);router[_0xc313('0x11')](_0xc313('0xe'),auth[_0xc313('0xb')](),controller[_0xc313('0x13')]);router[_0xc313('0x11')]('/:id/tags',auth[_0xc313('0xb')](),interaction[_0xc313('0x14')](_0xc313('0x15'),_0xc313('0x16')),controller[_0xc313('0x17')]);router[_0xc313('0x18')](_0xc313('0x19'),auth[_0xc313('0xb')](),interaction[_0xc313('0x14')](_0xc313('0x15'),_0xc313('0x1a')),controller[_0xc313('0x1b')]);router[_0xc313('0x1c')](_0xc313('0x19'),auth[_0xc313('0xb')](),interaction['tracked'](_0xc313('0x15'),_0xc313('0x1d')),controller[_0xc313('0x1e')]);router['delete'](_0xc313('0x1f'),auth[_0xc313('0xb')](),controller[_0xc313('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 903c767..f494d47 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 _0x5ff4=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x448054,_0x4a44bd){var _0x18a1a6=function(_0x13b0ac){while(--_0x13b0ac){_0x448054['push'](_0x448054['shift']());}};_0x18a1a6(++_0x4a44bd);}(_0x5ff4,0x1b5));var _0x45ff=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5ff4[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x45ff('0x0'));module[_0x45ff('0x1')]={'body':{'type':Sequelize[_0x45ff('0x2')](_0x45ff('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x45ff('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x45ff('0x5')]('in',_0x45ff('0x6')),'defaultValue':_0x45ff('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x45ff('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x45ff('0x7')]}}; \ No newline at end of file +var _0xee05=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x263a65,_0x9a3826){var _0x361393=function(_0x1e3cc8){while(--_0x1e3cc8){_0x263a65['push'](_0x263a65['shift']());}};_0x361393(++_0x9a3826);}(_0xee05,0x13f));var _0x5ee0=function(_0x5b9a1d,_0x473e49){_0x5b9a1d=_0x5b9a1d-0x0;var _0x37e81a=_0xee05[_0x5b9a1d];return _0x37e81a;};'use strict';var Sequelize=require(_0x5ee0('0x0'));module[_0x5ee0('0x1')]={'body':{'type':Sequelize[_0x5ee0('0x2')](_0x5ee0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5ee0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ee0('0x5')]('in',_0x5ee0('0x6')),'defaultValue':_0x5ee0('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5ee0('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5ee0('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 638f99d..8eccd47 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 _0xa885=['zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','status','end','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','include','rows','show','params','rawAttributes','includeAll','find','body','describe','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','CmContact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','UserId','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','server','files','attachments','eml-format'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa885,0x1a3));var _0x5a88=function(_0x324e07,_0x455af9){_0x324e07=_0x324e07-0x0;var _0x16976e=_0xa885[_0x324e07];return _0x16976e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a88('0x2'));var BPromise=require(_0x5a88('0x3'));var Mustache=require(_0x5a88('0x4'));var util=require(_0x5a88('0x5'));var path=require(_0x5a88('0x6'));var sox=require('sox');var csv=require(_0x5a88('0x7'));var ejs=require(_0x5a88('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a88('0x9'));var crypto=require(_0x5a88('0xa'));var jsforce=require(_0x5a88('0xb'));var deskjs=require(_0x5a88('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a88('0xd'));var Papa=require(_0x5a88('0xe'));var Redis=require(_0x5a88('0xf'));var authService=require(_0x5a88('0x10'));var qs=require(_0x5a88('0x11'));var as=require(_0x5a88('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a88('0x13'))(_0x5a88('0x14'));var utils=require(_0x5a88('0x15'));var config=require(_0x5a88('0x16'));var db=require('../../mysqldb')['db'];config[_0x5a88('0x17')]=_[_0x5a88('0x18')](config['redis'],{'host':_0x5a88('0x19'),'port':0x18eb});var socket=require(_0x5a88('0x1a'))(new Redis(config[_0x5a88('0x17')]));require('./faxMessage.socket')[_0x5a88('0x1b')](socket);var jayson=require(_0x5a88('0x1c'));var client=jayson[_0x5a88('0x1d')][_0x5a88('0x1e')]({'port':0x232c});var client9002=jayson[_0x5a88('0x1d')][_0x5a88('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x11b143,_0x33460c,_0x110093){if(_0x110093){var _0x471400=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x471400['test'](_0x33460c)){return _0x11b143;}else{throw new db[(_0x5a88('0x1f'))][(_0x5a88('0x20'))](_0x5a88('0x21'));}}else{return _0x11b143;}}function respondWithRpcPromise(_0xe7a2f1,_0x2ead13,_0x26afc2,_0x295682){return new BPromise(function(_0x5e6436,_0x226a59){var _0x532d9f=_0x295682||client;return _0x532d9f[_0x5a88('0x22')](_0xe7a2f1,_0x26afc2)['then'](function(_0x570c61){logger[_0x5a88('0x23')]('FaxMessage,\x20%s,\x20%s',_0x2ead13,_0x5a88('0x24'));logger[_0x5a88('0x25')](_0x5a88('0x26'),_0x2ead13,_0x5a88('0x24'),JSON[_0x5a88('0x27')](_0x570c61));if(_0x570c61[_0x5a88('0x28')]){if(_0x570c61[_0x5a88('0x28')][_0x5a88('0x29')]===0x1f4){logger[_0x5a88('0x28')]('FaxMessage,\x20%s,\x20%s',_0x2ead13,_0x570c61[_0x5a88('0x28')][_0x5a88('0x2a')]);return _0x226a59(_0x570c61[_0x5a88('0x28')][_0x5a88('0x2a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2ead13,_0x570c61[_0x5a88('0x28')]['message']);return _0x5e6436(_0x570c61['error']['message']);}else{logger[_0x5a88('0x23')](_0x5a88('0x2b'),_0x2ead13,_0x5a88('0x24'));_0x5e6436(_0x570c61[_0x5a88('0x2c')][_0x5a88('0x2a')]);}})[_0x5a88('0x2d')](function(_0x12c3f6){logger[_0x5a88('0x28')](_0x5a88('0x2b'),_0x2ead13,_0x12c3f6);_0x226a59(_0x12c3f6);});});}function respondWithStatusCode(_0x1f2aae,_0xa6ea2d){_0xa6ea2d=_0xa6ea2d||0xcc;return function(_0x41448d){if(_0x41448d){return _0x1f2aae['sendStatus'](_0xa6ea2d);}return _0x1f2aae[_0x5a88('0x2e')](_0xa6ea2d)[_0x5a88('0x2f')]();};}function respondWithResult(_0x4b0697,_0x23795e){_0x23795e=_0x23795e||0xc8;return function(_0x112008){if(_0x112008){return _0x4b0697[_0x5a88('0x2e')](_0x23795e)['json'](_0x112008);}};}function respondWithFilteredResult(_0x211446,_0x287126){return function(_0x1c701e){if(_0x1c701e){var _0x33a775=_0x1c701e['count'],_0xcb085=_0x287126[_0x5a88('0x30')],_0x38ef0d=_0x287126[_0x5a88('0x30')]+_0x287126['limit'],_0x2d440e;if(_0x38ef0d>=_0x33a775){_0x38ef0d=_0x33a775;_0x2d440e=0xc8;}else{_0x2d440e=0xce;}_0x211446[_0x5a88('0x2e')](_0x2d440e);return _0x211446[_0x5a88('0x31')](_0x5a88('0x32'),_0xcb085+'-'+_0x38ef0d+'/'+_0x33a775)[_0x5a88('0x33')](_0x1c701e);}return null;};}function patchUpdates(_0x3b29b3){return function(_0x3cecc0){try{jsonpatch[_0x5a88('0x34')](_0x3cecc0,_0x3b29b3,!![]);}catch(_0x35048e){return BPromise[_0x5a88('0x35')](_0x35048e);}return _0x3cecc0['save']();};}function saveUpdates(_0x2d5840,_0x7ea6b){return function(_0x559957){if(_0x559957){return _0x559957[_0x5a88('0x36')](_0x2d5840)[_0x5a88('0x37')](function(_0x24d269){return _0x24d269;});}return null;};}function removeEntity(_0xf93961,_0x36dd91){return function(_0x4cc700){if(_0x4cc700){return _0x4cc700[_0x5a88('0x38')]()[_0x5a88('0x37')](function(){_0xf93961[_0x5a88('0x2e')](0xcc)[_0x5a88('0x2f')]();});}};}function handleEntityNotFound(_0x4f04ba,_0xeedd54){return function(_0x55eb6e){if(!_0x55eb6e){_0x4f04ba[_0x5a88('0x39')](0x194);}return _0x55eb6e;};}function handleError(_0x2393fc,_0x275f3b){_0x275f3b=_0x275f3b||0x1f4;return function(_0x41f450){logger[_0x5a88('0x28')](_0x41f450[_0x5a88('0x3a')]);if(_0x41f450[_0x5a88('0x3b')]){delete _0x41f450[_0x5a88('0x3b')];}_0x2393fc[_0x5a88('0x2e')](_0x275f3b)[_0x5a88('0x3c')](_0x41f450);};}exports[_0x5a88('0x3d')]=function(_0x258429,_0x41a025){var _0x146a31={},_0x549d40={},_0x9b65d6={'count':0x0,'rows':[]};var _0x181116=_[_0x5a88('0x3e')](db[_0x5a88('0x3f')]['rawAttributes'],function(_0x87688f){return{'name':_0x87688f[_0x5a88('0x40')],'type':_0x87688f['type'][_0x5a88('0x41')]};});_0x549d40[_0x5a88('0x42')]=_[_0x5a88('0x3e')](_0x181116,_0x5a88('0x3b'));_0x549d40[_0x5a88('0x43')]=_[_0x5a88('0x44')](_0x258429[_0x5a88('0x43')]);_0x549d40[_0x5a88('0x45')]=_[_0x5a88('0x46')](_0x549d40['model'],_0x549d40[_0x5a88('0x43')]);_0x146a31[_0x5a88('0x47')]=_[_0x5a88('0x46')](_0x549d40['model'],qs[_0x5a88('0x48')](_0x258429[_0x5a88('0x43')][_0x5a88('0x48')]));_0x146a31[_0x5a88('0x47')]=_0x146a31[_0x5a88('0x47')][_0x5a88('0x49')]?_0x146a31[_0x5a88('0x47')]:_0x549d40[_0x5a88('0x42')];if(!_0x258429[_0x5a88('0x43')][_0x5a88('0x4a')](_0x5a88('0x4b'))){_0x146a31[_0x5a88('0x4c')]=qs['limit'](_0x258429['query'][_0x5a88('0x4c')]);_0x146a31[_0x5a88('0x30')]=qs[_0x5a88('0x30')](_0x258429[_0x5a88('0x43')]['offset']);}_0x146a31[_0x5a88('0x4d')]=qs[_0x5a88('0x4e')](_0x258429[_0x5a88('0x43')][_0x5a88('0x4e')]);_0x146a31[_0x5a88('0x4f')]=qs['filters'](_[_0x5a88('0x50')](_0x258429[_0x5a88('0x43')],_0x549d40[_0x5a88('0x45')]),_0x181116);if(_0x258429[_0x5a88('0x43')]['filter']){_0x146a31[_0x5a88('0x4f')]=_[_0x5a88('0x51')](_0x146a31[_0x5a88('0x4f')],{'$or':_[_0x5a88('0x3e')](_0x181116,function(_0x47c069){if(_0x47c069[_0x5a88('0x52')]!==_0x5a88('0x53')){var _0x1de17d={};_0x1de17d[_0x47c069[_0x5a88('0x3b')]]={'$like':'%'+_0x258429[_0x5a88('0x43')][_0x5a88('0x54')]+'%'};return _0x1de17d;}})});}_0x146a31=_['merge']({},_0x146a31,_0x258429[_0x5a88('0x55')]);var _0x305128={'where':_0x146a31[_0x5a88('0x4f')]};return db[_0x5a88('0x3f')][_0x5a88('0x56')](_0x305128)[_0x5a88('0x37')](function(_0x3bc3ee){_0x9b65d6[_0x5a88('0x56')]=_0x3bc3ee;if(_0x258429[_0x5a88('0x43')]['includeAll']){_0x146a31[_0x5a88('0x57')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x146a31);})[_0x5a88('0x37')](function(_0x53ee9a){_0x9b65d6[_0x5a88('0x58')]=_0x53ee9a;return _0x9b65d6;})[_0x5a88('0x37')](respondWithFilteredResult(_0x41a025,_0x146a31))[_0x5a88('0x2d')](handleError(_0x41a025,null));};exports[_0x5a88('0x59')]=function(_0x4d61df,_0x265c71){var _0x451834={'raw':!![],'where':{'id':_0x4d61df[_0x5a88('0x5a')]['id']}},_0x1745af={};_0x1745af[_0x5a88('0x42')]=_[_0x5a88('0x44')](db['FaxMessage'][_0x5a88('0x5b')]);_0x1745af[_0x5a88('0x43')]=_['keys'](_0x4d61df[_0x5a88('0x43')]);_0x1745af[_0x5a88('0x45')]=_[_0x5a88('0x46')](_0x1745af['model'],_0x1745af[_0x5a88('0x43')]);_0x451834[_0x5a88('0x47')]=_[_0x5a88('0x46')](_0x1745af[_0x5a88('0x42')],qs[_0x5a88('0x48')](_0x4d61df['query'][_0x5a88('0x48')]));_0x451834[_0x5a88('0x47')]=_0x451834[_0x5a88('0x47')]['length']?_0x451834[_0x5a88('0x47')]:_0x1745af['model'];if(_0x4d61df[_0x5a88('0x43')][_0x5a88('0x5c')]){_0x451834[_0x5a88('0x57')]=[{'all':!![]}];}_0x451834=_['merge']({},_0x451834,_0x4d61df['options']);return db[_0x5a88('0x3f')][_0x5a88('0x5d')](_0x451834)[_0x5a88('0x37')](handleEntityNotFound(_0x265c71,null))[_0x5a88('0x37')](respondWithResult(_0x265c71,null))[_0x5a88('0x2d')](handleError(_0x265c71,null));};exports['update']=function(_0x3891f6,_0x49c899){if(_0x3891f6[_0x5a88('0x5e')]['id']){delete _0x3891f6['body']['id'];}return db[_0x5a88('0x3f')][_0x5a88('0x5d')]({'where':{'id':_0x3891f6['params']['id']}})[_0x5a88('0x37')](handleEntityNotFound(_0x49c899,null))[_0x5a88('0x37')](saveUpdates(_0x3891f6['body'],null))['then'](respondWithResult(_0x49c899,null))[_0x5a88('0x2d')](handleError(_0x49c899,null));};exports[_0x5a88('0x38')]=function(_0x22be73,_0x43acff){return db[_0x5a88('0x3f')][_0x5a88('0x5d')]({'where':{'id':_0x22be73[_0x5a88('0x5a')]['id']}})['then'](handleEntityNotFound(_0x43acff,null))[_0x5a88('0x37')](removeEntity(_0x43acff,null))[_0x5a88('0x2d')](handleError(_0x43acff,null));};exports[_0x5a88('0x5f')]=function(_0x3b4f73,_0x3a8319){return db[_0x5a88('0x3f')]['describe']()[_0x5a88('0x37')](respondWithResult(_0x3a8319,null))[_0x5a88('0x2d')](handleError(_0x3a8319,null));};var interaction_log=require(_0x5a88('0x13'))('fax-interactions');exports[_0x5a88('0x60')]=function(_0x397ba5,_0x5ec3c8,_0x4583c4){var _0x311713={'channel':_0x5a88('0x61')};if(_0x397ba5[_0x5a88('0x5e')]['id']){delete _0x397ba5[_0x5a88('0x5e')]['id'];}_0x397ba5[_0x5a88('0x5e')]['read']=!![];_0x397ba5[_0x5a88('0x5e')][_0x5a88('0x62')]=moment()[_0x5a88('0x63')](_0x5a88('0x64'));_0x397ba5[_0x5a88('0x5e')]['UserId']=_0x397ba5['body']['UserId']||_0x397ba5[_0x5a88('0x65')]['id'];return db[_0x5a88('0x3f')][_0x5a88('0x5d')]({'where':{'id':_0x397ba5[_0x5a88('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x5a88('0x66')],'as':'Contact'}]})[_0x5a88('0x37')](handleEntityNotFound(_0x5ec3c8,null))[_0x5a88('0x37')](saveUpdates(_0x397ba5[_0x5a88('0x5e')],null))[_0x5a88('0x37')](function(_0x24fdb0){if(_0x24fdb0){_0x311713[_0x5a88('0x2a')]=_0x24fdb0['get']({'plain':!![]});return db[_0x5a88('0x67')][_0x5a88('0x5d')]({'where':{'id':_0x24fdb0[_0x5a88('0x68')]}});}return null;})[_0x5a88('0x37')](handleEntityNotFound(_0x5ec3c8,null))[_0x5a88('0x37')](function(_0x389183){if(_0x389183){return _0x389183[_0x5a88('0x36')]({'UserId':_0x397ba5['body']['UserId'],'read1stAt':_[_0x5a88('0x69')](_0x389183[_0x5a88('0x6a')])?moment()[_0x5a88('0x63')](_0x5a88('0x64')):undefined});}return null;})[_0x5a88('0x37')](function(_0x310d8d){if(_0x310d8d){_0x311713[_0x5a88('0x6b')]=_0x310d8d[_0x5a88('0x6c')]({'plain':!![]});interaction_log[_0x5a88('0x23')](_0x5a88('0x6d'),_0x397ba5[_0x5a88('0x65')]['id'],_0x397ba5[_0x5a88('0x65')][_0x5a88('0x3b')],_0x397ba5[_0x5a88('0x65')][_0x5a88('0x6e')],_0x311713[_0x5a88('0x6b')]['id'],_0x397ba5[_0x5a88('0x5e')]?JSON[_0x5a88('0x27')](_0x397ba5['body']):'null');return respondWithRpcPromise(_0x5a88('0x6f'),_0x5a88('0x70'),_0x311713);}return null;})[_0x5a88('0x37')](function(_0x47eba2){if(_0x47eba2){if(_0x397ba5[_0x5a88('0x5e')][_0x5a88('0x71')]){_0x311713[_0x5a88('0x2a')][_0x5a88('0x72')]=util['format'](_0x5a88('0x73'),_0x397ba5[_0x5a88('0x65')]['name']);_0x311713[_0x5a88('0x2a')]['channel']=_0x311713[_0x5a88('0x74')];_0x311713[_0x5a88('0x2a')]['event']=_0x5a88('0x60');return respondWithRpcPromise(_0x5a88('0x75'),_0x5a88('0x75'),{'event':_0x5a88('0x76'),'message':_0x311713[_0x5a88('0x2a')]},client9002)['then'](function(){return _0x311713;});}return _0x311713;}return null;})[_0x5a88('0x37')](respondWithResult(_0x5ec3c8,null))[_0x5a88('0x2d')](handleError(_0x5ec3c8,null));};var interaction_log=require('../../config/logger')(_0x5a88('0x77'));exports[_0x5a88('0x35')]=function(_0x1c2fb4,_0xa5e36,_0x4c5aaa){var _0x53a57b={'agent':{},'channel':_0x5a88('0x61')};if(_0x1c2fb4[_0x5a88('0x5e')]['id']){delete _0x1c2fb4['body']['id'];}_0x1c2fb4[_0x5a88('0x5e')][_0x5a88('0x78')]=_0x1c2fb4[_0x5a88('0x5e')][_0x5a88('0x78')]||_0x1c2fb4[_0x5a88('0x65')]['id'];_0x53a57b[_0x5a88('0x79')]['id']=_0x1c2fb4[_0x5a88('0x5e')][_0x5a88('0x78')];return db[_0x5a88('0x3f')][_0x5a88('0x5d')]({'where':{'id':_0x1c2fb4[_0x5a88('0x5a')]['id'],'UserId':null}})[_0x5a88('0x37')](handleEntityNotFound(_0xa5e36,null))[_0x5a88('0x37')](function(_0x103666){if(_0x103666){_0x53a57b['message']=_0x103666[_0x5a88('0x6c')]({'plain':!![]});return db[_0x5a88('0x67')][_0x5a88('0x5d')]({'where':{'id':_0x103666[_0x5a88('0x68')]}});}return null;})[_0x5a88('0x37')](handleEntityNotFound(_0xa5e36,null))[_0x5a88('0x37')](function(_0x131366){if(_0x131366){_0x53a57b[_0x5a88('0x6b')]=_0x131366[_0x5a88('0x6c')]({'plain':!![]});interaction_log[_0x5a88('0x23')](_0x5a88('0x7a'),_0x1c2fb4[_0x5a88('0x65')]['id'],_0x1c2fb4['user']['name'],_0x1c2fb4[_0x5a88('0x65')]['role'],_0x53a57b[_0x5a88('0x6b')]['id'],_0x1c2fb4[_0x5a88('0x5e')]?JSON[_0x5a88('0x27')](_0x1c2fb4[_0x5a88('0x5e')]):_0x5a88('0x7b'));return respondWithRpcPromise(_0x5a88('0x7c'),_0x5a88('0x7d'),_0x53a57b);}return null;})[_0x5a88('0x37')](function(_0x2df598){if(_0x2df598){_0x2df598[_0x5a88('0x2a')][_0x5a88('0x72')]=util[_0x5a88('0x63')](_0x5a88('0x73'),_0x1c2fb4[_0x5a88('0x65')][_0x5a88('0x3b')]);_0x2df598[_0x5a88('0x2a')][_0x5a88('0x74')]=_0x53a57b['channel'];_0x2df598[_0x5a88('0x2a')][_0x5a88('0x7e')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x5a88('0x7f'),'message':_0x2df598[_0x5a88('0x2a')]},client9002);return _0x53a57b;}return null;})[_0x5a88('0x37')](respondWithResult(_0xa5e36,null))[_0x5a88('0x2d')](handleError(_0xa5e36,null));};exports['create']=function(_0x5032aa,_0x397135){var _0x47a1d2;return db[_0x5a88('0x3f')][_0x5a88('0x80')](_0x5032aa['body'],{})['then'](function(_0x395403){_0x47a1d2=_0x395403;return db[_0x5a88('0x66')][_0x5a88('0x81')]({'where':{'id':_0x47a1d2[_0x5a88('0x82')]}});})[_0x5a88('0x37')](function(_0x1ccce4){if(_['isNil'](_0x1ccce4)){return;}else{_0x47a1d2[_0x5a88('0x61')]=_0x1ccce4[_0x5a88('0x61')];return db[_0x5a88('0x83')]['findOne']({'where':{'id':_0x47a1d2[_0x5a88('0x84')]}});}})[_0x5a88('0x37')](function(_0x3b6869){return respondWithRpcPromise(_0x5a88('0x85'),'SendFax',{'FaxAccountId':_[_0x5a88('0x69')](_0x5032aa[_0x5a88('0x5e')])?undefined:_0x5032aa['body'][_0x5a88('0x86')],'path':_['isNil'](_0x3b6869)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x3b6869[_0x5a88('0x87')]),'fax':_[_0x5a88('0x69')](_0x47a1d2[_0x5a88('0x61')])?undefined:_0x47a1d2[_0x5a88('0x61')],'AttachmentId':_0x47a1d2[_0x5a88('0x84')]},client9002);})['then'](respondWithResult(_0x397135,0xc9))[_0x5a88('0x2d')](handleError(_0x397135,null));};exports[_0x5a88('0x88')]=function(_0x537b34,_0x54de92){var _0x49abc5=path['join'](config['root'],_0x5a88('0x89'),_0x5a88('0x8a'),_0x5a88('0x8b'));return db[_0x5a88('0x3f')][_0x5a88('0x5d')]({'where':{'id':_0x537b34['params']['id']},'include':[{'model':db[_0x5a88('0x83')],'as':'Attachment'}]})[_0x5a88('0x37')](handleEntityNotFound(_0x54de92,null))['then'](function(_0x37374c){if(_0x37374c){return _0x54de92[_0x5a88('0x88')](path['join'](_0x49abc5,_0x37374c[_0x5a88('0x83')][_0x5a88('0x87')]));}})['catch'](handleError(_0x54de92,null));}; \ No newline at end of file +var _0x6c7d=['stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','FaxInteractionId','create','findOne','ContactId','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./faxMessage.socket','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','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy'];(function(_0xe495ee,_0x4ff219){var _0x28632d=function(_0x23e12a){while(--_0x23e12a){_0xe495ee['push'](_0xe495ee['shift']());}};_0x28632d(++_0x4ff219);}(_0x6c7d,0x15c));var _0xd6c7=function(_0x354394,_0x46c078){_0x354394=_0x354394-0x0;var _0x54d1d1=_0x6c7d[_0x354394];return _0x54d1d1;};'use strict';var pdf=require(_0xd6c7('0x0'));var emlformat=require(_0xd6c7('0x1'));var rimraf=require(_0xd6c7('0x2'));var zipdir=require(_0xd6c7('0x3'));var jsonpatch=require(_0xd6c7('0x4'));var rp=require(_0xd6c7('0x5'));var moment=require('moment');var BPromise=require(_0xd6c7('0x6'));var Mustache=require(_0xd6c7('0x7'));var util=require(_0xd6c7('0x8'));var path=require(_0xd6c7('0x9'));var sox=require(_0xd6c7('0xa'));var csv=require(_0xd6c7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6c7('0xc'));var squel=require(_0xd6c7('0xd'));var crypto=require(_0xd6c7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd6c7('0xf'));var toCsv=require(_0xd6c7('0xb'));var querystring=require(_0xd6c7('0x10'));var Papa=require(_0xd6c7('0x11'));var Redis=require(_0xd6c7('0x12'));var authService=require(_0xd6c7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd6c7('0x14'));var hardwareService=require(_0xd6c7('0x15'));var logger=require(_0xd6c7('0x16'))(_0xd6c7('0x17'));var utils=require(_0xd6c7('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd6c7('0x19')]=_['defaults'](config[_0xd6c7('0x19')],{'host':_0xd6c7('0x1a'),'port':0x18eb});var socket=require(_0xd6c7('0x1b'))(new Redis(config[_0xd6c7('0x19')]));require(_0xd6c7('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd6c7('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xd6c7('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4fe45b,_0x586911,_0x289bde){if(_0x289bde){var _0x5eabc5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5eabc5['test'](_0x586911)){return _0x4fe45b;}else{throw new db[(_0xd6c7('0x1e'))][(_0xd6c7('0x1f'))](_0xd6c7('0x20'));}}else{return _0x4fe45b;}}function respondWithRpcPromise(_0x1ee3cc,_0x4c08e2,_0x23bc46,_0x3573a4){return new BPromise(function(_0xbecd51,_0x2e15ad){var _0x58a695=_0x3573a4||client;return _0x58a695['request'](_0x1ee3cc,_0x23bc46)[_0xd6c7('0x21')](function(_0xf7c518){logger[_0xd6c7('0x22')](_0xd6c7('0x23'),_0x4c08e2,'request\x20sent');logger[_0xd6c7('0x24')](_0xd6c7('0x25'),_0x4c08e2,_0xd6c7('0x26'),JSON[_0xd6c7('0x27')](_0xf7c518));if(_0xf7c518[_0xd6c7('0x28')]){if(_0xf7c518[_0xd6c7('0x28')][_0xd6c7('0x29')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4c08e2,_0xf7c518[_0xd6c7('0x28')][_0xd6c7('0x2a')]);return _0x2e15ad(_0xf7c518[_0xd6c7('0x28')][_0xd6c7('0x2a')]);}logger['error'](_0xd6c7('0x23'),_0x4c08e2,_0xf7c518[_0xd6c7('0x28')][_0xd6c7('0x2a')]);return _0xbecd51(_0xf7c518['error']['message']);}else{logger[_0xd6c7('0x22')](_0xd6c7('0x23'),_0x4c08e2,_0xd6c7('0x26'));_0xbecd51(_0xf7c518[_0xd6c7('0x2b')][_0xd6c7('0x2a')]);}})[_0xd6c7('0x2c')](function(_0x396ce1){logger[_0xd6c7('0x28')]('FaxMessage,\x20%s,\x20%s',_0x4c08e2,_0x396ce1);_0x2e15ad(_0x396ce1);});});}function respondWithStatusCode(_0xe881f0,_0x3bfe8a){_0x3bfe8a=_0x3bfe8a||0xcc;return function(_0x168df0){if(_0x168df0){return _0xe881f0[_0xd6c7('0x2d')](_0x3bfe8a);}return _0xe881f0[_0xd6c7('0x2e')](_0x3bfe8a)[_0xd6c7('0x2f')]();};}function respondWithResult(_0x5048d6,_0x4e56df){_0x4e56df=_0x4e56df||0xc8;return function(_0x127266){if(_0x127266){return _0x5048d6[_0xd6c7('0x2e')](_0x4e56df)[_0xd6c7('0x30')](_0x127266);}};}function respondWithFilteredResult(_0x46b238,_0x515cba){return function(_0x876f77){if(_0x876f77){var _0x4aabb0=_0x876f77[_0xd6c7('0x31')],_0xeb0c06=_0x515cba[_0xd6c7('0x32')],_0x399a7c=_0x515cba[_0xd6c7('0x32')]+_0x515cba[_0xd6c7('0x33')],_0x338bee;if(_0x399a7c>=_0x4aabb0){_0x399a7c=_0x4aabb0;_0x338bee=0xc8;}else{_0x338bee=0xce;}_0x46b238[_0xd6c7('0x2e')](_0x338bee);return _0x46b238[_0xd6c7('0x34')]('Content-Range',_0xeb0c06+'-'+_0x399a7c+'/'+_0x4aabb0)[_0xd6c7('0x30')](_0x876f77);}return null;};}function patchUpdates(_0x2afde9){return function(_0x2b69bf){try{jsonpatch[_0xd6c7('0x35')](_0x2b69bf,_0x2afde9,!![]);}catch(_0x198ed6){return BPromise['reject'](_0x198ed6);}return _0x2b69bf[_0xd6c7('0x36')]();};}function saveUpdates(_0x2f346d,_0x5084e2){return function(_0x58c5e9){if(_0x58c5e9){return _0x58c5e9[_0xd6c7('0x37')](_0x2f346d)[_0xd6c7('0x21')](function(_0x198e3c){return _0x198e3c;});}return null;};}function removeEntity(_0x2fcd73,_0x4e7042){return function(_0x1c6993){if(_0x1c6993){return _0x1c6993[_0xd6c7('0x38')]()[_0xd6c7('0x21')](function(){_0x2fcd73['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4106c8,_0x98ed07){return function(_0x1b1fb5){if(!_0x1b1fb5){_0x4106c8[_0xd6c7('0x2d')](0x194);}return _0x1b1fb5;};}function handleError(_0x25f7e8,_0x51e40d){_0x51e40d=_0x51e40d||0x1f4;return function(_0x35076f){logger[_0xd6c7('0x28')](_0x35076f[_0xd6c7('0x39')]);if(_0x35076f[_0xd6c7('0x3a')]){delete _0x35076f[_0xd6c7('0x3a')];}_0x25f7e8[_0xd6c7('0x2e')](_0x51e40d)[_0xd6c7('0x3b')](_0x35076f);};}exports[_0xd6c7('0x3c')]=function(_0x46dd52,_0x448242){var _0x5774c1={},_0x54fdb9={},_0x352746={'count':0x0,'rows':[]};var _0x1223d8=_['map'](db[_0xd6c7('0x3d')][_0xd6c7('0x3e')],function(_0x2502d9){return{'name':_0x2502d9[_0xd6c7('0x3f')],'type':_0x2502d9[_0xd6c7('0x40')]['key']};});_0x54fdb9[_0xd6c7('0x41')]=_[_0xd6c7('0x42')](_0x1223d8,_0xd6c7('0x3a'));_0x54fdb9[_0xd6c7('0x43')]=_[_0xd6c7('0x44')](_0x46dd52['query']);_0x54fdb9[_0xd6c7('0x45')]=_['intersection'](_0x54fdb9[_0xd6c7('0x41')],_0x54fdb9[_0xd6c7('0x43')]);_0x5774c1[_0xd6c7('0x46')]=_[_0xd6c7('0x47')](_0x54fdb9[_0xd6c7('0x41')],qs[_0xd6c7('0x48')](_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x48')]));_0x5774c1[_0xd6c7('0x46')]=_0x5774c1[_0xd6c7('0x46')][_0xd6c7('0x49')]?_0x5774c1[_0xd6c7('0x46')]:_0x54fdb9[_0xd6c7('0x41')];if(!_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x4a')](_0xd6c7('0x4b'))){_0x5774c1[_0xd6c7('0x33')]=qs['limit'](_0x46dd52['query']['limit']);_0x5774c1[_0xd6c7('0x32')]=qs[_0xd6c7('0x32')](_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x32')]);}_0x5774c1[_0xd6c7('0x4c')]=qs[_0xd6c7('0x4d')](_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x4d')]);_0x5774c1[_0xd6c7('0x4e')]=qs[_0xd6c7('0x45')](_[_0xd6c7('0x4f')](_0x46dd52['query'],_0x54fdb9['filters']),_0x1223d8);if(_0x46dd52[_0xd6c7('0x43')]['filter']){_0x5774c1[_0xd6c7('0x4e')]=_[_0xd6c7('0x50')](_0x5774c1[_0xd6c7('0x4e')],{'$or':_[_0xd6c7('0x42')](_0x1223d8,function(_0x55d8c1){if(_0x55d8c1['type']!==_0xd6c7('0x51')){var _0x196dca={};_0x196dca[_0x55d8c1['name']]={'$like':'%'+_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x52')]+'%'};return _0x196dca;}})});}_0x5774c1=_[_0xd6c7('0x50')]({},_0x5774c1,_0x46dd52[_0xd6c7('0x53')]);var _0x17106a={'where':_0x5774c1['where']};return db[_0xd6c7('0x3d')]['count'](_0x17106a)['then'](function(_0x3c36a1){_0x352746[_0xd6c7('0x31')]=_0x3c36a1;if(_0x46dd52[_0xd6c7('0x43')][_0xd6c7('0x54')]){_0x5774c1[_0xd6c7('0x55')]=[{'all':!![]}];}return db[_0xd6c7('0x3d')][_0xd6c7('0x56')](_0x5774c1);})[_0xd6c7('0x21')](function(_0x402223){_0x352746[_0xd6c7('0x57')]=_0x402223;return _0x352746;})['then'](respondWithFilteredResult(_0x448242,_0x5774c1))[_0xd6c7('0x2c')](handleError(_0x448242,null));};exports['show']=function(_0x415b29,_0x314bb7){var _0x2e91f1={'raw':!![],'where':{'id':_0x415b29[_0xd6c7('0x58')]['id']}},_0x3a09c9={};_0x3a09c9['model']=_[_0xd6c7('0x44')](db[_0xd6c7('0x3d')][_0xd6c7('0x3e')]);_0x3a09c9[_0xd6c7('0x43')]=_[_0xd6c7('0x44')](_0x415b29[_0xd6c7('0x43')]);_0x3a09c9[_0xd6c7('0x45')]=_['intersection'](_0x3a09c9['model'],_0x3a09c9[_0xd6c7('0x43')]);_0x2e91f1[_0xd6c7('0x46')]=_['intersection'](_0x3a09c9[_0xd6c7('0x41')],qs['fields'](_0x415b29[_0xd6c7('0x43')][_0xd6c7('0x48')]));_0x2e91f1[_0xd6c7('0x46')]=_0x2e91f1[_0xd6c7('0x46')][_0xd6c7('0x49')]?_0x2e91f1[_0xd6c7('0x46')]:_0x3a09c9[_0xd6c7('0x41')];if(_0x415b29[_0xd6c7('0x43')][_0xd6c7('0x54')]){_0x2e91f1['include']=[{'all':!![]}];}_0x2e91f1=_['merge']({},_0x2e91f1,_0x415b29['options']);return db[_0xd6c7('0x3d')][_0xd6c7('0x59')](_0x2e91f1)['then'](handleEntityNotFound(_0x314bb7,null))[_0xd6c7('0x21')](respondWithResult(_0x314bb7,null))[_0xd6c7('0x2c')](handleError(_0x314bb7,null));};exports[_0xd6c7('0x37')]=function(_0x421c94,_0x3d30c0){if(_0x421c94[_0xd6c7('0x5a')]['id']){delete _0x421c94[_0xd6c7('0x5a')]['id'];}return db['FaxMessage'][_0xd6c7('0x59')]({'where':{'id':_0x421c94[_0xd6c7('0x58')]['id']}})[_0xd6c7('0x21')](handleEntityNotFound(_0x3d30c0,null))[_0xd6c7('0x21')](saveUpdates(_0x421c94[_0xd6c7('0x5a')],null))[_0xd6c7('0x21')](respondWithResult(_0x3d30c0,null))[_0xd6c7('0x2c')](handleError(_0x3d30c0,null));};exports['destroy']=function(_0x31b079,_0x42d6c8){return db['FaxMessage'][_0xd6c7('0x59')]({'where':{'id':_0x31b079[_0xd6c7('0x58')]['id']}})[_0xd6c7('0x21')](handleEntityNotFound(_0x42d6c8,null))[_0xd6c7('0x21')](removeEntity(_0x42d6c8,null))['catch'](handleError(_0x42d6c8,null));};exports['describe']=function(_0xe9fd4a,_0x588cc6){return db[_0xd6c7('0x3d')][_0xd6c7('0x5b')]()[_0xd6c7('0x21')](respondWithResult(_0x588cc6,null))[_0xd6c7('0x2c')](handleError(_0x588cc6,null));};var interaction_log=require(_0xd6c7('0x16'))(_0xd6c7('0x5c'));exports[_0xd6c7('0x5d')]=function(_0x395d06,_0xc5a2ef,_0x24345c){var _0x4f0206={'channel':_0xd6c7('0x5e')};if(_0x395d06[_0xd6c7('0x5a')]['id']){delete _0x395d06['body']['id'];}_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x5f')]=!![];_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x60')]=moment()[_0xd6c7('0x61')](_0xd6c7('0x62'));_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x63')]=_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x63')]||_0x395d06[_0xd6c7('0x64')]['id'];return db[_0xd6c7('0x3d')][_0xd6c7('0x59')]({'where':{'id':_0x395d06[_0xd6c7('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xd6c7('0x65')],'as':_0xd6c7('0x66')}]})[_0xd6c7('0x21')](handleEntityNotFound(_0xc5a2ef,null))[_0xd6c7('0x21')](saveUpdates(_0x395d06[_0xd6c7('0x5a')],null))[_0xd6c7('0x21')](function(_0x1ee62e){if(_0x1ee62e){_0x4f0206[_0xd6c7('0x2a')]=_0x1ee62e[_0xd6c7('0x67')]({'plain':!![]});return db[_0xd6c7('0x68')][_0xd6c7('0x59')]({'where':{'id':_0x1ee62e['FaxInteractionId']}});}return null;})[_0xd6c7('0x21')](handleEntityNotFound(_0xc5a2ef,null))['then'](function(_0x461b5a){if(_0x461b5a){return _0x461b5a[_0xd6c7('0x37')]({'UserId':_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x63')],'read1stAt':_['isNil'](_0x461b5a[_0xd6c7('0x69')])?moment()['format'](_0xd6c7('0x62')):undefined});}return null;})['then'](function(_0x55048d){if(_0x55048d){_0x4f0206[_0xd6c7('0x6a')]=_0x55048d['get']({'plain':!![]});interaction_log['info'](_0xd6c7('0x6b'),_0x395d06[_0xd6c7('0x64')]['id'],_0x395d06[_0xd6c7('0x64')][_0xd6c7('0x3a')],_0x395d06[_0xd6c7('0x64')][_0xd6c7('0x6c')],_0x4f0206[_0xd6c7('0x6a')]['id'],_0x395d06[_0xd6c7('0x5a')]?JSON[_0xd6c7('0x27')](_0x395d06[_0xd6c7('0x5a')]):'null');return respondWithRpcPromise(_0xd6c7('0x6d'),'acceptMessage',_0x4f0206);}return null;})[_0xd6c7('0x21')](function(_0x235c7a){if(_0x235c7a){if(_0x395d06[_0xd6c7('0x5a')][_0xd6c7('0x6e')]){_0x4f0206[_0xd6c7('0x2a')][_0xd6c7('0x6f')]=util[_0xd6c7('0x61')](_0xd6c7('0x70'),_0x395d06[_0xd6c7('0x64')]['name']);_0x4f0206[_0xd6c7('0x2a')]['channel']=_0x4f0206[_0xd6c7('0x71')];_0x4f0206[_0xd6c7('0x2a')][_0xd6c7('0x72')]=_0xd6c7('0x5d');return respondWithRpcPromise('EventManager',_0xd6c7('0x73'),{'event':_0xd6c7('0x74'),'message':_0x4f0206[_0xd6c7('0x2a')]},client9002)['then'](function(){return _0x4f0206;});}return _0x4f0206;}return null;})[_0xd6c7('0x21')](respondWithResult(_0xc5a2ef,null))[_0xd6c7('0x2c')](handleError(_0xc5a2ef,null));};var interaction_log=require(_0xd6c7('0x16'))(_0xd6c7('0x5c'));exports[_0xd6c7('0x75')]=function(_0x5cb01f,_0x33c55c,_0x49d3b6){var _0x1034fe={'agent':{},'channel':'fax'};if(_0x5cb01f[_0xd6c7('0x5a')]['id']){delete _0x5cb01f['body']['id'];}_0x5cb01f['body'][_0xd6c7('0x63')]=_0x5cb01f[_0xd6c7('0x5a')][_0xd6c7('0x63')]||_0x5cb01f[_0xd6c7('0x64')]['id'];_0x1034fe[_0xd6c7('0x76')]['id']=_0x5cb01f[_0xd6c7('0x5a')]['UserId'];return db[_0xd6c7('0x3d')][_0xd6c7('0x59')]({'where':{'id':_0x5cb01f[_0xd6c7('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33c55c,null))[_0xd6c7('0x21')](function(_0xd296de){if(_0xd296de){_0x1034fe['message']=_0xd296de['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0xd296de[_0xd6c7('0x77')]}});}return null;})[_0xd6c7('0x21')](handleEntityNotFound(_0x33c55c,null))[_0xd6c7('0x21')](function(_0x9eac30){if(_0x9eac30){_0x1034fe[_0xd6c7('0x6a')]=_0x9eac30[_0xd6c7('0x67')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5cb01f[_0xd6c7('0x64')]['id'],_0x5cb01f[_0xd6c7('0x64')][_0xd6c7('0x3a')],_0x5cb01f[_0xd6c7('0x64')][_0xd6c7('0x6c')],_0x1034fe[_0xd6c7('0x6a')]['id'],_0x5cb01f[_0xd6c7('0x5a')]?JSON[_0xd6c7('0x27')](_0x5cb01f['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1034fe);}return null;})[_0xd6c7('0x21')](function(_0x41c6fe){if(_0x41c6fe){_0x41c6fe[_0xd6c7('0x2a')]['interface']=util[_0xd6c7('0x61')](_0xd6c7('0x70'),_0x5cb01f[_0xd6c7('0x64')][_0xd6c7('0x3a')]);_0x41c6fe[_0xd6c7('0x2a')][_0xd6c7('0x71')]=_0x1034fe[_0xd6c7('0x71')];_0x41c6fe[_0xd6c7('0x2a')]['event']='reject';respondWithRpcPromise('EventManager',_0xd6c7('0x73'),{'event':'rejectmessage','message':_0x41c6fe[_0xd6c7('0x2a')]},client9002);return _0x1034fe;}return null;})[_0xd6c7('0x21')](respondWithResult(_0x33c55c,null))[_0xd6c7('0x2c')](handleError(_0x33c55c,null));};exports[_0xd6c7('0x78')]=function(_0x4956ca,_0x1d1174){var _0x5a91de;return db[_0xd6c7('0x3d')][_0xd6c7('0x78')](_0x4956ca[_0xd6c7('0x5a')],{})[_0xd6c7('0x21')](function(_0x50e644){_0x5a91de=_0x50e644;return db[_0xd6c7('0x65')][_0xd6c7('0x79')]({'where':{'id':_0x5a91de[_0xd6c7('0x7a')]}});})[_0xd6c7('0x21')](function(_0x1470b1){if(_['isNil'](_0x1470b1)){return;}else{_0x5a91de[_0xd6c7('0x5e')]=_0x1470b1[_0xd6c7('0x5e')];return db['Attachment'][_0xd6c7('0x79')]({'where':{'id':_0x5a91de[_0xd6c7('0x7b')]}});}})[_0xd6c7('0x21')](function(_0x5d33a6){return respondWithRpcPromise(_0xd6c7('0x7c'),_0xd6c7('0x7c'),{'FaxAccountId':_[_0xd6c7('0x7d')](_0x4956ca['body'])?undefined:_0x4956ca[_0xd6c7('0x5a')][_0xd6c7('0x7e')],'path':_[_0xd6c7('0x7d')](_0x5d33a6)?undefined:util[_0xd6c7('0x61')](_0xd6c7('0x7f'),_0x5d33a6[_0xd6c7('0x80')]),'fax':_['isNil'](_0x5a91de['fax'])?undefined:_0x5a91de[_0xd6c7('0x5e')],'AttachmentId':_0x5a91de[_0xd6c7('0x7b')]},client9002);})[_0xd6c7('0x21')](respondWithResult(_0x1d1174,0xc9))['catch'](handleError(_0x1d1174,null));};exports[_0xd6c7('0x81')]=function(_0xc9b01b,_0x290bf2){var _0xc3e0a2=path[_0xd6c7('0x82')](config[_0xd6c7('0x83')],_0xd6c7('0x84'),'files',_0xd6c7('0x85'));return db['FaxMessage']['find']({'where':{'id':_0xc9b01b['params']['id']},'include':[{'model':db[_0xd6c7('0x86')],'as':_0xd6c7('0x86')}]})['then'](handleEntityNotFound(_0x290bf2,null))[_0xd6c7('0x21')](function(_0x2c8d22){if(_0x2c8d22){return _0x290bf2[_0xd6c7('0x81')](path[_0xd6c7('0x82')](_0xc3e0a2,_0x2c8d22['Attachment'][_0xd6c7('0x80')]));}})[_0xd6c7('0x2c')](handleError(_0x290bf2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 10683ba..6b34eba 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x42f87b,_0x549ca1){var _0x320495=function(_0x1633d3){while(--_0x1633d3){_0x42f87b['push'](_0x42f87b['shift']());}};_0x320495(++_0x549ca1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x34e8,0x12c));var _0x834e=function(_0x55448f,_0x580b4c){_0x55448f=_0x55448f-0x0;var _0x3aa57e=_0x34e8[_0x55448f];return _0x3aa57e;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3fd6ad9..598b5f7 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 _0xf7e7=['findOne','FaxInteractionId','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf7e7,0x131));var _0x7f7e=function(_0x1ce488,_0x53feb3){_0x1ce488=_0x1ce488-0x0;var _0x4248eb=_0xf7e7[_0x1ce488];return _0x4248eb;};'use strict';var _=require(_0x7f7e('0x0'));var util=require(_0x7f7e('0x1'));var logger=require('../../config/logger')(_0x7f7e('0x2'));var moment=require(_0x7f7e('0x3'));var BPromise=require(_0x7f7e('0x4'));var rp=require(_0x7f7e('0x5'));var fs=require('fs');var path=require(_0x7f7e('0x6'));var rimraf=require('rimraf');var config=require(_0x7f7e('0x7'));var attributes=require(_0x7f7e('0x8'));module['exports']=function(_0x4a3f1a,_0x3b8bef){return _0x4a3f1a['define']('FaxMessage',attributes,{'tableName':_0x7f7e('0x9'),'paranoid':![],'indexes':[{'name':_0x7f7e('0xa'),'fields':['body'],'type':_0x7f7e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26f3df,_0x1ebd6f,_0xc2d811){var _0x7c011e=_0x4a3f1a[_0x7f7e('0xc')];var _0x441563=_0x26f3df['get']({'plain':!![]});if(_0x441563[_0x7f7e('0xd')][_0x7f7e('0xe')]()==='in'||_0x441563[_0x7f7e('0xd')][_0x7f7e('0xe')]()===_0x7f7e('0xf')&&!_0x441563[_0x7f7e('0x10')]&&!_[_0x7f7e('0x11')](_0x441563[_0x7f7e('0x12')])){_0x7c011e[_0x7f7e('0x13')][_0x7f7e('0x14')]({'where':{'id':_0x441563[_0x7f7e('0x15')]}})['then'](function(_0xe51703){if(_0xe51703){_0xe51703['update']({'lastMsgAt':_0x441563['createdAt'],'lastMsgDirection':_0x441563[_0x7f7e('0xd')]['toLowerCase']()});}})[_0x7f7e('0x16')](function(_0x5bae15){console['error'](_0x5bae15);});}_0xc2d811();}},'charset':_0x7f7e('0x17'),'collate':_0x7f7e('0x18')});}; \ No newline at end of file +var _0xde92=['bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','direction','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x88757c,_0x105b33){var _0x502354=function(_0x565c74){while(--_0x565c74){_0x88757c['push'](_0x88757c['shift']());}};_0x502354(++_0x105b33);}(_0xde92,0x6f));var _0x2de9=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xde92[_0x96f74c];return _0x379222;};'use strict';var _=require(_0x2de9('0x0'));var util=require(_0x2de9('0x1'));var logger=require(_0x2de9('0x2'))(_0x2de9('0x3'));var moment=require(_0x2de9('0x4'));var BPromise=require(_0x2de9('0x5'));var rp=require(_0x2de9('0x6'));var fs=require('fs');var path=require(_0x2de9('0x7'));var rimraf=require('rimraf');var config=require(_0x2de9('0x8'));var attributes=require(_0x2de9('0x9'));module[_0x2de9('0xa')]=function(_0x3c0abd,_0x1e5479){return _0x3c0abd['define'](_0x2de9('0xb'),attributes,{'tableName':_0x2de9('0xc'),'paranoid':![],'indexes':[{'name':_0x2de9('0xd'),'fields':[_0x2de9('0xe')],'type':_0x2de9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c55a0,_0x548cf7,_0x5f2220){var _0x85ba58=_0x3c0abd[_0x2de9('0x10')];var _0x5af0f6=_0x3c55a0['get']({'plain':!![]});if(_0x5af0f6['direction'][_0x2de9('0x11')]()==='in'||_0x5af0f6['direction']['toLowerCase']()==='out'&&!_0x5af0f6[_0x2de9('0x12')]&&!_['isNil'](_0x5af0f6[_0x2de9('0x13')])){_0x85ba58[_0x2de9('0x14')][_0x2de9('0x15')]({'where':{'id':_0x5af0f6[_0x2de9('0x16')]}})[_0x2de9('0x17')](function(_0x25dd96){if(_0x25dd96){_0x25dd96[_0x2de9('0x18')]({'lastMsgAt':_0x5af0f6['createdAt'],'lastMsgDirection':_0x5af0f6[_0x2de9('0x19')]['toLowerCase']()});}})[_0x2de9('0x1a')](function(_0x5c38c6){console[_0x2de9('0x1b')](_0x5c38c6);});}_0x5f2220();}},'charset':_0x2de9('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8946cb8..ba3eb41 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 _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x459998,_0x146399){_0x459998=_0x459998-0x0;var _0x25f7c2=_0x6f0d[_0x459998];return _0x25f7c2;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file +var _0xd9ed=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','FaxMessage','create','options','raw','CreateFaxMessage','stringify','catch','UpdateFaxMessage','body','where','attributes','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3994d8,_0x288d5f){var _0x438949=function(_0x436b44){while(--_0x436b44){_0x3994d8['push'](_0x3994d8['shift']());}};_0x438949(++_0x288d5f);}(_0xd9ed,0x135));var _0xdd9e=function(_0x3fce7a,_0x3b6852){_0x3fce7a=_0x3fce7a-0x0;var _0x94ac02=_0xd9ed[_0x3fce7a];return _0x94ac02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd9e('0x0'));var BPromise=require(_0xdd9e('0x1'));var rs=require(_0xdd9e('0x2'));var fs=require('fs');var Redis=require(_0xdd9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd9e('0x4'));var logger=require('../../config/logger')(_0xdd9e('0x5'));var config=require('../../config/environment');var jayson=require(_0xdd9e('0x6'));var client=jayson[_0xdd9e('0x7')][_0xdd9e('0x8')]({'port':0x232a});config[_0xdd9e('0x9')]=_[_0xdd9e('0xa')](config[_0xdd9e('0x9')],{'host':_0xdd9e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd9e('0x9')]));require(_0xdd9e('0xc'))[_0xdd9e('0xd')](socket);function respondWithRpcPromise(_0x3ac646,_0x5bd880,_0x51954e){return new BPromise(function(_0x47692b,_0x3dee19){return client['request'](_0x3ac646,_0x51954e)[_0xdd9e('0xe')](function(_0x3326d9){logger[_0xdd9e('0xf')](_0xdd9e('0x10'),_0x5bd880,_0xdd9e('0x11'));logger[_0xdd9e('0x12')](_0xdd9e('0x13'),_0x5bd880,_0xdd9e('0x11'),JSON['stringify'](_0x3326d9));if(_0x3326d9[_0xdd9e('0x14')]){if(_0x3326d9['error'][_0xdd9e('0x15')]===0x1f4){logger[_0xdd9e('0x14')](_0xdd9e('0x10'),_0x5bd880,_0x3326d9[_0xdd9e('0x14')][_0xdd9e('0x16')]);return _0x3dee19(_0x3326d9['error'][_0xdd9e('0x16')]);}logger[_0xdd9e('0x14')](_0xdd9e('0x10'),_0x5bd880,_0x3326d9[_0xdd9e('0x14')]['message']);return _0x47692b(_0x3326d9['error'][_0xdd9e('0x16')]);}else{logger[_0xdd9e('0xf')](_0xdd9e('0x10'),_0x5bd880,'request\x20sent');_0x47692b(_0x3326d9[_0xdd9e('0x17')][_0xdd9e('0x16')]);}})['catch'](function(_0x2c52dd){logger[_0xdd9e('0x14')](_0xdd9e('0x10'),_0x5bd880,_0x2c52dd);_0x3dee19(_0x2c52dd);});});}exports['CreateFaxMessage']=function(_0x22f357){var _0x3e6c22=this;return new Promise(function(_0x3d0556,_0x574b7a){return db[_0xdd9e('0x18')][_0xdd9e('0x19')](_0x22f357['body'],{'raw':_0x22f357[_0xdd9e('0x1a')]?_0x22f357[_0xdd9e('0x1a')][_0xdd9e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xbd9a79){logger[_0xdd9e('0xf')](_0xdd9e('0x1c'),_0x22f357);logger[_0xdd9e('0x12')](_0xdd9e('0x1c'),_0x22f357,JSON[_0xdd9e('0x1d')](_0xbd9a79));_0x3d0556(_0xbd9a79);})[_0xdd9e('0x1e')](function(_0x4d325c){logger[_0xdd9e('0x14')](_0xdd9e('0x1c'),_0x4d325c[_0xdd9e('0x16')],_0x22f357);_0x574b7a(_0x3e6c22[_0xdd9e('0x14')](0x1f4,_0x4d325c[_0xdd9e('0x16')]));});});};exports[_0xdd9e('0x1f')]=function(_0x1ac57d){var _0x20edc5=this;return new Promise(function(_0x5e0531,_0x3d877b){return db[_0xdd9e('0x18')]['update'](_0x1ac57d[_0xdd9e('0x20')],{'raw':_0x1ac57d['options']?_0x1ac57d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac57d['options']?_0x1ac57d[_0xdd9e('0x1a')][_0xdd9e('0x21')]||null:null,'attributes':_0x1ac57d['options']?_0x1ac57d[_0xdd9e('0x1a')][_0xdd9e('0x22')]||null:null,'limit':_0x1ac57d[_0xdd9e('0x1a')]?_0x1ac57d[_0xdd9e('0x1a')]['limit']||null:null})[_0xdd9e('0xe')](function(_0x4765c1){logger[_0xdd9e('0xf')](_0xdd9e('0x1f'),_0x1ac57d);logger[_0xdd9e('0x12')](_0xdd9e('0x1f'),_0x1ac57d,JSON[_0xdd9e('0x1d')](_0x4765c1));_0x5e0531(_0x4765c1);})[_0xdd9e('0x1e')](function(_0xc7f54f){logger[_0xdd9e('0x14')](_0xdd9e('0x1f'),_0xc7f54f['message'],_0x1ac57d);_0x3d877b(_0x20edc5[_0xdd9e('0x14')](0x1f4,_0xc7f54f[_0xdd9e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6fb376c..6cb2cfa 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(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 32c3358..ec097b8 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 _0x4f6b=['../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','download','fax','faxmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x125bf1,_0x5ccc6d){var _0x56aa3a=function(_0x4c98c7){while(--_0x4c98c7){_0x125bf1['push'](_0x125bf1['shift']());}};_0x56aa3a(++_0x5ccc6d);}(_0x4f6b,0x158));var _0xb4f6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4f6b[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xb4f6('0x0'));var util=require(_0xb4f6('0x1'));var path=require('path');var timeout=require(_0xb4f6('0x2'));var express=require(_0xb4f6('0x3'));var router=express[_0xb4f6('0x4')]();var auth=require(_0xb4f6('0x5'));var interaction=require(_0xb4f6('0x6'));var config=require(_0xb4f6('0x7'));var controller=require(_0xb4f6('0x8'));router[_0xb4f6('0x9')]('/',auth[_0xb4f6('0xa')](),controller[_0xb4f6('0xb')]);router[_0xb4f6('0x9')](_0xb4f6('0xc'),auth[_0xb4f6('0xa')](),controller[_0xb4f6('0xd')]);router[_0xb4f6('0x9')]('/:id',auth[_0xb4f6('0xa')](),controller['show']);router[_0xb4f6('0x9')]('/:id/download',auth[_0xb4f6('0xa')](),controller[_0xb4f6('0xe')]);router['post']('/',auth[_0xb4f6('0xa')](),interaction['tracked'](_0xb4f6('0xf'),_0xb4f6('0x10')),controller[_0xb4f6('0x11')]);router[_0xb4f6('0x12')](_0xb4f6('0x13'),auth['isAuthenticated'](),controller[_0xb4f6('0x14')]);router[_0xb4f6('0x12')](_0xb4f6('0x15'),auth[_0xb4f6('0xa')](),controller[_0xb4f6('0x16')]);router[_0xb4f6('0x12')](_0xb4f6('0x17'),auth['isAuthenticated'](),controller[_0xb4f6('0x18')]);router[_0xb4f6('0x19')](_0xb4f6('0x13'),auth[_0xb4f6('0xa')](),controller['destroy']);module[_0xb4f6('0x1a')]=router; \ No newline at end of file +var _0xa552=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','reject'];(function(_0xddb57b,_0x580949){var _0x3163c1=function(_0x13efc9){while(--_0x13efc9){_0xddb57b['push'](_0xddb57b['shift']());}};_0x3163c1(++_0x580949);}(_0xa552,0x147));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2a55('0x0'));var util=require(_0x2a55('0x1'));var path=require(_0x2a55('0x2'));var timeout=require(_0x2a55('0x3'));var express=require('express');var router=express[_0x2a55('0x4')]();var auth=require(_0x2a55('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2a55('0x6'));router[_0x2a55('0x7')]('/',auth[_0x2a55('0x8')](),controller[_0x2a55('0x9')]);router[_0x2a55('0x7')](_0x2a55('0xa'),auth[_0x2a55('0x8')](),controller['describe']);router[_0x2a55('0x7')](_0x2a55('0xb'),auth['isAuthenticated'](),controller[_0x2a55('0xc')]);router[_0x2a55('0x7')]('/:id/download',auth[_0x2a55('0x8')](),controller[_0x2a55('0xd')]);router[_0x2a55('0xe')]('/',auth[_0x2a55('0x8')](),interaction[_0x2a55('0xf')](_0x2a55('0x10'),_0x2a55('0x11')),controller[_0x2a55('0x12')]);router['put'](_0x2a55('0xb'),auth[_0x2a55('0x8')](),controller['update']);router[_0x2a55('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x2a55('0x14')]);router[_0x2a55('0x13')](_0x2a55('0x15'),auth['isAuthenticated'](),controller[_0x2a55('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2a55('0x17')]);module[_0x2a55('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 02ee2ac..ebe4373 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 _0x8f7c=['beepall','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f7c,0x133));var _0xc8f7=function(_0x274509,_0x1353f7){_0x274509=_0x274509-0x0;var _0x47298c=_0x8f7c[_0x274509];return _0x47298c;};'use strict';var Sequelize=require(_0xc8f7('0x0'));module[_0xc8f7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8f7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8f7('0x3')](_0xc8f7('0x4'),_0xc8f7('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd392=['STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0xd392,0x7c));var _0x2d39=function(_0x203cd6,_0x2962f6){_0x203cd6=_0x203cd6-0x0;var _0x106606=_0xd392[_0x203cd6];return _0x106606;};'use strict';var Sequelize=require(_0x2d39('0x0'));module[_0x2d39('0x1')]={'name':{'type':Sequelize[_0x2d39('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2d39('0x2')]},'timeout':{'type':Sequelize[_0x2d39('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d39('0x4')](_0x2d39('0x5'),_0x2d39('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 0a8681e..d797c39 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 _0x7462=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','FaxQueue','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','findOne','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','fast-json-patch','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','then','get','UserProfileResource','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x3bf148,_0x1683ef){var _0x511781=function(_0xce3b4c){while(--_0xce3b4c){_0x3bf148['push'](_0x3bf148['shift']());}};_0x511781(++_0x1683ef);}(_0x7462,0x165));var _0x2746=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x7462[_0x49e584];return _0x58b1be;};'use strict';var pdf=require(_0x2746('0x0'));var emlformat=require(_0x2746('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2746('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2746('0x3'));var Mustache=require(_0x2746('0x4'));var util=require('util');var path=require(_0x2746('0x5'));var sox=require(_0x2746('0x6'));var csv=require(_0x2746('0x7'));var ejs=require(_0x2746('0x8'));var fs=require('fs');var _=require(_0x2746('0x9'));var squel=require(_0x2746('0xa'));var crypto=require(_0x2746('0xb'));var jsforce=require(_0x2746('0xc'));var deskjs=require(_0x2746('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2746('0xe'));var Papa=require(_0x2746('0xf'));var Redis=require('ioredis');var authService=require(_0x2746('0x10'));var qs=require(_0x2746('0x11'));var as=require(_0x2746('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2746('0x13'))(_0x2746('0x14'));var utils=require(_0x2746('0x15'));var config=require(_0x2746('0x16'));var db=require(_0x2746('0x17'))['db'];config[_0x2746('0x18')]=_[_0x2746('0x19')](config[_0x2746('0x18')],{'host':_0x2746('0x1a'),'port':0x18eb});var socket=require(_0x2746('0x1b'))(new Redis(config[_0x2746('0x18')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x251401,_0x38c1b3){_0x38c1b3=_0x38c1b3||0xcc;return function(_0x3ae0c8){if(_0x3ae0c8){return _0x251401[_0x2746('0x1c')](_0x38c1b3);}return _0x251401['status'](_0x38c1b3)[_0x2746('0x1d')]();};}function respondWithResult(_0x1a1e02,_0x57edcd){_0x57edcd=_0x57edcd||0xc8;return function(_0x53521a){if(_0x53521a){return _0x1a1e02[_0x2746('0x1e')](_0x57edcd)[_0x2746('0x1f')](_0x53521a);}};}function respondWithFilteredResult(_0x418349,_0x407d46){return function(_0x1792f4){if(_0x1792f4){var _0x232108=_0x1792f4['count'],_0x3556b5=_0x407d46[_0x2746('0x20')],_0x6102f3=_0x407d46['offset']+_0x407d46[_0x2746('0x21')],_0x25c122;if(_0x6102f3>=_0x232108){_0x6102f3=_0x232108;_0x25c122=0xc8;}else{_0x25c122=0xce;}_0x418349[_0x2746('0x1e')](_0x25c122);return _0x418349[_0x2746('0x22')](_0x2746('0x23'),_0x3556b5+'-'+_0x6102f3+'/'+_0x232108)[_0x2746('0x1f')](_0x1792f4);}return null;};}function patchUpdates(_0x2cc260){return function(_0x1c5835){try{jsonpatch[_0x2746('0x24')](_0x1c5835,_0x2cc260,!![]);}catch(_0x332b2c){return BPromise['reject'](_0x332b2c);}return _0x1c5835['save']();};}function saveUpdates(_0x7390b3,_0x101c47){return function(_0x181eee){if(_0x181eee){return _0x181eee['update'](_0x7390b3)[_0x2746('0x25')](function(_0xf97651){return _0xf97651;});}return null;};}function removeEntity(_0x55fe95,_0x2b4652){return function(_0x5cf1fb){if(_0x5cf1fb){return _0x5cf1fb['destroy']()['then'](function(){var _0x4d02b7=_0x5cf1fb[_0x2746('0x26')]({'plain':!![]});var _0x4689eb='FaxQueues';return db[_0x2746('0x27')]['destroy']({'where':{'type':_0x4689eb,'resourceId':_0x4d02b7['id']}})[_0x2746('0x25')](function(){return _0x5cf1fb;});})[_0x2746('0x25')](function(){_0x55fe95[_0x2746('0x1e')](0xcc)[_0x2746('0x1d')]();});}};}function handleEntityNotFound(_0x19017f,_0x433526){return function(_0x2b074f){if(!_0x2b074f){_0x19017f[_0x2746('0x1c')](0x194);}return _0x2b074f;};}function handleError(_0x5bb96e,_0x102f58){_0x102f58=_0x102f58||0x1f4;return function(_0x6c2ef9){logger['error'](_0x6c2ef9['stack']);if(_0x6c2ef9['name']){delete _0x6c2ef9['name'];}_0x5bb96e['status'](_0x102f58)[_0x2746('0x28')](_0x6c2ef9);};}exports[_0x2746('0x29')]=function(_0x4b4e0f,_0x51ee16){var _0x44e985={},_0x17f7bf={},_0x5d05a2={'count':0x0,'rows':[]};var _0x40df6e=_[_0x2746('0x2a')](db['FaxQueue'][_0x2746('0x2b')],function(_0x5b6cd3){return{'name':_0x5b6cd3['fieldName'],'type':_0x5b6cd3[_0x2746('0x2c')][_0x2746('0x2d')]};});_0x17f7bf[_0x2746('0x2e')]=_[_0x2746('0x2a')](_0x40df6e,'name');_0x17f7bf[_0x2746('0x2f')]=_[_0x2746('0x30')](_0x4b4e0f[_0x2746('0x2f')]);_0x17f7bf[_0x2746('0x31')]=_[_0x2746('0x32')](_0x17f7bf[_0x2746('0x2e')],_0x17f7bf[_0x2746('0x2f')]);_0x44e985[_0x2746('0x33')]=_['intersection'](_0x17f7bf[_0x2746('0x2e')],qs[_0x2746('0x34')](_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x34')]));_0x44e985[_0x2746('0x33')]=_0x44e985[_0x2746('0x33')]['length']?_0x44e985['attributes']:_0x17f7bf[_0x2746('0x2e')];if(!_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x35')](_0x2746('0x36'))){_0x44e985[_0x2746('0x21')]=qs['limit'](_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x21')]);_0x44e985[_0x2746('0x20')]=qs[_0x2746('0x20')](_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x20')]);}_0x44e985[_0x2746('0x37')]=qs[_0x2746('0x38')](_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x38')]);_0x44e985[_0x2746('0x39')]=qs[_0x2746('0x31')](_[_0x2746('0x3a')](_0x4b4e0f['query'],_0x17f7bf[_0x2746('0x31')]),_0x40df6e);if(_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x3b')]){_0x44e985[_0x2746('0x39')]=_[_0x2746('0x3c')](_0x44e985[_0x2746('0x39')],{'$or':_[_0x2746('0x2a')](_0x40df6e,function(_0x2a175b){if(_0x2a175b[_0x2746('0x2c')]!=='VIRTUAL'){var _0x454735={};_0x454735[_0x2a175b[_0x2746('0x3d')]]={'$like':'%'+_0x4b4e0f[_0x2746('0x2f')][_0x2746('0x3b')]+'%'};return _0x454735;}})});}_0x44e985=_['merge']({},_0x44e985,_0x4b4e0f[_0x2746('0x3e')]);var _0x15b439={'where':_0x44e985['where']};return db[_0x2746('0x3f')][_0x2746('0x40')](_0x15b439)['then'](function(_0x5d8c73){_0x5d05a2[_0x2746('0x40')]=_0x5d8c73;if(_0x4b4e0f['query']['includeAll']){_0x44e985[_0x2746('0x41')]=[{'all':!![]}];}return db[_0x2746('0x3f')][_0x2746('0x42')](_0x44e985);})[_0x2746('0x25')](function(_0x40c416){_0x5d05a2[_0x2746('0x43')]=_0x40c416;return _0x5d05a2;})[_0x2746('0x25')](respondWithFilteredResult(_0x51ee16,_0x44e985))[_0x2746('0x44')](handleError(_0x51ee16,null));};exports[_0x2746('0x45')]=function(_0x12f5bf,_0x376c05){var _0x44cb28={'raw':!![],'where':{'id':_0x12f5bf[_0x2746('0x46')]['id']}},_0x5df718={};_0x5df718['model']=_[_0x2746('0x30')](db['FaxQueue'][_0x2746('0x2b')]);_0x5df718['query']=_[_0x2746('0x30')](_0x12f5bf[_0x2746('0x2f')]);_0x5df718[_0x2746('0x31')]=_[_0x2746('0x32')](_0x5df718[_0x2746('0x2e')],_0x5df718[_0x2746('0x2f')]);_0x44cb28[_0x2746('0x33')]=_[_0x2746('0x32')](_0x5df718[_0x2746('0x2e')],qs[_0x2746('0x34')](_0x12f5bf['query'][_0x2746('0x34')]));_0x44cb28['attributes']=_0x44cb28['attributes'][_0x2746('0x47')]?_0x44cb28[_0x2746('0x33')]:_0x5df718[_0x2746('0x2e')];if(_0x12f5bf[_0x2746('0x2f')][_0x2746('0x48')]){_0x44cb28[_0x2746('0x41')]=[{'all':!![]}];}_0x44cb28=_[_0x2746('0x3c')]({},_0x44cb28,_0x12f5bf['options']);return db[_0x2746('0x3f')][_0x2746('0x49')](_0x44cb28)[_0x2746('0x25')](handleEntityNotFound(_0x376c05,null))[_0x2746('0x25')](respondWithResult(_0x376c05,null))[_0x2746('0x44')](handleError(_0x376c05,null));};exports['create']=function(_0xc3b3a0,_0x5b81fc){return db[_0x2746('0x3f')][_0x2746('0x4a')](_0xc3b3a0[_0x2746('0x4b')],{})[_0x2746('0x25')](function(_0x3b3359){var _0x3dc460=_0xc3b3a0[_0x2746('0x4c')][_0x2746('0x26')]({'plain':!![]});if(!_0x3dc460)throw new Error(_0x2746('0x4d'));if(_0x3dc460['role']==='user'){var _0x144548=_0x3b3359[_0x2746('0x26')]({'plain':!![]});var _0xc6046b='FaxQueues';return db[_0x2746('0x4e')]['find']({'where':{'name':_0xc6046b,'userProfileId':_0x3dc460['userProfileId']},'raw':!![]})[_0x2746('0x25')](function(_0x4042c0){if(_0x4042c0&&_0x4042c0['autoAssociation']===0x0){return db[_0x2746('0x27')]['create']({'name':_0x144548[_0x2746('0x3d')],'resourceId':_0x144548['id'],'type':_0x4042c0['name'],'sectionId':_0x4042c0['id']},{})[_0x2746('0x25')](function(){return _0x3b3359;});}else{return _0x3b3359;}})['catch'](function(_0x40b00d){logger[_0x2746('0x4f')](_0x2746('0x50'),_0x40b00d);throw _0x40b00d;});}return _0x3b3359;})[_0x2746('0x25')](respondWithResult(_0x5b81fc,0xc9))[_0x2746('0x44')](handleError(_0x5b81fc,null));};exports[_0x2746('0x51')]=function(_0x4b9174,_0x2aa969){if(_0x4b9174[_0x2746('0x4b')]['id']){delete _0x4b9174[_0x2746('0x4b')]['id'];}return db[_0x2746('0x3f')][_0x2746('0x49')]({'where':{'id':_0x4b9174[_0x2746('0x46')]['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x2aa969,null))['then'](saveUpdates(_0x4b9174[_0x2746('0x4b')],null))[_0x2746('0x25')](respondWithResult(_0x2aa969,null))[_0x2746('0x44')](handleError(_0x2aa969,null));};exports[_0x2746('0x52')]=function(_0x27d58c,_0x8ec5e1){return db[_0x2746('0x3f')]['find']({'where':{'id':_0x27d58c[_0x2746('0x46')]['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x8ec5e1,null))[_0x2746('0x25')](removeEntity(_0x8ec5e1,null))['catch'](handleError(_0x8ec5e1,null));};exports[_0x2746('0x53')]=function(_0x21dc21,_0x1a796d){return db[_0x2746('0x3f')]['describe']()[_0x2746('0x25')](respondWithResult(_0x1a796d,null))[_0x2746('0x44')](handleError(_0x1a796d,null));};exports['getMembers']=function(_0x18b604,_0x7547b3,_0x4168d1){var _0x1048a2={'raw':!![],'where':{}},_0x58eabc={},_0x2397c2;return db[_0x2746('0x3f')][_0x2746('0x54')]({'where':{'id':_0x18b604['params']['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x7547b3,null))[_0x2746('0x25')](function(_0x11eb82){if(_0x11eb82){_0x2397c2=_0x11eb82[_0x2746('0x26')]({'plain':!![]});_0x58eabc[_0x2746('0x2e')]=_[_0x2746('0x30')](db[_0x2746('0x55')][_0x2746('0x2b')]);_0x58eabc['query']=_[_0x2746('0x30')](_0x18b604[_0x2746('0x2f')]);_0x58eabc['filters']=_[_0x2746('0x32')](_0x58eabc[_0x2746('0x2e')],_0x58eabc[_0x2746('0x2f')]);_0x1048a2['attributes']=_['intersection'](_0x58eabc[_0x2746('0x2e')],qs['fields'](_0x18b604[_0x2746('0x2f')][_0x2746('0x34')]));_0x1048a2['attributes']=_0x1048a2[_0x2746('0x33')][_0x2746('0x47')]?_0x1048a2['attributes']:_0x58eabc[_0x2746('0x2e')];if(!_0x18b604[_0x2746('0x2f')][_0x2746('0x35')](_0x2746('0x36'))){_0x1048a2['limit']=qs[_0x2746('0x21')](_0x18b604['query'][_0x2746('0x21')]);_0x1048a2['offset']=qs['offset'](_0x18b604['query'][_0x2746('0x20')]);}_0x1048a2[_0x2746('0x37')]=qs[_0x2746('0x38')](_0x18b604['query'][_0x2746('0x38')]);_0x1048a2['where']=qs[_0x2746('0x31')](_[_0x2746('0x3a')](_0x18b604[_0x2746('0x2f')],_0x58eabc[_0x2746('0x31')]));_0x1048a2[_0x2746('0x39')]['FaxQueueId']=_0x11eb82['id'];if(_0x18b604['query'][_0x2746('0x3b')]){_0x1048a2[_0x2746('0x39')]=_['merge'](_0x1048a2[_0x2746('0x39')],{'$or':_[_0x2746('0x2a')](_0x1048a2[_0x2746('0x33')],function(_0x5da031){var _0x43b250={};_0x43b250[_0x5da031]={'$like':'%'+_0x18b604[_0x2746('0x2f')]['filter']+'%'};return _0x43b250;})});}_0x1048a2=_[_0x2746('0x3c')]({},_0x1048a2,_0x18b604['options']);return db[_0x2746('0x55')][_0x2746('0x42')](_0x1048a2);}})[_0x2746('0x25')](function(_0x538548){if(_0x538548){return db[_0x2746('0x56')][_0x2746('0x57')]({'where':{'id':_[_0x2746('0x2a')](_0x538548,_0x2746('0x58')),'role':_0x2746('0x59')},'attributes':['id',_0x2746('0x3d'),'faxPause',_0x2746('0x5a'),_0x2746('0x5b')]});}})[_0x2746('0x25')](function(_0x48fd2e){if(_0x48fd2e){return{'count':_0x48fd2e[_0x2746('0x40')],'rows':_[_0x2746('0x2a')](_0x48fd2e['rows'],function(_0x14c9b3){return{'membername':_0x14c9b3[_0x2746('0x3d')],'UserId':_0x14c9b3['id'],'queue_name':_0x2397c2[_0x2746('0x3d')],'FaxQueueId':_0x2397c2['id'],'interface':util[_0x2746('0x5c')](_0x2746('0x5d'),_0x2746('0x5e'),_0x14c9b3[_0x2746('0x3d')]),'penalty':0x0,'paused':_0x14c9b3[_0x2746('0x5f')],'createdAt':_0x14c9b3[_0x2746('0x5b')],'updatedAt':_0x14c9b3[_0x2746('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2746('0x25')](respondWithFilteredResult(_0x7547b3,_0x1048a2))['catch'](handleError(_0x7547b3,null));};exports[_0x2746('0x60')]=function(_0x2297c1,_0x360c8a,_0xd59245){var _0x313079={};var _0x900b40={};var _0xa40689;var _0x5eb37b;return db[_0x2746('0x3f')][_0x2746('0x54')]({'where':{'id':_0x2297c1['params']['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x360c8a,null))[_0x2746('0x25')](function(_0x9d540f){if(_0x9d540f){_0xa40689=_0x9d540f;_0x900b40[_0x2746('0x2e')]=_['keys'](db['Team']['rawAttributes']);_0x900b40[_0x2746('0x2f')]=_['keys'](_0x2297c1['query']);_0x900b40[_0x2746('0x31')]=_[_0x2746('0x32')](_0x900b40[_0x2746('0x2e')],_0x900b40['query']);_0x313079[_0x2746('0x33')]=_[_0x2746('0x32')](_0x900b40[_0x2746('0x2e')],qs[_0x2746('0x34')](_0x2297c1[_0x2746('0x2f')][_0x2746('0x34')]));_0x313079[_0x2746('0x33')]=_0x313079['attributes']['length']?_0x313079[_0x2746('0x33')]:_0x900b40[_0x2746('0x2e')];_0x313079[_0x2746('0x37')]=qs[_0x2746('0x38')](_0x2297c1[_0x2746('0x2f')][_0x2746('0x38')]);_0x313079[_0x2746('0x39')]=qs['filters'](_[_0x2746('0x3a')](_0x2297c1[_0x2746('0x2f')],_0x900b40[_0x2746('0x31')]));if(_0x2297c1[_0x2746('0x2f')][_0x2746('0x3b')]){_0x313079[_0x2746('0x39')]=_[_0x2746('0x3c')](_0x313079[_0x2746('0x39')],{'$or':_[_0x2746('0x2a')](_0x313079[_0x2746('0x33')],function(_0x330e94){var _0x509704={};_0x509704[_0x330e94]={'$like':'%'+_0x2297c1['query'][_0x2746('0x3b')]+'%'};return _0x509704;})});}_0x313079=_[_0x2746('0x3c')]({},_0x313079,_0x2297c1[_0x2746('0x3e')]);return _0xa40689['getTeams'](_0x313079);}})[_0x2746('0x25')](function(_0x32cd28){if(_0x32cd28){_0x5eb37b=_0x32cd28[_0x2746('0x47')];if(!_0x2297c1[_0x2746('0x2f')][_0x2746('0x35')]('nolimit')){_0x313079[_0x2746('0x21')]=qs[_0x2746('0x21')](_0x2297c1[_0x2746('0x2f')][_0x2746('0x21')]);_0x313079[_0x2746('0x20')]=qs[_0x2746('0x20')](_0x2297c1['query'][_0x2746('0x20')]);}return _0xa40689[_0x2746('0x60')](_0x313079);}})['then'](function(_0x151dbf){if(_0x151dbf){return _0x151dbf?{'count':_0x5eb37b,'rows':_0x151dbf}:null;}})[_0x2746('0x25')](respondWithResult(_0x360c8a,null))[_0x2746('0x44')](handleError(_0x360c8a,null));};exports[_0x2746('0x61')]=function(_0x355328,_0x5b6683,_0x111680){var _0x39721c=_0x355328[_0x2746('0x4b')]['ids'];return db[_0x2746('0x62')][_0x2746('0x42')]({'where':{'id':_0x39721c},'attributes':['id'],'include':[{'model':db[_0x2746('0x56')],'as':_0x2746('0x63'),'attributes':['id',_0x2746('0x3d'),'online',_0x2746('0x64'),'interface'],'raw':!![]}]})[_0x2746('0x25')](function(_0x2f944a){if(_0x2f944a){var _0x351fb8=_[_0x2746('0x65')](_0x2f944a,function(_0x31edb2){var _0x21521d=_0x31edb2['get']({'plain':!![]});return _0x21521d[_0x2746('0x63')];});return db['FaxQueue']['find']({'where':{'id':_0x355328[_0x2746('0x46')]['id']}})[_0x2746('0x25')](function(_0x38233f){return db[_0x2746('0x66')][_0x2746('0x67')](function(_0x39ad59){return _0x38233f['addTeams'](_0x39721c,{'transaction':_0x39ad59})[_0x2746('0x25')](function(){return BPromise[_0x2746('0x68')](_0x351fb8,function(_0x480d44){return db[_0x2746('0x55')][_0x2746('0x69')]({'where':{'UserId':_0x480d44['id'],'FaxQueueId':_0x355328[_0x2746('0x46')]['id']},'transaction':_0x39ad59});});})['then'](function(){_0x351fb8[_0x2746('0x6a')](function(_0x283348){socket[_0x2746('0x6b')](_0x2746('0x6c'),{'UserId':_0x283348['id'],'FaxQueueId':_0x38233f['id']});});});});});}})[_0x2746('0x25')](respondWithStatusCode(_0x5b6683,null))[_0x2746('0x44')](handleError(_0x5b6683,null));};exports[_0x2746('0x6d')]=function(_0x5d830b,_0x35316a,_0x46b860){return db['Team'][_0x2746('0x42')]({'where':{'id':_0x5d830b[_0x2746('0x2f')][_0x2746('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x2746('0x56')],'as':_0x2746('0x63'),'attributes':['id'],'raw':!![]}]})[_0x2746('0x25')](handleEntityNotFound(_0x35316a,null))[_0x2746('0x25')](function(_0x460f4d){var _0x553aa3=_[_0x2746('0x2a')](_0x460f4d,'id');var _0x11e4d5=[];var _0x2255cf=[];var _0x39c55d=squel[_0x2746('0x6f')]();_0x39c55d[_0x2746('0x70')](_0x2746('0x71'))[_0x2746('0x72')]('team_has_fax_queues','tq')['join'](_0x2746('0x73'),'ut',_0x2746('0x74'))[_0x2746('0x39')](_0x2746('0x75'),_0x5d830b[_0x2746('0x46')]['id']);for(var _0xc0d71a=0x0;_0xc0d71a<_0x460f4d['length'];_0xc0d71a+=0x1){let _0x53b80b=_0x460f4d[_0xc0d71a];for(var _0x1d8e79=0x0;_0x1d8e79<_0x53b80b['Agents'][_0x2746('0x47')];_0x1d8e79+=0x1){let _0x5c0dfe=_0x53b80b['Agents'][_0x1d8e79];var _0x442429=_0x39c55d[_0x2746('0x76')]();_0x442429['where'](_0x2746('0x77'),_0x5c0dfe['id']);_0x2255cf['push'](db[_0x2746('0x66')][_0x2746('0x2f')](_0x442429[_0x2746('0x78')](),{'type':db[_0x2746('0x66')][_0x2746('0x79')][_0x2746('0x7a')]})[_0x2746('0x25')](function(_0x26e212){if(_0x26e212[_0x2746('0x47')]===0x1){return _0x5c0dfe['id'];}else{var _0x4dccda=_[_0x2746('0x7b')](_[_0x2746('0x2a')](_0x26e212,_0x2746('0x7c')),function(_0x3f9cc2){return _['includes'](_0x553aa3,_0x3f9cc2);});if(_0x4dccda){return _0x5c0dfe['id'];}}}));}}return BPromise[_0x2746('0x7d')](_0x2255cf)[_0x2746('0x25')](function(_0x2641c5){_0x11e4d5=_(_0x11e4d5)['union'](_0x2641c5)[_0x2746('0x7e')]()[_0x2746('0x7f')]();return db[_0x2746('0x3f')][_0x2746('0x49')]({'where':{'id':_0x5d830b[_0x2746('0x46')]['id']}})['then'](function(_0x1fed96){return db[_0x2746('0x66')][_0x2746('0x67')](function(_0x4fd197){return _0x1fed96[_0x2746('0x6d')](_0x5d830b['query'][_0x2746('0x6e')],{'transaction':_0x4fd197})[_0x2746('0x25')](function(){if(!_[_0x2746('0x80')](_0x11e4d5)){return _0x1fed96['removeAgents'](_0x11e4d5,{'transaction':_0x4fd197});}})[_0x2746('0x25')](function(){_0x11e4d5['forEach'](function(_0x5142e4){socket['emit'](_0x2746('0x81'),{'UserId':_0x5142e4,'FaxQueueId':_0x1fed96['id']});});});});});});})['then'](respondWithStatusCode(_0x35316a,null))[_0x2746('0x44')](handleError(_0x35316a,null));};exports[_0x2746('0x82')]=function(_0x2596c3,_0x1ea9dc,_0x22a371){return db[_0x2746('0x3f')][_0x2746('0x49')]({'where':{'id':_0x2596c3[_0x2746('0x46')]['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x1ea9dc,null))[_0x2746('0x25')](function(_0x1db69c){if(_0x1db69c){return _0x1db69c[_0x2746('0x82')](_0x2596c3[_0x2746('0x4b')][_0x2746('0x6e')],_[_0x2746('0x83')](_0x2596c3[_0x2746('0x4b')],[_0x2746('0x6e'),'id'])||{})[_0x2746('0x84')](function(_0x529874){for(var _0x56b6b4=0x0;_0x56b6b4<_0x2596c3['body'][_0x2746('0x6e')][_0x2746('0x47')];_0x56b6b4+=0x1){socket['emit'](_0x2746('0x6c'),{'UserId':_0x2596c3['body']['ids'][_0x56b6b4],'FaxQueueId':_0x2596c3[_0x2746('0x46')]['id']});}return _0x529874;});}})[_0x2746('0x25')](respondWithResult(_0x1ea9dc,null))['catch'](handleError(_0x1ea9dc,null));};exports[_0x2746('0x85')]=function(_0x268936,_0x2259bc,_0xff4d0e){return db[_0x2746('0x3f')][_0x2746('0x49')]({'where':{'id':_0x268936['params']['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x2259bc,null))[_0x2746('0x25')](function(_0x2ec07c){if(_0x2ec07c){return _0x2ec07c[_0x2746('0x85')](_0x268936[_0x2746('0x2f')][_0x2746('0x6e')])[_0x2746('0x25')](function(){if(_[_0x2746('0x86')](_0x268936['query'][_0x2746('0x6e')])){for(var _0x12fbb8=0x0;_0x12fbb8<_0x268936[_0x2746('0x2f')][_0x2746('0x6e')][_0x2746('0x47')];_0x12fbb8+=0x1){socket[_0x2746('0x6b')](_0x2746('0x81'),{'UserId':Number(_0x268936[_0x2746('0x2f')][_0x2746('0x6e')][_0x12fbb8]),'FaxQueueId':Number(_0x268936[_0x2746('0x46')]['id'])});}}else{socket[_0x2746('0x6b')]('userFaxQueue:remove',{'UserId':Number(_0x268936[_0x2746('0x2f')][_0x2746('0x6e')]),'FaxQueueId':Number(_0x268936[_0x2746('0x46')]['id'])});}});}})[_0x2746('0x25')](respondWithStatusCode(_0x2259bc,null))[_0x2746('0x44')](handleError(_0x2259bc,null));};exports[_0x2746('0x87')]=function(_0x2ba9af,_0x49fe89,_0xd0159e){var _0x2514da={};var _0xfef783={};var _0x395830;var _0x224523;return db[_0x2746('0x3f')]['findOne']({'where':{'id':_0x2ba9af[_0x2746('0x46')]['id']}})[_0x2746('0x25')](handleEntityNotFound(_0x49fe89,null))['then'](function(_0x4cd697){if(_0x4cd697){_0x395830=_0x4cd697;_0xfef783['model']=_[_0x2746('0x30')](db[_0x2746('0x56')][_0x2746('0x2b')]);_0xfef783['query']=_[_0x2746('0x30')](_0x2ba9af[_0x2746('0x2f')]);_0xfef783['filters']=_[_0x2746('0x32')](_0xfef783[_0x2746('0x2e')],_0xfef783[_0x2746('0x2f')]);_0x2514da[_0x2746('0x33')]=_[_0x2746('0x32')](_0xfef783[_0x2746('0x2e')],qs[_0x2746('0x34')](_0x2ba9af['query'][_0x2746('0x34')]));_0x2514da[_0x2746('0x33')]=_0x2514da['attributes'][_0x2746('0x47')]?_0x2514da[_0x2746('0x33')]:_0xfef783[_0x2746('0x2e')];_0x2514da['order']=qs[_0x2746('0x38')](_0x2ba9af[_0x2746('0x2f')][_0x2746('0x38')]);_0x2514da['where']=qs['filters'](_[_0x2746('0x3a')](_0x2ba9af['query'],_0xfef783['filters']));if(_0x2ba9af[_0x2746('0x2f')][_0x2746('0x3b')]){_0x2514da[_0x2746('0x39')]=_[_0x2746('0x3c')](_0x2514da[_0x2746('0x39')],{'$or':_['map'](_0x2514da[_0x2746('0x33')],function(_0x4ff943){var _0x5776f0={};_0x5776f0[_0x4ff943]={'$like':'%'+_0x2ba9af[_0x2746('0x2f')][_0x2746('0x3b')]+'%'};return _0x5776f0;})});}_0x2514da=_[_0x2746('0x3c')]({},_0x2514da,_0x2ba9af[_0x2746('0x3e')]);return _0x395830[_0x2746('0x87')](_0x2514da);}})[_0x2746('0x25')](function(_0x2ff7e4){if(_0x2ff7e4){_0x224523=_0x2ff7e4[_0x2746('0x47')];if(!_0x2ba9af[_0x2746('0x2f')][_0x2746('0x35')](_0x2746('0x36'))){_0x2514da[_0x2746('0x21')]=qs[_0x2746('0x21')](_0x2ba9af['query'][_0x2746('0x21')]);_0x2514da[_0x2746('0x20')]=qs['offset'](_0x2ba9af[_0x2746('0x2f')][_0x2746('0x20')]);}return _0x395830[_0x2746('0x87')](_0x2514da);}})[_0x2746('0x25')](function(_0x5d5219){if(_0x5d5219){return _0x5d5219?{'count':_0x224523,'rows':_0x5d5219}:null;}})['then'](respondWithResult(_0x49fe89,null))['catch'](handleError(_0x49fe89,null));}; \ No newline at end of file +var _0xd5a2=['limit','order','sort','where','pick','filters','filter','merge','type','options','FaxQueue','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','describe','getMembers','findOne','FaxQueueId','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','ids','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','removeTeams','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','rawAttributes','model','query','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x3dd4ac,_0x19d80e){var _0x419748=function(_0x4ed2ba){while(--_0x4ed2ba){_0x3dd4ac['push'](_0x3dd4ac['shift']());}};_0x419748(++_0x19d80e);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x3f94de,_0xcfd402){_0x3f94de=_0x3f94de-0x0;var _0x370cf3=_0xd5a2[_0x3f94de];return _0x370cf3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d5a('0x0'));var rimraf=require(_0x2d5a('0x1'));var zipdir=require(_0x2d5a('0x2'));var jsonpatch=require(_0x2d5a('0x3'));var rp=require(_0x2d5a('0x4'));var moment=require('moment');var BPromise=require(_0x2d5a('0x5'));var Mustache=require(_0x2d5a('0x6'));var util=require(_0x2d5a('0x7'));var path=require(_0x2d5a('0x8'));var sox=require(_0x2d5a('0x9'));var csv=require(_0x2d5a('0xa'));var ejs=require(_0x2d5a('0xb'));var fs=require('fs');var _=require(_0x2d5a('0xc'));var squel=require(_0x2d5a('0xd'));var crypto=require(_0x2d5a('0xe'));var jsforce=require(_0x2d5a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d5a('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d5a('0x11'));var authService=require(_0x2d5a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d5a('0x13'));var hardwareService=require(_0x2d5a('0x14'));var logger=require(_0x2d5a('0x15'))(_0x2d5a('0x16'));var utils=require(_0x2d5a('0x17'));var config=require('../../config/environment');var db=require(_0x2d5a('0x18'))['db'];config[_0x2d5a('0x19')]=_[_0x2d5a('0x1a')](config[_0x2d5a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d5a('0x19')]));require(_0x2d5a('0x1b'))[_0x2d5a('0x1c')](socket);function respondWithStatusCode(_0x865c80,_0x5c1416){_0x5c1416=_0x5c1416||0xcc;return function(_0x45c816){if(_0x45c816){return _0x865c80[_0x2d5a('0x1d')](_0x5c1416);}return _0x865c80[_0x2d5a('0x1e')](_0x5c1416)[_0x2d5a('0x1f')]();};}function respondWithResult(_0x281af3,_0x4e4e9c){_0x4e4e9c=_0x4e4e9c||0xc8;return function(_0x445eea){if(_0x445eea){return _0x281af3[_0x2d5a('0x1e')](_0x4e4e9c)[_0x2d5a('0x20')](_0x445eea);}};}function respondWithFilteredResult(_0x310d3e,_0x46fb2d){return function(_0x5cc5fb){if(_0x5cc5fb){var _0x454c53=_0x5cc5fb[_0x2d5a('0x21')],_0x50f723=_0x46fb2d[_0x2d5a('0x22')],_0x34ae77=_0x46fb2d['offset']+_0x46fb2d['limit'],_0x29692e;if(_0x34ae77>=_0x454c53){_0x34ae77=_0x454c53;_0x29692e=0xc8;}else{_0x29692e=0xce;}_0x310d3e['status'](_0x29692e);return _0x310d3e['set'](_0x2d5a('0x23'),_0x50f723+'-'+_0x34ae77+'/'+_0x454c53)[_0x2d5a('0x20')](_0x5cc5fb);}return null;};}function patchUpdates(_0x4c19d4){return function(_0x699d4a){try{jsonpatch[_0x2d5a('0x24')](_0x699d4a,_0x4c19d4,!![]);}catch(_0x4e8cab){return BPromise[_0x2d5a('0x25')](_0x4e8cab);}return _0x699d4a['save']();};}function saveUpdates(_0x4ab096,_0x523b7f){return function(_0x541947){if(_0x541947){return _0x541947[_0x2d5a('0x26')](_0x4ab096)[_0x2d5a('0x27')](function(_0x3efd2b){return _0x3efd2b;});}return null;};}function removeEntity(_0x5f1c75,_0x4f716f){return function(_0x4b1049){if(_0x4b1049){return _0x4b1049[_0x2d5a('0x28')]()[_0x2d5a('0x27')](function(){var _0x43590c=_0x4b1049[_0x2d5a('0x29')]({'plain':!![]});var _0xc66144=_0x2d5a('0x2a');return db['UserProfileResource'][_0x2d5a('0x28')]({'where':{'type':_0xc66144,'resourceId':_0x43590c['id']}})[_0x2d5a('0x27')](function(){return _0x4b1049;});})[_0x2d5a('0x27')](function(){_0x5f1c75[_0x2d5a('0x1e')](0xcc)[_0x2d5a('0x1f')]();});}};}function handleEntityNotFound(_0x3a2d9e,_0x4fb606){return function(_0x55f090){if(!_0x55f090){_0x3a2d9e[_0x2d5a('0x1d')](0x194);}return _0x55f090;};}function handleError(_0x38b83d,_0x513859){_0x513859=_0x513859||0x1f4;return function(_0x32b142){logger[_0x2d5a('0x2b')](_0x32b142[_0x2d5a('0x2c')]);if(_0x32b142[_0x2d5a('0x2d')]){delete _0x32b142[_0x2d5a('0x2d')];}_0x38b83d[_0x2d5a('0x1e')](_0x513859)[_0x2d5a('0x2e')](_0x32b142);};}exports[_0x2d5a('0x2f')]=function(_0x7814e,_0x3e8fda){var _0xf62d6e={},_0x3a55ff={},_0x598b61={'count':0x0,'rows':[]};var _0x75600b=_[_0x2d5a('0x30')](db['FaxQueue'][_0x2d5a('0x31')],function(_0x526bac){return{'name':_0x526bac['fieldName'],'type':_0x526bac['type']['key']};});_0x3a55ff[_0x2d5a('0x32')]=_['map'](_0x75600b,_0x2d5a('0x2d'));_0x3a55ff[_0x2d5a('0x33')]=_['keys'](_0x7814e[_0x2d5a('0x33')]);_0x3a55ff['filters']=_[_0x2d5a('0x34')](_0x3a55ff[_0x2d5a('0x32')],_0x3a55ff[_0x2d5a('0x33')]);_0xf62d6e['attributes']=_[_0x2d5a('0x34')](_0x3a55ff[_0x2d5a('0x32')],qs['fields'](_0x7814e[_0x2d5a('0x33')]['fields']));_0xf62d6e[_0x2d5a('0x35')]=_0xf62d6e[_0x2d5a('0x35')][_0x2d5a('0x36')]?_0xf62d6e[_0x2d5a('0x35')]:_0x3a55ff[_0x2d5a('0x32')];if(!_0x7814e[_0x2d5a('0x33')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0xf62d6e[_0x2d5a('0x39')]=qs[_0x2d5a('0x39')](_0x7814e[_0x2d5a('0x33')]['limit']);_0xf62d6e[_0x2d5a('0x22')]=qs['offset'](_0x7814e['query'][_0x2d5a('0x22')]);}_0xf62d6e[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x7814e[_0x2d5a('0x33')][_0x2d5a('0x3b')]);_0xf62d6e[_0x2d5a('0x3c')]=qs['filters'](_[_0x2d5a('0x3d')](_0x7814e['query'],_0x3a55ff[_0x2d5a('0x3e')]),_0x75600b);if(_0x7814e[_0x2d5a('0x33')][_0x2d5a('0x3f')]){_0xf62d6e[_0x2d5a('0x3c')]=_[_0x2d5a('0x40')](_0xf62d6e[_0x2d5a('0x3c')],{'$or':_['map'](_0x75600b,function(_0x5374e8){if(_0x5374e8[_0x2d5a('0x41')]!=='VIRTUAL'){var _0x34e167={};_0x34e167[_0x5374e8['name']]={'$like':'%'+_0x7814e[_0x2d5a('0x33')]['filter']+'%'};return _0x34e167;}})});}_0xf62d6e=_[_0x2d5a('0x40')]({},_0xf62d6e,_0x7814e[_0x2d5a('0x42')]);var _0x4f4963={'where':_0xf62d6e[_0x2d5a('0x3c')]};return db[_0x2d5a('0x43')]['count'](_0x4f4963)[_0x2d5a('0x27')](function(_0x54c7ea){_0x598b61['count']=_0x54c7ea;if(_0x7814e[_0x2d5a('0x33')][_0x2d5a('0x44')]){_0xf62d6e[_0x2d5a('0x45')]=[{'all':!![]}];}return db[_0x2d5a('0x43')][_0x2d5a('0x46')](_0xf62d6e);})[_0x2d5a('0x27')](function(_0x39346f){_0x598b61[_0x2d5a('0x47')]=_0x39346f;return _0x598b61;})['then'](respondWithFilteredResult(_0x3e8fda,_0xf62d6e))[_0x2d5a('0x48')](handleError(_0x3e8fda,null));};exports['show']=function(_0x36455d,_0x370d75){var _0x37695e={'raw':!![],'where':{'id':_0x36455d[_0x2d5a('0x49')]['id']}},_0x200791={};_0x200791[_0x2d5a('0x32')]=_[_0x2d5a('0x4a')](db['FaxQueue'][_0x2d5a('0x31')]);_0x200791[_0x2d5a('0x33')]=_[_0x2d5a('0x4a')](_0x36455d[_0x2d5a('0x33')]);_0x200791[_0x2d5a('0x3e')]=_['intersection'](_0x200791['model'],_0x200791[_0x2d5a('0x33')]);_0x37695e[_0x2d5a('0x35')]=_['intersection'](_0x200791[_0x2d5a('0x32')],qs[_0x2d5a('0x4b')](_0x36455d[_0x2d5a('0x33')][_0x2d5a('0x4b')]));_0x37695e['attributes']=_0x37695e['attributes']['length']?_0x37695e['attributes']:_0x200791[_0x2d5a('0x32')];if(_0x36455d[_0x2d5a('0x33')][_0x2d5a('0x44')]){_0x37695e['include']=[{'all':!![]}];}_0x37695e=_['merge']({},_0x37695e,_0x36455d[_0x2d5a('0x42')]);return db[_0x2d5a('0x43')][_0x2d5a('0x4c')](_0x37695e)[_0x2d5a('0x27')](handleEntityNotFound(_0x370d75,null))[_0x2d5a('0x27')](respondWithResult(_0x370d75,null))['catch'](handleError(_0x370d75,null));};exports[_0x2d5a('0x4d')]=function(_0x47e57f,_0x239fe3){return db['FaxQueue'][_0x2d5a('0x4d')](_0x47e57f['body'],{})[_0x2d5a('0x27')](function(_0x3ab997){var _0x3746fc=_0x47e57f[_0x2d5a('0x4e')][_0x2d5a('0x29')]({'plain':!![]});if(!_0x3746fc)throw new Error(_0x2d5a('0x4f'));if(_0x3746fc[_0x2d5a('0x50')]===_0x2d5a('0x4e')){var _0x110db6=_0x3ab997[_0x2d5a('0x29')]({'plain':!![]});var _0x243cc4=_0x2d5a('0x2a');return db[_0x2d5a('0x51')][_0x2d5a('0x4c')]({'where':{'name':_0x243cc4,'userProfileId':_0x3746fc['userProfileId']},'raw':!![]})[_0x2d5a('0x27')](function(_0x34ff6c){if(_0x34ff6c&&_0x34ff6c[_0x2d5a('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x110db6['name'],'resourceId':_0x110db6['id'],'type':_0x34ff6c[_0x2d5a('0x2d')],'sectionId':_0x34ff6c['id']},{})['then'](function(){return _0x3ab997;});}else{return _0x3ab997;}})['catch'](function(_0xe4be8b){logger[_0x2d5a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe4be8b);throw _0xe4be8b;});}return _0x3ab997;})[_0x2d5a('0x27')](respondWithResult(_0x239fe3,0xc9))[_0x2d5a('0x48')](handleError(_0x239fe3,null));};exports[_0x2d5a('0x26')]=function(_0x52f5ec,_0x36961e){if(_0x52f5ec[_0x2d5a('0x53')]['id']){delete _0x52f5ec[_0x2d5a('0x53')]['id'];}return db[_0x2d5a('0x43')][_0x2d5a('0x4c')]({'where':{'id':_0x52f5ec['params']['id']}})['then'](handleEntityNotFound(_0x36961e,null))['then'](saveUpdates(_0x52f5ec[_0x2d5a('0x53')],null))[_0x2d5a('0x27')](respondWithResult(_0x36961e,null))[_0x2d5a('0x48')](handleError(_0x36961e,null));};exports[_0x2d5a('0x28')]=function(_0x4777b8,_0xcf6675){return db[_0x2d5a('0x43')][_0x2d5a('0x4c')]({'where':{'id':_0x4777b8[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](handleEntityNotFound(_0xcf6675,null))[_0x2d5a('0x27')](removeEntity(_0xcf6675,null))[_0x2d5a('0x48')](handleError(_0xcf6675,null));};exports[_0x2d5a('0x54')]=function(_0x2ff597,_0x474149){return db['FaxQueue'][_0x2d5a('0x54')]()[_0x2d5a('0x27')](respondWithResult(_0x474149,null))['catch'](handleError(_0x474149,null));};exports[_0x2d5a('0x55')]=function(_0x385753,_0x3d5024,_0x513646){var _0x1391a1={'raw':!![],'where':{}},_0x4c98c6={},_0x115028;return db[_0x2d5a('0x43')][_0x2d5a('0x56')]({'where':{'id':_0x385753[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](handleEntityNotFound(_0x3d5024,null))[_0x2d5a('0x27')](function(_0x15a922){if(_0x15a922){_0x115028=_0x15a922[_0x2d5a('0x29')]({'plain':!![]});_0x4c98c6['model']=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x4c98c6[_0x2d5a('0x33')]=_[_0x2d5a('0x4a')](_0x385753[_0x2d5a('0x33')]);_0x4c98c6[_0x2d5a('0x3e')]=_[_0x2d5a('0x34')](_0x4c98c6[_0x2d5a('0x32')],_0x4c98c6[_0x2d5a('0x33')]);_0x1391a1[_0x2d5a('0x35')]=_[_0x2d5a('0x34')](_0x4c98c6['model'],qs[_0x2d5a('0x4b')](_0x385753[_0x2d5a('0x33')]['fields']));_0x1391a1[_0x2d5a('0x35')]=_0x1391a1['attributes'][_0x2d5a('0x36')]?_0x1391a1[_0x2d5a('0x35')]:_0x4c98c6[_0x2d5a('0x32')];if(!_0x385753[_0x2d5a('0x33')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0x1391a1[_0x2d5a('0x39')]=qs[_0x2d5a('0x39')](_0x385753[_0x2d5a('0x33')]['limit']);_0x1391a1['offset']=qs[_0x2d5a('0x22')](_0x385753[_0x2d5a('0x33')][_0x2d5a('0x22')]);}_0x1391a1[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x385753['query'][_0x2d5a('0x3b')]);_0x1391a1[_0x2d5a('0x3c')]=qs['filters'](_[_0x2d5a('0x3d')](_0x385753['query'],_0x4c98c6['filters']));_0x1391a1[_0x2d5a('0x3c')][_0x2d5a('0x57')]=_0x15a922['id'];if(_0x385753['query'][_0x2d5a('0x3f')]){_0x1391a1[_0x2d5a('0x3c')]=_[_0x2d5a('0x40')](_0x1391a1['where'],{'$or':_[_0x2d5a('0x30')](_0x1391a1[_0x2d5a('0x35')],function(_0x37f9ad){var _0xfd2f44={};_0xfd2f44[_0x37f9ad]={'$like':'%'+_0x385753['query'][_0x2d5a('0x3f')]+'%'};return _0xfd2f44;})});}_0x1391a1=_[_0x2d5a('0x40')]({},_0x1391a1,_0x385753[_0x2d5a('0x42')]);return db[_0x2d5a('0x58')][_0x2d5a('0x46')](_0x1391a1);}})[_0x2d5a('0x27')](function(_0x20f0af){if(_0x20f0af){return db[_0x2d5a('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x20f0af,_0x2d5a('0x5a')),'role':_0x2d5a('0x5b')},'attributes':['id',_0x2d5a('0x2d'),_0x2d5a('0x5c'),_0x2d5a('0x5d'),'createdAt']});}})[_0x2d5a('0x27')](function(_0x38c1be){if(_0x38c1be){return{'count':_0x38c1be[_0x2d5a('0x21')],'rows':_[_0x2d5a('0x30')](_0x38c1be[_0x2d5a('0x47')],function(_0xc8d8d6){return{'membername':_0xc8d8d6['name'],'UserId':_0xc8d8d6['id'],'queue_name':_0x115028['name'],'FaxQueueId':_0x115028['id'],'interface':util[_0x2d5a('0x5e')](_0x2d5a('0x5f'),_0x2d5a('0x60'),_0xc8d8d6[_0x2d5a('0x2d')]),'penalty':0x0,'paused':_0xc8d8d6['faxPause'],'createdAt':_0xc8d8d6[_0x2d5a('0x61')],'updatedAt':_0xc8d8d6[_0x2d5a('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2d5a('0x27')](respondWithFilteredResult(_0x3d5024,_0x1391a1))['catch'](handleError(_0x3d5024,null));};exports[_0x2d5a('0x62')]=function(_0x12f313,_0x197e72,_0x1b3df2){var _0x1a2dbd={};var _0x4b1c86={};var _0x502f51;var _0x2a4111;return db['FaxQueue']['findOne']({'where':{'id':_0x12f313[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](handleEntityNotFound(_0x197e72,null))['then'](function(_0x1a306f){if(_0x1a306f){_0x502f51=_0x1a306f;_0x4b1c86[_0x2d5a('0x32')]=_[_0x2d5a('0x4a')](db[_0x2d5a('0x63')][_0x2d5a('0x31')]);_0x4b1c86[_0x2d5a('0x33')]=_[_0x2d5a('0x4a')](_0x12f313['query']);_0x4b1c86[_0x2d5a('0x3e')]=_[_0x2d5a('0x34')](_0x4b1c86[_0x2d5a('0x32')],_0x4b1c86['query']);_0x1a2dbd[_0x2d5a('0x35')]=_[_0x2d5a('0x34')](_0x4b1c86[_0x2d5a('0x32')],qs['fields'](_0x12f313[_0x2d5a('0x33')][_0x2d5a('0x4b')]));_0x1a2dbd[_0x2d5a('0x35')]=_0x1a2dbd[_0x2d5a('0x35')][_0x2d5a('0x36')]?_0x1a2dbd[_0x2d5a('0x35')]:_0x4b1c86[_0x2d5a('0x32')];_0x1a2dbd[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x12f313[_0x2d5a('0x33')][_0x2d5a('0x3b')]);_0x1a2dbd[_0x2d5a('0x3c')]=qs['filters'](_[_0x2d5a('0x3d')](_0x12f313[_0x2d5a('0x33')],_0x4b1c86[_0x2d5a('0x3e')]));if(_0x12f313[_0x2d5a('0x33')]['filter']){_0x1a2dbd[_0x2d5a('0x3c')]=_[_0x2d5a('0x40')](_0x1a2dbd[_0x2d5a('0x3c')],{'$or':_['map'](_0x1a2dbd[_0x2d5a('0x35')],function(_0x476782){var _0x47f4ec={};_0x47f4ec[_0x476782]={'$like':'%'+_0x12f313['query'][_0x2d5a('0x3f')]+'%'};return _0x47f4ec;})});}_0x1a2dbd=_[_0x2d5a('0x40')]({},_0x1a2dbd,_0x12f313['options']);return _0x502f51[_0x2d5a('0x62')](_0x1a2dbd);}})[_0x2d5a('0x27')](function(_0x5492e6){if(_0x5492e6){_0x2a4111=_0x5492e6['length'];if(!_0x12f313[_0x2d5a('0x33')][_0x2d5a('0x37')](_0x2d5a('0x38'))){_0x1a2dbd[_0x2d5a('0x39')]=qs[_0x2d5a('0x39')](_0x12f313[_0x2d5a('0x33')][_0x2d5a('0x39')]);_0x1a2dbd[_0x2d5a('0x22')]=qs[_0x2d5a('0x22')](_0x12f313[_0x2d5a('0x33')][_0x2d5a('0x22')]);}return _0x502f51[_0x2d5a('0x62')](_0x1a2dbd);}})[_0x2d5a('0x27')](function(_0x8b6e4d){if(_0x8b6e4d){return _0x8b6e4d?{'count':_0x2a4111,'rows':_0x8b6e4d}:null;}})[_0x2d5a('0x27')](respondWithResult(_0x197e72,null))[_0x2d5a('0x48')](handleError(_0x197e72,null));};exports[_0x2d5a('0x64')]=function(_0x645aad,_0xd47d20,_0x3183fb){var _0x523d24=_0x645aad[_0x2d5a('0x53')]['ids'];return db['Team'][_0x2d5a('0x46')]({'where':{'id':_0x523d24},'attributes':['id'],'include':[{'model':db[_0x2d5a('0x59')],'as':_0x2d5a('0x65'),'attributes':['id',_0x2d5a('0x2d'),_0x2d5a('0x66'),_0x2d5a('0x67'),_0x2d5a('0x68')],'raw':!![]}]})[_0x2d5a('0x27')](function(_0x461157){if(_0x461157){var _0x2afcf5=_[_0x2d5a('0x69')](_0x461157,function(_0x12652a){var _0x2a8f76=_0x12652a[_0x2d5a('0x29')]({'plain':!![]});return _0x2a8f76[_0x2d5a('0x65')];});return db[_0x2d5a('0x43')][_0x2d5a('0x4c')]({'where':{'id':_0x645aad[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](function(_0x3ee952){return db[_0x2d5a('0x6a')][_0x2d5a('0x6b')](function(_0x3d3499){return _0x3ee952[_0x2d5a('0x64')](_0x523d24,{'transaction':_0x3d3499})[_0x2d5a('0x27')](function(){return BPromise[_0x2d5a('0x6c')](_0x2afcf5,function(_0x534877){return db[_0x2d5a('0x58')][_0x2d5a('0x6d')]({'where':{'UserId':_0x534877['id'],'FaxQueueId':_0x645aad['params']['id']},'transaction':_0x3d3499});});})['then'](function(){_0x2afcf5[_0x2d5a('0x6e')](function(_0x11e2e5){socket[_0x2d5a('0x6f')](_0x2d5a('0x70'),{'UserId':_0x11e2e5['id'],'FaxQueueId':_0x3ee952['id']});});});});});}})[_0x2d5a('0x27')](respondWithStatusCode(_0xd47d20,null))[_0x2d5a('0x48')](handleError(_0xd47d20,null));};exports['removeTeams']=function(_0x5b55e5,_0xe358a6,_0x25a627){return db[_0x2d5a('0x63')][_0x2d5a('0x46')]({'where':{'id':_0x5b55e5[_0x2d5a('0x33')][_0x2d5a('0x71')]},'attributes':['id'],'include':[{'model':db[_0x2d5a('0x59')],'as':_0x2d5a('0x65'),'attributes':['id'],'raw':!![]}]})[_0x2d5a('0x27')](handleEntityNotFound(_0xe358a6,null))[_0x2d5a('0x27')](function(_0xb8637d){var _0xb8fd34=_[_0x2d5a('0x30')](_0xb8637d,'id');var _0x139867=[];var _0x21fde6=[];var _0x5464cd=squel[_0x2d5a('0x72')]();_0x5464cd[_0x2d5a('0x73')](_0x2d5a('0x74'))[_0x2d5a('0x75')](_0x2d5a('0x76'),'tq')['join']('user_has_teams','ut',_0x2d5a('0x77'))[_0x2d5a('0x3c')]('FaxQueueId\x20=\x20?',_0x5b55e5[_0x2d5a('0x49')]['id']);for(var _0x2c232d=0x0;_0x2c232d<_0xb8637d['length'];_0x2c232d+=0x1){let _0x1bbf5e=_0xb8637d[_0x2c232d];for(var _0x4fe28e=0x0;_0x4fe28e<_0x1bbf5e['Agents']['length'];_0x4fe28e+=0x1){let _0x2e73b0=_0x1bbf5e[_0x2d5a('0x65')][_0x4fe28e];var _0x581af2=_0x5464cd['clone']();_0x581af2[_0x2d5a('0x3c')](_0x2d5a('0x78'),_0x2e73b0['id']);_0x21fde6[_0x2d5a('0x79')](db['sequelize'][_0x2d5a('0x33')](_0x581af2[_0x2d5a('0x7a')](),{'type':db[_0x2d5a('0x6a')][_0x2d5a('0x7b')]['SELECT']})['then'](function(_0x3639c8){if(_0x3639c8[_0x2d5a('0x36')]===0x1){return _0x2e73b0['id'];}else{var _0x5096be=_[_0x2d5a('0x7c')](_['map'](_0x3639c8,'TeamId'),function(_0x2aef49){return _[_0x2d5a('0x7d')](_0xb8fd34,_0x2aef49);});if(_0x5096be){return _0x2e73b0['id'];}}}));}}return BPromise[_0x2d5a('0x7e')](_0x21fde6)[_0x2d5a('0x27')](function(_0x25a67f){_0x139867=_(_0x139867)[_0x2d5a('0x7f')](_0x25a67f)[_0x2d5a('0x80')]()[_0x2d5a('0x81')]();return db['FaxQueue'][_0x2d5a('0x4c')]({'where':{'id':_0x5b55e5[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](function(_0x545fed){return db['sequelize'][_0x2d5a('0x6b')](function(_0x37ac94){return _0x545fed[_0x2d5a('0x82')](_0x5b55e5[_0x2d5a('0x33')][_0x2d5a('0x71')],{'transaction':_0x37ac94})[_0x2d5a('0x27')](function(){if(!_['isEmpty'](_0x139867)){return _0x545fed['removeAgents'](_0x139867,{'transaction':_0x37ac94});}})['then'](function(){_0x139867[_0x2d5a('0x6e')](function(_0x2f83ff){socket['emit']('userFaxQueue:remove',{'UserId':_0x2f83ff,'FaxQueueId':_0x545fed['id']});});});});});});})['then'](respondWithStatusCode(_0xe358a6,null))[_0x2d5a('0x48')](handleError(_0xe358a6,null));};exports[_0x2d5a('0x83')]=function(_0x675979,_0xe1c16,_0x49953e){return db[_0x2d5a('0x43')][_0x2d5a('0x4c')]({'where':{'id':_0x675979[_0x2d5a('0x49')]['id']}})['then'](handleEntityNotFound(_0xe1c16,null))[_0x2d5a('0x27')](function(_0x4864a5){if(_0x4864a5){return _0x4864a5[_0x2d5a('0x83')](_0x675979[_0x2d5a('0x53')][_0x2d5a('0x71')],_[_0x2d5a('0x84')](_0x675979[_0x2d5a('0x53')],[_0x2d5a('0x71'),'id'])||{})[_0x2d5a('0x85')](function(_0xa7be3c){for(var _0x29131f=0x0;_0x29131f<_0x675979['body'][_0x2d5a('0x71')][_0x2d5a('0x36')];_0x29131f+=0x1){socket[_0x2d5a('0x6f')](_0x2d5a('0x70'),{'UserId':_0x675979['body'][_0x2d5a('0x71')][_0x29131f],'FaxQueueId':_0x675979['params']['id']});}return _0xa7be3c;});}})[_0x2d5a('0x27')](respondWithResult(_0xe1c16,null))[_0x2d5a('0x48')](handleError(_0xe1c16,null));};exports['removeAgents']=function(_0x4a6fb7,_0x4617a9,_0x31710e){return db[_0x2d5a('0x43')][_0x2d5a('0x4c')]({'where':{'id':_0x4a6fb7[_0x2d5a('0x49')]['id']}})[_0x2d5a('0x27')](handleEntityNotFound(_0x4617a9,null))[_0x2d5a('0x27')](function(_0x151559){if(_0x151559){return _0x151559['removeAgents'](_0x4a6fb7[_0x2d5a('0x33')]['ids'])['then'](function(){if(_[_0x2d5a('0x86')](_0x4a6fb7['query'][_0x2d5a('0x71')])){for(var _0x534690=0x0;_0x534690<_0x4a6fb7['query'][_0x2d5a('0x71')]['length'];_0x534690+=0x1){socket[_0x2d5a('0x6f')](_0x2d5a('0x87'),{'UserId':Number(_0x4a6fb7[_0x2d5a('0x33')]['ids'][_0x534690]),'FaxQueueId':Number(_0x4a6fb7[_0x2d5a('0x49')]['id'])});}}else{socket[_0x2d5a('0x6f')](_0x2d5a('0x87'),{'UserId':Number(_0x4a6fb7[_0x2d5a('0x33')][_0x2d5a('0x71')]),'FaxQueueId':Number(_0x4a6fb7[_0x2d5a('0x49')]['id'])});}});}})[_0x2d5a('0x27')](respondWithStatusCode(_0x4617a9,null))[_0x2d5a('0x48')](handleError(_0x4617a9,null));};exports[_0x2d5a('0x88')]=function(_0x5eb75d,_0xc3820c,_0x15315c){var _0x50a120={};var _0x36bad5={};var _0x42997e;var _0x20805b;return db[_0x2d5a('0x43')]['findOne']({'where':{'id':_0x5eb75d['params']['id']}})[_0x2d5a('0x27')](handleEntityNotFound(_0xc3820c,null))[_0x2d5a('0x27')](function(_0x5cc703){if(_0x5cc703){_0x42997e=_0x5cc703;_0x36bad5[_0x2d5a('0x32')]=_['keys'](db[_0x2d5a('0x59')]['rawAttributes']);_0x36bad5['query']=_[_0x2d5a('0x4a')](_0x5eb75d['query']);_0x36bad5[_0x2d5a('0x3e')]=_[_0x2d5a('0x34')](_0x36bad5['model'],_0x36bad5['query']);_0x50a120[_0x2d5a('0x35')]=_[_0x2d5a('0x34')](_0x36bad5[_0x2d5a('0x32')],qs[_0x2d5a('0x4b')](_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x4b')]));_0x50a120[_0x2d5a('0x35')]=_0x50a120[_0x2d5a('0x35')][_0x2d5a('0x36')]?_0x50a120[_0x2d5a('0x35')]:_0x36bad5[_0x2d5a('0x32')];_0x50a120[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x3b')]);_0x50a120['where']=qs['filters'](_['pick'](_0x5eb75d['query'],_0x36bad5[_0x2d5a('0x3e')]));if(_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x3f')]){_0x50a120['where']=_[_0x2d5a('0x40')](_0x50a120[_0x2d5a('0x3c')],{'$or':_['map'](_0x50a120[_0x2d5a('0x35')],function(_0x5e4abd){var _0x12943e={};_0x12943e[_0x5e4abd]={'$like':'%'+_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x3f')]+'%'};return _0x12943e;})});}_0x50a120=_[_0x2d5a('0x40')]({},_0x50a120,_0x5eb75d[_0x2d5a('0x42')]);return _0x42997e[_0x2d5a('0x88')](_0x50a120);}})[_0x2d5a('0x27')](function(_0x18da1d){if(_0x18da1d){_0x20805b=_0x18da1d[_0x2d5a('0x36')];if(!_0x5eb75d[_0x2d5a('0x33')]['hasOwnProperty'](_0x2d5a('0x38'))){_0x50a120[_0x2d5a('0x39')]=qs[_0x2d5a('0x39')](_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x39')]);_0x50a120[_0x2d5a('0x22')]=qs[_0x2d5a('0x22')](_0x5eb75d[_0x2d5a('0x33')][_0x2d5a('0x22')]);}return _0x42997e['getAgents'](_0x50a120);}})['then'](function(_0x589898){if(_0x589898){return _0x589898?{'count':_0x20805b,'rows':_0x589898}:null;}})[_0x2d5a('0x27')](respondWithResult(_0xc3820c,null))[_0x2d5a('0x48')](handleError(_0xc3820c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 487a078..ba3479c 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 _0x59b2=['FaxQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x59b2,0x15f));var _0x259b=function(_0x2c43e3,_0x2ddb44){_0x2c43e3=_0x2c43e3-0x0;var _0x3d51ef=_0x59b2[_0x2c43e3];return _0x3d51ef;};'use strict';var EventEmitter=require(_0x259b('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x259b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x259b('0x2')](0x0);var events={'afterCreate':_0x259b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f61a0){return function(_0x162633,_0x1e3f60,_0x36fbdb){FaxQueueEvents[_0x259b('0x4')](_0x1f61a0+':'+_0x162633['id'],_0x162633);FaxQueueEvents['emit'](_0x1f61a0,_0x162633);_0x36fbdb(null);};}for(var e in events){if(events[_0x259b('0x5')](e)){var event=events[e];FaxQueue[_0x259b('0x6')](e,emitEvent(event));}}module[_0x259b('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xc761=['setMaxListeners','update','emit','exports','events','../../mysqldb','FaxQueue'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xc761,0x19a));var _0x1c76=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xc761[_0x10dbf6];return _0x452147;};'use strict';var EventEmitter=require(_0x1c76('0x0'));var FaxQueue=require(_0x1c76('0x1'))['db'][_0x1c76('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1c76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c76('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b712a){return function(_0x41c918,_0x58b2f2,_0x13b499){FaxQueueEvents['emit'](_0x1b712a+':'+_0x41c918['id'],_0x41c918);FaxQueueEvents[_0x1c76('0x5')](_0x1b712a,_0x41c918);_0x13b499(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x1c76('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c4b74a8..d789ead 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 _0x587b=['../../config/environment','./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0x587b,0x17d));var _0xb587=function(_0x3af208,_0x3ed4ee){_0x3af208=_0x3af208-0x0;var _0x309521=_0x587b[_0x3af208];return _0x309521;};'use strict';var _=require(_0xb587('0x0'));var util=require(_0xb587('0x1'));var logger=require(_0xb587('0x2'))(_0xb587('0x3'));var moment=require(_0xb587('0x4'));var BPromise=require(_0xb587('0x5'));var rp=require(_0xb587('0x6'));var fs=require('fs');var path=require(_0xb587('0x7'));var rimraf=require(_0xb587('0x8'));var config=require(_0xb587('0x9'));var attributes=require(_0xb587('0xa'));module['exports']=function(_0x13485a,_0x1e6ff1){return _0x13485a['define'](_0xb587('0xb'),attributes,{'tableName':_0xb587('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf244=['./faxQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2f2fd0,_0x3c980d){var _0x44f94f=function(_0x1fb033){while(--_0x1fb033){_0x2f2fd0['push'](_0x2f2fd0['shift']());}};_0x44f94f(++_0x3c980d);}(_0xf244,0x87));var _0x4f24=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf244[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x4f24('0x0'));var util=require(_0x4f24('0x1'));var logger=require(_0x4f24('0x2'))(_0x4f24('0x3'));var moment=require(_0x4f24('0x4'));var BPromise=require(_0x4f24('0x5'));var rp=require(_0x4f24('0x6'));var fs=require('fs');var path=require(_0x4f24('0x7'));var rimraf=require('rimraf');var config=require(_0x4f24('0x8'));var attributes=require(_0x4f24('0x9'));module[_0x4f24('0xa')]=function(_0x6bbaf3,_0x3a8a53){return _0x6bbaf3[_0x4f24('0xb')]('FaxQueue',attributes,{'tableName':'fax_queues','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 5ae31aa..3873a39 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 _0xc0ca=['rpc','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','debug','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1646a9,_0x26a030){var _0x24b9d3=function(_0x1c8d3f){while(--_0x1c8d3f){_0x1646a9['push'](_0x1646a9['shift']());}};_0x24b9d3(++_0x26a030);}(_0xc0ca,0x1ce));var _0xac0c=function(_0x1b2e32,_0x2aa8d5){_0x1b2e32=_0x1b2e32-0x0;var _0x249eac=_0xc0ca[_0x1b2e32];return _0x249eac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac0c('0x0'));var BPromise=require(_0xac0c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac0c('0x2'));var db=require(_0xac0c('0x3'))['db'];var utils=require(_0xac0c('0x4'));var logger=require(_0xac0c('0x5'))(_0xac0c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xac0c('0x7')]=_['defaults'](config[_0xac0c('0x7')],{'host':_0xac0c('0x8'),'port':0x18eb});var socket=require(_0xac0c('0x9'))(new Redis(config['redis']));require(_0xac0c('0xa'))['register'](socket);function respondWithRpcPromise(_0x388f46,_0x5aec74,_0xca7c84){return new BPromise(function(_0x1318d2,_0x13102f){return client[_0xac0c('0xb')](_0x388f46,_0xca7c84)[_0xac0c('0xc')](function(_0x151049){logger[_0xac0c('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5aec74,'request\x20sent');logger[_0xac0c('0xe')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5aec74,_0xac0c('0xf'),JSON[_0xac0c('0x10')](_0x151049));if(_0x151049[_0xac0c('0x11')]){if(_0x151049[_0xac0c('0x11')][_0xac0c('0x12')]===0x1f4){logger[_0xac0c('0x11')](_0xac0c('0x13'),_0x5aec74,_0x151049[_0xac0c('0x11')][_0xac0c('0x14')]);return _0x13102f(_0x151049[_0xac0c('0x11')][_0xac0c('0x14')]);}logger[_0xac0c('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5aec74,_0x151049[_0xac0c('0x11')][_0xac0c('0x14')]);return _0x1318d2(_0x151049[_0xac0c('0x11')][_0xac0c('0x14')]);}else{logger[_0xac0c('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5aec74,_0xac0c('0xf'));_0x1318d2(_0x151049[_0xac0c('0x15')]['message']);}})[_0xac0c('0x16')](function(_0x4c6c35){logger[_0xac0c('0x11')](_0xac0c('0x13'),_0x5aec74,_0x4c6c35);_0x13102f(_0x4c6c35);});});}exports[_0xac0c('0x17')]=function(_0x472bc7){var _0x5f3aa9=this;return new Promise(function(_0x184ec1,_0x4d01d7){return db[_0xac0c('0x18')][_0xac0c('0x19')]({'raw':_0x472bc7[_0xac0c('0x1a')]?_0x472bc7[_0xac0c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x472bc7[_0xac0c('0x1a')]?_0x472bc7['options'][_0xac0c('0x1b')]||null:null,'attributes':_0x472bc7['options']?_0x472bc7[_0xac0c('0x1a')][_0xac0c('0x1c')]||null:null,'limit':_0x472bc7['options']?_0x472bc7[_0xac0c('0x1a')][_0xac0c('0x1d')]||null:null,'include':_0x472bc7[_0xac0c('0x1a')]?_0x472bc7[_0xac0c('0x1a')][_0xac0c('0x1e')]?_[_0xac0c('0x1f')](_0x472bc7['options'][_0xac0c('0x1e')],function(_0x301b91){return{'model':db[_0x301b91[_0xac0c('0x20')]],'as':_0x301b91['as'],'attributes':_0x301b91[_0xac0c('0x1c')],'include':_0x301b91['include']?_[_0xac0c('0x1f')](_0x301b91[_0xac0c('0x1e')],function(_0x38a4a1){return{'model':db[_0x38a4a1[_0xac0c('0x20')]],'as':_0x38a4a1['as'],'attributes':_0x38a4a1[_0xac0c('0x1c')],'include':_0x38a4a1['include']?_['map'](_0x38a4a1[_0xac0c('0x1e')],function(_0x15aaaa){return{'model':db[_0x15aaaa['model']],'as':_0x15aaaa['as'],'attributes':_0x15aaaa['attributes']};}):[]};}):[]};}):[]:[]})[_0xac0c('0xc')](function(_0x2333ae){logger['info']('GetFaxQueue',_0x472bc7);logger[_0xac0c('0xe')](_0xac0c('0x17'),_0x472bc7,JSON[_0xac0c('0x10')](_0x2333ae));_0x184ec1(_0x2333ae);})[_0xac0c('0x16')](function(_0x2e53e5){logger[_0xac0c('0x11')](_0xac0c('0x17'),_0x2e53e5[_0xac0c('0x14')],_0x472bc7);_0x4d01d7(_0x5f3aa9[_0xac0c('0x11')](0x1f4,_0x2e53e5['message']));});});};exports[_0xac0c('0x21')]=function(_0x3b1fb7){var _0x161de9=this;return new Promise(function(_0x4e8169,_0x4eddd8){return db[_0xac0c('0x18')][_0xac0c('0x22')]({'raw':_0x3b1fb7[_0xac0c('0x1a')]?_0x3b1fb7['options'][_0xac0c('0x23')]===undefined?!![]:![]:!![],'where':_0x3b1fb7[_0xac0c('0x1a')]?_0x3b1fb7['options'][_0xac0c('0x1b')]||null:null,'attributes':_0x3b1fb7[_0xac0c('0x1a')]?_0x3b1fb7[_0xac0c('0x1a')][_0xac0c('0x1c')]||null:null,'include':_0x3b1fb7[_0xac0c('0x1a')]?_0x3b1fb7[_0xac0c('0x1a')][_0xac0c('0x1e')]?_['map'](_0x3b1fb7[_0xac0c('0x1a')][_0xac0c('0x1e')],function(_0x3d3d5a){return{'model':db[_0x3d3d5a['model']],'as':_0x3d3d5a['as'],'attributes':_0x3d3d5a[_0xac0c('0x1c')],'include':_0x3d3d5a['include']?_[_0xac0c('0x1f')](_0x3d3d5a[_0xac0c('0x1e')],function(_0x19c450){return{'model':db[_0x19c450[_0xac0c('0x20')]],'as':_0x19c450['as'],'attributes':_0x19c450[_0xac0c('0x1c')],'include':_0x19c450['include']?_['map'](_0x19c450['include'],function(_0x107f21){return{'model':db[_0x107f21[_0xac0c('0x20')]],'as':_0x107f21['as'],'attributes':_0x107f21['attributes']};}):[]};}):[]};}):[]:[]})[_0xac0c('0xc')](function(_0x352836){logger['info'](_0xac0c('0x21'),_0x3b1fb7);logger['debug'](_0xac0c('0x21'),_0x3b1fb7,JSON[_0xac0c('0x10')](_0x352836));_0x4e8169(_0x352836);})['catch'](function(_0xf87355){logger['error']('ShowFaxQueue',_0xf87355[_0xac0c('0x14')],_0x3b1fb7);_0x4eddd8(_0x161de9['error'](0x1f4,_0xf87355[_0xac0c('0x14')]));});});}; \ No newline at end of file +var _0xcd69=['options','raw','where','attributes','limit','map','include','model','GetFaxQueue','ShowFaxQueue','find','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','FaxQueue','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd69,0xfc));var _0x9cd6=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xcd69[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x9cd6('0x0'));var util=require(_0x9cd6('0x1'));var moment=require(_0x9cd6('0x2'));var BPromise=require('bluebird');var rs=require(_0x9cd6('0x3'));var fs=require('fs');var Redis=require(_0x9cd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9cd6('0x5'))(_0x9cd6('0x6'));var config=require(_0x9cd6('0x7'));var jayson=require(_0x9cd6('0x8'));var client=jayson[_0x9cd6('0x9')][_0x9cd6('0xa')]({'port':0x232a});config[_0x9cd6('0xb')]=_['defaults'](config[_0x9cd6('0xb')],{'host':_0x9cd6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cd6('0xb')]));require('./faxQueue.socket')[_0x9cd6('0xd')](socket);function respondWithRpcPromise(_0x1e7da1,_0x27c14f,_0x3d1d3e){return new BPromise(function(_0x42f978,_0x2947cd){return client[_0x9cd6('0xe')](_0x1e7da1,_0x3d1d3e)[_0x9cd6('0xf')](function(_0x43ed32){logger[_0x9cd6('0x10')]('FaxQueue,\x20%s,\x20%s',_0x27c14f,_0x9cd6('0x11'));logger['debug'](_0x9cd6('0x12'),_0x27c14f,_0x9cd6('0x11'),JSON[_0x9cd6('0x13')](_0x43ed32));if(_0x43ed32[_0x9cd6('0x14')]){if(_0x43ed32[_0x9cd6('0x14')][_0x9cd6('0x15')]===0x1f4){logger[_0x9cd6('0x14')](_0x9cd6('0x16'),_0x27c14f,_0x43ed32[_0x9cd6('0x14')]['message']);return _0x2947cd(_0x43ed32['error'][_0x9cd6('0x17')]);}logger[_0x9cd6('0x14')](_0x9cd6('0x16'),_0x27c14f,_0x43ed32[_0x9cd6('0x14')]['message']);return _0x42f978(_0x43ed32['error'][_0x9cd6('0x17')]);}else{logger[_0x9cd6('0x10')](_0x9cd6('0x16'),_0x27c14f,_0x9cd6('0x11'));_0x42f978(_0x43ed32[_0x9cd6('0x18')][_0x9cd6('0x17')]);}})[_0x9cd6('0x19')](function(_0x560d0b){logger[_0x9cd6('0x14')](_0x9cd6('0x16'),_0x27c14f,_0x560d0b);_0x2947cd(_0x560d0b);});});}exports['GetFaxQueue']=function(_0x15c25a){var _0x5e56fa=this;return new Promise(function(_0x46efc6,_0x144a0b){return db[_0x9cd6('0x1a')][_0x9cd6('0x1b')]({'raw':_0x15c25a[_0x9cd6('0x1c')]?_0x15c25a[_0x9cd6('0x1c')][_0x9cd6('0x1d')]===undefined?!![]:![]:!![],'where':_0x15c25a['options']?_0x15c25a[_0x9cd6('0x1c')][_0x9cd6('0x1e')]||null:null,'attributes':_0x15c25a[_0x9cd6('0x1c')]?_0x15c25a[_0x9cd6('0x1c')][_0x9cd6('0x1f')]||null:null,'limit':_0x15c25a[_0x9cd6('0x1c')]?_0x15c25a[_0x9cd6('0x1c')][_0x9cd6('0x20')]||null:null,'include':_0x15c25a[_0x9cd6('0x1c')]?_0x15c25a[_0x9cd6('0x1c')]['include']?_[_0x9cd6('0x21')](_0x15c25a['options'][_0x9cd6('0x22')],function(_0x5cb2d2){return{'model':db[_0x5cb2d2[_0x9cd6('0x23')]],'as':_0x5cb2d2['as'],'attributes':_0x5cb2d2['attributes'],'include':_0x5cb2d2[_0x9cd6('0x22')]?_[_0x9cd6('0x21')](_0x5cb2d2[_0x9cd6('0x22')],function(_0xafd2a3){return{'model':db[_0xafd2a3[_0x9cd6('0x23')]],'as':_0xafd2a3['as'],'attributes':_0xafd2a3[_0x9cd6('0x1f')],'include':_0xafd2a3['include']?_[_0x9cd6('0x21')](_0xafd2a3[_0x9cd6('0x22')],function(_0x304753){return{'model':db[_0x304753[_0x9cd6('0x23')]],'as':_0x304753['as'],'attributes':_0x304753[_0x9cd6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9cd6('0xf')](function(_0x171c9a){logger[_0x9cd6('0x10')](_0x9cd6('0x24'),_0x15c25a);logger['debug'](_0x9cd6('0x24'),_0x15c25a,JSON['stringify'](_0x171c9a));_0x46efc6(_0x171c9a);})['catch'](function(_0x54b103){logger[_0x9cd6('0x14')]('GetFaxQueue',_0x54b103[_0x9cd6('0x17')],_0x15c25a);_0x144a0b(_0x5e56fa[_0x9cd6('0x14')](0x1f4,_0x54b103['message']));});});};exports[_0x9cd6('0x25')]=function(_0x17f31){var _0x34385f=this;return new Promise(function(_0x5ad378,_0x45d539){return db[_0x9cd6('0x1a')][_0x9cd6('0x26')]({'raw':_0x17f31['options']?_0x17f31[_0x9cd6('0x1c')][_0x9cd6('0x1d')]===undefined?!![]:![]:!![],'where':_0x17f31[_0x9cd6('0x1c')]?_0x17f31['options'][_0x9cd6('0x1e')]||null:null,'attributes':_0x17f31[_0x9cd6('0x1c')]?_0x17f31[_0x9cd6('0x1c')][_0x9cd6('0x1f')]||null:null,'include':_0x17f31[_0x9cd6('0x1c')]?_0x17f31[_0x9cd6('0x1c')][_0x9cd6('0x22')]?_[_0x9cd6('0x21')](_0x17f31[_0x9cd6('0x1c')][_0x9cd6('0x22')],function(_0x679a57){return{'model':db[_0x679a57['model']],'as':_0x679a57['as'],'attributes':_0x679a57['attributes'],'include':_0x679a57['include']?_[_0x9cd6('0x21')](_0x679a57[_0x9cd6('0x22')],function(_0xa91c00){return{'model':db[_0xa91c00[_0x9cd6('0x23')]],'as':_0xa91c00['as'],'attributes':_0xa91c00['attributes'],'include':_0xa91c00[_0x9cd6('0x22')]?_['map'](_0xa91c00['include'],function(_0x1595a0){return{'model':db[_0x1595a0[_0x9cd6('0x23')]],'as':_0x1595a0['as'],'attributes':_0x1595a0[_0x9cd6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9cd6('0xf')](function(_0x3803ad){logger[_0x9cd6('0x10')]('ShowFaxQueue',_0x17f31);logger[_0x9cd6('0x27')](_0x9cd6('0x25'),_0x17f31,JSON[_0x9cd6('0x13')](_0x3803ad));_0x5ad378(_0x3803ad);})[_0x9cd6('0x19')](function(_0x406d55){logger[_0x9cd6('0x14')]('ShowFaxQueue',_0x406d55[_0x9cd6('0x17')],_0x17f31);_0x45d539(_0x34385f['error'](0x1f4,_0x406d55[_0x9cd6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0ca244e..ab68d04 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 _0x0ba7=['remove','update','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x0ba7,0x126));var _0x70ba=function(_0x5801c4,_0x259ff2){_0x5801c4=_0x5801c4-0x0;var _0x48ce73=_0x0ba7[_0x5801c4];return _0x48ce73;};'use strict';var FaxQueueEvents=require(_0x70ba('0x0'));var events=[_0x70ba('0x1'),_0x70ba('0x2'),_0x70ba('0x3')];function createListener(_0x41624e,_0x13a580){return function(_0x133765){_0x13a580[_0x70ba('0x4')](_0x41624e,_0x133765);};}function removeListener(_0x542814,_0x3f96de){return function(){FaxQueueEvents[_0x70ba('0x5')](_0x542814,_0x3f96de);};}exports[_0x70ba('0x6')]=function(_0xd93b6f){for(var _0x5b2ba1=0x0,_0x2a3cdb=events['length'];_0x5b2ba1<_0x2a3cdb;_0x5b2ba1++){var _0x1635fa=events[_0x5b2ba1];var _0x1567c5=createListener(_0x70ba('0x7')+_0x1635fa,_0xd93b6f);FaxQueueEvents['on'](_0x1635fa,_0x1567c5);}}; \ No newline at end of file +var _0xb99d=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x45c605,_0x3f2123){var _0x416eda=function(_0x44f9b3){while(--_0x44f9b3){_0x45c605['push'](_0x45c605['shift']());}};_0x416eda(++_0x3f2123);}(_0xb99d,0xf2));var _0xdb99=function(_0x5843d2,_0x121877){_0x5843d2=_0x5843d2-0x0;var _0x6dd37=_0xb99d[_0x5843d2];return _0x6dd37;};'use strict';var FaxQueueEvents=require(_0xdb99('0x0'));var events=[_0xdb99('0x1'),_0xdb99('0x2'),_0xdb99('0x3')];function createListener(_0x192dc6,_0x48181d){return function(_0x21cd60){_0x48181d[_0xdb99('0x4')](_0x192dc6,_0x21cd60);};}function removeListener(_0x18a5c8,_0x287eed){return function(){FaxQueueEvents[_0xdb99('0x5')](_0x18a5c8,_0x287eed);};}exports[_0xdb99('0x6')]=function(_0x2b5d38){for(var _0x4ef446=0x0,_0x35e19c=events[_0xdb99('0x7')];_0x4ef446<_0x35e19c;_0x4ef446++){var _0x136498=events[_0x4ef446];var _0x5093fc=createListener(_0xdb99('0x8')+_0x136498,_0x2b5d38);FaxQueueEvents['on'](_0x136498,_0x5093fc);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 79a09bf..e334163 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xb10b,0x12a));var _0xbb10=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0xb10b[_0x20cc29];return _0x28d513;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x0b0e,0x187));var _0xe0b0=function(_0x507056,_0xe16b72){_0x507056=_0x507056-0x0;var _0x4eaecc=_0x0b0e[_0x507056];return _0x4eaecc;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3553a80..418fc13 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 _0xcbbf=['exports','STRING','DATE','moment'];(function(_0x3e261b,_0x27d452){var _0x1c4083=function(_0x4ce5ca){while(--_0x4ce5ca){_0x3e261b['push'](_0x3e261b['shift']());}};_0x1c4083(++_0x27d452);}(_0xcbbf,0x1ef));var _0xfcbb=function(_0x4de89d,_0x4eacf9){_0x4de89d=_0x4de89d-0x0;var _0x47fd8d=_0xcbbf[_0x4de89d];return _0x47fd8d;};'use strict';var moment=require(_0xfcbb('0x0'));var Sequelize=require('sequelize');module[_0xfcbb('0x1')]={'uniqueid':{'type':Sequelize[_0xfcbb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfcbb('0x2')]},'joinAt':{'type':Sequelize[_0xfcbb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cab=['sequelize','exports','STRING','DATE','moment'];(function(_0x5480e5,_0x52e354){var _0x20b7cc=function(_0x21627d){while(--_0x21627d){_0x5480e5['push'](_0x5480e5['shift']());}};_0x20b7cc(++_0x52e354);}(_0x3cab,0x7c));var _0xb3ca=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x3cab[_0x5be7aa];return _0x215408;};'use strict';var moment=require(_0xb3ca('0x0'));var Sequelize=require(_0xb3ca('0x1'));module[_0xb3ca('0x2')]={'uniqueid':{'type':Sequelize[_0xb3ca('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb3ca('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb3ca('0x4')]},'acceptAt':{'type':Sequelize[_0xb3ca('0x4')]},'exitAt':{'type':Sequelize[_0xb3ca('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 150ff1b..22b256d 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 _0xc6df=['query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x1c5adf,_0x12a026){var _0x3dd9c2=function(_0x25e4d9){while(--_0x25e4d9){_0x1c5adf['push'](_0x1c5adf['shift']());}};_0x3dd9c2(++_0x12a026);}(_0xc6df,0xa6));var _0xfc6d=function(_0xc240a0,_0x363242){_0xc240a0=_0xc240a0-0x0;var _0x21192f=_0xc6df[_0xc240a0];return _0x21192f;};'use strict';var pdf=require(_0xfc6d('0x0'));var emlformat=require(_0xfc6d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc6d('0x2'));var jsonpatch=require(_0xfc6d('0x3'));var rp=require('request-promise');var moment=require(_0xfc6d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc6d('0x5'));var util=require(_0xfc6d('0x6'));var path=require(_0xfc6d('0x7'));var sox=require(_0xfc6d('0x8'));var csv=require(_0xfc6d('0x9'));var ejs=require(_0xfc6d('0xa'));var fs=require('fs');var _=require(_0xfc6d('0xb'));var squel=require(_0xfc6d('0xc'));var crypto=require('crypto');var jsforce=require(_0xfc6d('0xd'));var deskjs=require(_0xfc6d('0xe'));var toCsv=require(_0xfc6d('0x9'));var querystring=require(_0xfc6d('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc6d('0x10'));var authService=require(_0xfc6d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc6d('0x12'));var hardwareService=require(_0xfc6d('0x13'));var logger=require(_0xfc6d('0x14'))('api');var utils=require(_0xfc6d('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15f168,_0x29a620){_0x29a620=_0x29a620||0xcc;return function(_0x35525c){if(_0x35525c){return _0x15f168['sendStatus'](_0x29a620);}return _0x15f168[_0xfc6d('0x16')](_0x29a620)[_0xfc6d('0x17')]();};}function respondWithResult(_0x4e1d2c,_0x1f72ad){_0x1f72ad=_0x1f72ad||0xc8;return function(_0x42dc90){if(_0x42dc90){return _0x4e1d2c[_0xfc6d('0x16')](_0x1f72ad)[_0xfc6d('0x18')](_0x42dc90);}};}function respondWithFilteredResult(_0x211921,_0x3503c6){return function(_0x2f059d){if(_0x2f059d){var _0x88f4fa=_0x2f059d[_0xfc6d('0x19')],_0x4ded92=_0x3503c6[_0xfc6d('0x1a')],_0x11ad1c=_0x3503c6[_0xfc6d('0x1a')]+_0x3503c6[_0xfc6d('0x1b')],_0x3b3c12;if(_0x11ad1c>=_0x88f4fa){_0x11ad1c=_0x88f4fa;_0x3b3c12=0xc8;}else{_0x3b3c12=0xce;}_0x211921[_0xfc6d('0x16')](_0x3b3c12);return _0x211921[_0xfc6d('0x1c')](_0xfc6d('0x1d'),_0x4ded92+'-'+_0x11ad1c+'/'+_0x88f4fa)[_0xfc6d('0x18')](_0x2f059d);}return null;};}function patchUpdates(_0x1e7a1f){return function(_0x362bca){try{jsonpatch[_0xfc6d('0x1e')](_0x362bca,_0x1e7a1f,!![]);}catch(_0x4ad811){return BPromise[_0xfc6d('0x1f')](_0x4ad811);}return _0x362bca[_0xfc6d('0x20')]();};}function saveUpdates(_0x4e01cb,_0x341772){return function(_0x526b0c){if(_0x526b0c){return _0x526b0c[_0xfc6d('0x21')](_0x4e01cb)[_0xfc6d('0x22')](function(_0x243655){return _0x243655;});}return null;};}function removeEntity(_0x278c18,_0x20219e){return function(_0x38900c){if(_0x38900c){return _0x38900c['destroy']()[_0xfc6d('0x22')](function(){_0x278c18['status'](0xcc)[_0xfc6d('0x17')]();});}};}function handleEntityNotFound(_0x5b0875,_0x34f8a4){return function(_0x55ef51){if(!_0x55ef51){_0x5b0875[_0xfc6d('0x23')](0x194);}return _0x55ef51;};}function handleError(_0x31b4a7,_0x2f78a4){_0x2f78a4=_0x2f78a4||0x1f4;return function(_0x35f7ff){logger[_0xfc6d('0x24')](_0x35f7ff['stack']);if(_0x35f7ff[_0xfc6d('0x25')]){delete _0x35f7ff['name'];}_0x31b4a7['status'](_0x2f78a4)[_0xfc6d('0x26')](_0x35f7ff);};}exports[_0xfc6d('0x27')]=function(_0x31a16a,_0x37a5fc){var _0x1adac2={},_0x5d3cbb={},_0x3d0e84={'count':0x0,'rows':[]};var _0x23cf44=_[_0xfc6d('0x28')](db[_0xfc6d('0x29')][_0xfc6d('0x2a')],function(_0x4c6615){return{'name':_0x4c6615[_0xfc6d('0x2b')],'type':_0x4c6615[_0xfc6d('0x2c')][_0xfc6d('0x2d')]};});_0x5d3cbb[_0xfc6d('0x2e')]=_['map'](_0x23cf44,_0xfc6d('0x25'));_0x5d3cbb[_0xfc6d('0x2f')]=_[_0xfc6d('0x30')](_0x31a16a['query']);_0x5d3cbb['filters']=_[_0xfc6d('0x31')](_0x5d3cbb[_0xfc6d('0x2e')],_0x5d3cbb[_0xfc6d('0x2f')]);_0x1adac2[_0xfc6d('0x32')]=_[_0xfc6d('0x31')](_0x5d3cbb['model'],qs[_0xfc6d('0x33')](_0x31a16a[_0xfc6d('0x2f')][_0xfc6d('0x33')]));_0x1adac2[_0xfc6d('0x32')]=_0x1adac2[_0xfc6d('0x32')]['length']?_0x1adac2[_0xfc6d('0x32')]:_0x5d3cbb[_0xfc6d('0x2e')];if(!_0x31a16a[_0xfc6d('0x2f')][_0xfc6d('0x34')]('nolimit')){_0x1adac2[_0xfc6d('0x1b')]=qs[_0xfc6d('0x1b')](_0x31a16a['query'][_0xfc6d('0x1b')]);_0x1adac2['offset']=qs[_0xfc6d('0x1a')](_0x31a16a[_0xfc6d('0x2f')][_0xfc6d('0x1a')]);}_0x1adac2['order']=qs[_0xfc6d('0x35')](_0x31a16a[_0xfc6d('0x2f')]['sort']);_0x1adac2[_0xfc6d('0x36')]=qs[_0xfc6d('0x37')](_[_0xfc6d('0x38')](_0x31a16a[_0xfc6d('0x2f')],_0x5d3cbb['filters']),_0x23cf44);if(_0x31a16a[_0xfc6d('0x2f')][_0xfc6d('0x39')]){_0x1adac2[_0xfc6d('0x36')]=_[_0xfc6d('0x3a')](_0x1adac2[_0xfc6d('0x36')],{'$or':_[_0xfc6d('0x28')](_0x23cf44,function(_0x56da96){if(_0x56da96[_0xfc6d('0x2c')]!==_0xfc6d('0x3b')){var _0x2443c9={};_0x2443c9[_0x56da96[_0xfc6d('0x25')]]={'$like':'%'+_0x31a16a['query'][_0xfc6d('0x39')]+'%'};return _0x2443c9;}})});}_0x1adac2=_['merge']({},_0x1adac2,_0x31a16a['options']);var _0x448fab={'where':_0x1adac2[_0xfc6d('0x36')]};return db[_0xfc6d('0x29')]['count'](_0x448fab)[_0xfc6d('0x22')](function(_0x3d537d){_0x3d0e84[_0xfc6d('0x19')]=_0x3d537d;if(_0x31a16a[_0xfc6d('0x2f')][_0xfc6d('0x3c')]){_0x1adac2[_0xfc6d('0x3d')]=[{'all':!![]}];}return db[_0xfc6d('0x29')]['findAll'](_0x1adac2);})[_0xfc6d('0x22')](function(_0x1ab467){_0x3d0e84[_0xfc6d('0x3e')]=_0x1ab467;return _0x3d0e84;})['then'](respondWithFilteredResult(_0x37a5fc,_0x1adac2))['catch'](handleError(_0x37a5fc,null));};exports[_0xfc6d('0x3f')]=function(_0x799821,_0x389e69){var _0x1502f0={'raw':!![],'where':{'id':_0x799821[_0xfc6d('0x40')]['id']}},_0x8e277f={};_0x8e277f[_0xfc6d('0x2e')]=_[_0xfc6d('0x30')](db[_0xfc6d('0x29')]['rawAttributes']);_0x8e277f[_0xfc6d('0x2f')]=_[_0xfc6d('0x30')](_0x799821[_0xfc6d('0x2f')]);_0x8e277f[_0xfc6d('0x37')]=_[_0xfc6d('0x31')](_0x8e277f[_0xfc6d('0x2e')],_0x8e277f['query']);_0x1502f0['attributes']=_[_0xfc6d('0x31')](_0x8e277f[_0xfc6d('0x2e')],qs[_0xfc6d('0x33')](_0x799821[_0xfc6d('0x2f')][_0xfc6d('0x33')]));_0x1502f0[_0xfc6d('0x32')]=_0x1502f0[_0xfc6d('0x32')][_0xfc6d('0x41')]?_0x1502f0[_0xfc6d('0x32')]:_0x8e277f[_0xfc6d('0x2e')];if(_0x799821['query'][_0xfc6d('0x3c')]){_0x1502f0[_0xfc6d('0x3d')]=[{'all':!![]}];}_0x1502f0=_[_0xfc6d('0x3a')]({},_0x1502f0,_0x799821['options']);return db[_0xfc6d('0x29')][_0xfc6d('0x42')](_0x1502f0)[_0xfc6d('0x22')](handleEntityNotFound(_0x389e69,null))[_0xfc6d('0x22')](respondWithResult(_0x389e69,null))[_0xfc6d('0x43')](handleError(_0x389e69,null));};exports['create']=function(_0x761d20,_0x4ca06a){return db[_0xfc6d('0x29')][_0xfc6d('0x44')](_0x761d20[_0xfc6d('0x45')],{})[_0xfc6d('0x22')](respondWithResult(_0x4ca06a,0xc9))['catch'](handleError(_0x4ca06a,null));};exports[_0xfc6d('0x21')]=function(_0x4b6dab,_0x2010a6){if(_0x4b6dab[_0xfc6d('0x45')]['id']){delete _0x4b6dab[_0xfc6d('0x45')]['id'];}return db['FaxQueueReport'][_0xfc6d('0x42')]({'where':{'id':_0x4b6dab[_0xfc6d('0x40')]['id']}})[_0xfc6d('0x22')](handleEntityNotFound(_0x2010a6,null))[_0xfc6d('0x22')](saveUpdates(_0x4b6dab[_0xfc6d('0x45')],null))[_0xfc6d('0x22')](respondWithResult(_0x2010a6,null))[_0xfc6d('0x43')](handleError(_0x2010a6,null));};exports['destroy']=function(_0x26e4d8,_0x288e09){return db[_0xfc6d('0x29')][_0xfc6d('0x42')]({'where':{'id':_0x26e4d8[_0xfc6d('0x40')]['id']}})[_0xfc6d('0x22')](handleEntityNotFound(_0x288e09,null))[_0xfc6d('0x22')](removeEntity(_0x288e09,null))[_0xfc6d('0x43')](handleError(_0x288e09,null));};exports['describe']=function(_0x1710c8,_0x4fdb14){return db[_0xfc6d('0x29')][_0xfc6d('0x46')]()['then'](respondWithResult(_0x4fdb14,null))[_0xfc6d('0x43')](handleError(_0x4fdb14,null));}; \ No newline at end of file +var _0xc6c3=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','find','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','send','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc6c3,0x170));var _0x3c6c=function(_0x465684,_0x527edd){_0x465684=_0x465684-0x0;var _0x137644=_0xc6c3[_0x465684];return _0x137644;};'use strict';var pdf=require(_0x3c6c('0x0'));var emlformat=require(_0x3c6c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3c6c('0x2'));var jsonpatch=require(_0x3c6c('0x3'));var rp=require(_0x3c6c('0x4'));var moment=require(_0x3c6c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c6c('0x6'));var util=require('util');var path=require(_0x3c6c('0x7'));var sox=require(_0x3c6c('0x8'));var csv=require(_0x3c6c('0x9'));var ejs=require(_0x3c6c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c6c('0xb'));var crypto=require(_0x3c6c('0xc'));var jsforce=require(_0x3c6c('0xd'));var deskjs=require(_0x3c6c('0xe'));var toCsv=require(_0x3c6c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c6c('0xf'));var qs=require(_0x3c6c('0x10'));var as=require(_0x3c6c('0x11'));var hardwareService=require(_0x3c6c('0x12'));var logger=require(_0x3c6c('0x13'))('api');var utils=require(_0x3c6c('0x14'));var config=require(_0x3c6c('0x15'));var db=require(_0x3c6c('0x16'))['db'];function respondWithStatusCode(_0x333ded,_0x324676){_0x324676=_0x324676||0xcc;return function(_0x4fbb45){if(_0x4fbb45){return _0x333ded['sendStatus'](_0x324676);}return _0x333ded[_0x3c6c('0x17')](_0x324676)[_0x3c6c('0x18')]();};}function respondWithResult(_0x571286,_0xfde1de){_0xfde1de=_0xfde1de||0xc8;return function(_0x369ca4){if(_0x369ca4){return _0x571286['status'](_0xfde1de)[_0x3c6c('0x19')](_0x369ca4);}};}function respondWithFilteredResult(_0x4539ea,_0x371456){return function(_0x28e17e){if(_0x28e17e){var _0x36b7c9=_0x28e17e[_0x3c6c('0x1a')],_0xf81432=_0x371456[_0x3c6c('0x1b')],_0x242ffd=_0x371456[_0x3c6c('0x1b')]+_0x371456[_0x3c6c('0x1c')],_0x4a43b9;if(_0x242ffd>=_0x36b7c9){_0x242ffd=_0x36b7c9;_0x4a43b9=0xc8;}else{_0x4a43b9=0xce;}_0x4539ea['status'](_0x4a43b9);return _0x4539ea['set'](_0x3c6c('0x1d'),_0xf81432+'-'+_0x242ffd+'/'+_0x36b7c9)[_0x3c6c('0x19')](_0x28e17e);}return null;};}function patchUpdates(_0x51aaab){return function(_0x45091b){try{jsonpatch[_0x3c6c('0x1e')](_0x45091b,_0x51aaab,!![]);}catch(_0x5ef47d){return BPromise['reject'](_0x5ef47d);}return _0x45091b[_0x3c6c('0x1f')]();};}function saveUpdates(_0x12a9fa,_0x54a6e8){return function(_0x43dea4){if(_0x43dea4){return _0x43dea4[_0x3c6c('0x20')](_0x12a9fa)[_0x3c6c('0x21')](function(_0x1e4493){return _0x1e4493;});}return null;};}function removeEntity(_0x3437a8,_0x8bbcff){return function(_0x683784){if(_0x683784){return _0x683784[_0x3c6c('0x22')]()['then'](function(){_0x3437a8[_0x3c6c('0x17')](0xcc)[_0x3c6c('0x18')]();});}};}function handleEntityNotFound(_0x304e7f,_0x31fb30){return function(_0x2d3a0d){if(!_0x2d3a0d){_0x304e7f[_0x3c6c('0x23')](0x194);}return _0x2d3a0d;};}function handleError(_0x51fe93,_0x307124){_0x307124=_0x307124||0x1f4;return function(_0x3f3d4f){logger[_0x3c6c('0x24')](_0x3f3d4f['stack']);if(_0x3f3d4f['name']){delete _0x3f3d4f['name'];}_0x51fe93[_0x3c6c('0x17')](_0x307124)[_0x3c6c('0x25')](_0x3f3d4f);};}exports['index']=function(_0x32d8b8,_0x1a10da){var _0x501bd6={},_0x2603b7={},_0x1be1b9={'count':0x0,'rows':[]};var _0x2daf61=_['map'](db[_0x3c6c('0x26')][_0x3c6c('0x27')],function(_0x4e9ad8){return{'name':_0x4e9ad8[_0x3c6c('0x28')],'type':_0x4e9ad8[_0x3c6c('0x29')][_0x3c6c('0x2a')]};});_0x2603b7[_0x3c6c('0x2b')]=_[_0x3c6c('0x2c')](_0x2daf61,'name');_0x2603b7[_0x3c6c('0x2d')]=_[_0x3c6c('0x2e')](_0x32d8b8['query']);_0x2603b7[_0x3c6c('0x2f')]=_['intersection'](_0x2603b7[_0x3c6c('0x2b')],_0x2603b7[_0x3c6c('0x2d')]);_0x501bd6[_0x3c6c('0x30')]=_[_0x3c6c('0x31')](_0x2603b7[_0x3c6c('0x2b')],qs[_0x3c6c('0x32')](_0x32d8b8[_0x3c6c('0x2d')]['fields']));_0x501bd6[_0x3c6c('0x30')]=_0x501bd6[_0x3c6c('0x30')][_0x3c6c('0x33')]?_0x501bd6[_0x3c6c('0x30')]:_0x2603b7['model'];if(!_0x32d8b8[_0x3c6c('0x2d')]['hasOwnProperty'](_0x3c6c('0x34'))){_0x501bd6[_0x3c6c('0x1c')]=qs[_0x3c6c('0x1c')](_0x32d8b8[_0x3c6c('0x2d')]['limit']);_0x501bd6[_0x3c6c('0x1b')]=qs[_0x3c6c('0x1b')](_0x32d8b8[_0x3c6c('0x2d')][_0x3c6c('0x1b')]);}_0x501bd6[_0x3c6c('0x35')]=qs[_0x3c6c('0x36')](_0x32d8b8['query']['sort']);_0x501bd6[_0x3c6c('0x37')]=qs[_0x3c6c('0x2f')](_[_0x3c6c('0x38')](_0x32d8b8['query'],_0x2603b7[_0x3c6c('0x2f')]),_0x2daf61);if(_0x32d8b8[_0x3c6c('0x2d')][_0x3c6c('0x39')]){_0x501bd6[_0x3c6c('0x37')]=_[_0x3c6c('0x3a')](_0x501bd6[_0x3c6c('0x37')],{'$or':_[_0x3c6c('0x2c')](_0x2daf61,function(_0x11fc26){if(_0x11fc26[_0x3c6c('0x29')]!==_0x3c6c('0x3b')){var _0x270ed7={};_0x270ed7[_0x11fc26[_0x3c6c('0x3c')]]={'$like':'%'+_0x32d8b8[_0x3c6c('0x2d')][_0x3c6c('0x39')]+'%'};return _0x270ed7;}})});}_0x501bd6=_[_0x3c6c('0x3a')]({},_0x501bd6,_0x32d8b8[_0x3c6c('0x3d')]);var _0x16548f={'where':_0x501bd6[_0x3c6c('0x37')]};return db['FaxQueueReport'][_0x3c6c('0x1a')](_0x16548f)[_0x3c6c('0x21')](function(_0x445e88){_0x1be1b9['count']=_0x445e88;if(_0x32d8b8[_0x3c6c('0x2d')][_0x3c6c('0x3e')]){_0x501bd6[_0x3c6c('0x3f')]=[{'all':!![]}];}return db[_0x3c6c('0x26')][_0x3c6c('0x40')](_0x501bd6);})[_0x3c6c('0x21')](function(_0x1b5761){_0x1be1b9[_0x3c6c('0x41')]=_0x1b5761;return _0x1be1b9;})[_0x3c6c('0x21')](respondWithFilteredResult(_0x1a10da,_0x501bd6))[_0x3c6c('0x42')](handleError(_0x1a10da,null));};exports['show']=function(_0x292391,_0x1da841){var _0x4d8c9f={'raw':!![],'where':{'id':_0x292391[_0x3c6c('0x43')]['id']}},_0x412d43={};_0x412d43[_0x3c6c('0x2b')]=_[_0x3c6c('0x2e')](db[_0x3c6c('0x26')][_0x3c6c('0x27')]);_0x412d43[_0x3c6c('0x2d')]=_[_0x3c6c('0x2e')](_0x292391['query']);_0x412d43[_0x3c6c('0x2f')]=_[_0x3c6c('0x31')](_0x412d43[_0x3c6c('0x2b')],_0x412d43['query']);_0x4d8c9f[_0x3c6c('0x30')]=_['intersection'](_0x412d43['model'],qs[_0x3c6c('0x32')](_0x292391[_0x3c6c('0x2d')][_0x3c6c('0x32')]));_0x4d8c9f['attributes']=_0x4d8c9f['attributes'][_0x3c6c('0x33')]?_0x4d8c9f[_0x3c6c('0x30')]:_0x412d43[_0x3c6c('0x2b')];if(_0x292391[_0x3c6c('0x2d')][_0x3c6c('0x3e')]){_0x4d8c9f[_0x3c6c('0x3f')]=[{'all':!![]}];}_0x4d8c9f=_[_0x3c6c('0x3a')]({},_0x4d8c9f,_0x292391[_0x3c6c('0x3d')]);return db['FaxQueueReport'][_0x3c6c('0x44')](_0x4d8c9f)[_0x3c6c('0x21')](handleEntityNotFound(_0x1da841,null))['then'](respondWithResult(_0x1da841,null))['catch'](handleError(_0x1da841,null));};exports['create']=function(_0x8a4df6,_0x2f7489){return db['FaxQueueReport']['create'](_0x8a4df6['body'],{})['then'](respondWithResult(_0x2f7489,0xc9))[_0x3c6c('0x42')](handleError(_0x2f7489,null));};exports[_0x3c6c('0x20')]=function(_0x3ce406,_0x245194){if(_0x3ce406[_0x3c6c('0x45')]['id']){delete _0x3ce406[_0x3c6c('0x45')]['id'];}return db[_0x3c6c('0x26')]['find']({'where':{'id':_0x3ce406[_0x3c6c('0x43')]['id']}})[_0x3c6c('0x21')](handleEntityNotFound(_0x245194,null))[_0x3c6c('0x21')](saveUpdates(_0x3ce406['body'],null))[_0x3c6c('0x21')](respondWithResult(_0x245194,null))['catch'](handleError(_0x245194,null));};exports['destroy']=function(_0x3e5378,_0x266b21){return db[_0x3c6c('0x26')]['find']({'where':{'id':_0x3e5378[_0x3c6c('0x43')]['id']}})[_0x3c6c('0x21')](handleEntityNotFound(_0x266b21,null))['then'](removeEntity(_0x266b21,null))[_0x3c6c('0x42')](handleError(_0x266b21,null));};exports['describe']=function(_0xe41f3a,_0x3d8e79){return db[_0x3c6c('0x26')]['describe']()[_0x3c6c('0x21')](respondWithResult(_0x3d8e79,null))[_0x3c6c('0x42')](handleError(_0x3d8e79,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3eaab43..a108555 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 _0x9582=['bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x9582,0x95));var _0x2958=function(_0x1cb1cf,_0x43cfce){_0x1cb1cf=_0x1cb1cf-0x0;var _0x211c76=_0x9582[_0x1cb1cf];return _0x211c76;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c789f,_0x9dacd1){var _0x3e8568=function(_0x456552){while(--_0x456552){_0x3c789f['push'](_0x3c789f['shift']());}};_0x3e8568(++_0x9dacd1);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7413('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8459abb..026b1b7 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 _0x6a34=['../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','catch','CreateFaxQueueReport','options','raw','FaxQueueReport','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3cba0e,_0x5bf202){var _0x454478=function(_0x4358e8){while(--_0x4358e8){_0x3cba0e['push'](_0x3cba0e['shift']());}};_0x454478(++_0x5bf202);}(_0x6a34,0x1c9));var _0x46a3=function(_0x5b4224,_0x4b358f){_0x5b4224=_0x5b4224-0x0;var _0x18a697=_0x6a34[_0x5b4224];return _0x18a697;};'use strict';var _=require(_0x46a3('0x0'));var util=require('util');var moment=require(_0x46a3('0x1'));var BPromise=require(_0x46a3('0x2'));var rs=require(_0x46a3('0x3'));var fs=require('fs');var Redis=require(_0x46a3('0x4'));var db=require(_0x46a3('0x5'))['db'];var utils=require(_0x46a3('0x6'));var logger=require('../../config/logger')(_0x46a3('0x7'));var config=require(_0x46a3('0x8'));var jayson=require(_0x46a3('0x9'));var client=jayson[_0x46a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2416,_0x53bded,_0x2cf4bf){return new BPromise(function(_0x39b5db,_0x26b266){return client['request'](_0x1e2416,_0x2cf4bf)[_0x46a3('0xb')](function(_0x20fae1){logger[_0x46a3('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x53bded,_0x46a3('0xd'));logger[_0x46a3('0xe')](_0x46a3('0xf'),_0x53bded,_0x46a3('0xd'),JSON[_0x46a3('0x10')](_0x20fae1));if(_0x20fae1[_0x46a3('0x11')]){if(_0x20fae1['error'][_0x46a3('0x12')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x53bded,_0x20fae1[_0x46a3('0x11')][_0x46a3('0x13')]);return _0x26b266(_0x20fae1[_0x46a3('0x11')][_0x46a3('0x13')]);}logger[_0x46a3('0x11')](_0x46a3('0x14'),_0x53bded,_0x20fae1[_0x46a3('0x11')]['message']);return _0x39b5db(_0x20fae1[_0x46a3('0x11')]['message']);}else{logger[_0x46a3('0xc')](_0x46a3('0x14'),_0x53bded,_0x46a3('0xd'));_0x39b5db(_0x20fae1['result'][_0x46a3('0x13')]);}})[_0x46a3('0x15')](function(_0x536410){logger['error'](_0x46a3('0x14'),_0x53bded,_0x536410);_0x26b266(_0x536410);});});}exports[_0x46a3('0x16')]=function(_0x60a045){var _0x28e6c0=this;return new Promise(function(_0x3db66f,_0x36cbcc){return db['FaxQueueReport']['create'](_0x60a045['body'],{'raw':_0x60a045[_0x46a3('0x17')]?_0x60a045[_0x46a3('0x17')][_0x46a3('0x18')]===undefined?!![]:![]:!![]})[_0x46a3('0xb')](function(_0x4e1254){logger[_0x46a3('0xc')](_0x46a3('0x16'),_0x60a045);logger[_0x46a3('0xe')](_0x46a3('0x16'),_0x60a045,JSON[_0x46a3('0x10')](_0x4e1254));_0x3db66f(_0x4e1254);})[_0x46a3('0x15')](function(_0x1ea876){logger[_0x46a3('0x11')](_0x46a3('0x16'),_0x1ea876[_0x46a3('0x13')],_0x60a045);_0x36cbcc(_0x28e6c0['error'](0x1f4,_0x1ea876[_0x46a3('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x24307d){var _0x31bfb9=this;return new Promise(function(_0x106ac9,_0x2deaf3){return db[_0x46a3('0x19')][_0x46a3('0x1a')](_0x24307d['body'],{'raw':_0x24307d[_0x46a3('0x17')]?_0x24307d[_0x46a3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24307d[_0x46a3('0x17')]?_0x24307d[_0x46a3('0x17')][_0x46a3('0x1b')]||null:null,'attributes':_0x24307d[_0x46a3('0x17')]?_0x24307d[_0x46a3('0x17')][_0x46a3('0x1c')]||null:null,'limit':_0x24307d[_0x46a3('0x17')]?_0x24307d[_0x46a3('0x17')][_0x46a3('0x1d')]||null:null})[_0x46a3('0xb')](function(_0x5d252e){logger['info'](_0x46a3('0x1e'),_0x24307d);logger['debug']('UpdateFaxQueueReport',_0x24307d,JSON[_0x46a3('0x10')](_0x5d252e));_0x106ac9(_0x5d252e);})[_0x46a3('0x15')](function(_0x315b5){logger[_0x46a3('0x11')]('UpdateFaxQueueReport',_0x315b5['message'],_0x24307d);_0x2deaf3(_0x31bfb9[_0x46a3('0x11')](0x1f4,_0x315b5[_0x46a3('0x13')]));});});}; \ No newline at end of file +var _0x1063=['stringify','CreateFaxQueueReport','update','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','FaxQueueReport','create','body','options','raw'];(function(_0x59c778,_0x3da9c1){var _0x2f1e44=function(_0x337ad0){while(--_0x337ad0){_0x59c778['push'](_0x59c778['shift']());}};_0x2f1e44(++_0x3da9c1);}(_0x1063,0x102));var _0x3106=function(_0x30813f,_0x57308b){_0x30813f=_0x30813f-0x0;var _0x27c06a=_0x1063[_0x30813f];return _0x27c06a;};'use strict';var _=require(_0x3106('0x0'));var util=require(_0x3106('0x1'));var moment=require(_0x3106('0x2'));var BPromise=require(_0x3106('0x3'));var rs=require(_0x3106('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3106('0x5'))['db'];var utils=require(_0x3106('0x6'));var logger=require(_0x3106('0x7'))(_0x3106('0x8'));var config=require(_0x3106('0x9'));var jayson=require(_0x3106('0xa'));var client=jayson[_0x3106('0xb')][_0x3106('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x492ebf,_0x3e87b1,_0x11d2ba){return new BPromise(function(_0x18273d,_0x1d6d49){return client[_0x3106('0xd')](_0x492ebf,_0x11d2ba)[_0x3106('0xe')](function(_0x2e3e20){logger[_0x3106('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3e87b1,_0x3106('0x10'));logger[_0x3106('0x11')](_0x3106('0x12'),_0x3e87b1,_0x3106('0x10'),JSON['stringify'](_0x2e3e20));if(_0x2e3e20[_0x3106('0x13')]){if(_0x2e3e20[_0x3106('0x13')][_0x3106('0x14')]===0x1f4){logger[_0x3106('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3e87b1,_0x2e3e20[_0x3106('0x13')][_0x3106('0x15')]);return _0x1d6d49(_0x2e3e20['error'][_0x3106('0x15')]);}logger[_0x3106('0x13')](_0x3106('0x16'),_0x3e87b1,_0x2e3e20['error'][_0x3106('0x15')]);return _0x18273d(_0x2e3e20[_0x3106('0x13')][_0x3106('0x15')]);}else{logger[_0x3106('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3e87b1,'request\x20sent');_0x18273d(_0x2e3e20[_0x3106('0x17')][_0x3106('0x15')]);}})[_0x3106('0x18')](function(_0x74c660){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3e87b1,_0x74c660);_0x1d6d49(_0x74c660);});});}exports['CreateFaxQueueReport']=function(_0x2d768a){var _0x15e397=this;return new Promise(function(_0x473dab,_0x70b22b){return db[_0x3106('0x19')][_0x3106('0x1a')](_0x2d768a[_0x3106('0x1b')],{'raw':_0x2d768a[_0x3106('0x1c')]?_0x2d768a['options'][_0x3106('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3b762f){logger[_0x3106('0xf')]('CreateFaxQueueReport',_0x2d768a);logger['debug']('CreateFaxQueueReport',_0x2d768a,JSON[_0x3106('0x1e')](_0x3b762f));_0x473dab(_0x3b762f);})[_0x3106('0x18')](function(_0x5cfc67){logger[_0x3106('0x13')](_0x3106('0x1f'),_0x5cfc67[_0x3106('0x15')],_0x2d768a);_0x70b22b(_0x15e397[_0x3106('0x13')](0x1f4,_0x5cfc67[_0x3106('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x297cba){var _0x3d33aa=this;return new Promise(function(_0xceb36d,_0x1a14ce){return db[_0x3106('0x19')][_0x3106('0x20')](_0x297cba[_0x3106('0x1b')],{'raw':_0x297cba['options']?_0x297cba[_0x3106('0x1c')][_0x3106('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x297cba['options']?_0x297cba[_0x3106('0x1c')]['where']||null:null,'attributes':_0x297cba[_0x3106('0x1c')]?_0x297cba[_0x3106('0x1c')][_0x3106('0x21')]||null:null,'limit':_0x297cba[_0x3106('0x1c')]?_0x297cba[_0x3106('0x1c')][_0x3106('0x22')]||null:null})[_0x3106('0xe')](function(_0x1fee22){logger['info'](_0x3106('0x23'),_0x297cba);logger['debug'](_0x3106('0x23'),_0x297cba,JSON[_0x3106('0x1e')](_0x1fee22));_0xceb36d(_0x1fee22);})['catch'](function(_0x174d6d){logger[_0x3106('0x13')](_0x3106('0x23'),_0x174d6d[_0x3106('0x15')],_0x297cba);_0x1a14ce(_0x3d33aa[_0x3106('0x13')](0x1f4,_0x174d6d[_0x3106('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0284952..7e62889 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 _0x949d=['express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2eb831,_0x560722){var _0x813400=function(_0x36d96f){while(--_0x36d96f){_0x2eb831['push'](_0x2eb831['shift']());}};_0x813400(++_0x560722);}(_0x949d,0xc2));var _0xd949=function(_0x2f13ea,_0x38514e){_0x2f13ea=_0x2f13ea-0x0;var _0x3531f7=_0x949d[_0x2f13ea];return _0x3531f7;};'use strict';var multer=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var path=require(_0xd949('0x2'));var timeout=require(_0xd949('0x3'));var express=require(_0xd949('0x4'));var router=express[_0xd949('0x5')]();var auth=require(_0xd949('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd949('0x7'));var controller=require(_0xd949('0x8'));router[_0xd949('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd949('0x9')](_0xd949('0xa'),auth[_0xd949('0xb')](),controller['describe']);router[_0xd949('0x9')](_0xd949('0xc'),auth[_0xd949('0xb')](),controller[_0xd949('0xd')]);router[_0xd949('0xe')]('/',auth[_0xd949('0xb')](),controller[_0xd949('0xf')]);router['put'](_0xd949('0xc'),auth[_0xd949('0xb')](),controller['update']);router[_0xd949('0x10')](_0xd949('0xc'),auth[_0xd949('0xb')](),controller[_0xd949('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc0c8=['Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xc0c8,0x187));var _0x8c0c=function(_0x3b409e,_0x1b4f71){_0x3b409e=_0x3b409e-0x0;var _0x33774c=_0xc0c8[_0x3b409e];return _0x33774c;};'use strict';var multer=require(_0x8c0c('0x0'));var util=require(_0x8c0c('0x1'));var path=require(_0x8c0c('0x2'));var timeout=require(_0x8c0c('0x3'));var express=require(_0x8c0c('0x4'));var router=express[_0x8c0c('0x5')]();var auth=require(_0x8c0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c0c('0x7'));var controller=require(_0x8c0c('0x8'));router[_0x8c0c('0x9')]('/',auth[_0x8c0c('0xa')](),controller[_0x8c0c('0xb')]);router[_0x8c0c('0x9')]('/describe',auth[_0x8c0c('0xa')](),controller[_0x8c0c('0xc')]);router['get'](_0x8c0c('0xd'),auth[_0x8c0c('0xa')](),controller[_0x8c0c('0xe')]);router[_0x8c0c('0xf')]('/',auth[_0x8c0c('0xa')](),controller[_0x8c0c('0x10')]);router[_0x8c0c('0x11')](_0x8c0c('0xd'),auth[_0x8c0c('0xa')](),controller[_0x8c0c('0x12')]);router[_0x8c0c('0x13')](_0x8c0c('0xd'),auth[_0x8c0c('0xa')](),controller[_0x8c0c('0x14')]);module[_0x8c0c('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d8adc42..9085db1 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 _0xec33=['account','queue','DATE','moment','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec33,0x73));var _0x3ec3=function(_0x5474b8,_0x4f242d){_0x5474b8=_0x5474b8-0x0;var _0x5851ed=_0xec33[_0x5474b8];return _0x5851ed;};'use strict';var moment=require(_0x3ec3('0x0'));var Sequelize=require(_0x3ec3('0x1'));module[_0x3ec3('0x2')]={'uniqueid':{'type':Sequelize[_0x3ec3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3ec3('0x4')](_0x3ec3('0x5'),'agent',_0x3ec3('0x6')),'allowNull':![],'defaultValue':_0x3ec3('0x6')},'transferredAt':{'type':Sequelize[_0x3ec3('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x62b3=['sequelize','STRING','ENUM','account','queue','DATE'];(function(_0x2d00c9,_0x4f71b3){var _0x5de6cb=function(_0xd2c5da){while(--_0xd2c5da){_0x2d00c9['push'](_0x2d00c9['shift']());}};_0x5de6cb(++_0x4f71b3);}(_0x62b3,0x17a));var _0x362b=function(_0xf98fbc,_0x21f43e){_0xf98fbc=_0xf98fbc-0x0;var _0x1f5883=_0x62b3[_0xf98fbc];return _0x1f5883;};'use strict';var moment=require('moment');var Sequelize=require(_0x362b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x362b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x362b('0x2')](_0x362b('0x3'),'agent',_0x362b('0x4')),'allowNull':![],'defaultValue':_0x362b('0x4')},'transferredAt':{'type':Sequelize[_0x362b('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6845e9f..c088e54 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 _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x5705b3,_0x4e4e57){var _0xb4a7dd=function(_0x2f4eb6){while(--_0x2f4eb6){_0x5705b3['push'](_0x5705b3['shift']());}};_0xb4a7dd(++_0x4e4e57);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file +var _0x2ef3=['send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','then','stack','name'];(function(_0x169a20,_0xb9fa6d){var _0x3b1406=function(_0x59f508){while(--_0x59f508){_0x169a20['push'](_0x169a20['shift']());}};_0x3b1406(++_0xb9fa6d);}(_0x2ef3,0xba));var _0x32ef=function(_0x2bf75b,_0x20b89c){_0x2bf75b=_0x2bf75b-0x0;var _0x5ad1b8=_0x2ef3[_0x2bf75b];return _0x5ad1b8;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]),_0xba4b3f);if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['FaxTransferReport'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));};exports[_0x32ef('0x4a')]=function(_0x326445,_0x307ac8){return db[_0x32ef('0x29')][_0x32ef('0x4a')]()[_0x32ef('0x24')](respondWithResult(_0x307ac8,null))['catch'](handleError(_0x307ac8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index aacecd8..56e801e 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 _0x35ee=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid'];(function(_0x1e8a0f,_0x434574){var _0x255724=function(_0x32e3f9){while(--_0x32e3f9){_0x1e8a0f['push'](_0x1e8a0f['shift']());}};_0x255724(++_0x434574);}(_0x35ee,0x1ee));var _0xe35e=function(_0x3e2f81,_0x32df44){_0x3e2f81=_0x3e2f81-0x0;var _0x152184=_0x35ee[_0x3e2f81];return _0x152184;};'use strict';var _=require(_0xe35e('0x0'));var util=require(_0xe35e('0x1'));var logger=require('../../config/logger')(_0xe35e('0x2'));var moment=require(_0xe35e('0x3'));var BPromise=require(_0xe35e('0x4'));var rp=require(_0xe35e('0x5'));var fs=require('fs');var path=require(_0xe35e('0x6'));var rimraf=require('rimraf');var config=require(_0xe35e('0x7'));var attributes=require(_0xe35e('0x8'));module[_0xe35e('0x9')]=function(_0x47534b,_0x3e6133){return _0x47534b[_0xe35e('0xa')](_0xe35e('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xe35e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x88e9=['report_fax_transfer','uniqueid','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x88e9,0x141));var _0x988e=function(_0xcc3d40,_0x3c0f3c){_0xcc3d40=_0xcc3d40-0x0;var _0x4160a3=_0x88e9[_0xcc3d40];return _0x4160a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x988e('0x0'))(_0x988e('0x1'));var moment=require(_0x988e('0x2'));var BPromise=require(_0x988e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x988e('0x4'));var config=require(_0x988e('0x5'));var attributes=require(_0x988e('0x6'));module[_0x988e('0x7')]=function(_0x30bad0,_0x4cbc80){return _0x30bad0['define'](_0x988e('0x8'),attributes,{'tableName':_0x988e('0x9'),'paranoid':![],'indexes':[{'name':_0x988e('0xa'),'fields':[_0x988e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 79b0a74..fb4842b 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 _0x786e=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x786e,0x16f));var _0xe786=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x786e[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var moment=require(_0xe786('0x2'));var BPromise=require(_0xe786('0x3'));var rs=require(_0xe786('0x4'));var fs=require('fs');var Redis=require(_0xe786('0x5'));var db=require(_0xe786('0x6'))['db'];var utils=require(_0xe786('0x7'));var logger=require(_0xe786('0x8'))(_0xe786('0x9'));var config=require(_0xe786('0xa'));var jayson=require(_0xe786('0xb'));var client=jayson[_0xe786('0xc')][_0xe786('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2d1474,_0x2ac660,_0x1a6616){return new BPromise(function(_0x33b0aa,_0x2bc983){return client['request'](_0x2d1474,_0x1a6616)[_0xe786('0xe')](function(_0x586f73){logger[_0xe786('0xf')](_0xe786('0x10'),_0x2ac660,_0xe786('0x11'));logger[_0xe786('0x12')](_0xe786('0x13'),_0x2ac660,_0xe786('0x11'),JSON[_0xe786('0x14')](_0x586f73));if(_0x586f73[_0xe786('0x15')]){if(_0x586f73[_0xe786('0x15')][_0xe786('0x16')]===0x1f4){logger[_0xe786('0x15')](_0xe786('0x10'),_0x2ac660,_0x586f73[_0xe786('0x15')][_0xe786('0x17')]);return _0x2bc983(_0x586f73[_0xe786('0x15')][_0xe786('0x17')]);}logger[_0xe786('0x15')](_0xe786('0x10'),_0x2ac660,_0x586f73['error'][_0xe786('0x17')]);return _0x33b0aa(_0x586f73[_0xe786('0x15')]['message']);}else{logger[_0xe786('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2ac660,_0xe786('0x11'));_0x33b0aa(_0x586f73[_0xe786('0x18')][_0xe786('0x17')]);}})[_0xe786('0x19')](function(_0x566e2a){logger[_0xe786('0x15')](_0xe786('0x10'),_0x2ac660,_0x566e2a);_0x2bc983(_0x566e2a);});});} \ No newline at end of file +var _0xfe06=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe06,0x8d));var _0x6fe0=function(_0x25128e,_0x5805fc){_0x25128e=_0x25128e-0x0;var _0x1af6d2=_0xfe06[_0x25128e];return _0x1af6d2;};'use strict';var _=require('lodash');var util=require(_0x6fe0('0x0'));var moment=require(_0x6fe0('0x1'));var BPromise=require('bluebird');var rs=require(_0x6fe0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fe0('0x4'))(_0x6fe0('0x5'));var config=require(_0x6fe0('0x6'));var jayson=require(_0x6fe0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd8e57,_0x23d014,_0x3fb819){return new BPromise(function(_0x5dd20d,_0x495ff8){return client['request'](_0xfd8e57,_0x3fb819)['then'](function(_0x29b558){logger['info'](_0x6fe0('0x8'),_0x23d014,'request\x20sent');logger['debug'](_0x6fe0('0x9'),_0x23d014,_0x6fe0('0xa'),JSON['stringify'](_0x29b558));if(_0x29b558[_0x6fe0('0xb')]){if(_0x29b558[_0x6fe0('0xb')][_0x6fe0('0xc')]===0x1f4){logger[_0x6fe0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x23d014,_0x29b558[_0x6fe0('0xb')]['message']);return _0x495ff8(_0x29b558[_0x6fe0('0xb')][_0x6fe0('0xd')]);}logger['error'](_0x6fe0('0x8'),_0x23d014,_0x29b558[_0x6fe0('0xb')]['message']);return _0x5dd20d(_0x29b558[_0x6fe0('0xb')][_0x6fe0('0xd')]);}else{logger[_0x6fe0('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x23d014,_0x6fe0('0xa'));_0x5dd20d(_0x29b558[_0x6fe0('0xf')][_0x6fe0('0xd')]);}})['catch'](function(_0x50d0dd){logger['error'](_0x6fe0('0x8'),_0x23d014,_0x50d0dd);_0x495ff8(_0x50d0dd);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d5e6fe4..f322c89 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 _0x6100=['destroy','exports','util','connect-timeout','express','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','post','create','put','/:id'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0x6100,0x1d3));var _0x0610=function(_0xeb8c45,_0x19904){_0xeb8c45=_0xeb8c45-0x0;var _0x40867a=_0x6100[_0xeb8c45];return _0x40867a;};'use strict';var multer=require('multer');var util=require(_0x0610('0x0'));var path=require('path');var timeout=require(_0x0610('0x1'));var express=require(_0x0610('0x2'));var router=express[_0x0610('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0610('0x4'));var controller=require(_0x0610('0x5'));router[_0x0610('0x6')]('/',auth[_0x0610('0x7')](),controller['index']);router[_0x0610('0x6')]('/describe',auth[_0x0610('0x7')](),controller[_0x0610('0x8')]);router[_0x0610('0x6')]('/:id',auth[_0x0610('0x7')](),controller['show']);router[_0x0610('0x9')]('/',auth[_0x0610('0x7')](),controller[_0x0610('0xa')]);router[_0x0610('0xb')](_0x0610('0xc'),auth[_0x0610('0x7')](),controller['update']);router['delete']('/:id',auth[_0x0610('0x7')](),controller[_0x0610('0xd')]);module[_0x0610('0xe')]=router; \ No newline at end of file +var _0xa265=['describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x30ffbf,_0x4ee49f){var _0x53039b=function(_0x3924da){while(--_0x3924da){_0x30ffbf['push'](_0x30ffbf['shift']());}};_0x53039b(++_0x4ee49f);}(_0xa265,0x7a));var _0x5a26=function(_0x550551,_0xeb030a){_0x550551=_0x550551-0x0;var _0x510724=_0xa265[_0x550551];return _0x510724;};'use strict';var multer=require(_0x5a26('0x0'));var util=require('util');var path=require(_0x5a26('0x1'));var timeout=require(_0x5a26('0x2'));var express=require(_0x5a26('0x3'));var router=express[_0x5a26('0x4')]();var auth=require(_0x5a26('0x5'));var interaction=require(_0x5a26('0x6'));var config=require(_0x5a26('0x7'));var controller=require('./faxTransferReport.controller');router[_0x5a26('0x8')]('/',auth[_0x5a26('0x9')](),controller['index']);router[_0x5a26('0x8')](_0x5a26('0xa'),auth['isAuthenticated'](),controller[_0x5a26('0xb')]);router[_0x5a26('0x8')](_0x5a26('0xc'),auth[_0x5a26('0x9')](),controller[_0x5a26('0xd')]);router[_0x5a26('0xe')]('/',auth[_0x5a26('0x9')](),controller[_0x5a26('0xf')]);router['put']('/:id',auth[_0x5a26('0x9')](),controller[_0x5a26('0x10')]);router[_0x5a26('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5a26('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index eb5183f..dda46bd 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 _0x7da7=['isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller'];(function(_0x1f0ad0,_0x379f0b){var _0x2cec6e=function(_0x518fc2){while(--_0x518fc2){_0x1f0ad0['push'](_0x1f0ad0['shift']());}};_0x2cec6e(++_0x379f0b);}(_0x7da7,0x10d));var _0x77da=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x7da7[_0x5b34c0];return _0x242bd3;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['post']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x10')]);router[_0x77da('0x11')](_0x77da('0xc'),auth['isAuthenticated'](),controller[_0x77da('0x12')]);router[_0x77da('0x13')](_0x77da('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x77da('0x14')](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0x15')]);module[_0x77da('0x16')]=router; \ No newline at end of file +var _0xcca7=['getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x54c37f,_0x25254b){var _0x38cc4c=function(_0x12d321){while(--_0x12d321){_0x54c37f['push'](_0x54c37f['shift']());}};_0x38cc4c(++_0x25254b);}(_0xcca7,0x1aa));var _0x7cca=function(_0x52eb71,_0x565708){_0x52eb71=_0x52eb71-0x0;var _0x585935=_0xcca7[_0x52eb71];return _0x585935;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7cca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7cca('0x5'));var controller=require(_0x7cca('0x6'));router[_0x7cca('0x7')]('/',auth[_0x7cca('0x8')](),controller[_0x7cca('0x9')]);router[_0x7cca('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7cca('0xa')]);router[_0x7cca('0x7')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xc')]);router[_0x7cca('0x7')](_0x7cca('0xd'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xe')]);router[_0x7cca('0xf')]('/',auth['isAuthenticated'](),controller[_0x7cca('0x10')]);router[_0x7cca('0xf')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x11')]);router['put'](_0x7cca('0x12'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x13')]);router['delete']('/:id',auth[_0x7cca('0x8')](),controller[_0x7cca('0x14')]);module[_0x7cca('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 563eb08..9e7ccc9 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 _0x279c=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x279c,0x157));var _0xc279=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x279c[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xc279('0x0'));module[_0xc279('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc279('0x2')]},'username':{'type':Sequelize[_0xc279('0x2')]},'remoteUri':{'type':Sequelize[_0xc279('0x2')]},'authType':{'type':Sequelize[_0xc279('0x3')]('basic'),'defaultValue':_0xc279('0x4')},'password':{'type':Sequelize[_0xc279('0x2')]},'consumerKey':{'type':Sequelize[_0xc279('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xc279('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xc279('0x5'),_0xc279('0x6')),'defaultValue':_0xc279('0x5')}}; \ No newline at end of file +var _0x1722=['integrationTab','exports','STRING','ENUM','basic','newTab'];(function(_0x40e648,_0x119083){var _0xc87178=function(_0x7aa958){while(--_0x7aa958){_0x40e648['push'](_0x40e648['shift']());}};_0xc87178(++_0x119083);}(_0x1722,0xeb));var _0x2172=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1722[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x2172('0x0')]={'name':{'type':Sequelize[_0x2172('0x1')]},'description':{'type':Sequelize[_0x2172('0x1')]},'username':{'type':Sequelize[_0x2172('0x1')]},'remoteUri':{'type':Sequelize[_0x2172('0x1')]},'authType':{'type':Sequelize[_0x2172('0x2')](_0x2172('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x2172('0x1')]},'consumerKey':{'type':Sequelize[_0x2172('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2172('0x1')]},'tokenSecret':{'type':Sequelize[_0x2172('0x1')]},'serverUrl':{'type':Sequelize[_0x2172('0x1')]},'type':{'type':Sequelize[_0x2172('0x2')]('integrationTab',_0x2172('0x4')),'defaultValue':_0x2172('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b913a1e..f56e017 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 _0x6a2b=['entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','status','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','params','include','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded'];(function(_0x6a3cb2,_0xa52273){var _0x591e6d=function(_0x3f072a){while(--_0x3f072a){_0x6a3cb2['push'](_0x6a3cb2['shift']());}};_0x591e6d(++_0xa52273);}(_0x6a2b,0x83));var _0xb6a2=function(_0x281305,_0x2998d6){_0x281305=_0x281305-0x0;var _0x56ffbe=_0x6a2b[_0x281305];return _0x56ffbe;};'use strict';var pdf=require(_0xb6a2('0x0'));var emlformat=require(_0xb6a2('0x1'));var rimraf=require(_0xb6a2('0x2'));var zipdir=require(_0xb6a2('0x3'));var jsonpatch=require(_0xb6a2('0x4'));var rp=require('request-promise');var moment=require(_0xb6a2('0x5'));var BPromise=require(_0xb6a2('0x6'));var Mustache=require(_0xb6a2('0x7'));var util=require(_0xb6a2('0x8'));var path=require('path');var sox=require(_0xb6a2('0x9'));var csv=require(_0xb6a2('0xa'));var ejs=require(_0xb6a2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6a2('0xc'));var crypto=require(_0xb6a2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb6a2('0xa'));var querystring=require(_0xb6a2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb6a2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6a2('0x10'))(_0xb6a2('0x11'));var utils=require(_0xb6a2('0x12'));var config=require(_0xb6a2('0x13'));var db=require(_0xb6a2('0x14'))['db'];var integrations=require(_0xb6a2('0x15'));var jayson=require(_0xb6a2('0x16'));var client=jayson[_0xb6a2('0x17')][_0xb6a2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2485a9,_0x319ee3,_0x2770d1){if(_0x2770d1){var _0x40b7af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40b7af[_0xb6a2('0x19')](_0x319ee3)){return _0x2485a9;}else{throw new db[(_0xb6a2('0x1a'))][(_0xb6a2('0x1b'))](_0xb6a2('0x1c'));}}else{return _0x2485a9;}}function respondWithRpcPromise(_0x41aac3,_0x30168e,_0x94cdb0,_0x355859){return new BPromise(function(_0x935b8d,_0x3eb98d){var _0x416a53=_0x355859||client;return _0x416a53[_0xb6a2('0x1d')](_0x41aac3,_0x94cdb0)[_0xb6a2('0x1e')](function(_0x35778c){logger[_0xb6a2('0x1f')](_0xb6a2('0x20'),_0x30168e,_0xb6a2('0x21'));logger['debug'](_0xb6a2('0x22'),_0x30168e,_0xb6a2('0x21'),JSON[_0xb6a2('0x23')](_0x35778c));if(_0x35778c[_0xb6a2('0x24')]){if(_0x35778c[_0xb6a2('0x24')][_0xb6a2('0x25')]===0x1f4){logger[_0xb6a2('0x24')](_0xb6a2('0x20'),_0x30168e,_0x35778c[_0xb6a2('0x24')][_0xb6a2('0x26')]);return _0x3eb98d(_0x35778c['error'][_0xb6a2('0x26')]);}logger[_0xb6a2('0x24')](_0xb6a2('0x20'),_0x30168e,_0x35778c[_0xb6a2('0x24')]['message']);return _0x935b8d(_0x35778c['error'][_0xb6a2('0x26')]);}else{logger['info'](_0xb6a2('0x20'),_0x30168e,_0xb6a2('0x21'));_0x935b8d(_0x35778c[_0xb6a2('0x27')][_0xb6a2('0x26')]);}})[_0xb6a2('0x28')](function(_0x541b74){logger[_0xb6a2('0x24')](_0xb6a2('0x20'),_0x30168e,_0x541b74);_0x3eb98d(_0x541b74);});});}function respondWithStatusCode(_0xbfb94,_0x2801de){_0x2801de=_0x2801de||0xcc;return function(_0x4c66a1){if(_0x4c66a1){return _0xbfb94[_0xb6a2('0x29')](_0x2801de);}return _0xbfb94['status'](_0x2801de)[_0xb6a2('0x2a')]();};}function respondWithResult(_0x4f91a2,_0x13409c){_0x13409c=_0x13409c||0xc8;return function(_0x4931f2){if(_0x4931f2){return _0x4f91a2['status'](_0x13409c)[_0xb6a2('0x2b')](_0x4931f2);}};}function respondWithFilteredResult(_0x1be4fb,_0x539cc4){return function(_0x128d33){if(_0x128d33){var _0x51c954=_0x128d33['count'],_0x5829c0=_0x539cc4[_0xb6a2('0x2c')],_0x8ef102=_0x539cc4[_0xb6a2('0x2c')]+_0x539cc4['limit'],_0x4960df;if(_0x8ef102>=_0x51c954){_0x8ef102=_0x51c954;_0x4960df=0xc8;}else{_0x4960df=0xce;}_0x1be4fb[_0xb6a2('0x2d')](_0x4960df);return _0x1be4fb['set'](_0xb6a2('0x2e'),_0x5829c0+'-'+_0x8ef102+'/'+_0x51c954)[_0xb6a2('0x2b')](_0x128d33);}return null;};}function patchUpdates(_0x105cc2){return function(_0x2e9612){try{jsonpatch[_0xb6a2('0x2f')](_0x2e9612,_0x105cc2,!![]);}catch(_0x8dd352){return BPromise[_0xb6a2('0x30')](_0x8dd352);}return _0x2e9612[_0xb6a2('0x31')]();};}function saveUpdates(_0x3d1176,_0x54436e){return function(_0x4eba07){if(_0x4eba07){return _0x4eba07[_0xb6a2('0x32')](_0x3d1176)['then'](function(_0x50474f){return _0x50474f;});}return null;};}function removeEntity(_0x515196,_0x43a042){return function(_0x502087){if(_0x502087){return _0x502087[_0xb6a2('0x33')]()[_0xb6a2('0x1e')](function(){_0x515196['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39de84,_0x256a97){return function(_0x2024da){if(!_0x2024da){_0x39de84[_0xb6a2('0x29')](0x194);}return _0x2024da;};}function handleError(_0x4a91b4,_0x40b2f3){_0x40b2f3=_0x40b2f3||0x1f4;return function(_0x1d8184){logger[_0xb6a2('0x24')](_0x1d8184[_0xb6a2('0x34')]);if(_0x1d8184['name']){delete _0x1d8184['name'];}_0x4a91b4[_0xb6a2('0x2d')](_0x40b2f3)[_0xb6a2('0x35')](_0x1d8184);};}exports[_0xb6a2('0x36')]=function(_0x34bd0b,_0x10f2c9){var _0x588c9c={},_0x25f0c2={},_0x1990c0={'count':0x0,'rows':[]};var _0x15a995=_[_0xb6a2('0x37')](db[_0xb6a2('0x38')][_0xb6a2('0x39')],function(_0x5d4ef5){return{'name':_0x5d4ef5[_0xb6a2('0x3a')],'type':_0x5d4ef5[_0xb6a2('0x3b')][_0xb6a2('0x3c')]};});_0x25f0c2[_0xb6a2('0x3d')]=_[_0xb6a2('0x37')](_0x15a995,_0xb6a2('0x3e'));_0x25f0c2['query']=_[_0xb6a2('0x3f')](_0x34bd0b[_0xb6a2('0x40')]);_0x25f0c2[_0xb6a2('0x41')]=_['intersection'](_0x25f0c2['model'],_0x25f0c2[_0xb6a2('0x40')]);_0x588c9c[_0xb6a2('0x42')]=_[_0xb6a2('0x43')](_0x25f0c2[_0xb6a2('0x3d')],qs[_0xb6a2('0x44')](_0x34bd0b[_0xb6a2('0x40')]['fields']));_0x588c9c[_0xb6a2('0x42')]=_0x588c9c[_0xb6a2('0x42')][_0xb6a2('0x45')]?_0x588c9c[_0xb6a2('0x42')]:_0x25f0c2[_0xb6a2('0x3d')];if(!_0x34bd0b['query'][_0xb6a2('0x46')](_0xb6a2('0x47'))){_0x588c9c[_0xb6a2('0x48')]=qs['limit'](_0x34bd0b[_0xb6a2('0x40')]['limit']);_0x588c9c[_0xb6a2('0x2c')]=qs['offset'](_0x34bd0b[_0xb6a2('0x40')][_0xb6a2('0x2c')]);}_0x588c9c[_0xb6a2('0x49')]=qs[_0xb6a2('0x4a')](_0x34bd0b[_0xb6a2('0x40')][_0xb6a2('0x4a')]);_0x588c9c[_0xb6a2('0x4b')]=qs['filters'](_[_0xb6a2('0x4c')](_0x34bd0b['query'],_0x25f0c2[_0xb6a2('0x41')]),_0x15a995);if(_0x34bd0b[_0xb6a2('0x40')][_0xb6a2('0x4d')]){_0x588c9c[_0xb6a2('0x4b')]=_['merge'](_0x588c9c[_0xb6a2('0x4b')],{'$or':_['map'](_0x15a995,function(_0x49ca6d){if(_0x49ca6d[_0xb6a2('0x3b')]!==_0xb6a2('0x4e')){var _0x527896={};_0x527896[_0x49ca6d[_0xb6a2('0x3e')]]={'$like':'%'+_0x34bd0b[_0xb6a2('0x40')][_0xb6a2('0x4d')]+'%'};return _0x527896;}})});}_0x588c9c=_[_0xb6a2('0x4f')]({},_0x588c9c,_0x34bd0b[_0xb6a2('0x50')]);var _0x1f3448={'where':_0x588c9c[_0xb6a2('0x4b')]};return db[_0xb6a2('0x38')][_0xb6a2('0x51')](_0x1f3448)['then'](function(_0x47bfdd){_0x1990c0[_0xb6a2('0x51')]=_0x47bfdd;if(_0x34bd0b[_0xb6a2('0x40')][_0xb6a2('0x52')]){_0x588c9c['include']=[{'all':!![]}];}return db[_0xb6a2('0x38')][_0xb6a2('0x53')](_0x588c9c);})[_0xb6a2('0x1e')](function(_0x516428){_0x1990c0['rows']=_0x516428;return _0x1990c0;})[_0xb6a2('0x1e')](respondWithFilteredResult(_0x10f2c9,_0x588c9c))['catch'](handleError(_0x10f2c9,null));};exports['show']=function(_0x280094,_0x52f63f){var _0x2a84c3={'raw':![],'where':{'id':_0x280094[_0xb6a2('0x54')]['id']}},_0x34a844={};_0x34a844[_0xb6a2('0x3d')]=_[_0xb6a2('0x3f')](db['DeskAccount'][_0xb6a2('0x39')]);_0x34a844[_0xb6a2('0x40')]=_[_0xb6a2('0x3f')](_0x280094[_0xb6a2('0x40')]);_0x34a844['filters']=_[_0xb6a2('0x43')](_0x34a844[_0xb6a2('0x3d')],_0x34a844[_0xb6a2('0x40')]);_0x2a84c3['attributes']=_[_0xb6a2('0x43')](_0x34a844['model'],qs[_0xb6a2('0x44')](_0x280094[_0xb6a2('0x40')][_0xb6a2('0x44')]));_0x2a84c3[_0xb6a2('0x42')]=_0x2a84c3[_0xb6a2('0x42')][_0xb6a2('0x45')]?_0x2a84c3[_0xb6a2('0x42')]:_0x34a844['model'];if(_0x280094[_0xb6a2('0x40')][_0xb6a2('0x52')]){_0x2a84c3[_0xb6a2('0x55')]=[{'all':!![]}];}_0x2a84c3=_['merge']({},_0x2a84c3,_0x280094['options']);return db[_0xb6a2('0x38')][_0xb6a2('0x56')](_0x2a84c3)[_0xb6a2('0x1e')](handleEntityNotFound(_0x52f63f,null))[_0xb6a2('0x1e')](respondWithResult(_0x52f63f,null))['catch'](handleError(_0x52f63f,null));};exports[_0xb6a2('0x57')]=function(_0x21543e,_0x15a6c1){return db[_0xb6a2('0x38')][_0xb6a2('0x57')](_0x21543e[_0xb6a2('0x58')],{})['then'](respondWithResult(_0x15a6c1,0xc9))[_0xb6a2('0x28')](handleError(_0x15a6c1,null));};exports[_0xb6a2('0x32')]=function(_0x32ea1e,_0xc83dd0){if(_0x32ea1e['body']['id']){delete _0x32ea1e[_0xb6a2('0x58')]['id'];}return db[_0xb6a2('0x38')][_0xb6a2('0x56')]({'where':{'id':_0x32ea1e[_0xb6a2('0x54')]['id']}})[_0xb6a2('0x1e')](handleEntityNotFound(_0xc83dd0,null))[_0xb6a2('0x1e')](saveUpdates(_0x32ea1e[_0xb6a2('0x58')],null))[_0xb6a2('0x1e')](respondWithResult(_0xc83dd0,null))[_0xb6a2('0x28')](handleError(_0xc83dd0,null));};exports[_0xb6a2('0x33')]=function(_0x4c2f5e,_0x412b23){return db[_0xb6a2('0x38')][_0xb6a2('0x56')]({'where':{'id':_0x4c2f5e['params']['id']}})['then'](handleEntityNotFound(_0x412b23,null))['then'](removeEntity(_0x412b23,null))[_0xb6a2('0x28')](handleError(_0x412b23,null));};exports[_0xb6a2('0x59')]=function(_0x53f628,_0x5f453a,_0x333e0b){var _0x2676cf={};var _0x5e8d61={};var _0x562a64;var _0x9277bf;return db[_0xb6a2('0x38')][_0xb6a2('0x5a')]({'where':{'id':_0x53f628[_0xb6a2('0x54')]['id']}})[_0xb6a2('0x1e')](handleEntityNotFound(_0x5f453a,null))[_0xb6a2('0x1e')](function(_0xdaddfe){if(_0xdaddfe){_0x562a64=_0xdaddfe;_0x5e8d61[_0xb6a2('0x3d')]=_[_0xb6a2('0x3f')](db[_0xb6a2('0x5b')][_0xb6a2('0x39')]);_0x5e8d61['query']=_[_0xb6a2('0x3f')](_0x53f628['query']);_0x5e8d61[_0xb6a2('0x41')]=_[_0xb6a2('0x43')](_0x5e8d61[_0xb6a2('0x3d')],_0x5e8d61[_0xb6a2('0x40')]);_0x2676cf[_0xb6a2('0x42')]=_[_0xb6a2('0x43')](_0x5e8d61[_0xb6a2('0x3d')],qs[_0xb6a2('0x44')](_0x53f628[_0xb6a2('0x40')]['fields']));_0x2676cf[_0xb6a2('0x42')]=_0x2676cf[_0xb6a2('0x42')][_0xb6a2('0x45')]?_0x2676cf[_0xb6a2('0x42')]:_0x5e8d61[_0xb6a2('0x3d')];_0x2676cf['order']=qs[_0xb6a2('0x4a')](_0x53f628[_0xb6a2('0x40')][_0xb6a2('0x4a')]);_0x2676cf['where']=qs['filters'](_[_0xb6a2('0x4c')](_0x53f628['query'],_0x5e8d61[_0xb6a2('0x41')]));if(_0x53f628[_0xb6a2('0x40')]['filter']){_0x2676cf[_0xb6a2('0x4b')]=_[_0xb6a2('0x4f')](_0x2676cf[_0xb6a2('0x4b')],{'$or':_[_0xb6a2('0x37')](_0x2676cf[_0xb6a2('0x42')],function(_0x35df82){var _0x1e01d8={};_0x1e01d8[_0x35df82]={'$like':'%'+_0x53f628[_0xb6a2('0x40')]['filter']+'%'};return _0x1e01d8;})});}_0x2676cf=_[_0xb6a2('0x4f')]({},_0x2676cf,_0x53f628[_0xb6a2('0x50')]);return _0x562a64[_0xb6a2('0x59')](_0x2676cf);}})[_0xb6a2('0x1e')](function(_0x1d4f60){if(_0x1d4f60){_0x9277bf=_0x1d4f60[_0xb6a2('0x45')];if(!_0x53f628[_0xb6a2('0x40')][_0xb6a2('0x46')](_0xb6a2('0x47'))){_0x2676cf[_0xb6a2('0x48')]=qs[_0xb6a2('0x48')](_0x53f628[_0xb6a2('0x40')][_0xb6a2('0x48')]);_0x2676cf[_0xb6a2('0x2c')]=qs[_0xb6a2('0x2c')](_0x53f628['query'][_0xb6a2('0x2c')]);}return _0x562a64[_0xb6a2('0x59')](_0x2676cf);}})['then'](function(_0x52c532){if(_0x52c532){return _0x52c532?{'count':_0x9277bf,'rows':_0x52c532}:null;}})['then'](respondWithResult(_0x5f453a,null))[_0xb6a2('0x28')](handleError(_0x5f453a,null));};exports[_0xb6a2('0x5c')]=function(_0x2b2d95,_0x1fbc47,_0x4521dc){if(_0x2b2d95[_0xb6a2('0x58')]['id']){delete _0x2b2d95[_0xb6a2('0x58')]['id'];}return db[_0xb6a2('0x38')]['findOne']({'where':{'id':_0x2b2d95[_0xb6a2('0x54')]['id']}})[_0xb6a2('0x1e')](handleEntityNotFound(_0x1fbc47,null))[_0xb6a2('0x1e')](function(_0x19ab0f){if(_0x19ab0f){_0x2b2d95[_0xb6a2('0x58')][_0xb6a2('0x5d')]=_0x19ab0f['id'];_0x2b2d95[_0xb6a2('0x58')][_0xb6a2('0x5e')]=integrations[_0xb6a2('0x5f')](_0x2b2d95[_0xb6a2('0x58')][_0xb6a2('0x60')],_0x2b2d95[_0xb6a2('0x58')]['type']);_0x2b2d95[_0xb6a2('0x58')][_0xb6a2('0x61')]=integrations[_0xb6a2('0x62')](_0x2b2d95[_0xb6a2('0x58')]['channel'],_0x2b2d95[_0xb6a2('0x58')][_0xb6a2('0x3b')]);return db[_0xb6a2('0x5b')][_0xb6a2('0x57')](_0x2b2d95[_0xb6a2('0x58')],{'include':[{'model':db[_0xb6a2('0x63')],'as':_0xb6a2('0x5e')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xb6a2('0x1e')](respondWithResult(_0x1fbc47,null))[_0xb6a2('0x28')](handleError(_0x1fbc47,null));};exports[_0xb6a2('0x64')]=function(_0xc320d6,_0x567296,_0x4d498c){var _0x2ac685=[{'name':_0xb6a2('0x65'),'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 _0x1f1ed3='';return db[_0xb6a2('0x38')][_0xb6a2('0x5a')]({'where':{'id':_0xc320d6[_0xb6a2('0x54')]['id']},'attributes':['id',_0xb6a2('0x66'),_0xb6a2('0x67'),_0xb6a2('0x68'),_0xb6a2('0x69'),_0xb6a2('0x6a'),'consumerSecret',_0xb6a2('0x6b'),_0xb6a2('0x6c')]})['then'](handleEntityNotFound(_0x567296,null))[_0xb6a2('0x1e')](function(_0x35bfa2){if(_0x35bfa2){_0x1f1ed3=_0x35bfa2[_0xb6a2('0x66')];var _0x50dc93=_0x1f1ed3[_0xb6a2('0x6d')](-0x1);if(_0x50dc93==='/'){_0x1f1ed3=_0x1f1ed3[_0xb6a2('0x6e')](0x0,_0x1f1ed3['lastIndexOf'](_0x50dc93));}var _0x2fa59c={'method':'GET','uri':util['format'](_0xb6a2('0x6f'),_0x1f1ed3),'headers':{'Content-Type':_0xb6a2('0x70'),'Accept':'application/json'},'json':!![]};if(_0x35bfa2[_0xb6a2('0x67')]===_0xb6a2('0x71')){_0x2fa59c[_0xb6a2('0x72')][_0xb6a2('0x73')]=util['format'](_0xb6a2('0x74'),new Buffer(util['format'](_0xb6a2('0x75'),_0x35bfa2[_0xb6a2('0x68')],_0x35bfa2[_0xb6a2('0x69')]))[_0xb6a2('0x76')](_0xb6a2('0x77')));}return rp(_0x2fa59c)[_0xb6a2('0x1e')](function(_0x468e0e){return _0x2ac685['concat'](_[_0xb6a2('0x37')](_0x468e0e[_0xb6a2('0x78')][_0xb6a2('0x79')],function(_0x2e5be0){return{'id':_0x2e5be0[_0xb6a2('0x3e')],'name':_0x2e5be0[_0xb6a2('0x3e')],'type':_0x2e5be0['type'],'active':_0x2e5be0[_0xb6a2('0x7a')],'label':_0x2e5be0[_0xb6a2('0x7b')],'custom':!![]};}));});}})[_0xb6a2('0x1e')](function(_0x354a08){return{'count':_0x354a08['length'],'rows':_0x354a08};})[_0xb6a2('0x1e')](respondWithResult(_0x567296,null))[_0xb6a2('0x28')](function(_0x2b9c18){var _0x2e9360=_0xc320d6[_0xb6a2('0x40')]['test']?0x1f4:_0x2b9c18[_0xb6a2('0x7c')]||0x1f4;logger[_0xb6a2('0x24')](_0xb6a2('0x7d'),_0xb6a2('0x64'),_0x2e9360,JSON[_0xb6a2('0x23')](_0x2b9c18));delete _0x2b9c18[_0xb6a2('0x3e')];if(_0x2e9360===0x191){_0x2e9360=0x190;}_0x567296[_0xb6a2('0x2d')](_0x2e9360)[_0xb6a2('0x35')](_0xc320d6[_0xb6a2('0x40')][_0xb6a2('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x2b9c18['statusCode']}:_0x2b9c18);});}; \ No newline at end of file +var _0x6ede=['offset','limit','set','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','rows','show','create','body','find','params','getConfigurations','findOne','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','authType','username','password','consumerSecret','token','remoteUri','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','DeskAccount,\x20%s,\x20%s','message','result','catch','status','end','count'];(function(_0x24af19,_0x268c21){var _0x3d8ea4=function(_0x527243){while(--_0x527243){_0x24af19['push'](_0x24af19['shift']());}};_0x3d8ea4(++_0x268c21);}(_0x6ede,0x1c8));var _0xe6ed=function(_0x47cde9,_0x19d013){_0x47cde9=_0x47cde9-0x0;var _0x26fdf1=_0x6ede[_0x47cde9];return _0x26fdf1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6ed('0x0'));var rimraf=require(_0xe6ed('0x1'));var zipdir=require(_0xe6ed('0x2'));var jsonpatch=require(_0xe6ed('0x3'));var rp=require(_0xe6ed('0x4'));var moment=require('moment');var BPromise=require(_0xe6ed('0x5'));var Mustache=require(_0xe6ed('0x6'));var util=require(_0xe6ed('0x7'));var path=require(_0xe6ed('0x8'));var sox=require('sox');var csv=require(_0xe6ed('0x9'));var ejs=require(_0xe6ed('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe6ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xe6ed('0xc'));var deskjs=require(_0xe6ed('0xd'));var toCsv=require(_0xe6ed('0x9'));var querystring=require(_0xe6ed('0xe'));var Papa=require('papaparse');var Redis=require(_0xe6ed('0xf'));var authService=require(_0xe6ed('0x10'));var qs=require(_0xe6ed('0x11'));var as=require(_0xe6ed('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6ed('0x13'))(_0xe6ed('0x14'));var utils=require(_0xe6ed('0x15'));var config=require(_0xe6ed('0x16'));var db=require(_0xe6ed('0x17'))['db'];var integrations=require(_0xe6ed('0x18'));var jayson=require(_0xe6ed('0x19'));var client=jayson['client'][_0xe6ed('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x19f847,_0xa6c3fe,_0x13c915){if(_0x13c915){var _0x4ab68c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ab68c[_0xe6ed('0x1b')](_0xa6c3fe)){return _0x19f847;}else{throw new db[(_0xe6ed('0x1c'))][(_0xe6ed('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x19f847;}}function respondWithRpcPromise(_0x3312f0,_0x19612c,_0x365cee,_0x3432d9){return new BPromise(function(_0x2451b5,_0x5de675){var _0x2b0ce9=_0x3432d9||client;return _0x2b0ce9[_0xe6ed('0x1e')](_0x3312f0,_0x365cee)[_0xe6ed('0x1f')](function(_0x2ccf32){logger[_0xe6ed('0x20')]('DeskAccount,\x20%s,\x20%s',_0x19612c,_0xe6ed('0x21'));logger[_0xe6ed('0x22')](_0xe6ed('0x23'),_0x19612c,_0xe6ed('0x21'),JSON['stringify'](_0x2ccf32));if(_0x2ccf32['error']){if(_0x2ccf32[_0xe6ed('0x24')]['code']===0x1f4){logger[_0xe6ed('0x24')](_0xe6ed('0x25'),_0x19612c,_0x2ccf32[_0xe6ed('0x24')][_0xe6ed('0x26')]);return _0x5de675(_0x2ccf32['error'][_0xe6ed('0x26')]);}logger[_0xe6ed('0x24')](_0xe6ed('0x25'),_0x19612c,_0x2ccf32[_0xe6ed('0x24')][_0xe6ed('0x26')]);return _0x2451b5(_0x2ccf32[_0xe6ed('0x24')][_0xe6ed('0x26')]);}else{logger[_0xe6ed('0x20')](_0xe6ed('0x25'),_0x19612c,_0xe6ed('0x21'));_0x2451b5(_0x2ccf32[_0xe6ed('0x27')][_0xe6ed('0x26')]);}})[_0xe6ed('0x28')](function(_0x3b5ab0){logger[_0xe6ed('0x24')]('DeskAccount,\x20%s,\x20%s',_0x19612c,_0x3b5ab0);_0x5de675(_0x3b5ab0);});});}function respondWithStatusCode(_0x4425e7,_0x214db3){_0x214db3=_0x214db3||0xcc;return function(_0x1dd653){if(_0x1dd653){return _0x4425e7['sendStatus'](_0x214db3);}return _0x4425e7[_0xe6ed('0x29')](_0x214db3)[_0xe6ed('0x2a')]();};}function respondWithResult(_0x42d949,_0x2b9de7){_0x2b9de7=_0x2b9de7||0xc8;return function(_0x54d0d8){if(_0x54d0d8){return _0x42d949[_0xe6ed('0x29')](_0x2b9de7)['json'](_0x54d0d8);}};}function respondWithFilteredResult(_0x49e6cf,_0x5f31bd){return function(_0x23f200){if(_0x23f200){var _0x2a58aa=_0x23f200[_0xe6ed('0x2b')],_0x10d35d=_0x5f31bd[_0xe6ed('0x2c')],_0x5e7f32=_0x5f31bd[_0xe6ed('0x2c')]+_0x5f31bd[_0xe6ed('0x2d')],_0x29a722;if(_0x5e7f32>=_0x2a58aa){_0x5e7f32=_0x2a58aa;_0x29a722=0xc8;}else{_0x29a722=0xce;}_0x49e6cf[_0xe6ed('0x29')](_0x29a722);return _0x49e6cf[_0xe6ed('0x2e')](_0xe6ed('0x2f'),_0x10d35d+'-'+_0x5e7f32+'/'+_0x2a58aa)[_0xe6ed('0x30')](_0x23f200);}return null;};}function patchUpdates(_0x4094fa){return function(_0x4e34ee){try{jsonpatch['apply'](_0x4e34ee,_0x4094fa,!![]);}catch(_0x44278e){return BPromise[_0xe6ed('0x31')](_0x44278e);}return _0x4e34ee[_0xe6ed('0x32')]();};}function saveUpdates(_0x25058f,_0x59c133){return function(_0x138771){if(_0x138771){return _0x138771[_0xe6ed('0x33')](_0x25058f)['then'](function(_0x3da5d5){return _0x3da5d5;});}return null;};}function removeEntity(_0x3406de,_0x5d55b2){return function(_0x512984){if(_0x512984){return _0x512984[_0xe6ed('0x34')]()['then'](function(){_0x3406de[_0xe6ed('0x29')](0xcc)[_0xe6ed('0x2a')]();});}};}function handleEntityNotFound(_0x2de05e,_0x15a6d9){return function(_0x2f8c33){if(!_0x2f8c33){_0x2de05e[_0xe6ed('0x35')](0x194);}return _0x2f8c33;};}function handleError(_0x5abf0f,_0x2f1067){_0x2f1067=_0x2f1067||0x1f4;return function(_0x37edb7){logger['error'](_0x37edb7['stack']);if(_0x37edb7[_0xe6ed('0x36')]){delete _0x37edb7[_0xe6ed('0x36')];}_0x5abf0f['status'](_0x2f1067)[_0xe6ed('0x37')](_0x37edb7);};}exports['index']=function(_0x58c187,_0x2750e5){var _0x39867d={},_0x2b560a={},_0x5441c0={'count':0x0,'rows':[]};var _0x39b6ef=_[_0xe6ed('0x38')](db[_0xe6ed('0x39')][_0xe6ed('0x3a')],function(_0x93224d){return{'name':_0x93224d[_0xe6ed('0x3b')],'type':_0x93224d['type'][_0xe6ed('0x3c')]};});_0x2b560a[_0xe6ed('0x3d')]=_[_0xe6ed('0x38')](_0x39b6ef,_0xe6ed('0x36'));_0x2b560a[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x58c187[_0xe6ed('0x3e')]);_0x2b560a['filters']=_[_0xe6ed('0x40')](_0x2b560a['model'],_0x2b560a['query']);_0x39867d['attributes']=_['intersection'](_0x2b560a[_0xe6ed('0x3d')],qs[_0xe6ed('0x41')](_0x58c187[_0xe6ed('0x3e')][_0xe6ed('0x41')]));_0x39867d['attributes']=_0x39867d[_0xe6ed('0x42')]['length']?_0x39867d[_0xe6ed('0x42')]:_0x2b560a[_0xe6ed('0x3d')];if(!_0x58c187[_0xe6ed('0x3e')]['hasOwnProperty'](_0xe6ed('0x43'))){_0x39867d['limit']=qs[_0xe6ed('0x2d')](_0x58c187[_0xe6ed('0x3e')][_0xe6ed('0x2d')]);_0x39867d[_0xe6ed('0x2c')]=qs[_0xe6ed('0x2c')](_0x58c187[_0xe6ed('0x3e')][_0xe6ed('0x2c')]);}_0x39867d[_0xe6ed('0x44')]=qs[_0xe6ed('0x45')](_0x58c187[_0xe6ed('0x3e')]['sort']);_0x39867d[_0xe6ed('0x46')]=qs['filters'](_[_0xe6ed('0x47')](_0x58c187['query'],_0x2b560a[_0xe6ed('0x48')]),_0x39b6ef);if(_0x58c187['query'][_0xe6ed('0x49')]){_0x39867d[_0xe6ed('0x46')]=_[_0xe6ed('0x4a')](_0x39867d[_0xe6ed('0x46')],{'$or':_[_0xe6ed('0x38')](_0x39b6ef,function(_0x3c5e3b){if(_0x3c5e3b[_0xe6ed('0x4b')]!==_0xe6ed('0x4c')){var _0x475f0e={};_0x475f0e[_0x3c5e3b[_0xe6ed('0x36')]]={'$like':'%'+_0x58c187['query'][_0xe6ed('0x49')]+'%'};return _0x475f0e;}})});}_0x39867d=_[_0xe6ed('0x4a')]({},_0x39867d,_0x58c187[_0xe6ed('0x4d')]);var _0x2c78d7={'where':_0x39867d['where']};return db[_0xe6ed('0x39')][_0xe6ed('0x2b')](_0x2c78d7)[_0xe6ed('0x1f')](function(_0x52fb21){_0x5441c0[_0xe6ed('0x2b')]=_0x52fb21;if(_0x58c187['query']['includeAll']){_0x39867d[_0xe6ed('0x4e')]=[{'all':!![]}];}return db[_0xe6ed('0x39')]['findAll'](_0x39867d);})[_0xe6ed('0x1f')](function(_0x4f5813){_0x5441c0[_0xe6ed('0x4f')]=_0x4f5813;return _0x5441c0;})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x2750e5,_0x39867d))[_0xe6ed('0x28')](handleError(_0x2750e5,null));};exports[_0xe6ed('0x50')]=function(_0x170fbe,_0x3df119){var _0x1849b8={'raw':![],'where':{'id':_0x170fbe['params']['id']}},_0x4bc1eb={};_0x4bc1eb[_0xe6ed('0x3d')]=_['keys'](db[_0xe6ed('0x39')][_0xe6ed('0x3a')]);_0x4bc1eb['query']=_[_0xe6ed('0x3f')](_0x170fbe[_0xe6ed('0x3e')]);_0x4bc1eb['filters']=_[_0xe6ed('0x40')](_0x4bc1eb['model'],_0x4bc1eb[_0xe6ed('0x3e')]);_0x1849b8['attributes']=_[_0xe6ed('0x40')](_0x4bc1eb[_0xe6ed('0x3d')],qs[_0xe6ed('0x41')](_0x170fbe['query'][_0xe6ed('0x41')]));_0x1849b8[_0xe6ed('0x42')]=_0x1849b8[_0xe6ed('0x42')]['length']?_0x1849b8['attributes']:_0x4bc1eb[_0xe6ed('0x3d')];if(_0x170fbe[_0xe6ed('0x3e')]['includeAll']){_0x1849b8[_0xe6ed('0x4e')]=[{'all':!![]}];}_0x1849b8=_[_0xe6ed('0x4a')]({},_0x1849b8,_0x170fbe[_0xe6ed('0x4d')]);return db[_0xe6ed('0x39')]['find'](_0x1849b8)[_0xe6ed('0x1f')](handleEntityNotFound(_0x3df119,null))[_0xe6ed('0x1f')](respondWithResult(_0x3df119,null))[_0xe6ed('0x28')](handleError(_0x3df119,null));};exports[_0xe6ed('0x51')]=function(_0x1062f8,_0xe61abc){return db[_0xe6ed('0x39')][_0xe6ed('0x51')](_0x1062f8['body'],{})[_0xe6ed('0x1f')](respondWithResult(_0xe61abc,0xc9))[_0xe6ed('0x28')](handleError(_0xe61abc,null));};exports[_0xe6ed('0x33')]=function(_0x399e07,_0x255d7c){if(_0x399e07[_0xe6ed('0x52')]['id']){delete _0x399e07[_0xe6ed('0x52')]['id'];}return db['DeskAccount'][_0xe6ed('0x53')]({'where':{'id':_0x399e07[_0xe6ed('0x54')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x255d7c,null))[_0xe6ed('0x1f')](saveUpdates(_0x399e07['body'],null))[_0xe6ed('0x1f')](respondWithResult(_0x255d7c,null))['catch'](handleError(_0x255d7c,null));};exports[_0xe6ed('0x34')]=function(_0x22966b,_0x55ceab){return db[_0xe6ed('0x39')]['find']({'where':{'id':_0x22966b['params']['id']}})['then'](handleEntityNotFound(_0x55ceab,null))[_0xe6ed('0x1f')](removeEntity(_0x55ceab,null))['catch'](handleError(_0x55ceab,null));};exports[_0xe6ed('0x55')]=function(_0x352d1e,_0xd0b09f,_0x5898c4){var _0x577da6={};var _0x1d8751={};var _0x27731b;var _0x3dfe5a;return db[_0xe6ed('0x39')][_0xe6ed('0x56')]({'where':{'id':_0x352d1e[_0xe6ed('0x54')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0xd0b09f,null))[_0xe6ed('0x1f')](function(_0x57e4b6){if(_0x57e4b6){_0x27731b=_0x57e4b6;_0x1d8751['model']=_[_0xe6ed('0x3f')](db['DeskConfiguration'][_0xe6ed('0x3a')]);_0x1d8751[_0xe6ed('0x3e')]=_['keys'](_0x352d1e[_0xe6ed('0x3e')]);_0x1d8751[_0xe6ed('0x48')]=_[_0xe6ed('0x40')](_0x1d8751[_0xe6ed('0x3d')],_0x1d8751[_0xe6ed('0x3e')]);_0x577da6[_0xe6ed('0x42')]=_['intersection'](_0x1d8751['model'],qs[_0xe6ed('0x41')](_0x352d1e[_0xe6ed('0x3e')][_0xe6ed('0x41')]));_0x577da6['attributes']=_0x577da6[_0xe6ed('0x42')][_0xe6ed('0x57')]?_0x577da6[_0xe6ed('0x42')]:_0x1d8751[_0xe6ed('0x3d')];_0x577da6[_0xe6ed('0x44')]=qs[_0xe6ed('0x45')](_0x352d1e[_0xe6ed('0x3e')][_0xe6ed('0x45')]);_0x577da6[_0xe6ed('0x46')]=qs[_0xe6ed('0x48')](_[_0xe6ed('0x47')](_0x352d1e[_0xe6ed('0x3e')],_0x1d8751['filters']));if(_0x352d1e[_0xe6ed('0x3e')][_0xe6ed('0x49')]){_0x577da6[_0xe6ed('0x46')]=_[_0xe6ed('0x4a')](_0x577da6[_0xe6ed('0x46')],{'$or':_[_0xe6ed('0x38')](_0x577da6['attributes'],function(_0xf42e76){var _0x498b7f={};_0x498b7f[_0xf42e76]={'$like':'%'+_0x352d1e['query']['filter']+'%'};return _0x498b7f;})});}_0x577da6=_['merge']({},_0x577da6,_0x352d1e[_0xe6ed('0x4d')]);return _0x27731b[_0xe6ed('0x55')](_0x577da6);}})[_0xe6ed('0x1f')](function(_0x2c5152){if(_0x2c5152){_0x3dfe5a=_0x2c5152[_0xe6ed('0x57')];if(!_0x352d1e['query']['hasOwnProperty'](_0xe6ed('0x43'))){_0x577da6[_0xe6ed('0x2d')]=qs['limit'](_0x352d1e['query']['limit']);_0x577da6[_0xe6ed('0x2c')]=qs[_0xe6ed('0x2c')](_0x352d1e[_0xe6ed('0x3e')][_0xe6ed('0x2c')]);}return _0x27731b['getConfigurations'](_0x577da6);}})['then'](function(_0x349e42){if(_0x349e42){return _0x349e42?{'count':_0x3dfe5a,'rows':_0x349e42}:null;}})['then'](respondWithResult(_0xd0b09f,null))[_0xe6ed('0x28')](handleError(_0xd0b09f,null));};exports[_0xe6ed('0x58')]=function(_0x30f28d,_0x285ecc,_0x583752){if(_0x30f28d[_0xe6ed('0x52')]['id']){delete _0x30f28d[_0xe6ed('0x52')]['id'];}return db['DeskAccount'][_0xe6ed('0x56')]({'where':{'id':_0x30f28d[_0xe6ed('0x54')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x285ecc,null))[_0xe6ed('0x1f')](function(_0x5ac310){if(_0x5ac310){_0x30f28d['body'][_0xe6ed('0x59')]=_0x5ac310['id'];_0x30f28d[_0xe6ed('0x52')][_0xe6ed('0x5a')]=integrations[_0xe6ed('0x5b')](_0x30f28d['body'][_0xe6ed('0x5c')],_0x30f28d['body'][_0xe6ed('0x4b')]);_0x30f28d[_0xe6ed('0x52')][_0xe6ed('0x5d')]=integrations[_0xe6ed('0x5e')](_0x30f28d[_0xe6ed('0x52')]['channel'],_0x30f28d['body'][_0xe6ed('0x4b')]);return db[_0xe6ed('0x5f')][_0xe6ed('0x51')](_0x30f28d[_0xe6ed('0x52')],{'include':[{'model':db[_0xe6ed('0x60')],'as':_0xe6ed('0x5a')},{'model':db[_0xe6ed('0x60')],'as':_0xe6ed('0x5d')}]});}return null;})[_0xe6ed('0x1f')](respondWithResult(_0x285ecc,null))[_0xe6ed('0x28')](handleError(_0x285ecc,null));};exports[_0xe6ed('0x61')]=function(_0x418304,_0x21c98f,_0xdf501b){var _0x22d524=[{'name':_0xe6ed('0x62'),'label':_0xe6ed('0x62'),'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 _0xde5e39='';return db[_0xe6ed('0x39')][_0xe6ed('0x56')]({'where':{'id':_0x418304[_0xe6ed('0x54')]['id']},'attributes':['id','remoteUri',_0xe6ed('0x63'),_0xe6ed('0x64'),_0xe6ed('0x65'),'consumerKey',_0xe6ed('0x66'),_0xe6ed('0x67'),'tokenSecret']})[_0xe6ed('0x1f')](handleEntityNotFound(_0x21c98f,null))[_0xe6ed('0x1f')](function(_0x2ec371){if(_0x2ec371){_0xde5e39=_0x2ec371[_0xe6ed('0x68')];var _0x28b710=_0xde5e39['slice'](-0x1);if(_0x28b710==='/'){_0xde5e39=_0xde5e39['substring'](0x0,_0xde5e39[_0xe6ed('0x69')](_0x28b710));}var _0x2c3d40={'method':_0xe6ed('0x6a'),'uri':util['format'](_0xe6ed('0x6b'),_0xde5e39),'headers':{'Content-Type':_0xe6ed('0x6c'),'Accept':_0xe6ed('0x6c')},'json':!![]};if(_0x2ec371[_0xe6ed('0x63')]===_0xe6ed('0x6d')){_0x2c3d40[_0xe6ed('0x6e')][_0xe6ed('0x6f')]=util[_0xe6ed('0x70')](_0xe6ed('0x71'),new Buffer(util[_0xe6ed('0x70')](_0xe6ed('0x72'),_0x2ec371[_0xe6ed('0x64')],_0x2ec371[_0xe6ed('0x65')]))[_0xe6ed('0x73')](_0xe6ed('0x74')));}return rp(_0x2c3d40)[_0xe6ed('0x1f')](function(_0x1e9f6b){return _0x22d524[_0xe6ed('0x75')](_[_0xe6ed('0x38')](_0x1e9f6b[_0xe6ed('0x76')][_0xe6ed('0x77')],function(_0x4ddf67){return{'id':_0x4ddf67[_0xe6ed('0x36')],'name':_0x4ddf67[_0xe6ed('0x36')],'type':_0x4ddf67[_0xe6ed('0x4b')],'active':_0x4ddf67[_0xe6ed('0x78')],'label':_0x4ddf67['label'],'custom':!![]};}));});}})[_0xe6ed('0x1f')](function(_0x5a01a3){return{'count':_0x5a01a3[_0xe6ed('0x57')],'rows':_0x5a01a3};})[_0xe6ed('0x1f')](respondWithResult(_0x21c98f,null))[_0xe6ed('0x28')](function(_0x2c12b5){var _0x40ed55=_0x418304[_0xe6ed('0x3e')]['test']?0x1f4:_0x2c12b5[_0xe6ed('0x79')]||0x1f4;logger[_0xe6ed('0x24')](_0xe6ed('0x7a'),_0xe6ed('0x61'),_0x40ed55,JSON[_0xe6ed('0x7b')](_0x2c12b5));delete _0x2c12b5[_0xe6ed('0x36')];if(_0x40ed55===0x191){_0x40ed55=0x190;}_0x21c98f[_0xe6ed('0x29')](_0x40ed55)[_0xe6ed('0x37')](_0x418304[_0xe6ed('0x3e')]['test']?{'message':_0xe6ed('0x7c'),'statusCode':_0x2c12b5[_0xe6ed('0x79')]}:_0x2c12b5);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ee08dbc..b86033e 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 _0x0625=['exports','define','DeskAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x48774d,_0x3aff88){var _0x3e5a11=function(_0x1b4224){while(--_0x1b4224){_0x48774d['push'](_0x48774d['shift']());}};_0x3e5a11(++_0x3aff88);}(_0x0625,0xac));var _0x5062=function(_0x2cb47f,_0x94c39a){_0x2cb47f=_0x2cb47f-0x0;var _0x5a21ce=_0x0625[_0x2cb47f];return _0x5a21ce;};'use strict';var _=require('lodash');var util=require(_0x5062('0x0'));var logger=require(_0x5062('0x1'))(_0x5062('0x2'));var moment=require(_0x5062('0x3'));var BPromise=require(_0x5062('0x4'));var rp=require(_0x5062('0x5'));var fs=require('fs');var path=require(_0x5062('0x6'));var rimraf=require('rimraf');var config=require(_0x5062('0x7'));var attributes=require(_0x5062('0x8'));var integrations=require(_0x5062('0x9'));module[_0x5062('0xa')]=function(_0xd2f24,_0x1e3ef3){return _0xd2f24[_0x5062('0xb')](_0x5062('0xc'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b5b=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x50b415,_0x499cfd){var _0x4c4a0d=function(_0x2cd195){while(--_0x2cd195){_0x50b415['push'](_0x50b415['shift']());}};_0x4c4a0d(++_0x499cfd);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x438092,_0x2194dc){_0x438092=_0x438092-0x0;var _0x4ea8ab=_0x7b5b[_0x438092];return _0x4ea8ab;};'use strict';var _=require('lodash');var util=require(_0xb7b5('0x0'));var logger=require(_0xb7b5('0x1'))(_0xb7b5('0x2'));var moment=require(_0xb7b5('0x3'));var BPromise=require(_0xb7b5('0x4'));var rp=require(_0xb7b5('0x5'));var fs=require('fs');var path=require(_0xb7b5('0x6'));var rimraf=require(_0xb7b5('0x7'));var config=require(_0xb7b5('0x8'));var attributes=require(_0xb7b5('0x9'));var integrations=require(_0xb7b5('0xa'));module[_0xb7b5('0xb')]=function(_0x2f8a37,_0x21a157){return _0x2f8a37['define']('DeskAccount',attributes,{'tableName':_0xb7b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ca9f387..7bd1428 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 _0x65b8=['request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowDeskAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x2591e3,_0x36fb69){var _0xd8b248=function(_0x3971e1){while(--_0x3971e1){_0x2591e3['push'](_0x2591e3['shift']());}};_0xd8b248(++_0x36fb69);}(_0x65b8,0x7f));var _0x865b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x65b8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x865b('0x0'));var util=require('util');var moment=require(_0x865b('0x1'));var BPromise=require('bluebird');var rs=require(_0x865b('0x2'));var fs=require('fs');var Redis=require(_0x865b('0x3'));var db=require(_0x865b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x865b('0x5'));var config=require(_0x865b('0x6'));var jayson=require(_0x865b('0x7'));var client=jayson[_0x865b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169200,_0x2e9c26,_0x43927c){return new BPromise(function(_0x5f304c,_0x54bd7d){return client[_0x865b('0x9')](_0x169200,_0x43927c)[_0x865b('0xa')](function(_0x212b6a){logger[_0x865b('0xb')](_0x865b('0xc'),_0x2e9c26,_0x865b('0xd'));logger['debug'](_0x865b('0xe'),_0x2e9c26,_0x865b('0xd'),JSON[_0x865b('0xf')](_0x212b6a));if(_0x212b6a['error']){if(_0x212b6a[_0x865b('0x10')]['code']===0x1f4){logger[_0x865b('0x10')]('DeskAccount,\x20%s,\x20%s',_0x2e9c26,_0x212b6a[_0x865b('0x10')][_0x865b('0x11')]);return _0x54bd7d(_0x212b6a[_0x865b('0x10')][_0x865b('0x11')]);}logger['error'](_0x865b('0xc'),_0x2e9c26,_0x212b6a[_0x865b('0x10')][_0x865b('0x11')]);return _0x5f304c(_0x212b6a['error']['message']);}else{logger[_0x865b('0xb')]('DeskAccount,\x20%s,\x20%s',_0x2e9c26,'request\x20sent');_0x5f304c(_0x212b6a[_0x865b('0x12')]['message']);}})[_0x865b('0x13')](function(_0x23cdd3){logger[_0x865b('0x10')](_0x865b('0xc'),_0x2e9c26,_0x23cdd3);_0x54bd7d(_0x23cdd3);});});}exports[_0x865b('0x14')]=function(_0x382106){var _0x3f9b0d=this;return new Promise(function(_0x2bae2f,_0x558b87){return db[_0x865b('0x15')][_0x865b('0x16')]({'raw':_0x382106[_0x865b('0x17')]?_0x382106[_0x865b('0x17')][_0x865b('0x18')]===undefined?!![]:![]:!![],'where':_0x382106[_0x865b('0x17')]?_0x382106[_0x865b('0x17')][_0x865b('0x19')]||null:null,'attributes':_0x382106[_0x865b('0x17')]?_0x382106[_0x865b('0x17')][_0x865b('0x1a')]||null:null,'limit':_0x382106[_0x865b('0x17')]?_0x382106[_0x865b('0x17')][_0x865b('0x1b')]||null:null,'include':_0x382106[_0x865b('0x17')]?_0x382106[_0x865b('0x17')]['include']?_[_0x865b('0x1c')](_0x382106['options']['include'],function(_0x333b85){return{'model':db[_0x333b85[_0x865b('0x1d')]],'as':_0x333b85['as'],'attributes':_0x333b85['attributes'],'include':_0x333b85[_0x865b('0x1e')]?_['map'](_0x333b85['include'],function(_0x5f01ff){return{'model':db[_0x5f01ff[_0x865b('0x1d')]],'as':_0x5f01ff['as'],'attributes':_0x5f01ff['attributes'],'include':_0x5f01ff[_0x865b('0x1e')]?_[_0x865b('0x1c')](_0x5f01ff['include'],function(_0x86a018){return{'model':db[_0x86a018[_0x865b('0x1d')]],'as':_0x86a018['as'],'attributes':_0x86a018[_0x865b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x865b('0xa')](function(_0x27227c){logger[_0x865b('0xb')](_0x865b('0x14'),_0x382106);logger['debug'](_0x865b('0x14'),_0x382106,JSON[_0x865b('0xf')](_0x27227c));_0x2bae2f(_0x27227c);})[_0x865b('0x13')](function(_0x221133){logger[_0x865b('0x10')](_0x865b('0x14'),_0x221133[_0x865b('0x11')],_0x382106);_0x558b87(_0x3f9b0d[_0x865b('0x10')](0x1f4,_0x221133['message']));});});};exports[_0x865b('0x1f')]=function(_0x1f5b49){var _0x4be639=this;return new Promise(function(_0x51297c,_0x364318){return db[_0x865b('0x15')][_0x865b('0x20')]({'raw':_0x1f5b49[_0x865b('0x17')]?_0x1f5b49['options'][_0x865b('0x18')]===undefined?!![]:![]:!![],'where':_0x1f5b49[_0x865b('0x17')]?_0x1f5b49[_0x865b('0x17')][_0x865b('0x19')]||null:null,'attributes':_0x1f5b49[_0x865b('0x17')]?_0x1f5b49[_0x865b('0x17')][_0x865b('0x1a')]||null:null,'include':_0x1f5b49[_0x865b('0x17')]?_0x1f5b49[_0x865b('0x17')]['include']?_[_0x865b('0x1c')](_0x1f5b49[_0x865b('0x17')][_0x865b('0x1e')],function(_0x41cc8a){return{'model':db[_0x41cc8a[_0x865b('0x1d')]],'as':_0x41cc8a['as'],'attributes':_0x41cc8a[_0x865b('0x1a')],'include':_0x41cc8a['include']?_[_0x865b('0x1c')](_0x41cc8a[_0x865b('0x1e')],function(_0x30ecb9){return{'model':db[_0x30ecb9[_0x865b('0x1d')]],'as':_0x30ecb9['as'],'attributes':_0x30ecb9[_0x865b('0x1a')],'include':_0x30ecb9[_0x865b('0x1e')]?_[_0x865b('0x1c')](_0x30ecb9['include'],function(_0x2b93c6){return{'model':db[_0x2b93c6['model']],'as':_0x2b93c6['as'],'attributes':_0x2b93c6[_0x865b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x865b('0xa')](function(_0x4e100c){logger['info']('ShowDeskAccount',_0x1f5b49);logger[_0x865b('0x21')]('ShowDeskAccount',_0x1f5b49,JSON[_0x865b('0xf')](_0x4e100c));_0x51297c(_0x4e100c);})[_0x865b('0x13')](function(_0x5ce1f6){logger[_0x865b('0x10')]('ShowDeskAccount',_0x5ce1f6[_0x865b('0x11')],_0x1f5b49);_0x364318(_0x4be639[_0x865b('0x10')](0x1f4,_0x5ce1f6['message']));});});}; \ No newline at end of file +var _0x69c5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','model','map','info','debug','raw','where','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e4ce0,_0x8cbdd5){var _0x9db676=function(_0x4c4e49){while(--_0x4c4e49){_0x4e4ce0['push'](_0x4e4ce0['shift']());}};_0x9db676(++_0x8cbdd5);}(_0x69c5,0x16b));var _0x569c=function(_0x1f0c3a,_0x1e5fed){_0x1f0c3a=_0x1f0c3a-0x0;var _0x1fffc2=_0x69c5[_0x1f0c3a];return _0x1fffc2;};'use strict';var _=require(_0x569c('0x0'));var util=require(_0x569c('0x1'));var moment=require(_0x569c('0x2'));var BPromise=require(_0x569c('0x3'));var rs=require(_0x569c('0x4'));var fs=require('fs');var Redis=require(_0x569c('0x5'));var db=require(_0x569c('0x6'))['db'];var utils=require(_0x569c('0x7'));var logger=require(_0x569c('0x8'))(_0x569c('0x9'));var config=require(_0x569c('0xa'));var jayson=require(_0x569c('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ce9ad,_0x59dd46,_0x22ab5a){return new BPromise(function(_0x58ca48,_0x376dc2){return client[_0x569c('0xc')](_0x4ce9ad,_0x22ab5a)[_0x569c('0xd')](function(_0x248170){logger['info']('DeskAccount,\x20%s,\x20%s',_0x59dd46,_0x569c('0xe'));logger['debug'](_0x569c('0xf'),_0x59dd46,'request\x20sent',JSON[_0x569c('0x10')](_0x248170));if(_0x248170['error']){if(_0x248170[_0x569c('0x11')][_0x569c('0x12')]===0x1f4){logger[_0x569c('0x11')]('DeskAccount,\x20%s,\x20%s',_0x59dd46,_0x248170[_0x569c('0x11')][_0x569c('0x13')]);return _0x376dc2(_0x248170['error']['message']);}logger[_0x569c('0x11')](_0x569c('0x14'),_0x59dd46,_0x248170['error'][_0x569c('0x13')]);return _0x58ca48(_0x248170[_0x569c('0x11')][_0x569c('0x13')]);}else{logger['info'](_0x569c('0x14'),_0x59dd46,_0x569c('0xe'));_0x58ca48(_0x248170[_0x569c('0x15')][_0x569c('0x13')]);}})[_0x569c('0x16')](function(_0x9bcfe4){logger[_0x569c('0x11')](_0x569c('0x14'),_0x59dd46,_0x9bcfe4);_0x376dc2(_0x9bcfe4);});});}exports[_0x569c('0x17')]=function(_0x5d5774){var _0x2c7d3a=this;return new Promise(function(_0x3603b6,_0x425415){return db[_0x569c('0x18')][_0x569c('0x19')]({'raw':_0x5d5774[_0x569c('0x1a')]?_0x5d5774[_0x569c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5d5774[_0x569c('0x1a')]?_0x5d5774[_0x569c('0x1a')]['where']||null:null,'attributes':_0x5d5774[_0x569c('0x1a')]?_0x5d5774['options'][_0x569c('0x1b')]||null:null,'limit':_0x5d5774[_0x569c('0x1a')]?_0x5d5774[_0x569c('0x1a')][_0x569c('0x1c')]||null:null,'include':_0x5d5774['options']?_0x5d5774[_0x569c('0x1a')][_0x569c('0x1d')]?_['map'](_0x5d5774['options'][_0x569c('0x1d')],function(_0x384e51){return{'model':db[_0x384e51[_0x569c('0x1e')]],'as':_0x384e51['as'],'attributes':_0x384e51[_0x569c('0x1b')],'include':_0x384e51[_0x569c('0x1d')]?_[_0x569c('0x1f')](_0x384e51[_0x569c('0x1d')],function(_0x376efd){return{'model':db[_0x376efd[_0x569c('0x1e')]],'as':_0x376efd['as'],'attributes':_0x376efd['attributes'],'include':_0x376efd['include']?_[_0x569c('0x1f')](_0x376efd[_0x569c('0x1d')],function(_0x51cbe9){return{'model':db[_0x51cbe9[_0x569c('0x1e')]],'as':_0x51cbe9['as'],'attributes':_0x51cbe9[_0x569c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x569c('0xd')](function(_0x3c16cb){logger[_0x569c('0x20')](_0x569c('0x17'),_0x5d5774);logger[_0x569c('0x21')](_0x569c('0x17'),_0x5d5774,JSON[_0x569c('0x10')](_0x3c16cb));_0x3603b6(_0x3c16cb);})[_0x569c('0x16')](function(_0x4c303f){logger[_0x569c('0x11')](_0x569c('0x17'),_0x4c303f[_0x569c('0x13')],_0x5d5774);_0x425415(_0x2c7d3a[_0x569c('0x11')](0x1f4,_0x4c303f[_0x569c('0x13')]));});});};exports['ShowDeskAccount']=function(_0x1ec053){var _0xf10035=this;return new Promise(function(_0x28f64a,_0x142922){return db[_0x569c('0x18')]['find']({'raw':_0x1ec053['options']?_0x1ec053[_0x569c('0x1a')][_0x569c('0x22')]===undefined?!![]:![]:!![],'where':_0x1ec053[_0x569c('0x1a')]?_0x1ec053[_0x569c('0x1a')][_0x569c('0x23')]||null:null,'attributes':_0x1ec053[_0x569c('0x1a')]?_0x1ec053[_0x569c('0x1a')][_0x569c('0x1b')]||null:null,'include':_0x1ec053['options']?_0x1ec053[_0x569c('0x1a')][_0x569c('0x1d')]?_[_0x569c('0x1f')](_0x1ec053['options']['include'],function(_0x2ae967){return{'model':db[_0x2ae967[_0x569c('0x1e')]],'as':_0x2ae967['as'],'attributes':_0x2ae967[_0x569c('0x1b')],'include':_0x2ae967[_0x569c('0x1d')]?_[_0x569c('0x1f')](_0x2ae967[_0x569c('0x1d')],function(_0x7f8ca3){return{'model':db[_0x7f8ca3[_0x569c('0x1e')]],'as':_0x7f8ca3['as'],'attributes':_0x7f8ca3[_0x569c('0x1b')],'include':_0x7f8ca3[_0x569c('0x1d')]?_[_0x569c('0x1f')](_0x7f8ca3[_0x569c('0x1d')],function(_0x3595a9){return{'model':db[_0x3595a9[_0x569c('0x1e')]],'as':_0x3595a9['as'],'attributes':_0x3595a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6bb4){logger[_0x569c('0x20')]('ShowDeskAccount',_0x1ec053);logger['debug'](_0x569c('0x24'),_0x1ec053,JSON[_0x569c('0x10')](_0x3a6bb4));_0x28f64a(_0x3a6bb4);})[_0x569c('0x16')](function(_0x2edb6a){logger[_0x569c('0x11')]('ShowDeskAccount',_0x2edb6a[_0x569c('0x13')],_0x1ec053);_0x142922(_0xf10035[_0x569c('0x11')](0x1f4,_0x2edb6a[_0x569c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8bb1389..8212f00 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 _0x8a21=['index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated'];(function(_0x27353d,_0x107af7){var _0x50de29=function(_0x11ab70){while(--_0x11ab70){_0x27353d['push'](_0x27353d['shift']());}};_0x50de29(++_0x107af7);}(_0x8a21,0x1d8));var _0x18a2=function(_0x392407,_0x3c283a){_0x392407=_0x392407-0x0;var _0x2b08a4=_0x8a21[_0x392407];return _0x2b08a4;};'use strict';var multer=require(_0x18a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x18a2('0x1'));var express=require(_0x18a2('0x2'));var router=express[_0x18a2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18a2('0x4'));var controller=require(_0x18a2('0x5'));router[_0x18a2('0x6')]('/',auth[_0x18a2('0x7')](),controller[_0x18a2('0x8')]);router[_0x18a2('0x6')](_0x18a2('0x9'),auth[_0x18a2('0x7')](),controller['show']);router[_0x18a2('0x6')](_0x18a2('0xa'),auth[_0x18a2('0x7')](),controller['getFields']);router[_0x18a2('0x6')](_0x18a2('0xb'),auth[_0x18a2('0x7')](),controller[_0x18a2('0xc')]);router[_0x18a2('0x6')]('/:id/descriptions',auth[_0x18a2('0x7')](),controller[_0x18a2('0xd')]);router['get'](_0x18a2('0xe'),auth[_0x18a2('0x7')](),controller['getTags']);router[_0x18a2('0xf')]('/',auth[_0x18a2('0x7')](),controller['create']);router[_0x18a2('0xf')](_0x18a2('0xe'),auth[_0x18a2('0x7')](),controller[_0x18a2('0x10')]);router['put']('/:id',auth[_0x18a2('0x7')](),controller['update']);router[_0x18a2('0x11')]('/:id',auth[_0x18a2('0x7')](),controller[_0x18a2('0x12')]);module[_0x18a2('0x13')]=router; \ No newline at end of file +var _0x19fb=['connect-timeout','express','Router','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa8bddd,_0x410a04){var _0x1e60fe=function(_0x56ecc9){while(--_0x56ecc9){_0xa8bddd['push'](_0xa8bddd['shift']());}};_0x1e60fe(++_0x410a04);}(_0x19fb,0xdd));var _0xb19f=function(_0x19fd7e,_0x28ee18){_0x19fd7e=_0x19fd7e-0x0;var _0x1f021e=_0x19fb[_0x19fd7e];return _0x1f021e;};'use strict';var multer=require(_0xb19f('0x0'));var util=require(_0xb19f('0x1'));var path=require(_0xb19f('0x2'));var timeout=require(_0xb19f('0x3'));var express=require(_0xb19f('0x4'));var router=express[_0xb19f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb19f('0x6'));var controller=require(_0xb19f('0x7'));router[_0xb19f('0x8')]('/',auth[_0xb19f('0x9')](),controller[_0xb19f('0xa')]);router['get'](_0xb19f('0xb'),auth[_0xb19f('0x9')](),controller[_0xb19f('0xc')]);router[_0xb19f('0x8')](_0xb19f('0xd'),auth[_0xb19f('0x9')](),controller[_0xb19f('0xe')]);router[_0xb19f('0x8')]('/:id/subjects',auth[_0xb19f('0x9')](),controller[_0xb19f('0xf')]);router[_0xb19f('0x8')](_0xb19f('0x10'),auth[_0xb19f('0x9')](),controller[_0xb19f('0x11')]);router[_0xb19f('0x8')](_0xb19f('0x12'),auth[_0xb19f('0x9')](),controller[_0xb19f('0x13')]);router[_0xb19f('0x14')]('/',auth[_0xb19f('0x9')](),controller[_0xb19f('0x15')]);router[_0xb19f('0x14')](_0xb19f('0x12'),auth['isAuthenticated'](),controller[_0xb19f('0x16')]);router[_0xb19f('0x17')](_0xb19f('0xb'),auth['isAuthenticated'](),controller[_0xb19f('0x18')]);router[_0xb19f('0x19')](_0xb19f('0xb'),auth['isAuthenticated'](),controller[_0xb19f('0x1a')]);module[_0xb19f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cd3fade..3457e64 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 _0x4d59=['sequelize','STRING'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x4d59,0x1d0));var _0x94d5=function(_0x31f74d,_0x5924af){_0x31f74d=_0x31f74d-0x0;var _0x135c9b=_0x4d59[_0x31f74d];return _0x135c9b;};'use strict';var Sequelize=require(_0x94d5('0x0'));module['exports']={'name':{'type':Sequelize[_0x94d5('0x1')]},'description':{'type':Sequelize[_0x94d5('0x1')]}}; \ No newline at end of file +var _0x04fa=['sequelize','STRING'];(function(_0x33b6f1,_0x379380){var _0x34a536=function(_0x251960){while(--_0x251960){_0x33b6f1['push'](_0x33b6f1['shift']());}};_0x34a536(++_0x379380);}(_0x04fa,0x1ae));var _0xa04f=function(_0x1b3a6c,_0x5bfeef){_0x1b3a6c=_0x1b3a6c-0x0;var _0x5636e7=_0x04fa[_0x1b3a6c];return _0x5636e7;};'use strict';var Sequelize=require(_0xa04f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa04f('0x1')]},'description':{'type':Sequelize[_0xa04f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b89e991..ce77a63 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 _0x5447=['query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','merge','where','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body','findOne','DeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','index','DeskConfiguration','fieldName','key','map'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x5447,0xf1));var _0x7544=function(_0x3f2a7,_0x18d434){_0x3f2a7=_0x3f2a7-0x0;var _0x3fbb61=_0x5447[_0x3f2a7];return _0x3fbb61;};'use strict';var pdf=require(_0x7544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7544('0x1'));var zipdir=require(_0x7544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7544('0x3'));var moment=require('moment');var BPromise=require(_0x7544('0x4'));var Mustache=require(_0x7544('0x5'));var util=require(_0x7544('0x6'));var path=require(_0x7544('0x7'));var sox=require(_0x7544('0x8'));var csv=require(_0x7544('0x9'));var ejs=require(_0x7544('0xa'));var fs=require('fs');var _=require(_0x7544('0xb'));var squel=require(_0x7544('0xc'));var crypto=require(_0x7544('0xd'));var jsforce=require(_0x7544('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7544('0x9'));var querystring=require(_0x7544('0xf'));var Papa=require(_0x7544('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7544('0x11'));var hardwareService=require(_0x7544('0x12'));var logger=require(_0x7544('0x13'))(_0x7544('0x14'));var utils=require(_0x7544('0x15'));var config=require(_0x7544('0x16'));var db=require(_0x7544('0x17'))['db'];var jayson=require(_0x7544('0x18'));var client=jayson[_0x7544('0x19')][_0x7544('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5e48e4,_0x473444,_0x49c6a2){if(_0x49c6a2){var _0x325357=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x325357[_0x7544('0x1b')](_0x473444)){return _0x5e48e4;}else{throw new db['Sequelize'][(_0x7544('0x1c'))](_0x7544('0x1d'));}}else{return _0x5e48e4;}}function respondWithRpcPromise(_0x362e08,_0x250903,_0xcee864,_0x3808e2){return new BPromise(function(_0x25cc23,_0x36582a){var _0x592a6c=_0x3808e2||client;return _0x592a6c[_0x7544('0x1e')](_0x362e08,_0xcee864)[_0x7544('0x1f')](function(_0x4916cc){logger[_0x7544('0x20')](_0x7544('0x21'),_0x250903,'request\x20sent');logger[_0x7544('0x22')](_0x7544('0x23'),_0x250903,_0x7544('0x24'),JSON[_0x7544('0x25')](_0x4916cc));if(_0x4916cc[_0x7544('0x26')]){if(_0x4916cc[_0x7544('0x26')][_0x7544('0x27')]===0x1f4){logger[_0x7544('0x26')](_0x7544('0x21'),_0x250903,_0x4916cc[_0x7544('0x26')][_0x7544('0x28')]);return _0x36582a(_0x4916cc[_0x7544('0x26')][_0x7544('0x28')]);}logger[_0x7544('0x26')](_0x7544('0x21'),_0x250903,_0x4916cc[_0x7544('0x26')][_0x7544('0x28')]);return _0x25cc23(_0x4916cc[_0x7544('0x26')][_0x7544('0x28')]);}else{logger[_0x7544('0x20')](_0x7544('0x21'),_0x250903,_0x7544('0x24'));_0x25cc23(_0x4916cc[_0x7544('0x29')][_0x7544('0x28')]);}})[_0x7544('0x2a')](function(_0x34d7b8){logger[_0x7544('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x250903,_0x34d7b8);_0x36582a(_0x34d7b8);});});}function respondWithStatusCode(_0x133a01,_0x24a086){_0x24a086=_0x24a086||0xcc;return function(_0x97f74){if(_0x97f74){return _0x133a01['sendStatus'](_0x24a086);}return _0x133a01[_0x7544('0x2b')](_0x24a086)['end']();};}function respondWithResult(_0x548ce9,_0x1be6a5){_0x1be6a5=_0x1be6a5||0xc8;return function(_0xd584e){if(_0xd584e){return _0x548ce9[_0x7544('0x2b')](_0x1be6a5)[_0x7544('0x2c')](_0xd584e);}};}function respondWithFilteredResult(_0x46a415,_0x4fb8a3){return function(_0x1d9508){if(_0x1d9508){var _0x130ae0=_0x1d9508[_0x7544('0x2d')],_0x22616c=_0x4fb8a3[_0x7544('0x2e')],_0x2004d6=_0x4fb8a3[_0x7544('0x2e')]+_0x4fb8a3['limit'],_0x489506;if(_0x2004d6>=_0x130ae0){_0x2004d6=_0x130ae0;_0x489506=0xc8;}else{_0x489506=0xce;}_0x46a415[_0x7544('0x2b')](_0x489506);return _0x46a415['set'](_0x7544('0x2f'),_0x22616c+'-'+_0x2004d6+'/'+_0x130ae0)[_0x7544('0x2c')](_0x1d9508);}return null;};}function patchUpdates(_0x512fc7){return function(_0x395c6e){try{jsonpatch[_0x7544('0x30')](_0x395c6e,_0x512fc7,!![]);}catch(_0x39c387){return BPromise[_0x7544('0x31')](_0x39c387);}return _0x395c6e[_0x7544('0x32')]();};}function saveUpdates(_0x4b1fb5,_0x39852a){return function(_0x4097cf){if(_0x4097cf){return _0x4097cf[_0x7544('0x33')](_0x4b1fb5)[_0x7544('0x1f')](function(_0x569d29){return _0x569d29;});}return null;};}function removeEntity(_0x17213b,_0x325554){return function(_0xd9893){if(_0xd9893){return _0xd9893[_0x7544('0x34')]()[_0x7544('0x1f')](function(){_0x17213b['status'](0xcc)[_0x7544('0x35')]();});}};}function handleEntityNotFound(_0x31b6f9,_0x2d3f44){return function(_0x4d18bb){if(!_0x4d18bb){_0x31b6f9[_0x7544('0x36')](0x194);}return _0x4d18bb;};}function handleError(_0x41ff45,_0x4afcf8){_0x4afcf8=_0x4afcf8||0x1f4;return function(_0x4ff851){logger[_0x7544('0x26')](_0x4ff851[_0x7544('0x37')]);if(_0x4ff851['name']){delete _0x4ff851[_0x7544('0x38')];}_0x41ff45['status'](_0x4afcf8)['send'](_0x4ff851);};}exports[_0x7544('0x39')]=function(_0x594713,_0x1c8392){var _0x3679de={},_0x52b0da={},_0x7c0c3e={'count':0x0,'rows':[]};var _0x5a78eb=_['map'](db[_0x7544('0x3a')]['rawAttributes'],function(_0x266005){return{'name':_0x266005[_0x7544('0x3b')],'type':_0x266005['type'][_0x7544('0x3c')]};});_0x52b0da['model']=_[_0x7544('0x3d')](_0x5a78eb,_0x7544('0x38'));_0x52b0da[_0x7544('0x3e')]=_['keys'](_0x594713[_0x7544('0x3e')]);_0x52b0da['filters']=_['intersection'](_0x52b0da[_0x7544('0x3f')],_0x52b0da[_0x7544('0x3e')]);_0x3679de[_0x7544('0x40')]=_[_0x7544('0x41')](_0x52b0da[_0x7544('0x3f')],qs[_0x7544('0x42')](_0x594713['query'][_0x7544('0x42')]));_0x3679de[_0x7544('0x40')]=_0x3679de[_0x7544('0x40')][_0x7544('0x43')]?_0x3679de['attributes']:_0x52b0da[_0x7544('0x3f')];if(!_0x594713[_0x7544('0x3e')][_0x7544('0x44')](_0x7544('0x45'))){_0x3679de[_0x7544('0x46')]=qs[_0x7544('0x46')](_0x594713[_0x7544('0x3e')][_0x7544('0x46')]);_0x3679de['offset']=qs['offset'](_0x594713[_0x7544('0x3e')][_0x7544('0x2e')]);}_0x3679de[_0x7544('0x47')]=qs[_0x7544('0x48')](_0x594713[_0x7544('0x3e')][_0x7544('0x48')]);_0x3679de['where']=qs['filters'](_[_0x7544('0x49')](_0x594713[_0x7544('0x3e')],_0x52b0da[_0x7544('0x4a')]),_0x5a78eb);if(_0x594713[_0x7544('0x3e')]['filter']){_0x3679de['where']=_[_0x7544('0x4b')](_0x3679de[_0x7544('0x4c')],{'$or':_[_0x7544('0x3d')](_0x5a78eb,function(_0xb9f648){if(_0xb9f648[_0x7544('0x4d')]!==_0x7544('0x4e')){var _0x5e2619={};_0x5e2619[_0xb9f648[_0x7544('0x38')]]={'$like':'%'+_0x594713['query'][_0x7544('0x4f')]+'%'};return _0x5e2619;}})});}_0x3679de=_[_0x7544('0x4b')]({},_0x3679de,_0x594713[_0x7544('0x50')]);var _0x54ad11={'where':_0x3679de['where']};return db[_0x7544('0x3a')]['count'](_0x54ad11)[_0x7544('0x1f')](function(_0x2d71c5){_0x7c0c3e[_0x7544('0x2d')]=_0x2d71c5;if(_0x594713[_0x7544('0x3e')][_0x7544('0x51')]){_0x3679de['include']=[{'all':!![]}];}return db[_0x7544('0x3a')][_0x7544('0x52')](_0x3679de);})[_0x7544('0x1f')](function(_0xfc65c2){_0x7c0c3e[_0x7544('0x53')]=_0xfc65c2;return _0x7c0c3e;})['then'](respondWithFilteredResult(_0x1c8392,_0x3679de))[_0x7544('0x2a')](handleError(_0x1c8392,null));};exports[_0x7544('0x54')]=function(_0x5f4f7c,_0x25a180){var _0x23220c={'raw':![],'where':{'id':_0x5f4f7c[_0x7544('0x55')]['id']}},_0x480b22={};_0x480b22[_0x7544('0x3f')]=_[_0x7544('0x56')](db[_0x7544('0x3a')][_0x7544('0x57')]);_0x480b22[_0x7544('0x3e')]=_[_0x7544('0x56')](_0x5f4f7c[_0x7544('0x3e')]);_0x480b22['filters']=_[_0x7544('0x41')](_0x480b22[_0x7544('0x3f')],_0x480b22[_0x7544('0x3e')]);_0x23220c[_0x7544('0x40')]=_['intersection'](_0x480b22['model'],qs['fields'](_0x5f4f7c[_0x7544('0x3e')][_0x7544('0x42')]));_0x23220c['attributes']=_0x23220c[_0x7544('0x40')][_0x7544('0x43')]?_0x23220c[_0x7544('0x40')]:_0x480b22[_0x7544('0x3f')];if(_0x5f4f7c[_0x7544('0x3e')][_0x7544('0x51')]){_0x23220c[_0x7544('0x58')]=[{'all':!![]}];}_0x23220c=_[_0x7544('0x4b')]({},_0x23220c,_0x5f4f7c['options']);return db['DeskConfiguration'][_0x7544('0x59')](_0x23220c)[_0x7544('0x1f')](handleEntityNotFound(_0x25a180,null))[_0x7544('0x1f')](respondWithResult(_0x25a180,null))[_0x7544('0x2a')](handleError(_0x25a180,null));};exports[_0x7544('0x5a')]=function(_0x5c844a,_0xea8293){return db[_0x7544('0x3a')][_0x7544('0x5a')](_0x5c844a[_0x7544('0x5b')],{})[_0x7544('0x1f')](respondWithResult(_0xea8293,0xc9))[_0x7544('0x2a')](handleError(_0xea8293,null));};exports[_0x7544('0x33')]=function(_0x49244a,_0x26f346){if(_0x49244a[_0x7544('0x5b')]['id']){delete _0x49244a[_0x7544('0x5b')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x49244a[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x26f346,null))[_0x7544('0x1f')](saveUpdates(_0x49244a[_0x7544('0x5b')],null))[_0x7544('0x1f')](respondWithResult(_0x26f346,null))[_0x7544('0x2a')](handleError(_0x26f346,null));};exports[_0x7544('0x34')]=function(_0x36e028,_0x352c72){return db[_0x7544('0x3a')][_0x7544('0x59')]({'where':{'id':_0x36e028[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x352c72,null))[_0x7544('0x1f')](removeEntity(_0x352c72,null))[_0x7544('0x2a')](handleError(_0x352c72,null));};exports['getFields']=function(_0x57c70e,_0xc56985,_0x3711aa){var _0xc4adab={};var _0x40e6ca={};var _0x16abab;var _0x3688ab;return db[_0x7544('0x3a')][_0x7544('0x5c')]({'where':{'id':_0x57c70e[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0xc56985,null))['then'](function(_0x177c13){if(_0x177c13){_0x16abab=_0x177c13;_0x40e6ca[_0x7544('0x3f')]=_['keys'](db[_0x7544('0x5d')]['rawAttributes']);_0x40e6ca[_0x7544('0x3e')]=_[_0x7544('0x56')](_0x57c70e[_0x7544('0x3e')]);_0x40e6ca[_0x7544('0x4a')]=_[_0x7544('0x41')](_0x40e6ca[_0x7544('0x3f')],_0x40e6ca['query']);_0xc4adab[_0x7544('0x40')]=_[_0x7544('0x41')](_0x40e6ca[_0x7544('0x3f')],qs[_0x7544('0x42')](_0x57c70e[_0x7544('0x3e')]['fields']));_0xc4adab[_0x7544('0x40')]=_0xc4adab[_0x7544('0x40')][_0x7544('0x43')]?_0xc4adab[_0x7544('0x40')]:_0x40e6ca['model'];_0xc4adab[_0x7544('0x47')]=qs[_0x7544('0x48')](_0x57c70e[_0x7544('0x3e')]['sort']);_0xc4adab['where']=qs[_0x7544('0x4a')](_[_0x7544('0x49')](_0x57c70e['query'],_0x40e6ca[_0x7544('0x4a')]));if(_0x57c70e[_0x7544('0x3e')][_0x7544('0x4f')]){_0xc4adab[_0x7544('0x4c')]=_[_0x7544('0x4b')](_0xc4adab[_0x7544('0x4c')],{'$or':_['map'](_0xc4adab[_0x7544('0x40')],function(_0x413d41){var _0x3bd1e7={};_0x3bd1e7[_0x413d41]={'$like':'%'+_0x57c70e[_0x7544('0x3e')][_0x7544('0x4f')]+'%'};return _0x3bd1e7;})});}_0xc4adab=_['merge']({},_0xc4adab,_0x57c70e[_0x7544('0x50')]);return _0x16abab[_0x7544('0x5e')](_0xc4adab);}})[_0x7544('0x1f')](function(_0x587ca8){if(_0x587ca8){_0x3688ab=_0x587ca8[_0x7544('0x43')];if(!_0x57c70e['query'][_0x7544('0x44')](_0x7544('0x45'))){_0xc4adab[_0x7544('0x46')]=qs[_0x7544('0x46')](_0x57c70e[_0x7544('0x3e')][_0x7544('0x46')]);_0xc4adab[_0x7544('0x2e')]=qs[_0x7544('0x2e')](_0x57c70e[_0x7544('0x3e')][_0x7544('0x2e')]);}return _0x16abab['getFields'](_0xc4adab);}})[_0x7544('0x1f')](function(_0x2e5e6f){if(_0x2e5e6f){return _0x2e5e6f?{'count':_0x3688ab,'rows':_0x2e5e6f}:null;}})[_0x7544('0x1f')](respondWithResult(_0xc56985,null))['catch'](handleError(_0xc56985,null));};exports[_0x7544('0x5f')]=function(_0x56eb59,_0x2e7789,_0x5133a0){var _0x3af4d6={};var _0x30a376={};var _0x948ed1;var _0x21c670;return db[_0x7544('0x3a')][_0x7544('0x5c')]({'where':{'id':_0x56eb59[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x2e7789,null))[_0x7544('0x1f')](function(_0x36ff77){if(_0x36ff77){_0x948ed1=_0x36ff77;_0x30a376['model']=_[_0x7544('0x56')](db[_0x7544('0x5d')][_0x7544('0x57')]);_0x30a376[_0x7544('0x3e')]=_[_0x7544('0x56')](_0x56eb59[_0x7544('0x3e')]);_0x30a376[_0x7544('0x4a')]=_[_0x7544('0x41')](_0x30a376[_0x7544('0x3f')],_0x30a376['query']);_0x3af4d6[_0x7544('0x40')]=_[_0x7544('0x41')](_0x30a376[_0x7544('0x3f')],qs[_0x7544('0x42')](_0x56eb59[_0x7544('0x3e')][_0x7544('0x42')]));_0x3af4d6[_0x7544('0x40')]=_0x3af4d6['attributes'][_0x7544('0x43')]?_0x3af4d6[_0x7544('0x40')]:_0x30a376[_0x7544('0x3f')];_0x3af4d6[_0x7544('0x47')]=qs[_0x7544('0x48')](_0x56eb59[_0x7544('0x3e')]['sort']);_0x3af4d6[_0x7544('0x4c')]=qs[_0x7544('0x4a')](_['pick'](_0x56eb59['query'],_0x30a376[_0x7544('0x4a')]));if(_0x56eb59['query'][_0x7544('0x4f')]){_0x3af4d6[_0x7544('0x4c')]=_[_0x7544('0x4b')](_0x3af4d6[_0x7544('0x4c')],{'$or':_[_0x7544('0x3d')](_0x3af4d6[_0x7544('0x40')],function(_0x534fcb){var _0x2f0e07={};_0x2f0e07[_0x534fcb]={'$like':'%'+_0x56eb59[_0x7544('0x3e')]['filter']+'%'};return _0x2f0e07;})});}_0x3af4d6=_['merge']({},_0x3af4d6,_0x56eb59['options']);return _0x948ed1[_0x7544('0x5f')](_0x3af4d6);}})[_0x7544('0x1f')](function(_0x4fb85d){if(_0x4fb85d){_0x21c670=_0x4fb85d[_0x7544('0x43')];if(!_0x56eb59['query'][_0x7544('0x44')]('nolimit')){_0x3af4d6[_0x7544('0x46')]=qs[_0x7544('0x46')](_0x56eb59['query'][_0x7544('0x46')]);_0x3af4d6[_0x7544('0x2e')]=qs['offset'](_0x56eb59[_0x7544('0x3e')][_0x7544('0x2e')]);}return _0x948ed1[_0x7544('0x5f')](_0x3af4d6);}})[_0x7544('0x1f')](function(_0x4e564c){if(_0x4e564c){return _0x4e564c?{'count':_0x21c670,'rows':_0x4e564c}:null;}})[_0x7544('0x1f')](respondWithResult(_0x2e7789,null))[_0x7544('0x2a')](handleError(_0x2e7789,null));};exports[_0x7544('0x60')]=function(_0x428108,_0x1bd3a6,_0x353d32){var _0x5463ee={};var _0x4dc77c={};var _0x2f2fd2;var _0x5207f5;return db['DeskConfiguration'][_0x7544('0x5c')]({'where':{'id':_0x428108[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x1bd3a6,null))['then'](function(_0x3fd902){if(_0x3fd902){_0x2f2fd2=_0x3fd902;_0x4dc77c['model']=_[_0x7544('0x56')](db['DeskField'][_0x7544('0x57')]);_0x4dc77c[_0x7544('0x3e')]=_[_0x7544('0x56')](_0x428108[_0x7544('0x3e')]);_0x4dc77c[_0x7544('0x4a')]=_['intersection'](_0x4dc77c[_0x7544('0x3f')],_0x4dc77c[_0x7544('0x3e')]);_0x5463ee[_0x7544('0x40')]=_['intersection'](_0x4dc77c[_0x7544('0x3f')],qs[_0x7544('0x42')](_0x428108[_0x7544('0x3e')]['fields']));_0x5463ee[_0x7544('0x40')]=_0x5463ee[_0x7544('0x40')][_0x7544('0x43')]?_0x5463ee[_0x7544('0x40')]:_0x4dc77c['model'];_0x5463ee[_0x7544('0x47')]=qs[_0x7544('0x48')](_0x428108[_0x7544('0x3e')][_0x7544('0x48')]);_0x5463ee[_0x7544('0x4c')]=qs[_0x7544('0x4a')](_[_0x7544('0x49')](_0x428108[_0x7544('0x3e')],_0x4dc77c['filters']));if(_0x428108[_0x7544('0x3e')][_0x7544('0x4f')]){_0x5463ee[_0x7544('0x4c')]=_[_0x7544('0x4b')](_0x5463ee[_0x7544('0x4c')],{'$or':_['map'](_0x5463ee[_0x7544('0x40')],function(_0x26a5a5){var _0x1a124a={};_0x1a124a[_0x26a5a5]={'$like':'%'+_0x428108['query'][_0x7544('0x4f')]+'%'};return _0x1a124a;})});}_0x5463ee=_['merge']({},_0x5463ee,_0x428108[_0x7544('0x50')]);return _0x2f2fd2[_0x7544('0x60')](_0x5463ee);}})[_0x7544('0x1f')](function(_0x1de4d4){if(_0x1de4d4){_0x5207f5=_0x1de4d4[_0x7544('0x43')];if(!_0x428108[_0x7544('0x3e')][_0x7544('0x44')]('nolimit')){_0x5463ee['limit']=qs['limit'](_0x428108['query'][_0x7544('0x46')]);_0x5463ee[_0x7544('0x2e')]=qs['offset'](_0x428108[_0x7544('0x3e')][_0x7544('0x2e')]);}return _0x2f2fd2[_0x7544('0x60')](_0x5463ee);}})[_0x7544('0x1f')](function(_0x36bf11){if(_0x36bf11){return _0x36bf11?{'count':_0x5207f5,'rows':_0x36bf11}:null;}})[_0x7544('0x1f')](respondWithResult(_0x1bd3a6,null))[_0x7544('0x2a')](handleError(_0x1bd3a6,null));};exports['getTags']=function(_0x5b086c,_0x36bff9,_0x946078){var _0x12e85d={};var _0x3961d9={};var _0x5cd286;var _0x10c631;return db[_0x7544('0x3a')][_0x7544('0x5c')]({'where':{'id':_0x5b086c[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x36bff9,null))[_0x7544('0x1f')](function(_0x3070b5){if(_0x3070b5){_0x5cd286=_0x3070b5;_0x3961d9[_0x7544('0x3f')]=_[_0x7544('0x56')](db[_0x7544('0x61')][_0x7544('0x57')]);_0x3961d9[_0x7544('0x3e')]=_[_0x7544('0x56')](_0x5b086c[_0x7544('0x3e')]);_0x3961d9[_0x7544('0x4a')]=_[_0x7544('0x41')](_0x3961d9[_0x7544('0x3f')],_0x3961d9[_0x7544('0x3e')]);_0x12e85d['attributes']=_[_0x7544('0x41')](_0x3961d9[_0x7544('0x3f')],qs[_0x7544('0x42')](_0x5b086c[_0x7544('0x3e')][_0x7544('0x42')]));_0x12e85d[_0x7544('0x40')]=_0x12e85d[_0x7544('0x40')][_0x7544('0x43')]?_0x12e85d[_0x7544('0x40')]:_0x3961d9[_0x7544('0x3f')];_0x12e85d[_0x7544('0x47')]=qs[_0x7544('0x48')](_0x5b086c[_0x7544('0x3e')]['sort']);_0x12e85d[_0x7544('0x4c')]=qs[_0x7544('0x4a')](_[_0x7544('0x49')](_0x5b086c['query'],_0x3961d9['filters']));if(_0x5b086c[_0x7544('0x3e')][_0x7544('0x4f')]){_0x12e85d['where']=_[_0x7544('0x4b')](_0x12e85d[_0x7544('0x4c')],{'$or':_['map'](_0x12e85d['attributes'],function(_0x131707){var _0x44b3d0={};_0x44b3d0[_0x131707]={'$like':'%'+_0x5b086c[_0x7544('0x3e')][_0x7544('0x4f')]+'%'};return _0x44b3d0;})});}_0x12e85d=_[_0x7544('0x4b')]({},_0x12e85d,_0x5b086c[_0x7544('0x50')]);return _0x5cd286[_0x7544('0x62')](_0x12e85d);}})['then'](function(_0xebfecc){if(_0xebfecc){_0x10c631=_0xebfecc[_0x7544('0x43')];if(!_0x5b086c[_0x7544('0x3e')][_0x7544('0x44')]('nolimit')){_0x12e85d[_0x7544('0x46')]=qs[_0x7544('0x46')](_0x5b086c[_0x7544('0x3e')]['limit']);_0x12e85d[_0x7544('0x2e')]=qs[_0x7544('0x2e')](_0x5b086c[_0x7544('0x3e')][_0x7544('0x2e')]);}return _0x5cd286[_0x7544('0x62')](_0x12e85d);}})[_0x7544('0x1f')](function(_0x2d416a){if(_0x2d416a){return _0x2d416a?{'count':_0x10c631,'rows':_0x2d416a}:null;}})[_0x7544('0x1f')](respondWithResult(_0x36bff9,null))[_0x7544('0x2a')](handleError(_0x36bff9,null));};exports['setTags']=function(_0x4363ac,_0x4024ca,_0x260903){if(_0x4363ac[_0x7544('0x5b')]['id']){delete _0x4363ac['body']['id'];}return db[_0x7544('0x3a')][_0x7544('0x5c')]({'where':{'id':_0x4363ac[_0x7544('0x55')]['id']}})[_0x7544('0x1f')](handleEntityNotFound(_0x4024ca,null))[_0x7544('0x1f')](function(_0x2c821c){if(_0x2c821c){return _0x2c821c[_0x7544('0x63')](_0x4363ac['body'][_0x7544('0x64')]||[]);}return null;})[_0x7544('0x1f')](respondWithResult(_0x4024ca,null))[_0x7544('0x2a')](handleError(_0x4024ca,null));}; \ No newline at end of file +var _0xecd5=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','Sequelize','ValidationError','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','end','sendStatus','stack','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','merge','filter','where','includeAll','include','findAll','rows','show','params','options','find','create','body','destroy','getFields','findOne','DeskField','intersection','order','pick','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce'];(function(_0x54e603,_0x2c9fbd){var _0xd8d89b=function(_0xc74664){while(--_0xc74664){_0x54e603['push'](_0x54e603['shift']());}};_0xd8d89b(++_0x2c9fbd);}(_0xecd5,0x110));var _0x5ecd=function(_0xf3c51c,_0x4f5db2){_0xf3c51c=_0xf3c51c-0x0;var _0x440d95=_0xecd5[_0xf3c51c];return _0x440d95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ecd('0x0'));var rimraf=require(_0x5ecd('0x1'));var zipdir=require(_0x5ecd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ecd('0x3'));var moment=require(_0x5ecd('0x4'));var BPromise=require(_0x5ecd('0x5'));var Mustache=require(_0x5ecd('0x6'));var util=require('util');var path=require(_0x5ecd('0x7'));var sox=require('sox');var csv=require(_0x5ecd('0x8'));var ejs=require(_0x5ecd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0x8'));var querystring=require(_0x5ecd('0xe'));var Papa=require(_0x5ecd('0xf'));var Redis=require(_0x5ecd('0x10'));var authService=require(_0x5ecd('0x11'));var qs=require(_0x5ecd('0x12'));var as=require(_0x5ecd('0x13'));var hardwareService=require(_0x5ecd('0x14'));var logger=require('../../config/logger')(_0x5ecd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ecd('0x16'))['db'];var jayson=require(_0x5ecd('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3eaad7,_0x2106a0,_0x47cf02){if(_0x47cf02){var _0x37bfe1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37bfe1['test'](_0x2106a0)){return _0x3eaad7;}else{throw new db[(_0x5ecd('0x18'))][(_0x5ecd('0x19'))]('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 _0x3eaad7;}}function respondWithRpcPromise(_0x3619c8,_0xacc5c4,_0x48442a,_0x458899){return new BPromise(function(_0x4a0e19,_0x308374){var _0x36fb64=_0x458899||client;return _0x36fb64[_0x5ecd('0x1a')](_0x3619c8,_0x48442a)[_0x5ecd('0x1b')](function(_0x3d4973){logger[_0x5ecd('0x1c')](_0x5ecd('0x1d'),_0xacc5c4,_0x5ecd('0x1e'));logger[_0x5ecd('0x1f')](_0x5ecd('0x20'),_0xacc5c4,_0x5ecd('0x1e'),JSON[_0x5ecd('0x21')](_0x3d4973));if(_0x3d4973['error']){if(_0x3d4973[_0x5ecd('0x22')][_0x5ecd('0x23')]===0x1f4){logger[_0x5ecd('0x22')](_0x5ecd('0x1d'),_0xacc5c4,_0x3d4973[_0x5ecd('0x22')]['message']);return _0x308374(_0x3d4973[_0x5ecd('0x22')]['message']);}logger[_0x5ecd('0x22')](_0x5ecd('0x1d'),_0xacc5c4,_0x3d4973[_0x5ecd('0x22')][_0x5ecd('0x24')]);return _0x4a0e19(_0x3d4973[_0x5ecd('0x22')]['message']);}else{logger[_0x5ecd('0x1c')](_0x5ecd('0x1d'),_0xacc5c4,_0x5ecd('0x1e'));_0x4a0e19(_0x3d4973['result'][_0x5ecd('0x24')]);}})[_0x5ecd('0x25')](function(_0x257d4a){logger[_0x5ecd('0x22')](_0x5ecd('0x1d'),_0xacc5c4,_0x257d4a);_0x308374(_0x257d4a);});});}function respondWithStatusCode(_0x20f134,_0x3d0086){_0x3d0086=_0x3d0086||0xcc;return function(_0x14b07b){if(_0x14b07b){return _0x20f134['sendStatus'](_0x3d0086);}return _0x20f134[_0x5ecd('0x26')](_0x3d0086)['end']();};}function respondWithResult(_0x12a109,_0x36d964){_0x36d964=_0x36d964||0xc8;return function(_0x3d70da){if(_0x3d70da){return _0x12a109[_0x5ecd('0x26')](_0x36d964)[_0x5ecd('0x27')](_0x3d70da);}};}function respondWithFilteredResult(_0x57a775,_0x446324){return function(_0x42f1c8){if(_0x42f1c8){var _0x33ca9e=_0x42f1c8[_0x5ecd('0x28')],_0x38c87d=_0x446324[_0x5ecd('0x29')],_0x389b88=_0x446324[_0x5ecd('0x29')]+_0x446324[_0x5ecd('0x2a')],_0x1c3eb8;if(_0x389b88>=_0x33ca9e){_0x389b88=_0x33ca9e;_0x1c3eb8=0xc8;}else{_0x1c3eb8=0xce;}_0x57a775[_0x5ecd('0x26')](_0x1c3eb8);return _0x57a775[_0x5ecd('0x2b')](_0x5ecd('0x2c'),_0x38c87d+'-'+_0x389b88+'/'+_0x33ca9e)[_0x5ecd('0x27')](_0x42f1c8);}return null;};}function patchUpdates(_0x3055eb){return function(_0x3645a2){try{jsonpatch[_0x5ecd('0x2d')](_0x3645a2,_0x3055eb,!![]);}catch(_0x58c40e){return BPromise[_0x5ecd('0x2e')](_0x58c40e);}return _0x3645a2[_0x5ecd('0x2f')]();};}function saveUpdates(_0x37fdaa,_0x179c63){return function(_0x12646d){if(_0x12646d){return _0x12646d['update'](_0x37fdaa)[_0x5ecd('0x1b')](function(_0x169fa3){return _0x169fa3;});}return null;};}function removeEntity(_0xabe8b5,_0x195641){return function(_0x378c18){if(_0x378c18){return _0x378c18['destroy']()[_0x5ecd('0x1b')](function(){_0xabe8b5[_0x5ecd('0x26')](0xcc)[_0x5ecd('0x30')]();});}};}function handleEntityNotFound(_0x507a3d,_0x3d18fe){return function(_0x42d60a){if(!_0x42d60a){_0x507a3d[_0x5ecd('0x31')](0x194);}return _0x42d60a;};}function handleError(_0x46fb84,_0x27b8e5){_0x27b8e5=_0x27b8e5||0x1f4;return function(_0x8c8933){logger['error'](_0x8c8933[_0x5ecd('0x32')]);if(_0x8c8933['name']){delete _0x8c8933['name'];}_0x46fb84[_0x5ecd('0x26')](_0x27b8e5)[_0x5ecd('0x33')](_0x8c8933);};}exports[_0x5ecd('0x34')]=function(_0x29d265,_0x38809f){var _0x41975e={},_0x4f3373={},_0x58561f={'count':0x0,'rows':[]};var _0x9370a=_[_0x5ecd('0x35')](db[_0x5ecd('0x36')][_0x5ecd('0x37')],function(_0xd6e3a6){return{'name':_0xd6e3a6[_0x5ecd('0x38')],'type':_0xd6e3a6[_0x5ecd('0x39')]['key']};});_0x4f3373[_0x5ecd('0x3a')]=_[_0x5ecd('0x35')](_0x9370a,_0x5ecd('0x3b'));_0x4f3373['query']=_[_0x5ecd('0x3c')](_0x29d265[_0x5ecd('0x3d')]);_0x4f3373[_0x5ecd('0x3e')]=_['intersection'](_0x4f3373['model'],_0x4f3373['query']);_0x41975e[_0x5ecd('0x3f')]=_['intersection'](_0x4f3373[_0x5ecd('0x3a')],qs[_0x5ecd('0x40')](_0x29d265['query'][_0x5ecd('0x40')]));_0x41975e[_0x5ecd('0x3f')]=_0x41975e[_0x5ecd('0x3f')]['length']?_0x41975e[_0x5ecd('0x3f')]:_0x4f3373[_0x5ecd('0x3a')];if(!_0x29d265[_0x5ecd('0x3d')][_0x5ecd('0x41')](_0x5ecd('0x42'))){_0x41975e['limit']=qs[_0x5ecd('0x2a')](_0x29d265[_0x5ecd('0x3d')]['limit']);_0x41975e['offset']=qs[_0x5ecd('0x29')](_0x29d265[_0x5ecd('0x3d')][_0x5ecd('0x29')]);}_0x41975e['order']=qs[_0x5ecd('0x43')](_0x29d265['query'][_0x5ecd('0x43')]);_0x41975e['where']=qs['filters'](_['pick'](_0x29d265[_0x5ecd('0x3d')],_0x4f3373[_0x5ecd('0x3e')]),_0x9370a);if(_0x29d265[_0x5ecd('0x3d')]['filter']){_0x41975e['where']=_[_0x5ecd('0x44')](_0x41975e['where'],{'$or':_[_0x5ecd('0x35')](_0x9370a,function(_0x9b289d){if(_0x9b289d[_0x5ecd('0x39')]!=='VIRTUAL'){var _0x51216e={};_0x51216e[_0x9b289d['name']]={'$like':'%'+_0x29d265['query'][_0x5ecd('0x45')]+'%'};return _0x51216e;}})});}_0x41975e=_['merge']({},_0x41975e,_0x29d265['options']);var _0x38e61a={'where':_0x41975e[_0x5ecd('0x46')]};return db['DeskConfiguration'][_0x5ecd('0x28')](_0x38e61a)[_0x5ecd('0x1b')](function(_0x477b74){_0x58561f['count']=_0x477b74;if(_0x29d265[_0x5ecd('0x3d')][_0x5ecd('0x47')]){_0x41975e[_0x5ecd('0x48')]=[{'all':!![]}];}return db[_0x5ecd('0x36')][_0x5ecd('0x49')](_0x41975e);})[_0x5ecd('0x1b')](function(_0x2cf571){_0x58561f[_0x5ecd('0x4a')]=_0x2cf571;return _0x58561f;})[_0x5ecd('0x1b')](respondWithFilteredResult(_0x38809f,_0x41975e))['catch'](handleError(_0x38809f,null));};exports[_0x5ecd('0x4b')]=function(_0x13fed0,_0xda9406){var _0x35b68e={'raw':![],'where':{'id':_0x13fed0[_0x5ecd('0x4c')]['id']}},_0x926519={};_0x926519[_0x5ecd('0x3a')]=_[_0x5ecd('0x3c')](db['DeskConfiguration'][_0x5ecd('0x37')]);_0x926519[_0x5ecd('0x3d')]=_['keys'](_0x13fed0[_0x5ecd('0x3d')]);_0x926519[_0x5ecd('0x3e')]=_['intersection'](_0x926519[_0x5ecd('0x3a')],_0x926519[_0x5ecd('0x3d')]);_0x35b68e[_0x5ecd('0x3f')]=_['intersection'](_0x926519[_0x5ecd('0x3a')],qs[_0x5ecd('0x40')](_0x13fed0[_0x5ecd('0x3d')][_0x5ecd('0x40')]));_0x35b68e['attributes']=_0x35b68e[_0x5ecd('0x3f')]['length']?_0x35b68e[_0x5ecd('0x3f')]:_0x926519[_0x5ecd('0x3a')];if(_0x13fed0[_0x5ecd('0x3d')][_0x5ecd('0x47')]){_0x35b68e[_0x5ecd('0x48')]=[{'all':!![]}];}_0x35b68e=_['merge']({},_0x35b68e,_0x13fed0[_0x5ecd('0x4d')]);return db[_0x5ecd('0x36')][_0x5ecd('0x4e')](_0x35b68e)[_0x5ecd('0x1b')](handleEntityNotFound(_0xda9406,null))[_0x5ecd('0x1b')](respondWithResult(_0xda9406,null))[_0x5ecd('0x25')](handleError(_0xda9406,null));};exports[_0x5ecd('0x4f')]=function(_0x47b260,_0x324d0a){return db['DeskConfiguration'][_0x5ecd('0x4f')](_0x47b260[_0x5ecd('0x50')],{})[_0x5ecd('0x1b')](respondWithResult(_0x324d0a,0xc9))[_0x5ecd('0x25')](handleError(_0x324d0a,null));};exports['update']=function(_0x39f09d,_0x6c5364){if(_0x39f09d[_0x5ecd('0x50')]['id']){delete _0x39f09d[_0x5ecd('0x50')]['id'];}return db[_0x5ecd('0x36')][_0x5ecd('0x4e')]({'where':{'id':_0x39f09d[_0x5ecd('0x4c')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x6c5364,null))[_0x5ecd('0x1b')](saveUpdates(_0x39f09d[_0x5ecd('0x50')],null))['then'](respondWithResult(_0x6c5364,null))['catch'](handleError(_0x6c5364,null));};exports[_0x5ecd('0x51')]=function(_0x4d9df8,_0x31c2fa){return db[_0x5ecd('0x36')]['find']({'where':{'id':_0x4d9df8[_0x5ecd('0x4c')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x31c2fa,null))['then'](removeEntity(_0x31c2fa,null))['catch'](handleError(_0x31c2fa,null));};exports[_0x5ecd('0x52')]=function(_0x5a089e,_0x13048c,_0x368dc7){var _0x27aabb={};var _0x1c2ba7={};var _0x3f0957;var _0x1a6a3b;return db[_0x5ecd('0x36')][_0x5ecd('0x53')]({'where':{'id':_0x5a089e['params']['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x13048c,null))[_0x5ecd('0x1b')](function(_0x1acddf){if(_0x1acddf){_0x3f0957=_0x1acddf;_0x1c2ba7[_0x5ecd('0x3a')]=_[_0x5ecd('0x3c')](db[_0x5ecd('0x54')][_0x5ecd('0x37')]);_0x1c2ba7[_0x5ecd('0x3d')]=_[_0x5ecd('0x3c')](_0x5a089e[_0x5ecd('0x3d')]);_0x1c2ba7[_0x5ecd('0x3e')]=_[_0x5ecd('0x55')](_0x1c2ba7[_0x5ecd('0x3a')],_0x1c2ba7[_0x5ecd('0x3d')]);_0x27aabb[_0x5ecd('0x3f')]=_[_0x5ecd('0x55')](_0x1c2ba7[_0x5ecd('0x3a')],qs[_0x5ecd('0x40')](_0x5a089e[_0x5ecd('0x3d')][_0x5ecd('0x40')]));_0x27aabb['attributes']=_0x27aabb[_0x5ecd('0x3f')]['length']?_0x27aabb['attributes']:_0x1c2ba7[_0x5ecd('0x3a')];_0x27aabb[_0x5ecd('0x56')]=qs[_0x5ecd('0x43')](_0x5a089e['query'][_0x5ecd('0x43')]);_0x27aabb['where']=qs['filters'](_[_0x5ecd('0x57')](_0x5a089e[_0x5ecd('0x3d')],_0x1c2ba7['filters']));if(_0x5a089e[_0x5ecd('0x3d')]['filter']){_0x27aabb[_0x5ecd('0x46')]=_[_0x5ecd('0x44')](_0x27aabb[_0x5ecd('0x46')],{'$or':_[_0x5ecd('0x35')](_0x27aabb[_0x5ecd('0x3f')],function(_0x346a53){var _0x13579a={};_0x13579a[_0x346a53]={'$like':'%'+_0x5a089e['query'][_0x5ecd('0x45')]+'%'};return _0x13579a;})});}_0x27aabb=_[_0x5ecd('0x44')]({},_0x27aabb,_0x5a089e[_0x5ecd('0x4d')]);return _0x3f0957[_0x5ecd('0x52')](_0x27aabb);}})[_0x5ecd('0x1b')](function(_0x3606ee){if(_0x3606ee){_0x1a6a3b=_0x3606ee[_0x5ecd('0x58')];if(!_0x5a089e[_0x5ecd('0x3d')][_0x5ecd('0x41')]('nolimit')){_0x27aabb[_0x5ecd('0x2a')]=qs[_0x5ecd('0x2a')](_0x5a089e['query'][_0x5ecd('0x2a')]);_0x27aabb[_0x5ecd('0x29')]=qs[_0x5ecd('0x29')](_0x5a089e[_0x5ecd('0x3d')][_0x5ecd('0x29')]);}return _0x3f0957[_0x5ecd('0x52')](_0x27aabb);}})[_0x5ecd('0x1b')](function(_0x2f673e){if(_0x2f673e){return _0x2f673e?{'count':_0x1a6a3b,'rows':_0x2f673e}:null;}})['then'](respondWithResult(_0x13048c,null))['catch'](handleError(_0x13048c,null));};exports[_0x5ecd('0x59')]=function(_0x1ede54,_0x320ed9,_0xc43ff9){var _0x3ee317={};var _0x260683={};var _0xacf40a;var _0x52c4f0;return db['DeskConfiguration'][_0x5ecd('0x53')]({'where':{'id':_0x1ede54['params']['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x320ed9,null))[_0x5ecd('0x1b')](function(_0xf0ed){if(_0xf0ed){_0xacf40a=_0xf0ed;_0x260683[_0x5ecd('0x3a')]=_[_0x5ecd('0x3c')](db[_0x5ecd('0x54')][_0x5ecd('0x37')]);_0x260683['query']=_[_0x5ecd('0x3c')](_0x1ede54[_0x5ecd('0x3d')]);_0x260683[_0x5ecd('0x3e')]=_[_0x5ecd('0x55')](_0x260683[_0x5ecd('0x3a')],_0x260683['query']);_0x3ee317[_0x5ecd('0x3f')]=_['intersection'](_0x260683[_0x5ecd('0x3a')],qs[_0x5ecd('0x40')](_0x1ede54['query'][_0x5ecd('0x40')]));_0x3ee317[_0x5ecd('0x3f')]=_0x3ee317[_0x5ecd('0x3f')]['length']?_0x3ee317[_0x5ecd('0x3f')]:_0x260683[_0x5ecd('0x3a')];_0x3ee317[_0x5ecd('0x56')]=qs[_0x5ecd('0x43')](_0x1ede54[_0x5ecd('0x3d')][_0x5ecd('0x43')]);_0x3ee317[_0x5ecd('0x46')]=qs['filters'](_[_0x5ecd('0x57')](_0x1ede54['query'],_0x260683['filters']));if(_0x1ede54[_0x5ecd('0x3d')][_0x5ecd('0x45')]){_0x3ee317[_0x5ecd('0x46')]=_[_0x5ecd('0x44')](_0x3ee317['where'],{'$or':_['map'](_0x3ee317[_0x5ecd('0x3f')],function(_0x481722){var _0x35fc26={};_0x35fc26[_0x481722]={'$like':'%'+_0x1ede54['query']['filter']+'%'};return _0x35fc26;})});}_0x3ee317=_['merge']({},_0x3ee317,_0x1ede54['options']);return _0xacf40a[_0x5ecd('0x59')](_0x3ee317);}})[_0x5ecd('0x1b')](function(_0x4c6a06){if(_0x4c6a06){_0x52c4f0=_0x4c6a06[_0x5ecd('0x58')];if(!_0x1ede54[_0x5ecd('0x3d')][_0x5ecd('0x41')](_0x5ecd('0x42'))){_0x3ee317['limit']=qs['limit'](_0x1ede54[_0x5ecd('0x3d')][_0x5ecd('0x2a')]);_0x3ee317[_0x5ecd('0x29')]=qs[_0x5ecd('0x29')](_0x1ede54[_0x5ecd('0x3d')]['offset']);}return _0xacf40a[_0x5ecd('0x59')](_0x3ee317);}})['then'](function(_0x412af2){if(_0x412af2){return _0x412af2?{'count':_0x52c4f0,'rows':_0x412af2}:null;}})['then'](respondWithResult(_0x320ed9,null))['catch'](handleError(_0x320ed9,null));};exports[_0x5ecd('0x5a')]=function(_0xb44288,_0x50edd9,_0x47e7b5){var _0x171137={};var _0x52e50f={};var _0x71d4b7;var _0x4a3e50;return db[_0x5ecd('0x36')][_0x5ecd('0x53')]({'where':{'id':_0xb44288[_0x5ecd('0x4c')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x50edd9,null))[_0x5ecd('0x1b')](function(_0xffef89){if(_0xffef89){_0x71d4b7=_0xffef89;_0x52e50f['model']=_['keys'](db['DeskField']['rawAttributes']);_0x52e50f[_0x5ecd('0x3d')]=_[_0x5ecd('0x3c')](_0xb44288['query']);_0x52e50f[_0x5ecd('0x3e')]=_[_0x5ecd('0x55')](_0x52e50f[_0x5ecd('0x3a')],_0x52e50f[_0x5ecd('0x3d')]);_0x171137[_0x5ecd('0x3f')]=_[_0x5ecd('0x55')](_0x52e50f['model'],qs[_0x5ecd('0x40')](_0xb44288[_0x5ecd('0x3d')]['fields']));_0x171137[_0x5ecd('0x3f')]=_0x171137['attributes']['length']?_0x171137[_0x5ecd('0x3f')]:_0x52e50f[_0x5ecd('0x3a')];_0x171137[_0x5ecd('0x56')]=qs['sort'](_0xb44288[_0x5ecd('0x3d')][_0x5ecd('0x43')]);_0x171137[_0x5ecd('0x46')]=qs[_0x5ecd('0x3e')](_['pick'](_0xb44288[_0x5ecd('0x3d')],_0x52e50f[_0x5ecd('0x3e')]));if(_0xb44288['query']['filter']){_0x171137[_0x5ecd('0x46')]=_['merge'](_0x171137[_0x5ecd('0x46')],{'$or':_[_0x5ecd('0x35')](_0x171137[_0x5ecd('0x3f')],function(_0x38a7b6){var _0x314e0a={};_0x314e0a[_0x38a7b6]={'$like':'%'+_0xb44288['query']['filter']+'%'};return _0x314e0a;})});}_0x171137=_[_0x5ecd('0x44')]({},_0x171137,_0xb44288['options']);return _0x71d4b7['getDescriptions'](_0x171137);}})[_0x5ecd('0x1b')](function(_0x4ac73d){if(_0x4ac73d){_0x4a3e50=_0x4ac73d[_0x5ecd('0x58')];if(!_0xb44288[_0x5ecd('0x3d')][_0x5ecd('0x41')](_0x5ecd('0x42'))){_0x171137[_0x5ecd('0x2a')]=qs['limit'](_0xb44288[_0x5ecd('0x3d')][_0x5ecd('0x2a')]);_0x171137['offset']=qs[_0x5ecd('0x29')](_0xb44288[_0x5ecd('0x3d')][_0x5ecd('0x29')]);}return _0x71d4b7[_0x5ecd('0x5a')](_0x171137);}})['then'](function(_0x2534d4){if(_0x2534d4){return _0x2534d4?{'count':_0x4a3e50,'rows':_0x2534d4}:null;}})[_0x5ecd('0x1b')](respondWithResult(_0x50edd9,null))[_0x5ecd('0x25')](handleError(_0x50edd9,null));};exports[_0x5ecd('0x5b')]=function(_0x314b46,_0x1c2742,_0x579481){var _0x5dedcb={};var _0x21531e={};var _0x344178;var _0x544a8d;return db[_0x5ecd('0x36')][_0x5ecd('0x53')]({'where':{'id':_0x314b46[_0x5ecd('0x4c')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x1c2742,null))['then'](function(_0xd1f075){if(_0xd1f075){_0x344178=_0xd1f075;_0x21531e['model']=_[_0x5ecd('0x3c')](db[_0x5ecd('0x5c')][_0x5ecd('0x37')]);_0x21531e['query']=_[_0x5ecd('0x3c')](_0x314b46[_0x5ecd('0x3d')]);_0x21531e[_0x5ecd('0x3e')]=_[_0x5ecd('0x55')](_0x21531e[_0x5ecd('0x3a')],_0x21531e[_0x5ecd('0x3d')]);_0x5dedcb[_0x5ecd('0x3f')]=_[_0x5ecd('0x55')](_0x21531e['model'],qs[_0x5ecd('0x40')](_0x314b46['query']['fields']));_0x5dedcb['attributes']=_0x5dedcb[_0x5ecd('0x3f')][_0x5ecd('0x58')]?_0x5dedcb[_0x5ecd('0x3f')]:_0x21531e[_0x5ecd('0x3a')];_0x5dedcb[_0x5ecd('0x56')]=qs[_0x5ecd('0x43')](_0x314b46[_0x5ecd('0x3d')]['sort']);_0x5dedcb[_0x5ecd('0x46')]=qs[_0x5ecd('0x3e')](_[_0x5ecd('0x57')](_0x314b46[_0x5ecd('0x3d')],_0x21531e[_0x5ecd('0x3e')]));if(_0x314b46['query']['filter']){_0x5dedcb[_0x5ecd('0x46')]=_[_0x5ecd('0x44')](_0x5dedcb[_0x5ecd('0x46')],{'$or':_[_0x5ecd('0x35')](_0x5dedcb[_0x5ecd('0x3f')],function(_0xdc89c9){var _0x476195={};_0x476195[_0xdc89c9]={'$like':'%'+_0x314b46[_0x5ecd('0x3d')][_0x5ecd('0x45')]+'%'};return _0x476195;})});}_0x5dedcb=_[_0x5ecd('0x44')]({},_0x5dedcb,_0x314b46[_0x5ecd('0x4d')]);return _0x344178['getTags'](_0x5dedcb);}})[_0x5ecd('0x1b')](function(_0x38e32d){if(_0x38e32d){_0x544a8d=_0x38e32d[_0x5ecd('0x58')];if(!_0x314b46[_0x5ecd('0x3d')][_0x5ecd('0x41')](_0x5ecd('0x42'))){_0x5dedcb[_0x5ecd('0x2a')]=qs[_0x5ecd('0x2a')](_0x314b46[_0x5ecd('0x3d')][_0x5ecd('0x2a')]);_0x5dedcb[_0x5ecd('0x29')]=qs[_0x5ecd('0x29')](_0x314b46[_0x5ecd('0x3d')][_0x5ecd('0x29')]);}return _0x344178[_0x5ecd('0x5b')](_0x5dedcb);}})[_0x5ecd('0x1b')](function(_0x228dd1){if(_0x228dd1){return _0x228dd1?{'count':_0x544a8d,'rows':_0x228dd1}:null;}})[_0x5ecd('0x1b')](respondWithResult(_0x1c2742,null))[_0x5ecd('0x25')](handleError(_0x1c2742,null));};exports[_0x5ecd('0x5d')]=function(_0x57e9bc,_0x552972,_0x349b30){if(_0x57e9bc[_0x5ecd('0x50')]['id']){delete _0x57e9bc['body']['id'];}return db[_0x5ecd('0x36')][_0x5ecd('0x53')]({'where':{'id':_0x57e9bc[_0x5ecd('0x4c')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x552972,null))[_0x5ecd('0x1b')](function(_0x415340){if(_0x415340){return _0x415340[_0x5ecd('0x5d')](_0x57e9bc[_0x5ecd('0x50')][_0x5ecd('0x5e')]||[]);}return null;})[_0x5ecd('0x1b')](respondWithResult(_0x552972,null))[_0x5ecd('0x25')](handleError(_0x552972,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d65cf57..fc0da12 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 _0xecf6=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0x41caac,_0x50c421){var _0x28d2ba=function(_0x2a2e12){while(--_0x2a2e12){_0x41caac['push'](_0x41caac['shift']());}};_0x28d2ba(++_0x50c421);}(_0xecf6,0x71));var _0x6ecf=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xecf6[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x6ecf('0x0'));var util=require(_0x6ecf('0x1'));var logger=require(_0x6ecf('0x2'))(_0x6ecf('0x3'));var moment=require(_0x6ecf('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ecf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ecf('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x6ecf('0x7')]=function(_0x1b02e0,_0x3377da){return _0x1b02e0[_0x6ecf('0x8')](_0x6ecf('0x9'),attributes,{'tableName':_0x6ecf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cb2=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x227ca3,_0x4748bb){var _0x1561fc=function(_0x1a1c8e){while(--_0x1a1c8e){_0x227ca3['push'](_0x227ca3['shift']());}};_0x1561fc(++_0x4748bb);}(_0x7cb2,0x19d));var _0x27cb=function(_0x5b092a,_0x32cbdb){_0x5b092a=_0x5b092a-0x0;var _0x4b24d6=_0x7cb2[_0x5b092a];return _0x4b24d6;};'use strict';var _=require(_0x27cb('0x0'));var util=require(_0x27cb('0x1'));var logger=require(_0x27cb('0x2'))(_0x27cb('0x3'));var moment=require('moment');var BPromise=require(_0x27cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27cb('0x5'));var rimraf=require(_0x27cb('0x6'));var config=require(_0x27cb('0x7'));var attributes=require(_0x27cb('0x8'));module[_0x27cb('0x9')]=function(_0x57e128,_0x4f5b6e){return _0x57e128[_0x27cb('0xa')](_0x27cb('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 1f8b75b..337696f 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 _0xd138=['rpc','request','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb'];(function(_0x562565,_0x2ece9e){var _0x42b84c=function(_0x374278){while(--_0x374278){_0x562565['push'](_0x562565['shift']());}};_0x42b84c(++_0x2ece9e);}(_0xd138,0x1dc));var _0x8d13=function(_0x36d780,_0x493be1){_0x36d780=_0x36d780-0x0;var _0x491eda=_0xd138[_0x36d780];return _0x491eda;};'use strict';var _=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var moment=require(_0x8d13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d13('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d13('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57ca7f,_0x317105,_0x296da6){return new BPromise(function(_0x1ab1f6,_0x5846d4){return client[_0x8d13('0x5')](_0x57ca7f,_0x296da6)['then'](function(_0x29a579){logger[_0x8d13('0x6')]('DeskConfiguration,\x20%s,\x20%s',_0x317105,'request\x20sent');logger[_0x8d13('0x7')](_0x8d13('0x8'),_0x317105,_0x8d13('0x9'),JSON['stringify'](_0x29a579));if(_0x29a579[_0x8d13('0xa')]){if(_0x29a579[_0x8d13('0xa')][_0x8d13('0xb')]===0x1f4){logger['error'](_0x8d13('0xc'),_0x317105,_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);return _0x5846d4(_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);}logger[_0x8d13('0xa')](_0x8d13('0xc'),_0x317105,_0x29a579[_0x8d13('0xa')][_0x8d13('0xd')]);return _0x1ab1f6(_0x29a579['error'][_0x8d13('0xd')]);}else{logger['info'](_0x8d13('0xc'),_0x317105,_0x8d13('0x9'));_0x1ab1f6(_0x29a579['result'][_0x8d13('0xd')]);}})[_0x8d13('0xe')](function(_0x426cae){logger[_0x8d13('0xa')](_0x8d13('0xc'),_0x317105,_0x426cae);_0x5846d4(_0x426cae);});});} \ No newline at end of file +var _0x7b37=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x55d6d9,_0x4b0d00){var _0x2cdb30=function(_0x4fc0dc){while(--_0x4fc0dc){_0x55d6d9['push'](_0x55d6d9['shift']());}};_0x2cdb30(++_0x4b0d00);}(_0x7b37,0xd9));var _0x77b3=function(_0x28378a,_0x32a231){_0x28378a=_0x28378a-0x0;var _0x35fa9b=_0x7b37[_0x28378a];return _0x35fa9b;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 953dfd0..006a604 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 _0x4af9=['get','isAuthenticated','index','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4af9,0x105));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var path=require(_0x94af('0x2'));var timeout=require(_0x94af('0x3'));var express=require(_0x94af('0x4'));var router=express[_0x94af('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var controller=require(_0x94af('0x8'));router[_0x94af('0x9')]('/',auth[_0x94af('0xa')](),controller[_0x94af('0xb')]);router[_0x94af('0x9')]('/:id',auth[_0x94af('0xa')](),controller[_0x94af('0xc')]);router[_0x94af('0xd')]('/',auth[_0x94af('0xa')](),controller['create']);router[_0x94af('0xe')](_0x94af('0xf'),auth[_0x94af('0xa')](),controller[_0x94af('0x10')]);router[_0x94af('0x11')]('/:id',auth[_0x94af('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d5d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1fe320,_0x3e934e){var _0x293d10=function(_0x829260){while(--_0x829260){_0x1fe320['push'](_0x1fe320['shift']());}};_0x293d10(++_0x3e934e);}(_0x4d5d,0x19d));var _0xd4d5=function(_0x29b886,_0x3ec7c2){_0x29b886=_0x29b886-0x0;var _0x263ef9=_0x4d5d[_0x29b886];return _0x263ef9;};'use strict';var multer=require(_0xd4d5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd4d5('0x1'));var express=require(_0xd4d5('0x2'));var router=express[_0xd4d5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd4d5('0x4'));var config=require(_0xd4d5('0x5'));var controller=require(_0xd4d5('0x6'));router[_0xd4d5('0x7')]('/',auth[_0xd4d5('0x8')](),controller['index']);router[_0xd4d5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd4d5('0x9')]);router[_0xd4d5('0xa')]('/',auth[_0xd4d5('0x8')](),controller[_0xd4d5('0xb')]);router[_0xd4d5('0xc')](_0xd4d5('0xd'),auth[_0xd4d5('0x8')](),controller[_0xd4d5('0xe')]);router[_0xd4d5('0xf')](_0xd4d5('0xd'),auth['isAuthenticated'](),controller[_0xd4d5('0x10')]);module[_0xd4d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2427c82..ba02e3a 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 _0x88e6=['BOOLEAN','sequelize','exports','string','variable','keyValue','STRING','ENUM'];(function(_0x4e3ba4,_0x287983){var _0xb3169b=function(_0x6eeb6b){while(--_0x6eeb6b){_0x4e3ba4['push'](_0x4e3ba4['shift']());}};_0xb3169b(++_0x287983);}(_0x88e6,0x1d1));var _0x688e=function(_0x33a2a5,_0x42de72){_0x33a2a5=_0x33a2a5-0x0;var _0x140e62=_0x88e6[_0x33a2a5];return _0x140e62;};'use strict';var Sequelize=require(_0x688e('0x0'));module[_0x688e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x688e('0x2'),_0x688e('0x3'),'customVariable',_0x688e('0x4')),'defaultValue':_0x688e('0x2')},'content':{'type':Sequelize[_0x688e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x688e('0x6')](_0x688e('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x688e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x688e('0x5')]}}; \ No newline at end of file +var _0x0a4a=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x0a4a,0x1a9));var _0xa0a4=function(_0x36ff02,_0x2d9140){_0x36ff02=_0x36ff02-0x0;var _0x577ce8=_0x0a4a[_0x36ff02];return _0x577ce8;};'use strict';var Sequelize=require(_0xa0a4('0x0'));module[_0xa0a4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa0a4('0x2'),_0xa0a4('0x3'),_0xa0a4('0x4'),_0xa0a4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa0a4('0x6')]},'key':{'type':Sequelize[_0xa0a4('0x6')]},'keyType':{'type':Sequelize[_0xa0a4('0x7')]('string',_0xa0a4('0x3'),_0xa0a4('0x4'))},'keyContent':{'type':Sequelize[_0xa0a4('0x6')]},'idField':{'type':Sequelize[_0xa0a4('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa0a4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa0a4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 62e8ddc..9c36813 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 _0xb3b6=['fast-json-patch','request-promise','bluebird','util','path','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/environment','../../mysqldb','end','status','limit','Content-Range','json','reject','save','update','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','options','count','rows','then','catch','params','length','includeAll','include','find','create','body','destroy','eml-format','rimraf'];(function(_0x2a7fa5,_0x4f0dd8){var _0x405bd2=function(_0x28b6d6){while(--_0x28b6d6){_0x2a7fa5['push'](_0x2a7fa5['shift']());}};_0x405bd2(++_0x4f0dd8);}(_0xb3b6,0x11a));var _0x6b3b=function(_0x5f545b,_0x447d6e){_0x5f545b=_0x5f545b-0x0;var _0x18d108=_0xb3b6[_0x5f545b];return _0x18d108;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b3b('0x0'));var rimraf=require(_0x6b3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b3b('0x2'));var rp=require(_0x6b3b('0x3'));var moment=require('moment');var BPromise=require(_0x6b3b('0x4'));var Mustache=require('mustache');var util=require(_0x6b3b('0x5'));var path=require(_0x6b3b('0x6'));var sox=require('sox');var csv=require(_0x6b3b('0x7'));var ejs=require(_0x6b3b('0x8'));var fs=require('fs');var _=require(_0x6b3b('0x9'));var squel=require(_0x6b3b('0xa'));var crypto=require(_0x6b3b('0xb'));var jsforce=require(_0x6b3b('0xc'));var deskjs=require(_0x6b3b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b3b('0xe'));var Papa=require(_0x6b3b('0xf'));var Redis=require(_0x6b3b('0x10'));var authService=require(_0x6b3b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6b3b('0x12'));var hardwareService=require(_0x6b3b('0x13'));var logger=require(_0x6b3b('0x14'))(_0x6b3b('0x15'));var utils=require('../../config/utils');var config=require(_0x6b3b('0x16'));var db=require(_0x6b3b('0x17'))['db'];function respondWithStatusCode(_0x9f9e29,_0x45839e){_0x45839e=_0x45839e||0xcc;return function(_0x3dd851){if(_0x3dd851){return _0x9f9e29['sendStatus'](_0x45839e);}return _0x9f9e29['status'](_0x45839e)[_0x6b3b('0x18')]();};}function respondWithResult(_0x479986,_0x3589ad){_0x3589ad=_0x3589ad||0xc8;return function(_0x2da80a){if(_0x2da80a){return _0x479986[_0x6b3b('0x19')](_0x3589ad)['json'](_0x2da80a);}};}function respondWithFilteredResult(_0x1b517c,_0x2ba4ce){return function(_0xf32803){if(_0xf32803){var _0x31b5de=_0xf32803['count'],_0x31ae63=_0x2ba4ce['offset'],_0x5035e0=_0x2ba4ce['offset']+_0x2ba4ce[_0x6b3b('0x1a')],_0x23fe06;if(_0x5035e0>=_0x31b5de){_0x5035e0=_0x31b5de;_0x23fe06=0xc8;}else{_0x23fe06=0xce;}_0x1b517c['status'](_0x23fe06);return _0x1b517c['set'](_0x6b3b('0x1b'),_0x31ae63+'-'+_0x5035e0+'/'+_0x31b5de)[_0x6b3b('0x1c')](_0xf32803);}return null;};}function patchUpdates(_0x569b4a){return function(_0x2a9258){try{jsonpatch['apply'](_0x2a9258,_0x569b4a,!![]);}catch(_0x17f0b4){return BPromise[_0x6b3b('0x1d')](_0x17f0b4);}return _0x2a9258[_0x6b3b('0x1e')]();};}function saveUpdates(_0x503363,_0x2d6c3b){return function(_0x1603a1){if(_0x1603a1){return _0x1603a1[_0x6b3b('0x1f')](_0x503363)['then'](function(_0x543ec9){return _0x543ec9;});}return null;};}function removeEntity(_0x3909d2,_0x585c20){return function(_0x17d774){if(_0x17d774){return _0x17d774['destroy']()['then'](function(){_0x3909d2[_0x6b3b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39081c,_0x4ef085){return function(_0x281bd0){if(!_0x281bd0){_0x39081c[_0x6b3b('0x20')](0x194);}return _0x281bd0;};}function handleError(_0x3f4768,_0x43e8c6){_0x43e8c6=_0x43e8c6||0x1f4;return function(_0x42f77c){logger[_0x6b3b('0x21')](_0x42f77c[_0x6b3b('0x22')]);if(_0x42f77c[_0x6b3b('0x23')]){delete _0x42f77c[_0x6b3b('0x23')];}_0x3f4768[_0x6b3b('0x19')](_0x43e8c6)[_0x6b3b('0x24')](_0x42f77c);};}exports[_0x6b3b('0x25')]=function(_0x42db9d,_0x4c03fe){var _0x204096={},_0x176efe={},_0x310b53={'count':0x0,'rows':[]};var _0x19edf1=_['map'](db[_0x6b3b('0x26')][_0x6b3b('0x27')],function(_0x17eb65){return{'name':_0x17eb65[_0x6b3b('0x28')],'type':_0x17eb65['type'][_0x6b3b('0x29')]};});_0x176efe[_0x6b3b('0x2a')]=_[_0x6b3b('0x2b')](_0x19edf1,_0x6b3b('0x23'));_0x176efe[_0x6b3b('0x2c')]=_[_0x6b3b('0x2d')](_0x42db9d[_0x6b3b('0x2c')]);_0x176efe[_0x6b3b('0x2e')]=_[_0x6b3b('0x2f')](_0x176efe['model'],_0x176efe[_0x6b3b('0x2c')]);_0x204096[_0x6b3b('0x30')]=_[_0x6b3b('0x2f')](_0x176efe['model'],qs[_0x6b3b('0x31')](_0x42db9d[_0x6b3b('0x2c')]['fields']));_0x204096[_0x6b3b('0x30')]=_0x204096[_0x6b3b('0x30')]['length']?_0x204096[_0x6b3b('0x30')]:_0x176efe[_0x6b3b('0x2a')];if(!_0x42db9d[_0x6b3b('0x2c')][_0x6b3b('0x32')](_0x6b3b('0x33'))){_0x204096['limit']=qs['limit'](_0x42db9d['query'][_0x6b3b('0x1a')]);_0x204096['offset']=qs[_0x6b3b('0x34')](_0x42db9d[_0x6b3b('0x2c')][_0x6b3b('0x34')]);}_0x204096['order']=qs[_0x6b3b('0x35')](_0x42db9d['query'][_0x6b3b('0x35')]);_0x204096[_0x6b3b('0x36')]=qs[_0x6b3b('0x2e')](_[_0x6b3b('0x37')](_0x42db9d['query'],_0x176efe[_0x6b3b('0x2e')]),_0x19edf1);if(_0x42db9d['query']['filter']){_0x204096['where']=_[_0x6b3b('0x38')](_0x204096[_0x6b3b('0x36')],{'$or':_[_0x6b3b('0x2b')](_0x19edf1,function(_0x3c0e66){if(_0x3c0e66['type']!=='VIRTUAL'){var _0x7c3ffe={};_0x7c3ffe[_0x3c0e66[_0x6b3b('0x23')]]={'$like':'%'+_0x42db9d[_0x6b3b('0x2c')][_0x6b3b('0x39')]+'%'};return _0x7c3ffe;}})});}_0x204096=_[_0x6b3b('0x38')]({},_0x204096,_0x42db9d[_0x6b3b('0x3a')]);var _0x2ca109={'where':_0x204096[_0x6b3b('0x36')]};return db[_0x6b3b('0x26')][_0x6b3b('0x3b')](_0x2ca109)['then'](function(_0x5c85ce){_0x310b53[_0x6b3b('0x3b')]=_0x5c85ce;if(_0x42db9d[_0x6b3b('0x2c')]['includeAll']){_0x204096['include']=[{'all':!![]}];}return db[_0x6b3b('0x26')]['findAll'](_0x204096);})['then'](function(_0x1959cf){_0x310b53[_0x6b3b('0x3c')]=_0x1959cf;return _0x310b53;})[_0x6b3b('0x3d')](respondWithFilteredResult(_0x4c03fe,_0x204096))[_0x6b3b('0x3e')](handleError(_0x4c03fe,null));};exports['show']=function(_0x202b34,_0x3c80e1){var _0x4bb613={'raw':!![],'where':{'id':_0x202b34[_0x6b3b('0x3f')]['id']}},_0x73b859={};_0x73b859[_0x6b3b('0x2a')]=_[_0x6b3b('0x2d')](db['DeskField'][_0x6b3b('0x27')]);_0x73b859['query']=_[_0x6b3b('0x2d')](_0x202b34['query']);_0x73b859[_0x6b3b('0x2e')]=_[_0x6b3b('0x2f')](_0x73b859[_0x6b3b('0x2a')],_0x73b859['query']);_0x4bb613[_0x6b3b('0x30')]=_[_0x6b3b('0x2f')](_0x73b859['model'],qs['fields'](_0x202b34[_0x6b3b('0x2c')][_0x6b3b('0x31')]));_0x4bb613[_0x6b3b('0x30')]=_0x4bb613['attributes'][_0x6b3b('0x40')]?_0x4bb613[_0x6b3b('0x30')]:_0x73b859[_0x6b3b('0x2a')];if(_0x202b34['query'][_0x6b3b('0x41')]){_0x4bb613[_0x6b3b('0x42')]=[{'all':!![]}];}_0x4bb613=_[_0x6b3b('0x38')]({},_0x4bb613,_0x202b34[_0x6b3b('0x3a')]);return db[_0x6b3b('0x26')][_0x6b3b('0x43')](_0x4bb613)['then'](handleEntityNotFound(_0x3c80e1,null))[_0x6b3b('0x3d')](respondWithResult(_0x3c80e1,null))[_0x6b3b('0x3e')](handleError(_0x3c80e1,null));};exports[_0x6b3b('0x44')]=function(_0x444bd3,_0xc036ab){return db[_0x6b3b('0x26')][_0x6b3b('0x44')](_0x444bd3[_0x6b3b('0x45')],{})['then'](respondWithResult(_0xc036ab,0xc9))[_0x6b3b('0x3e')](handleError(_0xc036ab,null));};exports[_0x6b3b('0x1f')]=function(_0x3ce6f9,_0x16b6cd){if(_0x3ce6f9['body']['id']){delete _0x3ce6f9[_0x6b3b('0x45')]['id'];}return db[_0x6b3b('0x26')][_0x6b3b('0x43')]({'where':{'id':_0x3ce6f9[_0x6b3b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x16b6cd,null))[_0x6b3b('0x3d')](saveUpdates(_0x3ce6f9[_0x6b3b('0x45')],null))[_0x6b3b('0x3d')](respondWithResult(_0x16b6cd,null))[_0x6b3b('0x3e')](handleError(_0x16b6cd,null));};exports[_0x6b3b('0x46')]=function(_0x49b723,_0x168ca2){return db[_0x6b3b('0x26')][_0x6b3b('0x43')]({'where':{'id':_0x49b723[_0x6b3b('0x3f')]['id']}})[_0x6b3b('0x3d')](handleEntityNotFound(_0x168ca2,null))[_0x6b3b('0x3d')](removeEntity(_0x168ca2,null))['catch'](handleError(_0x168ca2,null));}; \ No newline at end of file +var _0xf811=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','index','map','DeskField','rawAttributes','type'];(function(_0x3b4825,_0xda45b6){var _0x547800=function(_0x2bf7af){while(--_0x2bf7af){_0x3b4825['push'](_0x3b4825['shift']());}};_0x547800(++_0xda45b6);}(_0xf811,0x13c));var _0x1f81=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf811[_0xc0a3d3];return _0x3386e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f81('0x0'));var rimraf=require(_0x1f81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f81('0x2'));var rp=require(_0x1f81('0x3'));var moment=require('moment');var BPromise=require(_0x1f81('0x4'));var Mustache=require('mustache');var util=require(_0x1f81('0x5'));var path=require(_0x1f81('0x6'));var sox=require('sox');var csv=require(_0x1f81('0x7'));var ejs=require(_0x1f81('0x8'));var fs=require('fs');var _=require(_0x1f81('0x9'));var squel=require('squel');var crypto=require(_0x1f81('0xa'));var jsforce=require(_0x1f81('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f81('0x7'));var querystring=require(_0x1f81('0xc'));var Papa=require(_0x1f81('0xd'));var Redis=require('ioredis');var authService=require(_0x1f81('0xe'));var qs=require(_0x1f81('0xf'));var as=require(_0x1f81('0x10'));var hardwareService=require(_0x1f81('0x11'));var logger=require(_0x1f81('0x12'))(_0x1f81('0x13'));var utils=require(_0x1f81('0x14'));var config=require(_0x1f81('0x15'));var db=require(_0x1f81('0x16'))['db'];function respondWithStatusCode(_0x4fe1d9,_0x3b6446){_0x3b6446=_0x3b6446||0xcc;return function(_0xb3d898){if(_0xb3d898){return _0x4fe1d9[_0x1f81('0x17')](_0x3b6446);}return _0x4fe1d9['status'](_0x3b6446)[_0x1f81('0x18')]();};}function respondWithResult(_0x4cbb7f,_0x5a7131){_0x5a7131=_0x5a7131||0xc8;return function(_0xa2a001){if(_0xa2a001){return _0x4cbb7f[_0x1f81('0x19')](_0x5a7131)[_0x1f81('0x1a')](_0xa2a001);}};}function respondWithFilteredResult(_0x747326,_0x3ceaad){return function(_0xda0cb6){if(_0xda0cb6){var _0x15a451=_0xda0cb6[_0x1f81('0x1b')],_0x220144=_0x3ceaad[_0x1f81('0x1c')],_0xde6832=_0x3ceaad[_0x1f81('0x1c')]+_0x3ceaad[_0x1f81('0x1d')],_0x55286c;if(_0xde6832>=_0x15a451){_0xde6832=_0x15a451;_0x55286c=0xc8;}else{_0x55286c=0xce;}_0x747326[_0x1f81('0x19')](_0x55286c);return _0x747326[_0x1f81('0x1e')](_0x1f81('0x1f'),_0x220144+'-'+_0xde6832+'/'+_0x15a451)[_0x1f81('0x1a')](_0xda0cb6);}return null;};}function patchUpdates(_0x12061f){return function(_0x50de1f){try{jsonpatch[_0x1f81('0x20')](_0x50de1f,_0x12061f,!![]);}catch(_0x1b046c){return BPromise[_0x1f81('0x21')](_0x1b046c);}return _0x50de1f[_0x1f81('0x22')]();};}function saveUpdates(_0x137d0d,_0x48d96e){return function(_0x5aca95){if(_0x5aca95){return _0x5aca95[_0x1f81('0x23')](_0x137d0d)['then'](function(_0x5a9fae){return _0x5a9fae;});}return null;};}function removeEntity(_0x2065aa,_0x4c9246){return function(_0x5cf8cf){if(_0x5cf8cf){return _0x5cf8cf[_0x1f81('0x24')]()[_0x1f81('0x25')](function(){_0x2065aa[_0x1f81('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0f5e,_0x3f1763){return function(_0xf6e7bc){if(!_0xf6e7bc){_0x2c0f5e[_0x1f81('0x17')](0x194);}return _0xf6e7bc;};}function handleError(_0x40e8af,_0x1e6aa9){_0x1e6aa9=_0x1e6aa9||0x1f4;return function(_0x45bc39){logger['error'](_0x45bc39['stack']);if(_0x45bc39['name']){delete _0x45bc39[_0x1f81('0x26')];}_0x40e8af[_0x1f81('0x19')](_0x1e6aa9)['send'](_0x45bc39);};}exports[_0x1f81('0x27')]=function(_0x4337dd,_0x1f176a){var _0x574aa4={},_0x66e54f={},_0x556dc1={'count':0x0,'rows':[]};var _0x513b98=_[_0x1f81('0x28')](db[_0x1f81('0x29')][_0x1f81('0x2a')],function(_0x22671c){return{'name':_0x22671c['fieldName'],'type':_0x22671c[_0x1f81('0x2b')][_0x1f81('0x2c')]};});_0x66e54f[_0x1f81('0x2d')]=_[_0x1f81('0x28')](_0x513b98,_0x1f81('0x26'));_0x66e54f[_0x1f81('0x2e')]=_['keys'](_0x4337dd[_0x1f81('0x2e')]);_0x66e54f[_0x1f81('0x2f')]=_[_0x1f81('0x30')](_0x66e54f[_0x1f81('0x2d')],_0x66e54f[_0x1f81('0x2e')]);_0x574aa4[_0x1f81('0x31')]=_[_0x1f81('0x30')](_0x66e54f[_0x1f81('0x2d')],qs['fields'](_0x4337dd['query'][_0x1f81('0x32')]));_0x574aa4[_0x1f81('0x31')]=_0x574aa4['attributes'][_0x1f81('0x33')]?_0x574aa4[_0x1f81('0x31')]:_0x66e54f[_0x1f81('0x2d')];if(!_0x4337dd[_0x1f81('0x2e')][_0x1f81('0x34')](_0x1f81('0x35'))){_0x574aa4['limit']=qs[_0x1f81('0x1d')](_0x4337dd[_0x1f81('0x2e')][_0x1f81('0x1d')]);_0x574aa4[_0x1f81('0x1c')]=qs[_0x1f81('0x1c')](_0x4337dd[_0x1f81('0x2e')][_0x1f81('0x1c')]);}_0x574aa4[_0x1f81('0x36')]=qs[_0x1f81('0x37')](_0x4337dd[_0x1f81('0x2e')]['sort']);_0x574aa4['where']=qs[_0x1f81('0x2f')](_[_0x1f81('0x38')](_0x4337dd['query'],_0x66e54f[_0x1f81('0x2f')]),_0x513b98);if(_0x4337dd[_0x1f81('0x2e')][_0x1f81('0x39')]){_0x574aa4[_0x1f81('0x3a')]=_[_0x1f81('0x3b')](_0x574aa4['where'],{'$or':_[_0x1f81('0x28')](_0x513b98,function(_0x59ab86){if(_0x59ab86[_0x1f81('0x2b')]!==_0x1f81('0x3c')){var _0x1f64c9={};_0x1f64c9[_0x59ab86[_0x1f81('0x26')]]={'$like':'%'+_0x4337dd['query'][_0x1f81('0x39')]+'%'};return _0x1f64c9;}})});}_0x574aa4=_['merge']({},_0x574aa4,_0x4337dd[_0x1f81('0x3d')]);var _0x44b2d2={'where':_0x574aa4[_0x1f81('0x3a')]};return db['DeskField'][_0x1f81('0x1b')](_0x44b2d2)[_0x1f81('0x25')](function(_0x579c7f){_0x556dc1['count']=_0x579c7f;if(_0x4337dd[_0x1f81('0x2e')]['includeAll']){_0x574aa4[_0x1f81('0x3e')]=[{'all':!![]}];}return db[_0x1f81('0x29')][_0x1f81('0x3f')](_0x574aa4);})[_0x1f81('0x25')](function(_0x3c12c0){_0x556dc1[_0x1f81('0x40')]=_0x3c12c0;return _0x556dc1;})['then'](respondWithFilteredResult(_0x1f176a,_0x574aa4))[_0x1f81('0x41')](handleError(_0x1f176a,null));};exports[_0x1f81('0x42')]=function(_0x860aaa,_0x4004be){var _0x277b72={'raw':!![],'where':{'id':_0x860aaa[_0x1f81('0x43')]['id']}},_0x448e9d={};_0x448e9d['model']=_[_0x1f81('0x44')](db[_0x1f81('0x29')][_0x1f81('0x2a')]);_0x448e9d['query']=_['keys'](_0x860aaa['query']);_0x448e9d[_0x1f81('0x2f')]=_[_0x1f81('0x30')](_0x448e9d[_0x1f81('0x2d')],_0x448e9d[_0x1f81('0x2e')]);_0x277b72[_0x1f81('0x31')]=_[_0x1f81('0x30')](_0x448e9d[_0x1f81('0x2d')],qs[_0x1f81('0x32')](_0x860aaa[_0x1f81('0x2e')][_0x1f81('0x32')]));_0x277b72[_0x1f81('0x31')]=_0x277b72['attributes'][_0x1f81('0x33')]?_0x277b72[_0x1f81('0x31')]:_0x448e9d[_0x1f81('0x2d')];if(_0x860aaa[_0x1f81('0x2e')]['includeAll']){_0x277b72[_0x1f81('0x3e')]=[{'all':!![]}];}_0x277b72=_['merge']({},_0x277b72,_0x860aaa['options']);return db['DeskField'][_0x1f81('0x45')](_0x277b72)[_0x1f81('0x25')](handleEntityNotFound(_0x4004be,null))[_0x1f81('0x25')](respondWithResult(_0x4004be,null))[_0x1f81('0x41')](handleError(_0x4004be,null));};exports['create']=function(_0x4c0b27,_0x52fb50){return db['DeskField'][_0x1f81('0x46')](_0x4c0b27[_0x1f81('0x47')],{})[_0x1f81('0x25')](respondWithResult(_0x52fb50,0xc9))['catch'](handleError(_0x52fb50,null));};exports['update']=function(_0x49dfdf,_0x16ec2a){if(_0x49dfdf[_0x1f81('0x47')]['id']){delete _0x49dfdf[_0x1f81('0x47')]['id'];}return db['DeskField'][_0x1f81('0x45')]({'where':{'id':_0x49dfdf[_0x1f81('0x43')]['id']}})[_0x1f81('0x25')](handleEntityNotFound(_0x16ec2a,null))[_0x1f81('0x25')](saveUpdates(_0x49dfdf['body'],null))[_0x1f81('0x25')](respondWithResult(_0x16ec2a,null))[_0x1f81('0x41')](handleError(_0x16ec2a,null));};exports['destroy']=function(_0x2f2a4c,_0x212087){return db[_0x1f81('0x29')][_0x1f81('0x45')]({'where':{'id':_0x2f2a4c[_0x1f81('0x43')]['id']}})[_0x1f81('0x25')](handleEntityNotFound(_0x212087,null))[_0x1f81('0x25')](removeEntity(_0x212087,null))[_0x1f81('0x41')](handleError(_0x212087,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 1eaf35c..6ba9b3d 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 _0x910e=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x25f69e,_0x514804){var _0x18ec11=function(_0x49f095){while(--_0x49f095){_0x25f69e['push'](_0x25f69e['shift']());}};_0x18ec11(++_0x514804);}(_0x910e,0x1a3));var _0xe910=function(_0x3ad3ef,_0x23cdd3){_0x3ad3ef=_0x3ad3ef-0x0;var _0x445969=_0x910e[_0x3ad3ef];return _0x445969;};'use strict';var _=require(_0xe910('0x0'));var util=require(_0xe910('0x1'));var logger=require(_0xe910('0x2'))(_0xe910('0x3'));var moment=require('moment');var BPromise=require(_0xe910('0x4'));var rp=require(_0xe910('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe910('0x6'));var config=require(_0xe910('0x7'));var attributes=require(_0xe910('0x8'));module[_0xe910('0x9')]=function(_0x3eda79,_0x389307){return _0x3eda79[_0xe910('0xa')](_0xe910('0xb'),attributes,{'tableName':_0xe910('0xc'),'paranoid':![],'indexes':[{'name':_0xe910('0xd'),'fields':[_0xe910('0xe'),_0xe910('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd7=['idField','FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x134e24,_0x5da697){var _0x57b9fb=function(_0x4a14a6){while(--_0x4a14a6){_0x134e24['push'](_0x134e24['shift']());}};_0x57b9fb(++_0x5da697);}(_0x7bd7,0x9c));var _0x77bd=function(_0x561611,_0x5fd769){_0x561611=_0x561611-0x0;var _0x1e3576=_0x7bd7[_0x561611];return _0x1e3576;};'use strict';var _=require(_0x77bd('0x0'));var util=require(_0x77bd('0x1'));var logger=require(_0x77bd('0x2'))(_0x77bd('0x3'));var moment=require(_0x77bd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x77bd('0x5'));var config=require(_0x77bd('0x6'));var attributes=require(_0x77bd('0x7'));module['exports']=function(_0x342ef7,_0x9e9cfe){return _0x342ef7[_0x77bd('0x8')](_0x77bd('0x9'),attributes,{'tableName':_0x77bd('0xa'),'paranoid':![],'indexes':[{'name':_0x77bd('0xb'),'fields':[_0x77bd('0xc'),_0x77bd('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 71c6c90..bfeeee0 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 _0xb843=['debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb843,0x169));var _0x3b84=function(_0x4f035e,_0x113f58){_0x4f035e=_0x4f035e-0x0;var _0x3319e8=_0xb843[_0x4f035e];return _0x3319e8;};'use strict';var _=require(_0x3b84('0x0'));var util=require('util');var moment=require(_0x3b84('0x1'));var BPromise=require(_0x3b84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b84('0x3'))['db'];var utils=require(_0x3b84('0x4'));var logger=require(_0x3b84('0x5'))(_0x3b84('0x6'));var config=require(_0x3b84('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3b84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c8b77,_0x1091e5,_0x49fc54){return new BPromise(function(_0x3321fd,_0x5ed067){return client[_0x3b84('0x9')](_0x3c8b77,_0x49fc54)[_0x3b84('0xa')](function(_0xbae5e7){logger[_0x3b84('0xb')](_0x3b84('0xc'),_0x1091e5,'request\x20sent');logger[_0x3b84('0xd')](_0x3b84('0xe'),_0x1091e5,_0x3b84('0xf'),JSON[_0x3b84('0x10')](_0xbae5e7));if(_0xbae5e7[_0x3b84('0x11')]){if(_0xbae5e7[_0x3b84('0x11')][_0x3b84('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x1091e5,_0xbae5e7[_0x3b84('0x11')]['message']);return _0x5ed067(_0xbae5e7[_0x3b84('0x11')][_0x3b84('0x13')]);}logger[_0x3b84('0x11')](_0x3b84('0xc'),_0x1091e5,_0xbae5e7['error'][_0x3b84('0x13')]);return _0x3321fd(_0xbae5e7[_0x3b84('0x11')][_0x3b84('0x13')]);}else{logger['info'](_0x3b84('0xc'),_0x1091e5,_0x3b84('0xf'));_0x3321fd(_0xbae5e7[_0x3b84('0x14')]['message']);}})[_0x3b84('0x15')](function(_0x3cafb7){logger[_0x3b84('0x11')](_0x3b84('0xc'),_0x1091e5,_0x3cafb7);_0x5ed067(_0x3cafb7);});});} \ No newline at end of file +var _0x434b=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ac430,_0xe24de6){var _0x14e78a=function(_0xe6756c){while(--_0xe6756c){_0x2ac430['push'](_0x2ac430['shift']());}};_0x14e78a(++_0xe24de6);}(_0x434b,0xf4));var _0xb434=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x434b[_0x59710f];return _0xaae66a;};'use strict';var _=require(_0xb434('0x0'));var util=require(_0xb434('0x1'));var moment=require('moment');var BPromise=require(_0xb434('0x2'));var rs=require(_0xb434('0x3'));var fs=require('fs');var Redis=require(_0xb434('0x4'));var db=require(_0xb434('0x5'))['db'];var utils=require(_0xb434('0x6'));var logger=require(_0xb434('0x7'))(_0xb434('0x8'));var config=require('../../config/environment');var jayson=require(_0xb434('0x9'));var client=jayson[_0xb434('0xa')][_0xb434('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4371fb,_0x511490,_0x315c31){return new BPromise(function(_0x3992dc,_0x3e3c25){return client[_0xb434('0xc')](_0x4371fb,_0x315c31)[_0xb434('0xd')](function(_0x2d8b35){logger[_0xb434('0xe')](_0xb434('0xf'),_0x511490,_0xb434('0x10'));logger[_0xb434('0x11')](_0xb434('0x12'),_0x511490,_0xb434('0x10'),JSON[_0xb434('0x13')](_0x2d8b35));if(_0x2d8b35[_0xb434('0x14')]){if(_0x2d8b35[_0xb434('0x14')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x511490,_0x2d8b35['error']['message']);return _0x3e3c25(_0x2d8b35[_0xb434('0x14')][_0xb434('0x15')]);}logger[_0xb434('0x14')](_0xb434('0xf'),_0x511490,_0x2d8b35[_0xb434('0x14')][_0xb434('0x15')]);return _0x3992dc(_0x2d8b35[_0xb434('0x14')]['message']);}else{logger[_0xb434('0xe')](_0xb434('0xf'),_0x511490,_0xb434('0x10'));_0x3992dc(_0x2d8b35[_0xb434('0x16')]['message']);}})[_0xb434('0x17')](function(_0x1402b6){logger[_0xb434('0x14')]('DeskField,\x20%s,\x20%s',_0x511490,_0x1402b6);_0x3e3c25(_0x1402b6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b332935..41a3611 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 _0x935e=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x597a3a,_0x1799df){var _0x1bc90b=function(_0x8493ec){while(--_0x8493ec){_0x597a3a['push'](_0x597a3a['shift']());}};_0x1bc90b(++_0x1799df);}(_0x935e,0xfc));var _0xe935=function(_0x16ad3d,_0x36b472){_0x16ad3d=_0x16ad3d-0x0;var _0x1536b3=_0x935e[_0x16ad3d];return _0x1536b3;};'use strict';var multer=require(_0xe935('0x0'));var util=require(_0xe935('0x1'));var path=require(_0xe935('0x2'));var timeout=require('connect-timeout');var express=require(_0xe935('0x3'));var router=express['Router']();var auth=require(_0xe935('0x4'));var interaction=require(_0xe935('0x5'));var config=require(_0xe935('0x6'));var controller=require(_0xe935('0x7'));router['get']('/',auth[_0xe935('0x8')](),controller[_0xe935('0x9')]);router[_0xe935('0xa')](_0xe935('0xb'),auth[_0xe935('0x8')](),controller[_0xe935('0xc')]);router[_0xe935('0xa')](_0xe935('0xd'),auth[_0xe935('0x8')](),controller[_0xe935('0xe')]);router[_0xe935('0xa')](_0xe935('0xf'),auth[_0xe935('0x8')](),controller[_0xe935('0x10')]);router[_0xe935('0x11')]('/',auth[_0xe935('0x8')](),controller['create']);router[_0xe935('0x11')](_0xe935('0xd'),auth[_0xe935('0x8')](),controller[_0xe935('0x12')]);router[_0xe935('0x13')](_0xe935('0xb'),auth[_0xe935('0x8')](),controller['update']);router[_0xe935('0x14')]('/:id',auth[_0xe935('0x8')](),controller[_0xe935('0x15')]);module[_0xe935('0x16')]=router; \ No newline at end of file +var _0x9340=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get'];(function(_0x3271a6,_0x5c5ea9){var _0x270543=function(_0xf85d2d){while(--_0xf85d2d){_0x3271a6['push'](_0x3271a6['shift']());}};_0x270543(++_0x5c5ea9);}(_0x9340,0xd3));var _0x0934=function(_0x218f72,_0x43799e){_0x218f72=_0x218f72-0x0;var _0x29f2c7=_0x9340[_0x218f72];return _0x29f2c7;};'use strict';var multer=require(_0x0934('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0934('0x1'));var router=express[_0x0934('0x2')]();var auth=require(_0x0934('0x3'));var interaction=require(_0x0934('0x4'));var config=require(_0x0934('0x5'));var controller=require(_0x0934('0x6'));router['get']('/',auth[_0x0934('0x7')](),controller['index']);router[_0x0934('0x8')](_0x0934('0x9'),auth['isAuthenticated'](),controller[_0x0934('0xa')]);router[_0x0934('0x8')](_0x0934('0xb'),auth[_0x0934('0x7')](),controller[_0x0934('0xc')]);router['get'](_0x0934('0xd'),auth[_0x0934('0x7')](),controller[_0x0934('0xe')]);router[_0x0934('0xf')]('/',auth[_0x0934('0x7')](),controller['create']);router[_0x0934('0xf')]('/:id/configurations',auth[_0x0934('0x7')](),controller[_0x0934('0x10')]);router['put'](_0x0934('0x9'),auth['isAuthenticated'](),controller[_0x0934('0x11')]);router[_0x0934('0x12')](_0x0934('0x9'),auth[_0x0934('0x7')](),controller['destroy']);module[_0x0934('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6d1cfc7..6f79053 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 _0x5a5a=['sequelize','exports','STRING'];(function(_0x5bd1dd,_0x53e9ac){var _0x12e968=function(_0x4776ee){while(--_0x4776ee){_0x5bd1dd['push'](_0x5bd1dd['shift']());}};_0x12e968(++_0x53e9ac);}(_0x5a5a,0x102));var _0xa5a5=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x5a5a[_0x4d67b8];return _0x55af3b;};'use strict';var Sequelize=require(_0xa5a5('0x0'));module[_0xa5a5('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa5a5('0x2')]},'password':{'type':Sequelize[_0xa5a5('0x2')]},'remoteUri':{'type':Sequelize[_0xa5a5('0x2')]},'tenantId':{'type':Sequelize[_0xa5a5('0x2')]},'clientId':{'type':Sequelize[_0xa5a5('0x2')]},'clientSecret':{'type':Sequelize[_0xa5a5('0x2')]},'serverUrl':{'type':Sequelize[_0xa5a5('0x2')]},'description':{'type':Sequelize[_0xa5a5('0x2')]}}; \ No newline at end of file +var _0xfcb9=['sequelize','STRING'];(function(_0x5c9062,_0x3c3014){var _0x548d7f=function(_0x5a1fd6){while(--_0x5a1fd6){_0x5c9062['push'](_0x5c9062['shift']());}};_0x548d7f(++_0x3c3014);}(_0xfcb9,0xa0));var _0x9fcb=function(_0x3225d8,_0x32f1a5){_0x3225d8=_0x3225d8-0x0;var _0x1647da=_0xfcb9[_0x3225d8];return _0x1647da;};'use strict';var Sequelize=require(_0x9fcb('0x0'));module['exports']={'name':{'type':Sequelize[_0x9fcb('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9fcb('0x1')]},'remoteUri':{'type':Sequelize[_0x9fcb('0x1')]},'tenantId':{'type':Sequelize[_0x9fcb('0x1')]},'clientId':{'type':Sequelize[_0x9fcb('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9fcb('0x1')]},'description':{'type':Sequelize[_0x9fcb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1243894..bdcb8aa 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 _0x3a1d=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Dynamics365Account','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','findOne','length','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientSecret','remoteUri','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','push','MetadataId','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials','GET',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','sendStatus','end','json','count','offset','limit','status','set'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x3a1d,0xae));var _0xd3a1=function(_0x39f097,_0x17116b){_0x39f097=_0x39f097-0x0;var _0x544f6a=_0x3a1d[_0x39f097];return _0x544f6a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd3a1('0x0'));var zipdir=require(_0xd3a1('0x1'));var jsonpatch=require(_0xd3a1('0x2'));var rp=require('request-promise');var moment=require(_0xd3a1('0x3'));var BPromise=require(_0xd3a1('0x4'));var Mustache=require(_0xd3a1('0x5'));var util=require('util');var path=require(_0xd3a1('0x6'));var sox=require('sox');var csv=require(_0xd3a1('0x7'));var ejs=require(_0xd3a1('0x8'));var fs=require('fs');var _=require(_0xd3a1('0x9'));var squel=require('squel');var crypto=require(_0xd3a1('0xa'));var jsforce=require(_0xd3a1('0xb'));var deskjs=require(_0xd3a1('0xc'));var toCsv=require(_0xd3a1('0x7'));var querystring=require(_0xd3a1('0xd'));var Papa=require('papaparse');var Redis=require(_0xd3a1('0xe'));var authService=require(_0xd3a1('0xf'));var qs=require(_0xd3a1('0x10'));var as=require(_0xd3a1('0x11'));var hardwareService=require(_0xd3a1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd3a1('0x13'));var config=require(_0xd3a1('0x14'));var db=require(_0xd3a1('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd3a1('0x16'));var client=jayson[_0xd3a1('0x17')][_0xd3a1('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1ce812,_0x5bdeb7,_0x418a32){if(_0x418a32){var _0x5b96b6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b96b6[_0xd3a1('0x19')](_0x5bdeb7)){return _0x1ce812;}else{throw new db[(_0xd3a1('0x1a'))][(_0xd3a1('0x1b'))](_0xd3a1('0x1c'));}}else{return _0x1ce812;}}function respondWithRpcPromise(_0x43597f,_0x4730ec,_0x5a2851,_0x5e4abd){return new BPromise(function(_0x46cd3b,_0x2debc8){var _0x1ff870=_0x5e4abd||client;return _0x1ff870[_0xd3a1('0x1d')](_0x43597f,_0x5a2851)['then'](function(_0x268088){logger[_0xd3a1('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x4730ec,'request\x20sent');logger['debug'](_0xd3a1('0x1f'),_0x4730ec,'request\x20sent',JSON[_0xd3a1('0x20')](_0x268088));if(_0x268088[_0xd3a1('0x21')]){if(_0x268088[_0xd3a1('0x21')][_0xd3a1('0x22')]===0x1f4){logger[_0xd3a1('0x21')](_0xd3a1('0x23'),_0x4730ec,_0x268088[_0xd3a1('0x21')]['message']);return _0x2debc8(_0x268088[_0xd3a1('0x21')][_0xd3a1('0x24')]);}logger[_0xd3a1('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x4730ec,_0x268088[_0xd3a1('0x21')][_0xd3a1('0x24')]);return _0x46cd3b(_0x268088[_0xd3a1('0x21')]['message']);}else{logger[_0xd3a1('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x4730ec,_0xd3a1('0x25'));_0x46cd3b(_0x268088[_0xd3a1('0x26')][_0xd3a1('0x24')]);}})['catch'](function(_0x2c9d14){logger[_0xd3a1('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x4730ec,_0x2c9d14);_0x2debc8(_0x2c9d14);});});}function respondWithStatusCode(_0x4e9b2f,_0x167756){_0x167756=_0x167756||0xcc;return function(_0x1c2599){if(_0x1c2599){return _0x4e9b2f[_0xd3a1('0x27')](_0x167756);}return _0x4e9b2f['status'](_0x167756)[_0xd3a1('0x28')]();};}function respondWithResult(_0x234548,_0x266680){_0x266680=_0x266680||0xc8;return function(_0x53231e){if(_0x53231e){return _0x234548['status'](_0x266680)[_0xd3a1('0x29')](_0x53231e);}};}function respondWithFilteredResult(_0x50172b,_0xb5a11a){return function(_0xae7d39){if(_0xae7d39){var _0x5d3c21=_0xae7d39[_0xd3a1('0x2a')],_0x79d7db=_0xb5a11a[_0xd3a1('0x2b')],_0x17c175=_0xb5a11a[_0xd3a1('0x2b')]+_0xb5a11a[_0xd3a1('0x2c')],_0x2caa5f;if(_0x17c175>=_0x5d3c21){_0x17c175=_0x5d3c21;_0x2caa5f=0xc8;}else{_0x2caa5f=0xce;}_0x50172b[_0xd3a1('0x2d')](_0x2caa5f);return _0x50172b[_0xd3a1('0x2e')](_0xd3a1('0x2f'),_0x79d7db+'-'+_0x17c175+'/'+_0x5d3c21)['json'](_0xae7d39);}return null;};}function patchUpdates(_0x22f0af){return function(_0x156ed4){try{jsonpatch[_0xd3a1('0x30')](_0x156ed4,_0x22f0af,!![]);}catch(_0x2a05e0){return BPromise[_0xd3a1('0x31')](_0x2a05e0);}return _0x156ed4[_0xd3a1('0x32')]();};}function saveUpdates(_0x32a13d,_0x173214){return function(_0x2885ca){if(_0x2885ca){return _0x2885ca[_0xd3a1('0x33')](_0x32a13d)[_0xd3a1('0x34')](function(_0x544eab){return _0x544eab;});}return null;};}function removeEntity(_0x35ef22,_0xfa7e10){return function(_0xc2291){if(_0xc2291){return _0xc2291[_0xd3a1('0x35')]()['then'](function(){_0x35ef22[_0xd3a1('0x2d')](0xcc)[_0xd3a1('0x28')]();});}};}function handleEntityNotFound(_0x40778c,_0x4ed95e){return function(_0x41a4ef){if(!_0x41a4ef){_0x40778c[_0xd3a1('0x27')](0x194);}return _0x41a4ef;};}function handleError(_0x46dbc1,_0x422343){_0x422343=_0x422343||0x1f4;return function(_0x297898){logger[_0xd3a1('0x21')](_0x297898[_0xd3a1('0x36')]);if(_0x297898[_0xd3a1('0x37')]){delete _0x297898[_0xd3a1('0x37')];}_0x46dbc1[_0xd3a1('0x2d')](_0x422343)[_0xd3a1('0x38')](_0x297898);};}exports[_0xd3a1('0x39')]=function(_0x43bfa7,_0x269f7a){var _0x53c73e={},_0x3f8cce={},_0x4034e0={'count':0x0,'rows':[]};var _0x538d22=_[_0xd3a1('0x3a')](db['Dynamics365Account'][_0xd3a1('0x3b')],function(_0x5b9088){return{'name':_0x5b9088[_0xd3a1('0x3c')],'type':_0x5b9088['type'][_0xd3a1('0x3d')]};});_0x3f8cce[_0xd3a1('0x3e')]=_[_0xd3a1('0x3a')](_0x538d22,_0xd3a1('0x37'));_0x3f8cce[_0xd3a1('0x3f')]=_[_0xd3a1('0x40')](_0x43bfa7['query']);_0x3f8cce[_0xd3a1('0x41')]=_[_0xd3a1('0x42')](_0x3f8cce[_0xd3a1('0x3e')],_0x3f8cce[_0xd3a1('0x3f')]);_0x53c73e[_0xd3a1('0x43')]=_['intersection'](_0x3f8cce[_0xd3a1('0x3e')],qs[_0xd3a1('0x44')](_0x43bfa7[_0xd3a1('0x3f')][_0xd3a1('0x44')]));_0x53c73e[_0xd3a1('0x43')]=_0x53c73e[_0xd3a1('0x43')]['length']?_0x53c73e[_0xd3a1('0x43')]:_0x3f8cce['model'];if(!_0x43bfa7['query'][_0xd3a1('0x45')](_0xd3a1('0x46'))){_0x53c73e['limit']=qs['limit'](_0x43bfa7[_0xd3a1('0x3f')][_0xd3a1('0x2c')]);_0x53c73e[_0xd3a1('0x2b')]=qs[_0xd3a1('0x2b')](_0x43bfa7[_0xd3a1('0x3f')][_0xd3a1('0x2b')]);}_0x53c73e[_0xd3a1('0x47')]=qs[_0xd3a1('0x48')](_0x43bfa7[_0xd3a1('0x3f')]['sort']);_0x53c73e[_0xd3a1('0x49')]=qs[_0xd3a1('0x41')](_[_0xd3a1('0x4a')](_0x43bfa7[_0xd3a1('0x3f')],_0x3f8cce[_0xd3a1('0x41')]),_0x538d22);if(_0x43bfa7[_0xd3a1('0x3f')][_0xd3a1('0x4b')]){_0x53c73e[_0xd3a1('0x49')]=_[_0xd3a1('0x4c')](_0x53c73e[_0xd3a1('0x49')],{'$or':_['map'](_0x538d22,function(_0x1b4b53){if(_0x1b4b53[_0xd3a1('0x4d')]!==_0xd3a1('0x4e')){var _0x2399ee={};_0x2399ee[_0x1b4b53[_0xd3a1('0x37')]]={'$like':'%'+_0x43bfa7[_0xd3a1('0x3f')]['filter']+'%'};return _0x2399ee;}})});}_0x53c73e=_[_0xd3a1('0x4c')]({},_0x53c73e,_0x43bfa7['options']);var _0x4c787b={'where':_0x53c73e[_0xd3a1('0x49')]};return db[_0xd3a1('0x4f')][_0xd3a1('0x2a')](_0x4c787b)['then'](function(_0x3bd701){_0x4034e0[_0xd3a1('0x2a')]=_0x3bd701;if(_0x43bfa7[_0xd3a1('0x3f')][_0xd3a1('0x50')]){_0x53c73e['include']=[{'all':!![]}];}return db[_0xd3a1('0x4f')][_0xd3a1('0x51')](_0x53c73e);})[_0xd3a1('0x34')](function(_0x24b277){_0x4034e0[_0xd3a1('0x52')]=_0x24b277;return _0x4034e0;})[_0xd3a1('0x34')](respondWithFilteredResult(_0x269f7a,_0x53c73e))[_0xd3a1('0x53')](handleError(_0x269f7a,null));};exports[_0xd3a1('0x54')]=function(_0x133e63,_0x182b4d){var _0xb1d4cf={'raw':![],'where':{'id':_0x133e63[_0xd3a1('0x55')]['id']}},_0x10e0e7={};_0x10e0e7[_0xd3a1('0x3e')]=_['keys'](db[_0xd3a1('0x4f')][_0xd3a1('0x3b')]);_0x10e0e7[_0xd3a1('0x3f')]=_[_0xd3a1('0x40')](_0x133e63[_0xd3a1('0x3f')]);_0x10e0e7['filters']=_['intersection'](_0x10e0e7[_0xd3a1('0x3e')],_0x10e0e7[_0xd3a1('0x3f')]);_0xb1d4cf[_0xd3a1('0x43')]=_[_0xd3a1('0x42')](_0x10e0e7[_0xd3a1('0x3e')],qs['fields'](_0x133e63[_0xd3a1('0x3f')][_0xd3a1('0x44')]));_0xb1d4cf[_0xd3a1('0x43')]=_0xb1d4cf['attributes']['length']?_0xb1d4cf[_0xd3a1('0x43')]:_0x10e0e7[_0xd3a1('0x3e')];if(_0x133e63[_0xd3a1('0x3f')]['includeAll']){_0xb1d4cf[_0xd3a1('0x56')]=[{'all':!![]}];}_0xb1d4cf=_[_0xd3a1('0x4c')]({},_0xb1d4cf,_0x133e63[_0xd3a1('0x57')]);return db[_0xd3a1('0x4f')][_0xd3a1('0x58')](_0xb1d4cf)[_0xd3a1('0x34')](handleEntityNotFound(_0x182b4d,null))['then'](respondWithResult(_0x182b4d,null))[_0xd3a1('0x53')](handleError(_0x182b4d,null));};exports[_0xd3a1('0x59')]=function(_0x24cc2f,_0x43975e){return db[_0xd3a1('0x4f')]['create'](_0x24cc2f[_0xd3a1('0x5a')],{})[_0xd3a1('0x34')](respondWithResult(_0x43975e,0xc9))['catch'](handleError(_0x43975e,null));};exports['update']=function(_0x98b1a2,_0x3545fc){if(_0x98b1a2[_0xd3a1('0x5a')]['id']){delete _0x98b1a2['body']['id'];}return db[_0xd3a1('0x4f')][_0xd3a1('0x58')]({'where':{'id':_0x98b1a2[_0xd3a1('0x55')]['id']}})[_0xd3a1('0x34')](handleEntityNotFound(_0x3545fc,null))[_0xd3a1('0x34')](saveUpdates(_0x98b1a2[_0xd3a1('0x5a')],null))[_0xd3a1('0x34')](respondWithResult(_0x3545fc,null))[_0xd3a1('0x53')](handleError(_0x3545fc,null));};exports[_0xd3a1('0x35')]=function(_0x4e2937,_0x3959f9){return db[_0xd3a1('0x4f')]['find']({'where':{'id':_0x4e2937[_0xd3a1('0x55')]['id']}})[_0xd3a1('0x34')](handleEntityNotFound(_0x3959f9,null))[_0xd3a1('0x34')](removeEntity(_0x3959f9,null))[_0xd3a1('0x53')](handleError(_0x3959f9,null));};exports['getConfigurations']=function(_0x163668,_0x1f4f57,_0x2ef417){var _0x4ce23e={};var _0x24a72f={};var _0x58e21e;var _0x165d29;return db[_0xd3a1('0x4f')][_0xd3a1('0x5b')]({'where':{'id':_0x163668[_0xd3a1('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f4f57,null))[_0xd3a1('0x34')](function(_0x3080b4){if(_0x3080b4){_0x58e21e=_0x3080b4;_0x24a72f[_0xd3a1('0x3e')]=_['keys'](db['Dynamics365Configuration'][_0xd3a1('0x3b')]);_0x24a72f[_0xd3a1('0x3f')]=_[_0xd3a1('0x40')](_0x163668['query']);_0x24a72f[_0xd3a1('0x41')]=_[_0xd3a1('0x42')](_0x24a72f[_0xd3a1('0x3e')],_0x24a72f['query']);_0x4ce23e['attributes']=_['intersection'](_0x24a72f[_0xd3a1('0x3e')],qs[_0xd3a1('0x44')](_0x163668[_0xd3a1('0x3f')]['fields']));_0x4ce23e[_0xd3a1('0x43')]=_0x4ce23e[_0xd3a1('0x43')][_0xd3a1('0x5c')]?_0x4ce23e['attributes']:_0x24a72f['model'];_0x4ce23e[_0xd3a1('0x47')]=qs[_0xd3a1('0x48')](_0x163668[_0xd3a1('0x3f')][_0xd3a1('0x48')]);_0x4ce23e[_0xd3a1('0x49')]=qs[_0xd3a1('0x41')](_[_0xd3a1('0x4a')](_0x163668['query'],_0x24a72f[_0xd3a1('0x41')]));if(_0x163668[_0xd3a1('0x3f')][_0xd3a1('0x4b')]){_0x4ce23e[_0xd3a1('0x49')]=_[_0xd3a1('0x4c')](_0x4ce23e[_0xd3a1('0x49')],{'$or':_['map'](_0x4ce23e[_0xd3a1('0x43')],function(_0x262715){var _0x4137b0={};_0x4137b0[_0x262715]={'$like':'%'+_0x163668[_0xd3a1('0x3f')][_0xd3a1('0x4b')]+'%'};return _0x4137b0;})});}_0x4ce23e=_[_0xd3a1('0x4c')]({},_0x4ce23e,_0x163668[_0xd3a1('0x57')]);return _0x58e21e[_0xd3a1('0x5d')](_0x4ce23e);}})[_0xd3a1('0x34')](function(_0x49be50){if(_0x49be50){_0x165d29=_0x49be50['length'];if(!_0x163668['query'][_0xd3a1('0x45')](_0xd3a1('0x46'))){_0x4ce23e['limit']=qs['limit'](_0x163668[_0xd3a1('0x3f')][_0xd3a1('0x2c')]);_0x4ce23e[_0xd3a1('0x2b')]=qs[_0xd3a1('0x2b')](_0x163668['query'][_0xd3a1('0x2b')]);}return _0x58e21e[_0xd3a1('0x5d')](_0x4ce23e);}})[_0xd3a1('0x34')](function(_0x465281){if(_0x465281){return _0x465281?{'count':_0x165d29,'rows':_0x465281}:null;}})[_0xd3a1('0x34')](respondWithResult(_0x1f4f57,null))[_0xd3a1('0x53')](handleError(_0x1f4f57,null));};exports['addConfiguration']=function(_0x1a3eab,_0x1f8dfc,_0xe67302){if(_0x1a3eab[_0xd3a1('0x5a')]['id']){delete _0x1a3eab['body']['id'];}return db[_0xd3a1('0x4f')][_0xd3a1('0x5b')]({'where':{'id':_0x1a3eab['params']['id']}})[_0xd3a1('0x34')](handleEntityNotFound(_0x1f8dfc,null))['then'](function(_0x2cd8f5){if(_0x2cd8f5){_0x1a3eab[_0xd3a1('0x5a')][_0xd3a1('0x5e')]=_0x2cd8f5['id'];_0x1a3eab[_0xd3a1('0x5a')][_0xd3a1('0x5f')]=integrations[_0xd3a1('0x60')](_0x1a3eab[_0xd3a1('0x5a')]['channel'],_0x1a3eab[_0xd3a1('0x5a')][_0xd3a1('0x4d')]);_0x1a3eab[_0xd3a1('0x5a')][_0xd3a1('0x61')]=integrations[_0xd3a1('0x62')](_0x1a3eab[_0xd3a1('0x5a')][_0xd3a1('0x63')],_0x1a3eab['body'][_0xd3a1('0x4d')]);return db[_0xd3a1('0x64')][_0xd3a1('0x59')](_0x1a3eab[_0xd3a1('0x5a')],{'include':[{'model':db[_0xd3a1('0x65')],'as':_0xd3a1('0x5f')},{'model':db[_0xd3a1('0x65')],'as':_0xd3a1('0x61')}]});}return null;})[_0xd3a1('0x34')](respondWithResult(_0x1f8dfc,null))['catch'](handleError(_0x1f8dfc,null));};exports[_0xd3a1('0x66')]=function(_0x4f3602,_0x4d5af1,_0x491b43){var _0x892161=_0x4f3602[_0xd3a1('0x3f')][_0xd3a1('0x67')];var _0x81719=_0x892161===_0xd3a1('0x68')?_0xd3a1('0x69'):'PhoneCall';var _0x4560ba='';var _0x46f99e='';var _0x3f3f96='';var _0x56e8f4='';var _0x171ee3='';var _0x5a278b='';var _0xd35cc='';var _0x508233='';var _0x25bebb=[_0xd3a1('0x6a'),_0xd3a1('0x6b'),_0xd3a1('0x6c'),_0xd3a1('0x6d'),_0xd3a1('0x6e'),_0xd3a1('0x6f'),_0xd3a1('0x70'),_0xd3a1('0x71'),_0xd3a1('0x72'),_0xd3a1('0x73')];var _0x409308=[_0xd3a1('0x74'),_0xd3a1('0x75'),'actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname',_0xd3a1('0x76'),_0xd3a1('0x77'),_0xd3a1('0x78'),_0xd3a1('0x79'),_0xd3a1('0x7a'),_0xd3a1('0x7b'),'createdonbehalfbyname',_0xd3a1('0x7c'),_0xd3a1('0x7d'),_0xd3a1('0x7e'),_0xd3a1('0x7f'),'emailaddress',_0xd3a1('0x80'),_0xd3a1('0x81'),_0xd3a1('0x82'),_0xd3a1('0x83'),_0xd3a1('0x84'),_0xd3a1('0x85'),_0xd3a1('0x86'),'importsequencenumber',_0xd3a1('0x87'),_0xd3a1('0x88'),_0xd3a1('0x89'),_0xd3a1('0x8a'),_0xd3a1('0x8b'),_0xd3a1('0x8c'),_0xd3a1('0x8d'),_0xd3a1('0x8e'),_0xd3a1('0x8f'),_0xd3a1('0x90'),_0xd3a1('0x91'),_0xd3a1('0x92'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0xd3a1('0x93'),'owneridname',_0xd3a1('0x94'),_0xd3a1('0x95'),'parentcaseidname','primarycontactidname',_0xd3a1('0x96'),_0xd3a1('0x97'),'productidname',_0xd3a1('0x98'),_0xd3a1('0x99'),'resolvebykpiidname',_0xd3a1('0x9a'),'responsiblecontactidname',_0xd3a1('0x9b'),_0xd3a1('0x9c'),'slainvokedidname',_0xd3a1('0x9d'),'socialprofileidname',_0xd3a1('0x9e'),'statuscode',_0xd3a1('0x9f'),_0xd3a1('0xa0'),_0xd3a1('0xa1'),_0xd3a1('0xa2'),_0xd3a1('0xa3'),_0xd3a1('0xa4'),_0xd3a1('0xa5')];var _0x326ee4=_0x25bebb[_0xd3a1('0xa6')](_0x409308);return db[_0xd3a1('0x4f')]['findOne']({'where':{'id':_0x4f3602[_0xd3a1('0x55')]['id']},'attributes':['id',_0xd3a1('0xa7'),'password','remoteUri',_0xd3a1('0xa8'),'clientId',_0xd3a1('0xa9')]})[_0xd3a1('0x34')](handleEntityNotFound(_0x4d5af1,null))[_0xd3a1('0x34')](function(_0x41749e){if(_0x41749e){_0x508233=_0x41749e[_0xd3a1('0xaa')];var _0x43cff7=_0x508233[_0xd3a1('0xab')](-0x1);if(_0x43cff7==='/'){_0x508233=_0x508233[_0xd3a1('0xac')](0x0,_0x508233['lastIndexOf'](_0x43cff7));}_0xd35cc=util[_0xd3a1('0xad')](_0xd3a1('0xae'),_0x508233);var _0x129eea={'method':_0xd3a1('0xaf'),'uri':_0xd3a1('0xb0')+_0x41749e[_0xd3a1('0xa8')]+_0xd3a1('0xb1'),'form':{'client_id':_0x41749e[_0xd3a1('0xb2')],'resource':_0x508233,'username':_0x41749e[_0xd3a1('0xa7')],'password':_0x41749e[_0xd3a1('0xb3')],'grant_type':'password','client_secret':_0x41749e[_0xd3a1('0xa9')]},'json':!![]};return rp(_0x129eea);}})[_0xd3a1('0x34')](function(_0x10bbe1){_0x5a278b=_0x10bbe1[_0xd3a1('0xb4')];var _0x2bb564={'method':'GET','uri':encodeURI(_0xd35cc+_0xd3a1('0xb5')+_0x81719+'\x27'),'headers':{'Authorization':_0xd3a1('0xb6')+_0x5a278b,'If-None-Match':null,'OData-Version':_0xd3a1('0xb7')},'json':!![]};return rp(_0x2bb564);})[_0xd3a1('0x34')](function(_0x253e31){var _0x58512b=_0x253e31[_0xd3a1('0xb8')][0x0];var _0x7e8323=_0x58512b['MetadataId'];var _0xa01f45={'method':'GET','uri':_0xd35cc+_0xd3a1('0xb9')+_0x7e8323+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xd3a1('0xb6')+_0x5a278b,'If-None-Match':null,'OData-Version':_0xd3a1('0xb7')},'json':!![]};return rp(_0xa01f45);})[_0xd3a1('0x34')](function(_0x77f7b2){_0x4560ba=_0x77f7b2;_0x46f99e=_0x4560ba[_0xd3a1('0xba')];_0x46f99e=_[_0xd3a1('0xbb')](_0x46f99e,function(_0x308a45){return!_0x326ee4[_0xd3a1('0xbc')](_0x308a45[_0xd3a1('0xbd')]);});var _0x5db150=[];var _0x55c955=[];_0x46f99e[_0xd3a1('0xbe')](function(_0x514a44){if(_0x514a44[_0xd3a1('0xbf')]){var _0x57b4bb=_0x514a44['@odata.type'][_0xd3a1('0xac')](_0x514a44[_0xd3a1('0xbf')][_0xd3a1('0xc0')]('.')+0x1);if(_0x57b4bb==='PicklistAttributeMetadata'){_0x5db150[_0xd3a1('0xc1')](getSelectList(_0xd35cc,_0x892161,_0x55c955,_0x4560ba[_0xd3a1('0xc2')],_0x514a44[_0xd3a1('0xc2')],_0x5a278b));}}});return Promise['all'](_0x5db150);})[_0xd3a1('0x34')](function(_0x2223a6){_0x3f3f96=_0x2223a6[0x0];var _0x2159e7=[];var _0xbc4ac4=[];_0x46f99e['forEach'](function(_0x1b1517){if(!_[_0xd3a1('0xc3')](_0x1b1517[_0xd3a1('0xbf')])){var _0x3b552d=_0x1b1517[_0xd3a1('0xbf')][_0xd3a1('0xac')](_0x1b1517[_0xd3a1('0xbf')][_0xd3a1('0xc0')]('.')+0x1);if(_0x3b552d===_0xd3a1('0xc4')){_0x2159e7[_0xd3a1('0xc1')](getBooleanList(_0xd35cc,_0x892161,_0xbc4ac4,_0x4560ba[_0xd3a1('0xc2')],_0x1b1517[_0xd3a1('0xc2')],_0x5a278b));}}});return Promise[_0xd3a1('0xc5')](_0x2159e7);})['then'](function(_0x558256){_0x56e8f4=_0x558256[0x0];var _0x1faa2d=[];var _0x3ed2ec=[];_0x46f99e[_0xd3a1('0xbe')](function(_0x596c15){if(_0x596c15[_0xd3a1('0xbf')]){var _0x31836a=_0x596c15[_0xd3a1('0xbf')][_0xd3a1('0xac')](_0x596c15[_0xd3a1('0xbf')]['lastIndexOf']('.')+0x1);if(_0x31836a==='StringAttributeMetadata'||_0x31836a===_0xd3a1('0xc6')||_0x31836a===_0xd3a1('0xc7')||_0x31836a==='IntegerAttributeMetadata'||_0x31836a===_0xd3a1('0xc8')||_0x31836a==='DateTimeAttributeMetadata'||_0x31836a==='StatusAttributeMetadata'||_0x31836a===_0xd3a1('0xc9')||_0x31836a===_0xd3a1('0xca')||_0x31836a===_0xd3a1('0xcb')){_0x1faa2d[_0xd3a1('0xc1')](getInputList(_0xd35cc,_0x892161,_0x31836a,_0x3ed2ec,_0x4560ba['MetadataId'],_0x596c15[_0xd3a1('0xc2')],_0x5a278b));}}});return Promise[_0xd3a1('0xc5')](_0x1faa2d);})[_0xd3a1('0x34')](function(_0xba3b82){_0x171ee3=_0xba3b82[0x0];var _0x40965a=_0x3f3f96[_0xd3a1('0xa6')](_0x56e8f4)['concat'](_0x171ee3);var _0x3a84fd={'count':_0x40965a[_0xd3a1('0x5c')],'rows':_0x40965a};return _0x3a84fd;})[_0xd3a1('0x34')](respondWithResult(_0x4d5af1,null))[_0xd3a1('0x53')](function(_0x39f27c){var _0x38ef76=_0x4f3602[_0xd3a1('0x3f')][_0xd3a1('0x19')]?0x1f4:_0x39f27c[_0xd3a1('0xcc')]||0x1f4;logger[_0xd3a1('0x21')](_0x39f27c[_0xd3a1('0x36')]);delete _0x39f27c['name'];if(_0x38ef76===0x191){_0x38ef76=0x190;}_0x4d5af1['status'](_0x38ef76)['send'](_0x4f3602[_0xd3a1('0x3f')]['test']?{'message':_0xd3a1('0xcd'),'statusCode':_0x39f27c[_0xd3a1('0xcc')]}:_0x39f27c);});};function getSelectList(_0x6ffc23,_0x1c9065,_0x48cf00,_0x1a1190,_0x5c47fd,_0x2b4720){var _0xc29105={'method':_0xd3a1('0xce'),'uri':_0x6ffc23+_0xd3a1('0xb9')+_0x1a1190+')/Attributes('+_0x5c47fd+_0xd3a1('0xcf')+_0xd3a1('0xd0'),'headers':{'Authorization':_0xd3a1('0xb6')+_0x2b4720,'If-None-Match':null,'OData-Version':_0xd3a1('0xb7')},'json':!![]};return rp(_0xc29105)[_0xd3a1('0x34')](function(_0x36cfa4){var _0x14af8f=[];var _0x38a36e=_0x36cfa4[_0xd3a1('0xd1')][_0xd3a1('0xd2')];_0x38a36e[_0xd3a1('0xbe')](function(_0x456e96){_0x14af8f['push']({'name':_0x456e96[_0xd3a1('0xd3')][_0xd3a1('0xd4')][_0xd3a1('0xd3')],'value':String(_0x456e96[_0xd3a1('0xd5')])});});var _0x5b9708={'id':_0x1c9065+'_'+_0x36cfa4[_0xd3a1('0xbd')],'name':_0x36cfa4[_0xd3a1('0xd6')][_0xd3a1('0xd4')][_0xd3a1('0xd3')],'custom':![],'options':_0x14af8f};_0x48cf00[_0xd3a1('0xc1')](_0x5b9708);return _0x48cf00;});}function getBooleanList(_0x452b8b,_0x3d031f,_0x432515,_0x1be925,_0xfb6829,_0x146a43){var _0x16399b={'method':'GET','uri':_0x452b8b+'EntityDefinitions('+_0x1be925+')/Attributes('+_0xfb6829+_0xd3a1('0xd7'),'headers':{'Authorization':_0xd3a1('0xb6')+_0x146a43,'If-None-Match':null,'OData-Version':_0xd3a1('0xb7')},'json':!![]};return rp(_0x16399b)[_0xd3a1('0x34')](function(_0x455153){var _0x31606c=[];_0x31606c[_0xd3a1('0xc1')]({'name':_0x455153[_0xd3a1('0xd1')]['TrueOption'][_0xd3a1('0xd3')][_0xd3a1('0xd4')]['Label'],'value':_0xd3a1('0xd8')},{'name':_0x455153[_0xd3a1('0xd1')][_0xd3a1('0xd9')][_0xd3a1('0xd3')][_0xd3a1('0xd4')][_0xd3a1('0xd3')],'value':_0xd3a1('0xda')});var _0x37ba43={'id':_0x3d031f+'_'+_0x455153[_0xd3a1('0xbd')],'name':_0x455153[_0xd3a1('0xd6')]['UserLocalizedLabel'][_0xd3a1('0xd3')],'custom':![],'options':_0x31606c};_0x432515['push'](_0x37ba43);return _0x432515;});}function getInputList(_0x9c013c,_0x132bee,_0x94cf5a,_0x4b4e08,_0x23d5de,_0x2f63db,_0x3dd034){var _0x1aee3b={'method':_0xd3a1('0xce'),'uri':_0x9c013c+_0xd3a1('0xb9')+_0x23d5de+_0xd3a1('0xdb')+_0x2f63db+_0xd3a1('0xdc')+_0x94cf5a+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xd3a1('0xb6')+_0x3dd034,'If-None-Match':null,'OData-Version':_0xd3a1('0xb7')},'json':!![]};return rp(_0x1aee3b)[_0xd3a1('0x34')](function(_0xabd041){var _0xb87475={'id':_0x132bee+'_'+_0xabd041[_0xd3a1('0xbd')],'name':_0xabd041[_0xd3a1('0xd6')][_0xd3a1('0xd4')]?_0xabd041[_0xd3a1('0xd6')][_0xd3a1('0xd4')]['Label']:_0xabd041[_0xd3a1('0xbd')],'custom':![],'options':[]};_0x4b4e08[_0xd3a1('0xc1')](_0xb87475);return _0x4b4e08;});} \ No newline at end of file +var _0x6a0b=['end','status','count','offset','limit','reject','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','type','VIRTUAL','options','include','rows','params','create','body','find','getConfigurations','findOne','Dynamics365Configuration','length','order','sort','addConfiguration','AccountId','Subjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6a0b,0x181));var _0xb6a0=function(_0x38786e,_0x39670d){_0x38786e=_0x38786e-0x0;var _0x5f314a=_0x6a0b[_0x38786e];return _0x5f314a;};'use strict';var pdf=require(_0xb6a0('0x0'));var emlformat=require(_0xb6a0('0x1'));var rimraf=require(_0xb6a0('0x2'));var zipdir=require(_0xb6a0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6a0('0x4'));var moment=require('moment');var BPromise=require(_0xb6a0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb6a0('0x6'));var sox=require(_0xb6a0('0x7'));var csv=require(_0xb6a0('0x8'));var ejs=require(_0xb6a0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6a0('0xa'));var crypto=require(_0xb6a0('0xb'));var jsforce=require(_0xb6a0('0xc'));var deskjs=require(_0xb6a0('0xd'));var toCsv=require(_0xb6a0('0x8'));var querystring=require(_0xb6a0('0xe'));var Papa=require(_0xb6a0('0xf'));var Redis=require(_0xb6a0('0x10'));var authService=require(_0xb6a0('0x11'));var qs=require(_0xb6a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6a0('0x13'))(_0xb6a0('0x14'));var utils=require(_0xb6a0('0x15'));var config=require('../../config/environment');var db=require(_0xb6a0('0x16'))['db'];var integrations=require(_0xb6a0('0x17'));var jayson=require(_0xb6a0('0x18'));var client=jayson[_0xb6a0('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fe9b4,_0x39a2c0,_0x1870a0){if(_0x1870a0){var _0x28a8da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28a8da[_0xb6a0('0x1a')](_0x39a2c0)){return _0x4fe9b4;}else{throw new db[(_0xb6a0('0x1b'))][(_0xb6a0('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 _0x4fe9b4;}}function respondWithRpcPromise(_0x46a01c,_0xb8115b,_0x3c63a4,_0x2a7abe){return new BPromise(function(_0x2954ba,_0x8428c){var _0x9a7457=_0x2a7abe||client;return _0x9a7457[_0xb6a0('0x1d')](_0x46a01c,_0x3c63a4)[_0xb6a0('0x1e')](function(_0x18c4d1){logger[_0xb6a0('0x1f')](_0xb6a0('0x20'),_0xb8115b,_0xb6a0('0x21'));logger[_0xb6a0('0x22')](_0xb6a0('0x23'),_0xb8115b,_0xb6a0('0x21'),JSON[_0xb6a0('0x24')](_0x18c4d1));if(_0x18c4d1['error']){if(_0x18c4d1[_0xb6a0('0x25')]['code']===0x1f4){logger[_0xb6a0('0x25')](_0xb6a0('0x20'),_0xb8115b,_0x18c4d1[_0xb6a0('0x25')][_0xb6a0('0x26')]);return _0x8428c(_0x18c4d1[_0xb6a0('0x25')][_0xb6a0('0x26')]);}logger[_0xb6a0('0x25')](_0xb6a0('0x20'),_0xb8115b,_0x18c4d1[_0xb6a0('0x25')]['message']);return _0x2954ba(_0x18c4d1[_0xb6a0('0x25')][_0xb6a0('0x26')]);}else{logger[_0xb6a0('0x1f')](_0xb6a0('0x20'),_0xb8115b,_0xb6a0('0x21'));_0x2954ba(_0x18c4d1['result'][_0xb6a0('0x26')]);}})[_0xb6a0('0x27')](function(_0x1e8f0f){logger[_0xb6a0('0x25')](_0xb6a0('0x20'),_0xb8115b,_0x1e8f0f);_0x8428c(_0x1e8f0f);});});}function respondWithStatusCode(_0x1b1c37,_0x19a847){_0x19a847=_0x19a847||0xcc;return function(_0x45b4fd){if(_0x45b4fd){return _0x1b1c37[_0xb6a0('0x28')](_0x19a847);}return _0x1b1c37['status'](_0x19a847)[_0xb6a0('0x29')]();};}function respondWithResult(_0x5b29ff,_0x13b3d6){_0x13b3d6=_0x13b3d6||0xc8;return function(_0x1082d2){if(_0x1082d2){return _0x5b29ff[_0xb6a0('0x2a')](_0x13b3d6)['json'](_0x1082d2);}};}function respondWithFilteredResult(_0x5d95b7,_0x31ffe4){return function(_0x517b34){if(_0x517b34){var _0x1318e2=_0x517b34[_0xb6a0('0x2b')],_0x372e32=_0x31ffe4[_0xb6a0('0x2c')],_0x324aea=_0x31ffe4['offset']+_0x31ffe4[_0xb6a0('0x2d')],_0x5410d0;if(_0x324aea>=_0x1318e2){_0x324aea=_0x1318e2;_0x5410d0=0xc8;}else{_0x5410d0=0xce;}_0x5d95b7[_0xb6a0('0x2a')](_0x5410d0);return _0x5d95b7['set']('Content-Range',_0x372e32+'-'+_0x324aea+'/'+_0x1318e2)['json'](_0x517b34);}return null;};}function patchUpdates(_0x209886){return function(_0x3f194b){try{jsonpatch['apply'](_0x3f194b,_0x209886,!![]);}catch(_0xc17466){return BPromise[_0xb6a0('0x2e')](_0xc17466);}return _0x3f194b['save']();};}function saveUpdates(_0x59515a,_0x141a2e){return function(_0x431117){if(_0x431117){return _0x431117[_0xb6a0('0x2f')](_0x59515a)[_0xb6a0('0x1e')](function(_0x43cc6e){return _0x43cc6e;});}return null;};}function removeEntity(_0x5ee216,_0xf3134d){return function(_0x148350){if(_0x148350){return _0x148350[_0xb6a0('0x30')]()[_0xb6a0('0x1e')](function(){_0x5ee216['status'](0xcc)[_0xb6a0('0x29')]();});}};}function handleEntityNotFound(_0xab4acc,_0x44b728){return function(_0x1da7c9){if(!_0x1da7c9){_0xab4acc['sendStatus'](0x194);}return _0x1da7c9;};}function handleError(_0x1fb847,_0x4fcdc8){_0x4fcdc8=_0x4fcdc8||0x1f4;return function(_0x120448){logger['error'](_0x120448[_0xb6a0('0x31')]);if(_0x120448[_0xb6a0('0x32')]){delete _0x120448[_0xb6a0('0x32')];}_0x1fb847[_0xb6a0('0x2a')](_0x4fcdc8)[_0xb6a0('0x33')](_0x120448);};}exports[_0xb6a0('0x34')]=function(_0x34e2b3,_0x4b57f1){var _0x40a6b0={},_0x5d4f4b={},_0x4b41d6={'count':0x0,'rows':[]};var _0x337f09=_[_0xb6a0('0x35')](db[_0xb6a0('0x36')][_0xb6a0('0x37')],function(_0x5a9cad){return{'name':_0x5a9cad[_0xb6a0('0x38')],'type':_0x5a9cad['type'][_0xb6a0('0x39')]};});_0x5d4f4b['model']=_[_0xb6a0('0x35')](_0x337f09,'name');_0x5d4f4b['query']=_[_0xb6a0('0x3a')](_0x34e2b3[_0xb6a0('0x3b')]);_0x5d4f4b['filters']=_[_0xb6a0('0x3c')](_0x5d4f4b[_0xb6a0('0x3d')],_0x5d4f4b[_0xb6a0('0x3b')]);_0x40a6b0[_0xb6a0('0x3e')]=_[_0xb6a0('0x3c')](_0x5d4f4b[_0xb6a0('0x3d')],qs[_0xb6a0('0x3f')](_0x34e2b3[_0xb6a0('0x3b')][_0xb6a0('0x3f')]));_0x40a6b0[_0xb6a0('0x3e')]=_0x40a6b0['attributes']['length']?_0x40a6b0[_0xb6a0('0x3e')]:_0x5d4f4b[_0xb6a0('0x3d')];if(!_0x34e2b3['query'][_0xb6a0('0x40')](_0xb6a0('0x41'))){_0x40a6b0['limit']=qs['limit'](_0x34e2b3[_0xb6a0('0x3b')][_0xb6a0('0x2d')]);_0x40a6b0[_0xb6a0('0x2c')]=qs['offset'](_0x34e2b3[_0xb6a0('0x3b')]['offset']);}_0x40a6b0['order']=qs['sort'](_0x34e2b3['query']['sort']);_0x40a6b0[_0xb6a0('0x42')]=qs[_0xb6a0('0x43')](_[_0xb6a0('0x44')](_0x34e2b3[_0xb6a0('0x3b')],_0x5d4f4b[_0xb6a0('0x43')]),_0x337f09);if(_0x34e2b3['query'][_0xb6a0('0x45')]){_0x40a6b0[_0xb6a0('0x42')]=_[_0xb6a0('0x46')](_0x40a6b0[_0xb6a0('0x42')],{'$or':_[_0xb6a0('0x35')](_0x337f09,function(_0x5db37c){if(_0x5db37c[_0xb6a0('0x47')]!==_0xb6a0('0x48')){var _0x56dda6={};_0x56dda6[_0x5db37c['name']]={'$like':'%'+_0x34e2b3[_0xb6a0('0x3b')][_0xb6a0('0x45')]+'%'};return _0x56dda6;}})});}_0x40a6b0=_[_0xb6a0('0x46')]({},_0x40a6b0,_0x34e2b3[_0xb6a0('0x49')]);var _0x439bba={'where':_0x40a6b0[_0xb6a0('0x42')]};return db[_0xb6a0('0x36')]['count'](_0x439bba)['then'](function(_0x11750c){_0x4b41d6['count']=_0x11750c;if(_0x34e2b3[_0xb6a0('0x3b')]['includeAll']){_0x40a6b0[_0xb6a0('0x4a')]=[{'all':!![]}];}return db[_0xb6a0('0x36')]['findAll'](_0x40a6b0);})['then'](function(_0x495e12){_0x4b41d6[_0xb6a0('0x4b')]=_0x495e12;return _0x4b41d6;})[_0xb6a0('0x1e')](respondWithFilteredResult(_0x4b57f1,_0x40a6b0))[_0xb6a0('0x27')](handleError(_0x4b57f1,null));};exports['show']=function(_0x18e8e3,_0x3bb2a7){var _0x3d6ffc={'raw':![],'where':{'id':_0x18e8e3[_0xb6a0('0x4c')]['id']}},_0x1af221={};_0x1af221['model']=_['keys'](db[_0xb6a0('0x36')][_0xb6a0('0x37')]);_0x1af221['query']=_['keys'](_0x18e8e3[_0xb6a0('0x3b')]);_0x1af221['filters']=_[_0xb6a0('0x3c')](_0x1af221[_0xb6a0('0x3d')],_0x1af221[_0xb6a0('0x3b')]);_0x3d6ffc['attributes']=_[_0xb6a0('0x3c')](_0x1af221['model'],qs['fields'](_0x18e8e3[_0xb6a0('0x3b')][_0xb6a0('0x3f')]));_0x3d6ffc[_0xb6a0('0x3e')]=_0x3d6ffc[_0xb6a0('0x3e')]['length']?_0x3d6ffc[_0xb6a0('0x3e')]:_0x1af221[_0xb6a0('0x3d')];if(_0x18e8e3[_0xb6a0('0x3b')]['includeAll']){_0x3d6ffc[_0xb6a0('0x4a')]=[{'all':!![]}];}_0x3d6ffc=_['merge']({},_0x3d6ffc,_0x18e8e3[_0xb6a0('0x49')]);return db['Dynamics365Account']['find'](_0x3d6ffc)['then'](handleEntityNotFound(_0x3bb2a7,null))[_0xb6a0('0x1e')](respondWithResult(_0x3bb2a7,null))[_0xb6a0('0x27')](handleError(_0x3bb2a7,null));};exports[_0xb6a0('0x4d')]=function(_0x5e2b4d,_0x35c326){return db[_0xb6a0('0x36')][_0xb6a0('0x4d')](_0x5e2b4d[_0xb6a0('0x4e')],{})['then'](respondWithResult(_0x35c326,0xc9))[_0xb6a0('0x27')](handleError(_0x35c326,null));};exports['update']=function(_0x28556a,_0x241da0){if(_0x28556a[_0xb6a0('0x4e')]['id']){delete _0x28556a[_0xb6a0('0x4e')]['id'];}return db['Dynamics365Account'][_0xb6a0('0x4f')]({'where':{'id':_0x28556a[_0xb6a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x241da0,null))[_0xb6a0('0x1e')](saveUpdates(_0x28556a[_0xb6a0('0x4e')],null))[_0xb6a0('0x1e')](respondWithResult(_0x241da0,null))[_0xb6a0('0x27')](handleError(_0x241da0,null));};exports[_0xb6a0('0x30')]=function(_0x12c2bb,_0x2ff94d){return db['Dynamics365Account']['find']({'where':{'id':_0x12c2bb[_0xb6a0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ff94d,null))['then'](removeEntity(_0x2ff94d,null))[_0xb6a0('0x27')](handleError(_0x2ff94d,null));};exports[_0xb6a0('0x50')]=function(_0xd4ba23,_0x24666a,_0x1c9c62){var _0x4536e4={};var _0x42fba5={};var _0x271424;var _0x319d9d;return db['Dynamics365Account'][_0xb6a0('0x51')]({'where':{'id':_0xd4ba23[_0xb6a0('0x4c')]['id']}})[_0xb6a0('0x1e')](handleEntityNotFound(_0x24666a,null))[_0xb6a0('0x1e')](function(_0x510f41){if(_0x510f41){_0x271424=_0x510f41;_0x42fba5['model']=_[_0xb6a0('0x3a')](db[_0xb6a0('0x52')][_0xb6a0('0x37')]);_0x42fba5[_0xb6a0('0x3b')]=_[_0xb6a0('0x3a')](_0xd4ba23['query']);_0x42fba5[_0xb6a0('0x43')]=_[_0xb6a0('0x3c')](_0x42fba5[_0xb6a0('0x3d')],_0x42fba5[_0xb6a0('0x3b')]);_0x4536e4[_0xb6a0('0x3e')]=_[_0xb6a0('0x3c')](_0x42fba5[_0xb6a0('0x3d')],qs[_0xb6a0('0x3f')](_0xd4ba23[_0xb6a0('0x3b')]['fields']));_0x4536e4[_0xb6a0('0x3e')]=_0x4536e4['attributes'][_0xb6a0('0x53')]?_0x4536e4[_0xb6a0('0x3e')]:_0x42fba5[_0xb6a0('0x3d')];_0x4536e4[_0xb6a0('0x54')]=qs[_0xb6a0('0x55')](_0xd4ba23[_0xb6a0('0x3b')][_0xb6a0('0x55')]);_0x4536e4[_0xb6a0('0x42')]=qs['filters'](_[_0xb6a0('0x44')](_0xd4ba23[_0xb6a0('0x3b')],_0x42fba5['filters']));if(_0xd4ba23[_0xb6a0('0x3b')]['filter']){_0x4536e4[_0xb6a0('0x42')]=_[_0xb6a0('0x46')](_0x4536e4[_0xb6a0('0x42')],{'$or':_[_0xb6a0('0x35')](_0x4536e4[_0xb6a0('0x3e')],function(_0x1a86b1){var _0x1d362a={};_0x1d362a[_0x1a86b1]={'$like':'%'+_0xd4ba23[_0xb6a0('0x3b')]['filter']+'%'};return _0x1d362a;})});}_0x4536e4=_['merge']({},_0x4536e4,_0xd4ba23[_0xb6a0('0x49')]);return _0x271424[_0xb6a0('0x50')](_0x4536e4);}})[_0xb6a0('0x1e')](function(_0x1e83cd){if(_0x1e83cd){_0x319d9d=_0x1e83cd[_0xb6a0('0x53')];if(!_0xd4ba23['query'][_0xb6a0('0x40')](_0xb6a0('0x41'))){_0x4536e4[_0xb6a0('0x2d')]=qs[_0xb6a0('0x2d')](_0xd4ba23[_0xb6a0('0x3b')][_0xb6a0('0x2d')]);_0x4536e4['offset']=qs[_0xb6a0('0x2c')](_0xd4ba23['query'][_0xb6a0('0x2c')]);}return _0x271424[_0xb6a0('0x50')](_0x4536e4);}})['then'](function(_0x4de1fd){if(_0x4de1fd){return _0x4de1fd?{'count':_0x319d9d,'rows':_0x4de1fd}:null;}})[_0xb6a0('0x1e')](respondWithResult(_0x24666a,null))[_0xb6a0('0x27')](handleError(_0x24666a,null));};exports[_0xb6a0('0x56')]=function(_0x3d5522,_0x275297,_0x3fdc3b){if(_0x3d5522[_0xb6a0('0x4e')]['id']){delete _0x3d5522[_0xb6a0('0x4e')]['id'];}return db['Dynamics365Account'][_0xb6a0('0x51')]({'where':{'id':_0x3d5522[_0xb6a0('0x4c')]['id']}})[_0xb6a0('0x1e')](handleEntityNotFound(_0x275297,null))[_0xb6a0('0x1e')](function(_0x5be1ea){if(_0x5be1ea){_0x3d5522[_0xb6a0('0x4e')][_0xb6a0('0x57')]=_0x5be1ea['id'];_0x3d5522[_0xb6a0('0x4e')][_0xb6a0('0x58')]=integrations['getSubjects'](_0x3d5522[_0xb6a0('0x4e')][_0xb6a0('0x59')],_0x3d5522[_0xb6a0('0x4e')][_0xb6a0('0x47')]);_0x3d5522[_0xb6a0('0x4e')]['Descriptions']=integrations[_0xb6a0('0x5a')](_0x3d5522['body']['channel'],_0x3d5522['body'][_0xb6a0('0x47')]);return db[_0xb6a0('0x52')][_0xb6a0('0x4d')](_0x3d5522['body'],{'include':[{'model':db[_0xb6a0('0x5b')],'as':_0xb6a0('0x58')},{'model':db['Dynamics365Field'],'as':_0xb6a0('0x5c')}]});}return null;})[_0xb6a0('0x1e')](respondWithResult(_0x275297,null))[_0xb6a0('0x27')](handleError(_0x275297,null));};exports[_0xb6a0('0x5d')]=function(_0x2fd17e,_0x329ed8,_0x129fae){var _0x5122c5=_0x2fd17e[_0xb6a0('0x3b')][_0xb6a0('0x5e')];var _0x193e2e=_0x5122c5===_0xb6a0('0x5f')?_0xb6a0('0x60'):_0xb6a0('0x61');var _0x2d148a='';var _0x5d9410='';var _0x4e5c16='';var _0x2b2207='';var _0x4e9dd7='';var _0x171621='';var _0x540347='';var _0x4f647b='';var _0x40fe47=[_0xb6a0('0x62'),_0xb6a0('0x63'),_0xb6a0('0x64'),_0xb6a0('0x65'),'caseorigincode','subject',_0xb6a0('0x66'),_0xb6a0('0x67'),_0xb6a0('0x68'),_0xb6a0('0x69')];var _0x34a8b8=[_0xb6a0('0x6a'),'accountidyominame',_0xb6a0('0x6b'),_0xb6a0('0x6c'),'contactidname',_0xb6a0('0x6d'),_0xb6a0('0x6e'),_0xb6a0('0x6f'),'createdbyexternalpartyname',_0xb6a0('0x70'),_0xb6a0('0x71'),_0xb6a0('0x72'),'createdon',_0xb6a0('0x73'),'createdonbehalfbyyominame',_0xb6a0('0x74'),'customeridtype','customeridyominame',_0xb6a0('0x75'),_0xb6a0('0x76'),_0xb6a0('0x77'),_0xb6a0('0x78'),'escalatedon',_0xb6a0('0x79'),'firstresponsebykpiidname',_0xb6a0('0x7a'),'importsequencenumber',_0xb6a0('0x7b'),'kbarticleidname',_0xb6a0('0x7c'),'masteridname',_0xb6a0('0x7d'),_0xb6a0('0x7e'),_0xb6a0('0x7f'),_0xb6a0('0x80'),_0xb6a0('0x81'),_0xb6a0('0x82'),_0xb6a0('0x83'),'msdyn_incidenttypename',_0xb6a0('0x84'),_0xb6a0('0x85'),_0xb6a0('0x86'),_0xb6a0('0x87'),_0xb6a0('0x88'),'owneridtype','owneridyominame',_0xb6a0('0x89'),_0xb6a0('0x8a'),_0xb6a0('0x8b'),_0xb6a0('0x8c'),_0xb6a0('0x8d'),_0xb6a0('0x8e'),_0xb6a0('0x8f'),_0xb6a0('0x90'),_0xb6a0('0x91'),'responsiblecontactidname',_0xb6a0('0x92'),_0xb6a0('0x93'),'slainvokedidname',_0xb6a0('0x94'),_0xb6a0('0x95'),'statecode',_0xb6a0('0x96'),_0xb6a0('0x97'),_0xb6a0('0x98'),_0xb6a0('0x99'),_0xb6a0('0x9a'),_0xb6a0('0x9b'),'utcconversiontimezonecode',_0xb6a0('0x9c')];var _0x2e052e=_0x40fe47[_0xb6a0('0x9d')](_0x34a8b8);return db[_0xb6a0('0x36')][_0xb6a0('0x51')]({'where':{'id':_0x2fd17e[_0xb6a0('0x4c')]['id']},'attributes':['id',_0xb6a0('0x9e'),_0xb6a0('0x9f'),_0xb6a0('0xa0'),_0xb6a0('0xa1'),_0xb6a0('0xa2'),_0xb6a0('0xa3')]})[_0xb6a0('0x1e')](handleEntityNotFound(_0x329ed8,null))[_0xb6a0('0x1e')](function(_0x4e7f1a){if(_0x4e7f1a){_0x4f647b=_0x4e7f1a[_0xb6a0('0xa0')];var _0xea6c58=_0x4f647b['slice'](-0x1);if(_0xea6c58==='/'){_0x4f647b=_0x4f647b[_0xb6a0('0xa4')](0x0,_0x4f647b[_0xb6a0('0xa5')](_0xea6c58));}_0x540347=util[_0xb6a0('0xa6')](_0xb6a0('0xa7'),_0x4f647b);var _0x149e77={'method':_0xb6a0('0xa8'),'uri':_0xb6a0('0xa9')+_0x4e7f1a[_0xb6a0('0xa1')]+_0xb6a0('0xaa'),'form':{'client_id':_0x4e7f1a[_0xb6a0('0xa2')],'resource':_0x4f647b,'username':_0x4e7f1a[_0xb6a0('0x9e')],'password':_0x4e7f1a[_0xb6a0('0x9f')],'grant_type':'password','client_secret':_0x4e7f1a[_0xb6a0('0xa3')]},'json':!![]};return rp(_0x149e77);}})[_0xb6a0('0x1e')](function(_0xd050bd){_0x171621=_0xd050bd[_0xb6a0('0xab')];var _0x5963e1={'method':_0xb6a0('0xac'),'uri':encodeURI(_0x540347+_0xb6a0('0xad')+_0x193e2e+'\x27'),'headers':{'Authorization':_0xb6a0('0xae')+_0x171621,'If-None-Match':null,'OData-Version':_0xb6a0('0xaf')},'json':!![]};return rp(_0x5963e1);})[_0xb6a0('0x1e')](function(_0x941af){var _0x38bf4a=_0x941af[_0xb6a0('0xb0')][0x0];var _0x2f2e11=_0x38bf4a[_0xb6a0('0xb1')];var _0x1ac2e0={'method':_0xb6a0('0xac'),'uri':_0x540347+'EntityDefinitions('+_0x2f2e11+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xb6a0('0xae')+_0x171621,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ac2e0);})[_0xb6a0('0x1e')](function(_0x33562a){_0x2d148a=_0x33562a;_0x5d9410=_0x2d148a[_0xb6a0('0xb2')];_0x5d9410=_[_0xb6a0('0xb3')](_0x5d9410,function(_0x1df33d){return!_0x2e052e[_0xb6a0('0xb4')](_0x1df33d[_0xb6a0('0xb5')]);});var _0x571e23=[];var _0x1c9c81=[];_0x5d9410[_0xb6a0('0xb6')](function(_0x4f5c28){if(_0x4f5c28[_0xb6a0('0xb7')]){var _0x500316=_0x4f5c28[_0xb6a0('0xb7')][_0xb6a0('0xa4')](_0x4f5c28[_0xb6a0('0xb7')][_0xb6a0('0xa5')]('.')+0x1);if(_0x500316===_0xb6a0('0xb8')){_0x571e23[_0xb6a0('0xb9')](getSelectList(_0x540347,_0x5122c5,_0x1c9c81,_0x2d148a['MetadataId'],_0x4f5c28[_0xb6a0('0xb1')],_0x171621));}}});return Promise[_0xb6a0('0xba')](_0x571e23);})['then'](function(_0x1cb2af){_0x4e5c16=_0x1cb2af[0x0];var _0xa1770c=[];var _0x216e5c=[];_0x5d9410[_0xb6a0('0xb6')](function(_0x3fc105){if(!_[_0xb6a0('0xbb')](_0x3fc105[_0xb6a0('0xb7')])){var _0x27f222=_0x3fc105['@odata.type'][_0xb6a0('0xa4')](_0x3fc105[_0xb6a0('0xb7')][_0xb6a0('0xa5')]('.')+0x1);if(_0x27f222===_0xb6a0('0xbc')){_0xa1770c['push'](getBooleanList(_0x540347,_0x5122c5,_0x216e5c,_0x2d148a['MetadataId'],_0x3fc105['MetadataId'],_0x171621));}}});return Promise['all'](_0xa1770c);})[_0xb6a0('0x1e')](function(_0x339bb0){_0x2b2207=_0x339bb0[0x0];var _0xb7502c=[];var _0xb9a726=[];_0x5d9410[_0xb6a0('0xb6')](function(_0x4faae1){if(_0x4faae1[_0xb6a0('0xb7')]){var _0x363168=_0x4faae1['@odata.type']['substring'](_0x4faae1[_0xb6a0('0xb7')][_0xb6a0('0xa5')]('.')+0x1);if(_0x363168==='StringAttributeMetadata'||_0x363168===_0xb6a0('0xbd')||_0x363168===_0xb6a0('0xbe')||_0x363168===_0xb6a0('0xbf')||_0x363168===_0xb6a0('0xc0')||_0x363168==='DateTimeAttributeMetadata'||_0x363168===_0xb6a0('0xc1')||_0x363168===_0xb6a0('0xc2')||_0x363168==='StateAttributeMetadata'||_0x363168==='DecimalAttributeMetadata'){_0xb7502c[_0xb6a0('0xb9')](getInputList(_0x540347,_0x5122c5,_0x363168,_0xb9a726,_0x2d148a['MetadataId'],_0x4faae1[_0xb6a0('0xb1')],_0x171621));}}});return Promise['all'](_0xb7502c);})['then'](function(_0xea5012){_0x4e9dd7=_0xea5012[0x0];var _0x3161cc=_0x4e5c16[_0xb6a0('0x9d')](_0x2b2207)[_0xb6a0('0x9d')](_0x4e9dd7);var _0x12b066={'count':_0x3161cc[_0xb6a0('0x53')],'rows':_0x3161cc};return _0x12b066;})['then'](respondWithResult(_0x329ed8,null))[_0xb6a0('0x27')](function(_0x2c48e5){var _0x47fb33=_0x2fd17e[_0xb6a0('0x3b')][_0xb6a0('0x1a')]?0x1f4:_0x2c48e5[_0xb6a0('0xc3')]||0x1f4;logger[_0xb6a0('0x25')](_0x2c48e5[_0xb6a0('0x31')]);delete _0x2c48e5[_0xb6a0('0x32')];if(_0x47fb33===0x191){_0x47fb33=0x190;}_0x329ed8['status'](_0x47fb33)[_0xb6a0('0x33')](_0x2fd17e[_0xb6a0('0x3b')][_0xb6a0('0x1a')]?{'message':_0xb6a0('0xc4'),'statusCode':_0x2c48e5[_0xb6a0('0xc3')]}:_0x2c48e5);});};function getSelectList(_0x5176cc,_0x4df758,_0x558368,_0x989a0e,_0x41f5ff,_0x553d6e){var _0x35cc5a={'method':_0xb6a0('0xac'),'uri':_0x5176cc+_0xb6a0('0xc5')+_0x989a0e+_0xb6a0('0xc6')+_0x41f5ff+_0xb6a0('0xc7')+_0xb6a0('0xc8'),'headers':{'Authorization':'Bearer\x20'+_0x553d6e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35cc5a)[_0xb6a0('0x1e')](function(_0x4f0efa){var _0x3a4162=[];var _0x50ef2d=_0x4f0efa['OptionSet'][_0xb6a0('0xc9')];_0x50ef2d['forEach'](function(_0x7c7bec){_0x3a4162['push']({'name':_0x7c7bec[_0xb6a0('0xca')]['UserLocalizedLabel']['Label'],'value':String(_0x7c7bec['Value'])});});var _0xf3da1e={'id':_0x4df758+'_'+_0x4f0efa[_0xb6a0('0xb5')],'name':_0x4f0efa[_0xb6a0('0xcb')][_0xb6a0('0xcc')][_0xb6a0('0xca')],'custom':![],'options':_0x3a4162};_0x558368['push'](_0xf3da1e);return _0x558368;});}function getBooleanList(_0x2ebf20,_0x5eac74,_0x28ffe4,_0x8c7a48,_0x4939d5,_0x1d0ff8){var _0x529d5e={'method':_0xb6a0('0xac'),'uri':_0x2ebf20+_0xb6a0('0xc5')+_0x8c7a48+_0xb6a0('0xc6')+_0x4939d5+_0xb6a0('0xcd'),'headers':{'Authorization':_0xb6a0('0xae')+_0x1d0ff8,'If-None-Match':null,'OData-Version':_0xb6a0('0xaf')},'json':!![]};return rp(_0x529d5e)[_0xb6a0('0x1e')](function(_0x4011b5){var _0x126205=[];_0x126205['push']({'name':_0x4011b5[_0xb6a0('0xce')][_0xb6a0('0xcf')][_0xb6a0('0xca')][_0xb6a0('0xcc')]['Label'],'value':_0xb6a0('0xd0')},{'name':_0x4011b5[_0xb6a0('0xce')][_0xb6a0('0xd1')][_0xb6a0('0xca')][_0xb6a0('0xcc')]['Label'],'value':_0xb6a0('0xd2')});var _0xc4ea72={'id':_0x5eac74+'_'+_0x4011b5[_0xb6a0('0xb5')],'name':_0x4011b5[_0xb6a0('0xcb')][_0xb6a0('0xcc')][_0xb6a0('0xca')],'custom':![],'options':_0x126205};_0x28ffe4[_0xb6a0('0xb9')](_0xc4ea72);return _0x28ffe4;});}function getInputList(_0x38a38c,_0x3ab96a,_0x238588,_0x20a16e,_0x27a4da,_0x1e1573,_0x22322f){var _0x21c934={'method':_0xb6a0('0xac'),'uri':_0x38a38c+'EntityDefinitions('+_0x27a4da+_0xb6a0('0xc6')+_0x1e1573+_0xb6a0('0xd3')+_0x238588+_0xb6a0('0xd4'),'headers':{'Authorization':'Bearer\x20'+_0x22322f,'If-None-Match':null,'OData-Version':_0xb6a0('0xaf')},'json':!![]};return rp(_0x21c934)['then'](function(_0x262d00){var _0x2af8c0={'id':_0x3ab96a+'_'+_0x262d00[_0xb6a0('0xb5')],'name':_0x262d00[_0xb6a0('0xcb')]['UserLocalizedLabel']?_0x262d00['DisplayName'][_0xb6a0('0xcc')][_0xb6a0('0xca')]:_0x262d00[_0xb6a0('0xb5')],'custom':![],'options':[]};_0x20a16e['push'](_0x2af8c0);return _0x20a16e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 32bd1fc..a084d6d 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 _0x66ce=['request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','util','../../config/logger','api','bluebird'];(function(_0x567985,_0x41366e){var _0x523f82=function(_0x83dd2c){while(--_0x83dd2c){_0x567985['push'](_0x567985['shift']());}};_0x523f82(++_0x41366e);}(_0x66ce,0x96));var _0xe66c=function(_0x1e4aa6,_0x2273b4){_0x1e4aa6=_0x1e4aa6-0x0;var _0x8457e0=_0x66ce[_0x1e4aa6];return _0x8457e0;};'use strict';var _=require('lodash');var util=require(_0xe66c('0x0'));var logger=require(_0xe66c('0x1'))(_0xe66c('0x2'));var moment=require('moment');var BPromise=require(_0xe66c('0x3'));var rp=require(_0xe66c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe66c('0x5'));var config=require(_0xe66c('0x6'));var attributes=require(_0xe66c('0x7'));var integrations=require(_0xe66c('0x8'));module[_0xe66c('0x9')]=function(_0x44faa1,_0xd67aa5){return _0x44faa1[_0xe66c('0xa')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb3=['api','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x551730,_0x41e422){var _0x33fe7f=function(_0x3a0851){while(--_0x3a0851){_0x551730['push'](_0x551730['shift']());}};_0x33fe7f(++_0x41e422);}(_0x7fb3,0xf9));var _0x37fb=function(_0x58f29c,_0x551df2){_0x58f29c=_0x58f29c-0x0;var _0x5266ed=_0x7fb3[_0x58f29c];return _0x5266ed;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var logger=require(_0x37fb('0x2'))(_0x37fb('0x3'));var moment=require('moment');var BPromise=require(_0x37fb('0x4'));var rp=require(_0x37fb('0x5'));var fs=require('fs');var path=require(_0x37fb('0x6'));var rimraf=require(_0x37fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fb('0x8'));var integrations=require(_0x37fb('0x9'));module[_0x37fb('0xa')]=function(_0x23a839,_0x144254){return _0x23a839[_0x37fb('0xb')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 056e947..2e7a689 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 _0x965d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','options','raw','where','limit','include','model','attributes','map','stringify','find','ShowDynamics365Account','catch','lodash','util'];(function(_0xbabc3d,_0x33535d){var _0x22cbae=function(_0x211fb0){while(--_0x211fb0){_0xbabc3d['push'](_0xbabc3d['shift']());}};_0x22cbae(++_0x33535d);}(_0x965d,0x1be));var _0xd965=function(_0x2575e9,_0x36117b){_0x2575e9=_0x2575e9-0x0;var _0x5d898e=_0x965d[_0x2575e9];return _0x5d898e;};'use strict';var _=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rs=require(_0xd965('0x3'));var fs=require('fs');var Redis=require(_0xd965('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd965('0x5'));var logger=require(_0xd965('0x6'))(_0xd965('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9b86,_0x368f36,_0x5772e3){return new BPromise(function(_0x427868,_0x563c33){return client[_0xd965('0x8')](_0x2f9b86,_0x5772e3)[_0xd965('0x9')](function(_0xa4f9f9){logger[_0xd965('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x368f36,_0xd965('0xb'));logger[_0xd965('0xc')](_0xd965('0xd'),_0x368f36,'request\x20sent',JSON['stringify'](_0xa4f9f9));if(_0xa4f9f9['error']){if(_0xa4f9f9['error'][_0xd965('0xe')]===0x1f4){logger[_0xd965('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x563c33(_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);}logger[_0xd965('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x368f36,_0xa4f9f9[_0xd965('0xf')][_0xd965('0x10')]);return _0x427868(_0xa4f9f9['error']['message']);}else{logger['info'](_0xd965('0x11'),_0x368f36,_0xd965('0xb'));_0x427868(_0xa4f9f9[_0xd965('0x12')][_0xd965('0x10')]);}})['catch'](function(_0x439eca){logger[_0xd965('0xf')](_0xd965('0x11'),_0x368f36,_0x439eca);_0x563c33(_0x439eca);});});}exports[_0xd965('0x13')]=function(_0x45f930){var _0x5dbaff=this;return new Promise(function(_0x1321c1,_0x5e4659){return db['Dynamics365Account']['findAll']({'raw':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')][_0xd965('0x15')]===undefined?!![]:![]:!![],'where':_0x45f930[_0xd965('0x14')]?_0x45f930['options'][_0xd965('0x16')]||null:null,'attributes':_0x45f930[_0xd965('0x14')]?_0x45f930[_0xd965('0x14')]['attributes']||null:null,'limit':_0x45f930['options']?_0x45f930['options'][_0xd965('0x17')]||null:null,'include':_0x45f930['options']?_0x45f930[_0xd965('0x14')][_0xd965('0x18')]?_['map'](_0x45f930['options'][_0xd965('0x18')],function(_0x140000){return{'model':db[_0x140000[_0xd965('0x19')]],'as':_0x140000['as'],'attributes':_0x140000[_0xd965('0x1a')],'include':_0x140000[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x140000[_0xd965('0x18')],function(_0x1a7367){return{'model':db[_0x1a7367[_0xd965('0x19')]],'as':_0x1a7367['as'],'attributes':_0x1a7367[_0xd965('0x1a')],'include':_0x1a7367[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x1a7367['include'],function(_0x3d8899){return{'model':db[_0x3d8899[_0xd965('0x19')]],'as':_0x3d8899['as'],'attributes':_0x3d8899['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d6a07){logger['info']('GetDynamics365Account',_0x45f930);logger[_0xd965('0xc')](_0xd965('0x13'),_0x45f930,JSON[_0xd965('0x1c')](_0x4d6a07));_0x1321c1(_0x4d6a07);})['catch'](function(_0x20b8b9){logger[_0xd965('0xf')](_0xd965('0x13'),_0x20b8b9['message'],_0x45f930);_0x5e4659(_0x5dbaff[_0xd965('0xf')](0x1f4,_0x20b8b9['message']));});});};exports['ShowDynamics365Account']=function(_0x5ac01e){var _0x26379d=this;return new Promise(function(_0x5d2d32,_0x29b600){return db['Dynamics365Account'][_0xd965('0x1d')]({'raw':_0x5ac01e[_0xd965('0x14')]?_0x5ac01e[_0xd965('0x14')][_0xd965('0x15')]===undefined?!![]:![]:!![],'where':_0x5ac01e['options']?_0x5ac01e[_0xd965('0x14')][_0xd965('0x16')]||null:null,'attributes':_0x5ac01e['options']?_0x5ac01e[_0xd965('0x14')][_0xd965('0x1a')]||null:null,'include':_0x5ac01e['options']?_0x5ac01e[_0xd965('0x14')]['include']?_[_0xd965('0x1b')](_0x5ac01e[_0xd965('0x14')][_0xd965('0x18')],function(_0x3e32b6){return{'model':db[_0x3e32b6['model']],'as':_0x3e32b6['as'],'attributes':_0x3e32b6[_0xd965('0x1a')],'include':_0x3e32b6[_0xd965('0x18')]?_['map'](_0x3e32b6[_0xd965('0x18')],function(_0x15286){return{'model':db[_0x15286[_0xd965('0x19')]],'as':_0x15286['as'],'attributes':_0x15286[_0xd965('0x1a')],'include':_0x15286[_0xd965('0x18')]?_[_0xd965('0x1b')](_0x15286['include'],function(_0x1f8b8d){return{'model':db[_0x1f8b8d['model']],'as':_0x1f8b8d['as'],'attributes':_0x1f8b8d[_0xd965('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd965('0x9')](function(_0x49caa7){logger[_0xd965('0xa')](_0xd965('0x1e'),_0x5ac01e);logger[_0xd965('0xc')](_0xd965('0x1e'),_0x5ac01e,JSON[_0xd965('0x1c')](_0x49caa7));_0x5d2d32(_0x49caa7);})[_0xd965('0x1f')](function(_0x2ee2a3){logger[_0xd965('0xf')](_0xd965('0x1e'),_0x2ee2a3[_0xd965('0x10')],_0x5ac01e);_0x29b600(_0x26379d['error'](0x1f4,_0x2ee2a3[_0xd965('0x10')]));});});}; \ No newline at end of file +var _0xd206=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Account,\x20%s,\x20%s','info','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','Dynamics365Account','find','ShowDynamics365Account','lodash'];(function(_0x2d7e6b,_0xf31f6){var _0x2060b9=function(_0x257e38){while(--_0x257e38){_0x2d7e6b['push'](_0x2d7e6b['shift']());}};_0x2060b9(++_0xf31f6);}(_0xd206,0x107));var _0x6d20=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xd206[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var moment=require('moment');var BPromise=require(_0x6d20('0x2'));var rs=require(_0x6d20('0x3'));var fs=require('fs');var Redis=require(_0x6d20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d20('0x5'));var logger=require(_0x6d20('0x6'))(_0x6d20('0x7'));var config=require(_0x6d20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc981,_0x125a39,_0x3080fb){return new BPromise(function(_0x5b4154,_0x2b338c){return client['request'](_0x4dc981,_0x3080fb)[_0x6d20('0xa')](function(_0x4222dc){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x125a39,'request\x20sent');logger[_0x6d20('0xb')](_0x6d20('0xc'),_0x125a39,'request\x20sent',JSON[_0x6d20('0xd')](_0x4222dc));if(_0x4222dc['error']){if(_0x4222dc[_0x6d20('0xe')]['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x125a39,_0x4222dc['error'][_0x6d20('0xf')]);return _0x2b338c(_0x4222dc[_0x6d20('0xe')][_0x6d20('0xf')]);}logger[_0x6d20('0xe')](_0x6d20('0x10'),_0x125a39,_0x4222dc[_0x6d20('0xe')]['message']);return _0x5b4154(_0x4222dc[_0x6d20('0xe')]['message']);}else{logger[_0x6d20('0x11')](_0x6d20('0x10'),_0x125a39,'request\x20sent');_0x5b4154(_0x4222dc[_0x6d20('0x12')][_0x6d20('0xf')]);}})[_0x6d20('0x13')](function(_0x133cd0){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x125a39,_0x133cd0);_0x2b338c(_0x133cd0);});});}exports[_0x6d20('0x14')]=function(_0x12fad7){var _0x4f938f=this;return new Promise(function(_0x10b87,_0x5040df){return db['Dynamics365Account'][_0x6d20('0x15')]({'raw':_0x12fad7[_0x6d20('0x16')]?_0x12fad7[_0x6d20('0x16')][_0x6d20('0x17')]===undefined?!![]:![]:!![],'where':_0x12fad7['options']?_0x12fad7[_0x6d20('0x16')][_0x6d20('0x18')]||null:null,'attributes':_0x12fad7[_0x6d20('0x16')]?_0x12fad7[_0x6d20('0x16')][_0x6d20('0x19')]||null:null,'limit':_0x12fad7[_0x6d20('0x16')]?_0x12fad7[_0x6d20('0x16')][_0x6d20('0x1a')]||null:null,'include':_0x12fad7[_0x6d20('0x16')]?_0x12fad7[_0x6d20('0x16')]['include']?_[_0x6d20('0x1b')](_0x12fad7['options'][_0x6d20('0x1c')],function(_0x4db5ba){return{'model':db[_0x4db5ba[_0x6d20('0x1d')]],'as':_0x4db5ba['as'],'attributes':_0x4db5ba[_0x6d20('0x19')],'include':_0x4db5ba[_0x6d20('0x1c')]?_[_0x6d20('0x1b')](_0x4db5ba[_0x6d20('0x1c')],function(_0x20054c){return{'model':db[_0x20054c[_0x6d20('0x1d')]],'as':_0x20054c['as'],'attributes':_0x20054c[_0x6d20('0x19')],'include':_0x20054c[_0x6d20('0x1c')]?_[_0x6d20('0x1b')](_0x20054c[_0x6d20('0x1c')],function(_0x5a50a9){return{'model':db[_0x5a50a9[_0x6d20('0x1d')]],'as':_0x5a50a9['as'],'attributes':_0x5a50a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d20('0xa')](function(_0x29c2d3){logger[_0x6d20('0x11')](_0x6d20('0x14'),_0x12fad7);logger[_0x6d20('0xb')]('GetDynamics365Account',_0x12fad7,JSON[_0x6d20('0xd')](_0x29c2d3));_0x10b87(_0x29c2d3);})[_0x6d20('0x13')](function(_0x4f9c49){logger[_0x6d20('0xe')]('GetDynamics365Account',_0x4f9c49[_0x6d20('0xf')],_0x12fad7);_0x5040df(_0x4f938f[_0x6d20('0xe')](0x1f4,_0x4f9c49[_0x6d20('0xf')]));});});};exports['ShowDynamics365Account']=function(_0xbb5adc){var _0x1bbf05=this;return new Promise(function(_0x404921,_0x3cbb12){return db[_0x6d20('0x1e')][_0x6d20('0x1f')]({'raw':_0xbb5adc[_0x6d20('0x16')]?_0xbb5adc[_0x6d20('0x16')][_0x6d20('0x17')]===undefined?!![]:![]:!![],'where':_0xbb5adc[_0x6d20('0x16')]?_0xbb5adc[_0x6d20('0x16')][_0x6d20('0x18')]||null:null,'attributes':_0xbb5adc['options']?_0xbb5adc[_0x6d20('0x16')][_0x6d20('0x19')]||null:null,'include':_0xbb5adc[_0x6d20('0x16')]?_0xbb5adc[_0x6d20('0x16')]['include']?_['map'](_0xbb5adc[_0x6d20('0x16')][_0x6d20('0x1c')],function(_0x2c8912){return{'model':db[_0x2c8912[_0x6d20('0x1d')]],'as':_0x2c8912['as'],'attributes':_0x2c8912['attributes'],'include':_0x2c8912[_0x6d20('0x1c')]?_[_0x6d20('0x1b')](_0x2c8912[_0x6d20('0x1c')],function(_0x414cf2){return{'model':db[_0x414cf2[_0x6d20('0x1d')]],'as':_0x414cf2['as'],'attributes':_0x414cf2[_0x6d20('0x19')],'include':_0x414cf2[_0x6d20('0x1c')]?_[_0x6d20('0x1b')](_0x414cf2['include'],function(_0x423053){return{'model':db[_0x423053['model']],'as':_0x423053['as'],'attributes':_0x423053[_0x6d20('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6d20('0xa')](function(_0x2580f8){logger[_0x6d20('0x11')]('ShowDynamics365Account',_0xbb5adc);logger[_0x6d20('0xb')]('ShowDynamics365Account',_0xbb5adc,JSON[_0x6d20('0xd')](_0x2580f8));_0x404921(_0x2580f8);})[_0x6d20('0x13')](function(_0x42d684){logger[_0x6d20('0xe')](_0x6d20('0x20'),_0x42d684[_0x6d20('0xf')],_0xbb5adc);_0x3cbb12(_0x1bbf05['error'](0x1f4,_0x42d684[_0x6d20('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d4404a9..d14c4b8 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 _0x604c=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getDescriptions','create'];(function(_0x49bdbb,_0x4e7f92){var _0x1f2843=function(_0x3f5042){while(--_0x3f5042){_0x49bdbb['push'](_0x49bdbb['shift']());}};_0x1f2843(++_0x4e7f92);}(_0x604c,0x6e));var _0xc604=function(_0x589e9f,_0x11318e){_0x589e9f=_0x589e9f-0x0;var _0x2bd5f1=_0x604c[_0x589e9f];return _0x2bd5f1;};'use strict';var multer=require('multer');var util=require(_0xc604('0x0'));var path=require(_0xc604('0x1'));var timeout=require(_0xc604('0x2'));var express=require(_0xc604('0x3'));var router=express[_0xc604('0x4')]();var auth=require(_0xc604('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc604('0x6'));var controller=require(_0xc604('0x7'));router[_0xc604('0x8')]('/',auth[_0xc604('0x9')](),controller['index']);router[_0xc604('0x8')](_0xc604('0xa'),auth[_0xc604('0x9')](),controller[_0xc604('0xb')]);router[_0xc604('0x8')]('/:id/fields',auth[_0xc604('0x9')](),controller[_0xc604('0xc')]);router[_0xc604('0x8')](_0xc604('0xd'),auth[_0xc604('0x9')](),controller['getSubjects']);router[_0xc604('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc604('0xe')]);router['post']('/',auth[_0xc604('0x9')](),controller[_0xc604('0xf')]);router[_0xc604('0x10')](_0xc604('0xa'),auth[_0xc604('0x9')](),controller[_0xc604('0x11')]);router[_0xc604('0x12')](_0xc604('0xa'),auth[_0xc604('0x9')](),controller[_0xc604('0x13')]);module[_0xc604('0x14')]=router; \ No newline at end of file +var _0x48bb=['./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x16367b,_0x48c89f){var _0x11c35b=function(_0x4c1b74){while(--_0x4c1b74){_0x16367b['push'](_0x16367b['shift']());}};_0x11c35b(++_0x48c89f);}(_0x48bb,0x1f3));var _0xb48b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x48bb[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xb48b('0x0'));var util=require('util');var path=require(_0xb48b('0x1'));var timeout=require(_0xb48b('0x2'));var express=require(_0xb48b('0x3'));var router=express['Router']();var auth=require(_0xb48b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb48b('0x5'));router['get']('/',auth[_0xb48b('0x6')](),controller[_0xb48b('0x7')]);router[_0xb48b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb48b('0x8')](_0xb48b('0x9'),auth[_0xb48b('0x6')](),controller[_0xb48b('0xa')]);router[_0xb48b('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb48b('0xb')]);router[_0xb48b('0x8')](_0xb48b('0xc'),auth[_0xb48b('0x6')](),controller[_0xb48b('0xd')]);router[_0xb48b('0xe')]('/',auth[_0xb48b('0x6')](),controller[_0xb48b('0xf')]);router[_0xb48b('0x10')](_0xb48b('0x11'),auth[_0xb48b('0x6')](),controller[_0xb48b('0x12')]);router[_0xb48b('0x13')](_0xb48b('0x11'),auth[_0xb48b('0x6')](),controller[_0xb48b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6b82849..c20b7ce 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 _0xc622=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc622,0x19e));var _0x2c62=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0xc622[_0x47199b];return _0x390911;};'use strict';var Sequelize=require(_0x2c62('0x0'));module[_0x2c62('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c62('0x2')]},'ticketType':{'type':Sequelize[_0x2c62('0x3')](_0x2c62('0x4'),_0x2c62('0x5')),'defaultValue':_0x2c62('0x4')}}; \ No newline at end of file +var _0x80a1=['STRING','incident','phonecall','sequelize','exports'];(function(_0x55c776,_0xf33bd0){var _0x5a6d31=function(_0x46eb77){while(--_0x46eb77){_0x55c776['push'](_0x55c776['shift']());}};_0x5a6d31(++_0xf33bd0);}(_0x80a1,0xf8));var _0x180a=function(_0x2b8ce9,_0x157372){_0x2b8ce9=_0x2b8ce9-0x0;var _0x3ed19e=_0x80a1[_0x2b8ce9];return _0x3ed19e;};'use strict';var Sequelize=require(_0x180a('0x0'));module[_0x180a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x180a('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x180a('0x3'),_0x180a('0x4')),'defaultValue':_0x180a('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ffa0392..bf9917a 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 _0xc606=['filters','pick','filter','type','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','rows','show','params','find','create','body','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x495ee8,_0x2b915d){var _0x5e3f5b=function(_0x5b4401){while(--_0x5b4401){_0x495ee8['push'](_0x495ee8['shift']());}};_0x5e3f5b(++_0x2b915d);}(_0xc606,0x135));var _0x6c60=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xc606[_0x2a55f8];return _0x245efd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6c60('0x0'));var zipdir=require(_0x6c60('0x1'));var jsonpatch=require(_0x6c60('0x2'));var rp=require(_0x6c60('0x3'));var moment=require(_0x6c60('0x4'));var BPromise=require(_0x6c60('0x5'));var Mustache=require(_0x6c60('0x6'));var util=require(_0x6c60('0x7'));var path=require('path');var sox=require(_0x6c60('0x8'));var csv=require(_0x6c60('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c60('0xa'));var squel=require(_0x6c60('0xb'));var crypto=require(_0x6c60('0xc'));var jsforce=require(_0x6c60('0xd'));var deskjs=require(_0x6c60('0xe'));var toCsv=require(_0x6c60('0x9'));var querystring=require(_0x6c60('0xf'));var Papa=require(_0x6c60('0x10'));var Redis=require(_0x6c60('0x11'));var authService=require(_0x6c60('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6c60('0x13'));var hardwareService=require(_0x6c60('0x14'));var logger=require('../../config/logger')(_0x6c60('0x15'));var utils=require('../../config/utils');var config=require(_0x6c60('0x16'));var db=require(_0x6c60('0x17'))['db'];var jayson=require(_0x6c60('0x18'));var client=jayson[_0x6c60('0x19')][_0x6c60('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x48ca9e,_0x5ce98e,_0x40c9e4){if(_0x40c9e4){var _0x9a9098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9a9098[_0x6c60('0x1b')](_0x5ce98e)){return _0x48ca9e;}else{throw new db[(_0x6c60('0x1c'))][(_0x6c60('0x1d'))](_0x6c60('0x1e'));}}else{return _0x48ca9e;}}function respondWithRpcPromise(_0x27bcd9,_0x5050d3,_0xb9ef1f,_0x4075a6){return new BPromise(function(_0x18db2a,_0x34ca5b){var _0x5b6ade=_0x4075a6||client;return _0x5b6ade[_0x6c60('0x1f')](_0x27bcd9,_0xb9ef1f)[_0x6c60('0x20')](function(_0xb8bb9a){logger[_0x6c60('0x21')](_0x6c60('0x22'),_0x5050d3,_0x6c60('0x23'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5050d3,'request\x20sent',JSON[_0x6c60('0x24')](_0xb8bb9a));if(_0xb8bb9a['error']){if(_0xb8bb9a[_0x6c60('0x25')][_0x6c60('0x26')]===0x1f4){logger[_0x6c60('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5050d3,_0xb8bb9a[_0x6c60('0x25')][_0x6c60('0x27')]);return _0x34ca5b(_0xb8bb9a[_0x6c60('0x25')][_0x6c60('0x27')]);}logger[_0x6c60('0x25')](_0x6c60('0x22'),_0x5050d3,_0xb8bb9a[_0x6c60('0x25')][_0x6c60('0x27')]);return _0x18db2a(_0xb8bb9a[_0x6c60('0x25')][_0x6c60('0x27')]);}else{logger[_0x6c60('0x21')](_0x6c60('0x22'),_0x5050d3,'request\x20sent');_0x18db2a(_0xb8bb9a[_0x6c60('0x28')]['message']);}})[_0x6c60('0x29')](function(_0x2c72c9){logger['error'](_0x6c60('0x22'),_0x5050d3,_0x2c72c9);_0x34ca5b(_0x2c72c9);});});}function respondWithStatusCode(_0xb26c15,_0x2ac5fe){_0x2ac5fe=_0x2ac5fe||0xcc;return function(_0x101ae7){if(_0x101ae7){return _0xb26c15['sendStatus'](_0x2ac5fe);}return _0xb26c15['status'](_0x2ac5fe)[_0x6c60('0x2a')]();};}function respondWithResult(_0x57ba9f,_0x50257c){_0x50257c=_0x50257c||0xc8;return function(_0x3583e4){if(_0x3583e4){return _0x57ba9f[_0x6c60('0x2b')](_0x50257c)[_0x6c60('0x2c')](_0x3583e4);}};}function respondWithFilteredResult(_0x3b95ff,_0x282f1a){return function(_0x1fe85a){if(_0x1fe85a){var _0x204562=_0x1fe85a[_0x6c60('0x2d')],_0x3418c1=_0x282f1a['offset'],_0xbaaa6f=_0x282f1a[_0x6c60('0x2e')]+_0x282f1a[_0x6c60('0x2f')],_0x8fae1b;if(_0xbaaa6f>=_0x204562){_0xbaaa6f=_0x204562;_0x8fae1b=0xc8;}else{_0x8fae1b=0xce;}_0x3b95ff[_0x6c60('0x2b')](_0x8fae1b);return _0x3b95ff[_0x6c60('0x30')](_0x6c60('0x31'),_0x3418c1+'-'+_0xbaaa6f+'/'+_0x204562)[_0x6c60('0x2c')](_0x1fe85a);}return null;};}function patchUpdates(_0x21cdec){return function(_0x48f893){try{jsonpatch[_0x6c60('0x32')](_0x48f893,_0x21cdec,!![]);}catch(_0x256151){return BPromise['reject'](_0x256151);}return _0x48f893[_0x6c60('0x33')]();};}function saveUpdates(_0x43dfb4,_0x4a18a5){return function(_0x215467){if(_0x215467){return _0x215467[_0x6c60('0x34')](_0x43dfb4)[_0x6c60('0x20')](function(_0x420937){return _0x420937;});}return null;};}function removeEntity(_0x2c1140,_0x55b2f4){return function(_0x488920){if(_0x488920){return _0x488920[_0x6c60('0x35')]()[_0x6c60('0x20')](function(){_0x2c1140[_0x6c60('0x2b')](0xcc)[_0x6c60('0x2a')]();});}};}function handleEntityNotFound(_0x3c48c9,_0x9a37f9){return function(_0x4e32d3){if(!_0x4e32d3){_0x3c48c9[_0x6c60('0x36')](0x194);}return _0x4e32d3;};}function handleError(_0x19d190,_0x262c9a){_0x262c9a=_0x262c9a||0x1f4;return function(_0x354e4b){logger[_0x6c60('0x25')](_0x354e4b[_0x6c60('0x37')]);if(_0x354e4b['name']){delete _0x354e4b[_0x6c60('0x38')];}_0x19d190[_0x6c60('0x2b')](_0x262c9a)[_0x6c60('0x39')](_0x354e4b);};}exports[_0x6c60('0x3a')]=function(_0x3e85f9,_0x5e3a0e){var _0x5b4231={},_0x5ee688={},_0x15708b={'count':0x0,'rows':[]};var _0x5ca688=_['map'](db['Dynamics365Configuration'][_0x6c60('0x3b')],function(_0x4eb2d7){return{'name':_0x4eb2d7[_0x6c60('0x3c')],'type':_0x4eb2d7['type'][_0x6c60('0x3d')]};});_0x5ee688[_0x6c60('0x3e')]=_[_0x6c60('0x3f')](_0x5ca688,_0x6c60('0x38'));_0x5ee688[_0x6c60('0x40')]=_[_0x6c60('0x41')](_0x3e85f9['query']);_0x5ee688['filters']=_[_0x6c60('0x42')](_0x5ee688[_0x6c60('0x3e')],_0x5ee688[_0x6c60('0x40')]);_0x5b4231[_0x6c60('0x43')]=_[_0x6c60('0x42')](_0x5ee688['model'],qs[_0x6c60('0x44')](_0x3e85f9[_0x6c60('0x40')][_0x6c60('0x44')]));_0x5b4231[_0x6c60('0x43')]=_0x5b4231[_0x6c60('0x43')][_0x6c60('0x45')]?_0x5b4231['attributes']:_0x5ee688['model'];if(!_0x3e85f9['query'][_0x6c60('0x46')](_0x6c60('0x47'))){_0x5b4231['limit']=qs['limit'](_0x3e85f9[_0x6c60('0x40')][_0x6c60('0x2f')]);_0x5b4231[_0x6c60('0x2e')]=qs[_0x6c60('0x2e')](_0x3e85f9[_0x6c60('0x40')][_0x6c60('0x2e')]);}_0x5b4231[_0x6c60('0x48')]=qs[_0x6c60('0x49')](_0x3e85f9['query'][_0x6c60('0x49')]);_0x5b4231[_0x6c60('0x4a')]=qs[_0x6c60('0x4b')](_[_0x6c60('0x4c')](_0x3e85f9[_0x6c60('0x40')],_0x5ee688[_0x6c60('0x4b')]),_0x5ca688);if(_0x3e85f9['query'][_0x6c60('0x4d')]){_0x5b4231[_0x6c60('0x4a')]=_['merge'](_0x5b4231[_0x6c60('0x4a')],{'$or':_[_0x6c60('0x3f')](_0x5ca688,function(_0x37f430){if(_0x37f430[_0x6c60('0x4e')]!==_0x6c60('0x4f')){var _0x27f218={};_0x27f218[_0x37f430[_0x6c60('0x38')]]={'$like':'%'+_0x3e85f9[_0x6c60('0x40')][_0x6c60('0x4d')]+'%'};return _0x27f218;}})});}_0x5b4231=_[_0x6c60('0x50')]({},_0x5b4231,_0x3e85f9[_0x6c60('0x51')]);var _0x1ba881={'where':_0x5b4231['where']};return db[_0x6c60('0x52')][_0x6c60('0x2d')](_0x1ba881)[_0x6c60('0x20')](function(_0x2022b1){_0x15708b[_0x6c60('0x2d')]=_0x2022b1;if(_0x3e85f9[_0x6c60('0x40')][_0x6c60('0x53')]){_0x5b4231[_0x6c60('0x54')]=[{'all':!![]}];}return db[_0x6c60('0x52')]['findAll'](_0x5b4231);})[_0x6c60('0x20')](function(_0x588a5a){_0x15708b[_0x6c60('0x55')]=_0x588a5a;return _0x15708b;})[_0x6c60('0x20')](respondWithFilteredResult(_0x5e3a0e,_0x5b4231))[_0x6c60('0x29')](handleError(_0x5e3a0e,null));};exports[_0x6c60('0x56')]=function(_0x3e0a59,_0x5e88c1){var _0x44a4db={'raw':![],'where':{'id':_0x3e0a59[_0x6c60('0x57')]['id']}},_0x4785c6={};_0x4785c6[_0x6c60('0x3e')]=_[_0x6c60('0x41')](db[_0x6c60('0x52')][_0x6c60('0x3b')]);_0x4785c6[_0x6c60('0x40')]=_['keys'](_0x3e0a59[_0x6c60('0x40')]);_0x4785c6['filters']=_['intersection'](_0x4785c6[_0x6c60('0x3e')],_0x4785c6['query']);_0x44a4db[_0x6c60('0x43')]=_[_0x6c60('0x42')](_0x4785c6['model'],qs[_0x6c60('0x44')](_0x3e0a59[_0x6c60('0x40')][_0x6c60('0x44')]));_0x44a4db[_0x6c60('0x43')]=_0x44a4db[_0x6c60('0x43')][_0x6c60('0x45')]?_0x44a4db[_0x6c60('0x43')]:_0x4785c6[_0x6c60('0x3e')];if(_0x3e0a59[_0x6c60('0x40')]['includeAll']){_0x44a4db['include']=[{'all':!![]}];}_0x44a4db=_[_0x6c60('0x50')]({},_0x44a4db,_0x3e0a59[_0x6c60('0x51')]);return db[_0x6c60('0x52')][_0x6c60('0x58')](_0x44a4db)[_0x6c60('0x20')](handleEntityNotFound(_0x5e88c1,null))['then'](respondWithResult(_0x5e88c1,null))[_0x6c60('0x29')](handleError(_0x5e88c1,null));};exports[_0x6c60('0x59')]=function(_0x56f98c,_0x1f7ef5){return db[_0x6c60('0x52')]['create'](_0x56f98c[_0x6c60('0x5a')],{})[_0x6c60('0x20')](respondWithResult(_0x1f7ef5,0xc9))[_0x6c60('0x29')](handleError(_0x1f7ef5,null));};exports[_0x6c60('0x34')]=function(_0x23c8a8,_0x3d6605){if(_0x23c8a8['body']['id']){delete _0x23c8a8[_0x6c60('0x5a')]['id'];}return db['Dynamics365Configuration'][_0x6c60('0x58')]({'where':{'id':_0x23c8a8[_0x6c60('0x57')]['id']}})[_0x6c60('0x20')](handleEntityNotFound(_0x3d6605,null))[_0x6c60('0x20')](saveUpdates(_0x23c8a8['body'],null))[_0x6c60('0x20')](respondWithResult(_0x3d6605,null))[_0x6c60('0x29')](handleError(_0x3d6605,null));};exports[_0x6c60('0x35')]=function(_0x318c93,_0x34b118){return db[_0x6c60('0x52')]['find']({'where':{'id':_0x318c93[_0x6c60('0x57')]['id']}})[_0x6c60('0x20')](handleEntityNotFound(_0x34b118,null))['then'](removeEntity(_0x34b118,null))[_0x6c60('0x29')](handleError(_0x34b118,null));};exports[_0x6c60('0x5b')]=function(_0x5213bb,_0x25fbd9,_0x1075d0){var _0x3d5814={};var _0x409be8={};var _0x42c260;var _0x283bdb;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5213bb[_0x6c60('0x57')]['id']}})[_0x6c60('0x20')](handleEntityNotFound(_0x25fbd9,null))[_0x6c60('0x20')](function(_0x3b586c){if(_0x3b586c){_0x42c260=_0x3b586c;_0x409be8[_0x6c60('0x3e')]=_[_0x6c60('0x41')](db[_0x6c60('0x5c')][_0x6c60('0x3b')]);_0x409be8[_0x6c60('0x40')]=_[_0x6c60('0x41')](_0x5213bb[_0x6c60('0x40')]);_0x409be8[_0x6c60('0x4b')]=_[_0x6c60('0x42')](_0x409be8[_0x6c60('0x3e')],_0x409be8['query']);_0x3d5814[_0x6c60('0x43')]=_[_0x6c60('0x42')](_0x409be8[_0x6c60('0x3e')],qs[_0x6c60('0x44')](_0x5213bb['query']['fields']));_0x3d5814[_0x6c60('0x43')]=_0x3d5814[_0x6c60('0x43')]['length']?_0x3d5814[_0x6c60('0x43')]:_0x409be8[_0x6c60('0x3e')];_0x3d5814[_0x6c60('0x48')]=qs['sort'](_0x5213bb[_0x6c60('0x40')][_0x6c60('0x49')]);_0x3d5814[_0x6c60('0x4a')]=qs[_0x6c60('0x4b')](_[_0x6c60('0x4c')](_0x5213bb['query'],_0x409be8[_0x6c60('0x4b')]));if(_0x5213bb[_0x6c60('0x40')][_0x6c60('0x4d')]){_0x3d5814[_0x6c60('0x4a')]=_[_0x6c60('0x50')](_0x3d5814[_0x6c60('0x4a')],{'$or':_[_0x6c60('0x3f')](_0x3d5814[_0x6c60('0x43')],function(_0x1652fe){var _0x443529={};_0x443529[_0x1652fe]={'$like':'%'+_0x5213bb[_0x6c60('0x40')]['filter']+'%'};return _0x443529;})});}_0x3d5814=_[_0x6c60('0x50')]({},_0x3d5814,_0x5213bb[_0x6c60('0x51')]);return _0x42c260['getFields'](_0x3d5814);}})[_0x6c60('0x20')](function(_0x15400f){if(_0x15400f){_0x283bdb=_0x15400f['length'];if(!_0x5213bb[_0x6c60('0x40')][_0x6c60('0x46')](_0x6c60('0x47'))){_0x3d5814['limit']=qs[_0x6c60('0x2f')](_0x5213bb[_0x6c60('0x40')]['limit']);_0x3d5814[_0x6c60('0x2e')]=qs[_0x6c60('0x2e')](_0x5213bb[_0x6c60('0x40')][_0x6c60('0x2e')]);}return _0x42c260[_0x6c60('0x5b')](_0x3d5814);}})[_0x6c60('0x20')](function(_0x5abc3a){if(_0x5abc3a){return _0x5abc3a?{'count':_0x283bdb,'rows':_0x5abc3a}:null;}})[_0x6c60('0x20')](respondWithResult(_0x25fbd9,null))[_0x6c60('0x29')](handleError(_0x25fbd9,null));};exports[_0x6c60('0x5d')]=function(_0x446d6d,_0x1a0074,_0x3978d8){var _0x4e4bf7={};var _0x4a0b05={};var _0x374517;var _0x4fba9c;return db[_0x6c60('0x52')][_0x6c60('0x5e')]({'where':{'id':_0x446d6d[_0x6c60('0x57')]['id']}})[_0x6c60('0x20')](handleEntityNotFound(_0x1a0074,null))[_0x6c60('0x20')](function(_0x10f451){if(_0x10f451){_0x374517=_0x10f451;_0x4a0b05[_0x6c60('0x3e')]=_[_0x6c60('0x41')](db['Dynamics365Field'][_0x6c60('0x3b')]);_0x4a0b05[_0x6c60('0x40')]=_[_0x6c60('0x41')](_0x446d6d[_0x6c60('0x40')]);_0x4a0b05['filters']=_[_0x6c60('0x42')](_0x4a0b05['model'],_0x4a0b05['query']);_0x4e4bf7[_0x6c60('0x43')]=_[_0x6c60('0x42')](_0x4a0b05[_0x6c60('0x3e')],qs[_0x6c60('0x44')](_0x446d6d['query'][_0x6c60('0x44')]));_0x4e4bf7[_0x6c60('0x43')]=_0x4e4bf7[_0x6c60('0x43')][_0x6c60('0x45')]?_0x4e4bf7[_0x6c60('0x43')]:_0x4a0b05[_0x6c60('0x3e')];_0x4e4bf7['order']=qs[_0x6c60('0x49')](_0x446d6d[_0x6c60('0x40')][_0x6c60('0x49')]);_0x4e4bf7[_0x6c60('0x4a')]=qs[_0x6c60('0x4b')](_['pick'](_0x446d6d[_0x6c60('0x40')],_0x4a0b05[_0x6c60('0x4b')]));if(_0x446d6d['query']['filter']){_0x4e4bf7[_0x6c60('0x4a')]=_[_0x6c60('0x50')](_0x4e4bf7['where'],{'$or':_[_0x6c60('0x3f')](_0x4e4bf7[_0x6c60('0x43')],function(_0x2d0eda){var _0x335326={};_0x335326[_0x2d0eda]={'$like':'%'+_0x446d6d[_0x6c60('0x40')][_0x6c60('0x4d')]+'%'};return _0x335326;})});}_0x4e4bf7=_[_0x6c60('0x50')]({},_0x4e4bf7,_0x446d6d[_0x6c60('0x51')]);return _0x374517[_0x6c60('0x5d')](_0x4e4bf7);}})[_0x6c60('0x20')](function(_0x174637){if(_0x174637){_0x4fba9c=_0x174637[_0x6c60('0x45')];if(!_0x446d6d[_0x6c60('0x40')][_0x6c60('0x46')](_0x6c60('0x47'))){_0x4e4bf7['limit']=qs[_0x6c60('0x2f')](_0x446d6d[_0x6c60('0x40')][_0x6c60('0x2f')]);_0x4e4bf7[_0x6c60('0x2e')]=qs['offset'](_0x446d6d[_0x6c60('0x40')][_0x6c60('0x2e')]);}return _0x374517[_0x6c60('0x5d')](_0x4e4bf7);}})[_0x6c60('0x20')](function(_0x29afbd){if(_0x29afbd){return _0x29afbd?{'count':_0x4fba9c,'rows':_0x29afbd}:null;}})['then'](respondWithResult(_0x1a0074,null))[_0x6c60('0x29')](handleError(_0x1a0074,null));};exports['getDescriptions']=function(_0x18aec7,_0x370d37,_0x475c09){var _0x4aa26e={};var _0xc1a51={};var _0x566998;var _0x37c237;return db[_0x6c60('0x52')][_0x6c60('0x5e')]({'where':{'id':_0x18aec7['params']['id']}})['then'](handleEntityNotFound(_0x370d37,null))[_0x6c60('0x20')](function(_0x14186f){if(_0x14186f){_0x566998=_0x14186f;_0xc1a51[_0x6c60('0x3e')]=_[_0x6c60('0x41')](db[_0x6c60('0x5c')]['rawAttributes']);_0xc1a51[_0x6c60('0x40')]=_['keys'](_0x18aec7[_0x6c60('0x40')]);_0xc1a51['filters']=_[_0x6c60('0x42')](_0xc1a51[_0x6c60('0x3e')],_0xc1a51[_0x6c60('0x40')]);_0x4aa26e['attributes']=_[_0x6c60('0x42')](_0xc1a51[_0x6c60('0x3e')],qs[_0x6c60('0x44')](_0x18aec7[_0x6c60('0x40')]['fields']));_0x4aa26e[_0x6c60('0x43')]=_0x4aa26e[_0x6c60('0x43')][_0x6c60('0x45')]?_0x4aa26e[_0x6c60('0x43')]:_0xc1a51['model'];_0x4aa26e['order']=qs[_0x6c60('0x49')](_0x18aec7[_0x6c60('0x40')]['sort']);_0x4aa26e[_0x6c60('0x4a')]=qs[_0x6c60('0x4b')](_['pick'](_0x18aec7[_0x6c60('0x40')],_0xc1a51['filters']));if(_0x18aec7[_0x6c60('0x40')]['filter']){_0x4aa26e['where']=_[_0x6c60('0x50')](_0x4aa26e[_0x6c60('0x4a')],{'$or':_[_0x6c60('0x3f')](_0x4aa26e[_0x6c60('0x43')],function(_0x13a5d0){var _0x1af4f={};_0x1af4f[_0x13a5d0]={'$like':'%'+_0x18aec7[_0x6c60('0x40')][_0x6c60('0x4d')]+'%'};return _0x1af4f;})});}_0x4aa26e=_[_0x6c60('0x50')]({},_0x4aa26e,_0x18aec7['options']);return _0x566998[_0x6c60('0x5f')](_0x4aa26e);}})[_0x6c60('0x20')](function(_0x39a273){if(_0x39a273){_0x37c237=_0x39a273['length'];if(!_0x18aec7[_0x6c60('0x40')][_0x6c60('0x46')]('nolimit')){_0x4aa26e['limit']=qs[_0x6c60('0x2f')](_0x18aec7[_0x6c60('0x40')][_0x6c60('0x2f')]);_0x4aa26e[_0x6c60('0x2e')]=qs['offset'](_0x18aec7['query'][_0x6c60('0x2e')]);}return _0x566998[_0x6c60('0x5f')](_0x4aa26e);}})['then'](function(_0x4b951f){if(_0x4b951f){return _0x4b951f?{'count':_0x37c237,'rows':_0x4b951f}:null;}})['then'](respondWithResult(_0x370d37,null))[_0x6c60('0x29')](handleError(_0x370d37,null));}; \ No newline at end of file +var _0xbfbb=['order','sort','where','pick','VIRTUAL','filter','then','includeAll','findAll','rows','include','merge','options','create','body','find','params','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfbb,0xdc));var _0xbbfb=function(_0x54a36e,_0x4a5c87){_0x54a36e=_0x54a36e-0x0;var _0x26c996=_0xbfbb[_0x54a36e];return _0x26c996;};'use strict';var pdf=require(_0xbbfb('0x0'));var emlformat=require(_0xbbfb('0x1'));var rimraf=require(_0xbbfb('0x2'));var zipdir=require(_0xbbfb('0x3'));var jsonpatch=require(_0xbbfb('0x4'));var rp=require(_0xbbfb('0x5'));var moment=require(_0xbbfb('0x6'));var BPromise=require(_0xbbfb('0x7'));var Mustache=require(_0xbbfb('0x8'));var util=require(_0xbbfb('0x9'));var path=require(_0xbbfb('0xa'));var sox=require(_0xbbfb('0xb'));var csv=require(_0xbbfb('0xc'));var ejs=require(_0xbbfb('0xd'));var fs=require('fs');var _=require(_0xbbfb('0xe'));var squel=require(_0xbbfb('0xf'));var crypto=require(_0xbbfb('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xbbfb('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbbfb('0x12'));var Papa=require(_0xbbfb('0x13'));var Redis=require(_0xbbfb('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbbfb('0x15'));var as=require(_0xbbfb('0x16'));var hardwareService=require(_0xbbfb('0x17'));var logger=require(_0xbbfb('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xbbfb('0x19'));var db=require(_0xbbfb('0x1a'))['db'];var jayson=require(_0xbbfb('0x1b'));var client=jayson['client'][_0xbbfb('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xdea1fd,_0x54743f,_0x3b9957){if(_0x3b9957){var _0x130051=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x130051[_0xbbfb('0x1d')](_0x54743f)){return _0xdea1fd;}else{throw new db[(_0xbbfb('0x1e'))][(_0xbbfb('0x1f'))](_0xbbfb('0x20'));}}else{return _0xdea1fd;}}function respondWithRpcPromise(_0x26fa75,_0x2cfdef,_0x3d9c19,_0x4a900a){return new BPromise(function(_0x1291d8,_0x3dbfba){var _0x288f2f=_0x4a900a||client;return _0x288f2f[_0xbbfb('0x21')](_0x26fa75,_0x3d9c19)['then'](function(_0x18de46){logger[_0xbbfb('0x22')](_0xbbfb('0x23'),_0x2cfdef,_0xbbfb('0x24'));logger[_0xbbfb('0x25')](_0xbbfb('0x26'),_0x2cfdef,'request\x20sent',JSON[_0xbbfb('0x27')](_0x18de46));if(_0x18de46[_0xbbfb('0x28')]){if(_0x18de46[_0xbbfb('0x28')][_0xbbfb('0x29')]===0x1f4){logger[_0xbbfb('0x28')](_0xbbfb('0x23'),_0x2cfdef,_0x18de46[_0xbbfb('0x28')][_0xbbfb('0x2a')]);return _0x3dbfba(_0x18de46[_0xbbfb('0x28')]['message']);}logger['error'](_0xbbfb('0x23'),_0x2cfdef,_0x18de46['error']['message']);return _0x1291d8(_0x18de46['error']['message']);}else{logger[_0xbbfb('0x22')](_0xbbfb('0x23'),_0x2cfdef,_0xbbfb('0x24'));_0x1291d8(_0x18de46[_0xbbfb('0x2b')]['message']);}})[_0xbbfb('0x2c')](function(_0x4b045f){logger[_0xbbfb('0x28')](_0xbbfb('0x23'),_0x2cfdef,_0x4b045f);_0x3dbfba(_0x4b045f);});});}function respondWithStatusCode(_0x4ba36e,_0x433c17){_0x433c17=_0x433c17||0xcc;return function(_0x2a058e){if(_0x2a058e){return _0x4ba36e[_0xbbfb('0x2d')](_0x433c17);}return _0x4ba36e[_0xbbfb('0x2e')](_0x433c17)[_0xbbfb('0x2f')]();};}function respondWithResult(_0x3b0102,_0x367fca){_0x367fca=_0x367fca||0xc8;return function(_0x2d2c41){if(_0x2d2c41){return _0x3b0102[_0xbbfb('0x2e')](_0x367fca)[_0xbbfb('0x30')](_0x2d2c41);}};}function respondWithFilteredResult(_0x26f92f,_0x2abcfb){return function(_0xe645a3){if(_0xe645a3){var _0x2055ae=_0xe645a3[_0xbbfb('0x31')],_0x338359=_0x2abcfb[_0xbbfb('0x32')],_0x4bf6d9=_0x2abcfb[_0xbbfb('0x32')]+_0x2abcfb[_0xbbfb('0x33')],_0x16b393;if(_0x4bf6d9>=_0x2055ae){_0x4bf6d9=_0x2055ae;_0x16b393=0xc8;}else{_0x16b393=0xce;}_0x26f92f[_0xbbfb('0x2e')](_0x16b393);return _0x26f92f[_0xbbfb('0x34')](_0xbbfb('0x35'),_0x338359+'-'+_0x4bf6d9+'/'+_0x2055ae)[_0xbbfb('0x30')](_0xe645a3);}return null;};}function patchUpdates(_0x3b9fbc){return function(_0x3b3437){try{jsonpatch[_0xbbfb('0x36')](_0x3b3437,_0x3b9fbc,!![]);}catch(_0x3c6a6f){return BPromise['reject'](_0x3c6a6f);}return _0x3b3437[_0xbbfb('0x37')]();};}function saveUpdates(_0x2e221c,_0x2557a4){return function(_0x581c31){if(_0x581c31){return _0x581c31[_0xbbfb('0x38')](_0x2e221c)['then'](function(_0x100260){return _0x100260;});}return null;};}function removeEntity(_0x50483a,_0x51098c){return function(_0x5e9acc){if(_0x5e9acc){return _0x5e9acc[_0xbbfb('0x39')]()['then'](function(){_0x50483a['status'](0xcc)[_0xbbfb('0x2f')]();});}};}function handleEntityNotFound(_0x3db78b,_0x888718){return function(_0x4bb197){if(!_0x4bb197){_0x3db78b[_0xbbfb('0x2d')](0x194);}return _0x4bb197;};}function handleError(_0x1a3eb2,_0x5eec38){_0x5eec38=_0x5eec38||0x1f4;return function(_0x2ae646){logger['error'](_0x2ae646[_0xbbfb('0x3a')]);if(_0x2ae646[_0xbbfb('0x3b')]){delete _0x2ae646[_0xbbfb('0x3b')];}_0x1a3eb2['status'](_0x5eec38)[_0xbbfb('0x3c')](_0x2ae646);};}exports[_0xbbfb('0x3d')]=function(_0x5134a9,_0x33b5c8){var _0x2f4859={},_0x41d6ea={},_0x142f2d={'count':0x0,'rows':[]};var _0x248271=_[_0xbbfb('0x3e')](db[_0xbbfb('0x3f')][_0xbbfb('0x40')],function(_0x4b326c){return{'name':_0x4b326c[_0xbbfb('0x41')],'type':_0x4b326c[_0xbbfb('0x42')]['key']};});_0x41d6ea['model']=_['map'](_0x248271,_0xbbfb('0x3b'));_0x41d6ea[_0xbbfb('0x43')]=_[_0xbbfb('0x44')](_0x5134a9[_0xbbfb('0x43')]);_0x41d6ea[_0xbbfb('0x45')]=_[_0xbbfb('0x46')](_0x41d6ea[_0xbbfb('0x47')],_0x41d6ea[_0xbbfb('0x43')]);_0x2f4859[_0xbbfb('0x48')]=_[_0xbbfb('0x46')](_0x41d6ea['model'],qs[_0xbbfb('0x49')](_0x5134a9[_0xbbfb('0x43')][_0xbbfb('0x49')]));_0x2f4859[_0xbbfb('0x48')]=_0x2f4859[_0xbbfb('0x48')][_0xbbfb('0x4a')]?_0x2f4859[_0xbbfb('0x48')]:_0x41d6ea['model'];if(!_0x5134a9['query'][_0xbbfb('0x4b')](_0xbbfb('0x4c'))){_0x2f4859['limit']=qs['limit'](_0x5134a9[_0xbbfb('0x43')]['limit']);_0x2f4859['offset']=qs[_0xbbfb('0x32')](_0x5134a9['query'][_0xbbfb('0x32')]);}_0x2f4859[_0xbbfb('0x4d')]=qs['sort'](_0x5134a9[_0xbbfb('0x43')][_0xbbfb('0x4e')]);_0x2f4859[_0xbbfb('0x4f')]=qs['filters'](_[_0xbbfb('0x50')](_0x5134a9[_0xbbfb('0x43')],_0x41d6ea[_0xbbfb('0x45')]),_0x248271);if(_0x5134a9[_0xbbfb('0x43')]['filter']){_0x2f4859[_0xbbfb('0x4f')]=_['merge'](_0x2f4859['where'],{'$or':_[_0xbbfb('0x3e')](_0x248271,function(_0x59cbe6){if(_0x59cbe6['type']!==_0xbbfb('0x51')){var _0x353d8f={};_0x353d8f[_0x59cbe6['name']]={'$like':'%'+_0x5134a9[_0xbbfb('0x43')][_0xbbfb('0x52')]+'%'};return _0x353d8f;}})});}_0x2f4859=_['merge']({},_0x2f4859,_0x5134a9['options']);var _0x4234b6={'where':_0x2f4859[_0xbbfb('0x4f')]};return db[_0xbbfb('0x3f')][_0xbbfb('0x31')](_0x4234b6)[_0xbbfb('0x53')](function(_0x150a9a){_0x142f2d['count']=_0x150a9a;if(_0x5134a9[_0xbbfb('0x43')][_0xbbfb('0x54')]){_0x2f4859['include']=[{'all':!![]}];}return db[_0xbbfb('0x3f')][_0xbbfb('0x55')](_0x2f4859);})[_0xbbfb('0x53')](function(_0x3fb5c7){_0x142f2d[_0xbbfb('0x56')]=_0x3fb5c7;return _0x142f2d;})[_0xbbfb('0x53')](respondWithFilteredResult(_0x33b5c8,_0x2f4859))['catch'](handleError(_0x33b5c8,null));};exports['show']=function(_0x2fa12c,_0xf25394){var _0x1a21e8={'raw':![],'where':{'id':_0x2fa12c['params']['id']}},_0x186390={};_0x186390['model']=_[_0xbbfb('0x44')](db[_0xbbfb('0x3f')][_0xbbfb('0x40')]);_0x186390['query']=_['keys'](_0x2fa12c['query']);_0x186390[_0xbbfb('0x45')]=_[_0xbbfb('0x46')](_0x186390[_0xbbfb('0x47')],_0x186390[_0xbbfb('0x43')]);_0x1a21e8[_0xbbfb('0x48')]=_[_0xbbfb('0x46')](_0x186390[_0xbbfb('0x47')],qs[_0xbbfb('0x49')](_0x2fa12c[_0xbbfb('0x43')][_0xbbfb('0x49')]));_0x1a21e8[_0xbbfb('0x48')]=_0x1a21e8[_0xbbfb('0x48')][_0xbbfb('0x4a')]?_0x1a21e8[_0xbbfb('0x48')]:_0x186390[_0xbbfb('0x47')];if(_0x2fa12c[_0xbbfb('0x43')]['includeAll']){_0x1a21e8[_0xbbfb('0x57')]=[{'all':!![]}];}_0x1a21e8=_[_0xbbfb('0x58')]({},_0x1a21e8,_0x2fa12c[_0xbbfb('0x59')]);return db[_0xbbfb('0x3f')]['find'](_0x1a21e8)[_0xbbfb('0x53')](handleEntityNotFound(_0xf25394,null))[_0xbbfb('0x53')](respondWithResult(_0xf25394,null))['catch'](handleError(_0xf25394,null));};exports['create']=function(_0x95c211,_0x2ae30f){return db[_0xbbfb('0x3f')][_0xbbfb('0x5a')](_0x95c211[_0xbbfb('0x5b')],{})[_0xbbfb('0x53')](respondWithResult(_0x2ae30f,0xc9))[_0xbbfb('0x2c')](handleError(_0x2ae30f,null));};exports[_0xbbfb('0x38')]=function(_0x4f2456,_0x5adacc){if(_0x4f2456[_0xbbfb('0x5b')]['id']){delete _0x4f2456[_0xbbfb('0x5b')]['id'];}return db[_0xbbfb('0x3f')][_0xbbfb('0x5c')]({'where':{'id':_0x4f2456['params']['id']}})[_0xbbfb('0x53')](handleEntityNotFound(_0x5adacc,null))['then'](saveUpdates(_0x4f2456[_0xbbfb('0x5b')],null))[_0xbbfb('0x53')](respondWithResult(_0x5adacc,null))[_0xbbfb('0x2c')](handleError(_0x5adacc,null));};exports[_0xbbfb('0x39')]=function(_0x43ab97,_0x3f7cbd){return db['Dynamics365Configuration'][_0xbbfb('0x5c')]({'where':{'id':_0x43ab97[_0xbbfb('0x5d')]['id']}})[_0xbbfb('0x53')](handleEntityNotFound(_0x3f7cbd,null))[_0xbbfb('0x53')](removeEntity(_0x3f7cbd,null))[_0xbbfb('0x2c')](handleError(_0x3f7cbd,null));};exports[_0xbbfb('0x5e')]=function(_0x290b7f,_0x34c3cf,_0x47373e){var _0x572adb={};var _0xe9dae7={};var _0x1e10b4;var _0x38a7ef;return db[_0xbbfb('0x3f')][_0xbbfb('0x5f')]({'where':{'id':_0x290b7f[_0xbbfb('0x5d')]['id']}})[_0xbbfb('0x53')](handleEntityNotFound(_0x34c3cf,null))[_0xbbfb('0x53')](function(_0x21f3fc){if(_0x21f3fc){_0x1e10b4=_0x21f3fc;_0xe9dae7[_0xbbfb('0x47')]=_[_0xbbfb('0x44')](db['Dynamics365Field'][_0xbbfb('0x40')]);_0xe9dae7[_0xbbfb('0x43')]=_[_0xbbfb('0x44')](_0x290b7f[_0xbbfb('0x43')]);_0xe9dae7['filters']=_[_0xbbfb('0x46')](_0xe9dae7[_0xbbfb('0x47')],_0xe9dae7['query']);_0x572adb[_0xbbfb('0x48')]=_[_0xbbfb('0x46')](_0xe9dae7[_0xbbfb('0x47')],qs[_0xbbfb('0x49')](_0x290b7f['query'][_0xbbfb('0x49')]));_0x572adb[_0xbbfb('0x48')]=_0x572adb[_0xbbfb('0x48')]['length']?_0x572adb[_0xbbfb('0x48')]:_0xe9dae7[_0xbbfb('0x47')];_0x572adb[_0xbbfb('0x4d')]=qs[_0xbbfb('0x4e')](_0x290b7f[_0xbbfb('0x43')][_0xbbfb('0x4e')]);_0x572adb['where']=qs[_0xbbfb('0x45')](_[_0xbbfb('0x50')](_0x290b7f[_0xbbfb('0x43')],_0xe9dae7['filters']));if(_0x290b7f[_0xbbfb('0x43')][_0xbbfb('0x52')]){_0x572adb[_0xbbfb('0x4f')]=_['merge'](_0x572adb[_0xbbfb('0x4f')],{'$or':_[_0xbbfb('0x3e')](_0x572adb[_0xbbfb('0x48')],function(_0x17916b){var _0x5d73f3={};_0x5d73f3[_0x17916b]={'$like':'%'+_0x290b7f[_0xbbfb('0x43')][_0xbbfb('0x52')]+'%'};return _0x5d73f3;})});}_0x572adb=_[_0xbbfb('0x58')]({},_0x572adb,_0x290b7f[_0xbbfb('0x59')]);return _0x1e10b4[_0xbbfb('0x5e')](_0x572adb);}})['then'](function(_0xbafb00){if(_0xbafb00){_0x38a7ef=_0xbafb00[_0xbbfb('0x4a')];if(!_0x290b7f['query']['hasOwnProperty'](_0xbbfb('0x4c'))){_0x572adb[_0xbbfb('0x33')]=qs[_0xbbfb('0x33')](_0x290b7f[_0xbbfb('0x43')][_0xbbfb('0x33')]);_0x572adb[_0xbbfb('0x32')]=qs[_0xbbfb('0x32')](_0x290b7f[_0xbbfb('0x43')]['offset']);}return _0x1e10b4[_0xbbfb('0x5e')](_0x572adb);}})[_0xbbfb('0x53')](function(_0x20c297){if(_0x20c297){return _0x20c297?{'count':_0x38a7ef,'rows':_0x20c297}:null;}})['then'](respondWithResult(_0x34c3cf,null))[_0xbbfb('0x2c')](handleError(_0x34c3cf,null));};exports[_0xbbfb('0x60')]=function(_0x5332ef,_0x23cdbd,_0x3738a3){var _0x1d6c18={};var _0xe99771={};var _0x5161ad;var _0xddbc41;return db[_0xbbfb('0x3f')]['findOne']({'where':{'id':_0x5332ef[_0xbbfb('0x5d')]['id']}})[_0xbbfb('0x53')](handleEntityNotFound(_0x23cdbd,null))[_0xbbfb('0x53')](function(_0x5aec44){if(_0x5aec44){_0x5161ad=_0x5aec44;_0xe99771[_0xbbfb('0x47')]=_[_0xbbfb('0x44')](db[_0xbbfb('0x61')][_0xbbfb('0x40')]);_0xe99771[_0xbbfb('0x43')]=_[_0xbbfb('0x44')](_0x5332ef[_0xbbfb('0x43')]);_0xe99771[_0xbbfb('0x45')]=_['intersection'](_0xe99771[_0xbbfb('0x47')],_0xe99771[_0xbbfb('0x43')]);_0x1d6c18[_0xbbfb('0x48')]=_[_0xbbfb('0x46')](_0xe99771[_0xbbfb('0x47')],qs[_0xbbfb('0x49')](_0x5332ef[_0xbbfb('0x43')][_0xbbfb('0x49')]));_0x1d6c18[_0xbbfb('0x48')]=_0x1d6c18[_0xbbfb('0x48')][_0xbbfb('0x4a')]?_0x1d6c18[_0xbbfb('0x48')]:_0xe99771[_0xbbfb('0x47')];_0x1d6c18[_0xbbfb('0x4d')]=qs[_0xbbfb('0x4e')](_0x5332ef[_0xbbfb('0x43')][_0xbbfb('0x4e')]);_0x1d6c18[_0xbbfb('0x4f')]=qs[_0xbbfb('0x45')](_[_0xbbfb('0x50')](_0x5332ef[_0xbbfb('0x43')],_0xe99771[_0xbbfb('0x45')]));if(_0x5332ef['query'][_0xbbfb('0x52')]){_0x1d6c18[_0xbbfb('0x4f')]=_['merge'](_0x1d6c18[_0xbbfb('0x4f')],{'$or':_[_0xbbfb('0x3e')](_0x1d6c18[_0xbbfb('0x48')],function(_0x46a284){var _0x3223df={};_0x3223df[_0x46a284]={'$like':'%'+_0x5332ef[_0xbbfb('0x43')][_0xbbfb('0x52')]+'%'};return _0x3223df;})});}_0x1d6c18=_[_0xbbfb('0x58')]({},_0x1d6c18,_0x5332ef[_0xbbfb('0x59')]);return _0x5161ad['getSubjects'](_0x1d6c18);}})[_0xbbfb('0x53')](function(_0x899e6b){if(_0x899e6b){_0xddbc41=_0x899e6b['length'];if(!_0x5332ef[_0xbbfb('0x43')][_0xbbfb('0x4b')](_0xbbfb('0x4c'))){_0x1d6c18[_0xbbfb('0x33')]=qs[_0xbbfb('0x33')](_0x5332ef[_0xbbfb('0x43')][_0xbbfb('0x33')]);_0x1d6c18[_0xbbfb('0x32')]=qs[_0xbbfb('0x32')](_0x5332ef['query']['offset']);}return _0x5161ad[_0xbbfb('0x60')](_0x1d6c18);}})[_0xbbfb('0x53')](function(_0xaeeb2){if(_0xaeeb2){return _0xaeeb2?{'count':_0xddbc41,'rows':_0xaeeb2}:null;}})[_0xbbfb('0x53')](respondWithResult(_0x23cdbd,null))[_0xbbfb('0x2c')](handleError(_0x23cdbd,null));};exports['getDescriptions']=function(_0x38bf0e,_0xdaf531,_0x405a5c){var _0x3cf388={};var _0x1a3be3={};var _0x598e79;var _0x16d645;return db[_0xbbfb('0x3f')][_0xbbfb('0x5f')]({'where':{'id':_0x38bf0e['params']['id']}})['then'](handleEntityNotFound(_0xdaf531,null))[_0xbbfb('0x53')](function(_0xbdf76a){if(_0xbdf76a){_0x598e79=_0xbdf76a;_0x1a3be3['model']=_[_0xbbfb('0x44')](db['Dynamics365Field']['rawAttributes']);_0x1a3be3[_0xbbfb('0x43')]=_['keys'](_0x38bf0e[_0xbbfb('0x43')]);_0x1a3be3[_0xbbfb('0x45')]=_['intersection'](_0x1a3be3[_0xbbfb('0x47')],_0x1a3be3[_0xbbfb('0x43')]);_0x3cf388['attributes']=_[_0xbbfb('0x46')](_0x1a3be3[_0xbbfb('0x47')],qs[_0xbbfb('0x49')](_0x38bf0e['query'][_0xbbfb('0x49')]));_0x3cf388[_0xbbfb('0x48')]=_0x3cf388['attributes'][_0xbbfb('0x4a')]?_0x3cf388[_0xbbfb('0x48')]:_0x1a3be3[_0xbbfb('0x47')];_0x3cf388[_0xbbfb('0x4d')]=qs[_0xbbfb('0x4e')](_0x38bf0e[_0xbbfb('0x43')][_0xbbfb('0x4e')]);_0x3cf388[_0xbbfb('0x4f')]=qs[_0xbbfb('0x45')](_[_0xbbfb('0x50')](_0x38bf0e[_0xbbfb('0x43')],_0x1a3be3[_0xbbfb('0x45')]));if(_0x38bf0e[_0xbbfb('0x43')][_0xbbfb('0x52')]){_0x3cf388['where']=_[_0xbbfb('0x58')](_0x3cf388[_0xbbfb('0x4f')],{'$or':_['map'](_0x3cf388[_0xbbfb('0x48')],function(_0x5bcb25){var _0x59a875={};_0x59a875[_0x5bcb25]={'$like':'%'+_0x38bf0e[_0xbbfb('0x43')][_0xbbfb('0x52')]+'%'};return _0x59a875;})});}_0x3cf388=_[_0xbbfb('0x58')]({},_0x3cf388,_0x38bf0e[_0xbbfb('0x59')]);return _0x598e79[_0xbbfb('0x62')](_0x3cf388);}})['then'](function(_0x4053c2){if(_0x4053c2){_0x16d645=_0x4053c2['length'];if(!_0x38bf0e['query'][_0xbbfb('0x4b')](_0xbbfb('0x4c'))){_0x3cf388[_0xbbfb('0x33')]=qs['limit'](_0x38bf0e[_0xbbfb('0x43')]['limit']);_0x3cf388['offset']=qs[_0xbbfb('0x32')](_0x38bf0e['query'][_0xbbfb('0x32')]);}return _0x598e79[_0xbbfb('0x62')](_0x3cf388);}})[_0xbbfb('0x53')](function(_0x3d9054){if(_0x3d9054){return _0x3d9054?{'count':_0x16d645,'rows':_0x3d9054}:null;}})[_0xbbfb('0x53')](respondWithResult(_0xdaf531,null))['catch'](handleError(_0xdaf531,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7fc4eb9..d5d530b 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 _0x7dd5=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations'];(function(_0x5df35c,_0x2ab072){var _0x5233be=function(_0x52649a){while(--_0x52649a){_0x5df35c['push'](_0x5df35c['shift']());}};_0x5233be(++_0x2ab072);}(_0x7dd5,0x1c8));var _0x57dd=function(_0x1722e9,_0xd07bb){_0x1722e9=_0x1722e9-0x0;var _0x33ddea=_0x7dd5[_0x1722e9];return _0x33ddea;};'use strict';var _=require(_0x57dd('0x0'));var util=require(_0x57dd('0x1'));var logger=require(_0x57dd('0x2'))('api');var moment=require(_0x57dd('0x3'));var BPromise=require(_0x57dd('0x4'));var rp=require(_0x57dd('0x5'));var fs=require('fs');var path=require(_0x57dd('0x6'));var rimraf=require(_0x57dd('0x7'));var config=require(_0x57dd('0x8'));var attributes=require(_0x57dd('0x9'));module['exports']=function(_0xa75c56,_0x5a7c32){return _0xa75c56['define'](_0x57dd('0xa'),attributes,{'tableName':_0x57dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x047a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api'];(function(_0x8ce4b4,_0xc85684){var _0x17722a=function(_0xb8a8a){while(--_0xb8a8a){_0x8ce4b4['push'](_0x8ce4b4['shift']());}};_0x17722a(++_0xc85684);}(_0x047a,0x189));var _0xa047=function(_0x353cd6,_0xc795f6){_0x353cd6=_0x353cd6-0x0;var _0x55712a=_0x047a[_0x353cd6];return _0x55712a;};'use strict';var _=require(_0xa047('0x0'));var util=require('util');var logger=require(_0xa047('0x1'))(_0xa047('0x2'));var moment=require(_0xa047('0x3'));var BPromise=require(_0xa047('0x4'));var rp=require(_0xa047('0x5'));var fs=require('fs');var path=require(_0xa047('0x6'));var rimraf=require(_0xa047('0x7'));var config=require(_0xa047('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x1ec6f3,_0xfdfd6a){return _0x1ec6f3[_0xa047('0x9')](_0xa047('0xa'),attributes,{'tableName':_0xa047('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 1f31b0a..6721bb9 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 _0x524b=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x405f4e,_0x428677){var _0x35a7fc=function(_0x5d175c){while(--_0x5d175c){_0x405f4e['push'](_0x405f4e['shift']());}};_0x35a7fc(++_0x428677);}(_0x524b,0x14a));var _0xb524=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x524b[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xb524('0x0'));var util=require(_0xb524('0x1'));var moment=require(_0xb524('0x2'));var BPromise=require(_0xb524('0x3'));var rs=require(_0xb524('0x4'));var fs=require('fs');var Redis=require(_0xb524('0x5'));var db=require(_0xb524('0x6'))['db'];var utils=require(_0xb524('0x7'));var logger=require('../../config/logger')(_0xb524('0x8'));var config=require('../../config/environment');var jayson=require(_0xb524('0x9'));var client=jayson[_0xb524('0xa')][_0xb524('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x216793,_0x54aeb2,_0x7193c3){return new BPromise(function(_0x72c35f,_0x17b306){return client[_0xb524('0xc')](_0x216793,_0x7193c3)[_0xb524('0xd')](function(_0x5a1c21){logger[_0xb524('0xe')](_0xb524('0xf'),_0x54aeb2,_0xb524('0x10'));logger[_0xb524('0x11')](_0xb524('0x12'),_0x54aeb2,_0xb524('0x10'),JSON[_0xb524('0x13')](_0x5a1c21));if(_0x5a1c21[_0xb524('0x14')]){if(_0x5a1c21['error'][_0xb524('0x15')]===0x1f4){logger[_0xb524('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x54aeb2,_0x5a1c21[_0xb524('0x14')][_0xb524('0x16')]);return _0x17b306(_0x5a1c21[_0xb524('0x14')]['message']);}logger[_0xb524('0x14')](_0xb524('0xf'),_0x54aeb2,_0x5a1c21[_0xb524('0x14')][_0xb524('0x16')]);return _0x72c35f(_0x5a1c21['error'][_0xb524('0x16')]);}else{logger['info'](_0xb524('0xf'),_0x54aeb2,_0xb524('0x10'));_0x72c35f(_0x5a1c21['result'][_0xb524('0x16')]);}})[_0xb524('0x17')](function(_0x5a539c){logger[_0xb524('0x14')](_0xb524('0xf'),_0x54aeb2,_0x5a539c);_0x17b306(_0x5a539c);});});} \ No newline at end of file +var _0x8b99=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x4a4d6e,_0x38ab14){var _0x377fa8=function(_0x46e3cd){while(--_0x46e3cd){_0x4a4d6e['push'](_0x4a4d6e['shift']());}};_0x377fa8(++_0x38ab14);}(_0x8b99,0x78));var _0x98b9=function(_0x3a4894,_0x20f73f){_0x3a4894=_0x3a4894-0x0;var _0x3670db=_0x8b99[_0x3a4894];return _0x3670db;};'use strict';var _=require(_0x98b9('0x0'));var util=require(_0x98b9('0x1'));var moment=require('moment');var BPromise=require(_0x98b9('0x2'));var rs=require(_0x98b9('0x3'));var fs=require('fs');var Redis=require(_0x98b9('0x4'));var db=require(_0x98b9('0x5'))['db'];var utils=require(_0x98b9('0x6'));var logger=require(_0x98b9('0x7'))(_0x98b9('0x8'));var config=require(_0x98b9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9036f5,_0x1294c1,_0xf47cc3){return new BPromise(function(_0x2ad73c,_0x36c982){return client[_0x98b9('0xb')](_0x9036f5,_0xf47cc3)[_0x98b9('0xc')](function(_0x4544d2){logger[_0x98b9('0xd')](_0x98b9('0xe'),_0x1294c1,_0x98b9('0xf'));logger[_0x98b9('0x10')](_0x98b9('0x11'),_0x1294c1,_0x98b9('0xf'),JSON[_0x98b9('0x12')](_0x4544d2));if(_0x4544d2[_0x98b9('0x13')]){if(_0x4544d2[_0x98b9('0x13')][_0x98b9('0x14')]===0x1f4){logger['error'](_0x98b9('0xe'),_0x1294c1,_0x4544d2[_0x98b9('0x13')][_0x98b9('0x15')]);return _0x36c982(_0x4544d2['error'][_0x98b9('0x15')]);}logger[_0x98b9('0x13')](_0x98b9('0xe'),_0x1294c1,_0x4544d2[_0x98b9('0x13')][_0x98b9('0x15')]);return _0x2ad73c(_0x4544d2[_0x98b9('0x13')]['message']);}else{logger[_0x98b9('0xd')](_0x98b9('0xe'),_0x1294c1,_0x98b9('0xf'));_0x2ad73c(_0x4544d2[_0x98b9('0x16')][_0x98b9('0x15')]);}})['catch'](function(_0x127b75){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1294c1,_0x127b75);_0x36c982(_0x127b75);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 87000b4..a9506d7 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 _0x4fef=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x405e23,_0x19b22a){var _0x48cdce=function(_0x268c20){while(--_0x268c20){_0x405e23['push'](_0x405e23['shift']());}};_0x48cdce(++_0x19b22a);}(_0x4fef,0x10f));var _0xf4fe=function(_0x1191ae,_0x425eec){_0x1191ae=_0x1191ae-0x0;var _0x2c8ede=_0x4fef[_0x1191ae];return _0x2c8ede;};'use strict';var multer=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var path=require('path');var timeout=require(_0xf4fe('0x2'));var express=require('express');var router=express[_0xf4fe('0x3')]();var auth=require(_0xf4fe('0x4'));var interaction=require(_0xf4fe('0x5'));var config=require(_0xf4fe('0x6'));var controller=require(_0xf4fe('0x7'));router[_0xf4fe('0x8')]('/',auth[_0xf4fe('0x9')](),controller[_0xf4fe('0xa')]);router['get'](_0xf4fe('0xb'),auth[_0xf4fe('0x9')](),controller['show']);router[_0xf4fe('0xc')]('/',auth[_0xf4fe('0x9')](),controller[_0xf4fe('0xd')]);router[_0xf4fe('0xe')](_0xf4fe('0xb'),auth[_0xf4fe('0x9')](),controller[_0xf4fe('0xf')]);router[_0xf4fe('0x10')]('/:id',auth[_0xf4fe('0x9')](),controller['destroy']);module[_0xf4fe('0x11')]=router; \ No newline at end of file +var _0xda55=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x494223,_0x2c1f71){var _0xdaf98=function(_0x1f790e){while(--_0x1f790e){_0x494223['push'](_0x494223['shift']());}};_0xdaf98(++_0x2c1f71);}(_0xda55,0x6d));var _0x5da5=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0xda55[_0x2b49bc];return _0x43cc65;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var auth=require(_0x5da5('0x4'));var interaction=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x5da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x5da5('0x8')]);router['get'](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xb')]);router[_0x5da5('0xc')]('/',auth[_0x5da5('0xa')](),controller[_0x5da5('0xd')]);router[_0x5da5('0xe')](_0x5da5('0x9'),auth['isAuthenticated'](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0x11')]);module[_0x5da5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index c49936b..e9129aa 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 _0x1d24=['keyValue','string','variable','STRING','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x1d24,0xa7));var _0x41d2=function(_0x4f2801,_0x366dd1){_0x4f2801=_0x4f2801-0x0;var _0x3ac22a=_0x1d24[_0x4f2801];return _0x3ac22a;};'use strict';var Sequelize=require(_0x41d2('0x0'));module[_0x41d2('0x1')]={'type':{'type':Sequelize[_0x41d2('0x2')]('string','variable',_0x41d2('0x3'),_0x41d2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x41d2('0x5'),_0x41d2('0x6'),_0x41d2('0x3'))},'keyContent':{'type':Sequelize[_0x41d2('0x7')]},'idField':{'type':Sequelize[_0x41d2('0x7')]},'nameField':{'type':Sequelize[_0x41d2('0x7')]},'customField':{'type':Sequelize[_0x41d2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41d2('0x7')]}}; \ No newline at end of file +var _0xe85b=['STRING','variable','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x4fb94e,_0x2d93d6){var _0x260409=function(_0x1dd449){while(--_0x1dd449){_0x4fb94e['push'](_0x4fb94e['shift']());}};_0x260409(++_0x2d93d6);}(_0xe85b,0xa3));var _0xbe85=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xe85b[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0xbe85('0x0'));module['exports']={'type':{'type':Sequelize[_0xbe85('0x1')](_0xbe85('0x2'),'variable',_0xbe85('0x3'),_0xbe85('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbe85('0x5')]},'key':{'type':Sequelize[_0xbe85('0x5')]},'keyType':{'type':Sequelize[_0xbe85('0x1')]('string',_0xbe85('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xbe85('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbe85('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbe85('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1a9e42d..d71b5cc 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 _0x1ef8=['html-pdf','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ef8,0xd5));var _0x81ef=function(_0x1479b1,_0x517116){_0x1479b1=_0x1479b1-0x0;var _0x1c2c40=_0x1ef8[_0x1479b1];return _0x1c2c40;};'use strict';var pdf=require(_0x81ef('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x81ef('0x1'));var moment=require(_0x81ef('0x2'));var BPromise=require(_0x81ef('0x3'));var Mustache=require(_0x81ef('0x4'));var util=require(_0x81ef('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x81ef('0x6'));var fs=require('fs');var _=require(_0x81ef('0x7'));var squel=require(_0x81ef('0x8'));var crypto=require(_0x81ef('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x81ef('0xa'));var toCsv=require(_0x81ef('0xb'));var querystring=require(_0x81ef('0xc'));var Papa=require(_0x81ef('0xd'));var Redis=require(_0x81ef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x81ef('0xf'));var as=require(_0x81ef('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81ef('0x11'))(_0x81ef('0x12'));var utils=require(_0x81ef('0x13'));var config=require(_0x81ef('0x14'));var db=require(_0x81ef('0x15'))['db'];function respondWithStatusCode(_0x2d509d,_0x44146c){_0x44146c=_0x44146c||0xcc;return function(_0x39130b){if(_0x39130b){return _0x2d509d[_0x81ef('0x16')](_0x44146c);}return _0x2d509d[_0x81ef('0x17')](_0x44146c)[_0x81ef('0x18')]();};}function respondWithResult(_0x27e013,_0x4d5bcd){_0x4d5bcd=_0x4d5bcd||0xc8;return function(_0x2062cc){if(_0x2062cc){return _0x27e013['status'](_0x4d5bcd)[_0x81ef('0x19')](_0x2062cc);}};}function respondWithFilteredResult(_0x84b6e3,_0x26f0e1){return function(_0x17fed3){if(_0x17fed3){var _0x1a4cb2=_0x17fed3[_0x81ef('0x1a')],_0x238fd6=_0x26f0e1['offset'],_0x144929=_0x26f0e1[_0x81ef('0x1b')]+_0x26f0e1['limit'],_0x416095;if(_0x144929>=_0x1a4cb2){_0x144929=_0x1a4cb2;_0x416095=0xc8;}else{_0x416095=0xce;}_0x84b6e3['status'](_0x416095);return _0x84b6e3[_0x81ef('0x1c')](_0x81ef('0x1d'),_0x238fd6+'-'+_0x144929+'/'+_0x1a4cb2)['json'](_0x17fed3);}return null;};}function patchUpdates(_0x5e8133){return function(_0x3da16a){try{jsonpatch[_0x81ef('0x1e')](_0x3da16a,_0x5e8133,!![]);}catch(_0x23fe66){return BPromise[_0x81ef('0x1f')](_0x23fe66);}return _0x3da16a[_0x81ef('0x20')]();};}function saveUpdates(_0x1b5518,_0x281911){return function(_0x351aa3){if(_0x351aa3){return _0x351aa3[_0x81ef('0x21')](_0x1b5518)[_0x81ef('0x22')](function(_0x219e27){return _0x219e27;});}return null;};}function removeEntity(_0x488ff5,_0x5f49f6){return function(_0xc9192b){if(_0xc9192b){return _0xc9192b[_0x81ef('0x23')]()['then'](function(){_0x488ff5[_0x81ef('0x17')](0xcc)[_0x81ef('0x18')]();});}};}function handleEntityNotFound(_0x39c8f3,_0x2dfa73){return function(_0x4c50d2){if(!_0x4c50d2){_0x39c8f3[_0x81ef('0x16')](0x194);}return _0x4c50d2;};}function handleError(_0x481683,_0x381396){_0x381396=_0x381396||0x1f4;return function(_0x28501a){logger[_0x81ef('0x24')](_0x28501a[_0x81ef('0x25')]);if(_0x28501a[_0x81ef('0x26')]){delete _0x28501a[_0x81ef('0x26')];}_0x481683[_0x81ef('0x17')](_0x381396)['send'](_0x28501a);};}exports[_0x81ef('0x27')]=function(_0x4dff29,_0x20900f){var _0x357cdf={},_0x5ac99f={},_0x137e93={'count':0x0,'rows':[]};var _0x15ae8c=_[_0x81ef('0x28')](db['Dynamics365Field'][_0x81ef('0x29')],function(_0x5f0ca6){return{'name':_0x5f0ca6[_0x81ef('0x2a')],'type':_0x5f0ca6[_0x81ef('0x2b')][_0x81ef('0x2c')]};});_0x5ac99f[_0x81ef('0x2d')]=_[_0x81ef('0x28')](_0x15ae8c,_0x81ef('0x26'));_0x5ac99f[_0x81ef('0x2e')]=_[_0x81ef('0x2f')](_0x4dff29[_0x81ef('0x2e')]);_0x5ac99f[_0x81ef('0x30')]=_[_0x81ef('0x31')](_0x5ac99f[_0x81ef('0x2d')],_0x5ac99f[_0x81ef('0x2e')]);_0x357cdf[_0x81ef('0x32')]=_[_0x81ef('0x31')](_0x5ac99f[_0x81ef('0x2d')],qs[_0x81ef('0x33')](_0x4dff29[_0x81ef('0x2e')][_0x81ef('0x33')]));_0x357cdf['attributes']=_0x357cdf[_0x81ef('0x32')][_0x81ef('0x34')]?_0x357cdf[_0x81ef('0x32')]:_0x5ac99f[_0x81ef('0x2d')];if(!_0x4dff29[_0x81ef('0x2e')]['hasOwnProperty']('nolimit')){_0x357cdf['limit']=qs[_0x81ef('0x35')](_0x4dff29[_0x81ef('0x2e')]['limit']);_0x357cdf[_0x81ef('0x1b')]=qs[_0x81ef('0x1b')](_0x4dff29['query'][_0x81ef('0x1b')]);}_0x357cdf[_0x81ef('0x36')]=qs[_0x81ef('0x37')](_0x4dff29[_0x81ef('0x2e')][_0x81ef('0x37')]);_0x357cdf[_0x81ef('0x38')]=qs[_0x81ef('0x30')](_[_0x81ef('0x39')](_0x4dff29['query'],_0x5ac99f[_0x81ef('0x30')]),_0x15ae8c);if(_0x4dff29[_0x81ef('0x2e')][_0x81ef('0x3a')]){_0x357cdf['where']=_[_0x81ef('0x3b')](_0x357cdf[_0x81ef('0x38')],{'$or':_[_0x81ef('0x28')](_0x15ae8c,function(_0xe2105a){if(_0xe2105a[_0x81ef('0x2b')]!==_0x81ef('0x3c')){var _0x330864={};_0x330864[_0xe2105a[_0x81ef('0x26')]]={'$like':'%'+_0x4dff29[_0x81ef('0x2e')][_0x81ef('0x3a')]+'%'};return _0x330864;}})});}_0x357cdf=_[_0x81ef('0x3b')]({},_0x357cdf,_0x4dff29[_0x81ef('0x3d')]);var _0x4b3430={'where':_0x357cdf[_0x81ef('0x38')]};return db[_0x81ef('0x3e')]['count'](_0x4b3430)['then'](function(_0x4ab68b){_0x137e93[_0x81ef('0x1a')]=_0x4ab68b;if(_0x4dff29[_0x81ef('0x2e')][_0x81ef('0x3f')]){_0x357cdf[_0x81ef('0x40')]=[{'all':!![]}];}return db[_0x81ef('0x3e')][_0x81ef('0x41')](_0x357cdf);})['then'](function(_0x354c79){_0x137e93[_0x81ef('0x42')]=_0x354c79;return _0x137e93;})['then'](respondWithFilteredResult(_0x20900f,_0x357cdf))[_0x81ef('0x43')](handleError(_0x20900f,null));};exports['show']=function(_0x1946a3,_0x300d41){var _0x13748d={'raw':!![],'where':{'id':_0x1946a3[_0x81ef('0x44')]['id']}},_0x16729d={};_0x16729d[_0x81ef('0x2d')]=_[_0x81ef('0x2f')](db['Dynamics365Field'][_0x81ef('0x29')]);_0x16729d[_0x81ef('0x2e')]=_[_0x81ef('0x2f')](_0x1946a3[_0x81ef('0x2e')]);_0x16729d[_0x81ef('0x30')]=_[_0x81ef('0x31')](_0x16729d['model'],_0x16729d[_0x81ef('0x2e')]);_0x13748d['attributes']=_[_0x81ef('0x31')](_0x16729d[_0x81ef('0x2d')],qs['fields'](_0x1946a3[_0x81ef('0x2e')][_0x81ef('0x33')]));_0x13748d[_0x81ef('0x32')]=_0x13748d[_0x81ef('0x32')][_0x81ef('0x34')]?_0x13748d[_0x81ef('0x32')]:_0x16729d['model'];if(_0x1946a3[_0x81ef('0x2e')][_0x81ef('0x3f')]){_0x13748d[_0x81ef('0x40')]=[{'all':!![]}];}_0x13748d=_[_0x81ef('0x3b')]({},_0x13748d,_0x1946a3['options']);return db['Dynamics365Field']['find'](_0x13748d)[_0x81ef('0x22')](handleEntityNotFound(_0x300d41,null))[_0x81ef('0x22')](respondWithResult(_0x300d41,null))[_0x81ef('0x43')](handleError(_0x300d41,null));};exports[_0x81ef('0x45')]=function(_0x1d4454,_0x460acd){return db['Dynamics365Field'][_0x81ef('0x45')](_0x1d4454[_0x81ef('0x46')],{})[_0x81ef('0x22')](respondWithResult(_0x460acd,0xc9))['catch'](handleError(_0x460acd,null));};exports[_0x81ef('0x21')]=function(_0x3697ec,_0x26aedd){if(_0x3697ec[_0x81ef('0x46')]['id']){delete _0x3697ec[_0x81ef('0x46')]['id'];}return db[_0x81ef('0x3e')]['find']({'where':{'id':_0x3697ec[_0x81ef('0x44')]['id']}})['then'](handleEntityNotFound(_0x26aedd,null))[_0x81ef('0x22')](saveUpdates(_0x3697ec[_0x81ef('0x46')],null))[_0x81ef('0x22')](respondWithResult(_0x26aedd,null))[_0x81ef('0x43')](handleError(_0x26aedd,null));};exports[_0x81ef('0x23')]=function(_0x5a07f1,_0x4e2edb){return db['Dynamics365Field']['find']({'where':{'id':_0x5a07f1['params']['id']}})[_0x81ef('0x22')](handleEntityNotFound(_0x4e2edb,null))['then'](removeEntity(_0x4e2edb,null))[_0x81ef('0x43')](handleError(_0x4e2edb,null));}; \ No newline at end of file +var _0xafe6=['fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','Dynamics365Field','findAll','rows','catch','keys','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x4a5ef4,_0x197f2f){var _0x132c92=function(_0x338ccb){while(--_0x338ccb){_0x4a5ef4['push'](_0x4a5ef4['shift']());}};_0x132c92(++_0x197f2f);}(_0xafe6,0xac));var _0x6afe=function(_0xb57bce,_0x42d212){_0xb57bce=_0xb57bce-0x0;var _0x74314a=_0xafe6[_0xb57bce];return _0x74314a;};'use strict';var pdf=require(_0x6afe('0x0'));var emlformat=require(_0x6afe('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6afe('0x2'));var rp=require(_0x6afe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6afe('0x4'));var util=require(_0x6afe('0x5'));var path=require(_0x6afe('0x6'));var sox=require(_0x6afe('0x7'));var csv=require(_0x6afe('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6afe('0x9'));var squel=require(_0x6afe('0xa'));var crypto=require(_0x6afe('0xb'));var jsforce=require(_0x6afe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6afe('0x8'));var querystring=require(_0x6afe('0xd'));var Papa=require(_0x6afe('0xe'));var Redis=require(_0x6afe('0xf'));var authService=require(_0x6afe('0x10'));var qs=require(_0x6afe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6afe('0x12'))(_0x6afe('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6afe('0x14'))['db'];function respondWithStatusCode(_0xe9fc4e,_0x3e75b5){_0x3e75b5=_0x3e75b5||0xcc;return function(_0x15ea76){if(_0x15ea76){return _0xe9fc4e[_0x6afe('0x15')](_0x3e75b5);}return _0xe9fc4e[_0x6afe('0x16')](_0x3e75b5)[_0x6afe('0x17')]();};}function respondWithResult(_0x4ecac3,_0x31940b){_0x31940b=_0x31940b||0xc8;return function(_0x4061bd){if(_0x4061bd){return _0x4ecac3[_0x6afe('0x16')](_0x31940b)[_0x6afe('0x18')](_0x4061bd);}};}function respondWithFilteredResult(_0x3fdd7b,_0x2d3e7d){return function(_0x94ca1){if(_0x94ca1){var _0x4deb5b=_0x94ca1[_0x6afe('0x19')],_0x311b1e=_0x2d3e7d[_0x6afe('0x1a')],_0x57e785=_0x2d3e7d[_0x6afe('0x1a')]+_0x2d3e7d[_0x6afe('0x1b')],_0x575280;if(_0x57e785>=_0x4deb5b){_0x57e785=_0x4deb5b;_0x575280=0xc8;}else{_0x575280=0xce;}_0x3fdd7b[_0x6afe('0x16')](_0x575280);return _0x3fdd7b[_0x6afe('0x1c')](_0x6afe('0x1d'),_0x311b1e+'-'+_0x57e785+'/'+_0x4deb5b)[_0x6afe('0x18')](_0x94ca1);}return null;};}function patchUpdates(_0x57dbe8){return function(_0x4ba466){try{jsonpatch[_0x6afe('0x1e')](_0x4ba466,_0x57dbe8,!![]);}catch(_0x23d77){return BPromise[_0x6afe('0x1f')](_0x23d77);}return _0x4ba466['save']();};}function saveUpdates(_0x47fc7c,_0x4227f0){return function(_0x18ee9f){if(_0x18ee9f){return _0x18ee9f[_0x6afe('0x20')](_0x47fc7c)[_0x6afe('0x21')](function(_0x22d70d){return _0x22d70d;});}return null;};}function removeEntity(_0x2e4d85,_0x1f3436){return function(_0x42e461){if(_0x42e461){return _0x42e461[_0x6afe('0x22')]()[_0x6afe('0x21')](function(){_0x2e4d85[_0x6afe('0x16')](0xcc)[_0x6afe('0x17')]();});}};}function handleEntityNotFound(_0x397439,_0x23fc00){return function(_0x93d444){if(!_0x93d444){_0x397439['sendStatus'](0x194);}return _0x93d444;};}function handleError(_0x5916b2,_0x160601){_0x160601=_0x160601||0x1f4;return function(_0x4ec694){logger['error'](_0x4ec694[_0x6afe('0x23')]);if(_0x4ec694[_0x6afe('0x24')]){delete _0x4ec694[_0x6afe('0x24')];}_0x5916b2[_0x6afe('0x16')](_0x160601)[_0x6afe('0x25')](_0x4ec694);};}exports[_0x6afe('0x26')]=function(_0x319bc0,_0x10fc9e){var _0x338ab8={},_0x2c6ac3={},_0x153efc={'count':0x0,'rows':[]};var _0x1ef7fa=_[_0x6afe('0x27')](db['Dynamics365Field'][_0x6afe('0x28')],function(_0x2c0573){return{'name':_0x2c0573[_0x6afe('0x29')],'type':_0x2c0573['type'][_0x6afe('0x2a')]};});_0x2c6ac3['model']=_[_0x6afe('0x27')](_0x1ef7fa,_0x6afe('0x24'));_0x2c6ac3['query']=_['keys'](_0x319bc0[_0x6afe('0x2b')]);_0x2c6ac3[_0x6afe('0x2c')]=_[_0x6afe('0x2d')](_0x2c6ac3[_0x6afe('0x2e')],_0x2c6ac3[_0x6afe('0x2b')]);_0x338ab8[_0x6afe('0x2f')]=_[_0x6afe('0x2d')](_0x2c6ac3[_0x6afe('0x2e')],qs[_0x6afe('0x30')](_0x319bc0[_0x6afe('0x2b')][_0x6afe('0x30')]));_0x338ab8[_0x6afe('0x2f')]=_0x338ab8[_0x6afe('0x2f')][_0x6afe('0x31')]?_0x338ab8[_0x6afe('0x2f')]:_0x2c6ac3[_0x6afe('0x2e')];if(!_0x319bc0[_0x6afe('0x2b')][_0x6afe('0x32')](_0x6afe('0x33'))){_0x338ab8[_0x6afe('0x1b')]=qs[_0x6afe('0x1b')](_0x319bc0['query']['limit']);_0x338ab8[_0x6afe('0x1a')]=qs[_0x6afe('0x1a')](_0x319bc0[_0x6afe('0x2b')][_0x6afe('0x1a')]);}_0x338ab8[_0x6afe('0x34')]=qs['sort'](_0x319bc0[_0x6afe('0x2b')]['sort']);_0x338ab8['where']=qs[_0x6afe('0x2c')](_[_0x6afe('0x35')](_0x319bc0[_0x6afe('0x2b')],_0x2c6ac3[_0x6afe('0x2c')]),_0x1ef7fa);if(_0x319bc0['query']['filter']){_0x338ab8[_0x6afe('0x36')]=_[_0x6afe('0x37')](_0x338ab8[_0x6afe('0x36')],{'$or':_['map'](_0x1ef7fa,function(_0x2aca5d){if(_0x2aca5d[_0x6afe('0x38')]!==_0x6afe('0x39')){var _0x2a603e={};_0x2a603e[_0x2aca5d[_0x6afe('0x24')]]={'$like':'%'+_0x319bc0[_0x6afe('0x2b')][_0x6afe('0x3a')]+'%'};return _0x2a603e;}})});}_0x338ab8=_['merge']({},_0x338ab8,_0x319bc0[_0x6afe('0x3b')]);var _0x29239a={'where':_0x338ab8['where']};return db['Dynamics365Field'][_0x6afe('0x19')](_0x29239a)['then'](function(_0xb288cb){_0x153efc[_0x6afe('0x19')]=_0xb288cb;if(_0x319bc0[_0x6afe('0x2b')][_0x6afe('0x3c')]){_0x338ab8[_0x6afe('0x3d')]=[{'all':!![]}];}return db[_0x6afe('0x3e')][_0x6afe('0x3f')](_0x338ab8);})['then'](function(_0x50b0a7){_0x153efc[_0x6afe('0x40')]=_0x50b0a7;return _0x153efc;})[_0x6afe('0x21')](respondWithFilteredResult(_0x10fc9e,_0x338ab8))[_0x6afe('0x41')](handleError(_0x10fc9e,null));};exports['show']=function(_0x5d0854,_0x3f8b43){var _0x59d18c={'raw':!![],'where':{'id':_0x5d0854['params']['id']}},_0x36c81b={};_0x36c81b['model']=_[_0x6afe('0x42')](db[_0x6afe('0x3e')][_0x6afe('0x28')]);_0x36c81b['query']=_[_0x6afe('0x42')](_0x5d0854['query']);_0x36c81b['filters']=_[_0x6afe('0x2d')](_0x36c81b[_0x6afe('0x2e')],_0x36c81b[_0x6afe('0x2b')]);_0x59d18c[_0x6afe('0x2f')]=_[_0x6afe('0x2d')](_0x36c81b['model'],qs['fields'](_0x5d0854[_0x6afe('0x2b')]['fields']));_0x59d18c['attributes']=_0x59d18c['attributes'][_0x6afe('0x31')]?_0x59d18c[_0x6afe('0x2f')]:_0x36c81b[_0x6afe('0x2e')];if(_0x5d0854[_0x6afe('0x2b')]['includeAll']){_0x59d18c[_0x6afe('0x3d')]=[{'all':!![]}];}_0x59d18c=_[_0x6afe('0x37')]({},_0x59d18c,_0x5d0854[_0x6afe('0x3b')]);return db[_0x6afe('0x3e')][_0x6afe('0x43')](_0x59d18c)[_0x6afe('0x21')](handleEntityNotFound(_0x3f8b43,null))[_0x6afe('0x21')](respondWithResult(_0x3f8b43,null))[_0x6afe('0x41')](handleError(_0x3f8b43,null));};exports[_0x6afe('0x44')]=function(_0x5546f1,_0x5033c6){return db[_0x6afe('0x3e')][_0x6afe('0x44')](_0x5546f1[_0x6afe('0x45')],{})['then'](respondWithResult(_0x5033c6,0xc9))['catch'](handleError(_0x5033c6,null));};exports['update']=function(_0x2772ca,_0x48911a){if(_0x2772ca[_0x6afe('0x45')]['id']){delete _0x2772ca[_0x6afe('0x45')]['id'];}return db['Dynamics365Field'][_0x6afe('0x43')]({'where':{'id':_0x2772ca[_0x6afe('0x46')]['id']}})[_0x6afe('0x21')](handleEntityNotFound(_0x48911a,null))[_0x6afe('0x21')](saveUpdates(_0x2772ca['body'],null))[_0x6afe('0x21')](respondWithResult(_0x48911a,null))['catch'](handleError(_0x48911a,null));};exports[_0x6afe('0x22')]=function(_0x4ada00,_0x4576e8){return db[_0x6afe('0x3e')][_0x6afe('0x43')]({'where':{'id':_0x4ada00[_0x6afe('0x46')]['id']}})[_0x6afe('0x21')](handleEntityNotFound(_0x4576e8,null))[_0x6afe('0x21')](removeEntity(_0x4576e8,null))['catch'](handleError(_0x4576e8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f1bd500..dd02454 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 _0x8534=['rimraf','define','Dynamics365Field','dynamics365_unique_index','FieldId','util','../../config/logger','moment','request-promise'];(function(_0x5c027f,_0xa40135){var _0x5392f3=function(_0x581c3b){while(--_0x581c3b){_0x5c027f['push'](_0x5c027f['shift']());}};_0x5392f3(++_0xa40135);}(_0x8534,0x1be));var _0x4853=function(_0x47d570,_0x5a81fc){_0x47d570=_0x47d570-0x0;var _0x370b99=_0x8534[_0x47d570];return _0x370b99;};'use strict';var _=require('lodash');var util=require(_0x4853('0x0'));var logger=require(_0x4853('0x1'))('api');var moment=require(_0x4853('0x2'));var BPromise=require('bluebird');var rp=require(_0x4853('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4853('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x2ab10c,_0x2a50c9){return _0x2ab10c[_0x4853('0x5')](_0x4853('0x6'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4853('0x7'),'fields':['idField',_0x4853('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd81b=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','util'];(function(_0xe7cac,_0x42383d){var _0x569d16=function(_0xb4618b){while(--_0xb4618b){_0xe7cac['push'](_0xe7cac['shift']());}};_0x569d16(++_0x42383d);}(_0xd81b,0x179));var _0xbd81=function(_0x36c9d3,_0x2730c2){_0x36c9d3=_0x36c9d3-0x0;var _0x4d0deb=_0xd81b[_0x36c9d3];return _0x4d0deb;};'use strict';var _=require('lodash');var util=require(_0xbd81('0x0'));var logger=require(_0xbd81('0x1'))('api');var moment=require(_0xbd81('0x2'));var BPromise=require(_0xbd81('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd81('0x4'));var rimraf=require(_0xbd81('0x5'));var config=require(_0xbd81('0x6'));var attributes=require(_0xbd81('0x7'));module[_0xbd81('0x8')]=function(_0x38ce94,_0x4e9760){return _0x38ce94[_0xbd81('0x9')](_0xbd81('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xbd81('0xb'),'fields':[_0xbd81('0xc'),_0xbd81('0xd')],'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 e18ff6a..4c7df84 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 _0x9b0d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','util'];(function(_0x1883bc,_0x5b9680){var _0x50ff73=function(_0xa3cdc7){while(--_0xa3cdc7){_0x1883bc['push'](_0x1883bc['shift']());}};_0x50ff73(++_0x5b9680);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x292627,_0x41e29d){_0x292627=_0x292627-0x0;var _0x40bcf3=_0x9b0d[_0x292627];return _0x40bcf3;};'use strict';var _=require('lodash');var util=require(_0xd9b0('0x0'));var moment=require(_0xd9b0('0x1'));var BPromise=require(_0xd9b0('0x2'));var rs=require(_0xd9b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9b0('0x4'))['db'];var utils=require(_0xd9b0('0x5'));var logger=require(_0xd9b0('0x6'))(_0xd9b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9b0('0x8'));var client=jayson[_0xd9b0('0x9')][_0xd9b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c012,_0x58bd64,_0x384d09){return new BPromise(function(_0x33f402,_0x510adc){return client[_0xd9b0('0xb')](_0x31c012,_0x384d09)[_0xd9b0('0xc')](function(_0x48181a){logger[_0xd9b0('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x58bd64,_0xd9b0('0xe'));logger['debug'](_0xd9b0('0xf'),_0x58bd64,_0xd9b0('0xe'),JSON[_0xd9b0('0x10')](_0x48181a));if(_0x48181a[_0xd9b0('0x11')]){if(_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x12')]===0x1f4){logger['error'](_0xd9b0('0x13'),_0x58bd64,_0x48181a[_0xd9b0('0x11')]['message']);return _0x510adc(_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x14')]);}logger[_0xd9b0('0x11')](_0xd9b0('0x13'),_0x58bd64,_0x48181a[_0xd9b0('0x11')][_0xd9b0('0x14')]);return _0x33f402(_0x48181a['error'][_0xd9b0('0x14')]);}else{logger['info'](_0xd9b0('0x13'),_0x58bd64,_0xd9b0('0xe'));_0x33f402(_0x48181a[_0xd9b0('0x15')][_0xd9b0('0x14')]);}})[_0xd9b0('0x16')](function(_0x3e7547){logger[_0xd9b0('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x58bd64,_0x3e7547);_0x510adc(_0x3e7547);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3e2016,_0x3a00dc){var _0x4fe9c1=function(_0x3b8696){while(--_0x3b8696){_0x3e2016['push'](_0x3e2016['shift']());}};_0x4fe9c1(++_0x3a00dc);}(_0x5496,0x175));var _0x6549=function(_0x469e41,_0xbb3b9f){_0x469e41=_0x469e41-0x0;var _0x3dd595=_0x5496[_0x469e41];return _0x3dd595;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 84e5709..0bf07dc 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 _0x7aff=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','path','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0x7aff,0x19a));var _0xf7af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7aff[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf7af('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf7af('0x1')]();var auth=require(_0xf7af('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf7af('0x3'));var controller=require(_0xf7af('0x4'));router[_0xf7af('0x5')]('/',auth[_0xf7af('0x6')](),controller[_0xf7af('0x7')]);router[_0xf7af('0x5')](_0xf7af('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xf7af('0x5')](_0xf7af('0x9'),auth[_0xf7af('0x6')](),controller[_0xf7af('0xa')]);router[_0xf7af('0x5')](_0xf7af('0xb'),auth['isAuthenticated'](),controller[_0xf7af('0xc')]);router[_0xf7af('0xd')]('/',auth[_0xf7af('0x6')](),controller[_0xf7af('0xe')]);router[_0xf7af('0xd')]('/:id/configurations',auth[_0xf7af('0x6')](),controller[_0xf7af('0xf')]);router[_0xf7af('0x10')](_0xf7af('0x8'),auth[_0xf7af('0x6')](),controller[_0xf7af('0x11')]);router[_0xf7af('0x12')](_0xf7af('0x8'),auth[_0xf7af('0x6')](),controller['destroy']);module[_0xf7af('0x13')]=router; \ No newline at end of file +var _0x38cb=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update'];(function(_0x58b069,_0x3132ce){var _0x5143ec=function(_0x4e6329){while(--_0x4e6329){_0x58b069['push'](_0x58b069['shift']());}};_0x5143ec(++_0x3132ce);}(_0x38cb,0x14c));var _0xb38c=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x38cb[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require('multer');var util=require(_0xb38c('0x0'));var path=require(_0xb38c('0x1'));var timeout=require(_0xb38c('0x2'));var express=require(_0xb38c('0x3'));var router=express[_0xb38c('0x4')]();var auth=require(_0xb38c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb38c('0x6'));var controller=require(_0xb38c('0x7'));router[_0xb38c('0x8')]('/',auth[_0xb38c('0x9')](),controller[_0xb38c('0xa')]);router[_0xb38c('0x8')](_0xb38c('0xb'),auth[_0xb38c('0x9')](),controller[_0xb38c('0xc')]);router[_0xb38c('0x8')](_0xb38c('0xd'),auth[_0xb38c('0x9')](),controller[_0xb38c('0xe')]);router[_0xb38c('0x8')]('/:id/fields',auth[_0xb38c('0x9')](),controller[_0xb38c('0xf')]);router[_0xb38c('0x10')]('/',auth[_0xb38c('0x9')](),controller[_0xb38c('0x11')]);router[_0xb38c('0x10')](_0xb38c('0xd'),auth[_0xb38c('0x9')](),controller[_0xb38c('0x12')]);router['put'](_0xb38c('0xb'),auth[_0xb38c('0x9')](),controller[_0xb38c('0x13')]);router[_0xb38c('0x14')](_0xb38c('0xb'),auth[_0xb38c('0x9')](),controller[_0xb38c('0x15')]);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 e367321..1274ed0 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 _0xc2a2=['sequelize','exports','STRING','username'];(function(_0x2b61f1,_0xa27e5f){var _0x26d9da=function(_0x2e2a90){while(--_0x2e2a90){_0x2b61f1['push'](_0x2b61f1['shift']());}};_0x26d9da(++_0xa27e5f);}(_0xc2a2,0x84));var _0x2c2a=function(_0x525c19,_0x2d8b56){_0x525c19=_0x525c19-0x0;var _0x54ad4d=_0xc2a2[_0x525c19];return _0x54ad4d;};'use strict';var Sequelize=require(_0x2c2a('0x0'));module[_0x2c2a('0x1')]={'name':{'type':Sequelize[_0x2c2a('0x2')]},'description':{'type':Sequelize[_0x2c2a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2c2a('0x3')},'apiKey':{'type':Sequelize[_0x2c2a('0x2')]},'remoteUri':{'type':Sequelize[_0x2c2a('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2c2a('0x2')]}}; \ No newline at end of file +var _0x57b7=['username','remoteUri','sequelize','exports','STRING'];(function(_0x31e395,_0x464bb7){var _0x1360b5=function(_0x4a3caa){while(--_0x4a3caa){_0x31e395['push'](_0x31e395['shift']());}};_0x1360b5(++_0x464bb7);}(_0x57b7,0x160));var _0x757b=function(_0x523481,_0xb75190){_0x523481=_0x523481-0x0;var _0x49387d=_0x57b7[_0x523481];return _0x49387d;};'use strict';var Sequelize=require(_0x757b('0x0'));module[_0x757b('0x1')]={'name':{'type':Sequelize[_0x757b('0x2')]},'description':{'type':Sequelize[_0x757b('0x2')]},'username':{'type':Sequelize[_0x757b('0x2')],'unique':_0x757b('0x3')},'apiKey':{'type':Sequelize[_0x757b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x757b('0x4')},'serverUrl':{'type':Sequelize[_0x757b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1de3aa0..b15b697 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 _0x7fbe=['../../config/environment','../../mysqldb','../../components/integrations/configuration','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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','params','includeAll','create','body','catch','find','findOne','merge','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x9fe7b0,_0x716f4e){var _0x19f378=function(_0x5a83fb){while(--_0x5a83fb){_0x9fe7b0['push'](_0x9fe7b0['shift']());}};_0x19f378(++_0x716f4e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1a5eb0,_0x1f8fbb){_0x1a5eb0=_0x1a5eb0-0x0;var _0x30f9ba=_0x7fbe[_0x1a5eb0];return _0x30f9ba;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];var integrations=require(_0xe7fb('0x1a'));var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x45fe75,_0x7fe4d3,_0x598729){if(_0x598729){var _0x278b75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x278b75[_0xe7fb('0x1e')](_0x7fe4d3)){return _0x45fe75;}else{throw new db['Sequelize'][(_0xe7fb('0x1f'))](_0xe7fb('0x20'));}}else{return _0x45fe75;}}function respondWithRpcPromise(_0x482f7d,_0xa76acf,_0x559129,_0x12fff6){return new BPromise(function(_0x18d23c,_0x12603d){var _0x17e8a8=_0x12fff6||client;return _0x17e8a8['request'](_0x482f7d,_0x559129)[_0xe7fb('0x21')](function(_0x5ebc87){logger[_0xe7fb('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,_0xe7fb('0x23'));logger[_0xe7fb('0x24')](_0xe7fb('0x25'),_0xa76acf,_0xe7fb('0x23'),JSON['stringify'](_0x5ebc87));if(_0x5ebc87[_0xe7fb('0x26')]){if(_0x5ebc87['error'][_0xe7fb('0x27')]===0x1f4){logger['error'](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87['error'][_0xe7fb('0x29')]);return _0x12603d(_0x5ebc87[_0xe7fb('0x26')]['message']);}logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87[_0xe7fb('0x26')]['message']);return _0x18d23c(_0x5ebc87[_0xe7fb('0x26')][_0xe7fb('0x29')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,'request\x20sent');_0x18d23c(_0x5ebc87[_0xe7fb('0x2a')]['message']);}})['catch'](function(_0x4026b1){logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x4026b1);_0x12603d(_0x4026b1);});});}function respondWithStatusCode(_0x4f6c73,_0x6c930){_0x6c930=_0x6c930||0xcc;return function(_0x2b69c4){if(_0x2b69c4){return _0x4f6c73[_0xe7fb('0x2b')](_0x6c930);}return _0x4f6c73[_0xe7fb('0x2c')](_0x6c930)[_0xe7fb('0x2d')]();};}function respondWithResult(_0x16237a,_0x380130){_0x380130=_0x380130||0xc8;return function(_0x59e015){if(_0x59e015){return _0x16237a['status'](_0x380130)[_0xe7fb('0x2e')](_0x59e015);}};}function respondWithFilteredResult(_0x3bdee9,_0xead63){return function(_0x4fd290){if(_0x4fd290){var _0xb1f2f4=_0x4fd290[_0xe7fb('0x2f')],_0x251807=_0xead63[_0xe7fb('0x30')],_0xd3fffe=_0xead63[_0xe7fb('0x30')]+_0xead63[_0xe7fb('0x31')],_0x5f265f;if(_0xd3fffe>=_0xb1f2f4){_0xd3fffe=_0xb1f2f4;_0x5f265f=0xc8;}else{_0x5f265f=0xce;}_0x3bdee9['status'](_0x5f265f);return _0x3bdee9[_0xe7fb('0x32')](_0xe7fb('0x33'),_0x251807+'-'+_0xd3fffe+'/'+_0xb1f2f4)[_0xe7fb('0x2e')](_0x4fd290);}return null;};}function patchUpdates(_0x547a04){return function(_0x517d70){try{jsonpatch[_0xe7fb('0x34')](_0x517d70,_0x547a04,!![]);}catch(_0x4a9fea){return BPromise[_0xe7fb('0x35')](_0x4a9fea);}return _0x517d70[_0xe7fb('0x36')]();};}function saveUpdates(_0xe49053,_0x2a4745){return function(_0x556368){if(_0x556368){return _0x556368[_0xe7fb('0x37')](_0xe49053)[_0xe7fb('0x21')](function(_0x18ed83){return _0x18ed83;});}return null;};}function removeEntity(_0x2f8818,_0x2d650d){return function(_0x480819){if(_0x480819){return _0x480819[_0xe7fb('0x38')]()[_0xe7fb('0x21')](function(){_0x2f8818[_0xe7fb('0x2c')](0xcc)[_0xe7fb('0x2d')]();});}};}function handleEntityNotFound(_0x46f430,_0x25e925){return function(_0x1bc72d){if(!_0x1bc72d){_0x46f430[_0xe7fb('0x2b')](0x194);}return _0x1bc72d;};}function handleError(_0x389903,_0x59f9df){_0x59f9df=_0x59f9df||0x1f4;return function(_0x44d8cf){logger[_0xe7fb('0x26')](_0x44d8cf[_0xe7fb('0x39')]);if(_0x44d8cf['name']){delete _0x44d8cf[_0xe7fb('0x3a')];}_0x389903[_0xe7fb('0x2c')](_0x59f9df)[_0xe7fb('0x3b')](_0x44d8cf);};}exports[_0xe7fb('0x3c')]=function(_0x402ca3,_0x35b828){var _0xfeefb1={},_0xc4e271={},_0x195c35={'count':0x0,'rows':[]};var _0xebfe1d=_[_0xe7fb('0x3d')](db[_0xe7fb('0x3e')][_0xe7fb('0x3f')],function(_0x1c81fe){return{'name':_0x1c81fe[_0xe7fb('0x40')],'type':_0x1c81fe[_0xe7fb('0x41')][_0xe7fb('0x42')]};});_0xc4e271[_0xe7fb('0x43')]=_[_0xe7fb('0x3d')](_0xebfe1d,'name');_0xc4e271[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x402ca3[_0xe7fb('0x44')]);_0xc4e271[_0xe7fb('0x46')]=_['intersection'](_0xc4e271[_0xe7fb('0x43')],_0xc4e271[_0xe7fb('0x44')]);_0xfeefb1[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0xc4e271['model'],qs[_0xe7fb('0x49')](_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x49')]));_0xfeefb1[_0xe7fb('0x47')]=_0xfeefb1[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0xfeefb1['attributes']:_0xc4e271[_0xe7fb('0x43')];if(!_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0xfeefb1[_0xe7fb('0x31')]=qs[_0xe7fb('0x31')](_0x402ca3['query']['limit']);_0xfeefb1['offset']=qs['offset'](_0x402ca3['query'][_0xe7fb('0x30')]);}_0xfeefb1[_0xe7fb('0x4c')]=qs[_0xe7fb('0x4d')](_0x402ca3['query'][_0xe7fb('0x4d')]);_0xfeefb1['where']=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x402ca3['query'],_0xc4e271[_0xe7fb('0x46')]),_0xebfe1d);if(_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]){_0xfeefb1[_0xe7fb('0x50')]=_['merge'](_0xfeefb1[_0xe7fb('0x50')],{'$or':_[_0xe7fb('0x3d')](_0xebfe1d,function(_0x1b8a34){if(_0x1b8a34['type']!==_0xe7fb('0x51')){var _0x6eb1ab={};_0x6eb1ab[_0x1b8a34[_0xe7fb('0x3a')]]={'$like':'%'+_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]+'%'};return _0x6eb1ab;}})});}_0xfeefb1=_['merge']({},_0xfeefb1,_0x402ca3[_0xe7fb('0x52')]);var _0x4df4aa={'where':_0xfeefb1[_0xe7fb('0x50')]};return db[_0xe7fb('0x3e')][_0xe7fb('0x2f')](_0x4df4aa)[_0xe7fb('0x21')](function(_0x15cec3){_0x195c35['count']=_0x15cec3;if(_0x402ca3[_0xe7fb('0x44')]['includeAll']){_0xfeefb1['include']=[{'all':!![]}];}return db[_0xe7fb('0x3e')][_0xe7fb('0x53')](_0xfeefb1);})[_0xe7fb('0x21')](function(_0x589555){_0x195c35[_0xe7fb('0x54')]=_0x589555;return _0x195c35;})[_0xe7fb('0x21')](respondWithFilteredResult(_0x35b828,_0xfeefb1))['catch'](handleError(_0x35b828,null));};exports['show']=function(_0x284bcb,_0x42270b){var _0x1cbf34={'raw':![],'where':{'id':_0x284bcb[_0xe7fb('0x55')]['id']}},_0x3dd6bf={};_0x3dd6bf[_0xe7fb('0x43')]=_[_0xe7fb('0x45')](db[_0xe7fb('0x3e')]['rawAttributes']);_0x3dd6bf[_0xe7fb('0x44')]=_['keys'](_0x284bcb[_0xe7fb('0x44')]);_0x3dd6bf[_0xe7fb('0x46')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],_0x3dd6bf['query']);_0x1cbf34[_0xe7fb('0x47')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],qs['fields'](_0x284bcb[_0xe7fb('0x44')]['fields']));_0x1cbf34[_0xe7fb('0x47')]=_0x1cbf34[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0x1cbf34[_0xe7fb('0x47')]:_0x3dd6bf[_0xe7fb('0x43')];if(_0x284bcb[_0xe7fb('0x44')][_0xe7fb('0x56')]){_0x1cbf34['include']=[{'all':!![]}];}_0x1cbf34=_['merge']({},_0x1cbf34,_0x284bcb[_0xe7fb('0x52')]);return db['FreshdeskAccount']['find'](_0x1cbf34)['then'](handleEntityNotFound(_0x42270b,null))['then'](respondWithResult(_0x42270b,null))['catch'](handleError(_0x42270b,null));};exports[_0xe7fb('0x57')]=function(_0x34dd69,_0xd2fd76){return db[_0xe7fb('0x3e')]['create'](_0x34dd69[_0xe7fb('0x58')],{})[_0xe7fb('0x21')](respondWithResult(_0xd2fd76,0xc9))[_0xe7fb('0x59')](handleError(_0xd2fd76,null));};exports['update']=function(_0x56c512,_0x2f3b72){if(_0x56c512[_0xe7fb('0x58')]['id']){delete _0x56c512[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount'][_0xe7fb('0x5a')]({'where':{'id':_0x56c512[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f3b72,null))[_0xe7fb('0x21')](saveUpdates(_0x56c512['body'],null))['then'](respondWithResult(_0x2f3b72,null))[_0xe7fb('0x59')](handleError(_0x2f3b72,null));};exports[_0xe7fb('0x38')]=function(_0x1f16b2,_0x2f61b1){return db[_0xe7fb('0x3e')]['find']({'where':{'id':_0x1f16b2[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f61b1,null))[_0xe7fb('0x21')](removeEntity(_0x2f61b1,null))['catch'](handleError(_0x2f61b1,null));};exports['getConfigurations']=function(_0x425bee,_0x3b69f7,_0x14fe1b){var _0x1c4035={};var _0x40f546={};var _0x3385e2;var _0x585b7c;return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x425bee[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3b69f7,null))[_0xe7fb('0x21')](function(_0x1e0d69){if(_0x1e0d69){_0x3385e2=_0x1e0d69;_0x40f546['model']=_[_0xe7fb('0x45')](db['FreshdeskConfiguration'][_0xe7fb('0x3f')]);_0x40f546[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x425bee[_0xe7fb('0x44')]);_0x40f546['filters']=_['intersection'](_0x40f546[_0xe7fb('0x43')],_0x40f546[_0xe7fb('0x44')]);_0x1c4035[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x40f546[_0xe7fb('0x43')],qs['fields'](_0x425bee[_0xe7fb('0x44')]['fields']));_0x1c4035[_0xe7fb('0x47')]=_0x1c4035['attributes']['length']?_0x1c4035[_0xe7fb('0x47')]:_0x40f546[_0xe7fb('0x43')];_0x1c4035[_0xe7fb('0x4c')]=qs['sort'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4d')]);_0x1c4035[_0xe7fb('0x50')]=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x425bee['query'],_0x40f546[_0xe7fb('0x46')]));if(_0x425bee[_0xe7fb('0x44')]['filter']){_0x1c4035[_0xe7fb('0x50')]=_[_0xe7fb('0x5c')](_0x1c4035['where'],{'$or':_[_0xe7fb('0x3d')](_0x1c4035['attributes'],function(_0x2705ef){var _0x1dc9c1={};_0x1dc9c1[_0x2705ef]={'$like':'%'+_0x425bee[_0xe7fb('0x44')]['filter']+'%'};return _0x1dc9c1;})});}_0x1c4035=_[_0xe7fb('0x5c')]({},_0x1c4035,_0x425bee[_0xe7fb('0x52')]);return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x35487f){if(_0x35487f){_0x585b7c=_0x35487f[_0xe7fb('0x4a')];if(!_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0x1c4035['limit']=qs[_0xe7fb('0x31')](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x31')]);_0x1c4035['offset']=qs['offset'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x30')]);}return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x2d558c){if(_0x2d558c){return _0x2d558c?{'count':_0x585b7c,'rows':_0x2d558c}:null;}})[_0xe7fb('0x21')](respondWithResult(_0x3b69f7,null))[_0xe7fb('0x59')](handleError(_0x3b69f7,null));};exports[_0xe7fb('0x5e')]=function(_0xb06693,_0x3691a6,_0x1ff5e7){if(_0xb06693[_0xe7fb('0x58')]['id']){delete _0xb06693[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xb06693[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3691a6,null))[_0xe7fb('0x21')](function(_0x16cd8f){if(_0x16cd8f){_0xb06693[_0xe7fb('0x58')]['AccountId']=_0x16cd8f['id'];_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x5f')]=integrations[_0xe7fb('0x60')](_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x61')],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x62')]=integrations['getDescriptions'](_0xb06693[_0xe7fb('0x58')]['channel'],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);return db[_0xe7fb('0x63')][_0xe7fb('0x57')](_0xb06693[_0xe7fb('0x58')],{'include':[{'model':db['FreshdeskField'],'as':_0xe7fb('0x5f')},{'model':db[_0xe7fb('0x64')],'as':_0xe7fb('0x62')}]});}return null;})[_0xe7fb('0x21')](respondWithResult(_0x3691a6,null))[_0xe7fb('0x59')](handleError(_0x3691a6,null));};exports[_0xe7fb('0x65')]=function(_0x10a6e8,_0x17e640,_0x3d139f){var _0x59731e='';return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x10a6e8[_0xe7fb('0x55')]['id']},'attributes':['id',_0xe7fb('0x66'),'apiKey']})['then'](handleEntityNotFound(_0x17e640,null))['then'](function(_0x13265b){if(_0x13265b){_0x59731e=_0x13265b[_0xe7fb('0x66')];var _0x25e4d9=_0x59731e[_0xe7fb('0x67')](-0x1);if(_0x25e4d9==='/'){_0x59731e=_0x59731e['substring'](0x0,_0x59731e[_0xe7fb('0x68')](_0x25e4d9));}return rp({'method':_0xe7fb('0x69'),'uri':util[_0xe7fb('0x6a')](_0xe7fb('0x6b'),_0x59731e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe7fb('0x6a')]('Basic\x20%s',new Buffer(util[_0xe7fb('0x6a')](_0xe7fb('0x6c'),_0x13265b[_0xe7fb('0x6d')]))[_0xe7fb('0x6e')](_0xe7fb('0x6f')))},'json':!![]});}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){var _0x5b8f3e=[_0xe7fb('0x70'),'subject',_0xe7fb('0x71'),_0xe7fb('0x72'),'status',_0xe7fb('0x73'),_0xe7fb('0x74'),_0xe7fb('0x75'),_0xe7fb('0x76'),'group',_0xe7fb('0x77')];_[_0xe7fb('0x78')](_0x3ffd6c,function(_0x1412e2){return _0x5b8f3e['includes'](_0x1412e2[_0xe7fb('0x3a')])||!_0x1412e2['default']&&_0x1412e2['type']!=='custom_text'&&_0x1412e2[_0xe7fb('0x41')]!==_0xe7fb('0x79');});return{'count':_0x3ffd6c['length'],'rows':_[_0xe7fb('0x3d')](_0x3ffd6c,function(_0x266bba){return{'id':_0x266bba[_0xe7fb('0x3a')],'name':_0x266bba[_0xe7fb('0x7a')],'custom':!_0x266bba[_0xe7fb('0x7b')],'options':_0x266bba[_0xe7fb('0x7c')]?_[_0xe7fb('0x3d')](_0x266bba[_0xe7fb('0x7c')],function(_0x42190e){return{'name':_[_0xe7fb('0x7d')](_0x42190e),'value':_0x42190e};}):[]};})};}})[_0xe7fb('0x21')](respondWithResult(_0x17e640,null))[_0xe7fb('0x59')](function(_0x3d1f34){var _0x27c97a=_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?0x1f4:_0x3d1f34[_0xe7fb('0x7e')]||0x1f4;logger[_0xe7fb('0x26')](_0xe7fb('0x7f'),_0xe7fb('0x65'),_0x27c97a,JSON['stringify'](_0x3d1f34));delete _0x3d1f34[_0xe7fb('0x3a')];if(_0x27c97a===0x191){_0x27c97a=0x190;}_0x17e640[_0xe7fb('0x2c')](_0x27c97a)[_0xe7fb('0x3b')](_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?{'message':_0xe7fb('0x80'),'statusCode':_0x3d1f34[_0xe7fb('0x7e')]}:_0x3d1f34);});}; \ No newline at end of file +var _0x9957=['requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','set','Content-Range','reject','update','end','stack','send','map','FreshdeskAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','limit','offset','sort','where','pick','filter','merge','VIRTUAL','include','findAll','params','keys','length','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0xc68236,_0xc84209){var _0x2dcb13=function(_0x239bca){while(--_0x239bca){_0xc68236['push'](_0xc68236['shift']());}};_0x2dcb13(++_0xc84209);}(_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'];var integrations=require(_0x7995('0x1a'));var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x23999f,_0x2bbe7a,_0x4cc004){if(_0x4cc004){var _0x58f5ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58f5ad[_0x7995('0x1e')](_0x2bbe7a)){return _0x23999f;}else{throw new db[(_0x7995('0x1f'))][(_0x7995('0x20'))](_0x7995('0x21'));}}else{return _0x23999f;}}function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new BPromise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x22')](_0x3f1d3e,_0x2202ce)[_0x7995('0x23')](function(_0x43d4b8){logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x26'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger['error'](_0x7995('0x25'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x25'),_0x1a5310,_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x29')]);}else{logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));_0x5377e5(_0x43d4b8[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x472195){logger['error'](_0x7995('0x25'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x2c')](_0x401dc3);}return _0x34e70c[_0x7995('0x2d')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x2d')](_0x5911c3)[_0x7995('0x2e')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=_0x4b6f99[_0x7995('0x2f')],_0x514445=_0x11c1eb['offset'],_0x456a28=_0x11c1eb['offset']+_0x11c1eb['limit'],_0x3250e0;if(_0x456a28>=_0x9b2a15){_0x456a28=_0x9b2a15;_0x3250e0=0xc8;}else{_0x3250e0=0xce;}_0x132a42[_0x7995('0x2d')](_0x3250e0);return _0x132a42[_0x7995('0x30')](_0x7995('0x31'),_0x514445+'-'+_0x456a28+'/'+_0x9b2a15)[_0x7995('0x2e')](_0x4b6f99);}return null;};}function patchUpdates(_0x2e3493){return function(_0x1ca460){try{jsonpatch['apply'](_0x1ca460,_0x2e3493,!![]);}catch(_0x481c74){return BPromise[_0x7995('0x32')](_0x481c74);}return _0x1ca460['save']();};}function saveUpdates(_0x553671,_0x3eb566){return function(_0x29fac5){if(_0x29fac5){return _0x29fac5[_0x7995('0x33')](_0x553671)[_0x7995('0x23')](function(_0x510841){return _0x510841;});}return null;};}function removeEntity(_0x44309d,_0x33e24e){return function(_0x5dd802){if(_0x5dd802){return _0x5dd802['destroy']()['then'](function(){_0x44309d[_0x7995('0x2d')](0xcc)[_0x7995('0x34')]();});}};}function handleEntityNotFound(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(!_0x51b95d){_0x4a176f[_0x7995('0x2c')](0x194);}return _0x51b95d;};}function handleError(_0x1cb058,_0x177cb4){_0x177cb4=_0x177cb4||0x1f4;return function(_0x5014d2){logger['error'](_0x5014d2[_0x7995('0x35')]);if(_0x5014d2['name']){delete _0x5014d2['name'];}_0x1cb058[_0x7995('0x2d')](_0x177cb4)[_0x7995('0x36')](_0x5014d2);};}exports['index']=function(_0x1baa15,_0x1922b4){var _0x2b772f={},_0x18667c={},_0x1e3dbf={'count':0x0,'rows':[]};var _0x53002a=_[_0x7995('0x37')](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x1d60b8){return{'name':_0x1d60b8['fieldName'],'type':_0x1d60b8[_0x7995('0x3a')][_0x7995('0x3b')]};});_0x18667c[_0x7995('0x3c')]=_[_0x7995('0x37')](_0x53002a,_0x7995('0x3d'));_0x18667c[_0x7995('0x3e')]=_['keys'](_0x1baa15[_0x7995('0x3e')]);_0x18667c[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],_0x18667c[_0x7995('0x3e')]);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x1baa15[_0x7995('0x3e')][_0x7995('0x42')]));_0x2b772f[_0x7995('0x41')]=_0x2b772f[_0x7995('0x41')]['length']?_0x2b772f['attributes']:_0x18667c[_0x7995('0x3c')];if(!_0x1baa15[_0x7995('0x3e')]['hasOwnProperty']('nolimit')){_0x2b772f[_0x7995('0x43')]=qs['limit'](_0x1baa15['query'][_0x7995('0x43')]);_0x2b772f[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x1baa15['query'][_0x7995('0x44')]);}_0x2b772f['order']=qs[_0x7995('0x45')](_0x1baa15['query']['sort']);_0x2b772f[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x1baa15[_0x7995('0x3e')],_0x18667c['filters']),_0x53002a);if(_0x1baa15[_0x7995('0x3e')][_0x7995('0x48')]){_0x2b772f[_0x7995('0x46')]=_[_0x7995('0x49')](_0x2b772f['where'],{'$or':_['map'](_0x53002a,function(_0x1c37c6){if(_0x1c37c6['type']!==_0x7995('0x4a')){var _0x59c153={};_0x59c153[_0x1c37c6[_0x7995('0x3d')]]={'$like':'%'+_0x1baa15['query'][_0x7995('0x48')]+'%'};return _0x59c153;}})});}_0x2b772f=_[_0x7995('0x49')]({},_0x2b772f,_0x1baa15['options']);var _0x3e9e62={'where':_0x2b772f[_0x7995('0x46')]};return db[_0x7995('0x38')][_0x7995('0x2f')](_0x3e9e62)['then'](function(_0x2458cb){_0x1e3dbf[_0x7995('0x2f')]=_0x2458cb;if(_0x1baa15[_0x7995('0x3e')]['includeAll']){_0x2b772f[_0x7995('0x4b')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4c')](_0x2b772f);})[_0x7995('0x23')](function(_0x255313){_0x1e3dbf['rows']=_0x255313;return _0x1e3dbf;})[_0x7995('0x23')](respondWithFilteredResult(_0x1922b4,_0x2b772f))[_0x7995('0x2b')](handleError(_0x1922b4,null));};exports['show']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9={'raw':![],'where':{'id':_0x3d1dbb[_0x7995('0x4d')]['id']}},_0x187735={};_0x187735[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x38')][_0x7995('0x39')]);_0x187735['query']=_[_0x7995('0x4e')](_0x3d1dbb[_0x7995('0x3e')]);_0x187735[_0x7995('0x3f')]=_['intersection'](_0x187735[_0x7995('0x3c')],_0x187735[_0x7995('0x3e')]);_0x1d87f9[_0x7995('0x41')]=_['intersection'](_0x187735['model'],qs['fields'](_0x3d1dbb[_0x7995('0x3e')][_0x7995('0x42')]));_0x1d87f9['attributes']=_0x1d87f9[_0x7995('0x41')][_0x7995('0x4f')]?_0x1d87f9[_0x7995('0x41')]:_0x187735[_0x7995('0x3c')];if(_0x3d1dbb[_0x7995('0x3e')]['includeAll']){_0x1d87f9[_0x7995('0x4b')]=[{'all':!![]}];}_0x1d87f9=_['merge']({},_0x1d87f9,_0x3d1dbb[_0x7995('0x50')]);return db[_0x7995('0x38')][_0x7995('0x51')](_0x1d87f9)['then'](handleEntityNotFound(_0x5843ba,null))['then'](respondWithResult(_0x5843ba,null))['catch'](handleError(_0x5843ba,null));};exports['create']=function(_0x2e13b0,_0x3709de){return db[_0x7995('0x38')][_0x7995('0x52')](_0x2e13b0[_0x7995('0x53')],{})[_0x7995('0x23')](respondWithResult(_0x3709de,0xc9))[_0x7995('0x2b')](handleError(_0x3709de,null));};exports[_0x7995('0x33')]=function(_0x328671,_0x17ecd3){if(_0x328671[_0x7995('0x53')]['id']){delete _0x328671[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x51')]({'where':{'id':_0x328671[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x17ecd3,null))[_0x7995('0x23')](saveUpdates(_0x328671[_0x7995('0x53')],null))[_0x7995('0x23')](respondWithResult(_0x17ecd3,null))['catch'](handleError(_0x17ecd3,null));};exports[_0x7995('0x54')]=function(_0x630737,_0x3b8a54){return db[_0x7995('0x38')]['find']({'where':{'id':_0x630737['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3b8a54,null))[_0x7995('0x23')](removeEntity(_0x3b8a54,null))[_0x7995('0x2b')](handleError(_0x3b8a54,null));};exports[_0x7995('0x55')]=function(_0x51c50b,_0x13cd7b,_0x74ff38){var _0xef5044={};var _0x33c49c={};var _0x502d43;var _0x5e2d97;return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x51c50b[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x13cd7b,null))[_0x7995('0x23')](function(_0x27c5cd){if(_0x27c5cd){_0x502d43=_0x27c5cd;_0x33c49c[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x57')]['rawAttributes']);_0x33c49c[_0x7995('0x3e')]=_[_0x7995('0x4e')](_0x51c50b[_0x7995('0x3e')]);_0x33c49c[_0x7995('0x3f')]=_['intersection'](_0x33c49c['model'],_0x33c49c[_0x7995('0x3e')]);_0xef5044[_0x7995('0x41')]=_['intersection'](_0x33c49c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x42')]));_0xef5044[_0x7995('0x41')]=_0xef5044['attributes'][_0x7995('0x4f')]?_0xef5044['attributes']:_0x33c49c[_0x7995('0x3c')];_0xef5044[_0x7995('0x58')]=qs[_0x7995('0x45')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x45')]);_0xef5044[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x51c50b[_0x7995('0x3e')],_0x33c49c[_0x7995('0x3f')]));if(_0x51c50b[_0x7995('0x3e')][_0x7995('0x48')]){_0xef5044['where']=_[_0x7995('0x49')](_0xef5044[_0x7995('0x46')],{'$or':_[_0x7995('0x37')](_0xef5044[_0x7995('0x41')],function(_0x2c6548){var _0x54a2e0={};_0x54a2e0[_0x2c6548]={'$like':'%'+_0x51c50b['query'][_0x7995('0x48')]+'%'};return _0x54a2e0;})});}_0xef5044=_[_0x7995('0x49')]({},_0xef5044,_0x51c50b[_0x7995('0x50')]);return _0x502d43[_0x7995('0x55')](_0xef5044);}})['then'](function(_0x22d317){if(_0x22d317){_0x5e2d97=_0x22d317['length'];if(!_0x51c50b['query'][_0x7995('0x59')](_0x7995('0x5a'))){_0xef5044[_0x7995('0x43')]=qs[_0x7995('0x43')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x43')]);_0xef5044[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x44')]);}return _0x502d43['getConfigurations'](_0xef5044);}})[_0x7995('0x23')](function(_0x8908cd){if(_0x8908cd){return _0x8908cd?{'count':_0x5e2d97,'rows':_0x8908cd}:null;}})[_0x7995('0x23')](respondWithResult(_0x13cd7b,null))['catch'](handleError(_0x13cd7b,null));};exports[_0x7995('0x5b')]=function(_0x1d2f9d,_0x705f0,_0x3a7d9d){if(_0x1d2f9d[_0x7995('0x53')]['id']){delete _0x1d2f9d[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x1d2f9d[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x705f0,null))[_0x7995('0x23')](function(_0x535131){if(_0x535131){_0x1d2f9d['body'][_0x7995('0x5c')]=_0x535131['id'];_0x1d2f9d[_0x7995('0x53')][_0x7995('0x5d')]=integrations[_0x7995('0x5e')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d[_0x7995('0x53')]['type']);_0x1d2f9d['body'][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d['body'][_0x7995('0x3a')]);return db[_0x7995('0x57')]['create'](_0x1d2f9d['body'],{'include':[{'model':db[_0x7995('0x62')],'as':'Subjects'},{'model':db[_0x7995('0x62')],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x23')](respondWithResult(_0x705f0,null))[_0x7995('0x2b')](handleError(_0x705f0,null));};exports[_0x7995('0x63')]=function(_0x18cff7,_0x8af865,_0x14cb17){var _0x29e0ee='';return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x18cff7[_0x7995('0x4d')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x23')](handleEntityNotFound(_0x8af865,null))[_0x7995('0x23')](function(_0x6ad274){if(_0x6ad274){_0x29e0ee=_0x6ad274[_0x7995('0x64')];var _0x2ff7ba=_0x29e0ee[_0x7995('0x66')](-0x1);if(_0x2ff7ba==='/'){_0x29e0ee=_0x29e0ee[_0x7995('0x67')](0x0,_0x29e0ee[_0x7995('0x68')](_0x2ff7ba));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0x29e0ee,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util['format'](_0x7995('0x6e'),_0x6ad274[_0x7995('0x65')]))['toString']('base64'))},'json':!![]});}})[_0x7995('0x23')](function(_0x3fe8fc){if(_0x3fe8fc){var _0x2d45d5=[_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),'description',_0x7995('0x2d'),_0x7995('0x72'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x73'),_0x7995('0x76')];_[_0x7995('0x77')](_0x3fe8fc,function(_0x560095){return _0x2d45d5[_0x7995('0x78')](_0x560095[_0x7995('0x3d')])||!_0x560095['default']&&_0x560095['type']!==_0x7995('0x79')&&_0x560095[_0x7995('0x3a')]!==_0x7995('0x7a');});return{'count':_0x3fe8fc[_0x7995('0x4f')],'rows':_[_0x7995('0x37')](_0x3fe8fc,function(_0x4a02ea){return{'id':_0x4a02ea[_0x7995('0x3d')],'name':_0x4a02ea[_0x7995('0x7b')],'custom':!_0x4a02ea['default'],'options':_0x4a02ea[_0x7995('0x7c')]?_[_0x7995('0x37')](_0x4a02ea['choices'],function(_0x1535a3){return{'name':_['capitalize'](_0x1535a3),'value':_0x1535a3};}):[]};})};}})[_0x7995('0x23')](respondWithResult(_0x8af865,null))[_0x7995('0x2b')](function(_0x3ab421){var _0x428a1b=_0x18cff7[_0x7995('0x3e')]['test']?0x1f4:_0x3ab421[_0x7995('0x7d')]||0x1f4;logger[_0x7995('0x27')](_0x7995('0x7e'),'getFields',_0x428a1b,JSON[_0x7995('0x7f')](_0x3ab421));delete _0x3ab421[_0x7995('0x3d')];if(_0x428a1b===0x191){_0x428a1b=0x190;}_0x8af865[_0x7995('0x2d')](_0x428a1b)[_0x7995('0x36')](_0x18cff7['query'][_0x7995('0x1e')]?{'message':_0x7995('0x80'),'statusCode':_0x3ab421[_0x7995('0x7d')]}:_0x3ab421);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9022047..d0067d9 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 _0x8e8a=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x4203d2,_0xb85918){var _0x180fde=function(_0x322e24){while(--_0x322e24){_0x4203d2['push'](_0x4203d2['shift']());}};_0x180fde(++_0xb85918);}(_0x8e8a,0x1b2));var _0xa8e8=function(_0xb650d7,_0x2fd3b4){_0xb650d7=_0xb650d7-0x0;var _0x48dae6=_0x8e8a[_0xb650d7];return _0x48dae6;};'use strict';var _=require(_0xa8e8('0x0'));var util=require(_0xa8e8('0x1'));var logger=require(_0xa8e8('0x2'))(_0xa8e8('0x3'));var moment=require(_0xa8e8('0x4'));var BPromise=require(_0xa8e8('0x5'));var rp=require(_0xa8e8('0x6'));var fs=require('fs');var path=require(_0xa8e8('0x7'));var rimraf=require('rimraf');var config=require(_0xa8e8('0x8'));var attributes=require(_0xa8e8('0x9'));var integrations=require(_0xa8e8('0xa'));module[_0xa8e8('0xb')]=function(_0x3f7bb1,_0x316fc4){return _0x3f7bb1[_0xa8e8('0xc')](_0xa8e8('0xd'),attributes,{'tableName':_0xa8e8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x60f0,0xec));var _0x060f=function(_0x48e7e1,_0x2b650d){_0x48e7e1=_0x48e7e1-0x0;var _0x320d9d=_0x60f0[_0x48e7e1];return _0x320d9d;};'use strict';var _=require(_0x060f('0x0'));var util=require(_0x060f('0x1'));var logger=require(_0x060f('0x2'))(_0x060f('0x3'));var moment=require(_0x060f('0x4'));var BPromise=require(_0x060f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x060f('0x6'));var rimraf=require(_0x060f('0x7'));var config=require(_0x060f('0x8'));var attributes=require(_0x060f('0x9'));var integrations=require(_0x060f('0xa'));module[_0x060f('0xb')]=function(_0x213832,_0x44cdc3){return _0x213832[_0x060f('0xc')](_0x060f('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c3e4d54..186c38a 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 _0xf26b=['request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf26b,0xad));var _0xbf26=function(_0xc9783b,_0x7d3db2){_0xc9783b=_0xc9783b-0x0;var _0x57b576=_0xf26b[_0xc9783b];return _0x57b576;};'use strict';var _=require(_0xbf26('0x0'));var util=require(_0xbf26('0x1'));var moment=require(_0xbf26('0x2'));var BPromise=require(_0xbf26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf26('0x4'))['db'];var utils=require(_0xbf26('0x5'));var logger=require(_0xbf26('0x6'))(_0xbf26('0x7'));var config=require(_0xbf26('0x8'));var jayson=require(_0xbf26('0x9'));var client=jayson[_0xbf26('0xa')][_0xbf26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59df92,_0x57fcd4,_0x11dcad){return new BPromise(function(_0x400900,_0x3d5b62){return client[_0xbf26('0xc')](_0x59df92,_0x11dcad)[_0xbf26('0xd')](function(_0x2398a2){logger[_0xbf26('0xe')](_0xbf26('0xf'),_0x57fcd4,'request\x20sent');logger[_0xbf26('0x10')](_0xbf26('0x11'),_0x57fcd4,_0xbf26('0x12'),JSON[_0xbf26('0x13')](_0x2398a2));if(_0x2398a2[_0xbf26('0x14')]){if(_0x2398a2[_0xbf26('0x14')][_0xbf26('0x15')]===0x1f4){logger[_0xbf26('0x14')](_0xbf26('0xf'),_0x57fcd4,_0x2398a2['error'][_0xbf26('0x16')]);return _0x3d5b62(_0x2398a2[_0xbf26('0x14')][_0xbf26('0x16')]);}logger[_0xbf26('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x57fcd4,_0x2398a2[_0xbf26('0x14')][_0xbf26('0x16')]);return _0x400900(_0x2398a2[_0xbf26('0x14')][_0xbf26('0x16')]);}else{logger['info'](_0xbf26('0xf'),_0x57fcd4,'request\x20sent');_0x400900(_0x2398a2[_0xbf26('0x17')]['message']);}})[_0xbf26('0x18')](function(_0x407f67){logger[_0xbf26('0x14')](_0xbf26('0xf'),_0x57fcd4,_0x407f67);_0x3d5b62(_0x407f67);});});}exports[_0xbf26('0x19')]=function(_0x3401c7){var _0x2da750=this;return new Promise(function(_0x195c37,_0x39e85b){return db[_0xbf26('0x1a')][_0xbf26('0x1b')]({'raw':_0x3401c7['options']?_0x3401c7[_0xbf26('0x1c')][_0xbf26('0x1d')]===undefined?!![]:![]:!![],'where':_0x3401c7[_0xbf26('0x1c')]?_0x3401c7[_0xbf26('0x1c')][_0xbf26('0x1e')]||null:null,'attributes':_0x3401c7[_0xbf26('0x1c')]?_0x3401c7['options']['attributes']||null:null,'limit':_0x3401c7['options']?_0x3401c7[_0xbf26('0x1c')][_0xbf26('0x1f')]||null:null,'include':_0x3401c7['options']?_0x3401c7[_0xbf26('0x1c')][_0xbf26('0x20')]?_[_0xbf26('0x21')](_0x3401c7['options'][_0xbf26('0x20')],function(_0x29bcbb){return{'model':db[_0x29bcbb[_0xbf26('0x22')]],'as':_0x29bcbb['as'],'attributes':_0x29bcbb[_0xbf26('0x23')],'include':_0x29bcbb[_0xbf26('0x20')]?_[_0xbf26('0x21')](_0x29bcbb[_0xbf26('0x20')],function(_0x29f706){return{'model':db[_0x29f706['model']],'as':_0x29f706['as'],'attributes':_0x29f706[_0xbf26('0x23')],'include':_0x29f706[_0xbf26('0x20')]?_[_0xbf26('0x21')](_0x29f706[_0xbf26('0x20')],function(_0x4dfe42){return{'model':db[_0x4dfe42['model']],'as':_0x4dfe42['as'],'attributes':_0x4dfe42[_0xbf26('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbf26('0xd')](function(_0x3c2f44){logger[_0xbf26('0xe')](_0xbf26('0x19'),_0x3401c7);logger[_0xbf26('0x10')](_0xbf26('0x19'),_0x3401c7,JSON[_0xbf26('0x13')](_0x3c2f44));_0x195c37(_0x3c2f44);})['catch'](function(_0xb16149){logger[_0xbf26('0x14')](_0xbf26('0x19'),_0xb16149[_0xbf26('0x16')],_0x3401c7);_0x39e85b(_0x2da750[_0xbf26('0x14')](0x1f4,_0xb16149[_0xbf26('0x16')]));});});};exports[_0xbf26('0x24')]=function(_0x21b3b5){var _0x6a87fc=this;return new Promise(function(_0x2b67a4,_0x2ffae7){return db[_0xbf26('0x1a')]['find']({'raw':_0x21b3b5['options']?_0x21b3b5[_0xbf26('0x1c')][_0xbf26('0x1d')]===undefined?!![]:![]:!![],'where':_0x21b3b5['options']?_0x21b3b5[_0xbf26('0x1c')][_0xbf26('0x1e')]||null:null,'attributes':_0x21b3b5[_0xbf26('0x1c')]?_0x21b3b5[_0xbf26('0x1c')]['attributes']||null:null,'include':_0x21b3b5[_0xbf26('0x1c')]?_0x21b3b5['options'][_0xbf26('0x20')]?_[_0xbf26('0x21')](_0x21b3b5[_0xbf26('0x1c')][_0xbf26('0x20')],function(_0x1e95b5){return{'model':db[_0x1e95b5[_0xbf26('0x22')]],'as':_0x1e95b5['as'],'attributes':_0x1e95b5[_0xbf26('0x23')],'include':_0x1e95b5[_0xbf26('0x20')]?_[_0xbf26('0x21')](_0x1e95b5['include'],function(_0x1c1b0c){return{'model':db[_0x1c1b0c[_0xbf26('0x22')]],'as':_0x1c1b0c['as'],'attributes':_0x1c1b0c[_0xbf26('0x23')],'include':_0x1c1b0c['include']?_[_0xbf26('0x21')](_0x1c1b0c[_0xbf26('0x20')],function(_0x4e7a52){return{'model':db[_0x4e7a52['model']],'as':_0x4e7a52['as'],'attributes':_0x4e7a52['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf26('0xd')](function(_0x55edbd){logger[_0xbf26('0xe')]('ShowFreshdeskAccount',_0x21b3b5);logger[_0xbf26('0x10')](_0xbf26('0x24'),_0x21b3b5,JSON[_0xbf26('0x13')](_0x55edbd));_0x2b67a4(_0x55edbd);})['catch'](function(_0x5f207a){logger['error'](_0xbf26('0x24'),_0x5f207a[_0xbf26('0x16')],_0x21b3b5);_0x2ffae7(_0x6a87fc[_0xbf26('0x14')](0x1f4,_0x5f207a[_0xbf26('0x16')]));});});}; \ No newline at end of file +var _0x98dc=['request\x20sent','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','map','model','include','debug','ShowFreshdeskAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x40d3a7,_0x1043f6){var _0x2c8ecc=function(_0x36fa24){while(--_0x36fa24){_0x40d3a7['push'](_0x40d3a7['shift']());}};_0x2c8ecc(++_0x1043f6);}(_0x98dc,0xe8));var _0xc98d=function(_0xf50cd2,_0x52ea7d){_0xf50cd2=_0xf50cd2-0x0;var _0x50c65f=_0x98dc[_0xf50cd2];return _0x50c65f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc98d('0x0'));var BPromise=require('bluebird');var rs=require(_0xc98d('0x1'));var fs=require('fs');var Redis=require(_0xc98d('0x2'));var db=require(_0xc98d('0x3'))['db'];var utils=require(_0xc98d('0x4'));var logger=require(_0xc98d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc98d('0x6'));var client=jayson['client'][_0xc98d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50631e,_0x970d9d,_0x58c1d8){return new BPromise(function(_0x44408d,_0x39e2e3){return client[_0xc98d('0x8')](_0x50631e,_0x58c1d8)[_0xc98d('0x9')](function(_0x1cad89){logger[_0xc98d('0xa')](_0xc98d('0xb'),_0x970d9d,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x970d9d,'request\x20sent',JSON[_0xc98d('0xc')](_0x1cad89));if(_0x1cad89['error']){if(_0x1cad89['error'][_0xc98d('0xd')]===0x1f4){logger[_0xc98d('0xe')](_0xc98d('0xb'),_0x970d9d,_0x1cad89[_0xc98d('0xe')][_0xc98d('0xf')]);return _0x39e2e3(_0x1cad89[_0xc98d('0xe')][_0xc98d('0xf')]);}logger[_0xc98d('0xe')](_0xc98d('0xb'),_0x970d9d,_0x1cad89[_0xc98d('0xe')]['message']);return _0x44408d(_0x1cad89[_0xc98d('0xe')][_0xc98d('0xf')]);}else{logger[_0xc98d('0xa')](_0xc98d('0xb'),_0x970d9d,_0xc98d('0x10'));_0x44408d(_0x1cad89[_0xc98d('0x11')]['message']);}})['catch'](function(_0x406c81){logger[_0xc98d('0xe')](_0xc98d('0xb'),_0x970d9d,_0x406c81);_0x39e2e3(_0x406c81);});});}exports[_0xc98d('0x12')]=function(_0x59d929){var _0x1b985c=this;return new Promise(function(_0x1cc17a,_0x5eeaaa){return db[_0xc98d('0x13')]['findAll']({'raw':_0x59d929[_0xc98d('0x14')]?_0x59d929[_0xc98d('0x14')][_0xc98d('0x15')]===undefined?!![]:![]:!![],'where':_0x59d929[_0xc98d('0x14')]?_0x59d929[_0xc98d('0x14')][_0xc98d('0x16')]||null:null,'attributes':_0x59d929[_0xc98d('0x14')]?_0x59d929[_0xc98d('0x14')][_0xc98d('0x17')]||null:null,'limit':_0x59d929['options']?_0x59d929['options'][_0xc98d('0x18')]||null:null,'include':_0x59d929[_0xc98d('0x14')]?_0x59d929[_0xc98d('0x14')]['include']?_[_0xc98d('0x19')](_0x59d929[_0xc98d('0x14')]['include'],function(_0x3bc42b){return{'model':db[_0x3bc42b[_0xc98d('0x1a')]],'as':_0x3bc42b['as'],'attributes':_0x3bc42b[_0xc98d('0x17')],'include':_0x3bc42b[_0xc98d('0x1b')]?_[_0xc98d('0x19')](_0x3bc42b['include'],function(_0x19ef57){return{'model':db[_0x19ef57[_0xc98d('0x1a')]],'as':_0x19ef57['as'],'attributes':_0x19ef57[_0xc98d('0x17')],'include':_0x19ef57[_0xc98d('0x1b')]?_[_0xc98d('0x19')](_0x19ef57[_0xc98d('0x1b')],function(_0x2d25ef){return{'model':db[_0x2d25ef['model']],'as':_0x2d25ef['as'],'attributes':_0x2d25ef[_0xc98d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b308){logger[_0xc98d('0xa')](_0xc98d('0x12'),_0x59d929);logger[_0xc98d('0x1c')](_0xc98d('0x12'),_0x59d929,JSON[_0xc98d('0xc')](_0x36b308));_0x1cc17a(_0x36b308);})['catch'](function(_0x5beda2){logger['error']('GetFreshdeskAccount',_0x5beda2['message'],_0x59d929);_0x5eeaaa(_0x1b985c[_0xc98d('0xe')](0x1f4,_0x5beda2['message']));});});};exports[_0xc98d('0x1d')]=function(_0x46b267){var _0x50e40c=this;return new Promise(function(_0x244210,_0x3baf1f){return db[_0xc98d('0x13')][_0xc98d('0x1e')]({'raw':_0x46b267[_0xc98d('0x14')]?_0x46b267[_0xc98d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x46b267[_0xc98d('0x14')]?_0x46b267[_0xc98d('0x14')][_0xc98d('0x16')]||null:null,'attributes':_0x46b267[_0xc98d('0x14')]?_0x46b267[_0xc98d('0x14')][_0xc98d('0x17')]||null:null,'include':_0x46b267[_0xc98d('0x14')]?_0x46b267[_0xc98d('0x14')][_0xc98d('0x1b')]?_[_0xc98d('0x19')](_0x46b267['options'][_0xc98d('0x1b')],function(_0x4e129c){return{'model':db[_0x4e129c[_0xc98d('0x1a')]],'as':_0x4e129c['as'],'attributes':_0x4e129c['attributes'],'include':_0x4e129c[_0xc98d('0x1b')]?_[_0xc98d('0x19')](_0x4e129c[_0xc98d('0x1b')],function(_0x8ed85){return{'model':db[_0x8ed85[_0xc98d('0x1a')]],'as':_0x8ed85['as'],'attributes':_0x8ed85[_0xc98d('0x17')],'include':_0x8ed85['include']?_[_0xc98d('0x19')](_0x8ed85[_0xc98d('0x1b')],function(_0x51f78d){return{'model':db[_0x51f78d['model']],'as':_0x51f78d['as'],'attributes':_0x51f78d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6521){logger['info']('ShowFreshdeskAccount',_0x46b267);logger['debug']('ShowFreshdeskAccount',_0x46b267,JSON[_0xc98d('0xc')](_0x4b6521));_0x244210(_0x4b6521);})['catch'](function(_0x4c9da7){logger[_0xc98d('0xe')](_0xc98d('0x1d'),_0x4c9da7[_0xc98d('0xf')],_0x46b267);_0x3baf1f(_0x50e40c[_0xc98d('0xe')](0x1f4,_0x4c9da7[_0xc98d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 35622f6..89e4b17 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 _0x2995=['getSubjects','getTags','post','create','/:id/tags','setTags','put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2995,0x93));var _0x5299=function(_0x1f4630,_0x2d7a4d){_0x1f4630=_0x1f4630-0x0;var _0x1a5230=_0x2995[_0x1f4630];return _0x1a5230;};'use strict';var multer=require(_0x5299('0x0'));var util=require('util');var path=require(_0x5299('0x1'));var timeout=require(_0x5299('0x2'));var express=require(_0x5299('0x3'));var router=express[_0x5299('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5299('0x5'));var config=require(_0x5299('0x6'));var controller=require(_0x5299('0x7'));router[_0x5299('0x8')]('/',auth['isAuthenticated'](),controller[_0x5299('0x9')]);router['get'](_0x5299('0xa'),auth['isAuthenticated'](),controller[_0x5299('0xb')]);router['get'](_0x5299('0xc'),auth[_0x5299('0xd')](),controller['getFields']);router[_0x5299('0x8')]('/:id/subjects',auth[_0x5299('0xd')](),controller[_0x5299('0xe')]);router[_0x5299('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5299('0x8')]('/:id/tags',auth[_0x5299('0xd')](),controller[_0x5299('0xf')]);router[_0x5299('0x10')]('/',auth[_0x5299('0xd')](),controller[_0x5299('0x11')]);router['post'](_0x5299('0x12'),auth[_0x5299('0xd')](),controller[_0x5299('0x13')]);router[_0x5299('0x14')](_0x5299('0xa'),auth['isAuthenticated'](),controller[_0x5299('0x15')]);router['delete'](_0x5299('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5299('0x16')]=router; \ No newline at end of file +var _0x4bbc=['path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','getTags','create','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0x4bbc,0x1b8));var _0xc4bb=function(_0x27e51d,_0x4e1f48){_0x27e51d=_0x27e51d-0x0;var _0x5c4b9a=_0x4bbc[_0x27e51d];return _0x5c4b9a;};'use strict';var multer=require(_0xc4bb('0x0'));var util=require(_0xc4bb('0x1'));var path=require(_0xc4bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xc4bb('0x3'));var router=express[_0xc4bb('0x4')]();var auth=require(_0xc4bb('0x5'));var interaction=require(_0xc4bb('0x6'));var config=require('../../config/environment');var controller=require(_0xc4bb('0x7'));router[_0xc4bb('0x8')]('/',auth[_0xc4bb('0x9')](),controller[_0xc4bb('0xa')]);router[_0xc4bb('0x8')]('/:id',auth[_0xc4bb('0x9')](),controller[_0xc4bb('0xb')]);router[_0xc4bb('0x8')](_0xc4bb('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xc4bb('0x8')]('/:id/subjects',auth[_0xc4bb('0x9')](),controller[_0xc4bb('0xd')]);router[_0xc4bb('0x8')](_0xc4bb('0xe'),auth[_0xc4bb('0x9')](),controller[_0xc4bb('0xf')]);router[_0xc4bb('0x8')]('/:id/tags',auth[_0xc4bb('0x9')](),controller[_0xc4bb('0x10')]);router['post']('/',auth[_0xc4bb('0x9')](),controller[_0xc4bb('0x11')]);router['post'](_0xc4bb('0x12'),auth['isAuthenticated'](),controller[_0xc4bb('0x13')]);router[_0xc4bb('0x14')](_0xc4bb('0x15'),auth[_0xc4bb('0x9')](),controller[_0xc4bb('0x16')]);router[_0xc4bb('0x17')](_0xc4bb('0x15'),auth[_0xc4bb('0x9')](),controller[_0xc4bb('0x18')]);module[_0xc4bb('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 238900b..80b269b 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfeee=['STRING','sequelize'];(function(_0x868611,_0x1a176e){var _0x143a08=function(_0x46b692){while(--_0x46b692){_0x868611['push'](_0x868611['shift']());}};_0x143a08(++_0x1a176e);}(_0xfeee,0x19f));var _0xefee=function(_0x31aa84,_0x3bcc8b){_0x31aa84=_0x31aa84-0x0;var _0x2d9e3e=_0xfeee[_0x31aa84];return _0x2d9e3e;};'use strict';var Sequelize=require(_0xefee('0x0'));module['exports']={'name':{'type':Sequelize[_0xefee('0x1')]},'description':{'type':Sequelize[_0xefee('0x1')]}}; \ No newline at end of file +var _0x4edb=['STRING'];(function(_0x185eb9,_0x143c95){var _0x10f271=function(_0x4af2fc){while(--_0x4af2fc){_0x185eb9['push'](_0x185eb9['shift']());}};_0x10f271(++_0x143c95);}(_0x4edb,0x1d5));var _0xb4ed=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x4edb[_0x197043];return _0x233e33;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb4ed('0x0')]},'description':{'type':Sequelize[_0xb4ed('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2c563c0..584fe97 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 _0xafdd=['create','body','destroy','find','getFields','findOne','getSubjects','FreshdeskField','nolimit','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','request','info','debug','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','length'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0xafdd,0x19a));var _0xdafd=function(_0x7ea9e0,_0x3e2a22){_0x7ea9e0=_0x7ea9e0-0x0;var _0x191073=_0xafdd[_0x7ea9e0];return _0x191073;};'use strict';var pdf=require(_0xdafd('0x0'));var emlformat=require(_0xdafd('0x1'));var rimraf=require(_0xdafd('0x2'));var zipdir=require(_0xdafd('0x3'));var jsonpatch=require(_0xdafd('0x4'));var rp=require(_0xdafd('0x5'));var moment=require(_0xdafd('0x6'));var BPromise=require(_0xdafd('0x7'));var Mustache=require('mustache');var util=require(_0xdafd('0x8'));var path=require(_0xdafd('0x9'));var sox=require(_0xdafd('0xa'));var csv=require(_0xdafd('0xb'));var ejs=require(_0xdafd('0xc'));var fs=require('fs');var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xb'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var db=require(_0xdafd('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xdafd('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x553508,_0x11a3e4,_0x35d2e5){if(_0x35d2e5){var _0x55b05a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55b05a[_0xdafd('0x1c')](_0x11a3e4)){return _0x553508;}else{throw new db['Sequelize']['ValidationError'](_0xdafd('0x1d'));}}else{return _0x553508;}}function respondWithRpcPromise(_0x14b895,_0x583b1d,_0x267bfc,_0x186379){return new BPromise(function(_0x496515,_0x47240f){var _0x1842d3=_0x186379||client;return _0x1842d3[_0xdafd('0x1e')](_0x14b895,_0x267bfc)['then'](function(_0xb382ca){logger[_0xdafd('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x583b1d,'request\x20sent');logger[_0xdafd('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x583b1d,_0xdafd('0x21'),JSON[_0xdafd('0x22')](_0xb382ca));if(_0xb382ca[_0xdafd('0x23')]){if(_0xb382ca[_0xdafd('0x23')][_0xdafd('0x24')]===0x1f4){logger[_0xdafd('0x23')](_0xdafd('0x25'),_0x583b1d,_0xb382ca[_0xdafd('0x23')][_0xdafd('0x26')]);return _0x47240f(_0xb382ca[_0xdafd('0x23')][_0xdafd('0x26')]);}logger[_0xdafd('0x23')](_0xdafd('0x25'),_0x583b1d,_0xb382ca[_0xdafd('0x23')]['message']);return _0x496515(_0xb382ca[_0xdafd('0x23')]['message']);}else{logger[_0xdafd('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x583b1d,_0xdafd('0x21'));_0x496515(_0xb382ca[_0xdafd('0x27')][_0xdafd('0x26')]);}})[_0xdafd('0x28')](function(_0xfc36d7){logger[_0xdafd('0x23')](_0xdafd('0x25'),_0x583b1d,_0xfc36d7);_0x47240f(_0xfc36d7);});});}function respondWithStatusCode(_0x30cba9,_0x3846dd){_0x3846dd=_0x3846dd||0xcc;return function(_0x5cd11d){if(_0x5cd11d){return _0x30cba9[_0xdafd('0x29')](_0x3846dd);}return _0x30cba9[_0xdafd('0x2a')](_0x3846dd)[_0xdafd('0x2b')]();};}function respondWithResult(_0x1feb5b,_0x16e828){_0x16e828=_0x16e828||0xc8;return function(_0x25f277){if(_0x25f277){return _0x1feb5b[_0xdafd('0x2a')](_0x16e828)[_0xdafd('0x2c')](_0x25f277);}};}function respondWithFilteredResult(_0x1c7083,_0x18dd7a){return function(_0x4c5363){if(_0x4c5363){var _0x243182=_0x4c5363[_0xdafd('0x2d')],_0x14626b=_0x18dd7a[_0xdafd('0x2e')],_0x13ab81=_0x18dd7a['offset']+_0x18dd7a['limit'],_0x249743;if(_0x13ab81>=_0x243182){_0x13ab81=_0x243182;_0x249743=0xc8;}else{_0x249743=0xce;}_0x1c7083['status'](_0x249743);return _0x1c7083[_0xdafd('0x2f')](_0xdafd('0x30'),_0x14626b+'-'+_0x13ab81+'/'+_0x243182)['json'](_0x4c5363);}return null;};}function patchUpdates(_0x4f6cb1){return function(_0x4172ea){try{jsonpatch[_0xdafd('0x31')](_0x4172ea,_0x4f6cb1,!![]);}catch(_0x432210){return BPromise[_0xdafd('0x32')](_0x432210);}return _0x4172ea[_0xdafd('0x33')]();};}function saveUpdates(_0xa8b2ac,_0x3e1287){return function(_0x5cc406){if(_0x5cc406){return _0x5cc406[_0xdafd('0x34')](_0xa8b2ac)[_0xdafd('0x35')](function(_0x477e5b){return _0x477e5b;});}return null;};}function removeEntity(_0x500504,_0xc187e0){return function(_0x34e2c1){if(_0x34e2c1){return _0x34e2c1['destroy']()[_0xdafd('0x35')](function(){_0x500504[_0xdafd('0x2a')](0xcc)[_0xdafd('0x2b')]();});}};}function handleEntityNotFound(_0x4a46a9,_0x41cf77){return function(_0x7698f5){if(!_0x7698f5){_0x4a46a9[_0xdafd('0x29')](0x194);}return _0x7698f5;};}function handleError(_0x37c20d,_0x826619){_0x826619=_0x826619||0x1f4;return function(_0x162645){logger[_0xdafd('0x23')](_0x162645['stack']);if(_0x162645[_0xdafd('0x36')]){delete _0x162645[_0xdafd('0x36')];}_0x37c20d[_0xdafd('0x2a')](_0x826619)[_0xdafd('0x37')](_0x162645);};}exports[_0xdafd('0x38')]=function(_0x5d5fb8,_0x386cf6){var _0x21d724={},_0x501470={},_0x3dbdb1={'count':0x0,'rows':[]};var _0x16fb7b=_[_0xdafd('0x39')](db[_0xdafd('0x3a')][_0xdafd('0x3b')],function(_0x1611f0){return{'name':_0x1611f0[_0xdafd('0x3c')],'type':_0x1611f0[_0xdafd('0x3d')][_0xdafd('0x3e')]};});_0x501470[_0xdafd('0x3f')]=_[_0xdafd('0x39')](_0x16fb7b,_0xdafd('0x36'));_0x501470[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x5d5fb8[_0xdafd('0x40')]);_0x501470[_0xdafd('0x42')]=_[_0xdafd('0x43')](_0x501470[_0xdafd('0x3f')],_0x501470[_0xdafd('0x40')]);_0x21d724[_0xdafd('0x44')]=_[_0xdafd('0x43')](_0x501470[_0xdafd('0x3f')],qs[_0xdafd('0x45')](_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x45')]));_0x21d724[_0xdafd('0x44')]=_0x21d724['attributes']['length']?_0x21d724[_0xdafd('0x44')]:_0x501470['model'];if(!_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x46')]('nolimit')){_0x21d724['limit']=qs[_0xdafd('0x47')](_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x47')]);_0x21d724[_0xdafd('0x2e')]=qs[_0xdafd('0x2e')](_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x2e')]);}_0x21d724[_0xdafd('0x48')]=qs[_0xdafd('0x49')](_0x5d5fb8['query']['sort']);_0x21d724[_0xdafd('0x4a')]=qs[_0xdafd('0x42')](_[_0xdafd('0x4b')](_0x5d5fb8[_0xdafd('0x40')],_0x501470[_0xdafd('0x42')]),_0x16fb7b);if(_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x4c')]){_0x21d724[_0xdafd('0x4a')]=_[_0xdafd('0x4d')](_0x21d724[_0xdafd('0x4a')],{'$or':_[_0xdafd('0x39')](_0x16fb7b,function(_0x3a9505){if(_0x3a9505[_0xdafd('0x3d')]!=='VIRTUAL'){var _0x43c44a={};_0x43c44a[_0x3a9505['name']]={'$like':'%'+_0x5d5fb8[_0xdafd('0x40')]['filter']+'%'};return _0x43c44a;}})});}_0x21d724=_[_0xdafd('0x4d')]({},_0x21d724,_0x5d5fb8[_0xdafd('0x4e')]);var _0x4464f2={'where':_0x21d724[_0xdafd('0x4a')]};return db[_0xdafd('0x3a')][_0xdafd('0x2d')](_0x4464f2)['then'](function(_0x322c1a){_0x3dbdb1[_0xdafd('0x2d')]=_0x322c1a;if(_0x5d5fb8[_0xdafd('0x40')][_0xdafd('0x4f')]){_0x21d724[_0xdafd('0x50')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x21d724);})[_0xdafd('0x35')](function(_0x44b71a){_0x3dbdb1[_0xdafd('0x51')]=_0x44b71a;return _0x3dbdb1;})[_0xdafd('0x35')](respondWithFilteredResult(_0x386cf6,_0x21d724))[_0xdafd('0x28')](handleError(_0x386cf6,null));};exports[_0xdafd('0x52')]=function(_0x274e0b,_0x2f5e4c){var _0x2ae4cd={'raw':![],'where':{'id':_0x274e0b[_0xdafd('0x53')]['id']}},_0x5058b1={};_0x5058b1[_0xdafd('0x3f')]=_[_0xdafd('0x41')](db[_0xdafd('0x3a')]['rawAttributes']);_0x5058b1[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x274e0b[_0xdafd('0x40')]);_0x5058b1[_0xdafd('0x42')]=_[_0xdafd('0x43')](_0x5058b1['model'],_0x5058b1['query']);_0x2ae4cd[_0xdafd('0x44')]=_[_0xdafd('0x43')](_0x5058b1['model'],qs['fields'](_0x274e0b[_0xdafd('0x40')][_0xdafd('0x45')]));_0x2ae4cd['attributes']=_0x2ae4cd[_0xdafd('0x44')][_0xdafd('0x54')]?_0x2ae4cd[_0xdafd('0x44')]:_0x5058b1['model'];if(_0x274e0b['query'][_0xdafd('0x4f')]){_0x2ae4cd[_0xdafd('0x50')]=[{'all':!![]}];}_0x2ae4cd=_['merge']({},_0x2ae4cd,_0x274e0b[_0xdafd('0x4e')]);return db['FreshdeskConfiguration']['find'](_0x2ae4cd)[_0xdafd('0x35')](handleEntityNotFound(_0x2f5e4c,null))[_0xdafd('0x35')](respondWithResult(_0x2f5e4c,null))[_0xdafd('0x28')](handleError(_0x2f5e4c,null));};exports[_0xdafd('0x55')]=function(_0x150fe1,_0x307f35){return db[_0xdafd('0x3a')][_0xdafd('0x55')](_0x150fe1['body'],{})[_0xdafd('0x35')](respondWithResult(_0x307f35,0xc9))[_0xdafd('0x28')](handleError(_0x307f35,null));};exports['update']=function(_0x1a50dc,_0x212dd7){if(_0x1a50dc[_0xdafd('0x56')]['id']){delete _0x1a50dc[_0xdafd('0x56')]['id'];}return db[_0xdafd('0x3a')]['find']({'where':{'id':_0x1a50dc[_0xdafd('0x53')]['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x212dd7,null))[_0xdafd('0x35')](saveUpdates(_0x1a50dc[_0xdafd('0x56')],null))[_0xdafd('0x35')](respondWithResult(_0x212dd7,null))['catch'](handleError(_0x212dd7,null));};exports[_0xdafd('0x57')]=function(_0x810d30,_0x55284e){return db['FreshdeskConfiguration'][_0xdafd('0x58')]({'where':{'id':_0x810d30['params']['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x55284e,null))['then'](removeEntity(_0x55284e,null))[_0xdafd('0x28')](handleError(_0x55284e,null));};exports[_0xdafd('0x59')]=function(_0x403a3b,_0x589664,_0xf2f551){var _0x5210be={};var _0xf9cc85={};var _0x2cdc84;var _0x4dced8;return db[_0xdafd('0x3a')][_0xdafd('0x5a')]({'where':{'id':_0x403a3b[_0xdafd('0x53')]['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x589664,null))[_0xdafd('0x35')](function(_0x4a651e){if(_0x4a651e){_0x2cdc84=_0x4a651e;_0xf9cc85[_0xdafd('0x3f')]=_[_0xdafd('0x41')](db['FreshdeskField'][_0xdafd('0x3b')]);_0xf9cc85[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x403a3b[_0xdafd('0x40')]);_0xf9cc85[_0xdafd('0x42')]=_['intersection'](_0xf9cc85[_0xdafd('0x3f')],_0xf9cc85['query']);_0x5210be['attributes']=_[_0xdafd('0x43')](_0xf9cc85['model'],qs[_0xdafd('0x45')](_0x403a3b[_0xdafd('0x40')][_0xdafd('0x45')]));_0x5210be[_0xdafd('0x44')]=_0x5210be['attributes'][_0xdafd('0x54')]?_0x5210be[_0xdafd('0x44')]:_0xf9cc85[_0xdafd('0x3f')];_0x5210be[_0xdafd('0x48')]=qs[_0xdafd('0x49')](_0x403a3b[_0xdafd('0x40')][_0xdafd('0x49')]);_0x5210be[_0xdafd('0x4a')]=qs[_0xdafd('0x42')](_[_0xdafd('0x4b')](_0x403a3b[_0xdafd('0x40')],_0xf9cc85[_0xdafd('0x42')]));if(_0x403a3b[_0xdafd('0x40')][_0xdafd('0x4c')]){_0x5210be[_0xdafd('0x4a')]=_[_0xdafd('0x4d')](_0x5210be[_0xdafd('0x4a')],{'$or':_['map'](_0x5210be[_0xdafd('0x44')],function(_0x4b6bd6){var _0x1523f5={};_0x1523f5[_0x4b6bd6]={'$like':'%'+_0x403a3b['query'][_0xdafd('0x4c')]+'%'};return _0x1523f5;})});}_0x5210be=_[_0xdafd('0x4d')]({},_0x5210be,_0x403a3b['options']);return _0x2cdc84['getFields'](_0x5210be);}})[_0xdafd('0x35')](function(_0x1490d0){if(_0x1490d0){_0x4dced8=_0x1490d0[_0xdafd('0x54')];if(!_0x403a3b['query']['hasOwnProperty']('nolimit')){_0x5210be[_0xdafd('0x47')]=qs['limit'](_0x403a3b[_0xdafd('0x40')]['limit']);_0x5210be[_0xdafd('0x2e')]=qs[_0xdafd('0x2e')](_0x403a3b[_0xdafd('0x40')][_0xdafd('0x2e')]);}return _0x2cdc84[_0xdafd('0x59')](_0x5210be);}})['then'](function(_0x512e51){if(_0x512e51){return _0x512e51?{'count':_0x4dced8,'rows':_0x512e51}:null;}})[_0xdafd('0x35')](respondWithResult(_0x589664,null))['catch'](handleError(_0x589664,null));};exports[_0xdafd('0x5b')]=function(_0x1c27c8,_0x580ffa,_0xf901ea){var _0x397a4e={};var _0x4bfc18={};var _0x2524b5;var _0x35e35b;return db[_0xdafd('0x3a')][_0xdafd('0x5a')]({'where':{'id':_0x1c27c8[_0xdafd('0x53')]['id']}})['then'](handleEntityNotFound(_0x580ffa,null))[_0xdafd('0x35')](function(_0xf3407c){if(_0xf3407c){_0x2524b5=_0xf3407c;_0x4bfc18['model']=_[_0xdafd('0x41')](db[_0xdafd('0x5c')]['rawAttributes']);_0x4bfc18[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x1c27c8['query']);_0x4bfc18[_0xdafd('0x42')]=_[_0xdafd('0x43')](_0x4bfc18[_0xdafd('0x3f')],_0x4bfc18['query']);_0x397a4e[_0xdafd('0x44')]=_[_0xdafd('0x43')](_0x4bfc18[_0xdafd('0x3f')],qs[_0xdafd('0x45')](_0x1c27c8['query']['fields']));_0x397a4e[_0xdafd('0x44')]=_0x397a4e[_0xdafd('0x44')]['length']?_0x397a4e[_0xdafd('0x44')]:_0x4bfc18[_0xdafd('0x3f')];_0x397a4e[_0xdafd('0x48')]=qs[_0xdafd('0x49')](_0x1c27c8[_0xdafd('0x40')][_0xdafd('0x49')]);_0x397a4e['where']=qs[_0xdafd('0x42')](_[_0xdafd('0x4b')](_0x1c27c8['query'],_0x4bfc18[_0xdafd('0x42')]));if(_0x1c27c8[_0xdafd('0x40')][_0xdafd('0x4c')]){_0x397a4e[_0xdafd('0x4a')]=_[_0xdafd('0x4d')](_0x397a4e[_0xdafd('0x4a')],{'$or':_[_0xdafd('0x39')](_0x397a4e[_0xdafd('0x44')],function(_0x28f9b3){var _0x3cc0fa={};_0x3cc0fa[_0x28f9b3]={'$like':'%'+_0x1c27c8[_0xdafd('0x40')]['filter']+'%'};return _0x3cc0fa;})});}_0x397a4e=_[_0xdafd('0x4d')]({},_0x397a4e,_0x1c27c8[_0xdafd('0x4e')]);return _0x2524b5[_0xdafd('0x5b')](_0x397a4e);}})[_0xdafd('0x35')](function(_0x2456ad){if(_0x2456ad){_0x35e35b=_0x2456ad[_0xdafd('0x54')];if(!_0x1c27c8[_0xdafd('0x40')][_0xdafd('0x46')](_0xdafd('0x5d'))){_0x397a4e[_0xdafd('0x47')]=qs[_0xdafd('0x47')](_0x1c27c8['query'][_0xdafd('0x47')]);_0x397a4e[_0xdafd('0x2e')]=qs['offset'](_0x1c27c8[_0xdafd('0x40')][_0xdafd('0x2e')]);}return _0x2524b5[_0xdafd('0x5b')](_0x397a4e);}})['then'](function(_0x153578){if(_0x153578){return _0x153578?{'count':_0x35e35b,'rows':_0x153578}:null;}})['then'](respondWithResult(_0x580ffa,null))[_0xdafd('0x28')](handleError(_0x580ffa,null));};exports[_0xdafd('0x5e')]=function(_0x50de50,_0x233b03,_0x1f8091){var _0x2a92d6={};var _0xde368={};var _0x258ba0;var _0x2d8032;return db[_0xdafd('0x3a')][_0xdafd('0x5a')]({'where':{'id':_0x50de50[_0xdafd('0x53')]['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x233b03,null))[_0xdafd('0x35')](function(_0x9eb4b4){if(_0x9eb4b4){_0x258ba0=_0x9eb4b4;_0xde368['model']=_['keys'](db[_0xdafd('0x5c')][_0xdafd('0x3b')]);_0xde368[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x50de50[_0xdafd('0x40')]);_0xde368[_0xdafd('0x42')]=_[_0xdafd('0x43')](_0xde368[_0xdafd('0x3f')],_0xde368['query']);_0x2a92d6[_0xdafd('0x44')]=_[_0xdafd('0x43')](_0xde368[_0xdafd('0x3f')],qs[_0xdafd('0x45')](_0x50de50['query']['fields']));_0x2a92d6['attributes']=_0x2a92d6[_0xdafd('0x44')]['length']?_0x2a92d6[_0xdafd('0x44')]:_0xde368[_0xdafd('0x3f')];_0x2a92d6[_0xdafd('0x48')]=qs[_0xdafd('0x49')](_0x50de50['query'][_0xdafd('0x49')]);_0x2a92d6[_0xdafd('0x4a')]=qs[_0xdafd('0x42')](_[_0xdafd('0x4b')](_0x50de50[_0xdafd('0x40')],_0xde368['filters']));if(_0x50de50[_0xdafd('0x40')]['filter']){_0x2a92d6[_0xdafd('0x4a')]=_[_0xdafd('0x4d')](_0x2a92d6['where'],{'$or':_[_0xdafd('0x39')](_0x2a92d6[_0xdafd('0x44')],function(_0x4d4d66){var _0x16f771={};_0x16f771[_0x4d4d66]={'$like':'%'+_0x50de50[_0xdafd('0x40')][_0xdafd('0x4c')]+'%'};return _0x16f771;})});}_0x2a92d6=_['merge']({},_0x2a92d6,_0x50de50[_0xdafd('0x4e')]);return _0x258ba0['getDescriptions'](_0x2a92d6);}})[_0xdafd('0x35')](function(_0x1d8287){if(_0x1d8287){_0x2d8032=_0x1d8287[_0xdafd('0x54')];if(!_0x50de50[_0xdafd('0x40')]['hasOwnProperty']('nolimit')){_0x2a92d6[_0xdafd('0x47')]=qs[_0xdafd('0x47')](_0x50de50[_0xdafd('0x40')][_0xdafd('0x47')]);_0x2a92d6[_0xdafd('0x2e')]=qs[_0xdafd('0x2e')](_0x50de50[_0xdafd('0x40')][_0xdafd('0x2e')]);}return _0x258ba0['getDescriptions'](_0x2a92d6);}})[_0xdafd('0x35')](function(_0x1f483c){if(_0x1f483c){return _0x1f483c?{'count':_0x2d8032,'rows':_0x1f483c}:null;}})[_0xdafd('0x35')](respondWithResult(_0x233b03,null))[_0xdafd('0x28')](handleError(_0x233b03,null));};exports['getTags']=function(_0x2fd239,_0x342ed1,_0x4e5072){var _0xe7595d={};var _0x2763df={};var _0x4c910a;var _0x162ffc;return db['FreshdeskConfiguration'][_0xdafd('0x5a')]({'where':{'id':_0x2fd239[_0xdafd('0x53')]['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x342ed1,null))[_0xdafd('0x35')](function(_0x4fda30){if(_0x4fda30){_0x4c910a=_0x4fda30;_0x2763df['model']=_[_0xdafd('0x41')](db[_0xdafd('0x5f')]['rawAttributes']);_0x2763df[_0xdafd('0x40')]=_[_0xdafd('0x41')](_0x2fd239[_0xdafd('0x40')]);_0x2763df[_0xdafd('0x42')]=_['intersection'](_0x2763df[_0xdafd('0x3f')],_0x2763df['query']);_0xe7595d[_0xdafd('0x44')]=_[_0xdafd('0x43')](_0x2763df[_0xdafd('0x3f')],qs['fields'](_0x2fd239[_0xdafd('0x40')]['fields']));_0xe7595d[_0xdafd('0x44')]=_0xe7595d[_0xdafd('0x44')][_0xdafd('0x54')]?_0xe7595d[_0xdafd('0x44')]:_0x2763df[_0xdafd('0x3f')];_0xe7595d[_0xdafd('0x48')]=qs[_0xdafd('0x49')](_0x2fd239['query'][_0xdafd('0x49')]);_0xe7595d[_0xdafd('0x4a')]=qs[_0xdafd('0x42')](_['pick'](_0x2fd239[_0xdafd('0x40')],_0x2763df['filters']));if(_0x2fd239[_0xdafd('0x40')][_0xdafd('0x4c')]){_0xe7595d[_0xdafd('0x4a')]=_[_0xdafd('0x4d')](_0xe7595d['where'],{'$or':_[_0xdafd('0x39')](_0xe7595d[_0xdafd('0x44')],function(_0x5ffaaf){var _0xaa609e={};_0xaa609e[_0x5ffaaf]={'$like':'%'+_0x2fd239[_0xdafd('0x40')]['filter']+'%'};return _0xaa609e;})});}_0xe7595d=_[_0xdafd('0x4d')]({},_0xe7595d,_0x2fd239['options']);return _0x4c910a[_0xdafd('0x60')](_0xe7595d);}})[_0xdafd('0x35')](function(_0x5e404e){if(_0x5e404e){_0x162ffc=_0x5e404e['length'];if(!_0x2fd239[_0xdafd('0x40')][_0xdafd('0x46')]('nolimit')){_0xe7595d[_0xdafd('0x47')]=qs['limit'](_0x2fd239[_0xdafd('0x40')][_0xdafd('0x47')]);_0xe7595d[_0xdafd('0x2e')]=qs[_0xdafd('0x2e')](_0x2fd239[_0xdafd('0x40')][_0xdafd('0x2e')]);}return _0x4c910a[_0xdafd('0x60')](_0xe7595d);}})[_0xdafd('0x35')](function(_0x30d2d5){if(_0x30d2d5){return _0x30d2d5?{'count':_0x162ffc,'rows':_0x30d2d5}:null;}})[_0xdafd('0x35')](respondWithResult(_0x342ed1,null))[_0xdafd('0x28')](handleError(_0x342ed1,null));};exports[_0xdafd('0x61')]=function(_0x2921f2,_0x526623,_0x2eb72e){if(_0x2921f2[_0xdafd('0x56')]['id']){delete _0x2921f2[_0xdafd('0x56')]['id'];}return db['FreshdeskConfiguration'][_0xdafd('0x5a')]({'where':{'id':_0x2921f2['params']['id']}})[_0xdafd('0x35')](handleEntityNotFound(_0x526623,null))[_0xdafd('0x35')](function(_0x677036){if(_0x677036){return _0x677036[_0xdafd('0x61')](_0x2921f2['body'][_0xdafd('0x62')]||[]);}return null;})[_0xdafd('0x35')](respondWithResult(_0x526623,null))[_0xdafd('0x28')](handleError(_0x526623,null));}; \ No newline at end of file +var _0xcdc2=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','reject','save','update','destroy','stack','name','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','find','create','body','params','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0xbc6566,_0x32d463){var _0x4ed128=function(_0x5555ae){while(--_0x5555ae){_0xbc6566['push'](_0xbc6566['shift']());}};_0x4ed128(++_0x32d463);}(_0xcdc2,0xae));var _0x2cdc=function(_0x5c5e92,_0x57c393){_0x5c5e92=_0x5c5e92-0x0;var _0x590e8a=_0xcdc2[_0x5c5e92];return _0x590e8a;};'use strict';var pdf=require(_0x2cdc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cdc('0x2'));var rp=require('request-promise');var moment=require(_0x2cdc('0x3'));var BPromise=require(_0x2cdc('0x4'));var Mustache=require(_0x2cdc('0x5'));var util=require('util');var path=require(_0x2cdc('0x6'));var sox=require(_0x2cdc('0x7'));var csv=require(_0x2cdc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cdc('0x9'));var squel=require(_0x2cdc('0xa'));var crypto=require('crypto');var jsforce=require(_0x2cdc('0xb'));var deskjs=require(_0x2cdc('0xc'));var toCsv=require(_0x2cdc('0x8'));var querystring=require('querystring');var Papa=require(_0x2cdc('0xd'));var Redis=require(_0x2cdc('0xe'));var authService=require(_0x2cdc('0xf'));var qs=require(_0x2cdc('0x10'));var as=require(_0x2cdc('0x11'));var hardwareService=require(_0x2cdc('0x12'));var logger=require(_0x2cdc('0x13'))(_0x2cdc('0x14'));var utils=require(_0x2cdc('0x15'));var config=require(_0x2cdc('0x16'));var db=require(_0x2cdc('0x17'))['db'];var jayson=require(_0x2cdc('0x18'));var client=jayson['client'][_0x2cdc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x18de69,_0x79c18d,_0x324fe7){if(_0x324fe7){var _0x3e06e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e06e8[_0x2cdc('0x1a')](_0x79c18d)){return _0x18de69;}else{throw new db[(_0x2cdc('0x1b'))]['ValidationError'](_0x2cdc('0x1c'));}}else{return _0x18de69;}}function respondWithRpcPromise(_0x6a1923,_0x5d0dab,_0x147210,_0x1a9dcc){return new BPromise(function(_0x3279f5,_0x4eaa88){var _0x6d3f4=_0x1a9dcc||client;return _0x6d3f4[_0x2cdc('0x1d')](_0x6a1923,_0x147210)[_0x2cdc('0x1e')](function(_0x123ebc){logger[_0x2cdc('0x1f')](_0x2cdc('0x20'),_0x5d0dab,_0x2cdc('0x21'));logger['debug'](_0x2cdc('0x22'),_0x5d0dab,'request\x20sent',JSON[_0x2cdc('0x23')](_0x123ebc));if(_0x123ebc[_0x2cdc('0x24')]){if(_0x123ebc['error'][_0x2cdc('0x25')]===0x1f4){logger[_0x2cdc('0x24')](_0x2cdc('0x20'),_0x5d0dab,_0x123ebc[_0x2cdc('0x24')]['message']);return _0x4eaa88(_0x123ebc['error'][_0x2cdc('0x26')]);}logger[_0x2cdc('0x24')](_0x2cdc('0x20'),_0x5d0dab,_0x123ebc[_0x2cdc('0x24')]['message']);return _0x3279f5(_0x123ebc[_0x2cdc('0x24')][_0x2cdc('0x26')]);}else{logger[_0x2cdc('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d0dab,'request\x20sent');_0x3279f5(_0x123ebc['result']['message']);}})[_0x2cdc('0x27')](function(_0x4e00c9){logger[_0x2cdc('0x24')](_0x2cdc('0x20'),_0x5d0dab,_0x4e00c9);_0x4eaa88(_0x4e00c9);});});}function respondWithStatusCode(_0x1a0217,_0x135b74){_0x135b74=_0x135b74||0xcc;return function(_0x47d1b2){if(_0x47d1b2){return _0x1a0217[_0x2cdc('0x28')](_0x135b74);}return _0x1a0217[_0x2cdc('0x29')](_0x135b74)[_0x2cdc('0x2a')]();};}function respondWithResult(_0x538eab,_0x3f5aab){_0x3f5aab=_0x3f5aab||0xc8;return function(_0x49486d){if(_0x49486d){return _0x538eab[_0x2cdc('0x29')](_0x3f5aab)[_0x2cdc('0x2b')](_0x49486d);}};}function respondWithFilteredResult(_0x159848,_0x3c7560){return function(_0x2bc06a){if(_0x2bc06a){var _0x4d97e7=_0x2bc06a[_0x2cdc('0x2c')],_0x45c6c5=_0x3c7560['offset'],_0x498880=_0x3c7560[_0x2cdc('0x2d')]+_0x3c7560[_0x2cdc('0x2e')],_0x43cfde;if(_0x498880>=_0x4d97e7){_0x498880=_0x4d97e7;_0x43cfde=0xc8;}else{_0x43cfde=0xce;}_0x159848[_0x2cdc('0x29')](_0x43cfde);return _0x159848['set']('Content-Range',_0x45c6c5+'-'+_0x498880+'/'+_0x4d97e7)[_0x2cdc('0x2b')](_0x2bc06a);}return null;};}function patchUpdates(_0x38e545){return function(_0x193159){try{jsonpatch['apply'](_0x193159,_0x38e545,!![]);}catch(_0x59b35b){return BPromise[_0x2cdc('0x2f')](_0x59b35b);}return _0x193159[_0x2cdc('0x30')]();};}function saveUpdates(_0x2edb1c,_0x3b430d){return function(_0x5b557e){if(_0x5b557e){return _0x5b557e[_0x2cdc('0x31')](_0x2edb1c)[_0x2cdc('0x1e')](function(_0x4d1eb2){return _0x4d1eb2;});}return null;};}function removeEntity(_0x17740e,_0x8dd4cc){return function(_0x325fd3){if(_0x325fd3){return _0x325fd3[_0x2cdc('0x32')]()[_0x2cdc('0x1e')](function(){_0x17740e[_0x2cdc('0x29')](0xcc)[_0x2cdc('0x2a')]();});}};}function handleEntityNotFound(_0x3d70ae,_0x14b04b){return function(_0x3a3bd0){if(!_0x3a3bd0){_0x3d70ae[_0x2cdc('0x28')](0x194);}return _0x3a3bd0;};}function handleError(_0x2ab3d5,_0x51a5bb){_0x51a5bb=_0x51a5bb||0x1f4;return function(_0x2d341d){logger['error'](_0x2d341d[_0x2cdc('0x33')]);if(_0x2d341d[_0x2cdc('0x34')]){delete _0x2d341d[_0x2cdc('0x34')];}_0x2ab3d5[_0x2cdc('0x29')](_0x51a5bb)['send'](_0x2d341d);};}exports['index']=function(_0x63de4,_0x425257){var _0x5b6020={},_0x5d06d2={},_0x3bf462={'count':0x0,'rows':[]};var _0x3c87b7=_[_0x2cdc('0x35')](db[_0x2cdc('0x36')][_0x2cdc('0x37')],function(_0x5e776d){return{'name':_0x5e776d['fieldName'],'type':_0x5e776d[_0x2cdc('0x38')][_0x2cdc('0x39')]};});_0x5d06d2[_0x2cdc('0x3a')]=_[_0x2cdc('0x35')](_0x3c87b7,_0x2cdc('0x34'));_0x5d06d2['query']=_['keys'](_0x63de4[_0x2cdc('0x3b')]);_0x5d06d2[_0x2cdc('0x3c')]=_[_0x2cdc('0x3d')](_0x5d06d2[_0x2cdc('0x3a')],_0x5d06d2[_0x2cdc('0x3b')]);_0x5b6020[_0x2cdc('0x3e')]=_[_0x2cdc('0x3d')](_0x5d06d2[_0x2cdc('0x3a')],qs[_0x2cdc('0x3f')](_0x63de4[_0x2cdc('0x3b')][_0x2cdc('0x3f')]));_0x5b6020[_0x2cdc('0x3e')]=_0x5b6020[_0x2cdc('0x3e')][_0x2cdc('0x40')]?_0x5b6020[_0x2cdc('0x3e')]:_0x5d06d2[_0x2cdc('0x3a')];if(!_0x63de4['query'][_0x2cdc('0x41')](_0x2cdc('0x42'))){_0x5b6020[_0x2cdc('0x2e')]=qs['limit'](_0x63de4[_0x2cdc('0x3b')][_0x2cdc('0x2e')]);_0x5b6020[_0x2cdc('0x2d')]=qs['offset'](_0x63de4[_0x2cdc('0x3b')]['offset']);}_0x5b6020[_0x2cdc('0x43')]=qs['sort'](_0x63de4[_0x2cdc('0x3b')]['sort']);_0x5b6020[_0x2cdc('0x44')]=qs[_0x2cdc('0x3c')](_[_0x2cdc('0x45')](_0x63de4[_0x2cdc('0x3b')],_0x5d06d2['filters']),_0x3c87b7);if(_0x63de4[_0x2cdc('0x3b')][_0x2cdc('0x46')]){_0x5b6020[_0x2cdc('0x44')]=_[_0x2cdc('0x47')](_0x5b6020[_0x2cdc('0x44')],{'$or':_[_0x2cdc('0x35')](_0x3c87b7,function(_0xa4e0e9){if(_0xa4e0e9[_0x2cdc('0x38')]!==_0x2cdc('0x48')){var _0x5de2ea={};_0x5de2ea[_0xa4e0e9[_0x2cdc('0x34')]]={'$like':'%'+_0x63de4[_0x2cdc('0x3b')]['filter']+'%'};return _0x5de2ea;}})});}_0x5b6020=_[_0x2cdc('0x47')]({},_0x5b6020,_0x63de4[_0x2cdc('0x49')]);var _0x489a97={'where':_0x5b6020['where']};return db[_0x2cdc('0x36')][_0x2cdc('0x2c')](_0x489a97)[_0x2cdc('0x1e')](function(_0x437b0e){_0x3bf462[_0x2cdc('0x2c')]=_0x437b0e;if(_0x63de4[_0x2cdc('0x3b')][_0x2cdc('0x4a')]){_0x5b6020['include']=[{'all':!![]}];}return db[_0x2cdc('0x36')][_0x2cdc('0x4b')](_0x5b6020);})[_0x2cdc('0x1e')](function(_0x39f50d){_0x3bf462[_0x2cdc('0x4c')]=_0x39f50d;return _0x3bf462;})[_0x2cdc('0x1e')](respondWithFilteredResult(_0x425257,_0x5b6020))[_0x2cdc('0x27')](handleError(_0x425257,null));};exports[_0x2cdc('0x4d')]=function(_0x5e1251,_0x589b28){var _0x263751={'raw':![],'where':{'id':_0x5e1251['params']['id']}},_0x1da637={};_0x1da637['model']=_[_0x2cdc('0x4e')](db[_0x2cdc('0x36')][_0x2cdc('0x37')]);_0x1da637['query']=_[_0x2cdc('0x4e')](_0x5e1251[_0x2cdc('0x3b')]);_0x1da637['filters']=_[_0x2cdc('0x3d')](_0x1da637['model'],_0x1da637[_0x2cdc('0x3b')]);_0x263751[_0x2cdc('0x3e')]=_[_0x2cdc('0x3d')](_0x1da637[_0x2cdc('0x3a')],qs[_0x2cdc('0x3f')](_0x5e1251['query']['fields']));_0x263751[_0x2cdc('0x3e')]=_0x263751[_0x2cdc('0x3e')]['length']?_0x263751[_0x2cdc('0x3e')]:_0x1da637[_0x2cdc('0x3a')];if(_0x5e1251[_0x2cdc('0x3b')][_0x2cdc('0x4a')]){_0x263751['include']=[{'all':!![]}];}_0x263751=_[_0x2cdc('0x47')]({},_0x263751,_0x5e1251[_0x2cdc('0x49')]);return db[_0x2cdc('0x36')][_0x2cdc('0x4f')](_0x263751)[_0x2cdc('0x1e')](handleEntityNotFound(_0x589b28,null))['then'](respondWithResult(_0x589b28,null))[_0x2cdc('0x27')](handleError(_0x589b28,null));};exports[_0x2cdc('0x50')]=function(_0x9e5bdd,_0x55c81e){return db['FreshdeskConfiguration'][_0x2cdc('0x50')](_0x9e5bdd[_0x2cdc('0x51')],{})[_0x2cdc('0x1e')](respondWithResult(_0x55c81e,0xc9))[_0x2cdc('0x27')](handleError(_0x55c81e,null));};exports['update']=function(_0x22d69f,_0xb6c715){if(_0x22d69f[_0x2cdc('0x51')]['id']){delete _0x22d69f[_0x2cdc('0x51')]['id'];}return db[_0x2cdc('0x36')]['find']({'where':{'id':_0x22d69f[_0x2cdc('0x52')]['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0xb6c715,null))[_0x2cdc('0x1e')](saveUpdates(_0x22d69f[_0x2cdc('0x51')],null))[_0x2cdc('0x1e')](respondWithResult(_0xb6c715,null))[_0x2cdc('0x27')](handleError(_0xb6c715,null));};exports[_0x2cdc('0x32')]=function(_0x3d7409,_0x333205){return db[_0x2cdc('0x36')][_0x2cdc('0x4f')]({'where':{'id':_0x3d7409[_0x2cdc('0x52')]['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0x333205,null))[_0x2cdc('0x1e')](removeEntity(_0x333205,null))[_0x2cdc('0x27')](handleError(_0x333205,null));};exports[_0x2cdc('0x53')]=function(_0x17e1bf,_0x18cb50,_0x45df67){var _0x64b3c7={};var _0x11fb41={};var _0x4ec767;var _0x30eae4;return db[_0x2cdc('0x36')][_0x2cdc('0x54')]({'where':{'id':_0x17e1bf['params']['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0x18cb50,null))[_0x2cdc('0x1e')](function(_0x4994c3){if(_0x4994c3){_0x4ec767=_0x4994c3;_0x11fb41['model']=_['keys'](db[_0x2cdc('0x55')][_0x2cdc('0x37')]);_0x11fb41[_0x2cdc('0x3b')]=_[_0x2cdc('0x4e')](_0x17e1bf[_0x2cdc('0x3b')]);_0x11fb41['filters']=_[_0x2cdc('0x3d')](_0x11fb41[_0x2cdc('0x3a')],_0x11fb41['query']);_0x64b3c7[_0x2cdc('0x3e')]=_['intersection'](_0x11fb41[_0x2cdc('0x3a')],qs[_0x2cdc('0x3f')](_0x17e1bf['query']['fields']));_0x64b3c7['attributes']=_0x64b3c7[_0x2cdc('0x3e')][_0x2cdc('0x40')]?_0x64b3c7[_0x2cdc('0x3e')]:_0x11fb41[_0x2cdc('0x3a')];_0x64b3c7[_0x2cdc('0x43')]=qs['sort'](_0x17e1bf[_0x2cdc('0x3b')][_0x2cdc('0x56')]);_0x64b3c7[_0x2cdc('0x44')]=qs['filters'](_[_0x2cdc('0x45')](_0x17e1bf['query'],_0x11fb41['filters']));if(_0x17e1bf['query']['filter']){_0x64b3c7[_0x2cdc('0x44')]=_['merge'](_0x64b3c7[_0x2cdc('0x44')],{'$or':_[_0x2cdc('0x35')](_0x64b3c7[_0x2cdc('0x3e')],function(_0x11aeb6){var _0x4848e3={};_0x4848e3[_0x11aeb6]={'$like':'%'+_0x17e1bf[_0x2cdc('0x3b')][_0x2cdc('0x46')]+'%'};return _0x4848e3;})});}_0x64b3c7=_[_0x2cdc('0x47')]({},_0x64b3c7,_0x17e1bf[_0x2cdc('0x49')]);return _0x4ec767[_0x2cdc('0x53')](_0x64b3c7);}})[_0x2cdc('0x1e')](function(_0x1a0765){if(_0x1a0765){_0x30eae4=_0x1a0765['length'];if(!_0x17e1bf[_0x2cdc('0x3b')]['hasOwnProperty']('nolimit')){_0x64b3c7['limit']=qs[_0x2cdc('0x2e')](_0x17e1bf['query'][_0x2cdc('0x2e')]);_0x64b3c7[_0x2cdc('0x2d')]=qs['offset'](_0x17e1bf[_0x2cdc('0x3b')][_0x2cdc('0x2d')]);}return _0x4ec767[_0x2cdc('0x53')](_0x64b3c7);}})['then'](function(_0x1145ae){if(_0x1145ae){return _0x1145ae?{'count':_0x30eae4,'rows':_0x1145ae}:null;}})[_0x2cdc('0x1e')](respondWithResult(_0x18cb50,null))[_0x2cdc('0x27')](handleError(_0x18cb50,null));};exports['getSubjects']=function(_0x2e0256,_0x24f3bb,_0x8344b7){var _0x3b18d9={};var _0x1191b8={};var _0x3610ef;var _0x2c84d4;return db[_0x2cdc('0x36')][_0x2cdc('0x54')]({'where':{'id':_0x2e0256[_0x2cdc('0x52')]['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0x24f3bb,null))[_0x2cdc('0x1e')](function(_0x9f24b4){if(_0x9f24b4){_0x3610ef=_0x9f24b4;_0x1191b8['model']=_[_0x2cdc('0x4e')](db[_0x2cdc('0x55')][_0x2cdc('0x37')]);_0x1191b8[_0x2cdc('0x3b')]=_['keys'](_0x2e0256[_0x2cdc('0x3b')]);_0x1191b8['filters']=_[_0x2cdc('0x3d')](_0x1191b8['model'],_0x1191b8[_0x2cdc('0x3b')]);_0x3b18d9[_0x2cdc('0x3e')]=_[_0x2cdc('0x3d')](_0x1191b8[_0x2cdc('0x3a')],qs[_0x2cdc('0x3f')](_0x2e0256['query'][_0x2cdc('0x3f')]));_0x3b18d9[_0x2cdc('0x3e')]=_0x3b18d9['attributes'][_0x2cdc('0x40')]?_0x3b18d9[_0x2cdc('0x3e')]:_0x1191b8['model'];_0x3b18d9[_0x2cdc('0x43')]=qs[_0x2cdc('0x56')](_0x2e0256[_0x2cdc('0x3b')][_0x2cdc('0x56')]);_0x3b18d9[_0x2cdc('0x44')]=qs[_0x2cdc('0x3c')](_[_0x2cdc('0x45')](_0x2e0256['query'],_0x1191b8[_0x2cdc('0x3c')]));if(_0x2e0256[_0x2cdc('0x3b')]['filter']){_0x3b18d9['where']=_[_0x2cdc('0x47')](_0x3b18d9[_0x2cdc('0x44')],{'$or':_['map'](_0x3b18d9[_0x2cdc('0x3e')],function(_0xa4fd8e){var _0x3e305c={};_0x3e305c[_0xa4fd8e]={'$like':'%'+_0x2e0256[_0x2cdc('0x3b')][_0x2cdc('0x46')]+'%'};return _0x3e305c;})});}_0x3b18d9=_['merge']({},_0x3b18d9,_0x2e0256[_0x2cdc('0x49')]);return _0x3610ef[_0x2cdc('0x57')](_0x3b18d9);}})[_0x2cdc('0x1e')](function(_0x5b2643){if(_0x5b2643){_0x2c84d4=_0x5b2643[_0x2cdc('0x40')];if(!_0x2e0256[_0x2cdc('0x3b')][_0x2cdc('0x41')](_0x2cdc('0x42'))){_0x3b18d9[_0x2cdc('0x2e')]=qs[_0x2cdc('0x2e')](_0x2e0256[_0x2cdc('0x3b')][_0x2cdc('0x2e')]);_0x3b18d9[_0x2cdc('0x2d')]=qs[_0x2cdc('0x2d')](_0x2e0256['query'][_0x2cdc('0x2d')]);}return _0x3610ef['getSubjects'](_0x3b18d9);}})[_0x2cdc('0x1e')](function(_0xa40597){if(_0xa40597){return _0xa40597?{'count':_0x2c84d4,'rows':_0xa40597}:null;}})[_0x2cdc('0x1e')](respondWithResult(_0x24f3bb,null))[_0x2cdc('0x27')](handleError(_0x24f3bb,null));};exports[_0x2cdc('0x58')]=function(_0x793a11,_0x4d04b7,_0x5df329){var _0x510af2={};var _0xcb27ba={};var _0x71bb0b;var _0x3ea3a2;return db[_0x2cdc('0x36')][_0x2cdc('0x54')]({'where':{'id':_0x793a11[_0x2cdc('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d04b7,null))[_0x2cdc('0x1e')](function(_0x40a9cf){if(_0x40a9cf){_0x71bb0b=_0x40a9cf;_0xcb27ba['model']=_[_0x2cdc('0x4e')](db[_0x2cdc('0x55')][_0x2cdc('0x37')]);_0xcb27ba['query']=_[_0x2cdc('0x4e')](_0x793a11['query']);_0xcb27ba[_0x2cdc('0x3c')]=_[_0x2cdc('0x3d')](_0xcb27ba[_0x2cdc('0x3a')],_0xcb27ba['query']);_0x510af2['attributes']=_['intersection'](_0xcb27ba['model'],qs[_0x2cdc('0x3f')](_0x793a11['query'][_0x2cdc('0x3f')]));_0x510af2[_0x2cdc('0x3e')]=_0x510af2[_0x2cdc('0x3e')][_0x2cdc('0x40')]?_0x510af2[_0x2cdc('0x3e')]:_0xcb27ba[_0x2cdc('0x3a')];_0x510af2[_0x2cdc('0x43')]=qs[_0x2cdc('0x56')](_0x793a11['query'][_0x2cdc('0x56')]);_0x510af2[_0x2cdc('0x44')]=qs[_0x2cdc('0x3c')](_['pick'](_0x793a11['query'],_0xcb27ba[_0x2cdc('0x3c')]));if(_0x793a11[_0x2cdc('0x3b')][_0x2cdc('0x46')]){_0x510af2['where']=_[_0x2cdc('0x47')](_0x510af2[_0x2cdc('0x44')],{'$or':_[_0x2cdc('0x35')](_0x510af2[_0x2cdc('0x3e')],function(_0x422663){var _0x166682={};_0x166682[_0x422663]={'$like':'%'+_0x793a11[_0x2cdc('0x3b')][_0x2cdc('0x46')]+'%'};return _0x166682;})});}_0x510af2=_[_0x2cdc('0x47')]({},_0x510af2,_0x793a11[_0x2cdc('0x49')]);return _0x71bb0b[_0x2cdc('0x58')](_0x510af2);}})[_0x2cdc('0x1e')](function(_0x2df172){if(_0x2df172){_0x3ea3a2=_0x2df172[_0x2cdc('0x40')];if(!_0x793a11[_0x2cdc('0x3b')][_0x2cdc('0x41')](_0x2cdc('0x42'))){_0x510af2[_0x2cdc('0x2e')]=qs[_0x2cdc('0x2e')](_0x793a11[_0x2cdc('0x3b')][_0x2cdc('0x2e')]);_0x510af2[_0x2cdc('0x2d')]=qs[_0x2cdc('0x2d')](_0x793a11[_0x2cdc('0x3b')][_0x2cdc('0x2d')]);}return _0x71bb0b[_0x2cdc('0x58')](_0x510af2);}})[_0x2cdc('0x1e')](function(_0x3da3c9){if(_0x3da3c9){return _0x3da3c9?{'count':_0x3ea3a2,'rows':_0x3da3c9}:null;}})[_0x2cdc('0x1e')](respondWithResult(_0x4d04b7,null))[_0x2cdc('0x27')](handleError(_0x4d04b7,null));};exports[_0x2cdc('0x59')]=function(_0x1a364f,_0x576edf,_0x7d1ffe){var _0x3efdb6={};var _0x5df200={};var _0x12ad6c;var _0x258185;return db[_0x2cdc('0x36')]['findOne']({'where':{'id':_0x1a364f[_0x2cdc('0x52')]['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0x576edf,null))[_0x2cdc('0x1e')](function(_0x3abe13){if(_0x3abe13){_0x12ad6c=_0x3abe13;_0x5df200[_0x2cdc('0x3a')]=_[_0x2cdc('0x4e')](db['Tag'][_0x2cdc('0x37')]);_0x5df200['query']=_[_0x2cdc('0x4e')](_0x1a364f['query']);_0x5df200[_0x2cdc('0x3c')]=_[_0x2cdc('0x3d')](_0x5df200['model'],_0x5df200['query']);_0x3efdb6[_0x2cdc('0x3e')]=_[_0x2cdc('0x3d')](_0x5df200[_0x2cdc('0x3a')],qs[_0x2cdc('0x3f')](_0x1a364f[_0x2cdc('0x3b')]['fields']));_0x3efdb6[_0x2cdc('0x3e')]=_0x3efdb6[_0x2cdc('0x3e')]['length']?_0x3efdb6[_0x2cdc('0x3e')]:_0x5df200[_0x2cdc('0x3a')];_0x3efdb6['order']=qs[_0x2cdc('0x56')](_0x1a364f['query']['sort']);_0x3efdb6[_0x2cdc('0x44')]=qs[_0x2cdc('0x3c')](_[_0x2cdc('0x45')](_0x1a364f[_0x2cdc('0x3b')],_0x5df200[_0x2cdc('0x3c')]));if(_0x1a364f['query']['filter']){_0x3efdb6['where']=_[_0x2cdc('0x47')](_0x3efdb6['where'],{'$or':_[_0x2cdc('0x35')](_0x3efdb6[_0x2cdc('0x3e')],function(_0x1ace42){var _0x26e652={};_0x26e652[_0x1ace42]={'$like':'%'+_0x1a364f[_0x2cdc('0x3b')][_0x2cdc('0x46')]+'%'};return _0x26e652;})});}_0x3efdb6=_[_0x2cdc('0x47')]({},_0x3efdb6,_0x1a364f[_0x2cdc('0x49')]);return _0x12ad6c[_0x2cdc('0x59')](_0x3efdb6);}})[_0x2cdc('0x1e')](function(_0x5b6f91){if(_0x5b6f91){_0x258185=_0x5b6f91[_0x2cdc('0x40')];if(!_0x1a364f[_0x2cdc('0x3b')][_0x2cdc('0x41')](_0x2cdc('0x42'))){_0x3efdb6['limit']=qs[_0x2cdc('0x2e')](_0x1a364f[_0x2cdc('0x3b')]['limit']);_0x3efdb6[_0x2cdc('0x2d')]=qs['offset'](_0x1a364f['query'][_0x2cdc('0x2d')]);}return _0x12ad6c['getTags'](_0x3efdb6);}})[_0x2cdc('0x1e')](function(_0x4a540d){if(_0x4a540d){return _0x4a540d?{'count':_0x258185,'rows':_0x4a540d}:null;}})[_0x2cdc('0x1e')](respondWithResult(_0x576edf,null))[_0x2cdc('0x27')](handleError(_0x576edf,null));};exports[_0x2cdc('0x5a')]=function(_0x4f51ff,_0x3eaf64,_0x396104){if(_0x4f51ff[_0x2cdc('0x51')]['id']){delete _0x4f51ff[_0x2cdc('0x51')]['id'];}return db['FreshdeskConfiguration'][_0x2cdc('0x54')]({'where':{'id':_0x4f51ff['params']['id']}})[_0x2cdc('0x1e')](handleEntityNotFound(_0x3eaf64,null))[_0x2cdc('0x1e')](function(_0x2551a2){if(_0x2551a2){return _0x2551a2[_0x2cdc('0x5a')](_0x4f51ff[_0x2cdc('0x51')][_0x2cdc('0x5b')]||[]);}return null;})[_0x2cdc('0x1e')](respondWithResult(_0x3eaf64,null))[_0x2cdc('0x27')](handleError(_0x3eaf64,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2f99f64..e04a6ff 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 _0x9957=['exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x47da66,_0x266c77){var _0x31c1d3=function(_0x1ff1e8){while(--_0x1ff1e8){_0x47da66['push'](_0x47da66['shift']());}};_0x31c1d3(++_0x266c77);}(_0x814b,0x1a2));var _0xb814=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x814b[_0x458363];return _0x4d0290;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 787d487..ef83c21 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 _0x0376=['lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0376,0xbd));var _0x6037=function(_0x14a38e,_0x4e6822){_0x14a38e=_0x14a38e-0x0;var _0x49a132=_0x0376[_0x14a38e];return _0x49a132;};'use strict';var _=require(_0x6037('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6037('0x1'));var rs=require(_0x6037('0x2'));var fs=require('fs');var Redis=require(_0x6037('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6037('0x4'));var config=require(_0x6037('0x5'));var jayson=require(_0x6037('0x6'));var client=jayson[_0x6037('0x7')][_0x6037('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19c678,_0x175c64,_0x15d2c3){return new BPromise(function(_0x196fc9,_0x1b0e89){return client[_0x6037('0x9')](_0x19c678,_0x15d2c3)[_0x6037('0xa')](function(_0x5c4ad0){logger[_0x6037('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x175c64,_0x6037('0xc'));logger['debug'](_0x6037('0xd'),_0x175c64,_0x6037('0xc'),JSON[_0x6037('0xe')](_0x5c4ad0));if(_0x5c4ad0[_0x6037('0xf')]){if(_0x5c4ad0[_0x6037('0xf')][_0x6037('0x10')]===0x1f4){logger[_0x6037('0xf')](_0x6037('0x11'),_0x175c64,_0x5c4ad0['error'][_0x6037('0x12')]);return _0x1b0e89(_0x5c4ad0[_0x6037('0xf')][_0x6037('0x12')]);}logger[_0x6037('0xf')](_0x6037('0x11'),_0x175c64,_0x5c4ad0[_0x6037('0xf')][_0x6037('0x12')]);return _0x196fc9(_0x5c4ad0[_0x6037('0xf')][_0x6037('0x12')]);}else{logger['info'](_0x6037('0x11'),_0x175c64,_0x6037('0xc'));_0x196fc9(_0x5c4ad0[_0x6037('0x13')][_0x6037('0x12')]);}})[_0x6037('0x14')](function(_0x3e4c4a){logger[_0x6037('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x175c64,_0x3e4c4a);_0x1b0e89(_0x3e4c4a);});});} \ No newline at end of file +var _0x1224=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x37da9b,_0x7428ae){var _0x4d6313=function(_0x5b6aa8){while(--_0x5b6aa8){_0x37da9b['push'](_0x37da9b['shift']());}};_0x4d6313(++_0x7428ae);}(_0x1224,0x195));var _0x4122=function(_0x52ce8e,_0x4dacf5){_0x52ce8e=_0x52ce8e-0x0;var _0x489cf9=_0x1224[_0x52ce8e];return _0x489cf9;};'use strict';var _=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var moment=require('moment');var BPromise=require(_0x4122('0x2'));var rs=require(_0x4122('0x3'));var fs=require('fs');var Redis=require(_0x4122('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4122('0x5'))(_0x4122('0x6'));var config=require(_0x4122('0x7'));var jayson=require(_0x4122('0x8'));var client=jayson[_0x4122('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x253fa5,_0x4f4c6c,_0x4ddf26){return new BPromise(function(_0x5b6984,_0x34615a){return client[_0x4122('0xa')](_0x253fa5,_0x4ddf26)[_0x4122('0xb')](function(_0xec062){logger[_0x4122('0xc')](_0x4122('0xd'),_0x4f4c6c,_0x4122('0xe'));logger[_0x4122('0xf')](_0x4122('0x10'),_0x4f4c6c,_0x4122('0xe'),JSON['stringify'](_0xec062));if(_0xec062[_0x4122('0x11')]){if(_0xec062[_0x4122('0x11')][_0x4122('0x12')]===0x1f4){logger['error'](_0x4122('0xd'),_0x4f4c6c,_0xec062[_0x4122('0x11')][_0x4122('0x13')]);return _0x34615a(_0xec062[_0x4122('0x11')][_0x4122('0x13')]);}logger[_0x4122('0x11')](_0x4122('0xd'),_0x4f4c6c,_0xec062['error'][_0x4122('0x13')]);return _0x5b6984(_0xec062[_0x4122('0x11')][_0x4122('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f4c6c,_0x4122('0xe'));_0x5b6984(_0xec062[_0x4122('0x14')][_0x4122('0x13')]);}})[_0x4122('0x15')](function(_0x2fd7d8){logger['error'](_0x4122('0xd'),_0x4f4c6c,_0x2fd7d8);_0x34615a(_0x2fd7d8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 21183c2..febc670 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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e0160,_0x115ca9){_0x3e0160=_0x3e0160-0x0;var _0x510a8d=_0xedd9[_0x3e0160];return _0x510a8d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xcb91[_0x4d180c];return _0x49b57e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5b6f1bd..9dca553 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 _0xd7ed=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x1d0fe6,_0x38ac70){var _0x4066a6=function(_0x250c69){while(--_0x250c69){_0x1d0fe6['push'](_0x1d0fe6['shift']());}};_0x4066a6(++_0x38ac70);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd7ed[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xdd7e('0x0')]={'type':{'type':Sequelize[_0xdd7e('0x1')](_0xdd7e('0x2'),_0xdd7e('0x3'),_0xdd7e('0x4'),_0xdd7e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdd7e('0x6')]},'key':{'type':Sequelize[_0xdd7e('0x6')]},'keyType':{'type':Sequelize[_0xdd7e('0x1')](_0xdd7e('0x2'),_0xdd7e('0x3'),_0xdd7e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdd7e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdd7e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd7e('0x6')]}}; \ No newline at end of file +var _0x2028=['keyValue','STRING','string','BOOLEAN','ENUM','variable','customVariable'];(function(_0x53f05d,_0x8b6dca){var _0x39715b=function(_0x5908ee){while(--_0x5908ee){_0x53f05d['push'](_0x53f05d['shift']());}};_0x39715b(++_0x8b6dca);}(_0x2028,0x1e0));var _0x8202=function(_0x26a346,_0x301c94){_0x26a346=_0x26a346-0x0;var _0x40d7f8=_0x2028[_0x26a346];return _0x40d7f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8202('0x0')]('string',_0x8202('0x1'),_0x8202('0x2'),_0x8202('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8202('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8202('0x0')](_0x8202('0x5'),_0x8202('0x1'),_0x8202('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8202('0x4')]},'customField':{'type':Sequelize[_0x8202('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8202('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 002a779..9049841 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 _0x9e9e=['show','params','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch'];(function(_0x4d1c92,_0x247c78){var _0x30085e=function(_0x62117){while(--_0x62117){_0x4d1c92['push'](_0x4d1c92['shift']());}};_0x30085e(++_0x247c78);}(_0x9e9e,0x8b));var _0xe9e9=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0x9e9e[_0x474c66];return _0xcbd9bf;};'use strict';var pdf=require(_0xe9e9('0x0'));var emlformat=require(_0xe9e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe9e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9e9('0x3'));var moment=require('moment');var BPromise=require(_0xe9e9('0x4'));var Mustache=require(_0xe9e9('0x5'));var util=require(_0xe9e9('0x6'));var path=require(_0xe9e9('0x7'));var sox=require(_0xe9e9('0x8'));var csv=require('to-csv');var ejs=require(_0xe9e9('0x9'));var fs=require('fs');var _=require(_0xe9e9('0xa'));var squel=require(_0xe9e9('0xb'));var crypto=require(_0xe9e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9e9('0xd'));var toCsv=require(_0xe9e9('0xe'));var querystring=require(_0xe9e9('0xf'));var Papa=require(_0xe9e9('0x10'));var Redis=require('ioredis');var authService=require(_0xe9e9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe9e9('0x12'));var hardwareService=require(_0xe9e9('0x13'));var logger=require(_0xe9e9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe9e9('0x15'))['db'];function respondWithStatusCode(_0x15b23f,_0x246b00){_0x246b00=_0x246b00||0xcc;return function(_0x2e25c8){if(_0x2e25c8){return _0x15b23f['sendStatus'](_0x246b00);}return _0x15b23f[_0xe9e9('0x16')](_0x246b00)['end']();};}function respondWithResult(_0x5d4589,_0x5327ff){_0x5327ff=_0x5327ff||0xc8;return function(_0x3e2894){if(_0x3e2894){return _0x5d4589[_0xe9e9('0x16')](_0x5327ff)[_0xe9e9('0x17')](_0x3e2894);}};}function respondWithFilteredResult(_0x33f1bc,_0x32c03d){return function(_0x3c56af){if(_0x3c56af){var _0x4470c3=_0x3c56af[_0xe9e9('0x18')],_0x40d580=_0x32c03d[_0xe9e9('0x19')],_0x559174=_0x32c03d[_0xe9e9('0x19')]+_0x32c03d[_0xe9e9('0x1a')],_0x293706;if(_0x559174>=_0x4470c3){_0x559174=_0x4470c3;_0x293706=0xc8;}else{_0x293706=0xce;}_0x33f1bc['status'](_0x293706);return _0x33f1bc[_0xe9e9('0x1b')]('Content-Range',_0x40d580+'-'+_0x559174+'/'+_0x4470c3)['json'](_0x3c56af);}return null;};}function patchUpdates(_0x4bd661){return function(_0x542f3a){try{jsonpatch[_0xe9e9('0x1c')](_0x542f3a,_0x4bd661,!![]);}catch(_0x562845){return BPromise['reject'](_0x562845);}return _0x542f3a[_0xe9e9('0x1d')]();};}function saveUpdates(_0x359886,_0x5a7feb){return function(_0x5278c0){if(_0x5278c0){return _0x5278c0[_0xe9e9('0x1e')](_0x359886)[_0xe9e9('0x1f')](function(_0x48d99b){return _0x48d99b;});}return null;};}function removeEntity(_0x54b4cd,_0x405aa5){return function(_0x2154aa){if(_0x2154aa){return _0x2154aa[_0xe9e9('0x20')]()[_0xe9e9('0x1f')](function(){_0x54b4cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x184dce,_0x4828c8){return function(_0x4d9283){if(!_0x4d9283){_0x184dce[_0xe9e9('0x21')](0x194);}return _0x4d9283;};}function handleError(_0x2be31f,_0x2953ab){_0x2953ab=_0x2953ab||0x1f4;return function(_0x3081ba){logger[_0xe9e9('0x22')](_0x3081ba['stack']);if(_0x3081ba[_0xe9e9('0x23')]){delete _0x3081ba[_0xe9e9('0x23')];}_0x2be31f[_0xe9e9('0x16')](_0x2953ab)['send'](_0x3081ba);};}exports[_0xe9e9('0x24')]=function(_0x571492,_0x2659eb){var _0x27166e={},_0x9321dc={},_0x27a7a8={'count':0x0,'rows':[]};var _0x4e24e9=_[_0xe9e9('0x25')](db[_0xe9e9('0x26')][_0xe9e9('0x27')],function(_0x59bae4){return{'name':_0x59bae4[_0xe9e9('0x28')],'type':_0x59bae4['type'][_0xe9e9('0x29')]};});_0x9321dc[_0xe9e9('0x2a')]=_[_0xe9e9('0x25')](_0x4e24e9,'name');_0x9321dc[_0xe9e9('0x2b')]=_[_0xe9e9('0x2c')](_0x571492[_0xe9e9('0x2b')]);_0x9321dc[_0xe9e9('0x2d')]=_[_0xe9e9('0x2e')](_0x9321dc[_0xe9e9('0x2a')],_0x9321dc[_0xe9e9('0x2b')]);_0x27166e['attributes']=_[_0xe9e9('0x2e')](_0x9321dc[_0xe9e9('0x2a')],qs[_0xe9e9('0x2f')](_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x2f')]));_0x27166e[_0xe9e9('0x30')]=_0x27166e[_0xe9e9('0x30')][_0xe9e9('0x31')]?_0x27166e[_0xe9e9('0x30')]:_0x9321dc[_0xe9e9('0x2a')];if(!_0x571492[_0xe9e9('0x2b')]['hasOwnProperty']('nolimit')){_0x27166e[_0xe9e9('0x1a')]=qs[_0xe9e9('0x1a')](_0x571492['query'][_0xe9e9('0x1a')]);_0x27166e[_0xe9e9('0x19')]=qs['offset'](_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x19')]);}_0x27166e['order']=qs['sort'](_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x32')]);_0x27166e[_0xe9e9('0x33')]=qs['filters'](_[_0xe9e9('0x34')](_0x571492['query'],_0x9321dc[_0xe9e9('0x2d')]),_0x4e24e9);if(_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x35')]){_0x27166e[_0xe9e9('0x33')]=_['merge'](_0x27166e[_0xe9e9('0x33')],{'$or':_['map'](_0x4e24e9,function(_0x4c6274){if(_0x4c6274[_0xe9e9('0x36')]!==_0xe9e9('0x37')){var _0x16176e={};_0x16176e[_0x4c6274['name']]={'$like':'%'+_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x35')]+'%'};return _0x16176e;}})});}_0x27166e=_[_0xe9e9('0x38')]({},_0x27166e,_0x571492[_0xe9e9('0x39')]);var _0x2decc5={'where':_0x27166e[_0xe9e9('0x33')]};return db[_0xe9e9('0x26')][_0xe9e9('0x18')](_0x2decc5)[_0xe9e9('0x1f')](function(_0x3f320a){_0x27a7a8['count']=_0x3f320a;if(_0x571492[_0xe9e9('0x2b')][_0xe9e9('0x3a')]){_0x27166e['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xe9e9('0x3b')](_0x27166e);})[_0xe9e9('0x1f')](function(_0x35a381){_0x27a7a8[_0xe9e9('0x3c')]=_0x35a381;return _0x27a7a8;})[_0xe9e9('0x1f')](respondWithFilteredResult(_0x2659eb,_0x27166e))[_0xe9e9('0x3d')](handleError(_0x2659eb,null));};exports[_0xe9e9('0x3e')]=function(_0x244efa,_0x4e997a){var _0x4ed89a={'raw':!![],'where':{'id':_0x244efa[_0xe9e9('0x3f')]['id']}},_0x2b3c3d={};_0x2b3c3d[_0xe9e9('0x2a')]=_[_0xe9e9('0x2c')](db[_0xe9e9('0x26')][_0xe9e9('0x27')]);_0x2b3c3d['query']=_[_0xe9e9('0x2c')](_0x244efa[_0xe9e9('0x2b')]);_0x2b3c3d['filters']=_[_0xe9e9('0x2e')](_0x2b3c3d[_0xe9e9('0x2a')],_0x2b3c3d[_0xe9e9('0x2b')]);_0x4ed89a[_0xe9e9('0x30')]=_[_0xe9e9('0x2e')](_0x2b3c3d[_0xe9e9('0x2a')],qs[_0xe9e9('0x2f')](_0x244efa[_0xe9e9('0x2b')][_0xe9e9('0x2f')]));_0x4ed89a[_0xe9e9('0x30')]=_0x4ed89a['attributes'][_0xe9e9('0x31')]?_0x4ed89a[_0xe9e9('0x30')]:_0x2b3c3d['model'];if(_0x244efa[_0xe9e9('0x2b')][_0xe9e9('0x3a')]){_0x4ed89a['include']=[{'all':!![]}];}_0x4ed89a=_['merge']({},_0x4ed89a,_0x244efa[_0xe9e9('0x39')]);return db['FreshdeskField'][_0xe9e9('0x40')](_0x4ed89a)['then'](handleEntityNotFound(_0x4e997a,null))[_0xe9e9('0x1f')](respondWithResult(_0x4e997a,null))[_0xe9e9('0x3d')](handleError(_0x4e997a,null));};exports[_0xe9e9('0x41')]=function(_0x39620a,_0x4b54e9){return db[_0xe9e9('0x26')]['create'](_0x39620a[_0xe9e9('0x42')],{})[_0xe9e9('0x1f')](respondWithResult(_0x4b54e9,0xc9))[_0xe9e9('0x3d')](handleError(_0x4b54e9,null));};exports[_0xe9e9('0x1e')]=function(_0x356360,_0x4293a4){if(_0x356360[_0xe9e9('0x42')]['id']){delete _0x356360['body']['id'];}return db[_0xe9e9('0x26')][_0xe9e9('0x40')]({'where':{'id':_0x356360[_0xe9e9('0x3f')]['id']}})[_0xe9e9('0x1f')](handleEntityNotFound(_0x4293a4,null))['then'](saveUpdates(_0x356360[_0xe9e9('0x42')],null))[_0xe9e9('0x1f')](respondWithResult(_0x4293a4,null))[_0xe9e9('0x3d')](handleError(_0x4293a4,null));};exports['destroy']=function(_0x379ef4,_0x1d0ffc){return db[_0xe9e9('0x26')][_0xe9e9('0x40')]({'where':{'id':_0x379ef4[_0xe9e9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d0ffc,null))['then'](removeEntity(_0x1d0ffc,null))['catch'](handleError(_0x1d0ffc,null));}; \ No newline at end of file +var _0x9fff=['map','FreshdeskField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index'];(function(_0xbe9547,_0x5c44c3){var _0x3b4060=function(_0x25ae1c){while(--_0x25ae1c){_0xbe9547['push'](_0xbe9547['shift']());}};_0x3b4060(++_0x5c44c3);}(_0x9fff,0x68));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf9ff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf9ff('0x1'));var zipdir=require(_0xf9ff('0x2'));var jsonpatch=require(_0xf9ff('0x3'));var rp=require(_0xf9ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf9ff('0x5'));var util=require(_0xf9ff('0x6'));var path=require(_0xf9ff('0x7'));var sox=require(_0xf9ff('0x8'));var csv=require(_0xf9ff('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf9ff('0xa'));var crypto=require(_0xf9ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf9ff('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf9ff('0xd'));var Papa=require('papaparse');var Redis=require(_0xf9ff('0xe'));var authService=require(_0xf9ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf9ff('0x10'));var hardwareService=require(_0xf9ff('0x11'));var logger=require(_0xf9ff('0x12'))(_0xf9ff('0x13'));var utils=require(_0xf9ff('0x14'));var config=require(_0xf9ff('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x170be7,_0x549cdc){_0x549cdc=_0x549cdc||0xcc;return function(_0x2ccc5d){if(_0x2ccc5d){return _0x170be7[_0xf9ff('0x16')](_0x549cdc);}return _0x170be7[_0xf9ff('0x17')](_0x549cdc)[_0xf9ff('0x18')]();};}function respondWithResult(_0xeed4d2,_0x2e8376){_0x2e8376=_0x2e8376||0xc8;return function(_0xbb0393){if(_0xbb0393){return _0xeed4d2[_0xf9ff('0x17')](_0x2e8376)['json'](_0xbb0393);}};}function respondWithFilteredResult(_0x36112a,_0x260140){return function(_0x1de2f2){if(_0x1de2f2){var _0x86bb96=_0x1de2f2[_0xf9ff('0x19')],_0x2bf679=_0x260140[_0xf9ff('0x1a')],_0x277071=_0x260140[_0xf9ff('0x1a')]+_0x260140['limit'],_0x3f7b32;if(_0x277071>=_0x86bb96){_0x277071=_0x86bb96;_0x3f7b32=0xc8;}else{_0x3f7b32=0xce;}_0x36112a[_0xf9ff('0x17')](_0x3f7b32);return _0x36112a[_0xf9ff('0x1b')](_0xf9ff('0x1c'),_0x2bf679+'-'+_0x277071+'/'+_0x86bb96)[_0xf9ff('0x1d')](_0x1de2f2);}return null;};}function patchUpdates(_0x4505bd){return function(_0x970784){try{jsonpatch[_0xf9ff('0x1e')](_0x970784,_0x4505bd,!![]);}catch(_0x1accce){return BPromise[_0xf9ff('0x1f')](_0x1accce);}return _0x970784[_0xf9ff('0x20')]();};}function saveUpdates(_0x41900f,_0x4d0ccf){return function(_0x4ca926){if(_0x4ca926){return _0x4ca926[_0xf9ff('0x21')](_0x41900f)[_0xf9ff('0x22')](function(_0x4605b6){return _0x4605b6;});}return null;};}function removeEntity(_0x596409,_0x5962cf){return function(_0x5cc6ab){if(_0x5cc6ab){return _0x5cc6ab[_0xf9ff('0x23')]()['then'](function(){_0x596409[_0xf9ff('0x17')](0xcc)[_0xf9ff('0x18')]();});}};}function handleEntityNotFound(_0x2f192d,_0x182b56){return function(_0x1747c3){if(!_0x1747c3){_0x2f192d['sendStatus'](0x194);}return _0x1747c3;};}function handleError(_0x51b276,_0xcfffa8){_0xcfffa8=_0xcfffa8||0x1f4;return function(_0x3f4691){logger[_0xf9ff('0x24')](_0x3f4691[_0xf9ff('0x25')]);if(_0x3f4691[_0xf9ff('0x26')]){delete _0x3f4691['name'];}_0x51b276[_0xf9ff('0x17')](_0xcfffa8)['send'](_0x3f4691);};}exports[_0xf9ff('0x27')]=function(_0x26035a,_0x14641a){var _0x2d63a9={},_0x3f6602={},_0xe67037={'count':0x0,'rows':[]};var _0x2325c8=_[_0xf9ff('0x28')](db[_0xf9ff('0x29')][_0xf9ff('0x2a')],function(_0x2bc9c7){return{'name':_0x2bc9c7[_0xf9ff('0x2b')],'type':_0x2bc9c7['type'][_0xf9ff('0x2c')]};});_0x3f6602['model']=_[_0xf9ff('0x28')](_0x2325c8,_0xf9ff('0x26'));_0x3f6602[_0xf9ff('0x2d')]=_[_0xf9ff('0x2e')](_0x26035a['query']);_0x3f6602[_0xf9ff('0x2f')]=_['intersection'](_0x3f6602[_0xf9ff('0x30')],_0x3f6602[_0xf9ff('0x2d')]);_0x2d63a9[_0xf9ff('0x31')]=_[_0xf9ff('0x32')](_0x3f6602['model'],qs[_0xf9ff('0x33')](_0x26035a['query'][_0xf9ff('0x33')]));_0x2d63a9[_0xf9ff('0x31')]=_0x2d63a9[_0xf9ff('0x31')][_0xf9ff('0x34')]?_0x2d63a9['attributes']:_0x3f6602[_0xf9ff('0x30')];if(!_0x26035a[_0xf9ff('0x2d')]['hasOwnProperty'](_0xf9ff('0x35'))){_0x2d63a9[_0xf9ff('0x36')]=qs[_0xf9ff('0x36')](_0x26035a[_0xf9ff('0x2d')][_0xf9ff('0x36')]);_0x2d63a9[_0xf9ff('0x1a')]=qs['offset'](_0x26035a[_0xf9ff('0x2d')]['offset']);}_0x2d63a9[_0xf9ff('0x37')]=qs['sort'](_0x26035a[_0xf9ff('0x2d')][_0xf9ff('0x38')]);_0x2d63a9[_0xf9ff('0x39')]=qs[_0xf9ff('0x2f')](_[_0xf9ff('0x3a')](_0x26035a[_0xf9ff('0x2d')],_0x3f6602[_0xf9ff('0x2f')]),_0x2325c8);if(_0x26035a[_0xf9ff('0x2d')]['filter']){_0x2d63a9[_0xf9ff('0x39')]=_[_0xf9ff('0x3b')](_0x2d63a9[_0xf9ff('0x39')],{'$or':_[_0xf9ff('0x28')](_0x2325c8,function(_0x56b37b){if(_0x56b37b['type']!=='VIRTUAL'){var _0x5d0017={};_0x5d0017[_0x56b37b['name']]={'$like':'%'+_0x26035a[_0xf9ff('0x2d')][_0xf9ff('0x3c')]+'%'};return _0x5d0017;}})});}_0x2d63a9=_[_0xf9ff('0x3b')]({},_0x2d63a9,_0x26035a[_0xf9ff('0x3d')]);var _0x2a34ca={'where':_0x2d63a9['where']};return db[_0xf9ff('0x29')]['count'](_0x2a34ca)[_0xf9ff('0x22')](function(_0x1b26a7){_0xe67037[_0xf9ff('0x19')]=_0x1b26a7;if(_0x26035a['query'][_0xf9ff('0x3e')]){_0x2d63a9[_0xf9ff('0x3f')]=[{'all':!![]}];}return db[_0xf9ff('0x29')][_0xf9ff('0x40')](_0x2d63a9);})[_0xf9ff('0x22')](function(_0x1c68b3){_0xe67037[_0xf9ff('0x41')]=_0x1c68b3;return _0xe67037;})[_0xf9ff('0x22')](respondWithFilteredResult(_0x14641a,_0x2d63a9))['catch'](handleError(_0x14641a,null));};exports[_0xf9ff('0x42')]=function(_0x1c49d0,_0x2fe789){var _0x309129={'raw':!![],'where':{'id':_0x1c49d0['params']['id']}},_0x43034f={};_0x43034f[_0xf9ff('0x30')]=_['keys'](db[_0xf9ff('0x29')]['rawAttributes']);_0x43034f['query']=_[_0xf9ff('0x2e')](_0x1c49d0[_0xf9ff('0x2d')]);_0x43034f['filters']=_['intersection'](_0x43034f[_0xf9ff('0x30')],_0x43034f[_0xf9ff('0x2d')]);_0x309129['attributes']=_[_0xf9ff('0x32')](_0x43034f['model'],qs[_0xf9ff('0x33')](_0x1c49d0[_0xf9ff('0x2d')]['fields']));_0x309129['attributes']=_0x309129[_0xf9ff('0x31')][_0xf9ff('0x34')]?_0x309129['attributes']:_0x43034f[_0xf9ff('0x30')];if(_0x1c49d0[_0xf9ff('0x2d')]['includeAll']){_0x309129['include']=[{'all':!![]}];}_0x309129=_[_0xf9ff('0x3b')]({},_0x309129,_0x1c49d0[_0xf9ff('0x3d')]);return db[_0xf9ff('0x29')][_0xf9ff('0x43')](_0x309129)[_0xf9ff('0x22')](handleEntityNotFound(_0x2fe789,null))['then'](respondWithResult(_0x2fe789,null))['catch'](handleError(_0x2fe789,null));};exports[_0xf9ff('0x44')]=function(_0x2190cb,_0x228805){return db[_0xf9ff('0x29')][_0xf9ff('0x44')](_0x2190cb[_0xf9ff('0x45')],{})[_0xf9ff('0x22')](respondWithResult(_0x228805,0xc9))[_0xf9ff('0x46')](handleError(_0x228805,null));};exports['update']=function(_0x233759,_0x54ff09){if(_0x233759[_0xf9ff('0x45')]['id']){delete _0x233759[_0xf9ff('0x45')]['id'];}return db[_0xf9ff('0x29')][_0xf9ff('0x43')]({'where':{'id':_0x233759[_0xf9ff('0x47')]['id']}})[_0xf9ff('0x22')](handleEntityNotFound(_0x54ff09,null))['then'](saveUpdates(_0x233759['body'],null))[_0xf9ff('0x22')](respondWithResult(_0x54ff09,null))['catch'](handleError(_0x54ff09,null));};exports[_0xf9ff('0x23')]=function(_0x23bde6,_0x565c40){return db[_0xf9ff('0x29')][_0xf9ff('0x43')]({'where':{'id':_0x23bde6[_0xf9ff('0x47')]['id']}})[_0xf9ff('0x22')](handleEntityNotFound(_0x565c40,null))[_0xf9ff('0x22')](removeEntity(_0x565c40,null))['catch'](handleError(_0x565c40,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6bdf77b..1d8f128 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 _0x2e5b=['rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x556918,_0x4882eb){var _0x1950fc=function(_0x192326){while(--_0x192326){_0x556918['push'](_0x556918['shift']());}};_0x1950fc(++_0x4882eb);}(_0x2e5b,0x93));var _0xb2e5=function(_0x2bab85,_0x3211a7){_0x2bab85=_0x2bab85-0x0;var _0x3d7d38=_0x2e5b[_0x2bab85];return _0x3d7d38;};'use strict';var _=require(_0xb2e5('0x0'));var util=require(_0xb2e5('0x1'));var logger=require(_0xb2e5('0x2'))(_0xb2e5('0x3'));var moment=require(_0xb2e5('0x4'));var BPromise=require(_0xb2e5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2e5('0x6'));var rimraf=require(_0xb2e5('0x7'));var config=require(_0xb2e5('0x8'));var attributes=require(_0xb2e5('0x9'));module['exports']=function(_0x5de1fa,_0x55c230){return _0x5de1fa[_0xb2e5('0xa')](_0xb2e5('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb2e5('0xc'),'fields':[_0xb2e5('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1933=['api','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','int_freshdesk_fields','idField','lodash','util','../../config/logger'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x1933,0xbd));var _0x3193=function(_0x44358a,_0x11a175){_0x44358a=_0x44358a-0x0;var _0x36fee1=_0x1933[_0x44358a];return _0x36fee1;};'use strict';var _=require(_0x3193('0x0'));var util=require(_0x3193('0x1'));var logger=require(_0x3193('0x2'))(_0x3193('0x3'));var moment=require(_0x3193('0x4'));var BPromise=require('bluebird');var rp=require(_0x3193('0x5'));var fs=require('fs');var path=require(_0x3193('0x6'));var rimraf=require('rimraf');var config=require(_0x3193('0x7'));var attributes=require(_0x3193('0x8'));module[_0x3193('0x9')]=function(_0x2c06b0,_0x155997){return _0x2c06b0['define']('FreshdeskField',attributes,{'tableName':_0x3193('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x3193('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 5c3fd02..96b545a 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x412529,_0x3997e2){var _0x1780bf=function(_0x376d02){while(--_0x376d02){_0x412529['push'](_0x412529['shift']());}};_0x1780bf(++_0x3997e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x13ed6f,_0x515c3c){_0x13ed6f=_0x13ed6f-0x0;var _0x3b42dd=_0xb10b[_0x13ed6f];return _0x3b42dd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xf7572a,_0x351da8){var _0x74f1ee=function(_0x395c0b){while(--_0x395c0b){_0xf7572a['push'](_0xf7572a['shift']());}};_0x74f1ee(++_0x351da8);}(_0xb10b,0x12a));var _0xbb10=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0xb10b[_0x592cbc];return _0x39b8d9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d621f6e..94c8ff1 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 _0xd314=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd314,0x180));var _0x4d31=function(_0x4d9c9e,_0x28cd51){_0x4d9c9e=_0x4d9c9e-0x0;var _0x1ac24b=_0xd314[_0x4d9c9e];return _0x1ac24b;};'use strict';var multer=require(_0x4d31('0x0'));var util=require('util');var path=require(_0x4d31('0x1'));var timeout=require(_0x4d31('0x2'));var express=require('express');var router=express[_0x4d31('0x3')]();var auth=require(_0x4d31('0x4'));var interaction=require(_0x4d31('0x5'));var config=require(_0x4d31('0x6'));var controller=require(_0x4d31('0x7'));router[_0x4d31('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d31('0x9')]);router[_0x4d31('0x8')](_0x4d31('0xa'),auth[_0x4d31('0xb')](),controller[_0x4d31('0xc')]);router['get'](_0x4d31('0xd'),auth[_0x4d31('0xb')](),controller[_0x4d31('0xe')]);router['get'](_0x4d31('0xf'),auth['isAuthenticated'](),controller[_0x4d31('0x10')]);router[_0x4d31('0x11')]('/',auth[_0x4d31('0xb')](),controller[_0x4d31('0x12')]);router[_0x4d31('0x11')](_0x4d31('0xd'),auth[_0x4d31('0xb')](),controller[_0x4d31('0x13')]);router[_0x4d31('0x14')](_0x4d31('0xa'),auth[_0x4d31('0xb')](),controller['update']);router[_0x4d31('0x15')](_0x4d31('0xa'),auth[_0x4d31('0xb')](),controller[_0x4d31('0x16')]);module['exports']=router; \ No newline at end of file +var _0x63fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x379d46,_0x590ea8){var _0x5f80c6=function(_0x4d3456){while(--_0x4d3456){_0x379d46['push'](_0x379d46['shift']());}};_0x5f80c6(++_0x590ea8);}(_0x63fe,0xda));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe63f('0x0'));var util=require(_0xe63f('0x1'));var path=require('path');var timeout=require(_0xe63f('0x2'));var express=require('express');var router=express[_0xe63f('0x3')]();var auth=require(_0xe63f('0x4'));var interaction=require(_0xe63f('0x5'));var config=require(_0xe63f('0x6'));var controller=require(_0xe63f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe63f('0x8')]);router[_0xe63f('0x9')](_0xe63f('0xa'),auth['isAuthenticated'](),controller[_0xe63f('0xb')]);router[_0xe63f('0x9')](_0xe63f('0xc'),auth[_0xe63f('0xd')](),controller[_0xe63f('0xe')]);router[_0xe63f('0x9')](_0xe63f('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe63f('0xd')](),controller[_0xe63f('0x10')]);router['post'](_0xe63f('0xc'),auth[_0xe63f('0xd')](),controller[_0xe63f('0x11')]);router[_0xe63f('0x12')]('/:id',auth[_0xe63f('0xd')](),controller[_0xe63f('0x13')]);router[_0xe63f('0x14')]('/:id',auth[_0xe63f('0xd')](),controller[_0xe63f('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 f46aa39..3091edb 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 _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x3e29b0,_0xc39593){var _0x2f7e8d=function(_0x576416){while(--_0x576416){_0x3e29b0['push'](_0x3e29b0['shift']());}};_0x2f7e8d(++_0xc39593);}(_0x02ce,0x1ac));var _0xe02c=function(_0x49a684,_0xbad4d5){_0x49a684=_0x49a684-0x0;var _0x9142f3=_0x02ce[_0x49a684];return _0x9142f3;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')]}}; \ No newline at end of file +var _0xd906=['username','remoteUri','STRING'];(function(_0x1cdcf4,_0x53cf30){var _0x33491e=function(_0xa6d512){while(--_0xa6d512){_0x1cdcf4['push'](_0x1cdcf4['shift']());}};_0x33491e(++_0x53cf30);}(_0xd906,0x6b));var _0x6d90=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0xd906[_0x4ba380];return _0x4b111b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d90('0x0')]},'description':{'type':Sequelize[_0x6d90('0x0')]},'username':{'type':Sequelize[_0x6d90('0x0')],'unique':_0x6d90('0x1')},'apiKey':{'type':Sequelize[_0x6d90('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x6d90('0x2')},'serverUrl':{'type':Sequelize[_0x6d90('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f90d8bc..47aac68 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 _0xa2b6=['request-promise','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','../../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','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FreshsalesAccount','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','keys','rawAttributes','include','create','body','params','find','order','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','username','remoteUri','slice','GET','format','%s%s','/api/selector/owners','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','fast-json-patch'];(function(_0x3fc87e,_0x418b29){var _0x17abcb=function(_0x4f8a6d){while(--_0x4f8a6d){_0x3fc87e['push'](_0x3fc87e['shift']());}};_0x17abcb(++_0x418b29);}(_0xa2b6,0x1c3));var _0x6a2b=function(_0x5bb1fc,_0x30a878){_0x5bb1fc=_0x5bb1fc-0x0;var _0x41b658=_0xa2b6[_0x5bb1fc];return _0x41b658;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6a2b('0x0'));var rp=require(_0x6a2b('0x1'));var moment=require(_0x6a2b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6a2b('0x3'));var util=require(_0x6a2b('0x4'));var path=require(_0x6a2b('0x5'));var sox=require(_0x6a2b('0x6'));var csv=require(_0x6a2b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a2b('0x8'));var squel=require(_0x6a2b('0x9'));var crypto=require('crypto');var jsforce=require(_0x6a2b('0xa'));var deskjs=require(_0x6a2b('0xb'));var toCsv=require(_0x6a2b('0x7'));var querystring=require(_0x6a2b('0xc'));var Papa=require(_0x6a2b('0xd'));var Redis=require(_0x6a2b('0xe'));var authService=require(_0x6a2b('0xf'));var qs=require(_0x6a2b('0x10'));var as=require(_0x6a2b('0x11'));var hardwareService=require(_0x6a2b('0x12'));var logger=require('../../config/logger')(_0x6a2b('0x13'));var utils=require(_0x6a2b('0x14'));var config=require(_0x6a2b('0x15'));var db=require(_0x6a2b('0x16'))['db'];var integrations=require(_0x6a2b('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x6a2b('0x18')][_0x6a2b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x159a84,_0x5bde86,_0x4c17f5){if(_0x4c17f5){var _0x35fea6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35fea6[_0x6a2b('0x1a')](_0x5bde86)){return _0x159a84;}else{throw new db['Sequelize'][(_0x6a2b('0x1b'))](_0x6a2b('0x1c'));}}else{return _0x159a84;}}function respondWithRpcPromise(_0x32a71d,_0xe366e3,_0x880416,_0x52008f){return new BPromise(function(_0xa530da,_0x4b18fe){var _0x205810=_0x52008f||client;return _0x205810[_0x6a2b('0x1d')](_0x32a71d,_0x880416)[_0x6a2b('0x1e')](function(_0xb8f9c1){logger[_0x6a2b('0x1f')](_0x6a2b('0x20'),_0xe366e3,_0x6a2b('0x21'));logger[_0x6a2b('0x22')](_0x6a2b('0x23'),_0xe366e3,'request\x20sent',JSON[_0x6a2b('0x24')](_0xb8f9c1));if(_0xb8f9c1[_0x6a2b('0x25')]){if(_0xb8f9c1[_0x6a2b('0x25')][_0x6a2b('0x26')]===0x1f4){logger[_0x6a2b('0x25')](_0x6a2b('0x20'),_0xe366e3,_0xb8f9c1[_0x6a2b('0x25')][_0x6a2b('0x27')]);return _0x4b18fe(_0xb8f9c1[_0x6a2b('0x25')][_0x6a2b('0x27')]);}logger[_0x6a2b('0x25')](_0x6a2b('0x20'),_0xe366e3,_0xb8f9c1['error'][_0x6a2b('0x27')]);return _0xa530da(_0xb8f9c1[_0x6a2b('0x25')][_0x6a2b('0x27')]);}else{logger[_0x6a2b('0x1f')](_0x6a2b('0x20'),_0xe366e3,'request\x20sent');_0xa530da(_0xb8f9c1[_0x6a2b('0x28')][_0x6a2b('0x27')]);}})[_0x6a2b('0x29')](function(_0x188ad1){logger[_0x6a2b('0x25')](_0x6a2b('0x20'),_0xe366e3,_0x188ad1);_0x4b18fe(_0x188ad1);});});}function respondWithStatusCode(_0x25f3a3,_0x438eb5){_0x438eb5=_0x438eb5||0xcc;return function(_0x10768d){if(_0x10768d){return _0x25f3a3[_0x6a2b('0x2a')](_0x438eb5);}return _0x25f3a3[_0x6a2b('0x2b')](_0x438eb5)['end']();};}function respondWithResult(_0x5ea183,_0x2e6f6e){_0x2e6f6e=_0x2e6f6e||0xc8;return function(_0x47440f){if(_0x47440f){return _0x5ea183[_0x6a2b('0x2b')](_0x2e6f6e)[_0x6a2b('0x2c')](_0x47440f);}};}function respondWithFilteredResult(_0x582c84,_0x41042a){return function(_0x11b9f5){if(_0x11b9f5){var _0x21a92d=_0x11b9f5['count'],_0xb68949=_0x41042a[_0x6a2b('0x2d')],_0x179257=_0x41042a[_0x6a2b('0x2d')]+_0x41042a[_0x6a2b('0x2e')],_0x5264a5;if(_0x179257>=_0x21a92d){_0x179257=_0x21a92d;_0x5264a5=0xc8;}else{_0x5264a5=0xce;}_0x582c84['status'](_0x5264a5);return _0x582c84[_0x6a2b('0x2f')](_0x6a2b('0x30'),_0xb68949+'-'+_0x179257+'/'+_0x21a92d)[_0x6a2b('0x2c')](_0x11b9f5);}return null;};}function patchUpdates(_0x3b5538){return function(_0x23d5b2){try{jsonpatch[_0x6a2b('0x31')](_0x23d5b2,_0x3b5538,!![]);}catch(_0x14e70c){return BPromise[_0x6a2b('0x32')](_0x14e70c);}return _0x23d5b2['save']();};}function saveUpdates(_0x6b3a29,_0x14891a){return function(_0x1973f1){if(_0x1973f1){return _0x1973f1[_0x6a2b('0x33')](_0x6b3a29)[_0x6a2b('0x1e')](function(_0xe2e2e4){return _0xe2e2e4;});}return null;};}function removeEntity(_0x4b97c8,_0x30d54e){return function(_0x552c20){if(_0x552c20){return _0x552c20[_0x6a2b('0x34')]()[_0x6a2b('0x1e')](function(){_0x4b97c8[_0x6a2b('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107405,_0x20c4e6){return function(_0x56058a){if(!_0x56058a){_0x107405[_0x6a2b('0x2a')](0x194);}return _0x56058a;};}function handleError(_0x37f055,_0xf4ba85){_0xf4ba85=_0xf4ba85||0x1f4;return function(_0x5ae4b6){logger['error'](_0x5ae4b6[_0x6a2b('0x35')]);if(_0x5ae4b6[_0x6a2b('0x36')]){delete _0x5ae4b6[_0x6a2b('0x36')];}_0x37f055['status'](_0xf4ba85)[_0x6a2b('0x37')](_0x5ae4b6);};}exports[_0x6a2b('0x38')]=function(_0x17a679,_0x3411ee){var _0x210c45={},_0x2b9ca1={},_0x185043={'count':0x0,'rows':[]};var _0x428130=_[_0x6a2b('0x39')](db[_0x6a2b('0x3a')]['rawAttributes'],function(_0xabe866){return{'name':_0xabe866['fieldName'],'type':_0xabe866[_0x6a2b('0x3b')][_0x6a2b('0x3c')]};});_0x2b9ca1[_0x6a2b('0x3d')]=_[_0x6a2b('0x39')](_0x428130,_0x6a2b('0x36'));_0x2b9ca1[_0x6a2b('0x3e')]=_['keys'](_0x17a679[_0x6a2b('0x3e')]);_0x2b9ca1[_0x6a2b('0x3f')]=_[_0x6a2b('0x40')](_0x2b9ca1[_0x6a2b('0x3d')],_0x2b9ca1[_0x6a2b('0x3e')]);_0x210c45[_0x6a2b('0x41')]=_[_0x6a2b('0x40')](_0x2b9ca1['model'],qs[_0x6a2b('0x42')](_0x17a679['query'][_0x6a2b('0x42')]));_0x210c45[_0x6a2b('0x41')]=_0x210c45[_0x6a2b('0x41')][_0x6a2b('0x43')]?_0x210c45['attributes']:_0x2b9ca1[_0x6a2b('0x3d')];if(!_0x17a679[_0x6a2b('0x3e')]['hasOwnProperty'](_0x6a2b('0x44'))){_0x210c45[_0x6a2b('0x2e')]=qs[_0x6a2b('0x2e')](_0x17a679[_0x6a2b('0x3e')][_0x6a2b('0x2e')]);_0x210c45[_0x6a2b('0x2d')]=qs[_0x6a2b('0x2d')](_0x17a679['query']['offset']);}_0x210c45['order']=qs[_0x6a2b('0x45')](_0x17a679[_0x6a2b('0x3e')][_0x6a2b('0x45')]);_0x210c45[_0x6a2b('0x46')]=qs[_0x6a2b('0x3f')](_[_0x6a2b('0x47')](_0x17a679[_0x6a2b('0x3e')],_0x2b9ca1[_0x6a2b('0x3f')]),_0x428130);if(_0x17a679['query'][_0x6a2b('0x48')]){_0x210c45['where']=_[_0x6a2b('0x49')](_0x210c45[_0x6a2b('0x46')],{'$or':_[_0x6a2b('0x39')](_0x428130,function(_0x3c6539){if(_0x3c6539[_0x6a2b('0x3b')]!==_0x6a2b('0x4a')){var _0x17772f={};_0x17772f[_0x3c6539[_0x6a2b('0x36')]]={'$like':'%'+_0x17a679[_0x6a2b('0x3e')][_0x6a2b('0x48')]+'%'};return _0x17772f;}})});}_0x210c45=_[_0x6a2b('0x49')]({},_0x210c45,_0x17a679[_0x6a2b('0x4b')]);var _0x379c91={'where':_0x210c45[_0x6a2b('0x46')]};return db[_0x6a2b('0x3a')][_0x6a2b('0x4c')](_0x379c91)[_0x6a2b('0x1e')](function(_0x55ed68){_0x185043['count']=_0x55ed68;if(_0x17a679[_0x6a2b('0x3e')][_0x6a2b('0x4d')]){_0x210c45['include']=[{'all':!![]}];}return db[_0x6a2b('0x3a')][_0x6a2b('0x4e')](_0x210c45);})[_0x6a2b('0x1e')](function(_0x3c4f94){_0x185043[_0x6a2b('0x4f')]=_0x3c4f94;return _0x185043;})[_0x6a2b('0x1e')](respondWithFilteredResult(_0x3411ee,_0x210c45))[_0x6a2b('0x29')](handleError(_0x3411ee,null));};exports[_0x6a2b('0x50')]=function(_0x55fe88,_0x285591){var _0x466850={'raw':![],'where':{'id':_0x55fe88['params']['id']}},_0xdfc863={};_0xdfc863['model']=_[_0x6a2b('0x51')](db[_0x6a2b('0x3a')][_0x6a2b('0x52')]);_0xdfc863['query']=_[_0x6a2b('0x51')](_0x55fe88[_0x6a2b('0x3e')]);_0xdfc863[_0x6a2b('0x3f')]=_[_0x6a2b('0x40')](_0xdfc863[_0x6a2b('0x3d')],_0xdfc863[_0x6a2b('0x3e')]);_0x466850['attributes']=_['intersection'](_0xdfc863[_0x6a2b('0x3d')],qs['fields'](_0x55fe88['query'][_0x6a2b('0x42')]));_0x466850[_0x6a2b('0x41')]=_0x466850['attributes'][_0x6a2b('0x43')]?_0x466850[_0x6a2b('0x41')]:_0xdfc863[_0x6a2b('0x3d')];if(_0x55fe88['query']['includeAll']){_0x466850[_0x6a2b('0x53')]=[{'all':!![]}];}_0x466850=_[_0x6a2b('0x49')]({},_0x466850,_0x55fe88[_0x6a2b('0x4b')]);return db[_0x6a2b('0x3a')]['find'](_0x466850)[_0x6a2b('0x1e')](handleEntityNotFound(_0x285591,null))[_0x6a2b('0x1e')](respondWithResult(_0x285591,null))[_0x6a2b('0x29')](handleError(_0x285591,null));};exports[_0x6a2b('0x54')]=function(_0x2a7981,_0x2f4f28){return db[_0x6a2b('0x3a')][_0x6a2b('0x54')](_0x2a7981[_0x6a2b('0x55')],{})[_0x6a2b('0x1e')](respondWithResult(_0x2f4f28,0xc9))[_0x6a2b('0x29')](handleError(_0x2f4f28,null));};exports['update']=function(_0x17ffa5,_0x56bf77){if(_0x17ffa5[_0x6a2b('0x55')]['id']){delete _0x17ffa5[_0x6a2b('0x55')]['id'];}return db[_0x6a2b('0x3a')]['find']({'where':{'id':_0x17ffa5[_0x6a2b('0x56')]['id']}})[_0x6a2b('0x1e')](handleEntityNotFound(_0x56bf77,null))[_0x6a2b('0x1e')](saveUpdates(_0x17ffa5[_0x6a2b('0x55')],null))['then'](respondWithResult(_0x56bf77,null))['catch'](handleError(_0x56bf77,null));};exports['destroy']=function(_0x2d587f,_0x565048){return db[_0x6a2b('0x3a')][_0x6a2b('0x57')]({'where':{'id':_0x2d587f[_0x6a2b('0x56')]['id']}})[_0x6a2b('0x1e')](handleEntityNotFound(_0x565048,null))[_0x6a2b('0x1e')](removeEntity(_0x565048,null))[_0x6a2b('0x29')](handleError(_0x565048,null));};exports['getConfigurations']=function(_0x799884,_0x440b91,_0x13c0b6){var _0xdb3d16={};var _0x33b9f8={};var _0x14056d;var _0x2f1303;return db[_0x6a2b('0x3a')]['findOne']({'where':{'id':_0x799884['params']['id']}})[_0x6a2b('0x1e')](handleEntityNotFound(_0x440b91,null))[_0x6a2b('0x1e')](function(_0x58d9e6){if(_0x58d9e6){_0x14056d=_0x58d9e6;_0x33b9f8[_0x6a2b('0x3d')]=_[_0x6a2b('0x51')](db['FreshsalesConfiguration'][_0x6a2b('0x52')]);_0x33b9f8['query']=_[_0x6a2b('0x51')](_0x799884['query']);_0x33b9f8['filters']=_['intersection'](_0x33b9f8[_0x6a2b('0x3d')],_0x33b9f8[_0x6a2b('0x3e')]);_0xdb3d16[_0x6a2b('0x41')]=_['intersection'](_0x33b9f8['model'],qs[_0x6a2b('0x42')](_0x799884['query'][_0x6a2b('0x42')]));_0xdb3d16['attributes']=_0xdb3d16[_0x6a2b('0x41')][_0x6a2b('0x43')]?_0xdb3d16[_0x6a2b('0x41')]:_0x33b9f8[_0x6a2b('0x3d')];_0xdb3d16[_0x6a2b('0x58')]=qs[_0x6a2b('0x45')](_0x799884['query'][_0x6a2b('0x45')]);_0xdb3d16[_0x6a2b('0x46')]=qs['filters'](_[_0x6a2b('0x47')](_0x799884[_0x6a2b('0x3e')],_0x33b9f8[_0x6a2b('0x3f')]));if(_0x799884[_0x6a2b('0x3e')]['filter']){_0xdb3d16[_0x6a2b('0x46')]=_[_0x6a2b('0x49')](_0xdb3d16['where'],{'$or':_[_0x6a2b('0x39')](_0xdb3d16[_0x6a2b('0x41')],function(_0xe473db){var _0x1f1f72={};_0x1f1f72[_0xe473db]={'$like':'%'+_0x799884[_0x6a2b('0x3e')][_0x6a2b('0x48')]+'%'};return _0x1f1f72;})});}_0xdb3d16=_[_0x6a2b('0x49')]({},_0xdb3d16,_0x799884[_0x6a2b('0x4b')]);return _0x14056d[_0x6a2b('0x59')](_0xdb3d16);}})[_0x6a2b('0x1e')](function(_0x4470e4){if(_0x4470e4){_0x2f1303=_0x4470e4[_0x6a2b('0x43')];if(!_0x799884[_0x6a2b('0x3e')][_0x6a2b('0x5a')](_0x6a2b('0x44'))){_0xdb3d16[_0x6a2b('0x2e')]=qs['limit'](_0x799884[_0x6a2b('0x3e')][_0x6a2b('0x2e')]);_0xdb3d16[_0x6a2b('0x2d')]=qs['offset'](_0x799884['query'][_0x6a2b('0x2d')]);}return _0x14056d[_0x6a2b('0x59')](_0xdb3d16);}})[_0x6a2b('0x1e')](function(_0x434a39){if(_0x434a39){return _0x434a39?{'count':_0x2f1303,'rows':_0x434a39}:null;}})['then'](respondWithResult(_0x440b91,null))[_0x6a2b('0x29')](handleError(_0x440b91,null));};exports[_0x6a2b('0x5b')]=function(_0x1dbb96,_0x55a224,_0x3cccd3){if(_0x1dbb96[_0x6a2b('0x55')]['id']){delete _0x1dbb96[_0x6a2b('0x55')]['id'];}return db[_0x6a2b('0x3a')][_0x6a2b('0x5c')]({'where':{'id':_0x1dbb96[_0x6a2b('0x56')]['id']}})[_0x6a2b('0x1e')](handleEntityNotFound(_0x55a224,null))['then'](function(_0x25d734){if(_0x25d734){_0x1dbb96[_0x6a2b('0x55')][_0x6a2b('0x5d')]=_0x25d734['id'];_0x1dbb96[_0x6a2b('0x55')][_0x6a2b('0x5e')]=integrations[_0x6a2b('0x5f')](_0x1dbb96[_0x6a2b('0x55')]['channel'],_0x1dbb96[_0x6a2b('0x55')][_0x6a2b('0x3b')]);_0x1dbb96['body'][_0x6a2b('0x60')]=integrations[_0x6a2b('0x61')](_0x1dbb96[_0x6a2b('0x55')]['channel'],_0x1dbb96[_0x6a2b('0x55')][_0x6a2b('0x3b')]);return db[_0x6a2b('0x62')]['create'](_0x1dbb96[_0x6a2b('0x55')],{'include':[{'model':db[_0x6a2b('0x63')],'as':'Subjects'},{'model':db[_0x6a2b('0x63')],'as':_0x6a2b('0x60')}]});}return null;})['then'](respondWithResult(_0x55a224,null))[_0x6a2b('0x29')](handleError(_0x55a224,null));};exports['getFields']=function(_0x3e5fa9,_0x515b25,_0x46ec61){var _0x1c9e8f='';var _0x401346='';return db[_0x6a2b('0x3a')][_0x6a2b('0x5c')]({'where':{'id':_0x3e5fa9['params']['id']},'attributes':['id',_0x6a2b('0x64'),_0x6a2b('0x65'),'apiKey']})['then'](handleEntityNotFound(_0x515b25,null))[_0x6a2b('0x1e')](function(_0x784757){if(_0x784757){_0x401346=_0x784757[_0x6a2b('0x64')];_0x1c9e8f=_0x784757[_0x6a2b('0x65')];var _0xff1a7b=_0x784757[_0x6a2b('0x65')][_0x6a2b('0x66')](-0x1);if(_0xff1a7b==='/'){_0x1c9e8f=_0x1c9e8f['substring'](0x0,_0x1c9e8f['lastIndexOf'](_0xff1a7b));}return rp({'method':_0x6a2b('0x67'),'uri':util[_0x6a2b('0x68')](_0x6a2b('0x69'),_0x1c9e8f,_0x6a2b('0x6a')),'headers':{'Authorization':'Token\x20token='+_0x784757[_0x6a2b('0x6b')]},'json':!![]});}})['then'](function(_0x54e286){if(_0x54e286){var _0x4fe4c1=_0x54e286[_0x6a2b('0x6c')];var _0x526bc8=![];var _0x39920a=null;for(_0x39920a=0x0;_0x39920a<_0x4fe4c1['length'];_0x39920a++){if(_0x4fe4c1[_0x39920a][_0x6a2b('0x6d')]===_0x401346){_0x526bc8=!![];}}if(_0x526bc8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x6a2b('0x1e')](respondWithResult(_0x515b25,null))['catch'](function(_0x4de473){var _0x1cb8c3=_0x3e5fa9[_0x6a2b('0x3e')][_0x6a2b('0x1a')]?0x1f4:_0x4de473[_0x6a2b('0x6e')]||0x1f4;logger[_0x6a2b('0x25')](_0x6a2b('0x6f'),_0x6a2b('0x70'),_0x1cb8c3,JSON[_0x6a2b('0x24')](_0x4de473));delete _0x4de473[_0x6a2b('0x36')];if(_0x1cb8c3===0x191){_0x1cb8c3=0x190;}_0x515b25[_0x6a2b('0x2b')](_0x1cb8c3)[_0x6a2b('0x37')](_0x3e5fa9[_0x6a2b('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4de473[_0x6a2b('0x6e')]}:_0x4de473);});}; \ No newline at end of file +var _0x698e=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','create','body','find','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','Subjects','channel','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','statusCode','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x400bd2,_0x4359c7){var _0x4d067b=function(_0x2a3d4d){while(--_0x2a3d4d){_0x400bd2['push'](_0x400bd2['shift']());}};_0x4d067b(++_0x4359c7);}(_0x698e,0x172));var _0xe698=function(_0x365700,_0x12bbb3){_0x365700=_0x365700-0x0;var _0x2eb5f0=_0x698e[_0x365700];return _0x2eb5f0;};'use strict';var pdf=require(_0xe698('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe698('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe698('0x2'));var rp=require(_0xe698('0x3'));var moment=require(_0xe698('0x4'));var BPromise=require(_0xe698('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe698('0x6'));var sox=require(_0xe698('0x7'));var csv=require('to-csv');var ejs=require(_0xe698('0x8'));var fs=require('fs');var _=require(_0xe698('0x9'));var squel=require(_0xe698('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe698('0xb'));var toCsv=require(_0xe698('0xc'));var querystring=require(_0xe698('0xd'));var Papa=require(_0xe698('0xe'));var Redis=require(_0xe698('0xf'));var authService=require(_0xe698('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe698('0x11'));var logger=require(_0xe698('0x12'))(_0xe698('0x13'));var utils=require('../../config/utils');var config=require(_0xe698('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe698('0x15'));var jayson=require(_0xe698('0x16'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x51b0f4,_0x5c001e,_0x2e17c3){if(_0x2e17c3){var _0x31384e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31384e[_0xe698('0x17')](_0x5c001e)){return _0x51b0f4;}else{throw new db['Sequelize'][(_0xe698('0x18'))](_0xe698('0x19'));}}else{return _0x51b0f4;}}function respondWithRpcPromise(_0x450b05,_0x5bf23b,_0x4fb93d,_0x422ed3){return new BPromise(function(_0x1ba98e,_0x4385be){var _0x547a12=_0x422ed3||client;return _0x547a12[_0xe698('0x1a')](_0x450b05,_0x4fb93d)[_0xe698('0x1b')](function(_0x59537f){logger[_0xe698('0x1c')](_0xe698('0x1d'),_0x5bf23b,'request\x20sent');logger[_0xe698('0x1e')](_0xe698('0x1f'),_0x5bf23b,_0xe698('0x20'),JSON[_0xe698('0x21')](_0x59537f));if(_0x59537f['error']){if(_0x59537f[_0xe698('0x22')][_0xe698('0x23')]===0x1f4){logger[_0xe698('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x5bf23b,_0x59537f[_0xe698('0x22')][_0xe698('0x24')]);return _0x4385be(_0x59537f[_0xe698('0x22')][_0xe698('0x24')]);}logger[_0xe698('0x22')](_0xe698('0x1d'),_0x5bf23b,_0x59537f['error'][_0xe698('0x24')]);return _0x1ba98e(_0x59537f['error'][_0xe698('0x24')]);}else{logger[_0xe698('0x1c')](_0xe698('0x1d'),_0x5bf23b,_0xe698('0x20'));_0x1ba98e(_0x59537f[_0xe698('0x25')]['message']);}})[_0xe698('0x26')](function(_0x55fcf6){logger[_0xe698('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x5bf23b,_0x55fcf6);_0x4385be(_0x55fcf6);});});}function respondWithStatusCode(_0x361350,_0x55ef6b){_0x55ef6b=_0x55ef6b||0xcc;return function(_0x47e91b){if(_0x47e91b){return _0x361350[_0xe698('0x27')](_0x55ef6b);}return _0x361350[_0xe698('0x28')](_0x55ef6b)[_0xe698('0x29')]();};}function respondWithResult(_0x191795,_0x36f96f){_0x36f96f=_0x36f96f||0xc8;return function(_0x1ca10e){if(_0x1ca10e){return _0x191795[_0xe698('0x28')](_0x36f96f)['json'](_0x1ca10e);}};}function respondWithFilteredResult(_0x31d7f1,_0x1bf633){return function(_0x59eaaf){if(_0x59eaaf){var _0x36b5d4=_0x59eaaf[_0xe698('0x2a')],_0x519159=_0x1bf633[_0xe698('0x2b')],_0x5e89ae=_0x1bf633[_0xe698('0x2b')]+_0x1bf633['limit'],_0x578bba;if(_0x5e89ae>=_0x36b5d4){_0x5e89ae=_0x36b5d4;_0x578bba=0xc8;}else{_0x578bba=0xce;}_0x31d7f1['status'](_0x578bba);return _0x31d7f1[_0xe698('0x2c')](_0xe698('0x2d'),_0x519159+'-'+_0x5e89ae+'/'+_0x36b5d4)[_0xe698('0x2e')](_0x59eaaf);}return null;};}function patchUpdates(_0x474ca1){return function(_0x5ab881){try{jsonpatch[_0xe698('0x2f')](_0x5ab881,_0x474ca1,!![]);}catch(_0x1b8087){return BPromise[_0xe698('0x30')](_0x1b8087);}return _0x5ab881['save']();};}function saveUpdates(_0x50260b,_0x27ab0f){return function(_0xb575ae){if(_0xb575ae){return _0xb575ae['update'](_0x50260b)[_0xe698('0x1b')](function(_0x4a5004){return _0x4a5004;});}return null;};}function removeEntity(_0x35e365,_0x5b571d){return function(_0x4d09ca){if(_0x4d09ca){return _0x4d09ca['destroy']()[_0xe698('0x1b')](function(){_0x35e365['status'](0xcc)[_0xe698('0x29')]();});}};}function handleEntityNotFound(_0x10771b,_0x17198b){return function(_0x2a50f2){if(!_0x2a50f2){_0x10771b[_0xe698('0x27')](0x194);}return _0x2a50f2;};}function handleError(_0x2166b2,_0x42ba35){_0x42ba35=_0x42ba35||0x1f4;return function(_0x565322){logger[_0xe698('0x22')](_0x565322[_0xe698('0x31')]);if(_0x565322[_0xe698('0x32')]){delete _0x565322[_0xe698('0x32')];}_0x2166b2[_0xe698('0x28')](_0x42ba35)[_0xe698('0x33')](_0x565322);};}exports['index']=function(_0x7d5e22,_0x49253f){var _0x3a86b6={},_0x230c68={},_0x144cdf={'count':0x0,'rows':[]};var _0x509b49=_['map'](db[_0xe698('0x34')][_0xe698('0x35')],function(_0x4d471e){return{'name':_0x4d471e[_0xe698('0x36')],'type':_0x4d471e[_0xe698('0x37')][_0xe698('0x38')]};});_0x230c68[_0xe698('0x39')]=_[_0xe698('0x3a')](_0x509b49,_0xe698('0x32'));_0x230c68['query']=_['keys'](_0x7d5e22[_0xe698('0x3b')]);_0x230c68[_0xe698('0x3c')]=_[_0xe698('0x3d')](_0x230c68[_0xe698('0x39')],_0x230c68[_0xe698('0x3b')]);_0x3a86b6[_0xe698('0x3e')]=_[_0xe698('0x3d')](_0x230c68[_0xe698('0x39')],qs[_0xe698('0x3f')](_0x7d5e22[_0xe698('0x3b')]['fields']));_0x3a86b6['attributes']=_0x3a86b6['attributes'][_0xe698('0x40')]?_0x3a86b6['attributes']:_0x230c68[_0xe698('0x39')];if(!_0x7d5e22['query'][_0xe698('0x41')](_0xe698('0x42'))){_0x3a86b6[_0xe698('0x43')]=qs['limit'](_0x7d5e22['query'][_0xe698('0x43')]);_0x3a86b6['offset']=qs[_0xe698('0x2b')](_0x7d5e22[_0xe698('0x3b')][_0xe698('0x2b')]);}_0x3a86b6[_0xe698('0x44')]=qs[_0xe698('0x45')](_0x7d5e22[_0xe698('0x3b')][_0xe698('0x45')]);_0x3a86b6[_0xe698('0x46')]=qs[_0xe698('0x3c')](_['pick'](_0x7d5e22[_0xe698('0x3b')],_0x230c68[_0xe698('0x3c')]),_0x509b49);if(_0x7d5e22[_0xe698('0x3b')][_0xe698('0x47')]){_0x3a86b6[_0xe698('0x46')]=_[_0xe698('0x48')](_0x3a86b6[_0xe698('0x46')],{'$or':_[_0xe698('0x3a')](_0x509b49,function(_0x132cdc){if(_0x132cdc[_0xe698('0x37')]!==_0xe698('0x49')){var _0x25bce1={};_0x25bce1[_0x132cdc[_0xe698('0x32')]]={'$like':'%'+_0x7d5e22[_0xe698('0x3b')][_0xe698('0x47')]+'%'};return _0x25bce1;}})});}_0x3a86b6=_[_0xe698('0x48')]({},_0x3a86b6,_0x7d5e22[_0xe698('0x4a')]);var _0xcfb19d={'where':_0x3a86b6[_0xe698('0x46')]};return db['FreshsalesAccount'][_0xe698('0x2a')](_0xcfb19d)['then'](function(_0x5707b4){_0x144cdf[_0xe698('0x2a')]=_0x5707b4;if(_0x7d5e22[_0xe698('0x3b')][_0xe698('0x4b')]){_0x3a86b6[_0xe698('0x4c')]=[{'all':!![]}];}return db[_0xe698('0x34')]['findAll'](_0x3a86b6);})[_0xe698('0x1b')](function(_0x39591d){_0x144cdf[_0xe698('0x4d')]=_0x39591d;return _0x144cdf;})[_0xe698('0x1b')](respondWithFilteredResult(_0x49253f,_0x3a86b6))[_0xe698('0x26')](handleError(_0x49253f,null));};exports[_0xe698('0x4e')]=function(_0x94bc8d,_0x2155ef){var _0x1a5f89={'raw':![],'where':{'id':_0x94bc8d['params']['id']}},_0x5c7109={};_0x5c7109[_0xe698('0x39')]=_[_0xe698('0x4f')](db['FreshsalesAccount'][_0xe698('0x35')]);_0x5c7109[_0xe698('0x3b')]=_['keys'](_0x94bc8d[_0xe698('0x3b')]);_0x5c7109[_0xe698('0x3c')]=_['intersection'](_0x5c7109[_0xe698('0x39')],_0x5c7109['query']);_0x1a5f89[_0xe698('0x3e')]=_[_0xe698('0x3d')](_0x5c7109[_0xe698('0x39')],qs['fields'](_0x94bc8d[_0xe698('0x3b')][_0xe698('0x3f')]));_0x1a5f89[_0xe698('0x3e')]=_0x1a5f89[_0xe698('0x3e')][_0xe698('0x40')]?_0x1a5f89[_0xe698('0x3e')]:_0x5c7109[_0xe698('0x39')];if(_0x94bc8d[_0xe698('0x3b')][_0xe698('0x4b')]){_0x1a5f89[_0xe698('0x4c')]=[{'all':!![]}];}_0x1a5f89=_[_0xe698('0x48')]({},_0x1a5f89,_0x94bc8d[_0xe698('0x4a')]);return db[_0xe698('0x34')]['find'](_0x1a5f89)[_0xe698('0x1b')](handleEntityNotFound(_0x2155ef,null))[_0xe698('0x1b')](respondWithResult(_0x2155ef,null))[_0xe698('0x26')](handleError(_0x2155ef,null));};exports[_0xe698('0x50')]=function(_0x31b9f0,_0x433cf7){return db[_0xe698('0x34')][_0xe698('0x50')](_0x31b9f0[_0xe698('0x51')],{})[_0xe698('0x1b')](respondWithResult(_0x433cf7,0xc9))[_0xe698('0x26')](handleError(_0x433cf7,null));};exports['update']=function(_0x29391f,_0x3acfe2){if(_0x29391f[_0xe698('0x51')]['id']){delete _0x29391f[_0xe698('0x51')]['id'];}return db[_0xe698('0x34')][_0xe698('0x52')]({'where':{'id':_0x29391f[_0xe698('0x53')]['id']}})['then'](handleEntityNotFound(_0x3acfe2,null))[_0xe698('0x1b')](saveUpdates(_0x29391f[_0xe698('0x51')],null))[_0xe698('0x1b')](respondWithResult(_0x3acfe2,null))[_0xe698('0x26')](handleError(_0x3acfe2,null));};exports['destroy']=function(_0x5d8718,_0x1339ad){return db[_0xe698('0x34')]['find']({'where':{'id':_0x5d8718[_0xe698('0x53')]['id']}})[_0xe698('0x1b')](handleEntityNotFound(_0x1339ad,null))[_0xe698('0x1b')](removeEntity(_0x1339ad,null))[_0xe698('0x26')](handleError(_0x1339ad,null));};exports[_0xe698('0x54')]=function(_0x4f975e,_0x2674c9,_0x2a0158){var _0x31184f={};var _0x58ff1d={};var _0x411e5c;var _0x17c068;return db[_0xe698('0x34')][_0xe698('0x55')]({'where':{'id':_0x4f975e[_0xe698('0x53')]['id']}})[_0xe698('0x1b')](handleEntityNotFound(_0x2674c9,null))[_0xe698('0x1b')](function(_0x2a0017){if(_0x2a0017){_0x411e5c=_0x2a0017;_0x58ff1d[_0xe698('0x39')]=_[_0xe698('0x4f')](db[_0xe698('0x56')][_0xe698('0x35')]);_0x58ff1d[_0xe698('0x3b')]=_['keys'](_0x4f975e['query']);_0x58ff1d[_0xe698('0x3c')]=_['intersection'](_0x58ff1d[_0xe698('0x39')],_0x58ff1d[_0xe698('0x3b')]);_0x31184f['attributes']=_[_0xe698('0x3d')](_0x58ff1d[_0xe698('0x39')],qs[_0xe698('0x3f')](_0x4f975e[_0xe698('0x3b')]['fields']));_0x31184f[_0xe698('0x3e')]=_0x31184f[_0xe698('0x3e')]['length']?_0x31184f[_0xe698('0x3e')]:_0x58ff1d[_0xe698('0x39')];_0x31184f[_0xe698('0x44')]=qs[_0xe698('0x45')](_0x4f975e[_0xe698('0x3b')]['sort']);_0x31184f[_0xe698('0x46')]=qs[_0xe698('0x3c')](_[_0xe698('0x57')](_0x4f975e[_0xe698('0x3b')],_0x58ff1d[_0xe698('0x3c')]));if(_0x4f975e[_0xe698('0x3b')][_0xe698('0x47')]){_0x31184f[_0xe698('0x46')]=_[_0xe698('0x48')](_0x31184f['where'],{'$or':_[_0xe698('0x3a')](_0x31184f[_0xe698('0x3e')],function(_0x40b2f5){var _0x68791d={};_0x68791d[_0x40b2f5]={'$like':'%'+_0x4f975e[_0xe698('0x3b')]['filter']+'%'};return _0x68791d;})});}_0x31184f=_['merge']({},_0x31184f,_0x4f975e[_0xe698('0x4a')]);return _0x411e5c[_0xe698('0x54')](_0x31184f);}})[_0xe698('0x1b')](function(_0x4c4736){if(_0x4c4736){_0x17c068=_0x4c4736[_0xe698('0x40')];if(!_0x4f975e[_0xe698('0x3b')][_0xe698('0x41')]('nolimit')){_0x31184f[_0xe698('0x43')]=qs['limit'](_0x4f975e[_0xe698('0x3b')][_0xe698('0x43')]);_0x31184f['offset']=qs[_0xe698('0x2b')](_0x4f975e['query'][_0xe698('0x2b')]);}return _0x411e5c['getConfigurations'](_0x31184f);}})[_0xe698('0x1b')](function(_0x10ac5a){if(_0x10ac5a){return _0x10ac5a?{'count':_0x17c068,'rows':_0x10ac5a}:null;}})[_0xe698('0x1b')](respondWithResult(_0x2674c9,null))['catch'](handleError(_0x2674c9,null));};exports[_0xe698('0x58')]=function(_0x2731a1,_0x4750c9,_0x148ea0){if(_0x2731a1[_0xe698('0x51')]['id']){delete _0x2731a1[_0xe698('0x51')]['id'];}return db['FreshsalesAccount'][_0xe698('0x55')]({'where':{'id':_0x2731a1[_0xe698('0x53')]['id']}})[_0xe698('0x1b')](handleEntityNotFound(_0x4750c9,null))[_0xe698('0x1b')](function(_0xf9f0a5){if(_0xf9f0a5){_0x2731a1['body']['AccountId']=_0xf9f0a5['id'];_0x2731a1[_0xe698('0x51')][_0xe698('0x59')]=integrations['getSubjects'](_0x2731a1[_0xe698('0x51')][_0xe698('0x5a')],_0x2731a1[_0xe698('0x51')][_0xe698('0x37')]);_0x2731a1[_0xe698('0x51')]['Descriptions']=integrations['getDescriptions'](_0x2731a1[_0xe698('0x51')][_0xe698('0x5a')],_0x2731a1['body'][_0xe698('0x37')]);return db[_0xe698('0x56')][_0xe698('0x50')](_0x2731a1[_0xe698('0x51')],{'include':[{'model':db[_0xe698('0x5b')],'as':_0xe698('0x59')},{'model':db[_0xe698('0x5b')],'as':_0xe698('0x5c')}]});}return null;})[_0xe698('0x1b')](respondWithResult(_0x4750c9,null))[_0xe698('0x26')](handleError(_0x4750c9,null));};exports[_0xe698('0x5d')]=function(_0x259fc7,_0x105ec8,_0x3864a6){var _0x49429e='';var _0xb740aa='';return db[_0xe698('0x34')]['findOne']({'where':{'id':_0x259fc7[_0xe698('0x53')]['id']},'attributes':['id','username',_0xe698('0x5e'),_0xe698('0x5f')]})[_0xe698('0x1b')](handleEntityNotFound(_0x105ec8,null))[_0xe698('0x1b')](function(_0x43f1c5){if(_0x43f1c5){_0xb740aa=_0x43f1c5[_0xe698('0x60')];_0x49429e=_0x43f1c5[_0xe698('0x5e')];var _0x5de185=_0x43f1c5['remoteUri'][_0xe698('0x61')](-0x1);if(_0x5de185==='/'){_0x49429e=_0x49429e[_0xe698('0x62')](0x0,_0x49429e[_0xe698('0x63')](_0x5de185));}return rp({'method':_0xe698('0x64'),'uri':util[_0xe698('0x65')](_0xe698('0x66'),_0x49429e,_0xe698('0x67')),'headers':{'Authorization':'Token\x20token='+_0x43f1c5[_0xe698('0x5f')]},'json':!![]});}})[_0xe698('0x1b')](function(_0x5687a5){if(_0x5687a5){var _0x1cbeb2=_0x5687a5['users'];var _0x354744=![];var _0x134d53=null;for(_0x134d53=0x0;_0x134d53<_0x1cbeb2['length'];_0x134d53++){if(_0x1cbeb2[_0x134d53][_0xe698('0x68')]===_0xb740aa){_0x354744=!![];}}if(_0x354744){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe698('0x69')});}}})[_0xe698('0x1b')](respondWithResult(_0x105ec8,null))['catch'](function(_0x341af5){var _0x127873=_0x259fc7[_0xe698('0x3b')][_0xe698('0x17')]?0x1f4:_0x341af5[_0xe698('0x6a')]||0x1f4;logger[_0xe698('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xe698('0x5d'),_0x127873,JSON[_0xe698('0x21')](_0x341af5));delete _0x341af5[_0xe698('0x32')];if(_0x127873===0x191){_0x127873=0x190;}_0x105ec8[_0xe698('0x28')](_0x127873)['send'](_0x259fc7[_0xe698('0x3b')][_0xe698('0x17')]?{'message':_0xe698('0x6b'),'statusCode':_0x341af5[_0xe698('0x6a')]}:_0x341af5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 94c8a61..21c275a 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 _0x4fdb=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','define'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x5410df,_0x1b85a9){_0x5410df=_0x5410df-0x0;var _0x1c663e=_0x4fdb[_0x5410df];return _0x1c663e;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xb4fd('0xa')]=function(_0x5d8b39,_0x53273f){return _0x5d8b39[_0xb4fd('0xb')](_0xb4fd('0xc'),attributes,{'tableName':_0xb4fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes'];(function(_0x5649c2,_0x5c8d04){var _0x28b072=function(_0x17c1a0){while(--_0x17c1a0){_0x5649c2['push'](_0x5649c2['shift']());}};_0x28b072(++_0x5c8d04);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));var integrations=require(_0x7995('0x9'));module[_0x7995('0xa')]=function(_0x219534,_0xbda126){return _0x219534[_0x7995('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x7995('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 679069f..70bd745 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 _0x11c8=['request\x20sent','debug','stringify','error','code','message','info','FreshsalesAccount,\x20%s,\x20%s','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x308072,_0x14afef){var _0x26e45c=function(_0x390aeb){while(--_0x390aeb){_0x308072['push'](_0x308072['shift']());}};_0x26e45c(++_0x14afef);}(_0x11c8,0x19a));var _0x811c=function(_0x129534,_0x560a44){_0x129534=_0x129534-0x0;var _0x430eb4=_0x11c8[_0x129534];return _0x430eb4;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});}exports[_0x811c('0x13')]=function(_0xcefd63){var _0x36c8da=this;return new Promise(function(_0x179636,_0x503bbc){return db[_0x811c('0x14')]['findAll']({'raw':_0xcefd63[_0x811c('0x15')]?_0xcefd63[_0x811c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xcefd63[_0x811c('0x15')]?_0xcefd63[_0x811c('0x15')][_0x811c('0x16')]||null:null,'attributes':_0xcefd63['options']?_0xcefd63['options']['attributes']||null:null,'limit':_0xcefd63[_0x811c('0x15')]?_0xcefd63[_0x811c('0x15')][_0x811c('0x17')]||null:null,'include':_0xcefd63['options']?_0xcefd63[_0x811c('0x15')][_0x811c('0x18')]?_[_0x811c('0x19')](_0xcefd63[_0x811c('0x15')]['include'],function(_0x29d80f){return{'model':db[_0x29d80f[_0x811c('0x1a')]],'as':_0x29d80f['as'],'attributes':_0x29d80f[_0x811c('0x1b')],'include':_0x29d80f[_0x811c('0x18')]?_[_0x811c('0x19')](_0x29d80f[_0x811c('0x18')],function(_0x54deb8){return{'model':db[_0x54deb8[_0x811c('0x1a')]],'as':_0x54deb8['as'],'attributes':_0x54deb8['attributes'],'include':_0x54deb8[_0x811c('0x18')]?_[_0x811c('0x19')](_0x54deb8[_0x811c('0x18')],function(_0x37dbb4){return{'model':db[_0x37dbb4[_0x811c('0x1a')]],'as':_0x37dbb4['as'],'attributes':_0x37dbb4[_0x811c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ecad8){logger[_0x811c('0x10')](_0x811c('0x13'),_0xcefd63);logger[_0x811c('0xb')](_0x811c('0x13'),_0xcefd63,JSON[_0x811c('0xc')](_0x1ecad8));_0x179636(_0x1ecad8);})['catch'](function(_0x2fde17){logger[_0x811c('0xd')]('GetFreshsalesAccount',_0x2fde17['message'],_0xcefd63);_0x503bbc(_0x36c8da[_0x811c('0xd')](0x1f4,_0x2fde17[_0x811c('0xf')]));});});};exports[_0x811c('0x1c')]=function(_0x5920a5){var _0x21d6d5=this;return new Promise(function(_0x244375,_0x538977){return db['FreshsalesAccount']['find']({'raw':_0x5920a5[_0x811c('0x15')]?_0x5920a5[_0x811c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5920a5[_0x811c('0x15')]?_0x5920a5['options']['where']||null:null,'attributes':_0x5920a5[_0x811c('0x15')]?_0x5920a5[_0x811c('0x15')][_0x811c('0x1b')]||null:null,'include':_0x5920a5[_0x811c('0x15')]?_0x5920a5[_0x811c('0x15')][_0x811c('0x18')]?_[_0x811c('0x19')](_0x5920a5[_0x811c('0x15')]['include'],function(_0x54a299){return{'model':db[_0x54a299[_0x811c('0x1a')]],'as':_0x54a299['as'],'attributes':_0x54a299[_0x811c('0x1b')],'include':_0x54a299['include']?_[_0x811c('0x19')](_0x54a299['include'],function(_0x4779d7){return{'model':db[_0x4779d7['model']],'as':_0x4779d7['as'],'attributes':_0x4779d7[_0x811c('0x1b')],'include':_0x4779d7[_0x811c('0x18')]?_['map'](_0x4779d7[_0x811c('0x18')],function(_0x2b4ce3){return{'model':db[_0x2b4ce3[_0x811c('0x1a')]],'as':_0x2b4ce3['as'],'attributes':_0x2b4ce3['attributes']};}):[]};}):[]};}):[]:[]})[_0x811c('0x1d')](function(_0x5720c1){logger['info']('ShowFreshsalesAccount',_0x5920a5);logger[_0x811c('0xb')](_0x811c('0x1c'),_0x5920a5,JSON['stringify'](_0x5720c1));_0x244375(_0x5720c1);})['catch'](function(_0x55766b){logger[_0x811c('0xd')](_0x811c('0x1c'),_0x55766b[_0x811c('0xf')],_0x5920a5);_0x538977(_0x21d6d5[_0x811c('0xd')](0x1f4,_0x55766b[_0x811c('0xf')]));});});}; \ No newline at end of file +var _0x7096=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','util','bluebird','ioredis','../../mysqldb'];(function(_0x748f64,_0x1ab840){var _0x50a19c=function(_0x292646){while(--_0x292646){_0x748f64['push'](_0x748f64['shift']());}};_0x50a19c(++_0x1ab840);}(_0x7096,0x10c));var _0x6709=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7096[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['findAll']({'raw':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x235a54[_0x6709('0x18')]?_0x235a54['options'][_0x6709('0x1a')]||null:null,'attributes':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1b')]||null:null,'limit':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1c')]||null:null,'include':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x235a54[_0x6709('0x18')]['include'],function(_0x29f25f){return{'model':db[_0x29f25f[_0x6709('0x1f')]],'as':_0x29f25f['as'],'attributes':_0x29f25f[_0x6709('0x1b')],'include':_0x29f25f['include']?_[_0x6709('0x1e')](_0x29f25f[_0x6709('0x1d')],function(_0x20a347){return{'model':db[_0x20a347[_0x6709('0x1f')]],'as':_0x20a347['as'],'attributes':_0x20a347['attributes'],'include':_0x20a347[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x20a347['include'],function(_0x585073){return{'model':db[_0x585073[_0x6709('0x1f')]],'as':_0x585073['as'],'attributes':_0x585073['attributes']};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x2499a2){logger['info'](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x2499a2));_0x9c1fd8(_0x2499a2);})['catch'](function(_0x137137){logger['error'](_0x6709('0x16'),_0x137137[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e['error'](0x1f4,_0x137137[_0x6709('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x138318){var _0x135f46=this;return new Promise(function(_0x4b93b2,_0x564dcb){return db[_0x6709('0x17')][_0x6709('0x20')]({'raw':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1a')]||null:null,'attributes':_0x138318[_0x6709('0x18')]?_0x138318['options'][_0x6709('0x1b')]||null:null,'include':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1d')]?_['map'](_0x138318[_0x6709('0x18')][_0x6709('0x1d')],function(_0x124e01){return{'model':db[_0x124e01[_0x6709('0x1f')]],'as':_0x124e01['as'],'attributes':_0x124e01['attributes'],'include':_0x124e01[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x124e01['include'],function(_0x8952f1){return{'model':db[_0x8952f1[_0x6709('0x1f')]],'as':_0x8952f1['as'],'attributes':_0x8952f1['attributes'],'include':_0x8952f1[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x8952f1[_0x6709('0x1d')],function(_0xf30c4c){return{'model':db[_0xf30c4c[_0x6709('0x1f')]],'as':_0xf30c4c['as'],'attributes':_0xf30c4c[_0x6709('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x4bfed4){logger[_0x6709('0xc')](_0x6709('0x21'),_0x138318);logger['debug'](_0x6709('0x21'),_0x138318,JSON[_0x6709('0x10')](_0x4bfed4));_0x4b93b2(_0x4bfed4);})[_0x6709('0x15')](function(_0x2bb89c){logger[_0x6709('0x11')](_0x6709('0x21'),_0x2bb89c['message'],_0x138318);_0x564dcb(_0x135f46[_0x6709('0x11')](0x1f4,_0x2bb89c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index af7be7e..b75692c 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 _0x6416=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x49e4c5,_0x1bdc1e){var _0x2a4ceb=function(_0x1091cd){while(--_0x1091cd){_0x49e4c5['push'](_0x49e4c5['shift']());}};_0x2a4ceb(++_0x1bdc1e);}(_0x6416,0x10a));var _0x6641=function(_0x52b321,_0x3a8b97){_0x52b321=_0x52b321-0x0;var _0x3a62a8=_0x6416[_0x52b321];return _0x3a62a8;};'use strict';var multer=require(_0x6641('0x0'));var util=require(_0x6641('0x1'));var path=require(_0x6641('0x2'));var timeout=require(_0x6641('0x3'));var express=require(_0x6641('0x4'));var router=express[_0x6641('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6641('0x6'));var config=require(_0x6641('0x7'));var controller=require(_0x6641('0x8'));router[_0x6641('0x9')]('/',auth[_0x6641('0xa')](),controller['index']);router[_0x6641('0x9')](_0x6641('0xb'),auth[_0x6641('0xa')](),controller['show']);router[_0x6641('0x9')](_0x6641('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x6641('0xd'),auth[_0x6641('0xa')](),controller['getDescriptions']);router[_0x6641('0x9')](_0x6641('0xe'),auth[_0x6641('0xa')](),controller[_0x6641('0xf')]);router[_0x6641('0x10')]('/',auth[_0x6641('0xa')](),controller[_0x6641('0x11')]);router[_0x6641('0x12')](_0x6641('0xb'),auth['isAuthenticated'](),controller[_0x6641('0x13')]);router['delete'](_0x6641('0xb'),auth['isAuthenticated'](),controller[_0x6641('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb505=['create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','post'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb505,0x9f));var _0x5b50=function(_0x5cfcbd,_0x414b0f){_0x5cfcbd=_0x5cfcbd-0x0;var _0x21eb8b=_0xb505[_0x5cfcbd];return _0x21eb8b;};'use strict';var multer=require(_0x5b50('0x0'));var util=require(_0x5b50('0x1'));var path=require('path');var timeout=require(_0x5b50('0x2'));var express=require(_0x5b50('0x3'));var router=express[_0x5b50('0x4')]();var auth=require(_0x5b50('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b50('0x6'));var controller=require(_0x5b50('0x7'));router[_0x5b50('0x8')]('/',auth[_0x5b50('0x9')](),controller[_0x5b50('0xa')]);router[_0x5b50('0x8')](_0x5b50('0xb'),auth[_0x5b50('0x9')](),controller[_0x5b50('0xc')]);router[_0x5b50('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x5b50('0x8')](_0x5b50('0xd'),auth['isAuthenticated'](),controller[_0x5b50('0xe')]);router['get'](_0x5b50('0xf'),auth[_0x5b50('0x9')](),controller['getFields']);router[_0x5b50('0x10')]('/',auth[_0x5b50('0x9')](),controller[_0x5b50('0x11')]);router[_0x5b50('0x12')](_0x5b50('0xb'),auth[_0x5b50('0x9')](),controller[_0x5b50('0x13')]);router[_0x5b50('0x14')](_0x5b50('0xb'),auth[_0x5b50('0x9')](),controller['destroy']);module[_0x5b50('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d85151b..02bd92f 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 _0xd36f=['sequelize','exports','STRING'];(function(_0x11b36c,_0x4caf31){var _0x560cc2=function(_0x289eb9){while(--_0x289eb9){_0x11b36c['push'](_0x11b36c['shift']());}};_0x560cc2(++_0x4caf31);}(_0xd36f,0x1bf));var _0xfd36=function(_0x2499b8,_0x161c2a){_0x2499b8=_0x2499b8-0x0;var _0x397354=_0xd36f[_0x2499b8];return _0x397354;};'use strict';var Sequelize=require(_0xfd36('0x0'));module[_0xfd36('0x1')]={'name':{'type':Sequelize[_0xfd36('0x2')]},'description':{'type':Sequelize[_0xfd36('0x2')]}}; \ No newline at end of file +var _0x5e33=['STRING','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5e33,0x109));var _0x35e3=function(_0x1b862d,_0x27f3e1){_0x1b862d=_0x1b862d-0x0;var _0x495ca8=_0x5e33[_0x1b862d];return _0x495ca8;};'use strict';var Sequelize=require(_0x35e3('0x0'));module[_0x35e3('0x1')]={'name':{'type':Sequelize[_0x35e3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 28f21cc..1fd2d75 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 _0x3a0e=['../../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','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','save','update','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getSubjects','findOne','FreshsalesField','filter','getDescriptions','getFields','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x5e5c74,_0x1c0d09){var _0x5d2127=function(_0x371e2b){while(--_0x371e2b){_0x5e5c74['push'](_0x5e5c74['shift']());}};_0x5d2127(++_0x1c0d09);}(_0x3a0e,0x108));var _0xe3a0=function(_0x20a761,_0x2ffd85){_0x20a761=_0x20a761-0x0;var _0x284a38=_0x3a0e[_0x20a761];return _0x284a38;};'use strict';var pdf=require(_0xe3a0('0x0'));var emlformat=require(_0xe3a0('0x1'));var rimraf=require(_0xe3a0('0x2'));var zipdir=require(_0xe3a0('0x3'));var jsonpatch=require(_0xe3a0('0x4'));var rp=require(_0xe3a0('0x5'));var moment=require(_0xe3a0('0x6'));var BPromise=require(_0xe3a0('0x7'));var Mustache=require(_0xe3a0('0x8'));var util=require(_0xe3a0('0x9'));var path=require(_0xe3a0('0xa'));var sox=require(_0xe3a0('0xb'));var csv=require(_0xe3a0('0xc'));var ejs=require(_0xe3a0('0xd'));var fs=require('fs');var _=require(_0xe3a0('0xe'));var squel=require('squel');var crypto=require(_0xe3a0('0xf'));var jsforce=require(_0xe3a0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3a0('0x11'));var Papa=require(_0xe3a0('0x12'));var Redis=require(_0xe3a0('0x13'));var authService=require(_0xe3a0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe3a0('0x15'));var hardwareService=require(_0xe3a0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe3a0('0x17'));var config=require('../../config/environment');var db=require(_0xe3a0('0x18'))['db'];var jayson=require(_0xe3a0('0x19'));var client=jayson[_0xe3a0('0x1a')][_0xe3a0('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x49cbba,_0x178562,_0x269158){if(_0x269158){var _0x2ead4b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ead4b[_0xe3a0('0x1c')](_0x178562)){return _0x49cbba;}else{throw new db['Sequelize'][(_0xe3a0('0x1d'))](_0xe3a0('0x1e'));}}else{return _0x49cbba;}}function respondWithRpcPromise(_0x67fc95,_0x58aa62,_0x53412e,_0x24cb41){return new BPromise(function(_0x1ac866,_0x5b3e8a){var _0x557e32=_0x24cb41||client;return _0x557e32[_0xe3a0('0x1f')](_0x67fc95,_0x53412e)[_0xe3a0('0x20')](function(_0x5b649e){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x58aa62,_0xe3a0('0x21'));logger['debug'](_0xe3a0('0x22'),_0x58aa62,'request\x20sent',JSON[_0xe3a0('0x23')](_0x5b649e));if(_0x5b649e['error']){if(_0x5b649e[_0xe3a0('0x24')][_0xe3a0('0x25')]===0x1f4){logger[_0xe3a0('0x24')](_0xe3a0('0x26'),_0x58aa62,_0x5b649e[_0xe3a0('0x24')]['message']);return _0x5b3e8a(_0x5b649e[_0xe3a0('0x24')][_0xe3a0('0x27')]);}logger[_0xe3a0('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x58aa62,_0x5b649e[_0xe3a0('0x24')][_0xe3a0('0x27')]);return _0x1ac866(_0x5b649e[_0xe3a0('0x24')][_0xe3a0('0x27')]);}else{logger[_0xe3a0('0x28')](_0xe3a0('0x26'),_0x58aa62,_0xe3a0('0x21'));_0x1ac866(_0x5b649e[_0xe3a0('0x29')][_0xe3a0('0x27')]);}})[_0xe3a0('0x2a')](function(_0x37ba0e){logger['error'](_0xe3a0('0x26'),_0x58aa62,_0x37ba0e);_0x5b3e8a(_0x37ba0e);});});}function respondWithStatusCode(_0x1b65d9,_0x1c97d2){_0x1c97d2=_0x1c97d2||0xcc;return function(_0x5676b5){if(_0x5676b5){return _0x1b65d9[_0xe3a0('0x2b')](_0x1c97d2);}return _0x1b65d9[_0xe3a0('0x2c')](_0x1c97d2)[_0xe3a0('0x2d')]();};}function respondWithResult(_0x6526bc,_0x5cf8b7){_0x5cf8b7=_0x5cf8b7||0xc8;return function(_0x108b84){if(_0x108b84){return _0x6526bc[_0xe3a0('0x2c')](_0x5cf8b7)['json'](_0x108b84);}};}function respondWithFilteredResult(_0x4cc4c7,_0x22d802){return function(_0x367980){if(_0x367980){var _0x157357=_0x367980[_0xe3a0('0x2e')],_0x5be5f2=_0x22d802[_0xe3a0('0x2f')],_0x2ea170=_0x22d802[_0xe3a0('0x2f')]+_0x22d802['limit'],_0x38b760;if(_0x2ea170>=_0x157357){_0x2ea170=_0x157357;_0x38b760=0xc8;}else{_0x38b760=0xce;}_0x4cc4c7[_0xe3a0('0x2c')](_0x38b760);return _0x4cc4c7[_0xe3a0('0x30')](_0xe3a0('0x31'),_0x5be5f2+'-'+_0x2ea170+'/'+_0x157357)[_0xe3a0('0x32')](_0x367980);}return null;};}function patchUpdates(_0x1127b9){return function(_0x18e2b7){try{jsonpatch['apply'](_0x18e2b7,_0x1127b9,!![]);}catch(_0x49e474){return BPromise['reject'](_0x49e474);}return _0x18e2b7[_0xe3a0('0x33')]();};}function saveUpdates(_0xffba73,_0x1d6994){return function(_0x263382){if(_0x263382){return _0x263382[_0xe3a0('0x34')](_0xffba73)[_0xe3a0('0x20')](function(_0x1e4d16){return _0x1e4d16;});}return null;};}function removeEntity(_0x5b68b2,_0x5e0de4){return function(_0x2513cb){if(_0x2513cb){return _0x2513cb[_0xe3a0('0x35')]()[_0xe3a0('0x20')](function(){_0x5b68b2[_0xe3a0('0x2c')](0xcc)[_0xe3a0('0x2d')]();});}};}function handleEntityNotFound(_0x37697f,_0x2a6cff){return function(_0x61678){if(!_0x61678){_0x37697f[_0xe3a0('0x2b')](0x194);}return _0x61678;};}function handleError(_0x1d5cb9,_0x500772){_0x500772=_0x500772||0x1f4;return function(_0x5cc4c6){logger['error'](_0x5cc4c6['stack']);if(_0x5cc4c6[_0xe3a0('0x36')]){delete _0x5cc4c6[_0xe3a0('0x36')];}_0x1d5cb9[_0xe3a0('0x2c')](_0x500772)[_0xe3a0('0x37')](_0x5cc4c6);};}exports[_0xe3a0('0x38')]=function(_0x5c10af,_0x278313){var _0x51f5cd={},_0x46c73d={},_0x212d5d={'count':0x0,'rows':[]};var _0x346d1c=_[_0xe3a0('0x39')](db[_0xe3a0('0x3a')][_0xe3a0('0x3b')],function(_0x5449de){return{'name':_0x5449de[_0xe3a0('0x3c')],'type':_0x5449de[_0xe3a0('0x3d')][_0xe3a0('0x3e')]};});_0x46c73d[_0xe3a0('0x3f')]=_[_0xe3a0('0x39')](_0x346d1c,_0xe3a0('0x36'));_0x46c73d[_0xe3a0('0x40')]=_['keys'](_0x5c10af[_0xe3a0('0x40')]);_0x46c73d[_0xe3a0('0x41')]=_[_0xe3a0('0x42')](_0x46c73d[_0xe3a0('0x3f')],_0x46c73d['query']);_0x51f5cd['attributes']=_['intersection'](_0x46c73d[_0xe3a0('0x3f')],qs[_0xe3a0('0x43')](_0x5c10af[_0xe3a0('0x40')][_0xe3a0('0x43')]));_0x51f5cd[_0xe3a0('0x44')]=_0x51f5cd[_0xe3a0('0x44')][_0xe3a0('0x45')]?_0x51f5cd[_0xe3a0('0x44')]:_0x46c73d[_0xe3a0('0x3f')];if(!_0x5c10af[_0xe3a0('0x40')]['hasOwnProperty'](_0xe3a0('0x46'))){_0x51f5cd[_0xe3a0('0x47')]=qs[_0xe3a0('0x47')](_0x5c10af[_0xe3a0('0x40')][_0xe3a0('0x47')]);_0x51f5cd[_0xe3a0('0x2f')]=qs['offset'](_0x5c10af[_0xe3a0('0x40')][_0xe3a0('0x2f')]);}_0x51f5cd[_0xe3a0('0x48')]=qs['sort'](_0x5c10af[_0xe3a0('0x40')][_0xe3a0('0x49')]);_0x51f5cd[_0xe3a0('0x4a')]=qs['filters'](_[_0xe3a0('0x4b')](_0x5c10af[_0xe3a0('0x40')],_0x46c73d[_0xe3a0('0x41')]),_0x346d1c);if(_0x5c10af[_0xe3a0('0x40')]['filter']){_0x51f5cd[_0xe3a0('0x4a')]=_['merge'](_0x51f5cd[_0xe3a0('0x4a')],{'$or':_[_0xe3a0('0x39')](_0x346d1c,function(_0x37b675){if(_0x37b675[_0xe3a0('0x3d')]!==_0xe3a0('0x4c')){var _0x5822fd={};_0x5822fd[_0x37b675[_0xe3a0('0x36')]]={'$like':'%'+_0x5c10af['query']['filter']+'%'};return _0x5822fd;}})});}_0x51f5cd=_[_0xe3a0('0x4d')]({},_0x51f5cd,_0x5c10af[_0xe3a0('0x4e')]);var _0x5c8770={'where':_0x51f5cd[_0xe3a0('0x4a')]};return db['FreshsalesConfiguration'][_0xe3a0('0x2e')](_0x5c8770)[_0xe3a0('0x20')](function(_0x407df7){_0x212d5d[_0xe3a0('0x2e')]=_0x407df7;if(_0x5c10af[_0xe3a0('0x40')][_0xe3a0('0x4f')]){_0x51f5cd[_0xe3a0('0x50')]=[{'all':!![]}];}return db[_0xe3a0('0x3a')][_0xe3a0('0x51')](_0x51f5cd);})[_0xe3a0('0x20')](function(_0x560578){_0x212d5d[_0xe3a0('0x52')]=_0x560578;return _0x212d5d;})['then'](respondWithFilteredResult(_0x278313,_0x51f5cd))[_0xe3a0('0x2a')](handleError(_0x278313,null));};exports[_0xe3a0('0x53')]=function(_0x12f7e9,_0xfb1d0d){var _0x4df5ac={'raw':![],'where':{'id':_0x12f7e9['params']['id']}},_0x38c7d4={};_0x38c7d4['model']=_[_0xe3a0('0x54')](db['FreshsalesConfiguration'][_0xe3a0('0x3b')]);_0x38c7d4[_0xe3a0('0x40')]=_[_0xe3a0('0x54')](_0x12f7e9[_0xe3a0('0x40')]);_0x38c7d4[_0xe3a0('0x41')]=_[_0xe3a0('0x42')](_0x38c7d4['model'],_0x38c7d4[_0xe3a0('0x40')]);_0x4df5ac['attributes']=_[_0xe3a0('0x42')](_0x38c7d4[_0xe3a0('0x3f')],qs['fields'](_0x12f7e9['query']['fields']));_0x4df5ac['attributes']=_0x4df5ac['attributes'][_0xe3a0('0x45')]?_0x4df5ac[_0xe3a0('0x44')]:_0x38c7d4[_0xe3a0('0x3f')];if(_0x12f7e9[_0xe3a0('0x40')][_0xe3a0('0x4f')]){_0x4df5ac[_0xe3a0('0x50')]=[{'all':!![]}];}_0x4df5ac=_[_0xe3a0('0x4d')]({},_0x4df5ac,_0x12f7e9[_0xe3a0('0x4e')]);return db[_0xe3a0('0x3a')][_0xe3a0('0x55')](_0x4df5ac)['then'](handleEntityNotFound(_0xfb1d0d,null))[_0xe3a0('0x20')](respondWithResult(_0xfb1d0d,null))['catch'](handleError(_0xfb1d0d,null));};exports[_0xe3a0('0x56')]=function(_0x685f54,_0x57673b){return db[_0xe3a0('0x3a')][_0xe3a0('0x56')](_0x685f54[_0xe3a0('0x57')],{})[_0xe3a0('0x20')](respondWithResult(_0x57673b,0xc9))[_0xe3a0('0x2a')](handleError(_0x57673b,null));};exports['update']=function(_0x349008,_0x5d7905){if(_0x349008['body']['id']){delete _0x349008[_0xe3a0('0x57')]['id'];}return db[_0xe3a0('0x3a')][_0xe3a0('0x55')]({'where':{'id':_0x349008[_0xe3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d7905,null))[_0xe3a0('0x20')](saveUpdates(_0x349008['body'],null))[_0xe3a0('0x20')](respondWithResult(_0x5d7905,null))[_0xe3a0('0x2a')](handleError(_0x5d7905,null));};exports['destroy']=function(_0x2dec98,_0x11c620){return db['FreshsalesConfiguration'][_0xe3a0('0x55')]({'where':{'id':_0x2dec98['params']['id']}})['then'](handleEntityNotFound(_0x11c620,null))['then'](removeEntity(_0x11c620,null))['catch'](handleError(_0x11c620,null));};exports[_0xe3a0('0x59')]=function(_0x1f71a9,_0xcfe430,_0xc5f072){var _0xa785f4={};var _0x1841b9={};var _0x3d148f;var _0x5d4db7;return db[_0xe3a0('0x3a')][_0xe3a0('0x5a')]({'where':{'id':_0x1f71a9['params']['id']}})['then'](handleEntityNotFound(_0xcfe430,null))[_0xe3a0('0x20')](function(_0x4f43f4){if(_0x4f43f4){_0x3d148f=_0x4f43f4;_0x1841b9[_0xe3a0('0x3f')]=_[_0xe3a0('0x54')](db[_0xe3a0('0x5b')][_0xe3a0('0x3b')]);_0x1841b9['query']=_[_0xe3a0('0x54')](_0x1f71a9[_0xe3a0('0x40')]);_0x1841b9['filters']=_['intersection'](_0x1841b9[_0xe3a0('0x3f')],_0x1841b9['query']);_0xa785f4['attributes']=_[_0xe3a0('0x42')](_0x1841b9[_0xe3a0('0x3f')],qs[_0xe3a0('0x43')](_0x1f71a9['query'][_0xe3a0('0x43')]));_0xa785f4[_0xe3a0('0x44')]=_0xa785f4['attributes'][_0xe3a0('0x45')]?_0xa785f4[_0xe3a0('0x44')]:_0x1841b9[_0xe3a0('0x3f')];_0xa785f4[_0xe3a0('0x48')]=qs[_0xe3a0('0x49')](_0x1f71a9[_0xe3a0('0x40')][_0xe3a0('0x49')]);_0xa785f4['where']=qs[_0xe3a0('0x41')](_[_0xe3a0('0x4b')](_0x1f71a9['query'],_0x1841b9[_0xe3a0('0x41')]));if(_0x1f71a9[_0xe3a0('0x40')][_0xe3a0('0x5c')]){_0xa785f4[_0xe3a0('0x4a')]=_['merge'](_0xa785f4[_0xe3a0('0x4a')],{'$or':_[_0xe3a0('0x39')](_0xa785f4['attributes'],function(_0xff68f3){var _0x16a998={};_0x16a998[_0xff68f3]={'$like':'%'+_0x1f71a9['query'][_0xe3a0('0x5c')]+'%'};return _0x16a998;})});}_0xa785f4=_[_0xe3a0('0x4d')]({},_0xa785f4,_0x1f71a9[_0xe3a0('0x4e')]);return _0x3d148f[_0xe3a0('0x59')](_0xa785f4);}})[_0xe3a0('0x20')](function(_0x4ae236){if(_0x4ae236){_0x5d4db7=_0x4ae236[_0xe3a0('0x45')];if(!_0x1f71a9[_0xe3a0('0x40')]['hasOwnProperty'](_0xe3a0('0x46'))){_0xa785f4[_0xe3a0('0x47')]=qs[_0xe3a0('0x47')](_0x1f71a9['query'][_0xe3a0('0x47')]);_0xa785f4[_0xe3a0('0x2f')]=qs[_0xe3a0('0x2f')](_0x1f71a9[_0xe3a0('0x40')]['offset']);}return _0x3d148f[_0xe3a0('0x59')](_0xa785f4);}})[_0xe3a0('0x20')](function(_0x536e1a){if(_0x536e1a){return _0x536e1a?{'count':_0x5d4db7,'rows':_0x536e1a}:null;}})['then'](respondWithResult(_0xcfe430,null))[_0xe3a0('0x2a')](handleError(_0xcfe430,null));};exports[_0xe3a0('0x5d')]=function(_0x54bbe7,_0x22a689,_0x1258e2){var _0x4ce18b={};var _0x476e56={};var _0x34e013;var _0x337725;return db[_0xe3a0('0x3a')][_0xe3a0('0x5a')]({'where':{'id':_0x54bbe7[_0xe3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x22a689,null))['then'](function(_0x34a81f){if(_0x34a81f){_0x34e013=_0x34a81f;_0x476e56[_0xe3a0('0x3f')]=_['keys'](db['FreshsalesField'][_0xe3a0('0x3b')]);_0x476e56[_0xe3a0('0x40')]=_[_0xe3a0('0x54')](_0x54bbe7['query']);_0x476e56[_0xe3a0('0x41')]=_[_0xe3a0('0x42')](_0x476e56[_0xe3a0('0x3f')],_0x476e56[_0xe3a0('0x40')]);_0x4ce18b[_0xe3a0('0x44')]=_['intersection'](_0x476e56[_0xe3a0('0x3f')],qs[_0xe3a0('0x43')](_0x54bbe7[_0xe3a0('0x40')]['fields']));_0x4ce18b[_0xe3a0('0x44')]=_0x4ce18b[_0xe3a0('0x44')]['length']?_0x4ce18b['attributes']:_0x476e56[_0xe3a0('0x3f')];_0x4ce18b[_0xe3a0('0x48')]=qs[_0xe3a0('0x49')](_0x54bbe7[_0xe3a0('0x40')][_0xe3a0('0x49')]);_0x4ce18b[_0xe3a0('0x4a')]=qs[_0xe3a0('0x41')](_[_0xe3a0('0x4b')](_0x54bbe7[_0xe3a0('0x40')],_0x476e56[_0xe3a0('0x41')]));if(_0x54bbe7[_0xe3a0('0x40')]['filter']){_0x4ce18b[_0xe3a0('0x4a')]=_[_0xe3a0('0x4d')](_0x4ce18b[_0xe3a0('0x4a')],{'$or':_[_0xe3a0('0x39')](_0x4ce18b[_0xe3a0('0x44')],function(_0x346d47){var _0x52db35={};_0x52db35[_0x346d47]={'$like':'%'+_0x54bbe7[_0xe3a0('0x40')][_0xe3a0('0x5c')]+'%'};return _0x52db35;})});}_0x4ce18b=_[_0xe3a0('0x4d')]({},_0x4ce18b,_0x54bbe7[_0xe3a0('0x4e')]);return _0x34e013[_0xe3a0('0x5d')](_0x4ce18b);}})[_0xe3a0('0x20')](function(_0x50de89){if(_0x50de89){_0x337725=_0x50de89['length'];if(!_0x54bbe7[_0xe3a0('0x40')]['hasOwnProperty'](_0xe3a0('0x46'))){_0x4ce18b['limit']=qs[_0xe3a0('0x47')](_0x54bbe7[_0xe3a0('0x40')][_0xe3a0('0x47')]);_0x4ce18b['offset']=qs['offset'](_0x54bbe7[_0xe3a0('0x40')]['offset']);}return _0x34e013[_0xe3a0('0x5d')](_0x4ce18b);}})[_0xe3a0('0x20')](function(_0x42f288){if(_0x42f288){return _0x42f288?{'count':_0x337725,'rows':_0x42f288}:null;}})['then'](respondWithResult(_0x22a689,null))[_0xe3a0('0x2a')](handleError(_0x22a689,null));};exports[_0xe3a0('0x5e')]=function(_0x3f8469,_0x10e396,_0x1bfcde){var _0x2c19f1={};var _0x6d82be={};var _0x3b2879;var _0x70bdc7;return db[_0xe3a0('0x3a')][_0xe3a0('0x5a')]({'where':{'id':_0x3f8469[_0xe3a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x10e396,null))['then'](function(_0x272478){if(_0x272478){_0x3b2879=_0x272478;_0x6d82be[_0xe3a0('0x3f')]=_[_0xe3a0('0x54')](db[_0xe3a0('0x5b')][_0xe3a0('0x3b')]);_0x6d82be[_0xe3a0('0x40')]=_[_0xe3a0('0x54')](_0x3f8469[_0xe3a0('0x40')]);_0x6d82be[_0xe3a0('0x41')]=_[_0xe3a0('0x42')](_0x6d82be['model'],_0x6d82be[_0xe3a0('0x40')]);_0x2c19f1[_0xe3a0('0x44')]=_[_0xe3a0('0x42')](_0x6d82be[_0xe3a0('0x3f')],qs[_0xe3a0('0x43')](_0x3f8469[_0xe3a0('0x40')][_0xe3a0('0x43')]));_0x2c19f1['attributes']=_0x2c19f1[_0xe3a0('0x44')][_0xe3a0('0x45')]?_0x2c19f1['attributes']:_0x6d82be['model'];_0x2c19f1[_0xe3a0('0x48')]=qs[_0xe3a0('0x49')](_0x3f8469[_0xe3a0('0x40')][_0xe3a0('0x49')]);_0x2c19f1[_0xe3a0('0x4a')]=qs['filters'](_[_0xe3a0('0x4b')](_0x3f8469['query'],_0x6d82be['filters']));if(_0x3f8469[_0xe3a0('0x40')][_0xe3a0('0x5c')]){_0x2c19f1['where']=_[_0xe3a0('0x4d')](_0x2c19f1[_0xe3a0('0x4a')],{'$or':_['map'](_0x2c19f1[_0xe3a0('0x44')],function(_0x550861){var _0x345de4={};_0x345de4[_0x550861]={'$like':'%'+_0x3f8469[_0xe3a0('0x40')][_0xe3a0('0x5c')]+'%'};return _0x345de4;})});}_0x2c19f1=_[_0xe3a0('0x4d')]({},_0x2c19f1,_0x3f8469[_0xe3a0('0x4e')]);return _0x3b2879[_0xe3a0('0x5e')](_0x2c19f1);}})[_0xe3a0('0x20')](function(_0x9e59a0){if(_0x9e59a0){_0x70bdc7=_0x9e59a0[_0xe3a0('0x45')];if(!_0x3f8469['query'][_0xe3a0('0x5f')]('nolimit')){_0x2c19f1['limit']=qs[_0xe3a0('0x47')](_0x3f8469[_0xe3a0('0x40')][_0xe3a0('0x47')]);_0x2c19f1[_0xe3a0('0x2f')]=qs[_0xe3a0('0x2f')](_0x3f8469[_0xe3a0('0x40')]['offset']);}return _0x3b2879[_0xe3a0('0x5e')](_0x2c19f1);}})[_0xe3a0('0x20')](function(_0x5cb2f1){if(_0x5cb2f1){return _0x5cb2f1?{'count':_0x70bdc7,'rows':_0x5cb2f1}:null;}})[_0xe3a0('0x20')](respondWithResult(_0x10e396,null))[_0xe3a0('0x2a')](handleError(_0x10e396,null));}; \ No newline at end of file +var _0x56d0=['where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','create','body','find','getSubjects','findOne','keys','FreshsalesField','map','options','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','code','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','name','send','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x56d0,0x18f));var _0x056d=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x56d0[_0x2c3a8f];return _0x189412;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x056d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x056d('0x1'));var jsonpatch=require(_0x056d('0x2'));var rp=require(_0x056d('0x3'));var moment=require(_0x056d('0x4'));var BPromise=require(_0x056d('0x5'));var Mustache=require(_0x056d('0x6'));var util=require(_0x056d('0x7'));var path=require(_0x056d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x056d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x056d('0xa'));var crypto=require(_0x056d('0xb'));var jsforce=require(_0x056d('0xc'));var deskjs=require(_0x056d('0xd'));var toCsv=require(_0x056d('0xe'));var querystring=require(_0x056d('0xf'));var Papa=require(_0x056d('0x10'));var Redis=require(_0x056d('0x11'));var authService=require(_0x056d('0x12'));var qs=require(_0x056d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x056d('0x14'));var logger=require(_0x056d('0x15'))('api');var utils=require(_0x056d('0x16'));var config=require(_0x056d('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x056d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x186d41,_0x95934c,_0xe96c06){if(_0xe96c06){var _0x80839e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x80839e['test'](_0x95934c)){return _0x186d41;}else{throw new db[(_0x056d('0x19'))][(_0x056d('0x1a'))](_0x056d('0x1b'));}}else{return _0x186d41;}}function respondWithRpcPromise(_0x37932f,_0x40c417,_0x195ac0,_0x5420fa){return new BPromise(function(_0x1c739a,_0x318075){var _0x192a27=_0x5420fa||client;return _0x192a27[_0x056d('0x1c')](_0x37932f,_0x195ac0)['then'](function(_0x4a0f66){logger[_0x056d('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x40c417,_0x056d('0x1e'));logger[_0x056d('0x1f')](_0x056d('0x20'),_0x40c417,_0x056d('0x1e'),JSON[_0x056d('0x21')](_0x4a0f66));if(_0x4a0f66['error']){if(_0x4a0f66['error'][_0x056d('0x22')]===0x1f4){logger[_0x056d('0x23')](_0x056d('0x24'),_0x40c417,_0x4a0f66[_0x056d('0x23')][_0x056d('0x25')]);return _0x318075(_0x4a0f66[_0x056d('0x23')][_0x056d('0x25')]);}logger['error'](_0x056d('0x24'),_0x40c417,_0x4a0f66['error']['message']);return _0x1c739a(_0x4a0f66['error']['message']);}else{logger[_0x056d('0x1d')](_0x056d('0x24'),_0x40c417,_0x056d('0x1e'));_0x1c739a(_0x4a0f66[_0x056d('0x26')][_0x056d('0x25')]);}})['catch'](function(_0x169f33){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x40c417,_0x169f33);_0x318075(_0x169f33);});});}function respondWithStatusCode(_0x5ab8eb,_0x52c12c){_0x52c12c=_0x52c12c||0xcc;return function(_0x2c3a33){if(_0x2c3a33){return _0x5ab8eb[_0x056d('0x27')](_0x52c12c);}return _0x5ab8eb['status'](_0x52c12c)[_0x056d('0x28')]();};}function respondWithResult(_0x5b1350,_0x164506){_0x164506=_0x164506||0xc8;return function(_0x4d1b84){if(_0x4d1b84){return _0x5b1350[_0x056d('0x29')](_0x164506)['json'](_0x4d1b84);}};}function respondWithFilteredResult(_0x4d7adb,_0x5a7d6f){return function(_0x5425a1){if(_0x5425a1){var _0x472e8e=_0x5425a1[_0x056d('0x2a')],_0x119c3c=_0x5a7d6f[_0x056d('0x2b')],_0x3e2348=_0x5a7d6f[_0x056d('0x2b')]+_0x5a7d6f[_0x056d('0x2c')],_0x3e53f1;if(_0x3e2348>=_0x472e8e){_0x3e2348=_0x472e8e;_0x3e53f1=0xc8;}else{_0x3e53f1=0xce;}_0x4d7adb[_0x056d('0x29')](_0x3e53f1);return _0x4d7adb[_0x056d('0x2d')](_0x056d('0x2e'),_0x119c3c+'-'+_0x3e2348+'/'+_0x472e8e)[_0x056d('0x2f')](_0x5425a1);}return null;};}function patchUpdates(_0x54f01c){return function(_0x21b869){try{jsonpatch['apply'](_0x21b869,_0x54f01c,!![]);}catch(_0x58206b){return BPromise[_0x056d('0x30')](_0x58206b);}return _0x21b869[_0x056d('0x31')]();};}function saveUpdates(_0x4be93c,_0x59e57f){return function(_0x26d5c3){if(_0x26d5c3){return _0x26d5c3[_0x056d('0x32')](_0x4be93c)[_0x056d('0x33')](function(_0x2ee560){return _0x2ee560;});}return null;};}function removeEntity(_0x4a704c,_0x2352e8){return function(_0x28a662){if(_0x28a662){return _0x28a662[_0x056d('0x34')]()[_0x056d('0x33')](function(){_0x4a704c[_0x056d('0x29')](0xcc)[_0x056d('0x28')]();});}};}function handleEntityNotFound(_0x6009fc,_0x11ab15){return function(_0x51b79c){if(!_0x51b79c){_0x6009fc[_0x056d('0x27')](0x194);}return _0x51b79c;};}function handleError(_0x4c2ba7,_0x412e0b){_0x412e0b=_0x412e0b||0x1f4;return function(_0x334534){logger[_0x056d('0x23')](_0x334534['stack']);if(_0x334534[_0x056d('0x35')]){delete _0x334534[_0x056d('0x35')];}_0x4c2ba7['status'](_0x412e0b)[_0x056d('0x36')](_0x334534);};}exports['index']=function(_0x27e74a,_0x50d5b5){var _0x2e43c4={},_0x2c0477={},_0x4d58a5={'count':0x0,'rows':[]};var _0x10adb1=_['map'](db[_0x056d('0x37')][_0x056d('0x38')],function(_0x15a3ac){return{'name':_0x15a3ac[_0x056d('0x39')],'type':_0x15a3ac[_0x056d('0x3a')][_0x056d('0x3b')]};});_0x2c0477[_0x056d('0x3c')]=_['map'](_0x10adb1,_0x056d('0x35'));_0x2c0477[_0x056d('0x3d')]=_['keys'](_0x27e74a[_0x056d('0x3d')]);_0x2c0477[_0x056d('0x3e')]=_[_0x056d('0x3f')](_0x2c0477[_0x056d('0x3c')],_0x2c0477['query']);_0x2e43c4[_0x056d('0x40')]=_[_0x056d('0x3f')](_0x2c0477[_0x056d('0x3c')],qs['fields'](_0x27e74a[_0x056d('0x3d')][_0x056d('0x41')]));_0x2e43c4[_0x056d('0x40')]=_0x2e43c4['attributes'][_0x056d('0x42')]?_0x2e43c4[_0x056d('0x40')]:_0x2c0477[_0x056d('0x3c')];if(!_0x27e74a[_0x056d('0x3d')][_0x056d('0x43')](_0x056d('0x44'))){_0x2e43c4[_0x056d('0x2c')]=qs[_0x056d('0x2c')](_0x27e74a['query'][_0x056d('0x2c')]);_0x2e43c4[_0x056d('0x2b')]=qs[_0x056d('0x2b')](_0x27e74a[_0x056d('0x3d')][_0x056d('0x2b')]);}_0x2e43c4[_0x056d('0x45')]=qs[_0x056d('0x46')](_0x27e74a[_0x056d('0x3d')][_0x056d('0x46')]);_0x2e43c4[_0x056d('0x47')]=qs[_0x056d('0x3e')](_[_0x056d('0x48')](_0x27e74a[_0x056d('0x3d')],_0x2c0477[_0x056d('0x3e')]),_0x10adb1);if(_0x27e74a[_0x056d('0x3d')][_0x056d('0x49')]){_0x2e43c4[_0x056d('0x47')]=_['merge'](_0x2e43c4['where'],{'$or':_['map'](_0x10adb1,function(_0x20e4d5){if(_0x20e4d5[_0x056d('0x3a')]!==_0x056d('0x4a')){var _0x1ef91c={};_0x1ef91c[_0x20e4d5[_0x056d('0x35')]]={'$like':'%'+_0x27e74a[_0x056d('0x3d')][_0x056d('0x49')]+'%'};return _0x1ef91c;}})});}_0x2e43c4=_[_0x056d('0x4b')]({},_0x2e43c4,_0x27e74a['options']);var _0x5c9e38={'where':_0x2e43c4[_0x056d('0x47')]};return db[_0x056d('0x37')][_0x056d('0x2a')](_0x5c9e38)[_0x056d('0x33')](function(_0x4b7dc6){_0x4d58a5[_0x056d('0x2a')]=_0x4b7dc6;if(_0x27e74a['query']['includeAll']){_0x2e43c4[_0x056d('0x4c')]=[{'all':!![]}];}return db[_0x056d('0x37')][_0x056d('0x4d')](_0x2e43c4);})[_0x056d('0x33')](function(_0x9c533f){_0x4d58a5[_0x056d('0x4e')]=_0x9c533f;return _0x4d58a5;})['then'](respondWithFilteredResult(_0x50d5b5,_0x2e43c4))[_0x056d('0x4f')](handleError(_0x50d5b5,null));};exports[_0x056d('0x50')]=function(_0x4fc375,_0x2b1d6a){var _0x338ff6={'raw':![],'where':{'id':_0x4fc375[_0x056d('0x51')]['id']}},_0x36a3ae={};_0x36a3ae[_0x056d('0x3c')]=_['keys'](db[_0x056d('0x37')][_0x056d('0x38')]);_0x36a3ae[_0x056d('0x3d')]=_['keys'](_0x4fc375['query']);_0x36a3ae[_0x056d('0x3e')]=_['intersection'](_0x36a3ae[_0x056d('0x3c')],_0x36a3ae[_0x056d('0x3d')]);_0x338ff6[_0x056d('0x40')]=_[_0x056d('0x3f')](_0x36a3ae[_0x056d('0x3c')],qs[_0x056d('0x41')](_0x4fc375['query'][_0x056d('0x41')]));_0x338ff6['attributes']=_0x338ff6[_0x056d('0x40')]['length']?_0x338ff6[_0x056d('0x40')]:_0x36a3ae['model'];if(_0x4fc375[_0x056d('0x3d')][_0x056d('0x52')]){_0x338ff6[_0x056d('0x4c')]=[{'all':!![]}];}_0x338ff6=_['merge']({},_0x338ff6,_0x4fc375['options']);return db[_0x056d('0x37')]['find'](_0x338ff6)[_0x056d('0x33')](handleEntityNotFound(_0x2b1d6a,null))[_0x056d('0x33')](respondWithResult(_0x2b1d6a,null))[_0x056d('0x4f')](handleError(_0x2b1d6a,null));};exports[_0x056d('0x53')]=function(_0x2acf40,_0x30b5f1){return db[_0x056d('0x37')][_0x056d('0x53')](_0x2acf40[_0x056d('0x54')],{})[_0x056d('0x33')](respondWithResult(_0x30b5f1,0xc9))[_0x056d('0x4f')](handleError(_0x30b5f1,null));};exports[_0x056d('0x32')]=function(_0x226d92,_0x50c2d7){if(_0x226d92['body']['id']){delete _0x226d92[_0x056d('0x54')]['id'];}return db[_0x056d('0x37')][_0x056d('0x55')]({'where':{'id':_0x226d92[_0x056d('0x51')]['id']}})[_0x056d('0x33')](handleEntityNotFound(_0x50c2d7,null))['then'](saveUpdates(_0x226d92[_0x056d('0x54')],null))[_0x056d('0x33')](respondWithResult(_0x50c2d7,null))[_0x056d('0x4f')](handleError(_0x50c2d7,null));};exports[_0x056d('0x34')]=function(_0x3a1fcd,_0x5c3c1a){return db[_0x056d('0x37')]['find']({'where':{'id':_0x3a1fcd[_0x056d('0x51')]['id']}})[_0x056d('0x33')](handleEntityNotFound(_0x5c3c1a,null))[_0x056d('0x33')](removeEntity(_0x5c3c1a,null))[_0x056d('0x4f')](handleError(_0x5c3c1a,null));};exports[_0x056d('0x56')]=function(_0x482c60,_0x3781a4,_0x21f6ff){var _0x2ad90f={};var _0x5a8433={};var _0x5b5459;var _0xd831e0;return db['FreshsalesConfiguration'][_0x056d('0x57')]({'where':{'id':_0x482c60[_0x056d('0x51')]['id']}})[_0x056d('0x33')](handleEntityNotFound(_0x3781a4,null))[_0x056d('0x33')](function(_0x4c3262){if(_0x4c3262){_0x5b5459=_0x4c3262;_0x5a8433[_0x056d('0x3c')]=_[_0x056d('0x58')](db[_0x056d('0x59')][_0x056d('0x38')]);_0x5a8433['query']=_[_0x056d('0x58')](_0x482c60[_0x056d('0x3d')]);_0x5a8433[_0x056d('0x3e')]=_[_0x056d('0x3f')](_0x5a8433[_0x056d('0x3c')],_0x5a8433[_0x056d('0x3d')]);_0x2ad90f[_0x056d('0x40')]=_[_0x056d('0x3f')](_0x5a8433[_0x056d('0x3c')],qs[_0x056d('0x41')](_0x482c60[_0x056d('0x3d')][_0x056d('0x41')]));_0x2ad90f[_0x056d('0x40')]=_0x2ad90f[_0x056d('0x40')][_0x056d('0x42')]?_0x2ad90f[_0x056d('0x40')]:_0x5a8433[_0x056d('0x3c')];_0x2ad90f[_0x056d('0x45')]=qs[_0x056d('0x46')](_0x482c60['query'][_0x056d('0x46')]);_0x2ad90f[_0x056d('0x47')]=qs[_0x056d('0x3e')](_['pick'](_0x482c60[_0x056d('0x3d')],_0x5a8433['filters']));if(_0x482c60['query']['filter']){_0x2ad90f[_0x056d('0x47')]=_[_0x056d('0x4b')](_0x2ad90f[_0x056d('0x47')],{'$or':_[_0x056d('0x5a')](_0x2ad90f['attributes'],function(_0x59804f){var _0x26950f={};_0x26950f[_0x59804f]={'$like':'%'+_0x482c60[_0x056d('0x3d')][_0x056d('0x49')]+'%'};return _0x26950f;})});}_0x2ad90f=_[_0x056d('0x4b')]({},_0x2ad90f,_0x482c60[_0x056d('0x5b')]);return _0x5b5459['getSubjects'](_0x2ad90f);}})[_0x056d('0x33')](function(_0x4538fd){if(_0x4538fd){_0xd831e0=_0x4538fd[_0x056d('0x42')];if(!_0x482c60[_0x056d('0x3d')][_0x056d('0x43')](_0x056d('0x44'))){_0x2ad90f[_0x056d('0x2c')]=qs[_0x056d('0x2c')](_0x482c60[_0x056d('0x3d')]['limit']);_0x2ad90f[_0x056d('0x2b')]=qs[_0x056d('0x2b')](_0x482c60[_0x056d('0x3d')]['offset']);}return _0x5b5459[_0x056d('0x56')](_0x2ad90f);}})[_0x056d('0x33')](function(_0x25b6b1){if(_0x25b6b1){return _0x25b6b1?{'count':_0xd831e0,'rows':_0x25b6b1}:null;}})[_0x056d('0x33')](respondWithResult(_0x3781a4,null))[_0x056d('0x4f')](handleError(_0x3781a4,null));};exports[_0x056d('0x5c')]=function(_0x4daf10,_0x44b7c4,_0xa041d7){var _0xb0b04b={};var _0x2a0915={};var _0x2e4b91;var _0x31ed68;return db[_0x056d('0x37')][_0x056d('0x57')]({'where':{'id':_0x4daf10[_0x056d('0x51')]['id']}})[_0x056d('0x33')](handleEntityNotFound(_0x44b7c4,null))[_0x056d('0x33')](function(_0x4a2cca){if(_0x4a2cca){_0x2e4b91=_0x4a2cca;_0x2a0915['model']=_[_0x056d('0x58')](db[_0x056d('0x59')][_0x056d('0x38')]);_0x2a0915['query']=_[_0x056d('0x58')](_0x4daf10[_0x056d('0x3d')]);_0x2a0915[_0x056d('0x3e')]=_[_0x056d('0x3f')](_0x2a0915[_0x056d('0x3c')],_0x2a0915[_0x056d('0x3d')]);_0xb0b04b[_0x056d('0x40')]=_[_0x056d('0x3f')](_0x2a0915['model'],qs[_0x056d('0x41')](_0x4daf10[_0x056d('0x3d')][_0x056d('0x41')]));_0xb0b04b['attributes']=_0xb0b04b[_0x056d('0x40')]['length']?_0xb0b04b[_0x056d('0x40')]:_0x2a0915[_0x056d('0x3c')];_0xb0b04b['order']=qs[_0x056d('0x46')](_0x4daf10[_0x056d('0x3d')][_0x056d('0x46')]);_0xb0b04b[_0x056d('0x47')]=qs[_0x056d('0x3e')](_[_0x056d('0x48')](_0x4daf10[_0x056d('0x3d')],_0x2a0915['filters']));if(_0x4daf10[_0x056d('0x3d')][_0x056d('0x49')]){_0xb0b04b['where']=_[_0x056d('0x4b')](_0xb0b04b[_0x056d('0x47')],{'$or':_[_0x056d('0x5a')](_0xb0b04b[_0x056d('0x40')],function(_0x2d5fb6){var _0x12e354={};_0x12e354[_0x2d5fb6]={'$like':'%'+_0x4daf10[_0x056d('0x3d')][_0x056d('0x49')]+'%'};return _0x12e354;})});}_0xb0b04b=_[_0x056d('0x4b')]({},_0xb0b04b,_0x4daf10['options']);return _0x2e4b91[_0x056d('0x5c')](_0xb0b04b);}})[_0x056d('0x33')](function(_0x472a7e){if(_0x472a7e){_0x31ed68=_0x472a7e['length'];if(!_0x4daf10[_0x056d('0x3d')][_0x056d('0x43')]('nolimit')){_0xb0b04b[_0x056d('0x2c')]=qs[_0x056d('0x2c')](_0x4daf10[_0x056d('0x3d')][_0x056d('0x2c')]);_0xb0b04b[_0x056d('0x2b')]=qs[_0x056d('0x2b')](_0x4daf10[_0x056d('0x3d')][_0x056d('0x2b')]);}return _0x2e4b91[_0x056d('0x5c')](_0xb0b04b);}})['then'](function(_0x18dd2e){if(_0x18dd2e){return _0x18dd2e?{'count':_0x31ed68,'rows':_0x18dd2e}:null;}})[_0x056d('0x33')](respondWithResult(_0x44b7c4,null))[_0x056d('0x4f')](handleError(_0x44b7c4,null));};exports['getFields']=function(_0x1fafd0,_0x19422e,_0x269ba7){var _0x3875c0={};var _0x39e0e4={};var _0x41af99;var _0x1dfe7d;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x1fafd0[_0x056d('0x51')]['id']}})[_0x056d('0x33')](handleEntityNotFound(_0x19422e,null))[_0x056d('0x33')](function(_0x3feb4c){if(_0x3feb4c){_0x41af99=_0x3feb4c;_0x39e0e4['model']=_['keys'](db[_0x056d('0x59')]['rawAttributes']);_0x39e0e4[_0x056d('0x3d')]=_['keys'](_0x1fafd0[_0x056d('0x3d')]);_0x39e0e4['filters']=_['intersection'](_0x39e0e4[_0x056d('0x3c')],_0x39e0e4[_0x056d('0x3d')]);_0x3875c0[_0x056d('0x40')]=_[_0x056d('0x3f')](_0x39e0e4[_0x056d('0x3c')],qs[_0x056d('0x41')](_0x1fafd0['query']['fields']));_0x3875c0['attributes']=_0x3875c0[_0x056d('0x40')]['length']?_0x3875c0[_0x056d('0x40')]:_0x39e0e4[_0x056d('0x3c')];_0x3875c0['order']=qs[_0x056d('0x46')](_0x1fafd0[_0x056d('0x3d')][_0x056d('0x46')]);_0x3875c0[_0x056d('0x47')]=qs[_0x056d('0x3e')](_['pick'](_0x1fafd0[_0x056d('0x3d')],_0x39e0e4[_0x056d('0x3e')]));if(_0x1fafd0[_0x056d('0x3d')]['filter']){_0x3875c0[_0x056d('0x47')]=_[_0x056d('0x4b')](_0x3875c0['where'],{'$or':_['map'](_0x3875c0[_0x056d('0x40')],function(_0x252956){var _0x1ad44f={};_0x1ad44f[_0x252956]={'$like':'%'+_0x1fafd0[_0x056d('0x3d')][_0x056d('0x49')]+'%'};return _0x1ad44f;})});}_0x3875c0=_[_0x056d('0x4b')]({},_0x3875c0,_0x1fafd0[_0x056d('0x5b')]);return _0x41af99[_0x056d('0x5d')](_0x3875c0);}})['then'](function(_0x471411){if(_0x471411){_0x1dfe7d=_0x471411['length'];if(!_0x1fafd0[_0x056d('0x3d')][_0x056d('0x43')](_0x056d('0x44'))){_0x3875c0[_0x056d('0x2c')]=qs[_0x056d('0x2c')](_0x1fafd0[_0x056d('0x3d')][_0x056d('0x2c')]);_0x3875c0[_0x056d('0x2b')]=qs['offset'](_0x1fafd0['query'][_0x056d('0x2b')]);}return _0x41af99[_0x056d('0x5d')](_0x3875c0);}})[_0x056d('0x33')](function(_0x3517c1){if(_0x3517c1){return _0x3517c1?{'count':_0x1dfe7d,'rows':_0x3517c1}:null;}})[_0x056d('0x33')](respondWithResult(_0x19422e,null))['catch'](handleError(_0x19422e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8318711..6d96148 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 _0x77e3=['api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x77e3,0x8d));var _0x377e=function(_0x54a56e,_0x2c330d){_0x54a56e=_0x54a56e-0x0;var _0x5e08db=_0x77e3[_0x54a56e];return _0x5e08db;};'use strict';var _=require('lodash');var util=require(_0x377e('0x0'));var logger=require(_0x377e('0x1'))(_0x377e('0x2'));var moment=require(_0x377e('0x3'));var BPromise=require(_0x377e('0x4'));var rp=require(_0x377e('0x5'));var fs=require('fs');var path=require(_0x377e('0x6'));var rimraf=require(_0x377e('0x7'));var config=require('../../config/environment');var attributes=require(_0x377e('0x8'));module[_0x377e('0x9')]=function(_0x2e4c1f,_0x3e1f56){return _0x2e4c1f[_0x377e('0xa')](_0x377e('0xb'),attributes,{'tableName':_0x377e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2142=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','int_freshsales_configurations','lodash'];(function(_0x4e759c,_0x4c5044){var _0x40776e=function(_0x299e25){while(--_0x299e25){_0x4e759c['push'](_0x4e759c['shift']());}};_0x40776e(++_0x4c5044);}(_0x2142,0x13f));var _0x2214=function(_0xde1b5,_0x291eca){_0xde1b5=_0xde1b5-0x0;var _0x52cd92=_0x2142[_0xde1b5];return _0x52cd92;};'use strict';var _=require(_0x2214('0x0'));var util=require(_0x2214('0x1'));var logger=require(_0x2214('0x2'))(_0x2214('0x3'));var moment=require(_0x2214('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2214('0x5'));var rimraf=require(_0x2214('0x6'));var config=require(_0x2214('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x143b08,_0x298036){return _0x143b08[_0x2214('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x2214('0x9'),'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 0de4fb3..8f7eb25 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 _0x3306=['then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x531476,_0x2e2f38){var _0xa559c7=function(_0x4483fd){while(--_0x4483fd){_0x531476['push'](_0x531476['shift']());}};_0xa559c7(++_0x2e2f38);}(_0x3306,0x107));var _0x6330=function(_0x207776,_0x58259e){_0x207776=_0x207776-0x0;var _0x1ebfb9=_0x3306[_0x207776];return _0x1ebfb9;};'use strict';var _=require(_0x6330('0x0'));var util=require(_0x6330('0x1'));var moment=require(_0x6330('0x2'));var BPromise=require(_0x6330('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6330('0x4'));var db=require(_0x6330('0x5'))['db'];var utils=require(_0x6330('0x6'));var logger=require(_0x6330('0x7'))(_0x6330('0x8'));var config=require('../../config/environment');var jayson=require(_0x6330('0x9'));var client=jayson[_0x6330('0xa')][_0x6330('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f164b,_0x27183c,_0x4561f7){return new BPromise(function(_0x274386,_0x3c8375){return client[_0x6330('0xc')](_0x1f164b,_0x4561f7)[_0x6330('0xd')](function(_0x554305){logger[_0x6330('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27183c,_0x6330('0xf'));logger[_0x6330('0x10')](_0x6330('0x11'),_0x27183c,_0x6330('0xf'),JSON[_0x6330('0x12')](_0x554305));if(_0x554305[_0x6330('0x13')]){if(_0x554305[_0x6330('0x13')][_0x6330('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x27183c,_0x554305[_0x6330('0x13')][_0x6330('0x15')]);return _0x3c8375(_0x554305[_0x6330('0x13')][_0x6330('0x15')]);}logger[_0x6330('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27183c,_0x554305[_0x6330('0x13')][_0x6330('0x15')]);return _0x274386(_0x554305[_0x6330('0x13')][_0x6330('0x15')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x27183c,_0x6330('0xf'));_0x274386(_0x554305[_0x6330('0x16')][_0x6330('0x15')]);}})['catch'](function(_0x32f1b3){logger[_0x6330('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27183c,_0x32f1b3);_0x3c8375(_0x32f1b3);});});} \ No newline at end of file +var _0xc4e6=['rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xc4e6[_0x25bca6];return _0x3f8d02;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var moment=require('moment');var BPromise=require(_0x6c4e('0x2'));var rs=require(_0x6c4e('0x3'));var fs=require('fs');var Redis=require(_0x6c4e('0x4'));var db=require(_0x6c4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c4e('0x6'))(_0x6c4e('0x7'));var config=require(_0x6c4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6c4e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56fec4,_0x3355f9,_0x394d8b){return new BPromise(function(_0xb0496a,_0x2f91ad){return client[_0x6c4e('0xa')](_0x56fec4,_0x394d8b)[_0x6c4e('0xb')](function(_0x58c1da){logger[_0x6c4e('0xc')](_0x6c4e('0xd'),_0x3355f9,_0x6c4e('0xe'));logger[_0x6c4e('0xf')](_0x6c4e('0x10'),_0x3355f9,'request\x20sent',JSON['stringify'](_0x58c1da));if(_0x58c1da[_0x6c4e('0x11')]){if(_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x12')]===0x1f4){logger['error'](_0x6c4e('0xd'),_0x3355f9,_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x13')]);return _0x2f91ad(_0x58c1da[_0x6c4e('0x11')]['message']);}logger[_0x6c4e('0x11')](_0x6c4e('0xd'),_0x3355f9,_0x58c1da[_0x6c4e('0x11')][_0x6c4e('0x13')]);return _0xb0496a(_0x58c1da[_0x6c4e('0x11')]['message']);}else{logger[_0x6c4e('0xc')](_0x6c4e('0xd'),_0x3355f9,_0x6c4e('0xe'));_0xb0496a(_0x58c1da['result']['message']);}})['catch'](function(_0x5e4e88){logger[_0x6c4e('0x11')](_0x6c4e('0xd'),_0x3355f9,_0x5e4e88);_0x2f91ad(_0x5e4e88);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ab0da73..38fa211 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 _0x6744=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0xe2eb7f,_0x5c6f67){var _0x20756c=function(_0x12bd6d){while(--_0x12bd6d){_0xe2eb7f['push'](_0xe2eb7f['shift']());}};_0x20756c(++_0x5c6f67);}(_0x6744,0x1c1));var _0x4674=function(_0x1590da,_0x2499a2){_0x1590da=_0x1590da-0x0;var _0x141c53=_0x6744[_0x1590da];return _0x141c53;};'use strict';var multer=require(_0x4674('0x0'));var util=require(_0x4674('0x1'));var path=require(_0x4674('0x2'));var timeout=require('connect-timeout');var express=require(_0x4674('0x3'));var router=express[_0x4674('0x4')]();var auth=require(_0x4674('0x5'));var interaction=require(_0x4674('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x4674('0x7')]('/',auth[_0x4674('0x8')](),controller[_0x4674('0x9')]);router['get'](_0x4674('0xa'),auth[_0x4674('0x8')](),controller['show']);router[_0x4674('0xb')]('/',auth['isAuthenticated'](),controller[_0x4674('0xc')]);router[_0x4674('0xd')]('/:id',auth[_0x4674('0x8')](),controller[_0x4674('0xe')]);router[_0x4674('0xf')](_0x4674('0xa'),auth[_0x4674('0x8')](),controller[_0x4674('0x10')]);module[_0x4674('0x11')]=router; \ No newline at end of file +var _0xb34f=['post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesField.controller','get','/:id','isAuthenticated','show'];(function(_0x3b2bb5,_0x315f28){var _0x5a7973=function(_0x51c96a){while(--_0x51c96a){_0x3b2bb5['push'](_0x3b2bb5['shift']());}};_0x5a7973(++_0x315f28);}(_0xb34f,0x1f3));var _0xfb34=function(_0x2fbf7d,_0x325ae6){_0x2fbf7d=_0x2fbf7d-0x0;var _0x49cb80=_0xb34f[_0x2fbf7d];return _0x49cb80;};'use strict';var multer=require(_0xfb34('0x0'));var util=require('util');var path=require(_0xfb34('0x1'));var timeout=require(_0xfb34('0x2'));var express=require(_0xfb34('0x3'));var router=express[_0xfb34('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb34('0x5'));var config=require('../../config/environment');var controller=require(_0xfb34('0x6'));router[_0xfb34('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfb34('0x8'),auth[_0xfb34('0x9')](),controller[_0xfb34('0xa')]);router[_0xfb34('0xb')]('/',auth['isAuthenticated'](),controller[_0xfb34('0xc')]);router[_0xfb34('0xd')](_0xfb34('0x8'),auth[_0xfb34('0x9')](),controller[_0xfb34('0xe')]);router['delete'](_0xfb34('0x8'),auth['isAuthenticated'](),controller[_0xfb34('0xf')]);module[_0xfb34('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9da34c1..3935e49 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 _0x6324=['ENUM','string','BOOLEAN','exports','variable','customVariable','keyValue','STRING'];(function(_0x49e723,_0x7d78de){var _0x424c2e=function(_0x389bf5){while(--_0x389bf5){_0x49e723['push'](_0x49e723['shift']());}};_0x424c2e(++_0x7d78de);}(_0x6324,0x13b));var _0x4632=function(_0x5c17d8,_0x51cc20){_0x5c17d8=_0x5c17d8-0x0;var _0x1841de=_0x6324[_0x5c17d8];return _0x1841de;};'use strict';var Sequelize=require('sequelize');module[_0x4632('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x4632('0x1'),_0x4632('0x2'),_0x4632('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4632('0x4')]},'key':{'type':Sequelize[_0x4632('0x4')]},'keyType':{'type':Sequelize[_0x4632('0x5')](_0x4632('0x6'),_0x4632('0x1'),_0x4632('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4632('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4632('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4632('0x4')]}}; \ No newline at end of file +var _0x77fa=['variable','keyValue','string','STRING','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x1f5b94,_0x431e6d){var _0x5bf571=function(_0x895379){while(--_0x895379){_0x1f5b94['push'](_0x1f5b94['shift']());}};_0x5bf571(++_0x431e6d);}(_0x77fa,0x1ee));var _0xa77f=function(_0x322d50,_0x4f990e){_0x322d50=_0x322d50-0x0;var _0x41a0f1=_0x77fa[_0x322d50];return _0x41a0f1;};'use strict';var Sequelize=require(_0xa77f('0x0'));module['exports']={'type':{'type':Sequelize[_0xa77f('0x1')]('string',_0xa77f('0x2'),'customVariable',_0xa77f('0x3')),'defaultValue':_0xa77f('0x4')},'content':{'type':Sequelize[_0xa77f('0x5')]},'key':{'type':Sequelize[_0xa77f('0x5')]},'keyType':{'type':Sequelize[_0xa77f('0x1')](_0xa77f('0x4'),_0xa77f('0x2'),_0xa77f('0x6'))},'keyContent':{'type':Sequelize[_0xa77f('0x5')]},'idField':{'type':Sequelize[_0xa77f('0x5')]},'nameField':{'type':Sequelize[_0xa77f('0x5')]},'customField':{'type':Sequelize[_0xa77f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 9cf6e4f..b8cffb6 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 _0x23b3=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','set','Content-Range','apply','reject','then','end','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','find','create','body','update','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x3ad712,_0x3d58a6){var _0x4e888d=function(_0x526f58){while(--_0x526f58){_0x3ad712['push'](_0x3ad712['shift']());}};_0x4e888d(++_0x3d58a6);}(_0x23b3,0x1ac));var _0x323b=function(_0x3369c5,_0xce66ba){_0x3369c5=_0x3369c5-0x0;var _0x10fae9=_0x23b3[_0x3369c5];return _0x10fae9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x323b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x323b('0x1'));var rp=require('request-promise');var moment=require(_0x323b('0x2'));var BPromise=require(_0x323b('0x3'));var Mustache=require(_0x323b('0x4'));var util=require(_0x323b('0x5'));var path=require(_0x323b('0x6'));var sox=require(_0x323b('0x7'));var csv=require(_0x323b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x323b('0x9'));var squel=require(_0x323b('0xa'));var crypto=require(_0x323b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x323b('0xc'));var toCsv=require(_0x323b('0x8'));var querystring=require(_0x323b('0xd'));var Papa=require(_0x323b('0xe'));var Redis=require(_0x323b('0xf'));var authService=require(_0x323b('0x10'));var qs=require(_0x323b('0x11'));var as=require(_0x323b('0x12'));var hardwareService=require(_0x323b('0x13'));var logger=require(_0x323b('0x14'))(_0x323b('0x15'));var utils=require(_0x323b('0x16'));var config=require(_0x323b('0x17'));var db=require(_0x323b('0x18'))['db'];function respondWithStatusCode(_0x4e24b8,_0x27e9fb){_0x27e9fb=_0x27e9fb||0xcc;return function(_0x2c9205){if(_0x2c9205){return _0x4e24b8[_0x323b('0x19')](_0x27e9fb);}return _0x4e24b8['status'](_0x27e9fb)['end']();};}function respondWithResult(_0x55385c,_0xedca4){_0xedca4=_0xedca4||0xc8;return function(_0x5a807d){if(_0x5a807d){return _0x55385c[_0x323b('0x1a')](_0xedca4)[_0x323b('0x1b')](_0x5a807d);}};}function respondWithFilteredResult(_0x395d04,_0x2919cc){return function(_0x3cd0f2){if(_0x3cd0f2){var _0x21f187=_0x3cd0f2['count'],_0x4164b4=_0x2919cc['offset'],_0x18c83f=_0x2919cc['offset']+_0x2919cc['limit'],_0x16ee84;if(_0x18c83f>=_0x21f187){_0x18c83f=_0x21f187;_0x16ee84=0xc8;}else{_0x16ee84=0xce;}_0x395d04['status'](_0x16ee84);return _0x395d04[_0x323b('0x1c')](_0x323b('0x1d'),_0x4164b4+'-'+_0x18c83f+'/'+_0x21f187)[_0x323b('0x1b')](_0x3cd0f2);}return null;};}function patchUpdates(_0x318ac7){return function(_0x348160){try{jsonpatch[_0x323b('0x1e')](_0x348160,_0x318ac7,!![]);}catch(_0x5ce60e){return BPromise[_0x323b('0x1f')](_0x5ce60e);}return _0x348160['save']();};}function saveUpdates(_0x2d52fb,_0x864905){return function(_0x46d8d9){if(_0x46d8d9){return _0x46d8d9['update'](_0x2d52fb)[_0x323b('0x20')](function(_0x3824e2){return _0x3824e2;});}return null;};}function removeEntity(_0x10398d,_0x26f221){return function(_0x388a4a){if(_0x388a4a){return _0x388a4a['destroy']()[_0x323b('0x20')](function(){_0x10398d['status'](0xcc)[_0x323b('0x21')]();});}};}function handleEntityNotFound(_0x2b8baf,_0x58b8d8){return function(_0x261e7d){if(!_0x261e7d){_0x2b8baf[_0x323b('0x19')](0x194);}return _0x261e7d;};}function handleError(_0x1da0f1,_0x1f005b){_0x1f005b=_0x1f005b||0x1f4;return function(_0x241f72){logger[_0x323b('0x22')](_0x241f72[_0x323b('0x23')]);if(_0x241f72['name']){delete _0x241f72[_0x323b('0x24')];}_0x1da0f1[_0x323b('0x1a')](_0x1f005b)['send'](_0x241f72);};}exports[_0x323b('0x25')]=function(_0x4cbb7a,_0x2fe46b){var _0x597c32={},_0x4aba08={},_0x118502={'count':0x0,'rows':[]};var _0x350642=_[_0x323b('0x26')](db[_0x323b('0x27')][_0x323b('0x28')],function(_0x4fa991){return{'name':_0x4fa991[_0x323b('0x29')],'type':_0x4fa991[_0x323b('0x2a')][_0x323b('0x2b')]};});_0x4aba08[_0x323b('0x2c')]=_['map'](_0x350642,'name');_0x4aba08[_0x323b('0x2d')]=_[_0x323b('0x2e')](_0x4cbb7a[_0x323b('0x2d')]);_0x4aba08[_0x323b('0x2f')]=_[_0x323b('0x30')](_0x4aba08[_0x323b('0x2c')],_0x4aba08[_0x323b('0x2d')]);_0x597c32[_0x323b('0x31')]=_['intersection'](_0x4aba08[_0x323b('0x2c')],qs[_0x323b('0x32')](_0x4cbb7a[_0x323b('0x2d')][_0x323b('0x32')]));_0x597c32[_0x323b('0x31')]=_0x597c32[_0x323b('0x31')][_0x323b('0x33')]?_0x597c32['attributes']:_0x4aba08['model'];if(!_0x4cbb7a[_0x323b('0x2d')][_0x323b('0x34')](_0x323b('0x35'))){_0x597c32[_0x323b('0x36')]=qs[_0x323b('0x36')](_0x4cbb7a[_0x323b('0x2d')]['limit']);_0x597c32[_0x323b('0x37')]=qs[_0x323b('0x37')](_0x4cbb7a[_0x323b('0x2d')][_0x323b('0x37')]);}_0x597c32['order']=qs['sort'](_0x4cbb7a['query'][_0x323b('0x38')]);_0x597c32['where']=qs[_0x323b('0x2f')](_[_0x323b('0x39')](_0x4cbb7a['query'],_0x4aba08[_0x323b('0x2f')]),_0x350642);if(_0x4cbb7a[_0x323b('0x2d')][_0x323b('0x3a')]){_0x597c32[_0x323b('0x3b')]=_[_0x323b('0x3c')](_0x597c32['where'],{'$or':_[_0x323b('0x26')](_0x350642,function(_0x361d82){if(_0x361d82[_0x323b('0x2a')]!==_0x323b('0x3d')){var _0x5565f8={};_0x5565f8[_0x361d82['name']]={'$like':'%'+_0x4cbb7a[_0x323b('0x2d')]['filter']+'%'};return _0x5565f8;}})});}_0x597c32=_[_0x323b('0x3c')]({},_0x597c32,_0x4cbb7a[_0x323b('0x3e')]);var _0x16c00f={'where':_0x597c32[_0x323b('0x3b')]};return db['FreshsalesField'][_0x323b('0x3f')](_0x16c00f)[_0x323b('0x20')](function(_0x2d14ee){_0x118502[_0x323b('0x3f')]=_0x2d14ee;if(_0x4cbb7a[_0x323b('0x2d')]['includeAll']){_0x597c32[_0x323b('0x40')]=[{'all':!![]}];}return db[_0x323b('0x27')][_0x323b('0x41')](_0x597c32);})[_0x323b('0x20')](function(_0x312191){_0x118502[_0x323b('0x42')]=_0x312191;return _0x118502;})['then'](respondWithFilteredResult(_0x2fe46b,_0x597c32))[_0x323b('0x43')](handleError(_0x2fe46b,null));};exports['show']=function(_0x403e0c,_0x593c0e){var _0x9b1f9a={'raw':!![],'where':{'id':_0x403e0c[_0x323b('0x44')]['id']}},_0x257b9b={};_0x257b9b[_0x323b('0x2c')]=_['keys'](db[_0x323b('0x27')][_0x323b('0x28')]);_0x257b9b[_0x323b('0x2d')]=_['keys'](_0x403e0c[_0x323b('0x2d')]);_0x257b9b[_0x323b('0x2f')]=_[_0x323b('0x30')](_0x257b9b[_0x323b('0x2c')],_0x257b9b[_0x323b('0x2d')]);_0x9b1f9a[_0x323b('0x31')]=_[_0x323b('0x30')](_0x257b9b[_0x323b('0x2c')],qs[_0x323b('0x32')](_0x403e0c[_0x323b('0x2d')][_0x323b('0x32')]));_0x9b1f9a[_0x323b('0x31')]=_0x9b1f9a[_0x323b('0x31')][_0x323b('0x33')]?_0x9b1f9a['attributes']:_0x257b9b[_0x323b('0x2c')];if(_0x403e0c[_0x323b('0x2d')]['includeAll']){_0x9b1f9a[_0x323b('0x40')]=[{'all':!![]}];}_0x9b1f9a=_['merge']({},_0x9b1f9a,_0x403e0c[_0x323b('0x3e')]);return db[_0x323b('0x27')][_0x323b('0x45')](_0x9b1f9a)['then'](handleEntityNotFound(_0x593c0e,null))['then'](respondWithResult(_0x593c0e,null))['catch'](handleError(_0x593c0e,null));};exports['create']=function(_0x20ad0b,_0x1cc94b){return db['FreshsalesField'][_0x323b('0x46')](_0x20ad0b[_0x323b('0x47')],{})['then'](respondWithResult(_0x1cc94b,0xc9))['catch'](handleError(_0x1cc94b,null));};exports[_0x323b('0x48')]=function(_0x421af2,_0x2f4fb7){if(_0x421af2['body']['id']){delete _0x421af2[_0x323b('0x47')]['id'];}return db[_0x323b('0x27')][_0x323b('0x45')]({'where':{'id':_0x421af2[_0x323b('0x44')]['id']}})[_0x323b('0x20')](handleEntityNotFound(_0x2f4fb7,null))[_0x323b('0x20')](saveUpdates(_0x421af2[_0x323b('0x47')],null))[_0x323b('0x20')](respondWithResult(_0x2f4fb7,null))[_0x323b('0x43')](handleError(_0x2f4fb7,null));};exports['destroy']=function(_0x4232cd,_0x79c015){return db[_0x323b('0x27')][_0x323b('0x45')]({'where':{'id':_0x4232cd[_0x323b('0x44')]['id']}})[_0x323b('0x20')](handleEntityNotFound(_0x79c015,null))[_0x323b('0x20')](removeEntity(_0x79c015,null))[_0x323b('0x43')](handleError(_0x79c015,null));}; \ No newline at end of file +var _0xf9dc=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','params','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto','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','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','index','FreshsalesField','rawAttributes','fieldName','type','model','map','name','query','keys','filters','attributes','intersection'];(function(_0x2f085c,_0x1811c3){var _0x1a5921=function(_0x175539){while(--_0x175539){_0x2f085c['push'](_0x2f085c['shift']());}};_0x1a5921(++_0x1811c3);}(_0xf9dc,0x9e));var _0xcf9d=function(_0x5f4777,_0x1df9ba){_0x5f4777=_0x5f4777-0x0;var _0x187998=_0xf9dc[_0x5f4777];return _0x187998;};'use strict';var pdf=require(_0xcf9d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcf9d('0x1'));var zipdir=require(_0xcf9d('0x2'));var jsonpatch=require(_0xcf9d('0x3'));var rp=require(_0xcf9d('0x4'));var moment=require('moment');var BPromise=require(_0xcf9d('0x5'));var Mustache=require(_0xcf9d('0x6'));var util=require(_0xcf9d('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf9d('0x8'));var squel=require(_0xcf9d('0x9'));var crypto=require(_0xcf9d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcf9d('0xb'));var toCsv=require(_0xcf9d('0xc'));var querystring=require(_0xcf9d('0xd'));var Papa=require(_0xcf9d('0xe'));var Redis=require(_0xcf9d('0xf'));var authService=require(_0xcf9d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcf9d('0x11'));var hardwareService=require(_0xcf9d('0x12'));var logger=require(_0xcf9d('0x13'))(_0xcf9d('0x14'));var utils=require(_0xcf9d('0x15'));var config=require(_0xcf9d('0x16'));var db=require(_0xcf9d('0x17'))['db'];function respondWithStatusCode(_0x5d66ac,_0x5b5620){_0x5b5620=_0x5b5620||0xcc;return function(_0x2e8c61){if(_0x2e8c61){return _0x5d66ac[_0xcf9d('0x18')](_0x5b5620);}return _0x5d66ac[_0xcf9d('0x19')](_0x5b5620)[_0xcf9d('0x1a')]();};}function respondWithResult(_0x1494ab,_0x3c27a6){_0x3c27a6=_0x3c27a6||0xc8;return function(_0x5a9cc7){if(_0x5a9cc7){return _0x1494ab[_0xcf9d('0x19')](_0x3c27a6)[_0xcf9d('0x1b')](_0x5a9cc7);}};}function respondWithFilteredResult(_0x30aacf,_0x483367){return function(_0x3a80d0){if(_0x3a80d0){var _0x3e10d0=_0x3a80d0['count'],_0x16d102=_0x483367[_0xcf9d('0x1c')],_0x16cfe0=_0x483367[_0xcf9d('0x1c')]+_0x483367[_0xcf9d('0x1d')],_0x5c2b55;if(_0x16cfe0>=_0x3e10d0){_0x16cfe0=_0x3e10d0;_0x5c2b55=0xc8;}else{_0x5c2b55=0xce;}_0x30aacf[_0xcf9d('0x19')](_0x5c2b55);return _0x30aacf[_0xcf9d('0x1e')]('Content-Range',_0x16d102+'-'+_0x16cfe0+'/'+_0x3e10d0)[_0xcf9d('0x1b')](_0x3a80d0);}return null;};}function patchUpdates(_0x5203f9){return function(_0x35cad8){try{jsonpatch[_0xcf9d('0x1f')](_0x35cad8,_0x5203f9,!![]);}catch(_0xa7a62c){return BPromise[_0xcf9d('0x20')](_0xa7a62c);}return _0x35cad8[_0xcf9d('0x21')]();};}function saveUpdates(_0x5b7e27,_0x744718){return function(_0x467c71){if(_0x467c71){return _0x467c71[_0xcf9d('0x22')](_0x5b7e27)[_0xcf9d('0x23')](function(_0x4da886){return _0x4da886;});}return null;};}function removeEntity(_0x3ceb41,_0x271f72){return function(_0x1ccef7){if(_0x1ccef7){return _0x1ccef7[_0xcf9d('0x24')]()[_0xcf9d('0x23')](function(){_0x3ceb41[_0xcf9d('0x19')](0xcc)[_0xcf9d('0x1a')]();});}};}function handleEntityNotFound(_0x3e4d9c,_0x53dd55){return function(_0xf1c854){if(!_0xf1c854){_0x3e4d9c[_0xcf9d('0x18')](0x194);}return _0xf1c854;};}function handleError(_0x54eb20,_0x320ff6){_0x320ff6=_0x320ff6||0x1f4;return function(_0x4894d1){logger[_0xcf9d('0x25')](_0x4894d1[_0xcf9d('0x26')]);if(_0x4894d1['name']){delete _0x4894d1['name'];}_0x54eb20[_0xcf9d('0x19')](_0x320ff6)['send'](_0x4894d1);};}exports[_0xcf9d('0x27')]=function(_0x178562,_0x1cfb3a){var _0x57c0e9={},_0x4d2301={},_0x432b3c={'count':0x0,'rows':[]};var _0x3b2836=_['map'](db[_0xcf9d('0x28')][_0xcf9d('0x29')],function(_0x4ae75e){return{'name':_0x4ae75e[_0xcf9d('0x2a')],'type':_0x4ae75e[_0xcf9d('0x2b')]['key']};});_0x4d2301[_0xcf9d('0x2c')]=_[_0xcf9d('0x2d')](_0x3b2836,_0xcf9d('0x2e'));_0x4d2301[_0xcf9d('0x2f')]=_[_0xcf9d('0x30')](_0x178562[_0xcf9d('0x2f')]);_0x4d2301[_0xcf9d('0x31')]=_['intersection'](_0x4d2301[_0xcf9d('0x2c')],_0x4d2301[_0xcf9d('0x2f')]);_0x57c0e9[_0xcf9d('0x32')]=_[_0xcf9d('0x33')](_0x4d2301[_0xcf9d('0x2c')],qs['fields'](_0x178562['query'][_0xcf9d('0x34')]));_0x57c0e9[_0xcf9d('0x32')]=_0x57c0e9[_0xcf9d('0x32')][_0xcf9d('0x35')]?_0x57c0e9[_0xcf9d('0x32')]:_0x4d2301[_0xcf9d('0x2c')];if(!_0x178562[_0xcf9d('0x2f')][_0xcf9d('0x36')](_0xcf9d('0x37'))){_0x57c0e9[_0xcf9d('0x1d')]=qs[_0xcf9d('0x1d')](_0x178562[_0xcf9d('0x2f')]['limit']);_0x57c0e9[_0xcf9d('0x1c')]=qs[_0xcf9d('0x1c')](_0x178562[_0xcf9d('0x2f')][_0xcf9d('0x1c')]);}_0x57c0e9['order']=qs['sort'](_0x178562['query'][_0xcf9d('0x38')]);_0x57c0e9[_0xcf9d('0x39')]=qs['filters'](_[_0xcf9d('0x3a')](_0x178562['query'],_0x4d2301[_0xcf9d('0x31')]),_0x3b2836);if(_0x178562[_0xcf9d('0x2f')][_0xcf9d('0x3b')]){_0x57c0e9[_0xcf9d('0x39')]=_[_0xcf9d('0x3c')](_0x57c0e9[_0xcf9d('0x39')],{'$or':_[_0xcf9d('0x2d')](_0x3b2836,function(_0x2c2dd4){if(_0x2c2dd4[_0xcf9d('0x2b')]!==_0xcf9d('0x3d')){var _0x2f41f2={};_0x2f41f2[_0x2c2dd4[_0xcf9d('0x2e')]]={'$like':'%'+_0x178562[_0xcf9d('0x2f')][_0xcf9d('0x3b')]+'%'};return _0x2f41f2;}})});}_0x57c0e9=_['merge']({},_0x57c0e9,_0x178562[_0xcf9d('0x3e')]);var _0x3fce18={'where':_0x57c0e9['where']};return db[_0xcf9d('0x28')][_0xcf9d('0x3f')](_0x3fce18)[_0xcf9d('0x23')](function(_0x1f60e4){_0x432b3c['count']=_0x1f60e4;if(_0x178562[_0xcf9d('0x2f')]['includeAll']){_0x57c0e9['include']=[{'all':!![]}];}return db[_0xcf9d('0x28')][_0xcf9d('0x40')](_0x57c0e9);})[_0xcf9d('0x23')](function(_0x2c4720){_0x432b3c['rows']=_0x2c4720;return _0x432b3c;})[_0xcf9d('0x23')](respondWithFilteredResult(_0x1cfb3a,_0x57c0e9))['catch'](handleError(_0x1cfb3a,null));};exports['show']=function(_0x4c7fce,_0x2e6b3c){var _0x311ecf={'raw':!![],'where':{'id':_0x4c7fce[_0xcf9d('0x41')]['id']}},_0x1e30da={};_0x1e30da[_0xcf9d('0x2c')]=_[_0xcf9d('0x30')](db[_0xcf9d('0x28')][_0xcf9d('0x29')]);_0x1e30da[_0xcf9d('0x2f')]=_['keys'](_0x4c7fce['query']);_0x1e30da[_0xcf9d('0x31')]=_[_0xcf9d('0x33')](_0x1e30da[_0xcf9d('0x2c')],_0x1e30da[_0xcf9d('0x2f')]);_0x311ecf[_0xcf9d('0x32')]=_[_0xcf9d('0x33')](_0x1e30da[_0xcf9d('0x2c')],qs[_0xcf9d('0x34')](_0x4c7fce[_0xcf9d('0x2f')][_0xcf9d('0x34')]));_0x311ecf[_0xcf9d('0x32')]=_0x311ecf[_0xcf9d('0x32')]['length']?_0x311ecf[_0xcf9d('0x32')]:_0x1e30da[_0xcf9d('0x2c')];if(_0x4c7fce[_0xcf9d('0x2f')]['includeAll']){_0x311ecf['include']=[{'all':!![]}];}_0x311ecf=_[_0xcf9d('0x3c')]({},_0x311ecf,_0x4c7fce[_0xcf9d('0x3e')]);return db[_0xcf9d('0x28')][_0xcf9d('0x42')](_0x311ecf)[_0xcf9d('0x23')](handleEntityNotFound(_0x2e6b3c,null))[_0xcf9d('0x23')](respondWithResult(_0x2e6b3c,null))[_0xcf9d('0x43')](handleError(_0x2e6b3c,null));};exports['create']=function(_0x580f8a,_0x8f35d3){return db[_0xcf9d('0x28')][_0xcf9d('0x44')](_0x580f8a[_0xcf9d('0x45')],{})[_0xcf9d('0x23')](respondWithResult(_0x8f35d3,0xc9))[_0xcf9d('0x43')](handleError(_0x8f35d3,null));};exports[_0xcf9d('0x22')]=function(_0x40a78d,_0x5b93f6){if(_0x40a78d[_0xcf9d('0x45')]['id']){delete _0x40a78d[_0xcf9d('0x45')]['id'];}return db[_0xcf9d('0x28')][_0xcf9d('0x42')]({'where':{'id':_0x40a78d[_0xcf9d('0x41')]['id']}})[_0xcf9d('0x23')](handleEntityNotFound(_0x5b93f6,null))[_0xcf9d('0x23')](saveUpdates(_0x40a78d[_0xcf9d('0x45')],null))[_0xcf9d('0x23')](respondWithResult(_0x5b93f6,null))['catch'](handleError(_0x5b93f6,null));};exports[_0xcf9d('0x24')]=function(_0x5715bd,_0x3d5cbf){return db[_0xcf9d('0x28')]['find']({'where':{'id':_0x5715bd[_0xcf9d('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d5cbf,null))[_0xcf9d('0x23')](removeEntity(_0x3d5cbf,null))['catch'](handleError(_0x3d5cbf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1c1734e..0f606d7 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 _0x3531=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2a40a9,_0x2a8ddc){var _0x4dd747=function(_0x29239a){while(--_0x29239a){_0x2a40a9['push'](_0x2a40a9['shift']());}};_0x4dd747(++_0x2a8ddc);}(_0x3531,0x1b8));var _0x1353=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3531[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x1353('0x0'));var util=require(_0x1353('0x1'));var logger=require(_0x1353('0x2'))(_0x1353('0x3'));var moment=require(_0x1353('0x4'));var BPromise=require(_0x1353('0x5'));var rp=require(_0x1353('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1353('0x7'));var config=require(_0x1353('0x8'));var attributes=require(_0x1353('0x9'));module[_0x1353('0xa')]=function(_0x13ed33,_0x6edcd0){return _0x13ed33[_0x1353('0xb')](_0x1353('0xc'),attributes,{'tableName':_0x1353('0xd'),'paranoid':![],'indexes':[{'name':_0x1353('0xe'),'fields':[_0x1353('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86bc=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','util','../../config/logger','api','bluebird'];(function(_0x3f38b4,_0x5b8ecc){var _0x10e2d8=function(_0x4512b8){while(--_0x4512b8){_0x3f38b4['push'](_0x3f38b4['shift']());}};_0x10e2d8(++_0x5b8ecc);}(_0x86bc,0x168));var _0xc86b=function(_0x3e66e0,_0x20335c){_0x3e66e0=_0x3e66e0-0x0;var _0x225641=_0x86bc[_0x3e66e0];return _0x225641;};'use strict';var _=require('lodash');var util=require(_0xc86b('0x0'));var logger=require(_0xc86b('0x1'))(_0xc86b('0x2'));var moment=require('moment');var BPromise=require(_0xc86b('0x3'));var rp=require(_0xc86b('0x4'));var fs=require('fs');var path=require(_0xc86b('0x5'));var rimraf=require(_0xc86b('0x6'));var config=require(_0xc86b('0x7'));var attributes=require(_0xc86b('0x8'));module[_0xc86b('0x9')]=function(_0x40f035,_0x342689){return _0x40f035['define'](_0xc86b('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xc86b('0xb'),'fields':[_0xc86b('0xc'),_0xc86b('0xd')],'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 4f19b8a..50a4774 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 _0x111b=['../../mysqldb','../../config/logger','../../config/environment','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x111b,0x1ee));var _0xb111=function(_0x335407,_0x53d150){_0x335407=_0x335407-0x0;var _0x76e61a=_0x111b[_0x335407];return _0x76e61a;};'use strict';var _=require(_0xb111('0x0'));var util=require(_0xb111('0x1'));var moment=require(_0xb111('0x2'));var BPromise=require(_0xb111('0x3'));var rs=require(_0xb111('0x4'));var fs=require('fs');var Redis=require(_0xb111('0x5'));var db=require(_0xb111('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb111('0x7'))('rpc');var config=require(_0xb111('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb111('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5320b3,_0x535922,_0x10c202){return new BPromise(function(_0x594e44,_0x4ddc17){return client[_0xb111('0xa')](_0x5320b3,_0x10c202)['then'](function(_0x5c78b3){logger[_0xb111('0xb')](_0xb111('0xc'),_0x535922,'request\x20sent');logger[_0xb111('0xd')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x535922,_0xb111('0xe'),JSON['stringify'](_0x5c78b3));if(_0x5c78b3[_0xb111('0xf')]){if(_0x5c78b3[_0xb111('0xf')][_0xb111('0x10')]===0x1f4){logger['error'](_0xb111('0xc'),_0x535922,_0x5c78b3['error'][_0xb111('0x11')]);return _0x4ddc17(_0x5c78b3[_0xb111('0xf')]['message']);}logger[_0xb111('0xf')](_0xb111('0xc'),_0x535922,_0x5c78b3[_0xb111('0xf')][_0xb111('0x11')]);return _0x594e44(_0x5c78b3[_0xb111('0xf')][_0xb111('0x11')]);}else{logger[_0xb111('0xb')](_0xb111('0xc'),_0x535922,'request\x20sent');_0x594e44(_0x5c78b3[_0xb111('0x12')][_0xb111('0x11')]);}})[_0xb111('0x13')](function(_0x40ecb6){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x535922,_0x40ecb6);_0x4ddc17(_0x40ecb6);});});} \ No newline at end of file +var _0x8b0f=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','FreshsalesField,\x20%s,\x20%s'];(function(_0x414584,_0x1a1da6){var _0x50b255=function(_0x3ae5ce){while(--_0x3ae5ce){_0x414584['push'](_0x414584['shift']());}};_0x50b255(++_0x1a1da6);}(_0x8b0f,0x191));var _0xf8b0=function(_0x440094,_0xde284d){_0x440094=_0x440094-0x0;var _0x2083f5=_0x8b0f[_0x440094];return _0x2083f5;};'use strict';var _=require(_0xf8b0('0x0'));var util=require('util');var moment=require(_0xf8b0('0x1'));var BPromise=require(_0xf8b0('0x2'));var rs=require(_0xf8b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8b0('0x4'))['db'];var utils=require(_0xf8b0('0x5'));var logger=require('../../config/logger')(_0xf8b0('0x6'));var config=require(_0xf8b0('0x7'));var jayson=require(_0xf8b0('0x8'));var client=jayson[_0xf8b0('0x9')][_0xf8b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30e87f,_0x5c14e8,_0x2e3248){return new BPromise(function(_0x5c43e0,_0x552766){return client[_0xf8b0('0xb')](_0x30e87f,_0x2e3248)['then'](function(_0xf5233b){logger[_0xf8b0('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x5c14e8,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5c14e8,_0xf8b0('0xd'),JSON[_0xf8b0('0xe')](_0xf5233b));if(_0xf5233b[_0xf8b0('0xf')]){if(_0xf5233b[_0xf8b0('0xf')]['code']===0x1f4){logger[_0xf8b0('0xf')](_0xf8b0('0x10'),_0x5c14e8,_0xf5233b['error'][_0xf8b0('0x11')]);return _0x552766(_0xf5233b[_0xf8b0('0xf')][_0xf8b0('0x11')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x5c14e8,_0xf5233b[_0xf8b0('0xf')][_0xf8b0('0x11')]);return _0x5c43e0(_0xf5233b[_0xf8b0('0xf')][_0xf8b0('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x5c14e8,_0xf8b0('0xd'));_0x5c43e0(_0xf5233b[_0xf8b0('0x12')]['message']);}})['catch'](function(_0x2e7ea1){logger[_0xf8b0('0xf')](_0xf8b0('0x10'),_0x5c14e8,_0x2e7ea1);_0x552766(_0x2e7ea1);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 976408b..fa932b9 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 _0xf725=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x52641d,_0x29827d){var _0x102971=function(_0x1b4215){while(--_0x1b4215){_0x52641d['push'](_0x52641d['shift']());}};_0x102971(++_0x29827d);}(_0xf725,0x7e));var _0x5f72=function(_0x3770a3,_0x448960){_0x3770a3=_0x3770a3-0x0;var _0x4bbad1=_0xf725[_0x3770a3];return _0x4bbad1;};'use strict';var multer=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var path=require(_0x5f72('0x2'));var timeout=require(_0x5f72('0x3'));var express=require(_0x5f72('0x4'));var router=express[_0x5f72('0x5')]();var auth=require(_0x5f72('0x6'));var interaction=require(_0x5f72('0x7'));var config=require(_0x5f72('0x8'));var controller=require(_0x5f72('0x9'));router['get']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0xb')]);router[_0x5f72('0xc')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller[_0x5f72('0xe')]);router[_0x5f72('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f72('0xf')]);router[_0x5f72('0xc')]('/:id/fields',auth[_0x5f72('0xa')](),controller[_0x5f72('0x10')]);router['post']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0x11')]);router[_0x5f72('0x12')](_0x5f72('0x13'),auth[_0x5f72('0xa')](),controller[_0x5f72('0x14')]);router[_0x5f72('0x15')]('/:id',auth[_0x5f72('0xa')](),controller[_0x5f72('0x16')]);router[_0x5f72('0x17')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller['destroy']);module[_0x5f72('0x18')]=router; \ No newline at end of file +var _0xd0e3=['post','create','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xe5be12,_0x6be4b4){var _0x399409=function(_0x67f8){while(--_0x67f8){_0xe5be12['push'](_0xe5be12['shift']());}};_0x399409(++_0x6be4b4);}(_0xd0e3,0xd6));var _0x3d0e=function(_0x3c5953,_0x3887b4){_0x3c5953=_0x3c5953-0x0;var _0x3b0de6=_0xd0e3[_0x3c5953];return _0x3b0de6;};'use strict';var multer=require(_0x3d0e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d0e('0x1'));var express=require(_0x3d0e('0x2'));var router=express[_0x3d0e('0x3')]();var auth=require(_0x3d0e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d0e('0x5'));var controller=require(_0x3d0e('0x6'));router['get']('/',auth[_0x3d0e('0x7')](),controller[_0x3d0e('0x8')]);router[_0x3d0e('0x9')](_0x3d0e('0xa'),auth[_0x3d0e('0x7')](),controller[_0x3d0e('0xb')]);router[_0x3d0e('0x9')](_0x3d0e('0xc'),auth[_0x3d0e('0x7')](),controller[_0x3d0e('0xd')]);router[_0x3d0e('0x9')](_0x3d0e('0xe'),auth[_0x3d0e('0x7')](),controller[_0x3d0e('0xf')]);router[_0x3d0e('0x10')]('/',auth[_0x3d0e('0x7')](),controller[_0x3d0e('0x11')]);router[_0x3d0e('0x10')](_0x3d0e('0xc'),auth[_0x3d0e('0x7')](),controller[_0x3d0e('0x12')]);router[_0x3d0e('0x13')]('/:id',auth[_0x3d0e('0x7')](),controller['update']);router[_0x3d0e('0x14')](_0x3d0e('0xa'),auth['isAuthenticated'](),controller[_0x3d0e('0x15')]);module[_0x3d0e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 71dc0fc..3a8ba2c 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 _0x7fbe=['integrationTab','newTab','STRING','username','ENUM'];(function(_0x5bb297,_0x132957){var _0x533f63=function(_0xa93b76){while(--_0xa93b76){_0x5bb297['push'](_0x5bb297['shift']());}};_0x533f63(++_0x132957);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x92a3d9,_0xcf3970){_0x92a3d9=_0x92a3d9-0x0;var _0x56458b=_0x7fbe[_0x92a3d9];return _0x56458b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'username':{'type':Sequelize[_0xe7fb('0x0')],'unique':_0xe7fb('0x1')},'remoteUri':{'type':Sequelize[_0xe7fb('0x0')]},'password':{'type':Sequelize[_0xe7fb('0x0')]},'clientId':{'type':Sequelize[_0xe7fb('0x0')]},'clientSecret':{'type':Sequelize[_0xe7fb('0x0')]},'securityToken':{'type':Sequelize[_0xe7fb('0x0')]},'serverUrl':{'type':Sequelize[_0xe7fb('0x0')]},'type':{'type':Sequelize[_0xe7fb('0x2')](_0xe7fb('0x3'),_0xe7fb('0x4')),'defaultValue':_0xe7fb('0x3')}}; \ No newline at end of file +var _0x1261=['STRING','username','integrationTab','newTab','exports'];(function(_0x5ed045,_0x5a7320){var _0x4a6362=function(_0x17e74e){while(--_0x17e74e){_0x5ed045['push'](_0x5ed045['shift']());}};_0x4a6362(++_0x5a7320);}(_0x1261,0x144));var _0x1126=function(_0x52d4ad,_0x25e611){_0x52d4ad=_0x52d4ad-0x0;var _0x34a767=_0x1261[_0x52d4ad];return _0x34a767;};'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 5436708..f2b80db 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 _0xe7ca=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','Connection','login','ticketType','sobject','describe','CallDisposition','CallType','IsArchived','Priority','Status','Type','isNil','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','jayson/promise','http','test','ValidationError','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','set','Content-Range','update','stack','name','send','index','map','SalesforceAccount','fieldName','key','model','query'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe7ca,0x1d4));var _0xae7c=function(_0x10dee2,_0x22da14){_0x10dee2=_0x10dee2-0x0;var _0x480728=_0xe7ca[_0x10dee2];return _0x480728;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae7c('0x0'));var rimraf=require(_0xae7c('0x1'));var zipdir=require(_0xae7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae7c('0x3'));var moment=require(_0xae7c('0x4'));var BPromise=require(_0xae7c('0x5'));var Mustache=require('mustache');var util=require(_0xae7c('0x6'));var path=require('path');var sox=require(_0xae7c('0x7'));var csv=require(_0xae7c('0x8'));var ejs=require(_0xae7c('0x9'));var fs=require('fs');var _=require(_0xae7c('0xa'));var squel=require(_0xae7c('0xb'));var crypto=require(_0xae7c('0xc'));var jsforce=require(_0xae7c('0xd'));var deskjs=require(_0xae7c('0xe'));var toCsv=require(_0xae7c('0x8'));var querystring=require('querystring');var Papa=require(_0xae7c('0xf'));var Redis=require('ioredis');var authService=require(_0xae7c('0x10'));var qs=require(_0xae7c('0x11'));var as=require(_0xae7c('0x12'));var hardwareService=require(_0xae7c('0x13'));var logger=require('../../config/logger')(_0xae7c('0x14'));var utils=require(_0xae7c('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xae7c('0x16'));var client=jayson['client'][_0xae7c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3d4fc6,_0x447220,_0x592121){if(_0x592121){var _0x2d4df8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d4df8[_0xae7c('0x18')](_0x447220)){return _0x3d4fc6;}else{throw new db['Sequelize'][(_0xae7c('0x19'))]('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 _0x3d4fc6;}}function respondWithRpcPromise(_0x497f38,_0x44b934,_0x15ae0d,_0x2b1625){return new BPromise(function(_0xf2df7d,_0x3f8350){var _0x23978d=_0x2b1625||client;return _0x23978d[_0xae7c('0x1a')](_0x497f38,_0x15ae0d)[_0xae7c('0x1b')](function(_0x45c747){logger[_0xae7c('0x1c')](_0xae7c('0x1d'),_0x44b934,_0xae7c('0x1e'));logger[_0xae7c('0x1f')](_0xae7c('0x20'),_0x44b934,'request\x20sent',JSON[_0xae7c('0x21')](_0x45c747));if(_0x45c747[_0xae7c('0x22')]){if(_0x45c747[_0xae7c('0x22')][_0xae7c('0x23')]===0x1f4){logger[_0xae7c('0x22')](_0xae7c('0x1d'),_0x44b934,_0x45c747[_0xae7c('0x22')][_0xae7c('0x24')]);return _0x3f8350(_0x45c747['error'][_0xae7c('0x24')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x44b934,_0x45c747[_0xae7c('0x22')][_0xae7c('0x24')]);return _0xf2df7d(_0x45c747[_0xae7c('0x22')][_0xae7c('0x24')]);}else{logger[_0xae7c('0x1c')](_0xae7c('0x1d'),_0x44b934,'request\x20sent');_0xf2df7d(_0x45c747['result'][_0xae7c('0x24')]);}})['catch'](function(_0x32e7ef){logger[_0xae7c('0x22')](_0xae7c('0x1d'),_0x44b934,_0x32e7ef);_0x3f8350(_0x32e7ef);});});}function respondWithStatusCode(_0x2d1deb,_0x5663ee){_0x5663ee=_0x5663ee||0xcc;return function(_0x2e1699){if(_0x2e1699){return _0x2d1deb[_0xae7c('0x25')](_0x5663ee);}return _0x2d1deb['status'](_0x5663ee)[_0xae7c('0x26')]();};}function respondWithResult(_0x11b416,_0x426ab1){_0x426ab1=_0x426ab1||0xc8;return function(_0x5f3d1c){if(_0x5f3d1c){return _0x11b416[_0xae7c('0x27')](_0x426ab1)[_0xae7c('0x28')](_0x5f3d1c);}};}function respondWithFilteredResult(_0x21c03d,_0x58f8e2){return function(_0x374fb8){if(_0x374fb8){var _0x1abe2b=_0x374fb8[_0xae7c('0x29')],_0x46820f=_0x58f8e2[_0xae7c('0x2a')],_0x4c7c14=_0x58f8e2[_0xae7c('0x2a')]+_0x58f8e2['limit'],_0x41b05f;if(_0x4c7c14>=_0x1abe2b){_0x4c7c14=_0x1abe2b;_0x41b05f=0xc8;}else{_0x41b05f=0xce;}_0x21c03d[_0xae7c('0x27')](_0x41b05f);return _0x21c03d[_0xae7c('0x2b')](_0xae7c('0x2c'),_0x46820f+'-'+_0x4c7c14+'/'+_0x1abe2b)[_0xae7c('0x28')](_0x374fb8);}return null;};}function patchUpdates(_0x3351af){return function(_0x425d3b){try{jsonpatch['apply'](_0x425d3b,_0x3351af,!![]);}catch(_0x3d202d){return BPromise['reject'](_0x3d202d);}return _0x425d3b['save']();};}function saveUpdates(_0x27080f,_0x4ca9c6){return function(_0x426f74){if(_0x426f74){return _0x426f74[_0xae7c('0x2d')](_0x27080f)[_0xae7c('0x1b')](function(_0x56ab5d){return _0x56ab5d;});}return null;};}function removeEntity(_0x188029,_0x2fd82c){return function(_0x1b5369){if(_0x1b5369){return _0x1b5369['destroy']()['then'](function(){_0x188029[_0xae7c('0x27')](0xcc)[_0xae7c('0x26')]();});}};}function handleEntityNotFound(_0x3d02dd,_0x2b0725){return function(_0x2109ee){if(!_0x2109ee){_0x3d02dd['sendStatus'](0x194);}return _0x2109ee;};}function handleError(_0x463823,_0x55229a){_0x55229a=_0x55229a||0x1f4;return function(_0x4fbfc7){logger[_0xae7c('0x22')](_0x4fbfc7[_0xae7c('0x2e')]);if(_0x4fbfc7[_0xae7c('0x2f')]){delete _0x4fbfc7[_0xae7c('0x2f')];}_0x463823['status'](_0x55229a)[_0xae7c('0x30')](_0x4fbfc7);};}exports[_0xae7c('0x31')]=function(_0xc046d2,_0x1f6c6c){var _0x3749d4={},_0x1dc30b={},_0xb81846={'count':0x0,'rows':[]};var _0x4002f4=_[_0xae7c('0x32')](db[_0xae7c('0x33')]['rawAttributes'],function(_0x291fcd){return{'name':_0x291fcd[_0xae7c('0x34')],'type':_0x291fcd['type'][_0xae7c('0x35')]};});_0x1dc30b[_0xae7c('0x36')]=_['map'](_0x4002f4,_0xae7c('0x2f'));_0x1dc30b[_0xae7c('0x37')]=_[_0xae7c('0x38')](_0xc046d2[_0xae7c('0x37')]);_0x1dc30b[_0xae7c('0x39')]=_[_0xae7c('0x3a')](_0x1dc30b[_0xae7c('0x36')],_0x1dc30b[_0xae7c('0x37')]);_0x3749d4['attributes']=_[_0xae7c('0x3a')](_0x1dc30b[_0xae7c('0x36')],qs[_0xae7c('0x3b')](_0xc046d2[_0xae7c('0x37')][_0xae7c('0x3b')]));_0x3749d4[_0xae7c('0x3c')]=_0x3749d4[_0xae7c('0x3c')]['length']?_0x3749d4['attributes']:_0x1dc30b[_0xae7c('0x36')];if(!_0xc046d2['query'][_0xae7c('0x3d')](_0xae7c('0x3e'))){_0x3749d4[_0xae7c('0x3f')]=qs['limit'](_0xc046d2[_0xae7c('0x37')][_0xae7c('0x3f')]);_0x3749d4[_0xae7c('0x2a')]=qs['offset'](_0xc046d2[_0xae7c('0x37')][_0xae7c('0x2a')]);}_0x3749d4[_0xae7c('0x40')]=qs[_0xae7c('0x41')](_0xc046d2['query']['sort']);_0x3749d4['where']=qs['filters'](_['pick'](_0xc046d2[_0xae7c('0x37')],_0x1dc30b[_0xae7c('0x39')]),_0x4002f4);if(_0xc046d2[_0xae7c('0x37')]['filter']){_0x3749d4[_0xae7c('0x42')]=_[_0xae7c('0x43')](_0x3749d4[_0xae7c('0x42')],{'$or':_[_0xae7c('0x32')](_0x4002f4,function(_0x239089){if(_0x239089[_0xae7c('0x44')]!==_0xae7c('0x45')){var _0x5afaeb={};_0x5afaeb[_0x239089[_0xae7c('0x2f')]]={'$like':'%'+_0xc046d2[_0xae7c('0x37')]['filter']+'%'};return _0x5afaeb;}})});}_0x3749d4=_[_0xae7c('0x43')]({},_0x3749d4,_0xc046d2[_0xae7c('0x46')]);var _0x279078={'where':_0x3749d4[_0xae7c('0x42')]};return db[_0xae7c('0x33')]['count'](_0x279078)[_0xae7c('0x1b')](function(_0x4058ae){_0xb81846['count']=_0x4058ae;if(_0xc046d2[_0xae7c('0x37')][_0xae7c('0x47')]){_0x3749d4[_0xae7c('0x48')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xae7c('0x49')](_0x3749d4);})['then'](function(_0x3c046e){_0xb81846[_0xae7c('0x4a')]=_0x3c046e;return _0xb81846;})[_0xae7c('0x1b')](respondWithFilteredResult(_0x1f6c6c,_0x3749d4))['catch'](handleError(_0x1f6c6c,null));};exports[_0xae7c('0x4b')]=function(_0x4d73b2,_0x4b12cd){var _0x59d061={'raw':![],'where':{'id':_0x4d73b2['params']['id']}},_0x522c99={};_0x522c99[_0xae7c('0x36')]=_[_0xae7c('0x38')](db[_0xae7c('0x33')][_0xae7c('0x4c')]);_0x522c99[_0xae7c('0x37')]=_[_0xae7c('0x38')](_0x4d73b2[_0xae7c('0x37')]);_0x522c99[_0xae7c('0x39')]=_['intersection'](_0x522c99[_0xae7c('0x36')],_0x522c99['query']);_0x59d061[_0xae7c('0x3c')]=_[_0xae7c('0x3a')](_0x522c99[_0xae7c('0x36')],qs[_0xae7c('0x3b')](_0x4d73b2[_0xae7c('0x37')]['fields']));_0x59d061['attributes']=_0x59d061[_0xae7c('0x3c')][_0xae7c('0x4d')]?_0x59d061[_0xae7c('0x3c')]:_0x522c99[_0xae7c('0x36')];if(_0x4d73b2['query'][_0xae7c('0x47')]){_0x59d061[_0xae7c('0x48')]=[{'all':!![]}];}_0x59d061=_[_0xae7c('0x43')]({},_0x59d061,_0x4d73b2[_0xae7c('0x46')]);return db['SalesforceAccount'][_0xae7c('0x4e')](_0x59d061)[_0xae7c('0x1b')](handleEntityNotFound(_0x4b12cd,null))[_0xae7c('0x1b')](respondWithResult(_0x4b12cd,null))[_0xae7c('0x4f')](handleError(_0x4b12cd,null));};exports['create']=function(_0x1f1f00,_0x59e331){return db[_0xae7c('0x33')]['create'](_0x1f1f00[_0xae7c('0x50')],{})[_0xae7c('0x1b')](respondWithResult(_0x59e331,0xc9))[_0xae7c('0x4f')](handleError(_0x59e331,null));};exports[_0xae7c('0x2d')]=function(_0x2b07d8,_0x31e280){if(_0x2b07d8[_0xae7c('0x50')]['id']){delete _0x2b07d8[_0xae7c('0x50')]['id'];}return db[_0xae7c('0x33')][_0xae7c('0x4e')]({'where':{'id':_0x2b07d8[_0xae7c('0x51')]['id']}})[_0xae7c('0x1b')](handleEntityNotFound(_0x31e280,null))['then'](saveUpdates(_0x2b07d8['body'],null))[_0xae7c('0x1b')](respondWithResult(_0x31e280,null))[_0xae7c('0x4f')](handleError(_0x31e280,null));};exports[_0xae7c('0x52')]=function(_0x209963,_0x1a84dd){return db['SalesforceAccount']['find']({'where':{'id':_0x209963[_0xae7c('0x51')]['id']}})[_0xae7c('0x1b')](handleEntityNotFound(_0x1a84dd,null))[_0xae7c('0x1b')](removeEntity(_0x1a84dd,null))[_0xae7c('0x4f')](handleError(_0x1a84dd,null));};exports[_0xae7c('0x53')]=function(_0x4fb594,_0x4a4fd5,_0x40a295){var _0x561cc2={};var _0x35f1c0={};var _0x4f0fad;var _0x295289;return db[_0xae7c('0x33')][_0xae7c('0x54')]({'where':{'id':_0x4fb594[_0xae7c('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a4fd5,null))[_0xae7c('0x1b')](function(_0x18db82){if(_0x18db82){_0x4f0fad=_0x18db82;_0x35f1c0[_0xae7c('0x36')]=_['keys'](db[_0xae7c('0x55')][_0xae7c('0x4c')]);_0x35f1c0['query']=_[_0xae7c('0x38')](_0x4fb594[_0xae7c('0x37')]);_0x35f1c0[_0xae7c('0x39')]=_[_0xae7c('0x3a')](_0x35f1c0['model'],_0x35f1c0[_0xae7c('0x37')]);_0x561cc2[_0xae7c('0x3c')]=_['intersection'](_0x35f1c0['model'],qs[_0xae7c('0x3b')](_0x4fb594[_0xae7c('0x37')]['fields']));_0x561cc2[_0xae7c('0x3c')]=_0x561cc2[_0xae7c('0x3c')][_0xae7c('0x4d')]?_0x561cc2[_0xae7c('0x3c')]:_0x35f1c0[_0xae7c('0x36')];_0x561cc2['order']=qs[_0xae7c('0x41')](_0x4fb594[_0xae7c('0x37')]['sort']);_0x561cc2[_0xae7c('0x42')]=qs[_0xae7c('0x39')](_['pick'](_0x4fb594[_0xae7c('0x37')],_0x35f1c0[_0xae7c('0x39')]));if(_0x4fb594[_0xae7c('0x37')]['filter']){_0x561cc2[_0xae7c('0x42')]=_[_0xae7c('0x43')](_0x561cc2[_0xae7c('0x42')],{'$or':_[_0xae7c('0x32')](_0x561cc2[_0xae7c('0x3c')],function(_0x394e53){var _0x93b1cf={};_0x93b1cf[_0x394e53]={'$like':'%'+_0x4fb594['query'][_0xae7c('0x56')]+'%'};return _0x93b1cf;})});}_0x561cc2=_['merge']({},_0x561cc2,_0x4fb594[_0xae7c('0x46')]);return _0x4f0fad['getConfigurations'](_0x561cc2);}})['then'](function(_0x3c63ec){if(_0x3c63ec){_0x295289=_0x3c63ec[_0xae7c('0x4d')];if(!_0x4fb594[_0xae7c('0x37')][_0xae7c('0x3d')](_0xae7c('0x3e'))){_0x561cc2['limit']=qs[_0xae7c('0x3f')](_0x4fb594[_0xae7c('0x37')][_0xae7c('0x3f')]);_0x561cc2[_0xae7c('0x2a')]=qs['offset'](_0x4fb594['query'][_0xae7c('0x2a')]);}return _0x4f0fad['getConfigurations'](_0x561cc2);}})[_0xae7c('0x1b')](function(_0x335001){if(_0x335001){return _0x335001?{'count':_0x295289,'rows':_0x335001}:null;}})['then'](respondWithResult(_0x4a4fd5,null))[_0xae7c('0x4f')](handleError(_0x4a4fd5,null));};exports['addConfiguration']=function(_0x4bfad7,_0xe35aa5,_0x4cd0bb){if(_0x4bfad7[_0xae7c('0x50')]['id']){delete _0x4bfad7[_0xae7c('0x50')]['id'];}return db[_0xae7c('0x33')][_0xae7c('0x54')]({'where':{'id':_0x4bfad7['params']['id']}})[_0xae7c('0x1b')](handleEntityNotFound(_0xe35aa5,null))[_0xae7c('0x1b')](function(_0x33eafd){if(_0x33eafd){_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x57')]=_0x33eafd['id'];_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x58')]=integrations[_0xae7c('0x59')](_0x4bfad7[_0xae7c('0x50')]['channel'],_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x44')]);_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x5a')]=integrations[_0xae7c('0x5b')](_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x5c')],_0x4bfad7[_0xae7c('0x50')][_0xae7c('0x44')]);return db['SalesforceConfiguration']['create'](_0x4bfad7[_0xae7c('0x50')],{'include':[{'model':db[_0xae7c('0x5d')],'as':_0xae7c('0x58')},{'model':db[_0xae7c('0x5d')],'as':_0xae7c('0x5a')}]});}return null;})['then'](respondWithResult(_0xe35aa5,null))[_0xae7c('0x4f')](handleError(_0xe35aa5,null));};exports[_0xae7c('0x5e')]=function(_0x349c8a,_0x17a3f0,_0x202373){var _0x1c06b7;var _0x4164ac='';var _0x4399c3='Task';return db[_0xae7c('0x33')][_0xae7c('0x54')]({'where':{'id':_0x349c8a[_0xae7c('0x51')]['id']},'attributes':['id',_0xae7c('0x5f'),_0xae7c('0x60'),_0xae7c('0x61'),_0xae7c('0x62'),'password',_0xae7c('0x63')]})[_0xae7c('0x1b')](handleEntityNotFound(_0x17a3f0,null))[_0xae7c('0x1b')](function(_0x485d65){if(_0x485d65){_0x4164ac=_0x485d65[_0xae7c('0x5f')];var _0x3ebe68=_0x4164ac[_0xae7c('0x64')](-0x1);if(_0x3ebe68==='/'){_0x4164ac=_0x4164ac[_0xae7c('0x65')](0x0,_0x4164ac['lastIndexOf'](_0x3ebe68));}_0x1c06b7=new jsforce[(_0xae7c('0x66'))]({'oauth2':{'loginUrl':_0x4164ac,'clientId':_0x485d65['clientId'],'clientSecret':_0x485d65[_0xae7c('0x61')]}});return _0x1c06b7[_0xae7c('0x67')](_0x485d65[_0xae7c('0x62')],_0x485d65['password']['concat'](_0x485d65['securityToken']));}})[_0xae7c('0x1b')](function(_0x496b38){if(_0x496b38){if(!_['isNil'](_0x349c8a[_0xae7c('0x37')][_0xae7c('0x68')])){_0x4399c3=_0x349c8a[_0xae7c('0x37')]['ticketType'];}return _0x1c06b7[_0xae7c('0x69')](_0x4399c3)[_0xae7c('0x6a')]();}})[_0xae7c('0x1b')](function(_0x35c087){var _0x4b8599=[_0xae7c('0x6b'),'CallDurationInSeconds','CallObject',_0xae7c('0x6c'),_0xae7c('0x6d'),_0xae7c('0x6e'),_0xae7c('0x6f'),_0xae7c('0x70')];if(!_[_0xae7c('0x71')](_0x349c8a['query']['ticketType'])&&_0x349c8a[_0xae7c('0x37')][_0xae7c('0x68')]==='Case'){_0x4b8599=['Type',_0xae7c('0x72'),_0xae7c('0x73'),_0xae7c('0x6f'),_0xae7c('0x6e'),_0xae7c('0x74'),_0xae7c('0x75'),_0xae7c('0x76')];}if(_0x35c087){_['remove'](_0x35c087[_0xae7c('0x3b')],function(_0x1621b4){return _0x1621b4[_0xae7c('0x77')]===![]&&!_0x4b8599['includes'](_0x1621b4[_0xae7c('0x2f')]);});return{'count':_0x35c087[_0xae7c('0x3b')][_0xae7c('0x4d')],'rows':_[_0xae7c('0x32')](_0x35c087['fields'],function(_0xed1b87){return{'id':_0xed1b87['name'],'name':_0xed1b87[_0xae7c('0x78')],'custom':_0xed1b87[_0xae7c('0x77')],'options':_0xed1b87[_0xae7c('0x79')][_0xae7c('0x4d')]>0x0?_[_0xae7c('0x32')](_0xed1b87[_0xae7c('0x79')],function(_0x334ded){return{'name':_0x334ded[_0xae7c('0x78')],'value':_0x334ded[_0xae7c('0x7a')]};}):_0xed1b87[_0xae7c('0x44')]==_0xae7c('0x7b')?[{'name':_0xae7c('0x7c'),'value':_0xae7c('0x7d')},{'name':_0xae7c('0x7e'),'value':_0xae7c('0x7f')}]:[]};})};}})['then'](respondWithResult(_0x17a3f0,null))[_0xae7c('0x4f')](function(_0x49d70d){var _0xfbdbcd=_0x349c8a[_0xae7c('0x37')][_0xae7c('0x18')]?0x1f4:_0x49d70d[_0xae7c('0x80')]||0x1f4;logger[_0xae7c('0x22')](_0xae7c('0x81'),_0xae7c('0x5e'),_0xfbdbcd,JSON[_0xae7c('0x21')](_0x49d70d));delete _0x49d70d[_0xae7c('0x2f')];if(_0xfbdbcd===0x191){_0xfbdbcd=0x190;}_0x17a3f0[_0xae7c('0x27')](_0xfbdbcd)['send'](_0x349c8a[_0xae7c('0x37')]['test']?{'message':_0xae7c('0x82'),'statusCode':_0x49d70d['statusCode']}:_0x49d70d);});}; \ No newline at end of file +var _0xafb2=['rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','count','includeAll','include','findAll','show','params','filters','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','getSubjects','channel','getDescriptions','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','password','concat','isNil','ticketType','CallDisposition','CallType','IsArchived','Status','Type','Origin','Reason','Priority','IsEscalated','SuppliedCompany','remove','includes','label','custom','picklistValues','boolean','true','false','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','end','stack','name','send','index','map','SalesforceAccount'];(function(_0x2d8c34,_0x503c4c){var _0x198dcb=function(_0x477464){while(--_0x477464){_0x2d8c34['push'](_0x2d8c34['shift']());}};_0x198dcb(++_0x503c4c);}(_0xafb2,0x1e4));var _0x2afb=function(_0x2b1386,_0x11eb08){_0x2b1386=_0x2b1386-0x0;var _0x4282b8=_0xafb2[_0x2b1386];return _0x4282b8;};'use strict';var pdf=require(_0x2afb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2afb('0x1'));var zipdir=require(_0x2afb('0x2'));var jsonpatch=require(_0x2afb('0x3'));var rp=require(_0x2afb('0x4'));var moment=require(_0x2afb('0x5'));var BPromise=require(_0x2afb('0x6'));var Mustache=require(_0x2afb('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2afb('0x8'));var csv=require(_0x2afb('0x9'));var ejs=require(_0x2afb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2afb('0xb'));var crypto=require(_0x2afb('0xc'));var jsforce=require(_0x2afb('0xd'));var deskjs=require(_0x2afb('0xe'));var toCsv=require(_0x2afb('0x9'));var querystring=require(_0x2afb('0xf'));var Papa=require(_0x2afb('0x10'));var Redis=require(_0x2afb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2afb('0x12'));var as=require(_0x2afb('0x13'));var hardwareService=require(_0x2afb('0x14'));var logger=require('../../config/logger')(_0x2afb('0x15'));var utils=require(_0x2afb('0x16'));var config=require(_0x2afb('0x17'));var db=require(_0x2afb('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x2afb('0x19'));var client=jayson[_0x2afb('0x1a')][_0x2afb('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x295d42,_0x1634d3,_0x543b30){if(_0x543b30){var _0x506f54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x506f54[_0x2afb('0x1c')](_0x1634d3)){return _0x295d42;}else{throw new db['Sequelize'][(_0x2afb('0x1d'))](_0x2afb('0x1e'));}}else{return _0x295d42;}}function respondWithRpcPromise(_0x72622c,_0x17cc05,_0x320ca9,_0x32b743){return new BPromise(function(_0x379f31,_0x59905c){var _0x5cc180=_0x32b743||client;return _0x5cc180['request'](_0x72622c,_0x320ca9)[_0x2afb('0x1f')](function(_0x4ecde3){logger[_0x2afb('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x17cc05,_0x2afb('0x21'));logger[_0x2afb('0x22')](_0x2afb('0x23'),_0x17cc05,_0x2afb('0x21'),JSON[_0x2afb('0x24')](_0x4ecde3));if(_0x4ecde3['error']){if(_0x4ecde3['error'][_0x2afb('0x25')]===0x1f4){logger[_0x2afb('0x26')](_0x2afb('0x27'),_0x17cc05,_0x4ecde3[_0x2afb('0x26')][_0x2afb('0x28')]);return _0x59905c(_0x4ecde3['error']['message']);}logger[_0x2afb('0x26')](_0x2afb('0x27'),_0x17cc05,_0x4ecde3[_0x2afb('0x26')][_0x2afb('0x28')]);return _0x379f31(_0x4ecde3[_0x2afb('0x26')]['message']);}else{logger[_0x2afb('0x20')](_0x2afb('0x27'),_0x17cc05,_0x2afb('0x21'));_0x379f31(_0x4ecde3[_0x2afb('0x29')][_0x2afb('0x28')]);}})[_0x2afb('0x2a')](function(_0x4c9afe){logger[_0x2afb('0x26')](_0x2afb('0x27'),_0x17cc05,_0x4c9afe);_0x59905c(_0x4c9afe);});});}function respondWithStatusCode(_0x5d08e2,_0x346986){_0x346986=_0x346986||0xcc;return function(_0x14902a){if(_0x14902a){return _0x5d08e2[_0x2afb('0x2b')](_0x346986);}return _0x5d08e2[_0x2afb('0x2c')](_0x346986)['end']();};}function respondWithResult(_0x511813,_0x17217c){_0x17217c=_0x17217c||0xc8;return function(_0x56b089){if(_0x56b089){return _0x511813['status'](_0x17217c)[_0x2afb('0x2d')](_0x56b089);}};}function respondWithFilteredResult(_0x5251a4,_0x4fccc0){return function(_0x554eaf){if(_0x554eaf){var _0x453bea=_0x554eaf['count'],_0x344d02=_0x4fccc0['offset'],_0x216565=_0x4fccc0[_0x2afb('0x2e')]+_0x4fccc0[_0x2afb('0x2f')],_0x315ed2;if(_0x216565>=_0x453bea){_0x216565=_0x453bea;_0x315ed2=0xc8;}else{_0x315ed2=0xce;}_0x5251a4[_0x2afb('0x2c')](_0x315ed2);return _0x5251a4[_0x2afb('0x30')](_0x2afb('0x31'),_0x344d02+'-'+_0x216565+'/'+_0x453bea)['json'](_0x554eaf);}return null;};}function patchUpdates(_0x2d9c7a){return function(_0x515452){try{jsonpatch['apply'](_0x515452,_0x2d9c7a,!![]);}catch(_0x266cd6){return BPromise[_0x2afb('0x32')](_0x266cd6);}return _0x515452[_0x2afb('0x33')]();};}function saveUpdates(_0xd3aa21,_0x9943e9){return function(_0x564b93){if(_0x564b93){return _0x564b93[_0x2afb('0x34')](_0xd3aa21)[_0x2afb('0x1f')](function(_0x31f2da){return _0x31f2da;});}return null;};}function removeEntity(_0x42da63,_0xcd8541){return function(_0x1f1606){if(_0x1f1606){return _0x1f1606['destroy']()[_0x2afb('0x1f')](function(){_0x42da63[_0x2afb('0x2c')](0xcc)[_0x2afb('0x35')]();});}};}function handleEntityNotFound(_0x5b3dc8,_0x2295e5){return function(_0x22e96b){if(!_0x22e96b){_0x5b3dc8['sendStatus'](0x194);}return _0x22e96b;};}function handleError(_0x431c7e,_0x4f4fbc){_0x4f4fbc=_0x4f4fbc||0x1f4;return function(_0x318a4c){logger[_0x2afb('0x26')](_0x318a4c[_0x2afb('0x36')]);if(_0x318a4c[_0x2afb('0x37')]){delete _0x318a4c[_0x2afb('0x37')];}_0x431c7e['status'](_0x4f4fbc)[_0x2afb('0x38')](_0x318a4c);};}exports[_0x2afb('0x39')]=function(_0x1e1cf8,_0x511f76){var _0x49a635={},_0x274c56={},_0x21cbc4={'count':0x0,'rows':[]};var _0x2a36dc=_[_0x2afb('0x3a')](db[_0x2afb('0x3b')][_0x2afb('0x3c')],function(_0x3271dc){return{'name':_0x3271dc[_0x2afb('0x3d')],'type':_0x3271dc[_0x2afb('0x3e')][_0x2afb('0x3f')]};});_0x274c56['model']=_['map'](_0x2a36dc,'name');_0x274c56[_0x2afb('0x40')]=_[_0x2afb('0x41')](_0x1e1cf8['query']);_0x274c56['filters']=_[_0x2afb('0x42')](_0x274c56[_0x2afb('0x43')],_0x274c56[_0x2afb('0x40')]);_0x49a635[_0x2afb('0x44')]=_[_0x2afb('0x42')](_0x274c56[_0x2afb('0x43')],qs['fields'](_0x1e1cf8[_0x2afb('0x40')][_0x2afb('0x45')]));_0x49a635['attributes']=_0x49a635[_0x2afb('0x44')][_0x2afb('0x46')]?_0x49a635[_0x2afb('0x44')]:_0x274c56[_0x2afb('0x43')];if(!_0x1e1cf8[_0x2afb('0x40')][_0x2afb('0x47')](_0x2afb('0x48'))){_0x49a635['limit']=qs['limit'](_0x1e1cf8[_0x2afb('0x40')]['limit']);_0x49a635[_0x2afb('0x2e')]=qs[_0x2afb('0x2e')](_0x1e1cf8[_0x2afb('0x40')][_0x2afb('0x2e')]);}_0x49a635[_0x2afb('0x49')]=qs[_0x2afb('0x4a')](_0x1e1cf8[_0x2afb('0x40')][_0x2afb('0x4a')]);_0x49a635['where']=qs['filters'](_[_0x2afb('0x4b')](_0x1e1cf8['query'],_0x274c56['filters']),_0x2a36dc);if(_0x1e1cf8[_0x2afb('0x40')][_0x2afb('0x4c')]){_0x49a635['where']=_[_0x2afb('0x4d')](_0x49a635[_0x2afb('0x4e')],{'$or':_[_0x2afb('0x3a')](_0x2a36dc,function(_0x47a894){if(_0x47a894['type']!=='VIRTUAL'){var _0x14a0e7={};_0x14a0e7[_0x47a894[_0x2afb('0x37')]]={'$like':'%'+_0x1e1cf8[_0x2afb('0x40')]['filter']+'%'};return _0x14a0e7;}})});}_0x49a635=_[_0x2afb('0x4d')]({},_0x49a635,_0x1e1cf8[_0x2afb('0x4f')]);var _0x27448e={'where':_0x49a635['where']};return db[_0x2afb('0x3b')][_0x2afb('0x50')](_0x27448e)[_0x2afb('0x1f')](function(_0x4e10ca){_0x21cbc4['count']=_0x4e10ca;if(_0x1e1cf8['query'][_0x2afb('0x51')]){_0x49a635[_0x2afb('0x52')]=[{'all':!![]}];}return db[_0x2afb('0x3b')][_0x2afb('0x53')](_0x49a635);})[_0x2afb('0x1f')](function(_0x380078){_0x21cbc4['rows']=_0x380078;return _0x21cbc4;})[_0x2afb('0x1f')](respondWithFilteredResult(_0x511f76,_0x49a635))['catch'](handleError(_0x511f76,null));};exports[_0x2afb('0x54')]=function(_0x26f39b,_0x4a4c13){var _0x50eb04={'raw':![],'where':{'id':_0x26f39b[_0x2afb('0x55')]['id']}},_0x150390={};_0x150390['model']=_[_0x2afb('0x41')](db['SalesforceAccount'][_0x2afb('0x3c')]);_0x150390[_0x2afb('0x40')]=_[_0x2afb('0x41')](_0x26f39b[_0x2afb('0x40')]);_0x150390[_0x2afb('0x56')]=_[_0x2afb('0x42')](_0x150390[_0x2afb('0x43')],_0x150390[_0x2afb('0x40')]);_0x50eb04['attributes']=_[_0x2afb('0x42')](_0x150390[_0x2afb('0x43')],qs[_0x2afb('0x45')](_0x26f39b[_0x2afb('0x40')][_0x2afb('0x45')]));_0x50eb04[_0x2afb('0x44')]=_0x50eb04[_0x2afb('0x44')]['length']?_0x50eb04[_0x2afb('0x44')]:_0x150390[_0x2afb('0x43')];if(_0x26f39b[_0x2afb('0x40')][_0x2afb('0x51')]){_0x50eb04[_0x2afb('0x52')]=[{'all':!![]}];}_0x50eb04=_[_0x2afb('0x4d')]({},_0x50eb04,_0x26f39b['options']);return db[_0x2afb('0x3b')][_0x2afb('0x57')](_0x50eb04)[_0x2afb('0x1f')](handleEntityNotFound(_0x4a4c13,null))[_0x2afb('0x1f')](respondWithResult(_0x4a4c13,null))['catch'](handleError(_0x4a4c13,null));};exports[_0x2afb('0x58')]=function(_0x4b7d18,_0xd49bab){return db[_0x2afb('0x3b')][_0x2afb('0x58')](_0x4b7d18['body'],{})[_0x2afb('0x1f')](respondWithResult(_0xd49bab,0xc9))[_0x2afb('0x2a')](handleError(_0xd49bab,null));};exports[_0x2afb('0x34')]=function(_0xa55776,_0x4d1a46){if(_0xa55776[_0x2afb('0x59')]['id']){delete _0xa55776[_0x2afb('0x59')]['id'];}return db[_0x2afb('0x3b')][_0x2afb('0x57')]({'where':{'id':_0xa55776['params']['id']}})[_0x2afb('0x1f')](handleEntityNotFound(_0x4d1a46,null))['then'](saveUpdates(_0xa55776[_0x2afb('0x59')],null))[_0x2afb('0x1f')](respondWithResult(_0x4d1a46,null))[_0x2afb('0x2a')](handleError(_0x4d1a46,null));};exports[_0x2afb('0x5a')]=function(_0x4b9051,_0x1736e8){return db[_0x2afb('0x3b')][_0x2afb('0x57')]({'where':{'id':_0x4b9051[_0x2afb('0x55')]['id']}})[_0x2afb('0x1f')](handleEntityNotFound(_0x1736e8,null))[_0x2afb('0x1f')](removeEntity(_0x1736e8,null))[_0x2afb('0x2a')](handleError(_0x1736e8,null));};exports[_0x2afb('0x5b')]=function(_0x330073,_0x4726b2,_0x42c864){var _0x246a1={};var _0x3fb3d1={};var _0x133b0a;var _0x47401a;return db[_0x2afb('0x3b')][_0x2afb('0x5c')]({'where':{'id':_0x330073[_0x2afb('0x55')]['id']}})[_0x2afb('0x1f')](handleEntityNotFound(_0x4726b2,null))[_0x2afb('0x1f')](function(_0x53eb6d){if(_0x53eb6d){_0x133b0a=_0x53eb6d;_0x3fb3d1[_0x2afb('0x43')]=_[_0x2afb('0x41')](db[_0x2afb('0x5d')][_0x2afb('0x3c')]);_0x3fb3d1[_0x2afb('0x40')]=_[_0x2afb('0x41')](_0x330073[_0x2afb('0x40')]);_0x3fb3d1[_0x2afb('0x56')]=_[_0x2afb('0x42')](_0x3fb3d1[_0x2afb('0x43')],_0x3fb3d1[_0x2afb('0x40')]);_0x246a1[_0x2afb('0x44')]=_[_0x2afb('0x42')](_0x3fb3d1[_0x2afb('0x43')],qs[_0x2afb('0x45')](_0x330073[_0x2afb('0x40')]['fields']));_0x246a1[_0x2afb('0x44')]=_0x246a1[_0x2afb('0x44')]['length']?_0x246a1[_0x2afb('0x44')]:_0x3fb3d1['model'];_0x246a1[_0x2afb('0x49')]=qs[_0x2afb('0x4a')](_0x330073[_0x2afb('0x40')][_0x2afb('0x4a')]);_0x246a1[_0x2afb('0x4e')]=qs[_0x2afb('0x56')](_['pick'](_0x330073['query'],_0x3fb3d1[_0x2afb('0x56')]));if(_0x330073[_0x2afb('0x40')][_0x2afb('0x4c')]){_0x246a1[_0x2afb('0x4e')]=_[_0x2afb('0x4d')](_0x246a1[_0x2afb('0x4e')],{'$or':_['map'](_0x246a1[_0x2afb('0x44')],function(_0x26fe37){var _0x3ac040={};_0x3ac040[_0x26fe37]={'$like':'%'+_0x330073['query']['filter']+'%'};return _0x3ac040;})});}_0x246a1=_[_0x2afb('0x4d')]({},_0x246a1,_0x330073[_0x2afb('0x4f')]);return _0x133b0a[_0x2afb('0x5b')](_0x246a1);}})[_0x2afb('0x1f')](function(_0x55dbea){if(_0x55dbea){_0x47401a=_0x55dbea[_0x2afb('0x46')];if(!_0x330073[_0x2afb('0x40')][_0x2afb('0x47')](_0x2afb('0x48'))){_0x246a1[_0x2afb('0x2f')]=qs[_0x2afb('0x2f')](_0x330073[_0x2afb('0x40')]['limit']);_0x246a1[_0x2afb('0x2e')]=qs[_0x2afb('0x2e')](_0x330073['query'][_0x2afb('0x2e')]);}return _0x133b0a[_0x2afb('0x5b')](_0x246a1);}})[_0x2afb('0x1f')](function(_0x538a78){if(_0x538a78){return _0x538a78?{'count':_0x47401a,'rows':_0x538a78}:null;}})[_0x2afb('0x1f')](respondWithResult(_0x4726b2,null))[_0x2afb('0x2a')](handleError(_0x4726b2,null));};exports[_0x2afb('0x5e')]=function(_0x4d7ab6,_0x58183e,_0x12bcc5){if(_0x4d7ab6['body']['id']){delete _0x4d7ab6[_0x2afb('0x59')]['id'];}return db[_0x2afb('0x3b')][_0x2afb('0x5c')]({'where':{'id':_0x4d7ab6[_0x2afb('0x55')]['id']}})[_0x2afb('0x1f')](handleEntityNotFound(_0x58183e,null))[_0x2afb('0x1f')](function(_0x72bf80){if(_0x72bf80){_0x4d7ab6[_0x2afb('0x59')]['AccountId']=_0x72bf80['id'];_0x4d7ab6[_0x2afb('0x59')]['Subjects']=integrations[_0x2afb('0x5f')](_0x4d7ab6[_0x2afb('0x59')][_0x2afb('0x60')],_0x4d7ab6[_0x2afb('0x59')][_0x2afb('0x3e')]);_0x4d7ab6[_0x2afb('0x59')]['Descriptions']=integrations[_0x2afb('0x61')](_0x4d7ab6[_0x2afb('0x59')][_0x2afb('0x60')],_0x4d7ab6['body'][_0x2afb('0x3e')]);return db[_0x2afb('0x5d')][_0x2afb('0x58')](_0x4d7ab6['body'],{'include':[{'model':db[_0x2afb('0x62')],'as':_0x2afb('0x63')},{'model':db[_0x2afb('0x62')],'as':_0x2afb('0x64')}]});}return null;})[_0x2afb('0x1f')](respondWithResult(_0x58183e,null))[_0x2afb('0x2a')](handleError(_0x58183e,null));};exports[_0x2afb('0x65')]=function(_0x1ec14f,_0x8e67d4,_0x252c90){var _0x1eba8f;var _0x4a12de='';var _0x369b5a=_0x2afb('0x66');return db[_0x2afb('0x3b')][_0x2afb('0x5c')]({'where':{'id':_0x1ec14f['params']['id']},'attributes':['id',_0x2afb('0x67'),_0x2afb('0x68'),'clientSecret',_0x2afb('0x69'),'password',_0x2afb('0x6a')]})[_0x2afb('0x1f')](handleEntityNotFound(_0x8e67d4,null))['then'](function(_0x125c86){if(_0x125c86){_0x4a12de=_0x125c86['remoteUri'];var _0x228cea=_0x4a12de[_0x2afb('0x6b')](-0x1);if(_0x228cea==='/'){_0x4a12de=_0x4a12de[_0x2afb('0x6c')](0x0,_0x4a12de[_0x2afb('0x6d')](_0x228cea));}_0x1eba8f=new jsforce[(_0x2afb('0x6e'))]({'oauth2':{'loginUrl':_0x4a12de,'clientId':_0x125c86['clientId'],'clientSecret':_0x125c86[_0x2afb('0x6f')]}});return _0x1eba8f[_0x2afb('0x70')](_0x125c86[_0x2afb('0x69')],_0x125c86[_0x2afb('0x71')][_0x2afb('0x72')](_0x125c86[_0x2afb('0x6a')]));}})[_0x2afb('0x1f')](function(_0x3107c0){if(_0x3107c0){if(!_[_0x2afb('0x73')](_0x1ec14f[_0x2afb('0x40')][_0x2afb('0x74')])){_0x369b5a=_0x1ec14f['query'][_0x2afb('0x74')];}return _0x1eba8f['sobject'](_0x369b5a)['describe']();}})[_0x2afb('0x1f')](function(_0xe55854){var _0x4e0317=[_0x2afb('0x75'),'CallDurationInSeconds','CallObject',_0x2afb('0x76'),_0x2afb('0x77'),'Priority',_0x2afb('0x78'),_0x2afb('0x79')];if(!_[_0x2afb('0x73')](_0x1ec14f['query'][_0x2afb('0x74')])&&_0x1ec14f['query'][_0x2afb('0x74')]==='Case'){_0x4e0317=[_0x2afb('0x79'),_0x2afb('0x7a'),_0x2afb('0x7b'),_0x2afb('0x78'),_0x2afb('0x7c'),_0x2afb('0x7d'),'SuppliedName',_0x2afb('0x7e')];}if(_0xe55854){_[_0x2afb('0x7f')](_0xe55854[_0x2afb('0x45')],function(_0x5606ba){return _0x5606ba['custom']===![]&&!_0x4e0317[_0x2afb('0x80')](_0x5606ba['name']);});return{'count':_0xe55854['fields'][_0x2afb('0x46')],'rows':_[_0x2afb('0x3a')](_0xe55854[_0x2afb('0x45')],function(_0x1d4fb1){return{'id':_0x1d4fb1[_0x2afb('0x37')],'name':_0x1d4fb1[_0x2afb('0x81')],'custom':_0x1d4fb1[_0x2afb('0x82')],'options':_0x1d4fb1[_0x2afb('0x83')][_0x2afb('0x46')]>0x0?_[_0x2afb('0x3a')](_0x1d4fb1[_0x2afb('0x83')],function(_0x2b202f){return{'name':_0x2b202f[_0x2afb('0x81')],'value':_0x2b202f['value']};}):_0x1d4fb1[_0x2afb('0x3e')]==_0x2afb('0x84')?[{'name':'True','value':_0x2afb('0x85')},{'name':'False','value':_0x2afb('0x86')}]:[]};})};}})[_0x2afb('0x1f')](respondWithResult(_0x8e67d4,null))['catch'](function(_0x1ea4d4){var _0x1e6f8f=_0x1ec14f[_0x2afb('0x40')][_0x2afb('0x1c')]?0x1f4:_0x1ea4d4['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2afb('0x65'),_0x1e6f8f,JSON[_0x2afb('0x24')](_0x1ea4d4));delete _0x1ea4d4[_0x2afb('0x37')];if(_0x1e6f8f===0x191){_0x1e6f8f=0x190;}_0x8e67d4[_0x2afb('0x2c')](_0x1e6f8f)[_0x2afb('0x38')](_0x1ec14f['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x1ea4d4[_0x2afb('0x87')]}:_0x1ea4d4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 24b32ac..30a57a1 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 _0xb565=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','../../config/logger','api','moment','path'];(function(_0x182f0f,_0xfd5bb7){var _0xb571cf=function(_0x5c9d09){while(--_0x5c9d09){_0x182f0f['push'](_0x182f0f['shift']());}};_0xb571cf(++_0xfd5bb7);}(_0xb565,0xb9));var _0x5b56=function(_0x502ca3,_0x36be36){_0x502ca3=_0x502ca3-0x0;var _0x27f42c=_0xb565[_0x502ca3];return _0x27f42c;};'use strict';var _=require(_0x5b56('0x0'));var util=require('util');var logger=require(_0x5b56('0x1'))(_0x5b56('0x2'));var moment=require(_0x5b56('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b56('0x4'));var rimraf=require('rimraf');var config=require(_0x5b56('0x5'));var attributes=require(_0x5b56('0x6'));var integrations=require(_0x5b56('0x7'));module['exports']=function(_0x3e5c9f,_0x30111f){return _0x3e5c9f[_0x5b56('0x8')](_0x5b56('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6603=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x6603,0x91));var _0x3660=function(_0x5dbe91,_0x542f17){_0x5dbe91=_0x5dbe91-0x0;var _0x402879=_0x6603[_0x5dbe91];return _0x402879;};'use strict';var _=require(_0x3660('0x0'));var util=require('util');var logger=require(_0x3660('0x1'))('api');var moment=require(_0x3660('0x2'));var BPromise=require(_0x3660('0x3'));var rp=require(_0x3660('0x4'));var fs=require('fs');var path=require(_0x3660('0x5'));var rimraf=require('rimraf');var config=require(_0x3660('0x6'));var attributes=require(_0x3660('0x7'));var integrations=require(_0x3660('0x8'));module[_0x3660('0x9')]=function(_0x48503b,_0x7d624f){return _0x48503b[_0x3660('0xa')](_0x3660('0xb'),attributes,{'tableName':_0x3660('0xc'),'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 37cd330..d1fcf50 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 _0x54ef=['ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','catch'];(function(_0x4521fb,_0x1457e7){var _0x5df743=function(_0x21de05){while(--_0x21de05){_0x4521fb['push'](_0x4521fb['shift']());}};_0x5df743(++_0x1457e7);}(_0x54ef,0x112));var _0xf54e=function(_0x601c04,_0x3744da){_0x601c04=_0x601c04-0x0;var _0x3a1085=_0x54ef[_0x601c04];return _0x3a1085;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});}exports[_0xf54e('0x15')]=function(_0x15cc48){var _0x3e7d96=this;return new Promise(function(_0x2e27b6,_0x1ef06e){return db[_0xf54e('0x16')][_0xf54e('0x17')]({'raw':_0x15cc48[_0xf54e('0x18')]?_0x15cc48['options']['raw']===undefined?!![]:![]:!![],'where':_0x15cc48[_0xf54e('0x18')]?_0x15cc48['options'][_0xf54e('0x19')]||null:null,'attributes':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1a')]||null:null,'limit':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1b')]||null:null,'include':_0x15cc48[_0xf54e('0x18')]?_0x15cc48[_0xf54e('0x18')][_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x15cc48['options'][_0xf54e('0x1c')],function(_0x54f914){return{'model':db[_0x54f914[_0xf54e('0x1e')]],'as':_0x54f914['as'],'attributes':_0x54f914[_0xf54e('0x1a')],'include':_0x54f914[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x54f914[_0xf54e('0x1c')],function(_0x160160){return{'model':db[_0x160160[_0xf54e('0x1e')]],'as':_0x160160['as'],'attributes':_0x160160[_0xf54e('0x1a')],'include':_0x160160[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0x160160[_0xf54e('0x1c')],function(_0x39c0ae){return{'model':db[_0x39c0ae[_0xf54e('0x1e')]],'as':_0x39c0ae['as'],'attributes':_0x39c0ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xf54e('0xc')](function(_0x4cbf7c){logger[_0xf54e('0xd')]('GetSalesforceAccount',_0x15cc48);logger[_0xf54e('0x10')](_0xf54e('0x15'),_0x15cc48,JSON[_0xf54e('0x11')](_0x4cbf7c));_0x2e27b6(_0x4cbf7c);})[_0xf54e('0x1f')](function(_0x25b643){logger[_0xf54e('0x12')](_0xf54e('0x15'),_0x25b643['message'],_0x15cc48);_0x1ef06e(_0x3e7d96['error'](0x1f4,_0x25b643[_0xf54e('0x13')]));});});};exports[_0xf54e('0x20')]=function(_0x2ec92e){var _0x16d00f=this;return new Promise(function(_0xb2d4c4,_0x133cd7){return db[_0xf54e('0x16')][_0xf54e('0x21')]({'raw':_0x2ec92e[_0xf54e('0x18')]?_0x2ec92e[_0xf54e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ec92e['options']?_0x2ec92e[_0xf54e('0x18')][_0xf54e('0x19')]||null:null,'attributes':_0x2ec92e['options']?_0x2ec92e[_0xf54e('0x18')][_0xf54e('0x1a')]||null:null,'include':_0x2ec92e[_0xf54e('0x18')]?_0x2ec92e[_0xf54e('0x18')]['include']?_['map'](_0x2ec92e['options'][_0xf54e('0x1c')],function(_0xe7e042){return{'model':db[_0xe7e042[_0xf54e('0x1e')]],'as':_0xe7e042['as'],'attributes':_0xe7e042[_0xf54e('0x1a')],'include':_0xe7e042[_0xf54e('0x1c')]?_[_0xf54e('0x1d')](_0xe7e042['include'],function(_0x4aff8e){return{'model':db[_0x4aff8e['model']],'as':_0x4aff8e['as'],'attributes':_0x4aff8e[_0xf54e('0x1a')],'include':_0x4aff8e[_0xf54e('0x1c')]?_['map'](_0x4aff8e['include'],function(_0xda1d10){return{'model':db[_0xda1d10[_0xf54e('0x1e')]],'as':_0xda1d10['as'],'attributes':_0xda1d10[_0xf54e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14ecc8){logger[_0xf54e('0xd')]('ShowSalesforceAccount',_0x2ec92e);logger[_0xf54e('0x10')](_0xf54e('0x20'),_0x2ec92e,JSON[_0xf54e('0x11')](_0x14ecc8));_0xb2d4c4(_0x14ecc8);})[_0xf54e('0x1f')](function(_0x12ef97){logger[_0xf54e('0x12')]('ShowSalesforceAccount',_0x12ef97['message'],_0x2ec92e);_0x133cd7(_0x16d00f[_0xf54e('0x12')](0x1f4,_0x12ef97[_0xf54e('0x13')]));});});}; \ No newline at end of file +var _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','include','map','model','attributes','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xe205,0xa7));var _0x5e20=function(_0x2bf8ad,_0x10ba3e){_0x2bf8ad=_0x2bf8ad-0x0;var _0x3aac96=_0xe205[_0x2bf8ad];return _0x3aac96;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6ea7fbb..0e68909 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 _0xb326=['getSubjects','/:id/descriptions','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x208e68,_0x2f15a1){var _0x3e5c82=function(_0x5ec745){while(--_0x5ec745){_0x208e68['push'](_0x208e68['shift']());}};_0x3e5c82(++_0x2f15a1);}(_0xb326,0x157));var _0x6b32=function(_0x9e8135,_0x2bfb03){_0x9e8135=_0x9e8135-0x0;var _0xa3dacf=_0xb326[_0x9e8135];return _0xa3dacf;};'use strict';var multer=require('multer');var util=require(_0x6b32('0x0'));var path=require(_0x6b32('0x1'));var timeout=require(_0x6b32('0x2'));var express=require(_0x6b32('0x3'));var router=express[_0x6b32('0x4')]();var auth=require(_0x6b32('0x5'));var interaction=require(_0x6b32('0x6'));var config=require('../../config/environment');var controller=require(_0x6b32('0x7'));router[_0x6b32('0x8')]('/',auth[_0x6b32('0x9')](),controller[_0x6b32('0xa')]);router[_0x6b32('0x8')](_0x6b32('0xb'),auth[_0x6b32('0x9')](),controller[_0x6b32('0xc')]);router[_0x6b32('0x8')](_0x6b32('0xd'),auth[_0x6b32('0x9')](),controller['getFields']);router[_0x6b32('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x6b32('0xe')]);router[_0x6b32('0x8')](_0x6b32('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6b32('0x10')]('/',auth[_0x6b32('0x9')](),controller[_0x6b32('0x11')]);router[_0x6b32('0x12')](_0x6b32('0xb'),auth[_0x6b32('0x9')](),controller['update']);router[_0x6b32('0x13')](_0x6b32('0xb'),auth[_0x6b32('0x9')](),controller[_0x6b32('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdb03=['multer','util','connect-timeout','express','Router','../../components/interaction/service','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xdb03,0xdc));var _0x3db0=function(_0x32bfeb,_0x5b1392){_0x32bfeb=_0x32bfeb-0x0;var _0x229ced=_0xdb03[_0x32bfeb];return _0x229ced;};'use strict';var multer=require(_0x3db0('0x0'));var util=require(_0x3db0('0x1'));var path=require('path');var timeout=require(_0x3db0('0x2'));var express=require(_0x3db0('0x3'));var router=express[_0x3db0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3db0('0x5'));var config=require('../../config/environment');var controller=require(_0x3db0('0x6'));router[_0x3db0('0x7')]('/',auth['isAuthenticated'](),controller[_0x3db0('0x8')]);router[_0x3db0('0x7')](_0x3db0('0x9'),auth[_0x3db0('0xa')](),controller[_0x3db0('0xb')]);router['get'](_0x3db0('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x3db0('0xa')](),controller[_0x3db0('0xd')]);router[_0x3db0('0x7')](_0x3db0('0xe'),auth['isAuthenticated'](),controller[_0x3db0('0xf')]);router[_0x3db0('0x10')]('/',auth[_0x3db0('0xa')](),controller[_0x3db0('0x11')]);router[_0x3db0('0x12')](_0x3db0('0x9'),auth[_0x3db0('0xa')](),controller[_0x3db0('0x13')]);router[_0x3db0('0x14')]('/:id',auth[_0x3db0('0xa')](),controller['destroy']);module[_0x3db0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0b8e527..de7bb4b 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 _0x24e6=['Task','contact','contact_lead','nothing','lead','sequelize','exports','STRING','ENUM'];(function(_0x54d2bd,_0x57c539){var _0x34f0d4=function(_0x2e8bba){while(--_0x2e8bba){_0x54d2bd['push'](_0x54d2bd['shift']());}};_0x34f0d4(++_0x57c539);}(_0x24e6,0x1a3));var _0x624e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x24e6[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x624e('0x0'));module[_0x624e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x624e('0x2')]},'ticketType':{'type':Sequelize[_0x624e('0x3')](_0x624e('0x4'),'Case'),'defaultValue':_0x624e('0x4')},'moduleSearch':{'type':Sequelize[_0x624e('0x3')]('contact_lead',_0x624e('0x5'),'lead'),'defaultValue':_0x624e('0x6')},'moduleCreate':{'type':Sequelize[_0x624e('0x3')](_0x624e('0x7'),'contact',_0x624e('0x8')),'defaultValue':_0x624e('0x8')}}; \ No newline at end of file +var _0xe8a7=['contact','lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','nothing'];(function(_0xc62a35,_0x2bf3b3){var _0x14f7fa=function(_0x553cb1){while(--_0x553cb1){_0xc62a35['push'](_0xc62a35['shift']());}};_0x14f7fa(++_0x2bf3b3);}(_0xe8a7,0xfc));var _0x7e8a=function(_0x4f3001,_0x651650){_0x4f3001=_0x4f3001-0x0;var _0x464e18=_0xe8a7[_0x4f3001];return _0x464e18;};'use strict';var Sequelize=require(_0x7e8a('0x0'));module[_0x7e8a('0x1')]={'name':{'type':Sequelize[_0x7e8a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7e8a('0x3')](_0x7e8a('0x4'),_0x7e8a('0x5')),'defaultValue':_0x7e8a('0x4')},'moduleSearch':{'type':Sequelize[_0x7e8a('0x3')](_0x7e8a('0x6'),'contact','lead'),'defaultValue':_0x7e8a('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x7e8a('0x7'),_0x7e8a('0x8'),'lead'),'defaultValue':_0x7e8a('0x9')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 27079bc..767711f 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 _0x5010=['include','find','create','body','destroy','getFields','findOne','SalesforceField','length','sort','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','end','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','findAll','rows','show','params','SalesforceConfiguration'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x5010,0x1c9));var _0x0501=function(_0x25f4c1,_0xb8af38){_0x25f4c1=_0x25f4c1-0x0;var _0x498b1e=_0x5010[_0x25f4c1];return _0x498b1e;};'use strict';var pdf=require(_0x0501('0x0'));var emlformat=require(_0x0501('0x1'));var rimraf=require(_0x0501('0x2'));var zipdir=require(_0x0501('0x3'));var jsonpatch=require(_0x0501('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0501('0x5'));var Mustache=require(_0x0501('0x6'));var util=require(_0x0501('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0501('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0501('0x9'));var jsforce=require(_0x0501('0xa'));var deskjs=require(_0x0501('0xb'));var toCsv=require(_0x0501('0xc'));var querystring=require(_0x0501('0xd'));var Papa=require('papaparse');var Redis=require(_0x0501('0xe'));var authService=require(_0x0501('0xf'));var qs=require(_0x0501('0x10'));var as=require(_0x0501('0x11'));var hardwareService=require(_0x0501('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0501('0x13'));var db=require(_0x0501('0x14'))['db'];var jayson=require(_0x0501('0x15'));var client=jayson[_0x0501('0x16')][_0x0501('0x17')]({'port':0x232a});function checkPasswordPattern(_0xad1ce9,_0x13dae1,_0x5b6d26){if(_0x5b6d26){var _0x41951c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41951c['test'](_0x13dae1)){return _0xad1ce9;}else{throw new db[(_0x0501('0x18'))][(_0x0501('0x19'))](_0x0501('0x1a'));}}else{return _0xad1ce9;}}function respondWithRpcPromise(_0x2519dc,_0x1d1ac1,_0x37ed7d,_0x30fbe6){return new BPromise(function(_0x2e34e4,_0x19719b){var _0x2986b7=_0x30fbe6||client;return _0x2986b7[_0x0501('0x1b')](_0x2519dc,_0x37ed7d)['then'](function(_0xe7d2c4){logger[_0x0501('0x1c')](_0x0501('0x1d'),_0x1d1ac1,_0x0501('0x1e'));logger[_0x0501('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1d1ac1,_0x0501('0x1e'),JSON[_0x0501('0x20')](_0xe7d2c4));if(_0xe7d2c4[_0x0501('0x21')]){if(_0xe7d2c4[_0x0501('0x21')][_0x0501('0x22')]===0x1f4){logger[_0x0501('0x21')](_0x0501('0x1d'),_0x1d1ac1,_0xe7d2c4[_0x0501('0x21')][_0x0501('0x23')]);return _0x19719b(_0xe7d2c4[_0x0501('0x21')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d1ac1,_0xe7d2c4['error'][_0x0501('0x23')]);return _0x2e34e4(_0xe7d2c4[_0x0501('0x21')][_0x0501('0x23')]);}else{logger['info'](_0x0501('0x1d'),_0x1d1ac1,_0x0501('0x1e'));_0x2e34e4(_0xe7d2c4[_0x0501('0x24')]['message']);}})[_0x0501('0x25')](function(_0x2c9fa8){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d1ac1,_0x2c9fa8);_0x19719b(_0x2c9fa8);});});}function respondWithStatusCode(_0x208d8d,_0x169ac1){_0x169ac1=_0x169ac1||0xcc;return function(_0x4b76a8){if(_0x4b76a8){return _0x208d8d[_0x0501('0x26')](_0x169ac1);}return _0x208d8d[_0x0501('0x27')](_0x169ac1)['end']();};}function respondWithResult(_0x585c61,_0x5973d3){_0x5973d3=_0x5973d3||0xc8;return function(_0x54c525){if(_0x54c525){return _0x585c61['status'](_0x5973d3)[_0x0501('0x28')](_0x54c525);}};}function respondWithFilteredResult(_0x5d0db7,_0x28762c){return function(_0x42b06e){if(_0x42b06e){var _0x216157=_0x42b06e[_0x0501('0x29')],_0x29cbb4=_0x28762c[_0x0501('0x2a')],_0x9e4803=_0x28762c[_0x0501('0x2a')]+_0x28762c[_0x0501('0x2b')],_0x532525;if(_0x9e4803>=_0x216157){_0x9e4803=_0x216157;_0x532525=0xc8;}else{_0x532525=0xce;}_0x5d0db7[_0x0501('0x27')](_0x532525);return _0x5d0db7[_0x0501('0x2c')]('Content-Range',_0x29cbb4+'-'+_0x9e4803+'/'+_0x216157)['json'](_0x42b06e);}return null;};}function patchUpdates(_0x36b954){return function(_0x164a3d){try{jsonpatch[_0x0501('0x2d')](_0x164a3d,_0x36b954,!![]);}catch(_0x3e4ba2){return BPromise['reject'](_0x3e4ba2);}return _0x164a3d[_0x0501('0x2e')]();};}function saveUpdates(_0x49054f,_0xe6d482){return function(_0x122755){if(_0x122755){return _0x122755[_0x0501('0x2f')](_0x49054f)[_0x0501('0x30')](function(_0x2255da){return _0x2255da;});}return null;};}function removeEntity(_0x382e95,_0x4e443a){return function(_0xe1ea88){if(_0xe1ea88){return _0xe1ea88['destroy']()[_0x0501('0x30')](function(){_0x382e95[_0x0501('0x27')](0xcc)[_0x0501('0x31')]();});}};}function handleEntityNotFound(_0x4c09bd,_0x2b6314){return function(_0x262319){if(!_0x262319){_0x4c09bd[_0x0501('0x26')](0x194);}return _0x262319;};}function handleError(_0x1fd04d,_0x3e672a){_0x3e672a=_0x3e672a||0x1f4;return function(_0x4ffc38){logger[_0x0501('0x21')](_0x4ffc38['stack']);if(_0x4ffc38[_0x0501('0x32')]){delete _0x4ffc38[_0x0501('0x32')];}_0x1fd04d[_0x0501('0x27')](_0x3e672a)['send'](_0x4ffc38);};}exports[_0x0501('0x33')]=function(_0x27d211,_0x365397){var _0xbf95f0={},_0x4da991={},_0x3a5417={'count':0x0,'rows':[]};var _0x4fef13=_['map'](db['SalesforceConfiguration'][_0x0501('0x34')],function(_0x3bb9a9){return{'name':_0x3bb9a9[_0x0501('0x35')],'type':_0x3bb9a9[_0x0501('0x36')][_0x0501('0x37')]};});_0x4da991['model']=_[_0x0501('0x38')](_0x4fef13,_0x0501('0x32'));_0x4da991[_0x0501('0x39')]=_[_0x0501('0x3a')](_0x27d211[_0x0501('0x39')]);_0x4da991[_0x0501('0x3b')]=_[_0x0501('0x3c')](_0x4da991[_0x0501('0x3d')],_0x4da991[_0x0501('0x39')]);_0xbf95f0[_0x0501('0x3e')]=_[_0x0501('0x3c')](_0x4da991[_0x0501('0x3d')],qs[_0x0501('0x3f')](_0x27d211[_0x0501('0x39')][_0x0501('0x3f')]));_0xbf95f0[_0x0501('0x3e')]=_0xbf95f0[_0x0501('0x3e')]['length']?_0xbf95f0['attributes']:_0x4da991['model'];if(!_0x27d211[_0x0501('0x39')][_0x0501('0x40')](_0x0501('0x41'))){_0xbf95f0[_0x0501('0x2b')]=qs[_0x0501('0x2b')](_0x27d211[_0x0501('0x39')][_0x0501('0x2b')]);_0xbf95f0[_0x0501('0x2a')]=qs[_0x0501('0x2a')](_0x27d211[_0x0501('0x39')][_0x0501('0x2a')]);}_0xbf95f0[_0x0501('0x42')]=qs['sort'](_0x27d211[_0x0501('0x39')]['sort']);_0xbf95f0[_0x0501('0x43')]=qs[_0x0501('0x3b')](_[_0x0501('0x44')](_0x27d211[_0x0501('0x39')],_0x4da991['filters']),_0x4fef13);if(_0x27d211[_0x0501('0x39')]['filter']){_0xbf95f0[_0x0501('0x43')]=_[_0x0501('0x45')](_0xbf95f0[_0x0501('0x43')],{'$or':_[_0x0501('0x38')](_0x4fef13,function(_0x1251f1){if(_0x1251f1[_0x0501('0x36')]!=='VIRTUAL'){var _0x88b3b5={};_0x88b3b5[_0x1251f1[_0x0501('0x32')]]={'$like':'%'+_0x27d211[_0x0501('0x39')][_0x0501('0x46')]+'%'};return _0x88b3b5;}})});}_0xbf95f0=_['merge']({},_0xbf95f0,_0x27d211[_0x0501('0x47')]);var _0xe15324={'where':_0xbf95f0[_0x0501('0x43')]};return db['SalesforceConfiguration'][_0x0501('0x29')](_0xe15324)['then'](function(_0x567110){_0x3a5417[_0x0501('0x29')]=_0x567110;if(_0x27d211['query']['includeAll']){_0xbf95f0['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x0501('0x48')](_0xbf95f0);})[_0x0501('0x30')](function(_0xfe59f9){_0x3a5417[_0x0501('0x49')]=_0xfe59f9;return _0x3a5417;})['then'](respondWithFilteredResult(_0x365397,_0xbf95f0))[_0x0501('0x25')](handleError(_0x365397,null));};exports[_0x0501('0x4a')]=function(_0x1cb032,_0x5b32f6){var _0x54b865={'raw':![],'where':{'id':_0x1cb032[_0x0501('0x4b')]['id']}},_0x2a3d59={};_0x2a3d59['model']=_['keys'](db[_0x0501('0x4c')][_0x0501('0x34')]);_0x2a3d59[_0x0501('0x39')]=_['keys'](_0x1cb032[_0x0501('0x39')]);_0x2a3d59['filters']=_[_0x0501('0x3c')](_0x2a3d59[_0x0501('0x3d')],_0x2a3d59[_0x0501('0x39')]);_0x54b865[_0x0501('0x3e')]=_[_0x0501('0x3c')](_0x2a3d59[_0x0501('0x3d')],qs[_0x0501('0x3f')](_0x1cb032[_0x0501('0x39')][_0x0501('0x3f')]));_0x54b865[_0x0501('0x3e')]=_0x54b865['attributes']['length']?_0x54b865[_0x0501('0x3e')]:_0x2a3d59['model'];if(_0x1cb032[_0x0501('0x39')]['includeAll']){_0x54b865[_0x0501('0x4d')]=[{'all':!![]}];}_0x54b865=_[_0x0501('0x45')]({},_0x54b865,_0x1cb032[_0x0501('0x47')]);return db['SalesforceConfiguration'][_0x0501('0x4e')](_0x54b865)[_0x0501('0x30')](handleEntityNotFound(_0x5b32f6,null))[_0x0501('0x30')](respondWithResult(_0x5b32f6,null))[_0x0501('0x25')](handleError(_0x5b32f6,null));};exports[_0x0501('0x4f')]=function(_0x1fba80,_0x4b1cd8){return db['SalesforceConfiguration'][_0x0501('0x4f')](_0x1fba80[_0x0501('0x50')],{})[_0x0501('0x30')](respondWithResult(_0x4b1cd8,0xc9))[_0x0501('0x25')](handleError(_0x4b1cd8,null));};exports[_0x0501('0x2f')]=function(_0x1b6f35,_0xe0117e){if(_0x1b6f35[_0x0501('0x50')]['id']){delete _0x1b6f35[_0x0501('0x50')]['id'];}return db[_0x0501('0x4c')]['find']({'where':{'id':_0x1b6f35['params']['id']}})[_0x0501('0x30')](handleEntityNotFound(_0xe0117e,null))[_0x0501('0x30')](saveUpdates(_0x1b6f35[_0x0501('0x50')],null))[_0x0501('0x30')](respondWithResult(_0xe0117e,null))[_0x0501('0x25')](handleError(_0xe0117e,null));};exports[_0x0501('0x51')]=function(_0x577025,_0x1032db){return db[_0x0501('0x4c')][_0x0501('0x4e')]({'where':{'id':_0x577025['params']['id']}})[_0x0501('0x30')](handleEntityNotFound(_0x1032db,null))[_0x0501('0x30')](removeEntity(_0x1032db,null))[_0x0501('0x25')](handleError(_0x1032db,null));};exports[_0x0501('0x52')]=function(_0x330500,_0x1afb8a,_0x1d6686){var _0x3e5e31={};var _0x21d7e0={};var _0x5e4b9e;var _0x52d766;return db[_0x0501('0x4c')][_0x0501('0x53')]({'where':{'id':_0x330500['params']['id']}})[_0x0501('0x30')](handleEntityNotFound(_0x1afb8a,null))['then'](function(_0x4f746d){if(_0x4f746d){_0x5e4b9e=_0x4f746d;_0x21d7e0['model']=_[_0x0501('0x3a')](db[_0x0501('0x54')]['rawAttributes']);_0x21d7e0[_0x0501('0x39')]=_[_0x0501('0x3a')](_0x330500['query']);_0x21d7e0['filters']=_[_0x0501('0x3c')](_0x21d7e0[_0x0501('0x3d')],_0x21d7e0[_0x0501('0x39')]);_0x3e5e31['attributes']=_[_0x0501('0x3c')](_0x21d7e0[_0x0501('0x3d')],qs['fields'](_0x330500[_0x0501('0x39')]['fields']));_0x3e5e31['attributes']=_0x3e5e31['attributes'][_0x0501('0x55')]?_0x3e5e31[_0x0501('0x3e')]:_0x21d7e0[_0x0501('0x3d')];_0x3e5e31[_0x0501('0x42')]=qs['sort'](_0x330500[_0x0501('0x39')][_0x0501('0x56')]);_0x3e5e31[_0x0501('0x43')]=qs[_0x0501('0x3b')](_[_0x0501('0x44')](_0x330500['query'],_0x21d7e0[_0x0501('0x3b')]));if(_0x330500[_0x0501('0x39')]['filter']){_0x3e5e31['where']=_[_0x0501('0x45')](_0x3e5e31[_0x0501('0x43')],{'$or':_[_0x0501('0x38')](_0x3e5e31[_0x0501('0x3e')],function(_0x32a2e9){var _0x2a7b0d={};_0x2a7b0d[_0x32a2e9]={'$like':'%'+_0x330500[_0x0501('0x39')][_0x0501('0x46')]+'%'};return _0x2a7b0d;})});}_0x3e5e31=_[_0x0501('0x45')]({},_0x3e5e31,_0x330500[_0x0501('0x47')]);return _0x5e4b9e['getFields'](_0x3e5e31);}})[_0x0501('0x30')](function(_0xbd7ed0){if(_0xbd7ed0){_0x52d766=_0xbd7ed0[_0x0501('0x55')];if(!_0x330500['query'][_0x0501('0x40')](_0x0501('0x41'))){_0x3e5e31[_0x0501('0x2b')]=qs['limit'](_0x330500[_0x0501('0x39')][_0x0501('0x2b')]);_0x3e5e31[_0x0501('0x2a')]=qs[_0x0501('0x2a')](_0x330500[_0x0501('0x39')][_0x0501('0x2a')]);}return _0x5e4b9e[_0x0501('0x52')](_0x3e5e31);}})[_0x0501('0x30')](function(_0x26638d){if(_0x26638d){return _0x26638d?{'count':_0x52d766,'rows':_0x26638d}:null;}})[_0x0501('0x30')](respondWithResult(_0x1afb8a,null))[_0x0501('0x25')](handleError(_0x1afb8a,null));};exports['getSubjects']=function(_0x1c8a57,_0x3e50c1,_0x52fe29){var _0x2549df={};var _0x30b880={};var _0x117f38;var _0xb66b74;return db[_0x0501('0x4c')][_0x0501('0x53')]({'where':{'id':_0x1c8a57['params']['id']}})['then'](handleEntityNotFound(_0x3e50c1,null))[_0x0501('0x30')](function(_0x3ddc66){if(_0x3ddc66){_0x117f38=_0x3ddc66;_0x30b880[_0x0501('0x3d')]=_[_0x0501('0x3a')](db[_0x0501('0x54')][_0x0501('0x34')]);_0x30b880[_0x0501('0x39')]=_[_0x0501('0x3a')](_0x1c8a57['query']);_0x30b880['filters']=_[_0x0501('0x3c')](_0x30b880[_0x0501('0x3d')],_0x30b880[_0x0501('0x39')]);_0x2549df['attributes']=_[_0x0501('0x3c')](_0x30b880[_0x0501('0x3d')],qs['fields'](_0x1c8a57[_0x0501('0x39')][_0x0501('0x3f')]));_0x2549df['attributes']=_0x2549df[_0x0501('0x3e')]['length']?_0x2549df[_0x0501('0x3e')]:_0x30b880[_0x0501('0x3d')];_0x2549df[_0x0501('0x42')]=qs[_0x0501('0x56')](_0x1c8a57[_0x0501('0x39')]['sort']);_0x2549df[_0x0501('0x43')]=qs[_0x0501('0x3b')](_[_0x0501('0x44')](_0x1c8a57[_0x0501('0x39')],_0x30b880[_0x0501('0x3b')]));if(_0x1c8a57[_0x0501('0x39')][_0x0501('0x46')]){_0x2549df[_0x0501('0x43')]=_[_0x0501('0x45')](_0x2549df[_0x0501('0x43')],{'$or':_[_0x0501('0x38')](_0x2549df[_0x0501('0x3e')],function(_0x5b9556){var _0x464fbe={};_0x464fbe[_0x5b9556]={'$like':'%'+_0x1c8a57[_0x0501('0x39')][_0x0501('0x46')]+'%'};return _0x464fbe;})});}_0x2549df=_[_0x0501('0x45')]({},_0x2549df,_0x1c8a57[_0x0501('0x47')]);return _0x117f38[_0x0501('0x57')](_0x2549df);}})[_0x0501('0x30')](function(_0x211c2d){if(_0x211c2d){_0xb66b74=_0x211c2d['length'];if(!_0x1c8a57[_0x0501('0x39')]['hasOwnProperty'](_0x0501('0x41'))){_0x2549df[_0x0501('0x2b')]=qs[_0x0501('0x2b')](_0x1c8a57[_0x0501('0x39')][_0x0501('0x2b')]);_0x2549df[_0x0501('0x2a')]=qs[_0x0501('0x2a')](_0x1c8a57[_0x0501('0x39')]['offset']);}return _0x117f38['getSubjects'](_0x2549df);}})[_0x0501('0x30')](function(_0x47804f){if(_0x47804f){return _0x47804f?{'count':_0xb66b74,'rows':_0x47804f}:null;}})[_0x0501('0x30')](respondWithResult(_0x3e50c1,null))[_0x0501('0x25')](handleError(_0x3e50c1,null));};exports[_0x0501('0x58')]=function(_0x498120,_0x157ffa,_0x30470e){var _0xbc92f7={};var _0x2af0d8={};var _0x3e3c79;var _0x331c6e;return db[_0x0501('0x4c')][_0x0501('0x53')]({'where':{'id':_0x498120[_0x0501('0x4b')]['id']}})[_0x0501('0x30')](handleEntityNotFound(_0x157ffa,null))['then'](function(_0x78cd5d){if(_0x78cd5d){_0x3e3c79=_0x78cd5d;_0x2af0d8['model']=_[_0x0501('0x3a')](db[_0x0501('0x54')]['rawAttributes']);_0x2af0d8[_0x0501('0x39')]=_[_0x0501('0x3a')](_0x498120[_0x0501('0x39')]);_0x2af0d8[_0x0501('0x3b')]=_['intersection'](_0x2af0d8[_0x0501('0x3d')],_0x2af0d8[_0x0501('0x39')]);_0xbc92f7['attributes']=_[_0x0501('0x3c')](_0x2af0d8[_0x0501('0x3d')],qs[_0x0501('0x3f')](_0x498120[_0x0501('0x39')][_0x0501('0x3f')]));_0xbc92f7[_0x0501('0x3e')]=_0xbc92f7['attributes'][_0x0501('0x55')]?_0xbc92f7[_0x0501('0x3e')]:_0x2af0d8[_0x0501('0x3d')];_0xbc92f7['order']=qs[_0x0501('0x56')](_0x498120[_0x0501('0x39')][_0x0501('0x56')]);_0xbc92f7['where']=qs[_0x0501('0x3b')](_[_0x0501('0x44')](_0x498120[_0x0501('0x39')],_0x2af0d8[_0x0501('0x3b')]));if(_0x498120[_0x0501('0x39')][_0x0501('0x46')]){_0xbc92f7['where']=_['merge'](_0xbc92f7['where'],{'$or':_[_0x0501('0x38')](_0xbc92f7[_0x0501('0x3e')],function(_0x5dd542){var _0x5dcad8={};_0x5dcad8[_0x5dd542]={'$like':'%'+_0x498120[_0x0501('0x39')][_0x0501('0x46')]+'%'};return _0x5dcad8;})});}_0xbc92f7=_['merge']({},_0xbc92f7,_0x498120['options']);return _0x3e3c79[_0x0501('0x58')](_0xbc92f7);}})[_0x0501('0x30')](function(_0x38bb48){if(_0x38bb48){_0x331c6e=_0x38bb48[_0x0501('0x55')];if(!_0x498120[_0x0501('0x39')]['hasOwnProperty']('nolimit')){_0xbc92f7[_0x0501('0x2b')]=qs[_0x0501('0x2b')](_0x498120['query']['limit']);_0xbc92f7[_0x0501('0x2a')]=qs[_0x0501('0x2a')](_0x498120[_0x0501('0x39')][_0x0501('0x2a')]);}return _0x3e3c79[_0x0501('0x58')](_0xbc92f7);}})[_0x0501('0x30')](function(_0x47e537){if(_0x47e537){return _0x47e537?{'count':_0x331c6e,'rows':_0x47e537}:null;}})[_0x0501('0x30')](respondWithResult(_0x157ffa,null))[_0x0501('0x25')](handleError(_0x157ffa,null));}; \ No newline at end of file +var _0x8275=['stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','SalesforceConfiguration','includeAll','include','findAll','show','options','find','create','body','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x8275,0x87));var _0x5827=function(_0x56bb9c,_0x5f1c07){_0x56bb9c=_0x56bb9c-0x0;var _0x1afda4=_0x8275[_0x56bb9c];return _0x1afda4;};'use strict';var pdf=require(_0x5827('0x0'));var emlformat=require(_0x5827('0x1'));var rimraf=require(_0x5827('0x2'));var zipdir=require(_0x5827('0x3'));var jsonpatch=require(_0x5827('0x4'));var rp=require(_0x5827('0x5'));var moment=require(_0x5827('0x6'));var BPromise=require(_0x5827('0x7'));var Mustache=require('mustache');var util=require(_0x5827('0x8'));var path=require('path');var sox=require(_0x5827('0x9'));var csv=require(_0x5827('0xa'));var ejs=require(_0x5827('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5827('0xc'));var crypto=require('crypto');var jsforce=require(_0x5827('0xd'));var deskjs=require(_0x5827('0xe'));var toCsv=require(_0x5827('0xa'));var querystring=require('querystring');var Papa=require(_0x5827('0xf'));var Redis=require(_0x5827('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5827('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5827('0x12'))(_0x5827('0x13'));var utils=require(_0x5827('0x14'));var config=require(_0x5827('0x15'));var db=require(_0x5827('0x16'))['db'];var jayson=require(_0x5827('0x17'));var client=jayson[_0x5827('0x18')][_0x5827('0x19')]({'port':0x232a});function checkPasswordPattern(_0x81b319,_0x3f46c6,_0x433ce1){if(_0x433ce1){var _0x2c7f85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c7f85['test'](_0x3f46c6)){return _0x81b319;}else{throw new db[(_0x5827('0x1a'))][(_0x5827('0x1b'))](_0x5827('0x1c'));}}else{return _0x81b319;}}function respondWithRpcPromise(_0x1bf5db,_0x168a73,_0x25d131,_0x273188){return new BPromise(function(_0x1db953,_0x5c3756){var _0x24b319=_0x273188||client;return _0x24b319[_0x5827('0x1d')](_0x1bf5db,_0x25d131)[_0x5827('0x1e')](function(_0x19e552){logger[_0x5827('0x1f')](_0x5827('0x20'),_0x168a73,_0x5827('0x21'));logger['debug'](_0x5827('0x22'),_0x168a73,_0x5827('0x21'),JSON[_0x5827('0x23')](_0x19e552));if(_0x19e552[_0x5827('0x24')]){if(_0x19e552[_0x5827('0x24')][_0x5827('0x25')]===0x1f4){logger[_0x5827('0x24')]('SalesforceConfiguration,\x20%s,\x20%s',_0x168a73,_0x19e552[_0x5827('0x24')][_0x5827('0x26')]);return _0x5c3756(_0x19e552[_0x5827('0x24')][_0x5827('0x26')]);}logger[_0x5827('0x24')](_0x5827('0x20'),_0x168a73,_0x19e552['error'][_0x5827('0x26')]);return _0x1db953(_0x19e552[_0x5827('0x24')][_0x5827('0x26')]);}else{logger[_0x5827('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x168a73,_0x5827('0x21'));_0x1db953(_0x19e552[_0x5827('0x27')][_0x5827('0x26')]);}})[_0x5827('0x28')](function(_0x272358){logger[_0x5827('0x24')](_0x5827('0x20'),_0x168a73,_0x272358);_0x5c3756(_0x272358);});});}function respondWithStatusCode(_0x1c549c,_0x313bc4){_0x313bc4=_0x313bc4||0xcc;return function(_0x438765){if(_0x438765){return _0x1c549c[_0x5827('0x29')](_0x313bc4);}return _0x1c549c[_0x5827('0x2a')](_0x313bc4)[_0x5827('0x2b')]();};}function respondWithResult(_0x28c2af,_0x9c5aee){_0x9c5aee=_0x9c5aee||0xc8;return function(_0x30f3b7){if(_0x30f3b7){return _0x28c2af['status'](_0x9c5aee)[_0x5827('0x2c')](_0x30f3b7);}};}function respondWithFilteredResult(_0x1ab5ce,_0x139fe5){return function(_0x5cf07c){if(_0x5cf07c){var _0x4fb7ed=_0x5cf07c[_0x5827('0x2d')],_0x319adf=_0x139fe5[_0x5827('0x2e')],_0x182698=_0x139fe5[_0x5827('0x2e')]+_0x139fe5[_0x5827('0x2f')],_0x14194d;if(_0x182698>=_0x4fb7ed){_0x182698=_0x4fb7ed;_0x14194d=0xc8;}else{_0x14194d=0xce;}_0x1ab5ce[_0x5827('0x2a')](_0x14194d);return _0x1ab5ce[_0x5827('0x30')](_0x5827('0x31'),_0x319adf+'-'+_0x182698+'/'+_0x4fb7ed)['json'](_0x5cf07c);}return null;};}function patchUpdates(_0x38203e){return function(_0x5d5cf0){try{jsonpatch[_0x5827('0x32')](_0x5d5cf0,_0x38203e,!![]);}catch(_0x46e458){return BPromise['reject'](_0x46e458);}return _0x5d5cf0[_0x5827('0x33')]();};}function saveUpdates(_0x30ccbe,_0x48268b){return function(_0x160913){if(_0x160913){return _0x160913['update'](_0x30ccbe)['then'](function(_0x1f74fa){return _0x1f74fa;});}return null;};}function removeEntity(_0x104e74,_0x26f600){return function(_0x4401f9){if(_0x4401f9){return _0x4401f9[_0x5827('0x34')]()[_0x5827('0x1e')](function(){_0x104e74[_0x5827('0x2a')](0xcc)[_0x5827('0x2b')]();});}};}function handleEntityNotFound(_0x45ec58,_0x5dc4c9){return function(_0x398173){if(!_0x398173){_0x45ec58[_0x5827('0x29')](0x194);}return _0x398173;};}function handleError(_0x316798,_0x4d8173){_0x4d8173=_0x4d8173||0x1f4;return function(_0x98f1c0){logger[_0x5827('0x24')](_0x98f1c0[_0x5827('0x35')]);if(_0x98f1c0['name']){delete _0x98f1c0[_0x5827('0x36')];}_0x316798['status'](_0x4d8173)[_0x5827('0x37')](_0x98f1c0);};}exports[_0x5827('0x38')]=function(_0x56d4ee,_0x4abb2e){var _0x281ef9={},_0x213c2f={},_0x184731={'count':0x0,'rows':[]};var _0x4eded1=_['map'](db['SalesforceConfiguration'][_0x5827('0x39')],function(_0x4673ea){return{'name':_0x4673ea[_0x5827('0x3a')],'type':_0x4673ea[_0x5827('0x3b')][_0x5827('0x3c')]};});_0x213c2f[_0x5827('0x3d')]=_['map'](_0x4eded1,_0x5827('0x36'));_0x213c2f[_0x5827('0x3e')]=_[_0x5827('0x3f')](_0x56d4ee[_0x5827('0x3e')]);_0x213c2f[_0x5827('0x40')]=_[_0x5827('0x41')](_0x213c2f[_0x5827('0x3d')],_0x213c2f['query']);_0x281ef9['attributes']=_[_0x5827('0x41')](_0x213c2f[_0x5827('0x3d')],qs[_0x5827('0x42')](_0x56d4ee[_0x5827('0x3e')][_0x5827('0x42')]));_0x281ef9[_0x5827('0x43')]=_0x281ef9[_0x5827('0x43')][_0x5827('0x44')]?_0x281ef9[_0x5827('0x43')]:_0x213c2f[_0x5827('0x3d')];if(!_0x56d4ee[_0x5827('0x3e')][_0x5827('0x45')](_0x5827('0x46'))){_0x281ef9['limit']=qs['limit'](_0x56d4ee[_0x5827('0x3e')][_0x5827('0x2f')]);_0x281ef9[_0x5827('0x2e')]=qs[_0x5827('0x2e')](_0x56d4ee[_0x5827('0x3e')][_0x5827('0x2e')]);}_0x281ef9[_0x5827('0x47')]=qs['sort'](_0x56d4ee[_0x5827('0x3e')][_0x5827('0x48')]);_0x281ef9[_0x5827('0x49')]=qs[_0x5827('0x40')](_[_0x5827('0x4a')](_0x56d4ee[_0x5827('0x3e')],_0x213c2f[_0x5827('0x40')]),_0x4eded1);if(_0x56d4ee[_0x5827('0x3e')][_0x5827('0x4b')]){_0x281ef9['where']=_['merge'](_0x281ef9['where'],{'$or':_[_0x5827('0x4c')](_0x4eded1,function(_0x57c1b1){if(_0x57c1b1[_0x5827('0x3b')]!==_0x5827('0x4d')){var _0x955195={};_0x955195[_0x57c1b1[_0x5827('0x36')]]={'$like':'%'+_0x56d4ee[_0x5827('0x3e')][_0x5827('0x4b')]+'%'};return _0x955195;}})});}_0x281ef9=_[_0x5827('0x4e')]({},_0x281ef9,_0x56d4ee['options']);var _0x215747={'where':_0x281ef9[_0x5827('0x49')]};return db[_0x5827('0x4f')][_0x5827('0x2d')](_0x215747)[_0x5827('0x1e')](function(_0x5d7bf3){_0x184731[_0x5827('0x2d')]=_0x5d7bf3;if(_0x56d4ee[_0x5827('0x3e')][_0x5827('0x50')]){_0x281ef9[_0x5827('0x51')]=[{'all':!![]}];}return db[_0x5827('0x4f')][_0x5827('0x52')](_0x281ef9);})[_0x5827('0x1e')](function(_0x309576){_0x184731['rows']=_0x309576;return _0x184731;})[_0x5827('0x1e')](respondWithFilteredResult(_0x4abb2e,_0x281ef9))[_0x5827('0x28')](handleError(_0x4abb2e,null));};exports[_0x5827('0x53')]=function(_0x40b53e,_0x527758){var _0x4866c2={'raw':![],'where':{'id':_0x40b53e['params']['id']}},_0x234a1d={};_0x234a1d[_0x5827('0x3d')]=_[_0x5827('0x3f')](db[_0x5827('0x4f')]['rawAttributes']);_0x234a1d['query']=_[_0x5827('0x3f')](_0x40b53e[_0x5827('0x3e')]);_0x234a1d[_0x5827('0x40')]=_['intersection'](_0x234a1d[_0x5827('0x3d')],_0x234a1d['query']);_0x4866c2[_0x5827('0x43')]=_[_0x5827('0x41')](_0x234a1d[_0x5827('0x3d')],qs[_0x5827('0x42')](_0x40b53e['query']['fields']));_0x4866c2[_0x5827('0x43')]=_0x4866c2[_0x5827('0x43')][_0x5827('0x44')]?_0x4866c2[_0x5827('0x43')]:_0x234a1d[_0x5827('0x3d')];if(_0x40b53e['query'][_0x5827('0x50')]){_0x4866c2[_0x5827('0x51')]=[{'all':!![]}];}_0x4866c2=_['merge']({},_0x4866c2,_0x40b53e[_0x5827('0x54')]);return db['SalesforceConfiguration'][_0x5827('0x55')](_0x4866c2)[_0x5827('0x1e')](handleEntityNotFound(_0x527758,null))['then'](respondWithResult(_0x527758,null))[_0x5827('0x28')](handleError(_0x527758,null));};exports[_0x5827('0x56')]=function(_0x24dbab,_0x1c6494){return db[_0x5827('0x4f')][_0x5827('0x56')](_0x24dbab[_0x5827('0x57')],{})['then'](respondWithResult(_0x1c6494,0xc9))['catch'](handleError(_0x1c6494,null));};exports['update']=function(_0x9268f3,_0x506659){if(_0x9268f3[_0x5827('0x57')]['id']){delete _0x9268f3[_0x5827('0x57')]['id'];}return db[_0x5827('0x4f')][_0x5827('0x55')]({'where':{'id':_0x9268f3[_0x5827('0x58')]['id']}})[_0x5827('0x1e')](handleEntityNotFound(_0x506659,null))[_0x5827('0x1e')](saveUpdates(_0x9268f3[_0x5827('0x57')],null))[_0x5827('0x1e')](respondWithResult(_0x506659,null))['catch'](handleError(_0x506659,null));};exports[_0x5827('0x34')]=function(_0x4ac26c,_0x5cec97){return db[_0x5827('0x4f')]['find']({'where':{'id':_0x4ac26c['params']['id']}})[_0x5827('0x1e')](handleEntityNotFound(_0x5cec97,null))[_0x5827('0x1e')](removeEntity(_0x5cec97,null))[_0x5827('0x28')](handleError(_0x5cec97,null));};exports[_0x5827('0x59')]=function(_0x341ec8,_0x55c16f,_0x522e93){var _0x3af542={};var _0x288abb={};var _0x3b0599;var _0x55a663;return db[_0x5827('0x4f')][_0x5827('0x5a')]({'where':{'id':_0x341ec8[_0x5827('0x58')]['id']}})[_0x5827('0x1e')](handleEntityNotFound(_0x55c16f,null))[_0x5827('0x1e')](function(_0x1107dc){if(_0x1107dc){_0x3b0599=_0x1107dc;_0x288abb['model']=_[_0x5827('0x3f')](db[_0x5827('0x5b')][_0x5827('0x39')]);_0x288abb[_0x5827('0x3e')]=_['keys'](_0x341ec8[_0x5827('0x3e')]);_0x288abb['filters']=_[_0x5827('0x41')](_0x288abb[_0x5827('0x3d')],_0x288abb['query']);_0x3af542[_0x5827('0x43')]=_[_0x5827('0x41')](_0x288abb['model'],qs['fields'](_0x341ec8['query'][_0x5827('0x42')]));_0x3af542[_0x5827('0x43')]=_0x3af542['attributes'][_0x5827('0x44')]?_0x3af542['attributes']:_0x288abb[_0x5827('0x3d')];_0x3af542[_0x5827('0x47')]=qs[_0x5827('0x48')](_0x341ec8['query'][_0x5827('0x48')]);_0x3af542[_0x5827('0x49')]=qs[_0x5827('0x40')](_[_0x5827('0x4a')](_0x341ec8[_0x5827('0x3e')],_0x288abb['filters']));if(_0x341ec8[_0x5827('0x3e')][_0x5827('0x4b')]){_0x3af542['where']=_['merge'](_0x3af542[_0x5827('0x49')],{'$or':_[_0x5827('0x4c')](_0x3af542[_0x5827('0x43')],function(_0x2691a2){var _0x52b90f={};_0x52b90f[_0x2691a2]={'$like':'%'+_0x341ec8[_0x5827('0x3e')][_0x5827('0x4b')]+'%'};return _0x52b90f;})});}_0x3af542=_['merge']({},_0x3af542,_0x341ec8['options']);return _0x3b0599[_0x5827('0x59')](_0x3af542);}})[_0x5827('0x1e')](function(_0x1ef39b){if(_0x1ef39b){_0x55a663=_0x1ef39b[_0x5827('0x44')];if(!_0x341ec8[_0x5827('0x3e')]['hasOwnProperty'](_0x5827('0x46'))){_0x3af542['limit']=qs['limit'](_0x341ec8[_0x5827('0x3e')]['limit']);_0x3af542[_0x5827('0x2e')]=qs[_0x5827('0x2e')](_0x341ec8[_0x5827('0x3e')][_0x5827('0x2e')]);}return _0x3b0599['getFields'](_0x3af542);}})[_0x5827('0x1e')](function(_0x5eaba9){if(_0x5eaba9){return _0x5eaba9?{'count':_0x55a663,'rows':_0x5eaba9}:null;}})[_0x5827('0x1e')](respondWithResult(_0x55c16f,null))[_0x5827('0x28')](handleError(_0x55c16f,null));};exports[_0x5827('0x5c')]=function(_0xe37055,_0x9c2a34,_0x26479f){var _0x34e1f8={};var _0x559f7a={};var _0x34e236;var _0x53abb5;return db[_0x5827('0x4f')][_0x5827('0x5a')]({'where':{'id':_0xe37055[_0x5827('0x58')]['id']}})[_0x5827('0x1e')](handleEntityNotFound(_0x9c2a34,null))[_0x5827('0x1e')](function(_0x45d713){if(_0x45d713){_0x34e236=_0x45d713;_0x559f7a[_0x5827('0x3d')]=_[_0x5827('0x3f')](db[_0x5827('0x5b')]['rawAttributes']);_0x559f7a[_0x5827('0x3e')]=_[_0x5827('0x3f')](_0xe37055[_0x5827('0x3e')]);_0x559f7a['filters']=_[_0x5827('0x41')](_0x559f7a[_0x5827('0x3d')],_0x559f7a[_0x5827('0x3e')]);_0x34e1f8[_0x5827('0x43')]=_[_0x5827('0x41')](_0x559f7a[_0x5827('0x3d')],qs[_0x5827('0x42')](_0xe37055[_0x5827('0x3e')][_0x5827('0x42')]));_0x34e1f8[_0x5827('0x43')]=_0x34e1f8['attributes'][_0x5827('0x44')]?_0x34e1f8['attributes']:_0x559f7a[_0x5827('0x3d')];_0x34e1f8['order']=qs[_0x5827('0x48')](_0xe37055[_0x5827('0x3e')]['sort']);_0x34e1f8[_0x5827('0x49')]=qs['filters'](_[_0x5827('0x4a')](_0xe37055[_0x5827('0x3e')],_0x559f7a[_0x5827('0x40')]));if(_0xe37055[_0x5827('0x3e')][_0x5827('0x4b')]){_0x34e1f8['where']=_[_0x5827('0x4e')](_0x34e1f8[_0x5827('0x49')],{'$or':_[_0x5827('0x4c')](_0x34e1f8[_0x5827('0x43')],function(_0x33647d){var _0x2bc6d4={};_0x2bc6d4[_0x33647d]={'$like':'%'+_0xe37055['query'][_0x5827('0x4b')]+'%'};return _0x2bc6d4;})});}_0x34e1f8=_[_0x5827('0x4e')]({},_0x34e1f8,_0xe37055[_0x5827('0x54')]);return _0x34e236[_0x5827('0x5c')](_0x34e1f8);}})[_0x5827('0x1e')](function(_0x4d15f0){if(_0x4d15f0){_0x53abb5=_0x4d15f0[_0x5827('0x44')];if(!_0xe37055[_0x5827('0x3e')]['hasOwnProperty'](_0x5827('0x46'))){_0x34e1f8[_0x5827('0x2f')]=qs[_0x5827('0x2f')](_0xe37055['query'][_0x5827('0x2f')]);_0x34e1f8['offset']=qs['offset'](_0xe37055[_0x5827('0x3e')][_0x5827('0x2e')]);}return _0x34e236['getSubjects'](_0x34e1f8);}})[_0x5827('0x1e')](function(_0x4f0f70){if(_0x4f0f70){return _0x4f0f70?{'count':_0x53abb5,'rows':_0x4f0f70}:null;}})['then'](respondWithResult(_0x9c2a34,null))[_0x5827('0x28')](handleError(_0x9c2a34,null));};exports[_0x5827('0x5d')]=function(_0x1e73e8,_0x4599fe,_0x582fd9){var _0x1c8eac={};var _0x586258={};var _0x8150b9;var _0x5cccf8;return db[_0x5827('0x4f')][_0x5827('0x5a')]({'where':{'id':_0x1e73e8[_0x5827('0x58')]['id']}})[_0x5827('0x1e')](handleEntityNotFound(_0x4599fe,null))[_0x5827('0x1e')](function(_0x14f0b5){if(_0x14f0b5){_0x8150b9=_0x14f0b5;_0x586258[_0x5827('0x3d')]=_[_0x5827('0x3f')](db[_0x5827('0x5b')][_0x5827('0x39')]);_0x586258[_0x5827('0x3e')]=_[_0x5827('0x3f')](_0x1e73e8[_0x5827('0x3e')]);_0x586258[_0x5827('0x40')]=_['intersection'](_0x586258['model'],_0x586258[_0x5827('0x3e')]);_0x1c8eac[_0x5827('0x43')]=_[_0x5827('0x41')](_0x586258[_0x5827('0x3d')],qs[_0x5827('0x42')](_0x1e73e8[_0x5827('0x3e')]['fields']));_0x1c8eac[_0x5827('0x43')]=_0x1c8eac[_0x5827('0x43')][_0x5827('0x44')]?_0x1c8eac[_0x5827('0x43')]:_0x586258[_0x5827('0x3d')];_0x1c8eac[_0x5827('0x47')]=qs[_0x5827('0x48')](_0x1e73e8[_0x5827('0x3e')][_0x5827('0x48')]);_0x1c8eac[_0x5827('0x49')]=qs[_0x5827('0x40')](_['pick'](_0x1e73e8['query'],_0x586258[_0x5827('0x40')]));if(_0x1e73e8[_0x5827('0x3e')][_0x5827('0x4b')]){_0x1c8eac[_0x5827('0x49')]=_[_0x5827('0x4e')](_0x1c8eac['where'],{'$or':_[_0x5827('0x4c')](_0x1c8eac[_0x5827('0x43')],function(_0x134bbc){var _0x238606={};_0x238606[_0x134bbc]={'$like':'%'+_0x1e73e8[_0x5827('0x3e')][_0x5827('0x4b')]+'%'};return _0x238606;})});}_0x1c8eac=_[_0x5827('0x4e')]({},_0x1c8eac,_0x1e73e8['options']);return _0x8150b9['getDescriptions'](_0x1c8eac);}})[_0x5827('0x1e')](function(_0x392594){if(_0x392594){_0x5cccf8=_0x392594[_0x5827('0x44')];if(!_0x1e73e8['query'][_0x5827('0x45')](_0x5827('0x46'))){_0x1c8eac['limit']=qs[_0x5827('0x2f')](_0x1e73e8['query'][_0x5827('0x2f')]);_0x1c8eac[_0x5827('0x2e')]=qs[_0x5827('0x2e')](_0x1e73e8['query'][_0x5827('0x2e')]);}return _0x8150b9[_0x5827('0x5d')](_0x1c8eac);}})[_0x5827('0x1e')](function(_0x55bbf6){if(_0x55bbf6){return _0x55bbf6?{'count':_0x5cccf8,'rows':_0x55bbf6}:null;}})[_0x5827('0x1e')](respondWithResult(_0x4599fe,null))[_0x5827('0x28')](handleError(_0x4599fe,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index faf5797..3d65c42 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 _0xcabb=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x584f11,_0x171988){var _0x3d0a70=function(_0x30dba3){while(--_0x30dba3){_0x584f11['push'](_0x584f11['shift']());}};_0x3d0a70(++_0x171988);}(_0xcabb,0xe8));var _0xbcab=function(_0x56eb57,_0x84437f){_0x56eb57=_0x56eb57-0x0;var _0x38f64a=_0xcabb[_0x56eb57];return _0x38f64a;};'use strict';var _=require('lodash');var util=require(_0xbcab('0x0'));var logger=require(_0xbcab('0x1'))(_0xbcab('0x2'));var moment=require(_0xbcab('0x3'));var BPromise=require(_0xbcab('0x4'));var rp=require(_0xbcab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcab('0x6'));var config=require(_0xbcab('0x7'));var attributes=require(_0xbcab('0x8'));module[_0xbcab('0x9')]=function(_0x1b1bb5,_0x416ca5){return _0x1b1bb5[_0xbcab('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xbcab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d02=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x6d02,0x104));var _0x26d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6d02[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x26d0('0x0'));var util=require(_0x26d0('0x1'));var logger=require('../../config/logger')(_0x26d0('0x2'));var moment=require(_0x26d0('0x3'));var BPromise=require(_0x26d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26d0('0x5'));var rimraf=require(_0x26d0('0x6'));var config=require(_0x26d0('0x7'));var attributes=require(_0x26d0('0x8'));module[_0x26d0('0x9')]=function(_0x2bcf33,_0x3c832b){return _0x2bcf33[_0x26d0('0xa')](_0x26d0('0xb'),attributes,{'tableName':_0x26d0('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 3d07488..7d86031 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 _0xba3d=['then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3f3fb7,_0x3942cf){var _0x280f97=function(_0x7cf798){while(--_0x7cf798){_0x3f3fb7['push'](_0x3f3fb7['shift']());}};_0x280f97(++_0x3942cf);}(_0xba3d,0x14c));var _0xdba3=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xba3d[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xdba3('0x0'));var util=require('util');var moment=require(_0xdba3('0x1'));var BPromise=require(_0xdba3('0x2'));var rs=require(_0xdba3('0x3'));var fs=require('fs');var Redis=require(_0xdba3('0x4'));var db=require(_0xdba3('0x5'))['db'];var utils=require(_0xdba3('0x6'));var logger=require(_0xdba3('0x7'))(_0xdba3('0x8'));var config=require('../../config/environment');var jayson=require(_0xdba3('0x9'));var client=jayson[_0xdba3('0xa')][_0xdba3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a8c5,_0x2a1164,_0x8f2c62){return new BPromise(function(_0x1e2763,_0x19fcf6){return client[_0xdba3('0xc')](_0x41a8c5,_0x8f2c62)[_0xdba3('0xd')](function(_0x14d597){logger[_0xdba3('0xe')](_0xdba3('0xf'),_0x2a1164,'request\x20sent');logger[_0xdba3('0x10')](_0xdba3('0x11'),_0x2a1164,_0xdba3('0x12'),JSON['stringify'](_0x14d597));if(_0x14d597[_0xdba3('0x13')]){if(_0x14d597[_0xdba3('0x13')][_0xdba3('0x14')]===0x1f4){logger[_0xdba3('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a1164,_0x14d597[_0xdba3('0x13')][_0xdba3('0x15')]);return _0x19fcf6(_0x14d597[_0xdba3('0x13')][_0xdba3('0x15')]);}logger[_0xdba3('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a1164,_0x14d597[_0xdba3('0x13')][_0xdba3('0x15')]);return _0x1e2763(_0x14d597['error'][_0xdba3('0x15')]);}else{logger[_0xdba3('0xe')](_0xdba3('0xf'),_0x2a1164,_0xdba3('0x12'));_0x1e2763(_0x14d597['result'][_0xdba3('0x15')]);}})[_0xdba3('0x16')](function(_0x34ed5c){logger[_0xdba3('0x13')](_0xdba3('0xf'),_0x2a1164,_0x34ed5c);_0x19fcf6(_0x34ed5c);});});} \ No newline at end of file +var _0x53f3=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x53f3,0x7d));var _0x353f=function(_0x2d800b,_0x2305d9){_0x2d800b=_0x2d800b-0x0;var _0x1296a2=_0x53f3[_0x2d800b];return _0x1296a2;};'use strict';var _=require(_0x353f('0x0'));var util=require('util');var moment=require(_0x353f('0x1'));var BPromise=require(_0x353f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x353f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x353f('0x4'));var logger=require(_0x353f('0x5'))('rpc');var config=require(_0x353f('0x6'));var jayson=require(_0x353f('0x7'));var client=jayson[_0x353f('0x8')][_0x353f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17fcca,_0x6fd70d,_0x18eef3){return new BPromise(function(_0xdf60e3,_0x22d5de){return client[_0x353f('0xa')](_0x17fcca,_0x18eef3)[_0x353f('0xb')](function(_0x20856f){logger[_0x353f('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x6fd70d,_0x353f('0xd'));logger[_0x353f('0xe')](_0x353f('0xf'),_0x6fd70d,_0x353f('0xd'),JSON[_0x353f('0x10')](_0x20856f));if(_0x20856f[_0x353f('0x11')]){if(_0x20856f[_0x353f('0x11')][_0x353f('0x12')]===0x1f4){logger[_0x353f('0x11')](_0x353f('0x13'),_0x6fd70d,_0x20856f[_0x353f('0x11')][_0x353f('0x14')]);return _0x22d5de(_0x20856f[_0x353f('0x11')][_0x353f('0x14')]);}logger[_0x353f('0x11')](_0x353f('0x13'),_0x6fd70d,_0x20856f[_0x353f('0x11')]['message']);return _0xdf60e3(_0x20856f[_0x353f('0x11')]['message']);}else{logger[_0x353f('0xc')](_0x353f('0x13'),_0x6fd70d,_0x353f('0xd'));_0xdf60e3(_0x20856f[_0x353f('0x15')][_0x353f('0x14')]);}})[_0x353f('0x16')](function(_0x48ab5e){logger[_0x353f('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x6fd70d,_0x48ab5e);_0x22d5de(_0x48ab5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7302be9..1096c18 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 _0x4fb4=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x4ae4f9,_0x39a722){var _0x1fce04=function(_0x272d77){while(--_0x272d77){_0x4ae4f9['push'](_0x4ae4f9['shift']());}};_0x1fce04(++_0x39a722);}(_0x4fb4,0x190));var _0x44fb=function(_0x22f506,_0x4e5909){_0x22f506=_0x22f506-0x0;var _0x504d61=_0x4fb4[_0x22f506];return _0x504d61;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var auth=require(_0x44fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x44fb('0x6'));var controller=require(_0x44fb('0x7'));router[_0x44fb('0x8')]('/',auth[_0x44fb('0x9')](),controller[_0x44fb('0xa')]);router[_0x44fb('0x8')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller['show']);router[_0x44fb('0xc')]('/',auth[_0x44fb('0x9')](),controller['create']);router[_0x44fb('0xd')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller[_0x44fb('0x10')]);module[_0x44fb('0x11')]=router; \ No newline at end of file +var _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x3ae03d,_0x268c5e){var _0x43c5e9=function(_0x362417){while(--_0x362417){_0x3ae03d['push'](_0x3ae03d['shift']());}};_0x43c5e9(++_0x268c5e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2eb815,_0x301262){_0x2eb815=_0x2eb815-0x0;var _0x1ed460=_0xdbf5[_0x2eb815];return _0x1ed460;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index ee9b794..18ff1bc 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 _0xd129=['string','variable','keyValue','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xd129,0x85));var _0x9d12=function(_0x3adef2,_0x5d37cc){_0x3adef2=_0x3adef2-0x0;var _0x3f4b00=_0xd129[_0x3adef2];return _0x3f4b00;};'use strict';var Sequelize=require(_0x9d12('0x0'));module[_0x9d12('0x1')]={'type':{'type':Sequelize[_0x9d12('0x2')](_0x9d12('0x3'),_0x9d12('0x4'),'customVariable',_0x9d12('0x5')),'defaultValue':_0x9d12('0x3')},'content':{'type':Sequelize[_0x9d12('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d12('0x2')](_0x9d12('0x3'),_0x9d12('0x4'),_0x9d12('0x7'))},'keyContent':{'type':Sequelize[_0x9d12('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9d12('0x6')]}}; \ No newline at end of file +var _0x7a9f=['sequelize','customVariable','keyValue','STRING','ENUM','string','variable'];(function(_0x518569,_0x3dc2f8){var _0x592f89=function(_0x4a8a21){while(--_0x4a8a21){_0x518569['push'](_0x518569['shift']());}};_0x592f89(++_0x3dc2f8);}(_0x7a9f,0x1b9));var _0xf7a9=function(_0x501a74,_0x3b2792){_0x501a74=_0x501a74-0x0;var _0x33c13d=_0x7a9f[_0x501a74];return _0x33c13d;};'use strict';var Sequelize=require(_0xf7a9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xf7a9('0x1'),_0xf7a9('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf7a9('0x3')]},'key':{'type':Sequelize[_0xf7a9('0x3')]},'keyType':{'type':Sequelize[_0xf7a9('0x4')](_0xf7a9('0x5'),_0xf7a9('0x6'),_0xf7a9('0x1'))},'keyContent':{'type':Sequelize[_0xf7a9('0x3')]},'idField':{'type':Sequelize[_0xf7a9('0x3')]},'variableName':{'type':Sequelize[_0xf7a9('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a5e8e03..08e2c2b 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 _0xb520=['filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4310dd,_0xf401d4){var _0x2158ec=function(_0x1f06b1){while(--_0x1f06b1){_0x4310dd['push'](_0x4310dd['shift']());}};_0x2158ec(++_0xf401d4);}(_0xb520,0x1dd));var _0x0b52=function(_0x46b26d,_0x1d32b3){_0x46b26d=_0x46b26d-0x0;var _0xdf241e=_0xb520[_0x46b26d];return _0xdf241e;};'use strict';var pdf=require(_0x0b52('0x0'));var emlformat=require(_0x0b52('0x1'));var rimraf=require(_0x0b52('0x2'));var zipdir=require(_0x0b52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b52('0x4'));var BPromise=require(_0x0b52('0x5'));var Mustache=require(_0x0b52('0x6'));var util=require(_0x0b52('0x7'));var path=require(_0x0b52('0x8'));var sox=require(_0x0b52('0x9'));var csv=require('to-csv');var ejs=require(_0x0b52('0xa'));var fs=require('fs');var _=require(_0x0b52('0xb'));var squel=require(_0x0b52('0xc'));var crypto=require(_0x0b52('0xd'));var jsforce=require(_0x0b52('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0b52('0xf'));var querystring=require('querystring');var Papa=require(_0x0b52('0x10'));var Redis=require(_0x0b52('0x11'));var authService=require(_0x0b52('0x12'));var qs=require(_0x0b52('0x13'));var as=require(_0x0b52('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b52('0x15'))(_0x0b52('0x16'));var utils=require(_0x0b52('0x17'));var config=require(_0x0b52('0x18'));var db=require(_0x0b52('0x19'))['db'];function respondWithStatusCode(_0x30bde0,_0xa2def7){_0xa2def7=_0xa2def7||0xcc;return function(_0xe481a2){if(_0xe481a2){return _0x30bde0[_0x0b52('0x1a')](_0xa2def7);}return _0x30bde0[_0x0b52('0x1b')](_0xa2def7)[_0x0b52('0x1c')]();};}function respondWithResult(_0x26a3f0,_0x2e7996){_0x2e7996=_0x2e7996||0xc8;return function(_0x33076d){if(_0x33076d){return _0x26a3f0[_0x0b52('0x1b')](_0x2e7996)[_0x0b52('0x1d')](_0x33076d);}};}function respondWithFilteredResult(_0xe35712,_0x6c7a2e){return function(_0xd51427){if(_0xd51427){var _0x230dc1=_0xd51427[_0x0b52('0x1e')],_0x53fc33=_0x6c7a2e['offset'],_0x5488c2=_0x6c7a2e[_0x0b52('0x1f')]+_0x6c7a2e[_0x0b52('0x20')],_0x4f07b6;if(_0x5488c2>=_0x230dc1){_0x5488c2=_0x230dc1;_0x4f07b6=0xc8;}else{_0x4f07b6=0xce;}_0xe35712[_0x0b52('0x1b')](_0x4f07b6);return _0xe35712[_0x0b52('0x21')](_0x0b52('0x22'),_0x53fc33+'-'+_0x5488c2+'/'+_0x230dc1)[_0x0b52('0x1d')](_0xd51427);}return null;};}function patchUpdates(_0x104005){return function(_0x5b63ca){try{jsonpatch[_0x0b52('0x23')](_0x5b63ca,_0x104005,!![]);}catch(_0x1f9845){return BPromise[_0x0b52('0x24')](_0x1f9845);}return _0x5b63ca[_0x0b52('0x25')]();};}function saveUpdates(_0x33f530,_0x318129){return function(_0x1e1534){if(_0x1e1534){return _0x1e1534[_0x0b52('0x26')](_0x33f530)['then'](function(_0x8dc203){return _0x8dc203;});}return null;};}function removeEntity(_0x5c0d6b,_0x33a0b0){return function(_0x3f4227){if(_0x3f4227){return _0x3f4227['destroy']()[_0x0b52('0x27')](function(){_0x5c0d6b['status'](0xcc)[_0x0b52('0x1c')]();});}};}function handleEntityNotFound(_0x7af1de,_0x2edc33){return function(_0xf71c67){if(!_0xf71c67){_0x7af1de[_0x0b52('0x1a')](0x194);}return _0xf71c67;};}function handleError(_0xd6cf7e,_0xbde02c){_0xbde02c=_0xbde02c||0x1f4;return function(_0x564721){logger[_0x0b52('0x28')](_0x564721[_0x0b52('0x29')]);if(_0x564721['name']){delete _0x564721[_0x0b52('0x2a')];}_0xd6cf7e[_0x0b52('0x1b')](_0xbde02c)[_0x0b52('0x2b')](_0x564721);};}exports['index']=function(_0x599f62,_0xa07bec){var _0x667848={},_0x486c1b={},_0x43f4cd={'count':0x0,'rows':[]};var _0x28ffc3=_[_0x0b52('0x2c')](db[_0x0b52('0x2d')][_0x0b52('0x2e')],function(_0x5116e9){return{'name':_0x5116e9[_0x0b52('0x2f')],'type':_0x5116e9[_0x0b52('0x30')][_0x0b52('0x31')]};});_0x486c1b[_0x0b52('0x32')]=_[_0x0b52('0x2c')](_0x28ffc3,_0x0b52('0x2a'));_0x486c1b[_0x0b52('0x33')]=_[_0x0b52('0x34')](_0x599f62[_0x0b52('0x33')]);_0x486c1b['filters']=_[_0x0b52('0x35')](_0x486c1b[_0x0b52('0x32')],_0x486c1b[_0x0b52('0x33')]);_0x667848[_0x0b52('0x36')]=_[_0x0b52('0x35')](_0x486c1b[_0x0b52('0x32')],qs['fields'](_0x599f62[_0x0b52('0x33')]['fields']));_0x667848[_0x0b52('0x36')]=_0x667848[_0x0b52('0x36')][_0x0b52('0x37')]?_0x667848[_0x0b52('0x36')]:_0x486c1b['model'];if(!_0x599f62[_0x0b52('0x33')][_0x0b52('0x38')](_0x0b52('0x39'))){_0x667848['limit']=qs[_0x0b52('0x20')](_0x599f62[_0x0b52('0x33')]['limit']);_0x667848[_0x0b52('0x1f')]=qs[_0x0b52('0x1f')](_0x599f62[_0x0b52('0x33')][_0x0b52('0x1f')]);}_0x667848[_0x0b52('0x3a')]=qs[_0x0b52('0x3b')](_0x599f62[_0x0b52('0x33')][_0x0b52('0x3b')]);_0x667848[_0x0b52('0x3c')]=qs['filters'](_[_0x0b52('0x3d')](_0x599f62[_0x0b52('0x33')],_0x486c1b[_0x0b52('0x3e')]),_0x28ffc3);if(_0x599f62[_0x0b52('0x33')][_0x0b52('0x3f')]){_0x667848[_0x0b52('0x3c')]=_[_0x0b52('0x40')](_0x667848[_0x0b52('0x3c')],{'$or':_[_0x0b52('0x2c')](_0x28ffc3,function(_0x3a21c5){if(_0x3a21c5[_0x0b52('0x30')]!==_0x0b52('0x41')){var _0x1748f8={};_0x1748f8[_0x3a21c5[_0x0b52('0x2a')]]={'$like':'%'+_0x599f62['query']['filter']+'%'};return _0x1748f8;}})});}_0x667848=_[_0x0b52('0x40')]({},_0x667848,_0x599f62[_0x0b52('0x42')]);var _0x955b1a={'where':_0x667848[_0x0b52('0x3c')]};return db['SalesforceField']['count'](_0x955b1a)[_0x0b52('0x27')](function(_0x3f0a25){_0x43f4cd[_0x0b52('0x1e')]=_0x3f0a25;if(_0x599f62[_0x0b52('0x33')][_0x0b52('0x43')]){_0x667848['include']=[{'all':!![]}];}return db[_0x0b52('0x2d')][_0x0b52('0x44')](_0x667848);})[_0x0b52('0x27')](function(_0x5ddfc2){_0x43f4cd['rows']=_0x5ddfc2;return _0x43f4cd;})[_0x0b52('0x27')](respondWithFilteredResult(_0xa07bec,_0x667848))[_0x0b52('0x45')](handleError(_0xa07bec,null));};exports[_0x0b52('0x46')]=function(_0x2add64,_0x5816aa){var _0x3988c5={'raw':!![],'where':{'id':_0x2add64[_0x0b52('0x47')]['id']}},_0x144d1a={};_0x144d1a['model']=_[_0x0b52('0x34')](db[_0x0b52('0x2d')][_0x0b52('0x2e')]);_0x144d1a['query']=_[_0x0b52('0x34')](_0x2add64[_0x0b52('0x33')]);_0x144d1a['filters']=_[_0x0b52('0x35')](_0x144d1a[_0x0b52('0x32')],_0x144d1a[_0x0b52('0x33')]);_0x3988c5['attributes']=_[_0x0b52('0x35')](_0x144d1a[_0x0b52('0x32')],qs[_0x0b52('0x48')](_0x2add64[_0x0b52('0x33')][_0x0b52('0x48')]));_0x3988c5[_0x0b52('0x36')]=_0x3988c5['attributes']['length']?_0x3988c5['attributes']:_0x144d1a[_0x0b52('0x32')];if(_0x2add64['query'][_0x0b52('0x43')]){_0x3988c5['include']=[{'all':!![]}];}_0x3988c5=_['merge']({},_0x3988c5,_0x2add64[_0x0b52('0x42')]);return db[_0x0b52('0x2d')]['find'](_0x3988c5)[_0x0b52('0x27')](handleEntityNotFound(_0x5816aa,null))[_0x0b52('0x27')](respondWithResult(_0x5816aa,null))[_0x0b52('0x45')](handleError(_0x5816aa,null));};exports[_0x0b52('0x49')]=function(_0x59b99f,_0x2935e6){return db[_0x0b52('0x2d')][_0x0b52('0x49')](_0x59b99f[_0x0b52('0x4a')],{})[_0x0b52('0x27')](respondWithResult(_0x2935e6,0xc9))[_0x0b52('0x45')](handleError(_0x2935e6,null));};exports[_0x0b52('0x26')]=function(_0x3d32c4,_0x23506b){if(_0x3d32c4['body']['id']){delete _0x3d32c4['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x3d32c4[_0x0b52('0x47')]['id']}})[_0x0b52('0x27')](handleEntityNotFound(_0x23506b,null))[_0x0b52('0x27')](saveUpdates(_0x3d32c4[_0x0b52('0x4a')],null))[_0x0b52('0x27')](respondWithResult(_0x23506b,null))['catch'](handleError(_0x23506b,null));};exports[_0x0b52('0x4b')]=function(_0x304ead,_0x5774ab){return db['SalesforceField'][_0x0b52('0x4c')]({'where':{'id':_0x304ead[_0x0b52('0x47')]['id']}})[_0x0b52('0x27')](handleEntityNotFound(_0x5774ab,null))[_0x0b52('0x27')](removeEntity(_0x5774ab,null))[_0x0b52('0x45')](handleError(_0x5774ab,null));}; \ No newline at end of file +var _0x3726=['filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','rawAttributes','fields','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','fieldName','type','model','query'];(function(_0x2d95e4,_0x519029){var _0x25fec8=function(_0x5401ab){while(--_0x5401ab){_0x2d95e4['push'](_0x2d95e4['shift']());}};_0x25fec8(++_0x519029);}(_0x3726,0x13d));var _0x6372=function(_0x2cabcc,_0x5019ab){_0x2cabcc=_0x2cabcc-0x0;var _0x82f3=_0x3726[_0x2cabcc];return _0x82f3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6372('0x0'));var zipdir=require(_0x6372('0x1'));var jsonpatch=require(_0x6372('0x2'));var rp=require(_0x6372('0x3'));var moment=require(_0x6372('0x4'));var BPromise=require(_0x6372('0x5'));var Mustache=require(_0x6372('0x6'));var util=require(_0x6372('0x7'));var path=require(_0x6372('0x8'));var sox=require(_0x6372('0x9'));var csv=require(_0x6372('0xa'));var ejs=require(_0x6372('0xb'));var fs=require('fs');var _=require(_0x6372('0xc'));var squel=require(_0x6372('0xd'));var crypto=require(_0x6372('0xe'));var jsforce=require(_0x6372('0xf'));var deskjs=require(_0x6372('0x10'));var toCsv=require(_0x6372('0xa'));var querystring=require(_0x6372('0x11'));var Papa=require('papaparse');var Redis=require(_0x6372('0x12'));var authService=require(_0x6372('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6372('0x14'));var hardwareService=require(_0x6372('0x15'));var logger=require(_0x6372('0x16'))(_0x6372('0x17'));var utils=require('../../config/utils');var config=require(_0x6372('0x18'));var db=require(_0x6372('0x19'))['db'];function respondWithStatusCode(_0x43b0c9,_0x198c22){_0x198c22=_0x198c22||0xcc;return function(_0x1a9c3d){if(_0x1a9c3d){return _0x43b0c9[_0x6372('0x1a')](_0x198c22);}return _0x43b0c9[_0x6372('0x1b')](_0x198c22)['end']();};}function respondWithResult(_0xd6531e,_0x55fcde){_0x55fcde=_0x55fcde||0xc8;return function(_0x323b86){if(_0x323b86){return _0xd6531e[_0x6372('0x1b')](_0x55fcde)[_0x6372('0x1c')](_0x323b86);}};}function respondWithFilteredResult(_0x1cd908,_0x4fd399){return function(_0x31910e){if(_0x31910e){var _0x2f13af=_0x31910e[_0x6372('0x1d')],_0x3d3f26=_0x4fd399[_0x6372('0x1e')],_0x38fe98=_0x4fd399[_0x6372('0x1e')]+_0x4fd399['limit'],_0x1588da;if(_0x38fe98>=_0x2f13af){_0x38fe98=_0x2f13af;_0x1588da=0xc8;}else{_0x1588da=0xce;}_0x1cd908[_0x6372('0x1b')](_0x1588da);return _0x1cd908[_0x6372('0x1f')](_0x6372('0x20'),_0x3d3f26+'-'+_0x38fe98+'/'+_0x2f13af)[_0x6372('0x1c')](_0x31910e);}return null;};}function patchUpdates(_0x21d824){return function(_0x326ac8){try{jsonpatch['apply'](_0x326ac8,_0x21d824,!![]);}catch(_0x3bcfb3){return BPromise[_0x6372('0x21')](_0x3bcfb3);}return _0x326ac8[_0x6372('0x22')]();};}function saveUpdates(_0x192494,_0x574df9){return function(_0x1adb48){if(_0x1adb48){return _0x1adb48[_0x6372('0x23')](_0x192494)[_0x6372('0x24')](function(_0x584138){return _0x584138;});}return null;};}function removeEntity(_0x2f451a,_0x2e8626){return function(_0x2ea8fb){if(_0x2ea8fb){return _0x2ea8fb[_0x6372('0x25')]()[_0x6372('0x24')](function(){_0x2f451a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ecf3f,_0x35d94b){return function(_0xb94357){if(!_0xb94357){_0x4ecf3f[_0x6372('0x1a')](0x194);}return _0xb94357;};}function handleError(_0x21784b,_0x1f126b){_0x1f126b=_0x1f126b||0x1f4;return function(_0x1de43f){logger[_0x6372('0x26')](_0x1de43f['stack']);if(_0x1de43f[_0x6372('0x27')]){delete _0x1de43f[_0x6372('0x27')];}_0x21784b[_0x6372('0x1b')](_0x1f126b)[_0x6372('0x28')](_0x1de43f);};}exports[_0x6372('0x29')]=function(_0x5440b9,_0x543943){var _0xf19145={},_0x4f6939={},_0x3fc570={'count':0x0,'rows':[]};var _0xcb936d=_[_0x6372('0x2a')](db[_0x6372('0x2b')]['rawAttributes'],function(_0x1bafe9){return{'name':_0x1bafe9[_0x6372('0x2c')],'type':_0x1bafe9[_0x6372('0x2d')]['key']};});_0x4f6939[_0x6372('0x2e')]=_[_0x6372('0x2a')](_0xcb936d,_0x6372('0x27'));_0x4f6939[_0x6372('0x2f')]=_['keys'](_0x5440b9[_0x6372('0x2f')]);_0x4f6939[_0x6372('0x30')]=_[_0x6372('0x31')](_0x4f6939[_0x6372('0x2e')],_0x4f6939['query']);_0xf19145[_0x6372('0x32')]=_['intersection'](_0x4f6939[_0x6372('0x2e')],qs['fields'](_0x5440b9[_0x6372('0x2f')]['fields']));_0xf19145[_0x6372('0x32')]=_0xf19145[_0x6372('0x32')][_0x6372('0x33')]?_0xf19145[_0x6372('0x32')]:_0x4f6939['model'];if(!_0x5440b9[_0x6372('0x2f')][_0x6372('0x34')](_0x6372('0x35'))){_0xf19145[_0x6372('0x36')]=qs['limit'](_0x5440b9['query'][_0x6372('0x36')]);_0xf19145[_0x6372('0x1e')]=qs[_0x6372('0x1e')](_0x5440b9[_0x6372('0x2f')][_0x6372('0x1e')]);}_0xf19145['order']=qs['sort'](_0x5440b9[_0x6372('0x2f')][_0x6372('0x37')]);_0xf19145[_0x6372('0x38')]=qs['filters'](_['pick'](_0x5440b9[_0x6372('0x2f')],_0x4f6939[_0x6372('0x30')]),_0xcb936d);if(_0x5440b9[_0x6372('0x2f')][_0x6372('0x39')]){_0xf19145['where']=_[_0x6372('0x3a')](_0xf19145[_0x6372('0x38')],{'$or':_['map'](_0xcb936d,function(_0x39ea49){if(_0x39ea49[_0x6372('0x2d')]!==_0x6372('0x3b')){var _0x321794={};_0x321794[_0x39ea49['name']]={'$like':'%'+_0x5440b9[_0x6372('0x2f')][_0x6372('0x39')]+'%'};return _0x321794;}})});}_0xf19145=_[_0x6372('0x3a')]({},_0xf19145,_0x5440b9[_0x6372('0x3c')]);var _0x1fc791={'where':_0xf19145[_0x6372('0x38')]};return db[_0x6372('0x2b')][_0x6372('0x1d')](_0x1fc791)['then'](function(_0x31b7c){_0x3fc570[_0x6372('0x1d')]=_0x31b7c;if(_0x5440b9[_0x6372('0x2f')]['includeAll']){_0xf19145[_0x6372('0x3d')]=[{'all':!![]}];}return db[_0x6372('0x2b')][_0x6372('0x3e')](_0xf19145);})[_0x6372('0x24')](function(_0x2cd990){_0x3fc570[_0x6372('0x3f')]=_0x2cd990;return _0x3fc570;})[_0x6372('0x24')](respondWithFilteredResult(_0x543943,_0xf19145))[_0x6372('0x40')](handleError(_0x543943,null));};exports[_0x6372('0x41')]=function(_0x4f2a3e,_0x93e0bc){var _0x55baa1={'raw':!![],'where':{'id':_0x4f2a3e['params']['id']}},_0x47031c={};_0x47031c[_0x6372('0x2e')]=_[_0x6372('0x42')](db[_0x6372('0x2b')][_0x6372('0x43')]);_0x47031c[_0x6372('0x2f')]=_[_0x6372('0x42')](_0x4f2a3e[_0x6372('0x2f')]);_0x47031c[_0x6372('0x30')]=_[_0x6372('0x31')](_0x47031c[_0x6372('0x2e')],_0x47031c[_0x6372('0x2f')]);_0x55baa1[_0x6372('0x32')]=_[_0x6372('0x31')](_0x47031c[_0x6372('0x2e')],qs[_0x6372('0x44')](_0x4f2a3e[_0x6372('0x2f')][_0x6372('0x44')]));_0x55baa1[_0x6372('0x32')]=_0x55baa1[_0x6372('0x32')]['length']?_0x55baa1[_0x6372('0x32')]:_0x47031c['model'];if(_0x4f2a3e['query']['includeAll']){_0x55baa1[_0x6372('0x3d')]=[{'all':!![]}];}_0x55baa1=_['merge']({},_0x55baa1,_0x4f2a3e[_0x6372('0x3c')]);return db['SalesforceField'][_0x6372('0x45')](_0x55baa1)['then'](handleEntityNotFound(_0x93e0bc,null))[_0x6372('0x24')](respondWithResult(_0x93e0bc,null))[_0x6372('0x40')](handleError(_0x93e0bc,null));};exports[_0x6372('0x46')]=function(_0x31ddc6,_0x5d2eeb){return db[_0x6372('0x2b')][_0x6372('0x46')](_0x31ddc6[_0x6372('0x47')],{})[_0x6372('0x24')](respondWithResult(_0x5d2eeb,0xc9))['catch'](handleError(_0x5d2eeb,null));};exports[_0x6372('0x23')]=function(_0x318466,_0x1dd0a0){if(_0x318466[_0x6372('0x47')]['id']){delete _0x318466[_0x6372('0x47')]['id'];}return db[_0x6372('0x2b')][_0x6372('0x45')]({'where':{'id':_0x318466[_0x6372('0x48')]['id']}})[_0x6372('0x24')](handleEntityNotFound(_0x1dd0a0,null))[_0x6372('0x24')](saveUpdates(_0x318466[_0x6372('0x47')],null))[_0x6372('0x24')](respondWithResult(_0x1dd0a0,null))[_0x6372('0x40')](handleError(_0x1dd0a0,null));};exports[_0x6372('0x25')]=function(_0x100cbb,_0x4ae9b6){return db[_0x6372('0x2b')]['find']({'where':{'id':_0x100cbb['params']['id']}})[_0x6372('0x24')](handleEntityNotFound(_0x4ae9b6,null))[_0x6372('0x24')](removeEntity(_0x4ae9b6,null))[_0x6372('0x40')](handleError(_0x4ae9b6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6b590a6..a24ab98 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 _0x3c9c=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x101793,_0x62f1cb){var _0x2aa015=function(_0x581eda){while(--_0x581eda){_0x101793['push'](_0x101793['shift']());}};_0x2aa015(++_0x62f1cb);}(_0x3c9c,0x1b1));var _0xc3c9=function(_0x4af7b2,_0x2fcbd9){_0x4af7b2=_0x4af7b2-0x0;var _0x241262=_0x3c9c[_0x4af7b2];return _0x241262;};'use strict';var _=require(_0xc3c9('0x0'));var util=require('util');var logger=require(_0xc3c9('0x1'))(_0xc3c9('0x2'));var moment=require(_0xc3c9('0x3'));var BPromise=require(_0xc3c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3c9('0x5'));var rimraf=require(_0xc3c9('0x6'));var config=require(_0xc3c9('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0xc3c9('0x8')]=function(_0x4a33e4,_0x4acd6e){return _0x4a33e4['define']('SalesforceField',attributes,{'tableName':_0xc3c9('0x9'),'paranoid':![],'indexes':[{'name':_0xc3c9('0xa'),'fields':[_0xc3c9('0xb'),_0xc3c9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf97=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','idField','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf97,0xd5));var _0x7df9=function(_0x430526,_0x5309c3){_0x430526=_0x430526-0x0;var _0x399ce1=_0xdf97[_0x430526];return _0x399ce1;};'use strict';var _=require(_0x7df9('0x0'));var util=require(_0x7df9('0x1'));var logger=require(_0x7df9('0x2'))('api');var moment=require(_0x7df9('0x3'));var BPromise=require(_0x7df9('0x4'));var rp=require(_0x7df9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7df9('0x6'));var config=require(_0x7df9('0x7'));var attributes=require(_0x7df9('0x8'));module['exports']=function(_0x2b3dcb,_0x471dff){return _0x2b3dcb[_0x7df9('0x9')]('SalesforceField',attributes,{'tableName':_0x7df9('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x7df9('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index fd0a81e..e0c501b 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d1eaf,_0x31b7bc){var _0xb0dc37=function(_0x2db2d4){while(--_0x2db2d4){_0x1d1eaf['push'](_0x1d1eaf['shift']());}};_0xb0dc37(++_0x31b7bc);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xaa88[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('SalesforceField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('SalesforceField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('SalesforceField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','SalesforceField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x20a761,_0x2ffd85){_0x20a761=_0x20a761-0x0;var _0x284a38=_0xbdb7[_0x20a761];return _0x284a38;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4da4348..999a576 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 _0x6797=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getConfigurations'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x6797,0x94));var _0x7679=function(_0x23f6a8,_0x29cb99){_0x23f6a8=_0x23f6a8-0x0;var _0x3d8092=_0x6797[_0x23f6a8];return _0x3d8092;};'use strict';var multer=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var path=require(_0x7679('0x2'));var timeout=require(_0x7679('0x3'));var express=require(_0x7679('0x4'));var router=express[_0x7679('0x5')]();var auth=require(_0x7679('0x6'));var interaction=require(_0x7679('0x7'));var config=require(_0x7679('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x7679('0x9')]('/',auth[_0x7679('0xa')](),controller['index']);router[_0x7679('0x9')]('/:id',auth[_0x7679('0xa')](),controller[_0x7679('0xb')]);router[_0x7679('0x9')]('/:id/configurations',auth[_0x7679('0xa')](),controller[_0x7679('0xc')]);router[_0x7679('0x9')](_0x7679('0xd'),auth[_0x7679('0xa')](),controller[_0x7679('0xe')]);router[_0x7679('0xf')]('/',auth['isAuthenticated'](),controller[_0x7679('0x10')]);router[_0x7679('0xf')](_0x7679('0x11'),auth[_0x7679('0xa')](),controller[_0x7679('0x12')]);router[_0x7679('0x13')](_0x7679('0x14'),auth[_0x7679('0xa')](),controller['update']);router[_0x7679('0x15')](_0x7679('0x14'),auth[_0x7679('0xa')](),controller[_0x7679('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf61e=['/:id','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','post','create','addConfiguration','put'];(function(_0x38194f,_0x548171){var _0x593877=function(_0x50eb30){while(--_0x50eb30){_0x38194f['push'](_0x38194f['shift']());}};_0x593877(++_0x548171);}(_0xf61e,0x82));var _0xef61=function(_0x481ffa,_0x58d633){_0x481ffa=_0x481ffa-0x0;var _0x3dfb71=_0xf61e[_0x481ffa];return _0x3dfb71;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef61('0x3')]();var auth=require(_0xef61('0x4'));var interaction=require(_0xef61('0x5'));var config=require(_0xef61('0x6'));var controller=require(_0xef61('0x7'));router[_0xef61('0x8')]('/',auth[_0xef61('0x9')](),controller[_0xef61('0xa')]);router[_0xef61('0x8')]('/:id',auth[_0xef61('0x9')](),controller['show']);router[_0xef61('0x8')](_0xef61('0xb'),auth[_0xef61('0x9')](),controller[_0xef61('0xc')]);router[_0xef61('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xef61('0xd')]('/',auth[_0xef61('0x9')](),controller[_0xef61('0xe')]);router['post'](_0xef61('0xb'),auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')](_0xef61('0x11'),auth[_0xef61('0x9')](),controller['update']);router[_0xef61('0x12')]('/:id',auth[_0xef61('0x9')](),controller[_0xef61('0x13')]);module[_0xef61('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b410dfc..8d75e8e 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 _0x027b=['sequelize','exports','STRING','remoteUri'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x027b,0xc0));var _0xb027=function(_0x36f01c,_0x2001e9){_0x36f01c=_0x36f01c-0x0;var _0x1e628e=_0x027b[_0x36f01c];return _0x1e628e;};'use strict';var Sequelize=require(_0xb027('0x0'));module[_0xb027('0x1')]={'name':{'type':Sequelize[_0xb027('0x2')]},'description':{'type':Sequelize[_0xb027('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xb027('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb027('0x2')],'unique':_0xb027('0x3')},'serverUrl':{'type':Sequelize[_0xb027('0x2')]}}; \ No newline at end of file +var _0x82c4=['exports','STRING','remoteUri','sequelize'];(function(_0x530d0b,_0x4771ee){var _0x37b359=function(_0x3244b6){while(--_0x3244b6){_0x530d0b['push'](_0x530d0b['shift']());}};_0x37b359(++_0x4771ee);}(_0x82c4,0xab));var _0x482c=function(_0x3e1353,_0x138834){_0x3e1353=_0x3e1353-0x0;var _0x2e6cae=_0x82c4[_0x3e1353];return _0x2e6cae;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'name':{'type':Sequelize[_0x482c('0x2')]},'description':{'type':Sequelize[_0x482c('0x2')]},'username':{'type':Sequelize[_0x482c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x482c('0x2')]},'email':{'type':Sequelize[_0x482c('0x2')]},'remoteUri':{'type':Sequelize[_0x482c('0x2')],'unique':_0x482c('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 471bccc..0d6ff44 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 _0x8f37=['Subjects','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','caused_by','upon_reject','sys_updated_on','child_incidents','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','short_description','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','findOne','password','email','serverUrl','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident\x20table\x20objects','assign','remove','label','push','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','statusCode','Wrong\x20credentials','True','False','GET','sys_choice?sysparm_query=name=incident^element=','value','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ServicenowAccount','count','include','show','params','keys','intersection','includeAll','find','create','body','catch','getConfigurations','ServicenowConfiguration'];(function(_0x33d615,_0x1a5af7){var _0x254611=function(_0x23c410){while(--_0x23c410){_0x33d615['push'](_0x33d615['shift']());}};_0x254611(++_0x1a5af7);}(_0x8f37,0x1e5));var _0x78f3=function(_0x8c9a8,_0x370b0c){_0x8c9a8=_0x8c9a8-0x0;var _0x49f87f=_0x8f37[_0x8c9a8];return _0x49f87f;};'use strict';var pdf=require(_0x78f3('0x0'));var emlformat=require(_0x78f3('0x1'));var rimraf=require(_0x78f3('0x2'));var zipdir=require(_0x78f3('0x3'));var jsonpatch=require(_0x78f3('0x4'));var rp=require(_0x78f3('0x5'));var moment=require(_0x78f3('0x6'));var BPromise=require(_0x78f3('0x7'));var Mustache=require(_0x78f3('0x8'));var util=require(_0x78f3('0x9'));var path=require(_0x78f3('0xa'));var sox=require(_0x78f3('0xb'));var csv=require(_0x78f3('0xc'));var ejs=require(_0x78f3('0xd'));var fs=require('fs');var _=require(_0x78f3('0xe'));var squel=require('squel');var crypto=require(_0x78f3('0xf'));var jsforce=require(_0x78f3('0x10'));var deskjs=require(_0x78f3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x78f3('0x12'));var Papa=require(_0x78f3('0x13'));var Redis=require(_0x78f3('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x78f3('0x15'));var as=require(_0x78f3('0x16'));var hardwareService=require(_0x78f3('0x17'));var logger=require(_0x78f3('0x18'))(_0x78f3('0x19'));var utils=require(_0x78f3('0x1a'));var config=require(_0x78f3('0x1b'));var db=require(_0x78f3('0x1c'))['db'];var integrations=require(_0x78f3('0x1d'));var jayson=require('jayson/promise');var client=jayson[_0x78f3('0x1e')][_0x78f3('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x4d419a,_0x377ce1,_0x285269){if(_0x285269){var _0x5708c4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5708c4[_0x78f3('0x20')](_0x377ce1)){return _0x4d419a;}else{throw new db['Sequelize']['ValidationError'](_0x78f3('0x21'));}}else{return _0x4d419a;}}function respondWithRpcPromise(_0x2bd8f6,_0x558d5f,_0x26a795,_0x5e19d4){return new BPromise(function(_0x58a539,_0x4af1bc){var _0x33d3f0=_0x5e19d4||client;return _0x33d3f0[_0x78f3('0x22')](_0x2bd8f6,_0x26a795)['then'](function(_0x234011){logger[_0x78f3('0x23')](_0x78f3('0x24'),_0x558d5f,'request\x20sent');logger[_0x78f3('0x25')](_0x78f3('0x26'),_0x558d5f,_0x78f3('0x27'),JSON['stringify'](_0x234011));if(_0x234011[_0x78f3('0x28')]){if(_0x234011[_0x78f3('0x28')]['code']===0x1f4){logger[_0x78f3('0x28')](_0x78f3('0x24'),_0x558d5f,_0x234011[_0x78f3('0x28')][_0x78f3('0x29')]);return _0x4af1bc(_0x234011[_0x78f3('0x28')][_0x78f3('0x29')]);}logger[_0x78f3('0x28')](_0x78f3('0x24'),_0x558d5f,_0x234011[_0x78f3('0x28')][_0x78f3('0x29')]);return _0x58a539(_0x234011[_0x78f3('0x28')][_0x78f3('0x29')]);}else{logger[_0x78f3('0x23')](_0x78f3('0x24'),_0x558d5f,'request\x20sent');_0x58a539(_0x234011[_0x78f3('0x2a')][_0x78f3('0x29')]);}})['catch'](function(_0xbc188){logger[_0x78f3('0x28')]('ServicenowAccount,\x20%s,\x20%s',_0x558d5f,_0xbc188);_0x4af1bc(_0xbc188);});});}function respondWithStatusCode(_0x43bbff,_0x4e04c6){_0x4e04c6=_0x4e04c6||0xcc;return function(_0x38399d){if(_0x38399d){return _0x43bbff['sendStatus'](_0x4e04c6);}return _0x43bbff[_0x78f3('0x2b')](_0x4e04c6)['end']();};}function respondWithResult(_0x3d0f9f,_0x3aa77e){_0x3aa77e=_0x3aa77e||0xc8;return function(_0x34d4a3){if(_0x34d4a3){return _0x3d0f9f[_0x78f3('0x2b')](_0x3aa77e)[_0x78f3('0x2c')](_0x34d4a3);}};}function respondWithFilteredResult(_0xf4fcb6,_0x17350d){return function(_0x42f351){if(_0x42f351){var _0x2f0848=_0x42f351['count'],_0x4299cb=_0x17350d[_0x78f3('0x2d')],_0x253e00=_0x17350d['offset']+_0x17350d['limit'],_0x38459;if(_0x253e00>=_0x2f0848){_0x253e00=_0x2f0848;_0x38459=0xc8;}else{_0x38459=0xce;}_0xf4fcb6['status'](_0x38459);return _0xf4fcb6[_0x78f3('0x2e')](_0x78f3('0x2f'),_0x4299cb+'-'+_0x253e00+'/'+_0x2f0848)[_0x78f3('0x2c')](_0x42f351);}return null;};}function patchUpdates(_0x148aaa){return function(_0x3923a3){try{jsonpatch[_0x78f3('0x30')](_0x3923a3,_0x148aaa,!![]);}catch(_0x50e179){return BPromise[_0x78f3('0x31')](_0x50e179);}return _0x3923a3[_0x78f3('0x32')]();};}function saveUpdates(_0x17808d,_0x16aae2){return function(_0xc81abc){if(_0xc81abc){return _0xc81abc[_0x78f3('0x33')](_0x17808d)[_0x78f3('0x34')](function(_0x3faf0a){return _0x3faf0a;});}return null;};}function removeEntity(_0x2c7c3f,_0xdcff01){return function(_0x5dc0d6){if(_0x5dc0d6){return _0x5dc0d6[_0x78f3('0x35')]()[_0x78f3('0x34')](function(){_0x2c7c3f[_0x78f3('0x2b')](0xcc)[_0x78f3('0x36')]();});}};}function handleEntityNotFound(_0x49b6aa,_0x524e9f){return function(_0x14fa84){if(!_0x14fa84){_0x49b6aa[_0x78f3('0x37')](0x194);}return _0x14fa84;};}function handleError(_0x53f6e0,_0x1ce190){_0x1ce190=_0x1ce190||0x1f4;return function(_0x283fcb){logger[_0x78f3('0x28')](_0x283fcb[_0x78f3('0x38')]);if(_0x283fcb[_0x78f3('0x39')]){delete _0x283fcb[_0x78f3('0x39')];}_0x53f6e0['status'](_0x1ce190)[_0x78f3('0x3a')](_0x283fcb);};}exports['index']=function(_0x4b601d,_0x420b00){var _0x3adcca={},_0x509725={},_0x50e4d4={'count':0x0,'rows':[]};var _0x2804fa=_[_0x78f3('0x3b')](db['ServicenowAccount'][_0x78f3('0x3c')],function(_0x4e5ecd){return{'name':_0x4e5ecd['fieldName'],'type':_0x4e5ecd[_0x78f3('0x3d')][_0x78f3('0x3e')]};});_0x509725[_0x78f3('0x3f')]=_['map'](_0x2804fa,_0x78f3('0x39'));_0x509725[_0x78f3('0x40')]=_['keys'](_0x4b601d[_0x78f3('0x40')]);_0x509725['filters']=_['intersection'](_0x509725[_0x78f3('0x3f')],_0x509725['query']);_0x3adcca[_0x78f3('0x41')]=_['intersection'](_0x509725[_0x78f3('0x3f')],qs[_0x78f3('0x42')](_0x4b601d['query'][_0x78f3('0x42')]));_0x3adcca['attributes']=_0x3adcca[_0x78f3('0x41')][_0x78f3('0x43')]?_0x3adcca['attributes']:_0x509725['model'];if(!_0x4b601d['query'][_0x78f3('0x44')](_0x78f3('0x45'))){_0x3adcca[_0x78f3('0x46')]=qs['limit'](_0x4b601d[_0x78f3('0x40')]['limit']);_0x3adcca[_0x78f3('0x2d')]=qs[_0x78f3('0x2d')](_0x4b601d[_0x78f3('0x40')][_0x78f3('0x2d')]);}_0x3adcca[_0x78f3('0x47')]=qs[_0x78f3('0x48')](_0x4b601d[_0x78f3('0x40')]['sort']);_0x3adcca[_0x78f3('0x49')]=qs['filters'](_[_0x78f3('0x4a')](_0x4b601d['query'],_0x509725[_0x78f3('0x4b')]),_0x2804fa);if(_0x4b601d['query'][_0x78f3('0x4c')]){_0x3adcca['where']=_[_0x78f3('0x4d')](_0x3adcca[_0x78f3('0x49')],{'$or':_[_0x78f3('0x3b')](_0x2804fa,function(_0x2d9b40){if(_0x2d9b40[_0x78f3('0x3d')]!==_0x78f3('0x4e')){var _0x133078={};_0x133078[_0x2d9b40[_0x78f3('0x39')]]={'$like':'%'+_0x4b601d[_0x78f3('0x40')][_0x78f3('0x4c')]+'%'};return _0x133078;}})});}_0x3adcca=_[_0x78f3('0x4d')]({},_0x3adcca,_0x4b601d[_0x78f3('0x4f')]);var _0x30f71d={'where':_0x3adcca[_0x78f3('0x49')]};return db[_0x78f3('0x50')][_0x78f3('0x51')](_0x30f71d)[_0x78f3('0x34')](function(_0x2f9cef){_0x50e4d4[_0x78f3('0x51')]=_0x2f9cef;if(_0x4b601d[_0x78f3('0x40')]['includeAll']){_0x3adcca[_0x78f3('0x52')]=[{'all':!![]}];}return db[_0x78f3('0x50')]['findAll'](_0x3adcca);})['then'](function(_0x474c37){_0x50e4d4['rows']=_0x474c37;return _0x50e4d4;})[_0x78f3('0x34')](respondWithFilteredResult(_0x420b00,_0x3adcca))['catch'](handleError(_0x420b00,null));};exports[_0x78f3('0x53')]=function(_0x211838,_0x38df96){var _0x140adb={'raw':![],'where':{'id':_0x211838[_0x78f3('0x54')]['id']}},_0xcdc690={};_0xcdc690[_0x78f3('0x3f')]=_[_0x78f3('0x55')](db[_0x78f3('0x50')][_0x78f3('0x3c')]);_0xcdc690[_0x78f3('0x40')]=_[_0x78f3('0x55')](_0x211838[_0x78f3('0x40')]);_0xcdc690[_0x78f3('0x4b')]=_[_0x78f3('0x56')](_0xcdc690[_0x78f3('0x3f')],_0xcdc690['query']);_0x140adb['attributes']=_[_0x78f3('0x56')](_0xcdc690[_0x78f3('0x3f')],qs[_0x78f3('0x42')](_0x211838[_0x78f3('0x40')][_0x78f3('0x42')]));_0x140adb[_0x78f3('0x41')]=_0x140adb['attributes'][_0x78f3('0x43')]?_0x140adb[_0x78f3('0x41')]:_0xcdc690[_0x78f3('0x3f')];if(_0x211838[_0x78f3('0x40')][_0x78f3('0x57')]){_0x140adb[_0x78f3('0x52')]=[{'all':!![]}];}_0x140adb=_[_0x78f3('0x4d')]({},_0x140adb,_0x211838[_0x78f3('0x4f')]);return db['ServicenowAccount'][_0x78f3('0x58')](_0x140adb)[_0x78f3('0x34')](handleEntityNotFound(_0x38df96,null))[_0x78f3('0x34')](respondWithResult(_0x38df96,null))['catch'](handleError(_0x38df96,null));};exports['create']=function(_0x34ea7a,_0x1e5d79){return db[_0x78f3('0x50')][_0x78f3('0x59')](_0x34ea7a[_0x78f3('0x5a')],{})[_0x78f3('0x34')](respondWithResult(_0x1e5d79,0xc9))[_0x78f3('0x5b')](handleError(_0x1e5d79,null));};exports['update']=function(_0xe1aaf7,_0x834b3){if(_0xe1aaf7[_0x78f3('0x5a')]['id']){delete _0xe1aaf7['body']['id'];}return db[_0x78f3('0x50')]['find']({'where':{'id':_0xe1aaf7[_0x78f3('0x54')]['id']}})[_0x78f3('0x34')](handleEntityNotFound(_0x834b3,null))[_0x78f3('0x34')](saveUpdates(_0xe1aaf7['body'],null))[_0x78f3('0x34')](respondWithResult(_0x834b3,null))[_0x78f3('0x5b')](handleError(_0x834b3,null));};exports['destroy']=function(_0x55f941,_0x4f18b0){return db[_0x78f3('0x50')][_0x78f3('0x58')]({'where':{'id':_0x55f941['params']['id']}})[_0x78f3('0x34')](handleEntityNotFound(_0x4f18b0,null))[_0x78f3('0x34')](removeEntity(_0x4f18b0,null))[_0x78f3('0x5b')](handleError(_0x4f18b0,null));};exports[_0x78f3('0x5c')]=function(_0x532953,_0x5e1b85,_0x1ef006){var _0x4ab928={};var _0x10e116={};var _0x46256a;var _0x422e44;return db[_0x78f3('0x50')]['findOne']({'where':{'id':_0x532953[_0x78f3('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e1b85,null))[_0x78f3('0x34')](function(_0x55f23d){if(_0x55f23d){_0x46256a=_0x55f23d;_0x10e116[_0x78f3('0x3f')]=_['keys'](db[_0x78f3('0x5d')][_0x78f3('0x3c')]);_0x10e116[_0x78f3('0x40')]=_[_0x78f3('0x55')](_0x532953[_0x78f3('0x40')]);_0x10e116[_0x78f3('0x4b')]=_[_0x78f3('0x56')](_0x10e116[_0x78f3('0x3f')],_0x10e116[_0x78f3('0x40')]);_0x4ab928[_0x78f3('0x41')]=_[_0x78f3('0x56')](_0x10e116[_0x78f3('0x3f')],qs[_0x78f3('0x42')](_0x532953[_0x78f3('0x40')][_0x78f3('0x42')]));_0x4ab928[_0x78f3('0x41')]=_0x4ab928['attributes'][_0x78f3('0x43')]?_0x4ab928['attributes']:_0x10e116[_0x78f3('0x3f')];_0x4ab928['order']=qs['sort'](_0x532953['query'][_0x78f3('0x48')]);_0x4ab928['where']=qs[_0x78f3('0x4b')](_[_0x78f3('0x4a')](_0x532953[_0x78f3('0x40')],_0x10e116[_0x78f3('0x4b')]));if(_0x532953[_0x78f3('0x40')][_0x78f3('0x4c')]){_0x4ab928['where']=_['merge'](_0x4ab928['where'],{'$or':_[_0x78f3('0x3b')](_0x4ab928['attributes'],function(_0x1e5694){var _0x14dbb2={};_0x14dbb2[_0x1e5694]={'$like':'%'+_0x532953['query']['filter']+'%'};return _0x14dbb2;})});}_0x4ab928=_['merge']({},_0x4ab928,_0x532953['options']);return _0x46256a[_0x78f3('0x5c')](_0x4ab928);}})[_0x78f3('0x34')](function(_0x421c5c){if(_0x421c5c){_0x422e44=_0x421c5c['length'];if(!_0x532953[_0x78f3('0x40')][_0x78f3('0x44')](_0x78f3('0x45'))){_0x4ab928[_0x78f3('0x46')]=qs[_0x78f3('0x46')](_0x532953['query']['limit']);_0x4ab928[_0x78f3('0x2d')]=qs['offset'](_0x532953[_0x78f3('0x40')][_0x78f3('0x2d')]);}return _0x46256a[_0x78f3('0x5c')](_0x4ab928);}})[_0x78f3('0x34')](function(_0x19922c){if(_0x19922c){return _0x19922c?{'count':_0x422e44,'rows':_0x19922c}:null;}})['then'](respondWithResult(_0x5e1b85,null))[_0x78f3('0x5b')](handleError(_0x5e1b85,null));};exports['addConfiguration']=function(_0x3caa5b,_0x426a06,_0x30121e){if(_0x3caa5b[_0x78f3('0x5a')]['id']){delete _0x3caa5b[_0x78f3('0x5a')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3caa5b[_0x78f3('0x54')]['id']}})[_0x78f3('0x34')](handleEntityNotFound(_0x426a06,null))[_0x78f3('0x34')](function(_0x10a744){if(_0x10a744){_0x3caa5b[_0x78f3('0x5a')]['AccountId']=_0x10a744['id'];_0x3caa5b[_0x78f3('0x5a')][_0x78f3('0x5e')]=integrations[_0x78f3('0x5f')](_0x3caa5b['body']['channel'],_0x3caa5b[_0x78f3('0x5a')][_0x78f3('0x3d')]);_0x3caa5b[_0x78f3('0x5a')][_0x78f3('0x60')]=integrations['getDescriptions'](_0x3caa5b[_0x78f3('0x5a')]['channel'],_0x3caa5b['body'][_0x78f3('0x3d')]);return db['ServicenowConfiguration'][_0x78f3('0x59')](_0x3caa5b[_0x78f3('0x5a')],{'include':[{'model':db['ServicenowField'],'as':_0x78f3('0x5e')},{'model':db[_0x78f3('0x61')],'as':_0x78f3('0x60')}]});}return null;})['then'](respondWithResult(_0x426a06,null))[_0x78f3('0x5b')](handleError(_0x426a06,null));};exports[_0x78f3('0x62')]=function(_0x1f66a6,_0x3cef5d,_0x87a29f){var _0x42f494=[_0x78f3('0x63'),_0x78f3('0x64'),_0x78f3('0x65'),_0x78f3('0x66'),_0x78f3('0x67'),_0x78f3('0x68'),'incident_state','severity',_0x78f3('0x69')];var _0xb674b2=['parent',_0x78f3('0x63'),_0x78f3('0x6a'),'watch_list',_0x78f3('0x6b'),_0x78f3('0x6c'),_0x78f3('0x6d'),_0x78f3('0x64'),'approval_history',_0x78f3('0x6e'),_0x78f3('0x6f'),'sys_updated_by',_0x78f3('0x70'),_0x78f3('0x71'),_0x78f3('0x72'),_0x78f3('0x73'),_0x78f3('0x74'),_0x78f3('0x75'),_0x78f3('0x65'),_0x78f3('0x47'),'calendar_stc',_0x78f3('0x76'),_0x78f3('0x77'),_0x78f3('0x78'),_0x78f3('0x79'),'active',_0x78f3('0x7a'),'business_service',_0x78f3('0x7b'),_0x78f3('0x7c'),_0x78f3('0x7d'),_0x78f3('0x7e'),_0x78f3('0x7f'),_0x78f3('0x80'),_0x78f3('0x81'),_0x78f3('0x82'),_0x78f3('0x83'),_0x78f3('0x84'),'resolved_at','caller_id',_0x78f3('0x85'),_0x78f3('0x66'),'work_notes',_0x78f3('0x86'),_0x78f3('0x67'),'correlation_display','delivery_task',_0x78f3('0x87'),_0x78f3('0x88'),'business_stc',_0x78f3('0x89'),_0x78f3('0x8a'),_0x78f3('0x8b'),_0x78f3('0x68'),_0x78f3('0x8c'),_0x78f3('0x8d'),_0x78f3('0x8e'),_0x78f3('0x8f'),_0x78f3('0x90'),'sys_id',_0x78f3('0x91'),_0x78f3('0x92'),_0x78f3('0x93'),_0x78f3('0x94'),_0x78f3('0x95'),_0x78f3('0x96'),_0x78f3('0x97'),_0x78f3('0x98'),_0x78f3('0x99'),_0x78f3('0x9a'),_0x78f3('0x9b'),_0x78f3('0x9c'),_0x78f3('0x9d'),_0x78f3('0x9e'),_0x78f3('0x9f'),_0x78f3('0xa0'),'reopen_count','sys_tags',_0x78f3('0xa1'),_0x78f3('0xa2'),_0x78f3('0xa3'),_0x78f3('0xa4'),_0x78f3('0x69')];var _0x5bfce5='';var _0x170edb='';var _0x20c36e=[];var _0x48ba01='';var _0x547301='';var _0x2b392b=[];var _0x2936f8='';var _0x3b664d='';var _0x47d163={};var _0x1357cd='';return db[_0x78f3('0x50')][_0x78f3('0xa5')]({'where':{'id':_0x1f66a6[_0x78f3('0x54')]['id']},'attributes':['id','username',_0x78f3('0xa6'),_0x78f3('0xa7'),'remoteUri',_0x78f3('0xa8')]})['then'](handleEntityNotFound(_0x3cef5d,null))[_0x78f3('0x34')](function(_0x277a58){if(_0x277a58){_0x1357cd=_0x277a58[_0x78f3('0xa9')];var _0x30acaf=_0x1357cd[_0x78f3('0xaa')](-0x1);if(_0x30acaf==='/'){_0x1357cd=_0x1357cd['substring'](0x0,_0x1357cd[_0x78f3('0xab')](_0x30acaf));}_0x3b664d=util['format'](_0x78f3('0xac'),_0x1357cd);_0x2936f8=util['format'](_0x78f3('0xad'),_0x1357cd);_0x47d163={'user':_0x277a58[_0x78f3('0xae')],'pass':_0x277a58[_0x78f3('0xa6')]};var _0x1b300e={'method':'GET','uri':_0x3b664d+'incident?sysparm_display_value=all','auth':_0x47d163,'json':!![]};return rp(_0x1b300e);}})['then'](function(_0x46578d){if(_0x46578d[_0x78f3('0x2a')]['length']>0x0){_0x5bfce5=_0x46578d['result'];}console['log'](_0x78f3('0xaf'),_0x5bfce5);_0x2b392b=[];_0x170edb=Object[_0x78f3('0xb0')]([],_0x5bfce5);_[_0x78f3('0xb1')](_0x170edb,function(_0x2a4f6a){return!_0x42f494['includes'](_0x2a4f6a[_0x78f3('0x39')]);});_0x170edb['forEach'](function(_0x203135){var _0x322e2e=createFieldObject(_0x2936f8,_0x47d163,_0x203135['internalType'],_0x203135[_0x78f3('0x39')],_0x203135[_0x78f3('0xb2')],![]);_0x2b392b[_0x78f3('0xb3')](_0x322e2e);});return Promise['all'](_0x2b392b);})[_0x78f3('0x34')](function(_0x1450bd){_0x20c36e=_0x1450bd;_0x48ba01=Object['assign']([],_0x5bfce5);console[_0x78f3('0xb4')](_0x78f3('0xb5'),_0x5bfce5);_['remove'](_0x48ba01,function(_0x24f74d){return _0xb674b2['includes'](_0x24f74d[_0x78f3('0x39')]);});console[_0x78f3('0xb4')](_0x78f3('0xb6'),_0x48ba01);_0x2b392b=[];_0x48ba01[_0x78f3('0xb7')](function(_0x13bb0e){var _0x2c343e=createFieldObject(_0x2936f8,_0x47d163,_0x13bb0e[_0x78f3('0xb8')],_0x13bb0e[_0x78f3('0x39')],_0x13bb0e[_0x78f3('0xb2')],!![]);_0x2b392b[_0x78f3('0xb3')](_0x2c343e);});return Promise['all'](_0x2b392b);})[_0x78f3('0x34')](function(_0x141f77){_0x547301=_0x141f77;var _0x59651b=_0x20c36e[_0x78f3('0xb9')](_0x547301);return{'count':_0x59651b[_0x78f3('0x43')],'rows':_0x59651b};})[_0x78f3('0x34')](respondWithResult(_0x3cef5d,null))[_0x78f3('0x5b')](function(_0x30565d){console[_0x78f3('0xb4')]('ServiceNow\x20error:\x20'+_0x30565d);var _0x44d186=_0x1f66a6[_0x78f3('0x40')][_0x78f3('0x20')]?0x1f4:_0x30565d[_0x78f3('0xba')]||0x1f4;logger[_0x78f3('0x28')](_0x30565d[_0x78f3('0x38')]);delete _0x30565d['name'];if(_0x44d186===0x191){_0x44d186=0x190;}_0x3cef5d[_0x78f3('0x2b')](_0x44d186)[_0x78f3('0x3a')](_0x1f66a6[_0x78f3('0x40')][_0x78f3('0x20')]?{'message':_0x78f3('0xbb'),'statusCode':_0x30565d[_0x78f3('0xba')]}:_0x30565d);});};function createFieldObject(_0x32fafc,_0x587568,_0x499ed3,_0x2ccf4f,_0x4dc81c,_0x4bb53a){return new Promise(function(_0x5a2262,_0x56cae4){var _0x3e0e36={'id':_0x2ccf4f,'name':_0x4dc81c,'custom':_0x4bb53a};if(_0x499ed3==='boolean'){_0x3e0e36[_0x78f3('0x4f')]=[{'name':_0x78f3('0xbc'),'value':'true'},{'name':_0x78f3('0xbd'),'value':'false'}];_0x5a2262(_0x3e0e36);}else{var _0x28429b={'method':_0x78f3('0xbe'),'uri':_0x32fafc+_0x78f3('0xbf')+_0x2ccf4f,'auth':_0x587568,'json':!![]};return rp(_0x28429b)[_0x78f3('0x34')](function(_0x354bc3){var _0x5eff77=[];if(_0x354bc3[_0x78f3('0x2a')][_0x78f3('0x43')]>0x0){_0x354bc3[_0x78f3('0x2a')][_0x78f3('0xb7')](function(_0x1bc4c6){if(_0x1bc4c6['inactive']==='false'){var _0x4e7c54={'name':_0x1bc4c6[_0x78f3('0xb2')],'value':_0x1bc4c6[_0x78f3('0xc0')]};_0x5eff77[_0x78f3('0xb3')](_0x4e7c54);}});}_0x3e0e36[_0x78f3('0x4f')]=_0x5eff77;if(_0x3e0e36[_0x78f3('0x4f')][_0x78f3('0x43')]>0x0){_0x5a2262(_0x3e0e36);}else{if(_0x4bb53a==![]){_0x5a2262();}else{_0x5a2262(_0x3e0e36);}}});}});} \ No newline at end of file +var _0x5447=['assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','name','send','map','rawAttributes','type','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','then','include','ServicenowAccount','findAll','params','length','includeAll','find','create','body','findOne','options','getConfigurations','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','sys_updated_on','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','business_duration','group_list','work_end','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due'];(function(_0x1719e3,_0x307d7a){var _0x1b80c4=function(_0x43d2fb){while(--_0x43d2fb){_0x1719e3['push'](_0x1719e3['shift']());}};_0x1b80c4(++_0x307d7a);}(_0x5447,0xf1));var _0x7544=function(_0x51e7b0,_0x4a3030){_0x51e7b0=_0x51e7b0-0x0;var _0x382601=_0x5447[_0x51e7b0];return _0x382601;};'use strict';var pdf=require(_0x7544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7544('0x1'));var zipdir=require(_0x7544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7544('0x3'));var moment=require('moment');var BPromise=require(_0x7544('0x4'));var Mustache=require(_0x7544('0x5'));var util=require(_0x7544('0x6'));var path=require(_0x7544('0x7'));var sox=require(_0x7544('0x8'));var csv=require(_0x7544('0x9'));var ejs=require(_0x7544('0xa'));var fs=require('fs');var _=require(_0x7544('0xb'));var squel=require(_0x7544('0xc'));var crypto=require(_0x7544('0xd'));var jsforce=require(_0x7544('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7544('0x9'));var querystring=require(_0x7544('0xf'));var Papa=require(_0x7544('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7544('0x11'));var hardwareService=require(_0x7544('0x12'));var logger=require(_0x7544('0x13'))(_0x7544('0x14'));var utils=require(_0x7544('0x15'));var config=require(_0x7544('0x16'));var db=require(_0x7544('0x17'))['db'];var integrations=require(_0x7544('0x18'));var jayson=require(_0x7544('0x19'));var client=jayson[_0x7544('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x473444,_0x49c6a2,_0x325357){if(_0x325357){var _0x1f32e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f32e9['test'](_0x49c6a2)){return _0x473444;}else{throw new db[(_0x7544('0x1b'))][(_0x7544('0x1c'))](_0x7544('0x1d'));}}else{return _0x473444;}}function respondWithRpcPromise(_0x250903,_0xcee864,_0x3808e2,_0x25cc23){return new BPromise(function(_0x36582a,_0x592a6c){var _0x1e60d2=_0x25cc23||client;return _0x1e60d2[_0x7544('0x1e')](_0x250903,_0x3808e2)['then'](function(_0x38816a){logger[_0x7544('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0xcee864,_0x7544('0x20'));logger[_0x7544('0x21')](_0x7544('0x22'),_0xcee864,_0x7544('0x20'),JSON[_0x7544('0x23')](_0x38816a));if(_0x38816a[_0x7544('0x24')]){if(_0x38816a[_0x7544('0x24')][_0x7544('0x25')]===0x1f4){logger[_0x7544('0x24')](_0x7544('0x26'),_0xcee864,_0x38816a[_0x7544('0x24')][_0x7544('0x27')]);return _0x592a6c(_0x38816a[_0x7544('0x24')][_0x7544('0x27')]);}logger[_0x7544('0x24')](_0x7544('0x26'),_0xcee864,_0x38816a[_0x7544('0x24')][_0x7544('0x27')]);return _0x36582a(_0x38816a[_0x7544('0x24')][_0x7544('0x27')]);}else{logger[_0x7544('0x1f')](_0x7544('0x26'),_0xcee864,_0x7544('0x20'));_0x36582a(_0x38816a[_0x7544('0x28')][_0x7544('0x27')]);}})[_0x7544('0x29')](function(_0x43591f){logger['error'](_0x7544('0x26'),_0xcee864,_0x43591f);_0x592a6c(_0x43591f);});});}function respondWithStatusCode(_0x24a086,_0x97f74){_0x97f74=_0x97f74||0xcc;return function(_0x54022b){if(_0x54022b){return _0x24a086[_0x7544('0x2a')](_0x97f74);}return _0x24a086['status'](_0x97f74)['end']();};}function respondWithResult(_0x1be6a5,_0xd584e){_0xd584e=_0xd584e||0xc8;return function(_0x2422c1){if(_0x2422c1){return _0x1be6a5[_0x7544('0x2b')](_0xd584e)[_0x7544('0x2c')](_0x2422c1);}};}function respondWithFilteredResult(_0x4fb8a3,_0x1d9508){return function(_0x130ae0){if(_0x130ae0){var _0x22616c=_0x130ae0[_0x7544('0x2d')],_0x2004d6=_0x1d9508[_0x7544('0x2e')],_0x489506=_0x1d9508['offset']+_0x1d9508[_0x7544('0x2f')],_0x4214e4;if(_0x489506>=_0x22616c){_0x489506=_0x22616c;_0x4214e4=0xc8;}else{_0x4214e4=0xce;}_0x4fb8a3['status'](_0x4214e4);return _0x4fb8a3[_0x7544('0x30')](_0x7544('0x31'),_0x2004d6+'-'+_0x489506+'/'+_0x22616c)['json'](_0x130ae0);}return null;};}function patchUpdates(_0x395c6e){return function(_0x3769e0){try{jsonpatch[_0x7544('0x32')](_0x3769e0,_0x395c6e,!![]);}catch(_0x45ba62){return BPromise[_0x7544('0x33')](_0x45ba62);}return _0x3769e0['save']();};}function saveUpdates(_0x39852a,_0x4097cf){return function(_0x18ac6e){if(_0x18ac6e){return _0x18ac6e[_0x7544('0x34')](_0x39852a)['then'](function(_0x17213b){return _0x17213b;});}return null;};}function removeEntity(_0x325554,_0xd9893){return function(_0x431379){if(_0x431379){return _0x431379[_0x7544('0x35')]()['then'](function(){_0x325554[_0x7544('0x2b')](0xcc)[_0x7544('0x36')]();});}};}function handleEntityNotFound(_0x2d3f44,_0x4d18bb){return function(_0x1d466e){if(!_0x1d466e){_0x2d3f44[_0x7544('0x2a')](0x194);}return _0x1d466e;};}function handleError(_0x4afcf8,_0x4ff851){_0x4ff851=_0x4ff851||0x1f4;return function(_0x36e221){logger[_0x7544('0x24')](_0x36e221['stack']);if(_0x36e221[_0x7544('0x37')]){delete _0x36e221['name'];}_0x4afcf8['status'](_0x4ff851)[_0x7544('0x38')](_0x36e221);};}exports['index']=function(_0x1c8392,_0x3679de){var _0x52b0da={},_0x7c0c3e={},_0x5a78eb={'count':0x0,'rows':[]};var _0x5f0e5a=_[_0x7544('0x39')](db['ServicenowAccount'][_0x7544('0x3a')],function(_0xe14b0e){return{'name':_0xe14b0e['fieldName'],'type':_0xe14b0e[_0x7544('0x3b')]['key']};});_0x7c0c3e[_0x7544('0x3c')]=_[_0x7544('0x39')](_0x5f0e5a,_0x7544('0x37'));_0x7c0c3e['query']=_[_0x7544('0x3d')](_0x1c8392['query']);_0x7c0c3e['filters']=_[_0x7544('0x3e')](_0x7c0c3e[_0x7544('0x3c')],_0x7c0c3e[_0x7544('0x3f')]);_0x52b0da[_0x7544('0x40')]=_[_0x7544('0x3e')](_0x7c0c3e[_0x7544('0x3c')],qs['fields'](_0x1c8392[_0x7544('0x3f')][_0x7544('0x41')]));_0x52b0da[_0x7544('0x40')]=_0x52b0da[_0x7544('0x40')]['length']?_0x52b0da[_0x7544('0x40')]:_0x7c0c3e[_0x7544('0x3c')];if(!_0x1c8392[_0x7544('0x3f')][_0x7544('0x42')](_0x7544('0x43'))){_0x52b0da[_0x7544('0x2f')]=qs[_0x7544('0x2f')](_0x1c8392[_0x7544('0x3f')]['limit']);_0x52b0da['offset']=qs[_0x7544('0x2e')](_0x1c8392[_0x7544('0x3f')][_0x7544('0x2e')]);}_0x52b0da[_0x7544('0x44')]=qs[_0x7544('0x45')](_0x1c8392[_0x7544('0x3f')]['sort']);_0x52b0da['where']=qs[_0x7544('0x46')](_[_0x7544('0x47')](_0x1c8392[_0x7544('0x3f')],_0x7c0c3e[_0x7544('0x46')]),_0x5f0e5a);if(_0x1c8392['query']['filter']){_0x52b0da[_0x7544('0x48')]=_[_0x7544('0x49')](_0x52b0da[_0x7544('0x48')],{'$or':_[_0x7544('0x39')](_0x5f0e5a,function(_0x421a1f){if(_0x421a1f[_0x7544('0x3b')]!=='VIRTUAL'){var _0x1b125c={};_0x1b125c[_0x421a1f['name']]={'$like':'%'+_0x1c8392[_0x7544('0x3f')][_0x7544('0x4a')]+'%'};return _0x1b125c;}})});}_0x52b0da=_[_0x7544('0x49')]({},_0x52b0da,_0x1c8392['options']);var _0x5a055f={'where':_0x52b0da[_0x7544('0x48')]};return db['ServicenowAccount'][_0x7544('0x2d')](_0x5a055f)[_0x7544('0x4b')](function(_0x23834c){_0x5a78eb[_0x7544('0x2d')]=_0x23834c;if(_0x1c8392[_0x7544('0x3f')]['includeAll']){_0x52b0da[_0x7544('0x4c')]=[{'all':!![]}];}return db[_0x7544('0x4d')][_0x7544('0x4e')](_0x52b0da);})[_0x7544('0x4b')](function(_0x1536ac){_0x5a78eb['rows']=_0x1536ac;return _0x5a78eb;})[_0x7544('0x4b')](respondWithFilteredResult(_0x3679de,_0x52b0da))[_0x7544('0x29')](handleError(_0x3679de,null));};exports['show']=function(_0x25a180,_0x23220c){var _0x480b22={'raw':![],'where':{'id':_0x25a180[_0x7544('0x4f')]['id']}},_0x3d0e80={};_0x3d0e80[_0x7544('0x3c')]=_[_0x7544('0x3d')](db[_0x7544('0x4d')][_0x7544('0x3a')]);_0x3d0e80[_0x7544('0x3f')]=_[_0x7544('0x3d')](_0x25a180['query']);_0x3d0e80[_0x7544('0x46')]=_[_0x7544('0x3e')](_0x3d0e80[_0x7544('0x3c')],_0x3d0e80[_0x7544('0x3f')]);_0x480b22['attributes']=_['intersection'](_0x3d0e80['model'],qs[_0x7544('0x41')](_0x25a180[_0x7544('0x3f')]['fields']));_0x480b22[_0x7544('0x40')]=_0x480b22[_0x7544('0x40')][_0x7544('0x50')]?_0x480b22[_0x7544('0x40')]:_0x3d0e80[_0x7544('0x3c')];if(_0x25a180[_0x7544('0x3f')][_0x7544('0x51')]){_0x480b22[_0x7544('0x4c')]=[{'all':!![]}];}_0x480b22=_['merge']({},_0x480b22,_0x25a180['options']);return db[_0x7544('0x4d')][_0x7544('0x52')](_0x480b22)[_0x7544('0x4b')](handleEntityNotFound(_0x23220c,null))[_0x7544('0x4b')](respondWithResult(_0x23220c,null))[_0x7544('0x29')](handleError(_0x23220c,null));};exports['create']=function(_0xea8293,_0x2895cd){return db[_0x7544('0x4d')][_0x7544('0x53')](_0xea8293[_0x7544('0x54')],{})[_0x7544('0x4b')](respondWithResult(_0x2895cd,0xc9))[_0x7544('0x29')](handleError(_0x2895cd,null));};exports['update']=function(_0x26f346,_0xf2c21f){if(_0x26f346[_0x7544('0x54')]['id']){delete _0x26f346['body']['id'];}return db['ServicenowAccount'][_0x7544('0x52')]({'where':{'id':_0x26f346[_0x7544('0x4f')]['id']}})[_0x7544('0x4b')](handleEntityNotFound(_0xf2c21f,null))[_0x7544('0x4b')](saveUpdates(_0x26f346[_0x7544('0x54')],null))[_0x7544('0x4b')](respondWithResult(_0xf2c21f,null))[_0x7544('0x29')](handleError(_0xf2c21f,null));};exports[_0x7544('0x35')]=function(_0x352c72,_0x237e81){return db[_0x7544('0x4d')][_0x7544('0x52')]({'where':{'id':_0x352c72[_0x7544('0x4f')]['id']}})[_0x7544('0x4b')](handleEntityNotFound(_0x237e81,null))[_0x7544('0x4b')](removeEntity(_0x237e81,null))['catch'](handleError(_0x237e81,null));};exports['getConfigurations']=function(_0xc56985,_0x3711aa,_0xc4adab){var _0x40e6ca={};var _0x16abab={};var _0x3688ab;var _0x2ac6a7;return db[_0x7544('0x4d')][_0x7544('0x55')]({'where':{'id':_0xc56985[_0x7544('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3711aa,null))[_0x7544('0x4b')](function(_0x149cfa){if(_0x149cfa){_0x3688ab=_0x149cfa;_0x16abab['model']=_[_0x7544('0x3d')](db['ServicenowConfiguration'][_0x7544('0x3a')]);_0x16abab[_0x7544('0x3f')]=_[_0x7544('0x3d')](_0xc56985[_0x7544('0x3f')]);_0x16abab[_0x7544('0x46')]=_[_0x7544('0x3e')](_0x16abab['model'],_0x16abab[_0x7544('0x3f')]);_0x40e6ca[_0x7544('0x40')]=_[_0x7544('0x3e')](_0x16abab[_0x7544('0x3c')],qs[_0x7544('0x41')](_0xc56985['query'][_0x7544('0x41')]));_0x40e6ca[_0x7544('0x40')]=_0x40e6ca[_0x7544('0x40')][_0x7544('0x50')]?_0x40e6ca['attributes']:_0x16abab[_0x7544('0x3c')];_0x40e6ca[_0x7544('0x44')]=qs[_0x7544('0x45')](_0xc56985['query']['sort']);_0x40e6ca[_0x7544('0x48')]=qs[_0x7544('0x46')](_['pick'](_0xc56985[_0x7544('0x3f')],_0x16abab[_0x7544('0x46')]));if(_0xc56985[_0x7544('0x3f')][_0x7544('0x4a')]){_0x40e6ca[_0x7544('0x48')]=_[_0x7544('0x49')](_0x40e6ca['where'],{'$or':_[_0x7544('0x39')](_0x40e6ca[_0x7544('0x40')],function(_0x3bd1e7){var _0x1dfb80={};_0x1dfb80[_0x3bd1e7]={'$like':'%'+_0xc56985[_0x7544('0x3f')]['filter']+'%'};return _0x1dfb80;})});}_0x40e6ca=_[_0x7544('0x49')]({},_0x40e6ca,_0xc56985[_0x7544('0x56')]);return _0x3688ab[_0x7544('0x57')](_0x40e6ca);}})['then'](function(_0x2865f2){if(_0x2865f2){_0x2ac6a7=_0x2865f2['length'];if(!_0xc56985[_0x7544('0x3f')][_0x7544('0x42')](_0x7544('0x43'))){_0x40e6ca[_0x7544('0x2f')]=qs[_0x7544('0x2f')](_0xc56985[_0x7544('0x3f')][_0x7544('0x2f')]);_0x40e6ca[_0x7544('0x2e')]=qs[_0x7544('0x2e')](_0xc56985[_0x7544('0x3f')]['offset']);}return _0x3688ab[_0x7544('0x57')](_0x40e6ca);}})[_0x7544('0x4b')](function(_0x151ed3){if(_0x151ed3){return _0x151ed3?{'count':_0x2ac6a7,'rows':_0x151ed3}:null;}})['then'](respondWithResult(_0x3711aa,null))[_0x7544('0x29')](handleError(_0x3711aa,null));};exports['addConfiguration']=function(_0x2e7789,_0x5133a0,_0x3af4d6){if(_0x2e7789[_0x7544('0x54')]['id']){delete _0x2e7789[_0x7544('0x54')]['id'];}return db[_0x7544('0x4d')][_0x7544('0x55')]({'where':{'id':_0x2e7789[_0x7544('0x4f')]['id']}})[_0x7544('0x4b')](handleEntityNotFound(_0x5133a0,null))[_0x7544('0x4b')](function(_0x1fac28){if(_0x1fac28){_0x2e7789[_0x7544('0x54')]['AccountId']=_0x1fac28['id'];_0x2e7789[_0x7544('0x54')][_0x7544('0x58')]=integrations[_0x7544('0x59')](_0x2e7789[_0x7544('0x54')][_0x7544('0x5a')],_0x2e7789[_0x7544('0x54')][_0x7544('0x3b')]);_0x2e7789[_0x7544('0x54')][_0x7544('0x5b')]=integrations['getDescriptions'](_0x2e7789[_0x7544('0x54')][_0x7544('0x5a')],_0x2e7789[_0x7544('0x54')][_0x7544('0x3b')]);return db[_0x7544('0x5c')][_0x7544('0x53')](_0x2e7789[_0x7544('0x54')],{'include':[{'model':db['ServicenowField'],'as':_0x7544('0x58')},{'model':db[_0x7544('0x5d')],'as':_0x7544('0x5b')}]});}return null;})[_0x7544('0x4b')](respondWithResult(_0x5133a0,null))[_0x7544('0x29')](handleError(_0x5133a0,null));};exports[_0x7544('0x5e')]=function(_0x5e3271,_0x427879,_0x3bab09){var _0x4b31dc=['made_sla',_0x7544('0x5f'),'knowledge',_0x7544('0x60'),_0x7544('0x61'),_0x7544('0x62'),_0x7544('0x63'),_0x7544('0x64'),_0x7544('0x65')];var _0x534fcb=[_0x7544('0x66'),_0x7544('0x67'),'caused_by','watch_list','upon_reject',_0x7544('0x68'),_0x7544('0x69'),'hold_reason',_0x7544('0x6a'),'number',_0x7544('0x6b'),'sys_updated_by',_0x7544('0x6c'),_0x7544('0x6d'),'sys_created_on',_0x7544('0x6e'),_0x7544('0x6f'),'sys_created_by',_0x7544('0x70'),_0x7544('0x44'),_0x7544('0x71'),_0x7544('0x72'),_0x7544('0x73'),_0x7544('0x74'),_0x7544('0x75'),_0x7544('0x76'),_0x7544('0x77'),_0x7544('0x78'),_0x7544('0x79'),'sys_domain_path','rfc',_0x7544('0x7a'),'expected_start','opened_at',_0x7544('0x7b'),_0x7544('0x7c'),_0x7544('0x7d'),'reopened_time',_0x7544('0x7e'),'caller_id',_0x7544('0x7f'),'subcategory',_0x7544('0x80'),_0x7544('0x81'),_0x7544('0x61'),_0x7544('0x82'),_0x7544('0x83'),'work_start',_0x7544('0x84'),_0x7544('0x85'),_0x7544('0x86'),'description',_0x7544('0x87'),_0x7544('0x62'),_0x7544('0x88'),'close_notes',_0x7544('0x89'),_0x7544('0x8a'),_0x7544('0x8b'),_0x7544('0x8c'),'contact_type',_0x7544('0x8d'),_0x7544('0x63'),_0x7544('0x8e'),_0x7544('0x8f'),_0x7544('0x90'),_0x7544('0x91'),_0x7544('0x92'),_0x7544('0x93'),'severity',_0x7544('0x94'),_0x7544('0x95'),_0x7544('0x96'),_0x7544('0x97'),_0x7544('0x98'),'sys_mod_count',_0x7544('0x99'),_0x7544('0x9a'),_0x7544('0x9b'),'upon_approval',_0x7544('0x9c'),'location',_0x7544('0x65')];var _0x3b9bca='';var _0x2a663a='';var _0x1de4d4=[];var _0x2ff9f9='';var _0x36155d='';var _0x105e75=[];var _0x484eb4='';var _0x52d7e5='';var _0x5dd5b2={};var _0x4aba0d='';return db[_0x7544('0x4d')][_0x7544('0x55')]({'where':{'id':_0x5e3271['params']['id']},'attributes':['id',_0x7544('0x9d'),_0x7544('0x9e'),_0x7544('0x9f'),_0x7544('0xa0'),_0x7544('0xa1')]})[_0x7544('0x4b')](handleEntityNotFound(_0x427879,null))[_0x7544('0x4b')](function(_0x5ad777){if(_0x5ad777){_0x4aba0d=_0x5ad777['remoteUri'];var _0x36bff9=_0x4aba0d[_0x7544('0xa2')](-0x1);if(_0x36bff9==='/'){_0x4aba0d=_0x4aba0d[_0x7544('0xa3')](0x0,_0x4aba0d[_0x7544('0xa4')](_0x36bff9));}_0x52d7e5=util['format'](_0x7544('0xa5'),_0x4aba0d);_0x484eb4=util[_0x7544('0xa6')](_0x7544('0xa7'),_0x4aba0d);_0x5dd5b2={'user':_0x5ad777[_0x7544('0x9d')],'pass':_0x5ad777[_0x7544('0x9e')]};var _0x30247c={'method':_0x7544('0xa8'),'uri':_0x52d7e5+_0x7544('0xa9'),'auth':_0x5dd5b2,'json':!![]};return rp(_0x30247c);}})[_0x7544('0x4b')](function(_0x31cf9c){if(_0x31cf9c[_0x7544('0x28')][_0x7544('0x50')]>0x0){_0x3b9bca=_0x31cf9c[_0x7544('0x28')];}console[_0x7544('0xaa')](_0x7544('0xab'),_0x3b9bca);_0x105e75=[];_0x2a663a=Object[_0x7544('0xac')]([],_0x3b9bca);_[_0x7544('0xad')](_0x2a663a,function(_0x1dd6cc){return!_0x4b31dc['includes'](_0x1dd6cc[_0x7544('0x37')]);});_0x2a663a[_0x7544('0xae')](function(_0x15cff7){var _0x1815b2=createFieldObject(_0x484eb4,_0x5dd5b2,_0x15cff7[_0x7544('0xaf')],_0x15cff7[_0x7544('0x37')],_0x15cff7[_0x7544('0xb0')],![]);_0x105e75[_0x7544('0xb1')](_0x1815b2);});return Promise[_0x7544('0xb2')](_0x105e75);})[_0x7544('0x4b')](function(_0x2af3a9){_0x1de4d4=_0x2af3a9;_0x2ff9f9=Object[_0x7544('0xac')]([],_0x3b9bca);console[_0x7544('0xaa')]('TCL:\x20_object',_0x3b9bca);_[_0x7544('0xad')](_0x2ff9f9,function(_0x476dc8){return _0x534fcb[_0x7544('0xb3')](_0x476dc8['name']);});console['log'](_0x7544('0xb4'),_0x2ff9f9);_0x105e75=[];_0x2ff9f9[_0x7544('0xae')](function(_0x5716db){var _0x164707=createFieldObject(_0x484eb4,_0x5dd5b2,_0x5716db[_0x7544('0xaf')],_0x5716db['name'],_0x5716db['label'],!![]);_0x105e75[_0x7544('0xb1')](_0x164707);});return Promise[_0x7544('0xb2')](_0x105e75);})[_0x7544('0x4b')](function(_0x2e12a5){_0x36155d=_0x2e12a5;var _0x44a8d=_0x1de4d4[_0x7544('0xb5')](_0x36155d);return{'count':_0x44a8d[_0x7544('0x50')],'rows':_0x44a8d};})['then'](respondWithResult(_0x427879,null))[_0x7544('0x29')](function(_0x183642){console[_0x7544('0xaa')](_0x7544('0xb6')+_0x183642);var _0x596ce8=_0x5e3271[_0x7544('0x3f')][_0x7544('0xb7')]?0x1f4:_0x183642[_0x7544('0xb8')]||0x1f4;logger['error'](_0x183642[_0x7544('0xb9')]);delete _0x183642[_0x7544('0x37')];if(_0x596ce8===0x191){_0x596ce8=0x190;}_0x427879[_0x7544('0x2b')](_0x596ce8)[_0x7544('0x38')](_0x5e3271[_0x7544('0x3f')][_0x7544('0xb7')]?{'message':_0x7544('0xba'),'statusCode':_0x183642[_0x7544('0xb8')]}:_0x183642);});};function createFieldObject(_0x1284a1,_0x4b2310,_0x4363ac,_0x4024ca,_0x260903,_0xfa7789){return new Promise(function(_0x58ca5d,_0x1cce1e){var _0x24b5c4={'id':_0x4024ca,'name':_0x260903,'custom':_0xfa7789};if(_0x4363ac===_0x7544('0xbb')){_0x24b5c4[_0x7544('0x56')]=[{'name':_0x7544('0xbc'),'value':_0x7544('0xbd')},{'name':_0x7544('0xbe'),'value':'false'}];_0x58ca5d(_0x24b5c4);}else{var _0x3df261={'method':_0x7544('0xa8'),'uri':_0x1284a1+_0x7544('0xbf')+_0x4024ca,'auth':_0x4b2310,'json':!![]};return rp(_0x3df261)[_0x7544('0x4b')](function(_0x4c321f){var _0x3eda70=[];if(_0x4c321f[_0x7544('0x28')][_0x7544('0x50')]>0x0){_0x4c321f['result'][_0x7544('0xae')](function(_0x54ac2e){if(_0x54ac2e[_0x7544('0xc0')]==='false'){var _0x4a6a18={'name':_0x54ac2e[_0x7544('0xb0')],'value':_0x54ac2e[_0x7544('0xc1')]};_0x3eda70[_0x7544('0xb1')](_0x4a6a18);}});}_0x24b5c4[_0x7544('0x56')]=_0x3eda70;if(_0x24b5c4[_0x7544('0x56')][_0x7544('0x50')]>0x0){_0x58ca5d(_0x24b5c4);}else{if(_0xfa7789==![]){_0x58ca5d();}else{_0x58ca5d(_0x24b5c4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bc2cf5c..2dcb7bb 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 _0x7877=['request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','../../config/logger','api','moment','bluebird'];(function(_0x4fe271,_0x55bdea){var _0x2e1b69=function(_0x468a4a){while(--_0x468a4a){_0x4fe271['push'](_0x4fe271['shift']());}};_0x2e1b69(++_0x55bdea);}(_0x7877,0xb0));var _0x7787=function(_0x4c5bbe,_0x556e5a){_0x4c5bbe=_0x4c5bbe-0x0;var _0x20f828=_0x7877[_0x4c5bbe];return _0x20f828;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7787('0x0'))(_0x7787('0x1'));var moment=require(_0x7787('0x2'));var BPromise=require(_0x7787('0x3'));var rp=require(_0x7787('0x4'));var fs=require('fs');var path=require(_0x7787('0x5'));var rimraf=require(_0x7787('0x6'));var config=require('../../config/environment');var attributes=require(_0x7787('0x7'));var integrations=require(_0x7787('0x8'));module[_0x7787('0x9')]=function(_0xd4f952,_0x2fd16d){return _0xd4f952[_0x7787('0xa')](_0x7787('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3758=['int_servicenow_accounts','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','ServicenowAccount'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x3758,0x12a));var _0x8375=function(_0x1a2d5e,_0x4c16fe){_0x1a2d5e=_0x1a2d5e-0x0;var _0x19a8bd=_0x3758[_0x1a2d5e];return _0x19a8bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8375('0x0'))(_0x8375('0x1'));var moment=require(_0x8375('0x2'));var BPromise=require('bluebird');var rp=require(_0x8375('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8375('0x4'));var config=require(_0x8375('0x5'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5a91b6,_0x2df583){return _0x5a91b6[_0x8375('0x6')](_0x8375('0x7'),attributes,{'tableName':_0x8375('0x8'),'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 921ca31..5cd539d 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 _0xd24b=['lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','raw'];(function(_0x12907d,_0x4e4525){var _0x5c140e=function(_0x49ad02){while(--_0x49ad02){_0x12907d['push'](_0x12907d['shift']());}};_0x5c140e(++_0x4e4525);}(_0xd24b,0x108));var _0xbd24=function(_0x47275c,_0x4bd743){_0x47275c=_0x47275c-0x0;var _0x1e892f=_0xd24b[_0x47275c];return _0x1e892f;};'use strict';var _=require(_0xbd24('0x0'));var util=require(_0xbd24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd24('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd24('0x3'));var logger=require(_0xbd24('0x4'))(_0xbd24('0x5'));var config=require(_0xbd24('0x6'));var jayson=require(_0xbd24('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7932,_0x137fcd,_0x15f877){return new BPromise(function(_0x1c2050,_0x23fff6){return client[_0xbd24('0x8')](_0x3a7932,_0x15f877)['then'](function(_0x4bfd36){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x137fcd,_0xbd24('0x9'));logger[_0xbd24('0xa')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x137fcd,_0xbd24('0x9'),JSON[_0xbd24('0xb')](_0x4bfd36));if(_0x4bfd36['error']){if(_0x4bfd36[_0xbd24('0xc')][_0xbd24('0xd')]===0x1f4){logger[_0xbd24('0xc')](_0xbd24('0xe'),_0x137fcd,_0x4bfd36[_0xbd24('0xc')][_0xbd24('0xf')]);return _0x23fff6(_0x4bfd36[_0xbd24('0xc')]['message']);}logger[_0xbd24('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x137fcd,_0x4bfd36[_0xbd24('0xc')]['message']);return _0x1c2050(_0x4bfd36['error'][_0xbd24('0xf')]);}else{logger[_0xbd24('0x10')](_0xbd24('0xe'),_0x137fcd,_0xbd24('0x9'));_0x1c2050(_0x4bfd36[_0xbd24('0x11')][_0xbd24('0xf')]);}})[_0xbd24('0x12')](function(_0x534cf0){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x137fcd,_0x534cf0);_0x23fff6(_0x534cf0);});});}exports[_0xbd24('0x13')]=function(_0x13f4ae){var _0x4d10ec=this;return new Promise(function(_0x2888ef,_0x4fd0ca){return db[_0xbd24('0x14')][_0xbd24('0x15')]({'raw':_0x13f4ae[_0xbd24('0x16')]?_0x13f4ae[_0xbd24('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x13f4ae[_0xbd24('0x16')]?_0x13f4ae['options'][_0xbd24('0x17')]||null:null,'attributes':_0x13f4ae['options']?_0x13f4ae[_0xbd24('0x16')][_0xbd24('0x18')]||null:null,'limit':_0x13f4ae[_0xbd24('0x16')]?_0x13f4ae['options'][_0xbd24('0x19')]||null:null,'include':_0x13f4ae[_0xbd24('0x16')]?_0x13f4ae[_0xbd24('0x16')][_0xbd24('0x1a')]?_[_0xbd24('0x1b')](_0x13f4ae['options'][_0xbd24('0x1a')],function(_0x25ca66){return{'model':db[_0x25ca66[_0xbd24('0x1c')]],'as':_0x25ca66['as'],'attributes':_0x25ca66[_0xbd24('0x18')],'include':_0x25ca66['include']?_['map'](_0x25ca66[_0xbd24('0x1a')],function(_0x33e370){return{'model':db[_0x33e370['model']],'as':_0x33e370['as'],'attributes':_0x33e370[_0xbd24('0x18')],'include':_0x33e370[_0xbd24('0x1a')]?_[_0xbd24('0x1b')](_0x33e370[_0xbd24('0x1a')],function(_0x27f4ab){return{'model':db[_0x27f4ab[_0xbd24('0x1c')]],'as':_0x27f4ab['as'],'attributes':_0x27f4ab[_0xbd24('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbd24('0x1d')](function(_0x4ac6d9){logger[_0xbd24('0x10')](_0xbd24('0x13'),_0x13f4ae);logger[_0xbd24('0xa')](_0xbd24('0x13'),_0x13f4ae,JSON[_0xbd24('0xb')](_0x4ac6d9));_0x2888ef(_0x4ac6d9);})[_0xbd24('0x12')](function(_0x1bf690){logger['error'](_0xbd24('0x13'),_0x1bf690[_0xbd24('0xf')],_0x13f4ae);_0x4fd0ca(_0x4d10ec[_0xbd24('0xc')](0x1f4,_0x1bf690[_0xbd24('0xf')]));});});};exports[_0xbd24('0x1e')]=function(_0x564a60){var _0x470a41=this;return new Promise(function(_0xe0af33,_0x40bb31){return db[_0xbd24('0x14')][_0xbd24('0x1f')]({'raw':_0x564a60['options']?_0x564a60[_0xbd24('0x16')][_0xbd24('0x20')]===undefined?!![]:![]:!![],'where':_0x564a60[_0xbd24('0x16')]?_0x564a60['options'][_0xbd24('0x17')]||null:null,'attributes':_0x564a60[_0xbd24('0x16')]?_0x564a60[_0xbd24('0x16')][_0xbd24('0x18')]||null:null,'include':_0x564a60[_0xbd24('0x16')]?_0x564a60[_0xbd24('0x16')][_0xbd24('0x1a')]?_[_0xbd24('0x1b')](_0x564a60[_0xbd24('0x16')][_0xbd24('0x1a')],function(_0x2b8287){return{'model':db[_0x2b8287[_0xbd24('0x1c')]],'as':_0x2b8287['as'],'attributes':_0x2b8287['attributes'],'include':_0x2b8287[_0xbd24('0x1a')]?_[_0xbd24('0x1b')](_0x2b8287['include'],function(_0x2df3c6){return{'model':db[_0x2df3c6['model']],'as':_0x2df3c6['as'],'attributes':_0x2df3c6[_0xbd24('0x18')],'include':_0x2df3c6[_0xbd24('0x1a')]?_[_0xbd24('0x1b')](_0x2df3c6[_0xbd24('0x1a')],function(_0x1fd55b){return{'model':db[_0x1fd55b[_0xbd24('0x1c')]],'as':_0x1fd55b['as'],'attributes':_0x1fd55b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25ad3c){logger[_0xbd24('0x10')](_0xbd24('0x1e'),_0x564a60);logger[_0xbd24('0xa')](_0xbd24('0x1e'),_0x564a60,JSON[_0xbd24('0xb')](_0x25ad3c));_0xe0af33(_0x25ad3c);})['catch'](function(_0x318786){logger[_0xbd24('0xc')](_0xbd24('0x1e'),_0x318786['message'],_0x564a60);_0x40bb31(_0x470a41['error'](0x1f4,_0x318786['message']));});});}; \ No newline at end of file +var _0xd9ef=['ShowServicenowAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9ef,0x175));var _0xfd9e=function(_0x547ec4,_0x3ca045){_0x547ec4=_0x547ec4-0x0;var _0x21ae01=_0xd9ef[_0x547ec4];return _0x21ae01;};'use strict';var _=require(_0xfd9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd9e('0x1'));var fs=require('fs');var Redis=require(_0xfd9e('0x2'));var db=require(_0xfd9e('0x3'))['db'];var utils=require(_0xfd9e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfd9e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfd9e('0x6')][_0xfd9e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34cd38,_0x5d337f,_0x44776a){return new BPromise(function(_0x1ba771,_0x3a4da0){return client[_0xfd9e('0x8')](_0x34cd38,_0x44776a)[_0xfd9e('0x9')](function(_0x443373){logger['info'](_0xfd9e('0xa'),_0x5d337f,_0xfd9e('0xb'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5d337f,_0xfd9e('0xb'),JSON[_0xfd9e('0xc')](_0x443373));if(_0x443373[_0xfd9e('0xd')]){if(_0x443373[_0xfd9e('0xd')]['code']===0x1f4){logger[_0xfd9e('0xd')](_0xfd9e('0xa'),_0x5d337f,_0x443373[_0xfd9e('0xd')]['message']);return _0x3a4da0(_0x443373[_0xfd9e('0xd')][_0xfd9e('0xe')]);}logger[_0xfd9e('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5d337f,_0x443373[_0xfd9e('0xd')][_0xfd9e('0xe')]);return _0x1ba771(_0x443373[_0xfd9e('0xd')][_0xfd9e('0xe')]);}else{logger[_0xfd9e('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5d337f,_0xfd9e('0xb'));_0x1ba771(_0x443373[_0xfd9e('0x10')][_0xfd9e('0xe')]);}})[_0xfd9e('0x11')](function(_0x591443){logger['error'](_0xfd9e('0xa'),_0x5d337f,_0x591443);_0x3a4da0(_0x591443);});});}exports[_0xfd9e('0x12')]=function(_0x529067){var _0x3ce3c4=this;return new Promise(function(_0x5cd683,_0x282c0c){return db[_0xfd9e('0x13')][_0xfd9e('0x14')]({'raw':_0x529067[_0xfd9e('0x15')]?_0x529067[_0xfd9e('0x15')][_0xfd9e('0x16')]===undefined?!![]:![]:!![],'where':_0x529067[_0xfd9e('0x15')]?_0x529067['options'][_0xfd9e('0x17')]||null:null,'attributes':_0x529067['options']?_0x529067[_0xfd9e('0x15')][_0xfd9e('0x18')]||null:null,'limit':_0x529067[_0xfd9e('0x15')]?_0x529067[_0xfd9e('0x15')][_0xfd9e('0x19')]||null:null,'include':_0x529067[_0xfd9e('0x15')]?_0x529067[_0xfd9e('0x15')]['include']?_[_0xfd9e('0x1a')](_0x529067[_0xfd9e('0x15')][_0xfd9e('0x1b')],function(_0x5e8802){return{'model':db[_0x5e8802[_0xfd9e('0x1c')]],'as':_0x5e8802['as'],'attributes':_0x5e8802[_0xfd9e('0x18')],'include':_0x5e8802[_0xfd9e('0x1b')]?_['map'](_0x5e8802[_0xfd9e('0x1b')],function(_0x98be6b){return{'model':db[_0x98be6b['model']],'as':_0x98be6b['as'],'attributes':_0x98be6b[_0xfd9e('0x18')],'include':_0x98be6b[_0xfd9e('0x1b')]?_[_0xfd9e('0x1a')](_0x98be6b[_0xfd9e('0x1b')],function(_0xf3a83d){return{'model':db[_0xf3a83d[_0xfd9e('0x1c')]],'as':_0xf3a83d['as'],'attributes':_0xf3a83d[_0xfd9e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfd9e('0x9')](function(_0x51949c){logger[_0xfd9e('0xf')](_0xfd9e('0x12'),_0x529067);logger[_0xfd9e('0x1d')](_0xfd9e('0x12'),_0x529067,JSON[_0xfd9e('0xc')](_0x51949c));_0x5cd683(_0x51949c);})['catch'](function(_0x265d2d){logger[_0xfd9e('0xd')](_0xfd9e('0x12'),_0x265d2d[_0xfd9e('0xe')],_0x529067);_0x282c0c(_0x3ce3c4['error'](0x1f4,_0x265d2d['message']));});});};exports['ShowServicenowAccount']=function(_0xb46640){var _0x9970a2=this;return new Promise(function(_0x39d03b,_0x22e651){return db[_0xfd9e('0x13')]['find']({'raw':_0xb46640[_0xfd9e('0x15')]?_0xb46640[_0xfd9e('0x15')][_0xfd9e('0x16')]===undefined?!![]:![]:!![],'where':_0xb46640[_0xfd9e('0x15')]?_0xb46640[_0xfd9e('0x15')][_0xfd9e('0x17')]||null:null,'attributes':_0xb46640[_0xfd9e('0x15')]?_0xb46640['options'][_0xfd9e('0x18')]||null:null,'include':_0xb46640['options']?_0xb46640[_0xfd9e('0x15')][_0xfd9e('0x1b')]?_[_0xfd9e('0x1a')](_0xb46640['options'][_0xfd9e('0x1b')],function(_0x41ea4f){return{'model':db[_0x41ea4f[_0xfd9e('0x1c')]],'as':_0x41ea4f['as'],'attributes':_0x41ea4f[_0xfd9e('0x18')],'include':_0x41ea4f[_0xfd9e('0x1b')]?_[_0xfd9e('0x1a')](_0x41ea4f[_0xfd9e('0x1b')],function(_0x479d4d){return{'model':db[_0x479d4d['model']],'as':_0x479d4d['as'],'attributes':_0x479d4d[_0xfd9e('0x18')],'include':_0x479d4d[_0xfd9e('0x1b')]?_[_0xfd9e('0x1a')](_0x479d4d['include'],function(_0x45a127){return{'model':db[_0x45a127['model']],'as':_0x45a127['as'],'attributes':_0x45a127['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd9e('0x9')](function(_0x42622e){logger[_0xfd9e('0xf')](_0xfd9e('0x1e'),_0xb46640);logger['debug'](_0xfd9e('0x1e'),_0xb46640,JSON[_0xfd9e('0xc')](_0x42622e));_0x39d03b(_0x42622e);})['catch'](function(_0x51c1f1){logger[_0xfd9e('0xd')](_0xfd9e('0x1e'),_0x51c1f1[_0xfd9e('0xe')],_0xb46640);_0x22e651(_0x9970a2[_0xfd9e('0xd')](0x1f4,_0x51c1f1[_0xfd9e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b8c6151..ef8a1b1 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 _0x3d5e=['path','connect-timeout','express','Router','../../components/auth/service','./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','util'];(function(_0x1ed9f9,_0x1a5ca3){var _0x340157=function(_0x279265){while(--_0x279265){_0x1ed9f9['push'](_0x1ed9f9['shift']());}};_0x340157(++_0x1a5ca3);}(_0x3d5e,0x186));var _0xe3d5=function(_0x46e71f,_0x3a10f3){_0x46e71f=_0x46e71f-0x0;var _0x56e45a=_0x3d5e[_0x46e71f];return _0x56e45a;};'use strict';var multer=require('multer');var util=require(_0xe3d5('0x0'));var path=require(_0xe3d5('0x1'));var timeout=require(_0xe3d5('0x2'));var express=require(_0xe3d5('0x3'));var router=express[_0xe3d5('0x4')]();var auth=require(_0xe3d5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe3d5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3d5('0x7')]);router[_0xe3d5('0x8')](_0xe3d5('0x9'),auth[_0xe3d5('0xa')](),controller['show']);router['get'](_0xe3d5('0xb'),auth[_0xe3d5('0xa')](),controller[_0xe3d5('0xc')]);router[_0xe3d5('0x8')](_0xe3d5('0xd'),auth[_0xe3d5('0xa')](),controller[_0xe3d5('0xe')]);router[_0xe3d5('0x8')](_0xe3d5('0xf'),auth['isAuthenticated'](),controller[_0xe3d5('0x10')]);router[_0xe3d5('0x11')]('/',auth[_0xe3d5('0xa')](),controller['create']);router[_0xe3d5('0x12')](_0xe3d5('0x9'),auth[_0xe3d5('0xa')](),controller[_0xe3d5('0x13')]);router[_0xe3d5('0x14')](_0xe3d5('0x9'),auth[_0xe3d5('0xa')](),controller[_0xe3d5('0x15')]);module[_0xe3d5('0x16')]=router; \ No newline at end of file +var _0x2194=['path','connect-timeout','Router','./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util'];(function(_0x13add1,_0x37c3e0){var _0x553c96=function(_0x2bf82b){while(--_0x2bf82b){_0x13add1['push'](_0x13add1['shift']());}};_0x553c96(++_0x37c3e0);}(_0x2194,0x71));var _0x4219=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x2194[_0x351b46];return _0x1515df;};'use strict';var multer=require(_0x4219('0x0'));var util=require(_0x4219('0x1'));var path=require(_0x4219('0x2'));var timeout=require(_0x4219('0x3'));var express=require('express');var router=express[_0x4219('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4219('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4219('0x6')]);router[_0x4219('0x7')](_0x4219('0x8'),auth[_0x4219('0x9')](),controller[_0x4219('0xa')]);router[_0x4219('0x7')](_0x4219('0xb'),auth['isAuthenticated'](),controller[_0x4219('0xc')]);router[_0x4219('0x7')](_0x4219('0xd'),auth[_0x4219('0x9')](),controller[_0x4219('0xe')]);router[_0x4219('0x7')](_0x4219('0xf'),auth[_0x4219('0x9')](),controller[_0x4219('0x10')]);router['post']('/',auth[_0x4219('0x9')](),controller[_0x4219('0x11')]);router[_0x4219('0x12')](_0x4219('0x8'),auth[_0x4219('0x9')](),controller[_0x4219('0x13')]);router[_0x4219('0x14')](_0x4219('0x8'),auth[_0x4219('0x9')](),controller[_0x4219('0x15')]);module[_0x4219('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2fa40ba..6e905dd 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 _0x8008=['STRING','sequelize','exports'];(function(_0x3e7728,_0x57e609){var _0x5992ae=function(_0x314306){while(--_0x314306){_0x3e7728['push'](_0x3e7728['shift']());}};_0x5992ae(++_0x57e609);}(_0x8008,0x9a));var _0x8800=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8008[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8800('0x0'));module[_0x8800('0x1')]={'name':{'type':Sequelize[_0x8800('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae16=['exports','STRING','sequelize'];(function(_0x1f7b41,_0x2918d0){var _0x54e062=function(_0x26717f){while(--_0x26717f){_0x1f7b41['push'](_0x1f7b41['shift']());}};_0x54e062(++_0x2918d0);}(_0xae16,0xe6));var _0x6ae1=function(_0x41af5b,_0x344035){_0x41af5b=_0x41af5b-0x0;var _0x323c2c=_0xae16[_0x41af5b];return _0x323c2c;};'use strict';var Sequelize=require(_0x6ae1('0x0'));module[_0x6ae1('0x1')]={'name':{'type':Sequelize[_0x6ae1('0x2')]},'description':{'type':Sequelize[_0x6ae1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 6ef876b..88aa256 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 _0xb7e7=['find','create','body','ServicenowField','order','sort','getFields','getSubjects','findOne','getDescriptions','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','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','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','intersection'];(function(_0x577caa,_0x35f639){var _0xd9d78f=function(_0x13aec5){while(--_0x13aec5){_0x577caa['push'](_0x577caa['shift']());}};_0xd9d78f(++_0x35f639);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'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'];var jayson=require(_0x7b7e('0x18'));var client=jayson[_0x7b7e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x267446,_0x430eab,_0x50d7d2){if(_0x50d7d2){var _0x422d3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x422d3a['test'](_0x430eab)){return _0x267446;}else{throw new db['Sequelize'][(_0x7b7e('0x1a'))](_0x7b7e('0x1b'));}}else{return _0x267446;}}function respondWithRpcPromise(_0xf067da,_0x457ec5,_0x3d2fb2,_0x5703fd){return new BPromise(function(_0x51baf6,_0xc7f087){var _0x36444d=_0x5703fd||client;return _0x36444d[_0x7b7e('0x1c')](_0xf067da,_0x3d2fb2)[_0x7b7e('0x1d')](function(_0x2cc400){logger[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x457ec5,_0x7b7e('0x20'));logger[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x457ec5,_0x7b7e('0x20'),JSON[_0x7b7e('0x23')](_0x2cc400));if(_0x2cc400[_0x7b7e('0x24')]){if(_0x2cc400[_0x7b7e('0x24')][_0x7b7e('0x25')]===0x1f4){logger[_0x7b7e('0x24')](_0x7b7e('0x1f'),_0x457ec5,_0x2cc400['error'][_0x7b7e('0x26')]);return _0xc7f087(_0x2cc400[_0x7b7e('0x24')][_0x7b7e('0x26')]);}logger['error'](_0x7b7e('0x1f'),_0x457ec5,_0x2cc400[_0x7b7e('0x24')][_0x7b7e('0x26')]);return _0x51baf6(_0x2cc400[_0x7b7e('0x24')][_0x7b7e('0x26')]);}else{logger[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x457ec5,_0x7b7e('0x20'));_0x51baf6(_0x2cc400['result']['message']);}})['catch'](function(_0x26ee14){logger[_0x7b7e('0x24')](_0x7b7e('0x1f'),_0x457ec5,_0x26ee14);_0xc7f087(_0x26ee14);});});}function respondWithStatusCode(_0x483c6f,_0x51d3b1){_0x51d3b1=_0x51d3b1||0xcc;return function(_0x5dadbb){if(_0x5dadbb){return _0x483c6f[_0x7b7e('0x27')](_0x51d3b1);}return _0x483c6f[_0x7b7e('0x28')](_0x51d3b1)[_0x7b7e('0x29')]();};}function respondWithResult(_0x7aa71,_0x3ceaf5){_0x3ceaf5=_0x3ceaf5||0xc8;return function(_0x48fad1){if(_0x48fad1){return _0x7aa71[_0x7b7e('0x28')](_0x3ceaf5)[_0x7b7e('0x2a')](_0x48fad1);}};}function respondWithFilteredResult(_0x4c46b8,_0x57b9da){return function(_0x4e5de7){if(_0x4e5de7){var _0x12ef0b=_0x4e5de7['count'],_0x423832=_0x57b9da[_0x7b7e('0x2b')],_0x503625=_0x57b9da[_0x7b7e('0x2b')]+_0x57b9da[_0x7b7e('0x2c')],_0x3db8c4;if(_0x503625>=_0x12ef0b){_0x503625=_0x12ef0b;_0x3db8c4=0xc8;}else{_0x3db8c4=0xce;}_0x4c46b8['status'](_0x3db8c4);return _0x4c46b8[_0x7b7e('0x2d')](_0x7b7e('0x2e'),_0x423832+'-'+_0x503625+'/'+_0x12ef0b)[_0x7b7e('0x2a')](_0x4e5de7);}return null;};}function patchUpdates(_0x326dd2){return function(_0x33f9a1){try{jsonpatch['apply'](_0x33f9a1,_0x326dd2,!![]);}catch(_0x41af57){return BPromise['reject'](_0x41af57);}return _0x33f9a1[_0x7b7e('0x2f')]();};}function saveUpdates(_0x1c7de4,_0x383de5){return function(_0x2ac337){if(_0x2ac337){return _0x2ac337[_0x7b7e('0x30')](_0x1c7de4)[_0x7b7e('0x1d')](function(_0x29cb58){return _0x29cb58;});}return null;};}function removeEntity(_0x4bfe7f,_0x5227a7){return function(_0xebcdbc){if(_0xebcdbc){return _0xebcdbc[_0x7b7e('0x31')]()['then'](function(){_0x4bfe7f[_0x7b7e('0x28')](0xcc)[_0x7b7e('0x29')]();});}};}function handleEntityNotFound(_0x2ca366,_0x48e255){return function(_0x330b1d){if(!_0x330b1d){_0x2ca366[_0x7b7e('0x27')](0x194);}return _0x330b1d;};}function handleError(_0x187184,_0xf1225){_0xf1225=_0xf1225||0x1f4;return function(_0x31043a){logger[_0x7b7e('0x24')](_0x31043a[_0x7b7e('0x32')]);if(_0x31043a[_0x7b7e('0x33')]){delete _0x31043a[_0x7b7e('0x33')];}_0x187184[_0x7b7e('0x28')](_0xf1225)[_0x7b7e('0x34')](_0x31043a);};}exports[_0x7b7e('0x35')]=function(_0x442366,_0xdcb8ef){var _0x116563={},_0x279f46={},_0x5a4f92={'count':0x0,'rows':[]};var _0x8c80d5=_[_0x7b7e('0x36')](db[_0x7b7e('0x37')][_0x7b7e('0x38')],function(_0x36abfc){return{'name':_0x36abfc[_0x7b7e('0x39')],'type':_0x36abfc[_0x7b7e('0x3a')][_0x7b7e('0x3b')]};});_0x279f46[_0x7b7e('0x3c')]=_[_0x7b7e('0x36')](_0x8c80d5,'name');_0x279f46[_0x7b7e('0x3d')]=_[_0x7b7e('0x3e')](_0x442366[_0x7b7e('0x3d')]);_0x279f46[_0x7b7e('0x3f')]=_['intersection'](_0x279f46[_0x7b7e('0x3c')],_0x279f46[_0x7b7e('0x3d')]);_0x116563[_0x7b7e('0x40')]=_['intersection'](_0x279f46['model'],qs[_0x7b7e('0x41')](_0x442366['query'][_0x7b7e('0x41')]));_0x116563[_0x7b7e('0x40')]=_0x116563['attributes'][_0x7b7e('0x42')]?_0x116563[_0x7b7e('0x40')]:_0x279f46[_0x7b7e('0x3c')];if(!_0x442366[_0x7b7e('0x3d')][_0x7b7e('0x43')](_0x7b7e('0x44'))){_0x116563[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x442366[_0x7b7e('0x3d')]['limit']);_0x116563['offset']=qs[_0x7b7e('0x2b')](_0x442366['query'][_0x7b7e('0x2b')]);}_0x116563['order']=qs['sort'](_0x442366[_0x7b7e('0x3d')]['sort']);_0x116563[_0x7b7e('0x45')]=qs['filters'](_[_0x7b7e('0x46')](_0x442366[_0x7b7e('0x3d')],_0x279f46[_0x7b7e('0x3f')]),_0x8c80d5);if(_0x442366[_0x7b7e('0x3d')]['filter']){_0x116563[_0x7b7e('0x45')]=_[_0x7b7e('0x47')](_0x116563[_0x7b7e('0x45')],{'$or':_[_0x7b7e('0x36')](_0x8c80d5,function(_0x3e4f21){if(_0x3e4f21[_0x7b7e('0x3a')]!=='VIRTUAL'){var _0x492df0={};_0x492df0[_0x3e4f21['name']]={'$like':'%'+_0x442366[_0x7b7e('0x3d')][_0x7b7e('0x48')]+'%'};return _0x492df0;}})});}_0x116563=_[_0x7b7e('0x47')]({},_0x116563,_0x442366[_0x7b7e('0x49')]);var _0x35ea02={'where':_0x116563[_0x7b7e('0x45')]};return db['ServicenowConfiguration'][_0x7b7e('0x4a')](_0x35ea02)[_0x7b7e('0x1d')](function(_0x5a0832){_0x5a4f92['count']=_0x5a0832;if(_0x442366[_0x7b7e('0x3d')][_0x7b7e('0x4b')]){_0x116563[_0x7b7e('0x4c')]=[{'all':!![]}];}return db[_0x7b7e('0x37')][_0x7b7e('0x4d')](_0x116563);})[_0x7b7e('0x1d')](function(_0x590154){_0x5a4f92[_0x7b7e('0x4e')]=_0x590154;return _0x5a4f92;})['then'](respondWithFilteredResult(_0xdcb8ef,_0x116563))[_0x7b7e('0x4f')](handleError(_0xdcb8ef,null));};exports[_0x7b7e('0x50')]=function(_0x2ea2b2,_0x5874e2){var _0x58e4e6={'raw':![],'where':{'id':_0x2ea2b2[_0x7b7e('0x51')]['id']}},_0x3b649e={};_0x3b649e[_0x7b7e('0x3c')]=_[_0x7b7e('0x3e')](db[_0x7b7e('0x37')]['rawAttributes']);_0x3b649e[_0x7b7e('0x3d')]=_[_0x7b7e('0x3e')](_0x2ea2b2[_0x7b7e('0x3d')]);_0x3b649e[_0x7b7e('0x3f')]=_[_0x7b7e('0x52')](_0x3b649e['model'],_0x3b649e[_0x7b7e('0x3d')]);_0x58e4e6[_0x7b7e('0x40')]=_[_0x7b7e('0x52')](_0x3b649e[_0x7b7e('0x3c')],qs[_0x7b7e('0x41')](_0x2ea2b2[_0x7b7e('0x3d')][_0x7b7e('0x41')]));_0x58e4e6['attributes']=_0x58e4e6[_0x7b7e('0x40')]['length']?_0x58e4e6[_0x7b7e('0x40')]:_0x3b649e[_0x7b7e('0x3c')];if(_0x2ea2b2['query'][_0x7b7e('0x4b')]){_0x58e4e6[_0x7b7e('0x4c')]=[{'all':!![]}];}_0x58e4e6=_[_0x7b7e('0x47')]({},_0x58e4e6,_0x2ea2b2[_0x7b7e('0x49')]);return db[_0x7b7e('0x37')][_0x7b7e('0x53')](_0x58e4e6)[_0x7b7e('0x1d')](handleEntityNotFound(_0x5874e2,null))['then'](respondWithResult(_0x5874e2,null))[_0x7b7e('0x4f')](handleError(_0x5874e2,null));};exports[_0x7b7e('0x54')]=function(_0x96752e,_0x24481a){return db['ServicenowConfiguration']['create'](_0x96752e['body'],{})[_0x7b7e('0x1d')](respondWithResult(_0x24481a,0xc9))[_0x7b7e('0x4f')](handleError(_0x24481a,null));};exports[_0x7b7e('0x30')]=function(_0x4aa92e,_0x5b1e10){if(_0x4aa92e[_0x7b7e('0x55')]['id']){delete _0x4aa92e[_0x7b7e('0x55')]['id'];}return db['ServicenowConfiguration'][_0x7b7e('0x53')]({'where':{'id':_0x4aa92e[_0x7b7e('0x51')]['id']}})[_0x7b7e('0x1d')](handleEntityNotFound(_0x5b1e10,null))['then'](saveUpdates(_0x4aa92e[_0x7b7e('0x55')],null))[_0x7b7e('0x1d')](respondWithResult(_0x5b1e10,null))['catch'](handleError(_0x5b1e10,null));};exports[_0x7b7e('0x31')]=function(_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x37')][_0x7b7e('0x53')]({'where':{'id':_0x441c3c[_0x7b7e('0x51')]['id']}})[_0x7b7e('0x1d')](handleEntityNotFound(_0x1d7db1,null))[_0x7b7e('0x1d')](removeEntity(_0x1d7db1,null))[_0x7b7e('0x4f')](handleError(_0x1d7db1,null));};exports['getFields']=function(_0x29d0af,_0x20108a,_0x516e75){var _0xc2b1b6={};var _0xa22edc={};var _0x3da726;var _0x59f2df;return db[_0x7b7e('0x37')]['findOne']({'where':{'id':_0x29d0af[_0x7b7e('0x51')]['id']}})[_0x7b7e('0x1d')](handleEntityNotFound(_0x20108a,null))['then'](function(_0x2a17c7){if(_0x2a17c7){_0x3da726=_0x2a17c7;_0xa22edc[_0x7b7e('0x3c')]=_['keys'](db[_0x7b7e('0x56')][_0x7b7e('0x38')]);_0xa22edc[_0x7b7e('0x3d')]=_[_0x7b7e('0x3e')](_0x29d0af['query']);_0xa22edc[_0x7b7e('0x3f')]=_[_0x7b7e('0x52')](_0xa22edc[_0x7b7e('0x3c')],_0xa22edc[_0x7b7e('0x3d')]);_0xc2b1b6[_0x7b7e('0x40')]=_[_0x7b7e('0x52')](_0xa22edc[_0x7b7e('0x3c')],qs[_0x7b7e('0x41')](_0x29d0af[_0x7b7e('0x3d')][_0x7b7e('0x41')]));_0xc2b1b6['attributes']=_0xc2b1b6[_0x7b7e('0x40')]['length']?_0xc2b1b6['attributes']:_0xa22edc[_0x7b7e('0x3c')];_0xc2b1b6[_0x7b7e('0x57')]=qs[_0x7b7e('0x58')](_0x29d0af[_0x7b7e('0x3d')]['sort']);_0xc2b1b6[_0x7b7e('0x45')]=qs[_0x7b7e('0x3f')](_[_0x7b7e('0x46')](_0x29d0af[_0x7b7e('0x3d')],_0xa22edc[_0x7b7e('0x3f')]));if(_0x29d0af[_0x7b7e('0x3d')]['filter']){_0xc2b1b6[_0x7b7e('0x45')]=_['merge'](_0xc2b1b6['where'],{'$or':_[_0x7b7e('0x36')](_0xc2b1b6['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x29d0af[_0x7b7e('0x3d')][_0x7b7e('0x48')]+'%'};return _0x4a2378;})});}_0xc2b1b6=_['merge']({},_0xc2b1b6,_0x29d0af[_0x7b7e('0x49')]);return _0x3da726[_0x7b7e('0x59')](_0xc2b1b6);}})['then'](function(_0x106a16){if(_0x106a16){_0x59f2df=_0x106a16[_0x7b7e('0x42')];if(!_0x29d0af[_0x7b7e('0x3d')][_0x7b7e('0x43')](_0x7b7e('0x44'))){_0xc2b1b6[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x29d0af[_0x7b7e('0x3d')][_0x7b7e('0x2c')]);_0xc2b1b6[_0x7b7e('0x2b')]=qs['offset'](_0x29d0af['query'][_0x7b7e('0x2b')]);}return _0x3da726[_0x7b7e('0x59')](_0xc2b1b6);}})[_0x7b7e('0x1d')](function(_0x348c77){if(_0x348c77){return _0x348c77?{'count':_0x59f2df,'rows':_0x348c77}:null;}})[_0x7b7e('0x1d')](respondWithResult(_0x20108a,null))[_0x7b7e('0x4f')](handleError(_0x20108a,null));};exports[_0x7b7e('0x5a')]=function(_0x5d2526,_0x28e6ac,_0x2aca93){var _0x4ff2c8={};var _0x3ce80e={};var _0x3f8162;var _0x2fea85;return db[_0x7b7e('0x37')][_0x7b7e('0x5b')]({'where':{'id':_0x5d2526[_0x7b7e('0x51')]['id']}})[_0x7b7e('0x1d')](handleEntityNotFound(_0x28e6ac,null))[_0x7b7e('0x1d')](function(_0x1aec4b){if(_0x1aec4b){_0x3f8162=_0x1aec4b;_0x3ce80e[_0x7b7e('0x3c')]=_[_0x7b7e('0x3e')](db['ServicenowField'][_0x7b7e('0x38')]);_0x3ce80e[_0x7b7e('0x3d')]=_[_0x7b7e('0x3e')](_0x5d2526[_0x7b7e('0x3d')]);_0x3ce80e[_0x7b7e('0x3f')]=_[_0x7b7e('0x52')](_0x3ce80e[_0x7b7e('0x3c')],_0x3ce80e['query']);_0x4ff2c8[_0x7b7e('0x40')]=_[_0x7b7e('0x52')](_0x3ce80e[_0x7b7e('0x3c')],qs['fields'](_0x5d2526[_0x7b7e('0x3d')][_0x7b7e('0x41')]));_0x4ff2c8[_0x7b7e('0x40')]=_0x4ff2c8[_0x7b7e('0x40')][_0x7b7e('0x42')]?_0x4ff2c8['attributes']:_0x3ce80e['model'];_0x4ff2c8['order']=qs[_0x7b7e('0x58')](_0x5d2526[_0x7b7e('0x3d')][_0x7b7e('0x58')]);_0x4ff2c8['where']=qs[_0x7b7e('0x3f')](_[_0x7b7e('0x46')](_0x5d2526[_0x7b7e('0x3d')],_0x3ce80e['filters']));if(_0x5d2526[_0x7b7e('0x3d')][_0x7b7e('0x48')]){_0x4ff2c8[_0x7b7e('0x45')]=_[_0x7b7e('0x47')](_0x4ff2c8['where'],{'$or':_[_0x7b7e('0x36')](_0x4ff2c8[_0x7b7e('0x40')],function(_0xa52b93){var _0x259f6e={};_0x259f6e[_0xa52b93]={'$like':'%'+_0x5d2526['query']['filter']+'%'};return _0x259f6e;})});}_0x4ff2c8=_[_0x7b7e('0x47')]({},_0x4ff2c8,_0x5d2526['options']);return _0x3f8162[_0x7b7e('0x5a')](_0x4ff2c8);}})[_0x7b7e('0x1d')](function(_0x4e2b05){if(_0x4e2b05){_0x2fea85=_0x4e2b05[_0x7b7e('0x42')];if(!_0x5d2526['query'][_0x7b7e('0x43')](_0x7b7e('0x44'))){_0x4ff2c8[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x5d2526[_0x7b7e('0x3d')][_0x7b7e('0x2c')]);_0x4ff2c8[_0x7b7e('0x2b')]=qs[_0x7b7e('0x2b')](_0x5d2526[_0x7b7e('0x3d')][_0x7b7e('0x2b')]);}return _0x3f8162[_0x7b7e('0x5a')](_0x4ff2c8);}})[_0x7b7e('0x1d')](function(_0xbdc4b9){if(_0xbdc4b9){return _0xbdc4b9?{'count':_0x2fea85,'rows':_0xbdc4b9}:null;}})[_0x7b7e('0x1d')](respondWithResult(_0x28e6ac,null))[_0x7b7e('0x4f')](handleError(_0x28e6ac,null));};exports[_0x7b7e('0x5c')]=function(_0x57d925,_0x3f4d00,_0x31b9c5){var _0x1d9e08={};var _0xa03d7a={};var _0x10c35e;var _0x302462;return db[_0x7b7e('0x37')]['findOne']({'where':{'id':_0x57d925[_0x7b7e('0x51')]['id']}})[_0x7b7e('0x1d')](handleEntityNotFound(_0x3f4d00,null))[_0x7b7e('0x1d')](function(_0x3f8682){if(_0x3f8682){_0x10c35e=_0x3f8682;_0xa03d7a[_0x7b7e('0x3c')]=_['keys'](db['ServicenowField'][_0x7b7e('0x38')]);_0xa03d7a[_0x7b7e('0x3d')]=_[_0x7b7e('0x3e')](_0x57d925[_0x7b7e('0x3d')]);_0xa03d7a[_0x7b7e('0x3f')]=_[_0x7b7e('0x52')](_0xa03d7a[_0x7b7e('0x3c')],_0xa03d7a[_0x7b7e('0x3d')]);_0x1d9e08[_0x7b7e('0x40')]=_[_0x7b7e('0x52')](_0xa03d7a['model'],qs[_0x7b7e('0x41')](_0x57d925[_0x7b7e('0x3d')][_0x7b7e('0x41')]));_0x1d9e08[_0x7b7e('0x40')]=_0x1d9e08[_0x7b7e('0x40')][_0x7b7e('0x42')]?_0x1d9e08[_0x7b7e('0x40')]:_0xa03d7a['model'];_0x1d9e08[_0x7b7e('0x57')]=qs['sort'](_0x57d925[_0x7b7e('0x3d')][_0x7b7e('0x58')]);_0x1d9e08['where']=qs[_0x7b7e('0x3f')](_[_0x7b7e('0x46')](_0x57d925[_0x7b7e('0x3d')],_0xa03d7a[_0x7b7e('0x3f')]));if(_0x57d925[_0x7b7e('0x3d')]['filter']){_0x1d9e08[_0x7b7e('0x45')]=_['merge'](_0x1d9e08['where'],{'$or':_[_0x7b7e('0x36')](_0x1d9e08[_0x7b7e('0x40')],function(_0x1ca753){var _0x1d080b={};_0x1d080b[_0x1ca753]={'$like':'%'+_0x57d925['query'][_0x7b7e('0x48')]+'%'};return _0x1d080b;})});}_0x1d9e08=_['merge']({},_0x1d9e08,_0x57d925[_0x7b7e('0x49')]);return _0x10c35e[_0x7b7e('0x5c')](_0x1d9e08);}})[_0x7b7e('0x1d')](function(_0x1e71ab){if(_0x1e71ab){_0x302462=_0x1e71ab[_0x7b7e('0x42')];if(!_0x57d925[_0x7b7e('0x3d')][_0x7b7e('0x43')]('nolimit')){_0x1d9e08[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x57d925['query'][_0x7b7e('0x2c')]);_0x1d9e08[_0x7b7e('0x2b')]=qs[_0x7b7e('0x2b')](_0x57d925[_0x7b7e('0x3d')][_0x7b7e('0x2b')]);}return _0x10c35e[_0x7b7e('0x5c')](_0x1d9e08);}})[_0x7b7e('0x1d')](function(_0x15bbf5){if(_0x15bbf5){return _0x15bbf5?{'count':_0x302462,'rows':_0x15bbf5}:null;}})[_0x7b7e('0x1d')](respondWithResult(_0x3f4d00,null))[_0x7b7e('0x4f')](handleError(_0x3f4d00,null));}; \ No newline at end of file +var _0xe706=['info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','ServicenowConfiguration','include','findAll','catch','show','params','includeAll','find','create','body','findOne','ServicenowField','rawAttributes','hasOwnProperty','getSubjects','order','getDescriptions','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','jayson/promise','client','http','ValidationError','request'];(function(_0x2ea3b2,_0x171ee8){var _0x4b52f1=function(_0x218090){while(--_0x218090){_0x2ea3b2['push'](_0x2ea3b2['shift']());}};_0x4b52f1(++_0x171ee8);}(_0xe706,0xa3));var _0x6e70=function(_0x24f66d,_0x261e88){_0x24f66d=_0x24f66d-0x0;var _0x147cdb=_0xe706[_0x24f66d];return _0x147cdb;};'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'];var jayson=require(_0x6e70('0x1c'));var client=jayson[_0x6e70('0x1d')][_0x6e70('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x310eb7,_0xa1eb74,_0x181005){if(_0x181005){var _0x5dfbaa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dfbaa['test'](_0xa1eb74)){return _0x310eb7;}else{throw new db['Sequelize'][(_0x6e70('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 _0x310eb7;}}function respondWithRpcPromise(_0x53aed0,_0x304716,_0x22c50c,_0x5d9263){return new BPromise(function(_0x24f3ac,_0x5c3fe7){var _0x2efc0f=_0x5d9263||client;return _0x2efc0f[_0x6e70('0x20')](_0x53aed0,_0x22c50c)['then'](function(_0x49029f){logger[_0x6e70('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x304716,_0x6e70('0x22'));logger[_0x6e70('0x23')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x304716,'request\x20sent',JSON[_0x6e70('0x24')](_0x49029f));if(_0x49029f[_0x6e70('0x25')]){if(_0x49029f[_0x6e70('0x25')][_0x6e70('0x26')]===0x1f4){logger[_0x6e70('0x25')](_0x6e70('0x27'),_0x304716,_0x49029f[_0x6e70('0x25')][_0x6e70('0x28')]);return _0x5c3fe7(_0x49029f[_0x6e70('0x25')][_0x6e70('0x28')]);}logger['error'](_0x6e70('0x27'),_0x304716,_0x49029f[_0x6e70('0x25')][_0x6e70('0x28')]);return _0x24f3ac(_0x49029f['error'][_0x6e70('0x28')]);}else{logger[_0x6e70('0x21')](_0x6e70('0x27'),_0x304716,'request\x20sent');_0x24f3ac(_0x49029f[_0x6e70('0x29')]['message']);}})['catch'](function(_0x4e97c7){logger[_0x6e70('0x25')](_0x6e70('0x27'),_0x304716,_0x4e97c7);_0x5c3fe7(_0x4e97c7);});});}function respondWithStatusCode(_0x51d292,_0x3ecdf1){_0x3ecdf1=_0x3ecdf1||0xcc;return function(_0x1196ed){if(_0x1196ed){return _0x51d292['sendStatus'](_0x3ecdf1);}return _0x51d292[_0x6e70('0x2a')](_0x3ecdf1)[_0x6e70('0x2b')]();};}function respondWithResult(_0x2bb231,_0x4a67ac){_0x4a67ac=_0x4a67ac||0xc8;return function(_0x54a5fe){if(_0x54a5fe){return _0x2bb231[_0x6e70('0x2a')](_0x4a67ac)[_0x6e70('0x2c')](_0x54a5fe);}};}function respondWithFilteredResult(_0x83c836,_0x114344){return function(_0x43fee0){if(_0x43fee0){var _0x5d772a=_0x43fee0[_0x6e70('0x2d')],_0x1952ea=_0x114344[_0x6e70('0x2e')],_0x406f29=_0x114344[_0x6e70('0x2e')]+_0x114344[_0x6e70('0x2f')],_0xecf336;if(_0x406f29>=_0x5d772a){_0x406f29=_0x5d772a;_0xecf336=0xc8;}else{_0xecf336=0xce;}_0x83c836[_0x6e70('0x2a')](_0xecf336);return _0x83c836[_0x6e70('0x30')](_0x6e70('0x31'),_0x1952ea+'-'+_0x406f29+'/'+_0x5d772a)['json'](_0x43fee0);}return null;};}function patchUpdates(_0x1b27d8){return function(_0x50d60b){try{jsonpatch[_0x6e70('0x32')](_0x50d60b,_0x1b27d8,!![]);}catch(_0x5a7a2a){return BPromise[_0x6e70('0x33')](_0x5a7a2a);}return _0x50d60b[_0x6e70('0x34')]();};}function saveUpdates(_0x30fa0b,_0x56f6f7){return function(_0x38c40d){if(_0x38c40d){return _0x38c40d[_0x6e70('0x35')](_0x30fa0b)['then'](function(_0x13d673){return _0x13d673;});}return null;};}function removeEntity(_0x154925,_0x52b457){return function(_0x10d8f6){if(_0x10d8f6){return _0x10d8f6[_0x6e70('0x36')]()[_0x6e70('0x37')](function(){_0x154925[_0x6e70('0x2a')](0xcc)[_0x6e70('0x2b')]();});}};}function handleEntityNotFound(_0x1e3e76,_0x44b19d){return function(_0x3f42bd){if(!_0x3f42bd){_0x1e3e76[_0x6e70('0x38')](0x194);}return _0x3f42bd;};}function handleError(_0x419a41,_0x4d32d8){_0x4d32d8=_0x4d32d8||0x1f4;return function(_0x3b9c06){logger['error'](_0x3b9c06[_0x6e70('0x39')]);if(_0x3b9c06[_0x6e70('0x3a')]){delete _0x3b9c06[_0x6e70('0x3a')];}_0x419a41[_0x6e70('0x2a')](_0x4d32d8)[_0x6e70('0x3b')](_0x3b9c06);};}exports[_0x6e70('0x3c')]=function(_0x2440be,_0xdd0bee){var _0x80bebb={},_0x198dd1={},_0x2a5444={'count':0x0,'rows':[]};var _0x23d5e2=_[_0x6e70('0x3d')](db['ServicenowConfiguration']['rawAttributes'],function(_0x5424eb){return{'name':_0x5424eb[_0x6e70('0x3e')],'type':_0x5424eb[_0x6e70('0x3f')][_0x6e70('0x40')]};});_0x198dd1[_0x6e70('0x41')]=_[_0x6e70('0x3d')](_0x23d5e2,_0x6e70('0x3a'));_0x198dd1['query']=_[_0x6e70('0x42')](_0x2440be[_0x6e70('0x43')]);_0x198dd1[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x198dd1[_0x6e70('0x41')],_0x198dd1[_0x6e70('0x43')]);_0x80bebb[_0x6e70('0x46')]=_[_0x6e70('0x45')](_0x198dd1['model'],qs[_0x6e70('0x47')](_0x2440be[_0x6e70('0x43')][_0x6e70('0x47')]));_0x80bebb[_0x6e70('0x46')]=_0x80bebb[_0x6e70('0x46')][_0x6e70('0x48')]?_0x80bebb[_0x6e70('0x46')]:_0x198dd1['model'];if(!_0x2440be['query']['hasOwnProperty'](_0x6e70('0x49'))){_0x80bebb[_0x6e70('0x2f')]=qs[_0x6e70('0x2f')](_0x2440be[_0x6e70('0x43')][_0x6e70('0x2f')]);_0x80bebb['offset']=qs[_0x6e70('0x2e')](_0x2440be[_0x6e70('0x43')][_0x6e70('0x2e')]);}_0x80bebb['order']=qs['sort'](_0x2440be['query'][_0x6e70('0x4a')]);_0x80bebb['where']=qs[_0x6e70('0x44')](_[_0x6e70('0x4b')](_0x2440be[_0x6e70('0x43')],_0x198dd1[_0x6e70('0x44')]),_0x23d5e2);if(_0x2440be['query'][_0x6e70('0x4c')]){_0x80bebb['where']=_[_0x6e70('0x4d')](_0x80bebb[_0x6e70('0x4e')],{'$or':_[_0x6e70('0x3d')](_0x23d5e2,function(_0x3478e2){if(_0x3478e2['type']!==_0x6e70('0x4f')){var _0x44b637={};_0x44b637[_0x3478e2[_0x6e70('0x3a')]]={'$like':'%'+_0x2440be[_0x6e70('0x43')][_0x6e70('0x4c')]+'%'};return _0x44b637;}})});}_0x80bebb=_[_0x6e70('0x4d')]({},_0x80bebb,_0x2440be[_0x6e70('0x50')]);var _0x552e7e={'where':_0x80bebb[_0x6e70('0x4e')]};return db[_0x6e70('0x51')][_0x6e70('0x2d')](_0x552e7e)[_0x6e70('0x37')](function(_0x3f86cf){_0x2a5444[_0x6e70('0x2d')]=_0x3f86cf;if(_0x2440be[_0x6e70('0x43')]['includeAll']){_0x80bebb[_0x6e70('0x52')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x6e70('0x53')](_0x80bebb);})[_0x6e70('0x37')](function(_0x4b351e){_0x2a5444['rows']=_0x4b351e;return _0x2a5444;})[_0x6e70('0x37')](respondWithFilteredResult(_0xdd0bee,_0x80bebb))[_0x6e70('0x54')](handleError(_0xdd0bee,null));};exports[_0x6e70('0x55')]=function(_0x587f04,_0x4af9b1){var _0x238ebb={'raw':![],'where':{'id':_0x587f04[_0x6e70('0x56')]['id']}},_0x11ac3d={};_0x11ac3d[_0x6e70('0x41')]=_[_0x6e70('0x42')](db[_0x6e70('0x51')]['rawAttributes']);_0x11ac3d[_0x6e70('0x43')]=_[_0x6e70('0x42')](_0x587f04[_0x6e70('0x43')]);_0x11ac3d[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x11ac3d['model'],_0x11ac3d['query']);_0x238ebb[_0x6e70('0x46')]=_[_0x6e70('0x45')](_0x11ac3d[_0x6e70('0x41')],qs[_0x6e70('0x47')](_0x587f04[_0x6e70('0x43')]['fields']));_0x238ebb[_0x6e70('0x46')]=_0x238ebb[_0x6e70('0x46')][_0x6e70('0x48')]?_0x238ebb[_0x6e70('0x46')]:_0x11ac3d[_0x6e70('0x41')];if(_0x587f04['query'][_0x6e70('0x57')]){_0x238ebb[_0x6e70('0x52')]=[{'all':!![]}];}_0x238ebb=_[_0x6e70('0x4d')]({},_0x238ebb,_0x587f04[_0x6e70('0x50')]);return db[_0x6e70('0x51')][_0x6e70('0x58')](_0x238ebb)['then'](handleEntityNotFound(_0x4af9b1,null))[_0x6e70('0x37')](respondWithResult(_0x4af9b1,null))[_0x6e70('0x54')](handleError(_0x4af9b1,null));};exports['create']=function(_0x382fde,_0xebe5f7){return db['ServicenowConfiguration'][_0x6e70('0x59')](_0x382fde[_0x6e70('0x5a')],{})[_0x6e70('0x37')](respondWithResult(_0xebe5f7,0xc9))[_0x6e70('0x54')](handleError(_0xebe5f7,null));};exports[_0x6e70('0x35')]=function(_0x53f8fc,_0x385825){if(_0x53f8fc[_0x6e70('0x5a')]['id']){delete _0x53f8fc[_0x6e70('0x5a')]['id'];}return db[_0x6e70('0x51')][_0x6e70('0x58')]({'where':{'id':_0x53f8fc[_0x6e70('0x56')]['id']}})[_0x6e70('0x37')](handleEntityNotFound(_0x385825,null))[_0x6e70('0x37')](saveUpdates(_0x53f8fc[_0x6e70('0x5a')],null))[_0x6e70('0x37')](respondWithResult(_0x385825,null))[_0x6e70('0x54')](handleError(_0x385825,null));};exports[_0x6e70('0x36')]=function(_0xb8f78,_0x1fd9a6){return db[_0x6e70('0x51')][_0x6e70('0x58')]({'where':{'id':_0xb8f78[_0x6e70('0x56')]['id']}})[_0x6e70('0x37')](handleEntityNotFound(_0x1fd9a6,null))[_0x6e70('0x37')](removeEntity(_0x1fd9a6,null))[_0x6e70('0x54')](handleError(_0x1fd9a6,null));};exports['getFields']=function(_0x28898a,_0x4434dd,_0x180a13){var _0xeeab6e={};var _0x36757e={};var _0x3880dd;var _0x5b4d5d;return db[_0x6e70('0x51')][_0x6e70('0x5b')]({'where':{'id':_0x28898a['params']['id']}})[_0x6e70('0x37')](handleEntityNotFound(_0x4434dd,null))[_0x6e70('0x37')](function(_0x459a30){if(_0x459a30){_0x3880dd=_0x459a30;_0x36757e['model']=_['keys'](db[_0x6e70('0x5c')][_0x6e70('0x5d')]);_0x36757e[_0x6e70('0x43')]=_[_0x6e70('0x42')](_0x28898a[_0x6e70('0x43')]);_0x36757e[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x36757e['model'],_0x36757e['query']);_0xeeab6e[_0x6e70('0x46')]=_[_0x6e70('0x45')](_0x36757e[_0x6e70('0x41')],qs[_0x6e70('0x47')](_0x28898a['query']['fields']));_0xeeab6e[_0x6e70('0x46')]=_0xeeab6e[_0x6e70('0x46')]['length']?_0xeeab6e['attributes']:_0x36757e[_0x6e70('0x41')];_0xeeab6e['order']=qs[_0x6e70('0x4a')](_0x28898a[_0x6e70('0x43')][_0x6e70('0x4a')]);_0xeeab6e[_0x6e70('0x4e')]=qs[_0x6e70('0x44')](_[_0x6e70('0x4b')](_0x28898a[_0x6e70('0x43')],_0x36757e[_0x6e70('0x44')]));if(_0x28898a['query'][_0x6e70('0x4c')]){_0xeeab6e[_0x6e70('0x4e')]=_[_0x6e70('0x4d')](_0xeeab6e[_0x6e70('0x4e')],{'$or':_[_0x6e70('0x3d')](_0xeeab6e['attributes'],function(_0x5f5b02){var _0x5979bf={};_0x5979bf[_0x5f5b02]={'$like':'%'+_0x28898a[_0x6e70('0x43')][_0x6e70('0x4c')]+'%'};return _0x5979bf;})});}_0xeeab6e=_[_0x6e70('0x4d')]({},_0xeeab6e,_0x28898a['options']);return _0x3880dd['getFields'](_0xeeab6e);}})[_0x6e70('0x37')](function(_0x3dae08){if(_0x3dae08){_0x5b4d5d=_0x3dae08[_0x6e70('0x48')];if(!_0x28898a[_0x6e70('0x43')][_0x6e70('0x5e')](_0x6e70('0x49'))){_0xeeab6e['limit']=qs[_0x6e70('0x2f')](_0x28898a[_0x6e70('0x43')][_0x6e70('0x2f')]);_0xeeab6e[_0x6e70('0x2e')]=qs['offset'](_0x28898a[_0x6e70('0x43')]['offset']);}return _0x3880dd['getFields'](_0xeeab6e);}})[_0x6e70('0x37')](function(_0x3249a5){if(_0x3249a5){return _0x3249a5?{'count':_0x5b4d5d,'rows':_0x3249a5}:null;}})[_0x6e70('0x37')](respondWithResult(_0x4434dd,null))[_0x6e70('0x54')](handleError(_0x4434dd,null));};exports[_0x6e70('0x5f')]=function(_0x2be0fc,_0x4b5b19,_0x370eeb){var _0x152003={};var _0x186550={};var _0x18e64c;var _0x20f977;return db[_0x6e70('0x51')][_0x6e70('0x5b')]({'where':{'id':_0x2be0fc[_0x6e70('0x56')]['id']}})[_0x6e70('0x37')](handleEntityNotFound(_0x4b5b19,null))[_0x6e70('0x37')](function(_0x575938){if(_0x575938){_0x18e64c=_0x575938;_0x186550[_0x6e70('0x41')]=_[_0x6e70('0x42')](db[_0x6e70('0x5c')]['rawAttributes']);_0x186550['query']=_[_0x6e70('0x42')](_0x2be0fc[_0x6e70('0x43')]);_0x186550[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x186550[_0x6e70('0x41')],_0x186550['query']);_0x152003['attributes']=_[_0x6e70('0x45')](_0x186550[_0x6e70('0x41')],qs['fields'](_0x2be0fc[_0x6e70('0x43')][_0x6e70('0x47')]));_0x152003[_0x6e70('0x46')]=_0x152003[_0x6e70('0x46')][_0x6e70('0x48')]?_0x152003[_0x6e70('0x46')]:_0x186550[_0x6e70('0x41')];_0x152003[_0x6e70('0x60')]=qs[_0x6e70('0x4a')](_0x2be0fc[_0x6e70('0x43')][_0x6e70('0x4a')]);_0x152003[_0x6e70('0x4e')]=qs[_0x6e70('0x44')](_[_0x6e70('0x4b')](_0x2be0fc['query'],_0x186550['filters']));if(_0x2be0fc[_0x6e70('0x43')]['filter']){_0x152003[_0x6e70('0x4e')]=_['merge'](_0x152003['where'],{'$or':_[_0x6e70('0x3d')](_0x152003['attributes'],function(_0x576069){var _0x3c77d8={};_0x3c77d8[_0x576069]={'$like':'%'+_0x2be0fc[_0x6e70('0x43')][_0x6e70('0x4c')]+'%'};return _0x3c77d8;})});}_0x152003=_['merge']({},_0x152003,_0x2be0fc['options']);return _0x18e64c['getSubjects'](_0x152003);}})[_0x6e70('0x37')](function(_0x512b0a){if(_0x512b0a){_0x20f977=_0x512b0a[_0x6e70('0x48')];if(!_0x2be0fc[_0x6e70('0x43')][_0x6e70('0x5e')](_0x6e70('0x49'))){_0x152003[_0x6e70('0x2f')]=qs[_0x6e70('0x2f')](_0x2be0fc[_0x6e70('0x43')]['limit']);_0x152003[_0x6e70('0x2e')]=qs[_0x6e70('0x2e')](_0x2be0fc[_0x6e70('0x43')]['offset']);}return _0x18e64c[_0x6e70('0x5f')](_0x152003);}})[_0x6e70('0x37')](function(_0x11a615){if(_0x11a615){return _0x11a615?{'count':_0x20f977,'rows':_0x11a615}:null;}})[_0x6e70('0x37')](respondWithResult(_0x4b5b19,null))[_0x6e70('0x54')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x61')]=function(_0xb72fe1,_0x4a8499,_0x461ec0){var _0x48f6fd={};var _0x463eed={};var _0x39e6db;var _0x53acc8;return db[_0x6e70('0x51')][_0x6e70('0x5b')]({'where':{'id':_0xb72fe1['params']['id']}})['then'](handleEntityNotFound(_0x4a8499,null))[_0x6e70('0x37')](function(_0x502e6c){if(_0x502e6c){_0x39e6db=_0x502e6c;_0x463eed[_0x6e70('0x41')]=_['keys'](db[_0x6e70('0x5c')][_0x6e70('0x5d')]);_0x463eed[_0x6e70('0x43')]=_[_0x6e70('0x42')](_0xb72fe1[_0x6e70('0x43')]);_0x463eed[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x463eed['model'],_0x463eed['query']);_0x48f6fd[_0x6e70('0x46')]=_['intersection'](_0x463eed[_0x6e70('0x41')],qs[_0x6e70('0x47')](_0xb72fe1[_0x6e70('0x43')][_0x6e70('0x47')]));_0x48f6fd['attributes']=_0x48f6fd[_0x6e70('0x46')]['length']?_0x48f6fd[_0x6e70('0x46')]:_0x463eed[_0x6e70('0x41')];_0x48f6fd[_0x6e70('0x60')]=qs[_0x6e70('0x4a')](_0xb72fe1[_0x6e70('0x43')][_0x6e70('0x4a')]);_0x48f6fd[_0x6e70('0x4e')]=qs['filters'](_[_0x6e70('0x4b')](_0xb72fe1['query'],_0x463eed[_0x6e70('0x44')]));if(_0xb72fe1['query']['filter']){_0x48f6fd['where']=_[_0x6e70('0x4d')](_0x48f6fd[_0x6e70('0x4e')],{'$or':_[_0x6e70('0x3d')](_0x48f6fd[_0x6e70('0x46')],function(_0x2a3a71){var _0x4dd69a={};_0x4dd69a[_0x2a3a71]={'$like':'%'+_0xb72fe1[_0x6e70('0x43')][_0x6e70('0x4c')]+'%'};return _0x4dd69a;})});}_0x48f6fd=_['merge']({},_0x48f6fd,_0xb72fe1[_0x6e70('0x50')]);return _0x39e6db['getDescriptions'](_0x48f6fd);}})[_0x6e70('0x37')](function(_0x5d0585){if(_0x5d0585){_0x53acc8=_0x5d0585['length'];if(!_0xb72fe1[_0x6e70('0x43')][_0x6e70('0x5e')](_0x6e70('0x49'))){_0x48f6fd[_0x6e70('0x2f')]=qs[_0x6e70('0x2f')](_0xb72fe1[_0x6e70('0x43')][_0x6e70('0x2f')]);_0x48f6fd['offset']=qs[_0x6e70('0x2e')](_0xb72fe1['query'][_0x6e70('0x2e')]);}return _0x39e6db[_0x6e70('0x61')](_0x48f6fd);}})[_0x6e70('0x37')](function(_0x3269ce){if(_0x3269ce){return _0x3269ce?{'count':_0x53acc8,'rows':_0x3269ce}:null;}})[_0x6e70('0x37')](respondWithResult(_0x4a8499,null))[_0x6e70('0x54')](handleError(_0x4a8499,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d204149..2988008 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 _0x092f=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','ServicenowConfiguration','lodash','util','../../config/logger','api'];(function(_0x130e14,_0x20add3){var _0x559f8e=function(_0x2a11ae){while(--_0x2a11ae){_0x130e14['push'](_0x130e14['shift']());}};_0x559f8e(++_0x20add3);}(_0x092f,0x1dc));var _0xf092=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x092f[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var logger=require(_0xf092('0x2'))(_0xf092('0x3'));var moment=require(_0xf092('0x4'));var BPromise=require('bluebird');var rp=require(_0xf092('0x5'));var fs=require('fs');var path=require(_0xf092('0x6'));var rimraf=require(_0xf092('0x7'));var config=require('../../config/environment');var attributes=require(_0xf092('0x8'));module['exports']=function(_0x2b50a9,_0x31c77a){return _0x2b50a9['define'](_0xf092('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x974c=['bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api'];(function(_0x4a9a9c,_0x1680d5){var _0x1c307f=function(_0x2cfec6){while(--_0x2cfec6){_0x4a9a9c['push'](_0x4a9a9c['shift']());}};_0x1c307f(++_0x1680d5);}(_0x974c,0xd4));var _0xc974=function(_0x7fb58,_0x74a2c1){_0x7fb58=_0x7fb58-0x0;var _0x23e804=_0x974c[_0x7fb58];return _0x23e804;};'use strict';var _=require(_0xc974('0x0'));var util=require(_0xc974('0x1'));var logger=require(_0xc974('0x2'))(_0xc974('0x3'));var moment=require('moment');var BPromise=require(_0xc974('0x4'));var rp=require(_0xc974('0x5'));var fs=require('fs');var path=require(_0xc974('0x6'));var rimraf=require('rimraf');var config=require(_0xc974('0x7'));var attributes=require(_0xc974('0x8'));module[_0xc974('0x9')]=function(_0x48be44,_0x1629ac){return _0x48be44[_0xc974('0xa')](_0xc974('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 2929d1f..8f49122 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 _0x7bff=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4053e6,_0xb5896c){var _0x34c226=function(_0x5cfa5d){while(--_0x5cfa5d){_0x4053e6['push'](_0x4053e6['shift']());}};_0x34c226(++_0xb5896c);}(_0x7bff,0x189));var _0xf7bf=function(_0x295cdb,_0x34057c){_0x295cdb=_0x295cdb-0x0;var _0x3516a5=_0x7bff[_0x295cdb];return _0x3516a5;};'use strict';var _=require(_0xf7bf('0x0'));var util=require(_0xf7bf('0x1'));var moment=require(_0xf7bf('0x2'));var BPromise=require(_0xf7bf('0x3'));var rs=require(_0xf7bf('0x4'));var fs=require('fs');var Redis=require(_0xf7bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7bf('0x6'));var logger=require(_0xf7bf('0x7'))(_0xf7bf('0x8'));var config=require(_0xf7bf('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346b5a,_0x1ee15f,_0x593968){return new BPromise(function(_0x29933a,_0xd5e500){return client[_0xf7bf('0xb')](_0x346b5a,_0x593968)['then'](function(_0x541acd){logger[_0xf7bf('0xc')](_0xf7bf('0xd'),_0x1ee15f,'request\x20sent');logger['debug'](_0xf7bf('0xe'),_0x1ee15f,_0xf7bf('0xf'),JSON[_0xf7bf('0x10')](_0x541acd));if(_0x541acd[_0xf7bf('0x11')]){if(_0x541acd[_0xf7bf('0x11')][_0xf7bf('0x12')]===0x1f4){logger['error'](_0xf7bf('0xd'),_0x1ee15f,_0x541acd[_0xf7bf('0x11')][_0xf7bf('0x13')]);return _0xd5e500(_0x541acd[_0xf7bf('0x11')][_0xf7bf('0x13')]);}logger[_0xf7bf('0x11')](_0xf7bf('0xd'),_0x1ee15f,_0x541acd[_0xf7bf('0x11')]['message']);return _0x29933a(_0x541acd[_0xf7bf('0x11')]['message']);}else{logger[_0xf7bf('0xc')](_0xf7bf('0xd'),_0x1ee15f,_0xf7bf('0xf'));_0x29933a(_0x541acd['result'][_0xf7bf('0x13')]);}})[_0xf7bf('0x14')](function(_0x2b5649){logger[_0xf7bf('0x11')](_0xf7bf('0xd'),_0x1ee15f,_0x2b5649);_0xd5e500(_0x2b5649);});});} \ No newline at end of file +var _0x4e27=['client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e8553,_0x62fc28){var _0x23dc48=function(_0xbb49cc){while(--_0xbb49cc){_0x1e8553['push'](_0x1e8553['shift']());}};_0x23dc48(++_0x62fc28);}(_0x4e27,0xe0));var _0x74e2=function(_0x3236a8,_0x5053cf){_0x3236a8=_0x3236a8-0x0;var _0xb62eb3=_0x4e27[_0x3236a8];return _0xb62eb3;};'use strict';var _=require('lodash');var util=require(_0x74e2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x74e2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74e2('0x2'))['db'];var utils=require(_0x74e2('0x3'));var logger=require(_0x74e2('0x4'))(_0x74e2('0x5'));var config=require(_0x74e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x74e2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19ed77,_0xe7dd9f,_0x299d10){return new BPromise(function(_0x566086,_0x41ce81){return client[_0x74e2('0x8')](_0x19ed77,_0x299d10)[_0x74e2('0x9')](function(_0x15f764){logger[_0x74e2('0xa')](_0x74e2('0xb'),_0xe7dd9f,_0x74e2('0xc'));logger[_0x74e2('0xd')](_0x74e2('0xe'),_0xe7dd9f,_0x74e2('0xc'),JSON[_0x74e2('0xf')](_0x15f764));if(_0x15f764['error']){if(_0x15f764[_0x74e2('0x10')][_0x74e2('0x11')]===0x1f4){logger[_0x74e2('0x10')](_0x74e2('0xb'),_0xe7dd9f,_0x15f764['error']['message']);return _0x41ce81(_0x15f764['error'][_0x74e2('0x12')]);}logger[_0x74e2('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe7dd9f,_0x15f764[_0x74e2('0x10')][_0x74e2('0x12')]);return _0x566086(_0x15f764[_0x74e2('0x10')]['message']);}else{logger[_0x74e2('0xa')](_0x74e2('0xb'),_0xe7dd9f,'request\x20sent');_0x566086(_0x15f764[_0x74e2('0x13')]['message']);}})[_0x74e2('0x14')](function(_0x439b76){logger[_0x74e2('0x10')](_0x74e2('0xb'),_0xe7dd9f,_0x439b76);_0x41ce81(_0x439b76);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 50be9d8..a545194 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 _0x08d9=['update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2e0a85,_0x242749){var _0x2c49bb=function(_0x320362){while(--_0x320362){_0x2e0a85['push'](_0x2e0a85['shift']());}};_0x2c49bb(++_0x242749);}(_0x08d9,0xd3));var _0x908d=function(_0x30810d,_0x1fb5cf){_0x30810d=_0x30810d-0x0;var _0x424597=_0x08d9[_0x30810d];return _0x424597;};'use strict';var multer=require('multer');var util=require(_0x908d('0x0'));var path=require('path');var timeout=require(_0x908d('0x1'));var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var auth=require(_0x908d('0x4'));var interaction=require(_0x908d('0x5'));var config=require(_0x908d('0x6'));var controller=require(_0x908d('0x7'));router[_0x908d('0x8')]('/',auth[_0x908d('0x9')](),controller['index']);router[_0x908d('0x8')](_0x908d('0xa'),auth[_0x908d('0x9')](),controller['show']);router[_0x908d('0xb')]('/',auth[_0x908d('0x9')](),controller[_0x908d('0xc')]);router['put'](_0x908d('0xa'),auth[_0x908d('0x9')](),controller[_0x908d('0xd')]);router[_0x908d('0xe')](_0x908d('0xa'),auth[_0x908d('0x9')](),controller['destroy']);module[_0x908d('0xf')]=router; \ No newline at end of file +var _0xd3a8=['exports','multer','util','path','Router','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy'];(function(_0x4d2136,_0x5a782e){var _0x4a77b2=function(_0x1012df){while(--_0x1012df){_0x4d2136['push'](_0x4d2136['shift']());}};_0x4a77b2(++_0x5a782e);}(_0xd3a8,0xb1));var _0x8d3a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd3a8[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x8d3a('0x0'));var util=require(_0x8d3a('0x1'));var path=require(_0x8d3a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d3a('0x3')]();var auth=require(_0x8d3a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d3a('0x5'));router[_0x8d3a('0x6')]('/',auth[_0x8d3a('0x7')](),controller[_0x8d3a('0x8')]);router[_0x8d3a('0x6')](_0x8d3a('0x9'),auth[_0x8d3a('0x7')](),controller['show']);router[_0x8d3a('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d3a('0xb')]);router[_0x8d3a('0xc')](_0x8d3a('0x9'),auth[_0x8d3a('0x7')](),controller['update']);router[_0x8d3a('0xd')](_0x8d3a('0x9'),auth[_0x8d3a('0x7')](),controller[_0x8d3a('0xe')]);module[_0x8d3a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 59e4c0b..0769968 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 _0xe79f=['customVariable','BOOLEAN','sequelize','ENUM','variable','STRING'];(function(_0x5def07,_0x3f6005){var _0x43dcd8=function(_0x24185f){while(--_0x24185f){_0x5def07['push'](_0x5def07['shift']());}};_0x43dcd8(++_0x3f6005);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe79('0x0'));module['exports']={'type':{'type':Sequelize[_0xfe79('0x1')]('string',_0xfe79('0x2'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe79('0x3')]},'key':{'type':Sequelize[_0xfe79('0x3')]},'keyType':{'type':Sequelize[_0xfe79('0x1')]('string','variable',_0xfe79('0x4'))},'keyContent':{'type':Sequelize[_0xfe79('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfe79('0x3')]},'customField':{'type':Sequelize[_0xfe79('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb5f5=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x559725,_0x3523c9){var _0x130ad7=function(_0x17adf1){while(--_0x17adf1){_0x559725['push'](_0x559725['shift']());}};_0x130ad7(++_0x3523c9);}(_0xb5f5,0x177));var _0x5b5f=function(_0x33d23f,_0x18004b){_0x33d23f=_0x33d23f-0x0;var _0x1f3c68=_0xb5f5[_0x33d23f];return _0x1f3c68;};'use strict';var Sequelize=require(_0x5b5f('0x0'));module[_0x5b5f('0x1')]={'type':{'type':Sequelize[_0x5b5f('0x2')](_0x5b5f('0x3'),'variable',_0x5b5f('0x4'),_0x5b5f('0x5')),'defaultValue':_0x5b5f('0x3')},'content':{'type':Sequelize[_0x5b5f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5b5f('0x2')](_0x5b5f('0x3'),_0x5b5f('0x7'),_0x5b5f('0x4'))},'keyContent':{'type':Sequelize[_0x5b5f('0x6')]},'idField':{'type':Sequelize[_0x5b5f('0x6')]},'nameField':{'type':Sequelize[_0x5b5f('0x6')]},'customField':{'type':Sequelize[_0x5b5f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b5f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a8ef981..6643ff5 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1612ba,_0x3e4845){var _0x43d897=function(_0x494cac){while(--_0x494cac){_0x1612ba['push'](_0x1612ba['shift']());}};_0x43d897(++_0x3e4845);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x16bd21,_0x3410da){var _0x3224c0=function(_0x460adc){while(--_0x460adc){_0x16bd21['push'](_0x16bd21['shift']());}};_0x3224c0(++_0x3410da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 09305c8..74be55b 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 _0x8bf1=['int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','ServicenowField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var logger=require(_0x18bf('0x2'))(_0x18bf('0x3'));var moment=require(_0x18bf('0x4'));var BPromise=require(_0x18bf('0x5'));var rp=require(_0x18bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18bf('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x18bf('0x8')]=function(_0x2241b0,_0x4f5782){return _0x2241b0[_0x18bf('0x9')](_0x18bf('0xa'),attributes,{'tableName':_0x18bf('0xb'),'paranoid':![],'indexes':[{'name':_0x18bf('0xc'),'fields':['idField',_0x18bf('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e71=['ServicenowField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','define'];(function(_0x2e8a6e,_0x18e64f){var _0x259829=function(_0x230dac){while(--_0x230dac){_0x2e8a6e['push'](_0x2e8a6e['shift']());}};_0x259829(++_0x18e64f);}(_0x2e71,0x1c6));var _0x12e7=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2e71[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x12e7('0x0'));var util=require(_0x12e7('0x1'));var logger=require(_0x12e7('0x2'))(_0x12e7('0x3'));var moment=require(_0x12e7('0x4'));var BPromise=require(_0x12e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12e7('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x115886,_0x397f36){return _0x115886[_0x12e7('0x7')](_0x12e7('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x12e7('0x9'),_0x12e7('0xa')],'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 348577b..0cd791a 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 _0x5b1a=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xeb306b,_0x2e14ea){var _0x1f40b4=function(_0xd4e40){while(--_0xd4e40){_0xeb306b['push'](_0xeb306b['shift']());}};_0x1f40b4(++_0x2e14ea);}(_0x5b1a,0x124));var _0xa5b1=function(_0x433f27,_0x3a72ce){_0x433f27=_0x433f27-0x0;var _0x50b8e5=_0x5b1a[_0x433f27];return _0x50b8e5;};'use strict';var _=require(_0xa5b1('0x0'));var util=require(_0xa5b1('0x1'));var moment=require(_0xa5b1('0x2'));var BPromise=require(_0xa5b1('0x3'));var rs=require(_0xa5b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5b1('0x5'))(_0xa5b1('0x6'));var config=require(_0xa5b1('0x7'));var jayson=require(_0xa5b1('0x8'));var client=jayson[_0xa5b1('0x9')][_0xa5b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378a2b,_0x549e76,_0x1a155e){return new BPromise(function(_0x163af7,_0x1575aa){return client['request'](_0x378a2b,_0x1a155e)['then'](function(_0x3601fa){logger['info'](_0xa5b1('0xb'),_0x549e76,_0xa5b1('0xc'));logger[_0xa5b1('0xd')](_0xa5b1('0xe'),_0x549e76,_0xa5b1('0xc'),JSON[_0xa5b1('0xf')](_0x3601fa));if(_0x3601fa['error']){if(_0x3601fa[_0xa5b1('0x10')][_0xa5b1('0x11')]===0x1f4){logger[_0xa5b1('0x10')](_0xa5b1('0xb'),_0x549e76,_0x3601fa[_0xa5b1('0x10')][_0xa5b1('0x12')]);return _0x1575aa(_0x3601fa[_0xa5b1('0x10')][_0xa5b1('0x12')]);}logger[_0xa5b1('0x10')](_0xa5b1('0xb'),_0x549e76,_0x3601fa[_0xa5b1('0x10')]['message']);return _0x163af7(_0x3601fa[_0xa5b1('0x10')]['message']);}else{logger[_0xa5b1('0x13')](_0xa5b1('0xb'),_0x549e76,_0xa5b1('0xc'));_0x163af7(_0x3601fa[_0xa5b1('0x14')][_0xa5b1('0x12')]);}})[_0xa5b1('0x15')](function(_0x2feaf3){logger['error'](_0xa5b1('0xb'),_0x549e76,_0x2feaf3);_0x1575aa(_0x2feaf3);});});} \ No newline at end of file +var _0xc2f7=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x45735b,_0x15bf2f){var _0x1c7553=function(_0x2e9713){while(--_0x2e9713){_0x45735b['push'](_0x45735b['shift']());}};_0x1c7553(++_0x15bf2f);}(_0xc2f7,0x162));var _0x7c2f=function(_0x3ed995,_0x418b6d){_0x3ed995=_0x3ed995-0x0;var _0x226f35=_0xc2f7[_0x3ed995];return _0x226f35;};'use strict';var _=require(_0x7c2f('0x0'));var util=require(_0x7c2f('0x1'));var moment=require(_0x7c2f('0x2'));var BPromise=require(_0x7c2f('0x3'));var rs=require(_0x7c2f('0x4'));var fs=require('fs');var Redis=require(_0x7c2f('0x5'));var db=require(_0x7c2f('0x6'))['db'];var utils=require(_0x7c2f('0x7'));var logger=require(_0x7c2f('0x8'))(_0x7c2f('0x9'));var config=require(_0x7c2f('0xa'));var jayson=require(_0x7c2f('0xb'));var client=jayson[_0x7c2f('0xc')][_0x7c2f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x360eb8,_0x1b90bc,_0x3c48e5){return new BPromise(function(_0x4c3a6b,_0x1b7d8a){return client[_0x7c2f('0xe')](_0x360eb8,_0x3c48e5)[_0x7c2f('0xf')](function(_0x389835){logger[_0x7c2f('0x10')](_0x7c2f('0x11'),_0x1b90bc,'request\x20sent');logger[_0x7c2f('0x12')](_0x7c2f('0x13'),_0x1b90bc,_0x7c2f('0x14'),JSON[_0x7c2f('0x15')](_0x389835));if(_0x389835[_0x7c2f('0x16')]){if(_0x389835[_0x7c2f('0x16')]['code']===0x1f4){logger[_0x7c2f('0x16')](_0x7c2f('0x11'),_0x1b90bc,_0x389835[_0x7c2f('0x16')][_0x7c2f('0x17')]);return _0x1b7d8a(_0x389835[_0x7c2f('0x16')]['message']);}logger[_0x7c2f('0x16')](_0x7c2f('0x11'),_0x1b90bc,_0x389835[_0x7c2f('0x16')]['message']);return _0x4c3a6b(_0x389835[_0x7c2f('0x16')][_0x7c2f('0x17')]);}else{logger[_0x7c2f('0x10')]('ServicenowField,\x20%s,\x20%s',_0x1b90bc,'request\x20sent');_0x4c3a6b(_0x389835[_0x7c2f('0x18')][_0x7c2f('0x17')]);}})[_0x7c2f('0x19')](function(_0x519bfd){logger['error'](_0x7c2f('0x11'),_0x1b90bc,_0x519bfd);_0x1b7d8a(_0x519bfd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index cc5c369..dce019d 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 _0xdeb1=['put','update','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','create','/:id/configurations','addConfiguration'];(function(_0x43767a,_0x512399){var _0x18f48d=function(_0x26e8ba){while(--_0x26e8ba){_0x43767a['push'](_0x43767a['shift']());}};_0x18f48d(++_0x512399);}(_0xdeb1,0x192));var _0x1deb=function(_0xbf3415,_0x3b9146){_0xbf3415=_0xbf3415-0x0;var _0x1df81f=_0xdeb1[_0xbf3415];return _0x1df81f;};'use strict';var multer=require('multer');var util=require(_0x1deb('0x0'));var path=require(_0x1deb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1deb('0x2')]();var auth=require(_0x1deb('0x3'));var interaction=require(_0x1deb('0x4'));var config=require(_0x1deb('0x5'));var controller=require(_0x1deb('0x6'));router[_0x1deb('0x7')]('/',auth[_0x1deb('0x8')](),controller[_0x1deb('0x9')]);router['get'](_0x1deb('0xa'),auth[_0x1deb('0x8')](),controller[_0x1deb('0xb')]);router[_0x1deb('0x7')]('/:id/configurations',auth[_0x1deb('0x8')](),controller[_0x1deb('0xc')]);router[_0x1deb('0x7')]('/:id/fields',auth[_0x1deb('0x8')](),controller['getFields']);router['post']('/',auth[_0x1deb('0x8')](),controller[_0x1deb('0xd')]);router['post'](_0x1deb('0xe'),auth[_0x1deb('0x8')](),controller[_0x1deb('0xf')]);router[_0x1deb('0x10')](_0x1deb('0xa'),auth[_0x1deb('0x8')](),controller[_0x1deb('0x11')]);router['delete'](_0x1deb('0xa'),auth['isAuthenticated'](),controller[_0x1deb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3378=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports'];(function(_0x5c018c,_0xdbd79){var _0xce21ac=function(_0x54d162){while(--_0x54d162){_0x5c018c['push'](_0x5c018c['shift']());}};_0xce21ac(++_0xdbd79);}(_0x3378,0x159));var _0x8337=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x3378[_0x21f3bf];return _0x249d08;};'use strict';var multer=require(_0x8337('0x0'));var util=require(_0x8337('0x1'));var path=require(_0x8337('0x2'));var timeout=require(_0x8337('0x3'));var express=require(_0x8337('0x4'));var router=express[_0x8337('0x5')]();var auth=require(_0x8337('0x6'));var interaction=require(_0x8337('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router['get']('/',auth[_0x8337('0x8')](),controller[_0x8337('0x9')]);router[_0x8337('0xa')](_0x8337('0xb'),auth[_0x8337('0x8')](),controller[_0x8337('0xc')]);router[_0x8337('0xa')]('/:id/configurations',auth[_0x8337('0x8')](),controller[_0x8337('0xd')]);router[_0x8337('0xa')](_0x8337('0xe'),auth[_0x8337('0x8')](),controller[_0x8337('0xf')]);router[_0x8337('0x10')]('/',auth[_0x8337('0x8')](),controller[_0x8337('0x11')]);router[_0x8337('0x10')](_0x8337('0x12'),auth[_0x8337('0x8')](),controller[_0x8337('0x13')]);router['put']('/:id',auth[_0x8337('0x8')](),controller[_0x8337('0x14')]);router['delete'](_0x8337('0xb'),auth[_0x8337('0x8')](),controller[_0x8337('0x15')]);module[_0x8337('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 9071c0b..f3531f7 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 _0xdf70=['STRING','username','sequelize','exports'];(function(_0x10a9c6,_0x3ad310){var _0x2a430d=function(_0x55d735){while(--_0x55d735){_0x10a9c6['push'](_0x10a9c6['shift']());}};_0x2a430d(++_0x3ad310);}(_0xdf70,0x86));var _0x0df7=function(_0x5b5e9b,_0xe289fa){_0x5b5e9b=_0x5b5e9b-0x0;var _0x4ab979=_0xdf70[_0x5b5e9b];return _0x4ab979;};'use strict';var Sequelize=require(_0x0df7('0x0'));module[_0x0df7('0x1')]={'name':{'type':Sequelize[_0x0df7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0df7('0x2')],'unique':_0x0df7('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0df7('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0df7('0x2')]}}; \ No newline at end of file +var _0x5da0=['STRING','remoteUri','sequelize'];(function(_0x2df51e,_0x3b67ef){var _0x2ec2c2=function(_0x27ab12){while(--_0x27ab12){_0x2df51e['push'](_0x2df51e['shift']());}};_0x2ec2c2(++_0x3b67ef);}(_0x5da0,0x1be));var _0x05da=function(_0x435f78,_0x259ea9){_0x435f78=_0x435f78-0x0;var _0x51e58d=_0x5da0[_0x435f78];return _0x51e58d;};'use strict';var Sequelize=require(_0x05da('0x0'));module['exports']={'name':{'type':Sequelize[_0x05da('0x1')]},'description':{'type':Sequelize[_0x05da('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x05da('0x1')]},'remoteUri':{'type':Sequelize[_0x05da('0x1')],'unique':_0x05da('0x2')},'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 3710ffb..150e1a9 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 _0xd272=['findOne','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','Calls','values','module_fields','remove','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','request','then','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','find','create','body','getConfigurations','SugarcrmConfiguration','nolimit'];(function(_0x302a10,_0x381ca4){var _0x2402ff=function(_0x328e42){while(--_0x328e42){_0x302a10['push'](_0x302a10['shift']());}};_0x2402ff(++_0x381ca4);}(_0xd272,0x1bb));var _0x2d27=function(_0x31510f,_0x37786b){_0x31510f=_0x31510f-0x0;var _0xc9e4d4=_0xd272[_0x31510f];return _0xc9e4d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d27('0x0'));var rimraf=require(_0x2d27('0x1'));var zipdir=require(_0x2d27('0x2'));var jsonpatch=require(_0x2d27('0x3'));var rp=require(_0x2d27('0x4'));var moment=require(_0x2d27('0x5'));var BPromise=require(_0x2d27('0x6'));var Mustache=require(_0x2d27('0x7'));var util=require(_0x2d27('0x8'));var path=require(_0x2d27('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d27('0xa'));var fs=require('fs');var _=require(_0x2d27('0xb'));var squel=require(_0x2d27('0xc'));var crypto=require('crypto');var jsforce=require(_0x2d27('0xd'));var deskjs=require(_0x2d27('0xe'));var toCsv=require(_0x2d27('0xf'));var querystring=require(_0x2d27('0x10'));var Papa=require(_0x2d27('0x11'));var Redis=require(_0x2d27('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2d27('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d27('0x14'));var logger=require('../../config/logger')(_0x2d27('0x15'));var utils=require(_0x2d27('0x16'));var config=require(_0x2d27('0x17'));var db=require(_0x2d27('0x18'))['db'];var integrations=require(_0x2d27('0x19'));var jayson=require(_0x2d27('0x1a'));var client=jayson[_0x2d27('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x5b6d56,_0x2eb2c1,_0x15a287){if(_0x15a287){var _0x33fb9e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33fb9e[_0x2d27('0x1c')](_0x2eb2c1)){return _0x5b6d56;}else{throw new db[(_0x2d27('0x1d'))][(_0x2d27('0x1e'))](_0x2d27('0x1f'));}}else{return _0x5b6d56;}}function respondWithRpcPromise(_0x29b458,_0x23780c,_0x1c5918,_0xa7c7bd){return new BPromise(function(_0x327ccc,_0x8d9eaf){var _0x3a2490=_0xa7c7bd||client;return _0x3a2490[_0x2d27('0x20')](_0x29b458,_0x1c5918)[_0x2d27('0x21')](function(_0x2fbfc0){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x23780c,'request\x20sent');logger[_0x2d27('0x22')](_0x2d27('0x23'),_0x23780c,_0x2d27('0x24'),JSON[_0x2d27('0x25')](_0x2fbfc0));if(_0x2fbfc0[_0x2d27('0x26')]){if(_0x2fbfc0[_0x2d27('0x26')]['code']===0x1f4){logger[_0x2d27('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x23780c,_0x2fbfc0[_0x2d27('0x26')][_0x2d27('0x27')]);return _0x8d9eaf(_0x2fbfc0['error'][_0x2d27('0x27')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x23780c,_0x2fbfc0[_0x2d27('0x26')][_0x2d27('0x27')]);return _0x327ccc(_0x2fbfc0[_0x2d27('0x26')]['message']);}else{logger['info'](_0x2d27('0x28'),_0x23780c,_0x2d27('0x24'));_0x327ccc(_0x2fbfc0[_0x2d27('0x29')][_0x2d27('0x27')]);}})[_0x2d27('0x2a')](function(_0x4b5ca5){logger[_0x2d27('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x23780c,_0x4b5ca5);_0x8d9eaf(_0x4b5ca5);});});}function respondWithStatusCode(_0x147685,_0x299463){_0x299463=_0x299463||0xcc;return function(_0x5a10a5){if(_0x5a10a5){return _0x147685['sendStatus'](_0x299463);}return _0x147685[_0x2d27('0x2b')](_0x299463)[_0x2d27('0x2c')]();};}function respondWithResult(_0x1f62fb,_0x5124d1){_0x5124d1=_0x5124d1||0xc8;return function(_0x3a6e01){if(_0x3a6e01){return _0x1f62fb[_0x2d27('0x2b')](_0x5124d1)[_0x2d27('0x2d')](_0x3a6e01);}};}function respondWithFilteredResult(_0x253dfc,_0x5287d5){return function(_0x302549){if(_0x302549){var _0x278d50=_0x302549[_0x2d27('0x2e')],_0x43c7e2=_0x5287d5[_0x2d27('0x2f')],_0x27b5f9=_0x5287d5[_0x2d27('0x2f')]+_0x5287d5['limit'],_0x325ee0;if(_0x27b5f9>=_0x278d50){_0x27b5f9=_0x278d50;_0x325ee0=0xc8;}else{_0x325ee0=0xce;}_0x253dfc[_0x2d27('0x2b')](_0x325ee0);return _0x253dfc[_0x2d27('0x30')](_0x2d27('0x31'),_0x43c7e2+'-'+_0x27b5f9+'/'+_0x278d50)[_0x2d27('0x2d')](_0x302549);}return null;};}function patchUpdates(_0x2130d0){return function(_0x212f73){try{jsonpatch[_0x2d27('0x32')](_0x212f73,_0x2130d0,!![]);}catch(_0x271299){return BPromise[_0x2d27('0x33')](_0x271299);}return _0x212f73[_0x2d27('0x34')]();};}function saveUpdates(_0x1ef4b5,_0x469122){return function(_0x2c439b){if(_0x2c439b){return _0x2c439b[_0x2d27('0x35')](_0x1ef4b5)[_0x2d27('0x21')](function(_0x2dfac2){return _0x2dfac2;});}return null;};}function removeEntity(_0x2a1e7b,_0x39cf5c){return function(_0x29ae29){if(_0x29ae29){return _0x29ae29[_0x2d27('0x36')]()['then'](function(){_0x2a1e7b['status'](0xcc)[_0x2d27('0x2c')]();});}};}function handleEntityNotFound(_0x4d1bb8,_0x33c57a){return function(_0x667b03){if(!_0x667b03){_0x4d1bb8[_0x2d27('0x37')](0x194);}return _0x667b03;};}function handleError(_0x1b8aed,_0x124353){_0x124353=_0x124353||0x1f4;return function(_0x16a0e9){logger[_0x2d27('0x26')](_0x16a0e9[_0x2d27('0x38')]);if(_0x16a0e9[_0x2d27('0x39')]){delete _0x16a0e9[_0x2d27('0x39')];}_0x1b8aed[_0x2d27('0x2b')](_0x124353)[_0x2d27('0x3a')](_0x16a0e9);};}exports[_0x2d27('0x3b')]=function(_0x37e273,_0x75d4bd){var _0x485e3e={},_0x56f0d1={},_0x3a84aa={'count':0x0,'rows':[]};var _0x51d94c=_['map'](db[_0x2d27('0x3c')][_0x2d27('0x3d')],function(_0x13848d){return{'name':_0x13848d[_0x2d27('0x3e')],'type':_0x13848d[_0x2d27('0x3f')][_0x2d27('0x40')]};});_0x56f0d1[_0x2d27('0x41')]=_[_0x2d27('0x42')](_0x51d94c,_0x2d27('0x39'));_0x56f0d1[_0x2d27('0x43')]=_[_0x2d27('0x44')](_0x37e273[_0x2d27('0x43')]);_0x56f0d1[_0x2d27('0x45')]=_[_0x2d27('0x46')](_0x56f0d1[_0x2d27('0x41')],_0x56f0d1[_0x2d27('0x43')]);_0x485e3e[_0x2d27('0x47')]=_[_0x2d27('0x46')](_0x56f0d1[_0x2d27('0x41')],qs['fields'](_0x37e273[_0x2d27('0x43')][_0x2d27('0x48')]));_0x485e3e[_0x2d27('0x47')]=_0x485e3e['attributes'][_0x2d27('0x49')]?_0x485e3e[_0x2d27('0x47')]:_0x56f0d1[_0x2d27('0x41')];if(!_0x37e273[_0x2d27('0x43')][_0x2d27('0x4a')]('nolimit')){_0x485e3e[_0x2d27('0x4b')]=qs[_0x2d27('0x4b')](_0x37e273[_0x2d27('0x43')][_0x2d27('0x4b')]);_0x485e3e[_0x2d27('0x2f')]=qs['offset'](_0x37e273[_0x2d27('0x43')][_0x2d27('0x2f')]);}_0x485e3e[_0x2d27('0x4c')]=qs[_0x2d27('0x4d')](_0x37e273['query'][_0x2d27('0x4d')]);_0x485e3e[_0x2d27('0x4e')]=qs['filters'](_[_0x2d27('0x4f')](_0x37e273['query'],_0x56f0d1[_0x2d27('0x45')]),_0x51d94c);if(_0x37e273['query']['filter']){_0x485e3e['where']=_[_0x2d27('0x50')](_0x485e3e[_0x2d27('0x4e')],{'$or':_['map'](_0x51d94c,function(_0x5c34c0){if(_0x5c34c0[_0x2d27('0x3f')]!==_0x2d27('0x51')){var _0x5c7674={};_0x5c7674[_0x5c34c0[_0x2d27('0x39')]]={'$like':'%'+_0x37e273[_0x2d27('0x43')][_0x2d27('0x52')]+'%'};return _0x5c7674;}})});}_0x485e3e=_[_0x2d27('0x50')]({},_0x485e3e,_0x37e273[_0x2d27('0x53')]);var _0x34e999={'where':_0x485e3e[_0x2d27('0x4e')]};return db[_0x2d27('0x3c')][_0x2d27('0x2e')](_0x34e999)[_0x2d27('0x21')](function(_0x3449d5){_0x3a84aa['count']=_0x3449d5;if(_0x37e273[_0x2d27('0x43')]['includeAll']){_0x485e3e[_0x2d27('0x54')]=[{'all':!![]}];}return db[_0x2d27('0x3c')][_0x2d27('0x55')](_0x485e3e);})[_0x2d27('0x21')](function(_0x40883a){_0x3a84aa['rows']=_0x40883a;return _0x3a84aa;})[_0x2d27('0x21')](respondWithFilteredResult(_0x75d4bd,_0x485e3e))[_0x2d27('0x2a')](handleError(_0x75d4bd,null));};exports['show']=function(_0x18b028,_0xa1c6d0){var _0x4968be={'raw':![],'where':{'id':_0x18b028[_0x2d27('0x56')]['id']}},_0x99c68b={};_0x99c68b[_0x2d27('0x41')]=_[_0x2d27('0x44')](db[_0x2d27('0x3c')][_0x2d27('0x3d')]);_0x99c68b[_0x2d27('0x43')]=_[_0x2d27('0x44')](_0x18b028['query']);_0x99c68b[_0x2d27('0x45')]=_['intersection'](_0x99c68b[_0x2d27('0x41')],_0x99c68b[_0x2d27('0x43')]);_0x4968be[_0x2d27('0x47')]=_[_0x2d27('0x46')](_0x99c68b['model'],qs[_0x2d27('0x48')](_0x18b028['query']['fields']));_0x4968be[_0x2d27('0x47')]=_0x4968be[_0x2d27('0x47')][_0x2d27('0x49')]?_0x4968be[_0x2d27('0x47')]:_0x99c68b[_0x2d27('0x41')];if(_0x18b028[_0x2d27('0x43')]['includeAll']){_0x4968be[_0x2d27('0x54')]=[{'all':!![]}];}_0x4968be=_['merge']({},_0x4968be,_0x18b028[_0x2d27('0x53')]);return db['SugarcrmAccount'][_0x2d27('0x57')](_0x4968be)[_0x2d27('0x21')](handleEntityNotFound(_0xa1c6d0,null))[_0x2d27('0x21')](respondWithResult(_0xa1c6d0,null))[_0x2d27('0x2a')](handleError(_0xa1c6d0,null));};exports[_0x2d27('0x58')]=function(_0x548557,_0x67f717){return db['SugarcrmAccount']['create'](_0x548557['body'],{})[_0x2d27('0x21')](respondWithResult(_0x67f717,0xc9))[_0x2d27('0x2a')](handleError(_0x67f717,null));};exports[_0x2d27('0x35')]=function(_0x3dc92d,_0x4b5f52){if(_0x3dc92d[_0x2d27('0x59')]['id']){delete _0x3dc92d[_0x2d27('0x59')]['id'];}return db[_0x2d27('0x3c')]['find']({'where':{'id':_0x3dc92d[_0x2d27('0x56')]['id']}})[_0x2d27('0x21')](handleEntityNotFound(_0x4b5f52,null))[_0x2d27('0x21')](saveUpdates(_0x3dc92d[_0x2d27('0x59')],null))[_0x2d27('0x21')](respondWithResult(_0x4b5f52,null))[_0x2d27('0x2a')](handleError(_0x4b5f52,null));};exports['destroy']=function(_0x58862a,_0x1e36a1){return db['SugarcrmAccount'][_0x2d27('0x57')]({'where':{'id':_0x58862a[_0x2d27('0x56')]['id']}})[_0x2d27('0x21')](handleEntityNotFound(_0x1e36a1,null))[_0x2d27('0x21')](removeEntity(_0x1e36a1,null))['catch'](handleError(_0x1e36a1,null));};exports[_0x2d27('0x5a')]=function(_0x219076,_0x611bdf,_0x307cbc){var _0x1f24d0={};var _0x571c4a={};var _0x44848d;var _0x389f3c;return db[_0x2d27('0x3c')]['findOne']({'where':{'id':_0x219076[_0x2d27('0x56')]['id']}})[_0x2d27('0x21')](handleEntityNotFound(_0x611bdf,null))[_0x2d27('0x21')](function(_0x50b3e5){if(_0x50b3e5){_0x44848d=_0x50b3e5;_0x571c4a[_0x2d27('0x41')]=_[_0x2d27('0x44')](db[_0x2d27('0x5b')]['rawAttributes']);_0x571c4a['query']=_[_0x2d27('0x44')](_0x219076[_0x2d27('0x43')]);_0x571c4a[_0x2d27('0x45')]=_[_0x2d27('0x46')](_0x571c4a[_0x2d27('0x41')],_0x571c4a['query']);_0x1f24d0[_0x2d27('0x47')]=_[_0x2d27('0x46')](_0x571c4a[_0x2d27('0x41')],qs[_0x2d27('0x48')](_0x219076['query']['fields']));_0x1f24d0[_0x2d27('0x47')]=_0x1f24d0['attributes'][_0x2d27('0x49')]?_0x1f24d0[_0x2d27('0x47')]:_0x571c4a['model'];_0x1f24d0[_0x2d27('0x4c')]=qs[_0x2d27('0x4d')](_0x219076[_0x2d27('0x43')][_0x2d27('0x4d')]);_0x1f24d0[_0x2d27('0x4e')]=qs[_0x2d27('0x45')](_[_0x2d27('0x4f')](_0x219076[_0x2d27('0x43')],_0x571c4a[_0x2d27('0x45')]));if(_0x219076[_0x2d27('0x43')][_0x2d27('0x52')]){_0x1f24d0[_0x2d27('0x4e')]=_[_0x2d27('0x50')](_0x1f24d0['where'],{'$or':_[_0x2d27('0x42')](_0x1f24d0[_0x2d27('0x47')],function(_0x548ff9){var _0x3066be={};_0x3066be[_0x548ff9]={'$like':'%'+_0x219076[_0x2d27('0x43')][_0x2d27('0x52')]+'%'};return _0x3066be;})});}_0x1f24d0=_[_0x2d27('0x50')]({},_0x1f24d0,_0x219076[_0x2d27('0x53')]);return _0x44848d['getConfigurations'](_0x1f24d0);}})[_0x2d27('0x21')](function(_0x4db847){if(_0x4db847){_0x389f3c=_0x4db847[_0x2d27('0x49')];if(!_0x219076[_0x2d27('0x43')][_0x2d27('0x4a')](_0x2d27('0x5c'))){_0x1f24d0[_0x2d27('0x4b')]=qs['limit'](_0x219076[_0x2d27('0x43')][_0x2d27('0x4b')]);_0x1f24d0[_0x2d27('0x2f')]=qs[_0x2d27('0x2f')](_0x219076[_0x2d27('0x43')][_0x2d27('0x2f')]);}return _0x44848d['getConfigurations'](_0x1f24d0);}})[_0x2d27('0x21')](function(_0x23bb5b){if(_0x23bb5b){return _0x23bb5b?{'count':_0x389f3c,'rows':_0x23bb5b}:null;}})['then'](respondWithResult(_0x611bdf,null))[_0x2d27('0x2a')](handleError(_0x611bdf,null));};exports['addConfiguration']=function(_0x4006d9,_0x354d7f,_0x2ecdc9){if(_0x4006d9[_0x2d27('0x59')]['id']){delete _0x4006d9[_0x2d27('0x59')]['id'];}return db[_0x2d27('0x3c')][_0x2d27('0x5d')]({'where':{'id':_0x4006d9['params']['id']}})['then'](handleEntityNotFound(_0x354d7f,null))['then'](function(_0x280497){if(_0x280497){_0x4006d9[_0x2d27('0x59')][_0x2d27('0x5e')]=_0x280497['id'];_0x4006d9[_0x2d27('0x59')][_0x2d27('0x5f')]=integrations[_0x2d27('0x60')](_0x4006d9['body']['channel'],_0x4006d9[_0x2d27('0x59')][_0x2d27('0x3f')]);_0x4006d9[_0x2d27('0x59')][_0x2d27('0x61')]=integrations['getDescriptions'](_0x4006d9[_0x2d27('0x59')][_0x2d27('0x62')],_0x4006d9['body'][_0x2d27('0x3f')]);return db[_0x2d27('0x5b')][_0x2d27('0x58')](_0x4006d9[_0x2d27('0x59')],{'include':[{'model':db[_0x2d27('0x63')],'as':_0x2d27('0x5f')},{'model':db['SugarcrmField'],'as':_0x2d27('0x61')}]});}return null;})[_0x2d27('0x21')](respondWithResult(_0x354d7f,null))[_0x2d27('0x2a')](handleError(_0x354d7f,null));};exports[_0x2d27('0x64')]=function(_0x487ae1,_0x1b22c3,_0x123ada){var _0x4d0981='';var _0x530c06=['id',_0x2d27('0x39'),_0x2d27('0x65'),_0x2d27('0x66'),_0x2d27('0x67'),'date_start',_0x2d27('0x68'),_0x2d27('0x69'),_0x2d27('0x6a'),_0x2d27('0x6b'),_0x2d27('0x6c'),_0x2d27('0x6d')];return db[_0x2d27('0x3c')]['findOne']({'where':{'id':_0x487ae1[_0x2d27('0x56')]['id']},'attributes':['id',_0x2d27('0x6e'),_0x2d27('0x6f'),_0x2d27('0x70')]})[_0x2d27('0x21')](handleEntityNotFound(_0x1b22c3,null))[_0x2d27('0x21')](function(_0x5f5df3){if(_0x5f5df3){_0x4d0981=_0x5f5df3[_0x2d27('0x70')];var _0x209e90=_0x4d0981[_0x2d27('0x71')](-0x1);if(_0x209e90==='/'){_0x4d0981=_0x4d0981[_0x2d27('0x72')](0x0,_0x4d0981['lastIndexOf'](_0x209e90));}return rp({'method':'POST','uri':util['format'](_0x2d27('0x73'),_0x4d0981,_0x2d27('0x74')),'json':!![],'form':{'method':_0x2d27('0x75'),'input_type':_0x2d27('0x76'),'response_type':_0x2d27('0x76'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5f5df3['username'],'password':_0x5f5df3[_0x2d27('0x6f')],'encryption':_0x2d27('0x77')},'application':_0x2d27('0x78')})}});}})[_0x2d27('0x21')](function(_0x4935b2){if(_0x4935b2&&_0x4935b2[_0x2d27('0x39')]!==_0x2d27('0x79')&&_0x4935b2[_0x2d27('0x39')]!==_0x2d27('0x7a')){return rp({'method':_0x2d27('0x7b'),'uri':util['format'](_0x2d27('0x73'),_0x4d0981,_0x2d27('0x74')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4935b2['id'],'module_name':_0x2d27('0x7c')})}})['then'](function(_0x21ff3){if(_0x21ff3){var _0x4e602b=_[_0x2d27('0x7d')](_0x21ff3[_0x2d27('0x7e')]);_[_0x2d27('0x7f')](_0x4e602b,function(_0x4526b4){return _0x530c06['includes'](_0x4526b4[_0x2d27('0x39')]);});return{'count':_0x4e602b[_0x2d27('0x49')],'rows':_['map'](_0x4e602b,function(_0x186847){return{'id':_0x186847[_0x2d27('0x39')],'name':_0x186847[_0x2d27('0x80')],'custom':_[_0x2d27('0x81')](_0x186847['name'],'_c')?!![]:![],'options':_0x186847[_0x2d27('0x53')]?_[_0x2d27('0x42')](_[_0x2d27('0x7d')](_0x186847[_0x2d27('0x53')]),function(_0x4914ae){return{'name':_0x4914ae[_0x2d27('0x82')],'value':_0x4914ae[_0x2d27('0x39')]};}):[]};})};}})[_0x2d27('0x21')](respondWithResult(_0x1b22c3,null))[_0x2d27('0x2a')](function(_0x16be0c){var _0x350ddc=_0x487ae1[_0x2d27('0x43')][_0x2d27('0x1c')]?0x1f4:_0x16be0c['statusCode']||0x1f4;logger[_0x2d27('0x26')](_0x2d27('0x83'),_0x2d27('0x64'),_0x350ddc,JSON[_0x2d27('0x25')](_0x16be0c));delete _0x16be0c['name'];if(_0x350ddc===0x191){_0x350ddc=0x190;}_0x1b22c3[_0x2d27('0x2b')](_0x350ddc)[_0x2d27('0x3a')](_0x487ae1[_0x2d27('0x43')][_0x2d27('0x1c')]?{'message':_0x2d27('0x84'),'statusCode':_0x16be0c[_0x2d27('0x85')]}:_0x16be0c);});}else{var _0x219af1=0x1f4;_0x1b22c3[_0x2d27('0x2b')](_0x219af1)[_0x2d27('0x3a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xb5de=['duration_hours','parent_id','parent_type','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','username','PLAIN','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','Calls','module_fields','remove','includes','label','endsWith','value','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../components/integrations/configuration','client','http','test','ValidationError','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','destroy','end','name','send','index','rawAttributes','type','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SugarcrmAccount','count','includeAll','include','findAll','catch','params','find','create','body','update','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start'];(function(_0x18efd9,_0x1e4654){var _0x216e04=function(_0x4968b2){while(--_0x4968b2){_0x18efd9['push'](_0x18efd9['shift']());}};_0x216e04(++_0x1e4654);}(_0xb5de,0x19b));var _0xeb5d=function(_0xbbc835,_0xb07f5){_0xbbc835=_0xbbc835-0x0;var _0xd058e9=_0xb5de[_0xbbc835];return _0xd058e9;};'use strict';var pdf=require(_0xeb5d('0x0'));var emlformat=require(_0xeb5d('0x1'));var rimraf=require(_0xeb5d('0x2'));var zipdir=require(_0xeb5d('0x3'));var jsonpatch=require(_0xeb5d('0x4'));var rp=require('request-promise');var moment=require(_0xeb5d('0x5'));var BPromise=require(_0xeb5d('0x6'));var Mustache=require(_0xeb5d('0x7'));var util=require(_0xeb5d('0x8'));var path=require(_0xeb5d('0x9'));var sox=require(_0xeb5d('0xa'));var csv=require(_0xeb5d('0xb'));var ejs=require(_0xeb5d('0xc'));var fs=require('fs');var _=require(_0xeb5d('0xd'));var squel=require(_0xeb5d('0xe'));var crypto=require(_0xeb5d('0xf'));var jsforce=require(_0xeb5d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xeb5d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb5d('0x11'));var authService=require(_0xeb5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeb5d('0x13'));var hardwareService=require(_0xeb5d('0x14'));var logger=require('../../config/logger')(_0xeb5d('0x15'));var utils=require(_0xeb5d('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xeb5d('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xeb5d('0x18')][_0xeb5d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x54ecb3,_0x2e5b5d,_0x2944ef){if(_0x2944ef){var _0x22d111=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22d111[_0xeb5d('0x1a')](_0x2e5b5d)){return _0x54ecb3;}else{throw new db['Sequelize'][(_0xeb5d('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54ecb3;}}function respondWithRpcPromise(_0xeaa292,_0x448dfe,_0x49e6f8,_0x306337){return new BPromise(function(_0x51baa5,_0x263a43){var _0x56854d=_0x306337||client;return _0x56854d[_0xeb5d('0x1c')](_0xeaa292,_0x49e6f8)[_0xeb5d('0x1d')](function(_0x5c1e2c){logger[_0xeb5d('0x1e')](_0xeb5d('0x1f'),_0x448dfe,_0xeb5d('0x20'));logger['debug'](_0xeb5d('0x21'),_0x448dfe,'request\x20sent',JSON[_0xeb5d('0x22')](_0x5c1e2c));if(_0x5c1e2c['error']){if(_0x5c1e2c[_0xeb5d('0x23')][_0xeb5d('0x24')]===0x1f4){logger[_0xeb5d('0x23')](_0xeb5d('0x1f'),_0x448dfe,_0x5c1e2c['error'][_0xeb5d('0x25')]);return _0x263a43(_0x5c1e2c['error'][_0xeb5d('0x25')]);}logger[_0xeb5d('0x23')](_0xeb5d('0x1f'),_0x448dfe,_0x5c1e2c[_0xeb5d('0x23')]['message']);return _0x51baa5(_0x5c1e2c[_0xeb5d('0x23')][_0xeb5d('0x25')]);}else{logger['info'](_0xeb5d('0x1f'),_0x448dfe,_0xeb5d('0x20'));_0x51baa5(_0x5c1e2c[_0xeb5d('0x26')][_0xeb5d('0x25')]);}})['catch'](function(_0x34fcae){logger[_0xeb5d('0x23')](_0xeb5d('0x1f'),_0x448dfe,_0x34fcae);_0x263a43(_0x34fcae);});});}function respondWithStatusCode(_0x5c65eb,_0x1ac3c6){_0x1ac3c6=_0x1ac3c6||0xcc;return function(_0x58d220){if(_0x58d220){return _0x5c65eb[_0xeb5d('0x27')](_0x1ac3c6);}return _0x5c65eb[_0xeb5d('0x28')](_0x1ac3c6)['end']();};}function respondWithResult(_0x5da576,_0x316695){_0x316695=_0x316695||0xc8;return function(_0x2b755d){if(_0x2b755d){return _0x5da576[_0xeb5d('0x28')](_0x316695)[_0xeb5d('0x29')](_0x2b755d);}};}function respondWithFilteredResult(_0x318256,_0x5133fb){return function(_0x5cf0a7){if(_0x5cf0a7){var _0x3c1e6d=_0x5cf0a7['count'],_0x57d087=_0x5133fb[_0xeb5d('0x2a')],_0x3f0f6b=_0x5133fb[_0xeb5d('0x2a')]+_0x5133fb['limit'],_0xb3fe2b;if(_0x3f0f6b>=_0x3c1e6d){_0x3f0f6b=_0x3c1e6d;_0xb3fe2b=0xc8;}else{_0xb3fe2b=0xce;}_0x318256[_0xeb5d('0x28')](_0xb3fe2b);return _0x318256[_0xeb5d('0x2b')](_0xeb5d('0x2c'),_0x57d087+'-'+_0x3f0f6b+'/'+_0x3c1e6d)[_0xeb5d('0x29')](_0x5cf0a7);}return null;};}function patchUpdates(_0x218af1){return function(_0x4aae79){try{jsonpatch[_0xeb5d('0x2d')](_0x4aae79,_0x218af1,!![]);}catch(_0x5eba49){return BPromise[_0xeb5d('0x2e')](_0x5eba49);}return _0x4aae79[_0xeb5d('0x2f')]();};}function saveUpdates(_0x24ca14,_0x50a43e){return function(_0x213531){if(_0x213531){return _0x213531['update'](_0x24ca14)['then'](function(_0x4b1554){return _0x4b1554;});}return null;};}function removeEntity(_0x33ae04,_0xe0f889){return function(_0x99f482){if(_0x99f482){return _0x99f482[_0xeb5d('0x30')]()['then'](function(){_0x33ae04[_0xeb5d('0x28')](0xcc)[_0xeb5d('0x31')]();});}};}function handleEntityNotFound(_0x182e90,_0x5d38e5){return function(_0x5595c9){if(!_0x5595c9){_0x182e90[_0xeb5d('0x27')](0x194);}return _0x5595c9;};}function handleError(_0x4ea2e4,_0x3ff626){_0x3ff626=_0x3ff626||0x1f4;return function(_0x53f412){logger[_0xeb5d('0x23')](_0x53f412['stack']);if(_0x53f412[_0xeb5d('0x32')]){delete _0x53f412[_0xeb5d('0x32')];}_0x4ea2e4[_0xeb5d('0x28')](_0x3ff626)[_0xeb5d('0x33')](_0x53f412);};}exports[_0xeb5d('0x34')]=function(_0x5980b0,_0x6a2d6a){var _0x4d5ec0={},_0x106d82={},_0x59a6e1={'count':0x0,'rows':[]};var _0x1769f7=_['map'](db['SugarcrmAccount'][_0xeb5d('0x35')],function(_0xe41faf){return{'name':_0xe41faf['fieldName'],'type':_0xe41faf[_0xeb5d('0x36')]['key']};});_0x106d82['model']=_[_0xeb5d('0x37')](_0x1769f7,_0xeb5d('0x32'));_0x106d82[_0xeb5d('0x38')]=_[_0xeb5d('0x39')](_0x5980b0[_0xeb5d('0x38')]);_0x106d82['filters']=_[_0xeb5d('0x3a')](_0x106d82['model'],_0x106d82[_0xeb5d('0x38')]);_0x4d5ec0[_0xeb5d('0x3b')]=_[_0xeb5d('0x3a')](_0x106d82[_0xeb5d('0x3c')],qs[_0xeb5d('0x3d')](_0x5980b0['query']['fields']));_0x4d5ec0['attributes']=_0x4d5ec0[_0xeb5d('0x3b')][_0xeb5d('0x3e')]?_0x4d5ec0[_0xeb5d('0x3b')]:_0x106d82[_0xeb5d('0x3c')];if(!_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x3f')]('nolimit')){_0x4d5ec0['limit']=qs[_0xeb5d('0x40')](_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x40')]);_0x4d5ec0['offset']=qs[_0xeb5d('0x2a')](_0x5980b0[_0xeb5d('0x38')]['offset']);}_0x4d5ec0[_0xeb5d('0x41')]=qs[_0xeb5d('0x42')](_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x42')]);_0x4d5ec0['where']=qs[_0xeb5d('0x43')](_[_0xeb5d('0x44')](_0x5980b0[_0xeb5d('0x38')],_0x106d82[_0xeb5d('0x43')]),_0x1769f7);if(_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x45')]){_0x4d5ec0[_0xeb5d('0x46')]=_[_0xeb5d('0x47')](_0x4d5ec0[_0xeb5d('0x46')],{'$or':_[_0xeb5d('0x37')](_0x1769f7,function(_0x4fa3e1){if(_0x4fa3e1[_0xeb5d('0x36')]!==_0xeb5d('0x48')){var _0x1d5d13={};_0x1d5d13[_0x4fa3e1['name']]={'$like':'%'+_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x45')]+'%'};return _0x1d5d13;}})});}_0x4d5ec0=_[_0xeb5d('0x47')]({},_0x4d5ec0,_0x5980b0[_0xeb5d('0x49')]);var _0x1c8be9={'where':_0x4d5ec0['where']};return db[_0xeb5d('0x4a')][_0xeb5d('0x4b')](_0x1c8be9)['then'](function(_0x26d294){_0x59a6e1[_0xeb5d('0x4b')]=_0x26d294;if(_0x5980b0[_0xeb5d('0x38')][_0xeb5d('0x4c')]){_0x4d5ec0[_0xeb5d('0x4d')]=[{'all':!![]}];}return db[_0xeb5d('0x4a')][_0xeb5d('0x4e')](_0x4d5ec0);})[_0xeb5d('0x1d')](function(_0x10c545){_0x59a6e1['rows']=_0x10c545;return _0x59a6e1;})['then'](respondWithFilteredResult(_0x6a2d6a,_0x4d5ec0))[_0xeb5d('0x4f')](handleError(_0x6a2d6a,null));};exports['show']=function(_0x5a654c,_0x220846){var _0x20e5c2={'raw':![],'where':{'id':_0x5a654c[_0xeb5d('0x50')]['id']}},_0x30cbd6={};_0x30cbd6[_0xeb5d('0x3c')]=_[_0xeb5d('0x39')](db[_0xeb5d('0x4a')][_0xeb5d('0x35')]);_0x30cbd6[_0xeb5d('0x38')]=_[_0xeb5d('0x39')](_0x5a654c[_0xeb5d('0x38')]);_0x30cbd6['filters']=_[_0xeb5d('0x3a')](_0x30cbd6['model'],_0x30cbd6['query']);_0x20e5c2[_0xeb5d('0x3b')]=_[_0xeb5d('0x3a')](_0x30cbd6[_0xeb5d('0x3c')],qs['fields'](_0x5a654c[_0xeb5d('0x38')]['fields']));_0x20e5c2['attributes']=_0x20e5c2['attributes'][_0xeb5d('0x3e')]?_0x20e5c2['attributes']:_0x30cbd6[_0xeb5d('0x3c')];if(_0x5a654c[_0xeb5d('0x38')]['includeAll']){_0x20e5c2[_0xeb5d('0x4d')]=[{'all':!![]}];}_0x20e5c2=_[_0xeb5d('0x47')]({},_0x20e5c2,_0x5a654c[_0xeb5d('0x49')]);return db[_0xeb5d('0x4a')][_0xeb5d('0x51')](_0x20e5c2)[_0xeb5d('0x1d')](handleEntityNotFound(_0x220846,null))['then'](respondWithResult(_0x220846,null))['catch'](handleError(_0x220846,null));};exports['create']=function(_0x3bb619,_0x48f6ce){return db[_0xeb5d('0x4a')][_0xeb5d('0x52')](_0x3bb619[_0xeb5d('0x53')],{})[_0xeb5d('0x1d')](respondWithResult(_0x48f6ce,0xc9))['catch'](handleError(_0x48f6ce,null));};exports[_0xeb5d('0x54')]=function(_0x462cf2,_0x30485d){if(_0x462cf2[_0xeb5d('0x53')]['id']){delete _0x462cf2['body']['id'];}return db['SugarcrmAccount'][_0xeb5d('0x51')]({'where':{'id':_0x462cf2[_0xeb5d('0x50')]['id']}})['then'](handleEntityNotFound(_0x30485d,null))[_0xeb5d('0x1d')](saveUpdates(_0x462cf2[_0xeb5d('0x53')],null))[_0xeb5d('0x1d')](respondWithResult(_0x30485d,null))[_0xeb5d('0x4f')](handleError(_0x30485d,null));};exports[_0xeb5d('0x30')]=function(_0x445bd6,_0x5502a5){return db['SugarcrmAccount'][_0xeb5d('0x51')]({'where':{'id':_0x445bd6[_0xeb5d('0x50')]['id']}})['then'](handleEntityNotFound(_0x5502a5,null))[_0xeb5d('0x1d')](removeEntity(_0x5502a5,null))[_0xeb5d('0x4f')](handleError(_0x5502a5,null));};exports[_0xeb5d('0x55')]=function(_0x500430,_0x1b75de,_0x534585){var _0x23d8a8={};var _0x38b81f={};var _0x45146b;var _0x404886;return db[_0xeb5d('0x4a')][_0xeb5d('0x56')]({'where':{'id':_0x500430[_0xeb5d('0x50')]['id']}})[_0xeb5d('0x1d')](handleEntityNotFound(_0x1b75de,null))[_0xeb5d('0x1d')](function(_0xc64efb){if(_0xc64efb){_0x45146b=_0xc64efb;_0x38b81f['model']=_[_0xeb5d('0x39')](db['SugarcrmConfiguration'][_0xeb5d('0x35')]);_0x38b81f[_0xeb5d('0x38')]=_[_0xeb5d('0x39')](_0x500430[_0xeb5d('0x38')]);_0x38b81f['filters']=_[_0xeb5d('0x3a')](_0x38b81f[_0xeb5d('0x3c')],_0x38b81f['query']);_0x23d8a8['attributes']=_['intersection'](_0x38b81f['model'],qs[_0xeb5d('0x3d')](_0x500430[_0xeb5d('0x38')][_0xeb5d('0x3d')]));_0x23d8a8['attributes']=_0x23d8a8['attributes']['length']?_0x23d8a8['attributes']:_0x38b81f['model'];_0x23d8a8[_0xeb5d('0x41')]=qs[_0xeb5d('0x42')](_0x500430[_0xeb5d('0x38')][_0xeb5d('0x42')]);_0x23d8a8[_0xeb5d('0x46')]=qs[_0xeb5d('0x43')](_[_0xeb5d('0x44')](_0x500430[_0xeb5d('0x38')],_0x38b81f[_0xeb5d('0x43')]));if(_0x500430['query'][_0xeb5d('0x45')]){_0x23d8a8[_0xeb5d('0x46')]=_[_0xeb5d('0x47')](_0x23d8a8[_0xeb5d('0x46')],{'$or':_[_0xeb5d('0x37')](_0x23d8a8[_0xeb5d('0x3b')],function(_0x46c18d){var _0x338f3d={};_0x338f3d[_0x46c18d]={'$like':'%'+_0x500430[_0xeb5d('0x38')]['filter']+'%'};return _0x338f3d;})});}_0x23d8a8=_[_0xeb5d('0x47')]({},_0x23d8a8,_0x500430[_0xeb5d('0x49')]);return _0x45146b[_0xeb5d('0x55')](_0x23d8a8);}})['then'](function(_0x1179f7){if(_0x1179f7){_0x404886=_0x1179f7[_0xeb5d('0x3e')];if(!_0x500430[_0xeb5d('0x38')][_0xeb5d('0x3f')]('nolimit')){_0x23d8a8[_0xeb5d('0x40')]=qs[_0xeb5d('0x40')](_0x500430['query']['limit']);_0x23d8a8[_0xeb5d('0x2a')]=qs[_0xeb5d('0x2a')](_0x500430[_0xeb5d('0x38')]['offset']);}return _0x45146b[_0xeb5d('0x55')](_0x23d8a8);}})[_0xeb5d('0x1d')](function(_0x4cab3d){if(_0x4cab3d){return _0x4cab3d?{'count':_0x404886,'rows':_0x4cab3d}:null;}})[_0xeb5d('0x1d')](respondWithResult(_0x1b75de,null))[_0xeb5d('0x4f')](handleError(_0x1b75de,null));};exports[_0xeb5d('0x57')]=function(_0x528fad,_0x414f3e,_0x48efb2){if(_0x528fad[_0xeb5d('0x53')]['id']){delete _0x528fad[_0xeb5d('0x53')]['id'];}return db[_0xeb5d('0x4a')]['findOne']({'where':{'id':_0x528fad[_0xeb5d('0x50')]['id']}})[_0xeb5d('0x1d')](handleEntityNotFound(_0x414f3e,null))[_0xeb5d('0x1d')](function(_0x5abae5){if(_0x5abae5){_0x528fad[_0xeb5d('0x53')][_0xeb5d('0x58')]=_0x5abae5['id'];_0x528fad[_0xeb5d('0x53')][_0xeb5d('0x59')]=integrations[_0xeb5d('0x5a')](_0x528fad['body'][_0xeb5d('0x5b')],_0x528fad[_0xeb5d('0x53')][_0xeb5d('0x36')]);_0x528fad['body'][_0xeb5d('0x5c')]=integrations[_0xeb5d('0x5d')](_0x528fad[_0xeb5d('0x53')][_0xeb5d('0x5b')],_0x528fad[_0xeb5d('0x53')][_0xeb5d('0x36')]);return db[_0xeb5d('0x5e')][_0xeb5d('0x52')](_0x528fad[_0xeb5d('0x53')],{'include':[{'model':db[_0xeb5d('0x5f')],'as':_0xeb5d('0x59')},{'model':db[_0xeb5d('0x5f')],'as':'Descriptions'}]});}return null;})[_0xeb5d('0x1d')](respondWithResult(_0x414f3e,null))['catch'](handleError(_0x414f3e,null));};exports[_0xeb5d('0x60')]=function(_0x102b90,_0x39c0d9,_0x369c5f){var _0x197976='';var _0x92bd77=['id',_0xeb5d('0x32'),_0xeb5d('0x61'),_0xeb5d('0x62'),_0xeb5d('0x63'),_0xeb5d('0x64'),_0xeb5d('0x65'),'duration_minutes',_0xeb5d('0x66'),_0xeb5d('0x67'),'parent_name','direction'];return db['SugarcrmAccount'][_0xeb5d('0x56')]({'where':{'id':_0x102b90[_0xeb5d('0x50')]['id']},'attributes':['id','username',_0xeb5d('0x68'),'remoteUri']})['then'](handleEntityNotFound(_0x39c0d9,null))['then'](function(_0x10efd1){if(_0x10efd1){_0x197976=_0x10efd1[_0xeb5d('0x69')];var _0xa1ad4f=_0x197976[_0xeb5d('0x6a')](-0x1);if(_0xa1ad4f==='/'){_0x197976=_0x197976[_0xeb5d('0x6b')](0x0,_0x197976[_0xeb5d('0x6c')](_0xa1ad4f));}return rp({'method':'POST','uri':util[_0xeb5d('0x6d')](_0xeb5d('0x6e'),_0x197976,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xeb5d('0x6f'),'input_type':_0xeb5d('0x70'),'response_type':_0xeb5d('0x70'),'rest_data':JSON[_0xeb5d('0x22')]({'user_auth':{'user_name':_0x10efd1[_0xeb5d('0x71')],'password':_0x10efd1[_0xeb5d('0x68')],'encryption':_0xeb5d('0x72')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xeb5d('0x1d')](function(_0x13e1ce){if(_0x13e1ce&&_0x13e1ce['name']!==_0xeb5d('0x73')&&_0x13e1ce[_0xeb5d('0x32')]!==_0xeb5d('0x74')){return rp({'method':_0xeb5d('0x75'),'uri':util['format'](_0xeb5d('0x6e'),_0x197976,_0xeb5d('0x76')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xeb5d('0x70'),'response_type':'JSON','rest_data':JSON[_0xeb5d('0x22')]({'session':_0x13e1ce['id'],'module_name':_0xeb5d('0x77')})}})[_0xeb5d('0x1d')](function(_0x58e8a8){if(_0x58e8a8){var _0x54c330=_['values'](_0x58e8a8[_0xeb5d('0x78')]);_[_0xeb5d('0x79')](_0x54c330,function(_0x38e569){return _0x92bd77[_0xeb5d('0x7a')](_0x38e569[_0xeb5d('0x32')]);});return{'count':_0x54c330['length'],'rows':_[_0xeb5d('0x37')](_0x54c330,function(_0x310de2){return{'id':_0x310de2['name'],'name':_0x310de2[_0xeb5d('0x7b')],'custom':_[_0xeb5d('0x7c')](_0x310de2[_0xeb5d('0x32')],'_c')?!![]:![],'options':_0x310de2['options']?_[_0xeb5d('0x37')](_['values'](_0x310de2[_0xeb5d('0x49')]),function(_0x1c21be){return{'name':_0x1c21be[_0xeb5d('0x7d')],'value':_0x1c21be['name']};}):[]};})};}})[_0xeb5d('0x1d')](respondWithResult(_0x39c0d9,null))[_0xeb5d('0x4f')](function(_0x3e80d8){var _0x41c088=_0x102b90['query'][_0xeb5d('0x1a')]?0x1f4:_0x3e80d8[_0xeb5d('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x41c088,JSON[_0xeb5d('0x22')](_0x3e80d8));delete _0x3e80d8[_0xeb5d('0x32')];if(_0x41c088===0x191){_0x41c088=0x190;}_0x39c0d9['status'](_0x41c088)[_0xeb5d('0x33')](_0x102b90[_0xeb5d('0x38')][_0xeb5d('0x1a')]?{'message':_0xeb5d('0x7f'),'statusCode':_0x3e80d8[_0xeb5d('0x7e')]}:_0x3e80d8);});}else{var _0x1a3a00=0x1f4;_0x39c0d9[_0xeb5d('0x28')](_0x1a3a00)[_0xeb5d('0x33')]({'message':_0xeb5d('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index cdaa12f..e416013 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 _0x4f67=['util','../../config/logger','api','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4f67,0x8e));var _0x74f6=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0x4f67[_0x2211ed];return _0x4d78cc;};'use strict';var _=require(_0x74f6('0x0'));var util=require(_0x74f6('0x1'));var logger=require(_0x74f6('0x2'))(_0x74f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x74f6('0x4'));var rimraf=require(_0x74f6('0x5'));var config=require('../../config/environment');var attributes=require(_0x74f6('0x6'));var integrations=require(_0x74f6('0x7'));module[_0x74f6('0x8')]=function(_0x29a12d,_0xeea9e9){return _0x29a12d[_0x74f6('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x74f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5133=['request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment'];(function(_0xfec4f,_0x516119){var _0x4d8bad=function(_0x3d5eaa){while(--_0x3d5eaa){_0xfec4f['push'](_0xfec4f['shift']());}};_0x4d8bad(++_0x516119);}(_0x5133,0x134));var _0x3513=function(_0x43ca73,_0x1d1b2a){_0x43ca73=_0x43ca73-0x0;var _0x56a5ef=_0x5133[_0x43ca73];return _0x56a5ef;};'use strict';var _=require(_0x3513('0x0'));var util=require(_0x3513('0x1'));var logger=require('../../config/logger')(_0x3513('0x2'));var moment=require(_0x3513('0x3'));var BPromise=require('bluebird');var rp=require(_0x3513('0x4'));var fs=require('fs');var path=require(_0x3513('0x5'));var rimraf=require('rimraf');var config=require(_0x3513('0x6'));var attributes=require(_0x3513('0x7'));var integrations=require(_0x3513('0x8'));module[_0x3513('0x9')]=function(_0x24638b,_0x349d99){return _0x24638b[_0x3513('0xa')](_0x3513('0xb'),attributes,{'tableName':_0x3513('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index bc03720..34a82d1 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 _0x02b3=['include','model','map','attributes','stringify','ShowSugarcrmAccount','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0x50f247,_0x1f42bb){var _0x348875=function(_0x5102a4){while(--_0x5102a4){_0x50f247['push'](_0x50f247['shift']());}};_0x348875(++_0x1f42bb);}(_0x02b3,0x1ac));var _0x302b=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x02b3[_0x478c8a];return _0x3b6b3e;};'use strict';var _=require(_0x302b('0x0'));var util=require(_0x302b('0x1'));var moment=require('moment');var BPromise=require(_0x302b('0x2'));var rs=require(_0x302b('0x3'));var fs=require('fs');var Redis=require(_0x302b('0x4'));var db=require(_0x302b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x302b('0x6'))('rpc');var config=require(_0x302b('0x7'));var jayson=require(_0x302b('0x8'));var client=jayson[_0x302b('0x9')][_0x302b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1340f6,_0x426694,_0x28a680){return new BPromise(function(_0x4eb9e9,_0x588ef3){return client['request'](_0x1340f6,_0x28a680)['then'](function(_0x5210cb){logger[_0x302b('0xb')](_0x302b('0xc'),_0x426694,_0x302b('0xd'));logger[_0x302b('0xe')](_0x302b('0xf'),_0x426694,_0x302b('0xd'),JSON['stringify'](_0x5210cb));if(_0x5210cb[_0x302b('0x10')]){if(_0x5210cb[_0x302b('0x10')][_0x302b('0x11')]===0x1f4){logger['error'](_0x302b('0xc'),_0x426694,_0x5210cb[_0x302b('0x10')][_0x302b('0x12')]);return _0x588ef3(_0x5210cb[_0x302b('0x10')][_0x302b('0x12')]);}logger[_0x302b('0x10')](_0x302b('0xc'),_0x426694,_0x5210cb[_0x302b('0x10')][_0x302b('0x12')]);return _0x4eb9e9(_0x5210cb[_0x302b('0x10')][_0x302b('0x12')]);}else{logger[_0x302b('0xb')](_0x302b('0xc'),_0x426694,_0x302b('0xd'));_0x4eb9e9(_0x5210cb[_0x302b('0x13')]['message']);}})[_0x302b('0x14')](function(_0x3e6c5c){logger[_0x302b('0x10')](_0x302b('0xc'),_0x426694,_0x3e6c5c);_0x588ef3(_0x3e6c5c);});});}exports[_0x302b('0x15')]=function(_0x5517ba){var _0x53eafc=this;return new Promise(function(_0x353025,_0x4cc15d){return db[_0x302b('0x16')][_0x302b('0x17')]({'raw':_0x5517ba[_0x302b('0x18')]?_0x5517ba['options'][_0x302b('0x19')]===undefined?!![]:![]:!![],'where':_0x5517ba[_0x302b('0x18')]?_0x5517ba[_0x302b('0x18')][_0x302b('0x1a')]||null:null,'attributes':_0x5517ba[_0x302b('0x18')]?_0x5517ba[_0x302b('0x18')]['attributes']||null:null,'limit':_0x5517ba[_0x302b('0x18')]?_0x5517ba[_0x302b('0x18')]['limit']||null:null,'include':_0x5517ba[_0x302b('0x18')]?_0x5517ba[_0x302b('0x18')][_0x302b('0x1b')]?_['map'](_0x5517ba[_0x302b('0x18')][_0x302b('0x1b')],function(_0x5c32ee){return{'model':db[_0x5c32ee[_0x302b('0x1c')]],'as':_0x5c32ee['as'],'attributes':_0x5c32ee['attributes'],'include':_0x5c32ee[_0x302b('0x1b')]?_[_0x302b('0x1d')](_0x5c32ee[_0x302b('0x1b')],function(_0x4646e1){return{'model':db[_0x4646e1[_0x302b('0x1c')]],'as':_0x4646e1['as'],'attributes':_0x4646e1[_0x302b('0x1e')],'include':_0x4646e1['include']?_[_0x302b('0x1d')](_0x4646e1[_0x302b('0x1b')],function(_0x3aebe8){return{'model':db[_0x3aebe8[_0x302b('0x1c')]],'as':_0x3aebe8['as'],'attributes':_0x3aebe8[_0x302b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x344ba8){logger[_0x302b('0xb')](_0x302b('0x15'),_0x5517ba);logger[_0x302b('0xe')](_0x302b('0x15'),_0x5517ba,JSON[_0x302b('0x1f')](_0x344ba8));_0x353025(_0x344ba8);})[_0x302b('0x14')](function(_0x247909){logger[_0x302b('0x10')](_0x302b('0x15'),_0x247909['message'],_0x5517ba);_0x4cc15d(_0x53eafc['error'](0x1f4,_0x247909['message']));});});};exports[_0x302b('0x20')]=function(_0x174913){var _0x4ba9f2=this;return new Promise(function(_0x4b05e7,_0x18e7c0){return db['SugarcrmAccount'][_0x302b('0x21')]({'raw':_0x174913[_0x302b('0x18')]?_0x174913[_0x302b('0x18')][_0x302b('0x19')]===undefined?!![]:![]:!![],'where':_0x174913[_0x302b('0x18')]?_0x174913['options'][_0x302b('0x1a')]||null:null,'attributes':_0x174913[_0x302b('0x18')]?_0x174913[_0x302b('0x18')][_0x302b('0x1e')]||null:null,'include':_0x174913[_0x302b('0x18')]?_0x174913[_0x302b('0x18')]['include']?_['map'](_0x174913[_0x302b('0x18')]['include'],function(_0x2e4c30){return{'model':db[_0x2e4c30[_0x302b('0x1c')]],'as':_0x2e4c30['as'],'attributes':_0x2e4c30[_0x302b('0x1e')],'include':_0x2e4c30[_0x302b('0x1b')]?_[_0x302b('0x1d')](_0x2e4c30['include'],function(_0xfd8923){return{'model':db[_0xfd8923['model']],'as':_0xfd8923['as'],'attributes':_0xfd8923[_0x302b('0x1e')],'include':_0xfd8923[_0x302b('0x1b')]?_[_0x302b('0x1d')](_0xfd8923[_0x302b('0x1b')],function(_0x3f8179){return{'model':db[_0x3f8179['model']],'as':_0x3f8179['as'],'attributes':_0x3f8179[_0x302b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x302b('0x22')](function(_0x44c600){logger[_0x302b('0xb')]('ShowSugarcrmAccount',_0x174913);logger[_0x302b('0xe')](_0x302b('0x20'),_0x174913,JSON[_0x302b('0x1f')](_0x44c600));_0x4b05e7(_0x44c600);})[_0x302b('0x14')](function(_0x1ddb1){logger[_0x302b('0x10')](_0x302b('0x20'),_0x1ddb1[_0x302b('0x12')],_0x174913);_0x18e7c0(_0x4ba9f2[_0x302b('0x10')](0x1f4,_0x1ddb1[_0x302b('0x12')]));});});}; \ No newline at end of file +var _0xbc16=['include','model','map','ShowSugarcrmAccount','SugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','raw','options','attributes','limit'];(function(_0xdfd2f0,_0x4f8dbd){var _0x583e44=function(_0x2a8c27){while(--_0x2a8c27){_0xdfd2f0['push'](_0xdfd2f0['shift']());}};_0x583e44(++_0x4f8dbd);}(_0xbc16,0x89));var _0x6bc1=function(_0x3f7912,_0x26b877){_0x3f7912=_0x3f7912-0x0;var _0x2427b8=_0xbc16[_0x3f7912];return _0x2427b8;};'use strict';var _=require(_0x6bc1('0x0'));var util=require(_0x6bc1('0x1'));var moment=require('moment');var BPromise=require(_0x6bc1('0x2'));var rs=require(_0x6bc1('0x3'));var fs=require('fs');var Redis=require(_0x6bc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6bc1('0x5'))(_0x6bc1('0x6'));var config=require(_0x6bc1('0x7'));var jayson=require(_0x6bc1('0x8'));var client=jayson['client'][_0x6bc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e57c8,_0x14b24c,_0x1767e1){return new BPromise(function(_0x2a1048,_0x3a8ee5){return client[_0x6bc1('0xa')](_0x3e57c8,_0x1767e1)[_0x6bc1('0xb')](function(_0x32f6bf){logger[_0x6bc1('0xc')](_0x6bc1('0xd'),_0x14b24c,_0x6bc1('0xe'));logger[_0x6bc1('0xf')](_0x6bc1('0x10'),_0x14b24c,'request\x20sent',JSON[_0x6bc1('0x11')](_0x32f6bf));if(_0x32f6bf[_0x6bc1('0x12')]){if(_0x32f6bf[_0x6bc1('0x12')]['code']===0x1f4){logger['error'](_0x6bc1('0xd'),_0x14b24c,_0x32f6bf['error']['message']);return _0x3a8ee5(_0x32f6bf[_0x6bc1('0x12')][_0x6bc1('0x13')]);}logger[_0x6bc1('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x14b24c,_0x32f6bf[_0x6bc1('0x12')][_0x6bc1('0x13')]);return _0x2a1048(_0x32f6bf[_0x6bc1('0x12')][_0x6bc1('0x13')]);}else{logger[_0x6bc1('0xc')](_0x6bc1('0xd'),_0x14b24c,_0x6bc1('0xe'));_0x2a1048(_0x32f6bf[_0x6bc1('0x14')]['message']);}})[_0x6bc1('0x15')](function(_0x34f90e){logger[_0x6bc1('0x12')](_0x6bc1('0xd'),_0x14b24c,_0x34f90e);_0x3a8ee5(_0x34f90e);});});}exports[_0x6bc1('0x16')]=function(_0x13ab86){var _0x53cf5f=this;return new Promise(function(_0xea4a5,_0x23d183){return db['SugarcrmAccount'][_0x6bc1('0x17')]({'raw':_0x13ab86['options']?_0x13ab86['options'][_0x6bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x13ab86[_0x6bc1('0x19')]?_0x13ab86[_0x6bc1('0x19')]['where']||null:null,'attributes':_0x13ab86['options']?_0x13ab86[_0x6bc1('0x19')][_0x6bc1('0x1a')]||null:null,'limit':_0x13ab86[_0x6bc1('0x19')]?_0x13ab86['options'][_0x6bc1('0x1b')]||null:null,'include':_0x13ab86[_0x6bc1('0x19')]?_0x13ab86['options'][_0x6bc1('0x1c')]?_['map'](_0x13ab86[_0x6bc1('0x19')][_0x6bc1('0x1c')],function(_0x188e4c){return{'model':db[_0x188e4c['model']],'as':_0x188e4c['as'],'attributes':_0x188e4c[_0x6bc1('0x1a')],'include':_0x188e4c[_0x6bc1('0x1c')]?_['map'](_0x188e4c[_0x6bc1('0x1c')],function(_0x24623e){return{'model':db[_0x24623e[_0x6bc1('0x1d')]],'as':_0x24623e['as'],'attributes':_0x24623e[_0x6bc1('0x1a')],'include':_0x24623e[_0x6bc1('0x1c')]?_[_0x6bc1('0x1e')](_0x24623e[_0x6bc1('0x1c')],function(_0x4ef8da){return{'model':db[_0x4ef8da[_0x6bc1('0x1d')]],'as':_0x4ef8da['as'],'attributes':_0x4ef8da[_0x6bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6bc1('0xb')](function(_0x54cf8d){logger[_0x6bc1('0xc')](_0x6bc1('0x16'),_0x13ab86);logger[_0x6bc1('0xf')](_0x6bc1('0x16'),_0x13ab86,JSON[_0x6bc1('0x11')](_0x54cf8d));_0xea4a5(_0x54cf8d);})[_0x6bc1('0x15')](function(_0x43e502){logger['error'](_0x6bc1('0x16'),_0x43e502[_0x6bc1('0x13')],_0x13ab86);_0x23d183(_0x53cf5f['error'](0x1f4,_0x43e502['message']));});});};exports[_0x6bc1('0x1f')]=function(_0x3076c4){var _0x1ef5b3=this;return new Promise(function(_0x2124b3,_0x505fd4){return db[_0x6bc1('0x20')]['find']({'raw':_0x3076c4[_0x6bc1('0x19')]?_0x3076c4[_0x6bc1('0x19')][_0x6bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x3076c4[_0x6bc1('0x19')]?_0x3076c4[_0x6bc1('0x19')]['where']||null:null,'attributes':_0x3076c4[_0x6bc1('0x19')]?_0x3076c4[_0x6bc1('0x19')][_0x6bc1('0x1a')]||null:null,'include':_0x3076c4[_0x6bc1('0x19')]?_0x3076c4[_0x6bc1('0x19')][_0x6bc1('0x1c')]?_[_0x6bc1('0x1e')](_0x3076c4['options'][_0x6bc1('0x1c')],function(_0xb6548){return{'model':db[_0xb6548[_0x6bc1('0x1d')]],'as':_0xb6548['as'],'attributes':_0xb6548[_0x6bc1('0x1a')],'include':_0xb6548['include']?_['map'](_0xb6548[_0x6bc1('0x1c')],function(_0x235c67){return{'model':db[_0x235c67[_0x6bc1('0x1d')]],'as':_0x235c67['as'],'attributes':_0x235c67['attributes'],'include':_0x235c67[_0x6bc1('0x1c')]?_['map'](_0x235c67[_0x6bc1('0x1c')],function(_0x5707a1){return{'model':db[_0x5707a1[_0x6bc1('0x1d')]],'as':_0x5707a1['as'],'attributes':_0x5707a1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e44ba){logger[_0x6bc1('0xc')]('ShowSugarcrmAccount',_0x3076c4);logger['debug'](_0x6bc1('0x1f'),_0x3076c4,JSON[_0x6bc1('0x11')](_0x3e44ba));_0x2124b3(_0x3e44ba);})['catch'](function(_0x3c4935){logger['error'](_0x6bc1('0x1f'),_0x3c4935[_0x6bc1('0x13')],_0x3076c4);_0x505fd4(_0x1ef5b3['error'](0x1f4,_0x3c4935['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bd21826..2cb5f19 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 _0xf472=['./intSugarcrmConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x179c6a,_0x3464ff){var _0x2d73c3=function(_0x2088ad){while(--_0x2088ad){_0x179c6a['push'](_0x179c6a['shift']());}};_0x2d73c3(++_0x3464ff);}(_0xf472,0x10a));var _0x2f47=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf472[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x2f47('0x0'));var util=require(_0x2f47('0x1'));var path=require(_0x2f47('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f47('0x3'));var router=express[_0x2f47('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2f47('0x5'));var config=require(_0x2f47('0x6'));var controller=require(_0x2f47('0x7'));router[_0x2f47('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f47('0x8')]('/:id',auth[_0x2f47('0x9')](),controller[_0x2f47('0xa')]);router[_0x2f47('0x8')]('/:id/fields',auth[_0x2f47('0x9')](),controller[_0x2f47('0xb')]);router[_0x2f47('0x8')](_0x2f47('0xc'),auth['isAuthenticated'](),controller[_0x2f47('0xd')]);router[_0x2f47('0x8')](_0x2f47('0xe'),auth[_0x2f47('0x9')](),controller[_0x2f47('0xf')]);router['post']('/',auth[_0x2f47('0x9')](),controller[_0x2f47('0x10')]);router['put'](_0x2f47('0x11'),auth[_0x2f47('0x9')](),controller[_0x2f47('0x12')]);router['delete'](_0x2f47('0x11'),auth[_0x2f47('0x9')](),controller[_0x2f47('0x13')]);module[_0x2f47('0x14')]=router; \ No newline at end of file +var _0x0293=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x31b04e,_0x28b691){var _0x48c7ea=function(_0x1ce1b9){while(--_0x1ce1b9){_0x31b04e['push'](_0x31b04e['shift']());}};_0x48c7ea(++_0x28b691);}(_0x0293,0x102));var _0x3029=function(_0xcb4a85,_0x5ccc50){_0xcb4a85=_0xcb4a85-0x0;var _0x54ee99=_0x0293[_0xcb4a85];return _0x54ee99;};'use strict';var multer=require(_0x3029('0x0'));var util=require('util');var path=require(_0x3029('0x1'));var timeout=require(_0x3029('0x2'));var express=require(_0x3029('0x3'));var router=express['Router']();var auth=require(_0x3029('0x4'));var interaction=require(_0x3029('0x5'));var config=require(_0x3029('0x6'));var controller=require(_0x3029('0x7'));router[_0x3029('0x8')]('/',auth[_0x3029('0x9')](),controller[_0x3029('0xa')]);router[_0x3029('0x8')](_0x3029('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x3029('0xc'),auth[_0x3029('0x9')](),controller[_0x3029('0xd')]);router[_0x3029('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3029('0xe')]);router[_0x3029('0x8')](_0x3029('0xf'),auth[_0x3029('0x9')](),controller[_0x3029('0x10')]);router[_0x3029('0x11')]('/',auth[_0x3029('0x9')](),controller['create']);router['put'](_0x3029('0xb'),auth[_0x3029('0x9')](),controller[_0x3029('0x12')]);router[_0x3029('0x13')](_0x3029('0xb'),auth[_0x3029('0x9')](),controller[_0x3029('0x14')]);module[_0x3029('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 854e49c..efc3280 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 _0xf7d2=['exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf7d2,0x1e8));var _0x2f7d=function(_0xcfeb13,_0x58814e){_0xcfeb13=_0xcfeb13-0x0;var _0x368e52=_0xf7d2[_0xcfeb13];return _0x368e52;};'use strict';var Sequelize=require('sequelize');module[_0x2f7d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c92=['STRING','sequelize','exports'];(function(_0x35acd8,_0x2ba62d){var _0x4d7dfb=function(_0x345de6){while(--_0x345de6){_0x35acd8['push'](_0x35acd8['shift']());}};_0x4d7dfb(++_0x2ba62d);}(_0x6c92,0xe8));var _0x26c9=function(_0x206d83,_0x456ab4){_0x206d83=_0x206d83-0x0;var _0x1185e8=_0x6c92[_0x206d83];return _0x1185e8;};'use strict';var Sequelize=require(_0x26c9('0x0'));module[_0x26c9('0x1')]={'name':{'type':Sequelize[_0x26c9('0x2')]},'description':{'type':Sequelize[_0x26c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 901dff2..a5db74f 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 _0xb461=['SugarcrmConfiguration','rows','keys','include','find','create','body','params','destroy','getFields','findOne','nolimit','SugarcrmField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0xb461,0x67));var _0x1b46=function(_0x431f0f,_0x263b3c){_0x431f0f=_0x431f0f-0x0;var _0x334a40=_0xb461[_0x431f0f];return _0x334a40;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1b46('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b46('0x1'));var rp=require(_0x1b46('0x2'));var moment=require(_0x1b46('0x3'));var BPromise=require(_0x1b46('0x4'));var Mustache=require(_0x1b46('0x5'));var util=require(_0x1b46('0x6'));var path=require('path');var sox=require(_0x1b46('0x7'));var csv=require('to-csv');var ejs=require(_0x1b46('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b46('0x9'));var crypto=require(_0x1b46('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1b46('0xb'));var toCsv=require(_0x1b46('0xc'));var querystring=require(_0x1b46('0xd'));var Papa=require(_0x1b46('0xe'));var Redis=require('ioredis');var authService=require(_0x1b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1b46('0x10'));var hardwareService=require(_0x1b46('0x11'));var logger=require(_0x1b46('0x12'))(_0x1b46('0x13'));var utils=require(_0x1b46('0x14'));var config=require(_0x1b46('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1b46('0x16')][_0x1b46('0x17')]({'port':0x232a});function checkPasswordPattern(_0x9763de,_0x3f86b7,_0x423f75){if(_0x423f75){var _0x1e2dcd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e2dcd[_0x1b46('0x18')](_0x3f86b7)){return _0x9763de;}else{throw new db['Sequelize']['ValidationError'](_0x1b46('0x19'));}}else{return _0x9763de;}}function respondWithRpcPromise(_0x44735b,_0x4a7209,_0x211f83,_0x40a87f){return new BPromise(function(_0xe5d844,_0x3acefc){var _0x397e84=_0x40a87f||client;return _0x397e84[_0x1b46('0x1a')](_0x44735b,_0x211f83)['then'](function(_0x270d08){logger[_0x1b46('0x1b')](_0x1b46('0x1c'),_0x4a7209,'request\x20sent');logger[_0x1b46('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4a7209,_0x1b46('0x1e'),JSON['stringify'](_0x270d08));if(_0x270d08[_0x1b46('0x1f')]){if(_0x270d08['error']['code']===0x1f4){logger[_0x1b46('0x1f')](_0x1b46('0x1c'),_0x4a7209,_0x270d08[_0x1b46('0x1f')]['message']);return _0x3acefc(_0x270d08[_0x1b46('0x1f')][_0x1b46('0x20')]);}logger[_0x1b46('0x1f')](_0x1b46('0x1c'),_0x4a7209,_0x270d08[_0x1b46('0x1f')][_0x1b46('0x20')]);return _0xe5d844(_0x270d08[_0x1b46('0x1f')][_0x1b46('0x20')]);}else{logger[_0x1b46('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a7209,'request\x20sent');_0xe5d844(_0x270d08[_0x1b46('0x21')][_0x1b46('0x20')]);}})[_0x1b46('0x22')](function(_0x4d52a2){logger[_0x1b46('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a7209,_0x4d52a2);_0x3acefc(_0x4d52a2);});});}function respondWithStatusCode(_0xc022d5,_0x204f21){_0x204f21=_0x204f21||0xcc;return function(_0xf760b3){if(_0xf760b3){return _0xc022d5['sendStatus'](_0x204f21);}return _0xc022d5[_0x1b46('0x23')](_0x204f21)[_0x1b46('0x24')]();};}function respondWithResult(_0x8e957a,_0x30ff65){_0x30ff65=_0x30ff65||0xc8;return function(_0x4ac57c){if(_0x4ac57c){return _0x8e957a[_0x1b46('0x23')](_0x30ff65)[_0x1b46('0x25')](_0x4ac57c);}};}function respondWithFilteredResult(_0xef660,_0x42b0a1){return function(_0x516625){if(_0x516625){var _0x182f55=_0x516625[_0x1b46('0x26')],_0x151a62=_0x42b0a1[_0x1b46('0x27')],_0x3d3e6f=_0x42b0a1[_0x1b46('0x27')]+_0x42b0a1[_0x1b46('0x28')],_0x17f77a;if(_0x3d3e6f>=_0x182f55){_0x3d3e6f=_0x182f55;_0x17f77a=0xc8;}else{_0x17f77a=0xce;}_0xef660[_0x1b46('0x23')](_0x17f77a);return _0xef660[_0x1b46('0x29')]('Content-Range',_0x151a62+'-'+_0x3d3e6f+'/'+_0x182f55)[_0x1b46('0x25')](_0x516625);}return null;};}function patchUpdates(_0x24ec49){return function(_0x2c2348){try{jsonpatch[_0x1b46('0x2a')](_0x2c2348,_0x24ec49,!![]);}catch(_0x22dd80){return BPromise[_0x1b46('0x2b')](_0x22dd80);}return _0x2c2348[_0x1b46('0x2c')]();};}function saveUpdates(_0x379697,_0x193a34){return function(_0x2bd226){if(_0x2bd226){return _0x2bd226[_0x1b46('0x2d')](_0x379697)['then'](function(_0x19532a){return _0x19532a;});}return null;};}function removeEntity(_0x5b1c44,_0x5c99db){return function(_0x38aa3b){if(_0x38aa3b){return _0x38aa3b['destroy']()[_0x1b46('0x2e')](function(){_0x5b1c44[_0x1b46('0x23')](0xcc)[_0x1b46('0x24')]();});}};}function handleEntityNotFound(_0x3cc9c4,_0x116cf1){return function(_0x5d845c){if(!_0x5d845c){_0x3cc9c4[_0x1b46('0x2f')](0x194);}return _0x5d845c;};}function handleError(_0x10f5f8,_0x41a867){_0x41a867=_0x41a867||0x1f4;return function(_0x441a6c){logger[_0x1b46('0x1f')](_0x441a6c[_0x1b46('0x30')]);if(_0x441a6c[_0x1b46('0x31')]){delete _0x441a6c[_0x1b46('0x31')];}_0x10f5f8[_0x1b46('0x23')](_0x41a867)[_0x1b46('0x32')](_0x441a6c);};}exports[_0x1b46('0x33')]=function(_0x38b911,_0x2da74a){var _0x4ec1b8={},_0x4130da={},_0x89f445={'count':0x0,'rows':[]};var _0x446faa=_['map'](db['SugarcrmConfiguration'][_0x1b46('0x34')],function(_0x1ef416){return{'name':_0x1ef416[_0x1b46('0x35')],'type':_0x1ef416[_0x1b46('0x36')]['key']};});_0x4130da[_0x1b46('0x37')]=_[_0x1b46('0x38')](_0x446faa,_0x1b46('0x31'));_0x4130da[_0x1b46('0x39')]=_['keys'](_0x38b911[_0x1b46('0x39')]);_0x4130da['filters']=_[_0x1b46('0x3a')](_0x4130da[_0x1b46('0x37')],_0x4130da['query']);_0x4ec1b8[_0x1b46('0x3b')]=_[_0x1b46('0x3a')](_0x4130da[_0x1b46('0x37')],qs[_0x1b46('0x3c')](_0x38b911[_0x1b46('0x39')][_0x1b46('0x3c')]));_0x4ec1b8[_0x1b46('0x3b')]=_0x4ec1b8[_0x1b46('0x3b')][_0x1b46('0x3d')]?_0x4ec1b8[_0x1b46('0x3b')]:_0x4130da[_0x1b46('0x37')];if(!_0x38b911[_0x1b46('0x39')][_0x1b46('0x3e')]('nolimit')){_0x4ec1b8['limit']=qs['limit'](_0x38b911['query']['limit']);_0x4ec1b8[_0x1b46('0x27')]=qs[_0x1b46('0x27')](_0x38b911[_0x1b46('0x39')][_0x1b46('0x27')]);}_0x4ec1b8[_0x1b46('0x3f')]=qs[_0x1b46('0x40')](_0x38b911['query'][_0x1b46('0x40')]);_0x4ec1b8['where']=qs['filters'](_[_0x1b46('0x41')](_0x38b911[_0x1b46('0x39')],_0x4130da[_0x1b46('0x42')]),_0x446faa);if(_0x38b911['query'][_0x1b46('0x43')]){_0x4ec1b8[_0x1b46('0x44')]=_[_0x1b46('0x45')](_0x4ec1b8[_0x1b46('0x44')],{'$or':_['map'](_0x446faa,function(_0x33b73a){if(_0x33b73a[_0x1b46('0x36')]!==_0x1b46('0x46')){var _0x31c707={};_0x31c707[_0x33b73a['name']]={'$like':'%'+_0x38b911[_0x1b46('0x39')]['filter']+'%'};return _0x31c707;}})});}_0x4ec1b8=_[_0x1b46('0x45')]({},_0x4ec1b8,_0x38b911[_0x1b46('0x47')]);var _0x5b1664={'where':_0x4ec1b8[_0x1b46('0x44')]};return db['SugarcrmConfiguration'][_0x1b46('0x26')](_0x5b1664)[_0x1b46('0x2e')](function(_0x529179){_0x89f445['count']=_0x529179;if(_0x38b911[_0x1b46('0x39')][_0x1b46('0x48')]){_0x4ec1b8['include']=[{'all':!![]}];}return db[_0x1b46('0x49')]['findAll'](_0x4ec1b8);})['then'](function(_0x1ca760){_0x89f445[_0x1b46('0x4a')]=_0x1ca760;return _0x89f445;})[_0x1b46('0x2e')](respondWithFilteredResult(_0x2da74a,_0x4ec1b8))[_0x1b46('0x22')](handleError(_0x2da74a,null));};exports['show']=function(_0x3327c2,_0x17fa59){var _0x6cd01d={'raw':![],'where':{'id':_0x3327c2['params']['id']}},_0xfe71a={};_0xfe71a[_0x1b46('0x37')]=_[_0x1b46('0x4b')](db['SugarcrmConfiguration'][_0x1b46('0x34')]);_0xfe71a[_0x1b46('0x39')]=_[_0x1b46('0x4b')](_0x3327c2[_0x1b46('0x39')]);_0xfe71a[_0x1b46('0x42')]=_['intersection'](_0xfe71a[_0x1b46('0x37')],_0xfe71a[_0x1b46('0x39')]);_0x6cd01d['attributes']=_[_0x1b46('0x3a')](_0xfe71a['model'],qs['fields'](_0x3327c2[_0x1b46('0x39')][_0x1b46('0x3c')]));_0x6cd01d[_0x1b46('0x3b')]=_0x6cd01d[_0x1b46('0x3b')][_0x1b46('0x3d')]?_0x6cd01d[_0x1b46('0x3b')]:_0xfe71a[_0x1b46('0x37')];if(_0x3327c2[_0x1b46('0x39')]['includeAll']){_0x6cd01d[_0x1b46('0x4c')]=[{'all':!![]}];}_0x6cd01d=_[_0x1b46('0x45')]({},_0x6cd01d,_0x3327c2['options']);return db[_0x1b46('0x49')][_0x1b46('0x4d')](_0x6cd01d)[_0x1b46('0x2e')](handleEntityNotFound(_0x17fa59,null))[_0x1b46('0x2e')](respondWithResult(_0x17fa59,null))['catch'](handleError(_0x17fa59,null));};exports[_0x1b46('0x4e')]=function(_0x21e9de,_0x57f815){return db['SugarcrmConfiguration'][_0x1b46('0x4e')](_0x21e9de[_0x1b46('0x4f')],{})[_0x1b46('0x2e')](respondWithResult(_0x57f815,0xc9))[_0x1b46('0x22')](handleError(_0x57f815,null));};exports[_0x1b46('0x2d')]=function(_0x24653a,_0x5e97da){if(_0x24653a['body']['id']){delete _0x24653a[_0x1b46('0x4f')]['id'];}return db[_0x1b46('0x49')][_0x1b46('0x4d')]({'where':{'id':_0x24653a[_0x1b46('0x50')]['id']}})[_0x1b46('0x2e')](handleEntityNotFound(_0x5e97da,null))[_0x1b46('0x2e')](saveUpdates(_0x24653a[_0x1b46('0x4f')],null))['then'](respondWithResult(_0x5e97da,null))['catch'](handleError(_0x5e97da,null));};exports[_0x1b46('0x51')]=function(_0x5c6463,_0x4a6db0){return db[_0x1b46('0x49')][_0x1b46('0x4d')]({'where':{'id':_0x5c6463[_0x1b46('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a6db0,null))[_0x1b46('0x2e')](removeEntity(_0x4a6db0,null))[_0x1b46('0x22')](handleError(_0x4a6db0,null));};exports[_0x1b46('0x52')]=function(_0x179911,_0x3dc6ed,_0x2dfa1a){var _0x3e93ee={};var _0x3ed1d6={};var _0x449487;var _0x3b00d8;return db[_0x1b46('0x49')][_0x1b46('0x53')]({'where':{'id':_0x179911[_0x1b46('0x50')]['id']}})[_0x1b46('0x2e')](handleEntityNotFound(_0x3dc6ed,null))[_0x1b46('0x2e')](function(_0x56b74e){if(_0x56b74e){_0x449487=_0x56b74e;_0x3ed1d6[_0x1b46('0x37')]=_[_0x1b46('0x4b')](db['SugarcrmField']['rawAttributes']);_0x3ed1d6[_0x1b46('0x39')]=_['keys'](_0x179911[_0x1b46('0x39')]);_0x3ed1d6[_0x1b46('0x42')]=_['intersection'](_0x3ed1d6['model'],_0x3ed1d6['query']);_0x3e93ee[_0x1b46('0x3b')]=_[_0x1b46('0x3a')](_0x3ed1d6[_0x1b46('0x37')],qs[_0x1b46('0x3c')](_0x179911[_0x1b46('0x39')][_0x1b46('0x3c')]));_0x3e93ee[_0x1b46('0x3b')]=_0x3e93ee[_0x1b46('0x3b')][_0x1b46('0x3d')]?_0x3e93ee[_0x1b46('0x3b')]:_0x3ed1d6['model'];_0x3e93ee[_0x1b46('0x3f')]=qs[_0x1b46('0x40')](_0x179911[_0x1b46('0x39')]['sort']);_0x3e93ee[_0x1b46('0x44')]=qs[_0x1b46('0x42')](_['pick'](_0x179911[_0x1b46('0x39')],_0x3ed1d6[_0x1b46('0x42')]));if(_0x179911[_0x1b46('0x39')][_0x1b46('0x43')]){_0x3e93ee[_0x1b46('0x44')]=_[_0x1b46('0x45')](_0x3e93ee['where'],{'$or':_[_0x1b46('0x38')](_0x3e93ee[_0x1b46('0x3b')],function(_0x322fd9){var _0x161497={};_0x161497[_0x322fd9]={'$like':'%'+_0x179911['query'][_0x1b46('0x43')]+'%'};return _0x161497;})});}_0x3e93ee=_[_0x1b46('0x45')]({},_0x3e93ee,_0x179911[_0x1b46('0x47')]);return _0x449487[_0x1b46('0x52')](_0x3e93ee);}})[_0x1b46('0x2e')](function(_0x4152bb){if(_0x4152bb){_0x3b00d8=_0x4152bb[_0x1b46('0x3d')];if(!_0x179911['query'][_0x1b46('0x3e')](_0x1b46('0x54'))){_0x3e93ee[_0x1b46('0x28')]=qs['limit'](_0x179911[_0x1b46('0x39')][_0x1b46('0x28')]);_0x3e93ee[_0x1b46('0x27')]=qs[_0x1b46('0x27')](_0x179911[_0x1b46('0x39')][_0x1b46('0x27')]);}return _0x449487[_0x1b46('0x52')](_0x3e93ee);}})[_0x1b46('0x2e')](function(_0x3abdf7){if(_0x3abdf7){return _0x3abdf7?{'count':_0x3b00d8,'rows':_0x3abdf7}:null;}})[_0x1b46('0x2e')](respondWithResult(_0x3dc6ed,null))[_0x1b46('0x22')](handleError(_0x3dc6ed,null));};exports['getSubjects']=function(_0x2052ec,_0x28fabd,_0x522d9f){var _0x4888e4={};var _0x563ba4={};var _0x59bf72;var _0x5495fb;return db[_0x1b46('0x49')][_0x1b46('0x53')]({'where':{'id':_0x2052ec[_0x1b46('0x50')]['id']}})[_0x1b46('0x2e')](handleEntityNotFound(_0x28fabd,null))[_0x1b46('0x2e')](function(_0x35c8ca){if(_0x35c8ca){_0x59bf72=_0x35c8ca;_0x563ba4[_0x1b46('0x37')]=_[_0x1b46('0x4b')](db[_0x1b46('0x55')]['rawAttributes']);_0x563ba4[_0x1b46('0x39')]=_[_0x1b46('0x4b')](_0x2052ec['query']);_0x563ba4[_0x1b46('0x42')]=_[_0x1b46('0x3a')](_0x563ba4['model'],_0x563ba4['query']);_0x4888e4['attributes']=_[_0x1b46('0x3a')](_0x563ba4['model'],qs[_0x1b46('0x3c')](_0x2052ec['query'][_0x1b46('0x3c')]));_0x4888e4['attributes']=_0x4888e4[_0x1b46('0x3b')][_0x1b46('0x3d')]?_0x4888e4[_0x1b46('0x3b')]:_0x563ba4['model'];_0x4888e4[_0x1b46('0x3f')]=qs[_0x1b46('0x40')](_0x2052ec[_0x1b46('0x39')][_0x1b46('0x40')]);_0x4888e4[_0x1b46('0x44')]=qs[_0x1b46('0x42')](_[_0x1b46('0x41')](_0x2052ec[_0x1b46('0x39')],_0x563ba4[_0x1b46('0x42')]));if(_0x2052ec['query'][_0x1b46('0x43')]){_0x4888e4['where']=_[_0x1b46('0x45')](_0x4888e4['where'],{'$or':_[_0x1b46('0x38')](_0x4888e4['attributes'],function(_0x32736e){var _0x21eefd={};_0x21eefd[_0x32736e]={'$like':'%'+_0x2052ec[_0x1b46('0x39')][_0x1b46('0x43')]+'%'};return _0x21eefd;})});}_0x4888e4=_[_0x1b46('0x45')]({},_0x4888e4,_0x2052ec['options']);return _0x59bf72[_0x1b46('0x56')](_0x4888e4);}})['then'](function(_0x42c631){if(_0x42c631){_0x5495fb=_0x42c631[_0x1b46('0x3d')];if(!_0x2052ec[_0x1b46('0x39')][_0x1b46('0x3e')]('nolimit')){_0x4888e4[_0x1b46('0x28')]=qs['limit'](_0x2052ec[_0x1b46('0x39')][_0x1b46('0x28')]);_0x4888e4[_0x1b46('0x27')]=qs['offset'](_0x2052ec[_0x1b46('0x39')]['offset']);}return _0x59bf72[_0x1b46('0x56')](_0x4888e4);}})[_0x1b46('0x2e')](function(_0x226d12){if(_0x226d12){return _0x226d12?{'count':_0x5495fb,'rows':_0x226d12}:null;}})[_0x1b46('0x2e')](respondWithResult(_0x28fabd,null))[_0x1b46('0x22')](handleError(_0x28fabd,null));};exports[_0x1b46('0x57')]=function(_0x26054e,_0x13e635,_0x3492e4){var _0x516695={};var _0x49b104={};var _0x57e594;var _0x4a95df;return db[_0x1b46('0x49')][_0x1b46('0x53')]({'where':{'id':_0x26054e[_0x1b46('0x50')]['id']}})[_0x1b46('0x2e')](handleEntityNotFound(_0x13e635,null))['then'](function(_0x31a8ff){if(_0x31a8ff){_0x57e594=_0x31a8ff;_0x49b104[_0x1b46('0x37')]=_['keys'](db[_0x1b46('0x55')]['rawAttributes']);_0x49b104[_0x1b46('0x39')]=_[_0x1b46('0x4b')](_0x26054e[_0x1b46('0x39')]);_0x49b104[_0x1b46('0x42')]=_['intersection'](_0x49b104[_0x1b46('0x37')],_0x49b104['query']);_0x516695[_0x1b46('0x3b')]=_[_0x1b46('0x3a')](_0x49b104[_0x1b46('0x37')],qs[_0x1b46('0x3c')](_0x26054e[_0x1b46('0x39')][_0x1b46('0x3c')]));_0x516695[_0x1b46('0x3b')]=_0x516695['attributes']['length']?_0x516695['attributes']:_0x49b104[_0x1b46('0x37')];_0x516695[_0x1b46('0x3f')]=qs[_0x1b46('0x40')](_0x26054e[_0x1b46('0x39')]['sort']);_0x516695[_0x1b46('0x44')]=qs[_0x1b46('0x42')](_[_0x1b46('0x41')](_0x26054e[_0x1b46('0x39')],_0x49b104[_0x1b46('0x42')]));if(_0x26054e['query'][_0x1b46('0x43')]){_0x516695[_0x1b46('0x44')]=_['merge'](_0x516695[_0x1b46('0x44')],{'$or':_[_0x1b46('0x38')](_0x516695[_0x1b46('0x3b')],function(_0x423784){var _0x547dfd={};_0x547dfd[_0x423784]={'$like':'%'+_0x26054e[_0x1b46('0x39')][_0x1b46('0x43')]+'%'};return _0x547dfd;})});}_0x516695=_[_0x1b46('0x45')]({},_0x516695,_0x26054e[_0x1b46('0x47')]);return _0x57e594['getDescriptions'](_0x516695);}})[_0x1b46('0x2e')](function(_0x385bb4){if(_0x385bb4){_0x4a95df=_0x385bb4[_0x1b46('0x3d')];if(!_0x26054e[_0x1b46('0x39')]['hasOwnProperty']('nolimit')){_0x516695['limit']=qs[_0x1b46('0x28')](_0x26054e[_0x1b46('0x39')][_0x1b46('0x28')]);_0x516695[_0x1b46('0x27')]=qs[_0x1b46('0x27')](_0x26054e['query']['offset']);}return _0x57e594['getDescriptions'](_0x516695);}})['then'](function(_0x11c1ea){if(_0x11c1ea){return _0x11c1ea?{'count':_0x4a95df,'rows':_0x11c1ea}:null;}})['then'](respondWithResult(_0x13e635,null))['catch'](handleError(_0x13e635,null));}; \ No newline at end of file +var _0x0bba=['code','message','result','catch','sendStatus','status','end','count','offset','limit','json','reject','update','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','intersection','order','pick','SugarcrmField','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0bba,0xf4));var _0xa0bb=function(_0x1815b3,_0x5b6df0){_0x1815b3=_0x1815b3-0x0;var _0x6462c9=_0x0bba[_0x1815b3];return _0x6462c9;};'use strict';var pdf=require(_0xa0bb('0x0'));var emlformat=require(_0xa0bb('0x1'));var rimraf=require(_0xa0bb('0x2'));var zipdir=require(_0xa0bb('0x3'));var jsonpatch=require(_0xa0bb('0x4'));var rp=require('request-promise');var moment=require(_0xa0bb('0x5'));var BPromise=require(_0xa0bb('0x6'));var Mustache=require(_0xa0bb('0x7'));var util=require(_0xa0bb('0x8'));var path=require(_0xa0bb('0x9'));var sox=require(_0xa0bb('0xa'));var csv=require(_0xa0bb('0xb'));var ejs=require(_0xa0bb('0xc'));var fs=require('fs');var _=require(_0xa0bb('0xd'));var squel=require(_0xa0bb('0xe'));var crypto=require(_0xa0bb('0xf'));var jsforce=require(_0xa0bb('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa0bb('0x11'));var Papa=require(_0xa0bb('0x12'));var Redis=require('ioredis');var authService=require(_0xa0bb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa0bb('0x14'));var hardwareService=require(_0xa0bb('0x15'));var logger=require(_0xa0bb('0x16'))(_0xa0bb('0x17'));var utils=require(_0xa0bb('0x18'));var config=require(_0xa0bb('0x19'));var db=require(_0xa0bb('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa0bb('0x1b')][_0xa0bb('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x588749,_0x2bb471,_0xd1277e){if(_0xd1277e){var _0x470675=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x470675[_0xa0bb('0x1d')](_0x2bb471)){return _0x588749;}else{throw new db['Sequelize'][(_0xa0bb('0x1e'))](_0xa0bb('0x1f'));}}else{return _0x588749;}}function respondWithRpcPromise(_0x4b1e69,_0x479287,_0x2ee390,_0x2031eb){return new BPromise(function(_0x267f2b,_0x22ddfa){var _0x1247a6=_0x2031eb||client;return _0x1247a6[_0xa0bb('0x20')](_0x4b1e69,_0x2ee390)[_0xa0bb('0x21')](function(_0x85f96c){logger[_0xa0bb('0x22')](_0xa0bb('0x23'),_0x479287,_0xa0bb('0x24'));logger[_0xa0bb('0x25')](_0xa0bb('0x26'),_0x479287,_0xa0bb('0x24'),JSON[_0xa0bb('0x27')](_0x85f96c));if(_0x85f96c[_0xa0bb('0x28')]){if(_0x85f96c[_0xa0bb('0x28')][_0xa0bb('0x29')]===0x1f4){logger[_0xa0bb('0x28')](_0xa0bb('0x23'),_0x479287,_0x85f96c[_0xa0bb('0x28')][_0xa0bb('0x2a')]);return _0x22ddfa(_0x85f96c[_0xa0bb('0x28')]['message']);}logger[_0xa0bb('0x28')](_0xa0bb('0x23'),_0x479287,_0x85f96c[_0xa0bb('0x28')]['message']);return _0x267f2b(_0x85f96c[_0xa0bb('0x28')][_0xa0bb('0x2a')]);}else{logger['info'](_0xa0bb('0x23'),_0x479287,_0xa0bb('0x24'));_0x267f2b(_0x85f96c[_0xa0bb('0x2b')]['message']);}})[_0xa0bb('0x2c')](function(_0x569f09){logger[_0xa0bb('0x28')](_0xa0bb('0x23'),_0x479287,_0x569f09);_0x22ddfa(_0x569f09);});});}function respondWithStatusCode(_0x3ac78d,_0x590a67){_0x590a67=_0x590a67||0xcc;return function(_0x24ad56){if(_0x24ad56){return _0x3ac78d[_0xa0bb('0x2d')](_0x590a67);}return _0x3ac78d[_0xa0bb('0x2e')](_0x590a67)[_0xa0bb('0x2f')]();};}function respondWithResult(_0x59a7db,_0x28b610){_0x28b610=_0x28b610||0xc8;return function(_0x34ff4c){if(_0x34ff4c){return _0x59a7db['status'](_0x28b610)['json'](_0x34ff4c);}};}function respondWithFilteredResult(_0x2078e0,_0x5d1c36){return function(_0x53e8ed){if(_0x53e8ed){var _0x23a786=_0x53e8ed[_0xa0bb('0x30')],_0x3f1f44=_0x5d1c36[_0xa0bb('0x31')],_0x1b2fa2=_0x5d1c36[_0xa0bb('0x31')]+_0x5d1c36[_0xa0bb('0x32')],_0xc013e3;if(_0x1b2fa2>=_0x23a786){_0x1b2fa2=_0x23a786;_0xc013e3=0xc8;}else{_0xc013e3=0xce;}_0x2078e0[_0xa0bb('0x2e')](_0xc013e3);return _0x2078e0['set']('Content-Range',_0x3f1f44+'-'+_0x1b2fa2+'/'+_0x23a786)[_0xa0bb('0x33')](_0x53e8ed);}return null;};}function patchUpdates(_0x4a9750){return function(_0x56c103){try{jsonpatch['apply'](_0x56c103,_0x4a9750,!![]);}catch(_0x191ce2){return BPromise[_0xa0bb('0x34')](_0x191ce2);}return _0x56c103['save']();};}function saveUpdates(_0x4b4a8d,_0x285a4e){return function(_0x358467){if(_0x358467){return _0x358467[_0xa0bb('0x35')](_0x4b4a8d)[_0xa0bb('0x21')](function(_0x3c3e80){return _0x3c3e80;});}return null;};}function removeEntity(_0x21de2f,_0x28c384){return function(_0x1c0c88){if(_0x1c0c88){return _0x1c0c88['destroy']()[_0xa0bb('0x21')](function(){_0x21de2f[_0xa0bb('0x2e')](0xcc)[_0xa0bb('0x2f')]();});}};}function handleEntityNotFound(_0x4f3d6e,_0x5cac5d){return function(_0x12efa1){if(!_0x12efa1){_0x4f3d6e['sendStatus'](0x194);}return _0x12efa1;};}function handleError(_0x3dffbe,_0x369391){_0x369391=_0x369391||0x1f4;return function(_0x2c2818){logger[_0xa0bb('0x28')](_0x2c2818[_0xa0bb('0x36')]);if(_0x2c2818[_0xa0bb('0x37')]){delete _0x2c2818[_0xa0bb('0x37')];}_0x3dffbe[_0xa0bb('0x2e')](_0x369391)[_0xa0bb('0x38')](_0x2c2818);};}exports['index']=function(_0x432add,_0x406d50){var _0x3a3070={},_0x296fcb={},_0x16eae1={'count':0x0,'rows':[]};var _0x155488=_[_0xa0bb('0x39')](db[_0xa0bb('0x3a')][_0xa0bb('0x3b')],function(_0x18b994){return{'name':_0x18b994[_0xa0bb('0x3c')],'type':_0x18b994[_0xa0bb('0x3d')][_0xa0bb('0x3e')]};});_0x296fcb[_0xa0bb('0x3f')]=_[_0xa0bb('0x39')](_0x155488,_0xa0bb('0x37'));_0x296fcb[_0xa0bb('0x40')]=_[_0xa0bb('0x41')](_0x432add[_0xa0bb('0x40')]);_0x296fcb['filters']=_['intersection'](_0x296fcb[_0xa0bb('0x3f')],_0x296fcb[_0xa0bb('0x40')]);_0x3a3070[_0xa0bb('0x42')]=_['intersection'](_0x296fcb[_0xa0bb('0x3f')],qs[_0xa0bb('0x43')](_0x432add[_0xa0bb('0x40')][_0xa0bb('0x43')]));_0x3a3070[_0xa0bb('0x42')]=_0x3a3070[_0xa0bb('0x42')][_0xa0bb('0x44')]?_0x3a3070[_0xa0bb('0x42')]:_0x296fcb[_0xa0bb('0x3f')];if(!_0x432add[_0xa0bb('0x40')][_0xa0bb('0x45')](_0xa0bb('0x46'))){_0x3a3070[_0xa0bb('0x32')]=qs[_0xa0bb('0x32')](_0x432add[_0xa0bb('0x40')][_0xa0bb('0x32')]);_0x3a3070[_0xa0bb('0x31')]=qs[_0xa0bb('0x31')](_0x432add[_0xa0bb('0x40')][_0xa0bb('0x31')]);}_0x3a3070['order']=qs[_0xa0bb('0x47')](_0x432add[_0xa0bb('0x40')]['sort']);_0x3a3070['where']=qs[_0xa0bb('0x48')](_['pick'](_0x432add[_0xa0bb('0x40')],_0x296fcb[_0xa0bb('0x48')]),_0x155488);if(_0x432add[_0xa0bb('0x40')][_0xa0bb('0x49')]){_0x3a3070[_0xa0bb('0x4a')]=_[_0xa0bb('0x4b')](_0x3a3070['where'],{'$or':_[_0xa0bb('0x39')](_0x155488,function(_0xc9cc3f){if(_0xc9cc3f[_0xa0bb('0x3d')]!=='VIRTUAL'){var _0x11754e={};_0x11754e[_0xc9cc3f[_0xa0bb('0x37')]]={'$like':'%'+_0x432add[_0xa0bb('0x40')][_0xa0bb('0x49')]+'%'};return _0x11754e;}})});}_0x3a3070=_[_0xa0bb('0x4b')]({},_0x3a3070,_0x432add[_0xa0bb('0x4c')]);var _0x3e5f24={'where':_0x3a3070[_0xa0bb('0x4a')]};return db[_0xa0bb('0x3a')][_0xa0bb('0x30')](_0x3e5f24)[_0xa0bb('0x21')](function(_0x23ce4a){_0x16eae1[_0xa0bb('0x30')]=_0x23ce4a;if(_0x432add[_0xa0bb('0x40')][_0xa0bb('0x4d')]){_0x3a3070[_0xa0bb('0x4e')]=[{'all':!![]}];}return db[_0xa0bb('0x3a')][_0xa0bb('0x4f')](_0x3a3070);})[_0xa0bb('0x21')](function(_0x2869ef){_0x16eae1[_0xa0bb('0x50')]=_0x2869ef;return _0x16eae1;})[_0xa0bb('0x21')](respondWithFilteredResult(_0x406d50,_0x3a3070))[_0xa0bb('0x2c')](handleError(_0x406d50,null));};exports[_0xa0bb('0x51')]=function(_0x5397a2,_0x1c63c1){var _0x121688={'raw':![],'where':{'id':_0x5397a2[_0xa0bb('0x52')]['id']}},_0x6c2f52={};_0x6c2f52[_0xa0bb('0x3f')]=_[_0xa0bb('0x41')](db[_0xa0bb('0x3a')][_0xa0bb('0x3b')]);_0x6c2f52[_0xa0bb('0x40')]=_[_0xa0bb('0x41')](_0x5397a2[_0xa0bb('0x40')]);_0x6c2f52[_0xa0bb('0x48')]=_['intersection'](_0x6c2f52[_0xa0bb('0x3f')],_0x6c2f52['query']);_0x121688['attributes']=_['intersection'](_0x6c2f52[_0xa0bb('0x3f')],qs[_0xa0bb('0x43')](_0x5397a2[_0xa0bb('0x40')][_0xa0bb('0x43')]));_0x121688[_0xa0bb('0x42')]=_0x121688[_0xa0bb('0x42')][_0xa0bb('0x44')]?_0x121688[_0xa0bb('0x42')]:_0x6c2f52[_0xa0bb('0x3f')];if(_0x5397a2[_0xa0bb('0x40')][_0xa0bb('0x4d')]){_0x121688[_0xa0bb('0x4e')]=[{'all':!![]}];}_0x121688=_[_0xa0bb('0x4b')]({},_0x121688,_0x5397a2['options']);return db[_0xa0bb('0x3a')][_0xa0bb('0x53')](_0x121688)['then'](handleEntityNotFound(_0x1c63c1,null))[_0xa0bb('0x21')](respondWithResult(_0x1c63c1,null))[_0xa0bb('0x2c')](handleError(_0x1c63c1,null));};exports[_0xa0bb('0x54')]=function(_0x14065b,_0xc390b2){return db[_0xa0bb('0x3a')][_0xa0bb('0x54')](_0x14065b['body'],{})[_0xa0bb('0x21')](respondWithResult(_0xc390b2,0xc9))[_0xa0bb('0x2c')](handleError(_0xc390b2,null));};exports[_0xa0bb('0x35')]=function(_0x1dc546,_0x36bd6d){if(_0x1dc546['body']['id']){delete _0x1dc546[_0xa0bb('0x55')]['id'];}return db[_0xa0bb('0x3a')][_0xa0bb('0x53')]({'where':{'id':_0x1dc546[_0xa0bb('0x52')]['id']}})[_0xa0bb('0x21')](handleEntityNotFound(_0x36bd6d,null))[_0xa0bb('0x21')](saveUpdates(_0x1dc546[_0xa0bb('0x55')],null))[_0xa0bb('0x21')](respondWithResult(_0x36bd6d,null))[_0xa0bb('0x2c')](handleError(_0x36bd6d,null));};exports[_0xa0bb('0x56')]=function(_0x53517c,_0xd84779){return db['SugarcrmConfiguration'][_0xa0bb('0x53')]({'where':{'id':_0x53517c[_0xa0bb('0x52')]['id']}})[_0xa0bb('0x21')](handleEntityNotFound(_0xd84779,null))[_0xa0bb('0x21')](removeEntity(_0xd84779,null))[_0xa0bb('0x2c')](handleError(_0xd84779,null));};exports[_0xa0bb('0x57')]=function(_0x4113ab,_0x1ba89d,_0x4d5820){var _0x5b2c4b={};var _0x5e136e={};var _0x2d70ae;var _0x1d1625;return db[_0xa0bb('0x3a')]['findOne']({'where':{'id':_0x4113ab[_0xa0bb('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ba89d,null))['then'](function(_0x19118a){if(_0x19118a){_0x2d70ae=_0x19118a;_0x5e136e[_0xa0bb('0x3f')]=_['keys'](db['SugarcrmField'][_0xa0bb('0x3b')]);_0x5e136e[_0xa0bb('0x40')]=_[_0xa0bb('0x41')](_0x4113ab['query']);_0x5e136e[_0xa0bb('0x48')]=_[_0xa0bb('0x58')](_0x5e136e[_0xa0bb('0x3f')],_0x5e136e[_0xa0bb('0x40')]);_0x5b2c4b[_0xa0bb('0x42')]=_[_0xa0bb('0x58')](_0x5e136e[_0xa0bb('0x3f')],qs[_0xa0bb('0x43')](_0x4113ab['query'][_0xa0bb('0x43')]));_0x5b2c4b['attributes']=_0x5b2c4b[_0xa0bb('0x42')]['length']?_0x5b2c4b[_0xa0bb('0x42')]:_0x5e136e[_0xa0bb('0x3f')];_0x5b2c4b[_0xa0bb('0x59')]=qs[_0xa0bb('0x47')](_0x4113ab[_0xa0bb('0x40')][_0xa0bb('0x47')]);_0x5b2c4b[_0xa0bb('0x4a')]=qs[_0xa0bb('0x48')](_[_0xa0bb('0x5a')](_0x4113ab[_0xa0bb('0x40')],_0x5e136e[_0xa0bb('0x48')]));if(_0x4113ab['query']['filter']){_0x5b2c4b[_0xa0bb('0x4a')]=_[_0xa0bb('0x4b')](_0x5b2c4b[_0xa0bb('0x4a')],{'$or':_['map'](_0x5b2c4b[_0xa0bb('0x42')],function(_0x122326){var _0x5c42f1={};_0x5c42f1[_0x122326]={'$like':'%'+_0x4113ab['query'][_0xa0bb('0x49')]+'%'};return _0x5c42f1;})});}_0x5b2c4b=_[_0xa0bb('0x4b')]({},_0x5b2c4b,_0x4113ab['options']);return _0x2d70ae[_0xa0bb('0x57')](_0x5b2c4b);}})[_0xa0bb('0x21')](function(_0x9481e4){if(_0x9481e4){_0x1d1625=_0x9481e4[_0xa0bb('0x44')];if(!_0x4113ab[_0xa0bb('0x40')]['hasOwnProperty'](_0xa0bb('0x46'))){_0x5b2c4b[_0xa0bb('0x32')]=qs[_0xa0bb('0x32')](_0x4113ab['query'][_0xa0bb('0x32')]);_0x5b2c4b[_0xa0bb('0x31')]=qs[_0xa0bb('0x31')](_0x4113ab['query'][_0xa0bb('0x31')]);}return _0x2d70ae[_0xa0bb('0x57')](_0x5b2c4b);}})['then'](function(_0x138382){if(_0x138382){return _0x138382?{'count':_0x1d1625,'rows':_0x138382}:null;}})[_0xa0bb('0x21')](respondWithResult(_0x1ba89d,null))['catch'](handleError(_0x1ba89d,null));};exports['getSubjects']=function(_0x32064b,_0x59ce7b,_0x655e89){var _0x7ab2b8={};var _0x39cdfa={};var _0xdf3ba5;var _0x449cfa;return db[_0xa0bb('0x3a')]['findOne']({'where':{'id':_0x32064b[_0xa0bb('0x52')]['id']}})[_0xa0bb('0x21')](handleEntityNotFound(_0x59ce7b,null))[_0xa0bb('0x21')](function(_0x23c1ad){if(_0x23c1ad){_0xdf3ba5=_0x23c1ad;_0x39cdfa[_0xa0bb('0x3f')]=_[_0xa0bb('0x41')](db[_0xa0bb('0x5b')][_0xa0bb('0x3b')]);_0x39cdfa[_0xa0bb('0x40')]=_[_0xa0bb('0x41')](_0x32064b[_0xa0bb('0x40')]);_0x39cdfa['filters']=_['intersection'](_0x39cdfa[_0xa0bb('0x3f')],_0x39cdfa[_0xa0bb('0x40')]);_0x7ab2b8[_0xa0bb('0x42')]=_[_0xa0bb('0x58')](_0x39cdfa['model'],qs[_0xa0bb('0x43')](_0x32064b[_0xa0bb('0x40')][_0xa0bb('0x43')]));_0x7ab2b8['attributes']=_0x7ab2b8['attributes'][_0xa0bb('0x44')]?_0x7ab2b8['attributes']:_0x39cdfa['model'];_0x7ab2b8[_0xa0bb('0x59')]=qs[_0xa0bb('0x47')](_0x32064b[_0xa0bb('0x40')]['sort']);_0x7ab2b8[_0xa0bb('0x4a')]=qs['filters'](_[_0xa0bb('0x5a')](_0x32064b[_0xa0bb('0x40')],_0x39cdfa[_0xa0bb('0x48')]));if(_0x32064b[_0xa0bb('0x40')][_0xa0bb('0x49')]){_0x7ab2b8[_0xa0bb('0x4a')]=_[_0xa0bb('0x4b')](_0x7ab2b8['where'],{'$or':_[_0xa0bb('0x39')](_0x7ab2b8[_0xa0bb('0x42')],function(_0x120c18){var _0x580715={};_0x580715[_0x120c18]={'$like':'%'+_0x32064b[_0xa0bb('0x40')][_0xa0bb('0x49')]+'%'};return _0x580715;})});}_0x7ab2b8=_[_0xa0bb('0x4b')]({},_0x7ab2b8,_0x32064b['options']);return _0xdf3ba5[_0xa0bb('0x5c')](_0x7ab2b8);}})[_0xa0bb('0x21')](function(_0x137172){if(_0x137172){_0x449cfa=_0x137172[_0xa0bb('0x44')];if(!_0x32064b[_0xa0bb('0x40')]['hasOwnProperty'](_0xa0bb('0x46'))){_0x7ab2b8[_0xa0bb('0x32')]=qs['limit'](_0x32064b['query'][_0xa0bb('0x32')]);_0x7ab2b8[_0xa0bb('0x31')]=qs[_0xa0bb('0x31')](_0x32064b[_0xa0bb('0x40')]['offset']);}return _0xdf3ba5[_0xa0bb('0x5c')](_0x7ab2b8);}})[_0xa0bb('0x21')](function(_0x136353){if(_0x136353){return _0x136353?{'count':_0x449cfa,'rows':_0x136353}:null;}})[_0xa0bb('0x21')](respondWithResult(_0x59ce7b,null))[_0xa0bb('0x2c')](handleError(_0x59ce7b,null));};exports['getDescriptions']=function(_0x3999d3,_0x33260a,_0xc7dcbe){var _0x4f5fa8={};var _0x3a834f={};var _0x3ca871;var _0x2d9619;return db[_0xa0bb('0x3a')][_0xa0bb('0x5d')]({'where':{'id':_0x3999d3[_0xa0bb('0x52')]['id']}})['then'](handleEntityNotFound(_0x33260a,null))[_0xa0bb('0x21')](function(_0x427470){if(_0x427470){_0x3ca871=_0x427470;_0x3a834f[_0xa0bb('0x3f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x3a834f['query']=_[_0xa0bb('0x41')](_0x3999d3[_0xa0bb('0x40')]);_0x3a834f[_0xa0bb('0x48')]=_[_0xa0bb('0x58')](_0x3a834f[_0xa0bb('0x3f')],_0x3a834f[_0xa0bb('0x40')]);_0x4f5fa8['attributes']=_[_0xa0bb('0x58')](_0x3a834f[_0xa0bb('0x3f')],qs[_0xa0bb('0x43')](_0x3999d3['query'][_0xa0bb('0x43')]));_0x4f5fa8['attributes']=_0x4f5fa8[_0xa0bb('0x42')][_0xa0bb('0x44')]?_0x4f5fa8['attributes']:_0x3a834f[_0xa0bb('0x3f')];_0x4f5fa8['order']=qs[_0xa0bb('0x47')](_0x3999d3[_0xa0bb('0x40')][_0xa0bb('0x47')]);_0x4f5fa8[_0xa0bb('0x4a')]=qs[_0xa0bb('0x48')](_[_0xa0bb('0x5a')](_0x3999d3['query'],_0x3a834f[_0xa0bb('0x48')]));if(_0x3999d3[_0xa0bb('0x40')][_0xa0bb('0x49')]){_0x4f5fa8[_0xa0bb('0x4a')]=_[_0xa0bb('0x4b')](_0x4f5fa8[_0xa0bb('0x4a')],{'$or':_[_0xa0bb('0x39')](_0x4f5fa8['attributes'],function(_0x29a217){var _0x7669dc={};_0x7669dc[_0x29a217]={'$like':'%'+_0x3999d3[_0xa0bb('0x40')][_0xa0bb('0x49')]+'%'};return _0x7669dc;})});}_0x4f5fa8=_['merge']({},_0x4f5fa8,_0x3999d3[_0xa0bb('0x4c')]);return _0x3ca871[_0xa0bb('0x5e')](_0x4f5fa8);}})['then'](function(_0x6c7502){if(_0x6c7502){_0x2d9619=_0x6c7502[_0xa0bb('0x44')];if(!_0x3999d3[_0xa0bb('0x40')]['hasOwnProperty'](_0xa0bb('0x46'))){_0x4f5fa8[_0xa0bb('0x32')]=qs[_0xa0bb('0x32')](_0x3999d3[_0xa0bb('0x40')][_0xa0bb('0x32')]);_0x4f5fa8[_0xa0bb('0x31')]=qs['offset'](_0x3999d3[_0xa0bb('0x40')]['offset']);}return _0x3ca871[_0xa0bb('0x5e')](_0x4f5fa8);}})[_0xa0bb('0x21')](function(_0x24bbd4){if(_0x24bbd4){return _0x24bbd4?{'count':_0x2d9619,'rows':_0x24bbd4}:null;}})[_0xa0bb('0x21')](respondWithResult(_0x33260a,null))[_0xa0bb('0x2c')](handleError(_0x33260a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ee0ebaf..db7c5e9 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 _0xdb9c=['path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5b2724,_0x100e23){var _0x20e1f6=function(_0x3f6b06){while(--_0x3f6b06){_0x5b2724['push'](_0x5b2724['shift']());}};_0x20e1f6(++_0x100e23);}(_0xdb9c,0x8a));var _0xcdb9=function(_0x1da63f,_0x311375){_0x1da63f=_0x1da63f-0x0;var _0x411519=_0xdb9c[_0x1da63f];return _0x411519;};'use strict';var _=require(_0xcdb9('0x0'));var util=require(_0xcdb9('0x1'));var logger=require(_0xcdb9('0x2'))('api');var moment=require(_0xcdb9('0x3'));var BPromise=require(_0xcdb9('0x4'));var rp=require(_0xcdb9('0x5'));var fs=require('fs');var path=require(_0xcdb9('0x6'));var rimraf=require(_0xcdb9('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdb9('0x8'));module[_0xcdb9('0x9')]=function(_0x4006c9,_0x810e23){return _0x4006c9[_0xcdb9('0xa')](_0xcdb9('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06cf=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b88e0,_0x157bfe){var _0x351932=function(_0x3960ac){while(--_0x3960ac){_0x3b88e0['push'](_0x3b88e0['shift']());}};_0x351932(++_0x157bfe);}(_0x06cf,0x12b));var _0xf06c=function(_0x134992,_0x1a2f48){_0x134992=_0x134992-0x0;var _0x59de38=_0x06cf[_0x134992];return _0x59de38;};'use strict';var _=require(_0xf06c('0x0'));var util=require(_0xf06c('0x1'));var logger=require('../../config/logger')(_0xf06c('0x2'));var moment=require(_0xf06c('0x3'));var BPromise=require(_0xf06c('0x4'));var rp=require(_0xf06c('0x5'));var fs=require('fs');var path=require(_0xf06c('0x6'));var rimraf=require(_0xf06c('0x7'));var config=require(_0xf06c('0x8'));var attributes=require(_0xf06c('0x9'));module[_0xf06c('0xa')]=function(_0x5d3efe,_0x1d2383){return _0x5d3efe[_0xf06c('0xb')](_0xf06c('0xc'),attributes,{'tableName':_0xf06c('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 924180b..0a64520 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 _0xb053=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb053,0x1b2));var _0x3b05=function(_0x4e303d,_0x193932){_0x4e303d=_0x4e303d-0x0;var _0x44de62=_0xb053[_0x4e303d];return _0x44de62;};'use strict';var _=require(_0x3b05('0x0'));var util=require(_0x3b05('0x1'));var moment=require(_0x3b05('0x2'));var BPromise=require(_0x3b05('0x3'));var rs=require(_0x3b05('0x4'));var fs=require('fs');var Redis=require(_0x3b05('0x5'));var db=require(_0x3b05('0x6'))['db'];var utils=require(_0x3b05('0x7'));var logger=require(_0x3b05('0x8'))(_0x3b05('0x9'));var config=require(_0x3b05('0xa'));var jayson=require(_0x3b05('0xb'));var client=jayson[_0x3b05('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b56e7,_0x399a86,_0x3eb924){return new BPromise(function(_0x37971b,_0x5a4485){return client['request'](_0x3b56e7,_0x3eb924)[_0x3b05('0xd')](function(_0x5c4b56){logger[_0x3b05('0xe')](_0x3b05('0xf'),_0x399a86,'request\x20sent');logger[_0x3b05('0x10')](_0x3b05('0x11'),_0x399a86,_0x3b05('0x12'),JSON['stringify'](_0x5c4b56));if(_0x5c4b56[_0x3b05('0x13')]){if(_0x5c4b56[_0x3b05('0x13')]['code']===0x1f4){logger[_0x3b05('0x13')](_0x3b05('0xf'),_0x399a86,_0x5c4b56['error'][_0x3b05('0x14')]);return _0x5a4485(_0x5c4b56['error'][_0x3b05('0x14')]);}logger[_0x3b05('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x399a86,_0x5c4b56[_0x3b05('0x13')]['message']);return _0x37971b(_0x5c4b56[_0x3b05('0x13')][_0x3b05('0x14')]);}else{logger[_0x3b05('0xe')](_0x3b05('0xf'),_0x399a86,'request\x20sent');_0x37971b(_0x5c4b56[_0x3b05('0x15')][_0x3b05('0x14')]);}})['catch'](function(_0x51ac06){logger[_0x3b05('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x399a86,_0x51ac06);_0x5a4485(_0x51ac06);});});} \ No newline at end of file +var _0x6e53=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x6e53,0xaa));var _0x36e5=function(_0x290844,_0x366077){_0x290844=_0x290844-0x0;var _0x546847=_0x6e53[_0x290844];return _0x546847;};'use strict';var _=require(_0x36e5('0x0'));var util=require(_0x36e5('0x1'));var moment=require(_0x36e5('0x2'));var BPromise=require(_0x36e5('0x3'));var rs=require(_0x36e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36e5('0x5'))['db'];var utils=require(_0x36e5('0x6'));var logger=require(_0x36e5('0x7'))(_0x36e5('0x8'));var config=require(_0x36e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x36e5('0xa')][_0x36e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e8942,_0x15499d,_0x479720){return new BPromise(function(_0x22962a,_0x44af6b){return client['request'](_0x1e8942,_0x479720)['then'](function(_0x406213){logger[_0x36e5('0xc')](_0x36e5('0xd'),_0x15499d,'request\x20sent');logger['debug'](_0x36e5('0xe'),_0x15499d,_0x36e5('0xf'),JSON[_0x36e5('0x10')](_0x406213));if(_0x406213[_0x36e5('0x11')]){if(_0x406213[_0x36e5('0x11')][_0x36e5('0x12')]===0x1f4){logger[_0x36e5('0x11')](_0x36e5('0xd'),_0x15499d,_0x406213['error'][_0x36e5('0x13')]);return _0x44af6b(_0x406213['error']['message']);}logger[_0x36e5('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x15499d,_0x406213[_0x36e5('0x11')][_0x36e5('0x13')]);return _0x22962a(_0x406213[_0x36e5('0x11')][_0x36e5('0x13')]);}else{logger[_0x36e5('0xc')](_0x36e5('0xd'),_0x15499d,_0x36e5('0xf'));_0x22962a(_0x406213['result'][_0x36e5('0x13')]);}})[_0x36e5('0x14')](function(_0x3ff5af){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x15499d,_0x3ff5af);_0x44af6b(_0x3ff5af);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f7cbbfa..4fcff97 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 _0xe9bb=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x4bc88a,_0x5f1427){var _0x5429c0=function(_0x36116f){while(--_0x36116f){_0x4bc88a['push'](_0x4bc88a['shift']());}};_0x5429c0(++_0x5f1427);}(_0xe9bb,0x1ed));var _0xbe9b=function(_0x289fbf,_0x3ce4fa){_0x289fbf=_0x289fbf-0x0;var _0x7cb48e=_0xe9bb[_0x289fbf];return _0x7cb48e;};'use strict';var multer=require(_0xbe9b('0x0'));var util=require('util');var path=require(_0xbe9b('0x1'));var timeout=require(_0xbe9b('0x2'));var express=require(_0xbe9b('0x3'));var router=express[_0xbe9b('0x4')]();var auth=require(_0xbe9b('0x5'));var interaction=require(_0xbe9b('0x6'));var config=require(_0xbe9b('0x7'));var controller=require(_0xbe9b('0x8'));router['get']('/',auth[_0xbe9b('0x9')](),controller[_0xbe9b('0xa')]);router[_0xbe9b('0xb')]('/:id',auth[_0xbe9b('0x9')](),controller['show']);router[_0xbe9b('0xc')]('/',auth[_0xbe9b('0x9')](),controller[_0xbe9b('0xd')]);router['put'](_0xbe9b('0xe'),auth[_0xbe9b('0x9')](),controller[_0xbe9b('0xf')]);router[_0xbe9b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbe9b('0x11')]);module[_0xbe9b('0x12')]=router; \ No newline at end of file +var _0x07f1=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x3b56a6,_0x35bb1b){var _0x32a136=function(_0x54ffad){while(--_0x54ffad){_0x3b56a6['push'](_0x3b56a6['shift']());}};_0x32a136(++_0x35bb1b);}(_0x07f1,0x116));var _0x107f=function(_0x1195da,_0x4bcda1){_0x1195da=_0x1195da-0x0;var _0x48ca28=_0x07f1[_0x1195da];return _0x48ca28;};'use strict';var multer=require(_0x107f('0x0'));var util=require(_0x107f('0x1'));var path=require(_0x107f('0x2'));var timeout=require(_0x107f('0x3'));var express=require('express');var router=express[_0x107f('0x4')]();var auth=require(_0x107f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x107f('0x6'));var controller=require(_0x107f('0x7'));router[_0x107f('0x8')]('/',auth[_0x107f('0x9')](),controller[_0x107f('0xa')]);router[_0x107f('0x8')](_0x107f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x107f('0xc')]('/',auth[_0x107f('0x9')](),controller['create']);router['put'](_0x107f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x107f('0xd')](_0x107f('0xb'),auth[_0x107f('0x9')](),controller['destroy']);module[_0x107f('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 211e10b..f01e5e9 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 _0xe647=['variable','customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x2850ca,_0x37514c){var _0x1a7db9=function(_0x9982d8){while(--_0x9982d8){_0x2850ca['push'](_0x2850ca['shift']());}};_0x1a7db9(++_0x37514c);}(_0xe647,0x16d));var _0x7e64=function(_0x538d73,_0x189879){_0x538d73=_0x538d73-0x0;var _0x1c28c3=_0xe647[_0x538d73];return _0x1c28c3;};'use strict';var Sequelize=require(_0x7e64('0x0'));module[_0x7e64('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7e64('0x2'),_0x7e64('0x3'),_0x7e64('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e64('0x5')]},'key':{'type':Sequelize[_0x7e64('0x5')]},'keyType':{'type':Sequelize[_0x7e64('0x6')](_0x7e64('0x2'),_0x7e64('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7e64('0x5')]},'idField':{'type':Sequelize[_0x7e64('0x5')]},'nameField':{'type':Sequelize[_0x7e64('0x5')]},'customField':{'type':Sequelize[_0x7e64('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e64('0x5')]}}; \ No newline at end of file +var _0x6c21=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x1f6d2d,_0x2f8da8){var _0x132ad2=function(_0x1e55f1){while(--_0x1e55f1){_0x1f6d2d['push'](_0x1f6d2d['shift']());}};_0x132ad2(++_0x2f8da8);}(_0x6c21,0x1b2));var _0x16c2=function(_0x26266e,_0x1f5d0c){_0x26266e=_0x26266e-0x0;var _0xe064c8=_0x6c21[_0x26266e];return _0xe064c8;};'use strict';var Sequelize=require(_0x16c2('0x0'));module[_0x16c2('0x1')]={'type':{'type':Sequelize[_0x16c2('0x2')](_0x16c2('0x3'),'variable',_0x16c2('0x4'),_0x16c2('0x5')),'defaultValue':_0x16c2('0x3')},'content':{'type':Sequelize[_0x16c2('0x6')]},'key':{'type':Sequelize[_0x16c2('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x16c2('0x3'),_0x16c2('0x7'),_0x16c2('0x4'))},'keyContent':{'type':Sequelize[_0x16c2('0x6')]},'idField':{'type':Sequelize[_0x16c2('0x6')]},'nameField':{'type':Sequelize[_0x16c2('0x6')]},'customField':{'type':Sequelize[_0x16c2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16c2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index fe16a56..2fef97d 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 _0x3f8c=['offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','SugarcrmField','includeAll','rows','catch','show','params','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count'];(function(_0xd8607d,_0x9ce730){var _0x2c4a9d=function(_0x359033){while(--_0x359033){_0xd8607d['push'](_0xd8607d['shift']());}};_0x2c4a9d(++_0x9ce730);}(_0x3f8c,0x1b0));var _0xc3f8=function(_0x17428b,_0x4e719c){_0x17428b=_0x17428b-0x0;var _0x484751=_0x3f8c[_0x17428b];return _0x484751;};'use strict';var pdf=require(_0xc3f8('0x0'));var emlformat=require(_0xc3f8('0x1'));var rimraf=require(_0xc3f8('0x2'));var zipdir=require(_0xc3f8('0x3'));var jsonpatch=require(_0xc3f8('0x4'));var rp=require(_0xc3f8('0x5'));var moment=require('moment');var BPromise=require(_0xc3f8('0x6'));var Mustache=require('mustache');var util=require(_0xc3f8('0x7'));var path=require(_0xc3f8('0x8'));var sox=require(_0xc3f8('0x9'));var csv=require(_0xc3f8('0xa'));var ejs=require(_0xc3f8('0xb'));var fs=require('fs');var _=require(_0xc3f8('0xc'));var squel=require(_0xc3f8('0xd'));var crypto=require(_0xc3f8('0xe'));var jsforce=require(_0xc3f8('0xf'));var deskjs=require(_0xc3f8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc3f8('0x11'));var Papa=require(_0xc3f8('0x12'));var Redis=require('ioredis');var authService=require(_0xc3f8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc3f8('0x14'));var hardwareService=require(_0xc3f8('0x15'));var logger=require(_0xc3f8('0x16'))(_0xc3f8('0x17'));var utils=require(_0xc3f8('0x18'));var config=require('../../config/environment');var db=require(_0xc3f8('0x19'))['db'];function respondWithStatusCode(_0x55177c,_0x478d95){_0x478d95=_0x478d95||0xcc;return function(_0x1cbff2){if(_0x1cbff2){return _0x55177c[_0xc3f8('0x1a')](_0x478d95);}return _0x55177c[_0xc3f8('0x1b')](_0x478d95)[_0xc3f8('0x1c')]();};}function respondWithResult(_0x50138d,_0x538f79){_0x538f79=_0x538f79||0xc8;return function(_0x3518e1){if(_0x3518e1){return _0x50138d[_0xc3f8('0x1b')](_0x538f79)['json'](_0x3518e1);}};}function respondWithFilteredResult(_0x428f8f,_0x597369){return function(_0x1dba30){if(_0x1dba30){var _0x18fbed=_0x1dba30[_0xc3f8('0x1d')],_0xa66495=_0x597369[_0xc3f8('0x1e')],_0x54b2a8=_0x597369[_0xc3f8('0x1e')]+_0x597369['limit'],_0x110589;if(_0x54b2a8>=_0x18fbed){_0x54b2a8=_0x18fbed;_0x110589=0xc8;}else{_0x110589=0xce;}_0x428f8f[_0xc3f8('0x1b')](_0x110589);return _0x428f8f[_0xc3f8('0x1f')](_0xc3f8('0x20'),_0xa66495+'-'+_0x54b2a8+'/'+_0x18fbed)[_0xc3f8('0x21')](_0x1dba30);}return null;};}function patchUpdates(_0x1e7965){return function(_0x3be3b0){try{jsonpatch[_0xc3f8('0x22')](_0x3be3b0,_0x1e7965,!![]);}catch(_0xffbadb){return BPromise[_0xc3f8('0x23')](_0xffbadb);}return _0x3be3b0[_0xc3f8('0x24')]();};}function saveUpdates(_0x26d15f,_0xf3928f){return function(_0x4b2326){if(_0x4b2326){return _0x4b2326[_0xc3f8('0x25')](_0x26d15f)[_0xc3f8('0x26')](function(_0x4d24e9){return _0x4d24e9;});}return null;};}function removeEntity(_0x57e3b1,_0x3ffa3a){return function(_0xf9efa9){if(_0xf9efa9){return _0xf9efa9[_0xc3f8('0x27')]()[_0xc3f8('0x26')](function(){_0x57e3b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f09e,_0xfa3097){return function(_0x1162ad){if(!_0x1162ad){_0x51f09e[_0xc3f8('0x1a')](0x194);}return _0x1162ad;};}function handleError(_0x5e32c2,_0x19c67c){_0x19c67c=_0x19c67c||0x1f4;return function(_0x46141e){logger[_0xc3f8('0x28')](_0x46141e['stack']);if(_0x46141e[_0xc3f8('0x29')]){delete _0x46141e[_0xc3f8('0x29')];}_0x5e32c2[_0xc3f8('0x1b')](_0x19c67c)[_0xc3f8('0x2a')](_0x46141e);};}exports[_0xc3f8('0x2b')]=function(_0x30ee76,_0x272451){var _0x5b14a2={},_0x42deeb={},_0x214bb4={'count':0x0,'rows':[]};var _0x2d705c=_[_0xc3f8('0x2c')](db['SugarcrmField'][_0xc3f8('0x2d')],function(_0x2ed342){return{'name':_0x2ed342[_0xc3f8('0x2e')],'type':_0x2ed342['type'][_0xc3f8('0x2f')]};});_0x42deeb[_0xc3f8('0x30')]=_[_0xc3f8('0x2c')](_0x2d705c,_0xc3f8('0x29'));_0x42deeb[_0xc3f8('0x31')]=_[_0xc3f8('0x32')](_0x30ee76[_0xc3f8('0x31')]);_0x42deeb[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x42deeb[_0xc3f8('0x30')],_0x42deeb['query']);_0x5b14a2[_0xc3f8('0x35')]=_[_0xc3f8('0x34')](_0x42deeb[_0xc3f8('0x30')],qs[_0xc3f8('0x36')](_0x30ee76[_0xc3f8('0x31')][_0xc3f8('0x36')]));_0x5b14a2[_0xc3f8('0x35')]=_0x5b14a2[_0xc3f8('0x35')][_0xc3f8('0x37')]?_0x5b14a2[_0xc3f8('0x35')]:_0x42deeb[_0xc3f8('0x30')];if(!_0x30ee76['query'][_0xc3f8('0x38')]('nolimit')){_0x5b14a2[_0xc3f8('0x39')]=qs[_0xc3f8('0x39')](_0x30ee76['query'][_0xc3f8('0x39')]);_0x5b14a2[_0xc3f8('0x1e')]=qs['offset'](_0x30ee76[_0xc3f8('0x31')][_0xc3f8('0x1e')]);}_0x5b14a2[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x30ee76[_0xc3f8('0x31')]['sort']);_0x5b14a2[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x3d')](_0x30ee76[_0xc3f8('0x31')],_0x42deeb[_0xc3f8('0x33')]),_0x2d705c);if(_0x30ee76[_0xc3f8('0x31')]['filter']){_0x5b14a2['where']=_[_0xc3f8('0x3e')](_0x5b14a2[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2c')](_0x2d705c,function(_0x3e154a){if(_0x3e154a[_0xc3f8('0x3f')]!==_0xc3f8('0x40')){var _0x3f7367={};_0x3f7367[_0x3e154a[_0xc3f8('0x29')]]={'$like':'%'+_0x30ee76[_0xc3f8('0x31')][_0xc3f8('0x41')]+'%'};return _0x3f7367;}})});}_0x5b14a2=_[_0xc3f8('0x3e')]({},_0x5b14a2,_0x30ee76['options']);var _0x346ecb={'where':_0x5b14a2[_0xc3f8('0x3c')]};return db[_0xc3f8('0x42')][_0xc3f8('0x1d')](_0x346ecb)[_0xc3f8('0x26')](function(_0x742d46){_0x214bb4[_0xc3f8('0x1d')]=_0x742d46;if(_0x30ee76['query'][_0xc3f8('0x43')]){_0x5b14a2['include']=[{'all':!![]}];}return db[_0xc3f8('0x42')]['findAll'](_0x5b14a2);})[_0xc3f8('0x26')](function(_0x299e8d){_0x214bb4[_0xc3f8('0x44')]=_0x299e8d;return _0x214bb4;})['then'](respondWithFilteredResult(_0x272451,_0x5b14a2))[_0xc3f8('0x45')](handleError(_0x272451,null));};exports[_0xc3f8('0x46')]=function(_0x513f36,_0x45b6d0){var _0x4b659f={'raw':!![],'where':{'id':_0x513f36[_0xc3f8('0x47')]['id']}},_0x56fc51={};_0x56fc51[_0xc3f8('0x30')]=_[_0xc3f8('0x32')](db['SugarcrmField'][_0xc3f8('0x2d')]);_0x56fc51[_0xc3f8('0x31')]=_[_0xc3f8('0x32')](_0x513f36[_0xc3f8('0x31')]);_0x56fc51[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x56fc51[_0xc3f8('0x30')],_0x56fc51[_0xc3f8('0x31')]);_0x4b659f[_0xc3f8('0x35')]=_[_0xc3f8('0x34')](_0x56fc51[_0xc3f8('0x30')],qs[_0xc3f8('0x36')](_0x513f36[_0xc3f8('0x31')]['fields']));_0x4b659f[_0xc3f8('0x35')]=_0x4b659f[_0xc3f8('0x35')][_0xc3f8('0x37')]?_0x4b659f['attributes']:_0x56fc51[_0xc3f8('0x30')];if(_0x513f36['query']['includeAll']){_0x4b659f[_0xc3f8('0x48')]=[{'all':!![]}];}_0x4b659f=_['merge']({},_0x4b659f,_0x513f36[_0xc3f8('0x49')]);return db['SugarcrmField'][_0xc3f8('0x4a')](_0x4b659f)['then'](handleEntityNotFound(_0x45b6d0,null))[_0xc3f8('0x26')](respondWithResult(_0x45b6d0,null))[_0xc3f8('0x45')](handleError(_0x45b6d0,null));};exports[_0xc3f8('0x4b')]=function(_0x412c99,_0x3649f6){return db[_0xc3f8('0x42')][_0xc3f8('0x4b')](_0x412c99[_0xc3f8('0x4c')],{})[_0xc3f8('0x26')](respondWithResult(_0x3649f6,0xc9))['catch'](handleError(_0x3649f6,null));};exports[_0xc3f8('0x25')]=function(_0x510a29,_0x1e1d6e){if(_0x510a29[_0xc3f8('0x4c')]['id']){delete _0x510a29[_0xc3f8('0x4c')]['id'];}return db[_0xc3f8('0x42')][_0xc3f8('0x4a')]({'where':{'id':_0x510a29[_0xc3f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e1d6e,null))[_0xc3f8('0x26')](saveUpdates(_0x510a29[_0xc3f8('0x4c')],null))['then'](respondWithResult(_0x1e1d6e,null))[_0xc3f8('0x45')](handleError(_0x1e1d6e,null));};exports['destroy']=function(_0x1b79d5,_0x12f019){return db[_0xc3f8('0x42')][_0xc3f8('0x4a')]({'where':{'id':_0x1b79d5[_0xc3f8('0x47')]['id']}})[_0xc3f8('0x26')](handleEntityNotFound(_0x12f019,null))['then'](removeEntity(_0x12f019,null))[_0xc3f8('0x45')](handleError(_0x12f019,null));}; \ No newline at end of file +var _0x8230=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','rows','catch','show','params','includeAll','include','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','SugarcrmField','rawAttributes','type','key','keys','query','model','intersection','fields'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8230,0xf9));var _0x0823=function(_0x3b6a97,_0x56372b){_0x3b6a97=_0x3b6a97-0x0;var _0x2aff96=_0x8230[_0x3b6a97];return _0x2aff96;};'use strict';var pdf=require(_0x0823('0x0'));var emlformat=require(_0x0823('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0823('0x2'));var jsonpatch=require(_0x0823('0x3'));var rp=require(_0x0823('0x4'));var moment=require(_0x0823('0x5'));var BPromise=require(_0x0823('0x6'));var Mustache=require(_0x0823('0x7'));var util=require(_0x0823('0x8'));var path=require('path');var sox=require(_0x0823('0x9'));var csv=require(_0x0823('0xa'));var ejs=require(_0x0823('0xb'));var fs=require('fs');var _=require(_0x0823('0xc'));var squel=require('squel');var crypto=require(_0x0823('0xd'));var jsforce=require(_0x0823('0xe'));var deskjs=require(_0x0823('0xf'));var toCsv=require(_0x0823('0xa'));var querystring=require(_0x0823('0x10'));var Papa=require(_0x0823('0x11'));var Redis=require(_0x0823('0x12'));var authService=require(_0x0823('0x13'));var qs=require(_0x0823('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0823('0x15'));var logger=require(_0x0823('0x16'))(_0x0823('0x17'));var utils=require(_0x0823('0x18'));var config=require(_0x0823('0x19'));var db=require(_0x0823('0x1a'))['db'];function respondWithStatusCode(_0xb0c6a0,_0xd446b8){_0xd446b8=_0xd446b8||0xcc;return function(_0x45fb81){if(_0x45fb81){return _0xb0c6a0[_0x0823('0x1b')](_0xd446b8);}return _0xb0c6a0[_0x0823('0x1c')](_0xd446b8)['end']();};}function respondWithResult(_0x2f6f81,_0x2719c8){_0x2719c8=_0x2719c8||0xc8;return function(_0x53e657){if(_0x53e657){return _0x2f6f81[_0x0823('0x1c')](_0x2719c8)[_0x0823('0x1d')](_0x53e657);}};}function respondWithFilteredResult(_0x17a5a6,_0xe482ee){return function(_0x52c8d1){if(_0x52c8d1){var _0x481522=_0x52c8d1[_0x0823('0x1e')],_0x191250=_0xe482ee['offset'],_0x38f26d=_0xe482ee[_0x0823('0x1f')]+_0xe482ee[_0x0823('0x20')],_0xc9332a;if(_0x38f26d>=_0x481522){_0x38f26d=_0x481522;_0xc9332a=0xc8;}else{_0xc9332a=0xce;}_0x17a5a6[_0x0823('0x1c')](_0xc9332a);return _0x17a5a6[_0x0823('0x21')](_0x0823('0x22'),_0x191250+'-'+_0x38f26d+'/'+_0x481522)[_0x0823('0x1d')](_0x52c8d1);}return null;};}function patchUpdates(_0x270c79){return function(_0x555435){try{jsonpatch[_0x0823('0x23')](_0x555435,_0x270c79,!![]);}catch(_0x3b27e1){return BPromise[_0x0823('0x24')](_0x3b27e1);}return _0x555435[_0x0823('0x25')]();};}function saveUpdates(_0x214f20,_0x4cc31d){return function(_0x902805){if(_0x902805){return _0x902805[_0x0823('0x26')](_0x214f20)[_0x0823('0x27')](function(_0x12922e){return _0x12922e;});}return null;};}function removeEntity(_0x5816a8,_0x31b56b){return function(_0x3ad749){if(_0x3ad749){return _0x3ad749[_0x0823('0x28')]()[_0x0823('0x27')](function(){_0x5816a8[_0x0823('0x1c')](0xcc)[_0x0823('0x29')]();});}};}function handleEntityNotFound(_0x592e25,_0x2b71ce){return function(_0x15e60d){if(!_0x15e60d){_0x592e25[_0x0823('0x1b')](0x194);}return _0x15e60d;};}function handleError(_0x1a6b97,_0x2d69c7){_0x2d69c7=_0x2d69c7||0x1f4;return function(_0x39fe80){logger[_0x0823('0x2a')](_0x39fe80[_0x0823('0x2b')]);if(_0x39fe80[_0x0823('0x2c')]){delete _0x39fe80[_0x0823('0x2c')];}_0x1a6b97[_0x0823('0x1c')](_0x2d69c7)['send'](_0x39fe80);};}exports['index']=function(_0x649ccd,_0x38e14b){var _0x40510c={},_0x12ea8f={},_0x593e74={'count':0x0,'rows':[]};var _0x572339=_[_0x0823('0x2d')](db[_0x0823('0x2e')][_0x0823('0x2f')],function(_0x3bb8da){return{'name':_0x3bb8da['fieldName'],'type':_0x3bb8da[_0x0823('0x30')][_0x0823('0x31')]};});_0x12ea8f['model']=_[_0x0823('0x2d')](_0x572339,_0x0823('0x2c'));_0x12ea8f['query']=_[_0x0823('0x32')](_0x649ccd[_0x0823('0x33')]);_0x12ea8f['filters']=_['intersection'](_0x12ea8f[_0x0823('0x34')],_0x12ea8f['query']);_0x40510c['attributes']=_[_0x0823('0x35')](_0x12ea8f[_0x0823('0x34')],qs[_0x0823('0x36')](_0x649ccd['query']['fields']));_0x40510c[_0x0823('0x37')]=_0x40510c[_0x0823('0x37')][_0x0823('0x38')]?_0x40510c[_0x0823('0x37')]:_0x12ea8f['model'];if(!_0x649ccd[_0x0823('0x33')][_0x0823('0x39')](_0x0823('0x3a'))){_0x40510c['limit']=qs[_0x0823('0x20')](_0x649ccd[_0x0823('0x33')]['limit']);_0x40510c[_0x0823('0x1f')]=qs[_0x0823('0x1f')](_0x649ccd[_0x0823('0x33')]['offset']);}_0x40510c[_0x0823('0x3b')]=qs[_0x0823('0x3c')](_0x649ccd[_0x0823('0x33')][_0x0823('0x3c')]);_0x40510c[_0x0823('0x3d')]=qs[_0x0823('0x3e')](_['pick'](_0x649ccd[_0x0823('0x33')],_0x12ea8f['filters']),_0x572339);if(_0x649ccd[_0x0823('0x33')]['filter']){_0x40510c[_0x0823('0x3d')]=_[_0x0823('0x3f')](_0x40510c['where'],{'$or':_['map'](_0x572339,function(_0x1f76d2){if(_0x1f76d2[_0x0823('0x30')]!==_0x0823('0x40')){var _0x46062e={};_0x46062e[_0x1f76d2[_0x0823('0x2c')]]={'$like':'%'+_0x649ccd[_0x0823('0x33')][_0x0823('0x41')]+'%'};return _0x46062e;}})});}_0x40510c=_[_0x0823('0x3f')]({},_0x40510c,_0x649ccd['options']);var _0x28f8f1={'where':_0x40510c[_0x0823('0x3d')]};return db['SugarcrmField'][_0x0823('0x1e')](_0x28f8f1)['then'](function(_0x5161a5){_0x593e74[_0x0823('0x1e')]=_0x5161a5;if(_0x649ccd[_0x0823('0x33')]['includeAll']){_0x40510c['include']=[{'all':!![]}];}return db[_0x0823('0x2e')]['findAll'](_0x40510c);})[_0x0823('0x27')](function(_0x3708ab){_0x593e74[_0x0823('0x42')]=_0x3708ab;return _0x593e74;})[_0x0823('0x27')](respondWithFilteredResult(_0x38e14b,_0x40510c))[_0x0823('0x43')](handleError(_0x38e14b,null));};exports[_0x0823('0x44')]=function(_0x11e38a,_0x4d9274){var _0x5bd0f8={'raw':!![],'where':{'id':_0x11e38a[_0x0823('0x45')]['id']}},_0x4af515={};_0x4af515['model']=_['keys'](db[_0x0823('0x2e')][_0x0823('0x2f')]);_0x4af515['query']=_['keys'](_0x11e38a['query']);_0x4af515[_0x0823('0x3e')]=_[_0x0823('0x35')](_0x4af515[_0x0823('0x34')],_0x4af515['query']);_0x5bd0f8[_0x0823('0x37')]=_[_0x0823('0x35')](_0x4af515[_0x0823('0x34')],qs[_0x0823('0x36')](_0x11e38a[_0x0823('0x33')][_0x0823('0x36')]));_0x5bd0f8['attributes']=_0x5bd0f8[_0x0823('0x37')][_0x0823('0x38')]?_0x5bd0f8[_0x0823('0x37')]:_0x4af515[_0x0823('0x34')];if(_0x11e38a[_0x0823('0x33')][_0x0823('0x46')]){_0x5bd0f8[_0x0823('0x47')]=[{'all':!![]}];}_0x5bd0f8=_[_0x0823('0x3f')]({},_0x5bd0f8,_0x11e38a[_0x0823('0x48')]);return db[_0x0823('0x2e')][_0x0823('0x49')](_0x5bd0f8)[_0x0823('0x27')](handleEntityNotFound(_0x4d9274,null))[_0x0823('0x27')](respondWithResult(_0x4d9274,null))[_0x0823('0x43')](handleError(_0x4d9274,null));};exports[_0x0823('0x4a')]=function(_0x36347e,_0x409bb0){return db[_0x0823('0x2e')][_0x0823('0x4a')](_0x36347e[_0x0823('0x4b')],{})[_0x0823('0x27')](respondWithResult(_0x409bb0,0xc9))[_0x0823('0x43')](handleError(_0x409bb0,null));};exports['update']=function(_0x4ef34f,_0x574311){if(_0x4ef34f[_0x0823('0x4b')]['id']){delete _0x4ef34f['body']['id'];}return db['SugarcrmField'][_0x0823('0x49')]({'where':{'id':_0x4ef34f['params']['id']}})[_0x0823('0x27')](handleEntityNotFound(_0x574311,null))[_0x0823('0x27')](saveUpdates(_0x4ef34f['body'],null))[_0x0823('0x27')](respondWithResult(_0x574311,null))[_0x0823('0x43')](handleError(_0x574311,null));};exports[_0x0823('0x28')]=function(_0x15c3d0,_0x498139){return db[_0x0823('0x2e')][_0x0823('0x49')]({'where':{'id':_0x15c3d0['params']['id']}})[_0x0823('0x27')](handleEntityNotFound(_0x498139,null))[_0x0823('0x27')](removeEntity(_0x498139,null))[_0x0823('0x43')](handleError(_0x498139,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0d61a10..feab21d 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 _0xd4b2=['request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api'];(function(_0xd5827a,_0x34b49b){var _0x417210=function(_0x6f7893){while(--_0x6f7893){_0xd5827a['push'](_0xd5827a['shift']());}};_0x417210(++_0x34b49b);}(_0xd4b2,0x191));var _0x2d4b=function(_0x4578e7,_0x1c72a2){_0x4578e7=_0x4578e7-0x0;var _0x3db768=_0xd4b2[_0x4578e7];return _0x3db768;};'use strict';var _=require('lodash');var util=require(_0x2d4b('0x0'));var logger=require('../../config/logger')(_0x2d4b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d4b('0x2'));var fs=require('fs');var path=require(_0x2d4b('0x3'));var rimraf=require(_0x2d4b('0x4'));var config=require(_0x2d4b('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x2d4b('0x6')]=function(_0x4425f4,_0x1f8d61){return _0x4425f4[_0x2d4b('0x7')](_0x2d4b('0x8'),attributes,{'tableName':_0x2d4b('0x9'),'paranoid':![],'indexes':[{'name':_0x2d4b('0xa'),'fields':[_0x2d4b('0xb'),_0x2d4b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56ac=['../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2af4cb,_0x390611){var _0x3cffc5=function(_0x5a1de8){while(--_0x5a1de8){_0x2af4cb['push'](_0x2af4cb['shift']());}};_0x3cffc5(++_0x390611);}(_0x56ac,0xd9));var _0xc56a=function(_0xa6f7f0,_0x3005fe){_0xa6f7f0=_0xa6f7f0-0x0;var _0x307407=_0x56ac[_0xa6f7f0];return _0x307407;};'use strict';var _=require(_0xc56a('0x0'));var util=require(_0xc56a('0x1'));var logger=require(_0xc56a('0x2'))(_0xc56a('0x3'));var moment=require(_0xc56a('0x4'));var BPromise=require(_0xc56a('0x5'));var rp=require(_0xc56a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc56a('0x7'));var config=require(_0xc56a('0x8'));var attributes=require(_0xc56a('0x9'));module[_0xc56a('0xa')]=function(_0x313228,_0x2bf79c){return _0x313228[_0xc56a('0xb')]('SugarcrmField',attributes,{'tableName':_0xc56a('0xc'),'paranoid':![],'indexes':[{'name':_0xc56a('0xd'),'fields':['idField',_0xc56a('0xe')],'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 78a7eba..a89dd11 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 _0x0b0e=['SugarcrmField,\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','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x0b0e[_0x53b8e0];return _0x10630c;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x485f20,_0x15dd3e){var _0x182471=function(_0x3a8f3b){while(--_0x3a8f3b){_0x485f20['push'](_0x485f20['shift']());}};_0x182471(++_0x15dd3e);}(_0x2032,0xd9));var _0x2203=function(_0x200579,_0x4c4104){_0x200579=_0x200579-0x0;var _0x3adaa3=_0x2032[_0x200579];return _0x3adaa3;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index fbded2c..0e486be 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 _0x71b2=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x354c1b,_0x56d79b){var _0x2c70f4=function(_0x47bdf4){while(--_0x47bdf4){_0x354c1b['push'](_0x354c1b['shift']());}};_0x2c70f4(++_0x56d79b);}(_0x71b2,0x8d));var _0x271b=function(_0x309a5e,_0x1ec246){_0x309a5e=_0x309a5e-0x0;var _0x1d21f1=_0x71b2[_0x309a5e];return _0x1d21f1;};'use strict';var multer=require(_0x271b('0x0'));var util=require(_0x271b('0x1'));var path=require('path');var timeout=require(_0x271b('0x2'));var express=require(_0x271b('0x3'));var router=express[_0x271b('0x4')]();var auth=require(_0x271b('0x5'));var interaction=require(_0x271b('0x6'));var config=require(_0x271b('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x271b('0x8')]('/',auth[_0x271b('0x9')](),controller['index']);router[_0x271b('0x8')](_0x271b('0xa'),auth[_0x271b('0x9')](),controller[_0x271b('0xb')]);router[_0x271b('0x8')](_0x271b('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x271b('0x8')](_0x271b('0xd'),auth[_0x271b('0x9')](),controller[_0x271b('0xe')]);router['post']('/',auth[_0x271b('0x9')](),controller[_0x271b('0xf')]);router[_0x271b('0x10')](_0x271b('0xc'),auth['isAuthenticated'](),controller[_0x271b('0x11')]);router[_0x271b('0x12')](_0x271b('0xa'),auth[_0x271b('0x9')](),controller[_0x271b('0x13')]);router[_0x271b('0x14')](_0x271b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x271b('0x15')]=router; \ No newline at end of file +var _0x0d7b=['create','post','put','update','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5d42c9,_0x198aa6){var _0x21cc96=function(_0x2994d9){while(--_0x2994d9){_0x5d42c9['push'](_0x5d42c9['shift']());}};_0x21cc96(++_0x198aa6);}(_0x0d7b,0xd7));var _0xb0d7=function(_0x49804c,_0x104823){_0x49804c=_0x49804c-0x0;var _0xe6ec1f=_0x0d7b[_0x49804c];return _0xe6ec1f;};'use strict';var multer=require(_0xb0d7('0x0'));var util=require(_0xb0d7('0x1'));var path=require(_0xb0d7('0x2'));var timeout=require(_0xb0d7('0x3'));var express=require(_0xb0d7('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb0d7('0x5'));var config=require('../../config/environment');var controller=require(_0xb0d7('0x6'));router['get']('/',auth[_0xb0d7('0x7')](),controller[_0xb0d7('0x8')]);router[_0xb0d7('0x9')](_0xb0d7('0xa'),auth[_0xb0d7('0x7')](),controller[_0xb0d7('0xb')]);router[_0xb0d7('0x9')](_0xb0d7('0xc'),auth[_0xb0d7('0x7')](),controller[_0xb0d7('0xd')]);router[_0xb0d7('0x9')](_0xb0d7('0xe'),auth[_0xb0d7('0x7')](),controller[_0xb0d7('0xf')]);router['post']('/',auth[_0xb0d7('0x7')](),controller[_0xb0d7('0x10')]);router[_0xb0d7('0x11')](_0xb0d7('0xc'),auth[_0xb0d7('0x7')](),controller['addConfiguration']);router[_0xb0d7('0x12')](_0xb0d7('0xa'),auth[_0xb0d7('0x7')](),controller[_0xb0d7('0x13')]);router[_0xb0d7('0x14')](_0xb0d7('0xa'),auth[_0xb0d7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 973bc02..ca0e09b 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 _0x1e6a=['exports','STRING','HelpDesk','sequelize'];(function(_0x3405e5,_0x570617){var _0x22b543=function(_0x570595){while(--_0x570595){_0x3405e5['push'](_0x3405e5['shift']());}};_0x22b543(++_0x570617);}(_0x1e6a,0x103));var _0xa1e6=function(_0x54e2e5,_0x477862){_0x54e2e5=_0x54e2e5-0x0;var _0x4bbc62=_0x1e6a[_0x54e2e5];return _0x4bbc62;};'use strict';var Sequelize=require(_0xa1e6('0x0'));module[_0xa1e6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa1e6('0x2')]},'username':{'type':Sequelize[_0xa1e6('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa1e6('0x2')],'allowNull':![],'defaultValue':_0xa1e6('0x3')},'remoteUri':{'type':Sequelize[_0xa1e6('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa1e6('0x2')]},'accessKey':{'type':Sequelize[_0xa1e6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfeb4=['exports','STRING','HelpDesk','sequelize'];(function(_0x420282,_0x1f941f){var _0x535480=function(_0x18cddc){while(--_0x18cddc){_0x420282['push'](_0x420282['shift']());}};_0x535480(++_0x1f941f);}(_0xfeb4,0x1a7));var _0x4feb=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfeb4[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x4feb('0x0'));module[_0x4feb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4feb('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4feb('0x2')],'allowNull':![],'defaultValue':_0x4feb('0x3')},'remoteUri':{'type':Sequelize[_0x4feb('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4feb('0x2')]},'accessKey':{'type':Sequelize[_0x4feb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3b6a12f..b842585 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 _0xff4d=['log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','count','offset','Content-Range','apply','reject','save','update','destroy','end','send','map','VtigerAccount','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','channel','Descriptions','VtigerField','Subjects','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','describe','autogenerated','reference','owner','remove','includes','editable','false','cf_','picklist','picklistValues','label','value'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xff4d,0x8b));var _0xdff4=function(_0x244cef,_0xbce3ec){_0x244cef=_0x244cef-0x0;var _0x32139b=_0xff4d[_0x244cef];return _0x32139b;};'use strict';var pdf=require(_0xdff4('0x0'));var emlformat=require(_0xdff4('0x1'));var rimraf=require(_0xdff4('0x2'));var zipdir=require(_0xdff4('0x3'));var jsonpatch=require(_0xdff4('0x4'));var rp=require(_0xdff4('0x5'));var moment=require(_0xdff4('0x6'));var BPromise=require(_0xdff4('0x7'));var Mustache=require(_0xdff4('0x8'));var util=require('util');var path=require(_0xdff4('0x9'));var sox=require(_0xdff4('0xa'));var csv=require(_0xdff4('0xb'));var ejs=require(_0xdff4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdff4('0xd'));var jsforce=require(_0xdff4('0xe'));var deskjs=require(_0xdff4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdff4('0x10'));var Papa=require(_0xdff4('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdff4('0x12'));var as=require(_0xdff4('0x13'));var hardwareService=require(_0xdff4('0x14'));var logger=require(_0xdff4('0x15'))(_0xdff4('0x16'));var utils=require(_0xdff4('0x17'));var config=require(_0xdff4('0x18'));var db=require(_0xdff4('0x19'))['db'];var integrations=require(_0xdff4('0x1a'));var jayson=require(_0xdff4('0x1b'));var client=jayson[_0xdff4('0x1c')][_0xdff4('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x35c4a4,_0x3d2a6a,_0x49c6ec){if(_0x49c6ec){var _0x2fc5c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fc5c0['test'](_0x3d2a6a)){return _0x35c4a4;}else{throw new db[(_0xdff4('0x1e'))][(_0xdff4('0x1f'))](_0xdff4('0x20'));}}else{return _0x35c4a4;}}function respondWithRpcPromise(_0x245e70,_0x37d4af,_0x2bb473,_0x66736e){return new BPromise(function(_0x3af781,_0x394f1b){var _0x3be78c=_0x66736e||client;return _0x3be78c[_0xdff4('0x21')](_0x245e70,_0x2bb473)[_0xdff4('0x22')](function(_0x5957b9){logger[_0xdff4('0x23')](_0xdff4('0x24'),_0x37d4af,_0xdff4('0x25'));logger[_0xdff4('0x26')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x37d4af,_0xdff4('0x25'),JSON[_0xdff4('0x27')](_0x5957b9));if(_0x5957b9[_0xdff4('0x28')]){if(_0x5957b9['error'][_0xdff4('0x29')]===0x1f4){logger['error'](_0xdff4('0x24'),_0x37d4af,_0x5957b9[_0xdff4('0x28')][_0xdff4('0x2a')]);return _0x394f1b(_0x5957b9[_0xdff4('0x28')][_0xdff4('0x2a')]);}logger[_0xdff4('0x28')](_0xdff4('0x24'),_0x37d4af,_0x5957b9[_0xdff4('0x28')][_0xdff4('0x2a')]);return _0x3af781(_0x5957b9['error'][_0xdff4('0x2a')]);}else{logger[_0xdff4('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x37d4af,_0xdff4('0x25'));_0x3af781(_0x5957b9[_0xdff4('0x2b')][_0xdff4('0x2a')]);}})[_0xdff4('0x2c')](function(_0x49a12c){logger[_0xdff4('0x28')](_0xdff4('0x24'),_0x37d4af,_0x49a12c);_0x394f1b(_0x49a12c);});});}function respondWithStatusCode(_0x53205b,_0x5a6e1b){_0x5a6e1b=_0x5a6e1b||0xcc;return function(_0x2302c4){if(_0x2302c4){return _0x53205b[_0xdff4('0x2d')](_0x5a6e1b);}return _0x53205b[_0xdff4('0x2e')](_0x5a6e1b)['end']();};}function respondWithResult(_0x13758a,_0x20448c){_0x20448c=_0x20448c||0xc8;return function(_0x580a14){if(_0x580a14){return _0x13758a[_0xdff4('0x2e')](_0x20448c)['json'](_0x580a14);}};}function respondWithFilteredResult(_0x4b983a,_0x214513){return function(_0x3aa0cb){if(_0x3aa0cb){var _0x1999b0=_0x3aa0cb[_0xdff4('0x2f')],_0x2a50f2=_0x214513[_0xdff4('0x30')],_0x420bb9=_0x214513[_0xdff4('0x30')]+_0x214513['limit'],_0x3f0d29;if(_0x420bb9>=_0x1999b0){_0x420bb9=_0x1999b0;_0x3f0d29=0xc8;}else{_0x3f0d29=0xce;}_0x4b983a[_0xdff4('0x2e')](_0x3f0d29);return _0x4b983a['set'](_0xdff4('0x31'),_0x2a50f2+'-'+_0x420bb9+'/'+_0x1999b0)['json'](_0x3aa0cb);}return null;};}function patchUpdates(_0x3195d2){return function(_0x4b80cf){try{jsonpatch[_0xdff4('0x32')](_0x4b80cf,_0x3195d2,!![]);}catch(_0x65191a){return BPromise[_0xdff4('0x33')](_0x65191a);}return _0x4b80cf[_0xdff4('0x34')]();};}function saveUpdates(_0xe20988,_0x381b20){return function(_0x3c4dd1){if(_0x3c4dd1){return _0x3c4dd1[_0xdff4('0x35')](_0xe20988)[_0xdff4('0x22')](function(_0x10ea0d){return _0x10ea0d;});}return null;};}function removeEntity(_0x52909f,_0x1c2e7c){return function(_0x34746c){if(_0x34746c){return _0x34746c[_0xdff4('0x36')]()[_0xdff4('0x22')](function(){_0x52909f[_0xdff4('0x2e')](0xcc)[_0xdff4('0x37')]();});}};}function handleEntityNotFound(_0x5138c2,_0x2e9111){return function(_0xd9f6d4){if(!_0xd9f6d4){_0x5138c2[_0xdff4('0x2d')](0x194);}return _0xd9f6d4;};}function handleError(_0x243cd5,_0x1805b6){_0x1805b6=_0x1805b6||0x1f4;return function(_0xe71fd9){logger[_0xdff4('0x28')](_0xe71fd9['stack']);if(_0xe71fd9['name']){delete _0xe71fd9['name'];}_0x243cd5['status'](_0x1805b6)[_0xdff4('0x38')](_0xe71fd9);};}exports['index']=function(_0xd155a6,_0x43b62f){var _0x3e8a0c={},_0x5e3faa={},_0x516266={'count':0x0,'rows':[]};var _0x3b1628=_[_0xdff4('0x39')](db[_0xdff4('0x3a')][_0xdff4('0x3b')],function(_0x54dc1d){return{'name':_0x54dc1d[_0xdff4('0x3c')],'type':_0x54dc1d['type'][_0xdff4('0x3d')]};});_0x5e3faa[_0xdff4('0x3e')]=_[_0xdff4('0x39')](_0x3b1628,_0xdff4('0x3f'));_0x5e3faa['query']=_[_0xdff4('0x40')](_0xd155a6[_0xdff4('0x41')]);_0x5e3faa[_0xdff4('0x42')]=_[_0xdff4('0x43')](_0x5e3faa[_0xdff4('0x3e')],_0x5e3faa['query']);_0x3e8a0c['attributes']=_[_0xdff4('0x43')](_0x5e3faa[_0xdff4('0x3e')],qs[_0xdff4('0x44')](_0xd155a6[_0xdff4('0x41')][_0xdff4('0x44')]));_0x3e8a0c[_0xdff4('0x45')]=_0x3e8a0c[_0xdff4('0x45')][_0xdff4('0x46')]?_0x3e8a0c[_0xdff4('0x45')]:_0x5e3faa[_0xdff4('0x3e')];if(!_0xd155a6[_0xdff4('0x41')][_0xdff4('0x47')](_0xdff4('0x48'))){_0x3e8a0c[_0xdff4('0x49')]=qs[_0xdff4('0x49')](_0xd155a6['query']['limit']);_0x3e8a0c[_0xdff4('0x30')]=qs['offset'](_0xd155a6[_0xdff4('0x41')]['offset']);}_0x3e8a0c['order']=qs[_0xdff4('0x4a')](_0xd155a6[_0xdff4('0x41')][_0xdff4('0x4a')]);_0x3e8a0c[_0xdff4('0x4b')]=qs[_0xdff4('0x42')](_[_0xdff4('0x4c')](_0xd155a6[_0xdff4('0x41')],_0x5e3faa[_0xdff4('0x42')]),_0x3b1628);if(_0xd155a6[_0xdff4('0x41')]['filter']){_0x3e8a0c[_0xdff4('0x4b')]=_[_0xdff4('0x4d')](_0x3e8a0c[_0xdff4('0x4b')],{'$or':_[_0xdff4('0x39')](_0x3b1628,function(_0x1e885d){if(_0x1e885d[_0xdff4('0x4e')]!==_0xdff4('0x4f')){var _0x3111b7={};_0x3111b7[_0x1e885d[_0xdff4('0x3f')]]={'$like':'%'+_0xd155a6['query'][_0xdff4('0x50')]+'%'};return _0x3111b7;}})});}_0x3e8a0c=_['merge']({},_0x3e8a0c,_0xd155a6[_0xdff4('0x51')]);var _0x1c56ee={'where':_0x3e8a0c['where']};return db[_0xdff4('0x3a')][_0xdff4('0x2f')](_0x1c56ee)['then'](function(_0x42ae03){_0x516266['count']=_0x42ae03;if(_0xd155a6[_0xdff4('0x41')][_0xdff4('0x52')]){_0x3e8a0c['include']=[{'all':!![]}];}return db[_0xdff4('0x3a')][_0xdff4('0x53')](_0x3e8a0c);})['then'](function(_0x1509ce){_0x516266[_0xdff4('0x54')]=_0x1509ce;return _0x516266;})[_0xdff4('0x22')](respondWithFilteredResult(_0x43b62f,_0x3e8a0c))['catch'](handleError(_0x43b62f,null));};exports[_0xdff4('0x55')]=function(_0x3c0c73,_0x5be053){var _0x488c16={'raw':![],'where':{'id':_0x3c0c73['params']['id']}},_0x56ffb4={};_0x56ffb4[_0xdff4('0x3e')]=_[_0xdff4('0x40')](db[_0xdff4('0x3a')][_0xdff4('0x3b')]);_0x56ffb4['query']=_['keys'](_0x3c0c73[_0xdff4('0x41')]);_0x56ffb4[_0xdff4('0x42')]=_[_0xdff4('0x43')](_0x56ffb4[_0xdff4('0x3e')],_0x56ffb4['query']);_0x488c16[_0xdff4('0x45')]=_[_0xdff4('0x43')](_0x56ffb4[_0xdff4('0x3e')],qs[_0xdff4('0x44')](_0x3c0c73['query']['fields']));_0x488c16['attributes']=_0x488c16[_0xdff4('0x45')][_0xdff4('0x46')]?_0x488c16[_0xdff4('0x45')]:_0x56ffb4[_0xdff4('0x3e')];if(_0x3c0c73['query']['includeAll']){_0x488c16[_0xdff4('0x56')]=[{'all':!![]}];}_0x488c16=_['merge']({},_0x488c16,_0x3c0c73['options']);return db['VtigerAccount'][_0xdff4('0x57')](_0x488c16)[_0xdff4('0x22')](handleEntityNotFound(_0x5be053,null))[_0xdff4('0x22')](respondWithResult(_0x5be053,null))[_0xdff4('0x2c')](handleError(_0x5be053,null));};exports[_0xdff4('0x58')]=function(_0x599b4c,_0x268d19){return db[_0xdff4('0x3a')][_0xdff4('0x58')](_0x599b4c[_0xdff4('0x59')],{})[_0xdff4('0x22')](respondWithResult(_0x268d19,0xc9))['catch'](handleError(_0x268d19,null));};exports['update']=function(_0x223d86,_0x2402bd){if(_0x223d86['body']['id']){delete _0x223d86[_0xdff4('0x59')]['id'];}return db[_0xdff4('0x3a')]['find']({'where':{'id':_0x223d86['params']['id']}})['then'](handleEntityNotFound(_0x2402bd,null))['then'](saveUpdates(_0x223d86['body'],null))['then'](respondWithResult(_0x2402bd,null))['catch'](handleError(_0x2402bd,null));};exports[_0xdff4('0x36')]=function(_0x2943b2,_0x5445d1){return db[_0xdff4('0x3a')]['find']({'where':{'id':_0x2943b2[_0xdff4('0x5a')]['id']}})[_0xdff4('0x22')](handleEntityNotFound(_0x5445d1,null))[_0xdff4('0x22')](removeEntity(_0x5445d1,null))[_0xdff4('0x2c')](handleError(_0x5445d1,null));};exports[_0xdff4('0x5b')]=function(_0xe7bfe8,_0x1c38a6,_0x337ab4){var _0x3c1542={};var _0xa4537d={};var _0x3071a9;var _0xbcb943;return db['VtigerAccount'][_0xdff4('0x5c')]({'where':{'id':_0xe7bfe8[_0xdff4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c38a6,null))[_0xdff4('0x22')](function(_0x303a54){if(_0x303a54){_0x3071a9=_0x303a54;_0xa4537d[_0xdff4('0x3e')]=_[_0xdff4('0x40')](db[_0xdff4('0x5d')]['rawAttributes']);_0xa4537d[_0xdff4('0x41')]=_[_0xdff4('0x40')](_0xe7bfe8[_0xdff4('0x41')]);_0xa4537d[_0xdff4('0x42')]=_[_0xdff4('0x43')](_0xa4537d['model'],_0xa4537d['query']);_0x3c1542[_0xdff4('0x45')]=_[_0xdff4('0x43')](_0xa4537d[_0xdff4('0x3e')],qs['fields'](_0xe7bfe8[_0xdff4('0x41')][_0xdff4('0x44')]));_0x3c1542[_0xdff4('0x45')]=_0x3c1542[_0xdff4('0x45')][_0xdff4('0x46')]?_0x3c1542[_0xdff4('0x45')]:_0xa4537d[_0xdff4('0x3e')];_0x3c1542[_0xdff4('0x5e')]=qs[_0xdff4('0x4a')](_0xe7bfe8['query']['sort']);_0x3c1542[_0xdff4('0x4b')]=qs['filters'](_[_0xdff4('0x4c')](_0xe7bfe8[_0xdff4('0x41')],_0xa4537d[_0xdff4('0x42')]));if(_0xe7bfe8[_0xdff4('0x41')][_0xdff4('0x50')]){_0x3c1542[_0xdff4('0x4b')]=_['merge'](_0x3c1542[_0xdff4('0x4b')],{'$or':_[_0xdff4('0x39')](_0x3c1542[_0xdff4('0x45')],function(_0x2163bf){var _0x3c821e={};_0x3c821e[_0x2163bf]={'$like':'%'+_0xe7bfe8[_0xdff4('0x41')][_0xdff4('0x50')]+'%'};return _0x3c821e;})});}_0x3c1542=_['merge']({},_0x3c1542,_0xe7bfe8[_0xdff4('0x51')]);return _0x3071a9[_0xdff4('0x5b')](_0x3c1542);}})[_0xdff4('0x22')](function(_0x240374){if(_0x240374){_0xbcb943=_0x240374[_0xdff4('0x46')];if(!_0xe7bfe8[_0xdff4('0x41')][_0xdff4('0x47')](_0xdff4('0x48'))){_0x3c1542[_0xdff4('0x49')]=qs[_0xdff4('0x49')](_0xe7bfe8[_0xdff4('0x41')]['limit']);_0x3c1542[_0xdff4('0x30')]=qs[_0xdff4('0x30')](_0xe7bfe8['query'][_0xdff4('0x30')]);}return _0x3071a9[_0xdff4('0x5b')](_0x3c1542);}})[_0xdff4('0x22')](function(_0x4210a0){if(_0x4210a0){return _0x4210a0?{'count':_0xbcb943,'rows':_0x4210a0}:null;}})[_0xdff4('0x22')](respondWithResult(_0x1c38a6,null))[_0xdff4('0x2c')](handleError(_0x1c38a6,null));};exports[_0xdff4('0x5f')]=function(_0x12f46d,_0x218bff,_0x2c0f43){if(_0x12f46d[_0xdff4('0x59')]['id']){delete _0x12f46d['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x12f46d[_0xdff4('0x5a')]['id']}})[_0xdff4('0x22')](handleEntityNotFound(_0x218bff,null))[_0xdff4('0x22')](function(_0x2151ce){if(_0x2151ce){_0x12f46d['body'][_0xdff4('0x60')]=_0x2151ce['id'];_0x12f46d[_0xdff4('0x59')]['Subjects']=integrations['getSubjects'](_0x12f46d[_0xdff4('0x59')][_0xdff4('0x61')],_0x12f46d[_0xdff4('0x59')][_0xdff4('0x4e')]);_0x12f46d[_0xdff4('0x59')][_0xdff4('0x62')]=integrations['getDescriptions'](_0x12f46d[_0xdff4('0x59')][_0xdff4('0x61')],_0x12f46d['body'][_0xdff4('0x4e')]);return db[_0xdff4('0x5d')]['create'](_0x12f46d[_0xdff4('0x59')],{'include':[{'model':db[_0xdff4('0x63')],'as':_0xdff4('0x64')},{'model':db[_0xdff4('0x63')],'as':_0xdff4('0x62')}]});}return null;})[_0xdff4('0x22')](respondWithResult(_0x218bff,null))[_0xdff4('0x2c')](handleError(_0x218bff,null));};var md5=require(_0xdff4('0x65'));exports[_0xdff4('0x66')]=function(_0x250145,_0x1bbd42,_0x4cc442){var _0x272363=null;var _0x2b55d2=null;var _0x58f226=null;var _0x29b5f0=null;var _0x1e1edd='';return db[_0xdff4('0x3a')]['findOne']({'where':{'id':_0x250145[_0xdff4('0x5a')]['id']},'attributes':['id',_0xdff4('0x3f'),'username',_0xdff4('0x67'),_0xdff4('0x68'),_0xdff4('0x69'),_0xdff4('0x6a'),_0xdff4('0x6b')]})[_0xdff4('0x22')](handleEntityNotFound(_0x1bbd42,null))['then'](function(_0xbbdd7d){if(_0xbbdd7d){_0x272363=_0xbbdd7d[_0xdff4('0x6c')];_0x2b55d2=_0xbbdd7d[_0xdff4('0x6b')];_0x58f226=_0xbbdd7d['moduleName'];_0x1e1edd=_0xbbdd7d['remoteUri'];var _0xad5486=_0x1e1edd[_0xdff4('0x6d')](-0x1);if(_0xad5486==='/'){_0x1e1edd=_0x1e1edd[_0xdff4('0x6e')](0x0,_0x1e1edd[_0xdff4('0x6f')](_0xad5486));}_0x29b5f0=util[_0xdff4('0x70')](_0xdff4('0x71'),_0x1e1edd);var _0x946103={'method':_0xdff4('0x72'),'uri':_0x29b5f0,'qs':{'operation':'getchallenge','username':_0xbbdd7d[_0xdff4('0x6c')]},'json':!![]};return rp(_0x946103);}})[_0xdff4('0x22')](function(_0x228ec5){if(_0x228ec5[_0xdff4('0x73')]){var _0x57c549={'method':_0xdff4('0x74'),'uri':_0x29b5f0,'form':{'operation':_0xdff4('0x75'),'username':_0x272363,'accessKey':md5(_0x228ec5['result']['token']+_0x2b55d2)},'json':!![]};return rp(_0x57c549);}})[_0xdff4('0x22')](function(_0x932e3){if(_0x932e3[_0xdff4('0x73')]){var _0x31f03e={'method':_0xdff4('0x72'),'uri':_0x29b5f0,'qs':{'operation':_0xdff4('0x76'),'username':_0x272363,'sessionName':_0x932e3['result']['sessionName'],'elementType':_0x58f226},'json':!![]};return rp(_0x31f03e);}})[_0xdff4('0x22')](function(_0x79ba8e){if(_0x79ba8e[_0xdff4('0x73')]){var _0x1acc7d=[_0xdff4('0x77'),_0xdff4('0x78'),_0xdff4('0x79')];_[_0xdff4('0x7a')](_0x79ba8e['result']['fields'],function(_0x24d4d1){return _0x1acc7d[_0xdff4('0x7b')](_0x24d4d1[_0xdff4('0x4e')][_0xdff4('0x3f')]);});_['remove'](_0x79ba8e[_0xdff4('0x2b')]['fields'],function(_0x1fcff2){return _0x1fcff2[_0xdff4('0x7c')]===_0xdff4('0x7d');});return{'count':_0x79ba8e[_0xdff4('0x2b')][_0xdff4('0x44')]['length'],'rows':_[_0xdff4('0x39')](_0x79ba8e[_0xdff4('0x2b')][_0xdff4('0x44')],function(_0x179430){return{'id':_0x179430[_0xdff4('0x3f')],'name':_0x179430['label'],'custom':_['startsWith'](_0x179430[_0xdff4('0x3f')],_0xdff4('0x7e'))?!![]:![],'options':_0x179430['type'][_0xdff4('0x3f')]===_0xdff4('0x7f')&&_0x179430[_0xdff4('0x4e')][_0xdff4('0x80')][_0xdff4('0x46')]>0x0?_[_0xdff4('0x39')](_0x179430[_0xdff4('0x4e')][_0xdff4('0x80')],function(_0x3a6128){return{'name':_0x3a6128[_0xdff4('0x81')],'value':_0x3a6128[_0xdff4('0x82')]};}):[]};})};}})[_0xdff4('0x22')](respondWithResult(_0x1bbd42,null))[_0xdff4('0x2c')](function(_0x5531b3){console[_0xdff4('0x83')]('vTiger\x20error:\x20'+_0x5531b3);var _0x1d2322=_0x250145['query'][_0xdff4('0x84')]?0x1f4:_0x5531b3[_0xdff4('0x85')]||0x1f4;logger[_0xdff4('0x28')](_0xdff4('0x86'),_0xdff4('0x66'),_0x1d2322,JSON[_0xdff4('0x27')](_0x5531b3));delete _0x5531b3[_0xdff4('0x3f')];if(_0x1d2322===0x191){_0x1d2322=0x190;}_0x1bbd42[_0xdff4('0x2e')](_0x1d2322)[_0xdff4('0x38')](_0x250145[_0xdff4('0x41')][_0xdff4('0x84')]?{'message':'Wrong\x20credentials','statusCode':_0x5531b3[_0xdff4('0x85')]}:_0x5531b3);});}; \ No newline at end of file +var _0x10d1=['order','sort','pick','where','VIRTUAL','filter','merge','options','VtigerAccount','includeAll','include','show','params','keys','find','create','body','update','findOne','VtigerConfiguration','map','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','channel','VtigerField','getFields','username','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','login','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x308920,_0x2423a6){var _0x33efc4=function(_0x5369ef){while(--_0x5369ef){_0x308920['push'](_0x308920['shift']());}};_0x33efc4(++_0x2423a6);}(_0x10d1,0xb4));var _0x110d=function(_0x321c4e,_0x153c41){_0x321c4e=_0x321c4e-0x0;var _0x5436c3=_0x10d1[_0x321c4e];return _0x5436c3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x110d('0x0'));var zipdir=require(_0x110d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x110d('0x2'));var moment=require(_0x110d('0x3'));var BPromise=require(_0x110d('0x4'));var Mustache=require('mustache');var util=require(_0x110d('0x5'));var path=require(_0x110d('0x6'));var sox=require(_0x110d('0x7'));var csv=require(_0x110d('0x8'));var ejs=require(_0x110d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x110d('0xa'));var toCsv=require(_0x110d('0x8'));var querystring=require('querystring');var Papa=require(_0x110d('0xb'));var Redis=require(_0x110d('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x110d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x110d('0xe'));var logger=require(_0x110d('0xf'))('api');var utils=require(_0x110d('0x10'));var config=require(_0x110d('0x11'));var db=require(_0x110d('0x12'))['db'];var integrations=require(_0x110d('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x110d('0x14')][_0x110d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x287a3b,_0x50c527,_0x2a104f){if(_0x2a104f){var _0x14e388=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14e388[_0x110d('0x16')](_0x50c527)){return _0x287a3b;}else{throw new db[(_0x110d('0x17'))][(_0x110d('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 _0x287a3b;}}function respondWithRpcPromise(_0xccfcdb,_0x5adb0c,_0x32115e,_0x243aeb){return new BPromise(function(_0x2764ed,_0x5977d4){var _0x5a1ec7=_0x243aeb||client;return _0x5a1ec7['request'](_0xccfcdb,_0x32115e)[_0x110d('0x19')](function(_0x299856){logger[_0x110d('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x5adb0c,_0x110d('0x1b'));logger[_0x110d('0x1c')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5adb0c,_0x110d('0x1b'),JSON[_0x110d('0x1d')](_0x299856));if(_0x299856[_0x110d('0x1e')]){if(_0x299856[_0x110d('0x1e')][_0x110d('0x1f')]===0x1f4){logger[_0x110d('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x5adb0c,_0x299856[_0x110d('0x1e')]['message']);return _0x5977d4(_0x299856[_0x110d('0x1e')][_0x110d('0x20')]);}logger['error'](_0x110d('0x21'),_0x5adb0c,_0x299856[_0x110d('0x1e')]['message']);return _0x2764ed(_0x299856[_0x110d('0x1e')][_0x110d('0x20')]);}else{logger[_0x110d('0x1a')](_0x110d('0x21'),_0x5adb0c,_0x110d('0x1b'));_0x2764ed(_0x299856[_0x110d('0x22')][_0x110d('0x20')]);}})[_0x110d('0x23')](function(_0x4c541f){logger[_0x110d('0x1e')](_0x110d('0x21'),_0x5adb0c,_0x4c541f);_0x5977d4(_0x4c541f);});});}function respondWithStatusCode(_0x4a5a18,_0x248b7b){_0x248b7b=_0x248b7b||0xcc;return function(_0x53c1e2){if(_0x53c1e2){return _0x4a5a18[_0x110d('0x24')](_0x248b7b);}return _0x4a5a18[_0x110d('0x25')](_0x248b7b)[_0x110d('0x26')]();};}function respondWithResult(_0x3347c4,_0x19d271){_0x19d271=_0x19d271||0xc8;return function(_0x48e1b1){if(_0x48e1b1){return _0x3347c4['status'](_0x19d271)[_0x110d('0x27')](_0x48e1b1);}};}function respondWithFilteredResult(_0x112985,_0xd60f86){return function(_0x1a63e5){if(_0x1a63e5){var _0x291d10=_0x1a63e5[_0x110d('0x28')],_0x5a3710=_0xd60f86[_0x110d('0x29')],_0x1df804=_0xd60f86[_0x110d('0x29')]+_0xd60f86[_0x110d('0x2a')],_0x50bce4;if(_0x1df804>=_0x291d10){_0x1df804=_0x291d10;_0x50bce4=0xc8;}else{_0x50bce4=0xce;}_0x112985[_0x110d('0x25')](_0x50bce4);return _0x112985[_0x110d('0x2b')](_0x110d('0x2c'),_0x5a3710+'-'+_0x1df804+'/'+_0x291d10)['json'](_0x1a63e5);}return null;};}function patchUpdates(_0x1f2772){return function(_0x34e566){try{jsonpatch[_0x110d('0x2d')](_0x34e566,_0x1f2772,!![]);}catch(_0x386a65){return BPromise[_0x110d('0x2e')](_0x386a65);}return _0x34e566[_0x110d('0x2f')]();};}function saveUpdates(_0xccf597,_0x6d92d9){return function(_0x10ea84){if(_0x10ea84){return _0x10ea84['update'](_0xccf597)[_0x110d('0x19')](function(_0x50aeab){return _0x50aeab;});}return null;};}function removeEntity(_0x21704c,_0x3a94eb){return function(_0x37e8bf){if(_0x37e8bf){return _0x37e8bf[_0x110d('0x30')]()[_0x110d('0x19')](function(){_0x21704c[_0x110d('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9099,_0x10447c){return function(_0x2658bb){if(!_0x2658bb){_0x4a9099[_0x110d('0x24')](0x194);}return _0x2658bb;};}function handleError(_0x48e289,_0x5666b3){_0x5666b3=_0x5666b3||0x1f4;return function(_0x4eaf30){logger[_0x110d('0x1e')](_0x4eaf30['stack']);if(_0x4eaf30['name']){delete _0x4eaf30[_0x110d('0x31')];}_0x48e289[_0x110d('0x25')](_0x5666b3)[_0x110d('0x32')](_0x4eaf30);};}exports['index']=function(_0x79c574,_0x315116){var _0x44a81d={},_0x38dceb={},_0x4c75c7={'count':0x0,'rows':[]};var _0x205eab=_['map'](db['VtigerAccount'][_0x110d('0x33')],function(_0x4b4632){return{'name':_0x4b4632[_0x110d('0x34')],'type':_0x4b4632[_0x110d('0x35')]['key']};});_0x38dceb[_0x110d('0x36')]=_['map'](_0x205eab,_0x110d('0x31'));_0x38dceb['query']=_['keys'](_0x79c574[_0x110d('0x37')]);_0x38dceb[_0x110d('0x38')]=_[_0x110d('0x39')](_0x38dceb['model'],_0x38dceb[_0x110d('0x37')]);_0x44a81d[_0x110d('0x3a')]=_[_0x110d('0x39')](_0x38dceb[_0x110d('0x36')],qs['fields'](_0x79c574[_0x110d('0x37')][_0x110d('0x3b')]));_0x44a81d[_0x110d('0x3a')]=_0x44a81d['attributes'][_0x110d('0x3c')]?_0x44a81d[_0x110d('0x3a')]:_0x38dceb['model'];if(!_0x79c574[_0x110d('0x37')][_0x110d('0x3d')]('nolimit')){_0x44a81d[_0x110d('0x2a')]=qs['limit'](_0x79c574[_0x110d('0x37')]['limit']);_0x44a81d['offset']=qs['offset'](_0x79c574['query'][_0x110d('0x29')]);}_0x44a81d[_0x110d('0x3e')]=qs[_0x110d('0x3f')](_0x79c574['query']['sort']);_0x44a81d['where']=qs[_0x110d('0x38')](_[_0x110d('0x40')](_0x79c574['query'],_0x38dceb[_0x110d('0x38')]),_0x205eab);if(_0x79c574[_0x110d('0x37')]['filter']){_0x44a81d['where']=_['merge'](_0x44a81d[_0x110d('0x41')],{'$or':_['map'](_0x205eab,function(_0x10601d){if(_0x10601d['type']!==_0x110d('0x42')){var _0x141b4d={};_0x141b4d[_0x10601d[_0x110d('0x31')]]={'$like':'%'+_0x79c574[_0x110d('0x37')][_0x110d('0x43')]+'%'};return _0x141b4d;}})});}_0x44a81d=_[_0x110d('0x44')]({},_0x44a81d,_0x79c574[_0x110d('0x45')]);var _0x2b6c8d={'where':_0x44a81d['where']};return db[_0x110d('0x46')][_0x110d('0x28')](_0x2b6c8d)[_0x110d('0x19')](function(_0x4d0f67){_0x4c75c7[_0x110d('0x28')]=_0x4d0f67;if(_0x79c574[_0x110d('0x37')][_0x110d('0x47')]){_0x44a81d[_0x110d('0x48')]=[{'all':!![]}];}return db[_0x110d('0x46')]['findAll'](_0x44a81d);})[_0x110d('0x19')](function(_0x1a2e3b){_0x4c75c7['rows']=_0x1a2e3b;return _0x4c75c7;})[_0x110d('0x19')](respondWithFilteredResult(_0x315116,_0x44a81d))[_0x110d('0x23')](handleError(_0x315116,null));};exports[_0x110d('0x49')]=function(_0x2902e0,_0x3a6303){var _0x3524e3={'raw':![],'where':{'id':_0x2902e0[_0x110d('0x4a')]['id']}},_0x30e29b={};_0x30e29b['model']=_[_0x110d('0x4b')](db[_0x110d('0x46')][_0x110d('0x33')]);_0x30e29b[_0x110d('0x37')]=_[_0x110d('0x4b')](_0x2902e0[_0x110d('0x37')]);_0x30e29b['filters']=_['intersection'](_0x30e29b[_0x110d('0x36')],_0x30e29b[_0x110d('0x37')]);_0x3524e3[_0x110d('0x3a')]=_[_0x110d('0x39')](_0x30e29b[_0x110d('0x36')],qs[_0x110d('0x3b')](_0x2902e0[_0x110d('0x37')][_0x110d('0x3b')]));_0x3524e3['attributes']=_0x3524e3['attributes'][_0x110d('0x3c')]?_0x3524e3['attributes']:_0x30e29b[_0x110d('0x36')];if(_0x2902e0[_0x110d('0x37')][_0x110d('0x47')]){_0x3524e3[_0x110d('0x48')]=[{'all':!![]}];}_0x3524e3=_['merge']({},_0x3524e3,_0x2902e0[_0x110d('0x45')]);return db[_0x110d('0x46')][_0x110d('0x4c')](_0x3524e3)['then'](handleEntityNotFound(_0x3a6303,null))[_0x110d('0x19')](respondWithResult(_0x3a6303,null))[_0x110d('0x23')](handleError(_0x3a6303,null));};exports[_0x110d('0x4d')]=function(_0x392409,_0x58f2ee){return db['VtigerAccount'][_0x110d('0x4d')](_0x392409[_0x110d('0x4e')],{})[_0x110d('0x19')](respondWithResult(_0x58f2ee,0xc9))[_0x110d('0x23')](handleError(_0x58f2ee,null));};exports[_0x110d('0x4f')]=function(_0x1609f7,_0x3fdef0){if(_0x1609f7['body']['id']){delete _0x1609f7[_0x110d('0x4e')]['id'];}return db[_0x110d('0x46')]['find']({'where':{'id':_0x1609f7[_0x110d('0x4a')]['id']}})[_0x110d('0x19')](handleEntityNotFound(_0x3fdef0,null))[_0x110d('0x19')](saveUpdates(_0x1609f7[_0x110d('0x4e')],null))[_0x110d('0x19')](respondWithResult(_0x3fdef0,null))['catch'](handleError(_0x3fdef0,null));};exports[_0x110d('0x30')]=function(_0x3b16df,_0x33f0a6){return db[_0x110d('0x46')][_0x110d('0x4c')]({'where':{'id':_0x3b16df[_0x110d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33f0a6,null))[_0x110d('0x19')](removeEntity(_0x33f0a6,null))[_0x110d('0x23')](handleError(_0x33f0a6,null));};exports['getConfigurations']=function(_0x47d96e,_0x59451f,_0x31d975){var _0x3c4193={};var _0x2554f={};var _0x49112e;var _0x27b87b;return db[_0x110d('0x46')][_0x110d('0x50')]({'where':{'id':_0x47d96e[_0x110d('0x4a')]['id']}})[_0x110d('0x19')](handleEntityNotFound(_0x59451f,null))[_0x110d('0x19')](function(_0x444d61){if(_0x444d61){_0x49112e=_0x444d61;_0x2554f[_0x110d('0x36')]=_['keys'](db[_0x110d('0x51')]['rawAttributes']);_0x2554f[_0x110d('0x37')]=_['keys'](_0x47d96e[_0x110d('0x37')]);_0x2554f[_0x110d('0x38')]=_[_0x110d('0x39')](_0x2554f['model'],_0x2554f[_0x110d('0x37')]);_0x3c4193[_0x110d('0x3a')]=_[_0x110d('0x39')](_0x2554f[_0x110d('0x36')],qs[_0x110d('0x3b')](_0x47d96e[_0x110d('0x37')]['fields']));_0x3c4193[_0x110d('0x3a')]=_0x3c4193[_0x110d('0x3a')][_0x110d('0x3c')]?_0x3c4193[_0x110d('0x3a')]:_0x2554f[_0x110d('0x36')];_0x3c4193[_0x110d('0x3e')]=qs[_0x110d('0x3f')](_0x47d96e[_0x110d('0x37')][_0x110d('0x3f')]);_0x3c4193[_0x110d('0x41')]=qs[_0x110d('0x38')](_[_0x110d('0x40')](_0x47d96e['query'],_0x2554f[_0x110d('0x38')]));if(_0x47d96e[_0x110d('0x37')][_0x110d('0x43')]){_0x3c4193[_0x110d('0x41')]=_[_0x110d('0x44')](_0x3c4193[_0x110d('0x41')],{'$or':_[_0x110d('0x52')](_0x3c4193[_0x110d('0x3a')],function(_0x405bda){var _0x4b08ec={};_0x4b08ec[_0x405bda]={'$like':'%'+_0x47d96e[_0x110d('0x37')][_0x110d('0x43')]+'%'};return _0x4b08ec;})});}_0x3c4193=_['merge']({},_0x3c4193,_0x47d96e['options']);return _0x49112e[_0x110d('0x53')](_0x3c4193);}})[_0x110d('0x19')](function(_0x3a0abf){if(_0x3a0abf){_0x27b87b=_0x3a0abf[_0x110d('0x3c')];if(!_0x47d96e['query'][_0x110d('0x3d')](_0x110d('0x54'))){_0x3c4193['limit']=qs[_0x110d('0x2a')](_0x47d96e[_0x110d('0x37')][_0x110d('0x2a')]);_0x3c4193[_0x110d('0x29')]=qs[_0x110d('0x29')](_0x47d96e[_0x110d('0x37')]['offset']);}return _0x49112e[_0x110d('0x53')](_0x3c4193);}})['then'](function(_0x465184){if(_0x465184){return _0x465184?{'count':_0x27b87b,'rows':_0x465184}:null;}})[_0x110d('0x19')](respondWithResult(_0x59451f,null))[_0x110d('0x23')](handleError(_0x59451f,null));};exports['addConfiguration']=function(_0x2161fc,_0xb74b39,_0x5c8751){if(_0x2161fc[_0x110d('0x4e')]['id']){delete _0x2161fc['body']['id'];}return db[_0x110d('0x46')][_0x110d('0x50')]({'where':{'id':_0x2161fc[_0x110d('0x4a')]['id']}})[_0x110d('0x19')](handleEntityNotFound(_0xb74b39,null))['then'](function(_0xc33314){if(_0xc33314){_0x2161fc[_0x110d('0x4e')][_0x110d('0x55')]=_0xc33314['id'];_0x2161fc[_0x110d('0x4e')][_0x110d('0x56')]=integrations[_0x110d('0x57')](_0x2161fc[_0x110d('0x4e')]['channel'],_0x2161fc[_0x110d('0x4e')]['type']);_0x2161fc['body'][_0x110d('0x58')]=integrations['getDescriptions'](_0x2161fc[_0x110d('0x4e')][_0x110d('0x59')],_0x2161fc[_0x110d('0x4e')][_0x110d('0x35')]);return db[_0x110d('0x51')][_0x110d('0x4d')](_0x2161fc[_0x110d('0x4e')],{'include':[{'model':db[_0x110d('0x5a')],'as':_0x110d('0x56')},{'model':db['VtigerField'],'as':_0x110d('0x58')}]});}return null;})[_0x110d('0x19')](respondWithResult(_0xb74b39,null))['catch'](handleError(_0xb74b39,null));};var md5=require('md5');exports[_0x110d('0x5b')]=function(_0x4a570e,_0x281416,_0x23fc80){var _0x157989=null;var _0x1fba99=null;var _0x1635a6=null;var _0x513d5d=null;var _0x2a5f5e='';return db[_0x110d('0x46')]['findOne']({'where':{'id':_0x4a570e[_0x110d('0x4a')]['id']},'attributes':['id',_0x110d('0x31'),_0x110d('0x5c'),'description','moduleName',_0x110d('0x5d'),_0x110d('0x5e'),_0x110d('0x5f')]})[_0x110d('0x19')](handleEntityNotFound(_0x281416,null))[_0x110d('0x19')](function(_0x2ec67b){if(_0x2ec67b){_0x157989=_0x2ec67b[_0x110d('0x5c')];_0x1fba99=_0x2ec67b[_0x110d('0x5f')];_0x1635a6=_0x2ec67b[_0x110d('0x60')];_0x2a5f5e=_0x2ec67b[_0x110d('0x5d')];var _0x4d2ca7=_0x2a5f5e[_0x110d('0x61')](-0x1);if(_0x4d2ca7==='/'){_0x2a5f5e=_0x2a5f5e['substring'](0x0,_0x2a5f5e[_0x110d('0x62')](_0x4d2ca7));}_0x513d5d=util['format'](_0x110d('0x63'),_0x2a5f5e);var _0x3cbfff={'method':_0x110d('0x64'),'uri':_0x513d5d,'qs':{'operation':_0x110d('0x65'),'username':_0x2ec67b[_0x110d('0x5c')]},'json':!![]};return rp(_0x3cbfff);}})[_0x110d('0x19')](function(_0x7169cd){if(_0x7169cd[_0x110d('0x66')]){var _0x15562c={'method':'POST','uri':_0x513d5d,'form':{'operation':_0x110d('0x67'),'username':_0x157989,'accessKey':md5(_0x7169cd[_0x110d('0x22')]['token']+_0x1fba99)},'json':!![]};return rp(_0x15562c);}})['then'](function(_0x38b25e){if(_0x38b25e[_0x110d('0x66')]){var _0x5a597a={'method':_0x110d('0x64'),'uri':_0x513d5d,'qs':{'operation':'describe','username':_0x157989,'sessionName':_0x38b25e[_0x110d('0x22')][_0x110d('0x68')],'elementType':_0x1635a6},'json':!![]};return rp(_0x5a597a);}})[_0x110d('0x19')](function(_0x2e3ac0){if(_0x2e3ac0['success']){var _0x481ef9=[_0x110d('0x69'),_0x110d('0x6a'),_0x110d('0x6b')];_[_0x110d('0x6c')](_0x2e3ac0['result'][_0x110d('0x3b')],function(_0x31c143){return _0x481ef9[_0x110d('0x6d')](_0x31c143['type']['name']);});_[_0x110d('0x6c')](_0x2e3ac0[_0x110d('0x22')][_0x110d('0x3b')],function(_0x54f0dc){return _0x54f0dc[_0x110d('0x6e')]===_0x110d('0x6f');});return{'count':_0x2e3ac0[_0x110d('0x22')][_0x110d('0x3b')][_0x110d('0x3c')],'rows':_['map'](_0x2e3ac0[_0x110d('0x22')][_0x110d('0x3b')],function(_0x42aa91){return{'id':_0x42aa91['name'],'name':_0x42aa91[_0x110d('0x70')],'custom':_['startsWith'](_0x42aa91['name'],_0x110d('0x71'))?!![]:![],'options':_0x42aa91[_0x110d('0x35')][_0x110d('0x31')]===_0x110d('0x72')&&_0x42aa91['type'][_0x110d('0x73')][_0x110d('0x3c')]>0x0?_[_0x110d('0x52')](_0x42aa91['type'][_0x110d('0x73')],function(_0x4581a2){return{'name':_0x4581a2[_0x110d('0x70')],'value':_0x4581a2[_0x110d('0x74')]};}):[]};})};}})['then'](respondWithResult(_0x281416,null))['catch'](function(_0x1df8b0){console[_0x110d('0x75')](_0x110d('0x76')+_0x1df8b0);var _0x359106=_0x4a570e[_0x110d('0x37')][_0x110d('0x16')]?0x1f4:_0x1df8b0['statusCode']||0x1f4;logger[_0x110d('0x1e')](_0x110d('0x77'),'getFields',_0x359106,JSON[_0x110d('0x1d')](_0x1df8b0));delete _0x1df8b0[_0x110d('0x31')];if(_0x359106===0x191){_0x359106=0x190;}_0x281416[_0x110d('0x25')](_0x359106)[_0x110d('0x32')](_0x4a570e[_0x110d('0x37')][_0x110d('0x16')]?{'message':_0x110d('0x78'),'statusCode':_0x1df8b0['statusCode']}:_0x1df8b0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c0493d0..8c67216 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 _0xabd2=['rimraf','../../config/environment','exports','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3701d7,_0x219031){var _0x1a33a3=function(_0x57067e){while(--_0x57067e){_0x3701d7['push'](_0x3701d7['shift']());}};_0x1a33a3(++_0x219031);}(_0xabd2,0x93));var _0x2abd=function(_0x45d77c,_0x11d4cf){_0x45d77c=_0x45d77c-0x0;var _0x12d62f=_0xabd2[_0x45d77c];return _0x12d62f;};'use strict';var _=require(_0x2abd('0x0'));var util=require('util');var logger=require(_0x2abd('0x1'))(_0x2abd('0x2'));var moment=require(_0x2abd('0x3'));var BPromise=require(_0x2abd('0x4'));var rp=require(_0x2abd('0x5'));var fs=require('fs');var path=require(_0x2abd('0x6'));var rimraf=require(_0x2abd('0x7'));var config=require(_0x2abd('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2abd('0x9')]=function(_0x3adbcd,_0x454057){return _0x3adbcd['define']('VtigerAccount',attributes,{'tableName':_0x2abd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae43=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x2ad1d0,_0x52a337){var _0x17e0e7=function(_0xfcd718){while(--_0xfcd718){_0x2ad1d0['push'](_0x2ad1d0['shift']());}};_0x17e0e7(++_0x52a337);}(_0xae43,0x11f));var _0x3ae4=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xae43[_0x256e32];return _0x464070;};'use strict';var _=require(_0x3ae4('0x0'));var util=require(_0x3ae4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3ae4('0x2'));var BPromise=require(_0x3ae4('0x3'));var rp=require(_0x3ae4('0x4'));var fs=require('fs');var path=require(_0x3ae4('0x5'));var rimraf=require(_0x3ae4('0x6'));var config=require(_0x3ae4('0x7'));var attributes=require(_0x3ae4('0x8'));var integrations=require(_0x3ae4('0x9'));module[_0x3ae4('0xa')]=function(_0xd9c8e6,_0x8dc925){return _0xd9c8e6[_0x3ae4('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index d9e12ce..fb1a962 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 _0x9a2c=['client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','where','attributes','limit','include','map','model','VtigerAccount','find','raw','ShowVtigerAccount','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37e1be,_0x364dd8){var _0x23ca0=function(_0x3d6330){while(--_0x3d6330){_0x37e1be['push'](_0x37e1be['shift']());}};_0x23ca0(++_0x364dd8);}(_0x9a2c,0x183));var _0xc9a2=function(_0x4e63ad,_0x463e55){_0x4e63ad=_0x4e63ad-0x0;var _0x10c5d4=_0x9a2c[_0x4e63ad];return _0x10c5d4;};'use strict';var _=require(_0xc9a2('0x0'));var util=require('util');var moment=require(_0xc9a2('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9a2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9a2('0x3'))['db'];var utils=require(_0xc9a2('0x4'));var logger=require(_0xc9a2('0x5'))(_0xc9a2('0x6'));var config=require(_0xc9a2('0x7'));var jayson=require(_0xc9a2('0x8'));var client=jayson[_0xc9a2('0x9')][_0xc9a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588702,_0x132522,_0x1de322){return new BPromise(function(_0x4259f9,_0x275024){return client[_0xc9a2('0xb')](_0x588702,_0x1de322)[_0xc9a2('0xc')](function(_0x4bcdeb){logger[_0xc9a2('0xd')](_0xc9a2('0xe'),_0x132522,_0xc9a2('0xf'));logger[_0xc9a2('0x10')](_0xc9a2('0x11'),_0x132522,'request\x20sent',JSON[_0xc9a2('0x12')](_0x4bcdeb));if(_0x4bcdeb[_0xc9a2('0x13')]){if(_0x4bcdeb[_0xc9a2('0x13')][_0xc9a2('0x14')]===0x1f4){logger[_0xc9a2('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x132522,_0x4bcdeb['error'][_0xc9a2('0x15')]);return _0x275024(_0x4bcdeb[_0xc9a2('0x13')][_0xc9a2('0x15')]);}logger[_0xc9a2('0x13')](_0xc9a2('0xe'),_0x132522,_0x4bcdeb[_0xc9a2('0x13')][_0xc9a2('0x15')]);return _0x4259f9(_0x4bcdeb[_0xc9a2('0x13')][_0xc9a2('0x15')]);}else{logger['info'](_0xc9a2('0xe'),_0x132522,_0xc9a2('0xf'));_0x4259f9(_0x4bcdeb['result'][_0xc9a2('0x15')]);}})[_0xc9a2('0x16')](function(_0x349c29){logger[_0xc9a2('0x13')](_0xc9a2('0xe'),_0x132522,_0x349c29);_0x275024(_0x349c29);});});}exports[_0xc9a2('0x17')]=function(_0x116c63){var _0x2defae=this;return new Promise(function(_0x359a94,_0x203acd){return db['VtigerAccount'][_0xc9a2('0x18')]({'raw':_0x116c63[_0xc9a2('0x19')]?_0x116c63[_0xc9a2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x116c63[_0xc9a2('0x19')]?_0x116c63[_0xc9a2('0x19')][_0xc9a2('0x1a')]||null:null,'attributes':_0x116c63[_0xc9a2('0x19')]?_0x116c63[_0xc9a2('0x19')][_0xc9a2('0x1b')]||null:null,'limit':_0x116c63['options']?_0x116c63[_0xc9a2('0x19')][_0xc9a2('0x1c')]||null:null,'include':_0x116c63[_0xc9a2('0x19')]?_0x116c63['options'][_0xc9a2('0x1d')]?_[_0xc9a2('0x1e')](_0x116c63[_0xc9a2('0x19')]['include'],function(_0x452b12){return{'model':db[_0x452b12['model']],'as':_0x452b12['as'],'attributes':_0x452b12[_0xc9a2('0x1b')],'include':_0x452b12[_0xc9a2('0x1d')]?_['map'](_0x452b12['include'],function(_0x45f33a){return{'model':db[_0x45f33a[_0xc9a2('0x1f')]],'as':_0x45f33a['as'],'attributes':_0x45f33a[_0xc9a2('0x1b')],'include':_0x45f33a[_0xc9a2('0x1d')]?_[_0xc9a2('0x1e')](_0x45f33a['include'],function(_0xf6387e){return{'model':db[_0xf6387e[_0xc9a2('0x1f')]],'as':_0xf6387e['as'],'attributes':_0xf6387e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9a2('0xc')](function(_0x3cc813){logger[_0xc9a2('0xd')]('GetVtigerAccount',_0x116c63);logger[_0xc9a2('0x10')](_0xc9a2('0x17'),_0x116c63,JSON['stringify'](_0x3cc813));_0x359a94(_0x3cc813);})[_0xc9a2('0x16')](function(_0x315561){logger['error']('GetVtigerAccount',_0x315561['message'],_0x116c63);_0x203acd(_0x2defae[_0xc9a2('0x13')](0x1f4,_0x315561[_0xc9a2('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x5d3a2b){var _0x491619=this;return new Promise(function(_0x3f93f6,_0x251b73){return db[_0xc9a2('0x20')][_0xc9a2('0x21')]({'raw':_0x5d3a2b[_0xc9a2('0x19')]?_0x5d3a2b[_0xc9a2('0x19')][_0xc9a2('0x22')]===undefined?!![]:![]:!![],'where':_0x5d3a2b[_0xc9a2('0x19')]?_0x5d3a2b[_0xc9a2('0x19')]['where']||null:null,'attributes':_0x5d3a2b[_0xc9a2('0x19')]?_0x5d3a2b[_0xc9a2('0x19')]['attributes']||null:null,'include':_0x5d3a2b[_0xc9a2('0x19')]?_0x5d3a2b[_0xc9a2('0x19')][_0xc9a2('0x1d')]?_['map'](_0x5d3a2b['options'][_0xc9a2('0x1d')],function(_0x28965e){return{'model':db[_0x28965e[_0xc9a2('0x1f')]],'as':_0x28965e['as'],'attributes':_0x28965e[_0xc9a2('0x1b')],'include':_0x28965e[_0xc9a2('0x1d')]?_[_0xc9a2('0x1e')](_0x28965e[_0xc9a2('0x1d')],function(_0x27670d){return{'model':db[_0x27670d['model']],'as':_0x27670d['as'],'attributes':_0x27670d[_0xc9a2('0x1b')],'include':_0x27670d['include']?_['map'](_0x27670d['include'],function(_0x243553){return{'model':db[_0x243553['model']],'as':_0x243553['as'],'attributes':_0x243553[_0xc9a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc9a2('0xc')](function(_0x36a62c){logger['info'](_0xc9a2('0x23'),_0x5d3a2b);logger[_0xc9a2('0x10')](_0xc9a2('0x23'),_0x5d3a2b,JSON['stringify'](_0x36a62c));_0x3f93f6(_0x36a62c);})[_0xc9a2('0x16')](function(_0x133d71){logger[_0xc9a2('0x13')](_0xc9a2('0x23'),_0x133d71[_0xc9a2('0x15')],_0x5d3a2b);_0x251b73(_0x491619[_0xc9a2('0x13')](0x1f4,_0x133d71[_0xc9a2('0x15')]));});});}; \ No newline at end of file +var _0xdf0b=['options','raw','where','attributes','limit','include','model','map','catch','find','ShowVtigerAccount','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','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'];(function(_0x2eb2ba,_0x1cbec1){var _0x489458=function(_0x1ea024){while(--_0x1ea024){_0x2eb2ba['push'](_0x2eb2ba['shift']());}};_0x489458(++_0x1cbec1);}(_0xdf0b,0x146));var _0xbdf0=function(_0x3712a8,_0x5895df){_0x3712a8=_0x3712a8-0x0;var _0x362383=_0xdf0b[_0x3712a8];return _0x362383;};'use strict';var _=require(_0xbdf0('0x0'));var util=require(_0xbdf0('0x1'));var moment=require(_0xbdf0('0x2'));var BPromise=require(_0xbdf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdf0('0x4'));var logger=require(_0xbdf0('0x5'))(_0xbdf0('0x6'));var config=require(_0xbdf0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbdf0('0x8')][_0xbdf0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17fc5b,_0x46afc2,_0x37e4e0){return new BPromise(function(_0x506ccf,_0x1aa2f0){return client[_0xbdf0('0xa')](_0x17fc5b,_0x37e4e0)[_0xbdf0('0xb')](function(_0x367a82){logger[_0xbdf0('0xc')](_0xbdf0('0xd'),_0x46afc2,_0xbdf0('0xe'));logger[_0xbdf0('0xf')](_0xbdf0('0x10'),_0x46afc2,_0xbdf0('0xe'),JSON['stringify'](_0x367a82));if(_0x367a82['error']){if(_0x367a82[_0xbdf0('0x11')][_0xbdf0('0x12')]===0x1f4){logger[_0xbdf0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x46afc2,_0x367a82[_0xbdf0('0x11')][_0xbdf0('0x13')]);return _0x1aa2f0(_0x367a82[_0xbdf0('0x11')][_0xbdf0('0x13')]);}logger[_0xbdf0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x46afc2,_0x367a82['error'][_0xbdf0('0x13')]);return _0x506ccf(_0x367a82[_0xbdf0('0x11')][_0xbdf0('0x13')]);}else{logger[_0xbdf0('0xc')](_0xbdf0('0xd'),_0x46afc2,_0xbdf0('0xe'));_0x506ccf(_0x367a82[_0xbdf0('0x14')][_0xbdf0('0x13')]);}})['catch'](function(_0x5e0445){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x46afc2,_0x5e0445);_0x1aa2f0(_0x5e0445);});});}exports[_0xbdf0('0x15')]=function(_0x1dd554){var _0x586272=this;return new Promise(function(_0xa285d,_0x43f820){return db[_0xbdf0('0x16')][_0xbdf0('0x17')]({'raw':_0x1dd554[_0xbdf0('0x18')]?_0x1dd554[_0xbdf0('0x18')][_0xbdf0('0x19')]===undefined?!![]:![]:!![],'where':_0x1dd554[_0xbdf0('0x18')]?_0x1dd554[_0xbdf0('0x18')][_0xbdf0('0x1a')]||null:null,'attributes':_0x1dd554['options']?_0x1dd554[_0xbdf0('0x18')][_0xbdf0('0x1b')]||null:null,'limit':_0x1dd554['options']?_0x1dd554['options'][_0xbdf0('0x1c')]||null:null,'include':_0x1dd554['options']?_0x1dd554[_0xbdf0('0x18')][_0xbdf0('0x1d')]?_['map'](_0x1dd554[_0xbdf0('0x18')][_0xbdf0('0x1d')],function(_0x681ff1){return{'model':db[_0x681ff1[_0xbdf0('0x1e')]],'as':_0x681ff1['as'],'attributes':_0x681ff1[_0xbdf0('0x1b')],'include':_0x681ff1[_0xbdf0('0x1d')]?_[_0xbdf0('0x1f')](_0x681ff1['include'],function(_0x3e8e19){return{'model':db[_0x3e8e19[_0xbdf0('0x1e')]],'as':_0x3e8e19['as'],'attributes':_0x3e8e19['attributes'],'include':_0x3e8e19['include']?_['map'](_0x3e8e19[_0xbdf0('0x1d')],function(_0x9fdd1f){return{'model':db[_0x9fdd1f[_0xbdf0('0x1e')]],'as':_0x9fdd1f['as'],'attributes':_0x9fdd1f[_0xbdf0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbdf0('0xb')](function(_0x2067d0){logger[_0xbdf0('0xc')](_0xbdf0('0x15'),_0x1dd554);logger[_0xbdf0('0xf')](_0xbdf0('0x15'),_0x1dd554,JSON['stringify'](_0x2067d0));_0xa285d(_0x2067d0);})[_0xbdf0('0x20')](function(_0x1c5726){logger[_0xbdf0('0x11')](_0xbdf0('0x15'),_0x1c5726['message'],_0x1dd554);_0x43f820(_0x586272[_0xbdf0('0x11')](0x1f4,_0x1c5726['message']));});});};exports['ShowVtigerAccount']=function(_0x4e6763){var _0x23ec0f=this;return new Promise(function(_0x54df45,_0x1dc17b){return db[_0xbdf0('0x16')][_0xbdf0('0x21')]({'raw':_0x4e6763['options']?_0x4e6763['options'][_0xbdf0('0x19')]===undefined?!![]:![]:!![],'where':_0x4e6763['options']?_0x4e6763['options'][_0xbdf0('0x1a')]||null:null,'attributes':_0x4e6763['options']?_0x4e6763[_0xbdf0('0x18')][_0xbdf0('0x1b')]||null:null,'include':_0x4e6763[_0xbdf0('0x18')]?_0x4e6763[_0xbdf0('0x18')][_0xbdf0('0x1d')]?_['map'](_0x4e6763[_0xbdf0('0x18')][_0xbdf0('0x1d')],function(_0x203adc){return{'model':db[_0x203adc['model']],'as':_0x203adc['as'],'attributes':_0x203adc[_0xbdf0('0x1b')],'include':_0x203adc['include']?_[_0xbdf0('0x1f')](_0x203adc[_0xbdf0('0x1d')],function(_0x4dd2e8){return{'model':db[_0x4dd2e8[_0xbdf0('0x1e')]],'as':_0x4dd2e8['as'],'attributes':_0x4dd2e8['attributes'],'include':_0x4dd2e8['include']?_[_0xbdf0('0x1f')](_0x4dd2e8[_0xbdf0('0x1d')],function(_0x1708c1){return{'model':db[_0x1708c1['model']],'as':_0x1708c1['as'],'attributes':_0x1708c1['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdf0('0xb')](function(_0xf0d9df){logger[_0xbdf0('0xc')](_0xbdf0('0x22'),_0x4e6763);logger[_0xbdf0('0xf')](_0xbdf0('0x22'),_0x4e6763,JSON['stringify'](_0xf0d9df));_0x54df45(_0xf0d9df);})['catch'](function(_0x352b4a){logger[_0xbdf0('0x11')](_0xbdf0('0x22'),_0x352b4a[_0xbdf0('0x13')],_0x4e6763);_0x1dc17b(_0x23ec0f['error'](0x1f4,_0x352b4a[_0xbdf0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 71eef21..231bb12 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(_0x14b02a,_0x12ce8b){var _0x5e4feb=function(_0x317e14){while(--_0x317e14){_0x14b02a['push'](_0x14b02a['shift']());}};_0x5e4feb(++_0x12ce8b);}(_0xb10b,0x12a));var _0xbb10=function(_0x236ac8,_0xa798d6){_0x236ac8=_0x236ac8-0x0;var _0x1ff538=_0xb10b[_0x236ac8];return _0x1ff538;};'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(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_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 f107327..5b43d8b 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 _0x3114=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3114,0xd3));var _0x4311=function(_0x2c4082,_0x45c1f6){_0x2c4082=_0x2c4082-0x0;var _0x150496=_0x3114[_0x2c4082];return _0x150496;};'use strict';var Sequelize=require(_0x4311('0x0'));module[_0x4311('0x1')]={'name':{'type':Sequelize[_0x4311('0x2')]},'description':{'type':Sequelize[_0x4311('0x2')]}}; \ No newline at end of file +var _0xf4c4=['STRING'];(function(_0x2a77ad,_0x2c8f64){var _0x1b4036=function(_0x5af6c3){while(--_0x5af6c3){_0x2a77ad['push'](_0x2a77ad['shift']());}};_0x1b4036(++_0x2c8f64);}(_0xf4c4,0x96));var _0x4f4c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf4c4[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f4c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4e8b6b3..ccf25c5 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 _0xccb3=['create','body','destroy','findOne','VtigerField','options','getFields','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','status','sendStatus','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','findAll','rows','show','params','includeAll','include','find'];(function(_0x4cea3e,_0xdff625){var _0x12b816=function(_0x18b24b){while(--_0x18b24b){_0x4cea3e['push'](_0x4cea3e['shift']());}};_0x12b816(++_0xdff625);}(_0xccb3,0xca));var _0x3ccb=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xccb3[_0x453e2b];return _0x50f306;};'use strict';var pdf=require(_0x3ccb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ccb('0x1'));var zipdir=require(_0x3ccb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ccb('0x3'));var BPromise=require(_0x3ccb('0x4'));var Mustache=require('mustache');var util=require(_0x3ccb('0x5'));var path=require(_0x3ccb('0x6'));var sox=require(_0x3ccb('0x7'));var csv=require(_0x3ccb('0x8'));var ejs=require(_0x3ccb('0x9'));var fs=require('fs');var _=require(_0x3ccb('0xa'));var squel=require(_0x3ccb('0xb'));var crypto=require(_0x3ccb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3ccb('0xd'));var toCsv=require(_0x3ccb('0x8'));var querystring=require(_0x3ccb('0xe'));var Papa=require(_0x3ccb('0xf'));var Redis=require(_0x3ccb('0x10'));var authService=require(_0x3ccb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ccb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ccb('0x13'))(_0x3ccb('0x14'));var utils=require(_0x3ccb('0x15'));var config=require('../../config/environment');var db=require(_0x3ccb('0x16'))['db'];var jayson=require(_0x3ccb('0x17'));var client=jayson[_0x3ccb('0x18')][_0x3ccb('0x19')]({'port':0x232a});function checkPasswordPattern(_0x41e55c,_0x4ee266,_0x1bd3d1){if(_0x1bd3d1){var _0x3b07ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b07ee[_0x3ccb('0x1a')](_0x4ee266)){return _0x41e55c;}else{throw new db['Sequelize'][(_0x3ccb('0x1b'))](_0x3ccb('0x1c'));}}else{return _0x41e55c;}}function respondWithRpcPromise(_0x348e05,_0x511ebf,_0x2a8b7e,_0x5b6961){return new BPromise(function(_0x3d4a24,_0x1d30f2){var _0x41405d=_0x5b6961||client;return _0x41405d[_0x3ccb('0x1d')](_0x348e05,_0x2a8b7e)[_0x3ccb('0x1e')](function(_0x294ba6){logger[_0x3ccb('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x511ebf,_0x3ccb('0x20'));logger[_0x3ccb('0x21')](_0x3ccb('0x22'),_0x511ebf,_0x3ccb('0x20'),JSON[_0x3ccb('0x23')](_0x294ba6));if(_0x294ba6[_0x3ccb('0x24')]){if(_0x294ba6[_0x3ccb('0x24')][_0x3ccb('0x25')]===0x1f4){logger[_0x3ccb('0x24')](_0x3ccb('0x26'),_0x511ebf,_0x294ba6[_0x3ccb('0x24')][_0x3ccb('0x27')]);return _0x1d30f2(_0x294ba6[_0x3ccb('0x24')][_0x3ccb('0x27')]);}logger[_0x3ccb('0x24')](_0x3ccb('0x26'),_0x511ebf,_0x294ba6[_0x3ccb('0x24')]['message']);return _0x3d4a24(_0x294ba6['error'][_0x3ccb('0x27')]);}else{logger[_0x3ccb('0x1f')](_0x3ccb('0x26'),_0x511ebf,_0x3ccb('0x20'));_0x3d4a24(_0x294ba6[_0x3ccb('0x28')][_0x3ccb('0x27')]);}})[_0x3ccb('0x29')](function(_0x5b0caa){logger[_0x3ccb('0x24')](_0x3ccb('0x26'),_0x511ebf,_0x5b0caa);_0x1d30f2(_0x5b0caa);});});}function respondWithStatusCode(_0x121488,_0xb20cd2){_0xb20cd2=_0xb20cd2||0xcc;return function(_0x25987c){if(_0x25987c){return _0x121488['sendStatus'](_0xb20cd2);}return _0x121488['status'](_0xb20cd2)[_0x3ccb('0x2a')]();};}function respondWithResult(_0x544611,_0x2941d1){_0x2941d1=_0x2941d1||0xc8;return function(_0x541034){if(_0x541034){return _0x544611['status'](_0x2941d1)[_0x3ccb('0x2b')](_0x541034);}};}function respondWithFilteredResult(_0x2f0adb,_0xb303a4){return function(_0x4938ac){if(_0x4938ac){var _0x2d042d=_0x4938ac[_0x3ccb('0x2c')],_0x4db1bc=_0xb303a4['offset'],_0x465b81=_0xb303a4[_0x3ccb('0x2d')]+_0xb303a4[_0x3ccb('0x2e')],_0x288261;if(_0x465b81>=_0x2d042d){_0x465b81=_0x2d042d;_0x288261=0xc8;}else{_0x288261=0xce;}_0x2f0adb['status'](_0x288261);return _0x2f0adb[_0x3ccb('0x2f')](_0x3ccb('0x30'),_0x4db1bc+'-'+_0x465b81+'/'+_0x2d042d)[_0x3ccb('0x2b')](_0x4938ac);}return null;};}function patchUpdates(_0x5eb9ac){return function(_0x533cf3){try{jsonpatch[_0x3ccb('0x31')](_0x533cf3,_0x5eb9ac,!![]);}catch(_0x4df1d6){return BPromise[_0x3ccb('0x32')](_0x4df1d6);}return _0x533cf3[_0x3ccb('0x33')]();};}function saveUpdates(_0x560168,_0x4d870d){return function(_0x4fd2e0){if(_0x4fd2e0){return _0x4fd2e0[_0x3ccb('0x34')](_0x560168)[_0x3ccb('0x1e')](function(_0x5f063a){return _0x5f063a;});}return null;};}function removeEntity(_0x2c8f25,_0x40949c){return function(_0x150aba){if(_0x150aba){return _0x150aba['destroy']()[_0x3ccb('0x1e')](function(){_0x2c8f25[_0x3ccb('0x35')](0xcc)[_0x3ccb('0x2a')]();});}};}function handleEntityNotFound(_0x1f6841,_0x46d116){return function(_0x35d5fb){if(!_0x35d5fb){_0x1f6841[_0x3ccb('0x36')](0x194);}return _0x35d5fb;};}function handleError(_0x582068,_0x4ef4c3){_0x4ef4c3=_0x4ef4c3||0x1f4;return function(_0x24a9fb){logger[_0x3ccb('0x24')](_0x24a9fb[_0x3ccb('0x37')]);if(_0x24a9fb[_0x3ccb('0x38')]){delete _0x24a9fb['name'];}_0x582068['status'](_0x4ef4c3)[_0x3ccb('0x39')](_0x24a9fb);};}exports['index']=function(_0x1dea19,_0x377b0c){var _0x545c88={},_0x2ef56b={},_0x357cf9={'count':0x0,'rows':[]};var _0xc95282=_[_0x3ccb('0x3a')](db[_0x3ccb('0x3b')][_0x3ccb('0x3c')],function(_0x3298a7){return{'name':_0x3298a7[_0x3ccb('0x3d')],'type':_0x3298a7[_0x3ccb('0x3e')][_0x3ccb('0x3f')]};});_0x2ef56b[_0x3ccb('0x40')]=_['map'](_0xc95282,_0x3ccb('0x38'));_0x2ef56b['query']=_[_0x3ccb('0x41')](_0x1dea19[_0x3ccb('0x42')]);_0x2ef56b[_0x3ccb('0x43')]=_[_0x3ccb('0x44')](_0x2ef56b[_0x3ccb('0x40')],_0x2ef56b['query']);_0x545c88['attributes']=_[_0x3ccb('0x44')](_0x2ef56b['model'],qs[_0x3ccb('0x45')](_0x1dea19[_0x3ccb('0x42')][_0x3ccb('0x45')]));_0x545c88['attributes']=_0x545c88['attributes'][_0x3ccb('0x46')]?_0x545c88[_0x3ccb('0x47')]:_0x2ef56b['model'];if(!_0x1dea19['query']['hasOwnProperty'](_0x3ccb('0x48'))){_0x545c88[_0x3ccb('0x2e')]=qs['limit'](_0x1dea19[_0x3ccb('0x42')][_0x3ccb('0x2e')]);_0x545c88[_0x3ccb('0x2d')]=qs[_0x3ccb('0x2d')](_0x1dea19[_0x3ccb('0x42')]['offset']);}_0x545c88[_0x3ccb('0x49')]=qs[_0x3ccb('0x4a')](_0x1dea19[_0x3ccb('0x42')][_0x3ccb('0x4a')]);_0x545c88[_0x3ccb('0x4b')]=qs['filters'](_[_0x3ccb('0x4c')](_0x1dea19[_0x3ccb('0x42')],_0x2ef56b[_0x3ccb('0x43')]),_0xc95282);if(_0x1dea19['query'][_0x3ccb('0x4d')]){_0x545c88[_0x3ccb('0x4b')]=_[_0x3ccb('0x4e')](_0x545c88[_0x3ccb('0x4b')],{'$or':_[_0x3ccb('0x3a')](_0xc95282,function(_0x3c60d8){if(_0x3c60d8['type']!=='VIRTUAL'){var _0x197fdf={};_0x197fdf[_0x3c60d8[_0x3ccb('0x38')]]={'$like':'%'+_0x1dea19[_0x3ccb('0x42')][_0x3ccb('0x4d')]+'%'};return _0x197fdf;}})});}_0x545c88=_[_0x3ccb('0x4e')]({},_0x545c88,_0x1dea19['options']);var _0x4f36ef={'where':_0x545c88['where']};return db[_0x3ccb('0x3b')][_0x3ccb('0x2c')](_0x4f36ef)[_0x3ccb('0x1e')](function(_0x3fab64){_0x357cf9[_0x3ccb('0x2c')]=_0x3fab64;if(_0x1dea19['query']['includeAll']){_0x545c88['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x3ccb('0x4f')](_0x545c88);})['then'](function(_0x3d6850){_0x357cf9[_0x3ccb('0x50')]=_0x3d6850;return _0x357cf9;})[_0x3ccb('0x1e')](respondWithFilteredResult(_0x377b0c,_0x545c88))[_0x3ccb('0x29')](handleError(_0x377b0c,null));};exports[_0x3ccb('0x51')]=function(_0x5c33d9,_0x40cfcc){var _0x544310={'raw':![],'where':{'id':_0x5c33d9[_0x3ccb('0x52')]['id']}},_0x5e7f8a={};_0x5e7f8a[_0x3ccb('0x40')]=_[_0x3ccb('0x41')](db[_0x3ccb('0x3b')][_0x3ccb('0x3c')]);_0x5e7f8a['query']=_['keys'](_0x5c33d9[_0x3ccb('0x42')]);_0x5e7f8a[_0x3ccb('0x43')]=_[_0x3ccb('0x44')](_0x5e7f8a[_0x3ccb('0x40')],_0x5e7f8a['query']);_0x544310[_0x3ccb('0x47')]=_[_0x3ccb('0x44')](_0x5e7f8a['model'],qs[_0x3ccb('0x45')](_0x5c33d9['query'][_0x3ccb('0x45')]));_0x544310[_0x3ccb('0x47')]=_0x544310[_0x3ccb('0x47')][_0x3ccb('0x46')]?_0x544310[_0x3ccb('0x47')]:_0x5e7f8a[_0x3ccb('0x40')];if(_0x5c33d9[_0x3ccb('0x42')][_0x3ccb('0x53')]){_0x544310[_0x3ccb('0x54')]=[{'all':!![]}];}_0x544310=_['merge']({},_0x544310,_0x5c33d9['options']);return db['VtigerConfiguration'][_0x3ccb('0x55')](_0x544310)[_0x3ccb('0x1e')](handleEntityNotFound(_0x40cfcc,null))[_0x3ccb('0x1e')](respondWithResult(_0x40cfcc,null))[_0x3ccb('0x29')](handleError(_0x40cfcc,null));};exports[_0x3ccb('0x56')]=function(_0x14a038,_0x43e284){return db[_0x3ccb('0x3b')]['create'](_0x14a038[_0x3ccb('0x57')],{})[_0x3ccb('0x1e')](respondWithResult(_0x43e284,0xc9))[_0x3ccb('0x29')](handleError(_0x43e284,null));};exports['update']=function(_0xcc972b,_0x29520c){if(_0xcc972b[_0x3ccb('0x57')]['id']){delete _0xcc972b[_0x3ccb('0x57')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0xcc972b[_0x3ccb('0x52')]['id']}})[_0x3ccb('0x1e')](handleEntityNotFound(_0x29520c,null))[_0x3ccb('0x1e')](saveUpdates(_0xcc972b[_0x3ccb('0x57')],null))[_0x3ccb('0x1e')](respondWithResult(_0x29520c,null))[_0x3ccb('0x29')](handleError(_0x29520c,null));};exports[_0x3ccb('0x58')]=function(_0x9a877d,_0x519b6c){return db['VtigerConfiguration'][_0x3ccb('0x55')]({'where':{'id':_0x9a877d[_0x3ccb('0x52')]['id']}})[_0x3ccb('0x1e')](handleEntityNotFound(_0x519b6c,null))[_0x3ccb('0x1e')](removeEntity(_0x519b6c,null))['catch'](handleError(_0x519b6c,null));};exports['getFields']=function(_0x3539d4,_0x44cd47,_0x495d6e){var _0xe5030e={};var _0x175cce={};var _0x195417;var _0x1f0519;return db[_0x3ccb('0x3b')][_0x3ccb('0x59')]({'where':{'id':_0x3539d4[_0x3ccb('0x52')]['id']}})[_0x3ccb('0x1e')](handleEntityNotFound(_0x44cd47,null))[_0x3ccb('0x1e')](function(_0x44ec5a){if(_0x44ec5a){_0x195417=_0x44ec5a;_0x175cce[_0x3ccb('0x40')]=_[_0x3ccb('0x41')](db[_0x3ccb('0x5a')][_0x3ccb('0x3c')]);_0x175cce[_0x3ccb('0x42')]=_[_0x3ccb('0x41')](_0x3539d4[_0x3ccb('0x42')]);_0x175cce[_0x3ccb('0x43')]=_['intersection'](_0x175cce[_0x3ccb('0x40')],_0x175cce['query']);_0xe5030e[_0x3ccb('0x47')]=_['intersection'](_0x175cce[_0x3ccb('0x40')],qs['fields'](_0x3539d4['query'][_0x3ccb('0x45')]));_0xe5030e[_0x3ccb('0x47')]=_0xe5030e[_0x3ccb('0x47')][_0x3ccb('0x46')]?_0xe5030e[_0x3ccb('0x47')]:_0x175cce[_0x3ccb('0x40')];_0xe5030e['order']=qs['sort'](_0x3539d4[_0x3ccb('0x42')][_0x3ccb('0x4a')]);_0xe5030e[_0x3ccb('0x4b')]=qs[_0x3ccb('0x43')](_['pick'](_0x3539d4['query'],_0x175cce[_0x3ccb('0x43')]));if(_0x3539d4[_0x3ccb('0x42')][_0x3ccb('0x4d')]){_0xe5030e['where']=_['merge'](_0xe5030e[_0x3ccb('0x4b')],{'$or':_[_0x3ccb('0x3a')](_0xe5030e[_0x3ccb('0x47')],function(_0x2d481a){var _0x78f2a9={};_0x78f2a9[_0x2d481a]={'$like':'%'+_0x3539d4[_0x3ccb('0x42')][_0x3ccb('0x4d')]+'%'};return _0x78f2a9;})});}_0xe5030e=_['merge']({},_0xe5030e,_0x3539d4[_0x3ccb('0x5b')]);return _0x195417[_0x3ccb('0x5c')](_0xe5030e);}})[_0x3ccb('0x1e')](function(_0x541094){if(_0x541094){_0x1f0519=_0x541094['length'];if(!_0x3539d4[_0x3ccb('0x42')][_0x3ccb('0x5d')](_0x3ccb('0x48'))){_0xe5030e['limit']=qs[_0x3ccb('0x2e')](_0x3539d4[_0x3ccb('0x42')]['limit']);_0xe5030e['offset']=qs['offset'](_0x3539d4[_0x3ccb('0x42')][_0x3ccb('0x2d')]);}return _0x195417['getFields'](_0xe5030e);}})[_0x3ccb('0x1e')](function(_0x3437bd){if(_0x3437bd){return _0x3437bd?{'count':_0x1f0519,'rows':_0x3437bd}:null;}})[_0x3ccb('0x1e')](respondWithResult(_0x44cd47,null))[_0x3ccb('0x29')](handleError(_0x44cd47,null));};exports[_0x3ccb('0x5e')]=function(_0x2b9777,_0x391f5a,_0x1ba973){var _0xe2689={};var _0x1edfdb={};var _0x13f82f;var _0x1c1b1c;return db['VtigerConfiguration'][_0x3ccb('0x59')]({'where':{'id':_0x2b9777[_0x3ccb('0x52')]['id']}})[_0x3ccb('0x1e')](handleEntityNotFound(_0x391f5a,null))[_0x3ccb('0x1e')](function(_0x343b76){if(_0x343b76){_0x13f82f=_0x343b76;_0x1edfdb['model']=_[_0x3ccb('0x41')](db[_0x3ccb('0x5a')]['rawAttributes']);_0x1edfdb['query']=_[_0x3ccb('0x41')](_0x2b9777[_0x3ccb('0x42')]);_0x1edfdb[_0x3ccb('0x43')]=_[_0x3ccb('0x44')](_0x1edfdb[_0x3ccb('0x40')],_0x1edfdb[_0x3ccb('0x42')]);_0xe2689[_0x3ccb('0x47')]=_[_0x3ccb('0x44')](_0x1edfdb[_0x3ccb('0x40')],qs['fields'](_0x2b9777['query']['fields']));_0xe2689[_0x3ccb('0x47')]=_0xe2689[_0x3ccb('0x47')]['length']?_0xe2689['attributes']:_0x1edfdb[_0x3ccb('0x40')];_0xe2689['order']=qs[_0x3ccb('0x4a')](_0x2b9777[_0x3ccb('0x42')][_0x3ccb('0x4a')]);_0xe2689[_0x3ccb('0x4b')]=qs[_0x3ccb('0x43')](_['pick'](_0x2b9777[_0x3ccb('0x42')],_0x1edfdb[_0x3ccb('0x43')]));if(_0x2b9777['query'][_0x3ccb('0x4d')]){_0xe2689['where']=_['merge'](_0xe2689['where'],{'$or':_['map'](_0xe2689['attributes'],function(_0x3bb0cd){var _0x91a393={};_0x91a393[_0x3bb0cd]={'$like':'%'+_0x2b9777[_0x3ccb('0x42')][_0x3ccb('0x4d')]+'%'};return _0x91a393;})});}_0xe2689=_['merge']({},_0xe2689,_0x2b9777[_0x3ccb('0x5b')]);return _0x13f82f[_0x3ccb('0x5e')](_0xe2689);}})['then'](function(_0x15aee1){if(_0x15aee1){_0x1c1b1c=_0x15aee1[_0x3ccb('0x46')];if(!_0x2b9777[_0x3ccb('0x42')][_0x3ccb('0x5d')](_0x3ccb('0x48'))){_0xe2689[_0x3ccb('0x2e')]=qs[_0x3ccb('0x2e')](_0x2b9777[_0x3ccb('0x42')][_0x3ccb('0x2e')]);_0xe2689[_0x3ccb('0x2d')]=qs['offset'](_0x2b9777['query'][_0x3ccb('0x2d')]);}return _0x13f82f[_0x3ccb('0x5e')](_0xe2689);}})[_0x3ccb('0x1e')](function(_0xc05c44){if(_0xc05c44){return _0xc05c44?{'count':_0x1c1b1c,'rows':_0xc05c44}:null;}})['then'](respondWithResult(_0x391f5a,null))[_0x3ccb('0x29')](handleError(_0x391f5a,null));};exports[_0x3ccb('0x5f')]=function(_0x5446b8,_0x48248b,_0x1d9523){var _0x383887={};var _0x20f692={};var _0x48b163;var _0x221c63;return db[_0x3ccb('0x3b')]['findOne']({'where':{'id':_0x5446b8[_0x3ccb('0x52')]['id']}})[_0x3ccb('0x1e')](handleEntityNotFound(_0x48248b,null))[_0x3ccb('0x1e')](function(_0x688181){if(_0x688181){_0x48b163=_0x688181;_0x20f692['model']=_[_0x3ccb('0x41')](db[_0x3ccb('0x5a')][_0x3ccb('0x3c')]);_0x20f692[_0x3ccb('0x42')]=_[_0x3ccb('0x41')](_0x5446b8['query']);_0x20f692['filters']=_[_0x3ccb('0x44')](_0x20f692[_0x3ccb('0x40')],_0x20f692[_0x3ccb('0x42')]);_0x383887['attributes']=_[_0x3ccb('0x44')](_0x20f692[_0x3ccb('0x40')],qs[_0x3ccb('0x45')](_0x5446b8[_0x3ccb('0x42')]['fields']));_0x383887[_0x3ccb('0x47')]=_0x383887[_0x3ccb('0x47')][_0x3ccb('0x46')]?_0x383887[_0x3ccb('0x47')]:_0x20f692['model'];_0x383887[_0x3ccb('0x49')]=qs[_0x3ccb('0x4a')](_0x5446b8[_0x3ccb('0x42')][_0x3ccb('0x4a')]);_0x383887[_0x3ccb('0x4b')]=qs[_0x3ccb('0x43')](_['pick'](_0x5446b8[_0x3ccb('0x42')],_0x20f692['filters']));if(_0x5446b8[_0x3ccb('0x42')][_0x3ccb('0x4d')]){_0x383887['where']=_['merge'](_0x383887[_0x3ccb('0x4b')],{'$or':_[_0x3ccb('0x3a')](_0x383887['attributes'],function(_0x1204b0){var _0x1c0bda={};_0x1c0bda[_0x1204b0]={'$like':'%'+_0x5446b8[_0x3ccb('0x42')]['filter']+'%'};return _0x1c0bda;})});}_0x383887=_['merge']({},_0x383887,_0x5446b8[_0x3ccb('0x5b')]);return _0x48b163['getDescriptions'](_0x383887);}})[_0x3ccb('0x1e')](function(_0x1811cc){if(_0x1811cc){_0x221c63=_0x1811cc[_0x3ccb('0x46')];if(!_0x5446b8[_0x3ccb('0x42')]['hasOwnProperty'](_0x3ccb('0x48'))){_0x383887[_0x3ccb('0x2e')]=qs[_0x3ccb('0x2e')](_0x5446b8[_0x3ccb('0x42')][_0x3ccb('0x2e')]);_0x383887[_0x3ccb('0x2d')]=qs['offset'](_0x5446b8[_0x3ccb('0x42')][_0x3ccb('0x2d')]);}return _0x48b163[_0x3ccb('0x5f')](_0x383887);}})[_0x3ccb('0x1e')](function(_0x289a6b){if(_0x289a6b){return _0x289a6b?{'count':_0x221c63,'rows':_0x289a6b}:null;}})[_0x3ccb('0x1e')](respondWithResult(_0x48248b,null))[_0x3ccb('0x29')](handleError(_0x48248b,null));}; \ No newline at end of file +var _0x518c=['map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','update','body','params','destroy','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','order','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','stack','name','send','index'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x518c,0x150));var _0xc518=function(_0x45ba8f,_0x217a35){_0x45ba8f=_0x45ba8f-0x0;var _0x1412f4=_0x518c[_0x45ba8f];return _0x1412f4;};'use strict';var pdf=require(_0xc518('0x0'));var emlformat=require(_0xc518('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc518('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc518('0x3'));var moment=require(_0xc518('0x4'));var BPromise=require(_0xc518('0x5'));var Mustache=require(_0xc518('0x6'));var util=require(_0xc518('0x7'));var path=require(_0xc518('0x8'));var sox=require(_0xc518('0x9'));var csv=require('to-csv');var ejs=require(_0xc518('0xa'));var fs=require('fs');var _=require(_0xc518('0xb'));var squel=require(_0xc518('0xc'));var crypto=require(_0xc518('0xd'));var jsforce=require(_0xc518('0xe'));var deskjs=require(_0xc518('0xf'));var toCsv=require(_0xc518('0x10'));var querystring=require(_0xc518('0x11'));var Papa=require(_0xc518('0x12'));var Redis=require(_0xc518('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc518('0x14'));var as=require(_0xc518('0x15'));var hardwareService=require(_0xc518('0x16'));var logger=require(_0xc518('0x17'))(_0xc518('0x18'));var utils=require('../../config/utils');var config=require(_0xc518('0x19'));var db=require(_0xc518('0x1a'))['db'];var jayson=require(_0xc518('0x1b'));var client=jayson[_0xc518('0x1c')][_0xc518('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x47f003,_0x8154e0,_0x55b192){if(_0x55b192){var _0x583f95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x583f95[_0xc518('0x1e')](_0x8154e0)){return _0x47f003;}else{throw new db[(_0xc518('0x1f'))][(_0xc518('0x20'))](_0xc518('0x21'));}}else{return _0x47f003;}}function respondWithRpcPromise(_0x5ace8c,_0x4619d6,_0x27cb67,_0x1843ee){return new BPromise(function(_0x377244,_0x171496){var _0xe20440=_0x1843ee||client;return _0xe20440['request'](_0x5ace8c,_0x27cb67)[_0xc518('0x22')](function(_0x3e7ff9){logger['info'](_0xc518('0x23'),_0x4619d6,_0xc518('0x24'));logger['debug'](_0xc518('0x25'),_0x4619d6,_0xc518('0x24'),JSON[_0xc518('0x26')](_0x3e7ff9));if(_0x3e7ff9['error']){if(_0x3e7ff9[_0xc518('0x27')][_0xc518('0x28')]===0x1f4){logger[_0xc518('0x27')]('VtigerConfiguration,\x20%s,\x20%s',_0x4619d6,_0x3e7ff9[_0xc518('0x27')]['message']);return _0x171496(_0x3e7ff9[_0xc518('0x27')]['message']);}logger[_0xc518('0x27')](_0xc518('0x23'),_0x4619d6,_0x3e7ff9[_0xc518('0x27')][_0xc518('0x29')]);return _0x377244(_0x3e7ff9['error'][_0xc518('0x29')]);}else{logger[_0xc518('0x2a')]('VtigerConfiguration,\x20%s,\x20%s',_0x4619d6,_0xc518('0x24'));_0x377244(_0x3e7ff9[_0xc518('0x2b')]['message']);}})[_0xc518('0x2c')](function(_0xaae073){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4619d6,_0xaae073);_0x171496(_0xaae073);});});}function respondWithStatusCode(_0x412150,_0x36667d){_0x36667d=_0x36667d||0xcc;return function(_0x375c38){if(_0x375c38){return _0x412150[_0xc518('0x2d')](_0x36667d);}return _0x412150[_0xc518('0x2e')](_0x36667d)[_0xc518('0x2f')]();};}function respondWithResult(_0x15a8a8,_0x1ca9f8){_0x1ca9f8=_0x1ca9f8||0xc8;return function(_0x4734be){if(_0x4734be){return _0x15a8a8[_0xc518('0x2e')](_0x1ca9f8)[_0xc518('0x30')](_0x4734be);}};}function respondWithFilteredResult(_0x37b98c,_0x53e8a9){return function(_0x12b9fb){if(_0x12b9fb){var _0x2f6f46=_0x12b9fb[_0xc518('0x31')],_0x487617=_0x53e8a9[_0xc518('0x32')],_0x54cdac=_0x53e8a9[_0xc518('0x32')]+_0x53e8a9[_0xc518('0x33')],_0x4f76a7;if(_0x54cdac>=_0x2f6f46){_0x54cdac=_0x2f6f46;_0x4f76a7=0xc8;}else{_0x4f76a7=0xce;}_0x37b98c[_0xc518('0x2e')](_0x4f76a7);return _0x37b98c[_0xc518('0x34')](_0xc518('0x35'),_0x487617+'-'+_0x54cdac+'/'+_0x2f6f46)[_0xc518('0x30')](_0x12b9fb);}return null;};}function patchUpdates(_0x51be4c){return function(_0xf336c3){try{jsonpatch[_0xc518('0x36')](_0xf336c3,_0x51be4c,!![]);}catch(_0x59567d){return BPromise[_0xc518('0x37')](_0x59567d);}return _0xf336c3['save']();};}function saveUpdates(_0x5b6555,_0x37d895){return function(_0x12574a){if(_0x12574a){return _0x12574a['update'](_0x5b6555)[_0xc518('0x22')](function(_0x1b2a13){return _0x1b2a13;});}return null;};}function removeEntity(_0x2a1f6d,_0x3e4af2){return function(_0x477cfd){if(_0x477cfd){return _0x477cfd['destroy']()[_0xc518('0x22')](function(){_0x2a1f6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5068b1,_0x334c7b){return function(_0x246b81){if(!_0x246b81){_0x5068b1[_0xc518('0x2d')](0x194);}return _0x246b81;};}function handleError(_0x4f0c27,_0x5d5ad3){_0x5d5ad3=_0x5d5ad3||0x1f4;return function(_0x314250){logger[_0xc518('0x27')](_0x314250[_0xc518('0x38')]);if(_0x314250['name']){delete _0x314250[_0xc518('0x39')];}_0x4f0c27[_0xc518('0x2e')](_0x5d5ad3)[_0xc518('0x3a')](_0x314250);};}exports[_0xc518('0x3b')]=function(_0x24f77c,_0x2312ab){var _0x3dd495={},_0x273927={},_0x19d0f4={'count':0x0,'rows':[]};var _0x31e3e4=_[_0xc518('0x3c')](db[_0xc518('0x3d')][_0xc518('0x3e')],function(_0x470eb7){return{'name':_0x470eb7[_0xc518('0x3f')],'type':_0x470eb7[_0xc518('0x40')][_0xc518('0x41')]};});_0x273927['model']=_[_0xc518('0x3c')](_0x31e3e4,_0xc518('0x39'));_0x273927[_0xc518('0x42')]=_[_0xc518('0x43')](_0x24f77c[_0xc518('0x42')]);_0x273927[_0xc518('0x44')]=_['intersection'](_0x273927['model'],_0x273927[_0xc518('0x42')]);_0x3dd495[_0xc518('0x45')]=_[_0xc518('0x46')](_0x273927[_0xc518('0x47')],qs[_0xc518('0x48')](_0x24f77c[_0xc518('0x42')][_0xc518('0x48')]));_0x3dd495['attributes']=_0x3dd495[_0xc518('0x45')][_0xc518('0x49')]?_0x3dd495[_0xc518('0x45')]:_0x273927[_0xc518('0x47')];if(!_0x24f77c[_0xc518('0x42')]['hasOwnProperty'](_0xc518('0x4a'))){_0x3dd495[_0xc518('0x33')]=qs[_0xc518('0x33')](_0x24f77c[_0xc518('0x42')][_0xc518('0x33')]);_0x3dd495[_0xc518('0x32')]=qs['offset'](_0x24f77c[_0xc518('0x42')][_0xc518('0x32')]);}_0x3dd495['order']=qs[_0xc518('0x4b')](_0x24f77c['query'][_0xc518('0x4b')]);_0x3dd495[_0xc518('0x4c')]=qs[_0xc518('0x44')](_[_0xc518('0x4d')](_0x24f77c[_0xc518('0x42')],_0x273927[_0xc518('0x44')]),_0x31e3e4);if(_0x24f77c['query'][_0xc518('0x4e')]){_0x3dd495[_0xc518('0x4c')]=_['merge'](_0x3dd495[_0xc518('0x4c')],{'$or':_['map'](_0x31e3e4,function(_0x1fd6a8){if(_0x1fd6a8['type']!==_0xc518('0x4f')){var _0x8371a={};_0x8371a[_0x1fd6a8['name']]={'$like':'%'+_0x24f77c[_0xc518('0x42')][_0xc518('0x4e')]+'%'};return _0x8371a;}})});}_0x3dd495=_[_0xc518('0x50')]({},_0x3dd495,_0x24f77c[_0xc518('0x51')]);var _0x343043={'where':_0x3dd495[_0xc518('0x4c')]};return db[_0xc518('0x3d')][_0xc518('0x31')](_0x343043)[_0xc518('0x22')](function(_0x5ed1e6){_0x19d0f4[_0xc518('0x31')]=_0x5ed1e6;if(_0x24f77c[_0xc518('0x42')][_0xc518('0x52')]){_0x3dd495[_0xc518('0x53')]=[{'all':!![]}];}return db[_0xc518('0x3d')][_0xc518('0x54')](_0x3dd495);})[_0xc518('0x22')](function(_0xbef9e5){_0x19d0f4[_0xc518('0x55')]=_0xbef9e5;return _0x19d0f4;})['then'](respondWithFilteredResult(_0x2312ab,_0x3dd495))[_0xc518('0x2c')](handleError(_0x2312ab,null));};exports['show']=function(_0x5d394c,_0x5a1b1b){var _0x5b5556={'raw':![],'where':{'id':_0x5d394c['params']['id']}},_0x1d842d={};_0x1d842d[_0xc518('0x47')]=_['keys'](db[_0xc518('0x3d')][_0xc518('0x3e')]);_0x1d842d['query']=_['keys'](_0x5d394c[_0xc518('0x42')]);_0x1d842d['filters']=_[_0xc518('0x46')](_0x1d842d[_0xc518('0x47')],_0x1d842d[_0xc518('0x42')]);_0x5b5556[_0xc518('0x45')]=_['intersection'](_0x1d842d['model'],qs[_0xc518('0x48')](_0x5d394c['query'][_0xc518('0x48')]));_0x5b5556['attributes']=_0x5b5556['attributes'][_0xc518('0x49')]?_0x5b5556['attributes']:_0x1d842d[_0xc518('0x47')];if(_0x5d394c[_0xc518('0x42')]['includeAll']){_0x5b5556[_0xc518('0x53')]=[{'all':!![]}];}_0x5b5556=_[_0xc518('0x50')]({},_0x5b5556,_0x5d394c[_0xc518('0x51')]);return db[_0xc518('0x3d')][_0xc518('0x56')](_0x5b5556)['then'](handleEntityNotFound(_0x5a1b1b,null))[_0xc518('0x22')](respondWithResult(_0x5a1b1b,null))[_0xc518('0x2c')](handleError(_0x5a1b1b,null));};exports[_0xc518('0x57')]=function(_0x23ae16,_0x2a52c6){return db[_0xc518('0x3d')][_0xc518('0x57')](_0x23ae16['body'],{})[_0xc518('0x22')](respondWithResult(_0x2a52c6,0xc9))['catch'](handleError(_0x2a52c6,null));};exports[_0xc518('0x58')]=function(_0x5da7c5,_0x4c4ff2){if(_0x5da7c5[_0xc518('0x59')]['id']){delete _0x5da7c5[_0xc518('0x59')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x5da7c5[_0xc518('0x5a')]['id']}})[_0xc518('0x22')](handleEntityNotFound(_0x4c4ff2,null))['then'](saveUpdates(_0x5da7c5[_0xc518('0x59')],null))[_0xc518('0x22')](respondWithResult(_0x4c4ff2,null))[_0xc518('0x2c')](handleError(_0x4c4ff2,null));};exports[_0xc518('0x5b')]=function(_0x2bcf7d,_0x2d0c6d){return db['VtigerConfiguration'][_0xc518('0x56')]({'where':{'id':_0x2bcf7d[_0xc518('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2d0c6d,null))['then'](removeEntity(_0x2d0c6d,null))['catch'](handleError(_0x2d0c6d,null));};exports[_0xc518('0x5c')]=function(_0x1c2033,_0x509e6d,_0x1dd7eb){var _0x1cf439={};var _0x121b97={};var _0x4cb6e2;var _0x5eae23;return db[_0xc518('0x3d')][_0xc518('0x5d')]({'where':{'id':_0x1c2033[_0xc518('0x5a')]['id']}})['then'](handleEntityNotFound(_0x509e6d,null))[_0xc518('0x22')](function(_0x1f14bf){if(_0x1f14bf){_0x4cb6e2=_0x1f14bf;_0x121b97[_0xc518('0x47')]=_[_0xc518('0x43')](db[_0xc518('0x5e')][_0xc518('0x3e')]);_0x121b97[_0xc518('0x42')]=_[_0xc518('0x43')](_0x1c2033[_0xc518('0x42')]);_0x121b97[_0xc518('0x44')]=_['intersection'](_0x121b97['model'],_0x121b97[_0xc518('0x42')]);_0x1cf439[_0xc518('0x45')]=_[_0xc518('0x46')](_0x121b97[_0xc518('0x47')],qs[_0xc518('0x48')](_0x1c2033[_0xc518('0x42')][_0xc518('0x48')]));_0x1cf439[_0xc518('0x45')]=_0x1cf439[_0xc518('0x45')][_0xc518('0x49')]?_0x1cf439[_0xc518('0x45')]:_0x121b97[_0xc518('0x47')];_0x1cf439['order']=qs[_0xc518('0x4b')](_0x1c2033[_0xc518('0x42')][_0xc518('0x4b')]);_0x1cf439[_0xc518('0x4c')]=qs[_0xc518('0x44')](_['pick'](_0x1c2033['query'],_0x121b97['filters']));if(_0x1c2033[_0xc518('0x42')][_0xc518('0x4e')]){_0x1cf439['where']=_['merge'](_0x1cf439['where'],{'$or':_[_0xc518('0x3c')](_0x1cf439['attributes'],function(_0x23fbce){var _0x1ca805={};_0x1ca805[_0x23fbce]={'$like':'%'+_0x1c2033[_0xc518('0x42')][_0xc518('0x4e')]+'%'};return _0x1ca805;})});}_0x1cf439=_[_0xc518('0x50')]({},_0x1cf439,_0x1c2033[_0xc518('0x51')]);return _0x4cb6e2['getFields'](_0x1cf439);}})[_0xc518('0x22')](function(_0x2a052f){if(_0x2a052f){_0x5eae23=_0x2a052f['length'];if(!_0x1c2033[_0xc518('0x42')][_0xc518('0x5f')](_0xc518('0x4a'))){_0x1cf439['limit']=qs['limit'](_0x1c2033[_0xc518('0x42')][_0xc518('0x33')]);_0x1cf439[_0xc518('0x32')]=qs[_0xc518('0x32')](_0x1c2033['query'][_0xc518('0x32')]);}return _0x4cb6e2[_0xc518('0x5c')](_0x1cf439);}})['then'](function(_0x287285){if(_0x287285){return _0x287285?{'count':_0x5eae23,'rows':_0x287285}:null;}})[_0xc518('0x22')](respondWithResult(_0x509e6d,null))[_0xc518('0x2c')](handleError(_0x509e6d,null));};exports[_0xc518('0x60')]=function(_0x26f367,_0x4b53ca,_0x2dc894){var _0x516508={};var _0x1da987={};var _0x24bae7;var _0x3b86b7;return db[_0xc518('0x3d')]['findOne']({'where':{'id':_0x26f367['params']['id']}})['then'](handleEntityNotFound(_0x4b53ca,null))[_0xc518('0x22')](function(_0x176546){if(_0x176546){_0x24bae7=_0x176546;_0x1da987[_0xc518('0x47')]=_['keys'](db[_0xc518('0x5e')][_0xc518('0x3e')]);_0x1da987[_0xc518('0x42')]=_[_0xc518('0x43')](_0x26f367[_0xc518('0x42')]);_0x1da987[_0xc518('0x44')]=_[_0xc518('0x46')](_0x1da987['model'],_0x1da987[_0xc518('0x42')]);_0x516508[_0xc518('0x45')]=_[_0xc518('0x46')](_0x1da987[_0xc518('0x47')],qs[_0xc518('0x48')](_0x26f367[_0xc518('0x42')][_0xc518('0x48')]));_0x516508[_0xc518('0x45')]=_0x516508[_0xc518('0x45')]['length']?_0x516508[_0xc518('0x45')]:_0x1da987[_0xc518('0x47')];_0x516508[_0xc518('0x61')]=qs[_0xc518('0x4b')](_0x26f367[_0xc518('0x42')]['sort']);_0x516508[_0xc518('0x4c')]=qs[_0xc518('0x44')](_[_0xc518('0x4d')](_0x26f367[_0xc518('0x42')],_0x1da987[_0xc518('0x44')]));if(_0x26f367[_0xc518('0x42')]['filter']){_0x516508[_0xc518('0x4c')]=_['merge'](_0x516508[_0xc518('0x4c')],{'$or':_[_0xc518('0x3c')](_0x516508[_0xc518('0x45')],function(_0x30411a){var _0x1b0577={};_0x1b0577[_0x30411a]={'$like':'%'+_0x26f367[_0xc518('0x42')][_0xc518('0x4e')]+'%'};return _0x1b0577;})});}_0x516508=_[_0xc518('0x50')]({},_0x516508,_0x26f367[_0xc518('0x51')]);return _0x24bae7['getSubjects'](_0x516508);}})[_0xc518('0x22')](function(_0xf07e9f){if(_0xf07e9f){_0x3b86b7=_0xf07e9f[_0xc518('0x49')];if(!_0x26f367['query']['hasOwnProperty']('nolimit')){_0x516508[_0xc518('0x33')]=qs[_0xc518('0x33')](_0x26f367[_0xc518('0x42')][_0xc518('0x33')]);_0x516508['offset']=qs[_0xc518('0x32')](_0x26f367[_0xc518('0x42')][_0xc518('0x32')]);}return _0x24bae7[_0xc518('0x60')](_0x516508);}})[_0xc518('0x22')](function(_0x295d23){if(_0x295d23){return _0x295d23?{'count':_0x3b86b7,'rows':_0x295d23}:null;}})[_0xc518('0x22')](respondWithResult(_0x4b53ca,null))[_0xc518('0x2c')](handleError(_0x4b53ca,null));};exports[_0xc518('0x62')]=function(_0x798520,_0x134a48,_0x576dc9){var _0xdc1491={};var _0x20d578={};var _0x4558e3;var _0x380d08;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x798520['params']['id']}})[_0xc518('0x22')](handleEntityNotFound(_0x134a48,null))['then'](function(_0x51f484){if(_0x51f484){_0x4558e3=_0x51f484;_0x20d578['model']=_['keys'](db[_0xc518('0x5e')]['rawAttributes']);_0x20d578[_0xc518('0x42')]=_['keys'](_0x798520['query']);_0x20d578[_0xc518('0x44')]=_[_0xc518('0x46')](_0x20d578[_0xc518('0x47')],_0x20d578[_0xc518('0x42')]);_0xdc1491[_0xc518('0x45')]=_[_0xc518('0x46')](_0x20d578[_0xc518('0x47')],qs[_0xc518('0x48')](_0x798520[_0xc518('0x42')]['fields']));_0xdc1491[_0xc518('0x45')]=_0xdc1491[_0xc518('0x45')]['length']?_0xdc1491[_0xc518('0x45')]:_0x20d578[_0xc518('0x47')];_0xdc1491['order']=qs[_0xc518('0x4b')](_0x798520[_0xc518('0x42')]['sort']);_0xdc1491[_0xc518('0x4c')]=qs[_0xc518('0x44')](_['pick'](_0x798520[_0xc518('0x42')],_0x20d578[_0xc518('0x44')]));if(_0x798520[_0xc518('0x42')][_0xc518('0x4e')]){_0xdc1491[_0xc518('0x4c')]=_['merge'](_0xdc1491[_0xc518('0x4c')],{'$or':_[_0xc518('0x3c')](_0xdc1491[_0xc518('0x45')],function(_0x17890b){var _0x254cef={};_0x254cef[_0x17890b]={'$like':'%'+_0x798520[_0xc518('0x42')]['filter']+'%'};return _0x254cef;})});}_0xdc1491=_[_0xc518('0x50')]({},_0xdc1491,_0x798520[_0xc518('0x51')]);return _0x4558e3['getDescriptions'](_0xdc1491);}})[_0xc518('0x22')](function(_0x39b923){if(_0x39b923){_0x380d08=_0x39b923['length'];if(!_0x798520['query'][_0xc518('0x5f')](_0xc518('0x4a'))){_0xdc1491[_0xc518('0x33')]=qs[_0xc518('0x33')](_0x798520[_0xc518('0x42')]['limit']);_0xdc1491[_0xc518('0x32')]=qs[_0xc518('0x32')](_0x798520[_0xc518('0x42')][_0xc518('0x32')]);}return _0x4558e3['getDescriptions'](_0xdc1491);}})[_0xc518('0x22')](function(_0xcdde9c){if(_0xcdde9c){return _0xcdde9c?{'count':_0x380d08,'rows':_0xcdde9c}:null;}})['then'](respondWithResult(_0x134a48,null))[_0xc518('0x2c')](handleError(_0x134a48,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7058916..eb0cfdc 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 _0xd54e=['define','VtigerConfiguration','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xd54e,0x138));var _0xed54=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd54e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xed54('0x0'));var logger=require(_0xed54('0x1'))('api');var moment=require('moment');var BPromise=require(_0xed54('0x2'));var rp=require(_0xed54('0x3'));var fs=require('fs');var path=require(_0xed54('0x4'));var rimraf=require(_0xed54('0x5'));var config=require(_0xed54('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xed54('0x7')]=function(_0x47912e,_0x43db73){return _0x47912e[_0xed54('0x8')](_0xed54('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab96=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0xab96,0xb8));var _0x6ab9=function(_0x249b91,_0x297432){_0x249b91=_0x249b91-0x0;var _0x255e1b=_0xab96[_0x249b91];return _0x255e1b;};'use strict';var _=require(_0x6ab9('0x0'));var util=require(_0x6ab9('0x1'));var logger=require('../../config/logger')(_0x6ab9('0x2'));var moment=require(_0x6ab9('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ab9('0x4'));var fs=require('fs');var path=require(_0x6ab9('0x5'));var rimraf=require(_0x6ab9('0x6'));var config=require(_0x6ab9('0x7'));var attributes=require(_0x6ab9('0x8'));module[_0x6ab9('0x9')]=function(_0x42e0ae,_0x4f4413){return _0x42e0ae[_0x6ab9('0xa')](_0x6ab9('0xb'),attributes,{'tableName':_0x6ab9('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 7dd4f8f..be6f5ca 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 _0xf517=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1155e6,_0x233e73){var _0x35dd79=function(_0x5b7d96){while(--_0x5b7d96){_0x1155e6['push'](_0x1155e6['shift']());}};_0x35dd79(++_0x233e73);}(_0xf517,0x1e6));var _0x7f51=function(_0x1d37d8,_0x48c0f3){_0x1d37d8=_0x1d37d8-0x0;var _0x1025b4=_0xf517[_0x1d37d8];return _0x1025b4;};'use strict';var _=require(_0x7f51('0x0'));var util=require(_0x7f51('0x1'));var moment=require(_0x7f51('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f51('0x3'));var fs=require('fs');var Redis=require(_0x7f51('0x4'));var db=require(_0x7f51('0x5'))['db'];var utils=require(_0x7f51('0x6'));var logger=require(_0x7f51('0x7'))(_0x7f51('0x8'));var config=require(_0x7f51('0x9'));var jayson=require(_0x7f51('0xa'));var client=jayson[_0x7f51('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f1af6,_0x5702d2,_0x4f0ba5){return new BPromise(function(_0x3f35a2,_0x162414){return client[_0x7f51('0xc')](_0x5f1af6,_0x4f0ba5)[_0x7f51('0xd')](function(_0x3dd8b0){logger['info'](_0x7f51('0xe'),_0x5702d2,'request\x20sent');logger[_0x7f51('0xf')](_0x7f51('0x10'),_0x5702d2,_0x7f51('0x11'),JSON[_0x7f51('0x12')](_0x3dd8b0));if(_0x3dd8b0[_0x7f51('0x13')]){if(_0x3dd8b0['error']['code']===0x1f4){logger[_0x7f51('0x13')](_0x7f51('0xe'),_0x5702d2,_0x3dd8b0['error'][_0x7f51('0x14')]);return _0x162414(_0x3dd8b0[_0x7f51('0x13')][_0x7f51('0x14')]);}logger[_0x7f51('0x13')](_0x7f51('0xe'),_0x5702d2,_0x3dd8b0[_0x7f51('0x13')]['message']);return _0x3f35a2(_0x3dd8b0['error'][_0x7f51('0x14')]);}else{logger['info'](_0x7f51('0xe'),_0x5702d2,'request\x20sent');_0x3f35a2(_0x3dd8b0[_0x7f51('0x15')]['message']);}})[_0x7f51('0x16')](function(_0x2f7360){logger[_0x7f51('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x5702d2,_0x2f7360);_0x162414(_0x2f7360);});});} \ No newline at end of file +var _0xfa1e=['http','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x434f6a,_0x24e3c3){var _0x32d4c0=function(_0x39d4a6){while(--_0x39d4a6){_0x434f6a['push'](_0x434f6a['shift']());}};_0x32d4c0(++_0x24e3c3);}(_0xfa1e,0x185));var _0xefa1=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xfa1e[_0x164760];return _0x8b91b2;};'use strict';var _=require(_0xefa1('0x0'));var util=require(_0xefa1('0x1'));var moment=require(_0xefa1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefa1('0x3'));var db=require(_0xefa1('0x4'))['db'];var utils=require(_0xefa1('0x5'));var logger=require(_0xefa1('0x6'))(_0xefa1('0x7'));var config=require(_0xefa1('0x8'));var jayson=require(_0xefa1('0x9'));var client=jayson[_0xefa1('0xa')][_0xefa1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ecc58,_0x42d1e2,_0x4150a2){return new BPromise(function(_0x5cee02,_0x3d8e55){return client[_0xefa1('0xc')](_0x3ecc58,_0x4150a2)[_0xefa1('0xd')](function(_0xf49a5c){logger[_0xefa1('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x42d1e2,'request\x20sent');logger[_0xefa1('0xf')](_0xefa1('0x10'),_0x42d1e2,_0xefa1('0x11'),JSON[_0xefa1('0x12')](_0xf49a5c));if(_0xf49a5c['error']){if(_0xf49a5c['error'][_0xefa1('0x13')]===0x1f4){logger[_0xefa1('0x14')](_0xefa1('0x15'),_0x42d1e2,_0xf49a5c[_0xefa1('0x14')]['message']);return _0x3d8e55(_0xf49a5c[_0xefa1('0x14')]['message']);}logger['error'](_0xefa1('0x15'),_0x42d1e2,_0xf49a5c[_0xefa1('0x14')][_0xefa1('0x16')]);return _0x5cee02(_0xf49a5c['error'][_0xefa1('0x16')]);}else{logger[_0xefa1('0xe')](_0xefa1('0x15'),_0x42d1e2,_0xefa1('0x11'));_0x5cee02(_0xf49a5c[_0xefa1('0x17')][_0xefa1('0x16')]);}})[_0xefa1('0x18')](function(_0x9a4225){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x42d1e2,_0x9a4225);_0x3d8e55(_0x9a4225);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9d9f94a..0b230c5 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 _0xfc1a=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x32f78b,_0x178f58){var _0x51d847=function(_0xc010c3){while(--_0xc010c3){_0x32f78b['push'](_0x32f78b['shift']());}};_0x51d847(++_0x178f58);}(_0xfc1a,0x18a));var _0xafc1=function(_0x3f2201,_0x3d6032){_0x3f2201=_0x3f2201-0x0;var _0x535319=_0xfc1a[_0x3f2201];return _0x535319;};'use strict';var multer=require(_0xafc1('0x0'));var util=require(_0xafc1('0x1'));var path=require(_0xafc1('0x2'));var timeout=require(_0xafc1('0x3'));var express=require(_0xafc1('0x4'));var router=express[_0xafc1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xafc1('0x6'));var config=require(_0xafc1('0x7'));var controller=require(_0xafc1('0x8'));router['get']('/',auth[_0xafc1('0x9')](),controller[_0xafc1('0xa')]);router['get']('/:id',auth[_0xafc1('0x9')](),controller['show']);router[_0xafc1('0xb')]('/',auth[_0xafc1('0x9')](),controller[_0xafc1('0xc')]);router[_0xafc1('0xd')](_0xafc1('0xe'),auth[_0xafc1('0x9')](),controller[_0xafc1('0xf')]);router[_0xafc1('0x10')](_0xafc1('0xe'),auth[_0xafc1('0x9')](),controller['destroy']);module[_0xafc1('0x11')]=router; \ No newline at end of file +var _0x2d1d=['show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/:id'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2d1d,0x150));var _0xd2d1=function(_0xdd255b,_0x5633bf){_0xdd255b=_0xdd255b-0x0;var _0x29477a=_0x2d1d[_0xdd255b];return _0x29477a;};'use strict';var multer=require(_0xd2d1('0x0'));var util=require(_0xd2d1('0x1'));var path=require('path');var timeout=require(_0xd2d1('0x2'));var express=require(_0xd2d1('0x3'));var router=express['Router']();var auth=require(_0xd2d1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0xd2d1('0x5')]('/',auth[_0xd2d1('0x6')](),controller[_0xd2d1('0x7')]);router[_0xd2d1('0x5')](_0xd2d1('0x8'),auth[_0xd2d1('0x6')](),controller[_0xd2d1('0x9')]);router['post']('/',auth[_0xd2d1('0x6')](),controller['create']);router[_0xd2d1('0xa')](_0xd2d1('0x8'),auth[_0xd2d1('0x6')](),controller[_0xd2d1('0xb')]);router[_0xd2d1('0xc')](_0xd2d1('0x8'),auth[_0xd2d1('0x6')](),controller[_0xd2d1('0xd')]);module[_0xd2d1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 79f52db..906a457 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 _0x7857=['string','variable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x7857,0x1a9));var _0x7785=function(_0x57c8fa,_0x4e81e3){_0x57c8fa=_0x57c8fa-0x0;var _0x2feb93=_0x7857[_0x57c8fa];return _0x2feb93;};'use strict';var Sequelize=require(_0x7785('0x0'));module[_0x7785('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7785('0x2'),_0x7785('0x3'),'customVariable',_0x7785('0x4')),'defaultValue':_0x7785('0x2')},'content':{'type':Sequelize[_0x7785('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7785('0x6')](_0x7785('0x2'),_0x7785('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7785('0x5')]},'nameField':{'type':Sequelize[_0x7785('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7785('0x5')]}}; \ No newline at end of file +var _0x297b=['string','variable','STRING','sequelize','ENUM'];(function(_0x7d2480,_0x51ec60){var _0x168388=function(_0x3fca1b){while(--_0x3fca1b){_0x7d2480['push'](_0x7d2480['shift']());}};_0x168388(++_0x51ec60);}(_0x297b,0x85));var _0xb297=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x297b[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0xb297('0x0'));module['exports']={'type':{'type':Sequelize[_0xb297('0x1')](_0xb297('0x2'),_0xb297('0x3'),'customVariable','keyValue'),'defaultValue':_0xb297('0x2')},'content':{'type':Sequelize[_0xb297('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb297('0x1')](_0xb297('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb297('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb297('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7f7e46a..df7b7e7 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 _0x6d94=['desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','error','name','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','VtigerField','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x6d94,0x14b));var _0x46d9=function(_0x2580ae,_0x4caf46){_0x2580ae=_0x2580ae-0x0;var _0x13f34e=_0x6d94[_0x2580ae];return _0x13f34e;};'use strict';var pdf=require(_0x46d9('0x0'));var emlformat=require(_0x46d9('0x1'));var rimraf=require(_0x46d9('0x2'));var zipdir=require(_0x46d9('0x3'));var jsonpatch=require(_0x46d9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x46d9('0x5'));var Mustache=require(_0x46d9('0x6'));var util=require(_0x46d9('0x7'));var path=require(_0x46d9('0x8'));var sox=require('sox');var csv=require(_0x46d9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x46d9('0xa'));var squel=require(_0x46d9('0xb'));var crypto=require(_0x46d9('0xc'));var jsforce=require(_0x46d9('0xd'));var deskjs=require(_0x46d9('0xe'));var toCsv=require(_0x46d9('0x9'));var querystring=require(_0x46d9('0xf'));var Papa=require(_0x46d9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46d9('0x11'));var as=require(_0x46d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46d9('0x13'))('api');var utils=require(_0x46d9('0x14'));var config=require(_0x46d9('0x15'));var db=require(_0x46d9('0x16'))['db'];function respondWithStatusCode(_0x1c7c4a,_0x567f9e){_0x567f9e=_0x567f9e||0xcc;return function(_0x3fa0b8){if(_0x3fa0b8){return _0x1c7c4a[_0x46d9('0x17')](_0x567f9e);}return _0x1c7c4a['status'](_0x567f9e)['end']();};}function respondWithResult(_0x361277,_0x1cfd7c){_0x1cfd7c=_0x1cfd7c||0xc8;return function(_0x439a30){if(_0x439a30){return _0x361277[_0x46d9('0x18')](_0x1cfd7c)[_0x46d9('0x19')](_0x439a30);}};}function respondWithFilteredResult(_0x343a3f,_0x10d770){return function(_0x432cdc){if(_0x432cdc){var _0x1e62c9=_0x432cdc['count'],_0x2e42c0=_0x10d770[_0x46d9('0x1a')],_0x16cd4f=_0x10d770[_0x46d9('0x1a')]+_0x10d770['limit'],_0x334a8d;if(_0x16cd4f>=_0x1e62c9){_0x16cd4f=_0x1e62c9;_0x334a8d=0xc8;}else{_0x334a8d=0xce;}_0x343a3f[_0x46d9('0x18')](_0x334a8d);return _0x343a3f[_0x46d9('0x1b')](_0x46d9('0x1c'),_0x2e42c0+'-'+_0x16cd4f+'/'+_0x1e62c9)[_0x46d9('0x19')](_0x432cdc);}return null;};}function patchUpdates(_0x1e79b8){return function(_0x414a2d){try{jsonpatch['apply'](_0x414a2d,_0x1e79b8,!![]);}catch(_0x225fed){return BPromise[_0x46d9('0x1d')](_0x225fed);}return _0x414a2d[_0x46d9('0x1e')]();};}function saveUpdates(_0x581354,_0x47598e){return function(_0x203398){if(_0x203398){return _0x203398[_0x46d9('0x1f')](_0x581354)[_0x46d9('0x20')](function(_0x404f81){return _0x404f81;});}return null;};}function removeEntity(_0x497deb,_0x4a6883){return function(_0x7384a4){if(_0x7384a4){return _0x7384a4['destroy']()[_0x46d9('0x20')](function(){_0x497deb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x137f84,_0x22779d){return function(_0x9ca36e){if(!_0x9ca36e){_0x137f84[_0x46d9('0x17')](0x194);}return _0x9ca36e;};}function handleError(_0x118ba3,_0x43e293){_0x43e293=_0x43e293||0x1f4;return function(_0xcdc4d5){logger[_0x46d9('0x21')](_0xcdc4d5['stack']);if(_0xcdc4d5[_0x46d9('0x22')]){delete _0xcdc4d5[_0x46d9('0x22')];}_0x118ba3['status'](_0x43e293)['send'](_0xcdc4d5);};}exports['index']=function(_0x15dd36,_0x27712a){var _0x21dcde={},_0x24d8ec={},_0x1514c5={'count':0x0,'rows':[]};var _0x20c6e6=_[_0x46d9('0x23')](db['VtigerField'][_0x46d9('0x24')],function(_0x59f7c9){return{'name':_0x59f7c9[_0x46d9('0x25')],'type':_0x59f7c9['type'][_0x46d9('0x26')]};});_0x24d8ec['model']=_[_0x46d9('0x23')](_0x20c6e6,_0x46d9('0x22'));_0x24d8ec[_0x46d9('0x27')]=_[_0x46d9('0x28')](_0x15dd36['query']);_0x24d8ec['filters']=_[_0x46d9('0x29')](_0x24d8ec[_0x46d9('0x2a')],_0x24d8ec[_0x46d9('0x27')]);_0x21dcde[_0x46d9('0x2b')]=_[_0x46d9('0x29')](_0x24d8ec[_0x46d9('0x2a')],qs[_0x46d9('0x2c')](_0x15dd36[_0x46d9('0x27')][_0x46d9('0x2c')]));_0x21dcde[_0x46d9('0x2b')]=_0x21dcde[_0x46d9('0x2b')][_0x46d9('0x2d')]?_0x21dcde[_0x46d9('0x2b')]:_0x24d8ec[_0x46d9('0x2a')];if(!_0x15dd36['query'][_0x46d9('0x2e')](_0x46d9('0x2f'))){_0x21dcde[_0x46d9('0x30')]=qs[_0x46d9('0x30')](_0x15dd36['query'][_0x46d9('0x30')]);_0x21dcde[_0x46d9('0x1a')]=qs[_0x46d9('0x1a')](_0x15dd36[_0x46d9('0x27')][_0x46d9('0x1a')]);}_0x21dcde['order']=qs[_0x46d9('0x31')](_0x15dd36[_0x46d9('0x27')][_0x46d9('0x31')]);_0x21dcde[_0x46d9('0x32')]=qs['filters'](_['pick'](_0x15dd36[_0x46d9('0x27')],_0x24d8ec[_0x46d9('0x33')]),_0x20c6e6);if(_0x15dd36['query'][_0x46d9('0x34')]){_0x21dcde['where']=_[_0x46d9('0x35')](_0x21dcde['where'],{'$or':_[_0x46d9('0x23')](_0x20c6e6,function(_0x33c77a){if(_0x33c77a['type']!==_0x46d9('0x36')){var _0x1716ef={};_0x1716ef[_0x33c77a[_0x46d9('0x22')]]={'$like':'%'+_0x15dd36['query']['filter']+'%'};return _0x1716ef;}})});}_0x21dcde=_[_0x46d9('0x35')]({},_0x21dcde,_0x15dd36['options']);var _0x54efc0={'where':_0x21dcde[_0x46d9('0x32')]};return db[_0x46d9('0x37')][_0x46d9('0x38')](_0x54efc0)[_0x46d9('0x20')](function(_0x3f9de1){_0x1514c5['count']=_0x3f9de1;if(_0x15dd36[_0x46d9('0x27')][_0x46d9('0x39')]){_0x21dcde['include']=[{'all':!![]}];}return db[_0x46d9('0x37')][_0x46d9('0x3a')](_0x21dcde);})['then'](function(_0x143ca6){_0x1514c5[_0x46d9('0x3b')]=_0x143ca6;return _0x1514c5;})[_0x46d9('0x20')](respondWithFilteredResult(_0x27712a,_0x21dcde))[_0x46d9('0x3c')](handleError(_0x27712a,null));};exports[_0x46d9('0x3d')]=function(_0x1a8e37,_0x3b254b){var _0x398f9e={'raw':!![],'where':{'id':_0x1a8e37[_0x46d9('0x3e')]['id']}},_0x2cb44d={};_0x2cb44d['model']=_[_0x46d9('0x28')](db['VtigerField']['rawAttributes']);_0x2cb44d[_0x46d9('0x27')]=_[_0x46d9('0x28')](_0x1a8e37[_0x46d9('0x27')]);_0x2cb44d[_0x46d9('0x33')]=_[_0x46d9('0x29')](_0x2cb44d[_0x46d9('0x2a')],_0x2cb44d[_0x46d9('0x27')]);_0x398f9e['attributes']=_[_0x46d9('0x29')](_0x2cb44d[_0x46d9('0x2a')],qs['fields'](_0x1a8e37[_0x46d9('0x27')]['fields']));_0x398f9e['attributes']=_0x398f9e[_0x46d9('0x2b')][_0x46d9('0x2d')]?_0x398f9e[_0x46d9('0x2b')]:_0x2cb44d['model'];if(_0x1a8e37[_0x46d9('0x27')]['includeAll']){_0x398f9e[_0x46d9('0x3f')]=[{'all':!![]}];}_0x398f9e=_[_0x46d9('0x35')]({},_0x398f9e,_0x1a8e37[_0x46d9('0x40')]);return db['VtigerField']['find'](_0x398f9e)[_0x46d9('0x20')](handleEntityNotFound(_0x3b254b,null))[_0x46d9('0x20')](respondWithResult(_0x3b254b,null))[_0x46d9('0x3c')](handleError(_0x3b254b,null));};exports['create']=function(_0x432e8d,_0x559496){return db[_0x46d9('0x37')][_0x46d9('0x41')](_0x432e8d[_0x46d9('0x42')],{})[_0x46d9('0x20')](respondWithResult(_0x559496,0xc9))[_0x46d9('0x3c')](handleError(_0x559496,null));};exports['update']=function(_0xc57d7f,_0x45da1e){if(_0xc57d7f['body']['id']){delete _0xc57d7f[_0x46d9('0x42')]['id'];}return db[_0x46d9('0x37')][_0x46d9('0x43')]({'where':{'id':_0xc57d7f[_0x46d9('0x3e')]['id']}})[_0x46d9('0x20')](handleEntityNotFound(_0x45da1e,null))[_0x46d9('0x20')](saveUpdates(_0xc57d7f['body'],null))[_0x46d9('0x20')](respondWithResult(_0x45da1e,null))[_0x46d9('0x3c')](handleError(_0x45da1e,null));};exports[_0x46d9('0x44')]=function(_0x265364,_0x5987e6){return db[_0x46d9('0x37')]['find']({'where':{'id':_0x265364[_0x46d9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5987e6,null))[_0x46d9('0x20')](removeEntity(_0x5987e6,null))[_0x46d9('0x3c')](handleError(_0x5987e6,null));}; \ No newline at end of file +var _0x0c24=['fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','offset','limit','set','json','apply','save','update','destroy','then','status','error','name','send','index','map','VtigerField','rawAttributes'];(function(_0x2e8b13,_0xce20fc){var _0xdce285=function(_0x5c13b5){while(--_0x5c13b5){_0x2e8b13['push'](_0x2e8b13['shift']());}};_0xdce285(++_0xce20fc);}(_0x0c24,0x13b));var _0x40c2=function(_0x2e97bf,_0x569e2b){_0x2e97bf=_0x2e97bf-0x0;var _0x3b2110=_0x0c24[_0x2e97bf];return _0x3b2110;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x40c2('0x0'));var zipdir=require(_0x40c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x40c2('0x3'));var util=require(_0x40c2('0x4'));var path=require(_0x40c2('0x5'));var sox=require('sox');var csv=require(_0x40c2('0x6'));var ejs=require(_0x40c2('0x7'));var fs=require('fs');var _=require(_0x40c2('0x8'));var squel=require(_0x40c2('0x9'));var crypto=require(_0x40c2('0xa'));var jsforce=require(_0x40c2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40c2('0x6'));var querystring=require(_0x40c2('0xc'));var Papa=require(_0x40c2('0xd'));var Redis=require(_0x40c2('0xe'));var authService=require(_0x40c2('0xf'));var qs=require(_0x40c2('0x10'));var as=require(_0x40c2('0x11'));var hardwareService=require(_0x40c2('0x12'));var logger=require(_0x40c2('0x13'))(_0x40c2('0x14'));var utils=require('../../config/utils');var config=require(_0x40c2('0x15'));var db=require(_0x40c2('0x16'))['db'];function respondWithStatusCode(_0x160884,_0x1141aa){_0x1141aa=_0x1141aa||0xcc;return function(_0x1ce344){if(_0x1ce344){return _0x160884['sendStatus'](_0x1141aa);}return _0x160884['status'](_0x1141aa)['end']();};}function respondWithResult(_0x4194f8,_0x23e394){_0x23e394=_0x23e394||0xc8;return function(_0x5a8d68){if(_0x5a8d68){return _0x4194f8['status'](_0x23e394)['json'](_0x5a8d68);}};}function respondWithFilteredResult(_0x21dc2b,_0x5db68d){return function(_0x3e7da7){if(_0x3e7da7){var _0x20f3df=_0x3e7da7['count'],_0x21c6e8=_0x5db68d[_0x40c2('0x17')],_0x23d976=_0x5db68d['offset']+_0x5db68d[_0x40c2('0x18')],_0x505b32;if(_0x23d976>=_0x20f3df){_0x23d976=_0x20f3df;_0x505b32=0xc8;}else{_0x505b32=0xce;}_0x21dc2b['status'](_0x505b32);return _0x21dc2b[_0x40c2('0x19')]('Content-Range',_0x21c6e8+'-'+_0x23d976+'/'+_0x20f3df)[_0x40c2('0x1a')](_0x3e7da7);}return null;};}function patchUpdates(_0x506603){return function(_0x532367){try{jsonpatch[_0x40c2('0x1b')](_0x532367,_0x506603,!![]);}catch(_0x3eaab5){return BPromise['reject'](_0x3eaab5);}return _0x532367[_0x40c2('0x1c')]();};}function saveUpdates(_0x21d445,_0x1a6a4b){return function(_0x131093){if(_0x131093){return _0x131093[_0x40c2('0x1d')](_0x21d445)['then'](function(_0x585c00){return _0x585c00;});}return null;};}function removeEntity(_0xa7ae60,_0x254c16){return function(_0x69ee6a){if(_0x69ee6a){return _0x69ee6a[_0x40c2('0x1e')]()[_0x40c2('0x1f')](function(){_0xa7ae60[_0x40c2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284d41,_0x4b5234){return function(_0x2e097a){if(!_0x2e097a){_0x284d41['sendStatus'](0x194);}return _0x2e097a;};}function handleError(_0x5b68f3,_0x300bba){_0x300bba=_0x300bba||0x1f4;return function(_0x10a5ad){logger[_0x40c2('0x21')](_0x10a5ad['stack']);if(_0x10a5ad[_0x40c2('0x22')]){delete _0x10a5ad[_0x40c2('0x22')];}_0x5b68f3[_0x40c2('0x20')](_0x300bba)[_0x40c2('0x23')](_0x10a5ad);};}exports[_0x40c2('0x24')]=function(_0x57c69a,_0x350218){var _0x594f00={},_0x3c43ba={},_0x1fcf3a={'count':0x0,'rows':[]};var _0x165d4a=_[_0x40c2('0x25')](db[_0x40c2('0x26')][_0x40c2('0x27')],function(_0x373572){return{'name':_0x373572[_0x40c2('0x28')],'type':_0x373572[_0x40c2('0x29')][_0x40c2('0x2a')]};});_0x3c43ba[_0x40c2('0x2b')]=_[_0x40c2('0x25')](_0x165d4a,_0x40c2('0x22'));_0x3c43ba[_0x40c2('0x2c')]=_[_0x40c2('0x2d')](_0x57c69a[_0x40c2('0x2c')]);_0x3c43ba['filters']=_[_0x40c2('0x2e')](_0x3c43ba['model'],_0x3c43ba['query']);_0x594f00['attributes']=_['intersection'](_0x3c43ba[_0x40c2('0x2b')],qs[_0x40c2('0x2f')](_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x2f')]));_0x594f00[_0x40c2('0x30')]=_0x594f00[_0x40c2('0x30')]['length']?_0x594f00[_0x40c2('0x30')]:_0x3c43ba['model'];if(!_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x31')](_0x40c2('0x32'))){_0x594f00[_0x40c2('0x18')]=qs[_0x40c2('0x18')](_0x57c69a['query'][_0x40c2('0x18')]);_0x594f00[_0x40c2('0x17')]=qs[_0x40c2('0x17')](_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x17')]);}_0x594f00[_0x40c2('0x33')]=qs['sort'](_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x34')]);_0x594f00['where']=qs[_0x40c2('0x35')](_[_0x40c2('0x36')](_0x57c69a[_0x40c2('0x2c')],_0x3c43ba[_0x40c2('0x35')]),_0x165d4a);if(_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x37')]){_0x594f00['where']=_[_0x40c2('0x38')](_0x594f00[_0x40c2('0x39')],{'$or':_['map'](_0x165d4a,function(_0x432f97){if(_0x432f97['type']!=='VIRTUAL'){var _0x4ade6c={};_0x4ade6c[_0x432f97[_0x40c2('0x22')]]={'$like':'%'+_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x37')]+'%'};return _0x4ade6c;}})});}_0x594f00=_[_0x40c2('0x38')]({},_0x594f00,_0x57c69a[_0x40c2('0x3a')]);var _0x4b34f2={'where':_0x594f00[_0x40c2('0x39')]};return db[_0x40c2('0x26')][_0x40c2('0x3b')](_0x4b34f2)[_0x40c2('0x1f')](function(_0x114f59){_0x1fcf3a['count']=_0x114f59;if(_0x57c69a[_0x40c2('0x2c')][_0x40c2('0x3c')]){_0x594f00[_0x40c2('0x3d')]=[{'all':!![]}];}return db[_0x40c2('0x26')][_0x40c2('0x3e')](_0x594f00);})[_0x40c2('0x1f')](function(_0x4bee1f){_0x1fcf3a[_0x40c2('0x3f')]=_0x4bee1f;return _0x1fcf3a;})[_0x40c2('0x1f')](respondWithFilteredResult(_0x350218,_0x594f00))[_0x40c2('0x40')](handleError(_0x350218,null));};exports[_0x40c2('0x41')]=function(_0x4bc4aa,_0x1bf377){var _0x514088={'raw':!![],'where':{'id':_0x4bc4aa[_0x40c2('0x42')]['id']}},_0x2679e2={};_0x2679e2[_0x40c2('0x2b')]=_[_0x40c2('0x2d')](db[_0x40c2('0x26')][_0x40c2('0x27')]);_0x2679e2[_0x40c2('0x2c')]=_[_0x40c2('0x2d')](_0x4bc4aa[_0x40c2('0x2c')]);_0x2679e2[_0x40c2('0x35')]=_['intersection'](_0x2679e2[_0x40c2('0x2b')],_0x2679e2[_0x40c2('0x2c')]);_0x514088[_0x40c2('0x30')]=_[_0x40c2('0x2e')](_0x2679e2[_0x40c2('0x2b')],qs[_0x40c2('0x2f')](_0x4bc4aa['query'][_0x40c2('0x2f')]));_0x514088[_0x40c2('0x30')]=_0x514088['attributes'][_0x40c2('0x43')]?_0x514088[_0x40c2('0x30')]:_0x2679e2[_0x40c2('0x2b')];if(_0x4bc4aa['query'][_0x40c2('0x3c')]){_0x514088['include']=[{'all':!![]}];}_0x514088=_[_0x40c2('0x38')]({},_0x514088,_0x4bc4aa['options']);return db[_0x40c2('0x26')]['find'](_0x514088)[_0x40c2('0x1f')](handleEntityNotFound(_0x1bf377,null))['then'](respondWithResult(_0x1bf377,null))[_0x40c2('0x40')](handleError(_0x1bf377,null));};exports['create']=function(_0x1cbb68,_0xb9fbb7){return db[_0x40c2('0x26')][_0x40c2('0x44')](_0x1cbb68[_0x40c2('0x45')],{})[_0x40c2('0x1f')](respondWithResult(_0xb9fbb7,0xc9))['catch'](handleError(_0xb9fbb7,null));};exports[_0x40c2('0x1d')]=function(_0x5208c0,_0x333541){if(_0x5208c0[_0x40c2('0x45')]['id']){delete _0x5208c0['body']['id'];}return db['VtigerField'][_0x40c2('0x46')]({'where':{'id':_0x5208c0['params']['id']}})[_0x40c2('0x1f')](handleEntityNotFound(_0x333541,null))['then'](saveUpdates(_0x5208c0[_0x40c2('0x45')],null))[_0x40c2('0x1f')](respondWithResult(_0x333541,null))['catch'](handleError(_0x333541,null));};exports['destroy']=function(_0x1fe90c,_0x4481e5){return db[_0x40c2('0x26')][_0x40c2('0x46')]({'where':{'id':_0x1fe90c['params']['id']}})[_0x40c2('0x1f')](handleEntityNotFound(_0x4481e5,null))[_0x40c2('0x1f')](removeEntity(_0x4481e5,null))[_0x40c2('0x40')](handleError(_0x4481e5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cab7888..aa57d94 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 _0xf3cd=['int_vtiger_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x26dfc5,_0x138166){_0x26dfc5=_0x26dfc5-0x0;var _0x566350=_0xf3cd[_0x26dfc5];return _0x566350;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xdf3c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x421361,_0x3bb9a0){_0x421361=_0x421361-0x0;var _0x41aeb1=_0x9bde[_0x421361];return _0x41aeb1;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[{'name':_0xe9bd('0xc'),'fields':[_0xe9bd('0xd'),_0xe9bd('0xe')],'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 be60dd0..c042411 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 _0x0490=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0xe732e,_0x3968fc){var _0x4d7075=function(_0x22e0df){while(--_0x22e0df){_0xe732e['push'](_0xe732e['shift']());}};_0x4d7075(++_0x3968fc);}(_0x0490,0x147));var _0x0049=function(_0xaaa453,_0x2d2e74){_0xaaa453=_0xaaa453-0x0;var _0x240cb4=_0x0490[_0xaaa453];return _0x240cb4;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0049('0x1'))['db'];var utils=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))(_0x0049('0x4'));var config=require(_0x0049('0x5'));var jayson=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28c8d2,_0x57fca5,_0x18bff7){return new BPromise(function(_0xe091c4,_0x154219){return client['request'](_0x28c8d2,_0x18bff7)[_0x0049('0x9')](function(_0x3f2ca1){logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));logger[_0x0049('0xd')](_0x0049('0xe'),_0x57fca5,_0x0049('0xc'),JSON[_0x0049('0xf')](_0x3f2ca1));if(_0x3f2ca1['error']){if(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x11')]===0x1f4){logger[_0x0049('0x10')]('VtigerField,\x20%s,\x20%s',_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0x154219(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x12')]);}logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0xe091c4(_0x3f2ca1[_0x0049('0x10')]['message']);}else{logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));_0xe091c4(_0x3f2ca1[_0x0049('0x13')]['message']);}})['catch'](function(_0x4315b5){logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x4315b5);_0x154219(_0x4315b5);});});} \ No newline at end of file +var _0x4899=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','../../mysqldb'];(function(_0x179118,_0x5ad20f){var _0x18b819=function(_0x56d91a){while(--_0x56d91a){_0x179118['push'](_0x179118['shift']());}};_0x18b819(++_0x5ad20f);}(_0x4899,0x74));var _0x9489=function(_0x175a0f,_0x113e2d){_0x175a0f=_0x175a0f-0x0;var _0x34385e=_0x4899[_0x175a0f];return _0x34385e;};'use strict';var _=require(_0x9489('0x0'));var util=require('util');var moment=require(_0x9489('0x1'));var BPromise=require('bluebird');var rs=require(_0x9489('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9489('0x3'))['db'];var utils=require(_0x9489('0x4'));var logger=require(_0x9489('0x5'))(_0x9489('0x6'));var config=require(_0x9489('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9489('0x8')][_0x9489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x411ebe,_0x31e8c3,_0x574279){return new BPromise(function(_0x553c77,_0x1379eb){return client['request'](_0x411ebe,_0x574279)[_0x9489('0xa')](function(_0xb426d8){logger['info'](_0x9489('0xb'),_0x31e8c3,_0x9489('0xc'));logger[_0x9489('0xd')](_0x9489('0xe'),_0x31e8c3,_0x9489('0xc'),JSON[_0x9489('0xf')](_0xb426d8));if(_0xb426d8[_0x9489('0x10')]){if(_0xb426d8[_0x9489('0x10')]['code']===0x1f4){logger[_0x9489('0x10')](_0x9489('0xb'),_0x31e8c3,_0xb426d8[_0x9489('0x10')]['message']);return _0x1379eb(_0xb426d8['error'][_0x9489('0x11')]);}logger[_0x9489('0x10')](_0x9489('0xb'),_0x31e8c3,_0xb426d8['error'][_0x9489('0x11')]);return _0x553c77(_0xb426d8['error'][_0x9489('0x11')]);}else{logger['info'](_0x9489('0xb'),_0x31e8c3,_0x9489('0xc'));_0x553c77(_0xb426d8[_0x9489('0x12')][_0x9489('0x11')]);}})[_0x9489('0x13')](function(_0x4c1389){logger[_0x9489('0x10')]('VtigerField,\x20%s,\x20%s',_0x31e8c3,_0x4c1389);_0x1379eb(_0x4c1389);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index aad2795..8322cfa 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 _0x61a0=['getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x188416,_0x2f2922){var _0x41a709=function(_0x5f3f91){while(--_0x5f3f91){_0x188416['push'](_0x188416['shift']());}};_0x41a709(++_0x2f2922);}(_0x61a0,0x1ea));var _0x061a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x61a0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x061a('0x0'));var util=require(_0x061a('0x1'));var path=require(_0x061a('0x2'));var timeout=require(_0x061a('0x3'));var express=require('express');var router=express[_0x061a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x061a('0x5'));var controller=require(_0x061a('0x6'));router[_0x061a('0x7')]('/',auth[_0x061a('0x8')](),controller[_0x061a('0x9')]);router[_0x061a('0x7')](_0x061a('0xa'),auth[_0x061a('0x8')](),controller['show']);router['get'](_0x061a('0xb'),auth[_0x061a('0x8')](),controller[_0x061a('0xc')]);router[_0x061a('0x7')](_0x061a('0xd'),auth[_0x061a('0x8')](),controller[_0x061a('0xe')]);router[_0x061a('0xf')]('/',auth[_0x061a('0x8')](),controller['create']);router[_0x061a('0xf')](_0x061a('0xb'),auth[_0x061a('0x8')](),controller[_0x061a('0x10')]);router[_0x061a('0x11')](_0x061a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x061a('0x12')](_0x061a('0xa'),auth[_0x061a('0x8')](),controller[_0x061a('0x13')]);module[_0x061a('0x14')]=router; \ No newline at end of file +var _0x5d4e=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d4e,0x1db));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var path=require(_0xe5d4('0x2'));var timeout=require(_0xe5d4('0x3'));var express=require(_0xe5d4('0x4'));var router=express[_0xe5d4('0x5')]();var auth=require(_0xe5d4('0x6'));var interaction=require(_0xe5d4('0x7'));var config=require(_0xe5d4('0x8'));var controller=require(_0xe5d4('0x9'));router[_0xe5d4('0xa')]('/',auth['isAuthenticated'](),controller[_0xe5d4('0xb')]);router[_0xe5d4('0xa')](_0xe5d4('0xc'),auth[_0xe5d4('0xd')](),controller[_0xe5d4('0xe')]);router[_0xe5d4('0xa')]('/:id/configurations',auth[_0xe5d4('0xd')](),controller[_0xe5d4('0xf')]);router[_0xe5d4('0xa')]('/:id/fields',auth[_0xe5d4('0xd')](),controller[_0xe5d4('0x10')]);router[_0xe5d4('0x11')]('/',auth[_0xe5d4('0xd')](),controller[_0xe5d4('0x12')]);router[_0xe5d4('0x11')]('/:id/configurations',auth[_0xe5d4('0xd')](),controller[_0xe5d4('0x13')]);router[_0xe5d4('0x14')](_0xe5d4('0xc'),auth[_0xe5d4('0xd')](),controller[_0xe5d4('0x15')]);router[_0xe5d4('0x16')]('/:id',auth[_0xe5d4('0xd')](),controller[_0xe5d4('0x17')]);module[_0xe5d4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index bc0f202..eb2a16a 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 _0xb97f=['sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xb97f,0x108));var _0xfb97=function(_0x1e99e3,_0x19276e){_0x1e99e3=_0x1e99e3-0x0;var _0x15ef00=_0xb97f[_0x1e99e3];return _0x15ef00;};'use strict';var Sequelize=require(_0xfb97('0x0'));module[_0xfb97('0x1')]={'name':{'type':Sequelize[_0xfb97('0x2')]},'description':{'type':Sequelize[_0xfb97('0x2')]},'username':{'type':Sequelize[_0xfb97('0x2')],'unique':_0xfb97('0x3')},'password':{'type':Sequelize[_0xfb97('0x2')]},'token':{'type':Sequelize[_0xfb97('0x2')]},'remoteUri':{'type':Sequelize[_0xfb97('0x2')],'unique':_0xfb97('0x4')},'authType':{'type':Sequelize[_0xfb97('0x5')]('password','token'),'defaultValue':_0xfb97('0x6')},'serverUrl':{'type':Sequelize[_0xfb97('0x2')]},'type':{'type':Sequelize['ENUM'](_0xfb97('0x7'),'newTab'),'defaultValue':_0xfb97('0x7')}}; \ No newline at end of file +var _0x2b94=['sequelize','exports','STRING','username','remoteUri','token','password','integrationTab'];(function(_0x4084cc,_0xbce3d5){var _0x2a8199=function(_0x87f4b3){while(--_0x87f4b3){_0x4084cc['push'](_0x4084cc['shift']());}};_0x2a8199(++_0xbce3d5);}(_0x2b94,0x1d8));var _0x42b9=function(_0x43e85f,_0x3bccb1){_0x43e85f=_0x43e85f-0x0;var _0x4a6023=_0x2b94[_0x43e85f];return _0x4a6023;};'use strict';var Sequelize=require(_0x42b9('0x0'));module[_0x42b9('0x1')]={'name':{'type':Sequelize[_0x42b9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x42b9('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x42b9('0x2')]},'remoteUri':{'type':Sequelize[_0x42b9('0x2')],'unique':_0x42b9('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0x42b9('0x5')),'defaultValue':_0x42b9('0x6')},'serverUrl':{'type':Sequelize[_0x42b9('0x2')]},'type':{'type':Sequelize['ENUM'](_0x42b9('0x7'),'newTab'),'defaultValue':_0x42b9('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4ee08d5..e9c1648 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 _0xe2a0=['includes','ticket_fields','title','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','destroy','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','update','getConfigurations','ZendeskConfiguration','pick','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','GET','format','%s/%s','headers','Basic\x20%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xe2a0,0x82));var _0x0e2a=function(_0x1826dd,_0x298d9b){_0x1826dd=_0x1826dd-0x0;var _0x1b01b9=_0xe2a0[_0x1826dd];return _0x1b01b9;};'use strict';var pdf=require(_0x0e2a('0x0'));var emlformat=require(_0x0e2a('0x1'));var rimraf=require(_0x0e2a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e2a('0x3'));var rp=require(_0x0e2a('0x4'));var moment=require('moment');var BPromise=require(_0x0e2a('0x5'));var Mustache=require(_0x0e2a('0x6'));var util=require('util');var path=require(_0x0e2a('0x7'));var sox=require(_0x0e2a('0x8'));var csv=require('to-csv');var ejs=require(_0x0e2a('0x9'));var fs=require('fs');var _=require(_0x0e2a('0xa'));var squel=require(_0x0e2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e2a('0xc'));var deskjs=require(_0x0e2a('0xd'));var toCsv=require(_0x0e2a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e2a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e2a('0x11'));var logger=require(_0x0e2a('0x12'))(_0x0e2a('0x13'));var utils=require(_0x0e2a('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0e2a('0x15'));var client=jayson['client'][_0x0e2a('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1d7bbe,_0x208336,_0x4a11c5){if(_0x4a11c5){var _0x2f64b6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f64b6['test'](_0x208336)){return _0x1d7bbe;}else{throw new db[(_0x0e2a('0x17'))]['ValidationError'](_0x0e2a('0x18'));}}else{return _0x1d7bbe;}}function respondWithRpcPromise(_0x159139,_0x93955,_0x334937,_0x2752d3){return new BPromise(function(_0x32bc7b,_0x54092f){var _0x2ca9eb=_0x2752d3||client;return _0x2ca9eb[_0x0e2a('0x19')](_0x159139,_0x334937)[_0x0e2a('0x1a')](function(_0x34d086){logger[_0x0e2a('0x1b')](_0x0e2a('0x1c'),_0x93955,_0x0e2a('0x1d'));logger[_0x0e2a('0x1e')](_0x0e2a('0x1f'),_0x93955,_0x0e2a('0x1d'),JSON[_0x0e2a('0x20')](_0x34d086));if(_0x34d086['error']){if(_0x34d086[_0x0e2a('0x21')][_0x0e2a('0x22')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x93955,_0x34d086[_0x0e2a('0x21')][_0x0e2a('0x23')]);return _0x54092f(_0x34d086['error'][_0x0e2a('0x23')]);}logger[_0x0e2a('0x21')](_0x0e2a('0x1c'),_0x93955,_0x34d086[_0x0e2a('0x21')]['message']);return _0x32bc7b(_0x34d086[_0x0e2a('0x21')]['message']);}else{logger['info'](_0x0e2a('0x1c'),_0x93955,_0x0e2a('0x1d'));_0x32bc7b(_0x34d086[_0x0e2a('0x24')][_0x0e2a('0x23')]);}})['catch'](function(_0x5b680e){logger[_0x0e2a('0x21')](_0x0e2a('0x1c'),_0x93955,_0x5b680e);_0x54092f(_0x5b680e);});});}function respondWithStatusCode(_0x541a52,_0x2c74c2){_0x2c74c2=_0x2c74c2||0xcc;return function(_0x375585){if(_0x375585){return _0x541a52[_0x0e2a('0x25')](_0x2c74c2);}return _0x541a52['status'](_0x2c74c2)[_0x0e2a('0x26')]();};}function respondWithResult(_0x102519,_0x544045){_0x544045=_0x544045||0xc8;return function(_0x4dbda0){if(_0x4dbda0){return _0x102519[_0x0e2a('0x27')](_0x544045)[_0x0e2a('0x28')](_0x4dbda0);}};}function respondWithFilteredResult(_0x383683,_0x13bcfe){return function(_0x100579){if(_0x100579){var _0x3c8896=_0x100579[_0x0e2a('0x29')],_0x15aa50=_0x13bcfe['offset'],_0x5461e0=_0x13bcfe[_0x0e2a('0x2a')]+_0x13bcfe[_0x0e2a('0x2b')],_0x59ffd4;if(_0x5461e0>=_0x3c8896){_0x5461e0=_0x3c8896;_0x59ffd4=0xc8;}else{_0x59ffd4=0xce;}_0x383683[_0x0e2a('0x27')](_0x59ffd4);return _0x383683[_0x0e2a('0x2c')]('Content-Range',_0x15aa50+'-'+_0x5461e0+'/'+_0x3c8896)[_0x0e2a('0x28')](_0x100579);}return null;};}function patchUpdates(_0xa3ef4){return function(_0x527e89){try{jsonpatch[_0x0e2a('0x2d')](_0x527e89,_0xa3ef4,!![]);}catch(_0x14d5bd){return BPromise[_0x0e2a('0x2e')](_0x14d5bd);}return _0x527e89[_0x0e2a('0x2f')]();};}function saveUpdates(_0xa0b9e4,_0x3ea195){return function(_0xb28291){if(_0xb28291){return _0xb28291['update'](_0xa0b9e4)[_0x0e2a('0x1a')](function(_0x3bedea){return _0x3bedea;});}return null;};}function removeEntity(_0x1d08eb,_0x52d77e){return function(_0x7f4446){if(_0x7f4446){return _0x7f4446[_0x0e2a('0x30')]()[_0x0e2a('0x1a')](function(){_0x1d08eb['status'](0xcc)[_0x0e2a('0x26')]();});}};}function handleEntityNotFound(_0x44344e,_0xb44cfd){return function(_0x295294){if(!_0x295294){_0x44344e[_0x0e2a('0x25')](0x194);}return _0x295294;};}function handleError(_0x5a3fa5,_0x58fb46){_0x58fb46=_0x58fb46||0x1f4;return function(_0xdc5e84){logger[_0x0e2a('0x21')](_0xdc5e84[_0x0e2a('0x31')]);if(_0xdc5e84['name']){delete _0xdc5e84[_0x0e2a('0x32')];}_0x5a3fa5[_0x0e2a('0x27')](_0x58fb46)[_0x0e2a('0x33')](_0xdc5e84);};}exports['index']=function(_0x369a95,_0x4eed94){var _0x6af800={},_0x14f6cb={},_0x3d3bc1={'count':0x0,'rows':[]};var _0x3f900f=_[_0x0e2a('0x34')](db[_0x0e2a('0x35')]['rawAttributes'],function(_0x59d176){return{'name':_0x59d176[_0x0e2a('0x36')],'type':_0x59d176[_0x0e2a('0x37')][_0x0e2a('0x38')]};});_0x14f6cb[_0x0e2a('0x39')]=_[_0x0e2a('0x34')](_0x3f900f,_0x0e2a('0x32'));_0x14f6cb[_0x0e2a('0x3a')]=_[_0x0e2a('0x3b')](_0x369a95[_0x0e2a('0x3a')]);_0x14f6cb[_0x0e2a('0x3c')]=_[_0x0e2a('0x3d')](_0x14f6cb[_0x0e2a('0x39')],_0x14f6cb[_0x0e2a('0x3a')]);_0x6af800['attributes']=_[_0x0e2a('0x3d')](_0x14f6cb['model'],qs['fields'](_0x369a95[_0x0e2a('0x3a')]['fields']));_0x6af800['attributes']=_0x6af800[_0x0e2a('0x3e')][_0x0e2a('0x3f')]?_0x6af800[_0x0e2a('0x3e')]:_0x14f6cb[_0x0e2a('0x39')];if(!_0x369a95[_0x0e2a('0x3a')]['hasOwnProperty'](_0x0e2a('0x40'))){_0x6af800['limit']=qs['limit'](_0x369a95['query'][_0x0e2a('0x2b')]);_0x6af800[_0x0e2a('0x2a')]=qs[_0x0e2a('0x2a')](_0x369a95[_0x0e2a('0x3a')][_0x0e2a('0x2a')]);}_0x6af800[_0x0e2a('0x41')]=qs[_0x0e2a('0x42')](_0x369a95['query'][_0x0e2a('0x42')]);_0x6af800['where']=qs['filters'](_['pick'](_0x369a95[_0x0e2a('0x3a')],_0x14f6cb[_0x0e2a('0x3c')]),_0x3f900f);if(_0x369a95[_0x0e2a('0x3a')][_0x0e2a('0x43')]){_0x6af800[_0x0e2a('0x44')]=_[_0x0e2a('0x45')](_0x6af800['where'],{'$or':_[_0x0e2a('0x34')](_0x3f900f,function(_0x4733b2){if(_0x4733b2['type']!==_0x0e2a('0x46')){var _0x2176db={};_0x2176db[_0x4733b2['name']]={'$like':'%'+_0x369a95['query']['filter']+'%'};return _0x2176db;}})});}_0x6af800=_[_0x0e2a('0x45')]({},_0x6af800,_0x369a95[_0x0e2a('0x47')]);var _0x254e44={'where':_0x6af800[_0x0e2a('0x44')]};return db['ZendeskAccount'][_0x0e2a('0x29')](_0x254e44)['then'](function(_0x58630a){_0x3d3bc1[_0x0e2a('0x29')]=_0x58630a;if(_0x369a95['query'][_0x0e2a('0x48')]){_0x6af800[_0x0e2a('0x49')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x0e2a('0x4a')](_0x6af800);})[_0x0e2a('0x1a')](function(_0x241dbc){_0x3d3bc1['rows']=_0x241dbc;return _0x3d3bc1;})['then'](respondWithFilteredResult(_0x4eed94,_0x6af800))[_0x0e2a('0x4b')](handleError(_0x4eed94,null));};exports[_0x0e2a('0x4c')]=function(_0x5b9166,_0x964419){var _0x405303={'raw':![],'where':{'id':_0x5b9166[_0x0e2a('0x4d')]['id']}},_0x1741da={};_0x1741da[_0x0e2a('0x39')]=_[_0x0e2a('0x3b')](db[_0x0e2a('0x35')][_0x0e2a('0x4e')]);_0x1741da[_0x0e2a('0x3a')]=_[_0x0e2a('0x3b')](_0x5b9166['query']);_0x1741da[_0x0e2a('0x3c')]=_['intersection'](_0x1741da['model'],_0x1741da[_0x0e2a('0x3a')]);_0x405303[_0x0e2a('0x3e')]=_[_0x0e2a('0x3d')](_0x1741da[_0x0e2a('0x39')],qs[_0x0e2a('0x4f')](_0x5b9166[_0x0e2a('0x3a')][_0x0e2a('0x4f')]));_0x405303[_0x0e2a('0x3e')]=_0x405303['attributes'][_0x0e2a('0x3f')]?_0x405303[_0x0e2a('0x3e')]:_0x1741da[_0x0e2a('0x39')];if(_0x5b9166[_0x0e2a('0x3a')][_0x0e2a('0x48')]){_0x405303['include']=[{'all':!![]}];}_0x405303=_['merge']({},_0x405303,_0x5b9166[_0x0e2a('0x47')]);return db[_0x0e2a('0x35')][_0x0e2a('0x50')](_0x405303)[_0x0e2a('0x1a')](handleEntityNotFound(_0x964419,null))[_0x0e2a('0x1a')](respondWithResult(_0x964419,null))[_0x0e2a('0x4b')](handleError(_0x964419,null));};exports[_0x0e2a('0x51')]=function(_0x3cda05,_0x85a8ed){return db[_0x0e2a('0x35')][_0x0e2a('0x51')](_0x3cda05[_0x0e2a('0x52')],{})[_0x0e2a('0x1a')](respondWithResult(_0x85a8ed,0xc9))[_0x0e2a('0x4b')](handleError(_0x85a8ed,null));};exports[_0x0e2a('0x53')]=function(_0x3191de,_0x49c14a){if(_0x3191de[_0x0e2a('0x52')]['id']){delete _0x3191de[_0x0e2a('0x52')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x3191de[_0x0e2a('0x4d')]['id']}})[_0x0e2a('0x1a')](handleEntityNotFound(_0x49c14a,null))[_0x0e2a('0x1a')](saveUpdates(_0x3191de[_0x0e2a('0x52')],null))['then'](respondWithResult(_0x49c14a,null))[_0x0e2a('0x4b')](handleError(_0x49c14a,null));};exports['destroy']=function(_0x34d71b,_0x49d36e){return db[_0x0e2a('0x35')][_0x0e2a('0x50')]({'where':{'id':_0x34d71b[_0x0e2a('0x4d')]['id']}})[_0x0e2a('0x1a')](handleEntityNotFound(_0x49d36e,null))['then'](removeEntity(_0x49d36e,null))[_0x0e2a('0x4b')](handleError(_0x49d36e,null));};exports[_0x0e2a('0x54')]=function(_0x45c033,_0x13725f,_0x4551b1){var _0x21cfd3={};var _0xc6e69c={};var _0xe52739;var _0xe9905e;return db[_0x0e2a('0x35')]['findOne']({'where':{'id':_0x45c033[_0x0e2a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13725f,null))[_0x0e2a('0x1a')](function(_0x312f9b){if(_0x312f9b){_0xe52739=_0x312f9b;_0xc6e69c['model']=_[_0x0e2a('0x3b')](db[_0x0e2a('0x55')][_0x0e2a('0x4e')]);_0xc6e69c[_0x0e2a('0x3a')]=_[_0x0e2a('0x3b')](_0x45c033[_0x0e2a('0x3a')]);_0xc6e69c[_0x0e2a('0x3c')]=_[_0x0e2a('0x3d')](_0xc6e69c[_0x0e2a('0x39')],_0xc6e69c[_0x0e2a('0x3a')]);_0x21cfd3['attributes']=_[_0x0e2a('0x3d')](_0xc6e69c['model'],qs[_0x0e2a('0x4f')](_0x45c033[_0x0e2a('0x3a')][_0x0e2a('0x4f')]));_0x21cfd3[_0x0e2a('0x3e')]=_0x21cfd3[_0x0e2a('0x3e')][_0x0e2a('0x3f')]?_0x21cfd3['attributes']:_0xc6e69c[_0x0e2a('0x39')];_0x21cfd3[_0x0e2a('0x41')]=qs[_0x0e2a('0x42')](_0x45c033['query'][_0x0e2a('0x42')]);_0x21cfd3[_0x0e2a('0x44')]=qs[_0x0e2a('0x3c')](_[_0x0e2a('0x56')](_0x45c033[_0x0e2a('0x3a')],_0xc6e69c[_0x0e2a('0x3c')]));if(_0x45c033[_0x0e2a('0x3a')][_0x0e2a('0x43')]){_0x21cfd3[_0x0e2a('0x44')]=_[_0x0e2a('0x45')](_0x21cfd3[_0x0e2a('0x44')],{'$or':_[_0x0e2a('0x34')](_0x21cfd3[_0x0e2a('0x3e')],function(_0x505f20){var _0x34d136={};_0x34d136[_0x505f20]={'$like':'%'+_0x45c033[_0x0e2a('0x3a')]['filter']+'%'};return _0x34d136;})});}_0x21cfd3=_[_0x0e2a('0x45')]({},_0x21cfd3,_0x45c033['options']);return _0xe52739[_0x0e2a('0x54')](_0x21cfd3);}})['then'](function(_0x15cf49){if(_0x15cf49){_0xe9905e=_0x15cf49[_0x0e2a('0x3f')];if(!_0x45c033[_0x0e2a('0x3a')]['hasOwnProperty'](_0x0e2a('0x40'))){_0x21cfd3[_0x0e2a('0x2b')]=qs[_0x0e2a('0x2b')](_0x45c033[_0x0e2a('0x3a')]['limit']);_0x21cfd3[_0x0e2a('0x2a')]=qs['offset'](_0x45c033[_0x0e2a('0x3a')][_0x0e2a('0x2a')]);}return _0xe52739[_0x0e2a('0x54')](_0x21cfd3);}})[_0x0e2a('0x1a')](function(_0x3a28a1){if(_0x3a28a1){return _0x3a28a1?{'count':_0xe9905e,'rows':_0x3a28a1}:null;}})[_0x0e2a('0x1a')](respondWithResult(_0x13725f,null))[_0x0e2a('0x4b')](handleError(_0x13725f,null));};exports[_0x0e2a('0x57')]=function(_0x5e0b07,_0x369cd2,_0x5bd266){if(_0x5e0b07[_0x0e2a('0x52')]['id']){delete _0x5e0b07['body']['id'];}return db[_0x0e2a('0x35')][_0x0e2a('0x58')]({'where':{'id':_0x5e0b07['params']['id']}})[_0x0e2a('0x1a')](handleEntityNotFound(_0x369cd2,null))['then'](function(_0x2c3f4e){if(_0x2c3f4e){_0x5e0b07[_0x0e2a('0x52')][_0x0e2a('0x59')]=_0x2c3f4e['id'];_0x5e0b07[_0x0e2a('0x52')]['Subjects']=integrations['getSubjects'](_0x5e0b07[_0x0e2a('0x52')][_0x0e2a('0x5a')],_0x5e0b07['body'][_0x0e2a('0x37')]);_0x5e0b07[_0x0e2a('0x52')][_0x0e2a('0x5b')]=integrations[_0x0e2a('0x5c')](_0x5e0b07['body'][_0x0e2a('0x5a')],_0x5e0b07['body'][_0x0e2a('0x37')]);return db[_0x0e2a('0x55')][_0x0e2a('0x51')](_0x5e0b07[_0x0e2a('0x52')],{'include':[{'model':db[_0x0e2a('0x5d')],'as':_0x0e2a('0x5e')},{'model':db['ZendeskField'],'as':_0x0e2a('0x5b')}]});}return null;})[_0x0e2a('0x1a')](respondWithResult(_0x369cd2,null))['catch'](handleError(_0x369cd2,null));};exports[_0x0e2a('0x5f')]=function(_0x329b52,_0xd3beb5,_0x55fe07){var _0x1cc737='';return db['ZendeskAccount'][_0x0e2a('0x58')]({'where':{'id':_0x329b52[_0x0e2a('0x4d')]['id']},'attributes':['id',_0x0e2a('0x60'),_0x0e2a('0x61'),_0x0e2a('0x62'),_0x0e2a('0x63'),_0x0e2a('0x64')]})[_0x0e2a('0x1a')](handleEntityNotFound(_0xd3beb5,null))['then'](function(_0x32d9a2){if(_0x32d9a2){_0x1cc737=_0x32d9a2[_0x0e2a('0x64')];var _0x4849a7=_0x1cc737[_0x0e2a('0x65')](-0x1);if(_0x4849a7==='/'){_0x1cc737=_0x1cc737['substring'](0x0,_0x1cc737['lastIndexOf'](_0x4849a7));}var _0x356dc3={'method':_0x0e2a('0x66'),'uri':util[_0x0e2a('0x67')](_0x0e2a('0x68'),_0x1cc737,'ticket_fields'),'json':!![]};switch(_0x32d9a2['authType']){case _0x0e2a('0x61'):_0x356dc3[_0x0e2a('0x69')]={'Authorization':util[_0x0e2a('0x67')](_0x0e2a('0x6a'),new Buffer(util[_0x0e2a('0x67')]('%s:%s',_0x32d9a2[_0x0e2a('0x60')],_0x32d9a2[_0x0e2a('0x61')]))[_0x0e2a('0x6b')]('base64'))};break;case _0x0e2a('0x62'):_0x356dc3[_0x0e2a('0x69')]={'Authorization':util[_0x0e2a('0x67')]('Basic\x20%s',new Buffer(util[_0x0e2a('0x67')](_0x0e2a('0x6c'),_0x32d9a2[_0x0e2a('0x60')],_0x32d9a2[_0x0e2a('0x62')]))[_0x0e2a('0x6b')](_0x0e2a('0x6d')))};break;default:throw new db['Sequelize'][(_0x0e2a('0x6e'))](_0x0e2a('0x6f'));}return rp(_0x356dc3);}})['then'](function(_0x34617c){if(_0x34617c){var _0x135236=[_0x0e2a('0x70'),_0x0e2a('0x71'),_0x0e2a('0x72'),'assignee'];_[_0x0e2a('0x73')](_0x34617c['ticket_fields'],function(_0xd73910){return _0x135236[_0x0e2a('0x74')](_0xd73910['type']);});return{'count':_0x34617c['ticket_fields'][_0x0e2a('0x3f')],'rows':_[_0x0e2a('0x34')](_0x34617c[_0x0e2a('0x75')],function(_0x1de650){return{'id':_0x1de650['id'],'name':_0x1de650['position']>0x7?_0x1de650[_0x0e2a('0x76')]:_0x1de650[_0x0e2a('0x37')],'custom':_0x1de650['position']>0x7?!![]:![],'options':_0x1de650['system_field_options']?_0x1de650['system_field_options']:_0x1de650[_0x0e2a('0x77')]?_0x1de650[_0x0e2a('0x77')]:[]};})};}})[_0x0e2a('0x1a')](respondWithResult(_0xd3beb5,null))['catch'](function(_0x3d8172){var _0x19dcb1=_0x329b52[_0x0e2a('0x3a')][_0x0e2a('0x78')]?0x1f4:_0x3d8172[_0x0e2a('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0e2a('0x5f'),_0x19dcb1,JSON[_0x0e2a('0x20')](_0x3d8172));delete _0x3d8172[_0x0e2a('0x32')];if(_0x19dcb1===0x191){_0x19dcb1=0x190;}_0xd3beb5[_0x0e2a('0x27')](_0x19dcb1)[_0x0e2a('0x33')](_0x329b52[_0x0e2a('0x3a')][_0x0e2a('0x78')]?{'message':_0x0e2a('0x7a'),'statusCode':_0x3d8172[_0x0e2a('0x79')]}:_0x3d8172);});}; \ No newline at end of file +var _0xc015=['order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','password','Basic\x20%s','%s:%s','username','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','show','params','keys','find','create','body','getConfigurations','findOne'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xc015,0x117));var _0x5c01=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xc015[_0x243217];return _0x478029;};'use strict';var pdf=require(_0x5c01('0x0'));var emlformat=require(_0x5c01('0x1'));var rimraf=require(_0x5c01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c01('0x3'));var rp=require(_0x5c01('0x4'));var moment=require('moment');var BPromise=require(_0x5c01('0x5'));var Mustache=require('mustache');var util=require(_0x5c01('0x6'));var path=require(_0x5c01('0x7'));var sox=require(_0x5c01('0x8'));var csv=require('to-csv');var ejs=require(_0x5c01('0x9'));var fs=require('fs');var _=require(_0x5c01('0xa'));var squel=require(_0x5c01('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c01('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c01('0xd'));var querystring=require(_0x5c01('0xe'));var Papa=require(_0x5c01('0xf'));var Redis=require(_0x5c01('0x10'));var authService=require(_0x5c01('0x11'));var qs=require(_0x5c01('0x12'));var as=require(_0x5c01('0x13'));var hardwareService=require(_0x5c01('0x14'));var logger=require(_0x5c01('0x15'))(_0x5c01('0x16'));var utils=require(_0x5c01('0x17'));var config=require('../../config/environment');var db=require(_0x5c01('0x18'))['db'];var integrations=require(_0x5c01('0x19'));var jayson=require(_0x5c01('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xa27090,_0x29eeb8,_0x215712){if(_0x215712){var _0x4b8d25=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b8d25['test'](_0x29eeb8)){return _0xa27090;}else{throw new db[(_0x5c01('0x1b'))]['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 _0xa27090;}}function respondWithRpcPromise(_0x595cdd,_0x1f5d3f,_0x8a417d,_0x4a22e7){return new BPromise(function(_0x289a16,_0x455fe1){var _0x3906d2=_0x4a22e7||client;return _0x3906d2[_0x5c01('0x1c')](_0x595cdd,_0x8a417d)[_0x5c01('0x1d')](function(_0x3c8d19){logger[_0x5c01('0x1e')](_0x5c01('0x1f'),_0x1f5d3f,_0x5c01('0x20'));logger[_0x5c01('0x21')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1f5d3f,_0x5c01('0x20'),JSON[_0x5c01('0x22')](_0x3c8d19));if(_0x3c8d19['error']){if(_0x3c8d19[_0x5c01('0x23')][_0x5c01('0x24')]===0x1f4){logger['error'](_0x5c01('0x1f'),_0x1f5d3f,_0x3c8d19['error'][_0x5c01('0x25')]);return _0x455fe1(_0x3c8d19[_0x5c01('0x23')][_0x5c01('0x25')]);}logger[_0x5c01('0x23')](_0x5c01('0x1f'),_0x1f5d3f,_0x3c8d19['error'][_0x5c01('0x25')]);return _0x289a16(_0x3c8d19[_0x5c01('0x23')][_0x5c01('0x25')]);}else{logger[_0x5c01('0x1e')](_0x5c01('0x1f'),_0x1f5d3f,_0x5c01('0x20'));_0x289a16(_0x3c8d19['result'][_0x5c01('0x25')]);}})[_0x5c01('0x26')](function(_0x1024a8){logger[_0x5c01('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x1f5d3f,_0x1024a8);_0x455fe1(_0x1024a8);});});}function respondWithStatusCode(_0x2bca55,_0x3b9502){_0x3b9502=_0x3b9502||0xcc;return function(_0x3eff36){if(_0x3eff36){return _0x2bca55[_0x5c01('0x27')](_0x3b9502);}return _0x2bca55[_0x5c01('0x28')](_0x3b9502)[_0x5c01('0x29')]();};}function respondWithResult(_0x339f95,_0x353009){_0x353009=_0x353009||0xc8;return function(_0x1962f5){if(_0x1962f5){return _0x339f95[_0x5c01('0x28')](_0x353009)[_0x5c01('0x2a')](_0x1962f5);}};}function respondWithFilteredResult(_0x56774c,_0x4f5757){return function(_0x283aa5){if(_0x283aa5){var _0x3392f6=_0x283aa5[_0x5c01('0x2b')],_0x42cc76=_0x4f5757[_0x5c01('0x2c')],_0x2723fa=_0x4f5757[_0x5c01('0x2c')]+_0x4f5757[_0x5c01('0x2d')],_0x34c1bc;if(_0x2723fa>=_0x3392f6){_0x2723fa=_0x3392f6;_0x34c1bc=0xc8;}else{_0x34c1bc=0xce;}_0x56774c[_0x5c01('0x28')](_0x34c1bc);return _0x56774c[_0x5c01('0x2e')](_0x5c01('0x2f'),_0x42cc76+'-'+_0x2723fa+'/'+_0x3392f6)[_0x5c01('0x2a')](_0x283aa5);}return null;};}function patchUpdates(_0x2199ea){return function(_0x162c16){try{jsonpatch[_0x5c01('0x30')](_0x162c16,_0x2199ea,!![]);}catch(_0x3f91dd){return BPromise[_0x5c01('0x31')](_0x3f91dd);}return _0x162c16[_0x5c01('0x32')]();};}function saveUpdates(_0x39ba4c,_0x39837b){return function(_0x36d487){if(_0x36d487){return _0x36d487[_0x5c01('0x33')](_0x39ba4c)[_0x5c01('0x1d')](function(_0x3580aa){return _0x3580aa;});}return null;};}function removeEntity(_0x130661,_0x555e7f){return function(_0x4644d8){if(_0x4644d8){return _0x4644d8[_0x5c01('0x34')]()[_0x5c01('0x1d')](function(){_0x130661['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f25d3,_0x683b3d){return function(_0x58a2f7){if(!_0x58a2f7){_0x2f25d3[_0x5c01('0x27')](0x194);}return _0x58a2f7;};}function handleError(_0xb5a98e,_0x3e8b9d){_0x3e8b9d=_0x3e8b9d||0x1f4;return function(_0x65c01a){logger[_0x5c01('0x23')](_0x65c01a['stack']);if(_0x65c01a['name']){delete _0x65c01a[_0x5c01('0x35')];}_0xb5a98e[_0x5c01('0x28')](_0x3e8b9d)[_0x5c01('0x36')](_0x65c01a);};}exports[_0x5c01('0x37')]=function(_0x2e8ee6,_0x4f48e5){var _0x2ae6db={},_0x4adca8={},_0x2d3986={'count':0x0,'rows':[]};var _0x44fe9a=_[_0x5c01('0x38')](db['ZendeskAccount'][_0x5c01('0x39')],function(_0x457972){return{'name':_0x457972['fieldName'],'type':_0x457972[_0x5c01('0x3a')][_0x5c01('0x3b')]};});_0x4adca8['model']=_[_0x5c01('0x38')](_0x44fe9a,'name');_0x4adca8[_0x5c01('0x3c')]=_['keys'](_0x2e8ee6[_0x5c01('0x3c')]);_0x4adca8[_0x5c01('0x3d')]=_[_0x5c01('0x3e')](_0x4adca8[_0x5c01('0x3f')],_0x4adca8['query']);_0x2ae6db[_0x5c01('0x40')]=_[_0x5c01('0x3e')](_0x4adca8['model'],qs[_0x5c01('0x41')](_0x2e8ee6[_0x5c01('0x3c')][_0x5c01('0x41')]));_0x2ae6db[_0x5c01('0x40')]=_0x2ae6db['attributes'][_0x5c01('0x42')]?_0x2ae6db[_0x5c01('0x40')]:_0x4adca8[_0x5c01('0x3f')];if(!_0x2e8ee6[_0x5c01('0x3c')][_0x5c01('0x43')]('nolimit')){_0x2ae6db[_0x5c01('0x2d')]=qs[_0x5c01('0x2d')](_0x2e8ee6['query'][_0x5c01('0x2d')]);_0x2ae6db[_0x5c01('0x2c')]=qs[_0x5c01('0x2c')](_0x2e8ee6['query'][_0x5c01('0x2c')]);}_0x2ae6db['order']=qs[_0x5c01('0x44')](_0x2e8ee6['query'][_0x5c01('0x44')]);_0x2ae6db[_0x5c01('0x45')]=qs[_0x5c01('0x3d')](_[_0x5c01('0x46')](_0x2e8ee6[_0x5c01('0x3c')],_0x4adca8[_0x5c01('0x3d')]),_0x44fe9a);if(_0x2e8ee6[_0x5c01('0x3c')][_0x5c01('0x47')]){_0x2ae6db['where']=_[_0x5c01('0x48')](_0x2ae6db['where'],{'$or':_['map'](_0x44fe9a,function(_0x2080e8){if(_0x2080e8['type']!==_0x5c01('0x49')){var _0x50a218={};_0x50a218[_0x2080e8[_0x5c01('0x35')]]={'$like':'%'+_0x2e8ee6[_0x5c01('0x3c')][_0x5c01('0x47')]+'%'};return _0x50a218;}})});}_0x2ae6db=_['merge']({},_0x2ae6db,_0x2e8ee6[_0x5c01('0x4a')]);var _0xda7538={'where':_0x2ae6db['where']};return db[_0x5c01('0x4b')][_0x5c01('0x2b')](_0xda7538)[_0x5c01('0x1d')](function(_0x3cadf8){_0x2d3986['count']=_0x3cadf8;if(_0x2e8ee6['query'][_0x5c01('0x4c')]){_0x2ae6db[_0x5c01('0x4d')]=[{'all':!![]}];}return db[_0x5c01('0x4b')]['findAll'](_0x2ae6db);})[_0x5c01('0x1d')](function(_0x587674){_0x2d3986[_0x5c01('0x4e')]=_0x587674;return _0x2d3986;})['then'](respondWithFilteredResult(_0x4f48e5,_0x2ae6db))[_0x5c01('0x26')](handleError(_0x4f48e5,null));};exports[_0x5c01('0x4f')]=function(_0x2661fa,_0x16c4b8){var _0x50d43b={'raw':![],'where':{'id':_0x2661fa[_0x5c01('0x50')]['id']}},_0x42744c={};_0x42744c[_0x5c01('0x3f')]=_[_0x5c01('0x51')](db['ZendeskAccount'][_0x5c01('0x39')]);_0x42744c[_0x5c01('0x3c')]=_[_0x5c01('0x51')](_0x2661fa['query']);_0x42744c[_0x5c01('0x3d')]=_[_0x5c01('0x3e')](_0x42744c['model'],_0x42744c[_0x5c01('0x3c')]);_0x50d43b[_0x5c01('0x40')]=_[_0x5c01('0x3e')](_0x42744c[_0x5c01('0x3f')],qs[_0x5c01('0x41')](_0x2661fa[_0x5c01('0x3c')][_0x5c01('0x41')]));_0x50d43b[_0x5c01('0x40')]=_0x50d43b[_0x5c01('0x40')][_0x5c01('0x42')]?_0x50d43b[_0x5c01('0x40')]:_0x42744c[_0x5c01('0x3f')];if(_0x2661fa['query'][_0x5c01('0x4c')]){_0x50d43b[_0x5c01('0x4d')]=[{'all':!![]}];}_0x50d43b=_[_0x5c01('0x48')]({},_0x50d43b,_0x2661fa[_0x5c01('0x4a')]);return db['ZendeskAccount'][_0x5c01('0x52')](_0x50d43b)[_0x5c01('0x1d')](handleEntityNotFound(_0x16c4b8,null))['then'](respondWithResult(_0x16c4b8,null))['catch'](handleError(_0x16c4b8,null));};exports['create']=function(_0x11d1e1,_0x179241){return db[_0x5c01('0x4b')][_0x5c01('0x53')](_0x11d1e1['body'],{})[_0x5c01('0x1d')](respondWithResult(_0x179241,0xc9))['catch'](handleError(_0x179241,null));};exports[_0x5c01('0x33')]=function(_0x10613f,_0x3da8d5){if(_0x10613f['body']['id']){delete _0x10613f[_0x5c01('0x54')]['id'];}return db[_0x5c01('0x4b')][_0x5c01('0x52')]({'where':{'id':_0x10613f[_0x5c01('0x50')]['id']}})[_0x5c01('0x1d')](handleEntityNotFound(_0x3da8d5,null))[_0x5c01('0x1d')](saveUpdates(_0x10613f['body'],null))[_0x5c01('0x1d')](respondWithResult(_0x3da8d5,null))[_0x5c01('0x26')](handleError(_0x3da8d5,null));};exports[_0x5c01('0x34')]=function(_0x5bd3e3,_0x37d936){return db[_0x5c01('0x4b')][_0x5c01('0x52')]({'where':{'id':_0x5bd3e3[_0x5c01('0x50')]['id']}})[_0x5c01('0x1d')](handleEntityNotFound(_0x37d936,null))[_0x5c01('0x1d')](removeEntity(_0x37d936,null))['catch'](handleError(_0x37d936,null));};exports[_0x5c01('0x55')]=function(_0x36dc53,_0x37ebfe,_0x3563ec){var _0x163a6f={};var _0x1261e5={};var _0x394c32;var _0x227f6c;return db[_0x5c01('0x4b')][_0x5c01('0x56')]({'where':{'id':_0x36dc53[_0x5c01('0x50')]['id']}})[_0x5c01('0x1d')](handleEntityNotFound(_0x37ebfe,null))['then'](function(_0x48ceba){if(_0x48ceba){_0x394c32=_0x48ceba;_0x1261e5[_0x5c01('0x3f')]=_[_0x5c01('0x51')](db['ZendeskConfiguration'][_0x5c01('0x39')]);_0x1261e5['query']=_[_0x5c01('0x51')](_0x36dc53[_0x5c01('0x3c')]);_0x1261e5['filters']=_['intersection'](_0x1261e5[_0x5c01('0x3f')],_0x1261e5[_0x5c01('0x3c')]);_0x163a6f[_0x5c01('0x40')]=_[_0x5c01('0x3e')](_0x1261e5[_0x5c01('0x3f')],qs[_0x5c01('0x41')](_0x36dc53['query'][_0x5c01('0x41')]));_0x163a6f[_0x5c01('0x40')]=_0x163a6f[_0x5c01('0x40')][_0x5c01('0x42')]?_0x163a6f[_0x5c01('0x40')]:_0x1261e5[_0x5c01('0x3f')];_0x163a6f[_0x5c01('0x57')]=qs['sort'](_0x36dc53[_0x5c01('0x3c')][_0x5c01('0x44')]);_0x163a6f[_0x5c01('0x45')]=qs[_0x5c01('0x3d')](_[_0x5c01('0x46')](_0x36dc53[_0x5c01('0x3c')],_0x1261e5[_0x5c01('0x3d')]));if(_0x36dc53[_0x5c01('0x3c')]['filter']){_0x163a6f[_0x5c01('0x45')]=_[_0x5c01('0x48')](_0x163a6f[_0x5c01('0x45')],{'$or':_[_0x5c01('0x38')](_0x163a6f[_0x5c01('0x40')],function(_0x2cd1ec){var _0x10814b={};_0x10814b[_0x2cd1ec]={'$like':'%'+_0x36dc53[_0x5c01('0x3c')][_0x5c01('0x47')]+'%'};return _0x10814b;})});}_0x163a6f=_['merge']({},_0x163a6f,_0x36dc53[_0x5c01('0x4a')]);return _0x394c32[_0x5c01('0x55')](_0x163a6f);}})[_0x5c01('0x1d')](function(_0x818fd3){if(_0x818fd3){_0x227f6c=_0x818fd3[_0x5c01('0x42')];if(!_0x36dc53[_0x5c01('0x3c')][_0x5c01('0x43')]('nolimit')){_0x163a6f[_0x5c01('0x2d')]=qs[_0x5c01('0x2d')](_0x36dc53[_0x5c01('0x3c')]['limit']);_0x163a6f[_0x5c01('0x2c')]=qs[_0x5c01('0x2c')](_0x36dc53[_0x5c01('0x3c')][_0x5c01('0x2c')]);}return _0x394c32['getConfigurations'](_0x163a6f);}})[_0x5c01('0x1d')](function(_0x2c0a08){if(_0x2c0a08){return _0x2c0a08?{'count':_0x227f6c,'rows':_0x2c0a08}:null;}})[_0x5c01('0x1d')](respondWithResult(_0x37ebfe,null))[_0x5c01('0x26')](handleError(_0x37ebfe,null));};exports[_0x5c01('0x58')]=function(_0x2bdfa6,_0xc2fa15,_0x2d4ed4){if(_0x2bdfa6[_0x5c01('0x54')]['id']){delete _0x2bdfa6[_0x5c01('0x54')]['id'];}return db[_0x5c01('0x4b')][_0x5c01('0x56')]({'where':{'id':_0x2bdfa6['params']['id']}})[_0x5c01('0x1d')](handleEntityNotFound(_0xc2fa15,null))['then'](function(_0xea60ea){if(_0xea60ea){_0x2bdfa6[_0x5c01('0x54')]['AccountId']=_0xea60ea['id'];_0x2bdfa6['body']['Subjects']=integrations[_0x5c01('0x59')](_0x2bdfa6[_0x5c01('0x54')][_0x5c01('0x5a')],_0x2bdfa6['body'][_0x5c01('0x3a')]);_0x2bdfa6[_0x5c01('0x54')][_0x5c01('0x5b')]=integrations[_0x5c01('0x5c')](_0x2bdfa6[_0x5c01('0x54')][_0x5c01('0x5a')],_0x2bdfa6[_0x5c01('0x54')][_0x5c01('0x3a')]);return db[_0x5c01('0x5d')][_0x5c01('0x53')](_0x2bdfa6[_0x5c01('0x54')],{'include':[{'model':db[_0x5c01('0x5e')],'as':'Subjects'},{'model':db[_0x5c01('0x5e')],'as':_0x5c01('0x5b')}]});}return null;})[_0x5c01('0x1d')](respondWithResult(_0xc2fa15,null))[_0x5c01('0x26')](handleError(_0xc2fa15,null));};exports[_0x5c01('0x5f')]=function(_0x5f285b,_0x4151c7,_0x4c9fd0){var _0x4f5412='';return db[_0x5c01('0x4b')][_0x5c01('0x56')]({'where':{'id':_0x5f285b[_0x5c01('0x50')]['id']},'attributes':['id','username','password',_0x5c01('0x60'),_0x5c01('0x61'),_0x5c01('0x62')]})[_0x5c01('0x1d')](handleEntityNotFound(_0x4151c7,null))[_0x5c01('0x1d')](function(_0x336f6b){if(_0x336f6b){_0x4f5412=_0x336f6b[_0x5c01('0x62')];var _0x30d78f=_0x4f5412[_0x5c01('0x63')](-0x1);if(_0x30d78f==='/'){_0x4f5412=_0x4f5412['substring'](0x0,_0x4f5412[_0x5c01('0x64')](_0x30d78f));}var _0x40a5a4={'method':'GET','uri':util[_0x5c01('0x65')]('%s/%s',_0x4f5412,_0x5c01('0x66')),'json':!![]};switch(_0x336f6b[_0x5c01('0x61')]){case _0x5c01('0x67'):_0x40a5a4['headers']={'Authorization':util[_0x5c01('0x65')](_0x5c01('0x68'),new Buffer(util[_0x5c01('0x65')](_0x5c01('0x69'),_0x336f6b[_0x5c01('0x6a')],_0x336f6b[_0x5c01('0x67')]))['toString']('base64'))};break;case'token':_0x40a5a4[_0x5c01('0x6b')]={'Authorization':util[_0x5c01('0x65')](_0x5c01('0x68'),new Buffer(util[_0x5c01('0x65')](_0x5c01('0x6c'),_0x336f6b[_0x5c01('0x6a')],_0x336f6b[_0x5c01('0x60')]))['toString']('base64'))};break;default:throw new db[(_0x5c01('0x1b'))][(_0x5c01('0x6d'))](_0x5c01('0x6e'));}return rp(_0x40a5a4);}})[_0x5c01('0x1d')](function(_0x268832){if(_0x268832){var _0x5aca5d=[_0x5c01('0x6f'),_0x5c01('0x70'),_0x5c01('0x71'),'assignee'];_[_0x5c01('0x72')](_0x268832['ticket_fields'],function(_0x34be8d){return _0x5aca5d['includes'](_0x34be8d[_0x5c01('0x3a')]);});return{'count':_0x268832[_0x5c01('0x66')][_0x5c01('0x42')],'rows':_[_0x5c01('0x38')](_0x268832[_0x5c01('0x66')],function(_0x9c2e2f){return{'id':_0x9c2e2f['id'],'name':_0x9c2e2f[_0x5c01('0x73')]>0x7?_0x9c2e2f['title']:_0x9c2e2f[_0x5c01('0x3a')],'custom':_0x9c2e2f[_0x5c01('0x73')]>0x7?!![]:![],'options':_0x9c2e2f[_0x5c01('0x74')]?_0x9c2e2f[_0x5c01('0x74')]:_0x9c2e2f['custom_field_options']?_0x9c2e2f[_0x5c01('0x75')]:[]};})};}})[_0x5c01('0x1d')](respondWithResult(_0x4151c7,null))[_0x5c01('0x26')](function(_0x1cc0e2){var _0x24a97b=_0x5f285b['query'][_0x5c01('0x76')]?0x1f4:_0x1cc0e2[_0x5c01('0x77')]||0x1f4;logger[_0x5c01('0x23')](_0x5c01('0x78'),_0x5c01('0x5f'),_0x24a97b,JSON[_0x5c01('0x22')](_0x1cc0e2));delete _0x1cc0e2[_0x5c01('0x35')];if(_0x24a97b===0x191){_0x24a97b=0x190;}_0x4151c7['status'](_0x24a97b)[_0x5c01('0x36')](_0x5f285b[_0x5c01('0x3c')]['test']?{'message':_0x5c01('0x79'),'statusCode':_0x1cc0e2[_0x5c01('0x77')]}:_0x1cc0e2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 751fa10..1d11a38 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 _0x2c9e=['./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2cda4b,_0x31b82b){var _0x1ab5dd=function(_0x59764a){while(--_0x59764a){_0x2cda4b['push'](_0x2cda4b['shift']());}};_0x1ab5dd(++_0x31b82b);}(_0x2c9e,0x1bc));var _0xe2c9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2c9e[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xe2c9('0x0'));var logger=require('../../config/logger')(_0xe2c9('0x1'));var moment=require(_0xe2c9('0x2'));var BPromise=require(_0xe2c9('0x3'));var rp=require(_0xe2c9('0x4'));var fs=require('fs');var path=require(_0xe2c9('0x5'));var rimraf=require('rimraf');var config=require(_0xe2c9('0x6'));var attributes=require(_0xe2c9('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x39d89e,_0x25622a){return _0x39d89e[_0xe2c9('0x8')](_0xe2c9('0x9'),attributes,{'tableName':_0xe2c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea0c=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x58be0c,_0x2a25dc){var _0x323bba=function(_0x150c60){while(--_0x150c60){_0x58be0c['push'](_0x58be0c['shift']());}};_0x323bba(++_0x2a25dc);}(_0xea0c,0x198));var _0xcea0=function(_0x28c995,_0xebd1a0){_0x28c995=_0x28c995-0x0;var _0x252553=_0xea0c[_0x28c995];return _0x252553;};'use strict';var _=require(_0xcea0('0x0'));var util=require(_0xcea0('0x1'));var logger=require(_0xcea0('0x2'))(_0xcea0('0x3'));var moment=require(_0xcea0('0x4'));var BPromise=require(_0xcea0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcea0('0x6'));var rimraf=require(_0xcea0('0x7'));var config=require(_0xcea0('0x8'));var attributes=require(_0xcea0('0x9'));var integrations=require(_0xcea0('0xa'));module[_0xcea0('0xb')]=function(_0x1de998,_0x81a1cc){return _0x1de998[_0xcea0('0xc')](_0xcea0('0xd'),attributes,{'tableName':_0xcea0('0xe'),'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 c318379..b8666b0 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0xe706,0xa3));var _0x6e70=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0xe706[_0x3d9e94];return _0x45f76e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +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(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 128bad2..66be458 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 _0x545b=['/:id/subjects','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0x545b,0xec));var _0xb545=function(_0x43e1e6,_0x399da){_0x43e1e6=_0x43e1e6-0x0;var _0x58753d=_0x545b[_0x43e1e6];return _0x58753d;};'use strict';var multer=require('multer');var util=require(_0xb545('0x0'));var path=require(_0xb545('0x1'));var timeout=require(_0xb545('0x2'));var express=require(_0xb545('0x3'));var router=express[_0xb545('0x4')]();var auth=require(_0xb545('0x5'));var interaction=require(_0xb545('0x6'));var config=require(_0xb545('0x7'));var controller=require(_0xb545('0x8'));router[_0xb545('0x9')]('/',auth[_0xb545('0xa')](),controller[_0xb545('0xb')]);router['get'](_0xb545('0xc'),auth[_0xb545('0xa')](),controller[_0xb545('0xd')]);router['get']('/:id/fields',auth[_0xb545('0xa')](),controller['getFields']);router[_0xb545('0x9')](_0xb545('0xe'),auth[_0xb545('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xb545('0x9')](_0xb545('0xf'),auth[_0xb545('0xa')](),controller[_0xb545('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb545('0x11')]);router[_0xb545('0x12')](_0xb545('0xf'),auth['isAuthenticated'](),controller[_0xb545('0x13')]);router[_0xb545('0x14')]('/:id',auth[_0xb545('0xa')](),controller[_0xb545('0x15')]);router[_0xb545('0x16')](_0xb545('0xc'),auth[_0xb545('0xa')](),controller[_0xb545('0x17')]);module[_0xb545('0x18')]=router; \ No newline at end of file +var _0x815e=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x815e,0xe1));var _0xe815=function(_0x5a0428,_0x1ba403){_0x5a0428=_0x5a0428-0x0;var _0xa19d9b=_0x815e[_0x5a0428];return _0xa19d9b;};'use strict';var multer=require(_0xe815('0x0'));var util=require(_0xe815('0x1'));var path=require(_0xe815('0x2'));var timeout=require(_0xe815('0x3'));var express=require(_0xe815('0x4'));var router=express[_0xe815('0x5')]();var auth=require(_0xe815('0x6'));var interaction=require(_0xe815('0x7'));var config=require(_0xe815('0x8'));var controller=require(_0xe815('0x9'));router['get']('/',auth[_0xe815('0xa')](),controller[_0xe815('0xb')]);router[_0xe815('0xc')](_0xe815('0xd'),auth[_0xe815('0xa')](),controller[_0xe815('0xe')]);router[_0xe815('0xc')](_0xe815('0xf'),auth[_0xe815('0xa')](),controller[_0xe815('0x10')]);router['get']('/:id/subjects',auth[_0xe815('0xa')](),controller[_0xe815('0x11')]);router[_0xe815('0xc')](_0xe815('0x12'),auth[_0xe815('0xa')](),controller[_0xe815('0x13')]);router['get'](_0xe815('0x14'),auth['isAuthenticated'](),controller[_0xe815('0x15')]);router[_0xe815('0x16')]('/',auth[_0xe815('0xa')](),controller['create']);router[_0xe815('0x16')](_0xe815('0x14'),auth[_0xe815('0xa')](),controller[_0xe815('0x17')]);router[_0xe815('0x18')](_0xe815('0xd'),auth[_0xe815('0xa')](),controller[_0xe815('0x19')]);router[_0xe815('0x1a')](_0xe815('0xd'),auth['isAuthenticated'](),controller[_0xe815('0x1b')]);module[_0xe815('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 b7e42db..5cbe99b 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 _0xefd5=['exports','STRING','sequelize'];(function(_0x4a8dfc,_0x33213a){var _0x12002f=function(_0x5f439d){while(--_0x5f439d){_0x4a8dfc['push'](_0x4a8dfc['shift']());}};_0x12002f(++_0x33213a);}(_0xefd5,0x113));var _0x5efd=function(_0x66a45d,_0x584b9e){_0x66a45d=_0x66a45d-0x0;var _0x5e3f12=_0xefd5[_0x66a45d];return _0x5e3f12;};'use strict';var Sequelize=require(_0x5efd('0x0'));module[_0x5efd('0x1')]={'name':{'type':Sequelize[_0x5efd('0x2')]},'description':{'type':Sequelize[_0x5efd('0x2')]}}; \ No newline at end of file +var _0xd3bc=['exports','STRING'];(function(_0x2600ae,_0x280958){var _0x2ac8ed=function(_0x4f6f18){while(--_0x4f6f18){_0x2600ae['push'](_0x2600ae['shift']());}};_0x2ac8ed(++_0x280958);}(_0xd3bc,0xac));var _0xcd3b=function(_0x167ea8,_0x5ddca3){_0x167ea8=_0x167ea8-0x0;var _0x32069f=_0xd3bc[_0x167ea8];return _0x32069f;};'use strict';var Sequelize=require('sequelize');module[_0xcd3b('0x0')]={'name':{'type':Sequelize[_0xcd3b('0x1')]},'description':{'type':Sequelize[_0xcd3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7ba65e6..05d8790 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 _0x6664=['util','path','sox','to-csv','ejs','lodash','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','client','http','Sequelize','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','VIRTUAL','merge','options','include','show','params','body','find','getFields','findOne','pick','hasOwnProperty','getSubjects','order','getDescriptions','ZendeskField','rawAttributes','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0xd60411,_0x50cb03){var _0x5d6c36=function(_0x2dd9b5){while(--_0x2dd9b5){_0xd60411['push'](_0xd60411['shift']());}};_0x5d6c36(++_0x50cb03);}(_0x6664,0x100));var _0x4666=function(_0x22e7ee,_0xd43e98){_0x22e7ee=_0x22e7ee-0x0;var _0xbf4677=_0x6664[_0x22e7ee];return _0xbf4677;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4666('0x0'));var zipdir=require(_0x4666('0x1'));var jsonpatch=require(_0x4666('0x2'));var rp=require(_0x4666('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4666('0x4'));var util=require(_0x4666('0x5'));var path=require(_0x4666('0x6'));var sox=require(_0x4666('0x7'));var csv=require(_0x4666('0x8'));var ejs=require(_0x4666('0x9'));var fs=require('fs');var _=require(_0x4666('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4666('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4666('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4666('0xc'));var as=require(_0x4666('0xd'));var hardwareService=require(_0x4666('0xe'));var logger=require(_0x4666('0xf'))(_0x4666('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4666('0x11')][_0x4666('0x12')]({'port':0x232a});function checkPasswordPattern(_0x1f3d79,_0x5a9f3f,_0x523c25){if(_0x523c25){var _0x30fe35=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30fe35['test'](_0x5a9f3f)){return _0x1f3d79;}else{throw new db[(_0x4666('0x13'))]['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 _0x1f3d79;}}function respondWithRpcPromise(_0x466f93,_0x2b44dc,_0x5c3a2d,_0x282389){return new BPromise(function(_0x2e7701,_0x54af12){var _0xa41f95=_0x282389||client;return _0xa41f95[_0x4666('0x14')](_0x466f93,_0x5c3a2d)[_0x4666('0x15')](function(_0x3c6576){logger[_0x4666('0x16')](_0x4666('0x17'),_0x2b44dc,_0x4666('0x18'));logger[_0x4666('0x19')](_0x4666('0x1a'),_0x2b44dc,'request\x20sent',JSON[_0x4666('0x1b')](_0x3c6576));if(_0x3c6576['error']){if(_0x3c6576['error'][_0x4666('0x1c')]===0x1f4){logger[_0x4666('0x1d')](_0x4666('0x17'),_0x2b44dc,_0x3c6576[_0x4666('0x1d')][_0x4666('0x1e')]);return _0x54af12(_0x3c6576[_0x4666('0x1d')][_0x4666('0x1e')]);}logger[_0x4666('0x1d')](_0x4666('0x17'),_0x2b44dc,_0x3c6576[_0x4666('0x1d')]['message']);return _0x2e7701(_0x3c6576[_0x4666('0x1d')]['message']);}else{logger['info'](_0x4666('0x17'),_0x2b44dc,_0x4666('0x18'));_0x2e7701(_0x3c6576[_0x4666('0x1f')][_0x4666('0x1e')]);}})[_0x4666('0x20')](function(_0x23e999){logger[_0x4666('0x1d')](_0x4666('0x17'),_0x2b44dc,_0x23e999);_0x54af12(_0x23e999);});});}function respondWithStatusCode(_0x36f4f6,_0x5f46a3){_0x5f46a3=_0x5f46a3||0xcc;return function(_0x3a71a8){if(_0x3a71a8){return _0x36f4f6[_0x4666('0x21')](_0x5f46a3);}return _0x36f4f6[_0x4666('0x22')](_0x5f46a3)[_0x4666('0x23')]();};}function respondWithResult(_0xd7e3e5,_0x39cd03){_0x39cd03=_0x39cd03||0xc8;return function(_0x38e4b8){if(_0x38e4b8){return _0xd7e3e5[_0x4666('0x22')](_0x39cd03)[_0x4666('0x24')](_0x38e4b8);}};}function respondWithFilteredResult(_0x50da4d,_0x461c15){return function(_0x5eb066){if(_0x5eb066){var _0x2e253b=_0x5eb066[_0x4666('0x25')],_0x4eb50d=_0x461c15[_0x4666('0x26')],_0x51f986=_0x461c15['offset']+_0x461c15[_0x4666('0x27')],_0x1b4e43;if(_0x51f986>=_0x2e253b){_0x51f986=_0x2e253b;_0x1b4e43=0xc8;}else{_0x1b4e43=0xce;}_0x50da4d[_0x4666('0x22')](_0x1b4e43);return _0x50da4d[_0x4666('0x28')](_0x4666('0x29'),_0x4eb50d+'-'+_0x51f986+'/'+_0x2e253b)[_0x4666('0x24')](_0x5eb066);}return null;};}function patchUpdates(_0x479821){return function(_0x4cf077){try{jsonpatch[_0x4666('0x2a')](_0x4cf077,_0x479821,!![]);}catch(_0x5b186c){return BPromise[_0x4666('0x2b')](_0x5b186c);}return _0x4cf077[_0x4666('0x2c')]();};}function saveUpdates(_0x2e7131,_0x364d8a){return function(_0x5339d5){if(_0x5339d5){return _0x5339d5[_0x4666('0x2d')](_0x2e7131)[_0x4666('0x15')](function(_0x36cfce){return _0x36cfce;});}return null;};}function removeEntity(_0x3ae455,_0xab15a2){return function(_0x3b7f6f){if(_0x3b7f6f){return _0x3b7f6f[_0x4666('0x2e')]()[_0x4666('0x15')](function(){_0x3ae455['status'](0xcc)[_0x4666('0x23')]();});}};}function handleEntityNotFound(_0x1a8204,_0x192073){return function(_0x184103){if(!_0x184103){_0x1a8204[_0x4666('0x21')](0x194);}return _0x184103;};}function handleError(_0x1976b0,_0x419f38){_0x419f38=_0x419f38||0x1f4;return function(_0x346818){logger[_0x4666('0x1d')](_0x346818[_0x4666('0x2f')]);if(_0x346818[_0x4666('0x30')]){delete _0x346818[_0x4666('0x30')];}_0x1976b0[_0x4666('0x22')](_0x419f38)[_0x4666('0x31')](_0x346818);};}exports[_0x4666('0x32')]=function(_0x1173f4,_0x33fca1){var _0x1ae9a5={},_0x10bd7d={},_0x1ab80c={'count':0x0,'rows':[]};var _0xd34248=_[_0x4666('0x33')](db[_0x4666('0x34')]['rawAttributes'],function(_0xb491b4){return{'name':_0xb491b4['fieldName'],'type':_0xb491b4[_0x4666('0x35')][_0x4666('0x36')]};});_0x10bd7d[_0x4666('0x37')]=_['map'](_0xd34248,_0x4666('0x30'));_0x10bd7d[_0x4666('0x38')]=_[_0x4666('0x39')](_0x1173f4['query']);_0x10bd7d[_0x4666('0x3a')]=_[_0x4666('0x3b')](_0x10bd7d['model'],_0x10bd7d[_0x4666('0x38')]);_0x1ae9a5['attributes']=_['intersection'](_0x10bd7d['model'],qs[_0x4666('0x3c')](_0x1173f4['query'][_0x4666('0x3c')]));_0x1ae9a5['attributes']=_0x1ae9a5[_0x4666('0x3d')][_0x4666('0x3e')]?_0x1ae9a5['attributes']:_0x10bd7d[_0x4666('0x37')];if(!_0x1173f4[_0x4666('0x38')]['hasOwnProperty'](_0x4666('0x3f'))){_0x1ae9a5[_0x4666('0x27')]=qs[_0x4666('0x27')](_0x1173f4['query']['limit']);_0x1ae9a5[_0x4666('0x26')]=qs[_0x4666('0x26')](_0x1173f4['query'][_0x4666('0x26')]);}_0x1ae9a5['order']=qs[_0x4666('0x40')](_0x1173f4['query'][_0x4666('0x40')]);_0x1ae9a5[_0x4666('0x41')]=qs['filters'](_['pick'](_0x1173f4['query'],_0x10bd7d[_0x4666('0x3a')]),_0xd34248);if(_0x1173f4[_0x4666('0x38')][_0x4666('0x42')]){_0x1ae9a5[_0x4666('0x41')]=_['merge'](_0x1ae9a5[_0x4666('0x41')],{'$or':_['map'](_0xd34248,function(_0x1fbf9d){if(_0x1fbf9d[_0x4666('0x35')]!==_0x4666('0x43')){var _0x384030={};_0x384030[_0x1fbf9d['name']]={'$like':'%'+_0x1173f4[_0x4666('0x38')][_0x4666('0x42')]+'%'};return _0x384030;}})});}_0x1ae9a5=_[_0x4666('0x44')]({},_0x1ae9a5,_0x1173f4[_0x4666('0x45')]);var _0x85f96f={'where':_0x1ae9a5[_0x4666('0x41')]};return db[_0x4666('0x34')][_0x4666('0x25')](_0x85f96f)['then'](function(_0x4e4b35){_0x1ab80c[_0x4666('0x25')]=_0x4e4b35;if(_0x1173f4[_0x4666('0x38')]['includeAll']){_0x1ae9a5[_0x4666('0x46')]=[{'all':!![]}];}return db[_0x4666('0x34')]['findAll'](_0x1ae9a5);})[_0x4666('0x15')](function(_0x49f758){_0x1ab80c['rows']=_0x49f758;return _0x1ab80c;})[_0x4666('0x15')](respondWithFilteredResult(_0x33fca1,_0x1ae9a5))[_0x4666('0x20')](handleError(_0x33fca1,null));};exports[_0x4666('0x47')]=function(_0xd97873,_0x5e3a39){var _0x4486a5={'raw':![],'where':{'id':_0xd97873[_0x4666('0x48')]['id']}},_0x3bb043={};_0x3bb043[_0x4666('0x37')]=_[_0x4666('0x39')](db[_0x4666('0x34')]['rawAttributes']);_0x3bb043[_0x4666('0x38')]=_[_0x4666('0x39')](_0xd97873[_0x4666('0x38')]);_0x3bb043[_0x4666('0x3a')]=_[_0x4666('0x3b')](_0x3bb043[_0x4666('0x37')],_0x3bb043[_0x4666('0x38')]);_0x4486a5[_0x4666('0x3d')]=_[_0x4666('0x3b')](_0x3bb043[_0x4666('0x37')],qs['fields'](_0xd97873[_0x4666('0x38')][_0x4666('0x3c')]));_0x4486a5['attributes']=_0x4486a5['attributes'][_0x4666('0x3e')]?_0x4486a5['attributes']:_0x3bb043['model'];if(_0xd97873[_0x4666('0x38')]['includeAll']){_0x4486a5['include']=[{'all':!![]}];}_0x4486a5=_[_0x4666('0x44')]({},_0x4486a5,_0xd97873[_0x4666('0x45')]);return db['ZendeskConfiguration']['find'](_0x4486a5)[_0x4666('0x15')](handleEntityNotFound(_0x5e3a39,null))[_0x4666('0x15')](respondWithResult(_0x5e3a39,null))[_0x4666('0x20')](handleError(_0x5e3a39,null));};exports['create']=function(_0x1917c2,_0x22fe5f){return db['ZendeskConfiguration']['create'](_0x1917c2[_0x4666('0x49')],{})[_0x4666('0x15')](respondWithResult(_0x22fe5f,0xc9))[_0x4666('0x20')](handleError(_0x22fe5f,null));};exports[_0x4666('0x2d')]=function(_0x1e74c6,_0x128c9c){if(_0x1e74c6[_0x4666('0x49')]['id']){delete _0x1e74c6[_0x4666('0x49')]['id'];}return db['ZendeskConfiguration'][_0x4666('0x4a')]({'where':{'id':_0x1e74c6['params']['id']}})['then'](handleEntityNotFound(_0x128c9c,null))[_0x4666('0x15')](saveUpdates(_0x1e74c6['body'],null))[_0x4666('0x15')](respondWithResult(_0x128c9c,null))[_0x4666('0x20')](handleError(_0x128c9c,null));};exports[_0x4666('0x2e')]=function(_0x1e9bff,_0x3eea7f){return db['ZendeskConfiguration'][_0x4666('0x4a')]({'where':{'id':_0x1e9bff[_0x4666('0x48')]['id']}})[_0x4666('0x15')](handleEntityNotFound(_0x3eea7f,null))[_0x4666('0x15')](removeEntity(_0x3eea7f,null))[_0x4666('0x20')](handleError(_0x3eea7f,null));};exports[_0x4666('0x4b')]=function(_0xe80a14,_0xf92584,_0x6e22e){var _0x24b22b={};var _0x1b0622={};var _0x5ebcfb;var _0x2f9cd1;return db[_0x4666('0x34')][_0x4666('0x4c')]({'where':{'id':_0xe80a14[_0x4666('0x48')]['id']}})['then'](handleEntityNotFound(_0xf92584,null))['then'](function(_0x388b64){if(_0x388b64){_0x5ebcfb=_0x388b64;_0x1b0622[_0x4666('0x37')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x1b0622[_0x4666('0x38')]=_[_0x4666('0x39')](_0xe80a14[_0x4666('0x38')]);_0x1b0622[_0x4666('0x3a')]=_[_0x4666('0x3b')](_0x1b0622[_0x4666('0x37')],_0x1b0622[_0x4666('0x38')]);_0x24b22b[_0x4666('0x3d')]=_[_0x4666('0x3b')](_0x1b0622['model'],qs[_0x4666('0x3c')](_0xe80a14['query'][_0x4666('0x3c')]));_0x24b22b[_0x4666('0x3d')]=_0x24b22b[_0x4666('0x3d')][_0x4666('0x3e')]?_0x24b22b['attributes']:_0x1b0622[_0x4666('0x37')];_0x24b22b['order']=qs[_0x4666('0x40')](_0xe80a14['query'][_0x4666('0x40')]);_0x24b22b[_0x4666('0x41')]=qs[_0x4666('0x3a')](_[_0x4666('0x4d')](_0xe80a14[_0x4666('0x38')],_0x1b0622[_0x4666('0x3a')]));if(_0xe80a14[_0x4666('0x38')]['filter']){_0x24b22b[_0x4666('0x41')]=_['merge'](_0x24b22b[_0x4666('0x41')],{'$or':_[_0x4666('0x33')](_0x24b22b[_0x4666('0x3d')],function(_0x10cd5e){var _0x25882e={};_0x25882e[_0x10cd5e]={'$like':'%'+_0xe80a14[_0x4666('0x38')][_0x4666('0x42')]+'%'};return _0x25882e;})});}_0x24b22b=_[_0x4666('0x44')]({},_0x24b22b,_0xe80a14[_0x4666('0x45')]);return _0x5ebcfb[_0x4666('0x4b')](_0x24b22b);}})[_0x4666('0x15')](function(_0x2314d6){if(_0x2314d6){_0x2f9cd1=_0x2314d6[_0x4666('0x3e')];if(!_0xe80a14[_0x4666('0x38')][_0x4666('0x4e')](_0x4666('0x3f'))){_0x24b22b[_0x4666('0x27')]=qs[_0x4666('0x27')](_0xe80a14[_0x4666('0x38')][_0x4666('0x27')]);_0x24b22b[_0x4666('0x26')]=qs['offset'](_0xe80a14[_0x4666('0x38')]['offset']);}return _0x5ebcfb[_0x4666('0x4b')](_0x24b22b);}})[_0x4666('0x15')](function(_0x34b751){if(_0x34b751){return _0x34b751?{'count':_0x2f9cd1,'rows':_0x34b751}:null;}})[_0x4666('0x15')](respondWithResult(_0xf92584,null))[_0x4666('0x20')](handleError(_0xf92584,null));};exports[_0x4666('0x4f')]=function(_0x18455d,_0x5ee3d0,_0x3cf050){var _0x2b7843={};var _0x391de6={};var _0x20b251;var _0x18fd01;return db['ZendeskConfiguration'][_0x4666('0x4c')]({'where':{'id':_0x18455d['params']['id']}})['then'](handleEntityNotFound(_0x5ee3d0,null))[_0x4666('0x15')](function(_0x5ad258){if(_0x5ad258){_0x20b251=_0x5ad258;_0x391de6[_0x4666('0x37')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x391de6['query']=_[_0x4666('0x39')](_0x18455d[_0x4666('0x38')]);_0x391de6[_0x4666('0x3a')]=_[_0x4666('0x3b')](_0x391de6['model'],_0x391de6[_0x4666('0x38')]);_0x2b7843['attributes']=_['intersection'](_0x391de6['model'],qs[_0x4666('0x3c')](_0x18455d[_0x4666('0x38')][_0x4666('0x3c')]));_0x2b7843[_0x4666('0x3d')]=_0x2b7843['attributes'][_0x4666('0x3e')]?_0x2b7843[_0x4666('0x3d')]:_0x391de6[_0x4666('0x37')];_0x2b7843[_0x4666('0x50')]=qs[_0x4666('0x40')](_0x18455d[_0x4666('0x38')]['sort']);_0x2b7843['where']=qs[_0x4666('0x3a')](_[_0x4666('0x4d')](_0x18455d[_0x4666('0x38')],_0x391de6[_0x4666('0x3a')]));if(_0x18455d['query'][_0x4666('0x42')]){_0x2b7843['where']=_[_0x4666('0x44')](_0x2b7843[_0x4666('0x41')],{'$or':_[_0x4666('0x33')](_0x2b7843['attributes'],function(_0x8f5c27){var _0x208fb9={};_0x208fb9[_0x8f5c27]={'$like':'%'+_0x18455d[_0x4666('0x38')][_0x4666('0x42')]+'%'};return _0x208fb9;})});}_0x2b7843=_[_0x4666('0x44')]({},_0x2b7843,_0x18455d[_0x4666('0x45')]);return _0x20b251[_0x4666('0x4f')](_0x2b7843);}})[_0x4666('0x15')](function(_0x15184b){if(_0x15184b){_0x18fd01=_0x15184b[_0x4666('0x3e')];if(!_0x18455d[_0x4666('0x38')][_0x4666('0x4e')](_0x4666('0x3f'))){_0x2b7843[_0x4666('0x27')]=qs['limit'](_0x18455d[_0x4666('0x38')]['limit']);_0x2b7843[_0x4666('0x26')]=qs[_0x4666('0x26')](_0x18455d[_0x4666('0x38')]['offset']);}return _0x20b251['getSubjects'](_0x2b7843);}})[_0x4666('0x15')](function(_0xe49b1f){if(_0xe49b1f){return _0xe49b1f?{'count':_0x18fd01,'rows':_0xe49b1f}:null;}})[_0x4666('0x15')](respondWithResult(_0x5ee3d0,null))['catch'](handleError(_0x5ee3d0,null));};exports[_0x4666('0x51')]=function(_0x67996a,_0x3349a6,_0x5173bc){var _0x26d847={};var _0x540c54={};var _0x5ba421;var _0x452977;return db[_0x4666('0x34')][_0x4666('0x4c')]({'where':{'id':_0x67996a['params']['id']}})[_0x4666('0x15')](handleEntityNotFound(_0x3349a6,null))[_0x4666('0x15')](function(_0x45ce35){if(_0x45ce35){_0x5ba421=_0x45ce35;_0x540c54[_0x4666('0x37')]=_[_0x4666('0x39')](db[_0x4666('0x52')][_0x4666('0x53')]);_0x540c54[_0x4666('0x38')]=_[_0x4666('0x39')](_0x67996a[_0x4666('0x38')]);_0x540c54[_0x4666('0x3a')]=_[_0x4666('0x3b')](_0x540c54['model'],_0x540c54[_0x4666('0x38')]);_0x26d847[_0x4666('0x3d')]=_[_0x4666('0x3b')](_0x540c54[_0x4666('0x37')],qs[_0x4666('0x3c')](_0x67996a['query'][_0x4666('0x3c')]));_0x26d847['attributes']=_0x26d847['attributes']['length']?_0x26d847[_0x4666('0x3d')]:_0x540c54['model'];_0x26d847[_0x4666('0x50')]=qs[_0x4666('0x40')](_0x67996a[_0x4666('0x38')][_0x4666('0x40')]);_0x26d847[_0x4666('0x41')]=qs['filters'](_[_0x4666('0x4d')](_0x67996a[_0x4666('0x38')],_0x540c54['filters']));if(_0x67996a[_0x4666('0x38')][_0x4666('0x42')]){_0x26d847[_0x4666('0x41')]=_[_0x4666('0x44')](_0x26d847[_0x4666('0x41')],{'$or':_[_0x4666('0x33')](_0x26d847[_0x4666('0x3d')],function(_0x3d55af){var _0x5f164c={};_0x5f164c[_0x3d55af]={'$like':'%'+_0x67996a[_0x4666('0x38')][_0x4666('0x42')]+'%'};return _0x5f164c;})});}_0x26d847=_[_0x4666('0x44')]({},_0x26d847,_0x67996a['options']);return _0x5ba421[_0x4666('0x51')](_0x26d847);}})[_0x4666('0x15')](function(_0x16373f){if(_0x16373f){_0x452977=_0x16373f[_0x4666('0x3e')];if(!_0x67996a[_0x4666('0x38')][_0x4666('0x4e')](_0x4666('0x3f'))){_0x26d847[_0x4666('0x27')]=qs[_0x4666('0x27')](_0x67996a[_0x4666('0x38')]['limit']);_0x26d847[_0x4666('0x26')]=qs[_0x4666('0x26')](_0x67996a[_0x4666('0x38')]['offset']);}return _0x5ba421[_0x4666('0x51')](_0x26d847);}})[_0x4666('0x15')](function(_0x597690){if(_0x597690){return _0x597690?{'count':_0x452977,'rows':_0x597690}:null;}})[_0x4666('0x15')](respondWithResult(_0x3349a6,null))[_0x4666('0x20')](handleError(_0x3349a6,null));};exports['getTags']=function(_0x2a7406,_0x2026e6,_0x1bcead){var _0x5925ec={};var _0x6881f4={};var _0x4359d5;var _0x5bf6c1;return db[_0x4666('0x34')][_0x4666('0x4c')]({'where':{'id':_0x2a7406[_0x4666('0x48')]['id']}})[_0x4666('0x15')](handleEntityNotFound(_0x2026e6,null))[_0x4666('0x15')](function(_0xee968a){if(_0xee968a){_0x4359d5=_0xee968a;_0x6881f4[_0x4666('0x37')]=_[_0x4666('0x39')](db[_0x4666('0x54')][_0x4666('0x53')]);_0x6881f4['query']=_[_0x4666('0x39')](_0x2a7406[_0x4666('0x38')]);_0x6881f4[_0x4666('0x3a')]=_['intersection'](_0x6881f4['model'],_0x6881f4[_0x4666('0x38')]);_0x5925ec[_0x4666('0x3d')]=_[_0x4666('0x3b')](_0x6881f4[_0x4666('0x37')],qs[_0x4666('0x3c')](_0x2a7406[_0x4666('0x38')][_0x4666('0x3c')]));_0x5925ec[_0x4666('0x3d')]=_0x5925ec[_0x4666('0x3d')][_0x4666('0x3e')]?_0x5925ec[_0x4666('0x3d')]:_0x6881f4[_0x4666('0x37')];_0x5925ec[_0x4666('0x50')]=qs[_0x4666('0x40')](_0x2a7406['query'][_0x4666('0x40')]);_0x5925ec[_0x4666('0x41')]=qs[_0x4666('0x3a')](_['pick'](_0x2a7406[_0x4666('0x38')],_0x6881f4[_0x4666('0x3a')]));if(_0x2a7406[_0x4666('0x38')][_0x4666('0x42')]){_0x5925ec['where']=_[_0x4666('0x44')](_0x5925ec[_0x4666('0x41')],{'$or':_['map'](_0x5925ec[_0x4666('0x3d')],function(_0x2ec5eb){var _0x319ef2={};_0x319ef2[_0x2ec5eb]={'$like':'%'+_0x2a7406[_0x4666('0x38')][_0x4666('0x42')]+'%'};return _0x319ef2;})});}_0x5925ec=_['merge']({},_0x5925ec,_0x2a7406[_0x4666('0x45')]);return _0x4359d5['getTags'](_0x5925ec);}})[_0x4666('0x15')](function(_0x364d3e){if(_0x364d3e){_0x5bf6c1=_0x364d3e[_0x4666('0x3e')];if(!_0x2a7406[_0x4666('0x38')][_0x4666('0x4e')](_0x4666('0x3f'))){_0x5925ec[_0x4666('0x27')]=qs[_0x4666('0x27')](_0x2a7406[_0x4666('0x38')][_0x4666('0x27')]);_0x5925ec[_0x4666('0x26')]=qs['offset'](_0x2a7406[_0x4666('0x38')][_0x4666('0x26')]);}return _0x4359d5[_0x4666('0x55')](_0x5925ec);}})['then'](function(_0x14943b){if(_0x14943b){return _0x14943b?{'count':_0x5bf6c1,'rows':_0x14943b}:null;}})['then'](respondWithResult(_0x2026e6,null))[_0x4666('0x20')](handleError(_0x2026e6,null));};exports[_0x4666('0x56')]=function(_0x32a3a0,_0x2fbf63,_0x51556a){if(_0x32a3a0[_0x4666('0x49')]['id']){delete _0x32a3a0['body']['id'];}return db[_0x4666('0x34')][_0x4666('0x4c')]({'where':{'id':_0x32a3a0[_0x4666('0x48')]['id']}})[_0x4666('0x15')](handleEntityNotFound(_0x2fbf63,null))[_0x4666('0x15')](function(_0xbda53c){if(_0xbda53c){return _0xbda53c[_0x4666('0x56')](_0x32a3a0['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x2fbf63,null))['catch'](handleError(_0x2fbf63,null));}; \ No newline at end of file +var _0xb0b8=['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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','ZendeskConfiguration','includeAll','findAll','rows','show','params','length','create','body','find','destroy','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir'];(function(_0x446bd8,_0x1ee333){var _0x26d66d=function(_0x254886){while(--_0x254886){_0x446bd8['push'](_0x446bd8['shift']());}};_0x26d66d(++_0x1ee333);}(_0xb0b8,0xc8));var _0x8b0b=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xb0b8[_0x27d8bc];return _0x4b04cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b0b('0x1'));var jsonpatch=require(_0x8b0b('0x2'));var rp=require(_0x8b0b('0x3'));var moment=require(_0x8b0b('0x4'));var BPromise=require(_0x8b0b('0x5'));var Mustache=require(_0x8b0b('0x6'));var util=require(_0x8b0b('0x7'));var path=require(_0x8b0b('0x8'));var sox=require(_0x8b0b('0x9'));var csv=require('to-csv');var ejs=require(_0x8b0b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b0b('0xb'));var crypto=require(_0x8b0b('0xc'));var jsforce=require(_0x8b0b('0xd'));var deskjs=require(_0x8b0b('0xe'));var toCsv=require(_0x8b0b('0xf'));var querystring=require(_0x8b0b('0x10'));var Papa=require(_0x8b0b('0x11'));var Redis=require(_0x8b0b('0x12'));var authService=require(_0x8b0b('0x13'));var qs=require(_0x8b0b('0x14'));var as=require(_0x8b0b('0x15'));var hardwareService=require(_0x8b0b('0x16'));var logger=require(_0x8b0b('0x17'))(_0x8b0b('0x18'));var utils=require(_0x8b0b('0x19'));var config=require(_0x8b0b('0x1a'));var db=require(_0x8b0b('0x1b'))['db'];var jayson=require(_0x8b0b('0x1c'));var client=jayson[_0x8b0b('0x1d')][_0x8b0b('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x213294,_0x33d3eb,_0x3261fd){if(_0x3261fd){var _0x47216f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47216f[_0x8b0b('0x1f')](_0x33d3eb)){return _0x213294;}else{throw new db[(_0x8b0b('0x20'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x213294;}}function respondWithRpcPromise(_0x33e80d,_0x139235,_0x2807c3,_0x101dce){return new BPromise(function(_0x2ab506,_0x22b08b){var _0x40e7e0=_0x101dce||client;return _0x40e7e0[_0x8b0b('0x21')](_0x33e80d,_0x2807c3)[_0x8b0b('0x22')](function(_0x50a47a){logger[_0x8b0b('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x139235,_0x8b0b('0x24'));logger[_0x8b0b('0x25')](_0x8b0b('0x26'),_0x139235,_0x8b0b('0x24'),JSON[_0x8b0b('0x27')](_0x50a47a));if(_0x50a47a['error']){if(_0x50a47a[_0x8b0b('0x28')]['code']===0x1f4){logger[_0x8b0b('0x28')]('ZendeskConfiguration,\x20%s,\x20%s',_0x139235,_0x50a47a[_0x8b0b('0x28')]['message']);return _0x22b08b(_0x50a47a[_0x8b0b('0x28')][_0x8b0b('0x29')]);}logger[_0x8b0b('0x28')]('ZendeskConfiguration,\x20%s,\x20%s',_0x139235,_0x50a47a[_0x8b0b('0x28')][_0x8b0b('0x29')]);return _0x2ab506(_0x50a47a[_0x8b0b('0x28')][_0x8b0b('0x29')]);}else{logger[_0x8b0b('0x23')](_0x8b0b('0x2a'),_0x139235,_0x8b0b('0x24'));_0x2ab506(_0x50a47a[_0x8b0b('0x2b')][_0x8b0b('0x29')]);}})[_0x8b0b('0x2c')](function(_0x4adc05){logger[_0x8b0b('0x28')]('ZendeskConfiguration,\x20%s,\x20%s',_0x139235,_0x4adc05);_0x22b08b(_0x4adc05);});});}function respondWithStatusCode(_0x22466f,_0x2d351e){_0x2d351e=_0x2d351e||0xcc;return function(_0x4659d0){if(_0x4659d0){return _0x22466f['sendStatus'](_0x2d351e);}return _0x22466f[_0x8b0b('0x2d')](_0x2d351e)[_0x8b0b('0x2e')]();};}function respondWithResult(_0x4e977a,_0x5476b4){_0x5476b4=_0x5476b4||0xc8;return function(_0x12d059){if(_0x12d059){return _0x4e977a['status'](_0x5476b4)[_0x8b0b('0x2f')](_0x12d059);}};}function respondWithFilteredResult(_0x3fedc7,_0x431ef3){return function(_0x49b563){if(_0x49b563){var _0xdd5e09=_0x49b563[_0x8b0b('0x30')],_0x25cef6=_0x431ef3[_0x8b0b('0x31')],_0x2b8413=_0x431ef3[_0x8b0b('0x31')]+_0x431ef3[_0x8b0b('0x32')],_0x111400;if(_0x2b8413>=_0xdd5e09){_0x2b8413=_0xdd5e09;_0x111400=0xc8;}else{_0x111400=0xce;}_0x3fedc7[_0x8b0b('0x2d')](_0x111400);return _0x3fedc7[_0x8b0b('0x33')](_0x8b0b('0x34'),_0x25cef6+'-'+_0x2b8413+'/'+_0xdd5e09)[_0x8b0b('0x2f')](_0x49b563);}return null;};}function patchUpdates(_0xd4cf41){return function(_0x425834){try{jsonpatch['apply'](_0x425834,_0xd4cf41,!![]);}catch(_0x38944c){return BPromise[_0x8b0b('0x35')](_0x38944c);}return _0x425834['save']();};}function saveUpdates(_0x22f0a7,_0x482aef){return function(_0xd9455a){if(_0xd9455a){return _0xd9455a[_0x8b0b('0x36')](_0x22f0a7)['then'](function(_0x703359){return _0x703359;});}return null;};}function removeEntity(_0x476666,_0xab019a){return function(_0x4c5f72){if(_0x4c5f72){return _0x4c5f72['destroy']()[_0x8b0b('0x22')](function(){_0x476666[_0x8b0b('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1593,_0x555d5b){return function(_0x39ad7f){if(!_0x39ad7f){_0xd1593[_0x8b0b('0x37')](0x194);}return _0x39ad7f;};}function handleError(_0x22dc3f,_0x22b643){_0x22b643=_0x22b643||0x1f4;return function(_0x16a2f6){logger[_0x8b0b('0x28')](_0x16a2f6[_0x8b0b('0x38')]);if(_0x16a2f6[_0x8b0b('0x39')]){delete _0x16a2f6[_0x8b0b('0x39')];}_0x22dc3f[_0x8b0b('0x2d')](_0x22b643)[_0x8b0b('0x3a')](_0x16a2f6);};}exports['index']=function(_0x578470,_0x129ef0){var _0x5c3cec={},_0x1b1c70={},_0x1c5190={'count':0x0,'rows':[]};var _0xe78004=_['map'](db['ZendeskConfiguration'][_0x8b0b('0x3b')],function(_0x1ee590){return{'name':_0x1ee590[_0x8b0b('0x3c')],'type':_0x1ee590[_0x8b0b('0x3d')][_0x8b0b('0x3e')]};});_0x1b1c70['model']=_[_0x8b0b('0x3f')](_0xe78004,'name');_0x1b1c70[_0x8b0b('0x40')]=_[_0x8b0b('0x41')](_0x578470[_0x8b0b('0x40')]);_0x1b1c70[_0x8b0b('0x42')]=_[_0x8b0b('0x43')](_0x1b1c70[_0x8b0b('0x44')],_0x1b1c70[_0x8b0b('0x40')]);_0x5c3cec[_0x8b0b('0x45')]=_[_0x8b0b('0x43')](_0x1b1c70[_0x8b0b('0x44')],qs[_0x8b0b('0x46')](_0x578470[_0x8b0b('0x40')]['fields']));_0x5c3cec['attributes']=_0x5c3cec[_0x8b0b('0x45')]['length']?_0x5c3cec[_0x8b0b('0x45')]:_0x1b1c70['model'];if(!_0x578470[_0x8b0b('0x40')][_0x8b0b('0x47')](_0x8b0b('0x48'))){_0x5c3cec[_0x8b0b('0x32')]=qs[_0x8b0b('0x32')](_0x578470[_0x8b0b('0x40')][_0x8b0b('0x32')]);_0x5c3cec[_0x8b0b('0x31')]=qs[_0x8b0b('0x31')](_0x578470[_0x8b0b('0x40')][_0x8b0b('0x31')]);}_0x5c3cec['order']=qs['sort'](_0x578470[_0x8b0b('0x40')][_0x8b0b('0x49')]);_0x5c3cec['where']=qs[_0x8b0b('0x42')](_[_0x8b0b('0x4a')](_0x578470[_0x8b0b('0x40')],_0x1b1c70[_0x8b0b('0x42')]),_0xe78004);if(_0x578470[_0x8b0b('0x40')][_0x8b0b('0x4b')]){_0x5c3cec[_0x8b0b('0x4c')]=_['merge'](_0x5c3cec[_0x8b0b('0x4c')],{'$or':_[_0x8b0b('0x3f')](_0xe78004,function(_0x150f6a){if(_0x150f6a[_0x8b0b('0x3d')]!==_0x8b0b('0x4d')){var _0x1bbb0a={};_0x1bbb0a[_0x150f6a[_0x8b0b('0x39')]]={'$like':'%'+_0x578470['query']['filter']+'%'};return _0x1bbb0a;}})});}_0x5c3cec=_[_0x8b0b('0x4e')]({},_0x5c3cec,_0x578470[_0x8b0b('0x4f')]);var _0x1ea482={'where':_0x5c3cec[_0x8b0b('0x4c')]};return db[_0x8b0b('0x50')]['count'](_0x1ea482)[_0x8b0b('0x22')](function(_0x2a2c61){_0x1c5190['count']=_0x2a2c61;if(_0x578470['query'][_0x8b0b('0x51')]){_0x5c3cec['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x8b0b('0x52')](_0x5c3cec);})[_0x8b0b('0x22')](function(_0x2e9d5e){_0x1c5190[_0x8b0b('0x53')]=_0x2e9d5e;return _0x1c5190;})[_0x8b0b('0x22')](respondWithFilteredResult(_0x129ef0,_0x5c3cec))[_0x8b0b('0x2c')](handleError(_0x129ef0,null));};exports[_0x8b0b('0x54')]=function(_0x3c8ec7,_0x226ed5){var _0x3885bf={'raw':![],'where':{'id':_0x3c8ec7[_0x8b0b('0x55')]['id']}},_0x463c14={};_0x463c14[_0x8b0b('0x44')]=_['keys'](db[_0x8b0b('0x50')]['rawAttributes']);_0x463c14[_0x8b0b('0x40')]=_[_0x8b0b('0x41')](_0x3c8ec7[_0x8b0b('0x40')]);_0x463c14[_0x8b0b('0x42')]=_[_0x8b0b('0x43')](_0x463c14[_0x8b0b('0x44')],_0x463c14['query']);_0x3885bf[_0x8b0b('0x45')]=_['intersection'](_0x463c14[_0x8b0b('0x44')],qs[_0x8b0b('0x46')](_0x3c8ec7[_0x8b0b('0x40')][_0x8b0b('0x46')]));_0x3885bf['attributes']=_0x3885bf[_0x8b0b('0x45')][_0x8b0b('0x56')]?_0x3885bf[_0x8b0b('0x45')]:_0x463c14['model'];if(_0x3c8ec7[_0x8b0b('0x40')][_0x8b0b('0x51')]){_0x3885bf['include']=[{'all':!![]}];}_0x3885bf=_[_0x8b0b('0x4e')]({},_0x3885bf,_0x3c8ec7[_0x8b0b('0x4f')]);return db[_0x8b0b('0x50')]['find'](_0x3885bf)[_0x8b0b('0x22')](handleEntityNotFound(_0x226ed5,null))[_0x8b0b('0x22')](respondWithResult(_0x226ed5,null))[_0x8b0b('0x2c')](handleError(_0x226ed5,null));};exports[_0x8b0b('0x57')]=function(_0x2ba6a1,_0x91818f){return db['ZendeskConfiguration']['create'](_0x2ba6a1['body'],{})[_0x8b0b('0x22')](respondWithResult(_0x91818f,0xc9))[_0x8b0b('0x2c')](handleError(_0x91818f,null));};exports['update']=function(_0x4d63c4,_0x322ac3){if(_0x4d63c4['body']['id']){delete _0x4d63c4[_0x8b0b('0x58')]['id'];}return db[_0x8b0b('0x50')][_0x8b0b('0x59')]({'where':{'id':_0x4d63c4[_0x8b0b('0x55')]['id']}})[_0x8b0b('0x22')](handleEntityNotFound(_0x322ac3,null))[_0x8b0b('0x22')](saveUpdates(_0x4d63c4['body'],null))[_0x8b0b('0x22')](respondWithResult(_0x322ac3,null))[_0x8b0b('0x2c')](handleError(_0x322ac3,null));};exports[_0x8b0b('0x5a')]=function(_0x26c6be,_0x4453ce){return db[_0x8b0b('0x50')]['find']({'where':{'id':_0x26c6be[_0x8b0b('0x55')]['id']}})[_0x8b0b('0x22')](handleEntityNotFound(_0x4453ce,null))['then'](removeEntity(_0x4453ce,null))['catch'](handleError(_0x4453ce,null));};exports[_0x8b0b('0x5b')]=function(_0x469368,_0x229e6b,_0x3fbf4f){var _0x3f2307={};var _0x43f924={};var _0x218cd3;var _0x4d86d4;return db['ZendeskConfiguration'][_0x8b0b('0x5c')]({'where':{'id':_0x469368[_0x8b0b('0x55')]['id']}})[_0x8b0b('0x22')](handleEntityNotFound(_0x229e6b,null))[_0x8b0b('0x22')](function(_0x44088a){if(_0x44088a){_0x218cd3=_0x44088a;_0x43f924[_0x8b0b('0x44')]=_[_0x8b0b('0x41')](db[_0x8b0b('0x5d')][_0x8b0b('0x3b')]);_0x43f924[_0x8b0b('0x40')]=_['keys'](_0x469368[_0x8b0b('0x40')]);_0x43f924[_0x8b0b('0x42')]=_[_0x8b0b('0x43')](_0x43f924[_0x8b0b('0x44')],_0x43f924[_0x8b0b('0x40')]);_0x3f2307['attributes']=_[_0x8b0b('0x43')](_0x43f924[_0x8b0b('0x44')],qs['fields'](_0x469368['query']['fields']));_0x3f2307[_0x8b0b('0x45')]=_0x3f2307[_0x8b0b('0x45')][_0x8b0b('0x56')]?_0x3f2307[_0x8b0b('0x45')]:_0x43f924['model'];_0x3f2307[_0x8b0b('0x5e')]=qs[_0x8b0b('0x49')](_0x469368[_0x8b0b('0x40')][_0x8b0b('0x49')]);_0x3f2307[_0x8b0b('0x4c')]=qs['filters'](_['pick'](_0x469368[_0x8b0b('0x40')],_0x43f924['filters']));if(_0x469368[_0x8b0b('0x40')]['filter']){_0x3f2307[_0x8b0b('0x4c')]=_[_0x8b0b('0x4e')](_0x3f2307['where'],{'$or':_[_0x8b0b('0x3f')](_0x3f2307[_0x8b0b('0x45')],function(_0xbae5e5){var _0x3cc5e9={};_0x3cc5e9[_0xbae5e5]={'$like':'%'+_0x469368[_0x8b0b('0x40')]['filter']+'%'};return _0x3cc5e9;})});}_0x3f2307=_[_0x8b0b('0x4e')]({},_0x3f2307,_0x469368[_0x8b0b('0x4f')]);return _0x218cd3[_0x8b0b('0x5b')](_0x3f2307);}})[_0x8b0b('0x22')](function(_0x23f559){if(_0x23f559){_0x4d86d4=_0x23f559[_0x8b0b('0x56')];if(!_0x469368['query'][_0x8b0b('0x47')](_0x8b0b('0x48'))){_0x3f2307[_0x8b0b('0x32')]=qs['limit'](_0x469368[_0x8b0b('0x40')][_0x8b0b('0x32')]);_0x3f2307[_0x8b0b('0x31')]=qs[_0x8b0b('0x31')](_0x469368[_0x8b0b('0x40')][_0x8b0b('0x31')]);}return _0x218cd3[_0x8b0b('0x5b')](_0x3f2307);}})[_0x8b0b('0x22')](function(_0x89bd2c){if(_0x89bd2c){return _0x89bd2c?{'count':_0x4d86d4,'rows':_0x89bd2c}:null;}})[_0x8b0b('0x22')](respondWithResult(_0x229e6b,null))['catch'](handleError(_0x229e6b,null));};exports[_0x8b0b('0x5f')]=function(_0x164260,_0x282017,_0x200f2d){var _0x48ee2c={};var _0x3a9692={};var _0x2e62a0;var _0x558368;return db[_0x8b0b('0x50')][_0x8b0b('0x5c')]({'where':{'id':_0x164260[_0x8b0b('0x55')]['id']}})[_0x8b0b('0x22')](handleEntityNotFound(_0x282017,null))[_0x8b0b('0x22')](function(_0x465016){if(_0x465016){_0x2e62a0=_0x465016;_0x3a9692['model']=_[_0x8b0b('0x41')](db[_0x8b0b('0x5d')]['rawAttributes']);_0x3a9692['query']=_[_0x8b0b('0x41')](_0x164260[_0x8b0b('0x40')]);_0x3a9692['filters']=_[_0x8b0b('0x43')](_0x3a9692[_0x8b0b('0x44')],_0x3a9692[_0x8b0b('0x40')]);_0x48ee2c['attributes']=_[_0x8b0b('0x43')](_0x3a9692[_0x8b0b('0x44')],qs[_0x8b0b('0x46')](_0x164260['query']['fields']));_0x48ee2c['attributes']=_0x48ee2c[_0x8b0b('0x45')][_0x8b0b('0x56')]?_0x48ee2c[_0x8b0b('0x45')]:_0x3a9692['model'];_0x48ee2c['order']=qs['sort'](_0x164260['query'][_0x8b0b('0x49')]);_0x48ee2c[_0x8b0b('0x4c')]=qs[_0x8b0b('0x42')](_['pick'](_0x164260[_0x8b0b('0x40')],_0x3a9692[_0x8b0b('0x42')]));if(_0x164260[_0x8b0b('0x40')][_0x8b0b('0x4b')]){_0x48ee2c[_0x8b0b('0x4c')]=_[_0x8b0b('0x4e')](_0x48ee2c[_0x8b0b('0x4c')],{'$or':_[_0x8b0b('0x3f')](_0x48ee2c[_0x8b0b('0x45')],function(_0x29a534){var _0x3117d0={};_0x3117d0[_0x29a534]={'$like':'%'+_0x164260[_0x8b0b('0x40')][_0x8b0b('0x4b')]+'%'};return _0x3117d0;})});}_0x48ee2c=_['merge']({},_0x48ee2c,_0x164260[_0x8b0b('0x4f')]);return _0x2e62a0[_0x8b0b('0x5f')](_0x48ee2c);}})[_0x8b0b('0x22')](function(_0x216134){if(_0x216134){_0x558368=_0x216134[_0x8b0b('0x56')];if(!_0x164260['query'][_0x8b0b('0x47')]('nolimit')){_0x48ee2c['limit']=qs[_0x8b0b('0x32')](_0x164260['query'][_0x8b0b('0x32')]);_0x48ee2c[_0x8b0b('0x31')]=qs[_0x8b0b('0x31')](_0x164260[_0x8b0b('0x40')]['offset']);}return _0x2e62a0[_0x8b0b('0x5f')](_0x48ee2c);}})[_0x8b0b('0x22')](function(_0x2fc623){if(_0x2fc623){return _0x2fc623?{'count':_0x558368,'rows':_0x2fc623}:null;}})[_0x8b0b('0x22')](respondWithResult(_0x282017,null))[_0x8b0b('0x2c')](handleError(_0x282017,null));};exports[_0x8b0b('0x60')]=function(_0x11acc5,_0x1be3d5,_0x1d6a51){var _0xdcae06={};var _0x5399d1={};var _0x4e2465;var _0x7b26c5;return db[_0x8b0b('0x50')]['findOne']({'where':{'id':_0x11acc5[_0x8b0b('0x55')]['id']}})['then'](handleEntityNotFound(_0x1be3d5,null))[_0x8b0b('0x22')](function(_0x4a2a70){if(_0x4a2a70){_0x4e2465=_0x4a2a70;_0x5399d1[_0x8b0b('0x44')]=_['keys'](db[_0x8b0b('0x5d')][_0x8b0b('0x3b')]);_0x5399d1[_0x8b0b('0x40')]=_[_0x8b0b('0x41')](_0x11acc5['query']);_0x5399d1[_0x8b0b('0x42')]=_['intersection'](_0x5399d1[_0x8b0b('0x44')],_0x5399d1[_0x8b0b('0x40')]);_0xdcae06[_0x8b0b('0x45')]=_['intersection'](_0x5399d1[_0x8b0b('0x44')],qs[_0x8b0b('0x46')](_0x11acc5[_0x8b0b('0x40')][_0x8b0b('0x46')]));_0xdcae06['attributes']=_0xdcae06[_0x8b0b('0x45')][_0x8b0b('0x56')]?_0xdcae06[_0x8b0b('0x45')]:_0x5399d1['model'];_0xdcae06[_0x8b0b('0x5e')]=qs['sort'](_0x11acc5[_0x8b0b('0x40')][_0x8b0b('0x49')]);_0xdcae06[_0x8b0b('0x4c')]=qs[_0x8b0b('0x42')](_['pick'](_0x11acc5[_0x8b0b('0x40')],_0x5399d1[_0x8b0b('0x42')]));if(_0x11acc5[_0x8b0b('0x40')]['filter']){_0xdcae06['where']=_[_0x8b0b('0x4e')](_0xdcae06[_0x8b0b('0x4c')],{'$or':_[_0x8b0b('0x3f')](_0xdcae06[_0x8b0b('0x45')],function(_0x564667){var _0x1fd69c={};_0x1fd69c[_0x564667]={'$like':'%'+_0x11acc5[_0x8b0b('0x40')][_0x8b0b('0x4b')]+'%'};return _0x1fd69c;})});}_0xdcae06=_['merge']({},_0xdcae06,_0x11acc5[_0x8b0b('0x4f')]);return _0x4e2465['getDescriptions'](_0xdcae06);}})[_0x8b0b('0x22')](function(_0x39539e){if(_0x39539e){_0x7b26c5=_0x39539e[_0x8b0b('0x56')];if(!_0x11acc5[_0x8b0b('0x40')]['hasOwnProperty']('nolimit')){_0xdcae06[_0x8b0b('0x32')]=qs[_0x8b0b('0x32')](_0x11acc5[_0x8b0b('0x40')][_0x8b0b('0x32')]);_0xdcae06[_0x8b0b('0x31')]=qs[_0x8b0b('0x31')](_0x11acc5[_0x8b0b('0x40')][_0x8b0b('0x31')]);}return _0x4e2465['getDescriptions'](_0xdcae06);}})[_0x8b0b('0x22')](function(_0x492a91){if(_0x492a91){return _0x492a91?{'count':_0x7b26c5,'rows':_0x492a91}:null;}})[_0x8b0b('0x22')](respondWithResult(_0x1be3d5,null))['catch'](handleError(_0x1be3d5,null));};exports[_0x8b0b('0x61')]=function(_0xed6cc6,_0x1c8fcc,_0x241c21){var _0x10654b={};var _0x48f622={};var _0x5893df;var _0x542e78;return db[_0x8b0b('0x50')][_0x8b0b('0x5c')]({'where':{'id':_0xed6cc6['params']['id']}})['then'](handleEntityNotFound(_0x1c8fcc,null))['then'](function(_0x46549e){if(_0x46549e){_0x5893df=_0x46549e;_0x48f622[_0x8b0b('0x44')]=_['keys'](db[_0x8b0b('0x62')][_0x8b0b('0x3b')]);_0x48f622[_0x8b0b('0x40')]=_[_0x8b0b('0x41')](_0xed6cc6[_0x8b0b('0x40')]);_0x48f622[_0x8b0b('0x42')]=_[_0x8b0b('0x43')](_0x48f622[_0x8b0b('0x44')],_0x48f622['query']);_0x10654b[_0x8b0b('0x45')]=_[_0x8b0b('0x43')](_0x48f622[_0x8b0b('0x44')],qs['fields'](_0xed6cc6['query'][_0x8b0b('0x46')]));_0x10654b[_0x8b0b('0x45')]=_0x10654b[_0x8b0b('0x45')][_0x8b0b('0x56')]?_0x10654b[_0x8b0b('0x45')]:_0x48f622[_0x8b0b('0x44')];_0x10654b['order']=qs[_0x8b0b('0x49')](_0xed6cc6[_0x8b0b('0x40')][_0x8b0b('0x49')]);_0x10654b[_0x8b0b('0x4c')]=qs['filters'](_[_0x8b0b('0x4a')](_0xed6cc6[_0x8b0b('0x40')],_0x48f622[_0x8b0b('0x42')]));if(_0xed6cc6[_0x8b0b('0x40')]['filter']){_0x10654b['where']=_[_0x8b0b('0x4e')](_0x10654b[_0x8b0b('0x4c')],{'$or':_[_0x8b0b('0x3f')](_0x10654b[_0x8b0b('0x45')],function(_0x5de958){var _0x5ae45b={};_0x5ae45b[_0x5de958]={'$like':'%'+_0xed6cc6[_0x8b0b('0x40')][_0x8b0b('0x4b')]+'%'};return _0x5ae45b;})});}_0x10654b=_['merge']({},_0x10654b,_0xed6cc6[_0x8b0b('0x4f')]);return _0x5893df[_0x8b0b('0x61')](_0x10654b);}})['then'](function(_0x36ca84){if(_0x36ca84){_0x542e78=_0x36ca84[_0x8b0b('0x56')];if(!_0xed6cc6[_0x8b0b('0x40')][_0x8b0b('0x47')](_0x8b0b('0x48'))){_0x10654b['limit']=qs['limit'](_0xed6cc6[_0x8b0b('0x40')][_0x8b0b('0x32')]);_0x10654b[_0x8b0b('0x31')]=qs[_0x8b0b('0x31')](_0xed6cc6[_0x8b0b('0x40')][_0x8b0b('0x31')]);}return _0x5893df['getTags'](_0x10654b);}})['then'](function(_0x1d1901){if(_0x1d1901){return _0x1d1901?{'count':_0x542e78,'rows':_0x1d1901}:null;}})[_0x8b0b('0x22')](respondWithResult(_0x1c8fcc,null))[_0x8b0b('0x2c')](handleError(_0x1c8fcc,null));};exports[_0x8b0b('0x63')]=function(_0x52d040,_0x2c9a86,_0x26fb00){if(_0x52d040[_0x8b0b('0x58')]['id']){delete _0x52d040['body']['id'];}return db['ZendeskConfiguration'][_0x8b0b('0x5c')]({'where':{'id':_0x52d040[_0x8b0b('0x55')]['id']}})[_0x8b0b('0x22')](handleEntityNotFound(_0x2c9a86,null))['then'](function(_0x53ca29){if(_0x53ca29){return _0x53ca29[_0x8b0b('0x63')](_0x52d040[_0x8b0b('0x58')][_0x8b0b('0x64')]||[]);}return null;})[_0x8b0b('0x22')](respondWithResult(_0x2c9a86,null))[_0x8b0b('0x2c')](handleError(_0x2c9a86,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7043172..d49d9de 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 _0xf396=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x2e8f5e,_0x4068d9){var _0xb57b44=function(_0x13220a){while(--_0x13220a){_0x2e8f5e['push'](_0x2e8f5e['shift']());}};_0xb57b44(++_0x4068d9);}(_0xf396,0xa7));var _0x6f39=function(_0xbc27d1,_0x19301c){_0xbc27d1=_0xbc27d1-0x0;var _0x3d148e=_0xf396[_0xbc27d1];return _0x3d148e;};'use strict';var _=require(_0x6f39('0x0'));var util=require(_0x6f39('0x1'));var logger=require(_0x6f39('0x2'))(_0x6f39('0x3'));var moment=require(_0x6f39('0x4'));var BPromise=require(_0x6f39('0x5'));var rp=require(_0x6f39('0x6'));var fs=require('fs');var path=require(_0x6f39('0x7'));var rimraf=require(_0x6f39('0x8'));var config=require(_0x6f39('0x9'));var attributes=require(_0x6f39('0xa'));module[_0x6f39('0xb')]=function(_0x11f9a7,_0x209c54){return _0x11f9a7[_0x6f39('0xc')](_0x6f39('0xd'),attributes,{'tableName':_0x6f39('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfd3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcfd3,0x150));var _0x3cfd=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0xcfd3[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0x3cfd('0x0'));var util=require(_0x3cfd('0x1'));var logger=require(_0x3cfd('0x2'))(_0x3cfd('0x3'));var moment=require(_0x3cfd('0x4'));var BPromise=require(_0x3cfd('0x5'));var rp=require(_0x3cfd('0x6'));var fs=require('fs');var path=require(_0x3cfd('0x7'));var rimraf=require(_0x3cfd('0x8'));var config=require(_0x3cfd('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3cfd('0xa')]=function(_0x39d3cb,_0x2743a9){return _0x39d3cb[_0x3cfd('0xb')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index e37cb49..39f8acd 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 _0x3e1e=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x155d28,_0x49dca7){var _0xbc10fb=function(_0x1a3cfb){while(--_0x1a3cfb){_0x155d28['push'](_0x155d28['shift']());}};_0xbc10fb(++_0x49dca7);}(_0x3e1e,0x1de));var _0xe3e1=function(_0x7d5828,_0x204027){_0x7d5828=_0x7d5828-0x0;var _0x52a1cb=_0x3e1e[_0x7d5828];return _0x52a1cb;};'use strict';var _=require(_0xe3e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3e1('0x1'));var rs=require(_0xe3e1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3e1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3e1('0x4'))('rpc');var config=require(_0xe3e1('0x5'));var jayson=require(_0xe3e1('0x6'));var client=jayson[_0xe3e1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x181f02,_0x13fee4,_0xa64b6f){return new BPromise(function(_0x2e3726,_0x49d0d){return client[_0xe3e1('0x8')](_0x181f02,_0xa64b6f)[_0xe3e1('0x9')](function(_0x539dae){logger[_0xe3e1('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x13fee4,_0xe3e1('0xb'));logger[_0xe3e1('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x13fee4,_0xe3e1('0xb'),JSON['stringify'](_0x539dae));if(_0x539dae[_0xe3e1('0xd')]){if(_0x539dae['error'][_0xe3e1('0xe')]===0x1f4){logger[_0xe3e1('0xd')](_0xe3e1('0xf'),_0x13fee4,_0x539dae['error'][_0xe3e1('0x10')]);return _0x49d0d(_0x539dae[_0xe3e1('0xd')][_0xe3e1('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x13fee4,_0x539dae['error'][_0xe3e1('0x10')]);return _0x2e3726(_0x539dae[_0xe3e1('0xd')][_0xe3e1('0x10')]);}else{logger['info'](_0xe3e1('0xf'),_0x13fee4,'request\x20sent');_0x2e3726(_0x539dae[_0xe3e1('0x11')][_0xe3e1('0x10')]);}})[_0xe3e1('0x12')](function(_0x4e8912){logger[_0xe3e1('0xd')](_0xe3e1('0xf'),_0x13fee4,_0x4e8912);_0x49d0d(_0x4e8912);});});} \ No newline at end of file +var _0xe163=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe163,0x1ce));var _0x3e16=function(_0x16e0f1,_0x2adeba){_0x16e0f1=_0x16e0f1-0x0;var _0x406e2a=_0xe163[_0x16e0f1];return _0x406e2a;};'use strict';var _=require(_0x3e16('0x0'));var util=require(_0x3e16('0x1'));var moment=require(_0x3e16('0x2'));var BPromise=require(_0x3e16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e16('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e16('0x5'));var logger=require(_0x3e16('0x6'))(_0x3e16('0x7'));var config=require(_0x3e16('0x8'));var jayson=require(_0x3e16('0x9'));var client=jayson[_0x3e16('0xa')][_0x3e16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3277e6,_0x3bb734,_0x392e57){return new BPromise(function(_0x10baeb,_0x2140c1){return client[_0x3e16('0xc')](_0x3277e6,_0x392e57)[_0x3e16('0xd')](function(_0x58494e){logger['info'](_0x3e16('0xe'),_0x3bb734,_0x3e16('0xf'));logger[_0x3e16('0x10')](_0x3e16('0x11'),_0x3bb734,_0x3e16('0xf'),JSON[_0x3e16('0x12')](_0x58494e));if(_0x58494e[_0x3e16('0x13')]){if(_0x58494e[_0x3e16('0x13')][_0x3e16('0x14')]===0x1f4){logger[_0x3e16('0x13')](_0x3e16('0xe'),_0x3bb734,_0x58494e[_0x3e16('0x13')][_0x3e16('0x15')]);return _0x2140c1(_0x58494e[_0x3e16('0x13')][_0x3e16('0x15')]);}logger[_0x3e16('0x13')](_0x3e16('0xe'),_0x3bb734,_0x58494e[_0x3e16('0x13')][_0x3e16('0x15')]);return _0x10baeb(_0x58494e['error'][_0x3e16('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3bb734,_0x3e16('0xf'));_0x10baeb(_0x58494e[_0x3e16('0x16')]['message']);}})[_0x3e16('0x17')](function(_0x3b9bc8){logger['error'](_0x3e16('0xe'),_0x3bb734,_0x3b9bc8);_0x2140c1(_0x3b9bc8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8cbfcc8..4fbbf9d 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 _0xb701=['put','update','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x45e1fc,_0x246aa6){var _0x488a42=function(_0xe90d1f){while(--_0xe90d1f){_0x45e1fc['push'](_0x45e1fc['shift']());}};_0x488a42(++_0x246aa6);}(_0xb701,0x144));var _0x1b70=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb701[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1b70('0x2'));var interaction=require(_0x1b70('0x3'));var config=require(_0x1b70('0x4'));var controller=require(_0x1b70('0x5'));router[_0x1b70('0x6')]('/',auth[_0x1b70('0x7')](),controller[_0x1b70('0x8')]);router[_0x1b70('0x6')](_0x1b70('0x9'),auth[_0x1b70('0x7')](),controller['show']);router[_0x1b70('0xa')]('/',auth[_0x1b70('0x7')](),controller[_0x1b70('0xb')]);router[_0x1b70('0xc')](_0x1b70('0x9'),auth[_0x1b70('0x7')](),controller[_0x1b70('0xd')]);router['delete'](_0x1b70('0x9'),auth[_0x1b70('0x7')](),controller[_0x1b70('0xe')]);module[_0x1b70('0xf')]=router; \ No newline at end of file +var _0x587a=['put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','create'];(function(_0x460e17,_0x3e1a11){var _0x241b0b=function(_0x38cc94){while(--_0x38cc94){_0x460e17['push'](_0x460e17['shift']());}};_0x241b0b(++_0x3e1a11);}(_0x587a,0x18b));var _0xa587=function(_0x55ffa0,_0x3c8d0e){_0x55ffa0=_0x55ffa0-0x0;var _0x644bfc=_0x587a[_0x55ffa0];return _0x644bfc;};'use strict';var multer=require(_0xa587('0x0'));var util=require(_0xa587('0x1'));var path=require(_0xa587('0x2'));var timeout=require(_0xa587('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa587('0x4'));var interaction=require(_0xa587('0x5'));var config=require(_0xa587('0x6'));var controller=require(_0xa587('0x7'));router['get']('/',auth[_0xa587('0x8')](),controller[_0xa587('0x9')]);router[_0xa587('0xa')](_0xa587('0xb'),auth[_0xa587('0x8')](),controller['show']);router['post']('/',auth[_0xa587('0x8')](),controller[_0xa587('0xc')]);router[_0xa587('0xd')](_0xa587('0xb'),auth[_0xa587('0x8')](),controller[_0xa587('0xe')]);router[_0xa587('0xf')](_0xa587('0xb'),auth[_0xa587('0x8')](),controller[_0xa587('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 48206b5..7cb2f64 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 _0xf698=['STRING','BOOLEAN','sequelize','exports','string','variable','keyValue'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0xf698,0x1de));var _0x8f69=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xf698[_0x16629d];return _0x56ccee;};'use strict';var Sequelize=require(_0x8f69('0x0'));module[_0x8f69('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8f69('0x2'),_0x8f69('0x3'),'customVariable',_0x8f69('0x4')),'defaultValue':_0x8f69('0x2')},'content':{'type':Sequelize[_0x8f69('0x5')]},'key':{'type':Sequelize[_0x8f69('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x8f69('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8f69('0x5')]},'nameField':{'type':Sequelize[_0x8f69('0x5')]},'customField':{'type':Sequelize[_0x8f69('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f69('0x5')]}}; \ No newline at end of file +var _0x7345=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','string'];(function(_0x8b2b5c,_0x30c0e1){var _0x3d857b=function(_0x2e48e1){while(--_0x2e48e1){_0x8b2b5c['push'](_0x8b2b5c['shift']());}};_0x3d857b(++_0x30c0e1);}(_0x7345,0x163));var _0x5734=function(_0x5bfeae,_0x267307){_0x5bfeae=_0x5bfeae-0x0;var _0xcc6761=_0x7345[_0x5bfeae];return _0xcc6761;};'use strict';var Sequelize=require(_0x5734('0x0'));module[_0x5734('0x1')]={'type':{'type':Sequelize[_0x5734('0x2')]('string',_0x5734('0x3'),'customVariable','keyValue'),'defaultValue':_0x5734('0x4')},'content':{'type':Sequelize[_0x5734('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5734('0x2')]('string',_0x5734('0x3'),_0x5734('0x6'))},'keyContent':{'type':Sequelize[_0x5734('0x5')]},'idField':{'type':Sequelize[_0x5734('0x5')]},'nameField':{'type':Sequelize[_0x5734('0x5')]},'customField':{'type':Sequelize[_0x5734('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5734('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 140e889..c221c7a 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 _0xd57f=['findAll','rows','catch','show','params','includeAll','include','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge'];(function(_0x55c8f5,_0x137adf){var _0x541f5e=function(_0x4f28a2){while(--_0x4f28a2){_0x55c8f5['push'](_0x55c8f5['shift']());}};_0x541f5e(++_0x137adf);}(_0xd57f,0x14b));var _0xfd57=function(_0xc4257b,_0x1b8aac){_0xc4257b=_0xc4257b-0x0;var _0x499ff6=_0xd57f[_0xc4257b];return _0x499ff6;};'use strict';var pdf=require(_0xfd57('0x0'));var emlformat=require(_0xfd57('0x1'));var rimraf=require(_0xfd57('0x2'));var zipdir=require(_0xfd57('0x3'));var jsonpatch=require(_0xfd57('0x4'));var rp=require(_0xfd57('0x5'));var moment=require(_0xfd57('0x6'));var BPromise=require(_0xfd57('0x7'));var Mustache=require(_0xfd57('0x8'));var util=require('util');var path=require(_0xfd57('0x9'));var sox=require(_0xfd57('0xa'));var csv=require(_0xfd57('0xb'));var ejs=require(_0xfd57('0xc'));var fs=require('fs');var _=require(_0xfd57('0xd'));var squel=require(_0xfd57('0xe'));var crypto=require(_0xfd57('0xf'));var jsforce=require(_0xfd57('0x10'));var deskjs=require(_0xfd57('0x11'));var toCsv=require(_0xfd57('0xb'));var querystring=require(_0xfd57('0x12'));var Papa=require('papaparse');var Redis=require(_0xfd57('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfd57('0x14'));var as=require(_0xfd57('0x15'));var hardwareService=require(_0xfd57('0x16'));var logger=require(_0xfd57('0x17'))(_0xfd57('0x18'));var utils=require(_0xfd57('0x19'));var config=require(_0xfd57('0x1a'));var db=require(_0xfd57('0x1b'))['db'];function respondWithStatusCode(_0xb40d60,_0x78992d){_0x78992d=_0x78992d||0xcc;return function(_0x469504){if(_0x469504){return _0xb40d60['sendStatus'](_0x78992d);}return _0xb40d60[_0xfd57('0x1c')](_0x78992d)['end']();};}function respondWithResult(_0x553529,_0x3972ab){_0x3972ab=_0x3972ab||0xc8;return function(_0x4f7759){if(_0x4f7759){return _0x553529[_0xfd57('0x1c')](_0x3972ab)['json'](_0x4f7759);}};}function respondWithFilteredResult(_0x48b7ff,_0x2d0653){return function(_0x592536){if(_0x592536){var _0x332c1a=_0x592536[_0xfd57('0x1d')],_0x1aed33=_0x2d0653[_0xfd57('0x1e')],_0x37236a=_0x2d0653[_0xfd57('0x1e')]+_0x2d0653[_0xfd57('0x1f')],_0x29e0a4;if(_0x37236a>=_0x332c1a){_0x37236a=_0x332c1a;_0x29e0a4=0xc8;}else{_0x29e0a4=0xce;}_0x48b7ff[_0xfd57('0x1c')](_0x29e0a4);return _0x48b7ff[_0xfd57('0x20')](_0xfd57('0x21'),_0x1aed33+'-'+_0x37236a+'/'+_0x332c1a)[_0xfd57('0x22')](_0x592536);}return null;};}function patchUpdates(_0x394905){return function(_0xfe2ceb){try{jsonpatch[_0xfd57('0x23')](_0xfe2ceb,_0x394905,!![]);}catch(_0x673ae){return BPromise[_0xfd57('0x24')](_0x673ae);}return _0xfe2ceb[_0xfd57('0x25')]();};}function saveUpdates(_0x1cc1ec,_0x75868a){return function(_0x55678f){if(_0x55678f){return _0x55678f[_0xfd57('0x26')](_0x1cc1ec)[_0xfd57('0x27')](function(_0x4a16ff){return _0x4a16ff;});}return null;};}function removeEntity(_0x5226d1,_0x4b8e80){return function(_0x1ae3d5){if(_0x1ae3d5){return _0x1ae3d5[_0xfd57('0x28')]()['then'](function(){_0x5226d1[_0xfd57('0x1c')](0xcc)[_0xfd57('0x29')]();});}};}function handleEntityNotFound(_0x5bd8b5,_0x4f1de2){return function(_0x2b9c6d){if(!_0x2b9c6d){_0x5bd8b5[_0xfd57('0x2a')](0x194);}return _0x2b9c6d;};}function handleError(_0x357c87,_0xe6092){_0xe6092=_0xe6092||0x1f4;return function(_0x5e7525){logger[_0xfd57('0x2b')](_0x5e7525[_0xfd57('0x2c')]);if(_0x5e7525[_0xfd57('0x2d')]){delete _0x5e7525['name'];}_0x357c87['status'](_0xe6092)[_0xfd57('0x2e')](_0x5e7525);};}exports[_0xfd57('0x2f')]=function(_0x1f18ed,_0x4f035b){var _0x45c9c7={},_0x38ce1b={},_0x5b746f={'count':0x0,'rows':[]};var _0x4f7bb0=_[_0xfd57('0x30')](db[_0xfd57('0x31')][_0xfd57('0x32')],function(_0x5d2dfc){return{'name':_0x5d2dfc[_0xfd57('0x33')],'type':_0x5d2dfc[_0xfd57('0x34')]['key']};});_0x38ce1b['model']=_['map'](_0x4f7bb0,_0xfd57('0x2d'));_0x38ce1b['query']=_[_0xfd57('0x35')](_0x1f18ed[_0xfd57('0x36')]);_0x38ce1b[_0xfd57('0x37')]=_[_0xfd57('0x38')](_0x38ce1b[_0xfd57('0x39')],_0x38ce1b[_0xfd57('0x36')]);_0x45c9c7['attributes']=_[_0xfd57('0x38')](_0x38ce1b[_0xfd57('0x39')],qs['fields'](_0x1f18ed[_0xfd57('0x36')][_0xfd57('0x3a')]));_0x45c9c7['attributes']=_0x45c9c7[_0xfd57('0x3b')][_0xfd57('0x3c')]?_0x45c9c7[_0xfd57('0x3b')]:_0x38ce1b['model'];if(!_0x1f18ed[_0xfd57('0x36')][_0xfd57('0x3d')](_0xfd57('0x3e'))){_0x45c9c7[_0xfd57('0x1f')]=qs[_0xfd57('0x1f')](_0x1f18ed[_0xfd57('0x36')]['limit']);_0x45c9c7['offset']=qs[_0xfd57('0x1e')](_0x1f18ed[_0xfd57('0x36')][_0xfd57('0x1e')]);}_0x45c9c7[_0xfd57('0x3f')]=qs[_0xfd57('0x40')](_0x1f18ed[_0xfd57('0x36')]['sort']);_0x45c9c7['where']=qs[_0xfd57('0x37')](_[_0xfd57('0x41')](_0x1f18ed[_0xfd57('0x36')],_0x38ce1b[_0xfd57('0x37')]),_0x4f7bb0);if(_0x1f18ed[_0xfd57('0x36')]['filter']){_0x45c9c7[_0xfd57('0x42')]=_['merge'](_0x45c9c7[_0xfd57('0x42')],{'$or':_[_0xfd57('0x30')](_0x4f7bb0,function(_0x2810c2){if(_0x2810c2['type']!==_0xfd57('0x43')){var _0x543a55={};_0x543a55[_0x2810c2['name']]={'$like':'%'+_0x1f18ed[_0xfd57('0x36')]['filter']+'%'};return _0x543a55;}})});}_0x45c9c7=_[_0xfd57('0x44')]({},_0x45c9c7,_0x1f18ed['options']);var _0x3956cb={'where':_0x45c9c7[_0xfd57('0x42')]};return db['ZendeskField'][_0xfd57('0x1d')](_0x3956cb)[_0xfd57('0x27')](function(_0x495651){_0x5b746f[_0xfd57('0x1d')]=_0x495651;if(_0x1f18ed[_0xfd57('0x36')]['includeAll']){_0x45c9c7['include']=[{'all':!![]}];}return db['ZendeskField'][_0xfd57('0x45')](_0x45c9c7);})[_0xfd57('0x27')](function(_0x293e15){_0x5b746f[_0xfd57('0x46')]=_0x293e15;return _0x5b746f;})['then'](respondWithFilteredResult(_0x4f035b,_0x45c9c7))[_0xfd57('0x47')](handleError(_0x4f035b,null));};exports[_0xfd57('0x48')]=function(_0x55761d,_0x14efef){var _0x10a2bf={'raw':!![],'where':{'id':_0x55761d[_0xfd57('0x49')]['id']}},_0x25737e={};_0x25737e['model']=_[_0xfd57('0x35')](db[_0xfd57('0x31')]['rawAttributes']);_0x25737e['query']=_['keys'](_0x55761d[_0xfd57('0x36')]);_0x25737e['filters']=_[_0xfd57('0x38')](_0x25737e[_0xfd57('0x39')],_0x25737e[_0xfd57('0x36')]);_0x10a2bf[_0xfd57('0x3b')]=_[_0xfd57('0x38')](_0x25737e['model'],qs[_0xfd57('0x3a')](_0x55761d['query'][_0xfd57('0x3a')]));_0x10a2bf['attributes']=_0x10a2bf[_0xfd57('0x3b')][_0xfd57('0x3c')]?_0x10a2bf[_0xfd57('0x3b')]:_0x25737e[_0xfd57('0x39')];if(_0x55761d[_0xfd57('0x36')][_0xfd57('0x4a')]){_0x10a2bf[_0xfd57('0x4b')]=[{'all':!![]}];}_0x10a2bf=_[_0xfd57('0x44')]({},_0x10a2bf,_0x55761d[_0xfd57('0x4c')]);return db['ZendeskField']['find'](_0x10a2bf)[_0xfd57('0x27')](handleEntityNotFound(_0x14efef,null))[_0xfd57('0x27')](respondWithResult(_0x14efef,null))[_0xfd57('0x47')](handleError(_0x14efef,null));};exports['create']=function(_0xb5767a,_0x41dd61){return db['ZendeskField'][_0xfd57('0x4d')](_0xb5767a[_0xfd57('0x4e')],{})[_0xfd57('0x27')](respondWithResult(_0x41dd61,0xc9))[_0xfd57('0x47')](handleError(_0x41dd61,null));};exports[_0xfd57('0x26')]=function(_0xbe1156,_0x5a2ba8){if(_0xbe1156['body']['id']){delete _0xbe1156['body']['id'];}return db[_0xfd57('0x31')][_0xfd57('0x4f')]({'where':{'id':_0xbe1156[_0xfd57('0x49')]['id']}})[_0xfd57('0x27')](handleEntityNotFound(_0x5a2ba8,null))[_0xfd57('0x27')](saveUpdates(_0xbe1156[_0xfd57('0x4e')],null))[_0xfd57('0x27')](respondWithResult(_0x5a2ba8,null))[_0xfd57('0x47')](handleError(_0x5a2ba8,null));};exports[_0xfd57('0x28')]=function(_0x3d7ead,_0x275fa9){return db[_0xfd57('0x31')]['find']({'where':{'id':_0x3d7ead[_0xfd57('0x49')]['id']}})['then'](handleEntityNotFound(_0x275fa9,null))[_0xfd57('0x27')](removeEntity(_0x275fa9,null))['catch'](handleError(_0x275fa9,null));}; \ No newline at end of file +var _0x5d8e=['body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','Content-Range','apply','update','then','destroy','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','fields','create'];(function(_0x19b34b,_0x49654a){var _0x43ded8=function(_0x6fa208){while(--_0x6fa208){_0x19b34b['push'](_0x19b34b['shift']());}};_0x43ded8(++_0x49654a);}(_0x5d8e,0x8a));var _0xe5d8=function(_0x33e8c2,_0x3ca05a){_0x33e8c2=_0x33e8c2-0x0;var _0x523b60=_0x5d8e[_0x33e8c2];return _0x523b60;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe5d8('0x0'));var rimraf=require(_0xe5d8('0x1'));var zipdir=require(_0xe5d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5d8('0x3'));var moment=require(_0xe5d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d8('0x5'));var util=require(_0xe5d8('0x6'));var path=require(_0xe5d8('0x7'));var sox=require(_0xe5d8('0x8'));var csv=require(_0xe5d8('0x9'));var ejs=require(_0xe5d8('0xa'));var fs=require('fs');var _=require(_0xe5d8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5d8('0xc'));var deskjs=require(_0xe5d8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5d8('0xe'));var qs=require(_0xe5d8('0xf'));var as=require(_0xe5d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d8('0x11'))(_0xe5d8('0x12'));var utils=require(_0xe5d8('0x13'));var config=require(_0xe5d8('0x14'));var db=require(_0xe5d8('0x15'))['db'];function respondWithStatusCode(_0x50fee6,_0x4cdf98){_0x4cdf98=_0x4cdf98||0xcc;return function(_0x3b9e4e){if(_0x3b9e4e){return _0x50fee6['sendStatus'](_0x4cdf98);}return _0x50fee6[_0xe5d8('0x16')](_0x4cdf98)[_0xe5d8('0x17')]();};}function respondWithResult(_0x540f80,_0x2f5f0d){_0x2f5f0d=_0x2f5f0d||0xc8;return function(_0x51158c){if(_0x51158c){return _0x540f80[_0xe5d8('0x16')](_0x2f5f0d)[_0xe5d8('0x18')](_0x51158c);}};}function respondWithFilteredResult(_0x1c97fa,_0x38dda4){return function(_0x294be6){if(_0x294be6){var _0x50fb9c=_0x294be6['count'],_0x27fb27=_0x38dda4[_0xe5d8('0x19')],_0x1f4d39=_0x38dda4['offset']+_0x38dda4['limit'],_0x401df1;if(_0x1f4d39>=_0x50fb9c){_0x1f4d39=_0x50fb9c;_0x401df1=0xc8;}else{_0x401df1=0xce;}_0x1c97fa[_0xe5d8('0x16')](_0x401df1);return _0x1c97fa['set'](_0xe5d8('0x1a'),_0x27fb27+'-'+_0x1f4d39+'/'+_0x50fb9c)[_0xe5d8('0x18')](_0x294be6);}return null;};}function patchUpdates(_0x4d0ec9){return function(_0x21131e){try{jsonpatch[_0xe5d8('0x1b')](_0x21131e,_0x4d0ec9,!![]);}catch(_0x27ca2c){return BPromise['reject'](_0x27ca2c);}return _0x21131e['save']();};}function saveUpdates(_0x37751b,_0x49cd37){return function(_0x19b70f){if(_0x19b70f){return _0x19b70f[_0xe5d8('0x1c')](_0x37751b)[_0xe5d8('0x1d')](function(_0x353dc2){return _0x353dc2;});}return null;};}function removeEntity(_0x17c4ce,_0x32e86b){return function(_0x32edb9){if(_0x32edb9){return _0x32edb9[_0xe5d8('0x1e')]()[_0xe5d8('0x1d')](function(){_0x17c4ce[_0xe5d8('0x16')](0xcc)[_0xe5d8('0x17')]();});}};}function handleEntityNotFound(_0x548997,_0x59b3f5){return function(_0x270ad9){if(!_0x270ad9){_0x548997['sendStatus'](0x194);}return _0x270ad9;};}function handleError(_0x9bae7b,_0x3a8869){_0x3a8869=_0x3a8869||0x1f4;return function(_0x39bd0d){logger[_0xe5d8('0x1f')](_0x39bd0d['stack']);if(_0x39bd0d[_0xe5d8('0x20')]){delete _0x39bd0d[_0xe5d8('0x20')];}_0x9bae7b[_0xe5d8('0x16')](_0x3a8869)['send'](_0x39bd0d);};}exports[_0xe5d8('0x21')]=function(_0x7bc456,_0x10c76e){var _0x217ed6={},_0x577d06={},_0x1e8b64={'count':0x0,'rows':[]};var _0x40d468=_[_0xe5d8('0x22')](db[_0xe5d8('0x23')][_0xe5d8('0x24')],function(_0x3c86f3){return{'name':_0x3c86f3[_0xe5d8('0x25')],'type':_0x3c86f3[_0xe5d8('0x26')][_0xe5d8('0x27')]};});_0x577d06[_0xe5d8('0x28')]=_[_0xe5d8('0x22')](_0x40d468,_0xe5d8('0x20'));_0x577d06[_0xe5d8('0x29')]=_[_0xe5d8('0x2a')](_0x7bc456[_0xe5d8('0x29')]);_0x577d06[_0xe5d8('0x2b')]=_[_0xe5d8('0x2c')](_0x577d06[_0xe5d8('0x28')],_0x577d06[_0xe5d8('0x29')]);_0x217ed6[_0xe5d8('0x2d')]=_[_0xe5d8('0x2c')](_0x577d06[_0xe5d8('0x28')],qs['fields'](_0x7bc456['query']['fields']));_0x217ed6[_0xe5d8('0x2d')]=_0x217ed6[_0xe5d8('0x2d')][_0xe5d8('0x2e')]?_0x217ed6[_0xe5d8('0x2d')]:_0x577d06[_0xe5d8('0x28')];if(!_0x7bc456[_0xe5d8('0x29')][_0xe5d8('0x2f')](_0xe5d8('0x30'))){_0x217ed6[_0xe5d8('0x31')]=qs[_0xe5d8('0x31')](_0x7bc456[_0xe5d8('0x29')][_0xe5d8('0x31')]);_0x217ed6[_0xe5d8('0x19')]=qs[_0xe5d8('0x19')](_0x7bc456[_0xe5d8('0x29')][_0xe5d8('0x19')]);}_0x217ed6[_0xe5d8('0x32')]=qs['sort'](_0x7bc456[_0xe5d8('0x29')]['sort']);_0x217ed6[_0xe5d8('0x33')]=qs[_0xe5d8('0x2b')](_[_0xe5d8('0x34')](_0x7bc456[_0xe5d8('0x29')],_0x577d06['filters']),_0x40d468);if(_0x7bc456['query']['filter']){_0x217ed6[_0xe5d8('0x33')]=_[_0xe5d8('0x35')](_0x217ed6[_0xe5d8('0x33')],{'$or':_[_0xe5d8('0x22')](_0x40d468,function(_0x90f2a4){if(_0x90f2a4[_0xe5d8('0x26')]!==_0xe5d8('0x36')){var _0x429c8a={};_0x429c8a[_0x90f2a4['name']]={'$like':'%'+_0x7bc456[_0xe5d8('0x29')][_0xe5d8('0x37')]+'%'};return _0x429c8a;}})});}_0x217ed6=_[_0xe5d8('0x35')]({},_0x217ed6,_0x7bc456[_0xe5d8('0x38')]);var _0x480b9f={'where':_0x217ed6['where']};return db['ZendeskField'][_0xe5d8('0x39')](_0x480b9f)['then'](function(_0x3fc27a){_0x1e8b64['count']=_0x3fc27a;if(_0x7bc456[_0xe5d8('0x29')][_0xe5d8('0x3a')]){_0x217ed6[_0xe5d8('0x3b')]=[{'all':!![]}];}return db[_0xe5d8('0x23')]['findAll'](_0x217ed6);})[_0xe5d8('0x1d')](function(_0x2a44bd){_0x1e8b64[_0xe5d8('0x3c')]=_0x2a44bd;return _0x1e8b64;})[_0xe5d8('0x1d')](respondWithFilteredResult(_0x10c76e,_0x217ed6))[_0xe5d8('0x3d')](handleError(_0x10c76e,null));};exports[_0xe5d8('0x3e')]=function(_0x4f5c07,_0x2b6fa6){var _0x5e7b3f={'raw':!![],'where':{'id':_0x4f5c07[_0xe5d8('0x3f')]['id']}},_0x5ce6a5={};_0x5ce6a5[_0xe5d8('0x28')]=_[_0xe5d8('0x2a')](db[_0xe5d8('0x23')]['rawAttributes']);_0x5ce6a5['query']=_['keys'](_0x4f5c07[_0xe5d8('0x29')]);_0x5ce6a5[_0xe5d8('0x2b')]=_['intersection'](_0x5ce6a5[_0xe5d8('0x28')],_0x5ce6a5[_0xe5d8('0x29')]);_0x5e7b3f['attributes']=_['intersection'](_0x5ce6a5[_0xe5d8('0x28')],qs[_0xe5d8('0x40')](_0x4f5c07[_0xe5d8('0x29')][_0xe5d8('0x40')]));_0x5e7b3f[_0xe5d8('0x2d')]=_0x5e7b3f[_0xe5d8('0x2d')][_0xe5d8('0x2e')]?_0x5e7b3f['attributes']:_0x5ce6a5['model'];if(_0x4f5c07[_0xe5d8('0x29')]['includeAll']){_0x5e7b3f[_0xe5d8('0x3b')]=[{'all':!![]}];}_0x5e7b3f=_[_0xe5d8('0x35')]({},_0x5e7b3f,_0x4f5c07[_0xe5d8('0x38')]);return db['ZendeskField']['find'](_0x5e7b3f)[_0xe5d8('0x1d')](handleEntityNotFound(_0x2b6fa6,null))[_0xe5d8('0x1d')](respondWithResult(_0x2b6fa6,null))[_0xe5d8('0x3d')](handleError(_0x2b6fa6,null));};exports[_0xe5d8('0x41')]=function(_0x3e4dff,_0x2d5abf){return db[_0xe5d8('0x23')][_0xe5d8('0x41')](_0x3e4dff[_0xe5d8('0x42')],{})[_0xe5d8('0x1d')](respondWithResult(_0x2d5abf,0xc9))[_0xe5d8('0x3d')](handleError(_0x2d5abf,null));};exports[_0xe5d8('0x1c')]=function(_0x53f163,_0x3ee67f){if(_0x53f163[_0xe5d8('0x42')]['id']){delete _0x53f163[_0xe5d8('0x42')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x53f163[_0xe5d8('0x3f')]['id']}})[_0xe5d8('0x1d')](handleEntityNotFound(_0x3ee67f,null))[_0xe5d8('0x1d')](saveUpdates(_0x53f163[_0xe5d8('0x42')],null))[_0xe5d8('0x1d')](respondWithResult(_0x3ee67f,null))[_0xe5d8('0x3d')](handleError(_0x3ee67f,null));};exports[_0xe5d8('0x1e')]=function(_0x5c0f1f,_0x190deb){return db[_0xe5d8('0x23')][_0xe5d8('0x43')]({'where':{'id':_0x5c0f1f[_0xe5d8('0x3f')]['id']}})[_0xe5d8('0x1d')](handleEntityNotFound(_0x190deb,null))['then'](removeEntity(_0x190deb,null))['catch'](handleError(_0x190deb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 41f12c0..3713836 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 _0xc900=['request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x2ef753,_0x44d150){var _0x1e2abd=function(_0x5d5c73){while(--_0x5d5c73){_0x2ef753['push'](_0x2ef753['shift']());}};_0x1e2abd(++_0x44d150);}(_0xc900,0xb3));var _0x0c90=function(_0x49fd0b,_0x574b40){_0x49fd0b=_0x49fd0b-0x0;var _0x315563=_0xc900[_0x49fd0b];return _0x315563;};'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')]('ZendeskField',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[{'name':_0x0c90('0xa'),'fields':[_0x0c90('0xb'),_0x0c90('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb0=['path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x567bf6,_0x1a0462){var _0x27c12d=function(_0x469669){while(--_0x469669){_0x567bf6['push'](_0x567bf6['shift']());}};_0x27c12d(++_0x1a0462);}(_0x2bb0,0xf3));var _0x02bb=function(_0x2ee0b7,_0x1fdca4){_0x2ee0b7=_0x2ee0b7-0x0;var _0x58de11=_0x2bb0[_0x2ee0b7];return _0x58de11;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));module[_0x02bb('0x7')]=function(_0x390ff7,_0x43dbb7){return _0x390ff7[_0x02bb('0x8')](_0x02bb('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x02bb('0xa'),'fields':[_0x02bb('0xb'),_0x02bb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 2e24551..6cc7fdb 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 _0xa090=['code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x167500,_0x5ef00f){var _0x285a1f=function(_0x1710c6){while(--_0x1710c6){_0x167500['push'](_0x167500['shift']());}};_0x285a1f(++_0x5ef00f);}(_0xa090,0xe1));var _0x0a09=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa090[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x0a09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a09('0x1'));var rs=require(_0x0a09('0x2'));var fs=require('fs');var Redis=require(_0x0a09('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0a09('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0a09('0x5')][_0x0a09('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x51f921,_0x453242,_0x1773b1){return new BPromise(function(_0x1dcbea,_0x564883){return client[_0x0a09('0x7')](_0x51f921,_0x1773b1)[_0x0a09('0x8')](function(_0x8272b2){logger['info'](_0x0a09('0x9'),_0x453242,_0x0a09('0xa'));logger[_0x0a09('0xb')](_0x0a09('0xc'),_0x453242,_0x0a09('0xa'),JSON[_0x0a09('0xd')](_0x8272b2));if(_0x8272b2[_0x0a09('0xe')]){if(_0x8272b2['error'][_0x0a09('0xf')]===0x1f4){logger[_0x0a09('0xe')](_0x0a09('0x9'),_0x453242,_0x8272b2[_0x0a09('0xe')][_0x0a09('0x10')]);return _0x564883(_0x8272b2[_0x0a09('0xe')]['message']);}logger[_0x0a09('0xe')](_0x0a09('0x9'),_0x453242,_0x8272b2['error'][_0x0a09('0x10')]);return _0x1dcbea(_0x8272b2['error'][_0x0a09('0x10')]);}else{logger[_0x0a09('0x11')](_0x0a09('0x9'),_0x453242,_0x0a09('0xa'));_0x1dcbea(_0x8272b2[_0x0a09('0x12')][_0x0a09('0x10')]);}})[_0x0a09('0x13')](function(_0x3c46e3){logger[_0x0a09('0xe')](_0x0a09('0x9'),_0x453242,_0x3c46e3);_0x564883(_0x3c46e3);});});} \ No newline at end of file +var _0xeda6=['util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x58f309,_0x4c9690){var _0x39eb6b=function(_0x3aa8df){while(--_0x3aa8df){_0x58f309['push'](_0x58f309['shift']());}};_0x39eb6b(++_0x4c9690);}(_0xeda6,0x121));var _0x6eda=function(_0x4497d4,_0x2c7c44){_0x4497d4=_0x4497d4-0x0;var _0x12b8ae=_0xeda6[_0x4497d4];return _0x12b8ae;};'use strict';var _=require('lodash');var util=require(_0x6eda('0x0'));var moment=require('moment');var BPromise=require(_0x6eda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eda('0x2'));var db=require(_0x6eda('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6eda('0x4'))('rpc');var config=require(_0x6eda('0x5'));var jayson=require(_0x6eda('0x6'));var client=jayson[_0x6eda('0x7')][_0x6eda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31eb5f,_0xafe967,_0x21c8ca){return new BPromise(function(_0x2afe92,_0xd9962b){return client['request'](_0x31eb5f,_0x21c8ca)[_0x6eda('0x9')](function(_0x10d1e5){logger[_0x6eda('0xa')](_0x6eda('0xb'),_0xafe967,_0x6eda('0xc'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0xafe967,_0x6eda('0xc'),JSON[_0x6eda('0xd')](_0x10d1e5));if(_0x10d1e5[_0x6eda('0xe')]){if(_0x10d1e5[_0x6eda('0xe')][_0x6eda('0xf')]===0x1f4){logger[_0x6eda('0xe')](_0x6eda('0xb'),_0xafe967,_0x10d1e5[_0x6eda('0xe')][_0x6eda('0x10')]);return _0xd9962b(_0x10d1e5[_0x6eda('0xe')][_0x6eda('0x10')]);}logger[_0x6eda('0xe')](_0x6eda('0xb'),_0xafe967,_0x10d1e5[_0x6eda('0xe')]['message']);return _0x2afe92(_0x10d1e5[_0x6eda('0xe')][_0x6eda('0x10')]);}else{logger[_0x6eda('0xa')](_0x6eda('0xb'),_0xafe967,_0x6eda('0xc'));_0x2afe92(_0x10d1e5['result'][_0x6eda('0x10')]);}})['catch'](function(_0xeb2bb8){logger[_0x6eda('0xe')]('ZendeskField,\x20%s,\x20%s',_0xafe967,_0xeb2bb8);_0xd9962b(_0xeb2bb8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ffe85ee..4247b8d 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 _0x02c4=['index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x02c4,0x1c5));var _0x402c=function(_0x3c130f,_0xf165df){_0x3c130f=_0x3c130f-0x0;var _0x483cd2=_0x02c4[_0x3c130f];return _0x483cd2;};'use strict';var multer=require(_0x402c('0x0'));var util=require(_0x402c('0x1'));var path=require('path');var timeout=require(_0x402c('0x2'));var express=require(_0x402c('0x3'));var router=express[_0x402c('0x4')]();var auth=require(_0x402c('0x5'));var interaction=require(_0x402c('0x6'));var config=require('../../config/environment');var controller=require(_0x402c('0x7'));router['get']('/',auth[_0x402c('0x8')](),controller[_0x402c('0x9')]);router[_0x402c('0xa')]('/:id',auth[_0x402c('0x8')](),controller[_0x402c('0xb')]);router['get'](_0x402c('0xc'),auth['isAuthenticated'](),controller[_0x402c('0xd')]);router[_0x402c('0xa')](_0x402c('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x402c('0xf')]('/',auth['isAuthenticated'](),controller[_0x402c('0x10')]);router[_0x402c('0xf')](_0x402c('0xc'),auth[_0x402c('0x8')](),controller[_0x402c('0x11')]);router[_0x402c('0x12')](_0x402c('0x13'),auth['isAuthenticated'](),controller[_0x402c('0x14')]);router['delete'](_0x402c('0x13'),auth[_0x402c('0x8')](),controller[_0x402c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1856=['show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','/:id'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x1856,0x17d));var _0x6185=function(_0x119ede,_0x3df360){_0x119ede=_0x119ede-0x0;var _0x1a5959=_0x1856[_0x119ede];return _0x1a5959;};'use strict';var multer=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var path=require(_0x6185('0x2'));var timeout=require(_0x6185('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6185('0x4'));var config=require(_0x6185('0x5'));var controller=require(_0x6185('0x6'));router['get']('/',auth[_0x6185('0x7')](),controller[_0x6185('0x8')]);router['get'](_0x6185('0x9'),auth[_0x6185('0x7')](),controller[_0x6185('0xa')]);router[_0x6185('0xb')](_0x6185('0xc'),auth[_0x6185('0x7')](),controller[_0x6185('0xd')]);router[_0x6185('0xb')](_0x6185('0xe'),auth[_0x6185('0x7')](),controller['getFields']);router[_0x6185('0xf')]('/',auth[_0x6185('0x7')](),controller[_0x6185('0x10')]);router[_0x6185('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6185('0x11')]);router[_0x6185('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6185('0x13')]);router[_0x6185('0x14')](_0x6185('0x9'),auth['isAuthenticated'](),controller[_0x6185('0x15')]);module[_0x6185('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index da7bbe9..95cd5f7 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 _0x056a=['STRING','sequelize'];(function(_0x3af8c2,_0x5ce9d2){var _0x58a4ce=function(_0xe3ad68){while(--_0xe3ad68){_0x3af8c2['push'](_0x3af8c2['shift']());}};_0x58a4ce(++_0x5ce9d2);}(_0x056a,0xbb));var _0xa056=function(_0x2acd6b,_0x49a61c){_0x2acd6b=_0x2acd6b-0x0;var _0x2f9d0b=_0x056a[_0x2acd6b];return _0x2f9d0b;};'use strict';var Sequelize=require(_0xa056('0x0'));module['exports']={'name':{'type':Sequelize[_0xa056('0x1')]},'description':{'type':Sequelize[_0xa056('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa056('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa056('0x1')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xa056('0x1')]}}; \ No newline at end of file +var _0x90bd=['sequelize','exports','STRING'];(function(_0x1adc0e,_0x4f38ff){var _0x23a973=function(_0xb989f){while(--_0xb989f){_0x1adc0e['push'](_0x1adc0e['shift']());}};_0x23a973(++_0x4f38ff);}(_0x90bd,0x12f));var _0xd90b=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x90bd[_0x1c34e7];return _0x378cb1;};'use strict';var Sequelize=require(_0xd90b('0x0'));module[_0xd90b('0x1')]={'name':{'type':Sequelize[_0xd90b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd90b('0x2')]},'zone':{'type':Sequelize[_0xd90b('0x2')]},'clientId':{'type':Sequelize[_0xd90b('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd90b('0x2')]},'code':{'type':Sequelize[_0xd90b('0x2')]},'refreshToken':{'type':Sequelize[_0xd90b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 646ddd7..ea84cf1 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 _0x7656=['update','destroy','then','stack','name','send','map','ZohoAccount','rawAttributes','type','key','keys','intersection','fields','query','attributes','nolimit','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','include','show','model','length','create','body','params','find','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x7656,0x1ea));var _0x6765=function(_0x290d75,_0x152928){_0x290d75=_0x290d75-0x0;var _0x59d968=_0x7656[_0x290d75];return _0x59d968;};'use strict';var pdf=require(_0x6765('0x0'));var emlformat=require(_0x6765('0x1'));var rimraf=require(_0x6765('0x2'));var zipdir=require(_0x6765('0x3'));var jsonpatch=require(_0x6765('0x4'));var rp=require('request-promise');var moment=require(_0x6765('0x5'));var BPromise=require(_0x6765('0x6'));var Mustache=require(_0x6765('0x7'));var util=require(_0x6765('0x8'));var path=require(_0x6765('0x9'));var sox=require('sox');var csv=require(_0x6765('0xa'));var ejs=require(_0x6765('0xb'));var fs=require('fs');var _=require(_0x6765('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6765('0xd'));var deskjs=require(_0x6765('0xe'));var toCsv=require(_0x6765('0xa'));var querystring=require(_0x6765('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6765('0x10'));var as=require(_0x6765('0x11'));var hardwareService=require(_0x6765('0x12'));var logger=require(_0x6765('0x13'))('api');var utils=require(_0x6765('0x14'));var config=require(_0x6765('0x15'));var db=require(_0x6765('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x6765('0x17'));var client=jayson[_0x6765('0x18')][_0x6765('0x19')]({'port':0x232a});function checkPasswordPattern(_0x63b191,_0x27ba04,_0xef9b2c){if(_0xef9b2c){var _0x561ab5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x561ab5[_0x6765('0x1a')](_0x27ba04)){return _0x63b191;}else{throw new db[(_0x6765('0x1b'))]['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 _0x63b191;}}function respondWithRpcPromise(_0x4829ca,_0x339424,_0x468da4,_0x3c8639){return new BPromise(function(_0x326cd4,_0xe55492){var _0x2b0b3b=_0x3c8639||client;return _0x2b0b3b[_0x6765('0x1c')](_0x4829ca,_0x468da4)['then'](function(_0x244199){logger[_0x6765('0x1d')](_0x6765('0x1e'),_0x339424,_0x6765('0x1f'));logger[_0x6765('0x20')](_0x6765('0x21'),_0x339424,_0x6765('0x1f'),JSON[_0x6765('0x22')](_0x244199));if(_0x244199[_0x6765('0x23')]){if(_0x244199[_0x6765('0x23')][_0x6765('0x24')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x339424,_0x244199[_0x6765('0x23')][_0x6765('0x25')]);return _0xe55492(_0x244199['error'][_0x6765('0x25')]);}logger[_0x6765('0x23')](_0x6765('0x1e'),_0x339424,_0x244199['error'][_0x6765('0x25')]);return _0x326cd4(_0x244199[_0x6765('0x23')]['message']);}else{logger[_0x6765('0x1d')](_0x6765('0x1e'),_0x339424,_0x6765('0x1f'));_0x326cd4(_0x244199[_0x6765('0x26')][_0x6765('0x25')]);}})[_0x6765('0x27')](function(_0x3ddccf){logger[_0x6765('0x23')](_0x6765('0x1e'),_0x339424,_0x3ddccf);_0xe55492(_0x3ddccf);});});}function respondWithStatusCode(_0xeb5a11,_0x43c5b7){_0x43c5b7=_0x43c5b7||0xcc;return function(_0x306840){if(_0x306840){return _0xeb5a11[_0x6765('0x28')](_0x43c5b7);}return _0xeb5a11[_0x6765('0x29')](_0x43c5b7)[_0x6765('0x2a')]();};}function respondWithResult(_0x1e14d2,_0x5653f6){_0x5653f6=_0x5653f6||0xc8;return function(_0x5c2d2b){if(_0x5c2d2b){return _0x1e14d2['status'](_0x5653f6)[_0x6765('0x2b')](_0x5c2d2b);}};}function respondWithFilteredResult(_0x5d131b,_0x30aff1){return function(_0x25c1ff){if(_0x25c1ff){var _0x53cfc4=_0x25c1ff['count'],_0x2559c3=_0x30aff1['offset'],_0x136d4a=_0x30aff1[_0x6765('0x2c')]+_0x30aff1[_0x6765('0x2d')],_0x206146;if(_0x136d4a>=_0x53cfc4){_0x136d4a=_0x53cfc4;_0x206146=0xc8;}else{_0x206146=0xce;}_0x5d131b[_0x6765('0x29')](_0x206146);return _0x5d131b['set'](_0x6765('0x2e'),_0x2559c3+'-'+_0x136d4a+'/'+_0x53cfc4)['json'](_0x25c1ff);}return null;};}function patchUpdates(_0x2bca24){return function(_0x2ea332){try{jsonpatch[_0x6765('0x2f')](_0x2ea332,_0x2bca24,!![]);}catch(_0x17be58){return BPromise[_0x6765('0x30')](_0x17be58);}return _0x2ea332[_0x6765('0x31')]();};}function saveUpdates(_0x369198,_0x542009){return function(_0x308c57){if(_0x308c57){return _0x308c57[_0x6765('0x32')](_0x369198)['then'](function(_0x5ac89c){return _0x5ac89c;});}return null;};}function removeEntity(_0x57ee22,_0x4c70bf){return function(_0x6549c8){if(_0x6549c8){return _0x6549c8[_0x6765('0x33')]()[_0x6765('0x34')](function(){_0x57ee22[_0x6765('0x29')](0xcc)[_0x6765('0x2a')]();});}};}function handleEntityNotFound(_0x5b1b32,_0x198ad1){return function(_0xeb5764){if(!_0xeb5764){_0x5b1b32[_0x6765('0x28')](0x194);}return _0xeb5764;};}function handleError(_0x4f0834,_0x271627){_0x271627=_0x271627||0x1f4;return function(_0x5356a5){logger['error'](_0x5356a5[_0x6765('0x35')]);if(_0x5356a5[_0x6765('0x36')]){delete _0x5356a5[_0x6765('0x36')];}_0x4f0834[_0x6765('0x29')](_0x271627)[_0x6765('0x37')](_0x5356a5);};}exports['index']=function(_0x41fe22,_0x140635){var _0x5db198={},_0x144cbd={},_0x1e9553={'count':0x0,'rows':[]};var _0x376329=_[_0x6765('0x38')](db[_0x6765('0x39')][_0x6765('0x3a')],function(_0x5b3140){return{'name':_0x5b3140['fieldName'],'type':_0x5b3140[_0x6765('0x3b')][_0x6765('0x3c')]};});_0x144cbd['model']=_['map'](_0x376329,_0x6765('0x36'));_0x144cbd['query']=_[_0x6765('0x3d')](_0x41fe22['query']);_0x144cbd['filters']=_[_0x6765('0x3e')](_0x144cbd['model'],_0x144cbd['query']);_0x5db198['attributes']=_[_0x6765('0x3e')](_0x144cbd['model'],qs[_0x6765('0x3f')](_0x41fe22[_0x6765('0x40')][_0x6765('0x3f')]));_0x5db198[_0x6765('0x41')]=_0x5db198[_0x6765('0x41')]['length']?_0x5db198[_0x6765('0x41')]:_0x144cbd['model'];if(!_0x41fe22[_0x6765('0x40')]['hasOwnProperty'](_0x6765('0x42'))){_0x5db198[_0x6765('0x2d')]=qs[_0x6765('0x2d')](_0x41fe22[_0x6765('0x40')][_0x6765('0x2d')]);_0x5db198[_0x6765('0x2c')]=qs[_0x6765('0x2c')](_0x41fe22[_0x6765('0x40')]['offset']);}_0x5db198['order']=qs[_0x6765('0x43')](_0x41fe22[_0x6765('0x40')][_0x6765('0x43')]);_0x5db198['where']=qs[_0x6765('0x44')](_['pick'](_0x41fe22[_0x6765('0x40')],_0x144cbd[_0x6765('0x44')]),_0x376329);if(_0x41fe22[_0x6765('0x40')][_0x6765('0x45')]){_0x5db198['where']=_[_0x6765('0x46')](_0x5db198[_0x6765('0x47')],{'$or':_[_0x6765('0x38')](_0x376329,function(_0x15a8cb){if(_0x15a8cb[_0x6765('0x3b')]!==_0x6765('0x48')){var _0x5a6eab={};_0x5a6eab[_0x15a8cb[_0x6765('0x36')]]={'$like':'%'+_0x41fe22[_0x6765('0x40')][_0x6765('0x45')]+'%'};return _0x5a6eab;}})});}_0x5db198=_[_0x6765('0x46')]({},_0x5db198,_0x41fe22[_0x6765('0x49')]);var _0x34ee48={'where':_0x5db198[_0x6765('0x47')]};return db[_0x6765('0x39')][_0x6765('0x4a')](_0x34ee48)[_0x6765('0x34')](function(_0x215e7a){_0x1e9553[_0x6765('0x4a')]=_0x215e7a;if(_0x41fe22[_0x6765('0x40')][_0x6765('0x4b')]){_0x5db198[_0x6765('0x4c')]=[{'all':!![]}];}return db[_0x6765('0x39')]['findAll'](_0x5db198);})[_0x6765('0x34')](function(_0x117af1){_0x1e9553['rows']=_0x117af1;return _0x1e9553;})[_0x6765('0x34')](respondWithFilteredResult(_0x140635,_0x5db198))[_0x6765('0x27')](handleError(_0x140635,null));};exports[_0x6765('0x4d')]=function(_0x126aad,_0x536b27){var _0x58ecca={'raw':![],'where':{'id':_0x126aad['params']['id']}},_0x45780c={};_0x45780c[_0x6765('0x4e')]=_['keys'](db[_0x6765('0x39')][_0x6765('0x3a')]);_0x45780c[_0x6765('0x40')]=_['keys'](_0x126aad[_0x6765('0x40')]);_0x45780c[_0x6765('0x44')]=_[_0x6765('0x3e')](_0x45780c[_0x6765('0x4e')],_0x45780c[_0x6765('0x40')]);_0x58ecca[_0x6765('0x41')]=_[_0x6765('0x3e')](_0x45780c[_0x6765('0x4e')],qs[_0x6765('0x3f')](_0x126aad[_0x6765('0x40')][_0x6765('0x3f')]));_0x58ecca[_0x6765('0x41')]=_0x58ecca[_0x6765('0x41')][_0x6765('0x4f')]?_0x58ecca['attributes']:_0x45780c['model'];if(_0x126aad[_0x6765('0x40')][_0x6765('0x4b')]){_0x58ecca[_0x6765('0x4c')]=[{'all':!![]}];}_0x58ecca=_['merge']({},_0x58ecca,_0x126aad[_0x6765('0x49')]);return db[_0x6765('0x39')]['find'](_0x58ecca)['then'](handleEntityNotFound(_0x536b27,null))[_0x6765('0x34')](respondWithResult(_0x536b27,null))[_0x6765('0x27')](handleError(_0x536b27,null));};exports[_0x6765('0x50')]=function(_0x1d9434,_0x4776c0){return db[_0x6765('0x39')][_0x6765('0x50')](_0x1d9434[_0x6765('0x51')],{})[_0x6765('0x34')](respondWithResult(_0x4776c0,0xc9))[_0x6765('0x27')](handleError(_0x4776c0,null));};exports[_0x6765('0x32')]=function(_0x1e82d0,_0x5cfcac){if(_0x1e82d0[_0x6765('0x51')]['id']){delete _0x1e82d0[_0x6765('0x51')]['id'];}return db[_0x6765('0x39')]['find']({'where':{'id':_0x1e82d0[_0x6765('0x52')]['id']}})['then'](handleEntityNotFound(_0x5cfcac,null))[_0x6765('0x34')](saveUpdates(_0x1e82d0[_0x6765('0x51')],null))[_0x6765('0x34')](respondWithResult(_0x5cfcac,null))['catch'](handleError(_0x5cfcac,null));};exports[_0x6765('0x33')]=function(_0xbc7864,_0x133f0b){return db[_0x6765('0x39')][_0x6765('0x53')]({'where':{'id':_0xbc7864[_0x6765('0x52')]['id']}})[_0x6765('0x34')](handleEntityNotFound(_0x133f0b,null))[_0x6765('0x34')](removeEntity(_0x133f0b,null))[_0x6765('0x27')](handleError(_0x133f0b,null));};exports[_0x6765('0x54')]=function(_0x5769a6,_0x41892d,_0x58ae9b){var _0x12cdc2={};var _0x338a2c={};var _0x2cee5c;var _0x32218a;return db[_0x6765('0x39')][_0x6765('0x55')]({'where':{'id':_0x5769a6[_0x6765('0x52')]['id']}})[_0x6765('0x34')](handleEntityNotFound(_0x41892d,null))[_0x6765('0x34')](function(_0x1870de){if(_0x1870de){_0x2cee5c=_0x1870de;_0x338a2c[_0x6765('0x4e')]=_[_0x6765('0x3d')](db['ZohoConfiguration'][_0x6765('0x3a')]);_0x338a2c[_0x6765('0x40')]=_[_0x6765('0x3d')](_0x5769a6[_0x6765('0x40')]);_0x338a2c[_0x6765('0x44')]=_['intersection'](_0x338a2c[_0x6765('0x4e')],_0x338a2c[_0x6765('0x40')]);_0x12cdc2[_0x6765('0x41')]=_[_0x6765('0x3e')](_0x338a2c[_0x6765('0x4e')],qs[_0x6765('0x3f')](_0x5769a6[_0x6765('0x40')][_0x6765('0x3f')]));_0x12cdc2[_0x6765('0x41')]=_0x12cdc2[_0x6765('0x41')][_0x6765('0x4f')]?_0x12cdc2['attributes']:_0x338a2c[_0x6765('0x4e')];_0x12cdc2[_0x6765('0x56')]=qs[_0x6765('0x43')](_0x5769a6[_0x6765('0x40')][_0x6765('0x43')]);_0x12cdc2[_0x6765('0x47')]=qs[_0x6765('0x44')](_['pick'](_0x5769a6[_0x6765('0x40')],_0x338a2c[_0x6765('0x44')]));if(_0x5769a6[_0x6765('0x40')]['filter']){_0x12cdc2[_0x6765('0x47')]=_[_0x6765('0x46')](_0x12cdc2[_0x6765('0x47')],{'$or':_[_0x6765('0x38')](_0x12cdc2[_0x6765('0x41')],function(_0x277b11){var _0x1d5259={};_0x1d5259[_0x277b11]={'$like':'%'+_0x5769a6['query'][_0x6765('0x45')]+'%'};return _0x1d5259;})});}_0x12cdc2=_[_0x6765('0x46')]({},_0x12cdc2,_0x5769a6['options']);return _0x2cee5c[_0x6765('0x54')](_0x12cdc2);}})['then'](function(_0x2003c7){if(_0x2003c7){_0x32218a=_0x2003c7[_0x6765('0x4f')];if(!_0x5769a6['query'][_0x6765('0x57')](_0x6765('0x42'))){_0x12cdc2[_0x6765('0x2d')]=qs[_0x6765('0x2d')](_0x5769a6[_0x6765('0x40')][_0x6765('0x2d')]);_0x12cdc2[_0x6765('0x2c')]=qs[_0x6765('0x2c')](_0x5769a6[_0x6765('0x40')][_0x6765('0x2c')]);}return _0x2cee5c[_0x6765('0x54')](_0x12cdc2);}})[_0x6765('0x34')](function(_0x2234eb){if(_0x2234eb){return _0x2234eb?{'count':_0x32218a,'rows':_0x2234eb}:null;}})[_0x6765('0x34')](respondWithResult(_0x41892d,null))[_0x6765('0x27')](handleError(_0x41892d,null));};exports[_0x6765('0x58')]=function(_0x328cd0,_0x495d3a,_0x2d6643){if(_0x328cd0[_0x6765('0x51')]['id']){delete _0x328cd0[_0x6765('0x51')]['id'];}return db[_0x6765('0x39')][_0x6765('0x55')]({'where':{'id':_0x328cd0[_0x6765('0x52')]['id']}})[_0x6765('0x34')](handleEntityNotFound(_0x495d3a,null))[_0x6765('0x34')](function(_0x34c228){if(_0x34c228){_0x328cd0['body'][_0x6765('0x59')]=_0x34c228['id'];_0x328cd0['body'][_0x6765('0x5a')]=integrations[_0x6765('0x5b')](_0x328cd0[_0x6765('0x51')][_0x6765('0x5c')],_0x328cd0[_0x6765('0x51')]['type']);_0x328cd0['body'][_0x6765('0x5d')]=integrations[_0x6765('0x5e')](_0x328cd0['body'][_0x6765('0x5c')],_0x328cd0[_0x6765('0x51')]['type']);return db['ZohoConfiguration']['create'](_0x328cd0[_0x6765('0x51')],{'include':[{'model':db['ZohoField'],'as':_0x6765('0x5a')},{'model':db[_0x6765('0x5f')],'as':_0x6765('0x5d')}]});}return null;})[_0x6765('0x34')](respondWithResult(_0x495d3a,null))['catch'](handleError(_0x495d3a,null));};function getAccessToken(_0x307ef1){return new Promise(function(_0x4a15dd,_0x7217e0){var _0x40a332;switch(_0x307ef1[_0x6765('0x60')]){case'US':_0x40a332=_0x6765('0x61');break;case'AU':_0x40a332='https://accounts.zoho.com.au';break;case'EU':_0x40a332=_0x6765('0x62');break;case'IN':_0x40a332='https://accounts.zoho.in';break;case'CN':_0x40a332=_0x6765('0x63');break;default:_0x40a332='https://accounts.zoho.eu';break;}var _0x102664={'method':_0x6765('0x64'),'uri':_0x40a332+'/oauth/v2/token','qs':{'refresh_token':_0x307ef1['refreshToken'],'client_id':_0x307ef1[_0x6765('0x65')],'client_secret':_0x307ef1[_0x6765('0x66')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x102664)['then'](function(_0x4cf970){if(_0x4cf970[_0x6765('0x67')]){_0x4a15dd(_0x4cf970[_0x6765('0x67')]);}else{_0x7217e0(_0x6765('0x68'));}})['catch'](function(_0x2a59f1){_0x7217e0(_0x2a59f1);});});}exports[_0x6765('0x69')]=function(_0x55a21b,_0x2962d9,_0x5a7e5c){var _0x251a72,_0x748e70,_0x5b6023,_0x1da4dc,_0x218505;return db[_0x6765('0x39')][_0x6765('0x55')]({'where':{'id':_0x55a21b[_0x6765('0x52')]['id']},'attributes':['id','host',_0x6765('0x60'),'clientId','clientSecret','serverUrl',_0x6765('0x24'),'refreshToken']})[_0x6765('0x34')](handleEntityNotFound(_0x2962d9,null))[_0x6765('0x34')](function(_0xf87036){_0x218505=_0xf87036;_0x251a72=_0x218505[_0x6765('0x6a')];_0x748e70=_0x251a72===_0x6765('0x6b')?'eu':_0x6765('0x6c');_0x5b6023=_0x218505['serverUrl'];var _0x147c4f=_0x5b6023[_0x6765('0x6d')](-0x1);if(_0x147c4f==='/'||_0x147c4f==='\x5c'||_0x147c4f===':'){_0x5b6023=_0x5b6023['substring'](0x0,_0x5b6023[_0x6765('0x6e')](_0x147c4f));}if(!_0x218505['refreshToken']){throw new Error(_0x6765('0x6f'));}return getAccessToken(_0x218505);})[_0x6765('0x34')](function(_0x395285){if(_0x395285){return rp({'method':_0x6765('0x70'),'uri':util[_0x6765('0x71')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x748e70),'qs':{'module':_0x6765('0x72')},'headers':{'Authorization':_0x6765('0x73')+_0x395285},'json':!![]});}})[_0x6765('0x34')](function(_0x372926){if(_0x372926){if(_0x372926[_0x6765('0x74')]&&_0x372926[_0x6765('0x74')]['error']){throw new Error(_0x372926[_0x6765('0x74')][_0x6765('0x23')][_0x6765('0x25')]);}var _0x412eef=[];var _0x3a90b3=[];var _0x1ae1c6=[_0x6765('0x75'),_0x6765('0x76'),_0x6765('0x77'),_0x6765('0x78'),_0x6765('0x79'),'Call_Result',_0x6765('0x7a'),_0x6765('0x7b')];_0x3a90b3=_['remove'](_0x372926[_0x6765('0x3f')],function(_0x34d3f8){return _0x1ae1c6[_0x6765('0x7c')](_0x34d3f8[_0x6765('0x7d')]);});for(var _0x114b42=0x0;_0x114b42<_0x3a90b3['length'];_0x114b42++){if(_0x3a90b3[_0x114b42][_0x6765('0x7e')]===![]){_0x412eef[_0x6765('0x7f')]({'id':_0x3a90b3[_0x114b42]['id'],'name':_0x3a90b3[_0x114b42][_0x6765('0x80')],'custom':_0x3a90b3[_0x114b42][_0x6765('0x81')],'options':_0x3a90b3[_0x114b42][_0x6765('0x82')]==='picklist'&&_0x3a90b3[_0x114b42]['pick_list_values'][_0x6765('0x4f')]>-0x1?_[_0x6765('0x38')](_0x3a90b3[_0x114b42][_0x6765('0x83')],function(_0x21f763){return{'name':_0x21f763,'value':_0x21f763};}):[]});}}return{'count':_0x412eef[_0x6765('0x4f')],'rows':_0x412eef};}else{return{'count':0x0,'rows':[]};}})[_0x6765('0x34')](respondWithResult(_0x2962d9,null))['catch'](function(_0x2f5b47){var _0x4b0af8=_0x55a21b[_0x6765('0x40')]['test']?0x1f4:_0x2f5b47[_0x6765('0x84')]||0x1f4;logger[_0x6765('0x23')](_0x6765('0x85'),_0x6765('0x69'),_0x4b0af8,JSON[_0x6765('0x22')](_0x2f5b47));delete _0x2f5b47['name'];if(_0x4b0af8===0x191){_0x4b0af8=0x190;}_0x2962d9['status'](_0x4b0af8)['send'](_0x55a21b['query']['test']?{'message':_0x6765('0x86'),'statusCode':_0x2f5b47['statusCode']}:_0x2f5b47);});}; \ No newline at end of file +var _0xc67b=['find','create','body','update','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','slice','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','type','options','ZohoAccount','includeAll','findAll','rows','params','include'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc67b,0x149));var _0xbc67=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc67b[_0x126558];return _0x1f6d14;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbc67('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc67('0x1'));var rp=require('request-promise');var moment=require(_0xbc67('0x2'));var BPromise=require(_0xbc67('0x3'));var Mustache=require('mustache');var util=require(_0xbc67('0x4'));var path=require(_0xbc67('0x5'));var sox=require(_0xbc67('0x6'));var csv=require(_0xbc67('0x7'));var ejs=require(_0xbc67('0x8'));var fs=require('fs');var _=require(_0xbc67('0x9'));var squel=require(_0xbc67('0xa'));var crypto=require('crypto');var jsforce=require(_0xbc67('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbc67('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbc67('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbc67('0xd'));var as=require(_0xbc67('0xe'));var hardwareService=require(_0xbc67('0xf'));var logger=require('../../config/logger')(_0xbc67('0x10'));var utils=require(_0xbc67('0x11'));var config=require(_0xbc67('0x12'));var db=require(_0xbc67('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xbc67('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x1c0c5c,_0x24b0c1,_0x30c5dd){if(_0x30c5dd){var _0x1574c1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1574c1[_0xbc67('0x15')](_0x24b0c1)){return _0x1c0c5c;}else{throw new db[(_0xbc67('0x16'))][(_0xbc67('0x17'))]('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 _0x1c0c5c;}}function respondWithRpcPromise(_0x3eecc0,_0x1188ad,_0xfeee06,_0x470d80){return new BPromise(function(_0x3bb700,_0x22cba6){var _0x415c98=_0x470d80||client;return _0x415c98[_0xbc67('0x18')](_0x3eecc0,_0xfeee06)['then'](function(_0x4b5bd3){logger[_0xbc67('0x19')](_0xbc67('0x1a'),_0x1188ad,_0xbc67('0x1b'));logger[_0xbc67('0x1c')](_0xbc67('0x1d'),_0x1188ad,'request\x20sent',JSON['stringify'](_0x4b5bd3));if(_0x4b5bd3[_0xbc67('0x1e')]){if(_0x4b5bd3['error']['code']===0x1f4){logger[_0xbc67('0x1e')](_0xbc67('0x1a'),_0x1188ad,_0x4b5bd3[_0xbc67('0x1e')][_0xbc67('0x1f')]);return _0x22cba6(_0x4b5bd3['error'][_0xbc67('0x1f')]);}logger['error'](_0xbc67('0x1a'),_0x1188ad,_0x4b5bd3['error'][_0xbc67('0x1f')]);return _0x3bb700(_0x4b5bd3[_0xbc67('0x1e')][_0xbc67('0x1f')]);}else{logger[_0xbc67('0x19')](_0xbc67('0x1a'),_0x1188ad,_0xbc67('0x1b'));_0x3bb700(_0x4b5bd3[_0xbc67('0x20')][_0xbc67('0x1f')]);}})[_0xbc67('0x21')](function(_0x27efa2){logger[_0xbc67('0x1e')](_0xbc67('0x1a'),_0x1188ad,_0x27efa2);_0x22cba6(_0x27efa2);});});}function respondWithStatusCode(_0xd6462a,_0x37f9b9){_0x37f9b9=_0x37f9b9||0xcc;return function(_0xcf858e){if(_0xcf858e){return _0xd6462a[_0xbc67('0x22')](_0x37f9b9);}return _0xd6462a[_0xbc67('0x23')](_0x37f9b9)[_0xbc67('0x24')]();};}function respondWithResult(_0x2617ae,_0x55e751){_0x55e751=_0x55e751||0xc8;return function(_0x218c4c){if(_0x218c4c){return _0x2617ae[_0xbc67('0x23')](_0x55e751)[_0xbc67('0x25')](_0x218c4c);}};}function respondWithFilteredResult(_0x1d0e16,_0x3bbfcb){return function(_0xbb685f){if(_0xbb685f){var _0x24a1d1=_0xbb685f[_0xbc67('0x26')],_0x405a9b=_0x3bbfcb[_0xbc67('0x27')],_0x23728e=_0x3bbfcb[_0xbc67('0x27')]+_0x3bbfcb['limit'],_0x4bc2c2;if(_0x23728e>=_0x24a1d1){_0x23728e=_0x24a1d1;_0x4bc2c2=0xc8;}else{_0x4bc2c2=0xce;}_0x1d0e16[_0xbc67('0x23')](_0x4bc2c2);return _0x1d0e16['set'](_0xbc67('0x28'),_0x405a9b+'-'+_0x23728e+'/'+_0x24a1d1)[_0xbc67('0x25')](_0xbb685f);}return null;};}function patchUpdates(_0x5984b5){return function(_0x2e42a2){try{jsonpatch['apply'](_0x2e42a2,_0x5984b5,!![]);}catch(_0x5e9a37){return BPromise[_0xbc67('0x29')](_0x5e9a37);}return _0x2e42a2[_0xbc67('0x2a')]();};}function saveUpdates(_0x228153,_0x225001){return function(_0x2d0429){if(_0x2d0429){return _0x2d0429['update'](_0x228153)['then'](function(_0x10c617){return _0x10c617;});}return null;};}function removeEntity(_0x100a3c,_0x2976e2){return function(_0x55c255){if(_0x55c255){return _0x55c255[_0xbc67('0x2b')]()[_0xbc67('0x2c')](function(){_0x100a3c[_0xbc67('0x23')](0xcc)[_0xbc67('0x24')]();});}};}function handleEntityNotFound(_0x444407,_0x7fccf4){return function(_0x2e4af5){if(!_0x2e4af5){_0x444407[_0xbc67('0x22')](0x194);}return _0x2e4af5;};}function handleError(_0x51fd73,_0x139644){_0x139644=_0x139644||0x1f4;return function(_0x422d07){logger[_0xbc67('0x1e')](_0x422d07[_0xbc67('0x2d')]);if(_0x422d07[_0xbc67('0x2e')]){delete _0x422d07[_0xbc67('0x2e')];}_0x51fd73[_0xbc67('0x23')](_0x139644)[_0xbc67('0x2f')](_0x422d07);};}exports[_0xbc67('0x30')]=function(_0x314538,_0x4332b8){var _0x398eb9={},_0x4e2d91={},_0x4d11b7={'count':0x0,'rows':[]};var _0x364671=_[_0xbc67('0x31')](db['ZohoAccount'][_0xbc67('0x32')],function(_0x208b87){return{'name':_0x208b87[_0xbc67('0x33')],'type':_0x208b87['type'][_0xbc67('0x34')]};});_0x4e2d91[_0xbc67('0x35')]=_[_0xbc67('0x31')](_0x364671,_0xbc67('0x2e'));_0x4e2d91[_0xbc67('0x36')]=_[_0xbc67('0x37')](_0x314538[_0xbc67('0x36')]);_0x4e2d91[_0xbc67('0x38')]=_[_0xbc67('0x39')](_0x4e2d91[_0xbc67('0x35')],_0x4e2d91['query']);_0x398eb9[_0xbc67('0x3a')]=_[_0xbc67('0x39')](_0x4e2d91[_0xbc67('0x35')],qs[_0xbc67('0x3b')](_0x314538[_0xbc67('0x36')][_0xbc67('0x3b')]));_0x398eb9[_0xbc67('0x3a')]=_0x398eb9['attributes'][_0xbc67('0x3c')]?_0x398eb9[_0xbc67('0x3a')]:_0x4e2d91[_0xbc67('0x35')];if(!_0x314538[_0xbc67('0x36')]['hasOwnProperty'](_0xbc67('0x3d'))){_0x398eb9[_0xbc67('0x3e')]=qs['limit'](_0x314538[_0xbc67('0x36')][_0xbc67('0x3e')]);_0x398eb9[_0xbc67('0x27')]=qs[_0xbc67('0x27')](_0x314538[_0xbc67('0x36')][_0xbc67('0x27')]);}_0x398eb9[_0xbc67('0x3f')]=qs[_0xbc67('0x40')](_0x314538[_0xbc67('0x36')][_0xbc67('0x40')]);_0x398eb9[_0xbc67('0x41')]=qs[_0xbc67('0x38')](_['pick'](_0x314538[_0xbc67('0x36')],_0x4e2d91[_0xbc67('0x38')]),_0x364671);if(_0x314538[_0xbc67('0x36')][_0xbc67('0x42')]){_0x398eb9[_0xbc67('0x41')]=_[_0xbc67('0x43')](_0x398eb9[_0xbc67('0x41')],{'$or':_[_0xbc67('0x31')](_0x364671,function(_0x36d49b){if(_0x36d49b[_0xbc67('0x44')]!=='VIRTUAL'){var _0x3a89a4={};_0x3a89a4[_0x36d49b['name']]={'$like':'%'+_0x314538[_0xbc67('0x36')][_0xbc67('0x42')]+'%'};return _0x3a89a4;}})});}_0x398eb9=_[_0xbc67('0x43')]({},_0x398eb9,_0x314538[_0xbc67('0x45')]);var _0x24f438={'where':_0x398eb9['where']};return db[_0xbc67('0x46')][_0xbc67('0x26')](_0x24f438)[_0xbc67('0x2c')](function(_0x59bbb2){_0x4d11b7[_0xbc67('0x26')]=_0x59bbb2;if(_0x314538['query'][_0xbc67('0x47')]){_0x398eb9['include']=[{'all':!![]}];}return db[_0xbc67('0x46')][_0xbc67('0x48')](_0x398eb9);})[_0xbc67('0x2c')](function(_0x3a5492){_0x4d11b7[_0xbc67('0x49')]=_0x3a5492;return _0x4d11b7;})[_0xbc67('0x2c')](respondWithFilteredResult(_0x4332b8,_0x398eb9))[_0xbc67('0x21')](handleError(_0x4332b8,null));};exports['show']=function(_0x4569be,_0x17838e){var _0x4825f6={'raw':![],'where':{'id':_0x4569be[_0xbc67('0x4a')]['id']}},_0x518238={};_0x518238['model']=_[_0xbc67('0x37')](db[_0xbc67('0x46')][_0xbc67('0x32')]);_0x518238[_0xbc67('0x36')]=_[_0xbc67('0x37')](_0x4569be[_0xbc67('0x36')]);_0x518238[_0xbc67('0x38')]=_['intersection'](_0x518238[_0xbc67('0x35')],_0x518238[_0xbc67('0x36')]);_0x4825f6[_0xbc67('0x3a')]=_[_0xbc67('0x39')](_0x518238[_0xbc67('0x35')],qs['fields'](_0x4569be[_0xbc67('0x36')][_0xbc67('0x3b')]));_0x4825f6['attributes']=_0x4825f6[_0xbc67('0x3a')][_0xbc67('0x3c')]?_0x4825f6['attributes']:_0x518238[_0xbc67('0x35')];if(_0x4569be['query'][_0xbc67('0x47')]){_0x4825f6[_0xbc67('0x4b')]=[{'all':!![]}];}_0x4825f6=_[_0xbc67('0x43')]({},_0x4825f6,_0x4569be['options']);return db['ZohoAccount'][_0xbc67('0x4c')](_0x4825f6)['then'](handleEntityNotFound(_0x17838e,null))['then'](respondWithResult(_0x17838e,null))[_0xbc67('0x21')](handleError(_0x17838e,null));};exports[_0xbc67('0x4d')]=function(_0x58bc12,_0x4912fd){return db[_0xbc67('0x46')][_0xbc67('0x4d')](_0x58bc12[_0xbc67('0x4e')],{})[_0xbc67('0x2c')](respondWithResult(_0x4912fd,0xc9))[_0xbc67('0x21')](handleError(_0x4912fd,null));};exports[_0xbc67('0x4f')]=function(_0x102aca,_0x39a891){if(_0x102aca[_0xbc67('0x4e')]['id']){delete _0x102aca['body']['id'];}return db[_0xbc67('0x46')]['find']({'where':{'id':_0x102aca[_0xbc67('0x4a')]['id']}})[_0xbc67('0x2c')](handleEntityNotFound(_0x39a891,null))[_0xbc67('0x2c')](saveUpdates(_0x102aca[_0xbc67('0x4e')],null))[_0xbc67('0x2c')](respondWithResult(_0x39a891,null))[_0xbc67('0x21')](handleError(_0x39a891,null));};exports[_0xbc67('0x2b')]=function(_0x1f5970,_0x2ccfff){return db[_0xbc67('0x46')][_0xbc67('0x4c')]({'where':{'id':_0x1f5970[_0xbc67('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ccfff,null))['then'](removeEntity(_0x2ccfff,null))[_0xbc67('0x21')](handleError(_0x2ccfff,null));};exports[_0xbc67('0x50')]=function(_0x349b54,_0x3abace,_0x30d36f){var _0x16a691={};var _0x10ca30={};var _0x5c355d;var _0x4900d8;return db[_0xbc67('0x46')][_0xbc67('0x51')]({'where':{'id':_0x349b54['params']['id']}})[_0xbc67('0x2c')](handleEntityNotFound(_0x3abace,null))[_0xbc67('0x2c')](function(_0xfd963){if(_0xfd963){_0x5c355d=_0xfd963;_0x10ca30[_0xbc67('0x35')]=_['keys'](db[_0xbc67('0x52')]['rawAttributes']);_0x10ca30[_0xbc67('0x36')]=_[_0xbc67('0x37')](_0x349b54[_0xbc67('0x36')]);_0x10ca30[_0xbc67('0x38')]=_[_0xbc67('0x39')](_0x10ca30[_0xbc67('0x35')],_0x10ca30[_0xbc67('0x36')]);_0x16a691[_0xbc67('0x3a')]=_[_0xbc67('0x39')](_0x10ca30[_0xbc67('0x35')],qs[_0xbc67('0x3b')](_0x349b54[_0xbc67('0x36')][_0xbc67('0x3b')]));_0x16a691[_0xbc67('0x3a')]=_0x16a691[_0xbc67('0x3a')][_0xbc67('0x3c')]?_0x16a691[_0xbc67('0x3a')]:_0x10ca30[_0xbc67('0x35')];_0x16a691['order']=qs[_0xbc67('0x40')](_0x349b54[_0xbc67('0x36')]['sort']);_0x16a691['where']=qs[_0xbc67('0x38')](_['pick'](_0x349b54[_0xbc67('0x36')],_0x10ca30[_0xbc67('0x38')]));if(_0x349b54[_0xbc67('0x36')][_0xbc67('0x42')]){_0x16a691[_0xbc67('0x41')]=_[_0xbc67('0x43')](_0x16a691['where'],{'$or':_[_0xbc67('0x31')](_0x16a691['attributes'],function(_0x5f3d66){var _0x5f204d={};_0x5f204d[_0x5f3d66]={'$like':'%'+_0x349b54[_0xbc67('0x36')]['filter']+'%'};return _0x5f204d;})});}_0x16a691=_[_0xbc67('0x43')]({},_0x16a691,_0x349b54[_0xbc67('0x45')]);return _0x5c355d[_0xbc67('0x50')](_0x16a691);}})['then'](function(_0x5d3102){if(_0x5d3102){_0x4900d8=_0x5d3102[_0xbc67('0x3c')];if(!_0x349b54['query'][_0xbc67('0x53')](_0xbc67('0x3d'))){_0x16a691[_0xbc67('0x3e')]=qs[_0xbc67('0x3e')](_0x349b54[_0xbc67('0x36')][_0xbc67('0x3e')]);_0x16a691[_0xbc67('0x27')]=qs[_0xbc67('0x27')](_0x349b54[_0xbc67('0x36')][_0xbc67('0x27')]);}return _0x5c355d[_0xbc67('0x50')](_0x16a691);}})[_0xbc67('0x2c')](function(_0x447be8){if(_0x447be8){return _0x447be8?{'count':_0x4900d8,'rows':_0x447be8}:null;}})[_0xbc67('0x2c')](respondWithResult(_0x3abace,null))['catch'](handleError(_0x3abace,null));};exports[_0xbc67('0x54')]=function(_0x1ed79b,_0xb7ce10,_0x4bee7d){if(_0x1ed79b['body']['id']){delete _0x1ed79b['body']['id'];}return db[_0xbc67('0x46')]['findOne']({'where':{'id':_0x1ed79b[_0xbc67('0x4a')]['id']}})[_0xbc67('0x2c')](handleEntityNotFound(_0xb7ce10,null))[_0xbc67('0x2c')](function(_0x2928bb){if(_0x2928bb){_0x1ed79b['body'][_0xbc67('0x55')]=_0x2928bb['id'];_0x1ed79b[_0xbc67('0x4e')][_0xbc67('0x56')]=integrations[_0xbc67('0x57')](_0x1ed79b['body'][_0xbc67('0x58')],_0x1ed79b['body'][_0xbc67('0x44')]);_0x1ed79b[_0xbc67('0x4e')][_0xbc67('0x59')]=integrations[_0xbc67('0x5a')](_0x1ed79b[_0xbc67('0x4e')][_0xbc67('0x58')],_0x1ed79b[_0xbc67('0x4e')][_0xbc67('0x44')]);return db['ZohoConfiguration'][_0xbc67('0x4d')](_0x1ed79b[_0xbc67('0x4e')],{'include':[{'model':db[_0xbc67('0x5b')],'as':'Subjects'},{'model':db[_0xbc67('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xb7ce10,null))['catch'](handleError(_0xb7ce10,null));};function getAccessToken(_0x52ca3f){return new Promise(function(_0x2d9e8e,_0x1b46e4){var _0x5bf4b0;switch(_0x52ca3f[_0xbc67('0x5c')]){case'US':_0x5bf4b0=_0xbc67('0x5d');break;case'AU':_0x5bf4b0=_0xbc67('0x5e');break;case'EU':_0x5bf4b0=_0xbc67('0x5f');break;case'IN':_0x5bf4b0=_0xbc67('0x60');break;case'CN':_0x5bf4b0=_0xbc67('0x61');break;default:_0x5bf4b0=_0xbc67('0x5f');break;}var _0x65692={'method':_0xbc67('0x62'),'uri':_0x5bf4b0+'/oauth/v2/token','qs':{'refresh_token':_0x52ca3f['refreshToken'],'client_id':_0x52ca3f[_0xbc67('0x63')],'client_secret':_0x52ca3f[_0xbc67('0x64')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x65692)[_0xbc67('0x2c')](function(_0x511934){if(_0x511934['access_token']){_0x2d9e8e(_0x511934[_0xbc67('0x65')]);}else{_0x1b46e4(_0xbc67('0x66'));}})['catch'](function(_0x6c3c26){_0x1b46e4(_0x6c3c26);});});}exports[_0xbc67('0x67')]=function(_0x1c2d70,_0x11be6f,_0x1155a3){var _0x19fbb3,_0x22450a,_0x22eab7,_0x23605a,_0x2c9b35;return db[_0xbc67('0x46')][_0xbc67('0x51')]({'where':{'id':_0x1c2d70[_0xbc67('0x4a')]['id']},'attributes':['id',_0xbc67('0x68'),_0xbc67('0x5c'),'clientId','clientSecret',_0xbc67('0x69'),'code','refreshToken']})['then'](handleEntityNotFound(_0x11be6f,null))['then'](function(_0x446099){_0x2c9b35=_0x446099;_0x19fbb3=_0x2c9b35[_0xbc67('0x68')];_0x22450a=_0x19fbb3===_0xbc67('0x6a')?'eu':'com';_0x22eab7=_0x2c9b35['serverUrl'];var _0x45dfd0=_0x22eab7[_0xbc67('0x6b')](-0x1);if(_0x45dfd0==='/'||_0x45dfd0==='\x5c'||_0x45dfd0===':'){_0x22eab7=_0x22eab7['substring'](0x0,_0x22eab7[_0xbc67('0x6c')](_0x45dfd0));}if(!_0x2c9b35[_0xbc67('0x6d')]){throw new Error(_0xbc67('0x6e'));}return getAccessToken(_0x2c9b35);})['then'](function(_0x57f697){if(_0x57f697){return rp({'method':_0xbc67('0x6f'),'uri':util[_0xbc67('0x70')](_0xbc67('0x71'),_0x22450a),'qs':{'module':_0xbc67('0x72')},'headers':{'Authorization':_0xbc67('0x73')+_0x57f697},'json':!![]});}})[_0xbc67('0x2c')](function(_0x2daefd){if(_0x2daefd){if(_0x2daefd[_0xbc67('0x74')]&&_0x2daefd[_0xbc67('0x74')][_0xbc67('0x1e')]){throw new Error(_0x2daefd[_0xbc67('0x74')][_0xbc67('0x1e')][_0xbc67('0x1f')]);}var _0x454a8e=[];var _0x39f2d9=[];var _0x552e33=[_0xbc67('0x75'),_0xbc67('0x76'),_0xbc67('0x77'),_0xbc67('0x78'),_0xbc67('0x79'),'Call_Result',_0xbc67('0x7a'),_0xbc67('0x7b')];_0x39f2d9=_[_0xbc67('0x7c')](_0x2daefd[_0xbc67('0x3b')],function(_0x27ff59){return _0x552e33[_0xbc67('0x7d')](_0x27ff59[_0xbc67('0x7e')]);});for(var _0x2765a5=0x0;_0x2765a5<_0x39f2d9[_0xbc67('0x3c')];_0x2765a5++){if(_0x39f2d9[_0x2765a5][_0xbc67('0x7f')]===![]){_0x454a8e['push']({'id':_0x39f2d9[_0x2765a5]['id'],'name':_0x39f2d9[_0x2765a5]['display_label'],'custom':_0x39f2d9[_0x2765a5][_0xbc67('0x80')],'options':_0x39f2d9[_0x2765a5][_0xbc67('0x81')]==='picklist'&&_0x39f2d9[_0x2765a5][_0xbc67('0x82')]['length']>-0x1?_[_0xbc67('0x31')](_0x39f2d9[_0x2765a5][_0xbc67('0x82')],function(_0x5632cd){return{'name':_0x5632cd,'value':_0x5632cd};}):[]});}}return{'count':_0x454a8e[_0xbc67('0x3c')],'rows':_0x454a8e};}else{return{'count':0x0,'rows':[]};}})[_0xbc67('0x2c')](respondWithResult(_0x11be6f,null))[_0xbc67('0x21')](function(_0x4e2ed2){var _0xf9d6e0=_0x1c2d70[_0xbc67('0x36')][_0xbc67('0x15')]?0x1f4:_0x4e2ed2[_0xbc67('0x83')]||0x1f4;logger[_0xbc67('0x1e')](_0xbc67('0x84'),_0xbc67('0x67'),_0xf9d6e0,JSON[_0xbc67('0x85')](_0x4e2ed2));delete _0x4e2ed2[_0xbc67('0x2e')];if(_0xf9d6e0===0x191){_0xf9d6e0=0x190;}_0x11be6f[_0xbc67('0x23')](_0xf9d6e0)[_0xbc67('0x2f')](_0x1c2d70[_0xbc67('0x36')][_0xbc67('0x15')]?{'message':_0xbc67('0x86'),'statusCode':_0x4e2ed2[_0xbc67('0x83')]}:_0x4e2ed2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0388225..e37f73d 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 _0xbc4c=['https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','lastIndexOf','https://accounts.zoho.com.cn','/oauth/v2/token','then','parse','inspect','util','../../config/logger','api','bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x1de6f2,_0x58131f){var _0x362653=function(_0x6b0231){while(--_0x6b0231){_0x1de6f2['push'](_0x1de6f2['shift']());}};_0x362653(++_0x58131f);}(_0xbc4c,0xfc));var _0xcbc4=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xbc4c[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require('lodash');var util=require(_0xcbc4('0x0'));var logger=require(_0xcbc4('0x1'))(_0xcbc4('0x2'));var moment=require('moment');var BPromise=require(_0xcbc4('0x3'));var rp=require(_0xcbc4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbc4('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc4('0x6'));var integrations=require(_0xcbc4('0x7'));module[_0xcbc4('0x8')]=function(_0x3b9021,_0x421579){return _0x3b9021['define'](_0xcbc4('0x9'),attributes,{'tableName':_0xcbc4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d801d,_0x1dcbba,_0x14b179){if(_0x1d801d[_0xcbc4('0xb')](_0xcbc4('0xc'))||_0x1d801d[_0xcbc4('0xb')](_0xcbc4('0xd'))||_0x1d801d[_0xcbc4('0xb')](_0xcbc4('0xe'))||_0x1d801d[_0xcbc4('0xb')](_0xcbc4('0xf'))||_0x1d801d['changed'](_0xcbc4('0x10'))||_0x1d801d[_0xcbc4('0xb')]('host')){var _0x51f6b8,_0x7362a8;_0x51f6b8=_0x1d801d[_0xcbc4('0xd')];var _0x4ed4bf=_0x51f6b8['slice'](-0x1);if(_0x4ed4bf==='/'||_0x4ed4bf==='\x5c'||_0x4ed4bf===':'){_0x51f6b8=_0x51f6b8[_0xcbc4('0x11')](0x0,_0x51f6b8['lastIndexOf'](_0x4ed4bf));}switch(_0x1d801d[_0xcbc4('0xc')]){case'US':_0x7362a8=_0xcbc4('0x12');break;case'AU':_0x7362a8=_0xcbc4('0x13');break;case'IN':_0x7362a8=_0xcbc4('0x14');break;case'CN':_0x7362a8='https://accounts.zoho.com.cn';break;default:_0x7362a8=_0xcbc4('0x15');break;}var _0x347469={'method':_0xcbc4('0x16'),'uri':_0x7362a8+'/oauth/v2/token','form':{'grant_type':_0xcbc4('0x17'),'client_id':_0x1d801d[_0xcbc4('0xe')],'client_secret':_0x1d801d[_0xcbc4('0xf')],'redirect_uri':_0x1d801d[_0xcbc4('0xd')],'code':_0x1d801d['code']},'headers':{'Content-Type':_0xcbc4('0x18')}};return rp(_0x347469)['then'](function(_0x453a80){var _0xf3a97d=JSON['parse'](_0x453a80);if(_0xf3a97d[_0xcbc4('0x19')]){_0x1d801d['refreshToken']=_0xf3a97d['refresh_token'];logger[_0xcbc4('0x1a')](util[_0xcbc4('0x1b')](_0xcbc4('0x1c'),_0x1d801d[_0xcbc4('0x1d')],_0x1d801d['id']));}else{logger[_0xcbc4('0x1e')](util[_0xcbc4('0x1b')](_0xcbc4('0x1f'),_0x1d801d[_0xcbc4('0x1d')],_0x1d801d['id']),util['inspect'](_0xf3a97d,{'showHidden':![],'depth':null}));}return _0x14b179(null,_0x1dcbba);})['catch'](function(_0xa7ce01){logger[_0xcbc4('0x1e')](util['format'](_0xcbc4('0x1f'),_0x1d801d[_0xcbc4('0x1d')],_0x1d801d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x14b179(_0xa7ce01);});}else{return _0x14b179(null,_0x1dcbba);}},'beforeUpdate':function(_0x2fd641,_0x390fe,_0x594e7f){if(_0x2fd641[_0xcbc4('0xb')](_0xcbc4('0xc'))||_0x2fd641[_0xcbc4('0xb')](_0xcbc4('0xd'))||_0x2fd641['changed'](_0xcbc4('0xe'))||_0x2fd641[_0xcbc4('0xb')]('clientSecret')||_0x2fd641[_0xcbc4('0xb')](_0xcbc4('0x10'))||_0x2fd641['changed']('host')){var _0xd23294,_0x1d13b8;_0xd23294=_0x2fd641[_0xcbc4('0xd')];var _0x7f9f5a=_0xd23294[_0xcbc4('0x20')](-0x1);if(_0x7f9f5a==='/'||_0x7f9f5a==='\x5c'||_0x7f9f5a===':'){_0xd23294=_0xd23294['substring'](0x0,_0xd23294[_0xcbc4('0x21')](_0x7f9f5a));}switch(_0x2fd641[_0xcbc4('0xc')]){case'US':_0x1d13b8=_0xcbc4('0x12');break;case'AU':_0x1d13b8=_0xcbc4('0x13');break;case'IN':_0x1d13b8=_0xcbc4('0x14');break;case'CN':_0x1d13b8=_0xcbc4('0x22');break;default:_0x1d13b8=_0xcbc4('0x15');break;}var _0x4567b1={'method':_0xcbc4('0x16'),'uri':_0x1d13b8+_0xcbc4('0x23'),'form':{'grant_type':_0xcbc4('0x17'),'client_id':_0x2fd641[_0xcbc4('0xe')],'client_secret':_0x2fd641[_0xcbc4('0xf')],'redirect_uri':_0x2fd641[_0xcbc4('0xd')],'code':_0x2fd641[_0xcbc4('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4567b1)[_0xcbc4('0x24')](function(_0x3bfba4){var _0x289303=JSON[_0xcbc4('0x25')](_0x3bfba4);if(_0x289303[_0xcbc4('0x19')]){_0x2fd641['refreshToken']=_0x289303[_0xcbc4('0x19')];logger[_0xcbc4('0x1a')](util[_0xcbc4('0x1b')](_0xcbc4('0x1c'),_0x2fd641[_0xcbc4('0x1d')],_0x2fd641['id']));}else{logger[_0xcbc4('0x1e')](util['format'](_0xcbc4('0x1f'),_0x2fd641[_0xcbc4('0x1d')],_0x2fd641['id']),util[_0xcbc4('0x26')](_0x289303,{'showHidden':![],'depth':null}));}return _0x594e7f(null,_0x390fe);})['catch'](function(_0x4a2a6d){logger[_0xcbc4('0x1e')](util['format'](_0xcbc4('0x1f'),_0x2fd641[_0xcbc4('0x1d')],_0x2fd641['id']),util[_0xcbc4('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x594e7f(_0x4a2a6d);});}else{return _0x594e7f(null,_0x390fe);}}}});}; \ No newline at end of file +var _0xe907=['POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','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','name','catch','error','inspect','host','refreshToken','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x5a85a6,_0x43a58f){var _0x5742e2=function(_0x2e1d71){while(--_0x2e1d71){_0x5a85a6['push'](_0x5a85a6['shift']());}};_0x5742e2(++_0x43a58f);}(_0xe907,0x1dd));var _0x7e90=function(_0x5c80fa,_0x4c932a){_0x5c80fa=_0x5c80fa-0x0;var _0x34c1f9=_0xe907[_0x5c80fa];return _0x34c1f9;};'use strict';var _=require(_0x7e90('0x0'));var util=require(_0x7e90('0x1'));var logger=require(_0x7e90('0x2'))(_0x7e90('0x3'));var moment=require(_0x7e90('0x4'));var BPromise=require(_0x7e90('0x5'));var rp=require(_0x7e90('0x6'));var fs=require('fs');var path=require(_0x7e90('0x7'));var rimraf=require(_0x7e90('0x8'));var config=require(_0x7e90('0x9'));var attributes=require(_0x7e90('0xa'));var integrations=require(_0x7e90('0xb'));module[_0x7e90('0xc')]=function(_0xe1b2,_0x5a5a96){return _0xe1b2[_0x7e90('0xd')](_0x7e90('0xe'),attributes,{'tableName':_0x7e90('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1919ed,_0x7d4bb0,_0x25d5de){if(_0x1919ed['changed']('zone')||_0x1919ed[_0x7e90('0x10')](_0x7e90('0x11'))||_0x1919ed[_0x7e90('0x10')](_0x7e90('0x12'))||_0x1919ed[_0x7e90('0x10')](_0x7e90('0x13'))||_0x1919ed['changed'](_0x7e90('0x14'))||_0x1919ed[_0x7e90('0x10')]('host')){var _0x38e747,_0x11354e;_0x38e747=_0x1919ed['serverUrl'];var _0x4fdefb=_0x38e747[_0x7e90('0x15')](-0x1);if(_0x4fdefb==='/'||_0x4fdefb==='\x5c'||_0x4fdefb===':'){_0x38e747=_0x38e747[_0x7e90('0x16')](0x0,_0x38e747['lastIndexOf'](_0x4fdefb));}switch(_0x1919ed[_0x7e90('0x17')]){case'US':_0x11354e=_0x7e90('0x18');break;case'AU':_0x11354e=_0x7e90('0x19');break;case'IN':_0x11354e=_0x7e90('0x1a');break;case'CN':_0x11354e=_0x7e90('0x1b');break;default:_0x11354e=_0x7e90('0x1c');break;}var _0x4621c8={'method':_0x7e90('0x1d'),'uri':_0x11354e+_0x7e90('0x1e'),'form':{'grant_type':_0x7e90('0x1f'),'client_id':_0x1919ed['clientId'],'client_secret':_0x1919ed[_0x7e90('0x13')],'redirect_uri':_0x1919ed[_0x7e90('0x11')],'code':_0x1919ed[_0x7e90('0x14')]},'headers':{'Content-Type':_0x7e90('0x20')}};return rp(_0x4621c8)[_0x7e90('0x21')](function(_0x3b3d78){var _0x1c1f28=JSON[_0x7e90('0x22')](_0x3b3d78);if(_0x1c1f28[_0x7e90('0x23')]){_0x1919ed['refreshToken']=_0x1c1f28[_0x7e90('0x23')];logger[_0x7e90('0x24')](util[_0x7e90('0x25')](_0x7e90('0x26'),_0x1919ed['name'],_0x1919ed['id']));}else{logger['error'](util[_0x7e90('0x25')](_0x7e90('0x27'),_0x1919ed[_0x7e90('0x28')],_0x1919ed['id']),util['inspect'](_0x1c1f28,{'showHidden':![],'depth':null}));}return _0x25d5de(null,_0x7d4bb0);})[_0x7e90('0x29')](function(_0x58999){logger[_0x7e90('0x2a')](util[_0x7e90('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1919ed[_0x7e90('0x28')],_0x1919ed['id']),util[_0x7e90('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x25d5de(_0x58999);});}else{return _0x25d5de(null,_0x7d4bb0);}},'beforeUpdate':function(_0x59d5f3,_0xc64f82,_0xec5d4e){if(_0x59d5f3[_0x7e90('0x10')](_0x7e90('0x17'))||_0x59d5f3[_0x7e90('0x10')](_0x7e90('0x11'))||_0x59d5f3[_0x7e90('0x10')](_0x7e90('0x12'))||_0x59d5f3[_0x7e90('0x10')](_0x7e90('0x13'))||_0x59d5f3['changed'](_0x7e90('0x14'))||_0x59d5f3[_0x7e90('0x10')](_0x7e90('0x2c'))){var _0x119547,_0x12b4c6;_0x119547=_0x59d5f3[_0x7e90('0x11')];var _0x4fddeb=_0x119547[_0x7e90('0x15')](-0x1);if(_0x4fddeb==='/'||_0x4fddeb==='\x5c'||_0x4fddeb===':'){_0x119547=_0x119547[_0x7e90('0x16')](0x0,_0x119547['lastIndexOf'](_0x4fddeb));}switch(_0x59d5f3[_0x7e90('0x17')]){case'US':_0x12b4c6=_0x7e90('0x18');break;case'AU':_0x12b4c6=_0x7e90('0x19');break;case'IN':_0x12b4c6=_0x7e90('0x1a');break;case'CN':_0x12b4c6=_0x7e90('0x1b');break;default:_0x12b4c6=_0x7e90('0x1c');break;}var _0x18d400={'method':_0x7e90('0x1d'),'uri':_0x12b4c6+_0x7e90('0x1e'),'form':{'grant_type':_0x7e90('0x1f'),'client_id':_0x59d5f3[_0x7e90('0x12')],'client_secret':_0x59d5f3[_0x7e90('0x13')],'redirect_uri':_0x59d5f3['serverUrl'],'code':_0x59d5f3[_0x7e90('0x14')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x18d400)[_0x7e90('0x21')](function(_0xd5aef1){var _0xe18f3e=JSON[_0x7e90('0x22')](_0xd5aef1);if(_0xe18f3e['refresh_token']){_0x59d5f3[_0x7e90('0x2d')]=_0xe18f3e['refresh_token'];logger['info'](util[_0x7e90('0x25')](_0x7e90('0x26'),_0x59d5f3[_0x7e90('0x28')],_0x59d5f3['id']));}else{logger[_0x7e90('0x2a')](util[_0x7e90('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x59d5f3[_0x7e90('0x28')],_0x59d5f3['id']),util[_0x7e90('0x2b')](_0xe18f3e,{'showHidden':![],'depth':null}));}return _0xec5d4e(null,_0xc64f82);})[_0x7e90('0x29')](function(_0x455e9d){logger['error'](util[_0x7e90('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x59d5f3[_0x7e90('0x28')],_0x59d5f3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xec5d4e(_0x455e9d);});}else{return _0xec5d4e(null,_0xc64f82);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 930acdc..f2c2202 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 _0xfbbb=['jayson/promise','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x569723,_0x28934d){_0x569723=_0x569723-0x0;var _0x437329=_0xfbbb[_0x569723];return _0x437329;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});}exports[_0xbfbb('0x17')]=function(_0x4be5df){var _0xc18041=this;return new Promise(function(_0x4834a9,_0x20337e){return db[_0xbfbb('0x18')][_0xbfbb('0x19')]({'raw':_0x4be5df[_0xbfbb('0x1a')]?_0x4be5df[_0xbfbb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4be5df[_0xbfbb('0x1a')]?_0x4be5df['options'][_0xbfbb('0x1b')]||null:null,'attributes':_0x4be5df[_0xbfbb('0x1a')]?_0x4be5df[_0xbfbb('0x1a')][_0xbfbb('0x1c')]||null:null,'limit':_0x4be5df[_0xbfbb('0x1a')]?_0x4be5df[_0xbfbb('0x1a')][_0xbfbb('0x1d')]||null:null,'include':_0x4be5df[_0xbfbb('0x1a')]?_0x4be5df['options'][_0xbfbb('0x1e')]?_[_0xbfbb('0x1f')](_0x4be5df['options'][_0xbfbb('0x1e')],function(_0x15e362){return{'model':db[_0x15e362[_0xbfbb('0x20')]],'as':_0x15e362['as'],'attributes':_0x15e362[_0xbfbb('0x1c')],'include':_0x15e362['include']?_[_0xbfbb('0x1f')](_0x15e362['include'],function(_0x151342){return{'model':db[_0x151342[_0xbfbb('0x20')]],'as':_0x151342['as'],'attributes':_0x151342[_0xbfbb('0x1c')],'include':_0x151342[_0xbfbb('0x1e')]?_[_0xbfbb('0x1f')](_0x151342[_0xbfbb('0x1e')],function(_0x190640){return{'model':db[_0x190640[_0xbfbb('0x20')]],'as':_0x190640['as'],'attributes':_0x190640[_0xbfbb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbfbb('0xc')](function(_0x217750){logger[_0xbfbb('0xd')](_0xbfbb('0x17'),_0x4be5df);logger[_0xbfbb('0xf')]('GetZohoAccount',_0x4be5df,JSON[_0xbfbb('0x21')](_0x217750));_0x4834a9(_0x217750);})[_0xbfbb('0x16')](function(_0x21f507){logger[_0xbfbb('0x11')]('GetZohoAccount',_0x21f507[_0xbfbb('0x14')],_0x4be5df);_0x20337e(_0xc18041[_0xbfbb('0x11')](0x1f4,_0x21f507[_0xbfbb('0x14')]));});});};exports['ShowZohoAccount']=function(_0x1a5afe){var _0x37976b=this;return new Promise(function(_0x1e59db,_0x1d5f19){return db[_0xbfbb('0x18')][_0xbfbb('0x22')]({'raw':_0x1a5afe[_0xbfbb('0x1a')]?_0x1a5afe[_0xbfbb('0x1a')][_0xbfbb('0x23')]===undefined?!![]:![]:!![],'where':_0x1a5afe['options']?_0x1a5afe['options'][_0xbfbb('0x1b')]||null:null,'attributes':_0x1a5afe[_0xbfbb('0x1a')]?_0x1a5afe[_0xbfbb('0x1a')]['attributes']||null:null,'include':_0x1a5afe[_0xbfbb('0x1a')]?_0x1a5afe[_0xbfbb('0x1a')][_0xbfbb('0x1e')]?_[_0xbfbb('0x1f')](_0x1a5afe['options'][_0xbfbb('0x1e')],function(_0x222476){return{'model':db[_0x222476['model']],'as':_0x222476['as'],'attributes':_0x222476[_0xbfbb('0x1c')],'include':_0x222476[_0xbfbb('0x1e')]?_[_0xbfbb('0x1f')](_0x222476['include'],function(_0x4cf704){return{'model':db[_0x4cf704[_0xbfbb('0x20')]],'as':_0x4cf704['as'],'attributes':_0x4cf704[_0xbfbb('0x1c')],'include':_0x4cf704['include']?_[_0xbfbb('0x1f')](_0x4cf704[_0xbfbb('0x1e')],function(_0x49a9c9){return{'model':db[_0x49a9c9[_0xbfbb('0x20')]],'as':_0x49a9c9['as'],'attributes':_0x49a9c9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfbb('0xc')](function(_0x4afe98){logger[_0xbfbb('0xd')]('ShowZohoAccount',_0x1a5afe);logger[_0xbfbb('0xf')](_0xbfbb('0x24'),_0x1a5afe,JSON[_0xbfbb('0x21')](_0x4afe98));_0x1e59db(_0x4afe98);})[_0xbfbb('0x16')](function(_0x132f32){logger[_0xbfbb('0x11')]('ShowZohoAccount',_0x132f32[_0xbfbb('0x14')],_0x1a5afe);_0x1d5f19(_0x37976b[_0xbfbb('0x11')](0x1f4,_0x132f32[_0xbfbb('0x14')]));});});}; \ No newline at end of file +var _0x81df=['include','model','find','ShowZohoAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where','attributes','limit','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81df,0xf9));var _0xf81d=function(_0x1d7c24,_0x36dfc1){_0x1d7c24=_0x1d7c24-0x0;var _0x194241=_0x81df[_0x1d7c24];return _0x194241;};'use strict';var _=require('lodash');var util=require(_0xf81d('0x0'));var moment=require('moment');var BPromise=require(_0xf81d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf81d('0x2'));var db=require(_0xf81d('0x3'))['db'];var utils=require(_0xf81d('0x4'));var logger=require(_0xf81d('0x5'))(_0xf81d('0x6'));var config=require(_0xf81d('0x7'));var jayson=require(_0xf81d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x191841,_0x56a35f,_0x3d4461){return new BPromise(function(_0x1dba61,_0x5e5a16){return client[_0xf81d('0x9')](_0x191841,_0x3d4461)[_0xf81d('0xa')](function(_0x3ee8ff){logger[_0xf81d('0xb')](_0xf81d('0xc'),_0x56a35f,_0xf81d('0xd'));logger[_0xf81d('0xe')](_0xf81d('0xf'),_0x56a35f,_0xf81d('0xd'),JSON[_0xf81d('0x10')](_0x3ee8ff));if(_0x3ee8ff[_0xf81d('0x11')]){if(_0x3ee8ff[_0xf81d('0x11')][_0xf81d('0x12')]===0x1f4){logger[_0xf81d('0x11')](_0xf81d('0xc'),_0x56a35f,_0x3ee8ff[_0xf81d('0x11')][_0xf81d('0x13')]);return _0x5e5a16(_0x3ee8ff[_0xf81d('0x11')][_0xf81d('0x13')]);}logger['error'](_0xf81d('0xc'),_0x56a35f,_0x3ee8ff[_0xf81d('0x11')][_0xf81d('0x13')]);return _0x1dba61(_0x3ee8ff['error'][_0xf81d('0x13')]);}else{logger[_0xf81d('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x56a35f,_0xf81d('0xd'));_0x1dba61(_0x3ee8ff[_0xf81d('0x14')][_0xf81d('0x13')]);}})[_0xf81d('0x15')](function(_0x2fc70a){logger[_0xf81d('0x11')](_0xf81d('0xc'),_0x56a35f,_0x2fc70a);_0x5e5a16(_0x2fc70a);});});}exports[_0xf81d('0x16')]=function(_0x293de8){var _0x2ca7c6=this;return new Promise(function(_0x23d092,_0x154501){return db[_0xf81d('0x17')][_0xf81d('0x18')]({'raw':_0x293de8['options']?_0x293de8['options'][_0xf81d('0x19')]===undefined?!![]:![]:!![],'where':_0x293de8[_0xf81d('0x1a')]?_0x293de8[_0xf81d('0x1a')][_0xf81d('0x1b')]||null:null,'attributes':_0x293de8[_0xf81d('0x1a')]?_0x293de8[_0xf81d('0x1a')][_0xf81d('0x1c')]||null:null,'limit':_0x293de8['options']?_0x293de8[_0xf81d('0x1a')][_0xf81d('0x1d')]||null:null,'include':_0x293de8[_0xf81d('0x1a')]?_0x293de8[_0xf81d('0x1a')]['include']?_[_0xf81d('0x1e')](_0x293de8[_0xf81d('0x1a')][_0xf81d('0x1f')],function(_0x27f81d){return{'model':db[_0x27f81d['model']],'as':_0x27f81d['as'],'attributes':_0x27f81d['attributes'],'include':_0x27f81d[_0xf81d('0x1f')]?_[_0xf81d('0x1e')](_0x27f81d[_0xf81d('0x1f')],function(_0x3a9d5b){return{'model':db[_0x3a9d5b[_0xf81d('0x20')]],'as':_0x3a9d5b['as'],'attributes':_0x3a9d5b[_0xf81d('0x1c')],'include':_0x3a9d5b['include']?_[_0xf81d('0x1e')](_0x3a9d5b[_0xf81d('0x1f')],function(_0x270c5c){return{'model':db[_0x270c5c[_0xf81d('0x20')]],'as':_0x270c5c['as'],'attributes':_0x270c5c[_0xf81d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf81d('0xa')](function(_0x1cc887){logger[_0xf81d('0xb')](_0xf81d('0x16'),_0x293de8);logger[_0xf81d('0xe')](_0xf81d('0x16'),_0x293de8,JSON[_0xf81d('0x10')](_0x1cc887));_0x23d092(_0x1cc887);})[_0xf81d('0x15')](function(_0x249135){logger[_0xf81d('0x11')]('GetZohoAccount',_0x249135[_0xf81d('0x13')],_0x293de8);_0x154501(_0x2ca7c6[_0xf81d('0x11')](0x1f4,_0x249135[_0xf81d('0x13')]));});});};exports['ShowZohoAccount']=function(_0x158300){var _0x5f3825=this;return new Promise(function(_0x354dd7,_0x126b13){return db[_0xf81d('0x17')][_0xf81d('0x21')]({'raw':_0x158300[_0xf81d('0x1a')]?_0x158300[_0xf81d('0x1a')][_0xf81d('0x19')]===undefined?!![]:![]:!![],'where':_0x158300['options']?_0x158300['options'][_0xf81d('0x1b')]||null:null,'attributes':_0x158300[_0xf81d('0x1a')]?_0x158300['options'][_0xf81d('0x1c')]||null:null,'include':_0x158300[_0xf81d('0x1a')]?_0x158300[_0xf81d('0x1a')][_0xf81d('0x1f')]?_['map'](_0x158300[_0xf81d('0x1a')][_0xf81d('0x1f')],function(_0x1644b9){return{'model':db[_0x1644b9['model']],'as':_0x1644b9['as'],'attributes':_0x1644b9[_0xf81d('0x1c')],'include':_0x1644b9[_0xf81d('0x1f')]?_[_0xf81d('0x1e')](_0x1644b9[_0xf81d('0x1f')],function(_0x1517c0){return{'model':db[_0x1517c0['model']],'as':_0x1517c0['as'],'attributes':_0x1517c0[_0xf81d('0x1c')],'include':_0x1517c0['include']?_[_0xf81d('0x1e')](_0x1517c0[_0xf81d('0x1f')],function(_0x1bea0a){return{'model':db[_0x1bea0a[_0xf81d('0x20')]],'as':_0x1bea0a['as'],'attributes':_0x1bea0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf81d('0xa')](function(_0x26cc76){logger[_0xf81d('0xb')](_0xf81d('0x22'),_0x158300);logger['debug'](_0xf81d('0x22'),_0x158300,JSON[_0xf81d('0x10')](_0x26cc76));_0x354dd7(_0x26cc76);})[_0xf81d('0x15')](function(_0x387e84){logger['error']('ShowZohoAccount',_0x387e84[_0xf81d('0x13')],_0x158300);_0x126b13(_0x5f3825[_0xf81d('0x11')](0x1f4,_0x387e84['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 5f9963c..1e784c1 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 _0x6594=['update','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x4578f0,_0x261bb9){var _0x217cd5=function(_0x3825e1){while(--_0x3825e1){_0x4578f0['push'](_0x4578f0['shift']());}};_0x217cd5(++_0x261bb9);}(_0x6594,0xcb));var _0x4659=function(_0xbcb6,_0x8e00a9){_0xbcb6=_0xbcb6-0x0;var _0x58899b=_0x6594[_0xbcb6];return _0x58899b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4659('0x0'));var router=express[_0x4659('0x1')]();var auth=require(_0x4659('0x2'));var interaction=require(_0x4659('0x3'));var config=require(_0x4659('0x4'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x4659('0x5')](),controller[_0x4659('0x6')]);router[_0x4659('0x7')](_0x4659('0x8'),auth['isAuthenticated'](),controller[_0x4659('0x9')]);router[_0x4659('0x7')](_0x4659('0xa'),auth[_0x4659('0x5')](),controller[_0x4659('0xb')]);router[_0x4659('0x7')]('/:id/subjects',auth[_0x4659('0x5')](),controller[_0x4659('0xc')]);router[_0x4659('0x7')](_0x4659('0xd'),auth[_0x4659('0x5')](),controller[_0x4659('0xe')]);router[_0x4659('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4659('0x10')](_0x4659('0x8'),auth[_0x4659('0x5')](),controller[_0x4659('0x11')]);router[_0x4659('0x12')](_0x4659('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x4659('0x13')]=router; \ No newline at end of file +var _0x74fd=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x74fd,0x8f));var _0xd74f=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x74fd[_0x55ef8b];return _0x359c84;};'use strict';var multer=require(_0xd74f('0x0'));var util=require('util');var path=require(_0xd74f('0x1'));var timeout=require(_0xd74f('0x2'));var express=require(_0xd74f('0x3'));var router=express[_0xd74f('0x4')]();var auth=require(_0xd74f('0x5'));var interaction=require(_0xd74f('0x6'));var config=require(_0xd74f('0x7'));var controller=require(_0xd74f('0x8'));router[_0xd74f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd74f('0x9')](_0xd74f('0xa'),auth['isAuthenticated'](),controller[_0xd74f('0xb')]);router[_0xd74f('0x9')](_0xd74f('0xc'),auth[_0xd74f('0xd')](),controller[_0xd74f('0xe')]);router['get']('/:id/subjects',auth[_0xd74f('0xd')](),controller['getSubjects']);router['get'](_0xd74f('0xf'),auth[_0xd74f('0xd')](),controller[_0xd74f('0x10')]);router[_0xd74f('0x11')]('/',auth[_0xd74f('0xd')](),controller[_0xd74f('0x12')]);router[_0xd74f('0x13')](_0xd74f('0xa'),auth[_0xd74f('0xd')](),controller['update']);router[_0xd74f('0x14')](_0xd74f('0xa'),auth[_0xd74f('0xd')](),controller[_0xd74f('0x15')]);module[_0xd74f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d21e99f..7ee041a 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 _0xa70f=['contact','contact_lead','sequelize','exports','STRING','lead'];(function(_0x1f55f9,_0xf5c554){var _0x885614=function(_0x9747d3){while(--_0x9747d3){_0x1f55f9['push'](_0x1f55f9['shift']());}};_0x885614(++_0xf5c554);}(_0xa70f,0xd4));var _0xfa70=function(_0x243c7,_0xb358a0){_0x243c7=_0x243c7-0x0;var _0x1288a2=_0xa70f[_0x243c7];return _0x1288a2;};'use strict';var Sequelize=require(_0xfa70('0x0'));module[_0xfa70('0x1')]={'name':{'type':Sequelize[_0xfa70('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xfa70('0x3'),_0xfa70('0x4'),'nothing'),'defaultValue':_0xfa70('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xfa70('0x5'),'contact',_0xfa70('0x3')),'defaultValue':_0xfa70('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8544=['STRING','ENUM','lead','contact_lead','contact','sequelize','exports'];(function(_0x1c3eb2,_0x2b1fb3){var _0x3b6d0f=function(_0x4e292d){while(--_0x4e292d){_0x1c3eb2['push'](_0x1c3eb2['shift']());}};_0x3b6d0f(++_0x2b1fb3);}(_0x8544,0x1a2));var _0x4854=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x8544[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x4854('0x0'));module[_0x4854('0x1')]={'name':{'type':Sequelize[_0x4854('0x2')]},'moduleCreate':{'type':Sequelize[_0x4854('0x3')](_0x4854('0x4'),'contact','nothing'),'defaultValue':_0x4854('0x4')},'moduleSearch':{'type':Sequelize[_0x4854('0x3')](_0x4854('0x5'),_0x4854('0x6'),_0x4854('0x4')),'defaultValue':_0x4854('0x5')},'description':{'type':Sequelize[_0x4854('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 012fff2..5fe374b 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 _0x26d9=['status','json','count','offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','create','body','find','ZohoField','order','getFields','nolimit','findOne','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','ejs','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','message','sendStatus','end'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x26d9,0x1c4));var _0x926d=function(_0x5a8f5f,_0x5d1290){_0x5a8f5f=_0x5a8f5f-0x0;var _0x4b98c7=_0x26d9[_0x5a8f5f];return _0x4b98c7;};'use strict';var pdf=require(_0x926d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x926d('0x1'));var zipdir=require(_0x926d('0x2'));var jsonpatch=require(_0x926d('0x3'));var rp=require('request-promise');var moment=require(_0x926d('0x4'));var BPromise=require(_0x926d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x926d('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x926d('0x7'));var crypto=require(_0x926d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x926d('0x9'));var toCsv=require(_0x926d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x926d('0xb'));var authService=require(_0x926d('0xc'));var qs=require(_0x926d('0xd'));var as=require(_0x926d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x926d('0xf'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x926d('0x10')]['http']({'port':0x232a});function checkPasswordPattern(_0x5465b9,_0x3e3552,_0x9d450f){if(_0x9d450f){var _0x41a3a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41a3a0[_0x926d('0x11')](_0x3e3552)){return _0x5465b9;}else{throw new db[(_0x926d('0x12'))]['ValidationError'](_0x926d('0x13'));}}else{return _0x5465b9;}}function respondWithRpcPromise(_0x5af0b7,_0x39f34b,_0x569b3e,_0x222296){return new BPromise(function(_0x57640d,_0x570d03){var _0x18cae5=_0x222296||client;return _0x18cae5['request'](_0x5af0b7,_0x569b3e)[_0x926d('0x14')](function(_0x38b230){logger[_0x926d('0x15')](_0x926d('0x16'),_0x39f34b,_0x926d('0x17'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x39f34b,'request\x20sent',JSON['stringify'](_0x38b230));if(_0x38b230['error']){if(_0x38b230[_0x926d('0x18')]['code']===0x1f4){logger[_0x926d('0x18')]('ZohoConfiguration,\x20%s,\x20%s',_0x39f34b,_0x38b230[_0x926d('0x18')][_0x926d('0x19')]);return _0x570d03(_0x38b230[_0x926d('0x18')][_0x926d('0x19')]);}logger['error'](_0x926d('0x16'),_0x39f34b,_0x38b230['error']['message']);return _0x57640d(_0x38b230[_0x926d('0x18')][_0x926d('0x19')]);}else{logger[_0x926d('0x15')](_0x926d('0x16'),_0x39f34b,_0x926d('0x17'));_0x57640d(_0x38b230['result'][_0x926d('0x19')]);}})['catch'](function(_0x5c01b1){logger['error'](_0x926d('0x16'),_0x39f34b,_0x5c01b1);_0x570d03(_0x5c01b1);});});}function respondWithStatusCode(_0xe41ebb,_0x62c93c){_0x62c93c=_0x62c93c||0xcc;return function(_0x2dbcbf){if(_0x2dbcbf){return _0xe41ebb[_0x926d('0x1a')](_0x62c93c);}return _0xe41ebb['status'](_0x62c93c)[_0x926d('0x1b')]();};}function respondWithResult(_0xc1411a,_0x5d456f){_0x5d456f=_0x5d456f||0xc8;return function(_0x595e4b){if(_0x595e4b){return _0xc1411a[_0x926d('0x1c')](_0x5d456f)[_0x926d('0x1d')](_0x595e4b);}};}function respondWithFilteredResult(_0x2305f5,_0x49d0ed){return function(_0x45afb3){if(_0x45afb3){var _0x2f638c=_0x45afb3[_0x926d('0x1e')],_0x505765=_0x49d0ed[_0x926d('0x1f')],_0x99ab73=_0x49d0ed[_0x926d('0x1f')]+_0x49d0ed[_0x926d('0x20')],_0x54ae1d;if(_0x99ab73>=_0x2f638c){_0x99ab73=_0x2f638c;_0x54ae1d=0xc8;}else{_0x54ae1d=0xce;}_0x2305f5['status'](_0x54ae1d);return _0x2305f5[_0x926d('0x21')](_0x926d('0x22'),_0x505765+'-'+_0x99ab73+'/'+_0x2f638c)[_0x926d('0x1d')](_0x45afb3);}return null;};}function patchUpdates(_0xe97a41){return function(_0x237d85){try{jsonpatch['apply'](_0x237d85,_0xe97a41,!![]);}catch(_0x141538){return BPromise[_0x926d('0x23')](_0x141538);}return _0x237d85['save']();};}function saveUpdates(_0x432d21,_0x272984){return function(_0x30258f){if(_0x30258f){return _0x30258f[_0x926d('0x24')](_0x432d21)[_0x926d('0x14')](function(_0x14adf7){return _0x14adf7;});}return null;};}function removeEntity(_0x2dec06,_0x4b8fc6){return function(_0x278526){if(_0x278526){return _0x278526[_0x926d('0x25')]()[_0x926d('0x14')](function(){_0x2dec06['status'](0xcc)[_0x926d('0x1b')]();});}};}function handleEntityNotFound(_0x463c34,_0x17b560){return function(_0x5cf558){if(!_0x5cf558){_0x463c34[_0x926d('0x1a')](0x194);}return _0x5cf558;};}function handleError(_0x6c3dde,_0x5c491d){_0x5c491d=_0x5c491d||0x1f4;return function(_0x17f7d8){logger[_0x926d('0x18')](_0x17f7d8[_0x926d('0x26')]);if(_0x17f7d8[_0x926d('0x27')]){delete _0x17f7d8[_0x926d('0x27')];}_0x6c3dde[_0x926d('0x1c')](_0x5c491d)[_0x926d('0x28')](_0x17f7d8);};}exports[_0x926d('0x29')]=function(_0x1aa1ca,_0x26e7c9){var _0x4d2f09={},_0x1d7b0e={},_0xe20e8f={'count':0x0,'rows':[]};var _0x478d74=_[_0x926d('0x2a')](db[_0x926d('0x2b')][_0x926d('0x2c')],function(_0x4dcbdd){return{'name':_0x4dcbdd[_0x926d('0x2d')],'type':_0x4dcbdd['type'][_0x926d('0x2e')]};});_0x1d7b0e['model']=_[_0x926d('0x2a')](_0x478d74,_0x926d('0x27'));_0x1d7b0e['query']=_[_0x926d('0x2f')](_0x1aa1ca[_0x926d('0x30')]);_0x1d7b0e[_0x926d('0x31')]=_[_0x926d('0x32')](_0x1d7b0e[_0x926d('0x33')],_0x1d7b0e[_0x926d('0x30')]);_0x4d2f09['attributes']=_['intersection'](_0x1d7b0e[_0x926d('0x33')],qs['fields'](_0x1aa1ca[_0x926d('0x30')][_0x926d('0x34')]));_0x4d2f09[_0x926d('0x35')]=_0x4d2f09[_0x926d('0x35')][_0x926d('0x36')]?_0x4d2f09[_0x926d('0x35')]:_0x1d7b0e[_0x926d('0x33')];if(!_0x1aa1ca[_0x926d('0x30')][_0x926d('0x37')]('nolimit')){_0x4d2f09[_0x926d('0x20')]=qs[_0x926d('0x20')](_0x1aa1ca[_0x926d('0x30')][_0x926d('0x20')]);_0x4d2f09[_0x926d('0x1f')]=qs[_0x926d('0x1f')](_0x1aa1ca['query'][_0x926d('0x1f')]);}_0x4d2f09['order']=qs[_0x926d('0x38')](_0x1aa1ca[_0x926d('0x30')][_0x926d('0x38')]);_0x4d2f09['where']=qs['filters'](_[_0x926d('0x39')](_0x1aa1ca['query'],_0x1d7b0e[_0x926d('0x31')]),_0x478d74);if(_0x1aa1ca[_0x926d('0x30')][_0x926d('0x3a')]){_0x4d2f09[_0x926d('0x3b')]=_[_0x926d('0x3c')](_0x4d2f09[_0x926d('0x3b')],{'$or':_[_0x926d('0x2a')](_0x478d74,function(_0x309596){if(_0x309596[_0x926d('0x3d')]!==_0x926d('0x3e')){var _0xc0265c={};_0xc0265c[_0x309596[_0x926d('0x27')]]={'$like':'%'+_0x1aa1ca['query'][_0x926d('0x3a')]+'%'};return _0xc0265c;}})});}_0x4d2f09=_[_0x926d('0x3c')]({},_0x4d2f09,_0x1aa1ca[_0x926d('0x3f')]);var _0x5c9424={'where':_0x4d2f09[_0x926d('0x3b')]};return db['ZohoConfiguration'][_0x926d('0x1e')](_0x5c9424)[_0x926d('0x14')](function(_0x1d220c){_0xe20e8f['count']=_0x1d220c;if(_0x1aa1ca[_0x926d('0x30')]['includeAll']){_0x4d2f09['include']=[{'all':!![]}];}return db[_0x926d('0x2b')][_0x926d('0x40')](_0x4d2f09);})[_0x926d('0x14')](function(_0x15af2d){_0xe20e8f[_0x926d('0x41')]=_0x15af2d;return _0xe20e8f;})[_0x926d('0x14')](respondWithFilteredResult(_0x26e7c9,_0x4d2f09))[_0x926d('0x42')](handleError(_0x26e7c9,null));};exports['show']=function(_0x5998a5,_0x45a878){var _0x451836={'raw':![],'where':{'id':_0x5998a5[_0x926d('0x43')]['id']}},_0x42aa7f={};_0x42aa7f['model']=_[_0x926d('0x2f')](db[_0x926d('0x2b')]['rawAttributes']);_0x42aa7f[_0x926d('0x30')]=_['keys'](_0x5998a5[_0x926d('0x30')]);_0x42aa7f[_0x926d('0x31')]=_[_0x926d('0x32')](_0x42aa7f['model'],_0x42aa7f[_0x926d('0x30')]);_0x451836['attributes']=_['intersection'](_0x42aa7f['model'],qs[_0x926d('0x34')](_0x5998a5[_0x926d('0x30')][_0x926d('0x34')]));_0x451836[_0x926d('0x35')]=_0x451836[_0x926d('0x35')][_0x926d('0x36')]?_0x451836[_0x926d('0x35')]:_0x42aa7f[_0x926d('0x33')];if(_0x5998a5[_0x926d('0x30')][_0x926d('0x44')]){_0x451836[_0x926d('0x45')]=[{'all':!![]}];}_0x451836=_[_0x926d('0x3c')]({},_0x451836,_0x5998a5[_0x926d('0x3f')]);return db[_0x926d('0x2b')]['find'](_0x451836)['then'](handleEntityNotFound(_0x45a878,null))[_0x926d('0x14')](respondWithResult(_0x45a878,null))[_0x926d('0x42')](handleError(_0x45a878,null));};exports[_0x926d('0x46')]=function(_0x1cef35,_0x1da1d7){return db[_0x926d('0x2b')][_0x926d('0x46')](_0x1cef35[_0x926d('0x47')],{})['then'](respondWithResult(_0x1da1d7,0xc9))[_0x926d('0x42')](handleError(_0x1da1d7,null));};exports[_0x926d('0x24')]=function(_0x55b0db,_0x3b69c0){if(_0x55b0db['body']['id']){delete _0x55b0db['body']['id'];}return db[_0x926d('0x2b')][_0x926d('0x48')]({'where':{'id':_0x55b0db[_0x926d('0x43')]['id']}})[_0x926d('0x14')](handleEntityNotFound(_0x3b69c0,null))[_0x926d('0x14')](saveUpdates(_0x55b0db['body'],null))[_0x926d('0x14')](respondWithResult(_0x3b69c0,null))[_0x926d('0x42')](handleError(_0x3b69c0,null));};exports[_0x926d('0x25')]=function(_0x126533,_0x5b1514){return db[_0x926d('0x2b')][_0x926d('0x48')]({'where':{'id':_0x126533[_0x926d('0x43')]['id']}})[_0x926d('0x14')](handleEntityNotFound(_0x5b1514,null))['then'](removeEntity(_0x5b1514,null))[_0x926d('0x42')](handleError(_0x5b1514,null));};exports['getFields']=function(_0x18afd0,_0x5658be,_0x121b11){var _0x59bc90={};var _0x5a1d9d={};var _0x4b3912;var _0x32d6f3;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x18afd0[_0x926d('0x43')]['id']}})['then'](handleEntityNotFound(_0x5658be,null))['then'](function(_0x409a0a){if(_0x409a0a){_0x4b3912=_0x409a0a;_0x5a1d9d[_0x926d('0x33')]=_[_0x926d('0x2f')](db[_0x926d('0x49')][_0x926d('0x2c')]);_0x5a1d9d['query']=_[_0x926d('0x2f')](_0x18afd0['query']);_0x5a1d9d['filters']=_[_0x926d('0x32')](_0x5a1d9d[_0x926d('0x33')],_0x5a1d9d[_0x926d('0x30')]);_0x59bc90[_0x926d('0x35')]=_['intersection'](_0x5a1d9d[_0x926d('0x33')],qs[_0x926d('0x34')](_0x18afd0[_0x926d('0x30')][_0x926d('0x34')]));_0x59bc90[_0x926d('0x35')]=_0x59bc90['attributes'][_0x926d('0x36')]?_0x59bc90[_0x926d('0x35')]:_0x5a1d9d['model'];_0x59bc90[_0x926d('0x4a')]=qs['sort'](_0x18afd0['query'][_0x926d('0x38')]);_0x59bc90[_0x926d('0x3b')]=qs['filters'](_[_0x926d('0x39')](_0x18afd0[_0x926d('0x30')],_0x5a1d9d['filters']));if(_0x18afd0[_0x926d('0x30')][_0x926d('0x3a')]){_0x59bc90[_0x926d('0x3b')]=_[_0x926d('0x3c')](_0x59bc90[_0x926d('0x3b')],{'$or':_['map'](_0x59bc90[_0x926d('0x35')],function(_0x542a06){var _0x5855b5={};_0x5855b5[_0x542a06]={'$like':'%'+_0x18afd0[_0x926d('0x30')][_0x926d('0x3a')]+'%'};return _0x5855b5;})});}_0x59bc90=_[_0x926d('0x3c')]({},_0x59bc90,_0x18afd0['options']);return _0x4b3912[_0x926d('0x4b')](_0x59bc90);}})[_0x926d('0x14')](function(_0x4cb329){if(_0x4cb329){_0x32d6f3=_0x4cb329[_0x926d('0x36')];if(!_0x18afd0[_0x926d('0x30')][_0x926d('0x37')](_0x926d('0x4c'))){_0x59bc90[_0x926d('0x20')]=qs['limit'](_0x18afd0[_0x926d('0x30')][_0x926d('0x20')]);_0x59bc90[_0x926d('0x1f')]=qs['offset'](_0x18afd0[_0x926d('0x30')][_0x926d('0x1f')]);}return _0x4b3912[_0x926d('0x4b')](_0x59bc90);}})[_0x926d('0x14')](function(_0x44def8){if(_0x44def8){return _0x44def8?{'count':_0x32d6f3,'rows':_0x44def8}:null;}})['then'](respondWithResult(_0x5658be,null))[_0x926d('0x42')](handleError(_0x5658be,null));};exports['getSubjects']=function(_0xaca0de,_0x493a35,_0x10d935){var _0x5a2a25={};var _0xfaa826={};var _0x4ca33a;var _0x1c1805;return db[_0x926d('0x2b')][_0x926d('0x4d')]({'where':{'id':_0xaca0de[_0x926d('0x43')]['id']}})[_0x926d('0x14')](handleEntityNotFound(_0x493a35,null))['then'](function(_0x1aac84){if(_0x1aac84){_0x4ca33a=_0x1aac84;_0xfaa826[_0x926d('0x33')]=_['keys'](db['ZohoField'][_0x926d('0x2c')]);_0xfaa826[_0x926d('0x30')]=_[_0x926d('0x2f')](_0xaca0de['query']);_0xfaa826[_0x926d('0x31')]=_['intersection'](_0xfaa826[_0x926d('0x33')],_0xfaa826[_0x926d('0x30')]);_0x5a2a25[_0x926d('0x35')]=_[_0x926d('0x32')](_0xfaa826[_0x926d('0x33')],qs[_0x926d('0x34')](_0xaca0de[_0x926d('0x30')][_0x926d('0x34')]));_0x5a2a25[_0x926d('0x35')]=_0x5a2a25[_0x926d('0x35')]['length']?_0x5a2a25[_0x926d('0x35')]:_0xfaa826[_0x926d('0x33')];_0x5a2a25[_0x926d('0x4a')]=qs[_0x926d('0x38')](_0xaca0de[_0x926d('0x30')][_0x926d('0x38')]);_0x5a2a25[_0x926d('0x3b')]=qs[_0x926d('0x31')](_[_0x926d('0x39')](_0xaca0de[_0x926d('0x30')],_0xfaa826[_0x926d('0x31')]));if(_0xaca0de[_0x926d('0x30')][_0x926d('0x3a')]){_0x5a2a25[_0x926d('0x3b')]=_[_0x926d('0x3c')](_0x5a2a25['where'],{'$or':_['map'](_0x5a2a25[_0x926d('0x35')],function(_0x311ef6){var _0xa8dcd7={};_0xa8dcd7[_0x311ef6]={'$like':'%'+_0xaca0de['query'][_0x926d('0x3a')]+'%'};return _0xa8dcd7;})});}_0x5a2a25=_[_0x926d('0x3c')]({},_0x5a2a25,_0xaca0de[_0x926d('0x3f')]);return _0x4ca33a[_0x926d('0x4e')](_0x5a2a25);}})[_0x926d('0x14')](function(_0x47d874){if(_0x47d874){_0x1c1805=_0x47d874[_0x926d('0x36')];if(!_0xaca0de[_0x926d('0x30')][_0x926d('0x37')]('nolimit')){_0x5a2a25['limit']=qs[_0x926d('0x20')](_0xaca0de[_0x926d('0x30')][_0x926d('0x20')]);_0x5a2a25[_0x926d('0x1f')]=qs[_0x926d('0x1f')](_0xaca0de[_0x926d('0x30')]['offset']);}return _0x4ca33a[_0x926d('0x4e')](_0x5a2a25);}})[_0x926d('0x14')](function(_0xb0f8eb){if(_0xb0f8eb){return _0xb0f8eb?{'count':_0x1c1805,'rows':_0xb0f8eb}:null;}})[_0x926d('0x14')](respondWithResult(_0x493a35,null))['catch'](handleError(_0x493a35,null));};exports[_0x926d('0x4f')]=function(_0x120f29,_0x138150,_0x4fa0ee){var _0x43b29a={};var _0x45e8e0={};var _0x3edc61;var _0x1797a8;return db[_0x926d('0x2b')][_0x926d('0x4d')]({'where':{'id':_0x120f29[_0x926d('0x43')]['id']}})[_0x926d('0x14')](handleEntityNotFound(_0x138150,null))['then'](function(_0x1c020d){if(_0x1c020d){_0x3edc61=_0x1c020d;_0x45e8e0[_0x926d('0x33')]=_[_0x926d('0x2f')](db[_0x926d('0x49')][_0x926d('0x2c')]);_0x45e8e0['query']=_[_0x926d('0x2f')](_0x120f29['query']);_0x45e8e0['filters']=_[_0x926d('0x32')](_0x45e8e0[_0x926d('0x33')],_0x45e8e0[_0x926d('0x30')]);_0x43b29a[_0x926d('0x35')]=_['intersection'](_0x45e8e0[_0x926d('0x33')],qs['fields'](_0x120f29[_0x926d('0x30')]['fields']));_0x43b29a[_0x926d('0x35')]=_0x43b29a['attributes'][_0x926d('0x36')]?_0x43b29a['attributes']:_0x45e8e0['model'];_0x43b29a[_0x926d('0x4a')]=qs[_0x926d('0x38')](_0x120f29['query'][_0x926d('0x38')]);_0x43b29a[_0x926d('0x3b')]=qs[_0x926d('0x31')](_['pick'](_0x120f29['query'],_0x45e8e0['filters']));if(_0x120f29['query'][_0x926d('0x3a')]){_0x43b29a[_0x926d('0x3b')]=_[_0x926d('0x3c')](_0x43b29a[_0x926d('0x3b')],{'$or':_[_0x926d('0x2a')](_0x43b29a[_0x926d('0x35')],function(_0x4205df){var _0x590413={};_0x590413[_0x4205df]={'$like':'%'+_0x120f29['query'][_0x926d('0x3a')]+'%'};return _0x590413;})});}_0x43b29a=_[_0x926d('0x3c')]({},_0x43b29a,_0x120f29['options']);return _0x3edc61[_0x926d('0x4f')](_0x43b29a);}})[_0x926d('0x14')](function(_0x616030){if(_0x616030){_0x1797a8=_0x616030['length'];if(!_0x120f29[_0x926d('0x30')][_0x926d('0x37')](_0x926d('0x4c'))){_0x43b29a[_0x926d('0x20')]=qs[_0x926d('0x20')](_0x120f29[_0x926d('0x30')]['limit']);_0x43b29a[_0x926d('0x1f')]=qs[_0x926d('0x1f')](_0x120f29[_0x926d('0x30')][_0x926d('0x1f')]);}return _0x3edc61[_0x926d('0x4f')](_0x43b29a);}})[_0x926d('0x14')](function(_0x3cfc31){if(_0x3cfc31){return _0x3cfc31?{'count':_0x1797a8,'rows':_0x3cfc31}:null;}})[_0x926d('0x14')](respondWithResult(_0x138150,null))['catch'](handleError(_0x138150,null));}; \ No newline at end of file +var _0x81f5=['attributes','hasOwnProperty','nolimit','query','sort','where','filters','pick','VIRTUAL','options','findAll','show','params','length','includeAll','merge','create','body','find','getFields','findOne','ZohoField','order','filter','getSubjects','rawAttributes','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','ZohoConfiguration','fieldName','type','model','map','keys','intersection','fields'];(function(_0x46ee3c,_0x1c08f0){var _0x530a97=function(_0x194bba){while(--_0x194bba){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x530a97(++_0x1c08f0);}(_0x81f5,0x1d3));var _0x581f=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x81f5[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x581f('0x0'));var emlformat=require(_0x581f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x581f('0x2'));var jsonpatch=require(_0x581f('0x3'));var rp=require('request-promise');var moment=require(_0x581f('0x4'));var BPromise=require(_0x581f('0x5'));var Mustache=require('mustache');var util=require(_0x581f('0x6'));var path=require(_0x581f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x581f('0x8'));var squel=require(_0x581f('0x9'));var crypto=require(_0x581f('0xa'));var jsforce=require(_0x581f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x581f('0xc'));var Redis=require(_0x581f('0xd'));var authService=require(_0x581f('0xe'));var qs=require(_0x581f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x581f('0x10'));var logger=require(_0x581f('0x11'))(_0x581f('0x12'));var utils=require('../../config/utils');var config=require(_0x581f('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x581f('0x14'));var client=jayson['client'][_0x581f('0x15')]({'port':0x232a});function checkPasswordPattern(_0x297597,_0x2e2b4d,_0x2ad968){if(_0x2ad968){var _0x925523=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x925523[_0x581f('0x16')](_0x2e2b4d)){return _0x297597;}else{throw new db[(_0x581f('0x17'))][(_0x581f('0x18'))](_0x581f('0x19'));}}else{return _0x297597;}}function respondWithRpcPromise(_0x3cbed5,_0x3a98c4,_0x36a6cf,_0x52dfcb){return new BPromise(function(_0xb45a78,_0x17ee10){var _0x84167a=_0x52dfcb||client;return _0x84167a['request'](_0x3cbed5,_0x36a6cf)[_0x581f('0x1a')](function(_0x3b292e){logger['info'](_0x581f('0x1b'),_0x3a98c4,_0x581f('0x1c'));logger[_0x581f('0x1d')](_0x581f('0x1e'),_0x3a98c4,'request\x20sent',JSON[_0x581f('0x1f')](_0x3b292e));if(_0x3b292e[_0x581f('0x20')]){if(_0x3b292e['error']['code']===0x1f4){logger['error'](_0x581f('0x1b'),_0x3a98c4,_0x3b292e[_0x581f('0x20')][_0x581f('0x21')]);return _0x17ee10(_0x3b292e['error'][_0x581f('0x21')]);}logger[_0x581f('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x3a98c4,_0x3b292e['error']['message']);return _0xb45a78(_0x3b292e['error']['message']);}else{logger[_0x581f('0x22')](_0x581f('0x1b'),_0x3a98c4,_0x581f('0x1c'));_0xb45a78(_0x3b292e[_0x581f('0x23')]['message']);}})[_0x581f('0x24')](function(_0x3abf29){logger[_0x581f('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x3a98c4,_0x3abf29);_0x17ee10(_0x3abf29);});});}function respondWithStatusCode(_0x51952b,_0xf696d){_0xf696d=_0xf696d||0xcc;return function(_0x186407){if(_0x186407){return _0x51952b[_0x581f('0x25')](_0xf696d);}return _0x51952b[_0x581f('0x26')](_0xf696d)[_0x581f('0x27')]();};}function respondWithResult(_0x2a86bf,_0x1b5637){_0x1b5637=_0x1b5637||0xc8;return function(_0x55f068){if(_0x55f068){return _0x2a86bf[_0x581f('0x26')](_0x1b5637)[_0x581f('0x28')](_0x55f068);}};}function respondWithFilteredResult(_0x1d4a78,_0x3f370c){return function(_0x5a3d68){if(_0x5a3d68){var _0x119dae=_0x5a3d68[_0x581f('0x29')],_0x2f0cc8=_0x3f370c[_0x581f('0x2a')],_0x2ea598=_0x3f370c['offset']+_0x3f370c[_0x581f('0x2b')],_0x3b8189;if(_0x2ea598>=_0x119dae){_0x2ea598=_0x119dae;_0x3b8189=0xc8;}else{_0x3b8189=0xce;}_0x1d4a78[_0x581f('0x26')](_0x3b8189);return _0x1d4a78[_0x581f('0x2c')](_0x581f('0x2d'),_0x2f0cc8+'-'+_0x2ea598+'/'+_0x119dae)[_0x581f('0x28')](_0x5a3d68);}return null;};}function patchUpdates(_0x5e8443){return function(_0x5b6447){try{jsonpatch[_0x581f('0x2e')](_0x5b6447,_0x5e8443,!![]);}catch(_0x226628){return BPromise['reject'](_0x226628);}return _0x5b6447['save']();};}function saveUpdates(_0x1f57fb,_0x7da68e){return function(_0x3e30c4){if(_0x3e30c4){return _0x3e30c4[_0x581f('0x2f')](_0x1f57fb)[_0x581f('0x1a')](function(_0x208894){return _0x208894;});}return null;};}function removeEntity(_0x462bf0,_0x3503c6){return function(_0x2eed1c){if(_0x2eed1c){return _0x2eed1c[_0x581f('0x30')]()[_0x581f('0x1a')](function(){_0x462bf0[_0x581f('0x26')](0xcc)[_0x581f('0x27')]();});}};}function handleEntityNotFound(_0x3d661c,_0xf1ef33){return function(_0x4d1dce){if(!_0x4d1dce){_0x3d661c[_0x581f('0x25')](0x194);}return _0x4d1dce;};}function handleError(_0x225684,_0xc207af){_0xc207af=_0xc207af||0x1f4;return function(_0x3b3618){logger[_0x581f('0x20')](_0x3b3618[_0x581f('0x31')]);if(_0x3b3618[_0x581f('0x32')]){delete _0x3b3618['name'];}_0x225684[_0x581f('0x26')](_0xc207af)[_0x581f('0x33')](_0x3b3618);};}exports[_0x581f('0x34')]=function(_0x1a7c78,_0x289d42){var _0x531ec7={},_0x23b972={},_0x3e52af={'count':0x0,'rows':[]};var _0x2632fe=_['map'](db[_0x581f('0x35')]['rawAttributes'],function(_0x505966){return{'name':_0x505966[_0x581f('0x36')],'type':_0x505966[_0x581f('0x37')]['key']};});_0x23b972[_0x581f('0x38')]=_[_0x581f('0x39')](_0x2632fe,_0x581f('0x32'));_0x23b972['query']=_[_0x581f('0x3a')](_0x1a7c78['query']);_0x23b972['filters']=_[_0x581f('0x3b')](_0x23b972['model'],_0x23b972['query']);_0x531ec7['attributes']=_['intersection'](_0x23b972['model'],qs[_0x581f('0x3c')](_0x1a7c78['query'][_0x581f('0x3c')]));_0x531ec7[_0x581f('0x3d')]=_0x531ec7[_0x581f('0x3d')]['length']?_0x531ec7[_0x581f('0x3d')]:_0x23b972['model'];if(!_0x1a7c78['query'][_0x581f('0x3e')](_0x581f('0x3f'))){_0x531ec7[_0x581f('0x2b')]=qs[_0x581f('0x2b')](_0x1a7c78[_0x581f('0x40')][_0x581f('0x2b')]);_0x531ec7[_0x581f('0x2a')]=qs[_0x581f('0x2a')](_0x1a7c78['query'][_0x581f('0x2a')]);}_0x531ec7['order']=qs[_0x581f('0x41')](_0x1a7c78[_0x581f('0x40')][_0x581f('0x41')]);_0x531ec7[_0x581f('0x42')]=qs[_0x581f('0x43')](_[_0x581f('0x44')](_0x1a7c78['query'],_0x23b972['filters']),_0x2632fe);if(_0x1a7c78[_0x581f('0x40')]['filter']){_0x531ec7[_0x581f('0x42')]=_['merge'](_0x531ec7[_0x581f('0x42')],{'$or':_[_0x581f('0x39')](_0x2632fe,function(_0x5460a3){if(_0x5460a3['type']!==_0x581f('0x45')){var _0x4b3063={};_0x4b3063[_0x5460a3['name']]={'$like':'%'+_0x1a7c78[_0x581f('0x40')]['filter']+'%'};return _0x4b3063;}})});}_0x531ec7=_['merge']({},_0x531ec7,_0x1a7c78[_0x581f('0x46')]);var _0xaf054d={'where':_0x531ec7['where']};return db[_0x581f('0x35')][_0x581f('0x29')](_0xaf054d)[_0x581f('0x1a')](function(_0x3576e6){_0x3e52af[_0x581f('0x29')]=_0x3576e6;if(_0x1a7c78[_0x581f('0x40')]['includeAll']){_0x531ec7['include']=[{'all':!![]}];}return db[_0x581f('0x35')][_0x581f('0x47')](_0x531ec7);})[_0x581f('0x1a')](function(_0x10ebe3){_0x3e52af['rows']=_0x10ebe3;return _0x3e52af;})[_0x581f('0x1a')](respondWithFilteredResult(_0x289d42,_0x531ec7))[_0x581f('0x24')](handleError(_0x289d42,null));};exports[_0x581f('0x48')]=function(_0x29e5d9,_0x3f5be8){var _0x479cc5={'raw':![],'where':{'id':_0x29e5d9[_0x581f('0x49')]['id']}},_0x5aff29={};_0x5aff29[_0x581f('0x38')]=_[_0x581f('0x3a')](db['ZohoConfiguration']['rawAttributes']);_0x5aff29['query']=_[_0x581f('0x3a')](_0x29e5d9['query']);_0x5aff29[_0x581f('0x43')]=_[_0x581f('0x3b')](_0x5aff29[_0x581f('0x38')],_0x5aff29['query']);_0x479cc5[_0x581f('0x3d')]=_['intersection'](_0x5aff29[_0x581f('0x38')],qs[_0x581f('0x3c')](_0x29e5d9[_0x581f('0x40')][_0x581f('0x3c')]));_0x479cc5['attributes']=_0x479cc5[_0x581f('0x3d')][_0x581f('0x4a')]?_0x479cc5[_0x581f('0x3d')]:_0x5aff29['model'];if(_0x29e5d9[_0x581f('0x40')][_0x581f('0x4b')]){_0x479cc5['include']=[{'all':!![]}];}_0x479cc5=_[_0x581f('0x4c')]({},_0x479cc5,_0x29e5d9['options']);return db['ZohoConfiguration']['find'](_0x479cc5)[_0x581f('0x1a')](handleEntityNotFound(_0x3f5be8,null))['then'](respondWithResult(_0x3f5be8,null))[_0x581f('0x24')](handleError(_0x3f5be8,null));};exports[_0x581f('0x4d')]=function(_0x22a1f6,_0x1d65e3){return db[_0x581f('0x35')]['create'](_0x22a1f6[_0x581f('0x4e')],{})[_0x581f('0x1a')](respondWithResult(_0x1d65e3,0xc9))[_0x581f('0x24')](handleError(_0x1d65e3,null));};exports[_0x581f('0x2f')]=function(_0x3c3bd2,_0xb49d58){if(_0x3c3bd2[_0x581f('0x4e')]['id']){delete _0x3c3bd2[_0x581f('0x4e')]['id'];}return db[_0x581f('0x35')][_0x581f('0x4f')]({'where':{'id':_0x3c3bd2[_0x581f('0x49')]['id']}})[_0x581f('0x1a')](handleEntityNotFound(_0xb49d58,null))[_0x581f('0x1a')](saveUpdates(_0x3c3bd2[_0x581f('0x4e')],null))['then'](respondWithResult(_0xb49d58,null))[_0x581f('0x24')](handleError(_0xb49d58,null));};exports['destroy']=function(_0x5c8b12,_0x41ef7e){return db[_0x581f('0x35')]['find']({'where':{'id':_0x5c8b12[_0x581f('0x49')]['id']}})[_0x581f('0x1a')](handleEntityNotFound(_0x41ef7e,null))[_0x581f('0x1a')](removeEntity(_0x41ef7e,null))[_0x581f('0x24')](handleError(_0x41ef7e,null));};exports[_0x581f('0x50')]=function(_0x629972,_0x5c546a,_0x901fb4){var _0x5c790c={};var _0x47b88f={};var _0xe4af96;var _0x4d64fc;return db[_0x581f('0x35')][_0x581f('0x51')]({'where':{'id':_0x629972[_0x581f('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c546a,null))[_0x581f('0x1a')](function(_0x24bcb6){if(_0x24bcb6){_0xe4af96=_0x24bcb6;_0x47b88f[_0x581f('0x38')]=_[_0x581f('0x3a')](db[_0x581f('0x52')]['rawAttributes']);_0x47b88f[_0x581f('0x40')]=_[_0x581f('0x3a')](_0x629972[_0x581f('0x40')]);_0x47b88f[_0x581f('0x43')]=_[_0x581f('0x3b')](_0x47b88f['model'],_0x47b88f[_0x581f('0x40')]);_0x5c790c[_0x581f('0x3d')]=_[_0x581f('0x3b')](_0x47b88f[_0x581f('0x38')],qs[_0x581f('0x3c')](_0x629972['query'][_0x581f('0x3c')]));_0x5c790c[_0x581f('0x3d')]=_0x5c790c[_0x581f('0x3d')][_0x581f('0x4a')]?_0x5c790c[_0x581f('0x3d')]:_0x47b88f[_0x581f('0x38')];_0x5c790c[_0x581f('0x53')]=qs[_0x581f('0x41')](_0x629972['query'][_0x581f('0x41')]);_0x5c790c[_0x581f('0x42')]=qs[_0x581f('0x43')](_[_0x581f('0x44')](_0x629972[_0x581f('0x40')],_0x47b88f[_0x581f('0x43')]));if(_0x629972[_0x581f('0x40')][_0x581f('0x54')]){_0x5c790c[_0x581f('0x42')]=_[_0x581f('0x4c')](_0x5c790c[_0x581f('0x42')],{'$or':_[_0x581f('0x39')](_0x5c790c['attributes'],function(_0x27761d){var _0x18b030={};_0x18b030[_0x27761d]={'$like':'%'+_0x629972[_0x581f('0x40')][_0x581f('0x54')]+'%'};return _0x18b030;})});}_0x5c790c=_['merge']({},_0x5c790c,_0x629972['options']);return _0xe4af96[_0x581f('0x50')](_0x5c790c);}})[_0x581f('0x1a')](function(_0x4d5141){if(_0x4d5141){_0x4d64fc=_0x4d5141['length'];if(!_0x629972[_0x581f('0x40')][_0x581f('0x3e')](_0x581f('0x3f'))){_0x5c790c[_0x581f('0x2b')]=qs[_0x581f('0x2b')](_0x629972['query'][_0x581f('0x2b')]);_0x5c790c[_0x581f('0x2a')]=qs[_0x581f('0x2a')](_0x629972['query']['offset']);}return _0xe4af96[_0x581f('0x50')](_0x5c790c);}})[_0x581f('0x1a')](function(_0x41f926){if(_0x41f926){return _0x41f926?{'count':_0x4d64fc,'rows':_0x41f926}:null;}})[_0x581f('0x1a')](respondWithResult(_0x5c546a,null))[_0x581f('0x24')](handleError(_0x5c546a,null));};exports[_0x581f('0x55')]=function(_0xe5f590,_0x2931e8,_0x1bd3c7){var _0x4d91dd={};var _0x1c575b={};var _0x1f591b;var _0x568a23;return db[_0x581f('0x35')][_0x581f('0x51')]({'where':{'id':_0xe5f590[_0x581f('0x49')]['id']}})[_0x581f('0x1a')](handleEntityNotFound(_0x2931e8,null))[_0x581f('0x1a')](function(_0x5e3cb2){if(_0x5e3cb2){_0x1f591b=_0x5e3cb2;_0x1c575b[_0x581f('0x38')]=_[_0x581f('0x3a')](db['ZohoField'][_0x581f('0x56')]);_0x1c575b[_0x581f('0x40')]=_[_0x581f('0x3a')](_0xe5f590[_0x581f('0x40')]);_0x1c575b[_0x581f('0x43')]=_[_0x581f('0x3b')](_0x1c575b[_0x581f('0x38')],_0x1c575b[_0x581f('0x40')]);_0x4d91dd[_0x581f('0x3d')]=_[_0x581f('0x3b')](_0x1c575b['model'],qs[_0x581f('0x3c')](_0xe5f590['query'][_0x581f('0x3c')]));_0x4d91dd[_0x581f('0x3d')]=_0x4d91dd['attributes'][_0x581f('0x4a')]?_0x4d91dd[_0x581f('0x3d')]:_0x1c575b['model'];_0x4d91dd[_0x581f('0x53')]=qs[_0x581f('0x41')](_0xe5f590[_0x581f('0x40')][_0x581f('0x41')]);_0x4d91dd[_0x581f('0x42')]=qs[_0x581f('0x43')](_[_0x581f('0x44')](_0xe5f590[_0x581f('0x40')],_0x1c575b[_0x581f('0x43')]));if(_0xe5f590['query']['filter']){_0x4d91dd[_0x581f('0x42')]=_['merge'](_0x4d91dd['where'],{'$or':_[_0x581f('0x39')](_0x4d91dd['attributes'],function(_0x3a92fd){var _0x59231b={};_0x59231b[_0x3a92fd]={'$like':'%'+_0xe5f590['query'][_0x581f('0x54')]+'%'};return _0x59231b;})});}_0x4d91dd=_[_0x581f('0x4c')]({},_0x4d91dd,_0xe5f590[_0x581f('0x46')]);return _0x1f591b[_0x581f('0x55')](_0x4d91dd);}})[_0x581f('0x1a')](function(_0x6254ad){if(_0x6254ad){_0x568a23=_0x6254ad[_0x581f('0x4a')];if(!_0xe5f590[_0x581f('0x40')][_0x581f('0x3e')](_0x581f('0x3f'))){_0x4d91dd['limit']=qs[_0x581f('0x2b')](_0xe5f590[_0x581f('0x40')][_0x581f('0x2b')]);_0x4d91dd[_0x581f('0x2a')]=qs['offset'](_0xe5f590['query']['offset']);}return _0x1f591b[_0x581f('0x55')](_0x4d91dd);}})['then'](function(_0x239786){if(_0x239786){return _0x239786?{'count':_0x568a23,'rows':_0x239786}:null;}})[_0x581f('0x1a')](respondWithResult(_0x2931e8,null))[_0x581f('0x24')](handleError(_0x2931e8,null));};exports[_0x581f('0x57')]=function(_0x4d9a12,_0x3a6157,_0x42dfd8){var _0xd67b11={};var _0x2225fa={};var _0x384812;var _0x542b4d;return db['ZohoConfiguration'][_0x581f('0x51')]({'where':{'id':_0x4d9a12['params']['id']}})[_0x581f('0x1a')](handleEntityNotFound(_0x3a6157,null))[_0x581f('0x1a')](function(_0x23bdab){if(_0x23bdab){_0x384812=_0x23bdab;_0x2225fa[_0x581f('0x38')]=_[_0x581f('0x3a')](db[_0x581f('0x52')][_0x581f('0x56')]);_0x2225fa['query']=_['keys'](_0x4d9a12[_0x581f('0x40')]);_0x2225fa[_0x581f('0x43')]=_['intersection'](_0x2225fa[_0x581f('0x38')],_0x2225fa[_0x581f('0x40')]);_0xd67b11['attributes']=_['intersection'](_0x2225fa[_0x581f('0x38')],qs['fields'](_0x4d9a12['query'][_0x581f('0x3c')]));_0xd67b11['attributes']=_0xd67b11[_0x581f('0x3d')][_0x581f('0x4a')]?_0xd67b11['attributes']:_0x2225fa[_0x581f('0x38')];_0xd67b11[_0x581f('0x53')]=qs[_0x581f('0x41')](_0x4d9a12[_0x581f('0x40')][_0x581f('0x41')]);_0xd67b11[_0x581f('0x42')]=qs[_0x581f('0x43')](_['pick'](_0x4d9a12[_0x581f('0x40')],_0x2225fa[_0x581f('0x43')]));if(_0x4d9a12[_0x581f('0x40')]['filter']){_0xd67b11[_0x581f('0x42')]=_[_0x581f('0x4c')](_0xd67b11['where'],{'$or':_[_0x581f('0x39')](_0xd67b11[_0x581f('0x3d')],function(_0x2e3a57){var _0x4a6d8f={};_0x4a6d8f[_0x2e3a57]={'$like':'%'+_0x4d9a12['query']['filter']+'%'};return _0x4a6d8f;})});}_0xd67b11=_[_0x581f('0x4c')]({},_0xd67b11,_0x4d9a12[_0x581f('0x46')]);return _0x384812[_0x581f('0x57')](_0xd67b11);}})['then'](function(_0x4bb5c2){if(_0x4bb5c2){_0x542b4d=_0x4bb5c2[_0x581f('0x4a')];if(!_0x4d9a12['query']['hasOwnProperty'](_0x581f('0x3f'))){_0xd67b11[_0x581f('0x2b')]=qs[_0x581f('0x2b')](_0x4d9a12[_0x581f('0x40')][_0x581f('0x2b')]);_0xd67b11[_0x581f('0x2a')]=qs[_0x581f('0x2a')](_0x4d9a12[_0x581f('0x40')]['offset']);}return _0x384812[_0x581f('0x57')](_0xd67b11);}})['then'](function(_0x28ee21){if(_0x28ee21){return _0x28ee21?{'count':_0x542b4d,'rows':_0x28ee21}:null;}})[_0x581f('0x1a')](respondWithResult(_0x3a6157,null))[_0x581f('0x24')](handleError(_0x3a6157,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dcb5562..1c81010 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 _0xe241=['exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x3c8156,_0x4b4c4f){var _0x48cf93=function(_0x132a2e){while(--_0x132a2e){_0x3c8156['push'](_0x3c8156['shift']());}};_0x48cf93(++_0x4b4c4f);}(_0xe241,0xfd));var _0x1e24=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xe241[_0x1b6186];return _0x186121;};'use strict';var _=require(_0x1e24('0x0'));var util=require('util');var logger=require(_0x1e24('0x1'))('api');var moment=require(_0x1e24('0x2'));var BPromise=require(_0x1e24('0x3'));var rp=require(_0x1e24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e24('0x5'));var attributes=require(_0x1e24('0x6'));module[_0x1e24('0x7')]=function(_0x535703,_0x6bc833){return _0x535703['define'](_0x1e24('0x8'),attributes,{'tableName':_0x1e24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x825f=['moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4206cc,_0x4c353d){var _0x2e6f04=function(_0x867289){while(--_0x867289){_0x4206cc['push'](_0x4206cc['shift']());}};_0x2e6f04(++_0x4c353d);}(_0x825f,0x196));var _0xf825=function(_0x4c4e4c,_0x24e2a0){_0x4c4e4c=_0x4c4e4c-0x0;var _0x187cc7=_0x825f[_0x4c4e4c];return _0x187cc7;};'use strict';var _=require(_0xf825('0x0'));var util=require(_0xf825('0x1'));var logger=require(_0xf825('0x2'))(_0xf825('0x3'));var moment=require(_0xf825('0x4'));var BPromise=require(_0xf825('0x5'));var rp=require(_0xf825('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf825('0x7'));var attributes=require(_0xf825('0x8'));module[_0xf825('0x9')]=function(_0x351424,_0x60663e){return _0x351424['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index ba44111..b1158de 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 _0x77f5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x36537a,_0x40cde8){var _0x89090d=function(_0x84dfe3){while(--_0x84dfe3){_0x36537a['push'](_0x36537a['shift']());}};_0x89090d(++_0x40cde8);}(_0x77f5,0xd0));var _0x577f=function(_0x8ae836,_0x5735d7){_0x8ae836=_0x8ae836-0x0;var _0x2f9136=_0x77f5[_0x8ae836];return _0x2f9136;};'use strict';var _=require(_0x577f('0x0'));var util=require(_0x577f('0x1'));var moment=require(_0x577f('0x2'));var BPromise=require(_0x577f('0x3'));var rs=require(_0x577f('0x4'));var fs=require('fs');var Redis=require(_0x577f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x577f('0x6'));var logger=require('../../config/logger')(_0x577f('0x7'));var config=require(_0x577f('0x8'));var jayson=require(_0x577f('0x9'));var client=jayson[_0x577f('0xa')][_0x577f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4192a7,_0x443f0b,_0xdb80d7){return new BPromise(function(_0x324f94,_0x20691b){return client[_0x577f('0xc')](_0x4192a7,_0xdb80d7)['then'](function(_0xa1183b){logger['info'](_0x577f('0xd'),_0x443f0b,_0x577f('0xe'));logger[_0x577f('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x443f0b,'request\x20sent',JSON[_0x577f('0x10')](_0xa1183b));if(_0xa1183b['error']){if(_0xa1183b[_0x577f('0x11')][_0x577f('0x12')]===0x1f4){logger[_0x577f('0x11')](_0x577f('0xd'),_0x443f0b,_0xa1183b[_0x577f('0x11')]['message']);return _0x20691b(_0xa1183b[_0x577f('0x11')][_0x577f('0x13')]);}logger[_0x577f('0x11')](_0x577f('0xd'),_0x443f0b,_0xa1183b[_0x577f('0x11')]['message']);return _0x324f94(_0xa1183b[_0x577f('0x11')][_0x577f('0x13')]);}else{logger[_0x577f('0x14')](_0x577f('0xd'),_0x443f0b,_0x577f('0xe'));_0x324f94(_0xa1183b[_0x577f('0x15')][_0x577f('0x13')]);}})[_0x577f('0x16')](function(_0x533aba){logger[_0x577f('0x11')](_0x577f('0xd'),_0x443f0b,_0x533aba);_0x20691b(_0x533aba);});});} \ No newline at end of file +var _0xe4d3=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31c68e,_0x5f0385){var _0x159e5d=function(_0x2537a6){while(--_0x2537a6){_0x31c68e['push'](_0x31c68e['shift']());}};_0x159e5d(++_0x5f0385);}(_0xe4d3,0x11b));var _0x3e4d=function(_0x241444,_0x3c5415){_0x241444=_0x241444-0x0;var _0x20b4a9=_0xe4d3[_0x241444];return _0x20b4a9;};'use strict';var _=require(_0x3e4d('0x0'));var util=require('util');var moment=require(_0x3e4d('0x1'));var BPromise=require(_0x3e4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e4d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e4d('0x4'));var logger=require(_0x3e4d('0x5'))(_0x3e4d('0x6'));var config=require(_0x3e4d('0x7'));var jayson=require(_0x3e4d('0x8'));var client=jayson[_0x3e4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b79a5,_0x86c69d,_0x1bc57f){return new BPromise(function(_0x2cd231,_0x2a75db){return client[_0x3e4d('0xa')](_0x1b79a5,_0x1bc57f)[_0x3e4d('0xb')](function(_0x3939dd){logger[_0x3e4d('0xc')](_0x3e4d('0xd'),_0x86c69d,_0x3e4d('0xe'));logger[_0x3e4d('0xf')](_0x3e4d('0x10'),_0x86c69d,'request\x20sent',JSON[_0x3e4d('0x11')](_0x3939dd));if(_0x3939dd[_0x3e4d('0x12')]){if(_0x3939dd[_0x3e4d('0x12')][_0x3e4d('0x13')]===0x1f4){logger['error'](_0x3e4d('0xd'),_0x86c69d,_0x3939dd['error'][_0x3e4d('0x14')]);return _0x2a75db(_0x3939dd[_0x3e4d('0x12')]['message']);}logger['error'](_0x3e4d('0xd'),_0x86c69d,_0x3939dd['error']['message']);return _0x2cd231(_0x3939dd[_0x3e4d('0x12')]['message']);}else{logger[_0x3e4d('0xc')](_0x3e4d('0xd'),_0x86c69d,_0x3e4d('0xe'));_0x2cd231(_0x3939dd[_0x3e4d('0x15')]['message']);}})[_0x3e4d('0x16')](function(_0x373f12){logger['error'](_0x3e4d('0xd'),_0x86c69d,_0x373f12);_0x2a75db(_0x373f12);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a46465c..932bbf0 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 _0x32b6=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy'];(function(_0x47cd88,_0x1afc88){var _0x85126=function(_0x3e496b){while(--_0x3e496b){_0x47cd88['push'](_0x47cd88['shift']());}};_0x85126(++_0x1afc88);}(_0x32b6,0x1d1));var _0x632b=function(_0x1ea276,_0x660669){_0x1ea276=_0x1ea276-0x0;var _0x50e047=_0x32b6[_0x1ea276];return _0x50e047;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['post']('/',auth[_0x632b('0x8')](),controller[_0x632b('0xc')]);router[_0x632b('0xd')](_0x632b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x632b('0xa'),auth['isAuthenticated'](),controller[_0x632b('0xe')]);module[_0x632b('0xf')]=router; \ No newline at end of file +var _0xef0f=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x368fcb,_0x6970e7){var _0x313bb2=function(_0x5e6697){while(--_0x5e6697){_0x368fcb['push'](_0x368fcb['shift']());}};_0x313bb2(++_0x6970e7);}(_0xef0f,0x168));var _0xfef0=function(_0x23bcc0,_0x34d3ce){_0x23bcc0=_0x23bcc0-0x0;var _0x28a3d1=_0xef0f[_0x23bcc0];return _0x28a3d1;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./intZohoField.controller');router[_0xfef0('0x7')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x9')]);router[_0xfef0('0x7')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller['show']);router[_0xfef0('0xb')]('/',auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router[_0xfef0('0xd')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x10')]);module[_0xfef0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6b15e5d..297e0ba 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 _0x1ef8=['keyValue','string','STRING','sequelize','customVariable'];(function(_0x343aa2,_0x374e6d){var _0x1c009e=function(_0x2d04b1){while(--_0x2d04b1){_0x343aa2['push'](_0x343aa2['shift']());}};_0x1c009e(++_0x374e6d);}(_0x1ef8,0xd5));var _0x81ef=function(_0x5a3a67,_0x46f10d){_0x5a3a67=_0x5a3a67-0x0;var _0x2f4dbe=_0x1ef8[_0x5a3a67];return _0x2f4dbe;};'use strict';var Sequelize=require(_0x81ef('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x81ef('0x1'),_0x81ef('0x2')),'defaultValue':_0x81ef('0x3')},'content':{'type':Sequelize[_0x81ef('0x4')]},'key':{'type':Sequelize[_0x81ef('0x4')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x81ef('0x1'))},'keyContent':{'type':Sequelize[_0x81ef('0x4')]},'idField':{'type':Sequelize[_0x81ef('0x4')]},'nameField':{'type':Sequelize[_0x81ef('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81ef('0x4')]}}; \ No newline at end of file +var _0x4693=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x5ee4cc,_0x486993){var _0x56df10=function(_0x12091b){while(--_0x12091b){_0x5ee4cc['push'](_0x5ee4cc['shift']());}};_0x56df10(++_0x486993);}(_0x4693,0x18b));var _0x3469=function(_0x3d6aec,_0x5dddc6){_0x3d6aec=_0x3d6aec-0x0;var _0x301a53=_0x4693[_0x3d6aec];return _0x301a53;};'use strict';var Sequelize=require(_0x3469('0x0'));module['exports']={'type':{'type':Sequelize[_0x3469('0x1')](_0x3469('0x2'),_0x3469('0x3'),_0x3469('0x4'),_0x3469('0x5')),'defaultValue':_0x3469('0x2')},'content':{'type':Sequelize[_0x3469('0x6')]},'key':{'type':Sequelize[_0x3469('0x6')]},'keyType':{'type':Sequelize[_0x3469('0x1')]('string',_0x3469('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3469('0x6')]},'idField':{'type':Sequelize[_0x3469('0x6')]},'nameField':{'type':Sequelize[_0x3469('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3469('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index e067f65..42c75cc 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x212d22,_0x2309d2){var _0x48f2b1=function(_0x43cc92){while(--_0x43cc92){_0x212d22['push'](_0x212d22['shift']());}};_0x48f2b1(++_0x2309d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4c0ebb,_0x1e7eae){var _0xfc4dc1=function(_0x3de6fc){while(--_0x3de6fc){_0x4c0ebb['push'](_0x4c0ebb['shift']());}};_0xfc4dc1(++_0x1e7eae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 967cc2c..4692b74 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 _0xcc45=['exports','int_zoho_fields','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4151c,_0x21d462){var _0x27ee14=function(_0x3c5294){while(--_0x3c5294){_0x4151c['push'](_0x4151c['shift']());}};_0x27ee14(++_0x21d462);}(_0xcc45,0x12c));var _0x5cc4=function(_0x1a57a2,_0x28fcf3){_0x1a57a2=_0x1a57a2-0x0;var _0x3ae93f=_0xcc45[_0x1a57a2];return _0x3ae93f;};'use strict';var _=require(_0x5cc4('0x0'));var util=require('util');var logger=require(_0x5cc4('0x1'))(_0x5cc4('0x2'));var moment=require(_0x5cc4('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cc4('0x4'));var fs=require('fs');var path=require(_0x5cc4('0x5'));var rimraf=require(_0x5cc4('0x6'));var config=require(_0x5cc4('0x7'));var attributes=require('./intZohoField.attributes');module[_0x5cc4('0x8')]=function(_0x54eab5,_0x385cb2){return _0x54eab5['define']('ZohoField',attributes,{'tableName':_0x5cc4('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5cc4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf12f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0xf12f,0x78));var _0xff12=function(_0x263c0a,_0x52b209){_0x263c0a=_0x263c0a-0x0;var _0x344a33=_0xf12f[_0x263c0a];return _0x344a33;};'use strict';var _=require('lodash');var util=require(_0xff12('0x0'));var logger=require(_0xff12('0x1'))(_0xff12('0x2'));var moment=require(_0xff12('0x3'));var BPromise=require(_0xff12('0x4'));var rp=require(_0xff12('0x5'));var fs=require('fs');var path=require(_0xff12('0x6'));var rimraf=require(_0xff12('0x7'));var config=require(_0xff12('0x8'));var attributes=require('./intZohoField.attributes');module[_0xff12('0x9')]=function(_0x257307,_0x324aab){return _0x257307['define'](_0xff12('0xa'),attributes,{'tableName':_0xff12('0xb'),'paranoid':![],'indexes':[{'name':_0xff12('0xc'),'fields':[_0xff12('0xd'),_0xff12('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 4bb4412..6e87e50 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 _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb458,0x103));var _0x8b45=function(_0x47d751,_0x50da49){_0x47d751=_0x47d751-0x0;var _0x34423b=_0xb458[_0x47d751];return _0x34423b;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file +var _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1de098,_0x15048b){var _0x29b385=function(_0x17319f){while(--_0x17319f){_0x1de098['push'](_0x1de098['shift']());}};_0x29b385(++_0x15048b);}(_0xac9d,0x14d));var _0xdac9=function(_0x4819e1,_0x44d88e){_0x4819e1=_0x4819e1-0x0;var _0xca4f58=_0xac9d[_0x4819e1];return _0xca4f58;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f98193e..8577733 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 _0x6d8a=['../../config/environment','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x6d8a,0x1a5));var _0xa6d8=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x6d8a[_0x3a3b9e];return _0x148103;};'use strict';var multer=require(_0xa6d8('0x0'));var util=require('util');var path=require(_0xa6d8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa6d8('0x2')]();var auth=require(_0xa6d8('0x3'));var interaction=require(_0xa6d8('0x4'));var config=require(_0xa6d8('0x5'));module['exports']=router; \ No newline at end of file +var _0xd178=['multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x9d9343,_0x494c83){var _0x2abcd2=function(_0x101a63){while(--_0x101a63){_0x9d9343['push'](_0x9d9343['shift']());}};_0x2abcd2(++_0x494c83);}(_0xd178,0x165));var _0x8d17=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xd178[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x8d17('0x0'));var util=require(_0x8d17('0x1'));var path=require(_0x8d17('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d17('0x3'));var router=express[_0x8d17('0x4')]();var auth=require(_0x8d17('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d17('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8a1f45f..7c180df 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 _0xf553=['STRING','unique_name_and_version','BOOLEAN','state','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf553,0x11e));var _0x3f55=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0xf553[_0xd2f4ac];return _0x9757b2;};'use strict';var Sequelize=require(_0x3f55('0x0'));module[_0x3f55('0x1')]={'name':{'type':Sequelize[_0x3f55('0x2')],'allowNull':![],'unique':_0x3f55('0x3')},'version':{'type':Sequelize[_0x3f55('0x2')],'allowNull':![],'unique':_0x3f55('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x3f55('0x2')]},'path':{'type':Sequelize[_0x3f55('0x2')]},'type':{'type':Sequelize[_0x3f55('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x3f55('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x3f55('0x2')]},'logo':{'type':Sequelize[_0x3f55('0x2')]},'state':{'type':Sequelize[_0x3f55('0x2')],'unique':_0x3f55('0x5')},'description':{'type':Sequelize[_0x3f55('0x2')]},'title':{'type':Sequelize[_0x3f55('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xccd5=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x1c2db9,_0x110afd){var _0x1e65d9=function(_0x45dbef){while(--_0x45dbef){_0x1c2db9['push'](_0x1c2db9['shift']());}};_0x1e65d9(++_0x110afd);}(_0xccd5,0xd4));var _0x5ccd=function(_0x39a6ca,_0x10c9f0){_0x39a6ca=_0x39a6ca-0x0;var _0x752c2f=_0xccd5[_0x39a6ca];return _0x752c2f;};'use strict';var Sequelize=require(_0x5ccd('0x0'));module[_0x5ccd('0x1')]={'name':{'type':Sequelize[_0x5ccd('0x2')],'allowNull':![],'unique':_0x5ccd('0x3')},'version':{'type':Sequelize[_0x5ccd('0x2')],'allowNull':![],'unique':_0x5ccd('0x3')},'main':{'type':Sequelize[_0x5ccd('0x2')],'defaultValue':_0x5ccd('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x5ccd('0x2')]},'type':{'type':Sequelize[_0x5ccd('0x2')]},'size':{'type':Sequelize[_0x5ccd('0x5')]},'active':{'type':Sequelize[_0x5ccd('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5ccd('0x2')]},'logo':{'type':Sequelize[_0x5ccd('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x5ccd('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5ccd('0x2')]},'remoteUri':{'type':Sequelize[_0x5ccd('0x2')]},'link':{'type':Sequelize[_0x5ccd('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 50f2783..11ca1e1 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 _0x76e7=['intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','params','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x76e7,0xa7));var _0x776e=function(_0x34840d,_0x5b6da9){_0x34840d=_0x34840d-0x0;var _0x4c58b4=_0x76e7[_0x34840d];return _0x4c58b4;};'use strict';var pdf=require(_0x776e('0x0'));var emlformat=require(_0x776e('0x1'));var rimraf=require(_0x776e('0x2'));var zipdir=require(_0x776e('0x3'));var jsonpatch=require(_0x776e('0x4'));var rp=require(_0x776e('0x5'));var moment=require(_0x776e('0x6'));var BPromise=require(_0x776e('0x7'));var Mustache=require(_0x776e('0x8'));var util=require('util');var path=require('path');var sox=require(_0x776e('0x9'));var csv=require(_0x776e('0xa'));var ejs=require(_0x776e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x776e('0xc'));var crypto=require(_0x776e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x776e('0xe'));var toCsv=require(_0x776e('0xa'));var querystring=require(_0x776e('0xf'));var Papa=require(_0x776e('0x10'));var Redis=require(_0x776e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x776e('0x12'));var as=require(_0x776e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x776e('0x14'))(_0x776e('0x15'));var utils=require('../../config/utils');var config=require(_0x776e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x210963,_0x2a4eeb){_0x2a4eeb=_0x2a4eeb||0xcc;return function(_0x3aa212){if(_0x3aa212){return _0x210963[_0x776e('0x17')](_0x2a4eeb);}return _0x210963[_0x776e('0x18')](_0x2a4eeb)['end']();};}function respondWithResult(_0x6f2aa8,_0x369fde){_0x369fde=_0x369fde||0xc8;return function(_0x56cba6){if(_0x56cba6){return _0x6f2aa8[_0x776e('0x18')](_0x369fde)[_0x776e('0x19')](_0x56cba6);}};}function respondWithFilteredResult(_0x1abf8b,_0x1ee8ec){return function(_0x30d786){if(_0x30d786){var _0xe4f3e8=_0x30d786[_0x776e('0x1a')],_0x49b448=_0x1ee8ec['offset'],_0x56303d=_0x1ee8ec['offset']+_0x1ee8ec[_0x776e('0x1b')],_0x2bca4e;if(_0x56303d>=_0xe4f3e8){_0x56303d=_0xe4f3e8;_0x2bca4e=0xc8;}else{_0x2bca4e=0xce;}_0x1abf8b[_0x776e('0x18')](_0x2bca4e);return _0x1abf8b[_0x776e('0x1c')](_0x776e('0x1d'),_0x49b448+'-'+_0x56303d+'/'+_0xe4f3e8)[_0x776e('0x19')](_0x30d786);}return null;};}function patchUpdates(_0x5b9c49){return function(_0x8b7952){try{jsonpatch[_0x776e('0x1e')](_0x8b7952,_0x5b9c49,!![]);}catch(_0x13ef6f){return BPromise[_0x776e('0x1f')](_0x13ef6f);}return _0x8b7952[_0x776e('0x20')]();};}function saveUpdates(_0x335f4d,_0x2abca0){return function(_0xd9c52c){if(_0xd9c52c){return _0xd9c52c[_0x776e('0x21')](_0x335f4d)[_0x776e('0x22')](function(_0x357a79){return _0x357a79;});}return null;};}function removeEntity(_0x48f4d1,_0x21fad8){return function(_0x18b472){if(_0x18b472){return _0x18b472[_0x776e('0x23')]()['then'](function(){_0x48f4d1[_0x776e('0x18')](0xcc)[_0x776e('0x24')]();});}};}function handleEntityNotFound(_0x155792,_0x433fd1){return function(_0x18476f){if(!_0x18476f){_0x155792['sendStatus'](0x194);}return _0x18476f;};}function handleError(_0x217b99,_0x11f498){_0x11f498=_0x11f498||0x1f4;return function(_0x1604a9){logger[_0x776e('0x25')](_0x1604a9['stack']);if(_0x1604a9[_0x776e('0x26')]){delete _0x1604a9[_0x776e('0x26')];}_0x217b99[_0x776e('0x18')](_0x11f498)[_0x776e('0x27')](_0x1604a9);};}exports['index']=function(_0x271cd0,_0x2cb6ec){var _0x3e8726={},_0xefd15={},_0xa2b8fe={'count':0x0,'rows':[]};var _0x298d0e=_[_0x776e('0x28')](db[_0x776e('0x29')][_0x776e('0x2a')],function(_0x5df577){return{'name':_0x5df577[_0x776e('0x2b')],'type':_0x5df577[_0x776e('0x2c')][_0x776e('0x2d')]};});_0xefd15['model']=_[_0x776e('0x28')](_0x298d0e,_0x776e('0x26'));_0xefd15[_0x776e('0x2e')]=_[_0x776e('0x2f')](_0x271cd0[_0x776e('0x2e')]);_0xefd15[_0x776e('0x30')]=_[_0x776e('0x31')](_0xefd15[_0x776e('0x32')],_0xefd15[_0x776e('0x2e')]);_0x3e8726[_0x776e('0x33')]=_[_0x776e('0x31')](_0xefd15[_0x776e('0x32')],qs[_0x776e('0x34')](_0x271cd0['query'][_0x776e('0x34')]));_0x3e8726[_0x776e('0x33')]=_0x3e8726[_0x776e('0x33')][_0x776e('0x35')]?_0x3e8726[_0x776e('0x33')]:_0xefd15[_0x776e('0x32')];if(!_0x271cd0['query']['hasOwnProperty'](_0x776e('0x36'))){_0x3e8726[_0x776e('0x1b')]=qs['limit'](_0x271cd0[_0x776e('0x2e')]['limit']);_0x3e8726[_0x776e('0x37')]=qs[_0x776e('0x37')](_0x271cd0[_0x776e('0x2e')]['offset']);}_0x3e8726[_0x776e('0x38')]=qs[_0x776e('0x39')](_0x271cd0['query'][_0x776e('0x39')]);_0x3e8726[_0x776e('0x3a')]=qs[_0x776e('0x30')](_[_0x776e('0x3b')](_0x271cd0[_0x776e('0x2e')],_0xefd15['filters']),_0x298d0e);if(_0x271cd0[_0x776e('0x2e')]['filter']){_0x3e8726[_0x776e('0x3a')]=_[_0x776e('0x3c')](_0x3e8726['where'],{'$or':_[_0x776e('0x28')](_0x298d0e,function(_0x3a67c1){if(_0x3a67c1[_0x776e('0x2c')]!=='VIRTUAL'){var _0x9b1713={};_0x9b1713[_0x3a67c1[_0x776e('0x26')]]={'$like':'%'+_0x271cd0['query'][_0x776e('0x3d')]+'%'};return _0x9b1713;}})});}_0x3e8726=_[_0x776e('0x3c')]({},_0x3e8726,_0x271cd0['options']);var _0x1930bd={'where':_0x3e8726[_0x776e('0x3a')]};return db[_0x776e('0x29')][_0x776e('0x1a')](_0x1930bd)[_0x776e('0x22')](function(_0x24ad44){_0xa2b8fe['count']=_0x24ad44;if(_0x271cd0['query'][_0x776e('0x3e')]){_0x3e8726[_0x776e('0x3f')]=[{'all':!![]}];}return db[_0x776e('0x29')][_0x776e('0x40')](_0x3e8726);})[_0x776e('0x22')](function(_0x421654){_0xa2b8fe[_0x776e('0x41')]=_0x421654;return _0xa2b8fe;})[_0x776e('0x22')](respondWithFilteredResult(_0x2cb6ec,_0x3e8726))['catch'](handleError(_0x2cb6ec,null));};exports['show']=function(_0x339515,_0xeb1e70){var _0x4f8940={'raw':![],'where':{'id':_0x339515[_0x776e('0x42')]['id']}},_0x57185f={};_0x57185f[_0x776e('0x32')]=_['keys'](db[_0x776e('0x29')][_0x776e('0x2a')]);_0x57185f[_0x776e('0x2e')]=_[_0x776e('0x2f')](_0x339515[_0x776e('0x2e')]);_0x57185f[_0x776e('0x30')]=_[_0x776e('0x31')](_0x57185f['model'],_0x57185f[_0x776e('0x2e')]);_0x4f8940[_0x776e('0x33')]=_[_0x776e('0x31')](_0x57185f[_0x776e('0x32')],qs[_0x776e('0x34')](_0x339515[_0x776e('0x2e')]['fields']));_0x4f8940[_0x776e('0x33')]=_0x4f8940['attributes']['length']?_0x4f8940[_0x776e('0x33')]:_0x57185f[_0x776e('0x32')];if(_0x339515['query']['includeAll']){_0x4f8940[_0x776e('0x3f')]=[{'all':!![]}];}_0x4f8940=_[_0x776e('0x3c')]({},_0x4f8940,_0x339515[_0x776e('0x43')]);return db[_0x776e('0x29')][_0x776e('0x44')](_0x4f8940)[_0x776e('0x22')](handleEntityNotFound(_0xeb1e70,null))[_0x776e('0x22')](respondWithResult(_0xeb1e70,null))[_0x776e('0x45')](handleError(_0xeb1e70,null));};exports[_0x776e('0x46')]=function(_0x2b6615,_0xb29507){return db[_0x776e('0x29')]['create'](_0x2b6615['body'],{})[_0x776e('0x22')](respondWithResult(_0xb29507,0xc9))[_0x776e('0x45')](handleError(_0xb29507,null));};exports['update']=function(_0x4dc763,_0x2855c1){if(_0x4dc763[_0x776e('0x47')]['id']){delete _0x4dc763[_0x776e('0x47')]['id'];}return db[_0x776e('0x29')][_0x776e('0x44')]({'where':{'id':_0x4dc763[_0x776e('0x42')]['id']}})[_0x776e('0x22')](handleEntityNotFound(_0x2855c1,null))[_0x776e('0x22')](saveUpdates(_0x4dc763[_0x776e('0x47')],null))[_0x776e('0x22')](respondWithResult(_0x2855c1,null))[_0x776e('0x45')](handleError(_0x2855c1,null));};exports[_0x776e('0x23')]=function(_0x12446b,_0x5093b0){return db[_0x776e('0x29')][_0x776e('0x44')]({'where':{'id':_0x12446b['params']['id']}})[_0x776e('0x22')](handleEntityNotFound(_0x5093b0,null))['then'](removeEntity(_0x5093b0,null))[_0x776e('0x45')](handleError(_0x5093b0,null));}; \ No newline at end of file +var _0x5dc2=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','Integration','count','includeAll','include','findAll','catch','show','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map'];(function(_0x6ffa12,_0x45a92a){var _0x17b047=function(_0x1bf1f6){while(--_0x1bf1f6){_0x6ffa12['push'](_0x6ffa12['shift']());}};_0x17b047(++_0x45a92a);}(_0x5dc2,0x1cf));var _0x25dc=function(_0x168975,_0x46ee91){_0x168975=_0x168975-0x0;var _0x583d37=_0x5dc2[_0x168975];return _0x583d37;};'use strict';var pdf=require(_0x25dc('0x0'));var emlformat=require(_0x25dc('0x1'));var rimraf=require(_0x25dc('0x2'));var zipdir=require(_0x25dc('0x3'));var jsonpatch=require(_0x25dc('0x4'));var rp=require(_0x25dc('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x25dc('0x6'));var util=require(_0x25dc('0x7'));var path=require(_0x25dc('0x8'));var sox=require(_0x25dc('0x9'));var csv=require(_0x25dc('0xa'));var ejs=require(_0x25dc('0xb'));var fs=require('fs');var _=require(_0x25dc('0xc'));var squel=require(_0x25dc('0xd'));var crypto=require(_0x25dc('0xe'));var jsforce=require(_0x25dc('0xf'));var deskjs=require(_0x25dc('0x10'));var toCsv=require(_0x25dc('0xa'));var querystring=require('querystring');var Papa=require(_0x25dc('0x11'));var Redis=require(_0x25dc('0x12'));var authService=require(_0x25dc('0x13'));var qs=require(_0x25dc('0x14'));var as=require(_0x25dc('0x15'));var hardwareService=require(_0x25dc('0x16'));var logger=require(_0x25dc('0x17'))(_0x25dc('0x18'));var utils=require(_0x25dc('0x19'));var config=require('../../config/environment');var db=require(_0x25dc('0x1a'))['db'];function respondWithStatusCode(_0x500b5e,_0x3db383){_0x3db383=_0x3db383||0xcc;return function(_0x32e2cd){if(_0x32e2cd){return _0x500b5e['sendStatus'](_0x3db383);}return _0x500b5e[_0x25dc('0x1b')](_0x3db383)['end']();};}function respondWithResult(_0x4568a8,_0x26a549){_0x26a549=_0x26a549||0xc8;return function(_0x263419){if(_0x263419){return _0x4568a8[_0x25dc('0x1b')](_0x26a549)[_0x25dc('0x1c')](_0x263419);}};}function respondWithFilteredResult(_0x533818,_0x56f922){return function(_0x6678e7){if(_0x6678e7){var _0x710542=_0x6678e7['count'],_0x47a7c0=_0x56f922['offset'],_0xf9c7e2=_0x56f922[_0x25dc('0x1d')]+_0x56f922[_0x25dc('0x1e')],_0x41a10f;if(_0xf9c7e2>=_0x710542){_0xf9c7e2=_0x710542;_0x41a10f=0xc8;}else{_0x41a10f=0xce;}_0x533818[_0x25dc('0x1b')](_0x41a10f);return _0x533818[_0x25dc('0x1f')](_0x25dc('0x20'),_0x47a7c0+'-'+_0xf9c7e2+'/'+_0x710542)[_0x25dc('0x1c')](_0x6678e7);}return null;};}function patchUpdates(_0x29dd9c){return function(_0x1b378b){try{jsonpatch[_0x25dc('0x21')](_0x1b378b,_0x29dd9c,!![]);}catch(_0x18187f){return BPromise[_0x25dc('0x22')](_0x18187f);}return _0x1b378b['save']();};}function saveUpdates(_0xb66a7e,_0x221fca){return function(_0x54bbd1){if(_0x54bbd1){return _0x54bbd1[_0x25dc('0x23')](_0xb66a7e)[_0x25dc('0x24')](function(_0x454c35){return _0x454c35;});}return null;};}function removeEntity(_0x3ee634,_0xda7b44){return function(_0xcffa03){if(_0xcffa03){return _0xcffa03[_0x25dc('0x25')]()[_0x25dc('0x24')](function(){_0x3ee634['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53669a,_0x1586cc){return function(_0xd5ca20){if(!_0xd5ca20){_0x53669a[_0x25dc('0x26')](0x194);}return _0xd5ca20;};}function handleError(_0x12aeec,_0x584134){_0x584134=_0x584134||0x1f4;return function(_0x296570){logger['error'](_0x296570['stack']);if(_0x296570[_0x25dc('0x27')]){delete _0x296570[_0x25dc('0x27')];}_0x12aeec[_0x25dc('0x1b')](_0x584134)[_0x25dc('0x28')](_0x296570);};}exports[_0x25dc('0x29')]=function(_0x5084dc,_0x3c0afe){var _0x4bb349={},_0x1c4300={},_0x53c019={'count':0x0,'rows':[]};var _0x4171b9=_['map'](db['Integration'][_0x25dc('0x2a')],function(_0x1246fa){return{'name':_0x1246fa[_0x25dc('0x2b')],'type':_0x1246fa[_0x25dc('0x2c')][_0x25dc('0x2d')]};});_0x1c4300[_0x25dc('0x2e')]=_[_0x25dc('0x2f')](_0x4171b9,_0x25dc('0x27'));_0x1c4300[_0x25dc('0x30')]=_[_0x25dc('0x31')](_0x5084dc[_0x25dc('0x30')]);_0x1c4300[_0x25dc('0x32')]=_['intersection'](_0x1c4300[_0x25dc('0x2e')],_0x1c4300[_0x25dc('0x30')]);_0x4bb349['attributes']=_[_0x25dc('0x33')](_0x1c4300[_0x25dc('0x2e')],qs[_0x25dc('0x34')](_0x5084dc['query'][_0x25dc('0x34')]));_0x4bb349[_0x25dc('0x35')]=_0x4bb349['attributes'][_0x25dc('0x36')]?_0x4bb349['attributes']:_0x1c4300[_0x25dc('0x2e')];if(!_0x5084dc[_0x25dc('0x30')][_0x25dc('0x37')]('nolimit')){_0x4bb349[_0x25dc('0x1e')]=qs['limit'](_0x5084dc[_0x25dc('0x30')][_0x25dc('0x1e')]);_0x4bb349[_0x25dc('0x1d')]=qs['offset'](_0x5084dc[_0x25dc('0x30')][_0x25dc('0x1d')]);}_0x4bb349[_0x25dc('0x38')]=qs[_0x25dc('0x39')](_0x5084dc[_0x25dc('0x30')][_0x25dc('0x39')]);_0x4bb349[_0x25dc('0x3a')]=qs[_0x25dc('0x32')](_['pick'](_0x5084dc[_0x25dc('0x30')],_0x1c4300[_0x25dc('0x32')]),_0x4171b9);if(_0x5084dc['query'][_0x25dc('0x3b')]){_0x4bb349[_0x25dc('0x3a')]=_['merge'](_0x4bb349[_0x25dc('0x3a')],{'$or':_[_0x25dc('0x2f')](_0x4171b9,function(_0x227d3c){if(_0x227d3c[_0x25dc('0x2c')]!==_0x25dc('0x3c')){var _0x5bf1f5={};_0x5bf1f5[_0x227d3c[_0x25dc('0x27')]]={'$like':'%'+_0x5084dc[_0x25dc('0x30')][_0x25dc('0x3b')]+'%'};return _0x5bf1f5;}})});}_0x4bb349=_[_0x25dc('0x3d')]({},_0x4bb349,_0x5084dc['options']);var _0x26fe06={'where':_0x4bb349['where']};return db[_0x25dc('0x3e')]['count'](_0x26fe06)[_0x25dc('0x24')](function(_0x740704){_0x53c019[_0x25dc('0x3f')]=_0x740704;if(_0x5084dc[_0x25dc('0x30')][_0x25dc('0x40')]){_0x4bb349[_0x25dc('0x41')]=[{'all':!![]}];}return db[_0x25dc('0x3e')][_0x25dc('0x42')](_0x4bb349);})[_0x25dc('0x24')](function(_0x17e496){_0x53c019['rows']=_0x17e496;return _0x53c019;})[_0x25dc('0x24')](respondWithFilteredResult(_0x3c0afe,_0x4bb349))[_0x25dc('0x43')](handleError(_0x3c0afe,null));};exports[_0x25dc('0x44')]=function(_0x26ff0e,_0x4be6e4){var _0x35c166={'raw':![],'where':{'id':_0x26ff0e['params']['id']}},_0x34aa4b={};_0x34aa4b['model']=_['keys'](db[_0x25dc('0x3e')][_0x25dc('0x2a')]);_0x34aa4b[_0x25dc('0x30')]=_[_0x25dc('0x31')](_0x26ff0e[_0x25dc('0x30')]);_0x34aa4b[_0x25dc('0x32')]=_['intersection'](_0x34aa4b[_0x25dc('0x2e')],_0x34aa4b['query']);_0x35c166['attributes']=_['intersection'](_0x34aa4b[_0x25dc('0x2e')],qs[_0x25dc('0x34')](_0x26ff0e[_0x25dc('0x30')][_0x25dc('0x34')]));_0x35c166[_0x25dc('0x35')]=_0x35c166[_0x25dc('0x35')][_0x25dc('0x36')]?_0x35c166['attributes']:_0x34aa4b[_0x25dc('0x2e')];if(_0x26ff0e[_0x25dc('0x30')][_0x25dc('0x40')]){_0x35c166['include']=[{'all':!![]}];}_0x35c166=_['merge']({},_0x35c166,_0x26ff0e[_0x25dc('0x45')]);return db[_0x25dc('0x3e')][_0x25dc('0x46')](_0x35c166)[_0x25dc('0x24')](handleEntityNotFound(_0x4be6e4,null))[_0x25dc('0x24')](respondWithResult(_0x4be6e4,null))['catch'](handleError(_0x4be6e4,null));};exports['create']=function(_0xd4197,_0x37d94f){return db[_0x25dc('0x3e')][_0x25dc('0x47')](_0xd4197['body'],{})[_0x25dc('0x24')](respondWithResult(_0x37d94f,0xc9))[_0x25dc('0x43')](handleError(_0x37d94f,null));};exports['update']=function(_0x153b4d,_0x2c00ae){if(_0x153b4d[_0x25dc('0x48')]['id']){delete _0x153b4d['body']['id'];}return db[_0x25dc('0x3e')][_0x25dc('0x46')]({'where':{'id':_0x153b4d['params']['id']}})[_0x25dc('0x24')](handleEntityNotFound(_0x2c00ae,null))[_0x25dc('0x24')](saveUpdates(_0x153b4d[_0x25dc('0x48')],null))[_0x25dc('0x24')](respondWithResult(_0x2c00ae,null))[_0x25dc('0x43')](handleError(_0x2c00ae,null));};exports[_0x25dc('0x25')]=function(_0x22903c,_0xfd435){return db[_0x25dc('0x3e')][_0x25dc('0x46')]({'where':{'id':_0x22903c['params']['id']}})[_0x25dc('0x24')](handleEntityNotFound(_0xfd435,null))[_0x25dc('0x24')](removeEntity(_0xfd435,null))[_0x25dc('0x43')](handleError(_0xfd435,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8dfdde9..0db2a21 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 _0x839c=['../../config/environment','./integration.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x50817c,_0x2aeda2){var _0x5e2577=function(_0x489709){while(--_0x489709){_0x50817c['push'](_0x50817c['shift']());}};_0x5e2577(++_0x2aeda2);}(_0x839c,0x1cc));var _0xc839=function(_0x11e9e6,_0x40b63c){_0x11e9e6=_0x11e9e6-0x0;var _0x5ebe60=_0x839c[_0x11e9e6];return _0x5ebe60;};'use strict';var _=require(_0xc839('0x0'));var util=require(_0xc839('0x1'));var logger=require(_0xc839('0x2'))(_0xc839('0x3'));var moment=require(_0xc839('0x4'));var BPromise=require('bluebird');var rp=require(_0xc839('0x5'));var fs=require('fs');var path=require(_0xc839('0x6'));var rimraf=require(_0xc839('0x7'));var config=require(_0xc839('0x8'));var attributes=require(_0xc839('0x9'));module[_0xc839('0xa')]=function(_0x175d65,_0x112d18){return _0x175d65[_0xc839('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17f1=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','moment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x17f1,0x14f));var _0x117f=function(_0x23eb8c,_0x5618e8){_0x23eb8c=_0x23eb8c-0x0;var _0x4978ba=_0x17f1[_0x23eb8c];return _0x4978ba;};'use strict';var _=require(_0x117f('0x0'));var util=require('util');var logger=require(_0x117f('0x1'))('api');var moment=require(_0x117f('0x2'));var BPromise=require(_0x117f('0x3'));var rp=require(_0x117f('0x4'));var fs=require('fs');var path=require(_0x117f('0x5'));var rimraf=require(_0x117f('0x6'));var config=require(_0x117f('0x7'));var attributes=require(_0x117f('0x8'));module[_0x117f('0x9')]=function(_0x1267b3,_0x352291){return _0x1267b3[_0x117f('0xa')](_0x117f('0xb'),attributes,{'tableName':_0x117f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f387856..33aa444 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 _0x89c9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x5be98f,_0x291688){var _0x1f66b4=function(_0x27642d){while(--_0x27642d){_0x5be98f['push'](_0x5be98f['shift']());}};_0x1f66b4(++_0x291688);}(_0x89c9,0xb0));var _0x989c=function(_0xb03f9,_0x588391){_0xb03f9=_0xb03f9-0x0;var _0x3ec30a=_0x89c9[_0xb03f9];return _0x3ec30a;};'use strict';var _=require(_0x989c('0x0'));var util=require(_0x989c('0x1'));var moment=require(_0x989c('0x2'));var BPromise=require(_0x989c('0x3'));var rs=require(_0x989c('0x4'));var fs=require('fs');var Redis=require(_0x989c('0x5'));var db=require(_0x989c('0x6'))['db'];var utils=require(_0x989c('0x7'));var logger=require(_0x989c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x989c('0x9')][_0x989c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22b2e5,_0x415bad,_0xa4cdf6){return new BPromise(function(_0x15bd83,_0x5aa575){return client[_0x989c('0xb')](_0x22b2e5,_0xa4cdf6)[_0x989c('0xc')](function(_0x5b6d03){logger['info'](_0x989c('0xd'),_0x415bad,_0x989c('0xe'));logger[_0x989c('0xf')](_0x989c('0x10'),_0x415bad,_0x989c('0xe'),JSON['stringify'](_0x5b6d03));if(_0x5b6d03['error']){if(_0x5b6d03[_0x989c('0x11')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x415bad,_0x5b6d03[_0x989c('0x11')][_0x989c('0x12')]);return _0x5aa575(_0x5b6d03[_0x989c('0x11')][_0x989c('0x12')]);}logger[_0x989c('0x11')](_0x989c('0xd'),_0x415bad,_0x5b6d03[_0x989c('0x11')]['message']);return _0x15bd83(_0x5b6d03['error'][_0x989c('0x12')]);}else{logger[_0x989c('0x13')](_0x989c('0xd'),_0x415bad,_0x989c('0xe'));_0x15bd83(_0x5b6d03[_0x989c('0x14')][_0x989c('0x12')]);}})[_0x989c('0x15')](function(_0x329ab3){logger[_0x989c('0x11')](_0x989c('0xd'),_0x415bad,_0x329ab3);_0x5aa575(_0x329ab3);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7bae[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('Integration,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('Integration,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8905348..b6d8863 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 _0x9256=['isAuthenticated','show','post','create','put','update','delete','exports','multer','express','../../components/interaction/service','../../config/environment','get','index','describe','/:id'];(function(_0x21bd89,_0x5cb3e3){var _0x5a07ee=function(_0x11b36d){while(--_0x11b36d){_0x21bd89['push'](_0x21bd89['shift']());}};_0x5a07ee(++_0x5cb3e3);}(_0x9256,0xa8));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6925('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6925('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6925('0x2'));var config=require(_0x6925('0x3'));var controller=require('./integrationReport.controller');router[_0x6925('0x4')]('/',auth['isAuthenticated'](),controller[_0x6925('0x5')]);router[_0x6925('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x6925('0x6')]);router['get'](_0x6925('0x7'),auth[_0x6925('0x8')](),controller[_0x6925('0x9')]);router[_0x6925('0xa')]('/',auth[_0x6925('0x8')](),controller[_0x6925('0xb')]);router[_0x6925('0xc')](_0x6925('0x7'),auth['isAuthenticated'](),controller[_0x6925('0xd')]);router[_0x6925('0xe')](_0x6925('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x6925('0xf')]=router; \ No newline at end of file +var _0xb677=['../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2582e5,_0x442302){var _0x19fda8=function(_0x52f948){while(--_0x52f948){_0x2582e5['push'](_0x2582e5['shift']());}};_0x19fda8(++_0x442302);}(_0xb677,0x119));var _0x7b67=function(_0x180cc7,_0x5d8dd1){_0x180cc7=_0x180cc7-0x0;var _0x747868=_0xb677[_0x180cc7];return _0x747868;};'use strict';var multer=require(_0x7b67('0x0'));var util=require('util');var path=require(_0x7b67('0x1'));var timeout=require(_0x7b67('0x2'));var express=require(_0x7b67('0x3'));var router=express[_0x7b67('0x4')]();var auth=require(_0x7b67('0x5'));var interaction=require(_0x7b67('0x6'));var config=require(_0x7b67('0x7'));var controller=require(_0x7b67('0x8'));router['get']('/',auth[_0x7b67('0x9')](),controller[_0x7b67('0xa')]);router[_0x7b67('0xb')](_0x7b67('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7b67('0xd'),auth['isAuthenticated'](),controller[_0x7b67('0xe')]);router['post']('/',auth[_0x7b67('0x9')](),controller[_0x7b67('0xf')]);router['put'](_0x7b67('0xd'),auth['isAuthenticated'](),controller[_0x7b67('0x10')]);router[_0x7b67('0x11')](_0x7b67('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index ecf3398..b059f89 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 _0xd068=['SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x1bddcf,_0x56e146){var _0x392d73=function(_0x4f6985){while(--_0x4f6985){_0x1bddcf['push'](_0x1bddcf['shift']());}};_0x392d73(++_0x56e146);}(_0xd068,0x1e3));var _0x8d06=function(_0x51a4a5,_0x2e11bd){_0x51a4a5=_0x51a4a5-0x0;var _0x227338=_0xd068[_0x51a4a5];return _0x227338;};'use strict';var Sequelize=require('sequelize');module[_0x8d06('0x0')]={'integration':{'type':Sequelize[_0x8d06('0x1')]},'eventChannel':{'type':Sequelize[_0x8d06('0x1')]},'exitStatus':{'type':Sequelize[_0x8d06('0x1')]},'ticketId':{'type':Sequelize[_0x8d06('0x1')]},'integrationId':{'type':Sequelize[_0x8d06('0x2')]},'contacts':{'type':Sequelize[_0x8d06('0x1')]},'uniqueid':{'type':Sequelize[_0x8d06('0x1')]},'calleridnum':{'type':Sequelize[_0x8d06('0x1')]},'calleridname':{'type':Sequelize[_0x8d06('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8d06('0x1')]},'membername':{'type':Sequelize[_0x8d06('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x8d06('0x3')]},'holdtime':{'type':Sequelize[_0x8d06('0x2')]},'agentcomplete':{'type':Sequelize[_0x8d06('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8d06('0x3')]},'talktime':{'type':Sequelize[_0x8d06('0x2')]},'agentacw':{'type':Sequelize[_0x8d06('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8d06('0x2')]},'reason':{'type':Sequelize[_0x8d06('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8d06('0x3')]},'agentdump':{'type':Sequelize[_0x8d06('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8d06('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8d06('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8d06('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8d06('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8d06('0x1')]},'accountcode':{'type':Sequelize[_0x8d06('0x1')]},'context':{'type':Sequelize[_0x8d06('0x1')]},'exten':{'type':Sequelize[_0x8d06('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x8d06('0x1')]},'destchannelstate':{'type':Sequelize[_0x8d06('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8d06('0x1')]},'destcalleridname':{'type':Sequelize[_0x8d06('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8d06('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x8d06('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8d06('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8d06('0x1')]},'messageId':{'type':Sequelize[_0x8d06('0x1')]},'inReplyTo':{'type':Sequelize[_0x8d06('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x8d06('0x1')]},'to':{'type':Sequelize[_0x8d06('0x1')]},'cc':{'type':Sequelize[_0x8d06('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8d06('0x5')]},'text':{'type':Sequelize[_0x8d06('0x5')]},'status':{'type':Sequelize[_0x8d06('0x6')]('SENT',_0x8d06('0x7'),_0x8d06('0x8'),_0x8d06('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x8d06('0x1')]},'appdata':{'type':Sequelize[_0x8d06('0x1')]},'projectId':{'type':Sequelize[_0x8d06('0x2')]}}; \ No newline at end of file +var _0x6b1d=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0x6b1d,0x154));var _0xd6b1=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0x6b1d[_0x224ad0];return _0x2e04fc;};'use strict';var Sequelize=require(_0xd6b1('0x0'));module[_0xd6b1('0x1')]={'integration':{'type':Sequelize[_0xd6b1('0x2')]},'eventChannel':{'type':Sequelize[_0xd6b1('0x2')]},'exitStatus':{'type':Sequelize[_0xd6b1('0x2')]},'ticketId':{'type':Sequelize[_0xd6b1('0x2')]},'integrationId':{'type':Sequelize[_0xd6b1('0x3')]},'contacts':{'type':Sequelize[_0xd6b1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6b1('0x2')]},'calleridname':{'type':Sequelize[_0xd6b1('0x2')]},'queue':{'type':Sequelize[_0xd6b1('0x2')]},'interface':{'type':Sequelize[_0xd6b1('0x2')]},'membername':{'type':Sequelize[_0xd6b1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd6b1('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd6b1('0x3')]},'agentcomplete':{'type':Sequelize[_0xd6b1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd6b1('0x4')]},'talktime':{'type':Sequelize[_0xd6b1('0x3')]},'agentacw':{'type':Sequelize[_0xd6b1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd6b1('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd6b1('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd6b1('0x4')]},'agentdump':{'type':Sequelize[_0xd6b1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd6b1('0x4')]},'lastevent':{'type':Sequelize[_0xd6b1('0x2')]},'channel':{'type':Sequelize[_0xd6b1('0x2')]},'channelstate':{'type':Sequelize[_0xd6b1('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd6b1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd6b1('0x2')]},'priority':{'type':Sequelize[_0xd6b1('0x2')]},'destchannel':{'type':Sequelize[_0xd6b1('0x2')]},'destchannelstate':{'type':Sequelize[_0xd6b1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd6b1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd6b1('0x2')]},'destcalleridname':{'type':Sequelize[_0xd6b1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd6b1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd6b1('0x2')]},'destlanguage':{'type':Sequelize[_0xd6b1('0x2')]},'destaccountcode':{'type':Sequelize[_0xd6b1('0x2')]},'destcontext':{'type':Sequelize[_0xd6b1('0x2')]},'destexten':{'type':Sequelize[_0xd6b1('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd6b1('0x2')]},'messageId':{'type':Sequelize[_0xd6b1('0x2')]},'inReplyTo':{'type':Sequelize[_0xd6b1('0x2')]},'subject':{'type':Sequelize[_0xd6b1('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd6b1('0x2')]},'cc':{'type':Sequelize[_0xd6b1('0x2')]},'attachment':{'type':Sequelize[_0xd6b1('0x6')]},'html':{'type':Sequelize[_0xd6b1('0x6')]},'text':{'type':Sequelize[_0xd6b1('0x6')]},'status':{'type':Sequelize[_0xd6b1('0x7')](_0xd6b1('0x8'),'SENDING',_0xd6b1('0x9'),_0xd6b1('0xa'))},'url':{'type':Sequelize[_0xd6b1('0x2')]},'app':{'type':Sequelize[_0xd6b1('0x2')]},'appdata':{'type':Sequelize[_0xd6b1('0x2')]},'projectId':{'type':Sequelize[_0xd6b1('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a4692bb..875b704 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 _0x369e=['create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','then','error','name','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','IntegrationReport','count','include','catch','show','params','includeAll','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x369e,0x1e7));var _0xe369=function(_0xc07088,_0x504f6c){_0xc07088=_0xc07088-0x0;var _0x4ec332=_0x369e[_0xc07088];return _0x4ec332;};'use strict';var pdf=require(_0xe369('0x0'));var emlformat=require(_0xe369('0x1'));var rimraf=require(_0xe369('0x2'));var zipdir=require(_0xe369('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe369('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe369('0x5'));var util=require(_0xe369('0x6'));var path=require(_0xe369('0x7'));var sox=require(_0xe369('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe369('0x9'));var squel=require(_0xe369('0xa'));var crypto=require(_0xe369('0xb'));var jsforce=require(_0xe369('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe369('0xd'));var Papa=require(_0xe369('0xe'));var Redis=require('ioredis');var authService=require(_0xe369('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe369('0x10'));var logger=require(_0xe369('0x11'))(_0xe369('0x12'));var utils=require(_0xe369('0x13'));var config=require(_0xe369('0x14'));var db=require(_0xe369('0x15'))['db'];function respondWithStatusCode(_0x4c64ca,_0x82ecad){_0x82ecad=_0x82ecad||0xcc;return function(_0x1bfff0){if(_0x1bfff0){return _0x4c64ca[_0xe369('0x16')](_0x82ecad);}return _0x4c64ca[_0xe369('0x17')](_0x82ecad)[_0xe369('0x18')]();};}function respondWithResult(_0x4e4ad8,_0x1e4544){_0x1e4544=_0x1e4544||0xc8;return function(_0x73690f){if(_0x73690f){return _0x4e4ad8['status'](_0x1e4544)['json'](_0x73690f);}};}function respondWithFilteredResult(_0x2ca767,_0x3eca20){return function(_0x9aff9a){if(_0x9aff9a){var _0xe82b53=_0x9aff9a['count'],_0x192e5f=_0x3eca20[_0xe369('0x19')],_0x534b0a=_0x3eca20[_0xe369('0x19')]+_0x3eca20['limit'],_0x228070;if(_0x534b0a>=_0xe82b53){_0x534b0a=_0xe82b53;_0x228070=0xc8;}else{_0x228070=0xce;}_0x2ca767[_0xe369('0x17')](_0x228070);return _0x2ca767[_0xe369('0x1a')](_0xe369('0x1b'),_0x192e5f+'-'+_0x534b0a+'/'+_0xe82b53)[_0xe369('0x1c')](_0x9aff9a);}return null;};}function patchUpdates(_0x1d7c8c){return function(_0x8dca97){try{jsonpatch[_0xe369('0x1d')](_0x8dca97,_0x1d7c8c,!![]);}catch(_0x2ac7ee){return BPromise[_0xe369('0x1e')](_0x2ac7ee);}return _0x8dca97[_0xe369('0x1f')]();};}function saveUpdates(_0xb77ec6,_0x455bf5){return function(_0x11e84a){if(_0x11e84a){return _0x11e84a['update'](_0xb77ec6)['then'](function(_0x50e25f){return _0x50e25f;});}return null;};}function removeEntity(_0x2d5b3e,_0x18d1cc){return function(_0x323adc){if(_0x323adc){return _0x323adc[_0xe369('0x20')]()[_0xe369('0x21')](function(){_0x2d5b3e[_0xe369('0x17')](0xcc)[_0xe369('0x18')]();});}};}function handleEntityNotFound(_0x1c1fa2,_0x9aa233){return function(_0x53ce71){if(!_0x53ce71){_0x1c1fa2['sendStatus'](0x194);}return _0x53ce71;};}function handleError(_0x5b8548,_0x49404c){_0x49404c=_0x49404c||0x1f4;return function(_0x4d0011){logger[_0xe369('0x22')](_0x4d0011['stack']);if(_0x4d0011[_0xe369('0x23')]){delete _0x4d0011[_0xe369('0x23')];}_0x5b8548['status'](_0x49404c)['send'](_0x4d0011);};}exports['index']=function(_0x211857,_0x12d194){var _0x172ec3={},_0x39a91a={},_0x1c2046={'count':0x0,'rows':[]};var _0xadcf20=_[_0xe369('0x24')](db['IntegrationReport'][_0xe369('0x25')],function(_0x4aa47f){return{'name':_0x4aa47f[_0xe369('0x26')],'type':_0x4aa47f[_0xe369('0x27')][_0xe369('0x28')]};});_0x39a91a[_0xe369('0x29')]=_[_0xe369('0x24')](_0xadcf20,'name');_0x39a91a['query']=_[_0xe369('0x2a')](_0x211857['query']);_0x39a91a[_0xe369('0x2b')]=_['intersection'](_0x39a91a[_0xe369('0x29')],_0x39a91a[_0xe369('0x2c')]);_0x172ec3[_0xe369('0x2d')]=_[_0xe369('0x2e')](_0x39a91a[_0xe369('0x29')],qs[_0xe369('0x2f')](_0x211857[_0xe369('0x2c')][_0xe369('0x2f')]));_0x172ec3[_0xe369('0x2d')]=_0x172ec3['attributes'][_0xe369('0x30')]?_0x172ec3['attributes']:_0x39a91a[_0xe369('0x29')];if(!_0x211857[_0xe369('0x2c')][_0xe369('0x31')](_0xe369('0x32'))){_0x172ec3[_0xe369('0x33')]=qs[_0xe369('0x33')](_0x211857[_0xe369('0x2c')][_0xe369('0x33')]);_0x172ec3[_0xe369('0x19')]=qs['offset'](_0x211857[_0xe369('0x2c')][_0xe369('0x19')]);}_0x172ec3[_0xe369('0x34')]=qs[_0xe369('0x35')](_0x211857[_0xe369('0x2c')][_0xe369('0x35')]);_0x172ec3['where']=qs[_0xe369('0x2b')](_[_0xe369('0x36')](_0x211857['query'],_0x39a91a[_0xe369('0x2b')]),_0xadcf20);if(_0x211857[_0xe369('0x2c')]['filter']){_0x172ec3[_0xe369('0x37')]=_[_0xe369('0x38')](_0x172ec3[_0xe369('0x37')],{'$or':_[_0xe369('0x24')](_0xadcf20,function(_0x2c7103){if(_0x2c7103[_0xe369('0x27')]!=='VIRTUAL'){var _0x43e1d7={};_0x43e1d7[_0x2c7103[_0xe369('0x23')]]={'$like':'%'+_0x211857['query']['filter']+'%'};return _0x43e1d7;}})});}_0x172ec3=_['merge']({},_0x172ec3,_0x211857['options']);var _0x3b8811={'where':_0x172ec3[_0xe369('0x37')]};return db[_0xe369('0x39')][_0xe369('0x3a')](_0x3b8811)[_0xe369('0x21')](function(_0x485724){_0x1c2046[_0xe369('0x3a')]=_0x485724;if(_0x211857['query']['includeAll']){_0x172ec3[_0xe369('0x3b')]=[{'all':!![]}];}return db[_0xe369('0x39')]['findAll'](_0x172ec3);})[_0xe369('0x21')](function(_0x2ce977){_0x1c2046['rows']=_0x2ce977;return _0x1c2046;})[_0xe369('0x21')](respondWithFilteredResult(_0x12d194,_0x172ec3))[_0xe369('0x3c')](handleError(_0x12d194,null));};exports[_0xe369('0x3d')]=function(_0x3f70fb,_0x5969f1){var _0x2d335f={'raw':![],'where':{'id':_0x3f70fb[_0xe369('0x3e')]['id']}},_0x54e38d={};_0x54e38d[_0xe369('0x29')]=_[_0xe369('0x2a')](db['IntegrationReport'][_0xe369('0x25')]);_0x54e38d[_0xe369('0x2c')]=_[_0xe369('0x2a')](_0x3f70fb['query']);_0x54e38d[_0xe369('0x2b')]=_[_0xe369('0x2e')](_0x54e38d['model'],_0x54e38d[_0xe369('0x2c')]);_0x2d335f[_0xe369('0x2d')]=_[_0xe369('0x2e')](_0x54e38d['model'],qs[_0xe369('0x2f')](_0x3f70fb['query'][_0xe369('0x2f')]));_0x2d335f['attributes']=_0x2d335f['attributes'][_0xe369('0x30')]?_0x2d335f[_0xe369('0x2d')]:_0x54e38d[_0xe369('0x29')];if(_0x3f70fb[_0xe369('0x2c')][_0xe369('0x3f')]){_0x2d335f['include']=[{'all':!![]}];}_0x2d335f=_['merge']({},_0x2d335f,_0x3f70fb['options']);return db[_0xe369('0x39')][_0xe369('0x40')](_0x2d335f)[_0xe369('0x21')](handleEntityNotFound(_0x5969f1,null))[_0xe369('0x21')](respondWithResult(_0x5969f1,null))[_0xe369('0x3c')](handleError(_0x5969f1,null));};exports[_0xe369('0x41')]=function(_0x145a2d,_0x1568f6){return db[_0xe369('0x39')]['create'](_0x145a2d[_0xe369('0x42')],{})[_0xe369('0x21')](respondWithResult(_0x1568f6,0xc9))[_0xe369('0x3c')](handleError(_0x1568f6,null));};exports[_0xe369('0x43')]=function(_0x33ae38,_0x230451){if(_0x33ae38[_0xe369('0x42')]['id']){delete _0x33ae38[_0xe369('0x42')]['id'];}return db[_0xe369('0x39')][_0xe369('0x40')]({'where':{'id':_0x33ae38[_0xe369('0x3e')]['id']}})[_0xe369('0x21')](handleEntityNotFound(_0x230451,null))[_0xe369('0x21')](saveUpdates(_0x33ae38[_0xe369('0x42')],null))[_0xe369('0x21')](respondWithResult(_0x230451,null))[_0xe369('0x3c')](handleError(_0x230451,null));};exports[_0xe369('0x20')]=function(_0x5cd8fc,_0x5b0649){return db[_0xe369('0x39')][_0xe369('0x40')]({'where':{'id':_0x5cd8fc[_0xe369('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5b0649,null))[_0xe369('0x21')](removeEntity(_0x5b0649,null))[_0xe369('0x3c')](handleError(_0x5b0649,null));};exports[_0xe369('0x44')]=function(_0xbf87b6,_0x562ce2){return db[_0xe369('0x39')][_0xe369('0x44')]()[_0xe369('0x21')](respondWithResult(_0x562ce2,null))[_0xe369('0x3c')](handleError(_0x562ce2,null));}; \ No newline at end of file +var _0x73f8=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1c2b3a,_0x16ba96){var _0x3f9bcc=function(_0xc82714){while(--_0xc82714){_0x1c2b3a['push'](_0x1c2b3a['shift']());}};_0x3f9bcc(++_0x16ba96);}(_0x73f8,0xcc));var _0x873f=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x73f8[_0x550d12];return _0x12103d;};'use strict';var pdf=require(_0x873f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x873f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x873f('0x2'));var rp=require(_0x873f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x873f('0x4'));var util=require(_0x873f('0x5'));var path=require(_0x873f('0x6'));var sox=require(_0x873f('0x7'));var csv=require(_0x873f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x873f('0x9'));var squel=require(_0x873f('0xa'));var crypto=require('crypto');var jsforce=require(_0x873f('0xb'));var deskjs=require(_0x873f('0xc'));var toCsv=require(_0x873f('0x8'));var querystring=require(_0x873f('0xd'));var Papa=require(_0x873f('0xe'));var Redis=require(_0x873f('0xf'));var authService=require(_0x873f('0x10'));var qs=require(_0x873f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x873f('0x12'));var logger=require('../../config/logger')(_0x873f('0x13'));var utils=require(_0x873f('0x14'));var config=require(_0x873f('0x15'));var db=require(_0x873f('0x16'))['db'];function respondWithStatusCode(_0x43f22d,_0x3c9cb4){_0x3c9cb4=_0x3c9cb4||0xcc;return function(_0x59d174){if(_0x59d174){return _0x43f22d[_0x873f('0x17')](_0x3c9cb4);}return _0x43f22d['status'](_0x3c9cb4)[_0x873f('0x18')]();};}function respondWithResult(_0x194a61,_0xcb9a1d){_0xcb9a1d=_0xcb9a1d||0xc8;return function(_0x58db4b){if(_0x58db4b){return _0x194a61[_0x873f('0x19')](_0xcb9a1d)[_0x873f('0x1a')](_0x58db4b);}};}function respondWithFilteredResult(_0x4ee1ca,_0x2d8f3e){return function(_0xf3b4ad){if(_0xf3b4ad){var _0xcaaff9=_0xf3b4ad[_0x873f('0x1b')],_0x18b206=_0x2d8f3e[_0x873f('0x1c')],_0x36831d=_0x2d8f3e[_0x873f('0x1c')]+_0x2d8f3e['limit'],_0x9e124c;if(_0x36831d>=_0xcaaff9){_0x36831d=_0xcaaff9;_0x9e124c=0xc8;}else{_0x9e124c=0xce;}_0x4ee1ca['status'](_0x9e124c);return _0x4ee1ca['set'](_0x873f('0x1d'),_0x18b206+'-'+_0x36831d+'/'+_0xcaaff9)[_0x873f('0x1a')](_0xf3b4ad);}return null;};}function patchUpdates(_0x525c5b){return function(_0x3175aa){try{jsonpatch['apply'](_0x3175aa,_0x525c5b,!![]);}catch(_0x239ae3){return BPromise[_0x873f('0x1e')](_0x239ae3);}return _0x3175aa[_0x873f('0x1f')]();};}function saveUpdates(_0x297879,_0x4552df){return function(_0x226994){if(_0x226994){return _0x226994['update'](_0x297879)[_0x873f('0x20')](function(_0x5e7324){return _0x5e7324;});}return null;};}function removeEntity(_0x4c7fda,_0x4a035f){return function(_0x138805){if(_0x138805){return _0x138805[_0x873f('0x21')]()[_0x873f('0x20')](function(){_0x4c7fda[_0x873f('0x19')](0xcc)[_0x873f('0x18')]();});}};}function handleEntityNotFound(_0xce28ca,_0x422cc1){return function(_0x2ed74b){if(!_0x2ed74b){_0xce28ca['sendStatus'](0x194);}return _0x2ed74b;};}function handleError(_0x4b8164,_0x10d12d){_0x10d12d=_0x10d12d||0x1f4;return function(_0x33e413){logger[_0x873f('0x22')](_0x33e413[_0x873f('0x23')]);if(_0x33e413[_0x873f('0x24')]){delete _0x33e413[_0x873f('0x24')];}_0x4b8164['status'](_0x10d12d)[_0x873f('0x25')](_0x33e413);};}exports[_0x873f('0x26')]=function(_0x470090,_0x16bca5){var _0x4173f4={},_0xf112cd={},_0x28ddb2={'count':0x0,'rows':[]};var _0x1736b8=_[_0x873f('0x27')](db[_0x873f('0x28')][_0x873f('0x29')],function(_0x5219cf){return{'name':_0x5219cf[_0x873f('0x2a')],'type':_0x5219cf[_0x873f('0x2b')][_0x873f('0x2c')]};});_0xf112cd[_0x873f('0x2d')]=_[_0x873f('0x27')](_0x1736b8,_0x873f('0x24'));_0xf112cd[_0x873f('0x2e')]=_[_0x873f('0x2f')](_0x470090['query']);_0xf112cd[_0x873f('0x30')]=_[_0x873f('0x31')](_0xf112cd[_0x873f('0x2d')],_0xf112cd[_0x873f('0x2e')]);_0x4173f4['attributes']=_[_0x873f('0x31')](_0xf112cd['model'],qs['fields'](_0x470090[_0x873f('0x2e')]['fields']));_0x4173f4[_0x873f('0x32')]=_0x4173f4[_0x873f('0x32')][_0x873f('0x33')]?_0x4173f4['attributes']:_0xf112cd[_0x873f('0x2d')];if(!_0x470090[_0x873f('0x2e')][_0x873f('0x34')](_0x873f('0x35'))){_0x4173f4[_0x873f('0x36')]=qs['limit'](_0x470090[_0x873f('0x2e')][_0x873f('0x36')]);_0x4173f4[_0x873f('0x1c')]=qs[_0x873f('0x1c')](_0x470090[_0x873f('0x2e')]['offset']);}_0x4173f4['order']=qs['sort'](_0x470090['query'][_0x873f('0x37')]);_0x4173f4[_0x873f('0x38')]=qs[_0x873f('0x30')](_[_0x873f('0x39')](_0x470090['query'],_0xf112cd[_0x873f('0x30')]),_0x1736b8);if(_0x470090[_0x873f('0x2e')][_0x873f('0x3a')]){_0x4173f4[_0x873f('0x38')]=_[_0x873f('0x3b')](_0x4173f4[_0x873f('0x38')],{'$or':_[_0x873f('0x27')](_0x1736b8,function(_0x584ada){if(_0x584ada['type']!=='VIRTUAL'){var _0x47f456={};_0x47f456[_0x584ada[_0x873f('0x24')]]={'$like':'%'+_0x470090[_0x873f('0x2e')]['filter']+'%'};return _0x47f456;}})});}_0x4173f4=_[_0x873f('0x3b')]({},_0x4173f4,_0x470090['options']);var _0x253b82={'where':_0x4173f4[_0x873f('0x38')]};return db[_0x873f('0x28')][_0x873f('0x1b')](_0x253b82)[_0x873f('0x20')](function(_0x19bc41){_0x28ddb2['count']=_0x19bc41;if(_0x470090['query'][_0x873f('0x3c')]){_0x4173f4[_0x873f('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x873f('0x3e')](_0x4173f4);})[_0x873f('0x20')](function(_0x2e12d8){_0x28ddb2[_0x873f('0x3f')]=_0x2e12d8;return _0x28ddb2;})[_0x873f('0x20')](respondWithFilteredResult(_0x16bca5,_0x4173f4))[_0x873f('0x40')](handleError(_0x16bca5,null));};exports[_0x873f('0x41')]=function(_0x339428,_0x3ff530){var _0x3a05c7={'raw':![],'where':{'id':_0x339428[_0x873f('0x42')]['id']}},_0x418995={};_0x418995[_0x873f('0x2d')]=_[_0x873f('0x2f')](db['IntegrationReport'][_0x873f('0x29')]);_0x418995[_0x873f('0x2e')]=_[_0x873f('0x2f')](_0x339428[_0x873f('0x2e')]);_0x418995[_0x873f('0x30')]=_[_0x873f('0x31')](_0x418995[_0x873f('0x2d')],_0x418995['query']);_0x3a05c7[_0x873f('0x32')]=_[_0x873f('0x31')](_0x418995['model'],qs['fields'](_0x339428[_0x873f('0x2e')][_0x873f('0x43')]));_0x3a05c7[_0x873f('0x32')]=_0x3a05c7[_0x873f('0x32')][_0x873f('0x33')]?_0x3a05c7[_0x873f('0x32')]:_0x418995['model'];if(_0x339428[_0x873f('0x2e')][_0x873f('0x3c')]){_0x3a05c7[_0x873f('0x3d')]=[{'all':!![]}];}_0x3a05c7=_['merge']({},_0x3a05c7,_0x339428[_0x873f('0x44')]);return db['IntegrationReport'][_0x873f('0x45')](_0x3a05c7)[_0x873f('0x20')](handleEntityNotFound(_0x3ff530,null))[_0x873f('0x20')](respondWithResult(_0x3ff530,null))[_0x873f('0x40')](handleError(_0x3ff530,null));};exports[_0x873f('0x46')]=function(_0x3d188d,_0x3ffa53){return db[_0x873f('0x28')]['create'](_0x3d188d[_0x873f('0x47')],{})[_0x873f('0x20')](respondWithResult(_0x3ffa53,0xc9))['catch'](handleError(_0x3ffa53,null));};exports[_0x873f('0x48')]=function(_0x122c44,_0x1ad9ec){if(_0x122c44[_0x873f('0x47')]['id']){delete _0x122c44['body']['id'];}return db[_0x873f('0x28')][_0x873f('0x45')]({'where':{'id':_0x122c44[_0x873f('0x42')]['id']}})[_0x873f('0x20')](handleEntityNotFound(_0x1ad9ec,null))[_0x873f('0x20')](saveUpdates(_0x122c44['body'],null))['then'](respondWithResult(_0x1ad9ec,null))['catch'](handleError(_0x1ad9ec,null));};exports['destroy']=function(_0x1222c8,_0x233946){return db[_0x873f('0x28')][_0x873f('0x45')]({'where':{'id':_0x1222c8['params']['id']}})[_0x873f('0x20')](handleEntityNotFound(_0x233946,null))[_0x873f('0x20')](removeEntity(_0x233946,null))[_0x873f('0x40')](handleError(_0x233946,null));};exports[_0x873f('0x49')]=function(_0x3776c5,_0x4dc768){return db[_0x873f('0x28')][_0x873f('0x49')]()[_0x873f('0x20')](respondWithResult(_0x4dc768,null))[_0x873f('0x40')](handleError(_0x4dc768,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e69b662..d6b9033 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 _0xa960=['api','bluebird','path','rimraf','./integrationReport.attributes','define','report_integration','lodash'];(function(_0x4b05a1,_0x2fc152){var _0x5a2aba=function(_0x4f09cb){while(--_0x4f09cb){_0x4b05a1['push'](_0x4b05a1['shift']());}};_0x5a2aba(++_0x2fc152);}(_0xa960,0x1cf));var _0x0a96=function(_0x1be94d,_0x3ccbcd){_0x1be94d=_0x1be94d-0x0;var _0x5908a0=_0xa960[_0x1be94d];return _0x5908a0;};'use strict';var _=require(_0x0a96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0a96('0x1'));var moment=require('moment');var BPromise=require(_0x0a96('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a96('0x3'));var rimraf=require(_0x0a96('0x4'));var config=require('../../config/environment');var attributes=require(_0x0a96('0x5'));module['exports']=function(_0x1fcddb,_0x1da89c){return _0x1fcddb[_0x0a96('0x6')]('IntegrationReport',attributes,{'tableName':_0x0a96('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9d5=['../../config/environment','exports','define','IntegrationReport','report_integration','api','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9d5,0x69));var _0x5b9d=function(_0x5089fa,_0x4d6288){_0x5089fa=_0x5089fa-0x0;var _0x4927c3=_0xb9d5[_0x5089fa];return _0x4927c3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5b9d('0x0'));var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rp=require(_0x5b9d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b9d('0x4'));var config=require(_0x5b9d('0x5'));var attributes=require('./integrationReport.attributes');module[_0x5b9d('0x6')]=function(_0x14077d,_0x2c9f90){return _0x14077d[_0x5b9d('0x7')](_0x5b9d('0x8'),attributes,{'tableName':_0x5b9d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a414c46..bccd167 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x52389d,_0x14611c){var _0x4af321=function(_0x5cb002){while(--_0x5cb002){_0x52389d['push'](_0x52389d['shift']());}};_0x4af321(++_0x14611c);}(_0x2032,0xd9));var _0x2203=function(_0x3d3447,_0x54dfb4){_0x3d3447=_0x3d3447-0x0;var _0x4396d1=_0x2032[_0x3d3447];return _0x4396d1;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ 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(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4239bd,_0x1f310b){_0x4239bd=_0x4239bd-0x0;var _0x21f061=_0x0b0e[_0x4239bd];return _0x21f061;};'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 6cf203a..ca60ce8 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(_0x4a6934,_0x1237f4){_0x4a6934=_0x4a6934-0x0;var _0x532acf=_0x55ca[_0x4a6934];return _0x532acf;};'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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x5b30d1,_0x17fe57){var _0x3a25d1=function(_0x4e5e80){while(--_0x4e5e80){_0x5b30d1['push'](_0x5b30d1['shift']());}};_0x3a25d1(++_0x17fe57);}(_0xedd9,0xfc));var _0x9edd=function(_0x4102a9,_0x1d1248){_0x4102a9=_0x4102a9-0x0;var _0x3ceca0=_0xedd9[_0x4102a9];return _0x3ceca0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('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 bf9e278..7b638c7 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 _0x17bb=['exports','STRING','sequelize'];(function(_0x278b09,_0x15449b){var _0xeb6da8=function(_0x1276ca){while(--_0x1276ca){_0x278b09['push'](_0x278b09['shift']());}};_0xeb6da8(++_0x15449b);}(_0x17bb,0x1b8));var _0xb17b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x17bb[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xb17b('0x0'));module[_0xb17b('0x1')]={'name':{'type':Sequelize[_0xb17b('0x2')]},'description':{'type':Sequelize[_0xb17b('0x2')]},'interval':{'type':Sequelize[_0xb17b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xdd85=['STRING','sequelize','exports'];(function(_0x21c434,_0x1addd1){var _0x160266=function(_0x2c6c47){while(--_0x2c6c47){_0x21c434['push'](_0x21c434['shift']());}};_0x160266(++_0x1addd1);}(_0xdd85,0xee));var _0x5dd8=function(_0x1a3691,_0x351ad1){_0x1a3691=_0x1a3691-0x0;var _0x4e0a71=_0xdd85[_0x1a3691];return _0x4e0a71;};'use strict';var Sequelize=require(_0x5dd8('0x0'));module[_0x5dd8('0x1')]={'name':{'type':Sequelize[_0x5dd8('0x2')]},'description':{'type':Sequelize[_0x5dd8('0x2')]},'interval':{'type':Sequelize[_0x5dd8('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 9125214..968b729 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 _0xa4d0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','end','stack','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','Interval','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','order','addIntervals','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4e346a,_0x1ba060){var _0x12ac3a=function(_0xbf09f5){while(--_0xbf09f5){_0x4e346a['push'](_0x4e346a['shift']());}};_0x12ac3a(++_0x1ba060);}(_0xa4d0,0xfd));var _0x0a4d=function(_0x2653d4,_0x4dceb8){_0x2653d4=_0x2653d4-0x0;var _0x37d466=_0xa4d0[_0x2653d4];return _0x37d466;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0a4d('0x0'));var rimraf=require(_0x0a4d('0x1'));var zipdir=require(_0x0a4d('0x2'));var jsonpatch=require(_0x0a4d('0x3'));var rp=require('request-promise');var moment=require(_0x0a4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a4d('0x5'));var util=require(_0x0a4d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0a4d('0x7'));var ejs=require(_0x0a4d('0x8'));var fs=require('fs');var _=require(_0x0a4d('0x9'));var squel=require(_0x0a4d('0xa'));var crypto=require(_0x0a4d('0xb'));var jsforce=require(_0x0a4d('0xc'));var deskjs=require(_0x0a4d('0xd'));var toCsv=require(_0x0a4d('0x7'));var querystring=require(_0x0a4d('0xe'));var Papa=require(_0x0a4d('0xf'));var Redis=require(_0x0a4d('0x10'));var authService=require(_0x0a4d('0x11'));var qs=require(_0x0a4d('0x12'));var as=require(_0x0a4d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a4d('0x14'))('api');var utils=require(_0x0a4d('0x15'));var config=require(_0x0a4d('0x16'));var db=require(_0x0a4d('0x17'))['db'];var extensions=require(_0x0a4d('0x18'));function respondWithStatusCode(_0x1163ee,_0x30d885){_0x30d885=_0x30d885||0xcc;return function(_0x2d71b0){if(_0x2d71b0){return _0x1163ee[_0x0a4d('0x19')](_0x30d885);}return _0x1163ee['status'](_0x30d885)['end']();};}function respondWithResult(_0x512637,_0x248f41){_0x248f41=_0x248f41||0xc8;return function(_0x24bcd6){if(_0x24bcd6){return _0x512637[_0x0a4d('0x1a')](_0x248f41)[_0x0a4d('0x1b')](_0x24bcd6);}};}function respondWithFilteredResult(_0x389e45,_0x5259d6){return function(_0x4c1a8e){if(_0x4c1a8e){var _0x38aee8=_0x4c1a8e[_0x0a4d('0x1c')],_0x10851d=_0x5259d6[_0x0a4d('0x1d')],_0x56a1ce=_0x5259d6[_0x0a4d('0x1d')]+_0x5259d6[_0x0a4d('0x1e')],_0x572255;if(_0x56a1ce>=_0x38aee8){_0x56a1ce=_0x38aee8;_0x572255=0xc8;}else{_0x572255=0xce;}_0x389e45[_0x0a4d('0x1a')](_0x572255);return _0x389e45[_0x0a4d('0x1f')]('Content-Range',_0x10851d+'-'+_0x56a1ce+'/'+_0x38aee8)[_0x0a4d('0x1b')](_0x4c1a8e);}return null;};}function patchUpdates(_0x3c1b28){return function(_0x42657e){try{jsonpatch[_0x0a4d('0x20')](_0x42657e,_0x3c1b28,!![]);}catch(_0x3f7702){return BPromise[_0x0a4d('0x21')](_0x3f7702);}return _0x42657e[_0x0a4d('0x22')]();};}function saveUpdates(_0x437941,_0x3573e9){return function(_0x459271){if(_0x459271){return _0x459271['update'](_0x437941)[_0x0a4d('0x23')](function(_0xb7aa13){return _0xb7aa13;});}return null;};}function removeEntity(_0x29cfc9,_0x10af38){return function(_0x21284d){if(_0x21284d){return _0x21284d[_0x0a4d('0x24')]()[_0x0a4d('0x23')](function(){var _0x185f57=_0x21284d[_0x0a4d('0x25')]({'plain':!![]});var _0x1bc099=_0x0a4d('0x26');return db[_0x0a4d('0x27')][_0x0a4d('0x24')]({'where':{'type':_0x1bc099,'resourceId':_0x185f57['id']}})[_0x0a4d('0x23')](function(){return _0x21284d;});})[_0x0a4d('0x23')](function(){_0x29cfc9['status'](0xcc)[_0x0a4d('0x28')]();});}};}function handleEntityNotFound(_0x2ecb14,_0x4fee8a){return function(_0x3864cc){if(!_0x3864cc){_0x2ecb14[_0x0a4d('0x19')](0x194);}return _0x3864cc;};}function handleError(_0x576173,_0x3d26bb){_0x3d26bb=_0x3d26bb||0x1f4;return function(_0x51246a){logger['error'](_0x51246a[_0x0a4d('0x29')]);if(_0x51246a['name']){delete _0x51246a['name'];}_0x576173[_0x0a4d('0x1a')](_0x3d26bb)['send'](_0x51246a);};}exports['index']=function(_0x42e93c,_0x514183){var _0x367407={},_0x53aebb={},_0x47fd7e={'count':0x0,'rows':[]};var _0x3f4ddd=_[_0x0a4d('0x2a')](db['Interval'][_0x0a4d('0x2b')],function(_0x2a41a4){return{'name':_0x2a41a4[_0x0a4d('0x2c')],'type':_0x2a41a4['type'][_0x0a4d('0x2d')]};});_0x53aebb[_0x0a4d('0x2e')]=_['map'](_0x3f4ddd,_0x0a4d('0x2f'));_0x53aebb[_0x0a4d('0x30')]=_[_0x0a4d('0x31')](_0x42e93c[_0x0a4d('0x30')]);_0x53aebb[_0x0a4d('0x32')]=_[_0x0a4d('0x33')](_0x53aebb[_0x0a4d('0x2e')],_0x53aebb[_0x0a4d('0x30')]);_0x367407[_0x0a4d('0x34')]=_[_0x0a4d('0x33')](_0x53aebb[_0x0a4d('0x2e')],qs[_0x0a4d('0x35')](_0x42e93c['query'][_0x0a4d('0x35')]));_0x367407[_0x0a4d('0x34')]=_0x367407['attributes'][_0x0a4d('0x36')]?_0x367407['attributes']:_0x53aebb[_0x0a4d('0x2e')];if(!_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x37')](_0x0a4d('0x38'))){_0x367407['limit']=qs[_0x0a4d('0x1e')](_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x1e')]);_0x367407[_0x0a4d('0x1d')]=qs['offset'](_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x1d')]);}_0x367407['order']=qs[_0x0a4d('0x39')](_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x39')]);_0x367407[_0x0a4d('0x3a')]=qs[_0x0a4d('0x32')](_[_0x0a4d('0x3b')](_0x42e93c['query'],_0x53aebb['filters']),_0x3f4ddd);if(_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x3c')]){_0x367407[_0x0a4d('0x3a')]=_[_0x0a4d('0x3d')](_0x367407['where'],{'$or':_[_0x0a4d('0x2a')](_0x3f4ddd,function(_0x422d1e){if(_0x422d1e[_0x0a4d('0x3e')]!=='VIRTUAL'){var _0x8ce17b={};_0x8ce17b[_0x422d1e['name']]={'$like':'%'+_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x3c')]+'%'};return _0x8ce17b;}})});}_0x367407=_['merge']({},_0x367407,_0x42e93c[_0x0a4d('0x3f')]);var _0x1d28dd={'where':_0x367407['where']};return db[_0x0a4d('0x40')][_0x0a4d('0x1c')](_0x1d28dd)[_0x0a4d('0x23')](function(_0xd736a5){_0x47fd7e[_0x0a4d('0x1c')]=_0xd736a5;if(_0x42e93c[_0x0a4d('0x30')][_0x0a4d('0x41')]){_0x367407[_0x0a4d('0x42')]=[{'all':!![]}];}return db[_0x0a4d('0x40')][_0x0a4d('0x43')](_0x367407);})[_0x0a4d('0x23')](function(_0x40513e){_0x47fd7e[_0x0a4d('0x44')]=_0x40513e;return _0x47fd7e;})[_0x0a4d('0x23')](respondWithFilteredResult(_0x514183,_0x367407))[_0x0a4d('0x45')](handleError(_0x514183,null));};exports[_0x0a4d('0x46')]=function(_0x481301,_0x3560ee){var _0x7f63aa={'raw':!![],'where':{'id':_0x481301['params']['id']}},_0x2a0198={};_0x2a0198[_0x0a4d('0x2e')]=_['keys'](db['Interval'][_0x0a4d('0x2b')]);_0x2a0198[_0x0a4d('0x30')]=_[_0x0a4d('0x31')](_0x481301[_0x0a4d('0x30')]);_0x2a0198['filters']=_[_0x0a4d('0x33')](_0x2a0198[_0x0a4d('0x2e')],_0x2a0198[_0x0a4d('0x30')]);_0x7f63aa['attributes']=_[_0x0a4d('0x33')](_0x2a0198[_0x0a4d('0x2e')],qs[_0x0a4d('0x35')](_0x481301[_0x0a4d('0x30')]['fields']));_0x7f63aa['attributes']=_0x7f63aa['attributes'][_0x0a4d('0x36')]?_0x7f63aa[_0x0a4d('0x34')]:_0x2a0198[_0x0a4d('0x2e')];if(_0x481301[_0x0a4d('0x30')][_0x0a4d('0x41')]){_0x7f63aa[_0x0a4d('0x42')]=[{'all':!![]}];}_0x7f63aa=_[_0x0a4d('0x3d')]({},_0x7f63aa,_0x481301['options']);return db['Interval'][_0x0a4d('0x47')](_0x7f63aa)['then'](handleEntityNotFound(_0x3560ee,null))['then'](respondWithResult(_0x3560ee,null))[_0x0a4d('0x45')](handleError(_0x3560ee,null));};exports[_0x0a4d('0x48')]=function(_0xbd1e7a,_0x2c3132){return db['Interval'][_0x0a4d('0x48')](_0xbd1e7a['body'],{})[_0x0a4d('0x23')](function(_0x50114a){var _0x490075=_0xbd1e7a[_0x0a4d('0x49')][_0x0a4d('0x25')]({'plain':!![]});if(!_0x490075)throw new Error(_0x0a4d('0x4a'));if(_0x490075[_0x0a4d('0x4b')]==='user'){var _0x2cb359=_0x50114a['get']({'plain':!![]});var _0xc95154=_0x0a4d('0x26');return db[_0x0a4d('0x4c')]['find']({'where':{'name':_0xc95154,'userProfileId':_0x490075[_0x0a4d('0x4d')]},'raw':!![]})[_0x0a4d('0x23')](function(_0x495b16){if(_0x495b16&&_0x495b16[_0x0a4d('0x4e')]===0x0){return db[_0x0a4d('0x27')]['create']({'name':_0x2cb359[_0x0a4d('0x2f')],'resourceId':_0x2cb359['id'],'type':_0x495b16[_0x0a4d('0x2f')],'sectionId':_0x495b16['id']},{})[_0x0a4d('0x23')](function(){return _0x50114a;});}else{return _0x50114a;}})['catch'](function(_0x4f4d92){logger['error'](_0x0a4d('0x4f'),_0x4f4d92);throw _0x4f4d92;});}return _0x50114a;})[_0x0a4d('0x23')](respondWithResult(_0x2c3132,0xc9))[_0x0a4d('0x45')](handleError(_0x2c3132,null));};exports['update']=function(_0x5e83a5,_0x1cec97){if(_0x5e83a5[_0x0a4d('0x50')]['id']){delete _0x5e83a5[_0x0a4d('0x50')]['id'];}return db[_0x0a4d('0x40')][_0x0a4d('0x47')]({'where':{'id':_0x5e83a5[_0x0a4d('0x51')]['id']}})[_0x0a4d('0x23')](handleEntityNotFound(_0x1cec97,null))[_0x0a4d('0x23')](saveUpdates(_0x5e83a5[_0x0a4d('0x50')],null))['then'](respondWithResult(_0x1cec97,null))['catch'](handleError(_0x1cec97,null));};exports[_0x0a4d('0x24')]=function(_0x10fe0a,_0x59a99b){return db[_0x0a4d('0x40')][_0x0a4d('0x47')]({'where':{'id':_0x10fe0a[_0x0a4d('0x51')]['id']}})[_0x0a4d('0x23')](handleEntityNotFound(_0x59a99b,null))[_0x0a4d('0x23')](removeEntity(_0x59a99b,null))[_0x0a4d('0x45')](handleError(_0x59a99b,null));};exports[_0x0a4d('0x52')]=function(_0x1af649,_0x31fb6c,_0x56ee43){if(_0x1af649[_0x0a4d('0x50')]['id']){delete _0x1af649[_0x0a4d('0x50')]['id'];}return db['Interval']['find']({'where':{'id':_0x1af649[_0x0a4d('0x51')]['id']}})[_0x0a4d('0x23')](handleEntityNotFound(_0x31fb6c,null))['then'](function(_0x279ed3){if(_0x279ed3){_0x1af649[_0x0a4d('0x50')]['IntervalId']=_0x279ed3['id'];return db[_0x0a4d('0x40')]['create'](_0x1af649[_0x0a4d('0x50')]);}})[_0x0a4d('0x23')](respondWithResult(_0x31fb6c,null))[_0x0a4d('0x45')](handleError(_0x31fb6c,null));};exports[_0x0a4d('0x53')]=function(_0x462d92,_0x5c44cd,_0x16672c){var _0x101007={};var _0x66bb7a={};var _0x5656f8;var _0x2dc65e;return db[_0x0a4d('0x40')][_0x0a4d('0x54')]({'where':{'id':_0x462d92[_0x0a4d('0x51')]['id']}})[_0x0a4d('0x23')](handleEntityNotFound(_0x5c44cd,null))[_0x0a4d('0x23')](function(_0x23fc94){if(_0x23fc94){_0x5656f8=_0x23fc94;_0x66bb7a['model']=_[_0x0a4d('0x31')](db[_0x0a4d('0x40')][_0x0a4d('0x2b')]);_0x66bb7a[_0x0a4d('0x30')]=_['keys'](_0x462d92[_0x0a4d('0x30')]);_0x66bb7a[_0x0a4d('0x32')]=_[_0x0a4d('0x33')](_0x66bb7a['model'],_0x66bb7a[_0x0a4d('0x30')]);_0x101007['attributes']=_['intersection'](_0x66bb7a['model'],qs[_0x0a4d('0x35')](_0x462d92[_0x0a4d('0x30')]['fields']));_0x101007['attributes']=_0x101007[_0x0a4d('0x34')][_0x0a4d('0x36')]?_0x101007[_0x0a4d('0x34')]:_0x66bb7a[_0x0a4d('0x2e')];_0x101007[_0x0a4d('0x55')]=qs[_0x0a4d('0x39')](_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x39')]);_0x101007['where']=qs[_0x0a4d('0x32')](_['pick'](_0x462d92[_0x0a4d('0x30')],_0x66bb7a[_0x0a4d('0x32')]));if(_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x3c')]){_0x101007[_0x0a4d('0x3a')]=_[_0x0a4d('0x3d')](_0x101007[_0x0a4d('0x3a')],{'$or':_[_0x0a4d('0x2a')](_0x101007[_0x0a4d('0x34')],function(_0x2979d4){var _0xd879c={};_0xd879c[_0x2979d4]={'$like':'%'+_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x3c')]+'%'};return _0xd879c;})});}_0x101007=_['merge']({},_0x101007,_0x462d92['options']);return _0x5656f8[_0x0a4d('0x53')](_0x101007);}})[_0x0a4d('0x23')](function(_0x4a867b){if(_0x4a867b){_0x2dc65e=_0x4a867b['length'];if(!_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x37')](_0x0a4d('0x38'))){_0x101007['limit']=qs[_0x0a4d('0x1e')](_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x1e')]);_0x101007['offset']=qs['offset'](_0x462d92[_0x0a4d('0x30')][_0x0a4d('0x1d')]);}return _0x5656f8[_0x0a4d('0x53')](_0x101007);}})['then'](function(_0x86d0d1){if(_0x86d0d1){return _0x86d0d1?{'count':_0x2dc65e,'rows':_0x86d0d1}:null;}})[_0x0a4d('0x23')](respondWithResult(_0x5c44cd,null))[_0x0a4d('0x45')](handleError(_0x5c44cd,null));};exports[_0x0a4d('0x56')]=function(_0x2f33ae,_0x10e99d,_0x31becc){return db['Interval'][_0x0a4d('0x54')]({'where':{'id':_0x2f33ae[_0x0a4d('0x51')]['id']}})[_0x0a4d('0x23')](handleEntityNotFound(_0x10e99d,null))[_0x0a4d('0x23')](function(_0x597e85){if(_0x597e85){return db['sequelize'][_0x0a4d('0x57')](function(_0x52c9b5){return db[_0x0a4d('0x40')][_0x0a4d('0x24')]({'where':{'IntervalId':_0x2f33ae[_0x0a4d('0x51')]['id']},'transaction':_0x52c9b5})['then'](function(_0x5ac8be){var _0x56a25b=_['map'](_0x2f33ae['body'],function(_0x2f62df){delete _0x2f62df['id'];_0x2f62df[_0x0a4d('0x58')]=_0x2f33ae['params']['id'];return _0x2f62df;});return db[_0x0a4d('0x40')][_0x0a4d('0x59')](_0x56a25b,{'transaction':_0x52c9b5});});})['then'](function(){return db[_0x0a4d('0x40')]['findAll']({'where':{'IntervalId':_0x2f33ae[_0x0a4d('0x51')]['id']}});});}})[_0x0a4d('0x23')](respondWithResult(_0x10e99d,null))[_0x0a4d('0x45')](handleError(_0x10e99d,null));}; \ No newline at end of file +var _0x0019=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','Interval','includeAll','findAll','show','params','length','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','IntervalId','getIntervals','findOne','order','sequelize','transaction','bulkCreate','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters'];(function(_0x3794e2,_0x535b86){var _0x2dc9b8=function(_0x5c8a60){while(--_0x5c8a60){_0x3794e2['push'](_0x3794e2['shift']());}};_0x2dc9b8(++_0x535b86);}(_0x0019,0x135));var _0x9001=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x0019[_0x231a47];return _0x48d7c9;};'use strict';var pdf=require(_0x9001('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9001('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9001('0x2'));var rp=require(_0x9001('0x3'));var moment=require(_0x9001('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9001('0x5'));var util=require(_0x9001('0x6'));var path=require(_0x9001('0x7'));var sox=require(_0x9001('0x8'));var csv=require(_0x9001('0x9'));var ejs=require(_0x9001('0xa'));var fs=require('fs');var _=require(_0x9001('0xb'));var squel=require(_0x9001('0xc'));var crypto=require(_0x9001('0xd'));var jsforce=require(_0x9001('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9001('0x9'));var querystring=require(_0x9001('0xf'));var Papa=require(_0x9001('0x10'));var Redis=require(_0x9001('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9001('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9001('0x13'))('api');var utils=require(_0x9001('0x14'));var config=require('../../config/environment');var db=require(_0x9001('0x15'))['db'];var extensions=require(_0x9001('0x16'));function respondWithStatusCode(_0xc9cdd3,_0x5b580d){_0x5b580d=_0x5b580d||0xcc;return function(_0x2d16cb){if(_0x2d16cb){return _0xc9cdd3[_0x9001('0x17')](_0x5b580d);}return _0xc9cdd3[_0x9001('0x18')](_0x5b580d)[_0x9001('0x19')]();};}function respondWithResult(_0x5b42c6,_0x4b3226){_0x4b3226=_0x4b3226||0xc8;return function(_0x825d2d){if(_0x825d2d){return _0x5b42c6[_0x9001('0x18')](_0x4b3226)[_0x9001('0x1a')](_0x825d2d);}};}function respondWithFilteredResult(_0x2a510b,_0x3e830b){return function(_0xf2f2e7){if(_0xf2f2e7){var _0x553495=_0xf2f2e7[_0x9001('0x1b')],_0x22db9b=_0x3e830b[_0x9001('0x1c')],_0x1a971a=_0x3e830b[_0x9001('0x1c')]+_0x3e830b[_0x9001('0x1d')],_0x404f97;if(_0x1a971a>=_0x553495){_0x1a971a=_0x553495;_0x404f97=0xc8;}else{_0x404f97=0xce;}_0x2a510b[_0x9001('0x18')](_0x404f97);return _0x2a510b[_0x9001('0x1e')](_0x9001('0x1f'),_0x22db9b+'-'+_0x1a971a+'/'+_0x553495)[_0x9001('0x1a')](_0xf2f2e7);}return null;};}function patchUpdates(_0x507d48){return function(_0x55e47d){try{jsonpatch[_0x9001('0x20')](_0x55e47d,_0x507d48,!![]);}catch(_0x53a775){return BPromise[_0x9001('0x21')](_0x53a775);}return _0x55e47d[_0x9001('0x22')]();};}function saveUpdates(_0x2cee80,_0x92c1dc){return function(_0x1de47d){if(_0x1de47d){return _0x1de47d['update'](_0x2cee80)[_0x9001('0x23')](function(_0x2fc13c){return _0x2fc13c;});}return null;};}function removeEntity(_0x5e793a,_0x39b4cc){return function(_0x4f89d0){if(_0x4f89d0){return _0x4f89d0[_0x9001('0x24')]()[_0x9001('0x23')](function(){var _0x207432=_0x4f89d0[_0x9001('0x25')]({'plain':!![]});var _0x28515b='Intervals';return db[_0x9001('0x26')]['destroy']({'where':{'type':_0x28515b,'resourceId':_0x207432['id']}})['then'](function(){return _0x4f89d0;});})['then'](function(){_0x5e793a[_0x9001('0x18')](0xcc)[_0x9001('0x19')]();});}};}function handleEntityNotFound(_0xec77f3,_0x15f61e){return function(_0x1e0504){if(!_0x1e0504){_0xec77f3['sendStatus'](0x194);}return _0x1e0504;};}function handleError(_0x5e3272,_0x578c1c){_0x578c1c=_0x578c1c||0x1f4;return function(_0x1064c3){logger[_0x9001('0x27')](_0x1064c3[_0x9001('0x28')]);if(_0x1064c3[_0x9001('0x29')]){delete _0x1064c3['name'];}_0x5e3272[_0x9001('0x18')](_0x578c1c)['send'](_0x1064c3);};}exports[_0x9001('0x2a')]=function(_0x16f723,_0x3bde37){var _0x26997c={},_0x496c0b={},_0x460b06={'count':0x0,'rows':[]};var _0x1164c6=_['map'](db['Interval'][_0x9001('0x2b')],function(_0x40d065){return{'name':_0x40d065[_0x9001('0x2c')],'type':_0x40d065['type'][_0x9001('0x2d')]};});_0x496c0b[_0x9001('0x2e')]=_[_0x9001('0x2f')](_0x1164c6,_0x9001('0x29'));_0x496c0b['query']=_[_0x9001('0x30')](_0x16f723[_0x9001('0x31')]);_0x496c0b[_0x9001('0x32')]=_[_0x9001('0x33')](_0x496c0b[_0x9001('0x2e')],_0x496c0b['query']);_0x26997c[_0x9001('0x34')]=_[_0x9001('0x33')](_0x496c0b[_0x9001('0x2e')],qs[_0x9001('0x35')](_0x16f723[_0x9001('0x31')][_0x9001('0x35')]));_0x26997c[_0x9001('0x34')]=_0x26997c[_0x9001('0x34')]['length']?_0x26997c[_0x9001('0x34')]:_0x496c0b[_0x9001('0x2e')];if(!_0x16f723[_0x9001('0x31')][_0x9001('0x36')](_0x9001('0x37'))){_0x26997c[_0x9001('0x1d')]=qs[_0x9001('0x1d')](_0x16f723[_0x9001('0x31')][_0x9001('0x1d')]);_0x26997c[_0x9001('0x1c')]=qs[_0x9001('0x1c')](_0x16f723[_0x9001('0x31')][_0x9001('0x1c')]);}_0x26997c['order']=qs[_0x9001('0x38')](_0x16f723[_0x9001('0x31')][_0x9001('0x38')]);_0x26997c['where']=qs[_0x9001('0x32')](_[_0x9001('0x39')](_0x16f723[_0x9001('0x31')],_0x496c0b[_0x9001('0x32')]),_0x1164c6);if(_0x16f723[_0x9001('0x31')][_0x9001('0x3a')]){_0x26997c[_0x9001('0x3b')]=_[_0x9001('0x3c')](_0x26997c[_0x9001('0x3b')],{'$or':_['map'](_0x1164c6,function(_0x2f067d){if(_0x2f067d['type']!=='VIRTUAL'){var _0x29828f={};_0x29828f[_0x2f067d[_0x9001('0x29')]]={'$like':'%'+_0x16f723['query']['filter']+'%'};return _0x29828f;}})});}_0x26997c=_[_0x9001('0x3c')]({},_0x26997c,_0x16f723[_0x9001('0x3d')]);var _0x192f04={'where':_0x26997c['where']};return db[_0x9001('0x3e')][_0x9001('0x1b')](_0x192f04)[_0x9001('0x23')](function(_0x24dab7){_0x460b06[_0x9001('0x1b')]=_0x24dab7;if(_0x16f723[_0x9001('0x31')][_0x9001('0x3f')]){_0x26997c['include']=[{'all':!![]}];}return db[_0x9001('0x3e')][_0x9001('0x40')](_0x26997c);})[_0x9001('0x23')](function(_0x5a2af6){_0x460b06['rows']=_0x5a2af6;return _0x460b06;})[_0x9001('0x23')](respondWithFilteredResult(_0x3bde37,_0x26997c))['catch'](handleError(_0x3bde37,null));};exports[_0x9001('0x41')]=function(_0x264ad4,_0x447616){var _0x422e90={'raw':!![],'where':{'id':_0x264ad4[_0x9001('0x42')]['id']}},_0x5e4def={};_0x5e4def[_0x9001('0x2e')]=_[_0x9001('0x30')](db[_0x9001('0x3e')][_0x9001('0x2b')]);_0x5e4def[_0x9001('0x31')]=_['keys'](_0x264ad4[_0x9001('0x31')]);_0x5e4def[_0x9001('0x32')]=_[_0x9001('0x33')](_0x5e4def['model'],_0x5e4def[_0x9001('0x31')]);_0x422e90['attributes']=_[_0x9001('0x33')](_0x5e4def[_0x9001('0x2e')],qs[_0x9001('0x35')](_0x264ad4[_0x9001('0x31')][_0x9001('0x35')]));_0x422e90[_0x9001('0x34')]=_0x422e90['attributes'][_0x9001('0x43')]?_0x422e90[_0x9001('0x34')]:_0x5e4def[_0x9001('0x2e')];if(_0x264ad4[_0x9001('0x31')][_0x9001('0x3f')]){_0x422e90[_0x9001('0x44')]=[{'all':!![]}];}_0x422e90=_[_0x9001('0x3c')]({},_0x422e90,_0x264ad4[_0x9001('0x3d')]);return db[_0x9001('0x3e')][_0x9001('0x45')](_0x422e90)[_0x9001('0x23')](handleEntityNotFound(_0x447616,null))['then'](respondWithResult(_0x447616,null))[_0x9001('0x46')](handleError(_0x447616,null));};exports[_0x9001('0x47')]=function(_0x395f24,_0x25c659){return db[_0x9001('0x3e')][_0x9001('0x47')](_0x395f24['body'],{})[_0x9001('0x23')](function(_0x22a2c5){var _0x3d3c6e=_0x395f24[_0x9001('0x48')]['get']({'plain':!![]});if(!_0x3d3c6e)throw new Error(_0x9001('0x49'));if(_0x3d3c6e[_0x9001('0x4a')]==='user'){var _0x20c0ce=_0x22a2c5[_0x9001('0x25')]({'plain':!![]});var _0xfc5cd4=_0x9001('0x4b');return db[_0x9001('0x4c')][_0x9001('0x45')]({'where':{'name':_0xfc5cd4,'userProfileId':_0x3d3c6e[_0x9001('0x4d')]},'raw':!![]})[_0x9001('0x23')](function(_0xef9ff4){if(_0xef9ff4&&_0xef9ff4[_0x9001('0x4e')]===0x0){return db[_0x9001('0x26')]['create']({'name':_0x20c0ce['name'],'resourceId':_0x20c0ce['id'],'type':_0xef9ff4['name'],'sectionId':_0xef9ff4['id']},{})['then'](function(){return _0x22a2c5;});}else{return _0x22a2c5;}})[_0x9001('0x46')](function(_0x306468){logger[_0x9001('0x27')](_0x9001('0x4f'),_0x306468);throw _0x306468;});}return _0x22a2c5;})[_0x9001('0x23')](respondWithResult(_0x25c659,0xc9))[_0x9001('0x46')](handleError(_0x25c659,null));};exports[_0x9001('0x50')]=function(_0x3a8834,_0x34c6aa){if(_0x3a8834[_0x9001('0x51')]['id']){delete _0x3a8834[_0x9001('0x51')]['id'];}return db[_0x9001('0x3e')][_0x9001('0x45')]({'where':{'id':_0x3a8834[_0x9001('0x42')]['id']}})['then'](handleEntityNotFound(_0x34c6aa,null))[_0x9001('0x23')](saveUpdates(_0x3a8834[_0x9001('0x51')],null))[_0x9001('0x23')](respondWithResult(_0x34c6aa,null))[_0x9001('0x46')](handleError(_0x34c6aa,null));};exports['destroy']=function(_0x9bbe46,_0x101824){return db[_0x9001('0x3e')]['find']({'where':{'id':_0x9bbe46[_0x9001('0x42')]['id']}})['then'](handleEntityNotFound(_0x101824,null))[_0x9001('0x23')](removeEntity(_0x101824,null))[_0x9001('0x46')](handleError(_0x101824,null));};exports[_0x9001('0x52')]=function(_0x3c1e78,_0x3fd213,_0xcae0ef){if(_0x3c1e78[_0x9001('0x51')]['id']){delete _0x3c1e78[_0x9001('0x51')]['id'];}return db[_0x9001('0x3e')]['find']({'where':{'id':_0x3c1e78[_0x9001('0x42')]['id']}})[_0x9001('0x23')](handleEntityNotFound(_0x3fd213,null))[_0x9001('0x23')](function(_0x17b197){if(_0x17b197){_0x3c1e78[_0x9001('0x51')][_0x9001('0x53')]=_0x17b197['id'];return db['Interval']['create'](_0x3c1e78[_0x9001('0x51')]);}})[_0x9001('0x23')](respondWithResult(_0x3fd213,null))[_0x9001('0x46')](handleError(_0x3fd213,null));};exports[_0x9001('0x54')]=function(_0x4fb82a,_0x33046b,_0x4c92f4){var _0x380e73={};var _0x294075={};var _0x208db7;var _0xc0d95e;return db[_0x9001('0x3e')][_0x9001('0x55')]({'where':{'id':_0x4fb82a[_0x9001('0x42')]['id']}})['then'](handleEntityNotFound(_0x33046b,null))[_0x9001('0x23')](function(_0x4d7999){if(_0x4d7999){_0x208db7=_0x4d7999;_0x294075[_0x9001('0x2e')]=_['keys'](db[_0x9001('0x3e')][_0x9001('0x2b')]);_0x294075['query']=_[_0x9001('0x30')](_0x4fb82a[_0x9001('0x31')]);_0x294075['filters']=_[_0x9001('0x33')](_0x294075['model'],_0x294075[_0x9001('0x31')]);_0x380e73[_0x9001('0x34')]=_['intersection'](_0x294075[_0x9001('0x2e')],qs[_0x9001('0x35')](_0x4fb82a[_0x9001('0x31')][_0x9001('0x35')]));_0x380e73[_0x9001('0x34')]=_0x380e73[_0x9001('0x34')][_0x9001('0x43')]?_0x380e73[_0x9001('0x34')]:_0x294075[_0x9001('0x2e')];_0x380e73[_0x9001('0x56')]=qs[_0x9001('0x38')](_0x4fb82a[_0x9001('0x31')][_0x9001('0x38')]);_0x380e73[_0x9001('0x3b')]=qs[_0x9001('0x32')](_[_0x9001('0x39')](_0x4fb82a[_0x9001('0x31')],_0x294075[_0x9001('0x32')]));if(_0x4fb82a[_0x9001('0x31')][_0x9001('0x3a')]){_0x380e73['where']=_[_0x9001('0x3c')](_0x380e73[_0x9001('0x3b')],{'$or':_[_0x9001('0x2f')](_0x380e73[_0x9001('0x34')],function(_0x307cdb){var _0x1035b5={};_0x1035b5[_0x307cdb]={'$like':'%'+_0x4fb82a[_0x9001('0x31')][_0x9001('0x3a')]+'%'};return _0x1035b5;})});}_0x380e73=_[_0x9001('0x3c')]({},_0x380e73,_0x4fb82a[_0x9001('0x3d')]);return _0x208db7[_0x9001('0x54')](_0x380e73);}})[_0x9001('0x23')](function(_0x20aa73){if(_0x20aa73){_0xc0d95e=_0x20aa73['length'];if(!_0x4fb82a['query'][_0x9001('0x36')]('nolimit')){_0x380e73['limit']=qs['limit'](_0x4fb82a[_0x9001('0x31')][_0x9001('0x1d')]);_0x380e73[_0x9001('0x1c')]=qs['offset'](_0x4fb82a[_0x9001('0x31')][_0x9001('0x1c')]);}return _0x208db7['getIntervals'](_0x380e73);}})[_0x9001('0x23')](function(_0x472a0f){if(_0x472a0f){return _0x472a0f?{'count':_0xc0d95e,'rows':_0x472a0f}:null;}})[_0x9001('0x23')](respondWithResult(_0x33046b,null))[_0x9001('0x46')](handleError(_0x33046b,null));};exports['addIntervals']=function(_0x1b0024,_0x45df63,_0x7b5f2a){return db[_0x9001('0x3e')]['findOne']({'where':{'id':_0x1b0024[_0x9001('0x42')]['id']}})[_0x9001('0x23')](handleEntityNotFound(_0x45df63,null))['then'](function(_0x56da50){if(_0x56da50){return db[_0x9001('0x57')][_0x9001('0x58')](function(_0x245e1a){return db[_0x9001('0x3e')][_0x9001('0x24')]({'where':{'IntervalId':_0x1b0024[_0x9001('0x42')]['id']},'transaction':_0x245e1a})[_0x9001('0x23')](function(_0x3e8fbc){var _0xa87b9e=_[_0x9001('0x2f')](_0x1b0024[_0x9001('0x51')],function(_0x4ded58){delete _0x4ded58['id'];_0x4ded58[_0x9001('0x53')]=_0x1b0024['params']['id'];return _0x4ded58;});return db[_0x9001('0x3e')][_0x9001('0x59')](_0xa87b9e,{'transaction':_0x245e1a});});})[_0x9001('0x23')](function(){return db['Interval'][_0x9001('0x40')]({'where':{'IntervalId':_0x1b0024[_0x9001('0x42')]['id']}});});}})[_0x9001('0x23')](respondWithResult(_0x45df63,null))[_0x9001('0x46')](handleError(_0x45df63,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 53dcd53..805bb36 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 _0x63eb=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x535db7,_0x5b9ff7){var _0x236546=function(_0x2ddeda){while(--_0x2ddeda){_0x535db7['push'](_0x535db7['shift']());}};_0x236546(++_0x5b9ff7);}(_0x63eb,0x90));var _0xb63e=function(_0x1f4af5,_0x2b9538){_0x1f4af5=_0x1f4af5-0x0;var _0x28e298=_0x63eb[_0x1f4af5];return _0x28e298;};'use strict';var _=require(_0xb63e('0x0'));var util=require(_0xb63e('0x1'));var logger=require(_0xb63e('0x2'))(_0xb63e('0x3'));var moment=require(_0xb63e('0x4'));var BPromise=require(_0xb63e('0x5'));var rp=require(_0xb63e('0x6'));var fs=require('fs');var path=require(_0xb63e('0x7'));var rimraf=require(_0xb63e('0x8'));var config=require(_0xb63e('0x9'));var attributes=require(_0xb63e('0xa'));var extensions=require(_0xb63e('0xb'));module[_0xb63e('0xc')]=function(_0x1c5849,_0x456ca3){return _0x1c5849[_0xb63e('0xd')](_0xb63e('0xe'),attributes,{'tableName':_0xb63e('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x199b7b,_0xf4dcb6){extensions[_0xb63e('0x10')](_0x1c5849,_0x199b7b);},'afterBulkCreate':function(_0x4c22a2,_0x43e36e,_0x482454){_0x482454();extensions[_0xb63e('0x10')](_0x1c5849,_0x4c22a2[0x0]);},'afterUpdate':function(_0x2bb21e,_0x3739eb){extensions['rewrite'](_0x1c5849,_0x2bb21e);},'afterDestroy':function(_0x2c62d1,_0x11b84d){extensions[_0xb63e('0x10')](_0x1c5849,_0x2c62d1);}}});}; \ No newline at end of file +var _0x37a4=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash'];(function(_0x1b268d,_0x59faf4){var _0x424d7a=function(_0xee793f){while(--_0xee793f){_0x1b268d['push'](_0x1b268d['shift']());}};_0x424d7a(++_0x59faf4);}(_0x37a4,0xcb));var _0x437a=function(_0x5a3978,_0x1822cc){_0x5a3978=_0x5a3978-0x0;var _0x4ff8c9=_0x37a4[_0x5a3978];return _0x4ff8c9;};'use strict';var _=require(_0x437a('0x0'));var util=require('util');var logger=require(_0x437a('0x1'))('api');var moment=require(_0x437a('0x2'));var BPromise=require(_0x437a('0x3'));var rp=require(_0x437a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x437a('0x5'));var attributes=require(_0x437a('0x6'));var extensions=require(_0x437a('0x7'));module[_0x437a('0x8')]=function(_0x5f5067,_0x1c567f){return _0x5f5067[_0x437a('0x9')]('Interval',attributes,{'tableName':_0x437a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15ac16,_0x2fe1a5){extensions[_0x437a('0xb')](_0x5f5067,_0x15ac16);},'afterBulkCreate':function(_0xb81523,_0x24d3a9,_0x294d71){_0x294d71();extensions[_0x437a('0xb')](_0x5f5067,_0xb81523[0x0]);},'afterUpdate':function(_0x26832b,_0xea841e){extensions[_0x437a('0xb')](_0x5f5067,_0x26832b);},'afterDestroy':function(_0x581d9a,_0x23f321){extensions[_0x437a('0xb')](_0x5f5067,_0x581d9a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 28560c9..691759d 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 _0x93a5=['request\x20sent','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','limit','model','attributes','include','map','ShowInterval','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1afe28,_0x4b5d6a){var _0x3d0e58=function(_0x5be079){while(--_0x5be079){_0x1afe28['push'](_0x1afe28['shift']());}};_0x3d0e58(++_0x4b5d6a);}(_0x93a5,0x194));var _0x593a=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x93a5[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require(_0x593a('0x0'));var moment=require(_0x593a('0x1'));var BPromise=require(_0x593a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x593a('0x3'));var db=require(_0x593a('0x4'))['db'];var utils=require(_0x593a('0x5'));var logger=require(_0x593a('0x6'))(_0x593a('0x7'));var config=require('../../config/environment');var jayson=require(_0x593a('0x8'));var client=jayson['client'][_0x593a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf55f,_0x32711f,_0x3b388d){return new BPromise(function(_0x54cbb7,_0x4b3d54){return client[_0x593a('0xa')](_0x3bf55f,_0x3b388d)[_0x593a('0xb')](function(_0x36d9d8){logger[_0x593a('0xc')](_0x593a('0xd'),_0x32711f,'request\x20sent');logger[_0x593a('0xe')](_0x593a('0xf'),_0x32711f,_0x593a('0x10'),JSON[_0x593a('0x11')](_0x36d9d8));if(_0x36d9d8['error']){if(_0x36d9d8[_0x593a('0x12')][_0x593a('0x13')]===0x1f4){logger[_0x593a('0x12')](_0x593a('0xd'),_0x32711f,_0x36d9d8[_0x593a('0x12')]['message']);return _0x4b3d54(_0x36d9d8['error'][_0x593a('0x14')]);}logger[_0x593a('0x12')]('Interval,\x20%s,\x20%s',_0x32711f,_0x36d9d8[_0x593a('0x12')][_0x593a('0x14')]);return _0x54cbb7(_0x36d9d8[_0x593a('0x12')][_0x593a('0x14')]);}else{logger[_0x593a('0xc')](_0x593a('0xd'),_0x32711f,'request\x20sent');_0x54cbb7(_0x36d9d8[_0x593a('0x15')][_0x593a('0x14')]);}})[_0x593a('0x16')](function(_0x5cd517){logger[_0x593a('0x12')](_0x593a('0xd'),_0x32711f,_0x5cd517);_0x4b3d54(_0x5cd517);});});}exports[_0x593a('0x17')]=function(_0x5d2b7b){var _0x20b1d3=this;return new Promise(function(_0x1d3343,_0x36cfd9){return db[_0x593a('0x18')][_0x593a('0x19')]({'raw':_0x5d2b7b['options']?_0x5d2b7b[_0x593a('0x1a')][_0x593a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d2b7b[_0x593a('0x1a')]?_0x5d2b7b[_0x593a('0x1a')][_0x593a('0x1c')]||null:null,'attributes':_0x5d2b7b[_0x593a('0x1a')]?_0x5d2b7b[_0x593a('0x1a')]['attributes']||null:null,'limit':_0x5d2b7b[_0x593a('0x1a')]?_0x5d2b7b[_0x593a('0x1a')][_0x593a('0x1d')]||null:null,'include':_0x5d2b7b[_0x593a('0x1a')]?_0x5d2b7b[_0x593a('0x1a')]['include']?_['map'](_0x5d2b7b['options']['include'],function(_0x105161){return{'model':db[_0x105161[_0x593a('0x1e')]],'as':_0x105161['as'],'attributes':_0x105161[_0x593a('0x1f')],'include':_0x105161[_0x593a('0x20')]?_[_0x593a('0x21')](_0x105161[_0x593a('0x20')],function(_0x3ec68e){return{'model':db[_0x3ec68e[_0x593a('0x1e')]],'as':_0x3ec68e['as'],'attributes':_0x3ec68e[_0x593a('0x1f')],'include':_0x3ec68e[_0x593a('0x20')]?_[_0x593a('0x21')](_0x3ec68e[_0x593a('0x20')],function(_0x187f54){return{'model':db[_0x187f54[_0x593a('0x1e')]],'as':_0x187f54['as'],'attributes':_0x187f54[_0x593a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x593a('0xb')](function(_0x53ab77){logger[_0x593a('0xc')]('GetInterval',_0x5d2b7b);logger[_0x593a('0xe')](_0x593a('0x17'),_0x5d2b7b,JSON['stringify'](_0x53ab77));_0x1d3343(_0x53ab77);})['catch'](function(_0x47c772){logger[_0x593a('0x12')](_0x593a('0x17'),_0x47c772['message'],_0x5d2b7b);_0x36cfd9(_0x20b1d3[_0x593a('0x12')](0x1f4,_0x47c772[_0x593a('0x14')]));});});};exports[_0x593a('0x22')]=function(_0x2e588d){var _0x329b3b=this;return new Promise(function(_0x43fb7b,_0x3906bb){return db[_0x593a('0x18')]['find']({'raw':_0x2e588d[_0x593a('0x1a')]?_0x2e588d[_0x593a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2e588d['options']?_0x2e588d[_0x593a('0x1a')][_0x593a('0x1c')]||null:null,'attributes':_0x2e588d[_0x593a('0x1a')]?_0x2e588d['options']['attributes']||null:null,'include':_0x2e588d[_0x593a('0x1a')]?_0x2e588d['options']['include']?_['map'](_0x2e588d[_0x593a('0x1a')][_0x593a('0x20')],function(_0x11d89b){return{'model':db[_0x11d89b['model']],'as':_0x11d89b['as'],'attributes':_0x11d89b['attributes'],'include':_0x11d89b[_0x593a('0x20')]?_['map'](_0x11d89b[_0x593a('0x20')],function(_0x532d32){return{'model':db[_0x532d32[_0x593a('0x1e')]],'as':_0x532d32['as'],'attributes':_0x532d32[_0x593a('0x1f')],'include':_0x532d32[_0x593a('0x20')]?_[_0x593a('0x21')](_0x532d32[_0x593a('0x20')],function(_0x42c992){return{'model':db[_0x42c992['model']],'as':_0x42c992['as'],'attributes':_0x42c992[_0x593a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x593a('0xb')](function(_0x5acc9c){logger[_0x593a('0xc')]('ShowInterval',_0x2e588d);logger[_0x593a('0xe')](_0x593a('0x22'),_0x2e588d,JSON['stringify'](_0x5acc9c));_0x43fb7b(_0x5acc9c);})['catch'](function(_0x113fe2){logger[_0x593a('0x12')](_0x593a('0x22'),_0x113fe2[_0x593a('0x14')],_0x2e588d);_0x3906bb(_0x329b3b[_0x593a('0x12')](0x1f4,_0x113fe2['message']));});});}; \ No newline at end of file +var _0x63ab=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetInterval','Interval','raw','options','where','limit','map','include','model','attributes','debug','ShowInterval','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0x63ab,0x81));var _0xb63a=function(_0x32f724,_0x11c4d6){_0x32f724=_0x32f724-0x0;var _0x51a9bd=_0x63ab[_0x32f724];return _0x51a9bd;};'use strict';var _=require(_0xb63a('0x0'));var util=require(_0xb63a('0x1'));var moment=require(_0xb63a('0x2'));var BPromise=require(_0xb63a('0x3'));var rs=require(_0xb63a('0x4'));var fs=require('fs');var Redis=require(_0xb63a('0x5'));var db=require(_0xb63a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb63a('0x7'));var config=require(_0xb63a('0x8'));var jayson=require(_0xb63a('0x9'));var client=jayson[_0xb63a('0xa')][_0xb63a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174018,_0x4e9117,_0x5983d7){return new BPromise(function(_0x5ab318,_0x1fc1ed){return client[_0xb63a('0xc')](_0x174018,_0x5983d7)[_0xb63a('0xd')](function(_0x55e8d2){logger[_0xb63a('0xe')](_0xb63a('0xf'),_0x4e9117,_0xb63a('0x10'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x4e9117,_0xb63a('0x10'),JSON[_0xb63a('0x11')](_0x55e8d2));if(_0x55e8d2[_0xb63a('0x12')]){if(_0x55e8d2[_0xb63a('0x12')][_0xb63a('0x13')]===0x1f4){logger['error'](_0xb63a('0xf'),_0x4e9117,_0x55e8d2[_0xb63a('0x12')][_0xb63a('0x14')]);return _0x1fc1ed(_0x55e8d2[_0xb63a('0x12')]['message']);}logger[_0xb63a('0x12')](_0xb63a('0xf'),_0x4e9117,_0x55e8d2[_0xb63a('0x12')][_0xb63a('0x14')]);return _0x5ab318(_0x55e8d2[_0xb63a('0x12')][_0xb63a('0x14')]);}else{logger[_0xb63a('0xe')]('Interval,\x20%s,\x20%s',_0x4e9117,_0xb63a('0x10'));_0x5ab318(_0x55e8d2['result']['message']);}})[_0xb63a('0x15')](function(_0xab050){logger['error'](_0xb63a('0xf'),_0x4e9117,_0xab050);_0x1fc1ed(_0xab050);});});}exports[_0xb63a('0x16')]=function(_0x3ec354){var _0xd9613b=this;return new Promise(function(_0x41e653,_0x5b6b66){return db[_0xb63a('0x17')]['findAll']({'raw':_0x3ec354['options']?_0x3ec354['options'][_0xb63a('0x18')]===undefined?!![]:![]:!![],'where':_0x3ec354[_0xb63a('0x19')]?_0x3ec354['options'][_0xb63a('0x1a')]||null:null,'attributes':_0x3ec354[_0xb63a('0x19')]?_0x3ec354[_0xb63a('0x19')]['attributes']||null:null,'limit':_0x3ec354[_0xb63a('0x19')]?_0x3ec354[_0xb63a('0x19')][_0xb63a('0x1b')]||null:null,'include':_0x3ec354[_0xb63a('0x19')]?_0x3ec354[_0xb63a('0x19')]['include']?_[_0xb63a('0x1c')](_0x3ec354[_0xb63a('0x19')][_0xb63a('0x1d')],function(_0x607c0d){return{'model':db[_0x607c0d[_0xb63a('0x1e')]],'as':_0x607c0d['as'],'attributes':_0x607c0d[_0xb63a('0x1f')],'include':_0x607c0d[_0xb63a('0x1d')]?_[_0xb63a('0x1c')](_0x607c0d[_0xb63a('0x1d')],function(_0x1fb9b2){return{'model':db[_0x1fb9b2[_0xb63a('0x1e')]],'as':_0x1fb9b2['as'],'attributes':_0x1fb9b2[_0xb63a('0x1f')],'include':_0x1fb9b2[_0xb63a('0x1d')]?_[_0xb63a('0x1c')](_0x1fb9b2[_0xb63a('0x1d')],function(_0x3e214a){return{'model':db[_0x3e214a[_0xb63a('0x1e')]],'as':_0x3e214a['as'],'attributes':_0x3e214a[_0xb63a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb63a('0xd')](function(_0x253b82){logger[_0xb63a('0xe')](_0xb63a('0x16'),_0x3ec354);logger['debug'](_0xb63a('0x16'),_0x3ec354,JSON[_0xb63a('0x11')](_0x253b82));_0x41e653(_0x253b82);})['catch'](function(_0x3644af){logger[_0xb63a('0x12')](_0xb63a('0x16'),_0x3644af[_0xb63a('0x14')],_0x3ec354);_0x5b6b66(_0xd9613b[_0xb63a('0x12')](0x1f4,_0x3644af[_0xb63a('0x14')]));});});};exports['ShowInterval']=function(_0x9655d2){var _0x537dbf=this;return new Promise(function(_0x2a4eae,_0x89434e){return db[_0xb63a('0x17')]['find']({'raw':_0x9655d2['options']?_0x9655d2['options'][_0xb63a('0x18')]===undefined?!![]:![]:!![],'where':_0x9655d2[_0xb63a('0x19')]?_0x9655d2['options'][_0xb63a('0x1a')]||null:null,'attributes':_0x9655d2[_0xb63a('0x19')]?_0x9655d2[_0xb63a('0x19')][_0xb63a('0x1f')]||null:null,'include':_0x9655d2['options']?_0x9655d2[_0xb63a('0x19')]['include']?_[_0xb63a('0x1c')](_0x9655d2[_0xb63a('0x19')][_0xb63a('0x1d')],function(_0x23a38c){return{'model':db[_0x23a38c[_0xb63a('0x1e')]],'as':_0x23a38c['as'],'attributes':_0x23a38c[_0xb63a('0x1f')],'include':_0x23a38c[_0xb63a('0x1d')]?_[_0xb63a('0x1c')](_0x23a38c[_0xb63a('0x1d')],function(_0x545da1){return{'model':db[_0x545da1[_0xb63a('0x1e')]],'as':_0x545da1['as'],'attributes':_0x545da1[_0xb63a('0x1f')],'include':_0x545da1[_0xb63a('0x1d')]?_[_0xb63a('0x1c')](_0x545da1[_0xb63a('0x1d')],function(_0x17fc06){return{'model':db[_0x17fc06[_0xb63a('0x1e')]],'as':_0x17fc06['as'],'attributes':_0x17fc06[_0xb63a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb63a('0xd')](function(_0x22eed5){logger[_0xb63a('0xe')]('ShowInterval',_0x9655d2);logger[_0xb63a('0x20')](_0xb63a('0x21'),_0x9655d2,JSON[_0xb63a('0x11')](_0x22eed5));_0x2a4eae(_0x22eed5);})[_0xb63a('0x15')](function(_0x45c63a){logger['error'](_0xb63a('0x21'),_0x45c63a[_0xb63a('0x14')],_0x9655d2);_0x89434e(_0x537dbf[_0xb63a('0x12')](0x1f4,_0x45c63a[_0xb63a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8cb4abb..8817eb1 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 _0xfb44=['express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0xef7f03,_0x3ebeff){var _0x1ccb31=function(_0x353875){while(--_0x353875){_0xef7f03['push'](_0xef7f03['shift']());}};_0x1ccb31(++_0x3ebeff);}(_0xfb44,0xb8));var _0x4fb4=function(_0x34d702,_0x3c3f13){_0x34d702=_0x34d702-0x0;var _0x5a91d1=_0xfb44[_0x34d702];return _0x5a91d1;};'use strict';var express=require(_0x4fb4('0x0'));var router=express[_0x4fb4('0x1')]();var auth=require(_0x4fb4('0x2'));var controller=require(_0x4fb4('0x3'));router[_0x4fb4('0x4')]('/',auth[_0x4fb4('0x5')](),controller[_0x4fb4('0x6')]);module[_0x4fb4('0x7')]=router; \ No newline at end of file +var _0xca9a=['exports','express','Router','../../components/auth/service','post','isAuthenticated'];(function(_0x12e590,_0x106bb8){var _0x50a48b=function(_0x352367){while(--_0x352367){_0x12e590['push'](_0x12e590['shift']());}};_0x50a48b(++_0x106bb8);}(_0xca9a,0x181));var _0xaca9=function(_0x495f5d,_0x2182cd){_0x495f5d=_0x495f5d-0x0;var _0xc5d314=_0xca9a[_0x495f5d];return _0xc5d314;};'use strict';var express=require(_0xaca9('0x0'));var router=express[_0xaca9('0x1')]();var auth=require(_0xaca9('0x2'));var controller=require('./jira.controller');router[_0xaca9('0x3')]('/',auth[_0xaca9('0x4')](),controller['send']);module[_0xaca9('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4c01e22..bcc4a9e 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 _0xef40=['headers','x-forwarded-for','connection','remoteAddress','socket','https','api','3eAmWpBVP0','Report','\x20from\x20','stringify','issuetype','customfield_11500','email','fields','customfield_11502','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','base64','request','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','body'];(function(_0x42f518,_0x347060){var _0x165913=function(_0x326567){while(--_0x326567){_0x42f518['push'](_0x42f518['shift']());}};_0x165913(++_0x347060);}(_0xef40,0xb9));var _0x0ef4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xef40[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require('bluebird');var https=require(_0x0ef4('0x0'));var logger=require('../../config/logger')(_0x0ef4('0x1'));var USERNAME='support';var PASSWORD=_0x0ef4('0x2');function openIssue(_0x187edc,_0xc38be4){var _0x4d7555={'fields':{'project':{'key':_0x187edc['key']||'MOTGUI'},'summary':(_0x187edc['summary']||_0x0ef4('0x3'))+_0x0ef4('0x4')+_0x187edc['ip'],'description':_0x187edc['description']||JSON[_0x0ef4('0x5')](_0x187edc),'issuetype':{'name':_0x187edc[_0x0ef4('0x6')]||'Bug'}}};_0x4d7555['fields'][_0x0ef4('0x7')]=_0x187edc[_0x0ef4('0x8')];_0x4d7555[_0x0ef4('0x9')]['customfield_11501']=_0x187edc['oldToken'];_0x4d7555[_0x0ef4('0x9')][_0x0ef4('0xa')]=_0x187edc['newToken'];_0x4d7555['fields']['customfield_11503']=_0x187edc[_0x0ef4('0xb')];_0x4d7555['fields']['customfield_11504']=_0x187edc[_0x0ef4('0xc')];_0x4d7555['fields']['customfield_10102']=_0x187edc['ip'];var _0x4aa37d={'host':_0x0ef4('0xd'),'port':0x1bb,'path':_0x0ef4('0xe'),'method':_0x0ef4('0xf'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x0ef4('0x10'))}};var _0x54c3e3=JSON[_0x0ef4('0x5')](_0x4d7555);var _0x44c83d=https[_0x0ef4('0x11')](_0x4aa37d,function(_0x3f8cdc){_0x3f8cdc['setEncoding'](_0x0ef4('0x12'));var _0x57f5fb='';_0x3f8cdc['on'](_0x0ef4('0x13'),function(_0x28ccc2){_0x57f5fb+=_0x28ccc2;});_0x3f8cdc['on'](_0x0ef4('0x14'),function(){if(_0xc38be4){return _0xc38be4['status'](_0x3f8cdc[_0x0ef4('0x15')])[_0x0ef4('0x16')](JSON[_0x0ef4('0x17')](_0x57f5fb));}});});_0x44c83d['on'](_0x0ef4('0x18'),function(_0x13bcd6){if(_0xc38be4){return _0xc38be4[_0x0ef4('0x19')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0ef4('0x1a')}]});}});_0x44c83d[_0x0ef4('0x1b')](_0x54c3e3);_0x44c83d['end']();}exports[_0x0ef4('0x1c')]=openIssue;exports[_0x0ef4('0x1d')]=function(_0x21e890,_0x472e81){_0x21e890[_0x0ef4('0x1e')]['ip']=_0x21e890[_0x0ef4('0x1f')][_0x0ef4('0x20')]||_0x21e890[_0x0ef4('0x21')][_0x0ef4('0x22')]||_0x21e890[_0x0ef4('0x23')][_0x0ef4('0x22')]||_0x21e890[_0x0ef4('0x21')]['socket']['remoteAddress'];return openIssue(_0x21e890[_0x0ef4('0x1e')],_0x472e81);}; \ No newline at end of file +var _0x8cae=['issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','base64','request','utf8','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','connection','remoteAddress','socket','bluebird','api','support','key','MOTGUI','Report','\x20from\x20','description','stringify'];(function(_0x5d8f20,_0x3f57b0){var _0x4a54f4=function(_0x522f34){while(--_0x522f34){_0x5d8f20['push'](_0x5d8f20['shift']());}};_0x4a54f4(++_0x3f57b0);}(_0x8cae,0xc9));var _0xe8ca=function(_0xb2d632,_0x48a844){_0xb2d632=_0xb2d632-0x0;var _0x31c045=_0x8cae[_0xb2d632];return _0x31c045;};'use strict';var BPromise=require(_0xe8ca('0x0'));var https=require('https');var logger=require('../../config/logger')(_0xe8ca('0x1'));var USERNAME=_0xe8ca('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x36b67a,_0x5cb230){var _0x4d117b={'fields':{'project':{'key':_0x36b67a[_0xe8ca('0x3')]||_0xe8ca('0x4')},'summary':(_0x36b67a['summary']||_0xe8ca('0x5'))+_0xe8ca('0x6')+_0x36b67a['ip'],'description':_0x36b67a[_0xe8ca('0x7')]||JSON[_0xe8ca('0x8')](_0x36b67a),'issuetype':{'name':_0x36b67a[_0xe8ca('0x9')]||_0xe8ca('0xa')}}};_0x4d117b['fields'][_0xe8ca('0xb')]=_0x36b67a['email'];_0x4d117b[_0xe8ca('0xc')][_0xe8ca('0xd')]=_0x36b67a['oldToken'];_0x4d117b[_0xe8ca('0xc')][_0xe8ca('0xe')]=_0x36b67a[_0xe8ca('0xf')];_0x4d117b[_0xe8ca('0xc')][_0xe8ca('0x10')]=_0x36b67a[_0xe8ca('0x11')];_0x4d117b['fields'][_0xe8ca('0x12')]=_0x36b67a[_0xe8ca('0x13')];_0x4d117b['fields']['customfield_10102']=_0x36b67a['ip'];var _0x5c5ce1={'host':_0xe8ca('0x14'),'port':0x1bb,'path':_0xe8ca('0x15'),'method':_0xe8ca('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xe8ca('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xe8ca('0x18'))}};var _0x3a220d=JSON[_0xe8ca('0x8')](_0x4d117b);var _0x268962=https[_0xe8ca('0x19')](_0x5c5ce1,function(_0x19d19b){_0x19d19b['setEncoding'](_0xe8ca('0x1a'));var _0x47bbd1='';_0x19d19b['on']('data',function(_0x2fb375){_0x47bbd1+=_0x2fb375;});_0x19d19b['on'](_0xe8ca('0x1b'),function(){if(_0x5cb230){return _0x5cb230['status'](_0x19d19b[_0xe8ca('0x1c')])[_0xe8ca('0x1d')](JSON[_0xe8ca('0x1e')](_0x47bbd1));}});});_0x268962['on'](_0xe8ca('0x1f'),function(_0x21b5e4){if(_0x5cb230){return _0x5cb230[_0xe8ca('0x20')](0x1f4)[_0xe8ca('0x1d')]({'errors':[{'message':_0xe8ca('0x21'),'type':_0xe8ca('0x22')}]});}});_0x268962[_0xe8ca('0x23')](_0x3a220d);_0x268962[_0xe8ca('0x1b')]();}exports[_0xe8ca('0x24')]=openIssue;exports['send']=function(_0x4a9bf4,_0x42c5e2){_0x4a9bf4[_0xe8ca('0x25')]['ip']=_0x4a9bf4[_0xe8ca('0x26')]['x-forwarded-for']||_0x4a9bf4[_0xe8ca('0x27')][_0xe8ca('0x28')]||_0x4a9bf4['socket'][_0xe8ca('0x28')]||_0x4a9bf4['connection'][_0xe8ca('0x29')][_0xe8ca('0x28')];return openIssue(_0x4a9bf4[_0xe8ca('0x25')],_0x42c5e2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a54b20f..9266f66 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 _0x9f78=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x2bd743,_0xd79c41){var _0xe94d5f=function(_0x51ea03){while(--_0x51ea03){_0x2bd743['push'](_0x2bd743['shift']());}};_0xe94d5f(++_0xd79c41);}(_0x9f78,0x8f));var _0x89f7=function(_0x2d2d40,_0x2cdce7){_0x2d2d40=_0x2d2d40-0x0;var _0x42dd02=_0x9f78[_0x2d2d40];return _0x42dd02;};'use strict';var multer=require('multer');var util=require(_0x89f7('0x0'));var path=require(_0x89f7('0x1'));var timeout=require(_0x89f7('0x2'));var express=require(_0x89f7('0x3'));var router=express[_0x89f7('0x4')]();var auth=require(_0x89f7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89f7('0x6'));router[_0x89f7('0x7')]('/',auth[_0x89f7('0x8')](),controller[_0x89f7('0x9')]);router[_0x89f7('0x7')](_0x89f7('0xa'),auth[_0x89f7('0x8')](),controller[_0x89f7('0xb')]);router[_0x89f7('0x7')](_0x89f7('0xc'),auth[_0x89f7('0x8')](),controller[_0x89f7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89f7('0xe')]);router[_0x89f7('0xf')]('/:id',auth[_0x89f7('0x8')](),controller[_0x89f7('0x10')]);router[_0x89f7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x89f7('0x12')]);module[_0x89f7('0x13')]=router; \ No newline at end of file +var _0xc0d3=['describe','/:id','post','create','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x229a84,_0x726145){var _0xd40809=function(_0x4b914b){while(--_0x4b914b){_0x229a84['push'](_0x229a84['shift']());}};_0xd40809(++_0x726145);}(_0xc0d3,0xa9));var _0x3c0d=function(_0x46a1f6,_0x26021a){_0x46a1f6=_0x46a1f6-0x0;var _0x151f83=_0xc0d3[_0x46a1f6];return _0x151f83;};'use strict';var multer=require(_0x3c0d('0x0'));var util=require(_0x3c0d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c0d('0x2'));var router=express[_0x3c0d('0x3')]();var auth=require(_0x3c0d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3c0d('0x5'));var controller=require(_0x3c0d('0x6'));router[_0x3c0d('0x7')]('/',auth['isAuthenticated'](),controller[_0x3c0d('0x8')]);router[_0x3c0d('0x7')](_0x3c0d('0x9'),auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xb')]);router[_0x3c0d('0x7')](_0x3c0d('0xc'),auth[_0x3c0d('0xa')](),controller['show']);router[_0x3c0d('0xd')]('/',auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xe')]);router['put']('/:id',auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xf')]);router['delete'](_0x3c0d('0xc'),auth['isAuthenticated'](),controller[_0x3c0d('0x10')]);module[_0x3c0d('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c9b7049..98a5226 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 _0xb0e0=['long','sequelize','exports','STRING','TEXT'];(function(_0x351348,_0x59f82d){var _0x434939=function(_0x21e9c4){while(--_0x21e9c4){_0x351348['push'](_0x351348['shift']());}};_0x434939(++_0x59f82d);}(_0xb0e0,0xdd));var _0x0b0e=function(_0x1cf7f2,_0x3ed9d9){_0x1cf7f2=_0x1cf7f2-0x0;var _0x2a62e8=_0xb0e0[_0x1cf7f2];return _0x2a62e8;};'use strict';var Sequelize=require(_0x0b0e('0x0'));module[_0x0b0e('0x1')]={'question':{'type':Sequelize[_0x0b0e('0x2')]},'answer':{'type':Sequelize[_0x0b0e('0x3')](_0x0b0e('0x4'))},'membername':{'type':Sequelize[_0x0b0e('0x2')]},'projectname':{'type':Sequelize[_0x0b0e('0x2')]},'queue':{'type':Sequelize[_0x0b0e('0x2')]},'uniqueid':{'type':Sequelize[_0x0b0e('0x2')]},'calleridname':{'type':Sequelize[_0x0b0e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x0b0e('0x2')]}}; \ No newline at end of file +var _0xcfc4=['TEXT','exports','STRING'];(function(_0x160870,_0x56f79c){var _0x306308=function(_0x44b61d){while(--_0x44b61d){_0x160870['push'](_0x160870['shift']());}};_0x306308(++_0x56f79c);}(_0xcfc4,0x97));var _0x4cfc=function(_0x86b933,_0x20d2f2){_0x86b933=_0x86b933-0x0;var _0xb72e95=_0xcfc4[_0x86b933];return _0xb72e95;};'use strict';var Sequelize=require('sequelize');module[_0x4cfc('0x0')]={'question':{'type':Sequelize[_0x4cfc('0x1')]},'answer':{'type':Sequelize[_0x4cfc('0x2')]('long')},'membername':{'type':Sequelize[_0x4cfc('0x1')]},'projectname':{'type':Sequelize[_0x4cfc('0x1')]},'queue':{'type':Sequelize[_0x4cfc('0x1')]},'uniqueid':{'type':Sequelize[_0x4cfc('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4cfc('0x1')]},'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 adad4f2..dba7469 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 _0x05c4=['attributes','intersection','fields','length','offset','sort','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','JscriptyAnswerReport','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x34be8f,_0x5da9ef){var _0x345213=function(_0x12b552){while(--_0x12b552){_0x34be8f['push'](_0x34be8f['shift']());}};_0x345213(++_0x5da9ef);}(_0x05c4,0xde));var _0x405c=function(_0x4afdd5,_0x4f4184){_0x4afdd5=_0x4afdd5-0x0;var _0x14a65d=_0x05c4[_0x4afdd5];return _0x14a65d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x405c('0x0'));var rimraf=require(_0x405c('0x1'));var zipdir=require(_0x405c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x405c('0x3'));var BPromise=require(_0x405c('0x4'));var Mustache=require(_0x405c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x405c('0x6'));var csv=require(_0x405c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x405c('0x8'));var squel=require(_0x405c('0x9'));var crypto=require(_0x405c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x405c('0xb'));var toCsv=require(_0x405c('0x7'));var querystring=require(_0x405c('0xc'));var Papa=require('papaparse');var Redis=require(_0x405c('0xd'));var authService=require(_0x405c('0xe'));var qs=require(_0x405c('0xf'));var as=require(_0x405c('0x10'));var hardwareService=require(_0x405c('0x11'));var logger=require(_0x405c('0x12'))(_0x405c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x405c('0x14'))['db'];function respondWithStatusCode(_0x2d58b9,_0x1a788e){_0x1a788e=_0x1a788e||0xcc;return function(_0x5c30e4){if(_0x5c30e4){return _0x2d58b9['sendStatus'](_0x1a788e);}return _0x2d58b9[_0x405c('0x15')](_0x1a788e)[_0x405c('0x16')]();};}function respondWithResult(_0x9fb2e8,_0x354262){_0x354262=_0x354262||0xc8;return function(_0x1671a5){if(_0x1671a5){return _0x9fb2e8[_0x405c('0x15')](_0x354262)[_0x405c('0x17')](_0x1671a5);}};}function respondWithFilteredResult(_0x846aa5,_0x35921c){return function(_0x1cb391){if(_0x1cb391){var _0x3b8c71=_0x1cb391[_0x405c('0x18')],_0x483da4=_0x35921c['offset'],_0x5b8c7e=_0x35921c['offset']+_0x35921c[_0x405c('0x19')],_0x11c373;if(_0x5b8c7e>=_0x3b8c71){_0x5b8c7e=_0x3b8c71;_0x11c373=0xc8;}else{_0x11c373=0xce;}_0x846aa5[_0x405c('0x15')](_0x11c373);return _0x846aa5['set'](_0x405c('0x1a'),_0x483da4+'-'+_0x5b8c7e+'/'+_0x3b8c71)[_0x405c('0x17')](_0x1cb391);}return null;};}function patchUpdates(_0x224f03){return function(_0x21e191){try{jsonpatch[_0x405c('0x1b')](_0x21e191,_0x224f03,!![]);}catch(_0x246d7b){return BPromise[_0x405c('0x1c')](_0x246d7b);}return _0x21e191[_0x405c('0x1d')]();};}function saveUpdates(_0x502fa2,_0x1faf0a){return function(_0x22ff43){if(_0x22ff43){return _0x22ff43[_0x405c('0x1e')](_0x502fa2)[_0x405c('0x1f')](function(_0x393c9a){return _0x393c9a;});}return null;};}function removeEntity(_0x42268d,_0x3d8547){return function(_0x412f59){if(_0x412f59){return _0x412f59[_0x405c('0x20')]()[_0x405c('0x1f')](function(){_0x42268d[_0x405c('0x15')](0xcc)[_0x405c('0x16')]();});}};}function handleEntityNotFound(_0x215a86,_0x28d249){return function(_0x1d50b2){if(!_0x1d50b2){_0x215a86[_0x405c('0x21')](0x194);}return _0x1d50b2;};}function handleError(_0x516b47,_0x4f6e02){_0x4f6e02=_0x4f6e02||0x1f4;return function(_0x5e2b9d){logger['error'](_0x5e2b9d[_0x405c('0x22')]);if(_0x5e2b9d['name']){delete _0x5e2b9d[_0x405c('0x23')];}_0x516b47['status'](_0x4f6e02)[_0x405c('0x24')](_0x5e2b9d);};}exports['index']=function(_0x28a996,_0x408d68){var _0x3cef01={},_0x4160e1={},_0x416cf5={'count':0x0,'rows':[]};var _0x1431cc=_['map'](db[_0x405c('0x25')][_0x405c('0x26')],function(_0x4bcb17){return{'name':_0x4bcb17['fieldName'],'type':_0x4bcb17[_0x405c('0x27')][_0x405c('0x28')]};});_0x4160e1[_0x405c('0x29')]=_[_0x405c('0x2a')](_0x1431cc,_0x405c('0x23'));_0x4160e1[_0x405c('0x2b')]=_[_0x405c('0x2c')](_0x28a996[_0x405c('0x2b')]);_0x4160e1[_0x405c('0x2d')]=_['intersection'](_0x4160e1[_0x405c('0x29')],_0x4160e1['query']);_0x3cef01[_0x405c('0x2e')]=_[_0x405c('0x2f')](_0x4160e1[_0x405c('0x29')],qs[_0x405c('0x30')](_0x28a996[_0x405c('0x2b')][_0x405c('0x30')]));_0x3cef01[_0x405c('0x2e')]=_0x3cef01['attributes'][_0x405c('0x31')]?_0x3cef01[_0x405c('0x2e')]:_0x4160e1[_0x405c('0x29')];if(!_0x28a996[_0x405c('0x2b')]['hasOwnProperty']('nolimit')){_0x3cef01['limit']=qs[_0x405c('0x19')](_0x28a996[_0x405c('0x2b')][_0x405c('0x19')]);_0x3cef01[_0x405c('0x32')]=qs['offset'](_0x28a996['query'][_0x405c('0x32')]);}_0x3cef01['order']=qs[_0x405c('0x33')](_0x28a996[_0x405c('0x2b')][_0x405c('0x33')]);_0x3cef01['where']=qs[_0x405c('0x2d')](_['pick'](_0x28a996[_0x405c('0x2b')],_0x4160e1[_0x405c('0x2d')]),_0x1431cc);if(_0x28a996['query']['filter']){_0x3cef01[_0x405c('0x34')]=_[_0x405c('0x35')](_0x3cef01[_0x405c('0x34')],{'$or':_[_0x405c('0x2a')](_0x1431cc,function(_0x3614be){if(_0x3614be[_0x405c('0x27')]!==_0x405c('0x36')){var _0x57ee74={};_0x57ee74[_0x3614be['name']]={'$like':'%'+_0x28a996['query']['filter']+'%'};return _0x57ee74;}})});}_0x3cef01=_[_0x405c('0x35')]({},_0x3cef01,_0x28a996[_0x405c('0x37')]);var _0x350b80={'where':_0x3cef01[_0x405c('0x34')]};return db[_0x405c('0x25')][_0x405c('0x18')](_0x350b80)[_0x405c('0x1f')](function(_0x4760f4){_0x416cf5[_0x405c('0x18')]=_0x4760f4;if(_0x28a996[_0x405c('0x2b')]['includeAll']){_0x3cef01['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x405c('0x38')](_0x3cef01);})['then'](function(_0x5dd748){_0x416cf5[_0x405c('0x39')]=_0x5dd748;return _0x416cf5;})[_0x405c('0x1f')](respondWithFilteredResult(_0x408d68,_0x3cef01))[_0x405c('0x3a')](handleError(_0x408d68,null));};exports[_0x405c('0x3b')]=function(_0x18dfd4,_0x51a221){var _0x492f9c={'raw':!![],'where':{'id':_0x18dfd4[_0x405c('0x3c')]['id']}},_0x132ac8={};_0x132ac8[_0x405c('0x29')]=_[_0x405c('0x2c')](db['JscriptyAnswerReport'][_0x405c('0x26')]);_0x132ac8[_0x405c('0x2b')]=_[_0x405c('0x2c')](_0x18dfd4[_0x405c('0x2b')]);_0x132ac8[_0x405c('0x2d')]=_[_0x405c('0x2f')](_0x132ac8[_0x405c('0x29')],_0x132ac8[_0x405c('0x2b')]);_0x492f9c[_0x405c('0x2e')]=_[_0x405c('0x2f')](_0x132ac8['model'],qs[_0x405c('0x30')](_0x18dfd4['query'][_0x405c('0x30')]));_0x492f9c[_0x405c('0x2e')]=_0x492f9c[_0x405c('0x2e')][_0x405c('0x31')]?_0x492f9c[_0x405c('0x2e')]:_0x132ac8[_0x405c('0x29')];if(_0x18dfd4[_0x405c('0x2b')][_0x405c('0x3d')]){_0x492f9c[_0x405c('0x3e')]=[{'all':!![]}];}_0x492f9c=_[_0x405c('0x35')]({},_0x492f9c,_0x18dfd4['options']);return db[_0x405c('0x25')][_0x405c('0x3f')](_0x492f9c)[_0x405c('0x1f')](handleEntityNotFound(_0x51a221,null))[_0x405c('0x1f')](respondWithResult(_0x51a221,null))[_0x405c('0x3a')](handleError(_0x51a221,null));};exports[_0x405c('0x40')]=function(_0x31989c,_0x49cbad){return db['JscriptyAnswerReport']['create'](_0x31989c[_0x405c('0x41')],{})[_0x405c('0x1f')](respondWithResult(_0x49cbad,0xc9))[_0x405c('0x3a')](handleError(_0x49cbad,null));};exports[_0x405c('0x1e')]=function(_0x4fdfb5,_0x33b861){if(_0x4fdfb5[_0x405c('0x41')]['id']){delete _0x4fdfb5[_0x405c('0x41')]['id'];}return db[_0x405c('0x25')]['find']({'where':{'id':_0x4fdfb5['params']['id']}})[_0x405c('0x1f')](handleEntityNotFound(_0x33b861,null))['then'](saveUpdates(_0x4fdfb5['body'],null))[_0x405c('0x1f')](respondWithResult(_0x33b861,null))[_0x405c('0x3a')](handleError(_0x33b861,null));};exports[_0x405c('0x20')]=function(_0x1796ab,_0x1ed2dd){return db[_0x405c('0x25')][_0x405c('0x3f')]({'where':{'id':_0x1796ab[_0x405c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1ed2dd,null))[_0x405c('0x1f')](removeEntity(_0x1ed2dd,null))[_0x405c('0x3a')](handleError(_0x1ed2dd,null));};exports[_0x405c('0x42')]=function(_0x1e953a,_0x22bea4){return db[_0x405c('0x25')][_0x405c('0x42')]()[_0x405c('0x1f')](respondWithResult(_0x22bea4,null))[_0x405c('0x3a')](handleError(_0x22bea4,null));}; \ No newline at end of file +var _0x4f2d=['bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','JscriptyAnswerReport','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x4f2d,0x11a));var _0xd4f2=function(_0x447047,_0x32276d){_0x447047=_0x447047-0x0;var _0x46d134=_0x4f2d[_0x447047];return _0x46d134;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd4f2('0x0'));var rimraf=require(_0xd4f2('0x1'));var zipdir=require(_0xd4f2('0x2'));var jsonpatch=require(_0xd4f2('0x3'));var rp=require(_0xd4f2('0x4'));var moment=require(_0xd4f2('0x5'));var BPromise=require(_0xd4f2('0x6'));var Mustache=require(_0xd4f2('0x7'));var util=require(_0xd4f2('0x8'));var path=require(_0xd4f2('0x9'));var sox=require('sox');var csv=require(_0xd4f2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd4f2('0xb'));var squel=require('squel');var crypto=require(_0xd4f2('0xc'));var jsforce=require(_0xd4f2('0xd'));var deskjs=require(_0xd4f2('0xe'));var toCsv=require(_0xd4f2('0xa'));var querystring=require(_0xd4f2('0xf'));var Papa=require(_0xd4f2('0x10'));var Redis=require(_0xd4f2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd4f2('0x12'));var as=require(_0xd4f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd4f2('0x14'));var utils=require('../../config/utils');var config=require(_0xd4f2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530309,_0x1d585c){_0x1d585c=_0x1d585c||0xcc;return function(_0x4dd2be){if(_0x4dd2be){return _0x530309[_0xd4f2('0x16')](_0x1d585c);}return _0x530309[_0xd4f2('0x17')](_0x1d585c)[_0xd4f2('0x18')]();};}function respondWithResult(_0x293fef,_0x82d99e){_0x82d99e=_0x82d99e||0xc8;return function(_0x3d02e0){if(_0x3d02e0){return _0x293fef[_0xd4f2('0x17')](_0x82d99e)[_0xd4f2('0x19')](_0x3d02e0);}};}function respondWithFilteredResult(_0x2553b9,_0x514461){return function(_0x5459ca){if(_0x5459ca){var _0x5ebcb6=_0x5459ca[_0xd4f2('0x1a')],_0x46c8cf=_0x514461['offset'],_0x30a65f=_0x514461[_0xd4f2('0x1b')]+_0x514461['limit'],_0x5d0aca;if(_0x30a65f>=_0x5ebcb6){_0x30a65f=_0x5ebcb6;_0x5d0aca=0xc8;}else{_0x5d0aca=0xce;}_0x2553b9[_0xd4f2('0x17')](_0x5d0aca);return _0x2553b9[_0xd4f2('0x1c')](_0xd4f2('0x1d'),_0x46c8cf+'-'+_0x30a65f+'/'+_0x5ebcb6)[_0xd4f2('0x19')](_0x5459ca);}return null;};}function patchUpdates(_0xae1ed8){return function(_0x4b8623){try{jsonpatch['apply'](_0x4b8623,_0xae1ed8,!![]);}catch(_0x3d2004){return BPromise[_0xd4f2('0x1e')](_0x3d2004);}return _0x4b8623[_0xd4f2('0x1f')]();};}function saveUpdates(_0x1f3866,_0x36ad71){return function(_0x525b46){if(_0x525b46){return _0x525b46[_0xd4f2('0x20')](_0x1f3866)['then'](function(_0x11da41){return _0x11da41;});}return null;};}function removeEntity(_0x4c397f,_0x5aabfc){return function(_0x18d3f2){if(_0x18d3f2){return _0x18d3f2[_0xd4f2('0x21')]()[_0xd4f2('0x22')](function(){_0x4c397f[_0xd4f2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xccaee3,_0x55fbfb){return function(_0x489fa8){if(!_0x489fa8){_0xccaee3[_0xd4f2('0x16')](0x194);}return _0x489fa8;};}function handleError(_0x2ac31f,_0x4b9a99){_0x4b9a99=_0x4b9a99||0x1f4;return function(_0x1e60e3){logger[_0xd4f2('0x23')](_0x1e60e3[_0xd4f2('0x24')]);if(_0x1e60e3[_0xd4f2('0x25')]){delete _0x1e60e3[_0xd4f2('0x25')];}_0x2ac31f['status'](_0x4b9a99)['send'](_0x1e60e3);};}exports[_0xd4f2('0x26')]=function(_0x384d01,_0x19c9aa){var _0x5e5981={},_0x346190={},_0x369ce0={'count':0x0,'rows':[]};var _0x25b9e6=_['map'](db[_0xd4f2('0x27')]['rawAttributes'],function(_0x4a7771){return{'name':_0x4a7771['fieldName'],'type':_0x4a7771[_0xd4f2('0x28')][_0xd4f2('0x29')]};});_0x346190['model']=_[_0xd4f2('0x2a')](_0x25b9e6,_0xd4f2('0x25'));_0x346190[_0xd4f2('0x2b')]=_[_0xd4f2('0x2c')](_0x384d01[_0xd4f2('0x2b')]);_0x346190[_0xd4f2('0x2d')]=_[_0xd4f2('0x2e')](_0x346190[_0xd4f2('0x2f')],_0x346190[_0xd4f2('0x2b')]);_0x5e5981[_0xd4f2('0x30')]=_[_0xd4f2('0x2e')](_0x346190[_0xd4f2('0x2f')],qs[_0xd4f2('0x31')](_0x384d01[_0xd4f2('0x2b')][_0xd4f2('0x31')]));_0x5e5981['attributes']=_0x5e5981[_0xd4f2('0x30')][_0xd4f2('0x32')]?_0x5e5981[_0xd4f2('0x30')]:_0x346190[_0xd4f2('0x2f')];if(!_0x384d01[_0xd4f2('0x2b')][_0xd4f2('0x33')]('nolimit')){_0x5e5981['limit']=qs['limit'](_0x384d01['query'][_0xd4f2('0x34')]);_0x5e5981[_0xd4f2('0x1b')]=qs['offset'](_0x384d01[_0xd4f2('0x2b')]['offset']);}_0x5e5981[_0xd4f2('0x35')]=qs[_0xd4f2('0x36')](_0x384d01['query'][_0xd4f2('0x36')]);_0x5e5981[_0xd4f2('0x37')]=qs[_0xd4f2('0x2d')](_[_0xd4f2('0x38')](_0x384d01[_0xd4f2('0x2b')],_0x346190[_0xd4f2('0x2d')]),_0x25b9e6);if(_0x384d01[_0xd4f2('0x2b')]['filter']){_0x5e5981['where']=_[_0xd4f2('0x39')](_0x5e5981[_0xd4f2('0x37')],{'$or':_[_0xd4f2('0x2a')](_0x25b9e6,function(_0x37bb67){if(_0x37bb67['type']!==_0xd4f2('0x3a')){var _0x55a846={};_0x55a846[_0x37bb67['name']]={'$like':'%'+_0x384d01[_0xd4f2('0x2b')][_0xd4f2('0x3b')]+'%'};return _0x55a846;}})});}_0x5e5981=_[_0xd4f2('0x39')]({},_0x5e5981,_0x384d01[_0xd4f2('0x3c')]);var _0x57d9f4={'where':_0x5e5981[_0xd4f2('0x37')]};return db[_0xd4f2('0x27')][_0xd4f2('0x1a')](_0x57d9f4)['then'](function(_0x57cfac){_0x369ce0['count']=_0x57cfac;if(_0x384d01[_0xd4f2('0x2b')]['includeAll']){_0x5e5981['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd4f2('0x3d')](_0x5e5981);})[_0xd4f2('0x22')](function(_0x50a40e){_0x369ce0[_0xd4f2('0x3e')]=_0x50a40e;return _0x369ce0;})[_0xd4f2('0x22')](respondWithFilteredResult(_0x19c9aa,_0x5e5981))[_0xd4f2('0x3f')](handleError(_0x19c9aa,null));};exports[_0xd4f2('0x40')]=function(_0x26030b,_0x14c912){var _0x3ff9ef={'raw':!![],'where':{'id':_0x26030b[_0xd4f2('0x41')]['id']}},_0x16fa33={};_0x16fa33[_0xd4f2('0x2f')]=_['keys'](db['JscriptyAnswerReport'][_0xd4f2('0x42')]);_0x16fa33['query']=_[_0xd4f2('0x2c')](_0x26030b['query']);_0x16fa33[_0xd4f2('0x2d')]=_[_0xd4f2('0x2e')](_0x16fa33[_0xd4f2('0x2f')],_0x16fa33[_0xd4f2('0x2b')]);_0x3ff9ef['attributes']=_['intersection'](_0x16fa33['model'],qs[_0xd4f2('0x31')](_0x26030b['query'][_0xd4f2('0x31')]));_0x3ff9ef['attributes']=_0x3ff9ef[_0xd4f2('0x30')][_0xd4f2('0x32')]?_0x3ff9ef['attributes']:_0x16fa33['model'];if(_0x26030b[_0xd4f2('0x2b')]['includeAll']){_0x3ff9ef[_0xd4f2('0x43')]=[{'all':!![]}];}_0x3ff9ef=_[_0xd4f2('0x39')]({},_0x3ff9ef,_0x26030b[_0xd4f2('0x3c')]);return db[_0xd4f2('0x27')][_0xd4f2('0x44')](_0x3ff9ef)[_0xd4f2('0x22')](handleEntityNotFound(_0x14c912,null))[_0xd4f2('0x22')](respondWithResult(_0x14c912,null))[_0xd4f2('0x3f')](handleError(_0x14c912,null));};exports[_0xd4f2('0x45')]=function(_0x309531,_0x3612fb){return db[_0xd4f2('0x27')][_0xd4f2('0x45')](_0x309531[_0xd4f2('0x46')],{})[_0xd4f2('0x22')](respondWithResult(_0x3612fb,0xc9))['catch'](handleError(_0x3612fb,null));};exports[_0xd4f2('0x20')]=function(_0x381c35,_0x38f647){if(_0x381c35[_0xd4f2('0x46')]['id']){delete _0x381c35[_0xd4f2('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x381c35[_0xd4f2('0x41')]['id']}})[_0xd4f2('0x22')](handleEntityNotFound(_0x38f647,null))[_0xd4f2('0x22')](saveUpdates(_0x381c35[_0xd4f2('0x46')],null))['then'](respondWithResult(_0x38f647,null))[_0xd4f2('0x3f')](handleError(_0x38f647,null));};exports['destroy']=function(_0x56749a,_0x12fe91){return db[_0xd4f2('0x27')][_0xd4f2('0x44')]({'where':{'id':_0x56749a[_0xd4f2('0x41')]['id']}})['then'](handleEntityNotFound(_0x12fe91,null))[_0xd4f2('0x22')](removeEntity(_0x12fe91,null))['catch'](handleError(_0x12fe91,null));};exports['describe']=function(_0x2490d9,_0x1b5e75){return db[_0xd4f2('0x27')][_0xd4f2('0x47')]()[_0xd4f2('0x22')](respondWithResult(_0x1b5e75,null))['catch'](handleError(_0x1b5e75,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 995beea..21c13b6 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 _0xc233=['exports','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xc233,0x1f0));var _0x3c23=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0xc233[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x3c23('0x0'));var util=require(_0x3c23('0x1'));var logger=require(_0x3c23('0x2'))(_0x3c23('0x3'));var moment=require(_0x3c23('0x4'));var BPromise=require(_0x3c23('0x5'));var rp=require(_0x3c23('0x6'));var fs=require('fs');var path=require(_0x3c23('0x7'));var rimraf=require(_0x3c23('0x8'));var config=require(_0x3c23('0x9'));var attributes=require(_0x3c23('0xa'));module[_0x3c23('0xb')]=function(_0x52190e,_0x10f5cf){return _0x52190e['define'](_0x3c23('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05da=['define','JscriptyAnswerReport','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5ec3d8,_0x138737){var _0x22dc70=function(_0x29ed68){while(--_0x29ed68){_0x5ec3d8['push'](_0x5ec3d8['shift']());}};_0x22dc70(++_0x138737);}(_0x05da,0x18e));var _0xa05d=function(_0x56ae41,_0x1becca){_0x56ae41=_0x56ae41-0x0;var _0x25d1c0=_0x05da[_0x56ae41];return _0x25d1c0;};'use strict';var _=require(_0xa05d('0x0'));var util=require(_0xa05d('0x1'));var logger=require('../../config/logger')(_0xa05d('0x2'));var moment=require(_0xa05d('0x3'));var BPromise=require(_0xa05d('0x4'));var rp=require(_0xa05d('0x5'));var fs=require('fs');var path=require(_0xa05d('0x6'));var rimraf=require('rimraf');var config=require(_0xa05d('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa05d('0x8')]=function(_0x3aac0d,_0x21f708){return _0x3aac0d[_0xa05d('0x9')](_0xa05d('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 8da5e4c..ecb9199 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 _0x0cac=['code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x22280b,_0x344d8a){var _0x449a95=function(_0x332bba){while(--_0x332bba){_0x22280b['push'](_0x22280b['shift']());}};_0x449a95(++_0x344d8a);}(_0x0cac,0x114));var _0xc0ca=function(_0x2053aa,_0x3df40e){_0x2053aa=_0x2053aa-0x0;var _0x30f5bb=_0x0cac[_0x2053aa];return _0x30f5bb;};'use strict';var _=require(_0xc0ca('0x0'));var util=require(_0xc0ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc0ca('0x2'));var fs=require('fs');var Redis=require(_0xc0ca('0x3'));var db=require(_0xc0ca('0x4'))['db'];var utils=require(_0xc0ca('0x5'));var logger=require('../../config/logger')(_0xc0ca('0x6'));var config=require(_0xc0ca('0x7'));var jayson=require(_0xc0ca('0x8'));var client=jayson[_0xc0ca('0x9')][_0xc0ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ca457,_0x170e89,_0x3e8628){return new BPromise(function(_0x42d16d,_0x20b001){return client[_0xc0ca('0xb')](_0x3ca457,_0x3e8628)['then'](function(_0x58ed12){logger[_0xc0ca('0xc')](_0xc0ca('0xd'),_0x170e89,_0xc0ca('0xe'));logger[_0xc0ca('0xf')](_0xc0ca('0x10'),_0x170e89,_0xc0ca('0xe'),JSON['stringify'](_0x58ed12));if(_0x58ed12[_0xc0ca('0x11')]){if(_0x58ed12['error'][_0xc0ca('0x12')]===0x1f4){logger[_0xc0ca('0x11')](_0xc0ca('0xd'),_0x170e89,_0x58ed12[_0xc0ca('0x11')]['message']);return _0x20b001(_0x58ed12[_0xc0ca('0x11')][_0xc0ca('0x13')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x170e89,_0x58ed12['error'][_0xc0ca('0x13')]);return _0x42d16d(_0x58ed12[_0xc0ca('0x11')][_0xc0ca('0x13')]);}else{logger[_0xc0ca('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x170e89,_0xc0ca('0xe'));_0x42d16d(_0x58ed12['result'][_0xc0ca('0x13')]);}})[_0xc0ca('0x14')](function(_0x1370a0){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x170e89,_0x1370a0);_0x20b001(_0x1370a0);});});} \ No newline at end of file +var _0x2e47=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x2e47,0xc7));var _0x72e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x72e4('0x0'));var util=require(_0x72e4('0x1'));var moment=require(_0x72e4('0x2'));var BPromise=require(_0x72e4('0x3'));var rs=require(_0x72e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72e4('0x5'))['db'];var utils=require(_0x72e4('0x6'));var logger=require(_0x72e4('0x7'))(_0x72e4('0x8'));var config=require('../../config/environment');var jayson=require(_0x72e4('0x9'));var client=jayson[_0x72e4('0xa')][_0x72e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e3d46,_0x59a9f1,_0x2ec61d){return new BPromise(function(_0x5e7eec,_0x412da1){return client[_0x72e4('0xc')](_0x4e3d46,_0x2ec61d)[_0x72e4('0xd')](function(_0x13484b){logger[_0x72e4('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x59a9f1,_0x72e4('0xf'));logger[_0x72e4('0x10')](_0x72e4('0x11'),_0x59a9f1,_0x72e4('0xf'),JSON['stringify'](_0x13484b));if(_0x13484b[_0x72e4('0x12')]){if(_0x13484b[_0x72e4('0x12')][_0x72e4('0x13')]===0x1f4){logger[_0x72e4('0x12')](_0x72e4('0x14'),_0x59a9f1,_0x13484b[_0x72e4('0x12')][_0x72e4('0x15')]);return _0x412da1(_0x13484b[_0x72e4('0x12')]['message']);}logger[_0x72e4('0x12')](_0x72e4('0x14'),_0x59a9f1,_0x13484b[_0x72e4('0x12')]['message']);return _0x5e7eec(_0x13484b[_0x72e4('0x12')]['message']);}else{logger[_0x72e4('0xe')](_0x72e4('0x14'),_0x59a9f1,_0x72e4('0xf'));_0x5e7eec(_0x13484b['result']['message']);}})[_0x72e4('0x16')](function(_0x481a7c){logger[_0x72e4('0x12')](_0x72e4('0x14'),_0x59a9f1,_0x481a7c);_0x412da1(_0x481a7c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 159bce4..2135247 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 _0x9952=['getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers'];(function(_0xe269a2,_0x480e88){var _0x3c0059=function(_0x264e4c){while(--_0x264e4c){_0xe269a2['push'](_0xe269a2['shift']());}};_0x3c0059(++_0x480e88);}(_0x9952,0xf7));var _0x2995=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x9952[_0x51ac09];return _0x3f827d;};'use strict';var multer=require('multer');var util=require(_0x2995('0x0'));var path=require('path');var timeout=require(_0x2995('0x1'));var express=require(_0x2995('0x2'));var router=express[_0x2995('0x3')]();var auth=require(_0x2995('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2995('0x5'));var controller=require(_0x2995('0x6'));router[_0x2995('0x7')]('/',auth[_0x2995('0x8')](),controller['index']);router[_0x2995('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2995('0x9')]);router[_0x2995('0x7')](_0x2995('0xa'),auth[_0x2995('0x8')](),controller[_0x2995('0xb')]);router[_0x2995('0x7')](_0x2995('0xc'),auth['isAuthenticated'](),controller[_0x2995('0xd')]);router[_0x2995('0x7')](_0x2995('0xe'),auth['isAuthenticated'](),timeout(_0x2995('0xf')),controller[_0x2995('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2995('0x11')]);router[_0x2995('0x12')](_0x2995('0x13'),auth[_0x2995('0x8')](),controller[_0x2995('0x14')]);router[_0x2995('0x15')](_0x2995('0x16'),auth[_0x2995('0x8')](),controller[_0x2995('0x17')]);router[_0x2995('0x18')](_0x2995('0x16'),auth[_0x2995('0x8')](),controller[_0x2995('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3885=['multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy','exports'];(function(_0x4bed91,_0x593219){var _0x5a1891=function(_0x184d84){while(--_0x184d84){_0x4bed91['push'](_0x4bed91['shift']());}};_0x5a1891(++_0x593219);}(_0x3885,0x1c2));var _0x5388=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3885[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x5388('0x0'));var util=require('util');var path=require(_0x5388('0x1'));var timeout=require(_0x5388('0x2'));var express=require('express');var router=express[_0x5388('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5388('0x4'));var config=require(_0x5388('0x5'));var controller=require(_0x5388('0x6'));router[_0x5388('0x7')]('/',auth[_0x5388('0x8')](),controller['index']);router[_0x5388('0x7')](_0x5388('0x9'),auth['isAuthenticated'](),controller[_0x5388('0xa')]);router[_0x5388('0x7')](_0x5388('0xb'),auth['isAuthenticated'](),controller[_0x5388('0xc')]);router[_0x5388('0x7')](_0x5388('0xd'),auth[_0x5388('0x8')](),controller['getAnswers']);router['get'](_0x5388('0xe'),auth['isAuthenticated'](),timeout(_0x5388('0xf')),controller[_0x5388('0x10')]);router[_0x5388('0x11')]('/',auth[_0x5388('0x8')](),controller[_0x5388('0x12')]);router[_0x5388('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x5388('0x13')]);router[_0x5388('0x14')](_0x5388('0x9'),auth[_0x5388('0x8')](),controller[_0x5388('0x15')]);router[_0x5388('0x16')](_0x5388('0x9'),auth[_0x5388('0x8')](),controller[_0x5388('0x17')]);module[_0x5388('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1ff8d79..2bc6755 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 _0x774b=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format'];(function(_0x53ff52,_0x13a295){var _0x30a60f=function(_0x50af00){while(--_0x50af00){_0x53ff52['push'](_0x53ff52['shift']());}};_0x30a60f(++_0x13a295);}(_0x774b,0x174));var _0xb774=function(_0x3ca96a,_0xe81d32){_0x3ca96a=_0x3ca96a-0x0;var _0x26aae4=_0x774b[_0x3ca96a];return _0x26aae4;};'use strict';var Sequelize=require(_0xb774('0x0'));var _=require(_0xb774('0x1'));var util=require(_0xb774('0x2'));module[_0xb774('0x3')]={'name':{'type':Sequelize[_0xb774('0x4')],'unique':_0xb774('0x5')},'description':{'type':Sequelize[_0xb774('0x4')]},'formData':{'type':Sequelize[_0xb774('0x6')](_0xb774('0x7')),'set':function(_0x4fed74){if(_[_0xb774('0x8')](_0x4fed74)){this[_0xb774('0x9')](_0xb774('0xa'),JSON['stringify'](_0x4fed74));}else if(_['isString'](_0x4fed74)){this[_0xb774('0x9')]('formData',_0x4fed74);}else{this[_0xb774('0x9')](_0xb774('0xa'),util[_0xb774('0xb')](_0xb774('0xc'),this[_0xb774('0xd')](_0xb774('0x5'))||'',this[_0xb774('0xd')](_0xb774('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb774('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x78d8=['setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','sequelize','exports','STRING','name','TEXT','formData','stringify'];(function(_0x1490ab,_0x5e0360){var _0x28d5e8=function(_0x367e41){while(--_0x367e41){_0x1490ab['push'](_0x1490ab['shift']());}};_0x28d5e8(++_0x5e0360);}(_0x78d8,0x138));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x878d('0x0'));var _=require('lodash');var util=require('util');module[_0x878d('0x1')]={'name':{'type':Sequelize[_0x878d('0x2')],'unique':_0x878d('0x3')},'description':{'type':Sequelize[_0x878d('0x2')]},'formData':{'type':Sequelize[_0x878d('0x4')]('long'),'set':function(_0x244162){if(_['isObjectLike'](_0x244162)){this['setDataValue'](_0x878d('0x5'),JSON[_0x878d('0x6')](_0x244162));}else if(_['isString'](_0x244162)){this[_0x878d('0x7')]('formData',_0x244162);}else{this[_0x878d('0x7')]('formData',util[_0x878d('0x8')](_0x878d('0x9'),this[_0x878d('0xa')](_0x878d('0x3'))||'',this[_0x878d('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'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 a821876..ed21322 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 _0x764d=['includeAll','findAll','catch','params','create','body','get','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','starttime','startTime','questionId','question','format','answer','push','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count'];(function(_0x229517,_0x4e5221){var _0x396d70=function(_0x1a4175){while(--_0x1a4175){_0x229517['push'](_0x229517['shift']());}};_0x396d70(++_0x4e5221);}(_0x764d,0x186));var _0xd764=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x764d[_0x4dab14];return _0xf41aa;};'use strict';var pdf=require(_0xd764('0x0'));var emlformat=require(_0xd764('0x1'));var rimraf=require(_0xd764('0x2'));var zipdir=require(_0xd764('0x3'));var jsonpatch=require(_0xd764('0x4'));var rp=require(_0xd764('0x5'));var moment=require('moment');var BPromise=require(_0xd764('0x6'));var Mustache=require(_0xd764('0x7'));var util=require(_0xd764('0x8'));var path=require('path');var sox=require(_0xd764('0x9'));var csv=require(_0xd764('0xa'));var ejs=require(_0xd764('0xb'));var fs=require('fs');var _=require(_0xd764('0xc'));var squel=require(_0xd764('0xd'));var crypto=require('crypto');var jsforce=require(_0xd764('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd764('0xa'));var querystring=require(_0xd764('0xf'));var Papa=require(_0xd764('0x10'));var Redis=require(_0xd764('0x11'));var authService=require(_0xd764('0x12'));var qs=require(_0xd764('0x13'));var as=require(_0xd764('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd764('0x15'))('api');var utils=require(_0xd764('0x16'));var config=require(_0xd764('0x17'));var db=require(_0xd764('0x18'))['db'];function respondWithStatusCode(_0x475f58,_0x55c12f){_0x55c12f=_0x55c12f||0xcc;return function(_0x1e2442){if(_0x1e2442){return _0x475f58[_0xd764('0x19')](_0x55c12f);}return _0x475f58['status'](_0x55c12f)[_0xd764('0x1a')]();};}function respondWithResult(_0x438083,_0x1c0431){_0x1c0431=_0x1c0431||0xc8;return function(_0xa0191e){if(_0xa0191e){return _0x438083[_0xd764('0x1b')](_0x1c0431)['json'](_0xa0191e);}};}function respondWithFilteredResult(_0x514d56,_0x183104){return function(_0x2c6f91){if(_0x2c6f91){var _0xe278f1=_0x2c6f91['count'],_0x10f13f=_0x183104[_0xd764('0x1c')],_0x3e2fb7=_0x183104['offset']+_0x183104[_0xd764('0x1d')],_0x4b9b51;if(_0x3e2fb7>=_0xe278f1){_0x3e2fb7=_0xe278f1;_0x4b9b51=0xc8;}else{_0x4b9b51=0xce;}_0x514d56[_0xd764('0x1b')](_0x4b9b51);return _0x514d56[_0xd764('0x1e')](_0xd764('0x1f'),_0x10f13f+'-'+_0x3e2fb7+'/'+_0xe278f1)[_0xd764('0x20')](_0x2c6f91);}return null;};}function patchUpdates(_0x34ecaf){return function(_0x1483ad){try{jsonpatch[_0xd764('0x21')](_0x1483ad,_0x34ecaf,!![]);}catch(_0x221dc4){return BPromise[_0xd764('0x22')](_0x221dc4);}return _0x1483ad[_0xd764('0x23')]();};}function saveUpdates(_0x3bae11,_0x293111){return function(_0x13e3b1){if(_0x13e3b1){return _0x13e3b1[_0xd764('0x24')](_0x3bae11)[_0xd764('0x25')](function(_0x51469f){return _0x51469f;});}return null;};}function removeEntity(_0x47b7f8,_0x3c6b8c){return function(_0x186651){if(_0x186651){return _0x186651[_0xd764('0x26')]()[_0xd764('0x25')](function(){var _0x51c7ea=_0x186651['get']({'plain':!![]});var _0x42b7fb=_0xd764('0x27');return db[_0xd764('0x28')][_0xd764('0x26')]({'where':{'type':_0x42b7fb,'resourceId':_0x51c7ea['id']}})[_0xd764('0x25')](function(){return _0x186651;});})['then'](function(){_0x47b7f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x447dc0,_0x711cba){return function(_0x1f839c){if(!_0x1f839c){_0x447dc0[_0xd764('0x19')](0x194);}return _0x1f839c;};}function handleError(_0x4548eb,_0x401618){_0x401618=_0x401618||0x1f4;return function(_0x688ad4){logger[_0xd764('0x29')](_0x688ad4[_0xd764('0x2a')]);if(_0x688ad4[_0xd764('0x2b')]){delete _0x688ad4[_0xd764('0x2b')];}_0x4548eb[_0xd764('0x1b')](_0x401618)['send'](_0x688ad4);};}exports[_0xd764('0x2c')]=function(_0x17baf2,_0x5d125d){var _0x2953a2={},_0x579b95={},_0x3a9227={'count':0x0,'rows':[]};var _0x356a57=_[_0xd764('0x2d')](db[_0xd764('0x2e')][_0xd764('0x2f')],function(_0x397b28){return{'name':_0x397b28['fieldName'],'type':_0x397b28['type']['key']};});_0x579b95[_0xd764('0x30')]=_[_0xd764('0x2d')](_0x356a57,_0xd764('0x2b'));_0x579b95[_0xd764('0x31')]=_[_0xd764('0x32')](_0x17baf2[_0xd764('0x31')]);_0x579b95[_0xd764('0x33')]=_[_0xd764('0x34')](_0x579b95['model'],_0x579b95[_0xd764('0x31')]);_0x2953a2[_0xd764('0x35')]=_[_0xd764('0x34')](_0x579b95['model'],qs['fields'](_0x17baf2[_0xd764('0x31')][_0xd764('0x36')]));_0x2953a2['attributes']=_0x2953a2[_0xd764('0x35')]['length']?_0x2953a2[_0xd764('0x35')]:_0x579b95['model'];if(!_0x17baf2[_0xd764('0x31')][_0xd764('0x37')]('nolimit')){_0x2953a2[_0xd764('0x1d')]=qs[_0xd764('0x1d')](_0x17baf2[_0xd764('0x31')][_0xd764('0x1d')]);_0x2953a2[_0xd764('0x1c')]=qs[_0xd764('0x1c')](_0x17baf2[_0xd764('0x31')][_0xd764('0x1c')]);}_0x2953a2[_0xd764('0x38')]=qs[_0xd764('0x39')](_0x17baf2[_0xd764('0x31')][_0xd764('0x39')]);_0x2953a2[_0xd764('0x3a')]=qs[_0xd764('0x33')](_[_0xd764('0x3b')](_0x17baf2[_0xd764('0x31')],_0x579b95['filters']),_0x356a57);if(_0x17baf2['query'][_0xd764('0x3c')]){_0x2953a2[_0xd764('0x3a')]=_[_0xd764('0x3d')](_0x2953a2[_0xd764('0x3a')],{'$or':_['map'](_0x356a57,function(_0x517b73){if(_0x517b73[_0xd764('0x3e')]!==_0xd764('0x3f')){var _0x51ac77={};_0x51ac77[_0x517b73[_0xd764('0x2b')]]={'$like':'%'+_0x17baf2[_0xd764('0x31')][_0xd764('0x3c')]+'%'};return _0x51ac77;}})});}_0x2953a2=_[_0xd764('0x3d')]({},_0x2953a2,_0x17baf2[_0xd764('0x40')]);var _0x1d8cfe={'where':_0x2953a2[_0xd764('0x3a')]};return db[_0xd764('0x2e')][_0xd764('0x41')](_0x1d8cfe)[_0xd764('0x25')](function(_0x2ce93c){_0x3a9227[_0xd764('0x41')]=_0x2ce93c;if(_0x17baf2[_0xd764('0x31')][_0xd764('0x42')]){_0x2953a2['include']=[{'all':!![]}];}return db[_0xd764('0x2e')][_0xd764('0x43')](_0x2953a2);})[_0xd764('0x25')](function(_0x6cab02){_0x3a9227['rows']=_0x6cab02;return _0x3a9227;})[_0xd764('0x25')](respondWithFilteredResult(_0x5d125d,_0x2953a2))[_0xd764('0x44')](handleError(_0x5d125d,null));};exports['show']=function(_0x30d582,_0x5b0761){var _0x5500ec={'raw':![],'where':{'id':_0x30d582[_0xd764('0x45')]['id']}},_0x2e83b1={};_0x2e83b1['model']=_[_0xd764('0x32')](db[_0xd764('0x2e')]['rawAttributes']);_0x2e83b1[_0xd764('0x31')]=_['keys'](_0x30d582[_0xd764('0x31')]);_0x2e83b1['filters']=_[_0xd764('0x34')](_0x2e83b1['model'],_0x2e83b1['query']);_0x5500ec[_0xd764('0x35')]=_[_0xd764('0x34')](_0x2e83b1[_0xd764('0x30')],qs[_0xd764('0x36')](_0x30d582['query'][_0xd764('0x36')]));_0x5500ec[_0xd764('0x35')]=_0x5500ec[_0xd764('0x35')]['length']?_0x5500ec[_0xd764('0x35')]:_0x2e83b1['model'];if(_0x30d582['query'][_0xd764('0x42')]){_0x5500ec['include']=[{'all':!![]}];}_0x5500ec=_[_0xd764('0x3d')]({},_0x5500ec,_0x30d582[_0xd764('0x40')]);return db[_0xd764('0x2e')]['find'](_0x5500ec)['then'](handleEntityNotFound(_0x5b0761,null))[_0xd764('0x25')](respondWithResult(_0x5b0761,null))[_0xd764('0x44')](handleError(_0x5b0761,null));};exports[_0xd764('0x46')]=function(_0x29d63c,_0x4319e4){return db['JscriptyProject']['create'](_0x29d63c[_0xd764('0x47')],{})[_0xd764('0x25')](function(_0xc035f6){var _0x1f4d7a=_0x29d63c['user'][_0xd764('0x48')]({'plain':!![]});if(!_0x1f4d7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f4d7a[_0xd764('0x49')]===_0xd764('0x4a')){var _0x483c2e=_0xc035f6[_0xd764('0x48')]({'plain':!![]});var _0x5583bf=_0xd764('0x27');return db[_0xd764('0x4b')][_0xd764('0x4c')]({'where':{'name':_0x5583bf,'userProfileId':_0x1f4d7a[_0xd764('0x4d')]},'raw':!![]})[_0xd764('0x25')](function(_0x4f0105){if(_0x4f0105&&_0x4f0105[_0xd764('0x4e')]===0x0){return db[_0xd764('0x28')]['create']({'name':_0x483c2e[_0xd764('0x2b')],'resourceId':_0x483c2e['id'],'type':_0x4f0105['name'],'sectionId':_0x4f0105['id']},{})[_0xd764('0x25')](function(){return _0xc035f6;});}else{return _0xc035f6;}})[_0xd764('0x44')](function(_0x5c4a0f){logger[_0xd764('0x29')](_0xd764('0x4f'),_0x5c4a0f);throw _0x5c4a0f;});}return _0xc035f6;})[_0xd764('0x25')](respondWithResult(_0x4319e4,0xc9))[_0xd764('0x44')](handleError(_0x4319e4,null));};exports[_0xd764('0x50')]=function(_0x5c1ef2,_0x2d74cc){var _0x1113c6={'where':{'id':_0x5c1ef2[_0xd764('0x45')]['id']}},_0x312013={};_0x312013[_0xd764('0x30')]=_[_0xd764('0x32')](db[_0xd764('0x2e')][_0xd764('0x2f')]);_0x1113c6[_0xd764('0x35')]=_[_0xd764('0x34')](_0x312013[_0xd764('0x30')],qs[_0xd764('0x36')](_0x5c1ef2[_0xd764('0x31')]['fields']));_0x1113c6[_0xd764('0x35')]=_0x1113c6[_0xd764('0x35')][_0xd764('0x51')]?_0x1113c6[_0xd764('0x35')]:_0x312013['model'];if(_0x5c1ef2[_0xd764('0x31')][_0xd764('0x42')]){_0x1113c6[_0xd764('0x52')]=[{'all':!![]}];}_0x1113c6=_['merge']({},_0x1113c6,_0x5c1ef2[_0xd764('0x40')]);return db[_0xd764('0x2e')][_0xd764('0x4c')](_0x1113c6)['then'](handleEntityNotFound(_0x2d74cc,null))['then'](function(_0x1f8e48){if(_0x1f8e48){var _0x2d385c=_0x1f8e48[_0xd764('0x48')]({'plain':!![]});_0x2d385c=qs[_0xd764('0x53')](_0x2d385c,['id',_0xd764('0x54'),'updatedAt']);_0x5c1ef2['body']=_[_0xd764('0x53')](_0x5c1ef2[_0xd764('0x47')],['id',_0xd764('0x54'),_0xd764('0x55')]);return db[_0xd764('0x2e')][_0xd764('0x46')](_['merge'](_0x2d385c,_0x5c1ef2[_0xd764('0x47')]),{'include':_0x5c1ef2[_0xd764('0x31')][_0xd764('0x42')]?[{'all':!![]}]:undefined})[_0xd764('0x25')](function(_0x3019e9){var _0x12c549=_0x5c1ef2[_0xd764('0x4a')][_0xd764('0x48')]({'plain':!![]});if(!_0x12c549)throw new Error(_0xd764('0x56'));if(_0x12c549[_0xd764('0x49')]===_0xd764('0x4a')){var _0x3e6722=_0x3019e9['get']({'plain':!![]});var _0x3b1725='Projects';return db[_0xd764('0x4b')][_0xd764('0x4c')]({'where':{'name':_0x3b1725,'userProfileId':_0x12c549[_0xd764('0x4d')]},'raw':!![]})[_0xd764('0x25')](function(_0x7c6225){if(_0x7c6225&&_0x7c6225[_0xd764('0x4e')]===0x0){return db[_0xd764('0x28')][_0xd764('0x46')]({'name':_0x3e6722['name'],'resourceId':_0x3e6722['id'],'type':_0x7c6225['name'],'sectionId':_0x7c6225['id']},{})[_0xd764('0x25')](function(){return _0x3019e9;});}else{return _0x3019e9;}})['catch'](function(_0x4d57cc){logger[_0xd764('0x29')](_0xd764('0x4f'),_0x4d57cc);throw _0x4d57cc;});}return _0x3019e9;});}})[_0xd764('0x25')](respondWithResult(_0x2d74cc,0xc9))[_0xd764('0x44')](handleError(_0x2d74cc,null));};exports['update']=function(_0x5b176f,_0x5bf0e8){if(_0x5b176f[_0xd764('0x47')]['id']){delete _0x5b176f[_0xd764('0x47')]['id'];}return db[_0xd764('0x2e')][_0xd764('0x4c')]({'where':{'id':_0x5b176f[_0xd764('0x45')]['id']}})[_0xd764('0x25')](handleEntityNotFound(_0x5bf0e8,null))['then'](saveUpdates(_0x5b176f[_0xd764('0x47')],null))[_0xd764('0x25')](respondWithResult(_0x5bf0e8,null))['catch'](handleError(_0x5bf0e8,null));};exports[_0xd764('0x26')]=function(_0x3037cf,_0x32266f){return db[_0xd764('0x2e')][_0xd764('0x4c')]({'where':{'id':_0x3037cf[_0xd764('0x45')]['id']}})['then'](handleEntityNotFound(_0x32266f,null))[_0xd764('0x25')](removeEntity(_0x32266f,null))[_0xd764('0x44')](handleError(_0x32266f,null));};exports[_0xd764('0x57')]=function(_0x4190a3,_0x121869,_0x482c5c){var _0x5bf1dc={'raw':!![],'where':{}};var _0x1e8bf2={};var _0x38f827={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd764('0x58')]({'where':{'id':_0x4190a3[_0xd764('0x45')]['id']}})[_0xd764('0x25')](handleEntityNotFound(_0x121869,null))['then'](function(_0x11ac74){if(_0x11ac74){_0x1e8bf2[_0xd764('0x30')]=_[_0xd764('0x32')](db[_0xd764('0x59')]['rawAttributes']);_0x1e8bf2[_0xd764('0x31')]=_[_0xd764('0x32')](_0x4190a3[_0xd764('0x31')]);_0x1e8bf2[_0xd764('0x33')]=_[_0xd764('0x34')](_0x1e8bf2[_0xd764('0x30')],_0x1e8bf2[_0xd764('0x31')]);_0x5bf1dc[_0xd764('0x35')]=_[_0xd764('0x34')](_0x1e8bf2[_0xd764('0x30')],qs[_0xd764('0x36')](_0x4190a3[_0xd764('0x31')]['fields']));_0x5bf1dc[_0xd764('0x35')]=_0x5bf1dc[_0xd764('0x35')]['length']?_0x5bf1dc[_0xd764('0x35')]:_0x1e8bf2[_0xd764('0x30')];if(!_0x4190a3[_0xd764('0x31')]['hasOwnProperty'](_0xd764('0x5a'))){_0x5bf1dc[_0xd764('0x1d')]=qs['limit'](_0x4190a3[_0xd764('0x31')][_0xd764('0x1d')]);_0x5bf1dc[_0xd764('0x1c')]=qs[_0xd764('0x1c')](_0x4190a3[_0xd764('0x31')][_0xd764('0x1c')]);}_0x5bf1dc[_0xd764('0x38')]=qs[_0xd764('0x39')](_0x4190a3[_0xd764('0x31')][_0xd764('0x39')]);_0x5bf1dc[_0xd764('0x3a')]=qs['filters'](_[_0xd764('0x3b')](_0x4190a3['query'],_0x1e8bf2[_0xd764('0x33')]));_0x5bf1dc[_0xd764('0x3a')][_0xd764('0x5b')]=_0x11ac74['id'];if(_0x4190a3['query'][_0xd764('0x3c')]){_0x5bf1dc[_0xd764('0x3a')]=_[_0xd764('0x3d')](_0x5bf1dc[_0xd764('0x3a')],{'$or':_[_0xd764('0x2d')](_0x5bf1dc['attributes'],function(_0x2779d6){var _0x5ae698={};_0x5ae698[_0x2779d6]={'$like':'%'+_0x4190a3[_0xd764('0x31')][_0xd764('0x3c')]+'%'};return _0x5ae698;})});}_0x5bf1dc=_[_0xd764('0x3d')]({},_0x5bf1dc,_0x4190a3[_0xd764('0x40')]);return db[_0xd764('0x59')]['count']({'where':_0x5bf1dc[_0xd764('0x3a')]})[_0xd764('0x25')](function(_0x5a25ee){_0x38f827[_0xd764('0x41')]=_0x5a25ee;if(_0x4190a3[_0xd764('0x31')]['includeAll']){_0x5bf1dc[_0xd764('0x52')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5bf1dc);})[_0xd764('0x25')](function(_0xa1acbf){_0x38f827[_0xd764('0x5c')]=_0xa1acbf;return _0x38f827;});}})['then'](respondWithFilteredResult(_0x121869,_0x5bf1dc))[_0xd764('0x44')](handleError(_0x121869,null));};exports[_0xd764('0x5d')]=function(_0x14d8ff,_0x374b7e,_0x2783b2){var _0x38f46f={'raw':!![],'where':{}};var _0x5c30ee={};var _0x217c3d={'count':0x0,'rows':[]};return db[_0xd764('0x2e')]['findOne']({'where':{'id':_0x14d8ff[_0xd764('0x45')]['id']}})['then'](handleEntityNotFound(_0x374b7e,null))[_0xd764('0x25')](function(_0x56b6e0){if(_0x56b6e0){_0x5c30ee[_0xd764('0x30')]=_['keys'](db[_0xd764('0x5e')][_0xd764('0x2f')]);_0x5c30ee[_0xd764('0x31')]=_['keys'](_0x14d8ff['query']);_0x5c30ee[_0xd764('0x33')]=_[_0xd764('0x34')](_0x5c30ee[_0xd764('0x30')],_0x5c30ee[_0xd764('0x31')]);_0x38f46f[_0xd764('0x35')]=_[_0xd764('0x34')](_0x5c30ee[_0xd764('0x30')],qs[_0xd764('0x36')](_0x14d8ff[_0xd764('0x31')][_0xd764('0x36')]));_0x38f46f[_0xd764('0x35')]=_0x38f46f[_0xd764('0x35')][_0xd764('0x51')]?_0x38f46f[_0xd764('0x35')]:_0x5c30ee[_0xd764('0x30')];if(!_0x14d8ff[_0xd764('0x31')][_0xd764('0x37')](_0xd764('0x5a'))){_0x38f46f[_0xd764('0x1d')]=qs[_0xd764('0x1d')](_0x14d8ff[_0xd764('0x31')][_0xd764('0x1d')]);_0x38f46f[_0xd764('0x1c')]=qs[_0xd764('0x1c')](_0x14d8ff[_0xd764('0x31')][_0xd764('0x1c')]);}_0x38f46f[_0xd764('0x38')]=qs[_0xd764('0x39')](_0x14d8ff['query'][_0xd764('0x39')]);_0x38f46f[_0xd764('0x3a')]=qs[_0xd764('0x33')](_[_0xd764('0x3b')](_0x14d8ff[_0xd764('0x31')],_0x5c30ee[_0xd764('0x33')]));_0x38f46f['where'][_0xd764('0x5b')]=_0x56b6e0['id'];if(_0x14d8ff[_0xd764('0x31')][_0xd764('0x3c')]){_0x38f46f[_0xd764('0x3a')]=_[_0xd764('0x3d')](_0x38f46f[_0xd764('0x3a')],{'$or':_[_0xd764('0x2d')](_0x38f46f['attributes'],function(_0x50759b){var _0x4fbdc0={};_0x4fbdc0[_0x50759b]={'$like':'%'+_0x14d8ff['query'][_0xd764('0x3c')]+'%'};return _0x4fbdc0;})});}_0x38f46f=_['merge']({},_0x38f46f,_0x14d8ff[_0xd764('0x40')]);return db['JscriptyAnswerReport'][_0xd764('0x41')]({'where':_0x38f46f[_0xd764('0x3a')]})[_0xd764('0x25')](function(_0x348e9b){_0x217c3d[_0xd764('0x41')]=_0x348e9b;if(_0x14d8ff[_0xd764('0x31')][_0xd764('0x42')]){_0x38f46f[_0xd764('0x52')]=[{'all':!![]}];}return db[_0xd764('0x5e')][_0xd764('0x43')](_0x38f46f);})[_0xd764('0x25')](function(_0x1db478){_0x217c3d[_0xd764('0x5c')]=_0x1db478;return _0x217c3d;});}})[_0xd764('0x25')](respondWithFilteredResult(_0x374b7e,_0x38f46f))[_0xd764('0x44')](handleError(_0x374b7e,null));};function char(_0x158e6a){return _0xd764('0x5f')===typeof _0x158e6a?String[_0xd764('0x60')][_0xd764('0x21')](null,arguments):_0x158e6a;}function needsEncapsulation(_0x5bf0a0){return!!_0x5bf0a0&&(_0x5bf0a0['toString']()[_0xd764('0x61')](char(0xd))>=0x0||_0x5bf0a0[_0xd764('0x62')]()[_0xd764('0x61')](char(0xa))>=0x0||_0x5bf0a0[_0xd764('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x5bf0a0[_0xd764('0x62')]()[_0xd764('0x61')](char(0x22))>=0x0);}function encapsulate(_0x5eab6a){var _0x1f5478=char(0x22),_0x49d96b='\x5c'+char(0x22),_0x1f9a03=_0x5eab6a[_0xd764('0x62')]()['replace'](new RegExp(_0x1f5478,'g'),_0x49d96b);return _0x1f5478+_0x1f9a03+_0x1f5478;}exports['getSummary']=function(_0x2ed02d,_0x433202,_0x5519f6){var _0x2813d2,_0x3f5aa6;var _0x43f2bb={'where':{'ProjectId':_0x2ed02d['params']['id']}};if(_0x2ed02d[_0xd764('0x31')]['startTime']){_0x43f2bb[_0xd764('0x3a')][_0xd764('0x63')]=JSON['parse'](_0x2ed02d['query'][_0xd764('0x64')]);}return db[_0xd764('0x59')]['findAll'](_0x43f2bb)[_0xd764('0x25')](handleEntityNotFound(_0x433202,null))['then'](function(_0x34e823){if(_0x34e823){_0x2813d2=_0x34e823;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xd764('0x2d')](_0x2813d2,'id')},'ProjectId':_0x2ed02d[_0xd764('0x45')]['id']},'order':'-createdAt'});}})[_0xd764('0x25')](handleEntityNotFound(_0x433202,null))[_0xd764('0x25')](function(_0x3e7cb2){if(_0x3e7cb2){_0x3f5aa6=_0x3e7cb2;var _0x3936e3={};for(var _0x6af4ef=0x0,_0x191918=_0x3f5aa6[_0xd764('0x51')];_0x6af4ef<_0x191918;_0x6af4ef++){if(!_0x3936e3[_0xd764('0x37')](_0x3f5aa6[_0x6af4ef][_0xd764('0x65')])){_0x3936e3[_0x3f5aa6[_0x6af4ef][_0xd764('0x65')]]=needsEncapsulation(_0x3f5aa6[_0x6af4ef][_0xd764('0x66')])?encapsulate(_0x3f5aa6[_0x6af4ef][_0xd764('0x66')]):_0x3f5aa6[_0x6af4ef][_0xd764('0x66')];}}var _0x7b3e=[],_0x13ab14={};for(var _0x54e6ed=0x0,_0x23ea81=_0x2813d2['length'];_0x54e6ed<_0x23ea81;_0x54e6ed++){_0x13ab14={'ProjectId':_0x2ed02d[_0xd764('0x45')]['id'],'SessionId':_0x2813d2[_0x54e6ed]['id'],'StartTime':moment(_0x2813d2[_0x54e6ed][_0xd764('0x63')])[_0xd764('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x364d66=0x0,_0x3aa24e=_0x3f5aa6[_0xd764('0x51')];_0x364d66<_0x3aa24e;_0x364d66++){if(_0x3f5aa6[_0x364d66]['SessionId']==_0x2813d2[_0x54e6ed]['id']&&_0x3936e3[_0xd764('0x37')](_0x3f5aa6[_0x364d66][_0xd764('0x65')])){_0x13ab14[_0x3936e3[_0x3f5aa6[_0x364d66][_0xd764('0x65')]]]=_0x3f5aa6[_0x364d66][_0xd764('0x68')];}}for(var _0xc6fb35 in _0x3936e3){if(!_0x13ab14[_0xd764('0x37')](_0x3936e3[_0xc6fb35])){_0x13ab14[_0x3936e3[_0xc6fb35]]=null;}}_0x7b3e[_0xd764('0x69')](_0x13ab14);}return _0x7b3e;}})[_0xd764('0x25')](function(_0x1d4908){if(!_[_0xd764('0x6a')](_0x1d4908)){var _0x4bf701=toCsv(_0x1d4908);var _0x3ced0b=Date[_0xd764('0x6b')]();fs[_0xd764('0x6c')](util[_0xd764('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2ed02d[_0xd764('0x45')]['id'],_0x3ced0b),_0x4bf701);_0x433202[_0xd764('0x6d')]('Content-disposition',_0xd764('0x6e')+util['format'](_0xd764('0x6f'),_0x2ed02d[_0xd764('0x45')]['id'],_0x3ced0b));_0x433202[_0xd764('0x6d')](_0xd764('0x70'),'text/csv');return _0x433202['download'](util[_0xd764('0x67')](_0xd764('0x71'),_0x2ed02d['params']['id'],_0x3ced0b));}else{return _0x433202[_0xd764('0x19')](0xcc);}})[_0xd764('0x44')](handleError(_0x433202,null));}; \ No newline at end of file +var _0x2421=['answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','map','JscriptyProject','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId'];(function(_0x453fcd,_0x4608bb){var _0x14c9dc=function(_0x534c7a){while(--_0x534c7a){_0x453fcd['push'](_0x453fcd['shift']());}};_0x14c9dc(++_0x4608bb);}(_0x2421,0x165));var _0x1242=function(_0x59c49e,_0x5731ff){_0x59c49e=_0x59c49e-0x0;var _0x62521b=_0x2421[_0x59c49e];return _0x62521b;};'use strict';var pdf=require(_0x1242('0x0'));var emlformat=require(_0x1242('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1242('0x2'));var rp=require(_0x1242('0x3'));var moment=require(_0x1242('0x4'));var BPromise=require(_0x1242('0x5'));var Mustache=require(_0x1242('0x6'));var util=require(_0x1242('0x7'));var path=require(_0x1242('0x8'));var sox=require('sox');var csv=require(_0x1242('0x9'));var ejs=require(_0x1242('0xa'));var fs=require('fs');var _=require(_0x1242('0xb'));var squel=require(_0x1242('0xc'));var crypto=require(_0x1242('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1242('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1242('0xf'));var Papa=require(_0x1242('0x10'));var Redis=require(_0x1242('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1242('0x12'));var as=require(_0x1242('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1242('0x14'))(_0x1242('0x15'));var utils=require(_0x1242('0x16'));var config=require(_0x1242('0x17'));var db=require(_0x1242('0x18'))['db'];function respondWithStatusCode(_0x19b500,_0x4095d6){_0x4095d6=_0x4095d6||0xcc;return function(_0x154f58){if(_0x154f58){return _0x19b500[_0x1242('0x19')](_0x4095d6);}return _0x19b500[_0x1242('0x1a')](_0x4095d6)[_0x1242('0x1b')]();};}function respondWithResult(_0x2221ad,_0x2f168d){_0x2f168d=_0x2f168d||0xc8;return function(_0x272e98){if(_0x272e98){return _0x2221ad['status'](_0x2f168d)[_0x1242('0x1c')](_0x272e98);}};}function respondWithFilteredResult(_0x14ebdb,_0x1431ef){return function(_0x905150){if(_0x905150){var _0x40251a=_0x905150[_0x1242('0x1d')],_0x38cf8e=_0x1431ef['offset'],_0xeb47d3=_0x1431ef[_0x1242('0x1e')]+_0x1431ef[_0x1242('0x1f')],_0x3175af;if(_0xeb47d3>=_0x40251a){_0xeb47d3=_0x40251a;_0x3175af=0xc8;}else{_0x3175af=0xce;}_0x14ebdb['status'](_0x3175af);return _0x14ebdb['set'](_0x1242('0x20'),_0x38cf8e+'-'+_0xeb47d3+'/'+_0x40251a)[_0x1242('0x1c')](_0x905150);}return null;};}function patchUpdates(_0x504287){return function(_0x400451){try{jsonpatch[_0x1242('0x21')](_0x400451,_0x504287,!![]);}catch(_0x360ce4){return BPromise[_0x1242('0x22')](_0x360ce4);}return _0x400451[_0x1242('0x23')]();};}function saveUpdates(_0x2c36fd,_0x204d77){return function(_0x4a539e){if(_0x4a539e){return _0x4a539e[_0x1242('0x24')](_0x2c36fd)[_0x1242('0x25')](function(_0x5d0440){return _0x5d0440;});}return null;};}function removeEntity(_0x50faea,_0x2995a8){return function(_0x3a1dd4){if(_0x3a1dd4){return _0x3a1dd4[_0x1242('0x26')]()[_0x1242('0x25')](function(){var _0x2f56bd=_0x3a1dd4[_0x1242('0x27')]({'plain':!![]});var _0x42706c=_0x1242('0x28');return db[_0x1242('0x29')][_0x1242('0x26')]({'where':{'type':_0x42706c,'resourceId':_0x2f56bd['id']}})[_0x1242('0x25')](function(){return _0x3a1dd4;});})[_0x1242('0x25')](function(){_0x50faea[_0x1242('0x1a')](0xcc)[_0x1242('0x1b')]();});}};}function handleEntityNotFound(_0x26af68,_0x5dd126){return function(_0x5897c2){if(!_0x5897c2){_0x26af68['sendStatus'](0x194);}return _0x5897c2;};}function handleError(_0x189e9f,_0x5df77c){_0x5df77c=_0x5df77c||0x1f4;return function(_0x4d9602){logger[_0x1242('0x2a')](_0x4d9602['stack']);if(_0x4d9602[_0x1242('0x2b')]){delete _0x4d9602[_0x1242('0x2b')];}_0x189e9f['status'](_0x5df77c)[_0x1242('0x2c')](_0x4d9602);};}exports['index']=function(_0x337b93,_0x340672){var _0x103142={},_0x5d5df7={},_0x1651d7={'count':0x0,'rows':[]};var _0x18ae03=_[_0x1242('0x2d')](db[_0x1242('0x2e')]['rawAttributes'],function(_0x1d7c32){return{'name':_0x1d7c32['fieldName'],'type':_0x1d7c32[_0x1242('0x2f')][_0x1242('0x30')]};});_0x5d5df7[_0x1242('0x31')]=_[_0x1242('0x2d')](_0x18ae03,_0x1242('0x2b'));_0x5d5df7[_0x1242('0x32')]=_[_0x1242('0x33')](_0x337b93[_0x1242('0x32')]);_0x5d5df7['filters']=_[_0x1242('0x34')](_0x5d5df7[_0x1242('0x31')],_0x5d5df7[_0x1242('0x32')]);_0x103142[_0x1242('0x35')]=_[_0x1242('0x34')](_0x5d5df7[_0x1242('0x31')],qs[_0x1242('0x36')](_0x337b93[_0x1242('0x32')][_0x1242('0x36')]));_0x103142['attributes']=_0x103142[_0x1242('0x35')][_0x1242('0x37')]?_0x103142[_0x1242('0x35')]:_0x5d5df7['model'];if(!_0x337b93[_0x1242('0x32')][_0x1242('0x38')](_0x1242('0x39'))){_0x103142[_0x1242('0x1f')]=qs[_0x1242('0x1f')](_0x337b93[_0x1242('0x32')][_0x1242('0x1f')]);_0x103142[_0x1242('0x1e')]=qs[_0x1242('0x1e')](_0x337b93['query'][_0x1242('0x1e')]);}_0x103142[_0x1242('0x3a')]=qs[_0x1242('0x3b')](_0x337b93['query']['sort']);_0x103142[_0x1242('0x3c')]=qs[_0x1242('0x3d')](_[_0x1242('0x3e')](_0x337b93[_0x1242('0x32')],_0x5d5df7[_0x1242('0x3d')]),_0x18ae03);if(_0x337b93[_0x1242('0x32')][_0x1242('0x3f')]){_0x103142[_0x1242('0x3c')]=_[_0x1242('0x40')](_0x103142[_0x1242('0x3c')],{'$or':_[_0x1242('0x2d')](_0x18ae03,function(_0x3d7f3a){if(_0x3d7f3a['type']!==_0x1242('0x41')){var _0x314f8b={};_0x314f8b[_0x3d7f3a['name']]={'$like':'%'+_0x337b93['query'][_0x1242('0x3f')]+'%'};return _0x314f8b;}})});}_0x103142=_[_0x1242('0x40')]({},_0x103142,_0x337b93[_0x1242('0x42')]);var _0x81ce93={'where':_0x103142[_0x1242('0x3c')]};return db[_0x1242('0x2e')][_0x1242('0x1d')](_0x81ce93)[_0x1242('0x25')](function(_0x505d94){_0x1651d7[_0x1242('0x1d')]=_0x505d94;if(_0x337b93[_0x1242('0x32')][_0x1242('0x43')]){_0x103142[_0x1242('0x44')]=[{'all':!![]}];}return db[_0x1242('0x2e')]['findAll'](_0x103142);})[_0x1242('0x25')](function(_0x3b6462){_0x1651d7[_0x1242('0x45')]=_0x3b6462;return _0x1651d7;})['then'](respondWithFilteredResult(_0x340672,_0x103142))[_0x1242('0x46')](handleError(_0x340672,null));};exports[_0x1242('0x47')]=function(_0x1c2ddc,_0x290c2e){var _0xb94cd={'raw':![],'where':{'id':_0x1c2ddc['params']['id']}},_0x5473f9={};_0x5473f9[_0x1242('0x31')]=_[_0x1242('0x33')](db[_0x1242('0x2e')][_0x1242('0x48')]);_0x5473f9[_0x1242('0x32')]=_[_0x1242('0x33')](_0x1c2ddc[_0x1242('0x32')]);_0x5473f9[_0x1242('0x3d')]=_[_0x1242('0x34')](_0x5473f9[_0x1242('0x31')],_0x5473f9[_0x1242('0x32')]);_0xb94cd[_0x1242('0x35')]=_[_0x1242('0x34')](_0x5473f9[_0x1242('0x31')],qs[_0x1242('0x36')](_0x1c2ddc['query'][_0x1242('0x36')]));_0xb94cd['attributes']=_0xb94cd[_0x1242('0x35')]['length']?_0xb94cd[_0x1242('0x35')]:_0x5473f9[_0x1242('0x31')];if(_0x1c2ddc[_0x1242('0x32')][_0x1242('0x43')]){_0xb94cd['include']=[{'all':!![]}];}_0xb94cd=_[_0x1242('0x40')]({},_0xb94cd,_0x1c2ddc[_0x1242('0x42')]);return db[_0x1242('0x2e')][_0x1242('0x49')](_0xb94cd)[_0x1242('0x25')](handleEntityNotFound(_0x290c2e,null))[_0x1242('0x25')](respondWithResult(_0x290c2e,null))[_0x1242('0x46')](handleError(_0x290c2e,null));};exports[_0x1242('0x4a')]=function(_0x3709fd,_0x53f9a8){return db[_0x1242('0x2e')][_0x1242('0x4a')](_0x3709fd[_0x1242('0x4b')],{})[_0x1242('0x25')](function(_0x17ce0f){var _0x1590f7=_0x3709fd[_0x1242('0x4c')][_0x1242('0x27')]({'plain':!![]});if(!_0x1590f7)throw new Error(_0x1242('0x4d'));if(_0x1590f7[_0x1242('0x4e')]==='user'){var _0x314bb1=_0x17ce0f[_0x1242('0x27')]({'plain':!![]});var _0x4e2583=_0x1242('0x28');return db[_0x1242('0x4f')]['find']({'where':{'name':_0x4e2583,'userProfileId':_0x1590f7[_0x1242('0x50')]},'raw':!![]})[_0x1242('0x25')](function(_0x5374b6){if(_0x5374b6&&_0x5374b6[_0x1242('0x51')]===0x0){return db[_0x1242('0x29')][_0x1242('0x4a')]({'name':_0x314bb1['name'],'resourceId':_0x314bb1['id'],'type':_0x5374b6[_0x1242('0x2b')],'sectionId':_0x5374b6['id']},{})['then'](function(){return _0x17ce0f;});}else{return _0x17ce0f;}})[_0x1242('0x46')](function(_0x3fffdf){logger[_0x1242('0x2a')](_0x1242('0x52'),_0x3fffdf);throw _0x3fffdf;});}return _0x17ce0f;})['then'](respondWithResult(_0x53f9a8,0xc9))[_0x1242('0x46')](handleError(_0x53f9a8,null));};exports[_0x1242('0x53')]=function(_0x2c030a,_0x1e2a94){var _0x5f0905={'where':{'id':_0x2c030a[_0x1242('0x54')]['id']}},_0x38cebf={};_0x38cebf[_0x1242('0x31')]=_[_0x1242('0x33')](db[_0x1242('0x2e')][_0x1242('0x48')]);_0x5f0905[_0x1242('0x35')]=_[_0x1242('0x34')](_0x38cebf[_0x1242('0x31')],qs[_0x1242('0x36')](_0x2c030a['query']['fields']));_0x5f0905['attributes']=_0x5f0905[_0x1242('0x35')][_0x1242('0x37')]?_0x5f0905[_0x1242('0x35')]:_0x38cebf[_0x1242('0x31')];if(_0x2c030a['query'][_0x1242('0x43')]){_0x5f0905['include']=[{'all':!![]}];}_0x5f0905=_[_0x1242('0x40')]({},_0x5f0905,_0x2c030a[_0x1242('0x42')]);return db[_0x1242('0x2e')][_0x1242('0x49')](_0x5f0905)[_0x1242('0x25')](handleEntityNotFound(_0x1e2a94,null))[_0x1242('0x25')](function(_0x1c0a2e){if(_0x1c0a2e){var _0x3fa338=_0x1c0a2e[_0x1242('0x27')]({'plain':!![]});_0x3fa338=qs[_0x1242('0x55')](_0x3fa338,['id',_0x1242('0x56'),_0x1242('0x57')]);_0x2c030a['body']=_[_0x1242('0x55')](_0x2c030a[_0x1242('0x4b')],['id','createdAt','updatedAt']);return db[_0x1242('0x2e')][_0x1242('0x4a')](_[_0x1242('0x40')](_0x3fa338,_0x2c030a[_0x1242('0x4b')]),{'include':_0x2c030a[_0x1242('0x32')][_0x1242('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x181112){var _0x532799=_0x2c030a[_0x1242('0x4c')][_0x1242('0x27')]({'plain':!![]});if(!_0x532799)throw new Error(_0x1242('0x4d'));if(_0x532799['role']===_0x1242('0x4c')){var _0x2445a0=_0x181112[_0x1242('0x27')]({'plain':!![]});var _0x10bc2d='Projects';return db[_0x1242('0x4f')]['find']({'where':{'name':_0x10bc2d,'userProfileId':_0x532799['userProfileId']},'raw':!![]})[_0x1242('0x25')](function(_0x3b6db5){if(_0x3b6db5&&_0x3b6db5[_0x1242('0x51')]===0x0){return db['UserProfileResource'][_0x1242('0x4a')]({'name':_0x2445a0[_0x1242('0x2b')],'resourceId':_0x2445a0['id'],'type':_0x3b6db5[_0x1242('0x2b')],'sectionId':_0x3b6db5['id']},{})[_0x1242('0x25')](function(){return _0x181112;});}else{return _0x181112;}})[_0x1242('0x46')](function(_0x51406e){logger[_0x1242('0x2a')](_0x1242('0x52'),_0x51406e);throw _0x51406e;});}return _0x181112;});}})[_0x1242('0x25')](respondWithResult(_0x1e2a94,0xc9))['catch'](handleError(_0x1e2a94,null));};exports['update']=function(_0x484183,_0x5d82c9){if(_0x484183[_0x1242('0x4b')]['id']){delete _0x484183[_0x1242('0x4b')]['id'];}return db[_0x1242('0x2e')][_0x1242('0x49')]({'where':{'id':_0x484183[_0x1242('0x54')]['id']}})[_0x1242('0x25')](handleEntityNotFound(_0x5d82c9,null))['then'](saveUpdates(_0x484183[_0x1242('0x4b')],null))[_0x1242('0x25')](respondWithResult(_0x5d82c9,null))[_0x1242('0x46')](handleError(_0x5d82c9,null));};exports[_0x1242('0x26')]=function(_0x3757d2,_0x2ce935){return db[_0x1242('0x2e')][_0x1242('0x49')]({'where':{'id':_0x3757d2['params']['id']}})[_0x1242('0x25')](handleEntityNotFound(_0x2ce935,null))['then'](removeEntity(_0x2ce935,null))[_0x1242('0x46')](handleError(_0x2ce935,null));};exports[_0x1242('0x58')]=function(_0x3d28d5,_0x2f554e,_0x2e5cbf){var _0x3d1c71={'raw':!![],'where':{}};var _0x4c2663={};var _0x5b0bdc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1242('0x59')]({'where':{'id':_0x3d28d5['params']['id']}})[_0x1242('0x25')](handleEntityNotFound(_0x2f554e,null))['then'](function(_0x325a5b){if(_0x325a5b){_0x4c2663[_0x1242('0x31')]=_[_0x1242('0x33')](db[_0x1242('0x5a')][_0x1242('0x48')]);_0x4c2663['query']=_[_0x1242('0x33')](_0x3d28d5[_0x1242('0x32')]);_0x4c2663[_0x1242('0x3d')]=_[_0x1242('0x34')](_0x4c2663[_0x1242('0x31')],_0x4c2663['query']);_0x3d1c71[_0x1242('0x35')]=_[_0x1242('0x34')](_0x4c2663[_0x1242('0x31')],qs[_0x1242('0x36')](_0x3d28d5[_0x1242('0x32')][_0x1242('0x36')]));_0x3d1c71[_0x1242('0x35')]=_0x3d1c71['attributes']['length']?_0x3d1c71[_0x1242('0x35')]:_0x4c2663['model'];if(!_0x3d28d5[_0x1242('0x32')][_0x1242('0x38')](_0x1242('0x39'))){_0x3d1c71[_0x1242('0x1f')]=qs[_0x1242('0x1f')](_0x3d28d5[_0x1242('0x32')][_0x1242('0x1f')]);_0x3d1c71[_0x1242('0x1e')]=qs[_0x1242('0x1e')](_0x3d28d5[_0x1242('0x32')][_0x1242('0x1e')]);}_0x3d1c71['order']=qs[_0x1242('0x3b')](_0x3d28d5[_0x1242('0x32')][_0x1242('0x3b')]);_0x3d1c71[_0x1242('0x3c')]=qs[_0x1242('0x3d')](_['pick'](_0x3d28d5['query'],_0x4c2663[_0x1242('0x3d')]));_0x3d1c71['where'][_0x1242('0x5b')]=_0x325a5b['id'];if(_0x3d28d5[_0x1242('0x32')][_0x1242('0x3f')]){_0x3d1c71[_0x1242('0x3c')]=_[_0x1242('0x40')](_0x3d1c71[_0x1242('0x3c')],{'$or':_[_0x1242('0x2d')](_0x3d1c71[_0x1242('0x35')],function(_0x2594ae){var _0x143a60={};_0x143a60[_0x2594ae]={'$like':'%'+_0x3d28d5[_0x1242('0x32')]['filter']+'%'};return _0x143a60;})});}_0x3d1c71=_[_0x1242('0x40')]({},_0x3d1c71,_0x3d28d5[_0x1242('0x42')]);return db[_0x1242('0x5a')][_0x1242('0x1d')]({'where':_0x3d1c71['where']})[_0x1242('0x25')](function(_0x46f2e3){_0x5b0bdc[_0x1242('0x1d')]=_0x46f2e3;if(_0x3d28d5[_0x1242('0x32')][_0x1242('0x43')]){_0x3d1c71[_0x1242('0x44')]=[{'all':!![]}];}return db[_0x1242('0x5a')][_0x1242('0x5c')](_0x3d1c71);})[_0x1242('0x25')](function(_0x4a7394){_0x5b0bdc[_0x1242('0x45')]=_0x4a7394;return _0x5b0bdc;});}})[_0x1242('0x25')](respondWithFilteredResult(_0x2f554e,_0x3d1c71))['catch'](handleError(_0x2f554e,null));};exports['getAnswers']=function(_0x5f00a1,_0xef1fca,_0xddfb0d){var _0x3fb407={'raw':!![],'where':{}};var _0x13e047={};var _0x2e58ae={'count':0x0,'rows':[]};return db[_0x1242('0x2e')][_0x1242('0x59')]({'where':{'id':_0x5f00a1[_0x1242('0x54')]['id']}})[_0x1242('0x25')](handleEntityNotFound(_0xef1fca,null))[_0x1242('0x25')](function(_0x37bb43){if(_0x37bb43){_0x13e047['model']=_[_0x1242('0x33')](db[_0x1242('0x5d')][_0x1242('0x48')]);_0x13e047[_0x1242('0x32')]=_[_0x1242('0x33')](_0x5f00a1[_0x1242('0x32')]);_0x13e047['filters']=_[_0x1242('0x34')](_0x13e047['model'],_0x13e047[_0x1242('0x32')]);_0x3fb407[_0x1242('0x35')]=_[_0x1242('0x34')](_0x13e047['model'],qs['fields'](_0x5f00a1[_0x1242('0x32')]['fields']));_0x3fb407['attributes']=_0x3fb407['attributes'][_0x1242('0x37')]?_0x3fb407[_0x1242('0x35')]:_0x13e047['model'];if(!_0x5f00a1['query'][_0x1242('0x38')]('nolimit')){_0x3fb407[_0x1242('0x1f')]=qs[_0x1242('0x1f')](_0x5f00a1['query'][_0x1242('0x1f')]);_0x3fb407[_0x1242('0x1e')]=qs[_0x1242('0x1e')](_0x5f00a1[_0x1242('0x32')][_0x1242('0x1e')]);}_0x3fb407[_0x1242('0x3a')]=qs[_0x1242('0x3b')](_0x5f00a1[_0x1242('0x32')][_0x1242('0x3b')]);_0x3fb407['where']=qs[_0x1242('0x3d')](_[_0x1242('0x3e')](_0x5f00a1['query'],_0x13e047[_0x1242('0x3d')]));_0x3fb407[_0x1242('0x3c')][_0x1242('0x5b')]=_0x37bb43['id'];if(_0x5f00a1[_0x1242('0x32')][_0x1242('0x3f')]){_0x3fb407[_0x1242('0x3c')]=_[_0x1242('0x40')](_0x3fb407[_0x1242('0x3c')],{'$or':_[_0x1242('0x2d')](_0x3fb407['attributes'],function(_0x4b0edf){var _0x269d52={};_0x269d52[_0x4b0edf]={'$like':'%'+_0x5f00a1[_0x1242('0x32')][_0x1242('0x3f')]+'%'};return _0x269d52;})});}_0x3fb407=_['merge']({},_0x3fb407,_0x5f00a1['options']);return db[_0x1242('0x5d')][_0x1242('0x1d')]({'where':_0x3fb407['where']})[_0x1242('0x25')](function(_0xd650c4){_0x2e58ae[_0x1242('0x1d')]=_0xd650c4;if(_0x5f00a1['query']['includeAll']){_0x3fb407[_0x1242('0x44')]=[{'all':!![]}];}return db[_0x1242('0x5d')][_0x1242('0x5c')](_0x3fb407);})[_0x1242('0x25')](function(_0x426840){_0x2e58ae[_0x1242('0x45')]=_0x426840;return _0x2e58ae;});}})['then'](respondWithFilteredResult(_0xef1fca,_0x3fb407))['catch'](handleError(_0xef1fca,null));};function char(_0x1caede){return _0x1242('0x5e')===typeof _0x1caede?String[_0x1242('0x5f')]['apply'](null,arguments):_0x1caede;}function needsEncapsulation(_0x19bd4e){return!!_0x19bd4e&&(_0x19bd4e[_0x1242('0x60')]()[_0x1242('0x61')](char(0xd))>=0x0||_0x19bd4e[_0x1242('0x60')]()[_0x1242('0x61')](char(0xa))>=0x0||_0x19bd4e['toString']()[_0x1242('0x61')](char(0x2c))>=0x0||_0x19bd4e[_0x1242('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5bc012){var _0x25d858=char(0x22),_0x2efe14='\x5c'+char(0x22),_0x1e4566=_0x5bc012['toString']()[_0x1242('0x62')](new RegExp(_0x25d858,'g'),_0x2efe14);return _0x25d858+_0x1e4566+_0x25d858;}exports[_0x1242('0x63')]=function(_0x3b842e,_0xc50c4e,_0x18db4a){var _0x5b3fe0,_0x5aa49f;var _0x239606={'where':{'ProjectId':_0x3b842e[_0x1242('0x54')]['id']}};if(_0x3b842e[_0x1242('0x32')][_0x1242('0x64')]){_0x239606[_0x1242('0x3c')][_0x1242('0x65')]=JSON['parse'](_0x3b842e[_0x1242('0x32')]['startTime']);}return db[_0x1242('0x5a')][_0x1242('0x5c')](_0x239606)['then'](handleEntityNotFound(_0xc50c4e,null))['then'](function(_0x590eaf){if(_0x590eaf){_0x5b3fe0=_0x590eaf;return db['JscriptyQuestionReport'][_0x1242('0x5c')]({'where':{'SessionId':{'$in':_[_0x1242('0x2d')](_0x5b3fe0,'id')},'ProjectId':_0x3b842e[_0x1242('0x54')]['id']},'order':'-createdAt'});}})[_0x1242('0x25')](handleEntityNotFound(_0xc50c4e,null))[_0x1242('0x25')](function(_0x3d47d8){if(_0x3d47d8){_0x5aa49f=_0x3d47d8;var _0x2309c2={};for(var _0x4ca2d7=0x0,_0x3c3329=_0x5aa49f[_0x1242('0x37')];_0x4ca2d7<_0x3c3329;_0x4ca2d7++){if(!_0x2309c2[_0x1242('0x38')](_0x5aa49f[_0x4ca2d7][_0x1242('0x66')])){_0x2309c2[_0x5aa49f[_0x4ca2d7]['questionId']]=needsEncapsulation(_0x5aa49f[_0x4ca2d7]['question'])?encapsulate(_0x5aa49f[_0x4ca2d7][_0x1242('0x67')]):_0x5aa49f[_0x4ca2d7][_0x1242('0x67')];}}var _0x3c2534=[],_0x3ef695={};for(var _0xb5deb0=0x0,_0x357490=_0x5b3fe0[_0x1242('0x37')];_0xb5deb0<_0x357490;_0xb5deb0++){_0x3ef695={'ProjectId':_0x3b842e[_0x1242('0x54')]['id'],'SessionId':_0x5b3fe0[_0xb5deb0]['id'],'StartTime':moment(_0x5b3fe0[_0xb5deb0]['starttime'])[_0x1242('0x68')](_0x1242('0x69'))};for(var _0x23f655=0x0,_0x558245=_0x5aa49f[_0x1242('0x37')];_0x23f655<_0x558245;_0x23f655++){if(_0x5aa49f[_0x23f655][_0x1242('0x6a')]==_0x5b3fe0[_0xb5deb0]['id']&&_0x2309c2[_0x1242('0x38')](_0x5aa49f[_0x23f655][_0x1242('0x66')])){_0x3ef695[_0x2309c2[_0x5aa49f[_0x23f655][_0x1242('0x66')]]]=_0x5aa49f[_0x23f655][_0x1242('0x6b')];}}for(var _0x5a9458 in _0x2309c2){if(!_0x3ef695[_0x1242('0x38')](_0x2309c2[_0x5a9458])){_0x3ef695[_0x2309c2[_0x5a9458]]=null;}}_0x3c2534['push'](_0x3ef695);}return _0x3c2534;}})[_0x1242('0x25')](function(_0x46c8b9){if(!_['isEmpty'](_0x46c8b9)){var _0x1da032=toCsv(_0x46c8b9);var _0x11881f=Date[_0x1242('0x6c')]();fs[_0x1242('0x6d')](util[_0x1242('0x68')](_0x1242('0x6e'),_0x3b842e[_0x1242('0x54')]['id'],_0x11881f),_0x1da032);_0xc50c4e[_0x1242('0x6f')]('Content-disposition',_0x1242('0x70')+util[_0x1242('0x68')](_0x1242('0x71'),_0x3b842e['params']['id'],_0x11881f));_0xc50c4e[_0x1242('0x6f')](_0x1242('0x72'),_0x1242('0x73'));return _0xc50c4e['download'](util[_0x1242('0x68')](_0x1242('0x6e'),_0x3b842e[_0x1242('0x54')]['id'],_0x11881f));}else{return _0xc50c4e[_0x1242('0x19')](0xcc);}})[_0x1242('0x46')](handleError(_0xc50c4e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a5878ff..3477905 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 _0x8236=['define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports'];(function(_0x5f51d2,_0x4f0133){var _0x24bf08=function(_0x25e6b5){while(--_0x25e6b5){_0x5f51d2['push'](_0x5f51d2['shift']());}};_0x24bf08(++_0x4f0133);}(_0x8236,0x7b));var _0x6823=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x8236[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x6823('0x0'));var util=require('util');var logger=require(_0x6823('0x1'))(_0x6823('0x2'));var moment=require(_0x6823('0x3'));var BPromise=require('bluebird');var rp=require(_0x6823('0x4'));var fs=require('fs');var path=require(_0x6823('0x5'));var rimraf=require(_0x6823('0x6'));var config=require('../../config/environment');var attributes=require(_0x6823('0x7'));module[_0x6823('0x8')]=function(_0x32dfba,_0x224bfd){return _0x32dfba[_0x6823('0x9')](_0x6823('0xa'),attributes,{'tableName':_0x6823('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda7b=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3b3eb6,_0x332559){var _0x2577fd=function(_0x3508fb){while(--_0x3508fb){_0x3b3eb6['push'](_0x3b3eb6['shift']());}};_0x2577fd(++_0x332559);}(_0xda7b,0x1f3));var _0xbda7=function(_0x25d156,_0x54df90){_0x25d156=_0x25d156-0x0;var _0x2e0ea=_0xda7b[_0x25d156];return _0x2e0ea;};'use strict';var _=require(_0xbda7('0x0'));var util=require('util');var logger=require(_0xbda7('0x1'))('api');var moment=require(_0xbda7('0x2'));var BPromise=require(_0xbda7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbda7('0x4'));var rimraf=require(_0xbda7('0x5'));var config=require(_0xbda7('0x6'));var attributes=require(_0xbda7('0x7'));module[_0xbda7('0x8')]=function(_0x2fa8d3,_0x1ff07c){return _0x2fa8d3[_0xbda7('0x9')]('JscriptyProject',attributes,{'tableName':_0xbda7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 8bbb25e..c70079f 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 _0x104c=['client','http','then','info','request\x20sent','debug','stringify','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x507eea,_0x47f2de){var _0x4d6e1b=function(_0x30af34){while(--_0x30af34){_0x507eea['push'](_0x507eea['shift']());}};_0x4d6e1b(++_0x47f2de);}(_0x104c,0x90));var _0xc104=function(_0x2d78d5,_0x24bc22){_0x2d78d5=_0x2d78d5-0x0;var _0x8ae349=_0x104c[_0x2d78d5];return _0x8ae349;};'use strict';var _=require(_0xc104('0x0'));var util=require(_0xc104('0x1'));var moment=require(_0xc104('0x2'));var BPromise=require(_0xc104('0x3'));var rs=require(_0xc104('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc104('0x5'))['db'];var utils=require(_0xc104('0x6'));var logger=require('../../config/logger')(_0xc104('0x7'));var config=require(_0xc104('0x8'));var jayson=require(_0xc104('0x9'));var client=jayson[_0xc104('0xa')][_0xc104('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a510,_0x547a37,_0x5ece9b){return new BPromise(function(_0x5f0c99,_0x12bfec){return client['request'](_0x39a510,_0x5ece9b)[_0xc104('0xc')](function(_0x450c39){logger[_0xc104('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x547a37,_0xc104('0xe'));logger[_0xc104('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x547a37,'request\x20sent',JSON[_0xc104('0x10')](_0x450c39));if(_0x450c39[_0xc104('0x11')]){if(_0x450c39['error']['code']===0x1f4){logger[_0xc104('0x11')](_0xc104('0x12'),_0x547a37,_0x450c39[_0xc104('0x11')]['message']);return _0x12bfec(_0x450c39['error']['message']);}logger[_0xc104('0x11')](_0xc104('0x12'),_0x547a37,_0x450c39[_0xc104('0x11')]['message']);return _0x5f0c99(_0x450c39[_0xc104('0x11')][_0xc104('0x13')]);}else{logger[_0xc104('0xd')](_0xc104('0x12'),_0x547a37,'request\x20sent');_0x5f0c99(_0x450c39[_0xc104('0x14')]['message']);}})[_0xc104('0x15')](function(_0x20882d){logger[_0xc104('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x547a37,_0x20882d);_0x12bfec(_0x20882d);});});} \ No newline at end of file +var _0x90a2=['JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','debug'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_0x90a2,0xa7));var _0x290a=function(_0x2de3a3,_0x36d720){_0x2de3a3=_0x2de3a3-0x0;var _0x214c4d=_0x90a2[_0x2de3a3];return _0x214c4d;};'use strict';var _=require(_0x290a('0x0'));var util=require(_0x290a('0x1'));var moment=require(_0x290a('0x2'));var BPromise=require(_0x290a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x290a('0x4'));var logger=require(_0x290a('0x5'))('rpc');var config=require(_0x290a('0x6'));var jayson=require(_0x290a('0x7'));var client=jayson['client'][_0x290a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x79f810,_0x3d9d76,_0x113746){return new BPromise(function(_0x5964c6,_0x10eecf){return client[_0x290a('0x9')](_0x79f810,_0x113746)['then'](function(_0x201452){logger[_0x290a('0xa')](_0x290a('0xb'),_0x3d9d76,'request\x20sent');logger[_0x290a('0xc')](_0x290a('0xd'),_0x3d9d76,_0x290a('0xe'),JSON[_0x290a('0xf')](_0x201452));if(_0x201452[_0x290a('0x10')]){if(_0x201452[_0x290a('0x10')][_0x290a('0x11')]===0x1f4){logger[_0x290a('0x10')](_0x290a('0xb'),_0x3d9d76,_0x201452[_0x290a('0x10')][_0x290a('0x12')]);return _0x10eecf(_0x201452['error'][_0x290a('0x12')]);}logger[_0x290a('0x10')](_0x290a('0xb'),_0x3d9d76,_0x201452[_0x290a('0x10')][_0x290a('0x12')]);return _0x5964c6(_0x201452[_0x290a('0x10')]['message']);}else{logger[_0x290a('0xa')](_0x290a('0xb'),_0x3d9d76,_0x290a('0xe'));_0x5964c6(_0x201452[_0x290a('0x13')][_0x290a('0x12')]);}})['catch'](function(_0x3bdfd4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3d9d76,_0x3bdfd4);_0x10eecf(_0x3bdfd4);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ee2e06b..d222540 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 _0xa1d7=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0xa1d7,0x1e5));var _0x7a1d=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0xa1d7[_0x3d73ba];return _0x47e406;};'use strict';var multer=require(_0x7a1d('0x0'));var util=require(_0x7a1d('0x1'));var path=require(_0x7a1d('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a1d('0x3'));var router=express['Router']();var auth=require(_0x7a1d('0x4'));var interaction=require(_0x7a1d('0x5'));var config=require(_0x7a1d('0x6'));var controller=require(_0x7a1d('0x7'));router[_0x7a1d('0x8')]('/',auth[_0x7a1d('0x9')](),controller[_0x7a1d('0xa')]);router[_0x7a1d('0x8')](_0x7a1d('0xb'),auth[_0x7a1d('0x9')](),controller[_0x7a1d('0xc')]);router[_0x7a1d('0x8')]('/:id',auth[_0x7a1d('0x9')](),controller[_0x7a1d('0xd')]);router[_0x7a1d('0xe')]('/',auth[_0x7a1d('0x9')](),controller[_0x7a1d('0xf')]);router[_0x7a1d('0x10')](_0x7a1d('0x11'),auth[_0x7a1d('0x9')](),controller['update']);router[_0x7a1d('0x12')](_0x7a1d('0x11'),auth[_0x7a1d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x76e9=['connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4b2449,_0x2abb05){var _0x4e9be3=function(_0x5bface){while(--_0x5bface){_0x4b2449['push'](_0x4b2449['shift']());}};_0x4e9be3(++_0x2abb05);}(_0x76e9,0x101));var _0x976e=function(_0x3a2aa4,_0x22fd59){_0x3a2aa4=_0x3a2aa4-0x0;var _0x1c49d8=_0x76e9[_0x3a2aa4];return _0x1c49d8;};'use strict';var multer=require(_0x976e('0x0'));var util=require(_0x976e('0x1'));var path=require(_0x976e('0x2'));var timeout=require(_0x976e('0x3'));var express=require(_0x976e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x976e('0x5'));var config=require(_0x976e('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x976e('0x7')]('/',auth[_0x976e('0x8')](),controller[_0x976e('0x9')]);router[_0x976e('0x7')](_0x976e('0xa'),auth['isAuthenticated'](),controller[_0x976e('0xb')]);router['get'](_0x976e('0xc'),auth[_0x976e('0x8')](),controller['show']);router[_0x976e('0xd')]('/',auth[_0x976e('0x8')](),controller[_0x976e('0xe')]);router[_0x976e('0xf')](_0x976e('0xc'),auth[_0x976e('0x8')](),controller[_0x976e('0x10')]);router[_0x976e('0x11')](_0x976e('0xc'),auth['isAuthenticated'](),controller[_0x976e('0x12')]);module[_0x976e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4c5e964..fbf0818 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 _0xc0dc=['STRING','TEXT','long','sequelize','exports'];(function(_0x2e95e5,_0x3d3b7d){var _0x1b27f0=function(_0x5529fd){while(--_0x5529fd){_0x2e95e5['push'](_0x2e95e5['shift']());}};_0x1b27f0(++_0x3d3b7d);}(_0xc0dc,0x94));var _0xcc0d=function(_0x5065b0,_0x261759){_0x5065b0=_0x5065b0-0x0;var _0x47ff19=_0xc0dc[_0x5065b0];return _0x47ff19;};'use strict';var Sequelize=require(_0xcc0d('0x0'));module[_0xcc0d('0x1')]={'question':{'type':Sequelize[_0xcc0d('0x2')]},'answer':{'type':Sequelize[_0xcc0d('0x3')](_0xcc0d('0x4'))},'membername':{'type':Sequelize[_0xcc0d('0x2')]},'projectname':{'type':Sequelize[_0xcc0d('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xcc0d('0x2')]},'calleridname':{'type':Sequelize[_0xcc0d('0x2')]},'calleridnum':{'type':Sequelize[_0xcc0d('0x2')]},'questionId':{'type':Sequelize[_0xcc0d('0x2')]}}; \ No newline at end of file +var _0x6c3e=['STRING','long','exports'];(function(_0x21bb2f,_0x4199b9){var _0x279b0e=function(_0x4014b5){while(--_0x4014b5){_0x21bb2f['push'](_0x21bb2f['shift']());}};_0x279b0e(++_0x4199b9);}(_0x6c3e,0x15e));var _0xe6c3=function(_0x29b3ec,_0x97cf10){_0x29b3ec=_0x29b3ec-0x0;var _0x3b6463=_0x6c3e[_0x29b3ec];return _0x3b6463;};'use strict';var Sequelize=require('sequelize');module[_0xe6c3('0x0')]={'question':{'type':Sequelize[_0xe6c3('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xe6c3('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe6c3('0x1')]},'queue':{'type':Sequelize[_0xe6c3('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe6c3('0x1')]},'calleridnum':{'type':Sequelize[_0xe6c3('0x1')]},'questionId':{'type':Sequelize[_0xe6c3('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 1967827..5304b2b 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 _0x9606=['rows','catch','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','JscriptyQuestionReport','include','findAll'];(function(_0xf96acd,_0x58dfe4){var _0x53b495=function(_0x4a55a8){while(--_0x4a55a8){_0xf96acd['push'](_0xf96acd['shift']());}};_0x53b495(++_0x58dfe4);}(_0x9606,0x149));var _0x6960=function(_0x4bbe54,_0x317ba7){_0x4bbe54=_0x4bbe54-0x0;var _0x4ef4e8=_0x9606[_0x4bbe54];return _0x4ef4e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6960('0x0'));var rimraf=require(_0x6960('0x1'));var zipdir=require(_0x6960('0x2'));var jsonpatch=require(_0x6960('0x3'));var rp=require(_0x6960('0x4'));var moment=require(_0x6960('0x5'));var BPromise=require(_0x6960('0x6'));var Mustache=require(_0x6960('0x7'));var util=require(_0x6960('0x8'));var path=require(_0x6960('0x9'));var sox=require(_0x6960('0xa'));var csv=require(_0x6960('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6960('0xc'));var squel=require(_0x6960('0xd'));var crypto=require(_0x6960('0xe'));var jsforce=require(_0x6960('0xf'));var deskjs=require(_0x6960('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6960('0x11'));var Papa=require(_0x6960('0x12'));var Redis=require(_0x6960('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6960('0x14'));var as=require(_0x6960('0x15'));var hardwareService=require(_0x6960('0x16'));var logger=require(_0x6960('0x17'))(_0x6960('0x18'));var utils=require(_0x6960('0x19'));var config=require(_0x6960('0x1a'));var db=require(_0x6960('0x1b'))['db'];function respondWithStatusCode(_0x150a18,_0x12f5f3){_0x12f5f3=_0x12f5f3||0xcc;return function(_0x2cbeb6){if(_0x2cbeb6){return _0x150a18[_0x6960('0x1c')](_0x12f5f3);}return _0x150a18[_0x6960('0x1d')](_0x12f5f3)[_0x6960('0x1e')]();};}function respondWithResult(_0x2ce7ff,_0x555cb9){_0x555cb9=_0x555cb9||0xc8;return function(_0x57e547){if(_0x57e547){return _0x2ce7ff['status'](_0x555cb9)[_0x6960('0x1f')](_0x57e547);}};}function respondWithFilteredResult(_0xd592fa,_0x1ccff6){return function(_0x380281){if(_0x380281){var _0x383b66=_0x380281[_0x6960('0x20')],_0x3ed09f=_0x1ccff6[_0x6960('0x21')],_0x1a438f=_0x1ccff6['offset']+_0x1ccff6[_0x6960('0x22')],_0xe44ad2;if(_0x1a438f>=_0x383b66){_0x1a438f=_0x383b66;_0xe44ad2=0xc8;}else{_0xe44ad2=0xce;}_0xd592fa[_0x6960('0x1d')](_0xe44ad2);return _0xd592fa['set'](_0x6960('0x23'),_0x3ed09f+'-'+_0x1a438f+'/'+_0x383b66)[_0x6960('0x1f')](_0x380281);}return null;};}function patchUpdates(_0x13a1df){return function(_0xd423a1){try{jsonpatch[_0x6960('0x24')](_0xd423a1,_0x13a1df,!![]);}catch(_0x57a5ae){return BPromise[_0x6960('0x25')](_0x57a5ae);}return _0xd423a1['save']();};}function saveUpdates(_0x11f343,_0x23efea){return function(_0x3efe76){if(_0x3efe76){return _0x3efe76[_0x6960('0x26')](_0x11f343)['then'](function(_0x16f67e){return _0x16f67e;});}return null;};}function removeEntity(_0x240ff8,_0x51fa4e){return function(_0x1907b4){if(_0x1907b4){return _0x1907b4[_0x6960('0x27')]()[_0x6960('0x28')](function(){_0x240ff8[_0x6960('0x1d')](0xcc)[_0x6960('0x1e')]();});}};}function handleEntityNotFound(_0x42d874,_0x1b53d2){return function(_0x14f02e){if(!_0x14f02e){_0x42d874[_0x6960('0x1c')](0x194);}return _0x14f02e;};}function handleError(_0x57c0af,_0x671a63){_0x671a63=_0x671a63||0x1f4;return function(_0x46cc7d){logger[_0x6960('0x29')](_0x46cc7d[_0x6960('0x2a')]);if(_0x46cc7d[_0x6960('0x2b')]){delete _0x46cc7d['name'];}_0x57c0af[_0x6960('0x1d')](_0x671a63)[_0x6960('0x2c')](_0x46cc7d);};}exports[_0x6960('0x2d')]=function(_0xefca8b,_0x5c22eb){var _0x2e5cca={},_0x3c4aa6={},_0x51ae64={'count':0x0,'rows':[]};var _0x9f17ad=_[_0x6960('0x2e')](db['JscriptyQuestionReport'][_0x6960('0x2f')],function(_0x3dd1bc){return{'name':_0x3dd1bc[_0x6960('0x30')],'type':_0x3dd1bc['type'][_0x6960('0x31')]};});_0x3c4aa6[_0x6960('0x32')]=_[_0x6960('0x2e')](_0x9f17ad,_0x6960('0x2b'));_0x3c4aa6[_0x6960('0x33')]=_[_0x6960('0x34')](_0xefca8b[_0x6960('0x33')]);_0x3c4aa6[_0x6960('0x35')]=_[_0x6960('0x36')](_0x3c4aa6['model'],_0x3c4aa6[_0x6960('0x33')]);_0x2e5cca['attributes']=_['intersection'](_0x3c4aa6[_0x6960('0x32')],qs['fields'](_0xefca8b[_0x6960('0x33')][_0x6960('0x37')]));_0x2e5cca[_0x6960('0x38')]=_0x2e5cca[_0x6960('0x38')][_0x6960('0x39')]?_0x2e5cca[_0x6960('0x38')]:_0x3c4aa6[_0x6960('0x32')];if(!_0xefca8b[_0x6960('0x33')][_0x6960('0x3a')](_0x6960('0x3b'))){_0x2e5cca[_0x6960('0x22')]=qs[_0x6960('0x22')](_0xefca8b[_0x6960('0x33')][_0x6960('0x22')]);_0x2e5cca[_0x6960('0x21')]=qs['offset'](_0xefca8b[_0x6960('0x33')][_0x6960('0x21')]);}_0x2e5cca[_0x6960('0x3c')]=qs[_0x6960('0x3d')](_0xefca8b[_0x6960('0x33')][_0x6960('0x3d')]);_0x2e5cca[_0x6960('0x3e')]=qs[_0x6960('0x35')](_[_0x6960('0x3f')](_0xefca8b['query'],_0x3c4aa6[_0x6960('0x35')]),_0x9f17ad);if(_0xefca8b[_0x6960('0x33')][_0x6960('0x40')]){_0x2e5cca[_0x6960('0x3e')]=_[_0x6960('0x41')](_0x2e5cca[_0x6960('0x3e')],{'$or':_[_0x6960('0x2e')](_0x9f17ad,function(_0x25fb50){if(_0x25fb50[_0x6960('0x42')]!==_0x6960('0x43')){var _0x4a4da5={};_0x4a4da5[_0x25fb50[_0x6960('0x2b')]]={'$like':'%'+_0xefca8b[_0x6960('0x33')][_0x6960('0x40')]+'%'};return _0x4a4da5;}})});}_0x2e5cca=_['merge']({},_0x2e5cca,_0xefca8b['options']);var _0x32eae2={'where':_0x2e5cca['where']};return db[_0x6960('0x44')][_0x6960('0x20')](_0x32eae2)[_0x6960('0x28')](function(_0xb5b520){_0x51ae64[_0x6960('0x20')]=_0xb5b520;if(_0xefca8b[_0x6960('0x33')]['includeAll']){_0x2e5cca[_0x6960('0x45')]=[{'all':!![]}];}return db[_0x6960('0x44')][_0x6960('0x46')](_0x2e5cca);})[_0x6960('0x28')](function(_0x3134a9){_0x51ae64[_0x6960('0x47')]=_0x3134a9;return _0x51ae64;})[_0x6960('0x28')](respondWithFilteredResult(_0x5c22eb,_0x2e5cca))[_0x6960('0x48')](handleError(_0x5c22eb,null));};exports['show']=function(_0x36f3b7,_0x2916be){var _0x158c3c={'raw':!![],'where':{'id':_0x36f3b7['params']['id']}},_0xbea86f={};_0xbea86f[_0x6960('0x32')]=_[_0x6960('0x34')](db[_0x6960('0x44')]['rawAttributes']);_0xbea86f[_0x6960('0x33')]=_[_0x6960('0x34')](_0x36f3b7[_0x6960('0x33')]);_0xbea86f[_0x6960('0x35')]=_[_0x6960('0x36')](_0xbea86f[_0x6960('0x32')],_0xbea86f['query']);_0x158c3c[_0x6960('0x38')]=_[_0x6960('0x36')](_0xbea86f['model'],qs['fields'](_0x36f3b7[_0x6960('0x33')]['fields']));_0x158c3c[_0x6960('0x38')]=_0x158c3c[_0x6960('0x38')][_0x6960('0x39')]?_0x158c3c[_0x6960('0x38')]:_0xbea86f['model'];if(_0x36f3b7[_0x6960('0x33')][_0x6960('0x49')]){_0x158c3c[_0x6960('0x45')]=[{'all':!![]}];}_0x158c3c=_[_0x6960('0x41')]({},_0x158c3c,_0x36f3b7[_0x6960('0x4a')]);return db[_0x6960('0x44')][_0x6960('0x4b')](_0x158c3c)[_0x6960('0x28')](handleEntityNotFound(_0x2916be,null))[_0x6960('0x28')](respondWithResult(_0x2916be,null))[_0x6960('0x48')](handleError(_0x2916be,null));};exports[_0x6960('0x4c')]=function(_0x4108da,_0x1db0d1){return db[_0x6960('0x44')]['create'](_0x4108da['body'],{})[_0x6960('0x28')](respondWithResult(_0x1db0d1,0xc9))[_0x6960('0x48')](handleError(_0x1db0d1,null));};exports['update']=function(_0x5e6d5b,_0x2ea514){if(_0x5e6d5b[_0x6960('0x4d')]['id']){delete _0x5e6d5b[_0x6960('0x4d')]['id'];}return db[_0x6960('0x44')][_0x6960('0x4b')]({'where':{'id':_0x5e6d5b[_0x6960('0x4e')]['id']}})[_0x6960('0x28')](handleEntityNotFound(_0x2ea514,null))[_0x6960('0x28')](saveUpdates(_0x5e6d5b[_0x6960('0x4d')],null))['then'](respondWithResult(_0x2ea514,null))[_0x6960('0x48')](handleError(_0x2ea514,null));};exports[_0x6960('0x27')]=function(_0x19bcbc,_0x3464cb){return db[_0x6960('0x44')]['find']({'where':{'id':_0x19bcbc['params']['id']}})[_0x6960('0x28')](handleEntityNotFound(_0x3464cb,null))[_0x6960('0x28')](removeEntity(_0x3464cb,null))[_0x6960('0x48')](handleError(_0x3464cb,null));};exports[_0x6960('0x4f')]=function(_0x535c6e,_0x53caf1){return db[_0x6960('0x44')][_0x6960('0x4f')]()['then'](respondWithResult(_0x53caf1,null))['catch'](handleError(_0x53caf1,null));}; \ No newline at end of file +var _0xabe1=['rawAttributes','options','find','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','JscriptyQuestionReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','params'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xabe1,0xcf));var _0x1abe=function(_0x1278e0,_0x35dbfc){_0x1278e0=_0x1278e0-0x0;var _0x13b8ea=_0xabe1[_0x1278e0];return _0x13b8ea;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1abe('0x0'));var zipdir=require(_0x1abe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1abe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1abe('0x3'));var util=require(_0x1abe('0x4'));var path=require(_0x1abe('0x5'));var sox=require(_0x1abe('0x6'));var csv=require(_0x1abe('0x7'));var ejs=require(_0x1abe('0x8'));var fs=require('fs');var _=require(_0x1abe('0x9'));var squel=require(_0x1abe('0xa'));var crypto=require(_0x1abe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1abe('0xc'));var toCsv=require(_0x1abe('0x7'));var querystring=require(_0x1abe('0xd'));var Papa=require('papaparse');var Redis=require(_0x1abe('0xe'));var authService=require(_0x1abe('0xf'));var qs=require(_0x1abe('0x10'));var as=require(_0x1abe('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1abe('0x12'));var utils=require(_0x1abe('0x13'));var config=require(_0x1abe('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4930ef,_0x35679a){_0x35679a=_0x35679a||0xcc;return function(_0xbb09e6){if(_0xbb09e6){return _0x4930ef[_0x1abe('0x15')](_0x35679a);}return _0x4930ef[_0x1abe('0x16')](_0x35679a)[_0x1abe('0x17')]();};}function respondWithResult(_0x570cc5,_0x3eb3fd){_0x3eb3fd=_0x3eb3fd||0xc8;return function(_0x3b04c9){if(_0x3b04c9){return _0x570cc5[_0x1abe('0x16')](_0x3eb3fd)['json'](_0x3b04c9);}};}function respondWithFilteredResult(_0x26fc6d,_0xf61103){return function(_0x19b8e7){if(_0x19b8e7){var _0x15661f=_0x19b8e7[_0x1abe('0x18')],_0x583199=_0xf61103[_0x1abe('0x19')],_0x1b7b38=_0xf61103[_0x1abe('0x19')]+_0xf61103[_0x1abe('0x1a')],_0x4c82a0;if(_0x1b7b38>=_0x15661f){_0x1b7b38=_0x15661f;_0x4c82a0=0xc8;}else{_0x4c82a0=0xce;}_0x26fc6d['status'](_0x4c82a0);return _0x26fc6d['set'](_0x1abe('0x1b'),_0x583199+'-'+_0x1b7b38+'/'+_0x15661f)['json'](_0x19b8e7);}return null;};}function patchUpdates(_0x430fc5){return function(_0x5c0d2f){try{jsonpatch[_0x1abe('0x1c')](_0x5c0d2f,_0x430fc5,!![]);}catch(_0x25361f){return BPromise[_0x1abe('0x1d')](_0x25361f);}return _0x5c0d2f[_0x1abe('0x1e')]();};}function saveUpdates(_0x25381e,_0x56e2a6){return function(_0x2bef8a){if(_0x2bef8a){return _0x2bef8a[_0x1abe('0x1f')](_0x25381e)[_0x1abe('0x20')](function(_0x6b2805){return _0x6b2805;});}return null;};}function removeEntity(_0x179889,_0x59bddd){return function(_0x4b0de1){if(_0x4b0de1){return _0x4b0de1['destroy']()[_0x1abe('0x20')](function(){_0x179889['status'](0xcc)[_0x1abe('0x17')]();});}};}function handleEntityNotFound(_0x77ed12,_0x16b750){return function(_0x11be3a){if(!_0x11be3a){_0x77ed12[_0x1abe('0x15')](0x194);}return _0x11be3a;};}function handleError(_0x40559e,_0x4eae2e){_0x4eae2e=_0x4eae2e||0x1f4;return function(_0x12f7fc){logger[_0x1abe('0x21')](_0x12f7fc[_0x1abe('0x22')]);if(_0x12f7fc[_0x1abe('0x23')]){delete _0x12f7fc['name'];}_0x40559e['status'](_0x4eae2e)['send'](_0x12f7fc);};}exports[_0x1abe('0x24')]=function(_0xf3d145,_0x33657e){var _0x11c00c={},_0x7a46d9={},_0x5ea31c={'count':0x0,'rows':[]};var _0xd8fe40=_[_0x1abe('0x25')](db[_0x1abe('0x26')]['rawAttributes'],function(_0x17211f){return{'name':_0x17211f['fieldName'],'type':_0x17211f[_0x1abe('0x27')]['key']};});_0x7a46d9[_0x1abe('0x28')]=_[_0x1abe('0x25')](_0xd8fe40,_0x1abe('0x23'));_0x7a46d9[_0x1abe('0x29')]=_[_0x1abe('0x2a')](_0xf3d145[_0x1abe('0x29')]);_0x7a46d9[_0x1abe('0x2b')]=_[_0x1abe('0x2c')](_0x7a46d9[_0x1abe('0x28')],_0x7a46d9['query']);_0x11c00c[_0x1abe('0x2d')]=_['intersection'](_0x7a46d9[_0x1abe('0x28')],qs[_0x1abe('0x2e')](_0xf3d145[_0x1abe('0x29')][_0x1abe('0x2e')]));_0x11c00c[_0x1abe('0x2d')]=_0x11c00c[_0x1abe('0x2d')][_0x1abe('0x2f')]?_0x11c00c[_0x1abe('0x2d')]:_0x7a46d9[_0x1abe('0x28')];if(!_0xf3d145['query'][_0x1abe('0x30')](_0x1abe('0x31'))){_0x11c00c['limit']=qs[_0x1abe('0x1a')](_0xf3d145['query'][_0x1abe('0x1a')]);_0x11c00c[_0x1abe('0x19')]=qs['offset'](_0xf3d145['query']['offset']);}_0x11c00c[_0x1abe('0x32')]=qs[_0x1abe('0x33')](_0xf3d145[_0x1abe('0x29')][_0x1abe('0x33')]);_0x11c00c['where']=qs['filters'](_[_0x1abe('0x34')](_0xf3d145[_0x1abe('0x29')],_0x7a46d9[_0x1abe('0x2b')]),_0xd8fe40);if(_0xf3d145[_0x1abe('0x29')][_0x1abe('0x35')]){_0x11c00c[_0x1abe('0x36')]=_[_0x1abe('0x37')](_0x11c00c[_0x1abe('0x36')],{'$or':_[_0x1abe('0x25')](_0xd8fe40,function(_0xffd694){if(_0xffd694[_0x1abe('0x27')]!=='VIRTUAL'){var _0x56ecb7={};_0x56ecb7[_0xffd694[_0x1abe('0x23')]]={'$like':'%'+_0xf3d145[_0x1abe('0x29')][_0x1abe('0x35')]+'%'};return _0x56ecb7;}})});}_0x11c00c=_[_0x1abe('0x37')]({},_0x11c00c,_0xf3d145['options']);var _0x2197af={'where':_0x11c00c[_0x1abe('0x36')]};return db[_0x1abe('0x26')][_0x1abe('0x18')](_0x2197af)['then'](function(_0x1ae972){_0x5ea31c[_0x1abe('0x18')]=_0x1ae972;if(_0xf3d145[_0x1abe('0x29')]['includeAll']){_0x11c00c[_0x1abe('0x38')]=[{'all':!![]}];}return db[_0x1abe('0x26')][_0x1abe('0x39')](_0x11c00c);})['then'](function(_0x5d1b69){_0x5ea31c[_0x1abe('0x3a')]=_0x5d1b69;return _0x5ea31c;})['then'](respondWithFilteredResult(_0x33657e,_0x11c00c))[_0x1abe('0x3b')](handleError(_0x33657e,null));};exports['show']=function(_0x37b793,_0x1c357b){var _0x5ae4a3={'raw':!![],'where':{'id':_0x37b793[_0x1abe('0x3c')]['id']}},_0x292525={};_0x292525[_0x1abe('0x28')]=_[_0x1abe('0x2a')](db[_0x1abe('0x26')][_0x1abe('0x3d')]);_0x292525['query']=_[_0x1abe('0x2a')](_0x37b793[_0x1abe('0x29')]);_0x292525[_0x1abe('0x2b')]=_['intersection'](_0x292525[_0x1abe('0x28')],_0x292525[_0x1abe('0x29')]);_0x5ae4a3[_0x1abe('0x2d')]=_[_0x1abe('0x2c')](_0x292525[_0x1abe('0x28')],qs[_0x1abe('0x2e')](_0x37b793[_0x1abe('0x29')][_0x1abe('0x2e')]));_0x5ae4a3[_0x1abe('0x2d')]=_0x5ae4a3['attributes'][_0x1abe('0x2f')]?_0x5ae4a3[_0x1abe('0x2d')]:_0x292525[_0x1abe('0x28')];if(_0x37b793[_0x1abe('0x29')]['includeAll']){_0x5ae4a3[_0x1abe('0x38')]=[{'all':!![]}];}_0x5ae4a3=_[_0x1abe('0x37')]({},_0x5ae4a3,_0x37b793[_0x1abe('0x3e')]);return db['JscriptyQuestionReport'][_0x1abe('0x3f')](_0x5ae4a3)[_0x1abe('0x20')](handleEntityNotFound(_0x1c357b,null))[_0x1abe('0x20')](respondWithResult(_0x1c357b,null))['catch'](handleError(_0x1c357b,null));};exports[_0x1abe('0x40')]=function(_0x12d5cc,_0x2010f8){return db[_0x1abe('0x26')][_0x1abe('0x40')](_0x12d5cc[_0x1abe('0x41')],{})[_0x1abe('0x20')](respondWithResult(_0x2010f8,0xc9))[_0x1abe('0x3b')](handleError(_0x2010f8,null));};exports[_0x1abe('0x1f')]=function(_0x22b999,_0x4fdce0){if(_0x22b999['body']['id']){delete _0x22b999[_0x1abe('0x41')]['id'];}return db[_0x1abe('0x26')]['find']({'where':{'id':_0x22b999['params']['id']}})['then'](handleEntityNotFound(_0x4fdce0,null))['then'](saveUpdates(_0x22b999['body'],null))[_0x1abe('0x20')](respondWithResult(_0x4fdce0,null))[_0x1abe('0x3b')](handleError(_0x4fdce0,null));};exports['destroy']=function(_0x348ef0,_0x2871a5){return db['JscriptyQuestionReport'][_0x1abe('0x3f')]({'where':{'id':_0x348ef0[_0x1abe('0x3c')]['id']}})[_0x1abe('0x20')](handleEntityNotFound(_0x2871a5,null))[_0x1abe('0x20')](removeEntity(_0x2871a5,null))[_0x1abe('0x3b')](handleError(_0x2871a5,null));};exports[_0x1abe('0x42')]=function(_0x3f6129,_0x23add7){return db['JscriptyQuestionReport'][_0x1abe('0x42')]()['then'](respondWithResult(_0x23add7,null))['catch'](handleError(_0x23add7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4591910..2f03e17 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 _0x2595=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x2595,0x9b));var _0x5259=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x2595[_0x2c7dc6];return _0x10002b;};'use strict';var _=require(_0x5259('0x0'));var util=require(_0x5259('0x1'));var logger=require(_0x5259('0x2'))(_0x5259('0x3'));var moment=require(_0x5259('0x4'));var BPromise=require('bluebird');var rp=require(_0x5259('0x5'));var fs=require('fs');var path=require(_0x5259('0x6'));var rimraf=require('rimraf');var config=require(_0x5259('0x7'));var attributes=require(_0x5259('0x8'));module[_0x5259('0x9')]=function(_0x456de8,_0xf05bbc){return _0x456de8['define'](_0x5259('0xa'),attributes,{'tableName':_0x5259('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf280=['api','moment','bluebird','request-promise','path','rimraf','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger'];(function(_0x7d261d,_0x4e1d2f){var _0x1a992a=function(_0x199824){while(--_0x199824){_0x7d261d['push'](_0x7d261d['shift']());}};_0x1a992a(++_0x4e1d2f);}(_0xf280,0x1a0));var _0x0f28=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xf280[_0x52f1e6];return _0x21f104;};'use strict';var _=require('lodash');var util=require(_0x0f28('0x0'));var logger=require(_0x0f28('0x1'))(_0x0f28('0x2'));var moment=require(_0x0f28('0x3'));var BPromise=require(_0x0f28('0x4'));var rp=require(_0x0f28('0x5'));var fs=require('fs');var path=require(_0x0f28('0x6'));var rimraf=require(_0x0f28('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x0f28('0x8')]=function(_0x251ccf,_0x43f3a5){return _0x251ccf['define'](_0x0f28('0x9'),attributes,{'tableName':_0x0f28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 463d733..62a3b05 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 _0xd7fc=['../../config/logger','rpc','../../config/environment','client','request','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cb309,_0x285baf){var _0x1e3e43=function(_0x3ef6ae){while(--_0x3ef6ae){_0x4cb309['push'](_0x4cb309['shift']());}};_0x1e3e43(++_0x285baf);}(_0xd7fc,0x178));var _0xcd7f=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0xd7fc[_0x51fe86];return _0x3557d4;};'use strict';var _=require(_0xcd7f('0x0'));var util=require(_0xcd7f('0x1'));var moment=require(_0xcd7f('0x2'));var BPromise=require(_0xcd7f('0x3'));var rs=require(_0xcd7f('0x4'));var fs=require('fs');var Redis=require(_0xcd7f('0x5'));var db=require(_0xcd7f('0x6'))['db'];var utils=require(_0xcd7f('0x7'));var logger=require(_0xcd7f('0x8'))(_0xcd7f('0x9'));var config=require(_0xcd7f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcd7f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57ae36,_0x1b4910,_0x1d5a79){return new BPromise(function(_0x48f7f6,_0x464a71){return client[_0xcd7f('0xc')](_0x57ae36,_0x1d5a79)['then'](function(_0x38b46c){logger[_0xcd7f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1b4910,'request\x20sent');logger[_0xcd7f('0xe')](_0xcd7f('0xf'),_0x1b4910,_0xcd7f('0x10'),JSON[_0xcd7f('0x11')](_0x38b46c));if(_0x38b46c[_0xcd7f('0x12')]){if(_0x38b46c[_0xcd7f('0x12')][_0xcd7f('0x13')]===0x1f4){logger['error'](_0xcd7f('0x14'),_0x1b4910,_0x38b46c[_0xcd7f('0x12')]['message']);return _0x464a71(_0x38b46c['error'][_0xcd7f('0x15')]);}logger[_0xcd7f('0x12')](_0xcd7f('0x14'),_0x1b4910,_0x38b46c['error'][_0xcd7f('0x15')]);return _0x48f7f6(_0x38b46c[_0xcd7f('0x12')]['message']);}else{logger['info'](_0xcd7f('0x14'),_0x1b4910,_0xcd7f('0x10'));_0x48f7f6(_0x38b46c[_0xcd7f('0x16')]['message']);}})[_0xcd7f('0x17')](function(_0x517bf0){logger[_0xcd7f('0x12')](_0xcd7f('0x14'),_0x1b4910,_0x517bf0);_0x464a71(_0x517bf0);});});} \ No newline at end of file +var _0xcaa1=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x1de3a0,_0x17593c){var _0x396141=function(_0x2d6e6f){while(--_0x2d6e6f){_0x1de3a0['push'](_0x1de3a0['shift']());}};_0x396141(++_0x17593c);}(_0xcaa1,0x1ac));var _0x1caa=function(_0x266503,_0x4e4048){_0x266503=_0x266503-0x0;var _0x4cbf6=_0xcaa1[_0x266503];return _0x4cbf6;};'use strict';var _=require('lodash');var util=require(_0x1caa('0x0'));var moment=require(_0x1caa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1caa('0x2'));var db=require(_0x1caa('0x3'))['db'];var utils=require(_0x1caa('0x4'));var logger=require(_0x1caa('0x5'))(_0x1caa('0x6'));var config=require(_0x1caa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1caa('0x8')][_0x1caa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286bd3,_0x409ae0,_0x35ae6b){return new BPromise(function(_0x1cc64f,_0x88edff){return client[_0x1caa('0xa')](_0x286bd3,_0x35ae6b)['then'](function(_0x7d671){logger[_0x1caa('0xb')](_0x1caa('0xc'),_0x409ae0,_0x1caa('0xd'));logger[_0x1caa('0xe')](_0x1caa('0xf'),_0x409ae0,'request\x20sent',JSON['stringify'](_0x7d671));if(_0x7d671[_0x1caa('0x10')]){if(_0x7d671[_0x1caa('0x10')][_0x1caa('0x11')]===0x1f4){logger[_0x1caa('0x10')](_0x1caa('0xc'),_0x409ae0,_0x7d671[_0x1caa('0x10')][_0x1caa('0x12')]);return _0x88edff(_0x7d671['error']['message']);}logger[_0x1caa('0x10')](_0x1caa('0xc'),_0x409ae0,_0x7d671[_0x1caa('0x10')][_0x1caa('0x12')]);return _0x1cc64f(_0x7d671[_0x1caa('0x10')]['message']);}else{logger[_0x1caa('0xb')](_0x1caa('0xc'),_0x409ae0,'request\x20sent');_0x1cc64f(_0x7d671['result']['message']);}})[_0x1caa('0x13')](function(_0x19c6e9){logger[_0x1caa('0x10')](_0x1caa('0xc'),_0x409ae0,_0x19c6e9);_0x88edff(_0x19c6e9);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index eb2eb4a..1fc9b60 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 _0xab5b=['isAuthenticated','index','describe','/:id','/:id/questions','post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0x28bb85,_0x23c20b){var _0x48a4eb=function(_0x1e282b){while(--_0x1e282b){_0x28bb85['push'](_0x28bb85['shift']());}};_0x48a4eb(++_0x23c20b);}(_0xab5b,0x11a));var _0xbab5=function(_0x3834e2,_0x4a69f5){_0x3834e2=_0x3834e2-0x0;var _0x24902d=_0xab5b[_0x3834e2];return _0x24902d;};'use strict';var multer=require(_0xbab5('0x0'));var util=require(_0xbab5('0x1'));var path=require('path');var timeout=require(_0xbab5('0x2'));var express=require(_0xbab5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbab5('0x4'));var config=require('../../config/environment');var controller=require(_0xbab5('0x5'));router[_0xbab5('0x6')]('/',auth[_0xbab5('0x7')](),controller[_0xbab5('0x8')]);router[_0xbab5('0x6')]('/describe',auth[_0xbab5('0x7')](),controller[_0xbab5('0x9')]);router[_0xbab5('0x6')](_0xbab5('0xa'),auth[_0xbab5('0x7')](),controller['show']);router[_0xbab5('0x6')](_0xbab5('0xb'),auth[_0xbab5('0x7')](),controller['getQuestions']);router[_0xbab5('0xc')]('/',auth[_0xbab5('0x7')](),controller['create']);router[_0xbab5('0xd')](_0xbab5('0xa'),auth[_0xbab5('0x7')](),controller[_0xbab5('0xe')]);router['delete'](_0xbab5('0xa'),auth['isAuthenticated'](),controller[_0xbab5('0xf')]);module[_0xbab5('0x10')]=router; \ No newline at end of file +var _0xf776=['getQuestions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/questions'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf776,0x169));var _0x6f77=function(_0x48f492,_0x42305b){_0x48f492=_0x48f492-0x0;var _0x4caf78=_0xf776[_0x48f492];return _0x4caf78;};'use strict';var multer=require(_0x6f77('0x0'));var util=require('util');var path=require(_0x6f77('0x1'));var timeout=require(_0x6f77('0x2'));var express=require('express');var router=express[_0x6f77('0x3')]();var auth=require(_0x6f77('0x4'));var interaction=require(_0x6f77('0x5'));var config=require(_0x6f77('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x6f77('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f77('0x8')]);router[_0x6f77('0x7')](_0x6f77('0x9'),auth[_0x6f77('0xa')](),controller['describe']);router[_0x6f77('0x7')]('/:id',auth[_0x6f77('0xa')](),controller[_0x6f77('0xb')]);router[_0x6f77('0x7')](_0x6f77('0xc'),auth['isAuthenticated'](),controller[_0x6f77('0xd')]);router[_0x6f77('0xe')]('/',auth[_0x6f77('0xa')](),controller[_0x6f77('0xf')]);router[_0x6f77('0x10')](_0x6f77('0x11'),auth['isAuthenticated'](),controller[_0x6f77('0x12')]);router[_0x6f77('0x13')](_0x6f77('0x11'),auth[_0x6f77('0xa')](),controller[_0x6f77('0x14')]);module[_0x6f77('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8472424..c21f89a 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 _0x6c9a=['BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x5c8628,_0x2fc5f5){var _0xcbd50e=function(_0x4e8bf1){while(--_0x4e8bf1){_0x5c8628['push'](_0x5c8628['shift']());}};_0xcbd50e(++_0x2fc5f5);}(_0x6c9a,0x105));var _0xa6c9=function(_0x4327a3,_0x2c89a6){_0x4327a3=_0x4327a3-0x0;var _0x29e68c=_0x6c9a[_0x4327a3];return _0x29e68c;};'use strict';var moment=require('moment');var Sequelize=require(_0xa6c9('0x0'));module[_0xa6c9('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1f25d2){this[_0xa6c9('0x2')](_0xa6c9('0x3'),_0x1f25d2);this[_0xa6c9('0x2')](_0xa6c9('0x4'),moment()[_0xa6c9('0x5')](_0xa6c9('0x6')));}},'endtime':{'type':Sequelize[_0xa6c9('0x7')]},'membername':{'type':Sequelize[_0xa6c9('0x8')]},'projectname':{'type':Sequelize[_0xa6c9('0x8')]},'queue':{'type':Sequelize[_0xa6c9('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa6c9('0x8')]},'calleridnum':{'type':Sequelize[_0xa6c9('0x8')]},'completed':{'type':Sequelize[_0xa6c9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x8665=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x301e92,_0xd96d18){var _0x298d94=function(_0x3104d0){while(--_0x3104d0){_0x301e92['push'](_0x301e92['shift']());}};_0x298d94(++_0xd96d18);}(_0x8665,0x1c8));var _0x5866=function(_0x4235ca,_0x5049d5){_0x4235ca=_0x4235ca-0x0;var _0x24ad7a=_0x8665[_0x4235ca];return _0x24ad7a;};'use strict';var moment=require(_0x5866('0x0'));var Sequelize=require(_0x5866('0x1'));module[_0x5866('0x2')]={'starttime':{'type':Sequelize[_0x5866('0x3')],'set':function(_0x4c8269){this[_0x5866('0x4')]('starttime',_0x4c8269);this[_0x5866('0x4')](_0x5866('0x5'),moment()[_0x5866('0x6')](_0x5866('0x7')));}},'endtime':{'type':Sequelize[_0x5866('0x3')]},'membername':{'type':Sequelize[_0x5866('0x8')]},'projectname':{'type':Sequelize[_0x5866('0x8')]},'queue':{'type':Sequelize[_0x5866('0x8')]},'uniqueid':{'type':Sequelize[_0x5866('0x8')]},'calleridname':{'type':Sequelize[_0x5866('0x8')]},'calleridnum':{'type':Sequelize[_0x5866('0x8')]},'completed':{'type':Sequelize[_0x5866('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a33a7d9..5ec9811 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 _0xca1f=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','options','JscriptySessionReport','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','getQuestions','findOne','JscriptyQuestionReport','nolimit','sort','SessionId','includeAll','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x35fd10,_0x24beb0){var _0x2cb3c9=function(_0x818c9){while(--_0x818c9){_0x35fd10['push'](_0x35fd10['shift']());}};_0x2cb3c9(++_0x24beb0);}(_0xca1f,0x168));var _0xfca1=function(_0x323a9a,_0x328bf5){_0x323a9a=_0x323a9a-0x0;var _0x5e7736=_0xca1f[_0x323a9a];return _0x5e7736;};'use strict';var pdf=require(_0xfca1('0x0'));var emlformat=require(_0xfca1('0x1'));var rimraf=require(_0xfca1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfca1('0x3'));var moment=require(_0xfca1('0x4'));var BPromise=require(_0xfca1('0x5'));var Mustache=require(_0xfca1('0x6'));var util=require(_0xfca1('0x7'));var path=require(_0xfca1('0x8'));var sox=require(_0xfca1('0x9'));var csv=require(_0xfca1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfca1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfca1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfca1('0xd'));var Papa=require(_0xfca1('0xe'));var Redis=require('ioredis');var authService=require(_0xfca1('0xf'));var qs=require(_0xfca1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfca1('0x11'));var logger=require(_0xfca1('0x12'))(_0xfca1('0x13'));var utils=require(_0xfca1('0x14'));var config=require(_0xfca1('0x15'));var db=require(_0xfca1('0x16'))['db'];function respondWithStatusCode(_0x56453b,_0x48a9ae){_0x48a9ae=_0x48a9ae||0xcc;return function(_0x563df2){if(_0x563df2){return _0x56453b[_0xfca1('0x17')](_0x48a9ae);}return _0x56453b[_0xfca1('0x18')](_0x48a9ae)[_0xfca1('0x19')]();};}function respondWithResult(_0x2067c3,_0x1cc414){_0x1cc414=_0x1cc414||0xc8;return function(_0x4b4512){if(_0x4b4512){return _0x2067c3[_0xfca1('0x18')](_0x1cc414)[_0xfca1('0x1a')](_0x4b4512);}};}function respondWithFilteredResult(_0xb95635,_0x358b79){return function(_0x1a3dce){if(_0x1a3dce){var _0x44d7d4=_0x1a3dce[_0xfca1('0x1b')],_0x2d435a=_0x358b79[_0xfca1('0x1c')],_0x4ffe38=_0x358b79[_0xfca1('0x1c')]+_0x358b79[_0xfca1('0x1d')],_0x11acea;if(_0x4ffe38>=_0x44d7d4){_0x4ffe38=_0x44d7d4;_0x11acea=0xc8;}else{_0x11acea=0xce;}_0xb95635[_0xfca1('0x18')](_0x11acea);return _0xb95635[_0xfca1('0x1e')](_0xfca1('0x1f'),_0x2d435a+'-'+_0x4ffe38+'/'+_0x44d7d4)[_0xfca1('0x1a')](_0x1a3dce);}return null;};}function patchUpdates(_0x2cc22a){return function(_0x305163){try{jsonpatch['apply'](_0x305163,_0x2cc22a,!![]);}catch(_0x2fd3a6){return BPromise['reject'](_0x2fd3a6);}return _0x305163['save']();};}function saveUpdates(_0x1087bc,_0x5e6a1f){return function(_0x4ecb3c){if(_0x4ecb3c){return _0x4ecb3c[_0xfca1('0x20')](_0x1087bc)[_0xfca1('0x21')](function(_0x5bd4e0){return _0x5bd4e0;});}return null;};}function removeEntity(_0x3bb44c,_0x529990){return function(_0x50c07b){if(_0x50c07b){return _0x50c07b[_0xfca1('0x22')]()['then'](function(){_0x3bb44c[_0xfca1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b096,_0x488064){return function(_0x2edf1b){if(!_0x2edf1b){_0x39b096[_0xfca1('0x17')](0x194);}return _0x2edf1b;};}function handleError(_0x52409d,_0xeb7803){_0xeb7803=_0xeb7803||0x1f4;return function(_0x56ccee){logger[_0xfca1('0x23')](_0x56ccee[_0xfca1('0x24')]);if(_0x56ccee[_0xfca1('0x25')]){delete _0x56ccee[_0xfca1('0x25')];}_0x52409d[_0xfca1('0x18')](_0xeb7803)[_0xfca1('0x26')](_0x56ccee);};}exports['index']=function(_0x33c58b,_0x242c6f){var _0x52ad6c={},_0x4d3e15={},_0x417c7c={'count':0x0,'rows':[]};var _0x862e40=_[_0xfca1('0x27')](db['JscriptySessionReport']['rawAttributes'],function(_0x2c081e){return{'name':_0x2c081e[_0xfca1('0x28')],'type':_0x2c081e['type'][_0xfca1('0x29')]};});_0x4d3e15[_0xfca1('0x2a')]=_['map'](_0x862e40,'name');_0x4d3e15[_0xfca1('0x2b')]=_[_0xfca1('0x2c')](_0x33c58b[_0xfca1('0x2b')]);_0x4d3e15[_0xfca1('0x2d')]=_[_0xfca1('0x2e')](_0x4d3e15[_0xfca1('0x2a')],_0x4d3e15[_0xfca1('0x2b')]);_0x52ad6c[_0xfca1('0x2f')]=_[_0xfca1('0x2e')](_0x4d3e15['model'],qs[_0xfca1('0x30')](_0x33c58b[_0xfca1('0x2b')][_0xfca1('0x30')]));_0x52ad6c[_0xfca1('0x2f')]=_0x52ad6c[_0xfca1('0x2f')][_0xfca1('0x31')]?_0x52ad6c[_0xfca1('0x2f')]:_0x4d3e15[_0xfca1('0x2a')];if(!_0x33c58b[_0xfca1('0x2b')][_0xfca1('0x32')]('nolimit')){_0x52ad6c[_0xfca1('0x1d')]=qs[_0xfca1('0x1d')](_0x33c58b[_0xfca1('0x2b')]['limit']);_0x52ad6c[_0xfca1('0x1c')]=qs['offset'](_0x33c58b['query'][_0xfca1('0x1c')]);}_0x52ad6c[_0xfca1('0x33')]=qs['sort'](_0x33c58b[_0xfca1('0x2b')]['sort']);_0x52ad6c[_0xfca1('0x34')]=qs[_0xfca1('0x2d')](_[_0xfca1('0x35')](_0x33c58b[_0xfca1('0x2b')],_0x4d3e15[_0xfca1('0x2d')]),_0x862e40);if(_0x33c58b['query'][_0xfca1('0x36')]){_0x52ad6c[_0xfca1('0x34')]=_['merge'](_0x52ad6c[_0xfca1('0x34')],{'$or':_[_0xfca1('0x27')](_0x862e40,function(_0x200b43){if(_0x200b43['type']!==_0xfca1('0x37')){var _0x187892={};_0x187892[_0x200b43[_0xfca1('0x25')]]={'$like':'%'+_0x33c58b[_0xfca1('0x2b')][_0xfca1('0x36')]+'%'};return _0x187892;}})});}_0x52ad6c=_['merge']({},_0x52ad6c,_0x33c58b[_0xfca1('0x38')]);var _0x52dcbb={'where':_0x52ad6c[_0xfca1('0x34')]};return db[_0xfca1('0x39')][_0xfca1('0x1b')](_0x52dcbb)['then'](function(_0x13a496){_0x417c7c[_0xfca1('0x1b')]=_0x13a496;if(_0x33c58b['query']['includeAll']){_0x52ad6c[_0xfca1('0x3a')]=[{'all':!![]}];}return db[_0xfca1('0x39')][_0xfca1('0x3b')](_0x52ad6c);})[_0xfca1('0x21')](function(_0x17afff){_0x417c7c[_0xfca1('0x3c')]=_0x17afff;return _0x417c7c;})[_0xfca1('0x21')](respondWithFilteredResult(_0x242c6f,_0x52ad6c))[_0xfca1('0x3d')](handleError(_0x242c6f,null));};exports[_0xfca1('0x3e')]=function(_0x16a61e,_0x418d10){var _0x7aac3c={'raw':!![],'where':{'id':_0x16a61e[_0xfca1('0x3f')]['id']}},_0xa73019={};_0xa73019[_0xfca1('0x2a')]=_[_0xfca1('0x2c')](db[_0xfca1('0x39')][_0xfca1('0x40')]);_0xa73019[_0xfca1('0x2b')]=_[_0xfca1('0x2c')](_0x16a61e[_0xfca1('0x2b')]);_0xa73019[_0xfca1('0x2d')]=_[_0xfca1('0x2e')](_0xa73019[_0xfca1('0x2a')],_0xa73019[_0xfca1('0x2b')]);_0x7aac3c[_0xfca1('0x2f')]=_[_0xfca1('0x2e')](_0xa73019[_0xfca1('0x2a')],qs[_0xfca1('0x30')](_0x16a61e[_0xfca1('0x2b')][_0xfca1('0x30')]));_0x7aac3c[_0xfca1('0x2f')]=_0x7aac3c[_0xfca1('0x2f')]['length']?_0x7aac3c[_0xfca1('0x2f')]:_0xa73019['model'];if(_0x16a61e[_0xfca1('0x2b')]['includeAll']){_0x7aac3c['include']=[{'all':!![]}];}_0x7aac3c=_[_0xfca1('0x41')]({},_0x7aac3c,_0x16a61e[_0xfca1('0x38')]);return db[_0xfca1('0x39')][_0xfca1('0x42')](_0x7aac3c)[_0xfca1('0x21')](handleEntityNotFound(_0x418d10,null))['then'](respondWithResult(_0x418d10,null))[_0xfca1('0x3d')](handleError(_0x418d10,null));};exports[_0xfca1('0x43')]=function(_0xba91bc,_0x2dd0dc){return db['JscriptySessionReport']['create'](_0xba91bc[_0xfca1('0x44')],{})[_0xfca1('0x21')](respondWithResult(_0x2dd0dc,0xc9))[_0xfca1('0x3d')](handleError(_0x2dd0dc,null));};exports[_0xfca1('0x20')]=function(_0xc585ba,_0x55445c){if(_0xc585ba[_0xfca1('0x44')]['id']){delete _0xc585ba[_0xfca1('0x44')]['id'];}return db[_0xfca1('0x39')]['find']({'where':{'id':_0xc585ba[_0xfca1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55445c,null))[_0xfca1('0x21')](saveUpdates(_0xc585ba[_0xfca1('0x44')],null))[_0xfca1('0x21')](respondWithResult(_0x55445c,null))[_0xfca1('0x3d')](handleError(_0x55445c,null));};exports['destroy']=function(_0x36c29b,_0xfea85){return db[_0xfca1('0x39')]['find']({'where':{'id':_0x36c29b['params']['id']}})['then'](handleEntityNotFound(_0xfea85,null))[_0xfca1('0x21')](removeEntity(_0xfea85,null))[_0xfca1('0x3d')](handleError(_0xfea85,null));};exports['describe']=function(_0xbd3ff3,_0x519569){return db[_0xfca1('0x39')]['describe']()[_0xfca1('0x21')](respondWithResult(_0x519569,null))[_0xfca1('0x3d')](handleError(_0x519569,null));};exports[_0xfca1('0x45')]=function(_0xc7aab3,_0x430abf,_0x5dd257){var _0x21d213={'raw':!![],'where':{}};var _0x292622={};var _0x2580de={'count':0x0,'rows':[]};return db[_0xfca1('0x39')][_0xfca1('0x46')]({'where':{'id':_0xc7aab3[_0xfca1('0x3f')]['id']}})[_0xfca1('0x21')](handleEntityNotFound(_0x430abf,null))['then'](function(_0x1e7e97){if(_0x1e7e97){_0x292622[_0xfca1('0x2a')]=_[_0xfca1('0x2c')](db[_0xfca1('0x47')][_0xfca1('0x40')]);_0x292622[_0xfca1('0x2b')]=_[_0xfca1('0x2c')](_0xc7aab3[_0xfca1('0x2b')]);_0x292622['filters']=_[_0xfca1('0x2e')](_0x292622['model'],_0x292622[_0xfca1('0x2b')]);_0x21d213[_0xfca1('0x2f')]=_[_0xfca1('0x2e')](_0x292622[_0xfca1('0x2a')],qs[_0xfca1('0x30')](_0xc7aab3[_0xfca1('0x2b')][_0xfca1('0x30')]));_0x21d213[_0xfca1('0x2f')]=_0x21d213[_0xfca1('0x2f')][_0xfca1('0x31')]?_0x21d213[_0xfca1('0x2f')]:_0x292622[_0xfca1('0x2a')];if(!_0xc7aab3[_0xfca1('0x2b')][_0xfca1('0x32')](_0xfca1('0x48'))){_0x21d213[_0xfca1('0x1d')]=qs[_0xfca1('0x1d')](_0xc7aab3['query'][_0xfca1('0x1d')]);_0x21d213[_0xfca1('0x1c')]=qs[_0xfca1('0x1c')](_0xc7aab3[_0xfca1('0x2b')][_0xfca1('0x1c')]);}_0x21d213[_0xfca1('0x33')]=qs[_0xfca1('0x49')](_0xc7aab3[_0xfca1('0x2b')]['sort']);_0x21d213['where']=qs[_0xfca1('0x2d')](_[_0xfca1('0x35')](_0xc7aab3[_0xfca1('0x2b')],_0x292622[_0xfca1('0x2d')]));_0x21d213[_0xfca1('0x34')][_0xfca1('0x4a')]=_0x1e7e97['id'];if(_0xc7aab3['query'][_0xfca1('0x36')]){_0x21d213[_0xfca1('0x34')]=_['merge'](_0x21d213[_0xfca1('0x34')],{'$or':_[_0xfca1('0x27')](_0x21d213[_0xfca1('0x2f')],function(_0x53ab3d){var _0xe8297f={};_0xe8297f[_0x53ab3d]={'$like':'%'+_0xc7aab3[_0xfca1('0x2b')][_0xfca1('0x36')]+'%'};return _0xe8297f;})});}_0x21d213=_[_0xfca1('0x41')]({},_0x21d213,_0xc7aab3[_0xfca1('0x38')]);return db['JscriptyQuestionReport'][_0xfca1('0x1b')]({'where':_0x21d213[_0xfca1('0x34')]})['then'](function(_0x3c43ac){_0x2580de['count']=_0x3c43ac;if(_0xc7aab3[_0xfca1('0x2b')][_0xfca1('0x4b')]){_0x21d213['include']=[{'all':!![]}];}return db[_0xfca1('0x47')][_0xfca1('0x3b')](_0x21d213);})['then'](function(_0x38faa1){_0x2580de['rows']=_0x38faa1;return _0x2580de;});}})[_0xfca1('0x21')](respondWithFilteredResult(_0x430abf,_0x21d213))[_0xfca1('0x3d')](handleError(_0x430abf,null));}; \ No newline at end of file +var _0xb701=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','findOne','JscriptyQuestionReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs'];(function(_0x11118c,_0x184bbc){var _0x4acbe5=function(_0x5037ed){while(--_0x5037ed){_0x11118c['push'](_0x11118c['shift']());}};_0x4acbe5(++_0x184bbc);}(_0xb701,0x1b2));var _0x1b70=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb701[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0x1b70('0x0'));var emlformat=require(_0x1b70('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b70('0x2'));var jsonpatch=require(_0x1b70('0x3'));var rp=require(_0x1b70('0x4'));var moment=require(_0x1b70('0x5'));var BPromise=require(_0x1b70('0x6'));var Mustache=require(_0x1b70('0x7'));var util=require('util');var path=require(_0x1b70('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1b70('0x9'));var fs=require('fs');var _=require(_0x1b70('0xa'));var squel=require(_0x1b70('0xb'));var crypto=require(_0x1b70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b70('0xd'));var toCsv=require(_0x1b70('0xe'));var querystring=require(_0x1b70('0xf'));var Papa=require(_0x1b70('0x10'));var Redis=require(_0x1b70('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b70('0x12'));var logger=require('../../config/logger')(_0x1b70('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1b70('0x14'))['db'];function respondWithStatusCode(_0x25e864,_0x5b8a83){_0x5b8a83=_0x5b8a83||0xcc;return function(_0x3279b3){if(_0x3279b3){return _0x25e864['sendStatus'](_0x5b8a83);}return _0x25e864[_0x1b70('0x15')](_0x5b8a83)['end']();};}function respondWithResult(_0x35f0ff,_0xd5efd4){_0xd5efd4=_0xd5efd4||0xc8;return function(_0x52f269){if(_0x52f269){return _0x35f0ff[_0x1b70('0x15')](_0xd5efd4)[_0x1b70('0x16')](_0x52f269);}};}function respondWithFilteredResult(_0x25fd04,_0x1c07f5){return function(_0x2daf18){if(_0x2daf18){var _0x482026=_0x2daf18[_0x1b70('0x17')],_0xd96370=_0x1c07f5[_0x1b70('0x18')],_0x514867=_0x1c07f5[_0x1b70('0x18')]+_0x1c07f5['limit'],_0x2e1757;if(_0x514867>=_0x482026){_0x514867=_0x482026;_0x2e1757=0xc8;}else{_0x2e1757=0xce;}_0x25fd04[_0x1b70('0x15')](_0x2e1757);return _0x25fd04[_0x1b70('0x19')](_0x1b70('0x1a'),_0xd96370+'-'+_0x514867+'/'+_0x482026)['json'](_0x2daf18);}return null;};}function patchUpdates(_0x23551c){return function(_0x4eada9){try{jsonpatch[_0x1b70('0x1b')](_0x4eada9,_0x23551c,!![]);}catch(_0x58c52d){return BPromise['reject'](_0x58c52d);}return _0x4eada9[_0x1b70('0x1c')]();};}function saveUpdates(_0x33ef72,_0x3939ed){return function(_0x35b887){if(_0x35b887){return _0x35b887[_0x1b70('0x1d')](_0x33ef72)[_0x1b70('0x1e')](function(_0x129738){return _0x129738;});}return null;};}function removeEntity(_0x32a6d1,_0xf86475){return function(_0x347d75){if(_0x347d75){return _0x347d75[_0x1b70('0x1f')]()[_0x1b70('0x1e')](function(){_0x32a6d1[_0x1b70('0x15')](0xcc)[_0x1b70('0x20')]();});}};}function handleEntityNotFound(_0x36c1ed,_0x7ff704){return function(_0x3892bb){if(!_0x3892bb){_0x36c1ed[_0x1b70('0x21')](0x194);}return _0x3892bb;};}function handleError(_0x86976b,_0xc31a96){_0xc31a96=_0xc31a96||0x1f4;return function(_0x70eb56){logger['error'](_0x70eb56[_0x1b70('0x22')]);if(_0x70eb56['name']){delete _0x70eb56['name'];}_0x86976b[_0x1b70('0x15')](_0xc31a96)[_0x1b70('0x23')](_0x70eb56);};}exports['index']=function(_0x1d95a3,_0x35e16a){var _0x5759fd={},_0x1116d0={},_0x4c4ddb={'count':0x0,'rows':[]};var _0x4627a1=_[_0x1b70('0x24')](db[_0x1b70('0x25')][_0x1b70('0x26')],function(_0x27abc1){return{'name':_0x27abc1[_0x1b70('0x27')],'type':_0x27abc1[_0x1b70('0x28')][_0x1b70('0x29')]};});_0x1116d0[_0x1b70('0x2a')]=_[_0x1b70('0x24')](_0x4627a1,_0x1b70('0x2b'));_0x1116d0[_0x1b70('0x2c')]=_[_0x1b70('0x2d')](_0x1d95a3[_0x1b70('0x2c')]);_0x1116d0['filters']=_[_0x1b70('0x2e')](_0x1116d0[_0x1b70('0x2a')],_0x1116d0[_0x1b70('0x2c')]);_0x5759fd[_0x1b70('0x2f')]=_[_0x1b70('0x2e')](_0x1116d0['model'],qs[_0x1b70('0x30')](_0x1d95a3['query'][_0x1b70('0x30')]));_0x5759fd[_0x1b70('0x2f')]=_0x5759fd[_0x1b70('0x2f')][_0x1b70('0x31')]?_0x5759fd[_0x1b70('0x2f')]:_0x1116d0['model'];if(!_0x1d95a3[_0x1b70('0x2c')][_0x1b70('0x32')](_0x1b70('0x33'))){_0x5759fd[_0x1b70('0x34')]=qs['limit'](_0x1d95a3[_0x1b70('0x2c')][_0x1b70('0x34')]);_0x5759fd[_0x1b70('0x18')]=qs[_0x1b70('0x18')](_0x1d95a3[_0x1b70('0x2c')][_0x1b70('0x18')]);}_0x5759fd[_0x1b70('0x35')]=qs[_0x1b70('0x36')](_0x1d95a3['query'][_0x1b70('0x36')]);_0x5759fd[_0x1b70('0x37')]=qs[_0x1b70('0x38')](_[_0x1b70('0x39')](_0x1d95a3['query'],_0x1116d0[_0x1b70('0x38')]),_0x4627a1);if(_0x1d95a3[_0x1b70('0x2c')][_0x1b70('0x3a')]){_0x5759fd[_0x1b70('0x37')]=_[_0x1b70('0x3b')](_0x5759fd[_0x1b70('0x37')],{'$or':_[_0x1b70('0x24')](_0x4627a1,function(_0x2b945e){if(_0x2b945e[_0x1b70('0x28')]!=='VIRTUAL'){var _0xe0cff7={};_0xe0cff7[_0x2b945e[_0x1b70('0x2b')]]={'$like':'%'+_0x1d95a3[_0x1b70('0x2c')][_0x1b70('0x3a')]+'%'};return _0xe0cff7;}})});}_0x5759fd=_[_0x1b70('0x3b')]({},_0x5759fd,_0x1d95a3[_0x1b70('0x3c')]);var _0x142b8b={'where':_0x5759fd['where']};return db[_0x1b70('0x25')]['count'](_0x142b8b)['then'](function(_0x23dc0e){_0x4c4ddb[_0x1b70('0x17')]=_0x23dc0e;if(_0x1d95a3[_0x1b70('0x2c')]['includeAll']){_0x5759fd[_0x1b70('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1b70('0x3e')](_0x5759fd);})['then'](function(_0x3b7142){_0x4c4ddb[_0x1b70('0x3f')]=_0x3b7142;return _0x4c4ddb;})[_0x1b70('0x1e')](respondWithFilteredResult(_0x35e16a,_0x5759fd))[_0x1b70('0x40')](handleError(_0x35e16a,null));};exports[_0x1b70('0x41')]=function(_0x5b8a76,_0x1cc05f){var _0x3b02f9={'raw':!![],'where':{'id':_0x5b8a76[_0x1b70('0x42')]['id']}},_0x4572b1={};_0x4572b1['model']=_['keys'](db[_0x1b70('0x25')][_0x1b70('0x26')]);_0x4572b1[_0x1b70('0x2c')]=_[_0x1b70('0x2d')](_0x5b8a76[_0x1b70('0x2c')]);_0x4572b1[_0x1b70('0x38')]=_[_0x1b70('0x2e')](_0x4572b1['model'],_0x4572b1['query']);_0x3b02f9[_0x1b70('0x2f')]=_[_0x1b70('0x2e')](_0x4572b1[_0x1b70('0x2a')],qs[_0x1b70('0x30')](_0x5b8a76[_0x1b70('0x2c')][_0x1b70('0x30')]));_0x3b02f9['attributes']=_0x3b02f9[_0x1b70('0x2f')][_0x1b70('0x31')]?_0x3b02f9[_0x1b70('0x2f')]:_0x4572b1[_0x1b70('0x2a')];if(_0x5b8a76[_0x1b70('0x2c')][_0x1b70('0x43')]){_0x3b02f9[_0x1b70('0x3d')]=[{'all':!![]}];}_0x3b02f9=_[_0x1b70('0x3b')]({},_0x3b02f9,_0x5b8a76[_0x1b70('0x3c')]);return db['JscriptySessionReport'][_0x1b70('0x44')](_0x3b02f9)[_0x1b70('0x1e')](handleEntityNotFound(_0x1cc05f,null))[_0x1b70('0x1e')](respondWithResult(_0x1cc05f,null))[_0x1b70('0x40')](handleError(_0x1cc05f,null));};exports['create']=function(_0x376170,_0xcf20f8){return db['JscriptySessionReport'][_0x1b70('0x45')](_0x376170[_0x1b70('0x46')],{})[_0x1b70('0x1e')](respondWithResult(_0xcf20f8,0xc9))[_0x1b70('0x40')](handleError(_0xcf20f8,null));};exports[_0x1b70('0x1d')]=function(_0x51b8ba,_0x3d8a42){if(_0x51b8ba[_0x1b70('0x46')]['id']){delete _0x51b8ba[_0x1b70('0x46')]['id'];}return db[_0x1b70('0x25')][_0x1b70('0x44')]({'where':{'id':_0x51b8ba['params']['id']}})[_0x1b70('0x1e')](handleEntityNotFound(_0x3d8a42,null))['then'](saveUpdates(_0x51b8ba[_0x1b70('0x46')],null))[_0x1b70('0x1e')](respondWithResult(_0x3d8a42,null))[_0x1b70('0x40')](handleError(_0x3d8a42,null));};exports['destroy']=function(_0x234539,_0x253a65){return db[_0x1b70('0x25')][_0x1b70('0x44')]({'where':{'id':_0x234539['params']['id']}})[_0x1b70('0x1e')](handleEntityNotFound(_0x253a65,null))[_0x1b70('0x1e')](removeEntity(_0x253a65,null))['catch'](handleError(_0x253a65,null));};exports['describe']=function(_0xd683ec,_0x191951){return db[_0x1b70('0x25')][_0x1b70('0x47')]()[_0x1b70('0x1e')](respondWithResult(_0x191951,null))['catch'](handleError(_0x191951,null));};exports['getQuestions']=function(_0x44c182,_0x16d7aa,_0x457727){var _0x11d263={'raw':!![],'where':{}};var _0x113c78={};var _0x443ab4={'count':0x0,'rows':[]};return db[_0x1b70('0x25')][_0x1b70('0x48')]({'where':{'id':_0x44c182[_0x1b70('0x42')]['id']}})[_0x1b70('0x1e')](handleEntityNotFound(_0x16d7aa,null))[_0x1b70('0x1e')](function(_0x49d757){if(_0x49d757){_0x113c78['model']=_[_0x1b70('0x2d')](db[_0x1b70('0x49')][_0x1b70('0x26')]);_0x113c78[_0x1b70('0x2c')]=_[_0x1b70('0x2d')](_0x44c182['query']);_0x113c78[_0x1b70('0x38')]=_['intersection'](_0x113c78[_0x1b70('0x2a')],_0x113c78[_0x1b70('0x2c')]);_0x11d263['attributes']=_[_0x1b70('0x2e')](_0x113c78[_0x1b70('0x2a')],qs['fields'](_0x44c182[_0x1b70('0x2c')][_0x1b70('0x30')]));_0x11d263[_0x1b70('0x2f')]=_0x11d263[_0x1b70('0x2f')][_0x1b70('0x31')]?_0x11d263[_0x1b70('0x2f')]:_0x113c78[_0x1b70('0x2a')];if(!_0x44c182[_0x1b70('0x2c')][_0x1b70('0x32')](_0x1b70('0x33'))){_0x11d263[_0x1b70('0x34')]=qs[_0x1b70('0x34')](_0x44c182[_0x1b70('0x2c')]['limit']);_0x11d263[_0x1b70('0x18')]=qs[_0x1b70('0x18')](_0x44c182[_0x1b70('0x2c')][_0x1b70('0x18')]);}_0x11d263['order']=qs[_0x1b70('0x36')](_0x44c182[_0x1b70('0x2c')][_0x1b70('0x36')]);_0x11d263[_0x1b70('0x37')]=qs['filters'](_['pick'](_0x44c182[_0x1b70('0x2c')],_0x113c78['filters']));_0x11d263['where']['SessionId']=_0x49d757['id'];if(_0x44c182['query'][_0x1b70('0x3a')]){_0x11d263[_0x1b70('0x37')]=_['merge'](_0x11d263[_0x1b70('0x37')],{'$or':_['map'](_0x11d263[_0x1b70('0x2f')],function(_0x889a9d){var _0x33d95c={};_0x33d95c[_0x889a9d]={'$like':'%'+_0x44c182[_0x1b70('0x2c')]['filter']+'%'};return _0x33d95c;})});}_0x11d263=_[_0x1b70('0x3b')]({},_0x11d263,_0x44c182[_0x1b70('0x3c')]);return db['JscriptyQuestionReport']['count']({'where':_0x11d263['where']})[_0x1b70('0x1e')](function(_0x195533){_0x443ab4[_0x1b70('0x17')]=_0x195533;if(_0x44c182[_0x1b70('0x2c')][_0x1b70('0x43')]){_0x11d263[_0x1b70('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1b70('0x3e')](_0x11d263);})[_0x1b70('0x1e')](function(_0x5c2e61){_0x443ab4[_0x1b70('0x3f')]=_0x5c2e61;return _0x443ab4;});}})['then'](respondWithFilteredResult(_0x16d7aa,_0x11d263))[_0x1b70('0x40')](handleError(_0x16d7aa,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 56010ce..af05c12 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 _0xf06c=['request-promise','path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0x409b1a,_0x5d9afc){var _0x431819=function(_0x56cda8){while(--_0x56cda8){_0x409b1a['push'](_0x409b1a['shift']());}};_0x431819(++_0x5d9afc);}(_0xf06c,0xc7));var _0xcf06=function(_0x3c70eb,_0x1350a6){_0x3c70eb=_0x3c70eb-0x0;var _0x30086e=_0xf06c[_0x3c70eb];return _0x30086e;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var logger=require(_0xcf06('0x2'))(_0xcf06('0x3'));var moment=require(_0xcf06('0x4'));var BPromise=require('bluebird');var rp=require(_0xcf06('0x5'));var fs=require('fs');var path=require(_0xcf06('0x6'));var rimraf=require(_0xcf06('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf06('0x8'));module[_0xcf06('0x9')]=function(_0x3de2dc,_0x4e6799){return _0x3de2dc[_0xcf06('0xa')]('JscriptySessionReport',attributes,{'tableName':_0xcf06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x964b=['util','api','moment','bluebird','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x964b,0x112));var _0xb964=function(_0x198dd1,_0x34cf31){_0x198dd1=_0x198dd1-0x0;var _0x5df6d3=_0x964b[_0x198dd1];return _0x5df6d3;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'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 5c98566..a5085a7 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 _0xc719=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x184833,_0x726b0f){var _0x3d40d4=function(_0x23d6f3){while(--_0x23d6f3){_0x184833['push'](_0x184833['shift']());}};_0x3d40d4(++_0x726b0f);}(_0xc719,0x1d2));var _0x9c71=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xc719[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require(_0x9c71('0x0'));var util=require(_0x9c71('0x1'));var moment=require(_0x9c71('0x2'));var BPromise=require(_0x9c71('0x3'));var rs=require(_0x9c71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c71('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c71('0x6'))(_0x9c71('0x7'));var config=require(_0x9c71('0x8'));var jayson=require(_0x9c71('0x9'));var client=jayson[_0x9c71('0xa')][_0x9c71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x413519,_0x162af5,_0x55a82e){return new BPromise(function(_0x1c27d2,_0x2f212e){return client[_0x9c71('0xc')](_0x413519,_0x55a82e)[_0x9c71('0xd')](function(_0x37bc17){logger[_0x9c71('0xe')](_0x9c71('0xf'),_0x162af5,_0x9c71('0x10'));logger[_0x9c71('0x11')](_0x9c71('0x12'),_0x162af5,_0x9c71('0x10'),JSON[_0x9c71('0x13')](_0x37bc17));if(_0x37bc17['error']){if(_0x37bc17['error'][_0x9c71('0x14')]===0x1f4){logger['error'](_0x9c71('0xf'),_0x162af5,_0x37bc17['error'][_0x9c71('0x15')]);return _0x2f212e(_0x37bc17[_0x9c71('0x16')][_0x9c71('0x15')]);}logger['error'](_0x9c71('0xf'),_0x162af5,_0x37bc17[_0x9c71('0x16')][_0x9c71('0x15')]);return _0x1c27d2(_0x37bc17['error']['message']);}else{logger[_0x9c71('0xe')](_0x9c71('0xf'),_0x162af5,'request\x20sent');_0x1c27d2(_0x37bc17['result']['message']);}})[_0x9c71('0x17')](function(_0x588f14){logger[_0x9c71('0x16')](_0x9c71('0xf'),_0x162af5,_0x588f14);_0x2f212e(_0x588f14);});});} \ No newline at end of file +var _0x06fb=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','debug','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info'];(function(_0x22651a,_0x131ee8){var _0x518710=function(_0x48c657){while(--_0x48c657){_0x22651a['push'](_0x22651a['shift']());}};_0x518710(++_0x131ee8);}(_0x06fb,0x190));var _0xb06f=function(_0x35d120,_0x2ca28c){_0x35d120=_0x35d120-0x0;var _0x69e008=_0x06fb[_0x35d120];return _0x69e008;};'use strict';var _=require('lodash');var util=require(_0xb06f('0x0'));var moment=require('moment');var BPromise=require(_0xb06f('0x1'));var rs=require(_0xb06f('0x2'));var fs=require('fs');var Redis=require(_0xb06f('0x3'));var db=require(_0xb06f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb06f('0x5'));var jayson=require(_0xb06f('0x6'));var client=jayson[_0xb06f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370010,_0x12c261,_0x1971ec){return new BPromise(function(_0x486e74,_0x41f626){return client[_0xb06f('0x8')](_0x370010,_0x1971ec)[_0xb06f('0x9')](function(_0x1d20b8){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x12c261,'request\x20sent');logger[_0xb06f('0xa')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x12c261,_0xb06f('0xb'),JSON[_0xb06f('0xc')](_0x1d20b8));if(_0x1d20b8[_0xb06f('0xd')]){if(_0x1d20b8['error'][_0xb06f('0xe')]===0x1f4){logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);return _0x41f626(_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);}logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);return _0x486e74(_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);}else{logger[_0xb06f('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x12c261,'request\x20sent');_0x486e74(_0x1d20b8['result'][_0xb06f('0x10')]);}})[_0xb06f('0x12')](function(_0x5b3a06){logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x5b3a06);_0x41f626(_0x5b3a06);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3e2e935..e58f3b2 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 _0xaaf7=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','put','/:id','update','multer'];(function(_0x33b9ac,_0x1cd671){var _0x4da2a0=function(_0x62ec6b){while(--_0x62ec6b){_0x33b9ac['push'](_0x33b9ac['shift']());}};_0x4da2a0(++_0x1cd671);}(_0xaaf7,0x143));var _0x7aaf=function(_0x280405,_0x274b31){_0x280405=_0x280405-0x0;var _0x2db04d=_0xaaf7[_0x280405];return _0x2db04d;};'use strict';var multer=require(_0x7aaf('0x0'));var util=require('util');var path=require(_0x7aaf('0x1'));var timeout=require(_0x7aaf('0x2'));var express=require(_0x7aaf('0x3'));var router=express[_0x7aaf('0x4')]();var auth=require(_0x7aaf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7aaf('0x6'));var controller=require('./license.controller');router[_0x7aaf('0x7')]('/',controller[_0x7aaf('0x8')]);router[_0x7aaf('0x9')](_0x7aaf('0xa'),auth['isAuthenticated'](),controller[_0x7aaf('0xb')]);module['exports']=router; \ No newline at end of file +var _0x1c02=['../../components/interaction/service','./license.controller','index','put','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3431ca,_0x3ad596){var _0x912a8c=function(_0x3a2ecc){while(--_0x3a2ecc){_0x3431ca['push'](_0x3431ca['shift']());}};_0x912a8c(++_0x3ad596);}(_0x1c02,0x156));var _0x21c0=function(_0x4ba66e,_0x163655){_0x4ba66e=_0x4ba66e-0x0;var _0x485b1e=_0x1c02[_0x4ba66e];return _0x485b1e;};'use strict';var multer=require(_0x21c0('0x0'));var util=require(_0x21c0('0x1'));var path=require(_0x21c0('0x2'));var timeout=require(_0x21c0('0x3'));var express=require('express');var router=express[_0x21c0('0x4')]();var auth=require(_0x21c0('0x5'));var interaction=require(_0x21c0('0x6'));var config=require('../../config/environment');var controller=require(_0x21c0('0x7'));router['get']('/',controller[_0x21c0('0x8')]);router[_0x21c0('0x9')](_0x21c0('0xa'),auth['isAuthenticated'](),controller['update']);module[_0x21c0('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index f571353..639ed39 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 _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xba34,0x119));var _0x4ba3=function(_0x1d8013,_0x3c01ab){_0x1d8013=_0x1d8013-0x0;var _0x7e6d98=_0xba34[_0x1d8013];return _0x7e6d98;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d38=['exports','TEXT','STRING'];(function(_0x3836db,_0x1e33d6){var _0x3f8867=function(_0xc33b0b){while(--_0xc33b0b){_0x3836db['push'](_0x3836db['shift']());}};_0x3f8867(++_0x1e33d6);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'license':{'type':Sequelize[_0x86d3('0x1')]},'data1':{'type':Sequelize[_0x86d3('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 8c4850b..feb0518 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 _0x7f0e=['limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','attributes','intersection','model','fields','length','merge','getLicense','catch','body','params','get','key','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x7f0e,0x1f0));var _0xe7f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7f0e[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0xe7f0('0x0'));var emlformat=require(_0xe7f0('0x1'));var rimraf=require(_0xe7f0('0x2'));var zipdir=require(_0xe7f0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe7f0('0x4'));var util=require(_0xe7f0('0x5'));var path=require(_0xe7f0('0x6'));var sox=require(_0xe7f0('0x7'));var csv=require(_0xe7f0('0x8'));var ejs=require(_0xe7f0('0x9'));var fs=require('fs');var _=require(_0xe7f0('0xa'));var squel=require(_0xe7f0('0xb'));var crypto=require(_0xe7f0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe7f0('0x8'));var querystring=require('querystring');var Papa=require(_0xe7f0('0xd'));var Redis=require(_0xe7f0('0xe'));var authService=require(_0xe7f0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe7f0('0x10'));var hardwareService=require(_0xe7f0('0x11'));var logger=require(_0xe7f0('0x12'))(_0xe7f0('0x13'));var utils=require(_0xe7f0('0x14'));var config=require('../../config/environment');var db=require(_0xe7f0('0x15'))['db'];function respondWithStatusCode(_0x5efd1c,_0x297824){_0x297824=_0x297824||0xcc;return function(_0x28b0bf){if(_0x28b0bf){return _0x5efd1c['sendStatus'](_0x297824);}return _0x5efd1c[_0xe7f0('0x16')](_0x297824)['end']();};}function respondWithResult(_0x250607,_0x303cc7){_0x303cc7=_0x303cc7||0xc8;return function(_0x20b2ed){if(_0x20b2ed){return _0x250607[_0xe7f0('0x16')](_0x303cc7)[_0xe7f0('0x17')](_0x20b2ed);}};}function respondWithFilteredResult(_0x5d5efb,_0xa09d1e){return function(_0x38a28b){if(_0x38a28b){var _0x384755=_0x38a28b[_0xe7f0('0x18')],_0x25c197=_0xa09d1e['offset'],_0x19f51f=_0xa09d1e[_0xe7f0('0x19')]+_0xa09d1e[_0xe7f0('0x1a')],_0x231295;if(_0x19f51f>=_0x384755){_0x19f51f=_0x384755;_0x231295=0xc8;}else{_0x231295=0xce;}_0x5d5efb[_0xe7f0('0x16')](_0x231295);return _0x5d5efb[_0xe7f0('0x1b')](_0xe7f0('0x1c'),_0x25c197+'-'+_0x19f51f+'/'+_0x384755)[_0xe7f0('0x17')](_0x38a28b);}return null;};}function patchUpdates(_0x250e83){return function(_0x5bbe87){try{jsonpatch[_0xe7f0('0x1d')](_0x5bbe87,_0x250e83,!![]);}catch(_0x58a564){return BPromise['reject'](_0x58a564);}return _0x5bbe87[_0xe7f0('0x1e')]();};}function saveUpdates(_0x4a5f2f,_0x4317af){return function(_0x466b80){if(_0x466b80){return _0x466b80[_0xe7f0('0x1f')](_0x4a5f2f)[_0xe7f0('0x20')](function(_0xf373ad){return _0xf373ad;});}return null;};}function removeEntity(_0x13223e,_0x2c955c){return function(_0x5081b4){if(_0x5081b4){return _0x5081b4[_0xe7f0('0x21')]()[_0xe7f0('0x20')](function(){_0x13223e[_0xe7f0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3091dd,_0x5cfe63){return function(_0x7c389c){if(!_0x7c389c){_0x3091dd[_0xe7f0('0x22')](0x194);}return _0x7c389c;};}function handleError(_0x43ee4f,_0x1e8464){_0x1e8464=_0x1e8464||0x1f4;return function(_0x5bf0e0){logger[_0xe7f0('0x23')](_0x5bf0e0[_0xe7f0('0x24')]);if(_0x5bf0e0[_0xe7f0('0x25')]){delete _0x5bf0e0['name'];}_0x43ee4f[_0xe7f0('0x16')](_0x1e8464)[_0xe7f0('0x26')](_0x5bf0e0);};}var utilLicense=require(_0xe7f0('0x27'));exports[_0xe7f0('0x28')]=function(_0x39692f,_0x548f3f){var _0x306c85={'raw':!![],'where':{'id':0x1}},_0x11de52={};_0x11de52['model']=_[_0xe7f0('0x29')](db[_0xe7f0('0x2a')][_0xe7f0('0x2b')]);_0x11de52[_0xe7f0('0x2c')]=_['keys'](_0x39692f[_0xe7f0('0x2c')]);_0x11de52[_0xe7f0('0x2d')]=_['intersection'](_0x11de52['model'],_0x11de52[_0xe7f0('0x2c')]);_0x306c85[_0xe7f0('0x2e')]=_[_0xe7f0('0x2f')](_0x11de52[_0xe7f0('0x30')],qs['fields'](_0x39692f[_0xe7f0('0x2c')][_0xe7f0('0x31')]));_0x306c85[_0xe7f0('0x2e')]=_0x306c85[_0xe7f0('0x2e')][_0xe7f0('0x32')]?_0x306c85['attributes']:_0x11de52[_0xe7f0('0x30')];_0x306c85=_[_0xe7f0('0x33')]({},_0x306c85,_0x39692f['options']);return utilLicense[_0xe7f0('0x34')](_0x306c85)[_0xe7f0('0x20')](respondWithResult(_0x548f3f,null))[_0xe7f0('0x35')](handleError(_0x548f3f,null));};exports[_0xe7f0('0x1f')]=function(_0x170ac0,_0x338b83){if(_0x170ac0[_0xe7f0('0x36')]['id']){delete _0x170ac0[_0xe7f0('0x36')]['id'];}return db[_0xe7f0('0x2a')]['find']({'where':{'id':_0x170ac0[_0xe7f0('0x37')]['id']}})[_0xe7f0('0x20')](handleEntityNotFound(_0x338b83,null))['then'](function(_0x14ac19){var _0x462b40=_0x14ac19[_0xe7f0('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x462b40,_0x170ac0['body'][_0xe7f0('0x39')]);})['then'](function(_0x5bff0f){if(!_0x5bff0f['demo']){return saveUpdates(_0x170ac0[_0xe7f0('0x36')],null);}return _0x5bff0f;})[_0xe7f0('0x20')](respondWithResult(_0x338b83,null))[_0xe7f0('0x35')](handleError(_0x338b83,null));}; \ No newline at end of file +var _0xf200=['get','checkLicense','key','html-pdf','rimraf','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','error','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','length','attributes','merge','options','getLicense','catch','body','find','params'];(function(_0x63b9ea,_0x2d811b){var _0x274909=function(_0x59b3be){while(--_0x59b3be){_0x63b9ea['push'](_0x63b9ea['shift']());}};_0x274909(++_0x2d811b);}(_0xf200,0x77));var _0x0f20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf200[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0f20('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f20('0x2'));var BPromise=require(_0x0f20('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f20('0x4'));var sox=require('sox');var csv=require(_0x0f20('0x5'));var ejs=require(_0x0f20('0x6'));var fs=require('fs');var _=require(_0x0f20('0x7'));var squel=require(_0x0f20('0x8'));var crypto=require(_0x0f20('0x9'));var jsforce=require(_0x0f20('0xa'));var deskjs=require(_0x0f20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0f20('0xc'));var Papa=require('papaparse');var Redis=require(_0x0f20('0xd'));var authService=require(_0x0f20('0xe'));var qs=require(_0x0f20('0xf'));var as=require(_0x0f20('0x10'));var hardwareService=require(_0x0f20('0x11'));var logger=require(_0x0f20('0x12'))(_0x0f20('0x13'));var utils=require(_0x0f20('0x14'));var config=require(_0x0f20('0x15'));var db=require(_0x0f20('0x16'))['db'];function respondWithStatusCode(_0x69d91,_0x507e85){_0x507e85=_0x507e85||0xcc;return function(_0x71d19a){if(_0x71d19a){return _0x69d91[_0x0f20('0x17')](_0x507e85);}return _0x69d91[_0x0f20('0x18')](_0x507e85)[_0x0f20('0x19')]();};}function respondWithResult(_0xdb0bfa,_0x202396){_0x202396=_0x202396||0xc8;return function(_0x3aad36){if(_0x3aad36){return _0xdb0bfa[_0x0f20('0x18')](_0x202396)[_0x0f20('0x1a')](_0x3aad36);}};}function respondWithFilteredResult(_0x2287a0,_0x28245d){return function(_0x228890){if(_0x228890){var _0x4da541=_0x228890[_0x0f20('0x1b')],_0x4b5e76=_0x28245d['offset'],_0x433bcd=_0x28245d[_0x0f20('0x1c')]+_0x28245d['limit'],_0x7e03a3;if(_0x433bcd>=_0x4da541){_0x433bcd=_0x4da541;_0x7e03a3=0xc8;}else{_0x7e03a3=0xce;}_0x2287a0[_0x0f20('0x18')](_0x7e03a3);return _0x2287a0[_0x0f20('0x1d')]('Content-Range',_0x4b5e76+'-'+_0x433bcd+'/'+_0x4da541)[_0x0f20('0x1a')](_0x228890);}return null;};}function patchUpdates(_0x1a777a){return function(_0x213312){try{jsonpatch[_0x0f20('0x1e')](_0x213312,_0x1a777a,!![]);}catch(_0x42f4e3){return BPromise[_0x0f20('0x1f')](_0x42f4e3);}return _0x213312['save']();};}function saveUpdates(_0x3e570e,_0xb1b0e1){return function(_0x43e10d){if(_0x43e10d){return _0x43e10d[_0x0f20('0x20')](_0x3e570e)[_0x0f20('0x21')](function(_0x8af789){return _0x8af789;});}return null;};}function removeEntity(_0x1a7229,_0x13edcd){return function(_0x106ddc){if(_0x106ddc){return _0x106ddc[_0x0f20('0x22')]()[_0x0f20('0x21')](function(){_0x1a7229['status'](0xcc)[_0x0f20('0x19')]();});}};}function handleEntityNotFound(_0x4c0f6e,_0x2b8643){return function(_0x58401e){if(!_0x58401e){_0x4c0f6e[_0x0f20('0x17')](0x194);}return _0x58401e;};}function handleError(_0x420f43,_0x42cbe7){_0x42cbe7=_0x42cbe7||0x1f4;return function(_0x52eb97){logger[_0x0f20('0x23')](_0x52eb97['stack']);if(_0x52eb97[_0x0f20('0x24')]){delete _0x52eb97[_0x0f20('0x24')];}_0x420f43[_0x0f20('0x18')](_0x42cbe7)['send'](_0x52eb97);};}var utilLicense=require('../../config/license/util');exports[_0x0f20('0x25')]=function(_0xe2ceb2,_0x4ec8cf){var _0x51434d={'raw':!![],'where':{'id':0x1}},_0x2f1355={};_0x2f1355[_0x0f20('0x26')]=_[_0x0f20('0x27')](db[_0x0f20('0x28')][_0x0f20('0x29')]);_0x2f1355[_0x0f20('0x2a')]=_[_0x0f20('0x27')](_0xe2ceb2[_0x0f20('0x2a')]);_0x2f1355[_0x0f20('0x2b')]=_[_0x0f20('0x2c')](_0x2f1355[_0x0f20('0x26')],_0x2f1355[_0x0f20('0x2a')]);_0x51434d['attributes']=_['intersection'](_0x2f1355['model'],qs['fields'](_0xe2ceb2[_0x0f20('0x2a')][_0x0f20('0x2d')]));_0x51434d['attributes']=_0x51434d['attributes'][_0x0f20('0x2e')]?_0x51434d[_0x0f20('0x2f')]:_0x2f1355[_0x0f20('0x26')];_0x51434d=_[_0x0f20('0x30')]({},_0x51434d,_0xe2ceb2[_0x0f20('0x31')]);return utilLicense[_0x0f20('0x32')](_0x51434d)[_0x0f20('0x21')](respondWithResult(_0x4ec8cf,null))[_0x0f20('0x33')](handleError(_0x4ec8cf,null));};exports[_0x0f20('0x20')]=function(_0x1852cf,_0x4fe148){if(_0x1852cf['body']['id']){delete _0x1852cf[_0x0f20('0x34')]['id'];}return db[_0x0f20('0x28')][_0x0f20('0x35')]({'where':{'id':_0x1852cf[_0x0f20('0x36')]['id']}})['then'](handleEntityNotFound(_0x4fe148,null))[_0x0f20('0x21')](function(_0x450391){var _0x24434c=_0x450391[_0x0f20('0x37')]({'plain':!![]});return utilLicense[_0x0f20('0x38')](_0x24434c,_0x1852cf[_0x0f20('0x34')][_0x0f20('0x39')]);})[_0x0f20('0x21')](function(_0x44cf3a){if(!_0x44cf3a['demo']){return saveUpdates(_0x1852cf[_0x0f20('0x34')],null);}return _0x44cf3a;})['then'](respondWithResult(_0x4fe148,null))[_0x0f20('0x33')](handleError(_0x4fe148,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6bdd4f0..0310bd5 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xb10b,0x12a));var _0xbb10=function(_0x40f5d4,_0x5c7478){_0x40f5d4=_0x40f5d4-0x0;var _0x4408b9=_0xb10b[_0x40f5d4];return _0x4408b9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x5c7525,_0x39490f){var _0x2e2ec8=function(_0x20d59a){while(--_0x20d59a){_0x5c7525['push'](_0x5c7525['shift']());}};_0x2e2ec8(++_0x39490f);}(_0xb10b,0x12a));var _0xbb10=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0xb10b[_0xe4e303];return _0x39021e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 32ccbe8..1803137 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 _0xcd31=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd31,0x15d));var _0x1cd3=function(_0x5f3e2b,_0x269bc0){_0x5f3e2b=_0x5f3e2b-0x0;var _0x13b396=_0xcd31[_0x5f3e2b];return _0x13b396;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cd3('0x9')][_0x1cd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedb6d1,_0x49d849,_0x45cc24){return new BPromise(function(_0x11b139,_0x124659){return client['request'](_0xedb6d1,_0x45cc24)[_0x1cd3('0xb')](function(_0x3953d3){logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x49d849,'request\x20sent',JSON[_0x1cd3('0x11')](_0x3953d3));if(_0x3953d3[_0x1cd3('0x12')]){if(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x13')]===0x1f4){logger['error'](_0x1cd3('0xd'),_0x49d849,_0x3953d3['error'][_0x1cd3('0x14')]);return _0x124659(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x49d849,_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);return _0x11b139(_0x3953d3[_0x1cd3('0x12')]['message']);}else{logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));_0x11b139(_0x3953d3[_0x1cd3('0x15')]['message']);}})['catch'](function(_0x5531c5){logger['error']('License,\x20%s,\x20%s',_0x49d849,_0x5531c5);_0x124659(_0x5531c5);});});} \ No newline at end of file +var _0xe99c=['../../config/environment','client','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x100496,_0x252cde){var _0x2f75fe=function(_0x428096){while(--_0x428096){_0x100496['push'](_0x100496['shift']());}};_0x2f75fe(++_0x252cde);}(_0xe99c,0x197));var _0xce99=function(_0x1c8ff7,_0x5b280b){_0x1c8ff7=_0x1c8ff7-0x0;var _0x592ede=_0xe99c[_0x1c8ff7];return _0x592ede;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var moment=require(_0xce99('0x1'));var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require(_0xce99('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xce99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3755dd,_0x380c7c,_0x1e4c4e){return new BPromise(function(_0x732cca,_0x39df1c){return client[_0xce99('0x9')](_0x3755dd,_0x1e4c4e)[_0xce99('0xa')](function(_0x48aa48){logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));logger['debug'](_0xce99('0xd'),_0x380c7c,_0xce99('0xc'),JSON[_0xce99('0xe')](_0x48aa48));if(_0x48aa48['error']){if(_0x48aa48[_0xce99('0xf')]['code']===0x1f4){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x48aa48['error']['message']);return _0x39df1c(_0x48aa48[_0xce99('0xf')][_0xce99('0x10')]);}logger[_0xce99('0xf')]('License,\x20%s,\x20%s',_0x380c7c,_0x48aa48['error'][_0xce99('0x10')]);return _0x732cca(_0x48aa48['error'][_0xce99('0x10')]);}else{logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));_0x732cca(_0x48aa48[_0xce99('0x11')]['message']);}})['catch'](function(_0x967d3d){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x967d3d);_0x39df1c(_0x967d3d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7bd5ca1..9cd7cc5 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 _0x2da1=['get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./mailAccount.controller'];(function(_0x251b81,_0x32e8d5){var _0xf320a1=function(_0x3b3071){while(--_0x3b3071){_0x251b81['push'](_0x251b81['shift']());}};_0xf320a1(++_0x32e8d5);}(_0x2da1,0x8a));var _0x12da=function(_0x30c92b,_0x154324){_0x30c92b=_0x30c92b-0x0;var _0x33837b=_0x2da1[_0x30c92b];return _0x33837b;};'use strict';var multer=require(_0x12da('0x0'));var util=require(_0x12da('0x1'));var path=require(_0x12da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x12da('0x3'));var interaction=require(_0x12da('0x4'));var config=require('../../config/environment');var controller=require(_0x12da('0x5'));router[_0x12da('0x6')]('/',auth['isAuthenticated'](),controller[_0x12da('0x7')]);router[_0x12da('0x6')](_0x12da('0x8'),auth[_0x12da('0x9')](),controller[_0x12da('0xa')]);router[_0x12da('0x6')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['show']);router[_0x12da('0x6')](_0x12da('0xc'),auth[_0x12da('0x9')](),controller[_0x12da('0xd')]);router['get'](_0x12da('0xe'),auth[_0x12da('0x9')](),controller[_0x12da('0xf')]);router[_0x12da('0x6')](_0x12da('0x10'),auth[_0x12da('0x9')](),controller[_0x12da('0x11')]);router['get'](_0x12da('0x12'),auth[_0x12da('0x9')](),controller['getSmtp']);router[_0x12da('0x6')](_0x12da('0x13'),auth[_0x12da('0x9')](),controller[_0x12da('0x14')]);router[_0x12da('0x6')]('/:id/applications',auth[_0x12da('0x9')](),controller[_0x12da('0x15')]);router[_0x12da('0x6')](_0x12da('0x16'),auth[_0x12da('0x9')](),controller[_0x12da('0x17')]);router[_0x12da('0x6')](_0x12da('0x18'),auth['isAuthenticated'](),controller[_0x12da('0x19')]);router[_0x12da('0x6')]('/:id/users',auth[_0x12da('0x9')](),controller[_0x12da('0x1a')]);router[_0x12da('0x1b')](_0x12da('0xc'),auth['isAuthenticated'](),controller[_0x12da('0x1c')]);router[_0x12da('0x1b')](_0x12da('0xe'),auth[_0x12da('0x9')](),controller[_0x12da('0x1d')]);router[_0x12da('0x1b')]('/',auth[_0x12da('0x9')](),controller[_0x12da('0x1e')]);router[_0x12da('0x1b')](_0x12da('0x10'),auth[_0x12da('0x9')](),controller[_0x12da('0x1f')]);router['post'](_0x12da('0x12'),auth[_0x12da('0x9')](),controller[_0x12da('0x20')]);router[_0x12da('0x1b')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x12da('0x21')]);router['post'](_0x12da('0x22'),auth['isAuthenticated'](),controller[_0x12da('0x23')]);router[_0x12da('0x1b')](_0x12da('0x24'),auth[_0x12da('0x9')](),controller[_0x12da('0x25')]);router[_0x12da('0x1b')](_0x12da('0x26'),auth[_0x12da('0x9')](),controller[_0x12da('0x27')]);router['put'](_0x12da('0xb'),auth['isAuthenticated'](),controller[_0x12da('0x28')]);router[_0x12da('0x29')](_0x12da('0xc'),auth[_0x12da('0x9')](),controller[_0x12da('0x2a')]);router[_0x12da('0x29')](_0x12da('0xe'),auth[_0x12da('0x9')](),controller[_0x12da('0x2b')]);router[_0x12da('0x29')](_0x12da('0x10'),auth[_0x12da('0x9')](),controller[_0x12da('0x2c')]);router[_0x12da('0x29')](_0x12da('0x12'),auth['isAuthenticated'](),controller[_0x12da('0x2d')]);router[_0x12da('0x29')](_0x12da('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x12da('0x29')]('/:id/users',auth[_0x12da('0x9')](),controller[_0x12da('0x2e')]);module[_0x12da('0x2f')]=router; \ No newline at end of file +var _0xa900=['post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','/:id/interactions','addInteraction','/:id/send','addAgents','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','connect-timeout','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users'];(function(_0x3b147b,_0x46faa9){var _0x1ec5e0=function(_0x5e08c8){while(--_0x5e08c8){_0x3b147b['push'](_0x3b147b['shift']());}};_0x1ec5e0(++_0x46faa9);}(_0xa900,0x9c));var _0x0a90=function(_0x57b90a,_0x246933){_0x57b90a=_0x57b90a-0x0;var _0x9b9abd=_0xa900[_0x57b90a];return _0x9b9abd;};'use strict';var multer=require(_0x0a90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a90('0x1'));var express=require('express');var router=express[_0x0a90('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a90('0x3'));var config=require('../../config/environment');var controller=require(_0x0a90('0x4'));router[_0x0a90('0x5')]('/',auth[_0x0a90('0x6')](),controller[_0x0a90('0x7')]);router['get'](_0x0a90('0x8'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x9')]);router['get'](_0x0a90('0xa'),auth['isAuthenticated'](),controller[_0x0a90('0xb')]);router[_0x0a90('0x5')]('/:id/dispositions',auth[_0x0a90('0x6')](),controller[_0x0a90('0xc')]);router[_0x0a90('0x5')](_0x0a90('0xd'),auth['isAuthenticated'](),controller[_0x0a90('0xe')]);router[_0x0a90('0x5')]('/:id/in_servers',auth[_0x0a90('0x6')](),controller[_0x0a90('0xf')]);router[_0x0a90('0x5')](_0x0a90('0x10'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x11')]);router['get']('/:id/interactions',auth[_0x0a90('0x6')](),controller[_0x0a90('0x12')]);router['get'](_0x0a90('0x13'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x14')]);router['get'](_0x0a90('0x15'),auth[_0x0a90('0x6')](),controller['getMessages']);router[_0x0a90('0x5')](_0x0a90('0x16'),auth[_0x0a90('0x6')](),controller['verifySmtp']);router[_0x0a90('0x5')](_0x0a90('0x17'),auth[_0x0a90('0x6')](),controller['getAgents']);router[_0x0a90('0x18')]('/:id/dispositions',auth[_0x0a90('0x6')](),controller[_0x0a90('0x19')]);router[_0x0a90('0x18')](_0x0a90('0xd'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x1a')]);router[_0x0a90('0x18')]('/',auth['isAuthenticated'](),controller[_0x0a90('0x1b')]);router[_0x0a90('0x18')](_0x0a90('0x1c'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x1d')]);router[_0x0a90('0x18')](_0x0a90('0x10'),auth['isAuthenticated'](),controller[_0x0a90('0x1e')]);router['post'](_0x0a90('0x1f'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x20')]);router[_0x0a90('0x18')](_0x0a90('0x13'),auth[_0x0a90('0x6')](),controller['addApplications']);router[_0x0a90('0x18')](_0x0a90('0x21'),auth[_0x0a90('0x6')](),controller['send']);router[_0x0a90('0x18')](_0x0a90('0x17'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x22')]);router[_0x0a90('0x23')](_0x0a90('0xa'),auth['isAuthenticated'](),controller[_0x0a90('0x24')]);router[_0x0a90('0x25')](_0x0a90('0x26'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x27')]);router[_0x0a90('0x25')](_0x0a90('0xd'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x28')]);router[_0x0a90('0x25')](_0x0a90('0x1c'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x29')]);router[_0x0a90('0x25')](_0x0a90('0x10'),auth[_0x0a90('0x6')](),controller['removeSmtp']);router[_0x0a90('0x25')](_0x0a90('0xa'),auth['isAuthenticated'](),controller[_0x0a90('0x2a')]);router[_0x0a90('0x25')](_0x0a90('0x17'),auth[_0x0a90('0x6')](),controller[_0x0a90('0x2b')]);module[_0x0a90('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a6d0507..dc1761d 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 _0x63f7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x63f7,0x153));var _0x763f=function(_0x429d68,_0x1aa5a2){_0x429d68=_0x429d68-0x0;var _0x172ef0=_0x63f7[_0x429d68];return _0x172ef0;};'use strict';var Sequelize=require(_0x763f('0x0'));module[_0x763f('0x1')]={'description':{'type':Sequelize[_0x763f('0x2')]},'name':{'type':Sequelize[_0x763f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x763f('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x763f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x763f('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x763f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x763f('0x2')],'allowNull':![],'defaultValue':_0x763f('0x4')},'fontSize':{'type':Sequelize[_0x763f('0x5')](0x2)[_0x763f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x763f('0x7')],'defaultValue':function(){return _0x763f('0x8');}},'notificationSound':{'type':Sequelize[_0x763f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x763f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x763f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x763f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x763f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x763f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x763f('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x763f('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x763f('0xa'),'set':function(_0x12223d){if(!_0x12223d)this[_0x763f('0xb')](_0x763f('0xc'),null);this[_0x763f('0xb')](_0x763f('0xd'),_0x12223d);}}}; \ No newline at end of file +var _0xa782=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','UNSIGNED'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0xa782,0x166));var _0x2a78=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa782[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x2a78('0x0'));module[_0x2a78('0x1')]={'description':{'type':Sequelize[_0x2a78('0x2')]},'name':{'type':Sequelize[_0x2a78('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2a78('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2a78('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2a78('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2a78('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2a78('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x2a78('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2a78('0x4')],'defaultValue':function(){return _0x2a78('0x6');}},'notificationSound':{'type':Sequelize[_0x2a78('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2a78('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2a78('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a78('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2a78('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2a78('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2a78('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2a78('0x9'),'set':function(_0xa2dfb4){if(!_0xa2dfb4)this[_0x2a78('0xa')](_0x2a78('0xb'),null);this['setDataValue'](_0x2a78('0xc'),_0xa2dfb4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0504ba8..01b9698 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 _0x6c76=['join','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','Contacts','defaults','messageId','subject','attach','out','Interaction','VerifySmtp','verifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','test','ValidationError','request','then','request\x20sent','debug','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','MailServerIn','rawAttributes','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','Imap','user','cuser','cpassword','authentication','host','port','service','password','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmList','updatedAt','DESC','from','format','%s\x20<%s>','attachments'];(function(_0x21c69c,_0x1b7535){var _0x2acd03=function(_0x4c70f0){while(--_0x4c70f0){_0x21c69c['push'](_0x21c69c['shift']());}};_0x2acd03(++_0x1b7535);}(_0x6c76,0xdc));var _0x66c7=function(_0x5c7107,_0x3c9e3a){_0x5c7107=_0x5c7107-0x0;var _0x52d2cb=_0x6c76[_0x5c7107];return _0x52d2cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x66c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66c7('0x1'));var jsonpatch=require(_0x66c7('0x2'));var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require(_0x66c7('0x5'));var Mustache=require(_0x66c7('0x6'));var util=require(_0x66c7('0x7'));var path=require(_0x66c7('0x8'));var sox=require(_0x66c7('0x9'));var csv=require(_0x66c7('0xa'));var ejs=require(_0x66c7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66c7('0xc'));var crypto=require(_0x66c7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66c7('0xe'));var Papa=require(_0x66c7('0xf'));var Redis=require(_0x66c7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x66c7('0x11'));var as=require(_0x66c7('0x12'));var hardwareService=require(_0x66c7('0x13'));var logger=require(_0x66c7('0x14'))(_0x66c7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x66c7('0x16'))['db'];config[_0x66c7('0x17')]=_['defaults'](config['redis'],{'host':_0x66c7('0x18'),'port':0x18eb});var socket=require(_0x66c7('0x19'))(new Redis(config[_0x66c7('0x17')]));require(_0x66c7('0x1a'))['register'](socket);var jayson=require(_0x66c7('0x1b'));var client=jayson[_0x66c7('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0x11dcba,_0x299b70,_0x4dd26f){if(_0x4dd26f){var _0x2066fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2066fe[_0x66c7('0x1d')](_0x299b70)){return _0x11dcba;}else{throw new db['Sequelize'][(_0x66c7('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 _0x11dcba;}}function respondWithRpcPromise(_0x12eec2,_0xfb45db,_0x544b3c,_0x5085d7){return new BPromise(function(_0x5e576e,_0x70e868){var _0x27bc78=_0x5085d7||client;return _0x27bc78[_0x66c7('0x1f')](_0x12eec2,_0x544b3c)[_0x66c7('0x20')](function(_0x39754b){logger['info']('MailAccount,\x20%s,\x20%s',_0xfb45db,_0x66c7('0x21'));logger[_0x66c7('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xfb45db,_0x66c7('0x21'),JSON['stringify'](_0x39754b));if(_0x39754b['error']){if(_0x39754b[_0x66c7('0x23')][_0x66c7('0x24')]===0x1f4){logger['error'](_0x66c7('0x25'),_0xfb45db,_0x39754b[_0x66c7('0x23')][_0x66c7('0x26')]);return _0x70e868(_0x39754b[_0x66c7('0x23')][_0x66c7('0x26')]);}logger[_0x66c7('0x23')](_0x66c7('0x25'),_0xfb45db,_0x39754b[_0x66c7('0x23')][_0x66c7('0x26')]);return _0x5e576e(_0x39754b['error'][_0x66c7('0x26')]);}else{logger[_0x66c7('0x27')](_0x66c7('0x25'),_0xfb45db,'request\x20sent');_0x5e576e(_0x39754b[_0x66c7('0x28')]['message']);}})[_0x66c7('0x29')](function(_0x5bc105){logger['error'](_0x66c7('0x25'),_0xfb45db,_0x5bc105);_0x70e868(_0x5bc105);});});}function respondWithStatusCode(_0x27d64a,_0x25c7cc){_0x25c7cc=_0x25c7cc||0xcc;return function(_0x56c524){if(_0x56c524){return _0x27d64a[_0x66c7('0x2a')](_0x25c7cc);}return _0x27d64a['status'](_0x25c7cc)[_0x66c7('0x2b')]();};}function respondWithResult(_0x5d301e,_0x56fe28){_0x56fe28=_0x56fe28||0xc8;return function(_0x24c34f){if(_0x24c34f){return _0x5d301e[_0x66c7('0x2c')](_0x56fe28)[_0x66c7('0x2d')](_0x24c34f);}};}function respondWithFilteredResult(_0x5e6fd9,_0x2bbb78){return function(_0x1316fa){if(_0x1316fa){var _0x1f1b77=_0x1316fa[_0x66c7('0x2e')],_0x59428f=_0x2bbb78[_0x66c7('0x2f')],_0x2aee71=_0x2bbb78[_0x66c7('0x2f')]+_0x2bbb78[_0x66c7('0x30')],_0x28dd3a;if(_0x2aee71>=_0x1f1b77){_0x2aee71=_0x1f1b77;_0x28dd3a=0xc8;}else{_0x28dd3a=0xce;}_0x5e6fd9[_0x66c7('0x2c')](_0x28dd3a);return _0x5e6fd9['set'](_0x66c7('0x31'),_0x59428f+'-'+_0x2aee71+'/'+_0x1f1b77)[_0x66c7('0x2d')](_0x1316fa);}return null;};}function patchUpdates(_0x10366b){return function(_0xd6e545){try{jsonpatch['apply'](_0xd6e545,_0x10366b,!![]);}catch(_0x310d36){return BPromise['reject'](_0x310d36);}return _0xd6e545['save']();};}function saveUpdates(_0x5cc161,_0x2e5383){return function(_0xafc804){if(_0xafc804){return _0xafc804[_0x66c7('0x32')](_0x5cc161)[_0x66c7('0x20')](function(_0x40e09a){return _0x40e09a;});}return null;};}function removeEntity(_0x456013,_0x8e11bc){return function(_0x1cd231){if(_0x1cd231){return _0x1cd231[_0x66c7('0x33')]()[_0x66c7('0x20')](function(){var _0x276a78=_0x1cd231[_0x66c7('0x34')]({'plain':!![]});var _0x54bb5a=_0x66c7('0x35');return db[_0x66c7('0x36')]['destroy']({'where':{'type':_0x54bb5a,'resourceId':_0x276a78['id']}})['then'](function(){return _0x1cd231;});})[_0x66c7('0x20')](function(){_0x456013[_0x66c7('0x2c')](0xcc)[_0x66c7('0x2b')]();});}};}function handleEntityNotFound(_0x2f2cf4,_0x2d5e35){return function(_0x15a1d0){if(!_0x15a1d0){_0x2f2cf4[_0x66c7('0x2a')](0x194);}return _0x15a1d0;};}function handleError(_0xef9031,_0x25f614){_0x25f614=_0x25f614||0x1f4;return function(_0xbfa043){logger[_0x66c7('0x23')](_0xbfa043[_0x66c7('0x37')]);if(_0xbfa043[_0x66c7('0x38')]){delete _0xbfa043['name'];}_0xef9031['status'](_0x25f614)[_0x66c7('0x39')](_0xbfa043);};}exports[_0x66c7('0x3a')]=function(_0x4daaca,_0x423c95){var _0x307833={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x66c7('0x3b')],'as':_0x66c7('0x3c')},{'model':db[_0x66c7('0x3d')],'as':_0x66c7('0x3e')}]},_0x19a773={},_0x1e4da2={'count':0x0,'rows':[]};var _0x264a07=_['map'](db[_0x66c7('0x3f')]['rawAttributes'],function(_0x394415){return{'name':_0x394415['fieldName'],'type':_0x394415[_0x66c7('0x40')][_0x66c7('0x41')]};});_0x19a773[_0x66c7('0x42')]=_[_0x66c7('0x43')](_0x264a07,_0x66c7('0x38'));_0x19a773['query']=_[_0x66c7('0x44')](_0x4daaca[_0x66c7('0x45')]);_0x19a773[_0x66c7('0x46')]=_[_0x66c7('0x47')](_0x19a773['model'],_0x19a773[_0x66c7('0x45')]);_0x307833['attributes']=_['intersection'](_0x19a773[_0x66c7('0x42')],qs[_0x66c7('0x48')](_0x4daaca['query'][_0x66c7('0x48')]));_0x307833['attributes']=_0x307833['attributes'][_0x66c7('0x49')]?_0x307833[_0x66c7('0x4a')]:_0x19a773[_0x66c7('0x42')];if(!_0x4daaca[_0x66c7('0x45')][_0x66c7('0x4b')](_0x66c7('0x4c'))){_0x307833[_0x66c7('0x30')]=qs[_0x66c7('0x30')](_0x4daaca[_0x66c7('0x45')][_0x66c7('0x30')]);_0x307833[_0x66c7('0x2f')]=qs[_0x66c7('0x2f')](_0x4daaca[_0x66c7('0x45')][_0x66c7('0x2f')]);}_0x307833[_0x66c7('0x4d')]=qs[_0x66c7('0x4e')](_0x4daaca[_0x66c7('0x45')][_0x66c7('0x4e')]);_0x307833['where']=qs[_0x66c7('0x46')](_[_0x66c7('0x4f')](_0x4daaca[_0x66c7('0x45')],_0x19a773['filters']),_0x264a07);if(_0x4daaca[_0x66c7('0x45')]['filter']){_0x307833[_0x66c7('0x50')]=_[_0x66c7('0x51')](_0x307833['where'],{'$or':_[_0x66c7('0x43')](_0x264a07,function(_0x2f2e4f){if(_0x2f2e4f[_0x66c7('0x40')]!==_0x66c7('0x52')){var _0x59fe91={};_0x59fe91[_0x2f2e4f[_0x66c7('0x38')]]={'$like':'%'+_0x4daaca['query'][_0x66c7('0x53')]+'%'};return _0x59fe91;}})});}_0x307833=_[_0x66c7('0x51')]({},_0x307833,_0x4daaca[_0x66c7('0x54')]);var _0x1c5b9d={'where':_0x307833[_0x66c7('0x50')]};return db['MailAccount'][_0x66c7('0x2e')](_0x1c5b9d)['then'](function(_0x11604b){_0x1e4da2[_0x66c7('0x2e')]=_0x11604b;if(_0x4daaca['query'][_0x66c7('0x55')]){_0x307833[_0x66c7('0x56')]=[{'all':!![]}];}return db['MailAccount'][_0x66c7('0x57')](_0x307833);})[_0x66c7('0x20')](function(_0x30543d){_0x1e4da2[_0x66c7('0x58')]=_0x30543d;return _0x1e4da2;})[_0x66c7('0x20')](respondWithFilteredResult(_0x423c95,_0x307833))[_0x66c7('0x29')](handleError(_0x423c95,null));};exports['show']=function(_0x525d8e,_0x2feff7){var _0x4a02f9={'raw':![],'where':{'id':_0x525d8e[_0x66c7('0x59')]['id']},'include':[{'model':db[_0x66c7('0x5a')],'as':'Imap'},{'model':db[_0x66c7('0x3b')],'as':_0x66c7('0x3c')},{'model':db[_0x66c7('0x3d')],'as':_0x66c7('0x3e')}]},_0x26cc0e={};_0x26cc0e[_0x66c7('0x42')]=_[_0x66c7('0x44')](db[_0x66c7('0x3f')][_0x66c7('0x5b')]);_0x26cc0e[_0x66c7('0x45')]=_[_0x66c7('0x44')](_0x525d8e[_0x66c7('0x45')]);_0x26cc0e[_0x66c7('0x46')]=_[_0x66c7('0x47')](_0x26cc0e[_0x66c7('0x42')],_0x26cc0e[_0x66c7('0x45')]);_0x4a02f9[_0x66c7('0x4a')]=_['intersection'](_0x26cc0e['model'],qs[_0x66c7('0x48')](_0x525d8e[_0x66c7('0x45')][_0x66c7('0x48')]));_0x4a02f9[_0x66c7('0x4a')]=_0x4a02f9[_0x66c7('0x4a')][_0x66c7('0x49')]?_0x4a02f9['attributes']:_0x26cc0e[_0x66c7('0x42')];if(_0x525d8e['query'][_0x66c7('0x55')]){_0x4a02f9[_0x66c7('0x56')]=[{'all':!![]}];}_0x4a02f9=_['merge']({},_0x4a02f9,_0x525d8e[_0x66c7('0x54')]);return db[_0x66c7('0x3f')][_0x66c7('0x5c')](_0x4a02f9)['then'](handleEntityNotFound(_0x2feff7,null))[_0x66c7('0x20')](respondWithResult(_0x2feff7,null))[_0x66c7('0x29')](handleError(_0x2feff7,null));};exports[_0x66c7('0x32')]=function(_0x3d2c65,_0x58104f){if(_0x3d2c65[_0x66c7('0x5d')]['id']){delete _0x3d2c65['body']['id'];}return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x3d2c65[_0x66c7('0x59')]['id']},'include':[{'model':db[_0x66c7('0x5a')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x66c7('0x3c')},{'model':db[_0x66c7('0x3d')],'as':_0x66c7('0x3e')}]})['then'](handleEntityNotFound(_0x58104f,null))[_0x66c7('0x20')](saveUpdates(_0x3d2c65[_0x66c7('0x5d')],null))[_0x66c7('0x20')](function(_0x22717d){if(_0x22717d&&_0x3d2c65[_0x66c7('0x5d')]['Imap']){return db[_0x66c7('0x5a')][_0x66c7('0x32')](_0x3d2c65[_0x66c7('0x5d')]['Imap'],{'where':{'MailAccountId':_0x22717d['id']}})[_0x66c7('0x20')](function(){return _0x22717d;});}return _0x22717d;})[_0x66c7('0x20')](function(_0x565caa){if(_0x565caa&&_0x3d2c65[_0x66c7('0x5d')][_0x66c7('0x3c')]){return db['MailServerOut'][_0x66c7('0x32')](_0x3d2c65['body'][_0x66c7('0x3c')],{'where':{'MailAccountId':_0x565caa['id']}})[_0x66c7('0x20')](function(){return _0x565caa;});}return _0x565caa;})[_0x66c7('0x20')](respondWithResult(_0x58104f,null))[_0x66c7('0x29')](handleError(_0x58104f,null));};exports[_0x66c7('0x5e')]=function(_0x3025ec,_0x6f3de2){return db[_0x66c7('0x3f')][_0x66c7('0x5e')]()['then'](respondWithResult(_0x6f3de2,null))[_0x66c7('0x29')](handleError(_0x6f3de2,null));};exports[_0x66c7('0x5f')]=function(_0x16b534,_0x152eca,_0x4e602d){if(_0x16b534[_0x66c7('0x5d')]['id']){delete _0x16b534['body']['id'];}return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x16b534['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x152eca,null))[_0x66c7('0x20')](function(_0x380071){if(_0x380071){_0x16b534[_0x66c7('0x5d')][_0x66c7('0x60')]=_0x380071['id'];return db[_0x66c7('0x61')][_0x66c7('0x62')](_0x16b534[_0x66c7('0x5d')]);}})[_0x66c7('0x20')](respondWithResult(_0x152eca,null))['catch'](handleError(_0x152eca,null));};exports[_0x66c7('0x63')]=function(_0x4ae689,_0x2b5316,_0x45e01d){var _0x57942b={'raw':![],'where':{}};var _0x59e2c2={};var _0x1bbd21={'count':0x0,'rows':[]};return db['MailAccount'][_0x66c7('0x64')]({'where':{'id':_0x4ae689[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x2b5316,null))['then'](function(_0x3db616){if(_0x3db616){_0x59e2c2[_0x66c7('0x42')]=_[_0x66c7('0x44')](db[_0x66c7('0x61')][_0x66c7('0x5b')]);_0x59e2c2['query']=_[_0x66c7('0x44')](_0x4ae689[_0x66c7('0x45')]);_0x59e2c2[_0x66c7('0x46')]=_[_0x66c7('0x47')](_0x59e2c2['model'],_0x59e2c2['query']);_0x57942b[_0x66c7('0x4a')]=_[_0x66c7('0x47')](_0x59e2c2[_0x66c7('0x42')],qs[_0x66c7('0x48')](_0x4ae689[_0x66c7('0x45')][_0x66c7('0x48')]));_0x57942b[_0x66c7('0x4a')]=_0x57942b[_0x66c7('0x4a')]['length']?_0x57942b[_0x66c7('0x4a')]:_0x59e2c2['model'];if(!_0x4ae689[_0x66c7('0x45')]['hasOwnProperty']('nolimit')){_0x57942b[_0x66c7('0x30')]=qs[_0x66c7('0x30')](_0x4ae689[_0x66c7('0x45')][_0x66c7('0x30')]);_0x57942b[_0x66c7('0x2f')]=qs[_0x66c7('0x2f')](_0x4ae689['query'][_0x66c7('0x2f')]);}_0x57942b[_0x66c7('0x4d')]=qs[_0x66c7('0x4e')](_0x4ae689[_0x66c7('0x45')][_0x66c7('0x4e')]);_0x57942b[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_[_0x66c7('0x4f')](_0x4ae689['query'],_0x59e2c2['filters']));_0x57942b[_0x66c7('0x50')][_0x66c7('0x60')]=_0x3db616['id'];if(_0x4ae689[_0x66c7('0x45')][_0x66c7('0x53')]){_0x57942b[_0x66c7('0x50')]=_[_0x66c7('0x51')](_0x57942b[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x57942b[_0x66c7('0x4a')],function(_0x56a29e){var _0x14549b={};_0x14549b[_0x56a29e]={'$like':'%'+_0x4ae689[_0x66c7('0x45')]['filter']+'%'};return _0x14549b;})});}_0x57942b=_[_0x66c7('0x51')]({},_0x57942b,_0x4ae689[_0x66c7('0x54')]);return db[_0x66c7('0x61')]['count']({'where':_0x57942b[_0x66c7('0x50')]})[_0x66c7('0x20')](function(_0x55ecae){_0x1bbd21[_0x66c7('0x2e')]=_0x55ecae;if(_0x4ae689[_0x66c7('0x45')][_0x66c7('0x55')]){_0x57942b[_0x66c7('0x56')]=[{'all':!![]}];}return db[_0x66c7('0x61')][_0x66c7('0x57')](_0x57942b);})[_0x66c7('0x20')](function(_0x52bc3){_0x1bbd21[_0x66c7('0x58')]=_0x52bc3;return _0x1bbd21;});}})[_0x66c7('0x20')](respondWithFilteredResult(_0x2b5316,_0x57942b))[_0x66c7('0x29')](handleError(_0x2b5316,null));};exports[_0x66c7('0x65')]=function(_0x432f28,_0xd688ad,_0x3c399c){return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x432f28[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0xd688ad,null))[_0x66c7('0x20')](function(_0x183d97){if(_0x183d97){return _0x183d97[_0x66c7('0x65')](_0x432f28['query'][_0x66c7('0x66')]);}})[_0x66c7('0x20')](respondWithStatusCode(_0xd688ad,null))[_0x66c7('0x29')](handleError(_0xd688ad,null));};exports['addAnswer']=function(_0x25a4bb,_0x2a1c7d,_0x104d53){if(_0x25a4bb[_0x66c7('0x5d')]['id']){delete _0x25a4bb[_0x66c7('0x5d')]['id'];}return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x25a4bb[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x2a1c7d,null))[_0x66c7('0x20')](function(_0x293fd4){if(_0x293fd4){_0x25a4bb[_0x66c7('0x5d')][_0x66c7('0x60')]=_0x293fd4['id'];return db[_0x66c7('0x67')][_0x66c7('0x62')](_0x25a4bb[_0x66c7('0x5d')]);}})['then'](respondWithResult(_0x2a1c7d,null))[_0x66c7('0x29')](handleError(_0x2a1c7d,null));};exports[_0x66c7('0x68')]=function(_0x16dc84,_0x5c69c7,_0x30dca5){var _0x3a4260={'raw':![],'where':{}};var _0x3eaf27={};var _0x4512fa={'count':0x0,'rows':[]};return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x16dc84['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x5c69c7,null))[_0x66c7('0x20')](function(_0x54a612){if(_0x54a612){_0x3eaf27[_0x66c7('0x42')]=_[_0x66c7('0x44')](db[_0x66c7('0x67')][_0x66c7('0x5b')]);_0x3eaf27[_0x66c7('0x45')]=_['keys'](_0x16dc84['query']);_0x3eaf27['filters']=_[_0x66c7('0x47')](_0x3eaf27[_0x66c7('0x42')],_0x3eaf27[_0x66c7('0x45')]);_0x3a4260[_0x66c7('0x4a')]=_[_0x66c7('0x47')](_0x3eaf27['model'],qs[_0x66c7('0x48')](_0x16dc84['query'][_0x66c7('0x48')]));_0x3a4260[_0x66c7('0x4a')]=_0x3a4260[_0x66c7('0x4a')][_0x66c7('0x49')]?_0x3a4260[_0x66c7('0x4a')]:_0x3eaf27[_0x66c7('0x42')];if(!_0x16dc84['query'][_0x66c7('0x4b')](_0x66c7('0x4c'))){_0x3a4260[_0x66c7('0x30')]=qs['limit'](_0x16dc84[_0x66c7('0x45')][_0x66c7('0x30')]);_0x3a4260[_0x66c7('0x2f')]=qs[_0x66c7('0x2f')](_0x16dc84['query'][_0x66c7('0x2f')]);}_0x3a4260[_0x66c7('0x4d')]=qs[_0x66c7('0x4e')](_0x16dc84[_0x66c7('0x45')]['sort']);_0x3a4260[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_['pick'](_0x16dc84[_0x66c7('0x45')],_0x3eaf27['filters']));_0x3a4260[_0x66c7('0x50')][_0x66c7('0x60')]=_0x54a612['id'];if(_0x16dc84[_0x66c7('0x45')]['filter']){_0x3a4260['where']=_['merge'](_0x3a4260[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x3a4260[_0x66c7('0x4a')],function(_0x44d576){var _0x351f0f={};_0x351f0f[_0x44d576]={'$like':'%'+_0x16dc84['query'][_0x66c7('0x53')]+'%'};return _0x351f0f;})});}_0x3a4260=_[_0x66c7('0x51')]({},_0x3a4260,_0x16dc84[_0x66c7('0x54')]);return db['CannedAnswer'][_0x66c7('0x2e')]({'where':_0x3a4260[_0x66c7('0x50')]})[_0x66c7('0x20')](function(_0x2306f5){_0x4512fa[_0x66c7('0x2e')]=_0x2306f5;if(_0x16dc84[_0x66c7('0x45')][_0x66c7('0x55')]){_0x3a4260[_0x66c7('0x56')]=[{'all':!![]}];}return db[_0x66c7('0x67')][_0x66c7('0x57')](_0x3a4260);})[_0x66c7('0x20')](function(_0x489b42){_0x4512fa['rows']=_0x489b42;return _0x4512fa;});}})[_0x66c7('0x20')](respondWithFilteredResult(_0x5c69c7,_0x3a4260))[_0x66c7('0x29')](handleError(_0x5c69c7,null));};exports[_0x66c7('0x69')]=function(_0x2b1171,_0x34b13c,_0x485d47){return db[_0x66c7('0x3f')]['find']({'where':{'id':_0x2b1171[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x34b13c,null))[_0x66c7('0x20')](function(_0x55a623){if(_0x55a623){return _0x55a623[_0x66c7('0x69')](_0x2b1171[_0x66c7('0x45')][_0x66c7('0x66')]);}})['then'](respondWithStatusCode(_0x34b13c,null))[_0x66c7('0x29')](handleError(_0x34b13c,null));};exports[_0x66c7('0x62')]=function(_0x31e434,_0x332ff3){var _0x16062e={'name':_0x31e434[_0x66c7('0x5d')][_0x66c7('0x38')],'key':_0x31e434[_0x66c7('0x5d')]['key'],'email':_0x31e434[_0x66c7('0x5d')][_0x66c7('0x6a')],'ListId':_0x31e434[_0x66c7('0x5d')][_0x66c7('0x6b')],'active':!_[_0x66c7('0x6c')](_0x31e434['body'][_0x66c7('0x6d')])?_0x31e434['body'][_0x66c7('0x6d')]:!![],'description':_0x31e434[_0x66c7('0x5d')][_0x66c7('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0x66c7('0x6c')](_0x31e434[_0x66c7('0x5d')][_0x66c7('0x6f')])){if(_0x31e434[_0x66c7('0x5d')][_0x66c7('0x70')]){_0x16062e[_0x66c7('0x71')]['user']=_0x16062e['Smtp'][_0x66c7('0x72')]=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x73')];_0x16062e[_0x66c7('0x71')]['password']=_0x16062e[_0x66c7('0x3c')]['pass']=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x74')];}else{_0x16062e[_0x66c7('0x71')][_0x66c7('0x75')]=_0x16062e[_0x66c7('0x3c')]['authentication']=![];}_0x16062e[_0x66c7('0x71')][_0x66c7('0x76')]=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x71')]['host'];_0x16062e['Imap']['port']=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x71')][_0x66c7('0x77')];_0x16062e['Smtp'][_0x66c7('0x76')]=_0x31e434[_0x66c7('0x5d')]['Smtp'][_0x66c7('0x76')];_0x16062e[_0x66c7('0x3c')][_0x66c7('0x77')]=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x3c')][_0x66c7('0x77')];}else{_0x16062e[_0x66c7('0x71')][_0x66c7('0x78')]=_0x16062e[_0x66c7('0x3c')][_0x66c7('0x78')]=_0x31e434['body'][_0x66c7('0x6f')];_0x16062e[_0x66c7('0x71')][_0x66c7('0x72')]=_0x16062e[_0x66c7('0x3c')][_0x66c7('0x72')]=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x73')];_0x16062e[_0x66c7('0x71')][_0x66c7('0x79')]=_0x16062e[_0x66c7('0x3c')][_0x66c7('0x7a')]=_0x31e434[_0x66c7('0x5d')][_0x66c7('0x74')];}return db[_0x66c7('0x3f')][_0x66c7('0x62')](_0x16062e,{'include':[{'model':db[_0x66c7('0x3b')],'as':_0x66c7('0x3c')},{'model':db[_0x66c7('0x5a')],'as':_0x66c7('0x71')}]})['then'](function(_0x57d68f){var _0x15743e=_0x31e434['user'][_0x66c7('0x34')]({'plain':!![]});if(!_0x15743e)throw new Error(_0x66c7('0x7b'));if(_0x15743e[_0x66c7('0x7c')]==='user'){var _0x235f27=_0x57d68f[_0x66c7('0x34')]({'plain':!![]});return db[_0x66c7('0x7d')]['find']({'where':{'name':_0x66c7('0x35'),'userProfileId':_0x15743e[_0x66c7('0x7e')]},'raw':!![]})[_0x66c7('0x20')](function(_0x188462){if(_0x188462&&_0x188462[_0x66c7('0x7f')]===0x0){return db[_0x66c7('0x36')][_0x66c7('0x62')]({'name':_0x235f27['name'],'resourceId':_0x235f27['id'],'type':_0x188462[_0x66c7('0x38')],'sectionId':_0x188462['id']},{})[_0x66c7('0x20')](function(){return _0x57d68f;});}else{return _0x57d68f;}})[_0x66c7('0x29')](function(_0x75ced5){logger['error'](_0x66c7('0x80'),_0x75ced5);throw _0x75ced5;});}return _0x57d68f;})[_0x66c7('0x20')](respondWithResult(_0x332ff3,0xc9))[_0x66c7('0x29')](handleError(_0x332ff3,null));};exports[_0x66c7('0x81')]=function(_0x1b69cc,_0x482194,_0x9d1a37){return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x1b69cc[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x482194,null))['then'](function(_0x9bc3e6){if(_0x9bc3e6){return _0x9bc3e6[_0x66c7('0x81')]();}return null;})['then'](respondWithResult(_0x482194,null))[_0x66c7('0x29')](handleError(_0x482194,null));};exports[_0x66c7('0x82')]=function(_0x14cc9f,_0x155959,_0x4df21b){if(_0x14cc9f[_0x66c7('0x5d')]['id']){delete _0x14cc9f[_0x66c7('0x5d')]['id'];}return db['MailAccount'][_0x66c7('0x5c')]({'where':{'id':_0x14cc9f['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x155959,null))['then'](function(_0x2e216a){if(_0x2e216a){_0x14cc9f[_0x66c7('0x5d')][_0x66c7('0x60')]=_0x2e216a['id'];return db[_0x66c7('0x5a')][_0x66c7('0x62')](_0x14cc9f[_0x66c7('0x5d')]);}})[_0x66c7('0x20')](respondWithResult(_0x155959,null))[_0x66c7('0x29')](handleError(_0x155959,null));};exports[_0x66c7('0x83')]=function(_0x52cdf8,_0x32e088,_0x2ec7a2){return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x52cdf8[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x32e088,null))[_0x66c7('0x20')](function(_0x47022a){if(_0x47022a){return _0x47022a[_0x66c7('0x84')](null);}return null;})[_0x66c7('0x20')](respondWithStatusCode(_0x32e088,null))[_0x66c7('0x29')](handleError(_0x32e088,null));};exports['getSmtp']=function(_0x225dbb,_0xb4426,_0x402506){return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x225dbb['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0xb4426,null))[_0x66c7('0x20')](function(_0xeeb7d7){if(_0xeeb7d7){return _0xeeb7d7['getSmtp']();}return null;})[_0x66c7('0x20')](respondWithResult(_0xb4426,null))[_0x66c7('0x29')](handleError(_0xb4426,null));};exports[_0x66c7('0x85')]=function(_0x3c6291,_0x56e4e6,_0x3fa960){if(_0x3c6291[_0x66c7('0x5d')]['id']){delete _0x3c6291[_0x66c7('0x5d')]['id'];}return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x3c6291[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x56e4e6,null))[_0x66c7('0x20')](function(_0x35fa22){if(_0x35fa22){_0x3c6291[_0x66c7('0x5d')][_0x66c7('0x60')]=_0x35fa22['id'];return db[_0x66c7('0x3b')]['create'](_0x3c6291[_0x66c7('0x5d')]);}})[_0x66c7('0x20')](respondWithResult(_0x56e4e6,null))[_0x66c7('0x29')](handleError(_0x56e4e6,null));};exports[_0x66c7('0x86')]=function(_0x3d3136,_0x2d5c95,_0x585784){return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x3d3136['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x2d5c95,null))[_0x66c7('0x20')](function(_0x172ac0){if(_0x172ac0){return _0x172ac0[_0x66c7('0x87')](null);}return null;})[_0x66c7('0x20')](respondWithStatusCode(_0x2d5c95,null))[_0x66c7('0x29')](handleError(_0x2d5c95,null));};exports[_0x66c7('0x88')]=function(_0x4afda8,_0x336f41,_0xf0fa31){return db[_0x66c7('0x89')]['find']({'where':{'id':_0x4afda8[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x336f41,null))[_0x66c7('0x20')](function(_0x4cb4c6){if(_0x4cb4c6){return _0x4cb4c6[_0x66c7('0x88')](_0x4afda8['body']['ids'],_[_0x66c7('0x8a')](_0x4afda8[_0x66c7('0x5d')],[_0x66c7('0x66'),'id'])||{});}})[_0x66c7('0x20')](respondWithResult(_0x336f41,null))['catch'](handleError(_0x336f41,null));};exports[_0x66c7('0x8b')]=function(_0x1a21af,_0x20bb83,_0x2d8487){var _0x1596fa={'raw':![],'where':{}};var _0x5513d9={};var _0x3d9292={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1a21af[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x20bb83,null))[_0x66c7('0x20')](function(_0xbfa8e){if(_0xbfa8e){_0x5513d9[_0x66c7('0x42')]=_['keys'](db[_0x66c7('0x89')][_0x66c7('0x5b')]);_0x5513d9[_0x66c7('0x45')]=_[_0x66c7('0x44')](_0x1a21af['query']);_0x5513d9[_0x66c7('0x46')]=_['intersection'](_0x5513d9[_0x66c7('0x42')],_0x5513d9['query']);_0x1596fa[_0x66c7('0x4a')]=_[_0x66c7('0x47')](_0x5513d9[_0x66c7('0x42')],qs[_0x66c7('0x48')](_0x1a21af[_0x66c7('0x45')][_0x66c7('0x48')]));_0x1596fa[_0x66c7('0x4a')]=_0x1596fa[_0x66c7('0x4a')]['length']?_0x1596fa[_0x66c7('0x4a')]:_0x5513d9[_0x66c7('0x42')];if(!_0x1a21af[_0x66c7('0x45')][_0x66c7('0x4b')]('nolimit')){_0x1596fa[_0x66c7('0x30')]=qs[_0x66c7('0x30')](_0x1a21af['query']['limit']);_0x1596fa[_0x66c7('0x2f')]=qs['offset'](_0x1a21af['query'][_0x66c7('0x2f')]);}_0x1596fa['order']=qs['sort'](_0x1a21af['query'][_0x66c7('0x4e')]);_0x1596fa[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_['pick'](_0x1a21af[_0x66c7('0x45')],_0x5513d9[_0x66c7('0x46')]));_0x1596fa[_0x66c7('0x50')]['MailAccountId']=_0xbfa8e['id'];if(_0x1a21af[_0x66c7('0x45')]['filter']){_0x1596fa[_0x66c7('0x50')]=_[_0x66c7('0x51')](_0x1596fa[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x1596fa[_0x66c7('0x4a')],function(_0x5258cf){var _0x427388={};_0x427388[_0x5258cf]={'$like':'%'+_0x1a21af[_0x66c7('0x45')][_0x66c7('0x53')]+'%'};return _0x427388;})});}_0x1596fa=_[_0x66c7('0x51')]({},_0x1596fa,_0x1a21af['options']);return db[_0x66c7('0x89')][_0x66c7('0x2e')]({'where':_0x1596fa[_0x66c7('0x50')]})[_0x66c7('0x20')](function(_0x55ce50){_0x3d9292[_0x66c7('0x2e')]=_0x55ce50;if(_0x1a21af['query']['includeAll']){_0x1596fa[_0x66c7('0x56')]=[{'model':db[_0x66c7('0x8c')],'as':_0x66c7('0x8d'),'required':![]},{'model':db['User'],'as':_0x66c7('0x8e'),'attributes':[_0x66c7('0x38'),_0x66c7('0x8f'),_0x66c7('0x90')],'required':![]},{'model':db['Tag'],'as':_0x66c7('0x91'),'attributes':['id',_0x66c7('0x38'),_0x66c7('0x92')],'where':_0x1a21af[_0x66c7('0x45')]['tag']?{'id':_0x1a21af[_0x66c7('0x45')][_0x66c7('0x93')]}:undefined,'required':_0x1a21af['query'][_0x66c7('0x93')]?!![]:![]}];}return db[_0x66c7('0x89')][_0x66c7('0x57')](_0x1596fa);})[_0x66c7('0x20')](function(_0x1a2ad4){_0x3d9292[_0x66c7('0x58')]=_0x1a2ad4;return _0x3d9292;});}})['then'](respondWithFilteredResult(_0x20bb83,_0x1596fa))[_0x66c7('0x29')](handleError(_0x20bb83,null));};exports[_0x66c7('0x94')]=function(_0x3eac2a,_0x5269e3,_0x16cecc){return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x3eac2a[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x5269e3,null))[_0x66c7('0x20')](function(_0x585044){if(_0x585044){return db[_0x66c7('0x95')][_0x66c7('0x96')](function(_0x1462b8){return db['MailApplication'][_0x66c7('0x33')]({'where':{'MailAccountId':_0x3eac2a['params']['id']},'transaction':_0x1462b8})[_0x66c7('0x20')](function(_0x5474fd){var _0x3a6083=_['map'](_0x3eac2a[_0x66c7('0x5d')],function(_0x409a91){_0x409a91[_0x66c7('0x60')]=_0x3eac2a[_0x66c7('0x59')]['id'];return _0x409a91;});return db[_0x66c7('0x97')][_0x66c7('0x98')](_0x3a6083,{'transaction':_0x1462b8});});})[_0x66c7('0x20')](function(){return db['MailApplication'][_0x66c7('0x99')]({'where':{'MailAccountId':_0x3eac2a[_0x66c7('0x59')]['id']},'order':_0x66c7('0x9a')});});}})[_0x66c7('0x20')](respondWithResult(_0x5269e3,null))[_0x66c7('0x29')](handleError(_0x5269e3,null));};exports[_0x66c7('0x9b')]=function(_0x20241d,_0x36420d,_0x18f5c8){var _0x37ee2b={};var _0x53f321={};var _0x304ade;var _0x47b3a0;return db['MailAccount']['findOne']({'where':{'id':_0x20241d[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x36420d,null))[_0x66c7('0x20')](function(_0xcc9744){if(_0xcc9744){_0x304ade=_0xcc9744;_0x53f321['model']=_['keys'](db[_0x66c7('0x97')]['rawAttributes']);_0x53f321[_0x66c7('0x45')]=_['keys'](_0x20241d[_0x66c7('0x45')]);_0x53f321['filters']=_[_0x66c7('0x47')](_0x53f321[_0x66c7('0x42')],_0x53f321[_0x66c7('0x45')]);_0x37ee2b[_0x66c7('0x4a')]=_['intersection'](_0x53f321[_0x66c7('0x42')],qs['fields'](_0x20241d[_0x66c7('0x45')][_0x66c7('0x48')]));_0x37ee2b[_0x66c7('0x4a')]=_0x37ee2b['attributes']['length']?_0x37ee2b[_0x66c7('0x4a')]:_0x53f321[_0x66c7('0x42')];_0x37ee2b['order']=qs[_0x66c7('0x4e')](_0x20241d['query'][_0x66c7('0x4e')]);_0x37ee2b[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_[_0x66c7('0x4f')](_0x20241d[_0x66c7('0x45')],_0x53f321[_0x66c7('0x46')]));if(_0x20241d[_0x66c7('0x45')][_0x66c7('0x53')]){_0x37ee2b[_0x66c7('0x50')]=_['merge'](_0x37ee2b[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x37ee2b['attributes'],function(_0x54350c){var _0x5c1dd8={};_0x5c1dd8[_0x54350c]={'$like':'%'+_0x20241d[_0x66c7('0x45')]['filter']+'%'};return _0x5c1dd8;})});}_0x37ee2b=_[_0x66c7('0x51')]({},_0x37ee2b,_0x20241d[_0x66c7('0x54')]);return _0x304ade[_0x66c7('0x9b')](_0x37ee2b);}})[_0x66c7('0x20')](function(_0x4ff01b){if(_0x4ff01b){_0x47b3a0=_0x4ff01b[_0x66c7('0x49')];if(!_0x20241d[_0x66c7('0x45')][_0x66c7('0x4b')]('nolimit')){_0x37ee2b[_0x66c7('0x30')]=qs[_0x66c7('0x30')](_0x20241d[_0x66c7('0x45')]['limit']);_0x37ee2b[_0x66c7('0x2f')]=qs[_0x66c7('0x2f')](_0x20241d['query'][_0x66c7('0x2f')]);}return _0x304ade[_0x66c7('0x9b')](_0x37ee2b);}})['then'](function(_0x43f64b){if(_0x43f64b){return _0x43f64b?{'count':_0x47b3a0,'rows':_0x43f64b}:null;}})['then'](respondWithResult(_0x36420d,null))[_0x66c7('0x29')](handleError(_0x36420d,null));};exports[_0x66c7('0x9c')]=function(_0x5be1c2,_0x1a992a,_0x2b0e54){var _0x4ffc5d={'raw':!![],'where':{}};var _0x5c9f5b={};var _0x167d0b={'count':0x0,'rows':[]};return db['MailAccount'][_0x66c7('0x64')]({'where':{'id':_0x5be1c2['params']['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x1a992a,null))['then'](function(_0x52f0af){if(_0x52f0af){_0x5c9f5b[_0x66c7('0x42')]=_[_0x66c7('0x44')](db['MailMessage'][_0x66c7('0x5b')]);_0x5c9f5b['query']=_[_0x66c7('0x44')](_0x5be1c2[_0x66c7('0x45')]);_0x5c9f5b[_0x66c7('0x46')]=_['intersection'](_0x5c9f5b['model'],_0x5c9f5b[_0x66c7('0x45')]);_0x4ffc5d[_0x66c7('0x4a')]=_[_0x66c7('0x47')](_0x5c9f5b['model'],qs['fields'](_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x48')]));_0x4ffc5d[_0x66c7('0x4a')]=_0x4ffc5d['attributes'][_0x66c7('0x49')]?_0x4ffc5d[_0x66c7('0x4a')]:_0x5c9f5b[_0x66c7('0x42')];if(!_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x4b')](_0x66c7('0x4c'))){_0x4ffc5d[_0x66c7('0x30')]=qs['limit'](_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x30')]);_0x4ffc5d['offset']=qs[_0x66c7('0x2f')](_0x5be1c2[_0x66c7('0x45')]['offset']);}_0x4ffc5d[_0x66c7('0x4d')]=qs[_0x66c7('0x4e')](_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x4e')]);_0x4ffc5d[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_[_0x66c7('0x4f')](_0x5be1c2[_0x66c7('0x45')],_0x5c9f5b['filters']));_0x4ffc5d[_0x66c7('0x50')][_0x66c7('0x60')]=_0x52f0af['id'];if(_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x53')]){_0x4ffc5d[_0x66c7('0x50')]=_[_0x66c7('0x51')](_0x4ffc5d[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x4ffc5d[_0x66c7('0x4a')],function(_0x21a119){var _0x4c34ba={};_0x4c34ba[_0x21a119]={'$like':'%'+_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x53')]+'%'};return _0x4c34ba;})});}if(_0x5be1c2['query'][_0x66c7('0x9d')]){var _0x2dcb31=_0x5be1c2[_0x66c7('0x45')]['$gte'][_0x66c7('0x9e')](',');var _0x2b82ef={};_0x2b82ef[_0x2dcb31[0x0]]={'$gte':moment(_0x2dcb31[0x1])['format'](_0x66c7('0x9f'))};_0x4ffc5d['where']=_[_0x66c7('0x51')](_0x4ffc5d[_0x66c7('0x50')],_0x2b82ef);}_0x4ffc5d=_[_0x66c7('0x51')]({},_0x4ffc5d,_0x5be1c2['options']);return db[_0x66c7('0xa0')][_0x66c7('0x2e')]({'where':_0x4ffc5d[_0x66c7('0x50')]})[_0x66c7('0x20')](function(_0x1b6724){_0x167d0b[_0x66c7('0x2e')]=_0x1b6724;if(_0x5be1c2[_0x66c7('0x45')][_0x66c7('0x55')]){_0x4ffc5d[_0x66c7('0x56')]=[{'all':!![]}];}return db['MailMessage'][_0x66c7('0x57')](_0x4ffc5d);})[_0x66c7('0x20')](function(_0x2172e5){_0x167d0b[_0x66c7('0x58')]=_0x2172e5;return _0x167d0b;});}})[_0x66c7('0x20')](respondWithFilteredResult(_0x1a992a,_0x4ffc5d))[_0x66c7('0x29')](handleError(_0x1a992a,null));};exports[_0x66c7('0x39')]=function(_0x263bc6,_0x323e2a,_0x569d58){var _0x5cf474,_0x2c1359={},_0x18758c;if(_0x263bc6['body']['to']){_0x18758c=_0x263bc6[_0x66c7('0x5d')]['to'][_0x66c7('0x9e')](',')[0x0];}return db['MailAccount'][_0x66c7('0x5c')]({'where':{'id':_0x263bc6['params']['id']},'include':[{'model':db[_0x66c7('0xa1')],'as':'List','include':[{'model':db[_0x66c7('0x8c')],'as':'Contacts','where':{'email':_0x18758c},'limit':0x1,'order':[[_0x66c7('0xa2'),_0x66c7('0xa3')]]}]},{'model':db[_0x66c7('0x3b')],'as':_0x66c7('0x3c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x323e2a,null))[_0x66c7('0x20')](function(_0x49b599){if(_0x49b599){_0x5cf474=_0x49b599;if(_0x49b599[_0x66c7('0x3c')]){if(_[_0x66c7('0x6c')](_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xa4')])){_0x263bc6['body'][_0x66c7('0xa4')]=util[_0x66c7('0xa5')](_0x66c7('0xa6'),_0x49b599['name'],_0x49b599[_0x66c7('0x6a')]||_0x49b599['Smtp'][_0x66c7('0x72')]);}if(_0x263bc6[_0x66c7('0x5d')]['attachments']&&_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xa7')][_0x66c7('0x49')]){for(var _0x1e40eb=0x0;_0x1e40eb<_0x263bc6['body']['attachments'][_0x66c7('0x49')];_0x1e40eb+=0x1){_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xa7')][_0x1e40eb]={'filename':_0x263bc6[_0x66c7('0x5d')]['attachments'][_0x1e40eb]['name'],'path':path[_0x66c7('0xa8')](config['root'],'server/files/attachments',_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xa7')][_0x1e40eb][_0x66c7('0xa9')])};}}var _0x468970={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x49b599[_0x66c7('0x3c')]['service'])){if(_0x49b599[_0x66c7('0x3c')][_0x66c7('0x75')]){_0x468970[_0x66c7('0xaa')]={'user':_0x49b599[_0x66c7('0x3c')]['user'],'pass':_0x49b599[_0x66c7('0x3c')][_0x66c7('0x7a')]};}_0x468970[_0x66c7('0x76')]=_0x49b599['Smtp'][_0x66c7('0x76')];_0x468970['port']=_0x49b599[_0x66c7('0x3c')][_0x66c7('0x77')];_0x468970['secure']=_0x49b599['Smtp'][_0x66c7('0xab')];}else{_0x468970['service']=_0x49b599[_0x66c7('0x3c')][_0x66c7('0x78')];_0x468970[_0x66c7('0xaa')]={'user':_0x49b599[_0x66c7('0x3c')][_0x66c7('0x72')],'pass':_0x49b599[_0x66c7('0x3c')]['pass']};}return respondWithRpcPromise(_0x66c7('0xac'),_0x66c7('0xad'),{'account':_0x468970,'message':_0x263bc6[_0x66c7('0x5d')]});}else{throw new Error(_0x66c7('0xae'));}}})[_0x66c7('0x20')](function(_0x4b39b5){if(_0x4b39b5){_0x2c1359=_0x4b39b5;if(_0x5cf474[_0x66c7('0xaf')]){if(_0x5cf474['List'][_0x66c7('0xb0')][_0x66c7('0x49')]){return _0x5cf474[_0x66c7('0xaf')][_0x66c7('0xb0')][0x0];}else{return db[_0x66c7('0x8c')][_0x66c7('0x62')](_[_0x66c7('0xb1')](_0x263bc6[_0x66c7('0x5d')],{'firstName':_0x263bc6[_0x66c7('0x5d')]['to'],'email':_0x263bc6[_0x66c7('0x5d')]['to'],'phone':_0x263bc6[_0x66c7('0x5d')]['to'],'ListId':_0x5cf474['ListId']}));}}else{throw new Error(_0x66c7('0xae'));}}})['then'](function(_0x19a76d){if(_0x19a76d){var _0x22c83a={'UserId':_0x263bc6[_0x66c7('0x72')]['id'],'ContactId':_0x19a76d['id'],'MailAccountId':_0x5cf474['id'],'inReplyTo':_0x2c1359[_0x66c7('0xb2')],'to':_0x263bc6['body'][_0x66c7('0xa4')],'cc':_0x263bc6[_0x66c7('0x5d')]['cc'],'subject':_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xb3')],'attach':_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xb4')],'firstMsgDirection':_0x66c7('0xb5'),'lastMsgAt':moment()[_0x66c7('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x263bc6[_0x66c7('0x5d')][_0x66c7('0x5d')],'Messages':[_[_0x66c7('0x51')](_0x263bc6['body'],{'messageId':_0x2c1359[_0x66c7('0xb2')],'sentAt':moment()[_0x66c7('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5cf474['id'],'UserId':_0x263bc6[_0x66c7('0x72')]['id'],'ContactId':_0x19a76d['id']})]};if(_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xb6')]){_0x22c83a=_[_0x66c7('0x51')](_0x22c83a,_0x263bc6[_0x66c7('0x5d')][_0x66c7('0xb6')]);}return db[_0x66c7('0x89')][_0x66c7('0x62')](_0x22c83a,{'include':[{'model':db[_0x66c7('0xa0')],'as':'Messages'}]});}})['then'](respondWithResult(_0x323e2a,null))['catch'](handleError(_0x323e2a,null));};exports['verifySmtp']=function(_0x58f067,_0xa7b6b7,_0x4e15b8){return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x58f067[_0x66c7('0x59')]['id']},'include':[{'model':db[_0x66c7('0x3b')],'as':'Smtp','raw':!![]}]})[_0x66c7('0x20')](handleEntityNotFound(_0xa7b6b7,null))['then'](function(_0x399998){if(_0x399998&&_0x399998[_0x66c7('0x3c')]){var _0x3a3d13={'id':_0x399998['id'],'tls':{'rejectUnauthorized':![]}};if(_0x399998['Smtp'][_0x66c7('0x78')]){_0x3a3d13['service']=_0x399998[_0x66c7('0x3c')]['service'];}else{_0x3a3d13['host']=_0x399998[_0x66c7('0x3c')][_0x66c7('0x76')];_0x3a3d13[_0x66c7('0x77')]=_0x399998[_0x66c7('0x3c')][_0x66c7('0x77')];_0x3a3d13['secure']=_0x399998[_0x66c7('0x3c')]['secure'];}if(_0x399998['Smtp'][_0x66c7('0x75')]){_0x3a3d13[_0x66c7('0xaa')]={'user':_0x399998[_0x66c7('0x3c')][_0x66c7('0x72')],'pass':_0x399998[_0x66c7('0x3c')]['pass']};}return respondWithRpcPromise(_0x66c7('0xb7'),_0x66c7('0xb8'),{'account':_0x3a3d13});}})[_0x66c7('0x20')](respondWithResult(_0xa7b6b7,null))[_0x66c7('0x29')](handleError(_0xa7b6b7,null));};exports[_0x66c7('0x33')]=function(_0x30f5c9,_0xd3247c){return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x30f5c9[_0x66c7('0x59')]['id']}})['then'](handleEntityNotFound(_0xd3247c,null))[_0x66c7('0x20')](function(_0x563775){if(_0x563775&&_0x563775[_0x66c7('0x78')]){throw new db[(_0x66c7('0xb9'))][(_0x66c7('0x1e'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x563775;})[_0x66c7('0x20')](removeEntity(_0xd3247c,null))['catch'](handleError(_0xd3247c,null));};exports[_0x66c7('0xba')]=function(_0x353f02,_0xadf0f3,_0x1b4f28){return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x353f02[_0x66c7('0x59')]['id']}})['then'](handleEntityNotFound(_0xadf0f3,null))[_0x66c7('0x20')](function(_0x3d2605){if(_0x3d2605){return _0x3d2605['addAgents'](_0x353f02['body'][_0x66c7('0x66')],_['omit'](_0x353f02[_0x66c7('0x5d')],[_0x66c7('0x66'),'id'])||{})[_0x66c7('0xbb')](function(_0xc776ed){for(var _0x1aa147=0x0;_0x1aa147<_0x353f02[_0x66c7('0x5d')][_0x66c7('0x66')][_0x66c7('0x49')];_0x1aa147+=0x1){socket[_0x66c7('0xbc')](_0x66c7('0xbd'),{'UserId':_0x353f02[_0x66c7('0x5d')]['ids'][_0x1aa147],'MailAccountId':_0x353f02[_0x66c7('0x59')]['id']});}return _0xc776ed;});}})[_0x66c7('0x20')](respondWithResult(_0xadf0f3,null))[_0x66c7('0x29')](handleError(_0xadf0f3,null));};exports[_0x66c7('0xbe')]=function(_0x1e8f71,_0x21e213,_0x1c512e){return db[_0x66c7('0x3f')][_0x66c7('0x5c')]({'where':{'id':_0x1e8f71[_0x66c7('0x59')]['id']}})['then'](handleEntityNotFound(_0x21e213,null))[_0x66c7('0x20')](function(_0x23cb84){if(_0x23cb84){return _0x23cb84[_0x66c7('0xbe')](_0x1e8f71[_0x66c7('0x45')][_0x66c7('0x66')])[_0x66c7('0x20')](function(){if(_[_0x66c7('0xbf')](_0x1e8f71[_0x66c7('0x45')][_0x66c7('0x66')])){for(var _0x23ae77=0x0;_0x23ae77<_0x1e8f71[_0x66c7('0x45')][_0x66c7('0x66')]['length'];_0x23ae77+=0x1){socket[_0x66c7('0xbc')](_0x66c7('0xc0'),{'UserId':Number(_0x1e8f71[_0x66c7('0x45')][_0x66c7('0x66')][_0x23ae77]),'MailAccountId':Number(_0x1e8f71[_0x66c7('0x59')]['id'])});}}else{socket[_0x66c7('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x1e8f71[_0x66c7('0x45')][_0x66c7('0x66')]),'MailAccountId':Number(_0x1e8f71[_0x66c7('0x59')]['id'])});}});}})[_0x66c7('0x20')](respondWithStatusCode(_0x21e213,null))['catch'](handleError(_0x21e213,null));};exports[_0x66c7('0xc1')]=function(_0x565ff0,_0x451d2d,_0x1af920){var _0x2d8146={};var _0x1619fc={};var _0x40280b;var _0xf75661;return db[_0x66c7('0x3f')][_0x66c7('0x64')]({'where':{'id':_0x565ff0[_0x66c7('0x59')]['id']}})[_0x66c7('0x20')](handleEntityNotFound(_0x451d2d,null))['then'](function(_0x591e13){if(_0x591e13){_0x40280b=_0x591e13;_0x1619fc['model']=_[_0x66c7('0x44')](db['User'][_0x66c7('0x5b')]);_0x1619fc['query']=_['keys'](_0x565ff0[_0x66c7('0x45')]);_0x1619fc[_0x66c7('0x46')]=_[_0x66c7('0x47')](_0x1619fc[_0x66c7('0x42')],_0x1619fc[_0x66c7('0x45')]);_0x2d8146[_0x66c7('0x4a')]=_[_0x66c7('0x47')](_0x1619fc[_0x66c7('0x42')],qs[_0x66c7('0x48')](_0x565ff0[_0x66c7('0x45')]['fields']));_0x2d8146['attributes']=_0x2d8146[_0x66c7('0x4a')]['length']?_0x2d8146[_0x66c7('0x4a')]:_0x1619fc[_0x66c7('0x42')];_0x2d8146[_0x66c7('0x4d')]=qs[_0x66c7('0x4e')](_0x565ff0[_0x66c7('0x45')][_0x66c7('0x4e')]);_0x2d8146[_0x66c7('0x50')]=qs[_0x66c7('0x46')](_[_0x66c7('0x4f')](_0x565ff0[_0x66c7('0x45')],_0x1619fc[_0x66c7('0x46')]));if(_0x565ff0[_0x66c7('0x45')][_0x66c7('0x53')]){_0x2d8146['where']=_[_0x66c7('0x51')](_0x2d8146[_0x66c7('0x50')],{'$or':_[_0x66c7('0x43')](_0x2d8146['attributes'],function(_0x1d2873){var _0x29d33e={};_0x29d33e[_0x1d2873]={'$like':'%'+_0x565ff0[_0x66c7('0x45')][_0x66c7('0x53')]+'%'};return _0x29d33e;})});}_0x2d8146=_[_0x66c7('0x51')]({},_0x2d8146,_0x565ff0[_0x66c7('0x54')]);return _0x40280b['getAgents'](_0x2d8146);}})[_0x66c7('0x20')](function(_0x1204a6){if(_0x1204a6){_0xf75661=_0x1204a6['length'];if(!_0x565ff0[_0x66c7('0x45')][_0x66c7('0x4b')](_0x66c7('0x4c'))){_0x2d8146[_0x66c7('0x30')]=qs['limit'](_0x565ff0['query'][_0x66c7('0x30')]);_0x2d8146[_0x66c7('0x2f')]=qs[_0x66c7('0x2f')](_0x565ff0['query'][_0x66c7('0x2f')]);}return _0x40280b['getAgents'](_0x2d8146);}})[_0x66c7('0x20')](function(_0x59251a){if(_0x59251a){return _0x59251a?{'count':_0xf75661,'rows':_0x59251a}:null;}})[_0x66c7('0x20')](respondWithResult(_0x451d2d,null))[_0x66c7('0x29')](handleError(_0x451d2d,null));}; \ No newline at end of file +var _0x8314=['MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','fullname','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','removeAgents','userMailAccount:remove','getAgents','User','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','count','offset','Content-Range','apply','reject','save','UserProfileResource','destroy','sendStatus','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','type','VIRTUAL','include','findAll','rows','show','params','merge','options','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','order','filter','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cuser','password','pass','cpassword','authentication','host','port','service','user','get','role','UserProfileSection'];(function(_0x5c087b,_0xd79b8e){var _0x132b69=function(_0x4d78f5){while(--_0x4d78f5){_0x5c087b['push'](_0x5c087b['shift']());}};_0x132b69(++_0xd79b8e);}(_0x8314,0x101));var _0x4831=function(_0x4d5545,_0x3e9ce7){_0x4d5545=_0x4d5545-0x0;var _0x879779=_0x8314[_0x4d5545];return _0x879779;};'use strict';var pdf=require(_0x4831('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4831('0x1'));var rp=require(_0x4831('0x2'));var moment=require(_0x4831('0x3'));var BPromise=require(_0x4831('0x4'));var Mustache=require(_0x4831('0x5'));var util=require(_0x4831('0x6'));var path=require(_0x4831('0x7'));var sox=require(_0x4831('0x8'));var csv=require(_0x4831('0x9'));var ejs=require(_0x4831('0xa'));var fs=require('fs');var _=require(_0x4831('0xb'));var squel=require(_0x4831('0xc'));var crypto=require('crypto');var jsforce=require(_0x4831('0xd'));var deskjs=require(_0x4831('0xe'));var toCsv=require(_0x4831('0x9'));var querystring=require(_0x4831('0xf'));var Papa=require(_0x4831('0x10'));var Redis=require(_0x4831('0x11'));var authService=require(_0x4831('0x12'));var qs=require(_0x4831('0x13'));var as=require(_0x4831('0x14'));var hardwareService=require(_0x4831('0x15'));var logger=require(_0x4831('0x16'))(_0x4831('0x17'));var utils=require(_0x4831('0x18'));var config=require(_0x4831('0x19'));var db=require(_0x4831('0x1a'))['db'];config[_0x4831('0x1b')]=_[_0x4831('0x1c')](config['redis'],{'host':_0x4831('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4831('0x1b')]));require('./mailAccount.socket')[_0x4831('0x1e')](socket);var jayson=require(_0x4831('0x1f'));var client=jayson[_0x4831('0x20')][_0x4831('0x21')]({'port':0x232b});function checkPasswordPattern(_0x1610af,_0x3d4886,_0x3fd4a2){if(_0x3fd4a2){var _0x3d4e1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d4e1f[_0x4831('0x22')](_0x3d4886)){return _0x1610af;}else{throw new db[(_0x4831('0x23'))][(_0x4831('0x24'))](_0x4831('0x25'));}}else{return _0x1610af;}}function respondWithRpcPromise(_0x21b2ac,_0x4ebb59,_0x54329b,_0xc9adf2){return new BPromise(function(_0x5d455a,_0x50370e){var _0x5f2c62=_0xc9adf2||client;return _0x5f2c62[_0x4831('0x26')](_0x21b2ac,_0x54329b)[_0x4831('0x27')](function(_0x17ab47){logger[_0x4831('0x28')](_0x4831('0x29'),_0x4ebb59,'request\x20sent');logger[_0x4831('0x2a')](_0x4831('0x2b'),_0x4ebb59,_0x4831('0x2c'),JSON[_0x4831('0x2d')](_0x17ab47));if(_0x17ab47['error']){if(_0x17ab47[_0x4831('0x2e')]['code']===0x1f4){logger[_0x4831('0x2e')]('MailAccount,\x20%s,\x20%s',_0x4ebb59,_0x17ab47[_0x4831('0x2e')][_0x4831('0x2f')]);return _0x50370e(_0x17ab47[_0x4831('0x2e')][_0x4831('0x2f')]);}logger[_0x4831('0x2e')](_0x4831('0x29'),_0x4ebb59,_0x17ab47['error'][_0x4831('0x2f')]);return _0x5d455a(_0x17ab47['error'][_0x4831('0x2f')]);}else{logger[_0x4831('0x28')]('MailAccount,\x20%s,\x20%s',_0x4ebb59,_0x4831('0x2c'));_0x5d455a(_0x17ab47['result'][_0x4831('0x2f')]);}})[_0x4831('0x30')](function(_0x3f04ba){logger[_0x4831('0x2e')](_0x4831('0x29'),_0x4ebb59,_0x3f04ba);_0x50370e(_0x3f04ba);});});}function respondWithStatusCode(_0x4f7707,_0x176317){_0x176317=_0x176317||0xcc;return function(_0x40c954){if(_0x40c954){return _0x4f7707['sendStatus'](_0x176317);}return _0x4f7707[_0x4831('0x31')](_0x176317)[_0x4831('0x32')]();};}function respondWithResult(_0x8580c5,_0x2e900b){_0x2e900b=_0x2e900b||0xc8;return function(_0x565b8a){if(_0x565b8a){return _0x8580c5[_0x4831('0x31')](_0x2e900b)[_0x4831('0x33')](_0x565b8a);}};}function respondWithFilteredResult(_0x48b54e,_0x141848){return function(_0x21a37a){if(_0x21a37a){var _0x4c19fb=_0x21a37a[_0x4831('0x34')],_0x4eca71=_0x141848[_0x4831('0x35')],_0x39e425=_0x141848['offset']+_0x141848['limit'],_0x37017b;if(_0x39e425>=_0x4c19fb){_0x39e425=_0x4c19fb;_0x37017b=0xc8;}else{_0x37017b=0xce;}_0x48b54e[_0x4831('0x31')](_0x37017b);return _0x48b54e['set'](_0x4831('0x36'),_0x4eca71+'-'+_0x39e425+'/'+_0x4c19fb)['json'](_0x21a37a);}return null;};}function patchUpdates(_0x848902){return function(_0x87d116){try{jsonpatch[_0x4831('0x37')](_0x87d116,_0x848902,!![]);}catch(_0x411275){return BPromise[_0x4831('0x38')](_0x411275);}return _0x87d116[_0x4831('0x39')]();};}function saveUpdates(_0x4cb042,_0x117b2e){return function(_0x5530aa){if(_0x5530aa){return _0x5530aa['update'](_0x4cb042)[_0x4831('0x27')](function(_0x383042){return _0x383042;});}return null;};}function removeEntity(_0x3e3623,_0x5a8c98){return function(_0x3102be){if(_0x3102be){return _0x3102be['destroy']()[_0x4831('0x27')](function(){var _0x9341be=_0x3102be['get']({'plain':!![]});var _0x21ff96='MailAccounts';return db[_0x4831('0x3a')][_0x4831('0x3b')]({'where':{'type':_0x21ff96,'resourceId':_0x9341be['id']}})[_0x4831('0x27')](function(){return _0x3102be;});})['then'](function(){_0x3e3623['status'](0xcc)[_0x4831('0x32')]();});}};}function handleEntityNotFound(_0x458d42,_0x298ba5){return function(_0x40cda0){if(!_0x40cda0){_0x458d42[_0x4831('0x3c')](0x194);}return _0x40cda0;};}function handleError(_0x24b149,_0x1b1fcd){_0x1b1fcd=_0x1b1fcd||0x1f4;return function(_0x1a6a7d){logger[_0x4831('0x2e')](_0x1a6a7d[_0x4831('0x3d')]);if(_0x1a6a7d['name']){delete _0x1a6a7d[_0x4831('0x3e')];}_0x24b149[_0x4831('0x31')](_0x1b1fcd)[_0x4831('0x3f')](_0x1a6a7d);};}exports[_0x4831('0x40')]=function(_0x38e9b5,_0x2dbb33){var _0x220729={'include':[{'model':db[_0x4831('0x41')],'as':_0x4831('0x42')},{'model':db[_0x4831('0x43')],'as':_0x4831('0x44')},{'model':db[_0x4831('0x45')],'as':_0x4831('0x46')}]},_0x1ed149={},_0x35a4f6={'count':0x0,'rows':[]};var _0x1f903c=_[_0x4831('0x47')](db[_0x4831('0x48')][_0x4831('0x49')],function(_0x3fba54){return{'name':_0x3fba54[_0x4831('0x4a')],'type':_0x3fba54['type'][_0x4831('0x4b')]};});_0x1ed149[_0x4831('0x4c')]=_['map'](_0x1f903c,'name');_0x1ed149[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x38e9b5[_0x4831('0x4d')]);_0x1ed149[_0x4831('0x4f')]=_['intersection'](_0x1ed149['model'],_0x1ed149[_0x4831('0x4d')]);_0x220729[_0x4831('0x50')]=_[_0x4831('0x51')](_0x1ed149['model'],qs['fields'](_0x38e9b5[_0x4831('0x4d')][_0x4831('0x52')]));_0x220729[_0x4831('0x50')]=_0x220729[_0x4831('0x50')][_0x4831('0x53')]?_0x220729[_0x4831('0x50')]:_0x1ed149[_0x4831('0x4c')];if(!_0x38e9b5[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x220729[_0x4831('0x56')]=qs['limit'](_0x38e9b5['query'][_0x4831('0x56')]);_0x220729[_0x4831('0x35')]=qs[_0x4831('0x35')](_0x38e9b5['query'][_0x4831('0x35')]);}_0x220729['order']=qs[_0x4831('0x57')](_0x38e9b5['query'][_0x4831('0x57')]);_0x220729['where']=qs[_0x4831('0x4f')](_[_0x4831('0x58')](_0x38e9b5['query'],_0x1ed149[_0x4831('0x4f')]),_0x1f903c);if(_0x38e9b5['query']['filter']){_0x220729[_0x4831('0x59')]=_['merge'](_0x220729[_0x4831('0x59')],{'$or':_['map'](_0x1f903c,function(_0x43321f){if(_0x43321f[_0x4831('0x5a')]!==_0x4831('0x5b')){var _0x1ed3f2={};_0x1ed3f2[_0x43321f['name']]={'$like':'%'+_0x38e9b5[_0x4831('0x4d')]['filter']+'%'};return _0x1ed3f2;}})});}_0x220729=_['merge']({},_0x220729,_0x38e9b5['options']);var _0x167e0c={'where':_0x220729['where']};return db[_0x4831('0x48')][_0x4831('0x34')](_0x167e0c)[_0x4831('0x27')](function(_0x1f9e30){_0x35a4f6['count']=_0x1f9e30;if(_0x38e9b5[_0x4831('0x4d')]['includeAll']){_0x220729[_0x4831('0x5c')]=[{'all':!![]}];}return db[_0x4831('0x48')][_0x4831('0x5d')](_0x220729);})['then'](function(_0x26b77e){_0x35a4f6[_0x4831('0x5e')]=_0x26b77e;return _0x35a4f6;})[_0x4831('0x27')](respondWithFilteredResult(_0x2dbb33,_0x220729))[_0x4831('0x30')](handleError(_0x2dbb33,null));};exports[_0x4831('0x5f')]=function(_0x499d9a,_0xf0cca7){var _0x3b3c7c={'raw':![],'where':{'id':_0x499d9a[_0x4831('0x60')]['id']},'include':[{'model':db[_0x4831('0x41')],'as':_0x4831('0x42')},{'model':db[_0x4831('0x43')],'as':'Smtp'},{'model':db[_0x4831('0x45')],'as':_0x4831('0x46')}]},_0x26d460={};_0x26d460[_0x4831('0x4c')]=_[_0x4831('0x4e')](db[_0x4831('0x48')]['rawAttributes']);_0x26d460[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x499d9a[_0x4831('0x4d')]);_0x26d460['filters']=_[_0x4831('0x51')](_0x26d460[_0x4831('0x4c')],_0x26d460[_0x4831('0x4d')]);_0x3b3c7c[_0x4831('0x50')]=_[_0x4831('0x51')](_0x26d460[_0x4831('0x4c')],qs[_0x4831('0x52')](_0x499d9a[_0x4831('0x4d')][_0x4831('0x52')]));_0x3b3c7c[_0x4831('0x50')]=_0x3b3c7c['attributes'][_0x4831('0x53')]?_0x3b3c7c[_0x4831('0x50')]:_0x26d460['model'];if(_0x499d9a['query']['includeAll']){_0x3b3c7c[_0x4831('0x5c')]=[{'all':!![]}];}_0x3b3c7c=_[_0x4831('0x61')]({},_0x3b3c7c,_0x499d9a[_0x4831('0x62')]);return db[_0x4831('0x48')][_0x4831('0x63')](_0x3b3c7c)[_0x4831('0x27')](handleEntityNotFound(_0xf0cca7,null))[_0x4831('0x27')](respondWithResult(_0xf0cca7,null))['catch'](handleError(_0xf0cca7,null));};exports[_0x4831('0x64')]=function(_0x215934,_0x5bd20a){if(_0x215934['body']['id']){delete _0x215934[_0x4831('0x65')]['id'];}return db['MailAccount'][_0x4831('0x63')]({'where':{'id':_0x215934['params']['id']},'include':[{'model':db[_0x4831('0x41')],'as':_0x4831('0x42')},{'model':db[_0x4831('0x43')],'as':_0x4831('0x44')},{'model':db['Pause'],'as':_0x4831('0x46')}]})[_0x4831('0x27')](handleEntityNotFound(_0x5bd20a,null))['then'](saveUpdates(_0x215934['body'],null))[_0x4831('0x27')](function(_0x924f87){if(_0x924f87&&_0x215934[_0x4831('0x65')][_0x4831('0x42')]){return db[_0x4831('0x41')][_0x4831('0x64')](_0x215934['body'][_0x4831('0x42')],{'where':{'MailAccountId':_0x924f87['id']}})['then'](function(){return _0x924f87;});}return _0x924f87;})[_0x4831('0x27')](function(_0x151314){if(_0x151314&&_0x215934[_0x4831('0x65')][_0x4831('0x44')]){return db[_0x4831('0x43')][_0x4831('0x64')](_0x215934[_0x4831('0x65')][_0x4831('0x44')],{'where':{'MailAccountId':_0x151314['id']}})['then'](function(){return _0x151314;});}return _0x151314;})[_0x4831('0x27')](respondWithResult(_0x5bd20a,null))[_0x4831('0x30')](handleError(_0x5bd20a,null));};exports[_0x4831('0x66')]=function(_0x14f313,_0x2343bf){return db['MailAccount'][_0x4831('0x66')]()[_0x4831('0x27')](respondWithResult(_0x2343bf,null))[_0x4831('0x30')](handleError(_0x2343bf,null));};exports[_0x4831('0x67')]=function(_0x349dfd,_0x4de9df,_0x51dc2f){if(_0x349dfd[_0x4831('0x65')]['id']){delete _0x349dfd[_0x4831('0x65')]['id'];}return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x349dfd[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x4de9df,null))[_0x4831('0x27')](function(_0x1d6964){if(_0x1d6964){_0x349dfd['body'][_0x4831('0x68')]=_0x1d6964['id'];return db[_0x4831('0x69')][_0x4831('0x6a')](_0x349dfd[_0x4831('0x65')]);}})[_0x4831('0x27')](respondWithResult(_0x4de9df,null))[_0x4831('0x30')](handleError(_0x4de9df,null));};exports['getDispositions']=function(_0x1b9c8f,_0x6b0d53,_0x35d48d){var _0x3fc9c2={'raw':![],'where':{}};var _0x14a2b1={};var _0x5810dc={'count':0x0,'rows':[]};return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x1b9c8f[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x6b0d53,null))['then'](function(_0x32d5e5){if(_0x32d5e5){_0x14a2b1['model']=_[_0x4831('0x4e')](db[_0x4831('0x69')]['rawAttributes']);_0x14a2b1[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x1b9c8f[_0x4831('0x4d')]);_0x14a2b1[_0x4831('0x4f')]=_[_0x4831('0x51')](_0x14a2b1[_0x4831('0x4c')],_0x14a2b1[_0x4831('0x4d')]);_0x3fc9c2['attributes']=_[_0x4831('0x51')](_0x14a2b1['model'],qs[_0x4831('0x52')](_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x52')]));_0x3fc9c2[_0x4831('0x50')]=_0x3fc9c2[_0x4831('0x50')]['length']?_0x3fc9c2['attributes']:_0x14a2b1[_0x4831('0x4c')];if(!_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x3fc9c2['limit']=qs['limit'](_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x56')]);_0x3fc9c2[_0x4831('0x35')]=qs['offset'](_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x35')]);}_0x3fc9c2[_0x4831('0x6c')]=qs[_0x4831('0x57')](_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x57')]);_0x3fc9c2[_0x4831('0x59')]=qs[_0x4831('0x4f')](_[_0x4831('0x58')](_0x1b9c8f[_0x4831('0x4d')],_0x14a2b1[_0x4831('0x4f')]));_0x3fc9c2['where']['MailAccountId']=_0x32d5e5['id'];if(_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x6d')]){_0x3fc9c2['where']=_[_0x4831('0x61')](_0x3fc9c2[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x3fc9c2[_0x4831('0x50')],function(_0x5ce832){var _0x589ce0={};_0x589ce0[_0x5ce832]={'$like':'%'+_0x1b9c8f[_0x4831('0x4d')][_0x4831('0x6d')]+'%'};return _0x589ce0;})});}_0x3fc9c2=_[_0x4831('0x61')]({},_0x3fc9c2,_0x1b9c8f[_0x4831('0x62')]);return db[_0x4831('0x69')]['count']({'where':_0x3fc9c2['where']})['then'](function(_0xe39aa7){_0x5810dc[_0x4831('0x34')]=_0xe39aa7;if(_0x1b9c8f['query'][_0x4831('0x6e')]){_0x3fc9c2['include']=[{'all':!![]}];}return db['Disposition'][_0x4831('0x5d')](_0x3fc9c2);})[_0x4831('0x27')](function(_0x29222e){_0x5810dc[_0x4831('0x5e')]=_0x29222e;return _0x5810dc;});}})[_0x4831('0x27')](respondWithFilteredResult(_0x6b0d53,_0x3fc9c2))['catch'](handleError(_0x6b0d53,null));};exports[_0x4831('0x6f')]=function(_0x25f69e,_0xc65375,_0x4845de){return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x25f69e[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0xc65375,null))[_0x4831('0x27')](function(_0x5d9f42){if(_0x5d9f42){return _0x5d9f42['removeDispositions'](_0x25f69e[_0x4831('0x4d')][_0x4831('0x70')]);}})['then'](respondWithStatusCode(_0xc65375,null))[_0x4831('0x30')](handleError(_0xc65375,null));};exports[_0x4831('0x71')]=function(_0x24326e,_0x265753,_0x40a439){if(_0x24326e['body']['id']){delete _0x24326e[_0x4831('0x65')]['id'];}return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x24326e['params']['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x265753,null))[_0x4831('0x27')](function(_0x3a5db5){if(_0x3a5db5){_0x24326e[_0x4831('0x65')][_0x4831('0x68')]=_0x3a5db5['id'];return db['CannedAnswer'][_0x4831('0x6a')](_0x24326e[_0x4831('0x65')]);}})[_0x4831('0x27')](respondWithResult(_0x265753,null))['catch'](handleError(_0x265753,null));};exports['getAnswers']=function(_0xa6b8ea,_0x59e250,_0x3a1fbb){var _0x1ef080={'raw':![],'where':{}};var _0x5c3f5b={};var _0x22078e={'count':0x0,'rows':[]};return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0xa6b8ea[_0x4831('0x60')]['id']}})['then'](handleEntityNotFound(_0x59e250,null))[_0x4831('0x27')](function(_0xeb3056){if(_0xeb3056){_0x5c3f5b[_0x4831('0x4c')]=_[_0x4831('0x4e')](db[_0x4831('0x72')]['rawAttributes']);_0x5c3f5b[_0x4831('0x4d')]=_['keys'](_0xa6b8ea[_0x4831('0x4d')]);_0x5c3f5b['filters']=_[_0x4831('0x51')](_0x5c3f5b[_0x4831('0x4c')],_0x5c3f5b[_0x4831('0x4d')]);_0x1ef080[_0x4831('0x50')]=_[_0x4831('0x51')](_0x5c3f5b[_0x4831('0x4c')],qs[_0x4831('0x52')](_0xa6b8ea[_0x4831('0x4d')]['fields']));_0x1ef080['attributes']=_0x1ef080['attributes'][_0x4831('0x53')]?_0x1ef080[_0x4831('0x50')]:_0x5c3f5b[_0x4831('0x4c')];if(!_0xa6b8ea['query'][_0x4831('0x54')](_0x4831('0x55'))){_0x1ef080[_0x4831('0x56')]=qs[_0x4831('0x56')](_0xa6b8ea['query']['limit']);_0x1ef080[_0x4831('0x35')]=qs[_0x4831('0x35')](_0xa6b8ea[_0x4831('0x4d')][_0x4831('0x35')]);}_0x1ef080[_0x4831('0x6c')]=qs[_0x4831('0x57')](_0xa6b8ea['query'][_0x4831('0x57')]);_0x1ef080[_0x4831('0x59')]=qs[_0x4831('0x4f')](_['pick'](_0xa6b8ea[_0x4831('0x4d')],_0x5c3f5b[_0x4831('0x4f')]));_0x1ef080[_0x4831('0x59')]['MailAccountId']=_0xeb3056['id'];if(_0xa6b8ea[_0x4831('0x4d')][_0x4831('0x6d')]){_0x1ef080[_0x4831('0x59')]=_[_0x4831('0x61')](_0x1ef080[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x1ef080['attributes'],function(_0x3a49b2){var _0x25437c={};_0x25437c[_0x3a49b2]={'$like':'%'+_0xa6b8ea['query'][_0x4831('0x6d')]+'%'};return _0x25437c;})});}_0x1ef080=_[_0x4831('0x61')]({},_0x1ef080,_0xa6b8ea['options']);return db[_0x4831('0x72')]['count']({'where':_0x1ef080['where']})[_0x4831('0x27')](function(_0x3c7751){_0x22078e[_0x4831('0x34')]=_0x3c7751;if(_0xa6b8ea[_0x4831('0x4d')]['includeAll']){_0x1ef080[_0x4831('0x5c')]=[{'all':!![]}];}return db[_0x4831('0x72')][_0x4831('0x5d')](_0x1ef080);})[_0x4831('0x27')](function(_0x310313){_0x22078e[_0x4831('0x5e')]=_0x310313;return _0x22078e;});}})[_0x4831('0x27')](respondWithFilteredResult(_0x59e250,_0x1ef080))[_0x4831('0x30')](handleError(_0x59e250,null));};exports[_0x4831('0x73')]=function(_0x4fc005,_0x2e126f,_0x52e89b){return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x4fc005[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x2e126f,null))['then'](function(_0x393794){if(_0x393794){return _0x393794[_0x4831('0x73')](_0x4fc005['query'][_0x4831('0x70')]);}})[_0x4831('0x27')](respondWithStatusCode(_0x2e126f,null))[_0x4831('0x30')](handleError(_0x2e126f,null));};exports['create']=function(_0x38f7b9,_0x1c17aa){var _0x2cf26d={'name':_0x38f7b9[_0x4831('0x65')]['name'],'key':_0x38f7b9[_0x4831('0x65')][_0x4831('0x4b')],'email':_0x38f7b9[_0x4831('0x65')][_0x4831('0x74')],'ListId':_0x38f7b9[_0x4831('0x65')][_0x4831('0x75')],'active':!_[_0x4831('0x76')](_0x38f7b9[_0x4831('0x65')]['active'])?_0x38f7b9[_0x4831('0x65')][_0x4831('0x77')]:!![],'description':_0x38f7b9[_0x4831('0x65')][_0x4831('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x4831('0x76')](_0x38f7b9[_0x4831('0x65')]['cservice'])){if(_0x38f7b9[_0x4831('0x65')]['cauthentication']){_0x2cf26d[_0x4831('0x42')]['user']=_0x2cf26d[_0x4831('0x44')]['user']=_0x38f7b9[_0x4831('0x65')][_0x4831('0x79')];_0x2cf26d[_0x4831('0x42')][_0x4831('0x7a')]=_0x2cf26d['Smtp'][_0x4831('0x7b')]=_0x38f7b9[_0x4831('0x65')][_0x4831('0x7c')];}else{_0x2cf26d[_0x4831('0x42')][_0x4831('0x7d')]=_0x2cf26d[_0x4831('0x44')][_0x4831('0x7d')]=![];}_0x2cf26d['Imap'][_0x4831('0x7e')]=_0x38f7b9[_0x4831('0x65')]['Imap']['host'];_0x2cf26d[_0x4831('0x42')][_0x4831('0x7f')]=_0x38f7b9[_0x4831('0x65')][_0x4831('0x42')][_0x4831('0x7f')];_0x2cf26d['Smtp'][_0x4831('0x7e')]=_0x38f7b9[_0x4831('0x65')]['Smtp']['host'];_0x2cf26d[_0x4831('0x44')][_0x4831('0x7f')]=_0x38f7b9['body'][_0x4831('0x44')][_0x4831('0x7f')];}else{_0x2cf26d[_0x4831('0x42')][_0x4831('0x80')]=_0x2cf26d[_0x4831('0x44')][_0x4831('0x80')]=_0x38f7b9['body']['cservice'];_0x2cf26d['Imap']['user']=_0x2cf26d[_0x4831('0x44')]['user']=_0x38f7b9[_0x4831('0x65')][_0x4831('0x79')];_0x2cf26d['Imap'][_0x4831('0x7a')]=_0x2cf26d[_0x4831('0x44')][_0x4831('0x7b')]=_0x38f7b9[_0x4831('0x65')][_0x4831('0x7c')];}return db[_0x4831('0x48')]['create'](_0x2cf26d,{'include':[{'model':db['MailServerOut'],'as':_0x4831('0x44')},{'model':db[_0x4831('0x41')],'as':_0x4831('0x42')}]})[_0x4831('0x27')](function(_0x24477f){var _0x4c638a=_0x38f7b9[_0x4831('0x81')][_0x4831('0x82')]({'plain':!![]});if(!_0x4c638a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c638a[_0x4831('0x83')]==='user'){var _0x29049b=_0x24477f[_0x4831('0x82')]({'plain':!![]});return db[_0x4831('0x84')]['find']({'where':{'name':_0x4831('0x85'),'userProfileId':_0x4c638a['userProfileId']},'raw':!![]})[_0x4831('0x27')](function(_0x3613a2){if(_0x3613a2&&_0x3613a2[_0x4831('0x86')]===0x0){return db['UserProfileResource'][_0x4831('0x6a')]({'name':_0x29049b[_0x4831('0x3e')],'resourceId':_0x29049b['id'],'type':_0x3613a2[_0x4831('0x3e')],'sectionId':_0x3613a2['id']},{})[_0x4831('0x27')](function(){return _0x24477f;});}else{return _0x24477f;}})['catch'](function(_0x5794d8){logger[_0x4831('0x2e')](_0x4831('0x87'),_0x5794d8);throw _0x5794d8;});}return _0x24477f;})[_0x4831('0x27')](respondWithResult(_0x1c17aa,0xc9))['catch'](handleError(_0x1c17aa,null));};exports['getImap']=function(_0x388e41,_0x3b605e,_0x22c393){return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x388e41[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x3b605e,null))['then'](function(_0x333918){if(_0x333918){return _0x333918[_0x4831('0x88')]();}return null;})[_0x4831('0x27')](respondWithResult(_0x3b605e,null))[_0x4831('0x30')](handleError(_0x3b605e,null));};exports[_0x4831('0x89')]=function(_0x40d817,_0x5f2f95,_0x58b13d){if(_0x40d817[_0x4831('0x65')]['id']){delete _0x40d817[_0x4831('0x65')]['id'];}return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x40d817[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x5f2f95,null))[_0x4831('0x27')](function(_0x129238){if(_0x129238){_0x40d817[_0x4831('0x65')][_0x4831('0x68')]=_0x129238['id'];return db[_0x4831('0x41')][_0x4831('0x6a')](_0x40d817['body']);}})['then'](respondWithResult(_0x5f2f95,null))['catch'](handleError(_0x5f2f95,null));};exports[_0x4831('0x8a')]=function(_0x2f0069,_0x5c86f5,_0x32d64d){return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x2f0069[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x5c86f5,null))[_0x4831('0x27')](function(_0x1684b2){if(_0x1684b2){return _0x1684b2[_0x4831('0x8b')](null);}return null;})[_0x4831('0x27')](respondWithStatusCode(_0x5c86f5,null))[_0x4831('0x30')](handleError(_0x5c86f5,null));};exports[_0x4831('0x8c')]=function(_0x5db720,_0x1c07bd,_0x2399cc){return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x5db720[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x1c07bd,null))[_0x4831('0x27')](function(_0xea8a94){if(_0xea8a94){return _0xea8a94[_0x4831('0x8c')]();}return null;})[_0x4831('0x27')](respondWithResult(_0x1c07bd,null))[_0x4831('0x30')](handleError(_0x1c07bd,null));};exports['addSmtp']=function(_0x3f17f4,_0x41f9ad,_0xb66f84){if(_0x3f17f4[_0x4831('0x65')]['id']){delete _0x3f17f4[_0x4831('0x65')]['id'];}return db[_0x4831('0x48')]['find']({'where':{'id':_0x3f17f4[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x41f9ad,null))[_0x4831('0x27')](function(_0x31d855){if(_0x31d855){_0x3f17f4['body']['MailAccountId']=_0x31d855['id'];return db[_0x4831('0x43')][_0x4831('0x6a')](_0x3f17f4[_0x4831('0x65')]);}})['then'](respondWithResult(_0x41f9ad,null))[_0x4831('0x30')](handleError(_0x41f9ad,null));};exports[_0x4831('0x8d')]=function(_0x218039,_0x1e56bb,_0xd6540b){return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x218039[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x1e56bb,null))[_0x4831('0x27')](function(_0x4fc27c){if(_0x4fc27c){return _0x4fc27c[_0x4831('0x8e')](null);}return null;})['then'](respondWithStatusCode(_0x1e56bb,null))[_0x4831('0x30')](handleError(_0x1e56bb,null));};exports[_0x4831('0x8f')]=function(_0x59a860,_0x343e09,_0x353031){return db['MailInteraction']['find']({'where':{'id':_0x59a860[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x343e09,null))[_0x4831('0x27')](function(_0x1481af){if(_0x1481af){return _0x1481af[_0x4831('0x8f')](_0x59a860[_0x4831('0x65')][_0x4831('0x70')],_['omit'](_0x59a860[_0x4831('0x65')],[_0x4831('0x70'),'id'])||{});}})[_0x4831('0x27')](respondWithResult(_0x343e09,null))[_0x4831('0x30')](handleError(_0x343e09,null));};exports[_0x4831('0x90')]=function(_0x52a4d4,_0x2dade5,_0x28ef49){var _0x3b0bff={'raw':![],'where':{}};var _0x3854c7={};var _0x2c6a63={'count':0x0,'rows':[]};return db[_0x4831('0x48')]['findOne']({'where':{'id':_0x52a4d4[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x2dade5,null))['then'](function(_0x26cca4){if(_0x26cca4){_0x3854c7[_0x4831('0x4c')]=_[_0x4831('0x4e')](db[_0x4831('0x91')][_0x4831('0x49')]);_0x3854c7[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x52a4d4['query']);_0x3854c7[_0x4831('0x4f')]=_[_0x4831('0x51')](_0x3854c7[_0x4831('0x4c')],_0x3854c7[_0x4831('0x4d')]);_0x3b0bff['attributes']=_[_0x4831('0x51')](_0x3854c7[_0x4831('0x4c')],qs[_0x4831('0x52')](_0x52a4d4[_0x4831('0x4d')][_0x4831('0x52')]));_0x3b0bff['attributes']=_0x3b0bff[_0x4831('0x50')][_0x4831('0x53')]?_0x3b0bff[_0x4831('0x50')]:_0x3854c7[_0x4831('0x4c')];if(!_0x52a4d4[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x3b0bff[_0x4831('0x56')]=qs['limit'](_0x52a4d4['query'][_0x4831('0x56')]);_0x3b0bff['offset']=qs['offset'](_0x52a4d4[_0x4831('0x4d')][_0x4831('0x35')]);}_0x3b0bff[_0x4831('0x6c')]=qs[_0x4831('0x57')](_0x52a4d4[_0x4831('0x4d')][_0x4831('0x57')]);_0x3b0bff[_0x4831('0x59')]=qs[_0x4831('0x4f')](_[_0x4831('0x58')](_0x52a4d4[_0x4831('0x4d')],_0x3854c7['filters']));_0x3b0bff[_0x4831('0x59')][_0x4831('0x68')]=_0x26cca4['id'];if(_0x52a4d4[_0x4831('0x4d')][_0x4831('0x6d')]){_0x3b0bff[_0x4831('0x59')]=_['merge'](_0x3b0bff[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x3b0bff[_0x4831('0x50')],function(_0x1a0bfe){var _0x476b45={};_0x476b45[_0x1a0bfe]={'$like':'%'+_0x52a4d4[_0x4831('0x4d')][_0x4831('0x6d')]+'%'};return _0x476b45;})});}_0x3b0bff=_['merge']({},_0x3b0bff,_0x52a4d4[_0x4831('0x62')]);return db[_0x4831('0x91')]['count']({'where':_0x3b0bff[_0x4831('0x59')]})[_0x4831('0x27')](function(_0x2ffd50){_0x2c6a63['count']=_0x2ffd50;if(_0x52a4d4[_0x4831('0x4d')][_0x4831('0x6e')]){_0x3b0bff[_0x4831('0x5c')]=[{'model':db[_0x4831('0x92')],'as':_0x4831('0x93'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4831('0x3e'),_0x4831('0x94'),'internal'],'required':![]},{'model':db[_0x4831('0x95')],'as':_0x4831('0x96'),'attributes':['id','name',_0x4831('0x97')],'where':_0x52a4d4[_0x4831('0x4d')][_0x4831('0x98')]?{'id':_0x52a4d4[_0x4831('0x4d')][_0x4831('0x98')]}:undefined,'required':_0x52a4d4[_0x4831('0x4d')][_0x4831('0x98')]?!![]:![]}];}return db[_0x4831('0x91')][_0x4831('0x5d')](_0x3b0bff);})[_0x4831('0x27')](function(_0x37c104){_0x2c6a63['rows']=_0x37c104;return _0x2c6a63;});}})[_0x4831('0x27')](respondWithFilteredResult(_0x2dade5,_0x3b0bff))['catch'](handleError(_0x2dade5,null));};exports[_0x4831('0x99')]=function(_0x5964b7,_0x4608c8,_0x57756d){return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x5964b7[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x4608c8,null))[_0x4831('0x27')](function(_0x31ca06){if(_0x31ca06){return db['sequelize'][_0x4831('0x9a')](function(_0x25bbe8){return db[_0x4831('0x9b')][_0x4831('0x3b')]({'where':{'MailAccountId':_0x5964b7[_0x4831('0x60')]['id']},'transaction':_0x25bbe8})[_0x4831('0x27')](function(_0x14e6de){var _0x3f55a4=_[_0x4831('0x47')](_0x5964b7[_0x4831('0x65')],function(_0x825440){_0x825440[_0x4831('0x68')]=_0x5964b7[_0x4831('0x60')]['id'];return _0x825440;});return db[_0x4831('0x9b')][_0x4831('0x9c')](_0x3f55a4,{'transaction':_0x25bbe8});});})[_0x4831('0x27')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5964b7[_0x4831('0x60')]['id']},'order':_0x4831('0x9d')});});}})[_0x4831('0x27')](respondWithResult(_0x4608c8,null))[_0x4831('0x30')](handleError(_0x4608c8,null));};exports[_0x4831('0x9e')]=function(_0x22de69,_0xaf9c6b,_0x50dd6c){var _0x300b64={};var _0x3b722a={};var _0x168c30;var _0x3b8119;return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x22de69[_0x4831('0x60')]['id']}})['then'](handleEntityNotFound(_0xaf9c6b,null))[_0x4831('0x27')](function(_0x4bb285){if(_0x4bb285){_0x168c30=_0x4bb285;_0x3b722a[_0x4831('0x4c')]=_['keys'](db[_0x4831('0x9b')]['rawAttributes']);_0x3b722a[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x22de69[_0x4831('0x4d')]);_0x3b722a[_0x4831('0x4f')]=_[_0x4831('0x51')](_0x3b722a[_0x4831('0x4c')],_0x3b722a['query']);_0x300b64['attributes']=_[_0x4831('0x51')](_0x3b722a[_0x4831('0x4c')],qs[_0x4831('0x52')](_0x22de69['query'][_0x4831('0x52')]));_0x300b64[_0x4831('0x50')]=_0x300b64[_0x4831('0x50')][_0x4831('0x53')]?_0x300b64[_0x4831('0x50')]:_0x3b722a[_0x4831('0x4c')];_0x300b64[_0x4831('0x6c')]=qs['sort'](_0x22de69[_0x4831('0x4d')]['sort']);_0x300b64[_0x4831('0x59')]=qs['filters'](_[_0x4831('0x58')](_0x22de69[_0x4831('0x4d')],_0x3b722a[_0x4831('0x4f')]));if(_0x22de69['query'][_0x4831('0x6d')]){_0x300b64[_0x4831('0x59')]=_['merge'](_0x300b64[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x300b64[_0x4831('0x50')],function(_0x383d20){var _0x5708cb={};_0x5708cb[_0x383d20]={'$like':'%'+_0x22de69[_0x4831('0x4d')][_0x4831('0x6d')]+'%'};return _0x5708cb;})});}_0x300b64=_[_0x4831('0x61')]({},_0x300b64,_0x22de69[_0x4831('0x62')]);return _0x168c30[_0x4831('0x9e')](_0x300b64);}})[_0x4831('0x27')](function(_0x58c7ed){if(_0x58c7ed){_0x3b8119=_0x58c7ed['length'];if(!_0x22de69[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x300b64['limit']=qs[_0x4831('0x56')](_0x22de69['query'][_0x4831('0x56')]);_0x300b64[_0x4831('0x35')]=qs['offset'](_0x22de69[_0x4831('0x4d')][_0x4831('0x35')]);}return _0x168c30['getApplications'](_0x300b64);}})[_0x4831('0x27')](function(_0x462f87){if(_0x462f87){return _0x462f87?{'count':_0x3b8119,'rows':_0x462f87}:null;}})[_0x4831('0x27')](respondWithResult(_0xaf9c6b,null))[_0x4831('0x30')](handleError(_0xaf9c6b,null));};exports[_0x4831('0x9f')]=function(_0x254813,_0x584f08,_0x3f1f45){var _0x56ec88={'raw':!![],'where':{}};var _0x503f2e={};var _0xab6173={'count':0x0,'rows':[]};return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x254813['params']['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x584f08,null))[_0x4831('0x27')](function(_0x22ad58){if(_0x22ad58){_0x503f2e[_0x4831('0x4c')]=_['keys'](db[_0x4831('0xa0')]['rawAttributes']);_0x503f2e['query']=_[_0x4831('0x4e')](_0x254813['query']);_0x503f2e['filters']=_['intersection'](_0x503f2e['model'],_0x503f2e[_0x4831('0x4d')]);_0x56ec88['attributes']=_[_0x4831('0x51')](_0x503f2e[_0x4831('0x4c')],qs[_0x4831('0x52')](_0x254813[_0x4831('0x4d')][_0x4831('0x52')]));_0x56ec88[_0x4831('0x50')]=_0x56ec88['attributes']['length']?_0x56ec88[_0x4831('0x50')]:_0x503f2e['model'];if(!_0x254813[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x56ec88[_0x4831('0x56')]=qs[_0x4831('0x56')](_0x254813[_0x4831('0x4d')][_0x4831('0x56')]);_0x56ec88[_0x4831('0x35')]=qs[_0x4831('0x35')](_0x254813[_0x4831('0x4d')][_0x4831('0x35')]);}_0x56ec88[_0x4831('0x6c')]=qs[_0x4831('0x57')](_0x254813['query'][_0x4831('0x57')]);_0x56ec88[_0x4831('0x59')]=qs[_0x4831('0x4f')](_[_0x4831('0x58')](_0x254813['query'],_0x503f2e[_0x4831('0x4f')]));_0x56ec88[_0x4831('0x59')][_0x4831('0x68')]=_0x22ad58['id'];if(_0x254813['query'][_0x4831('0x6d')]){_0x56ec88['where']=_[_0x4831('0x61')](_0x56ec88[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x56ec88[_0x4831('0x50')],function(_0x42f49b){var _0x3195bd={};_0x3195bd[_0x42f49b]={'$like':'%'+_0x254813[_0x4831('0x4d')][_0x4831('0x6d')]+'%'};return _0x3195bd;})});}if(_0x254813['query'][_0x4831('0xa1')]){var _0x28bce3=_0x254813[_0x4831('0x4d')][_0x4831('0xa1')][_0x4831('0xa2')](',');var _0x346e59={};_0x346e59[_0x28bce3[0x0]]={'$gte':moment(_0x28bce3[0x1])[_0x4831('0xa3')](_0x4831('0xa4'))};_0x56ec88[_0x4831('0x59')]=_[_0x4831('0x61')](_0x56ec88['where'],_0x346e59);}_0x56ec88=_['merge']({},_0x56ec88,_0x254813[_0x4831('0x62')]);return db[_0x4831('0xa0')]['count']({'where':_0x56ec88[_0x4831('0x59')]})[_0x4831('0x27')](function(_0x511e3c){_0xab6173[_0x4831('0x34')]=_0x511e3c;if(_0x254813[_0x4831('0x4d')]['includeAll']){_0x56ec88['include']=[{'all':!![]}];}return db[_0x4831('0xa0')][_0x4831('0x5d')](_0x56ec88);})['then'](function(_0x1b4369){_0xab6173[_0x4831('0x5e')]=_0x1b4369;return _0xab6173;});}})[_0x4831('0x27')](respondWithFilteredResult(_0x584f08,_0x56ec88))[_0x4831('0x30')](handleError(_0x584f08,null));};exports[_0x4831('0x3f')]=function(_0x30cd30,_0x598606,_0x570def){var _0x15f9b7,_0x253b09={},_0x37641f;if(_0x30cd30[_0x4831('0x65')]['to']){_0x37641f=_0x30cd30['body']['to'][_0x4831('0xa2')](',')[0x0];}return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x30cd30[_0x4831('0x60')]['id']},'include':[{'model':db[_0x4831('0xa5')],'as':_0x4831('0xa6'),'include':[{'model':db['CmContact'],'as':_0x4831('0xa7'),'where':{'email':_0x37641f},'limit':0x1,'order':[['updatedAt',_0x4831('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0x4831('0x44'),'raw':!![]}]})[_0x4831('0x27')](handleEntityNotFound(_0x598606,null))[_0x4831('0x27')](function(_0x251d4b){if(_0x251d4b){_0x15f9b7=_0x251d4b;if(_0x251d4b[_0x4831('0x44')]){if(_[_0x4831('0x76')](_0x30cd30[_0x4831('0x65')][_0x4831('0xa9')])){_0x30cd30['body'][_0x4831('0xa9')]=util['format']('%s\x20<%s>',_0x251d4b['name'],_0x251d4b[_0x4831('0x74')]||_0x251d4b[_0x4831('0x44')]['user']);}if(_0x30cd30[_0x4831('0x65')][_0x4831('0xaa')]&&_0x30cd30[_0x4831('0x65')][_0x4831('0xaa')][_0x4831('0x53')]){for(var _0x19e054=0x0;_0x19e054<_0x30cd30[_0x4831('0x65')][_0x4831('0xaa')]['length'];_0x19e054+=0x1){_0x30cd30['body'][_0x4831('0xaa')][_0x19e054]={'filename':_0x30cd30['body'][_0x4831('0xaa')][_0x19e054][_0x4831('0x3e')],'path':path[_0x4831('0xab')](config[_0x4831('0xac')],_0x4831('0xad'),_0x30cd30['body'][_0x4831('0xaa')][_0x19e054][_0x4831('0xae')])};}}var _0xbc98da={'tls':{'rejectUnauthorized':![]}};if(_[_0x4831('0x76')](_0x251d4b['Smtp'][_0x4831('0x80')])){if(_0x251d4b[_0x4831('0x44')][_0x4831('0x7d')]){_0xbc98da[_0x4831('0xaf')]={'user':_0x251d4b['Smtp'][_0x4831('0x81')],'pass':_0x251d4b[_0x4831('0x44')][_0x4831('0x7b')]};}_0xbc98da[_0x4831('0x7e')]=_0x251d4b['Smtp']['host'];_0xbc98da[_0x4831('0x7f')]=_0x251d4b[_0x4831('0x44')][_0x4831('0x7f')];_0xbc98da[_0x4831('0xb0')]=_0x251d4b[_0x4831('0x44')][_0x4831('0xb0')];}else{_0xbc98da[_0x4831('0x80')]=_0x251d4b[_0x4831('0x44')][_0x4831('0x80')];_0xbc98da[_0x4831('0xaf')]={'user':_0x251d4b['Smtp']['user'],'pass':_0x251d4b['Smtp'][_0x4831('0x7b')]};}return respondWithRpcPromise('SendMail',_0x4831('0xb1'),{'account':_0xbc98da,'message':_0x30cd30['body']});}else{throw new Error(_0x4831('0xb2'));}}})[_0x4831('0x27')](function(_0x68e93c){if(_0x68e93c){_0x253b09=_0x68e93c;if(_0x15f9b7[_0x4831('0xa6')]){if(_0x15f9b7[_0x4831('0xa6')][_0x4831('0xa7')][_0x4831('0x53')]){return _0x15f9b7[_0x4831('0xa6')][_0x4831('0xa7')][0x0];}else{return db[_0x4831('0x92')]['create'](_[_0x4831('0x1c')](_0x30cd30['body'],{'firstName':_0x30cd30[_0x4831('0x65')]['to'],'email':_0x30cd30[_0x4831('0x65')]['to'],'phone':_0x30cd30['body']['to'],'ListId':_0x15f9b7['ListId']}));}}else{throw new Error(_0x4831('0xb2'));}}})[_0x4831('0x27')](function(_0x5e7050){if(_0x5e7050){var _0x4671b5={'UserId':_0x30cd30[_0x4831('0x81')]['id'],'ContactId':_0x5e7050['id'],'MailAccountId':_0x15f9b7['id'],'inReplyTo':_0x253b09['messageId'],'to':_0x30cd30[_0x4831('0x65')][_0x4831('0xa9')],'cc':_0x30cd30[_0x4831('0x65')]['cc'],'subject':_0x30cd30[_0x4831('0x65')][_0x4831('0xb3')],'attach':_0x30cd30['body'][_0x4831('0xb4')],'firstMsgDirection':_0x4831('0xb5'),'lastMsgAt':moment()[_0x4831('0xa3')](_0x4831('0xa4')),'lastMsgDirection':'out','lastMsgBody':_0x30cd30[_0x4831('0x65')][_0x4831('0x65')],'Messages':[_['merge'](_0x30cd30[_0x4831('0x65')],{'messageId':_0x253b09[_0x4831('0xb6')],'sentAt':moment()[_0x4831('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x15f9b7['id'],'UserId':_0x30cd30[_0x4831('0x81')]['id'],'ContactId':_0x5e7050['id']})]};if(_0x30cd30[_0x4831('0x65')][_0x4831('0xb7')]){_0x4671b5=_[_0x4831('0x61')](_0x4671b5,_0x30cd30[_0x4831('0x65')][_0x4831('0xb7')]);}return db['MailInteraction'][_0x4831('0x6a')](_0x4671b5,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x4831('0x27')](respondWithResult(_0x598606,null))[_0x4831('0x30')](handleError(_0x598606,null));};exports[_0x4831('0xb8')]=function(_0x6c8f26,_0x14d4bd,_0x533436){return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x6c8f26[_0x4831('0x60')]['id']},'include':[{'model':db[_0x4831('0x43')],'as':'Smtp','raw':!![]}]})[_0x4831('0x27')](handleEntityNotFound(_0x14d4bd,null))[_0x4831('0x27')](function(_0x4f6bb1){if(_0x4f6bb1&&_0x4f6bb1[_0x4831('0x44')]){var _0x1117bf={'id':_0x4f6bb1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4f6bb1[_0x4831('0x44')]['service']){_0x1117bf[_0x4831('0x80')]=_0x4f6bb1[_0x4831('0x44')][_0x4831('0x80')];}else{_0x1117bf[_0x4831('0x7e')]=_0x4f6bb1[_0x4831('0x44')]['host'];_0x1117bf[_0x4831('0x7f')]=_0x4f6bb1[_0x4831('0x44')]['port'];_0x1117bf[_0x4831('0xb0')]=_0x4f6bb1[_0x4831('0x44')][_0x4831('0xb0')];}if(_0x4f6bb1[_0x4831('0x44')]['authentication']){_0x1117bf[_0x4831('0xaf')]={'user':_0x4f6bb1[_0x4831('0x44')][_0x4831('0x81')],'pass':_0x4f6bb1[_0x4831('0x44')][_0x4831('0x7b')]};}return respondWithRpcPromise(_0x4831('0xb9'),_0x4831('0xb8'),{'account':_0x1117bf});}})[_0x4831('0x27')](respondWithResult(_0x14d4bd,null))['catch'](handleError(_0x14d4bd,null));};exports[_0x4831('0x3b')]=function(_0x1583cc,_0x24dedc){return db[_0x4831('0x48')]['find']({'where':{'id':_0x1583cc['params']['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x24dedc,null))[_0x4831('0x27')](function(_0x3580c8){if(_0x3580c8&&_0x3580c8[_0x4831('0x80')]){throw new db[(_0x4831('0x23'))][(_0x4831('0x24'))](_0x4831('0xba'));}return _0x3580c8;})[_0x4831('0x27')](removeEntity(_0x24dedc,null))[_0x4831('0x30')](handleError(_0x24dedc,null));};exports[_0x4831('0xbb')]=function(_0xde35d7,_0x15a13f,_0x58bcef){return db['MailAccount'][_0x4831('0x63')]({'where':{'id':_0xde35d7[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x15a13f,null))[_0x4831('0x27')](function(_0x128e1c){if(_0x128e1c){return _0x128e1c[_0x4831('0xbb')](_0xde35d7[_0x4831('0x65')][_0x4831('0x70')],_[_0x4831('0xbc')](_0xde35d7['body'],[_0x4831('0x70'),'id'])||{})[_0x4831('0xbd')](function(_0x166e5e){for(var _0x5b2110=0x0;_0x5b2110<_0xde35d7[_0x4831('0x65')][_0x4831('0x70')][_0x4831('0x53')];_0x5b2110+=0x1){socket[_0x4831('0xbe')]('userMailAccount:save',{'UserId':_0xde35d7[_0x4831('0x65')][_0x4831('0x70')][_0x5b2110],'MailAccountId':_0xde35d7[_0x4831('0x60')]['id']});}return _0x166e5e;});}})['then'](respondWithResult(_0x15a13f,null))[_0x4831('0x30')](handleError(_0x15a13f,null));};exports[_0x4831('0xbf')]=function(_0x4fe5bb,_0x12464c,_0x2f94cb){return db[_0x4831('0x48')][_0x4831('0x63')]({'where':{'id':_0x4fe5bb[_0x4831('0x60')]['id']}})['then'](handleEntityNotFound(_0x12464c,null))[_0x4831('0x27')](function(_0x47808f){if(_0x47808f){return _0x47808f[_0x4831('0xbf')](_0x4fe5bb[_0x4831('0x4d')][_0x4831('0x70')])['then'](function(){if(_['isArray'](_0x4fe5bb[_0x4831('0x4d')][_0x4831('0x70')])){for(var _0x2f2fa7=0x0;_0x2f2fa7<_0x4fe5bb[_0x4831('0x4d')][_0x4831('0x70')]['length'];_0x2f2fa7+=0x1){socket['emit'](_0x4831('0xc0'),{'UserId':Number(_0x4fe5bb[_0x4831('0x4d')][_0x4831('0x70')][_0x2f2fa7]),'MailAccountId':Number(_0x4fe5bb[_0x4831('0x60')]['id'])});}}else{socket[_0x4831('0xbe')](_0x4831('0xc0'),{'UserId':Number(_0x4fe5bb[_0x4831('0x4d')]['ids']),'MailAccountId':Number(_0x4fe5bb[_0x4831('0x60')]['id'])});}});}})[_0x4831('0x27')](respondWithStatusCode(_0x12464c,null))['catch'](handleError(_0x12464c,null));};exports[_0x4831('0xc1')]=function(_0x1c6c5f,_0x1b4c8b,_0x10302c){var _0x3ba5cd={};var _0x2da2db={};var _0x329327;var _0x4396d9;return db[_0x4831('0x48')][_0x4831('0x6b')]({'where':{'id':_0x1c6c5f[_0x4831('0x60')]['id']}})[_0x4831('0x27')](handleEntityNotFound(_0x1b4c8b,null))[_0x4831('0x27')](function(_0x2594f5){if(_0x2594f5){_0x329327=_0x2594f5;_0x2da2db['model']=_['keys'](db[_0x4831('0xc2')][_0x4831('0x49')]);_0x2da2db[_0x4831('0x4d')]=_[_0x4831('0x4e')](_0x1c6c5f[_0x4831('0x4d')]);_0x2da2db[_0x4831('0x4f')]=_['intersection'](_0x2da2db['model'],_0x2da2db['query']);_0x3ba5cd[_0x4831('0x50')]=_[_0x4831('0x51')](_0x2da2db[_0x4831('0x4c')],qs[_0x4831('0x52')](_0x1c6c5f[_0x4831('0x4d')][_0x4831('0x52')]));_0x3ba5cd[_0x4831('0x50')]=_0x3ba5cd[_0x4831('0x50')][_0x4831('0x53')]?_0x3ba5cd['attributes']:_0x2da2db[_0x4831('0x4c')];_0x3ba5cd[_0x4831('0x6c')]=qs[_0x4831('0x57')](_0x1c6c5f[_0x4831('0x4d')][_0x4831('0x57')]);_0x3ba5cd['where']=qs[_0x4831('0x4f')](_[_0x4831('0x58')](_0x1c6c5f['query'],_0x2da2db[_0x4831('0x4f')]));if(_0x1c6c5f[_0x4831('0x4d')][_0x4831('0x6d')]){_0x3ba5cd[_0x4831('0x59')]=_[_0x4831('0x61')](_0x3ba5cd[_0x4831('0x59')],{'$or':_[_0x4831('0x47')](_0x3ba5cd[_0x4831('0x50')],function(_0x2d27d7){var _0x352aa0={};_0x352aa0[_0x2d27d7]={'$like':'%'+_0x1c6c5f[_0x4831('0x4d')]['filter']+'%'};return _0x352aa0;})});}_0x3ba5cd=_[_0x4831('0x61')]({},_0x3ba5cd,_0x1c6c5f['options']);return _0x329327[_0x4831('0xc1')](_0x3ba5cd);}})['then'](function(_0x5df099){if(_0x5df099){_0x4396d9=_0x5df099['length'];if(!_0x1c6c5f[_0x4831('0x4d')][_0x4831('0x54')](_0x4831('0x55'))){_0x3ba5cd['limit']=qs[_0x4831('0x56')](_0x1c6c5f[_0x4831('0x4d')][_0x4831('0x56')]);_0x3ba5cd[_0x4831('0x35')]=qs['offset'](_0x1c6c5f['query'][_0x4831('0x35')]);}return _0x329327[_0x4831('0xc1')](_0x3ba5cd);}})[_0x4831('0x27')](function(_0x57b862){if(_0x57b862){return _0x57b862?{'count':_0x4396d9,'rows':_0x57b862}:null;}})[_0x4831('0x27')](respondWithResult(_0x1b4c8b,null))['catch'](handleError(_0x1b4c8b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 03b22f3..8a8a59a 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 _0x9760=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x7ab177,_0x497d65){var _0x47671f=function(_0x362f38){while(--_0x362f38){_0x7ab177['push'](_0x7ab177['shift']());}};_0x47671f(++_0x497d65);}(_0x9760,0xae));var _0x0976=function(_0x146bbb,_0x359ea7){_0x146bbb=_0x146bbb-0x0;var _0x4b287c=_0x9760[_0x146bbb];return _0x4b287c;};'use strict';var EventEmitter=require(_0x0976('0x0'));var MailAccount=require(_0x0976('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0976('0x2')](0x0);var events={'afterCreate':_0x0976('0x3'),'afterUpdate':_0x0976('0x4'),'afterDestroy':'remove'};function emitEvent(_0x441389){return function(_0x31f72c,_0x566b1e,_0x3a5554){MailAccountEvents[_0x0976('0x5')](_0x441389+':'+_0x31f72c['id'],_0x31f72c);MailAccountEvents['emit'](_0x441389,_0x31f72c);_0x3a5554(null);};}for(var e in events){if(events[_0x0976('0x6')](e)){var event=events[e];MailAccount[_0x0976('0x7')](e,emitEvent(event));}}module[_0x0976('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x50f9=['exports','events','MailAccount','save','update','emit','hasOwnProperty','hook'];(function(_0x3780c6,_0x126a4d){var _0xa2eae5=function(_0xf39820){while(--_0xf39820){_0x3780c6['push'](_0x3780c6['shift']());}};_0xa2eae5(++_0x126a4d);}(_0x50f9,0xa1));var _0x950f=function(_0x50a488,_0x5ab3e9){_0x50a488=_0x50a488-0x0;var _0x382254=_0x50f9[_0x50a488];return _0x382254;};'use strict';var EventEmitter=require(_0x950f('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x950f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x950f('0x2'),'afterUpdate':_0x950f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x73daac){return function(_0x244890,_0x566af0,_0x41f79e){MailAccountEvents[_0x950f('0x4')](_0x73daac+':'+_0x244890['id'],_0x244890);MailAccountEvents[_0x950f('0x4')](_0x73daac,_0x244890);_0x41f79e(null);};}for(var e in events){if(events[_0x950f('0x5')](e)){var event=events[e];MailAccount[_0x950f('0x6')](e,emitEvent(event));}}module[_0x950f('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3e8a301..02a10b0 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 _0xb2fa=['rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','../../config/logger','api','bluebird','path'];(function(_0x28aed4,_0x2e2f5c){var _0x2a1484=function(_0x17ea09){while(--_0x17ea09){_0x28aed4['push'](_0x28aed4['shift']());}};_0x2a1484(++_0x2e2f5c);}(_0xb2fa,0x10e));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab2f('0x0'));var util=require('util');var logger=require(_0xab2f('0x1'))(_0xab2f('0x2'));var moment=require('moment');var BPromise=require(_0xab2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab2f('0x4'));var rimraf=require(_0xab2f('0x5'));var config=require(_0xab2f('0x6'));var attributes=require(_0xab2f('0x7'));module['exports']=function(_0x523302,_0x14fa92){return _0x523302[_0xab2f('0x8')](_0xab2f('0x9'),attributes,{'tableName':_0xab2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x8e0a,0xb5));var _0xa8e0=function(_0x79e408,_0x12f9e3){_0x79e408=_0x79e408-0x0;var _0x26c7ab=_0x8e0a[_0x79e408];return _0x26c7ab;};'use strict';var _=require(_0xa8e0('0x0'));var util=require(_0xa8e0('0x1'));var logger=require('../../config/logger')(_0xa8e0('0x2'));var moment=require(_0xa8e0('0x3'));var BPromise=require(_0xa8e0('0x4'));var rp=require(_0xa8e0('0x5'));var fs=require('fs');var path=require(_0xa8e0('0x6'));var rimraf=require(_0xa8e0('0x7'));var config=require(_0xa8e0('0x8'));var attributes=require(_0xa8e0('0x9'));module[_0xa8e0('0xa')]=function(_0x30abc9,_0x329d59){return _0x30abc9[_0xa8e0('0xb')](_0xa8e0('0xc'),attributes,{'tableName':_0xa8e0('0xd'),'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 e3ccf63..a3ff48f 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 _0xaf80=['spread','update','format','interaction','create','attachments','originTo','bcc','Attachment','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','model','map','ShowMailAccount','find','where','NotifyMailAccount','mail','keys','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','MailAccount','account','CmList','List','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','asc','autoclose','length','*,*,*,*','CmContact','List\x20not\x20found','contact','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found'];(function(_0x1192cc,_0x297dac){var _0x99befb=function(_0x4aa0eb){while(--_0x4aa0eb){_0x1192cc['push'](_0x1192cc['shift']());}};_0x99befb(++_0x297dac);}(_0xaf80,0x1ef));var _0x0af8=function(_0x15ef01,_0x5477e0){_0x15ef01=_0x15ef01-0x0;var _0x12c10e=_0xaf80[_0x15ef01];return _0x12c10e;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232c});config['redis']=_[_0x0af8('0xa')](config['redis'],{'host':_0x0af8('0xb'),'port':0x18eb});var socket=require(_0x0af8('0xc'))(new Redis(config[_0x0af8('0xd')]));require('./mailAccount.socket')[_0x0af8('0xe')](socket);function respondWithRpcPromise(_0x3fbdb3,_0x2f4267,_0x55964b){return new BPromise(function(_0x52f25f,_0x429915){return client[_0x0af8('0xf')](_0x3fbdb3,_0x55964b)[_0x0af8('0x10')](function(_0x19d65e){logger[_0x0af8('0x11')]('MailAccount,\x20%s,\x20%s',_0x2f4267,_0x0af8('0x12'));logger[_0x0af8('0x13')](_0x0af8('0x14'),_0x2f4267,_0x0af8('0x12'),JSON[_0x0af8('0x15')](_0x19d65e));if(_0x19d65e[_0x0af8('0x16')]){if(_0x19d65e[_0x0af8('0x16')]['code']===0x1f4){logger['error'](_0x0af8('0x17'),_0x2f4267,_0x19d65e[_0x0af8('0x16')][_0x0af8('0x18')]);return _0x429915(_0x19d65e[_0x0af8('0x16')][_0x0af8('0x18')]);}logger[_0x0af8('0x16')](_0x0af8('0x17'),_0x2f4267,_0x19d65e[_0x0af8('0x16')]['message']);return _0x52f25f(_0x19d65e['error']['message']);}else{logger[_0x0af8('0x11')](_0x0af8('0x17'),_0x2f4267,'request\x20sent');_0x52f25f(_0x19d65e[_0x0af8('0x19')][_0x0af8('0x18')]);}})[_0x0af8('0x1a')](function(_0x4a5851){logger['error']('MailAccount,\x20%s,\x20%s',_0x2f4267,_0x4a5851);_0x429915(_0x4a5851);});});}exports[_0x0af8('0x1b')]=function(_0x1eb805){var _0x5626f8=this;return new Promise(function(_0x2baa24,_0x4891e6){return db['MailAccount'][_0x0af8('0x1c')]({'raw':_0x1eb805[_0x0af8('0x1d')]?_0x1eb805[_0x0af8('0x1d')][_0x0af8('0x1e')]===undefined?!![]:![]:!![],'where':_0x1eb805[_0x0af8('0x1d')]?_0x1eb805['options']['where']||null:null,'attributes':_0x1eb805[_0x0af8('0x1d')]?_0x1eb805[_0x0af8('0x1d')][_0x0af8('0x1f')]||null:null,'limit':_0x1eb805[_0x0af8('0x1d')]?_0x1eb805[_0x0af8('0x1d')][_0x0af8('0x20')]||null:null,'include':_0x1eb805[_0x0af8('0x1d')]?_0x1eb805[_0x0af8('0x1d')]['include']?_['map'](_0x1eb805[_0x0af8('0x1d')][_0x0af8('0x21')],function(_0x359583){return{'model':db[_0x359583[_0x0af8('0x22')]],'as':_0x359583['as'],'attributes':_0x359583['attributes'],'include':_0x359583['include']?_[_0x0af8('0x23')](_0x359583[_0x0af8('0x21')],function(_0x23a102){return{'model':db[_0x23a102[_0x0af8('0x22')]],'as':_0x23a102['as'],'attributes':_0x23a102[_0x0af8('0x1f')],'include':_0x23a102[_0x0af8('0x21')]?_[_0x0af8('0x23')](_0x23a102['include'],function(_0x34aa8b){return{'model':db[_0x34aa8b[_0x0af8('0x22')]],'as':_0x34aa8b['as'],'attributes':_0x34aa8b[_0x0af8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0af8('0x10')](function(_0x1b94cf){logger[_0x0af8('0x11')](_0x0af8('0x1b'),_0x1eb805);logger[_0x0af8('0x13')](_0x0af8('0x1b'),_0x1eb805,JSON[_0x0af8('0x15')](_0x1b94cf));_0x2baa24(_0x1b94cf);})[_0x0af8('0x1a')](function(_0x47a75d){logger[_0x0af8('0x16')]('GetMailAccount',_0x47a75d[_0x0af8('0x18')],_0x1eb805);_0x4891e6(_0x5626f8['error'](0x1f4,_0x47a75d[_0x0af8('0x18')]));});});};exports[_0x0af8('0x24')]=function(_0x535352){var _0x14cf8b=this;return new Promise(function(_0x2466c3,_0x34b3e5){return db['MailAccount'][_0x0af8('0x25')]({'raw':_0x535352[_0x0af8('0x1d')]?_0x535352[_0x0af8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x535352[_0x0af8('0x1d')]?_0x535352[_0x0af8('0x1d')][_0x0af8('0x26')]||null:null,'attributes':_0x535352[_0x0af8('0x1d')]?_0x535352[_0x0af8('0x1d')][_0x0af8('0x1f')]||null:null,'include':_0x535352['options']?_0x535352[_0x0af8('0x1d')][_0x0af8('0x21')]?_[_0x0af8('0x23')](_0x535352[_0x0af8('0x1d')][_0x0af8('0x21')],function(_0x42dec5){return{'model':db[_0x42dec5[_0x0af8('0x22')]],'as':_0x42dec5['as'],'attributes':_0x42dec5[_0x0af8('0x1f')],'include':_0x42dec5[_0x0af8('0x21')]?_[_0x0af8('0x23')](_0x42dec5[_0x0af8('0x21')],function(_0x156b37){return{'model':db[_0x156b37['model']],'as':_0x156b37['as'],'attributes':_0x156b37[_0x0af8('0x1f')],'include':_0x156b37[_0x0af8('0x21')]?_[_0x0af8('0x23')](_0x156b37[_0x0af8('0x21')],function(_0x159d72){return{'model':db[_0x159d72[_0x0af8('0x22')]],'as':_0x159d72['as'],'attributes':_0x159d72[_0x0af8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22143f){logger[_0x0af8('0x11')](_0x0af8('0x24'),_0x535352);logger['debug'](_0x0af8('0x24'),_0x535352,JSON[_0x0af8('0x15')](_0x22143f));_0x2466c3(_0x22143f);})[_0x0af8('0x1a')](function(_0x4ad618){logger[_0x0af8('0x16')](_0x0af8('0x24'),_0x4ad618[_0x0af8('0x18')],_0x535352);_0x34b3e5(_0x14cf8b[_0x0af8('0x16')](0x1f4,_0x4ad618[_0x0af8('0x18')]));});});};exports[_0x0af8('0x27')]=function(_0x258872){var _0x5e900a=this;return new Promise(function(_0x586924,_0x399474){var _0x39f87c={'body':_0x258872['body'],'channel':_0x0af8('0x28')};var _0x4486b8=_['difference'](_[_0x0af8('0x29')](db['CmContact'][_0x0af8('0x2a')]),[_0x0af8('0x2b'),'updatedAt',_0x0af8('0x2c'),_0x0af8('0x2d')]);var _0x497695=![];if(_0x258872[_0x0af8('0x2e')]['id']){delete _0x258872['body']['id'];}if(_[_0x0af8('0x2f')](_0x258872[_0x0af8('0x2e')][_0x0af8('0x30')])){return _0x399474(_0x5e900a['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0af8('0x2f')](_0x258872[_0x0af8('0x2e')][_0x0af8('0x2e')])||_0x258872[_0x0af8('0x2e')]['body']===''){return _0x399474(_0x5e900a[_0x0af8('0x16')](0x1f4,_0x0af8('0x31')));}if(_[_0x0af8('0x2f')](_0x258872['body'][_0x0af8('0x32')])){return _0x399474(_0x5e900a[_0x0af8('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4486b8));}if(!_[_0x0af8('0x33')](_0x4486b8,_0x258872['body'][_0x0af8('0x32')])){return _0x399474(_0x5e900a['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4486b8));}var _0x588783={};_0x588783[_0x258872[_0x0af8('0x2e')]['mapKey']]=_0x258872[_0x0af8('0x2e')]['from'];return db[_0x0af8('0x34')][_0x0af8('0x25')]({'where':{'id':_0x258872[_0x0af8('0x35')]['id']},'include':[{'model':db[_0x0af8('0x36')],'as':_0x0af8('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x588783,'limit':0x1,'order':[[_0x0af8('0x38'),_0x0af8('0x39')]]}]},{'model':db[_0x0af8('0x3a')],'as':_0x0af8('0x3b')},{'model':db[_0x0af8('0x3c')],'as':_0x0af8('0x3d')}]})[_0x0af8('0x10')](function(_0x578e52){if(_0x578e52&&_0x578e52['List']){var _0x45f252=_0x578e52[_0x0af8('0x3e')]({'plain':!![]});_0x39f87c[_0x0af8('0x35')]=_[_0x0af8('0x3f')](_0x45f252,['Applications',_0x0af8('0x37')]);_0x39f87c[_0x0af8('0x40')]=_0x45f252[_0x0af8('0x3b')];_0x39f87c[_0x0af8('0x41')]=_0x45f252[_0x0af8('0x37')];_0x39f87c[_0x0af8('0x40')]=_['orderBy'](_0x39f87c[_0x0af8('0x40')],['priority'],[_0x0af8('0x42')]);if(_0x39f87c['account']&&_0x39f87c[_0x0af8('0x35')][_0x0af8('0x43')]){_0x39f87c[_0x0af8('0x40')]['push']({'id':0x0,'priority':_0x39f87c[_0x0af8('0x40')][_0x0af8('0x44')]+0x1,'app':'close','appdata':_0x0af8('0x43'),'interval':_0x0af8('0x45')});}if(_0x39f87c[_0x0af8('0x35')][_0x0af8('0x3b')]){delete _0x39f87c[_0x0af8('0x35')][_0x0af8('0x3b')];}if(_0x39f87c[_0x0af8('0x35')]['List']){delete _0x39f87c[_0x0af8('0x35')][_0x0af8('0x37')];}if(_0x45f252['List']['Contacts'][_0x0af8('0x44')]){return _0x45f252[_0x0af8('0x37')]['Contacts'][0x0];}var _0x2dd0ed=_[_0x0af8('0xa')](_0x258872['body'],{'firstName':_0x258872[_0x0af8('0x2e')]['from'],'ListId':_0x45f252['ListId']});_0x2dd0ed[_0x258872[_0x0af8('0x2e')][_0x0af8('0x32')]]=_0x258872['body'][_0x0af8('0x30')];return db[_0x0af8('0x46')]['create'](_0x2dd0ed);}else{throw new Error(_0x0af8('0x47'));}})['then'](function(_0x3d5c24){_0x39f87c[_0x0af8('0x48')]=_0x3d5c24;if(_0x3d5c24){if(!_0x258872['body']['message'][_0x0af8('0x49')]){_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x49')]=rs['generate']()+'\x20'+_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x30')];}var _0x56eaa1={'ContactId':_0x3d5c24['id'],'MailAccountId':_0x258872[_0x0af8('0x35')]['id'],'inReplyTo':_0x258872[_0x0af8('0x2e')]['message']['messageId'],'to':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x30')],'cc':_0x258872['body'][_0x0af8('0x18')]['cc'],'subject':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x4a')],'attach':_0x258872[_0x0af8('0x2e')]['message'][_0x0af8('0x4b')],'lastMsgAt':moment()['format'](_0x0af8('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x258872['body'][_0x0af8('0x2e')]};return db[_0x0af8('0x4d')][_0x0af8('0x25')]({'where':{'closed':![],'MailAccountId':_0x258872[_0x0af8('0x35')]['id']},'include':[{'model':db[_0x0af8('0x4e')],'as':_0x0af8('0x4f'),'attributes':[_0x0af8('0x49')],'where':{'messageId':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')]['inReplyTo']}}]})[_0x0af8('0x10')](function(_0x3df6e4){if(_0x3df6e4){return[_0x3df6e4,![]];}return db[_0x0af8('0x4d')]['create'](_0x56eaa1)['then'](function(_0x298681){return[_0x298681,!![]];});});}else{throw new Error(_0x0af8('0x50'));}})[_0x0af8('0x51')](function(_0x1eabdb,_0x29d286){if(_0x1eabdb){_0x497695=_0x29d286;if(!_0x29d286){return _0x1eabdb[_0x0af8('0x52')]({'inReplyTo':_0x258872['body'][_0x0af8('0x18')]['messageId'],'to':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')]['from'],'cc':_0x258872['body']['message']['cc'],'subject':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x4a')],'attach':_0x1eabdb[_0x0af8('0x4b')]?_0x1eabdb[_0x0af8('0x4b')]:_0x258872[_0x0af8('0x2e')]['message'][_0x0af8('0x4b')],'substatus':null,'substatusAt':moment()[_0x0af8('0x53')](_0x0af8('0x4c')),'lastMsgAt':moment()['format'](_0x0af8('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x258872[_0x0af8('0x2e')]['body']});}else{return _0x1eabdb;}}})[_0x0af8('0x10')](function(_0x1b06fa){_0x39f87c[_0x0af8('0x54')]=_0x1b06fa[_0x0af8('0x3e')]({'plain':!![]});_0x39f87c[_0x0af8('0x54')]['created']=_0x497695;return db[_0x0af8('0x4e')][_0x0af8('0x55')]({'body':_0x258872[_0x0af8('0x2e')][_0x0af8('0x2e')],'MailAccountId':_0x258872['account']['id'],'MailInteractionId':_0x1b06fa['id'],'direction':'in','ContactId':_0x39f87c['contact']['id'],'messageId':_0x258872['body']['message'][_0x0af8('0x49')],'from':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')]['from'],'to':_0x258872['body']['message']['to'],'cc':_0x258872['body'][_0x0af8('0x18')]['cc'],'subject':_0x258872['body'][_0x0af8('0x18')][_0x0af8('0x4a')],'attach':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')]['attach'],'Attachments':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x56')],'originTo':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x57')],'originCc':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')]['originCc'],'bcc':_0x258872[_0x0af8('0x2e')][_0x0af8('0x18')][_0x0af8('0x58')]},{'include':[{'model':db[_0x0af8('0x59')],'as':'Attachments'}]});})[_0x0af8('0x10')](function(_0x43178e){_0x39f87c[_0x0af8('0x18')]=_0x43178e;if(_0x39f87c[_0x0af8('0x54')]['UserId']){return db['User'][_0x0af8('0x25')]({'attributes':['id',_0x0af8('0x5a')],'where':{'id':_0x39f87c[_0x0af8('0x54')][_0x0af8('0x5b')]}})[_0x0af8('0x10')](function(_0x1386e4){if(_0x1386e4){_0x39f87c[_0x0af8('0x40')][_0x0af8('0x5c')]({'id':0x0,'priority':0x0,'app':_0x0af8('0x5d'),'appdata':_0x1386e4[_0x0af8('0x5a')]+','+(_0x39f87c[_0x0af8('0x35')][_0x0af8('0x5e')]||0xa),'interval':_0x0af8('0x45')});}return respondWithRpcPromise(_0x0af8('0x5f'),'startRouting',_0x39f87c);});}return respondWithRpcPromise(_0x0af8('0x5f'),'startRouting',_0x39f87c);})['then'](function(_0x4d643e){_0x586924(_0x4d643e);})[_0x0af8('0x1a')](function(_0x4e0f6c){_0x399474(_0x5e900a['error'](0x1f4,_0x4e0f6c['message']));});});}; \ No newline at end of file +var _0x4b07=['error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','map','model','include','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','account','CmList','List','CmContact','Contacts','DESC','Applications','MailServerOut','Smtp','list','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','Contact\x20not\x20found','spread','subject','format','interaction','get','MailMessage','attachments','originTo','bcc','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','startRouting','Start','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57e656,_0x3fe9f3){var _0x2535b3=function(_0x380acf){while(--_0x380acf){_0x57e656['push'](_0x57e656['shift']());}};_0x2535b3(++_0x3fe9f3);}(_0x4b07,0x1d6));var _0x74b0=function(_0x1cb093,_0x63a105){_0x1cb093=_0x1cb093-0x0;var _0x323476=_0x4b07[_0x1cb093];return _0x323476;};'use strict';var _=require('lodash');var util=require(_0x74b0('0x0'));var moment=require(_0x74b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b0('0x2'));var fs=require('fs');var Redis=require(_0x74b0('0x3'));var db=require(_0x74b0('0x4'))['db'];var utils=require(_0x74b0('0x5'));var logger=require('../../config/logger')(_0x74b0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x74b0('0x7')]({'port':0x232c});config[_0x74b0('0x8')]=_['defaults'](config['redis'],{'host':_0x74b0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74b0('0x8')]));require(_0x74b0('0xa'))[_0x74b0('0xb')](socket);function respondWithRpcPromise(_0x419fab,_0x3a516c,_0x462a84){return new BPromise(function(_0x2382cd,_0x1c1af8){return client[_0x74b0('0xc')](_0x419fab,_0x462a84)[_0x74b0('0xd')](function(_0x2907a8){logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x3a516c,_0x74b0('0x10'));logger[_0x74b0('0x11')](_0x74b0('0x12'),_0x3a516c,'request\x20sent',JSON[_0x74b0('0x13')](_0x2907a8));if(_0x2907a8[_0x74b0('0x14')]){if(_0x2907a8['error'][_0x74b0('0x15')]===0x1f4){logger['error'](_0x74b0('0xf'),_0x3a516c,_0x2907a8[_0x74b0('0x14')]['message']);return _0x1c1af8(_0x2907a8[_0x74b0('0x14')]['message']);}logger[_0x74b0('0x14')]('MailAccount,\x20%s,\x20%s',_0x3a516c,_0x2907a8[_0x74b0('0x14')]['message']);return _0x2382cd(_0x2907a8[_0x74b0('0x14')][_0x74b0('0x16')]);}else{logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x3a516c,_0x74b0('0x10'));_0x2382cd(_0x2907a8[_0x74b0('0x17')][_0x74b0('0x16')]);}})[_0x74b0('0x18')](function(_0x4a2c60){logger['error']('MailAccount,\x20%s,\x20%s',_0x3a516c,_0x4a2c60);_0x1c1af8(_0x4a2c60);});});}exports[_0x74b0('0x19')]=function(_0x4b8893){var _0xf313bc=this;return new Promise(function(_0x41f602,_0xc17e43){return db[_0x74b0('0x1a')]['findAll']({'raw':_0x4b8893[_0x74b0('0x1b')]?_0x4b8893[_0x74b0('0x1b')][_0x74b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b8893[_0x74b0('0x1b')]?_0x4b8893['options'][_0x74b0('0x1d')]||null:null,'attributes':_0x4b8893[_0x74b0('0x1b')]?_0x4b8893[_0x74b0('0x1b')][_0x74b0('0x1e')]||null:null,'limit':_0x4b8893[_0x74b0('0x1b')]?_0x4b8893[_0x74b0('0x1b')][_0x74b0('0x1f')]||null:null,'include':_0x4b8893[_0x74b0('0x1b')]?_0x4b8893[_0x74b0('0x1b')]['include']?_[_0x74b0('0x20')](_0x4b8893['options']['include'],function(_0x2166a5){return{'model':db[_0x2166a5[_0x74b0('0x21')]],'as':_0x2166a5['as'],'attributes':_0x2166a5[_0x74b0('0x1e')],'include':_0x2166a5['include']?_[_0x74b0('0x20')](_0x2166a5[_0x74b0('0x22')],function(_0x1f8b2a){return{'model':db[_0x1f8b2a[_0x74b0('0x21')]],'as':_0x1f8b2a['as'],'attributes':_0x1f8b2a['attributes'],'include':_0x1f8b2a[_0x74b0('0x22')]?_[_0x74b0('0x20')](_0x1f8b2a[_0x74b0('0x22')],function(_0x2163f4){return{'model':db[_0x2163f4[_0x74b0('0x21')]],'as':_0x2163f4['as'],'attributes':_0x2163f4[_0x74b0('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dc537){logger['info'](_0x74b0('0x19'),_0x4b8893);logger[_0x74b0('0x11')]('GetMailAccount',_0x4b8893,JSON[_0x74b0('0x13')](_0x2dc537));_0x41f602(_0x2dc537);})[_0x74b0('0x18')](function(_0x143093){logger['error']('GetMailAccount',_0x143093['message'],_0x4b8893);_0xc17e43(_0xf313bc[_0x74b0('0x14')](0x1f4,_0x143093[_0x74b0('0x16')]));});});};exports['ShowMailAccount']=function(_0x198de5){var _0x40c4f3=this;return new Promise(function(_0x3a77a4,_0x388786){return db[_0x74b0('0x1a')][_0x74b0('0x23')]({'raw':_0x198de5['options']?_0x198de5[_0x74b0('0x1b')][_0x74b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x198de5[_0x74b0('0x1b')]?_0x198de5['options'][_0x74b0('0x1d')]||null:null,'attributes':_0x198de5[_0x74b0('0x1b')]?_0x198de5['options'][_0x74b0('0x1e')]||null:null,'include':_0x198de5[_0x74b0('0x1b')]?_0x198de5[_0x74b0('0x1b')]['include']?_[_0x74b0('0x20')](_0x198de5[_0x74b0('0x1b')][_0x74b0('0x22')],function(_0x4c4bf8){return{'model':db[_0x4c4bf8['model']],'as':_0x4c4bf8['as'],'attributes':_0x4c4bf8[_0x74b0('0x1e')],'include':_0x4c4bf8['include']?_[_0x74b0('0x20')](_0x4c4bf8[_0x74b0('0x22')],function(_0x1c8e59){return{'model':db[_0x1c8e59[_0x74b0('0x21')]],'as':_0x1c8e59['as'],'attributes':_0x1c8e59[_0x74b0('0x1e')],'include':_0x1c8e59[_0x74b0('0x22')]?_[_0x74b0('0x20')](_0x1c8e59[_0x74b0('0x22')],function(_0x1cc750){return{'model':db[_0x1cc750[_0x74b0('0x21')]],'as':_0x1cc750['as'],'attributes':_0x1cc750[_0x74b0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x74b0('0xd')](function(_0xd08f82){logger[_0x74b0('0xe')](_0x74b0('0x24'),_0x198de5);logger[_0x74b0('0x11')](_0x74b0('0x24'),_0x198de5,JSON[_0x74b0('0x13')](_0xd08f82));_0x3a77a4(_0xd08f82);})[_0x74b0('0x18')](function(_0x7ee0ca){logger[_0x74b0('0x14')](_0x74b0('0x24'),_0x7ee0ca[_0x74b0('0x16')],_0x198de5);_0x388786(_0x40c4f3[_0x74b0('0x14')](0x1f4,_0x7ee0ca['message']));});});};exports[_0x74b0('0x25')]=function(_0x5c3c66){var _0x4c37bd=this;return new Promise(function(_0x4fe7da,_0xe249f0){var _0x10fcf5={'body':_0x5c3c66[_0x74b0('0x26')],'channel':_0x74b0('0x27')};var _0x2bd216=_[_0x74b0('0x28')](_['keys'](db['CmContact'][_0x74b0('0x29')]),[_0x74b0('0x2a'),_0x74b0('0x2b'),_0x74b0('0x2c'),_0x74b0('0x2d')]);var _0x589b24=![];if(_0x5c3c66['body']['id']){delete _0x5c3c66['body']['id'];}if(_[_0x74b0('0x2e')](_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x2f')])){return _0xe249f0(_0x4c37bd[_0x74b0('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x74b0('0x2e')](_0x5c3c66[_0x74b0('0x26')]['body'])||_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x26')]===''){return _0xe249f0(_0x4c37bd['error'](0x1f4,_0x74b0('0x30')));}if(_['isNil'](_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x31')])){return _0xe249f0(_0x4c37bd[_0x74b0('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bd216));}if(!_['includes'](_0x2bd216,_0x5c3c66[_0x74b0('0x26')]['mapKey'])){return _0xe249f0(_0x4c37bd[_0x74b0('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bd216));}var _0x30ea94={};_0x30ea94[_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x31')]]=_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x2f')];return db[_0x74b0('0x1a')][_0x74b0('0x23')]({'where':{'id':_0x5c3c66[_0x74b0('0x32')]['id']},'include':[{'model':db[_0x74b0('0x33')],'as':_0x74b0('0x34'),'include':[{'model':db[_0x74b0('0x35')],'as':_0x74b0('0x36'),'where':_0x30ea94,'limit':0x1,'order':[['updatedAt',_0x74b0('0x37')]]}]},{'model':db['MailApplication'],'as':_0x74b0('0x38')},{'model':db[_0x74b0('0x39')],'as':_0x74b0('0x3a')}]})[_0x74b0('0xd')](function(_0x2438a7){if(_0x2438a7&&_0x2438a7[_0x74b0('0x34')]){var _0x4f133b=_0x2438a7['get']({'plain':!![]});_0x10fcf5['account']=_['omit'](_0x4f133b,[_0x74b0('0x38'),_0x74b0('0x34')]);_0x10fcf5['applications']=_0x4f133b[_0x74b0('0x38')];_0x10fcf5[_0x74b0('0x3b')]=_0x4f133b[_0x74b0('0x34')];_0x10fcf5['applications']=_[_0x74b0('0x3c')](_0x10fcf5[_0x74b0('0x3d')],[_0x74b0('0x3e')],[_0x74b0('0x3f')]);if(_0x10fcf5['account']&&_0x10fcf5[_0x74b0('0x32')][_0x74b0('0x40')]){_0x10fcf5[_0x74b0('0x3d')][_0x74b0('0x41')]({'id':0x0,'priority':_0x10fcf5['applications'][_0x74b0('0x42')]+0x1,'app':_0x74b0('0x43'),'appdata':_0x74b0('0x40'),'interval':_0x74b0('0x44')});}if(_0x10fcf5[_0x74b0('0x32')][_0x74b0('0x38')]){delete _0x10fcf5['account']['Applications'];}if(_0x10fcf5['account'][_0x74b0('0x34')]){delete _0x10fcf5[_0x74b0('0x32')][_0x74b0('0x34')];}if(_0x4f133b[_0x74b0('0x34')][_0x74b0('0x36')][_0x74b0('0x42')]){return _0x4f133b['List']['Contacts'][0x0];}var _0x239a1=_['defaults'](_0x5c3c66[_0x74b0('0x26')],{'firstName':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x2f')],'ListId':_0x4f133b[_0x74b0('0x2d')]});_0x239a1[_0x5c3c66['body']['mapKey']]=_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x2f')];return db[_0x74b0('0x35')]['create'](_0x239a1);}else{throw new Error(_0x74b0('0x45'));}})['then'](function(_0x3061fb){_0x10fcf5[_0x74b0('0x46')]=_0x3061fb;if(_0x3061fb){if(!_0x5c3c66['body']['message'][_0x74b0('0x47')]){_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['messageId']=rs['generate']()+'\x20'+_0x5c3c66['body'][_0x74b0('0x16')][_0x74b0('0x2f')];}var _0x203129={'ContactId':_0x3061fb['id'],'MailAccountId':_0x5c3c66[_0x74b0('0x32')]['id'],'inReplyTo':_0x5c3c66[_0x74b0('0x26')]['message'][_0x74b0('0x47')],'to':_0x5c3c66[_0x74b0('0x26')]['message'][_0x74b0('0x2f')],'cc':_0x5c3c66['body']['message']['cc'],'subject':_0x5c3c66['body'][_0x74b0('0x16')]['subject'],'attach':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x48')],'lastMsgAt':moment()['format'](_0x74b0('0x49')),'lastMsgDirection':'in','lastMsgBody':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x26')]};return db[_0x74b0('0x4a')]['find']({'where':{'closed':![],'MailAccountId':_0x5c3c66[_0x74b0('0x32')]['id']},'include':[{'model':db['MailMessage'],'as':_0x74b0('0x4b'),'attributes':['messageId'],'where':{'messageId':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x4c')]}}]})[_0x74b0('0xd')](function(_0x51bee7){if(_0x51bee7){return[_0x51bee7,![]];}return db[_0x74b0('0x4a')][_0x74b0('0x4d')](_0x203129)[_0x74b0('0xd')](function(_0x187d02){return[_0x187d02,!![]];});});}else{throw new Error(_0x74b0('0x4e'));}})[_0x74b0('0x4f')](function(_0x1a9921,_0x1f6859){if(_0x1a9921){_0x589b24=_0x1f6859;if(!_0x1f6859){return _0x1a9921['update']({'inReplyTo':_0x5c3c66['body'][_0x74b0('0x16')][_0x74b0('0x47')],'to':_0x5c3c66['body']['message'][_0x74b0('0x2f')],'cc':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['cc'],'subject':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x50')],'attach':_0x1a9921[_0x74b0('0x48')]?_0x1a9921['attach']:_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0x74b0('0x51')](_0x74b0('0x49')),'lastMsgAt':moment()[_0x74b0('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x26')]});}else{return _0x1a9921;}}})[_0x74b0('0xd')](function(_0x5c4e42){_0x10fcf5[_0x74b0('0x52')]=_0x5c4e42[_0x74b0('0x53')]({'plain':!![]});_0x10fcf5[_0x74b0('0x52')]['created']=_0x589b24;return db[_0x74b0('0x54')]['create']({'body':_0x5c3c66[_0x74b0('0x26')]['body'],'MailAccountId':_0x5c3c66[_0x74b0('0x32')]['id'],'MailInteractionId':_0x5c4e42['id'],'direction':'in','ContactId':_0x10fcf5[_0x74b0('0x46')]['id'],'messageId':_0x5c3c66[_0x74b0('0x26')]['message'][_0x74b0('0x47')],'from':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x2f')],'to':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['to'],'cc':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['cc'],'subject':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x50')],'attach':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x48')],'Attachments':_0x5c3c66['body'][_0x74b0('0x16')][_0x74b0('0x55')],'originTo':_0x5c3c66['body']['message'][_0x74b0('0x56')],'originCc':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')]['originCc'],'bcc':_0x5c3c66[_0x74b0('0x26')][_0x74b0('0x16')][_0x74b0('0x57')]},{'include':[{'model':db[_0x74b0('0x58')],'as':_0x74b0('0x59')}]});})[_0x74b0('0xd')](function(_0x37a328){_0x10fcf5[_0x74b0('0x16')]=_0x37a328;if(_0x10fcf5['interaction'][_0x74b0('0x5a')]){return db[_0x74b0('0x5b')][_0x74b0('0x23')]({'attributes':['id','name'],'where':{'id':_0x10fcf5[_0x74b0('0x52')][_0x74b0('0x5a')]}})[_0x74b0('0xd')](function(_0x39d4b3){if(_0x39d4b3){_0x10fcf5[_0x74b0('0x3d')][_0x74b0('0x5c')]({'id':0x0,'priority':0x0,'app':_0x74b0('0x5d'),'appdata':_0x39d4b3[_0x74b0('0x5e')]+','+(_0x10fcf5[_0x74b0('0x32')][_0x74b0('0x5f')]||0xa),'interval':_0x74b0('0x44')});}return respondWithRpcPromise('Start',_0x74b0('0x60'),_0x10fcf5);});}return respondWithRpcPromise(_0x74b0('0x61'),_0x74b0('0x60'),_0x10fcf5);})['then'](function(_0x2643de){_0x4fe7da(_0x2643de);})[_0x74b0('0x18')](function(_0x594ec5){_0xe249f0(_0x4c37bd[_0x74b0('0x14')](0x1f4,_0x594ec5[_0x74b0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 63ba7a5..ae35548 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 _0x4f5d=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4f5d[_0x16b9ed];return _0x66b1f8;};'use strict';var MailAccountEvents=require(_0xd4f5('0x0'));var events=[_0xd4f5('0x1'),_0xd4f5('0x2'),_0xd4f5('0x3')];function createListener(_0x4548e6,_0x2b9e98){return function(_0x5b9640){_0x2b9e98[_0xd4f5('0x4')](_0x4548e6,_0x5b9640);};}function removeListener(_0x468609,_0xf61335){return function(){MailAccountEvents[_0xd4f5('0x5')](_0x468609,_0xf61335);};}exports[_0xd4f5('0x6')]=function(_0x2c44bb){for(var _0x121bfd=0x0,_0x3ab294=events[_0xd4f5('0x7')];_0x121bfd<_0x3ab294;_0x121bfd++){var _0x1d2d72=events[_0x121bfd];var _0xee2bc=createListener(_0xd4f5('0x8')+_0x1d2d72,_0x2c44bb);MailAccountEvents['on'](_0x1d2d72,_0xee2bc);}}; \ No newline at end of file +var _0xacd6=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xacd6,0xef));var _0x6acd=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0xacd6[_0x5ca353];return _0x4f2fe5;};'use strict';var MailAccountEvents=require(_0x6acd('0x0'));var events=[_0x6acd('0x1'),_0x6acd('0x2'),_0x6acd('0x3')];function createListener(_0x339d03,_0x395606){return function(_0x27beed){_0x395606[_0x6acd('0x4')](_0x339d03,_0x27beed);};}function removeListener(_0xac184f,_0x34bae2){return function(){MailAccountEvents[_0x6acd('0x5')](_0xac184f,_0x34bae2);};}exports[_0x6acd('0x6')]=function(_0x592d42){for(var _0x115a7b=0x0,_0x1c6c37=events[_0x6acd('0x7')];_0x115a7b<_0x1c6c37;_0x115a7b++){var _0x9dec1e=events[_0x115a7b];var _0x1b834a=createListener(_0x6acd('0x8')+_0x9dec1e,_0x592d42);MailAccountEvents['on'](_0x9dec1e,_0x1b834a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a614cd0..1a46171 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 _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x428ea6,_0x1e99c5){var _0x55fc88=function(_0x5ebb7a){while(--_0x5ebb7a){_0x428ea6['push'](_0x428ea6['shift']());}};_0x55fc88(++_0x1e99c5);}(_0x6b20,0xd1));var _0x06b2=function(_0x105581,_0x2c3261){_0x105581=_0x105581-0x0;var _0x44c3e0=_0x6b20[_0x105581];return _0x44c3e0;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')](_0x06b2('0x8'),auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0xb')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0xd')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);module['exports']=router; \ No newline at end of file +var _0x282b=['express','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4b8eb7,_0x395807){var _0x50771d=function(_0x3d85ed){while(--_0x3d85ed){_0x4b8eb7['push'](_0x4b8eb7['shift']());}};_0x50771d(++_0x395807);}(_0x282b,0xec));var _0xb282=function(_0x19f91a,_0x31c29c){_0x19f91a=_0x19f91a-0x0;var _0xa0c60f=_0x282b[_0x19f91a];return _0xa0c60f;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb282('0x5'));var config=require('../../config/environment');var controller=require(_0xb282('0x6'));router[_0xb282('0x7')](_0xb282('0x8'),auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xc')]);router[_0xb282('0xd')]('/:id',auth[_0xb282('0x9')](),controller[_0xb282('0xe')]);module[_0xb282('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 53c2ec4..f864cff 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 _0x802a=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x39b0db,_0x377d57){var _0x857751=function(_0x5f1d94){while(--_0x5f1d94){_0x39b0db['push'](_0x39b0db['shift']());}};_0x857751(++_0x377d57);}(_0x802a,0xe5));var _0xa802=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x802a[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0xa802('0x0'));module[_0xa802('0x1')]={'priority':{'type':Sequelize[_0xa802('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa802('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa802('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa802('0x5')}}; \ No newline at end of file +var _0x3e20=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x483a0f,_0x5c456c){var _0x595579=function(_0x396bb1){while(--_0x396bb1){_0x483a0f['push'](_0x483a0f['shift']());}};_0x595579(++_0x5c456c);}(_0x3e20,0x80));var _0x03e2=function(_0x2158cc,_0x51fafc){_0x2158cc=_0x2158cc-0x0;var _0x5aa42f=_0x3e20[_0x2158cc];return _0x5aa42f;};'use strict';var Sequelize=require(_0x03e2('0x0'));module[_0x03e2('0x1')]={'priority':{'type':Sequelize[_0x03e2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x03e2('0x3')],'allowNull':![],'defaultValue':_0x03e2('0x4')},'appdata':{'type':Sequelize[_0x03e2('0x5')]()},'description':{'type':Sequelize[_0x03e2('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 26f20a0..6e77888 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 _0x215d=['util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','length','include','merge','find','update','body','catch','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x4009b5,_0x4ba0f7){var _0x2d06c2=function(_0x56edb4){while(--_0x56edb4){_0x4009b5['push'](_0x4009b5['shift']());}};_0x2d06c2(++_0x4ba0f7);}(_0x215d,0xdb));var _0xd215=function(_0x38a0b6,_0x1aa9e6){_0x38a0b6=_0x38a0b6-0x0;var _0x4fb245=_0x215d[_0x38a0b6];return _0x4fb245;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd215('0x0'));var zipdir=require(_0xd215('0x1'));var jsonpatch=require(_0xd215('0x2'));var rp=require('request-promise');var moment=require(_0xd215('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd215('0x4'));var util=require(_0xd215('0x5'));var path=require(_0xd215('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd215('0x7'));var fs=require('fs');var _=require(_0xd215('0x8'));var squel=require('squel');var crypto=require(_0xd215('0x9'));var jsforce=require(_0xd215('0xa'));var deskjs=require(_0xd215('0xb'));var toCsv=require(_0xd215('0xc'));var querystring=require('querystring');var Papa=require(_0xd215('0xd'));var Redis=require(_0xd215('0xe'));var authService=require(_0xd215('0xf'));var qs=require(_0xd215('0x10'));var as=require(_0xd215('0x11'));var hardwareService=require(_0xd215('0x12'));var logger=require(_0xd215('0x13'))(_0xd215('0x14'));var utils=require(_0xd215('0x15'));var config=require(_0xd215('0x16'));var db=require(_0xd215('0x17'))['db'];function respondWithStatusCode(_0x3187b3,_0x4507e4){_0x4507e4=_0x4507e4||0xcc;return function(_0x468ee3){if(_0x468ee3){return _0x3187b3[_0xd215('0x18')](_0x4507e4);}return _0x3187b3[_0xd215('0x19')](_0x4507e4)[_0xd215('0x1a')]();};}function respondWithResult(_0x21d80e,_0x2355ea){_0x2355ea=_0x2355ea||0xc8;return function(_0xe71d7a){if(_0xe71d7a){return _0x21d80e['status'](_0x2355ea)[_0xd215('0x1b')](_0xe71d7a);}};}function respondWithFilteredResult(_0x559176,_0x264092){return function(_0x4e2776){if(_0x4e2776){var _0x1d65b9=_0x4e2776['count'],_0x3d3f8c=_0x264092[_0xd215('0x1c')],_0xf21611=_0x264092[_0xd215('0x1c')]+_0x264092[_0xd215('0x1d')],_0x49afbb;if(_0xf21611>=_0x1d65b9){_0xf21611=_0x1d65b9;_0x49afbb=0xc8;}else{_0x49afbb=0xce;}_0x559176[_0xd215('0x19')](_0x49afbb);return _0x559176[_0xd215('0x1e')](_0xd215('0x1f'),_0x3d3f8c+'-'+_0xf21611+'/'+_0x1d65b9)[_0xd215('0x1b')](_0x4e2776);}return null;};}function patchUpdates(_0x3aa640){return function(_0x2d7b46){try{jsonpatch[_0xd215('0x20')](_0x2d7b46,_0x3aa640,!![]);}catch(_0x51d159){return BPromise[_0xd215('0x21')](_0x51d159);}return _0x2d7b46['save']();};}function saveUpdates(_0x32449c,_0x5385ec){return function(_0x15b352){if(_0x15b352){return _0x15b352['update'](_0x32449c)[_0xd215('0x22')](function(_0x2ece5){return _0x2ece5;});}return null;};}function removeEntity(_0x281ea7,_0x1ff9a9){return function(_0x44b9ad){if(_0x44b9ad){return _0x44b9ad[_0xd215('0x23')]()[_0xd215('0x22')](function(){_0x281ea7[_0xd215('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350dea,_0x47dfa5){return function(_0x121bef){if(!_0x121bef){_0x350dea[_0xd215('0x18')](0x194);}return _0x121bef;};}function handleError(_0x3f2f31,_0xbeb34){_0xbeb34=_0xbeb34||0x1f4;return function(_0x5b8ad4){logger[_0xd215('0x24')](_0x5b8ad4[_0xd215('0x25')]);if(_0x5b8ad4[_0xd215('0x26')]){delete _0x5b8ad4['name'];}_0x3f2f31[_0xd215('0x19')](_0xbeb34)[_0xd215('0x27')](_0x5b8ad4);};}exports['show']=function(_0x160eac,_0x2b6824){var _0x49a04e={'raw':!![],'where':{'id':_0x160eac[_0xd215('0x28')]['id']}},_0xd6fef9={};_0xd6fef9[_0xd215('0x29')]=_[_0xd215('0x2a')](db[_0xd215('0x2b')][_0xd215('0x2c')]);_0xd6fef9[_0xd215('0x2d')]=_[_0xd215('0x2a')](_0x160eac['query']);_0xd6fef9[_0xd215('0x2e')]=_[_0xd215('0x2f')](_0xd6fef9[_0xd215('0x29')],_0xd6fef9[_0xd215('0x2d')]);_0x49a04e['attributes']=_[_0xd215('0x2f')](_0xd6fef9[_0xd215('0x29')],qs[_0xd215('0x30')](_0x160eac[_0xd215('0x2d')]['fields']));_0x49a04e['attributes']=_0x49a04e['attributes'][_0xd215('0x31')]?_0x49a04e['attributes']:_0xd6fef9['model'];if(_0x160eac[_0xd215('0x2d')]['includeAll']){_0x49a04e[_0xd215('0x32')]=[{'all':!![]}];}_0x49a04e=_[_0xd215('0x33')]({},_0x49a04e,_0x160eac['options']);return db[_0xd215('0x2b')][_0xd215('0x34')](_0x49a04e)['then'](handleEntityNotFound(_0x2b6824,null))[_0xd215('0x22')](respondWithResult(_0x2b6824,null))['catch'](handleError(_0x2b6824,null));};exports[_0xd215('0x35')]=function(_0x19f987,_0x2548a6){if(_0x19f987[_0xd215('0x36')]['id']){delete _0x19f987[_0xd215('0x36')]['id'];}return db[_0xd215('0x2b')][_0xd215('0x34')]({'where':{'id':_0x19f987['params']['id']}})['then'](handleEntityNotFound(_0x2548a6,null))[_0xd215('0x22')](saveUpdates(_0x19f987[_0xd215('0x36')],null))['then'](respondWithResult(_0x2548a6,null))[_0xd215('0x37')](handleError(_0x2548a6,null));};exports[_0xd215('0x23')]=function(_0x3c3ceb,_0x58559c){return db[_0xd215('0x2b')][_0xd215('0x34')]({'where':{'id':_0x3c3ceb[_0xd215('0x28')]['id']}})['then'](handleEntityNotFound(_0x58559c,null))[_0xd215('0x22')](removeEntity(_0x58559c,null))['catch'](handleError(_0x58559c,null));}; \ No newline at end of file +var _0xc1e6=['fields','length','merge','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','params','model','MailApplication','rawAttributes','query','keys','filters','attributes','intersection'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc1e6,0xe6));var _0x6c1e=function(_0x3d4d9a,_0x5d9cf6){_0x3d4d9a=_0x3d4d9a-0x0;var _0x43b947=_0xc1e6[_0x3d4d9a];return _0x43b947;};'use strict';var pdf=require(_0x6c1e('0x0'));var emlformat=require(_0x6c1e('0x1'));var rimraf=require(_0x6c1e('0x2'));var zipdir=require(_0x6c1e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1e('0x4'));var moment=require(_0x6c1e('0x5'));var BPromise=require(_0x6c1e('0x6'));var Mustache=require(_0x6c1e('0x7'));var util=require(_0x6c1e('0x8'));var path=require(_0x6c1e('0x9'));var sox=require(_0x6c1e('0xa'));var csv=require(_0x6c1e('0xb'));var ejs=require(_0x6c1e('0xc'));var fs=require('fs');var _=require(_0x6c1e('0xd'));var squel=require(_0x6c1e('0xe'));var crypto=require(_0x6c1e('0xf'));var jsforce=require(_0x6c1e('0x10'));var deskjs=require(_0x6c1e('0x11'));var toCsv=require(_0x6c1e('0xb'));var querystring=require(_0x6c1e('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c1e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c1e('0x14'));var logger=require(_0x6c1e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6c1e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57413b,_0x5d593a){_0x5d593a=_0x5d593a||0xcc;return function(_0xc8ef4e){if(_0xc8ef4e){return _0x57413b[_0x6c1e('0x17')](_0x5d593a);}return _0x57413b[_0x6c1e('0x18')](_0x5d593a)[_0x6c1e('0x19')]();};}function respondWithResult(_0x11cc1e,_0x3ff9ce){_0x3ff9ce=_0x3ff9ce||0xc8;return function(_0x5697e5){if(_0x5697e5){return _0x11cc1e[_0x6c1e('0x18')](_0x3ff9ce)[_0x6c1e('0x1a')](_0x5697e5);}};}function respondWithFilteredResult(_0x5d8d4a,_0x2fdf6b){return function(_0x272573){if(_0x272573){var _0x381a6d=_0x272573[_0x6c1e('0x1b')],_0x58941b=_0x2fdf6b[_0x6c1e('0x1c')],_0x3c7b80=_0x2fdf6b[_0x6c1e('0x1c')]+_0x2fdf6b[_0x6c1e('0x1d')],_0x3e9a62;if(_0x3c7b80>=_0x381a6d){_0x3c7b80=_0x381a6d;_0x3e9a62=0xc8;}else{_0x3e9a62=0xce;}_0x5d8d4a['status'](_0x3e9a62);return _0x5d8d4a[_0x6c1e('0x1e')](_0x6c1e('0x1f'),_0x58941b+'-'+_0x3c7b80+'/'+_0x381a6d)[_0x6c1e('0x1a')](_0x272573);}return null;};}function patchUpdates(_0x5ef833){return function(_0x335b4d){try{jsonpatch['apply'](_0x335b4d,_0x5ef833,!![]);}catch(_0x41bdf4){return BPromise[_0x6c1e('0x20')](_0x41bdf4);}return _0x335b4d[_0x6c1e('0x21')]();};}function saveUpdates(_0x374fd9,_0x65c840){return function(_0x161a9b){if(_0x161a9b){return _0x161a9b[_0x6c1e('0x22')](_0x374fd9)['then'](function(_0x402451){return _0x402451;});}return null;};}function removeEntity(_0x4e71f3,_0x2155ea){return function(_0x623068){if(_0x623068){return _0x623068[_0x6c1e('0x23')]()[_0x6c1e('0x24')](function(){_0x4e71f3[_0x6c1e('0x18')](0xcc)[_0x6c1e('0x19')]();});}};}function handleEntityNotFound(_0x577ef5,_0x1355f1){return function(_0x3c5b13){if(!_0x3c5b13){_0x577ef5[_0x6c1e('0x17')](0x194);}return _0x3c5b13;};}function handleError(_0x1ad9ef,_0x45be62){_0x45be62=_0x45be62||0x1f4;return function(_0x465feb){logger[_0x6c1e('0x25')](_0x465feb[_0x6c1e('0x26')]);if(_0x465feb[_0x6c1e('0x27')]){delete _0x465feb[_0x6c1e('0x27')];}_0x1ad9ef[_0x6c1e('0x18')](_0x45be62)[_0x6c1e('0x28')](_0x465feb);};}exports['show']=function(_0x193b95,_0x3ec26b){var _0x269ffd={'raw':!![],'where':{'id':_0x193b95[_0x6c1e('0x29')]['id']}},_0x4c482a={};_0x4c482a[_0x6c1e('0x2a')]=_['keys'](db[_0x6c1e('0x2b')][_0x6c1e('0x2c')]);_0x4c482a[_0x6c1e('0x2d')]=_[_0x6c1e('0x2e')](_0x193b95['query']);_0x4c482a[_0x6c1e('0x2f')]=_['intersection'](_0x4c482a[_0x6c1e('0x2a')],_0x4c482a[_0x6c1e('0x2d')]);_0x269ffd[_0x6c1e('0x30')]=_[_0x6c1e('0x31')](_0x4c482a[_0x6c1e('0x2a')],qs[_0x6c1e('0x32')](_0x193b95[_0x6c1e('0x2d')][_0x6c1e('0x32')]));_0x269ffd[_0x6c1e('0x30')]=_0x269ffd['attributes'][_0x6c1e('0x33')]?_0x269ffd[_0x6c1e('0x30')]:_0x4c482a[_0x6c1e('0x2a')];if(_0x193b95[_0x6c1e('0x2d')]['includeAll']){_0x269ffd['include']=[{'all':!![]}];}_0x269ffd=_[_0x6c1e('0x34')]({},_0x269ffd,_0x193b95['options']);return db[_0x6c1e('0x2b')][_0x6c1e('0x35')](_0x269ffd)[_0x6c1e('0x24')](handleEntityNotFound(_0x3ec26b,null))['then'](respondWithResult(_0x3ec26b,null))[_0x6c1e('0x36')](handleError(_0x3ec26b,null));};exports[_0x6c1e('0x22')]=function(_0x7b7a77,_0x46f3c5){if(_0x7b7a77[_0x6c1e('0x37')]['id']){delete _0x7b7a77[_0x6c1e('0x37')]['id'];}return db[_0x6c1e('0x2b')][_0x6c1e('0x35')]({'where':{'id':_0x7b7a77[_0x6c1e('0x29')]['id']}})['then'](handleEntityNotFound(_0x46f3c5,null))[_0x6c1e('0x24')](saveUpdates(_0x7b7a77[_0x6c1e('0x37')],null))[_0x6c1e('0x24')](respondWithResult(_0x46f3c5,null))['catch'](handleError(_0x46f3c5,null));};exports['destroy']=function(_0x222af6,_0x2e723b){return db[_0x6c1e('0x2b')][_0x6c1e('0x35')]({'where':{'id':_0x222af6[_0x6c1e('0x29')]['id']}})[_0x6c1e('0x24')](handleEntityNotFound(_0x2e723b,null))[_0x6c1e('0x24')](removeEntity(_0x2e723b,null))[_0x6c1e('0x36')](handleError(_0x2e723b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1d0b4a6..31023a6 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 _0xc67e=['api','moment','bluebird','path','rimraf','define','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x137459,_0x19eea2){var _0x2031d2=function(_0x5e4f72){while(--_0x5e4f72){_0x137459['push'](_0x137459['shift']());}};_0x2031d2(++_0x19eea2);}(_0xc67e,0xd9));var _0xec67=function(_0x87ce2e,_0x444182){_0x87ce2e=_0x87ce2e-0x0;var _0x4a6659=_0xc67e[_0x87ce2e];return _0x4a6659;};'use strict';var _=require(_0xec67('0x0'));var util=require(_0xec67('0x1'));var logger=require(_0xec67('0x2'))(_0xec67('0x3'));var moment=require(_0xec67('0x4'));var BPromise=require(_0xec67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec67('0x6'));var rimraf=require(_0xec67('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x4c7a3a,_0x483779){return _0x4c7a3a[_0xec67('0x8')]('MailApplication',attributes,{'tableName':_0xec67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec67('0xa')});}; \ No newline at end of file +var _0x63df=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26bf1e,_0x3587c3){var _0x3f6b80=function(_0x178b3e){while(--_0x178b3e){_0x26bf1e['push'](_0x26bf1e['shift']());}};_0x3f6b80(++_0x3587c3);}(_0x63df,0x196));var _0xf63d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x63df[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf63d('0x0'));var util=require(_0xf63d('0x1'));var logger=require(_0xf63d('0x2'))(_0xf63d('0x3'));var moment=require(_0xf63d('0x4'));var BPromise=require(_0xf63d('0x5'));var rp=require(_0xf63d('0x6'));var fs=require('fs');var path=require(_0xf63d('0x7'));var rimraf=require(_0xf63d('0x8'));var config=require(_0xf63d('0x9'));var attributes=require(_0xf63d('0xa'));module[_0xf63d('0xb')]=function(_0x5e373d,_0x47c6e4){return _0x5e373d[_0xf63d('0xc')](_0xf63d('0xd'),attributes,{'tableName':_0xf63d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf63d('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 0e5f5ed..1970396 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 _0x712c=['jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e1e84,_0x5d4612){var _0x3f3709=function(_0x12d4b3){while(--_0x12d4b3){_0x5e1e84['push'](_0x5e1e84['shift']());}};_0x3f3709(++_0x5d4612);}(_0x712c,0xd1));var _0xc712=function(_0x5b5a32,_0x54c9a3){_0x5b5a32=_0x5b5a32-0x0;var _0x24572d=_0x712c[_0x5b5a32];return _0x24572d;};'use strict';var _=require(_0xc712('0x0'));var util=require(_0xc712('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc712('0x2'));var fs=require('fs');var Redis=require(_0xc712('0x3'));var db=require(_0xc712('0x4'))['db'];var utils=require(_0xc712('0x5'));var logger=require(_0xc712('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc712('0x7'));var client=jayson[_0xc712('0x8')][_0xc712('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87315f,_0x52dec1,_0x5ee7bb){return new BPromise(function(_0x1a8267,_0x2d1885){return client['request'](_0x87315f,_0x5ee7bb)[_0xc712('0xa')](function(_0x49526d){logger[_0xc712('0xb')](_0xc712('0xc'),_0x52dec1,_0xc712('0xd'));logger[_0xc712('0xe')](_0xc712('0xf'),_0x52dec1,_0xc712('0xd'),JSON[_0xc712('0x10')](_0x49526d));if(_0x49526d[_0xc712('0x11')]){if(_0x49526d[_0xc712('0x11')][_0xc712('0x12')]===0x1f4){logger[_0xc712('0x11')](_0xc712('0xc'),_0x52dec1,_0x49526d['error'][_0xc712('0x13')]);return _0x2d1885(_0x49526d[_0xc712('0x11')][_0xc712('0x13')]);}logger[_0xc712('0x11')]('MailApplication,\x20%s,\x20%s',_0x52dec1,_0x49526d[_0xc712('0x11')][_0xc712('0x13')]);return _0x1a8267(_0x49526d[_0xc712('0x11')][_0xc712('0x13')]);}else{logger[_0xc712('0xb')](_0xc712('0xc'),_0x52dec1,_0xc712('0xd'));_0x1a8267(_0x49526d[_0xc712('0x14')][_0xc712('0x13')]);}})[_0xc712('0x15')](function(_0x5a28e0){logger['error'](_0xc712('0xc'),_0x52dec1,_0x5a28e0);_0x2d1885(_0x5a28e0);});});}exports[_0xc712('0x16')]=function(_0x36a05e){var _0x5349ac=this;return new Promise(function(_0xf4467f,_0x5118d6){return db['MailApplication'][_0xc712('0x17')](_0x36a05e[_0xc712('0x18')],{'raw':_0x36a05e[_0xc712('0x19')]?_0x36a05e[_0xc712('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a05e[_0xc712('0x19')]?_0x36a05e[_0xc712('0x19')]['where']||null:null,'attributes':_0x36a05e['options']?_0x36a05e[_0xc712('0x19')]['attributes']||null:null,'limit':_0x36a05e['options']?_0x36a05e[_0xc712('0x19')][_0xc712('0x1a')]||null:null})[_0xc712('0xa')](function(_0xe173df){logger[_0xc712('0xb')](_0xc712('0x16'),_0x36a05e);logger[_0xc712('0xe')](_0xc712('0x16'),_0x36a05e,JSON[_0xc712('0x10')](_0xe173df));_0xf4467f(_0xe173df);})[_0xc712('0x15')](function(_0x32c2f0){logger[_0xc712('0x11')](_0xc712('0x16'),_0x32c2f0[_0xc712('0x13')],_0x36a05e);_0x5118d6(_0x5349ac[_0xc712('0x11')](0x1f4,_0x32c2f0['message']));});});}; \ No newline at end of file +var _0xe433=['options','raw','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateMailApplication','update'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xe433,0xd3));var _0x3e43=function(_0x3a747b,_0x3b5f55){_0x3a747b=_0x3a747b-0x0;var _0x584ea3=_0xe433[_0x3a747b];return _0x584ea3;};'use strict';var _=require(_0x3e43('0x0'));var util=require(_0x3e43('0x1'));var moment=require('moment');var BPromise=require(_0x3e43('0x2'));var rs=require(_0x3e43('0x3'));var fs=require('fs');var Redis=require(_0x3e43('0x4'));var db=require(_0x3e43('0x5'))['db'];var utils=require(_0x3e43('0x6'));var logger=require(_0x3e43('0x7'))(_0x3e43('0x8'));var config=require('../../config/environment');var jayson=require(_0x3e43('0x9'));var client=jayson[_0x3e43('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf2ab9,_0x326dee,_0x4b43d7){return new BPromise(function(_0x19963f,_0xe1e1cf){return client['request'](_0xbf2ab9,_0x4b43d7)[_0x3e43('0xb')](function(_0x55c5cb){logger[_0x3e43('0xc')](_0x3e43('0xd'),_0x326dee,_0x3e43('0xe'));logger[_0x3e43('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x326dee,_0x3e43('0xe'),JSON[_0x3e43('0x10')](_0x55c5cb));if(_0x55c5cb[_0x3e43('0x11')]){if(_0x55c5cb['error']['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x326dee,_0x55c5cb['error'][_0x3e43('0x12')]);return _0xe1e1cf(_0x55c5cb[_0x3e43('0x11')][_0x3e43('0x12')]);}logger[_0x3e43('0x11')](_0x3e43('0xd'),_0x326dee,_0x55c5cb[_0x3e43('0x11')][_0x3e43('0x12')]);return _0x19963f(_0x55c5cb['error'][_0x3e43('0x12')]);}else{logger[_0x3e43('0xc')](_0x3e43('0xd'),_0x326dee,_0x3e43('0xe'));_0x19963f(_0x55c5cb[_0x3e43('0x13')][_0x3e43('0x12')]);}})[_0x3e43('0x14')](function(_0x594690){logger[_0x3e43('0x11')](_0x3e43('0xd'),_0x326dee,_0x594690);_0xe1e1cf(_0x594690);});});}exports[_0x3e43('0x15')]=function(_0x20ef4a){var _0x53cd33=this;return new Promise(function(_0x41fb18,_0x355e3d){return db['MailApplication'][_0x3e43('0x16')](_0x20ef4a['body'],{'raw':_0x20ef4a['options']?_0x20ef4a[_0x3e43('0x17')][_0x3e43('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ef4a['options']?_0x20ef4a[_0x3e43('0x17')]['where']||null:null,'attributes':_0x20ef4a['options']?_0x20ef4a[_0x3e43('0x17')][_0x3e43('0x19')]||null:null,'limit':_0x20ef4a[_0x3e43('0x17')]?_0x20ef4a['options']['limit']||null:null})['then'](function(_0x4eaa74){logger[_0x3e43('0xc')](_0x3e43('0x15'),_0x20ef4a);logger['debug']('UpdateMailApplication',_0x20ef4a,JSON[_0x3e43('0x10')](_0x4eaa74));_0x41fb18(_0x4eaa74);})[_0x3e43('0x14')](function(_0x1b86a9){logger[_0x3e43('0x11')](_0x3e43('0x15'),_0x1b86a9[_0x3e43('0x12')],_0x20ef4a);_0x355e3d(_0x53cd33[_0x3e43('0x11')](0x1f4,_0x1b86a9[_0x3e43('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 497fdb2..6978997 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 _0x0694=['express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','multer','util','connect-timeout'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0694,0x183));var _0x4069=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0694[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x4069('0x0'));var util=require(_0x4069('0x1'));var path=require('path');var timeout=require(_0x4069('0x2'));var express=require(_0x4069('0x3'));var router=express['Router']();var auth=require(_0x4069('0x4'));var interaction=require(_0x4069('0x5'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x4069('0x6')]('/',auth[_0x4069('0x7')](),controller[_0x4069('0x8')]);router[_0x4069('0x6')]('/describe',auth[_0x4069('0x7')](),controller[_0x4069('0x9')]);router[_0x4069('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4069('0xa')]);router[_0x4069('0x6')]('/:id/messages',auth[_0x4069('0x7')](),controller[_0x4069('0xb')]);router['get'](_0x4069('0xc'),auth[_0x4069('0x7')](),controller[_0x4069('0xd')]);router[_0x4069('0xe')]('/',auth[_0x4069('0x7')](),controller[_0x4069('0xf')]);router[_0x4069('0xe')](_0x4069('0x10'),auth[_0x4069('0x7')](),controller[_0x4069('0x11')]);router[_0x4069('0xe')](_0x4069('0x12'),auth[_0x4069('0x7')](),interaction[_0x4069('0x13')]('mail',_0x4069('0x14')),controller[_0x4069('0x15')]);router[_0x4069('0x16')](_0x4069('0x17'),auth[_0x4069('0x7')](),interaction[_0x4069('0x13')](_0x4069('0x18'),_0x4069('0x19')),controller['update']);router[_0x4069('0x1a')](_0x4069('0x17'),auth[_0x4069('0x7')](),interaction['tracked'](_0x4069('0x18'),_0x4069('0x1b')),controller[_0x4069('0x1c')]);router[_0x4069('0x1a')](_0x4069('0x12'),auth['isAuthenticated'](),controller['removeTags']);module[_0x4069('0x1d')]=router; \ No newline at end of file +var _0x75a2=['mail','mailinteraction:update','update','mailinteraction:destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','/describe','isAuthenticated','describe','get','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','/:id','tracked'];(function(_0x105907,_0xd6178d){var _0x34f7a1=function(_0x175851){while(--_0x175851){_0x105907['push'](_0x105907['shift']());}};_0x34f7a1(++_0xd6178d);}(_0x75a2,0x187));var _0x275a=function(_0x5446d9,_0x2cc594){_0x5446d9=_0x5446d9-0x0;var _0x40ec1d=_0x75a2[_0x5446d9];return _0x40ec1d;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require('connect-timeout');var express=require(_0x275a('0x3'));var router=express[_0x275a('0x4')]();var auth=require(_0x275a('0x5'));var interaction=require(_0x275a('0x6'));var config=require('../../config/environment');var controller=require(_0x275a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x275a('0x8'),auth[_0x275a('0x9')](),controller[_0x275a('0xa')]);router[_0x275a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x275a('0xc')]);router[_0x275a('0xb')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x275a('0xb')](_0x275a('0xd'),auth[_0x275a('0x9')](),controller[_0x275a('0xe')]);router[_0x275a('0xf')]('/',auth[_0x275a('0x9')](),controller[_0x275a('0x10')]);router[_0x275a('0xf')](_0x275a('0x11'),auth[_0x275a('0x9')](),controller[_0x275a('0x12')]);router['post'](_0x275a('0x13'),auth[_0x275a('0x9')](),interaction['tracked']('mail',_0x275a('0x14')),controller[_0x275a('0x15')]);router[_0x275a('0x16')](_0x275a('0x17'),auth[_0x275a('0x9')](),interaction[_0x275a('0x18')](_0x275a('0x19'),_0x275a('0x1a')),controller[_0x275a('0x1b')]);router['delete']('/:id',auth[_0x275a('0x9')](),interaction[_0x275a('0x18')]('mail',_0x275a('0x1c')),controller['destroy']);router[_0x275a('0x1d')](_0x275a('0x13'),auth['isAuthenticated'](),controller[_0x275a('0x1e')]);module[_0x275a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d96e01b..a271ab4 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 _0x9dcf=['BOOLEAN','STRING','TEXT','DATE','ENUM','out','long','sequelize','iconv','exports'];(function(_0x56986e,_0x28a678){var _0x19224f=function(_0x833bc7){while(--_0x833bc7){_0x56986e['push'](_0x56986e['shift']());}};_0x19224f(++_0x28a678);}(_0x9dcf,0x183));var _0xf9dc=function(_0x49ef87,_0x26ed12){_0x49ef87=_0x49ef87-0x0;var _0x230a8f=_0x9dcf[_0x49ef87];return _0x230a8f;};'use strict';var Sequelize=require(_0xf9dc('0x0'));var iconv=require(_0xf9dc('0x1'));module[_0xf9dc('0x2')]={'closed':{'type':Sequelize[_0xf9dc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf9dc('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xf9dc('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf9dc('0x5')]('long')},'subject':{'type':Sequelize[_0xf9dc('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xf9dc('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xf9dc('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xf9dc('0x7')]('in',_0xf9dc('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf9dc('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xf9dc('0x5')](_0xf9dc('0x9'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xf9dc('0x9'))}}; \ No newline at end of file +var _0xd6d0=['ENUM','out','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6d0,0xe8));var _0x0d6d=function(_0x4dc064,_0x4df5e4){_0x4dc064=_0x4dc064-0x0;var _0x177a12=_0xd6d0[_0x4dc064];return _0x177a12;};'use strict';var Sequelize=require(_0x0d6d('0x0'));var iconv=require(_0x0d6d('0x1'));module[_0x0d6d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0d6d('0x3')]},'disposition':{'type':Sequelize[_0x0d6d('0x4')]},'note':{'type':Sequelize[_0x0d6d('0x4')]},'inReplyTo':{'type':Sequelize[_0x0d6d('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0d6d('0x4')]},'cc':{'type':Sequelize[_0x0d6d('0x5')](_0x0d6d('0x6'))},'subject':{'type':Sequelize[_0x0d6d('0x5')]()},'attach':{'type':Sequelize[_0x0d6d('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0d6d('0x3')]},'substatus':{'type':Sequelize[_0x0d6d('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0d6d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d6d('0x8')]('in',_0x0d6d('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0d6d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0d6d('0x8')]('in',_0x0d6d('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x0d6d('0x5')](_0x0d6d('0x6'))},'lastMsgText':{'type':Sequelize[_0x0d6d('0x5')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5d6a3df..207a0bb 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x3738d8,_0x1f410d){var _0x30665a=function(_0x3b0e52){while(--_0x3b0e52){_0x3738d8['push'](_0x3738d8['shift']());}};_0x30665a(++_0x1f410d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x59e227,_0x1429ed){var _0x3342d6=function(_0x2eea7c){while(--_0x2eea7c){_0x59e227['push'](_0x59e227['shift']());}};_0x3342d6(++_0x1429ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 41d5b75..d9dac8e 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 _0xe8a0=['unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x162d35,_0x339313){var _0x5eab8e=function(_0x5cbf65){while(--_0x5cbf65){_0x162d35['push'](_0x162d35['shift']());}};_0x5eab8e(++_0x339313);}(_0xe8a0,0x1c6));var _0x0e8a=function(_0x475d0c,_0x184135){_0x475d0c=_0x475d0c-0x0;var _0x51aa1c=_0xe8a0[_0x475d0c];return _0x51aa1c;};'use strict';var EventEmitter=require(_0x0e8a('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x0e8a('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e8a('0x2'),'afterDestroy':_0x0e8a('0x3')};function emitEvent(_0xfada44){return function(_0x51554a,_0x4c3f44,_0x5d8cac){_0x51554a[_0x0e8a('0x4')]({'attributes':['id'],'raw':!![]})[_0x0e8a('0x5')](function(_0x28ce9a){_0x51554a[_0x0e8a('0x6')](_0x0e8a('0x7'),_0x28ce9a[_0x0e8a('0x8')](function(_0x51118e){return{'id':_0x51118e['id']};}));return MailMessage[_0x0e8a('0x9')]({'where':{'MailInteractionId':_0x51554a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e8a('0x5')](function(_0x552ec){_0x51554a['setDataValue'](_0x0e8a('0xa'),_0x552ec[_0x0e8a('0xb')]);MailInteractionEvents[_0x0e8a('0xc')](_0xfada44+':'+_0x51554a['id'],_0x51554a);MailInteractionEvents[_0x0e8a('0xc')](_0xfada44,_0x51554a);_0x5d8cac(null);})['catch'](_0x5d8cac(null));};}for(var e in events){if(events[_0x0e8a('0xd')](e)){var event=events[e];MailInteraction[_0x0e8a('0xe')](e,emitEvent(event));}}module[_0x0e8a('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xaa2f=['events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','setDataValue','emit','catch','hasOwnProperty','exports'];(function(_0xe4fe64,_0x364cb6){var _0x5c62fa=function(_0x1b1098){while(--_0x1b1098){_0xe4fe64['push'](_0xe4fe64['shift']());}};_0x5c62fa(++_0x364cb6);}(_0xaa2f,0x110));var _0xfaa2=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xaa2f[_0x33a694];return _0x41ff01;};'use strict';var EventEmitter=require(_0xfaa2('0x0'));var MailInteraction=require(_0xfaa2('0x1'))['db'][_0xfaa2('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xfaa2('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xfaa2('0x4')](0x0);var events={'afterCreate':_0xfaa2('0x5'),'afterUpdate':_0xfaa2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x239778){return function(_0x397985,_0x150050,_0x11e7a6){_0x397985[_0xfaa2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfaa2('0x8')](function(_0x3eba78){_0x397985['setDataValue'](_0xfaa2('0x9'),_0x3eba78['map'](function(_0x5391ad){return{'id':_0x5391ad['id']};}));return MailMessage[_0xfaa2('0xa')]({'where':{'MailInteractionId':_0x397985['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e8b3c){_0x397985[_0xfaa2('0xb')]('unreadMessages',_0x2e8b3c['length']);MailInteractionEvents[_0xfaa2('0xc')](_0x239778+':'+_0x397985['id'],_0x397985);MailInteractionEvents['emit'](_0x239778,_0x397985);_0x11e7a6(null);})[_0xfaa2('0xd')](_0x11e7a6(null));};}for(var e in events){if(events[_0xfaa2('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xfaa2('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4fef4c1..f84d6de 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x12315d,_0x15f545){var _0x258c54=function(_0x59e160){while(--_0x59e160){_0x12315d['push'](_0x12315d['shift']());}};_0x258c54(++_0x15f545);}(_0x34e8,0x12c));var _0x834e=function(_0x4168b7,_0xc1ea0b){_0x4168b7=_0x4168b7-0x0;var _0x538f12=_0x34e8[_0x4168b7];return _0x538f12;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file +var _0x008c=['then','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','substatus','closedAt','models','update'];(function(_0x3311b4,_0x27e8f4){var _0x2a15e5=function(_0x45dd88){while(--_0x45dd88){_0x3311b4['push'](_0x3311b4['shift']());}};_0x2a15e5(++_0x27e8f4);}(_0x008c,0x188));var _0xc008=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x008c[_0xa5d9f9];return _0x40e9f6;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MailInteraction',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc008('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52041f,_0x27830d,_0x7231b4){if(_0x52041f['substatus']){_0x52041f['substatusAt']=moment()['format'](_0xc008('0xe'));}if(_0x52041f[_0xc008('0xf')]){_0x52041f['closedAt']=moment()[_0xc008('0x10')](_0xc008('0xe'));}_0x7231b4(null,_0x27830d);},'beforeUpdate':function(_0x2ea200,_0x2a5b4e,_0x9ffa93){if(_0x2ea200[_0xc008('0x11')](_0xc008('0x12'))){_0x2ea200['substatusAt']=_0x2ea200['substatus']?moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea200[_0xc008('0x11')](_0xc008('0xf'))){_0x2ea200[_0xc008('0x13')]=moment()[_0xc008('0x10')](_0xc008('0xe'));_0x2ea200['substatus']=null;_0x2ea200['substatusAt']=null;}_0x9ffa93(null,_0x2ea200);},'afterUpdate':function(_0x4bd0f4,_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x13aa7[_0xc008('0x14')];var _0x4fe771=_0x4bd0f4['get']({'plain':!![]});if(_0x4fe771['closed']){return _0x3cafe3['MailMessage'][_0xc008('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4fe771['id']}})[_0xc008('0x16')](function(){_0x15a6ad();})['catch'](function(_0x813397){_0x15a6ad(_0x813397);});}else{_0x15a6ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ab8715b..9d10377 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 _0x8130=['update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateMailInteraction'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x8130,0x146));var _0x0813=function(_0x526d8c,_0x445f53){_0x526d8c=_0x526d8c-0x0;var _0x432cf4=_0x8130[_0x526d8c];return _0x432cf4;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});config[_0x0813('0xa')]=_[_0x0813('0xb')](config[_0x0813('0xa')],{'host':_0x0813('0xc'),'port':0x18eb});var socket=require(_0x0813('0xd'))(new Redis(config[_0x0813('0xa')]));require('./mailInteraction.socket')[_0x0813('0xe')](socket);function respondWithRpcPromise(_0x1815be,_0x251ca8,_0x5a9c5e){return new BPromise(function(_0x5550c8,_0x15f8d6){return client['request'](_0x1815be,_0x5a9c5e)[_0x0813('0xf')](function(_0x5b54ec){logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));logger[_0x0813('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x251ca8,'request\x20sent',JSON[_0x0813('0x14')](_0x5b54ec));if(_0x5b54ec[_0x0813('0x15')]){if(_0x5b54ec['error'][_0x0813('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x15f8d6(_0x5b54ec['error'][_0x0813('0x17')]);}logger['error'](_0x0813('0x11'),_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x5550c8(_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);}else{logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));_0x5550c8(_0x5b54ec['result'][_0x0813('0x17')]);}})['catch'](function(_0x112720){logger[_0x0813('0x15')]('MailInteraction,\x20%s,\x20%s',_0x251ca8,_0x112720);_0x15f8d6(_0x112720);});});}exports[_0x0813('0x18')]=function(_0x3639fc){var _0x4945df=this;return new Promise(function(_0x1ee739,_0x334741){return db['MailInteraction'][_0x0813('0x19')](_0x3639fc[_0x0813('0x1a')],{'raw':_0x3639fc[_0x0813('0x1b')]?_0x3639fc[_0x0813('0x1b')][_0x0813('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3639fc['options']?_0x3639fc[_0x0813('0x1b')][_0x0813('0x1d')]||null:null,'attributes':_0x3639fc[_0x0813('0x1b')]?_0x3639fc['options'][_0x0813('0x1e')]||null:null,'limit':_0x3639fc['options']?_0x3639fc['options'][_0x0813('0x1f')]||null:null})['then'](function(_0x5eb50e){logger[_0x0813('0x10')](_0x0813('0x18'),_0x3639fc);logger[_0x0813('0x13')](_0x0813('0x18'),_0x3639fc,JSON[_0x0813('0x14')](_0x5eb50e));_0x1ee739(_0x5eb50e);})[_0x0813('0x20')](function(_0x42627c){logger[_0x0813('0x15')]('UpdateMailInteraction',_0x42627c[_0x0813('0x17')],_0x3639fc);_0x334741(_0x4945df[_0x0813('0x15')](0x1f4,_0x42627c[_0x0813('0x17')]));});});};exports[_0x0813('0x21')]=function(_0x355462){return new Promise(function(_0x373ad0,_0x55e115){return db[_0x0813('0x22')][_0x0813('0x23')]({'where':_0x355462['options']?_0x355462['options'][_0x0813('0x1d')]||null:null})[_0x0813('0xf')](function(_0x32086e){if(_0x32086e){return _0x32086e[_0x0813('0x24')](_0x355462[_0x0813('0x1a')][_0x0813('0x25')],_['omit'](_0x355462[_0x0813('0x1a')],[_0x0813('0x25'),'id'])||{});}})['spread'](function(_0x47ae8d){logger[_0x0813('0x10')](_0x0813('0x26'),_0x355462);logger[_0x0813('0x13')]('AddTags',_0x355462,JSON[_0x0813('0x14')](_0x47ae8d));_0x373ad0(_0x47ae8d);})[_0x0813('0x20')](function(_0x53d599){logger['error'](_0x0813('0x26'),_0x53d599[_0x0813('0x17')],_0x355462);_0x55e115(_this[_0x0813('0x15')](0x1f4,_0x53d599[_0x0813('0x17')]));});});}; \ No newline at end of file +var _0xbf5c=['then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateMailInteraction','update','options','raw','where','limit','debug','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./mailInteraction.socket','register','request'];(function(_0x352389,_0x5f5ae3){var _0x5b5df5=function(_0x19350d){while(--_0x19350d){_0x352389['push'](_0x352389['shift']());}};_0x5b5df5(++_0x5f5ae3);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x573f76,_0xdd4e6d){_0x573f76=_0x573f76-0x0;var _0x288ca4=_0xbf5c[_0x573f76];return _0x288ca4;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});config['redis']=_[_0xcbf5('0xb')](config[_0xcbf5('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbf5('0xc')]));require(_0xcbf5('0xd'))[_0xcbf5('0xe')](socket);function respondWithRpcPromise(_0x5f4e74,_0x320554,_0x752a2a){return new BPromise(function(_0x29b871,_0x1b1822){return client[_0xcbf5('0xf')](_0x5f4e74,_0x752a2a)[_0xcbf5('0x10')](function(_0x5db829){logger[_0xcbf5('0x11')](_0xcbf5('0x12'),_0x320554,_0xcbf5('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x320554,_0xcbf5('0x13'),JSON['stringify'](_0x5db829));if(_0x5db829[_0xcbf5('0x14')]){if(_0x5db829[_0xcbf5('0x14')][_0xcbf5('0x15')]===0x1f4){logger[_0xcbf5('0x14')]('MailInteraction,\x20%s,\x20%s',_0x320554,_0x5db829['error'][_0xcbf5('0x16')]);return _0x1b1822(_0x5db829['error'][_0xcbf5('0x16')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x320554,_0x5db829[_0xcbf5('0x14')][_0xcbf5('0x16')]);return _0x29b871(_0x5db829[_0xcbf5('0x14')][_0xcbf5('0x16')]);}else{logger[_0xcbf5('0x11')](_0xcbf5('0x12'),_0x320554,_0xcbf5('0x13'));_0x29b871(_0x5db829['result'][_0xcbf5('0x16')]);}})[_0xcbf5('0x17')](function(_0x2817cc){logger[_0xcbf5('0x14')](_0xcbf5('0x12'),_0x320554,_0x2817cc);_0x1b1822(_0x2817cc);});});}exports[_0xcbf5('0x18')]=function(_0x3b9f05){var _0x28a065=this;return new Promise(function(_0x58f4fd,_0x155147){return db['MailInteraction'][_0xcbf5('0x19')](_0x3b9f05['body'],{'raw':_0x3b9f05[_0xcbf5('0x1a')]?_0x3b9f05[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b9f05[_0xcbf5('0x1a')]?_0x3b9f05[_0xcbf5('0x1a')][_0xcbf5('0x1c')]||null:null,'attributes':_0x3b9f05['options']?_0x3b9f05[_0xcbf5('0x1a')]['attributes']||null:null,'limit':_0x3b9f05[_0xcbf5('0x1a')]?_0x3b9f05[_0xcbf5('0x1a')][_0xcbf5('0x1d')]||null:null})[_0xcbf5('0x10')](function(_0x4c8d12){logger[_0xcbf5('0x11')](_0xcbf5('0x18'),_0x3b9f05);logger[_0xcbf5('0x1e')](_0xcbf5('0x18'),_0x3b9f05,JSON[_0xcbf5('0x1f')](_0x4c8d12));_0x58f4fd(_0x4c8d12);})[_0xcbf5('0x17')](function(_0x149b61){logger[_0xcbf5('0x14')]('UpdateMailInteraction',_0x149b61[_0xcbf5('0x16')],_0x3b9f05);_0x155147(_0x28a065[_0xcbf5('0x14')](0x1f4,_0x149b61[_0xcbf5('0x16')]));});});};exports[_0xcbf5('0x20')]=function(_0x38ab04){return new Promise(function(_0x57e453,_0x1293ab){return db[_0xcbf5('0x21')][_0xcbf5('0x22')]({'where':_0x38ab04[_0xcbf5('0x1a')]?_0x38ab04[_0xcbf5('0x1a')][_0xcbf5('0x1c')]||null:null})['then'](function(_0x2d98d2){if(_0x2d98d2){return _0x2d98d2[_0xcbf5('0x23')](_0x38ab04[_0xcbf5('0x24')][_0xcbf5('0x25')],_[_0xcbf5('0x26')](_0x38ab04[_0xcbf5('0x24')],[_0xcbf5('0x25'),'id'])||{});}})['spread'](function(_0x4d2a50){logger[_0xcbf5('0x11')]('AddTags',_0x38ab04);logger[_0xcbf5('0x1e')](_0xcbf5('0x27'),_0x38ab04,JSON[_0xcbf5('0x1f')](_0x4d2a50));_0x57e453(_0x4d2a50);})[_0xcbf5('0x17')](function(_0x3fd23a){logger['error']('AddTags',_0x3fd23a[_0xcbf5('0x16')],_0x38ab04);_0x1293ab(_this[_0xcbf5('0x14')](0x1f4,_0x3fd23a[_0xcbf5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1cede23..f1ddbb2 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 _0x3c8d=['remove','emit','removeListener','register','length','./mailInteraction.events','save'];(function(_0x4e4978,_0x4d4bc7){var _0x559172=function(_0x5cc2aa){while(--_0x5cc2aa){_0x4e4978['push'](_0x4e4978['shift']());}};_0x559172(++_0x4d4bc7);}(_0x3c8d,0x1a9));var _0xd3c8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3c8d[_0x513aa5];return _0x1a1a7c;};'use strict';var MailInteractionEvents=require(_0xd3c8('0x0'));var events=[_0xd3c8('0x1'),_0xd3c8('0x2'),'update'];function createListener(_0x41ccfa,_0x4bf4a6){return function(_0x485422){_0x4bf4a6[_0xd3c8('0x3')](_0x41ccfa,_0x485422);};}function removeListener(_0x4fac52,_0x322e79){return function(){MailInteractionEvents[_0xd3c8('0x4')](_0x4fac52,_0x322e79);};}exports[_0xd3c8('0x5')]=function(_0x16035b){for(var _0x28f4cf=0x0,_0x1fcbc7=events[_0xd3c8('0x6')];_0x28f4cf<_0x1fcbc7;_0x28f4cf++){var _0xb4989b=events[_0x28f4cf];var _0x40064e=createListener('mailInteraction:'+_0xb4989b,_0x16035b);MailInteractionEvents['on'](_0xb4989b,_0x40064e);}}; \ No newline at end of file +var _0x2ca3=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x2304f2,_0x1b9293){var _0x2c15c6=function(_0x39daa5){while(--_0x39daa5){_0x2304f2['push'](_0x2304f2['shift']());}};_0x2c15c6(++_0x1b9293);}(_0x2ca3,0xbc));var _0x32ca=function(_0x48b3ba,_0x28d973){_0x48b3ba=_0x48b3ba-0x0;var _0x10c275=_0x2ca3[_0x48b3ba];return _0x10c275;};'use strict';var MailInteractionEvents=require(_0x32ca('0x0'));var events=['save',_0x32ca('0x1'),'update'];function createListener(_0x5b599e,_0x427399){return function(_0x23fbbb){_0x427399[_0x32ca('0x2')](_0x5b599e,_0x23fbbb);};}function removeListener(_0x2bde16,_0x497a4b){return function(){MailInteractionEvents[_0x32ca('0x3')](_0x2bde16,_0x497a4b);};}exports[_0x32ca('0x4')]=function(_0x3025fe){for(var _0x432173=0x0,_0x2ea4f2=events[_0x32ca('0x5')];_0x432173<_0x2ea4f2;_0x432173++){var _0x13f767=events[_0x432173];var _0x4ac76f=createListener(_0x32ca('0x6')+_0x13f767,_0x3025fe);MailInteractionEvents['on'](_0x13f767,_0x4ac76f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 094b39a..7737f18 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 _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3843a5,_0x3f2e8e){var _0x3712fd=function(_0x135d3e){while(--_0x135d3e){_0x3843a5['push'](_0x3843a5['shift']());}};_0x3712fd(++_0x3f2e8e);}(_0xa41a,0x6b));var _0xaa41=function(_0x4a24b5,_0x55f7cf){_0x4a24b5=_0x4a24b5-0x0;var _0x4c1deb=_0xa41a[_0x4a24b5];return _0x4c1deb;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file +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(_0x3da72a,_0x3b1e0d){var _0x48dc5c=function(_0x5928d1){while(--_0x5928d1){_0x3da72a['push'](_0x3da72a['shift']());}};_0x48dc5c(++_0x3b1e0d);}(_0x3e74,0x175));var _0x43e7=function(_0x58c56f,_0x24e41d){_0x58c56f=_0x58c56f-0x0;var _0x1cfb24=_0x3e74[_0x58c56f];return _0x1cfb24;};'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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fd5c739..e2dd9f5 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 _0xc35f=['medium','BOOLEAN','out','STRING','long','DATE','INTEGER','sequelize','lodash','exports','TEXT'];(function(_0x1af828,_0xfacba4){var _0x325cbb=function(_0x44049e){while(--_0x44049e){_0x1af828['push'](_0x1af828['shift']());}};_0x325cbb(++_0xfacba4);}(_0xc35f,0x1ca));var _0xfc35=function(_0xd07bf5,_0x4de00e){_0xd07bf5=_0xd07bf5-0x0;var _0x3925e5=_0xc35f[_0xd07bf5];return _0x3925e5;};'use strict';var Sequelize=require(_0xfc35('0x0'));var _=require(_0xfc35('0x1'));module[_0xfc35('0x2')]={'body':{'type':Sequelize[_0xfc35('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x4'))},'read':{'type':Sequelize[_0xfc35('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfc35('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xfc35('0x7')]},'to':{'type':Sequelize[_0xfc35('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0xfc35('0x8'))},'bcc':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfc35('0x9')]},'attach':{'type':Sequelize[_0xfc35('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfc35('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x8'))},'originCc':{'type':Sequelize[_0xfc35('0x3')](_0xfc35('0x8'))}}; \ No newline at end of file +var _0xde1a=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x2c59a6,_0x106f5d){var _0x5b543f=function(_0x2b5e4d){while(--_0x2b5e4d){_0x2c59a6['push'](_0x2c59a6['shift']());}};_0x5b543f(++_0x106f5d);}(_0xde1a,0xfd));var _0xade1=function(_0x3f3516,_0x425cca){_0x3f3516=_0x3f3516-0x0;var _0x48990d=_0xde1a[_0x3f3516];return _0x48990d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xade1('0x0'));module[_0xade1('0x1')]={'body':{'type':Sequelize[_0xade1('0x2')](_0xade1('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xade1('0x2')](_0xade1('0x4'))},'read':{'type':Sequelize[_0xade1('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xade1('0x6')]('in','out'),'defaultValue':_0xade1('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xade1('0x8')](0x1fe)},'from':{'type':Sequelize[_0xade1('0x8')]},'to':{'type':Sequelize[_0xade1('0x2')](_0xade1('0x3'))},'cc':{'type':Sequelize[_0xade1('0x2')]('long')},'bcc':{'type':Sequelize[_0xade1('0x2')](_0xade1('0x3'))},'subject':{'type':Sequelize[_0xade1('0x2')]},'sentAt':{'type':Sequelize[_0xade1('0x9')]},'attach':{'type':Sequelize[_0xade1('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xade1('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xade1('0x9')]},'originTo':{'type':Sequelize[_0xade1('0x2')]('long')},'originCc':{'type':Sequelize[_0xade1('0x2')](_0xade1('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8145b01..a2c1be6 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 _0x36aa=['MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','reject','agent','info','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','push','readFileSync','build','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.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','request\x20sent','debug','stringify','code','MailMessage,\x20%s,\x20%s','error','message','result','catch','status','end','count','offset','set','Content-Range','json','save','destroy','then','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','update','body','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','Contacts','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','user','attachments','join','root','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','mail-interactions','accept','mail','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get'];(function(_0x145aef,_0x371dd5){var _0x114246=function(_0x567ab5){while(--_0x567ab5){_0x145aef['push'](_0x145aef['shift']());}};_0x114246(++_0x371dd5);}(_0x36aa,0x170));var _0xa36a=function(_0x3d00b2,_0x64a1ab){_0x3d00b2=_0x3d00b2-0x0;var _0x39556f=_0x36aa[_0x3d00b2];return _0x39556f;};'use strict';var pdf=require(_0xa36a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa36a('0x1'));var zipdir=require(_0xa36a('0x2'));var jsonpatch=require(_0xa36a('0x3'));var rp=require(_0xa36a('0x4'));var moment=require('moment');var BPromise=require(_0xa36a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa36a('0x6'));var csv=require(_0xa36a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa36a('0x8'));var crypto=require(_0xa36a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa36a('0xa'));var toCsv=require(_0xa36a('0x7'));var querystring=require(_0xa36a('0xb'));var Papa=require(_0xa36a('0xc'));var Redis=require(_0xa36a('0xd'));var authService=require(_0xa36a('0xe'));var qs=require(_0xa36a('0xf'));var as=require(_0xa36a('0x10'));var hardwareService=require(_0xa36a('0x11'));var logger=require(_0xa36a('0x12'))(_0xa36a('0x13'));var utils=require(_0xa36a('0x14'));var config=require(_0xa36a('0x15'));var db=require('../../mysqldb')['db'];config[_0xa36a('0x16')]=_[_0xa36a('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa36a('0x18'))(new Redis(config[_0xa36a('0x16')]));require(_0xa36a('0x19'))[_0xa36a('0x1a')](socket);var jayson=require(_0xa36a('0x1b'));var client=jayson[_0xa36a('0x1c')][_0xa36a('0x1d')]({'port':0x232c});var client9003=jayson[_0xa36a('0x1c')]['http']({'port':0x232b});var client9002=jayson['client'][_0xa36a('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xed4019,_0x28bef2,_0x36539c){if(_0x36539c){var _0x1f16ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f16ee[_0xa36a('0x1e')](_0x28bef2)){return _0xed4019;}else{throw new db[(_0xa36a('0x1f'))]['ValidationError'](_0xa36a('0x20'));}}else{return _0xed4019;}}function respondWithRpcPromise(_0x3e379d,_0x9a2333,_0x58ff09,_0x3151d2){return new BPromise(function(_0x5889e3,_0x34ed8c){var _0x26154f=_0x3151d2||client;return _0x26154f[_0xa36a('0x21')](_0x3e379d,_0x58ff09)['then'](function(_0xa960c6){logger['info']('MailMessage,\x20%s,\x20%s',_0x9a2333,_0xa36a('0x22'));logger[_0xa36a('0x23')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x9a2333,_0xa36a('0x22'),JSON[_0xa36a('0x24')](_0xa960c6));if(_0xa960c6['error']){if(_0xa960c6['error'][_0xa36a('0x25')]===0x1f4){logger['error'](_0xa36a('0x26'),_0x9a2333,_0xa960c6[_0xa36a('0x27')][_0xa36a('0x28')]);return _0x34ed8c(_0xa960c6[_0xa36a('0x27')][_0xa36a('0x28')]);}logger[_0xa36a('0x27')](_0xa36a('0x26'),_0x9a2333,_0xa960c6[_0xa36a('0x27')]['message']);return _0x5889e3(_0xa960c6[_0xa36a('0x27')][_0xa36a('0x28')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x9a2333,_0xa36a('0x22'));_0x5889e3(_0xa960c6[_0xa36a('0x29')][_0xa36a('0x28')]);}})[_0xa36a('0x2a')](function(_0x18ad1d){logger['error'](_0xa36a('0x26'),_0x9a2333,_0x18ad1d);_0x34ed8c(_0x18ad1d);});});}function respondWithStatusCode(_0x3730a8,_0x46f02d){_0x46f02d=_0x46f02d||0xcc;return function(_0x233743){if(_0x233743){return _0x3730a8['sendStatus'](_0x46f02d);}return _0x3730a8[_0xa36a('0x2b')](_0x46f02d)[_0xa36a('0x2c')]();};}function respondWithResult(_0x5281a4,_0xc5c27f){_0xc5c27f=_0xc5c27f||0xc8;return function(_0xf588cc){if(_0xf588cc){return _0x5281a4[_0xa36a('0x2b')](_0xc5c27f)['json'](_0xf588cc);}};}function respondWithFilteredResult(_0x67f748,_0x16b8bf){return function(_0x564586){if(_0x564586){var _0x42edb4=_0x564586[_0xa36a('0x2d')],_0x5606ff=_0x16b8bf[_0xa36a('0x2e')],_0x2cfbdb=_0x16b8bf[_0xa36a('0x2e')]+_0x16b8bf['limit'],_0x1e45e0;if(_0x2cfbdb>=_0x42edb4){_0x2cfbdb=_0x42edb4;_0x1e45e0=0xc8;}else{_0x1e45e0=0xce;}_0x67f748[_0xa36a('0x2b')](_0x1e45e0);return _0x67f748[_0xa36a('0x2f')](_0xa36a('0x30'),_0x5606ff+'-'+_0x2cfbdb+'/'+_0x42edb4)[_0xa36a('0x31')](_0x564586);}return null;};}function patchUpdates(_0x483b82){return function(_0x12e00f){try{jsonpatch['apply'](_0x12e00f,_0x483b82,!![]);}catch(_0x2a21d7){return BPromise['reject'](_0x2a21d7);}return _0x12e00f[_0xa36a('0x32')]();};}function saveUpdates(_0x3c7a3d,_0x57bcb1){return function(_0x57efd2){if(_0x57efd2){return _0x57efd2['update'](_0x3c7a3d)['then'](function(_0x10d12e){return _0x10d12e;});}return null;};}function removeEntity(_0x55cf5d,_0x548408){return function(_0xcf79d0){if(_0xcf79d0){return _0xcf79d0[_0xa36a('0x33')]()[_0xa36a('0x34')](function(){_0x55cf5d[_0xa36a('0x2b')](0xcc)[_0xa36a('0x2c')]();});}};}function handleEntityNotFound(_0x297b28,_0x231bbf){return function(_0xc32de8){if(!_0xc32de8){_0x297b28[_0xa36a('0x35')](0x194);}return _0xc32de8;};}function handleError(_0x4f0eab,_0x3e6a1d){_0x3e6a1d=_0x3e6a1d||0x1f4;return function(_0x28772d){logger[_0xa36a('0x27')](_0x28772d[_0xa36a('0x36')]);if(_0x28772d['name']){delete _0x28772d[_0xa36a('0x37')];}_0x4f0eab[_0xa36a('0x2b')](_0x3e6a1d)[_0xa36a('0x38')](_0x28772d);};}exports[_0xa36a('0x39')]=function(_0x5bd00b,_0x35cf3d){var _0x38ee77={},_0x4f2cd9={},_0x5008bb={'count':0x0,'rows':[]};var _0x442459=_[_0xa36a('0x3a')](db[_0xa36a('0x3b')][_0xa36a('0x3c')],function(_0x17587a){return{'name':_0x17587a[_0xa36a('0x3d')],'type':_0x17587a[_0xa36a('0x3e')][_0xa36a('0x3f')]};});_0x4f2cd9['model']=_[_0xa36a('0x3a')](_0x442459,_0xa36a('0x37'));_0x4f2cd9[_0xa36a('0x40')]=_[_0xa36a('0x41')](_0x5bd00b[_0xa36a('0x40')]);_0x4f2cd9[_0xa36a('0x42')]=_['intersection'](_0x4f2cd9['model'],_0x4f2cd9[_0xa36a('0x40')]);_0x38ee77['attributes']=_[_0xa36a('0x43')](_0x4f2cd9[_0xa36a('0x44')],qs[_0xa36a('0x45')](_0x5bd00b[_0xa36a('0x40')][_0xa36a('0x45')]));_0x38ee77[_0xa36a('0x46')]=_0x38ee77[_0xa36a('0x46')][_0xa36a('0x47')]?_0x38ee77[_0xa36a('0x46')]:_0x4f2cd9['model'];if(!_0x5bd00b[_0xa36a('0x40')]['hasOwnProperty'](_0xa36a('0x48'))){_0x38ee77[_0xa36a('0x49')]=qs[_0xa36a('0x49')](_0x5bd00b[_0xa36a('0x40')]['limit']);_0x38ee77[_0xa36a('0x2e')]=qs[_0xa36a('0x2e')](_0x5bd00b[_0xa36a('0x40')][_0xa36a('0x2e')]);}_0x38ee77['order']=qs['sort'](_0x5bd00b['query']['sort']);_0x38ee77[_0xa36a('0x4a')]=qs['filters'](_['pick'](_0x5bd00b[_0xa36a('0x40')],_0x4f2cd9[_0xa36a('0x42')]),_0x442459);if(_0x5bd00b[_0xa36a('0x40')]['filter']){_0x38ee77['where']=_[_0xa36a('0x4b')](_0x38ee77[_0xa36a('0x4a')],{'$or':_[_0xa36a('0x3a')](_0x442459,function(_0x5e61a2){if(_0x5e61a2[_0xa36a('0x3e')]!==_0xa36a('0x4c')){var _0x2971a7={};_0x2971a7[_0x5e61a2['name']]={'$like':'%'+_0x5bd00b['query']['filter']+'%'};return _0x2971a7;}})});}_0x38ee77=_[_0xa36a('0x4b')]({},_0x38ee77,_0x5bd00b[_0xa36a('0x4d')]);var _0x5e9dfe={'where':_0x38ee77[_0xa36a('0x4a')]};return db['MailMessage'][_0xa36a('0x2d')](_0x5e9dfe)[_0xa36a('0x34')](function(_0x16cc89){_0x5008bb['count']=_0x16cc89;if(_0x5bd00b[_0xa36a('0x40')][_0xa36a('0x4e')]){_0x38ee77[_0xa36a('0x4f')]=[{'all':!![]}];}return db[_0xa36a('0x3b')][_0xa36a('0x50')](_0x38ee77);})['then'](function(_0x42f5ae){_0x5008bb['rows']=_0x42f5ae;return _0x5008bb;})[_0xa36a('0x34')](respondWithFilteredResult(_0x35cf3d,_0x38ee77))[_0xa36a('0x2a')](handleError(_0x35cf3d,null));};exports[_0xa36a('0x51')]=function(_0x306be5,_0x53f106){var _0x3890ee={'raw':!![],'where':{'id':_0x306be5[_0xa36a('0x52')]['id']}},_0x8d8f2c={};_0x8d8f2c['model']=_[_0xa36a('0x41')](db[_0xa36a('0x3b')]['rawAttributes']);_0x8d8f2c[_0xa36a('0x40')]=_[_0xa36a('0x41')](_0x306be5[_0xa36a('0x40')]);_0x8d8f2c['filters']=_['intersection'](_0x8d8f2c[_0xa36a('0x44')],_0x8d8f2c[_0xa36a('0x40')]);_0x3890ee['attributes']=_['intersection'](_0x8d8f2c[_0xa36a('0x44')],qs[_0xa36a('0x45')](_0x306be5['query'][_0xa36a('0x45')]));_0x3890ee[_0xa36a('0x46')]=_0x3890ee[_0xa36a('0x46')][_0xa36a('0x47')]?_0x3890ee[_0xa36a('0x46')]:_0x8d8f2c['model'];if(_0x306be5['query'][_0xa36a('0x4e')]){_0x3890ee[_0xa36a('0x4f')]=[{'all':!![]}];}_0x3890ee=_[_0xa36a('0x4b')]({},_0x3890ee,_0x306be5[_0xa36a('0x4d')]);return db[_0xa36a('0x3b')][_0xa36a('0x53')](_0x3890ee)[_0xa36a('0x34')](handleEntityNotFound(_0x53f106,null))[_0xa36a('0x34')](respondWithResult(_0x53f106,null))[_0xa36a('0x2a')](handleError(_0x53f106,null));};exports[_0xa36a('0x54')]=function(_0x7ab2cf,_0x4fc0e2){if(_0x7ab2cf[_0xa36a('0x55')]['id']){delete _0x7ab2cf[_0xa36a('0x55')]['id'];}return db[_0xa36a('0x3b')][_0xa36a('0x53')]({'where':{'id':_0x7ab2cf[_0xa36a('0x52')]['id']}})[_0xa36a('0x34')](handleEntityNotFound(_0x4fc0e2,null))[_0xa36a('0x34')](saveUpdates(_0x7ab2cf['body'],null))[_0xa36a('0x34')](respondWithResult(_0x4fc0e2,null))[_0xa36a('0x2a')](handleError(_0x4fc0e2,null));};exports[_0xa36a('0x33')]=function(_0x4cd0c8,_0x44146f){return db['MailMessage'][_0xa36a('0x53')]({'where':{'id':_0x4cd0c8[_0xa36a('0x52')]['id']}})['then'](handleEntityNotFound(_0x44146f,null))[_0xa36a('0x34')](removeEntity(_0x44146f,null))[_0xa36a('0x2a')](handleError(_0x44146f,null));};exports['describe']=function(_0x41c0e1,_0x182495){return db[_0xa36a('0x3b')][_0xa36a('0x56')]()['then'](respondWithResult(_0x182495,null))[_0xa36a('0x2a')](handleError(_0x182495,null));};exports[_0xa36a('0x57')]=function(_0x148e80,_0x4aaaca){return db['MailMessage'][_0xa36a('0x57')](_0x148e80[_0xa36a('0x55')])[_0xa36a('0x34')](function(_0x1edf17){if(_0x1edf17){if(_0x1edf17[_0xa36a('0x58')]==='out'&&!_0x1edf17[_0xa36a('0x59')]){var _0x3bafc6,_0x311947,_0x1d90ba;if(_0x148e80[_0xa36a('0x55')]['to']){_0x311947=_0x148e80['body']['to'][_0xa36a('0x5a')](',')[0x0];}return db['MailAccount'][_0xa36a('0x5b')]({'where':{'id':_0x1edf17[_0xa36a('0x5c')]},'include':[{'model':db[_0xa36a('0x5d')],'as':_0xa36a('0x5e'),'include':[{'model':db['CmContact'],'as':_0xa36a('0x5f'),'where':{'email':_0x311947},'limit':0x1,'order':[['updatedAt',_0xa36a('0x60')]]}]},{'model':db['MailServerOut'],'as':_0xa36a('0x61'),'raw':!![]}]})['then'](function(_0x3fd6f5){_0x3bafc6=_0x3fd6f5;if(_0x3bafc6&&_0x3bafc6[_0xa36a('0x61')]){var _0x1df55f={'tls':{'rejectUnauthorized':![]}};if(_[_0xa36a('0x62')](_0x3bafc6[_0xa36a('0x61')][_0xa36a('0x63')])){_0x1df55f[_0xa36a('0x64')]=_0x3bafc6['Smtp'][_0xa36a('0x64')];_0x1df55f[_0xa36a('0x65')]=_0x3bafc6[_0xa36a('0x61')]['port'];_0x1df55f[_0xa36a('0x66')]=_0x3bafc6['Smtp'][_0xa36a('0x66')];if(_0x3bafc6['Smtp'][_0xa36a('0x67')]){_0x1df55f[_0xa36a('0x68')]={'user':_0x3bafc6[_0xa36a('0x61')][_0xa36a('0x69')],'pass':_0x3bafc6['Smtp']['pass']};}}else{_0x1df55f['service']=_0x3bafc6[_0xa36a('0x61')][_0xa36a('0x63')];_0x1df55f[_0xa36a('0x68')]={'user':_0x3bafc6['Smtp']['user'],'pass':_0x3bafc6['Smtp']['pass']};_0x1df55f[_0xa36a('0x66')]=_0x3bafc6[_0xa36a('0x61')]['secure'];}if(_0x148e80['body'][_0xa36a('0x6a')]&&_0x148e80[_0xa36a('0x55')][_0xa36a('0x6a')][_0xa36a('0x47')]){for(var _0x569c01=0x0;_0x569c01<_0x148e80[_0xa36a('0x55')]['attachments'][_0xa36a('0x47')];_0x569c01+=0x1){_0x148e80[_0xa36a('0x55')][_0xa36a('0x6a')][_0x569c01]={'filename':_0x148e80['body']['attachments'][_0x569c01][_0xa36a('0x37')],'path':path[_0xa36a('0x6b')](config[_0xa36a('0x6c')],'server/files/attachments',_0x148e80[_0xa36a('0x55')]['attachments'][_0x569c01][_0xa36a('0x6d')])};}}_0x1d90ba={'account':_0x1df55f,'message':_0x148e80[_0xa36a('0x55')]};return;}})[_0xa36a('0x34')](function(){if(_0x3bafc6[_0xa36a('0x5e')]){if(_0x3bafc6[_0xa36a('0x5e')][_0xa36a('0x5f')][_0xa36a('0x47')]){return _0x3bafc6['List'][_0xa36a('0x5f')][0x0];}else{return db[_0xa36a('0x6e')][_0xa36a('0x57')](_[_0xa36a('0x17')](_0x148e80[_0xa36a('0x55')],{'firstName':_0x148e80['body']['to'],'email':_0x148e80[_0xa36a('0x55')]['to'],'phone':_0x148e80['body']['to'],'ListId':_0x3bafc6[_0xa36a('0x6f')]}));}}else{throw new Error(_0xa36a('0x70'));}})['then'](function(){if(_0x1d90ba){return respondWithRpcPromise(_0xa36a('0x71'),_0xa36a('0x72'),_0x1d90ba,client9003)['then'](function(_0x3a5af5){return _0x1edf17[_0xa36a('0x54')]({'read':!![],'messageId':_0x3a5af5['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0xe914c6){logger[_0xa36a('0x27')]('%s',JSON[_0xa36a('0x24')](_0xe914c6));return _0x1edf17;});}return _0x1edf17;});}return _0x1edf17;}})[_0xa36a('0x34')](respondWithResult(_0x4aaaca,0xc9))[_0xa36a('0x2a')](handleError(_0x4aaaca,null));};var interaction_log=require(_0xa36a('0x12'))(_0xa36a('0x73'));exports[_0xa36a('0x74')]=function(_0x44b3a6,_0x54957e,_0x3fdc74){var _0x48f373={'channel':_0xa36a('0x75')};if(_0x44b3a6[_0xa36a('0x55')]['id']){delete _0x44b3a6[_0xa36a('0x55')]['id'];}_0x44b3a6[_0xa36a('0x55')]['read']=!![];_0x44b3a6[_0xa36a('0x55')][_0xa36a('0x76')]=moment()[_0xa36a('0x77')](_0xa36a('0x78'));_0x44b3a6[_0xa36a('0x55')][_0xa36a('0x79')]=_0x44b3a6['body'][_0xa36a('0x79')]||_0x44b3a6['user']['id'];return db[_0xa36a('0x3b')][_0xa36a('0x53')]({'where':{'id':_0x44b3a6['params']['id'],'UserId':null},'include':[{'model':db[_0xa36a('0x6e')],'as':_0xa36a('0x7a')}]})[_0xa36a('0x34')](handleEntityNotFound(_0x54957e,null))[_0xa36a('0x34')](saveUpdates(_0x44b3a6[_0xa36a('0x55')],null))[_0xa36a('0x34')](function(_0x76ee84){if(_0x76ee84){_0x48f373['message']=_0x76ee84[_0xa36a('0x7b')]({'plain':!![]});return db[_0xa36a('0x7c')][_0xa36a('0x53')]({'where':{'id':_0x76ee84[_0xa36a('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x54957e,null))['then'](function(_0x491f01){if(_0x491f01){return _0x491f01['update']({'UserId':_0x44b3a6[_0xa36a('0x55')][_0xa36a('0x79')],'read1stAt':_[_0xa36a('0x62')](_0x491f01[_0xa36a('0x7e')])?moment()[_0xa36a('0x77')](_0xa36a('0x78')):undefined});}return null;})['then'](function(_0x4dff5f){if(_0x4dff5f){_0x48f373[_0xa36a('0x7f')]=_0x4dff5f[_0xa36a('0x7b')]({'plain':!![]});interaction_log['info'](_0xa36a('0x80'),_0x44b3a6[_0xa36a('0x69')]['id'],_0x44b3a6['user'][_0xa36a('0x37')],_0x44b3a6[_0xa36a('0x69')][_0xa36a('0x81')],_0x48f373['interaction']['id'],_0x44b3a6[_0xa36a('0x55')]?JSON[_0xa36a('0x24')](_0x44b3a6[_0xa36a('0x55')]):_0xa36a('0x82'));return respondWithRpcPromise(_0xa36a('0x83'),_0xa36a('0x84'),_0x48f373);}return null;})[_0xa36a('0x34')](function(_0x3deb90){if(_0x3deb90){if(_0x44b3a6['body']['manual']){_0x48f373[_0xa36a('0x28')][_0xa36a('0x85')]=util[_0xa36a('0x77')]('SIP/%s',_0x44b3a6[_0xa36a('0x69')][_0xa36a('0x37')]);_0x48f373[_0xa36a('0x28')][_0xa36a('0x86')]=_0x48f373[_0xa36a('0x86')];_0x48f373[_0xa36a('0x28')][_0xa36a('0x87')]=_0xa36a('0x74');return respondWithRpcPromise('EventManager',_0xa36a('0x88'),{'event':'acceptmessage','message':_0x48f373['message']},client9002)[_0xa36a('0x34')](function(){return _0x48f373;});}return _0x48f373;}return null;})['then'](respondWithResult(_0x54957e,null))['catch'](handleError(_0x54957e,null));};var interaction_log=require(_0xa36a('0x12'))(_0xa36a('0x73'));exports[_0xa36a('0x89')]=function(_0x2d0bff,_0x5a5ac8,_0x11b5be){var _0x77fabf={'agent':{},'channel':_0xa36a('0x75')};if(_0x2d0bff[_0xa36a('0x55')]['id']){delete _0x2d0bff['body']['id'];}_0x2d0bff[_0xa36a('0x55')][_0xa36a('0x79')]=_0x2d0bff[_0xa36a('0x55')][_0xa36a('0x79')]||_0x2d0bff[_0xa36a('0x69')]['id'];_0x77fabf[_0xa36a('0x8a')]['id']=_0x2d0bff[_0xa36a('0x55')]['UserId'];return db[_0xa36a('0x3b')]['find']({'where':{'id':_0x2d0bff[_0xa36a('0x52')]['id'],'UserId':null}})[_0xa36a('0x34')](handleEntityNotFound(_0x5a5ac8,null))[_0xa36a('0x34')](function(_0x29b2d9){if(_0x29b2d9){_0x77fabf[_0xa36a('0x28')]=_0x29b2d9['get']({'plain':!![]});return db[_0xa36a('0x7c')]['find']({'where':{'id':_0x29b2d9['MailInteractionId']}});}return null;})[_0xa36a('0x34')](handleEntityNotFound(_0x5a5ac8,null))[_0xa36a('0x34')](function(_0x477fcc){if(_0x477fcc){_0x77fabf[_0xa36a('0x7f')]=_0x477fcc[_0xa36a('0x7b')]({'plain':!![]});interaction_log[_0xa36a('0x8b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d0bff[_0xa36a('0x69')]['id'],_0x2d0bff[_0xa36a('0x69')][_0xa36a('0x37')],_0x2d0bff[_0xa36a('0x69')][_0xa36a('0x81')],_0x77fabf[_0xa36a('0x7f')]['id'],_0x2d0bff['body']?JSON['stringify'](_0x2d0bff['body']):_0xa36a('0x82'));return respondWithRpcPromise(_0xa36a('0x8c'),_0xa36a('0x8d'),_0x77fabf);}return null;})[_0xa36a('0x34')](function(_0x1fafdf){if(_0x1fafdf){_0x1fafdf[_0xa36a('0x28')][_0xa36a('0x85')]=util[_0xa36a('0x77')](_0xa36a('0x8e'),_0x2d0bff['user']['name']);_0x1fafdf[_0xa36a('0x28')][_0xa36a('0x86')]=_0x77fabf['channel'];_0x1fafdf[_0xa36a('0x28')][_0xa36a('0x87')]=_0xa36a('0x89');respondWithRpcPromise('EventManager',_0xa36a('0x88'),{'event':_0xa36a('0x8f'),'message':_0x1fafdf[_0xa36a('0x28')]},client9002);return _0x77fabf;}return null;})[_0xa36a('0x34')](respondWithResult(_0x5a5ac8,null))[_0xa36a('0x2a')](handleError(_0x5a5ac8,null));};exports[_0xa36a('0x90')]=function(_0x1f6f8f,_0x2fac01){var _0x415f1d=moment()[_0xa36a('0x91')]()['toString']();var _0x5d6bd=path[_0xa36a('0x6b')](config[_0xa36a('0x6c')],_0xa36a('0x92'),_0xa36a('0x93'),_0xa36a('0x94'));var _0x1c0bc9=path[_0xa36a('0x6b')](config[_0xa36a('0x6c')],_0xa36a('0x92'),_0xa36a('0x93'),_0xa36a('0x6a'));var _0x1eab0=util[_0xa36a('0x77')](_0xa36a('0x95'),_0x415f1d);return db[_0xa36a('0x3b')][_0xa36a('0x53')]({'where':{'id':_0x1f6f8f[_0xa36a('0x52')]['id']},'attributes':['id',_0xa36a('0x55'),_0xa36a('0x96'),'to','cc',_0xa36a('0x97'),_0xa36a('0x98'),_0xa36a('0x99')],'include':_0x1f6f8f['query']['attachments']?[{'model':db[_0xa36a('0x9a')],'as':'Attachments'}]:undefined})[_0xa36a('0x34')](handleEntityNotFound(_0x2fac01,null))['then'](function(_0x4dd808){if(_0x4dd808){var _0x2d3136=_0x4dd808;var _0x39be2d={'from':_0x2d3136[_0xa36a('0x96')],'to':_0x2d3136['to'],'subject':_0x2d3136[_0xa36a('0x98')],'html':_0x2d3136[_0xa36a('0x55')],'headers':{'Date':moment(_0x2d3136[_0xa36a('0x99')])['format'](_0xa36a('0x9b'))},'attachments':[]};if(_0x4dd808['cc']){_0x39be2d[_0xa36a('0x9c')]['Cc']=_0x4dd808['cc'];}if(_0x4dd808[_0xa36a('0x97')]){_0x39be2d[_0xa36a('0x9c')]['Bcc']=_0x4dd808[_0xa36a('0x97')];}return new BPromise(function(_0x4443d6,_0x5823cd){if(_0x4dd808[_0xa36a('0x9d')]){for(var _0x230607=0x0;_0x230607<_0x4dd808[_0xa36a('0x9d')][_0xa36a('0x47')];_0x230607++){var _0x2c6284=_0x4dd808['Attachments'][_0x230607];var _0x57bde4=path[_0xa36a('0x6b')](_0x1c0bc9,_0x2c6284[_0xa36a('0x6d')]);if(fs['existsSync'](_0x57bde4)){_0x39be2d[_0xa36a('0x6a')][_0xa36a('0x9e')]({'name':_0x2c6284[_0xa36a('0x37')],'contentType':_0x2c6284['type'],'data':fs[_0xa36a('0x9f')](_0x57bde4)});}}}emlformat[_0xa36a('0xa0')](_0x39be2d,function(_0x16c10d,_0x5bba98){if(_0x16c10d)return _0x5823cd(_0x16c10d);fs['writeFileSync'](path[_0xa36a('0x6b')](_0x5d6bd,_0x1eab0),_0x5bba98);return _0x4443d6(_0x5bba98);});});}})['then'](function(_0x40bb7b){if(_0x40bb7b){return _0x2fac01['download'](path[_0xa36a('0x6b')](_0x5d6bd,_0x1eab0),_0x1eab0,function(_0x44f07){if(_0x44f07){console[_0xa36a('0xa1')](_0xa36a('0xa2'),_0x44f07);}else{fs[_0xa36a('0xa3')](path[_0xa36a('0x6b')](_0x5d6bd,_0x1eab0));}});}})['catch'](handleError(_0x2fac01,null));}; \ No newline at end of file +var _0x177e=['accept','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','unix','toString','join','server','files','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','readFileSync','build','writeFileSync','download','unlinkSync','bluebird','mustache','util','to-csv','ejs','lodash','crypto','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','register','jayson/promise','client','http','test','request','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','end','status','json','offset','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','then','include','findAll','show','params','includeAll','find','body','describe','create','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','service','host','port','secure','auth','user','pass','attachments','root','server/files/attachments','basename','Contacts','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions'];(function(_0x637c33,_0x92f772){var _0x702222=function(_0x145b36){while(--_0x145b36){_0x637c33['push'](_0x637c33['shift']());}};_0x702222(++_0x92f772);}(_0x177e,0xd0));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe177('0x0'));var Mustache=require(_0xe177('0x1'));var util=require(_0xe177('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0xe177('0x3'));var ejs=require(_0xe177('0x4'));var fs=require('fs');var _=require(_0xe177('0x5'));var squel=require('squel');var crypto=require(_0xe177('0x6'));var jsforce=require(_0xe177('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe177('0x3'));var querystring=require(_0xe177('0x8'));var Papa=require(_0xe177('0x9'));var Redis=require(_0xe177('0xa'));var authService=require(_0xe177('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xe177('0xc'));var hardwareService=require(_0xe177('0xd'));var logger=require(_0xe177('0xe'))(_0xe177('0xf'));var utils=require('../../config/utils');var config=require(_0xe177('0x10'));var db=require(_0xe177('0x11'))['db'];config[_0xe177('0x12')]=_[_0xe177('0x13')](config[_0xe177('0x12')],{'host':_0xe177('0x14'),'port':0x18eb});var socket=require(_0xe177('0x15'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xe177('0x16')](socket);var jayson=require(_0xe177('0x17'));var client=jayson[_0xe177('0x18')]['http']({'port':0x232c});var client9003=jayson[_0xe177('0x18')][_0xe177('0x19')]({'port':0x232b});var client9002=jayson[_0xe177('0x18')][_0xe177('0x19')]({'port':0x232a});function checkPasswordPattern(_0x61eb22,_0xdac6e7,_0x4e38bf){if(_0x4e38bf){var _0x5968a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5968a7[_0xe177('0x1a')](_0xdac6e7)){return _0x61eb22;}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 _0x61eb22;}}function respondWithRpcPromise(_0x2b8745,_0x59cf0a,_0x145e87,_0x4d8f80){return new BPromise(function(_0x21eccf,_0x5a3c8b){var _0x8e9ba5=_0x4d8f80||client;return _0x8e9ba5[_0xe177('0x1b')](_0x2b8745,_0x145e87)['then'](function(_0x381466){logger['info'](_0xe177('0x1c'),_0x59cf0a,'request\x20sent');logger[_0xe177('0x1d')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x59cf0a,_0xe177('0x1e'),JSON[_0xe177('0x1f')](_0x381466));if(_0x381466[_0xe177('0x20')]){if(_0x381466['error']['code']===0x1f4){logger[_0xe177('0x20')](_0xe177('0x1c'),_0x59cf0a,_0x381466[_0xe177('0x20')][_0xe177('0x21')]);return _0x5a3c8b(_0x381466[_0xe177('0x20')][_0xe177('0x21')]);}logger[_0xe177('0x20')](_0xe177('0x1c'),_0x59cf0a,_0x381466[_0xe177('0x20')][_0xe177('0x21')]);return _0x21eccf(_0x381466[_0xe177('0x20')][_0xe177('0x21')]);}else{logger[_0xe177('0x22')](_0xe177('0x1c'),_0x59cf0a,'request\x20sent');_0x21eccf(_0x381466['result']['message']);}})[_0xe177('0x23')](function(_0x291331){logger['error']('MailMessage,\x20%s,\x20%s',_0x59cf0a,_0x291331);_0x5a3c8b(_0x291331);});});}function respondWithStatusCode(_0x377838,_0x449bee){_0x449bee=_0x449bee||0xcc;return function(_0x1c519b){if(_0x1c519b){return _0x377838['sendStatus'](_0x449bee);}return _0x377838['status'](_0x449bee)[_0xe177('0x24')]();};}function respondWithResult(_0x1466ab,_0x126d92){_0x126d92=_0x126d92||0xc8;return function(_0x5c2c35){if(_0x5c2c35){return _0x1466ab[_0xe177('0x25')](_0x126d92)[_0xe177('0x26')](_0x5c2c35);}};}function respondWithFilteredResult(_0x582d1b,_0x16e864){return function(_0x50e592){if(_0x50e592){var _0x37e895=_0x50e592['count'],_0x428167=_0x16e864[_0xe177('0x27')],_0x24a742=_0x16e864[_0xe177('0x27')]+_0x16e864['limit'],_0xd1aaa;if(_0x24a742>=_0x37e895){_0x24a742=_0x37e895;_0xd1aaa=0xc8;}else{_0xd1aaa=0xce;}_0x582d1b['status'](_0xd1aaa);return _0x582d1b['set']('Content-Range',_0x428167+'-'+_0x24a742+'/'+_0x37e895)[_0xe177('0x26')](_0x50e592);}return null;};}function patchUpdates(_0x5cc273){return function(_0xba6110){try{jsonpatch[_0xe177('0x28')](_0xba6110,_0x5cc273,!![]);}catch(_0x105346){return BPromise[_0xe177('0x29')](_0x105346);}return _0xba6110[_0xe177('0x2a')]();};}function saveUpdates(_0x5c9be3,_0x50c46a){return function(_0x20f868){if(_0x20f868){return _0x20f868[_0xe177('0x2b')](_0x5c9be3)['then'](function(_0x361c54){return _0x361c54;});}return null;};}function removeEntity(_0x56b0d0,_0x24919d){return function(_0x5315e5){if(_0x5315e5){return _0x5315e5[_0xe177('0x2c')]()['then'](function(){_0x56b0d0[_0xe177('0x25')](0xcc)[_0xe177('0x24')]();});}};}function handleEntityNotFound(_0x519079,_0x2133b8){return function(_0x30d3f0){if(!_0x30d3f0){_0x519079[_0xe177('0x2d')](0x194);}return _0x30d3f0;};}function handleError(_0x283248,_0x36b9df){_0x36b9df=_0x36b9df||0x1f4;return function(_0x117162){logger[_0xe177('0x20')](_0x117162[_0xe177('0x2e')]);if(_0x117162['name']){delete _0x117162[_0xe177('0x2f')];}_0x283248['status'](_0x36b9df)[_0xe177('0x30')](_0x117162);};}exports['index']=function(_0xd92261,_0x2c7a48){var _0x10484d={},_0x2ecfbc={},_0x58b5f3={'count':0x0,'rows':[]};var _0x2a93ca=_[_0xe177('0x31')](db[_0xe177('0x32')][_0xe177('0x33')],function(_0x28653b){return{'name':_0x28653b['fieldName'],'type':_0x28653b[_0xe177('0x34')]['key']};});_0x2ecfbc[_0xe177('0x35')]=_[_0xe177('0x31')](_0x2a93ca,_0xe177('0x2f'));_0x2ecfbc[_0xe177('0x36')]=_[_0xe177('0x37')](_0xd92261[_0xe177('0x36')]);_0x2ecfbc['filters']=_[_0xe177('0x38')](_0x2ecfbc['model'],_0x2ecfbc[_0xe177('0x36')]);_0x10484d[_0xe177('0x39')]=_[_0xe177('0x38')](_0x2ecfbc['model'],qs[_0xe177('0x3a')](_0xd92261[_0xe177('0x36')]['fields']));_0x10484d[_0xe177('0x39')]=_0x10484d[_0xe177('0x39')][_0xe177('0x3b')]?_0x10484d[_0xe177('0x39')]:_0x2ecfbc[_0xe177('0x35')];if(!_0xd92261[_0xe177('0x36')][_0xe177('0x3c')](_0xe177('0x3d'))){_0x10484d['limit']=qs[_0xe177('0x3e')](_0xd92261[_0xe177('0x36')]['limit']);_0x10484d[_0xe177('0x27')]=qs[_0xe177('0x27')](_0xd92261[_0xe177('0x36')][_0xe177('0x27')]);}_0x10484d[_0xe177('0x3f')]=qs[_0xe177('0x40')](_0xd92261[_0xe177('0x36')][_0xe177('0x40')]);_0x10484d[_0xe177('0x41')]=qs[_0xe177('0x42')](_[_0xe177('0x43')](_0xd92261[_0xe177('0x36')],_0x2ecfbc['filters']),_0x2a93ca);if(_0xd92261[_0xe177('0x36')][_0xe177('0x44')]){_0x10484d['where']=_[_0xe177('0x45')](_0x10484d[_0xe177('0x41')],{'$or':_[_0xe177('0x31')](_0x2a93ca,function(_0x5bdd79){if(_0x5bdd79[_0xe177('0x34')]!==_0xe177('0x46')){var _0x4c09fd={};_0x4c09fd[_0x5bdd79['name']]={'$like':'%'+_0xd92261['query'][_0xe177('0x44')]+'%'};return _0x4c09fd;}})});}_0x10484d=_[_0xe177('0x45')]({},_0x10484d,_0xd92261[_0xe177('0x47')]);var _0x55e089={'where':_0x10484d['where']};return db[_0xe177('0x32')][_0xe177('0x48')](_0x55e089)[_0xe177('0x49')](function(_0x3d5096){_0x58b5f3['count']=_0x3d5096;if(_0xd92261['query']['includeAll']){_0x10484d[_0xe177('0x4a')]=[{'all':!![]}];}return db['MailMessage'][_0xe177('0x4b')](_0x10484d);})['then'](function(_0x525ac9){_0x58b5f3['rows']=_0x525ac9;return _0x58b5f3;})[_0xe177('0x49')](respondWithFilteredResult(_0x2c7a48,_0x10484d))['catch'](handleError(_0x2c7a48,null));};exports[_0xe177('0x4c')]=function(_0x3418f4,_0x2435f4){var _0x45645b={'raw':!![],'where':{'id':_0x3418f4[_0xe177('0x4d')]['id']}},_0x2650e3={};_0x2650e3[_0xe177('0x35')]=_[_0xe177('0x37')](db[_0xe177('0x32')][_0xe177('0x33')]);_0x2650e3[_0xe177('0x36')]=_['keys'](_0x3418f4['query']);_0x2650e3[_0xe177('0x42')]=_[_0xe177('0x38')](_0x2650e3[_0xe177('0x35')],_0x2650e3[_0xe177('0x36')]);_0x45645b['attributes']=_[_0xe177('0x38')](_0x2650e3['model'],qs[_0xe177('0x3a')](_0x3418f4[_0xe177('0x36')][_0xe177('0x3a')]));_0x45645b['attributes']=_0x45645b[_0xe177('0x39')][_0xe177('0x3b')]?_0x45645b[_0xe177('0x39')]:_0x2650e3[_0xe177('0x35')];if(_0x3418f4[_0xe177('0x36')][_0xe177('0x4e')]){_0x45645b[_0xe177('0x4a')]=[{'all':!![]}];}_0x45645b=_[_0xe177('0x45')]({},_0x45645b,_0x3418f4[_0xe177('0x47')]);return db[_0xe177('0x32')][_0xe177('0x4f')](_0x45645b)[_0xe177('0x49')](handleEntityNotFound(_0x2435f4,null))[_0xe177('0x49')](respondWithResult(_0x2435f4,null))[_0xe177('0x23')](handleError(_0x2435f4,null));};exports[_0xe177('0x2b')]=function(_0x4642d5,_0x308c8d){if(_0x4642d5[_0xe177('0x50')]['id']){delete _0x4642d5[_0xe177('0x50')]['id'];}return db['MailMessage'][_0xe177('0x4f')]({'where':{'id':_0x4642d5[_0xe177('0x4d')]['id']}})[_0xe177('0x49')](handleEntityNotFound(_0x308c8d,null))['then'](saveUpdates(_0x4642d5[_0xe177('0x50')],null))[_0xe177('0x49')](respondWithResult(_0x308c8d,null))['catch'](handleError(_0x308c8d,null));};exports[_0xe177('0x2c')]=function(_0x1f41c9,_0x247e33){return db['MailMessage'][_0xe177('0x4f')]({'where':{'id':_0x1f41c9[_0xe177('0x4d')]['id']}})[_0xe177('0x49')](handleEntityNotFound(_0x247e33,null))[_0xe177('0x49')](removeEntity(_0x247e33,null))[_0xe177('0x23')](handleError(_0x247e33,null));};exports[_0xe177('0x51')]=function(_0x2fb2c5,_0x4cb02c){return db[_0xe177('0x32')][_0xe177('0x51')]()[_0xe177('0x49')](respondWithResult(_0x4cb02c,null))[_0xe177('0x23')](handleError(_0x4cb02c,null));};exports[_0xe177('0x52')]=function(_0x46937f,_0x334cd5){return db[_0xe177('0x32')][_0xe177('0x52')](_0x46937f['body'])[_0xe177('0x49')](function(_0x4c4f95){if(_0x4c4f95){if(_0x4c4f95['direction']===_0xe177('0x53')&&!_0x4c4f95[_0xe177('0x54')]){var _0x349327,_0x42ff50,_0x28f4bf;if(_0x46937f[_0xe177('0x50')]['to']){_0x42ff50=_0x46937f[_0xe177('0x50')]['to'][_0xe177('0x55')](',')[0x0];}return db['MailAccount'][_0xe177('0x56')]({'where':{'id':_0x4c4f95[_0xe177('0x57')]},'include':[{'model':db[_0xe177('0x58')],'as':_0xe177('0x59'),'include':[{'model':db[_0xe177('0x5a')],'as':'Contacts','where':{'email':_0x42ff50},'limit':0x1,'order':[['updatedAt',_0xe177('0x5b')]]}]},{'model':db[_0xe177('0x5c')],'as':_0xe177('0x5d'),'raw':!![]}]})[_0xe177('0x49')](function(_0x1d3397){_0x349327=_0x1d3397;if(_0x349327&&_0x349327[_0xe177('0x5d')]){var _0x564e9f={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x349327[_0xe177('0x5d')][_0xe177('0x5e')])){_0x564e9f[_0xe177('0x5f')]=_0x349327[_0xe177('0x5d')][_0xe177('0x5f')];_0x564e9f[_0xe177('0x60')]=_0x349327[_0xe177('0x5d')]['port'];_0x564e9f[_0xe177('0x61')]=_0x349327[_0xe177('0x5d')][_0xe177('0x61')];if(_0x349327[_0xe177('0x5d')]['authentication']){_0x564e9f[_0xe177('0x62')]={'user':_0x349327[_0xe177('0x5d')][_0xe177('0x63')],'pass':_0x349327[_0xe177('0x5d')][_0xe177('0x64')]};}}else{_0x564e9f['service']=_0x349327[_0xe177('0x5d')][_0xe177('0x5e')];_0x564e9f['auth']={'user':_0x349327['Smtp'][_0xe177('0x63')],'pass':_0x349327[_0xe177('0x5d')][_0xe177('0x64')]};_0x564e9f[_0xe177('0x61')]=_0x349327[_0xe177('0x5d')]['secure'];}if(_0x46937f[_0xe177('0x50')][_0xe177('0x65')]&&_0x46937f['body'][_0xe177('0x65')][_0xe177('0x3b')]){for(var _0x25afb6=0x0;_0x25afb6<_0x46937f[_0xe177('0x50')][_0xe177('0x65')][_0xe177('0x3b')];_0x25afb6+=0x1){_0x46937f[_0xe177('0x50')][_0xe177('0x65')][_0x25afb6]={'filename':_0x46937f['body'][_0xe177('0x65')][_0x25afb6]['name'],'path':path['join'](config[_0xe177('0x66')],_0xe177('0x67'),_0x46937f['body']['attachments'][_0x25afb6][_0xe177('0x68')])};}}_0x28f4bf={'account':_0x564e9f,'message':_0x46937f['body']};return;}})[_0xe177('0x49')](function(){if(_0x349327[_0xe177('0x59')]){if(_0x349327[_0xe177('0x59')][_0xe177('0x69')]['length']){return _0x349327['List'][_0xe177('0x69')][0x0];}else{return db['CmContact'][_0xe177('0x52')](_[_0xe177('0x13')](_0x46937f[_0xe177('0x50')],{'firstName':_0x46937f[_0xe177('0x50')]['to'],'email':_0x46937f[_0xe177('0x50')]['to'],'phone':_0x46937f[_0xe177('0x50')]['to'],'ListId':_0x349327['ListId']}));}}else{throw new Error(_0xe177('0x6a'));}})[_0xe177('0x49')](function(){if(_0x28f4bf){return respondWithRpcPromise(_0xe177('0x6b'),_0xe177('0x6c'),_0x28f4bf,client9003)[_0xe177('0x49')](function(_0x198a4a){return _0x4c4f95[_0xe177('0x2b')]({'read':!![],'messageId':_0x198a4a['messageId'],'sentAt':moment()[_0xe177('0x6d')](_0xe177('0x6e'))});})['catch'](function(_0x2a6763){logger['error']('%s',JSON[_0xe177('0x1f')](_0x2a6763));return _0x4c4f95;});}return _0x4c4f95;});}return _0x4c4f95;}})[_0xe177('0x49')](respondWithResult(_0x334cd5,0xc9))[_0xe177('0x23')](handleError(_0x334cd5,null));};var interaction_log=require('../../config/logger')(_0xe177('0x6f'));exports[_0xe177('0x70')]=function(_0x25087b,_0x2d5804,_0x57befa){var _0x1af8c0={'channel':_0xe177('0x71')};if(_0x25087b['body']['id']){delete _0x25087b[_0xe177('0x50')]['id'];}_0x25087b[_0xe177('0x50')][_0xe177('0x72')]=!![];_0x25087b['body']['readAt']=moment()[_0xe177('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');_0x25087b[_0xe177('0x50')][_0xe177('0x73')]=_0x25087b['body'][_0xe177('0x73')]||_0x25087b[_0xe177('0x63')]['id'];return db[_0xe177('0x32')]['find']({'where':{'id':_0x25087b[_0xe177('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0xe177('0x5a')],'as':_0xe177('0x74')}]})['then'](handleEntityNotFound(_0x2d5804,null))['then'](saveUpdates(_0x25087b['body'],null))[_0xe177('0x49')](function(_0x1fd6f3){if(_0x1fd6f3){_0x1af8c0['message']=_0x1fd6f3[_0xe177('0x75')]({'plain':!![]});return db[_0xe177('0x76')][_0xe177('0x4f')]({'where':{'id':_0x1fd6f3[_0xe177('0x77')]}});}return null;})[_0xe177('0x49')](handleEntityNotFound(_0x2d5804,null))[_0xe177('0x49')](function(_0xd77074){if(_0xd77074){return _0xd77074[_0xe177('0x2b')]({'UserId':_0x25087b['body'][_0xe177('0x73')],'read1stAt':_[_0xe177('0x78')](_0xd77074[_0xe177('0x79')])?moment()['format'](_0xe177('0x6e')):undefined});}return null;})['then'](function(_0x774813){if(_0x774813){_0x1af8c0[_0xe177('0x7a')]=_0x774813[_0xe177('0x75')]({'plain':!![]});interaction_log[_0xe177('0x22')](_0xe177('0x7b'),_0x25087b['user']['id'],_0x25087b[_0xe177('0x63')][_0xe177('0x2f')],_0x25087b[_0xe177('0x63')][_0xe177('0x7c')],_0x1af8c0['interaction']['id'],_0x25087b[_0xe177('0x50')]?JSON[_0xe177('0x1f')](_0x25087b['body']):_0xe177('0x7d'));return respondWithRpcPromise(_0xe177('0x7e'),_0xe177('0x7f'),_0x1af8c0);}return null;})[_0xe177('0x49')](function(_0x54ed67){if(_0x54ed67){if(_0x25087b[_0xe177('0x50')][_0xe177('0x80')]){_0x1af8c0[_0xe177('0x21')]['interface']=util[_0xe177('0x6d')](_0xe177('0x81'),_0x25087b['user'][_0xe177('0x2f')]);_0x1af8c0[_0xe177('0x21')][_0xe177('0x82')]=_0x1af8c0[_0xe177('0x82')];_0x1af8c0[_0xe177('0x21')][_0xe177('0x83')]=_0xe177('0x70');return respondWithRpcPromise(_0xe177('0x84'),_0xe177('0x84'),{'event':_0xe177('0x85'),'message':_0x1af8c0[_0xe177('0x21')]},client9002)[_0xe177('0x49')](function(){return _0x1af8c0;});}return _0x1af8c0;}return null;})[_0xe177('0x49')](respondWithResult(_0x2d5804,null))['catch'](handleError(_0x2d5804,null));};var interaction_log=require(_0xe177('0xe'))(_0xe177('0x6f'));exports[_0xe177('0x29')]=function(_0x52d84f,_0x413607,_0x5e35b3){var _0x35ff7e={'agent':{},'channel':_0xe177('0x71')};if(_0x52d84f[_0xe177('0x50')]['id']){delete _0x52d84f[_0xe177('0x50')]['id'];}_0x52d84f[_0xe177('0x50')][_0xe177('0x73')]=_0x52d84f[_0xe177('0x50')]['UserId']||_0x52d84f[_0xe177('0x63')]['id'];_0x35ff7e[_0xe177('0x86')]['id']=_0x52d84f[_0xe177('0x50')][_0xe177('0x73')];return db['MailMessage']['find']({'where':{'id':_0x52d84f['params']['id'],'UserId':null}})[_0xe177('0x49')](handleEntityNotFound(_0x413607,null))[_0xe177('0x49')](function(_0x221b62){if(_0x221b62){_0x35ff7e['message']=_0x221b62['get']({'plain':!![]});return db['MailInteraction'][_0xe177('0x4f')]({'where':{'id':_0x221b62[_0xe177('0x77')]}});}return null;})[_0xe177('0x49')](handleEntityNotFound(_0x413607,null))[_0xe177('0x49')](function(_0x141ac8){if(_0x141ac8){_0x35ff7e[_0xe177('0x7a')]=_0x141ac8[_0xe177('0x75')]({'plain':!![]});interaction_log['info'](_0xe177('0x87'),_0x52d84f['user']['id'],_0x52d84f[_0xe177('0x63')][_0xe177('0x2f')],_0x52d84f[_0xe177('0x63')][_0xe177('0x7c')],_0x35ff7e[_0xe177('0x7a')]['id'],_0x52d84f['body']?JSON[_0xe177('0x1f')](_0x52d84f['body']):_0xe177('0x7d'));return respondWithRpcPromise(_0xe177('0x88'),'rejectMessage',_0x35ff7e);}return null;})['then'](function(_0x788658){if(_0x788658){_0x788658[_0xe177('0x21')][_0xe177('0x89')]=util[_0xe177('0x6d')](_0xe177('0x81'),_0x52d84f['user'][_0xe177('0x2f')]);_0x788658['message']['channel']=_0x35ff7e['channel'];_0x788658[_0xe177('0x21')]['event']='reject';respondWithRpcPromise('EventManager',_0xe177('0x84'),{'event':_0xe177('0x8a'),'message':_0x788658[_0xe177('0x21')]},client9002);return _0x35ff7e;}return null;})[_0xe177('0x49')](respondWithResult(_0x413607,null))[_0xe177('0x23')](handleError(_0x413607,null));};exports['download']=function(_0x59ec43,_0xe567e7){var _0x172fcb=moment()[_0xe177('0x8b')]()[_0xe177('0x8c')]();var _0x400a11=path[_0xe177('0x8d')](config['root'],_0xe177('0x8e'),_0xe177('0x8f'),_0xe177('0x90'));var _0x17a54c=path[_0xe177('0x8d')](config['root'],_0xe177('0x8e'),'files',_0xe177('0x65'));var _0x4eb6bb=util[_0xe177('0x6d')](_0xe177('0x91'),_0x172fcb);return db['MailMessage'][_0xe177('0x4f')]({'where':{'id':_0x59ec43[_0xe177('0x4d')]['id']},'attributes':['id',_0xe177('0x50'),_0xe177('0x92'),'to','cc','bcc','subject',_0xe177('0x93')],'include':_0x59ec43[_0xe177('0x36')][_0xe177('0x65')]?[{'model':db[_0xe177('0x94')],'as':_0xe177('0x95')}]:undefined})['then'](handleEntityNotFound(_0xe567e7,null))[_0xe177('0x49')](function(_0x55aebc){if(_0x55aebc){var _0x50ce21=_0x55aebc;var _0x1a8628={'from':_0x50ce21[_0xe177('0x92')],'to':_0x50ce21['to'],'subject':_0x50ce21[_0xe177('0x96')],'html':_0x50ce21[_0xe177('0x50')],'headers':{'Date':moment(_0x50ce21['createdAt'])[_0xe177('0x6d')](_0xe177('0x97'))},'attachments':[]};if(_0x55aebc['cc']){_0x1a8628[_0xe177('0x98')]['Cc']=_0x55aebc['cc'];}if(_0x55aebc[_0xe177('0x99')]){_0x1a8628[_0xe177('0x98')][_0xe177('0x9a')]=_0x55aebc[_0xe177('0x99')];}return new BPromise(function(_0x22e7c2,_0x18b1c3){if(_0x55aebc['Attachments']){for(var _0x379733=0x0;_0x379733<_0x55aebc[_0xe177('0x95')][_0xe177('0x3b')];_0x379733++){var _0x490943=_0x55aebc[_0xe177('0x95')][_0x379733];var _0x571520=path['join'](_0x17a54c,_0x490943[_0xe177('0x68')]);if(fs['existsSync'](_0x571520)){_0x1a8628['attachments']['push']({'name':_0x490943[_0xe177('0x2f')],'contentType':_0x490943[_0xe177('0x34')],'data':fs[_0xe177('0x9b')](_0x571520)});}}}emlformat[_0xe177('0x9c')](_0x1a8628,function(_0x4031ae,_0x6ef1f2){if(_0x4031ae)return _0x18b1c3(_0x4031ae);fs[_0xe177('0x9d')](path[_0xe177('0x8d')](_0x400a11,_0x4eb6bb),_0x6ef1f2);return _0x22e7c2(_0x6ef1f2);});});}})[_0xe177('0x49')](function(_0x1bc17e){if(_0x1bc17e){return _0xe567e7[_0xe177('0x9e')](path[_0xe177('0x8d')](_0x400a11,_0x4eb6bb),_0x4eb6bb,function(_0x13113d){if(_0x13113d){console['log']('err',_0x13113d);}else{fs[_0xe177('0x9f')](path[_0xe177('0x8d')](_0x400a11,_0x4eb6bb));}});}})['catch'](handleError(_0xe567e7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fe981ad..4ecbe20 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 _0xed31=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xed31,0x1c9));var _0x1ed3=function(_0x1bea0f,_0x4e2edb){_0x1bea0f=_0x1bea0f-0x0;var _0xd24123=_0xed31[_0x1bea0f];return _0xd24123;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x1ed3('0x0'))['db'][_0x1ed3('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1ed3('0x2')](0x0);var events={'afterCreate':_0x1ed3('0x3'),'afterUpdate':_0x1ed3('0x4'),'afterDestroy':_0x1ed3('0x5')};function emitEvent(_0x5e0baa){return function(_0x557ea8,_0x37d3ea,_0x5eeac2){MailMessageEvents['emit'](_0x5e0baa+':'+_0x557ea8['id'],_0x557ea8);MailMessageEvents[_0x1ed3('0x6')](_0x5e0baa,_0x557ea8);_0x5eeac2(null);};}for(var e in events){if(events[_0x1ed3('0x7')](e)){var event=events[e];MailMessage[_0x1ed3('0x8')](e,emitEvent(event));}}module[_0x1ed3('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x25e7=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x2e6dc3,_0x404496){var _0x2f4ddb=function(_0x242063){while(--_0x242063){_0x2e6dc3['push'](_0x2e6dc3['shift']());}};_0x2f4ddb(++_0x404496);}(_0x25e7,0x106));var _0x725e=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0x25e7[_0x2f421];return _0x27b4af;};'use strict';var EventEmitter=require(_0x725e('0x0'));var MailMessage=require(_0x725e('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x725e('0x2')](0x0);var events={'afterCreate':_0x725e('0x3'),'afterUpdate':_0x725e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x150a11){return function(_0x2def04,_0x29ee26,_0x2d77ae){MailMessageEvents[_0x725e('0x5')](_0x150a11+':'+_0x2def04['id'],_0x2def04);MailMessageEvents[_0x725e('0x5')](_0x150a11,_0x2def04);_0x2d77ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x725e('0x6')](e,emitEvent(event));}}module[_0x725e('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e8f57ad..d84ae09 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 _0x95a8=['get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models'];(function(_0x535ff8,_0x4d89ac){var _0x4f1a77=function(_0x40bd79){while(--_0x40bd79){_0x535ff8['push'](_0x535ff8['shift']());}};_0x4f1a77(++_0x4d89ac);}(_0x95a8,0x140));var _0x895a=function(_0x1236b7,_0x1c53bf){_0x1236b7=_0x1236b7-0x0;var _0x58e712=_0x95a8[_0x1236b7];return _0x58e712;};'use strict';var _=require(_0x895a('0x0'));var util=require(_0x895a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x895a('0x2'));var BPromise=require(_0x895a('0x3'));var rp=require(_0x895a('0x4'));var htmlToText=require(_0x895a('0x5'));var fs=require('fs');var path=require(_0x895a('0x6'));var rimraf=require(_0x895a('0x7'));var config=require(_0x895a('0x8'));var attributes=require('./mailMessage.attributes');module[_0x895a('0x9')]=function(_0x1bb99b,_0x220095){return _0x1bb99b[_0x895a('0xa')](_0x895a('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x895a('0xc')]},{'name':_0x895a('0xd'),'fields':[_0x895a('0xe'),_0x895a('0xf')],'type':_0x895a('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b6aca,_0x28f58e,_0x39e0de){if(_0x5b6aca[_0x895a('0x11')]){_0x5b6aca['plainBody']=htmlToText[_0x895a('0x12')](_0x5b6aca[_0x895a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x39e0de(null,_0x28f58e);},'afterCreate':function(_0x398c95,_0x14e507,_0x3d21a0){var _0x5a8919=_0x1bb99b[_0x895a('0x13')];var _0x2737f0=_0x398c95[_0x895a('0x14')]({'plain':!![]});if(_0x2737f0['direction']['toLowerCase']()==='in'||_0x2737f0[_0x895a('0x15')][_0x895a('0x16')]()===_0x895a('0x17')&&!_0x2737f0[_0x895a('0x18')]&&!_['isNil'](_0x2737f0[_0x895a('0x19')])){_0x5a8919[_0x895a('0x1a')][_0x895a('0x1b')]({'where':{'id':_0x2737f0['MailInteractionId']}})[_0x895a('0x1c')](function(_0x5b8798){if(_0x5b8798){_0x5b8798[_0x895a('0x1d')]({'lastMsgAt':_0x2737f0[_0x895a('0x1e')],'lastMsgDirection':_0x2737f0[_0x895a('0x15')][_0x895a('0x16')](),'lastMsgBody':_0x2737f0[_0x895a('0x11')]});}})[_0x895a('0x1f')](function(_0x431ca4){console[_0x895a('0x20')](_0x431ca4);});}_0x3d21a0();}},'charset':'utf8mb4','collate':_0x895a('0x21')});}; \ No newline at end of file +var _0xa882=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','rimraf','../../config/environment','exports','define','MailMessage','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','UserId','findOne','MailInteractionId','then','update','catch','error'];(function(_0x517a50,_0x57eb49){var _0x1a7779=function(_0x2ef097){while(--_0x2ef097){_0x517a50['push'](_0x517a50['shift']());}};_0x1a7779(++_0x57eb49);}(_0xa882,0xda));var _0x2a88=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xa882[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x2a88('0x0'));var util=require(_0x2a88('0x1'));var logger=require(_0x2a88('0x2'))(_0x2a88('0x3'));var moment=require(_0x2a88('0x4'));var BPromise=require(_0x2a88('0x5'));var rp=require('request-promise');var htmlToText=require(_0x2a88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a88('0x7'));var config=require(_0x2a88('0x8'));var attributes=require('./mailMessage.attributes');module[_0x2a88('0x9')]=function(_0x11c21c,_0x4bb2d8){return _0x11c21c[_0x2a88('0xa')](_0x2a88('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x2a88('0xc'),'fields':[_0x2a88('0xd'),_0x2a88('0xe')],'type':_0x2a88('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x292e53,_0x42f15f,_0x13ae5a){if(_0x292e53[_0x2a88('0x10')]){_0x292e53[_0x2a88('0xd')]=htmlToText[_0x2a88('0x11')](_0x292e53[_0x2a88('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13ae5a(null,_0x42f15f);},'afterCreate':function(_0x2b9019,_0x33a446,_0x31e957){var _0x3609c5=_0x11c21c[_0x2a88('0x12')];var _0x5f1b2b=_0x2b9019[_0x2a88('0x13')]({'plain':!![]});if(_0x5f1b2b[_0x2a88('0x14')][_0x2a88('0x15')]()==='in'||_0x5f1b2b[_0x2a88('0x14')]['toLowerCase']()===_0x2a88('0x16')&&!_0x5f1b2b['secret']&&!_['isNil'](_0x5f1b2b[_0x2a88('0x17')])){_0x3609c5['MailInteraction'][_0x2a88('0x18')]({'where':{'id':_0x5f1b2b[_0x2a88('0x19')]}})[_0x2a88('0x1a')](function(_0x612c08){if(_0x612c08){_0x612c08[_0x2a88('0x1b')]({'lastMsgAt':_0x5f1b2b['createdAt'],'lastMsgDirection':_0x5f1b2b[_0x2a88('0x14')]['toLowerCase'](),'lastMsgBody':_0x5f1b2b[_0x2a88('0x10')]});}})[_0x2a88('0x1c')](function(_0x1ddfab){console[_0x2a88('0x1d')](_0x1ddfab);});}_0x31e957();}},'charset':_0x2a88('0x1e'),'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 ed893d9..6c22e16 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 _0xed5c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','MailMessage','create','body','options','raw','CreateMailMessage','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40fcad,_0x396331){var _0x4bcccc=function(_0x4e6b9d){while(--_0x4e6b9d){_0x40fcad['push'](_0x40fcad['shift']());}};_0x4bcccc(++_0x396331);}(_0xed5c,0x81));var _0xced5=function(_0x28f92e,_0x1ffe7c){_0x28f92e=_0x28f92e-0x0;var _0x4668d2=_0xed5c[_0x28f92e];return _0x4668d2;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});config['redis']=_[_0xced5('0xc')](config[_0xced5('0xd')],{'host':_0xced5('0xe'),'port':0x18eb});var socket=require(_0xced5('0xf'))(new Redis(config[_0xced5('0xd')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x708a5a,_0x2f2606,_0x37d308){return new BPromise(function(_0x10fd53,_0x5b760e){return client[_0xced5('0x10')](_0x708a5a,_0x37d308)['then'](function(_0x3ba212){logger[_0xced5('0x11')]('MailMessage,\x20%s,\x20%s',_0x2f2606,_0xced5('0x12'));logger['debug'](_0xced5('0x13'),_0x2f2606,_0xced5('0x12'),JSON[_0xced5('0x14')](_0x3ba212));if(_0x3ba212[_0xced5('0x15')]){if(_0x3ba212[_0xced5('0x15')][_0xced5('0x16')]===0x1f4){logger[_0xced5('0x15')]('MailMessage,\x20%s,\x20%s',_0x2f2606,_0x3ba212['error'][_0xced5('0x17')]);return _0x5b760e(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f2606,_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);return _0x10fd53(_0x3ba212[_0xced5('0x15')][_0xced5('0x17')]);}else{logger[_0xced5('0x11')](_0xced5('0x18'),_0x2f2606,'request\x20sent');_0x10fd53(_0x3ba212[_0xced5('0x19')][_0xced5('0x17')]);}})['catch'](function(_0x33851d){logger[_0xced5('0x15')](_0xced5('0x18'),_0x2f2606,_0x33851d);_0x5b760e(_0x33851d);});});}exports['CreateMailMessage']=function(_0x127eb4){var _0x353071=this;return new Promise(function(_0x2a5aca,_0x590e5f){return db[_0xced5('0x1a')][_0xced5('0x1b')](_0x127eb4[_0xced5('0x1c')],{'raw':_0x127eb4[_0xced5('0x1d')]?_0x127eb4[_0xced5('0x1d')][_0xced5('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1ba520){logger[_0xced5('0x11')](_0xced5('0x1f'),_0x127eb4);logger[_0xced5('0x20')](_0xced5('0x1f'),_0x127eb4,JSON[_0xced5('0x14')](_0x1ba520));_0x2a5aca(_0x1ba520);})[_0xced5('0x21')](function(_0x45766f){logger[_0xced5('0x15')](_0xced5('0x1f'),_0x45766f[_0xced5('0x17')],_0x127eb4);_0x590e5f(_0x353071[_0xced5('0x15')](0x1f4,_0x45766f[_0xced5('0x17')]));});});}; \ No newline at end of file +var _0xdc03=['CreateMailMessage','MailMessage','create','body','options','raw','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x4e3701,_0x43f440){var _0x3e4cec=function(_0x2c9b64){while(--_0x2c9b64){_0x4e3701['push'](_0x4e3701['shift']());}};_0x3e4cec(++_0x43f440);}(_0xdc03,0x65));var _0x3dc0=function(_0x2e047f,_0xf7ec05){_0x2e047f=_0x2e047f-0x0;var _0x4074eb=_0xdc03[_0x2e047f];return _0x4074eb;};'use strict';var _=require(_0x3dc0('0x0'));var util=require('util');var moment=require(_0x3dc0('0x1'));var BPromise=require(_0x3dc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dc0('0x3'));var db=require(_0x3dc0('0x4'))['db'];var utils=require(_0x3dc0('0x5'));var logger=require(_0x3dc0('0x6'))(_0x3dc0('0x7'));var config=require(_0x3dc0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dc0('0x9')][_0x3dc0('0xa')]({'port':0x232a});config[_0x3dc0('0xb')]=_['defaults'](config[_0x3dc0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3dc0('0xc'))[_0x3dc0('0xd')](socket);function respondWithRpcPromise(_0xb5ff98,_0xa2608d,_0x2967f6){return new BPromise(function(_0x1fb434,_0x3e0b99){return client['request'](_0xb5ff98,_0x2967f6)['then'](function(_0x14b474){logger[_0x3dc0('0xe')](_0x3dc0('0xf'),_0xa2608d,'request\x20sent');logger['debug'](_0x3dc0('0x10'),_0xa2608d,'request\x20sent',JSON[_0x3dc0('0x11')](_0x14b474));if(_0x14b474['error']){if(_0x14b474['error'][_0x3dc0('0x12')]===0x1f4){logger[_0x3dc0('0x13')](_0x3dc0('0xf'),_0xa2608d,_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);return _0x3e0b99(_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);}logger[_0x3dc0('0x13')]('MailMessage,\x20%s,\x20%s',_0xa2608d,_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);return _0x1fb434(_0x14b474['error'][_0x3dc0('0x14')]);}else{logger[_0x3dc0('0xe')](_0x3dc0('0xf'),_0xa2608d,'request\x20sent');_0x1fb434(_0x14b474[_0x3dc0('0x15')][_0x3dc0('0x14')]);}})[_0x3dc0('0x16')](function(_0x5a67af){logger[_0x3dc0('0x13')](_0x3dc0('0xf'),_0xa2608d,_0x5a67af);_0x3e0b99(_0x5a67af);});});}exports[_0x3dc0('0x17')]=function(_0xac9dc8){var _0x24bf8c=this;return new Promise(function(_0x3efe80,_0x379fff){return db[_0x3dc0('0x18')][_0x3dc0('0x19')](_0xac9dc8[_0x3dc0('0x1a')],{'raw':_0xac9dc8['options']?_0xac9dc8[_0x3dc0('0x1b')][_0x3dc0('0x1c')]===undefined?!![]:![]:!![]})[_0x3dc0('0x1d')](function(_0x5ee6b3){logger['info'](_0x3dc0('0x17'),_0xac9dc8);logger[_0x3dc0('0x1e')](_0x3dc0('0x17'),_0xac9dc8,JSON[_0x3dc0('0x11')](_0x5ee6b3));_0x3efe80(_0x5ee6b3);})['catch'](function(_0x252cda){logger['error']('CreateMailMessage',_0x252cda[_0x3dc0('0x14')],_0xac9dc8);_0x379fff(_0x24bf8c[_0x3dc0('0x13')](0x1f4,_0x252cda[_0x3dc0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 52450af..c11e762 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 _0x3685=['./mailMessage.events','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x2dfb85,_0x5ec859){var _0x21e6ee=function(_0x204c4c){while(--_0x204c4c){_0x2dfb85['push'](_0x2dfb85['shift']());}};_0x21e6ee(++_0x5ec859);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var MailMessageEvents=require(_0x5368('0x0'));var events=['save',_0x5368('0x1'),_0x5368('0x2')];function createListener(_0x1e4f48,_0x3ee78f){return function(_0x38e06c){_0x3ee78f[_0x5368('0x3')](_0x1e4f48,_0x38e06c);};}function removeListener(_0x271e21,_0x2c9c35){return function(){MailMessageEvents[_0x5368('0x4')](_0x271e21,_0x2c9c35);};}exports[_0x5368('0x5')]=function(_0x4fc6ed){for(var _0x1a4450=0x0,_0x2529a2=events[_0x5368('0x6')];_0x1a4450<_0x2529a2;_0x1a4450++){var _0xaf4549=events[_0x1a4450];var _0x55fb7d=createListener(_0x5368('0x7')+_0xaf4549,_0x4fc6ed);MailMessageEvents['on'](_0xaf4549,_0x55fb7d);}}; \ No newline at end of file +var _0xe186=['register','mailMessage:','./mailMessage.events','save','update','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe186,0x146));var _0x6e18=function(_0x28ec2d,_0x3d3237){_0x28ec2d=_0x28ec2d-0x0;var _0xf4ce61=_0xe186[_0x28ec2d];return _0xf4ce61;};'use strict';var MailMessageEvents=require(_0x6e18('0x0'));var events=[_0x6e18('0x1'),'remove',_0x6e18('0x2')];function createListener(_0xc09e8a,_0xf8a6e3){return function(_0xadd322){_0xf8a6e3[_0x6e18('0x3')](_0xc09e8a,_0xadd322);};}function removeListener(_0x4b7198,_0x1d3480){return function(){MailMessageEvents['removeListener'](_0x4b7198,_0x1d3480);};}exports[_0x6e18('0x4')]=function(_0x1bafb5){for(var _0x1b9e15=0x0,_0x5a2ae3=events['length'];_0x1b9e15<_0x5a2ae3;_0x1b9e15++){var _0x30a65b=events[_0x1b9e15];var _0x508982=createListener(_0x6e18('0x5')+_0x30a65b,_0x1bafb5);MailMessageEvents['on'](_0x30a65b,_0x508982);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 050461b..6346594 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 _0xc3ec=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','update','destroy','removeTeams','delete','removeAgents','exports'];(function(_0x258032,_0x3bfdac){var _0x44a841=function(_0xac7df8){while(--_0xac7df8){_0x258032['push'](_0x258032['shift']());}};_0x44a841(++_0x3bfdac);}(_0xc3ec,0xf0));var _0xcc3e=function(_0x3bb2f3,_0x1a55b8){_0x3bb2f3=_0x3bb2f3-0x0;var _0x402182=_0xc3ec[_0x3bb2f3];return _0x402182;};'use strict';var multer=require(_0xcc3e('0x0'));var util=require(_0xcc3e('0x1'));var path=require(_0xcc3e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcc3e('0x3')]();var auth=require(_0xcc3e('0x4'));var interaction=require(_0xcc3e('0x5'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xcc3e('0x6')](),controller['index']);router[_0xcc3e('0x7')](_0xcc3e('0x8'),auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x9')]);router['get'](_0xcc3e('0xa'),auth[_0xcc3e('0x6')](),controller['show']);router[_0xcc3e('0x7')](_0xcc3e('0xb'),auth[_0xcc3e('0x6')](),controller['getMembers']);router['get'](_0xcc3e('0xc'),auth[_0xcc3e('0x6')](),controller[_0xcc3e('0xd')]);router['get'](_0xcc3e('0xe'),auth['isAuthenticated'](),controller[_0xcc3e('0xf')]);router[_0xcc3e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcc3e('0x10')]('/:id/teams',auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x11')]);router[_0xcc3e('0x10')](_0xcc3e('0xe'),auth[_0xcc3e('0x6')](),controller['addAgents']);router['put'](_0xcc3e('0xa'),auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x12')]);router['delete'](_0xcc3e('0xa'),auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x13')]);router['delete']('/:id/teams',auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x14')]);router[_0xcc3e('0x15')](_0xcc3e('0xe'),auth[_0xcc3e('0x6')](),controller[_0xcc3e('0x16')]);module[_0xcc3e('0x17')]=router; \ No newline at end of file +var _0x8bc9=['./mailQueue.controller','get','isAuthenticated','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','util','path','express','Router','../../components/interaction/service'];(function(_0xee6e19,_0x3f9a7d){var _0x1f9ca3=function(_0x3f8899){while(--_0x3f8899){_0xee6e19['push'](_0xee6e19['shift']());}};_0x1f9ca3(++_0x3f9a7d);}(_0x8bc9,0x1de));var _0x98bc=function(_0x202951,_0x71eba4){_0x202951=_0x202951-0x0;var _0x1da075=_0x8bc9[_0x202951];return _0x1da075;};'use strict';var multer=require('multer');var util=require(_0x98bc('0x0'));var path=require(_0x98bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x98bc('0x2'));var router=express[_0x98bc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x98bc('0x4'));var config=require('../../config/environment');var controller=require(_0x98bc('0x5'));router[_0x98bc('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x98bc('0x6')]('/describe',auth[_0x98bc('0x7')](),controller['describe']);router[_0x98bc('0x6')](_0x98bc('0x8'),auth[_0x98bc('0x7')](),controller[_0x98bc('0x9')]);router[_0x98bc('0x6')](_0x98bc('0xa'),auth[_0x98bc('0x7')](),controller['getMembers']);router[_0x98bc('0x6')](_0x98bc('0xb'),auth[_0x98bc('0x7')](),controller['getTeams']);router[_0x98bc('0x6')](_0x98bc('0xc'),auth[_0x98bc('0x7')](),controller[_0x98bc('0xd')]);router[_0x98bc('0xe')]('/',auth['isAuthenticated'](),controller[_0x98bc('0xf')]);router[_0x98bc('0xe')]('/:id/teams',auth[_0x98bc('0x7')](),controller[_0x98bc('0x10')]);router[_0x98bc('0xe')](_0x98bc('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x98bc('0x11')](_0x98bc('0x8'),auth['isAuthenticated'](),controller[_0x98bc('0x12')]);router[_0x98bc('0x13')](_0x98bc('0x8'),auth[_0x98bc('0x7')](),controller[_0x98bc('0x14')]);router[_0x98bc('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x98bc('0x15')]);router[_0x98bc('0x13')](_0x98bc('0xc'),auth[_0x98bc('0x7')](),controller['removeAgents']);module[_0x98bc('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0b2ba55..da75fae 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 _0xdc45=['sequelize','exports','STRING','rrmemory','beepall','roundrobin'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xdc45,0x156));var _0x5dc4=function(_0xb51bce,_0x19ad95){_0xb51bce=_0xb51bce-0x0;var _0x35dc8f=_0xdc45[_0xb51bce];return _0x35dc8f;};'use strict';var Sequelize=require(_0x5dc4('0x0'));module[_0x5dc4('0x1')]={'name':{'type':Sequelize[_0x5dc4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5dc4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5dc4('0x3'),_0x5dc4('0x4'),_0x5dc4('0x5'))}}; \ No newline at end of file +var _0xb778=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0xbea3fb,_0x14e98b){var _0x5cd5d1=function(_0x426e4c){while(--_0x426e4c){_0xbea3fb['push'](_0xbea3fb['shift']());}};_0x5cd5d1(++_0x14e98b);}(_0xb778,0x1c8));var _0x8b77=function(_0x3ad737,_0x300131){_0x3ad737=_0x3ad737-0x0;var _0x16c1e2=_0xb778[_0x3ad737];return _0x16c1e2;};'use strict';var Sequelize=require(_0x8b77('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b77('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8b77('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b77('0x3')](_0x8b77('0x4'),_0x8b77('0x5'),_0x8b77('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 361c066..d823e47 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 _0x5550=['localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','get','MailQueues','error','name','index','map','MailQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','find','destroy','params','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','%s/%s','createdAt','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','value','ids','removeAgents','userMailQueue:remove','addAgents','omit','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis'];(function(_0x513547,_0x30467b){var _0x40905f=function(_0x11aecd){while(--_0x11aecd){_0x513547['push'](_0x513547['shift']());}};_0x40905f(++_0x30467b);}(_0x5550,0xf1));var _0x0555=function(_0x54d6b5,_0x3db690){_0x54d6b5=_0x54d6b5-0x0;var _0x579f74=_0x5550[_0x54d6b5];return _0x579f74;};'use strict';var pdf=require(_0x0555('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0555('0x1'));var zipdir=require(_0x0555('0x2'));var jsonpatch=require(_0x0555('0x3'));var rp=require(_0x0555('0x4'));var moment=require(_0x0555('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0555('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0555('0x7'));var csv=require('to-csv');var ejs=require(_0x0555('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0555('0x9'));var crypto=require(_0x0555('0xa'));var jsforce=require(_0x0555('0xb'));var deskjs=require(_0x0555('0xc'));var toCsv=require(_0x0555('0xd'));var querystring=require(_0x0555('0xe'));var Papa=require(_0x0555('0xf'));var Redis=require('ioredis');var authService=require(_0x0555('0x10'));var qs=require(_0x0555('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0555('0x12'));var logger=require(_0x0555('0x13'))(_0x0555('0x14'));var utils=require(_0x0555('0x15'));var config=require('../../config/environment');var db=require(_0x0555('0x16'))['db'];config['redis']=_[_0x0555('0x17')](config[_0x0555('0x18')],{'host':_0x0555('0x19'),'port':0x18eb});var socket=require(_0x0555('0x1a'))(new Redis(config[_0x0555('0x18')]));require(_0x0555('0x1b'))[_0x0555('0x1c')](socket);function respondWithStatusCode(_0x442efa,_0x51c03e){_0x51c03e=_0x51c03e||0xcc;return function(_0x2e3107){if(_0x2e3107){return _0x442efa[_0x0555('0x1d')](_0x51c03e);}return _0x442efa[_0x0555('0x1e')](_0x51c03e)[_0x0555('0x1f')]();};}function respondWithResult(_0xdee24b,_0x1eac29){_0x1eac29=_0x1eac29||0xc8;return function(_0x16d599){if(_0x16d599){return _0xdee24b[_0x0555('0x1e')](_0x1eac29)[_0x0555('0x20')](_0x16d599);}};}function respondWithFilteredResult(_0x57b8b6,_0x4cba3b){return function(_0x44e050){if(_0x44e050){var _0x58a8e9=_0x44e050[_0x0555('0x21')],_0x3d1d29=_0x4cba3b[_0x0555('0x22')],_0xba4546=_0x4cba3b[_0x0555('0x22')]+_0x4cba3b[_0x0555('0x23')],_0x131eaa;if(_0xba4546>=_0x58a8e9){_0xba4546=_0x58a8e9;_0x131eaa=0xc8;}else{_0x131eaa=0xce;}_0x57b8b6['status'](_0x131eaa);return _0x57b8b6[_0x0555('0x24')](_0x0555('0x25'),_0x3d1d29+'-'+_0xba4546+'/'+_0x58a8e9)['json'](_0x44e050);}return null;};}function patchUpdates(_0x57ba7e){return function(_0x18702d){try{jsonpatch['apply'](_0x18702d,_0x57ba7e,!![]);}catch(_0x53ea64){return BPromise[_0x0555('0x26')](_0x53ea64);}return _0x18702d[_0x0555('0x27')]();};}function saveUpdates(_0x27b53f,_0x28e46b){return function(_0x328578){if(_0x328578){return _0x328578['update'](_0x27b53f)[_0x0555('0x28')](function(_0x2006a1){return _0x2006a1;});}return null;};}function removeEntity(_0x4c9015,_0x2c7f48){return function(_0x4376f0){if(_0x4376f0){return _0x4376f0['destroy']()[_0x0555('0x28')](function(){var _0x97b68a=_0x4376f0[_0x0555('0x29')]({'plain':!![]});var _0x17530a=_0x0555('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x17530a,'resourceId':_0x97b68a['id']}})[_0x0555('0x28')](function(){return _0x4376f0;});})['then'](function(){_0x4c9015[_0x0555('0x1e')](0xcc)[_0x0555('0x1f')]();});}};}function handleEntityNotFound(_0x9f9ee7,_0x1648ce){return function(_0x3ea1f8){if(!_0x3ea1f8){_0x9f9ee7[_0x0555('0x1d')](0x194);}return _0x3ea1f8;};}function handleError(_0x3f7cc5,_0x4751d2){_0x4751d2=_0x4751d2||0x1f4;return function(_0x4bc102){logger[_0x0555('0x2b')](_0x4bc102['stack']);if(_0x4bc102[_0x0555('0x2c')]){delete _0x4bc102[_0x0555('0x2c')];}_0x3f7cc5[_0x0555('0x1e')](_0x4751d2)['send'](_0x4bc102);};}exports[_0x0555('0x2d')]=function(_0x5cee97,_0x53f9d4){var _0x979f7a={},_0x5eda15={},_0x10dd61={'count':0x0,'rows':[]};var _0x2e1e35=_[_0x0555('0x2e')](db[_0x0555('0x2f')][_0x0555('0x30')],function(_0x17ef6c){return{'name':_0x17ef6c[_0x0555('0x31')],'type':_0x17ef6c[_0x0555('0x32')]['key']};});_0x5eda15[_0x0555('0x33')]=_[_0x0555('0x2e')](_0x2e1e35,_0x0555('0x2c'));_0x5eda15['query']=_[_0x0555('0x34')](_0x5cee97['query']);_0x5eda15[_0x0555('0x35')]=_[_0x0555('0x36')](_0x5eda15[_0x0555('0x33')],_0x5eda15[_0x0555('0x37')]);_0x979f7a[_0x0555('0x38')]=_[_0x0555('0x36')](_0x5eda15[_0x0555('0x33')],qs[_0x0555('0x39')](_0x5cee97[_0x0555('0x37')][_0x0555('0x39')]));_0x979f7a[_0x0555('0x38')]=_0x979f7a[_0x0555('0x38')]['length']?_0x979f7a[_0x0555('0x38')]:_0x5eda15[_0x0555('0x33')];if(!_0x5cee97[_0x0555('0x37')]['hasOwnProperty']('nolimit')){_0x979f7a[_0x0555('0x23')]=qs[_0x0555('0x23')](_0x5cee97[_0x0555('0x37')][_0x0555('0x23')]);_0x979f7a[_0x0555('0x22')]=qs[_0x0555('0x22')](_0x5cee97[_0x0555('0x37')][_0x0555('0x22')]);}_0x979f7a[_0x0555('0x3a')]=qs[_0x0555('0x3b')](_0x5cee97[_0x0555('0x37')][_0x0555('0x3b')]);_0x979f7a[_0x0555('0x3c')]=qs[_0x0555('0x35')](_['pick'](_0x5cee97['query'],_0x5eda15['filters']),_0x2e1e35);if(_0x5cee97[_0x0555('0x37')][_0x0555('0x3d')]){_0x979f7a[_0x0555('0x3c')]=_[_0x0555('0x3e')](_0x979f7a['where'],{'$or':_['map'](_0x2e1e35,function(_0x508b5c){if(_0x508b5c[_0x0555('0x32')]!==_0x0555('0x3f')){var _0x4b2d29={};_0x4b2d29[_0x508b5c[_0x0555('0x2c')]]={'$like':'%'+_0x5cee97[_0x0555('0x37')][_0x0555('0x3d')]+'%'};return _0x4b2d29;}})});}_0x979f7a=_['merge']({},_0x979f7a,_0x5cee97[_0x0555('0x40')]);var _0x57afd0={'where':_0x979f7a['where']};return db[_0x0555('0x2f')][_0x0555('0x21')](_0x57afd0)[_0x0555('0x28')](function(_0x5cd9a6){_0x10dd61[_0x0555('0x21')]=_0x5cd9a6;if(_0x5cee97['query'][_0x0555('0x41')]){_0x979f7a[_0x0555('0x42')]=[{'all':!![]}];}return db[_0x0555('0x2f')][_0x0555('0x43')](_0x979f7a);})[_0x0555('0x28')](function(_0x5a9e4b){_0x10dd61[_0x0555('0x44')]=_0x5a9e4b;return _0x10dd61;})[_0x0555('0x28')](respondWithFilteredResult(_0x53f9d4,_0x979f7a))[_0x0555('0x45')](handleError(_0x53f9d4,null));};exports[_0x0555('0x46')]=function(_0x7921f3,_0x2d435e){var _0x22dca1={'raw':!![],'where':{'id':_0x7921f3['params']['id']}},_0x2ee159={};_0x2ee159['model']=_[_0x0555('0x34')](db[_0x0555('0x2f')][_0x0555('0x30')]);_0x2ee159['query']=_[_0x0555('0x34')](_0x7921f3['query']);_0x2ee159[_0x0555('0x35')]=_[_0x0555('0x36')](_0x2ee159[_0x0555('0x33')],_0x2ee159[_0x0555('0x37')]);_0x22dca1[_0x0555('0x38')]=_[_0x0555('0x36')](_0x2ee159['model'],qs[_0x0555('0x39')](_0x7921f3['query'][_0x0555('0x39')]));_0x22dca1[_0x0555('0x38')]=_0x22dca1[_0x0555('0x38')][_0x0555('0x47')]?_0x22dca1[_0x0555('0x38')]:_0x2ee159[_0x0555('0x33')];if(_0x7921f3[_0x0555('0x37')][_0x0555('0x41')]){_0x22dca1[_0x0555('0x42')]=[{'all':!![]}];}_0x22dca1=_[_0x0555('0x3e')]({},_0x22dca1,_0x7921f3[_0x0555('0x40')]);return db['MailQueue']['find'](_0x22dca1)[_0x0555('0x28')](handleEntityNotFound(_0x2d435e,null))[_0x0555('0x28')](respondWithResult(_0x2d435e,null))['catch'](handleError(_0x2d435e,null));};exports[_0x0555('0x48')]=function(_0x55c7ed,_0x548ecc){return db[_0x0555('0x2f')][_0x0555('0x48')](_0x55c7ed['body'],{})[_0x0555('0x28')](function(_0x3bcfd1){var _0x541b01=_0x55c7ed[_0x0555('0x49')][_0x0555('0x29')]({'plain':!![]});if(!_0x541b01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x541b01[_0x0555('0x4a')]===_0x0555('0x49')){var _0x49ab17=_0x3bcfd1[_0x0555('0x29')]({'plain':!![]});var _0x6fb357=_0x0555('0x2a');return db[_0x0555('0x4b')]['find']({'where':{'name':_0x6fb357,'userProfileId':_0x541b01[_0x0555('0x4c')]},'raw':!![]})[_0x0555('0x28')](function(_0x3de5ae){if(_0x3de5ae&&_0x3de5ae[_0x0555('0x4d')]===0x0){return db[_0x0555('0x4e')][_0x0555('0x48')]({'name':_0x49ab17[_0x0555('0x2c')],'resourceId':_0x49ab17['id'],'type':_0x3de5ae[_0x0555('0x2c')],'sectionId':_0x3de5ae['id']},{})['then'](function(){return _0x3bcfd1;});}else{return _0x3bcfd1;}})[_0x0555('0x45')](function(_0x22b7f8){logger[_0x0555('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22b7f8);throw _0x22b7f8;});}return _0x3bcfd1;})[_0x0555('0x28')](respondWithResult(_0x548ecc,0xc9))[_0x0555('0x45')](handleError(_0x548ecc,null));};exports[_0x0555('0x4f')]=function(_0x138903,_0x119075){if(_0x138903[_0x0555('0x50')]['id']){delete _0x138903['body']['id'];}return db[_0x0555('0x2f')][_0x0555('0x51')]({'where':{'id':_0x138903['params']['id']}})[_0x0555('0x28')](handleEntityNotFound(_0x119075,null))[_0x0555('0x28')](saveUpdates(_0x138903[_0x0555('0x50')],null))[_0x0555('0x28')](respondWithResult(_0x119075,null))[_0x0555('0x45')](handleError(_0x119075,null));};exports[_0x0555('0x52')]=function(_0x5d8b36,_0x114385){return db[_0x0555('0x2f')][_0x0555('0x51')]({'where':{'id':_0x5d8b36[_0x0555('0x53')]['id']}})['then'](handleEntityNotFound(_0x114385,null))[_0x0555('0x28')](removeEntity(_0x114385,null))[_0x0555('0x45')](handleError(_0x114385,null));};exports['describe']=function(_0x2f4693,_0x1fc829){return db[_0x0555('0x2f')][_0x0555('0x54')]()['then'](respondWithResult(_0x1fc829,null))[_0x0555('0x45')](handleError(_0x1fc829,null));};exports['getMembers']=function(_0xbd0f8a,_0x9379a9,_0x5e7758){var _0x2b8726={'raw':!![],'where':{}},_0x6a67fd={},_0x145127;return db[_0x0555('0x2f')][_0x0555('0x55')]({'where':{'id':_0xbd0f8a[_0x0555('0x53')]['id']}})[_0x0555('0x28')](handleEntityNotFound(_0x9379a9,null))[_0x0555('0x28')](function(_0x5deae3){if(_0x5deae3){_0x145127=_0x5deae3['get']({'plain':!![]});_0x6a67fd[_0x0555('0x33')]=_['keys'](db[_0x0555('0x56')][_0x0555('0x30')]);_0x6a67fd['query']=_[_0x0555('0x34')](_0xbd0f8a[_0x0555('0x37')]);_0x6a67fd[_0x0555('0x35')]=_[_0x0555('0x36')](_0x6a67fd['model'],_0x6a67fd[_0x0555('0x37')]);_0x2b8726['attributes']=_[_0x0555('0x36')](_0x6a67fd[_0x0555('0x33')],qs[_0x0555('0x39')](_0xbd0f8a[_0x0555('0x37')][_0x0555('0x39')]));_0x2b8726[_0x0555('0x38')]=_0x2b8726[_0x0555('0x38')][_0x0555('0x47')]?_0x2b8726[_0x0555('0x38')]:_0x6a67fd[_0x0555('0x33')];if(!_0xbd0f8a[_0x0555('0x37')][_0x0555('0x57')](_0x0555('0x58'))){_0x2b8726[_0x0555('0x23')]=qs['limit'](_0xbd0f8a[_0x0555('0x37')][_0x0555('0x23')]);_0x2b8726['offset']=qs[_0x0555('0x22')](_0xbd0f8a[_0x0555('0x37')][_0x0555('0x22')]);}_0x2b8726[_0x0555('0x3a')]=qs[_0x0555('0x3b')](_0xbd0f8a[_0x0555('0x37')][_0x0555('0x3b')]);_0x2b8726[_0x0555('0x3c')]=qs[_0x0555('0x35')](_[_0x0555('0x59')](_0xbd0f8a[_0x0555('0x37')],_0x6a67fd['filters']));_0x2b8726[_0x0555('0x3c')][_0x0555('0x5a')]=_0x5deae3['id'];if(_0xbd0f8a[_0x0555('0x37')][_0x0555('0x3d')]){_0x2b8726[_0x0555('0x3c')]=_[_0x0555('0x3e')](_0x2b8726[_0x0555('0x3c')],{'$or':_['map'](_0x2b8726[_0x0555('0x38')],function(_0x36000d){var _0x15231b={};_0x15231b[_0x36000d]={'$like':'%'+_0xbd0f8a[_0x0555('0x37')]['filter']+'%'};return _0x15231b;})});}_0x2b8726=_[_0x0555('0x3e')]({},_0x2b8726,_0xbd0f8a['options']);return db['UserMailQueue'][_0x0555('0x43')](_0x2b8726);}})[_0x0555('0x28')](function(_0x4e55dc){if(_0x4e55dc){return db[_0x0555('0x5b')][_0x0555('0x5c')]({'where':{'id':_[_0x0555('0x2e')](_0x4e55dc,_0x0555('0x5d')),'role':'agent'},'attributes':['id',_0x0555('0x2c'),_0x0555('0x5e'),_0x0555('0x5f'),'createdAt']});}})['then'](function(_0x508e7c){if(_0x508e7c){return{'count':_0x508e7c[_0x0555('0x21')],'rows':_['map'](_0x508e7c[_0x0555('0x44')],function(_0x1ea037){return{'membername':_0x1ea037[_0x0555('0x2c')],'UserId':_0x1ea037['id'],'queue_name':_0x145127[_0x0555('0x2c')],'MailQueueId':_0x145127['id'],'interface':util['format'](_0x0555('0x60'),'SIP',_0x1ea037['name']),'penalty':0x0,'paused':_0x1ea037[_0x0555('0x5e')],'createdAt':_0x1ea037[_0x0555('0x61')],'updatedAt':_0x1ea037[_0x0555('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0555('0x28')](respondWithFilteredResult(_0x9379a9,_0x2b8726))[_0x0555('0x45')](handleError(_0x9379a9,null));};exports[_0x0555('0x62')]=function(_0x2d17ae,_0x5e51dd,_0x566e80){var _0x2d478c={};var _0x16fb56={};var _0x282863;var _0x4775ca;return db['MailQueue'][_0x0555('0x55')]({'where':{'id':_0x2d17ae[_0x0555('0x53')]['id']}})['then'](handleEntityNotFound(_0x5e51dd,null))[_0x0555('0x28')](function(_0x1617f9){if(_0x1617f9){_0x282863=_0x1617f9;_0x16fb56[_0x0555('0x33')]=_[_0x0555('0x34')](db[_0x0555('0x63')][_0x0555('0x30')]);_0x16fb56[_0x0555('0x37')]=_[_0x0555('0x34')](_0x2d17ae[_0x0555('0x37')]);_0x16fb56[_0x0555('0x35')]=_[_0x0555('0x36')](_0x16fb56['model'],_0x16fb56[_0x0555('0x37')]);_0x2d478c[_0x0555('0x38')]=_[_0x0555('0x36')](_0x16fb56[_0x0555('0x33')],qs[_0x0555('0x39')](_0x2d17ae[_0x0555('0x37')]['fields']));_0x2d478c['attributes']=_0x2d478c[_0x0555('0x38')][_0x0555('0x47')]?_0x2d478c['attributes']:_0x16fb56[_0x0555('0x33')];_0x2d478c['order']=qs[_0x0555('0x3b')](_0x2d17ae[_0x0555('0x37')][_0x0555('0x3b')]);_0x2d478c[_0x0555('0x3c')]=qs['filters'](_[_0x0555('0x59')](_0x2d17ae['query'],_0x16fb56[_0x0555('0x35')]));if(_0x2d17ae[_0x0555('0x37')][_0x0555('0x3d')]){_0x2d478c[_0x0555('0x3c')]=_[_0x0555('0x3e')](_0x2d478c[_0x0555('0x3c')],{'$or':_[_0x0555('0x2e')](_0x2d478c[_0x0555('0x38')],function(_0x46bbe1){var _0x59bea7={};_0x59bea7[_0x46bbe1]={'$like':'%'+_0x2d17ae[_0x0555('0x37')][_0x0555('0x3d')]+'%'};return _0x59bea7;})});}_0x2d478c=_['merge']({},_0x2d478c,_0x2d17ae['options']);return _0x282863['getTeams'](_0x2d478c);}})['then'](function(_0x2ab8c3){if(_0x2ab8c3){_0x4775ca=_0x2ab8c3[_0x0555('0x47')];if(!_0x2d17ae[_0x0555('0x37')][_0x0555('0x57')](_0x0555('0x58'))){_0x2d478c[_0x0555('0x23')]=qs['limit'](_0x2d17ae['query'][_0x0555('0x23')]);_0x2d478c[_0x0555('0x22')]=qs[_0x0555('0x22')](_0x2d17ae['query'][_0x0555('0x22')]);}return _0x282863[_0x0555('0x62')](_0x2d478c);}})[_0x0555('0x28')](function(_0x1626f6){if(_0x1626f6){return _0x1626f6?{'count':_0x4775ca,'rows':_0x1626f6}:null;}})[_0x0555('0x28')](respondWithResult(_0x5e51dd,null))[_0x0555('0x45')](handleError(_0x5e51dd,null));};exports[_0x0555('0x64')]=function(_0x50a632,_0xfd0524,_0x363d9f){var _0x45893b=_0x50a632['body']['ids'];return db[_0x0555('0x63')]['findAll']({'where':{'id':_0x45893b},'attributes':['id'],'include':[{'model':db[_0x0555('0x5b')],'as':_0x0555('0x65'),'attributes':['id',_0x0555('0x2c'),_0x0555('0x66'),'voicePause','interface'],'raw':!![]}]})[_0x0555('0x28')](function(_0x16db98){if(_0x16db98){var _0x3456ee=_[_0x0555('0x67')](_0x16db98,function(_0x596e49){var _0x557338=_0x596e49[_0x0555('0x29')]({'plain':!![]});return _0x557338['Agents'];});return db[_0x0555('0x2f')][_0x0555('0x51')]({'where':{'id':_0x50a632[_0x0555('0x53')]['id']}})[_0x0555('0x28')](function(_0x585b11){return db[_0x0555('0x68')][_0x0555('0x69')](function(_0x49e7db){return _0x585b11['addTeams'](_0x45893b,{'transaction':_0x49e7db})['then'](function(){return BPromise[_0x0555('0x6a')](_0x3456ee,function(_0x11044a){return db['UserMailQueue'][_0x0555('0x6b')]({'where':{'UserId':_0x11044a['id'],'MailQueueId':_0x50a632['params']['id']},'transaction':_0x49e7db});});})[_0x0555('0x28')](function(){_0x3456ee[_0x0555('0x6c')](function(_0x17cd49){socket[_0x0555('0x6d')](_0x0555('0x6e'),{'UserId':_0x17cd49['id'],'MailQueueId':_0x585b11['id']});});});});});}})['then'](respondWithStatusCode(_0xfd0524,null))[_0x0555('0x45')](handleError(_0xfd0524,null));};exports[_0x0555('0x6f')]=function(_0x3b4e1b,_0x56c894,_0x342914){return db[_0x0555('0x63')]['findAll']({'where':{'id':_0x3b4e1b[_0x0555('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x56c894,null))[_0x0555('0x28')](function(_0x945719){var _0x5c726c=_[_0x0555('0x2e')](_0x945719,'id');var _0x383453=[];var _0xb71c62=[];var _0x42c933=squel[_0x0555('0x70')]();_0x42c933[_0x0555('0x71')](_0x0555('0x72'))['from'](_0x0555('0x73'),'tq')[_0x0555('0x74')](_0x0555('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0555('0x3c')]('MailQueueId\x20=\x20?',_0x3b4e1b[_0x0555('0x53')]['id']);for(var _0x15a3f8=0x0;_0x15a3f8<_0x945719[_0x0555('0x47')];_0x15a3f8+=0x1){let _0x4bad02=_0x945719[_0x15a3f8];for(var _0x54a844=0x0;_0x54a844<_0x4bad02[_0x0555('0x65')][_0x0555('0x47')];_0x54a844+=0x1){let _0x24402b=_0x4bad02['Agents'][_0x54a844];var _0x13aec2=_0x42c933[_0x0555('0x76')]();_0x13aec2[_0x0555('0x3c')](_0x0555('0x77'),_0x24402b['id']);_0xb71c62['push'](db['sequelize'][_0x0555('0x37')](_0x13aec2[_0x0555('0x78')](),{'type':db[_0x0555('0x68')][_0x0555('0x79')]['SELECT']})['then'](function(_0x5c77d6){if(_0x5c77d6[_0x0555('0x47')]===0x1){return _0x24402b['id'];}else{var _0x5829f9=_[_0x0555('0x7a')](_[_0x0555('0x2e')](_0x5c77d6,_0x0555('0x7b')),function(_0x31da33){return _[_0x0555('0x7c')](_0x5c726c,_0x31da33);});if(_0x5829f9){return _0x24402b['id'];}}}));}}return BPromise['all'](_0xb71c62)[_0x0555('0x28')](function(_0x5c218d){_0x383453=_(_0x383453)[_0x0555('0x7d')](_0x5c218d)['compact']()[_0x0555('0x7e')]();return db['MailQueue'][_0x0555('0x51')]({'where':{'id':_0x3b4e1b[_0x0555('0x53')]['id']}})[_0x0555('0x28')](function(_0x3e80ee){return db[_0x0555('0x68')][_0x0555('0x69')](function(_0x352d7d){return _0x3e80ee[_0x0555('0x6f')](_0x3b4e1b[_0x0555('0x37')][_0x0555('0x7f')],{'transaction':_0x352d7d})[_0x0555('0x28')](function(){if(!_['isEmpty'](_0x383453)){return _0x3e80ee[_0x0555('0x80')](_0x383453,{'transaction':_0x352d7d});}})[_0x0555('0x28')](function(){_0x383453[_0x0555('0x6c')](function(_0x137407){socket[_0x0555('0x6d')](_0x0555('0x81'),{'UserId':_0x137407,'MailQueueId':_0x3e80ee['id']});});});});});});})[_0x0555('0x28')](respondWithStatusCode(_0x56c894,null))[_0x0555('0x45')](handleError(_0x56c894,null));};exports['addAgents']=function(_0x3bcc6e,_0x28f318,_0x3fce28){return db[_0x0555('0x2f')][_0x0555('0x51')]({'where':{'id':_0x3bcc6e[_0x0555('0x53')]['id']}})[_0x0555('0x28')](handleEntityNotFound(_0x28f318,null))['then'](function(_0xad6720){if(_0xad6720){return _0xad6720[_0x0555('0x82')](_0x3bcc6e[_0x0555('0x50')][_0x0555('0x7f')],_[_0x0555('0x83')](_0x3bcc6e[_0x0555('0x50')],[_0x0555('0x7f'),'id'])||{})['spread'](function(_0x481da1){for(var _0x20d4b1=0x0;_0x20d4b1<_0x3bcc6e[_0x0555('0x50')][_0x0555('0x7f')]['length'];_0x20d4b1+=0x1){socket[_0x0555('0x6d')](_0x0555('0x6e'),{'UserId':_0x3bcc6e['body'][_0x0555('0x7f')][_0x20d4b1],'MailQueueId':_0x3bcc6e['params']['id']});}return _0x481da1;});}})[_0x0555('0x28')](respondWithResult(_0x28f318,null))['catch'](handleError(_0x28f318,null));};exports[_0x0555('0x80')]=function(_0x3cf6c4,_0x19fbe8,_0xba9bc0){return db[_0x0555('0x2f')][_0x0555('0x51')]({'where':{'id':_0x3cf6c4[_0x0555('0x53')]['id']}})[_0x0555('0x28')](handleEntityNotFound(_0x19fbe8,null))['then'](function(_0x38b61e){if(_0x38b61e){return _0x38b61e[_0x0555('0x80')](_0x3cf6c4[_0x0555('0x37')][_0x0555('0x7f')])[_0x0555('0x28')](function(){if(_['isArray'](_0x3cf6c4[_0x0555('0x37')][_0x0555('0x7f')])){for(var _0x1dc8a1=0x0;_0x1dc8a1<_0x3cf6c4['query'][_0x0555('0x7f')]['length'];_0x1dc8a1+=0x1){socket['emit'](_0x0555('0x81'),{'UserId':Number(_0x3cf6c4[_0x0555('0x37')][_0x0555('0x7f')][_0x1dc8a1]),'MailQueueId':Number(_0x3cf6c4[_0x0555('0x53')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3cf6c4[_0x0555('0x37')][_0x0555('0x7f')]),'MailQueueId':Number(_0x3cf6c4[_0x0555('0x53')]['id'])});}});}})[_0x0555('0x28')](respondWithStatusCode(_0x19fbe8,null))['catch'](handleError(_0x19fbe8,null));};exports[_0x0555('0x84')]=function(_0xe710e6,_0x2a2066,_0x12d8d8){var _0x1a6e5c={};var _0x5d40d8={};var _0x13615f;var _0x4a8071;return db[_0x0555('0x2f')]['findOne']({'where':{'id':_0xe710e6[_0x0555('0x53')]['id']}})[_0x0555('0x28')](handleEntityNotFound(_0x2a2066,null))[_0x0555('0x28')](function(_0x19aa6f){if(_0x19aa6f){_0x13615f=_0x19aa6f;_0x5d40d8[_0x0555('0x33')]=_['keys'](db[_0x0555('0x5b')]['rawAttributes']);_0x5d40d8[_0x0555('0x37')]=_[_0x0555('0x34')](_0xe710e6[_0x0555('0x37')]);_0x5d40d8['filters']=_['intersection'](_0x5d40d8[_0x0555('0x33')],_0x5d40d8[_0x0555('0x37')]);_0x1a6e5c['attributes']=_[_0x0555('0x36')](_0x5d40d8[_0x0555('0x33')],qs['fields'](_0xe710e6['query']['fields']));_0x1a6e5c[_0x0555('0x38')]=_0x1a6e5c[_0x0555('0x38')][_0x0555('0x47')]?_0x1a6e5c[_0x0555('0x38')]:_0x5d40d8[_0x0555('0x33')];_0x1a6e5c[_0x0555('0x3a')]=qs[_0x0555('0x3b')](_0xe710e6[_0x0555('0x37')][_0x0555('0x3b')]);_0x1a6e5c[_0x0555('0x3c')]=qs[_0x0555('0x35')](_[_0x0555('0x59')](_0xe710e6[_0x0555('0x37')],_0x5d40d8['filters']));if(_0xe710e6[_0x0555('0x37')]['filter']){_0x1a6e5c[_0x0555('0x3c')]=_[_0x0555('0x3e')](_0x1a6e5c[_0x0555('0x3c')],{'$or':_[_0x0555('0x2e')](_0x1a6e5c[_0x0555('0x38')],function(_0xafb35f){var _0x490e0f={};_0x490e0f[_0xafb35f]={'$like':'%'+_0xe710e6[_0x0555('0x37')][_0x0555('0x3d')]+'%'};return _0x490e0f;})});}_0x1a6e5c=_[_0x0555('0x3e')]({},_0x1a6e5c,_0xe710e6[_0x0555('0x40')]);return _0x13615f['getAgents'](_0x1a6e5c);}})[_0x0555('0x28')](function(_0x50385c){if(_0x50385c){_0x4a8071=_0x50385c[_0x0555('0x47')];if(!_0xe710e6[_0x0555('0x37')][_0x0555('0x57')](_0x0555('0x58'))){_0x1a6e5c[_0x0555('0x23')]=qs['limit'](_0xe710e6['query'][_0x0555('0x23')]);_0x1a6e5c[_0x0555('0x22')]=qs[_0x0555('0x22')](_0xe710e6[_0x0555('0x37')]['offset']);}return _0x13615f[_0x0555('0x84')](_0x1a6e5c);}})['then'](function(_0x15ea6a){if(_0x15ea6a){return _0x15ea6a?{'count':_0x4a8071,'rows':_0x15ea6a}:null;}})[_0x0555('0x28')](respondWithResult(_0x2a2066,null))[_0x0555('0x45')](handleError(_0x2a2066,null));}; \ No newline at end of file +var _0x02ed=['hasOwnProperty','nolimit','order','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','findOne','Team','getTeams','voicePause','interface','flatMap','each','emit','userMailQueue:save','removeTeams','ids','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','includes','all','union','compact','transaction','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','sort','where','pick','filters','merge','VIRTUAL','filter','options','MailQueue','include','findAll','rows','catch','show','length','find','create','body','user','role','MailQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers'];(function(_0x258bc6,_0x193ee1){var _0x3b9ba6=function(_0x4707d5){while(--_0x4707d5){_0x258bc6['push'](_0x258bc6['shift']());}};_0x3b9ba6(++_0x193ee1);}(_0x02ed,0x1c7));var _0xd02e=function(_0x4e8db9,_0x15ff81){_0x4e8db9=_0x4e8db9-0x0;var _0x1fc3be=_0x02ed[_0x4e8db9];return _0x1fc3be;};'use strict';var pdf=require(_0xd02e('0x0'));var emlformat=require(_0xd02e('0x1'));var rimraf=require(_0xd02e('0x2'));var zipdir=require(_0xd02e('0x3'));var jsonpatch=require(_0xd02e('0x4'));var rp=require(_0xd02e('0x5'));var moment=require(_0xd02e('0x6'));var BPromise=require(_0xd02e('0x7'));var Mustache=require(_0xd02e('0x8'));var util=require(_0xd02e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xd02e('0xa'));var ejs=require(_0xd02e('0xb'));var fs=require('fs');var _=require(_0xd02e('0xc'));var squel=require(_0xd02e('0xd'));var crypto=require(_0xd02e('0xe'));var jsforce=require(_0xd02e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd02e('0xa'));var querystring=require(_0xd02e('0x10'));var Papa=require(_0xd02e('0x11'));var Redis=require(_0xd02e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd02e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd02e('0x14'))(_0xd02e('0x15'));var utils=require(_0xd02e('0x16'));var config=require(_0xd02e('0x17'));var db=require('../../mysqldb')['db'];config[_0xd02e('0x18')]=_[_0xd02e('0x19')](config[_0xd02e('0x18')],{'host':_0xd02e('0x1a'),'port':0x18eb});var socket=require(_0xd02e('0x1b'))(new Redis(config[_0xd02e('0x18')]));require(_0xd02e('0x1c'))[_0xd02e('0x1d')](socket);function respondWithStatusCode(_0x1be7c4,_0x86c693){_0x86c693=_0x86c693||0xcc;return function(_0xc2b24f){if(_0xc2b24f){return _0x1be7c4[_0xd02e('0x1e')](_0x86c693);}return _0x1be7c4['status'](_0x86c693)[_0xd02e('0x1f')]();};}function respondWithResult(_0xb017d4,_0x353ee1){_0x353ee1=_0x353ee1||0xc8;return function(_0x47abf5){if(_0x47abf5){return _0xb017d4[_0xd02e('0x20')](_0x353ee1)[_0xd02e('0x21')](_0x47abf5);}};}function respondWithFilteredResult(_0x59e30e,_0x4595d6){return function(_0x55bffb){if(_0x55bffb){var _0x2dc139=_0x55bffb[_0xd02e('0x22')],_0x40467d=_0x4595d6[_0xd02e('0x23')],_0x130692=_0x4595d6[_0xd02e('0x23')]+_0x4595d6[_0xd02e('0x24')],_0x3e49bd;if(_0x130692>=_0x2dc139){_0x130692=_0x2dc139;_0x3e49bd=0xc8;}else{_0x3e49bd=0xce;}_0x59e30e[_0xd02e('0x20')](_0x3e49bd);return _0x59e30e[_0xd02e('0x25')]('Content-Range',_0x40467d+'-'+_0x130692+'/'+_0x2dc139)['json'](_0x55bffb);}return null;};}function patchUpdates(_0x2c9986){return function(_0xfa4f79){try{jsonpatch['apply'](_0xfa4f79,_0x2c9986,!![]);}catch(_0x420722){return BPromise[_0xd02e('0x26')](_0x420722);}return _0xfa4f79[_0xd02e('0x27')]();};}function saveUpdates(_0x5ebe31,_0x242aa5){return function(_0x54902){if(_0x54902){return _0x54902[_0xd02e('0x28')](_0x5ebe31)[_0xd02e('0x29')](function(_0x237b53){return _0x237b53;});}return null;};}function removeEntity(_0x4e29f3,_0x21674e){return function(_0x2848e7){if(_0x2848e7){return _0x2848e7[_0xd02e('0x2a')]()[_0xd02e('0x29')](function(){var _0x24c553=_0x2848e7[_0xd02e('0x2b')]({'plain':!![]});var _0x29d419='MailQueues';return db[_0xd02e('0x2c')][_0xd02e('0x2a')]({'where':{'type':_0x29d419,'resourceId':_0x24c553['id']}})['then'](function(){return _0x2848e7;});})[_0xd02e('0x29')](function(){_0x4e29f3[_0xd02e('0x20')](0xcc)[_0xd02e('0x1f')]();});}};}function handleEntityNotFound(_0x15e643,_0x3963a9){return function(_0xc687d){if(!_0xc687d){_0x15e643[_0xd02e('0x1e')](0x194);}return _0xc687d;};}function handleError(_0x4275f9,_0x5c04e0){_0x5c04e0=_0x5c04e0||0x1f4;return function(_0x9d5d90){logger[_0xd02e('0x2d')](_0x9d5d90['stack']);if(_0x9d5d90['name']){delete _0x9d5d90[_0xd02e('0x2e')];}_0x4275f9[_0xd02e('0x20')](_0x5c04e0)[_0xd02e('0x2f')](_0x9d5d90);};}exports[_0xd02e('0x30')]=function(_0x3e8ab1,_0x6c2083){var _0x454681={},_0x1518df={},_0x4aa5d6={'count':0x0,'rows':[]};var _0x439a4c=_[_0xd02e('0x31')](db['MailQueue'][_0xd02e('0x32')],function(_0x264336){return{'name':_0x264336['fieldName'],'type':_0x264336[_0xd02e('0x33')][_0xd02e('0x34')]};});_0x1518df[_0xd02e('0x35')]=_[_0xd02e('0x31')](_0x439a4c,_0xd02e('0x2e'));_0x1518df['query']=_[_0xd02e('0x36')](_0x3e8ab1[_0xd02e('0x37')]);_0x1518df['filters']=_[_0xd02e('0x38')](_0x1518df[_0xd02e('0x35')],_0x1518df[_0xd02e('0x37')]);_0x454681[_0xd02e('0x39')]=_[_0xd02e('0x38')](_0x1518df['model'],qs[_0xd02e('0x3a')](_0x3e8ab1[_0xd02e('0x37')][_0xd02e('0x3a')]));_0x454681['attributes']=_0x454681[_0xd02e('0x39')]['length']?_0x454681['attributes']:_0x1518df['model'];if(!_0x3e8ab1[_0xd02e('0x37')]['hasOwnProperty']('nolimit')){_0x454681[_0xd02e('0x24')]=qs['limit'](_0x3e8ab1[_0xd02e('0x37')][_0xd02e('0x24')]);_0x454681['offset']=qs[_0xd02e('0x23')](_0x3e8ab1[_0xd02e('0x37')][_0xd02e('0x23')]);}_0x454681['order']=qs[_0xd02e('0x3b')](_0x3e8ab1[_0xd02e('0x37')][_0xd02e('0x3b')]);_0x454681[_0xd02e('0x3c')]=qs['filters'](_[_0xd02e('0x3d')](_0x3e8ab1[_0xd02e('0x37')],_0x1518df[_0xd02e('0x3e')]),_0x439a4c);if(_0x3e8ab1[_0xd02e('0x37')]['filter']){_0x454681['where']=_[_0xd02e('0x3f')](_0x454681[_0xd02e('0x3c')],{'$or':_[_0xd02e('0x31')](_0x439a4c,function(_0x23e345){if(_0x23e345['type']!==_0xd02e('0x40')){var _0x361da4={};_0x361da4[_0x23e345[_0xd02e('0x2e')]]={'$like':'%'+_0x3e8ab1[_0xd02e('0x37')][_0xd02e('0x41')]+'%'};return _0x361da4;}})});}_0x454681=_['merge']({},_0x454681,_0x3e8ab1[_0xd02e('0x42')]);var _0x1dcabb={'where':_0x454681[_0xd02e('0x3c')]};return db[_0xd02e('0x43')][_0xd02e('0x22')](_0x1dcabb)[_0xd02e('0x29')](function(_0x429545){_0x4aa5d6['count']=_0x429545;if(_0x3e8ab1[_0xd02e('0x37')]['includeAll']){_0x454681[_0xd02e('0x44')]=[{'all':!![]}];}return db[_0xd02e('0x43')][_0xd02e('0x45')](_0x454681);})[_0xd02e('0x29')](function(_0x474a80){_0x4aa5d6[_0xd02e('0x46')]=_0x474a80;return _0x4aa5d6;})[_0xd02e('0x29')](respondWithFilteredResult(_0x6c2083,_0x454681))[_0xd02e('0x47')](handleError(_0x6c2083,null));};exports[_0xd02e('0x48')]=function(_0x3489d0,_0x4b562a){var _0x1cb196={'raw':!![],'where':{'id':_0x3489d0['params']['id']}},_0x168145={};_0x168145[_0xd02e('0x35')]=_[_0xd02e('0x36')](db['MailQueue']['rawAttributes']);_0x168145[_0xd02e('0x37')]=_[_0xd02e('0x36')](_0x3489d0[_0xd02e('0x37')]);_0x168145[_0xd02e('0x3e')]=_[_0xd02e('0x38')](_0x168145[_0xd02e('0x35')],_0x168145[_0xd02e('0x37')]);_0x1cb196[_0xd02e('0x39')]=_['intersection'](_0x168145[_0xd02e('0x35')],qs[_0xd02e('0x3a')](_0x3489d0[_0xd02e('0x37')][_0xd02e('0x3a')]));_0x1cb196[_0xd02e('0x39')]=_0x1cb196[_0xd02e('0x39')][_0xd02e('0x49')]?_0x1cb196[_0xd02e('0x39')]:_0x168145[_0xd02e('0x35')];if(_0x3489d0['query']['includeAll']){_0x1cb196[_0xd02e('0x44')]=[{'all':!![]}];}_0x1cb196=_['merge']({},_0x1cb196,_0x3489d0[_0xd02e('0x42')]);return db['MailQueue'][_0xd02e('0x4a')](_0x1cb196)['then'](handleEntityNotFound(_0x4b562a,null))['then'](respondWithResult(_0x4b562a,null))[_0xd02e('0x47')](handleError(_0x4b562a,null));};exports[_0xd02e('0x4b')]=function(_0x39628e,_0x2bd626){return db[_0xd02e('0x43')][_0xd02e('0x4b')](_0x39628e[_0xd02e('0x4c')],{})[_0xd02e('0x29')](function(_0x2d9925){var _0x44fbb8=_0x39628e[_0xd02e('0x4d')][_0xd02e('0x2b')]({'plain':!![]});if(!_0x44fbb8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44fbb8[_0xd02e('0x4e')]===_0xd02e('0x4d')){var _0x3b5777=_0x2d9925[_0xd02e('0x2b')]({'plain':!![]});var _0x15406b=_0xd02e('0x4f');return db[_0xd02e('0x50')][_0xd02e('0x4a')]({'where':{'name':_0x15406b,'userProfileId':_0x44fbb8['userProfileId']},'raw':!![]})['then'](function(_0x29a798){if(_0x29a798&&_0x29a798['autoAssociation']===0x0){return db[_0xd02e('0x2c')][_0xd02e('0x4b')]({'name':_0x3b5777[_0xd02e('0x2e')],'resourceId':_0x3b5777['id'],'type':_0x29a798[_0xd02e('0x2e')],'sectionId':_0x29a798['id']},{})[_0xd02e('0x29')](function(){return _0x2d9925;});}else{return _0x2d9925;}})['catch'](function(_0x1a268f){logger['error'](_0xd02e('0x51'),_0x1a268f);throw _0x1a268f;});}return _0x2d9925;})[_0xd02e('0x29')](respondWithResult(_0x2bd626,0xc9))['catch'](handleError(_0x2bd626,null));};exports[_0xd02e('0x28')]=function(_0x469c84,_0x40da74){if(_0x469c84[_0xd02e('0x4c')]['id']){delete _0x469c84['body']['id'];}return db['MailQueue'][_0xd02e('0x4a')]({'where':{'id':_0x469c84[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x40da74,null))[_0xd02e('0x29')](saveUpdates(_0x469c84['body'],null))['then'](respondWithResult(_0x40da74,null))[_0xd02e('0x47')](handleError(_0x40da74,null));};exports[_0xd02e('0x2a')]=function(_0x32ec29,_0x4d3379){return db[_0xd02e('0x43')]['find']({'where':{'id':_0x32ec29[_0xd02e('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d3379,null))[_0xd02e('0x29')](removeEntity(_0x4d3379,null))[_0xd02e('0x47')](handleError(_0x4d3379,null));};exports[_0xd02e('0x53')]=function(_0x59c3c1,_0xc0e5ce){return db[_0xd02e('0x43')]['describe']()[_0xd02e('0x29')](respondWithResult(_0xc0e5ce,null))[_0xd02e('0x47')](handleError(_0xc0e5ce,null));};exports[_0xd02e('0x54')]=function(_0x28aa5c,_0x31652b,_0x1a2424){var _0x19554b={'raw':!![],'where':{}},_0x24c18f={},_0x2acf74;return db[_0xd02e('0x43')]['findOne']({'where':{'id':_0x28aa5c['params']['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x31652b,null))[_0xd02e('0x29')](function(_0x2ff0aa){if(_0x2ff0aa){_0x2acf74=_0x2ff0aa[_0xd02e('0x2b')]({'plain':!![]});_0x24c18f[_0xd02e('0x35')]=_[_0xd02e('0x36')](db['UserMailQueue']['rawAttributes']);_0x24c18f[_0xd02e('0x37')]=_[_0xd02e('0x36')](_0x28aa5c['query']);_0x24c18f[_0xd02e('0x3e')]=_['intersection'](_0x24c18f[_0xd02e('0x35')],_0x24c18f[_0xd02e('0x37')]);_0x19554b[_0xd02e('0x39')]=_[_0xd02e('0x38')](_0x24c18f[_0xd02e('0x35')],qs[_0xd02e('0x3a')](_0x28aa5c['query']['fields']));_0x19554b[_0xd02e('0x39')]=_0x19554b['attributes'][_0xd02e('0x49')]?_0x19554b['attributes']:_0x24c18f[_0xd02e('0x35')];if(!_0x28aa5c[_0xd02e('0x37')][_0xd02e('0x55')](_0xd02e('0x56'))){_0x19554b[_0xd02e('0x24')]=qs['limit'](_0x28aa5c['query']['limit']);_0x19554b['offset']=qs[_0xd02e('0x23')](_0x28aa5c[_0xd02e('0x37')][_0xd02e('0x23')]);}_0x19554b[_0xd02e('0x57')]=qs[_0xd02e('0x3b')](_0x28aa5c[_0xd02e('0x37')][_0xd02e('0x3b')]);_0x19554b['where']=qs[_0xd02e('0x3e')](_['pick'](_0x28aa5c['query'],_0x24c18f['filters']));_0x19554b[_0xd02e('0x3c')]['MailQueueId']=_0x2ff0aa['id'];if(_0x28aa5c[_0xd02e('0x37')][_0xd02e('0x41')]){_0x19554b['where']=_[_0xd02e('0x3f')](_0x19554b['where'],{'$or':_[_0xd02e('0x31')](_0x19554b['attributes'],function(_0x4aecf6){var _0x9495d1={};_0x9495d1[_0x4aecf6]={'$like':'%'+_0x28aa5c[_0xd02e('0x37')][_0xd02e('0x41')]+'%'};return _0x9495d1;})});}_0x19554b=_['merge']({},_0x19554b,_0x28aa5c[_0xd02e('0x42')]);return db[_0xd02e('0x58')][_0xd02e('0x45')](_0x19554b);}})[_0xd02e('0x29')](function(_0x514430){if(_0x514430){return db[_0xd02e('0x59')][_0xd02e('0x5a')]({'where':{'id':_[_0xd02e('0x31')](_0x514430,_0xd02e('0x5b')),'role':_0xd02e('0x5c')},'attributes':['id','name',_0xd02e('0x5d'),_0xd02e('0x5e'),_0xd02e('0x5f')]});}})[_0xd02e('0x29')](function(_0x4ad7cf){if(_0x4ad7cf){return{'count':_0x4ad7cf[_0xd02e('0x22')],'rows':_[_0xd02e('0x31')](_0x4ad7cf[_0xd02e('0x46')],function(_0x43576a){return{'membername':_0x43576a[_0xd02e('0x2e')],'UserId':_0x43576a['id'],'queue_name':_0x2acf74[_0xd02e('0x2e')],'MailQueueId':_0x2acf74['id'],'interface':util[_0xd02e('0x60')]('%s/%s','SIP',_0x43576a[_0xd02e('0x2e')]),'penalty':0x0,'paused':_0x43576a[_0xd02e('0x5d')],'createdAt':_0x43576a['createdAt'],'updatedAt':_0x43576a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd02e('0x29')](respondWithFilteredResult(_0x31652b,_0x19554b))[_0xd02e('0x47')](handleError(_0x31652b,null));};exports['getTeams']=function(_0x3e06de,_0x3418f0,_0xebcf33){var _0x267bb5={};var _0x2778f8={};var _0x11bbb9;var _0x57c57f;return db[_0xd02e('0x43')][_0xd02e('0x61')]({'where':{'id':_0x3e06de[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x3418f0,null))[_0xd02e('0x29')](function(_0x20f954){if(_0x20f954){_0x11bbb9=_0x20f954;_0x2778f8[_0xd02e('0x35')]=_['keys'](db[_0xd02e('0x62')][_0xd02e('0x32')]);_0x2778f8[_0xd02e('0x37')]=_[_0xd02e('0x36')](_0x3e06de[_0xd02e('0x37')]);_0x2778f8[_0xd02e('0x3e')]=_['intersection'](_0x2778f8[_0xd02e('0x35')],_0x2778f8[_0xd02e('0x37')]);_0x267bb5[_0xd02e('0x39')]=_[_0xd02e('0x38')](_0x2778f8[_0xd02e('0x35')],qs[_0xd02e('0x3a')](_0x3e06de['query'][_0xd02e('0x3a')]));_0x267bb5[_0xd02e('0x39')]=_0x267bb5[_0xd02e('0x39')][_0xd02e('0x49')]?_0x267bb5[_0xd02e('0x39')]:_0x2778f8[_0xd02e('0x35')];_0x267bb5[_0xd02e('0x57')]=qs[_0xd02e('0x3b')](_0x3e06de[_0xd02e('0x37')][_0xd02e('0x3b')]);_0x267bb5['where']=qs[_0xd02e('0x3e')](_[_0xd02e('0x3d')](_0x3e06de[_0xd02e('0x37')],_0x2778f8[_0xd02e('0x3e')]));if(_0x3e06de[_0xd02e('0x37')]['filter']){_0x267bb5[_0xd02e('0x3c')]=_['merge'](_0x267bb5['where'],{'$or':_[_0xd02e('0x31')](_0x267bb5[_0xd02e('0x39')],function(_0x427908){var _0x2c8810={};_0x2c8810[_0x427908]={'$like':'%'+_0x3e06de[_0xd02e('0x37')][_0xd02e('0x41')]+'%'};return _0x2c8810;})});}_0x267bb5=_['merge']({},_0x267bb5,_0x3e06de['options']);return _0x11bbb9[_0xd02e('0x63')](_0x267bb5);}})[_0xd02e('0x29')](function(_0x4b53e1){if(_0x4b53e1){_0x57c57f=_0x4b53e1['length'];if(!_0x3e06de[_0xd02e('0x37')][_0xd02e('0x55')]('nolimit')){_0x267bb5['limit']=qs['limit'](_0x3e06de['query'][_0xd02e('0x24')]);_0x267bb5['offset']=qs['offset'](_0x3e06de[_0xd02e('0x37')][_0xd02e('0x23')]);}return _0x11bbb9['getTeams'](_0x267bb5);}})['then'](function(_0x267b12){if(_0x267b12){return _0x267b12?{'count':_0x57c57f,'rows':_0x267b12}:null;}})[_0xd02e('0x29')](respondWithResult(_0x3418f0,null))[_0xd02e('0x47')](handleError(_0x3418f0,null));};exports['addTeams']=function(_0x3426d1,_0x3669d6,_0xc2ece7){var _0xcef5f0=_0x3426d1[_0xd02e('0x4c')]['ids'];return db[_0xd02e('0x62')][_0xd02e('0x45')]({'where':{'id':_0xcef5f0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd02e('0x2e'),'online',_0xd02e('0x64'),_0xd02e('0x65')],'raw':!![]}]})[_0xd02e('0x29')](function(_0x45066d){if(_0x45066d){var _0x17790d=_[_0xd02e('0x66')](_0x45066d,function(_0x127e77){var _0x2053bf=_0x127e77['get']({'plain':!![]});return _0x2053bf['Agents'];});return db['MailQueue'][_0xd02e('0x4a')]({'where':{'id':_0x3426d1[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](function(_0x1df9bf){return db['sequelize']['transaction'](function(_0x3e1135){return _0x1df9bf['addTeams'](_0xcef5f0,{'transaction':_0x3e1135})[_0xd02e('0x29')](function(){return BPromise[_0xd02e('0x67')](_0x17790d,function(_0x3ee9e3){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x3ee9e3['id'],'MailQueueId':_0x3426d1[_0xd02e('0x52')]['id']},'transaction':_0x3e1135});});})[_0xd02e('0x29')](function(){_0x17790d['forEach'](function(_0x1db08e){socket[_0xd02e('0x68')](_0xd02e('0x69'),{'UserId':_0x1db08e['id'],'MailQueueId':_0x1df9bf['id']});});});});});}})['then'](respondWithStatusCode(_0x3669d6,null))['catch'](handleError(_0x3669d6,null));};exports[_0xd02e('0x6a')]=function(_0xcc823f,_0x8f4b0b,_0x47dbc6){return db[_0xd02e('0x62')]['findAll']({'where':{'id':_0xcc823f[_0xd02e('0x37')][_0xd02e('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd02e('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd02e('0x29')](handleEntityNotFound(_0x8f4b0b,null))['then'](function(_0x57bb43){var _0x261b68=_[_0xd02e('0x31')](_0x57bb43,'id');var _0x1d036a=[];var _0x43dbf8=[];var _0xc9f4ae=squel['select']();_0xc9f4ae['field'](_0xd02e('0x6c'))[_0xd02e('0x6d')](_0xd02e('0x6e'),'tq')['join'](_0xd02e('0x6f'),'ut',_0xd02e('0x70'))['where'](_0xd02e('0x71'),_0xcc823f[_0xd02e('0x52')]['id']);for(var _0x3c7a21=0x0;_0x3c7a21<_0x57bb43[_0xd02e('0x49')];_0x3c7a21+=0x1){let _0x3b2c8c=_0x57bb43[_0x3c7a21];for(var _0x421c2c=0x0;_0x421c2c<_0x3b2c8c[_0xd02e('0x72')][_0xd02e('0x49')];_0x421c2c+=0x1){let _0x1505a5=_0x3b2c8c[_0xd02e('0x72')][_0x421c2c];var _0x5bb469=_0xc9f4ae[_0xd02e('0x73')]();_0x5bb469[_0xd02e('0x3c')](_0xd02e('0x74'),_0x1505a5['id']);_0x43dbf8[_0xd02e('0x75')](db['sequelize'][_0xd02e('0x37')](_0x5bb469[_0xd02e('0x76')](),{'type':db[_0xd02e('0x77')]['QueryTypes'][_0xd02e('0x78')]})['then'](function(_0x49b059){if(_0x49b059[_0xd02e('0x49')]===0x1){return _0x1505a5['id'];}else{var _0xd74a15=_['every'](_[_0xd02e('0x31')](_0x49b059,'TeamId'),function(_0x114d1d){return _[_0xd02e('0x79')](_0x261b68,_0x114d1d);});if(_0xd74a15){return _0x1505a5['id'];}}}));}}return BPromise[_0xd02e('0x7a')](_0x43dbf8)[_0xd02e('0x29')](function(_0x3742fa){_0x1d036a=_(_0x1d036a)[_0xd02e('0x7b')](_0x3742fa)[_0xd02e('0x7c')]()['value']();return db[_0xd02e('0x43')][_0xd02e('0x4a')]({'where':{'id':_0xcc823f[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](function(_0x45ea1e){return db[_0xd02e('0x77')][_0xd02e('0x7d')](function(_0x49d363){return _0x45ea1e['removeTeams'](_0xcc823f[_0xd02e('0x37')]['ids'],{'transaction':_0x49d363})[_0xd02e('0x29')](function(){if(!_[_0xd02e('0x7e')](_0x1d036a)){return _0x45ea1e[_0xd02e('0x7f')](_0x1d036a,{'transaction':_0x49d363});}})[_0xd02e('0x29')](function(){_0x1d036a[_0xd02e('0x80')](function(_0x5bc757){socket[_0xd02e('0x68')](_0xd02e('0x81'),{'UserId':_0x5bc757,'MailQueueId':_0x45ea1e['id']});});});});});});})[_0xd02e('0x29')](respondWithStatusCode(_0x8f4b0b,null))['catch'](handleError(_0x8f4b0b,null));};exports[_0xd02e('0x82')]=function(_0x351c9b,_0x3ddb3e,_0x3fd154){return db[_0xd02e('0x43')][_0xd02e('0x4a')]({'where':{'id':_0x351c9b[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x3ddb3e,null))['then'](function(_0x3dc983){if(_0x3dc983){return _0x3dc983['addAgents'](_0x351c9b[_0xd02e('0x4c')][_0xd02e('0x6b')],_[_0xd02e('0x83')](_0x351c9b[_0xd02e('0x4c')],[_0xd02e('0x6b'),'id'])||{})[_0xd02e('0x84')](function(_0x2c1576){for(var _0x2cabf7=0x0;_0x2cabf7<_0x351c9b['body'][_0xd02e('0x6b')][_0xd02e('0x49')];_0x2cabf7+=0x1){socket[_0xd02e('0x68')](_0xd02e('0x69'),{'UserId':_0x351c9b[_0xd02e('0x4c')][_0xd02e('0x6b')][_0x2cabf7],'MailQueueId':_0x351c9b[_0xd02e('0x52')]['id']});}return _0x2c1576;});}})['then'](respondWithResult(_0x3ddb3e,null))[_0xd02e('0x47')](handleError(_0x3ddb3e,null));};exports[_0xd02e('0x7f')]=function(_0x5db825,_0x147b4e,_0xc84031){return db['MailQueue'][_0xd02e('0x4a')]({'where':{'id':_0x5db825[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x147b4e,null))['then'](function(_0x536e32){if(_0x536e32){return _0x536e32[_0xd02e('0x7f')](_0x5db825[_0xd02e('0x37')]['ids'])[_0xd02e('0x29')](function(){if(_[_0xd02e('0x85')](_0x5db825[_0xd02e('0x37')][_0xd02e('0x6b')])){for(var _0xc86eb9=0x0;_0xc86eb9<_0x5db825['query'][_0xd02e('0x6b')][_0xd02e('0x49')];_0xc86eb9+=0x1){socket[_0xd02e('0x68')](_0xd02e('0x81'),{'UserId':Number(_0x5db825[_0xd02e('0x37')][_0xd02e('0x6b')][_0xc86eb9]),'MailQueueId':Number(_0x5db825[_0xd02e('0x52')]['id'])});}}else{socket['emit'](_0xd02e('0x81'),{'UserId':Number(_0x5db825['query'][_0xd02e('0x6b')]),'MailQueueId':Number(_0x5db825[_0xd02e('0x52')]['id'])});}});}})[_0xd02e('0x29')](respondWithStatusCode(_0x147b4e,null))[_0xd02e('0x47')](handleError(_0x147b4e,null));};exports[_0xd02e('0x86')]=function(_0x3fcc7e,_0x25167a,_0x2316da){var _0x510c08={};var _0xbe613={};var _0x2b2727;var _0x4c728a;return db['MailQueue']['findOne']({'where':{'id':_0x3fcc7e[_0xd02e('0x52')]['id']}})[_0xd02e('0x29')](handleEntityNotFound(_0x25167a,null))[_0xd02e('0x29')](function(_0x3c9a11){if(_0x3c9a11){_0x2b2727=_0x3c9a11;_0xbe613[_0xd02e('0x35')]=_[_0xd02e('0x36')](db[_0xd02e('0x59')]['rawAttributes']);_0xbe613['query']=_[_0xd02e('0x36')](_0x3fcc7e[_0xd02e('0x37')]);_0xbe613['filters']=_[_0xd02e('0x38')](_0xbe613[_0xd02e('0x35')],_0xbe613[_0xd02e('0x37')]);_0x510c08[_0xd02e('0x39')]=_[_0xd02e('0x38')](_0xbe613['model'],qs[_0xd02e('0x3a')](_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x3a')]));_0x510c08[_0xd02e('0x39')]=_0x510c08[_0xd02e('0x39')][_0xd02e('0x49')]?_0x510c08[_0xd02e('0x39')]:_0xbe613['model'];_0x510c08[_0xd02e('0x57')]=qs[_0xd02e('0x3b')](_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x3b')]);_0x510c08['where']=qs[_0xd02e('0x3e')](_[_0xd02e('0x3d')](_0x3fcc7e[_0xd02e('0x37')],_0xbe613[_0xd02e('0x3e')]));if(_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x41')]){_0x510c08[_0xd02e('0x3c')]=_['merge'](_0x510c08['where'],{'$or':_['map'](_0x510c08[_0xd02e('0x39')],function(_0xd05bed){var _0xfe009f={};_0xfe009f[_0xd05bed]={'$like':'%'+_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x41')]+'%'};return _0xfe009f;})});}_0x510c08=_[_0xd02e('0x3f')]({},_0x510c08,_0x3fcc7e['options']);return _0x2b2727['getAgents'](_0x510c08);}})['then'](function(_0x179848){if(_0x179848){_0x4c728a=_0x179848['length'];if(!_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x55')](_0xd02e('0x56'))){_0x510c08[_0xd02e('0x24')]=qs[_0xd02e('0x24')](_0x3fcc7e[_0xd02e('0x37')][_0xd02e('0x24')]);_0x510c08[_0xd02e('0x23')]=qs[_0xd02e('0x23')](_0x3fcc7e[_0xd02e('0x37')]['offset']);}return _0x2b2727[_0xd02e('0x86')](_0x510c08);}})[_0xd02e('0x29')](function(_0x347983){if(_0x347983){return _0x347983?{'count':_0x4c728a,'rows':_0x347983}:null;}})[_0xd02e('0x29')](respondWithResult(_0x25167a,null))['catch'](handleError(_0x25167a,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 4706754..813ea12 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 _0x0212=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x6d4cf,_0x111b86){var _0x291c53=function(_0x2ecd1d){while(--_0x2ecd1d){_0x6d4cf['push'](_0x6d4cf['shift']());}};_0x291c53(++_0x111b86);}(_0x0212,0x1ac));var _0x2021=function(_0x572dc4,_0x3f8b8b){_0x572dc4=_0x572dc4-0x0;var _0x560da4=_0x0212[_0x572dc4];return _0x560da4;};'use strict';var EventEmitter=require(_0x2021('0x0'));var MailQueue=require(_0x2021('0x1'))['db'][_0x2021('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2021('0x3')](0x0);var events={'afterCreate':_0x2021('0x4'),'afterUpdate':_0x2021('0x5'),'afterDestroy':_0x2021('0x6')};function emitEvent(_0x2e3569){return function(_0x3cc1af,_0x301551,_0x4c791b){MailQueueEvents[_0x2021('0x7')](_0x2e3569+':'+_0x3cc1af['id'],_0x3cc1af);MailQueueEvents['emit'](_0x2e3569,_0x3cc1af);_0x4c791b(null);};}for(var e in events){if(events[_0x2021('0x8')](e)){var event=events[e];MailQueue[_0x2021('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x96a2=['exports','events','../../mysqldb','MailQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x96a2,0x172));var _0x296a=function(_0x8a51a2,_0xa18f1){_0x8a51a2=_0x8a51a2-0x0;var _0x5b2a05=_0x96a2[_0x8a51a2];return _0x5b2a05;};'use strict';var EventEmitter=require(_0x296a('0x0'));var MailQueue=require(_0x296a('0x1'))['db'][_0x296a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x296a('0x3'),'afterDestroy':_0x296a('0x4')};function emitEvent(_0x1e6a69){return function(_0x16b81b,_0x501d7e,_0x7d5ee1){MailQueueEvents[_0x296a('0x5')](_0x1e6a69+':'+_0x16b81b['id'],_0x16b81b);MailQueueEvents[_0x296a('0x5')](_0x1e6a69,_0x16b81b);_0x7d5ee1(null);};}for(var e in events){if(events[_0x296a('0x6')](e)){var event=events[e];MailQueue[_0x296a('0x7')](e,emitEvent(event));}}module[_0x296a('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9e18422..e0c4b98 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 _0x10d3=['path','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','api','bluebird','request-promise'];(function(_0x2efd54,_0x241172){var _0x3f923e=function(_0x3cfd1d){while(--_0x3cfd1d){_0x2efd54['push'](_0x2efd54['shift']());}};_0x3f923e(++_0x241172);}(_0x10d3,0xcc));var _0x310d=function(_0x266d82,_0x5a9161){_0x266d82=_0x266d82-0x0;var _0x5dcb9c=_0x10d3[_0x266d82];return _0x5dcb9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x310d('0x0'));var moment=require('moment');var BPromise=require(_0x310d('0x1'));var rp=require(_0x310d('0x2'));var fs=require('fs');var path=require(_0x310d('0x3'));var rimraf=require('rimraf');var config=require(_0x310d('0x4'));var attributes=require(_0x310d('0x5'));module[_0x310d('0x6')]=function(_0x118cb7,_0x3970e8){return _0x118cb7['define'](_0x310d('0x7'),attributes,{'tableName':_0x310d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecc4=['util','api','moment','path','rimraf','exports','define','MailQueue','mail_queues','lodash'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0xecc4,0xc7));var _0x4ecc=function(_0x1b2dcc,_0x24b9e6){_0x1b2dcc=_0x1b2dcc-0x0;var _0x2185ed=_0xecc4[_0x1b2dcc];return _0x2185ed;};'use strict';var _=require(_0x4ecc('0x0'));var util=require(_0x4ecc('0x1'));var logger=require('../../config/logger')(_0x4ecc('0x2'));var moment=require(_0x4ecc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ecc('0x4'));var rimraf=require(_0x4ecc('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x4ecc('0x6')]=function(_0x31cdf5,_0x12016e){return _0x31cdf5[_0x4ecc('0x7')](_0x4ecc('0x8'),attributes,{'tableName':_0x4ecc('0x9'),'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 a98800b..b18cc0d 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 _0xd86c=['rpc','../../config/environment','client','http','redis','defaults','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','include','map','MailQueue','model','info','ShowMailQueue','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x39fe3f,_0x38b8eb){var _0x50d483=function(_0x3bd5dc){while(--_0x3bd5dc){_0x39fe3f['push'](_0x39fe3f['shift']());}};_0x50d483(++_0x38b8eb);}(_0xd86c,0x1f3));var _0xcd86=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0xd86c[_0x40f9a0];return _0x3e3144;};'use strict';var _=require(_0xcd86('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd86('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd86('0x2'))['db'];var utils=require(_0xcd86('0x3'));var logger=require(_0xcd86('0x4'))(_0xcd86('0x5'));var config=require(_0xcd86('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcd86('0x7')][_0xcd86('0x8')]({'port':0x232a});config[_0xcd86('0x9')]=_[_0xcd86('0xa')](config[_0xcd86('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcd86('0xb'))[_0xcd86('0xc')](socket);function respondWithRpcPromise(_0x24760e,_0x13da9e,_0x53454b){return new BPromise(function(_0x1a9383,_0x4b5235){return client[_0xcd86('0xd')](_0x24760e,_0x53454b)[_0xcd86('0xe')](function(_0x332594){logger['info'](_0xcd86('0xf'),_0x13da9e,_0xcd86('0x10'));logger[_0xcd86('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x13da9e,_0xcd86('0x10'),JSON[_0xcd86('0x12')](_0x332594));if(_0x332594[_0xcd86('0x13')]){if(_0x332594[_0xcd86('0x13')][_0xcd86('0x14')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x13da9e,_0x332594[_0xcd86('0x13')]['message']);return _0x4b5235(_0x332594['error']['message']);}logger[_0xcd86('0x13')]('MailQueue,\x20%s,\x20%s',_0x13da9e,_0x332594['error'][_0xcd86('0x15')]);return _0x1a9383(_0x332594[_0xcd86('0x13')]['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x13da9e,_0xcd86('0x10'));_0x1a9383(_0x332594[_0xcd86('0x16')][_0xcd86('0x15')]);}})[_0xcd86('0x17')](function(_0x40703d){logger[_0xcd86('0x13')](_0xcd86('0xf'),_0x13da9e,_0x40703d);_0x4b5235(_0x40703d);});});}exports[_0xcd86('0x18')]=function(_0x162369){var _0x202e72=this;return new Promise(function(_0x1073bf,_0x1383a5){return db['MailQueue'][_0xcd86('0x19')]({'raw':_0x162369[_0xcd86('0x1a')]?_0x162369[_0xcd86('0x1a')][_0xcd86('0x1b')]===undefined?!![]:![]:!![],'where':_0x162369[_0xcd86('0x1a')]?_0x162369[_0xcd86('0x1a')][_0xcd86('0x1c')]||null:null,'attributes':_0x162369[_0xcd86('0x1a')]?_0x162369[_0xcd86('0x1a')][_0xcd86('0x1d')]||null:null,'limit':_0x162369[_0xcd86('0x1a')]?_0x162369[_0xcd86('0x1a')]['limit']||null:null,'include':_0x162369[_0xcd86('0x1a')]?_0x162369[_0xcd86('0x1a')][_0xcd86('0x1e')]?_['map'](_0x162369[_0xcd86('0x1a')][_0xcd86('0x1e')],function(_0x5e37bc){return{'model':db[_0x5e37bc['model']],'as':_0x5e37bc['as'],'attributes':_0x5e37bc['attributes'],'include':_0x5e37bc['include']?_['map'](_0x5e37bc[_0xcd86('0x1e')],function(_0x5b8eed){return{'model':db[_0x5b8eed['model']],'as':_0x5b8eed['as'],'attributes':_0x5b8eed[_0xcd86('0x1d')],'include':_0x5b8eed[_0xcd86('0x1e')]?_[_0xcd86('0x1f')](_0x5b8eed[_0xcd86('0x1e')],function(_0x25ae77){return{'model':db[_0x25ae77['model']],'as':_0x25ae77['as'],'attributes':_0x25ae77[_0xcd86('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd86('0xe')](function(_0x42c85b){logger['info'](_0xcd86('0x18'),_0x162369);logger[_0xcd86('0x11')](_0xcd86('0x18'),_0x162369,JSON[_0xcd86('0x12')](_0x42c85b));_0x1073bf(_0x42c85b);})[_0xcd86('0x17')](function(_0x4f55f8){logger[_0xcd86('0x13')](_0xcd86('0x18'),_0x4f55f8[_0xcd86('0x15')],_0x162369);_0x1383a5(_0x202e72['error'](0x1f4,_0x4f55f8['message']));});});};exports['ShowMailQueue']=function(_0x3ee668){var _0x525d08=this;return new Promise(function(_0x16c667,_0x74530a){return db[_0xcd86('0x20')]['find']({'raw':_0x3ee668['options']?_0x3ee668[_0xcd86('0x1a')][_0xcd86('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ee668[_0xcd86('0x1a')]?_0x3ee668['options']['where']||null:null,'attributes':_0x3ee668[_0xcd86('0x1a')]?_0x3ee668[_0xcd86('0x1a')][_0xcd86('0x1d')]||null:null,'include':_0x3ee668[_0xcd86('0x1a')]?_0x3ee668[_0xcd86('0x1a')][_0xcd86('0x1e')]?_['map'](_0x3ee668['options'][_0xcd86('0x1e')],function(_0x25c051){return{'model':db[_0x25c051[_0xcd86('0x21')]],'as':_0x25c051['as'],'attributes':_0x25c051[_0xcd86('0x1d')],'include':_0x25c051[_0xcd86('0x1e')]?_[_0xcd86('0x1f')](_0x25c051[_0xcd86('0x1e')],function(_0x1981a4){return{'model':db[_0x1981a4[_0xcd86('0x21')]],'as':_0x1981a4['as'],'attributes':_0x1981a4[_0xcd86('0x1d')],'include':_0x1981a4['include']?_[_0xcd86('0x1f')](_0x1981a4[_0xcd86('0x1e')],function(_0x1cfa50){return{'model':db[_0x1cfa50[_0xcd86('0x21')]],'as':_0x1cfa50['as'],'attributes':_0x1cfa50[_0xcd86('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd86('0xe')](function(_0x1d7a82){logger[_0xcd86('0x22')](_0xcd86('0x23'),_0x3ee668);logger[_0xcd86('0x11')](_0xcd86('0x23'),_0x3ee668,JSON['stringify'](_0x1d7a82));_0x16c667(_0x1d7a82);})[_0xcd86('0x17')](function(_0x44b20e){logger[_0xcd86('0x13')](_0xcd86('0x23'),_0x44b20e[_0xcd86('0x15')],_0x3ee668);_0x74530a(_0x525d08[_0xcd86('0x13')](0x1f4,_0x44b20e['message']));});});}; \ No newline at end of file +var _0xa318=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','request\x20sent','debug','stringify','error','code','message','MailQueue,\x20%s,\x20%s','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','model','attributes','then','find','info','ShowMailQueue','lodash','bluebird'];(function(_0x3fc9a9,_0x1a8524){var _0x27969c=function(_0x2f2775){while(--_0x2f2775){_0x3fc9a9['push'](_0x3fc9a9['shift']());}};_0x27969c(++_0x1a8524);}(_0xa318,0x6d));var _0x8a31=function(_0x3d3472,_0xeb9882){_0x3d3472=_0x3d3472-0x0;var _0x241bc2=_0xa318[_0x3d3472];return _0x241bc2;};'use strict';var _=require(_0x8a31('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a31('0x1'));var rs=require(_0x8a31('0x2'));var fs=require('fs');var Redis=require(_0x8a31('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a31('0x4'))(_0x8a31('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a31('0x6'));var client=jayson['client'][_0x8a31('0x7')]({'port':0x232a});config[_0x8a31('0x8')]=_[_0x8a31('0x9')](config['redis'],{'host':_0x8a31('0xa'),'port':0x18eb});var socket=require(_0x8a31('0xb'))(new Redis(config[_0x8a31('0x8')]));require(_0x8a31('0xc'))[_0x8a31('0xd')](socket);function respondWithRpcPromise(_0x3c15b8,_0x2213a3,_0x201548){return new BPromise(function(_0x1c23eb,_0x125b2a){return client[_0x8a31('0xe')](_0x3c15b8,_0x201548)['then'](function(_0x145bbb){logger['info']('MailQueue,\x20%s,\x20%s',_0x2213a3,_0x8a31('0xf'));logger[_0x8a31('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2213a3,_0x8a31('0xf'),JSON[_0x8a31('0x11')](_0x145bbb));if(_0x145bbb[_0x8a31('0x12')]){if(_0x145bbb['error'][_0x8a31('0x13')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x2213a3,_0x145bbb[_0x8a31('0x12')][_0x8a31('0x14')]);return _0x125b2a(_0x145bbb[_0x8a31('0x12')]['message']);}logger[_0x8a31('0x12')](_0x8a31('0x15'),_0x2213a3,_0x145bbb['error'][_0x8a31('0x14')]);return _0x1c23eb(_0x145bbb[_0x8a31('0x12')][_0x8a31('0x14')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2213a3,_0x8a31('0xf'));_0x1c23eb(_0x145bbb['result']['message']);}})[_0x8a31('0x16')](function(_0xb97c05){logger['error'](_0x8a31('0x15'),_0x2213a3,_0xb97c05);_0x125b2a(_0xb97c05);});});}exports[_0x8a31('0x17')]=function(_0x1c3fb3){var _0x102547=this;return new Promise(function(_0x537d64,_0x10d67f){return db[_0x8a31('0x18')][_0x8a31('0x19')]({'raw':_0x1c3fb3['options']?_0x1c3fb3[_0x8a31('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1c3fb3['options']?_0x1c3fb3['options'][_0x8a31('0x1b')]||null:null,'attributes':_0x1c3fb3[_0x8a31('0x1a')]?_0x1c3fb3[_0x8a31('0x1a')]['attributes']||null:null,'limit':_0x1c3fb3[_0x8a31('0x1a')]?_0x1c3fb3[_0x8a31('0x1a')][_0x8a31('0x1c')]||null:null,'include':_0x1c3fb3[_0x8a31('0x1a')]?_0x1c3fb3['options'][_0x8a31('0x1d')]?_[_0x8a31('0x1e')](_0x1c3fb3[_0x8a31('0x1a')][_0x8a31('0x1d')],function(_0x50a94d){return{'model':db[_0x50a94d['model']],'as':_0x50a94d['as'],'attributes':_0x50a94d['attributes'],'include':_0x50a94d['include']?_[_0x8a31('0x1e')](_0x50a94d[_0x8a31('0x1d')],function(_0x322234){return{'model':db[_0x322234[_0x8a31('0x1f')]],'as':_0x322234['as'],'attributes':_0x322234[_0x8a31('0x20')],'include':_0x322234[_0x8a31('0x1d')]?_[_0x8a31('0x1e')](_0x322234[_0x8a31('0x1d')],function(_0x5f237e){return{'model':db[_0x5f237e[_0x8a31('0x1f')]],'as':_0x5f237e['as'],'attributes':_0x5f237e[_0x8a31('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8a31('0x21')](function(_0x33e0f9){logger['info'](_0x8a31('0x17'),_0x1c3fb3);logger[_0x8a31('0x10')]('GetMailQueue',_0x1c3fb3,JSON[_0x8a31('0x11')](_0x33e0f9));_0x537d64(_0x33e0f9);})[_0x8a31('0x16')](function(_0x3d3db2){logger[_0x8a31('0x12')](_0x8a31('0x17'),_0x3d3db2[_0x8a31('0x14')],_0x1c3fb3);_0x10d67f(_0x102547[_0x8a31('0x12')](0x1f4,_0x3d3db2[_0x8a31('0x14')]));});});};exports['ShowMailQueue']=function(_0xcac25f){var _0x3f1126=this;return new Promise(function(_0x3c358d,_0x3656eb){return db[_0x8a31('0x18')][_0x8a31('0x22')]({'raw':_0xcac25f[_0x8a31('0x1a')]?_0xcac25f['options']['raw']===undefined?!![]:![]:!![],'where':_0xcac25f['options']?_0xcac25f[_0x8a31('0x1a')]['where']||null:null,'attributes':_0xcac25f[_0x8a31('0x1a')]?_0xcac25f[_0x8a31('0x1a')][_0x8a31('0x20')]||null:null,'include':_0xcac25f[_0x8a31('0x1a')]?_0xcac25f['options'][_0x8a31('0x1d')]?_[_0x8a31('0x1e')](_0xcac25f[_0x8a31('0x1a')]['include'],function(_0x1a77fc){return{'model':db[_0x1a77fc[_0x8a31('0x1f')]],'as':_0x1a77fc['as'],'attributes':_0x1a77fc[_0x8a31('0x20')],'include':_0x1a77fc['include']?_[_0x8a31('0x1e')](_0x1a77fc['include'],function(_0x3c88c0){return{'model':db[_0x3c88c0[_0x8a31('0x1f')]],'as':_0x3c88c0['as'],'attributes':_0x3c88c0[_0x8a31('0x20')],'include':_0x3c88c0['include']?_[_0x8a31('0x1e')](_0x3c88c0[_0x8a31('0x1d')],function(_0x2743c2){return{'model':db[_0x2743c2[_0x8a31('0x1f')]],'as':_0x2743c2['as'],'attributes':_0x2743c2[_0x8a31('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8a31('0x21')](function(_0x34e04b){logger[_0x8a31('0x23')](_0x8a31('0x24'),_0xcac25f);logger[_0x8a31('0x10')](_0x8a31('0x24'),_0xcac25f,JSON[_0x8a31('0x11')](_0x34e04b));_0x3c358d(_0x34e04b);})[_0x8a31('0x16')](function(_0xca825b){logger[_0x8a31('0x12')]('ShowMailQueue',_0xca825b['message'],_0xcac25f);_0x3656eb(_0x3f1126['error'](0x1f4,_0xca825b[_0x8a31('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d27c496..403261a 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 _0xe980=['length','mailQueue:','./mailQueue.events','remove','update','register'];(function(_0x4e745f,_0x1d660f){var _0x1e1c2f=function(_0x7b3d0b){while(--_0x7b3d0b){_0x4e745f['push'](_0x4e745f['shift']());}};_0x1e1c2f(++_0x1d660f);}(_0xe980,0xc8));var _0x0e98=function(_0x2dd772,_0x57f87e){_0x2dd772=_0x2dd772-0x0;var _0x2590de=_0xe980[_0x2dd772];return _0x2590de;};'use strict';var MailQueueEvents=require(_0x0e98('0x0'));var events=['save',_0x0e98('0x1'),_0x0e98('0x2')];function createListener(_0x26b6d4,_0x39c8e5){return function(_0x824e77){_0x39c8e5['emit'](_0x26b6d4,_0x824e77);};}function removeListener(_0x33f4f1,_0x97cdc3){return function(){MailQueueEvents['removeListener'](_0x33f4f1,_0x97cdc3);};}exports[_0x0e98('0x3')]=function(_0x5838c8){for(var _0x377b8b=0x0,_0x463b10=events[_0x0e98('0x4')];_0x377b8b<_0x463b10;_0x377b8b++){var _0x5c567e=events[_0x377b8b];var _0x48d0da=createListener(_0x0e98('0x5')+_0x5c567e,_0x5838c8);MailQueueEvents['on'](_0x5c567e,_0x48d0da);}}; \ No newline at end of file +var _0xd7e5=['mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd7e5,0x1a0));var _0x5d7e=function(_0x44d128,_0xdd104e){_0x44d128=_0x44d128-0x0;var _0x49b7a3=_0xd7e5[_0x44d128];return _0x49b7a3;};'use strict';var MailQueueEvents=require(_0x5d7e('0x0'));var events=[_0x5d7e('0x1'),_0x5d7e('0x2'),_0x5d7e('0x3')];function createListener(_0x1173cb,_0x26e0da){return function(_0x31333f){_0x26e0da['emit'](_0x1173cb,_0x31333f);};}function removeListener(_0x98ebe,_0x4ec2fa){return function(){MailQueueEvents['removeListener'](_0x98ebe,_0x4ec2fa);};}exports['register']=function(_0xa84234){for(var _0x1bc26e=0x0,_0x356395=events['length'];_0x1bc26e<_0x356395;_0x1bc26e++){var _0x3af689=events[_0x1bc26e];var _0x2add11=createListener(_0x5d7e('0x4')+_0x3af689,_0xa84234);MailQueueEvents['on'](_0x3af689,_0x2add11);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 53b4651..450d2b1 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 _0x092c=['get','isAuthenticated','/describe','describe','show','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x3987c5,_0x4bfeed){var _0x51f931=function(_0x39c4df){while(--_0x39c4df){_0x3987c5['push'](_0x3987c5['shift']());}};_0x51f931(++_0x4bfeed);}(_0x092c,0x1d2));var _0xc092=function(_0x2bbbcf,_0x4bc60f){_0x2bbbcf=_0x2bbbcf-0x0;var _0x4ce02d=_0x092c[_0x2bbbcf];return _0x4ce02d;};'use strict';var multer=require(_0xc092('0x0'));var util=require(_0xc092('0x1'));var path=require(_0xc092('0x2'));var timeout=require(_0xc092('0x3'));var express=require(_0xc092('0x4'));var router=express['Router']();var auth=require(_0xc092('0x5'));var interaction=require(_0xc092('0x6'));var config=require(_0xc092('0x7'));var controller=require(_0xc092('0x8'));router[_0xc092('0x9')]('/',auth[_0xc092('0xa')](),controller['index']);router['get'](_0xc092('0xb'),auth['isAuthenticated'](),controller[_0xc092('0xc')]);router[_0xc092('0x9')]('/:id',auth[_0xc092('0xa')](),controller[_0xc092('0xd')]);router[_0xc092('0xe')]('/',auth[_0xc092('0xa')](),controller[_0xc092('0xf')]);router[_0xc092('0x10')](_0xc092('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc092('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xc092('0x12')]=router; \ No newline at end of file +var _0xa8de=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x4a562e,_0x1787ef){var _0x20c9bd=function(_0x5a5d34){while(--_0x5a5d34){_0x4a562e['push'](_0x4a562e['shift']());}};_0x20c9bd(++_0x1787ef);}(_0xa8de,0x14b));var _0xea8d=function(_0x412a85,_0x595c92){_0x412a85=_0x412a85-0x0;var _0x42043a=_0xa8de[_0x412a85];return _0x42043a;};'use strict';var multer=require(_0xea8d('0x0'));var util=require(_0xea8d('0x1'));var path=require(_0xea8d('0x2'));var timeout=require(_0xea8d('0x3'));var express=require(_0xea8d('0x4'));var router=express[_0xea8d('0x5')]();var auth=require(_0xea8d('0x6'));var interaction=require(_0xea8d('0x7'));var config=require(_0xea8d('0x8'));var controller=require(_0xea8d('0x9'));router[_0xea8d('0xa')]('/',auth[_0xea8d('0xb')](),controller[_0xea8d('0xc')]);router[_0xea8d('0xa')]('/describe',auth[_0xea8d('0xb')](),controller[_0xea8d('0xd')]);router[_0xea8d('0xa')](_0xea8d('0xe'),auth[_0xea8d('0xb')](),controller[_0xea8d('0xf')]);router[_0xea8d('0x10')]('/',auth[_0xea8d('0xb')](),controller[_0xea8d('0x11')]);router[_0xea8d('0x12')](_0xea8d('0xe'),auth[_0xea8d('0xb')](),controller['update']);router[_0xea8d('0x13')](_0xea8d('0xe'),auth[_0xea8d('0xb')](),controller[_0xea8d('0x14')]);module[_0xea8d('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 39b135c..9c65854 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 _0x195d=['STRING','DATE','moment','sequelize','exports'];(function(_0x2f1ac4,_0x236a72){var _0x18e1a5=function(_0x18f34b){while(--_0x18f34b){_0x2f1ac4['push'](_0x2f1ac4['shift']());}};_0x18e1a5(++_0x236a72);}(_0x195d,0x19c));var _0xd195=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x195d[_0x2d89ce];return _0x3fad10;};'use strict';var moment=require(_0xd195('0x0'));var Sequelize=require(_0xd195('0x1'));module[_0xd195('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd195('0x3')]},'joinAt':{'type':Sequelize[_0xd195('0x4')]},'leaveAt':{'type':Sequelize[_0xd195('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd195('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91e9=['exports','STRING','DATE','moment','sequelize'];(function(_0x586d43,_0x5a750c){var _0x17ca21=function(_0x38360f){while(--_0x38360f){_0x586d43['push'](_0x586d43['shift']());}};_0x17ca21(++_0x5a750c);}(_0x91e9,0x1ca));var _0x991e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x91e9[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x991e('0x0'));var Sequelize=require(_0x991e('0x1'));module[_0x991e('0x2')]={'uniqueid':{'type':Sequelize[_0x991e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x991e('0x3')]},'joinAt':{'type':Sequelize[_0x991e('0x4')]},'leaveAt':{'type':Sequelize[_0x991e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x991e('0x4')]},'reason':{'type':Sequelize[_0x991e('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fcc288e..bb38c19 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 _0x7923=['body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','options','MailQueueReport','includeAll','include','rows','catch','fields','create'];(function(_0x1fdcbe,_0x5c9cf6){var _0x5e400c=function(_0x4e4fb7){while(--_0x4e4fb7){_0x1fdcbe['push'](_0x1fdcbe['shift']());}};_0x5e400c(++_0x5c9cf6);}(_0x7923,0x8f));var _0x3792=function(_0x544160,_0x475e2a){_0x544160=_0x544160-0x0;var _0x3ce4ba=_0x7923[_0x544160];return _0x3ce4ba;};'use strict';var pdf=require(_0x3792('0x0'));var emlformat=require(_0x3792('0x1'));var rimraf=require(_0x3792('0x2'));var zipdir=require(_0x3792('0x3'));var jsonpatch=require(_0x3792('0x4'));var rp=require(_0x3792('0x5'));var moment=require(_0x3792('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3792('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3792('0x8'));var csv=require('to-csv');var ejs=require(_0x3792('0x9'));var fs=require('fs');var _=require(_0x3792('0xa'));var squel=require(_0x3792('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3792('0xc'));var toCsv=require(_0x3792('0xd'));var querystring=require('querystring');var Papa=require(_0x3792('0xe'));var Redis=require(_0x3792('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3792('0x10'));var as=require(_0x3792('0x11'));var hardwareService=require(_0x3792('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3792('0x13'));var config=require(_0x3792('0x14'));var db=require(_0x3792('0x15'))['db'];function respondWithStatusCode(_0x19ec7c,_0x5a6d8e){_0x5a6d8e=_0x5a6d8e||0xcc;return function(_0x506ec4){if(_0x506ec4){return _0x19ec7c[_0x3792('0x16')](_0x5a6d8e);}return _0x19ec7c[_0x3792('0x17')](_0x5a6d8e)[_0x3792('0x18')]();};}function respondWithResult(_0x3530fe,_0x10913e){_0x10913e=_0x10913e||0xc8;return function(_0x2b86ce){if(_0x2b86ce){return _0x3530fe[_0x3792('0x17')](_0x10913e)[_0x3792('0x19')](_0x2b86ce);}};}function respondWithFilteredResult(_0x44398b,_0x11910c){return function(_0x427b53){if(_0x427b53){var _0x183c42=_0x427b53[_0x3792('0x1a')],_0x4247cd=_0x11910c[_0x3792('0x1b')],_0x26a4ba=_0x11910c['offset']+_0x11910c[_0x3792('0x1c')],_0x46653b;if(_0x26a4ba>=_0x183c42){_0x26a4ba=_0x183c42;_0x46653b=0xc8;}else{_0x46653b=0xce;}_0x44398b[_0x3792('0x17')](_0x46653b);return _0x44398b[_0x3792('0x1d')](_0x3792('0x1e'),_0x4247cd+'-'+_0x26a4ba+'/'+_0x183c42)[_0x3792('0x19')](_0x427b53);}return null;};}function patchUpdates(_0x5a9f56){return function(_0x350f32){try{jsonpatch[_0x3792('0x1f')](_0x350f32,_0x5a9f56,!![]);}catch(_0x19f513){return BPromise[_0x3792('0x20')](_0x19f513);}return _0x350f32[_0x3792('0x21')]();};}function saveUpdates(_0x5647ac,_0x4cd50b){return function(_0x2c1f8a){if(_0x2c1f8a){return _0x2c1f8a[_0x3792('0x22')](_0x5647ac)[_0x3792('0x23')](function(_0x2e5f38){return _0x2e5f38;});}return null;};}function removeEntity(_0x17277b,_0x386b88){return function(_0x5c2c70){if(_0x5c2c70){return _0x5c2c70['destroy']()[_0x3792('0x23')](function(){_0x17277b[_0x3792('0x17')](0xcc)[_0x3792('0x18')]();});}};}function handleEntityNotFound(_0x7a0f3f,_0x54d99b){return function(_0x515dc0){if(!_0x515dc0){_0x7a0f3f['sendStatus'](0x194);}return _0x515dc0;};}function handleError(_0x21c266,_0x3608da){_0x3608da=_0x3608da||0x1f4;return function(_0x5c0a27){logger['error'](_0x5c0a27[_0x3792('0x24')]);if(_0x5c0a27[_0x3792('0x25')]){delete _0x5c0a27[_0x3792('0x25')];}_0x21c266['status'](_0x3608da)['send'](_0x5c0a27);};}exports[_0x3792('0x26')]=function(_0xd53563,_0x53369e){var _0x483e79={},_0x7e2964={},_0x223b6b={'count':0x0,'rows':[]};var _0x1334d2=_[_0x3792('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x3d2091){return{'name':_0x3d2091[_0x3792('0x28')],'type':_0x3d2091[_0x3792('0x29')][_0x3792('0x2a')]};});_0x7e2964[_0x3792('0x2b')]=_[_0x3792('0x27')](_0x1334d2,_0x3792('0x25'));_0x7e2964[_0x3792('0x2c')]=_[_0x3792('0x2d')](_0xd53563['query']);_0x7e2964[_0x3792('0x2e')]=_[_0x3792('0x2f')](_0x7e2964[_0x3792('0x2b')],_0x7e2964[_0x3792('0x2c')]);_0x483e79[_0x3792('0x30')]=_['intersection'](_0x7e2964['model'],qs['fields'](_0xd53563[_0x3792('0x2c')]['fields']));_0x483e79[_0x3792('0x30')]=_0x483e79['attributes'][_0x3792('0x31')]?_0x483e79[_0x3792('0x30')]:_0x7e2964[_0x3792('0x2b')];if(!_0xd53563[_0x3792('0x2c')]['hasOwnProperty'](_0x3792('0x32'))){_0x483e79['limit']=qs['limit'](_0xd53563[_0x3792('0x2c')][_0x3792('0x1c')]);_0x483e79[_0x3792('0x1b')]=qs[_0x3792('0x1b')](_0xd53563['query']['offset']);}_0x483e79[_0x3792('0x33')]=qs[_0x3792('0x34')](_0xd53563[_0x3792('0x2c')][_0x3792('0x34')]);_0x483e79[_0x3792('0x35')]=qs[_0x3792('0x2e')](_['pick'](_0xd53563[_0x3792('0x2c')],_0x7e2964[_0x3792('0x2e')]),_0x1334d2);if(_0xd53563[_0x3792('0x2c')][_0x3792('0x36')]){_0x483e79[_0x3792('0x35')]=_[_0x3792('0x37')](_0x483e79[_0x3792('0x35')],{'$or':_[_0x3792('0x27')](_0x1334d2,function(_0x4add84){if(_0x4add84['type']!=='VIRTUAL'){var _0x211371={};_0x211371[_0x4add84[_0x3792('0x25')]]={'$like':'%'+_0xd53563[_0x3792('0x2c')]['filter']+'%'};return _0x211371;}})});}_0x483e79=_['merge']({},_0x483e79,_0xd53563[_0x3792('0x38')]);var _0x151523={'where':_0x483e79['where']};return db[_0x3792('0x39')][_0x3792('0x1a')](_0x151523)[_0x3792('0x23')](function(_0x5e1814){_0x223b6b[_0x3792('0x1a')]=_0x5e1814;if(_0xd53563['query'][_0x3792('0x3a')]){_0x483e79[_0x3792('0x3b')]=[{'all':!![]}];}return db[_0x3792('0x39')]['findAll'](_0x483e79);})[_0x3792('0x23')](function(_0xed07d){_0x223b6b[_0x3792('0x3c')]=_0xed07d;return _0x223b6b;})[_0x3792('0x23')](respondWithFilteredResult(_0x53369e,_0x483e79))[_0x3792('0x3d')](handleError(_0x53369e,null));};exports['show']=function(_0x114965,_0x1abc25){var _0x1d72ca={'raw':!![],'where':{'id':_0x114965['params']['id']}},_0x2634dc={};_0x2634dc[_0x3792('0x2b')]=_[_0x3792('0x2d')](db[_0x3792('0x39')]['rawAttributes']);_0x2634dc[_0x3792('0x2c')]=_[_0x3792('0x2d')](_0x114965[_0x3792('0x2c')]);_0x2634dc[_0x3792('0x2e')]=_[_0x3792('0x2f')](_0x2634dc[_0x3792('0x2b')],_0x2634dc[_0x3792('0x2c')]);_0x1d72ca[_0x3792('0x30')]=_[_0x3792('0x2f')](_0x2634dc[_0x3792('0x2b')],qs[_0x3792('0x3e')](_0x114965[_0x3792('0x2c')][_0x3792('0x3e')]));_0x1d72ca[_0x3792('0x30')]=_0x1d72ca[_0x3792('0x30')][_0x3792('0x31')]?_0x1d72ca[_0x3792('0x30')]:_0x2634dc[_0x3792('0x2b')];if(_0x114965[_0x3792('0x2c')][_0x3792('0x3a')]){_0x1d72ca[_0x3792('0x3b')]=[{'all':!![]}];}_0x1d72ca=_[_0x3792('0x37')]({},_0x1d72ca,_0x114965['options']);return db[_0x3792('0x39')]['find'](_0x1d72ca)[_0x3792('0x23')](handleEntityNotFound(_0x1abc25,null))[_0x3792('0x23')](respondWithResult(_0x1abc25,null))[_0x3792('0x3d')](handleError(_0x1abc25,null));};exports['create']=function(_0x1ec866,_0x42e8b0){return db['MailQueueReport'][_0x3792('0x3f')](_0x1ec866[_0x3792('0x40')],{})[_0x3792('0x23')](respondWithResult(_0x42e8b0,0xc9))[_0x3792('0x3d')](handleError(_0x42e8b0,null));};exports[_0x3792('0x22')]=function(_0x172f47,_0x1268f7){if(_0x172f47[_0x3792('0x40')]['id']){delete _0x172f47[_0x3792('0x40')]['id'];}return db[_0x3792('0x39')][_0x3792('0x41')]({'where':{'id':_0x172f47[_0x3792('0x42')]['id']}})[_0x3792('0x23')](handleEntityNotFound(_0x1268f7,null))[_0x3792('0x23')](saveUpdates(_0x172f47[_0x3792('0x40')],null))[_0x3792('0x23')](respondWithResult(_0x1268f7,null))[_0x3792('0x3d')](handleError(_0x1268f7,null));};exports[_0x3792('0x43')]=function(_0x3564fd,_0x414a3e){return db[_0x3792('0x39')][_0x3792('0x41')]({'where':{'id':_0x3564fd[_0x3792('0x42')]['id']}})[_0x3792('0x23')](handleEntityNotFound(_0x414a3e,null))[_0x3792('0x23')](removeEntity(_0x414a3e,null))['catch'](handleError(_0x414a3e,null));};exports['describe']=function(_0x4e23b9,_0x521efb){return db[_0x3792('0x39')][_0x3792('0x44')]()['then'](respondWithResult(_0x521efb,null))[_0x3792('0x3d')](handleError(_0x521efb,null));}; \ No newline at end of file +var _0xdbbe=['../../config/environment','sendStatus','status','end','json','count','offset','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','show','params','length','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x21420e,_0x15c0b0){var _0x56a508=function(_0x3d48df){while(--_0x3d48df){_0x21420e['push'](_0x21420e['shift']());}};_0x56a508(++_0x15c0b0);}(_0xdbbe,0x148));var _0xedbb=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0xdbbe[_0x3d9b04];return _0x557936;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedbb('0x0'));var rimraf=require(_0xedbb('0x1'));var zipdir=require(_0xedbb('0x2'));var jsonpatch=require(_0xedbb('0x3'));var rp=require(_0xedbb('0x4'));var moment=require(_0xedbb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xedbb('0x6'));var util=require(_0xedbb('0x7'));var path=require(_0xedbb('0x8'));var sox=require(_0xedbb('0x9'));var csv=require(_0xedbb('0xa'));var ejs=require(_0xedbb('0xb'));var fs=require('fs');var _=require(_0xedbb('0xc'));var squel=require('squel');var crypto=require(_0xedbb('0xd'));var jsforce=require(_0xedbb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xedbb('0xa'));var querystring=require('querystring');var Papa=require(_0xedbb('0xf'));var Redis=require(_0xedbb('0x10'));var authService=require(_0xedbb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xedbb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedbb('0x13'))(_0xedbb('0x14'));var utils=require(_0xedbb('0x15'));var config=require(_0xedbb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4260fc,_0x156b0e){_0x156b0e=_0x156b0e||0xcc;return function(_0x420003){if(_0x420003){return _0x4260fc[_0xedbb('0x17')](_0x156b0e);}return _0x4260fc[_0xedbb('0x18')](_0x156b0e)[_0xedbb('0x19')]();};}function respondWithResult(_0x47fe18,_0x20c895){_0x20c895=_0x20c895||0xc8;return function(_0xaee7ac){if(_0xaee7ac){return _0x47fe18[_0xedbb('0x18')](_0x20c895)[_0xedbb('0x1a')](_0xaee7ac);}};}function respondWithFilteredResult(_0x2a4fe3,_0x3612d8){return function(_0x4e23be){if(_0x4e23be){var _0x4b7afe=_0x4e23be[_0xedbb('0x1b')],_0x369f68=_0x3612d8[_0xedbb('0x1c')],_0x1ca947=_0x3612d8[_0xedbb('0x1c')]+_0x3612d8['limit'],_0x5186cf;if(_0x1ca947>=_0x4b7afe){_0x1ca947=_0x4b7afe;_0x5186cf=0xc8;}else{_0x5186cf=0xce;}_0x2a4fe3[_0xedbb('0x18')](_0x5186cf);return _0x2a4fe3['set']('Content-Range',_0x369f68+'-'+_0x1ca947+'/'+_0x4b7afe)['json'](_0x4e23be);}return null;};}function patchUpdates(_0x54ec3f){return function(_0x725fb6){try{jsonpatch['apply'](_0x725fb6,_0x54ec3f,!![]);}catch(_0x4d5f61){return BPromise[_0xedbb('0x1d')](_0x4d5f61);}return _0x725fb6[_0xedbb('0x1e')]();};}function saveUpdates(_0x11d269,_0x139a93){return function(_0x92851f){if(_0x92851f){return _0x92851f[_0xedbb('0x1f')](_0x11d269)['then'](function(_0x10cef3){return _0x10cef3;});}return null;};}function removeEntity(_0x28587f,_0x10e4e9){return function(_0x5f2ce2){if(_0x5f2ce2){return _0x5f2ce2[_0xedbb('0x20')]()[_0xedbb('0x21')](function(){_0x28587f[_0xedbb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135533,_0x1e9bb6){return function(_0x8574c4){if(!_0x8574c4){_0x135533[_0xedbb('0x17')](0x194);}return _0x8574c4;};}function handleError(_0x1e6d72,_0x12af1c){_0x12af1c=_0x12af1c||0x1f4;return function(_0x8a285d){logger[_0xedbb('0x22')](_0x8a285d[_0xedbb('0x23')]);if(_0x8a285d['name']){delete _0x8a285d[_0xedbb('0x24')];}_0x1e6d72[_0xedbb('0x18')](_0x12af1c)[_0xedbb('0x25')](_0x8a285d);};}exports['index']=function(_0x29bf23,_0x38fb3b){var _0x5b4a1f={},_0x4c8dbf={},_0x528647={'count':0x0,'rows':[]};var _0x1a3a01=_[_0xedbb('0x26')](db[_0xedbb('0x27')][_0xedbb('0x28')],function(_0x83f403){return{'name':_0x83f403['fieldName'],'type':_0x83f403[_0xedbb('0x29')][_0xedbb('0x2a')]};});_0x4c8dbf[_0xedbb('0x2b')]=_[_0xedbb('0x26')](_0x1a3a01,_0xedbb('0x24'));_0x4c8dbf['query']=_[_0xedbb('0x2c')](_0x29bf23[_0xedbb('0x2d')]);_0x4c8dbf[_0xedbb('0x2e')]=_[_0xedbb('0x2f')](_0x4c8dbf[_0xedbb('0x2b')],_0x4c8dbf[_0xedbb('0x2d')]);_0x5b4a1f[_0xedbb('0x30')]=_['intersection'](_0x4c8dbf[_0xedbb('0x2b')],qs[_0xedbb('0x31')](_0x29bf23[_0xedbb('0x2d')]['fields']));_0x5b4a1f['attributes']=_0x5b4a1f[_0xedbb('0x30')]['length']?_0x5b4a1f[_0xedbb('0x30')]:_0x4c8dbf[_0xedbb('0x2b')];if(!_0x29bf23[_0xedbb('0x2d')][_0xedbb('0x32')]('nolimit')){_0x5b4a1f[_0xedbb('0x33')]=qs[_0xedbb('0x33')](_0x29bf23['query'][_0xedbb('0x33')]);_0x5b4a1f[_0xedbb('0x1c')]=qs['offset'](_0x29bf23[_0xedbb('0x2d')]['offset']);}_0x5b4a1f[_0xedbb('0x34')]=qs[_0xedbb('0x35')](_0x29bf23['query']['sort']);_0x5b4a1f['where']=qs[_0xedbb('0x2e')](_['pick'](_0x29bf23[_0xedbb('0x2d')],_0x4c8dbf[_0xedbb('0x2e')]),_0x1a3a01);if(_0x29bf23[_0xedbb('0x2d')]['filter']){_0x5b4a1f[_0xedbb('0x36')]=_[_0xedbb('0x37')](_0x5b4a1f[_0xedbb('0x36')],{'$or':_[_0xedbb('0x26')](_0x1a3a01,function(_0x2dedcb){if(_0x2dedcb[_0xedbb('0x29')]!==_0xedbb('0x38')){var _0x1c4b8f={};_0x1c4b8f[_0x2dedcb['name']]={'$like':'%'+_0x29bf23[_0xedbb('0x2d')][_0xedbb('0x39')]+'%'};return _0x1c4b8f;}})});}_0x5b4a1f=_['merge']({},_0x5b4a1f,_0x29bf23['options']);var _0x1ad6b9={'where':_0x5b4a1f[_0xedbb('0x36')]};return db[_0xedbb('0x27')][_0xedbb('0x1b')](_0x1ad6b9)[_0xedbb('0x21')](function(_0x3af301){_0x528647['count']=_0x3af301;if(_0x29bf23[_0xedbb('0x2d')][_0xedbb('0x3a')]){_0x5b4a1f[_0xedbb('0x3b')]=[{'all':!![]}];}return db[_0xedbb('0x27')]['findAll'](_0x5b4a1f);})[_0xedbb('0x21')](function(_0x101cc4){_0x528647[_0xedbb('0x3c')]=_0x101cc4;return _0x528647;})['then'](respondWithFilteredResult(_0x38fb3b,_0x5b4a1f))['catch'](handleError(_0x38fb3b,null));};exports[_0xedbb('0x3d')]=function(_0xd2557e,_0x4ec6aa){var _0x25998c={'raw':!![],'where':{'id':_0xd2557e[_0xedbb('0x3e')]['id']}},_0x2c99a9={};_0x2c99a9[_0xedbb('0x2b')]=_[_0xedbb('0x2c')](db[_0xedbb('0x27')][_0xedbb('0x28')]);_0x2c99a9['query']=_[_0xedbb('0x2c')](_0xd2557e['query']);_0x2c99a9[_0xedbb('0x2e')]=_['intersection'](_0x2c99a9[_0xedbb('0x2b')],_0x2c99a9[_0xedbb('0x2d')]);_0x25998c[_0xedbb('0x30')]=_[_0xedbb('0x2f')](_0x2c99a9[_0xedbb('0x2b')],qs['fields'](_0xd2557e[_0xedbb('0x2d')][_0xedbb('0x31')]));_0x25998c[_0xedbb('0x30')]=_0x25998c[_0xedbb('0x30')][_0xedbb('0x3f')]?_0x25998c[_0xedbb('0x30')]:_0x2c99a9[_0xedbb('0x2b')];if(_0xd2557e[_0xedbb('0x2d')]['includeAll']){_0x25998c[_0xedbb('0x3b')]=[{'all':!![]}];}_0x25998c=_[_0xedbb('0x37')]({},_0x25998c,_0xd2557e[_0xedbb('0x40')]);return db[_0xedbb('0x27')][_0xedbb('0x41')](_0x25998c)[_0xedbb('0x21')](handleEntityNotFound(_0x4ec6aa,null))[_0xedbb('0x21')](respondWithResult(_0x4ec6aa,null))['catch'](handleError(_0x4ec6aa,null));};exports[_0xedbb('0x42')]=function(_0xd15fe7,_0x51cd9b){return db['MailQueueReport'][_0xedbb('0x42')](_0xd15fe7[_0xedbb('0x43')],{})[_0xedbb('0x21')](respondWithResult(_0x51cd9b,0xc9))[_0xedbb('0x44')](handleError(_0x51cd9b,null));};exports[_0xedbb('0x1f')]=function(_0x52fca0,_0x36ac3a){if(_0x52fca0['body']['id']){delete _0x52fca0[_0xedbb('0x43')]['id'];}return db[_0xedbb('0x27')]['find']({'where':{'id':_0x52fca0[_0xedbb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36ac3a,null))['then'](saveUpdates(_0x52fca0[_0xedbb('0x43')],null))[_0xedbb('0x21')](respondWithResult(_0x36ac3a,null))[_0xedbb('0x44')](handleError(_0x36ac3a,null));};exports[_0xedbb('0x20')]=function(_0x1feaee,_0x5511c9){return db[_0xedbb('0x27')][_0xedbb('0x41')]({'where':{'id':_0x1feaee['params']['id']}})[_0xedbb('0x21')](handleEntityNotFound(_0x5511c9,null))['then'](removeEntity(_0x5511c9,null))[_0xedbb('0x44')](handleError(_0x5511c9,null));};exports['describe']=function(_0x25220d,_0x5d45e1){return db[_0xedbb('0x27')][_0xedbb('0x45')]()[_0xedbb('0x21')](respondWithResult(_0x5d45e1,null))[_0xedbb('0x44')](handleError(_0x5d45e1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6ec2998..1550ed2 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 _0x9512=['./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9512,0x75));var _0x2951=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0x9512[_0x1f9503];return _0xaab94f;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var logger=require(_0x2951('0x2'))(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require(_0x2951('0x5'));var rp=require(_0x2951('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2951('0x7'));var config=require(_0x2951('0x8'));var attributes=require(_0x2951('0x9'));module[_0x2951('0xa')]=function(_0x15d4fa,_0x293a9c){return _0x15d4fa[_0x2951('0xb')]('MailQueueReport',attributes,{'tableName':_0x2951('0xc'),'paranoid':![],'indexes':[{'name':_0x2951('0xd'),'fields':[_0x2951('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','MailQueueReport','uniqueid'];(function(_0x25ecbc,_0x1d71e9){var _0x3da7f8=function(_0x48ba0c){while(--_0x48ba0c){_0x25ecbc['push'](_0x25ecbc['shift']());}};_0x3da7f8(++_0x1d71e9);}(_0xe820,0xd2));var _0x0e82=function(_0x5a5a33,_0x5b6d8d){_0x5a5a33=_0x5a5a33-0x0;var _0x395428=_0xe820[_0x5a5a33];return _0x395428;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x0e82('0x9'),'fields':[_0x0e82('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 57be864..579cb51 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 _0xda19=['CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','update','attributes','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0xda19,0xd5));var _0x9da1=function(_0x583b02,_0x5693d5){_0x583b02=_0x583b02-0x0;var _0x4dcee4=_0xda19[_0x583b02];return _0x4dcee4;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});}exports[_0x9da1('0x13')]=function(_0xfb278d){var _0x42a9c7=this;return new Promise(function(_0x497676,_0x4d4541){return db[_0x9da1('0x14')][_0x9da1('0x15')](_0xfb278d[_0x9da1('0x16')],{'raw':_0xfb278d[_0x9da1('0x17')]?_0xfb278d[_0x9da1('0x17')][_0x9da1('0x18')]===undefined?!![]:![]:!![]})[_0x9da1('0x19')](function(_0x47e5cf){logger[_0x9da1('0x11')](_0x9da1('0x13'),_0xfb278d);logger[_0x9da1('0xc')](_0x9da1('0x13'),_0xfb278d,JSON[_0x9da1('0xe')](_0x47e5cf));_0x497676(_0x47e5cf);})['catch'](function(_0x5454d3){logger[_0x9da1('0xf')](_0x9da1('0x13'),_0x5454d3[_0x9da1('0x10')],_0xfb278d);_0x4d4541(_0x42a9c7[_0x9da1('0xf')](0x1f4,_0x5454d3[_0x9da1('0x10')]));});});};exports[_0x9da1('0x1a')]=function(_0x4c60aa){var _0x2413fe=this;return new Promise(function(_0x3bfa40,_0x4fd25a){return db[_0x9da1('0x14')][_0x9da1('0x1b')](_0x4c60aa['body'],{'raw':_0x4c60aa[_0x9da1('0x17')]?_0x4c60aa[_0x9da1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c60aa[_0x9da1('0x17')]?_0x4c60aa[_0x9da1('0x17')]['where']||null:null,'attributes':_0x4c60aa['options']?_0x4c60aa[_0x9da1('0x17')][_0x9da1('0x1c')]||null:null,'limit':_0x4c60aa['options']?_0x4c60aa[_0x9da1('0x17')]['limit']||null:null})['then'](function(_0x5a59c2){logger[_0x9da1('0x11')](_0x9da1('0x1a'),_0x4c60aa);logger[_0x9da1('0xc')](_0x9da1('0x1a'),_0x4c60aa,JSON[_0x9da1('0xe')](_0x5a59c2));_0x3bfa40(_0x5a59c2);})['catch'](function(_0x269628){logger['error'](_0x9da1('0x1a'),_0x269628[_0x9da1('0x10')],_0x4c60aa);_0x4fd25a(_0x2413fe['error'](0x1f4,_0x269628[_0x9da1('0x10')]));});});}; \ No newline at end of file +var _0x2a07=['create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','MailQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x2a07[_0x57fcc0];return _0x5270df;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});}exports['CreateMailQueueReport']=function(_0x100d8f){var _0x42e9ec=this;return new Promise(function(_0x131b73,_0x5b63c8){return db[_0x72a0('0x17')][_0x72a0('0x18')](_0x100d8f[_0x72a0('0x19')],{'raw':_0x100d8f[_0x72a0('0x1a')]?_0x100d8f['options'][_0x72a0('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d0607){logger[_0x72a0('0x15')](_0x72a0('0x1c'),_0x100d8f);logger['debug'](_0x72a0('0x1c'),_0x100d8f,JSON[_0x72a0('0x12')](_0x3d0607));_0x131b73(_0x3d0607);})[_0x72a0('0x16')](function(_0x3d1965){logger['error'](_0x72a0('0x1c'),_0x3d1965[_0x72a0('0x14')],_0x100d8f);_0x5b63c8(_0x42e9ec[_0x72a0('0x13')](0x1f4,_0x3d1965[_0x72a0('0x14')]));});});};exports[_0x72a0('0x1d')]=function(_0x174b1b){var _0x5c4daf=this;return new Promise(function(_0x4dd1a6,_0x468d66){return db[_0x72a0('0x17')][_0x72a0('0x1e')](_0x174b1b[_0x72a0('0x19')],{'raw':_0x174b1b[_0x72a0('0x1a')]?_0x174b1b[_0x72a0('0x1a')][_0x72a0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x174b1b[_0x72a0('0x1a')]?_0x174b1b[_0x72a0('0x1a')][_0x72a0('0x1f')]||null:null,'attributes':_0x174b1b['options']?_0x174b1b[_0x72a0('0x1a')][_0x72a0('0x20')]||null:null,'limit':_0x174b1b[_0x72a0('0x1a')]?_0x174b1b[_0x72a0('0x1a')][_0x72a0('0x21')]||null:null})[_0x72a0('0xe')](function(_0x432179){logger[_0x72a0('0x15')](_0x72a0('0x1d'),_0x174b1b);logger[_0x72a0('0x22')]('UpdateMailQueueReport',_0x174b1b,JSON[_0x72a0('0x12')](_0x432179));_0x4dd1a6(_0x432179);})[_0x72a0('0x16')](function(_0x39136d){logger[_0x72a0('0x13')](_0x72a0('0x1d'),_0x39136d[_0x72a0('0x14')],_0x174b1b);_0x468d66(_0x5c4daf[_0x72a0('0x13')](0x1f4,_0x39136d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ca85774..f05a93b 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 _0x713d=['express','Router','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713d,0x116));var _0xd713=function(_0x4d5857,_0x1aecb6){_0x4d5857=_0x4d5857-0x0;var _0x45d182=_0x713d[_0x4d5857];return _0x45d182;};'use strict';var multer=require('multer');var util=require(_0xd713('0x0'));var path=require('path');var timeout=require(_0xd713('0x1'));var express=require(_0xd713('0x2'));var router=express[_0xd713('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd713('0x4'));var config=require(_0xd713('0x5'));module[_0xd713('0x6')]=router; \ No newline at end of file +var _0xbe69=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','multer','util'];(function(_0x25e477,_0xc966e1){var _0x42e7a4=function(_0x1f5fb0){while(--_0x1f5fb0){_0x25e477['push'](_0x25e477['shift']());}};_0x42e7a4(++_0xc966e1);}(_0xbe69,0x16a));var _0x9be6=function(_0x7c29a0,_0x1e9b83){_0x7c29a0=_0x7c29a0-0x0;var _0x1288e9=_0xbe69[_0x7c29a0];return _0x1288e9;};'use strict';var multer=require(_0x9be6('0x0'));var util=require(_0x9be6('0x1'));var path=require('path');var timeout=require(_0x9be6('0x2'));var express=require(_0x9be6('0x3'));var router=express[_0x9be6('0x4')]();var auth=require(_0x9be6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9be6('0x6'));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 b0c3849..9325035 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 _0x98bf=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x452f24,_0x1d6264){var _0x283827=function(_0x19f3e2){while(--_0x19f3e2){_0x452f24['push'](_0x452f24['shift']());}};_0x283827(++_0x1d6264);}(_0x98bf,0x14d));var _0xf98b=function(_0xddcb6f,_0x34f5c1){_0xddcb6f=_0xddcb6f-0x0;var _0x22a491=_0x98bf[_0xddcb6f];return _0x22a491;};'use strict';var Sequelize=require(_0xf98b('0x0'));module['exports']={'description':{'type':Sequelize[_0xf98b('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xf98b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf98b('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf98b('0x3')]},'tls':{'type':Sequelize[_0xf98b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf98b('0x1')],'defaultValue':_0xf98b('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf98b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf98b('0x1')]}}; \ No newline at end of file +var _0x5774=['STRING','username','INTEGER','BOOLEAN','INBOX','sequelize','exports'];(function(_0x6e5c6d,_0x43c0d2){var _0x4d8106=function(_0x20774e){while(--_0x20774e){_0x6e5c6d['push'](_0x6e5c6d['shift']());}};_0x4d8106(++_0x43c0d2);}(_0x5774,0x140));var _0x4577=function(_0x14bbf9,_0x4cfe02){_0x14bbf9=_0x14bbf9-0x0;var _0x2bad61=_0x5774[_0x14bbf9];return _0x2bad61;};'use strict';var Sequelize=require(_0x4577('0x0'));module[_0x4577('0x1')]={'description':{'type':Sequelize[_0x4577('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x4577('0x3')},'password':{'type':Sequelize[_0x4577('0x2')]},'port':{'type':Sequelize[_0x4577('0x4')]},'tls':{'type':Sequelize[_0x4577('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4577('0x2')],'defaultValue':_0x4577('0x6')},'connTimeout':{'type':Sequelize[_0x4577('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4577('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4577('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9ed6718..08753bf 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 _0x4cc7=['exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes'];(function(_0x4446aa,_0x2d8caf){var _0x70224e=function(_0x16c21f){while(--_0x16c21f){_0x4446aa['push'](_0x4446aa['shift']());}};_0x70224e(++_0x2d8caf);}(_0x4cc7,0x1b6));var _0x74cc=function(_0xfdb2df,_0x5517ff){_0xfdb2df=_0xfdb2df-0x0;var _0x42dc28=_0x4cc7[_0xfdb2df];return _0x42dc28;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var logger=require(_0x74cc('0x2'))(_0x74cc('0x3'));var moment=require(_0x74cc('0x4'));var BPromise=require(_0x74cc('0x5'));var rp=require(_0x74cc('0x6'));var fs=require('fs');var path=require(_0x74cc('0x7'));var rimraf=require('rimraf');var config=require(_0x74cc('0x8'));var attributes=require(_0x74cc('0x9'));module[_0x74cc('0xa')]=function(_0x3b5d01,_0x225d38){return _0x3b5d01[_0x74cc('0xb')](_0x74cc('0xc'),attributes,{'tableName':_0x74cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x891b=['request-promise','path','rimraf','./mailServerIn.attributes','exports','../../config/logger','api','bluebird'];(function(_0x314350,_0x4433a0){var _0x2d9c1d=function(_0x2ca929){while(--_0x2ca929){_0x314350['push'](_0x314350['shift']());}};_0x2d9c1d(++_0x4433a0);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb891('0x0'))(_0xb891('0x1'));var moment=require('moment');var BPromise=require(_0xb891('0x2'));var rp=require(_0xb891('0x3'));var fs=require('fs');var path=require(_0xb891('0x4'));var rimraf=require(_0xb891('0x5'));var config=require('../../config/environment');var attributes=require(_0xb891('0x6'));module[_0xb891('0x7')]=function(_0x542400,_0x3635be){return _0x542400['define']('MailServerIn',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 42c205f..7306f83 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 _0xb8f1=['include','map','attributes','model','then','GetMailServerIn','stringify','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message','info','catch','MailServerIn','findAll','options','raw','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb8f1,0x89));var _0x1b8f=function(_0x1d6d9e,_0x48766d){_0x1d6d9e=_0x1d6d9e-0x0;var _0x2c56e1=_0xb8f1[_0x1d6d9e];return _0x2c56e1;};'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('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b8f('0x0'))(_0x1b8f('0x1'));var config=require(_0x1b8f('0x2'));var jayson=require(_0x1b8f('0x3'));var client=jayson[_0x1b8f('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14be8f,_0x348835,_0x22e81e){return new BPromise(function(_0x573a87,_0x52b9fc){return client[_0x1b8f('0x5')](_0x14be8f,_0x22e81e)['then'](function(_0x441217){logger['info']('MailServerIn,\x20%s,\x20%s',_0x348835,_0x1b8f('0x6'));logger[_0x1b8f('0x7')](_0x1b8f('0x8'),_0x348835,_0x1b8f('0x6'),JSON['stringify'](_0x441217));if(_0x441217[_0x1b8f('0x9')]){if(_0x441217['error']['code']===0x1f4){logger[_0x1b8f('0x9')](_0x1b8f('0xa'),_0x348835,_0x441217['error']['message']);return _0x52b9fc(_0x441217[_0x1b8f('0x9')]['message']);}logger[_0x1b8f('0x9')](_0x1b8f('0xa'),_0x348835,_0x441217[_0x1b8f('0x9')][_0x1b8f('0xb')]);return _0x573a87(_0x441217[_0x1b8f('0x9')][_0x1b8f('0xb')]);}else{logger[_0x1b8f('0xc')](_0x1b8f('0xa'),_0x348835,_0x1b8f('0x6'));_0x573a87(_0x441217['result'][_0x1b8f('0xb')]);}})[_0x1b8f('0xd')](function(_0x1fe104){logger['error'](_0x1b8f('0xa'),_0x348835,_0x1fe104);_0x52b9fc(_0x1fe104);});});}exports['GetMailServerIn']=function(_0x1434b2){var _0x59dd56=this;return new Promise(function(_0x271c1b,_0x51eea8){return db[_0x1b8f('0xe')][_0x1b8f('0xf')]({'raw':_0x1434b2['options']?_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x11')]===undefined?!![]:![]:!![],'where':_0x1434b2[_0x1b8f('0x10')]?_0x1434b2[_0x1b8f('0x10')]['where']||null:null,'attributes':_0x1434b2['options']?_0x1434b2['options']['attributes']||null:null,'limit':_0x1434b2['options']?_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x12')]||null:null,'include':_0x1434b2[_0x1b8f('0x10')]?_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x13')]?_[_0x1b8f('0x14')](_0x1434b2[_0x1b8f('0x10')][_0x1b8f('0x13')],function(_0x36e7c2){return{'model':db[_0x36e7c2['model']],'as':_0x36e7c2['as'],'attributes':_0x36e7c2[_0x1b8f('0x15')],'include':_0x36e7c2[_0x1b8f('0x13')]?_['map'](_0x36e7c2[_0x1b8f('0x13')],function(_0x3d5113){return{'model':db[_0x3d5113[_0x1b8f('0x16')]],'as':_0x3d5113['as'],'attributes':_0x3d5113[_0x1b8f('0x15')],'include':_0x3d5113[_0x1b8f('0x13')]?_[_0x1b8f('0x14')](_0x3d5113['include'],function(_0x2e8c90){return{'model':db[_0x2e8c90['model']],'as':_0x2e8c90['as'],'attributes':_0x2e8c90[_0x1b8f('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1b8f('0x17')](function(_0x43b96c){logger[_0x1b8f('0xc')](_0x1b8f('0x18'),_0x1434b2);logger['debug'](_0x1b8f('0x18'),_0x1434b2,JSON[_0x1b8f('0x19')](_0x43b96c));_0x271c1b(_0x43b96c);})[_0x1b8f('0xd')](function(_0x323575){logger['error'](_0x1b8f('0x18'),_0x323575[_0x1b8f('0xb')],_0x1434b2);_0x51eea8(_0x59dd56[_0x1b8f('0x9')](0x1f4,_0x323575['message']));});});}; \ No newline at end of file +var _0xa45a=['raw','limit','map','include','model','attributes','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xa45a,0xc2));var _0xaa45=function(_0x59fd95,_0x226b4c){_0x59fd95=_0x59fd95-0x0;var _0x998034=_0xa45a[_0x59fd95];return _0x998034;};'use strict';var _=require('lodash');var util=require(_0xaa45('0x0'));var moment=require(_0xaa45('0x1'));var BPromise=require(_0xaa45('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa45('0x3'));var db=require(_0xaa45('0x4'))['db'];var utils=require(_0xaa45('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa45('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaa45('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc78e,_0x229f1b,_0x243134){return new BPromise(function(_0x4a76a4,_0x5a059f){return client[_0xaa45('0x8')](_0x3cc78e,_0x243134)[_0xaa45('0x9')](function(_0x2ef059){logger[_0xaa45('0xa')](_0xaa45('0xb'),_0x229f1b,_0xaa45('0xc'));logger[_0xaa45('0xd')](_0xaa45('0xe'),_0x229f1b,_0xaa45('0xc'),JSON['stringify'](_0x2ef059));if(_0x2ef059[_0xaa45('0xf')]){if(_0x2ef059['error'][_0xaa45('0x10')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x229f1b,_0x2ef059[_0xaa45('0xf')][_0xaa45('0x11')]);return _0x5a059f(_0x2ef059['error'][_0xaa45('0x11')]);}logger[_0xaa45('0xf')](_0xaa45('0xb'),_0x229f1b,_0x2ef059[_0xaa45('0xf')]['message']);return _0x4a76a4(_0x2ef059['error'][_0xaa45('0x11')]);}else{logger[_0xaa45('0xa')](_0xaa45('0xb'),_0x229f1b,_0xaa45('0xc'));_0x4a76a4(_0x2ef059[_0xaa45('0x12')][_0xaa45('0x11')]);}})['catch'](function(_0x116ffc){logger[_0xaa45('0xf')]('MailServerIn,\x20%s,\x20%s',_0x229f1b,_0x116ffc);_0x5a059f(_0x116ffc);});});}exports[_0xaa45('0x13')]=function(_0x2b5894){var _0xca8dad=this;return new Promise(function(_0xa8e191,_0x1a587f){return db[_0xaa45('0x14')][_0xaa45('0x15')]({'raw':_0x2b5894['options']?_0x2b5894[_0xaa45('0x16')][_0xaa45('0x17')]===undefined?!![]:![]:!![],'where':_0x2b5894[_0xaa45('0x16')]?_0x2b5894[_0xaa45('0x16')]['where']||null:null,'attributes':_0x2b5894[_0xaa45('0x16')]?_0x2b5894[_0xaa45('0x16')]['attributes']||null:null,'limit':_0x2b5894[_0xaa45('0x16')]?_0x2b5894[_0xaa45('0x16')][_0xaa45('0x18')]||null:null,'include':_0x2b5894['options']?_0x2b5894[_0xaa45('0x16')]['include']?_[_0xaa45('0x19')](_0x2b5894[_0xaa45('0x16')][_0xaa45('0x1a')],function(_0x21887e){return{'model':db[_0x21887e[_0xaa45('0x1b')]],'as':_0x21887e['as'],'attributes':_0x21887e[_0xaa45('0x1c')],'include':_0x21887e['include']?_[_0xaa45('0x19')](_0x21887e['include'],function(_0x54be94){return{'model':db[_0x54be94[_0xaa45('0x1b')]],'as':_0x54be94['as'],'attributes':_0x54be94[_0xaa45('0x1c')],'include':_0x54be94[_0xaa45('0x1a')]?_['map'](_0x54be94['include'],function(_0x4fe2ae){return{'model':db[_0x4fe2ae['model']],'as':_0x4fe2ae['as'],'attributes':_0x4fe2ae[_0xaa45('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x164abc){logger[_0xaa45('0xa')](_0xaa45('0x13'),_0x2b5894);logger[_0xaa45('0xd')](_0xaa45('0x13'),_0x2b5894,JSON[_0xaa45('0x1d')](_0x164abc));_0xa8e191(_0x164abc);})[_0xaa45('0x1e')](function(_0x527f8d){logger[_0xaa45('0xf')](_0xaa45('0x13'),_0x527f8d[_0xaa45('0x11')],_0x2b5894);_0x1a587f(_0xca8dad[_0xaa45('0xf')](0x1f4,_0x527f8d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8a86e34..5b3d2d7 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 _0xa3a0=['post','create','put','delete','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show'];(function(_0x534e28,_0x28d3d8){var _0x43276a=function(_0x143ef5){while(--_0x143ef5){_0x534e28['push'](_0x534e28['shift']());}};_0x43276a(++_0x28d3d8);}(_0xa3a0,0x145));var _0x0a3a=function(_0x1ea8fc,_0x522c8f){_0x1ea8fc=_0x1ea8fc-0x0;var _0x432b05=_0xa3a0[_0x1ea8fc];return _0x432b05;};'use strict';var multer=require(_0x0a3a('0x0'));var util=require(_0x0a3a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a3a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a3a('0x3'));var config=require(_0x0a3a('0x4'));var controller=require(_0x0a3a('0x5'));router[_0x0a3a('0x6')]('/',auth[_0x0a3a('0x7')](),controller[_0x0a3a('0x8')]);router[_0x0a3a('0x6')](_0x0a3a('0x9'),auth[_0x0a3a('0x7')](),controller[_0x0a3a('0xa')]);router[_0x0a3a('0xb')]('/',auth[_0x0a3a('0x7')](),controller[_0x0a3a('0xc')]);router[_0x0a3a('0xd')](_0x0a3a('0x9'),auth[_0x0a3a('0x7')](),controller['update']);router[_0x0a3a('0xe')]('/:id',auth[_0x0a3a('0x7')](),controller['destroy']);module[_0x0a3a('0xf')]=router; \ No newline at end of file +var _0x7425=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','post','create','/:id','update','exports','util','path','connect-timeout','express'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x7425,0xd9));var _0x5742=function(_0x4fb862,_0x58cde2){_0x4fb862=_0x4fb862-0x0;var _0x3a3d45=_0x7425[_0x4fb862];return _0x3a3d45;};'use strict';var multer=require('multer');var util=require(_0x5742('0x0'));var path=require(_0x5742('0x1'));var timeout=require(_0x5742('0x2'));var express=require(_0x5742('0x3'));var router=express[_0x5742('0x4')]();var auth=require(_0x5742('0x5'));var interaction=require(_0x5742('0x6'));var config=require(_0x5742('0x7'));var controller=require(_0x5742('0x8'));router['get']('/',auth[_0x5742('0x9')](),controller[_0x5742('0xa')]);router[_0x5742('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5742('0xc')]('/',auth[_0x5742('0x9')](),controller[_0x5742('0xd')]);router['put'](_0x5742('0xe'),auth[_0x5742('0x9')](),controller[_0x5742('0xf')]);router['delete']('/:id',auth[_0x5742('0x9')](),controller['destroy']);module[_0x5742('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 9c9a44d..f751293 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 _0xb7ac=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x4a2d29,_0xc009f5){var _0x3a3128=function(_0x45933f){while(--_0x45933f){_0x4a2d29['push'](_0x4a2d29['shift']());}};_0x3a3128(++_0xc009f5);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x35a9b3,_0x748661){_0x35a9b3=_0x35a9b3-0x0;var _0x2c3c4d=_0xb7ac[_0x35a9b3];return _0x2c3c4d;};'use strict';var Sequelize=require(_0xcb7a('0x0'));module[_0xcb7a('0x1')]={'description':{'type':Sequelize[_0xcb7a('0x2')]},'host':{'type':Sequelize[_0xcb7a('0x2')]},'user':{'type':Sequelize[_0xcb7a('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xcb7a('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xcb7a('0x2')]},'authentication':{'type':Sequelize[_0xcb7a('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x644f=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x53506c,_0x5cd283){var _0x5aa537=function(_0x354142){while(--_0x354142){_0x53506c['push'](_0x53506c['shift']());}};_0x5aa537(++_0x5cd283);}(_0x644f,0xc2));var _0xf644=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x644f[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require(_0xf644('0x0'));module[_0xf644('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xf644('0x2')]},'pass':{'type':Sequelize[_0xf644('0x2')]},'port':{'type':Sequelize[_0xf644('0x3')]},'secure':{'type':Sequelize[_0xf644('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xf644('0x2')]},'authentication':{'type':Sequelize[_0xf644('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7b555c1..3a79458 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 _0xd09d=['save','update','destroy','then','name','send','index','MailServerOut','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','findAll','rows','show','length','options','find','create','body','catch','params','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','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x522aa2,_0x48a2e6){var _0x1ed063=function(_0x421a64){while(--_0x421a64){_0x522aa2['push'](_0x522aa2['shift']());}};_0x1ed063(++_0x48a2e6);}(_0xd09d,0x6d));var _0xdd09=function(_0x3e53f1,_0x1c2930){_0x3e53f1=_0x3e53f1-0x0;var _0x3414fd=_0xd09d[_0x3e53f1];return _0x3414fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd09('0x0'));var rimraf=require(_0xdd09('0x1'));var zipdir=require(_0xdd09('0x2'));var jsonpatch=require(_0xdd09('0x3'));var rp=require(_0xdd09('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd09('0x5'));var util=require(_0xdd09('0x6'));var path=require(_0xdd09('0x7'));var sox=require(_0xdd09('0x8'));var csv=require(_0xdd09('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd09('0xa'));var squel=require(_0xdd09('0xb'));var crypto=require(_0xdd09('0xc'));var jsforce=require(_0xdd09('0xd'));var deskjs=require(_0xdd09('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd09('0xf'));var Papa=require(_0xdd09('0x10'));var Redis=require(_0xdd09('0x11'));var authService=require(_0xdd09('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd09('0x13'));var hardwareService=require(_0xdd09('0x14'));var logger=require(_0xdd09('0x15'))(_0xdd09('0x16'));var utils=require(_0xdd09('0x17'));var config=require('../../config/environment');var db=require(_0xdd09('0x18'))['db'];function respondWithStatusCode(_0x503e9e,_0x5d09c7){_0x5d09c7=_0x5d09c7||0xcc;return function(_0xcf67ef){if(_0xcf67ef){return _0x503e9e['sendStatus'](_0x5d09c7);}return _0x503e9e[_0xdd09('0x19')](_0x5d09c7)[_0xdd09('0x1a')]();};}function respondWithResult(_0x3cbc9e,_0x4e4806){_0x4e4806=_0x4e4806||0xc8;return function(_0x1079ef){if(_0x1079ef){return _0x3cbc9e[_0xdd09('0x19')](_0x4e4806)[_0xdd09('0x1b')](_0x1079ef);}};}function respondWithFilteredResult(_0x2cc2bd,_0x37cc3c){return function(_0x2cceb5){if(_0x2cceb5){var _0x2d4fcb=_0x2cceb5[_0xdd09('0x1c')],_0x4fe8bf=_0x37cc3c['offset'],_0x1c7845=_0x37cc3c[_0xdd09('0x1d')]+_0x37cc3c[_0xdd09('0x1e')],_0x265411;if(_0x1c7845>=_0x2d4fcb){_0x1c7845=_0x2d4fcb;_0x265411=0xc8;}else{_0x265411=0xce;}_0x2cc2bd['status'](_0x265411);return _0x2cc2bd[_0xdd09('0x1f')](_0xdd09('0x20'),_0x4fe8bf+'-'+_0x1c7845+'/'+_0x2d4fcb)[_0xdd09('0x1b')](_0x2cceb5);}return null;};}function patchUpdates(_0x3aef38){return function(_0x26d5db){try{jsonpatch[_0xdd09('0x21')](_0x26d5db,_0x3aef38,!![]);}catch(_0x570758){return BPromise[_0xdd09('0x22')](_0x570758);}return _0x26d5db[_0xdd09('0x23')]();};}function saveUpdates(_0x14dee6,_0x44718f){return function(_0x330e63){if(_0x330e63){return _0x330e63[_0xdd09('0x24')](_0x14dee6)['then'](function(_0x264c10){return _0x264c10;});}return null;};}function removeEntity(_0x48d22e,_0xb6a0bb){return function(_0x57a069){if(_0x57a069){return _0x57a069[_0xdd09('0x25')]()[_0xdd09('0x26')](function(){_0x48d22e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff649,_0x4ed3ff){return function(_0x4b8a29){if(!_0x4b8a29){_0x2ff649['sendStatus'](0x194);}return _0x4b8a29;};}function handleError(_0x436d88,_0x418aed){_0x418aed=_0x418aed||0x1f4;return function(_0x13236c){logger['error'](_0x13236c['stack']);if(_0x13236c[_0xdd09('0x27')]){delete _0x13236c['name'];}_0x436d88[_0xdd09('0x19')](_0x418aed)[_0xdd09('0x28')](_0x13236c);};}exports[_0xdd09('0x29')]=function(_0x589073,_0xcd22e3){var _0x514b7c={},_0x111511={},_0x306ac7={'count':0x0,'rows':[]};var _0x4ab119=_['map'](db[_0xdd09('0x2a')][_0xdd09('0x2b')],function(_0x544328){return{'name':_0x544328['fieldName'],'type':_0x544328['type'][_0xdd09('0x2c')]};});_0x111511['model']=_[_0xdd09('0x2d')](_0x4ab119,_0xdd09('0x27'));_0x111511[_0xdd09('0x2e')]=_[_0xdd09('0x2f')](_0x589073[_0xdd09('0x2e')]);_0x111511[_0xdd09('0x30')]=_[_0xdd09('0x31')](_0x111511[_0xdd09('0x32')],_0x111511[_0xdd09('0x2e')]);_0x514b7c[_0xdd09('0x33')]=_[_0xdd09('0x31')](_0x111511[_0xdd09('0x32')],qs[_0xdd09('0x34')](_0x589073['query'][_0xdd09('0x34')]));_0x514b7c[_0xdd09('0x33')]=_0x514b7c[_0xdd09('0x33')]['length']?_0x514b7c[_0xdd09('0x33')]:_0x111511[_0xdd09('0x32')];if(!_0x589073[_0xdd09('0x2e')][_0xdd09('0x35')](_0xdd09('0x36'))){_0x514b7c[_0xdd09('0x1e')]=qs[_0xdd09('0x1e')](_0x589073['query'][_0xdd09('0x1e')]);_0x514b7c[_0xdd09('0x1d')]=qs[_0xdd09('0x1d')](_0x589073['query']['offset']);}_0x514b7c[_0xdd09('0x37')]=qs[_0xdd09('0x38')](_0x589073['query']['sort']);_0x514b7c[_0xdd09('0x39')]=qs[_0xdd09('0x30')](_['pick'](_0x589073['query'],_0x111511[_0xdd09('0x30')]),_0x4ab119);if(_0x589073['query']['filter']){_0x514b7c['where']=_['merge'](_0x514b7c['where'],{'$or':_['map'](_0x4ab119,function(_0x2f2740){if(_0x2f2740[_0xdd09('0x3a')]!==_0xdd09('0x3b')){var _0x110cb2={};_0x110cb2[_0x2f2740[_0xdd09('0x27')]]={'$like':'%'+_0x589073[_0xdd09('0x2e')][_0xdd09('0x3c')]+'%'};return _0x110cb2;}})});}_0x514b7c=_[_0xdd09('0x3d')]({},_0x514b7c,_0x589073['options']);var _0x40b8b1={'where':_0x514b7c[_0xdd09('0x39')]};return db['MailServerOut']['count'](_0x40b8b1)[_0xdd09('0x26')](function(_0x54e0e2){_0x306ac7[_0xdd09('0x1c')]=_0x54e0e2;if(_0x589073[_0xdd09('0x2e')]['includeAll']){_0x514b7c['include']=[{'all':!![]}];}return db['MailServerOut'][_0xdd09('0x3e')](_0x514b7c);})[_0xdd09('0x26')](function(_0xa761bb){_0x306ac7[_0xdd09('0x3f')]=_0xa761bb;return _0x306ac7;})['then'](respondWithFilteredResult(_0xcd22e3,_0x514b7c))['catch'](handleError(_0xcd22e3,null));};exports[_0xdd09('0x40')]=function(_0x42d2a6,_0x4777f2){var _0x2db4de={'raw':!![],'where':{'id':_0x42d2a6['params']['id']}},_0x2cd349={};_0x2cd349[_0xdd09('0x32')]=_['keys'](db[_0xdd09('0x2a')][_0xdd09('0x2b')]);_0x2cd349['query']=_[_0xdd09('0x2f')](_0x42d2a6[_0xdd09('0x2e')]);_0x2cd349['filters']=_[_0xdd09('0x31')](_0x2cd349['model'],_0x2cd349['query']);_0x2db4de[_0xdd09('0x33')]=_['intersection'](_0x2cd349[_0xdd09('0x32')],qs[_0xdd09('0x34')](_0x42d2a6[_0xdd09('0x2e')][_0xdd09('0x34')]));_0x2db4de['attributes']=_0x2db4de['attributes'][_0xdd09('0x41')]?_0x2db4de[_0xdd09('0x33')]:_0x2cd349['model'];if(_0x42d2a6[_0xdd09('0x2e')]['includeAll']){_0x2db4de['include']=[{'all':!![]}];}_0x2db4de=_['merge']({},_0x2db4de,_0x42d2a6[_0xdd09('0x42')]);return db[_0xdd09('0x2a')][_0xdd09('0x43')](_0x2db4de)[_0xdd09('0x26')](handleEntityNotFound(_0x4777f2,null))['then'](respondWithResult(_0x4777f2,null))['catch'](handleError(_0x4777f2,null));};exports[_0xdd09('0x44')]=function(_0x3e6f00,_0x1745ac){return db[_0xdd09('0x2a')]['create'](_0x3e6f00[_0xdd09('0x45')],{})['then'](respondWithResult(_0x1745ac,0xc9))[_0xdd09('0x46')](handleError(_0x1745ac,null));};exports[_0xdd09('0x24')]=function(_0x2a5646,_0xb8b1a4){if(_0x2a5646['body']['id']){delete _0x2a5646[_0xdd09('0x45')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x2a5646[_0xdd09('0x47')]['id']}})[_0xdd09('0x26')](handleEntityNotFound(_0xb8b1a4,null))['then'](saveUpdates(_0x2a5646[_0xdd09('0x45')],null))[_0xdd09('0x26')](respondWithResult(_0xb8b1a4,null))[_0xdd09('0x46')](handleError(_0xb8b1a4,null));};exports[_0xdd09('0x25')]=function(_0x306886,_0x2498e2){return db['MailServerOut']['find']({'where':{'id':_0x306886['params']['id']}})[_0xdd09('0x26')](handleEntityNotFound(_0x2498e2,null))[_0xdd09('0x26')](removeEntity(_0x2498e2,null))[_0xdd09('0x46')](handleError(_0x2498e2,null));}; \ No newline at end of file +var _0x954f=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','show','params','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','send','index','map','MailServerOut','rawAttributes','type','key','model','name'];(function(_0x5e9693,_0x1eb992){var _0x5163e8=function(_0x1cc6a5){while(--_0x1cc6a5){_0x5e9693['push'](_0x5e9693['shift']());}};_0x5163e8(++_0x1eb992);}(_0x954f,0xdc));var _0xf954=function(_0x4a0df6,_0x46de51){_0x4a0df6=_0x4a0df6-0x0;var _0x5a603f=_0x954f[_0x4a0df6];return _0x5a603f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf954('0x0'));var rimraf=require(_0xf954('0x1'));var zipdir=require(_0xf954('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf954('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf954('0x4'));var util=require(_0xf954('0x5'));var path=require(_0xf954('0x6'));var sox=require(_0xf954('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf954('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xf954('0x9'));var querystring=require(_0xf954('0xa'));var Papa=require(_0xf954('0xb'));var Redis=require(_0xf954('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf954('0xd'));var logger=require('../../config/logger')(_0xf954('0xe'));var utils=require(_0xf954('0xf'));var config=require('../../config/environment');var db=require(_0xf954('0x10'))['db'];function respondWithStatusCode(_0x1032d2,_0x511a35){_0x511a35=_0x511a35||0xcc;return function(_0x57356b){if(_0x57356b){return _0x1032d2[_0xf954('0x11')](_0x511a35);}return _0x1032d2[_0xf954('0x12')](_0x511a35)['end']();};}function respondWithResult(_0x4b45f8,_0x448633){_0x448633=_0x448633||0xc8;return function(_0x2c2907){if(_0x2c2907){return _0x4b45f8['status'](_0x448633)[_0xf954('0x13')](_0x2c2907);}};}function respondWithFilteredResult(_0x4a1a5a,_0x43f3f5){return function(_0x435bcc){if(_0x435bcc){var _0x5693eb=_0x435bcc[_0xf954('0x14')],_0x32eb8e=_0x43f3f5[_0xf954('0x15')],_0x2fcfc8=_0x43f3f5[_0xf954('0x15')]+_0x43f3f5[_0xf954('0x16')],_0x38d3f3;if(_0x2fcfc8>=_0x5693eb){_0x2fcfc8=_0x5693eb;_0x38d3f3=0xc8;}else{_0x38d3f3=0xce;}_0x4a1a5a[_0xf954('0x12')](_0x38d3f3);return _0x4a1a5a[_0xf954('0x17')](_0xf954('0x18'),_0x32eb8e+'-'+_0x2fcfc8+'/'+_0x5693eb)[_0xf954('0x13')](_0x435bcc);}return null;};}function patchUpdates(_0x5a1c35){return function(_0x1eda66){try{jsonpatch[_0xf954('0x19')](_0x1eda66,_0x5a1c35,!![]);}catch(_0x40d987){return BPromise[_0xf954('0x1a')](_0x40d987);}return _0x1eda66[_0xf954('0x1b')]();};}function saveUpdates(_0x4549e1,_0x326da6){return function(_0x35a3f6){if(_0x35a3f6){return _0x35a3f6['update'](_0x4549e1)['then'](function(_0x3243d5){return _0x3243d5;});}return null;};}function removeEntity(_0x2825cb,_0x20f5c0){return function(_0x57bf85){if(_0x57bf85){return _0x57bf85[_0xf954('0x1c')]()[_0xf954('0x1d')](function(){_0x2825cb[_0xf954('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22eb6d,_0x481594){return function(_0x5dae5b){if(!_0x5dae5b){_0x22eb6d[_0xf954('0x11')](0x194);}return _0x5dae5b;};}function handleError(_0x4e327b,_0xf574f4){_0xf574f4=_0xf574f4||0x1f4;return function(_0x42d28f){logger['error'](_0x42d28f[_0xf954('0x1e')]);if(_0x42d28f['name']){delete _0x42d28f['name'];}_0x4e327b[_0xf954('0x12')](_0xf574f4)[_0xf954('0x1f')](_0x42d28f);};}exports[_0xf954('0x20')]=function(_0x1ce16d,_0x185ef0){var _0x5900a8={},_0x447e6a={},_0x37ecfa={'count':0x0,'rows':[]};var _0x5dcf49=_[_0xf954('0x21')](db[_0xf954('0x22')][_0xf954('0x23')],function(_0x52b808){return{'name':_0x52b808['fieldName'],'type':_0x52b808[_0xf954('0x24')][_0xf954('0x25')]};});_0x447e6a[_0xf954('0x26')]=_['map'](_0x5dcf49,_0xf954('0x27'));_0x447e6a[_0xf954('0x28')]=_[_0xf954('0x29')](_0x1ce16d[_0xf954('0x28')]);_0x447e6a[_0xf954('0x2a')]=_[_0xf954('0x2b')](_0x447e6a[_0xf954('0x26')],_0x447e6a[_0xf954('0x28')]);_0x5900a8['attributes']=_[_0xf954('0x2b')](_0x447e6a[_0xf954('0x26')],qs[_0xf954('0x2c')](_0x1ce16d[_0xf954('0x28')][_0xf954('0x2c')]));_0x5900a8[_0xf954('0x2d')]=_0x5900a8[_0xf954('0x2d')][_0xf954('0x2e')]?_0x5900a8['attributes']:_0x447e6a['model'];if(!_0x1ce16d[_0xf954('0x28')][_0xf954('0x2f')]('nolimit')){_0x5900a8['limit']=qs['limit'](_0x1ce16d[_0xf954('0x28')][_0xf954('0x16')]);_0x5900a8[_0xf954('0x15')]=qs[_0xf954('0x15')](_0x1ce16d[_0xf954('0x28')][_0xf954('0x15')]);}_0x5900a8[_0xf954('0x30')]=qs[_0xf954('0x31')](_0x1ce16d[_0xf954('0x28')][_0xf954('0x31')]);_0x5900a8[_0xf954('0x32')]=qs[_0xf954('0x2a')](_[_0xf954('0x33')](_0x1ce16d[_0xf954('0x28')],_0x447e6a[_0xf954('0x2a')]),_0x5dcf49);if(_0x1ce16d[_0xf954('0x28')]['filter']){_0x5900a8[_0xf954('0x32')]=_[_0xf954('0x34')](_0x5900a8[_0xf954('0x32')],{'$or':_[_0xf954('0x21')](_0x5dcf49,function(_0x568794){if(_0x568794[_0xf954('0x24')]!==_0xf954('0x35')){var _0x3b2cdc={};_0x3b2cdc[_0x568794['name']]={'$like':'%'+_0x1ce16d['query'][_0xf954('0x36')]+'%'};return _0x3b2cdc;}})});}_0x5900a8=_[_0xf954('0x34')]({},_0x5900a8,_0x1ce16d['options']);var _0x557fa2={'where':_0x5900a8['where']};return db[_0xf954('0x22')][_0xf954('0x14')](_0x557fa2)['then'](function(_0x9c8b1c){_0x37ecfa[_0xf954('0x14')]=_0x9c8b1c;if(_0x1ce16d['query'][_0xf954('0x37')]){_0x5900a8[_0xf954('0x38')]=[{'all':!![]}];}return db[_0xf954('0x22')]['findAll'](_0x5900a8);})[_0xf954('0x1d')](function(_0x43a531){_0x37ecfa['rows']=_0x43a531;return _0x37ecfa;})[_0xf954('0x1d')](respondWithFilteredResult(_0x185ef0,_0x5900a8))['catch'](handleError(_0x185ef0,null));};exports[_0xf954('0x39')]=function(_0x5ef249,_0x4dbbc8){var _0x4600e1={'raw':!![],'where':{'id':_0x5ef249[_0xf954('0x3a')]['id']}},_0x43a5da={};_0x43a5da['model']=_[_0xf954('0x29')](db[_0xf954('0x22')][_0xf954('0x23')]);_0x43a5da[_0xf954('0x28')]=_[_0xf954('0x29')](_0x5ef249[_0xf954('0x28')]);_0x43a5da[_0xf954('0x2a')]=_[_0xf954('0x2b')](_0x43a5da[_0xf954('0x26')],_0x43a5da[_0xf954('0x28')]);_0x4600e1['attributes']=_[_0xf954('0x2b')](_0x43a5da[_0xf954('0x26')],qs[_0xf954('0x2c')](_0x5ef249['query'][_0xf954('0x2c')]));_0x4600e1['attributes']=_0x4600e1[_0xf954('0x2d')]['length']?_0x4600e1[_0xf954('0x2d')]:_0x43a5da[_0xf954('0x26')];if(_0x5ef249['query'][_0xf954('0x37')]){_0x4600e1[_0xf954('0x38')]=[{'all':!![]}];}_0x4600e1=_[_0xf954('0x34')]({},_0x4600e1,_0x5ef249[_0xf954('0x3b')]);return db[_0xf954('0x22')]['find'](_0x4600e1)['then'](handleEntityNotFound(_0x4dbbc8,null))[_0xf954('0x1d')](respondWithResult(_0x4dbbc8,null))[_0xf954('0x3c')](handleError(_0x4dbbc8,null));};exports[_0xf954('0x3d')]=function(_0x1b4f37,_0x3a23fd){return db[_0xf954('0x22')][_0xf954('0x3d')](_0x1b4f37[_0xf954('0x3e')],{})[_0xf954('0x1d')](respondWithResult(_0x3a23fd,0xc9))[_0xf954('0x3c')](handleError(_0x3a23fd,null));};exports[_0xf954('0x3f')]=function(_0x16f083,_0x40cd43){if(_0x16f083[_0xf954('0x3e')]['id']){delete _0x16f083[_0xf954('0x3e')]['id'];}return db['MailServerOut'][_0xf954('0x40')]({'where':{'id':_0x16f083[_0xf954('0x3a')]['id']}})[_0xf954('0x1d')](handleEntityNotFound(_0x40cd43,null))[_0xf954('0x1d')](saveUpdates(_0x16f083[_0xf954('0x3e')],null))[_0xf954('0x1d')](respondWithResult(_0x40cd43,null))[_0xf954('0x3c')](handleError(_0x40cd43,null));};exports['destroy']=function(_0x28a6c9,_0x31b94b){return db[_0xf954('0x22')][_0xf954('0x40')]({'where':{'id':_0x28a6c9[_0xf954('0x3a')]['id']}})['then'](handleEntityNotFound(_0x31b94b,null))[_0xf954('0x1d')](removeEntity(_0x31b94b,null))[_0xf954('0x3c')](handleError(_0x31b94b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6a5f41f..7061996 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 _0x6842=['MailServerOut','mail_servers_out','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6842,0x91));var _0x2684=function(_0x11e1bc,_0x5262bf){_0x11e1bc=_0x11e1bc-0x0;var _0x42861c=_0x6842[_0x11e1bc];return _0x42861c;};'use strict';var _=require(_0x2684('0x0'));var util=require(_0x2684('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2684('0x2'));var BPromise=require(_0x2684('0x3'));var rp=require(_0x2684('0x4'));var fs=require('fs');var path=require(_0x2684('0x5'));var rimraf=require('rimraf');var config=require(_0x2684('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x2684('0x7')]=function(_0x2c98ec,_0x2d59d3){return _0x2c98ec[_0x2684('0x8')](_0x2684('0x9'),attributes,{'tableName':_0x2684('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f61=['MailServerOut','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','define'];(function(_0x4151b4,_0x2ba766){var _0xd8cf9=function(_0x275f06){while(--_0x275f06){_0x4151b4['push'](_0x4151b4['shift']());}};_0xd8cf9(++_0x2ba766);}(_0x2f61,0x181));var _0x12f6=function(_0x481ed9,_0x191060){_0x481ed9=_0x481ed9-0x0;var _0x5abb22=_0x2f61[_0x481ed9];return _0x5abb22;};'use strict';var _=require('lodash');var util=require(_0x12f6('0x0'));var logger=require(_0x12f6('0x1'))(_0x12f6('0x2'));var moment=require(_0x12f6('0x3'));var BPromise=require(_0x12f6('0x4'));var rp=require(_0x12f6('0x5'));var fs=require('fs');var path=require(_0x12f6('0x6'));var rimraf=require(_0x12f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x12f6('0x8'));module[_0x12f6('0x9')]=function(_0x2f8f9b,_0x11651c){return _0x2f8f9b[_0x12f6('0xa')](_0x12f6('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 7d38926..1951adf 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 _0x2848=['MailServerOut,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','http','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32e836,_0x2ee781){var _0x1dc909=function(_0x594851){while(--_0x594851){_0x32e836['push'](_0x32e836['shift']());}};_0x1dc909(++_0x2ee781);}(_0x2848,0x147));var _0x8284=function(_0x55624b,_0x150b16){_0x55624b=_0x55624b-0x0;var _0x4e6e1a=_0x2848[_0x55624b];return _0x4e6e1a;};'use strict';var _=require(_0x8284('0x0'));var util=require('util');var moment=require(_0x8284('0x1'));var BPromise=require(_0x8284('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8284('0x3'))['db'];var utils=require(_0x8284('0x4'));var logger=require('../../config/logger')(_0x8284('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8284('0x6')][_0x8284('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x412c7e,_0x270781,_0x56cd17){return new BPromise(function(_0x2574dd,_0x198fd6){return client['request'](_0x412c7e,_0x56cd17)[_0x8284('0x8')](function(_0x27380c){logger[_0x8284('0x9')]('MailServerOut,\x20%s,\x20%s',_0x270781,_0x8284('0xa'));logger[_0x8284('0xb')](_0x8284('0xc'),_0x270781,'request\x20sent',JSON[_0x8284('0xd')](_0x27380c));if(_0x27380c[_0x8284('0xe')]){if(_0x27380c[_0x8284('0xe')]['code']===0x1f4){logger[_0x8284('0xe')](_0x8284('0xf'),_0x270781,_0x27380c[_0x8284('0xe')]['message']);return _0x198fd6(_0x27380c[_0x8284('0xe')]['message']);}logger[_0x8284('0xe')](_0x8284('0xf'),_0x270781,_0x27380c[_0x8284('0xe')]['message']);return _0x2574dd(_0x27380c[_0x8284('0xe')][_0x8284('0x10')]);}else{logger[_0x8284('0x9')]('MailServerOut,\x20%s,\x20%s',_0x270781,_0x8284('0xa'));_0x2574dd(_0x27380c[_0x8284('0x11')][_0x8284('0x10')]);}})[_0x8284('0x12')](function(_0x336634){logger[_0x8284('0xe')](_0x8284('0xf'),_0x270781,_0x336634);_0x198fd6(_0x336634);});});} \ No newline at end of file +var _0xc54c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0xc54c,0xbd));var _0xcc54=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xc54c[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcc54('0x0'));var rs=require(_0xcc54('0x1'));var fs=require('fs');var Redis=require(_0xcc54('0x2'));var db=require(_0xcc54('0x3'))['db'];var utils=require(_0xcc54('0x4'));var logger=require(_0xcc54('0x5'))(_0xcc54('0x6'));var config=require(_0xcc54('0x7'));var jayson=require(_0xcc54('0x8'));var client=jayson[_0xcc54('0x9')][_0xcc54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e4cf,_0x4047be,_0x54e729){return new BPromise(function(_0x28ef88,_0x4b0c00){return client[_0xcc54('0xb')](_0x27e4cf,_0x54e729)[_0xcc54('0xc')](function(_0x1d5f95){logger[_0xcc54('0xd')](_0xcc54('0xe'),_0x4047be,_0xcc54('0xf'));logger[_0xcc54('0x10')](_0xcc54('0x11'),_0x4047be,_0xcc54('0xf'),JSON[_0xcc54('0x12')](_0x1d5f95));if(_0x1d5f95[_0xcc54('0x13')]){if(_0x1d5f95[_0xcc54('0x13')][_0xcc54('0x14')]===0x1f4){logger[_0xcc54('0x13')](_0xcc54('0xe'),_0x4047be,_0x1d5f95['error'][_0xcc54('0x15')]);return _0x4b0c00(_0x1d5f95[_0xcc54('0x13')]['message']);}logger['error'](_0xcc54('0xe'),_0x4047be,_0x1d5f95[_0xcc54('0x13')][_0xcc54('0x15')]);return _0x28ef88(_0x1d5f95['error'][_0xcc54('0x15')]);}else{logger['info'](_0xcc54('0xe'),_0x4047be,_0xcc54('0xf'));_0x28ef88(_0x1d5f95[_0xcc54('0x16')]['message']);}})[_0xcc54('0x17')](function(_0x301f1a){logger[_0xcc54('0x13')](_0xcc54('0xe'),_0x4047be,_0x301f1a);_0x4b0c00(_0x301f1a);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a90ddac..16903ee 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 _0x147a=['get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller'];(function(_0xbd9ec9,_0x195a3d){var _0x162a75=function(_0x4edac2){while(--_0x4edac2){_0xbd9ec9['push'](_0xbd9ec9['shift']());}};_0x162a75(++_0x195a3d);}(_0x147a,0x1c5));var _0xa147=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x147a[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xa147('0x0'));var util=require(_0xa147('0x1'));var path=require(_0xa147('0x2'));var timeout=require(_0xa147('0x3'));var express=require(_0xa147('0x4'));var router=express[_0xa147('0x5')]();var auth=require(_0xa147('0x6'));var interaction=require(_0xa147('0x7'));var config=require('../../config/environment');var controller=require(_0xa147('0x8'));router[_0xa147('0x9')]('/',auth[_0xa147('0xa')](),controller[_0xa147('0xb')]);router['get'](_0xa147('0xc'),auth[_0xa147('0xa')](),controller[_0xa147('0xd')]);router[_0xa147('0x9')]('/:id',auth[_0xa147('0xa')](),controller[_0xa147('0xe')]);router['post']('/',auth[_0xa147('0xa')](),controller['create']);router[_0xa147('0xf')](_0xa147('0x10'),auth[_0xa147('0xa')](),controller[_0xa147('0x11')]);router[_0xa147('0x12')](_0xa147('0x10'),auth[_0xa147('0xa')](),controller[_0xa147('0x13')]);module[_0xa147('0x14')]=router; \ No newline at end of file +var _0x2679=['show','create','put','update','multer','util','connect-timeout','express','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x6d08c4,_0x1f98ab){var _0xaf82df=function(_0x4d3571){while(--_0x4d3571){_0x6d08c4['push'](_0x6d08c4['shift']());}};_0xaf82df(++_0x1f98ab);}(_0x2679,0x124));var _0x9267=function(_0x1213eb,_0x254d44){_0x1213eb=_0x1213eb-0x0;var _0x1cb4bb=_0x2679[_0x1213eb];return _0x1cb4bb;};'use strict';var multer=require(_0x9267('0x0'));var util=require(_0x9267('0x1'));var path=require('path');var timeout=require(_0x9267('0x2'));var express=require(_0x9267('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9267('0x4'));var config=require('../../config/environment');var controller=require(_0x9267('0x5'));router[_0x9267('0x6')]('/',auth[_0x9267('0x7')](),controller[_0x9267('0x8')]);router[_0x9267('0x6')](_0x9267('0x9'),auth['isAuthenticated'](),controller[_0x9267('0xa')]);router['get'](_0x9267('0xb'),auth[_0x9267('0x7')](),controller[_0x9267('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9267('0xd')]);router[_0x9267('0xe')]('/:id',auth[_0x9267('0x7')](),controller[_0x9267('0xf')]);router['delete'](_0x9267('0xb'),auth[_0x9267('0x7')](),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 c8fb184..e5c64f3 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 _0x1f81=['exports','name','STRING','sequelize'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x1f81,0xab));var _0x11f8=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x1f81[_0x2e249d];return _0x1faa37;};'use strict';var Sequelize=require(_0x11f8('0x0'));module[_0x11f8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x11f8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x11f8('0x3')]}}; \ No newline at end of file +var _0x8ace=['sequelize','exports','STRING','name'];(function(_0x105149,_0x14f335){var _0x19c3dd=function(_0x6016b6){while(--_0x6016b6){_0x105149['push'](_0x105149['shift']());}};_0x19c3dd(++_0x14f335);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5f13cd,_0x3daaf8){_0x5f13cd=_0x5f13cd-0x0;var _0x827cb7=_0x8ace[_0x5f13cd];return _0x827cb7;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'unique':_0xe8ac('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1f98d7d..9a023c6 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 _0xdf25=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','reject','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','count','findAll','params','keys','includeAll','include','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0xdf25,0x1ab));var _0x5df2=function(_0x2b95bc,_0x2c6ae3){_0x2b95bc=_0x2b95bc-0x0;var _0x3c734b=_0xdf25[_0x2b95bc];return _0x3c734b;};'use strict';var pdf=require(_0x5df2('0x0'));var emlformat=require(_0x5df2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5df2('0x2'));var jsonpatch=require(_0x5df2('0x3'));var rp=require(_0x5df2('0x4'));var moment=require('moment');var BPromise=require(_0x5df2('0x5'));var Mustache=require(_0x5df2('0x6'));var util=require(_0x5df2('0x7'));var path=require(_0x5df2('0x8'));var sox=require(_0x5df2('0x9'));var csv=require(_0x5df2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5df2('0xb'));var crypto=require(_0x5df2('0xc'));var jsforce=require(_0x5df2('0xd'));var deskjs=require(_0x5df2('0xe'));var toCsv=require(_0x5df2('0xa'));var querystring=require('querystring');var Papa=require(_0x5df2('0xf'));var Redis=require(_0x5df2('0x10'));var authService=require(_0x5df2('0x11'));var qs=require(_0x5df2('0x12'));var as=require(_0x5df2('0x13'));var hardwareService=require(_0x5df2('0x14'));var logger=require('../../config/logger')(_0x5df2('0x15'));var utils=require(_0x5df2('0x16'));var config=require(_0x5df2('0x17'));var db=require(_0x5df2('0x18'))['db'];function respondWithStatusCode(_0x16f3fc,_0x7525f9){_0x7525f9=_0x7525f9||0xcc;return function(_0xb68a32){if(_0xb68a32){return _0x16f3fc['sendStatus'](_0x7525f9);}return _0x16f3fc[_0x5df2('0x19')](_0x7525f9)[_0x5df2('0x1a')]();};}function respondWithResult(_0x28893e,_0x412724){_0x412724=_0x412724||0xc8;return function(_0x4104de){if(_0x4104de){return _0x28893e[_0x5df2('0x19')](_0x412724)[_0x5df2('0x1b')](_0x4104de);}};}function respondWithFilteredResult(_0x28ec36,_0x474251){return function(_0xa0b7b7){if(_0xa0b7b7){var _0xa30145=_0xa0b7b7['count'],_0x5a83ad=_0x474251[_0x5df2('0x1c')],_0x991e1a=_0x474251[_0x5df2('0x1c')]+_0x474251['limit'],_0x59975c;if(_0x991e1a>=_0xa30145){_0x991e1a=_0xa30145;_0x59975c=0xc8;}else{_0x59975c=0xce;}_0x28ec36[_0x5df2('0x19')](_0x59975c);return _0x28ec36[_0x5df2('0x1d')]('Content-Range',_0x5a83ad+'-'+_0x991e1a+'/'+_0xa30145)[_0x5df2('0x1b')](_0xa0b7b7);}return null;};}function patchUpdates(_0x4e7f77){return function(_0x453d89){try{jsonpatch['apply'](_0x453d89,_0x4e7f77,!![]);}catch(_0x1f6d04){return BPromise[_0x5df2('0x1e')](_0x1f6d04);}return _0x453d89[_0x5df2('0x1f')]();};}function saveUpdates(_0x31aa93,_0x371c77){return function(_0x37471e){if(_0x37471e){return _0x37471e[_0x5df2('0x20')](_0x31aa93)[_0x5df2('0x21')](function(_0x4cc186){return _0x4cc186;});}return null;};}function removeEntity(_0x235baa,_0x5dc543){return function(_0x14640c){if(_0x14640c){return _0x14640c['destroy']()[_0x5df2('0x21')](function(){_0x235baa[_0x5df2('0x19')](0xcc)[_0x5df2('0x1a')]();});}};}function handleEntityNotFound(_0x5b9977,_0x3c635e){return function(_0x42c8ae){if(!_0x42c8ae){_0x5b9977['sendStatus'](0x194);}return _0x42c8ae;};}function handleError(_0xbe45fb,_0x3f2feb){_0x3f2feb=_0x3f2feb||0x1f4;return function(_0x1cd98a){logger[_0x5df2('0x22')](_0x1cd98a[_0x5df2('0x23')]);if(_0x1cd98a[_0x5df2('0x24')]){delete _0x1cd98a[_0x5df2('0x24')];}_0xbe45fb[_0x5df2('0x19')](_0x3f2feb)[_0x5df2('0x25')](_0x1cd98a);};}exports[_0x5df2('0x26')]=function(_0x444864,_0x46ec3c){var _0x21b8fa={},_0x13c908={},_0x406c67={'count':0x0,'rows':[]};var _0x47c7eb=_[_0x5df2('0x27')](db[_0x5df2('0x28')][_0x5df2('0x29')],function(_0x47e307){return{'name':_0x47e307['fieldName'],'type':_0x47e307['type'][_0x5df2('0x2a')]};});_0x13c908[_0x5df2('0x2b')]=_[_0x5df2('0x27')](_0x47c7eb,_0x5df2('0x24'));_0x13c908['query']=_['keys'](_0x444864[_0x5df2('0x2c')]);_0x13c908[_0x5df2('0x2d')]=_['intersection'](_0x13c908[_0x5df2('0x2b')],_0x13c908['query']);_0x21b8fa[_0x5df2('0x2e')]=_[_0x5df2('0x2f')](_0x13c908[_0x5df2('0x2b')],qs['fields'](_0x444864[_0x5df2('0x2c')][_0x5df2('0x30')]));_0x21b8fa[_0x5df2('0x2e')]=_0x21b8fa[_0x5df2('0x2e')][_0x5df2('0x31')]?_0x21b8fa[_0x5df2('0x2e')]:_0x13c908[_0x5df2('0x2b')];if(!_0x444864['query'][_0x5df2('0x32')](_0x5df2('0x33'))){_0x21b8fa[_0x5df2('0x34')]=qs[_0x5df2('0x34')](_0x444864[_0x5df2('0x2c')]['limit']);_0x21b8fa[_0x5df2('0x1c')]=qs['offset'](_0x444864[_0x5df2('0x2c')][_0x5df2('0x1c')]);}_0x21b8fa[_0x5df2('0x35')]=qs['sort'](_0x444864['query'][_0x5df2('0x36')]);_0x21b8fa[_0x5df2('0x37')]=qs['filters'](_[_0x5df2('0x38')](_0x444864[_0x5df2('0x2c')],_0x13c908[_0x5df2('0x2d')]),_0x47c7eb);if(_0x444864[_0x5df2('0x2c')][_0x5df2('0x39')]){_0x21b8fa[_0x5df2('0x37')]=_['merge'](_0x21b8fa[_0x5df2('0x37')],{'$or':_[_0x5df2('0x27')](_0x47c7eb,function(_0x276d3c){if(_0x276d3c[_0x5df2('0x3a')]!==_0x5df2('0x3b')){var _0x33cc97={};_0x33cc97[_0x276d3c['name']]={'$like':'%'+_0x444864[_0x5df2('0x2c')]['filter']+'%'};return _0x33cc97;}})});}_0x21b8fa=_[_0x5df2('0x3c')]({},_0x21b8fa,_0x444864['options']);var _0x283ce2={'where':_0x21b8fa[_0x5df2('0x37')]};return db['MailSubstatus'][_0x5df2('0x3d')](_0x283ce2)[_0x5df2('0x21')](function(_0x33d7fa){_0x406c67[_0x5df2('0x3d')]=_0x33d7fa;if(_0x444864['query']['includeAll']){_0x21b8fa['include']=[{'all':!![]}];}return db[_0x5df2('0x28')][_0x5df2('0x3e')](_0x21b8fa);})[_0x5df2('0x21')](function(_0x30ae60){_0x406c67['rows']=_0x30ae60;return _0x406c67;})[_0x5df2('0x21')](respondWithFilteredResult(_0x46ec3c,_0x21b8fa))['catch'](handleError(_0x46ec3c,null));};exports['show']=function(_0x2b24ff,_0x4b6481){var _0x2aee30={'raw':!![],'where':{'id':_0x2b24ff[_0x5df2('0x3f')]['id']}},_0x315cdf={};_0x315cdf[_0x5df2('0x2b')]=_[_0x5df2('0x40')](db[_0x5df2('0x28')][_0x5df2('0x29')]);_0x315cdf['query']=_[_0x5df2('0x40')](_0x2b24ff[_0x5df2('0x2c')]);_0x315cdf[_0x5df2('0x2d')]=_[_0x5df2('0x2f')](_0x315cdf[_0x5df2('0x2b')],_0x315cdf[_0x5df2('0x2c')]);_0x2aee30[_0x5df2('0x2e')]=_[_0x5df2('0x2f')](_0x315cdf['model'],qs[_0x5df2('0x30')](_0x2b24ff['query'][_0x5df2('0x30')]));_0x2aee30[_0x5df2('0x2e')]=_0x2aee30['attributes'][_0x5df2('0x31')]?_0x2aee30[_0x5df2('0x2e')]:_0x315cdf[_0x5df2('0x2b')];if(_0x2b24ff['query'][_0x5df2('0x41')]){_0x2aee30[_0x5df2('0x42')]=[{'all':!![]}];}_0x2aee30=_[_0x5df2('0x3c')]({},_0x2aee30,_0x2b24ff[_0x5df2('0x43')]);return db[_0x5df2('0x28')][_0x5df2('0x44')](_0x2aee30)[_0x5df2('0x21')](handleEntityNotFound(_0x4b6481,null))[_0x5df2('0x21')](respondWithResult(_0x4b6481,null))[_0x5df2('0x45')](handleError(_0x4b6481,null));};exports[_0x5df2('0x46')]=function(_0x4b450b,_0x2e375e){return db[_0x5df2('0x28')][_0x5df2('0x46')](_0x4b450b[_0x5df2('0x47')],{})['then'](respondWithResult(_0x2e375e,0xc9))[_0x5df2('0x45')](handleError(_0x2e375e,null));};exports[_0x5df2('0x20')]=function(_0x1968ab,_0x16d55c){if(_0x1968ab[_0x5df2('0x47')]['id']){delete _0x1968ab[_0x5df2('0x47')]['id'];}return db[_0x5df2('0x28')]['find']({'where':{'id':_0x1968ab[_0x5df2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x16d55c,null))[_0x5df2('0x21')](saveUpdates(_0x1968ab[_0x5df2('0x47')],null))[_0x5df2('0x21')](respondWithResult(_0x16d55c,null))[_0x5df2('0x45')](handleError(_0x16d55c,null));};exports['destroy']=function(_0x272756,_0x403c62){return db[_0x5df2('0x28')][_0x5df2('0x44')]({'where':{'id':_0x272756[_0x5df2('0x3f')]['id']}})[_0x5df2('0x21')](handleEntityNotFound(_0x403c62,null))[_0x5df2('0x21')](removeEntity(_0x403c62,null))[_0x5df2('0x45')](handleError(_0x403c62,null));};exports[_0x5df2('0x48')]=function(_0x2d6b7d,_0xfcc3c8){return db['MailSubstatus'][_0x5df2('0x48')]()[_0x5df2('0x21')](respondWithResult(_0xfcc3c8,null))[_0x5df2('0x45')](handleError(_0xfcc3c8,null));}; \ No newline at end of file +var _0x73a0=['../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','catch','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3b6f47,_0x2768cf){var _0x460ccd=function(_0xf89163){while(--_0xf89163){_0x3b6f47['push'](_0x3b6f47['shift']());}};_0x460ccd(++_0x2768cf);}(_0x73a0,0x7b));var _0x073a=function(_0x182604,_0xd30875){_0x182604=_0x182604-0x0;var _0x4d8ae2=_0x73a0[_0x182604];return _0x4d8ae2;};'use strict';var pdf=require(_0x073a('0x0'));var emlformat=require(_0x073a('0x1'));var rimraf=require(_0x073a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x073a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x073a('0x4'));var Mustache=require(_0x073a('0x5'));var util=require(_0x073a('0x6'));var path=require(_0x073a('0x7'));var sox=require(_0x073a('0x8'));var csv=require(_0x073a('0x9'));var ejs=require(_0x073a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x073a('0xb'));var crypto=require(_0x073a('0xc'));var jsforce=require(_0x073a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x073a('0xe'));var Redis=require(_0x073a('0xf'));var authService=require(_0x073a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x073a('0x11'));var hardwareService=require(_0x073a('0x12'));var logger=require(_0x073a('0x13'))('api');var utils=require(_0x073a('0x14'));var config=require('../../config/environment');var db=require(_0x073a('0x15'))['db'];function respondWithStatusCode(_0x51f95d,_0x4c36e9){_0x4c36e9=_0x4c36e9||0xcc;return function(_0x36e4d2){if(_0x36e4d2){return _0x51f95d[_0x073a('0x16')](_0x4c36e9);}return _0x51f95d[_0x073a('0x17')](_0x4c36e9)['end']();};}function respondWithResult(_0x9820e4,_0x29aca8){_0x29aca8=_0x29aca8||0xc8;return function(_0x4c39e4){if(_0x4c39e4){return _0x9820e4['status'](_0x29aca8)['json'](_0x4c39e4);}};}function respondWithFilteredResult(_0x23b626,_0x265c22){return function(_0x1748c4){if(_0x1748c4){var _0x40dbdb=_0x1748c4[_0x073a('0x18')],_0x20b781=_0x265c22[_0x073a('0x19')],_0x1cc84d=_0x265c22[_0x073a('0x19')]+_0x265c22[_0x073a('0x1a')],_0x1b1597;if(_0x1cc84d>=_0x40dbdb){_0x1cc84d=_0x40dbdb;_0x1b1597=0xc8;}else{_0x1b1597=0xce;}_0x23b626[_0x073a('0x17')](_0x1b1597);return _0x23b626[_0x073a('0x1b')](_0x073a('0x1c'),_0x20b781+'-'+_0x1cc84d+'/'+_0x40dbdb)['json'](_0x1748c4);}return null;};}function patchUpdates(_0x5ae20d){return function(_0x765ed9){try{jsonpatch['apply'](_0x765ed9,_0x5ae20d,!![]);}catch(_0x46f102){return BPromise['reject'](_0x46f102);}return _0x765ed9[_0x073a('0x1d')]();};}function saveUpdates(_0x2d2a95,_0xa56728){return function(_0x1d1914){if(_0x1d1914){return _0x1d1914[_0x073a('0x1e')](_0x2d2a95)[_0x073a('0x1f')](function(_0x234627){return _0x234627;});}return null;};}function removeEntity(_0x2b887b,_0x304833){return function(_0x243b05){if(_0x243b05){return _0x243b05[_0x073a('0x20')]()[_0x073a('0x1f')](function(){_0x2b887b[_0x073a('0x17')](0xcc)[_0x073a('0x21')]();});}};}function handleEntityNotFound(_0xce7e6,_0x29c1db){return function(_0x352fe4){if(!_0x352fe4){_0xce7e6[_0x073a('0x16')](0x194);}return _0x352fe4;};}function handleError(_0x1fe882,_0x3764dc){_0x3764dc=_0x3764dc||0x1f4;return function(_0x68d0c3){logger[_0x073a('0x22')](_0x68d0c3[_0x073a('0x23')]);if(_0x68d0c3['name']){delete _0x68d0c3[_0x073a('0x24')];}_0x1fe882[_0x073a('0x17')](_0x3764dc)['send'](_0x68d0c3);};}exports[_0x073a('0x25')]=function(_0x447849,_0xbd3905){var _0x23be27={},_0x196737={},_0x3be265={'count':0x0,'rows':[]};var _0x339af8=_['map'](db[_0x073a('0x26')][_0x073a('0x27')],function(_0x144765){return{'name':_0x144765[_0x073a('0x28')],'type':_0x144765[_0x073a('0x29')][_0x073a('0x2a')]};});_0x196737[_0x073a('0x2b')]=_[_0x073a('0x2c')](_0x339af8,'name');_0x196737[_0x073a('0x2d')]=_[_0x073a('0x2e')](_0x447849['query']);_0x196737[_0x073a('0x2f')]=_[_0x073a('0x30')](_0x196737['model'],_0x196737['query']);_0x23be27[_0x073a('0x31')]=_[_0x073a('0x30')](_0x196737[_0x073a('0x2b')],qs[_0x073a('0x32')](_0x447849[_0x073a('0x2d')][_0x073a('0x32')]));_0x23be27['attributes']=_0x23be27['attributes'][_0x073a('0x33')]?_0x23be27[_0x073a('0x31')]:_0x196737['model'];if(!_0x447849[_0x073a('0x2d')][_0x073a('0x34')](_0x073a('0x35'))){_0x23be27[_0x073a('0x1a')]=qs['limit'](_0x447849['query'][_0x073a('0x1a')]);_0x23be27[_0x073a('0x19')]=qs[_0x073a('0x19')](_0x447849['query'][_0x073a('0x19')]);}_0x23be27[_0x073a('0x36')]=qs[_0x073a('0x37')](_0x447849[_0x073a('0x2d')][_0x073a('0x37')]);_0x23be27[_0x073a('0x38')]=qs['filters'](_[_0x073a('0x39')](_0x447849['query'],_0x196737[_0x073a('0x2f')]),_0x339af8);if(_0x447849[_0x073a('0x2d')][_0x073a('0x3a')]){_0x23be27[_0x073a('0x38')]=_[_0x073a('0x3b')](_0x23be27['where'],{'$or':_[_0x073a('0x2c')](_0x339af8,function(_0x3f6fc8){if(_0x3f6fc8[_0x073a('0x29')]!==_0x073a('0x3c')){var _0x119582={};_0x119582[_0x3f6fc8[_0x073a('0x24')]]={'$like':'%'+_0x447849[_0x073a('0x2d')]['filter']+'%'};return _0x119582;}})});}_0x23be27=_[_0x073a('0x3b')]({},_0x23be27,_0x447849['options']);var _0x24f015={'where':_0x23be27[_0x073a('0x38')]};return db[_0x073a('0x26')][_0x073a('0x18')](_0x24f015)[_0x073a('0x1f')](function(_0x2afec3){_0x3be265[_0x073a('0x18')]=_0x2afec3;if(_0x447849[_0x073a('0x2d')][_0x073a('0x3d')]){_0x23be27[_0x073a('0x3e')]=[{'all':!![]}];}return db[_0x073a('0x26')][_0x073a('0x3f')](_0x23be27);})[_0x073a('0x1f')](function(_0x4adbc1){_0x3be265['rows']=_0x4adbc1;return _0x3be265;})[_0x073a('0x1f')](respondWithFilteredResult(_0xbd3905,_0x23be27))['catch'](handleError(_0xbd3905,null));};exports[_0x073a('0x40')]=function(_0x530925,_0x4d7522){var _0x19aa07={'raw':!![],'where':{'id':_0x530925[_0x073a('0x41')]['id']}},_0x26022b={};_0x26022b[_0x073a('0x2b')]=_['keys'](db[_0x073a('0x26')][_0x073a('0x27')]);_0x26022b[_0x073a('0x2d')]=_[_0x073a('0x2e')](_0x530925[_0x073a('0x2d')]);_0x26022b[_0x073a('0x2f')]=_[_0x073a('0x30')](_0x26022b[_0x073a('0x2b')],_0x26022b[_0x073a('0x2d')]);_0x19aa07['attributes']=_[_0x073a('0x30')](_0x26022b['model'],qs[_0x073a('0x32')](_0x530925['query'][_0x073a('0x32')]));_0x19aa07['attributes']=_0x19aa07[_0x073a('0x31')][_0x073a('0x33')]?_0x19aa07[_0x073a('0x31')]:_0x26022b[_0x073a('0x2b')];if(_0x530925[_0x073a('0x2d')]['includeAll']){_0x19aa07[_0x073a('0x3e')]=[{'all':!![]}];}_0x19aa07=_['merge']({},_0x19aa07,_0x530925[_0x073a('0x42')]);return db[_0x073a('0x26')][_0x073a('0x43')](_0x19aa07)[_0x073a('0x1f')](handleEntityNotFound(_0x4d7522,null))[_0x073a('0x1f')](respondWithResult(_0x4d7522,null))['catch'](handleError(_0x4d7522,null));};exports[_0x073a('0x44')]=function(_0x212bd5,_0x204c4c){return db['MailSubstatus'][_0x073a('0x44')](_0x212bd5['body'],{})[_0x073a('0x1f')](respondWithResult(_0x204c4c,0xc9))[_0x073a('0x45')](handleError(_0x204c4c,null));};exports[_0x073a('0x1e')]=function(_0xd4620e,_0x334b5b){if(_0xd4620e[_0x073a('0x46')]['id']){delete _0xd4620e[_0x073a('0x46')]['id'];}return db[_0x073a('0x26')]['find']({'where':{'id':_0xd4620e['params']['id']}})[_0x073a('0x1f')](handleEntityNotFound(_0x334b5b,null))[_0x073a('0x1f')](saveUpdates(_0xd4620e[_0x073a('0x46')],null))['then'](respondWithResult(_0x334b5b,null))[_0x073a('0x45')](handleError(_0x334b5b,null));};exports[_0x073a('0x20')]=function(_0x1ab51c,_0x30871e){return db[_0x073a('0x26')][_0x073a('0x43')]({'where':{'id':_0x1ab51c[_0x073a('0x41')]['id']}})[_0x073a('0x1f')](handleEntityNotFound(_0x30871e,null))['then'](removeEntity(_0x30871e,null))[_0x073a('0x45')](handleError(_0x30871e,null));};exports[_0x073a('0x47')]=function(_0x4db0e9,_0xdfc438){return db[_0x073a('0x26')][_0x073a('0x47')]()[_0x073a('0x1f')](respondWithResult(_0xdfc438,null))[_0x073a('0x45')](handleError(_0xdfc438,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 58edc1a..aea66c4 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 _0x4c54=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','util'];(function(_0x3a04c5,_0x5ca671){var _0x4dff96=function(_0x59bade){while(--_0x59bade){_0x3a04c5['push'](_0x3a04c5['shift']());}};_0x4dff96(++_0x5ca671);}(_0x4c54,0xd0));var _0x44c5=function(_0x5c4592,_0xa5ba32){_0x5c4592=_0x5c4592-0x0;var _0x51ab0f=_0x4c54[_0x5c4592];return _0x51ab0f;};'use strict';var _=require('lodash');var util=require(_0x44c5('0x0'));var logger=require(_0x44c5('0x1'))(_0x44c5('0x2'));var moment=require(_0x44c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x44c5('0x4'));var fs=require('fs');var path=require(_0x44c5('0x5'));var rimraf=require(_0x44c5('0x6'));var config=require(_0x44c5('0x7'));var attributes=require(_0x44c5('0x8'));module['exports']=function(_0x3b0b53,_0xd45810){return _0x3b0b53[_0x44c5('0x9')](_0x44c5('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6634=['request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','mail_substatuses','../../config/logger','api','moment'];(function(_0x43da25,_0x37f6a3){var _0x58d48a=function(_0x46bb0f){while(--_0x46bb0f){_0x43da25['push'](_0x43da25['shift']());}};_0x58d48a(++_0x37f6a3);}(_0x6634,0x175));var _0x4663=function(_0x57dd90,_0x58ddc4){_0x57dd90=_0x57dd90-0x0;var _0x34abca=_0x6634[_0x57dd90];return _0x34abca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4663('0x0'))(_0x4663('0x1'));var moment=require(_0x4663('0x2'));var BPromise=require('bluebird');var rp=require(_0x4663('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4663('0x4'));var config=require(_0x4663('0x5'));var attributes=require(_0x4663('0x6'));module['exports']=function(_0x20894c,_0x32aa4b){return _0x20894c['define']('MailSubstatus',attributes,{'tableName':_0x4663('0x7'),'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 5c28639..1f5b3e0 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 _0x70e0=['code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x52358e,_0x415168){var _0x485b29=function(_0x227711){while(--_0x227711){_0x52358e['push'](_0x52358e['shift']());}};_0x485b29(++_0x415168);}(_0x70e0,0x17b));var _0x070e=function(_0x458738,_0x5910da){_0x458738=_0x458738-0x0;var _0x5690c0=_0x70e0[_0x458738];return _0x5690c0;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x9cd94,_0x4daa7a){var _0x343a0b=function(_0xe2016a){while(--_0xe2016a){_0x9cd94['push'](_0x9cd94['shift']());}};_0x343a0b(++_0x4daa7a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0xcb91[_0x22663b];return _0x310d0a;};'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')]('MailSubstatus,\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/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 524719e..88d0940 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 _0x850f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get'];(function(_0x119fc7,_0x2847e9){var _0x1b18ab=function(_0x42ce77){while(--_0x42ce77){_0x119fc7['push'](_0x119fc7['shift']());}};_0x1b18ab(++_0x2847e9);}(_0x850f,0x1d8));var _0xf850=function(_0x182b4d,_0x2e8492){_0x182b4d=_0x182b4d-0x0;var _0x21d4f9=_0x850f[_0x182b4d];return _0x21d4f9;};'use strict';var multer=require(_0xf850('0x0'));var util=require(_0xf850('0x1'));var path=require(_0xf850('0x2'));var timeout=require(_0xf850('0x3'));var express=require(_0xf850('0x4'));var router=express['Router']();var auth=require(_0xf850('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf850('0x6'));var controller=require('./mailTransferReport.controller');router[_0xf850('0x7')]('/',auth[_0xf850('0x8')](),controller[_0xf850('0x9')]);router[_0xf850('0x7')](_0xf850('0xa'),auth['isAuthenticated'](),controller[_0xf850('0xb')]);router[_0xf850('0x7')](_0xf850('0xc'),auth[_0xf850('0x8')](),controller[_0xf850('0xd')]);router[_0xf850('0xe')]('/',auth[_0xf850('0x8')](),controller[_0xf850('0xf')]);router[_0xf850('0x10')](_0xf850('0xc'),auth[_0xf850('0x8')](),controller[_0xf850('0x11')]);router[_0xf850('0x12')]('/:id',auth[_0xf850('0x8')](),controller[_0xf850('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd17d=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd17d,0x1ce));var _0xdd17=function(_0x3b97b2,_0x35fe72){_0x3b97b2=_0x3b97b2-0x0;var _0x5d5510=_0xd17d[_0x3b97b2];return _0x5d5510;};'use strict';var multer=require(_0xdd17('0x0'));var util=require(_0xdd17('0x1'));var path=require(_0xdd17('0x2'));var timeout=require(_0xdd17('0x3'));var express=require('express');var router=express[_0xdd17('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdd17('0x5'));var config=require(_0xdd17('0x6'));var controller=require(_0xdd17('0x7'));router['get']('/',auth[_0xdd17('0x8')](),controller[_0xdd17('0x9')]);router[_0xdd17('0xa')](_0xdd17('0xb'),auth[_0xdd17('0x8')](),controller[_0xdd17('0xc')]);router[_0xdd17('0xa')](_0xdd17('0xd'),auth['isAuthenticated'](),controller[_0xdd17('0xe')]);router[_0xdd17('0xf')]('/',auth[_0xdd17('0x8')](),controller[_0xdd17('0x10')]);router[_0xdd17('0x11')](_0xdd17('0xd'),auth['isAuthenticated'](),controller[_0xdd17('0x12')]);router[_0xdd17('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdd17('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ec036aa..2cf18f7 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 _0x75d9=['DATE','NOW','moment','exports','STRING','agent','queue'];(function(_0x2b778d,_0x5dd9e4){var _0x46a581=function(_0x3eb2ee){while(--_0x3eb2ee){_0x2b778d['push'](_0x2b778d['shift']());}};_0x46a581(++_0x5dd9e4);}(_0x75d9,0x175));var _0x975d=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x75d9[_0x1bb58c];return _0x277586;};'use strict';var moment=require(_0x975d('0x0'));var Sequelize=require('sequelize');module[_0x975d('0x1')]={'uniqueid':{'type':Sequelize[_0x975d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x975d('0x3'),_0x975d('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x975d('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x975d('0x6')]}}; \ No newline at end of file +var _0x5187=['DATE','NOW','sequelize','exports','STRING','ENUM','account','queue'];(function(_0x263a40,_0x2ab440){var _0x441acc=function(_0x844dcd){while(--_0x844dcd){_0x263a40['push'](_0x263a40['shift']());}};_0x441acc(++_0x2ab440);}(_0x5187,0xb2));var _0x7518=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x5187[_0x4fbb15];return _0x436338;};'use strict';var moment=require('moment');var Sequelize=require(_0x7518('0x0'));module[_0x7518('0x1')]={'uniqueid':{'type':Sequelize[_0x7518('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7518('0x3')](_0x7518('0x4'),'agent',_0x7518('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x7518('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x7518('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 85c2bd6..50e71db 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 _0x8d01=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','MailTransferReport','count','includeAll','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x8d01,0x1ae));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18d0('0x0'));var rimraf=require(_0x18d0('0x1'));var zipdir=require(_0x18d0('0x2'));var jsonpatch=require(_0x18d0('0x3'));var rp=require(_0x18d0('0x4'));var moment=require('moment');var BPromise=require(_0x18d0('0x5'));var Mustache=require(_0x18d0('0x6'));var util=require(_0x18d0('0x7'));var path=require(_0x18d0('0x8'));var sox=require('sox');var csv=require(_0x18d0('0x9'));var ejs=require(_0x18d0('0xa'));var fs=require('fs');var _=require(_0x18d0('0xb'));var squel=require(_0x18d0('0xc'));var crypto=require(_0x18d0('0xd'));var jsforce=require(_0x18d0('0xe'));var deskjs=require(_0x18d0('0xf'));var toCsv=require(_0x18d0('0x9'));var querystring=require(_0x18d0('0x10'));var Papa=require(_0x18d0('0x11'));var Redis=require(_0x18d0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x18d0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18d0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x18d0('0x15'));var config=require(_0x18d0('0x16'));var db=require(_0x18d0('0x17'))['db'];function respondWithStatusCode(_0x31708c,_0x187f04){_0x187f04=_0x187f04||0xcc;return function(_0x5c8f35){if(_0x5c8f35){return _0x31708c[_0x18d0('0x18')](_0x187f04);}return _0x31708c[_0x18d0('0x19')](_0x187f04)['end']();};}function respondWithResult(_0x514c92,_0x4e78d9){_0x4e78d9=_0x4e78d9||0xc8;return function(_0x4a7fae){if(_0x4a7fae){return _0x514c92[_0x18d0('0x19')](_0x4e78d9)[_0x18d0('0x1a')](_0x4a7fae);}};}function respondWithFilteredResult(_0x31bab0,_0x36c9f1){return function(_0x1d7048){if(_0x1d7048){var _0x33af81=_0x1d7048['count'],_0x4bcd5c=_0x36c9f1[_0x18d0('0x1b')],_0xefb652=_0x36c9f1[_0x18d0('0x1b')]+_0x36c9f1[_0x18d0('0x1c')],_0x3efaa1;if(_0xefb652>=_0x33af81){_0xefb652=_0x33af81;_0x3efaa1=0xc8;}else{_0x3efaa1=0xce;}_0x31bab0[_0x18d0('0x19')](_0x3efaa1);return _0x31bab0[_0x18d0('0x1d')](_0x18d0('0x1e'),_0x4bcd5c+'-'+_0xefb652+'/'+_0x33af81)[_0x18d0('0x1a')](_0x1d7048);}return null;};}function patchUpdates(_0x253cd5){return function(_0xc7168c){try{jsonpatch['apply'](_0xc7168c,_0x253cd5,!![]);}catch(_0x14a270){return BPromise[_0x18d0('0x1f')](_0x14a270);}return _0xc7168c['save']();};}function saveUpdates(_0x293344,_0x91b14d){return function(_0x32f1f7){if(_0x32f1f7){return _0x32f1f7[_0x18d0('0x20')](_0x293344)[_0x18d0('0x21')](function(_0x2ca427){return _0x2ca427;});}return null;};}function removeEntity(_0x35e182,_0x32315a){return function(_0x2de0cc){if(_0x2de0cc){return _0x2de0cc[_0x18d0('0x22')]()[_0x18d0('0x21')](function(){_0x35e182[_0x18d0('0x19')](0xcc)[_0x18d0('0x23')]();});}};}function handleEntityNotFound(_0x1ce18e,_0x253002){return function(_0x5d2a23){if(!_0x5d2a23){_0x1ce18e['sendStatus'](0x194);}return _0x5d2a23;};}function handleError(_0x558060,_0x2c94b2){_0x2c94b2=_0x2c94b2||0x1f4;return function(_0x5cdc97){logger[_0x18d0('0x24')](_0x5cdc97[_0x18d0('0x25')]);if(_0x5cdc97['name']){delete _0x5cdc97[_0x18d0('0x26')];}_0x558060['status'](_0x2c94b2)[_0x18d0('0x27')](_0x5cdc97);};}exports[_0x18d0('0x28')]=function(_0x43d160,_0x5910fa){var _0x105c89={},_0x38a0c6={},_0x16034a={'count':0x0,'rows':[]};var _0x297f24=_['map'](db['MailTransferReport'][_0x18d0('0x29')],function(_0x134fe8){return{'name':_0x134fe8[_0x18d0('0x2a')],'type':_0x134fe8[_0x18d0('0x2b')][_0x18d0('0x2c')]};});_0x38a0c6['model']=_[_0x18d0('0x2d')](_0x297f24,_0x18d0('0x26'));_0x38a0c6[_0x18d0('0x2e')]=_[_0x18d0('0x2f')](_0x43d160[_0x18d0('0x2e')]);_0x38a0c6[_0x18d0('0x30')]=_[_0x18d0('0x31')](_0x38a0c6[_0x18d0('0x32')],_0x38a0c6['query']);_0x105c89[_0x18d0('0x33')]=_[_0x18d0('0x31')](_0x38a0c6['model'],qs[_0x18d0('0x34')](_0x43d160['query']['fields']));_0x105c89[_0x18d0('0x33')]=_0x105c89[_0x18d0('0x33')][_0x18d0('0x35')]?_0x105c89[_0x18d0('0x33')]:_0x38a0c6['model'];if(!_0x43d160[_0x18d0('0x2e')]['hasOwnProperty'](_0x18d0('0x36'))){_0x105c89[_0x18d0('0x1c')]=qs[_0x18d0('0x1c')](_0x43d160[_0x18d0('0x2e')][_0x18d0('0x1c')]);_0x105c89[_0x18d0('0x1b')]=qs['offset'](_0x43d160['query'][_0x18d0('0x1b')]);}_0x105c89[_0x18d0('0x37')]=qs['sort'](_0x43d160[_0x18d0('0x2e')][_0x18d0('0x38')]);_0x105c89[_0x18d0('0x39')]=qs[_0x18d0('0x30')](_[_0x18d0('0x3a')](_0x43d160[_0x18d0('0x2e')],_0x38a0c6[_0x18d0('0x30')]),_0x297f24);if(_0x43d160[_0x18d0('0x2e')][_0x18d0('0x3b')]){_0x105c89[_0x18d0('0x39')]=_[_0x18d0('0x3c')](_0x105c89['where'],{'$or':_['map'](_0x297f24,function(_0x564739){if(_0x564739[_0x18d0('0x2b')]!=='VIRTUAL'){var _0x17f47d={};_0x17f47d[_0x564739[_0x18d0('0x26')]]={'$like':'%'+_0x43d160[_0x18d0('0x2e')][_0x18d0('0x3b')]+'%'};return _0x17f47d;}})});}_0x105c89=_[_0x18d0('0x3c')]({},_0x105c89,_0x43d160[_0x18d0('0x3d')]);var _0x4ee74b={'where':_0x105c89['where']};return db[_0x18d0('0x3e')][_0x18d0('0x3f')](_0x4ee74b)[_0x18d0('0x21')](function(_0x4c94d2){_0x16034a[_0x18d0('0x3f')]=_0x4c94d2;if(_0x43d160[_0x18d0('0x2e')][_0x18d0('0x40')]){_0x105c89['include']=[{'all':!![]}];}return db[_0x18d0('0x3e')][_0x18d0('0x41')](_0x105c89);})['then'](function(_0x193cf4){_0x16034a[_0x18d0('0x42')]=_0x193cf4;return _0x16034a;})['then'](respondWithFilteredResult(_0x5910fa,_0x105c89))[_0x18d0('0x43')](handleError(_0x5910fa,null));};exports[_0x18d0('0x44')]=function(_0x20cfd2,_0x546f3d){var _0x94446d={'raw':!![],'where':{'id':_0x20cfd2[_0x18d0('0x45')]['id']}},_0x101c18={};_0x101c18[_0x18d0('0x32')]=_['keys'](db[_0x18d0('0x3e')][_0x18d0('0x29')]);_0x101c18[_0x18d0('0x2e')]=_[_0x18d0('0x2f')](_0x20cfd2[_0x18d0('0x2e')]);_0x101c18[_0x18d0('0x30')]=_[_0x18d0('0x31')](_0x101c18[_0x18d0('0x32')],_0x101c18['query']);_0x94446d[_0x18d0('0x33')]=_[_0x18d0('0x31')](_0x101c18[_0x18d0('0x32')],qs[_0x18d0('0x34')](_0x20cfd2[_0x18d0('0x2e')]['fields']));_0x94446d[_0x18d0('0x33')]=_0x94446d[_0x18d0('0x33')][_0x18d0('0x35')]?_0x94446d[_0x18d0('0x33')]:_0x101c18[_0x18d0('0x32')];if(_0x20cfd2[_0x18d0('0x2e')][_0x18d0('0x40')]){_0x94446d['include']=[{'all':!![]}];}_0x94446d=_['merge']({},_0x94446d,_0x20cfd2['options']);return db[_0x18d0('0x3e')]['find'](_0x94446d)['then'](handleEntityNotFound(_0x546f3d,null))['then'](respondWithResult(_0x546f3d,null))[_0x18d0('0x43')](handleError(_0x546f3d,null));};exports[_0x18d0('0x46')]=function(_0x3ad554,_0x29e24b){return db[_0x18d0('0x3e')][_0x18d0('0x46')](_0x3ad554[_0x18d0('0x47')],{})[_0x18d0('0x21')](respondWithResult(_0x29e24b,0xc9))[_0x18d0('0x43')](handleError(_0x29e24b,null));};exports[_0x18d0('0x20')]=function(_0x1edb85,_0x3384e2){if(_0x1edb85[_0x18d0('0x47')]['id']){delete _0x1edb85[_0x18d0('0x47')]['id'];}return db[_0x18d0('0x3e')]['find']({'where':{'id':_0x1edb85[_0x18d0('0x45')]['id']}})[_0x18d0('0x21')](handleEntityNotFound(_0x3384e2,null))[_0x18d0('0x21')](saveUpdates(_0x1edb85[_0x18d0('0x47')],null))[_0x18d0('0x21')](respondWithResult(_0x3384e2,null))[_0x18d0('0x43')](handleError(_0x3384e2,null));};exports[_0x18d0('0x22')]=function(_0x41eb5d,_0x47b7a3){return db[_0x18d0('0x3e')][_0x18d0('0x48')]({'where':{'id':_0x41eb5d['params']['id']}})[_0x18d0('0x21')](handleEntityNotFound(_0x47b7a3,null))[_0x18d0('0x21')](removeEntity(_0x47b7a3,null))['catch'](handleError(_0x47b7a3,null));};exports[_0x18d0('0x49')]=function(_0xe78a61,_0x62ca47){return db['MailTransferReport'][_0x18d0('0x49')]()['then'](respondWithResult(_0x62ca47,null))['catch'](handleError(_0x62ca47,null));}; \ No newline at end of file +var _0xfb17=['order','sort','where','filters','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x13da27,_0x374d22){var _0x6bd66f=function(_0x38c8c2){while(--_0x38c8c2){_0x13da27['push'](_0x13da27['shift']());}};_0x6bd66f(++_0x374d22);}(_0xfb17,0x18f));var _0x7fb1=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xfb17[_0x50007c];return _0x5c1ec7;};'use strict';var pdf=require(_0x7fb1('0x0'));var emlformat=require(_0x7fb1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7fb1('0x2'));var jsonpatch=require(_0x7fb1('0x3'));var rp=require(_0x7fb1('0x4'));var moment=require(_0x7fb1('0x5'));var BPromise=require(_0x7fb1('0x6'));var Mustache=require(_0x7fb1('0x7'));var util=require('util');var path=require(_0x7fb1('0x8'));var sox=require(_0x7fb1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fb1('0xa'));var fs=require('fs');var _=require(_0x7fb1('0xb'));var squel=require(_0x7fb1('0xc'));var crypto=require(_0x7fb1('0xd'));var jsforce=require(_0x7fb1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7fb1('0xf'));var querystring=require(_0x7fb1('0x10'));var Papa=require(_0x7fb1('0x11'));var Redis=require('ioredis');var authService=require(_0x7fb1('0x12'));var qs=require(_0x7fb1('0x13'));var as=require(_0x7fb1('0x14'));var hardwareService=require(_0x7fb1('0x15'));var logger=require(_0x7fb1('0x16'))(_0x7fb1('0x17'));var utils=require(_0x7fb1('0x18'));var config=require(_0x7fb1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x223e23,_0x51ae0){_0x51ae0=_0x51ae0||0xcc;return function(_0x5cb0d4){if(_0x5cb0d4){return _0x223e23[_0x7fb1('0x1a')](_0x51ae0);}return _0x223e23[_0x7fb1('0x1b')](_0x51ae0)[_0x7fb1('0x1c')]();};}function respondWithResult(_0x38fe84,_0x574829){_0x574829=_0x574829||0xc8;return function(_0x1b672e){if(_0x1b672e){return _0x38fe84[_0x7fb1('0x1b')](_0x574829)[_0x7fb1('0x1d')](_0x1b672e);}};}function respondWithFilteredResult(_0xd3b07c,_0x23106d){return function(_0x26f422){if(_0x26f422){var _0x25bd76=_0x26f422[_0x7fb1('0x1e')],_0x5be726=_0x23106d[_0x7fb1('0x1f')],_0x93afc6=_0x23106d[_0x7fb1('0x1f')]+_0x23106d[_0x7fb1('0x20')],_0x718bc7;if(_0x93afc6>=_0x25bd76){_0x93afc6=_0x25bd76;_0x718bc7=0xc8;}else{_0x718bc7=0xce;}_0xd3b07c[_0x7fb1('0x1b')](_0x718bc7);return _0xd3b07c[_0x7fb1('0x21')](_0x7fb1('0x22'),_0x5be726+'-'+_0x93afc6+'/'+_0x25bd76)[_0x7fb1('0x1d')](_0x26f422);}return null;};}function patchUpdates(_0x98b25c){return function(_0x571c8f){try{jsonpatch[_0x7fb1('0x23')](_0x571c8f,_0x98b25c,!![]);}catch(_0x1ec946){return BPromise[_0x7fb1('0x24')](_0x1ec946);}return _0x571c8f['save']();};}function saveUpdates(_0x1ac3e8,_0xce1b3d){return function(_0x4acdd6){if(_0x4acdd6){return _0x4acdd6[_0x7fb1('0x25')](_0x1ac3e8)['then'](function(_0x3bc8e0){return _0x3bc8e0;});}return null;};}function removeEntity(_0x2bcf4b,_0x110911){return function(_0x486148){if(_0x486148){return _0x486148[_0x7fb1('0x26')]()[_0x7fb1('0x27')](function(){_0x2bcf4b[_0x7fb1('0x1b')](0xcc)[_0x7fb1('0x1c')]();});}};}function handleEntityNotFound(_0xb9137f,_0x16837e){return function(_0x382d65){if(!_0x382d65){_0xb9137f[_0x7fb1('0x1a')](0x194);}return _0x382d65;};}function handleError(_0x428bdf,_0x2b1fa8){_0x2b1fa8=_0x2b1fa8||0x1f4;return function(_0x758120){logger['error'](_0x758120[_0x7fb1('0x28')]);if(_0x758120[_0x7fb1('0x29')]){delete _0x758120['name'];}_0x428bdf[_0x7fb1('0x1b')](_0x2b1fa8)[_0x7fb1('0x2a')](_0x758120);};}exports[_0x7fb1('0x2b')]=function(_0x5af37e,_0x3e30ec){var _0x445caa={},_0x22d36a={},_0x5bf26b={'count':0x0,'rows':[]};var _0x3dab60=_[_0x7fb1('0x2c')](db['MailTransferReport'][_0x7fb1('0x2d')],function(_0x473a3c){return{'name':_0x473a3c[_0x7fb1('0x2e')],'type':_0x473a3c[_0x7fb1('0x2f')]['key']};});_0x22d36a['model']=_[_0x7fb1('0x2c')](_0x3dab60,_0x7fb1('0x29'));_0x22d36a['query']=_[_0x7fb1('0x30')](_0x5af37e[_0x7fb1('0x31')]);_0x22d36a['filters']=_[_0x7fb1('0x32')](_0x22d36a['model'],_0x22d36a[_0x7fb1('0x31')]);_0x445caa['attributes']=_[_0x7fb1('0x32')](_0x22d36a[_0x7fb1('0x33')],qs[_0x7fb1('0x34')](_0x5af37e['query'][_0x7fb1('0x34')]));_0x445caa[_0x7fb1('0x35')]=_0x445caa[_0x7fb1('0x35')][_0x7fb1('0x36')]?_0x445caa[_0x7fb1('0x35')]:_0x22d36a[_0x7fb1('0x33')];if(!_0x5af37e[_0x7fb1('0x31')][_0x7fb1('0x37')](_0x7fb1('0x38'))){_0x445caa[_0x7fb1('0x20')]=qs['limit'](_0x5af37e[_0x7fb1('0x31')][_0x7fb1('0x20')]);_0x445caa[_0x7fb1('0x1f')]=qs[_0x7fb1('0x1f')](_0x5af37e[_0x7fb1('0x31')]['offset']);}_0x445caa[_0x7fb1('0x39')]=qs[_0x7fb1('0x3a')](_0x5af37e['query']['sort']);_0x445caa[_0x7fb1('0x3b')]=qs['filters'](_['pick'](_0x5af37e['query'],_0x22d36a[_0x7fb1('0x3c')]),_0x3dab60);if(_0x5af37e['query']['filter']){_0x445caa[_0x7fb1('0x3b')]=_[_0x7fb1('0x3d')](_0x445caa['where'],{'$or':_[_0x7fb1('0x2c')](_0x3dab60,function(_0x3ecd50){if(_0x3ecd50[_0x7fb1('0x2f')]!==_0x7fb1('0x3e')){var _0x418270={};_0x418270[_0x3ecd50[_0x7fb1('0x29')]]={'$like':'%'+_0x5af37e['query']['filter']+'%'};return _0x418270;}})});}_0x445caa=_[_0x7fb1('0x3d')]({},_0x445caa,_0x5af37e[_0x7fb1('0x3f')]);var _0x319d62={'where':_0x445caa[_0x7fb1('0x3b')]};return db[_0x7fb1('0x40')][_0x7fb1('0x1e')](_0x319d62)[_0x7fb1('0x27')](function(_0x210188){_0x5bf26b[_0x7fb1('0x1e')]=_0x210188;if(_0x5af37e['query'][_0x7fb1('0x41')]){_0x445caa['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x7fb1('0x42')](_0x445caa);})[_0x7fb1('0x27')](function(_0x1ce76d){_0x5bf26b[_0x7fb1('0x43')]=_0x1ce76d;return _0x5bf26b;})[_0x7fb1('0x27')](respondWithFilteredResult(_0x3e30ec,_0x445caa))[_0x7fb1('0x44')](handleError(_0x3e30ec,null));};exports[_0x7fb1('0x45')]=function(_0x5c0d80,_0x2e8553){var _0x28522a={'raw':!![],'where':{'id':_0x5c0d80[_0x7fb1('0x46')]['id']}},_0x19d3ba={};_0x19d3ba['model']=_[_0x7fb1('0x30')](db[_0x7fb1('0x40')]['rawAttributes']);_0x19d3ba['query']=_[_0x7fb1('0x30')](_0x5c0d80[_0x7fb1('0x31')]);_0x19d3ba[_0x7fb1('0x3c')]=_[_0x7fb1('0x32')](_0x19d3ba[_0x7fb1('0x33')],_0x19d3ba['query']);_0x28522a[_0x7fb1('0x35')]=_[_0x7fb1('0x32')](_0x19d3ba[_0x7fb1('0x33')],qs[_0x7fb1('0x34')](_0x5c0d80['query'][_0x7fb1('0x34')]));_0x28522a['attributes']=_0x28522a[_0x7fb1('0x35')][_0x7fb1('0x36')]?_0x28522a[_0x7fb1('0x35')]:_0x19d3ba[_0x7fb1('0x33')];if(_0x5c0d80[_0x7fb1('0x31')][_0x7fb1('0x41')]){_0x28522a[_0x7fb1('0x47')]=[{'all':!![]}];}_0x28522a=_['merge']({},_0x28522a,_0x5c0d80[_0x7fb1('0x3f')]);return db[_0x7fb1('0x40')][_0x7fb1('0x48')](_0x28522a)['then'](handleEntityNotFound(_0x2e8553,null))[_0x7fb1('0x27')](respondWithResult(_0x2e8553,null))[_0x7fb1('0x44')](handleError(_0x2e8553,null));};exports[_0x7fb1('0x49')]=function(_0x21f47c,_0x4e7160){return db[_0x7fb1('0x40')][_0x7fb1('0x49')](_0x21f47c['body'],{})[_0x7fb1('0x27')](respondWithResult(_0x4e7160,0xc9))[_0x7fb1('0x44')](handleError(_0x4e7160,null));};exports[_0x7fb1('0x25')]=function(_0x31e3a0,_0x30b45b){if(_0x31e3a0['body']['id']){delete _0x31e3a0[_0x7fb1('0x4a')]['id'];}return db[_0x7fb1('0x40')][_0x7fb1('0x48')]({'where':{'id':_0x31e3a0[_0x7fb1('0x46')]['id']}})[_0x7fb1('0x27')](handleEntityNotFound(_0x30b45b,null))['then'](saveUpdates(_0x31e3a0['body'],null))[_0x7fb1('0x27')](respondWithResult(_0x30b45b,null))[_0x7fb1('0x44')](handleError(_0x30b45b,null));};exports[_0x7fb1('0x26')]=function(_0x43a073,_0x2189c9){return db[_0x7fb1('0x40')][_0x7fb1('0x48')]({'where':{'id':_0x43a073[_0x7fb1('0x46')]['id']}})[_0x7fb1('0x27')](handleEntityNotFound(_0x2189c9,null))[_0x7fb1('0x27')](removeEntity(_0x2189c9,null))['catch'](handleError(_0x2189c9,null));};exports[_0x7fb1('0x4b')]=function(_0x111807,_0x20d7c6){return db[_0x7fb1('0x40')][_0x7fb1('0x4b')]()['then'](respondWithResult(_0x20d7c6,null))[_0x7fb1('0x44')](handleError(_0x20d7c6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b5dd727..9156325 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 _0xe1f7=['rimraf','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x12d7f8,_0x2fab4d){var _0x4452ee=function(_0x22a8f5){while(--_0x22a8f5){_0x12d7f8['push'](_0x12d7f8['shift']());}};_0x4452ee(++_0x2fab4d);}(_0xe1f7,0x12f));var _0x7e1f=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0xe1f7[_0xb7cb72];return _0x4b7570;};'use strict';var _=require(_0x7e1f('0x0'));var util=require('util');var logger=require(_0x7e1f('0x1'))(_0x7e1f('0x2'));var moment=require(_0x7e1f('0x3'));var BPromise=require(_0x7e1f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e1f('0x5'));var config=require('../../config/environment');var attributes=require(_0x7e1f('0x6'));module[_0x7e1f('0x7')]=function(_0x396ecb,_0x43abfe){return _0x396ecb['define'](_0x7e1f('0x8'),attributes,{'tableName':_0x7e1f('0x9'),'paranoid':![],'indexes':[{'name':_0x7e1f('0xa'),'fields':[_0x7e1f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fb=['exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2446a8,_0x287c7a){var _0xf8842a=function(_0x1912a1){while(--_0x1912a1){_0x2446a8['push'](_0x2446a8['shift']());}};_0xf8842a(++_0x287c7a);}(_0xf6fb,0x90));var _0xbf6f=function(_0x570695,_0x649fa0){_0x570695=_0x570695-0x0;var _0xdf299a=_0xf6fb[_0x570695];return _0xdf299a;};'use strict';var _=require(_0xbf6f('0x0'));var util=require(_0xbf6f('0x1'));var logger=require(_0xbf6f('0x2'))(_0xbf6f('0x3'));var moment=require(_0xbf6f('0x4'));var BPromise=require(_0xbf6f('0x5'));var rp=require(_0xbf6f('0x6'));var fs=require('fs');var path=require(_0xbf6f('0x7'));var rimraf=require(_0xbf6f('0x8'));var config=require(_0xbf6f('0x9'));var attributes=require('./mailTransferReport.attributes');module[_0xbf6f('0xa')]=function(_0x4dea2b,_0x424831){return _0x4dea2b['define'](_0xbf6f('0xb'),attributes,{'tableName':_0xbf6f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbf6f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 564a42b..950a96d 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 _0xc5ff=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','error'];(function(_0x455d83,_0x520d2d){var _0x4c6eab=function(_0xeaec95){while(--_0xeaec95){_0x455d83['push'](_0x455d83['shift']());}};_0x4c6eab(++_0x520d2d);}(_0xc5ff,0x1a9));var _0xfc5f=function(_0x23a83c,_0x9d572f){_0x23a83c=_0x23a83c-0x0;var _0x545e6f=_0xc5ff[_0x23a83c];return _0x545e6f;};'use strict';var _=require(_0xfc5f('0x0'));var util=require(_0xfc5f('0x1'));var moment=require(_0xfc5f('0x2'));var BPromise=require(_0xfc5f('0x3'));var rs=require(_0xfc5f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5f('0x5'))['db'];var utils=require(_0xfc5f('0x6'));var logger=require(_0xfc5f('0x7'))('rpc');var config=require(_0xfc5f('0x8'));var jayson=require(_0xfc5f('0x9'));var client=jayson[_0xfc5f('0xa')][_0xfc5f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a97fe,_0x102633,_0x2dae90){return new BPromise(function(_0x526213,_0x406252){return client[_0xfc5f('0xc')](_0x3a97fe,_0x2dae90)['then'](function(_0x8c1297){logger['info'](_0xfc5f('0xd'),_0x102633,_0xfc5f('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x102633,_0xfc5f('0xe'),JSON['stringify'](_0x8c1297));if(_0x8c1297[_0xfc5f('0xf')]){if(_0x8c1297[_0xfc5f('0xf')][_0xfc5f('0x10')]===0x1f4){logger[_0xfc5f('0xf')](_0xfc5f('0xd'),_0x102633,_0x8c1297[_0xfc5f('0xf')][_0xfc5f('0x11')]);return _0x406252(_0x8c1297[_0xfc5f('0xf')][_0xfc5f('0x11')]);}logger[_0xfc5f('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x102633,_0x8c1297['error'][_0xfc5f('0x11')]);return _0x526213(_0x8c1297[_0xfc5f('0xf')][_0xfc5f('0x11')]);}else{logger[_0xfc5f('0x12')](_0xfc5f('0xd'),_0x102633,_0xfc5f('0xe'));_0x526213(_0x8c1297[_0xfc5f('0x13')]['message']);}})[_0xfc5f('0x14')](function(_0x1a65b3){logger['error'](_0xfc5f('0xd'),_0x102633,_0x1a65b3);_0x406252(_0x1a65b3);});});} \ No newline at end of file +var _0x4294=['MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3ebec3,_0x2c7107){var _0x3cb294=function(_0x4e0990){while(--_0x4e0990){_0x3ebec3['push'](_0x3ebec3['shift']());}};_0x3cb294(++_0x2c7107);}(_0x4294,0x1a9));var _0x4429=function(_0x493a97,_0x50a93e){_0x493a97=_0x493a97-0x0;var _0x51f171=_0x4294[_0x493a97];return _0x51f171;};'use strict';var _=require('lodash');var util=require(_0x4429('0x0'));var moment=require(_0x4429('0x1'));var BPromise=require(_0x4429('0x2'));var rs=require(_0x4429('0x3'));var fs=require('fs');var Redis=require(_0x4429('0x4'));var db=require(_0x4429('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4429('0x6'))(_0x4429('0x7'));var config=require(_0x4429('0x8'));var jayson=require(_0x4429('0x9'));var client=jayson['client'][_0x4429('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dac5,_0x2e2325,_0x3f21d8){return new BPromise(function(_0x1d8892,_0x2da965){return client['request'](_0x3dac5,_0x3f21d8)[_0x4429('0xb')](function(_0x5b240b){logger[_0x4429('0xc')](_0x4429('0xd'),_0x2e2325,_0x4429('0xe'));logger[_0x4429('0xf')](_0x4429('0x10'),_0x2e2325,'request\x20sent',JSON['stringify'](_0x5b240b));if(_0x5b240b[_0x4429('0x11')]){if(_0x5b240b[_0x4429('0x11')][_0x4429('0x12')]===0x1f4){logger[_0x4429('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2e2325,_0x5b240b[_0x4429('0x11')][_0x4429('0x13')]);return _0x2da965(_0x5b240b['error']['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2e2325,_0x5b240b[_0x4429('0x11')][_0x4429('0x13')]);return _0x1d8892(_0x5b240b[_0x4429('0x11')][_0x4429('0x13')]);}else{logger['info'](_0x4429('0xd'),_0x2e2325,'request\x20sent');_0x1d8892(_0x5b240b[_0x4429('0x14')]['message']);}})['catch'](function(_0x2fcc83){logger[_0x4429('0x11')](_0x4429('0xd'),_0x2e2325,_0x2fcc83);_0x2da965(_0x2fcc83);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1f6f3b2..045a225 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 _0x17c2=['/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x17c2,0xef));var _0x217c=function(_0x403e34,_0xd256be){_0x403e34=_0x403e34-0x0;var _0x11ad75=_0x17c2[_0x403e34];return _0x11ad75;};'use strict';var multer=require(_0x217c('0x0'));var util=require(_0x217c('0x1'));var path=require(_0x217c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x217c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x217c('0x4'));var config=require(_0x217c('0x5'));var controller=require('./memberReport.controller');router[_0x217c('0x6')]('/',auth['isAuthenticated'](),controller[_0x217c('0x7')]);router[_0x217c('0x6')](_0x217c('0x8'),auth[_0x217c('0x9')](),controller[_0x217c('0xa')]);router[_0x217c('0x6')](_0x217c('0xb'),auth[_0x217c('0x9')](),controller[_0x217c('0xc')]);router[_0x217c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x217c('0xe')](_0x217c('0xb'),auth['isAuthenticated'](),controller[_0x217c('0xf')]);router[_0x217c('0x10')](_0x217c('0xb'),auth[_0x217c('0x9')](),controller[_0x217c('0x11')]);module[_0x217c('0x12')]=router; \ No newline at end of file +var _0x43e4=['../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x59c56f,_0x59e85a){var _0x29ab55=function(_0x2d1008){while(--_0x2d1008){_0x59c56f['push'](_0x59c56f['shift']());}};_0x29ab55(++_0x59e85a);}(_0x43e4,0x140));var _0x443e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x43e4[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x443e('0x0'));var path=require('path');var timeout=require(_0x443e('0x1'));var express=require('express');var router=express[_0x443e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x443e('0x3'));var config=require(_0x443e('0x4'));var controller=require(_0x443e('0x5'));router['get']('/',auth[_0x443e('0x6')](),controller[_0x443e('0x7')]);router[_0x443e('0x8')](_0x443e('0x9'),auth[_0x443e('0x6')](),controller[_0x443e('0xa')]);router[_0x443e('0x8')](_0x443e('0xb'),auth[_0x443e('0x6')](),controller['show']);router[_0x443e('0xc')]('/',auth[_0x443e('0x6')](),controller[_0x443e('0xd')]);router['put'](_0x443e('0xb'),auth[_0x443e('0x6')](),controller[_0x443e('0xe')]);router[_0x443e('0xf')](_0x443e('0xb'),auth[_0x443e('0x6')](),controller[_0x443e('0x10')]);module[_0x443e('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c75662e..8817324 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 _0x8c14=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x3ebfca,_0x8f884c){var _0x2ed64a=function(_0x267af0){while(--_0x267af0){_0x3ebfca['push'](_0x3ebfca['shift']());}};_0x2ed64a(++_0x8f884c);}(_0x8c14,0x1f0));var _0x48c1=function(_0x52fe72,_0xa9ff4b){_0x52fe72=_0x52fe72-0x0;var _0x11edcc=_0x8c14[_0x52fe72];return _0x11edcc;};'use strict';var Sequelize=require(_0x48c1('0x0'));var moment=require(_0x48c1('0x1'));module[_0x48c1('0x2')]={'channel':{'type':Sequelize[_0x48c1('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x48c1('0x3')]},'type':{'type':Sequelize[_0x48c1('0x3')],'defaultValue':_0x48c1('0x4'),'comment':_0x48c1('0x5')},'duration':{'type':Sequelize[_0x48c1('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x48c1('0x7')],'set':function(_0x2e55d0){var _0x4dabfb=moment(_0x2e55d0);var _0x75ff17=moment(this[_0x48c1('0x8')](_0x48c1('0x9')));var _0x3a9566=_0x4dabfb['diff'](_0x75ff17,_0x48c1('0xa'));this[_0x48c1('0xb')]('exitAt',_0x2e55d0);this[_0x48c1('0xb')](_0x48c1('0xc'),_0x3a9566||null);}},'data1':{'type':Sequelize[_0x48c1('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x48c1('0xd')},'data3':{'type':Sequelize[_0x48c1('0x3')],'comment':_0x48c1('0xe')},'data4':{'type':Sequelize[_0x48c1('0x3')],'comment':_0x48c1('0xf')},'data5':{'type':Sequelize[_0x48c1('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x48c1('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3161=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x40f6e9,_0x1cc6cf){var _0x605d54=function(_0x1c52aa){while(--_0x1c52aa){_0x40f6e9['push'](_0x40f6e9['shift']());}};_0x605d54(++_0x1cc6cf);}(_0x3161,0x168));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1316('0x0'));var moment=require(_0x1316('0x1'));module[_0x1316('0x2')]={'channel':{'type':Sequelize[_0x1316('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1316('0x3')]},'type':{'type':Sequelize[_0x1316('0x3')],'defaultValue':_0x1316('0x4'),'comment':_0x1316('0x5')},'duration':{'type':Sequelize[_0x1316('0x6')]},'enterAt':{'type':Sequelize[_0x1316('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x164bc6){var _0x166824=moment(_0x164bc6);var _0x4d3b57=moment(this['getDataValue']('enterAt'));var _0x197ccb=_0x166824[_0x1316('0x8')](_0x4d3b57,_0x1316('0x9'));this[_0x1316('0xa')](_0x1316('0xb'),_0x164bc6);this[_0x1316('0xa')]('duration',_0x197ccb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x1316('0xc')},'data2':{'type':Sequelize[_0x1316('0x3')],'comment':_0x1316('0xd')},'data3':{'type':Sequelize[_0x1316('0x3')],'comment':_0x1316('0xe')},'data4':{'type':Sequelize[_0x1316('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x1316('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x1316('0x3')]},'internal':{'type':Sequelize[_0x1316('0x6')]},'uniqueid':{'type':Sequelize[_0x1316('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e3a126e..a9e09a7 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 _0xa4d4=['path','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','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','name','send','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x181052,_0x5e5cdd){var _0x59d396=function(_0x488b0f){while(--_0x488b0f){_0x181052['push'](_0x181052['shift']());}};_0x59d396(++_0x5e5cdd);}(_0xa4d4,0x1ba));var _0x4a4d=function(_0x5ec5d1,_0x2b42cf){_0x5ec5d1=_0x5ec5d1-0x0;var _0x38744b=_0xa4d4[_0x5ec5d1];return _0x38744b;};'use strict';var pdf=require(_0x4a4d('0x0'));var emlformat=require(_0x4a4d('0x1'));var rimraf=require(_0x4a4d('0x2'));var zipdir=require(_0x4a4d('0x3'));var jsonpatch=require(_0x4a4d('0x4'));var rp=require(_0x4a4d('0x5'));var moment=require('moment');var BPromise=require(_0x4a4d('0x6'));var Mustache=require(_0x4a4d('0x7'));var util=require('util');var path=require(_0x4a4d('0x8'));var sox=require('sox');var csv=require(_0x4a4d('0x9'));var ejs=require(_0x4a4d('0xa'));var fs=require('fs');var _=require(_0x4a4d('0xb'));var squel=require(_0x4a4d('0xc'));var crypto=require(_0x4a4d('0xd'));var jsforce=require(_0x4a4d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a4d('0xf'));var Papa=require(_0x4a4d('0x10'));var Redis=require(_0x4a4d('0x11'));var authService=require(_0x4a4d('0x12'));var qs=require(_0x4a4d('0x13'));var as=require(_0x4a4d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a4d('0x15'))(_0x4a4d('0x16'));var utils=require(_0x4a4d('0x17'));var config=require(_0x4a4d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cf82d,_0x4c04e4){_0x4c04e4=_0x4c04e4||0xcc;return function(_0x3581c4){if(_0x3581c4){return _0x3cf82d[_0x4a4d('0x19')](_0x4c04e4);}return _0x3cf82d[_0x4a4d('0x1a')](_0x4c04e4)[_0x4a4d('0x1b')]();};}function respondWithResult(_0x4d938b,_0x36c71d){_0x36c71d=_0x36c71d||0xc8;return function(_0x5709d6){if(_0x5709d6){return _0x4d938b[_0x4a4d('0x1a')](_0x36c71d)[_0x4a4d('0x1c')](_0x5709d6);}};}function respondWithFilteredResult(_0x376d81,_0x346add){return function(_0x2cc8b7){if(_0x2cc8b7){var _0x258a99=_0x2cc8b7['count'],_0x3064ea=_0x346add[_0x4a4d('0x1d')],_0x58104d=_0x346add[_0x4a4d('0x1d')]+_0x346add['limit'],_0x43db22;if(_0x58104d>=_0x258a99){_0x58104d=_0x258a99;_0x43db22=0xc8;}else{_0x43db22=0xce;}_0x376d81[_0x4a4d('0x1a')](_0x43db22);return _0x376d81[_0x4a4d('0x1e')](_0x4a4d('0x1f'),_0x3064ea+'-'+_0x58104d+'/'+_0x258a99)[_0x4a4d('0x1c')](_0x2cc8b7);}return null;};}function patchUpdates(_0x2be72d){return function(_0x343510){try{jsonpatch['apply'](_0x343510,_0x2be72d,!![]);}catch(_0x24b3df){return BPromise[_0x4a4d('0x20')](_0x24b3df);}return _0x343510[_0x4a4d('0x21')]();};}function saveUpdates(_0x21b857,_0x3c5c0a){return function(_0x5729a4){if(_0x5729a4){return _0x5729a4[_0x4a4d('0x22')](_0x21b857)[_0x4a4d('0x23')](function(_0xbaa683){return _0xbaa683;});}return null;};}function removeEntity(_0x48f207,_0x2dc817){return function(_0x5a1f16){if(_0x5a1f16){return _0x5a1f16[_0x4a4d('0x24')]()[_0x4a4d('0x23')](function(){_0x48f207['status'](0xcc)[_0x4a4d('0x1b')]();});}};}function handleEntityNotFound(_0x529eaa,_0x37a28e){return function(_0x13418e){if(!_0x13418e){_0x529eaa[_0x4a4d('0x19')](0x194);}return _0x13418e;};}function handleError(_0x247248,_0x5b1889){_0x5b1889=_0x5b1889||0x1f4;return function(_0x12cc07){logger['error'](_0x12cc07['stack']);if(_0x12cc07[_0x4a4d('0x25')]){delete _0x12cc07[_0x4a4d('0x25')];}_0x247248[_0x4a4d('0x1a')](_0x5b1889)[_0x4a4d('0x26')](_0x12cc07);};}exports['index']=function(_0x31dd92,_0x291304){var _0x98c1bc={},_0xb85139={},_0x33bc6c={'count':0x0,'rows':[]};var _0x3c3363=_[_0x4a4d('0x27')](db[_0x4a4d('0x28')][_0x4a4d('0x29')],function(_0x12a1f6){return{'name':_0x12a1f6[_0x4a4d('0x2a')],'type':_0x12a1f6[_0x4a4d('0x2b')]['key']};});_0xb85139[_0x4a4d('0x2c')]=_['map'](_0x3c3363,_0x4a4d('0x25'));_0xb85139[_0x4a4d('0x2d')]=_[_0x4a4d('0x2e')](_0x31dd92[_0x4a4d('0x2d')]);_0xb85139[_0x4a4d('0x2f')]=_[_0x4a4d('0x30')](_0xb85139[_0x4a4d('0x2c')],_0xb85139['query']);_0x98c1bc[_0x4a4d('0x31')]=_[_0x4a4d('0x30')](_0xb85139['model'],qs[_0x4a4d('0x32')](_0x31dd92[_0x4a4d('0x2d')][_0x4a4d('0x32')]));_0x98c1bc[_0x4a4d('0x31')]=_0x98c1bc['attributes'][_0x4a4d('0x33')]?_0x98c1bc[_0x4a4d('0x31')]:_0xb85139[_0x4a4d('0x2c')];if(!_0x31dd92['query'][_0x4a4d('0x34')](_0x4a4d('0x35'))){_0x98c1bc[_0x4a4d('0x36')]=qs[_0x4a4d('0x36')](_0x31dd92['query'][_0x4a4d('0x36')]);_0x98c1bc[_0x4a4d('0x1d')]=qs[_0x4a4d('0x1d')](_0x31dd92['query']['offset']);}_0x98c1bc[_0x4a4d('0x37')]=qs[_0x4a4d('0x38')](_0x31dd92[_0x4a4d('0x2d')][_0x4a4d('0x38')]);_0x98c1bc[_0x4a4d('0x39')]=qs[_0x4a4d('0x2f')](_[_0x4a4d('0x3a')](_0x31dd92['query'],_0xb85139[_0x4a4d('0x2f')]),_0x3c3363);if(_0x31dd92[_0x4a4d('0x2d')][_0x4a4d('0x3b')]){_0x98c1bc['where']=_['merge'](_0x98c1bc[_0x4a4d('0x39')],{'$or':_['map'](_0x3c3363,function(_0x54d71e){if(_0x54d71e[_0x4a4d('0x2b')]!==_0x4a4d('0x3c')){var _0x5640d4={};_0x5640d4[_0x54d71e[_0x4a4d('0x25')]]={'$like':'%'+_0x31dd92[_0x4a4d('0x2d')][_0x4a4d('0x3b')]+'%'};return _0x5640d4;}})});}_0x98c1bc=_[_0x4a4d('0x3d')]({},_0x98c1bc,_0x31dd92[_0x4a4d('0x3e')]);var _0x1978b={'where':_0x98c1bc[_0x4a4d('0x39')]};return db['MemberReport'][_0x4a4d('0x3f')](_0x1978b)[_0x4a4d('0x23')](function(_0x3c2731){_0x33bc6c[_0x4a4d('0x3f')]=_0x3c2731;if(_0x31dd92[_0x4a4d('0x2d')][_0x4a4d('0x40')]){_0x98c1bc[_0x4a4d('0x41')]=[{'all':!![]}];}return db['MemberReport'][_0x4a4d('0x42')](_0x98c1bc);})[_0x4a4d('0x23')](function(_0x2295a2){_0x33bc6c[_0x4a4d('0x43')]=_0x2295a2;return _0x33bc6c;})['then'](respondWithFilteredResult(_0x291304,_0x98c1bc))[_0x4a4d('0x44')](handleError(_0x291304,null));};exports[_0x4a4d('0x45')]=function(_0x3a8255,_0x5935c3){var _0x26de62={'raw':!![],'where':{'id':_0x3a8255[_0x4a4d('0x46')]['id']}},_0xbd6379={};_0xbd6379['model']=_[_0x4a4d('0x2e')](db[_0x4a4d('0x28')][_0x4a4d('0x29')]);_0xbd6379[_0x4a4d('0x2d')]=_[_0x4a4d('0x2e')](_0x3a8255[_0x4a4d('0x2d')]);_0xbd6379['filters']=_[_0x4a4d('0x30')](_0xbd6379[_0x4a4d('0x2c')],_0xbd6379['query']);_0x26de62[_0x4a4d('0x31')]=_['intersection'](_0xbd6379[_0x4a4d('0x2c')],qs[_0x4a4d('0x32')](_0x3a8255[_0x4a4d('0x2d')]['fields']));_0x26de62[_0x4a4d('0x31')]=_0x26de62[_0x4a4d('0x31')][_0x4a4d('0x33')]?_0x26de62[_0x4a4d('0x31')]:_0xbd6379[_0x4a4d('0x2c')];if(_0x3a8255['query'][_0x4a4d('0x40')]){_0x26de62[_0x4a4d('0x41')]=[{'all':!![]}];}_0x26de62=_[_0x4a4d('0x3d')]({},_0x26de62,_0x3a8255[_0x4a4d('0x3e')]);return db[_0x4a4d('0x28')][_0x4a4d('0x47')](_0x26de62)[_0x4a4d('0x23')](handleEntityNotFound(_0x5935c3,null))[_0x4a4d('0x23')](respondWithResult(_0x5935c3,null))['catch'](handleError(_0x5935c3,null));};exports[_0x4a4d('0x48')]=function(_0x1e00f5,_0x933bb0){return db[_0x4a4d('0x28')][_0x4a4d('0x48')](_0x1e00f5[_0x4a4d('0x49')],{})['then'](respondWithResult(_0x933bb0,0xc9))[_0x4a4d('0x44')](handleError(_0x933bb0,null));};exports[_0x4a4d('0x22')]=function(_0x12113b,_0x295e9a){if(_0x12113b[_0x4a4d('0x49')]['id']){delete _0x12113b[_0x4a4d('0x49')]['id'];}return db[_0x4a4d('0x28')][_0x4a4d('0x47')]({'where':{'id':_0x12113b[_0x4a4d('0x46')]['id']}})[_0x4a4d('0x23')](handleEntityNotFound(_0x295e9a,null))['then'](saveUpdates(_0x12113b['body'],null))['then'](respondWithResult(_0x295e9a,null))[_0x4a4d('0x44')](handleError(_0x295e9a,null));};exports[_0x4a4d('0x24')]=function(_0x432c63,_0x3796f3){return db[_0x4a4d('0x28')]['find']({'where':{'id':_0x432c63[_0x4a4d('0x46')]['id']}})[_0x4a4d('0x23')](handleEntityNotFound(_0x3796f3,null))[_0x4a4d('0x23')](removeEntity(_0x3796f3,null))[_0x4a4d('0x44')](handleError(_0x3796f3,null));};exports[_0x4a4d('0x4a')]=function(_0x27927c,_0x118412){return db[_0x4a4d('0x28')][_0x4a4d('0x4a')]()[_0x4a4d('0x23')](respondWithResult(_0x118412,null))['catch'](handleError(_0x118412,null));}; \ No newline at end of file +var _0xa359=['save','update','then','stack','name','send','index','map','MemberReport','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','describe','rimraf','request-promise','mustache','util','path','sox','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','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x35f030,_0x578800){var _0x474559=function(_0x54f81d){while(--_0x54f81d){_0x35f030['push'](_0x35f030['shift']());}};_0x474559(++_0x578800);}(_0xa359,0x192));var _0x9a35=function(_0x1c7f85,_0xa1f24a){_0x1c7f85=_0x1c7f85-0x0;var _0x2e2d9e=_0xa359[_0x1c7f85];return _0x2e2d9e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9a35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a35('0x2'));var util=require(_0x9a35('0x3'));var path=require(_0x9a35('0x4'));var sox=require(_0x9a35('0x5'));var csv=require(_0x9a35('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a35('0x7'));var squel=require(_0x9a35('0x8'));var crypto=require(_0x9a35('0x9'));var jsforce=require(_0x9a35('0xa'));var deskjs=require(_0x9a35('0xb'));var toCsv=require(_0x9a35('0x6'));var querystring=require(_0x9a35('0xc'));var Papa=require('papaparse');var Redis=require(_0x9a35('0xd'));var authService=require(_0x9a35('0xe'));var qs=require(_0x9a35('0xf'));var as=require(_0x9a35('0x10'));var hardwareService=require(_0x9a35('0x11'));var logger=require(_0x9a35('0x12'))(_0x9a35('0x13'));var utils=require(_0x9a35('0x14'));var config=require(_0x9a35('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a1653,_0x23811a){_0x23811a=_0x23811a||0xcc;return function(_0x39853f){if(_0x39853f){return _0x5a1653[_0x9a35('0x16')](_0x23811a);}return _0x5a1653[_0x9a35('0x17')](_0x23811a)[_0x9a35('0x18')]();};}function respondWithResult(_0x3a7076,_0x45fa6c){_0x45fa6c=_0x45fa6c||0xc8;return function(_0x1de621){if(_0x1de621){return _0x3a7076[_0x9a35('0x17')](_0x45fa6c)[_0x9a35('0x19')](_0x1de621);}};}function respondWithFilteredResult(_0x1f5797,_0x45b695){return function(_0x1bd0c2){if(_0x1bd0c2){var _0x2b77d9=_0x1bd0c2['count'],_0x418796=_0x45b695[_0x9a35('0x1a')],_0x333eb5=_0x45b695[_0x9a35('0x1a')]+_0x45b695[_0x9a35('0x1b')],_0x57191d;if(_0x333eb5>=_0x2b77d9){_0x333eb5=_0x2b77d9;_0x57191d=0xc8;}else{_0x57191d=0xce;}_0x1f5797[_0x9a35('0x17')](_0x57191d);return _0x1f5797[_0x9a35('0x1c')](_0x9a35('0x1d'),_0x418796+'-'+_0x333eb5+'/'+_0x2b77d9)[_0x9a35('0x19')](_0x1bd0c2);}return null;};}function patchUpdates(_0x415600){return function(_0x192bb5){try{jsonpatch['apply'](_0x192bb5,_0x415600,!![]);}catch(_0x1246f2){return BPromise['reject'](_0x1246f2);}return _0x192bb5[_0x9a35('0x1e')]();};}function saveUpdates(_0x281904,_0x339423){return function(_0x12f07f){if(_0x12f07f){return _0x12f07f[_0x9a35('0x1f')](_0x281904)[_0x9a35('0x20')](function(_0x27e0bf){return _0x27e0bf;});}return null;};}function removeEntity(_0x2fba28,_0x1e47c5){return function(_0x525e92){if(_0x525e92){return _0x525e92['destroy']()[_0x9a35('0x20')](function(){_0x2fba28[_0x9a35('0x17')](0xcc)[_0x9a35('0x18')]();});}};}function handleEntityNotFound(_0x2ae31d,_0x2b3822){return function(_0x8ec43e){if(!_0x8ec43e){_0x2ae31d[_0x9a35('0x16')](0x194);}return _0x8ec43e;};}function handleError(_0x4fbb97,_0x46d962){_0x46d962=_0x46d962||0x1f4;return function(_0x273aec){logger['error'](_0x273aec[_0x9a35('0x21')]);if(_0x273aec[_0x9a35('0x22')]){delete _0x273aec[_0x9a35('0x22')];}_0x4fbb97[_0x9a35('0x17')](_0x46d962)[_0x9a35('0x23')](_0x273aec);};}exports[_0x9a35('0x24')]=function(_0x56be69,_0x1903c3){var _0x383aef={},_0x1334c3={},_0x425d12={'count':0x0,'rows':[]};var _0x1c6742=_[_0x9a35('0x25')](db[_0x9a35('0x26')]['rawAttributes'],function(_0x430273){return{'name':_0x430273[_0x9a35('0x27')],'type':_0x430273[_0x9a35('0x28')][_0x9a35('0x29')]};});_0x1334c3[_0x9a35('0x2a')]=_[_0x9a35('0x25')](_0x1c6742,_0x9a35('0x22'));_0x1334c3['query']=_[_0x9a35('0x2b')](_0x56be69['query']);_0x1334c3[_0x9a35('0x2c')]=_[_0x9a35('0x2d')](_0x1334c3[_0x9a35('0x2a')],_0x1334c3[_0x9a35('0x2e')]);_0x383aef['attributes']=_['intersection'](_0x1334c3[_0x9a35('0x2a')],qs[_0x9a35('0x2f')](_0x56be69[_0x9a35('0x2e')][_0x9a35('0x2f')]));_0x383aef[_0x9a35('0x30')]=_0x383aef['attributes'][_0x9a35('0x31')]?_0x383aef[_0x9a35('0x30')]:_0x1334c3['model'];if(!_0x56be69[_0x9a35('0x2e')]['hasOwnProperty'](_0x9a35('0x32'))){_0x383aef[_0x9a35('0x1b')]=qs['limit'](_0x56be69['query']['limit']);_0x383aef[_0x9a35('0x1a')]=qs[_0x9a35('0x1a')](_0x56be69[_0x9a35('0x2e')][_0x9a35('0x1a')]);}_0x383aef[_0x9a35('0x33')]=qs['sort'](_0x56be69['query'][_0x9a35('0x34')]);_0x383aef[_0x9a35('0x35')]=qs[_0x9a35('0x2c')](_['pick'](_0x56be69[_0x9a35('0x2e')],_0x1334c3[_0x9a35('0x2c')]),_0x1c6742);if(_0x56be69[_0x9a35('0x2e')]['filter']){_0x383aef[_0x9a35('0x35')]=_[_0x9a35('0x36')](_0x383aef[_0x9a35('0x35')],{'$or':_[_0x9a35('0x25')](_0x1c6742,function(_0x3f7933){if(_0x3f7933['type']!==_0x9a35('0x37')){var _0x9f3a0={};_0x9f3a0[_0x3f7933[_0x9a35('0x22')]]={'$like':'%'+_0x56be69['query'][_0x9a35('0x38')]+'%'};return _0x9f3a0;}})});}_0x383aef=_[_0x9a35('0x36')]({},_0x383aef,_0x56be69[_0x9a35('0x39')]);var _0x44f80f={'where':_0x383aef[_0x9a35('0x35')]};return db[_0x9a35('0x26')][_0x9a35('0x3a')](_0x44f80f)['then'](function(_0x5bd6fa){_0x425d12[_0x9a35('0x3a')]=_0x5bd6fa;if(_0x56be69[_0x9a35('0x2e')][_0x9a35('0x3b')]){_0x383aef[_0x9a35('0x3c')]=[{'all':!![]}];}return db[_0x9a35('0x26')][_0x9a35('0x3d')](_0x383aef);})[_0x9a35('0x20')](function(_0x4cef4e){_0x425d12[_0x9a35('0x3e')]=_0x4cef4e;return _0x425d12;})[_0x9a35('0x20')](respondWithFilteredResult(_0x1903c3,_0x383aef))[_0x9a35('0x3f')](handleError(_0x1903c3,null));};exports[_0x9a35('0x40')]=function(_0x288917,_0x248923){var _0x1eee7c={'raw':!![],'where':{'id':_0x288917[_0x9a35('0x41')]['id']}},_0x6231ad={};_0x6231ad[_0x9a35('0x2a')]=_[_0x9a35('0x2b')](db[_0x9a35('0x26')][_0x9a35('0x42')]);_0x6231ad[_0x9a35('0x2e')]=_[_0x9a35('0x2b')](_0x288917[_0x9a35('0x2e')]);_0x6231ad[_0x9a35('0x2c')]=_['intersection'](_0x6231ad[_0x9a35('0x2a')],_0x6231ad[_0x9a35('0x2e')]);_0x1eee7c[_0x9a35('0x30')]=_[_0x9a35('0x2d')](_0x6231ad[_0x9a35('0x2a')],qs['fields'](_0x288917['query'][_0x9a35('0x2f')]));_0x1eee7c[_0x9a35('0x30')]=_0x1eee7c['attributes'][_0x9a35('0x31')]?_0x1eee7c[_0x9a35('0x30')]:_0x6231ad[_0x9a35('0x2a')];if(_0x288917[_0x9a35('0x2e')][_0x9a35('0x3b')]){_0x1eee7c[_0x9a35('0x3c')]=[{'all':!![]}];}_0x1eee7c=_[_0x9a35('0x36')]({},_0x1eee7c,_0x288917[_0x9a35('0x39')]);return db[_0x9a35('0x26')]['find'](_0x1eee7c)[_0x9a35('0x20')](handleEntityNotFound(_0x248923,null))[_0x9a35('0x20')](respondWithResult(_0x248923,null))[_0x9a35('0x3f')](handleError(_0x248923,null));};exports[_0x9a35('0x43')]=function(_0x630acc,_0x3d9d49){return db[_0x9a35('0x26')][_0x9a35('0x43')](_0x630acc[_0x9a35('0x44')],{})[_0x9a35('0x20')](respondWithResult(_0x3d9d49,0xc9))[_0x9a35('0x3f')](handleError(_0x3d9d49,null));};exports[_0x9a35('0x1f')]=function(_0x4392c4,_0x1feded){if(_0x4392c4[_0x9a35('0x44')]['id']){delete _0x4392c4[_0x9a35('0x44')]['id'];}return db['MemberReport'][_0x9a35('0x45')]({'where':{'id':_0x4392c4['params']['id']}})[_0x9a35('0x20')](handleEntityNotFound(_0x1feded,null))[_0x9a35('0x20')](saveUpdates(_0x4392c4[_0x9a35('0x44')],null))[_0x9a35('0x20')](respondWithResult(_0x1feded,null))[_0x9a35('0x3f')](handleError(_0x1feded,null));};exports[_0x9a35('0x46')]=function(_0x5bec09,_0x588005){return db[_0x9a35('0x26')][_0x9a35('0x45')]({'where':{'id':_0x5bec09[_0x9a35('0x41')]['id']}})[_0x9a35('0x20')](handleEntityNotFound(_0x588005,null))[_0x9a35('0x20')](removeEntity(_0x588005,null))[_0x9a35('0x3f')](handleError(_0x588005,null));};exports[_0x9a35('0x47')]=function(_0x331792,_0xe8d143){return db['MemberReport']['describe']()[_0x9a35('0x20')](respondWithResult(_0xe8d143,null))['catch'](handleError(_0xe8d143,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6ce80b1..3d38527 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 _0x84ab=['exports','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./memberReport.attributes'];(function(_0x2972cf,_0x343fde){var _0x4c173f=function(_0x30eb3a){while(--_0x30eb3a){_0x2972cf['push'](_0x2972cf['shift']());}};_0x4c173f(++_0x343fde);}(_0x84ab,0x12f));var _0xb84a=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x84ab[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xb84a('0xb'),'fields':[_0xb84a('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6737=['membername','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes'];(function(_0xa3d440,_0x2978cb){var _0x2a17a9=function(_0x59318a){while(--_0x59318a){_0xa3d440['push'](_0xa3d440['shift']());}};_0x2a17a9(++_0x2978cb);}(_0x6737,0xe2));var _0x7673=function(_0xcb3ad8,_0x106b9b){_0xcb3ad8=_0xcb3ad8-0x0;var _0xeca5b7=_0x6737[_0xcb3ad8];return _0xeca5b7;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x7673('0x8'),'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 443d281..4036791 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 _0x756f=['error','code','MemberReport,\x20%s,\x20%s','message','result','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','raw','update','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b49e9,_0x5c3201){var _0x4062cd=function(_0x412d31){while(--_0x412d31){_0x3b49e9['push'](_0x3b49e9['shift']());}};_0x4062cd(++_0x5c3201);}(_0x756f,0x127));var _0xf756=function(_0x3982f3,_0x242251){_0x3982f3=_0x3982f3-0x0;var _0x18ded5=_0x756f[_0x3982f3];return _0x18ded5;};'use strict';var _=require('lodash');var util=require(_0xf756('0x0'));var moment=require(_0xf756('0x1'));var BPromise=require(_0xf756('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf756('0x3'));var db=require(_0xf756('0x4'))['db'];var utils=require(_0xf756('0x5'));var logger=require(_0xf756('0x6'))(_0xf756('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf756('0x8')][_0xf756('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c53c0,_0x2624a2,_0x65378f){return new BPromise(function(_0x119195,_0x255b85){return client[_0xf756('0xa')](_0x7c53c0,_0x65378f)[_0xf756('0xb')](function(_0x1b85ba){logger[_0xf756('0xc')]('MemberReport,\x20%s,\x20%s',_0x2624a2,_0xf756('0xd'));logger[_0xf756('0xe')](_0xf756('0xf'),_0x2624a2,_0xf756('0xd'),JSON[_0xf756('0x10')](_0x1b85ba));if(_0x1b85ba[_0xf756('0x11')]){if(_0x1b85ba['error'][_0xf756('0x12')]===0x1f4){logger[_0xf756('0x11')](_0xf756('0x13'),_0x2624a2,_0x1b85ba['error'][_0xf756('0x14')]);return _0x255b85(_0x1b85ba[_0xf756('0x11')][_0xf756('0x14')]);}logger[_0xf756('0x11')](_0xf756('0x13'),_0x2624a2,_0x1b85ba[_0xf756('0x11')]['message']);return _0x119195(_0x1b85ba[_0xf756('0x11')][_0xf756('0x14')]);}else{logger[_0xf756('0xc')](_0xf756('0x13'),_0x2624a2,'request\x20sent');_0x119195(_0x1b85ba[_0xf756('0x15')][_0xf756('0x14')]);}})[_0xf756('0x16')](function(_0x3b0171){logger[_0xf756('0x11')](_0xf756('0x13'),_0x2624a2,_0x3b0171);_0x255b85(_0x3b0171);});});}exports['GetMemberReport']=function(_0x10d831){var _0x31b484=this;return new Promise(function(_0x158501,_0x5a1643){return db[_0xf756('0x17')][_0xf756('0x18')]({'raw':_0x10d831[_0xf756('0x19')]?_0x10d831['options']['raw']===undefined?!![]:![]:!![],'where':_0x10d831[_0xf756('0x19')]?_0x10d831[_0xf756('0x19')][_0xf756('0x1a')]||null:null,'attributes':_0x10d831[_0xf756('0x19')]?_0x10d831['options'][_0xf756('0x1b')]||null:null,'limit':_0x10d831[_0xf756('0x19')]?_0x10d831[_0xf756('0x19')][_0xf756('0x1c')]||null:null,'include':_0x10d831[_0xf756('0x19')]?_0x10d831[_0xf756('0x19')][_0xf756('0x1d')]?_[_0xf756('0x1e')](_0x10d831[_0xf756('0x19')][_0xf756('0x1d')],function(_0x53bf9b){return{'model':db[_0x53bf9b[_0xf756('0x1f')]],'as':_0x53bf9b['as'],'attributes':_0x53bf9b[_0xf756('0x1b')],'include':_0x53bf9b[_0xf756('0x1d')]?_['map'](_0x53bf9b[_0xf756('0x1d')],function(_0x17678c){return{'model':db[_0x17678c[_0xf756('0x1f')]],'as':_0x17678c['as'],'attributes':_0x17678c['attributes'],'include':_0x17678c[_0xf756('0x1d')]?_['map'](_0x17678c[_0xf756('0x1d')],function(_0x57aff4){return{'model':db[_0x57aff4['model']],'as':_0x57aff4['as'],'attributes':_0x57aff4[_0xf756('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf756('0xb')](function(_0x54cd50){logger[_0xf756('0xc')](_0xf756('0x20'),_0x10d831);logger[_0xf756('0xe')](_0xf756('0x20'),_0x10d831,JSON[_0xf756('0x10')](_0x54cd50));_0x158501(_0x54cd50);})[_0xf756('0x16')](function(_0x3ce885){logger[_0xf756('0x11')](_0xf756('0x20'),_0x3ce885['message'],_0x10d831);_0x5a1643(_0x31b484[_0xf756('0x11')](0x1f4,_0x3ce885[_0xf756('0x14')]));});});};exports[_0xf756('0x21')]=function(_0x30f278){var _0x2d742c=this;return new Promise(function(_0x5eb2a5,_0x515c39){return db[_0xf756('0x17')][_0xf756('0x22')](_0x30f278[_0xf756('0x23')],{'raw':_0x30f278[_0xf756('0x19')]?_0x30f278['options'][_0xf756('0x24')]===undefined?!![]:![]:!![]})[_0xf756('0xb')](function(_0x4bc851){logger[_0xf756('0xc')]('CreateMemberReport',_0x30f278);logger[_0xf756('0xe')](_0xf756('0x21'),_0x30f278,JSON[_0xf756('0x10')](_0x4bc851));_0x5eb2a5(_0x4bc851);})[_0xf756('0x16')](function(_0xb2b87){logger[_0xf756('0x11')](_0xf756('0x21'),_0xb2b87['message'],_0x30f278);_0x515c39(_0x2d742c[_0xf756('0x11')](0x1f4,_0xb2b87[_0xf756('0x14')]));});});};exports['UpdateMemberReport']=function(_0x4806e7){var _0xaff053=this;return new Promise(function(_0x23b4fe,_0x31403b){return db[_0xf756('0x17')][_0xf756('0x25')](_0x4806e7[_0xf756('0x23')],{'raw':_0x4806e7[_0xf756('0x19')]?_0x4806e7[_0xf756('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4806e7[_0xf756('0x19')]?_0x4806e7[_0xf756('0x19')][_0xf756('0x1a')]||null:null,'attributes':_0x4806e7[_0xf756('0x19')]?_0x4806e7[_0xf756('0x19')][_0xf756('0x1b')]||null:null,'limit':_0x4806e7[_0xf756('0x19')]?_0x4806e7[_0xf756('0x19')][_0xf756('0x1c')]||null:null})[_0xf756('0xb')](function(_0x20f4a1){logger[_0xf756('0xc')](_0xf756('0x26'),_0x4806e7);logger[_0xf756('0xe')]('UpdateMemberReport',_0x4806e7,JSON['stringify'](_0x20f4a1));_0x23b4fe(_0x20f4a1);})['catch'](function(_0x19ed58){logger[_0xf756('0x11')](_0xf756('0x26'),_0x19ed58['message'],_0x4806e7);_0x31403b(_0xaff053['error'](0x1f4,_0x19ed58[_0xf756('0x14')]));});});}; \ No newline at end of file +var _0x45fd=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','MemberReport','findAll','options','raw','where','limit','include','attributes','map','model','GetMemberReport','catch','create','body','CreateMemberReport','update','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x7c7b04,_0x11a118){var _0x18a71f=function(_0x2894f8){while(--_0x2894f8){_0x7c7b04['push'](_0x7c7b04['shift']());}};_0x18a71f(++_0x11a118);}(_0x45fd,0xac));var _0xd45f=function(_0x2686b1,_0x234265){_0x2686b1=_0x2686b1-0x0;var _0x269fce=_0x45fd[_0x2686b1];return _0x269fce;};'use strict';var _=require(_0xd45f('0x0'));var util=require(_0xd45f('0x1'));var moment=require('moment');var BPromise=require(_0xd45f('0x2'));var rs=require(_0xd45f('0x3'));var fs=require('fs');var Redis=require(_0xd45f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd45f('0x5'));var logger=require(_0xd45f('0x6'))(_0xd45f('0x7'));var config=require(_0xd45f('0x8'));var jayson=require(_0xd45f('0x9'));var client=jayson[_0xd45f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c963,_0x4227da,_0x2219cf){return new BPromise(function(_0x2cd4d6,_0x4dedde){return client['request'](_0x33c963,_0x2219cf)[_0xd45f('0xb')](function(_0xeaa067){logger[_0xd45f('0xc')](_0xd45f('0xd'),_0x4227da,_0xd45f('0xe'));logger[_0xd45f('0xf')](_0xd45f('0x10'),_0x4227da,_0xd45f('0xe'),JSON[_0xd45f('0x11')](_0xeaa067));if(_0xeaa067[_0xd45f('0x12')]){if(_0xeaa067['error']['code']===0x1f4){logger[_0xd45f('0x12')](_0xd45f('0xd'),_0x4227da,_0xeaa067[_0xd45f('0x12')][_0xd45f('0x13')]);return _0x4dedde(_0xeaa067[_0xd45f('0x12')]['message']);}logger[_0xd45f('0x12')](_0xd45f('0xd'),_0x4227da,_0xeaa067[_0xd45f('0x12')]['message']);return _0x2cd4d6(_0xeaa067[_0xd45f('0x12')][_0xd45f('0x13')]);}else{logger[_0xd45f('0xc')](_0xd45f('0xd'),_0x4227da,_0xd45f('0xe'));_0x2cd4d6(_0xeaa067['result'][_0xd45f('0x13')]);}})['catch'](function(_0x4896bf){logger['error'](_0xd45f('0xd'),_0x4227da,_0x4896bf);_0x4dedde(_0x4896bf);});});}exports['GetMemberReport']=function(_0x5825bf){var _0x3d7391=this;return new Promise(function(_0xb4e533,_0x4d074b){return db[_0xd45f('0x14')][_0xd45f('0x15')]({'raw':_0x5825bf[_0xd45f('0x16')]?_0x5825bf[_0xd45f('0x16')][_0xd45f('0x17')]===undefined?!![]:![]:!![],'where':_0x5825bf['options']?_0x5825bf[_0xd45f('0x16')][_0xd45f('0x18')]||null:null,'attributes':_0x5825bf['options']?_0x5825bf[_0xd45f('0x16')]['attributes']||null:null,'limit':_0x5825bf[_0xd45f('0x16')]?_0x5825bf[_0xd45f('0x16')][_0xd45f('0x19')]||null:null,'include':_0x5825bf['options']?_0x5825bf['options'][_0xd45f('0x1a')]?_['map'](_0x5825bf[_0xd45f('0x16')][_0xd45f('0x1a')],function(_0x103f6c){return{'model':db[_0x103f6c['model']],'as':_0x103f6c['as'],'attributes':_0x103f6c[_0xd45f('0x1b')],'include':_0x103f6c[_0xd45f('0x1a')]?_['map'](_0x103f6c[_0xd45f('0x1a')],function(_0x4986b5){return{'model':db[_0x4986b5['model']],'as':_0x4986b5['as'],'attributes':_0x4986b5[_0xd45f('0x1b')],'include':_0x4986b5[_0xd45f('0x1a')]?_[_0xd45f('0x1c')](_0x4986b5[_0xd45f('0x1a')],function(_0x19076e){return{'model':db[_0x19076e[_0xd45f('0x1d')]],'as':_0x19076e['as'],'attributes':_0x19076e[_0xd45f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd45f('0xb')](function(_0x7435cf){logger[_0xd45f('0xc')](_0xd45f('0x1e'),_0x5825bf);logger[_0xd45f('0xf')](_0xd45f('0x1e'),_0x5825bf,JSON[_0xd45f('0x11')](_0x7435cf));_0xb4e533(_0x7435cf);})[_0xd45f('0x1f')](function(_0x4550df){logger['error']('GetMemberReport',_0x4550df[_0xd45f('0x13')],_0x5825bf);_0x4d074b(_0x3d7391[_0xd45f('0x12')](0x1f4,_0x4550df['message']));});});};exports['CreateMemberReport']=function(_0x1831b3){var _0x2aadd8=this;return new Promise(function(_0xc79a68,_0x1da724){return db[_0xd45f('0x14')][_0xd45f('0x20')](_0x1831b3[_0xd45f('0x21')],{'raw':_0x1831b3[_0xd45f('0x16')]?_0x1831b3[_0xd45f('0x16')][_0xd45f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x6b417a){logger[_0xd45f('0xc')]('CreateMemberReport',_0x1831b3);logger['debug'](_0xd45f('0x22'),_0x1831b3,JSON['stringify'](_0x6b417a));_0xc79a68(_0x6b417a);})['catch'](function(_0x19c85c){logger[_0xd45f('0x12')]('CreateMemberReport',_0x19c85c[_0xd45f('0x13')],_0x1831b3);_0x1da724(_0x2aadd8[_0xd45f('0x12')](0x1f4,_0x19c85c['message']));});});};exports['UpdateMemberReport']=function(_0x3a014a){var _0x534ac7=this;return new Promise(function(_0x46dd25,_0x431c41){return db['MemberReport'][_0xd45f('0x23')](_0x3a014a[_0xd45f('0x21')],{'raw':_0x3a014a[_0xd45f('0x16')]?_0x3a014a['options'][_0xd45f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a014a[_0xd45f('0x16')]?_0x3a014a['options']['where']||null:null,'attributes':_0x3a014a[_0xd45f('0x16')]?_0x3a014a[_0xd45f('0x16')][_0xd45f('0x1b')]||null:null,'limit':_0x3a014a[_0xd45f('0x16')]?_0x3a014a[_0xd45f('0x16')][_0xd45f('0x19')]||null:null})[_0xd45f('0xb')](function(_0x9706e2){logger['info']('UpdateMemberReport',_0x3a014a);logger['debug'](_0xd45f('0x24'),_0x3a014a,JSON[_0xd45f('0x11')](_0x9706e2));_0x46dd25(_0x9706e2);})[_0xd45f('0x1f')](function(_0xe24591){logger[_0xd45f('0x12')]('UpdateMemberReport',_0xe24591['message'],_0x3a014a);_0x431c41(_0x534ac7[_0xd45f('0x12')](0x1f4,_0xe24591[_0xd45f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 32f5681..3ba9d89 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 _0xd4f4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','multer','util','path','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5867c2,_0x445a1f){_0x5867c2=_0x5867c2-0x0;var _0x408ead=_0xd4f4[_0x5867c2];return _0x408ead;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require(_0x4d4f('0x9'));router[_0x4d4f('0xa')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x7af2=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x21a098,_0x204c09){var _0x3233a5=function(_0x192c82){while(--_0x192c82){_0x21a098['push'](_0x21a098['shift']());}};_0x3233a5(++_0x204c09);}(_0x7af2,0x119));var _0x27af=function(_0x131ed2,_0x2b56c0){_0x131ed2=_0x131ed2-0x0;var _0x27d2a3=_0x7af2[_0x131ed2];return _0x27d2a3;};'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')]('/',controller[_0x27af('0x9')]);module[_0x27af('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7b8d2b1..e0c57a1 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 _0xc49c=['sequelize','version'];(function(_0xf1ae32,_0x4eff4f){var _0x39a168=function(_0x34a161){while(--_0x34a161){_0xf1ae32['push'](_0xf1ae32['shift']());}};_0x39a168(++_0x4eff4f);}(_0xc49c,0x180));var _0xcc49=function(_0x3ed02f,_0x9b64c6){_0x3ed02f=_0x3ed02f-0x0;var _0x3cac4e=_0xc49c[_0x3ed02f];return _0x3cac4e;};'use strict';var Sequelize=require(_0xcc49('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xcc49('0x1')}}; \ No newline at end of file +var _0x34ef=['sequelize','exports','STRING','version'];(function(_0x25b105,_0x135b27){var _0x2aea9f=function(_0x1564f6){while(--_0x1564f6){_0x25b105['push'](_0x25b105['shift']());}};_0x2aea9f(++_0x135b27);}(_0x34ef,0x1f4));var _0xf34e=function(_0x543a37,_0x186fc0){_0x543a37=_0x543a37-0x0;var _0x244812=_0x34ef[_0x543a37];return _0x244812;};'use strict';var Sequelize=require(_0xf34e('0x0'));module[_0xf34e('0x1')]={'version':{'type':Sequelize[_0xf34e('0x2')],'unique':_0xf34e('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index bc430b9..f7861ce 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 _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x70e0,0x17b));var _0x070e=function(_0x33bc84,_0x505040){_0x33bc84=_0x33bc84-0x0;var _0x10b3cf=_0x70e0[_0x33bc84];return _0x10b3cf;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file +var _0xf3cd=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','Migration','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5f122c,_0x2b3b42){var _0x53dad8=function(_0x2a2bc0){while(--_0x2a2bc0){_0x5f122c['push'](_0x5f122c['shift']());}};_0x53dad8(++_0x2b3b42);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xf3cd[_0x37e886];return _0x57c5cd;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var db=require(_0xdf3c('0x19'))['db'];function respondWithStatusCode(_0x5e8925,_0x1d483c){_0x1d483c=_0x1d483c||0xcc;return function(_0x166ae5){if(_0x166ae5){return _0x5e8925[_0xdf3c('0x1a')](_0x1d483c);}return _0x5e8925[_0xdf3c('0x1b')](_0x1d483c)['end']();};}function respondWithResult(_0x2ae4ad,_0x461079){_0x461079=_0x461079||0xc8;return function(_0x13ea5f){if(_0x13ea5f){return _0x2ae4ad['status'](_0x461079)[_0xdf3c('0x1c')](_0x13ea5f);}};}function respondWithFilteredResult(_0x38b01d,_0x173041){return function(_0x4274fd){if(_0x4274fd){var _0x21e587=_0x4274fd[_0xdf3c('0x1d')],_0x1a7a5a=_0x173041[_0xdf3c('0x1e')],_0x305ea5=_0x173041['offset']+_0x173041[_0xdf3c('0x1f')],_0x92008b;if(_0x305ea5>=_0x21e587){_0x305ea5=_0x21e587;_0x92008b=0xc8;}else{_0x92008b=0xce;}_0x38b01d[_0xdf3c('0x1b')](_0x92008b);return _0x38b01d[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x1a7a5a+'-'+_0x305ea5+'/'+_0x21e587)[_0xdf3c('0x1c')](_0x4274fd);}return null;};}function patchUpdates(_0x113b56){return function(_0x16b02b){try{jsonpatch[_0xdf3c('0x22')](_0x16b02b,_0x113b56,!![]);}catch(_0x426f3a){return BPromise[_0xdf3c('0x23')](_0x426f3a);}return _0x16b02b[_0xdf3c('0x24')]();};}function saveUpdates(_0x3d14cc,_0x25487c){return function(_0x5d2390){if(_0x5d2390){return _0x5d2390['update'](_0x3d14cc)[_0xdf3c('0x25')](function(_0x583ce4){return _0x583ce4;});}return null;};}function removeEntity(_0x15776c,_0x40e7ec){return function(_0x36552e){if(_0x36552e){return _0x36552e[_0xdf3c('0x26')]()[_0xdf3c('0x25')](function(){_0x15776c[_0xdf3c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a164,_0x213d75){return function(_0x13e3ca){if(!_0x13e3ca){_0x22a164[_0xdf3c('0x1a')](0x194);}return _0x13e3ca;};}function handleError(_0x40032a,_0x3b5371){_0x3b5371=_0x3b5371||0x1f4;return function(_0xef54cb){logger[_0xdf3c('0x27')](_0xef54cb[_0xdf3c('0x28')]);if(_0xef54cb[_0xdf3c('0x29')]){delete _0xef54cb['name'];}_0x40032a[_0xdf3c('0x1b')](_0x3b5371)[_0xdf3c('0x2a')](_0xef54cb);};}exports['index']=function(_0xdc8962,_0x59659e){var _0x4eaced={},_0x508be9={},_0x14aac9={'count':0x0,'rows':[]};var _0x186bba=_['map'](db['Migration'][_0xdf3c('0x2b')],function(_0x1f2ce4){return{'name':_0x1f2ce4[_0xdf3c('0x2c')],'type':_0x1f2ce4[_0xdf3c('0x2d')]['key']};});_0x508be9[_0xdf3c('0x2e')]=_[_0xdf3c('0x2f')](_0x186bba,'name');_0x508be9['query']=_[_0xdf3c('0x30')](_0xdc8962[_0xdf3c('0x31')]);_0x508be9[_0xdf3c('0x32')]=_['intersection'](_0x508be9[_0xdf3c('0x2e')],_0x508be9[_0xdf3c('0x31')]);_0x4eaced[_0xdf3c('0x33')]=_[_0xdf3c('0x34')](_0x508be9['model'],qs[_0xdf3c('0x35')](_0xdc8962[_0xdf3c('0x31')]['fields']));_0x4eaced[_0xdf3c('0x33')]=_0x4eaced[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x4eaced[_0xdf3c('0x33')]:_0x508be9['model'];if(!_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x37')](_0xdf3c('0x38'))){_0x4eaced[_0xdf3c('0x1f')]=qs['limit'](_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x1f')]);_0x4eaced['offset']=qs['offset'](_0xdc8962[_0xdf3c('0x31')]['offset']);}_0x4eaced[_0xdf3c('0x39')]=qs['sort'](_0xdc8962['query']['sort']);_0x4eaced[_0xdf3c('0x3a')]=qs[_0xdf3c('0x32')](_[_0xdf3c('0x3b')](_0xdc8962[_0xdf3c('0x31')],_0x508be9['filters']),_0x186bba);if(_0xdc8962['query'][_0xdf3c('0x3c')]){_0x4eaced['where']=_[_0xdf3c('0x3d')](_0x4eaced[_0xdf3c('0x3a')],{'$or':_[_0xdf3c('0x2f')](_0x186bba,function(_0xcdd731){if(_0xcdd731[_0xdf3c('0x2d')]!==_0xdf3c('0x3e')){var _0x1c7335={};_0x1c7335[_0xcdd731[_0xdf3c('0x29')]]={'$like':'%'+_0xdc8962[_0xdf3c('0x31')]['filter']+'%'};return _0x1c7335;}})});}_0x4eaced=_[_0xdf3c('0x3d')]({},_0x4eaced,_0xdc8962['options']);var _0x5c1471={'where':_0x4eaced[_0xdf3c('0x3a')]};return db['Migration'][_0xdf3c('0x1d')](_0x5c1471)['then'](function(_0x2a94c3){_0x14aac9[_0xdf3c('0x1d')]=_0x2a94c3;if(_0xdc8962[_0xdf3c('0x31')][_0xdf3c('0x3f')]){_0x4eaced[_0xdf3c('0x40')]=[{'all':!![]}];}return db[_0xdf3c('0x41')][_0xdf3c('0x42')](_0x4eaced);})[_0xdf3c('0x25')](function(_0x3cf131){_0x14aac9[_0xdf3c('0x43')]=_0x3cf131;return _0x14aac9;})[_0xdf3c('0x25')](respondWithFilteredResult(_0x59659e,_0x4eaced))[_0xdf3c('0x44')](handleError(_0x59659e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d944ed7..dfcd963 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 _0xe812=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations','util','../../config/logger'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xe812,0x1f2));var _0x2e81=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe812[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x2e81('0x0'));var logger=require(_0x2e81('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2e81('0x2'));var rp=require(_0x2e81('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e81('0x4'));var config=require(_0x2e81('0x5'));var attributes=require('./migration.attributes');module[_0x2e81('0x6')]=function(_0x251244,_0x4f6864){return _0x251244[_0x2e81('0x7')](_0x2e81('0x8'),attributes,{'tableName':_0x2e81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf53f=['migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xf53f,0x8d));var _0xff53=function(_0x54ff13,_0x3f2cca){_0x54ff13=_0x54ff13-0x0;var _0x4fc200=_0xf53f[_0x54ff13];return _0x4fc200;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var moment=require(_0xff53('0x4'));var BPromise=require(_0xff53('0x5'));var rp=require(_0xff53('0x6'));var fs=require('fs');var path=require(_0xff53('0x7'));var rimraf=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var attributes=require(_0xff53('0xa'));module[_0xff53('0xb')]=function(_0x54d39c,_0x54e637){return _0x54d39c[_0xff53('0xc')]('Migration',attributes,{'tableName':_0xff53('0xd'),'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 e0f4271..77da7b2 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 _0x8074=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x8074,0x175));var _0x4807=function(_0x55fb6a,_0x1ad7d5){_0x55fb6a=_0x55fb6a-0x0;var _0x22f466=_0x8074[_0x55fb6a];return _0x22f466;};'use strict';var _=require(_0x4807('0x0'));var util=require(_0x4807('0x1'));var moment=require(_0x4807('0x2'));var BPromise=require('bluebird');var rs=require(_0x4807('0x3'));var fs=require('fs');var Redis=require(_0x4807('0x4'));var db=require(_0x4807('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4807('0x6'));var config=require(_0x4807('0x7'));var jayson=require(_0x4807('0x8'));var client=jayson[_0x4807('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4982dd,_0x19a887,_0x33662a){return new BPromise(function(_0x19c731,_0x3998fb){return client[_0x4807('0xa')](_0x4982dd,_0x33662a)[_0x4807('0xb')](function(_0x585168){logger['info'](_0x4807('0xc'),_0x19a887,_0x4807('0xd'));logger[_0x4807('0xe')](_0x4807('0xf'),_0x19a887,'request\x20sent',JSON['stringify'](_0x585168));if(_0x585168[_0x4807('0x10')]){if(_0x585168[_0x4807('0x10')]['code']===0x1f4){logger['error'](_0x4807('0xc'),_0x19a887,_0x585168[_0x4807('0x10')][_0x4807('0x11')]);return _0x3998fb(_0x585168[_0x4807('0x10')][_0x4807('0x11')]);}logger['error'](_0x4807('0xc'),_0x19a887,_0x585168[_0x4807('0x10')]['message']);return _0x19c731(_0x585168[_0x4807('0x10')]['message']);}else{logger[_0x4807('0x12')]('Migration,\x20%s,\x20%s',_0x19a887,'request\x20sent');_0x19c731(_0x585168[_0x4807('0x13')][_0x4807('0x11')]);}})[_0x4807('0x14')](function(_0x4a94d1){logger[_0x4807('0x10')](_0x4807('0xc'),_0x19a887,_0x4a94d1);_0x3998fb(_0x4a94d1);});});} \ No newline at end of file +var _0xe908=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring'];(function(_0x2b2a2c,_0x5ddad7){var _0xaabc35=function(_0x46538e){while(--_0x46538e){_0x2b2a2c['push'](_0x2b2a2c['shift']());}};_0xaabc35(++_0x5ddad7);}(_0xe908,0xb1));var _0x8e90=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xe908[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e90('0x0'));var BPromise=require(_0x8e90('0x1'));var rs=require(_0x8e90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e90('0x3'))['db'];var utils=require(_0x8e90('0x4'));var logger=require(_0x8e90('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e90('0x6'));var client=jayson[_0x8e90('0x7')][_0x8e90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ca71d,_0x19a817,_0x57c0d8){return new BPromise(function(_0x490725,_0x4470f9){return client[_0x8e90('0x9')](_0x4ca71d,_0x57c0d8)[_0x8e90('0xa')](function(_0x2a3d15){logger[_0x8e90('0xb')](_0x8e90('0xc'),_0x19a817,_0x8e90('0xd'));logger['debug'](_0x8e90('0xe'),_0x19a817,_0x8e90('0xd'),JSON[_0x8e90('0xf')](_0x2a3d15));if(_0x2a3d15[_0x8e90('0x10')]){if(_0x2a3d15[_0x8e90('0x10')][_0x8e90('0x11')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x19a817,_0x2a3d15[_0x8e90('0x10')][_0x8e90('0x12')]);return _0x4470f9(_0x2a3d15[_0x8e90('0x10')][_0x8e90('0x12')]);}logger[_0x8e90('0x10')](_0x8e90('0xc'),_0x19a817,_0x2a3d15[_0x8e90('0x10')][_0x8e90('0x12')]);return _0x490725(_0x2a3d15[_0x8e90('0x10')][_0x8e90('0x12')]);}else{logger[_0x8e90('0xb')]('Migration,\x20%s,\x20%s',_0x19a817,_0x8e90('0xd'));_0x490725(_0x2a3d15[_0x8e90('0x13')][_0x8e90('0x12')]);}})['catch'](function(_0x7d3a66){logger[_0x8e90('0x10')](_0x8e90('0xc'),_0x19a817,_0x7d3a66);_0x4470f9(_0x7d3a66);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5b806b2..e3b1501 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 _0x3fe9=['/:id','show','post','create','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x75fa5d,_0x3b6ad8){var _0x355108=function(_0x56cab0){while(--_0x56cab0){_0x75fa5d['push'](_0x75fa5d['shift']());}};_0x355108(++_0x3b6ad8);}(_0x3fe9,0x106));var _0x93fe=function(_0xd1a3d1,_0x272629){_0xd1a3d1=_0xd1a3d1-0x0;var _0x38aed5=_0x3fe9[_0xd1a3d1];return _0x38aed5;};'use strict';var multer=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93fe('0x2'));var router=express[_0x93fe('0x3')]();var auth=require(_0x93fe('0x4'));var interaction=require(_0x93fe('0x5'));var config=require('../../config/environment');var controller=require(_0x93fe('0x6'));router[_0x93fe('0x7')]('/',auth[_0x93fe('0x8')](),controller[_0x93fe('0x9')]);router['get'](_0x93fe('0xa'),auth[_0x93fe('0x8')](),controller[_0x93fe('0xb')]);router[_0x93fe('0xc')]('/',auth['isAuthenticated'](),controller[_0x93fe('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x93fe('0xe')]);router[_0x93fe('0xf')](_0x93fe('0xa'),auth[_0x93fe('0x8')](),controller[_0x93fe('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2144=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x275685,_0x53dde4){var _0x55d16b=function(_0x4c2179){while(--_0x4c2179){_0x275685['push'](_0x275685['shift']());}};_0x55d16b(++_0x53dde4);}(_0x2144,0xfa));var _0x4214=function(_0x2b3d1f,_0x40c8b6){_0x2b3d1f=_0x2b3d1f-0x0;var _0x187469=_0x2144[_0x2b3d1f];return _0x187469;};'use strict';var multer=require(_0x4214('0x0'));var util=require(_0x4214('0x1'));var path=require(_0x4214('0x2'));var timeout=require(_0x4214('0x3'));var express=require(_0x4214('0x4'));var router=express[_0x4214('0x5')]();var auth=require(_0x4214('0x6'));var interaction=require(_0x4214('0x7'));var config=require(_0x4214('0x8'));var controller=require(_0x4214('0x9'));router[_0x4214('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4214('0xa')](_0x4214('0xb'),auth[_0x4214('0xc')](),controller[_0x4214('0xd')]);router[_0x4214('0xe')]('/',auth[_0x4214('0xc')](),controller[_0x4214('0xf')]);router['put'](_0x4214('0xb'),auth['isAuthenticated'](),controller[_0x4214('0x10')]);router[_0x4214('0x11')]('/:id',auth[_0x4214('0xc')](),controller[_0x4214('0x12')]);module[_0x4214('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c74d862..cf1441a 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(_0x4cceaf,_0x35a567){var _0x120d40=function(_0x409c6c){while(--_0x409c6c){_0x4cceaf['push'](_0x4cceaf['shift']());}};_0x120d40(++_0x35a567);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x13260c,_0x21042b){var _0x322b16=function(_0x445804){while(--_0x445804){_0x13260c['push'](_0x13260c['shift']());}};_0x322b16(++_0x21042b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 dcbeb2b..9430705 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 _0x035e=['info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','Content-Range','save','update','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','Network','count','includeAll','include','findAll','show','params','options','find','sequelize','transaction','create','body','toUpperCase','STUN','server/files/templates/stun_multiple.ejs','utf8','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','writeFileSync','Reload','readFileSync','join','server/files/templates/network.ejs','render','format','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','TURN','/etc/asterisk/turn_xcally.conf','destroy','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then'];(function(_0x2ae555,_0x4c0c12){var _0x49c95a=function(_0x430e0e){while(--_0x430e0e){_0x2ae555['push'](_0x2ae555['shift']());}};_0x49c95a(++_0x4c0c12);}(_0x035e,0x194));var _0xe035=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x035e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe035('0x0'));var emlformat=require(_0xe035('0x1'));var rimraf=require(_0xe035('0x2'));var zipdir=require(_0xe035('0x3'));var jsonpatch=require(_0xe035('0x4'));var rp=require('request-promise');var moment=require(_0xe035('0x5'));var BPromise=require(_0xe035('0x6'));var Mustache=require(_0xe035('0x7'));var util=require(_0xe035('0x8'));var path=require(_0xe035('0x9'));var sox=require('sox');var csv=require(_0xe035('0xa'));var ejs=require(_0xe035('0xb'));var fs=require('fs');var _=require(_0xe035('0xc'));var squel=require(_0xe035('0xd'));var crypto=require('crypto');var jsforce=require(_0xe035('0xe'));var deskjs=require(_0xe035('0xf'));var toCsv=require(_0xe035('0xa'));var querystring=require('querystring');var Papa=require(_0xe035('0x10'));var Redis=require(_0xe035('0x11'));var authService=require(_0xe035('0x12'));var qs=require(_0xe035('0x13'));var as=require(_0xe035('0x14'));var hardwareService=require(_0xe035('0x15'));var logger=require(_0xe035('0x16'))(_0xe035('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe035('0x18'))['db'];var jayson=require(_0xe035('0x19'));var client=jayson[_0xe035('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1926c9,_0x2171a2,_0x5ec4a8){if(_0x5ec4a8){var _0x3faa9c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3faa9c[_0xe035('0x1b')](_0x2171a2)){return _0x1926c9;}else{throw new db[(_0xe035('0x1c'))][(_0xe035('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1926c9;}}function respondWithRpcPromise(_0x453e25,_0x1dc1f8,_0x11a1bb,_0x38ffd1){return new BPromise(function(_0x439c20,_0x10d71a){var _0xab4fb3=_0x38ffd1||client;return _0xab4fb3[_0xe035('0x1e')](_0x453e25,_0x11a1bb)[_0xe035('0x1f')](function(_0x5f30d1){logger[_0xe035('0x20')](_0xe035('0x21'),_0x1dc1f8,'request\x20sent');logger[_0xe035('0x22')](_0xe035('0x23'),_0x1dc1f8,_0xe035('0x24'),JSON[_0xe035('0x25')](_0x5f30d1));if(_0x5f30d1[_0xe035('0x26')]){if(_0x5f30d1[_0xe035('0x26')][_0xe035('0x27')]===0x1f4){logger[_0xe035('0x26')]('Network,\x20%s,\x20%s',_0x1dc1f8,_0x5f30d1[_0xe035('0x26')][_0xe035('0x28')]);return _0x10d71a(_0x5f30d1[_0xe035('0x26')][_0xe035('0x28')]);}logger['error']('Network,\x20%s,\x20%s',_0x1dc1f8,_0x5f30d1[_0xe035('0x26')][_0xe035('0x28')]);return _0x439c20(_0x5f30d1[_0xe035('0x26')][_0xe035('0x28')]);}else{logger[_0xe035('0x20')](_0xe035('0x21'),_0x1dc1f8,_0xe035('0x24'));_0x439c20(_0x5f30d1['result'][_0xe035('0x28')]);}})[_0xe035('0x29')](function(_0xe2cf06){logger[_0xe035('0x26')](_0xe035('0x21'),_0x1dc1f8,_0xe2cf06);_0x10d71a(_0xe2cf06);});});}function respondWithStatusCode(_0x52f905,_0x15b7b6){_0x15b7b6=_0x15b7b6||0xcc;return function(_0x59b304){if(_0x59b304){return _0x52f905[_0xe035('0x2a')](_0x15b7b6);}return _0x52f905[_0xe035('0x2b')](_0x15b7b6)[_0xe035('0x2c')]();};}function respondWithResult(_0x313ff0,_0x593e45){_0x593e45=_0x593e45||0xc8;return function(_0x444e91){if(_0x444e91){return _0x313ff0[_0xe035('0x2b')](_0x593e45)[_0xe035('0x2d')](_0x444e91);}};}function respondWithFilteredResult(_0x7735c,_0x217568){return function(_0x1c3e65){if(_0x1c3e65){var _0x4356d3=_0x1c3e65['count'],_0x16abd1=_0x217568[_0xe035('0x2e')],_0x126b7a=_0x217568[_0xe035('0x2e')]+_0x217568['limit'],_0x78da9f;if(_0x126b7a>=_0x4356d3){_0x126b7a=_0x4356d3;_0x78da9f=0xc8;}else{_0x78da9f=0xce;}_0x7735c[_0xe035('0x2b')](_0x78da9f);return _0x7735c['set'](_0xe035('0x2f'),_0x16abd1+'-'+_0x126b7a+'/'+_0x4356d3)[_0xe035('0x2d')](_0x1c3e65);}return null;};}function patchUpdates(_0x34b5ed){return function(_0x1b8e28){try{jsonpatch['apply'](_0x1b8e28,_0x34b5ed,!![]);}catch(_0x328f36){return BPromise['reject'](_0x328f36);}return _0x1b8e28[_0xe035('0x30')]();};}function saveUpdates(_0x378a8b,_0xa67208){return function(_0x388a7c){if(_0x388a7c){return _0x388a7c[_0xe035('0x31')](_0x378a8b)[_0xe035('0x1f')](function(_0x5ef8cc){return _0x5ef8cc;});}return null;};}function removeEntity(_0x30f942,_0x52af7f){return function(_0x58e767){if(_0x58e767){return _0x58e767['destroy']()[_0xe035('0x1f')](function(){_0x30f942[_0xe035('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2822b8,_0x3df7e8){return function(_0x2187f0){if(!_0x2187f0){_0x2822b8['sendStatus'](0x194);}return _0x2187f0;};}function handleError(_0x37a89b,_0x294eee){_0x294eee=_0x294eee||0x1f4;return function(_0x550a3f){logger[_0xe035('0x26')](_0x550a3f['stack']);if(_0x550a3f[_0xe035('0x32')]){delete _0x550a3f['name'];}_0x37a89b[_0xe035('0x2b')](_0x294eee)[_0xe035('0x33')](_0x550a3f);};}exports[_0xe035('0x34')]=function(_0x305c87,_0x56aca8){var _0x35570e={},_0x26adcd={},_0x1594da={'count':0x0,'rows':[]};var _0x5e6ad7=_['map'](db['Network'][_0xe035('0x35')],function(_0xa2e5e){return{'name':_0xa2e5e[_0xe035('0x36')],'type':_0xa2e5e['type'][_0xe035('0x37')]};});_0x26adcd[_0xe035('0x38')]=_[_0xe035('0x39')](_0x5e6ad7,_0xe035('0x32'));_0x26adcd[_0xe035('0x3a')]=_[_0xe035('0x3b')](_0x305c87[_0xe035('0x3a')]);_0x26adcd[_0xe035('0x3c')]=_['intersection'](_0x26adcd[_0xe035('0x38')],_0x26adcd['query']);_0x35570e['attributes']=_[_0xe035('0x3d')](_0x26adcd[_0xe035('0x38')],qs[_0xe035('0x3e')](_0x305c87[_0xe035('0x3a')][_0xe035('0x3e')]));_0x35570e[_0xe035('0x3f')]=_0x35570e[_0xe035('0x3f')][_0xe035('0x40')]?_0x35570e[_0xe035('0x3f')]:_0x26adcd[_0xe035('0x38')];if(!_0x305c87[_0xe035('0x3a')][_0xe035('0x41')](_0xe035('0x42'))){_0x35570e[_0xe035('0x43')]=qs[_0xe035('0x43')](_0x305c87[_0xe035('0x3a')][_0xe035('0x43')]);_0x35570e[_0xe035('0x2e')]=qs[_0xe035('0x2e')](_0x305c87[_0xe035('0x3a')]['offset']);}_0x35570e[_0xe035('0x44')]=qs[_0xe035('0x45')](_0x305c87[_0xe035('0x3a')]['sort']);_0x35570e[_0xe035('0x46')]=qs['filters'](_['pick'](_0x305c87[_0xe035('0x3a')],_0x26adcd[_0xe035('0x3c')]),_0x5e6ad7);if(_0x305c87[_0xe035('0x3a')][_0xe035('0x47')]){_0x35570e[_0xe035('0x46')]=_[_0xe035('0x48')](_0x35570e[_0xe035('0x46')],{'$or':_[_0xe035('0x39')](_0x5e6ad7,function(_0x1fe71b){if(_0x1fe71b[_0xe035('0x49')]!==_0xe035('0x4a')){var _0x49d624={};_0x49d624[_0x1fe71b[_0xe035('0x32')]]={'$like':'%'+_0x305c87[_0xe035('0x3a')]['filter']+'%'};return _0x49d624;}})});}_0x35570e=_[_0xe035('0x48')]({},_0x35570e,_0x305c87['options']);var _0x3988dc={'where':_0x35570e[_0xe035('0x46')]};return db[_0xe035('0x4b')][_0xe035('0x4c')](_0x3988dc)[_0xe035('0x1f')](function(_0x5c8114){_0x1594da[_0xe035('0x4c')]=_0x5c8114;if(_0x305c87[_0xe035('0x3a')][_0xe035('0x4d')]){_0x35570e[_0xe035('0x4e')]=[{'all':!![]}];}return db[_0xe035('0x4b')][_0xe035('0x4f')](_0x35570e);})[_0xe035('0x1f')](function(_0xfa16d3){_0x1594da['rows']=_0xfa16d3;return _0x1594da;})[_0xe035('0x1f')](respondWithFilteredResult(_0x56aca8,_0x35570e))[_0xe035('0x29')](handleError(_0x56aca8,null));};exports[_0xe035('0x50')]=function(_0x25ffde,_0x5ddce8){var _0x2597ad={'raw':!![],'where':{'id':_0x25ffde[_0xe035('0x51')]['id']}},_0xf47551={};_0xf47551[_0xe035('0x38')]=_[_0xe035('0x3b')](db['Network'][_0xe035('0x35')]);_0xf47551[_0xe035('0x3a')]=_[_0xe035('0x3b')](_0x25ffde['query']);_0xf47551[_0xe035('0x3c')]=_['intersection'](_0xf47551[_0xe035('0x38')],_0xf47551['query']);_0x2597ad[_0xe035('0x3f')]=_[_0xe035('0x3d')](_0xf47551[_0xe035('0x38')],qs['fields'](_0x25ffde[_0xe035('0x3a')][_0xe035('0x3e')]));_0x2597ad[_0xe035('0x3f')]=_0x2597ad[_0xe035('0x3f')]['length']?_0x2597ad[_0xe035('0x3f')]:_0xf47551[_0xe035('0x38')];if(_0x25ffde['query'][_0xe035('0x4d')]){_0x2597ad[_0xe035('0x4e')]=[{'all':!![]}];}_0x2597ad=_[_0xe035('0x48')]({},_0x2597ad,_0x25ffde[_0xe035('0x52')]);return db[_0xe035('0x4b')][_0xe035('0x53')](_0x2597ad)['then'](handleEntityNotFound(_0x5ddce8,null))[_0xe035('0x1f')](respondWithResult(_0x5ddce8,null))['catch'](handleError(_0x5ddce8,null));};exports['create']=function(_0x26f4ad,_0x45e3b4,_0x228345){var _0x5b10d5;return db[_0xe035('0x54')][_0xe035('0x55')](function(_0x5893b9){return db[_0xe035('0x4b')][_0xe035('0x56')](_0x26f4ad[_0xe035('0x57')],{'raw':!![]})[_0xe035('0x1f')](function(_0x2a9861){_0x5b10d5=_0x2a9861;return db[_0xe035('0x4b')][_0xe035('0x4f')]({'where':{'type':_0x26f4ad[_0xe035('0x57')][_0xe035('0x49')]},'raw':!![]});})[_0xe035('0x1f')](function(_0x3067da){if(_0x5b10d5['type'][_0xe035('0x58')]()==_0xe035('0x59')){var _0x5f1392=fs['readFileSync'](path['join'](config['root'],_0xe035('0x5a')),_0xe035('0x5b'));var _0x4cdb5c=ejs['render'](_0x5f1392,{'networks':_0x3067da||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4cdb5c);return respondWithRpcPromise('Reload',_0xe035('0x56'),{'module':_0xe035('0x5c')});}else if(_0x5b10d5[_0xe035('0x49')][_0xe035('0x58')]()=='TURN'){var _0x5c221b=fs['readFileSync'](path['join'](config[_0xe035('0x5d')],_0xe035('0x5e')),_0xe035('0x5b'));var _0x5ad776=ejs['render'](_0x5c221b,{'networks':_0x3067da||[]});fs[_0xe035('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x5ad776);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x31b57e=fs[_0xe035('0x61')](path[_0xe035('0x62')](config['root'],_0xe035('0x63')),_0xe035('0x5b'));var _0x44b409=ejs[_0xe035('0x64')](_0x31b57e,{'networks':_0x3067da||[]});fs[_0xe035('0x5f')](util[_0xe035('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x26f4ad[_0xe035('0x57')][_0xe035('0x49')][_0xe035('0x66')]()),_0x44b409);return respondWithRpcPromise('Reload',_0xe035('0x56'),{'module':_0xe035('0x67')});}return null;})['then'](function(){return _0x5b10d5;});})[_0xe035('0x1f')](respondWithResult(_0x45e3b4,0xc9))[_0xe035('0x29')](handleError(_0x45e3b4,null));};exports[_0xe035('0x31')]=function(_0x3f8e00,_0x4733e8,_0x29c7c1){var _0x46fd9f;return db[_0xe035('0x54')]['transaction'](function(_0x584acd){return db[_0xe035('0x4b')][_0xe035('0x53')]({'where':{'id':_0x3f8e00[_0xe035('0x51')]['id']}})[_0xe035('0x1f')](handleEntityNotFound(_0x4733e8,null))['then'](saveUpdates(_0x3f8e00['body'],null))['then'](function(_0x3c087e){if(_0x3c087e){_0x46fd9f=_0x3c087e;return db[_0xe035('0x4b')][_0xe035('0x4f')]({'where':{'type':_0x46fd9f[_0xe035('0x49')]},'raw':!![]});}return null;})['then'](function(_0x1b00d1){if(_0x46fd9f[_0xe035('0x49')][_0xe035('0x58')]()==_0xe035('0x59')){var _0x4c5f2a=fs[_0xe035('0x61')](path['join'](config[_0xe035('0x5d')],_0xe035('0x5a')),_0xe035('0x5b'));var _0x9866fa=ejs['render'](_0x4c5f2a,{'networks':_0x1b00d1||[]});fs['writeFileSync'](_0xe035('0x68'),_0x9866fa);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x31'),{'module':_0xe035('0x5c')});}else if(_0x46fd9f[_0xe035('0x49')][_0xe035('0x58')]()==_0xe035('0x69')){var _0x18bba9=fs[_0xe035('0x61')](path[_0xe035('0x62')](config[_0xe035('0x5d')],_0xe035('0x5e')),_0xe035('0x5b'));var _0x575977=ejs[_0xe035('0x64')](_0x18bba9,{'networks':_0x1b00d1||[]});fs[_0xe035('0x5f')](_0xe035('0x6a'),_0x575977);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x32c88f=fs['readFileSync'](path['join'](config[_0xe035('0x5d')],_0xe035('0x63')),_0xe035('0x5b'));var _0x11119f=ejs[_0xe035('0x64')](_0x32c88f,{'networks':_0x1b00d1||[]});fs[_0xe035('0x5f')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3f8e00['body'][_0xe035('0x49')][_0xe035('0x66')]()),_0x11119f);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x31'),{'module':_0xe035('0x67')});}return null;})[_0xe035('0x1f')](function(_0x19413d){if(_0x19413d){return _0x46fd9f;}return null;});})[_0xe035('0x1f')](respondWithResult(_0x4733e8,null))[_0xe035('0x29')](handleError(_0x4733e8,null));};exports[_0xe035('0x6b')]=function(_0x281607,_0x5dc481,_0x2c5a12){var _0x539c4e;return db[_0xe035('0x4b')][_0xe035('0x53')]({'where':{'id':_0x281607[_0xe035('0x51')]['id']}})[_0xe035('0x1f')](function(_0xd0c447){_0x539c4e=_0xd0c447;return _0xd0c447;})['then'](handleEntityNotFound(_0x5dc481,null))['then'](removeEntity(_0x5dc481,null))['then'](function(){if(_0x539c4e){return db[_0xe035('0x4b')][_0xe035('0x4f')]({'where':{'type':_0x539c4e[_0xe035('0x49')]},'raw':!![]});}})[_0xe035('0x1f')](function(_0x37b8fe){if(_0x539c4e['type']['toUpperCase']()==_0xe035('0x59')){var _0x5c0826=fs[_0xe035('0x61')](path[_0xe035('0x62')](config[_0xe035('0x5d')],_0xe035('0x5a')),_0xe035('0x5b'));var _0x1a412e=ejs[_0xe035('0x64')](_0x5c0826,{'networks':_0x37b8fe||[]});fs[_0xe035('0x5f')](_0xe035('0x68'),_0x1a412e);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x6b'),{'module':_0xe035('0x5c')});}else if(_0x539c4e[_0xe035('0x49')][_0xe035('0x58')]()==_0xe035('0x69')){var _0x2903b0=fs[_0xe035('0x61')](path[_0xe035('0x62')](config[_0xe035('0x5d')],_0xe035('0x5e')),'utf8');var _0x892ef=ejs[_0xe035('0x64')](_0x2903b0,{'networks':_0x37b8fe||[]});fs[_0xe035('0x5f')](_0xe035('0x6a'),_0x892ef);return respondWithRpcPromise('Reload',_0xe035('0x6b'),{'module':_0xe035('0x5c')});}else{var _0x3baf5e=fs[_0xe035('0x61')](path[_0xe035('0x62')](config['root'],'server/files/templates/network.ejs'),_0xe035('0x5b'));var _0x4cf5e=ejs[_0xe035('0x64')](_0x3baf5e,{'networks':_0x37b8fe||[]});fs[_0xe035('0x5f')](util[_0xe035('0x65')](_0xe035('0x6c'),_0x281607[_0xe035('0x57')][_0xe035('0x49')][_0xe035('0x66')]()),_0x4cf5e);return respondWithRpcPromise(_0xe035('0x60'),_0xe035('0x6b'),{'module':_0xe035('0x67')});}return null;})['catch'](handleError(_0x5dc481,null));}; \ No newline at end of file +var _0xc910=['filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','fields','create','sequelize','transaction','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys'];(function(_0x1bc1c5,_0x2290b7){var _0x2bdaa9=function(_0x24009b){while(--_0x24009b){_0x1bc1c5['push'](_0x1bc1c5['shift']());}};_0x2bdaa9(++_0x2290b7);}(_0xc910,0x1e1));var _0x0c91=function(_0x4bfc8c,_0x4bae91){_0x4bfc8c=_0x4bfc8c-0x0;var _0x342dfe=_0xc910[_0x4bfc8c];return _0x342dfe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0c91('0x0'));var rimraf=require(_0x0c91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c91('0x2'));var rp=require(_0x0c91('0x3'));var moment=require(_0x0c91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c91('0x5'));var util=require(_0x0c91('0x6'));var path=require(_0x0c91('0x7'));var sox=require(_0x0c91('0x8'));var csv=require(_0x0c91('0x9'));var ejs=require(_0x0c91('0xa'));var fs=require('fs');var _=require(_0x0c91('0xb'));var squel=require('squel');var crypto=require(_0x0c91('0xc'));var jsforce=require(_0x0c91('0xd'));var deskjs=require(_0x0c91('0xe'));var toCsv=require(_0x0c91('0x9'));var querystring=require('querystring');var Papa=require(_0x0c91('0xf'));var Redis=require(_0x0c91('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(_0x0c91('0x11'))('api');var utils=require(_0x0c91('0x12'));var config=require('../../config/environment');var db=require(_0x0c91('0x13'))['db'];var jayson=require(_0x0c91('0x14'));var client=jayson[_0x0c91('0x15')][_0x0c91('0x16')]({'port':0x232a});function checkPasswordPattern(_0xaf9a86,_0x28d861,_0x184e83){if(_0x184e83){var _0x41738d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41738d[_0x0c91('0x17')](_0x28d861)){return _0xaf9a86;}else{throw new db[(_0x0c91('0x18'))][(_0x0c91('0x19'))](_0x0c91('0x1a'));}}else{return _0xaf9a86;}}function respondWithRpcPromise(_0xde03c6,_0x484d6d,_0x23e6a9,_0xcbbba8){return new BPromise(function(_0x31f63b,_0x12ba6b){var _0x21e22c=_0xcbbba8||client;return _0x21e22c[_0x0c91('0x1b')](_0xde03c6,_0x23e6a9)[_0x0c91('0x1c')](function(_0x1df9a8){logger[_0x0c91('0x1d')](_0x0c91('0x1e'),_0x484d6d,_0x0c91('0x1f'));logger[_0x0c91('0x20')](_0x0c91('0x21'),_0x484d6d,'request\x20sent',JSON['stringify'](_0x1df9a8));if(_0x1df9a8['error']){if(_0x1df9a8[_0x0c91('0x22')][_0x0c91('0x23')]===0x1f4){logger[_0x0c91('0x22')](_0x0c91('0x1e'),_0x484d6d,_0x1df9a8['error'][_0x0c91('0x24')]);return _0x12ba6b(_0x1df9a8[_0x0c91('0x22')]['message']);}logger['error'](_0x0c91('0x1e'),_0x484d6d,_0x1df9a8['error'][_0x0c91('0x24')]);return _0x31f63b(_0x1df9a8[_0x0c91('0x22')][_0x0c91('0x24')]);}else{logger[_0x0c91('0x1d')](_0x0c91('0x1e'),_0x484d6d,'request\x20sent');_0x31f63b(_0x1df9a8[_0x0c91('0x25')]['message']);}})['catch'](function(_0x1905f1){logger[_0x0c91('0x22')](_0x0c91('0x1e'),_0x484d6d,_0x1905f1);_0x12ba6b(_0x1905f1);});});}function respondWithStatusCode(_0x52acd0,_0x142411){_0x142411=_0x142411||0xcc;return function(_0x33c51c){if(_0x33c51c){return _0x52acd0[_0x0c91('0x26')](_0x142411);}return _0x52acd0[_0x0c91('0x27')](_0x142411)['end']();};}function respondWithResult(_0x16bcff,_0x342fa9){_0x342fa9=_0x342fa9||0xc8;return function(_0x2e827a){if(_0x2e827a){return _0x16bcff[_0x0c91('0x27')](_0x342fa9)['json'](_0x2e827a);}};}function respondWithFilteredResult(_0x308961,_0x1d7cc6){return function(_0x366039){if(_0x366039){var _0x5ec2cd=_0x366039[_0x0c91('0x28')],_0x1de9d1=_0x1d7cc6[_0x0c91('0x29')],_0x287d05=_0x1d7cc6[_0x0c91('0x29')]+_0x1d7cc6[_0x0c91('0x2a')],_0xa3b06c;if(_0x287d05>=_0x5ec2cd){_0x287d05=_0x5ec2cd;_0xa3b06c=0xc8;}else{_0xa3b06c=0xce;}_0x308961[_0x0c91('0x27')](_0xa3b06c);return _0x308961[_0x0c91('0x2b')](_0x0c91('0x2c'),_0x1de9d1+'-'+_0x287d05+'/'+_0x5ec2cd)[_0x0c91('0x2d')](_0x366039);}return null;};}function patchUpdates(_0x2a96bb){return function(_0x29bb45){try{jsonpatch[_0x0c91('0x2e')](_0x29bb45,_0x2a96bb,!![]);}catch(_0x26c8e7){return BPromise[_0x0c91('0x2f')](_0x26c8e7);}return _0x29bb45[_0x0c91('0x30')]();};}function saveUpdates(_0x2f696c,_0x3573ca){return function(_0x413e18){if(_0x413e18){return _0x413e18[_0x0c91('0x31')](_0x2f696c)['then'](function(_0x1c7f52){return _0x1c7f52;});}return null;};}function removeEntity(_0xe4e92e,_0x1f6d00){return function(_0x2a3809){if(_0x2a3809){return _0x2a3809[_0x0c91('0x32')]()['then'](function(){_0xe4e92e['status'](0xcc)[_0x0c91('0x33')]();});}};}function handleEntityNotFound(_0x239b85,_0x9f746e){return function(_0x2d7c9d){if(!_0x2d7c9d){_0x239b85[_0x0c91('0x26')](0x194);}return _0x2d7c9d;};}function handleError(_0x26b1c1,_0x1d8549){_0x1d8549=_0x1d8549||0x1f4;return function(_0x459e23){logger[_0x0c91('0x22')](_0x459e23[_0x0c91('0x34')]);if(_0x459e23[_0x0c91('0x35')]){delete _0x459e23[_0x0c91('0x35')];}_0x26b1c1[_0x0c91('0x27')](_0x1d8549)[_0x0c91('0x36')](_0x459e23);};}exports[_0x0c91('0x37')]=function(_0x41b14b,_0x4f5693){var _0x8bbcb2={},_0x51a655={},_0x25b0eb={'count':0x0,'rows':[]};var _0x345fe7=_[_0x0c91('0x38')](db[_0x0c91('0x39')][_0x0c91('0x3a')],function(_0x40c512){return{'name':_0x40c512[_0x0c91('0x3b')],'type':_0x40c512['type'][_0x0c91('0x3c')]};});_0x51a655[_0x0c91('0x3d')]=_[_0x0c91('0x38')](_0x345fe7,_0x0c91('0x35'));_0x51a655[_0x0c91('0x3e')]=_[_0x0c91('0x3f')](_0x41b14b[_0x0c91('0x3e')]);_0x51a655[_0x0c91('0x40')]=_['intersection'](_0x51a655[_0x0c91('0x3d')],_0x51a655[_0x0c91('0x3e')]);_0x8bbcb2[_0x0c91('0x41')]=_[_0x0c91('0x42')](_0x51a655[_0x0c91('0x3d')],qs['fields'](_0x41b14b[_0x0c91('0x3e')]['fields']));_0x8bbcb2[_0x0c91('0x41')]=_0x8bbcb2[_0x0c91('0x41')][_0x0c91('0x43')]?_0x8bbcb2[_0x0c91('0x41')]:_0x51a655['model'];if(!_0x41b14b['query'][_0x0c91('0x44')](_0x0c91('0x45'))){_0x8bbcb2[_0x0c91('0x2a')]=qs[_0x0c91('0x2a')](_0x41b14b[_0x0c91('0x3e')][_0x0c91('0x2a')]);_0x8bbcb2[_0x0c91('0x29')]=qs[_0x0c91('0x29')](_0x41b14b['query']['offset']);}_0x8bbcb2['order']=qs[_0x0c91('0x46')](_0x41b14b[_0x0c91('0x3e')][_0x0c91('0x46')]);_0x8bbcb2[_0x0c91('0x47')]=qs[_0x0c91('0x40')](_[_0x0c91('0x48')](_0x41b14b[_0x0c91('0x3e')],_0x51a655['filters']),_0x345fe7);if(_0x41b14b[_0x0c91('0x3e')][_0x0c91('0x49')]){_0x8bbcb2[_0x0c91('0x47')]=_['merge'](_0x8bbcb2[_0x0c91('0x47')],{'$or':_[_0x0c91('0x38')](_0x345fe7,function(_0x247734){if(_0x247734[_0x0c91('0x4a')]!==_0x0c91('0x4b')){var _0x5f44d5={};_0x5f44d5[_0x247734[_0x0c91('0x35')]]={'$like':'%'+_0x41b14b[_0x0c91('0x3e')][_0x0c91('0x49')]+'%'};return _0x5f44d5;}})});}_0x8bbcb2=_[_0x0c91('0x4c')]({},_0x8bbcb2,_0x41b14b[_0x0c91('0x4d')]);var _0x1ac489={'where':_0x8bbcb2[_0x0c91('0x47')]};return db[_0x0c91('0x39')]['count'](_0x1ac489)[_0x0c91('0x1c')](function(_0x10de29){_0x25b0eb[_0x0c91('0x28')]=_0x10de29;if(_0x41b14b[_0x0c91('0x3e')]['includeAll']){_0x8bbcb2[_0x0c91('0x4e')]=[{'all':!![]}];}return db[_0x0c91('0x39')][_0x0c91('0x4f')](_0x8bbcb2);})[_0x0c91('0x1c')](function(_0x208215){_0x25b0eb[_0x0c91('0x50')]=_0x208215;return _0x25b0eb;})[_0x0c91('0x1c')](respondWithFilteredResult(_0x4f5693,_0x8bbcb2))[_0x0c91('0x51')](handleError(_0x4f5693,null));};exports[_0x0c91('0x52')]=function(_0x27ddb7,_0x38a3f4){var _0x3736cf={'raw':!![],'where':{'id':_0x27ddb7[_0x0c91('0x53')]['id']}},_0x54d303={};_0x54d303[_0x0c91('0x3d')]=_[_0x0c91('0x3f')](db['Network'][_0x0c91('0x3a')]);_0x54d303[_0x0c91('0x3e')]=_[_0x0c91('0x3f')](_0x27ddb7[_0x0c91('0x3e')]);_0x54d303[_0x0c91('0x40')]=_[_0x0c91('0x42')](_0x54d303[_0x0c91('0x3d')],_0x54d303['query']);_0x3736cf[_0x0c91('0x41')]=_[_0x0c91('0x42')](_0x54d303['model'],qs['fields'](_0x27ddb7[_0x0c91('0x3e')][_0x0c91('0x54')]));_0x3736cf[_0x0c91('0x41')]=_0x3736cf[_0x0c91('0x41')][_0x0c91('0x43')]?_0x3736cf[_0x0c91('0x41')]:_0x54d303[_0x0c91('0x3d')];if(_0x27ddb7[_0x0c91('0x3e')]['includeAll']){_0x3736cf['include']=[{'all':!![]}];}_0x3736cf=_[_0x0c91('0x4c')]({},_0x3736cf,_0x27ddb7[_0x0c91('0x4d')]);return db['Network']['find'](_0x3736cf)[_0x0c91('0x1c')](handleEntityNotFound(_0x38a3f4,null))['then'](respondWithResult(_0x38a3f4,null))[_0x0c91('0x51')](handleError(_0x38a3f4,null));};exports[_0x0c91('0x55')]=function(_0x175605,_0x1fe926,_0x23bd02){var _0x4c3139;return db[_0x0c91('0x56')][_0x0c91('0x57')](function(_0x4c50ec){return db[_0x0c91('0x39')][_0x0c91('0x55')](_0x175605[_0x0c91('0x58')],{'raw':!![]})[_0x0c91('0x1c')](function(_0x4c14b6){_0x4c3139=_0x4c14b6;return db[_0x0c91('0x39')]['findAll']({'where':{'type':_0x175605['body'][_0x0c91('0x4a')]},'raw':!![]});})[_0x0c91('0x1c')](function(_0x393c85){if(_0x4c3139[_0x0c91('0x4a')]['toUpperCase']()==_0x0c91('0x59')){var _0x50e2aa=fs[_0x0c91('0x5a')](path[_0x0c91('0x5b')](config['root'],_0x0c91('0x5c')),_0x0c91('0x5d'));var _0x1e7252=ejs[_0x0c91('0x5e')](_0x50e2aa,{'networks':_0x393c85||[]});fs[_0x0c91('0x5f')](_0x0c91('0x60'),_0x1e7252);return respondWithRpcPromise('Reload',_0x0c91('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x4c3139['type'][_0x0c91('0x61')]()==_0x0c91('0x62')){var _0x566d15=fs[_0x0c91('0x5a')](path[_0x0c91('0x5b')](config['root'],_0x0c91('0x63')),_0x0c91('0x5d'));var _0x32c88c=ejs[_0x0c91('0x5e')](_0x566d15,{'networks':_0x393c85||[]});fs[_0x0c91('0x5f')](_0x0c91('0x64'),_0x32c88c);return respondWithRpcPromise('Reload',_0x0c91('0x55'),{'module':_0x0c91('0x65')});}else{var _0x1a1225=fs['readFileSync'](path[_0x0c91('0x5b')](config[_0x0c91('0x66')],_0x0c91('0x67')),_0x0c91('0x5d'));var _0x295d57=ejs['render'](_0x1a1225,{'networks':_0x393c85||[]});fs[_0x0c91('0x5f')](util[_0x0c91('0x68')](_0x0c91('0x69'),_0x175605[_0x0c91('0x58')][_0x0c91('0x4a')][_0x0c91('0x6a')]()),_0x295d57);return respondWithRpcPromise(_0x0c91('0x6b'),'create',{'module':'chan_sip.so'});}return null;})[_0x0c91('0x1c')](function(){return _0x4c3139;});})['then'](respondWithResult(_0x1fe926,0xc9))[_0x0c91('0x51')](handleError(_0x1fe926,null));};exports['update']=function(_0x512043,_0xb13b89,_0x56f256){var _0x50e915;return db[_0x0c91('0x56')][_0x0c91('0x57')](function(_0x57b3ee){return db[_0x0c91('0x39')]['find']({'where':{'id':_0x512043[_0x0c91('0x53')]['id']}})['then'](handleEntityNotFound(_0xb13b89,null))['then'](saveUpdates(_0x512043[_0x0c91('0x58')],null))[_0x0c91('0x1c')](function(_0x2d1495){if(_0x2d1495){_0x50e915=_0x2d1495;return db[_0x0c91('0x39')][_0x0c91('0x4f')]({'where':{'type':_0x50e915[_0x0c91('0x4a')]},'raw':!![]});}return null;})[_0x0c91('0x1c')](function(_0x55dbd4){if(_0x50e915[_0x0c91('0x4a')][_0x0c91('0x61')]()==_0x0c91('0x59')){var _0x1cb15c=fs['readFileSync'](path[_0x0c91('0x5b')](config['root'],_0x0c91('0x5c')),_0x0c91('0x5d'));var _0x4f0b72=ejs[_0x0c91('0x5e')](_0x1cb15c,{'networks':_0x55dbd4||[]});fs[_0x0c91('0x5f')](_0x0c91('0x60'),_0x4f0b72);return respondWithRpcPromise(_0x0c91('0x6b'),_0x0c91('0x31'),{'module':_0x0c91('0x65')});}else if(_0x50e915[_0x0c91('0x4a')]['toUpperCase']()==_0x0c91('0x62')){var _0x2e4178=fs['readFileSync'](path['join'](config[_0x0c91('0x66')],'server/files/templates/turn_multiple.ejs'),_0x0c91('0x5d'));var _0x4bb65d=ejs[_0x0c91('0x5e')](_0x2e4178,{'networks':_0x55dbd4||[]});fs['writeFileSync'](_0x0c91('0x64'),_0x4bb65d);return respondWithRpcPromise('Reload',_0x0c91('0x31'),{'module':_0x0c91('0x65')});}else{var _0x39a72a=fs[_0x0c91('0x5a')](path[_0x0c91('0x5b')](config[_0x0c91('0x66')],_0x0c91('0x67')),_0x0c91('0x5d'));var _0x2a9767=ejs[_0x0c91('0x5e')](_0x39a72a,{'networks':_0x55dbd4||[]});fs[_0x0c91('0x5f')](util[_0x0c91('0x68')](_0x0c91('0x69'),_0x512043[_0x0c91('0x58')][_0x0c91('0x4a')][_0x0c91('0x6a')]()),_0x2a9767);return respondWithRpcPromise(_0x0c91('0x6b'),'update',{'module':_0x0c91('0x6c')});}return null;})[_0x0c91('0x1c')](function(_0x3fbdc5){if(_0x3fbdc5){return _0x50e915;}return null;});})['then'](respondWithResult(_0xb13b89,null))[_0x0c91('0x51')](handleError(_0xb13b89,null));};exports[_0x0c91('0x32')]=function(_0xd4bcf2,_0x3a4cae,_0x581e23){var _0x1554fb;return db[_0x0c91('0x39')]['find']({'where':{'id':_0xd4bcf2[_0x0c91('0x53')]['id']}})[_0x0c91('0x1c')](function(_0x439e21){_0x1554fb=_0x439e21;return _0x439e21;})['then'](handleEntityNotFound(_0x3a4cae,null))[_0x0c91('0x1c')](removeEntity(_0x3a4cae,null))[_0x0c91('0x1c')](function(){if(_0x1554fb){return db[_0x0c91('0x39')]['findAll']({'where':{'type':_0x1554fb[_0x0c91('0x4a')]},'raw':!![]});}})[_0x0c91('0x1c')](function(_0x95a466){if(_0x1554fb[_0x0c91('0x4a')][_0x0c91('0x61')]()==_0x0c91('0x59')){var _0x3f3334=fs[_0x0c91('0x5a')](path[_0x0c91('0x5b')](config[_0x0c91('0x66')],'server/files/templates/stun_multiple.ejs'),_0x0c91('0x5d'));var _0x53ab6f=ejs['render'](_0x3f3334,{'networks':_0x95a466||[]});fs[_0x0c91('0x5f')](_0x0c91('0x60'),_0x53ab6f);return respondWithRpcPromise('Reload',_0x0c91('0x32'),{'module':_0x0c91('0x65')});}else if(_0x1554fb[_0x0c91('0x4a')]['toUpperCase']()=='TURN'){var _0x281f91=fs[_0x0c91('0x5a')](path[_0x0c91('0x5b')](config[_0x0c91('0x66')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x290a9c=ejs['render'](_0x281f91,{'networks':_0x95a466||[]});fs[_0x0c91('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x290a9c);return respondWithRpcPromise(_0x0c91('0x6b'),'destroy',{'module':_0x0c91('0x65')});}else{var _0x56ce71=fs[_0x0c91('0x5a')](path['join'](config[_0x0c91('0x66')],_0x0c91('0x67')),_0x0c91('0x5d'));var _0x34d516=ejs[_0x0c91('0x5e')](_0x56ce71,{'networks':_0x95a466||[]});fs[_0x0c91('0x5f')](util['format'](_0x0c91('0x69'),_0xd4bcf2[_0x0c91('0x58')][_0x0c91('0x4a')][_0x0c91('0x6a')]()),_0x34d516);return respondWithRpcPromise(_0x0c91('0x6b'),'destroy',{'module':_0x0c91('0x6c')});}return null;})[_0x0c91('0x51')](handleError(_0x3a4cae,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 66c8081..3231fb0 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 _0x5b02=['define','Network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes','exports'];(function(_0xa35408,_0x315f2a){var _0xc71d1b=function(_0x3a90d1){while(--_0x3a90d1){_0xa35408['push'](_0xa35408['shift']());}};_0xc71d1b(++_0x315f2a);}(_0x5b02,0xe9));var _0x25b0=function(_0x40107b,_0x3cde33){_0x40107b=_0x40107b-0x0;var _0x4c4997=_0x5b02[_0x40107b];return _0x4c4997;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','Network','network','lodash'];(function(_0x27787d,_0x3c832a){var _0x2ec19c=function(_0x1d7c49){while(--_0x1d7c49){_0x27787d['push'](_0x27787d['shift']());}};_0x2ec19c(++_0x3c832a);}(_0xaa88,0x137));var _0x8aa8=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xaa88[_0x19a49f];return _0x5351ae;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 987daee..2fa512a 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 _0x1ec2=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x5f0627,_0x72504a){var _0x490fe6=function(_0x421e95){while(--_0x421e95){_0x5f0627['push'](_0x5f0627['shift']());}};_0x490fe6(++_0x72504a);}(_0x1ec2,0x1a0));var _0x21ec=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1ec2[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x21ec('0x0'));var util=require(_0x21ec('0x1'));var moment=require(_0x21ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x21ec('0x3'));var fs=require('fs');var Redis=require(_0x21ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21ec('0x5'))('rpc');var config=require(_0x21ec('0x6'));var jayson=require(_0x21ec('0x7'));var client=jayson[_0x21ec('0x8')][_0x21ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28729f,_0xe015f8,_0x575569){return new BPromise(function(_0xda0f71,_0x32c0c1){return client[_0x21ec('0xa')](_0x28729f,_0x575569)['then'](function(_0x41d602){logger['info'](_0x21ec('0xb'),_0xe015f8,_0x21ec('0xc'));logger[_0x21ec('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0xe015f8,_0x21ec('0xc'),JSON[_0x21ec('0xe')](_0x41d602));if(_0x41d602[_0x21ec('0xf')]){if(_0x41d602[_0x21ec('0xf')][_0x21ec('0x10')]===0x1f4){logger[_0x21ec('0xf')](_0x21ec('0xb'),_0xe015f8,_0x41d602[_0x21ec('0xf')][_0x21ec('0x11')]);return _0x32c0c1(_0x41d602['error']['message']);}logger[_0x21ec('0xf')]('Network,\x20%s,\x20%s',_0xe015f8,_0x41d602['error']['message']);return _0xda0f71(_0x41d602[_0x21ec('0xf')][_0x21ec('0x11')]);}else{logger[_0x21ec('0x12')](_0x21ec('0xb'),_0xe015f8,_0x21ec('0xc'));_0xda0f71(_0x41d602[_0x21ec('0x13')][_0x21ec('0x11')]);}})[_0x21ec('0x14')](function(_0x4799af){logger['error'](_0x21ec('0xb'),_0xe015f8,_0x4799af);_0x32c0c1(_0x4799af);});});} \ No newline at end of file +var _0xb8d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x5ebcc4,_0x24356a){var _0xff2552=function(_0x2f4f51){while(--_0x2f4f51){_0x5ebcc4['push'](_0x5ebcc4['shift']());}};_0xff2552(++_0x24356a);}(_0xb8d3,0x165));var _0x3b8d=function(_0x5982a5,_0x3dc07b){_0x5982a5=_0x5982a5-0x0;var _0x159c80=_0xb8d3[_0x5982a5];return _0x159c80;};'use strict';var _=require(_0x3b8d('0x0'));var util=require(_0x3b8d('0x1'));var moment=require(_0x3b8d('0x2'));var BPromise=require(_0x3b8d('0x3'));var rs=require(_0x3b8d('0x4'));var fs=require('fs');var Redis=require(_0x3b8d('0x5'));var db=require(_0x3b8d('0x6'))['db'];var utils=require(_0x3b8d('0x7'));var logger=require('../../config/logger')(_0x3b8d('0x8'));var config=require(_0x3b8d('0x9'));var jayson=require(_0x3b8d('0xa'));var client=jayson[_0x3b8d('0xb')][_0x3b8d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfadbad,_0x4dd467,_0x45288f){return new BPromise(function(_0x2d9dcd,_0x45f19c){return client['request'](_0xfadbad,_0x45288f)[_0x3b8d('0xd')](function(_0x19b0a8){logger[_0x3b8d('0xe')]('Network,\x20%s,\x20%s',_0x4dd467,_0x3b8d('0xf'));logger['debug'](_0x3b8d('0x10'),_0x4dd467,'request\x20sent',JSON[_0x3b8d('0x11')](_0x19b0a8));if(_0x19b0a8['error']){if(_0x19b0a8[_0x3b8d('0x12')][_0x3b8d('0x13')]===0x1f4){logger['error'](_0x3b8d('0x14'),_0x4dd467,_0x19b0a8[_0x3b8d('0x12')][_0x3b8d('0x15')]);return _0x45f19c(_0x19b0a8[_0x3b8d('0x12')]['message']);}logger[_0x3b8d('0x12')](_0x3b8d('0x14'),_0x4dd467,_0x19b0a8[_0x3b8d('0x12')][_0x3b8d('0x15')]);return _0x2d9dcd(_0x19b0a8[_0x3b8d('0x12')][_0x3b8d('0x15')]);}else{logger[_0x3b8d('0xe')]('Network,\x20%s,\x20%s',_0x4dd467,'request\x20sent');_0x2d9dcd(_0x19b0a8[_0x3b8d('0x16')][_0x3b8d('0x15')]);}})[_0x3b8d('0x17')](function(_0x5eda87){logger[_0x3b8d('0x12')](_0x3b8d('0x14'),_0x4dd467,_0x5eda87);_0x45f19c(_0x5eda87);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index c07207f..0c45b03 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 _0xf5c3=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','exports','multer','util'];(function(_0x503357,_0x22a271){var _0x47069f=function(_0x2b5478){while(--_0x2b5478){_0x503357['push'](_0x503357['shift']());}};_0x47069f(++_0x22a271);}(_0xf5c3,0x1ba));var _0x3f5c=function(_0x327f7d,_0x143154){_0x327f7d=_0x327f7d-0x0;var _0x1941a5=_0xf5c3[_0x327f7d];return _0x1941a5;};'use strict';var multer=require(_0x3f5c('0x0'));var util=require(_0x3f5c('0x1'));var path=require(_0x3f5c('0x2'));var timeout=require(_0x3f5c('0x3'));var express=require(_0x3f5c('0x4'));var router=express[_0x3f5c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3f5c('0x6'));var config=require(_0x3f5c('0x7'));var controller=require(_0x3f5c('0x8'));router[_0x3f5c('0x9')]('/',auth[_0x3f5c('0xa')](),controller['sendNotification']);module[_0x3f5c('0xb')]=router; \ No newline at end of file +var _0x54e5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x54e5,0x1f4));var _0x554e=function(_0x432075,_0x308bed){_0x432075=_0x432075-0x0;var _0x575582=_0x54e5[_0x432075];return _0x575582;};'use strict';var multer=require(_0x554e('0x0'));var util=require(_0x554e('0x1'));var path=require(_0x554e('0x2'));var timeout=require(_0x554e('0x3'));var express=require(_0x554e('0x4'));var router=express[_0x554e('0x5')]();var auth=require(_0x554e('0x6'));var interaction=require(_0x554e('0x7'));var config=require(_0x554e('0x8'));var controller=require(_0x554e('0x9'));router[_0x554e('0xa')]('/',auth[_0x554e('0xb')](),controller[_0x554e('0xc')]);module[_0x554e('0xd')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index e35897a..94a4be7 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 _0x5216=['exports','STRING','TEXT'];(function(_0x10cc4d,_0x1747ba){var _0x396027=function(_0x3e0465){while(--_0x3e0465){_0x10cc4d['push'](_0x10cc4d['shift']());}};_0x396027(++_0x1747ba);}(_0x5216,0x135));var _0x6521=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5216[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x6521('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6521('0x1')]},'recipientsId':{'type':Sequelize[_0x6521('0x2')]},'recipientsDescription':{'type':Sequelize[_0x6521('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x9d11=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9d11,0xc8));var _0x19d1=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x9d11[_0x2797c6];return _0x54809f;};'use strict';var Sequelize=require(_0x19d1('0x0'));module[_0x19d1('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x19d1('0x2')]},'recipientsId':{'type':Sequelize[_0x19d1('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x19d1('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 5d451b3..2051120 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 _0xcea7=['Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','Template','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','view','catch','startCase','User','ids','queue','Queue','push','union','flatten','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','sendNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcea7,0x8e));var _0x7cea=function(_0x45988c,_0x251681){_0x45988c=_0x45988c-0x0;var _0x2774a2=_0xcea7[_0x45988c];return _0x2774a2;};'use strict';var pdf=require(_0x7cea('0x0'));var emlformat=require(_0x7cea('0x1'));var rimraf=require(_0x7cea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7cea('0x3'));var moment=require('moment');var BPromise=require(_0x7cea('0x4'));var Mustache=require(_0x7cea('0x5'));var util=require(_0x7cea('0x6'));var path=require(_0x7cea('0x7'));var sox=require(_0x7cea('0x8'));var csv=require(_0x7cea('0x9'));var ejs=require(_0x7cea('0xa'));var fs=require('fs');var _=require(_0x7cea('0xb'));var squel=require(_0x7cea('0xc'));var crypto=require(_0x7cea('0xd'));var jsforce=require(_0x7cea('0xe'));var deskjs=require(_0x7cea('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cea('0x10'));var authService=require(_0x7cea('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7cea('0x12'));var logger=require('../../config/logger')(_0x7cea('0x13'));var utils=require(_0x7cea('0x14'));var config=require(_0x7cea('0x15'));var db=require('../../mysqldb')['db'];config[_0x7cea('0x16')]=_[_0x7cea('0x17')](config[_0x7cea('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cea('0x18'))(new Redis(config['redis']));require('./notification.socket')[_0x7cea('0x19')](socket);function respondWithStatusCode(_0x138940,_0x1c6bd7){_0x1c6bd7=_0x1c6bd7||0xcc;return function(_0x2e759c){if(_0x2e759c){return _0x138940['sendStatus'](_0x1c6bd7);}return _0x138940[_0x7cea('0x1a')](_0x1c6bd7)[_0x7cea('0x1b')]();};}function respondWithResult(_0x55b562,_0x4f0733){_0x4f0733=_0x4f0733||0xc8;return function(_0x3fad0d){if(_0x3fad0d){return _0x55b562[_0x7cea('0x1a')](_0x4f0733)[_0x7cea('0x1c')](_0x3fad0d);}};}function respondWithFilteredResult(_0x3bc517,_0x1ae034){return function(_0x21b063){if(_0x21b063){var _0x8e499b=_0x21b063[_0x7cea('0x1d')],_0x2d6217=_0x1ae034[_0x7cea('0x1e')],_0x5f2bf9=_0x1ae034[_0x7cea('0x1e')]+_0x1ae034[_0x7cea('0x1f')],_0x483c1a;if(_0x5f2bf9>=_0x8e499b){_0x5f2bf9=_0x8e499b;_0x483c1a=0xc8;}else{_0x483c1a=0xce;}_0x3bc517[_0x7cea('0x1a')](_0x483c1a);return _0x3bc517[_0x7cea('0x20')](_0x7cea('0x21'),_0x2d6217+'-'+_0x5f2bf9+'/'+_0x8e499b)['json'](_0x21b063);}return null;};}function patchUpdates(_0x30520c){return function(_0x4611dd){try{jsonpatch['apply'](_0x4611dd,_0x30520c,!![]);}catch(_0x30fab4){return BPromise[_0x7cea('0x22')](_0x30fab4);}return _0x4611dd['save']();};}function saveUpdates(_0x2d1951,_0x199331){return function(_0x13474f){if(_0x13474f){return _0x13474f['update'](_0x2d1951)[_0x7cea('0x23')](function(_0x4a8b57){return _0x4a8b57;});}return null;};}function removeEntity(_0x53bb6e,_0x2724bf){return function(_0x312bf5){if(_0x312bf5){return _0x312bf5[_0x7cea('0x24')]()[_0x7cea('0x23')](function(){_0x53bb6e[_0x7cea('0x1a')](0xcc)[_0x7cea('0x1b')]();});}};}function handleEntityNotFound(_0x3e0a84,_0x180de4){return function(_0x1bda3d){if(!_0x1bda3d){_0x3e0a84[_0x7cea('0x25')](0x194);}return _0x1bda3d;};}function handleError(_0x447fc4,_0x3767b3){_0x3767b3=_0x3767b3||0x1f4;return function(_0x1fa5b2){logger[_0x7cea('0x26')](_0x1fa5b2[_0x7cea('0x27')]);if(_0x1fa5b2['name']){delete _0x1fa5b2[_0x7cea('0x28')];}_0x447fc4[_0x7cea('0x1a')](_0x3767b3)[_0x7cea('0x29')](_0x1fa5b2);};}exports[_0x7cea('0x2a')]=function(_0x83422f,_0x4bd0ed,_0x3a9521){if(!_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')](_0x7cea('0x2d'))&&!_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')]('TemplateId')){throw new db['Sequelize'][(_0x7cea('0x2e'))](_0x7cea('0x2f'));}else{if(_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')]('TemplateId')&&!_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')]('view')){throw new db[(_0x7cea('0x30'))][(_0x7cea('0x2e'))](_0x7cea('0x31'));}if(!_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')](_0x7cea('0x32'))){throw new db[(_0x7cea('0x30'))][(_0x7cea('0x2e'))](_0x7cea('0x33'));}else{try{var _0x5ec75d=JSON['parse'](_0x83422f[_0x7cea('0x2b')][_0x7cea('0x32')]);}catch(_0xed1e61){logger[_0x7cea('0x26')](_0xed1e61);throw new db[(_0x7cea('0x30'))][(_0x7cea('0x2e'))](_0x7cea('0x34'));}var _0x10ff41=[_0x7cea('0x35'),_0x7cea('0x36'),_0x7cea('0x37'),_0x7cea('0x38'),'smsqueue',_0x7cea('0x39'),_0x7cea('0x3a'),_0x7cea('0x3b'),_0x7cea('0x3c')];if(_[_0x7cea('0x3d')](_0x5ec75d,function(_0x3b4e8c){return!_[_0x7cea('0x3e')](_0x10ff41,_0x3b4e8c[_0x7cea('0x3f')][_0x7cea('0x40')]());})){throw new db[(_0x7cea('0x30'))]['ValidationError'](_0x7cea('0x41'));}}}var _0x38e00d={};_0x38e00d[_0x7cea('0x42')]=_0x83422f[_0x7cea('0x2b')][_0x7cea('0x2c')]('senderName')?_0x83422f[_0x7cea('0x2b')][_0x7cea('0x42')]:_0x83422f[_0x7cea('0x3c')][_0x7cea('0x43')];_0x38e00d[_0x7cea('0x44')]=_[_0x7cea('0x45')](_0x83422f[_0x7cea('0x2b')][_0x7cea('0x44')])?null:_0x83422f[_0x7cea('0x2b')][_0x7cea('0x44')];_0x38e00d[_0x7cea('0x46')]=_0x83422f[_0x7cea('0x2b')]['beep']||![];_0x38e00d['SenderId']=_0x83422f[_0x7cea('0x3c')]['id'];return getContent(_0x83422f['body'])[_0x7cea('0x23')](function(_0x24db85){_0x38e00d[_0x7cea('0x2b')]=_0x24db85;return getRecipients(_0x5ec75d);})[_0x7cea('0x23')](function(_0xd35956){_0x38e00d['recipientsId']=_[_0x7cea('0x47')](_0xd35956)[_0x7cea('0x48')](',');return db[_0x7cea('0x49')][_0x7cea('0x4a')](function(_0x4b9ec3){return db[_0x7cea('0x4b')][_0x7cea('0x4c')](_0x38e00d,{'raw':!![],'transaction':_0x4b9ec3})[_0x7cea('0x23')](function(_0x46793e){var _0x4edb64={'sender':_0x38e00d[_0x7cea('0x42')],'description':_0x38e00d[_0x7cea('0x44')],'content':_0x38e00d[_0x7cea('0x2b')],'beep':_0x38e00d[_0x7cea('0x46')]};_0xd35956[_0x7cea('0x4d')](function(_0x3f9b8d){_0x4edb64[_0x7cea('0x4e')]=_0x3f9b8d;socket[_0x7cea('0x4f')](_0x7cea('0x50'),_0x4edb64);});return _0x46793e;});});})['then'](respondWithResult(_0x4bd0ed,0xc9))['catch'](handleError(_0x4bd0ed,null));};function getContent(_0x5bc34d){return new BPromise(function(_0x27333c,_0x5d7334){if(_0x5bc34d[_0x7cea('0x2d')]){_0x27333c(_0x5bc34d[_0x7cea('0x2d')]);return;}return db[_0x7cea('0x51')][_0x7cea('0x52')]({'attributes':['html'],'where':{'id':_0x5bc34d[_0x7cea('0x53')]},'raw':!![]})[_0x7cea('0x23')](function(_0x532e5c){if(!_0x532e5c)throw new db[(_0x7cea('0x30'))][(_0x7cea('0x2e'))](_0x7cea('0x54'));var _0x792b51=Mustache['render'](_0x532e5c['html'],_0x5bc34d[_0x7cea('0x55')]);_0x27333c(_0x792b51);})[_0x7cea('0x56')](function(_0x36f280){_0x5d7334(_0x36f280);});});}function getRecipients(_0x153113){return new BPromise(function(_0x2c94c2,_0x8aa20b){var _0x4be4ae=[];var _0xb5e39f=[];_0x153113[_0x7cea('0x4d')](function(_0x4f414c){var _0x287031=_[_0x7cea('0x57')](_0x4f414c[_0x7cea('0x3f')][_0x7cea('0x40')]());if(_0x287031===_0x7cea('0x58')){_0x4be4ae=_['union'](_0x4be4ae,_0x4f414c[_0x7cea('0x59')]);}else{if(_[_0x7cea('0x3e')](_0x287031,'queue'))_0x287031=_0x287031['replace'](_0x7cea('0x5a'),_0x7cea('0x5b'));_0x4f414c[_0x7cea('0x59')][_0x7cea('0x4d')](function(_0x50ad89){_0xb5e39f[_0x7cea('0x5c')](getAgents(_0x287031,_0x50ad89));});}});return BPromise['all'](_0xb5e39f)[_0x7cea('0x23')](function(_0x3d8f0e){_0x4be4ae=_[_0x7cea('0x5d')](_0x4be4ae,_[_0x7cea('0x5e')](_0x3d8f0e));_0x2c94c2(_0x4be4ae);})[_0x7cea('0x56')](function(_0x7127a1){_0x8aa20b(_0x7127a1);});});}function getAgents(_0x276cc4,_0x6459eb){return new BPromise(function(_0x2b05f8,_0xbed050){return db[_0x276cc4][_0x7cea('0x52')]({'where':{'id':_0x6459eb}})[_0x7cea('0x23')](function(_0x4e3b7a){return _0x4e3b7a['getAgents']({'attributes':['id'],'raw':!![]})[_0x7cea('0x23')](function(_0x2c2139){var _0x18a44e=_['map'](_0x2c2139,'id');_0x2b05f8(_0x18a44e);});})[_0x7cea('0x56')](function(_0x20741d){_0xbed050(_0x20741d);});});} \ No newline at end of file +var _0xe7d8=['Queue','push','all','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','status','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','name','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','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','forEach','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','ids','queue','replace'];(function(_0x1a69fb,_0x4f458a){var _0x217808=function(_0x1040f6){while(--_0x1040f6){_0x1a69fb['push'](_0x1a69fb['shift']());}};_0x217808(++_0x4f458a);}(_0xe7d8,0x18d));var _0x8e7d=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0xe7d8[_0x566168];return _0x4e1f7a;};'use strict';var pdf=require(_0x8e7d('0x0'));var emlformat=require(_0x8e7d('0x1'));var rimraf=require(_0x8e7d('0x2'));var zipdir=require(_0x8e7d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e7d('0x4'));var moment=require(_0x8e7d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8e7d('0x6'));var util=require(_0x8e7d('0x7'));var path=require(_0x8e7d('0x8'));var sox=require(_0x8e7d('0x9'));var csv=require('to-csv');var ejs=require(_0x8e7d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e7d('0xb'));var crypto=require(_0x8e7d('0xc'));var jsforce=require(_0x8e7d('0xd'));var deskjs=require(_0x8e7d('0xe'));var toCsv=require(_0x8e7d('0xf'));var querystring=require(_0x8e7d('0x10'));var Papa=require(_0x8e7d('0x11'));var Redis=require(_0x8e7d('0x12'));var authService=require(_0x8e7d('0x13'));var qs=require(_0x8e7d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e7d('0x15'));var logger=require(_0x8e7d('0x16'))(_0x8e7d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8e7d('0x18'))['db'];config[_0x8e7d('0x19')]=_[_0x8e7d('0x1a')](config[_0x8e7d('0x19')],{'host':_0x8e7d('0x1b'),'port':0x18eb});var socket=require(_0x8e7d('0x1c'))(new Redis(config[_0x8e7d('0x19')]));require(_0x8e7d('0x1d'))[_0x8e7d('0x1e')](socket);function respondWithStatusCode(_0x44aefb,_0x189e08){_0x189e08=_0x189e08||0xcc;return function(_0x933160){if(_0x933160){return _0x44aefb['sendStatus'](_0x189e08);}return _0x44aefb[_0x8e7d('0x1f')](_0x189e08)['end']();};}function respondWithResult(_0x7c5040,_0x4af55f){_0x4af55f=_0x4af55f||0xc8;return function(_0xf87734){if(_0xf87734){return _0x7c5040[_0x8e7d('0x1f')](_0x4af55f)[_0x8e7d('0x20')](_0xf87734);}};}function respondWithFilteredResult(_0x5a1ee8,_0x5a589f){return function(_0x59c082){if(_0x59c082){var _0x472915=_0x59c082[_0x8e7d('0x21')],_0x44008c=_0x5a589f[_0x8e7d('0x22')],_0x529133=_0x5a589f[_0x8e7d('0x22')]+_0x5a589f[_0x8e7d('0x23')],_0x11ae0f;if(_0x529133>=_0x472915){_0x529133=_0x472915;_0x11ae0f=0xc8;}else{_0x11ae0f=0xce;}_0x5a1ee8['status'](_0x11ae0f);return _0x5a1ee8['set'](_0x8e7d('0x24'),_0x44008c+'-'+_0x529133+'/'+_0x472915)[_0x8e7d('0x20')](_0x59c082);}return null;};}function patchUpdates(_0x26187e){return function(_0x15e7da){try{jsonpatch[_0x8e7d('0x25')](_0x15e7da,_0x26187e,!![]);}catch(_0x44708c){return BPromise['reject'](_0x44708c);}return _0x15e7da[_0x8e7d('0x26')]();};}function saveUpdates(_0x2de1cf,_0x599e20){return function(_0x14e129){if(_0x14e129){return _0x14e129[_0x8e7d('0x27')](_0x2de1cf)[_0x8e7d('0x28')](function(_0x5183b8){return _0x5183b8;});}return null;};}function removeEntity(_0x80e8f3,_0x3c93a2){return function(_0x5cee9e){if(_0x5cee9e){return _0x5cee9e['destroy']()['then'](function(){_0x80e8f3[_0x8e7d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27d907,_0x2dcc5f){return function(_0x3d2736){if(!_0x3d2736){_0x27d907[_0x8e7d('0x29')](0x194);}return _0x3d2736;};}function handleError(_0x53d2b8,_0x31c388){_0x31c388=_0x31c388||0x1f4;return function(_0x524673){logger['error'](_0x524673['stack']);if(_0x524673[_0x8e7d('0x2a')]){delete _0x524673[_0x8e7d('0x2a')];}_0x53d2b8[_0x8e7d('0x1f')](_0x31c388)['send'](_0x524673);};}exports[_0x8e7d('0x2b')]=function(_0x5b2888,_0x1755e3,_0x3374ed){if(!_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x2d')](_0x8e7d('0x2e'))&&!_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x2d')](_0x8e7d('0x2f'))){throw new db[(_0x8e7d('0x30'))][(_0x8e7d('0x31'))](_0x8e7d('0x32'));}else{if(_0x5b2888['body']['hasOwnProperty'](_0x8e7d('0x2f'))&&!_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x2d')](_0x8e7d('0x33'))){throw new db['Sequelize'][(_0x8e7d('0x31'))](_0x8e7d('0x34'));}if(!_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x2d')](_0x8e7d('0x35'))){throw new db['Sequelize'][(_0x8e7d('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x304b4b=JSON[_0x8e7d('0x36')](_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x35')]);}catch(_0x503d3){logger[_0x8e7d('0x37')](_0x503d3);throw new db[(_0x8e7d('0x30'))][(_0x8e7d('0x31'))](_0x8e7d('0x38'));}var _0x18de68=[_0x8e7d('0x39'),_0x8e7d('0x3a'),_0x8e7d('0x3b'),'openchannelqueue',_0x8e7d('0x3c'),'voicequeue','whatsappqueue',_0x8e7d('0x3d'),_0x8e7d('0x3e')];if(_[_0x8e7d('0x3f')](_0x304b4b,function(_0x1ac792){return!_[_0x8e7d('0x40')](_0x18de68,_0x1ac792['model'][_0x8e7d('0x41')]());})){throw new db[(_0x8e7d('0x30'))][(_0x8e7d('0x31'))](_0x8e7d('0x42'));}}}var _0x5c4918={};_0x5c4918[_0x8e7d('0x43')]=_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x2d')](_0x8e7d('0x43'))?_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x43')]:_0x5b2888['user']['fullname'];_0x5c4918[_0x8e7d('0x44')]=_[_0x8e7d('0x45')](_0x5b2888[_0x8e7d('0x2c')]['recipientsDescription'])?null:_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x44')];_0x5c4918[_0x8e7d('0x46')]=_0x5b2888[_0x8e7d('0x2c')][_0x8e7d('0x46')]||![];_0x5c4918[_0x8e7d('0x47')]=_0x5b2888[_0x8e7d('0x3e')]['id'];return getContent(_0x5b2888['body'])[_0x8e7d('0x28')](function(_0x22f372){_0x5c4918['body']=_0x22f372;return getRecipients(_0x304b4b);})[_0x8e7d('0x28')](function(_0x278a12){_0x5c4918[_0x8e7d('0x48')]=_[_0x8e7d('0x49')](_0x278a12)['join'](',');return db[_0x8e7d('0x4a')][_0x8e7d('0x4b')](function(_0x801dc){return db['Notification'][_0x8e7d('0x4c')](_0x5c4918,{'raw':!![],'transaction':_0x801dc})[_0x8e7d('0x28')](function(_0x4a025c){var _0x47b203={'sender':_0x5c4918[_0x8e7d('0x43')],'description':_0x5c4918[_0x8e7d('0x44')],'content':_0x5c4918[_0x8e7d('0x2c')],'beep':_0x5c4918['beep']};_0x278a12[_0x8e7d('0x4d')](function(_0xe5862b){_0x47b203['recipient']=_0xe5862b;socket[_0x8e7d('0x4e')](_0x8e7d('0x4f'),_0x47b203);});return _0x4a025c;});});})['then'](respondWithResult(_0x1755e3,0xc9))[_0x8e7d('0x50')](handleError(_0x1755e3,null));};function getContent(_0x17deb5){return new BPromise(function(_0x3e0bd9,_0x2d6d34){if(_0x17deb5['text']){_0x3e0bd9(_0x17deb5[_0x8e7d('0x2e')]);return;}return db[_0x8e7d('0x51')][_0x8e7d('0x52')]({'attributes':[_0x8e7d('0x53')],'where':{'id':_0x17deb5[_0x8e7d('0x2f')]},'raw':!![]})['then'](function(_0xbf2a){if(!_0xbf2a)throw new db[(_0x8e7d('0x30'))]['ValidationError'](_0x8e7d('0x54'));var _0x390f78=Mustache[_0x8e7d('0x55')](_0xbf2a[_0x8e7d('0x53')],_0x17deb5[_0x8e7d('0x33')]);_0x3e0bd9(_0x390f78);})['catch'](function(_0x3b8ddd){_0x2d6d34(_0x3b8ddd);});});}function getRecipients(_0x44be44){return new BPromise(function(_0x2077a2,_0x3f8b0b){var _0x15e4ae=[];var _0x529972=[];_0x44be44[_0x8e7d('0x4d')](function(_0x383e88){var _0x2c32b7=_[_0x8e7d('0x56')](_0x383e88[_0x8e7d('0x57')]['toLowerCase']());if(_0x2c32b7===_0x8e7d('0x58')){_0x15e4ae=_[_0x8e7d('0x59')](_0x15e4ae,_0x383e88[_0x8e7d('0x5a')]);}else{if(_[_0x8e7d('0x40')](_0x2c32b7,_0x8e7d('0x5b')))_0x2c32b7=_0x2c32b7[_0x8e7d('0x5c')](_0x8e7d('0x5b'),_0x8e7d('0x5d'));_0x383e88[_0x8e7d('0x5a')][_0x8e7d('0x4d')](function(_0x101f0e){_0x529972[_0x8e7d('0x5e')](getAgents(_0x2c32b7,_0x101f0e));});}});return BPromise[_0x8e7d('0x5f')](_0x529972)[_0x8e7d('0x28')](function(_0x63c87d){_0x15e4ae=_[_0x8e7d('0x59')](_0x15e4ae,_['flatten'](_0x63c87d));_0x2077a2(_0x15e4ae);})[_0x8e7d('0x50')](function(_0x15d8e3){_0x3f8b0b(_0x15d8e3);});});}function getAgents(_0x5759b6,_0x55a244){return new BPromise(function(_0x50e0f1,_0x4eb6a3){return db[_0x5759b6]['findOne']({'where':{'id':_0x55a244}})[_0x8e7d('0x28')](function(_0x441c24){return _0x441c24[_0x8e7d('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3cb766){var _0x4355a3=_[_0x8e7d('0x61')](_0x3cb766,'id');_0x50e0f1(_0x4355a3);});})[_0x8e7d('0x50')](function(_0x178e61){_0x4eb6a3(_0x178e61);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 1f0db61..31f62e1 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 _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x5e7b5c,_0x2d2351){var _0x59eb17=function(_0x2477c8){while(--_0x2477c8){_0x5e7b5c['push'](_0x5e7b5c['shift']());}};_0x59eb17(++_0x2d2351);}(_0xb10b,0x12a));var _0xbb10=function(_0x8a7bcb,_0x2cf7d1){_0x8a7bcb=_0x8a7bcb-0x0;var _0x23ccc0=_0xb10b[_0x8a7bcb];return _0x23ccc0;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2032,0xd9));var _0x2203=function(_0x534970,_0x71bf08){_0x534970=_0x534970-0x0;var _0x4c7348=_0x2032[_0x534970];return _0x4c7348;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index b2935bb..c840ee1 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 _0xb03e=['request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x146f3a,_0x373e03){var _0x4ebd8a=function(_0x2b4ea9){while(--_0x2b4ea9){_0x146f3a['push'](_0x146f3a['shift']());}};_0x4ebd8a(++_0x373e03);}(_0xb03e,0x1eb));var _0xeb03=function(_0x306add,_0x149c58){_0x306add=_0x306add-0x0;var _0x11d04a=_0xb03e[_0x306add];return _0x11d04a;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb03('0xe'),'collate':_0xeb03('0xf')});}; \ No newline at end of file +var _0x4cf8=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','notifications'];(function(_0x2300fa,_0x41c382){var _0x11fef0=function(_0x597ffb){while(--_0x597ffb){_0x2300fa['push'](_0x2300fa['shift']());}};_0x11fef0(++_0x41c382);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x27bca8,_0x191f63){_0x27bca8=_0x27bca8-0x0;var _0x370163=_0x4cf8[_0x27bca8];return _0x370163;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('Notification',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x84cf('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 7b36d6e..681e925 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 _0x424b=['request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x424b,0xe5));var _0xb424=function(_0x5d4a2b,_0xaabd31){_0x5d4a2b=_0x5d4a2b-0x0;var _0x34529b=_0x424b[_0x5d4a2b];return _0x34529b;};'use strict';var _=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var moment=require('moment');var BPromise=require(_0xb424('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb424('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb424('0x4'));var logger=require(_0xb424('0x5'))('rpc');var config=require(_0xb424('0x6'));var jayson=require(_0xb424('0x7'));var client=jayson['client'][_0xb424('0x8')]({'port':0x232a});config[_0xb424('0x9')]=_[_0xb424('0xa')](config[_0xb424('0x9')],{'host':_0xb424('0xb'),'port':0x18eb});var socket=require(_0xb424('0xc'))(new Redis(config[_0xb424('0x9')]));require('./notification.socket')[_0xb424('0xd')](socket);function respondWithRpcPromise(_0x37243d,_0x1f4d20,_0x45bb10){return new BPromise(function(_0x3e8ce0,_0x179702){return client[_0xb424('0xe')](_0x37243d,_0x45bb10)[_0xb424('0xf')](function(_0x30865f){logger[_0xb424('0x10')](_0xb424('0x11'),_0x1f4d20,'request\x20sent');logger[_0xb424('0x12')](_0xb424('0x13'),_0x1f4d20,_0xb424('0x14'),JSON[_0xb424('0x15')](_0x30865f));if(_0x30865f[_0xb424('0x16')]){if(_0x30865f[_0xb424('0x16')][_0xb424('0x17')]===0x1f4){logger[_0xb424('0x16')](_0xb424('0x11'),_0x1f4d20,_0x30865f[_0xb424('0x16')][_0xb424('0x18')]);return _0x179702(_0x30865f['error'][_0xb424('0x18')]);}logger[_0xb424('0x16')](_0xb424('0x11'),_0x1f4d20,_0x30865f[_0xb424('0x16')][_0xb424('0x18')]);return _0x3e8ce0(_0x30865f[_0xb424('0x16')][_0xb424('0x18')]);}else{logger[_0xb424('0x10')](_0xb424('0x11'),_0x1f4d20,_0xb424('0x14'));_0x3e8ce0(_0x30865f[_0xb424('0x19')]['message']);}})[_0xb424('0x1a')](function(_0x38af4c){logger['error'](_0xb424('0x11'),_0x1f4d20,_0x38af4c);_0x179702(_0x38af4c);});});} \ No newline at end of file +var _0x6af3=['defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','Notification,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x463c90,_0x4ac540){var _0x4ce53e=function(_0x1345d5){while(--_0x1345d5){_0x463c90['push'](_0x463c90['shift']());}};_0x4ce53e(++_0x4ac540);}(_0x6af3,0x17b));var _0x36af=function(_0x2a3a4b,_0x49abfa){_0x2a3a4b=_0x2a3a4b-0x0;var _0x3ec061=_0x6af3[_0x2a3a4b];return _0x3ec061;};'use strict';var _=require(_0x36af('0x0'));var util=require(_0x36af('0x1'));var moment=require('moment');var BPromise=require(_0x36af('0x2'));var rs=require(_0x36af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36af('0x4'))['db'];var utils=require(_0x36af('0x5'));var logger=require(_0x36af('0x6'))(_0x36af('0x7'));var config=require(_0x36af('0x8'));var jayson=require(_0x36af('0x9'));var client=jayson[_0x36af('0xa')][_0x36af('0xb')]({'port':0x232a});config[_0x36af('0xc')]=_[_0x36af('0xd')](config['redis'],{'host':_0x36af('0xe'),'port':0x18eb});var socket=require(_0x36af('0xf'))(new Redis(config[_0x36af('0xc')]));require(_0x36af('0x10'))[_0x36af('0x11')](socket);function respondWithRpcPromise(_0x235318,_0x68bee5,_0x115e29){return new BPromise(function(_0x1c634e,_0x28d5ba){return client[_0x36af('0x12')](_0x235318,_0x115e29)[_0x36af('0x13')](function(_0x37d92b){logger['info'](_0x36af('0x14'),_0x68bee5,'request\x20sent');logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x68bee5,'request\x20sent',JSON[_0x36af('0x15')](_0x37d92b));if(_0x37d92b[_0x36af('0x16')]){if(_0x37d92b[_0x36af('0x16')]['code']===0x1f4){logger[_0x36af('0x16')](_0x36af('0x14'),_0x68bee5,_0x37d92b[_0x36af('0x16')][_0x36af('0x17')]);return _0x28d5ba(_0x37d92b[_0x36af('0x16')][_0x36af('0x17')]);}logger[_0x36af('0x16')](_0x36af('0x14'),_0x68bee5,_0x37d92b['error'][_0x36af('0x17')]);return _0x1c634e(_0x37d92b[_0x36af('0x16')][_0x36af('0x17')]);}else{logger[_0x36af('0x18')](_0x36af('0x14'),_0x68bee5,_0x36af('0x19'));_0x1c634e(_0x37d92b[_0x36af('0x1a')][_0x36af('0x17')]);}})[_0x36af('0x1b')](function(_0x3ffceb){logger[_0x36af('0x16')]('Notification,\x20%s,\x20%s',_0x68bee5,_0x3ffceb);_0x28d5ba(_0x3ffceb);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index cdd0947..1ba8afb 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 _0x9b15=['removeListener','length','notification:','./notification.events','save','remove','update','emit'];(function(_0x491c82,_0x4b8308){var _0x3defe8=function(_0x19df3f){while(--_0x19df3f){_0x491c82['push'](_0x491c82['shift']());}};_0x3defe8(++_0x4b8308);}(_0x9b15,0x12b));var _0x59b1=function(_0xad7c32,_0x53755e){_0xad7c32=_0xad7c32-0x0;var _0x52ba47=_0x9b15[_0xad7c32];return _0x52ba47;};'use strict';var NotificationEvents=require(_0x59b1('0x0'));var events=[_0x59b1('0x1'),_0x59b1('0x2'),_0x59b1('0x3')];function createListener(_0x264395,_0x4599ef){return function(_0x51debe){_0x4599ef[_0x59b1('0x4')](_0x264395,_0x51debe);};}function removeListener(_0x224fea,_0x107479){return function(){NotificationEvents[_0x59b1('0x5')](_0x224fea,_0x107479);};}exports['register']=function(_0x1b9fd9){for(var _0x491773=0x0,_0x469554=events[_0x59b1('0x6')];_0x491773<_0x469554;_0x491773++){var _0x1018ec=events[_0x491773];var _0x4020d8=createListener(_0x59b1('0x7')+_0x1018ec,_0x1b9fd9);NotificationEvents['on'](_0x1018ec,_0x4020d8);}}; \ No newline at end of file +var _0x43bd=['remove','update','emit','removeListener','register','length','notification:'];(function(_0x1a8b18,_0x31291e){var _0x523ba8=function(_0x54ff45){while(--_0x54ff45){_0x1a8b18['push'](_0x1a8b18['shift']());}};_0x523ba8(++_0x31291e);}(_0x43bd,0x13b));var _0xd43b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x43bd[_0x20a584];return _0x4b41a8;};'use strict';var NotificationEvents=require('./notification.events');var events=['save',_0xd43b('0x0'),_0xd43b('0x1')];function createListener(_0x4dfe33,_0x4f7412){return function(_0x5b2e3e){_0x4f7412[_0xd43b('0x2')](_0x4dfe33,_0x5b2e3e);};}function removeListener(_0x2c709d,_0x403ebc){return function(){NotificationEvents[_0xd43b('0x3')](_0x2c709d,_0x403ebc);};}exports[_0xd43b('0x4')]=function(_0x5b69a1){for(var _0x2a5fdc=0x0,_0x26c1fc=events[_0xd43b('0x5')];_0x2a5fdc<_0x26c1fc;_0x2a5fdc++){var _0xc828a6=events[_0x2a5fdc];var _0x1a0429=createListener(_0xd43b('0x6')+_0xc828a6,_0x5b69a1);NotificationEvents['on'](_0xc828a6,_0x1a0429);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 5193350..d18e574 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 _0xfccb=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','destroy','removeDispositions','delete','removeAnswers','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions'];(function(_0x105c50,_0x29ba3e){var _0x570327=function(_0x3fa438){while(--_0x3fa438){_0x105c50['push'](_0x105c50['shift']());}};_0x570327(++_0x29ba3e);}(_0xfccb,0x138));var _0xbfcc=function(_0x1b92b2,_0x275dbe){_0x1b92b2=_0x1b92b2-0x0;var _0x2613e8=_0xfccb[_0x1b92b2];return _0x2613e8;};'use strict';var multer=require(_0xbfcc('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcc('0x1')]();var auth=require(_0xbfcc('0x2'));var interaction=require(_0xbfcc('0x3'));var config=require('../../config/environment');var controller=require(_0xbfcc('0x4'));router['get']('/',auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x6')]);router[_0xbfcc('0x7')](_0xbfcc('0x8'),auth[_0xbfcc('0x5')](),controller['describe']);router[_0xbfcc('0x7')](_0xbfcc('0x9'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0xa')]);router[_0xbfcc('0x7')](_0xbfcc('0xb'),auth[_0xbfcc('0x5')](),controller['getDispositions']);router[_0xbfcc('0x7')](_0xbfcc('0xc'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0xd')]);router['get'](_0xbfcc('0xe'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0xf')]);router[_0xbfcc('0x7')](_0xbfcc('0x10'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x11')]);router[_0xbfcc('0x7')](_0xbfcc('0x12'),auth['isAuthenticated'](),controller[_0xbfcc('0x13')]);router['post']('/',auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x14')]);router[_0xbfcc('0x15')](_0xbfcc('0xb'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x16')]);router[_0xbfcc('0x15')](_0xbfcc('0xc'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x17')]);router[_0xbfcc('0x15')](_0xbfcc('0x18'),controller[_0xbfcc('0x19')]);router[_0xbfcc('0x15')](_0xbfcc('0xe'),auth['isAuthenticated'](),controller[_0xbfcc('0x1a')]);router[_0xbfcc('0x15')](_0xbfcc('0x12'),auth['isAuthenticated'](),controller[_0xbfcc('0x1b')]);router[_0xbfcc('0x15')](_0xbfcc('0x1c'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x1d')]);router['put'](_0xbfcc('0x9'),auth['isAuthenticated'](),controller[_0xbfcc('0x1e')]);router['delete'](_0xbfcc('0x9'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x1f')]);router['delete'](_0xbfcc('0xb'),auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x20')]);router[_0xbfcc('0x21')]('/:id/canned_answers',auth[_0xbfcc('0x5')](),controller[_0xbfcc('0x22')]);router['delete'](_0xbfcc('0x12'),auth[_0xbfcc('0x5')](),controller['removeAgents']);module[_0xbfcc('0x23')]=router; \ No newline at end of file +var _0xa430=['delete','destroy','removeAnswers','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/users','getAgents','post','create','notify','addApplications','addAgents','/:id/send','send','/:id'];(function(_0x52379a,_0x3ca0fe){var _0x3fd014=function(_0x4b4063){while(--_0x4b4063){_0x52379a['push'](_0x52379a['shift']());}};_0x3fd014(++_0x3ca0fe);}(_0xa430,0xff));var _0x0a43=function(_0x400671,_0x4ae6a4){_0x400671=_0x400671-0x0;var _0x2c6184=_0xa430[_0x400671];return _0x2c6184;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a43('0x0'));var timeout=require(_0x0a43('0x1'));var express=require(_0x0a43('0x2'));var router=express['Router']();var auth=require(_0x0a43('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a43('0x4'));var controller=require(_0x0a43('0x5'));router[_0x0a43('0x6')]('/',auth[_0x0a43('0x7')](),controller['index']);router[_0x0a43('0x6')](_0x0a43('0x8'),auth[_0x0a43('0x7')](),controller[_0x0a43('0x9')]);router[_0x0a43('0x6')]('/:id',auth[_0x0a43('0x7')](),controller['show']);router[_0x0a43('0x6')](_0x0a43('0xa'),auth[_0x0a43('0x7')](),controller[_0x0a43('0xb')]);router[_0x0a43('0x6')](_0x0a43('0xc'),auth[_0x0a43('0x7')](),controller[_0x0a43('0xd')]);router[_0x0a43('0x6')](_0x0a43('0xe'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/interactions',auth[_0x0a43('0x7')](),controller['getInteractions']);router['get'](_0x0a43('0xf'),auth['isAuthenticated'](),controller[_0x0a43('0x10')]);router[_0x0a43('0x11')]('/',auth['isAuthenticated'](),controller[_0x0a43('0x12')]);router[_0x0a43('0x11')](_0x0a43('0xa'),auth[_0x0a43('0x7')](),controller['addDisposition']);router[_0x0a43('0x11')](_0x0a43('0xc'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x0a43('0x11')]('/:id/notify',controller[_0x0a43('0x13')]);router[_0x0a43('0x11')](_0x0a43('0xe'),auth[_0x0a43('0x7')](),controller[_0x0a43('0x14')]);router[_0x0a43('0x11')](_0x0a43('0xf'),auth['isAuthenticated'](),controller[_0x0a43('0x15')]);router[_0x0a43('0x11')](_0x0a43('0x16'),auth[_0x0a43('0x7')](),controller[_0x0a43('0x17')]);router['put'](_0x0a43('0x18'),auth[_0x0a43('0x7')](),controller['update']);router[_0x0a43('0x19')](_0x0a43('0x18'),auth[_0x0a43('0x7')](),controller[_0x0a43('0x1a')]);router[_0x0a43('0x19')](_0x0a43('0xa'),auth[_0x0a43('0x7')](),controller['removeDispositions']);router[_0x0a43('0x19')]('/:id/canned_answers',auth[_0x0a43('0x7')](),controller[_0x0a43('0x1b')]);router[_0x0a43('0x19')](_0x0a43('0xf'),auth[_0x0a43('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 79bf6b2..6a54859 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 _0x6d10=['randomstring','exports','STRING','name','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5de2fd,_0x481ca9){var _0x50afa6=function(_0x29fb64){while(--_0x29fb64){_0x5de2fd['push'](_0x5de2fd['shift']());}};_0x50afa6(++_0x481ca9);}(_0x6d10,0x15b));var _0x06d1=function(_0x31a671,_0x1383b2){_0x31a671=_0x31a671-0x0;var _0x5b8002=_0x6d10[_0x31a671];return _0x5b8002;};'use strict';var Sequelize=require(_0x06d1('0x0'));var rs=require(_0x06d1('0x1'));module[_0x06d1('0x2')]={'name':{'type':Sequelize[_0x06d1('0x3')],'unique':_0x06d1('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x06d1('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x06d1('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x06d1('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x06d1('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06d1('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x06d1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x06d1('0x3')]},'queueTransfer':{'type':Sequelize[_0x06d1('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x06d1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x06d1('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x06d1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x06d1('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x06d1('0x6')],'defaultValue':![],'comment':_0x06d1('0x8'),'set':function(_0x4aa4e6){if(!_0x4aa4e6)this[_0x06d1('0x9')](_0x06d1('0xa'),null);this[_0x06d1('0x9')](_0x06d1('0xb'),_0x4aa4e6);}}}; \ No newline at end of file +var _0x2225=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x522fb7,_0x433f5f){var _0x3c2140=function(_0x10fd6f){while(--_0x10fd6f){_0x522fb7['push'](_0x522fb7['shift']());}};_0x3c2140(++_0x433f5f);}(_0x2225,0x19d));var _0x5222=function(_0x3306fb,_0x25b70e){_0x3306fb=_0x3306fb-0x0;var _0x325be4=_0x2225[_0x3306fb];return _0x325be4;};'use strict';var Sequelize=require(_0x5222('0x0'));var rs=require(_0x5222('0x1'));module[_0x5222('0x2')]={'name':{'type':Sequelize[_0x5222('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5222('0x3')]},'token':{'type':Sequelize[_0x5222('0x3')],'defaultValue':function(){return rs[_0x5222('0x4')]();}},'replyUri':{'type':Sequelize[_0x5222('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5222('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5222('0x5')],'defaultValue':function(){return _0x5222('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5222('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5222('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5222('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5222('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5222('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5222('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5222('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x5222('0x7')],'defaultValue':![],'comment':_0x5222('0xa'),'set':function(_0x5264ce){if(!_0x5264ce)this[_0x5222('0xb')](_0x5222('0xc'),null);this[_0x5222('0xb')](_0x5222('0xd'),_0x5264ce);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 279fba5..d49248c 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 _0x0cb1=['index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','OpenchannelAccountId','removeDispositions','getAnswers','CannedAnswer','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','List','OpenchannelApplication','account','Applications','applications','orderBy','asc','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','autoclose','push','close','unmanaged','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','zip-dir','moment','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','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','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','count','offset','limit','Content-Range','save','then','destroy','get','UserProfileResource','stack','name'];(function(_0x296052,_0x28d551){var _0x43efd6=function(_0x110702){while(--_0x110702){_0x296052['push'](_0x296052['shift']());}};_0x43efd6(++_0x28d551);}(_0x0cb1,0x81));var _0x10cb=function(_0x2ac738,_0x5148af){_0x2ac738=_0x2ac738-0x0;var _0x3e2de8=_0x0cb1[_0x2ac738];return _0x3e2de8;};'use strict';var pdf=require(_0x10cb('0x0'));var emlformat=require(_0x10cb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x10cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x10cb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x10cb('0x4'));var csv=require(_0x10cb('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x10cb('0x6'));var crypto=require(_0x10cb('0x7'));var jsforce=require(_0x10cb('0x8'));var deskjs=require(_0x10cb('0x9'));var toCsv=require(_0x10cb('0x5'));var querystring=require(_0x10cb('0xa'));var Papa=require(_0x10cb('0xb'));var Redis=require(_0x10cb('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x10cb('0xd'));var as=require(_0x10cb('0xe'));var hardwareService=require(_0x10cb('0xf'));var logger=require(_0x10cb('0x10'))(_0x10cb('0x11'));var utils=require(_0x10cb('0x12'));var config=require(_0x10cb('0x13'));var db=require(_0x10cb('0x14'))['db'];config[_0x10cb('0x15')]=_[_0x10cb('0x16')](config[_0x10cb('0x15')],{'host':_0x10cb('0x17'),'port':0x18eb});var socket=require(_0x10cb('0x18'))(new Redis(config[_0x10cb('0x15')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x10cb('0x19'));var client=jayson[_0x10cb('0x1a')][_0x10cb('0x1b')]({'port':0x232c});var client9002=jayson[_0x10cb('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1c23d5,_0xb30c9e,_0x57d6e8){if(_0x57d6e8){var _0x4bb7e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bb7e5[_0x10cb('0x1c')](_0xb30c9e)){return _0x1c23d5;}else{throw new db['Sequelize'][(_0x10cb('0x1d'))](_0x10cb('0x1e'));}}else{return _0x1c23d5;}}function respondWithRpcPromise(_0x36d73c,_0x463ce0,_0x24fa8e,_0x2ddde4){return new BPromise(function(_0x3dee61,_0x1a65d9){var _0x49675f=_0x2ddde4||client;return _0x49675f[_0x10cb('0x1f')](_0x36d73c,_0x24fa8e)['then'](function(_0x4af781){logger['info'](_0x10cb('0x20'),_0x463ce0,_0x10cb('0x21'));logger[_0x10cb('0x22')](_0x10cb('0x23'),_0x463ce0,'request\x20sent',JSON[_0x10cb('0x24')](_0x4af781));if(_0x4af781['error']){if(_0x4af781[_0x10cb('0x25')][_0x10cb('0x26')]===0x1f4){logger[_0x10cb('0x25')](_0x10cb('0x20'),_0x463ce0,_0x4af781[_0x10cb('0x25')][_0x10cb('0x27')]);return _0x1a65d9(_0x4af781[_0x10cb('0x25')][_0x10cb('0x27')]);}logger[_0x10cb('0x25')](_0x10cb('0x20'),_0x463ce0,_0x4af781[_0x10cb('0x25')][_0x10cb('0x27')]);return _0x3dee61(_0x4af781[_0x10cb('0x25')][_0x10cb('0x27')]);}else{logger[_0x10cb('0x28')](_0x10cb('0x20'),_0x463ce0,_0x10cb('0x21'));_0x3dee61(_0x4af781['result'][_0x10cb('0x27')]);}})[_0x10cb('0x29')](function(_0x198332){logger['error'](_0x10cb('0x20'),_0x463ce0,_0x198332);_0x1a65d9(_0x198332);});});}function respondWithStatusCode(_0x53a200,_0x3f5561){_0x3f5561=_0x3f5561||0xcc;return function(_0x3fe162){if(_0x3fe162){return _0x53a200['sendStatus'](_0x3f5561);}return _0x53a200[_0x10cb('0x2a')](_0x3f5561)[_0x10cb('0x2b')]();};}function respondWithResult(_0x5ac78d,_0x2f601c){_0x2f601c=_0x2f601c||0xc8;return function(_0x391fa7){if(_0x391fa7){return _0x5ac78d[_0x10cb('0x2a')](_0x2f601c)[_0x10cb('0x2c')](_0x391fa7);}};}function respondWithFilteredResult(_0x414243,_0x34d671){return function(_0x5251cc){if(_0x5251cc){var _0x5f18f9=_0x5251cc[_0x10cb('0x2d')],_0x192991=_0x34d671[_0x10cb('0x2e')],_0x4e50af=_0x34d671[_0x10cb('0x2e')]+_0x34d671[_0x10cb('0x2f')],_0x349678;if(_0x4e50af>=_0x5f18f9){_0x4e50af=_0x5f18f9;_0x349678=0xc8;}else{_0x349678=0xce;}_0x414243['status'](_0x349678);return _0x414243['set'](_0x10cb('0x30'),_0x192991+'-'+_0x4e50af+'/'+_0x5f18f9)[_0x10cb('0x2c')](_0x5251cc);}return null;};}function patchUpdates(_0x313fcb){return function(_0x37187e){try{jsonpatch['apply'](_0x37187e,_0x313fcb,!![]);}catch(_0x4e151f){return BPromise['reject'](_0x4e151f);}return _0x37187e[_0x10cb('0x31')]();};}function saveUpdates(_0x396220,_0xfa26ff){return function(_0x33a489){if(_0x33a489){return _0x33a489['update'](_0x396220)[_0x10cb('0x32')](function(_0xad4d28){return _0xad4d28;});}return null;};}function removeEntity(_0xf8fcd2,_0x239c04){return function(_0x2159e0){if(_0x2159e0){return _0x2159e0[_0x10cb('0x33')]()[_0x10cb('0x32')](function(){var _0x190580=_0x2159e0[_0x10cb('0x34')]({'plain':!![]});var _0xf81474='OpenchannelAccounts';return db[_0x10cb('0x35')]['destroy']({'where':{'type':_0xf81474,'resourceId':_0x190580['id']}})[_0x10cb('0x32')](function(){return _0x2159e0;});})[_0x10cb('0x32')](function(){_0xf8fcd2[_0x10cb('0x2a')](0xcc)[_0x10cb('0x2b')]();});}};}function handleEntityNotFound(_0x1fe5a6,_0x9c722c){return function(_0x21bc40){if(!_0x21bc40){_0x1fe5a6['sendStatus'](0x194);}return _0x21bc40;};}function handleError(_0x270ed1,_0x33ffa3){_0x33ffa3=_0x33ffa3||0x1f4;return function(_0x6b0856){logger[_0x10cb('0x25')](_0x6b0856[_0x10cb('0x36')]);if(_0x6b0856['name']){delete _0x6b0856[_0x10cb('0x37')];}_0x270ed1[_0x10cb('0x2a')](_0x33ffa3)['send'](_0x6b0856);};}exports[_0x10cb('0x38')]=function(_0x36a3c7,_0x1b98d9){var _0xe3d2a1={'include':[{'model':db[_0x10cb('0x39')],'as':_0x10cb('0x3a')}]},_0x28061d={},_0x140733={'count':0x0,'rows':[]};var _0x577f35=_['map'](db[_0x10cb('0x3b')][_0x10cb('0x3c')],function(_0x42cd98){return{'name':_0x42cd98[_0x10cb('0x3d')],'type':_0x42cd98[_0x10cb('0x3e')][_0x10cb('0x3f')]};});_0x28061d[_0x10cb('0x40')]=_[_0x10cb('0x41')](_0x577f35,_0x10cb('0x37'));_0x28061d[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x36a3c7[_0x10cb('0x42')]);_0x28061d['filters']=_['intersection'](_0x28061d['model'],_0x28061d[_0x10cb('0x42')]);_0xe3d2a1[_0x10cb('0x44')]=_[_0x10cb('0x45')](_0x28061d[_0x10cb('0x40')],qs[_0x10cb('0x46')](_0x36a3c7[_0x10cb('0x42')][_0x10cb('0x46')]));_0xe3d2a1['attributes']=_0xe3d2a1[_0x10cb('0x44')][_0x10cb('0x47')]?_0xe3d2a1[_0x10cb('0x44')]:_0x28061d[_0x10cb('0x40')];if(!_0x36a3c7['query']['hasOwnProperty'](_0x10cb('0x48'))){_0xe3d2a1[_0x10cb('0x2f')]=qs[_0x10cb('0x2f')](_0x36a3c7['query'][_0x10cb('0x2f')]);_0xe3d2a1[_0x10cb('0x2e')]=qs[_0x10cb('0x2e')](_0x36a3c7[_0x10cb('0x42')]['offset']);}_0xe3d2a1[_0x10cb('0x49')]=qs[_0x10cb('0x4a')](_0x36a3c7[_0x10cb('0x42')][_0x10cb('0x4a')]);_0xe3d2a1[_0x10cb('0x4b')]=qs[_0x10cb('0x4c')](_[_0x10cb('0x4d')](_0x36a3c7[_0x10cb('0x42')],_0x28061d[_0x10cb('0x4c')]),_0x577f35);if(_0x36a3c7[_0x10cb('0x42')][_0x10cb('0x4e')]){_0xe3d2a1[_0x10cb('0x4b')]=_[_0x10cb('0x4f')](_0xe3d2a1[_0x10cb('0x4b')],{'$or':_[_0x10cb('0x41')](_0x577f35,function(_0xffe4de){if(_0xffe4de[_0x10cb('0x3e')]!==_0x10cb('0x50')){var _0x5b8b61={};_0x5b8b61[_0xffe4de[_0x10cb('0x37')]]={'$like':'%'+_0x36a3c7[_0x10cb('0x42')][_0x10cb('0x4e')]+'%'};return _0x5b8b61;}})});}_0xe3d2a1=_[_0x10cb('0x4f')]({},_0xe3d2a1,_0x36a3c7[_0x10cb('0x51')]);var _0x28d9a9={'where':_0xe3d2a1[_0x10cb('0x4b')]};return db[_0x10cb('0x3b')][_0x10cb('0x2d')](_0x28d9a9)[_0x10cb('0x32')](function(_0x4bd905){_0x140733['count']=_0x4bd905;if(_0x36a3c7[_0x10cb('0x42')][_0x10cb('0x52')]){_0xe3d2a1[_0x10cb('0x53')]=[{'all':!![]}];}return db[_0x10cb('0x3b')]['findAll'](_0xe3d2a1);})[_0x10cb('0x32')](function(_0xae7eab){_0x140733[_0x10cb('0x54')]=_0xae7eab;return _0x140733;})[_0x10cb('0x32')](respondWithFilteredResult(_0x1b98d9,_0xe3d2a1))[_0x10cb('0x29')](handleError(_0x1b98d9,null));};exports[_0x10cb('0x55')]=function(_0x353b5d,_0x13fff1){var _0x2ea455={'raw':![],'where':{'id':_0x353b5d[_0x10cb('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x10cb('0x3a')}]},_0x1e333f={};_0x1e333f[_0x10cb('0x40')]=_['keys'](db[_0x10cb('0x3b')][_0x10cb('0x3c')]);_0x1e333f[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x353b5d[_0x10cb('0x42')]);_0x1e333f['filters']=_['intersection'](_0x1e333f[_0x10cb('0x40')],_0x1e333f[_0x10cb('0x42')]);_0x2ea455[_0x10cb('0x44')]=_[_0x10cb('0x45')](_0x1e333f[_0x10cb('0x40')],qs['fields'](_0x353b5d[_0x10cb('0x42')][_0x10cb('0x46')]));_0x2ea455[_0x10cb('0x44')]=_0x2ea455[_0x10cb('0x44')][_0x10cb('0x47')]?_0x2ea455[_0x10cb('0x44')]:_0x1e333f[_0x10cb('0x40')];if(_0x353b5d['query'][_0x10cb('0x52')]){_0x2ea455[_0x10cb('0x53')]=[{'all':!![]}];}_0x2ea455=_[_0x10cb('0x4f')]({},_0x2ea455,_0x353b5d[_0x10cb('0x51')]);return db['OpenchannelAccount']['find'](_0x2ea455)[_0x10cb('0x32')](handleEntityNotFound(_0x13fff1,null))[_0x10cb('0x32')](respondWithResult(_0x13fff1,null))['catch'](handleError(_0x13fff1,null));};exports[_0x10cb('0x57')]=function(_0x40d8ae,_0x25189d){return db['OpenchannelAccount']['create'](_0x40d8ae[_0x10cb('0x58')],{})[_0x10cb('0x32')](function(_0x1665f0){var _0x446a11=_0x40d8ae[_0x10cb('0x59')]['get']({'plain':!![]});if(!_0x446a11)throw new Error(_0x10cb('0x5a'));if(_0x446a11[_0x10cb('0x5b')]===_0x10cb('0x59')){var _0x403d4e=_0x1665f0[_0x10cb('0x34')]({'plain':!![]});var _0x2ea732=_0x10cb('0x5c');return db[_0x10cb('0x5d')][_0x10cb('0x5e')]({'where':{'name':_0x2ea732,'userProfileId':_0x446a11[_0x10cb('0x5f')]},'raw':!![]})[_0x10cb('0x32')](function(_0x4cc67b){if(_0x4cc67b&&_0x4cc67b[_0x10cb('0x60')]===0x0){return db[_0x10cb('0x35')]['create']({'name':_0x403d4e[_0x10cb('0x37')],'resourceId':_0x403d4e['id'],'type':_0x4cc67b['name'],'sectionId':_0x4cc67b['id']},{})['then'](function(){return _0x1665f0;});}else{return _0x1665f0;}})[_0x10cb('0x29')](function(_0x1906a){logger[_0x10cb('0x25')](_0x10cb('0x61'),_0x1906a);throw _0x1906a;});}return _0x1665f0;})[_0x10cb('0x32')](respondWithResult(_0x25189d,0xc9))[_0x10cb('0x29')](handleError(_0x25189d,null));};exports[_0x10cb('0x62')]=function(_0x7185ed,_0x12985c){if(_0x7185ed[_0x10cb('0x58')]['id']){delete _0x7185ed['body']['id'];}return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x7185ed['params']['id']},'include':[{'model':db['Pause'],'as':_0x10cb('0x3a')}]})[_0x10cb('0x32')](handleEntityNotFound(_0x12985c,null))[_0x10cb('0x32')](saveUpdates(_0x7185ed[_0x10cb('0x58')],null))[_0x10cb('0x32')](respondWithResult(_0x12985c,null))['catch'](handleError(_0x12985c,null));};exports[_0x10cb('0x33')]=function(_0x3d12c9,_0x5bc18e){return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x3d12c9[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x5bc18e,null))['then'](removeEntity(_0x5bc18e,null))[_0x10cb('0x29')](handleError(_0x5bc18e,null));};exports['describe']=function(_0x39d76c,_0x28c6ee){return db[_0x10cb('0x3b')][_0x10cb('0x63')]()[_0x10cb('0x32')](respondWithResult(_0x28c6ee,null))[_0x10cb('0x29')](handleError(_0x28c6ee,null));};exports[_0x10cb('0x64')]=function(_0x440841,_0x11c711,_0x1a8b4a){if(_0x440841[_0x10cb('0x58')]['id']){delete _0x440841['body']['id'];}return db['OpenchannelAccount'][_0x10cb('0x5e')]({'where':{'id':_0x440841[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x11c711,null))['then'](function(_0x4046cc){if(_0x4046cc){_0x440841[_0x10cb('0x58')]['OpnechannelAccountId']=_0x4046cc['id'];return db[_0x10cb('0x65')][_0x10cb('0x57')](_0x440841[_0x10cb('0x58')]);}})[_0x10cb('0x32')](respondWithResult(_0x11c711,null))[_0x10cb('0x29')](handleError(_0x11c711,null));};exports[_0x10cb('0x66')]=function(_0x582c7e,_0x6622d7,_0x34a674){var _0x475c32={'raw':![],'where':{}};var _0x1e13af={};var _0x2f029c={'count':0x0,'rows':[]};return db[_0x10cb('0x3b')][_0x10cb('0x67')]({'where':{'id':_0x582c7e[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x6622d7,null))[_0x10cb('0x32')](function(_0x33e023){if(_0x33e023){_0x1e13af[_0x10cb('0x40')]=_[_0x10cb('0x43')](db[_0x10cb('0x65')][_0x10cb('0x3c')]);_0x1e13af['query']=_['keys'](_0x582c7e[_0x10cb('0x42')]);_0x1e13af[_0x10cb('0x4c')]=_[_0x10cb('0x45')](_0x1e13af[_0x10cb('0x40')],_0x1e13af[_0x10cb('0x42')]);_0x475c32['attributes']=_['intersection'](_0x1e13af[_0x10cb('0x40')],qs[_0x10cb('0x46')](_0x582c7e[_0x10cb('0x42')][_0x10cb('0x46')]));_0x475c32[_0x10cb('0x44')]=_0x475c32['attributes'][_0x10cb('0x47')]?_0x475c32[_0x10cb('0x44')]:_0x1e13af['model'];if(!_0x582c7e[_0x10cb('0x42')][_0x10cb('0x68')](_0x10cb('0x48'))){_0x475c32[_0x10cb('0x2f')]=qs[_0x10cb('0x2f')](_0x582c7e[_0x10cb('0x42')][_0x10cb('0x2f')]);_0x475c32[_0x10cb('0x2e')]=qs['offset'](_0x582c7e['query']['offset']);}_0x475c32[_0x10cb('0x49')]=qs[_0x10cb('0x4a')](_0x582c7e[_0x10cb('0x42')]['sort']);_0x475c32[_0x10cb('0x4b')]=qs[_0x10cb('0x4c')](_['pick'](_0x582c7e[_0x10cb('0x42')],_0x1e13af[_0x10cb('0x4c')]));_0x475c32[_0x10cb('0x4b')][_0x10cb('0x69')]=_0x33e023['id'];if(_0x582c7e[_0x10cb('0x42')][_0x10cb('0x4e')]){_0x475c32[_0x10cb('0x4b')]=_['merge'](_0x475c32[_0x10cb('0x4b')],{'$or':_[_0x10cb('0x41')](_0x475c32[_0x10cb('0x44')],function(_0x3f2ee8){var _0x270eaa={};_0x270eaa[_0x3f2ee8]={'$like':'%'+_0x582c7e[_0x10cb('0x42')][_0x10cb('0x4e')]+'%'};return _0x270eaa;})});}_0x475c32=_[_0x10cb('0x4f')]({},_0x475c32,_0x582c7e[_0x10cb('0x51')]);return db[_0x10cb('0x65')][_0x10cb('0x2d')]({'where':_0x475c32[_0x10cb('0x4b')]})[_0x10cb('0x32')](function(_0x3054ec){_0x2f029c[_0x10cb('0x2d')]=_0x3054ec;if(_0x582c7e[_0x10cb('0x42')][_0x10cb('0x52')]){_0x475c32[_0x10cb('0x53')]=[{'all':!![]}];}return db[_0x10cb('0x65')]['findAll'](_0x475c32);})[_0x10cb('0x32')](function(_0x246c8d){_0x2f029c[_0x10cb('0x54')]=_0x246c8d;return _0x2f029c;});}})[_0x10cb('0x32')](respondWithFilteredResult(_0x6622d7,_0x475c32))['catch'](handleError(_0x6622d7,null));};exports[_0x10cb('0x6a')]=function(_0x5613f5,_0xf67923,_0x507372){return db[_0x10cb('0x3b')]['find']({'where':{'id':_0x5613f5[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0xf67923,null))[_0x10cb('0x32')](function(_0x514755){if(_0x514755){return _0x514755[_0x10cb('0x6a')](_0x5613f5[_0x10cb('0x42')]['ids']);}})[_0x10cb('0x32')](respondWithStatusCode(_0xf67923,null))[_0x10cb('0x29')](handleError(_0xf67923,null));};exports['addAnswer']=function(_0x56875b,_0x1e0401,_0x1d344d){if(_0x56875b[_0x10cb('0x58')]['id']){delete _0x56875b[_0x10cb('0x58')]['id'];}return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x56875b['params']['id']}})['then'](handleEntityNotFound(_0x1e0401,null))[_0x10cb('0x32')](function(_0x410cff){if(_0x410cff){_0x56875b[_0x10cb('0x58')]['OpenchannelAccountId']=_0x410cff['id'];return db['CannedAnswer'][_0x10cb('0x57')](_0x56875b[_0x10cb('0x58')]);}})[_0x10cb('0x32')](respondWithResult(_0x1e0401,null))[_0x10cb('0x29')](handleError(_0x1e0401,null));};exports[_0x10cb('0x6b')]=function(_0x39ba02,_0xe09c5,_0x20c257){var _0x5bc0d0={'raw':![],'where':{}};var _0x2d9e34={};var _0x36feec={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x10cb('0x67')]({'where':{'id':_0x39ba02['params']['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0xe09c5,null))[_0x10cb('0x32')](function(_0x4f378a){if(_0x4f378a){_0x2d9e34[_0x10cb('0x40')]=_[_0x10cb('0x43')](db['CannedAnswer'][_0x10cb('0x3c')]);_0x2d9e34[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x39ba02[_0x10cb('0x42')]);_0x2d9e34[_0x10cb('0x4c')]=_[_0x10cb('0x45')](_0x2d9e34[_0x10cb('0x40')],_0x2d9e34[_0x10cb('0x42')]);_0x5bc0d0[_0x10cb('0x44')]=_[_0x10cb('0x45')](_0x2d9e34[_0x10cb('0x40')],qs[_0x10cb('0x46')](_0x39ba02[_0x10cb('0x42')]['fields']));_0x5bc0d0[_0x10cb('0x44')]=_0x5bc0d0[_0x10cb('0x44')][_0x10cb('0x47')]?_0x5bc0d0[_0x10cb('0x44')]:_0x2d9e34[_0x10cb('0x40')];if(!_0x39ba02[_0x10cb('0x42')][_0x10cb('0x68')](_0x10cb('0x48'))){_0x5bc0d0[_0x10cb('0x2f')]=qs[_0x10cb('0x2f')](_0x39ba02[_0x10cb('0x42')][_0x10cb('0x2f')]);_0x5bc0d0[_0x10cb('0x2e')]=qs[_0x10cb('0x2e')](_0x39ba02[_0x10cb('0x42')][_0x10cb('0x2e')]);}_0x5bc0d0[_0x10cb('0x49')]=qs['sort'](_0x39ba02[_0x10cb('0x42')][_0x10cb('0x4a')]);_0x5bc0d0[_0x10cb('0x4b')]=qs[_0x10cb('0x4c')](_[_0x10cb('0x4d')](_0x39ba02['query'],_0x2d9e34[_0x10cb('0x4c')]));_0x5bc0d0[_0x10cb('0x4b')][_0x10cb('0x69')]=_0x4f378a['id'];if(_0x39ba02[_0x10cb('0x42')][_0x10cb('0x4e')]){_0x5bc0d0[_0x10cb('0x4b')]=_[_0x10cb('0x4f')](_0x5bc0d0[_0x10cb('0x4b')],{'$or':_[_0x10cb('0x41')](_0x5bc0d0[_0x10cb('0x44')],function(_0x16f356){var _0x23d03b={};_0x23d03b[_0x16f356]={'$like':'%'+_0x39ba02[_0x10cb('0x42')][_0x10cb('0x4e')]+'%'};return _0x23d03b;})});}_0x5bc0d0=_[_0x10cb('0x4f')]({},_0x5bc0d0,_0x39ba02[_0x10cb('0x51')]);return db[_0x10cb('0x6c')][_0x10cb('0x2d')]({'where':_0x5bc0d0[_0x10cb('0x4b')]})[_0x10cb('0x32')](function(_0x4387c7){_0x36feec['count']=_0x4387c7;if(_0x39ba02[_0x10cb('0x42')]['includeAll']){_0x5bc0d0['include']=[{'all':!![]}];}return db[_0x10cb('0x6c')][_0x10cb('0x6d')](_0x5bc0d0);})[_0x10cb('0x32')](function(_0x1d7822){_0x36feec[_0x10cb('0x54')]=_0x1d7822;return _0x36feec;});}})[_0x10cb('0x32')](respondWithFilteredResult(_0xe09c5,_0x5bc0d0))[_0x10cb('0x29')](handleError(_0xe09c5,null));};exports[_0x10cb('0x6e')]=function(_0x50d3ca,_0x1084a2,_0x8bea35){return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x50d3ca[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x1084a2,null))[_0x10cb('0x32')](function(_0x55c88e){if(_0x55c88e){return _0x55c88e[_0x10cb('0x6e')](_0x50d3ca[_0x10cb('0x42')][_0x10cb('0x6f')]);}})[_0x10cb('0x32')](respondWithStatusCode(_0x1084a2,null))['catch'](handleError(_0x1084a2,null));};exports[_0x10cb('0x70')]=function(_0x2cf939,_0x34c4a0,_0x3d4e06){var _0x1d8573={'body':_0x2cf939[_0x10cb('0x58')],'channel':_0x10cb('0x71')};var _0x432e4c=[];var _0x30fe94=[];var _0x4164be={};var _0x4c3d31=![];return db[_0x10cb('0x72')][_0x10cb('0x63')]()[_0x10cb('0x32')](function(_0x4d2dfe){if(!_0x4d2dfe){throw new db[(_0x10cb('0x73'))][(_0x10cb('0x1d'))](_0x10cb('0x74'));}_0x432e4c=_[_0x10cb('0x75')](_['keys'](_0x4d2dfe),[_0x10cb('0x76'),_0x10cb('0x77')]);_0x30fe94=_[_0x10cb('0x75')](_[_0x10cb('0x43')](_0x4d2dfe),[_0x10cb('0x76'),_0x10cb('0x77'),_0x10cb('0x78'),_0x10cb('0x79')]);if(_0x2cf939[_0x10cb('0x58')]['id']){delete _0x2cf939[_0x10cb('0x58')]['id'];}if(_[_0x10cb('0x7a')](_0x2cf939[_0x10cb('0x58')]['from'])){throw new db[(_0x10cb('0x73'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x10cb('0x7a')](_0x2cf939[_0x10cb('0x58')]['body'])||_0x2cf939[_0x10cb('0x58')]['body']===''){throw new db[(_0x10cb('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2cf939[_0x10cb('0x58')]['mapKey'])){throw new db['Sequelize'][(_0x10cb('0x1d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30fe94);}if(!_['includes'](_0x30fe94,_0x2cf939['body']['mapKey'])){throw new db[(_0x10cb('0x73'))][(_0x10cb('0x1d'))](_0x10cb('0x7b')+_0x30fe94);}_0x4164be[_0x2cf939['body'][_0x10cb('0x7c')]]=_0x2cf939[_0x10cb('0x58')][_0x10cb('0x7d')];})['then'](function(){return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x2cf939[_0x10cb('0x56')]['id']},'include':[{'model':db[_0x10cb('0x7e')],'as':_0x10cb('0x7f'),'include':[{'model':db[_0x10cb('0x72')],'as':'Contacts','where':_0x4164be,'limit':0x1,'order':[[_0x10cb('0x77'),'DESC']]}]},{'model':db[_0x10cb('0x80')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x34c4a0,null))[_0x10cb('0x32')](function(_0x42d6b4){if(_0x42d6b4&&_0x42d6b4[_0x10cb('0x7f')]){_0x1d8573[_0x10cb('0x81')]=_0x42d6b4;_0x1d8573['applications']=_0x42d6b4[_0x10cb('0x82')];_0x1d8573['list']=_0x42d6b4[_0x10cb('0x7f')];_0x1d8573[_0x10cb('0x83')]=_[_0x10cb('0x84')](_0x1d8573[_0x10cb('0x83')],['priority'],[_0x10cb('0x85')]);if(_0x1d8573[_0x10cb('0x81')][_0x10cb('0x82')]){delete _0x1d8573['account'][_0x10cb('0x82')];}if(_0x1d8573[_0x10cb('0x81')]['List']&&_0x1d8573[_0x10cb('0x81')][_0x10cb('0x7f')][_0x10cb('0x86')]['length']){return _0x1d8573[_0x10cb('0x81')][_0x10cb('0x7f')][_0x10cb('0x86')][0x0];}var _0x5c44b2=_['defaults'](_0x2cf939['body'],{'firstName':_0x2cf939[_0x10cb('0x58')][_0x10cb('0x7d')],'ListId':_0x42d6b4[_0x10cb('0x79')]});_0x5c44b2[_0x2cf939['body']['mapKey']]=_0x2cf939[_0x10cb('0x58')][_0x10cb('0x7d')];return db[_0x10cb('0x72')][_0x10cb('0x57')](_0x5c44b2,{'fields':_0x432e4c,'raw':!![]});}})['then'](handleEntityNotFound(_0x34c4a0,null))[_0x10cb('0x32')](function(_0x4c3b47){_0x1d8573[_0x10cb('0x87')]=_0x4c3b47;if(_0x4c3b47){var _0x19997b={'ContactId':_0x4c3b47['id'],'OpenchannelAccountId':_0x2cf939['params']['id'],'from':(_0x4c3b47['firstName']||'')+'\x20'+(_0x4c3b47[_0x10cb('0x88')]||'')};var _0xbfc07={'OpenchannelAccountId':_0x2cf939[_0x10cb('0x56')]['id'],'closed':![]};if(_0x2cf939[_0x10cb('0x58')][_0x10cb('0x89')]){_0xbfc07[_0x10cb('0x89')]=_0x2cf939[_0x10cb('0x58')]['threadId'];return db[_0x10cb('0x8a')]['find']({'where':_0xbfc07})[_0x10cb('0x32')](function(_0x34baa0){if(_0x34baa0){return[_0x34baa0,![]];}_0x19997b['threadId']=_0x2cf939[_0x10cb('0x58')]['threadId'];_0x19997b['externalUrl']=_0x2cf939['body'][_0x10cb('0x8b')];return db[_0x10cb('0x8a')][_0x10cb('0x57')](_0x19997b)[_0x10cb('0x32')](function(_0x4fca3a){return[_0x4fca3a,!![]];});});}else{_0xbfc07[_0x10cb('0x89')]=null;}_0xbfc07[_0x10cb('0x8c')]=_0x4c3b47['id'];return db[_0x10cb('0x8a')][_0x10cb('0x5e')]({'where':_0xbfc07})[_0x10cb('0x32')](function(_0x42ed65){if(_0x42ed65){return[_0x42ed65,![]];}return db['OpenchannelInteraction'][_0x10cb('0x57')](_0x19997b)['then'](function(_0x7dd279){return[_0x7dd279,!![]];});});}})[_0x10cb('0x8d')](function(_0xae14d1,_0x498d8c){if(_0xae14d1){_0x4c3d31=_0x498d8c;if(!_0x498d8c){var _0x3a5dc4={'from':(_0x1d8573[_0x10cb('0x87')][_0x10cb('0x8e')]||'')+'\x20'+(_0x1d8573[_0x10cb('0x87')]['lastName']||'')};if(_0x2cf939['body'][_0x10cb('0x89')]&&_0x2cf939[_0x10cb('0x58')][_0x10cb('0x8f')]&&_0x2cf939[_0x10cb('0x58')][_0x10cb('0x89')]!=_0x2cf939[_0x10cb('0x58')][_0x10cb('0x8f')]){_0x3a5dc4['threadId']=_0x2cf939[_0x10cb('0x58')][_0x10cb('0x8f')];}return _0xae14d1[_0x10cb('0x62')](_0x3a5dc4);}else{return _0xae14d1;}}})[_0x10cb('0x32')](function(_0x835616){_0x1d8573[_0x10cb('0x90')]=_0x835616[_0x10cb('0x34')]({'plain':!![]});_0x1d8573['interaction']['created']=_0x4c3d31;if(_0x1d8573[_0x10cb('0x90')]['created']){if(_0x1d8573[_0x10cb('0x81')][_0x10cb('0x91')]){_0x1d8573['applications'][_0x10cb('0x92')]({'id':0x0,'priority':_0x1d8573[_0x10cb('0x83')][_0x10cb('0x47')]+0x1,'app':_0x10cb('0x93'),'appdata':_0x10cb('0x94'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x2cf939[_0x10cb('0x58')][_0x10cb('0x58')],'OpenchannelAccountId':_0x2cf939['params']['id'],'OpenchannelInteractionId':_0x835616['id'],'direction':'in','ContactId':_0x1d8573['contact']['id'],'AttachmentId':_0x2cf939[_0x10cb('0x58')]['AttachmentId']});})[_0x10cb('0x32')](function(_0x9fdf78){_0x1d8573['message']=_0x9fdf78;if(_0x1d8573['interaction'][_0x10cb('0x95')]){return db['User'][_0x10cb('0x5e')]({'attributes':['id',_0x10cb('0x37')],'where':{'id':_0x1d8573['interaction'][_0x10cb('0x95')]}})[_0x10cb('0x32')](function(_0x38137d){if(_0x38137d){_0x1d8573[_0x10cb('0x83')][_0x10cb('0x96')]({'id':0x0,'priority':0x0,'app':_0x10cb('0x97'),'appdata':_0x38137d[_0x10cb('0x37')]+','+(_0x1d8573[_0x10cb('0x81')][_0x10cb('0x98')]||0xa),'interval':_0x10cb('0x99')});_0x1d8573[_0x10cb('0x9a')]=![];}return respondWithRpcPromise('Start','startRouting',_0x1d8573);});}return respondWithRpcPromise(_0x10cb('0x9b'),_0x10cb('0x9c'),_0x1d8573);})[_0x10cb('0x32')](function(_0x251358){respondWithRpcPromise(_0x10cb('0x9d'),_0x10cb('0x9d'),{'event':'notify','message':_0x251358},client9002);return _0x251358;})[_0x10cb('0x32')](respondWithResult(_0x34c4a0,null))['catch'](handleError(_0x34c4a0,null));};exports[_0x10cb('0x9e')]=function(_0x5e9009,_0xd0b97f,_0x5839c5){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5e9009[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0xd0b97f,null))[_0x10cb('0x32')](function(_0x4f7e35){if(_0x4f7e35){return db['sequelize'][_0x10cb('0x9f')](function(_0x121d51){return db['OpenchannelApplication'][_0x10cb('0x33')]({'where':{'OpenchannelAccountId':_0x5e9009[_0x10cb('0x56')]['id']},'transaction':_0x121d51})[_0x10cb('0x32')](function(_0x2fd3cd){var _0x5b4487=_['map'](_0x5e9009[_0x10cb('0x58')],function(_0x7a3bc5){_0x7a3bc5['OpenchannelAccountId']=_0x5e9009[_0x10cb('0x56')]['id'];return _0x7a3bc5;});return db[_0x10cb('0x80')]['bulkCreate'](_0x5b4487,{'transaction':_0x121d51});});})[_0x10cb('0x32')](function(){return db['OpenchannelApplication'][_0x10cb('0xa0')]({'where':{'OpenchannelAccountId':_0x5e9009['params']['id']},'order':_0x10cb('0xa1')});});}})[_0x10cb('0x32')](respondWithResult(_0xd0b97f,null))[_0x10cb('0x29')](handleError(_0xd0b97f,null));};exports[_0x10cb('0xa2')]=function(_0x19ac1e,_0x4b2ca9,_0x4e4c50){var _0x3022c9={};var _0xd03187={};var _0x13ad52;var _0xbd14df;return db[_0x10cb('0x3b')]['findOne']({'where':{'id':_0x19ac1e[_0x10cb('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b2ca9,null))[_0x10cb('0x32')](function(_0x30c1ff){if(_0x30c1ff){_0x13ad52=_0x30c1ff;_0xd03187[_0x10cb('0x40')]=_[_0x10cb('0x43')](db[_0x10cb('0x80')][_0x10cb('0x3c')]);_0xd03187[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x19ac1e[_0x10cb('0x42')]);_0xd03187['filters']=_[_0x10cb('0x45')](_0xd03187[_0x10cb('0x40')],_0xd03187[_0x10cb('0x42')]);_0x3022c9['attributes']=_[_0x10cb('0x45')](_0xd03187['model'],qs['fields'](_0x19ac1e['query'][_0x10cb('0x46')]));_0x3022c9[_0x10cb('0x44')]=_0x3022c9[_0x10cb('0x44')]['length']?_0x3022c9[_0x10cb('0x44')]:_0xd03187[_0x10cb('0x40')];_0x3022c9[_0x10cb('0x49')]=qs[_0x10cb('0x4a')](_0x19ac1e['query'][_0x10cb('0x4a')]);_0x3022c9['where']=qs['filters'](_[_0x10cb('0x4d')](_0x19ac1e[_0x10cb('0x42')],_0xd03187[_0x10cb('0x4c')]));if(_0x19ac1e[_0x10cb('0x42')][_0x10cb('0x4e')]){_0x3022c9[_0x10cb('0x4b')]=_[_0x10cb('0x4f')](_0x3022c9[_0x10cb('0x4b')],{'$or':_[_0x10cb('0x41')](_0x3022c9['attributes'],function(_0x447d2b){var _0x58de4e={};_0x58de4e[_0x447d2b]={'$like':'%'+_0x19ac1e[_0x10cb('0x42')]['filter']+'%'};return _0x58de4e;})});}_0x3022c9=_['merge']({},_0x3022c9,_0x19ac1e[_0x10cb('0x51')]);return _0x13ad52[_0x10cb('0xa2')](_0x3022c9);}})['then'](function(_0x180a8b){if(_0x180a8b){_0xbd14df=_0x180a8b['length'];if(!_0x19ac1e['query']['hasOwnProperty'](_0x10cb('0x48'))){_0x3022c9[_0x10cb('0x2f')]=qs[_0x10cb('0x2f')](_0x19ac1e[_0x10cb('0x42')][_0x10cb('0x2f')]);_0x3022c9[_0x10cb('0x2e')]=qs[_0x10cb('0x2e')](_0x19ac1e['query'][_0x10cb('0x2e')]);}return _0x13ad52[_0x10cb('0xa2')](_0x3022c9);}})[_0x10cb('0x32')](function(_0x17ec92){if(_0x17ec92){return _0x17ec92?{'count':_0xbd14df,'rows':_0x17ec92}:null;}})['then'](respondWithResult(_0x4b2ca9,null))[_0x10cb('0x29')](handleError(_0x4b2ca9,null));};exports[_0x10cb('0xa3')]=function(_0x319f84,_0x2813c4,_0x3a92ef){var _0x180df6={'raw':![],'where':{}};var _0x335409={};var _0x221a21={'count':0x0,'rows':[]};return db[_0x10cb('0x3b')]['findOne']({'where':{'id':_0x319f84['params']['id']}})['then'](handleEntityNotFound(_0x2813c4,null))['then'](function(_0x47ff1e){if(_0x47ff1e){_0x335409[_0x10cb('0x40')]=_['keys'](db[_0x10cb('0x8a')][_0x10cb('0x3c')]);_0x335409[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x319f84['query']);_0x335409[_0x10cb('0x4c')]=_[_0x10cb('0x45')](_0x335409[_0x10cb('0x40')],_0x335409['query']);_0x180df6[_0x10cb('0x44')]=_[_0x10cb('0x45')](_0x335409[_0x10cb('0x40')],qs[_0x10cb('0x46')](_0x319f84[_0x10cb('0x42')][_0x10cb('0x46')]));_0x180df6[_0x10cb('0x44')]=_0x180df6[_0x10cb('0x44')]['length']?_0x180df6[_0x10cb('0x44')]:_0x335409[_0x10cb('0x40')];if(!_0x319f84['query'][_0x10cb('0x68')]('nolimit')){_0x180df6[_0x10cb('0x2f')]=qs[_0x10cb('0x2f')](_0x319f84[_0x10cb('0x42')][_0x10cb('0x2f')]);_0x180df6['offset']=qs[_0x10cb('0x2e')](_0x319f84[_0x10cb('0x42')][_0x10cb('0x2e')]);}_0x180df6['order']=qs[_0x10cb('0x4a')](_0x319f84[_0x10cb('0x42')][_0x10cb('0x4a')]);_0x180df6[_0x10cb('0x4b')]=qs[_0x10cb('0x4c')](_[_0x10cb('0x4d')](_0x319f84[_0x10cb('0x42')],_0x335409[_0x10cb('0x4c')]));_0x180df6['where'][_0x10cb('0x69')]=_0x47ff1e['id'];if(_0x319f84[_0x10cb('0x42')][_0x10cb('0x4e')]){_0x180df6[_0x10cb('0x4b')]=_['merge'](_0x180df6[_0x10cb('0x4b')],{'$or':_['map'](_0x180df6[_0x10cb('0x44')],function(_0x5d002c){var _0x1fb92e={};_0x1fb92e[_0x5d002c]={'$like':'%'+_0x319f84['query'][_0x10cb('0x4e')]+'%'};return _0x1fb92e;})});}_0x180df6=_[_0x10cb('0x4f')]({},_0x180df6,_0x319f84[_0x10cb('0x51')]);return db[_0x10cb('0x8a')][_0x10cb('0x2d')]({'where':_0x180df6[_0x10cb('0x4b')]})[_0x10cb('0x32')](function(_0x19eaff){_0x221a21['count']=_0x19eaff;if(_0x319f84['query'][_0x10cb('0x52')]){_0x180df6[_0x10cb('0x53')]=[{'model':db['CmContact'],'as':_0x10cb('0xa4'),'required':![]},{'model':db[_0x10cb('0xa5')],'as':'Owner','attributes':[_0x10cb('0x37'),_0x10cb('0xa6'),_0x10cb('0xa7')],'required':![]},{'model':db[_0x10cb('0xa8')],'as':_0x10cb('0xa9'),'attributes':['id',_0x10cb('0x37'),_0x10cb('0xaa')],'where':_0x319f84[_0x10cb('0x42')][_0x10cb('0xab')]?{'id':_0x319f84['query'][_0x10cb('0xab')]}:undefined,'required':_0x319f84['query'][_0x10cb('0xab')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x10cb('0x6d')](_0x180df6);})[_0x10cb('0x32')](function(_0x1f3bf4){_0x221a21[_0x10cb('0x54')]=_0x1f3bf4;return _0x221a21;});}})[_0x10cb('0x32')](respondWithFilteredResult(_0x2813c4,_0x180df6))[_0x10cb('0x29')](handleError(_0x2813c4,null));};exports[_0x10cb('0xac')]=function(_0x42a602,_0x139c83,_0x2821c1){return db['OpenchannelAccount'][_0x10cb('0x5e')]({'where':{'id':_0x42a602[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x139c83,null))[_0x10cb('0x32')](function(_0x2ef0cf){if(_0x2ef0cf){return _0x2ef0cf[_0x10cb('0xac')](_0x42a602[_0x10cb('0x58')]['ids'],_['omit'](_0x42a602[_0x10cb('0x58')],[_0x10cb('0x6f'),'id'])||{})[_0x10cb('0x8d')](function(_0x567925){for(var _0x56e7e7=0x0;_0x56e7e7<_0x42a602[_0x10cb('0x58')][_0x10cb('0x6f')][_0x10cb('0x47')];_0x56e7e7+=0x1){socket[_0x10cb('0xad')](_0x10cb('0xae'),{'UserId':_0x42a602[_0x10cb('0x58')][_0x10cb('0x6f')][_0x56e7e7],'OpenchannelAccountId':_0x42a602[_0x10cb('0x56')]['id']});}return _0x567925;});}})['then'](respondWithResult(_0x139c83,null))[_0x10cb('0x29')](handleError(_0x139c83,null));};exports[_0x10cb('0xaf')]=function(_0x17bd7d,_0x5909da,_0x534f88){return db[_0x10cb('0x3b')][_0x10cb('0x5e')]({'where':{'id':_0x17bd7d['params']['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x5909da,null))[_0x10cb('0x32')](function(_0x727760){if(_0x727760){return _0x727760['removeAgents'](_0x17bd7d[_0x10cb('0x42')][_0x10cb('0x6f')])[_0x10cb('0x32')](function(){if(_[_0x10cb('0xb0')](_0x17bd7d[_0x10cb('0x42')]['ids'])){for(var _0x2a1bea=0x0;_0x2a1bea<_0x17bd7d[_0x10cb('0x42')][_0x10cb('0x6f')][_0x10cb('0x47')];_0x2a1bea+=0x1){socket[_0x10cb('0xad')](_0x10cb('0xb1'),{'UserId':Number(_0x17bd7d[_0x10cb('0x42')][_0x10cb('0x6f')][_0x2a1bea]),'OpenchannelAccountId':Number(_0x17bd7d['params']['id'])});}}else{socket[_0x10cb('0xad')](_0x10cb('0xb1'),{'UserId':Number(_0x17bd7d['query'][_0x10cb('0x6f')]),'OpenchannelAccountId':Number(_0x17bd7d[_0x10cb('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x5909da,null))['catch'](handleError(_0x5909da,null));};exports['getAgents']=function(_0x5e44aa,_0x45eb6e,_0x344e66){var _0xf8f272={};var _0x137a15={};var _0x338df1;var _0x14553b;return db[_0x10cb('0x3b')][_0x10cb('0x67')]({'where':{'id':_0x5e44aa['params']['id']}})['then'](handleEntityNotFound(_0x45eb6e,null))[_0x10cb('0x32')](function(_0xadd3f1){if(_0xadd3f1){_0x338df1=_0xadd3f1;_0x137a15[_0x10cb('0x40')]=_['keys'](db[_0x10cb('0xa5')][_0x10cb('0x3c')]);_0x137a15[_0x10cb('0x42')]=_[_0x10cb('0x43')](_0x5e44aa[_0x10cb('0x42')]);_0x137a15[_0x10cb('0x4c')]=_['intersection'](_0x137a15[_0x10cb('0x40')],_0x137a15[_0x10cb('0x42')]);_0xf8f272['attributes']=_['intersection'](_0x137a15[_0x10cb('0x40')],qs[_0x10cb('0x46')](_0x5e44aa[_0x10cb('0x42')][_0x10cb('0x46')]));_0xf8f272[_0x10cb('0x44')]=_0xf8f272['attributes'][_0x10cb('0x47')]?_0xf8f272[_0x10cb('0x44')]:_0x137a15[_0x10cb('0x40')];_0xf8f272[_0x10cb('0x49')]=qs[_0x10cb('0x4a')](_0x5e44aa[_0x10cb('0x42')]['sort']);_0xf8f272['where']=qs['filters'](_[_0x10cb('0x4d')](_0x5e44aa['query'],_0x137a15['filters']));if(_0x5e44aa['query'][_0x10cb('0x4e')]){_0xf8f272[_0x10cb('0x4b')]=_['merge'](_0xf8f272['where'],{'$or':_[_0x10cb('0x41')](_0xf8f272[_0x10cb('0x44')],function(_0x43b1d5){var _0x54dbd5={};_0x54dbd5[_0x43b1d5]={'$like':'%'+_0x5e44aa['query']['filter']+'%'};return _0x54dbd5;})});}_0xf8f272=_[_0x10cb('0x4f')]({},_0xf8f272,_0x5e44aa[_0x10cb('0x51')]);return _0x338df1[_0x10cb('0xb2')](_0xf8f272);}})['then'](function(_0x11cdb8){if(_0x11cdb8){_0x14553b=_0x11cdb8['length'];if(!_0x5e44aa[_0x10cb('0x42')][_0x10cb('0x68')](_0x10cb('0x48'))){_0xf8f272['limit']=qs[_0x10cb('0x2f')](_0x5e44aa[_0x10cb('0x42')][_0x10cb('0x2f')]);_0xf8f272[_0x10cb('0x2e')]=qs[_0x10cb('0x2e')](_0x5e44aa[_0x10cb('0x42')][_0x10cb('0x2e')]);}return _0x338df1[_0x10cb('0xb2')](_0xf8f272);}})['then'](function(_0x574ad2){if(_0x574ad2){return _0x574ad2?{'count':_0x14553b,'rows':_0x574ad2}:null;}})[_0x10cb('0x32')](respondWithResult(_0x45eb6e,null))[_0x10cb('0x29')](handleError(_0x45eb6e,null));};exports['send']=function(_0x754b2f,_0x51baab,_0x2c20cc){var _0xb2cab6,_0x5e6994,_0x47c967;if(_[_0x10cb('0x7a')](_0x754b2f[_0x10cb('0x58')]['body'])||_0x754b2f[_0x10cb('0x58')][_0x10cb('0x58')]===''){throw new db[(_0x10cb('0x73'))][(_0x10cb('0x1d'))](_0x10cb('0xb3'));}if(_[_0x10cb('0x7a')](_0x754b2f['body']['to'])){}_0xb2cab6=_0x754b2f[_0x10cb('0x58')]['to'];return db[_0x10cb('0x3b')][_0x10cb('0x67')]({'where':{'id':_0x754b2f[_0x10cb('0x56')]['id']}})[_0x10cb('0x32')](handleEntityNotFound(_0x51baab,null))[_0x10cb('0x32')](function(_0x286d45){if(_0x286d45){return db[_0x10cb('0x3b')]['find']({'where':{'id':_0x286d45['id']},'include':[{'model':db[_0x10cb('0x7e')],'as':_0x10cb('0x7f'),'include':[{'model':db[_0x10cb('0x72')],'as':_0x10cb('0x86'),'where':{[_0x286d45[_0x10cb('0x7c')]]:_0xb2cab6},'limit':0x1,'order':[[_0x10cb('0x77'),_0x10cb('0xb4')]]}]}]})[_0x10cb('0x32')](handleEntityNotFound(_0x51baab,null))[_0x10cb('0x32')](function(_0x59f545){if(_0x59f545&&_0x59f545[_0x10cb('0x7f')]){_0x5e6994=_0x59f545[_0x10cb('0x34')]({'plain':!![]});if(_0x5e6994[_0x10cb('0x7f')]&&_0x5e6994[_0x10cb('0x7f')]['Contacts'][_0x10cb('0x47')]){return _0x5e6994[_0x10cb('0x7f')][_0x10cb('0x86')][0x0];}return db[_0x10cb('0x72')]['create'](_['defaults'](_0x754b2f[_0x10cb('0x58')],{'firstName':_0xb2cab6,[_0x59f545[_0x10cb('0x7c')]]:_0xb2cab6,'phone':_0xb2cab6,'ListId':_0x5e6994[_0x10cb('0x79')]}));}})['then'](handleEntityNotFound(_0x51baab,null))['then'](function(_0x49df99){if(_0x49df99){_0x47c967=_0x49df99;return db[_0x10cb('0x8a')][_0x10cb('0x5e')]({'where':{'ContactId':_0x47c967['id'],'closed':![],'OpenchannelAccountId':_0x5e6994['id']}})['then'](function(_0x114539){if(_0x114539){return[_0x114539,![]];}return db[_0x10cb('0x8a')][_0x10cb('0x57')]({'UserId':_0x754b2f[_0x10cb('0x59')]['id'],'ContactId':_0x47c967['id'],'OpenchannelAccountId':_0x5e6994['id'],'lastMsgDirection':_0x10cb('0xb5'),'Messages':[_[_0x10cb('0x4f')](_0x754b2f[_0x10cb('0x58')],{'read':![],'body':_0x754b2f[_0x10cb('0x58')][_0x10cb('0x58')],'OpenchannelAccountId':_0x5e6994['id'],'UserId':_0x754b2f[_0x10cb('0x59')]['id'],'ContactId':_0x47c967['id']})]},{'include':[{'model':db[_0x10cb('0xb6')],'as':_0x10cb('0xb7')}]})[_0x10cb('0x32')](function(_0x1a7fc1){return[_0x1a7fc1,!![]];});});}})['spread'](function(_0x555ddc,_0x5f09fe){if(_0x5f09fe){return _0x555ddc;}return db[_0x10cb('0xb6')][_0x10cb('0x57')](_[_0x10cb('0x4f')](_0x754b2f[_0x10cb('0x58')],{'read':![],'body':_0x754b2f[_0x10cb('0x58')][_0x10cb('0x58')],'OpenchannelAccountId':_0x5e6994['id'],'OpenchannelInteractionId':_0x555ddc['id'],'UserId':_0x754b2f[_0x10cb('0x59')]['id'],'ContactId':_0x47c967['id']}))[_0x10cb('0x32')](function(_0x549779){_0x555ddc['dataValues'][_0x10cb('0xb7')]=[];_0x555ddc['dataValues'][_0x10cb('0xb7')]['push'](_0x549779[_0x10cb('0xb8')]);return _0x555ddc;});});}})[_0x10cb('0x32')](respondWithResult(_0x51baab,null))['catch'](handleError(_0x51baab,null));}; \ No newline at end of file +var _0x88c8=['sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','CmList','DESC','out','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','http','client','test','Sequelize','ValidationError','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','findAll','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpnechannelAccountId','Disposition','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','createdAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','Contacts','updatedAt','Applications','List','applications','list','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications'];(function(_0x169aa6,_0x4d8a24){var _0x3a47bc=function(_0x1bc7ed){while(--_0x1bc7ed){_0x169aa6['push'](_0x169aa6['shift']());}};_0x3a47bc(++_0x4d8a24);}(_0x88c8,0xd3));var _0x888c=function(_0x30f2cb,_0x281b2a){_0x30f2cb=_0x30f2cb-0x0;var _0x557d58=_0x88c8[_0x30f2cb];return _0x557d58;};'use strict';var pdf=require(_0x888c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x888c('0x1'));var zipdir=require(_0x888c('0x2'));var jsonpatch=require(_0x888c('0x3'));var rp=require(_0x888c('0x4'));var moment=require(_0x888c('0x5'));var BPromise=require(_0x888c('0x6'));var Mustache=require(_0x888c('0x7'));var util=require(_0x888c('0x8'));var path=require(_0x888c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x888c('0xa'));var squel=require('squel');var crypto=require(_0x888c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x888c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x888c('0xd'));var Papa=require(_0x888c('0xe'));var Redis=require(_0x888c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x888c('0x10'));var as=require(_0x888c('0x11'));var hardwareService=require(_0x888c('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x888c('0x13'));var db=require(_0x888c('0x14'))['db'];config['redis']=_[_0x888c('0x15')](config[_0x888c('0x16')],{'host':_0x888c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x888c('0x16')]));require('./openchannelAccount.socket')[_0x888c('0x18')](socket);var jayson=require(_0x888c('0x19'));var client=jayson['client'][_0x888c('0x1a')]({'port':0x232c});var client9002=jayson[_0x888c('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x19849a,_0x7471a4,_0x369cfd){if(_0x369cfd){var _0x275047=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x275047[_0x888c('0x1c')](_0x7471a4)){return _0x19849a;}else{throw new db[(_0x888c('0x1d'))][(_0x888c('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 _0x19849a;}}function respondWithRpcPromise(_0x3cf757,_0x25f1f5,_0x12dfc2,_0x19dd12){return new BPromise(function(_0x96846a,_0x25b0c2){var _0x517f0d=_0x19dd12||client;return _0x517f0d[_0x888c('0x1f')](_0x3cf757,_0x12dfc2)['then'](function(_0x4c57c3){logger[_0x888c('0x20')](_0x888c('0x21'),_0x25f1f5,'request\x20sent');logger[_0x888c('0x22')](_0x888c('0x23'),_0x25f1f5,_0x888c('0x24'),JSON['stringify'](_0x4c57c3));if(_0x4c57c3['error']){if(_0x4c57c3[_0x888c('0x25')]['code']===0x1f4){logger['error'](_0x888c('0x21'),_0x25f1f5,_0x4c57c3[_0x888c('0x25')][_0x888c('0x26')]);return _0x25b0c2(_0x4c57c3[_0x888c('0x25')]['message']);}logger[_0x888c('0x25')](_0x888c('0x21'),_0x25f1f5,_0x4c57c3['error'][_0x888c('0x26')]);return _0x96846a(_0x4c57c3[_0x888c('0x25')][_0x888c('0x26')]);}else{logger[_0x888c('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x25f1f5,_0x888c('0x24'));_0x96846a(_0x4c57c3['result'][_0x888c('0x26')]);}})[_0x888c('0x27')](function(_0x3c6edd){logger[_0x888c('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x25f1f5,_0x3c6edd);_0x25b0c2(_0x3c6edd);});});}function respondWithStatusCode(_0x156fb7,_0x141589){_0x141589=_0x141589||0xcc;return function(_0x258a59){if(_0x258a59){return _0x156fb7['sendStatus'](_0x141589);}return _0x156fb7[_0x888c('0x28')](_0x141589)[_0x888c('0x29')]();};}function respondWithResult(_0x52f826,_0x81be49){_0x81be49=_0x81be49||0xc8;return function(_0x4410a4){if(_0x4410a4){return _0x52f826[_0x888c('0x28')](_0x81be49)[_0x888c('0x2a')](_0x4410a4);}};}function respondWithFilteredResult(_0x121875,_0x13941f){return function(_0x5368b6){if(_0x5368b6){var _0x32edc1=_0x5368b6[_0x888c('0x2b')],_0x1529d8=_0x13941f[_0x888c('0x2c')],_0x475440=_0x13941f[_0x888c('0x2c')]+_0x13941f[_0x888c('0x2d')],_0x5452a6;if(_0x475440>=_0x32edc1){_0x475440=_0x32edc1;_0x5452a6=0xc8;}else{_0x5452a6=0xce;}_0x121875[_0x888c('0x28')](_0x5452a6);return _0x121875[_0x888c('0x2e')]('Content-Range',_0x1529d8+'-'+_0x475440+'/'+_0x32edc1)[_0x888c('0x2a')](_0x5368b6);}return null;};}function patchUpdates(_0x3d8da8){return function(_0x21cda6){try{jsonpatch[_0x888c('0x2f')](_0x21cda6,_0x3d8da8,!![]);}catch(_0x4d58ff){return BPromise['reject'](_0x4d58ff);}return _0x21cda6[_0x888c('0x30')]();};}function saveUpdates(_0x87d712,_0x598c2f){return function(_0x3d9619){if(_0x3d9619){return _0x3d9619[_0x888c('0x31')](_0x87d712)[_0x888c('0x32')](function(_0xbe70a8){return _0xbe70a8;});}return null;};}function removeEntity(_0x50f6fc,_0x137477){return function(_0x298594){if(_0x298594){return _0x298594[_0x888c('0x33')]()[_0x888c('0x32')](function(){var _0x364bef=_0x298594[_0x888c('0x34')]({'plain':!![]});var _0x1f5319='OpenchannelAccounts';return db['UserProfileResource'][_0x888c('0x33')]({'where':{'type':_0x1f5319,'resourceId':_0x364bef['id']}})[_0x888c('0x32')](function(){return _0x298594;});})[_0x888c('0x32')](function(){_0x50f6fc[_0x888c('0x28')](0xcc)[_0x888c('0x29')]();});}};}function handleEntityNotFound(_0x2f9683,_0x1bd03b){return function(_0x3e126a){if(!_0x3e126a){_0x2f9683[_0x888c('0x35')](0x194);}return _0x3e126a;};}function handleError(_0x1fbff4,_0x48d9ca){_0x48d9ca=_0x48d9ca||0x1f4;return function(_0x109881){logger[_0x888c('0x25')](_0x109881[_0x888c('0x36')]);if(_0x109881[_0x888c('0x37')]){delete _0x109881[_0x888c('0x37')];}_0x1fbff4['status'](_0x48d9ca)[_0x888c('0x38')](_0x109881);};}exports[_0x888c('0x39')]=function(_0x389425,_0xb2694b){var _0x24cefd={'include':[{'model':db[_0x888c('0x3a')],'as':_0x888c('0x3b')}]},_0x4c12f2={},_0x4af098={'count':0x0,'rows':[]};var _0x27d16e=_[_0x888c('0x3c')](db[_0x888c('0x3d')][_0x888c('0x3e')],function(_0x25ccd2){return{'name':_0x25ccd2[_0x888c('0x3f')],'type':_0x25ccd2[_0x888c('0x40')][_0x888c('0x41')]};});_0x4c12f2[_0x888c('0x42')]=_['map'](_0x27d16e,_0x888c('0x37'));_0x4c12f2[_0x888c('0x43')]=_[_0x888c('0x44')](_0x389425['query']);_0x4c12f2[_0x888c('0x45')]=_[_0x888c('0x46')](_0x4c12f2[_0x888c('0x42')],_0x4c12f2['query']);_0x24cefd[_0x888c('0x47')]=_[_0x888c('0x46')](_0x4c12f2[_0x888c('0x42')],qs['fields'](_0x389425[_0x888c('0x43')][_0x888c('0x48')]));_0x24cefd['attributes']=_0x24cefd[_0x888c('0x47')][_0x888c('0x49')]?_0x24cefd['attributes']:_0x4c12f2[_0x888c('0x42')];if(!_0x389425[_0x888c('0x43')][_0x888c('0x4a')](_0x888c('0x4b'))){_0x24cefd[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x389425[_0x888c('0x43')][_0x888c('0x2d')]);_0x24cefd[_0x888c('0x2c')]=qs[_0x888c('0x2c')](_0x389425[_0x888c('0x43')][_0x888c('0x2c')]);}_0x24cefd[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x389425[_0x888c('0x43')]['sort']);_0x24cefd[_0x888c('0x4e')]=qs['filters'](_['pick'](_0x389425[_0x888c('0x43')],_0x4c12f2[_0x888c('0x45')]),_0x27d16e);if(_0x389425['query']['filter']){_0x24cefd[_0x888c('0x4e')]=_['merge'](_0x24cefd[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x27d16e,function(_0x3f041e){if(_0x3f041e['type']!==_0x888c('0x4f')){var _0x562d90={};_0x562d90[_0x3f041e[_0x888c('0x37')]]={'$like':'%'+_0x389425[_0x888c('0x43')][_0x888c('0x50')]+'%'};return _0x562d90;}})});}_0x24cefd=_[_0x888c('0x51')]({},_0x24cefd,_0x389425[_0x888c('0x52')]);var _0x57dfe5={'where':_0x24cefd[_0x888c('0x4e')]};return db[_0x888c('0x3d')][_0x888c('0x2b')](_0x57dfe5)['then'](function(_0x53238c){_0x4af098[_0x888c('0x2b')]=_0x53238c;if(_0x389425[_0x888c('0x43')]['includeAll']){_0x24cefd['include']=[{'all':!![]}];}return db[_0x888c('0x3d')][_0x888c('0x53')](_0x24cefd);})[_0x888c('0x32')](function(_0x2c259d){_0x4af098['rows']=_0x2c259d;return _0x4af098;})['then'](respondWithFilteredResult(_0xb2694b,_0x24cefd))['catch'](handleError(_0xb2694b,null));};exports[_0x888c('0x54')]=function(_0x30f477,_0x1c1746){var _0x5691f4={'raw':![],'where':{'id':_0x30f477['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x508986={};_0x508986[_0x888c('0x42')]=_['keys'](db[_0x888c('0x3d')][_0x888c('0x3e')]);_0x508986['query']=_[_0x888c('0x44')](_0x30f477[_0x888c('0x43')]);_0x508986[_0x888c('0x45')]=_[_0x888c('0x46')](_0x508986[_0x888c('0x42')],_0x508986[_0x888c('0x43')]);_0x5691f4[_0x888c('0x47')]=_[_0x888c('0x46')](_0x508986[_0x888c('0x42')],qs[_0x888c('0x48')](_0x30f477[_0x888c('0x43')][_0x888c('0x48')]));_0x5691f4[_0x888c('0x47')]=_0x5691f4[_0x888c('0x47')][_0x888c('0x49')]?_0x5691f4['attributes']:_0x508986[_0x888c('0x42')];if(_0x30f477[_0x888c('0x43')][_0x888c('0x55')]){_0x5691f4[_0x888c('0x56')]=[{'all':!![]}];}_0x5691f4=_[_0x888c('0x51')]({},_0x5691f4,_0x30f477[_0x888c('0x52')]);return db['OpenchannelAccount'][_0x888c('0x57')](_0x5691f4)[_0x888c('0x32')](handleEntityNotFound(_0x1c1746,null))['then'](respondWithResult(_0x1c1746,null))['catch'](handleError(_0x1c1746,null));};exports[_0x888c('0x58')]=function(_0x5532be,_0x201936){return db[_0x888c('0x3d')][_0x888c('0x58')](_0x5532be[_0x888c('0x59')],{})[_0x888c('0x32')](function(_0x122590){var _0x2b4494=_0x5532be[_0x888c('0x5a')][_0x888c('0x34')]({'plain':!![]});if(!_0x2b4494)throw new Error(_0x888c('0x5b'));if(_0x2b4494[_0x888c('0x5c')]==='user'){var _0x58a53e=_0x122590[_0x888c('0x34')]({'plain':!![]});var _0x1fc467=_0x888c('0x5d');return db[_0x888c('0x5e')][_0x888c('0x57')]({'where':{'name':_0x1fc467,'userProfileId':_0x2b4494[_0x888c('0x5f')]},'raw':!![]})[_0x888c('0x32')](function(_0x4a715d){if(_0x4a715d&&_0x4a715d['autoAssociation']===0x0){return db['UserProfileResource'][_0x888c('0x58')]({'name':_0x58a53e[_0x888c('0x37')],'resourceId':_0x58a53e['id'],'type':_0x4a715d[_0x888c('0x37')],'sectionId':_0x4a715d['id']},{})['then'](function(){return _0x122590;});}else{return _0x122590;}})[_0x888c('0x27')](function(_0x2c041a){logger[_0x888c('0x25')](_0x888c('0x60'),_0x2c041a);throw _0x2c041a;});}return _0x122590;})[_0x888c('0x32')](respondWithResult(_0x201936,0xc9))[_0x888c('0x27')](handleError(_0x201936,null));};exports[_0x888c('0x31')]=function(_0x490074,_0x540f63){if(_0x490074[_0x888c('0x59')]['id']){delete _0x490074[_0x888c('0x59')]['id'];}return db['OpenchannelAccount'][_0x888c('0x57')]({'where':{'id':_0x490074[_0x888c('0x61')]['id']},'include':[{'model':db[_0x888c('0x3a')],'as':_0x888c('0x3b')}]})[_0x888c('0x32')](handleEntityNotFound(_0x540f63,null))['then'](saveUpdates(_0x490074[_0x888c('0x59')],null))[_0x888c('0x32')](respondWithResult(_0x540f63,null))[_0x888c('0x27')](handleError(_0x540f63,null));};exports[_0x888c('0x33')]=function(_0x21265f,_0x52fd00){return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0x21265f['params']['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x52fd00,null))[_0x888c('0x32')](removeEntity(_0x52fd00,null))[_0x888c('0x27')](handleError(_0x52fd00,null));};exports[_0x888c('0x62')]=function(_0xa18353,_0x3e4a54){return db[_0x888c('0x3d')][_0x888c('0x62')]()['then'](respondWithResult(_0x3e4a54,null))[_0x888c('0x27')](handleError(_0x3e4a54,null));};exports[_0x888c('0x63')]=function(_0x259b96,_0x47e2ba,_0x4f8d93){if(_0x259b96[_0x888c('0x59')]['id']){delete _0x259b96[_0x888c('0x59')]['id'];}return db[_0x888c('0x3d')]['find']({'where':{'id':_0x259b96[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x47e2ba,null))[_0x888c('0x32')](function(_0x53226e){if(_0x53226e){_0x259b96[_0x888c('0x59')][_0x888c('0x64')]=_0x53226e['id'];return db['Disposition'][_0x888c('0x58')](_0x259b96[_0x888c('0x59')]);}})[_0x888c('0x32')](respondWithResult(_0x47e2ba,null))[_0x888c('0x27')](handleError(_0x47e2ba,null));};exports['getDispositions']=function(_0x4833e8,_0x3525a7,_0x12a044){var _0x4a8c2f={'raw':![],'where':{}};var _0x5d0d7d={};var _0x49e76e={'count':0x0,'rows':[]};return db[_0x888c('0x3d')]['findOne']({'where':{'id':_0x4833e8['params']['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x3525a7,null))['then'](function(_0x3bcd1e){if(_0x3bcd1e){_0x5d0d7d[_0x888c('0x42')]=_[_0x888c('0x44')](db[_0x888c('0x65')][_0x888c('0x3e')]);_0x5d0d7d[_0x888c('0x43')]=_[_0x888c('0x44')](_0x4833e8[_0x888c('0x43')]);_0x5d0d7d[_0x888c('0x45')]=_[_0x888c('0x46')](_0x5d0d7d[_0x888c('0x42')],_0x5d0d7d[_0x888c('0x43')]);_0x4a8c2f['attributes']=_[_0x888c('0x46')](_0x5d0d7d[_0x888c('0x42')],qs[_0x888c('0x48')](_0x4833e8[_0x888c('0x43')][_0x888c('0x48')]));_0x4a8c2f[_0x888c('0x47')]=_0x4a8c2f[_0x888c('0x47')]['length']?_0x4a8c2f[_0x888c('0x47')]:_0x5d0d7d[_0x888c('0x42')];if(!_0x4833e8[_0x888c('0x43')][_0x888c('0x4a')]('nolimit')){_0x4a8c2f[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x4833e8[_0x888c('0x43')][_0x888c('0x2d')]);_0x4a8c2f[_0x888c('0x2c')]=qs[_0x888c('0x2c')](_0x4833e8[_0x888c('0x43')]['offset']);}_0x4a8c2f[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x4833e8[_0x888c('0x43')][_0x888c('0x4d')]);_0x4a8c2f[_0x888c('0x4e')]=qs[_0x888c('0x45')](_[_0x888c('0x66')](_0x4833e8[_0x888c('0x43')],_0x5d0d7d[_0x888c('0x45')]));_0x4a8c2f[_0x888c('0x4e')][_0x888c('0x67')]=_0x3bcd1e['id'];if(_0x4833e8[_0x888c('0x43')][_0x888c('0x50')]){_0x4a8c2f[_0x888c('0x4e')]=_[_0x888c('0x51')](_0x4a8c2f[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x4a8c2f[_0x888c('0x47')],function(_0x376e73){var _0x18308f={};_0x18308f[_0x376e73]={'$like':'%'+_0x4833e8[_0x888c('0x43')][_0x888c('0x50')]+'%'};return _0x18308f;})});}_0x4a8c2f=_[_0x888c('0x51')]({},_0x4a8c2f,_0x4833e8[_0x888c('0x52')]);return db[_0x888c('0x65')][_0x888c('0x2b')]({'where':_0x4a8c2f[_0x888c('0x4e')]})['then'](function(_0x27480c){_0x49e76e['count']=_0x27480c;if(_0x4833e8['query'][_0x888c('0x55')]){_0x4a8c2f[_0x888c('0x56')]=[{'all':!![]}];}return db[_0x888c('0x65')][_0x888c('0x53')](_0x4a8c2f);})[_0x888c('0x32')](function(_0x26cf9e){_0x49e76e['rows']=_0x26cf9e;return _0x49e76e;});}})[_0x888c('0x32')](respondWithFilteredResult(_0x3525a7,_0x4a8c2f))['catch'](handleError(_0x3525a7,null));};exports[_0x888c('0x68')]=function(_0x223970,_0x5452d2,_0x3641c0){return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0x223970['params']['id']}})['then'](handleEntityNotFound(_0x5452d2,null))[_0x888c('0x32')](function(_0x586b7d){if(_0x586b7d){return _0x586b7d[_0x888c('0x68')](_0x223970['query'][_0x888c('0x69')]);}})[_0x888c('0x32')](respondWithStatusCode(_0x5452d2,null))[_0x888c('0x27')](handleError(_0x5452d2,null));};exports[_0x888c('0x6a')]=function(_0xc052ed,_0x1561bd,_0x2a5812){if(_0xc052ed[_0x888c('0x59')]['id']){delete _0xc052ed['body']['id'];}return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0xc052ed[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x1561bd,null))['then'](function(_0x2fa402){if(_0x2fa402){_0xc052ed['body'][_0x888c('0x67')]=_0x2fa402['id'];return db[_0x888c('0x6b')][_0x888c('0x58')](_0xc052ed['body']);}})[_0x888c('0x32')](respondWithResult(_0x1561bd,null))[_0x888c('0x27')](handleError(_0x1561bd,null));};exports[_0x888c('0x6c')]=function(_0x12e267,_0x23fc3e,_0x2a9470){var _0x4fe8a1={'raw':![],'where':{}};var _0x2fce9e={};var _0x4f1389={'count':0x0,'rows':[]};return db[_0x888c('0x3d')][_0x888c('0x6d')]({'where':{'id':_0x12e267[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x23fc3e,null))['then'](function(_0x148840){if(_0x148840){_0x2fce9e[_0x888c('0x42')]=_['keys'](db[_0x888c('0x6b')]['rawAttributes']);_0x2fce9e[_0x888c('0x43')]=_['keys'](_0x12e267[_0x888c('0x43')]);_0x2fce9e['filters']=_[_0x888c('0x46')](_0x2fce9e[_0x888c('0x42')],_0x2fce9e[_0x888c('0x43')]);_0x4fe8a1['attributes']=_['intersection'](_0x2fce9e[_0x888c('0x42')],qs['fields'](_0x12e267['query'][_0x888c('0x48')]));_0x4fe8a1[_0x888c('0x47')]=_0x4fe8a1['attributes']['length']?_0x4fe8a1['attributes']:_0x2fce9e[_0x888c('0x42')];if(!_0x12e267[_0x888c('0x43')][_0x888c('0x4a')](_0x888c('0x4b'))){_0x4fe8a1[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x12e267['query'][_0x888c('0x2d')]);_0x4fe8a1['offset']=qs[_0x888c('0x2c')](_0x12e267[_0x888c('0x43')][_0x888c('0x2c')]);}_0x4fe8a1[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x12e267['query'][_0x888c('0x4d')]);_0x4fe8a1['where']=qs['filters'](_['pick'](_0x12e267[_0x888c('0x43')],_0x2fce9e['filters']));_0x4fe8a1[_0x888c('0x4e')]['OpenchannelAccountId']=_0x148840['id'];if(_0x12e267['query'][_0x888c('0x50')]){_0x4fe8a1['where']=_[_0x888c('0x51')](_0x4fe8a1[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x4fe8a1['attributes'],function(_0x5543b9){var _0x56fc04={};_0x56fc04[_0x5543b9]={'$like':'%'+_0x12e267[_0x888c('0x43')]['filter']+'%'};return _0x56fc04;})});}_0x4fe8a1=_[_0x888c('0x51')]({},_0x4fe8a1,_0x12e267[_0x888c('0x52')]);return db[_0x888c('0x6b')][_0x888c('0x2b')]({'where':_0x4fe8a1[_0x888c('0x4e')]})['then'](function(_0x226e23){_0x4f1389['count']=_0x226e23;if(_0x12e267[_0x888c('0x43')][_0x888c('0x55')]){_0x4fe8a1[_0x888c('0x56')]=[{'all':!![]}];}return db[_0x888c('0x6b')]['findAll'](_0x4fe8a1);})[_0x888c('0x32')](function(_0x435d7f){_0x4f1389[_0x888c('0x6e')]=_0x435d7f;return _0x4f1389;});}})['then'](respondWithFilteredResult(_0x23fc3e,_0x4fe8a1))[_0x888c('0x27')](handleError(_0x23fc3e,null));};exports[_0x888c('0x6f')]=function(_0x325c12,_0x2871c9,_0x7db5ba){return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0x325c12['params']['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x2871c9,null))['then'](function(_0x5e4aed){if(_0x5e4aed){return _0x5e4aed[_0x888c('0x6f')](_0x325c12['query'][_0x888c('0x69')]);}})[_0x888c('0x32')](respondWithStatusCode(_0x2871c9,null))[_0x888c('0x27')](handleError(_0x2871c9,null));};exports[_0x888c('0x70')]=function(_0x464a81,_0x8ae0f8,_0x1ef3ea){var _0x152928={'body':_0x464a81[_0x888c('0x59')],'channel':'openchannel'};var _0x3639bc=[];var _0xb717ff=[];var _0x387ac1={};var _0xa93051=![];return db[_0x888c('0x71')][_0x888c('0x62')]()[_0x888c('0x32')](function(_0x3e1c48){if(!_0x3e1c48){throw new db[(_0x888c('0x1d'))][(_0x888c('0x1e'))](_0x888c('0x72'));}_0x3639bc=_[_0x888c('0x73')](_['keys'](_0x3e1c48),[_0x888c('0x74'),'updatedAt']);_0xb717ff=_[_0x888c('0x73')](_[_0x888c('0x44')](_0x3e1c48),['createdAt','updatedAt','CompanyId',_0x888c('0x75')]);if(_0x464a81[_0x888c('0x59')]['id']){delete _0x464a81[_0x888c('0x59')]['id'];}if(_[_0x888c('0x76')](_0x464a81['body']['from'])){throw new db[(_0x888c('0x1d'))][(_0x888c('0x1e'))](_0x888c('0x77'));}if(_[_0x888c('0x76')](_0x464a81[_0x888c('0x59')][_0x888c('0x59')])||_0x464a81[_0x888c('0x59')][_0x888c('0x59')]===''){throw new db[(_0x888c('0x1d'))][(_0x888c('0x1e'))](_0x888c('0x78'));}if(_[_0x888c('0x76')](_0x464a81[_0x888c('0x59')][_0x888c('0x79')])){throw new db[(_0x888c('0x1d'))][(_0x888c('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb717ff);}if(!_[_0x888c('0x7a')](_0xb717ff,_0x464a81[_0x888c('0x59')]['mapKey'])){throw new db[(_0x888c('0x1d'))][(_0x888c('0x1e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb717ff);}_0x387ac1[_0x464a81['body'][_0x888c('0x79')]]=_0x464a81[_0x888c('0x59')][_0x888c('0x7b')];})[_0x888c('0x32')](function(){return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0x464a81[_0x888c('0x61')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x888c('0x71')],'as':_0x888c('0x7c'),'where':_0x387ac1,'limit':0x1,'order':[[_0x888c('0x7d'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x888c('0x7e')}]});})[_0x888c('0x32')](handleEntityNotFound(_0x8ae0f8,null))[_0x888c('0x32')](function(_0x2aa8f4){if(_0x2aa8f4&&_0x2aa8f4[_0x888c('0x7f')]){_0x152928['account']=_0x2aa8f4;_0x152928[_0x888c('0x80')]=_0x2aa8f4[_0x888c('0x7e')];_0x152928[_0x888c('0x81')]=_0x2aa8f4[_0x888c('0x7f')];_0x152928[_0x888c('0x80')]=_['orderBy'](_0x152928[_0x888c('0x80')],[_0x888c('0x82')],[_0x888c('0x83')]);if(_0x152928[_0x888c('0x84')][_0x888c('0x7e')]){delete _0x152928['account'][_0x888c('0x7e')];}if(_0x152928['account']['List']&&_0x152928[_0x888c('0x84')]['List'][_0x888c('0x7c')][_0x888c('0x49')]){return _0x152928[_0x888c('0x84')][_0x888c('0x7f')]['Contacts'][0x0];}var _0x4e3795=_[_0x888c('0x15')](_0x464a81['body'],{'firstName':_0x464a81[_0x888c('0x59')][_0x888c('0x7b')],'ListId':_0x2aa8f4[_0x888c('0x75')]});_0x4e3795[_0x464a81['body'][_0x888c('0x79')]]=_0x464a81[_0x888c('0x59')]['from'];return db[_0x888c('0x71')]['create'](_0x4e3795,{'fields':_0x3639bc,'raw':!![]});}})[_0x888c('0x32')](handleEntityNotFound(_0x8ae0f8,null))[_0x888c('0x32')](function(_0x433f5f){_0x152928[_0x888c('0x85')]=_0x433f5f;if(_0x433f5f){var _0x28746e={'ContactId':_0x433f5f['id'],'OpenchannelAccountId':_0x464a81[_0x888c('0x61')]['id'],'from':(_0x433f5f[_0x888c('0x86')]||'')+'\x20'+(_0x433f5f[_0x888c('0x87')]||'')};var _0x1aa65d={'OpenchannelAccountId':_0x464a81[_0x888c('0x61')]['id'],'closed':![]};if(_0x464a81[_0x888c('0x59')][_0x888c('0x88')]){_0x1aa65d[_0x888c('0x88')]=_0x464a81['body']['threadId'];return db[_0x888c('0x89')][_0x888c('0x57')]({'where':_0x1aa65d})[_0x888c('0x32')](function(_0x188035){if(_0x188035){return[_0x188035,![]];}_0x28746e[_0x888c('0x88')]=_0x464a81[_0x888c('0x59')][_0x888c('0x88')];_0x28746e['externalUrl']=_0x464a81[_0x888c('0x59')]['externalUrl'];return db[_0x888c('0x89')][_0x888c('0x58')](_0x28746e)[_0x888c('0x32')](function(_0x3e53d7){return[_0x3e53d7,!![]];});});}else{_0x1aa65d[_0x888c('0x88')]=null;}_0x1aa65d[_0x888c('0x8a')]=_0x433f5f['id'];return db['OpenchannelInteraction'][_0x888c('0x57')]({'where':_0x1aa65d})['then'](function(_0x431fa3){if(_0x431fa3){return[_0x431fa3,![]];}return db[_0x888c('0x89')][_0x888c('0x58')](_0x28746e)[_0x888c('0x32')](function(_0xc0e356){return[_0xc0e356,!![]];});});}})['spread'](function(_0x30d436,_0x1bbe05){if(_0x30d436){_0xa93051=_0x1bbe05;if(!_0x1bbe05){var _0x2bf24c={'from':(_0x152928[_0x888c('0x85')][_0x888c('0x86')]||'')+'\x20'+(_0x152928[_0x888c('0x85')][_0x888c('0x87')]||'')};if(_0x464a81[_0x888c('0x59')][_0x888c('0x88')]&&_0x464a81[_0x888c('0x59')][_0x888c('0x8b')]&&_0x464a81['body'][_0x888c('0x88')]!=_0x464a81[_0x888c('0x59')][_0x888c('0x8b')]){_0x2bf24c[_0x888c('0x88')]=_0x464a81['body'][_0x888c('0x8b')];}return _0x30d436[_0x888c('0x31')](_0x2bf24c);}else{return _0x30d436;}}})['then'](function(_0x473433){_0x152928[_0x888c('0x8c')]=_0x473433['get']({'plain':!![]});_0x152928[_0x888c('0x8c')]['created']=_0xa93051;if(_0x152928[_0x888c('0x8c')][_0x888c('0x8d')]){if(_0x152928[_0x888c('0x84')][_0x888c('0x8e')]){_0x152928['applications'][_0x888c('0x8f')]({'id':0x0,'priority':_0x152928[_0x888c('0x80')][_0x888c('0x49')]+0x1,'app':_0x888c('0x90'),'appdata':_0x888c('0x91'),'interval':'*,*,*,*'});}}return db[_0x888c('0x92')][_0x888c('0x58')]({'body':_0x464a81[_0x888c('0x59')][_0x888c('0x59')],'OpenchannelAccountId':_0x464a81[_0x888c('0x61')]['id'],'OpenchannelInteractionId':_0x473433['id'],'direction':'in','ContactId':_0x152928[_0x888c('0x85')]['id'],'AttachmentId':_0x464a81[_0x888c('0x59')][_0x888c('0x93')]});})['then'](function(_0x35fe80){_0x152928[_0x888c('0x26')]=_0x35fe80;if(_0x152928['interaction']['UserId']){return db['User'][_0x888c('0x57')]({'attributes':['id','name'],'where':{'id':_0x152928['interaction'][_0x888c('0x94')]}})['then'](function(_0x20a0fa){if(_0x20a0fa){_0x152928[_0x888c('0x80')][_0x888c('0x95')]({'id':0x0,'priority':0x0,'app':_0x888c('0x96'),'appdata':_0x20a0fa[_0x888c('0x37')]+','+(_0x152928['account'][_0x888c('0x97')]||0xa),'interval':_0x888c('0x98')});_0x152928['forcedOwnership']=![];}return respondWithRpcPromise(_0x888c('0x99'),_0x888c('0x9a'),_0x152928);});}return respondWithRpcPromise(_0x888c('0x99'),'startRouting',_0x152928);})[_0x888c('0x32')](function(_0x1b4b41){respondWithRpcPromise(_0x888c('0x9b'),_0x888c('0x9b'),{'event':_0x888c('0x70'),'message':_0x1b4b41},client9002);return _0x1b4b41;})[_0x888c('0x32')](respondWithResult(_0x8ae0f8,null))[_0x888c('0x27')](handleError(_0x8ae0f8,null));};exports[_0x888c('0x9c')]=function(_0x4da42c,_0x57b508,_0x4799bd){return db[_0x888c('0x3d')]['findOne']({'where':{'id':_0x4da42c[_0x888c('0x61')]['id']}})['then'](handleEntityNotFound(_0x57b508,null))['then'](function(_0xa72013){if(_0xa72013){return db[_0x888c('0x9d')][_0x888c('0x9e')](function(_0x15a2ab){return db[_0x888c('0x9f')][_0x888c('0x33')]({'where':{'OpenchannelAccountId':_0x4da42c[_0x888c('0x61')]['id']},'transaction':_0x15a2ab})[_0x888c('0x32')](function(_0x22f69f){var _0xb4448f=_['map'](_0x4da42c[_0x888c('0x59')],function(_0x3a1995){_0x3a1995[_0x888c('0x67')]=_0x4da42c[_0x888c('0x61')]['id'];return _0x3a1995;});return db[_0x888c('0x9f')]['bulkCreate'](_0xb4448f,{'transaction':_0x15a2ab});});})['then'](function(){return db[_0x888c('0x9f')][_0x888c('0xa0')]({'where':{'OpenchannelAccountId':_0x4da42c['params']['id']},'order':_0x888c('0x82')});});}})[_0x888c('0x32')](respondWithResult(_0x57b508,null))[_0x888c('0x27')](handleError(_0x57b508,null));};exports['getApplications']=function(_0x447056,_0x36fed4,_0x44bdcf){var _0x5588f1={};var _0xaf6465={};var _0x255a93;var _0x5303bb;return db['OpenchannelAccount'][_0x888c('0x6d')]({'where':{'id':_0x447056[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x36fed4,null))['then'](function(_0x1809d6){if(_0x1809d6){_0x255a93=_0x1809d6;_0xaf6465[_0x888c('0x42')]=_[_0x888c('0x44')](db[_0x888c('0x9f')]['rawAttributes']);_0xaf6465['query']=_[_0x888c('0x44')](_0x447056[_0x888c('0x43')]);_0xaf6465[_0x888c('0x45')]=_['intersection'](_0xaf6465[_0x888c('0x42')],_0xaf6465['query']);_0x5588f1['attributes']=_['intersection'](_0xaf6465[_0x888c('0x42')],qs[_0x888c('0x48')](_0x447056[_0x888c('0x43')][_0x888c('0x48')]));_0x5588f1['attributes']=_0x5588f1[_0x888c('0x47')][_0x888c('0x49')]?_0x5588f1[_0x888c('0x47')]:_0xaf6465[_0x888c('0x42')];_0x5588f1[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x447056[_0x888c('0x43')][_0x888c('0x4d')]);_0x5588f1[_0x888c('0x4e')]=qs[_0x888c('0x45')](_['pick'](_0x447056[_0x888c('0x43')],_0xaf6465['filters']));if(_0x447056[_0x888c('0x43')]['filter']){_0x5588f1['where']=_['merge'](_0x5588f1[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x5588f1[_0x888c('0x47')],function(_0x168b77){var _0x2c050b={};_0x2c050b[_0x168b77]={'$like':'%'+_0x447056[_0x888c('0x43')][_0x888c('0x50')]+'%'};return _0x2c050b;})});}_0x5588f1=_[_0x888c('0x51')]({},_0x5588f1,_0x447056[_0x888c('0x52')]);return _0x255a93[_0x888c('0xa1')](_0x5588f1);}})[_0x888c('0x32')](function(_0x3d0616){if(_0x3d0616){_0x5303bb=_0x3d0616[_0x888c('0x49')];if(!_0x447056[_0x888c('0x43')][_0x888c('0x4a')](_0x888c('0x4b'))){_0x5588f1[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x447056[_0x888c('0x43')][_0x888c('0x2d')]);_0x5588f1['offset']=qs[_0x888c('0x2c')](_0x447056[_0x888c('0x43')][_0x888c('0x2c')]);}return _0x255a93[_0x888c('0xa1')](_0x5588f1);}})[_0x888c('0x32')](function(_0x1a9c01){if(_0x1a9c01){return _0x1a9c01?{'count':_0x5303bb,'rows':_0x1a9c01}:null;}})[_0x888c('0x32')](respondWithResult(_0x36fed4,null))[_0x888c('0x27')](handleError(_0x36fed4,null));};exports[_0x888c('0xa2')]=function(_0x538693,_0x4b5932,_0x2b7c79){var _0x453ca3={'raw':![],'where':{}};var _0x478c96={};var _0x456dd9={'count':0x0,'rows':[]};return db[_0x888c('0x3d')]['findOne']({'where':{'id':_0x538693[_0x888c('0x61')]['id']}})['then'](handleEntityNotFound(_0x4b5932,null))[_0x888c('0x32')](function(_0xfd1bf2){if(_0xfd1bf2){_0x478c96[_0x888c('0x42')]=_[_0x888c('0x44')](db[_0x888c('0x89')][_0x888c('0x3e')]);_0x478c96[_0x888c('0x43')]=_[_0x888c('0x44')](_0x538693[_0x888c('0x43')]);_0x478c96['filters']=_[_0x888c('0x46')](_0x478c96[_0x888c('0x42')],_0x478c96[_0x888c('0x43')]);_0x453ca3[_0x888c('0x47')]=_['intersection'](_0x478c96[_0x888c('0x42')],qs[_0x888c('0x48')](_0x538693[_0x888c('0x43')][_0x888c('0x48')]));_0x453ca3[_0x888c('0x47')]=_0x453ca3[_0x888c('0x47')][_0x888c('0x49')]?_0x453ca3[_0x888c('0x47')]:_0x478c96[_0x888c('0x42')];if(!_0x538693['query'][_0x888c('0x4a')](_0x888c('0x4b'))){_0x453ca3[_0x888c('0x2d')]=qs[_0x888c('0x2d')](_0x538693[_0x888c('0x43')][_0x888c('0x2d')]);_0x453ca3[_0x888c('0x2c')]=qs[_0x888c('0x2c')](_0x538693[_0x888c('0x43')][_0x888c('0x2c')]);}_0x453ca3[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x538693[_0x888c('0x43')][_0x888c('0x4d')]);_0x453ca3[_0x888c('0x4e')]=qs[_0x888c('0x45')](_[_0x888c('0x66')](_0x538693[_0x888c('0x43')],_0x478c96[_0x888c('0x45')]));_0x453ca3[_0x888c('0x4e')][_0x888c('0x67')]=_0xfd1bf2['id'];if(_0x538693[_0x888c('0x43')][_0x888c('0x50')]){_0x453ca3[_0x888c('0x4e')]=_[_0x888c('0x51')](_0x453ca3[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x453ca3[_0x888c('0x47')],function(_0x186b41){var _0x1419a4={};_0x1419a4[_0x186b41]={'$like':'%'+_0x538693['query'][_0x888c('0x50')]+'%'};return _0x1419a4;})});}_0x453ca3=_[_0x888c('0x51')]({},_0x453ca3,_0x538693[_0x888c('0x52')]);return db[_0x888c('0x89')][_0x888c('0x2b')]({'where':_0x453ca3[_0x888c('0x4e')]})[_0x888c('0x32')](function(_0x362092){_0x456dd9[_0x888c('0x2b')]=_0x362092;if(_0x538693[_0x888c('0x43')][_0x888c('0x55')]){_0x453ca3[_0x888c('0x56')]=[{'model':db[_0x888c('0x71')],'as':_0x888c('0xa3'),'required':![]},{'model':db['User'],'as':_0x888c('0xa4'),'attributes':[_0x888c('0x37'),_0x888c('0xa5'),_0x888c('0xa6')],'required':![]},{'model':db[_0x888c('0xa7')],'as':_0x888c('0xa8'),'attributes':['id',_0x888c('0x37'),'color'],'where':_0x538693['query'][_0x888c('0xa9')]?{'id':_0x538693['query'][_0x888c('0xa9')]}:undefined,'required':_0x538693['query'][_0x888c('0xa9')]?!![]:![]}];}return db[_0x888c('0x89')][_0x888c('0x53')](_0x453ca3);})[_0x888c('0x32')](function(_0x3a8006){_0x456dd9[_0x888c('0x6e')]=_0x3a8006;return _0x456dd9;});}})[_0x888c('0x32')](respondWithFilteredResult(_0x4b5932,_0x453ca3))[_0x888c('0x27')](handleError(_0x4b5932,null));};exports[_0x888c('0xaa')]=function(_0x269715,_0x3ee7fb,_0x444653){return db[_0x888c('0x3d')][_0x888c('0x57')]({'where':{'id':_0x269715[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x3ee7fb,null))[_0x888c('0x32')](function(_0x4bf9c5){if(_0x4bf9c5){return _0x4bf9c5[_0x888c('0xaa')](_0x269715[_0x888c('0x59')][_0x888c('0x69')],_[_0x888c('0xab')](_0x269715[_0x888c('0x59')],[_0x888c('0x69'),'id'])||{})[_0x888c('0xac')](function(_0xfaa2b3){for(var _0x254e01=0x0;_0x254e01<_0x269715[_0x888c('0x59')][_0x888c('0x69')][_0x888c('0x49')];_0x254e01+=0x1){socket['emit'](_0x888c('0xad'),{'UserId':_0x269715[_0x888c('0x59')][_0x888c('0x69')][_0x254e01],'OpenchannelAccountId':_0x269715['params']['id']});}return _0xfaa2b3;});}})[_0x888c('0x32')](respondWithResult(_0x3ee7fb,null))[_0x888c('0x27')](handleError(_0x3ee7fb,null));};exports['removeAgents']=function(_0x53d1aa,_0x2fb564,_0x59a718){return db[_0x888c('0x3d')]['find']({'where':{'id':_0x53d1aa[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x2fb564,null))[_0x888c('0x32')](function(_0x16086c){if(_0x16086c){return _0x16086c[_0x888c('0xae')](_0x53d1aa[_0x888c('0x43')][_0x888c('0x69')])[_0x888c('0x32')](function(){if(_[_0x888c('0xaf')](_0x53d1aa['query'][_0x888c('0x69')])){for(var _0x52db55=0x0;_0x52db55<_0x53d1aa[_0x888c('0x43')][_0x888c('0x69')][_0x888c('0x49')];_0x52db55+=0x1){socket['emit'](_0x888c('0xb0'),{'UserId':Number(_0x53d1aa[_0x888c('0x43')]['ids'][_0x52db55]),'OpenchannelAccountId':Number(_0x53d1aa['params']['id'])});}}else{socket['emit'](_0x888c('0xb0'),{'UserId':Number(_0x53d1aa[_0x888c('0x43')][_0x888c('0x69')]),'OpenchannelAccountId':Number(_0x53d1aa[_0x888c('0x61')]['id'])});}});}})[_0x888c('0x32')](respondWithStatusCode(_0x2fb564,null))[_0x888c('0x27')](handleError(_0x2fb564,null));};exports[_0x888c('0xb1')]=function(_0x468a11,_0x3e30ec,_0x12ec34){var _0x3b06e3={};var _0x11e9db={};var _0x3062a3;var _0x4bd90a;return db[_0x888c('0x3d')][_0x888c('0x6d')]({'where':{'id':_0x468a11[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x3e30ec,null))[_0x888c('0x32')](function(_0x4582e7){if(_0x4582e7){_0x3062a3=_0x4582e7;_0x11e9db['model']=_[_0x888c('0x44')](db[_0x888c('0xb2')][_0x888c('0x3e')]);_0x11e9db[_0x888c('0x43')]=_[_0x888c('0x44')](_0x468a11['query']);_0x11e9db['filters']=_[_0x888c('0x46')](_0x11e9db[_0x888c('0x42')],_0x11e9db['query']);_0x3b06e3[_0x888c('0x47')]=_['intersection'](_0x11e9db[_0x888c('0x42')],qs[_0x888c('0x48')](_0x468a11[_0x888c('0x43')][_0x888c('0x48')]));_0x3b06e3[_0x888c('0x47')]=_0x3b06e3[_0x888c('0x47')][_0x888c('0x49')]?_0x3b06e3[_0x888c('0x47')]:_0x11e9db[_0x888c('0x42')];_0x3b06e3[_0x888c('0x4c')]=qs[_0x888c('0x4d')](_0x468a11[_0x888c('0x43')][_0x888c('0x4d')]);_0x3b06e3[_0x888c('0x4e')]=qs['filters'](_[_0x888c('0x66')](_0x468a11['query'],_0x11e9db[_0x888c('0x45')]));if(_0x468a11['query'][_0x888c('0x50')]){_0x3b06e3[_0x888c('0x4e')]=_['merge'](_0x3b06e3[_0x888c('0x4e')],{'$or':_[_0x888c('0x3c')](_0x3b06e3[_0x888c('0x47')],function(_0x401d30){var _0x2e66fd={};_0x2e66fd[_0x401d30]={'$like':'%'+_0x468a11[_0x888c('0x43')][_0x888c('0x50')]+'%'};return _0x2e66fd;})});}_0x3b06e3=_[_0x888c('0x51')]({},_0x3b06e3,_0x468a11[_0x888c('0x52')]);return _0x3062a3[_0x888c('0xb1')](_0x3b06e3);}})['then'](function(_0x13b378){if(_0x13b378){_0x4bd90a=_0x13b378['length'];if(!_0x468a11[_0x888c('0x43')]['hasOwnProperty'](_0x888c('0x4b'))){_0x3b06e3['limit']=qs[_0x888c('0x2d')](_0x468a11['query'][_0x888c('0x2d')]);_0x3b06e3[_0x888c('0x2c')]=qs[_0x888c('0x2c')](_0x468a11[_0x888c('0x43')]['offset']);}return _0x3062a3[_0x888c('0xb1')](_0x3b06e3);}})[_0x888c('0x32')](function(_0x581aa6){if(_0x581aa6){return _0x581aa6?{'count':_0x4bd90a,'rows':_0x581aa6}:null;}})['then'](respondWithResult(_0x3e30ec,null))[_0x888c('0x27')](handleError(_0x3e30ec,null));};exports['send']=function(_0x384735,_0x505bdb,_0x35af4d){var _0x38908a,_0x2f7b30,_0x5d22a4;if(_[_0x888c('0x76')](_0x384735['body'][_0x888c('0x59')])||_0x384735[_0x888c('0x59')][_0x888c('0x59')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x888c('0x76')](_0x384735['body']['to'])){}_0x38908a=_0x384735[_0x888c('0x59')]['to'];return db[_0x888c('0x3d')][_0x888c('0x6d')]({'where':{'id':_0x384735[_0x888c('0x61')]['id']}})[_0x888c('0x32')](handleEntityNotFound(_0x505bdb,null))['then'](function(_0x112d28){if(_0x112d28){return db[_0x888c('0x3d')]['find']({'where':{'id':_0x112d28['id']},'include':[{'model':db[_0x888c('0xb3')],'as':_0x888c('0x7f'),'include':[{'model':db[_0x888c('0x71')],'as':_0x888c('0x7c'),'where':{[_0x112d28[_0x888c('0x79')]]:_0x38908a},'limit':0x1,'order':[[_0x888c('0x7d'),_0x888c('0xb4')]]}]}]})[_0x888c('0x32')](handleEntityNotFound(_0x505bdb,null))[_0x888c('0x32')](function(_0x25b315){if(_0x25b315&&_0x25b315[_0x888c('0x7f')]){_0x2f7b30=_0x25b315[_0x888c('0x34')]({'plain':!![]});if(_0x2f7b30[_0x888c('0x7f')]&&_0x2f7b30['List'][_0x888c('0x7c')][_0x888c('0x49')]){return _0x2f7b30[_0x888c('0x7f')][_0x888c('0x7c')][0x0];}return db['CmContact'][_0x888c('0x58')](_['defaults'](_0x384735['body'],{'firstName':_0x38908a,[_0x25b315[_0x888c('0x79')]]:_0x38908a,'phone':_0x38908a,'ListId':_0x2f7b30['ListId']}));}})['then'](handleEntityNotFound(_0x505bdb,null))[_0x888c('0x32')](function(_0x4ffba1){if(_0x4ffba1){_0x5d22a4=_0x4ffba1;return db[_0x888c('0x89')]['find']({'where':{'ContactId':_0x5d22a4['id'],'closed':![],'OpenchannelAccountId':_0x2f7b30['id']}})[_0x888c('0x32')](function(_0x15e966){if(_0x15e966){return[_0x15e966,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x384735[_0x888c('0x5a')]['id'],'ContactId':_0x5d22a4['id'],'OpenchannelAccountId':_0x2f7b30['id'],'lastMsgDirection':_0x888c('0xb5'),'Messages':[_[_0x888c('0x51')](_0x384735[_0x888c('0x59')],{'read':![],'body':_0x384735[_0x888c('0x59')][_0x888c('0x59')],'OpenchannelAccountId':_0x2f7b30['id'],'UserId':_0x384735['user']['id'],'ContactId':_0x5d22a4['id']})]},{'include':[{'model':db[_0x888c('0x92')],'as':'Messages'}]})[_0x888c('0x32')](function(_0x35ffea){return[_0x35ffea,!![]];});});}})[_0x888c('0xac')](function(_0x3f9780,_0xb81af9){if(_0xb81af9){return _0x3f9780;}return db[_0x888c('0x92')][_0x888c('0x58')](_['merge'](_0x384735[_0x888c('0x59')],{'read':![],'body':_0x384735[_0x888c('0x59')]['body'],'OpenchannelAccountId':_0x2f7b30['id'],'OpenchannelInteractionId':_0x3f9780['id'],'UserId':_0x384735['user']['id'],'ContactId':_0x5d22a4['id']}))['then'](function(_0x1ce635){_0x3f9780['dataValues'][_0x888c('0xb6')]=[];_0x3f9780['dataValues']['Messages']['push'](_0x1ce635[_0x888c('0xb7')]);return _0x3f9780;});});}})[_0x888c('0x32')](respondWithResult(_0x505bdb,null))[_0x888c('0x27')](handleError(_0x505bdb,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 95f129f..4c3c590 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 _0x449b=['save','update','remove','emit','hasOwnProperty','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x1fcda7,_0xdc5f3d){var _0x10ee2d=function(_0x28213a){while(--_0x28213a){_0x1fcda7['push'](_0x1fcda7['shift']());}};_0x10ee2d(++_0xdc5f3d);}(_0x449b,0x75));var _0xb449=function(_0x49d377,_0x3a3018){_0x49d377=_0x49d377-0x0;var _0x4efa93=_0x449b[_0x49d377];return _0x4efa93;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xb449('0x0'))['db'][_0xb449('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb449('0x2')](0x0);var events={'afterCreate':_0xb449('0x3'),'afterUpdate':_0xb449('0x4'),'afterDestroy':_0xb449('0x5')};function emitEvent(_0x4b0cd3){return function(_0x125fce,_0xc171e,_0x40013b){OpenchannelAccountEvents[_0xb449('0x6')](_0x4b0cd3+':'+_0x125fce['id'],_0x125fce);OpenchannelAccountEvents[_0xb449('0x6')](_0x4b0cd3,_0x125fce);_0x40013b(null);};}for(var e in events){if(events[_0xb449('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x72c9=['remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x24358b,_0x23394b){var _0x44515c=function(_0x3872a4){while(--_0x3872a4){_0x24358b['push'](_0x24358b['shift']());}};_0x44515c(++_0x23394b);}(_0x72c9,0xd3));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x972c('0x0'));var OpenchannelAccount=require(_0x972c('0x1'))['db'][_0x972c('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x972c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x972c('0x4'),'afterDestroy':_0x972c('0x5')};function emitEvent(_0x4b40ed){return function(_0x4218c1,_0x151a9b,_0x798618){OpenchannelAccountEvents[_0x972c('0x6')](_0x4b40ed+':'+_0x4218c1['id'],_0x4218c1);OpenchannelAccountEvents[_0x972c('0x6')](_0x4b40ed,_0x4218c1);_0x798618(null);};}for(var e in events){if(events[_0x972c('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 0e43c33..b4da869 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 _0x23f5=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount','lodash','util'];(function(_0x49ec20,_0x1e33ac){var _0x5f3080=function(_0x33635e){while(--_0x33635e){_0x49ec20['push'](_0x49ec20['shift']());}};_0x5f3080(++_0x1e33ac);}(_0x23f5,0x80));var _0x523f=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x23f5[_0x22b39b];return _0x280e1d;};'use strict';var _=require(_0x523f('0x0'));var util=require(_0x523f('0x1'));var logger=require(_0x523f('0x2'))('api');var moment=require(_0x523f('0x3'));var BPromise=require(_0x523f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x523f('0x5'));var config=require(_0x523f('0x6'));var attributes=require(_0x523f('0x7'));module[_0x523f('0x8')]=function(_0x4a4c7d,_0x1a1606){return _0x4a4c7d['define'](_0x523f('0x9'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd201=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xd201,0xc2));var _0x1d20=function(_0x1ed1d8,_0x384889){_0x1ed1d8=_0x1ed1d8-0x0;var _0x4f145d=_0xd201[_0x1ed1d8];return _0x4f145d;};'use strict';var _=require(_0x1d20('0x0'));var util=require(_0x1d20('0x1'));var logger=require(_0x1d20('0x2'))(_0x1d20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d20('0x4'));var fs=require('fs');var path=require(_0x1d20('0x5'));var rimraf=require(_0x1d20('0x6'));var config=require(_0x1d20('0x7'));var attributes=require(_0x1d20('0x8'));module[_0x1d20('0x9')]=function(_0x247657,_0x5b8354){return _0x247657[_0x1d20('0xa')](_0x1d20('0xb'),attributes,{'tableName':_0x1d20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 269da4f..337f7ed 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 _0xd723=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x352f1f,_0x2570bc){var _0x483122=function(_0x1191ef){while(--_0x1191ef){_0x352f1f['push'](_0x352f1f['shift']());}};_0x483122(++_0x2570bc);}(_0xd723,0x97));var _0x3d72=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd723[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x3d72('0x0'));var moment=require(_0x3d72('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d72('0x2'));var fs=require('fs');var Redis=require(_0x3d72('0x3'));var db=require(_0x3d72('0x4'))['db'];var utils=require(_0x3d72('0x5'));var logger=require(_0x3d72('0x6'))(_0x3d72('0x7'));var config=require(_0x3d72('0x8'));var jayson=require(_0x3d72('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3d72('0xa')]=_['defaults'](config[_0x3d72('0xa')],{'host':_0x3d72('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x3d72('0xc')](socket);function respondWithRpcPromise(_0x5e7b72,_0x22dbe4,_0x431a1e){return new BPromise(function(_0x543d95,_0x127008){return client[_0x3d72('0xd')](_0x5e7b72,_0x431a1e)[_0x3d72('0xe')](function(_0x2c718d){logger[_0x3d72('0xf')](_0x3d72('0x10'),_0x22dbe4,_0x3d72('0x11'));logger[_0x3d72('0x12')](_0x3d72('0x13'),_0x22dbe4,_0x3d72('0x11'),JSON['stringify'](_0x2c718d));if(_0x2c718d[_0x3d72('0x14')]){if(_0x2c718d['error'][_0x3d72('0x15')]===0x1f4){logger[_0x3d72('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x22dbe4,_0x2c718d[_0x3d72('0x14')][_0x3d72('0x16')]);return _0x127008(_0x2c718d[_0x3d72('0x14')][_0x3d72('0x16')]);}logger[_0x3d72('0x14')](_0x3d72('0x10'),_0x22dbe4,_0x2c718d[_0x3d72('0x14')][_0x3d72('0x16')]);return _0x543d95(_0x2c718d['error'][_0x3d72('0x16')]);}else{logger[_0x3d72('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x22dbe4,_0x3d72('0x11'));_0x543d95(_0x2c718d[_0x3d72('0x17')][_0x3d72('0x16')]);}})[_0x3d72('0x18')](function(_0x20c204){logger[_0x3d72('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x22dbe4,_0x20c204);_0x127008(_0x20c204);});});} \ No newline at end of file +var _0x8ecf=['../../config/environment','jayson/promise','client','redis','defaults','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x8ecf,0x99));var _0xf8ec=function(_0x316b38,_0x2d3774){_0x316b38=_0x316b38-0x0;var _0x53e2e3=_0x8ecf[_0x316b38];return _0x53e2e3;};'use strict';var _=require(_0xf8ec('0x0'));var util=require(_0xf8ec('0x1'));var moment=require(_0xf8ec('0x2'));var BPromise=require(_0xf8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8ec('0x4'));var db=require(_0xf8ec('0x5'))['db'];var utils=require(_0xf8ec('0x6'));var logger=require('../../config/logger')(_0xf8ec('0x7'));var config=require(_0xf8ec('0x8'));var jayson=require(_0xf8ec('0x9'));var client=jayson[_0xf8ec('0xa')]['http']({'port':0x232a});config[_0xf8ec('0xb')]=_[_0xf8ec('0xc')](config[_0xf8ec('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8ec('0xb')]));require(_0xf8ec('0xd'))['register'](socket);function respondWithRpcPromise(_0x1727d2,_0x3a6a35,_0x4eee06){return new BPromise(function(_0x224c78,_0xf41f2c){return client['request'](_0x1727d2,_0x4eee06)[_0xf8ec('0xe')](function(_0x4d621c){logger[_0xf8ec('0xf')](_0xf8ec('0x10'),_0x3a6a35,_0xf8ec('0x11'));logger['debug'](_0xf8ec('0x12'),_0x3a6a35,_0xf8ec('0x11'),JSON[_0xf8ec('0x13')](_0x4d621c));if(_0x4d621c[_0xf8ec('0x14')]){if(_0x4d621c[_0xf8ec('0x14')]['code']===0x1f4){logger[_0xf8ec('0x14')](_0xf8ec('0x10'),_0x3a6a35,_0x4d621c[_0xf8ec('0x14')][_0xf8ec('0x15')]);return _0xf41f2c(_0x4d621c[_0xf8ec('0x14')][_0xf8ec('0x15')]);}logger[_0xf8ec('0x14')](_0xf8ec('0x10'),_0x3a6a35,_0x4d621c['error'][_0xf8ec('0x15')]);return _0x224c78(_0x4d621c['error'][_0xf8ec('0x15')]);}else{logger[_0xf8ec('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x3a6a35,_0xf8ec('0x11'));_0x224c78(_0x4d621c['result'][_0xf8ec('0x15')]);}})[_0xf8ec('0x16')](function(_0x26ae5e){logger['error'](_0xf8ec('0x10'),_0x3a6a35,_0x26ae5e);_0xf41f2c(_0x26ae5e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 872f1a6..16ee7f0 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 _0x88cb=['save','remove','update','emit','register','length','openchannelAccount:'];(function(_0x299ac8,_0x1ae81d){var _0xd36727=function(_0x4b7d46){while(--_0x4b7d46){_0x299ac8['push'](_0x299ac8['shift']());}};_0xd36727(++_0x1ae81d);}(_0x88cb,0x93));var _0xb88c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x88cb[_0x1facfa];return _0x9ec701;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xb88c('0x0'),_0xb88c('0x1'),_0xb88c('0x2')];function createListener(_0x358b46,_0x323c71){return function(_0x56b8cc){_0x323c71[_0xb88c('0x3')](_0x358b46,_0x56b8cc);};}function removeListener(_0x555feb,_0x299f09){return function(){OpenchannelAccountEvents['removeListener'](_0x555feb,_0x299f09);};}exports[_0xb88c('0x4')]=function(_0x1cf274){for(var _0x568f95=0x0,_0x14504c=events[_0xb88c('0x5')];_0x568f95<_0x14504c;_0x568f95++){var _0x3552d1=events[_0x568f95];var _0x1818ec=createListener(_0xb88c('0x6')+_0x3552d1,_0x1cf274);OpenchannelAccountEvents['on'](_0x3552d1,_0x1818ec);}}; \ No newline at end of file +var _0x802f=['removeListener','length','openchannelAccount:','./openchannelAccount.events','emit'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x802f,0x1b1));var _0xf802=function(_0x3de187,_0x1ddeee){_0x3de187=_0x3de187-0x0;var _0x507def=_0x802f[_0x3de187];return _0x507def;};'use strict';var OpenchannelAccountEvents=require(_0xf802('0x0'));var events=['save','remove','update'];function createListener(_0x3df158,_0x1ef328){return function(_0x182d23){_0x1ef328[_0xf802('0x1')](_0x3df158,_0x182d23);};}function removeListener(_0x399649,_0xef7167){return function(){OpenchannelAccountEvents[_0xf802('0x2')](_0x399649,_0xef7167);};}exports['register']=function(_0x3e2e89){for(var _0x249bdc=0x0,_0xf1312b=events[_0xf802('0x3')];_0x249bdc<_0xf1312b;_0x249bdc++){var _0x273714=events[_0x249bdc];var _0x1644ca=createListener(_0xf802('0x4')+_0x273714,_0x3e2e89);OpenchannelAccountEvents['on'](_0x273714,_0x1644ca);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b15e25d..6ba7db2 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 _0x337d=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x4a3b5e,_0x58c2e5){var _0x273a1b=function(_0x17318a){while(--_0x17318a){_0x4a3b5e['push'](_0x4a3b5e['shift']());}};_0x273a1b(++_0x58c2e5);}(_0x337d,0x1d0));var _0xd337=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x337d[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd337('0x0'));var timeout=require(_0xd337('0x1'));var express=require('express');var router=express[_0xd337('0x2')]();var auth=require(_0xd337('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd337('0x4'));var controller=require(_0xd337('0x5'));router[_0xd337('0x6')]('/',auth[_0xd337('0x7')](),controller[_0xd337('0x8')]);router[_0xd337('0x6')](_0xd337('0x9'),auth['isAuthenticated'](),controller[_0xd337('0xa')]);router[_0xd337('0xb')]('/',auth[_0xd337('0x7')](),controller['create']);router[_0xd337('0xc')](_0xd337('0x9'),auth[_0xd337('0x7')](),controller[_0xd337('0xd')]);router[_0xd337('0xe')](_0xd337('0x9'),auth[_0xd337('0x7')](),controller[_0xd337('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9cff=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','destroy','exports','multer','util','path'];(function(_0x2503aa,_0x4ea0db){var _0x44f5e2=function(_0x49ca0d){while(--_0x49ca0d){_0x2503aa['push'](_0x2503aa['shift']());}};_0x44f5e2(++_0x4ea0db);}(_0x9cff,0x165));var _0xf9cf=function(_0x5f4ae5,_0x4e70f1){_0x5f4ae5=_0x5f4ae5-0x0;var _0x98b3fc=_0x9cff[_0x5f4ae5];return _0x98b3fc;};'use strict';var multer=require(_0xf9cf('0x0'));var util=require(_0xf9cf('0x1'));var path=require(_0xf9cf('0x2'));var timeout=require('connect-timeout');var express=require(_0xf9cf('0x3'));var router=express[_0xf9cf('0x4')]();var auth=require(_0xf9cf('0x5'));var interaction=require(_0xf9cf('0x6'));var config=require(_0xf9cf('0x7'));var controller=require('./openchannelApplication.controller');router[_0xf9cf('0x8')]('/',auth[_0xf9cf('0x9')](),controller['index']);router['get'](_0xf9cf('0xa'),auth['isAuthenticated'](),controller[_0xf9cf('0xb')]);router[_0xf9cf('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf9cf('0xa'),auth[_0xf9cf('0x9')](),controller['update']);router['delete'](_0xf9cf('0xa'),auth['isAuthenticated'](),controller[_0xf9cf('0xd')]);module[_0xf9cf('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index fe41b1a..68e1c56 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 _0xfe96=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3c5dfe,_0x43de71){var _0x22a3f3=function(_0x2ef7e6){while(--_0x2ef7e6){_0x3c5dfe['push'](_0x3c5dfe['shift']());}};_0x22a3f3(++_0x43de71);}(_0xfe96,0x8a));var _0x6fe9=function(_0x353552,_0x205fca){_0x353552=_0x353552-0x0;var _0x4a4556=_0xfe96[_0x353552];return _0x4a4556;};'use strict';var Sequelize=require(_0x6fe9('0x0'));module[_0x6fe9('0x1')]={'priority':{'type':Sequelize[_0x6fe9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6fe9('0x3')],'allowNull':![],'defaultValue':_0x6fe9('0x4')},'appdata':{'type':Sequelize[_0x6fe9('0x5')]()},'description':{'type':Sequelize[_0x6fe9('0x3')]},'interval':{'type':Sequelize[_0x6fe9('0x3')],'defaultValue':_0x6fe9('0x6')}}; \ No newline at end of file +var _0xc298=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x44f630,_0xcdd7f8){var _0x3633ef=function(_0x19d9d4){while(--_0x19d9d4){_0x44f630['push'](_0x44f630['shift']());}};_0x3633ef(++_0xcdd7f8);}(_0xc298,0x1eb));var _0x8c29=function(_0xe1a7a7,_0x23e67e){_0xe1a7a7=_0xe1a7a7-0x0;var _0x582b1e=_0xc298[_0xe1a7a7];return _0x582b1e;};'use strict';var Sequelize=require(_0x8c29('0x0'));module[_0x8c29('0x1')]={'priority':{'type':Sequelize[_0x8c29('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c29('0x3')],'allowNull':![],'defaultValue':_0x8c29('0x4')},'appdata':{'type':Sequelize[_0x8c29('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8c29('0x3')],'defaultValue':_0x8c29('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 73d5f77..bc2943b 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 _0xf82f=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','OpenchannelApplication','includeAll','findAll','rows','catch','show','params','include','options','find','body','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','count','offset','json','apply','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0xf82f,0x12e));var _0xff82=function(_0x19e005,_0x198a94){_0x19e005=_0x19e005-0x0;var _0x25276b=_0xf82f[_0x19e005];return _0x25276b;};'use strict';var pdf=require(_0xff82('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff82('0x1'));var rp=require(_0xff82('0x2'));var moment=require(_0xff82('0x3'));var BPromise=require(_0xff82('0x4'));var Mustache=require(_0xff82('0x5'));var util=require(_0xff82('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xff82('0x7'));var ejs=require(_0xff82('0x8'));var fs=require('fs');var _=require(_0xff82('0x9'));var squel=require(_0xff82('0xa'));var crypto=require(_0xff82('0xb'));var jsforce=require(_0xff82('0xc'));var deskjs=require(_0xff82('0xd'));var toCsv=require(_0xff82('0x7'));var querystring=require('querystring');var Papa=require(_0xff82('0xe'));var Redis=require(_0xff82('0xf'));var authService=require(_0xff82('0x10'));var qs=require(_0xff82('0x11'));var as=require(_0xff82('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff82('0x13'));var utils=require(_0xff82('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad14c,_0x4fcd5e){_0x4fcd5e=_0x4fcd5e||0xcc;return function(_0x4f9fc0){if(_0x4f9fc0){return _0x2ad14c[_0xff82('0x15')](_0x4fcd5e);}return _0x2ad14c[_0xff82('0x16')](_0x4fcd5e)[_0xff82('0x17')]();};}function respondWithResult(_0x2f8c45,_0x159614){_0x159614=_0x159614||0xc8;return function(_0x67a174){if(_0x67a174){return _0x2f8c45['status'](_0x159614)['json'](_0x67a174);}};}function respondWithFilteredResult(_0x41f8ff,_0xa7e2cc){return function(_0x4709a5){if(_0x4709a5){var _0xaaca99=_0x4709a5[_0xff82('0x18')],_0x214a03=_0xa7e2cc[_0xff82('0x19')],_0x548e7d=_0xa7e2cc['offset']+_0xa7e2cc['limit'],_0x2061b4;if(_0x548e7d>=_0xaaca99){_0x548e7d=_0xaaca99;_0x2061b4=0xc8;}else{_0x2061b4=0xce;}_0x41f8ff[_0xff82('0x16')](_0x2061b4);return _0x41f8ff['set']('Content-Range',_0x214a03+'-'+_0x548e7d+'/'+_0xaaca99)[_0xff82('0x1a')](_0x4709a5);}return null;};}function patchUpdates(_0x59d8b1){return function(_0x1b6839){try{jsonpatch[_0xff82('0x1b')](_0x1b6839,_0x59d8b1,!![]);}catch(_0x2b49c1){return BPromise['reject'](_0x2b49c1);}return _0x1b6839['save']();};}function saveUpdates(_0x3f9985,_0x437b52){return function(_0x50585d){if(_0x50585d){return _0x50585d[_0xff82('0x1c')](_0x3f9985)['then'](function(_0x1e0cb2){return _0x1e0cb2;});}return null;};}function removeEntity(_0x1309f4,_0x59e366){return function(_0x26aca7){if(_0x26aca7){return _0x26aca7[_0xff82('0x1d')]()[_0xff82('0x1e')](function(){_0x1309f4[_0xff82('0x16')](0xcc)[_0xff82('0x17')]();});}};}function handleEntityNotFound(_0xb34f61,_0x159c51){return function(_0x40d5db){if(!_0x40d5db){_0xb34f61[_0xff82('0x15')](0x194);}return _0x40d5db;};}function handleError(_0x6f7bda,_0x4fa897){_0x4fa897=_0x4fa897||0x1f4;return function(_0x575c90){logger[_0xff82('0x1f')](_0x575c90[_0xff82('0x20')]);if(_0x575c90[_0xff82('0x21')]){delete _0x575c90[_0xff82('0x21')];}_0x6f7bda[_0xff82('0x16')](_0x4fa897)[_0xff82('0x22')](_0x575c90);};}exports[_0xff82('0x23')]=function(_0xb54be7,_0x223816){var _0x4a675a={},_0x5ef73c={},_0x192c37={'count':0x0,'rows':[]};var _0x45ddcf=_['map'](db['OpenchannelApplication'][_0xff82('0x24')],function(_0x3956a1){return{'name':_0x3956a1[_0xff82('0x25')],'type':_0x3956a1[_0xff82('0x26')][_0xff82('0x27')]};});_0x5ef73c[_0xff82('0x28')]=_[_0xff82('0x29')](_0x45ddcf,_0xff82('0x21'));_0x5ef73c[_0xff82('0x2a')]=_[_0xff82('0x2b')](_0xb54be7[_0xff82('0x2a')]);_0x5ef73c[_0xff82('0x2c')]=_[_0xff82('0x2d')](_0x5ef73c[_0xff82('0x28')],_0x5ef73c[_0xff82('0x2a')]);_0x4a675a[_0xff82('0x2e')]=_['intersection'](_0x5ef73c[_0xff82('0x28')],qs[_0xff82('0x2f')](_0xb54be7[_0xff82('0x2a')]['fields']));_0x4a675a[_0xff82('0x2e')]=_0x4a675a[_0xff82('0x2e')][_0xff82('0x30')]?_0x4a675a['attributes']:_0x5ef73c[_0xff82('0x28')];if(!_0xb54be7[_0xff82('0x2a')][_0xff82('0x31')](_0xff82('0x32'))){_0x4a675a[_0xff82('0x33')]=qs[_0xff82('0x33')](_0xb54be7[_0xff82('0x2a')][_0xff82('0x33')]);_0x4a675a[_0xff82('0x19')]=qs[_0xff82('0x19')](_0xb54be7[_0xff82('0x2a')][_0xff82('0x19')]);}_0x4a675a['order']=qs[_0xff82('0x34')](_0xb54be7[_0xff82('0x2a')][_0xff82('0x34')]);_0x4a675a['where']=qs[_0xff82('0x2c')](_['pick'](_0xb54be7[_0xff82('0x2a')],_0x5ef73c[_0xff82('0x2c')]),_0x45ddcf);if(_0xb54be7[_0xff82('0x2a')][_0xff82('0x35')]){_0x4a675a[_0xff82('0x36')]=_[_0xff82('0x37')](_0x4a675a[_0xff82('0x36')],{'$or':_[_0xff82('0x29')](_0x45ddcf,function(_0x778da6){if(_0x778da6[_0xff82('0x26')]!==_0xff82('0x38')){var _0x31c14f={};_0x31c14f[_0x778da6[_0xff82('0x21')]]={'$like':'%'+_0xb54be7[_0xff82('0x2a')][_0xff82('0x35')]+'%'};return _0x31c14f;}})});}_0x4a675a=_[_0xff82('0x37')]({},_0x4a675a,_0xb54be7['options']);var _0x38d67d={'where':_0x4a675a[_0xff82('0x36')]};return db[_0xff82('0x39')]['count'](_0x38d67d)[_0xff82('0x1e')](function(_0x1bf4fe){_0x192c37['count']=_0x1bf4fe;if(_0xb54be7[_0xff82('0x2a')][_0xff82('0x3a')]){_0x4a675a['include']=[{'all':!![]}];}return db[_0xff82('0x39')][_0xff82('0x3b')](_0x4a675a);})['then'](function(_0x2284b8){_0x192c37[_0xff82('0x3c')]=_0x2284b8;return _0x192c37;})[_0xff82('0x1e')](respondWithFilteredResult(_0x223816,_0x4a675a))[_0xff82('0x3d')](handleError(_0x223816,null));};exports[_0xff82('0x3e')]=function(_0x342844,_0x31ce06){var _0x176ee7={'raw':!![],'where':{'id':_0x342844[_0xff82('0x3f')]['id']}},_0x417ec5={};_0x417ec5[_0xff82('0x28')]=_['keys'](db[_0xff82('0x39')][_0xff82('0x24')]);_0x417ec5[_0xff82('0x2a')]=_[_0xff82('0x2b')](_0x342844[_0xff82('0x2a')]);_0x417ec5[_0xff82('0x2c')]=_[_0xff82('0x2d')](_0x417ec5[_0xff82('0x28')],_0x417ec5[_0xff82('0x2a')]);_0x176ee7[_0xff82('0x2e')]=_[_0xff82('0x2d')](_0x417ec5['model'],qs[_0xff82('0x2f')](_0x342844[_0xff82('0x2a')][_0xff82('0x2f')]));_0x176ee7['attributes']=_0x176ee7[_0xff82('0x2e')]['length']?_0x176ee7['attributes']:_0x417ec5[_0xff82('0x28')];if(_0x342844['query'][_0xff82('0x3a')]){_0x176ee7[_0xff82('0x40')]=[{'all':!![]}];}_0x176ee7=_[_0xff82('0x37')]({},_0x176ee7,_0x342844[_0xff82('0x41')]);return db[_0xff82('0x39')][_0xff82('0x42')](_0x176ee7)['then'](handleEntityNotFound(_0x31ce06,null))[_0xff82('0x1e')](respondWithResult(_0x31ce06,null))['catch'](handleError(_0x31ce06,null));};exports['create']=function(_0x3b79ad,_0x170ea3){return db['OpenchannelApplication']['create'](_0x3b79ad[_0xff82('0x43')],{})[_0xff82('0x1e')](respondWithResult(_0x170ea3,0xc9))[_0xff82('0x3d')](handleError(_0x170ea3,null));};exports['update']=function(_0x378d44,_0x50b447){if(_0x378d44[_0xff82('0x43')]['id']){delete _0x378d44[_0xff82('0x43')]['id'];}return db[_0xff82('0x39')][_0xff82('0x42')]({'where':{'id':_0x378d44['params']['id']}})['then'](handleEntityNotFound(_0x50b447,null))[_0xff82('0x1e')](saveUpdates(_0x378d44['body'],null))[_0xff82('0x1e')](respondWithResult(_0x50b447,null))[_0xff82('0x3d')](handleError(_0x50b447,null));};exports[_0xff82('0x1d')]=function(_0x4cb8a8,_0x3bef59){return db['OpenchannelApplication'][_0xff82('0x42')]({'where':{'id':_0x4cb8a8[_0xff82('0x3f')]['id']}})[_0xff82('0x1e')](handleEntityNotFound(_0x3bef59,null))[_0xff82('0x1e')](removeEntity(_0x3bef59,null))[_0xff82('0x3d')](handleError(_0x3bef59,null));}; \ No newline at end of file +var _0x90ed=['filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','destroy','error','stack','send','index','OpenchannelApplication','rawAttributes','key','map','name','query','keys'];(function(_0x5d32b9,_0x101d65){var _0x545d5a=function(_0x28f61e){while(--_0x28f61e){_0x5d32b9['push'](_0x5d32b9['shift']());}};_0x545d5a(++_0x101d65);}(_0x90ed,0x13a));var _0xd90e=function(_0x19ad3b,_0x34c323){_0x19ad3b=_0x19ad3b-0x0;var _0x4937dd=_0x90ed[_0x19ad3b];return _0x4937dd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd90e('0x0'));var zipdir=require(_0xd90e('0x1'));var jsonpatch=require(_0xd90e('0x2'));var rp=require(_0xd90e('0x3'));var moment=require(_0xd90e('0x4'));var BPromise=require(_0xd90e('0x5'));var Mustache=require(_0xd90e('0x6'));var util=require('util');var path=require(_0xd90e('0x7'));var sox=require(_0xd90e('0x8'));var csv=require(_0xd90e('0x9'));var ejs=require(_0xd90e('0xa'));var fs=require('fs');var _=require(_0xd90e('0xb'));var squel=require(_0xd90e('0xc'));var crypto=require(_0xd90e('0xd'));var jsforce=require(_0xd90e('0xe'));var deskjs=require(_0xd90e('0xf'));var toCsv=require(_0xd90e('0x9'));var querystring=require(_0xd90e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd90e('0x11'));var authService=require(_0xd90e('0x12'));var qs=require(_0xd90e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd90e('0x14'));var logger=require('../../config/logger')(_0xd90e('0x15'));var utils=require('../../config/utils');var config=require(_0xd90e('0x16'));var db=require(_0xd90e('0x17'))['db'];function respondWithStatusCode(_0x40a91d,_0x25de41){_0x25de41=_0x25de41||0xcc;return function(_0x1eb007){if(_0x1eb007){return _0x40a91d[_0xd90e('0x18')](_0x25de41);}return _0x40a91d[_0xd90e('0x19')](_0x25de41)['end']();};}function respondWithResult(_0x4d3407,_0x45af4e){_0x45af4e=_0x45af4e||0xc8;return function(_0x21242b){if(_0x21242b){return _0x4d3407[_0xd90e('0x19')](_0x45af4e)[_0xd90e('0x1a')](_0x21242b);}};}function respondWithFilteredResult(_0x17093a,_0x3f17a6){return function(_0x3e5315){if(_0x3e5315){var _0x107952=_0x3e5315[_0xd90e('0x1b')],_0x2b568e=_0x3f17a6[_0xd90e('0x1c')],_0x378bbe=_0x3f17a6[_0xd90e('0x1c')]+_0x3f17a6[_0xd90e('0x1d')],_0x5b6387;if(_0x378bbe>=_0x107952){_0x378bbe=_0x107952;_0x5b6387=0xc8;}else{_0x5b6387=0xce;}_0x17093a[_0xd90e('0x19')](_0x5b6387);return _0x17093a[_0xd90e('0x1e')]('Content-Range',_0x2b568e+'-'+_0x378bbe+'/'+_0x107952)[_0xd90e('0x1a')](_0x3e5315);}return null;};}function patchUpdates(_0x28558f){return function(_0x2c24ad){try{jsonpatch['apply'](_0x2c24ad,_0x28558f,!![]);}catch(_0x11f137){return BPromise[_0xd90e('0x1f')](_0x11f137);}return _0x2c24ad['save']();};}function saveUpdates(_0x5a9326,_0x58edf1){return function(_0x4e4063){if(_0x4e4063){return _0x4e4063[_0xd90e('0x20')](_0x5a9326)[_0xd90e('0x21')](function(_0x90e81b){return _0x90e81b;});}return null;};}function removeEntity(_0x60063e,_0x4bc826){return function(_0x16658c){if(_0x16658c){return _0x16658c[_0xd90e('0x22')]()[_0xd90e('0x21')](function(){_0x60063e[_0xd90e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277cd9,_0x58c068){return function(_0x21b247){if(!_0x21b247){_0x277cd9[_0xd90e('0x18')](0x194);}return _0x21b247;};}function handleError(_0x52cb2b,_0x1142b5){_0x1142b5=_0x1142b5||0x1f4;return function(_0x113a25){logger[_0xd90e('0x23')](_0x113a25[_0xd90e('0x24')]);if(_0x113a25['name']){delete _0x113a25['name'];}_0x52cb2b['status'](_0x1142b5)[_0xd90e('0x25')](_0x113a25);};}exports[_0xd90e('0x26')]=function(_0x4b5333,_0x3c8ac7){var _0x5d68f4={},_0x1be955={},_0x5881d2={'count':0x0,'rows':[]};var _0x2313ee=_['map'](db[_0xd90e('0x27')][_0xd90e('0x28')],function(_0x153b7e){return{'name':_0x153b7e['fieldName'],'type':_0x153b7e['type'][_0xd90e('0x29')]};});_0x1be955['model']=_[_0xd90e('0x2a')](_0x2313ee,_0xd90e('0x2b'));_0x1be955[_0xd90e('0x2c')]=_[_0xd90e('0x2d')](_0x4b5333[_0xd90e('0x2c')]);_0x1be955[_0xd90e('0x2e')]=_[_0xd90e('0x2f')](_0x1be955['model'],_0x1be955[_0xd90e('0x2c')]);_0x5d68f4[_0xd90e('0x30')]=_['intersection'](_0x1be955[_0xd90e('0x31')],qs['fields'](_0x4b5333[_0xd90e('0x2c')]['fields']));_0x5d68f4[_0xd90e('0x30')]=_0x5d68f4['attributes']['length']?_0x5d68f4[_0xd90e('0x30')]:_0x1be955[_0xd90e('0x31')];if(!_0x4b5333['query'][_0xd90e('0x32')](_0xd90e('0x33'))){_0x5d68f4[_0xd90e('0x1d')]=qs[_0xd90e('0x1d')](_0x4b5333[_0xd90e('0x2c')][_0xd90e('0x1d')]);_0x5d68f4[_0xd90e('0x1c')]=qs['offset'](_0x4b5333['query'][_0xd90e('0x1c')]);}_0x5d68f4[_0xd90e('0x34')]=qs[_0xd90e('0x35')](_0x4b5333[_0xd90e('0x2c')]['sort']);_0x5d68f4[_0xd90e('0x36')]=qs[_0xd90e('0x2e')](_[_0xd90e('0x37')](_0x4b5333[_0xd90e('0x2c')],_0x1be955[_0xd90e('0x2e')]),_0x2313ee);if(_0x4b5333[_0xd90e('0x2c')][_0xd90e('0x38')]){_0x5d68f4['where']=_[_0xd90e('0x39')](_0x5d68f4[_0xd90e('0x36')],{'$or':_[_0xd90e('0x2a')](_0x2313ee,function(_0x2b8200){if(_0x2b8200[_0xd90e('0x3a')]!==_0xd90e('0x3b')){var _0x1db021={};_0x1db021[_0x2b8200[_0xd90e('0x2b')]]={'$like':'%'+_0x4b5333[_0xd90e('0x2c')][_0xd90e('0x38')]+'%'};return _0x1db021;}})});}_0x5d68f4=_[_0xd90e('0x39')]({},_0x5d68f4,_0x4b5333['options']);var _0x29b49e={'where':_0x5d68f4[_0xd90e('0x36')]};return db[_0xd90e('0x27')][_0xd90e('0x1b')](_0x29b49e)['then'](function(_0x165fdf){_0x5881d2[_0xd90e('0x1b')]=_0x165fdf;if(_0x4b5333[_0xd90e('0x2c')][_0xd90e('0x3c')]){_0x5d68f4[_0xd90e('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xd90e('0x3e')](_0x5d68f4);})['then'](function(_0x9d5ab4){_0x5881d2[_0xd90e('0x3f')]=_0x9d5ab4;return _0x5881d2;})['then'](respondWithFilteredResult(_0x3c8ac7,_0x5d68f4))[_0xd90e('0x40')](handleError(_0x3c8ac7,null));};exports[_0xd90e('0x41')]=function(_0x11b259,_0x16a8fa){var _0x212e3e={'raw':!![],'where':{'id':_0x11b259[_0xd90e('0x42')]['id']}},_0x13b819={};_0x13b819[_0xd90e('0x31')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x13b819[_0xd90e('0x2c')]=_[_0xd90e('0x2d')](_0x11b259[_0xd90e('0x2c')]);_0x13b819['filters']=_[_0xd90e('0x2f')](_0x13b819[_0xd90e('0x31')],_0x13b819[_0xd90e('0x2c')]);_0x212e3e[_0xd90e('0x30')]=_['intersection'](_0x13b819[_0xd90e('0x31')],qs[_0xd90e('0x43')](_0x11b259[_0xd90e('0x2c')][_0xd90e('0x43')]));_0x212e3e['attributes']=_0x212e3e[_0xd90e('0x30')]['length']?_0x212e3e[_0xd90e('0x30')]:_0x13b819['model'];if(_0x11b259[_0xd90e('0x2c')][_0xd90e('0x3c')]){_0x212e3e[_0xd90e('0x3d')]=[{'all':!![]}];}_0x212e3e=_[_0xd90e('0x39')]({},_0x212e3e,_0x11b259[_0xd90e('0x44')]);return db['OpenchannelApplication'][_0xd90e('0x45')](_0x212e3e)[_0xd90e('0x21')](handleEntityNotFound(_0x16a8fa,null))[_0xd90e('0x21')](respondWithResult(_0x16a8fa,null))['catch'](handleError(_0x16a8fa,null));};exports[_0xd90e('0x46')]=function(_0x28ab75,_0x12cd3e){return db[_0xd90e('0x27')][_0xd90e('0x46')](_0x28ab75[_0xd90e('0x47')],{})[_0xd90e('0x21')](respondWithResult(_0x12cd3e,0xc9))[_0xd90e('0x40')](handleError(_0x12cd3e,null));};exports[_0xd90e('0x20')]=function(_0xc4c4af,_0x45b5fc){if(_0xc4c4af['body']['id']){delete _0xc4c4af[_0xd90e('0x47')]['id'];}return db[_0xd90e('0x27')][_0xd90e('0x45')]({'where':{'id':_0xc4c4af[_0xd90e('0x42')]['id']}})[_0xd90e('0x21')](handleEntityNotFound(_0x45b5fc,null))[_0xd90e('0x21')](saveUpdates(_0xc4c4af[_0xd90e('0x47')],null))['then'](respondWithResult(_0x45b5fc,null))[_0xd90e('0x40')](handleError(_0x45b5fc,null));};exports[_0xd90e('0x22')]=function(_0x759c01,_0x4172a7){return db[_0xd90e('0x27')][_0xd90e('0x45')]({'where':{'id':_0x759c01[_0xd90e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4172a7,null))['then'](removeEntity(_0x4172a7,null))[_0xd90e('0x40')](handleError(_0x4172a7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d81b52a..370080d 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 _0xb517=['../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xb517,0x1d3));var _0x7b51=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xb517[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b51('0x0'))(_0x7b51('0x1'));var moment=require('moment');var BPromise=require(_0x7b51('0x2'));var rp=require(_0x7b51('0x3'));var fs=require('fs');var path=require(_0x7b51('0x4'));var rimraf=require(_0x7b51('0x5'));var config=require(_0x7b51('0x6'));var attributes=require(_0x7b51('0x7'));module['exports']=function(_0x34265e,_0x294a97){return _0x34265e[_0x7b51('0x8')](_0x7b51('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b51('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x20b4=['./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0x20b4,0xeb));var _0x420b=function(_0x4fedd4,_0x1dbf05){_0x4fedd4=_0x4fedd4-0x0;var _0x5dce0d=_0x20b4[_0x4fedd4];return _0x5dce0d;};'use strict';var _=require('lodash');var util=require(_0x420b('0x0'));var logger=require('../../config/logger')(_0x420b('0x1'));var moment=require(_0x420b('0x2'));var BPromise=require(_0x420b('0x3'));var rp=require(_0x420b('0x4'));var fs=require('fs');var path=require(_0x420b('0x5'));var rimraf=require('rimraf');var config=require(_0x420b('0x6'));var attributes=require(_0x420b('0x7'));module[_0x420b('0x8')]=function(_0x58252f,_0x232a7c){return _0x58252f['define']('OpenchannelApplication',attributes,{'tableName':_0x420b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x420b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index adcee15..adcfa87 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x41eb44,_0x229d85){var _0x334ba7=function(_0x4b442f){while(--_0x4b442f){_0x41eb44['push'](_0x41eb44['shift']());}};_0x334ba7(++_0x229d85);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f6b61,_0x14cc4d){_0x4f6b61=_0x4f6b61-0x0;var _0x281cd0=_0x5f2f[_0x4f6b61];return _0x281cd0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x13e614,_0x11dcf6){var _0x822d50=function(_0x1e84c3){while(--_0x1e84c3){_0x13e614['push'](_0x13e614['shift']());}};_0x822d50(++_0x11dcf6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cbbe7,_0x14df5e){_0x3cbbe7=_0x3cbbe7-0x0;var _0x11503d=_0xb10b[_0x3cbbe7];return _0x11503d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1a2e032..f206d22 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 _0x3c6a=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','update','openchannelinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2ca3b4,_0x3583de){var _0x14d3c0=function(_0x17462d){while(--_0x17462d){_0x2ca3b4['push'](_0x2ca3b4['shift']());}};_0x14d3c0(++_0x3583de);}(_0x3c6a,0x155));var _0xa3c6=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x3c6a[_0x3a13cf];return _0x4817c;};'use strict';var multer=require(_0xa3c6('0x0'));var util=require(_0xa3c6('0x1'));var path=require(_0xa3c6('0x2'));var timeout=require(_0xa3c6('0x3'));var express=require(_0xa3c6('0x4'));var router=express[_0xa3c6('0x5')]();var auth=require(_0xa3c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xa3c6('0x7')]('/',auth[_0xa3c6('0x8')](),controller[_0xa3c6('0x9')]);router['get'](_0xa3c6('0xa'),auth[_0xa3c6('0x8')](),controller[_0xa3c6('0xb')]);router[_0xa3c6('0x7')](_0xa3c6('0xc'),auth[_0xa3c6('0x8')](),controller[_0xa3c6('0xd')]);router[_0xa3c6('0x7')](_0xa3c6('0xe'),auth[_0xa3c6('0x8')](),controller[_0xa3c6('0xf')]);router[_0xa3c6('0x7')](_0xa3c6('0x10'),auth[_0xa3c6('0x8')](),controller[_0xa3c6('0x11')]);router[_0xa3c6('0x12')]('/',auth[_0xa3c6('0x8')](),controller[_0xa3c6('0x13')]);router[_0xa3c6('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xa3c6('0x14')]);router[_0xa3c6('0x12')](_0xa3c6('0x15'),auth[_0xa3c6('0x8')](),interaction[_0xa3c6('0x16')](_0xa3c6('0x17'),'openchannelinteraction:addtags'),controller['addTags']);router['put'](_0xa3c6('0xc'),auth[_0xa3c6('0x8')](),interaction[_0xa3c6('0x16')]('openchannel','openchannelinteraction:update'),controller[_0xa3c6('0x18')]);router['delete'](_0xa3c6('0xc'),auth[_0xa3c6('0x8')](),interaction[_0xa3c6('0x16')](_0xa3c6('0x17'),_0xa3c6('0x19')),controller[_0xa3c6('0x1a')]);router[_0xa3c6('0x1b')](_0xa3c6('0x15'),auth['isAuthenticated'](),controller[_0xa3c6('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3072=['create','addMessage','/:id/tags','openchannel','put','tracked','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post'];(function(_0x24029d,_0x11cc07){var _0x474387=function(_0x408c8c){while(--_0x408c8c){_0x24029d['push'](_0x24029d['shift']());}};_0x474387(++_0x11cc07);}(_0x3072,0x7e));var _0x2307=function(_0x339c74,_0x39dda7){_0x339c74=_0x339c74-0x0;var _0x592097=_0x3072[_0x339c74];return _0x592097;};'use strict';var multer=require(_0x2307('0x0'));var util=require(_0x2307('0x1'));var path=require(_0x2307('0x2'));var timeout=require(_0x2307('0x3'));var express=require(_0x2307('0x4'));var router=express[_0x2307('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2307('0x6'));var config=require(_0x2307('0x7'));var controller=require(_0x2307('0x8'));router[_0x2307('0x9')]('/',auth['isAuthenticated'](),controller[_0x2307('0xa')]);router[_0x2307('0x9')](_0x2307('0xb'),auth[_0x2307('0xc')](),controller[_0x2307('0xd')]);router[_0x2307('0x9')](_0x2307('0xe'),auth[_0x2307('0xc')](),controller[_0x2307('0xf')]);router[_0x2307('0x9')](_0x2307('0x10'),auth[_0x2307('0xc')](),controller['getMessages']);router[_0x2307('0x9')](_0x2307('0x11'),auth[_0x2307('0xc')](),controller['download']);router[_0x2307('0x12')]('/',auth[_0x2307('0xc')](),controller[_0x2307('0x13')]);router[_0x2307('0x12')]('/:id/messages',auth[_0x2307('0xc')](),controller[_0x2307('0x14')]);router[_0x2307('0x12')](_0x2307('0x15'),auth[_0x2307('0xc')](),interaction['tracked'](_0x2307('0x16'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x2307('0x17')](_0x2307('0xe'),auth[_0x2307('0xc')](),interaction[_0x2307('0x18')]('openchannel','openchannelinteraction:update'),controller[_0x2307('0x19')]);router[_0x2307('0x1a')](_0x2307('0xe'),auth[_0x2307('0xc')](),interaction[_0x2307('0x18')](_0x2307('0x16'),'openchannelinteraction:destroy'),controller[_0x2307('0x1b')]);router[_0x2307('0x1a')](_0x2307('0x15'),auth['isAuthenticated'](),controller[_0x2307('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ef19c06..845a1fb 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 _0xd272=['ENUM','out','DATE','STRING'];(function(_0xc371bf,_0x17c644){var _0x50068d=function(_0xcb7e6b){while(--_0xcb7e6b){_0xc371bf['push'](_0xc371bf['shift']());}};_0x50068d(++_0x17c644);}(_0xd272,0x15e));var _0x2d27=function(_0x5ba569,_0x386324){_0x5ba569=_0x5ba569-0x0;var _0x93e094=_0xd272[_0x5ba569];return _0x93e094;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2d27('0x0')]},'disposition':{'type':Sequelize[_0x2d27('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2d27('0x0')]},'threadId':{'type':Sequelize[_0x2d27('0x1')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x2d27('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x2d27('0x2')]('in',_0x2d27('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd11b=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x112424,_0x2bdade){var _0x3d7160=function(_0x5a4e93){while(--_0x5a4e93){_0x112424['push'](_0x112424['shift']());}};_0x3d7160(++_0x2bdade);}(_0xd11b,0x125));var _0xbd11=function(_0x1ca047,_0x1e5ada){_0x1ca047=_0x1ca047-0x0;var _0x256a03=_0xd11b[_0x1ca047];return _0x256a03;};'use strict';var Sequelize=require(_0xbd11('0x0'));module[_0xbd11('0x1')]={'closed':{'type':Sequelize[_0xbd11('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbd11('0x3')]},'read1stAt':{'type':Sequelize[_0xbd11('0x4')]},'threadId':{'type':Sequelize[_0xbd11('0x3')]},'externalUrl':{'type':Sequelize[_0xbd11('0x3')]},'lastMsgAt':{'type':Sequelize[_0xbd11('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xbd11('0x5')]('in',_0xbd11('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbd11('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ccf21eb..7e91a9f 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 _0x64e6=['../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','count','offset','set','json','apply','reject','update','then','destroy','error','name','send','Users','split','forEach','Tags','TagIds','catch','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','buildExpression','text','start','body','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','show','params','includeAll','include','merge','create','describe','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','fullname','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','\x0a\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','Openchannel','N.A.','closed','Public','Private','Messages','basename','existsSync','createWriteStream','out','System','renderFile','downloadInteraction.html','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1630f8,_0x438cb6){var _0x5381a3=function(_0x1382ad){while(--_0x1382ad){_0x1630f8['push'](_0x1630f8['shift']());}};_0x5381a3(++_0x438cb6);}(_0x64e6,0xcd));var _0x664e=function(_0x4d2cb3,_0x37ae86){_0x4d2cb3=_0x4d2cb3-0x0;var _0x452695=_0x64e6[_0x4d2cb3];return _0x452695;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x664e('0x0'));var rimraf=require(_0x664e('0x1'));var zipdir=require(_0x664e('0x2'));var jsonpatch=require(_0x664e('0x3'));var rp=require('request-promise');var moment=require(_0x664e('0x4'));var BPromise=require(_0x664e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x664e('0x6'));var csv=require('to-csv');var ejs=require(_0x664e('0x7'));var fs=require('fs');var _=require(_0x664e('0x8'));var squel=require('squel');var crypto=require(_0x664e('0x9'));var jsforce=require(_0x664e('0xa'));var deskjs=require(_0x664e('0xb'));var toCsv=require(_0x664e('0xc'));var querystring=require(_0x664e('0xd'));var Papa=require(_0x664e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x664e('0xf'));var as=require(_0x664e('0x10'));var hardwareService=require(_0x664e('0x11'));var logger=require(_0x664e('0x12'))(_0x664e('0x13'));var utils=require(_0x664e('0x14'));var config=require('../../config/environment');var db=require(_0x664e('0x15'))['db'];config[_0x664e('0x16')]=_['defaults'](config[_0x664e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x664e('0x17'))(new Redis(config[_0x664e('0x16')]));require(_0x664e('0x18'))['register'](socket);function respondWithStatusCode(_0x243848,_0x4837bd){_0x4837bd=_0x4837bd||0xcc;return function(_0x179191){if(_0x179191){return _0x243848[_0x664e('0x19')](_0x4837bd);}return _0x243848[_0x664e('0x1a')](_0x4837bd)[_0x664e('0x1b')]();};}function respondWithResult(_0x3f5b28,_0x2fc3f5){_0x2fc3f5=_0x2fc3f5||0xc8;return function(_0x110dee){if(_0x110dee){return _0x3f5b28[_0x664e('0x1a')](_0x2fc3f5)['json'](_0x110dee);}};}function respondWithFilteredResult(_0x4604b1,_0x3c0009){return function(_0x5bcfdb){if(_0x5bcfdb){var _0x3e55cc=_0x5bcfdb[_0x664e('0x1c')],_0x4d950e=_0x3c0009[_0x664e('0x1d')],_0x2766f0=_0x3c0009[_0x664e('0x1d')]+_0x3c0009['limit'],_0x1b2c3f;if(_0x2766f0>=_0x3e55cc){_0x2766f0=_0x3e55cc;_0x1b2c3f=0xc8;}else{_0x1b2c3f=0xce;}_0x4604b1[_0x664e('0x1a')](_0x1b2c3f);return _0x4604b1[_0x664e('0x1e')]('Content-Range',_0x4d950e+'-'+_0x2766f0+'/'+_0x3e55cc)[_0x664e('0x1f')](_0x5bcfdb);}return null;};}function patchUpdates(_0x5975ce){return function(_0xf3a705){try{jsonpatch[_0x664e('0x20')](_0xf3a705,_0x5975ce,!![]);}catch(_0x34309f){return BPromise[_0x664e('0x21')](_0x34309f);}return _0xf3a705['save']();};}function saveUpdates(_0x6ce3d8,_0x356de4){return function(_0x16af9b){if(_0x16af9b){return _0x16af9b[_0x664e('0x22')](_0x6ce3d8)[_0x664e('0x23')](function(_0x5cecb8){return _0x5cecb8;});}return null;};}function removeEntity(_0x411ed8,_0x41d0c5){return function(_0x114daa){if(_0x114daa){return _0x114daa[_0x664e('0x24')]()[_0x664e('0x23')](function(){_0x411ed8[_0x664e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62a545,_0x2aa309){return function(_0x4e4488){if(!_0x4e4488){_0x62a545[_0x664e('0x19')](0x194);}return _0x4e4488;};}function handleError(_0x3b0713,_0x58c1b1){_0x58c1b1=_0x58c1b1||0x1f4;return function(_0x2363bb){logger[_0x664e('0x25')](_0x2363bb['stack']);if(_0x2363bb[_0x664e('0x26')]){delete _0x2363bb['name'];}_0x3b0713['status'](_0x58c1b1)[_0x664e('0x27')](_0x2363bb);};}function getInteractionUsers(_0x311c49,_0x154d48){return new BPromise(function(_0x52c830,_0xa86fd0){try{if(_0x154d48[_0x311c49['id']]){_0x311c49[_0x664e('0x28')]=_['map'](_0x154d48[_0x311c49['id']],function(_0x41025d){return{'id':_0x41025d['id'],'fullname':_0x41025d['fullname']};});}}catch(_0x3f571e){_0xa86fd0(_0x3f571e);}_0x52c830(_0x311c49);});}function getInteractionTags(_0x1fc1fa,_0x289b50){return new BPromise(function(_0x23f6db,_0x3bac52){try{if(_0x1fc1fa['TagIds']){_0x1fc1fa['Tags']=[];_0x1fc1fa['TagIds'][_0x664e('0x29')](',')[_0x664e('0x2a')](function(_0x2304b9){_0x1fc1fa[_0x664e('0x2b')]['push'](_0x289b50[_0x2304b9]);});}delete _0x1fc1fa[_0x664e('0x2c')];}catch(_0x549b49){_0x3bac52(_0x549b49);}_0x23f6db(_0x1fc1fa);});}function updateOpenchannelInteraction(_0x33eb3b,_0xf18e7b,_0x16cae8){return new BPromise(function(_0x46be9c,_0x4c4e83){return getInteractionUsers(_0x33eb3b,_0x16cae8)[_0x664e('0x23')](function(_0x22e902){return getInteractionTags(_0x22e902,_0xf18e7b);})['then'](function(_0x39ab2f){_0x46be9c(_0x39ab2f);})[_0x664e('0x2d')](function(_0x418b85){_0x4c4e83(_0x418b85);});});}exports['index']=function(_0x502687,_0x5353b4){var _0x20165c={},_0x56695e={},_0x560279={'count':0x0,'rows':[]};var _0x37b910=_[_0x664e('0x2e')](db[_0x664e('0x2f')][_0x664e('0x30')],function(_0x28dd71){return{'name':_0x28dd71[_0x664e('0x31')],'type':_0x28dd71[_0x664e('0x32')][_0x664e('0x33')]};});_0x56695e['model']=_[_0x664e('0x2e')](_0x37b910,_0x664e('0x26'));_0x56695e[_0x664e('0x34')]=_[_0x664e('0x35')](_0x502687['query']);_0x56695e[_0x664e('0x36')]=_[_0x664e('0x37')](_0x56695e[_0x664e('0x38')],_0x56695e[_0x664e('0x34')]);_0x20165c[_0x664e('0x39')]=_[_0x664e('0x37')](_0x56695e['model'],qs['fields'](_0x502687[_0x664e('0x34')][_0x664e('0x3a')]));_0x20165c[_0x664e('0x39')]=_0x20165c['attributes'][_0x664e('0x3b')]?_0x20165c[_0x664e('0x39')]:_0x56695e[_0x664e('0x38')];if(!_0x502687[_0x664e('0x34')]['hasOwnProperty'](_0x664e('0x3c'))){_0x20165c[_0x664e('0x3d')]=qs[_0x664e('0x3d')](_0x502687[_0x664e('0x34')][_0x664e('0x3d')]);_0x20165c[_0x664e('0x1d')]=qs[_0x664e('0x1d')](_0x502687[_0x664e('0x34')][_0x664e('0x1d')]);}_0x20165c[_0x664e('0x3e')]=qs[_0x664e('0x3f')](_0x502687[_0x664e('0x34')][_0x664e('0x3f')]);_0x20165c['where']=qs[_0x664e('0x36')](_[_0x664e('0x40')](_0x502687['query'],_0x56695e[_0x664e('0x36')]),_0x37b910);var _0x198704=[];var _0x2c75e9=squel[_0x664e('0x41')]()[_0x664e('0x42')]('id')[_0x664e('0x42')](_0x664e('0x26'))[_0x664e('0x42')](_0x664e('0x43'))['from'](_0x664e('0x44'));var _0x5ed653=squel[_0x664e('0x41')]()[_0x664e('0x42')]('u.id')[_0x664e('0x42')](_0x664e('0x45'))[_0x664e('0x42')](_0x664e('0x46'))[_0x664e('0x47')]('user_has_openchannel_interactions','ui')[_0x664e('0x48')]('users','u',_0x664e('0x49'));var _0x118365=squel[_0x664e('0x41')]()[_0x664e('0x47')](_0x664e('0x4a'),'i')[_0x664e('0x48')](_0x664e('0x4b'),'c',_0x664e('0x4c'))[_0x664e('0x48')](_0x664e('0x4d'),'o',_0x664e('0x4e'))[_0x664e('0x48')](_0x664e('0x4f'),'a',_0x664e('0x50'))['left_join'](_0x664e('0x51'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x664e('0x48')](_0x664e('0x52'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x664e('0x53'));var _0x15fd98=squel[_0x664e('0x54')]();var _0x18cfd5=[];var _0x15b7f8=squel[_0x664e('0x54')]();var _0x404e53;if(_0x502687['query']['search']){_0x404e53=as[_0x664e('0x55')](_0x502687['query'][_0x664e('0x56')]);var _0x46dafb=_0x404e53[_0x664e('0x57')];for(var _0x14a72b=0x0;_0x14a72b<_0x404e53['conditions']['length'];_0x14a72b++){var _0x14b6cc=_0x404e53[_0x664e('0x58')][_0x14a72b];var _0x49e2d7='i';var _0x3f5218=_[_0x664e('0x59')](_0x37b910,[_0x664e('0x26'),_0x14b6cc['field']]);if(!_0x3f5218){switch(_0x14b6cc[_0x664e('0x42')]){case _0x664e('0x5a'):if(_0x14b6cc[_0x664e('0x5b')]==0x1){_0x118365[_0x664e('0x5c')]('`'+_0x14b6cc[_0x664e('0x42')]+_0x664e('0x5d'));}else{_0x118365[_0x664e('0x5c')]('`'+_0x14b6cc[_0x664e('0x42')]+'`\x20>\x200');}break;case _0x664e('0x5e'):if(_0x14b6cc[_0x664e('0x5f')]==='$substring'){if(_0x14b6cc[_0x664e('0x5b')]['split']('\x20')[_0x664e('0x3b')]>0x1){_0x15fd98[_0x46dafb](_0x664e('0x60'),qs[_0x664e('0x61')](_0x14b6cc[_0x664e('0x5b')]),null);}else{var _0x1ff428='%'+_0x14b6cc[_0x664e('0x5b')]+'%';_0x15fd98[_0x46dafb](_0x664e('0x62'),_0x1ff428,_0x1ff428,_0x1ff428);}}else{_0x3f5218=_['find'](_0x37b910,[_0x664e('0x26'),_0x664e('0x63')]);_0x14b6cc['field']='ContactId';_0x2f0c90=as['buildExpression'](_0x49e2d7,_0x3f5218[_0x664e('0x32')],_0x14b6cc);_0x15fd98[_0x46dafb](_0x2f0c90['text'],_0x2f0c90[_0x664e('0x5b')]['start'],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x1b')]);}break;case _0x664e('0x64'):var _0xa6ce98=_0x14b6cc[_0x664e('0x5b')][_0x664e('0x29')](',')['map'](function(_0x5e4dc7){return Number(_0x5e4dc7);});_0xa6ce98[_0x664e('0x2a')](function(_0x40c207){_0x15b7f8['or'](_0x664e('0x65'),'%,'+_0x40c207+',%');});_0x18cfd5=_[_0x664e('0x66')](_0x18cfd5,_0xa6ce98);break;case _0x664e('0x67'):if(_0x14b6cc[_0x664e('0x5f')]===_0x664e('0x68')){_0x15fd98[_0x46dafb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x14b6cc[_0x664e('0x5b')]+'%',null);}else{_0x3f5218=_[_0x664e('0x59')](_0x37b910,[_0x664e('0x26'),_0x664e('0x69')]);_0x14b6cc[_0x664e('0x42')]=_0x664e('0x69');_0x2f0c90=as[_0x664e('0x6a')](_0x49e2d7,_0x3f5218[_0x664e('0x32')],_0x14b6cc);_0x15fd98[_0x46dafb](_0x2f0c90[_0x664e('0x6b')],_0x2f0c90['value'][_0x664e('0x6c')],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x1b')]);}break;case _0x664e('0x6d'):_0x2f0c90=as['buildExpression']('me',null,_0x14b6cc);_0x15fd98[_0x46dafb](_0x2f0c90[_0x664e('0x6b')],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x6c')],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x1b')]);break;}}else{var _0x2f0c90=as[_0x664e('0x6a')](_0x49e2d7,_0x3f5218['type'],_0x14b6cc);_0x15fd98[_0x46dafb](_0x2f0c90[_0x664e('0x6b')],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x6c')],_0x2f0c90[_0x664e('0x5b')][_0x664e('0x1b')]);}}}else{var _0x20a557=_(_0x502687[_0x664e('0x34')])[_0x664e('0x35')]()[_0x664e('0x2e')](function(_0x3e55fd){return _[_0x664e('0x6e')](_0x37b910,['name',_0x3e55fd])?_0x3e55fd:undefined;})[_0x664e('0x6f')]()[_0x664e('0x5b')]();if(!_[_0x664e('0x70')](_0x20a557)){_0x20a557[_0x664e('0x2a')](function(_0x583b1f){if(_0x583b1f==='OpenchannelAccountId'){_0x118365[_0x664e('0x71')](_0x664e('0x72'),[][_0x664e('0x73')](_0x502687[_0x664e('0x34')][_0x583b1f]));}else if(_0x583b1f===_0x664e('0x74')){var _0x1add9f=JSON['parse'](_0x502687[_0x664e('0x34')][_0x583b1f])[_0x664e('0x75')];var _0x2891a0=JSON['parse'](_0x502687[_0x664e('0x34')][_0x583b1f])[_0x664e('0x76')];_0x118365[_0x664e('0x71')](_0x664e('0x77'),_0x1add9f,_0x2891a0);}else{if(_0x502687['query'][_0x583b1f]==='null'){_0x118365[_0x664e('0x71')]('i.'+_0x583b1f+_0x664e('0x78'));}else{_0x118365[_0x664e('0x71')]('i.'+_0x583b1f+_0x664e('0x79'),_0x502687['query'][_0x583b1f]);}}});}if(_0x502687['query'][_0x664e('0x7a')]){if(_0x502687[_0x664e('0x34')][_0x664e('0x7a')]==0x1){_0x118365[_0x664e('0x5c')](_0x664e('0x7b'));}else{_0x118365[_0x664e('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x502687[_0x664e('0x34')]['tag']){_0x18cfd5=_['isArray'](_0x502687[_0x664e('0x34')]['tag'])?_0x502687[_0x664e('0x34')][_0x664e('0x7c')]:new Array(_0x502687['query']['tag']);_0x18cfd5[_0x664e('0x2a')](function(_0x2364b6){_0x15b7f8['or'](_0x664e('0x65'),'%,'+_0x2364b6+',%');});}if(_0x502687['query']['filter']){var _0x432dd8=_0x502687['query'][_0x664e('0x7d')][_0x664e('0x7e')]('\x5c','\x5c\x5c')[_0x664e('0x7e')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x664e('0x7f')](_0x432dd8)){_0x15fd98['or']('i.id\x20LIKE\x20?',_0x432dd8+'%');}else{_0x15fd98['or'](_0x664e('0x80'),qs[_0x664e('0x61')](_0x432dd8))['or']('i.from\x20LIKE\x20?',_0x432dd8+'%')['or'](_0x664e('0x81'),_0x432dd8+'%');}}}_0x118365[_0x664e('0x71')](_0x15fd98);_0x118365['group']('i.id');var _0x46b478={'type':db[_0x664e('0x82')][_0x664e('0x83')][_0x664e('0x84')],'raw':!![]};var _0x93d765=_0x118365[_0x664e('0x85')]();_0x93d765[_0x664e('0x42')]('i.id');_0x93d765[_0x664e('0x42')](_0x664e('0x86'),_0x664e('0x5a'));if(_0x20165c[_0x664e('0x3e')]){_0x20165c['order'][_0x664e('0x2a')](function(_0x5405ff){_0x118365['order']('i.'+_0x5405ff[0x0],_0x5405ff[0x1]==='DESC'?![]:!![]);});}if(!_[_0x664e('0x70')](_0x18cfd5)){_0x118365[_0x664e('0x5c')](_0x15b7f8);_0x93d765[_0x664e('0x71')]('t.id\x20IN\x20?',_0x18cfd5);}BPromise['resolve']()['then'](function(){if(!_0x404e53){if(_0x502687[_0x664e('0x34')][_0x664e('0x87')]||_0x502687['query'][_0x664e('0x88')])return;_0x93d765[_0x664e('0x71')](_0x664e('0x89'));_0x118365[_0x664e('0x71')](_0x664e('0x89'));return;}return _0x502687['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4e46df){if(_[_0x664e('0x70')](_0x4e46df)){_0x93d765['where'](_0x664e('0x8a'));_0x118365['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x93d765[_0x664e('0x71')](_0x664e('0x72'),_[_0x664e('0x2e')](_0x4e46df,'id'));_0x118365['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x664e('0x2e')](_0x4e46df,'id'));}});})[_0x664e('0x23')](function(){db[_0x664e('0x8b')][_0x664e('0x34')](_0x93d765[_0x664e('0x8c')](),_0x46b478)[_0x664e('0x23')](function(_0x46b242){_0x560279[_0x664e('0x1c')]=_0x46b242['length'];if(_0x560279[_0x664e('0x1c')]===0x0)return[];return db[_0x664e('0x8b')]['query'](_0x2c75e9['toString'](),_0x46b478)[_0x664e('0x23')](function(_0x3a5297){_0x198704=_[_0x664e('0x8d')](_0x3a5297,'id');_0x46b478=_['merge'](_0x46b478,{'model':db[_0x664e('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x502687[_0x664e('0x34')][_0x664e('0x3a')]){_0x20165c[_0x664e('0x39')][_0x664e('0x2a')](function(_0x165f39){_0x118365[_0x664e('0x42')]('i.'+_0x165f39);});}else{_0x118365['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x118365['field'](_0x664e('0x8e'),_0x664e('0x8f'));_0x118365[_0x664e('0x42')](_0x664e('0x90'),_0x664e('0x91'));_0x118365[_0x664e('0x42')](_0x664e('0x92'));_0x118365['field'](_0x664e('0x93'),'Contact.firstName');_0x118365['field']('c.lastName',_0x664e('0x94'));_0x118365[_0x664e('0x42')](_0x664e('0x95'),_0x664e('0x96'));_0x118365[_0x664e('0x42')](_0x664e('0x97'),_0x664e('0x98'));_0x118365[_0x664e('0x42')](_0x664e('0x99'),_0x664e('0x9a'));_0x118365[_0x664e('0x42')](_0x664e('0x9b'),_0x664e('0x9c'));_0x118365[_0x664e('0x42')]('o.fullname','Owner.fullname');_0x118365[_0x664e('0x42')](_0x664e('0x9d'),'Owner.internal');_0x118365[_0x664e('0x42')](_0x664e('0x9e'),_0x664e('0x2c'));}if(_0x20165c[_0x664e('0x3d')])_0x118365[_0x664e('0x3d')](_0x20165c['limit']);if(_0x20165c['offset'])_0x118365[_0x664e('0x1d')](_0x20165c['offset']);return db[_0x664e('0x8b')][_0x664e('0x34')](_0x118365[_0x664e('0x8c')](),_0x46b478);})[_0x664e('0x23')](function(_0x4028a6){_0x5ed653[_0x664e('0x71')](_0x664e('0x9f'),_['map'](_0x4028a6,'id'));return db[_0x664e('0x8b')][_0x664e('0x34')](_0x5ed653[_0x664e('0x8c')](),_0x46b478)[_0x664e('0x23')](function(_0x457562){var _0x4a08c9=_[_0x664e('0xa0')](_0x457562,_0x664e('0xa1'));var _0x115174=[];_0x4028a6[_0x664e('0x2a')](function(_0x21c040){_0x115174[_0x664e('0xa2')](updateOpenchannelInteraction(_0x21c040,_0x198704,_0x4a08c9));});return BPromise[_0x664e('0xa3')](_0x115174);});});})['then'](function(_0x1bb65d){_0x560279[_0x664e('0xa4')]=_0x1bb65d;return _0x560279;})[_0x664e('0x23')](respondWithFilteredResult(_0x5353b4,_0x20165c));})[_0x664e('0x2d')](handleError(_0x5353b4,null));};exports[_0x664e('0xa5')]=function(_0x2a9783,_0x944596){var _0x5b334f={'raw':![],'where':{'id':_0x2a9783[_0x664e('0xa6')]['id']}},_0x4f5e1e={};_0x4f5e1e[_0x664e('0x38')]=_[_0x664e('0x35')](db[_0x664e('0x2f')][_0x664e('0x30')]);_0x4f5e1e[_0x664e('0x34')]=_['keys'](_0x2a9783[_0x664e('0x34')]);_0x4f5e1e[_0x664e('0x36')]=_[_0x664e('0x37')](_0x4f5e1e[_0x664e('0x38')],_0x4f5e1e[_0x664e('0x34')]);_0x5b334f[_0x664e('0x39')]=_['intersection'](_0x4f5e1e[_0x664e('0x38')],qs['fields'](_0x2a9783[_0x664e('0x34')][_0x664e('0x3a')]));_0x5b334f[_0x664e('0x39')]=_0x5b334f['attributes'][_0x664e('0x3b')]?_0x5b334f[_0x664e('0x39')]:_0x4f5e1e[_0x664e('0x38')];if(_0x2a9783['query'][_0x664e('0xa7')]){_0x5b334f[_0x664e('0xa8')]=[{'all':!![]}];}_0x5b334f=_[_0x664e('0xa9')]({},_0x5b334f,_0x2a9783['options']);return db['OpenchannelInteraction'][_0x664e('0x59')](_0x5b334f)[_0x664e('0x23')](handleEntityNotFound(_0x944596,null))[_0x664e('0x23')](respondWithResult(_0x944596,null))[_0x664e('0x2d')](handleError(_0x944596,null));};exports[_0x664e('0xaa')]=function(_0x25e23a,_0x4fbebd){return db[_0x664e('0x2f')]['create'](_0x25e23a['body'],{})['then'](respondWithResult(_0x4fbebd,0xc9))[_0x664e('0x2d')](handleError(_0x4fbebd,null));};exports['update']=function(_0x18077d,_0x4c9bb2){if(_0x18077d[_0x664e('0x6d')]['id']){delete _0x18077d[_0x664e('0x6d')]['id'];}return db[_0x664e('0x2f')][_0x664e('0x59')]({'where':{'id':_0x18077d[_0x664e('0xa6')]['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x4c9bb2,null))[_0x664e('0x23')](saveUpdates(_0x18077d[_0x664e('0x6d')],null))[_0x664e('0x23')](respondWithResult(_0x4c9bb2,null))[_0x664e('0x2d')](handleError(_0x4c9bb2,null));};exports[_0x664e('0x24')]=function(_0xd0ef73,_0x3103c1){return db[_0x664e('0x2f')][_0x664e('0x59')]({'where':{'id':_0xd0ef73['params']['id']}})['then'](handleEntityNotFound(_0x3103c1,null))[_0x664e('0x23')](removeEntity(_0x3103c1,null))['catch'](handleError(_0x3103c1,null));};exports['describe']=function(_0x3c939c,_0x376c57){return db[_0x664e('0x2f')][_0x664e('0xab')]()[_0x664e('0x23')](respondWithResult(_0x376c57,null))['catch'](handleError(_0x376c57,null));};exports[_0x664e('0xac')]=function(_0x229e70,_0x29a872,_0x515588){return db[_0x664e('0xad')][_0x664e('0x59')]({'where':{'id':_0x229e70[_0x664e('0xa6')]['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x29a872,null))[_0x664e('0x23')](function(_0x22c412){if(_0x22c412){return _0x22c412[_0x664e('0xac')](_0x229e70['body'][_0x664e('0xae')],_['omit'](_0x229e70[_0x664e('0x6d')],[_0x664e('0xae'),'id'])||{});}})[_0x664e('0x23')](respondWithResult(_0x29a872,null))[_0x664e('0x2d')](handleError(_0x29a872,null));};exports['getMessages']=function(_0x1c5b6f,_0x3f50a9,_0x263f5e){var _0x87f7ee={'raw':![],'where':{}};var _0x1545e8={};var _0x4caa04={'count':0x0,'rows':[]};return db[_0x664e('0x2f')][_0x664e('0xaf')]({'where':{'id':_0x1c5b6f['params']['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x3f50a9,null))[_0x664e('0x23')](function(_0x2bbf9c){if(_0x2bbf9c){_0x1545e8['model']=_[_0x664e('0x35')](db['OpenchannelMessage']['rawAttributes']);_0x1545e8[_0x664e('0x34')]=_['keys'](_0x1c5b6f[_0x664e('0x34')]);_0x1545e8[_0x664e('0x36')]=_[_0x664e('0x37')](_0x1545e8[_0x664e('0x38')],_0x1545e8[_0x664e('0x34')]);_0x87f7ee['attributes']=_[_0x664e('0x37')](_0x1545e8[_0x664e('0x38')],qs[_0x664e('0x3a')](_0x1c5b6f['query'][_0x664e('0x3a')]));_0x87f7ee[_0x664e('0x39')]=_0x87f7ee[_0x664e('0x39')][_0x664e('0x3b')]?_0x87f7ee[_0x664e('0x39')]:_0x1545e8['model'];if(!_0x1c5b6f[_0x664e('0x34')][_0x664e('0xb0')](_0x664e('0x3c'))){_0x87f7ee['limit']=qs[_0x664e('0x3d')](_0x1c5b6f[_0x664e('0x34')][_0x664e('0x3d')]);_0x87f7ee['offset']=qs[_0x664e('0x1d')](_0x1c5b6f[_0x664e('0x34')][_0x664e('0x1d')]);}_0x87f7ee[_0x664e('0x3e')]=qs[_0x664e('0x3f')](_0x1c5b6f['query'][_0x664e('0x3f')]);_0x87f7ee[_0x664e('0x71')]=qs['filters'](_[_0x664e('0x40')](_0x1c5b6f[_0x664e('0x34')],_0x1545e8[_0x664e('0x36')]));_0x87f7ee[_0x664e('0x71')]['OpenchannelInteractionId']=_0x2bbf9c['id'];if(_0x1c5b6f[_0x664e('0x34')]['filter']){_0x87f7ee[_0x664e('0x71')]=_[_0x664e('0xa9')](_0x87f7ee[_0x664e('0x71')],{'$or':_[_0x664e('0x2e')](_0x87f7ee['attributes'],function(_0x48be83){var _0x111f48={};_0x111f48[_0x48be83]={'$like':'%'+_0x1c5b6f[_0x664e('0x34')][_0x664e('0x7d')]+'%'};return _0x111f48;})});}if(_0x1c5b6f[_0x664e('0x34')][_0x664e('0x75')]){var _0x2ede0a=_0x1c5b6f['query'][_0x664e('0x75')][_0x664e('0x29')](',');var _0xb829de={};_0xb829de[_0x2ede0a[0x0]]={'$gte':moment(_0x2ede0a[0x1])[_0x664e('0xb1')](_0x664e('0xb2'))};_0x87f7ee[_0x664e('0x71')]=_['merge'](_0x87f7ee[_0x664e('0x71')],_0xb829de);}_0x87f7ee=_[_0x664e('0xa9')]({},_0x87f7ee,_0x1c5b6f[_0x664e('0xb3')]);return db['OpenchannelMessage'][_0x664e('0x1c')]({'where':_0x87f7ee[_0x664e('0x71')]})[_0x664e('0x23')](function(_0x5ec630){_0x4caa04[_0x664e('0x1c')]=_0x5ec630;if(_0x1c5b6f[_0x664e('0x34')][_0x664e('0xa7')]){_0x87f7ee[_0x664e('0xa8')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x664e('0xb4')](_0x87f7ee);})[_0x664e('0x23')](function(_0x1bb1b3){_0x4caa04[_0x664e('0xa4')]=_0x1bb1b3;return _0x4caa04;});}})[_0x664e('0x23')](respondWithFilteredResult(_0x3f50a9,_0x87f7ee))[_0x664e('0x2d')](handleError(_0x3f50a9,null));};exports[_0x664e('0xb5')]=function(_0x1f0c08,_0x373495,_0x2de973){return db[_0x664e('0x2f')][_0x664e('0x59')]({'where':{'id':_0x1f0c08[_0x664e('0xa6')]['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x373495,null))[_0x664e('0x23')](function(_0x4e958f){if(_0x4e958f){return _0x4e958f[_0x664e('0xb6')](_0x1f0c08[_0x664e('0x6d')][_0x664e('0xae')],_[_0x664e('0xb7')](_0x1f0c08[_0x664e('0x6d')],[_0x664e('0xae'),'id'])||{})['spread'](function(){return db[_0x664e('0x64')][_0x664e('0xb4')]({'attributes':['id',_0x664e('0x26'),_0x664e('0x43')],'where':{'id':_0x1f0c08[_0x664e('0x6d')][_0x664e('0xae')]}});})['then'](function(_0x4ccca7){socket['emit'](_0x664e('0xb8'),{'id':Number(_0x1f0c08[_0x664e('0xa6')]['id']),'tags':_0x4ccca7||[]});return{'id':Number(_0x1f0c08[_0x664e('0xa6')]['id']),'tags':_0x4ccca7||[]};});}})[_0x664e('0x23')](respondWithResult(_0x373495,null))[_0x664e('0x2d')](handleError(_0x373495,null));};exports[_0x664e('0xb9')]=function(_0x24b05d,_0x553b40,_0x5e7578){return db[_0x664e('0x2f')][_0x664e('0x59')]({'where':{'id':_0x24b05d[_0x664e('0xa6')]['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x553b40,null))['then'](function(_0x1331fe){if(_0x1331fe){return _0x1331fe[_0x664e('0xb9')](_0x24b05d['query'][_0x664e('0xae')]);}})[_0x664e('0x23')](respondWithStatusCode(_0x553b40,null))[_0x664e('0x2d')](handleError(_0x553b40,null));};exports['download']=function(_0x4f57cb,_0x249216){var _0x167046=moment()[_0x664e('0xba')]()[_0x664e('0x8c')]();var _0x2f6be8=path[_0x664e('0xbb')](config[_0x664e('0xbc')],_0x664e('0xbd'),_0x664e('0xbe'),_0x664e('0xbf'));var _0x5f5296=path['join'](config[_0x664e('0xbc')],'server',_0x664e('0xbe'),'attachments');var _0x607e29=path[_0x664e('0xbb')](_0x2f6be8,_0x167046);var _0x53494=util['format'](_0x664e('0xc0'),_0x4f57cb[_0x664e('0xa6')]['id'],_0x167046);var _0x1fff37=path[_0x664e('0xbb')](_0x2f6be8,_0x53494);var _0x585095=[];_0x585095[_0x664e('0xa2')]({'model':db[_0x664e('0x67')],'as':_0x664e('0x67'),'attributes':['id','fullname'],'raw':!![]});_0x585095['push']({'model':db[_0x664e('0xc1')],'as':_0x664e('0x5e'),'attributes':['id',_0x664e('0xc2'),_0x664e('0xc3')],'raw':!![]});if(_0x4f57cb['query']['attachments']){_0x585095[_0x664e('0xa2')]({'model':db[_0x664e('0xc4')],'as':_0x664e('0xc4'),'raw':!![]});}var _0x657a51=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x664e('0x6d'),_0x664e('0x74'),_0x664e('0xc5'),_0x664e('0xc6'),_0x664e('0x7a')],'include':_0x585095}];_0x657a51[_0x664e('0xa2')]({'model':db[_0x664e('0xc7')],'as':_0x664e('0xc8'),'attributes':['id','name']});_0x657a51[_0x664e('0xa2')]({'model':db[_0x664e('0x67')],'as':_0x664e('0xc9'),'attributes':['id',_0x664e('0xca')]});return db['OpenchannelInteraction'][_0x664e('0x59')]({'where':{'id':_0x4f57cb[_0x664e('0xa6')]['id']},'include':_0x657a51})[_0x664e('0x23')](handleEntityNotFound(_0x249216,null))[_0x664e('0x23')](function(_0x1fcbf2){if(_0x1fcbf2){var _0x1527c5=_0x1fcbf2['get']({'plain':!![]});fs[_0x664e('0xcb')](_0x607e29);var _0x2fb474={'format':'A4','border':'10px','header':{'height':_0x664e('0xcc'),'contents':{'first':_0x664e('0xcd')}},'footer':{'height':_0x664e('0xce'),'contents':{'default':util['format'](_0x664e('0xcf'),util[_0x664e('0xb1')](_0x664e('0xd0'),'Openchannel',_0x1527c5['id']),moment()[_0x664e('0xb1')]('YYYY-MM-DD')['toString']())}}};var _0x10cf94={'channel':_0x664e('0xd1'),'account':_0x1527c5[_0x664e('0xc8')][_0x664e('0x26')],'agent':_0x1527c5[_0x664e('0xc9')]?_0x1527c5[_0x664e('0xc9')][_0x664e('0xca')]:_0x664e('0xd2'),'createdAt':moment(_0x1527c5[_0x664e('0x74')])[_0x664e('0xb1')](_0x664e('0xb2'))[_0x664e('0x8c')](),'closedAt':_0x1527c5[_0x664e('0xd3')]?moment(_0x1527c5['closedAt'])[_0x664e('0xb1')](_0x664e('0xb2'))['toString']():'','disposition':_0x1527c5['disposition'],'visibility':_0x1527c5['threadId']?_0x664e('0xd4'):_0x664e('0xd5'),'messages':_(_0x1527c5[_0x664e('0xd6')])[_0x664e('0x7d')]({'secret':![]})[_0x664e('0x2e')](function(_0x1be9ea){if(_0x1be9ea['Attachment']){var _0x328b62=path['join'](_0x5f5296,_0x1be9ea[_0x664e('0xc4')][_0x664e('0xd7')]);if(fs[_0x664e('0xd8')](_0x328b62)){fs['createReadStream'](_0x328b62)['pipe'](fs[_0x664e('0xd9')](path[_0x664e('0xbb')](_0x607e29,_0x1be9ea['Attachment'][_0x664e('0xd7')])));}}return{'date':moment(_0x1be9ea[_0x664e('0x74')])[_0x664e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x664e('0x8c')](),'sender':_0x1be9ea[_0x664e('0xc5')]===_0x664e('0xda')?_0x1be9ea[_0x664e('0x67')]?_0x1be9ea[_0x664e('0x67')][_0x664e('0xca')]:_0x664e('0xdb'):_0x1be9ea['Contact'][_0x664e('0xc2')]+(_0x1be9ea[_0x664e('0x5e')][_0x664e('0xc3')]?'\x20'+_0x1be9ea['Contact']['lastName']:''),'body':_0x1be9ea['Attachment']?_0x1be9ea['Attachment'][_0x664e('0xd7')]:_0x1be9ea[_0x664e('0x6d')],'direction':_0x1be9ea['direction']===_0x664e('0xda')?'A':'C','secret':_0x1be9ea[_0x664e('0xc6')],'read':_0x1be9ea[_0x664e('0x7a')],'attachment':_0x1be9ea[_0x664e('0xc4')]};})[_0x664e('0x5b')]()};return ejs[_0x664e('0xdc')](path[_0x664e('0xbb')](config['root'],_0x664e('0xbd'),'views',_0x664e('0xdd')),{'interaction':_0x10cf94})[_0x664e('0x23')](function(_0x71056d){return new BPromise(function(_0x39f018,_0x336c0b){pdf[_0x664e('0xaa')](_0x71056d,_0x2fb474)['toFile'](path['join'](_0x607e29,'transcript-'+_0x1527c5['id']+'-'+_0x167046+'.pdf'),function(_0x25e8ee,_0x51c10f){if(_0x25e8ee)return _0x336c0b(_0x25e8ee);_0x39f018(_0x51c10f);});});})[_0x664e('0x23')](function(){return new BPromise(function(_0x5602b1,_0x9951c8){zipdir(_0x607e29,{'saveTo':_0x1fff37},function(_0x246bce,_0x1797c6){if(_0x246bce)return _0x9951c8(_0x246bce);return _0x5602b1(_0x1797c6);});})[_0x664e('0x23')](function(){return new BPromise(function(_0xc944be,_0x1404da){rimraf(_0x607e29,function(_0x4c181c){if(_0x4c181c)_0x1404da(_0x4c181c);return _0xc944be();});});})[_0x664e('0x23')](function(){return _0x249216[_0x664e('0xde')](_0x1fff37,_0x53494,function(_0x20c555){if(_0x20c555){console[_0x664e('0xdf')](_0x664e('0xe0'),_0x20c555);}else{fs[_0x664e('0xe1')](_0x1fff37);}});});});}else{return _0x249216[_0x664e('0x19')](0xc8);}})[_0x664e('0x2d')](handleError(_0x249216,null));}; \ No newline at end of file +var _0xf4e5=['status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','parse','$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)','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','rows','catch','params','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\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','Openchannel','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus'];(function(_0x2bcef7,_0x183483){var _0x2e6972=function(_0x33d8da){while(--_0x33d8da){_0x2bcef7['push'](_0x2bcef7['shift']());}};_0x2e6972(++_0x183483);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x1e142a,_0x4e26a5){_0x1e142a=_0x1e142a-0x0;var _0x49433d=_0xf4e5[_0x1e142a];return _0x49433d;};'use strict';var pdf=require(_0x5f4e('0x0'));var emlformat=require(_0x5f4e('0x1'));var rimraf=require(_0x5f4e('0x2'));var zipdir=require(_0x5f4e('0x3'));var jsonpatch=require(_0x5f4e('0x4'));var rp=require(_0x5f4e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f4e('0x6'));var util=require(_0x5f4e('0x7'));var path=require(_0x5f4e('0x8'));var sox=require('sox');var csv=require(_0x5f4e('0x9'));var ejs=require(_0x5f4e('0xa'));var fs=require('fs');var _=require(_0x5f4e('0xb'));var squel=require(_0x5f4e('0xc'));var crypto=require(_0x5f4e('0xd'));var jsforce=require(_0x5f4e('0xe'));var deskjs=require(_0x5f4e('0xf'));var toCsv=require(_0x5f4e('0x9'));var querystring=require(_0x5f4e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5f4e('0x11'));var qs=require(_0x5f4e('0x12'));var as=require(_0x5f4e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f4e('0x14'))(_0x5f4e('0x15'));var utils=require(_0x5f4e('0x16'));var config=require(_0x5f4e('0x17'));var db=require(_0x5f4e('0x18'))['db'];config[_0x5f4e('0x19')]=_[_0x5f4e('0x1a')](config[_0x5f4e('0x19')],{'host':_0x5f4e('0x1b'),'port':0x18eb});var socket=require(_0x5f4e('0x1c'))(new Redis(config[_0x5f4e('0x19')]));require('./openchannelInteraction.socket')[_0x5f4e('0x1d')](socket);function respondWithStatusCode(_0x45b662,_0x499298){_0x499298=_0x499298||0xcc;return function(_0xfe4d0b){if(_0xfe4d0b){return _0x45b662[_0x5f4e('0x1e')](_0x499298);}return _0x45b662[_0x5f4e('0x1f')](_0x499298)['end']();};}function respondWithResult(_0x364ff8,_0x1f4b49){_0x1f4b49=_0x1f4b49||0xc8;return function(_0x27a344){if(_0x27a344){return _0x364ff8['status'](_0x1f4b49)[_0x5f4e('0x20')](_0x27a344);}};}function respondWithFilteredResult(_0xbd7401,_0x4cfa15){return function(_0xa20484){if(_0xa20484){var _0x403a71=_0xa20484['count'],_0x1a8c0e=_0x4cfa15[_0x5f4e('0x21')],_0x46c3d7=_0x4cfa15['offset']+_0x4cfa15[_0x5f4e('0x22')],_0xb27b7e;if(_0x46c3d7>=_0x403a71){_0x46c3d7=_0x403a71;_0xb27b7e=0xc8;}else{_0xb27b7e=0xce;}_0xbd7401[_0x5f4e('0x1f')](_0xb27b7e);return _0xbd7401[_0x5f4e('0x23')](_0x5f4e('0x24'),_0x1a8c0e+'-'+_0x46c3d7+'/'+_0x403a71)[_0x5f4e('0x20')](_0xa20484);}return null;};}function patchUpdates(_0x31a7de){return function(_0x36ae18){try{jsonpatch[_0x5f4e('0x25')](_0x36ae18,_0x31a7de,!![]);}catch(_0x1f9106){return BPromise[_0x5f4e('0x26')](_0x1f9106);}return _0x36ae18[_0x5f4e('0x27')]();};}function saveUpdates(_0x53fd00,_0x3bf464){return function(_0x145934){if(_0x145934){return _0x145934[_0x5f4e('0x28')](_0x53fd00)[_0x5f4e('0x29')](function(_0x9f8c87){return _0x9f8c87;});}return null;};}function removeEntity(_0x1aac72,_0x8844a4){return function(_0xfaf38){if(_0xfaf38){return _0xfaf38[_0x5f4e('0x2a')]()[_0x5f4e('0x29')](function(){_0x1aac72[_0x5f4e('0x1f')](0xcc)[_0x5f4e('0x2b')]();});}};}function handleEntityNotFound(_0x2ab68e,_0x18a135){return function(_0x1b47de){if(!_0x1b47de){_0x2ab68e[_0x5f4e('0x1e')](0x194);}return _0x1b47de;};}function handleError(_0x5d3c05,_0x4ba4f9){_0x4ba4f9=_0x4ba4f9||0x1f4;return function(_0x2100ad){logger[_0x5f4e('0x2c')](_0x2100ad[_0x5f4e('0x2d')]);if(_0x2100ad['name']){delete _0x2100ad[_0x5f4e('0x2e')];}_0x5d3c05[_0x5f4e('0x1f')](_0x4ba4f9)[_0x5f4e('0x2f')](_0x2100ad);};}function getInteractionUsers(_0x1844c4,_0x3d87ed){return new BPromise(function(_0x383805,_0x2128fd){try{if(_0x3d87ed[_0x1844c4['id']]){_0x1844c4['Users']=_[_0x5f4e('0x30')](_0x3d87ed[_0x1844c4['id']],function(_0x4ddeb9){return{'id':_0x4ddeb9['id'],'fullname':_0x4ddeb9[_0x5f4e('0x31')]};});}}catch(_0x409e53){_0x2128fd(_0x409e53);}_0x383805(_0x1844c4);});}function getInteractionTags(_0x256f69,_0x201f86){return new BPromise(function(_0x16a491,_0x1dac37){try{if(_0x256f69[_0x5f4e('0x32')]){_0x256f69[_0x5f4e('0x33')]=[];_0x256f69[_0x5f4e('0x32')]['split'](',')[_0x5f4e('0x34')](function(_0x4e8a8c){_0x256f69[_0x5f4e('0x33')][_0x5f4e('0x35')](_0x201f86[_0x4e8a8c]);});}delete _0x256f69[_0x5f4e('0x32')];}catch(_0x7508e0){_0x1dac37(_0x7508e0);}_0x16a491(_0x256f69);});}function updateOpenchannelInteraction(_0xda076a,_0x45586d,_0x8705b7){return new BPromise(function(_0x5caef2,_0x5a9bf0){return getInteractionUsers(_0xda076a,_0x8705b7)[_0x5f4e('0x29')](function(_0x554394){return getInteractionTags(_0x554394,_0x45586d);})[_0x5f4e('0x29')](function(_0x6c7d25){_0x5caef2(_0x6c7d25);})['catch'](function(_0x8bea61){_0x5a9bf0(_0x8bea61);});});}exports[_0x5f4e('0x36')]=function(_0x2b1f64,_0x48a709){var _0x56d264={},_0x7033fe={},_0xda9e10={'count':0x0,'rows':[]};var _0x4a7972=_[_0x5f4e('0x30')](db[_0x5f4e('0x37')][_0x5f4e('0x38')],function(_0x2454c5){return{'name':_0x2454c5[_0x5f4e('0x39')],'type':_0x2454c5[_0x5f4e('0x3a')][_0x5f4e('0x3b')]};});_0x7033fe[_0x5f4e('0x3c')]=_['map'](_0x4a7972,'name');_0x7033fe[_0x5f4e('0x3d')]=_[_0x5f4e('0x3e')](_0x2b1f64[_0x5f4e('0x3d')]);_0x7033fe[_0x5f4e('0x3f')]=_[_0x5f4e('0x40')](_0x7033fe[_0x5f4e('0x3c')],_0x7033fe[_0x5f4e('0x3d')]);_0x56d264[_0x5f4e('0x41')]=_[_0x5f4e('0x40')](_0x7033fe['model'],qs[_0x5f4e('0x42')](_0x2b1f64['query']['fields']));_0x56d264[_0x5f4e('0x41')]=_0x56d264[_0x5f4e('0x41')][_0x5f4e('0x43')]?_0x56d264[_0x5f4e('0x41')]:_0x7033fe[_0x5f4e('0x3c')];if(!_0x2b1f64['query']['hasOwnProperty']('nolimit')){_0x56d264['limit']=qs['limit'](_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x22')]);_0x56d264[_0x5f4e('0x21')]=qs['offset'](_0x2b1f64[_0x5f4e('0x3d')]['offset']);}_0x56d264[_0x5f4e('0x44')]=qs[_0x5f4e('0x45')](_0x2b1f64['query'][_0x5f4e('0x45')]);_0x56d264[_0x5f4e('0x46')]=qs[_0x5f4e('0x3f')](_[_0x5f4e('0x47')](_0x2b1f64[_0x5f4e('0x3d')],_0x7033fe[_0x5f4e('0x3f')]),_0x4a7972);var _0x4c4f57=[];var _0x17ec2b=squel['select']()[_0x5f4e('0x48')]('id')[_0x5f4e('0x48')](_0x5f4e('0x2e'))[_0x5f4e('0x48')](_0x5f4e('0x49'))[_0x5f4e('0x4a')](_0x5f4e('0x4b'));var _0x2228f2=squel[_0x5f4e('0x4c')]()[_0x5f4e('0x48')](_0x5f4e('0x4d'))[_0x5f4e('0x48')]('u.fullname')[_0x5f4e('0x48')](_0x5f4e('0x4e'))[_0x5f4e('0x4a')](_0x5f4e('0x4f'),'ui')['left_join']('users','u',_0x5f4e('0x50'));var _0x12adff=squel[_0x5f4e('0x4c')]()[_0x5f4e('0x4a')](_0x5f4e('0x51'),'i')[_0x5f4e('0x52')]('cm_contacts','c',_0x5f4e('0x53'))[_0x5f4e('0x52')](_0x5f4e('0x54'),'o','o.id\x20=\x20i.UserId')[_0x5f4e('0x52')](_0x5f4e('0x55'),'a',_0x5f4e('0x56'))[_0x5f4e('0x52')]('openchannel_messages','me',_0x5f4e('0x57'))[_0x5f4e('0x52')](_0x5f4e('0x58'),'it',_0x5f4e('0x59'))[_0x5f4e('0x52')](_0x5f4e('0x4b'),'t',_0x5f4e('0x5a'));var _0x16de78=squel[_0x5f4e('0x5b')]();var _0x100703=[];var _0x59aa1b=squel['expr']();var _0x21579b;if(_0x2b1f64['query'][_0x5f4e('0x5c')]){_0x21579b=as[_0x5f4e('0x5d')](_0x2b1f64[_0x5f4e('0x3d')]['search']);var _0x170e19=_0x21579b[_0x5f4e('0x5e')];for(var _0x483d58=0x0;_0x483d58<_0x21579b[_0x5f4e('0x5f')][_0x5f4e('0x43')];_0x483d58++){var _0x403a26=_0x21579b[_0x5f4e('0x5f')][_0x483d58];var _0x425cff='i';var _0xaa1de8=_[_0x5f4e('0x60')](_0x4a7972,['name',_0x403a26['field']]);if(!_0xaa1de8){switch(_0x403a26['field']){case'unreadMessages':if(_0x403a26['value']==0x1){_0x12adff[_0x5f4e('0x61')]('`'+_0x403a26[_0x5f4e('0x48')]+_0x5f4e('0x62'));}else{_0x12adff[_0x5f4e('0x61')]('`'+_0x403a26[_0x5f4e('0x48')]+'`\x20>\x200');}break;case'Contact':if(_0x403a26['operator']===_0x5f4e('0x63')){if(_0x403a26[_0x5f4e('0x64')][_0x5f4e('0x65')]('\x20')[_0x5f4e('0x43')]>0x1){_0x16de78[_0x170e19](_0x5f4e('0x66'),qs[_0x5f4e('0x67')](_0x403a26['value']),null);}else{var _0x442d70='%'+_0x403a26[_0x5f4e('0x64')]+'%';_0x16de78[_0x170e19](_0x5f4e('0x68'),_0x442d70,_0x442d70,_0x442d70);}}else{_0xaa1de8=_[_0x5f4e('0x60')](_0x4a7972,['name',_0x5f4e('0x69')]);_0x403a26[_0x5f4e('0x48')]=_0x5f4e('0x69');_0x4f4611=as['buildExpression'](_0x425cff,_0xaa1de8[_0x5f4e('0x3a')],_0x403a26);_0x16de78[_0x170e19](_0x4f4611[_0x5f4e('0x6a')],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x6b')],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x2b')]);}break;case _0x5f4e('0x6c'):var _0x3f214e=_0x403a26[_0x5f4e('0x64')][_0x5f4e('0x65')](',')[_0x5f4e('0x30')](function(_0xa8788c){return Number(_0xa8788c);});_0x3f214e[_0x5f4e('0x34')](function(_0x110185){_0x59aa1b['or'](_0x5f4e('0x6d'),'%,'+_0x110185+',%');});_0x100703=_['union'](_0x100703,_0x3f214e);break;case _0x5f4e('0x6e'):if(_0x403a26[_0x5f4e('0x6f')]==='$substring'){_0x16de78[_0x170e19](_0x5f4e('0x70'),'%'+_0x403a26[_0x5f4e('0x64')]+'%',null);}else{_0xaa1de8=_['find'](_0x4a7972,[_0x5f4e('0x2e'),_0x5f4e('0x71')]);_0x403a26[_0x5f4e('0x48')]=_0x5f4e('0x71');_0x4f4611=as[_0x5f4e('0x72')](_0x425cff,_0xaa1de8['type'],_0x403a26);_0x16de78[_0x170e19](_0x4f4611['text'],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x6b')],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x2b')]);}break;case'body':_0x4f4611=as[_0x5f4e('0x72')]('me',null,_0x403a26);_0x16de78[_0x170e19](_0x4f4611[_0x5f4e('0x6a')],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x6b')],_0x4f4611[_0x5f4e('0x64')]['end']);break;}}else{var _0x4f4611=as['buildExpression'](_0x425cff,_0xaa1de8[_0x5f4e('0x3a')],_0x403a26);_0x16de78[_0x170e19](_0x4f4611[_0x5f4e('0x6a')],_0x4f4611[_0x5f4e('0x64')]['start'],_0x4f4611[_0x5f4e('0x64')][_0x5f4e('0x2b')]);}}}else{var _0x555c37=_(_0x2b1f64[_0x5f4e('0x3d')])[_0x5f4e('0x3e')]()[_0x5f4e('0x30')](function(_0x2dc978){return _[_0x5f4e('0x73')](_0x4a7972,['name',_0x2dc978])?_0x2dc978:undefined;})[_0x5f4e('0x74')]()[_0x5f4e('0x64')]();if(!_[_0x5f4e('0x75')](_0x555c37)){_0x555c37[_0x5f4e('0x34')](function(_0x20de0b){if(_0x20de0b==='OpenchannelAccountId'){_0x12adff[_0x5f4e('0x46')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x2b1f64[_0x5f4e('0x3d')][_0x20de0b]));}else if(_0x20de0b==='createdAt'){var _0x94f3cb=JSON[_0x5f4e('0x76')](_0x2b1f64[_0x5f4e('0x3d')][_0x20de0b])['$gte'];var _0x59ae83=JSON['parse'](_0x2b1f64[_0x5f4e('0x3d')][_0x20de0b])[_0x5f4e('0x77')];_0x12adff[_0x5f4e('0x46')](_0x5f4e('0x78'),_0x94f3cb,_0x59ae83);}else{if(_0x2b1f64[_0x5f4e('0x3d')][_0x20de0b]===_0x5f4e('0x79')){_0x12adff[_0x5f4e('0x46')]('i.'+_0x20de0b+_0x5f4e('0x7a'));}else{_0x12adff[_0x5f4e('0x46')]('i.'+_0x20de0b+_0x5f4e('0x7b'),_0x2b1f64['query'][_0x20de0b]);}}});}if(_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x7c')]){if(_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x7c')]==0x1){_0x12adff[_0x5f4e('0x61')]('`unreadMessages`\x20=\x200');}else{_0x12adff[_0x5f4e('0x61')](_0x5f4e('0x7d'));}}if(_0x2b1f64[_0x5f4e('0x3d')]['tag']){_0x100703=_[_0x5f4e('0x7e')](_0x2b1f64['query']['tag'])?_0x2b1f64[_0x5f4e('0x3d')]['tag']:new Array(_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x7f')]);_0x100703[_0x5f4e('0x34')](function(_0x56672f){_0x59aa1b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x56672f+',%');});}if(_0x2b1f64['query'][_0x5f4e('0x80')]){var _0x23154c=_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x80')][_0x5f4e('0x81')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x5f4e('0x82'));if(qs[_0x5f4e('0x83')](_0x23154c)){_0x16de78['or']('i.id\x20LIKE\x20?',_0x23154c+'%');}else{_0x16de78['or'](_0x5f4e('0x84'),qs[_0x5f4e('0x67')](_0x23154c))['or'](_0x5f4e('0x85'),_0x23154c+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x23154c+'%');}}}_0x12adff[_0x5f4e('0x46')](_0x16de78);_0x12adff[_0x5f4e('0x86')](_0x5f4e('0x87'));var _0x38fb42={'type':db[_0x5f4e('0x88')]['QueryTypes'][_0x5f4e('0x89')],'raw':!![]};var _0x343baa=_0x12adff['clone']();_0x343baa[_0x5f4e('0x48')](_0x5f4e('0x87'));_0x343baa[_0x5f4e('0x48')](_0x5f4e('0x8a'),_0x5f4e('0x8b'));if(_0x56d264['order']){_0x56d264[_0x5f4e('0x44')]['forEach'](function(_0x29e235){_0x12adff[_0x5f4e('0x44')]('i.'+_0x29e235[0x0],_0x29e235[0x1]===_0x5f4e('0x8c')?![]:!![]);});}if(!_[_0x5f4e('0x75')](_0x100703)){_0x12adff[_0x5f4e('0x61')](_0x59aa1b);_0x343baa[_0x5f4e('0x46')](_0x5f4e('0x8d'),_0x100703);}BPromise[_0x5f4e('0x8e')]()[_0x5f4e('0x29')](function(){if(!_0x21579b){if(_0x2b1f64[_0x5f4e('0x3d')]['OpenchannelAccountId']||_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x8f')])return;_0x343baa[_0x5f4e('0x46')](_0x5f4e('0x90'));_0x12adff[_0x5f4e('0x46')](_0x5f4e('0x90'));return;}return _0x2b1f64[_0x5f4e('0x91')][_0x5f4e('0x92')]({'attributes':['id'],'raw':!![]})[_0x5f4e('0x29')](function(_0x1b979c){if(_[_0x5f4e('0x75')](_0x1b979c)){_0x343baa[_0x5f4e('0x46')](_0x5f4e('0x93'));_0x12adff[_0x5f4e('0x46')](_0x5f4e('0x93'));}else{_0x343baa[_0x5f4e('0x46')](_0x5f4e('0x94'),_['map'](_0x1b979c,'id'));_0x12adff['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x1b979c,'id'));}});})[_0x5f4e('0x29')](function(){db[_0x5f4e('0x95')]['query'](_0x343baa[_0x5f4e('0x96')](),_0x38fb42)['then'](function(_0x126f1a){_0xda9e10[_0x5f4e('0x97')]=_0x126f1a['length'];if(_0xda9e10[_0x5f4e('0x97')]===0x0)return[];return db[_0x5f4e('0x95')]['query'](_0x17ec2b[_0x5f4e('0x96')](),_0x38fb42)['then'](function(_0x364a9c){_0x4c4f57=_[_0x5f4e('0x98')](_0x364a9c,'id');_0x38fb42=_[_0x5f4e('0x99')](_0x38fb42,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b1f64[_0x5f4e('0x3d')][_0x5f4e('0x42')]){_0x56d264[_0x5f4e('0x41')][_0x5f4e('0x34')](function(_0x2a5a3d){_0x12adff['field']('i.'+_0x2a5a3d);});}else{_0x12adff['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5f4e('0x8b'));_0x12adff[_0x5f4e('0x48')](_0x5f4e('0x9a'),_0x5f4e('0x9b'));_0x12adff[_0x5f4e('0x48')](_0x5f4e('0x9c'),'Account.mandatoryDisposition');_0x12adff['field']('i.*');_0x12adff[_0x5f4e('0x48')](_0x5f4e('0x9d'),_0x5f4e('0x9e'));_0x12adff[_0x5f4e('0x48')](_0x5f4e('0x9f'),_0x5f4e('0xa0'));_0x12adff[_0x5f4e('0x48')](_0x5f4e('0xa1'),'Contact.email');_0x12adff[_0x5f4e('0x48')]('c.phone',_0x5f4e('0xa2'));_0x12adff[_0x5f4e('0x48')]('c.mobile',_0x5f4e('0xa3'));_0x12adff['field']('c.fax','Contact.fax');_0x12adff['field']('o.fullname',_0x5f4e('0xa4'));_0x12adff['field'](_0x5f4e('0xa5'),_0x5f4e('0xa6'));_0x12adff[_0x5f4e('0x48')](_0x5f4e('0xa7'),_0x5f4e('0x32'));}if(_0x56d264[_0x5f4e('0x22')])_0x12adff[_0x5f4e('0x22')](_0x56d264[_0x5f4e('0x22')]);if(_0x56d264[_0x5f4e('0x21')])_0x12adff[_0x5f4e('0x21')](_0x56d264[_0x5f4e('0x21')]);return db[_0x5f4e('0x95')]['query'](_0x12adff[_0x5f4e('0x96')](),_0x38fb42);})[_0x5f4e('0x29')](function(_0xa48eea){_0x2228f2[_0x5f4e('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x5f4e('0x30')](_0xa48eea,'id'));return db['sequelize']['query'](_0x2228f2[_0x5f4e('0x96')](),_0x38fb42)[_0x5f4e('0x29')](function(_0x523bf9){var _0x1b676f=_['groupBy'](_0x523bf9,_0x5f4e('0xa8'));var _0x443838=[];_0xa48eea[_0x5f4e('0x34')](function(_0x42dfd1){_0x443838['push'](updateOpenchannelInteraction(_0x42dfd1,_0x4c4f57,_0x1b676f));});return BPromise['all'](_0x443838);});});})['then'](function(_0x7a8093){_0xda9e10[_0x5f4e('0xa9')]=_0x7a8093;return _0xda9e10;})[_0x5f4e('0x29')](respondWithFilteredResult(_0x48a709,_0x56d264));})[_0x5f4e('0xaa')](handleError(_0x48a709,null));};exports['show']=function(_0x3e8450,_0x4c95f1){var _0x193ba8={'raw':![],'where':{'id':_0x3e8450[_0x5f4e('0xab')]['id']}},_0x54c376={};_0x54c376['model']=_[_0x5f4e('0x3e')](db[_0x5f4e('0x37')][_0x5f4e('0x38')]);_0x54c376[_0x5f4e('0x3d')]=_[_0x5f4e('0x3e')](_0x3e8450['query']);_0x54c376[_0x5f4e('0x3f')]=_[_0x5f4e('0x40')](_0x54c376[_0x5f4e('0x3c')],_0x54c376['query']);_0x193ba8[_0x5f4e('0x41')]=_[_0x5f4e('0x40')](_0x54c376['model'],qs[_0x5f4e('0x42')](_0x3e8450[_0x5f4e('0x3d')][_0x5f4e('0x42')]));_0x193ba8[_0x5f4e('0x41')]=_0x193ba8[_0x5f4e('0x41')][_0x5f4e('0x43')]?_0x193ba8['attributes']:_0x54c376['model'];if(_0x3e8450[_0x5f4e('0x3d')]['includeAll']){_0x193ba8[_0x5f4e('0xac')]=[{'all':!![]}];}_0x193ba8=_[_0x5f4e('0x99')]({},_0x193ba8,_0x3e8450[_0x5f4e('0xad')]);return db[_0x5f4e('0x37')]['find'](_0x193ba8)['then'](handleEntityNotFound(_0x4c95f1,null))[_0x5f4e('0x29')](respondWithResult(_0x4c95f1,null))['catch'](handleError(_0x4c95f1,null));};exports['create']=function(_0x2796a7,_0x337010){return db[_0x5f4e('0x37')][_0x5f4e('0xae')](_0x2796a7[_0x5f4e('0xaf')],{})[_0x5f4e('0x29')](respondWithResult(_0x337010,0xc9))[_0x5f4e('0xaa')](handleError(_0x337010,null));};exports['update']=function(_0x528aea,_0x304fbd){if(_0x528aea[_0x5f4e('0xaf')]['id']){delete _0x528aea[_0x5f4e('0xaf')]['id'];}return db[_0x5f4e('0x37')][_0x5f4e('0x60')]({'where':{'id':_0x528aea[_0x5f4e('0xab')]['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x304fbd,null))[_0x5f4e('0x29')](saveUpdates(_0x528aea[_0x5f4e('0xaf')],null))[_0x5f4e('0x29')](respondWithResult(_0x304fbd,null))['catch'](handleError(_0x304fbd,null));};exports['destroy']=function(_0x4d129e,_0x323f71){return db[_0x5f4e('0x37')][_0x5f4e('0x60')]({'where':{'id':_0x4d129e[_0x5f4e('0xab')]['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x323f71,null))[_0x5f4e('0x29')](removeEntity(_0x323f71,null))['catch'](handleError(_0x323f71,null));};exports[_0x5f4e('0xb0')]=function(_0x56c33e,_0x1db5a0){return db[_0x5f4e('0x37')][_0x5f4e('0xb0')]()['then'](respondWithResult(_0x1db5a0,null))['catch'](handleError(_0x1db5a0,null));};exports[_0x5f4e('0xb1')]=function(_0x42009e,_0x4bfe8f,_0x661fcd){return db[_0x5f4e('0xb2')]['find']({'where':{'id':_0x42009e['params']['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x4bfe8f,null))['then'](function(_0x3d16be){if(_0x3d16be){return _0x3d16be[_0x5f4e('0xb1')](_0x42009e[_0x5f4e('0xaf')][_0x5f4e('0xb3')],_['omit'](_0x42009e[_0x5f4e('0xaf')],['ids','id'])||{});}})[_0x5f4e('0x29')](respondWithResult(_0x4bfe8f,null))[_0x5f4e('0xaa')](handleError(_0x4bfe8f,null));};exports[_0x5f4e('0xb4')]=function(_0x50a30e,_0x3ec14e,_0x4d043b){var _0x1beb2f={'raw':![],'where':{}};var _0x1b0588={};var _0x2a020f={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x50a30e['params']['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x3ec14e,null))[_0x5f4e('0x29')](function(_0x39c776){if(_0x39c776){_0x1b0588['model']=_[_0x5f4e('0x3e')](db['OpenchannelMessage'][_0x5f4e('0x38')]);_0x1b0588[_0x5f4e('0x3d')]=_[_0x5f4e('0x3e')](_0x50a30e[_0x5f4e('0x3d')]);_0x1b0588[_0x5f4e('0x3f')]=_[_0x5f4e('0x40')](_0x1b0588[_0x5f4e('0x3c')],_0x1b0588['query']);_0x1beb2f[_0x5f4e('0x41')]=_['intersection'](_0x1b0588[_0x5f4e('0x3c')],qs[_0x5f4e('0x42')](_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0x42')]));_0x1beb2f[_0x5f4e('0x41')]=_0x1beb2f[_0x5f4e('0x41')][_0x5f4e('0x43')]?_0x1beb2f[_0x5f4e('0x41')]:_0x1b0588[_0x5f4e('0x3c')];if(!_0x50a30e[_0x5f4e('0x3d')]['hasOwnProperty'](_0x5f4e('0xb5'))){_0x1beb2f[_0x5f4e('0x22')]=qs[_0x5f4e('0x22')](_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0x22')]);_0x1beb2f['offset']=qs[_0x5f4e('0x21')](_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0x21')]);}_0x1beb2f[_0x5f4e('0x44')]=qs['sort'](_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0x45')]);_0x1beb2f[_0x5f4e('0x46')]=qs[_0x5f4e('0x3f')](_[_0x5f4e('0x47')](_0x50a30e['query'],_0x1b0588[_0x5f4e('0x3f')]));_0x1beb2f['where'][_0x5f4e('0xa8')]=_0x39c776['id'];if(_0x50a30e[_0x5f4e('0x3d')]['filter']){_0x1beb2f[_0x5f4e('0x46')]=_[_0x5f4e('0x99')](_0x1beb2f['where'],{'$or':_['map'](_0x1beb2f['attributes'],function(_0x37ba50){var _0x4fa49e={};_0x4fa49e[_0x37ba50]={'$like':'%'+_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0x80')]+'%'};return _0x4fa49e;})});}if(_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0xb6')]){var _0x288aa1=_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0xb6')][_0x5f4e('0x65')](',');var _0x2a778a={};_0x2a778a[_0x288aa1[0x0]]={'$gte':moment(_0x288aa1[0x1])[_0x5f4e('0xb7')](_0x5f4e('0xb8'))};_0x1beb2f[_0x5f4e('0x46')]=_[_0x5f4e('0x99')](_0x1beb2f['where'],_0x2a778a);}_0x1beb2f=_[_0x5f4e('0x99')]({},_0x1beb2f,_0x50a30e[_0x5f4e('0xad')]);return db[_0x5f4e('0xb2')][_0x5f4e('0x97')]({'where':_0x1beb2f[_0x5f4e('0x46')]})[_0x5f4e('0x29')](function(_0x23253d){_0x2a020f[_0x5f4e('0x97')]=_0x23253d;if(_0x50a30e[_0x5f4e('0x3d')][_0x5f4e('0xb9')]){_0x1beb2f['include']=[{'all':!![]}];}return db[_0x5f4e('0xb2')][_0x5f4e('0xba')](_0x1beb2f);})[_0x5f4e('0x29')](function(_0x328213){_0x2a020f[_0x5f4e('0xa9')]=_0x328213;return _0x2a020f;});}})['then'](respondWithFilteredResult(_0x3ec14e,_0x1beb2f))[_0x5f4e('0xaa')](handleError(_0x3ec14e,null));};exports[_0x5f4e('0xbb')]=function(_0x358a01,_0x1c7273,_0x299ae5){return db[_0x5f4e('0x37')][_0x5f4e('0x60')]({'where':{'id':_0x358a01[_0x5f4e('0xab')]['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x1c7273,null))[_0x5f4e('0x29')](function(_0x3667fe){if(_0x3667fe){return _0x3667fe[_0x5f4e('0xbc')](_0x358a01[_0x5f4e('0xaf')]['ids'],_[_0x5f4e('0xbd')](_0x358a01[_0x5f4e('0xaf')],[_0x5f4e('0xb3'),'id'])||{})[_0x5f4e('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0x5f4e('0x2e'),_0x5f4e('0x49')],'where':{'id':_0x358a01[_0x5f4e('0xaf')][_0x5f4e('0xb3')]}});})[_0x5f4e('0x29')](function(_0xb7d7b5){socket[_0x5f4e('0xbf')](_0x5f4e('0xc0'),{'id':Number(_0x358a01['params']['id']),'tags':_0xb7d7b5||[]});return{'id':Number(_0x358a01[_0x5f4e('0xab')]['id']),'tags':_0xb7d7b5||[]};});}})[_0x5f4e('0x29')](respondWithResult(_0x1c7273,null))[_0x5f4e('0xaa')](handleError(_0x1c7273,null));};exports[_0x5f4e('0xc1')]=function(_0x3f95ce,_0x5d3de7,_0x52746e){return db[_0x5f4e('0x37')][_0x5f4e('0x60')]({'where':{'id':_0x3f95ce[_0x5f4e('0xab')]['id']}})[_0x5f4e('0x29')](handleEntityNotFound(_0x5d3de7,null))['then'](function(_0x5f22cf){if(_0x5f22cf){return _0x5f22cf[_0x5f4e('0xc1')](_0x3f95ce['query'][_0x5f4e('0xb3')]);}})[_0x5f4e('0x29')](respondWithStatusCode(_0x5d3de7,null))[_0x5f4e('0xaa')](handleError(_0x5d3de7,null));};exports['download']=function(_0x29f125,_0x2b8035){var _0x55691c=moment()[_0x5f4e('0xc2')]()[_0x5f4e('0x96')]();var _0x5663a1=path['join'](config[_0x5f4e('0xc3')],'server',_0x5f4e('0xc4'),_0x5f4e('0xc5'));var _0x253dc4=path['join'](config[_0x5f4e('0xc3')],_0x5f4e('0xc6'),_0x5f4e('0xc4'),'attachments');var _0xdedd2a=path[_0x5f4e('0xc7')](_0x5663a1,_0x55691c);var _0x4ecead=util[_0x5f4e('0xb7')](_0x5f4e('0xc8'),_0x29f125[_0x5f4e('0xab')]['id'],_0x55691c);var _0x29cd39=path[_0x5f4e('0xc7')](_0x5663a1,_0x4ecead);var _0x2798b0=[];_0x2798b0[_0x5f4e('0x35')]({'model':db[_0x5f4e('0x6e')],'as':_0x5f4e('0x6e'),'attributes':['id',_0x5f4e('0x31')],'raw':!![]});_0x2798b0['push']({'model':db[_0x5f4e('0xc9')],'as':_0x5f4e('0xca'),'attributes':['id','firstName',_0x5f4e('0xcb')],'raw':!![]});if(_0x29f125[_0x5f4e('0x3d')][_0x5f4e('0xcc')]){_0x2798b0[_0x5f4e('0x35')]({'model':db[_0x5f4e('0xcd')],'as':_0x5f4e('0xcd'),'raw':!![]});}var _0x1c9ad5=[{'model':db[_0x5f4e('0xb2')],'as':_0x5f4e('0xce'),'attributes':['id',_0x5f4e('0xaf'),_0x5f4e('0xcf'),_0x5f4e('0xd0'),_0x5f4e('0xd1'),_0x5f4e('0x7c')],'include':_0x2798b0}];_0x1c9ad5[_0x5f4e('0x35')]({'model':db[_0x5f4e('0xd2')],'as':'Account','attributes':['id',_0x5f4e('0x2e')]});_0x1c9ad5[_0x5f4e('0x35')]({'model':db['User'],'as':_0x5f4e('0xd3'),'attributes':['id',_0x5f4e('0x31')]});return db[_0x5f4e('0x37')]['find']({'where':{'id':_0x29f125[_0x5f4e('0xab')]['id']},'include':_0x1c9ad5})[_0x5f4e('0x29')](handleEntityNotFound(_0x2b8035,null))[_0x5f4e('0x29')](function(_0x3f241d){if(_0x3f241d){var _0x249323=_0x3f241d[_0x5f4e('0xd4')]({'plain':!![]});fs[_0x5f4e('0xd5')](_0xdedd2a);var _0x21aaa1={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x5f4e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x5f4e('0xb7')](_0x5f4e('0xd7'),util[_0x5f4e('0xb7')](_0x5f4e('0xd8'),_0x5f4e('0xd9'),_0x249323['id']),moment()[_0x5f4e('0xb7')](_0x5f4e('0xda'))['toString']())}}};var _0x23ecc9={'channel':_0x5f4e('0xd9'),'account':_0x249323[_0x5f4e('0xdb')][_0x5f4e('0x2e')],'agent':_0x249323['Owner']?_0x249323['Owner'][_0x5f4e('0x31')]:_0x5f4e('0xdc'),'createdAt':moment(_0x249323[_0x5f4e('0xcf')])['format'](_0x5f4e('0xb8'))[_0x5f4e('0x96')](),'closedAt':_0x249323[_0x5f4e('0xdd')]?moment(_0x249323[_0x5f4e('0xde')])[_0x5f4e('0xb7')](_0x5f4e('0xb8'))[_0x5f4e('0x96')]():'','disposition':_0x249323[_0x5f4e('0xdf')],'visibility':_0x249323[_0x5f4e('0xe0')]?_0x5f4e('0xe1'):_0x5f4e('0xe2'),'messages':_(_0x249323['Messages'])['filter']({'secret':![]})[_0x5f4e('0x30')](function(_0x96c47){if(_0x96c47[_0x5f4e('0xcd')]){var _0x30c446=path['join'](_0x253dc4,_0x96c47[_0x5f4e('0xcd')][_0x5f4e('0xe3')]);if(fs[_0x5f4e('0xe4')](_0x30c446)){fs[_0x5f4e('0xe5')](_0x30c446)['pipe'](fs[_0x5f4e('0xe6')](path[_0x5f4e('0xc7')](_0xdedd2a,_0x96c47['Attachment'][_0x5f4e('0xe3')])));}}return{'date':moment(_0x96c47[_0x5f4e('0xcf')])[_0x5f4e('0xb7')](_0x5f4e('0xb8'))[_0x5f4e('0x96')](),'sender':_0x96c47[_0x5f4e('0xd0')]===_0x5f4e('0xe7')?_0x96c47[_0x5f4e('0x6e')]?_0x96c47[_0x5f4e('0x6e')][_0x5f4e('0x31')]:_0x5f4e('0xe8'):_0x96c47[_0x5f4e('0xca')]['firstName']+(_0x96c47['Contact']['lastName']?'\x20'+_0x96c47[_0x5f4e('0xca')][_0x5f4e('0xcb')]:''),'body':_0x96c47[_0x5f4e('0xcd')]?_0x96c47['Attachment'][_0x5f4e('0xe3')]:_0x96c47['body'],'direction':_0x96c47[_0x5f4e('0xd0')]==='out'?'A':'C','secret':_0x96c47['secret'],'read':_0x96c47[_0x5f4e('0x7c')],'attachment':_0x96c47['Attachment']};})[_0x5f4e('0x64')]()};return ejs[_0x5f4e('0xe9')](path['join'](config[_0x5f4e('0xc3')],_0x5f4e('0xc6'),_0x5f4e('0xea'),_0x5f4e('0xeb')),{'interaction':_0x23ecc9})[_0x5f4e('0x29')](function(_0x42b89c){return new BPromise(function(_0x549fc4,_0x4bb279){pdf[_0x5f4e('0xae')](_0x42b89c,_0x21aaa1)[_0x5f4e('0xec')](path['join'](_0xdedd2a,_0x5f4e('0xed')+_0x249323['id']+'-'+_0x55691c+_0x5f4e('0xee')),function(_0x418b21,_0x462ef2){if(_0x418b21)return _0x4bb279(_0x418b21);_0x549fc4(_0x462ef2);});});})[_0x5f4e('0x29')](function(){return new BPromise(function(_0x194c5a,_0x145531){zipdir(_0xdedd2a,{'saveTo':_0x29cd39},function(_0x4643ff,_0x302c1f){if(_0x4643ff)return _0x145531(_0x4643ff);return _0x194c5a(_0x302c1f);});})[_0x5f4e('0x29')](function(){return new BPromise(function(_0x39a0aa,_0x3a6ea5){rimraf(_0xdedd2a,function(_0x421c67){if(_0x421c67)_0x3a6ea5(_0x421c67);return _0x39a0aa();});});})[_0x5f4e('0x29')](function(){return _0x2b8035[_0x5f4e('0xef')](_0x29cd39,_0x4ecead,function(_0x64399e){if(_0x64399e){console[_0x5f4e('0xf0')](_0x5f4e('0xf1'),_0x64399e);}else{fs[_0x5f4e('0xf2')](_0x29cd39);}});});});}else{return _0x2b8035['sendStatus'](0xc8);}})['catch'](handleError(_0x2b8035,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 23d476c..47b6dbd 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 _0x33d6=['emit','catch','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x18309f,_0x43df8f){var _0x2c0295=function(_0x46c5b1){while(--_0x46c5b1){_0x18309f['push'](_0x18309f['shift']());}};_0x2c0295(++_0x43df8f);}(_0x33d6,0x1bf));var _0x633d=function(_0x3bd738,_0x40be16){_0x3bd738=_0x3bd738-0x0;var _0x4005a8=_0x33d6[_0x3bd738];return _0x4005a8;};'use strict';var EventEmitter=require(_0x633d('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x633d('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x633d('0x2')](0x0);var events={'afterCreate':_0x633d('0x3'),'afterUpdate':'update','afterDestroy':_0x633d('0x4')};function emitEvent(_0x6b7464){return function(_0x4dd031,_0x306dbb,_0x4d3fe2){_0x4dd031[_0x633d('0x5')]({'attributes':['id'],'raw':!![]})[_0x633d('0x6')](function(_0x2cedff){_0x4dd031[_0x633d('0x7')](_0x633d('0x8'),_0x2cedff[_0x633d('0x9')](function(_0x570f86){return{'id':_0x570f86['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4dd031['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x589898){_0x4dd031[_0x633d('0x7')](_0x633d('0xa'),_0x589898[_0x633d('0xb')]);OpenchannelInteractionEvents[_0x633d('0xc')](_0x6b7464+':'+_0x4dd031['id'],_0x4dd031);OpenchannelInteractionEvents[_0x633d('0xc')](_0x6b7464,_0x4dd031);_0x4d3fe2(null);})[_0x633d('0xd')](_0x4d3fe2(null));};}for(var e in events){if(events[_0x633d('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x633d('0xf')](e,emitEvent(event));}}module[_0x633d('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2dff=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','map'];(function(_0x581b97,_0x4a4930){var _0xda75bc=function(_0x37ab02){while(--_0x37ab02){_0x581b97['push'](_0x581b97['shift']());}};_0xda75bc(++_0x4a4930);}(_0x2dff,0x18e));var _0xf2df=function(_0x91385d,_0x5dbeae){_0x91385d=_0x91385d-0x0;var _0x36eb56=_0x2dff[_0x91385d];return _0x36eb56;};'use strict';var EventEmitter=require(_0xf2df('0x0'));var OpenchannelInteraction=require(_0xf2df('0x1'))['db'][_0xf2df('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf2df('0x3')](0x0);var events={'afterCreate':_0xf2df('0x4'),'afterUpdate':'update','afterDestroy':_0xf2df('0x5')};function emitEvent(_0x6e6f1e){return function(_0x4db1b1,_0x42bcb1,_0x109780){_0x4db1b1[_0xf2df('0x6')]({'attributes':['id'],'raw':!![]})[_0xf2df('0x7')](function(_0x5152d5){_0x4db1b1[_0xf2df('0x8')]('Users',_0x5152d5[_0xf2df('0x9')](function(_0x933370){return{'id':_0x933370['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4db1b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf2df('0x7')](function(_0x4e9d15){_0x4db1b1[_0xf2df('0x8')](_0xf2df('0xa'),_0x4e9d15[_0xf2df('0xb')]);OpenchannelInteractionEvents[_0xf2df('0xc')](_0x6e6f1e+':'+_0x4db1b1['id'],_0x4db1b1);OpenchannelInteractionEvents['emit'](_0x6e6f1e,_0x4db1b1);_0x109780(null);})[_0xf2df('0xd')](_0x109780(null));};}for(var e in events){if(events[_0xf2df('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf2df('0xf')](e,emitEvent(event));}}module[_0xf2df('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1a62211..d0c4f13 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 _0x940b=['request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird'];(function(_0x2b4760,_0x5928d0){var _0xe041de=function(_0x107eaf){while(--_0x107eaf){_0x2b4760['push'](_0x2b4760['shift']());}};_0xe041de(++_0x5928d0);}(_0x940b,0x16c));var _0xb940=function(_0x475a7c,_0x5166bb){_0x475a7c=_0x475a7c-0x0;var _0x3260fa=_0x940b[_0x475a7c];return _0x3260fa;};'use strict';var _=require(_0xb940('0x0'));var util=require('util');var logger=require(_0xb940('0x1'))(_0xb940('0x2'));var moment=require('moment');var BPromise=require(_0xb940('0x3'));var rp=require(_0xb940('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb940('0x5'));var config=require(_0xb940('0x6'));var attributes=require(_0xb940('0x7'));module[_0xb940('0x8')]=function(_0x47f2ef,_0x12d1a0){return _0x47f2ef[_0xb940('0x9')](_0xb940('0xa'),attributes,{'tableName':_0xb940('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2609a3,_0x3f8508,_0x171dee){if(_0x2609a3[_0xb940('0xc')](_0xb940('0xd'))){_0x2609a3['closedAt']=moment()[_0xb940('0xe')](_0xb940('0xf'));}_0x171dee(null,_0x2609a3);}}});}; \ No newline at end of file +var _0x80c4=['define','openchannel_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x47d5bf,_0x5759ee){var _0xd2f47d=function(_0x20e7da){while(--_0x20e7da){_0x47d5bf['push'](_0x47d5bf['shift']());}};_0xd2f47d(++_0x5759ee);}(_0x80c4,0x9b));var _0x480c=function(_0x11141a,_0x669621){_0x11141a=_0x11141a-0x0;var _0x1c08c5=_0x80c4[_0x11141a];return _0x1c08c5;};'use strict';var _=require(_0x480c('0x0'));var util=require(_0x480c('0x1'));var logger=require(_0x480c('0x2'))('api');var moment=require(_0x480c('0x3'));var BPromise=require(_0x480c('0x4'));var rp=require(_0x480c('0x5'));var fs=require('fs');var path=require(_0x480c('0x6'));var rimraf=require(_0x480c('0x7'));var config=require(_0x480c('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x480c('0x9')]=function(_0x19a3a3,_0x1b0978){return _0x19a3a3[_0x480c('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x480c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36a032,_0x320cdc,_0x3357c7){if(_0x36a032[_0x480c('0xc')]('closed')){_0x36a032['closedAt']=moment()[_0x480c('0xd')](_0x480c('0xe'));}_0x3357c7(null,_0x36a032);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c911a43..8829d1c 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 _0x0440=['then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','body','options','where','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x5e66e9,_0x3f99c0){var _0x3c53b9=function(_0x535f91){while(--_0x535f91){_0x5e66e9['push'](_0x5e66e9['shift']());}};_0x3c53b9(++_0x3f99c0);}(_0x0440,0x1ea));var _0x0044=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x0440[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x0044('0x0'));var util=require(_0x0044('0x1'));var moment=require(_0x0044('0x2'));var BPromise=require(_0x0044('0x3'));var rs=require(_0x0044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0044('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0044('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0044('0x7')][_0x0044('0x8')]({'port':0x232a});config[_0x0044('0x9')]=_['defaults'](config[_0x0044('0x9')],{'host':_0x0044('0xa'),'port':0x18eb});var socket=require(_0x0044('0xb'))(new Redis(config[_0x0044('0x9')]));require('./openchannelInteraction.socket')[_0x0044('0xc')](socket);function respondWithRpcPromise(_0x379ac6,_0x33e8b0,_0x50c8c1){return new BPromise(function(_0x51477f,_0x44672f){return client[_0x0044('0xd')](_0x379ac6,_0x50c8c1)[_0x0044('0xe')](function(_0x276efe){logger[_0x0044('0xf')](_0x0044('0x10'),_0x33e8b0,_0x0044('0x11'));logger[_0x0044('0x12')](_0x0044('0x13'),_0x33e8b0,_0x0044('0x11'),JSON[_0x0044('0x14')](_0x276efe));if(_0x276efe[_0x0044('0x15')]){if(_0x276efe[_0x0044('0x15')][_0x0044('0x16')]===0x1f4){logger[_0x0044('0x15')](_0x0044('0x10'),_0x33e8b0,_0x276efe['error'][_0x0044('0x17')]);return _0x44672f(_0x276efe[_0x0044('0x15')][_0x0044('0x17')]);}logger[_0x0044('0x15')](_0x0044('0x10'),_0x33e8b0,_0x276efe[_0x0044('0x15')]['message']);return _0x51477f(_0x276efe[_0x0044('0x15')][_0x0044('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x33e8b0,_0x0044('0x11'));_0x51477f(_0x276efe[_0x0044('0x18')][_0x0044('0x17')]);}})['catch'](function(_0x267c9c){logger[_0x0044('0x15')](_0x0044('0x10'),_0x33e8b0,_0x267c9c);_0x44672f(_0x267c9c);});});}exports[_0x0044('0x19')]=function(_0x329084){var _0x51db6e=this;return new Promise(function(_0x5bb44d,_0x33bcc7){return db['OpenchannelInteraction']['update'](_0x329084[_0x0044('0x1a')],{'raw':_0x329084[_0x0044('0x1b')]?_0x329084[_0x0044('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x329084[_0x0044('0x1b')]?_0x329084[_0x0044('0x1b')][_0x0044('0x1c')]||null:null,'attributes':_0x329084[_0x0044('0x1b')]?_0x329084['options']['attributes']||null:null,'limit':_0x329084[_0x0044('0x1b')]?_0x329084['options'][_0x0044('0x1d')]||null:null})[_0x0044('0xe')](function(_0xa078c4){logger[_0x0044('0xf')](_0x0044('0x19'),_0x329084);logger[_0x0044('0x12')](_0x0044('0x19'),_0x329084,JSON[_0x0044('0x14')](_0xa078c4));_0x5bb44d(_0xa078c4);})['catch'](function(_0x2b8347){logger[_0x0044('0x15')](_0x0044('0x19'),_0x2b8347[_0x0044('0x17')],_0x329084);_0x33bcc7(_0x51db6e[_0x0044('0x15')](0x1f4,_0x2b8347[_0x0044('0x17')]));});});};exports[_0x0044('0x1e')]=function(_0x1c875e){return new Promise(function(_0x5607a8,_0x50e7c0){return db[_0x0044('0x1f')][_0x0044('0x20')]({'where':_0x1c875e[_0x0044('0x1b')]?_0x1c875e['options'][_0x0044('0x1c')]||null:null})[_0x0044('0xe')](function(_0x3f341f){if(_0x3f341f){return _0x3f341f['addTags'](_0x1c875e[_0x0044('0x1a')][_0x0044('0x21')],_['omit'](_0x1c875e[_0x0044('0x1a')],[_0x0044('0x21'),'id'])||{});}})['spread'](function(_0x19c907){logger[_0x0044('0xf')](_0x0044('0x22'),_0x1c875e);logger[_0x0044('0x12')]('AddTags',_0x1c875e,JSON[_0x0044('0x14')](_0x19c907));_0x5607a8(_0x19c907);})[_0x0044('0x23')](function(_0x4bacd7){logger[_0x0044('0x15')](_0x0044('0x22'),_0x4bacd7['message'],_0x1c875e);_0x50e7c0(_this['error'](0x1f4,_0x4bacd7[_0x0044('0x17')]));});});}; \ No newline at end of file +var _0x34f0=['rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','stringify','find','then','addTags','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5284a0,_0x2e5320){var _0x4518b1=function(_0x509580){while(--_0x509580){_0x5284a0['push'](_0x5284a0['shift']());}};_0x4518b1(++_0x2e5320);}(_0x34f0,0x1b0));var _0x034f=function(_0x4cb4ca,_0x689f2d){_0x4cb4ca=_0x4cb4ca-0x0;var _0x5c4b61=_0x34f0[_0x4cb4ca];return _0x5c4b61;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var moment=require(_0x034f('0x2'));var BPromise=require(_0x034f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x034f('0x4'));var db=require(_0x034f('0x5'))['db'];var utils=require(_0x034f('0x6'));var logger=require(_0x034f('0x7'))(_0x034f('0x8'));var config=require('../../config/environment');var jayson=require(_0x034f('0x9'));var client=jayson[_0x034f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x034f('0xb')](config[_0x034f('0xc')],{'host':_0x034f('0xd'),'port':0x18eb});var socket=require(_0x034f('0xe'))(new Redis(config['redis']));require(_0x034f('0xf'))['register'](socket);function respondWithRpcPromise(_0x51489c,_0x12b57b,_0x4ddd5d){return new BPromise(function(_0x48b0b1,_0x2083d8){return client[_0x034f('0x10')](_0x51489c,_0x4ddd5d)['then'](function(_0x14af21){logger[_0x034f('0x11')](_0x034f('0x12'),_0x12b57b,_0x034f('0x13'));logger[_0x034f('0x14')](_0x034f('0x15'),_0x12b57b,_0x034f('0x13'),JSON['stringify'](_0x14af21));if(_0x14af21['error']){if(_0x14af21[_0x034f('0x16')]['code']===0x1f4){logger[_0x034f('0x16')](_0x034f('0x12'),_0x12b57b,_0x14af21[_0x034f('0x16')][_0x034f('0x17')]);return _0x2083d8(_0x14af21[_0x034f('0x16')][_0x034f('0x17')]);}logger[_0x034f('0x16')](_0x034f('0x12'),_0x12b57b,_0x14af21[_0x034f('0x16')][_0x034f('0x17')]);return _0x48b0b1(_0x14af21['error'][_0x034f('0x17')]);}else{logger['info'](_0x034f('0x12'),_0x12b57b,'request\x20sent');_0x48b0b1(_0x14af21[_0x034f('0x18')][_0x034f('0x17')]);}})[_0x034f('0x19')](function(_0x346b28){logger[_0x034f('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x12b57b,_0x346b28);_0x2083d8(_0x346b28);});});}exports[_0x034f('0x1a')]=function(_0x4b715a){var _0x4a2a8e=this;return new Promise(function(_0x3572e4,_0x5aae7a){return db[_0x034f('0x1b')][_0x034f('0x1c')](_0x4b715a[_0x034f('0x1d')],{'raw':_0x4b715a[_0x034f('0x1e')]?_0x4b715a[_0x034f('0x1e')][_0x034f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b715a['options']?_0x4b715a[_0x034f('0x1e')][_0x034f('0x20')]||null:null,'attributes':_0x4b715a[_0x034f('0x1e')]?_0x4b715a[_0x034f('0x1e')][_0x034f('0x21')]||null:null,'limit':_0x4b715a[_0x034f('0x1e')]?_0x4b715a[_0x034f('0x1e')]['limit']||null:null})['then'](function(_0x21da38){logger[_0x034f('0x11')]('UpdateOpenchannelInteraction',_0x4b715a);logger[_0x034f('0x14')]('UpdateOpenchannelInteraction',_0x4b715a,JSON[_0x034f('0x22')](_0x21da38));_0x3572e4(_0x21da38);})[_0x034f('0x19')](function(_0x3ad58d){logger[_0x034f('0x16')](_0x034f('0x1a'),_0x3ad58d[_0x034f('0x17')],_0x4b715a);_0x5aae7a(_0x4a2a8e[_0x034f('0x16')](0x1f4,_0x3ad58d['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3d4539){return new Promise(function(_0x582004,_0x455998){return db[_0x034f('0x1b')][_0x034f('0x23')]({'where':_0x3d4539[_0x034f('0x1e')]?_0x3d4539['options']['where']||null:null})[_0x034f('0x24')](function(_0x339f48){if(_0x339f48){return _0x339f48[_0x034f('0x25')](_0x3d4539[_0x034f('0x1d')][_0x034f('0x26')],_['omit'](_0x3d4539[_0x034f('0x1d')],[_0x034f('0x26'),'id'])||{});}})['spread'](function(_0x19d298){logger[_0x034f('0x11')]('AddTags',_0x3d4539);logger[_0x034f('0x14')](_0x034f('0x27'),_0x3d4539,JSON[_0x034f('0x22')](_0x19d298));_0x582004(_0x19d298);})[_0x034f('0x19')](function(_0x9721ce){logger[_0x034f('0x16')](_0x034f('0x27'),_0x9721ce[_0x034f('0x17')],_0x3d4539);_0x455998(_this[_0x034f('0x16')](0x1f4,_0x9721ce['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 10d1bd3..fe5ca88 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 _0x0a39=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x453b02,_0x254027){var _0x36f141=function(_0x4365f0){while(--_0x4365f0){_0x453b02['push'](_0x453b02['shift']());}};_0x36f141(++_0x254027);}(_0x0a39,0x169));var _0x90a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0a39[_0x3ab51d];return _0x29a04e;};'use strict';var OpenchannelInteractionEvents=require(_0x90a3('0x0'));var events=['save',_0x90a3('0x1'),_0x90a3('0x2')];function createListener(_0x17df3b,_0x55e260){return function(_0x4061e0){_0x55e260[_0x90a3('0x3')](_0x17df3b,_0x4061e0);};}function removeListener(_0x1a743b,_0xf86b36){return function(){OpenchannelInteractionEvents[_0x90a3('0x4')](_0x1a743b,_0xf86b36);};}exports[_0x90a3('0x5')]=function(_0x5e3d8b){for(var _0x3f9301=0x0,_0x4a9922=events[_0x90a3('0x6')];_0x3f9301<_0x4a9922;_0x3f9301++){var _0x1176ea=events[_0x3f9301];var _0x21b665=createListener(_0x90a3('0x7')+_0x1176ea,_0x5e3d8b);OpenchannelInteractionEvents['on'](_0x1176ea,_0x21b665);}}; \ No newline at end of file +var _0x83b6=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x447af3,_0x381c44){var _0x202e95=function(_0x29daef){while(--_0x29daef){_0x447af3['push'](_0x447af3['shift']());}};_0x202e95(++_0x381c44);}(_0x83b6,0x1a3));var _0x683b=function(_0x302a2b,_0x43e2e1){_0x302a2b=_0x302a2b-0x0;var _0x4b1db2=_0x83b6[_0x302a2b];return _0x4b1db2;};'use strict';var OpenchannelInteractionEvents=require(_0x683b('0x0'));var events=[_0x683b('0x1'),_0x683b('0x2'),_0x683b('0x3')];function createListener(_0x47f879,_0x134c10){return function(_0x5c14d1){_0x134c10[_0x683b('0x4')](_0x47f879,_0x5c14d1);};}function removeListener(_0x29d35a,_0x5cbbbe){return function(){OpenchannelInteractionEvents[_0x683b('0x5')](_0x29d35a,_0x5cbbbe);};}exports[_0x683b('0x6')]=function(_0x2bc177){for(var _0x3652ea=0x0,_0x28687e=events[_0x683b('0x7')];_0x3652ea<_0x28687e;_0x3652ea++){var _0x438982=events[_0x3652ea];var _0x50abd2=createListener(_0x683b('0x8')+_0x438982,_0x2bc177);OpenchannelInteractionEvents['on'](_0x438982,_0x50abd2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b814602..f19853c 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 _0xe887=['show','create','put','/:id','update','/:id/accept','accept','/:id/reject','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1a017c,_0x3914ec){var _0x178e98=function(_0x56cba3){while(--_0x56cba3){_0x1a017c['push'](_0x1a017c['shift']());}};_0x178e98(++_0x3914ec);}(_0xe887,0x1d5));var _0x7e88=function(_0x5b1cd4,_0x2beace){_0x5b1cd4=_0x5b1cd4-0x0;var _0x52b5ee=_0xe887[_0x5b1cd4];return _0x52b5ee;};'use strict';var multer=require('multer');var util=require(_0x7e88('0x0'));var path=require(_0x7e88('0x1'));var timeout=require(_0x7e88('0x2'));var express=require(_0x7e88('0x3'));var router=express['Router']();var auth=require(_0x7e88('0x4'));var interaction=require(_0x7e88('0x5'));var config=require('../../config/environment');var controller=require(_0x7e88('0x6'));router[_0x7e88('0x7')]('/',auth[_0x7e88('0x8')](),controller[_0x7e88('0x9')]);router[_0x7e88('0x7')](_0x7e88('0xa'),auth[_0x7e88('0x8')](),controller['describe']);router[_0x7e88('0x7')]('/:id',auth[_0x7e88('0x8')](),controller[_0x7e88('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelmessage:create'),controller[_0x7e88('0xc')]);router[_0x7e88('0xd')](_0x7e88('0xe'),auth[_0x7e88('0x8')](),controller[_0x7e88('0xf')]);router[_0x7e88('0xd')](_0x7e88('0x10'),auth['isAuthenticated'](),controller[_0x7e88('0x11')]);router[_0x7e88('0xd')](_0x7e88('0x12'),auth[_0x7e88('0x8')](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7e88('0x13')]=router; \ No newline at end of file +var _0xd5e4=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','post','openchannel','openchannelmessage:create','update','put','accept','/:id/reject'];(function(_0x9149cf,_0x38c9f6){var _0x19795b=function(_0x52a602){while(--_0x52a602){_0x9149cf['push'](_0x9149cf['shift']());}};_0x19795b(++_0x38c9f6);}(_0xd5e4,0x12c));var _0x4d5e=function(_0x11013c,_0x58fa62){_0x11013c=_0x11013c-0x0;var _0x105bbf=_0xd5e4[_0x11013c];return _0x105bbf;};'use strict';var multer=require(_0x4d5e('0x0'));var util=require('util');var path=require(_0x4d5e('0x1'));var timeout=require(_0x4d5e('0x2'));var express=require(_0x4d5e('0x3'));var router=express[_0x4d5e('0x4')]();var auth=require(_0x4d5e('0x5'));var interaction=require(_0x4d5e('0x6'));var config=require(_0x4d5e('0x7'));var controller=require(_0x4d5e('0x8'));router['get']('/',auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xa')]);router['get'](_0x4d5e('0xb'),auth['isAuthenticated'](),controller[_0x4d5e('0xc')]);router[_0x4d5e('0xd')](_0x4d5e('0xe'),auth[_0x4d5e('0x9')](),controller['show']);router[_0x4d5e('0xf')]('/',auth[_0x4d5e('0x9')](),interaction['tracked'](_0x4d5e('0x10'),_0x4d5e('0x11')),controller['create']);router['put'](_0x4d5e('0xe'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x12')]);router[_0x4d5e('0x13')]('/:id/accept',auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x14')]);router[_0x4d5e('0x13')](_0x4d5e('0x15'),auth[_0x4d5e('0x9')](),controller['reject']);router['delete'](_0x4d5e('0xe'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 592cd46..11fa032 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 _0xf4fc=['TEXT','BOOLEAN','ENUM','out','DATE','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf4fc,0x77));var _0xcf4f=function(_0x479e07,_0x454d2e){_0x479e07=_0x479e07-0x0;var _0x2a890f=_0xf4fc[_0x479e07];return _0x2a890f;};'use strict';var Sequelize=require('sequelize');module[_0xcf4f('0x0')]={'body':{'type':Sequelize[_0xcf4f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcf4f('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcf4f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf4f('0x3')]('in',_0xcf4f('0x4')),'defaultValue':_0xcf4f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcf4f('0x5')]}}; \ No newline at end of file +var _0x5576=['exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x3e75a1,_0x47051b){var _0x456c32=function(_0x2df63e){while(--_0x2df63e){_0x3e75a1['push'](_0x3e75a1['shift']());}};_0x456c32(++_0x47051b);}(_0x5576,0x96));var _0x6557=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5576[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require('sequelize');module[_0x6557('0x0')]={'body':{'type':Sequelize['TEXT'](_0x6557('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6557('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6557('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6557('0x3')]('in',_0x6557('0x4')),'defaultValue':_0x6557('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6557('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 87410ec..3eded2a 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 _0x7b15=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.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','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','create','body','catch','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','CmContact','Contact','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','stringify','null','manual','SIP/%s','channel','EventManager','acceptmessage','agent','OpenchannelInteractionId','info','role','RejectMessage','event','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x7b15,0xea));var _0x57b1=function(_0xc5e658,_0x1383b3){_0xc5e658=_0xc5e658-0x0;var _0x382a75=_0x7b15[_0xc5e658];return _0x382a75;};'use strict';var pdf=require(_0x57b1('0x0'));var emlformat=require(_0x57b1('0x1'));var rimraf=require(_0x57b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57b1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x57b1('0x4'));var Mustache=require(_0x57b1('0x5'));var util=require(_0x57b1('0x6'));var path=require(_0x57b1('0x7'));var sox=require(_0x57b1('0x8'));var csv=require(_0x57b1('0x9'));var ejs=require(_0x57b1('0xa'));var fs=require('fs');var _=require(_0x57b1('0xb'));var squel=require('squel');var crypto=require(_0x57b1('0xc'));var jsforce=require(_0x57b1('0xd'));var deskjs=require(_0x57b1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57b1('0xf'));var Papa=require(_0x57b1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x57b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57b1('0x12'))(_0x57b1('0x13'));var utils=require('../../config/utils');var config=require(_0x57b1('0x14'));var db=require(_0x57b1('0x15'))['db'];config['redis']=_[_0x57b1('0x16')](config[_0x57b1('0x17')],{'host':_0x57b1('0x18'),'port':0x18eb});var socket=require(_0x57b1('0x19'))(new Redis(config[_0x57b1('0x17')]));require(_0x57b1('0x1a'))[_0x57b1('0x1b')](socket);var jayson=require(_0x57b1('0x1c'));var client=jayson[_0x57b1('0x1d')][_0x57b1('0x1e')]({'port':0x232c});var client9002=jayson[_0x57b1('0x1d')][_0x57b1('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2acf86,_0x2b581d,_0x552627){if(_0x552627){var _0x34c66e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34c66e[_0x57b1('0x1f')](_0x2b581d)){return _0x2acf86;}else{throw new db['Sequelize'][(_0x57b1('0x20'))](_0x57b1('0x21'));}}else{return _0x2acf86;}}function respondWithRpcPromise(_0x1b78ae,_0x156cad,_0x38cee5,_0x3af027){return new BPromise(function(_0x3b10fa,_0x50962e){var _0x2389b5=_0x3af027||client;return _0x2389b5[_0x57b1('0x22')](_0x1b78ae,_0x38cee5)[_0x57b1('0x23')](function(_0x3de2a7){logger['info'](_0x57b1('0x24'),_0x156cad,'request\x20sent');logger[_0x57b1('0x25')](_0x57b1('0x26'),_0x156cad,_0x57b1('0x27'),JSON['stringify'](_0x3de2a7));if(_0x3de2a7[_0x57b1('0x28')]){if(_0x3de2a7['error'][_0x57b1('0x29')]===0x1f4){logger[_0x57b1('0x28')](_0x57b1('0x24'),_0x156cad,_0x3de2a7[_0x57b1('0x28')][_0x57b1('0x2a')]);return _0x50962e(_0x3de2a7['error'][_0x57b1('0x2a')]);}logger[_0x57b1('0x28')](_0x57b1('0x24'),_0x156cad,_0x3de2a7[_0x57b1('0x28')]['message']);return _0x3b10fa(_0x3de2a7[_0x57b1('0x28')][_0x57b1('0x2a')]);}else{logger['info'](_0x57b1('0x24'),_0x156cad,_0x57b1('0x27'));_0x3b10fa(_0x3de2a7[_0x57b1('0x2b')][_0x57b1('0x2a')]);}})['catch'](function(_0x2d755f){logger[_0x57b1('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x156cad,_0x2d755f);_0x50962e(_0x2d755f);});});}function respondWithStatusCode(_0x5b6b7f,_0x1b2eb4){_0x1b2eb4=_0x1b2eb4||0xcc;return function(_0x401d9c){if(_0x401d9c){return _0x5b6b7f['sendStatus'](_0x1b2eb4);}return _0x5b6b7f['status'](_0x1b2eb4)[_0x57b1('0x2c')]();};}function respondWithResult(_0x23ff1a,_0x9b1484){_0x9b1484=_0x9b1484||0xc8;return function(_0x5ecb45){if(_0x5ecb45){return _0x23ff1a[_0x57b1('0x2d')](_0x9b1484)[_0x57b1('0x2e')](_0x5ecb45);}};}function respondWithFilteredResult(_0x139d93,_0x337ac6){return function(_0x2876fc){if(_0x2876fc){var _0x158aea=_0x2876fc[_0x57b1('0x2f')],_0x5ec37d=_0x337ac6['offset'],_0x329f66=_0x337ac6[_0x57b1('0x30')]+_0x337ac6[_0x57b1('0x31')],_0x391419;if(_0x329f66>=_0x158aea){_0x329f66=_0x158aea;_0x391419=0xc8;}else{_0x391419=0xce;}_0x139d93['status'](_0x391419);return _0x139d93['set'](_0x57b1('0x32'),_0x5ec37d+'-'+_0x329f66+'/'+_0x158aea)['json'](_0x2876fc);}return null;};}function patchUpdates(_0xfe86ba){return function(_0x4a6cef){try{jsonpatch[_0x57b1('0x33')](_0x4a6cef,_0xfe86ba,!![]);}catch(_0x5b5e09){return BPromise[_0x57b1('0x34')](_0x5b5e09);}return _0x4a6cef[_0x57b1('0x35')]();};}function saveUpdates(_0x15b0e9,_0x2bb6d1){return function(_0x15c33c){if(_0x15c33c){return _0x15c33c[_0x57b1('0x36')](_0x15b0e9)[_0x57b1('0x23')](function(_0x26067a){return _0x26067a;});}return null;};}function removeEntity(_0x5a0de5,_0x4a9f87){return function(_0x5bdb5c){if(_0x5bdb5c){return _0x5bdb5c[_0x57b1('0x37')]()[_0x57b1('0x23')](function(){_0x5a0de5[_0x57b1('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b444,_0x59711e){return function(_0x76f0e8){if(!_0x76f0e8){_0x40b444[_0x57b1('0x38')](0x194);}return _0x76f0e8;};}function handleError(_0x26f917,_0x52130c){_0x52130c=_0x52130c||0x1f4;return function(_0x4eb27f){logger[_0x57b1('0x28')](_0x4eb27f[_0x57b1('0x39')]);if(_0x4eb27f['name']){delete _0x4eb27f[_0x57b1('0x3a')];}_0x26f917['status'](_0x52130c)[_0x57b1('0x3b')](_0x4eb27f);};}exports[_0x57b1('0x3c')]=function(_0x3ff432,_0x4616e5){var _0x42bad5={},_0x3d5994={},_0x5ee433={'count':0x0,'rows':[]};var _0x37091c=_[_0x57b1('0x3d')](db[_0x57b1('0x3e')][_0x57b1('0x3f')],function(_0x4834d7){return{'name':_0x4834d7['fieldName'],'type':_0x4834d7['type'][_0x57b1('0x40')]};});_0x3d5994['model']=_['map'](_0x37091c,_0x57b1('0x3a'));_0x3d5994[_0x57b1('0x41')]=_['keys'](_0x3ff432['query']);_0x3d5994[_0x57b1('0x42')]=_[_0x57b1('0x43')](_0x3d5994[_0x57b1('0x44')],_0x3d5994[_0x57b1('0x41')]);_0x42bad5[_0x57b1('0x45')]=_[_0x57b1('0x43')](_0x3d5994[_0x57b1('0x44')],qs[_0x57b1('0x46')](_0x3ff432['query'][_0x57b1('0x46')]));_0x42bad5['attributes']=_0x42bad5[_0x57b1('0x45')][_0x57b1('0x47')]?_0x42bad5[_0x57b1('0x45')]:_0x3d5994[_0x57b1('0x44')];if(!_0x3ff432[_0x57b1('0x41')][_0x57b1('0x48')](_0x57b1('0x49'))){_0x42bad5[_0x57b1('0x31')]=qs['limit'](_0x3ff432[_0x57b1('0x41')][_0x57b1('0x31')]);_0x42bad5[_0x57b1('0x30')]=qs['offset'](_0x3ff432[_0x57b1('0x41')][_0x57b1('0x30')]);}_0x42bad5['order']=qs[_0x57b1('0x4a')](_0x3ff432[_0x57b1('0x41')]['sort']);_0x42bad5[_0x57b1('0x4b')]=qs[_0x57b1('0x42')](_[_0x57b1('0x4c')](_0x3ff432[_0x57b1('0x41')],_0x3d5994[_0x57b1('0x42')]),_0x37091c);if(_0x3ff432['query'][_0x57b1('0x4d')]){_0x42bad5[_0x57b1('0x4b')]=_['merge'](_0x42bad5[_0x57b1('0x4b')],{'$or':_['map'](_0x37091c,function(_0xcff74b){if(_0xcff74b['type']!==_0x57b1('0x4e')){var _0x10f3ce={};_0x10f3ce[_0xcff74b['name']]={'$like':'%'+_0x3ff432['query']['filter']+'%'};return _0x10f3ce;}})});}_0x42bad5=_[_0x57b1('0x4f')]({},_0x42bad5,_0x3ff432[_0x57b1('0x50')]);var _0x370b1d={'where':_0x42bad5[_0x57b1('0x4b')]};return db[_0x57b1('0x3e')][_0x57b1('0x2f')](_0x370b1d)[_0x57b1('0x23')](function(_0x206382){_0x5ee433[_0x57b1('0x2f')]=_0x206382;if(_0x3ff432[_0x57b1('0x41')][_0x57b1('0x51')]){_0x42bad5[_0x57b1('0x52')]=[{'all':!![]}];}return db[_0x57b1('0x3e')]['findAll'](_0x42bad5);})['then'](function(_0x46f6d6){_0x5ee433[_0x57b1('0x53')]=_0x46f6d6;return _0x5ee433;})[_0x57b1('0x23')](respondWithFilteredResult(_0x4616e5,_0x42bad5))['catch'](handleError(_0x4616e5,null));};exports[_0x57b1('0x54')]=function(_0x3e80ed,_0x5c7644){var _0x3c3858={'raw':!![],'where':{'id':_0x3e80ed[_0x57b1('0x55')]['id']}},_0x5e9515={};_0x5e9515[_0x57b1('0x44')]=_['keys'](db['OpenchannelMessage'][_0x57b1('0x3f')]);_0x5e9515['query']=_[_0x57b1('0x56')](_0x3e80ed[_0x57b1('0x41')]);_0x5e9515[_0x57b1('0x42')]=_[_0x57b1('0x43')](_0x5e9515[_0x57b1('0x44')],_0x5e9515['query']);_0x3c3858['attributes']=_['intersection'](_0x5e9515[_0x57b1('0x44')],qs[_0x57b1('0x46')](_0x3e80ed['query'][_0x57b1('0x46')]));_0x3c3858[_0x57b1('0x45')]=_0x3c3858['attributes']['length']?_0x3c3858[_0x57b1('0x45')]:_0x5e9515['model'];if(_0x3e80ed[_0x57b1('0x41')][_0x57b1('0x51')]){_0x3c3858[_0x57b1('0x52')]=[{'all':!![]}];}_0x3c3858=_[_0x57b1('0x4f')]({},_0x3c3858,_0x3e80ed[_0x57b1('0x50')]);return db[_0x57b1('0x3e')][_0x57b1('0x57')](_0x3c3858)[_0x57b1('0x23')](handleEntityNotFound(_0x5c7644,null))['then'](respondWithResult(_0x5c7644,null))['catch'](handleError(_0x5c7644,null));};exports[_0x57b1('0x58')]=function(_0x1e10fa,_0x23c5e1){return db[_0x57b1('0x3e')][_0x57b1('0x58')](_0x1e10fa[_0x57b1('0x59')],{})[_0x57b1('0x23')](respondWithResult(_0x23c5e1,0xc9))[_0x57b1('0x5a')](handleError(_0x23c5e1,null));};exports[_0x57b1('0x36')]=function(_0x2f929a,_0x189530){if(_0x2f929a[_0x57b1('0x59')]['id']){delete _0x2f929a[_0x57b1('0x59')]['id'];}return db[_0x57b1('0x3e')][_0x57b1('0x57')]({'where':{'id':_0x2f929a[_0x57b1('0x55')]['id']}})[_0x57b1('0x23')](handleEntityNotFound(_0x189530,null))[_0x57b1('0x23')](saveUpdates(_0x2f929a[_0x57b1('0x59')],null))[_0x57b1('0x23')](respondWithResult(_0x189530,null))['catch'](handleError(_0x189530,null));};exports[_0x57b1('0x37')]=function(_0x30e171,_0x393bfd){return db['OpenchannelMessage'][_0x57b1('0x57')]({'where':{'id':_0x30e171[_0x57b1('0x55')]['id']}})[_0x57b1('0x23')](handleEntityNotFound(_0x393bfd,null))[_0x57b1('0x23')](removeEntity(_0x393bfd,null))[_0x57b1('0x5a')](handleError(_0x393bfd,null));};exports[_0x57b1('0x5b')]=function(_0x5c8377,_0x443bec){return db[_0x57b1('0x3e')][_0x57b1('0x5b')]()['then'](respondWithResult(_0x443bec,null))[_0x57b1('0x5a')](handleError(_0x443bec,null));};var interaction_log=require('../../config/logger')(_0x57b1('0x5c'));exports[_0x57b1('0x5d')]=function(_0x55ea90,_0x5aa6da,_0x385183){var _0x5c74b0={'channel':_0x57b1('0x5e')};if(_0x55ea90[_0x57b1('0x59')]['id']){delete _0x55ea90[_0x57b1('0x59')]['id'];}_0x55ea90[_0x57b1('0x59')][_0x57b1('0x5f')]=!![];_0x55ea90['body'][_0x57b1('0x60')]=moment()[_0x57b1('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x55ea90[_0x57b1('0x59')]['UserId']=_0x55ea90['body'][_0x57b1('0x62')]||_0x55ea90[_0x57b1('0x63')]['id'];return db['OpenchannelMessage'][_0x57b1('0x57')]({'where':{'id':_0x55ea90[_0x57b1('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x57b1('0x64')],'as':_0x57b1('0x65')}]})[_0x57b1('0x23')](handleEntityNotFound(_0x5aa6da,null))[_0x57b1('0x23')](saveUpdates(_0x55ea90[_0x57b1('0x59')],null))[_0x57b1('0x23')](function(_0x3d614b){if(_0x3d614b){_0x5c74b0[_0x57b1('0x2a')]=_0x3d614b[_0x57b1('0x66')]({'plain':!![]});return db[_0x57b1('0x67')][_0x57b1('0x57')]({'where':{'id':_0x3d614b['OpenchannelInteractionId']}});}return null;})[_0x57b1('0x23')](handleEntityNotFound(_0x5aa6da,null))[_0x57b1('0x23')](function(_0x1fd6bb){if(_0x1fd6bb){return _0x1fd6bb[_0x57b1('0x36')]({'UserId':_0x55ea90[_0x57b1('0x59')][_0x57b1('0x62')],'read1stAt':_[_0x57b1('0x68')](_0x1fd6bb[_0x57b1('0x69')])?moment()[_0x57b1('0x61')](_0x57b1('0x6a')):undefined});}return null;})[_0x57b1('0x23')](function(_0x436a21){if(_0x436a21){_0x5c74b0[_0x57b1('0x6b')]=_0x436a21[_0x57b1('0x66')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55ea90['user']['id'],_0x55ea90[_0x57b1('0x63')][_0x57b1('0x3a')],_0x55ea90['user']['role'],_0x5c74b0['interaction']['id'],_0x55ea90[_0x57b1('0x59')]?JSON[_0x57b1('0x6c')](_0x55ea90[_0x57b1('0x59')]):_0x57b1('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5c74b0);}return null;})[_0x57b1('0x23')](function(_0xf2f26b){if(_0xf2f26b){if(_0x55ea90[_0x57b1('0x59')][_0x57b1('0x6e')]){_0x5c74b0[_0x57b1('0x2a')]['interface']=util['format'](_0x57b1('0x6f'),_0x55ea90[_0x57b1('0x63')][_0x57b1('0x3a')]);_0x5c74b0[_0x57b1('0x2a')][_0x57b1('0x70')]=_0x5c74b0['channel'];_0x5c74b0[_0x57b1('0x2a')]['event']='accept';return respondWithRpcPromise(_0x57b1('0x71'),_0x57b1('0x71'),{'event':_0x57b1('0x72'),'message':_0x5c74b0['message']},client9002)[_0x57b1('0x23')](function(){return _0x5c74b0;});}return _0x5c74b0;}return null;})[_0x57b1('0x23')](respondWithResult(_0x5aa6da,null))[_0x57b1('0x5a')](handleError(_0x5aa6da,null));};var interaction_log=require(_0x57b1('0x12'))(_0x57b1('0x5c'));exports[_0x57b1('0x34')]=function(_0x24b806,_0x4086c7,_0x44984b){var _0x44a499={'agent':{},'channel':_0x57b1('0x5e')};if(_0x24b806['body']['id']){delete _0x24b806[_0x57b1('0x59')]['id'];}_0x24b806[_0x57b1('0x59')][_0x57b1('0x62')]=_0x24b806[_0x57b1('0x59')][_0x57b1('0x62')]||_0x24b806[_0x57b1('0x63')]['id'];_0x44a499[_0x57b1('0x73')]['id']=_0x24b806['body']['UserId'];return db[_0x57b1('0x3e')][_0x57b1('0x57')]({'where':{'id':_0x24b806['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4086c7,null))[_0x57b1('0x23')](function(_0x3bf161){if(_0x3bf161){_0x44a499[_0x57b1('0x2a')]=_0x3bf161[_0x57b1('0x66')]({'plain':!![]});return db[_0x57b1('0x67')]['find']({'where':{'id':_0x3bf161[_0x57b1('0x74')]}});}return null;})[_0x57b1('0x23')](handleEntityNotFound(_0x4086c7,null))[_0x57b1('0x23')](function(_0x3e2669){if(_0x3e2669){_0x44a499[_0x57b1('0x6b')]=_0x3e2669[_0x57b1('0x66')]({'plain':!![]});interaction_log[_0x57b1('0x75')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24b806[_0x57b1('0x63')]['id'],_0x24b806[_0x57b1('0x63')][_0x57b1('0x3a')],_0x24b806[_0x57b1('0x63')][_0x57b1('0x76')],_0x44a499[_0x57b1('0x6b')]['id'],_0x24b806[_0x57b1('0x59')]?JSON['stringify'](_0x24b806[_0x57b1('0x59')]):_0x57b1('0x6d'));return respondWithRpcPromise(_0x57b1('0x77'),'rejectMessage',_0x44a499);}return null;})[_0x57b1('0x23')](function(_0x1c977a){if(_0x1c977a){_0x1c977a['message']['interface']=util[_0x57b1('0x61')](_0x57b1('0x6f'),_0x24b806[_0x57b1('0x63')][_0x57b1('0x3a')]);_0x1c977a[_0x57b1('0x2a')][_0x57b1('0x70')]=_0x44a499[_0x57b1('0x70')];_0x1c977a[_0x57b1('0x2a')][_0x57b1('0x78')]='reject';respondWithRpcPromise(_0x57b1('0x71'),_0x57b1('0x71'),{'event':'rejectmessage','message':_0x1c977a[_0x57b1('0x2a')]},client9002);return _0x44a499;}return null;})['then'](respondWithResult(_0x4086c7,null))[_0x57b1('0x5a')](handleError(_0x4086c7,null));}; \ No newline at end of file +var _0x8832=['../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.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','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','apply','save','update','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','OpenchannelInteractionId','isNil','read1stAt','format','interaction','get','user','null','acceptMessage','interface','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x8832,0x15f));var _0x2883=function(_0x50809e,_0x16161d){_0x50809e=_0x50809e-0x0;var _0x3d1d70=_0x8832[_0x50809e];return _0x3d1d70;};'use strict';var pdf=require(_0x2883('0x0'));var emlformat=require(_0x2883('0x1'));var rimraf=require(_0x2883('0x2'));var zipdir=require(_0x2883('0x3'));var jsonpatch=require(_0x2883('0x4'));var rp=require(_0x2883('0x5'));var moment=require(_0x2883('0x6'));var BPromise=require(_0x2883('0x7'));var Mustache=require(_0x2883('0x8'));var util=require(_0x2883('0x9'));var path=require(_0x2883('0xa'));var sox=require(_0x2883('0xb'));var csv=require(_0x2883('0xc'));var ejs=require(_0x2883('0xd'));var fs=require('fs');var _=require(_0x2883('0xe'));var squel=require(_0x2883('0xf'));var crypto=require(_0x2883('0x10'));var jsforce=require(_0x2883('0x11'));var deskjs=require(_0x2883('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2883('0x13'));var Redis=require(_0x2883('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2883('0x15'));var logger=require(_0x2883('0x16'))(_0x2883('0x17'));var utils=require(_0x2883('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2883('0x19')]=_[_0x2883('0x1a')](config[_0x2883('0x19')],{'host':_0x2883('0x1b'),'port':0x18eb});var socket=require(_0x2883('0x1c'))(new Redis(config[_0x2883('0x19')]));require(_0x2883('0x1d'))[_0x2883('0x1e')](socket);var jayson=require(_0x2883('0x1f'));var client=jayson[_0x2883('0x20')][_0x2883('0x21')]({'port':0x232c});var client9002=jayson[_0x2883('0x20')][_0x2883('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4c5173,_0x187c4,_0x4eb8e2){if(_0x4eb8e2){var _0x5626f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5626f6[_0x2883('0x22')](_0x187c4)){return _0x4c5173;}else{throw new db[(_0x2883('0x23'))]['ValidationError'](_0x2883('0x24'));}}else{return _0x4c5173;}}function respondWithRpcPromise(_0x5d4ce6,_0x5859b5,_0x40c661,_0x202038){return new BPromise(function(_0x3841a3,_0x82ab56){var _0x5767b7=_0x202038||client;return _0x5767b7[_0x2883('0x25')](_0x5d4ce6,_0x40c661)[_0x2883('0x26')](function(_0x2b490d){logger[_0x2883('0x27')](_0x2883('0x28'),_0x5859b5,_0x2883('0x29'));logger[_0x2883('0x2a')](_0x2883('0x2b'),_0x5859b5,_0x2883('0x29'),JSON[_0x2883('0x2c')](_0x2b490d));if(_0x2b490d[_0x2883('0x2d')]){if(_0x2b490d[_0x2883('0x2d')]['code']===0x1f4){logger[_0x2883('0x2d')]('OpenchannelMessage,\x20%s,\x20%s',_0x5859b5,_0x2b490d['error'][_0x2883('0x2e')]);return _0x82ab56(_0x2b490d[_0x2883('0x2d')][_0x2883('0x2e')]);}logger['error'](_0x2883('0x28'),_0x5859b5,_0x2b490d[_0x2883('0x2d')][_0x2883('0x2e')]);return _0x3841a3(_0x2b490d[_0x2883('0x2d')]['message']);}else{logger[_0x2883('0x27')](_0x2883('0x28'),_0x5859b5,'request\x20sent');_0x3841a3(_0x2b490d[_0x2883('0x2f')][_0x2883('0x2e')]);}})[_0x2883('0x30')](function(_0xfa06d4){logger['error'](_0x2883('0x28'),_0x5859b5,_0xfa06d4);_0x82ab56(_0xfa06d4);});});}function respondWithStatusCode(_0x23d37b,_0x289856){_0x289856=_0x289856||0xcc;return function(_0x65c736){if(_0x65c736){return _0x23d37b[_0x2883('0x31')](_0x289856);}return _0x23d37b['status'](_0x289856)['end']();};}function respondWithResult(_0x1a2d46,_0x1e479a){_0x1e479a=_0x1e479a||0xc8;return function(_0x295fe2){if(_0x295fe2){return _0x1a2d46[_0x2883('0x32')](_0x1e479a)[_0x2883('0x33')](_0x295fe2);}};}function respondWithFilteredResult(_0xed3709,_0x4b61f3){return function(_0x876edf){if(_0x876edf){var _0x5637f9=_0x876edf['count'],_0x44897d=_0x4b61f3['offset'],_0x997d51=_0x4b61f3[_0x2883('0x34')]+_0x4b61f3[_0x2883('0x35')],_0x4345a5;if(_0x997d51>=_0x5637f9){_0x997d51=_0x5637f9;_0x4345a5=0xc8;}else{_0x4345a5=0xce;}_0xed3709[_0x2883('0x32')](_0x4345a5);return _0xed3709['set']('Content-Range',_0x44897d+'-'+_0x997d51+'/'+_0x5637f9)[_0x2883('0x33')](_0x876edf);}return null;};}function patchUpdates(_0x1252f6){return function(_0x26fc99){try{jsonpatch[_0x2883('0x36')](_0x26fc99,_0x1252f6,!![]);}catch(_0x3b1d0d){return BPromise['reject'](_0x3b1d0d);}return _0x26fc99[_0x2883('0x37')]();};}function saveUpdates(_0x2fec98,_0x42d6fe){return function(_0x4cf2aa){if(_0x4cf2aa){return _0x4cf2aa[_0x2883('0x38')](_0x2fec98)[_0x2883('0x26')](function(_0x49e2d3){return _0x49e2d3;});}return null;};}function removeEntity(_0x5b01ce,_0x5c9fa4){return function(_0x5e6378){if(_0x5e6378){return _0x5e6378['destroy']()['then'](function(){_0x5b01ce[_0x2883('0x32')](0xcc)[_0x2883('0x39')]();});}};}function handleEntityNotFound(_0x249aa0,_0xed0270){return function(_0x3d6a57){if(!_0x3d6a57){_0x249aa0[_0x2883('0x31')](0x194);}return _0x3d6a57;};}function handleError(_0x5a5cf2,_0x14fdd7){_0x14fdd7=_0x14fdd7||0x1f4;return function(_0x2d0339){logger['error'](_0x2d0339['stack']);if(_0x2d0339['name']){delete _0x2d0339[_0x2883('0x3a')];}_0x5a5cf2[_0x2883('0x32')](_0x14fdd7)[_0x2883('0x3b')](_0x2d0339);};}exports[_0x2883('0x3c')]=function(_0x4ff1d3,_0x2db62f){var _0x5c4287={},_0x240c60={},_0x429df1={'count':0x0,'rows':[]};var _0x208465=_[_0x2883('0x3d')](db[_0x2883('0x3e')][_0x2883('0x3f')],function(_0x2f31d0){return{'name':_0x2f31d0[_0x2883('0x40')],'type':_0x2f31d0[_0x2883('0x41')]['key']};});_0x240c60[_0x2883('0x42')]=_[_0x2883('0x3d')](_0x208465,_0x2883('0x3a'));_0x240c60['query']=_[_0x2883('0x43')](_0x4ff1d3[_0x2883('0x44')]);_0x240c60[_0x2883('0x45')]=_[_0x2883('0x46')](_0x240c60[_0x2883('0x42')],_0x240c60[_0x2883('0x44')]);_0x5c4287[_0x2883('0x47')]=_[_0x2883('0x46')](_0x240c60[_0x2883('0x42')],qs[_0x2883('0x48')](_0x4ff1d3[_0x2883('0x44')][_0x2883('0x48')]));_0x5c4287[_0x2883('0x47')]=_0x5c4287['attributes'][_0x2883('0x49')]?_0x5c4287[_0x2883('0x47')]:_0x240c60[_0x2883('0x42')];if(!_0x4ff1d3[_0x2883('0x44')][_0x2883('0x4a')](_0x2883('0x4b'))){_0x5c4287[_0x2883('0x35')]=qs[_0x2883('0x35')](_0x4ff1d3['query']['limit']);_0x5c4287[_0x2883('0x34')]=qs[_0x2883('0x34')](_0x4ff1d3['query'][_0x2883('0x34')]);}_0x5c4287[_0x2883('0x4c')]=qs[_0x2883('0x4d')](_0x4ff1d3[_0x2883('0x44')][_0x2883('0x4d')]);_0x5c4287[_0x2883('0x4e')]=qs[_0x2883('0x45')](_[_0x2883('0x4f')](_0x4ff1d3[_0x2883('0x44')],_0x240c60[_0x2883('0x45')]),_0x208465);if(_0x4ff1d3['query'][_0x2883('0x50')]){_0x5c4287[_0x2883('0x4e')]=_[_0x2883('0x51')](_0x5c4287[_0x2883('0x4e')],{'$or':_[_0x2883('0x3d')](_0x208465,function(_0xf49333){if(_0xf49333['type']!==_0x2883('0x52')){var _0x307def={};_0x307def[_0xf49333[_0x2883('0x3a')]]={'$like':'%'+_0x4ff1d3[_0x2883('0x44')][_0x2883('0x50')]+'%'};return _0x307def;}})});}_0x5c4287=_[_0x2883('0x51')]({},_0x5c4287,_0x4ff1d3[_0x2883('0x53')]);var _0x2c19d1={'where':_0x5c4287[_0x2883('0x4e')]};return db[_0x2883('0x3e')][_0x2883('0x54')](_0x2c19d1)['then'](function(_0x14695e){_0x429df1[_0x2883('0x54')]=_0x14695e;if(_0x4ff1d3[_0x2883('0x44')][_0x2883('0x55')]){_0x5c4287[_0x2883('0x56')]=[{'all':!![]}];}return db[_0x2883('0x3e')][_0x2883('0x57')](_0x5c4287);})[_0x2883('0x26')](function(_0x44a2dc){_0x429df1[_0x2883('0x58')]=_0x44a2dc;return _0x429df1;})[_0x2883('0x26')](respondWithFilteredResult(_0x2db62f,_0x5c4287))[_0x2883('0x30')](handleError(_0x2db62f,null));};exports[_0x2883('0x59')]=function(_0x4c260c,_0x2ae475){var _0x18ed0c={'raw':!![],'where':{'id':_0x4c260c[_0x2883('0x5a')]['id']}},_0x6686c={};_0x6686c[_0x2883('0x42')]=_[_0x2883('0x43')](db['OpenchannelMessage'][_0x2883('0x3f')]);_0x6686c['query']=_['keys'](_0x4c260c[_0x2883('0x44')]);_0x6686c['filters']=_[_0x2883('0x46')](_0x6686c[_0x2883('0x42')],_0x6686c[_0x2883('0x44')]);_0x18ed0c[_0x2883('0x47')]=_[_0x2883('0x46')](_0x6686c['model'],qs[_0x2883('0x48')](_0x4c260c['query'][_0x2883('0x48')]));_0x18ed0c[_0x2883('0x47')]=_0x18ed0c[_0x2883('0x47')][_0x2883('0x49')]?_0x18ed0c['attributes']:_0x6686c[_0x2883('0x42')];if(_0x4c260c[_0x2883('0x44')][_0x2883('0x55')]){_0x18ed0c[_0x2883('0x56')]=[{'all':!![]}];}_0x18ed0c=_['merge']({},_0x18ed0c,_0x4c260c['options']);return db[_0x2883('0x3e')][_0x2883('0x5b')](_0x18ed0c)[_0x2883('0x26')](handleEntityNotFound(_0x2ae475,null))[_0x2883('0x26')](respondWithResult(_0x2ae475,null))[_0x2883('0x30')](handleError(_0x2ae475,null));};exports['create']=function(_0x3f826f,_0xde1c24){return db['OpenchannelMessage'][_0x2883('0x5c')](_0x3f826f[_0x2883('0x5d')],{})['then'](respondWithResult(_0xde1c24,0xc9))[_0x2883('0x30')](handleError(_0xde1c24,null));};exports['update']=function(_0x1833b4,_0x318497){if(_0x1833b4[_0x2883('0x5d')]['id']){delete _0x1833b4[_0x2883('0x5d')]['id'];}return db[_0x2883('0x3e')][_0x2883('0x5b')]({'where':{'id':_0x1833b4[_0x2883('0x5a')]['id']}})[_0x2883('0x26')](handleEntityNotFound(_0x318497,null))[_0x2883('0x26')](saveUpdates(_0x1833b4[_0x2883('0x5d')],null))[_0x2883('0x26')](respondWithResult(_0x318497,null))[_0x2883('0x30')](handleError(_0x318497,null));};exports['destroy']=function(_0x50119d,_0x1e6e19){return db[_0x2883('0x3e')]['find']({'where':{'id':_0x50119d[_0x2883('0x5a')]['id']}})[_0x2883('0x26')](handleEntityNotFound(_0x1e6e19,null))[_0x2883('0x26')](removeEntity(_0x1e6e19,null))[_0x2883('0x30')](handleError(_0x1e6e19,null));};exports['describe']=function(_0x28ec3c,_0x1b5094){return db['OpenchannelMessage'][_0x2883('0x5e')]()['then'](respondWithResult(_0x1b5094,null))[_0x2883('0x30')](handleError(_0x1b5094,null));};var interaction_log=require(_0x2883('0x16'))(_0x2883('0x5f'));exports[_0x2883('0x60')]=function(_0x4bd6de,_0x1ac038,_0x3fc0ed){var _0x5446dc={'channel':_0x2883('0x61')};if(_0x4bd6de[_0x2883('0x5d')]['id']){delete _0x4bd6de[_0x2883('0x5d')]['id'];}_0x4bd6de['body'][_0x2883('0x62')]=!![];_0x4bd6de[_0x2883('0x5d')][_0x2883('0x63')]=moment()['format'](_0x2883('0x64'));_0x4bd6de[_0x2883('0x5d')][_0x2883('0x65')]=_0x4bd6de[_0x2883('0x5d')][_0x2883('0x65')]||_0x4bd6de['user']['id'];return db['OpenchannelMessage'][_0x2883('0x5b')]({'where':{'id':_0x4bd6de[_0x2883('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x2883('0x66')}]})[_0x2883('0x26')](handleEntityNotFound(_0x1ac038,null))[_0x2883('0x26')](saveUpdates(_0x4bd6de[_0x2883('0x5d')],null))['then'](function(_0x397b44){if(_0x397b44){_0x5446dc[_0x2883('0x2e')]=_0x397b44['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x2883('0x5b')]({'where':{'id':_0x397b44[_0x2883('0x67')]}});}return null;})[_0x2883('0x26')](handleEntityNotFound(_0x1ac038,null))[_0x2883('0x26')](function(_0x3e8e6e){if(_0x3e8e6e){return _0x3e8e6e[_0x2883('0x38')]({'UserId':_0x4bd6de[_0x2883('0x5d')][_0x2883('0x65')],'read1stAt':_[_0x2883('0x68')](_0x3e8e6e[_0x2883('0x69')])?moment()[_0x2883('0x6a')](_0x2883('0x64')):undefined});}return null;})[_0x2883('0x26')](function(_0x1c4669){if(_0x1c4669){_0x5446dc[_0x2883('0x6b')]=_0x1c4669[_0x2883('0x6c')]({'plain':!![]});interaction_log[_0x2883('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4bd6de['user']['id'],_0x4bd6de['user'][_0x2883('0x3a')],_0x4bd6de[_0x2883('0x6d')]['role'],_0x5446dc[_0x2883('0x6b')]['id'],_0x4bd6de['body']?JSON[_0x2883('0x2c')](_0x4bd6de[_0x2883('0x5d')]):_0x2883('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x2883('0x6f'),_0x5446dc);}return null;})[_0x2883('0x26')](function(_0x1b39be){if(_0x1b39be){if(_0x4bd6de[_0x2883('0x5d')]['manual']){_0x5446dc['message'][_0x2883('0x70')]=util['format']('SIP/%s',_0x4bd6de['user'][_0x2883('0x3a')]);_0x5446dc[_0x2883('0x2e')][_0x2883('0x71')]=_0x5446dc[_0x2883('0x71')];_0x5446dc[_0x2883('0x2e')][_0x2883('0x72')]=_0x2883('0x60');return respondWithRpcPromise(_0x2883('0x73'),_0x2883('0x73'),{'event':_0x2883('0x74'),'message':_0x5446dc[_0x2883('0x2e')]},client9002)[_0x2883('0x26')](function(){return _0x5446dc;});}return _0x5446dc;}return null;})[_0x2883('0x26')](respondWithResult(_0x1ac038,null))[_0x2883('0x30')](handleError(_0x1ac038,null));};var interaction_log=require(_0x2883('0x16'))('openchannel-interactions');exports['reject']=function(_0x435b10,_0x449fb3,_0x1597d4){var _0x348de1={'agent':{},'channel':_0x2883('0x61')};if(_0x435b10[_0x2883('0x5d')]['id']){delete _0x435b10['body']['id'];}_0x435b10[_0x2883('0x5d')][_0x2883('0x65')]=_0x435b10[_0x2883('0x5d')][_0x2883('0x65')]||_0x435b10['user']['id'];_0x348de1[_0x2883('0x75')]['id']=_0x435b10[_0x2883('0x5d')][_0x2883('0x65')];return db[_0x2883('0x3e')]['find']({'where':{'id':_0x435b10[_0x2883('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x449fb3,null))[_0x2883('0x26')](function(_0x469d97){if(_0x469d97){_0x348de1['message']=_0x469d97[_0x2883('0x6c')]({'plain':!![]});return db[_0x2883('0x76')][_0x2883('0x5b')]({'where':{'id':_0x469d97[_0x2883('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x449fb3,null))[_0x2883('0x26')](function(_0x36a51d){if(_0x36a51d){_0x348de1[_0x2883('0x6b')]=_0x36a51d[_0x2883('0x6c')]({'plain':!![]});interaction_log[_0x2883('0x27')](_0x2883('0x77'),_0x435b10[_0x2883('0x6d')]['id'],_0x435b10[_0x2883('0x6d')][_0x2883('0x3a')],_0x435b10[_0x2883('0x6d')][_0x2883('0x78')],_0x348de1['interaction']['id'],_0x435b10[_0x2883('0x5d')]?JSON[_0x2883('0x2c')](_0x435b10[_0x2883('0x5d')]):_0x2883('0x6e'));return respondWithRpcPromise(_0x2883('0x79'),_0x2883('0x7a'),_0x348de1);}return null;})['then'](function(_0x34f20c){if(_0x34f20c){_0x34f20c['message'][_0x2883('0x70')]=util[_0x2883('0x6a')](_0x2883('0x7b'),_0x435b10[_0x2883('0x6d')][_0x2883('0x3a')]);_0x34f20c[_0x2883('0x2e')]['channel']=_0x348de1[_0x2883('0x71')];_0x34f20c['message'][_0x2883('0x72')]='reject';respondWithRpcPromise('EventManager',_0x2883('0x73'),{'event':'rejectmessage','message':_0x34f20c[_0x2883('0x2e')]},client9002);return _0x348de1;}return null;})[_0x2883('0x26')](respondWithResult(_0x449fb3,null))[_0x2883('0x30')](handleError(_0x449fb3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 213d669..edabced 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 _0x619d=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','save','remove'];(function(_0x4bbaba,_0x15097c){var _0x34ff2b=function(_0x190d49){while(--_0x190d49){_0x4bbaba['push'](_0x4bbaba['shift']());}};_0x34ff2b(++_0x15097c);}(_0x619d,0x18b));var _0xd619=function(_0x435104,_0x516d69){_0x435104=_0x435104-0x0;var _0x55b6ca=_0x619d[_0x435104];return _0x55b6ca;};'use strict';var EventEmitter=require(_0xd619('0x0'));var OpenchannelMessage=require(_0xd619('0x1'))['db'][_0xd619('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd619('0x3'),'afterUpdate':'update','afterDestroy':_0xd619('0x4')};function emitEvent(_0x1d8a54){return function(_0x18b92d,_0x36ff32,_0x14111f){OpenchannelMessageEvents[_0xd619('0x5')](_0x1d8a54+':'+_0x18b92d['id'],_0x18b92d);OpenchannelMessageEvents[_0xd619('0x5')](_0x1d8a54,_0x18b92d);_0x14111f(null);};}for(var e in events){if(events[_0xd619('0x6')](e)){var event=events[e];OpenchannelMessage[_0xd619('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x6094=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x4331f8,_0xa6f80a){var _0x140a86=function(_0x238a8a){while(--_0x238a8a){_0x4331f8['push'](_0x4331f8['shift']());}};_0x140a86(++_0xa6f80a);}(_0x6094,0xba));var _0x4609=function(_0x174790,_0x459acf){_0x174790=_0x174790-0x0;var _0x219266=_0x6094[_0x174790];return _0x219266;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4609('0x0'))['db'][_0x4609('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4609('0x2')](0x0);var events={'afterCreate':_0x4609('0x3'),'afterUpdate':_0x4609('0x4'),'afterDestroy':_0x4609('0x5')};function emitEvent(_0x2f89f2){return function(_0x5e8cf8,_0x3a58d0,_0x1aeebd){OpenchannelMessageEvents[_0x4609('0x6')](_0x2f89f2+':'+_0x5e8cf8['id'],_0x5e8cf8);OpenchannelMessageEvents[_0x4609('0x6')](_0x2f89f2,_0x5e8cf8);_0x1aeebd(null);};}for(var e in events){if(events[_0x4609('0x7')](e)){var event=events[e];OpenchannelMessage[_0x4609('0x8')](e,emitEvent(event));}}module[_0x4609('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4fab298..974a201 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 _0x0689=['OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','get','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','describe','OpenchannelAccount','find'];(function(_0x41568f,_0x7c6734){var _0x2b35e5=function(_0x486c48){while(--_0x486c48){_0x41568f['push'](_0x41568f['shift']());}};_0x2b35e5(++_0x7c6734);}(_0x0689,0x161));var _0x9068=function(_0x32c798,_0xd2fe15){_0x32c798=_0x32c798-0x0;var _0x429dbf=_0x0689[_0x32c798];return _0x429dbf;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x9068('0xb'),'fields':[_0x9068('0xc')],'type':_0x9068('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x77a2db,_0x1c63d2,_0xf611cf){var _0x451a17=_0x287846[_0x9068('0xe')];var _0x19204e=_0x77a2db['get']({'plain':!![]});if(_0x19204e[_0x9068('0xf')][_0x9068('0x10')]()==='in'||_0x19204e[_0x9068('0xf')][_0x9068('0x10')]()==='out'&&!_0x19204e[_0x9068('0x11')]&&!_[_0x9068('0x12')](_0x19204e[_0x9068('0x13')])){_0x451a17['OpenchannelInteraction'][_0x9068('0x14')]({'where':{'id':_0x19204e[_0x9068('0x15')]}})[_0x9068('0x16')](function(_0x479675){if(_0x479675){_0x479675[_0x9068('0x17')]({'lastMsgAt':_0x19204e[_0x9068('0x18')],'lastMsgDirection':_0x19204e['direction'][_0x9068('0x10')]()});}})[_0x9068('0x19')](function(_0x486714){console[_0x9068('0x1a')](_0x486714);});}if(_0x19204e[_0x9068('0xf')]===_0x9068('0x1b')&&!_0x19204e[_0x9068('0x11')]){var _0x576b34;_0x451a17[_0x9068('0x1c')][_0x9068('0x1d')]()[_0x9068('0x16')](function(_0x36d591){return _0x451a17[_0x9068('0x1e')][_0x9068('0x1f')]({'where':{'id':_0x19204e[_0x9068('0x20')]},'include':[{'model':_0x451a17[_0x9068('0x21')],'as':_0x9068('0x22'),'where':{'id':_0x19204e['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x451a17[_0x9068('0x1c')],'as':_0x9068('0x23'),'attributes':_[_0x9068('0x24')](_0x36d591)}]}]});})[_0x9068('0x16')](function(_0xb6bf1e){_0x576b34=_0xb6bf1e[_0x9068('0x25')]({'plain':!![]});if(_0x576b34&&_0x576b34[_0x9068('0x26')]){logger[_0x9068('0x27')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x9068('0x28'),_0x19204e['id'],_0x576b34['replyUri']));if(_0x576b34['Interactions']&&_0x576b34[_0x9068('0x22')][_0x9068('0x29')]){_0x19204e[_0x9068('0x2a')]=_[_0x9068('0x2b')](_0x576b34['Interactions'][0x0],_0x9068('0x23'));_0x19204e[_0x9068('0x23')]=_0x576b34[_0x9068('0x22')][0x0][_0x9068('0x23')];}var _0x1c63d2={'method':_0x9068('0x2c'),'uri':encodeURI(_0x576b34['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c63d2[_0x9068('0x2d')]){case _0x9068('0x2e'):_0x1c63d2['qs']=_0x19204e;break;case'POST':_0x1c63d2[_0x9068('0xc')]=_0x19204e;break;}return rp(_0x1c63d2)[_0x9068('0x16')](function(_0x54f0f2){logger['info'](_0x9068('0x2f'),'afterCreate',util[_0x9068('0x30')](_0x9068('0x31'),_0x19204e['id'],_0x576b34[_0x9068('0x26')]));if(_0x54f0f2[_0x9068('0xc')][_0x9068('0x32')]&&_0x54f0f2['body'][_0x9068('0x32')]!=_0x19204e[_0x9068('0x2a')][_0x9068('0x32')]){return _0x451a17[_0x9068('0x21')]['update']({'threadId':_0x54f0f2['body'][_0x9068('0x32')]},{'logging':!![],'where':{'id':_0x19204e[_0x9068('0x2a')]['id']}});}else{return;}})[_0x9068('0x16')](function(){return _0x77a2db[_0x9068('0x17')]({'read':!![]});})[_0x9068('0x19')](function(_0x386b68){logger[_0x9068('0x1a')](_0x9068('0x2f'),_0x9068('0x33'),util[_0x9068('0x34')](_0x386b68,{'showHidden':![],'depth':null}));_0xf611cf();});}else{_0xf611cf();}})['finally'](function(){_0xf611cf();});}else{_0xf611cf();}}},'charset':_0x9068('0x35'),'collate':_0x9068('0x36')});}; \ No newline at end of file +var _0x8b04=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','Interaction','omit','method','GET','POST','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','CmContact','find','OpenchannelInteractionId','Contact','keys'];(function(_0xfc3e1a,_0x1e8283){var _0x5d8ab0=function(_0x54d171){while(--_0x54d171){_0xfc3e1a['push'](_0xfc3e1a['shift']());}};_0x5d8ab0(++_0x1e8283);}(_0x8b04,0x130));var _0x48b0=function(_0x355000,_0x373def){_0x355000=_0x355000-0x0;var _0x317d0c=_0x8b04[_0x355000];return _0x317d0c;};'use strict';var _=require(_0x48b0('0x0'));var util=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var moment=require('moment');var BPromise=require(_0x48b0('0x3'));var rp=require(_0x48b0('0x4'));var fs=require('fs');var path=require(_0x48b0('0x5'));var rimraf=require(_0x48b0('0x6'));var config=require(_0x48b0('0x7'));var attributes=require(_0x48b0('0x8'));module[_0x48b0('0x9')]=function(_0x43e21c,_0x357849){return _0x43e21c[_0x48b0('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x48b0('0xb'),'paranoid':![],'indexes':[{'name':_0x48b0('0xc'),'fields':[_0x48b0('0xd')],'type':_0x48b0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ca1e6,_0x3baa46,_0x6f19eb){var _0x5bb6f3=_0x43e21c[_0x48b0('0xf')];var _0x3971a=_0x3ca1e6['get']({'plain':!![]});if(_0x3971a[_0x48b0('0x10')][_0x48b0('0x11')]()==='in'||_0x3971a['direction'][_0x48b0('0x11')]()===_0x48b0('0x12')&&!_0x3971a[_0x48b0('0x13')]&&!_[_0x48b0('0x14')](_0x3971a[_0x48b0('0x15')])){_0x5bb6f3[_0x48b0('0x16')][_0x48b0('0x17')]({'where':{'id':_0x3971a['OpenchannelInteractionId']}})[_0x48b0('0x18')](function(_0x5458f5){if(_0x5458f5){_0x5458f5[_0x48b0('0x19')]({'lastMsgAt':_0x3971a['createdAt'],'lastMsgDirection':_0x3971a[_0x48b0('0x10')][_0x48b0('0x11')]()});}})[_0x48b0('0x1a')](function(_0x37110c){console['error'](_0x37110c);});}if(_0x3971a[_0x48b0('0x10')]===_0x48b0('0x12')&&!_0x3971a[_0x48b0('0x13')]){var _0x4ccc45;_0x5bb6f3[_0x48b0('0x1b')]['describe']()['then'](function(_0xa002cb){return _0x5bb6f3['OpenchannelAccount'][_0x48b0('0x1c')]({'where':{'id':_0x3971a['OpenchannelAccountId']},'include':[{'model':_0x5bb6f3[_0x48b0('0x16')],'as':'Interactions','where':{'id':_0x3971a[_0x48b0('0x1d')]},'limit':0x1,'include':[{'model':_0x5bb6f3[_0x48b0('0x1b')],'as':_0x48b0('0x1e'),'attributes':_[_0x48b0('0x1f')](_0xa002cb)}]}]});})[_0x48b0('0x18')](function(_0x53e103){_0x4ccc45=_0x53e103['get']({'plain':!![]});if(_0x4ccc45&&_0x4ccc45['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x48b0('0x20'),util[_0x48b0('0x21')](_0x48b0('0x22'),_0x3971a['id'],_0x4ccc45[_0x48b0('0x23')]));if(_0x4ccc45['Interactions']&&_0x4ccc45[_0x48b0('0x24')]['length']){_0x3971a[_0x48b0('0x25')]=_[_0x48b0('0x26')](_0x4ccc45[_0x48b0('0x24')][0x0],_0x48b0('0x1e'));_0x3971a[_0x48b0('0x1e')]=_0x4ccc45['Interactions'][0x0]['Contact'];}var _0x3baa46={'method':'POST','uri':encodeURI(_0x4ccc45['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3baa46[_0x48b0('0x27')]){case _0x48b0('0x28'):_0x3baa46['qs']=_0x3971a;break;case _0x48b0('0x29'):_0x3baa46[_0x48b0('0xd')]=_0x3971a;break;}return rp(_0x3baa46)[_0x48b0('0x18')](function(_0x5b747f){logger[_0x48b0('0x2a')](_0x48b0('0x2b'),'afterCreate',util['format'](_0x48b0('0x2c'),_0x3971a['id'],_0x4ccc45[_0x48b0('0x23')]));if(_0x5b747f['body'][_0x48b0('0x2d')]&&_0x5b747f[_0x48b0('0xd')]['threadId']!=_0x3971a['Interaction'][_0x48b0('0x2d')]){return _0x5bb6f3[_0x48b0('0x16')][_0x48b0('0x19')]({'threadId':_0x5b747f[_0x48b0('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x3971a[_0x48b0('0x25')]['id']}});}else{return;}})['then'](function(){return _0x3ca1e6[_0x48b0('0x19')]({'read':!![]});})[_0x48b0('0x1a')](function(_0x3498b9){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x48b0('0x20'),util[_0x48b0('0x2e')](_0x3498b9,{'showHidden':![],'depth':null}));_0x6f19eb();});}else{_0x6f19eb();}})[_0x48b0('0x2f')](function(){_0x6f19eb();});}else{_0x6f19eb();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1dea037..1a49528 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 _0x9666=['info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9666,0x17a));var _0x6966=function(_0x57f9ad,_0x22a9b6){_0x57f9ad=_0x57f9ad-0x0;var _0x1028a2=_0x9666[_0x57f9ad];return _0x1028a2;};'use strict';var _=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var moment=require(_0x6966('0x2'));var BPromise=require(_0x6966('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6966('0x4'));var db=require(_0x6966('0x5'))['db'];var utils=require(_0x6966('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6966('0x7'));var jayson=require(_0x6966('0x8'));var client=jayson[_0x6966('0x9')][_0x6966('0xa')]({'port':0x232a});config[_0x6966('0xb')]=_[_0x6966('0xc')](config['redis'],{'host':_0x6966('0xd'),'port':0x18eb});var socket=require(_0x6966('0xe'))(new Redis(config[_0x6966('0xb')]));require('./openchannelMessage.socket')[_0x6966('0xf')](socket);function respondWithRpcPromise(_0x377666,_0x150ca1,_0x47578b){return new BPromise(function(_0x2961fd,_0x3bb5b1){return client[_0x6966('0x10')](_0x377666,_0x47578b)[_0x6966('0x11')](function(_0x276f89){logger[_0x6966('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x150ca1,'request\x20sent');logger['debug'](_0x6966('0x13'),_0x150ca1,_0x6966('0x14'),JSON[_0x6966('0x15')](_0x276f89));if(_0x276f89['error']){if(_0x276f89['error']['code']===0x1f4){logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);return _0x3bb5b1(_0x276f89[_0x6966('0x16')]['message']);}logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89['error'][_0x6966('0x18')]);return _0x2961fd(_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);}else{logger['info'](_0x6966('0x17'),_0x150ca1,'request\x20sent');_0x2961fd(_0x276f89[_0x6966('0x19')]['message']);}})['catch'](function(_0x5de186){logger[_0x6966('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x150ca1,_0x5de186);_0x3bb5b1(_0x5de186);});});}exports['CreateOpenchannelMessage']=function(_0x5e3128){var _0x4aae5d=this;return new Promise(function(_0x5e66b3,_0x197c2c){return db[_0x6966('0x1a')][_0x6966('0x1b')](_0x5e3128['body'],{'raw':_0x5e3128[_0x6966('0x1c')]?_0x5e3128[_0x6966('0x1c')][_0x6966('0x1d')]===undefined?!![]:![]:!![]})[_0x6966('0x11')](function(_0x33fc7f){logger[_0x6966('0x12')](_0x6966('0x1e'),_0x5e3128);logger[_0x6966('0x1f')](_0x6966('0x1e'),_0x5e3128,JSON['stringify'](_0x33fc7f));_0x5e66b3(_0x33fc7f);})[_0x6966('0x20')](function(_0x6f8663){logger[_0x6966('0x16')](_0x6966('0x1e'),_0x6f8663[_0x6966('0x18')],_0x5e3128);_0x197c2c(_0x4aae5d[_0x6966('0x16')](0x1f4,_0x6f8663[_0x6966('0x18')]));});});}; \ No newline at end of file +var _0xc6a2=['stringify','error','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x41f2c8,_0x58a26c){var _0x2338a9=function(_0x2b2faf){while(--_0x2b2faf){_0x41f2c8['push'](_0x41f2c8['shift']());}};_0x2338a9(++_0x58a26c);}(_0xc6a2,0x69));var _0x2c6a=function(_0x973981,_0x3daecd){_0x973981=_0x973981-0x0;var _0x5b4ab5=_0xc6a2[_0x973981];return _0x5b4ab5;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var moment=require('moment');var BPromise=require(_0x2c6a('0x2'));var rs=require(_0x2c6a('0x3'));var fs=require('fs');var Redis=require(_0x2c6a('0x4'));var db=require(_0x2c6a('0x5'))['db'];var utils=require(_0x2c6a('0x6'));var logger=require(_0x2c6a('0x7'))(_0x2c6a('0x8'));var config=require(_0x2c6a('0x9'));var jayson=require(_0x2c6a('0xa'));var client=jayson[_0x2c6a('0xb')][_0x2c6a('0xc')]({'port':0x232a});config[_0x2c6a('0xd')]=_[_0x2c6a('0xe')](config[_0x2c6a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c6a('0xf'))(new Redis(config[_0x2c6a('0xd')]));require(_0x2c6a('0x10'))[_0x2c6a('0x11')](socket);function respondWithRpcPromise(_0x261e90,_0x28b169,_0x25d67f){return new BPromise(function(_0x2a7040,_0x4aa0a3){return client['request'](_0x261e90,_0x25d67f)[_0x2c6a('0x12')](function(_0x46531e){logger[_0x2c6a('0x13')](_0x2c6a('0x14'),_0x28b169,'request\x20sent');logger['debug'](_0x2c6a('0x15'),_0x28b169,_0x2c6a('0x16'),JSON[_0x2c6a('0x17')](_0x46531e));if(_0x46531e['error']){if(_0x46531e['error']['code']===0x1f4){logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);return _0x4aa0a3(_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);}logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x46531e[_0x2c6a('0x18')]['message']);return _0x2a7040(_0x46531e[_0x2c6a('0x18')][_0x2c6a('0x19')]);}else{logger['info'](_0x2c6a('0x14'),_0x28b169,'request\x20sent');_0x2a7040(_0x46531e['result'][_0x2c6a('0x19')]);}})[_0x2c6a('0x1a')](function(_0x15fa74){logger[_0x2c6a('0x18')](_0x2c6a('0x14'),_0x28b169,_0x15fa74);_0x4aa0a3(_0x15fa74);});});}exports[_0x2c6a('0x1b')]=function(_0x2f9dda){var _0x54bc5d=this;return new Promise(function(_0x132d58,_0x4003ed){return db[_0x2c6a('0x1c')][_0x2c6a('0x1d')](_0x2f9dda[_0x2c6a('0x1e')],{'raw':_0x2f9dda['options']?_0x2f9dda['options'][_0x2c6a('0x1f')]===undefined?!![]:![]:!![]})[_0x2c6a('0x12')](function(_0x9de775){logger[_0x2c6a('0x13')]('CreateOpenchannelMessage',_0x2f9dda);logger['debug']('CreateOpenchannelMessage',_0x2f9dda,JSON[_0x2c6a('0x17')](_0x9de775));_0x132d58(_0x9de775);})[_0x2c6a('0x1a')](function(_0x401471){logger[_0x2c6a('0x18')](_0x2c6a('0x1b'),_0x401471[_0x2c6a('0x19')],_0x2f9dda);_0x4003ed(_0x54bc5d[_0x2c6a('0x18')](0x1f4,_0x401471['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index c448063..0e1dab4 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 _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x16b55f,_0x301c6c){_0x16b55f=_0x16b55f-0x0;var _0x391c2f=_0xbdb7[_0x16b55f];return _0x391c2f;};'use strict';var OpenchannelMessageEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelMessageEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelMessageEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x5c1829,_0x5e5b18){var _0x45dd65=function(_0x2c08bf){while(--_0x2c08bf){_0x5c1829['push'](_0x5c1829['shift']());}};_0x45dd65(++_0x5e5b18);}(_0xe706,0xa3));var _0x6e70=function(_0x2e10b1,_0x845b82){_0x2e10b1=_0x2e10b1-0x0;var _0x41de8b=_0xe706[_0x2e10b1];return _0x41de8b;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 1498343..64298cd 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 _0xdbbe=['update','delete','destroy','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put'];(function(_0x3a902a,_0xca8442){var _0x24f2d5=function(_0xb6799a){while(--_0xb6799a){_0x3a902a['push'](_0x3a902a['shift']());}};_0x24f2d5(++_0xca8442);}(_0xdbbe,0x148));var _0xedbb=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0xdbbe[_0x324012];return _0x435cf2;};'use strict';var multer=require('multer');var util=require(_0xedbb('0x0'));var path=require(_0xedbb('0x1'));var timeout=require(_0xedbb('0x2'));var express=require(_0xedbb('0x3'));var router=express[_0xedbb('0x4')]();var auth=require(_0xedbb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xedbb('0x6'));var controller=require(_0xedbb('0x7'));router[_0xedbb('0x8')]('/',auth[_0xedbb('0x9')](),controller[_0xedbb('0xa')]);router[_0xedbb('0x8')](_0xedbb('0xb'),auth['isAuthenticated'](),controller[_0xedbb('0xc')]);router[_0xedbb('0x8')]('/:id',auth[_0xedbb('0x9')](),controller['show']);router[_0xedbb('0x8')](_0xedbb('0xd'),auth[_0xedbb('0x9')](),controller['getMembers']);router[_0xedbb('0x8')]('/:id/teams',auth[_0xedbb('0x9')](),controller[_0xedbb('0xe')]);router[_0xedbb('0x8')](_0xedbb('0xf'),auth['isAuthenticated'](),controller[_0xedbb('0x10')]);router[_0xedbb('0x11')]('/',auth[_0xedbb('0x9')](),controller[_0xedbb('0x12')]);router[_0xedbb('0x11')](_0xedbb('0x13'),auth['isAuthenticated'](),controller[_0xedbb('0x14')]);router[_0xedbb('0x11')](_0xedbb('0xf'),auth[_0xedbb('0x9')](),controller[_0xedbb('0x15')]);router[_0xedbb('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xedbb('0x17')]);router[_0xedbb('0x18')]('/:id',auth[_0xedbb('0x9')](),controller[_0xedbb('0x19')]);router[_0xedbb('0x18')]('/:id/teams',auth[_0xedbb('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xedbb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0024=['util','connect-timeout','Router','../../config/environment','./openchannelQueue.controller','index','get','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getAgents','post','addTeams','put','delete','destroy','removeAgents','exports'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x0024,0xa8));var _0x4002=function(_0x2c5b59,_0x4901d7){_0x2c5b59=_0x2c5b59-0x0;var _0x5f2dc6=_0x0024[_0x2c5b59];return _0x5f2dc6;};'use strict';var multer=require('multer');var util=require(_0x4002('0x0'));var path=require('path');var timeout=require(_0x4002('0x1'));var express=require('express');var router=express[_0x4002('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4002('0x3'));var controller=require(_0x4002('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x4002('0x5')]);router[_0x4002('0x6')](_0x4002('0x7'),auth[_0x4002('0x8')](),controller['describe']);router[_0x4002('0x6')](_0x4002('0x9'),auth[_0x4002('0x8')](),controller[_0x4002('0xa')]);router['get']('/:id/members',auth[_0x4002('0x8')](),controller[_0x4002('0xb')]);router[_0x4002('0x6')](_0x4002('0xc'),auth[_0x4002('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0x4002('0x8')](),controller[_0x4002('0xd')]);router[_0x4002('0xe')]('/',auth[_0x4002('0x8')](),controller['create']);router[_0x4002('0xe')](_0x4002('0xc'),auth[_0x4002('0x8')](),controller[_0x4002('0xf')]);router[_0x4002('0xe')]('/:id/users',auth[_0x4002('0x8')](),controller['addAgents']);router[_0x4002('0x10')](_0x4002('0x9'),auth[_0x4002('0x8')](),controller['update']);router[_0x4002('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4002('0x12')]);router[_0x4002('0x11')]('/:id/teams',auth[_0x4002('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x4002('0x8')](),controller[_0x4002('0x13')]);module[_0x4002('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ffb52d5..7e53e77 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 _0x457a=['beepall','roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x457a,0x167));var _0xa457=function(_0x1f2253,_0x21c622){_0x1f2253=_0x1f2253-0x0;var _0x480c87=_0x457a[_0x1f2253];return _0x480c87;};'use strict';var Sequelize=require(_0xa457('0x0'));module[_0xa457('0x1')]={'name':{'type':Sequelize[_0xa457('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa457('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa457('0x3')](_0xa457('0x4'),_0xa457('0x5'),_0xa457('0x6'))}}; \ No newline at end of file +var _0xa809=['STRING','beepall','roundrobin','exports'];(function(_0x2b70cc,_0x102755){var _0x410dac=function(_0x55718e){while(--_0x55718e){_0x2b70cc['push'](_0x2b70cc['shift']());}};_0x410dac(++_0x102755);}(_0xa809,0x1f3));var _0x9a80=function(_0x571fcb,_0x584df0){_0x571fcb=_0x571fcb-0x0;var _0x199cc5=_0xa809[_0x571fcb];return _0x199cc5;};'use strict';var Sequelize=require('sequelize');module[_0x9a80('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a80('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9a80('0x2'),_0x9a80('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index de14dac..26dc5a5 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 _0xa28e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','field','tq.TeamId','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','count','offset','limit','set','json','apply','reject','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0x2c0204,_0x4dcb2e){var _0x4f796a=function(_0x10cc1f){while(--_0x10cc1f){_0x2c0204['push'](_0x2c0204['shift']());}};_0x4f796a(++_0x4dcb2e);}(_0xa28e,0x165));var _0xea28=function(_0x31d040,_0x46742e){_0x31d040=_0x31d040-0x0;var _0xf4812a=_0xa28e[_0x31d040];return _0xf4812a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xea28('0x0'));var rimraf=require(_0xea28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xea28('0x2'));var moment=require(_0xea28('0x3'));var BPromise=require(_0xea28('0x4'));var Mustache=require(_0xea28('0x5'));var util=require(_0xea28('0x6'));var path=require(_0xea28('0x7'));var sox=require(_0xea28('0x8'));var csv=require(_0xea28('0x9'));var ejs=require(_0xea28('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xea28('0xb'));var jsforce=require(_0xea28('0xc'));var deskjs=require(_0xea28('0xd'));var toCsv=require('to-csv');var querystring=require(_0xea28('0xe'));var Papa=require(_0xea28('0xf'));var Redis=require(_0xea28('0x10'));var authService=require(_0xea28('0x11'));var qs=require(_0xea28('0x12'));var as=require(_0xea28('0x13'));var hardwareService=require(_0xea28('0x14'));var logger=require(_0xea28('0x15'))(_0xea28('0x16'));var utils=require(_0xea28('0x17'));var config=require(_0xea28('0x18'));var db=require(_0xea28('0x19'))['db'];config[_0xea28('0x1a')]=_[_0xea28('0x1b')](config[_0xea28('0x1a')],{'host':_0xea28('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea28('0x1a')]));require('./openchannelQueue.socket')[_0xea28('0x1d')](socket);function respondWithStatusCode(_0x5aa588,_0x13d7e8){_0x13d7e8=_0x13d7e8||0xcc;return function(_0x3aa865){if(_0x3aa865){return _0x5aa588['sendStatus'](_0x13d7e8);}return _0x5aa588[_0xea28('0x1e')](_0x13d7e8)[_0xea28('0x1f')]();};}function respondWithResult(_0x23638d,_0x558a6f){_0x558a6f=_0x558a6f||0xc8;return function(_0x15e557){if(_0x15e557){return _0x23638d[_0xea28('0x1e')](_0x558a6f)['json'](_0x15e557);}};}function respondWithFilteredResult(_0x13ee2d,_0x5df701){return function(_0x16bc2b){if(_0x16bc2b){var _0x503456=_0x16bc2b[_0xea28('0x20')],_0x46e054=_0x5df701[_0xea28('0x21')],_0x59aa62=_0x5df701[_0xea28('0x21')]+_0x5df701[_0xea28('0x22')],_0x753ae3;if(_0x59aa62>=_0x503456){_0x59aa62=_0x503456;_0x753ae3=0xc8;}else{_0x753ae3=0xce;}_0x13ee2d[_0xea28('0x1e')](_0x753ae3);return _0x13ee2d[_0xea28('0x23')]('Content-Range',_0x46e054+'-'+_0x59aa62+'/'+_0x503456)[_0xea28('0x24')](_0x16bc2b);}return null;};}function patchUpdates(_0x110152){return function(_0x2eca22){try{jsonpatch[_0xea28('0x25')](_0x2eca22,_0x110152,!![]);}catch(_0x5df51e){return BPromise[_0xea28('0x26')](_0x5df51e);}return _0x2eca22['save']();};}function saveUpdates(_0x30fe15,_0x5eddac){return function(_0x456d0b){if(_0x456d0b){return _0x456d0b['update'](_0x30fe15)[_0xea28('0x27')](function(_0xfc371e){return _0xfc371e;});}return null;};}function removeEntity(_0x5bff4a,_0x1e10b2){return function(_0x5cbc7a){if(_0x5cbc7a){return _0x5cbc7a[_0xea28('0x28')]()[_0xea28('0x27')](function(){var _0x50eda0=_0x5cbc7a[_0xea28('0x29')]({'plain':!![]});var _0x3b6da0=_0xea28('0x2a');return db[_0xea28('0x2b')][_0xea28('0x28')]({'where':{'type':_0x3b6da0,'resourceId':_0x50eda0['id']}})[_0xea28('0x27')](function(){return _0x5cbc7a;});})[_0xea28('0x27')](function(){_0x5bff4a[_0xea28('0x1e')](0xcc)[_0xea28('0x1f')]();});}};}function handleEntityNotFound(_0x3d0041,_0x3ab9a8){return function(_0x27b750){if(!_0x27b750){_0x3d0041[_0xea28('0x2c')](0x194);}return _0x27b750;};}function handleError(_0x1f1bd5,_0x3d22ea){_0x3d22ea=_0x3d22ea||0x1f4;return function(_0x416587){logger[_0xea28('0x2d')](_0x416587['stack']);if(_0x416587[_0xea28('0x2e')]){delete _0x416587['name'];}_0x1f1bd5[_0xea28('0x1e')](_0x3d22ea)[_0xea28('0x2f')](_0x416587);};}exports[_0xea28('0x30')]=function(_0x12124b,_0x57c897){var _0x44e7e5={},_0x9571f8={},_0x1f6cf8={'count':0x0,'rows':[]};var _0x13ee59=_[_0xea28('0x31')](db[_0xea28('0x32')][_0xea28('0x33')],function(_0x12d43e){return{'name':_0x12d43e[_0xea28('0x34')],'type':_0x12d43e['type'][_0xea28('0x35')]};});_0x9571f8[_0xea28('0x36')]=_[_0xea28('0x31')](_0x13ee59,'name');_0x9571f8[_0xea28('0x37')]=_[_0xea28('0x38')](_0x12124b[_0xea28('0x37')]);_0x9571f8[_0xea28('0x39')]=_['intersection'](_0x9571f8[_0xea28('0x36')],_0x9571f8['query']);_0x44e7e5[_0xea28('0x3a')]=_[_0xea28('0x3b')](_0x9571f8[_0xea28('0x36')],qs[_0xea28('0x3c')](_0x12124b[_0xea28('0x37')][_0xea28('0x3c')]));_0x44e7e5[_0xea28('0x3a')]=_0x44e7e5[_0xea28('0x3a')][_0xea28('0x3d')]?_0x44e7e5['attributes']:_0x9571f8[_0xea28('0x36')];if(!_0x12124b[_0xea28('0x37')][_0xea28('0x3e')](_0xea28('0x3f'))){_0x44e7e5['limit']=qs[_0xea28('0x22')](_0x12124b['query']['limit']);_0x44e7e5[_0xea28('0x21')]=qs[_0xea28('0x21')](_0x12124b['query'][_0xea28('0x21')]);}_0x44e7e5[_0xea28('0x40')]=qs[_0xea28('0x41')](_0x12124b[_0xea28('0x37')][_0xea28('0x41')]);_0x44e7e5[_0xea28('0x42')]=qs['filters'](_['pick'](_0x12124b[_0xea28('0x37')],_0x9571f8[_0xea28('0x39')]),_0x13ee59);if(_0x12124b[_0xea28('0x37')][_0xea28('0x43')]){_0x44e7e5[_0xea28('0x42')]=_[_0xea28('0x44')](_0x44e7e5['where'],{'$or':_['map'](_0x13ee59,function(_0x16b780){if(_0x16b780[_0xea28('0x45')]!==_0xea28('0x46')){var _0x45932a={};_0x45932a[_0x16b780[_0xea28('0x2e')]]={'$like':'%'+_0x12124b[_0xea28('0x37')]['filter']+'%'};return _0x45932a;}})});}_0x44e7e5=_[_0xea28('0x44')]({},_0x44e7e5,_0x12124b[_0xea28('0x47')]);var _0x56bf96={'where':_0x44e7e5[_0xea28('0x42')]};return db[_0xea28('0x32')][_0xea28('0x20')](_0x56bf96)[_0xea28('0x27')](function(_0x15fce3){_0x1f6cf8['count']=_0x15fce3;if(_0x12124b[_0xea28('0x37')][_0xea28('0x48')]){_0x44e7e5['include']=[{'all':!![]}];}return db[_0xea28('0x32')][_0xea28('0x49')](_0x44e7e5);})['then'](function(_0x5d795b){_0x1f6cf8[_0xea28('0x4a')]=_0x5d795b;return _0x1f6cf8;})['then'](respondWithFilteredResult(_0x57c897,_0x44e7e5))[_0xea28('0x4b')](handleError(_0x57c897,null));};exports[_0xea28('0x4c')]=function(_0x2523a9,_0x1bb6e0){var _0x5a62f9={'raw':!![],'where':{'id':_0x2523a9[_0xea28('0x4d')]['id']}},_0x36a311={};_0x36a311[_0xea28('0x36')]=_[_0xea28('0x38')](db[_0xea28('0x32')][_0xea28('0x33')]);_0x36a311[_0xea28('0x37')]=_['keys'](_0x2523a9[_0xea28('0x37')]);_0x36a311[_0xea28('0x39')]=_[_0xea28('0x3b')](_0x36a311['model'],_0x36a311[_0xea28('0x37')]);_0x5a62f9['attributes']=_[_0xea28('0x3b')](_0x36a311[_0xea28('0x36')],qs[_0xea28('0x3c')](_0x2523a9[_0xea28('0x37')][_0xea28('0x3c')]));_0x5a62f9[_0xea28('0x3a')]=_0x5a62f9[_0xea28('0x3a')][_0xea28('0x3d')]?_0x5a62f9[_0xea28('0x3a')]:_0x36a311[_0xea28('0x36')];if(_0x2523a9[_0xea28('0x37')][_0xea28('0x48')]){_0x5a62f9[_0xea28('0x4e')]=[{'all':!![]}];}_0x5a62f9=_[_0xea28('0x44')]({},_0x5a62f9,_0x2523a9['options']);return db[_0xea28('0x32')][_0xea28('0x4f')](_0x5a62f9)[_0xea28('0x27')](handleEntityNotFound(_0x1bb6e0,null))['then'](respondWithResult(_0x1bb6e0,null))[_0xea28('0x4b')](handleError(_0x1bb6e0,null));};exports[_0xea28('0x50')]=function(_0x38d8f5,_0x3fba85){return db[_0xea28('0x32')]['create'](_0x38d8f5[_0xea28('0x51')],{})['then'](function(_0x550d51){var _0x1a1c40=_0x38d8f5[_0xea28('0x52')]['get']({'plain':!![]});if(!_0x1a1c40)throw new Error(_0xea28('0x53'));if(_0x1a1c40[_0xea28('0x54')]===_0xea28('0x52')){var _0x44a037=_0x550d51[_0xea28('0x29')]({'plain':!![]});var _0x526e9c=_0xea28('0x2a');return db['UserProfileSection'][_0xea28('0x4f')]({'where':{'name':_0x526e9c,'userProfileId':_0x1a1c40['userProfileId']},'raw':!![]})[_0xea28('0x27')](function(_0x16d48c){if(_0x16d48c&&_0x16d48c[_0xea28('0x55')]===0x0){return db[_0xea28('0x2b')][_0xea28('0x50')]({'name':_0x44a037[_0xea28('0x2e')],'resourceId':_0x44a037['id'],'type':_0x16d48c[_0xea28('0x2e')],'sectionId':_0x16d48c['id']},{})[_0xea28('0x27')](function(){return _0x550d51;});}else{return _0x550d51;}})['catch'](function(_0x103df2){logger['error'](_0xea28('0x56'),_0x103df2);throw _0x103df2;});}return _0x550d51;})['then'](respondWithResult(_0x3fba85,0xc9))[_0xea28('0x4b')](handleError(_0x3fba85,null));};exports[_0xea28('0x57')]=function(_0x1b51a0,_0x4c6344){if(_0x1b51a0[_0xea28('0x51')]['id']){delete _0x1b51a0[_0xea28('0x51')]['id'];}return db['OpenchannelQueue'][_0xea28('0x4f')]({'where':{'id':_0x1b51a0[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0x4c6344,null))[_0xea28('0x27')](saveUpdates(_0x1b51a0[_0xea28('0x51')],null))['then'](respondWithResult(_0x4c6344,null))['catch'](handleError(_0x4c6344,null));};exports[_0xea28('0x28')]=function(_0x15dac4,_0xf3ee4c){return db[_0xea28('0x32')]['find']({'where':{'id':_0x15dac4[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0xf3ee4c,null))[_0xea28('0x27')](removeEntity(_0xf3ee4c,null))[_0xea28('0x4b')](handleError(_0xf3ee4c,null));};exports[_0xea28('0x58')]=function(_0x244914,_0x1f92c8){return db[_0xea28('0x32')]['describe']()[_0xea28('0x27')](respondWithResult(_0x1f92c8,null))['catch'](handleError(_0x1f92c8,null));};exports[_0xea28('0x59')]=function(_0x3dd362,_0x1a6dbf,_0xcbef4f){var _0x27e1d3={'raw':!![],'where':{}},_0x3f6df8={},_0x2abb8a;return db['OpenchannelQueue'][_0xea28('0x5a')]({'where':{'id':_0x3dd362[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0x1a6dbf,null))[_0xea28('0x27')](function(_0x1da835){if(_0x1da835){_0x2abb8a=_0x1da835[_0xea28('0x29')]({'plain':!![]});_0x3f6df8[_0xea28('0x36')]=_[_0xea28('0x38')](db[_0xea28('0x5b')]['rawAttributes']);_0x3f6df8['query']=_[_0xea28('0x38')](_0x3dd362['query']);_0x3f6df8[_0xea28('0x39')]=_[_0xea28('0x3b')](_0x3f6df8[_0xea28('0x36')],_0x3f6df8[_0xea28('0x37')]);_0x27e1d3[_0xea28('0x3a')]=_['intersection'](_0x3f6df8[_0xea28('0x36')],qs[_0xea28('0x3c')](_0x3dd362['query']['fields']));_0x27e1d3[_0xea28('0x3a')]=_0x27e1d3[_0xea28('0x3a')][_0xea28('0x3d')]?_0x27e1d3[_0xea28('0x3a')]:_0x3f6df8[_0xea28('0x36')];if(!_0x3dd362[_0xea28('0x37')]['hasOwnProperty'](_0xea28('0x3f'))){_0x27e1d3[_0xea28('0x22')]=qs[_0xea28('0x22')](_0x3dd362[_0xea28('0x37')][_0xea28('0x22')]);_0x27e1d3[_0xea28('0x21')]=qs[_0xea28('0x21')](_0x3dd362[_0xea28('0x37')][_0xea28('0x21')]);}_0x27e1d3[_0xea28('0x40')]=qs[_0xea28('0x41')](_0x3dd362[_0xea28('0x37')][_0xea28('0x41')]);_0x27e1d3['where']=qs[_0xea28('0x39')](_[_0xea28('0x5c')](_0x3dd362['query'],_0x3f6df8[_0xea28('0x39')]));_0x27e1d3[_0xea28('0x42')][_0xea28('0x5d')]=_0x1da835['id'];if(_0x3dd362[_0xea28('0x37')][_0xea28('0x43')]){_0x27e1d3[_0xea28('0x42')]=_[_0xea28('0x44')](_0x27e1d3[_0xea28('0x42')],{'$or':_['map'](_0x27e1d3[_0xea28('0x3a')],function(_0x401dd7){var _0x2e47fe={};_0x2e47fe[_0x401dd7]={'$like':'%'+_0x3dd362[_0xea28('0x37')][_0xea28('0x43')]+'%'};return _0x2e47fe;})});}_0x27e1d3=_[_0xea28('0x44')]({},_0x27e1d3,_0x3dd362[_0xea28('0x47')]);return db[_0xea28('0x5b')][_0xea28('0x49')](_0x27e1d3);}})[_0xea28('0x27')](function(_0x3ca153){if(_0x3ca153){return db[_0xea28('0x5e')][_0xea28('0x5f')]({'where':{'id':_['map'](_0x3ca153,_0xea28('0x60')),'role':_0xea28('0x61')},'attributes':['id',_0xea28('0x2e'),_0xea28('0x62'),_0xea28('0x63'),_0xea28('0x64')]});}})[_0xea28('0x27')](function(_0x45abaa){if(_0x45abaa){return{'count':_0x45abaa[_0xea28('0x20')],'rows':_[_0xea28('0x31')](_0x45abaa[_0xea28('0x4a')],function(_0x38c037){return{'membername':_0x38c037['name'],'UserId':_0x38c037['id'],'queue_name':_0x2abb8a['name'],'OpenchannelQueueId':_0x2abb8a['id'],'interface':util[_0xea28('0x65')](_0xea28('0x66'),'SIP',_0x38c037['name']),'penalty':0x0,'paused':_0x38c037[_0xea28('0x62')],'createdAt':_0x38c037['createdAt'],'updatedAt':_0x38c037[_0xea28('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea28('0x27')](respondWithFilteredResult(_0x1a6dbf,_0x27e1d3))[_0xea28('0x4b')](handleError(_0x1a6dbf,null));};exports['getTeams']=function(_0x2e4189,_0x152a65,_0x33a62f){var _0x1552dc={};var _0x1ac664={};var _0x1ecfb1;var _0x47e23a;return db['OpenchannelQueue'][_0xea28('0x5a')]({'where':{'id':_0x2e4189[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0x152a65,null))['then'](function(_0x5c35f9){if(_0x5c35f9){_0x1ecfb1=_0x5c35f9;_0x1ac664[_0xea28('0x36')]=_[_0xea28('0x38')](db[_0xea28('0x67')][_0xea28('0x33')]);_0x1ac664[_0xea28('0x37')]=_[_0xea28('0x38')](_0x2e4189['query']);_0x1ac664['filters']=_['intersection'](_0x1ac664['model'],_0x1ac664[_0xea28('0x37')]);_0x1552dc[_0xea28('0x3a')]=_[_0xea28('0x3b')](_0x1ac664[_0xea28('0x36')],qs[_0xea28('0x3c')](_0x2e4189[_0xea28('0x37')][_0xea28('0x3c')]));_0x1552dc[_0xea28('0x3a')]=_0x1552dc[_0xea28('0x3a')]['length']?_0x1552dc[_0xea28('0x3a')]:_0x1ac664[_0xea28('0x36')];_0x1552dc[_0xea28('0x40')]=qs[_0xea28('0x41')](_0x2e4189[_0xea28('0x37')]['sort']);_0x1552dc[_0xea28('0x42')]=qs[_0xea28('0x39')](_[_0xea28('0x5c')](_0x2e4189['query'],_0x1ac664[_0xea28('0x39')]));if(_0x2e4189[_0xea28('0x37')]['filter']){_0x1552dc['where']=_[_0xea28('0x44')](_0x1552dc['where'],{'$or':_['map'](_0x1552dc['attributes'],function(_0x5a9294){var _0x4a9135={};_0x4a9135[_0x5a9294]={'$like':'%'+_0x2e4189[_0xea28('0x37')]['filter']+'%'};return _0x4a9135;})});}_0x1552dc=_[_0xea28('0x44')]({},_0x1552dc,_0x2e4189[_0xea28('0x47')]);return _0x1ecfb1[_0xea28('0x68')](_0x1552dc);}})[_0xea28('0x27')](function(_0x9e4969){if(_0x9e4969){_0x47e23a=_0x9e4969[_0xea28('0x3d')];if(!_0x2e4189[_0xea28('0x37')][_0xea28('0x3e')](_0xea28('0x3f'))){_0x1552dc[_0xea28('0x22')]=qs[_0xea28('0x22')](_0x2e4189[_0xea28('0x37')][_0xea28('0x22')]);_0x1552dc['offset']=qs[_0xea28('0x21')](_0x2e4189[_0xea28('0x37')]['offset']);}return _0x1ecfb1['getTeams'](_0x1552dc);}})[_0xea28('0x27')](function(_0x504dbe){if(_0x504dbe){return _0x504dbe?{'count':_0x47e23a,'rows':_0x504dbe}:null;}})[_0xea28('0x27')](respondWithResult(_0x152a65,null))[_0xea28('0x4b')](handleError(_0x152a65,null));};exports[_0xea28('0x69')]=function(_0x224d8e,_0x6f079,_0x188879){var _0x3d9d7b=_0x224d8e[_0xea28('0x51')][_0xea28('0x6a')];return db[_0xea28('0x67')][_0xea28('0x49')]({'where':{'id':_0x3d9d7b},'attributes':['id'],'include':[{'model':db[_0xea28('0x5e')],'as':_0xea28('0x6b'),'attributes':['id',_0xea28('0x2e'),_0xea28('0x6c'),_0xea28('0x6d'),_0xea28('0x6e')],'raw':!![]}]})['then'](function(_0x8a15b){if(_0x8a15b){var _0x4cd6f6=_[_0xea28('0x6f')](_0x8a15b,function(_0x2e1f0f){var _0x182633=_0x2e1f0f[_0xea28('0x29')]({'plain':!![]});return _0x182633[_0xea28('0x6b')];});return db['OpenchannelQueue'][_0xea28('0x4f')]({'where':{'id':_0x224d8e['params']['id']}})['then'](function(_0x162fa6){return db['sequelize'][_0xea28('0x70')](function(_0x445e27){return _0x162fa6['addTeams'](_0x3d9d7b,{'transaction':_0x445e27})[_0xea28('0x27')](function(){return BPromise[_0xea28('0x71')](_0x4cd6f6,function(_0xe64ac9){return db[_0xea28('0x5b')][_0xea28('0x72')]({'where':{'UserId':_0xe64ac9['id'],'OpenchannelQueueId':_0x224d8e[_0xea28('0x4d')]['id']},'transaction':_0x445e27});});})[_0xea28('0x27')](function(){_0x4cd6f6['forEach'](function(_0x7aa606){socket[_0xea28('0x73')](_0xea28('0x74'),{'UserId':_0x7aa606['id'],'OpenchannelQueueId':_0x162fa6['id']});});});});});}})['then'](respondWithStatusCode(_0x6f079,null))[_0xea28('0x4b')](handleError(_0x6f079,null));};exports['removeTeams']=function(_0x352d7e,_0x1f6566,_0x238f6c){return db['Team'][_0xea28('0x49')]({'where':{'id':_0x352d7e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xea28('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea28('0x27')](handleEntityNotFound(_0x1f6566,null))['then'](function(_0xb3f768){var _0x5765d1=_[_0xea28('0x31')](_0xb3f768,'id');var _0x1e6fd8=[];var _0xb302ac=[];var _0x14b938=squel['select']();_0x14b938[_0xea28('0x75')](_0xea28('0x76'))['from'](_0xea28('0x77'),'tq')[_0xea28('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xea28('0x79'),_0x352d7e[_0xea28('0x4d')]['id']);for(var _0xce0e2f=0x0;_0xce0e2f<_0xb3f768[_0xea28('0x3d')];_0xce0e2f+=0x1){let _0x4a6123=_0xb3f768[_0xce0e2f];for(var _0x52f97c=0x0;_0x52f97c<_0x4a6123[_0xea28('0x6b')]['length'];_0x52f97c+=0x1){let _0x3ae158=_0x4a6123['Agents'][_0x52f97c];var _0x5abc89=_0x14b938['clone']();_0x5abc89[_0xea28('0x42')](_0xea28('0x7a'),_0x3ae158['id']);_0xb302ac[_0xea28('0x7b')](db['sequelize'][_0xea28('0x37')](_0x5abc89[_0xea28('0x7c')](),{'type':db[_0xea28('0x7d')]['QueryTypes']['SELECT']})[_0xea28('0x27')](function(_0x2404de){if(_0x2404de[_0xea28('0x3d')]===0x1){return _0x3ae158['id'];}else{var _0x210f48=_[_0xea28('0x7e')](_[_0xea28('0x31')](_0x2404de,_0xea28('0x7f')),function(_0x1cc320){return _[_0xea28('0x80')](_0x5765d1,_0x1cc320);});if(_0x210f48){return _0x3ae158['id'];}}}));}}return BPromise[_0xea28('0x81')](_0xb302ac)['then'](function(_0x254d15){_0x1e6fd8=_(_0x1e6fd8)[_0xea28('0x82')](_0x254d15)[_0xea28('0x83')]()['value']();return db['OpenchannelQueue'][_0xea28('0x4f')]({'where':{'id':_0x352d7e[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](function(_0x1e3836){return db[_0xea28('0x7d')][_0xea28('0x70')](function(_0x5d4f44){return _0x1e3836[_0xea28('0x84')](_0x352d7e[_0xea28('0x37')][_0xea28('0x6a')],{'transaction':_0x5d4f44})[_0xea28('0x27')](function(){if(!_[_0xea28('0x85')](_0x1e6fd8)){return _0x1e3836[_0xea28('0x86')](_0x1e6fd8,{'transaction':_0x5d4f44});}})[_0xea28('0x27')](function(){_0x1e6fd8[_0xea28('0x87')](function(_0x515e67){socket[_0xea28('0x73')](_0xea28('0x88'),{'UserId':_0x515e67,'OpenchannelQueueId':_0x1e3836['id']});});});});});});})[_0xea28('0x27')](respondWithStatusCode(_0x1f6566,null))['catch'](handleError(_0x1f6566,null));};exports['addAgents']=function(_0x3806a8,_0x53307d,_0x20df90){return db[_0xea28('0x32')][_0xea28('0x4f')]({'where':{'id':_0x3806a8[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0x53307d,null))[_0xea28('0x27')](function(_0x5023e1){if(_0x5023e1){return _0x5023e1['addAgents'](_0x3806a8[_0xea28('0x51')][_0xea28('0x6a')],_['omit'](_0x3806a8['body'],[_0xea28('0x6a'),'id'])||{})['spread'](function(_0x9ece10){for(var _0x4a37d8=0x0;_0x4a37d8<_0x3806a8[_0xea28('0x51')][_0xea28('0x6a')][_0xea28('0x3d')];_0x4a37d8+=0x1){socket[_0xea28('0x73')](_0xea28('0x74'),{'UserId':_0x3806a8[_0xea28('0x51')][_0xea28('0x6a')][_0x4a37d8],'OpenchannelQueueId':_0x3806a8[_0xea28('0x4d')]['id']});}return _0x9ece10;});}})[_0xea28('0x27')](respondWithResult(_0x53307d,null))['catch'](handleError(_0x53307d,null));};exports[_0xea28('0x86')]=function(_0x5cb75c,_0xec3be6,_0x228672){return db[_0xea28('0x32')][_0xea28('0x4f')]({'where':{'id':_0x5cb75c['params']['id']}})[_0xea28('0x27')](handleEntityNotFound(_0xec3be6,null))[_0xea28('0x27')](function(_0x1d2f3c){if(_0x1d2f3c){return _0x1d2f3c[_0xea28('0x86')](_0x5cb75c['query'][_0xea28('0x6a')])[_0xea28('0x27')](function(){if(_[_0xea28('0x89')](_0x5cb75c[_0xea28('0x37')][_0xea28('0x6a')])){for(var _0x18bad3=0x0;_0x18bad3<_0x5cb75c[_0xea28('0x37')][_0xea28('0x6a')][_0xea28('0x3d')];_0x18bad3+=0x1){socket['emit'](_0xea28('0x88'),{'UserId':Number(_0x5cb75c[_0xea28('0x37')][_0xea28('0x6a')][_0x18bad3]),'OpenchannelQueueId':Number(_0x5cb75c[_0xea28('0x4d')]['id'])});}}else{socket['emit'](_0xea28('0x88'),{'UserId':Number(_0x5cb75c[_0xea28('0x37')][_0xea28('0x6a')]),'OpenchannelQueueId':Number(_0x5cb75c[_0xea28('0x4d')]['id'])});}});}})[_0xea28('0x27')](respondWithStatusCode(_0xec3be6,null))[_0xea28('0x4b')](handleError(_0xec3be6,null));};exports[_0xea28('0x8a')]=function(_0x275eec,_0x53ac84,_0x5f46e0){var _0x54756c={};var _0x27e4ba={};var _0x40d235;var _0x20628d;return db[_0xea28('0x32')][_0xea28('0x5a')]({'where':{'id':_0x275eec[_0xea28('0x4d')]['id']}})[_0xea28('0x27')](handleEntityNotFound(_0x53ac84,null))[_0xea28('0x27')](function(_0x366c85){if(_0x366c85){_0x40d235=_0x366c85;_0x27e4ba[_0xea28('0x36')]=_[_0xea28('0x38')](db[_0xea28('0x5e')][_0xea28('0x33')]);_0x27e4ba[_0xea28('0x37')]=_[_0xea28('0x38')](_0x275eec[_0xea28('0x37')]);_0x27e4ba['filters']=_['intersection'](_0x27e4ba[_0xea28('0x36')],_0x27e4ba[_0xea28('0x37')]);_0x54756c['attributes']=_['intersection'](_0x27e4ba['model'],qs['fields'](_0x275eec[_0xea28('0x37')][_0xea28('0x3c')]));_0x54756c[_0xea28('0x3a')]=_0x54756c[_0xea28('0x3a')][_0xea28('0x3d')]?_0x54756c[_0xea28('0x3a')]:_0x27e4ba['model'];_0x54756c[_0xea28('0x40')]=qs[_0xea28('0x41')](_0x275eec[_0xea28('0x37')][_0xea28('0x41')]);_0x54756c[_0xea28('0x42')]=qs[_0xea28('0x39')](_[_0xea28('0x5c')](_0x275eec['query'],_0x27e4ba[_0xea28('0x39')]));if(_0x275eec[_0xea28('0x37')]['filter']){_0x54756c[_0xea28('0x42')]=_[_0xea28('0x44')](_0x54756c['where'],{'$or':_['map'](_0x54756c[_0xea28('0x3a')],function(_0x176ceb){var _0x27b429={};_0x27b429[_0x176ceb]={'$like':'%'+_0x275eec[_0xea28('0x37')][_0xea28('0x43')]+'%'};return _0x27b429;})});}_0x54756c=_[_0xea28('0x44')]({},_0x54756c,_0x275eec['options']);return _0x40d235[_0xea28('0x8a')](_0x54756c);}})[_0xea28('0x27')](function(_0x2655b1){if(_0x2655b1){_0x20628d=_0x2655b1[_0xea28('0x3d')];if(!_0x275eec[_0xea28('0x37')][_0xea28('0x3e')]('nolimit')){_0x54756c[_0xea28('0x22')]=qs[_0xea28('0x22')](_0x275eec[_0xea28('0x37')][_0xea28('0x22')]);_0x54756c[_0xea28('0x21')]=qs['offset'](_0x275eec[_0xea28('0x37')][_0xea28('0x21')]);}return _0x40d235[_0xea28('0x8a')](_0x54756c);}})[_0xea28('0x27')](function(_0x39b4ab){if(_0x39b4ab){return _0x39b4ab?{'count':_0x20628d,'rows':_0x39b4ab}:null;}})['then'](respondWithResult(_0x53ac84,null))[_0xea28('0x4b')](handleError(_0x53ac84,null));}; \ No newline at end of file +var _0xc391=['reject','update','then','destroy','get','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserOpenchannelQueue','options','User','findAndCountAll','UserId','updatedAt','format','%s/%s','createdAt','findOne','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xc391,0x67));var _0x1c39=function(_0x57b7b0,_0x36c056){_0x57b7b0=_0x57b7b0-0x0;var _0x5461a2=_0xc391[_0x57b7b0];return _0x5461a2;};'use strict';var pdf=require(_0x1c39('0x0'));var emlformat=require(_0x1c39('0x1'));var rimraf=require(_0x1c39('0x2'));var zipdir=require(_0x1c39('0x3'));var jsonpatch=require(_0x1c39('0x4'));var rp=require('request-promise');var moment=require(_0x1c39('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1c39('0x6'));var util=require('util');var path=require(_0x1c39('0x7'));var sox=require(_0x1c39('0x8'));var csv=require(_0x1c39('0x9'));var ejs=require(_0x1c39('0xa'));var fs=require('fs');var _=require(_0x1c39('0xb'));var squel=require(_0x1c39('0xc'));var crypto=require('crypto');var jsforce=require(_0x1c39('0xd'));var deskjs=require(_0x1c39('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1c39('0xf'));var Papa=require(_0x1c39('0x10'));var Redis=require(_0x1c39('0x11'));var authService=require(_0x1c39('0x12'));var qs=require(_0x1c39('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c39('0x14'));var logger=require('../../config/logger')(_0x1c39('0x15'));var utils=require(_0x1c39('0x16'));var config=require('../../config/environment');var db=require(_0x1c39('0x17'))['db'];config[_0x1c39('0x18')]=_[_0x1c39('0x19')](config['redis'],{'host':_0x1c39('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c39('0x1b'))[_0x1c39('0x1c')](socket);function respondWithStatusCode(_0x1a2e69,_0x3d2f53){_0x3d2f53=_0x3d2f53||0xcc;return function(_0x25f2a0){if(_0x25f2a0){return _0x1a2e69[_0x1c39('0x1d')](_0x3d2f53);}return _0x1a2e69['status'](_0x3d2f53)[_0x1c39('0x1e')]();};}function respondWithResult(_0x2d6ded,_0x58dfca){_0x58dfca=_0x58dfca||0xc8;return function(_0x578873){if(_0x578873){return _0x2d6ded[_0x1c39('0x1f')](_0x58dfca)[_0x1c39('0x20')](_0x578873);}};}function respondWithFilteredResult(_0x217e9d,_0x18a28a){return function(_0x29e21e){if(_0x29e21e){var _0x23c29c=_0x29e21e['count'],_0x56da69=_0x18a28a[_0x1c39('0x21')],_0x4d7dd4=_0x18a28a[_0x1c39('0x21')]+_0x18a28a[_0x1c39('0x22')],_0x24b1fe;if(_0x4d7dd4>=_0x23c29c){_0x4d7dd4=_0x23c29c;_0x24b1fe=0xc8;}else{_0x24b1fe=0xce;}_0x217e9d[_0x1c39('0x1f')](_0x24b1fe);return _0x217e9d[_0x1c39('0x23')](_0x1c39('0x24'),_0x56da69+'-'+_0x4d7dd4+'/'+_0x23c29c)[_0x1c39('0x20')](_0x29e21e);}return null;};}function patchUpdates(_0x393e65){return function(_0x533946){try{jsonpatch['apply'](_0x533946,_0x393e65,!![]);}catch(_0x21947a){return BPromise[_0x1c39('0x25')](_0x21947a);}return _0x533946['save']();};}function saveUpdates(_0x3839d4,_0x1c3c02){return function(_0x5847ab){if(_0x5847ab){return _0x5847ab[_0x1c39('0x26')](_0x3839d4)[_0x1c39('0x27')](function(_0x33605c){return _0x33605c;});}return null;};}function removeEntity(_0x577ccc,_0x4c1407){return function(_0x1697d6){if(_0x1697d6){return _0x1697d6[_0x1c39('0x28')]()[_0x1c39('0x27')](function(){var _0x46226b=_0x1697d6[_0x1c39('0x29')]({'plain':!![]});var _0x43d0b7='OpenchannelQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x43d0b7,'resourceId':_0x46226b['id']}})[_0x1c39('0x27')](function(){return _0x1697d6;});})[_0x1c39('0x27')](function(){_0x577ccc[_0x1c39('0x1f')](0xcc)[_0x1c39('0x1e')]();});}};}function handleEntityNotFound(_0x5926f4,_0xae379f){return function(_0x282121){if(!_0x282121){_0x5926f4[_0x1c39('0x1d')](0x194);}return _0x282121;};}function handleError(_0xf694,_0x13e08a){_0x13e08a=_0x13e08a||0x1f4;return function(_0x42acee){logger[_0x1c39('0x2a')](_0x42acee['stack']);if(_0x42acee['name']){delete _0x42acee[_0x1c39('0x2b')];}_0xf694['status'](_0x13e08a)[_0x1c39('0x2c')](_0x42acee);};}exports[_0x1c39('0x2d')]=function(_0x543545,_0x20382e){var _0x66894a={},_0x2025b6={},_0x23a186={'count':0x0,'rows':[]};var _0x37aaf1=_[_0x1c39('0x2e')](db['OpenchannelQueue'][_0x1c39('0x2f')],function(_0x33532d){return{'name':_0x33532d['fieldName'],'type':_0x33532d[_0x1c39('0x30')][_0x1c39('0x31')]};});_0x2025b6[_0x1c39('0x32')]=_[_0x1c39('0x2e')](_0x37aaf1,'name');_0x2025b6[_0x1c39('0x33')]=_[_0x1c39('0x34')](_0x543545[_0x1c39('0x33')]);_0x2025b6[_0x1c39('0x35')]=_[_0x1c39('0x36')](_0x2025b6['model'],_0x2025b6[_0x1c39('0x33')]);_0x66894a['attributes']=_[_0x1c39('0x36')](_0x2025b6[_0x1c39('0x32')],qs[_0x1c39('0x37')](_0x543545[_0x1c39('0x33')][_0x1c39('0x37')]));_0x66894a[_0x1c39('0x38')]=_0x66894a[_0x1c39('0x38')]['length']?_0x66894a['attributes']:_0x2025b6[_0x1c39('0x32')];if(!_0x543545[_0x1c39('0x33')][_0x1c39('0x39')](_0x1c39('0x3a'))){_0x66894a[_0x1c39('0x22')]=qs[_0x1c39('0x22')](_0x543545[_0x1c39('0x33')]['limit']);_0x66894a[_0x1c39('0x21')]=qs[_0x1c39('0x21')](_0x543545['query']['offset']);}_0x66894a[_0x1c39('0x3b')]=qs[_0x1c39('0x3c')](_0x543545[_0x1c39('0x33')][_0x1c39('0x3c')]);_0x66894a[_0x1c39('0x3d')]=qs[_0x1c39('0x35')](_[_0x1c39('0x3e')](_0x543545[_0x1c39('0x33')],_0x2025b6[_0x1c39('0x35')]),_0x37aaf1);if(_0x543545[_0x1c39('0x33')][_0x1c39('0x3f')]){_0x66894a[_0x1c39('0x3d')]=_[_0x1c39('0x40')](_0x66894a[_0x1c39('0x3d')],{'$or':_[_0x1c39('0x2e')](_0x37aaf1,function(_0x4d21c7){if(_0x4d21c7[_0x1c39('0x30')]!==_0x1c39('0x41')){var _0x3a5f32={};_0x3a5f32[_0x4d21c7[_0x1c39('0x2b')]]={'$like':'%'+_0x543545[_0x1c39('0x33')]['filter']+'%'};return _0x3a5f32;}})});}_0x66894a=_[_0x1c39('0x40')]({},_0x66894a,_0x543545['options']);var _0x33bb74={'where':_0x66894a[_0x1c39('0x3d')]};return db[_0x1c39('0x42')][_0x1c39('0x43')](_0x33bb74)[_0x1c39('0x27')](function(_0x215e4b){_0x23a186['count']=_0x215e4b;if(_0x543545['query'][_0x1c39('0x44')]){_0x66894a[_0x1c39('0x45')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x1c39('0x46')](_0x66894a);})[_0x1c39('0x27')](function(_0x484d4a){_0x23a186[_0x1c39('0x47')]=_0x484d4a;return _0x23a186;})['then'](respondWithFilteredResult(_0x20382e,_0x66894a))[_0x1c39('0x48')](handleError(_0x20382e,null));};exports[_0x1c39('0x49')]=function(_0x26241c,_0x14ef40){var _0x57ae47={'raw':!![],'where':{'id':_0x26241c['params']['id']}},_0x402a32={};_0x402a32[_0x1c39('0x32')]=_[_0x1c39('0x34')](db[_0x1c39('0x42')][_0x1c39('0x2f')]);_0x402a32[_0x1c39('0x33')]=_[_0x1c39('0x34')](_0x26241c[_0x1c39('0x33')]);_0x402a32['filters']=_[_0x1c39('0x36')](_0x402a32['model'],_0x402a32[_0x1c39('0x33')]);_0x57ae47[_0x1c39('0x38')]=_[_0x1c39('0x36')](_0x402a32[_0x1c39('0x32')],qs[_0x1c39('0x37')](_0x26241c['query'][_0x1c39('0x37')]));_0x57ae47[_0x1c39('0x38')]=_0x57ae47[_0x1c39('0x38')][_0x1c39('0x4a')]?_0x57ae47[_0x1c39('0x38')]:_0x402a32[_0x1c39('0x32')];if(_0x26241c[_0x1c39('0x33')][_0x1c39('0x44')]){_0x57ae47['include']=[{'all':!![]}];}_0x57ae47=_[_0x1c39('0x40')]({},_0x57ae47,_0x26241c['options']);return db['OpenchannelQueue'][_0x1c39('0x4b')](_0x57ae47)[_0x1c39('0x27')](handleEntityNotFound(_0x14ef40,null))[_0x1c39('0x27')](respondWithResult(_0x14ef40,null))[_0x1c39('0x48')](handleError(_0x14ef40,null));};exports[_0x1c39('0x4c')]=function(_0x435005,_0x44b59f){return db[_0x1c39('0x42')]['create'](_0x435005['body'],{})[_0x1c39('0x27')](function(_0x29ac0a){var _0x385239=_0x435005[_0x1c39('0x4d')][_0x1c39('0x29')]({'plain':!![]});if(!_0x385239)throw new Error(_0x1c39('0x4e'));if(_0x385239['role']===_0x1c39('0x4d')){var _0x5d449d=_0x29ac0a['get']({'plain':!![]});var _0x3ce0f5=_0x1c39('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x3ce0f5,'userProfileId':_0x385239[_0x1c39('0x50')]},'raw':!![]})[_0x1c39('0x27')](function(_0x3fa3d9){if(_0x3fa3d9&&_0x3fa3d9[_0x1c39('0x51')]===0x0){return db[_0x1c39('0x52')][_0x1c39('0x4c')]({'name':_0x5d449d[_0x1c39('0x2b')],'resourceId':_0x5d449d['id'],'type':_0x3fa3d9[_0x1c39('0x2b')],'sectionId':_0x3fa3d9['id']},{})['then'](function(){return _0x29ac0a;});}else{return _0x29ac0a;}})['catch'](function(_0x4207f0){logger[_0x1c39('0x2a')](_0x1c39('0x53'),_0x4207f0);throw _0x4207f0;});}return _0x29ac0a;})[_0x1c39('0x27')](respondWithResult(_0x44b59f,0xc9))['catch'](handleError(_0x44b59f,null));};exports['update']=function(_0x55def1,_0x3592bc){if(_0x55def1[_0x1c39('0x54')]['id']){delete _0x55def1[_0x1c39('0x54')]['id'];}return db[_0x1c39('0x42')][_0x1c39('0x4b')]({'where':{'id':_0x55def1[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x3592bc,null))[_0x1c39('0x27')](saveUpdates(_0x55def1[_0x1c39('0x54')],null))['then'](respondWithResult(_0x3592bc,null))[_0x1c39('0x48')](handleError(_0x3592bc,null));};exports['destroy']=function(_0x2d6250,_0x305278){return db['OpenchannelQueue'][_0x1c39('0x4b')]({'where':{'id':_0x2d6250[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x305278,null))[_0x1c39('0x27')](removeEntity(_0x305278,null))[_0x1c39('0x48')](handleError(_0x305278,null));};exports[_0x1c39('0x56')]=function(_0x5e02b0,_0xafa03d){return db[_0x1c39('0x42')][_0x1c39('0x56')]()[_0x1c39('0x27')](respondWithResult(_0xafa03d,null))[_0x1c39('0x48')](handleError(_0xafa03d,null));};exports[_0x1c39('0x57')]=function(_0x44a61f,_0x368948,_0x515bd9){var _0x4aa500={'raw':!![],'where':{}},_0x226bfd={},_0x2c5b26;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x44a61f[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x368948,null))[_0x1c39('0x27')](function(_0x407b1c){if(_0x407b1c){_0x2c5b26=_0x407b1c['get']({'plain':!![]});_0x226bfd[_0x1c39('0x32')]=_[_0x1c39('0x34')](db[_0x1c39('0x58')][_0x1c39('0x2f')]);_0x226bfd[_0x1c39('0x33')]=_['keys'](_0x44a61f[_0x1c39('0x33')]);_0x226bfd[_0x1c39('0x35')]=_[_0x1c39('0x36')](_0x226bfd['model'],_0x226bfd['query']);_0x4aa500[_0x1c39('0x38')]=_['intersection'](_0x226bfd['model'],qs[_0x1c39('0x37')](_0x44a61f[_0x1c39('0x33')][_0x1c39('0x37')]));_0x4aa500[_0x1c39('0x38')]=_0x4aa500[_0x1c39('0x38')]['length']?_0x4aa500['attributes']:_0x226bfd['model'];if(!_0x44a61f['query']['hasOwnProperty'](_0x1c39('0x3a'))){_0x4aa500[_0x1c39('0x22')]=qs[_0x1c39('0x22')](_0x44a61f['query'][_0x1c39('0x22')]);_0x4aa500[_0x1c39('0x21')]=qs[_0x1c39('0x21')](_0x44a61f[_0x1c39('0x33')]['offset']);}_0x4aa500[_0x1c39('0x3b')]=qs['sort'](_0x44a61f[_0x1c39('0x33')][_0x1c39('0x3c')]);_0x4aa500['where']=qs['filters'](_[_0x1c39('0x3e')](_0x44a61f[_0x1c39('0x33')],_0x226bfd[_0x1c39('0x35')]));_0x4aa500[_0x1c39('0x3d')]['OpenchannelQueueId']=_0x407b1c['id'];if(_0x44a61f[_0x1c39('0x33')][_0x1c39('0x3f')]){_0x4aa500[_0x1c39('0x3d')]=_[_0x1c39('0x40')](_0x4aa500['where'],{'$or':_[_0x1c39('0x2e')](_0x4aa500[_0x1c39('0x38')],function(_0xe1d20b){var _0x39dc19={};_0x39dc19[_0xe1d20b]={'$like':'%'+_0x44a61f[_0x1c39('0x33')][_0x1c39('0x3f')]+'%'};return _0x39dc19;})});}_0x4aa500=_[_0x1c39('0x40')]({},_0x4aa500,_0x44a61f[_0x1c39('0x59')]);return db[_0x1c39('0x58')][_0x1c39('0x46')](_0x4aa500);}})[_0x1c39('0x27')](function(_0x1749ed){if(_0x1749ed){return db[_0x1c39('0x5a')][_0x1c39('0x5b')]({'where':{'id':_[_0x1c39('0x2e')](_0x1749ed,_0x1c39('0x5c')),'role':'agent'},'attributes':['id','name','openchannelPause',_0x1c39('0x5d'),'createdAt']});}})[_0x1c39('0x27')](function(_0x5d87a5){if(_0x5d87a5){return{'count':_0x5d87a5[_0x1c39('0x43')],'rows':_[_0x1c39('0x2e')](_0x5d87a5[_0x1c39('0x47')],function(_0x3c5e2e){return{'membername':_0x3c5e2e['name'],'UserId':_0x3c5e2e['id'],'queue_name':_0x2c5b26[_0x1c39('0x2b')],'OpenchannelQueueId':_0x2c5b26['id'],'interface':util[_0x1c39('0x5e')](_0x1c39('0x5f'),'SIP',_0x3c5e2e['name']),'penalty':0x0,'paused':_0x3c5e2e['openchannelPause'],'createdAt':_0x3c5e2e[_0x1c39('0x60')],'updatedAt':_0x3c5e2e[_0x1c39('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1c39('0x27')](respondWithFilteredResult(_0x368948,_0x4aa500))['catch'](handleError(_0x368948,null));};exports['getTeams']=function(_0x1405db,_0x12c2ff,_0x3af3a3){var _0x2b43d4={};var _0x5af762={};var _0x3ba60f;var _0xff2ce2;return db[_0x1c39('0x42')][_0x1c39('0x61')]({'where':{'id':_0x1405db[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x12c2ff,null))[_0x1c39('0x27')](function(_0x538133){if(_0x538133){_0x3ba60f=_0x538133;_0x5af762[_0x1c39('0x32')]=_[_0x1c39('0x34')](db['Team'][_0x1c39('0x2f')]);_0x5af762[_0x1c39('0x33')]=_[_0x1c39('0x34')](_0x1405db[_0x1c39('0x33')]);_0x5af762[_0x1c39('0x35')]=_['intersection'](_0x5af762['model'],_0x5af762['query']);_0x2b43d4[_0x1c39('0x38')]=_[_0x1c39('0x36')](_0x5af762[_0x1c39('0x32')],qs[_0x1c39('0x37')](_0x1405db[_0x1c39('0x33')]['fields']));_0x2b43d4[_0x1c39('0x38')]=_0x2b43d4['attributes']['length']?_0x2b43d4[_0x1c39('0x38')]:_0x5af762['model'];_0x2b43d4[_0x1c39('0x3b')]=qs['sort'](_0x1405db[_0x1c39('0x33')]['sort']);_0x2b43d4[_0x1c39('0x3d')]=qs[_0x1c39('0x35')](_[_0x1c39('0x3e')](_0x1405db[_0x1c39('0x33')],_0x5af762['filters']));if(_0x1405db['query']['filter']){_0x2b43d4[_0x1c39('0x3d')]=_[_0x1c39('0x40')](_0x2b43d4[_0x1c39('0x3d')],{'$or':_[_0x1c39('0x2e')](_0x2b43d4[_0x1c39('0x38')],function(_0x3cc878){var _0x27015a={};_0x27015a[_0x3cc878]={'$like':'%'+_0x1405db['query'][_0x1c39('0x3f')]+'%'};return _0x27015a;})});}_0x2b43d4=_[_0x1c39('0x40')]({},_0x2b43d4,_0x1405db[_0x1c39('0x59')]);return _0x3ba60f[_0x1c39('0x62')](_0x2b43d4);}})['then'](function(_0x200bd8){if(_0x200bd8){_0xff2ce2=_0x200bd8[_0x1c39('0x4a')];if(!_0x1405db[_0x1c39('0x33')][_0x1c39('0x39')]('nolimit')){_0x2b43d4[_0x1c39('0x22')]=qs[_0x1c39('0x22')](_0x1405db[_0x1c39('0x33')]['limit']);_0x2b43d4[_0x1c39('0x21')]=qs[_0x1c39('0x21')](_0x1405db[_0x1c39('0x33')][_0x1c39('0x21')]);}return _0x3ba60f[_0x1c39('0x62')](_0x2b43d4);}})[_0x1c39('0x27')](function(_0x2a8082){if(_0x2a8082){return _0x2a8082?{'count':_0xff2ce2,'rows':_0x2a8082}:null;}})[_0x1c39('0x27')](respondWithResult(_0x12c2ff,null))[_0x1c39('0x48')](handleError(_0x12c2ff,null));};exports[_0x1c39('0x63')]=function(_0x512162,_0x133486,_0x380607){var _0x301578=_0x512162['body'][_0x1c39('0x64')];return db[_0x1c39('0x65')][_0x1c39('0x46')]({'where':{'id':_0x301578},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x1c39('0x66'),_0x1c39('0x67'),_0x1c39('0x68')],'raw':!![]}]})[_0x1c39('0x27')](function(_0x4d0da3){if(_0x4d0da3){var _0x1f8380=_[_0x1c39('0x69')](_0x4d0da3,function(_0x6ccbdc){var _0x956b3e=_0x6ccbdc[_0x1c39('0x29')]({'plain':!![]});return _0x956b3e['Agents'];});return db[_0x1c39('0x42')][_0x1c39('0x4b')]({'where':{'id':_0x512162[_0x1c39('0x55')]['id']}})['then'](function(_0x4bda7c){return db[_0x1c39('0x6a')][_0x1c39('0x6b')](function(_0x37f779){return _0x4bda7c['addTeams'](_0x301578,{'transaction':_0x37f779})['then'](function(){return BPromise[_0x1c39('0x6c')](_0x1f8380,function(_0x1ed4f3){return db[_0x1c39('0x58')][_0x1c39('0x6d')]({'where':{'UserId':_0x1ed4f3['id'],'OpenchannelQueueId':_0x512162[_0x1c39('0x55')]['id']},'transaction':_0x37f779});});})[_0x1c39('0x27')](function(){_0x1f8380[_0x1c39('0x6e')](function(_0x6c71fb){socket[_0x1c39('0x6f')](_0x1c39('0x70'),{'UserId':_0x6c71fb['id'],'OpenchannelQueueId':_0x4bda7c['id']});});});});});}})[_0x1c39('0x27')](respondWithStatusCode(_0x133486,null))[_0x1c39('0x48')](handleError(_0x133486,null));};exports[_0x1c39('0x71')]=function(_0x46fbad,_0x468718,_0x2d9072){return db[_0x1c39('0x65')][_0x1c39('0x46')]({'where':{'id':_0x46fbad['query'][_0x1c39('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1c39('0x27')](handleEntityNotFound(_0x468718,null))[_0x1c39('0x27')](function(_0x3ee890){var _0x1db641=_[_0x1c39('0x2e')](_0x3ee890,'id');var _0x4d60b6=[];var _0x3c118e=[];var _0x3474bc=squel['select']();_0x3474bc[_0x1c39('0x72')](_0x1c39('0x73'))[_0x1c39('0x74')](_0x1c39('0x75'),'tq')[_0x1c39('0x76')]('user_has_teams','ut',_0x1c39('0x77'))[_0x1c39('0x3d')](_0x1c39('0x78'),_0x46fbad['params']['id']);for(var _0x477890=0x0;_0x477890<_0x3ee890['length'];_0x477890+=0x1){let _0x2aee10=_0x3ee890[_0x477890];for(var _0x9804=0x0;_0x9804<_0x2aee10[_0x1c39('0x79')][_0x1c39('0x4a')];_0x9804+=0x1){let _0x43c92e=_0x2aee10['Agents'][_0x9804];var _0x24ff11=_0x3474bc[_0x1c39('0x7a')]();_0x24ff11[_0x1c39('0x3d')](_0x1c39('0x7b'),_0x43c92e['id']);_0x3c118e[_0x1c39('0x7c')](db[_0x1c39('0x6a')][_0x1c39('0x33')](_0x24ff11[_0x1c39('0x7d')](),{'type':db[_0x1c39('0x6a')][_0x1c39('0x7e')]['SELECT']})[_0x1c39('0x27')](function(_0x485e8f){if(_0x485e8f[_0x1c39('0x4a')]===0x1){return _0x43c92e['id'];}else{var _0xc67606=_[_0x1c39('0x7f')](_['map'](_0x485e8f,_0x1c39('0x80')),function(_0x43c65c){return _[_0x1c39('0x81')](_0x1db641,_0x43c65c);});if(_0xc67606){return _0x43c92e['id'];}}}));}}return BPromise[_0x1c39('0x82')](_0x3c118e)[_0x1c39('0x27')](function(_0x406573){_0x4d60b6=_(_0x4d60b6)[_0x1c39('0x83')](_0x406573)[_0x1c39('0x84')]()[_0x1c39('0x85')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x46fbad[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](function(_0x32e451){return db[_0x1c39('0x6a')][_0x1c39('0x6b')](function(_0x11aace){return _0x32e451[_0x1c39('0x71')](_0x46fbad[_0x1c39('0x33')][_0x1c39('0x64')],{'transaction':_0x11aace})['then'](function(){if(!_[_0x1c39('0x86')](_0x4d60b6)){return _0x32e451[_0x1c39('0x87')](_0x4d60b6,{'transaction':_0x11aace});}})['then'](function(){_0x4d60b6[_0x1c39('0x6e')](function(_0x488aae){socket[_0x1c39('0x6f')](_0x1c39('0x88'),{'UserId':_0x488aae,'OpenchannelQueueId':_0x32e451['id']});});});});});});})[_0x1c39('0x27')](respondWithStatusCode(_0x468718,null))[_0x1c39('0x48')](handleError(_0x468718,null));};exports[_0x1c39('0x89')]=function(_0x22c460,_0x241b81,_0x5cf6fc){return db[_0x1c39('0x42')][_0x1c39('0x4b')]({'where':{'id':_0x22c460[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x241b81,null))[_0x1c39('0x27')](function(_0x10b5ce){if(_0x10b5ce){return _0x10b5ce[_0x1c39('0x89')](_0x22c460[_0x1c39('0x54')][_0x1c39('0x64')],_['omit'](_0x22c460['body'],[_0x1c39('0x64'),'id'])||{})['spread'](function(_0x3372f6){for(var _0x240d0e=0x0;_0x240d0e<_0x22c460['body']['ids']['length'];_0x240d0e+=0x1){socket[_0x1c39('0x6f')](_0x1c39('0x70'),{'UserId':_0x22c460[_0x1c39('0x54')]['ids'][_0x240d0e],'OpenchannelQueueId':_0x22c460[_0x1c39('0x55')]['id']});}return _0x3372f6;});}})[_0x1c39('0x27')](respondWithResult(_0x241b81,null))[_0x1c39('0x48')](handleError(_0x241b81,null));};exports[_0x1c39('0x87')]=function(_0x189ab7,_0x401b93,_0x5888c8){return db[_0x1c39('0x42')]['find']({'where':{'id':_0x189ab7[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x401b93,null))[_0x1c39('0x27')](function(_0x4deb6c){if(_0x4deb6c){return _0x4deb6c['removeAgents'](_0x189ab7[_0x1c39('0x33')][_0x1c39('0x64')])[_0x1c39('0x27')](function(){if(_[_0x1c39('0x8a')](_0x189ab7[_0x1c39('0x33')][_0x1c39('0x64')])){for(var _0x3cf28=0x0;_0x3cf28<_0x189ab7['query'][_0x1c39('0x64')][_0x1c39('0x4a')];_0x3cf28+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x189ab7[_0x1c39('0x33')][_0x1c39('0x64')][_0x3cf28]),'OpenchannelQueueId':Number(_0x189ab7[_0x1c39('0x55')]['id'])});}}else{socket[_0x1c39('0x6f')](_0x1c39('0x88'),{'UserId':Number(_0x189ab7['query'][_0x1c39('0x64')]),'OpenchannelQueueId':Number(_0x189ab7[_0x1c39('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x401b93,null))[_0x1c39('0x48')](handleError(_0x401b93,null));};exports[_0x1c39('0x8b')]=function(_0x297c8f,_0x490692,_0x192b2f){var _0x3024a4={};var _0x542f5b={};var _0x5b2d3b;var _0x486dc7;return db['OpenchannelQueue'][_0x1c39('0x61')]({'where':{'id':_0x297c8f[_0x1c39('0x55')]['id']}})[_0x1c39('0x27')](handleEntityNotFound(_0x490692,null))[_0x1c39('0x27')](function(_0x51f5b1){if(_0x51f5b1){_0x5b2d3b=_0x51f5b1;_0x542f5b[_0x1c39('0x32')]=_['keys'](db['User'][_0x1c39('0x2f')]);_0x542f5b[_0x1c39('0x33')]=_[_0x1c39('0x34')](_0x297c8f[_0x1c39('0x33')]);_0x542f5b[_0x1c39('0x35')]=_[_0x1c39('0x36')](_0x542f5b[_0x1c39('0x32')],_0x542f5b[_0x1c39('0x33')]);_0x3024a4[_0x1c39('0x38')]=_[_0x1c39('0x36')](_0x542f5b[_0x1c39('0x32')],qs[_0x1c39('0x37')](_0x297c8f[_0x1c39('0x33')][_0x1c39('0x37')]));_0x3024a4[_0x1c39('0x38')]=_0x3024a4[_0x1c39('0x38')]['length']?_0x3024a4[_0x1c39('0x38')]:_0x542f5b['model'];_0x3024a4[_0x1c39('0x3b')]=qs['sort'](_0x297c8f[_0x1c39('0x33')][_0x1c39('0x3c')]);_0x3024a4['where']=qs[_0x1c39('0x35')](_['pick'](_0x297c8f['query'],_0x542f5b['filters']));if(_0x297c8f['query'][_0x1c39('0x3f')]){_0x3024a4['where']=_[_0x1c39('0x40')](_0x3024a4[_0x1c39('0x3d')],{'$or':_[_0x1c39('0x2e')](_0x3024a4[_0x1c39('0x38')],function(_0x3a547e){var _0xf08626={};_0xf08626[_0x3a547e]={'$like':'%'+_0x297c8f[_0x1c39('0x33')]['filter']+'%'};return _0xf08626;})});}_0x3024a4=_[_0x1c39('0x40')]({},_0x3024a4,_0x297c8f[_0x1c39('0x59')]);return _0x5b2d3b[_0x1c39('0x8b')](_0x3024a4);}})[_0x1c39('0x27')](function(_0x41b111){if(_0x41b111){_0x486dc7=_0x41b111[_0x1c39('0x4a')];if(!_0x297c8f['query']['hasOwnProperty'](_0x1c39('0x3a'))){_0x3024a4[_0x1c39('0x22')]=qs[_0x1c39('0x22')](_0x297c8f[_0x1c39('0x33')]['limit']);_0x3024a4[_0x1c39('0x21')]=qs['offset'](_0x297c8f['query'][_0x1c39('0x21')]);}return _0x5b2d3b[_0x1c39('0x8b')](_0x3024a4);}})[_0x1c39('0x27')](function(_0x4c58b8){if(_0x4c58b8){return _0x4c58b8?{'count':_0x486dc7,'rows':_0x4c58b8}:null;}})[_0x1c39('0x27')](respondWithResult(_0x490692,null))[_0x1c39('0x48')](handleError(_0x490692,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c62d6b0..dd68158 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 _0xa012=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x50d8d3,_0xfa1ff){var _0x3704e7=function(_0x5803dd){while(--_0x5803dd){_0x50d8d3['push'](_0x50d8d3['shift']());}};_0x3704e7(++_0xfa1ff);}(_0xa012,0x16d));var _0x2a01=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0xa012[_0x5e5c4c];return _0x176148;};'use strict';var EventEmitter=require(_0x2a01('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x2a01('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2a01('0x2')](0x0);var events={'afterCreate':_0x2a01('0x3'),'afterUpdate':_0x2a01('0x4'),'afterDestroy':_0x2a01('0x5')};function emitEvent(_0x14b13b){return function(_0x15e456,_0x207586,_0x55b909){OpenchannelQueueEvents[_0x2a01('0x6')](_0x14b13b+':'+_0x15e456['id'],_0x15e456);OpenchannelQueueEvents['emit'](_0x14b13b,_0x15e456);_0x55b909(null);};}for(var e in events){if(events[_0x2a01('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2a01('0x8')](e,emitEvent(event));}}module[_0x2a01('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x37d3=['OpenchannelQueue','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5347f9,_0x1e94a0){var _0x4c8f68=function(_0x275d5c){while(--_0x275d5c){_0x5347f9['push'](_0x5347f9['shift']());}};_0x4c8f68(++_0x1e94a0);}(_0x37d3,0x1d3));var _0x337d=function(_0x117129,_0x1dd2f8){_0x117129=_0x117129-0x0;var _0x36f786=_0x37d3[_0x117129];return _0x36f786;};'use strict';var EventEmitter=require(_0x337d('0x0'));var OpenchannelQueue=require(_0x337d('0x1'))['db'][_0x337d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x337d('0x3')};function emitEvent(_0x3fdddb){return function(_0x4a0fe7,_0x10baa7,_0x136c84){OpenchannelQueueEvents[_0x337d('0x4')](_0x3fdddb+':'+_0x4a0fe7['id'],_0x4a0fe7);OpenchannelQueueEvents[_0x337d('0x4')](_0x3fdddb,_0x4a0fe7);_0x136c84(null);};}for(var e in events){if(events[_0x337d('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x337d('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 088194d..94d0765 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 _0x2645=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x1ad3ab,_0x4fc7a3){var _0x49763a=function(_0x2df960){while(--_0x2df960){_0x1ad3ab['push'](_0x1ad3ab['shift']());}};_0x49763a(++_0x4fc7a3);}(_0x2645,0x138));var _0x5264=function(_0x4d0153,_0x55e737){_0x4d0153=_0x4d0153-0x0;var _0x35520a=_0x2645[_0x4d0153];return _0x35520a;};'use strict';var _=require(_0x5264('0x0'));var util=require(_0x5264('0x1'));var logger=require('../../config/logger')(_0x5264('0x2'));var moment=require(_0x5264('0x3'));var BPromise=require(_0x5264('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5264('0x5'));var rimraf=require(_0x5264('0x6'));var config=require(_0x5264('0x7'));var attributes=require(_0x5264('0x8'));module[_0x5264('0x9')]=function(_0x26e1f4,_0x32d8e8){return _0x26e1f4[_0x5264('0xa')](_0x5264('0xb'),attributes,{'tableName':_0x5264('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e9b=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash'];(function(_0x5dc01d,_0x2666f7){var _0x2cf7e8=function(_0x172535){while(--_0x172535){_0x5dc01d['push'](_0x5dc01d['shift']());}};_0x2cf7e8(++_0x2666f7);}(_0x3e9b,0x8e));var _0xb3e9=function(_0x1b48c4,_0x457668){_0x1b48c4=_0x1b48c4-0x0;var _0x1720ba=_0x3e9b[_0x1b48c4];return _0x1720ba;};'use strict';var _=require(_0xb3e9('0x0'));var util=require(_0xb3e9('0x1'));var logger=require(_0xb3e9('0x2'))(_0xb3e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb3e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3e9('0x5'));var config=require(_0xb3e9('0x6'));var attributes=require(_0xb3e9('0x7'));module[_0xb3e9('0x8')]=function(_0x4f0ea0,_0x358ecc){return _0x4f0ea0[_0xb3e9('0x9')](_0xb3e9('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index c37c152..ca46275 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 _0x7bb6=['redis','defaults','localhost','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','OpenchannelQueue','where','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x5ac5eb,_0x1bdca4){var _0x47feba=function(_0x5f41ba){while(--_0x5f41ba){_0x5ac5eb['push'](_0x5ac5eb['shift']());}};_0x47feba(++_0x1bdca4);}(_0x7bb6,0x6a));var _0x67bb=function(_0x2016d8,_0x25f1dd){_0x2016d8=_0x2016d8-0x0;var _0x3bb7ac=_0x7bb6[_0x2016d8];return _0x3bb7ac;};'use strict';var _=require(_0x67bb('0x0'));var util=require(_0x67bb('0x1'));var moment=require(_0x67bb('0x2'));var BPromise=require(_0x67bb('0x3'));var rs=require(_0x67bb('0x4'));var fs=require('fs');var Redis=require(_0x67bb('0x5'));var db=require(_0x67bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x67bb('0x7'))(_0x67bb('0x8'));var config=require(_0x67bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x67bb('0xa')]['http']({'port':0x232a});config[_0x67bb('0xb')]=_[_0x67bb('0xc')](config[_0x67bb('0xb')],{'host':_0x67bb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x67bb('0xe'))['register'](socket);function respondWithRpcPromise(_0x2b6f9b,_0x3b407e,_0x247df5){return new BPromise(function(_0xcfb612,_0x5acec0){return client[_0x67bb('0xf')](_0x2b6f9b,_0x247df5)[_0x67bb('0x10')](function(_0x430f5f){logger[_0x67bb('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3b407e,_0x67bb('0x12'));logger[_0x67bb('0x13')](_0x67bb('0x14'),_0x3b407e,_0x67bb('0x12'),JSON['stringify'](_0x430f5f));if(_0x430f5f['error']){if(_0x430f5f[_0x67bb('0x15')][_0x67bb('0x16')]===0x1f4){logger[_0x67bb('0x15')](_0x67bb('0x17'),_0x3b407e,_0x430f5f[_0x67bb('0x15')][_0x67bb('0x18')]);return _0x5acec0(_0x430f5f[_0x67bb('0x15')]['message']);}logger[_0x67bb('0x15')](_0x67bb('0x17'),_0x3b407e,_0x430f5f[_0x67bb('0x15')][_0x67bb('0x18')]);return _0xcfb612(_0x430f5f[_0x67bb('0x15')][_0x67bb('0x18')]);}else{logger[_0x67bb('0x11')](_0x67bb('0x17'),_0x3b407e,'request\x20sent');_0xcfb612(_0x430f5f['result']['message']);}})[_0x67bb('0x19')](function(_0x4a6216){logger[_0x67bb('0x15')](_0x67bb('0x17'),_0x3b407e,_0x4a6216);_0x5acec0(_0x4a6216);});});}exports[_0x67bb('0x1a')]=function(_0x311df5){var _0x3fa42d=this;return new Promise(function(_0x306877,_0x1e181c){return db['OpenchannelQueue'][_0x67bb('0x1b')]({'raw':_0x311df5[_0x67bb('0x1c')]?_0x311df5[_0x67bb('0x1c')][_0x67bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x311df5['options']?_0x311df5[_0x67bb('0x1c')]['where']||null:null,'attributes':_0x311df5[_0x67bb('0x1c')]?_0x311df5[_0x67bb('0x1c')][_0x67bb('0x1e')]||null:null,'limit':_0x311df5['options']?_0x311df5[_0x67bb('0x1c')][_0x67bb('0x1f')]||null:null,'include':_0x311df5[_0x67bb('0x1c')]?_0x311df5[_0x67bb('0x1c')][_0x67bb('0x20')]?_['map'](_0x311df5[_0x67bb('0x1c')][_0x67bb('0x20')],function(_0x4369de){return{'model':db[_0x4369de['model']],'as':_0x4369de['as'],'attributes':_0x4369de[_0x67bb('0x1e')],'include':_0x4369de[_0x67bb('0x20')]?_[_0x67bb('0x21')](_0x4369de['include'],function(_0x2f2c88){return{'model':db[_0x2f2c88[_0x67bb('0x22')]],'as':_0x2f2c88['as'],'attributes':_0x2f2c88[_0x67bb('0x1e')],'include':_0x2f2c88[_0x67bb('0x20')]?_[_0x67bb('0x21')](_0x2f2c88['include'],function(_0x4ed787){return{'model':db[_0x4ed787['model']],'as':_0x4ed787['as'],'attributes':_0x4ed787['attributes']};}):[]};}):[]};}):[]:[]})[_0x67bb('0x10')](function(_0x5d4aa4){logger[_0x67bb('0x11')](_0x67bb('0x1a'),_0x311df5);logger['debug'](_0x67bb('0x1a'),_0x311df5,JSON[_0x67bb('0x23')](_0x5d4aa4));_0x306877(_0x5d4aa4);})[_0x67bb('0x19')](function(_0xd09dd){logger['error'](_0x67bb('0x1a'),_0xd09dd[_0x67bb('0x18')],_0x311df5);_0x1e181c(_0x3fa42d['error'](0x1f4,_0xd09dd['message']));});});};exports['ShowOpenchannelQueue']=function(_0xd65d2e){var _0x2dbde4=this;return new Promise(function(_0x1987a3,_0x4e7986){return db[_0x67bb('0x24')]['find']({'raw':_0xd65d2e[_0x67bb('0x1c')]?_0xd65d2e[_0x67bb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd65d2e[_0x67bb('0x1c')]?_0xd65d2e[_0x67bb('0x1c')][_0x67bb('0x25')]||null:null,'attributes':_0xd65d2e[_0x67bb('0x1c')]?_0xd65d2e['options']['attributes']||null:null,'include':_0xd65d2e[_0x67bb('0x1c')]?_0xd65d2e[_0x67bb('0x1c')][_0x67bb('0x20')]?_[_0x67bb('0x21')](_0xd65d2e[_0x67bb('0x1c')]['include'],function(_0x41f204){return{'model':db[_0x41f204['model']],'as':_0x41f204['as'],'attributes':_0x41f204['attributes'],'include':_0x41f204[_0x67bb('0x20')]?_[_0x67bb('0x21')](_0x41f204[_0x67bb('0x20')],function(_0x58ba86){return{'model':db[_0x58ba86[_0x67bb('0x22')]],'as':_0x58ba86['as'],'attributes':_0x58ba86[_0x67bb('0x1e')],'include':_0x58ba86[_0x67bb('0x20')]?_['map'](_0x58ba86[_0x67bb('0x20')],function(_0x1977a4){return{'model':db[_0x1977a4['model']],'as':_0x1977a4['as'],'attributes':_0x1977a4[_0x67bb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x67bb('0x10')](function(_0xe1c07c){logger[_0x67bb('0x11')](_0x67bb('0x26'),_0xd65d2e);logger[_0x67bb('0x13')]('ShowOpenchannelQueue',_0xd65d2e,JSON['stringify'](_0xe1c07c));_0x1987a3(_0xe1c07c);})[_0x67bb('0x19')](function(_0x4d45cc){logger[_0x67bb('0x15')](_0x67bb('0x26'),_0x4d45cc['message'],_0xd65d2e);_0x4e7986(_0x2dbde4[_0x67bb('0x15')](0x1f4,_0x4d45cc['message']));});});}; \ No newline at end of file +var _0xb804=['../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','limit','include','map','attributes','GetOpenchannelQueue','stringify','OpenchannelQueue','find','model','ShowOpenchannelQueue','lodash','util','moment','bluebird'];(function(_0x4ca4a9,_0x50e350){var _0x22cdc8=function(_0x392513){while(--_0x392513){_0x4ca4a9['push'](_0x4ca4a9['shift']());}};_0x22cdc8(++_0x50e350);}(_0xb804,0x74));var _0x4b80=function(_0x38af14,_0x2cc244){_0x38af14=_0x38af14-0x0;var _0x2a64b3=_0xb804[_0x38af14];return _0x2a64b3;};'use strict';var _=require(_0x4b80('0x0'));var util=require(_0x4b80('0x1'));var moment=require(_0x4b80('0x2'));var BPromise=require(_0x4b80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4b80('0x4'));var logger=require(_0x4b80('0x5'))(_0x4b80('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b80('0x7')][_0x4b80('0x8')]({'port':0x232a});config['redis']=_[_0x4b80('0x9')](config[_0x4b80('0xa')],{'host':_0x4b80('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b80('0xa')]));require(_0x4b80('0xc'))[_0x4b80('0xd')](socket);function respondWithRpcPromise(_0x5ebd5d,_0x2e6786,_0x447dbb){return new BPromise(function(_0x4eaa24,_0x28399f){return client[_0x4b80('0xe')](_0x5ebd5d,_0x447dbb)[_0x4b80('0xf')](function(_0x18a19b){logger[_0x4b80('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x2e6786,_0x4b80('0x11'));logger[_0x4b80('0x12')](_0x4b80('0x13'),_0x2e6786,'request\x20sent',JSON['stringify'](_0x18a19b));if(_0x18a19b[_0x4b80('0x14')]){if(_0x18a19b[_0x4b80('0x14')][_0x4b80('0x15')]===0x1f4){logger[_0x4b80('0x14')](_0x4b80('0x16'),_0x2e6786,_0x18a19b[_0x4b80('0x14')][_0x4b80('0x17')]);return _0x28399f(_0x18a19b[_0x4b80('0x14')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2e6786,_0x18a19b[_0x4b80('0x14')][_0x4b80('0x17')]);return _0x4eaa24(_0x18a19b['error'][_0x4b80('0x17')]);}else{logger[_0x4b80('0x10')](_0x4b80('0x16'),_0x2e6786,_0x4b80('0x11'));_0x4eaa24(_0x18a19b[_0x4b80('0x18')][_0x4b80('0x17')]);}})[_0x4b80('0x19')](function(_0xb6a7ac){logger[_0x4b80('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x2e6786,_0xb6a7ac);_0x28399f(_0xb6a7ac);});});}exports['GetOpenchannelQueue']=function(_0x1f9aa0){var _0x5f3992=this;return new Promise(function(_0x5dca35,_0x1f89ca){return db['OpenchannelQueue'][_0x4b80('0x1a')]({'raw':_0x1f9aa0['options']?_0x1f9aa0[_0x4b80('0x1b')][_0x4b80('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f9aa0[_0x4b80('0x1b')]?_0x1f9aa0[_0x4b80('0x1b')][_0x4b80('0x1d')]||null:null,'attributes':_0x1f9aa0[_0x4b80('0x1b')]?_0x1f9aa0[_0x4b80('0x1b')]['attributes']||null:null,'limit':_0x1f9aa0[_0x4b80('0x1b')]?_0x1f9aa0[_0x4b80('0x1b')][_0x4b80('0x1e')]||null:null,'include':_0x1f9aa0['options']?_0x1f9aa0[_0x4b80('0x1b')][_0x4b80('0x1f')]?_[_0x4b80('0x20')](_0x1f9aa0['options'][_0x4b80('0x1f')],function(_0x2569d5){return{'model':db[_0x2569d5['model']],'as':_0x2569d5['as'],'attributes':_0x2569d5[_0x4b80('0x21')],'include':_0x2569d5[_0x4b80('0x1f')]?_['map'](_0x2569d5[_0x4b80('0x1f')],function(_0x576f56){return{'model':db[_0x576f56['model']],'as':_0x576f56['as'],'attributes':_0x576f56[_0x4b80('0x21')],'include':_0x576f56[_0x4b80('0x1f')]?_[_0x4b80('0x20')](_0x576f56[_0x4b80('0x1f')],function(_0x444c96){return{'model':db[_0x444c96['model']],'as':_0x444c96['as'],'attributes':_0x444c96[_0x4b80('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4b80('0xf')](function(_0x12df9c){logger[_0x4b80('0x10')]('GetOpenchannelQueue',_0x1f9aa0);logger['debug'](_0x4b80('0x22'),_0x1f9aa0,JSON[_0x4b80('0x23')](_0x12df9c));_0x5dca35(_0x12df9c);})[_0x4b80('0x19')](function(_0x5403d7){logger[_0x4b80('0x14')]('GetOpenchannelQueue',_0x5403d7[_0x4b80('0x17')],_0x1f9aa0);_0x1f89ca(_0x5f3992['error'](0x1f4,_0x5403d7[_0x4b80('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x281e36){var _0x3e9e6c=this;return new Promise(function(_0x50558d,_0x298e47){return db[_0x4b80('0x24')][_0x4b80('0x25')]({'raw':_0x281e36[_0x4b80('0x1b')]?_0x281e36[_0x4b80('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x281e36['options']?_0x281e36[_0x4b80('0x1b')][_0x4b80('0x1d')]||null:null,'attributes':_0x281e36['options']?_0x281e36['options'][_0x4b80('0x21')]||null:null,'include':_0x281e36['options']?_0x281e36[_0x4b80('0x1b')]['include']?_[_0x4b80('0x20')](_0x281e36[_0x4b80('0x1b')][_0x4b80('0x1f')],function(_0x440ae2){return{'model':db[_0x440ae2[_0x4b80('0x26')]],'as':_0x440ae2['as'],'attributes':_0x440ae2[_0x4b80('0x21')],'include':_0x440ae2['include']?_[_0x4b80('0x20')](_0x440ae2[_0x4b80('0x1f')],function(_0x554815){return{'model':db[_0x554815[_0x4b80('0x26')]],'as':_0x554815['as'],'attributes':_0x554815[_0x4b80('0x21')],'include':_0x554815[_0x4b80('0x1f')]?_[_0x4b80('0x20')](_0x554815[_0x4b80('0x1f')],function(_0x18aeba){return{'model':db[_0x18aeba[_0x4b80('0x26')]],'as':_0x18aeba['as'],'attributes':_0x18aeba[_0x4b80('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4b80('0xf')](function(_0xd2cfd6){logger[_0x4b80('0x10')](_0x4b80('0x27'),_0x281e36);logger[_0x4b80('0x12')](_0x4b80('0x27'),_0x281e36,JSON[_0x4b80('0x23')](_0xd2cfd6));_0x50558d(_0xd2cfd6);})['catch'](function(_0x46060c){logger[_0x4b80('0x14')](_0x4b80('0x27'),_0x46060c[_0x4b80('0x17')],_0x281e36);_0x298e47(_0x3e9e6c[_0x4b80('0x14')](0x1f4,_0x46060c[_0x4b80('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 19f9bf2..29ebe57 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 _0xf6d2=['openchannelQueue:','save','remove','update','emit','register','length'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xf6d2,0x1c1));var _0x2f6d=function(_0xd1448f,_0x257085){_0xd1448f=_0xd1448f-0x0;var _0x5eadb2=_0xf6d2[_0xd1448f];return _0x5eadb2;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x2f6d('0x0'),_0x2f6d('0x1'),_0x2f6d('0x2')];function createListener(_0x2679fe,_0x4ed2e0){return function(_0x1e3e0b){_0x4ed2e0[_0x2f6d('0x3')](_0x2679fe,_0x1e3e0b);};}function removeListener(_0x179f82,_0xd05db2){return function(){OpenchannelQueueEvents['removeListener'](_0x179f82,_0xd05db2);};}exports[_0x2f6d('0x4')]=function(_0x5591f7){for(var _0x3b0c1f=0x0,_0x540159=events[_0x2f6d('0x5')];_0x3b0c1f<_0x540159;_0x3b0c1f++){var _0x57ae9e=events[_0x3b0c1f];var _0x380987=createListener(_0x2f6d('0x6')+_0x57ae9e,_0x5591f7);OpenchannelQueueEvents['on'](_0x57ae9e,_0x380987);}}; \ No newline at end of file +var _0xba23=['openchannelQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba23,0x129));var _0x3ba2=function(_0x542412,_0x2d8f1b){_0x542412=_0x542412-0x0;var _0x4b57ae=_0xba23[_0x542412];return _0x4b57ae;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x3ba2('0x0'),_0x3ba2('0x1'),_0x3ba2('0x2')];function createListener(_0x5da302,_0x18fd30){return function(_0x585fc4){_0x18fd30[_0x3ba2('0x3')](_0x5da302,_0x585fc4);};}function removeListener(_0x27e6fa,_0x29da8c){return function(){OpenchannelQueueEvents[_0x3ba2('0x4')](_0x27e6fa,_0x29da8c);};}exports[_0x3ba2('0x5')]=function(_0x2bd27d){for(var _0x4c1b9b=0x0,_0x59074b=events[_0x3ba2('0x6')];_0x4c1b9b<_0x59074b;_0x4c1b9b++){var _0x2a1a48=events[_0x4c1b9b];var _0x34438d=createListener(_0x3ba2('0x7')+_0x2a1a48,_0x2bd27d);OpenchannelQueueEvents['on'](_0x2a1a48,_0x34438d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b63d35a..4e6763a 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 _0xe449=['../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2c87b3,_0x25d3df){var _0x32f2e6=function(_0x323568){while(--_0x323568){_0x2c87b3['push'](_0x2c87b3['shift']());}};_0x32f2e6(++_0x25d3df);}(_0xe449,0xd7));var _0x9e44=function(_0xd07e92,_0x595161){_0xd07e92=_0xd07e92-0x0;var _0x20f541=_0xe449[_0xd07e92];return _0x20f541;};'use strict';var multer=require(_0x9e44('0x0'));var util=require(_0x9e44('0x1'));var path=require(_0x9e44('0x2'));var timeout=require(_0x9e44('0x3'));var express=require('express');var router=express[_0x9e44('0x4')]();var auth=require(_0x9e44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9e44('0x6'));var controller=require(_0x9e44('0x7'));router[_0x9e44('0x8')]('/',auth[_0x9e44('0x9')](),controller[_0x9e44('0xa')]);router[_0x9e44('0x8')](_0x9e44('0xb'),auth[_0x9e44('0x9')](),controller[_0x9e44('0xc')]);router['get'](_0x9e44('0xd'),auth[_0x9e44('0x9')](),controller[_0x9e44('0xe')]);router[_0x9e44('0xf')]('/',auth[_0x9e44('0x9')](),controller[_0x9e44('0x10')]);router['put']('/:id',auth[_0x9e44('0x9')](),controller['update']);router[_0x9e44('0x11')](_0x9e44('0xd'),auth['isAuthenticated'](),controller[_0x9e44('0x12')]);module[_0x9e44('0x13')]=router; \ No newline at end of file +var _0xf613=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf613,0x70));var _0x3f61=function(_0x4bb722,_0x1db86e){_0x4bb722=_0x4bb722-0x0;var _0x407977=_0xf613[_0x4bb722];return _0x407977;};'use strict';var multer=require(_0x3f61('0x0'));var util=require(_0x3f61('0x1'));var path=require(_0x3f61('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f61('0x3'));var router=express[_0x3f61('0x4')]();var auth=require(_0x3f61('0x5'));var interaction=require(_0x3f61('0x6'));var config=require(_0x3f61('0x7'));var controller=require(_0x3f61('0x8'));router[_0x3f61('0x9')]('/',auth[_0x3f61('0xa')](),controller['index']);router['get'](_0x3f61('0xb'),auth['isAuthenticated'](),controller[_0x3f61('0xc')]);router[_0x3f61('0x9')](_0x3f61('0xd'),auth[_0x3f61('0xa')](),controller[_0x3f61('0xe')]);router[_0x3f61('0xf')]('/',auth[_0x3f61('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3f61('0x10')]);router[_0x3f61('0x11')](_0x3f61('0xd'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 36ca12a..e62c217 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 _0xf1d9=['sequelize','STRING','DATE','moment'];(function(_0x2a467c,_0x1f1e91){var _0x27ecd2=function(_0x4982b7){while(--_0x4982b7){_0x2a467c['push'](_0x2a467c['shift']());}};_0x27ecd2(++_0x1f1e91);}(_0xf1d9,0x123));var _0x9f1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1d9[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9f1d('0x0'));var Sequelize=require(_0x9f1d('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9f1d('0x2')]},'joinAt':{'type':Sequelize[_0x9f1d('0x3')]},'leaveAt':{'type':Sequelize[_0x9f1d('0x3')]},'acceptAt':{'type':Sequelize[_0x9f1d('0x3')]},'exitAt':{'type':Sequelize[_0x9f1d('0x3')]},'reason':{'type':Sequelize[_0x9f1d('0x2')]}}; \ No newline at end of file +var _0x9b76=['exports','STRING','DATE','moment','sequelize'];(function(_0x292e87,_0x9b2eb5){var _0x5186f6=function(_0x2eb5b6){while(--_0x2eb5b6){_0x292e87['push'](_0x292e87['shift']());}};_0x5186f6(++_0x9b2eb5);}(_0x9b76,0x80));var _0x69b7=function(_0x339d84,_0x42371b){_0x339d84=_0x339d84-0x0;var _0x3d8587=_0x9b76[_0x339d84];return _0x3d8587;};'use strict';var moment=require(_0x69b7('0x0'));var Sequelize=require(_0x69b7('0x1'));module[_0x69b7('0x2')]={'uniqueid':{'type':Sequelize[_0x69b7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x69b7('0x3')]},'joinAt':{'type':Sequelize[_0x69b7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x69b7('0x4')]},'exitAt':{'type':Sequelize[_0x69b7('0x4')]},'reason':{'type':Sequelize[_0x69b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9119c13..0db1e41 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 _0xa8e2=['../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','apply','reject','update','then','end','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x533c7c,_0x318247){var _0x567b5a=function(_0x28b391){while(--_0x28b391){_0x533c7c['push'](_0x533c7c['shift']());}};_0x567b5a(++_0x318247);}(_0xa8e2,0x14e));var _0x2a8e=function(_0x55d44a,_0x1fd0b4){_0x55d44a=_0x55d44a-0x0;var _0x370855=_0xa8e2[_0x55d44a];return _0x370855;};'use strict';var pdf=require(_0x2a8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a8e('0x1'));var zipdir=require(_0x2a8e('0x2'));var jsonpatch=require(_0x2a8e('0x3'));var rp=require(_0x2a8e('0x4'));var moment=require(_0x2a8e('0x5'));var BPromise=require(_0x2a8e('0x6'));var Mustache=require('mustache');var util=require(_0x2a8e('0x7'));var path=require(_0x2a8e('0x8'));var sox=require(_0x2a8e('0x9'));var csv=require(_0x2a8e('0xa'));var ejs=require(_0x2a8e('0xb'));var fs=require('fs');var _=require(_0x2a8e('0xc'));var squel=require(_0x2a8e('0xd'));var crypto=require(_0x2a8e('0xe'));var jsforce=require(_0x2a8e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2a8e('0xa'));var querystring=require('querystring');var Papa=require(_0x2a8e('0x10'));var Redis=require(_0x2a8e('0x11'));var authService=require(_0x2a8e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a8e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a8e('0x14'))('api');var utils=require(_0x2a8e('0x15'));var config=require(_0x2a8e('0x16'));var db=require(_0x2a8e('0x17'))['db'];function respondWithStatusCode(_0x886e95,_0x5cfa00){_0x5cfa00=_0x5cfa00||0xcc;return function(_0x50186e){if(_0x50186e){return _0x886e95['sendStatus'](_0x5cfa00);}return _0x886e95[_0x2a8e('0x18')](_0x5cfa00)['end']();};}function respondWithResult(_0x18c844,_0x3ae693){_0x3ae693=_0x3ae693||0xc8;return function(_0x511481){if(_0x511481){return _0x18c844[_0x2a8e('0x18')](_0x3ae693)[_0x2a8e('0x19')](_0x511481);}};}function respondWithFilteredResult(_0x40dc6c,_0x4112e6){return function(_0x210784){if(_0x210784){var _0x5bda2a=_0x210784['count'],_0x4b99ec=_0x4112e6[_0x2a8e('0x1a')],_0x62cec1=_0x4112e6['offset']+_0x4112e6['limit'],_0x37da38;if(_0x62cec1>=_0x5bda2a){_0x62cec1=_0x5bda2a;_0x37da38=0xc8;}else{_0x37da38=0xce;}_0x40dc6c[_0x2a8e('0x18')](_0x37da38);return _0x40dc6c[_0x2a8e('0x1b')]('Content-Range',_0x4b99ec+'-'+_0x62cec1+'/'+_0x5bda2a)[_0x2a8e('0x19')](_0x210784);}return null;};}function patchUpdates(_0x326331){return function(_0x108028){try{jsonpatch[_0x2a8e('0x1c')](_0x108028,_0x326331,!![]);}catch(_0x4b560d){return BPromise[_0x2a8e('0x1d')](_0x4b560d);}return _0x108028['save']();};}function saveUpdates(_0x5524f9,_0x4891ce){return function(_0x420e60){if(_0x420e60){return _0x420e60[_0x2a8e('0x1e')](_0x5524f9)['then'](function(_0xec3a5d){return _0xec3a5d;});}return null;};}function removeEntity(_0x54bdb5,_0x5a2d2d){return function(_0x203b89){if(_0x203b89){return _0x203b89['destroy']()[_0x2a8e('0x1f')](function(){_0x54bdb5[_0x2a8e('0x18')](0xcc)[_0x2a8e('0x20')]();});}};}function handleEntityNotFound(_0x5360a9,_0x72f454){return function(_0x2b2fd9){if(!_0x2b2fd9){_0x5360a9['sendStatus'](0x194);}return _0x2b2fd9;};}function handleError(_0x3f6b22,_0x30206d){_0x30206d=_0x30206d||0x1f4;return function(_0xefa590){logger['error'](_0xefa590[_0x2a8e('0x21')]);if(_0xefa590[_0x2a8e('0x22')]){delete _0xefa590[_0x2a8e('0x22')];}_0x3f6b22[_0x2a8e('0x18')](_0x30206d)[_0x2a8e('0x23')](_0xefa590);};}exports[_0x2a8e('0x24')]=function(_0x5a58fd,_0x4841ab){var _0x224fd7={},_0x4ef2d6={},_0x547921={'count':0x0,'rows':[]};var _0x85f54f=_[_0x2a8e('0x25')](db[_0x2a8e('0x26')][_0x2a8e('0x27')],function(_0x3d7ac9){return{'name':_0x3d7ac9[_0x2a8e('0x28')],'type':_0x3d7ac9['type'][_0x2a8e('0x29')]};});_0x4ef2d6['model']=_[_0x2a8e('0x25')](_0x85f54f,_0x2a8e('0x22'));_0x4ef2d6[_0x2a8e('0x2a')]=_[_0x2a8e('0x2b')](_0x5a58fd[_0x2a8e('0x2a')]);_0x4ef2d6[_0x2a8e('0x2c')]=_['intersection'](_0x4ef2d6[_0x2a8e('0x2d')],_0x4ef2d6['query']);_0x224fd7[_0x2a8e('0x2e')]=_[_0x2a8e('0x2f')](_0x4ef2d6[_0x2a8e('0x2d')],qs[_0x2a8e('0x30')](_0x5a58fd['query']['fields']));_0x224fd7[_0x2a8e('0x2e')]=_0x224fd7[_0x2a8e('0x2e')]['length']?_0x224fd7[_0x2a8e('0x2e')]:_0x4ef2d6[_0x2a8e('0x2d')];if(!_0x5a58fd[_0x2a8e('0x2a')]['hasOwnProperty'](_0x2a8e('0x31'))){_0x224fd7['limit']=qs[_0x2a8e('0x32')](_0x5a58fd[_0x2a8e('0x2a')][_0x2a8e('0x32')]);_0x224fd7[_0x2a8e('0x1a')]=qs[_0x2a8e('0x1a')](_0x5a58fd[_0x2a8e('0x2a')][_0x2a8e('0x1a')]);}_0x224fd7[_0x2a8e('0x33')]=qs[_0x2a8e('0x34')](_0x5a58fd[_0x2a8e('0x2a')][_0x2a8e('0x34')]);_0x224fd7[_0x2a8e('0x35')]=qs[_0x2a8e('0x2c')](_['pick'](_0x5a58fd[_0x2a8e('0x2a')],_0x4ef2d6[_0x2a8e('0x2c')]),_0x85f54f);if(_0x5a58fd[_0x2a8e('0x2a')][_0x2a8e('0x36')]){_0x224fd7[_0x2a8e('0x35')]=_[_0x2a8e('0x37')](_0x224fd7['where'],{'$or':_[_0x2a8e('0x25')](_0x85f54f,function(_0x5d047c){if(_0x5d047c[_0x2a8e('0x38')]!==_0x2a8e('0x39')){var _0x4c7aef={};_0x4c7aef[_0x5d047c['name']]={'$like':'%'+_0x5a58fd[_0x2a8e('0x2a')]['filter']+'%'};return _0x4c7aef;}})});}_0x224fd7=_['merge']({},_0x224fd7,_0x5a58fd[_0x2a8e('0x3a')]);var _0x5607f1={'where':_0x224fd7['where']};return db[_0x2a8e('0x26')][_0x2a8e('0x3b')](_0x5607f1)[_0x2a8e('0x1f')](function(_0x1355a3){_0x547921[_0x2a8e('0x3b')]=_0x1355a3;if(_0x5a58fd['query'][_0x2a8e('0x3c')]){_0x224fd7[_0x2a8e('0x3d')]=[{'all':!![]}];}return db[_0x2a8e('0x26')][_0x2a8e('0x3e')](_0x224fd7);})['then'](function(_0x301bf3){_0x547921[_0x2a8e('0x3f')]=_0x301bf3;return _0x547921;})[_0x2a8e('0x1f')](respondWithFilteredResult(_0x4841ab,_0x224fd7))[_0x2a8e('0x40')](handleError(_0x4841ab,null));};exports[_0x2a8e('0x41')]=function(_0x5718b4,_0x4d354d){var _0x391ec0={'raw':!![],'where':{'id':_0x5718b4[_0x2a8e('0x42')]['id']}},_0x5144d0={};_0x5144d0[_0x2a8e('0x2d')]=_[_0x2a8e('0x2b')](db[_0x2a8e('0x26')][_0x2a8e('0x27')]);_0x5144d0['query']=_[_0x2a8e('0x2b')](_0x5718b4[_0x2a8e('0x2a')]);_0x5144d0[_0x2a8e('0x2c')]=_[_0x2a8e('0x2f')](_0x5144d0[_0x2a8e('0x2d')],_0x5144d0[_0x2a8e('0x2a')]);_0x391ec0[_0x2a8e('0x2e')]=_['intersection'](_0x5144d0[_0x2a8e('0x2d')],qs[_0x2a8e('0x30')](_0x5718b4[_0x2a8e('0x2a')]['fields']));_0x391ec0[_0x2a8e('0x2e')]=_0x391ec0['attributes']['length']?_0x391ec0[_0x2a8e('0x2e')]:_0x5144d0[_0x2a8e('0x2d')];if(_0x5718b4[_0x2a8e('0x2a')]['includeAll']){_0x391ec0[_0x2a8e('0x3d')]=[{'all':!![]}];}_0x391ec0=_[_0x2a8e('0x37')]({},_0x391ec0,_0x5718b4[_0x2a8e('0x3a')]);return db['OpenchannelQueueReport'][_0x2a8e('0x43')](_0x391ec0)[_0x2a8e('0x1f')](handleEntityNotFound(_0x4d354d,null))[_0x2a8e('0x1f')](respondWithResult(_0x4d354d,null))[_0x2a8e('0x40')](handleError(_0x4d354d,null));};exports['create']=function(_0x4be883,_0x19c162){return db[_0x2a8e('0x26')]['create'](_0x4be883[_0x2a8e('0x44')],{})[_0x2a8e('0x1f')](respondWithResult(_0x19c162,0xc9))[_0x2a8e('0x40')](handleError(_0x19c162,null));};exports[_0x2a8e('0x1e')]=function(_0x36c8a7,_0xff67b6){if(_0x36c8a7[_0x2a8e('0x44')]['id']){delete _0x36c8a7[_0x2a8e('0x44')]['id'];}return db[_0x2a8e('0x26')][_0x2a8e('0x43')]({'where':{'id':_0x36c8a7[_0x2a8e('0x42')]['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0xff67b6,null))[_0x2a8e('0x1f')](saveUpdates(_0x36c8a7[_0x2a8e('0x44')],null))[_0x2a8e('0x1f')](respondWithResult(_0xff67b6,null))['catch'](handleError(_0xff67b6,null));};exports[_0x2a8e('0x45')]=function(_0xa09997,_0x4f46f6){return db[_0x2a8e('0x26')][_0x2a8e('0x43')]({'where':{'id':_0xa09997['params']['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0x4f46f6,null))['then'](removeEntity(_0x4f46f6,null))['catch'](handleError(_0x4f46f6,null));};exports['describe']=function(_0x242d54,_0x213df6){return db[_0x2a8e('0x26')][_0x2a8e('0x46')]()[_0x2a8e('0x1f')](respondWithResult(_0x213df6,null))['catch'](handleError(_0x213df6,null));}; \ No newline at end of file +var _0xa0bf=['limit','Content-Range','apply','reject','save','then','destroy','error','name','index','map','OpenchannelQueueReport','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','type','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','request-promise','bluebird','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','sendStatus','status','end','json','count'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xa0bf,0xb6));var _0xfa0b=function(_0x5b85d2,_0x1f7fad){_0x5b85d2=_0x5b85d2-0x0;var _0x5394a1=_0xa0bf[_0x5b85d2];return _0x5394a1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa0b('0x0'));var moment=require('moment');var BPromise=require(_0xfa0b('0x1'));var Mustache=require('mustache');var util=require(_0xfa0b('0x2'));var path=require('path');var sox=require(_0xfa0b('0x3'));var csv=require(_0xfa0b('0x4'));var ejs=require(_0xfa0b('0x5'));var fs=require('fs');var _=require(_0xfa0b('0x6'));var squel=require(_0xfa0b('0x7'));var crypto=require(_0xfa0b('0x8'));var jsforce=require(_0xfa0b('0x9'));var deskjs=require(_0xfa0b('0xa'));var toCsv=require(_0xfa0b('0x4'));var querystring=require(_0xfa0b('0xb'));var Papa=require('papaparse');var Redis=require(_0xfa0b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfa0b('0xd'));var as=require(_0xfa0b('0xe'));var hardwareService=require(_0xfa0b('0xf'));var logger=require('../../config/logger')(_0xfa0b('0x10'));var utils=require(_0xfa0b('0x11'));var config=require(_0xfa0b('0x12'));var db=require(_0xfa0b('0x13'))['db'];function respondWithStatusCode(_0x48541c,_0x2c6bf9){_0x2c6bf9=_0x2c6bf9||0xcc;return function(_0x4cabbf){if(_0x4cabbf){return _0x48541c[_0xfa0b('0x14')](_0x2c6bf9);}return _0x48541c[_0xfa0b('0x15')](_0x2c6bf9)[_0xfa0b('0x16')]();};}function respondWithResult(_0x384f0b,_0x2d86b0){_0x2d86b0=_0x2d86b0||0xc8;return function(_0x361da0){if(_0x361da0){return _0x384f0b[_0xfa0b('0x15')](_0x2d86b0)[_0xfa0b('0x17')](_0x361da0);}};}function respondWithFilteredResult(_0x4cfe43,_0x2f9894){return function(_0x511c6d){if(_0x511c6d){var _0x1af4f0=_0x511c6d[_0xfa0b('0x18')],_0x557fc8=_0x2f9894['offset'],_0x3353b7=_0x2f9894['offset']+_0x2f9894[_0xfa0b('0x19')],_0x2185fc;if(_0x3353b7>=_0x1af4f0){_0x3353b7=_0x1af4f0;_0x2185fc=0xc8;}else{_0x2185fc=0xce;}_0x4cfe43['status'](_0x2185fc);return _0x4cfe43['set'](_0xfa0b('0x1a'),_0x557fc8+'-'+_0x3353b7+'/'+_0x1af4f0)['json'](_0x511c6d);}return null;};}function patchUpdates(_0x3f61a1){return function(_0x445337){try{jsonpatch[_0xfa0b('0x1b')](_0x445337,_0x3f61a1,!![]);}catch(_0x44ab34){return BPromise[_0xfa0b('0x1c')](_0x44ab34);}return _0x445337[_0xfa0b('0x1d')]();};}function saveUpdates(_0x35cd35,_0x1a2a30){return function(_0x3f9026){if(_0x3f9026){return _0x3f9026['update'](_0x35cd35)[_0xfa0b('0x1e')](function(_0xa4d974){return _0xa4d974;});}return null;};}function removeEntity(_0x51f650,_0x5868d7){return function(_0x101c78){if(_0x101c78){return _0x101c78[_0xfa0b('0x1f')]()[_0xfa0b('0x1e')](function(){_0x51f650['status'](0xcc)[_0xfa0b('0x16')]();});}};}function handleEntityNotFound(_0x2c55ea,_0x1ff89a){return function(_0x2631ba){if(!_0x2631ba){_0x2c55ea['sendStatus'](0x194);}return _0x2631ba;};}function handleError(_0x1238db,_0x26bd19){_0x26bd19=_0x26bd19||0x1f4;return function(_0xd0cb35){logger[_0xfa0b('0x20')](_0xd0cb35['stack']);if(_0xd0cb35[_0xfa0b('0x21')]){delete _0xd0cb35[_0xfa0b('0x21')];}_0x1238db[_0xfa0b('0x15')](_0x26bd19)['send'](_0xd0cb35);};}exports[_0xfa0b('0x22')]=function(_0x4492c9,_0x13418e){var _0x1d4566={},_0x73f57b={},_0x60e27e={'count':0x0,'rows':[]};var _0xa2871b=_[_0xfa0b('0x23')](db[_0xfa0b('0x24')]['rawAttributes'],function(_0x80362d){return{'name':_0x80362d[_0xfa0b('0x25')],'type':_0x80362d['type'][_0xfa0b('0x26')]};});_0x73f57b[_0xfa0b('0x27')]=_['map'](_0xa2871b,'name');_0x73f57b['query']=_[_0xfa0b('0x28')](_0x4492c9['query']);_0x73f57b['filters']=_[_0xfa0b('0x29')](_0x73f57b['model'],_0x73f57b[_0xfa0b('0x2a')]);_0x1d4566[_0xfa0b('0x2b')]=_['intersection'](_0x73f57b[_0xfa0b('0x27')],qs['fields'](_0x4492c9[_0xfa0b('0x2a')][_0xfa0b('0x2c')]));_0x1d4566[_0xfa0b('0x2b')]=_0x1d4566[_0xfa0b('0x2b')]['length']?_0x1d4566[_0xfa0b('0x2b')]:_0x73f57b['model'];if(!_0x4492c9[_0xfa0b('0x2a')][_0xfa0b('0x2d')](_0xfa0b('0x2e'))){_0x1d4566[_0xfa0b('0x19')]=qs[_0xfa0b('0x19')](_0x4492c9['query'][_0xfa0b('0x19')]);_0x1d4566[_0xfa0b('0x2f')]=qs[_0xfa0b('0x2f')](_0x4492c9[_0xfa0b('0x2a')][_0xfa0b('0x2f')]);}_0x1d4566[_0xfa0b('0x30')]=qs[_0xfa0b('0x31')](_0x4492c9[_0xfa0b('0x2a')]['sort']);_0x1d4566[_0xfa0b('0x32')]=qs[_0xfa0b('0x33')](_[_0xfa0b('0x34')](_0x4492c9[_0xfa0b('0x2a')],_0x73f57b[_0xfa0b('0x33')]),_0xa2871b);if(_0x4492c9[_0xfa0b('0x2a')]['filter']){_0x1d4566[_0xfa0b('0x32')]=_['merge'](_0x1d4566['where'],{'$or':_[_0xfa0b('0x23')](_0xa2871b,function(_0x3110b9){if(_0x3110b9[_0xfa0b('0x35')]!=='VIRTUAL'){var _0x2a547e={};_0x2a547e[_0x3110b9[_0xfa0b('0x21')]]={'$like':'%'+_0x4492c9[_0xfa0b('0x2a')][_0xfa0b('0x36')]+'%'};return _0x2a547e;}})});}_0x1d4566=_[_0xfa0b('0x37')]({},_0x1d4566,_0x4492c9[_0xfa0b('0x38')]);var _0x576c09={'where':_0x1d4566[_0xfa0b('0x32')]};return db[_0xfa0b('0x24')][_0xfa0b('0x18')](_0x576c09)['then'](function(_0x307052){_0x60e27e['count']=_0x307052;if(_0x4492c9[_0xfa0b('0x2a')]['includeAll']){_0x1d4566[_0xfa0b('0x39')]=[{'all':!![]}];}return db[_0xfa0b('0x24')][_0xfa0b('0x3a')](_0x1d4566);})[_0xfa0b('0x1e')](function(_0x4ce308){_0x60e27e[_0xfa0b('0x3b')]=_0x4ce308;return _0x60e27e;})[_0xfa0b('0x1e')](respondWithFilteredResult(_0x13418e,_0x1d4566))[_0xfa0b('0x3c')](handleError(_0x13418e,null));};exports[_0xfa0b('0x3d')]=function(_0x1c95fb,_0x1f8ced){var _0x32ee5f={'raw':!![],'where':{'id':_0x1c95fb[_0xfa0b('0x3e')]['id']}},_0x3d900e={};_0x3d900e['model']=_['keys'](db[_0xfa0b('0x24')]['rawAttributes']);_0x3d900e[_0xfa0b('0x2a')]=_['keys'](_0x1c95fb[_0xfa0b('0x2a')]);_0x3d900e['filters']=_[_0xfa0b('0x29')](_0x3d900e[_0xfa0b('0x27')],_0x3d900e[_0xfa0b('0x2a')]);_0x32ee5f[_0xfa0b('0x2b')]=_[_0xfa0b('0x29')](_0x3d900e['model'],qs[_0xfa0b('0x2c')](_0x1c95fb[_0xfa0b('0x2a')][_0xfa0b('0x2c')]));_0x32ee5f[_0xfa0b('0x2b')]=_0x32ee5f[_0xfa0b('0x2b')][_0xfa0b('0x3f')]?_0x32ee5f['attributes']:_0x3d900e[_0xfa0b('0x27')];if(_0x1c95fb[_0xfa0b('0x2a')][_0xfa0b('0x40')]){_0x32ee5f[_0xfa0b('0x39')]=[{'all':!![]}];}_0x32ee5f=_['merge']({},_0x32ee5f,_0x1c95fb['options']);return db['OpenchannelQueueReport'][_0xfa0b('0x41')](_0x32ee5f)[_0xfa0b('0x1e')](handleEntityNotFound(_0x1f8ced,null))['then'](respondWithResult(_0x1f8ced,null))[_0xfa0b('0x3c')](handleError(_0x1f8ced,null));};exports[_0xfa0b('0x42')]=function(_0x3d0813,_0x59f2b2){return db['OpenchannelQueueReport'][_0xfa0b('0x42')](_0x3d0813[_0xfa0b('0x43')],{})[_0xfa0b('0x1e')](respondWithResult(_0x59f2b2,0xc9))['catch'](handleError(_0x59f2b2,null));};exports['update']=function(_0xb21a9b,_0x396ec9){if(_0xb21a9b['body']['id']){delete _0xb21a9b[_0xfa0b('0x43')]['id'];}return db[_0xfa0b('0x24')][_0xfa0b('0x41')]({'where':{'id':_0xb21a9b[_0xfa0b('0x3e')]['id']}})[_0xfa0b('0x1e')](handleEntityNotFound(_0x396ec9,null))[_0xfa0b('0x1e')](saveUpdates(_0xb21a9b['body'],null))['then'](respondWithResult(_0x396ec9,null))[_0xfa0b('0x3c')](handleError(_0x396ec9,null));};exports[_0xfa0b('0x1f')]=function(_0x18e2a3,_0x3abb7a){return db[_0xfa0b('0x24')][_0xfa0b('0x41')]({'where':{'id':_0x18e2a3[_0xfa0b('0x3e')]['id']}})[_0xfa0b('0x1e')](handleEntityNotFound(_0x3abb7a,null))[_0xfa0b('0x1e')](removeEntity(_0x3abb7a,null))[_0xfa0b('0x3c')](handleError(_0x3abb7a,null));};exports['describe']=function(_0x6edf6a,_0x296c8c){return db[_0xfa0b('0x24')][_0xfa0b('0x44')]()[_0xfa0b('0x1e')](respondWithResult(_0x296c8c,null))[_0xfa0b('0x3c')](handleError(_0x296c8c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8bc61cd..9cf4346 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 _0x2a0d=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x139882,_0x484286){var _0xfe6e4b=function(_0x8afc5f){while(--_0x8afc5f){_0x139882['push'](_0x139882['shift']());}};_0xfe6e4b(++_0x484286);}(_0x2a0d,0x109));var _0xd2a0=function(_0x299962,_0x274432){_0x299962=_0x299962-0x0;var _0x5260d5=_0x2a0d[_0x299962];return _0x5260d5;};'use strict';var _=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var logger=require('../../config/logger')(_0xd2a0('0x2'));var moment=require(_0xd2a0('0x3'));var BPromise=require(_0xd2a0('0x4'));var rp=require(_0xd2a0('0x5'));var fs=require('fs');var path=require(_0xd2a0('0x6'));var rimraf=require(_0xd2a0('0x7'));var config=require(_0xd2a0('0x8'));var attributes=require(_0xd2a0('0x9'));module['exports']=function(_0x255d5d,_0x280d91){return _0x255d5d[_0xd2a0('0xa')](_0xd2a0('0xb'),attributes,{'tableName':_0xd2a0('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd2a0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1561=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0x1561,0x1bd));var _0x1156=function(_0x4c43c4,_0x1085f9){_0x4c43c4=_0x4c43c4-0x0;var _0x3c9524=_0x1561[_0x4c43c4];return _0x3c9524;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1156('0x0'))(_0x1156('0x1'));var moment=require(_0x1156('0x2'));var BPromise=require(_0x1156('0x3'));var rp=require(_0x1156('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1156('0x5'));var config=require(_0x1156('0x6'));var attributes=require(_0x1156('0x7'));module[_0x1156('0x8')]=function(_0x5c989c,_0xb0dab7){return _0x5c989c['define'](_0x1156('0x9'),attributes,{'tableName':_0x1156('0xa'),'paranoid':![],'indexes':[{'name':_0x1156('0xb'),'fields':[_0x1156('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6766ebe..222c0d2 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 _0xc43c=['limit','UpdateOpenchannelQueueReport','lodash','util','moment','../../mysqldb','../../config/environment','jayson/promise','client','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','update','where','attributes'];(function(_0x457849,_0x3ca70a){var _0x5dd9d0=function(_0x3f984a){while(--_0x3f984a){_0x457849['push'](_0x457849['shift']());}};_0x5dd9d0(++_0x3ca70a);}(_0xc43c,0xd4));var _0xcc43=function(_0x52778e,_0x13789d){_0x52778e=_0x52778e-0x0;var _0x16f982=_0xc43c[_0x52778e];return _0x16f982;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc43('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcc43('0x4'));var jayson=require(_0xcc43('0x5'));var client=jayson[_0xcc43('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359663,_0x3896a9,_0x36e3a5){return new BPromise(function(_0x25528e,_0x335084){return client[_0xcc43('0x7')](_0x359663,_0x36e3a5)[_0xcc43('0x8')](function(_0xd311b1){logger['info'](_0xcc43('0x9'),_0x3896a9,_0xcc43('0xa'));logger[_0xcc43('0xb')](_0xcc43('0xc'),_0x3896a9,_0xcc43('0xa'),JSON[_0xcc43('0xd')](_0xd311b1));if(_0xd311b1[_0xcc43('0xe')]){if(_0xd311b1[_0xcc43('0xe')][_0xcc43('0xf')]===0x1f4){logger[_0xcc43('0xe')](_0xcc43('0x9'),_0x3896a9,_0xd311b1['error'][_0xcc43('0x10')]);return _0x335084(_0xd311b1[_0xcc43('0xe')][_0xcc43('0x10')]);}logger[_0xcc43('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3896a9,_0xd311b1[_0xcc43('0xe')][_0xcc43('0x10')]);return _0x25528e(_0xd311b1[_0xcc43('0xe')][_0xcc43('0x10')]);}else{logger[_0xcc43('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3896a9,_0xcc43('0xa'));_0x25528e(_0xd311b1[_0xcc43('0x12')]['message']);}})[_0xcc43('0x13')](function(_0x5ae3e4){logger[_0xcc43('0xe')](_0xcc43('0x9'),_0x3896a9,_0x5ae3e4);_0x335084(_0x5ae3e4);});});}exports[_0xcc43('0x14')]=function(_0x50348a){var _0x44628c=this;return new Promise(function(_0x295ecb,_0x313402){return db[_0xcc43('0x15')]['create'](_0x50348a[_0xcc43('0x16')],{'raw':_0x50348a[_0xcc43('0x17')]?_0x50348a['options'][_0xcc43('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xcfb0d9){logger['info'](_0xcc43('0x14'),_0x50348a);logger[_0xcc43('0xb')](_0xcc43('0x14'),_0x50348a,JSON['stringify'](_0xcfb0d9));_0x295ecb(_0xcfb0d9);})[_0xcc43('0x13')](function(_0x5e0a61){logger[_0xcc43('0xe')](_0xcc43('0x14'),_0x5e0a61[_0xcc43('0x10')],_0x50348a);_0x313402(_0x44628c[_0xcc43('0xe')](0x1f4,_0x5e0a61[_0xcc43('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ba3d0){var _0x164551=this;return new Promise(function(_0x5caa7a,_0x46378e){return db[_0xcc43('0x15')][_0xcc43('0x19')](_0x2ba3d0['body'],{'raw':_0x2ba3d0[_0xcc43('0x17')]?_0x2ba3d0['options'][_0xcc43('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba3d0[_0xcc43('0x17')]?_0x2ba3d0[_0xcc43('0x17')][_0xcc43('0x1a')]||null:null,'attributes':_0x2ba3d0[_0xcc43('0x17')]?_0x2ba3d0['options'][_0xcc43('0x1b')]||null:null,'limit':_0x2ba3d0[_0xcc43('0x17')]?_0x2ba3d0[_0xcc43('0x17')][_0xcc43('0x1c')]||null:null})[_0xcc43('0x8')](function(_0x5940da){logger['info'](_0xcc43('0x1d'),_0x2ba3d0);logger[_0xcc43('0xb')](_0xcc43('0x1d'),_0x2ba3d0,JSON[_0xcc43('0xd')](_0x5940da));_0x5caa7a(_0x5940da);})['catch'](function(_0x40642f){logger[_0xcc43('0xe')](_0xcc43('0x1d'),_0x40642f[_0xcc43('0x10')],_0x2ba3d0);_0x46378e(_0x164551['error'](0x1f4,_0x40642f[_0xcc43('0x10')]));});});}; \ No newline at end of file +var _0x7af9=['error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','create','body','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','options','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x345220,_0xc0a015){var _0x13b089=function(_0x63331d){while(--_0x63331d){_0x345220['push'](_0x345220['shift']());}};_0x13b089(++_0xc0a015);}(_0x7af9,0x95));var _0x97af=function(_0x17e006,_0x441a81){_0x17e006=_0x17e006-0x0;var _0x23e290=_0x7af9[_0x17e006];return _0x23e290;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x966c4e,_0x265d22,_0x70b4db){return new BPromise(function(_0x52835d,_0x2c2ee4){return client[_0x97af('0x9')](_0x966c4e,_0x70b4db)[_0x97af('0xa')](function(_0x4b866a){logger[_0x97af('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x265d22,_0x97af('0xc'));logger[_0x97af('0xd')](_0x97af('0xe'),_0x265d22,_0x97af('0xc'),JSON[_0x97af('0xf')](_0x4b866a));if(_0x4b866a[_0x97af('0x10')]){if(_0x4b866a[_0x97af('0x10')][_0x97af('0x11')]===0x1f4){logger[_0x97af('0x10')](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')]['message']);return _0x2c2ee4(_0x4b866a[_0x97af('0x10')]['message']);}logger['error'](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);return _0x52835d(_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);}else{logger[_0x97af('0xb')](_0x97af('0x12'),_0x265d22,'request\x20sent');_0x52835d(_0x4b866a[_0x97af('0x14')]['message']);}})[_0x97af('0x15')](function(_0x58d967){logger[_0x97af('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x265d22,_0x58d967);_0x2c2ee4(_0x58d967);});});}exports[_0x97af('0x16')]=function(_0x2ae4ce){var _0x3815da=this;return new Promise(function(_0x1481d4,_0xc5c15f){return db['OpenchannelQueueReport'][_0x97af('0x17')](_0x2ae4ce[_0x97af('0x18')],{'raw':_0x2ae4ce['options']?_0x2ae4ce['options'][_0x97af('0x19')]===undefined?!![]:![]:!![]})[_0x97af('0xa')](function(_0x5dcd87){logger[_0x97af('0xb')]('CreateOpenchannelQueueReport',_0x2ae4ce);logger[_0x97af('0xd')](_0x97af('0x16'),_0x2ae4ce,JSON[_0x97af('0xf')](_0x5dcd87));_0x1481d4(_0x5dcd87);})[_0x97af('0x15')](function(_0x36c378){logger['error'](_0x97af('0x16'),_0x36c378[_0x97af('0x13')],_0x2ae4ce);_0xc5c15f(_0x3815da[_0x97af('0x10')](0x1f4,_0x36c378[_0x97af('0x13')]));});});};exports[_0x97af('0x1a')]=function(_0x2a7740){var _0x275e8c=this;return new Promise(function(_0x41122c,_0x5ad95e){return db[_0x97af('0x1b')][_0x97af('0x1c')](_0x2a7740[_0x97af('0x18')],{'raw':_0x2a7740[_0x97af('0x1d')]?_0x2a7740[_0x97af('0x1d')][_0x97af('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7740['options']?_0x2a7740[_0x97af('0x1d')][_0x97af('0x1e')]||null:null,'attributes':_0x2a7740[_0x97af('0x1d')]?_0x2a7740[_0x97af('0x1d')][_0x97af('0x1f')]||null:null,'limit':_0x2a7740['options']?_0x2a7740[_0x97af('0x1d')][_0x97af('0x20')]||null:null})['then'](function(_0x258193){logger[_0x97af('0xb')](_0x97af('0x1a'),_0x2a7740);logger[_0x97af('0xd')](_0x97af('0x1a'),_0x2a7740,JSON[_0x97af('0xf')](_0x258193));_0x41122c(_0x258193);})[_0x97af('0x15')](function(_0x26f891){logger[_0x97af('0x10')](_0x97af('0x1a'),_0x26f891['message'],_0x2a7740);_0x5ad95e(_0x275e8c[_0x97af('0x10')](0x1f4,_0x26f891['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5dfe743..824d27f 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(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 fcd1304..359a0b7 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 _0x5059=['queue','DATE','NOW','moment','STRING'];(function(_0x13184d,_0x6bdeb0){var _0x384a96=function(_0x17070d){while(--_0x17070d){_0x13184d['push'](_0x13184d['shift']());}};_0x384a96(++_0x6bdeb0);}(_0x5059,0xcb));var _0x9505=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x5059[_0x54eab6];return _0x1e7435;};'use strict';var moment=require(_0x9505('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9505('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x9505('0x2')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9505('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x9505('0x4')]}}; \ No newline at end of file +var _0x0626=['sequelize','STRING','ENUM','account','queue','NOW','moment'];(function(_0x28b90b,_0x463ddb){var _0x57fe9f=function(_0x46b148){while(--_0x46b148){_0x28b90b['push'](_0x28b90b['shift']());}};_0x57fe9f(++_0x463ddb);}(_0x0626,0x156));var _0x6062=function(_0x1335d2,_0x2f0a77){_0x1335d2=_0x1335d2-0x0;var _0x486bd1=_0x0626[_0x1335d2];return _0x486bd1;};'use strict';var moment=require(_0x6062('0x0'));var Sequelize=require(_0x6062('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6062('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6062('0x3')](_0x6062('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x6062('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6062('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8ec3f58..a5780b1 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 _0xd88c=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','name','send','index','OpenchannelTransferReport','rawAttributes','key','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','params','length','include','find','catch','create','body','describe','html-pdf'];(function(_0x143b5a,_0x1c2fb8){var _0x3a2d55=function(_0x2f94bf){while(--_0x2f94bf){_0x143b5a['push'](_0x143b5a['shift']());}};_0x3a2d55(++_0x1c2fb8);}(_0xd88c,0x19d));var _0xcd88=function(_0x416326,_0xd2abb0){_0x416326=_0x416326-0x0;var _0xa70bf5=_0xd88c[_0x416326];return _0xa70bf5;};'use strict';var pdf=require(_0xcd88('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcd88('0x1'));var rp=require('request-promise');var moment=require(_0xcd88('0x2'));var BPromise=require(_0xcd88('0x3'));var Mustache=require('mustache');var util=require(_0xcd88('0x4'));var path=require(_0xcd88('0x5'));var sox=require(_0xcd88('0x6'));var csv=require(_0xcd88('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd88('0x8'));var squel=require(_0xcd88('0x9'));var crypto=require(_0xcd88('0xa'));var jsforce=require(_0xcd88('0xb'));var deskjs=require(_0xcd88('0xc'));var toCsv=require(_0xcd88('0x7'));var querystring=require(_0xcd88('0xd'));var Papa=require(_0xcd88('0xe'));var Redis=require(_0xcd88('0xf'));var authService=require(_0xcd88('0x10'));var qs=require(_0xcd88('0x11'));var as=require(_0xcd88('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd88('0x13'))('api');var utils=require(_0xcd88('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551c65,_0x4a2cc7){_0x4a2cc7=_0x4a2cc7||0xcc;return function(_0x378729){if(_0x378729){return _0x551c65[_0xcd88('0x15')](_0x4a2cc7);}return _0x551c65[_0xcd88('0x16')](_0x4a2cc7)[_0xcd88('0x17')]();};}function respondWithResult(_0x2b3872,_0x4011c0){_0x4011c0=_0x4011c0||0xc8;return function(_0x7b0e4a){if(_0x7b0e4a){return _0x2b3872[_0xcd88('0x16')](_0x4011c0)[_0xcd88('0x18')](_0x7b0e4a);}};}function respondWithFilteredResult(_0x471a77,_0x43892d){return function(_0x18d36c){if(_0x18d36c){var _0x398eac=_0x18d36c[_0xcd88('0x19')],_0x422ff6=_0x43892d['offset'],_0x56a4c2=_0x43892d[_0xcd88('0x1a')]+_0x43892d['limit'],_0x139e21;if(_0x56a4c2>=_0x398eac){_0x56a4c2=_0x398eac;_0x139e21=0xc8;}else{_0x139e21=0xce;}_0x471a77[_0xcd88('0x16')](_0x139e21);return _0x471a77[_0xcd88('0x1b')]('Content-Range',_0x422ff6+'-'+_0x56a4c2+'/'+_0x398eac)[_0xcd88('0x18')](_0x18d36c);}return null;};}function patchUpdates(_0x517a38){return function(_0x5f1a4e){try{jsonpatch[_0xcd88('0x1c')](_0x5f1a4e,_0x517a38,!![]);}catch(_0x286fdf){return BPromise[_0xcd88('0x1d')](_0x286fdf);}return _0x5f1a4e[_0xcd88('0x1e')]();};}function saveUpdates(_0x25d9af,_0x5965fa){return function(_0x478d92){if(_0x478d92){return _0x478d92[_0xcd88('0x1f')](_0x25d9af)[_0xcd88('0x20')](function(_0xb4c008){return _0xb4c008;});}return null;};}function removeEntity(_0x4c7ba6,_0x4b690a){return function(_0x35cb01){if(_0x35cb01){return _0x35cb01[_0xcd88('0x21')]()[_0xcd88('0x20')](function(){_0x4c7ba6[_0xcd88('0x16')](0xcc)[_0xcd88('0x17')]();});}};}function handleEntityNotFound(_0x29c1cd,_0x2326c8){return function(_0x4e2694){if(!_0x4e2694){_0x29c1cd[_0xcd88('0x15')](0x194);}return _0x4e2694;};}function handleError(_0x56f1ed,_0x300e8b){_0x300e8b=_0x300e8b||0x1f4;return function(_0x2abebd){logger['error'](_0x2abebd['stack']);if(_0x2abebd[_0xcd88('0x22')]){delete _0x2abebd[_0xcd88('0x22')];}_0x56f1ed[_0xcd88('0x16')](_0x300e8b)[_0xcd88('0x23')](_0x2abebd);};}exports[_0xcd88('0x24')]=function(_0x24bbac,_0x7b9e82){var _0x167c7d={},_0x67e5c2={},_0x14e438={'count':0x0,'rows':[]};var _0x253fe6=_['map'](db[_0xcd88('0x25')][_0xcd88('0x26')],function(_0x30d69a){return{'name':_0x30d69a['fieldName'],'type':_0x30d69a['type'][_0xcd88('0x27')]};});_0x67e5c2['model']=_[_0xcd88('0x28')](_0x253fe6,_0xcd88('0x22'));_0x67e5c2['query']=_[_0xcd88('0x29')](_0x24bbac['query']);_0x67e5c2[_0xcd88('0x2a')]=_[_0xcd88('0x2b')](_0x67e5c2[_0xcd88('0x2c')],_0x67e5c2[_0xcd88('0x2d')]);_0x167c7d[_0xcd88('0x2e')]=_[_0xcd88('0x2b')](_0x67e5c2[_0xcd88('0x2c')],qs[_0xcd88('0x2f')](_0x24bbac['query'][_0xcd88('0x2f')]));_0x167c7d['attributes']=_0x167c7d[_0xcd88('0x2e')]['length']?_0x167c7d['attributes']:_0x67e5c2[_0xcd88('0x2c')];if(!_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x30')](_0xcd88('0x31'))){_0x167c7d[_0xcd88('0x32')]=qs[_0xcd88('0x32')](_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x32')]);_0x167c7d[_0xcd88('0x1a')]=qs['offset'](_0x24bbac['query'][_0xcd88('0x1a')]);}_0x167c7d[_0xcd88('0x33')]=qs[_0xcd88('0x34')](_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x34')]);_0x167c7d[_0xcd88('0x35')]=qs[_0xcd88('0x2a')](_['pick'](_0x24bbac[_0xcd88('0x2d')],_0x67e5c2[_0xcd88('0x2a')]),_0x253fe6);if(_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x36')]){_0x167c7d['where']=_[_0xcd88('0x37')](_0x167c7d['where'],{'$or':_[_0xcd88('0x28')](_0x253fe6,function(_0x3dbdf6){if(_0x3dbdf6[_0xcd88('0x38')]!==_0xcd88('0x39')){var _0x5cbe5f={};_0x5cbe5f[_0x3dbdf6['name']]={'$like':'%'+_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x36')]+'%'};return _0x5cbe5f;}})});}_0x167c7d=_[_0xcd88('0x37')]({},_0x167c7d,_0x24bbac[_0xcd88('0x3a')]);var _0x288bc0={'where':_0x167c7d[_0xcd88('0x35')]};return db[_0xcd88('0x25')]['count'](_0x288bc0)['then'](function(_0x2aeb13){_0x14e438['count']=_0x2aeb13;if(_0x24bbac[_0xcd88('0x2d')][_0xcd88('0x3b')]){_0x167c7d['include']=[{'all':!![]}];}return db[_0xcd88('0x25')][_0xcd88('0x3c')](_0x167c7d);})[_0xcd88('0x20')](function(_0x29c412){_0x14e438['rows']=_0x29c412;return _0x14e438;})[_0xcd88('0x20')](respondWithFilteredResult(_0x7b9e82,_0x167c7d))['catch'](handleError(_0x7b9e82,null));};exports['show']=function(_0x3d8251,_0x1b0146){var _0x1903c1={'raw':!![],'where':{'id':_0x3d8251[_0xcd88('0x3d')]['id']}},_0x48df4b={};_0x48df4b[_0xcd88('0x2c')]=_[_0xcd88('0x29')](db['OpenchannelTransferReport'][_0xcd88('0x26')]);_0x48df4b[_0xcd88('0x2d')]=_[_0xcd88('0x29')](_0x3d8251[_0xcd88('0x2d')]);_0x48df4b[_0xcd88('0x2a')]=_[_0xcd88('0x2b')](_0x48df4b[_0xcd88('0x2c')],_0x48df4b['query']);_0x1903c1[_0xcd88('0x2e')]=_['intersection'](_0x48df4b[_0xcd88('0x2c')],qs[_0xcd88('0x2f')](_0x3d8251[_0xcd88('0x2d')][_0xcd88('0x2f')]));_0x1903c1[_0xcd88('0x2e')]=_0x1903c1[_0xcd88('0x2e')][_0xcd88('0x3e')]?_0x1903c1[_0xcd88('0x2e')]:_0x48df4b[_0xcd88('0x2c')];if(_0x3d8251['query'][_0xcd88('0x3b')]){_0x1903c1[_0xcd88('0x3f')]=[{'all':!![]}];}_0x1903c1=_['merge']({},_0x1903c1,_0x3d8251[_0xcd88('0x3a')]);return db[_0xcd88('0x25')][_0xcd88('0x40')](_0x1903c1)['then'](handleEntityNotFound(_0x1b0146,null))[_0xcd88('0x20')](respondWithResult(_0x1b0146,null))[_0xcd88('0x41')](handleError(_0x1b0146,null));};exports[_0xcd88('0x42')]=function(_0x35b72a,_0x3c4b6d){return db[_0xcd88('0x25')][_0xcd88('0x42')](_0x35b72a['body'],{})[_0xcd88('0x20')](respondWithResult(_0x3c4b6d,0xc9))[_0xcd88('0x41')](handleError(_0x3c4b6d,null));};exports[_0xcd88('0x1f')]=function(_0x46720b,_0x74f123){if(_0x46720b[_0xcd88('0x43')]['id']){delete _0x46720b['body']['id'];}return db[_0xcd88('0x25')][_0xcd88('0x40')]({'where':{'id':_0x46720b[_0xcd88('0x3d')]['id']}})[_0xcd88('0x20')](handleEntityNotFound(_0x74f123,null))[_0xcd88('0x20')](saveUpdates(_0x46720b[_0xcd88('0x43')],null))[_0xcd88('0x20')](respondWithResult(_0x74f123,null))[_0xcd88('0x41')](handleError(_0x74f123,null));};exports[_0xcd88('0x21')]=function(_0x33a30a,_0x251c10){return db[_0xcd88('0x25')][_0xcd88('0x40')]({'where':{'id':_0x33a30a[_0xcd88('0x3d')]['id']}})[_0xcd88('0x20')](handleEntityNotFound(_0x251c10,null))[_0xcd88('0x20')](removeEntity(_0x251c10,null))['catch'](handleError(_0x251c10,null));};exports[_0xcd88('0x44')]=function(_0x18c764,_0x126498){return db[_0xcd88('0x25')][_0xcd88('0x44')]()[_0xcd88('0x20')](respondWithResult(_0x126498,null))[_0xcd88('0x41')](handleError(_0x126498,null));}; \ No newline at end of file +var _0x95c8=['findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options'];(function(_0x3d0031,_0x46a062){var _0xfed1ce=function(_0x5e5dca){while(--_0x5e5dca){_0x3d0031['push'](_0x3d0031['shift']());}};_0xfed1ce(++_0x46a062);}(_0x95c8,0x128));var _0x895c=function(_0xb6f459,_0x208495){_0xb6f459=_0xb6f459-0x0;var _0x2c71da=_0x95c8[_0xb6f459];return _0x2c71da;};'use strict';var pdf=require(_0x895c('0x0'));var emlformat=require(_0x895c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x895c('0x2'));var jsonpatch=require(_0x895c('0x3'));var rp=require(_0x895c('0x4'));var moment=require('moment');var BPromise=require(_0x895c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x895c('0x6'));var sox=require(_0x895c('0x7'));var csv=require(_0x895c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x895c('0x9'));var squel=require(_0x895c('0xa'));var crypto=require(_0x895c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x895c('0x8'));var querystring=require('querystring');var Papa=require(_0x895c('0xc'));var Redis=require('ioredis');var authService=require(_0x895c('0xd'));var qs=require(_0x895c('0xe'));var as=require(_0x895c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x895c('0x10'))(_0x895c('0x11'));var utils=require(_0x895c('0x12'));var config=require('../../config/environment');var db=require(_0x895c('0x13'))['db'];function respondWithStatusCode(_0x5d40a4,_0xa567d0){_0xa567d0=_0xa567d0||0xcc;return function(_0x3228b2){if(_0x3228b2){return _0x5d40a4['sendStatus'](_0xa567d0);}return _0x5d40a4[_0x895c('0x14')](_0xa567d0)[_0x895c('0x15')]();};}function respondWithResult(_0x2b8678,_0x3885b8){_0x3885b8=_0x3885b8||0xc8;return function(_0x12dc3c){if(_0x12dc3c){return _0x2b8678[_0x895c('0x14')](_0x3885b8)[_0x895c('0x16')](_0x12dc3c);}};}function respondWithFilteredResult(_0x1b7082,_0x410eb1){return function(_0xf9e3a7){if(_0xf9e3a7){var _0x17a8b2=_0xf9e3a7[_0x895c('0x17')],_0x3d8b72=_0x410eb1[_0x895c('0x18')],_0x50eb7c=_0x410eb1['offset']+_0x410eb1['limit'],_0x50666a;if(_0x50eb7c>=_0x17a8b2){_0x50eb7c=_0x17a8b2;_0x50666a=0xc8;}else{_0x50666a=0xce;}_0x1b7082[_0x895c('0x14')](_0x50666a);return _0x1b7082[_0x895c('0x19')](_0x895c('0x1a'),_0x3d8b72+'-'+_0x50eb7c+'/'+_0x17a8b2)[_0x895c('0x16')](_0xf9e3a7);}return null;};}function patchUpdates(_0xbad5c0){return function(_0x415e2a){try{jsonpatch[_0x895c('0x1b')](_0x415e2a,_0xbad5c0,!![]);}catch(_0x15ba58){return BPromise[_0x895c('0x1c')](_0x15ba58);}return _0x415e2a['save']();};}function saveUpdates(_0x218403,_0x4132f7){return function(_0x4ee9dc){if(_0x4ee9dc){return _0x4ee9dc['update'](_0x218403)[_0x895c('0x1d')](function(_0x3da1d4){return _0x3da1d4;});}return null;};}function removeEntity(_0x1d3d96,_0x539384){return function(_0x5925d9){if(_0x5925d9){return _0x5925d9['destroy']()[_0x895c('0x1d')](function(){_0x1d3d96['status'](0xcc)[_0x895c('0x15')]();});}};}function handleEntityNotFound(_0x1db8e5,_0x54a0af){return function(_0x53d1a9){if(!_0x53d1a9){_0x1db8e5[_0x895c('0x1e')](0x194);}return _0x53d1a9;};}function handleError(_0x585d06,_0x5de882){_0x5de882=_0x5de882||0x1f4;return function(_0x2be509){logger[_0x895c('0x1f')](_0x2be509[_0x895c('0x20')]);if(_0x2be509[_0x895c('0x21')]){delete _0x2be509[_0x895c('0x21')];}_0x585d06[_0x895c('0x14')](_0x5de882)[_0x895c('0x22')](_0x2be509);};}exports[_0x895c('0x23')]=function(_0x30246a,_0x73f63e){var _0x1eb588={},_0x1b2d7e={},_0x343c86={'count':0x0,'rows':[]};var _0xe0af43=_[_0x895c('0x24')](db[_0x895c('0x25')][_0x895c('0x26')],function(_0x5b0e88){return{'name':_0x5b0e88[_0x895c('0x27')],'type':_0x5b0e88[_0x895c('0x28')][_0x895c('0x29')]};});_0x1b2d7e['model']=_[_0x895c('0x24')](_0xe0af43,_0x895c('0x21'));_0x1b2d7e['query']=_[_0x895c('0x2a')](_0x30246a['query']);_0x1b2d7e[_0x895c('0x2b')]=_[_0x895c('0x2c')](_0x1b2d7e[_0x895c('0x2d')],_0x1b2d7e[_0x895c('0x2e')]);_0x1eb588[_0x895c('0x2f')]=_[_0x895c('0x2c')](_0x1b2d7e[_0x895c('0x2d')],qs['fields'](_0x30246a['query'][_0x895c('0x30')]));_0x1eb588[_0x895c('0x2f')]=_0x1eb588[_0x895c('0x2f')][_0x895c('0x31')]?_0x1eb588[_0x895c('0x2f')]:_0x1b2d7e[_0x895c('0x2d')];if(!_0x30246a[_0x895c('0x2e')][_0x895c('0x32')](_0x895c('0x33'))){_0x1eb588[_0x895c('0x34')]=qs[_0x895c('0x34')](_0x30246a[_0x895c('0x2e')]['limit']);_0x1eb588[_0x895c('0x18')]=qs[_0x895c('0x18')](_0x30246a['query']['offset']);}_0x1eb588[_0x895c('0x35')]=qs[_0x895c('0x36')](_0x30246a[_0x895c('0x2e')][_0x895c('0x36')]);_0x1eb588[_0x895c('0x37')]=qs[_0x895c('0x2b')](_[_0x895c('0x38')](_0x30246a[_0x895c('0x2e')],_0x1b2d7e[_0x895c('0x2b')]),_0xe0af43);if(_0x30246a['query']['filter']){_0x1eb588[_0x895c('0x37')]=_[_0x895c('0x39')](_0x1eb588[_0x895c('0x37')],{'$or':_['map'](_0xe0af43,function(_0x2339bc){if(_0x2339bc['type']!=='VIRTUAL'){var _0x493b19={};_0x493b19[_0x2339bc[_0x895c('0x21')]]={'$like':'%'+_0x30246a['query']['filter']+'%'};return _0x493b19;}})});}_0x1eb588=_[_0x895c('0x39')]({},_0x1eb588,_0x30246a[_0x895c('0x3a')]);var _0x3134ab={'where':_0x1eb588[_0x895c('0x37')]};return db[_0x895c('0x25')][_0x895c('0x17')](_0x3134ab)[_0x895c('0x1d')](function(_0x3f85be){_0x343c86['count']=_0x3f85be;if(_0x30246a['query']['includeAll']){_0x1eb588['include']=[{'all':!![]}];}return db[_0x895c('0x25')][_0x895c('0x3b')](_0x1eb588);})[_0x895c('0x1d')](function(_0x169d28){_0x343c86[_0x895c('0x3c')]=_0x169d28;return _0x343c86;})[_0x895c('0x1d')](respondWithFilteredResult(_0x73f63e,_0x1eb588))[_0x895c('0x3d')](handleError(_0x73f63e,null));};exports[_0x895c('0x3e')]=function(_0x42cc39,_0x369acd){var _0x3b1615={'raw':!![],'where':{'id':_0x42cc39[_0x895c('0x3f')]['id']}},_0x356db5={};_0x356db5['model']=_[_0x895c('0x2a')](db[_0x895c('0x25')][_0x895c('0x26')]);_0x356db5[_0x895c('0x2e')]=_[_0x895c('0x2a')](_0x42cc39[_0x895c('0x2e')]);_0x356db5[_0x895c('0x2b')]=_[_0x895c('0x2c')](_0x356db5[_0x895c('0x2d')],_0x356db5['query']);_0x3b1615[_0x895c('0x2f')]=_[_0x895c('0x2c')](_0x356db5[_0x895c('0x2d')],qs[_0x895c('0x30')](_0x42cc39[_0x895c('0x2e')][_0x895c('0x30')]));_0x3b1615[_0x895c('0x2f')]=_0x3b1615[_0x895c('0x2f')][_0x895c('0x31')]?_0x3b1615['attributes']:_0x356db5[_0x895c('0x2d')];if(_0x42cc39[_0x895c('0x2e')][_0x895c('0x40')]){_0x3b1615[_0x895c('0x41')]=[{'all':!![]}];}_0x3b1615=_[_0x895c('0x39')]({},_0x3b1615,_0x42cc39['options']);return db[_0x895c('0x25')][_0x895c('0x42')](_0x3b1615)[_0x895c('0x1d')](handleEntityNotFound(_0x369acd,null))[_0x895c('0x1d')](respondWithResult(_0x369acd,null))['catch'](handleError(_0x369acd,null));};exports[_0x895c('0x43')]=function(_0x130c35,_0x18a129){return db[_0x895c('0x25')][_0x895c('0x43')](_0x130c35['body'],{})[_0x895c('0x1d')](respondWithResult(_0x18a129,0xc9))[_0x895c('0x3d')](handleError(_0x18a129,null));};exports['update']=function(_0x3642a3,_0x26ee92){if(_0x3642a3[_0x895c('0x44')]['id']){delete _0x3642a3[_0x895c('0x44')]['id'];}return db[_0x895c('0x25')][_0x895c('0x42')]({'where':{'id':_0x3642a3[_0x895c('0x3f')]['id']}})[_0x895c('0x1d')](handleEntityNotFound(_0x26ee92,null))[_0x895c('0x1d')](saveUpdates(_0x3642a3[_0x895c('0x44')],null))['then'](respondWithResult(_0x26ee92,null))[_0x895c('0x3d')](handleError(_0x26ee92,null));};exports[_0x895c('0x45')]=function(_0x28933d,_0x327235){return db[_0x895c('0x25')]['find']({'where':{'id':_0x28933d['params']['id']}})[_0x895c('0x1d')](handleEntityNotFound(_0x327235,null))[_0x895c('0x1d')](removeEntity(_0x327235,null))[_0x895c('0x3d')](handleError(_0x327235,null));};exports['describe']=function(_0x5f46f2,_0x4135eb){return db[_0x895c('0x25')][_0x895c('0x46')]()[_0x895c('0x1d')](respondWithResult(_0x4135eb,null))[_0x895c('0x3d')](handleError(_0x4135eb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 535d79b..a64657d 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 _0xd7d5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x2a7376,_0x2af094){_0x2a7376=_0x2a7376-0x0;var _0x47a4ed=_0xd7d5[_0x2a7376];return _0x47a4ed;};'use strict';var _=require(_0x5d7d('0x0'));var util=require(_0x5d7d('0x1'));var logger=require(_0x5d7d('0x2'))(_0x5d7d('0x3'));var moment=require(_0x5d7d('0x4'));var BPromise=require(_0x5d7d('0x5'));var rp=require(_0x5d7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d7d('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d7d('0x8'));module[_0x5d7d('0x9')]=function(_0x297be9,_0x4b30eb){return _0x297be9[_0x5d7d('0xa')](_0x5d7d('0xb'),attributes,{'tableName':_0x5d7d('0xc'),'paranoid':![],'indexes':[{'name':_0x5d7d('0xd'),'fields':[_0x5d7d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3f=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b8956,_0x3a5c8d){var _0x2f5838=function(_0x11b1a4){while(--_0x11b1a4){_0x4b8956['push'](_0x4b8956['shift']());}};_0x2f5838(++_0x3a5c8d);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x45d934,_0x396e57){_0x45d934=_0x45d934-0x0;var _0xe172bf=_0xaa3f[_0x45d934];return _0xe172bf;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[{'name':_0xfaa3('0xd'),'fields':[_0xfaa3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 38afb22..1ed46d6 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 _0x212b=['jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x14fca2,_0x270886){var _0x576a3d=function(_0x387ea1){while(--_0x387ea1){_0x14fca2['push'](_0x14fca2['shift']());}};_0x576a3d(++_0x270886);}(_0x212b,0x148));var _0xb212=function(_0x4e813e,_0x11a983){_0x4e813e=_0x4e813e-0x0;var _0x46e865=_0x212b[_0x4e813e];return _0x46e865;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var moment=require(_0xb212('0x1'));var BPromise=require(_0xb212('0x2'));var rs=require(_0xb212('0x3'));var fs=require('fs');var Redis=require(_0xb212('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb212('0x5'));var logger=require(_0xb212('0x6'))(_0xb212('0x7'));var config=require('../../config/environment');var jayson=require(_0xb212('0x8'));var client=jayson[_0xb212('0x9')][_0xb212('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f604,_0x15a5a5,_0x3839e0){return new BPromise(function(_0x5c1000,_0x4cf8f7){return client[_0xb212('0xb')](_0x51f604,_0x3839e0)[_0xb212('0xc')](function(_0x5b6886){logger[_0xb212('0xd')](_0xb212('0xe'),_0x15a5a5,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x15a5a5,_0xb212('0xf'),JSON['stringify'](_0x5b6886));if(_0x5b6886[_0xb212('0x10')]){if(_0x5b6886[_0xb212('0x10')][_0xb212('0x11')]===0x1f4){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);return _0x4cf8f7(_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);}logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')]['message']);return _0x5c1000(_0x5b6886['error']['message']);}else{logger['info'](_0xb212('0xe'),_0x15a5a5,_0xb212('0xf'));_0x5c1000(_0x5b6886[_0xb212('0x13')]['message']);}})[_0xb212('0x14')](function(_0x285ef6){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x285ef6);_0x4cf8f7(_0x285ef6);});});} \ No newline at end of file +var _0x00ce=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x00ce,0x132));var _0xe00c=function(_0x112d4c,_0x224c56){_0x112d4c=_0x112d4c-0x0;var _0x458ac0=_0x00ce[_0x112d4c];return _0x458ac0;};'use strict';var _=require(_0xe00c('0x0'));var util=require(_0xe00c('0x1'));var moment=require(_0xe00c('0x2'));var BPromise=require(_0xe00c('0x3'));var rs=require(_0xe00c('0x4'));var fs=require('fs');var Redis=require(_0xe00c('0x5'));var db=require(_0xe00c('0x6'))['db'];var utils=require(_0xe00c('0x7'));var logger=require(_0xe00c('0x8'))(_0xe00c('0x9'));var config=require(_0xe00c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe00c('0xb')][_0xe00c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ceabd,_0x28ba6c,_0xeb7f87){return new BPromise(function(_0x543962,_0x33c5b7){return client[_0xe00c('0xd')](_0x4ceabd,_0xeb7f87)[_0xe00c('0xe')](function(_0x55813a){logger[_0xe00c('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x28ba6c,_0xe00c('0x10'));logger[_0xe00c('0x11')](_0xe00c('0x12'),_0x28ba6c,'request\x20sent',JSON[_0xe00c('0x13')](_0x55813a));if(_0x55813a[_0xe00c('0x14')]){if(_0x55813a[_0xe00c('0x14')][_0xe00c('0x15')]===0x1f4){logger[_0xe00c('0x14')](_0xe00c('0x16'),_0x28ba6c,_0x55813a['error'][_0xe00c('0x17')]);return _0x33c5b7(_0x55813a[_0xe00c('0x14')][_0xe00c('0x17')]);}logger['error'](_0xe00c('0x16'),_0x28ba6c,_0x55813a[_0xe00c('0x14')][_0xe00c('0x17')]);return _0x543962(_0x55813a[_0xe00c('0x14')]['message']);}else{logger[_0xe00c('0xf')](_0xe00c('0x16'),_0x28ba6c,_0xe00c('0x10'));_0x543962(_0x55813a['result'][_0xe00c('0x17')]);}})['catch'](function(_0x40a401){logger[_0xe00c('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x28ba6c,_0x40a401);_0x33c5b7(_0x40a401);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index df3db69..f8e58b7 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 _0x8b9d=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8b9d,0x169));var _0xd8b9=function(_0x5908b8,_0x544699){_0x5908b8=_0x5908b8-0x0;var _0xe24a76=_0x8b9d[_0x5908b8];return _0xe24a76;};'use strict';var multer=require(_0xd8b9('0x0'));var util=require(_0xd8b9('0x1'));var path=require(_0xd8b9('0x2'));var timeout=require(_0xd8b9('0x3'));var express=require(_0xd8b9('0x4'));var router=express[_0xd8b9('0x5')]();var auth=require(_0xd8b9('0x6'));var interaction=require(_0xd8b9('0x7'));var config=require(_0xd8b9('0x8'));var controller=require(_0xd8b9('0x9'));router[_0xd8b9('0xa')]('/',auth[_0xd8b9('0xb')](),controller[_0xd8b9('0xc')]);router['get'](_0xd8b9('0xd'),auth[_0xd8b9('0xb')](),controller[_0xd8b9('0xe')]);router[_0xd8b9('0xf')]('/',auth[_0xd8b9('0xb')](),controller[_0xd8b9('0x10')]);router[_0xd8b9('0x11')](_0xd8b9('0xd'),auth[_0xd8b9('0xb')](),controller[_0xd8b9('0x12')]);router[_0xd8b9('0x13')](_0xd8b9('0xd'),auth[_0xd8b9('0xb')](),controller[_0xd8b9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf96a=['show','create','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xf96a,0x7c));var _0xaf96=function(_0x35c013,_0x456f78){_0x35c013=_0x35c013-0x0;var _0x3e1e17=_0xf96a[_0x35c013];return _0x3e1e17;};'use strict';var multer=require(_0xaf96('0x0'));var util=require(_0xaf96('0x1'));var path=require('path');var timeout=require(_0xaf96('0x2'));var express=require(_0xaf96('0x3'));var router=express[_0xaf96('0x4')]();var auth=require(_0xaf96('0x5'));var interaction=require(_0xaf96('0x6'));var config=require(_0xaf96('0x7'));var controller=require(_0xaf96('0x8'));router['get']('/',auth[_0xaf96('0x9')](),controller['index']);router[_0xaf96('0xa')]('/:id',auth[_0xaf96('0x9')](),controller[_0xaf96('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf96('0xc')]);router['put'](_0xaf96('0xd'),auth[_0xaf96('0x9')](),controller['update']);router['delete'](_0xaf96('0xd'),auth[_0xaf96('0x9')](),controller['destroy']);module[_0xaf96('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 524c427..5c57a72 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 _0x4102=['sequelize','exports','STRING','name'];(function(_0x1ddefb,_0x2751d4){var _0x1337e0=function(_0x421494){while(--_0x421494){_0x1ddefb['push'](_0x1ddefb['shift']());}};_0x1337e0(++_0x2751d4);}(_0x4102,0x16c));var _0x2410=function(_0x19b272,_0x1400a4){_0x19b272=_0x19b272-0x0;var _0xe37b13=_0x4102[_0x19b272];return _0xe37b13;};'use strict';var Sequelize=require(_0x2410('0x0'));module[_0x2410('0x1')]={'name':{'type':Sequelize[_0x2410('0x2')],'unique':_0x2410('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6e9=['exports','STRING','name'];(function(_0x41e1d2,_0x41014f){var _0x4b9e13=function(_0x3ecfd1){while(--_0x3ecfd1){_0x41e1d2['push'](_0x41e1d2['shift']());}};_0x4b9e13(++_0x41014f);}(_0xf6e9,0x1da));var _0x9f6e=function(_0x34eff5,_0x4875f5){_0x34eff5=_0x34eff5-0x0;var _0xc801b9=_0xf6e9[_0x34eff5];return _0xc801b9;};'use strict';var Sequelize=require('sequelize');module[_0x9f6e('0x0')]={'name':{'type':Sequelize[_0x9f6e('0x1')],'unique':_0x9f6e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9f6e('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5b41a61..c552a6c 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 _0x117d=['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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','fields','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x117d,0x192));var _0xd117=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x117d[_0x20d54d];return _0x516e8b;};'use strict';var pdf=require(_0xd117('0x0'));var emlformat=require(_0xd117('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd117('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd117('0x3'));var moment=require(_0xd117('0x4'));var BPromise=require(_0xd117('0x5'));var Mustache=require(_0xd117('0x6'));var util=require('util');var path=require(_0xd117('0x7'));var sox=require(_0xd117('0x8'));var csv=require(_0xd117('0x9'));var ejs=require(_0xd117('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd117('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd117('0xc'));var toCsv=require(_0xd117('0x9'));var querystring=require(_0xd117('0xd'));var Papa=require(_0xd117('0xe'));var Redis=require(_0xd117('0xf'));var authService=require(_0xd117('0x10'));var qs=require(_0xd117('0x11'));var as=require(_0xd117('0x12'));var hardwareService=require(_0xd117('0x13'));var logger=require(_0xd117('0x14'))(_0xd117('0x15'));var utils=require(_0xd117('0x16'));var config=require(_0xd117('0x17'));var db=require(_0xd117('0x18'))['db'];function respondWithStatusCode(_0x49aa54,_0x355bc4){_0x355bc4=_0x355bc4||0xcc;return function(_0x337ef5){if(_0x337ef5){return _0x49aa54[_0xd117('0x19')](_0x355bc4);}return _0x49aa54[_0xd117('0x1a')](_0x355bc4)[_0xd117('0x1b')]();};}function respondWithResult(_0x3e50e9,_0xb9ddc8){_0xb9ddc8=_0xb9ddc8||0xc8;return function(_0x48d880){if(_0x48d880){return _0x3e50e9['status'](_0xb9ddc8)[_0xd117('0x1c')](_0x48d880);}};}function respondWithFilteredResult(_0x40ce6a,_0x47c16f){return function(_0x41f3fe){if(_0x41f3fe){var _0x189562=_0x41f3fe['count'],_0x2d0bf0=_0x47c16f[_0xd117('0x1d')],_0x41ce73=_0x47c16f['offset']+_0x47c16f[_0xd117('0x1e')],_0x41e3d4;if(_0x41ce73>=_0x189562){_0x41ce73=_0x189562;_0x41e3d4=0xc8;}else{_0x41e3d4=0xce;}_0x40ce6a[_0xd117('0x1a')](_0x41e3d4);return _0x40ce6a[_0xd117('0x1f')]('Content-Range',_0x2d0bf0+'-'+_0x41ce73+'/'+_0x189562)['json'](_0x41f3fe);}return null;};}function patchUpdates(_0x72043f){return function(_0x2729c9){try{jsonpatch['apply'](_0x2729c9,_0x72043f,!![]);}catch(_0x38670a){return BPromise[_0xd117('0x20')](_0x38670a);}return _0x2729c9[_0xd117('0x21')]();};}function saveUpdates(_0x88081e,_0x28f4c9){return function(_0x3da7c3){if(_0x3da7c3){return _0x3da7c3['update'](_0x88081e)[_0xd117('0x22')](function(_0x5653d0){return _0x5653d0;});}return null;};}function removeEntity(_0x2cedcf,_0x2bb7fc){return function(_0x57e6aa){if(_0x57e6aa){return _0x57e6aa[_0xd117('0x23')]()[_0xd117('0x22')](function(){var _0x48a302=_0x57e6aa[_0xd117('0x24')]({'plain':!![]});var _0x2c5141=_0xd117('0x25');return db[_0xd117('0x26')][_0xd117('0x23')]({'where':{'type':_0x2c5141,'resourceId':_0x48a302['id']}})['then'](function(){return _0x57e6aa;});})[_0xd117('0x22')](function(){_0x2cedcf[_0xd117('0x1a')](0xcc)[_0xd117('0x1b')]();});}};}function handleEntityNotFound(_0x147bbf,_0xa4a360){return function(_0x2b3827){if(!_0x2b3827){_0x147bbf[_0xd117('0x19')](0x194);}return _0x2b3827;};}function handleError(_0x321a53,_0x422d25){_0x422d25=_0x422d25||0x1f4;return function(_0x477d96){logger[_0xd117('0x27')](_0x477d96[_0xd117('0x28')]);if(_0x477d96[_0xd117('0x29')]){delete _0x477d96['name'];}_0x321a53[_0xd117('0x1a')](_0x422d25)[_0xd117('0x2a')](_0x477d96);};}exports[_0xd117('0x2b')]=function(_0x9c141f,_0x4d6b59){var _0x2fd9ce={},_0x22b4ad={},_0x11df38={'count':0x0,'rows':[]};var _0x133b8a=_[_0xd117('0x2c')](db[_0xd117('0x2d')][_0xd117('0x2e')],function(_0x3faf8f){return{'name':_0x3faf8f['fieldName'],'type':_0x3faf8f[_0xd117('0x2f')][_0xd117('0x30')]};});_0x22b4ad[_0xd117('0x31')]=_['map'](_0x133b8a,_0xd117('0x29'));_0x22b4ad[_0xd117('0x32')]=_['keys'](_0x9c141f[_0xd117('0x32')]);_0x22b4ad[_0xd117('0x33')]=_[_0xd117('0x34')](_0x22b4ad[_0xd117('0x31')],_0x22b4ad[_0xd117('0x32')]);_0x2fd9ce[_0xd117('0x35')]=_['intersection'](_0x22b4ad[_0xd117('0x31')],qs['fields'](_0x9c141f[_0xd117('0x32')]['fields']));_0x2fd9ce[_0xd117('0x35')]=_0x2fd9ce[_0xd117('0x35')][_0xd117('0x36')]?_0x2fd9ce[_0xd117('0x35')]:_0x22b4ad[_0xd117('0x31')];if(!_0x9c141f['query']['hasOwnProperty'](_0xd117('0x37'))){_0x2fd9ce[_0xd117('0x1e')]=qs[_0xd117('0x1e')](_0x9c141f[_0xd117('0x32')]['limit']);_0x2fd9ce[_0xd117('0x1d')]=qs['offset'](_0x9c141f[_0xd117('0x32')][_0xd117('0x1d')]);}_0x2fd9ce['order']=qs[_0xd117('0x38')](_0x9c141f[_0xd117('0x32')][_0xd117('0x38')]);_0x2fd9ce[_0xd117('0x39')]=qs[_0xd117('0x33')](_[_0xd117('0x3a')](_0x9c141f['query'],_0x22b4ad[_0xd117('0x33')]),_0x133b8a);if(_0x9c141f[_0xd117('0x32')][_0xd117('0x3b')]){_0x2fd9ce['where']=_[_0xd117('0x3c')](_0x2fd9ce[_0xd117('0x39')],{'$or':_[_0xd117('0x2c')](_0x133b8a,function(_0x5e9ede){if(_0x5e9ede['type']!==_0xd117('0x3d')){var _0x267159={};_0x267159[_0x5e9ede[_0xd117('0x29')]]={'$like':'%'+_0x9c141f[_0xd117('0x32')][_0xd117('0x3b')]+'%'};return _0x267159;}})});}_0x2fd9ce=_['merge']({},_0x2fd9ce,_0x9c141f[_0xd117('0x3e')]);var _0x542e13={'where':_0x2fd9ce[_0xd117('0x39')]};return db[_0xd117('0x2d')][_0xd117('0x3f')](_0x542e13)[_0xd117('0x22')](function(_0x56fc1b){_0x11df38[_0xd117('0x3f')]=_0x56fc1b;if(_0x9c141f['query']['includeAll']){_0x2fd9ce[_0xd117('0x40')]=[{'all':!![]}];}return db[_0xd117('0x2d')][_0xd117('0x41')](_0x2fd9ce);})[_0xd117('0x22')](function(_0x69f78f){_0x11df38[_0xd117('0x42')]=_0x69f78f;return _0x11df38;})[_0xd117('0x22')](respondWithFilteredResult(_0x4d6b59,_0x2fd9ce))['catch'](handleError(_0x4d6b59,null));};exports[_0xd117('0x43')]=function(_0x3ebc85,_0xc67a2e){var _0x3e2d80={'raw':!![],'where':{'id':_0x3ebc85[_0xd117('0x44')]['id']}},_0x1d3e12={};_0x1d3e12[_0xd117('0x31')]=_['keys'](db[_0xd117('0x2d')][_0xd117('0x2e')]);_0x1d3e12[_0xd117('0x32')]=_[_0xd117('0x45')](_0x3ebc85['query']);_0x1d3e12[_0xd117('0x33')]=_[_0xd117('0x34')](_0x1d3e12[_0xd117('0x31')],_0x1d3e12[_0xd117('0x32')]);_0x3e2d80[_0xd117('0x35')]=_[_0xd117('0x34')](_0x1d3e12[_0xd117('0x31')],qs[_0xd117('0x46')](_0x3ebc85['query']['fields']));_0x3e2d80[_0xd117('0x35')]=_0x3e2d80['attributes'][_0xd117('0x36')]?_0x3e2d80[_0xd117('0x35')]:_0x1d3e12[_0xd117('0x31')];if(_0x3ebc85[_0xd117('0x32')]['includeAll']){_0x3e2d80[_0xd117('0x40')]=[{'all':!![]}];}_0x3e2d80=_['merge']({},_0x3e2d80,_0x3ebc85[_0xd117('0x3e')]);return db[_0xd117('0x2d')]['find'](_0x3e2d80)[_0xd117('0x22')](handleEntityNotFound(_0xc67a2e,null))[_0xd117('0x22')](respondWithResult(_0xc67a2e,null))[_0xd117('0x47')](handleError(_0xc67a2e,null));};exports[_0xd117('0x48')]=function(_0xbb38eb,_0x3258ce){return db[_0xd117('0x2d')][_0xd117('0x48')](_0xbb38eb[_0xd117('0x49')],{})[_0xd117('0x22')](function(_0x3445f5){var _0x4b3d5d=_0xbb38eb[_0xd117('0x4a')]['get']({'plain':!![]});if(!_0x4b3d5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b3d5d[_0xd117('0x4b')]===_0xd117('0x4a')){var _0x3e8763=_0x3445f5[_0xd117('0x24')]({'plain':!![]});var _0x56fd34='Pauses';return db[_0xd117('0x4c')][_0xd117('0x4d')]({'where':{'name':_0x56fd34,'userProfileId':_0x4b3d5d[_0xd117('0x4e')]},'raw':!![]})[_0xd117('0x22')](function(_0x2aba9a){if(_0x2aba9a&&_0x2aba9a[_0xd117('0x4f')]===0x0){return db[_0xd117('0x26')]['create']({'name':_0x3e8763['name'],'resourceId':_0x3e8763['id'],'type':_0x2aba9a[_0xd117('0x29')],'sectionId':_0x2aba9a['id']},{})[_0xd117('0x22')](function(){return _0x3445f5;});}else{return _0x3445f5;}})[_0xd117('0x47')](function(_0x5bc597){logger[_0xd117('0x27')](_0xd117('0x50'),_0x5bc597);throw _0x5bc597;});}return _0x3445f5;})[_0xd117('0x22')](respondWithResult(_0x3258ce,0xc9))[_0xd117('0x47')](handleError(_0x3258ce,null));};exports[_0xd117('0x51')]=function(_0x32d28b,_0x23fc5b){if(_0x32d28b['body']['id']){delete _0x32d28b['body']['id'];}return db[_0xd117('0x2d')][_0xd117('0x4d')]({'where':{'id':_0x32d28b[_0xd117('0x44')]['id']}})['then'](handleEntityNotFound(_0x23fc5b,null))[_0xd117('0x22')](saveUpdates(_0x32d28b[_0xd117('0x49')],null))[_0xd117('0x22')](respondWithResult(_0x23fc5b,null))[_0xd117('0x47')](handleError(_0x23fc5b,null));};exports[_0xd117('0x23')]=function(_0x4b6454,_0x5a4cde){return db[_0xd117('0x2d')][_0xd117('0x4d')]({'where':{'id':_0x4b6454[_0xd117('0x44')]['id']}})[_0xd117('0x22')](handleEntityNotFound(_0x5a4cde,null))[_0xd117('0x22')](removeEntity(_0x5a4cde,null))[_0xd117('0x47')](handleError(_0x5a4cde,null));}; \ No newline at end of file +var _0x56ca=['filters','intersection','fields','attributes','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','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','end','status','json','count','offset','limit','set','apply','reject','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','map','Pause','fieldName','type','model','query'];(function(_0x25d751,_0x492643){var _0x3c3f07=function(_0x209df7){while(--_0x209df7){_0x25d751['push'](_0x25d751['shift']());}};_0x3c3f07(++_0x492643);}(_0x56ca,0xb3));var _0xa56c=function(_0x47890e,_0x3e3b2b){_0x47890e=_0x47890e-0x0;var _0x5843f9=_0x56ca[_0x47890e];return _0x5843f9;};'use strict';var pdf=require(_0xa56c('0x0'));var emlformat=require(_0xa56c('0x1'));var rimraf=require(_0xa56c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa56c('0x3'));var rp=require('request-promise');var moment=require(_0xa56c('0x4'));var BPromise=require(_0xa56c('0x5'));var Mustache=require(_0xa56c('0x6'));var util=require('util');var path=require(_0xa56c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa56c('0x8'));var squel=require(_0xa56c('0x9'));var crypto=require(_0xa56c('0xa'));var jsforce=require(_0xa56c('0xb'));var deskjs=require(_0xa56c('0xc'));var toCsv=require(_0xa56c('0xd'));var querystring=require(_0xa56c('0xe'));var Papa=require(_0xa56c('0xf'));var Redis=require(_0xa56c('0x10'));var authService=require(_0xa56c('0x11'));var qs=require(_0xa56c('0x12'));var as=require(_0xa56c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa56c('0x14'))(_0xa56c('0x15'));var utils=require(_0xa56c('0x16'));var config=require(_0xa56c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548ef1,_0x21256a){_0x21256a=_0x21256a||0xcc;return function(_0x4c830c){if(_0x4c830c){return _0x548ef1['sendStatus'](_0x21256a);}return _0x548ef1['status'](_0x21256a)[_0xa56c('0x18')]();};}function respondWithResult(_0x3517fb,_0x2f5ea1){_0x2f5ea1=_0x2f5ea1||0xc8;return function(_0x460c48){if(_0x460c48){return _0x3517fb[_0xa56c('0x19')](_0x2f5ea1)[_0xa56c('0x1a')](_0x460c48);}};}function respondWithFilteredResult(_0x39332d,_0xf00826){return function(_0x2fce4d){if(_0x2fce4d){var _0x570257=_0x2fce4d[_0xa56c('0x1b')],_0x187ff0=_0xf00826[_0xa56c('0x1c')],_0x42e991=_0xf00826['offset']+_0xf00826[_0xa56c('0x1d')],_0x1cdf42;if(_0x42e991>=_0x570257){_0x42e991=_0x570257;_0x1cdf42=0xc8;}else{_0x1cdf42=0xce;}_0x39332d[_0xa56c('0x19')](_0x1cdf42);return _0x39332d[_0xa56c('0x1e')]('Content-Range',_0x187ff0+'-'+_0x42e991+'/'+_0x570257)[_0xa56c('0x1a')](_0x2fce4d);}return null;};}function patchUpdates(_0x31b63c){return function(_0x2ff985){try{jsonpatch[_0xa56c('0x1f')](_0x2ff985,_0x31b63c,!![]);}catch(_0x4dd4b6){return BPromise[_0xa56c('0x20')](_0x4dd4b6);}return _0x2ff985['save']();};}function saveUpdates(_0x274c4a,_0x23935d){return function(_0x286564){if(_0x286564){return _0x286564[_0xa56c('0x21')](_0x274c4a)['then'](function(_0x11cee5){return _0x11cee5;});}return null;};}function removeEntity(_0x32d0e8,_0x783f93){return function(_0x4cb8eb){if(_0x4cb8eb){return _0x4cb8eb[_0xa56c('0x22')]()[_0xa56c('0x23')](function(){var _0x1a11e2=_0x4cb8eb[_0xa56c('0x24')]({'plain':!![]});var _0x1fe740='Pauses';return db[_0xa56c('0x25')][_0xa56c('0x22')]({'where':{'type':_0x1fe740,'resourceId':_0x1a11e2['id']}})[_0xa56c('0x23')](function(){return _0x4cb8eb;});})[_0xa56c('0x23')](function(){_0x32d0e8['status'](0xcc)[_0xa56c('0x18')]();});}};}function handleEntityNotFound(_0x469e09,_0x43cfbc){return function(_0x25bffd){if(!_0x25bffd){_0x469e09[_0xa56c('0x26')](0x194);}return _0x25bffd;};}function handleError(_0x374971,_0xe8d430){_0xe8d430=_0xe8d430||0x1f4;return function(_0x1cdd10){logger[_0xa56c('0x27')](_0x1cdd10[_0xa56c('0x28')]);if(_0x1cdd10[_0xa56c('0x29')]){delete _0x1cdd10[_0xa56c('0x29')];}_0x374971[_0xa56c('0x19')](_0xe8d430)[_0xa56c('0x2a')](_0x1cdd10);};}exports['index']=function(_0xaf75f5,_0x269983){var _0x28f51c={},_0x203233={},_0x38c428={'count':0x0,'rows':[]};var _0x19d308=_[_0xa56c('0x2b')](db[_0xa56c('0x2c')]['rawAttributes'],function(_0x580ead){return{'name':_0x580ead[_0xa56c('0x2d')],'type':_0x580ead[_0xa56c('0x2e')]['key']};});_0x203233[_0xa56c('0x2f')]=_[_0xa56c('0x2b')](_0x19d308,_0xa56c('0x29'));_0x203233[_0xa56c('0x30')]=_['keys'](_0xaf75f5['query']);_0x203233[_0xa56c('0x31')]=_[_0xa56c('0x32')](_0x203233['model'],_0x203233['query']);_0x28f51c['attributes']=_[_0xa56c('0x32')](_0x203233[_0xa56c('0x2f')],qs[_0xa56c('0x33')](_0xaf75f5[_0xa56c('0x30')]['fields']));_0x28f51c['attributes']=_0x28f51c[_0xa56c('0x34')]['length']?_0x28f51c[_0xa56c('0x34')]:_0x203233[_0xa56c('0x2f')];if(!_0xaf75f5[_0xa56c('0x30')]['hasOwnProperty']('nolimit')){_0x28f51c['limit']=qs[_0xa56c('0x1d')](_0xaf75f5['query'][_0xa56c('0x1d')]);_0x28f51c[_0xa56c('0x1c')]=qs[_0xa56c('0x1c')](_0xaf75f5[_0xa56c('0x30')][_0xa56c('0x1c')]);}_0x28f51c['order']=qs[_0xa56c('0x35')](_0xaf75f5[_0xa56c('0x30')][_0xa56c('0x35')]);_0x28f51c[_0xa56c('0x36')]=qs[_0xa56c('0x31')](_['pick'](_0xaf75f5['query'],_0x203233[_0xa56c('0x31')]),_0x19d308);if(_0xaf75f5[_0xa56c('0x30')][_0xa56c('0x37')]){_0x28f51c[_0xa56c('0x36')]=_[_0xa56c('0x38')](_0x28f51c[_0xa56c('0x36')],{'$or':_[_0xa56c('0x2b')](_0x19d308,function(_0x5919ed){if(_0x5919ed['type']!==_0xa56c('0x39')){var _0x2b5be6={};_0x2b5be6[_0x5919ed[_0xa56c('0x29')]]={'$like':'%'+_0xaf75f5[_0xa56c('0x30')]['filter']+'%'};return _0x2b5be6;}})});}_0x28f51c=_[_0xa56c('0x38')]({},_0x28f51c,_0xaf75f5['options']);var _0x1a6092={'where':_0x28f51c[_0xa56c('0x36')]};return db['Pause'][_0xa56c('0x1b')](_0x1a6092)['then'](function(_0x1d14b7){_0x38c428[_0xa56c('0x1b')]=_0x1d14b7;if(_0xaf75f5[_0xa56c('0x30')][_0xa56c('0x3a')]){_0x28f51c[_0xa56c('0x3b')]=[{'all':!![]}];}return db[_0xa56c('0x2c')]['findAll'](_0x28f51c);})[_0xa56c('0x23')](function(_0x305403){_0x38c428[_0xa56c('0x3c')]=_0x305403;return _0x38c428;})['then'](respondWithFilteredResult(_0x269983,_0x28f51c))[_0xa56c('0x3d')](handleError(_0x269983,null));};exports[_0xa56c('0x3e')]=function(_0xe74734,_0x5b583b){var _0x1e8ec6={'raw':!![],'where':{'id':_0xe74734[_0xa56c('0x3f')]['id']}},_0x14d20f={};_0x14d20f['model']=_['keys'](db[_0xa56c('0x2c')][_0xa56c('0x40')]);_0x14d20f[_0xa56c('0x30')]=_['keys'](_0xe74734[_0xa56c('0x30')]);_0x14d20f[_0xa56c('0x31')]=_['intersection'](_0x14d20f[_0xa56c('0x2f')],_0x14d20f[_0xa56c('0x30')]);_0x1e8ec6[_0xa56c('0x34')]=_['intersection'](_0x14d20f[_0xa56c('0x2f')],qs[_0xa56c('0x33')](_0xe74734['query'][_0xa56c('0x33')]));_0x1e8ec6[_0xa56c('0x34')]=_0x1e8ec6[_0xa56c('0x34')][_0xa56c('0x41')]?_0x1e8ec6[_0xa56c('0x34')]:_0x14d20f[_0xa56c('0x2f')];if(_0xe74734[_0xa56c('0x30')][_0xa56c('0x3a')]){_0x1e8ec6[_0xa56c('0x3b')]=[{'all':!![]}];}_0x1e8ec6=_[_0xa56c('0x38')]({},_0x1e8ec6,_0xe74734['options']);return db[_0xa56c('0x2c')][_0xa56c('0x42')](_0x1e8ec6)['then'](handleEntityNotFound(_0x5b583b,null))[_0xa56c('0x23')](respondWithResult(_0x5b583b,null))[_0xa56c('0x3d')](handleError(_0x5b583b,null));};exports[_0xa56c('0x43')]=function(_0x23a242,_0x33e792){return db[_0xa56c('0x2c')][_0xa56c('0x43')](_0x23a242[_0xa56c('0x44')],{})['then'](function(_0x587fe5){var _0x426d6a=_0x23a242[_0xa56c('0x45')][_0xa56c('0x24')]({'plain':!![]});if(!_0x426d6a)throw new Error(_0xa56c('0x46'));if(_0x426d6a[_0xa56c('0x47')]===_0xa56c('0x45')){var _0x4d5b92=_0x587fe5['get']({'plain':!![]});var _0x449b2a=_0xa56c('0x48');return db[_0xa56c('0x49')][_0xa56c('0x42')]({'where':{'name':_0x449b2a,'userProfileId':_0x426d6a[_0xa56c('0x4a')]},'raw':!![]})[_0xa56c('0x23')](function(_0x564b65){if(_0x564b65&&_0x564b65['autoAssociation']===0x0){return db[_0xa56c('0x25')]['create']({'name':_0x4d5b92[_0xa56c('0x29')],'resourceId':_0x4d5b92['id'],'type':_0x564b65[_0xa56c('0x29')],'sectionId':_0x564b65['id']},{})[_0xa56c('0x23')](function(){return _0x587fe5;});}else{return _0x587fe5;}})[_0xa56c('0x3d')](function(_0x51acbc){logger[_0xa56c('0x27')](_0xa56c('0x4b'),_0x51acbc);throw _0x51acbc;});}return _0x587fe5;})[_0xa56c('0x23')](respondWithResult(_0x33e792,0xc9))[_0xa56c('0x3d')](handleError(_0x33e792,null));};exports[_0xa56c('0x21')]=function(_0x3278eb,_0x54cc98){if(_0x3278eb[_0xa56c('0x44')]['id']){delete _0x3278eb[_0xa56c('0x44')]['id'];}return db[_0xa56c('0x2c')][_0xa56c('0x42')]({'where':{'id':_0x3278eb[_0xa56c('0x3f')]['id']}})[_0xa56c('0x23')](handleEntityNotFound(_0x54cc98,null))['then'](saveUpdates(_0x3278eb[_0xa56c('0x44')],null))[_0xa56c('0x23')](respondWithResult(_0x54cc98,null))[_0xa56c('0x3d')](handleError(_0x54cc98,null));};exports[_0xa56c('0x22')]=function(_0x38c47e,_0x2e8507){return db['Pause'][_0xa56c('0x42')]({'where':{'id':_0x38c47e['params']['id']}})[_0xa56c('0x23')](handleEntityNotFound(_0x2e8507,null))[_0xa56c('0x23')](removeEntity(_0x2e8507,null))[_0xa56c('0x3d')](handleError(_0x2e8507,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4bc8664..d0ce3d2 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 _0x3c49=['define','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x43347e,_0x12f3ac){var _0xcb5363=function(_0xeae5b4){while(--_0xeae5b4){_0x43347e['push'](_0x43347e['shift']());}};_0xcb5363(++_0x12f3ac);}(_0x3c49,0xb8));var _0x93c4=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3c49[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x93c4('0x0'));var util=require(_0x93c4('0x1'));var logger=require(_0x93c4('0x2'))(_0x93c4('0x3'));var moment=require(_0x93c4('0x4'));var BPromise=require(_0x93c4('0x5'));var rp=require(_0x93c4('0x6'));var fs=require('fs');var path=require(_0x93c4('0x7'));var rimraf=require(_0x93c4('0x8'));var config=require(_0x93c4('0x9'));var attributes=require(_0x93c4('0xa'));module['exports']=function(_0x3f9684,_0x1e40bb){return _0x3f9684[_0x93c4('0xb')]('Pause',attributes,{'tableName':_0x93c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xade9=['Pause','tools_pauses','util','../../config/logger','bluebird','request-promise','path','rimraf','./pause.attributes','define'];(function(_0x55296e,_0x7447d2){var _0x2cc8bd=function(_0x328581){while(--_0x328581){_0x55296e['push'](_0x55296e['shift']());}};_0x2cc8bd(++_0x7447d2);}(_0xade9,0x12e));var _0x9ade=function(_0x495f0b,_0x499f83){_0x495f0b=_0x495f0b-0x0;var _0xef44be=_0xade9[_0x495f0b];return _0xef44be;};'use strict';var _=require('lodash');var util=require(_0x9ade('0x0'));var logger=require(_0x9ade('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9ade('0x2'));var rp=require(_0x9ade('0x3'));var fs=require('fs');var path=require(_0x9ade('0x4'));var rimraf=require(_0x9ade('0x5'));var config=require('../../config/environment');var attributes=require(_0x9ade('0x6'));module['exports']=function(_0x33aaf7,_0x5dd186){return _0x33aaf7[_0x9ade('0x7')](_0x9ade('0x8'),attributes,{'tableName':_0x9ade('0x9'),'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 466f9e7..49df9ac 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 _0xaf0a=['map','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','model'];(function(_0xd1be7,_0x54cc82){var _0x2ef76a=function(_0x1bdf65){while(--_0x1bdf65){_0xd1be7['push'](_0xd1be7['shift']());}};_0x2ef76a(++_0x54cc82);}(_0xaf0a,0xa6));var _0xaaf0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xaf0a[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xaaf0('0x0'));var util=require('util');var moment=require(_0xaaf0('0x1'));var BPromise=require(_0xaaf0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaf0('0x3'));var db=require(_0xaaf0('0x4'))['db'];var utils=require(_0xaaf0('0x5'));var logger=require(_0xaaf0('0x6'))('rpc');var config=require(_0xaaf0('0x7'));var jayson=require(_0xaaf0('0x8'));var client=jayson[_0xaaf0('0x9')][_0xaaf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c6580,_0x37312f,_0x209588){return new BPromise(function(_0x1eff52,_0x16aa35){return client['request'](_0x3c6580,_0x209588)[_0xaaf0('0xb')](function(_0x3a89e6){logger[_0xaaf0('0xc')](_0xaaf0('0xd'),_0x37312f,_0xaaf0('0xe'));logger[_0xaaf0('0xf')](_0xaaf0('0x10'),_0x37312f,_0xaaf0('0xe'),JSON[_0xaaf0('0x11')](_0x3a89e6));if(_0x3a89e6[_0xaaf0('0x12')]){if(_0x3a89e6[_0xaaf0('0x12')][_0xaaf0('0x13')]===0x1f4){logger['error'](_0xaaf0('0xd'),_0x37312f,_0x3a89e6[_0xaaf0('0x12')]['message']);return _0x16aa35(_0x3a89e6['error'][_0xaaf0('0x14')]);}logger['error'](_0xaaf0('0xd'),_0x37312f,_0x3a89e6[_0xaaf0('0x12')][_0xaaf0('0x14')]);return _0x1eff52(_0x3a89e6[_0xaaf0('0x12')][_0xaaf0('0x14')]);}else{logger['info'](_0xaaf0('0xd'),_0x37312f,'request\x20sent');_0x1eff52(_0x3a89e6[_0xaaf0('0x15')][_0xaaf0('0x14')]);}})[_0xaaf0('0x16')](function(_0x270658){logger[_0xaaf0('0x12')]('Pause,\x20%s,\x20%s',_0x37312f,_0x270658);_0x16aa35(_0x270658);});});}exports[_0xaaf0('0x17')]=function(_0x52d893){var _0x52a60f=this;return new Promise(function(_0x16ed84,_0x38b734){return db[_0xaaf0('0x18')][_0xaaf0('0x19')]({'raw':_0x52d893[_0xaaf0('0x1a')]?_0x52d893[_0xaaf0('0x1a')][_0xaaf0('0x1b')]===undefined?!![]:![]:!![],'where':_0x52d893[_0xaaf0('0x1a')]?_0x52d893[_0xaaf0('0x1a')][_0xaaf0('0x1c')]||null:null,'attributes':_0x52d893[_0xaaf0('0x1a')]?_0x52d893[_0xaaf0('0x1a')][_0xaaf0('0x1d')]||null:null,'include':_0x52d893[_0xaaf0('0x1a')]?_0x52d893[_0xaaf0('0x1a')][_0xaaf0('0x1e')]?_['map'](_0x52d893[_0xaaf0('0x1a')][_0xaaf0('0x1e')],function(_0x5703eb){return{'model':db[_0x5703eb[_0xaaf0('0x1f')]],'as':_0x5703eb['as'],'attributes':_0x5703eb['attributes'],'include':_0x5703eb[_0xaaf0('0x1e')]?_['map'](_0x5703eb[_0xaaf0('0x1e')],function(_0x185b65){return{'model':db[_0x185b65[_0xaaf0('0x1f')]],'as':_0x185b65['as'],'attributes':_0x185b65[_0xaaf0('0x1d')],'include':_0x185b65['include']?_[_0xaaf0('0x20')](_0x185b65[_0xaaf0('0x1e')],function(_0x170f5b){return{'model':db[_0x170f5b[_0xaaf0('0x1f')]],'as':_0x170f5b['as'],'attributes':_0x170f5b[_0xaaf0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaaf0('0xb')](function(_0x39def7){logger[_0xaaf0('0xc')](_0xaaf0('0x17'),_0x52d893);logger['debug'](_0xaaf0('0x17'),_0x52d893,JSON[_0xaaf0('0x11')](_0x39def7));_0x16ed84(_0x39def7);})[_0xaaf0('0x16')](function(_0x1c3fd8){logger[_0xaaf0('0x12')](_0xaaf0('0x17'),_0x1c3fd8[_0xaaf0('0x14')],_0x52d893);_0x38b734(_0x52a60f[_0xaaf0('0x12')](0x1f4,_0x1c3fd8[_0xaaf0('0x14')]));});});}; \ No newline at end of file +var _0x1af7=['request','then','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','ShowPause','find','options','raw','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','client'];(function(_0x5af086,_0x23d002){var _0x272c2f=function(_0x5c7845){while(--_0x5c7845){_0x5af086['push'](_0x5af086['shift']());}};_0x272c2f(++_0x23d002);}(_0x1af7,0x1b8));var _0x71af=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1af7[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x71af('0x0'));var util=require(_0x71af('0x1'));var moment=require(_0x71af('0x2'));var BPromise=require(_0x71af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71af('0x5'));var logger=require(_0x71af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71af('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1af506,_0x5e0fdf,_0x3cec6f){return new BPromise(function(_0x5868c0,_0x47fad8){return client[_0x71af('0x8')](_0x1af506,_0x3cec6f)[_0x71af('0x9')](function(_0x170836){logger['info'](_0x71af('0xa'),_0x5e0fdf,'request\x20sent');logger[_0x71af('0xb')](_0x71af('0xc'),_0x5e0fdf,_0x71af('0xd'),JSON[_0x71af('0xe')](_0x170836));if(_0x170836['error']){if(_0x170836['error'][_0x71af('0xf')]===0x1f4){logger[_0x71af('0x10')](_0x71af('0xa'),_0x5e0fdf,_0x170836[_0x71af('0x10')][_0x71af('0x11')]);return _0x47fad8(_0x170836[_0x71af('0x10')][_0x71af('0x11')]);}logger['error'](_0x71af('0xa'),_0x5e0fdf,_0x170836[_0x71af('0x10')][_0x71af('0x11')]);return _0x5868c0(_0x170836[_0x71af('0x10')][_0x71af('0x11')]);}else{logger[_0x71af('0x12')]('Pause,\x20%s,\x20%s',_0x5e0fdf,_0x71af('0xd'));_0x5868c0(_0x170836['result'][_0x71af('0x11')]);}})[_0x71af('0x13')](function(_0x58eafa){logger[_0x71af('0x10')]('Pause,\x20%s,\x20%s',_0x5e0fdf,_0x58eafa);_0x47fad8(_0x58eafa);});});}exports[_0x71af('0x14')]=function(_0x24ef36){var _0x503b2e=this;return new Promise(function(_0x3d2863,_0x52df9a){return db['Pause'][_0x71af('0x15')]({'raw':_0x24ef36[_0x71af('0x16')]?_0x24ef36[_0x71af('0x16')][_0x71af('0x17')]===undefined?!![]:![]:!![],'where':_0x24ef36[_0x71af('0x16')]?_0x24ef36[_0x71af('0x16')]['where']||null:null,'attributes':_0x24ef36[_0x71af('0x16')]?_0x24ef36[_0x71af('0x16')][_0x71af('0x18')]||null:null,'include':_0x24ef36['options']?_0x24ef36[_0x71af('0x16')][_0x71af('0x19')]?_['map'](_0x24ef36[_0x71af('0x16')][_0x71af('0x19')],function(_0x12dd11){return{'model':db[_0x12dd11[_0x71af('0x1a')]],'as':_0x12dd11['as'],'attributes':_0x12dd11[_0x71af('0x18')],'include':_0x12dd11['include']?_['map'](_0x12dd11[_0x71af('0x19')],function(_0x34d71f){return{'model':db[_0x34d71f[_0x71af('0x1a')]],'as':_0x34d71f['as'],'attributes':_0x34d71f[_0x71af('0x18')],'include':_0x34d71f['include']?_[_0x71af('0x1b')](_0x34d71f[_0x71af('0x19')],function(_0xb72e8d){return{'model':db[_0xb72e8d[_0x71af('0x1a')]],'as':_0xb72e8d['as'],'attributes':_0xb72e8d[_0x71af('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bdd41){logger['info'](_0x71af('0x14'),_0x24ef36);logger['debug'](_0x71af('0x14'),_0x24ef36,JSON[_0x71af('0xe')](_0x5bdd41));_0x3d2863(_0x5bdd41);})['catch'](function(_0x2c7281){logger[_0x71af('0x10')](_0x71af('0x14'),_0x2c7281[_0x71af('0x11')],_0x24ef36);_0x52df9a(_0x503b2e[_0x71af('0x10')](0x1f4,_0x2c7281[_0x71af('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2471fa7..6aa8b14 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 _0x6049=['replace','format','%s-%s%s','basename','now','extname','post','file','upload','webhookPost','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x6049,0x1a6));var _0x9604=function(_0x63bc43,_0x22ea85){_0x63bc43=_0x63bc43-0x0;var _0x52075a=_0x6049[_0x63bc43];return _0x52075a;};'use strict';var multer=require(_0x9604('0x0'));var util=require(_0x9604('0x1'));var path=require(_0x9604('0x2'));var timeout=require(_0x9604('0x3'));var express=require(_0x9604('0x4'));var router=express[_0x9604('0x5')]();var auth=require(_0x9604('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9604('0x7'));var controller=require(_0x9604('0x8'));router[_0x9604('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9604('0x9')](_0x9604('0xa'),controller[_0x9604('0xb')]);router[_0x9604('0x9')]('/:id',auth[_0x9604('0xc')](),controller[_0x9604('0xd')]);router['get'](_0x9604('0xe'),auth[_0x9604('0xc')](),controller[_0x9604('0xf')]);var upload=multer({'storage':multer[_0x9604('0x10')]({'destination':function(_0x4aac19,_0x4d6a46,_0x459db6){_0x459db6(null,path[_0x9604('0x11')](config[_0x9604('0x12')],'server/files/plugins'));},'filename':function(_0x5187d0,_0x32207b,_0x27f16c){_0x32207b[_0x9604('0x13')]=_0x32207b[_0x9604('0x13')][_0x9604('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x27f16c(null,util[_0x9604('0x15')](_0x9604('0x16'),path[_0x9604('0x17')](_0x32207b[_0x9604('0x13')],path['extname'](_0x32207b[_0x9604('0x13')])),Date[_0x9604('0x18')](),path[_0x9604('0x19')](_0x32207b[_0x9604('0x13')])));}})});router[_0x9604('0x1a')]('/',upload['single'](_0x9604('0x1b')),controller[_0x9604('0x1c')]);router[_0x9604('0x1a')](_0x9604('0xa'),controller[_0x9604('0x1d')]);router[_0x9604('0x1e')]('/:id',auth[_0x9604('0xc')](),controller['update']);router[_0x9604('0x1f')](_0x9604('0x20'),auth[_0x9604('0xc')](),controller['delete']);module[_0x9604('0x21')]=router; \ No newline at end of file +var _0xc4fa=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','diskStorage','root','originalname','format','%s-%s%s','basename','extname','now','post','single','upload','put','delete','util'];(function(_0x36f532,_0x34995f){var _0x3c5779=function(_0x2e31ad){while(--_0x2e31ad){_0x36f532['push'](_0x36f532['shift']());}};_0x3c5779(++_0x34995f);}(_0xc4fa,0x1bf));var _0xac4f=function(_0x3c89aa,_0x19aaee){_0x3c89aa=_0x3c89aa-0x0;var _0x1c231f=_0xc4fa[_0x3c89aa];return _0x1c231f;};'use strict';var multer=require('multer');var util=require(_0xac4f('0x0'));var path=require(_0xac4f('0x1'));var timeout=require(_0xac4f('0x2'));var express=require(_0xac4f('0x3'));var router=express['Router']();var auth=require(_0xac4f('0x4'));var interaction=require(_0xac4f('0x5'));var config=require(_0xac4f('0x6'));var controller=require(_0xac4f('0x7'));router[_0xac4f('0x8')]('/',auth[_0xac4f('0x9')](),controller['index']);router['get'](_0xac4f('0xa'),controller[_0xac4f('0xb')]);router['get'](_0xac4f('0xc'),auth[_0xac4f('0x9')](),controller[_0xac4f('0xd')]);router[_0xac4f('0x8')](_0xac4f('0xe'),auth[_0xac4f('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xac4f('0xf')]({'destination':function(_0xdecf8,_0x51d538,_0x46d09b){_0x46d09b(null,path['join'](config[_0xac4f('0x10')],'server/files/plugins'));},'filename':function(_0x150086,_0x424fd7,_0x1e722a){_0x424fd7[_0xac4f('0x11')]=_0x424fd7[_0xac4f('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e722a(null,util[_0xac4f('0x12')](_0xac4f('0x13'),path[_0xac4f('0x14')](_0x424fd7[_0xac4f('0x11')],path[_0xac4f('0x15')](_0x424fd7[_0xac4f('0x11')])),Date[_0xac4f('0x16')](),path[_0xac4f('0x15')](_0x424fd7[_0xac4f('0x11')])));}})});router[_0xac4f('0x17')]('/',upload[_0xac4f('0x18')]('file'),controller[_0xac4f('0x19')]);router[_0xac4f('0x17')]('/webhook',controller['webhookPost']);router[_0xac4f('0x1a')](_0xac4f('0xc'),auth[_0xac4f('0x9')](),controller['update']);router['delete'](_0xac4f('0xc'),auth[_0xac4f('0x9')](),controller[_0xac4f('0x1b')]);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 b14bc6a..1541de0 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 _0x76ae=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','agentOnly','never'];(function(_0xececf9,_0x103a8e){var _0x560549=function(_0x8b1deb){while(--_0x8b1deb){_0xececf9['push'](_0xececf9['shift']());}};_0x560549(++_0x103a8e);}(_0x76ae,0x155));var _0xe76a=function(_0x50bad2,_0x44e99e){_0x50bad2=_0x50bad2-0x0;var _0x2e5a09=_0x76ae[_0x50bad2];return _0x2e5a09;};'use strict';var Sequelize=require(_0xe76a('0x0'));module[_0xe76a('0x1')]={'name':{'type':Sequelize[_0xe76a('0x2')]},'type':{'type':Sequelize[_0xe76a('0x3')](_0xe76a('0x4'),'script')},'description':{'type':Sequelize[_0xe76a('0x5')]},'version':{'type':Sequelize[_0xe76a('0x5')]},'path':{'type':Sequelize[_0xe76a('0x2')],'comment':_0xe76a('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xe76a('0x3')]('adminOnly',_0xe76a('0x7'),'always',_0xe76a('0x8')),'defaultValue':'always','comment':_0xe76a('0x9')},'icon':{'type':Sequelize[_0xe76a('0x2')]},'adminUrl':{'type':Sequelize[_0xe76a('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xe76a('0x2')]}}; \ No newline at end of file +var _0x73db=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','TEXT','STRING'];(function(_0x375913,_0x1c4cf9){var _0x26ac4b=function(_0x1d8665){while(--_0x1d8665){_0x375913['push'](_0x375913['shift']());}};_0x26ac4b(++_0x1c4cf9);}(_0x73db,0xe0));var _0xb73d=function(_0x33a4d5,_0x3a12dc){_0x33a4d5=_0x33a4d5-0x0;var _0x108498=_0x73db[_0x33a4d5];return _0x108498;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb73d('0x0')](_0xb73d('0x1'),'script')},'description':{'type':Sequelize[_0xb73d('0x2')]},'version':{'type':Sequelize[_0xb73d('0x2')]},'path':{'type':Sequelize[_0xb73d('0x3')],'comment':_0xb73d('0x4')},'active':{'type':Sequelize[_0xb73d('0x5')],'defaultValue':0x0,'comment':_0xb73d('0x6')},'sidebar':{'type':Sequelize[_0xb73d('0x0')](_0xb73d('0x7'),_0xb73d('0x8'),_0xb73d('0x9'),_0xb73d('0xa')),'defaultValue':_0xb73d('0x9'),'comment':_0xb73d('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb73d('0x3')]},'agentUrl':{'type':Sequelize[_0xb73d('0x3')]},'scriptName':{'type':Sequelize[_0xb73d('0x3')]},'scriptPath':{'type':Sequelize[_0xb73d('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 587d8a1..3d080a8 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 _0x7b4d=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','params','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','%s%s','headers','content-type','statusCode','webhookPost','content-length','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','socket.io-emitter','./plugin.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x3bd497,_0x37d7a8){var _0x32f967=function(_0x1b84ba){while(--_0x1b84ba){_0x3bd497['push'](_0x3bd497['shift']());}};_0x32f967(++_0x37d7a8);}(_0x7b4d,0x69));var _0xd7b4=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x7b4d[_0x15106b];return _0x521203;};'use strict';var pdf=require(_0xd7b4('0x0'));var emlformat=require(_0xd7b4('0x1'));var rimraf=require(_0xd7b4('0x2'));var zipdir=require(_0xd7b4('0x3'));var jsonpatch=require(_0xd7b4('0x4'));var rp=require(_0xd7b4('0x5'));var moment=require('moment');var BPromise=require(_0xd7b4('0x6'));var Mustache=require(_0xd7b4('0x7'));var util=require(_0xd7b4('0x8'));var path=require(_0xd7b4('0x9'));var sox=require(_0xd7b4('0xa'));var csv=require('to-csv');var ejs=require(_0xd7b4('0xb'));var fs=require('fs');var _=require(_0xd7b4('0xc'));var squel=require(_0xd7b4('0xd'));var crypto=require('crypto');var jsforce=require(_0xd7b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd7b4('0xf'));var querystring=require(_0xd7b4('0x10'));var Papa=require(_0xd7b4('0x11'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xd7b4('0x12'));var authService=require(_0xd7b4('0x13'));var qs=require(_0xd7b4('0x14'));var as=require(_0xd7b4('0x15'));var hardwareService=require(_0xd7b4('0x16'));var logger=require(_0xd7b4('0x17'))('api');var utils=require(_0xd7b4('0x18'));var config=require(_0xd7b4('0x19'));var db=require(_0xd7b4('0x1a'))['db'];config[_0xd7b4('0x1b')]=_[_0xd7b4('0x1c')](config[_0xd7b4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b4('0x1d'))(new Redis(config[_0xd7b4('0x1b')]));require(_0xd7b4('0x1e'))[_0xd7b4('0x1f')](socket);function respondWithStatusCode(_0x38de1b,_0x32a2f9){_0x32a2f9=_0x32a2f9||0xcc;return function(_0x2c9338){if(_0x2c9338){return _0x38de1b['sendStatus'](_0x32a2f9);}return _0x38de1b[_0xd7b4('0x20')](_0x32a2f9)[_0xd7b4('0x21')]();};}function respondWithResult(_0x1b43a4,_0x42c06e){_0x42c06e=_0x42c06e||0xc8;return function(_0x9a5655){if(_0x9a5655){return _0x1b43a4[_0xd7b4('0x20')](_0x42c06e)['json'](_0x9a5655);}};}function respondWithFilteredResult(_0x51520b,_0x1dea53){return function(_0x5a1626){if(_0x5a1626){var _0x284ff8=_0x5a1626[_0xd7b4('0x22')],_0x2e4fec=_0x1dea53['offset'],_0x37dbaf=_0x1dea53[_0xd7b4('0x23')]+_0x1dea53[_0xd7b4('0x24')],_0xa103b3;if(_0x37dbaf>=_0x284ff8){_0x37dbaf=_0x284ff8;_0xa103b3=0xc8;}else{_0xa103b3=0xce;}_0x51520b['status'](_0xa103b3);return _0x51520b[_0xd7b4('0x25')](_0xd7b4('0x26'),_0x2e4fec+'-'+_0x37dbaf+'/'+_0x284ff8)['json'](_0x5a1626);}return null;};}function patchUpdates(_0x39adce){return function(_0x2b86dc){try{jsonpatch[_0xd7b4('0x27')](_0x2b86dc,_0x39adce,!![]);}catch(_0x592167){return BPromise[_0xd7b4('0x28')](_0x592167);}return _0x2b86dc[_0xd7b4('0x29')]();};}function saveUpdates(_0x4a9d70,_0x53067d){return function(_0x3f6257){if(_0x3f6257){return _0x3f6257[_0xd7b4('0x2a')](_0x4a9d70)[_0xd7b4('0x2b')](function(_0x568054){return _0x568054;});}return null;};}function removeEntity(_0x5850f9,_0x165041){return function(_0x11fa88){if(_0x11fa88){return _0x11fa88[_0xd7b4('0x2c')]()[_0xd7b4('0x2b')](function(){var _0xdbff0b=_0x11fa88[_0xd7b4('0x2d')]({'plain':!![]});var _0x57c6e7=_0xd7b4('0x2e');return db[_0xd7b4('0x2f')][_0xd7b4('0x2c')]({'where':{'type':_0x57c6e7,'resourceId':_0xdbff0b['id']}})[_0xd7b4('0x2b')](function(){return _0x11fa88;});})[_0xd7b4('0x2b')](function(){_0x5850f9[_0xd7b4('0x20')](0xcc)[_0xd7b4('0x21')]();});}};}function handleEntityNotFound(_0x410a91,_0x5696e2){return function(_0x2149bd){if(!_0x2149bd){_0x410a91[_0xd7b4('0x30')](0x194);}return _0x2149bd;};}function handleError(_0x3d8e74,_0x5e07ad){_0x5e07ad=_0x5e07ad||0x1f4;return function(_0x46e9eb){logger[_0xd7b4('0x31')](_0x46e9eb[_0xd7b4('0x32')]);if(_0x46e9eb['name']){delete _0x46e9eb[_0xd7b4('0x33')];}_0x3d8e74['status'](_0x5e07ad)[_0xd7b4('0x34')](_0x46e9eb);};}exports[_0xd7b4('0x35')]=function(_0x1f6fba,_0x3694e9){var _0x3e0205={},_0x1ca2a4={},_0x2ba2a5={'count':0x0,'rows':[]};var _0x38124a=_[_0xd7b4('0x36')](db[_0xd7b4('0x37')][_0xd7b4('0x38')],function(_0x260f58){return{'name':_0x260f58[_0xd7b4('0x39')],'type':_0x260f58['type'][_0xd7b4('0x3a')]};});_0x1ca2a4[_0xd7b4('0x3b')]=_[_0xd7b4('0x36')](_0x38124a,_0xd7b4('0x33'));_0x1ca2a4['query']=_[_0xd7b4('0x3c')](_0x1f6fba[_0xd7b4('0x3d')]);_0x1ca2a4[_0xd7b4('0x3e')]=_[_0xd7b4('0x3f')](_0x1ca2a4[_0xd7b4('0x3b')],_0x1ca2a4[_0xd7b4('0x3d')]);_0x3e0205[_0xd7b4('0x40')]=_[_0xd7b4('0x3f')](_0x1ca2a4[_0xd7b4('0x3b')],qs[_0xd7b4('0x41')](_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x41')]));_0x3e0205[_0xd7b4('0x40')]=_0x3e0205[_0xd7b4('0x40')][_0xd7b4('0x42')]?_0x3e0205[_0xd7b4('0x40')]:_0x1ca2a4[_0xd7b4('0x3b')];if(!_0x1f6fba['query'][_0xd7b4('0x43')](_0xd7b4('0x44'))){_0x3e0205['limit']=qs[_0xd7b4('0x24')](_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x24')]);_0x3e0205[_0xd7b4('0x23')]=qs[_0xd7b4('0x23')](_0x1f6fba['query'][_0xd7b4('0x23')]);}_0x3e0205[_0xd7b4('0x45')]=qs[_0xd7b4('0x46')](_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x46')]);_0x3e0205['where']=qs[_0xd7b4('0x3e')](_[_0xd7b4('0x47')](_0x1f6fba[_0xd7b4('0x3d')],_0x1ca2a4['filters']),_0x38124a);if(_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x48')]){_0x3e0205[_0xd7b4('0x49')]=_[_0xd7b4('0x4a')](_0x3e0205['where'],{'$or':_[_0xd7b4('0x36')](_0x38124a,function(_0x502d2f){if(_0x502d2f['type']!=='VIRTUAL'){var _0x234478={};_0x234478[_0x502d2f['name']]={'$like':'%'+_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x48')]+'%'};return _0x234478;}})});}_0x3e0205=_[_0xd7b4('0x4a')]({},_0x3e0205,_0x1f6fba['options']);var _0x163057={'where':_0x3e0205[_0xd7b4('0x49')]};return db[_0xd7b4('0x37')][_0xd7b4('0x22')](_0x163057)[_0xd7b4('0x2b')](function(_0x1d25bd){_0x2ba2a5[_0xd7b4('0x22')]=_0x1d25bd;if(_0x1f6fba[_0xd7b4('0x3d')][_0xd7b4('0x4b')]){_0x3e0205[_0xd7b4('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0xd7b4('0x4d')](_0x3e0205);})['then'](function(_0x3805d7){_0x2ba2a5[_0xd7b4('0x4e')]=_0x3805d7;return _0x2ba2a5;})[_0xd7b4('0x2b')](respondWithFilteredResult(_0x3694e9,_0x3e0205))['catch'](handleError(_0x3694e9,null));};exports['show']=function(_0x187a8a,_0x3c8351){var _0x42cca7={'raw':!![],'where':{'id':_0x187a8a[_0xd7b4('0x4f')]['id']}},_0x4de4ca={};_0x4de4ca[_0xd7b4('0x3b')]=_[_0xd7b4('0x3c')](db['Plugin'][_0xd7b4('0x38')]);_0x4de4ca[_0xd7b4('0x3d')]=_[_0xd7b4('0x3c')](_0x187a8a[_0xd7b4('0x3d')]);_0x4de4ca['filters']=_[_0xd7b4('0x3f')](_0x4de4ca[_0xd7b4('0x3b')],_0x4de4ca[_0xd7b4('0x3d')]);_0x42cca7[_0xd7b4('0x40')]=_[_0xd7b4('0x3f')](_0x4de4ca[_0xd7b4('0x3b')],qs[_0xd7b4('0x41')](_0x187a8a['query'][_0xd7b4('0x41')]));_0x42cca7[_0xd7b4('0x40')]=_0x42cca7['attributes'][_0xd7b4('0x42')]?_0x42cca7[_0xd7b4('0x40')]:_0x4de4ca[_0xd7b4('0x3b')];if(_0x187a8a['query'][_0xd7b4('0x4b')]){_0x42cca7[_0xd7b4('0x4c')]=[{'all':!![]}];}_0x42cca7=_[_0xd7b4('0x4a')]({},_0x42cca7,_0x187a8a['options']);return db[_0xd7b4('0x37')][_0xd7b4('0x50')](_0x42cca7)['then'](handleEntityNotFound(_0x3c8351,null))[_0xd7b4('0x2b')](respondWithResult(_0x3c8351,null))[_0xd7b4('0x51')](handleError(_0x3c8351,null));};exports[_0xd7b4('0x52')]=function(_0x1529ab,_0x13e81f,_0x36fb89){return db[_0xd7b4('0x37')][_0xd7b4('0x50')]({'where':{'id':_0x1529ab[_0xd7b4('0x4f')]['id']},'attributes':[_0xd7b4('0x33'),_0xd7b4('0x9')],'raw':!![]})[_0xd7b4('0x2b')](handleEntityNotFound(_0x13e81f,null))['then'](function(_0x19d614){if(_0x19d614){var _0x4fbfbb=path[_0xd7b4('0x53')](config[_0xd7b4('0x54')],_0xd7b4('0x55'),util[_0xd7b4('0x56')](_0xd7b4('0x57'),path[_0xd7b4('0x58')](_0x19d614['path'])));var _0x568ce0=fs['createWriteStream'](_0x4fbfbb);var _0xfc31f8=archiver(_0xd7b4('0x59'),{'zlib':{'level':0x9}});_0xfc31f8['on'](_0xd7b4('0x5a'),function(_0xaca0c3){if(_0xaca0c3[_0xd7b4('0x5b')]===_0xd7b4('0x5c')){logger[_0xd7b4('0x31')](_0xaca0c3);}else{throw new db[(_0xd7b4('0x5d'))]['Error'](_0xd7b4('0x5e'));}});_0xfc31f8['on'](_0xd7b4('0x31'),function(_0x1db7b0){throw new db[(_0xd7b4('0x5d'))][(_0xd7b4('0x5f'))](_0xd7b4('0x5e'));});_0xfc31f8['pipe'](_0x568ce0);_0xfc31f8[_0xd7b4('0x60')](_0xd7b4('0x61'),{'cwd':path['join'](config[_0xd7b4('0x54')],_0xd7b4('0x55'),path[_0xd7b4('0x62')](_0x19d614[_0xd7b4('0x9')])),'ignore':[path['join'](path[_0xd7b4('0x58')](_0x19d614[_0xd7b4('0x9')]),_0xd7b4('0x63')),path[_0xd7b4('0x53')](path[_0xd7b4('0x58')](_0x19d614['path']),_0xd7b4('0x64'))],'nodir':!![]})[_0xd7b4('0x65')]();_0x568ce0['on']('close',function(){if(!fs['existsSync'](_0x4fbfbb)){throw new db[(_0xd7b4('0x5d'))]['Error']('Plugin\x20not\x20found');}return _0x13e81f['download'](_0x4fbfbb,util['format']('%s.zip',path[_0xd7b4('0x58')](_0x19d614[_0xd7b4('0x9')])),function(_0x50e04e){if(_0x50e04e){throw new db[(_0xd7b4('0x5d'))][(_0xd7b4('0x5f'))](_0xd7b4('0x66'));}fs['unlinkSync'](_0x4fbfbb);logger[_0xd7b4('0x67')]('Download\x20completed');logger[_0xd7b4('0x67')](_0xd7b4('0x68'));});});}return null;})[_0xd7b4('0x51')](handleError(_0x13e81f,null));};exports[_0xd7b4('0x69')]=function(_0x513f47,_0x1e5789,_0x17014a){var _0x1a0b3c=path['basename'](_0x513f47[_0xd7b4('0x6a')][_0xd7b4('0x6b')],path['extname'](_0x513f47[_0xd7b4('0x6a')][_0xd7b4('0x6b')]));var _0x459b9f=path['join'](config[_0xd7b4('0x54')],_0xd7b4('0x55'),_0x513f47[_0xd7b4('0x6a')][_0xd7b4('0x6b')]);var _0x377281=path[_0xd7b4('0x53')](config[_0xd7b4('0x54')],_0xd7b4('0x55'),_0x1a0b3c);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x459b9f);logger['info'](_0xd7b4('0x6c'),_0x377281);try{fs[_0xd7b4('0x6d')](_0x459b9f,parseInt(_0xd7b4('0x6e'),0x8));extract(_0x459b9f,{'dir':_0x377281},function(_0x10f9c7){if(_0x10f9c7){logger[_0xd7b4('0x31')](_0x10f9c7);handleError(_0x10f9c7,!![]);};var _0x525434=fs[_0xd7b4('0x6f')](_0x377281);if(_0x525434[_0xd7b4('0x42')]>0x1){removeReferences(_0x459b9f,_0x377281);logger['error'](_0xd7b4('0x70'));return _0x17014a(new Error('Invalid\x20plugin\x20structure'));}var _0x55cfa8=fs[_0xd7b4('0x71')](path[_0xd7b4('0x53')](_0x377281,_0x525434[0x0]));if(_0x55cfa8[_0xd7b4('0x72')]()){removeReferences(_0x459b9f,_0x377281);logger[_0xd7b4('0x31')]('Invalid\x20plugin\x20structure');return _0x17014a(new Error('Invalid\x20plugin\x20structure'));}if(_0x55cfa8[_0xd7b4('0x73')]()){var _0x453d2d=fs[_0xd7b4('0x6f')](path[_0xd7b4('0x53')](_0x377281,_0x525434[0x0]));if(_0x453d2d[_0xd7b4('0x42')]===0x0){removeReferences(_0x459b9f,_0x377281);logger[_0xd7b4('0x31')](_0xd7b4('0x70'));return _0x17014a(new Error(_0xd7b4('0x70')));}var _0x58ec2c=_0x453d2d[_0xd7b4('0x74')](function(_0x29856b){return _0x29856b===_0xd7b4('0x75');});if(!_0x58ec2c){return _0x17014a(new Error(_0xd7b4('0x76')));}var _0x3e8864=fs[_0xd7b4('0x77')](path[_0xd7b4('0x53')](_0x377281,_0x525434[0x0],_0xd7b4('0x75')));var _0x1b9746=JSON[_0xd7b4('0x78')](_0x3e8864);if('undefined'==typeof _0x1b9746[_0xd7b4('0x33')]){return _0x17014a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7a')]){return _0x17014a(new Error(_0xd7b4('0x7b')));}if('undefined'==typeof _0x1b9746[_0xd7b4('0x7c')]){return _0x17014a(new Error(_0xd7b4('0x7d')));}if(_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7e')]){return _0x17014a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1b9746[_0xd7b4('0x7a')]===_0xd7b4('0x7f')){if(_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')]){return _0x17014a(new Error(_0xd7b4('0x81')));}if(_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')][_0xd7b4('0x82')]&&_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')][_0xd7b4('0x83')]){return _0x17014a(new Error(_0xd7b4('0x84')));}}else if(_0x1b9746[_0xd7b4('0x7a')]===_0xd7b4('0x85')){if('undefined'==typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x86')]){return _0x17014a(new Error(_0xd7b4('0x87')));}if(_0xd7b4('0x79')==typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x88')]){return _0x17014a(new Error(_0xd7b4('0x89')));}}else{return _0x17014a(new Error(_0xd7b4('0x8a')));}var _0x4ccdc5=_0x1b9746['name'];var _0x1a5084=_0x1b9746['description'];var _0x143568=_0x1b9746['type'];var _0x19544f=_0x1b9746[_0xd7b4('0x8b')]?_0x1b9746['sidebar']:_0xd7b4('0x8c');var _0x40bfb2=_0x1b9746['icon']?_0x1b9746[_0xd7b4('0x8d')]:_0xd7b4('0x8e');var _0x5412a6='';var _0x5d3609='';var _0x35dfb8='';var _0x3333ba='';var _0x5d37e5=_0x1b9746[_0xd7b4('0x7c')];if(_0x143568===_0xd7b4('0x7f')){if('undefined'!=typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')][_0xd7b4('0x82')]){var _0x4472e7=_0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd7b4('0x8f')](_0x4472e7)){_0x5412a6=path['join']('plugins',_0x1a0b3c,_0x525434[0x0],_0x4472e7);}else{_0x5412a6=_0x4472e7;}}else{logger[_0xd7b4('0x67')](_0xd7b4('0x90'));}if(_0xd7b4('0x79')!=typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')][_0xd7b4('0x83')]){var _0x23069d=_0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x23069d)){_0x5d3609=path[_0xd7b4('0x53')]('plugins',_0x1a0b3c,_0x525434[0x0],_0x23069d);}else{_0x5d3609=_0x23069d;}}else{logger[_0xd7b4('0x67')](_0xd7b4('0x91'));}}else if(_0x143568===_0xd7b4('0x85')){_0x35dfb8=_0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x86')];_0x3333ba=_0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x88')];if(_0xd7b4('0x79')!=typeof _0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')]){if(_0xd7b4('0x79')!=typeof _0x1b9746[_0xd7b4('0x7e')]['views'][_0xd7b4('0x82')]){var _0x4472e7=_0x1b9746['parameters'][_0xd7b4('0x80')][_0xd7b4('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xd7b4('0x8f')](_0x4472e7)){_0x5412a6=path['join'](_0xd7b4('0x92'),_0x1a0b3c,_0x525434[0x0],_0x4472e7);}else{_0x5412a6=_0x4472e7;}}if('undefined'!=typeof _0x1b9746['parameters']['views'][_0xd7b4('0x83')]){var _0x23069d=_0x1b9746[_0xd7b4('0x7e')][_0xd7b4('0x80')][_0xd7b4('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xd7b4('0x8f')](_0x23069d)){_0x5d3609=path[_0xd7b4('0x53')](_0xd7b4('0x92'),_0x1a0b3c,_0x525434[0x0],_0x23069d);}else{_0x5d3609=_0x23069d;}}}}var _0x2fb84a={'name':_0x4ccdc5,'description':_0x1a5084,'path':path[_0xd7b4('0x53')](_0x1a0b3c,_0x525434[0x0]),'type':_0x143568,'sidebar':_0x19544f,'icon':_0x40bfb2,'adminUrl':_0x5412a6,'agentUrl':_0x5d3609,'scriptName':_0x35dfb8,'scriptPath':_0x3333ba,'version':_0x5d37e5};removeReferences(_0x459b9f,null);return db[_0xd7b4('0x37')][_0xd7b4('0x93')](_0x2fb84a)[_0xd7b4('0x2b')](function(_0x303063){var _0x116f2f={'role':_0x513f47[_0xd7b4('0x94')][_0xd7b4('0x95')],'userProfileId':_0x513f47[_0xd7b4('0x94')]['userProfileId']};if(!_0x116f2f)throw new Error(_0xd7b4('0x96'));if(_0x116f2f[_0xd7b4('0x95')]==='user'){var _0xd53099=_0x303063[_0xd7b4('0x2d')]({'plain':!![]});return db[_0xd7b4('0x97')]['find']({'where':{'name':'Plugins','userProfileId':_0x116f2f['userProfileId']},'raw':!![]})[_0xd7b4('0x2b')](function(_0x40c78f){if(_0x40c78f&&_0x40c78f['autoAssociation']===0x0){return db[_0xd7b4('0x2f')][_0xd7b4('0x93')]({'name':_0xd53099['name'],'resourceId':_0xd53099['id'],'type':_0x40c78f[_0xd7b4('0x33')],'sectionId':_0x40c78f['id']},{})[_0xd7b4('0x2b')](function(){return _0x303063;});}else{return _0x303063;}})['catch'](function(_0x3ca0d8){logger[_0xd7b4('0x31')](_0xd7b4('0x98'),_0x3ca0d8);throw _0x3ca0d8;});}return _0x303063;})[_0xd7b4('0x2b')](respondWithResult(_0x1e5789,null))[_0xd7b4('0x51')](handleError(_0x1e5789,null));}});}catch(_0x1283de){_0x1e5789[_0xd7b4('0x20')](0x1f4)['send'](_0x1283de);}};function removeReferences(_0x1bb244,_0xa064c3){try{if(_0x1bb244){fs[_0xd7b4('0x99')](_0x1bb244);logger[_0xd7b4('0x67')](_0xd7b4('0x9a'));}if(_0xa064c3){rimraf(_0xa064c3,function(){});logger[_0xd7b4('0x67')](_0xd7b4('0x9b'));}}catch(_0x22886d){logger[_0xd7b4('0x31')](_0x22886d);}}exports[_0xd7b4('0x2a')]=function(_0x2a29e2,_0x2e96ea,_0x13a89c){return db[_0xd7b4('0x37')][_0xd7b4('0x50')]({'where':{'id':_0x2a29e2['params']['id']}})[_0xd7b4('0x2b')](handleEntityNotFound(_0x2e96ea,null))['then'](saveUpdates(_0x2a29e2['body'],null))[_0xd7b4('0x2b')](respondWithResult(_0x2e96ea,null))[_0xd7b4('0x51')](handleError(_0x2e96ea,null));};exports[_0xd7b4('0x9c')]=function(_0x3d5305,_0xddae9e,_0x5619e5){return db[_0xd7b4('0x37')][_0xd7b4('0x50')]({'where':{'id':_0x3d5305[_0xd7b4('0x4f')]['id']}})['then'](function(_0x569741){if(_0x569741){return _0x569741[_0xd7b4('0x2c')]();}})[_0xd7b4('0x2b')](function(_0x2edbb4){rimraf(path['join'](config[_0xd7b4('0x54')],'server/files/plugins',path[_0xd7b4('0x62')](_0x2edbb4[_0xd7b4('0x9')])),function(){});return _0x2edbb4;})[_0xd7b4('0x2b')](handleEntityNotFound(_0xddae9e,null))[_0xd7b4('0x2b')](respondWithStatusCode(_0xddae9e,null))[_0xd7b4('0x51')](handleError(_0xddae9e,null));};exports[_0xd7b4('0x9d')]=function(_0x5d7393,_0x4669a1,_0x3aa539){return BPromise[_0xd7b4('0x9e')]()['then'](function(){if(!_0x5d7393[_0xd7b4('0x3d')]['path']){throw new Error(_0xd7b4('0x9f'));}if(!_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0xa0')]){throw new Error(_0xd7b4('0xa1'));}var _0xcab3f7=_0x5d7393['query'][_0xd7b4('0xa2')]?_0x5d7393['query'][_0xd7b4('0xa2')]+':'+_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0xa0')]:'http://localhost:'+_0x5d7393[_0xd7b4('0x3d')]['port'];var _0xa0845a=_0x5d7393['query'][_0xd7b4('0xa3')]?_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0xa3')]:!![];var _0x3759b7=_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0xa4')]?_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0xa4')]:null;var _0x1d1945={'method':_0x5d7393[_0xd7b4('0xa5')],'uri':util['format'](_0xd7b4('0xa6'),_0xcab3f7,_0x5d7393[_0xd7b4('0x3d')][_0xd7b4('0x9')]),'json':_0xa0845a,'resolveWithFullResponse':!![],'encoding':_0x3759b7,'qs':_0x5d7393[_0xd7b4('0x3d')]};if(_0x5d7393['headers']){_0x1d1945[_0xd7b4('0xa7')]=_0x5d7393[_0xd7b4('0xa7')];if(_0x1d1945['headers']['content-length']){delete _0x1d1945[_0xd7b4('0xa7')]['content-length'];}}if(_0x1d1945[_0xd7b4('0xa7')][_0xd7b4('0xa8')]){delete _0x1d1945['headers']['content-type'];}return rp(_0x1d1945);})['then'](function(_0x51afcf){if(_0x51afcf){_0x4669a1['set'](_0x51afcf[_0xd7b4('0xa7')]);logger[_0xd7b4('0x67')](_0x51afcf['body']);if(_['endsWith'](_0x5d7393['query'][_0xd7b4('0x9')],_0xd7b4('0x52'))&&_0x51afcf[_0xd7b4('0xa9')]==0x1f4){return _0x4669a1['sendStatus'](_0x51afcf['statusCode']);}else{return _0x4669a1[_0xd7b4('0x20')](_0x51afcf[_0xd7b4('0xa9')])['send'](_0x51afcf[_0xd7b4('0x94')]);}}else{return _0x4669a1['sendStatus'](0xc8);}})[_0xd7b4('0x51')](handleError(_0x4669a1,null));};exports[_0xd7b4('0xaa')]=function(_0x1ef4f7,_0x452421,_0x44a649){return BPromise[_0xd7b4('0x9e')]()['then'](function(){if(!_0x1ef4f7[_0xd7b4('0x3d')]['path']){throw new Error(_0xd7b4('0x9f'));}if(!_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa0')]){throw new Error(_0xd7b4('0xa1'));}var _0x134869=_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa2')]?_0x1ef4f7['query'][_0xd7b4('0xa2')]+':'+_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa0')]:'http://localhost:'+_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa0')];var _0x5c3f64=_0x1ef4f7[_0xd7b4('0x3d')]['json']?_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa3')]:!![];var _0x151002=_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0xa4')]?_0x1ef4f7['query']['encoding']:null;var _0x4ee0dc={'method':_0x1ef4f7[_0xd7b4('0xa5')],'uri':util[_0xd7b4('0x56')]('%s%s',_0x134869,_0x1ef4f7[_0xd7b4('0x3d')][_0xd7b4('0x9')]),'json':_0x5c3f64,'resolveWithFullResponse':!![],'encoding':_0x151002,'body':_0x1ef4f7[_0xd7b4('0x94')]};if(_0x1ef4f7[_0xd7b4('0xa7')]){_0x4ee0dc['headers']=_0x1ef4f7[_0xd7b4('0xa7')];if(_0x4ee0dc[_0xd7b4('0xa7')][_0xd7b4('0xab')]){delete _0x4ee0dc[_0xd7b4('0xa7')][_0xd7b4('0xab')];}}if(_0x4ee0dc[_0xd7b4('0xa7')]['content-type']){delete _0x4ee0dc[_0xd7b4('0xa7')][_0xd7b4('0xa8')];}return rp(_0x4ee0dc);})[_0xd7b4('0x2b')](function(_0x2dc562){if(_0x2dc562){_0x452421[_0xd7b4('0x25')](_0x2dc562[_0xd7b4('0xa7')]);logger['info'](_0x2dc562[_0xd7b4('0x94')]);return _0x452421[_0xd7b4('0x20')](_0x2dc562['statusCode'])[_0xd7b4('0x34')](_0x2dc562[_0xd7b4('0x94')]);}else{return _0x452421[_0xd7b4('0x30')](0xc8);}})[_0xd7b4('0x51')](handleError(_0x452421,null));}; \ No newline at end of file +var _0x42d8=['views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','./plugin.socket','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','error','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','keys','catch','download','find','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','length','Invalid\x20plugin\x20structure','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html'];(function(_0x4af926,_0x5329c3){var _0x47ae6e=function(_0x45fbd9){while(--_0x45fbd9){_0x4af926['push'](_0x4af926['shift']());}};_0x47ae6e(++_0x5329c3);}(_0x42d8,0xd4));var _0x842d=function(_0xfd025a,_0xd56718){_0xfd025a=_0xfd025a-0x0;var _0x1cd60d=_0x42d8[_0xfd025a];return _0x1cd60d;};'use strict';var pdf=require(_0x842d('0x0'));var emlformat=require(_0x842d('0x1'));var rimraf=require(_0x842d('0x2'));var zipdir=require(_0x842d('0x3'));var jsonpatch=require(_0x842d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x842d('0x5'));var Mustache=require(_0x842d('0x6'));var util=require(_0x842d('0x7'));var path=require('path');var sox=require(_0x842d('0x8'));var csv=require(_0x842d('0x9'));var ejs=require(_0x842d('0xa'));var fs=require('fs');var _=require(_0x842d('0xb'));var squel=require(_0x842d('0xc'));var crypto=require(_0x842d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x842d('0xe'));var toCsv=require(_0x842d('0x9'));var querystring=require(_0x842d('0xf'));var Papa=require('papaparse');var extract=require(_0x842d('0x10'));var rimraf=require('rimraf');var archiver=require(_0x842d('0x11'));var Redis=require(_0x842d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x842d('0x13'));var as=require(_0x842d('0x14'));var hardwareService=require(_0x842d('0x15'));var logger=require('../../config/logger')(_0x842d('0x16'));var utils=require(_0x842d('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x842d('0x18')]=_[_0x842d('0x19')](config[_0x842d('0x18')],{'host':_0x842d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x842d('0x1b'))['register'](socket);function respondWithStatusCode(_0x5e9040,_0x138e63){_0x138e63=_0x138e63||0xcc;return function(_0x1f00f3){if(_0x1f00f3){return _0x5e9040[_0x842d('0x1c')](_0x138e63);}return _0x5e9040['status'](_0x138e63)['end']();};}function respondWithResult(_0x1a5d3b,_0x25b268){_0x25b268=_0x25b268||0xc8;return function(_0x2e6302){if(_0x2e6302){return _0x1a5d3b[_0x842d('0x1d')](_0x25b268)[_0x842d('0x1e')](_0x2e6302);}};}function respondWithFilteredResult(_0x36fca3,_0x41ae91){return function(_0x27bbda){if(_0x27bbda){var _0x4ac62a=_0x27bbda[_0x842d('0x1f')],_0x4d200d=_0x41ae91[_0x842d('0x20')],_0x651e6e=_0x41ae91[_0x842d('0x20')]+_0x41ae91['limit'],_0x3a78ad;if(_0x651e6e>=_0x4ac62a){_0x651e6e=_0x4ac62a;_0x3a78ad=0xc8;}else{_0x3a78ad=0xce;}_0x36fca3[_0x842d('0x1d')](_0x3a78ad);return _0x36fca3['set'](_0x842d('0x21'),_0x4d200d+'-'+_0x651e6e+'/'+_0x4ac62a)[_0x842d('0x1e')](_0x27bbda);}return null;};}function patchUpdates(_0x1a64ef){return function(_0x18e2c7){try{jsonpatch[_0x842d('0x22')](_0x18e2c7,_0x1a64ef,!![]);}catch(_0x572eb8){return BPromise[_0x842d('0x23')](_0x572eb8);}return _0x18e2c7['save']();};}function saveUpdates(_0x4f09ff,_0x3aac2c){return function(_0xbd8f0){if(_0xbd8f0){return _0xbd8f0[_0x842d('0x24')](_0x4f09ff)[_0x842d('0x25')](function(_0x4002b8){return _0x4002b8;});}return null;};}function removeEntity(_0x2f8261,_0x44ae32){return function(_0x59f72c){if(_0x59f72c){return _0x59f72c[_0x842d('0x26')]()[_0x842d('0x25')](function(){var _0x1b51cb=_0x59f72c['get']({'plain':!![]});var _0x1941f1='Plugins';return db[_0x842d('0x27')][_0x842d('0x26')]({'where':{'type':_0x1941f1,'resourceId':_0x1b51cb['id']}})['then'](function(){return _0x59f72c;});})[_0x842d('0x25')](function(){_0x2f8261[_0x842d('0x1d')](0xcc)[_0x842d('0x28')]();});}};}function handleEntityNotFound(_0x5779c4,_0x12c200){return function(_0x427ce8){if(!_0x427ce8){_0x5779c4[_0x842d('0x1c')](0x194);}return _0x427ce8;};}function handleError(_0x59b165,_0x4621b4){_0x4621b4=_0x4621b4||0x1f4;return function(_0x4cf43a){logger[_0x842d('0x29')](_0x4cf43a['stack']);if(_0x4cf43a[_0x842d('0x2a')]){delete _0x4cf43a[_0x842d('0x2a')];}_0x59b165['status'](_0x4621b4)[_0x842d('0x2b')](_0x4cf43a);};}exports[_0x842d('0x2c')]=function(_0xaa1748,_0x48c658){var _0x3b7d57={},_0x40bb24={},_0x5e75ba={'count':0x0,'rows':[]};var _0x4a0fe6=_[_0x842d('0x2d')](db[_0x842d('0x2e')][_0x842d('0x2f')],function(_0x5b321c){return{'name':_0x5b321c[_0x842d('0x30')],'type':_0x5b321c['type'][_0x842d('0x31')]};});_0x40bb24[_0x842d('0x32')]=_['map'](_0x4a0fe6,_0x842d('0x2a'));_0x40bb24[_0x842d('0x33')]=_['keys'](_0xaa1748[_0x842d('0x33')]);_0x40bb24[_0x842d('0x34')]=_[_0x842d('0x35')](_0x40bb24[_0x842d('0x32')],_0x40bb24[_0x842d('0x33')]);_0x3b7d57['attributes']=_[_0x842d('0x35')](_0x40bb24[_0x842d('0x32')],qs[_0x842d('0x36')](_0xaa1748[_0x842d('0x33')]['fields']));_0x3b7d57[_0x842d('0x37')]=_0x3b7d57['attributes']['length']?_0x3b7d57[_0x842d('0x37')]:_0x40bb24[_0x842d('0x32')];if(!_0xaa1748[_0x842d('0x33')][_0x842d('0x38')](_0x842d('0x39'))){_0x3b7d57[_0x842d('0x3a')]=qs['limit'](_0xaa1748[_0x842d('0x33')]['limit']);_0x3b7d57[_0x842d('0x20')]=qs[_0x842d('0x20')](_0xaa1748[_0x842d('0x33')][_0x842d('0x20')]);}_0x3b7d57['order']=qs[_0x842d('0x3b')](_0xaa1748[_0x842d('0x33')][_0x842d('0x3b')]);_0x3b7d57[_0x842d('0x3c')]=qs[_0x842d('0x34')](_[_0x842d('0x3d')](_0xaa1748['query'],_0x40bb24[_0x842d('0x34')]),_0x4a0fe6);if(_0xaa1748[_0x842d('0x33')][_0x842d('0x3e')]){_0x3b7d57[_0x842d('0x3c')]=_[_0x842d('0x3f')](_0x3b7d57[_0x842d('0x3c')],{'$or':_[_0x842d('0x2d')](_0x4a0fe6,function(_0x2da7e4){if(_0x2da7e4[_0x842d('0x40')]!==_0x842d('0x41')){var _0x28fd0f={};_0x28fd0f[_0x2da7e4['name']]={'$like':'%'+_0xaa1748['query']['filter']+'%'};return _0x28fd0f;}})});}_0x3b7d57=_[_0x842d('0x3f')]({},_0x3b7d57,_0xaa1748[_0x842d('0x42')]);var _0x1cf6ef={'where':_0x3b7d57[_0x842d('0x3c')]};return db[_0x842d('0x2e')][_0x842d('0x1f')](_0x1cf6ef)[_0x842d('0x25')](function(_0x51f2fd){_0x5e75ba[_0x842d('0x1f')]=_0x51f2fd;if(_0xaa1748[_0x842d('0x33')][_0x842d('0x43')]){_0x3b7d57[_0x842d('0x44')]=[{'all':!![]}];}return db[_0x842d('0x2e')]['findAll'](_0x3b7d57);})['then'](function(_0x5dced1){_0x5e75ba['rows']=_0x5dced1;return _0x5e75ba;})[_0x842d('0x25')](respondWithFilteredResult(_0x48c658,_0x3b7d57))['catch'](handleError(_0x48c658,null));};exports[_0x842d('0x45')]=function(_0x1618c2,_0x2580aa){var _0x5d5946={'raw':!![],'where':{'id':_0x1618c2[_0x842d('0x46')]['id']}},_0x5ec4f8={};_0x5ec4f8[_0x842d('0x32')]=_[_0x842d('0x47')](db['Plugin'][_0x842d('0x2f')]);_0x5ec4f8[_0x842d('0x33')]=_['keys'](_0x1618c2[_0x842d('0x33')]);_0x5ec4f8[_0x842d('0x34')]=_['intersection'](_0x5ec4f8[_0x842d('0x32')],_0x5ec4f8[_0x842d('0x33')]);_0x5d5946[_0x842d('0x37')]=_[_0x842d('0x35')](_0x5ec4f8['model'],qs[_0x842d('0x36')](_0x1618c2[_0x842d('0x33')][_0x842d('0x36')]));_0x5d5946[_0x842d('0x37')]=_0x5d5946[_0x842d('0x37')]['length']?_0x5d5946[_0x842d('0x37')]:_0x5ec4f8[_0x842d('0x32')];if(_0x1618c2[_0x842d('0x33')][_0x842d('0x43')]){_0x5d5946[_0x842d('0x44')]=[{'all':!![]}];}_0x5d5946=_['merge']({},_0x5d5946,_0x1618c2[_0x842d('0x42')]);return db[_0x842d('0x2e')]['find'](_0x5d5946)[_0x842d('0x25')](handleEntityNotFound(_0x2580aa,null))[_0x842d('0x25')](respondWithResult(_0x2580aa,null))[_0x842d('0x48')](handleError(_0x2580aa,null));};exports[_0x842d('0x49')]=function(_0x3e9dc3,_0x3b6311,_0x441cda){return db[_0x842d('0x2e')][_0x842d('0x4a')]({'where':{'id':_0x3e9dc3[_0x842d('0x46')]['id']},'attributes':[_0x842d('0x2a'),_0x842d('0x4b')],'raw':!![]})[_0x842d('0x25')](handleEntityNotFound(_0x3b6311,null))[_0x842d('0x25')](function(_0x1a0743){if(_0x1a0743){var _0x578948=path[_0x842d('0x4c')](config[_0x842d('0x4d')],_0x842d('0x4e'),util[_0x842d('0x4f')](_0x842d('0x50'),path[_0x842d('0x51')](_0x1a0743['path'])));var _0x17ee22=fs[_0x842d('0x52')](_0x578948);var _0xf35164=archiver(_0x842d('0x53'),{'zlib':{'level':0x9}});_0xf35164['on'](_0x842d('0x54'),function(_0x43e8d8){if(_0x43e8d8[_0x842d('0x55')]==='ENOENT'){logger[_0x842d('0x29')](_0x43e8d8);}else{throw new db['Sequelize']['Error'](_0x842d('0x56'));}});_0xf35164['on'](_0x842d('0x29'),function(_0x111697){throw new db[(_0x842d('0x57'))]['Error'](_0x842d('0x56'));});_0xf35164[_0x842d('0x58')](_0x17ee22);_0xf35164[_0x842d('0x59')](_0x842d('0x5a'),{'cwd':path[_0x842d('0x4c')](config['root'],'server/files/plugins',path[_0x842d('0x5b')](_0x1a0743[_0x842d('0x4b')])),'ignore':[path['join'](path[_0x842d('0x51')](_0x1a0743[_0x842d('0x4b')]),_0x842d('0x5c')),path['join'](path[_0x842d('0x51')](_0x1a0743[_0x842d('0x4b')]),_0x842d('0x5d'))],'nodir':!![]})[_0x842d('0x5e')]();_0x17ee22['on'](_0x842d('0x5f'),function(){if(!fs[_0x842d('0x60')](_0x578948)){throw new db[(_0x842d('0x57'))][(_0x842d('0x61'))]('Plugin\x20not\x20found');}return _0x3b6311['download'](_0x578948,util['format'](_0x842d('0x50'),path['basename'](_0x1a0743[_0x842d('0x4b')])),function(_0x5576e8){if(_0x5576e8){throw new db['Sequelize'][(_0x842d('0x61'))](_0x842d('0x62'));}fs[_0x842d('0x63')](_0x578948);logger[_0x842d('0x64')]('Download\x20completed');logger['info'](_0x842d('0x65'));});});}return null;})[_0x842d('0x48')](handleError(_0x3b6311,null));};exports['upload']=function(_0x5524c6,_0x34f2,_0x1205dc){var _0x25f1ac=path[_0x842d('0x51')](_0x5524c6[_0x842d('0x66')][_0x842d('0x67')],path[_0x842d('0x68')](_0x5524c6[_0x842d('0x66')][_0x842d('0x67')]));var _0x11ba02=path[_0x842d('0x4c')](config[_0x842d('0x4d')],_0x842d('0x4e'),_0x5524c6[_0x842d('0x66')][_0x842d('0x67')]);var _0x394ea0=path['join'](config[_0x842d('0x4d')],_0x842d('0x4e'),_0x25f1ac);logger[_0x842d('0x64')](_0x842d('0x69'),_0x11ba02);logger['info'](_0x842d('0x6a'),_0x394ea0);try{fs['chmodSync'](_0x11ba02,parseInt(_0x842d('0x6b'),0x8));extract(_0x11ba02,{'dir':_0x394ea0},function(_0x20e103){if(_0x20e103){logger[_0x842d('0x29')](_0x20e103);handleError(_0x20e103,!![]);};var _0x586301=fs[_0x842d('0x6c')](_0x394ea0);if(_0x586301[_0x842d('0x6d')]>0x1){removeReferences(_0x11ba02,_0x394ea0);logger['error']('Invalid\x20plugin\x20structure');return _0x1205dc(new Error(_0x842d('0x6e')));}var _0x1341e2=fs['lstatSync'](path[_0x842d('0x4c')](_0x394ea0,_0x586301[0x0]));if(_0x1341e2['isFile']()){removeReferences(_0x11ba02,_0x394ea0);logger[_0x842d('0x29')](_0x842d('0x6e'));return _0x1205dc(new Error(_0x842d('0x6e')));}if(_0x1341e2[_0x842d('0x6f')]()){var _0x2b283f=fs[_0x842d('0x6c')](path[_0x842d('0x4c')](_0x394ea0,_0x586301[0x0]));if(_0x2b283f[_0x842d('0x6d')]===0x0){removeReferences(_0x11ba02,_0x394ea0);logger['error']('Invalid\x20plugin\x20structure');return _0x1205dc(new Error(_0x842d('0x6e')));}var _0x2ecb7b=_0x2b283f['some'](function(_0x51a442){return _0x51a442===_0x842d('0x70');});if(!_0x2ecb7b){return _0x1205dc(new Error(_0x842d('0x71')));}var _0x3c557e=fs[_0x842d('0x72')](path[_0x842d('0x4c')](_0x394ea0,_0x586301[0x0],_0x842d('0x70')));var _0x484008=JSON[_0x842d('0x73')](_0x3c557e);if(_0x842d('0x74')==typeof _0x484008['name']){return _0x1205dc(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x484008[_0x842d('0x40')]){return _0x1205dc(new Error(_0x842d('0x75')));}if(_0x842d('0x74')==typeof _0x484008[_0x842d('0x76')]){return _0x1205dc(new Error(_0x842d('0x77')));}if(_0x842d('0x74')==typeof _0x484008[_0x842d('0x78')]){return _0x1205dc(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x484008['type']===_0x842d('0x79')){if(_0x842d('0x74')==typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')]){return _0x1205dc(new Error(_0x842d('0x7b')));}if(_0x842d('0x74')==typeof _0x484008[_0x842d('0x78')]['views'][_0x842d('0x7c')]&&_0x842d('0x74')==typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7d')]){return _0x1205dc(new Error(_0x842d('0x7e')));}}else if(_0x484008[_0x842d('0x40')]===_0x842d('0x7f')){if(_0x842d('0x74')==typeof _0x484008['parameters'][_0x842d('0x80')]){return _0x1205dc(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x842d('0x74')==typeof _0x484008[_0x842d('0x78')]['scriptPath']){return _0x1205dc(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1205dc(new Error(_0x842d('0x81')));}var _0xa54f87=_0x484008[_0x842d('0x2a')];var _0x2df37e=_0x484008[_0x842d('0x82')];var _0x17133e=_0x484008[_0x842d('0x40')];var _0x5d1a4f=_0x484008[_0x842d('0x83')]?_0x484008[_0x842d('0x83')]:'always';var _0x2d205f=_0x484008['icon']?_0x484008[_0x842d('0x84')]:_0x842d('0x85');var _0x77cbe0='';var _0x3de03b='';var _0x579312='';var _0x29fbac='';var _0x26d039=_0x484008['version'];if(_0x17133e===_0x842d('0x79')){if(_0x842d('0x74')!=typeof _0x484008[_0x842d('0x78')]['views'][_0x842d('0x7c')]){var _0x172119=_0x484008['parameters']['views'][_0x842d('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x842d('0x86')](_0x172119)){_0x77cbe0=path[_0x842d('0x4c')](_0x842d('0x87'),_0x25f1ac,_0x586301[0x0],_0x172119);}else{_0x77cbe0=_0x172119;}}else{logger[_0x842d('0x64')](_0x842d('0x88'));}if(_0x842d('0x74')!=typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7d')]){var _0x1db82e=_0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x842d('0x86')](_0x1db82e)){_0x3de03b=path['join'](_0x842d('0x87'),_0x25f1ac,_0x586301[0x0],_0x1db82e);}else{_0x3de03b=_0x1db82e;}}else{logger[_0x842d('0x64')](_0x842d('0x89'));}}else if(_0x17133e===_0x842d('0x7f')){_0x579312=_0x484008['parameters'][_0x842d('0x80')];_0x29fbac=_0x484008[_0x842d('0x78')][_0x842d('0x8a')];if(_0x842d('0x74')!=typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')]){if(_0x842d('0x74')!=typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7c')]){var _0x172119=_0x484008['parameters'][_0x842d('0x7a')][_0x842d('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x842d('0x86')](_0x172119)){_0x77cbe0=path[_0x842d('0x4c')](_0x842d('0x87'),_0x25f1ac,_0x586301[0x0],_0x172119);}else{_0x77cbe0=_0x172119;}}if(_0x842d('0x74')!=typeof _0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7d')]){var _0x1db82e=_0x484008[_0x842d('0x78')][_0x842d('0x7a')][_0x842d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x842d('0x86')](_0x1db82e)){_0x3de03b=path[_0x842d('0x4c')]('plugins',_0x25f1ac,_0x586301[0x0],_0x1db82e);}else{_0x3de03b=_0x1db82e;}}}}var _0x2dc776={'name':_0xa54f87,'description':_0x2df37e,'path':path[_0x842d('0x4c')](_0x25f1ac,_0x586301[0x0]),'type':_0x17133e,'sidebar':_0x5d1a4f,'icon':_0x2d205f,'adminUrl':_0x77cbe0,'agentUrl':_0x3de03b,'scriptName':_0x579312,'scriptPath':_0x29fbac,'version':_0x26d039};removeReferences(_0x11ba02,null);return db[_0x842d('0x2e')][_0x842d('0x8b')](_0x2dc776)['then'](function(_0x4a8b3f){var _0x22ca0f={'role':_0x5524c6[_0x842d('0x8c')][_0x842d('0x8d')],'userProfileId':_0x5524c6[_0x842d('0x8c')][_0x842d('0x8e')]};if(!_0x22ca0f)throw new Error(_0x842d('0x8f'));if(_0x22ca0f[_0x842d('0x8d')]===_0x842d('0x90')){var _0x180874=_0x4a8b3f['get']({'plain':!![]});return db[_0x842d('0x91')]['find']({'where':{'name':'Plugins','userProfileId':_0x22ca0f[_0x842d('0x8e')]},'raw':!![]})[_0x842d('0x25')](function(_0x31b6e5){if(_0x31b6e5&&_0x31b6e5[_0x842d('0x92')]===0x0){return db[_0x842d('0x27')][_0x842d('0x8b')]({'name':_0x180874[_0x842d('0x2a')],'resourceId':_0x180874['id'],'type':_0x31b6e5['name'],'sectionId':_0x31b6e5['id']},{})[_0x842d('0x25')](function(){return _0x4a8b3f;});}else{return _0x4a8b3f;}})['catch'](function(_0x48b957){logger[_0x842d('0x29')](_0x842d('0x93'),_0x48b957);throw _0x48b957;});}return _0x4a8b3f;})[_0x842d('0x25')](respondWithResult(_0x34f2,null))['catch'](handleError(_0x34f2,null));}});}catch(_0x222c81){_0x34f2[_0x842d('0x1d')](0x1f4)[_0x842d('0x2b')](_0x222c81);}};function removeReferences(_0x4a77fc,_0x17d479){try{if(_0x4a77fc){fs[_0x842d('0x63')](_0x4a77fc);logger[_0x842d('0x64')](_0x842d('0x94'));}if(_0x17d479){rimraf(_0x17d479,function(){});logger[_0x842d('0x64')](_0x842d('0x95'));}}catch(_0xb3d593){logger[_0x842d('0x29')](_0xb3d593);}}exports[_0x842d('0x24')]=function(_0x41558e,_0x919e64,_0x4eeb10){return db['Plugin'][_0x842d('0x4a')]({'where':{'id':_0x41558e['params']['id']}})[_0x842d('0x25')](handleEntityNotFound(_0x919e64,null))['then'](saveUpdates(_0x41558e[_0x842d('0x8c')],null))['then'](respondWithResult(_0x919e64,null))[_0x842d('0x48')](handleError(_0x919e64,null));};exports[_0x842d('0x96')]=function(_0x20c420,_0x43ec9d,_0x533c46){return db[_0x842d('0x2e')]['find']({'where':{'id':_0x20c420[_0x842d('0x46')]['id']}})[_0x842d('0x25')](function(_0x51a6bc){if(_0x51a6bc){return _0x51a6bc[_0x842d('0x26')]();}})[_0x842d('0x25')](function(_0x24293b){rimraf(path['join'](config['root'],'server/files/plugins',path['dirname'](_0x24293b[_0x842d('0x4b')])),function(){});return _0x24293b;})['then'](handleEntityNotFound(_0x43ec9d,null))['then'](respondWithStatusCode(_0x43ec9d,null))['catch'](handleError(_0x43ec9d,null));};exports[_0x842d('0x97')]=function(_0x55b875,_0xbf5b2a,_0x59e580){return BPromise['resolve']()[_0x842d('0x25')](function(){if(!_0x55b875[_0x842d('0x33')][_0x842d('0x4b')]){throw new Error(_0x842d('0x98'));}if(!_0x55b875[_0x842d('0x33')][_0x842d('0x99')]){throw new Error(_0x842d('0x9a'));}var _0x483e1b=_0x55b875[_0x842d('0x33')][_0x842d('0x9b')]?_0x55b875[_0x842d('0x33')][_0x842d('0x9b')]+':'+_0x55b875[_0x842d('0x33')][_0x842d('0x99')]:_0x842d('0x9c')+_0x55b875[_0x842d('0x33')]['port'];var _0x1767dc=_0x55b875['query'][_0x842d('0x1e')]?_0x55b875[_0x842d('0x33')][_0x842d('0x1e')]:!![];var _0x1ace20=_0x55b875[_0x842d('0x33')][_0x842d('0x9d')]?_0x55b875[_0x842d('0x33')][_0x842d('0x9d')]:null;var _0x254025={'method':_0x55b875[_0x842d('0x9e')],'uri':util[_0x842d('0x4f')](_0x842d('0x9f'),_0x483e1b,_0x55b875[_0x842d('0x33')][_0x842d('0x4b')]),'json':_0x1767dc,'resolveWithFullResponse':!![],'encoding':_0x1ace20,'qs':_0x55b875['query']};if(_0x55b875[_0x842d('0xa0')]){_0x254025[_0x842d('0xa0')]=_0x55b875[_0x842d('0xa0')];if(_0x254025['headers']['content-length']){delete _0x254025[_0x842d('0xa0')][_0x842d('0xa1')];}}if(_0x254025['headers'][_0x842d('0xa2')]){delete _0x254025[_0x842d('0xa0')][_0x842d('0xa2')];}return rp(_0x254025);})[_0x842d('0x25')](function(_0x4d6bae){if(_0x4d6bae){_0xbf5b2a[_0x842d('0xa3')](_0x4d6bae[_0x842d('0xa0')]);logger[_0x842d('0x64')](_0x4d6bae[_0x842d('0x8c')]);if(_[_0x842d('0xa4')](_0x55b875[_0x842d('0x33')][_0x842d('0x4b')],_0x842d('0x49'))&&_0x4d6bae['statusCode']==0x1f4){return _0xbf5b2a['sendStatus'](_0x4d6bae[_0x842d('0xa5')]);}else{return _0xbf5b2a['status'](_0x4d6bae[_0x842d('0xa5')])[_0x842d('0x2b')](_0x4d6bae[_0x842d('0x8c')]);}}else{return _0xbf5b2a[_0x842d('0x1c')](0xc8);}})[_0x842d('0x48')](handleError(_0xbf5b2a,null));};exports[_0x842d('0xa6')]=function(_0x3a35fa,_0x3c111e,_0x41aea0){return BPromise['resolve']()[_0x842d('0x25')](function(){if(!_0x3a35fa[_0x842d('0x33')][_0x842d('0x4b')]){throw new Error(_0x842d('0x98'));}if(!_0x3a35fa[_0x842d('0x33')][_0x842d('0x99')]){throw new Error(_0x842d('0x9a'));}var _0x4ddb40=_0x3a35fa[_0x842d('0x33')][_0x842d('0x9b')]?_0x3a35fa[_0x842d('0x33')][_0x842d('0x9b')]+':'+_0x3a35fa['query']['port']:_0x842d('0x9c')+_0x3a35fa['query'][_0x842d('0x99')];var _0x390aca=_0x3a35fa[_0x842d('0x33')][_0x842d('0x1e')]?_0x3a35fa['query'][_0x842d('0x1e')]:!![];var _0x1db158=_0x3a35fa['query'][_0x842d('0x9d')]?_0x3a35fa[_0x842d('0x33')][_0x842d('0x9d')]:null;var _0x302553={'method':_0x3a35fa[_0x842d('0x9e')],'uri':util[_0x842d('0x4f')]('%s%s',_0x4ddb40,_0x3a35fa[_0x842d('0x33')][_0x842d('0x4b')]),'json':_0x390aca,'resolveWithFullResponse':!![],'encoding':_0x1db158,'body':_0x3a35fa[_0x842d('0x8c')]};if(_0x3a35fa[_0x842d('0xa0')]){_0x302553[_0x842d('0xa0')]=_0x3a35fa[_0x842d('0xa0')];if(_0x302553['headers'][_0x842d('0xa1')]){delete _0x302553[_0x842d('0xa0')][_0x842d('0xa1')];}}if(_0x302553['headers']['content-type']){delete _0x302553[_0x842d('0xa0')]['content-type'];}return rp(_0x302553);})[_0x842d('0x25')](function(_0x56c0ae){if(_0x56c0ae){_0x3c111e[_0x842d('0xa3')](_0x56c0ae[_0x842d('0xa0')]);logger[_0x842d('0x64')](_0x56c0ae[_0x842d('0x8c')]);return _0x3c111e[_0x842d('0x1d')](_0x56c0ae[_0x842d('0xa5')])[_0x842d('0x2b')](_0x56c0ae[_0x842d('0x8c')]);}else{return _0x3c111e[_0x842d('0x1c')](0xc8);}})[_0x842d('0x48')](handleError(_0x3c111e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8d03144..4eb1f05 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 _0xd117=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x558dad,_0x1a9b5a){var _0x1921ea=function(_0x2d44d6){while(--_0x2d44d6){_0x558dad['push'](_0x558dad['shift']());}};_0x1921ea(++_0x1a9b5a);}(_0xd117,0x182));var _0x7d11=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xd117[_0x4996d5];return _0x4793f9;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var Plugin=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){PluginEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);PluginEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];Plugin[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=PluginEvents; \ No newline at end of file +var _0xf61e=['hook','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x29341e,_0x5854f8){var _0x260533=function(_0x28a615){while(--_0x28a615){_0x29341e['push'](_0x29341e['shift']());}};_0x260533(++_0x5854f8);}(_0xf61e,0x191));var _0xef61=function(_0x3c9490,_0x493f0a){_0x3c9490=_0x3c9490-0x0;var _0x4a65c1=_0xf61e[_0x3c9490];return _0x4a65c1;};'use strict';var EventEmitter=require(_0xef61('0x0'));var Plugin=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xef61('0x3')](0x0);var events={'afterCreate':_0xef61('0x4'),'afterUpdate':_0xef61('0x5'),'afterDestroy':_0xef61('0x6')};function emitEvent(_0x40509e){return function(_0x2bd1d0,_0x14122a,_0x239fa9){PluginEvents[_0xef61('0x7')](_0x40509e+':'+_0x2bd1d0['id'],_0x2bd1d0);PluginEvents['emit'](_0x40509e,_0x2bd1d0);_0x239fa9(null);};}for(var e in events){if(events[_0xef61('0x8')](e)){var event=events[e];Plugin[_0xef61('0x9')](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 507acf5..e41691c 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 _0xdb8b=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb8b,0x97));var _0xbdb8=function(_0x1b3a82,_0x163669){_0x1b3a82=_0x1b3a82-0x0;var _0x2ca9df=_0xdb8b[_0x1b3a82];return _0x2ca9df;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var logger=require(_0xbdb8('0x1'))(_0xbdb8('0x2'));var moment=require(_0xbdb8('0x3'));var BPromise=require(_0xbdb8('0x4'));var rp=require(_0xbdb8('0x5'));var fs=require('fs');var path=require(_0xbdb8('0x6'));var rimraf=require(_0xbdb8('0x7'));var config=require(_0xbdb8('0x8'));var attributes=require(_0xbdb8('0x9'));module['exports']=function(_0x3d9d50,_0x253570){return _0x3d9d50['define'](_0xbdb8('0xa'),attributes,{'tableName':_0xbdb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf400=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','lodash'];(function(_0x345705,_0x2829c1){var _0x22c250=function(_0x4ae124){while(--_0x4ae124){_0x345705['push'](_0x345705['shift']());}};_0x22c250(++_0x2829c1);}(_0xf400,0x18b));var _0x0f40=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xf400[_0x454165];return _0x56db53;};'use strict';var _=require(_0x0f40('0x0'));var util=require(_0x0f40('0x1'));var logger=require(_0x0f40('0x2'))(_0x0f40('0x3'));var moment=require(_0x0f40('0x4'));var BPromise=require(_0x0f40('0x5'));var rp=require(_0x0f40('0x6'));var fs=require('fs');var path=require(_0x0f40('0x7'));var rimraf=require(_0x0f40('0x8'));var config=require('../../config/environment');var attributes=require(_0x0f40('0x9'));module[_0x0f40('0xa')]=function(_0x50c8bc,_0x3e010c){return _0x50c8bc[_0x0f40('0xb')]('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 8cff783..9f2086c 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 _0x1cbe=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','debug','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./plugin.socket'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x1cbe,0x1f3));var _0xe1cb=function(_0x318e35,_0x155312){_0x318e35=_0x318e35-0x0;var _0x4590c5=_0x1cbe[_0x318e35];return _0x4590c5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1cb('0x0'));var BPromise=require('bluebird');var rs=require(_0xe1cb('0x1'));var fs=require('fs');var Redis=require(_0xe1cb('0x2'));var db=require(_0xe1cb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1cb('0x4'))(_0xe1cb('0x5'));var config=require(_0xe1cb('0x6'));var jayson=require(_0xe1cb('0x7'));var client=jayson[_0xe1cb('0x8')][_0xe1cb('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe1cb('0xa')],{'host':_0xe1cb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe1cb('0xc'))[_0xe1cb('0xd')](socket);function respondWithRpcPromise(_0x3ed30c,_0x439085,_0x4c7573){return new BPromise(function(_0x182e16,_0x8b7044){return client[_0xe1cb('0xe')](_0x3ed30c,_0x4c7573)[_0xe1cb('0xf')](function(_0x1faabd){logger[_0xe1cb('0x10')](_0xe1cb('0x11'),_0x439085,_0xe1cb('0x12'));logger['debug'](_0xe1cb('0x13'),_0x439085,_0xe1cb('0x12'),JSON['stringify'](_0x1faabd));if(_0x1faabd[_0xe1cb('0x14')]){if(_0x1faabd['error'][_0xe1cb('0x15')]===0x1f4){logger[_0xe1cb('0x14')](_0xe1cb('0x11'),_0x439085,_0x1faabd[_0xe1cb('0x14')][_0xe1cb('0x16')]);return _0x8b7044(_0x1faabd['error']['message']);}logger['error'](_0xe1cb('0x11'),_0x439085,_0x1faabd['error'][_0xe1cb('0x16')]);return _0x182e16(_0x1faabd[_0xe1cb('0x14')][_0xe1cb('0x16')]);}else{logger[_0xe1cb('0x10')](_0xe1cb('0x11'),_0x439085,_0xe1cb('0x12'));_0x182e16(_0x1faabd[_0xe1cb('0x17')]['message']);}})[_0xe1cb('0x18')](function(_0x3924a3){logger[_0xe1cb('0x14')](_0xe1cb('0x11'),_0x439085,_0x3924a3);_0x8b7044(_0x3924a3);});});}exports[_0xe1cb('0x19')]=function(_0x2961e5){var _0x2ea80c=this;return new Promise(function(_0x563914,_0x1e8b60){return db[_0xe1cb('0x1a')][_0xe1cb('0x1b')](_0x2961e5['body'],{'raw':_0x2961e5[_0xe1cb('0x1c')]?_0x2961e5[_0xe1cb('0x1c')][_0xe1cb('0x1d')]===undefined?!![]:![]:!![]})[_0xe1cb('0xf')](function(_0x219902){logger[_0xe1cb('0x10')](_0xe1cb('0x19'),_0x2961e5);logger[_0xe1cb('0x1e')](_0xe1cb('0x19'),_0x2961e5,JSON[_0xe1cb('0x1f')](_0x219902));_0x563914(_0x219902);})[_0xe1cb('0x18')](function(_0x14cbab){logger[_0xe1cb('0x14')](_0xe1cb('0x19'),_0x14cbab['message'],_0x2961e5);_0x1e8b60(_0x2ea80c['error'](0x1f4,_0x14cbab[_0xe1cb('0x16')]));});});}; \ No newline at end of file +var _0xecf8=['catch','Plugin','create','options','raw','CreatePlugin','stringify','lodash','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x1606ad,_0x2a757f){var _0x4ff678=function(_0x1037c7){while(--_0x1037c7){_0x1606ad['push'](_0x1606ad['shift']());}};_0x4ff678(++_0x2a757f);}(_0xecf8,0x16f));var _0x8ecf=function(_0x395488,_0x2254d1){_0x395488=_0x395488-0x0;var _0x23ff6b=_0xecf8[_0x395488];return _0x23ff6b;};'use strict';var _=require(_0x8ecf('0x0'));var util=require(_0x8ecf('0x1'));var moment=require(_0x8ecf('0x2'));var BPromise=require(_0x8ecf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ecf('0x4'))('rpc');var config=require(_0x8ecf('0x5'));var jayson=require(_0x8ecf('0x6'));var client=jayson[_0x8ecf('0x7')][_0x8ecf('0x8')]({'port':0x232a});config['redis']=_[_0x8ecf('0x9')](config[_0x8ecf('0xa')],{'host':_0x8ecf('0xb'),'port':0x18eb});var socket=require(_0x8ecf('0xc'))(new Redis(config[_0x8ecf('0xa')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x315703,_0x14cc61,_0x1d9888){return new BPromise(function(_0x153aad,_0x446759){return client[_0x8ecf('0xd')](_0x315703,_0x1d9888)[_0x8ecf('0xe')](function(_0x4ef8b2){logger['info'](_0x8ecf('0xf'),_0x14cc61,_0x8ecf('0x10'));logger[_0x8ecf('0x11')](_0x8ecf('0x12'),_0x14cc61,_0x8ecf('0x10'),JSON['stringify'](_0x4ef8b2));if(_0x4ef8b2[_0x8ecf('0x13')]){if(_0x4ef8b2[_0x8ecf('0x13')]['code']===0x1f4){logger['error'](_0x8ecf('0xf'),_0x14cc61,_0x4ef8b2[_0x8ecf('0x13')][_0x8ecf('0x14')]);return _0x446759(_0x4ef8b2['error']['message']);}logger[_0x8ecf('0x13')](_0x8ecf('0xf'),_0x14cc61,_0x4ef8b2[_0x8ecf('0x13')][_0x8ecf('0x14')]);return _0x153aad(_0x4ef8b2['error'][_0x8ecf('0x14')]);}else{logger[_0x8ecf('0x15')]('Plugin,\x20%s,\x20%s',_0x14cc61,_0x8ecf('0x10'));_0x153aad(_0x4ef8b2[_0x8ecf('0x16')][_0x8ecf('0x14')]);}})[_0x8ecf('0x17')](function(_0x1afd3f){logger[_0x8ecf('0x13')](_0x8ecf('0xf'),_0x14cc61,_0x1afd3f);_0x446759(_0x1afd3f);});});}exports['CreatePlugin']=function(_0x4c979d){var _0x428383=this;return new Promise(function(_0xbf49a6,_0x190479){return db[_0x8ecf('0x18')][_0x8ecf('0x19')](_0x4c979d['body'],{'raw':_0x4c979d[_0x8ecf('0x1a')]?_0x4c979d[_0x8ecf('0x1a')][_0x8ecf('0x1b')]===undefined?!![]:![]:!![]})[_0x8ecf('0xe')](function(_0x450f94){logger[_0x8ecf('0x15')](_0x8ecf('0x1c'),_0x4c979d);logger[_0x8ecf('0x11')](_0x8ecf('0x1c'),_0x4c979d,JSON[_0x8ecf('0x1d')](_0x450f94));_0xbf49a6(_0x450f94);})[_0x8ecf('0x17')](function(_0x4dbe7f){logger[_0x8ecf('0x13')]('CreatePlugin',_0x4dbe7f['message'],_0x4c979d);_0x190479(_0x428383[_0x8ecf('0x13')](0x1f4,_0x4dbe7f[_0x8ecf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dd097c2..a5dae8d 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 _0x06f7=['save','remove','update','emit','removeListener','length','plugin:','./plugin.events'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x06f7,0xd7));var _0x706f=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x06f7[_0x35b195];return _0x2433bf;};'use strict';var PluginEvents=require(_0x706f('0x0'));var events=[_0x706f('0x1'),_0x706f('0x2'),_0x706f('0x3')];function createListener(_0x3e7715,_0x28b55b){return function(_0x518474){_0x28b55b[_0x706f('0x4')](_0x3e7715,_0x518474);};}function removeListener(_0x59239f,_0xe669e){return function(){PluginEvents[_0x706f('0x5')](_0x59239f,_0xe669e);};}exports['register']=function(_0x258fe7){for(var _0x3f8f3e=0x0,_0x30a043=events[_0x706f('0x6')];_0x3f8f3e<_0x30a043;_0x3f8f3e++){var _0x2204c9=events[_0x3f8f3e];var _0x3f7748=createListener(_0x706f('0x7')+_0x2204c9,_0x258fe7);PluginEvents['on'](_0x2204c9,_0x3f7748);}}; \ No newline at end of file +var _0xf7e2=['plugin:','save','remove','emit','removeListener'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0xf7e2,0x191));var _0x2f7e=function(_0x46ee72,_0xde4f9c){_0x46ee72=_0x46ee72-0x0;var _0xaed9fc=_0xf7e2[_0x46ee72];return _0xaed9fc;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x2f7e('0x0'),_0x2f7e('0x1'),'update'];function createListener(_0x17a0d6,_0x50950c){return function(_0x320814){_0x50950c[_0x2f7e('0x2')](_0x17a0d6,_0x320814);};}function removeListener(_0x5ea2cb,_0x2b8d46){return function(){PluginEvents[_0x2f7e('0x3')](_0x5ea2cb,_0x2b8d46);};}exports['register']=function(_0x13d6d3){for(var _0x10532e=0x0,_0x1229d3=events['length'];_0x10532e<_0x1229d3;_0x10532e++){var _0x19f1d9=events[_0x10532e];var _0x23f8c2=createListener(_0x2f7e('0x4')+_0x19f1d9,_0x13d6d3);PluginEvents['on'](_0x19f1d9,_0x23f8c2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b6e00da..365d200 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 _0x93ca=['isAuthenticated','index','/:id','show','create','put','update','destroy','express','../../components/auth/service','./pm2.controller','get'];(function(_0x49fa98,_0x11accf){var _0x1698f1=function(_0x22f95f){while(--_0x22f95f){_0x49fa98['push'](_0x49fa98['shift']());}};_0x1698f1(++_0x11accf);}(_0x93ca,0xb0));var _0xa93c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ca[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xa93c('0x0'));var router=express['Router']();var auth=require(_0xa93c('0x1'));var controller=require(_0xa93c('0x2'));router[_0xa93c('0x3')]('/',auth[_0xa93c('0x4')](),controller[_0xa93c('0x5')]);router[_0xa93c('0x3')](_0xa93c('0x6'),auth[_0xa93c('0x4')](),controller[_0xa93c('0x7')]);router['post']('/',auth[_0xa93c('0x4')](),controller[_0xa93c('0x8')]);router[_0xa93c('0x9')]('/:id',auth[_0xa93c('0x4')](),controller[_0xa93c('0xa')]);router['delete']('/:id',auth[_0xa93c('0x4')](),controller[_0xa93c('0xb')]);module['exports']=router; \ No newline at end of file +var _0x2176=['show','post','create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','/:id'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x2176,0x1ba));var _0x6217=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2176[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x6217('0x0'));var router=express[_0x6217('0x1')]();var auth=require(_0x6217('0x2'));var controller=require('./pm2.controller');router[_0x6217('0x3')]('/',auth[_0x6217('0x4')](),controller['index']);router['get'](_0x6217('0x5'),auth['isAuthenticated'](),controller[_0x6217('0x6')]);router[_0x6217('0x7')]('/',auth[_0x6217('0x4')](),controller[_0x6217('0x8')]);router[_0x6217('0x9')](_0x6217('0x5'),auth['isAuthenticated'](),controller[_0x6217('0xa')]);router[_0x6217('0xb')](_0x6217('0x5'),auth[_0x6217('0x4')](),controller[_0x6217('0xc')]);module[_0x6217('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 6baba7d..aac927c 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 _0x19d9=['cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','stack','status','send','npm\x20install','info','list','then','reject','express','name','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins'];(function(_0x4e6bf6,_0x397e69){var _0x4eb06c=function(_0x56289e){while(--_0x56289e){_0x4e6bf6['push'](_0x4e6bf6['shift']());}};_0x4eb06c(++_0x397e69);}(_0x19d9,0xb9));var _0x919d=function(_0x479826,_0x598c41){_0x479826=_0x479826-0x0;var _0x1c621e=_0x19d9[_0x479826];return _0x1c621e;};'use strict';var _=require(_0x919d('0x0'));var pm2=require(_0x919d('0x1'));var logger=require(_0x919d('0x2'))(_0x919d('0x3'));var path=require('path');var exec=require('child_process')[_0x919d('0x4')];var BPromise=require(_0x919d('0x5'));function handleEntityNotFound(_0xa783e1,_0x354b20){return function(_0x595d75){if(!_0x595d75){_0xa783e1[_0x919d('0x6')](0x194);;}return _0x595d75;};}function respondWithResult(_0x5be674,_0xbe0618){_0xbe0618=_0xbe0618||0xc8;return function(_0x3b5785){if(_0x3b5785){return _0x5be674['status'](_0xbe0618)[_0x919d('0x7')](_0x3b5785);}return null;};}function handleError(_0xa2c9c2,_0x30940e){_0x30940e=_0x30940e||0x1f4;return function(_0x2c6bea){logger[_0x919d('0x8')](_0x2c6bea[_0x919d('0x9')]);if(_0x2c6bea['name']){delete _0x2c6bea['name'];}_0xa2c9c2[_0x919d('0xa')](_0x30940e)[_0x919d('0xb')](_0x2c6bea);};}function execChildProcess(){return new BPromise(function(_0x50a987,_0x2b1125){exec(_0x919d('0xc'),function(_0xd04662,_0x2c9d5c,_0x2de0de){logger[_0x919d('0xd')](_0x2c9d5c);logger[_0x919d('0xd')](_0x2de0de);if(_0xd04662){logger[_0x919d('0x8')](_0xd04662);return _0x2b1125(_0xd04662);}return _0x50a987(_0x2c9d5c);});});}exports['index']=function(_0x5b930e,_0x25d3ec){return pm2[_0x919d('0xe')]()[_0x919d('0xf')](function(_0x4dcd6f){if(_0x4dcd6f){var _0x478f06=_[_0x919d('0x10')](_0x4dcd6f,function(_0x27ee44){return _0x27ee44['name']===_0x919d('0x11')||_0x27ee44[_0x919d('0x12')]===_0x919d('0x13');});return{'rows':_0x478f06,'count':_0x478f06[_0x919d('0x14')]};}return null;})[_0x919d('0xf')](respondWithResult(_0x25d3ec,null))[_0x919d('0x15')](handleError(_0x25d3ec,null));};exports[_0x919d('0x16')]=function(_0x1dbe96,_0x5ae515){return pm2[_0x919d('0x17')](_0x1dbe96[_0x919d('0x18')]['id'])[_0x919d('0xf')](respondWithResult(_0x5ae515,null))[_0x919d('0xf')](handleEntityNotFound(_0x5ae515,null))[_0x919d('0x15')](handleError(_0x5ae515,null));};exports[_0x919d('0x19')]=function(_0x4768a7,_0x2eb8fd){if(_0x4768a7[_0x919d('0x1a')][_0x919d('0x12')]&&_0x4768a7[_0x919d('0x1a')][_0x919d('0x1b')]){var _0x53ecf3=path[_0x919d('0x1c')](__dirname,_0x919d('0x1d'),_0x4768a7[_0x919d('0x1a')][_0x919d('0x1b')]);var _0x1bd69b=process[_0x919d('0x1e')]();process[_0x919d('0x1f')](path[_0x919d('0x20')](_0x53ecf3));return execChildProcess()[_0x919d('0xf')](function(_0xc1bb6e){process['chdir'](_0x1bd69b);return pm2[_0x919d('0x21')]({'name':_0x4768a7[_0x919d('0x1a')][_0x919d('0x12')],'script':_0x53ecf3});})[_0x919d('0xf')](function(_0x3ab782){pm2['dump']();return _0x3ab782[0x0];})['then'](respondWithResult(_0x2eb8fd,0xc9))[_0x919d('0x15')](handleError(_0x2eb8fd,null));}else{return _0x2eb8fd[_0x919d('0xa')](0x1f4)['send']({'message':_0x919d('0x22')});}};exports[_0x919d('0x23')]=function(_0x29a6d8,_0x2e440c){if(_0x29a6d8[_0x919d('0x1a')]['id']){delete _0x29a6d8[_0x919d('0x1a')]['id'];}var _0x589ed8={'online':_0x919d('0x24'),'stopped':_0x919d('0x25')};if(_0x589ed8[_0x919d('0x26')](_0x29a6d8[_0x919d('0x1a')][_0x919d('0xa')])){return pm2[_0x589ed8[_0x29a6d8[_0x919d('0x1a')]['status']]](_0x29a6d8[_0x919d('0x18')]['id'])[_0x919d('0xf')](respondWithResult(_0x2e440c,0xc8))[_0x919d('0x15')](handleError(_0x2e440c,null));}else{return _0x2e440c[_0x919d('0xa')](0x1f4)[_0x919d('0xb')]({'message':_0x919d('0x27')});}};exports[_0x919d('0x28')]=function(_0x30537f,_0x4458e1){if(_0x30537f[_0x919d('0x1a')]['id']){delete _0x30537f[_0x919d('0x1a')]['id'];}if(_0x30537f['params']['id']){return pm2[_0x919d('0x29')](_0x30537f[_0x919d('0x18')]['id'])['then'](function(_0x25c39e){pm2['dump']();return _0x25c39e[0x0];})[_0x919d('0xf')](respondWithResult(_0x4458e1,null))[_0x919d('0x15')](handleError(_0x4458e1,null));}else{return _0x4458e1[_0x919d('0xa')](0x1f4)[_0x919d('0xb')]({'message':_0x919d('0x2a')});}}; \ No newline at end of file +var _0xaa64=['api','child_process','bluebird','sendStatus','json','stack','name','status','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','update','restart','hasOwnProperty','destroy','delete','lodash','../../config/logger'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xaa64,0x166));var _0x4aa6=function(_0x4d6bcb,_0x3bc099){_0x4d6bcb=_0x4d6bcb-0x0;var _0x3bca33=_0xaa64[_0x4d6bcb];return _0x3bca33;};'use strict';var _=require(_0x4aa6('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x4aa6('0x1'))(_0x4aa6('0x2'));var path=require('path');var exec=require(_0x4aa6('0x3'))['exec'];var BPromise=require(_0x4aa6('0x4'));function handleEntityNotFound(_0x4af926,_0x313cfd){return function(_0x22a178){if(!_0x22a178){_0x4af926[_0x4aa6('0x5')](0x194);;}return _0x22a178;};}function respondWithResult(_0x3a5558,_0x62c07){_0x62c07=_0x62c07||0xc8;return function(_0x2f5d51){if(_0x2f5d51){return _0x3a5558['status'](_0x62c07)[_0x4aa6('0x6')](_0x2f5d51);}return null;};}function handleError(_0x152ba2,_0x3179ef){_0x3179ef=_0x3179ef||0x1f4;return function(_0x10c504){logger['error'](_0x10c504[_0x4aa6('0x7')]);if(_0x10c504[_0x4aa6('0x8')]){delete _0x10c504[_0x4aa6('0x8')];}_0x152ba2[_0x4aa6('0x9')](_0x3179ef)[_0x4aa6('0xa')](_0x10c504);};}function execChildProcess(){return new BPromise(function(_0x1ceae1,_0x3505fc){exec(_0x4aa6('0xb'),function(_0x4ef25e,_0x29ae54,_0x4a12f7){logger[_0x4aa6('0xc')](_0x29ae54);logger[_0x4aa6('0xc')](_0x4a12f7);if(_0x4ef25e){logger[_0x4aa6('0xd')](_0x4ef25e);return _0x3505fc(_0x4ef25e);}return _0x1ceae1(_0x29ae54);});});}exports['index']=function(_0xc5cdee,_0x14c89b){return pm2[_0x4aa6('0xe')]()[_0x4aa6('0xf')](function(_0x4ebbd5){if(_0x4ebbd5){var _0x1de7d7=_[_0x4aa6('0x10')](_0x4ebbd5,function(_0x357c19){return _0x357c19[_0x4aa6('0x8')]==='express'||_0x357c19[_0x4aa6('0x8')]==='motion2';});return{'rows':_0x1de7d7,'count':_0x1de7d7[_0x4aa6('0x11')]};}return null;})[_0x4aa6('0xf')](respondWithResult(_0x14c89b,null))[_0x4aa6('0x12')](handleError(_0x14c89b,null));};exports[_0x4aa6('0x13')]=function(_0x156fcf,_0x50ab84){return pm2[_0x4aa6('0x14')](_0x156fcf[_0x4aa6('0x15')]['id'])[_0x4aa6('0xf')](respondWithResult(_0x50ab84,null))['then'](handleEntityNotFound(_0x50ab84,null))['catch'](handleError(_0x50ab84,null));};exports[_0x4aa6('0x16')]=function(_0x298a0b,_0x3a90f3){if(_0x298a0b[_0x4aa6('0x17')]['name']&&_0x298a0b[_0x4aa6('0x17')][_0x4aa6('0x18')]){var _0x3a4111=path[_0x4aa6('0x19')](__dirname,_0x4aa6('0x1a'),_0x298a0b[_0x4aa6('0x17')]['script']);var _0x1067a1=process[_0x4aa6('0x1b')]();process[_0x4aa6('0x1c')](path['dirname'](_0x3a4111));return execChildProcess()[_0x4aa6('0xf')](function(_0x25af6b){process[_0x4aa6('0x1c')](_0x1067a1);return pm2[_0x4aa6('0x1d')]({'name':_0x298a0b[_0x4aa6('0x17')][_0x4aa6('0x8')],'script':_0x3a4111});})['then'](function(_0x4c6a1a){pm2[_0x4aa6('0x1e')]();return _0x4c6a1a[0x0];})['then'](respondWithResult(_0x3a90f3,0xc9))['catch'](handleError(_0x3a90f3,null));}else{return _0x3a90f3[_0x4aa6('0x9')](0x1f4)[_0x4aa6('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x4aa6('0x1f')]=function(_0x17f7de,_0x2c0e1d){if(_0x17f7de[_0x4aa6('0x17')]['id']){delete _0x17f7de[_0x4aa6('0x17')]['id'];}var _0xa63ad1={'online':_0x4aa6('0x20'),'stopped':'stop'};if(_0xa63ad1[_0x4aa6('0x21')](_0x17f7de[_0x4aa6('0x17')][_0x4aa6('0x9')])){return pm2[_0xa63ad1[_0x17f7de[_0x4aa6('0x17')][_0x4aa6('0x9')]]](_0x17f7de[_0x4aa6('0x15')]['id'])[_0x4aa6('0xf')](respondWithResult(_0x2c0e1d,0xc8))[_0x4aa6('0x12')](handleError(_0x2c0e1d,null));}else{return _0x2c0e1d[_0x4aa6('0x9')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x4aa6('0x22')]=function(_0x2909ba,_0x4a08ee){if(_0x2909ba[_0x4aa6('0x17')]['id']){delete _0x2909ba[_0x4aa6('0x17')]['id'];}if(_0x2909ba[_0x4aa6('0x15')]['id']){return pm2[_0x4aa6('0x23')](_0x2909ba[_0x4aa6('0x15')]['id'])[_0x4aa6('0xf')](function(_0x34f627){pm2[_0x4aa6('0x1e')]();return _0x34f627[0x0];})[_0x4aa6('0xf')](respondWithResult(_0x4a08ee,null))[_0x4aa6('0x12')](handleError(_0x4a08ee,null));}else{return _0x4a08ee[_0x4aa6('0x9')](0x1f4)[_0x4aa6('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cd5cfd0..25fb783 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 _0x14ea=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x14ea,0x189));var _0xa14e=function(_0x5e51d0,_0x4fc72b){_0x5e51d0=_0x5e51d0-0x0;var _0x14879c=_0x14ea[_0x5e51d0];return _0x14879c;};'use strict';var multer=require(_0xa14e('0x0'));var util=require(_0xa14e('0x1'));var path=require(_0xa14e('0x2'));var timeout=require(_0xa14e('0x3'));var express=require(_0xa14e('0x4'));var router=express[_0xa14e('0x5')]();var auth=require(_0xa14e('0x6'));var interaction=require(_0xa14e('0x7'));var config=require('../../config/environment');module[_0xa14e('0x8')]=router; \ No newline at end of file +var _0x29ea=['../../components/auth/service','exports','util','path','connect-timeout','express','Router'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x29ea,0x191));var _0xa29e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29ea[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xa29e('0x0'));var path=require(_0xa29e('0x1'));var timeout=require(_0xa29e('0x2'));var express=require(_0xa29e('0x3'));var router=express[_0xa29e('0x4')]();var auth=require(_0xa29e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xa29e('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5dba103..d2c1d1a 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 _0xf111=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x243db1,_0x5572f2){var _0x1713b6=function(_0x2b00ed){while(--_0x2b00ed){_0x243db1['push'](_0x243db1['shift']());}};_0x1713b6(++_0x5572f2);}(_0xf111,0x1e8));var _0x1f11=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xf111[_0x764874];return _0x29f9d5;};'use strict';var Sequelize=require(_0x1f11('0x0'));module[_0x1f11('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1f11('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x1f11('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1f11('0x3')]},'ringtime':{'type':Sequelize[_0x1f11('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1f11('0x2')]},'membername':{'type':Sequelize[_0x1f11('0x2')]}}; \ No newline at end of file +var _0xe481=['DATE','STRING','INTEGER'];(function(_0x24428e,_0x43f53f){var _0x3199d5=function(_0x4cc649){while(--_0x4cc649){_0x24428e['push'](_0x24428e['shift']());}};_0x3199d5(++_0x43f53f);}(_0xe481,0xd7));var _0x1e48=function(_0x4eb158,_0x2da8f8){_0x4eb158=_0x4eb158-0x0;var _0xc51455=_0xe481[_0x4eb158];return _0xc51455;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x1e48('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1e48('0x1')]},'uniqueid':{'type':Sequelize[_0x1e48('0x2')]},'starttime':{'type':Sequelize[_0x1e48('0x1')]},'responsetime':{'type':Sequelize[_0x1e48('0x1')]},'ringtime':{'type':Sequelize[_0x1e48('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1e48('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1e48('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 79647fa..95fe308 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 _0x29c7=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x32f69e,_0x39a1c2){var _0x46d616=function(_0x28971a){while(--_0x28971a){_0x32f69e['push'](_0x32f69e['shift']());}};_0x46d616(++_0x39a1c2);}(_0x29c7,0x71));var _0x729c=function(_0x501769,_0x400f3f){_0x501769=_0x501769-0x0;var _0x463880=_0x29c7[_0x501769];return _0x463880;};'use strict';var _=require(_0x729c('0x0'));var util=require(_0x729c('0x1'));var logger=require(_0x729c('0x2'))(_0x729c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x729c('0x4'));var fs=require('fs');var path=require(_0x729c('0x5'));var rimraf=require(_0x729c('0x6'));var config=require(_0x729c('0x7'));var attributes=require(_0x729c('0x8'));module['exports']=function(_0x44c6a8,_0x3965b5){return _0x44c6a8[_0x729c('0x9')](_0x729c('0xa'),attributes,{'tableName':_0x729c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb2=['request-promise','path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xbfb2,0xf9));var _0x2bfb=function(_0x36ab1f,_0x26dee1){_0x36ab1f=_0x36ab1f-0x0;var _0x126f65=_0xbfb2[_0x36ab1f];return _0x126f65;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2bfb('0x0'))(_0x2bfb('0x1'));var moment=require(_0x2bfb('0x2'));var BPromise=require(_0x2bfb('0x3'));var rp=require(_0x2bfb('0x4'));var fs=require('fs');var path=require(_0x2bfb('0x5'));var rimraf=require('rimraf');var config=require(_0x2bfb('0x6'));var attributes=require(_0x2bfb('0x7'));module['exports']=function(_0x381698,_0x1fda98){return _0x381698[_0x2bfb('0x8')](_0x2bfb('0x9'),attributes,{'tableName':_0x2bfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index f99d8a9..d34cc06 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 _0xd482=['http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd482,0xf1));var _0x2d48=function(_0x46aa04,_0xbace80){_0x46aa04=_0x46aa04-0x0;var _0x55cc0d=_0xd482[_0x46aa04];return _0x55cc0d;};'use strict';var _=require('lodash');var util=require(_0x2d48('0x0'));var moment=require(_0x2d48('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d48('0x2'));var db=require(_0x2d48('0x3'))['db'];var utils=require(_0x2d48('0x4'));var logger=require(_0x2d48('0x5'))(_0x2d48('0x6'));var config=require(_0x2d48('0x7'));var jayson=require(_0x2d48('0x8'));var client=jayson['client'][_0x2d48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38dd60,_0x13452a,_0x129d62){return new BPromise(function(_0x5ad1f8,_0x5b5aba){return client[_0x2d48('0xa')](_0x38dd60,_0x129d62)[_0x2d48('0xb')](function(_0x1fa822){logger[_0x2d48('0xc')](_0x2d48('0xd'),_0x13452a,_0x2d48('0xe'));logger[_0x2d48('0xf')](_0x2d48('0x10'),_0x13452a,_0x2d48('0xe'),JSON[_0x2d48('0x11')](_0x1fa822));if(_0x1fa822[_0x2d48('0x12')]){if(_0x1fa822[_0x2d48('0x12')]['code']===0x1f4){logger[_0x2d48('0x12')](_0x2d48('0xd'),_0x13452a,_0x1fa822[_0x2d48('0x12')][_0x2d48('0x13')]);return _0x5b5aba(_0x1fa822[_0x2d48('0x12')][_0x2d48('0x13')]);}logger[_0x2d48('0x12')](_0x2d48('0xd'),_0x13452a,_0x1fa822[_0x2d48('0x12')][_0x2d48('0x13')]);return _0x5ad1f8(_0x1fa822['error'][_0x2d48('0x13')]);}else{logger[_0x2d48('0xc')](_0x2d48('0xd'),_0x13452a,_0x2d48('0xe'));_0x5ad1f8(_0x1fa822['result']['message']);}})[_0x2d48('0x14')](function(_0x2df3ee){logger[_0x2d48('0x12')](_0x2d48('0xd'),_0x13452a,_0x2df3ee);_0x5b5aba(_0x2df3ee);});});}exports[_0x2d48('0x15')]=function(_0x53bfcb){var _0x148a23=this;return new Promise(function(_0x46585e,_0x448948){return db[_0x2d48('0x16')]['create'](_0x53bfcb[_0x2d48('0x17')],{'raw':_0x53bfcb[_0x2d48('0x18')]?_0x53bfcb[_0x2d48('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2d48('0xb')](function(_0x5bd1a8){logger['info'](_0x2d48('0x15'),_0x53bfcb);logger['debug'](_0x2d48('0x15'),_0x53bfcb,JSON['stringify'](_0x5bd1a8));_0x46585e(_0x5bd1a8);})[_0x2d48('0x14')](function(_0x2a96cd){logger[_0x2d48('0x12')](_0x2d48('0x15'),_0x2a96cd[_0x2d48('0x13')],_0x53bfcb);_0x448948(_0x148a23[_0x2d48('0x12')](0x1f4,_0x2a96cd[_0x2d48('0x13')]));});});}; \ No newline at end of file +var _0xdf42=['message','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2b55be,_0x56a9cd){var _0x178211=function(_0x1a63a0){while(--_0x1a63a0){_0x2b55be['push'](_0x2b55be['shift']());}};_0x178211(++_0x56a9cd);}(_0xdf42,0x1d8));var _0x2df4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xdf42[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x2df4('0x0'));var util=require(_0x2df4('0x1'));var moment=require(_0x2df4('0x2'));var BPromise=require('bluebird');var rs=require(_0x2df4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2df4('0x4'))['db'];var utils=require(_0x2df4('0x5'));var logger=require(_0x2df4('0x6'))(_0x2df4('0x7'));var config=require(_0x2df4('0x8'));var jayson=require(_0x2df4('0x9'));var client=jayson[_0x2df4('0xa')][_0x2df4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dcd8a,_0x19341d,_0x2882f0){return new BPromise(function(_0x683792,_0xb1dfbf){return client[_0x2df4('0xc')](_0x1dcd8a,_0x2882f0)[_0x2df4('0xd')](function(_0x48b6e8){logger[_0x2df4('0xe')](_0x2df4('0xf'),_0x19341d,_0x2df4('0x10'));logger[_0x2df4('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x19341d,_0x2df4('0x10'),JSON[_0x2df4('0x12')](_0x48b6e8));if(_0x48b6e8[_0x2df4('0x13')]){if(_0x48b6e8['error'][_0x2df4('0x14')]===0x1f4){logger[_0x2df4('0x13')](_0x2df4('0xf'),_0x19341d,_0x48b6e8['error'][_0x2df4('0x15')]);return _0xb1dfbf(_0x48b6e8[_0x2df4('0x13')][_0x2df4('0x15')]);}logger['error'](_0x2df4('0xf'),_0x19341d,_0x48b6e8[_0x2df4('0x13')][_0x2df4('0x15')]);return _0x683792(_0x48b6e8[_0x2df4('0x13')][_0x2df4('0x15')]);}else{logger[_0x2df4('0xe')](_0x2df4('0xf'),_0x19341d,_0x2df4('0x10'));_0x683792(_0x48b6e8[_0x2df4('0x16')][_0x2df4('0x15')]);}})[_0x2df4('0x17')](function(_0x494067){logger[_0x2df4('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x19341d,_0x494067);_0xb1dfbf(_0x494067);});});}exports['CreateReportAgentPreview']=function(_0x55df89){var _0x1dc2a9=this;return new Promise(function(_0xa197c0,_0x741255){return db[_0x2df4('0x18')][_0x2df4('0x19')](_0x55df89[_0x2df4('0x1a')],{'raw':_0x55df89[_0x2df4('0x1b')]?_0x55df89[_0x2df4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x2df4('0xd')](function(_0x29f3f9){logger['info']('CreateReportAgentPreview',_0x55df89);logger['debug'](_0x2df4('0x1c'),_0x55df89,JSON[_0x2df4('0x12')](_0x29f3f9));_0xa197c0(_0x29f3f9);})[_0x2df4('0x17')](function(_0x4a67e9){logger['error'](_0x2df4('0x1c'),_0x4a67e9['message'],_0x55df89);_0x741255(_0x1dc2a9[_0x2df4('0x13')](0x1f4,_0x4a67e9[_0x2df4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 630657b..c6aed55 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 _0x258c=['/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','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','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x258c,0x168));var _0xc258=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x258c[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xc258('0x0'));var path=require('path');var express=require(_0xc258('0x1'));var router=express[_0xc258('0x2')]();var auth=require(_0xc258('0x3'));var controller=require(_0xc258('0x4'));router['get'](_0xc258('0x5'),auth[_0xc258('0x6')](),controller[_0xc258('0x7')]);router[_0xc258('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xc258('0x6')](),controller[_0xc258('0x9')]);router['get'](_0xc258('0xa'),auth[_0xc258('0x6')](),controller[_0xc258('0xb')]);router[_0xc258('0x8')](_0xc258('0xc'),auth[_0xc258('0x6')](),controller[_0xc258('0xd')]);router[_0xc258('0x8')](_0xc258('0xe'),auth[_0xc258('0x6')](),controller['chatQueues']);router[_0xc258('0x8')]('/mail/queues',auth[_0xc258('0x6')](),controller[_0xc258('0xf')]);router[_0xc258('0x8')]('/mail/accounts',auth[_0xc258('0x6')](),controller[_0xc258('0x10')]);router[_0xc258('0x8')](_0xc258('0x11'),auth[_0xc258('0x6')](),controller[_0xc258('0x12')]);router[_0xc258('0x8')](_0xc258('0x13'),auth[_0xc258('0x6')](),controller[_0xc258('0x14')]);router[_0xc258('0x8')](_0xc258('0x15'),auth[_0xc258('0x6')](),controller[_0xc258('0x16')]);router[_0xc258('0x8')](_0xc258('0x17'),auth[_0xc258('0x6')](),controller[_0xc258('0x18')]);router[_0xc258('0x8')](_0xc258('0x19'),auth[_0xc258('0x6')](),controller[_0xc258('0x1a')]);router[_0xc258('0x8')](_0xc258('0x1b'),auth['isAuthenticated'](),controller[_0xc258('0x1c')]);router[_0xc258('0x8')](_0xc258('0x1d'),auth[_0xc258('0x6')](),controller[_0xc258('0x1e')]);router[_0xc258('0x8')](_0xc258('0x1f'),auth[_0xc258('0x6')](),controller[_0xc258('0x20')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xc258('0x6')](),controller[_0xc258('0x21')]);router['get'](_0xc258('0x22'),auth['isAuthenticated'](),controller[_0xc258('0x23')]);router[_0xc258('0x8')](_0xc258('0x24'),auth[_0xc258('0x6')](),controller[_0xc258('0x25')]);router['get']('/outbound/channels',auth[_0xc258('0x6')](),controller[_0xc258('0x26')]);router[_0xc258('0x8')](_0xc258('0x27'),auth[_0xc258('0x6')](),controller['agents']);router[_0xc258('0x28')](_0xc258('0x29'),auth['isAuthenticated'](),controller[_0xc258('0x2a')]);router['get'](_0xc258('0x2b'),auth[_0xc258('0x6')](),controller[_0xc258('0x2c')]);router[_0xc258('0x8')](_0xc258('0x2d'),auth[_0xc258('0x6')](),controller[_0xc258('0x2e')]);router['get'](_0xc258('0x2f'),auth[_0xc258('0x6')](),controller[_0xc258('0x30')]);router['get'](_0xc258('0x31'),auth[_0xc258('0x6')](),controller['faxAccounts']);router['get'](_0xc258('0x32'),auth[_0xc258('0x6')](),controller[_0xc258('0x33')]);router[_0xc258('0x8')](_0xc258('0x34'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xc258('0x8')](_0xc258('0x35'),auth[_0xc258('0x6')](),controller[_0xc258('0x36')]);router[_0xc258('0x8')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc258('0x37')]);router[_0xc258('0x8')](_0xc258('0x38'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0xc258('0x8')](_0xc258('0x39'),auth['isAuthenticated'](),controller[_0xc258('0x3a')]);router[_0xc258('0x3b')](_0xc258('0x3c'),auth[_0xc258('0x6')](),controller['queueNotify'](_0xc258('0x3d')));router[_0xc258('0x8')](_0xc258('0x3e'),auth[_0xc258('0x6')](),controller[_0xc258('0x3f')]);router['post'](_0xc258('0x40'),auth[_0xc258('0x6')](),controller[_0xc258('0x41')](_0xc258('0x42')));router['get'](_0xc258('0x43'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xc258('0x3b')](_0xc258('0x44'),auth[_0xc258('0x6')](),controller[_0xc258('0x41')](_0xc258('0x45')));router[_0xc258('0x8')](_0xc258('0x46'),auth[_0xc258('0x6')](),controller[_0xc258('0x47')]);router[_0xc258('0x3b')](_0xc258('0x48'),auth['isAuthenticated'](),controller[_0xc258('0x41')](_0xc258('0x49')));router[_0xc258('0x8')](_0xc258('0x4a'),auth[_0xc258('0x6')](),controller[_0xc258('0x4b')]);router['post'](_0xc258('0x4c'),auth[_0xc258('0x6')](),controller[_0xc258('0x41')]('sms'));router['post'](_0xc258('0x4d'),auth[_0xc258('0x6')](),controller[_0xc258('0x41')](_0xc258('0x4e')));router[_0xc258('0x8')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xc258('0x4f')]);router[_0xc258('0x8')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xc258('0x50')]);router['post'](_0xc258('0x51'),auth[_0xc258('0x6')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x7404=['outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels'];(function(_0x22e9a1,_0x1d3a53){var _0x5bff12=function(_0x2f353a){while(--_0x2f353a){_0x22e9a1['push'](_0x22e9a1['shift']());}};_0x5bff12(++_0x1d3a53);}(_0x7404,0x1c2));var _0x4740=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7404[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4740('0x0'));var util=require(_0x4740('0x1'));var path=require(_0x4740('0x2'));var express=require(_0x4740('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4740('0x4'));router[_0x4740('0x5')]('/voice/channels',auth[_0x4740('0x6')](),controller['voiceChannels']);router[_0x4740('0x5')](_0x4740('0x7'),auth[_0x4740('0x6')](),controller[_0x4740('0x8')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4740('0x6')](),controller[_0x4740('0x9')]);router[_0x4740('0x5')](_0x4740('0xa'),auth['isAuthenticated'](),controller[_0x4740('0xb')]);router[_0x4740('0x5')](_0x4740('0xc'),auth[_0x4740('0x6')](),controller[_0x4740('0xd')]);router['get'](_0x4740('0xe'),auth['isAuthenticated'](),controller[_0x4740('0xf')]);router[_0x4740('0x5')](_0x4740('0x10'),auth[_0x4740('0x6')](),controller[_0x4740('0x11')]);router[_0x4740('0x5')](_0x4740('0x12'),auth[_0x4740('0x6')](),controller[_0x4740('0x13')]);router[_0x4740('0x5')](_0x4740('0x14'),auth[_0x4740('0x6')](),controller['smsQueues']);router[_0x4740('0x5')](_0x4740('0x15'),auth[_0x4740('0x6')](),controller[_0x4740('0x16')]);router['get']('/fax/queues',auth[_0x4740('0x6')](),controller[_0x4740('0x17')]);router[_0x4740('0x5')](_0x4740('0x18'),auth[_0x4740('0x6')](),controller[_0x4740('0x19')]);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x4740('0x1a')]);router[_0x4740('0x5')](_0x4740('0x1b'),auth[_0x4740('0x6')](),controller['voiceQueuesChannel']);router[_0x4740('0x5')](_0x4740('0x1c'),auth[_0x4740('0x6')](),controller[_0x4740('0x1d')]);router[_0x4740('0x5')](_0x4740('0x1e'),auth[_0x4740('0x6')](),controller[_0x4740('0x1f')]);router[_0x4740('0x5')](_0x4740('0x20'),auth['isAuthenticated'](),controller[_0x4740('0x21')]);router[_0x4740('0x5')](_0x4740('0x22'),auth['isAuthenticated'](),controller['outbound']);router['get'](_0x4740('0x23'),auth['isAuthenticated'](),controller[_0x4740('0x24')]);router['get'](_0x4740('0x25'),auth[_0x4740('0x6')](),controller[_0x4740('0x26')]);router['put'](_0x4740('0x27'),auth[_0x4740('0x6')](),controller[_0x4740('0x28')]);router[_0x4740('0x5')](_0x4740('0x29'),auth[_0x4740('0x6')](),controller[_0x4740('0x2a')]);router[_0x4740('0x5')](_0x4740('0x2b'),auth[_0x4740('0x6')](),controller[_0x4740('0x2c')]);router[_0x4740('0x5')](_0x4740('0x2d'),auth[_0x4740('0x6')](),controller[_0x4740('0x2e')]);router['get'](_0x4740('0x2f'),auth[_0x4740('0x6')](),controller['faxAccounts']);router[_0x4740('0x5')](_0x4740('0x30'),auth[_0x4740('0x6')](),controller[_0x4740('0x31')]);router[_0x4740('0x5')](_0x4740('0x32'),auth[_0x4740('0x6')](),controller[_0x4740('0x33')]);router[_0x4740('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x4740('0x6')](),controller[_0x4740('0x34')]);router[_0x4740('0x5')](_0x4740('0x35'),auth[_0x4740('0x6')](),controller[_0x4740('0x36')]);router[_0x4740('0x5')](_0x4740('0x37'),auth[_0x4740('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x4740('0x5')](_0x4740('0x38'),auth[_0x4740('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x4740('0x39')](_0x4740('0x3a'),auth[_0x4740('0x6')](),controller[_0x4740('0x3b')](_0x4740('0x3c')));router[_0x4740('0x5')](_0x4740('0x3d'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x4740('0x39')](_0x4740('0x3e'),auth[_0x4740('0x6')](),controller[_0x4740('0x3b')]('chat'));router['get'](_0x4740('0x3f'),auth[_0x4740('0x6')](),controller[_0x4740('0x40')]);router['post'](_0x4740('0x41'),auth[_0x4740('0x6')](),controller['queueNotify']('fax'));router[_0x4740('0x5')](_0x4740('0x42'),auth[_0x4740('0x6')](),controller[_0x4740('0x43')]);router['post'](_0x4740('0x44'),auth['isAuthenticated'](),controller[_0x4740('0x3b')](_0x4740('0x45')));router[_0x4740('0x5')](_0x4740('0x46'),auth[_0x4740('0x6')](),controller[_0x4740('0x47')]);router[_0x4740('0x39')](_0x4740('0x48'),auth['isAuthenticated'](),controller[_0x4740('0x3b')](_0x4740('0x49')));router['post'](_0x4740('0x4a'),auth[_0x4740('0x6')](),controller[_0x4740('0x3b')](_0x4740('0x4b')));router[_0x4740('0x5')]('/sms/queues/:id',auth[_0x4740('0x6')](),controller[_0x4740('0x4c')]);router[_0x4740('0x5')](_0x4740('0x4d'),auth['isAuthenticated'](),controller[_0x4740('0x4e')]);router['post'](_0x4740('0x4f'),auth[_0x4740('0x6')](),controller[_0x4740('0x50')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index bf11e0b..e02b0fc 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 _0xddcf=['interaction','user','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','messageId','InteractionId','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','error','code','message','result','catch','status','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body'];(function(_0x6ffa12,_0x45a92a){var _0x17b047=function(_0x1bf1f6){while(--_0x1bf1f6){_0x6ffa12['push'](_0x6ffa12['shift']());}};_0x17b047(++_0x45a92a);}(_0xddcf,0x133));var _0xfddc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xddcf[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0xfddc('0x0'));var moment=require(_0xfddc('0x1'));var _=require(_0xfddc('0x2'));var util=require('util');var db=require(_0xfddc('0x3'))['db'];var logger=require(_0xfddc('0x4'))(_0xfddc('0x5'));var jayson=require(_0xfddc('0x6'));var amiClient=jayson['client'][_0xfddc('0x7')]({'port':0x232a});var mailClient=jayson[_0xfddc('0x8')][_0xfddc('0x7')]({'port':0x232b});var routingClient=jayson[_0xfddc('0x8')][_0xfddc('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x565165,_0x34ec19,_0x4c678e){return new BPromise(function(_0x2d7598,_0x28177f){var _0x2855d5=_0x4c678e?_0x4c678e:amiClient;return _0x2855d5[_0xfddc('0x9')](_0x565165,_0x34ec19)['then'](function(_0x299427){if(_0x299427[_0xfddc('0xa')]){if(_0x299427[_0xfddc('0xa')][_0xfddc('0xb')]===0x1f4){return _0x28177f(_0x299427[_0xfddc('0xa')]['message']);}return _0x2d7598(_0x299427[_0xfddc('0xa')][_0xfddc('0xc')]);}else{_0x2d7598(_0x299427[_0xfddc('0xd')]);}})[_0xfddc('0xe')](function(_0x1256aa){_0x28177f(_0x1256aa);});});}function respondWithResult(_0x5bc8ce,_0x4840df){_0x4840df=_0x4840df||0xc8;return function(_0xae2993){if(_0xae2993){return _0x5bc8ce[_0xfddc('0xf')](_0x4840df)['json'](_0xae2993);}return _0x5bc8ce[_0xfddc('0x10')](0x194);};}function handleError(_0x41b805,_0x3b70e8){_0x3b70e8=_0x3b70e8||0x1f4;return function(_0xcf0cc2){logger[_0xfddc('0xa')](_0xcf0cc2['stack']);if(_0xcf0cc2[_0xfddc('0x11')]){delete _0xcf0cc2[_0xfddc('0x11')];}_0x41b805[_0xfddc('0xf')](_0x3b70e8)[_0xfddc('0x12')](_0xcf0cc2);};}function findById(_0x50afb3){return function(_0x3a61af){if(!_[_0xfddc('0x13')](_0x50afb3)&&!_[_0xfddc('0x13')](_0x3a61af)&&!_[_0xfddc('0x13')](_0x3a61af[_0xfddc('0x14')])){return _['find'](_0x3a61af[_0xfddc('0x14')],function(_0x5e2798){return _0x5e2798['id']==_0x50afb3;});}return null;};}exports[_0xfddc('0x15')]=function(_0x69697e,_0x30bc64){return respondWithRpcPromise(_0xfddc('0x16'),_0x69697e[_0xfddc('0x17')])[_0xfddc('0x18')](respondWithResult(_0x30bc64,null))[_0xfddc('0xe')](handleError(_0x30bc64,null));};exports['voiceChannelMixMonitor']=function(_0x3d33a3,_0xbb2025){return respondWithRpcPromise(_0xfddc('0x19'),_[_0xfddc('0x1a')](_0x3d33a3[_0xfddc('0x17')],_0x3d33a3['params']))['then'](respondWithResult(_0xbb2025,null))[_0xfddc('0xe')](handleError(_0xbb2025,null));};exports[_0xfddc('0x1b')]=function(_0x25a880,_0x294616){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x25a880[_0xfddc('0x17')],_0x25a880[_0xfddc('0x1c')]))[_0xfddc('0x18')](respondWithResult(_0x294616,null))[_0xfddc('0xe')](handleError(_0x294616,null));};exports[_0xfddc('0x1d')]=function(_0x33d765,_0x3af83f){return respondWithRpcPromise(_0xfddc('0x1e'),_0x33d765['query'])[_0xfddc('0x18')](respondWithResult(_0x3af83f,null))[_0xfddc('0xe')](handleError(_0x3af83f,null));};exports[_0xfddc('0x1f')]=function(_0x211a26,_0x4d8bee){return respondWithRpcPromise(_0xfddc('0x1e'),_0x211a26[_0xfddc('0x17')])[_0xfddc('0x18')](findById(_0x211a26['params']['id']))[_0xfddc('0x18')](respondWithResult(_0x4d8bee,null))[_0xfddc('0xe')](handleError(_0x4d8bee,null));};exports[_0xfddc('0x20')]=function(_0x1a0073,_0x2c73ce){return respondWithRpcPromise(_0xfddc('0x21'),_[_0xfddc('0x1a')](_0x1a0073[_0xfddc('0x17')],_0x1a0073[_0xfddc('0x1c')]))[_0xfddc('0x18')](respondWithResult(_0x2c73ce,null))[_0xfddc('0xe')](handleError(_0x2c73ce,null));};exports[_0xfddc('0x22')]=function(_0x14f15c,_0x1be6e5){return respondWithRpcPromise('VoiceQueuesChannels',_0x14f15c['query'])[_0xfddc('0x18')](respondWithResult(_0x1be6e5,null))[_0xfddc('0xe')](handleError(_0x1be6e5,null));};exports[_0xfddc('0x23')]=function(_0x20e7f8,_0x56132e){return respondWithRpcPromise(_0xfddc('0x24'),_[_0xfddc('0x1a')](_0x20e7f8[_0xfddc('0x17')],_0x20e7f8[_0xfddc('0x1c')]))[_0xfddc('0x18')](respondWithResult(_0x56132e,null))[_0xfddc('0xe')](handleError(_0x56132e,null));};exports[_0xfddc('0x25')]=function(_0x31ddd9,_0x552956){return respondWithRpcPromise(_0xfddc('0x26'),_[_0xfddc('0x1a')](_0x31ddd9['query'],_0x31ddd9['params']))[_0xfddc('0x18')](respondWithResult(_0x552956,null))['catch'](handleError(_0x552956,null));};exports[_0xfddc('0x27')]=function(_0x1a1c47,_0x5e5321){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xfddc('0x1a')](_0x1a1c47[_0xfddc('0x17')],_0x1a1c47[_0xfddc('0x1c')]))['then'](respondWithResult(_0x5e5321,null))[_0xfddc('0xe')](handleError(_0x5e5321,null));};exports[_0xfddc('0x28')]=function(_0x2de143,_0x5c0d36){return respondWithRpcPromise(_0xfddc('0x29'),_0x2de143[_0xfddc('0x17')])['then'](respondWithResult(_0x5c0d36,null))[_0xfddc('0xe')](handleError(_0x5c0d36,null));};exports[_0xfddc('0x2a')]=function(_0x49f720,_0x4cd349){return respondWithRpcPromise(_0xfddc('0x2b'),_0x49f720[_0xfddc('0x17')])[_0xfddc('0x18')](respondWithResult(_0x4cd349,null))[_0xfddc('0xe')](handleError(_0x4cd349,null));};exports[_0xfddc('0x2c')]=function(_0x1dd2c2,_0x214209){var _0x2716fe;return respondWithRpcPromise(_0xfddc('0x2d'),_0x1dd2c2['query'])[_0xfddc('0x18')](function(_0x47e559){_0x2716fe=_0x47e559;return respondWithRpcPromise(_0xfddc('0x2d'),_0x1dd2c2['query'],routingClient);})[_0xfddc('0x18')](function(_0x32470e){return _[_0xfddc('0x1a')]({},_0x32470e,_0x2716fe);})[_0xfddc('0x18')](respondWithResult(_0x214209,null))[_0xfddc('0xe')](handleError(_0x214209,null));};exports['agentCapacity']=function(_0x433010,_0x249a28){if(_0x433010[_0xfddc('0x2e')]&&_0x433010['body'][_0xfddc('0x2f')]&&_0x433010['user']&&_0x433010[_0xfddc('0x30')][_0xfddc('0x11')]){for(var _0x4ad04e in _0x433010['body'][_0xfddc('0x2f')]){if(_0x433010[_0xfddc('0x2e')][_0xfddc('0x2f')]['hasOwnProperty'](_0x4ad04e)){db['MemberReport'][_0xfddc('0x31')]({'where':{'channel':_0x4ad04e,'membername':_0x433010[_0xfddc('0x30')][_0xfddc('0x11')],'type':_0xfddc('0x32'),'exitAt':null,'uniqueid':_0x433010[_0xfddc('0x2e')]['interaction'][_0x4ad04e]&&_0x433010[_0xfddc('0x2e')][_0xfddc('0x2f')][_0x4ad04e][_0xfddc('0x33')]?{'$notIn':_0x433010['body'][_0xfddc('0x2f')][_0x4ad04e]}:{'$ne':null}}})[_0xfddc('0x18')](function(_0xfe74f5){var _0x1de4bc=moment()[_0xfddc('0x34')](_0xfddc('0x35'));for(var _0x4ec85d=0x0,_0x259154=_0xfe74f5['length'];_0x4ec85d<_0x259154;_0x4ec85d+=0x1){_0xfe74f5[_0x4ec85d]['updateAttributes']({'exitAt':_0x1de4bc});}});for(var _0xaac932=0x0;_0xaac932<_0x433010['body'][_0xfddc('0x2f')][_0x4ad04e]['length'];_0xaac932+=0x1){db[_0xfddc('0x36')]['findOrCreate']({'where':{'channel':_0x4ad04e,'membername':_0x433010['user'][_0xfddc('0x11')],'type':'INTERACTION','uniqueid':_0x433010[_0xfddc('0x2e')][_0xfddc('0x2f')][_0x4ad04e][_0xaac932],'exitAt':null},'defaults':{'channel':_0x4ad04e,'membername':_0x433010['user'][_0xfddc('0x11')],'interface':_['isNil'](_0x433010['user'][_0xfddc('0x37')])?util[_0xfddc('0x34')](_0xfddc('0x38'),_0x433010[_0xfddc('0x30')][_0xfddc('0x11')]):_0x433010[_0xfddc('0x30')][_0xfddc('0x37')],'type':_0xfddc('0x32'),'enterAt':moment()['format'](_0xfddc('0x35')),'role':_0xfddc('0x39'),'internal':_0x433010[_0xfddc('0x30')][_0xfddc('0x3a')],'uniqueid':_0x433010[_0xfddc('0x2e')]['interaction'][_0x4ad04e][_0xaac932]}});}}}}return respondWithRpcPromise(_0xfddc('0x3b'),{'id':_0x433010['params']['id'],'capacity':_0x433010[_0xfddc('0x2e')][_0xfddc('0x3c')]},routingClient)[_0xfddc('0x18')](respondWithResult(_0x249a28,null))['catch'](handleError(_0x249a28,null));};exports[_0xfddc('0x3d')]=function(_0x23e7f9,_0x40e3ab){return respondWithRpcPromise(_0xfddc('0x3e'),_0x23e7f9['query'])[_0xfddc('0x18')](respondWithResult(_0x40e3ab,null))['catch'](handleError(_0x40e3ab,null));};exports[_0xfddc('0x3f')]=function(_0x485160,_0x1bf682){return respondWithRpcPromise(_0xfddc('0x40'),_0x485160[_0xfddc('0x17')])[_0xfddc('0x18')](respondWithResult(_0x1bf682,null))[_0xfddc('0xe')](handleError(_0x1bf682,null));};exports[_0xfddc('0x41')]=function(_0x32d930,_0x23183e){return respondWithRpcPromise(_0xfddc('0x42'),_0x32d930[_0xfddc('0x17')])[_0xfddc('0x18')](respondWithResult(_0x23183e,null))[_0xfddc('0xe')](handleError(_0x23183e,null));};exports[_0xfddc('0x43')]=function(_0x4391f5,_0x3ef4a3){return respondWithRpcPromise(_0xfddc('0x44'),_0x4391f5[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x3ef4a3,null))[_0xfddc('0xe')](handleError(_0x3ef4a3,null));};exports['showChatQueues']=function(_0x5b0776,_0x186dba){return respondWithRpcPromise(_0xfddc('0x44'),_0x5b0776[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](findById(_0x5b0776[_0xfddc('0x1c')]['id']))['then'](respondWithResult(_0x186dba,null))['catch'](handleError(_0x186dba,null));};exports[_0xfddc('0x45')]=function(_0x9b268,_0x2f3f18){return respondWithRpcPromise(_0xfddc('0x46'),_0x9b268['query'],routingClient)['then'](respondWithResult(_0x2f3f18,null))[_0xfddc('0xe')](handleError(_0x2f3f18,null));};exports[_0xfddc('0x47')]=function(_0x3fc6be,_0x1bb48d){return respondWithRpcPromise(_0xfddc('0x46'),_0x3fc6be[_0xfddc('0x17')],routingClient)['then'](findById(_0x3fc6be[_0xfddc('0x1c')]['id']))[_0xfddc('0x18')](respondWithResult(_0x1bb48d,null))[_0xfddc('0xe')](handleError(_0x1bb48d,null));};exports['mailAccounts']=function(_0x3d8b74,_0x5a30a0){return respondWithRpcPromise(_0xfddc('0x48'),_0x3d8b74['query'],mailClient)[_0xfddc('0x18')](respondWithResult(_0x5a30a0,null))[_0xfddc('0xe')](handleError(_0x5a30a0,null));};exports[_0xfddc('0x49')]=function(_0x340812,_0x504164){return respondWithRpcPromise(_0xfddc('0x4a'),_0x340812[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x504164,null))[_0xfddc('0xe')](handleError(_0x504164,null));};exports[_0xfddc('0x4b')]=function(_0x1df2f1,_0x2cbdad){return respondWithRpcPromise('OpenchannelQueues',_0x1df2f1[_0xfddc('0x17')],routingClient)['then'](findById(_0x1df2f1[_0xfddc('0x1c')]['id']))[_0xfddc('0x18')](respondWithResult(_0x2cbdad,null))['catch'](handleError(_0x2cbdad,null));};exports[_0xfddc('0x4c')]=function(_0x58ecc1,_0x79b4c7){return respondWithRpcPromise(_0xfddc('0x4d'),_0x58ecc1['query'],routingClient)[_0xfddc('0x18')](respondWithResult(_0x79b4c7,null))[_0xfddc('0xe')](handleError(_0x79b4c7,null));};exports[_0xfddc('0x4e')]=function(_0xd482c,_0x23bb29){return respondWithRpcPromise('SmsQueues',_0xd482c['query'],routingClient)[_0xfddc('0x18')](findById(_0xd482c[_0xfddc('0x1c')]['id']))[_0xfddc('0x18')](respondWithResult(_0x23bb29,null))[_0xfddc('0xe')](handleError(_0x23bb29,null));};exports[_0xfddc('0x4f')]=function(_0x414030,_0x303be6){return respondWithRpcPromise(_0xfddc('0x50'),_0x414030[_0xfddc('0x17')],routingClient)['then'](respondWithResult(_0x303be6,null))[_0xfddc('0xe')](handleError(_0x303be6,null));};exports['showWhatsappQueues']=function(_0x415dac,_0x10b5bc){return respondWithRpcPromise('WhatsappQueues',_0x415dac[_0xfddc('0x17')],routingClient)['then'](findById(_0x415dac[_0xfddc('0x1c')]['id']))['then'](respondWithResult(_0x10b5bc,null))[_0xfddc('0xe')](handleError(_0x10b5bc,null));};exports[_0xfddc('0x51')]=function(_0x59d1bc,_0x259119){return respondWithRpcPromise(_0xfddc('0x52'),_0x59d1bc['query'],routingClient)[_0xfddc('0x18')](respondWithResult(_0x259119,null))[_0xfddc('0xe')](handleError(_0x259119,null));};exports[_0xfddc('0x53')]=function(_0x4ecf9c,_0x4e6606){return respondWithRpcPromise('FaxQueues',_0x4ecf9c[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](findById(_0x4ecf9c['params']['id']))[_0xfddc('0x18')](respondWithResult(_0x4e6606,null))[_0xfddc('0xe')](handleError(_0x4e6606,null));};exports[_0xfddc('0x54')]=function(_0x47b378,_0x1a0e2a){return respondWithRpcPromise('FaxAccounts',_0x47b378[_0xfddc('0x17')])[_0xfddc('0x18')](respondWithResult(_0x1a0e2a,null))[_0xfddc('0xe')](handleError(_0x1a0e2a,null));};exports[_0xfddc('0x55')]=function(_0x5e1193,_0x10f78f){return respondWithRpcPromise(_0xfddc('0x56'),_0x5e1193[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x10f78f,null))[_0xfddc('0xe')](handleError(_0x10f78f,null));};exports[_0xfddc('0x57')]=function(_0x45ad1e,_0x3cea71){return respondWithRpcPromise(_0xfddc('0x58'),_0x45ad1e[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x3cea71,null))[_0xfddc('0xe')](handleError(_0x3cea71,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1280fb,_0xccc793){return respondWithRpcPromise(_0xfddc('0x59'),_0x1280fb[_0xfddc('0x17')],routingClient)['then'](respondWithResult(_0xccc793,null))[_0xfddc('0xe')](handleError(_0xccc793,null));};exports[_0xfddc('0x5a')]=function(_0x5420da,_0x85d535){return respondWithRpcPromise(_0xfddc('0x5b'),_0x5420da[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x85d535,null))['catch'](handleError(_0x85d535,null));};exports[_0xfddc('0x5c')]=function(_0x100020,_0x55089c){return respondWithRpcPromise(_0xfddc('0x5d'),_0x100020[_0xfddc('0x17')],routingClient)[_0xfddc('0x18')](respondWithResult(_0x55089c,null))[_0xfddc('0xe')](handleError(_0x55089c,null));};exports[_0xfddc('0x5e')]=function(_0x4f66e8,_0x892bb2){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4f66e8['query'],routingClient)[_0xfddc('0x18')](respondWithResult(_0x892bb2,null))[_0xfddc('0xe')](handleError(_0x892bb2,null));};exports[_0xfddc('0x5f')]=function(_0x416f00){return function(_0x3b9866,_0x247baf){var _0x28ce37,_0x269f2c;var _0x49f591=_['capitalize'](_0x416f00);var _0x2d885d=_0x416f00===_0xfddc('0x60')?_0xfddc('0x61'):_0xfddc('0x62');return db[_0x49f591+'Queue'][_0xfddc('0x63')]({'raw':!![],'where':{'id':_0x3b9866[_0xfddc('0x1c')]['id']}})['then'](function(_0x414b31){if(_[_0xfddc('0x13')](_0x414b31)){throw new Error(_0x49f591+_0xfddc('0x64'));}_0x28ce37=_0x414b31;return db[_0x49f591+'Message'][_0xfddc('0x63')]({'where':{'id':_0x3b9866['body']['messageId']},'include':[{'model':db[_0x49f591+_0xfddc('0x65')],'as':_0xfddc('0x65')},{'model':db[_0x49f591+_0x2d885d],'as':'Account'}]});})[_0xfddc('0x18')](function(_0x1d23ad){if(_[_0xfddc('0x13')](_0x1d23ad)){throw new Error(_0x49f591+_0xfddc('0x66'));}_0x269f2c=_0x1d23ad;return _0x1d23ad[_0xfddc('0x67')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1e53a7={'uniqueid':_0x416f00+'.'+_0x269f2c['id']+'.'+_0x269f2c[_0xfddc('0x65')]['id'],'FromUserId':_0x3b9866[_0xfddc('0x30')]['id'],'type':_0xfddc('0x68')};_0x1e53a7[_0x49f591+_0xfddc('0x69')]=_0x269f2c['id'];_0x1e53a7[_0x49f591+'InteractionId']=_0x269f2c[_0xfddc('0x65')]['id'];_0x1e53a7[_0xfddc('0x6a')+_0x49f591+_0x2d885d+'Id']=_0x269f2c[_0xfddc('0x62')]['id'];_0x1e53a7['To'+_0x49f591+_0xfddc('0x6b')]=_0x28ce37['id'];return db[_0x49f591+'TransferReport'][_0xfddc('0x6c')](_0x1e53a7);})[_0xfddc('0x18')](function(){return respondWithRpcPromise(_0xfddc('0x6d'),{'channel':_0x416f00,'interaction':_0x269f2c[_0xfddc('0x65')],'message':_0x269f2c,'account':_0x269f2c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xfddc('0x68'),'appdata':_0x28ce37['name']+','+(_0x269f2c[_0xfddc('0x62')][_0xfddc('0x6e')]||0x12c),'interval':_0xfddc('0x6f')}]},routingClient);})[_0xfddc('0x18')](respondWithResult(_0x247baf,null))[_0xfddc('0xe')](handleError(_0x247baf,null));};};exports[_0xfddc('0x70')]=function(_0x3bc47,_0x24df91){var _0x3b54e2,_0x3aef33;if(_[_0xfddc('0x13')](_0x3bc47[_0xfddc('0x2e')][_0xfddc('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4eb30e=_0x3bc47['body'][_0xfddc('0x71')];var _0x308786=_['capitalize'](_0x4eb30e);var _0x222a39=_0x4eb30e===_0xfddc('0x60')?_0xfddc('0x61'):_0xfddc('0x62');return db[_0xfddc('0x72')][_0xfddc('0x63')]({'raw':!![],'where':{'id':_0x3bc47['params']['id'],'role':'agent'}})[_0xfddc('0x18')](function(_0x5b5491){if(_['isNil'](_0x5b5491)){throw new Error('Agent\x20not\x20found');}_0x3b54e2=_0x5b5491;return db[_0x308786+'Message']['findOne']({'where':{'id':_0x3bc47[_0xfddc('0x2e')][_0xfddc('0x73')]},'include':[{'model':db[_0x308786+_0xfddc('0x65')],'as':'Interaction'},{'model':db[_0x308786+_0x222a39],'as':_0xfddc('0x62')}]});})[_0xfddc('0x18')](function(_0x594f73){if(_[_0xfddc('0x13')](_0x594f73)){throw new Error(_0x308786+_0xfddc('0x66'));}_0x3aef33=_0x594f73;return _0x594f73[_0xfddc('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfddc('0x18')](function(){var _0x9bf21a={'uniqueid':_0x4eb30e+'.'+_0x3aef33['id']+'.'+_0x3aef33[_0xfddc('0x65')]['id'],'FromUserId':_0x3bc47[_0xfddc('0x30')]['id'],'type':'queue','ToUserId':_0x3b54e2['id']};_0x9bf21a[_0x308786+_0xfddc('0x69')]=_0x3aef33['id'];_0x9bf21a[_0x308786+_0xfddc('0x74')]=_0x3aef33[_0xfddc('0x65')]['id'];_0x9bf21a[_0xfddc('0x6a')+_0x308786+_0x222a39+'Id']=_0x3aef33[_0xfddc('0x62')]['id'];return db[_0x308786+'TransferReport']['create'](_0x9bf21a);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4eb30e,'interaction':_0x3aef33[_0xfddc('0x65')],'message':_0x3aef33,'account':_0x3aef33['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xfddc('0x39'),'appdata':_0x3b54e2['name']+','+(_0x3aef33[_0xfddc('0x62')][_0xfddc('0x75')]||0x12c),'interval':_0xfddc('0x6f')}]},routingClient);})[_0xfddc('0x18')](respondWithResult(_0x24df91,null))[_0xfddc('0xe')](handleError(_0x24df91,null));}; \ No newline at end of file +var _0x8e3b=['showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','create','queue','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','TransferReport','Start','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','catch','status','json','sendStatus','send','isNil','find','rows','VoiceChannels','query','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','format','SIP/%s','interface','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues'];(function(_0x4c139d,_0xf5e7bf){var _0x5d7bb1=function(_0x2ddf30){while(--_0x2ddf30){_0x4c139d['push'](_0x4c139d['shift']());}};_0x5d7bb1(++_0xf5e7bf);}(_0x8e3b,0xaa));var _0xb8e3=function(_0x5a7282,_0xa6e195){_0x5a7282=_0x5a7282-0x0;var _0x4928ec=_0x8e3b[_0x5a7282];return _0x4928ec;};'use strict';var BPromise=require(_0xb8e3('0x0'));var moment=require(_0xb8e3('0x1'));var _=require(_0xb8e3('0x2'));var util=require(_0xb8e3('0x3'));var db=require(_0xb8e3('0x4'))['db'];var logger=require(_0xb8e3('0x5'))(_0xb8e3('0x6'));var jayson=require(_0xb8e3('0x7'));var amiClient=jayson['client'][_0xb8e3('0x8')]({'port':0x232a});var mailClient=jayson[_0xb8e3('0x9')][_0xb8e3('0x8')]({'port':0x232b});var routingClient=jayson[_0xb8e3('0x9')][_0xb8e3('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x59badb,_0x127f31,_0x2e7af0){return new BPromise(function(_0x3bb305,_0x557b54){var _0x255811=_0x2e7af0?_0x2e7af0:amiClient;return _0x255811[_0xb8e3('0xa')](_0x59badb,_0x127f31)[_0xb8e3('0xb')](function(_0x5adb16){if(_0x5adb16[_0xb8e3('0xc')]){if(_0x5adb16[_0xb8e3('0xc')][_0xb8e3('0xd')]===0x1f4){return _0x557b54(_0x5adb16[_0xb8e3('0xc')]['message']);}return _0x3bb305(_0x5adb16[_0xb8e3('0xc')]['message']);}else{_0x3bb305(_0x5adb16['result']);}})[_0xb8e3('0xe')](function(_0x4c18b8){_0x557b54(_0x4c18b8);});});}function respondWithResult(_0x144a57,_0x479d31){_0x479d31=_0x479d31||0xc8;return function(_0x2ea5e7){if(_0x2ea5e7){return _0x144a57[_0xb8e3('0xf')](_0x479d31)[_0xb8e3('0x10')](_0x2ea5e7);}return _0x144a57[_0xb8e3('0x11')](0x194);};}function handleError(_0x5c4f8a,_0x289153){_0x289153=_0x289153||0x1f4;return function(_0x557837){logger['error'](_0x557837['stack']);if(_0x557837['name']){delete _0x557837['name'];}_0x5c4f8a[_0xb8e3('0xf')](_0x289153)[_0xb8e3('0x12')](_0x557837);};}function findById(_0x3f778b){return function(_0xb45379){if(!_[_0xb8e3('0x13')](_0x3f778b)&&!_['isNil'](_0xb45379)&&!_[_0xb8e3('0x13')](_0xb45379['rows'])){return _[_0xb8e3('0x14')](_0xb45379[_0xb8e3('0x15')],function(_0x2957aa){return _0x2957aa['id']==_0x3f778b;});}return null;};}exports['voiceChannels']=function(_0x3e6ab2,_0x26ae2f){return respondWithRpcPromise(_0xb8e3('0x16'),_0x3e6ab2[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0x26ae2f,null))[_0xb8e3('0xe')](handleError(_0x26ae2f,null));};exports['voiceChannelMixMonitor']=function(_0x8a9c20,_0x1607eb){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb8e3('0x18')](_0x8a9c20[_0xb8e3('0x17')],_0x8a9c20[_0xb8e3('0x19')]))['then'](respondWithResult(_0x1607eb,null))[_0xb8e3('0xe')](handleError(_0x1607eb,null));};exports[_0xb8e3('0x1a')]=function(_0x5afd8a,_0x54ea94){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xb8e3('0x18')](_0x5afd8a[_0xb8e3('0x17')],_0x5afd8a[_0xb8e3('0x19')]))[_0xb8e3('0xb')](respondWithResult(_0x54ea94,null))[_0xb8e3('0xe')](handleError(_0x54ea94,null));};exports[_0xb8e3('0x1b')]=function(_0x3973e5,_0x12f5d1){return respondWithRpcPromise(_0xb8e3('0x1c'),_0x3973e5[_0xb8e3('0x17')])['then'](respondWithResult(_0x12f5d1,null))['catch'](handleError(_0x12f5d1,null));};exports[_0xb8e3('0x1d')]=function(_0x23dc82,_0x514d52){return respondWithRpcPromise(_0xb8e3('0x1c'),_0x23dc82[_0xb8e3('0x17')])[_0xb8e3('0xb')](findById(_0x23dc82[_0xb8e3('0x19')]['id']))[_0xb8e3('0xb')](respondWithResult(_0x514d52,null))[_0xb8e3('0xe')](handleError(_0x514d52,null));};exports['voiceQueuesPreview']=function(_0x127d9e,_0x155045){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xb8e3('0x18')](_0x127d9e[_0xb8e3('0x17')],_0x127d9e[_0xb8e3('0x19')]))['then'](respondWithResult(_0x155045,null))['catch'](handleError(_0x155045,null));};exports[_0xb8e3('0x1e')]=function(_0x5aa3b3,_0x3cf970){return respondWithRpcPromise(_0xb8e3('0x1f'),_0x5aa3b3[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0x3cf970,null))[_0xb8e3('0xe')](handleError(_0x3cf970,null));};exports['voiceQueuesChannel']=function(_0x3c340f,_0x47393c){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xb8e3('0x18')](_0x3c340f[_0xb8e3('0x17')],_0x3c340f[_0xb8e3('0x19')]))[_0xb8e3('0xb')](respondWithResult(_0x47393c,null))[_0xb8e3('0xe')](handleError(_0x47393c,null));};exports[_0xb8e3('0x20')]=function(_0x373354,_0x2132cd){return respondWithRpcPromise(_0xb8e3('0x21'),_[_0xb8e3('0x18')](_0x373354[_0xb8e3('0x17')],_0x373354[_0xb8e3('0x19')]))[_0xb8e3('0xb')](respondWithResult(_0x2132cd,null))[_0xb8e3('0xe')](handleError(_0x2132cd,null));};exports[_0xb8e3('0x22')]=function(_0x399570,_0x9e0152){return respondWithRpcPromise(_0xb8e3('0x23'),_[_0xb8e3('0x18')](_0x399570[_0xb8e3('0x17')],_0x399570[_0xb8e3('0x19')]))[_0xb8e3('0xb')](respondWithResult(_0x9e0152,null))[_0xb8e3('0xe')](handleError(_0x9e0152,null));};exports[_0xb8e3('0x24')]=function(_0x172900,_0x3df720){return respondWithRpcPromise(_0xb8e3('0x25'),_0x172900[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0x3df720,null))[_0xb8e3('0xe')](handleError(_0x3df720,null));};exports[_0xb8e3('0x26')]=function(_0xeb868d,_0x188fdf){return respondWithRpcPromise(_0xb8e3('0x27'),_0xeb868d[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0x188fdf,null))[_0xb8e3('0xe')](handleError(_0x188fdf,null));};exports[_0xb8e3('0x28')]=function(_0xdd01b,_0x5e657b){var _0x4e4b7f;return respondWithRpcPromise(_0xb8e3('0x29'),_0xdd01b[_0xb8e3('0x17')])[_0xb8e3('0xb')](function(_0x14a762){_0x4e4b7f=_0x14a762;return respondWithRpcPromise(_0xb8e3('0x29'),_0xdd01b[_0xb8e3('0x17')],routingClient);})[_0xb8e3('0xb')](function(_0x22937b){return _[_0xb8e3('0x18')]({},_0x22937b,_0x4e4b7f);})['then'](respondWithResult(_0x5e657b,null))[_0xb8e3('0xe')](handleError(_0x5e657b,null));};exports['agentCapacity']=function(_0x3cabf0,_0x458e97){if(_0x3cabf0[_0xb8e3('0x2a')]&&_0x3cabf0[_0xb8e3('0x2a')][_0xb8e3('0x2b')]&&_0x3cabf0[_0xb8e3('0x2c')]&&_0x3cabf0[_0xb8e3('0x2c')][_0xb8e3('0x2d')]){for(var _0x5a25ab in _0x3cabf0['body']['interaction']){if(_0x3cabf0['body'][_0xb8e3('0x2b')][_0xb8e3('0x2e')](_0x5a25ab)){db[_0xb8e3('0x2f')][_0xb8e3('0x30')]({'where':{'channel':_0x5a25ab,'membername':_0x3cabf0['user'][_0xb8e3('0x2d')],'type':_0xb8e3('0x31'),'exitAt':null,'uniqueid':_0x3cabf0['body'][_0xb8e3('0x2b')][_0x5a25ab]&&_0x3cabf0['body'][_0xb8e3('0x2b')][_0x5a25ab][_0xb8e3('0x32')]?{'$notIn':_0x3cabf0[_0xb8e3('0x2a')][_0xb8e3('0x2b')][_0x5a25ab]}:{'$ne':null}}})[_0xb8e3('0xb')](function(_0x12669c){var _0x5c6b31=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4cbeb1=0x0,_0x3e2515=_0x12669c['length'];_0x4cbeb1<_0x3e2515;_0x4cbeb1+=0x1){_0x12669c[_0x4cbeb1][_0xb8e3('0x33')]({'exitAt':_0x5c6b31});}});for(var _0x1eb47c=0x0;_0x1eb47c<_0x3cabf0['body']['interaction'][_0x5a25ab][_0xb8e3('0x32')];_0x1eb47c+=0x1){db[_0xb8e3('0x2f')]['findOrCreate']({'where':{'channel':_0x5a25ab,'membername':_0x3cabf0[_0xb8e3('0x2c')][_0xb8e3('0x2d')],'type':_0xb8e3('0x31'),'uniqueid':_0x3cabf0['body'][_0xb8e3('0x2b')][_0x5a25ab][_0x1eb47c],'exitAt':null},'defaults':{'channel':_0x5a25ab,'membername':_0x3cabf0[_0xb8e3('0x2c')][_0xb8e3('0x2d')],'interface':_[_0xb8e3('0x13')](_0x3cabf0[_0xb8e3('0x2c')]['interface'])?util[_0xb8e3('0x34')](_0xb8e3('0x35'),_0x3cabf0[_0xb8e3('0x2c')][_0xb8e3('0x2d')]):_0x3cabf0[_0xb8e3('0x2c')][_0xb8e3('0x36')],'type':_0xb8e3('0x31'),'enterAt':moment()[_0xb8e3('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3cabf0[_0xb8e3('0x2c')]['internal'],'uniqueid':_0x3cabf0[_0xb8e3('0x2a')][_0xb8e3('0x2b')][_0x5a25ab][_0x1eb47c]}});}}}}return respondWithRpcPromise(_0xb8e3('0x37'),{'id':_0x3cabf0[_0xb8e3('0x19')]['id'],'capacity':_0x3cabf0['body'][_0xb8e3('0x38')]},routingClient)['then'](respondWithResult(_0x458e97,null))['catch'](handleError(_0x458e97,null));};exports[_0xb8e3('0x39')]=function(_0x4aff87,_0x539ef9){return respondWithRpcPromise(_0xb8e3('0x3a'),_0x4aff87['query'])['then'](respondWithResult(_0x539ef9,null))[_0xb8e3('0xe')](handleError(_0x539ef9,null));};exports[_0xb8e3('0x3b')]=function(_0x532b70,_0x365235){return respondWithRpcPromise(_0xb8e3('0x3c'),_0x532b70[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0x365235,null))[_0xb8e3('0xe')](handleError(_0x365235,null));};exports[_0xb8e3('0x3d')]=function(_0xd3bd35,_0x3e57ee){return respondWithRpcPromise(_0xb8e3('0x3e'),_0xd3bd35[_0xb8e3('0x17')])['then'](respondWithResult(_0x3e57ee,null))[_0xb8e3('0xe')](handleError(_0x3e57ee,null));};exports['chatQueues']=function(_0x2518b1,_0x2638e3){return respondWithRpcPromise(_0xb8e3('0x3f'),_0x2518b1[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x2638e3,null))[_0xb8e3('0xe')](handleError(_0x2638e3,null));};exports[_0xb8e3('0x40')]=function(_0x6afc71,_0xd8bfb2){return respondWithRpcPromise(_0xb8e3('0x3f'),_0x6afc71[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](findById(_0x6afc71[_0xb8e3('0x19')]['id']))['then'](respondWithResult(_0xd8bfb2,null))[_0xb8e3('0xe')](handleError(_0xd8bfb2,null));};exports[_0xb8e3('0x41')]=function(_0xeb194e,_0x559311){return respondWithRpcPromise(_0xb8e3('0x42'),_0xeb194e[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x559311,null))['catch'](handleError(_0x559311,null));};exports[_0xb8e3('0x43')]=function(_0x2ffbce,_0x39fecb){return respondWithRpcPromise('MailQueues',_0x2ffbce[_0xb8e3('0x17')],routingClient)['then'](findById(_0x2ffbce['params']['id']))[_0xb8e3('0xb')](respondWithResult(_0x39fecb,null))[_0xb8e3('0xe')](handleError(_0x39fecb,null));};exports[_0xb8e3('0x44')]=function(_0x4ceb0e,_0x540dae){return respondWithRpcPromise(_0xb8e3('0x45'),_0x4ceb0e[_0xb8e3('0x17')],mailClient)['then'](respondWithResult(_0x540dae,null))['catch'](handleError(_0x540dae,null));};exports[_0xb8e3('0x46')]=function(_0x3fb511,_0x17dfad){return respondWithRpcPromise(_0xb8e3('0x47'),_0x3fb511['query'],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x17dfad,null))[_0xb8e3('0xe')](handleError(_0x17dfad,null));};exports['showOpenchannelQueues']=function(_0x5b48eb,_0x54436f){return respondWithRpcPromise(_0xb8e3('0x47'),_0x5b48eb[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](findById(_0x5b48eb[_0xb8e3('0x19')]['id']))[_0xb8e3('0xb')](respondWithResult(_0x54436f,null))[_0xb8e3('0xe')](handleError(_0x54436f,null));};exports[_0xb8e3('0x48')]=function(_0x540d2b,_0x474588){return respondWithRpcPromise('SmsQueues',_0x540d2b[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x474588,null))[_0xb8e3('0xe')](handleError(_0x474588,null));};exports[_0xb8e3('0x49')]=function(_0xe126c1,_0x64cc76){return respondWithRpcPromise(_0xb8e3('0x4a'),_0xe126c1['query'],routingClient)[_0xb8e3('0xb')](findById(_0xe126c1[_0xb8e3('0x19')]['id']))[_0xb8e3('0xb')](respondWithResult(_0x64cc76,null))['catch'](handleError(_0x64cc76,null));};exports['whatsappQueues']=function(_0x20970d,_0xda893b){return respondWithRpcPromise(_0xb8e3('0x4b'),_0x20970d['query'],routingClient)[_0xb8e3('0xb')](respondWithResult(_0xda893b,null))['catch'](handleError(_0xda893b,null));};exports[_0xb8e3('0x4c')]=function(_0xb7a061,_0x4b6955){return respondWithRpcPromise(_0xb8e3('0x4b'),_0xb7a061['query'],routingClient)[_0xb8e3('0xb')](findById(_0xb7a061['params']['id']))[_0xb8e3('0xb')](respondWithResult(_0x4b6955,null))['catch'](handleError(_0x4b6955,null));};exports[_0xb8e3('0x4d')]=function(_0x18124a,_0x3bd692){return respondWithRpcPromise(_0xb8e3('0x4e'),_0x18124a['query'],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x3bd692,null))[_0xb8e3('0xe')](handleError(_0x3bd692,null));};exports[_0xb8e3('0x4f')]=function(_0xa7aa9f,_0x1d821d){return respondWithRpcPromise(_0xb8e3('0x4e'),_0xa7aa9f[_0xb8e3('0x17')],routingClient)['then'](findById(_0xa7aa9f[_0xb8e3('0x19')]['id']))[_0xb8e3('0xb')](respondWithResult(_0x1d821d,null))['catch'](handleError(_0x1d821d,null));};exports[_0xb8e3('0x50')]=function(_0x23d9a8,_0xa383cd){return respondWithRpcPromise(_0xb8e3('0x51'),_0x23d9a8[_0xb8e3('0x17')])[_0xb8e3('0xb')](respondWithResult(_0xa383cd,null))[_0xb8e3('0xe')](handleError(_0xa383cd,null));};exports[_0xb8e3('0x52')]=function(_0x3263aa,_0x4099df){return respondWithRpcPromise(_0xb8e3('0x53'),_0x3263aa[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x4099df,null))[_0xb8e3('0xe')](handleError(_0x4099df,null));};exports['mailQueuesWaitingInteractions']=function(_0x24db68,_0x10c7ca){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x24db68[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x10c7ca,null))[_0xb8e3('0xe')](handleError(_0x10c7ca,null));};exports[_0xb8e3('0x54')]=function(_0x125c2f,_0x1cdb4a){return respondWithRpcPromise(_0xb8e3('0x55'),_0x125c2f[_0xb8e3('0x17')],routingClient)['then'](respondWithResult(_0x1cdb4a,null))[_0xb8e3('0xe')](handleError(_0x1cdb4a,null));};exports[_0xb8e3('0x56')]=function(_0x485e4f,_0x12fc82){return respondWithRpcPromise(_0xb8e3('0x57'),_0x485e4f['query'],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x12fc82,null))['catch'](handleError(_0x12fc82,null));};exports[_0xb8e3('0x58')]=function(_0x340fd9,_0x5a3c90){return respondWithRpcPromise(_0xb8e3('0x59'),_0x340fd9['query'],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x5a3c90,null))[_0xb8e3('0xe')](handleError(_0x5a3c90,null));};exports[_0xb8e3('0x5a')]=function(_0x4e05bb,_0x1d9346){return respondWithRpcPromise(_0xb8e3('0x5b'),_0x4e05bb[_0xb8e3('0x17')],routingClient)[_0xb8e3('0xb')](respondWithResult(_0x1d9346,null))[_0xb8e3('0xe')](handleError(_0x1d9346,null));};exports[_0xb8e3('0x5c')]=function(_0x5e9ce2){return function(_0x3fcb36,_0x2296c2){var _0x22dc3b,_0x1c389a;var _0x59f5fd=_[_0xb8e3('0x5d')](_0x5e9ce2);var _0x3eba57=_0x5e9ce2===_0xb8e3('0x5e')?_0xb8e3('0x5f'):'Account';return db[_0x59f5fd+_0xb8e3('0x60')]['findOne']({'raw':!![],'where':{'id':_0x3fcb36[_0xb8e3('0x19')]['id']}})[_0xb8e3('0xb')](function(_0x204076){if(_['isNil'](_0x204076)){throw new Error(_0x59f5fd+_0xb8e3('0x61'));}_0x22dc3b=_0x204076;return db[_0x59f5fd+'Message'][_0xb8e3('0x62')]({'where':{'id':_0x3fcb36[_0xb8e3('0x2a')][_0xb8e3('0x63')]},'include':[{'model':db[_0x59f5fd+_0xb8e3('0x64')],'as':'Interaction'},{'model':db[_0x59f5fd+_0x3eba57],'as':_0xb8e3('0x65')}]});})[_0xb8e3('0xb')](function(_0x143171){if(_['isNil'](_0x143171)){throw new Error(_0x59f5fd+_0xb8e3('0x66'));}_0x1c389a=_0x143171;return _0x143171[_0xb8e3('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb8e3('0xb')](function(){var _0x6ef357={'uniqueid':_0x5e9ce2+'.'+_0x1c389a['id']+'.'+_0x1c389a['Interaction']['id'],'FromUserId':_0x3fcb36['user']['id'],'type':'queue'};_0x6ef357[_0x59f5fd+_0xb8e3('0x68')]=_0x1c389a['id'];_0x6ef357[_0x59f5fd+_0xb8e3('0x69')]=_0x1c389a['Interaction']['id'];_0x6ef357[_0xb8e3('0x6a')+_0x59f5fd+_0x3eba57+'Id']=_0x1c389a['Account']['id'];_0x6ef357['To'+_0x59f5fd+'QueueId']=_0x22dc3b['id'];return db[_0x59f5fd+'TransferReport'][_0xb8e3('0x6b')](_0x6ef357);})[_0xb8e3('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x5e9ce2,'interaction':_0x1c389a[_0xb8e3('0x64')],'message':_0x1c389a,'account':_0x1c389a[_0xb8e3('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb8e3('0x6c'),'appdata':_0x22dc3b[_0xb8e3('0x2d')]+','+(_0x1c389a['Account']['queueTransferTimeout']||0x12c),'interval':_0xb8e3('0x6d')}]},routingClient);})[_0xb8e3('0xb')](respondWithResult(_0x2296c2,null))[_0xb8e3('0xe')](handleError(_0x2296c2,null));};};exports['agentNotify']=function(_0x18e9e5,_0xbeb56f){var _0x4b8fa4,_0x1272d8;if(_[_0xb8e3('0x13')](_0x18e9e5[_0xb8e3('0x2a')][_0xb8e3('0x6e')])){throw new Error(_0xb8e3('0x6f'));}var _0x49c965=_0x18e9e5[_0xb8e3('0x2a')]['channel'];var _0x4a8d3c=_[_0xb8e3('0x5d')](_0x49c965);var _0x5ba527=_0x49c965===_0xb8e3('0x5e')?_0xb8e3('0x5f'):_0xb8e3('0x65');return db[_0xb8e3('0x70')][_0xb8e3('0x62')]({'raw':!![],'where':{'id':_0x18e9e5[_0xb8e3('0x19')]['id'],'role':_0xb8e3('0x71')}})[_0xb8e3('0xb')](function(_0x4530a2){if(_[_0xb8e3('0x13')](_0x4530a2)){throw new Error(_0xb8e3('0x72'));}_0x4b8fa4=_0x4530a2;return db[_0x4a8d3c+'Message'][_0xb8e3('0x62')]({'where':{'id':_0x18e9e5[_0xb8e3('0x2a')][_0xb8e3('0x63')]},'include':[{'model':db[_0x4a8d3c+_0xb8e3('0x64')],'as':_0xb8e3('0x64')},{'model':db[_0x4a8d3c+_0x5ba527],'as':'Account'}]});})[_0xb8e3('0xb')](function(_0x48299b){if(_[_0xb8e3('0x13')](_0x48299b)){throw new Error(_0x4a8d3c+_0xb8e3('0x66'));}_0x1272d8=_0x48299b;return _0x48299b[_0xb8e3('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb8e3('0xb')](function(){var _0x402cd0={'uniqueid':_0x49c965+'.'+_0x1272d8['id']+'.'+_0x1272d8[_0xb8e3('0x64')]['id'],'FromUserId':_0x18e9e5[_0xb8e3('0x2c')]['id'],'type':_0xb8e3('0x6c'),'ToUserId':_0x4b8fa4['id']};_0x402cd0[_0x4a8d3c+_0xb8e3('0x68')]=_0x1272d8['id'];_0x402cd0[_0x4a8d3c+_0xb8e3('0x69')]=_0x1272d8[_0xb8e3('0x64')]['id'];_0x402cd0[_0xb8e3('0x6a')+_0x4a8d3c+_0x5ba527+'Id']=_0x1272d8['Account']['id'];return db[_0x4a8d3c+_0xb8e3('0x73')][_0xb8e3('0x6b')](_0x402cd0);})[_0xb8e3('0xb')](function(){return respondWithRpcPromise(_0xb8e3('0x74'),{'channel':_0x49c965,'interaction':_0x1272d8[_0xb8e3('0x64')],'message':_0x1272d8,'account':_0x1272d8['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb8e3('0x71'),'appdata':_0x4b8fa4['name']+','+(_0x1272d8[_0xb8e3('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb8e3('0xb')](respondWithResult(_0xbeb56f,null))[_0xb8e3('0xe')](handleError(_0xbeb56f,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1399b9b..1640686 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 _0x6977=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','post'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0x6977,0x77));var _0x7697=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x6977[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0x7697('0x0'));var util=require('util');var path=require(_0x7697('0x1'));var timeout=require(_0x7697('0x2'));var express=require(_0x7697('0x3'));var router=express[_0x7697('0x4')]();var auth=require(_0x7697('0x5'));var interaction=require(_0x7697('0x6'));var config=require('../../config/environment');var controller=require(_0x7697('0x7'));router[_0x7697('0x8')]('/',auth[_0x7697('0x9')](),controller['index']);router[_0x7697('0x8')](_0x7697('0xa'),auth[_0x7697('0x9')](),controller[_0x7697('0xb')]);router[_0x7697('0x8')](_0x7697('0xc'),auth[_0x7697('0x9')](),controller['run']);router[_0x7697('0xd')]('/',auth[_0x7697('0x9')](),controller[_0x7697('0xe')]);router[_0x7697('0xf')]('/:id',auth[_0x7697('0x9')](),controller[_0x7697('0x10')]);router[_0x7697('0x11')](_0x7697('0xa'),auth[_0x7697('0x9')](),controller['destroy']);module[_0x7697('0x12')]=router; \ No newline at end of file +var _0x4b3c=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','create'];(function(_0x4ef03d,_0x4b8062){var _0x33cce1=function(_0x202041){while(--_0x202041){_0x4ef03d['push'](_0x4ef03d['shift']());}};_0x33cce1(++_0x4b8062);}(_0x4b3c,0x10d));var _0xc4b3=function(_0x5e0e90,_0x1c8363){_0x5e0e90=_0x5e0e90-0x0;var _0x33cfe3=_0x4b3c[_0x5e0e90];return _0x33cfe3;};'use strict';var multer=require(_0xc4b3('0x0'));var util=require(_0xc4b3('0x1'));var path=require(_0xc4b3('0x2'));var timeout=require(_0xc4b3('0x3'));var express=require(_0xc4b3('0x4'));var router=express[_0xc4b3('0x5')]();var auth=require(_0xc4b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc4b3('0x7'));var controller=require(_0xc4b3('0x8'));router[_0xc4b3('0x9')]('/',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xb')]);router[_0xc4b3('0x9')](_0xc4b3('0xc'),auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xd')]);router[_0xc4b3('0x9')]('/:id/run',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xe')]);router['post']('/',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xf')]);router[_0xc4b3('0x10')]('/:id',auth[_0xc4b3('0xa')](),controller['update']);router[_0xc4b3('0x11')]('/:id',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7e3899e..183433e 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 _0x6ec2=['TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','months','hours','minutes','days','csv','xlsx','custom','default'];(function(_0x6306b4,_0x5f4647){var _0x46e442=function(_0x281912){while(--_0x281912){_0x6306b4['push'](_0x6306b4['shift']());}};_0x46e442(++_0x5f4647);}(_0x6ec2,0x78));var _0x26ec=function(_0x307f36,_0x42a282){_0x307f36=_0x307f36-0x0;var _0x5f5826=_0x6ec2[_0x307f36];return _0x5f5826;};'use strict';var Sequelize=require(_0x26ec('0x0'));module[_0x26ec('0x1')]={'name':{'type':Sequelize[_0x26ec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x26ec('0x2')]},'active':{'type':Sequelize[_0x26ec('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x26ec('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x26ec('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x26ec('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x26ec('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x26ec('0x6')](_0x26ec('0x7'),'quarters',_0x26ec('0x8'),'weeks','days',_0x26ec('0x9'),_0x26ec('0xa')),'allowNull':![],'defaultValue':_0x26ec('0xb')},'output':{'type':Sequelize['ENUM'](_0x26ec('0xc'),'pdf',_0x26ec('0xd')),'allowNull':![],'defaultValue':_0x26ec('0xc')},'type':{'type':Sequelize[_0x26ec('0x6')](_0x26ec('0xe'),_0x26ec('0xf')),'allowNull':![],'defaultValue':_0x26ec('0xe')},'sendMail':{'type':Sequelize[_0x26ec('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x26ec('0x2')]},'cc':{'type':Sequelize[_0x26ec('0x10')]},'bcc':{'type':Sequelize[_0x26ec('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x37c5=['pdf','xlsx','csv','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','hours','minutes','days'];(function(_0x1ba4d1,_0x54fd0e){var _0x29a4a5=function(_0x15c9b8){while(--_0x15c9b8){_0x1ba4d1['push'](_0x1ba4d1['shift']());}};_0x29a4a5(++_0x54fd0e);}(_0x37c5,0xa7));var _0x537c=function(_0x1222c3,_0x4651bd){_0x1222c3=_0x1222c3-0x0;var _0xb85da7=_0x37c5[_0x1222c3];return _0xb85da7;};'use strict';var Sequelize=require('sequelize');module[_0x537c('0x0')]={'name':{'type':Sequelize[_0x537c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x537c('0x1')]},'active':{'type':Sequelize[_0x537c('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x537c('0x1')],'allowNull':![],'defaultValue':_0x537c('0x3')},'startAt':{'type':Sequelize[_0x537c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x537c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x537c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x537c('0x6')]('years',_0x537c('0x7'),_0x537c('0x8'),_0x537c('0x9'),'days',_0x537c('0xa'),_0x537c('0xb')),'allowNull':![],'defaultValue':_0x537c('0xc')},'output':{'type':Sequelize[_0x537c('0x6')]('csv',_0x537c('0xd'),_0x537c('0xe')),'allowNull':![],'defaultValue':_0x537c('0xf')},'type':{'type':Sequelize['ENUM'](_0x537c('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x537c('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x537c('0x11')]},'bcc':{'type':Sequelize[_0x537c('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x537c('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 52c29be..06b383c 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 _0x96e7=['stack','name','Schedule','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','body','../../config/schedule','html-pdf','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','then','destroy','get','Scheduler'];(function(_0x1ae64c,_0x27962e){var _0xfff0df=function(_0x145310){while(--_0x145310){_0x1ae64c['push'](_0x1ae64c['shift']());}};_0xfff0df(++_0x27962e);}(_0x96e7,0x1b8));var _0x796e=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x96e7[_0x19115e];return _0x45bbd4;};'use strict';var pdf=require(_0x796e('0x0'));var emlformat=require(_0x796e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x796e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x796e('0x3'));var Mustache=require(_0x796e('0x4'));var util=require(_0x796e('0x5'));var path=require('path');var sox=require(_0x796e('0x6'));var csv=require(_0x796e('0x7'));var ejs=require(_0x796e('0x8'));var fs=require('fs');var _=require(_0x796e('0x9'));var squel=require(_0x796e('0xa'));var crypto=require('crypto');var jsforce=require(_0x796e('0xb'));var deskjs=require(_0x796e('0xc'));var toCsv=require(_0x796e('0x7'));var querystring=require(_0x796e('0xd'));var Papa=require(_0x796e('0xe'));var Redis=require(_0x796e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x796e('0x10'));var logger=require(_0x796e('0x11'))(_0x796e('0x12'));var utils=require(_0x796e('0x13'));var config=require(_0x796e('0x14'));var db=require(_0x796e('0x15'))['db'];function respondWithStatusCode(_0x4f31f7,_0x57420c){_0x57420c=_0x57420c||0xcc;return function(_0x16fe10){if(_0x16fe10){return _0x4f31f7[_0x796e('0x16')](_0x57420c);}return _0x4f31f7[_0x796e('0x17')](_0x57420c)[_0x796e('0x18')]();};}function respondWithResult(_0x1c1f2e,_0x4600e4){_0x4600e4=_0x4600e4||0xc8;return function(_0x416b42){if(_0x416b42){return _0x1c1f2e[_0x796e('0x17')](_0x4600e4)[_0x796e('0x19')](_0x416b42);}};}function respondWithFilteredResult(_0x79204f,_0x5008f0){return function(_0x52e612){if(_0x52e612){var _0x1b6b44=_0x52e612['count'],_0x38d6b5=_0x5008f0[_0x796e('0x1a')],_0x15a006=_0x5008f0[_0x796e('0x1a')]+_0x5008f0[_0x796e('0x1b')],_0x37d431;if(_0x15a006>=_0x1b6b44){_0x15a006=_0x1b6b44;_0x37d431=0xc8;}else{_0x37d431=0xce;}_0x79204f['status'](_0x37d431);return _0x79204f['set'](_0x796e('0x1c'),_0x38d6b5+'-'+_0x15a006+'/'+_0x1b6b44)['json'](_0x52e612);}return null;};}function patchUpdates(_0x37c241){return function(_0x32751e){try{jsonpatch[_0x796e('0x1d')](_0x32751e,_0x37c241,!![]);}catch(_0x4005e4){return BPromise['reject'](_0x4005e4);}return _0x32751e['save']();};}function saveUpdates(_0x4d0700,_0xa03882){return function(_0x1d20cd){if(_0x1d20cd){return _0x1d20cd['update'](_0x4d0700)[_0x796e('0x1e')](function(_0x11f8a1){return _0x11f8a1;});}return null;};}function removeEntity(_0x385cfa,_0x2479f0){return function(_0x139af5){if(_0x139af5){return _0x139af5[_0x796e('0x1f')]()[_0x796e('0x1e')](function(){var _0x4f56af=_0x139af5[_0x796e('0x20')]({'plain':!![]});var _0x434a0f=_0x796e('0x21');return db['UserProfileResource'][_0x796e('0x1f')]({'where':{'type':_0x434a0f,'resourceId':_0x4f56af['id']}})[_0x796e('0x1e')](function(){return _0x139af5;});})['then'](function(){_0x385cfa['status'](0xcc)[_0x796e('0x18')]();});}};}function handleEntityNotFound(_0x19a72d,_0x34ab8e){return function(_0x4a0aa9){if(!_0x4a0aa9){_0x19a72d[_0x796e('0x16')](0x194);}return _0x4a0aa9;};}function handleError(_0x3c00e6,_0x581329){_0x581329=_0x581329||0x1f4;return function(_0x33eff3){logger['error'](_0x33eff3[_0x796e('0x22')]);if(_0x33eff3['name']){delete _0x33eff3[_0x796e('0x23')];}_0x3c00e6[_0x796e('0x17')](_0x581329)['send'](_0x33eff3);};}exports['index']=function(_0x251240,_0x3fc323){var _0x41254d={},_0x4eca59={},_0x21bb2d={'count':0x0,'rows':[]};var _0x5667be=_['map'](db[_0x796e('0x24')][_0x796e('0x25')],function(_0x5493ff){return{'name':_0x5493ff[_0x796e('0x26')],'type':_0x5493ff[_0x796e('0x27')]['key']};});_0x4eca59['model']=_[_0x796e('0x28')](_0x5667be,_0x796e('0x23'));_0x4eca59['query']=_[_0x796e('0x29')](_0x251240[_0x796e('0x2a')]);_0x4eca59[_0x796e('0x2b')]=_[_0x796e('0x2c')](_0x4eca59[_0x796e('0x2d')],_0x4eca59[_0x796e('0x2a')]);_0x41254d[_0x796e('0x2e')]=_[_0x796e('0x2c')](_0x4eca59[_0x796e('0x2d')],qs['fields'](_0x251240[_0x796e('0x2a')]['fields']));_0x41254d[_0x796e('0x2e')]=_0x41254d[_0x796e('0x2e')][_0x796e('0x2f')]?_0x41254d[_0x796e('0x2e')]:_0x4eca59[_0x796e('0x2d')];if(!_0x251240[_0x796e('0x2a')][_0x796e('0x30')](_0x796e('0x31'))){_0x41254d['limit']=qs[_0x796e('0x1b')](_0x251240[_0x796e('0x2a')][_0x796e('0x1b')]);_0x41254d[_0x796e('0x1a')]=qs[_0x796e('0x1a')](_0x251240['query'][_0x796e('0x1a')]);}_0x41254d[_0x796e('0x32')]=qs[_0x796e('0x33')](_0x251240[_0x796e('0x2a')][_0x796e('0x33')]);_0x41254d[_0x796e('0x34')]=qs[_0x796e('0x2b')](_[_0x796e('0x35')](_0x251240['query'],_0x4eca59['filters']),_0x5667be);if(_0x251240[_0x796e('0x2a')][_0x796e('0x36')]){_0x41254d[_0x796e('0x34')]=_[_0x796e('0x37')](_0x41254d[_0x796e('0x34')],{'$or':_[_0x796e('0x28')](_0x5667be,function(_0x9ee3ed){if(_0x9ee3ed[_0x796e('0x27')]!==_0x796e('0x38')){var _0x407110={};_0x407110[_0x9ee3ed[_0x796e('0x23')]]={'$like':'%'+_0x251240[_0x796e('0x2a')][_0x796e('0x36')]+'%'};return _0x407110;}})});}_0x41254d=_[_0x796e('0x37')]({},_0x41254d,_0x251240[_0x796e('0x39')]);var _0x1760ad={'where':_0x41254d[_0x796e('0x34')]};return db['Schedule'][_0x796e('0x3a')](_0x1760ad)['then'](function(_0x293378){_0x21bb2d[_0x796e('0x3a')]=_0x293378;if(_0x251240[_0x796e('0x2a')]['includeAll']){_0x41254d[_0x796e('0x3b')]=[{'all':!![]}];}return db[_0x796e('0x24')]['findAll'](_0x41254d);})[_0x796e('0x1e')](function(_0x149f0f){_0x21bb2d[_0x796e('0x3c')]=_0x149f0f;return _0x21bb2d;})[_0x796e('0x1e')](respondWithFilteredResult(_0x3fc323,_0x41254d))[_0x796e('0x3d')](handleError(_0x3fc323,null));};exports[_0x796e('0x3e')]=function(_0x42b24e,_0x111f6d){var _0x183dc7={'raw':![],'where':{'id':_0x42b24e[_0x796e('0x3f')]['id']}},_0x55de33={};_0x55de33[_0x796e('0x2d')]=_['keys'](db['Schedule']['rawAttributes']);_0x55de33['query']=_[_0x796e('0x29')](_0x42b24e['query']);_0x55de33[_0x796e('0x2b')]=_[_0x796e('0x2c')](_0x55de33[_0x796e('0x2d')],_0x55de33[_0x796e('0x2a')]);_0x183dc7['attributes']=_[_0x796e('0x2c')](_0x55de33[_0x796e('0x2d')],qs[_0x796e('0x40')](_0x42b24e[_0x796e('0x2a')]['fields']));_0x183dc7[_0x796e('0x2e')]=_0x183dc7[_0x796e('0x2e')][_0x796e('0x2f')]?_0x183dc7['attributes']:_0x55de33[_0x796e('0x2d')];if(_0x42b24e[_0x796e('0x2a')][_0x796e('0x41')]){_0x183dc7['include']=[{'all':!![]}];}_0x183dc7=_['merge']({},_0x183dc7,_0x42b24e['options']);return db[_0x796e('0x24')][_0x796e('0x42')](_0x183dc7)[_0x796e('0x1e')](handleEntityNotFound(_0x111f6d,null))['then'](respondWithResult(_0x111f6d,null))[_0x796e('0x3d')](handleError(_0x111f6d,null));};exports[_0x796e('0x43')]=function(_0x146642,_0x14323b){return db[_0x796e('0x24')]['create'](_0x146642['body'],{})[_0x796e('0x1e')](function(_0x7b26fb){var _0x464158=_0x146642[_0x796e('0x44')][_0x796e('0x20')]({'plain':!![]});if(!_0x464158)throw new Error(_0x796e('0x45'));if(_0x464158[_0x796e('0x46')]==='user'){var _0x1d8ac2=_0x7b26fb[_0x796e('0x20')]({'plain':!![]});var _0x580262=_0x796e('0x21');return db[_0x796e('0x47')][_0x796e('0x42')]({'where':{'name':_0x580262,'userProfileId':_0x464158[_0x796e('0x48')]},'raw':!![]})[_0x796e('0x1e')](function(_0x3b71fc){if(_0x3b71fc&&_0x3b71fc[_0x796e('0x49')]===0x0){return db[_0x796e('0x4a')][_0x796e('0x43')]({'name':_0x1d8ac2[_0x796e('0x23')],'resourceId':_0x1d8ac2['id'],'type':_0x3b71fc[_0x796e('0x23')],'sectionId':_0x3b71fc['id']},{})['then'](function(){return _0x7b26fb;});}else{return _0x7b26fb;}})[_0x796e('0x3d')](function(_0x2bd02d){logger[_0x796e('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bd02d);throw _0x2bd02d;});}return _0x7b26fb;})[_0x796e('0x1e')](respondWithResult(_0x14323b,0xc9))['catch'](handleError(_0x14323b,null));};exports[_0x796e('0x4c')]=function(_0x4f88ea,_0xbae94b){if(_0x4f88ea['body']['id']){delete _0x4f88ea[_0x796e('0x4d')]['id'];}return db[_0x796e('0x24')][_0x796e('0x42')]({'where':{'id':_0x4f88ea[_0x796e('0x3f')]['id']}})[_0x796e('0x1e')](handleEntityNotFound(_0xbae94b,null))[_0x796e('0x1e')](saveUpdates(_0x4f88ea['body'],null))[_0x796e('0x1e')](respondWithResult(_0xbae94b,null))[_0x796e('0x3d')](handleError(_0xbae94b,null));};exports[_0x796e('0x1f')]=function(_0x1fc08a,_0xb98fb7){return db[_0x796e('0x24')][_0x796e('0x42')]({'where':{'id':_0x1fc08a[_0x796e('0x3f')]['id']}})[_0x796e('0x1e')](handleEntityNotFound(_0xb98fb7,null))['then'](removeEntity(_0xb98fb7,null))[_0x796e('0x3d')](handleError(_0xb98fb7,null));};exports['run']=function(_0x570240,_0x35fb0c,_0x4a90c9){var _0x2a26d5=require(_0x796e('0x4e'));return db[_0x796e('0x24')]['find']({'where':{'id':_0x570240[_0x796e('0x3f')]['id']},'raw':!![]})[_0x796e('0x1e')](handleEntityNotFound(_0x35fb0c,null))['then'](function(){_0x2a26d5['run'](_0x570240[_0x796e('0x3f')]['id']);})['then'](respondWithStatusCode(_0x35fb0c,null))['catch'](handleError(_0x35fb0c,null));}; \ No newline at end of file +var _0x555f=['catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','Schedule','findAll','rows'];(function(_0x5a1906,_0x42d724){var _0x2218fb=function(_0x3a8513){while(--_0x3a8513){_0x5a1906['push'](_0x5a1906['shift']());}};_0x2218fb(++_0x42d724);}(_0x555f,0x1f3));var _0xf555=function(_0x98cb08,_0x3212b4){_0x98cb08=_0x98cb08-0x0;var _0x23473c=_0x555f[_0x98cb08];return _0x23473c;};'use strict';var pdf=require(_0xf555('0x0'));var emlformat=require(_0xf555('0x1'));var rimraf=require(_0xf555('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf555('0x3'));var rp=require(_0xf555('0x4'));var moment=require(_0xf555('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf555('0x6'));var csv=require(_0xf555('0x7'));var ejs=require(_0xf555('0x8'));var fs=require('fs');var _=require(_0xf555('0x9'));var squel=require('squel');var crypto=require(_0xf555('0xa'));var jsforce=require(_0xf555('0xb'));var deskjs=require(_0xf555('0xc'));var toCsv=require(_0xf555('0x7'));var querystring=require(_0xf555('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf555('0xe'));var as=require(_0xf555('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf555('0x10'));var utils=require(_0xf555('0x11'));var config=require(_0xf555('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31e416,_0x53422f){_0x53422f=_0x53422f||0xcc;return function(_0x65b391){if(_0x65b391){return _0x31e416['sendStatus'](_0x53422f);}return _0x31e416[_0xf555('0x13')](_0x53422f)[_0xf555('0x14')]();};}function respondWithResult(_0x17ec0b,_0x43ec3b){_0x43ec3b=_0x43ec3b||0xc8;return function(_0x23d399){if(_0x23d399){return _0x17ec0b[_0xf555('0x13')](_0x43ec3b)['json'](_0x23d399);}};}function respondWithFilteredResult(_0x323290,_0x308031){return function(_0x450670){if(_0x450670){var _0x50a59a=_0x450670[_0xf555('0x15')],_0x4f4ad0=_0x308031[_0xf555('0x16')],_0x270e9c=_0x308031[_0xf555('0x16')]+_0x308031[_0xf555('0x17')],_0x328281;if(_0x270e9c>=_0x50a59a){_0x270e9c=_0x50a59a;_0x328281=0xc8;}else{_0x328281=0xce;}_0x323290['status'](_0x328281);return _0x323290[_0xf555('0x18')](_0xf555('0x19'),_0x4f4ad0+'-'+_0x270e9c+'/'+_0x50a59a)[_0xf555('0x1a')](_0x450670);}return null;};}function patchUpdates(_0x242caa){return function(_0x438ade){try{jsonpatch[_0xf555('0x1b')](_0x438ade,_0x242caa,!![]);}catch(_0x56c90a){return BPromise[_0xf555('0x1c')](_0x56c90a);}return _0x438ade[_0xf555('0x1d')]();};}function saveUpdates(_0x41f1d8,_0x319e58){return function(_0x300a23){if(_0x300a23){return _0x300a23['update'](_0x41f1d8)[_0xf555('0x1e')](function(_0x2e05fc){return _0x2e05fc;});}return null;};}function removeEntity(_0x359738,_0x424c9a){return function(_0x1610dc){if(_0x1610dc){return _0x1610dc[_0xf555('0x1f')]()[_0xf555('0x1e')](function(){var _0x1ab771=_0x1610dc[_0xf555('0x20')]({'plain':!![]});var _0x555a49='Scheduler';return db[_0xf555('0x21')]['destroy']({'where':{'type':_0x555a49,'resourceId':_0x1ab771['id']}})[_0xf555('0x1e')](function(){return _0x1610dc;});})[_0xf555('0x1e')](function(){_0x359738[_0xf555('0x13')](0xcc)[_0xf555('0x14')]();});}};}function handleEntityNotFound(_0x4516cf,_0x1392f8){return function(_0x42a971){if(!_0x42a971){_0x4516cf[_0xf555('0x22')](0x194);}return _0x42a971;};}function handleError(_0x1296b9,_0x4b5ee2){_0x4b5ee2=_0x4b5ee2||0x1f4;return function(_0x39f316){logger[_0xf555('0x23')](_0x39f316[_0xf555('0x24')]);if(_0x39f316['name']){delete _0x39f316['name'];}_0x1296b9[_0xf555('0x13')](_0x4b5ee2)[_0xf555('0x25')](_0x39f316);};}exports[_0xf555('0x26')]=function(_0x93769e,_0x2e2334){var _0xd8fcf={},_0x2666ed={},_0x48d05b={'count':0x0,'rows':[]};var _0x419154=_[_0xf555('0x27')](db['Schedule'][_0xf555('0x28')],function(_0x5e0805){return{'name':_0x5e0805[_0xf555('0x29')],'type':_0x5e0805[_0xf555('0x2a')][_0xf555('0x2b')]};});_0x2666ed['model']=_[_0xf555('0x27')](_0x419154,_0xf555('0x2c'));_0x2666ed['query']=_[_0xf555('0x2d')](_0x93769e['query']);_0x2666ed['filters']=_[_0xf555('0x2e')](_0x2666ed[_0xf555('0x2f')],_0x2666ed[_0xf555('0x30')]);_0xd8fcf['attributes']=_[_0xf555('0x2e')](_0x2666ed[_0xf555('0x2f')],qs[_0xf555('0x31')](_0x93769e[_0xf555('0x30')]['fields']));_0xd8fcf[_0xf555('0x32')]=_0xd8fcf[_0xf555('0x32')][_0xf555('0x33')]?_0xd8fcf['attributes']:_0x2666ed[_0xf555('0x2f')];if(!_0x93769e[_0xf555('0x30')][_0xf555('0x34')](_0xf555('0x35'))){_0xd8fcf[_0xf555('0x17')]=qs[_0xf555('0x17')](_0x93769e['query'][_0xf555('0x17')]);_0xd8fcf[_0xf555('0x16')]=qs['offset'](_0x93769e['query'][_0xf555('0x16')]);}_0xd8fcf[_0xf555('0x36')]=qs[_0xf555('0x37')](_0x93769e[_0xf555('0x30')]['sort']);_0xd8fcf['where']=qs[_0xf555('0x38')](_[_0xf555('0x39')](_0x93769e['query'],_0x2666ed[_0xf555('0x38')]),_0x419154);if(_0x93769e[_0xf555('0x30')]['filter']){_0xd8fcf[_0xf555('0x3a')]=_[_0xf555('0x3b')](_0xd8fcf[_0xf555('0x3a')],{'$or':_['map'](_0x419154,function(_0xa733fd){if(_0xa733fd[_0xf555('0x2a')]!==_0xf555('0x3c')){var _0x586166={};_0x586166[_0xa733fd[_0xf555('0x2c')]]={'$like':'%'+_0x93769e[_0xf555('0x30')][_0xf555('0x3d')]+'%'};return _0x586166;}})});}_0xd8fcf=_[_0xf555('0x3b')]({},_0xd8fcf,_0x93769e[_0xf555('0x3e')]);var _0x451b22={'where':_0xd8fcf[_0xf555('0x3a')]};return db['Schedule'][_0xf555('0x15')](_0x451b22)[_0xf555('0x1e')](function(_0x52c897){_0x48d05b[_0xf555('0x15')]=_0x52c897;if(_0x93769e[_0xf555('0x30')][_0xf555('0x3f')]){_0xd8fcf[_0xf555('0x40')]=[{'all':!![]}];}return db[_0xf555('0x41')][_0xf555('0x42')](_0xd8fcf);})[_0xf555('0x1e')](function(_0x284a06){_0x48d05b[_0xf555('0x43')]=_0x284a06;return _0x48d05b;})[_0xf555('0x1e')](respondWithFilteredResult(_0x2e2334,_0xd8fcf))[_0xf555('0x44')](handleError(_0x2e2334,null));};exports['show']=function(_0x11b7ed,_0x380f5a){var _0x301fa5={'raw':![],'where':{'id':_0x11b7ed[_0xf555('0x45')]['id']}},_0x45591b={};_0x45591b[_0xf555('0x2f')]=_[_0xf555('0x2d')](db['Schedule'][_0xf555('0x28')]);_0x45591b[_0xf555('0x30')]=_['keys'](_0x11b7ed[_0xf555('0x30')]);_0x45591b[_0xf555('0x38')]=_['intersection'](_0x45591b[_0xf555('0x2f')],_0x45591b[_0xf555('0x30')]);_0x301fa5['attributes']=_[_0xf555('0x2e')](_0x45591b[_0xf555('0x2f')],qs[_0xf555('0x31')](_0x11b7ed['query']['fields']));_0x301fa5[_0xf555('0x32')]=_0x301fa5[_0xf555('0x32')][_0xf555('0x33')]?_0x301fa5[_0xf555('0x32')]:_0x45591b[_0xf555('0x2f')];if(_0x11b7ed['query'][_0xf555('0x3f')]){_0x301fa5[_0xf555('0x40')]=[{'all':!![]}];}_0x301fa5=_[_0xf555('0x3b')]({},_0x301fa5,_0x11b7ed[_0xf555('0x3e')]);return db[_0xf555('0x41')][_0xf555('0x46')](_0x301fa5)[_0xf555('0x1e')](handleEntityNotFound(_0x380f5a,null))[_0xf555('0x1e')](respondWithResult(_0x380f5a,null))[_0xf555('0x44')](handleError(_0x380f5a,null));};exports[_0xf555('0x47')]=function(_0x2332e0,_0x2ed024){return db[_0xf555('0x41')][_0xf555('0x47')](_0x2332e0[_0xf555('0x48')],{})[_0xf555('0x1e')](function(_0x1be862){var _0x1e223e=_0x2332e0[_0xf555('0x49')][_0xf555('0x20')]({'plain':!![]});if(!_0x1e223e)throw new Error(_0xf555('0x4a'));if(_0x1e223e[_0xf555('0x4b')]==='user'){var _0x5fc300=_0x1be862[_0xf555('0x20')]({'plain':!![]});var _0x28a412=_0xf555('0x4c');return db['UserProfileSection'][_0xf555('0x46')]({'where':{'name':_0x28a412,'userProfileId':_0x1e223e[_0xf555('0x4d')]},'raw':!![]})[_0xf555('0x1e')](function(_0x211a78){if(_0x211a78&&_0x211a78[_0xf555('0x4e')]===0x0){return db[_0xf555('0x21')][_0xf555('0x47')]({'name':_0x5fc300['name'],'resourceId':_0x5fc300['id'],'type':_0x211a78[_0xf555('0x2c')],'sectionId':_0x211a78['id']},{})[_0xf555('0x1e')](function(){return _0x1be862;});}else{return _0x1be862;}})[_0xf555('0x44')](function(_0x6a8b1c){logger[_0xf555('0x23')](_0xf555('0x4f'),_0x6a8b1c);throw _0x6a8b1c;});}return _0x1be862;})['then'](respondWithResult(_0x2ed024,0xc9))[_0xf555('0x44')](handleError(_0x2ed024,null));};exports['update']=function(_0x253e35,_0x409fe2){if(_0x253e35['body']['id']){delete _0x253e35[_0xf555('0x48')]['id'];}return db[_0xf555('0x41')][_0xf555('0x46')]({'where':{'id':_0x253e35[_0xf555('0x45')]['id']}})[_0xf555('0x1e')](handleEntityNotFound(_0x409fe2,null))['then'](saveUpdates(_0x253e35[_0xf555('0x48')],null))['then'](respondWithResult(_0x409fe2,null))[_0xf555('0x44')](handleError(_0x409fe2,null));};exports[_0xf555('0x1f')]=function(_0x3d464b,_0x375a91){return db[_0xf555('0x41')][_0xf555('0x46')]({'where':{'id':_0x3d464b['params']['id']}})[_0xf555('0x1e')](handleEntityNotFound(_0x375a91,null))[_0xf555('0x1e')](removeEntity(_0x375a91,null))[_0xf555('0x44')](handleError(_0x375a91,null));};exports[_0xf555('0x50')]=function(_0x23929d,_0x281960,_0x534570){var _0x29f324=require('../../config/schedule');return db[_0xf555('0x41')][_0xf555('0x46')]({'where':{'id':_0x23929d[_0xf555('0x45')]['id']},'raw':!![]})[_0xf555('0x1e')](handleEntityNotFound(_0x281960,null))[_0xf555('0x1e')](function(){_0x29f324[_0xf555('0x50')](_0x23929d[_0xf555('0x45')]['id']);})['then'](respondWithStatusCode(_0x281960,null))[_0xf555('0x44')](handleError(_0x281960,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ff9b58c..758d8d6 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 _0x6662=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Schedule','lodash'];(function(_0xaf3e2b,_0x51f353){var _0x38ada6=function(_0x431ee7){while(--_0x431ee7){_0xaf3e2b['push'](_0xaf3e2b['shift']());}};_0x38ada6(++_0x51f353);}(_0x6662,0xaf));var _0x2666=function(_0x584683,_0x46a0a4){_0x584683=_0x584683-0x0;var _0x57bbf4=_0x6662[_0x584683];return _0x57bbf4;};'use strict';var _=require(_0x2666('0x0'));var util=require(_0x2666('0x1'));var logger=require(_0x2666('0x2'))(_0x2666('0x3'));var moment=require(_0x2666('0x4'));var BPromise=require(_0x2666('0x5'));var rp=require(_0x2666('0x6'));var fs=require('fs');var path=require(_0x2666('0x7'));var rimraf=require(_0x2666('0x8'));var config=require(_0x2666('0x9'));var attributes=require('./schedule.attributes');module['exports']=function(_0x596866,_0x100fb4){return _0x596866['define'](_0x2666('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Schedule','tools_schedules','lodash'];(function(_0x27d89b,_0x14c10a){var _0xb96aae=function(_0x5cad32){while(--_0x5cad32){_0x27d89b['push'](_0x27d89b['shift']());}};_0xb96aae(++_0x14c10a);}(_0x56c7,0xe9));var _0x756c=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0x56c7[_0x33670a];return _0x36ad1d;};'use strict';var _=require(_0x756c('0x0'));var util=require(_0x756c('0x1'));var logger=require(_0x756c('0x2'))(_0x756c('0x3'));var moment=require(_0x756c('0x4'));var BPromise=require(_0x756c('0x5'));var rp=require(_0x756c('0x6'));var fs=require('fs');var path=require(_0x756c('0x7'));var rimraf=require(_0x756c('0x8'));var config=require(_0x756c('0x9'));var attributes=require('./schedule.attributes');module[_0x756c('0xa')]=function(_0x39eed8,_0x1e8d56){return _0x39eed8['define'](_0x756c('0xb'),attributes,{'tableName':_0x756c('0xc'),'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 872995a..6edabb5 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 _0x5c7e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5c7e,0x1c2));var _0xe5c7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x5c7e[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xe5c7('0x0'));var util=require(_0xe5c7('0x1'));var moment=require(_0xe5c7('0x2'));var BPromise=require(_0xe5c7('0x3'));var rs=require(_0xe5c7('0x4'));var fs=require('fs');var Redis=require(_0xe5c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5c7('0x6'));var logger=require(_0xe5c7('0x7'))(_0xe5c7('0x8'));var config=require(_0xe5c7('0x9'));var jayson=require(_0xe5c7('0xa'));var client=jayson[_0xe5c7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6d7b,_0x3fc66a,_0x3d2a85){return new BPromise(function(_0x470d7d,_0x19981b){return client[_0xe5c7('0xc')](_0x2f6d7b,_0x3d2a85)[_0xe5c7('0xd')](function(_0x3660f3){logger[_0xe5c7('0xe')](_0xe5c7('0xf'),_0x3fc66a,_0xe5c7('0x10'));logger[_0xe5c7('0x11')](_0xe5c7('0x12'),_0x3fc66a,_0xe5c7('0x10'),JSON[_0xe5c7('0x13')](_0x3660f3));if(_0x3660f3[_0xe5c7('0x14')]){if(_0x3660f3[_0xe5c7('0x14')][_0xe5c7('0x15')]===0x1f4){logger['error'](_0xe5c7('0xf'),_0x3fc66a,_0x3660f3['error'][_0xe5c7('0x16')]);return _0x19981b(_0x3660f3[_0xe5c7('0x14')]['message']);}logger[_0xe5c7('0x14')](_0xe5c7('0xf'),_0x3fc66a,_0x3660f3[_0xe5c7('0x14')][_0xe5c7('0x16')]);return _0x470d7d(_0x3660f3[_0xe5c7('0x14')]['message']);}else{logger[_0xe5c7('0xe')](_0xe5c7('0xf'),_0x3fc66a,_0xe5c7('0x10'));_0x470d7d(_0x3660f3[_0xe5c7('0x17')][_0xe5c7('0x16')]);}})[_0xe5c7('0x18')](function(_0xbb08ab){logger[_0xe5c7('0x14')](_0xe5c7('0xf'),_0x3fc66a,_0xbb08ab);_0x19981b(_0xbb08ab);});});} \ No newline at end of file +var _0xa789=['lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0xa789,0x168));var _0x9a78=function(_0x23ef47,_0x527d97){_0x23ef47=_0x23ef47-0x0;var _0x5c3acd=_0xa789[_0x23ef47];return _0x5c3acd;};'use strict';var _=require(_0x9a78('0x0'));var util=require(_0x9a78('0x1'));var moment=require('moment');var BPromise=require(_0x9a78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a78('0x3'));var db=require(_0x9a78('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a78('0x5'));var config=require(_0x9a78('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a78('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e92b2,_0x19cc04,_0x118287){return new BPromise(function(_0x57c8b7,_0x106497){return client[_0x9a78('0x8')](_0x5e92b2,_0x118287)[_0x9a78('0x9')](function(_0x4bab75){logger[_0x9a78('0xa')](_0x9a78('0xb'),_0x19cc04,_0x9a78('0xc'));logger['debug'](_0x9a78('0xd'),_0x19cc04,_0x9a78('0xc'),JSON['stringify'](_0x4bab75));if(_0x4bab75[_0x9a78('0xe')]){if(_0x4bab75['error'][_0x9a78('0xf')]===0x1f4){logger[_0x9a78('0xe')](_0x9a78('0xb'),_0x19cc04,_0x4bab75[_0x9a78('0xe')][_0x9a78('0x10')]);return _0x106497(_0x4bab75[_0x9a78('0xe')]['message']);}logger[_0x9a78('0xe')](_0x9a78('0xb'),_0x19cc04,_0x4bab75[_0x9a78('0xe')][_0x9a78('0x10')]);return _0x57c8b7(_0x4bab75['error']['message']);}else{logger['info'](_0x9a78('0xb'),_0x19cc04,_0x9a78('0xc'));_0x57c8b7(_0x4bab75['result']['message']);}})[_0x9a78('0x11')](function(_0x40bb7c){logger[_0x9a78('0xe')](_0x9a78('0xb'),_0x19cc04,_0x40bb7c);_0x106497(_0x40bb7c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 19ddfbf..3569b9a 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 _0xfb5c=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id/download','download','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x29df9a,_0x3d762b){var _0x4e9e89=function(_0x50be63){while(--_0x50be63){_0x29df9a['push'](_0x29df9a['shift']());}};_0x4e9e89(++_0x3d762b);}(_0xfb5c,0x19f));var _0xcfb5=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0xfb5c[_0x16a637];return _0x25126d;};'use strict';var multer=require(_0xcfb5('0x0'));var util=require(_0xcfb5('0x1'));var path=require(_0xcfb5('0x2'));var timeout=require(_0xcfb5('0x3'));var express=require(_0xcfb5('0x4'));var router=express[_0xcfb5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfb5('0x6'));var config=require(_0xcfb5('0x7'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xcfb5('0x8')](),controller['index']);router['get'](_0xcfb5('0x9'),auth['isAuthenticated'](),controller[_0xcfb5('0xa')]);router['get']('/:id',auth[_0xcfb5('0x8')](),controller['show']);router[_0xcfb5('0xb')](_0xcfb5('0xc'),auth['isAuthenticated'](),controller[_0xcfb5('0xd')]);router[_0xcfb5('0xe')]('/',auth[_0xcfb5('0x8')](),controller[_0xcfb5('0xf')]);router['put'](_0xcfb5('0x10'),auth['isAuthenticated'](),controller[_0xcfb5('0x11')]);router['delete']('/:id',auth[_0xcfb5('0x8')](),controller[_0xcfb5('0x12')]);module[_0xcfb5('0x13')]=router; \ No newline at end of file +var _0xa32b=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0xa32b,0xa0));var _0xba32=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0xa32b[_0x2fc113];return _0x5144ce;};'use strict';var multer=require(_0xba32('0x0'));var util=require(_0xba32('0x1'));var path=require(_0xba32('0x2'));var timeout=require(_0xba32('0x3'));var express=require(_0xba32('0x4'));var router=express['Router']();var auth=require(_0xba32('0x5'));var interaction=require(_0xba32('0x6'));var config=require(_0xba32('0x7'));var controller=require('./screenRecording.controller');router[_0xba32('0x8')]('/',auth[_0xba32('0x9')](),controller[_0xba32('0xa')]);router[_0xba32('0x8')](_0xba32('0xb'),auth[_0xba32('0x9')](),controller[_0xba32('0xc')]);router[_0xba32('0x8')](_0xba32('0xd'),auth[_0xba32('0x9')](),controller[_0xba32('0xe')]);router[_0xba32('0x8')](_0xba32('0xf'),auth['isAuthenticated'](),controller[_0xba32('0x10')]);router[_0xba32('0x11')]('/',auth['isAuthenticated'](),controller[_0xba32('0x12')]);router[_0xba32('0x13')](_0xba32('0xd'),auth[_0xba32('0x9')](),controller[_0xba32('0x14')]);router['delete'](_0xba32('0xd'),auth[_0xba32('0x9')](),controller[_0xba32('0x15')]);module[_0xba32('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0195d32..91fe254 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 _0x0e85=['../../config/environment','exports','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','getDataValue','createdAt','toString','updatedAt','sequelize','moment'];(function(_0x14a45d,_0x2a68c1){var _0x4a7d34=function(_0x5b1d76){while(--_0x5b1d76){_0x14a45d['push'](_0x14a45d['shift']());}};_0x4a7d34(++_0x2a68c1);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x50e8('0x0'));var moment=require(_0x50e8('0x1'));var path=require('path');var config=require(_0x50e8('0x2'));module[_0x50e8('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0x50e8('0x4')](this['getDataValue'](_0x50e8('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x50e8('0x6')]},'channel':{'type':Sequelize[_0x50e8('0x6')]},'value':{'type':Sequelize[_0x50e8('0x6')],'set':function(_0x5e8b01){var _0x3ce904=_0x5e8b01[_0x50e8('0x7')](/\\/g,'/');this[_0x50e8('0x8')](_0x50e8('0x5'),_0x3ce904);}},'rating':{'type':Sequelize[_0x50e8('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x50e8('0x9')],'set':function(_0x5825f5){this[_0x50e8('0x8')](_0x50e8('0xa'),moment()[_0x50e8('0xb')](_0x5825f5,'ms'));this[_0x50e8('0x8')](_0x50e8('0xc'),moment());this[_0x50e8('0x8')](_0x50e8('0xd'),_0x5825f5);}},'startedAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0xc')))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0x50e8('0x13')]();}},'updatedAt':{'type':Sequelize[_0x50e8('0xe')],'get':function(){return moment(this[_0x50e8('0x11')](_0x50e8('0x14')))[_0x50e8('0xf')](_0x50e8('0x10'))['toString']();}}}; \ No newline at end of file +var _0x5075=['VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5075,0x73));var _0x5507=function(_0x135fa5,_0x5068d7){_0x135fa5=_0x135fa5-0x0;var _0x40789f=_0x5075[_0x135fa5];return _0x40789f;};'use strict';var Sequelize=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var config=require(_0x5507('0x3'));module[_0x5507('0x4')]={'format':{'type':Sequelize[_0x5507('0x5')],'get':function(){return this[_0x5507('0x6')]('value')?path[_0x5507('0x7')](this[_0x5507('0x6')](_0x5507('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x5507('0x9')],'set':function(_0x773559){var _0x4c2d6d=_0x773559[_0x5507('0xa')](/\\/g,'/');this[_0x5507('0xb')](_0x5507('0x8'),_0x4c2d6d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xe8c49){this[_0x5507('0xb')](_0x5507('0xc'),moment()[_0x5507('0xd')](_0xe8c49,'ms'));this['setDataValue'](_0x5507('0xe'),moment());this[_0x5507('0xb')]('duration',_0xe8c49);}},'startedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')]('startedAt'))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}},'closedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')](_0x5507('0xe')))['format'](_0x5507('0x11'))[_0x5507('0x12')]();}},'createdAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')]('createdAt'))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}},'updatedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')](_0x5507('0x13')))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5ad82f6..2c569dc 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 _0x19d0=['Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','format','%s.cypher','existsSync','secrets','recording','root','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found'];(function(_0x589479,_0x45e1b2){var _0x5a0085=function(_0x32a199){while(--_0x32a199){_0x589479['push'](_0x589479['shift']());}};_0x5a0085(++_0x45e1b2);}(_0x19d0,0xd9));var _0x019d=function(_0x54522f,_0x4c4207){_0x54522f=_0x54522f-0x0;var _0x25fb28=_0x19d0[_0x54522f];return _0x25fb28;};'use strict';var pdf=require(_0x019d('0x0'));var emlformat=require(_0x019d('0x1'));var rimraf=require(_0x019d('0x2'));var zipdir=require(_0x019d('0x3'));var jsonpatch=require(_0x019d('0x4'));var rp=require(_0x019d('0x5'));var moment=require('moment');var BPromise=require(_0x019d('0x6'));var Mustache=require(_0x019d('0x7'));var util=require(_0x019d('0x8'));var path=require(_0x019d('0x9'));var sox=require(_0x019d('0xa'));var csv=require(_0x019d('0xb'));var ejs=require(_0x019d('0xc'));var fs=require('fs');var _=require(_0x019d('0xd'));var squel=require(_0x019d('0xe'));var crypto=require(_0x019d('0xf'));var jsforce=require(_0x019d('0x10'));var deskjs=require(_0x019d('0x11'));var toCsv=require(_0x019d('0xb'));var querystring=require(_0x019d('0x12'));var Papa=require(_0x019d('0x13'));var Redis=require(_0x019d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x019d('0x15'));var as=require(_0x019d('0x16'));var hardwareService=require(_0x019d('0x17'));var logger=require(_0x019d('0x18'))(_0x019d('0x19'));var utils=require(_0x019d('0x1a'));var config=require('../../config/environment');var db=require(_0x019d('0x1b'))['db'];function respondWithStatusCode(_0x5bd73e,_0x2be9b6){_0x2be9b6=_0x2be9b6||0xcc;return function(_0x567bdb){if(_0x567bdb){return _0x5bd73e[_0x019d('0x1c')](_0x2be9b6);}return _0x5bd73e[_0x019d('0x1d')](_0x2be9b6)[_0x019d('0x1e')]();};}function respondWithResult(_0x496aa6,_0x5d20ac){_0x5d20ac=_0x5d20ac||0xc8;return function(_0x9d1131){if(_0x9d1131){return _0x496aa6[_0x019d('0x1d')](_0x5d20ac)['json'](_0x9d1131);}};}function respondWithFilteredResult(_0x42abf4,_0x554384){return function(_0x5d0e2b){if(_0x5d0e2b){var _0x1ebd56=_0x5d0e2b[_0x019d('0x1f')],_0x4a449e=_0x554384['offset'],_0x513a6e=_0x554384[_0x019d('0x20')]+_0x554384['limit'],_0x1c820d;if(_0x513a6e>=_0x1ebd56){_0x513a6e=_0x1ebd56;_0x1c820d=0xc8;}else{_0x1c820d=0xce;}_0x42abf4[_0x019d('0x1d')](_0x1c820d);return _0x42abf4[_0x019d('0x21')](_0x019d('0x22'),_0x4a449e+'-'+_0x513a6e+'/'+_0x1ebd56)['json'](_0x5d0e2b);}return null;};}function patchUpdates(_0x3bd253){return function(_0x1162bf){try{jsonpatch[_0x019d('0x23')](_0x1162bf,_0x3bd253,!![]);}catch(_0x483e6f){return BPromise[_0x019d('0x24')](_0x483e6f);}return _0x1162bf[_0x019d('0x25')]();};}function saveUpdates(_0x332bdd,_0x2d518a){return function(_0xefe9d2){if(_0xefe9d2){return _0xefe9d2[_0x019d('0x26')](_0x332bdd)[_0x019d('0x27')](function(_0x4b56db){return _0x4b56db;});}return null;};}function removeEntity(_0x4ebc9d,_0x4c9ee9){return function(_0x3c3761){if(_0x3c3761){return _0x3c3761['destroy']()['then'](function(){_0x4ebc9d[_0x019d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519f43,_0x1b8756){return function(_0x3f80a8){if(!_0x3f80a8){_0x519f43[_0x019d('0x1c')](0x194);}return _0x3f80a8;};}function handleError(_0x50ebd0,_0x497ee2){_0x497ee2=_0x497ee2||0x1f4;return function(_0x55d7ae){logger[_0x019d('0x28')](_0x55d7ae['stack']);if(_0x55d7ae[_0x019d('0x29')]){delete _0x55d7ae['name'];}_0x50ebd0[_0x019d('0x1d')](_0x497ee2)[_0x019d('0x2a')](_0x55d7ae);};}exports[_0x019d('0x2b')]=function(_0x45079d,_0x3adc49){var _0x22f525={},_0xe375c8={},_0xd01f13={'count':0x0,'rows':[]};var _0x3dca30=_[_0x019d('0x2c')](db[_0x019d('0x2d')]['rawAttributes'],function(_0x53186c){return{'name':_0x53186c[_0x019d('0x2e')],'type':_0x53186c[_0x019d('0x2f')][_0x019d('0x30')]};});_0xe375c8[_0x019d('0x31')]=_[_0x019d('0x32')](_[_0x019d('0x2c')](_0x3dca30,_0x019d('0x29')),['format']);_0xe375c8[_0x019d('0x33')]=_[_0x019d('0x34')](_0x45079d[_0x019d('0x33')]);_0xe375c8[_0x019d('0x35')]=_[_0x019d('0x36')](_0xe375c8['model'],_0xe375c8[_0x019d('0x33')]);_0x22f525[_0x019d('0x37')]=_['intersection'](_0xe375c8[_0x019d('0x31')],qs['fields'](_0x45079d[_0x019d('0x33')][_0x019d('0x38')]));_0x22f525[_0x019d('0x37')]=_0x22f525[_0x019d('0x37')][_0x019d('0x39')]?_0x22f525[_0x019d('0x37')]:_0xe375c8['model'];if(!_0x45079d[_0x019d('0x33')][_0x019d('0x3a')]('nolimit')){_0x22f525[_0x019d('0x3b')]=qs['limit'](_0x45079d[_0x019d('0x33')][_0x019d('0x3b')]);_0x22f525[_0x019d('0x20')]=qs[_0x019d('0x20')](_0x45079d[_0x019d('0x33')][_0x019d('0x20')]);}_0x22f525['order']=qs[_0x019d('0x3c')](_0x45079d['query'][_0x019d('0x3c')]);_0x22f525[_0x019d('0x3d')]=qs[_0x019d('0x35')](_[_0x019d('0x3e')](_0x45079d['query'],_0xe375c8[_0x019d('0x35')]),_0x3dca30);if(_0x45079d[_0x019d('0x33')]['filter']){_0x22f525[_0x019d('0x3d')]=_[_0x019d('0x3f')](_0x22f525['where'],{'$or':_['map'](_0x3dca30,function(_0x1f17c0){if(_0x1f17c0[_0x019d('0x2f')]!==_0x019d('0x40')){var _0x4695de={};_0x4695de[_0x1f17c0[_0x019d('0x29')]]={'$like':'%'+_0x45079d[_0x019d('0x33')][_0x019d('0x41')]+'%'};return _0x4695de;}})});}_0x22f525=_[_0x019d('0x3f')]({},_0x22f525,_0x45079d[_0x019d('0x42')]);var _0x44a054={'where':_0x22f525['where']};return db[_0x019d('0x2d')]['count'](_0x44a054)[_0x019d('0x27')](function(_0x3b2d90){_0xd01f13['count']=_0x3b2d90;if(_0x45079d[_0x019d('0x33')]['includeAll']){_0x22f525['include']=[{'all':!![]}];}return db[_0x019d('0x2d')][_0x019d('0x43')](_0x22f525);})['then'](function(_0x589cf7){_0xd01f13[_0x019d('0x44')]=_0x589cf7;return _0xd01f13;})[_0x019d('0x27')](respondWithFilteredResult(_0x3adc49,_0x22f525))['catch'](handleError(_0x3adc49,null));};exports[_0x019d('0x45')]=function(_0x519150,_0x5bfef1){var _0x747c00={'raw':![],'where':{'id':_0x519150[_0x019d('0x46')]['id']}},_0x5023bc={};_0x5023bc[_0x019d('0x31')]=_['keys'](db[_0x019d('0x2d')]['rawAttributes']);_0x5023bc[_0x019d('0x33')]=_[_0x019d('0x34')](_0x519150[_0x019d('0x33')]);_0x5023bc[_0x019d('0x35')]=_['intersection'](_0x5023bc['model'],_0x5023bc[_0x019d('0x33')]);_0x747c00['attributes']=_[_0x019d('0x36')](_0x5023bc[_0x019d('0x31')],qs[_0x019d('0x38')](_0x519150['query'][_0x019d('0x38')]));_0x747c00[_0x019d('0x37')]=_0x747c00[_0x019d('0x37')][_0x019d('0x39')]?_0x747c00[_0x019d('0x37')]:_0x5023bc['model'];if(_0x519150[_0x019d('0x33')][_0x019d('0x47')]){_0x747c00[_0x019d('0x48')]=[{'all':!![]}];}_0x747c00=_[_0x019d('0x3f')]({},_0x747c00,_0x519150['options']);return db['ScreenRecording'][_0x019d('0x49')](_0x747c00)[_0x019d('0x27')](handleEntityNotFound(_0x5bfef1,null))[_0x019d('0x27')](respondWithResult(_0x5bfef1,null))[_0x019d('0x4a')](handleError(_0x5bfef1,null));};exports['create']=function(_0x274fb2,_0x58b238){return db[_0x019d('0x2d')][_0x019d('0x4b')](_0x274fb2[_0x019d('0x4c')],{})[_0x019d('0x27')](respondWithResult(_0x58b238,0xc9))[_0x019d('0x4a')](handleError(_0x58b238,null));};exports[_0x019d('0x26')]=function(_0x29a2a0,_0x2a3fa5){if(_0x29a2a0[_0x019d('0x4c')]['id']){delete _0x29a2a0[_0x019d('0x4c')]['id'];}delete _0x29a2a0[_0x019d('0x4c')][_0x019d('0x4d')];delete _0x29a2a0['body'][_0x019d('0x4e')];delete _0x29a2a0['body'][_0x019d('0x4f')];delete _0x29a2a0[_0x019d('0x4c')][_0x019d('0x50')];return db[_0x019d('0x2d')][_0x019d('0x49')]({'where':{'id':_0x29a2a0[_0x019d('0x46')]['id']}})[_0x019d('0x27')](handleEntityNotFound(_0x2a3fa5,null))[_0x019d('0x27')](saveUpdates(_0x29a2a0[_0x019d('0x4c')],null))[_0x019d('0x27')](respondWithResult(_0x2a3fa5,null))[_0x019d('0x4a')](handleError(_0x2a3fa5,null));};exports[_0x019d('0x51')]=function(_0x3cb216,_0x56814a){return db[_0x019d('0x2d')][_0x019d('0x51')]()[_0x019d('0x27')](respondWithResult(_0x56814a,null))[_0x019d('0x4a')](handleError(_0x56814a,null));};exports[_0x019d('0x52')]=function(_0x16cf59,_0x8e7279,_0x1137b1){var _0xc05e9c=require(_0x019d('0x53'));var _0x18e47f=![];var _0x1a4551={};if(_0x16cf59[_0x019d('0x33')]['type']&&_0x16cf59[_0x019d('0x33')][_0x019d('0x2f')]===_0x019d('0x54')){_0x1a4551['uniqueid']=_0x16cf59[_0x019d('0x46')]['id'];}else{_0x1a4551['id']=_0x16cf59[_0x019d('0x46')]['id'];}return db[_0x019d('0x2d')][_0x019d('0x49')]({'where':_0x1a4551,'attributes':['id',_0x019d('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x8e7279,null))[_0x019d('0x27')](function(_0x4f0a20){if(_0x4f0a20){var _0x31c459=path[_0x019d('0x55')](config['root'],_0x019d('0x56'),_0x4f0a20['value']);var _0x51db14=util[_0x019d('0x57')](_0x019d('0x58'),_0x31c459);if(fs[_0x019d('0x59')](_0x51db14)){_0x18e47f=!![];return _0xc05e9c['decryptFile'](_0x51db14,_0x31c459,config[_0x019d('0x5a')][_0x019d('0x5b')])['then'](function(){return _0x4f0a20;});}return _0x4f0a20;}})[_0x019d('0x27')](function(_0x227ec0){if(_0x227ec0){var _0x104328=path[_0x019d('0x55')](config[_0x019d('0x5c')],_0x019d('0x56'),_0x227ec0['value']);if(!fs[_0x019d('0x59')](_0x104328)){throw new db[(_0x019d('0x5d'))][(_0x019d('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0x227ec0['filename']){return _0x8e7279[_0x019d('0x52')](_0x104328,_0x227ec0[_0x019d('0x5f')]+path[_0x019d('0x60')](_0x104328),function(){if(_0x18e47f){fs[_0x019d('0x61')](_0x104328);}});}else{return _0x8e7279[_0x019d('0x52')](_0x104328,function(_0x3f033c){if(_0x18e47f){fs[_0x019d('0x61')](_0x104328);}});}}})[_0x019d('0x4a')](function(_0x3a06c5){if(_0x3a06c5[_0x019d('0x62')]===_0x019d('0x63')){_0x8e7279[_0x019d('0x1d')](0x194)['send'](_0x019d('0x64'));}else{return handleError(_0x8e7279,null);}});};exports['destroy']=function(_0x4ec9d6,_0x2ae978){return db['ScreenRecording'][_0x019d('0x49')]({'where':{'id':_0x4ec9d6[_0x019d('0x46')]['id']}})[_0x019d('0x27')](function(_0x1f0a8c){if(!_0x1f0a8c)throw new ReferenceError(_0x019d('0x65'));return _0x1f0a8c;})[_0x019d('0x27')](function(_0x327383){var _0x217e01=path[_0x019d('0x55')](config['root'],_0x019d('0x56'),_0x327383[_0x019d('0x50')]);logger[_0x019d('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x217e01);if(!_[_0x019d('0x67')](_0x327383[_0x019d('0x50')])&&fs[_0x019d('0x59')](_0x217e01)){logger[_0x019d('0x66')](_0x019d('0x68')+_0x217e01+_0x019d('0x69'));fs['unlinkSync'](_0x217e01);}_0x217e01=_0x217e01+'.cypher';if(!_[_0x019d('0x67')](_0x327383[_0x019d('0x50')])&&fs[_0x019d('0x59')](_0x217e01)){logger['info'](_0x019d('0x68')+_0x217e01+_0x019d('0x69'));fs['unlinkSync'](_0x217e01);}return _0x327383;})[_0x019d('0x27')](function(_0x1dee27){if(!_0x1dee27)throw new InternalError();return _0x1dee27['destroy']();})[_0x019d('0x27')](function(){_0x2ae978[_0x019d('0x1d')](0xcc)[_0x019d('0x1e')]();})[_0x019d('0x4a')](handleError(_0x2ae978,null));}; \ No newline at end of file +var _0xc230=['create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','decryptFile','recording','root','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find'];(function(_0x205e56,_0x366e77){var _0x489d5d=function(_0x130a84){while(--_0x130a84){_0x205e56['push'](_0x205e56['shift']());}};_0x489d5d(++_0x366e77);}(_0xc230,0xf3));var _0x0c23=function(_0x4dc0ca,_0x1f4d72){_0x4dc0ca=_0x4dc0ca-0x0;var _0x11b3e1=_0xc230[_0x4dc0ca];return _0x11b3e1;};'use strict';var pdf=require(_0x0c23('0x0'));var emlformat=require(_0x0c23('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0c23('0x2'));var jsonpatch=require(_0x0c23('0x3'));var rp=require(_0x0c23('0x4'));var moment=require(_0x0c23('0x5'));var BPromise=require(_0x0c23('0x6'));var Mustache=require('mustache');var util=require(_0x0c23('0x7'));var path=require(_0x0c23('0x8'));var sox=require(_0x0c23('0x9'));var csv=require(_0x0c23('0xa'));var ejs=require(_0x0c23('0xb'));var fs=require('fs');var _=require(_0x0c23('0xc'));var squel=require(_0x0c23('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c23('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0c23('0xa'));var querystring=require('querystring');var Papa=require(_0x0c23('0xf'));var Redis=require(_0x0c23('0x10'));var authService=require(_0x0c23('0x11'));var qs=require(_0x0c23('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c23('0x13'));var logger=require(_0x0c23('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0c23('0x15'));var db=require(_0x0c23('0x16'))['db'];function respondWithStatusCode(_0x543f85,_0xdafbb){_0xdafbb=_0xdafbb||0xcc;return function(_0x34556d){if(_0x34556d){return _0x543f85[_0x0c23('0x17')](_0xdafbb);}return _0x543f85[_0x0c23('0x18')](_0xdafbb)[_0x0c23('0x19')]();};}function respondWithResult(_0x9bc998,_0x712b92){_0x712b92=_0x712b92||0xc8;return function(_0x513a65){if(_0x513a65){return _0x9bc998[_0x0c23('0x18')](_0x712b92)[_0x0c23('0x1a')](_0x513a65);}};}function respondWithFilteredResult(_0x30c40c,_0x48abfc){return function(_0xad0ebe){if(_0xad0ebe){var _0x15f175=_0xad0ebe[_0x0c23('0x1b')],_0x4fc98d=_0x48abfc[_0x0c23('0x1c')],_0x1ca562=_0x48abfc[_0x0c23('0x1c')]+_0x48abfc[_0x0c23('0x1d')],_0x54f4b8;if(_0x1ca562>=_0x15f175){_0x1ca562=_0x15f175;_0x54f4b8=0xc8;}else{_0x54f4b8=0xce;}_0x30c40c[_0x0c23('0x18')](_0x54f4b8);return _0x30c40c[_0x0c23('0x1e')]('Content-Range',_0x4fc98d+'-'+_0x1ca562+'/'+_0x15f175)[_0x0c23('0x1a')](_0xad0ebe);}return null;};}function patchUpdates(_0x363110){return function(_0x19ace0){try{jsonpatch['apply'](_0x19ace0,_0x363110,!![]);}catch(_0x322416){return BPromise[_0x0c23('0x1f')](_0x322416);}return _0x19ace0[_0x0c23('0x20')]();};}function saveUpdates(_0x1f5741,_0x404c64){return function(_0x5eb0a7){if(_0x5eb0a7){return _0x5eb0a7[_0x0c23('0x21')](_0x1f5741)[_0x0c23('0x22')](function(_0x63c91b){return _0x63c91b;});}return null;};}function removeEntity(_0xb24748,_0x193cc9){return function(_0x2d1cc8){if(_0x2d1cc8){return _0x2d1cc8[_0x0c23('0x23')]()['then'](function(){_0xb24748[_0x0c23('0x18')](0xcc)[_0x0c23('0x19')]();});}};}function handleEntityNotFound(_0x6deb61,_0x548e9d){return function(_0x46438f){if(!_0x46438f){_0x6deb61[_0x0c23('0x17')](0x194);}return _0x46438f;};}function handleError(_0x5ca087,_0xf44f28){_0xf44f28=_0xf44f28||0x1f4;return function(_0x37dac0){logger[_0x0c23('0x24')](_0x37dac0[_0x0c23('0x25')]);if(_0x37dac0[_0x0c23('0x26')]){delete _0x37dac0[_0x0c23('0x26')];}_0x5ca087[_0x0c23('0x18')](_0xf44f28)[_0x0c23('0x27')](_0x37dac0);};}exports[_0x0c23('0x28')]=function(_0x153419,_0x29a3ee){var _0xeb4936={},_0x467ebf={},_0x359577={'count':0x0,'rows':[]};var _0xb3ffe9=_['map'](db[_0x0c23('0x29')][_0x0c23('0x2a')],function(_0x17db52){return{'name':_0x17db52[_0x0c23('0x2b')],'type':_0x17db52['type'][_0x0c23('0x2c')]};});_0x467ebf[_0x0c23('0x2d')]=_[_0x0c23('0x2e')](_['map'](_0xb3ffe9,_0x0c23('0x26')),[_0x0c23('0x2f')]);_0x467ebf[_0x0c23('0x30')]=_[_0x0c23('0x31')](_0x153419[_0x0c23('0x30')]);_0x467ebf['filters']=_[_0x0c23('0x32')](_0x467ebf[_0x0c23('0x2d')],_0x467ebf[_0x0c23('0x30')]);_0xeb4936['attributes']=_['intersection'](_0x467ebf['model'],qs[_0x0c23('0x33')](_0x153419['query'][_0x0c23('0x33')]));_0xeb4936[_0x0c23('0x34')]=_0xeb4936[_0x0c23('0x34')]['length']?_0xeb4936['attributes']:_0x467ebf[_0x0c23('0x2d')];if(!_0x153419[_0x0c23('0x30')][_0x0c23('0x35')](_0x0c23('0x36'))){_0xeb4936[_0x0c23('0x1d')]=qs[_0x0c23('0x1d')](_0x153419['query']['limit']);_0xeb4936[_0x0c23('0x1c')]=qs[_0x0c23('0x1c')](_0x153419[_0x0c23('0x30')][_0x0c23('0x1c')]);}_0xeb4936[_0x0c23('0x37')]=qs['sort'](_0x153419[_0x0c23('0x30')][_0x0c23('0x38')]);_0xeb4936[_0x0c23('0x39')]=qs[_0x0c23('0x3a')](_[_0x0c23('0x3b')](_0x153419['query'],_0x467ebf[_0x0c23('0x3a')]),_0xb3ffe9);if(_0x153419[_0x0c23('0x30')][_0x0c23('0x3c')]){_0xeb4936[_0x0c23('0x39')]=_[_0x0c23('0x3d')](_0xeb4936[_0x0c23('0x39')],{'$or':_[_0x0c23('0x3e')](_0xb3ffe9,function(_0x3239aa){if(_0x3239aa[_0x0c23('0x3f')]!==_0x0c23('0x40')){var _0x1ddd54={};_0x1ddd54[_0x3239aa['name']]={'$like':'%'+_0x153419[_0x0c23('0x30')]['filter']+'%'};return _0x1ddd54;}})});}_0xeb4936=_['merge']({},_0xeb4936,_0x153419[_0x0c23('0x41')]);var _0x5d1cd0={'where':_0xeb4936['where']};return db[_0x0c23('0x29')]['count'](_0x5d1cd0)[_0x0c23('0x22')](function(_0x26572a){_0x359577[_0x0c23('0x1b')]=_0x26572a;if(_0x153419[_0x0c23('0x30')]['includeAll']){_0xeb4936['include']=[{'all':!![]}];}return db[_0x0c23('0x29')][_0x0c23('0x42')](_0xeb4936);})[_0x0c23('0x22')](function(_0x597601){_0x359577[_0x0c23('0x43')]=_0x597601;return _0x359577;})[_0x0c23('0x22')](respondWithFilteredResult(_0x29a3ee,_0xeb4936))[_0x0c23('0x44')](handleError(_0x29a3ee,null));};exports[_0x0c23('0x45')]=function(_0x52fd7a,_0x1752a8){var _0x531003={'raw':![],'where':{'id':_0x52fd7a[_0x0c23('0x46')]['id']}},_0xc65b37={};_0xc65b37[_0x0c23('0x2d')]=_[_0x0c23('0x31')](db[_0x0c23('0x29')]['rawAttributes']);_0xc65b37['query']=_['keys'](_0x52fd7a['query']);_0xc65b37[_0x0c23('0x3a')]=_['intersection'](_0xc65b37['model'],_0xc65b37['query']);_0x531003[_0x0c23('0x34')]=_[_0x0c23('0x32')](_0xc65b37['model'],qs[_0x0c23('0x33')](_0x52fd7a['query'][_0x0c23('0x33')]));_0x531003[_0x0c23('0x34')]=_0x531003[_0x0c23('0x34')][_0x0c23('0x47')]?_0x531003['attributes']:_0xc65b37[_0x0c23('0x2d')];if(_0x52fd7a[_0x0c23('0x30')][_0x0c23('0x48')]){_0x531003[_0x0c23('0x49')]=[{'all':!![]}];}_0x531003=_['merge']({},_0x531003,_0x52fd7a[_0x0c23('0x41')]);return db[_0x0c23('0x29')][_0x0c23('0x4a')](_0x531003)['then'](handleEntityNotFound(_0x1752a8,null))[_0x0c23('0x22')](respondWithResult(_0x1752a8,null))[_0x0c23('0x44')](handleError(_0x1752a8,null));};exports[_0x0c23('0x4b')]=function(_0x40aedc,_0x225980){return db[_0x0c23('0x29')][_0x0c23('0x4b')](_0x40aedc[_0x0c23('0x4c')],{})[_0x0c23('0x22')](respondWithResult(_0x225980,0xc9))[_0x0c23('0x44')](handleError(_0x225980,null));};exports[_0x0c23('0x21')]=function(_0x5c6cec,_0x232fcd){if(_0x5c6cec[_0x0c23('0x4c')]['id']){delete _0x5c6cec[_0x0c23('0x4c')]['id'];}delete _0x5c6cec[_0x0c23('0x4c')][_0x0c23('0x4d')];delete _0x5c6cec[_0x0c23('0x4c')][_0x0c23('0x4e')];delete _0x5c6cec[_0x0c23('0x4c')][_0x0c23('0x4f')];delete _0x5c6cec[_0x0c23('0x4c')][_0x0c23('0x50')];return db['ScreenRecording']['find']({'where':{'id':_0x5c6cec[_0x0c23('0x46')]['id']}})[_0x0c23('0x22')](handleEntityNotFound(_0x232fcd,null))[_0x0c23('0x22')](saveUpdates(_0x5c6cec[_0x0c23('0x4c')],null))[_0x0c23('0x22')](respondWithResult(_0x232fcd,null))[_0x0c23('0x44')](handleError(_0x232fcd,null));};exports[_0x0c23('0x51')]=function(_0x4cef88,_0x427113){return db[_0x0c23('0x29')]['describe']()[_0x0c23('0x22')](respondWithResult(_0x427113,null))[_0x0c23('0x44')](handleError(_0x427113,null));};exports[_0x0c23('0x52')]=function(_0x15deb8,_0x5ac2d1,_0xeb5564){var _0xacd2c4=require(_0x0c23('0x53'));var _0x18a05c=![];var _0x8e3693={};if(_0x15deb8['query']['type']&&_0x15deb8[_0x0c23('0x30')][_0x0c23('0x3f')]===_0x0c23('0x54')){_0x8e3693[_0x0c23('0x54')]=_0x15deb8['params']['id'];}else{_0x8e3693['id']=_0x15deb8['params']['id'];}return db[_0x0c23('0x29')][_0x0c23('0x4a')]({'where':_0x8e3693,'attributes':['id',_0x0c23('0x50')],'raw':!![]})[_0x0c23('0x22')](handleEntityNotFound(_0x5ac2d1,null))[_0x0c23('0x22')](function(_0x8564e4){if(_0x8564e4){var _0x102f16=path[_0x0c23('0x55')](config['root'],_0x0c23('0x56'),_0x8564e4[_0x0c23('0x50')]);var _0x554c54=util[_0x0c23('0x2f')](_0x0c23('0x57'),_0x102f16);if(fs['existsSync'](_0x554c54)){_0x18a05c=!![];return _0xacd2c4[_0x0c23('0x58')](_0x554c54,_0x102f16,config['secrets'][_0x0c23('0x59')])[_0x0c23('0x22')](function(){return _0x8564e4;});}return _0x8564e4;}})[_0x0c23('0x22')](function(_0x56e4a2){if(_0x56e4a2){var _0x19d99a=path['join'](config[_0x0c23('0x5a')],'server/files/screen_recordings',_0x56e4a2[_0x0c23('0x50')]);if(!fs[_0x0c23('0x5b')](_0x19d99a)){throw new db[(_0x0c23('0x5c'))][(_0x0c23('0x5d'))](_0x0c23('0x5e'));}if(_0x56e4a2[_0x0c23('0x5f')]){return _0x5ac2d1['download'](_0x19d99a,_0x56e4a2[_0x0c23('0x5f')]+path[_0x0c23('0x60')](_0x19d99a),function(){if(_0x18a05c){fs['unlink'](_0x19d99a);}});}else{return _0x5ac2d1[_0x0c23('0x52')](_0x19d99a,function(_0x54da95){if(_0x18a05c){fs[_0x0c23('0x61')](_0x19d99a);}});}}})[_0x0c23('0x44')](function(_0x507d3b){if(_0x507d3b['message']===_0x0c23('0x5e')){_0x5ac2d1['status'](0x194)[_0x0c23('0x27')](_0x0c23('0x62'));}else{return handleError(_0x5ac2d1,null);}});};exports[_0x0c23('0x23')]=function(_0x5c8139,_0x2b4d68){return db[_0x0c23('0x29')][_0x0c23('0x4a')]({'where':{'id':_0x5c8139[_0x0c23('0x46')]['id']}})[_0x0c23('0x22')](function(_0x2a0414){if(!_0x2a0414)throw new ReferenceError(_0x0c23('0x63'));return _0x2a0414;})[_0x0c23('0x22')](function(_0x3521bd){var _0x54863b=path['join'](config['root'],_0x0c23('0x56'),_0x3521bd[_0x0c23('0x50')]);logger[_0x0c23('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x54863b);if(!_[_0x0c23('0x65')](_0x3521bd[_0x0c23('0x50')])&&fs[_0x0c23('0x5b')](_0x54863b)){logger[_0x0c23('0x64')](_0x0c23('0x66')+_0x54863b+_0x0c23('0x67'));fs[_0x0c23('0x68')](_0x54863b);}_0x54863b=_0x54863b+_0x0c23('0x69');if(!_[_0x0c23('0x65')](_0x3521bd[_0x0c23('0x50')])&&fs[_0x0c23('0x5b')](_0x54863b)){logger[_0x0c23('0x64')](_0x0c23('0x66')+_0x54863b+_0x0c23('0x67'));fs[_0x0c23('0x68')](_0x54863b);}return _0x3521bd;})[_0x0c23('0x22')](function(_0x2b9e3a){if(!_0x2b9e3a)throw new InternalError();return _0x2b9e3a[_0x0c23('0x23')]();})['then'](function(){_0x2b4d68['status'](0xcc)[_0x0c23('0x19')]();})['catch'](handleError(_0x2b4d68,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c75e7d4..f7d6e0b 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 _0xf076=['rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0xf076,0x13e));var _0x6f07=function(_0x25cdd8,_0x11bc34){_0x25cdd8=_0x25cdd8-0x0;var _0x4ad408=_0xf076[_0x25cdd8];return _0x4ad408;};'use strict';var _=require(_0x6f07('0x0'));var util=require('util');var logger=require(_0x6f07('0x1'))('api');var moment=require(_0x6f07('0x2'));var BPromise=require(_0x6f07('0x3'));var rp=require(_0x6f07('0x4'));var fs=require('fs');var path=require(_0x6f07('0x5'));var rimraf=require(_0x6f07('0x6'));var config=require(_0x6f07('0x7'));var attributes=require(_0x6f07('0x8'));module['exports']=function(_0x4e97f1,_0x391a7a){return _0x4e97f1['define'](_0x6f07('0x9'),attributes,{'tableName':_0x6f07('0xa'),'paranoid':![],'indexes':[{'name':_0x6f07('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf36b=['bluebird','path','rimraf','../../config/environment','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x536a3a,_0x3d2d40){var _0x54d12f=function(_0x2d5257){while(--_0x2d5257){_0x536a3a['push'](_0x536a3a['shift']());}};_0x54d12f(++_0x3d2d40);}(_0xf36b,0x127));var _0xbf36=function(_0x31a6ff,_0x279d48){_0x31a6ff=_0x31a6ff-0x0;var _0x5e6029=_0xf36b[_0x31a6ff];return _0x5e6029;};'use strict';var _=require(_0xbf36('0x0'));var util=require(_0xbf36('0x1'));var logger=require(_0xbf36('0x2'))(_0xbf36('0x3'));var moment=require(_0xbf36('0x4'));var BPromise=require(_0xbf36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf36('0x6'));var rimraf=require(_0xbf36('0x7'));var config=require(_0xbf36('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x431de5,_0x454c36){return _0x431de5['define'](_0xbf36('0x9'),attributes,{'tableName':_0xbf36('0xa'),'paranoid':![],'indexes':[{'name':_0xbf36('0xb'),'fields':[_0xbf36('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f37cb27..50e61b7 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(_0x495cba,_0x4297ba){var _0x15d5b9=function(_0x277d27){while(--_0x277d27){_0x495cba['push'](_0x495cba['shift']());}};_0x15d5b9(++_0x4297ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x26eb2c,_0x34d202){var _0x2fd7fc=function(_0x5614ee){while(--_0x5614ee){_0x26eb2c['push'](_0x26eb2c['shift']());}};_0x2fd7fc(++_0x34d202);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 188b8d7..db762a4 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 _0x0a0a=['get','isAuthenticated','index','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','preferred','addPreferred','favicon','addFavicon','put','/:id','update','multer','path','Router','../../components/auth/service','../../components/interaction/service','./setting.controller'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0x0a0a,0x1bd));var _0xa0a0=function(_0x3c5053,_0x24b2d1){_0x3c5053=_0x3c5053-0x0;var _0x559abd=_0x0a0a[_0x3c5053];return _0x559abd;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require('util');var path=require(_0xa0a0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0a0('0x2')]();var auth=require(_0xa0a0('0x3'));var interaction=require(_0xa0a0('0x4'));var config=require('../../config/environment');var controller=require(_0xa0a0('0x5'));router[_0xa0a0('0x6')]('/',auth[_0xa0a0('0x7')](),controller[_0xa0a0('0x8')]);router[_0xa0a0('0x6')]('/:id',controller[_0xa0a0('0x9')]);router[_0xa0a0('0x6')](_0xa0a0('0xa'),controller[_0xa0a0('0xb')]);router[_0xa0a0('0x6')](_0xa0a0('0xc'),controller[_0xa0a0('0xd')]);router[_0xa0a0('0x6')](_0xa0a0('0xe'),controller[_0xa0a0('0xf')]);router[_0xa0a0('0x6')](_0xa0a0('0x10'),controller[_0xa0a0('0x11')]);router[_0xa0a0('0x6')](_0xa0a0('0x12'),controller[_0xa0a0('0x13')]);var upload=multer({'storage':multer[_0xa0a0('0x14')]({'destination':function(_0x18d5ac,_0x245851,_0x13d8fb){_0x13d8fb(null,path[_0xa0a0('0x15')](config[_0xa0a0('0x16')],_0xa0a0('0x17')));},'filename':function(_0x36f9f3,_0x283322,_0x29048e){_0x29048e(null,util[_0xa0a0('0x18')](_0xa0a0('0x19'),_0xa0a0('0x1a'),path[_0xa0a0('0x1b')](_0x283322[_0xa0a0('0x1c')])));}})});router[_0xa0a0('0x1d')](_0xa0a0('0xa'),upload[_0xa0a0('0x1e')]('file'),controller[_0xa0a0('0x1f')]);var upload=multer({'storage':multer[_0xa0a0('0x14')]({'destination':function(_0x44d963,_0x5d8928,_0x1313d1){_0x1313d1(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3fbcb2,_0x57f8ba,_0x5b712f){_0x5b712f(null,util[_0xa0a0('0x18')](_0xa0a0('0x19'),_0xa0a0('0x20'),path['extname'](_0x57f8ba[_0xa0a0('0x1c')])));}})});router[_0xa0a0('0x1d')](_0xa0a0('0xc'),upload[_0xa0a0('0x1e')](_0xa0a0('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39977e,_0x22f230,_0x28526a){_0x28526a(null,path[_0xa0a0('0x15')](config[_0xa0a0('0x16')],_0xa0a0('0x17')));},'filename':function(_0xc8401f,_0x2a4808,_0x305110){_0x305110(null,util[_0xa0a0('0x18')]('%s%s',_0xa0a0('0x22'),path[_0xa0a0('0x1b')](_0x2a4808[_0xa0a0('0x1c')])));}})});router[_0xa0a0('0x1d')]('/:id/preferred',upload[_0xa0a0('0x1e')]('file'),controller[_0xa0a0('0x23')]);var upload=multer({'storage':multer[_0xa0a0('0x14')]({'destination':function(_0x5a224,_0x278f28,_0x198b25){_0x198b25(null,path[_0xa0a0('0x15')](config[_0xa0a0('0x16')],_0xa0a0('0x17')));},'filename':function(_0x1b0a58,_0x39ee75,_0x33d4ca){_0x33d4ca(null,util[_0xa0a0('0x18')]('%s%s',_0xa0a0('0x24'),path[_0xa0a0('0x1b')](_0x39ee75['originalname'])));}})});router[_0xa0a0('0x1d')](_0xa0a0('0x12'),upload[_0xa0a0('0x1e')](_0xa0a0('0x21')),controller[_0xa0a0('0x25')]);router[_0xa0a0('0x26')](_0xa0a0('0x27'),auth[_0xa0a0('0x7')](),controller[_0xa0a0('0x28')]);module['exports']=router; \ No newline at end of file +var _0x248d=['update','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','single','addLogoLogin','preferred','/:id/preferred','favicon','/:id/favicon','addFavicon','put'];(function(_0x4fd171,_0x55079e){var _0x513dde=function(_0x49e280){while(--_0x49e280){_0x4fd171['push'](_0x4fd171['shift']());}};_0x513dde(++_0x55079e);}(_0x248d,0x185));var _0xd248=function(_0x31264f,_0x1212b0){_0x31264f=_0x31264f-0x0;var _0x54b08d=_0x248d[_0x31264f];return _0x54b08d;};'use strict';var multer=require(_0xd248('0x0'));var util=require(_0xd248('0x1'));var path=require(_0xd248('0x2'));var timeout=require(_0xd248('0x3'));var express=require(_0xd248('0x4'));var router=express[_0xd248('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd248('0x6'));var controller=require(_0xd248('0x7'));router[_0xd248('0x8')]('/',auth[_0xd248('0x9')](),controller[_0xd248('0xa')]);router[_0xd248('0x8')](_0xd248('0xb'),controller[_0xd248('0xc')]);router[_0xd248('0x8')](_0xd248('0xd'),controller[_0xd248('0xe')]);router[_0xd248('0x8')](_0xd248('0xf'),controller[_0xd248('0x10')]);router['get'](_0xd248('0x11'),controller[_0xd248('0x12')]);router['get']('/:id/preferred',controller[_0xd248('0x13')]);router['get']('/:id/favicon',controller[_0xd248('0x14')]);var upload=multer({'storage':multer[_0xd248('0x15')]({'destination':function(_0x53db83,_0x4bbaa9,_0x3da9e1){_0x3da9e1(null,path[_0xd248('0x16')](config[_0xd248('0x17')],_0xd248('0x18')));},'filename':function(_0x300e52,_0x239df2,_0x1ac98d){_0x1ac98d(null,util[_0xd248('0x19')](_0xd248('0x1a'),_0xd248('0x1b'),path[_0xd248('0x1c')](_0x239df2[_0xd248('0x1d')])));}})});router[_0xd248('0x1e')]('/:id/logo',upload['single'](_0xd248('0x1f')),controller[_0xd248('0x20')]);var upload=multer({'storage':multer[_0xd248('0x15')]({'destination':function(_0x2e70b2,_0xf9333c,_0x2c2a6f){_0x2c2a6f(null,path[_0xd248('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2fb8be,_0x3a6db3,_0x29ef85){_0x29ef85(null,util[_0xd248('0x19')]('%s%s','logologin',path['extname'](_0x3a6db3['originalname'])));}})});router['post'](_0xd248('0xf'),upload[_0xd248('0x21')](_0xd248('0x1f')),controller[_0xd248('0x22')]);var upload=multer({'storage':multer[_0xd248('0x15')]({'destination':function(_0x4ee5f3,_0x3b2c1c,_0x3277c){_0x3277c(null,path[_0xd248('0x16')](config[_0xd248('0x17')],_0xd248('0x18')));},'filename':function(_0x21e101,_0x1e5c2b,_0x42168c){_0x42168c(null,util['format']('%s%s',_0xd248('0x23'),path[_0xd248('0x1c')](_0x1e5c2b[_0xd248('0x1d')])));}})});router[_0xd248('0x1e')](_0xd248('0x24'),upload[_0xd248('0x21')](_0xd248('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58dc67,_0x280ba9,_0xdb87cd){_0xdb87cd(null,path[_0xd248('0x16')](config[_0xd248('0x17')],'server/files/images/logos/'));},'filename':function(_0x7893d,_0x5b6c83,_0x33f91a){_0x33f91a(null,util[_0xd248('0x19')]('%s%s',_0xd248('0x25'),path['extname'](_0x5b6c83['originalname'])));}})});router[_0xd248('0x1e')](_0xd248('0x26'),upload['single'](_0xd248('0x1f')),controller[_0xd248('0x27')]);router[_0xd248('0x28')](_0xd248('0xb'),auth['isAuthenticated'](),controller[_0xd248('0x29')]);module[_0xd248('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 610e1cf..766396c 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 _0xec7c=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','exports'];(function(_0x1108d9,_0x524bb1){var _0x5c1af8=function(_0x4bc989){while(--_0x4bc989){_0x1108d9['push'](_0x1108d9['shift']());}};_0x5c1af8(++_0x524bb1);}(_0xec7c,0x172));var _0xcec7=function(_0x428244,_0x45cf14){_0x428244=_0x428244-0x0;var _0x104a2a=_0xec7c[_0x428244];return _0x104a2a;};'use strict';var Sequelize=require('sequelize');module[_0xcec7('0x0')]={'min_internal':{'type':Sequelize[_0xcec7('0x1')](0xb),'unique':_0xcec7('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xcec7('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcec7('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xcec7('0x4')]},'defaultLogo':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcec7('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcec7('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xcec7('0x4')]},'turnusername':{'type':Sequelize[_0xcec7('0x4')]},'turnpassword':{'type':Sequelize[_0xcec7('0x4')]},'pageTitle':{'type':Sequelize[_0xcec7('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcec7('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xcec7('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcec7('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcec7('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xcec7('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xcec7('0x4')]},'defaultPreferred':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcec7('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcec7('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcec7('0x4')]},'defaultFavicon':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcec7('0x1')]},'transcribeRegion':{'type':Sequelize[_0xcec7('0x4')]},'sentiment':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcec7('0x1')]},'sentimentRegion':{'type':Sequelize[_0xcec7('0x4')]},'language':{'type':Sequelize[_0xcec7('0x4')]},'bucket':{'type':Sequelize[_0xcec7('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xcec7('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xebb9=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','INTEGER','min_internal'];(function(_0x3ea89f,_0x2fe99a){var _0xe7cf07=function(_0x3a6e3a){while(--_0x3a6e3a){_0x3ea89f['push'](_0x3ea89f['shift']());}};_0xe7cf07(++_0x2fe99a);}(_0xebb9,0xa8));var _0x9ebb=function(_0x368b04,_0x319b86){_0x368b04=_0x368b04-0x0;var _0x3068d2=_0xebb9[_0x368b04];return _0x3068d2;};'use strict';var Sequelize=require(_0x9ebb('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x9ebb('0x1')](0xb),'unique':_0x9ebb('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9ebb('0x1')](0xb),'unique':_0x9ebb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9ebb('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9ebb('0x4')],'defaultValue':_0x9ebb('0x5')},'logo':{'type':Sequelize[_0x9ebb('0x4')]},'defaultLogo':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9ebb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9ebb('0x4')]},'turnaddr':{'type':Sequelize[_0x9ebb('0x4')]},'turnusername':{'type':Sequelize[_0x9ebb('0x4')]},'turnpassword':{'type':Sequelize[_0x9ebb('0x4')]},'pageTitle':{'type':Sequelize[_0x9ebb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x9ebb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9ebb('0x4')],'defaultValue':_0x9ebb('0x8')},'chatTimeout':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9ebb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9ebb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9ebb('0x4')]},'defaultFavicon':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9ebb('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9ebb('0x1')]},'transcribeRegion':{'type':Sequelize[_0x9ebb('0x4')]},'sentiment':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9ebb('0x1')]},'sentimentRegion':{'type':Sequelize[_0x9ebb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x9ebb('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x9ebb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8c6eed6..cec3c93 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 _0x3624=['name','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultLogo','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','stack'];(function(_0x35d9e6,_0x4e3d91){var _0x40bab4=function(_0x21b2e6){while(--_0x21b2e6){_0x35d9e6['push'](_0x35d9e6['shift']());}};_0x40bab4(++_0x4e3d91);}(_0x3624,0x1a3));var _0x4362=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x3624[_0x197185];return _0x2c8af1;};'use strict';var pdf=require(_0x4362('0x0'));var emlformat=require(_0x4362('0x1'));var rimraf=require(_0x4362('0x2'));var zipdir=require(_0x4362('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4362('0x4'));var moment=require(_0x4362('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4362('0x6'));var util=require('util');var path=require(_0x4362('0x7'));var sox=require(_0x4362('0x8'));var csv=require(_0x4362('0x9'));var ejs=require(_0x4362('0xa'));var fs=require('fs');var _=require(_0x4362('0xb'));var squel=require('squel');var crypto=require(_0x4362('0xc'));var jsforce=require(_0x4362('0xd'));var deskjs=require(_0x4362('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4362('0xf'));var Redis=require(_0x4362('0x10'));var authService=require(_0x4362('0x11'));var qs=require(_0x4362('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4362('0x13'))(_0x4362('0x14'));var utils=require(_0x4362('0x15'));var config=require(_0x4362('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4362('0x17'));var client=jayson[_0x4362('0x18')][_0x4362('0x19')]({'port':0x232a});function checkPasswordPattern(_0x229f4b,_0x5c980e,_0x55516e){if(_0x55516e){var _0x48fa35=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48fa35[_0x4362('0x1a')](_0x5c980e)){return _0x229f4b;}else{throw new db[(_0x4362('0x1b'))][(_0x4362('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 _0x229f4b;}}function respondWithRpcPromise(_0x516b84,_0x5f0cdb,_0x48f7f8,_0x47e758){return new BPromise(function(_0x5b4f7c,_0x4bc59e){var _0x41447c=_0x47e758||client;return _0x41447c[_0x4362('0x1d')](_0x516b84,_0x48f7f8)[_0x4362('0x1e')](function(_0x573a0c){logger[_0x4362('0x1f')](_0x4362('0x20'),_0x5f0cdb,_0x4362('0x21'));logger[_0x4362('0x22')](_0x4362('0x23'),_0x5f0cdb,_0x4362('0x21'),JSON['stringify'](_0x573a0c));if(_0x573a0c[_0x4362('0x24')]){if(_0x573a0c[_0x4362('0x24')][_0x4362('0x25')]===0x1f4){logger[_0x4362('0x24')](_0x4362('0x20'),_0x5f0cdb,_0x573a0c['error'][_0x4362('0x26')]);return _0x4bc59e(_0x573a0c['error'][_0x4362('0x26')]);}logger[_0x4362('0x24')]('Setting,\x20%s,\x20%s',_0x5f0cdb,_0x573a0c[_0x4362('0x24')][_0x4362('0x26')]);return _0x5b4f7c(_0x573a0c[_0x4362('0x24')][_0x4362('0x26')]);}else{logger['info'](_0x4362('0x20'),_0x5f0cdb,_0x4362('0x21'));_0x5b4f7c(_0x573a0c[_0x4362('0x27')][_0x4362('0x26')]);}})['catch'](function(_0x51e3ce){logger[_0x4362('0x24')](_0x4362('0x20'),_0x5f0cdb,_0x51e3ce);_0x4bc59e(_0x51e3ce);});});}function respondWithStatusCode(_0x3b2168,_0x405c06){_0x405c06=_0x405c06||0xcc;return function(_0x57bba8){if(_0x57bba8){return _0x3b2168[_0x4362('0x28')](_0x405c06);}return _0x3b2168['status'](_0x405c06)[_0x4362('0x29')]();};}function respondWithResult(_0x13da63,_0x44efd3){_0x44efd3=_0x44efd3||0xc8;return function(_0x42446b){if(_0x42446b){return _0x13da63[_0x4362('0x2a')](_0x44efd3)[_0x4362('0x2b')](_0x42446b);}};}function respondWithFilteredResult(_0x48d234,_0x522646){return function(_0x502f8f){if(_0x502f8f){var _0xc8e698=_0x502f8f[_0x4362('0x2c')],_0x1be75a=_0x522646['offset'],_0x4fb331=_0x522646[_0x4362('0x2d')]+_0x522646[_0x4362('0x2e')],_0x487790;if(_0x4fb331>=_0xc8e698){_0x4fb331=_0xc8e698;_0x487790=0xc8;}else{_0x487790=0xce;}_0x48d234[_0x4362('0x2a')](_0x487790);return _0x48d234['set'](_0x4362('0x2f'),_0x1be75a+'-'+_0x4fb331+'/'+_0xc8e698)['json'](_0x502f8f);}return null;};}function patchUpdates(_0x24b488){return function(_0x3f91d2){try{jsonpatch[_0x4362('0x30')](_0x3f91d2,_0x24b488,!![]);}catch(_0x17dd18){return BPromise[_0x4362('0x31')](_0x17dd18);}return _0x3f91d2[_0x4362('0x32')]();};}function saveUpdates(_0x4fcff7,_0x496476){return function(_0xda4527){if(_0xda4527){return _0xda4527[_0x4362('0x33')](_0x4fcff7)[_0x4362('0x1e')](function(_0x318c42){return _0x318c42;});}return null;};}function removeEntity(_0x211e24,_0x1388a7){return function(_0x5009ae){if(_0x5009ae){return _0x5009ae['destroy']()[_0x4362('0x1e')](function(){_0x211e24[_0x4362('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e71c4,_0x45f004){return function(_0x192503){if(!_0x192503){_0x1e71c4[_0x4362('0x28')](0x194);}return _0x192503;};}function handleError(_0xff5a13,_0x423ccf){_0x423ccf=_0x423ccf||0x1f4;return function(_0x149528){logger[_0x4362('0x24')](_0x149528[_0x4362('0x34')]);if(_0x149528[_0x4362('0x35')]){delete _0x149528[_0x4362('0x35')];}_0xff5a13[_0x4362('0x2a')](_0x423ccf)['send'](_0x149528);};}exports[_0x4362('0x36')]=function(_0x4445c1,_0x12caa5){var _0x4af3dc={},_0x16594a={},_0x4516b7={'count':0x0,'rows':[]};var _0x41bd09=_[_0x4362('0x37')](db[_0x4362('0x38')][_0x4362('0x39')],function(_0x5218d9){return{'name':_0x5218d9[_0x4362('0x3a')],'type':_0x5218d9[_0x4362('0x3b')][_0x4362('0x3c')]};});_0x16594a['model']=_['map'](_0x41bd09,_0x4362('0x35'));_0x16594a[_0x4362('0x3d')]=_[_0x4362('0x3e')](_0x4445c1[_0x4362('0x3d')]);_0x16594a[_0x4362('0x3f')]=_['intersection'](_0x16594a['model'],_0x16594a[_0x4362('0x3d')]);_0x4af3dc['attributes']=_[_0x4362('0x40')](_0x16594a[_0x4362('0x41')],qs[_0x4362('0x42')](_0x4445c1[_0x4362('0x3d')][_0x4362('0x42')]));_0x4af3dc[_0x4362('0x43')]=_0x4af3dc['attributes']['length']?_0x4af3dc[_0x4362('0x43')]:_0x16594a[_0x4362('0x41')];if(!_0x4445c1['query']['hasOwnProperty']('nolimit')){_0x4af3dc[_0x4362('0x2e')]=qs[_0x4362('0x2e')](_0x4445c1[_0x4362('0x3d')][_0x4362('0x2e')]);_0x4af3dc[_0x4362('0x2d')]=qs[_0x4362('0x2d')](_0x4445c1['query'][_0x4362('0x2d')]);}_0x4af3dc[_0x4362('0x44')]=qs['sort'](_0x4445c1[_0x4362('0x3d')]['sort']);_0x4af3dc[_0x4362('0x45')]=qs['filters'](_[_0x4362('0x46')](_0x4445c1['query'],_0x16594a[_0x4362('0x3f')]),_0x41bd09);if(_0x4445c1[_0x4362('0x3d')][_0x4362('0x47')]){_0x4af3dc[_0x4362('0x45')]=_[_0x4362('0x48')](_0x4af3dc[_0x4362('0x45')],{'$or':_[_0x4362('0x37')](_0x41bd09,function(_0x436a36){if(_0x436a36[_0x4362('0x3b')]!==_0x4362('0x49')){var _0x45cb7f={};_0x45cb7f[_0x436a36['name']]={'$like':'%'+_0x4445c1[_0x4362('0x3d')][_0x4362('0x47')]+'%'};return _0x45cb7f;}})});}_0x4af3dc=_[_0x4362('0x48')]({},_0x4af3dc,_0x4445c1[_0x4362('0x4a')]);var _0x3ea327={'where':_0x4af3dc['where']};return db['Setting'][_0x4362('0x2c')](_0x3ea327)[_0x4362('0x1e')](function(_0x5d4e70){_0x4516b7[_0x4362('0x2c')]=_0x5d4e70;if(_0x4445c1['query'][_0x4362('0x4b')]){_0x4af3dc[_0x4362('0x4c')]=[{'all':!![]}];}return db[_0x4362('0x38')][_0x4362('0x4d')](_0x4af3dc);})['then'](function(_0xfbc739){_0x4516b7['rows']=_0xfbc739;return _0x4516b7;})[_0x4362('0x1e')](respondWithFilteredResult(_0x12caa5,_0x4af3dc))[_0x4362('0x4e')](handleError(_0x12caa5,null));};exports[_0x4362('0x4f')]=function(_0x100161,_0x1bf874){var _0x16ac7e={'raw':![],'where':{'id':_0x100161[_0x4362('0x50')]['id']}},_0x10be58={};_0x10be58[_0x4362('0x41')]=_['keys'](db[_0x4362('0x38')][_0x4362('0x39')]);_0x10be58[_0x4362('0x3d')]=_[_0x4362('0x3e')](_0x100161[_0x4362('0x3d')]);_0x10be58[_0x4362('0x3f')]=_['intersection'](_0x10be58[_0x4362('0x41')],_0x10be58[_0x4362('0x3d')]);_0x16ac7e[_0x4362('0x43')]=_[_0x4362('0x40')](_0x10be58[_0x4362('0x41')],qs[_0x4362('0x42')](_0x100161[_0x4362('0x3d')]['fields']));_0x16ac7e['attributes']=_0x16ac7e['attributes'][_0x4362('0x51')]?_0x16ac7e[_0x4362('0x43')]:_0x10be58[_0x4362('0x41')];if(_0x100161['query'][_0x4362('0x4b')]){_0x16ac7e[_0x4362('0x4c')]=[{'all':!![]}];}_0x16ac7e=_['merge']({},_0x16ac7e,_0x100161[_0x4362('0x4a')]);return db[_0x4362('0x38')][_0x4362('0x52')](_0x16ac7e)[_0x4362('0x1e')](handleEntityNotFound(_0x1bf874,null))[_0x4362('0x1e')](respondWithResult(_0x1bf874,null))['catch'](handleError(_0x1bf874,null));};exports[_0x4362('0x33')]=function(_0x45ac49,_0x1b19f8){if(_0x45ac49[_0x4362('0x53')]['id']){delete _0x45ac49[_0x4362('0x53')]['id'];}return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x45ac49[_0x4362('0x50')]['id']}})[_0x4362('0x1e')](handleEntityNotFound(_0x1b19f8,null))['then'](saveUpdates(_0x45ac49[_0x4362('0x53')],null))[_0x4362('0x1e')](respondWithResult(_0x1b19f8,null))[_0x4362('0x4e')](handleError(_0x1b19f8,null));};exports[_0x4362('0x54')]=function(_0x3c14d3,_0x51e64e,_0x47ab4f){if(_0x3c14d3['file']&&_0x3c14d3[_0x4362('0x55')][_0x4362('0x56')]){_0x3c14d3[_0x4362('0x53')][_0x4362('0x57')]=_0x3c14d3[_0x4362('0x55')][_0x4362('0x56')];}return db[_0x4362('0x38')]['find']({'where':{'id':_0x3c14d3['params']['id']}})['then'](handleEntityNotFound(_0x51e64e,null))[_0x4362('0x1e')](saveUpdates(_0x3c14d3[_0x4362('0x53')],null))['then'](respondWithResult(_0x51e64e,null))[_0x4362('0x4e')](handleError(_0x51e64e,null));};exports['addLogoLogin']=function(_0x4dd2df,_0x393a3c,_0x500747){if(_0x4dd2df[_0x4362('0x55')]&&_0x4dd2df[_0x4362('0x55')]['filename']){_0x4dd2df['body'][_0x4362('0x58')]=_0x4dd2df[_0x4362('0x55')][_0x4362('0x56')];}return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x4dd2df[_0x4362('0x50')]['id']}})[_0x4362('0x1e')](handleEntityNotFound(_0x393a3c,null))[_0x4362('0x1e')](saveUpdates(_0x4dd2df[_0x4362('0x53')],null))['then'](respondWithResult(_0x393a3c,null))['catch'](handleError(_0x393a3c,null));};var utilLicense=require(_0x4362('0x59'));exports[_0x4362('0x5a')]=function(_0xdafdce,_0x5ce319,_0x1c1b37){var _0xd6f217='server/files/images/logos';var _0xad879b={'custom':![]};return utilLicense[_0x4362('0x5b')]()[_0x4362('0x1e')](function(_0x2fd8e5){if(_0x2fd8e5){_0xad879b=_0x2fd8e5;}return db[_0x4362('0x38')]['find']({'where':{'id':_0xdafdce[_0x4362('0x50')]['id']},'attributes':[_0x4362('0x57'),'loginLogo',_0x4362('0x5c'),_0x4362('0x5d'),'defaultLogo',_0x4362('0x5e'),_0x4362('0x5f'),_0x4362('0x60')],'raw':!![]});})[_0x4362('0x1e')](handleEntityNotFound(_0x5ce319,null))[_0x4362('0x1e')](function(_0x1c035b){if(_0x1c035b){var _0x2d94e8=_0x1c035b['logo']&&fs[_0x4362('0x61')](path[_0x4362('0x62')](config[_0x4362('0x63')],_0xd6f217,_[_0x4362('0x64')](_0x1c035b[_0x4362('0x57')])))?path[_0x4362('0x62')](config['root'],_0xd6f217,_[_0x4362('0x64')](_0x1c035b['logo'])):path['join'](config[_0x4362('0x63')],_0xd6f217,_[_0x4362('0x64')]('default_logo.svg'));var _0x51a627='default'+_[_0x4362('0x65')](_0x4362('0x57'));if(_0x1c035b[_0x51a627]||!_0xad879b[_0x4362('0x66')]){_0x2d94e8=path[_0x4362('0x62')](config['root'],_0xd6f217,_[_0x4362('0x64')](_0x4362('0x67')));}if(!fs[_0x4362('0x61')](_0x2d94e8)){throw new db[(_0x4362('0x1b'))][(_0x4362('0x1c'))](_['upperFirst'](_0x4362('0x57'))+_0x4362('0x68'));}return _0x5ce319[_0x4362('0x69')](_0x2d94e8);}})[_0x4362('0x4e')](handleError(_0x5ce319,null));};var utilLicense=require(_0x4362('0x59'));exports[_0x4362('0x6a')]=function(_0x37a5a3,_0x21a85d,_0x14e4c0){var _0x93119=_0x4362('0x6b');var _0x19498a={'custom':![]};return utilLicense[_0x4362('0x5b')]()['then'](function(_0x52b774){if(_0x52b774){_0x19498a=_0x52b774;}return db['Setting'][_0x4362('0x52')]({'where':{'id':_0x37a5a3['params']['id']},'attributes':['logo',_0x4362('0x58'),_0x4362('0x5c'),_0x4362('0x5d'),_0x4362('0x6c'),_0x4362('0x5e'),_0x4362('0x5f'),_0x4362('0x60')],'raw':!![]});})[_0x4362('0x1e')](handleEntityNotFound(_0x21a85d,null))[_0x4362('0x1e')](function(_0x11a3c1){if(_0x11a3c1){var _0x5687ba=_0x11a3c1[_0x4362('0x58')]&&fs[_0x4362('0x61')](path['join'](config[_0x4362('0x63')],_0x93119,_[_0x4362('0x64')](_0x11a3c1[_0x4362('0x58')])))?path[_0x4362('0x62')](config['root'],_0x93119,_[_0x4362('0x64')](_0x11a3c1[_0x4362('0x58')])):path[_0x4362('0x62')](config[_0x4362('0x63')],_0x93119,_['toLower'](_0x4362('0x6d')));var _0x5aeeab=_0x4362('0x6e')+_['upperFirst']('loginLogo');if(_0x11a3c1[_0x5aeeab]||!_0x19498a['custom']){_0x5687ba=path[_0x4362('0x62')](config[_0x4362('0x63')],_0x93119,_[_0x4362('0x64')](_0x4362('0x6d')));}if(!fs[_0x4362('0x61')](_0x5687ba)){throw new db['Sequelize'][(_0x4362('0x1c'))](_[_0x4362('0x65')](_0x4362('0x58'))+'\x20not\x20found');}return _0x21a85d[_0x4362('0x69')](_0x5687ba);}})['catch'](handleError(_0x21a85d,null));};exports[_0x4362('0x6f')]=function(_0x1837be,_0x171747){return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x1837be[_0x4362('0x50')]['id']},'attributes':[_0x4362('0x70')]})[_0x4362('0x1e')](respondWithResult(_0x171747,null))[_0x4362('0x4e')](handleError(_0x171747,null));};exports['addPreferred']=function(_0x342cde,_0x4f079f,_0x384194){if(_0x342cde[_0x4362('0x55')]&&_0x342cde[_0x4362('0x55')][_0x4362('0x56')]){_0x342cde['body'][_0x4362('0x5c')]=_0x342cde['file']['filename'];}return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x342cde[_0x4362('0x50')]['id']}})[_0x4362('0x1e')](handleEntityNotFound(_0x4f079f,null))[_0x4362('0x1e')](saveUpdates(_0x342cde[_0x4362('0x53')],null))[_0x4362('0x1e')](respondWithResult(_0x4f079f,null))[_0x4362('0x4e')](handleError(_0x4f079f,null));};var utilLicense=require('../../config/license/util');exports[_0x4362('0x71')]=function(_0x45a4ae,_0x26e33b,_0x5231bb){var _0x2a64f4=_0x4362('0x6b');var _0x35a397={'custom':![]};return utilLicense[_0x4362('0x5b')]()[_0x4362('0x1e')](function(_0x5a42e7){if(_0x5a42e7){_0x35a397=_0x5a42e7;}return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x45a4ae[_0x4362('0x50')]['id']},'attributes':[_0x4362('0x57'),_0x4362('0x58'),_0x4362('0x5c'),_0x4362('0x5d'),_0x4362('0x6c'),_0x4362('0x5e'),_0x4362('0x5f'),_0x4362('0x60')],'raw':!![]});})[_0x4362('0x1e')](handleEntityNotFound(_0x26e33b,null))[_0x4362('0x1e')](function(_0x37dbdd){if(_0x37dbdd){var _0x5a13df=_0x37dbdd[_0x4362('0x5c')]&&fs[_0x4362('0x61')](path['join'](config[_0x4362('0x63')],_0x2a64f4,_[_0x4362('0x64')](_0x37dbdd[_0x4362('0x5c')])))?path[_0x4362('0x62')](config[_0x4362('0x63')],_0x2a64f4,_[_0x4362('0x64')](_0x37dbdd[_0x4362('0x5c')])):path[_0x4362('0x62')](config[_0x4362('0x63')],_0x2a64f4,_[_0x4362('0x64')](_0x4362('0x72')));var _0x2e692e=_0x4362('0x6e')+_[_0x4362('0x65')](_0x4362('0x5c'));if(_0x37dbdd[_0x2e692e]||!_0x35a397[_0x4362('0x66')]||!_0x35a397[_0x4362('0x5c')]){_0x5a13df=path[_0x4362('0x62')](config[_0x4362('0x63')],_0x2a64f4,_['toLower']('default_preferred.png'));}if(!fs[_0x4362('0x61')](_0x5a13df)){throw new db[(_0x4362('0x1b'))][(_0x4362('0x1c'))](_[_0x4362('0x65')]('preferred')+_0x4362('0x68'));}return _0x26e33b[_0x4362('0x69')](_0x5a13df);}})['catch'](handleError(_0x26e33b,null));};exports[_0x4362('0x73')]=function(_0x198b9b,_0x3aaa59,_0x36ca9f){if(_0x198b9b[_0x4362('0x55')]&&_0x198b9b[_0x4362('0x55')][_0x4362('0x56')]){_0x198b9b[_0x4362('0x53')][_0x4362('0x5d')]=_0x198b9b[_0x4362('0x55')][_0x4362('0x56')];}return db[_0x4362('0x38')]['find']({'where':{'id':_0x198b9b[_0x4362('0x50')]['id']}})[_0x4362('0x1e')](handleEntityNotFound(_0x3aaa59,null))['then'](saveUpdates(_0x198b9b['body'],null))['then'](respondWithResult(_0x3aaa59,null))['catch'](handleError(_0x3aaa59,null));};var utilLicense=require(_0x4362('0x59'));exports[_0x4362('0x74')]=function(_0x33e3b6,_0x23761a,_0x28be73){var _0x340740=_0x4362('0x6b');var _0x2d9ae8={'custom':![]};return utilLicense[_0x4362('0x5b')]()[_0x4362('0x1e')](function(_0x1979b8){if(_0x1979b8){_0x2d9ae8=_0x1979b8;}return db[_0x4362('0x38')][_0x4362('0x52')]({'where':{'id':_0x33e3b6[_0x4362('0x50')]['id']},'attributes':[_0x4362('0x57'),'loginLogo',_0x4362('0x5c'),_0x4362('0x5d'),_0x4362('0x6c'),_0x4362('0x5e'),_0x4362('0x5f'),_0x4362('0x60')],'raw':!![]});})[_0x4362('0x1e')](handleEntityNotFound(_0x23761a,null))[_0x4362('0x1e')](function(_0x49c2a0){if(_0x49c2a0){var _0x24c70d=_0x49c2a0[_0x4362('0x5d')]&&fs[_0x4362('0x61')](path[_0x4362('0x62')](config[_0x4362('0x63')],_0x340740,_['toLower'](_0x49c2a0[_0x4362('0x5d')])))?path[_0x4362('0x62')](config[_0x4362('0x63')],_0x340740,_[_0x4362('0x64')](_0x49c2a0['favicon'])):path[_0x4362('0x62')](config[_0x4362('0x63')],_0x340740,_[_0x4362('0x64')](_0x4362('0x75')));var _0x3062c5=_0x4362('0x6e')+_['upperFirst']('favicon');if(_0x49c2a0[_0x3062c5]||!_0x2d9ae8[_0x4362('0x66')]){_0x24c70d=path['join'](config[_0x4362('0x63')],_0x340740,_[_0x4362('0x64')](_0x4362('0x75')));}if(!fs[_0x4362('0x61')](_0x24c70d)){throw new db[(_0x4362('0x1b'))][(_0x4362('0x1c'))](_[_0x4362('0x65')](_0x4362('0x5d'))+'\x20not\x20found');}return _0x23761a[_0x4362('0x69')](_0x24c70d);}})[_0x4362('0x4e')](handleError(_0x23761a,null));}; \ No newline at end of file +var _0x5c45=['favicon','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','download','getLogoLogin','defaultLogo','existsSync','default_loginLogo.svg','Sequelize','upperFirst','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','sort','pick','filter','where','merge','VIRTUAL','options','Setting','includeAll','include','findAll','rows','params','rawAttributes','fields','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','find','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred'];(function(_0x43a5d8,_0x561c83){var _0x4dd37c=function(_0x49fc27){while(--_0x49fc27){_0x43a5d8['push'](_0x43a5d8['shift']());}};_0x4dd37c(++_0x561c83);}(_0x5c45,0x8a));var _0x55c4=function(_0x1273a7,_0x3a9414){_0x1273a7=_0x1273a7-0x0;var _0x23400f=_0x5c45[_0x1273a7];return _0x23400f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x55c4('0x0'));var zipdir=require(_0x55c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55c4('0x2'));var moment=require(_0x55c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x55c4('0x4'));var util=require(_0x55c4('0x5'));var path=require('path');var sox=require(_0x55c4('0x6'));var csv=require(_0x55c4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x55c4('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x55c4('0x9'));var toCsv=require(_0x55c4('0x7'));var querystring=require(_0x55c4('0xa'));var Papa=require(_0x55c4('0xb'));var Redis=require('ioredis');var authService=require(_0x55c4('0xc'));var qs=require(_0x55c4('0xd'));var as=require(_0x55c4('0xe'));var hardwareService=require(_0x55c4('0xf'));var logger=require(_0x55c4('0x10'))(_0x55c4('0x11'));var utils=require(_0x55c4('0x12'));var config=require(_0x55c4('0x13'));var db=require(_0x55c4('0x14'))['db'];var jayson=require(_0x55c4('0x15'));var client=jayson[_0x55c4('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x1cf7c1,_0x1e26e3,_0xe2f31c){if(_0xe2f31c){var _0x1bfdf6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bfdf6['test'](_0x1e26e3)){return _0x1cf7c1;}else{throw new db['Sequelize'][(_0x55c4('0x17'))](_0x55c4('0x18'));}}else{return _0x1cf7c1;}}function respondWithRpcPromise(_0x18a5b8,_0x108b46,_0x420d1e,_0x142f0a){return new BPromise(function(_0x4a801d,_0x3f2397){var _0x7dd1a7=_0x142f0a||client;return _0x7dd1a7[_0x55c4('0x19')](_0x18a5b8,_0x420d1e)[_0x55c4('0x1a')](function(_0x4981cb){logger[_0x55c4('0x1b')](_0x55c4('0x1c'),_0x108b46,_0x55c4('0x1d'));logger[_0x55c4('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x108b46,_0x55c4('0x1d'),JSON[_0x55c4('0x1f')](_0x4981cb));if(_0x4981cb[_0x55c4('0x20')]){if(_0x4981cb[_0x55c4('0x20')]['code']===0x1f4){logger['error'](_0x55c4('0x1c'),_0x108b46,_0x4981cb[_0x55c4('0x20')][_0x55c4('0x21')]);return _0x3f2397(_0x4981cb[_0x55c4('0x20')]['message']);}logger[_0x55c4('0x20')](_0x55c4('0x1c'),_0x108b46,_0x4981cb[_0x55c4('0x20')]['message']);return _0x4a801d(_0x4981cb[_0x55c4('0x20')][_0x55c4('0x21')]);}else{logger[_0x55c4('0x1b')]('Setting,\x20%s,\x20%s',_0x108b46,_0x55c4('0x1d'));_0x4a801d(_0x4981cb['result'][_0x55c4('0x21')]);}})[_0x55c4('0x22')](function(_0x58391e){logger['error'](_0x55c4('0x1c'),_0x108b46,_0x58391e);_0x3f2397(_0x58391e);});});}function respondWithStatusCode(_0x8c633,_0x20487d){_0x20487d=_0x20487d||0xcc;return function(_0x359522){if(_0x359522){return _0x8c633[_0x55c4('0x23')](_0x20487d);}return _0x8c633[_0x55c4('0x24')](_0x20487d)[_0x55c4('0x25')]();};}function respondWithResult(_0x52169f,_0x3ad249){_0x3ad249=_0x3ad249||0xc8;return function(_0x506e3a){if(_0x506e3a){return _0x52169f[_0x55c4('0x24')](_0x3ad249)[_0x55c4('0x26')](_0x506e3a);}};}function respondWithFilteredResult(_0x50365c,_0x18914b){return function(_0x2f35ed){if(_0x2f35ed){var _0x57c88c=_0x2f35ed[_0x55c4('0x27')],_0x31f4dc=_0x18914b[_0x55c4('0x28')],_0x3a7435=_0x18914b[_0x55c4('0x28')]+_0x18914b[_0x55c4('0x29')],_0x50b57c;if(_0x3a7435>=_0x57c88c){_0x3a7435=_0x57c88c;_0x50b57c=0xc8;}else{_0x50b57c=0xce;}_0x50365c[_0x55c4('0x24')](_0x50b57c);return _0x50365c[_0x55c4('0x2a')](_0x55c4('0x2b'),_0x31f4dc+'-'+_0x3a7435+'/'+_0x57c88c)['json'](_0x2f35ed);}return null;};}function patchUpdates(_0xec0fef){return function(_0x3910e4){try{jsonpatch[_0x55c4('0x2c')](_0x3910e4,_0xec0fef,!![]);}catch(_0xbe1c4a){return BPromise[_0x55c4('0x2d')](_0xbe1c4a);}return _0x3910e4[_0x55c4('0x2e')]();};}function saveUpdates(_0x565b57,_0x23a9e2){return function(_0x712c6a){if(_0x712c6a){return _0x712c6a[_0x55c4('0x2f')](_0x565b57)[_0x55c4('0x1a')](function(_0x40a211){return _0x40a211;});}return null;};}function removeEntity(_0x33c6c0,_0x6c10d4){return function(_0x376e93){if(_0x376e93){return _0x376e93['destroy']()['then'](function(){_0x33c6c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x596945,_0x1f8154){return function(_0x7d2d5f){if(!_0x7d2d5f){_0x596945[_0x55c4('0x23')](0x194);}return _0x7d2d5f;};}function handleError(_0x30a403,_0x380084){_0x380084=_0x380084||0x1f4;return function(_0x50594a){logger[_0x55c4('0x20')](_0x50594a[_0x55c4('0x30')]);if(_0x50594a['name']){delete _0x50594a[_0x55c4('0x31')];}_0x30a403[_0x55c4('0x24')](_0x380084)[_0x55c4('0x32')](_0x50594a);};}exports[_0x55c4('0x33')]=function(_0x5b065a,_0x1dbc9d){var _0x1027bc={},_0x5c5d67={},_0x5e973a={'count':0x0,'rows':[]};var _0x542b33=_[_0x55c4('0x34')](db['Setting']['rawAttributes'],function(_0x59229b){return{'name':_0x59229b[_0x55c4('0x35')],'type':_0x59229b[_0x55c4('0x36')][_0x55c4('0x37')]};});_0x5c5d67[_0x55c4('0x38')]=_[_0x55c4('0x34')](_0x542b33,_0x55c4('0x31'));_0x5c5d67[_0x55c4('0x39')]=_[_0x55c4('0x3a')](_0x5b065a[_0x55c4('0x39')]);_0x5c5d67[_0x55c4('0x3b')]=_[_0x55c4('0x3c')](_0x5c5d67['model'],_0x5c5d67['query']);_0x1027bc[_0x55c4('0x3d')]=_[_0x55c4('0x3c')](_0x5c5d67[_0x55c4('0x38')],qs['fields'](_0x5b065a['query']['fields']));_0x1027bc['attributes']=_0x1027bc[_0x55c4('0x3d')]['length']?_0x1027bc[_0x55c4('0x3d')]:_0x5c5d67['model'];if(!_0x5b065a[_0x55c4('0x39')]['hasOwnProperty']('nolimit')){_0x1027bc[_0x55c4('0x29')]=qs[_0x55c4('0x29')](_0x5b065a[_0x55c4('0x39')][_0x55c4('0x29')]);_0x1027bc['offset']=qs[_0x55c4('0x28')](_0x5b065a['query'][_0x55c4('0x28')]);}_0x1027bc['order']=qs[_0x55c4('0x3e')](_0x5b065a[_0x55c4('0x39')]['sort']);_0x1027bc['where']=qs[_0x55c4('0x3b')](_[_0x55c4('0x3f')](_0x5b065a['query'],_0x5c5d67[_0x55c4('0x3b')]),_0x542b33);if(_0x5b065a[_0x55c4('0x39')][_0x55c4('0x40')]){_0x1027bc[_0x55c4('0x41')]=_[_0x55c4('0x42')](_0x1027bc[_0x55c4('0x41')],{'$or':_[_0x55c4('0x34')](_0x542b33,function(_0x113250){if(_0x113250['type']!==_0x55c4('0x43')){var _0x172838={};_0x172838[_0x113250[_0x55c4('0x31')]]={'$like':'%'+_0x5b065a[_0x55c4('0x39')][_0x55c4('0x40')]+'%'};return _0x172838;}})});}_0x1027bc=_[_0x55c4('0x42')]({},_0x1027bc,_0x5b065a[_0x55c4('0x44')]);var _0x3cd305={'where':_0x1027bc[_0x55c4('0x41')]};return db[_0x55c4('0x45')]['count'](_0x3cd305)[_0x55c4('0x1a')](function(_0x2427d5){_0x5e973a[_0x55c4('0x27')]=_0x2427d5;if(_0x5b065a['query'][_0x55c4('0x46')]){_0x1027bc[_0x55c4('0x47')]=[{'all':!![]}];}return db[_0x55c4('0x45')][_0x55c4('0x48')](_0x1027bc);})[_0x55c4('0x1a')](function(_0x1259ad){_0x5e973a[_0x55c4('0x49')]=_0x1259ad;return _0x5e973a;})[_0x55c4('0x1a')](respondWithFilteredResult(_0x1dbc9d,_0x1027bc))['catch'](handleError(_0x1dbc9d,null));};exports['show']=function(_0x28b51b,_0xfef26e){var _0x111323={'raw':![],'where':{'id':_0x28b51b[_0x55c4('0x4a')]['id']}},_0x9b4f09={};_0x9b4f09[_0x55c4('0x38')]=_[_0x55c4('0x3a')](db[_0x55c4('0x45')][_0x55c4('0x4b')]);_0x9b4f09['query']=_[_0x55c4('0x3a')](_0x28b51b[_0x55c4('0x39')]);_0x9b4f09[_0x55c4('0x3b')]=_[_0x55c4('0x3c')](_0x9b4f09['model'],_0x9b4f09['query']);_0x111323[_0x55c4('0x3d')]=_[_0x55c4('0x3c')](_0x9b4f09[_0x55c4('0x38')],qs[_0x55c4('0x4c')](_0x28b51b[_0x55c4('0x39')][_0x55c4('0x4c')]));_0x111323[_0x55c4('0x3d')]=_0x111323[_0x55c4('0x3d')]['length']?_0x111323['attributes']:_0x9b4f09['model'];if(_0x28b51b[_0x55c4('0x39')][_0x55c4('0x46')]){_0x111323[_0x55c4('0x47')]=[{'all':!![]}];}_0x111323=_[_0x55c4('0x42')]({},_0x111323,_0x28b51b['options']);return db['Setting']['find'](_0x111323)['then'](handleEntityNotFound(_0xfef26e,null))[_0x55c4('0x1a')](respondWithResult(_0xfef26e,null))['catch'](handleError(_0xfef26e,null));};exports[_0x55c4('0x2f')]=function(_0xccecb1,_0x5632e2){if(_0xccecb1[_0x55c4('0x4d')]['id']){delete _0xccecb1[_0x55c4('0x4d')]['id'];}return db[_0x55c4('0x45')]['find']({'where':{'id':_0xccecb1[_0x55c4('0x4a')]['id']}})[_0x55c4('0x1a')](handleEntityNotFound(_0x5632e2,null))['then'](saveUpdates(_0xccecb1[_0x55c4('0x4d')],null))[_0x55c4('0x1a')](respondWithResult(_0x5632e2,null))[_0x55c4('0x22')](handleError(_0x5632e2,null));};exports[_0x55c4('0x4e')]=function(_0x2ebc60,_0x8f0105,_0x14e5d6){if(_0x2ebc60['file']&&_0x2ebc60[_0x55c4('0x4f')]['filename']){_0x2ebc60[_0x55c4('0x4d')][_0x55c4('0x50')]=_0x2ebc60[_0x55c4('0x4f')][_0x55c4('0x51')];}return db[_0x55c4('0x45')]['find']({'where':{'id':_0x2ebc60['params']['id']}})[_0x55c4('0x1a')](handleEntityNotFound(_0x8f0105,null))[_0x55c4('0x1a')](saveUpdates(_0x2ebc60[_0x55c4('0x4d')],null))[_0x55c4('0x1a')](respondWithResult(_0x8f0105,null))[_0x55c4('0x22')](handleError(_0x8f0105,null));};exports[_0x55c4('0x52')]=function(_0x23eac3,_0x2c8cb0,_0x44ce86){if(_0x23eac3[_0x55c4('0x4f')]&&_0x23eac3['file'][_0x55c4('0x51')]){_0x23eac3[_0x55c4('0x4d')][_0x55c4('0x53')]=_0x23eac3['file'][_0x55c4('0x51')];}return db['Setting'][_0x55c4('0x54')]({'where':{'id':_0x23eac3[_0x55c4('0x4a')]['id']}})[_0x55c4('0x1a')](handleEntityNotFound(_0x2c8cb0,null))['then'](saveUpdates(_0x23eac3[_0x55c4('0x4d')],null))[_0x55c4('0x1a')](respondWithResult(_0x2c8cb0,null))['catch'](handleError(_0x2c8cb0,null));};var utilLicense=require(_0x55c4('0x55'));exports[_0x55c4('0x56')]=function(_0x40343b,_0xf26dc2,_0x539a63){var _0x7b27d2=_0x55c4('0x57');var _0x4a2367={'custom':![]};return utilLicense[_0x55c4('0x58')]()['then'](function(_0x147967){if(_0x147967){_0x4a2367=_0x147967;}return db[_0x55c4('0x45')]['find']({'where':{'id':_0x40343b[_0x55c4('0x4a')]['id']},'attributes':['logo',_0x55c4('0x53'),_0x55c4('0x59'),_0x55c4('0x5a'),'defaultLogo','defaultLoginLogo',_0x55c4('0x5b'),_0x55c4('0x5c')],'raw':!![]});})[_0x55c4('0x1a')](handleEntityNotFound(_0xf26dc2,null))[_0x55c4('0x1a')](function(_0x5570dd){if(_0x5570dd){var _0x2087bd=_0x5570dd[_0x55c4('0x50')]&&fs['existsSync'](path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x7b27d2,_[_0x55c4('0x5f')](_0x5570dd[_0x55c4('0x50')])))?path[_0x55c4('0x5d')](config['root'],_0x7b27d2,_[_0x55c4('0x5f')](_0x5570dd['logo'])):path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x7b27d2,_['toLower'](_0x55c4('0x60')));var _0x833f61=_0x55c4('0x61')+_['upperFirst'](_0x55c4('0x50'));if(_0x5570dd[_0x833f61]||!_0x4a2367[_0x55c4('0x62')]){_0x2087bd=path['join'](config[_0x55c4('0x5e')],_0x7b27d2,_[_0x55c4('0x5f')](_0x55c4('0x60')));}if(!fs['existsSync'](_0x2087bd)){throw new db['Sequelize'][(_0x55c4('0x17'))](_['upperFirst'](_0x55c4('0x50'))+'\x20not\x20found');}return _0xf26dc2[_0x55c4('0x63')](_0x2087bd);}})[_0x55c4('0x22')](handleError(_0xf26dc2,null));};var utilLicense=require(_0x55c4('0x55'));exports[_0x55c4('0x64')]=function(_0x58fd90,_0x29fe5c,_0x21a770){var _0x3ff563='server/files/images/logos';var _0x21780a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x6626e8){if(_0x6626e8){_0x21780a=_0x6626e8;}return db[_0x55c4('0x45')][_0x55c4('0x54')]({'where':{'id':_0x58fd90[_0x55c4('0x4a')]['id']},'attributes':[_0x55c4('0x50'),'loginLogo',_0x55c4('0x59'),_0x55c4('0x5a'),_0x55c4('0x65'),'defaultLoginLogo',_0x55c4('0x5b'),_0x55c4('0x5c')],'raw':!![]});})[_0x55c4('0x1a')](handleEntityNotFound(_0x29fe5c,null))['then'](function(_0x45d284){if(_0x45d284){var _0x4eb2e3=_0x45d284['loginLogo']&&fs[_0x55c4('0x66')](path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x3ff563,_['toLower'](_0x45d284['loginLogo'])))?path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x3ff563,_[_0x55c4('0x5f')](_0x45d284[_0x55c4('0x53')])):path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x3ff563,_[_0x55c4('0x5f')](_0x55c4('0x67')));var _0x4c259e=_0x55c4('0x61')+_['upperFirst'](_0x55c4('0x53'));if(_0x45d284[_0x4c259e]||!_0x21780a[_0x55c4('0x62')]){_0x4eb2e3=path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x3ff563,_[_0x55c4('0x5f')](_0x55c4('0x67')));}if(!fs[_0x55c4('0x66')](_0x4eb2e3)){throw new db[(_0x55c4('0x68'))][(_0x55c4('0x17'))](_[_0x55c4('0x69')](_0x55c4('0x53'))+_0x55c4('0x6a'));}return _0x29fe5c[_0x55c4('0x63')](_0x4eb2e3);}})['catch'](handleError(_0x29fe5c,null));};exports[_0x55c4('0x6b')]=function(_0x4e9d65,_0x23aad9){return db['Setting'][_0x55c4('0x54')]({'where':{'id':_0x4e9d65[_0x55c4('0x4a')]['id']},'attributes':[_0x55c4('0x6c')]})[_0x55c4('0x1a')](respondWithResult(_0x23aad9,null))['catch'](handleError(_0x23aad9,null));};exports[_0x55c4('0x6d')]=function(_0x58274e,_0x7bf2df,_0x226462){if(_0x58274e[_0x55c4('0x4f')]&&_0x58274e[_0x55c4('0x4f')][_0x55c4('0x51')]){_0x58274e['body'][_0x55c4('0x59')]=_0x58274e[_0x55c4('0x4f')][_0x55c4('0x51')];}return db[_0x55c4('0x45')][_0x55c4('0x54')]({'where':{'id':_0x58274e[_0x55c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7bf2df,null))[_0x55c4('0x1a')](saveUpdates(_0x58274e[_0x55c4('0x4d')],null))[_0x55c4('0x1a')](respondWithResult(_0x7bf2df,null))['catch'](handleError(_0x7bf2df,null));};var utilLicense=require('../../config/license/util');exports[_0x55c4('0x6e')]=function(_0x4ccc0f,_0x599b0a,_0x4925cb){var _0x10ec67=_0x55c4('0x57');var _0x1754f3={'custom':![]};return utilLicense[_0x55c4('0x58')]()[_0x55c4('0x1a')](function(_0x479b84){if(_0x479b84){_0x1754f3=_0x479b84;}return db['Setting'][_0x55c4('0x54')]({'where':{'id':_0x4ccc0f[_0x55c4('0x4a')]['id']},'attributes':[_0x55c4('0x50'),_0x55c4('0x53'),_0x55c4('0x59'),'favicon',_0x55c4('0x65'),_0x55c4('0x6f'),'defaultPreferred',_0x55c4('0x5c')],'raw':!![]});})[_0x55c4('0x1a')](handleEntityNotFound(_0x599b0a,null))[_0x55c4('0x1a')](function(_0xb2e6c2){if(_0xb2e6c2){var _0x75b3c9=_0xb2e6c2[_0x55c4('0x59')]&&fs[_0x55c4('0x66')](path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x10ec67,_['toLower'](_0xb2e6c2['preferred'])))?path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x10ec67,_[_0x55c4('0x5f')](_0xb2e6c2['preferred'])):path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x10ec67,_['toLower']('default_preferred.png'));var _0x20b2a5='default'+_[_0x55c4('0x69')](_0x55c4('0x59'));if(_0xb2e6c2[_0x20b2a5]||!_0x1754f3[_0x55c4('0x62')]||!_0x1754f3['preferred']){_0x75b3c9=path['join'](config[_0x55c4('0x5e')],_0x10ec67,_['toLower'](_0x55c4('0x70')));}if(!fs[_0x55c4('0x66')](_0x75b3c9)){throw new db[(_0x55c4('0x68'))][(_0x55c4('0x17'))](_[_0x55c4('0x69')]('preferred')+_0x55c4('0x6a'));}return _0x599b0a[_0x55c4('0x63')](_0x75b3c9);}})[_0x55c4('0x22')](handleError(_0x599b0a,null));};exports[_0x55c4('0x71')]=function(_0x1a0733,_0xedea14,_0x332405){if(_0x1a0733[_0x55c4('0x4f')]&&_0x1a0733[_0x55c4('0x4f')]['filename']){_0x1a0733[_0x55c4('0x4d')][_0x55c4('0x5a')]=_0x1a0733[_0x55c4('0x4f')][_0x55c4('0x51')];}return db[_0x55c4('0x45')]['find']({'where':{'id':_0x1a0733[_0x55c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0xedea14,null))[_0x55c4('0x1a')](saveUpdates(_0x1a0733[_0x55c4('0x4d')],null))[_0x55c4('0x1a')](respondWithResult(_0xedea14,null))[_0x55c4('0x22')](handleError(_0xedea14,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x27eb8a,_0x2eb3b9,_0x2a2606){var _0x150316=_0x55c4('0x57');var _0x4ae000={'custom':![]};return utilLicense[_0x55c4('0x58')]()[_0x55c4('0x1a')](function(_0x5b1eeb){if(_0x5b1eeb){_0x4ae000=_0x5b1eeb;}return db[_0x55c4('0x45')][_0x55c4('0x54')]({'where':{'id':_0x27eb8a[_0x55c4('0x4a')]['id']},'attributes':[_0x55c4('0x50'),_0x55c4('0x53'),_0x55c4('0x59'),_0x55c4('0x5a'),_0x55c4('0x65'),_0x55c4('0x6f'),_0x55c4('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x55c4('0x1a')](handleEntityNotFound(_0x2eb3b9,null))['then'](function(_0x13b198){if(_0x13b198){var _0x208bc6=_0x13b198[_0x55c4('0x5a')]&&fs[_0x55c4('0x66')](path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x150316,_[_0x55c4('0x5f')](_0x13b198['favicon'])))?path['join'](config['root'],_0x150316,_[_0x55c4('0x5f')](_0x13b198[_0x55c4('0x5a')])):path[_0x55c4('0x5d')](config['root'],_0x150316,_[_0x55c4('0x5f')]('default_favicon.ico'));var _0x33bff1=_0x55c4('0x61')+_[_0x55c4('0x69')](_0x55c4('0x5a'));if(_0x13b198[_0x33bff1]||!_0x4ae000['custom']){_0x208bc6=path[_0x55c4('0x5d')](config[_0x55c4('0x5e')],_0x150316,_['toLower']('default_favicon.ico'));}if(!fs[_0x55c4('0x66')](_0x208bc6)){throw new db[(_0x55c4('0x68'))][(_0x55c4('0x17'))](_[_0x55c4('0x69')]('favicon')+_0x55c4('0x6a'));}return _0x2eb3b9[_0x55c4('0x63')](_0x208bc6);}})[_0x55c4('0x22')](handleError(_0x2eb3b9,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 151d619..674afcf 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 _0x5898=['moment','bluebird','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','util','api'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x5898,0x1ad));var _0x8589=function(_0x109946,_0x3494b7){_0x109946=_0x109946-0x0;var _0x4ed20b=_0x5898[_0x109946];return _0x4ed20b;};'use strict';var _=require(_0x8589('0x0'));var util=require(_0x8589('0x1'));var logger=require('../../config/logger')(_0x8589('0x2'));var moment=require(_0x8589('0x3'));var BPromise=require(_0x8589('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8589('0x5'));var config=require(_0x8589('0x6'));var attributes=require(_0x8589('0x7'));module[_0x8589('0x8')]=function(_0x5627e9,_0x25ca22){return _0x5627e9[_0x8589('0x9')](_0x8589('0xa'),attributes,{'tableName':_0x8589('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x434e=['./setting.attributes','exports','define','Setting','settings','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5670f4,_0x2c2c31){var _0x2afcf1=function(_0x279fe4){while(--_0x279fe4){_0x5670f4['push'](_0x5670f4['shift']());}};_0x2afcf1(++_0x2c2c31);}(_0x434e,0x131));var _0xe434=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x434e[_0x4c73ac];return _0x9839ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe434('0x0'))('api');var moment=require(_0xe434('0x1'));var BPromise=require(_0xe434('0x2'));var rp=require(_0xe434('0x3'));var fs=require('fs');var path=require(_0xe434('0x4'));var rimraf=require(_0xe434('0x5'));var config=require(_0xe434('0x6'));var attributes=require(_0xe434('0x7'));module[_0xe434('0x8')]=function(_0xad39d3,_0x4117e0){return _0xad39d3[_0xe434('0x9')](_0xe434('0xa'),attributes,{'tableName':_0xe434('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 90d59b4..71f1d7a 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 _0x653b=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xcc0f32,_0x36ff70){var _0x501c02=function(_0x116cac){while(--_0x116cac){_0xcc0f32['push'](_0xcc0f32['shift']());}};_0x501c02(++_0x36ff70);}(_0x653b,0x1e7));var _0xb653=function(_0x279c42,_0x33614d){_0x279c42=_0x279c42-0x0;var _0x52eecf=_0x653b[_0x279c42];return _0x52eecf;};'use strict';var _=require('lodash');var util=require(_0xb653('0x0'));var moment=require('moment');var BPromise=require(_0xb653('0x1'));var rs=require(_0xb653('0x2'));var fs=require('fs');var Redis=require(_0xb653('0x3'));var db=require(_0xb653('0x4'))['db'];var utils=require(_0xb653('0x5'));var logger=require(_0xb653('0x6'))(_0xb653('0x7'));var config=require(_0xb653('0x8'));var jayson=require(_0xb653('0x9'));var client=jayson[_0xb653('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8fdb,_0x23603f,_0x99d3d0){return new BPromise(function(_0x568db3,_0x3330d3){return client[_0xb653('0xb')](_0x2f8fdb,_0x99d3d0)[_0xb653('0xc')](function(_0x5e1bed){logger[_0xb653('0xd')](_0xb653('0xe'),_0x23603f,_0xb653('0xf'));logger[_0xb653('0x10')](_0xb653('0x11'),_0x23603f,_0xb653('0xf'),JSON[_0xb653('0x12')](_0x5e1bed));if(_0x5e1bed[_0xb653('0x13')]){if(_0x5e1bed[_0xb653('0x13')][_0xb653('0x14')]===0x1f4){logger[_0xb653('0x13')](_0xb653('0xe'),_0x23603f,_0x5e1bed[_0xb653('0x13')]['message']);return _0x3330d3(_0x5e1bed['error'][_0xb653('0x15')]);}logger['error']('Setting,\x20%s,\x20%s',_0x23603f,_0x5e1bed[_0xb653('0x13')][_0xb653('0x15')]);return _0x568db3(_0x5e1bed[_0xb653('0x13')]['message']);}else{logger[_0xb653('0xd')]('Setting,\x20%s,\x20%s',_0x23603f,_0xb653('0xf'));_0x568db3(_0x5e1bed[_0xb653('0x16')][_0xb653('0x15')]);}})[_0xb653('0x17')](function(_0xd3f984){logger[_0xb653('0x13')](_0xb653('0xe'),_0x23603f,_0xd3f984);_0x3330d3(_0xd3f984);});});} \ No newline at end of file +var _0x30fb=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result'];(function(_0x52945b,_0x103a28){var _0x3820e6=function(_0x4a231f){while(--_0x4a231f){_0x52945b['push'](_0x52945b['shift']());}};_0x3820e6(++_0x103a28);}(_0x30fb,0xf3));var _0xb30f=function(_0x1d60d0,_0x2cfa88){_0x1d60d0=_0x1d60d0-0x0;var _0x1a0917=_0x30fb[_0x1d60d0];return _0x1a0917;};'use strict';var _=require(_0xb30f('0x0'));var util=require(_0xb30f('0x1'));var moment=require(_0xb30f('0x2'));var BPromise=require(_0xb30f('0x3'));var rs=require(_0xb30f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb30f('0x5'))['db'];var utils=require(_0xb30f('0x6'));var logger=require('../../config/logger')(_0xb30f('0x7'));var config=require('../../config/environment');var jayson=require(_0xb30f('0x8'));var client=jayson[_0xb30f('0x9')][_0xb30f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51520e,_0x3e25ed,_0x5b80a0){return new BPromise(function(_0x4e3b43,_0x37d94f){return client['request'](_0x51520e,_0x5b80a0)[_0xb30f('0xb')](function(_0x5b3018){logger[_0xb30f('0xc')](_0xb30f('0xd'),_0x3e25ed,'request\x20sent');logger[_0xb30f('0xe')](_0xb30f('0xf'),_0x3e25ed,_0xb30f('0x10'),JSON['stringify'](_0x5b3018));if(_0x5b3018['error']){if(_0x5b3018['error'][_0xb30f('0x11')]===0x1f4){logger[_0xb30f('0x12')]('Setting,\x20%s,\x20%s',_0x3e25ed,_0x5b3018[_0xb30f('0x12')][_0xb30f('0x13')]);return _0x37d94f(_0x5b3018[_0xb30f('0x12')]['message']);}logger[_0xb30f('0x12')]('Setting,\x20%s,\x20%s',_0x3e25ed,_0x5b3018[_0xb30f('0x12')][_0xb30f('0x13')]);return _0x4e3b43(_0x5b3018[_0xb30f('0x12')][_0xb30f('0x13')]);}else{logger['info'](_0xb30f('0xd'),_0x3e25ed,'request\x20sent');_0x4e3b43(_0x5b3018[_0xb30f('0x14')][_0xb30f('0x13')]);}})[_0xb30f('0x15')](function(_0x19b0b1){logger[_0xb30f('0x12')]('Setting,\x20%s,\x20%s',_0x3e25ed,_0x19b0b1);_0x37d94f(_0x19b0b1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8246d8d..c92b78f 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 _0x2bf4=['/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','update','delete','/:id/dispositions','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x2bf4,0x117));var _0x42bf=function(_0xe924a5,_0x1bf7f2){_0xe924a5=_0xe924a5-0x0;var _0x5e464f=_0x2bf4[_0xe924a5];return _0x5e464f;};'use strict';var multer=require('multer');var util=require(_0x42bf('0x0'));var path=require(_0x42bf('0x1'));var timeout=require(_0x42bf('0x2'));var express=require(_0x42bf('0x3'));var router=express[_0x42bf('0x4')]();var auth=require(_0x42bf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsAccount.controller');router[_0x42bf('0x6')]('/',auth[_0x42bf('0x7')](),controller['index']);router[_0x42bf('0x6')](_0x42bf('0x8'),auth[_0x42bf('0x7')](),controller['describe']);router['get'](_0x42bf('0x9'),auth['isAuthenticated'](),controller[_0x42bf('0xa')]);router[_0x42bf('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x42bf('0xb')]);router[_0x42bf('0x6')](_0x42bf('0xc'),auth[_0x42bf('0x7')](),controller[_0x42bf('0xd')]);router[_0x42bf('0x6')](_0x42bf('0xe'),auth[_0x42bf('0x7')](),controller[_0x42bf('0xf')]);router[_0x42bf('0x6')](_0x42bf('0x10'),auth[_0x42bf('0x7')](),controller[_0x42bf('0x11')]);router[_0x42bf('0x6')](_0x42bf('0x12'),controller[_0x42bf('0x13')]);router['get'](_0x42bf('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x42bf('0x15')]('/',auth['isAuthenticated'](),controller[_0x42bf('0x16')]);router[_0x42bf('0x15')]('/:id/dispositions',auth[_0x42bf('0x7')](),controller['addDisposition']);router[_0x42bf('0x15')](_0x42bf('0xc'),auth[_0x42bf('0x7')](),controller[_0x42bf('0x17')]);router['post'](_0x42bf('0x18'),controller[_0x42bf('0x19')]);router[_0x42bf('0x15')](_0x42bf('0xe'),auth[_0x42bf('0x7')](),controller[_0x42bf('0x1a')]);router[_0x42bf('0x15')](_0x42bf('0x1b'),auth[_0x42bf('0x7')](),controller[_0x42bf('0x1c')]);router[_0x42bf('0x15')](_0x42bf('0x12'),controller[_0x42bf('0x1d')]);router['post'](_0x42bf('0x14'),auth[_0x42bf('0x7')](),controller['addAgents']);router['put']('/:id',auth[_0x42bf('0x7')](),controller[_0x42bf('0x1e')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x42bf('0x1f')](_0x42bf('0x20'),auth[_0x42bf('0x7')](),controller[_0x42bf('0x21')]);router[_0x42bf('0x1f')](_0x42bf('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x42bf('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x42bf('0x22')]);module[_0x42bf('0x23')]=router; \ No newline at end of file +var _0x74b1=['addAnswer','notify','/:id/applications','addApplications','/:id/send','send','status','addAgents','put','delete','removeAgents','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','create','addDisposition'];(function(_0x35dfe6,_0x4244fa){var _0x59651c=function(_0x3ff137){while(--_0x3ff137){_0x35dfe6['push'](_0x35dfe6['shift']());}};_0x59651c(++_0x4244fa);}(_0x74b1,0x134));var _0x174b=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x74b1[_0x24679e];return _0x291f21;};'use strict';var multer=require(_0x174b('0x0'));var util=require('util');var path=require(_0x174b('0x1'));var timeout=require('connect-timeout');var express=require(_0x174b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x174b('0x3'));var config=require(_0x174b('0x4'));var controller=require('./smsAccount.controller');router[_0x174b('0x5')]('/',auth['isAuthenticated'](),controller[_0x174b('0x6')]);router[_0x174b('0x5')](_0x174b('0x7'),auth[_0x174b('0x8')](),controller[_0x174b('0x9')]);router['get'](_0x174b('0xa'),auth[_0x174b('0x8')](),controller[_0x174b('0xb')]);router[_0x174b('0x5')](_0x174b('0xc'),auth[_0x174b('0x8')](),controller[_0x174b('0xd')]);router[_0x174b('0x5')](_0x174b('0xe'),auth[_0x174b('0x8')](),controller[_0x174b('0xf')]);router['get']('/:id/applications',auth[_0x174b('0x8')](),controller[_0x174b('0x10')]);router['get'](_0x174b('0x11'),auth['isAuthenticated'](),controller[_0x174b('0x12')]);router[_0x174b('0x5')](_0x174b('0x13'),controller['statusGet']);router['get'](_0x174b('0x14'),auth[_0x174b('0x8')](),controller[_0x174b('0x15')]);router[_0x174b('0x16')]('/',auth[_0x174b('0x8')](),controller[_0x174b('0x17')]);router[_0x174b('0x16')](_0x174b('0xc'),auth[_0x174b('0x8')](),controller[_0x174b('0x18')]);router[_0x174b('0x16')]('/:id/canned_answers',auth[_0x174b('0x8')](),controller[_0x174b('0x19')]);router[_0x174b('0x16')]('/:id/notify',controller[_0x174b('0x1a')]);router[_0x174b('0x16')](_0x174b('0x1b'),auth[_0x174b('0x8')](),controller[_0x174b('0x1c')]);router[_0x174b('0x16')](_0x174b('0x1d'),auth[_0x174b('0x8')](),controller[_0x174b('0x1e')]);router[_0x174b('0x16')]('/:id/status',controller[_0x174b('0x1f')]);router[_0x174b('0x16')](_0x174b('0x14'),auth[_0x174b('0x8')](),controller[_0x174b('0x20')]);router[_0x174b('0x21')]('/:id',auth[_0x174b('0x8')](),controller['update']);router['delete'](_0x174b('0xa'),auth[_0x174b('0x8')](),controller['destroy']);router[_0x174b('0x22')](_0x174b('0xc'),auth[_0x174b('0x8')](),controller['removeDispositions']);router[_0x174b('0x22')](_0x174b('0xe'),auth[_0x174b('0x8')](),controller['removeAnswers']);router[_0x174b('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x174b('0x23')]);module[_0x174b('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index fd33678..af33e31 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 _0x37a5=['name','generate','skebby','connectel','clickatell','csc','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x30f9a3,_0x5b6d20){var _0x4aad40=function(_0x298dd9){while(--_0x298dd9){_0x30f9a3['push'](_0x30f9a3['shift']());}};_0x4aad40(++_0x5b6d20);}(_0x37a5,0x12d));var _0x537a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x37a5[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x537a('0x0'));module[_0x537a('0x1')]={'name':{'type':Sequelize[_0x537a('0x2')],'unique':_0x537a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x537a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x537a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x537a('0x2')],'defaultValue':function(){return rs[_0x537a('0x4')]();}},'phone':{'type':Sequelize[_0x537a('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x537a('0x5'),_0x537a('0x6'),'clicksend','plivo',_0x537a('0x7'),_0x537a('0x8'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x537a('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x537a('0x2')]},'smsMethod':{'type':Sequelize[_0x537a('0x9')]('SI','TI','GP')},'username':{'type':Sequelize[_0x537a('0x2')]},'password':{'type':Sequelize[_0x537a('0x2')]},'apiKey':{'type':Sequelize[_0x537a('0x2')]},'senderString':{'type':Sequelize[_0x537a('0x2')]},'deliveryReport':{'type':Sequelize[_0x537a('0xa')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x537a('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x537a('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x537a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x537a('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x537a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x537a('0xb')],'comment':_0x537a('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x537a('0xa')],'defaultValue':![],'comment':_0x537a('0xd'),'set':function(_0x1a2228){if(!_0x1a2228)this[_0x537a('0xe')]('mandatoryDispositionPauseId',null);this[_0x537a('0xe')](_0x537a('0xf'),_0x1a2228);}}}; \ No newline at end of file +var _0xf577=['plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','generate','ENUM','twilio','skebby','clicksend'];(function(_0x2cd231,_0x38c859){var _0x4ca8a5=function(_0x6e5ddf){while(--_0x6e5ddf){_0x2cd231['push'](_0x2cd231['shift']());}};_0x4ca8a5(++_0x38c859);}(_0xf577,0x174));var _0x7f57=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf577[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7f57('0x0'));module[_0x7f57('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x7f57('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7f57('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x7f57('0x2')],'defaultValue':function(){return rs[_0x7f57('0x3')]();}},'phone':{'type':Sequelize[_0x7f57('0x2')]},'type':{'type':Sequelize[_0x7f57('0x4')](_0x7f57('0x5'),_0x7f57('0x6'),'connectel',_0x7f57('0x7'),_0x7f57('0x8'),_0x7f57('0x9'),_0x7f57('0xa'),_0x7f57('0xb'),_0x7f57('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7f57('0x2')]},'smsMethod':{'type':Sequelize[_0x7f57('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7f57('0x2')]},'apiKey':{'type':Sequelize[_0x7f57('0x2')]},'senderString':{'type':Sequelize[_0x7f57('0x2')]},'deliveryReport':{'type':Sequelize[_0x7f57('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7f57('0xe')],'defaultValue':function(){return _0x7f57('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7f57('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f57('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7f57('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f57('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f57('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7f57('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7f57('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x7f57('0xd')],'defaultValue':![],'comment':_0x7f57('0x12'),'set':function(_0x2bfe50){if(!_0x2bfe50)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x7f57('0x13')]('mandatoryDisposition',_0x2bfe50);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 44a2549..1529536 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x57408b,_0xb7cbc5){var _0x31a897=function(_0x5810ac){while(--_0x5810ac){_0x57408b['push'](_0x57408b['shift']());}};_0x31a897(++_0xb7cbc5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2f1b49e..2e86c0f 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 _0x02c9=['remove','emit','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x23b1da,_0x47d7c0){var _0x3e499b=function(_0x5228d6){while(--_0x5228d6){_0x23b1da['push'](_0x23b1da['shift']());}};_0x3e499b(++_0x47d7c0);}(_0x02c9,0x1b2));var _0x902c=function(_0xe7e47a,_0xc46860){_0xe7e47a=_0xe7e47a-0x0;var _0x2b0be4=_0x02c9[_0xe7e47a];return _0x2b0be4;};'use strict';var EventEmitter=require(_0x902c('0x0'));var SmsAccount=require(_0x902c('0x1'))['db'][_0x902c('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x902c('0x3')](0x0);var events={'afterCreate':_0x902c('0x4'),'afterUpdate':_0x902c('0x5'),'afterDestroy':_0x902c('0x6')};function emitEvent(_0x1e09f6){return function(_0x3dc673,_0x250fc5,_0x11f995){SmsAccountEvents[_0x902c('0x7')](_0x1e09f6+':'+_0x3dc673['id'],_0x3dc673);SmsAccountEvents[_0x902c('0x7')](_0x1e09f6,_0x3dc673);_0x11f995(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x902c('0x8')](e,emitEvent(event));}}module[_0x902c('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7468=['hasOwnProperty','events','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0x7468,0x151));var _0x8746=function(_0x343b36,_0xb49ba5){_0x343b36=_0x343b36-0x0;var _0x3274c9=_0x7468[_0x343b36];return _0x3274c9;};'use strict';var EventEmitter=require(_0x8746('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8746('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8746('0x2')](0x0);var events={'afterCreate':_0x8746('0x3'),'afterUpdate':_0x8746('0x4'),'afterDestroy':_0x8746('0x5')};function emitEvent(_0x585750){return function(_0x3c50a8,_0x264a54,_0x4cb5d0){SmsAccountEvents['emit'](_0x585750+':'+_0x3c50a8['id'],_0x3c50a8);SmsAccountEvents[_0x8746('0x6')](_0x585750,_0x3c50a8);_0x4cb5d0(null);};}for(var e in events){if(events[_0x8746('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d5ff291..a7a4bbb 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x181f8f,_0x286591){var _0x5b915f=function(_0x5c92d0){while(--_0x5c92d0){_0x181f8f['push'](_0x181f8f['shift']());}};_0x5b915f(++_0x286591);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x49d9d0,_0x55a0dd){var _0x2fd880=function(_0x8832f8){while(--_0x8832f8){_0x49d9d0['push'](_0x49d9d0['shift']());}};_0x2fd880(++_0x55a0dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index ca25aa7..32d2569 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 _0x6825=['client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','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','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x10df9c,_0x577cf6){var _0x4cd508=function(_0x4fe9a5){while(--_0x4fe9a5){_0x10df9c['push'](_0x10df9c['shift']());}};_0x4cd508(++_0x577cf6);}(_0x6825,0x1cb));var _0x5682=function(_0x4b55f6,_0x3c2166){_0x4b55f6=_0x4b55f6-0x0;var _0x4fab94=_0x6825[_0x4b55f6];return _0x4fab94;};'use strict';var _=require(_0x5682('0x0'));var util=require(_0x5682('0x1'));var moment=require(_0x5682('0x2'));var BPromise=require('bluebird');var rs=require(_0x5682('0x3'));var fs=require('fs');var Redis=require(_0x5682('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5682('0x5'))(_0x5682('0x6'));var config=require(_0x5682('0x7'));var jayson=require(_0x5682('0x8'));var client=jayson[_0x5682('0x9')][_0x5682('0xa')]({'port':0x232a});config[_0x5682('0xb')]=_[_0x5682('0xc')](config['redis'],{'host':_0x5682('0xd'),'port':0x18eb});var socket=require(_0x5682('0xe'))(new Redis(config['redis']));require(_0x5682('0xf'))[_0x5682('0x10')](socket);function respondWithRpcPromise(_0x14f55f,_0x55d60a,_0x3c6b48){return new BPromise(function(_0x324aa8,_0x43e7c4){return client['request'](_0x14f55f,_0x3c6b48)[_0x5682('0x11')](function(_0x40a406){logger[_0x5682('0x12')](_0x5682('0x13'),_0x55d60a,_0x5682('0x14'));logger[_0x5682('0x15')](_0x5682('0x16'),_0x55d60a,_0x5682('0x14'),JSON[_0x5682('0x17')](_0x40a406));if(_0x40a406[_0x5682('0x18')]){if(_0x40a406[_0x5682('0x18')][_0x5682('0x19')]===0x1f4){logger[_0x5682('0x18')](_0x5682('0x13'),_0x55d60a,_0x40a406[_0x5682('0x18')]['message']);return _0x43e7c4(_0x40a406[_0x5682('0x18')][_0x5682('0x1a')]);}logger['error'](_0x5682('0x13'),_0x55d60a,_0x40a406[_0x5682('0x18')][_0x5682('0x1a')]);return _0x324aa8(_0x40a406[_0x5682('0x18')][_0x5682('0x1a')]);}else{logger[_0x5682('0x12')](_0x5682('0x13'),_0x55d60a,_0x5682('0x14'));_0x324aa8(_0x40a406[_0x5682('0x1b')][_0x5682('0x1a')]);}})['catch'](function(_0xf6a02e){logger['error']('SmsAccount,\x20%s,\x20%s',_0x55d60a,_0xf6a02e);_0x43e7c4(_0xf6a02e);});});}exports[_0x5682('0x1c')]=function(_0x13247a){var _0x5244ed=this;return new Promise(function(_0x5ba79d,_0x2ee5b1){return db[_0x5682('0x1d')][_0x5682('0x1e')]({'raw':_0x13247a['options']?_0x13247a[_0x5682('0x1f')][_0x5682('0x20')]===undefined?!![]:![]:!![],'where':_0x13247a[_0x5682('0x1f')]?_0x13247a['options'][_0x5682('0x21')]||null:null,'attributes':_0x13247a[_0x5682('0x1f')]?_0x13247a[_0x5682('0x1f')][_0x5682('0x22')]||null:null,'include':_0x13247a[_0x5682('0x1f')]?_0x13247a['options'][_0x5682('0x23')]?_[_0x5682('0x24')](_0x13247a[_0x5682('0x1f')]['include'],function(_0x32e923){return{'model':db[_0x32e923[_0x5682('0x25')]],'as':_0x32e923['as'],'attributes':_0x32e923['attributes'],'include':_0x32e923[_0x5682('0x23')]?_[_0x5682('0x24')](_0x32e923[_0x5682('0x23')],function(_0xcc2fe3){return{'model':db[_0xcc2fe3[_0x5682('0x25')]],'as':_0xcc2fe3['as'],'attributes':_0xcc2fe3[_0x5682('0x22')],'include':_0xcc2fe3[_0x5682('0x23')]?_[_0x5682('0x24')](_0xcc2fe3[_0x5682('0x23')],function(_0x2ffe07){return{'model':db[_0x2ffe07[_0x5682('0x25')]],'as':_0x2ffe07['as'],'attributes':_0x2ffe07['attributes']};}):[]};}):[]};}):[]:[]})[_0x5682('0x11')](function(_0x9dc6fc){logger[_0x5682('0x12')]('ShowSmsAccount',_0x13247a);logger['debug'](_0x5682('0x1c'),_0x13247a,JSON[_0x5682('0x17')](_0x9dc6fc));_0x5ba79d(_0x9dc6fc);})[_0x5682('0x26')](function(_0xaa4f4d){logger['error'](_0x5682('0x1c'),_0xaa4f4d[_0x5682('0x1a')],_0x13247a);_0x2ee5b1(_0x5244ed[_0x5682('0x18')](0x1f4,_0xaa4f4d['message']));});});}; \ No newline at end of file +var _0x3441=['model','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include'];(function(_0x5f0f0a,_0x70f959){var _0x6c59a=function(_0x3bd915){while(--_0x3bd915){_0x5f0f0a['push'](_0x5f0f0a['shift']());}};_0x6c59a(++_0x70f959);}(_0x3441,0xa2));var _0x1344=function(_0x3056b4,_0xf25203){_0x3056b4=_0x3056b4-0x0;var _0x2f68b4=_0x3441[_0x3056b4];return _0x2f68b4;};'use strict';var _=require('lodash');var util=require(_0x1344('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1344('0x1'));var db=require(_0x1344('0x2'))['db'];var utils=require(_0x1344('0x3'));var logger=require(_0x1344('0x4'))('rpc');var config=require(_0x1344('0x5'));var jayson=require(_0x1344('0x6'));var client=jayson[_0x1344('0x7')][_0x1344('0x8')]({'port':0x232a});config[_0x1344('0x9')]=_['defaults'](config[_0x1344('0x9')],{'host':_0x1344('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1344('0x9')]));require(_0x1344('0xb'))[_0x1344('0xc')](socket);function respondWithRpcPromise(_0x2db608,_0x2ff4d7,_0x420109){return new BPromise(function(_0x53f4d0,_0x4d0581){return client['request'](_0x2db608,_0x420109)[_0x1344('0xd')](function(_0x46458d){logger[_0x1344('0xe')](_0x1344('0xf'),_0x2ff4d7,'request\x20sent');logger[_0x1344('0x10')](_0x1344('0x11'),_0x2ff4d7,_0x1344('0x12'),JSON[_0x1344('0x13')](_0x46458d));if(_0x46458d[_0x1344('0x14')]){if(_0x46458d['error']['code']===0x1f4){logger[_0x1344('0x14')](_0x1344('0xf'),_0x2ff4d7,_0x46458d[_0x1344('0x14')][_0x1344('0x15')]);return _0x4d0581(_0x46458d['error'][_0x1344('0x15')]);}logger[_0x1344('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2ff4d7,_0x46458d[_0x1344('0x14')][_0x1344('0x15')]);return _0x53f4d0(_0x46458d[_0x1344('0x14')]['message']);}else{logger[_0x1344('0xe')](_0x1344('0xf'),_0x2ff4d7,_0x1344('0x12'));_0x53f4d0(_0x46458d[_0x1344('0x16')][_0x1344('0x15')]);}})['catch'](function(_0x22c817){logger[_0x1344('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2ff4d7,_0x22c817);_0x4d0581(_0x22c817);});});}exports[_0x1344('0x17')]=function(_0x1265c4){var _0x545978=this;return new Promise(function(_0x1ae1a1,_0x57e1e8){return db[_0x1344('0x18')]['find']({'raw':_0x1265c4[_0x1344('0x19')]?_0x1265c4[_0x1344('0x19')][_0x1344('0x1a')]===undefined?!![]:![]:!![],'where':_0x1265c4[_0x1344('0x19')]?_0x1265c4[_0x1344('0x19')][_0x1344('0x1b')]||null:null,'attributes':_0x1265c4[_0x1344('0x19')]?_0x1265c4[_0x1344('0x19')][_0x1344('0x1c')]||null:null,'include':_0x1265c4['options']?_0x1265c4[_0x1344('0x19')][_0x1344('0x1d')]?_['map'](_0x1265c4[_0x1344('0x19')][_0x1344('0x1d')],function(_0x48747b){return{'model':db[_0x48747b[_0x1344('0x1e')]],'as':_0x48747b['as'],'attributes':_0x48747b[_0x1344('0x1c')],'include':_0x48747b[_0x1344('0x1d')]?_['map'](_0x48747b[_0x1344('0x1d')],function(_0x764165){return{'model':db[_0x764165[_0x1344('0x1e')]],'as':_0x764165['as'],'attributes':_0x764165[_0x1344('0x1c')],'include':_0x764165['include']?_['map'](_0x764165[_0x1344('0x1d')],function(_0x18d017){return{'model':db[_0x18d017[_0x1344('0x1e')]],'as':_0x18d017['as'],'attributes':_0x18d017[_0x1344('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1344('0xd')](function(_0x287d00){logger['info'](_0x1344('0x17'),_0x1265c4);logger[_0x1344('0x10')]('ShowSmsAccount',_0x1265c4,JSON[_0x1344('0x13')](_0x287d00));_0x1ae1a1(_0x287d00);})[_0x1344('0x1f')](function(_0x12095f){logger['error'](_0x1344('0x17'),_0x12095f['message'],_0x1265c4);_0x57e1e8(_0x545978['error'](0x1f4,_0x12095f[_0x1344('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 543b1ac..553307d 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 _0xfaa6=['./smsAccount.events','save','remove','update','emit','length','smsAccount:'];(function(_0x3ff8bf,_0x28cf97){var _0xe7295d=function(_0x5639fc){while(--_0x5639fc){_0x3ff8bf['push'](_0x3ff8bf['shift']());}};_0xe7295d(++_0x28cf97);}(_0xfaa6,0xbd));var _0x6faa=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xfaa6[_0x5f519b];return _0x2461e2;};'use strict';var SmsAccountEvents=require(_0x6faa('0x0'));var events=[_0x6faa('0x1'),_0x6faa('0x2'),_0x6faa('0x3')];function createListener(_0x20529d,_0x57eb19){return function(_0x3f9f16){_0x57eb19[_0x6faa('0x4')](_0x20529d,_0x3f9f16);};}function removeListener(_0x14fbd3,_0x372c17){return function(){SmsAccountEvents['removeListener'](_0x14fbd3,_0x372c17);};}exports['register']=function(_0x370ebc){for(var _0x4e6b8b=0x0,_0x229c57=events[_0x6faa('0x5')];_0x4e6b8b<_0x229c57;_0x4e6b8b++){var _0x27195c=events[_0x4e6b8b];var _0x874022=createListener(_0x6faa('0x6')+_0x27195c,_0x370ebc);SmsAccountEvents['on'](_0x27195c,_0x874022);}}; \ No newline at end of file +var _0x9809=['./smsAccount.events','save','remove','update','removeListener','register','length'];(function(_0x402817,_0x437548){var _0x3bba11=function(_0x5d65cb){while(--_0x5d65cb){_0x402817['push'](_0x402817['shift']());}};_0x3bba11(++_0x437548);}(_0x9809,0x1b2));var _0x9980=function(_0xdecb75,_0x3abacc){_0xdecb75=_0xdecb75-0x0;var _0x1ad0e0=_0x9809[_0xdecb75];return _0x1ad0e0;};'use strict';var SmsAccountEvents=require(_0x9980('0x0'));var events=[_0x9980('0x1'),_0x9980('0x2'),_0x9980('0x3')];function createListener(_0x5c7eab,_0x65648c){return function(_0x1e537b){_0x65648c['emit'](_0x5c7eab,_0x1e537b);};}function removeListener(_0x11305e,_0x3f772d){return function(){SmsAccountEvents[_0x9980('0x4')](_0x11305e,_0x3f772d);};}exports[_0x9980('0x5')]=function(_0x333cf2){for(var _0x225429=0x0,_0x25d908=events[_0x9980('0x6')];_0x225429<_0x25d908;_0x225429++){var _0x63bf6b=events[_0x225429];var _0x4fc0be=createListener('smsAccount:'+_0x63bf6b,_0x333cf2);SmsAccountEvents['on'](_0x63bf6b,_0x4fc0be);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 0539939..445db5f 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 _0x7ddd=['get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','./smsApplication.controller'];(function(_0x536e0c,_0x1cc916){var _0x20e2ad=function(_0x27cf20){while(--_0x27cf20){_0x536e0c['push'](_0x536e0c['shift']());}};_0x20e2ad(++_0x1cc916);}(_0x7ddd,0x180));var _0xd7dd=function(_0x11b918,_0xff7fa8){_0x11b918=_0x11b918-0x0;var _0x23acd5=_0x7ddd[_0x11b918];return _0x23acd5;};'use strict';var multer=require(_0xd7dd('0x0'));var util=require('util');var path=require(_0xd7dd('0x1'));var timeout=require(_0xd7dd('0x2'));var express=require(_0xd7dd('0x3'));var router=express['Router']();var auth=require(_0xd7dd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd7dd('0x5'));router[_0xd7dd('0x6')]('/',auth[_0xd7dd('0x7')](),controller['index']);router['get'](_0xd7dd('0x8'),auth[_0xd7dd('0x7')](),controller['show']);router[_0xd7dd('0x9')]('/',auth[_0xd7dd('0x7')](),controller[_0xd7dd('0xa')]);router[_0xd7dd('0xb')]('/:id',auth[_0xd7dd('0x7')](),controller[_0xd7dd('0xc')]);router['delete'](_0xd7dd('0x8'),auth[_0xd7dd('0x7')](),controller[_0xd7dd('0xd')]);module[_0xd7dd('0xe')]=router; \ No newline at end of file +var _0xbf72=['delete','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','put','update'];(function(_0x41fd9f,_0x377d67){var _0x251a06=function(_0x5a365a){while(--_0x5a365a){_0x41fd9f['push'](_0x41fd9f['shift']());}};_0x251a06(++_0x377d67);}(_0xbf72,0x151));var _0x2bf7=function(_0x4d1fd6,_0x465044){_0x4d1fd6=_0x4d1fd6-0x0;var _0x2bbd49=_0xbf72[_0x4d1fd6];return _0x2bbd49;};'use strict';var multer=require(_0x2bf7('0x0'));var util=require('util');var path=require(_0x2bf7('0x1'));var timeout=require(_0x2bf7('0x2'));var express=require('express');var router=express[_0x2bf7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2bf7('0x4'));var config=require(_0x2bf7('0x5'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0x2bf7('0x6')](),controller[_0x2bf7('0x7')]);router[_0x2bf7('0x8')](_0x2bf7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2bf7('0xa')]('/',auth[_0x2bf7('0x6')](),controller['create']);router[_0x2bf7('0xb')](_0x2bf7('0x9'),auth['isAuthenticated'](),controller[_0x2bf7('0xc')]);router[_0x2bf7('0xd')](_0x2bf7('0x9'),auth[_0x2bf7('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c3ecc23..739fdab 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 _0x5c9b=['INTEGER','STRING','*,*,*,*'];(function(_0x2cf66f,_0x141ca7){var _0x53cca1=function(_0x1b445c){while(--_0x1b445c){_0x2cf66f['push'](_0x2cf66f['shift']());}};_0x53cca1(++_0x141ca7);}(_0x5c9b,0x16b));var _0xb5c9=function(_0x263053,_0x5d7ffd){_0x263053=_0x263053-0x0;var _0x35b77c=_0x5c9b[_0x263053];return _0x35b77c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb5c9('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb5c9('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb5c9('0x1')]},'interval':{'type':Sequelize[_0xb5c9('0x1')],'defaultValue':_0xb5c9('0x2')}}; \ No newline at end of file +var _0xaa52=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x32af46,_0xb38e36){var _0x5a5520=function(_0x42d5b9){while(--_0x42d5b9){_0x32af46['push'](_0x32af46['shift']());}};_0x5a5520(++_0xb38e36);}(_0xaa52,0xef));var _0x2aa5=function(_0x3ae7d2,_0x3d3750){_0x3ae7d2=_0x3ae7d2-0x0;var _0x2a4d74=_0xaa52[_0x3ae7d2];return _0x2a4d74;};'use strict';var Sequelize=require(_0x2aa5('0x0'));module[_0x2aa5('0x1')]={'priority':{'type':Sequelize[_0x2aa5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2aa5('0x3')]()},'description':{'type':Sequelize[_0x2aa5('0x4')]},'interval':{'type':Sequelize[_0x2aa5('0x4')],'defaultValue':_0x2aa5('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b2b65e4..d948db1 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 _0x0b0e=['update','then','destroy','end','error','name','index','map','SmsApplication','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject'];(function(_0x1836af,_0x319e0a){var _0x2da7d3=function(_0xcde069){while(--_0xcde069){_0x1836af['push'](_0x1836af['shift']());}};_0x2da7d3(++_0x319e0a);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0x0b0e[_0xcfcbaa];return _0x157ed0;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['SmsApplication'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['SmsApplication'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['SmsApplication'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));}; \ No newline at end of file +var _0xed3c=['ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','error','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xed3c,0x1a6));var _0xced3=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xed3c[_0x119629];return _0x49a771;};'use strict';var pdf=require(_0xced3('0x0'));var emlformat=require(_0xced3('0x1'));var rimraf=require(_0xced3('0x2'));var zipdir=require(_0xced3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced3('0x4'));var moment=require(_0xced3('0x5'));var BPromise=require(_0xced3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xced3('0x7'));var sox=require(_0xced3('0x8'));var csv=require(_0xced3('0x9'));var ejs=require(_0xced3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var db=require(_0xced3('0x14'))['db'];function respondWithStatusCode(_0x19b8c2,_0x42d879){_0x42d879=_0x42d879||0xcc;return function(_0x3b2ac4){if(_0x3b2ac4){return _0x19b8c2[_0xced3('0x15')](_0x42d879);}return _0x19b8c2[_0xced3('0x16')](_0x42d879)[_0xced3('0x17')]();};}function respondWithResult(_0x5aadb6,_0x65bb58){_0x65bb58=_0x65bb58||0xc8;return function(_0x5e186e){if(_0x5e186e){return _0x5aadb6[_0xced3('0x16')](_0x65bb58)[_0xced3('0x18')](_0x5e186e);}};}function respondWithFilteredResult(_0x20d099,_0x39e4aa){return function(_0x4dd4c3){if(_0x4dd4c3){var _0x146a21=_0x4dd4c3[_0xced3('0x19')],_0x322c2d=_0x39e4aa[_0xced3('0x1a')],_0x4acae6=_0x39e4aa[_0xced3('0x1a')]+_0x39e4aa['limit'],_0x3b5962;if(_0x4acae6>=_0x146a21){_0x4acae6=_0x146a21;_0x3b5962=0xc8;}else{_0x3b5962=0xce;}_0x20d099[_0xced3('0x16')](_0x3b5962);return _0x20d099['set'](_0xced3('0x1b'),_0x322c2d+'-'+_0x4acae6+'/'+_0x146a21)[_0xced3('0x18')](_0x4dd4c3);}return null;};}function patchUpdates(_0x32c402){return function(_0x1fb300){try{jsonpatch[_0xced3('0x1c')](_0x1fb300,_0x32c402,!![]);}catch(_0x688c97){return BPromise[_0xced3('0x1d')](_0x688c97);}return _0x1fb300[_0xced3('0x1e')]();};}function saveUpdates(_0x3f688c,_0x17c011){return function(_0x2008f2){if(_0x2008f2){return _0x2008f2['update'](_0x3f688c)['then'](function(_0x5e8c44){return _0x5e8c44;});}return null;};}function removeEntity(_0x1e8450,_0x342b9e){return function(_0x21e074){if(_0x21e074){return _0x21e074['destroy']()[_0xced3('0x1f')](function(){_0x1e8450[_0xced3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559fa2,_0x3adf14){return function(_0x101708){if(!_0x101708){_0x559fa2[_0xced3('0x15')](0x194);}return _0x101708;};}function handleError(_0x15c6c5,_0x50f7c1){_0x50f7c1=_0x50f7c1||0x1f4;return function(_0x1905a3){logger[_0xced3('0x20')](_0x1905a3['stack']);if(_0x1905a3[_0xced3('0x21')]){delete _0x1905a3['name'];}_0x15c6c5[_0xced3('0x16')](_0x50f7c1)[_0xced3('0x22')](_0x1905a3);};}exports[_0xced3('0x23')]=function(_0x23a570,_0x2ec2c4){var _0x502cf1={},_0x5454c0={},_0x36b1fe={'count':0x0,'rows':[]};var _0x5bb425=_[_0xced3('0x24')](db[_0xced3('0x25')]['rawAttributes'],function(_0x3db664){return{'name':_0x3db664[_0xced3('0x26')],'type':_0x3db664[_0xced3('0x27')][_0xced3('0x28')]};});_0x5454c0[_0xced3('0x29')]=_[_0xced3('0x24')](_0x5bb425,_0xced3('0x21'));_0x5454c0[_0xced3('0x2a')]=_[_0xced3('0x2b')](_0x23a570['query']);_0x5454c0[_0xced3('0x2c')]=_[_0xced3('0x2d')](_0x5454c0[_0xced3('0x29')],_0x5454c0[_0xced3('0x2a')]);_0x502cf1[_0xced3('0x2e')]=_[_0xced3('0x2d')](_0x5454c0[_0xced3('0x29')],qs[_0xced3('0x2f')](_0x23a570[_0xced3('0x2a')][_0xced3('0x2f')]));_0x502cf1[_0xced3('0x2e')]=_0x502cf1[_0xced3('0x2e')][_0xced3('0x30')]?_0x502cf1[_0xced3('0x2e')]:_0x5454c0[_0xced3('0x29')];if(!_0x23a570[_0xced3('0x2a')][_0xced3('0x31')](_0xced3('0x32'))){_0x502cf1[_0xced3('0x33')]=qs[_0xced3('0x33')](_0x23a570[_0xced3('0x2a')]['limit']);_0x502cf1[_0xced3('0x1a')]=qs['offset'](_0x23a570[_0xced3('0x2a')][_0xced3('0x1a')]);}_0x502cf1[_0xced3('0x34')]=qs[_0xced3('0x35')](_0x23a570[_0xced3('0x2a')][_0xced3('0x35')]);_0x502cf1[_0xced3('0x36')]=qs[_0xced3('0x2c')](_[_0xced3('0x37')](_0x23a570[_0xced3('0x2a')],_0x5454c0['filters']),_0x5bb425);if(_0x23a570[_0xced3('0x2a')][_0xced3('0x38')]){_0x502cf1['where']=_[_0xced3('0x39')](_0x502cf1[_0xced3('0x36')],{'$or':_[_0xced3('0x24')](_0x5bb425,function(_0x4f6ada){if(_0x4f6ada['type']!==_0xced3('0x3a')){var _0x529d5e={};_0x529d5e[_0x4f6ada[_0xced3('0x21')]]={'$like':'%'+_0x23a570[_0xced3('0x2a')]['filter']+'%'};return _0x529d5e;}})});}_0x502cf1=_[_0xced3('0x39')]({},_0x502cf1,_0x23a570[_0xced3('0x3b')]);var _0x2a6dbf={'where':_0x502cf1['where']};return db[_0xced3('0x25')]['count'](_0x2a6dbf)['then'](function(_0x34d5db){_0x36b1fe[_0xced3('0x19')]=_0x34d5db;if(_0x23a570[_0xced3('0x2a')]['includeAll']){_0x502cf1[_0xced3('0x3c')]=[{'all':!![]}];}return db[_0xced3('0x25')][_0xced3('0x3d')](_0x502cf1);})[_0xced3('0x1f')](function(_0x28506e){_0x36b1fe[_0xced3('0x3e')]=_0x28506e;return _0x36b1fe;})[_0xced3('0x1f')](respondWithFilteredResult(_0x2ec2c4,_0x502cf1))[_0xced3('0x3f')](handleError(_0x2ec2c4,null));};exports[_0xced3('0x40')]=function(_0x3eca11,_0x2b4a18){var _0x38855f={'raw':!![],'where':{'id':_0x3eca11[_0xced3('0x41')]['id']}},_0x16b2c7={};_0x16b2c7[_0xced3('0x29')]=_['keys'](db[_0xced3('0x25')][_0xced3('0x42')]);_0x16b2c7[_0xced3('0x2a')]=_[_0xced3('0x2b')](_0x3eca11[_0xced3('0x2a')]);_0x16b2c7[_0xced3('0x2c')]=_[_0xced3('0x2d')](_0x16b2c7[_0xced3('0x29')],_0x16b2c7[_0xced3('0x2a')]);_0x38855f['attributes']=_[_0xced3('0x2d')](_0x16b2c7['model'],qs[_0xced3('0x2f')](_0x3eca11[_0xced3('0x2a')][_0xced3('0x2f')]));_0x38855f['attributes']=_0x38855f[_0xced3('0x2e')][_0xced3('0x30')]?_0x38855f[_0xced3('0x2e')]:_0x16b2c7[_0xced3('0x29')];if(_0x3eca11['query'][_0xced3('0x43')]){_0x38855f[_0xced3('0x3c')]=[{'all':!![]}];}_0x38855f=_[_0xced3('0x39')]({},_0x38855f,_0x3eca11[_0xced3('0x3b')]);return db[_0xced3('0x25')]['find'](_0x38855f)[_0xced3('0x1f')](handleEntityNotFound(_0x2b4a18,null))[_0xced3('0x1f')](respondWithResult(_0x2b4a18,null))[_0xced3('0x3f')](handleError(_0x2b4a18,null));};exports[_0xced3('0x44')]=function(_0x334474,_0x740743){return db[_0xced3('0x25')]['create'](_0x334474[_0xced3('0x45')],{})[_0xced3('0x1f')](respondWithResult(_0x740743,0xc9))['catch'](handleError(_0x740743,null));};exports['update']=function(_0x140df2,_0x59b586){if(_0x140df2[_0xced3('0x45')]['id']){delete _0x140df2[_0xced3('0x45')]['id'];}return db[_0xced3('0x25')][_0xced3('0x46')]({'where':{'id':_0x140df2[_0xced3('0x41')]['id']}})[_0xced3('0x1f')](handleEntityNotFound(_0x59b586,null))[_0xced3('0x1f')](saveUpdates(_0x140df2[_0xced3('0x45')],null))[_0xced3('0x1f')](respondWithResult(_0x59b586,null))['catch'](handleError(_0x59b586,null));};exports[_0xced3('0x47')]=function(_0x8df206,_0x2aa876){return db[_0xced3('0x25')][_0xced3('0x46')]({'where':{'id':_0x8df206[_0xced3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2aa876,null))[_0xced3('0x1f')](removeEntity(_0x2aa876,null))[_0xced3('0x3f')](handleError(_0x2aa876,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f03b610..c3eb743 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 _0x10c3=['utf8mb4_unicode_ci','util','api','moment','../../config/environment','./smsApplication.attributes','exports','sms_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c3,0x1b9));var _0x310c=function(_0x1a9339,_0xce7340){_0x1a9339=_0x1a9339-0x0;var _0x243d16=_0x10c3[_0x1a9339];return _0x243d16;};'use strict';var _=require('lodash');var util=require(_0x310c('0x0'));var logger=require('../../config/logger')(_0x310c('0x1'));var moment=require(_0x310c('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(_0x310c('0x3'));var attributes=require(_0x310c('0x4'));module[_0x310c('0x5')]=function(_0x4f5041,_0x5b1f27){return _0x4f5041['define']('SmsApplication',attributes,{'tableName':_0x310c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x310c('0x7')});}; \ No newline at end of file +var _0x00e6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1aeec4,_0xbf8821){var _0x2af83d=function(_0x5c1fe0){while(--_0x5c1fe0){_0x1aeec4['push'](_0x1aeec4['shift']());}};_0x2af83d(++_0xbf8821);}(_0x00e6,0x1b7));var _0x600e=function(_0x2f3b86,_0x1fffad){_0x2f3b86=_0x2f3b86-0x0;var _0x9741a0=_0x00e6[_0x2f3b86];return _0x9741a0;};'use strict';var _=require(_0x600e('0x0'));var util=require(_0x600e('0x1'));var logger=require(_0x600e('0x2'))(_0x600e('0x3'));var moment=require(_0x600e('0x4'));var BPromise=require(_0x600e('0x5'));var rp=require(_0x600e('0x6'));var fs=require('fs');var path=require(_0x600e('0x7'));var rimraf=require(_0x600e('0x8'));var config=require(_0x600e('0x9'));var attributes=require(_0x600e('0xa'));module[_0x600e('0xb')]=function(_0x1a2a07,_0x38430b){return _0x1a2a07[_0x600e('0xc')](_0x600e('0xd'),attributes,{'tableName':_0x600e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x600e('0xf'),'collate':_0x600e('0x10')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5faf351..4a3d738 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 _0x3edc=['request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x11890b,_0x3dafe5){var _0x14251f=function(_0xc72ddb){while(--_0xc72ddb){_0x11890b['push'](_0x11890b['shift']());}};_0x14251f(++_0x3dafe5);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x336030,_0x4086ea){_0x336030=_0x336030-0x0;var _0x2b203b=_0x3edc[_0x336030];return _0x2b203b;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var moment=require(_0xc3ed('0x2'));var BPromise=require(_0xc3ed('0x3'));var rs=require(_0xc3ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3ed('0x6'))(_0xc3ed('0x7'));var config=require(_0xc3ed('0x8'));var jayson=require(_0xc3ed('0x9'));var client=jayson[_0xc3ed('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b28d4,_0x323058,_0x14d194){return new BPromise(function(_0x2f28ce,_0x13999f){return client[_0xc3ed('0xb')](_0x1b28d4,_0x14d194)['then'](function(_0x81590e){logger[_0xc3ed('0xc')](_0xc3ed('0xd'),_0x323058,'request\x20sent');logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x323058,_0xc3ed('0xe'),JSON[_0xc3ed('0xf')](_0x81590e));if(_0x81590e[_0xc3ed('0x10')]){if(_0x81590e[_0xc3ed('0x10')][_0xc3ed('0x11')]===0x1f4){logger[_0xc3ed('0x10')](_0xc3ed('0xd'),_0x323058,_0x81590e[_0xc3ed('0x10')][_0xc3ed('0x12')]);return _0x13999f(_0x81590e[_0xc3ed('0x10')]['message']);}logger[_0xc3ed('0x10')](_0xc3ed('0xd'),_0x323058,_0x81590e[_0xc3ed('0x10')][_0xc3ed('0x12')]);return _0x2f28ce(_0x81590e['error']['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x323058,_0xc3ed('0xe'));_0x2f28ce(_0x81590e[_0xc3ed('0x13')]['message']);}})[_0xc3ed('0x14')](function(_0x15eb2e){logger['error']('SmsApplication,\x20%s,\x20%s',_0x323058,_0x15eb2e);_0x13999f(_0x15eb2e);});});} \ No newline at end of file +var _0x87d3=['http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xf1b134,_0xb399dd){var _0x139dbb=function(_0xe7a88d){while(--_0xe7a88d){_0xf1b134['push'](_0xf1b134['shift']());}};_0x139dbb(++_0xb399dd);}(_0x87d3,0x86));var _0x387d=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0x87d3[_0x4a94d0];return _0x50128a;};'use strict';var _=require(_0x387d('0x0'));var util=require(_0x387d('0x1'));var moment=require(_0x387d('0x2'));var BPromise=require(_0x387d('0x3'));var rs=require(_0x387d('0x4'));var fs=require('fs');var Redis=require(_0x387d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x387d('0x6'));var logger=require('../../config/logger')(_0x387d('0x7'));var config=require(_0x387d('0x8'));var jayson=require(_0x387d('0x9'));var client=jayson['client'][_0x387d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265532,_0x3b1d5b,_0x689c51){return new BPromise(function(_0x86e92e,_0x39fece){return client[_0x387d('0xb')](_0x265532,_0x689c51)[_0x387d('0xc')](function(_0x47568d){logger[_0x387d('0xd')](_0x387d('0xe'),_0x3b1d5b,'request\x20sent');logger[_0x387d('0xf')](_0x387d('0x10'),_0x3b1d5b,_0x387d('0x11'),JSON[_0x387d('0x12')](_0x47568d));if(_0x47568d[_0x387d('0x13')]){if(_0x47568d[_0x387d('0x13')][_0x387d('0x14')]===0x1f4){logger[_0x387d('0x13')](_0x387d('0xe'),_0x3b1d5b,_0x47568d[_0x387d('0x13')][_0x387d('0x15')]);return _0x39fece(_0x47568d[_0x387d('0x13')][_0x387d('0x15')]);}logger[_0x387d('0x13')](_0x387d('0xe'),_0x3b1d5b,_0x47568d['error']['message']);return _0x86e92e(_0x47568d[_0x387d('0x13')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x3b1d5b,_0x387d('0x11'));_0x86e92e(_0x47568d[_0x387d('0x16')][_0x387d('0x15')]);}})[_0x387d('0x17')](function(_0x3cd7ce){logger[_0x387d('0x13')](_0x387d('0xe'),_0x3b1d5b,_0x3cd7ce);_0x39fece(_0x3cd7ce);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 495db63..97f1b3e 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 _0x553e=['removeTags','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','/:id/download','download','/:id/messages','tracked','sms','smsinteraction:addtags','addTags','put','update','destroy','delete'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x553e,0x10f));var _0xe553=function(_0x2a5d0f,_0x244370){_0x2a5d0f=_0x2a5d0f-0x0;var _0x438955=_0x553e[_0x2a5d0f];return _0x438955;};'use strict';var multer=require(_0xe553('0x0'));var util=require(_0xe553('0x1'));var path=require(_0xe553('0x2'));var timeout=require(_0xe553('0x3'));var express=require(_0xe553('0x4'));var router=express[_0xe553('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe553('0x6'));var config=require(_0xe553('0x7'));var controller=require(_0xe553('0x8'));router[_0xe553('0x9')]('/',auth[_0xe553('0xa')](),controller[_0xe553('0xb')]);router[_0xe553('0x9')]('/describe',auth[_0xe553('0xa')](),controller[_0xe553('0xc')]);router[_0xe553('0x9')](_0xe553('0xd'),auth[_0xe553('0xa')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xe553('0xe')]);router[_0xe553('0x9')](_0xe553('0xf'),auth[_0xe553('0xa')](),controller[_0xe553('0x10')]);router['post']('/',auth[_0xe553('0xa')](),controller['create']);router['post'](_0xe553('0x11'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xe553('0xa')](),interaction[_0xe553('0x12')](_0xe553('0x13'),_0xe553('0x14')),controller[_0xe553('0x15')]);router[_0xe553('0x16')](_0xe553('0xd'),auth[_0xe553('0xa')](),interaction[_0xe553('0x12')]('sms','smsinteraction:update'),controller[_0xe553('0x17')]);router['delete'](_0xe553('0xd'),auth[_0xe553('0xa')](),interaction[_0xe553('0x12')](_0xe553('0x13'),'smsinteraction:destroy'),controller[_0xe553('0x18')]);router[_0xe553('0x19')]('/:id/tags',auth[_0xe553('0xa')](),controller[_0xe553('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd65f=['smsinteraction:update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','index','/describe','isAuthenticated','describe','get','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','/:id','sms'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xd65f,0x198));var _0xfd65=function(_0x300e9e,_0xcbfa6b){_0x300e9e=_0x300e9e-0x0;var _0x53c501=_0xd65f[_0x300e9e];return _0x53c501;};'use strict';var multer=require('multer');var util=require(_0xfd65('0x0'));var path=require('path');var timeout=require(_0xfd65('0x1'));var express=require(_0xfd65('0x2'));var router=express[_0xfd65('0x3')]();var auth=require(_0xfd65('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfd65('0x5'));var controller=require(_0xfd65('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd65('0x7')]);router['get'](_0xfd65('0x8'),auth[_0xfd65('0x9')](),controller[_0xfd65('0xa')]);router[_0xfd65('0xb')]('/:id',auth[_0xfd65('0x9')](),controller[_0xfd65('0xc')]);router['get'](_0xfd65('0xd'),auth[_0xfd65('0x9')](),controller[_0xfd65('0xe')]);router['get']('/:id/download',auth[_0xfd65('0x9')](),controller[_0xfd65('0xf')]);router[_0xfd65('0x10')]('/',auth[_0xfd65('0x9')](),controller['create']);router[_0xfd65('0x10')](_0xfd65('0xd'),auth['isAuthenticated'](),controller[_0xfd65('0x11')]);router[_0xfd65('0x10')](_0xfd65('0x12'),auth['isAuthenticated'](),interaction[_0xfd65('0x13')]('sms',_0xfd65('0x14')),controller['addTags']);router[_0xfd65('0x15')](_0xfd65('0x16'),auth[_0xfd65('0x9')](),interaction[_0xfd65('0x13')](_0xfd65('0x17'),_0xfd65('0x18')),controller['update']);router[_0xfd65('0x19')](_0xfd65('0x16'),auth['isAuthenticated'](),interaction[_0xfd65('0x13')](_0xfd65('0x17'),'smsinteraction:destroy'),controller['destroy']);router[_0xfd65('0x19')](_0xfd65('0x12'),auth[_0xfd65('0x9')](),controller['removeTags']);module[_0xfd65('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 73c7faf..3cd5c9c 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 _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x2c25c7,_0x57f2d7){var _0x1e51bd=function(_0x544467){while(--_0x544467){_0x2c25c7['push'](_0x2c25c7['shift']());}};_0x1e51bd(++_0x57f2d7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x195ae2,_0x3225a1){var _0x504040=function(_0x43e2b9){while(--_0x43e2b9){_0x195ae2['push'](_0x195ae2['shift']());}};_0x504040(++_0x3225a1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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 diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 09d8abf..c72e54f 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 _0x153f=['tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show','params','rawAttributes','includeAll','include','options','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','pick','format','rows','addTags','setTags','Tag','findAll','emit','smsInteractionTags:save','removeTags','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','direction','out','System','views','create','toFile','transcript-','download','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','catch','SmsInteraction','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','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','body','some','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200'];(function(_0x28f407,_0x2d65ec){var _0x306cd6=function(_0x177c13){while(--_0x177c13){_0x28f407['push'](_0x28f407['shift']());}};_0x306cd6(++_0x2d65ec);}(_0x153f,0x15b));var _0xf153=function(_0x1ba630,_0x1d698b){_0x1ba630=_0x1ba630-0x0;var _0x2eb856=_0x153f[_0x1ba630];return _0x2eb856;};'use strict';var pdf=require(_0xf153('0x0'));var emlformat=require(_0xf153('0x1'));var rimraf=require(_0xf153('0x2'));var zipdir=require(_0xf153('0x3'));var jsonpatch=require(_0xf153('0x4'));var rp=require(_0xf153('0x5'));var moment=require(_0xf153('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf153('0x7'));var util=require('util');var path=require(_0xf153('0x8'));var sox=require(_0xf153('0x9'));var csv=require(_0xf153('0xa'));var ejs=require(_0xf153('0xb'));var fs=require('fs');var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0xa'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var db=require(_0xf153('0x19'))['db'];config[_0xf153('0x1a')]=_[_0xf153('0x1b')](config[_0xf153('0x1a')],{'host':_0xf153('0x1c'),'port':0x18eb});var socket=require(_0xf153('0x1d'))(new Redis(config[_0xf153('0x1a')]));require(_0xf153('0x1e'))[_0xf153('0x1f')](socket);function respondWithStatusCode(_0x4c5283,_0x18be7e){_0x18be7e=_0x18be7e||0xcc;return function(_0x2340f5){if(_0x2340f5){return _0x4c5283[_0xf153('0x20')](_0x18be7e);}return _0x4c5283[_0xf153('0x21')](_0x18be7e)[_0xf153('0x22')]();};}function respondWithResult(_0x68f436,_0x273a90){_0x273a90=_0x273a90||0xc8;return function(_0x287bc6){if(_0x287bc6){return _0x68f436['status'](_0x273a90)[_0xf153('0x23')](_0x287bc6);}};}function respondWithFilteredResult(_0x564eeb,_0x37093a){return function(_0x2c62b6){if(_0x2c62b6){var _0x138dbe=_0x2c62b6[_0xf153('0x24')],_0x44272e=_0x37093a[_0xf153('0x25')],_0x4e790d=_0x37093a[_0xf153('0x25')]+_0x37093a[_0xf153('0x26')],_0x357d57;if(_0x4e790d>=_0x138dbe){_0x4e790d=_0x138dbe;_0x357d57=0xc8;}else{_0x357d57=0xce;}_0x564eeb[_0xf153('0x21')](_0x357d57);return _0x564eeb[_0xf153('0x27')](_0xf153('0x28'),_0x44272e+'-'+_0x4e790d+'/'+_0x138dbe)[_0xf153('0x23')](_0x2c62b6);}return null;};}function patchUpdates(_0x1dd340){return function(_0x33ce52){try{jsonpatch[_0xf153('0x29')](_0x33ce52,_0x1dd340,!![]);}catch(_0x493e8a){return BPromise[_0xf153('0x2a')](_0x493e8a);}return _0x33ce52[_0xf153('0x2b')]();};}function saveUpdates(_0x3d3e41,_0x32e759){return function(_0x5c9f44){if(_0x5c9f44){return _0x5c9f44[_0xf153('0x2c')](_0x3d3e41)[_0xf153('0x2d')](function(_0x4376f7){return _0x4376f7;});}return null;};}function removeEntity(_0xf67cde,_0x38190c){return function(_0x1570fc){if(_0x1570fc){return _0x1570fc[_0xf153('0x2e')]()[_0xf153('0x2d')](function(){_0xf67cde[_0xf153('0x21')](0xcc)[_0xf153('0x22')]();});}};}function handleEntityNotFound(_0x35f9da,_0x141ef4){return function(_0x703adb){if(!_0x703adb){_0x35f9da[_0xf153('0x20')](0x194);}return _0x703adb;};}function handleError(_0x17f7a4,_0x48ebdc){_0x48ebdc=_0x48ebdc||0x1f4;return function(_0x6d62ef){logger[_0xf153('0x2f')](_0x6d62ef['stack']);if(_0x6d62ef[_0xf153('0x30')]){delete _0x6d62ef[_0xf153('0x30')];}_0x17f7a4['status'](_0x48ebdc)[_0xf153('0x31')](_0x6d62ef);};}function getInteractionUsers(_0x10295e,_0x261ac0){return new BPromise(function(_0x2b9a9c,_0x339e96){try{if(_0x261ac0[_0x10295e['id']]){_0x10295e[_0xf153('0x32')]=_[_0xf153('0x33')](_0x261ac0[_0x10295e['id']],function(_0x3b5f4f){return{'id':_0x3b5f4f['id'],'fullname':_0x3b5f4f[_0xf153('0x34')]};});}}catch(_0x8e31bf){_0x339e96(_0x8e31bf);}_0x2b9a9c(_0x10295e);});}function getInteractionTags(_0x13b541,_0x415a5f){return new BPromise(function(_0x5b5237,_0x258fb0){try{if(_0x13b541[_0xf153('0x35')]){_0x13b541[_0xf153('0x36')]=[];_0x13b541[_0xf153('0x35')]['split'](',')['forEach'](function(_0x28433d){_0x13b541['Tags']['push'](_0x415a5f[_0x28433d]);});}delete _0x13b541[_0xf153('0x35')];}catch(_0x4ab958){_0x258fb0(_0x4ab958);}_0x5b5237(_0x13b541);});}function updateSmsInteraction(_0x2b9623,_0x4d1a71,_0x1b0f2a){return new BPromise(function(_0x10f461,_0x4bc442){return getInteractionUsers(_0x2b9623,_0x1b0f2a)[_0xf153('0x2d')](function(_0x281c4b){return getInteractionTags(_0x281c4b,_0x4d1a71);})[_0xf153('0x2d')](function(_0x40be52){_0x10f461(_0x40be52);})[_0xf153('0x37')](function(_0x220d31){_0x4bc442(_0x220d31);});});}exports['index']=function(_0x23c293,_0x5c333b){var _0x40834b={},_0x2523c0={},_0x9b3f4c={'count':0x0,'rows':[]};var _0x1820c3=_[_0xf153('0x33')](db[_0xf153('0x38')]['rawAttributes'],function(_0x1b4bc1){return{'name':_0x1b4bc1[_0xf153('0x39')],'type':_0x1b4bc1[_0xf153('0x3a')]['key']};});_0x2523c0[_0xf153('0x3b')]=_[_0xf153('0x33')](_0x1820c3,_0xf153('0x30'));_0x2523c0[_0xf153('0x3c')]=_[_0xf153('0x3d')](_0x23c293[_0xf153('0x3c')]);_0x2523c0['filters']=_[_0xf153('0x3e')](_0x2523c0[_0xf153('0x3b')],_0x2523c0['query']);_0x40834b[_0xf153('0x3f')]=_[_0xf153('0x3e')](_0x2523c0[_0xf153('0x3b')],qs[_0xf153('0x40')](_0x23c293[_0xf153('0x3c')][_0xf153('0x40')]));_0x40834b[_0xf153('0x3f')]=_0x40834b['attributes'][_0xf153('0x41')]?_0x40834b[_0xf153('0x3f')]:_0x2523c0[_0xf153('0x3b')];if(!_0x23c293[_0xf153('0x3c')][_0xf153('0x42')](_0xf153('0x43'))){_0x40834b['limit']=qs['limit'](_0x23c293[_0xf153('0x3c')]['limit']);_0x40834b[_0xf153('0x25')]=qs[_0xf153('0x25')](_0x23c293[_0xf153('0x3c')][_0xf153('0x25')]);}_0x40834b[_0xf153('0x44')]=qs[_0xf153('0x45')](_0x23c293['query']['sort']);_0x40834b[_0xf153('0x46')]=qs[_0xf153('0x47')](_['pick'](_0x23c293[_0xf153('0x3c')],_0x2523c0[_0xf153('0x47')]),_0x1820c3);var _0x1edf65=[];var _0x3a9cb2=squel[_0xf153('0x48')]()[_0xf153('0x49')]('id')[_0xf153('0x49')](_0xf153('0x30'))[_0xf153('0x49')](_0xf153('0x4a'))[_0xf153('0x4b')](_0xf153('0x4c'));var _0x59228a=squel[_0xf153('0x48')]()[_0xf153('0x49')](_0xf153('0x4d'))['field'](_0xf153('0x4e'))[_0xf153('0x49')]('ui.SmsInteractionId')[_0xf153('0x4b')]('user_has_sms_interactions','ui')[_0xf153('0x4f')](_0xf153('0x50'),'u',_0xf153('0x51'));var _0x550d45=squel[_0xf153('0x48')]()[_0xf153('0x4b')](_0xf153('0x52'),'i')[_0xf153('0x4f')](_0xf153('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf153('0x4f')](_0xf153('0x50'),'o','o.id\x20=\x20i.UserId')[_0xf153('0x4f')](_0xf153('0x54'),'a',_0xf153('0x55'))['left_join'](_0xf153('0x56'),'me',_0xf153('0x57'))[_0xf153('0x4f')](_0xf153('0x58'),'it',_0xf153('0x59'))[_0xf153('0x4f')](_0xf153('0x4c'),'t',_0xf153('0x5a'));var _0x3b91ed=squel['expr']();var _0x5c1444=[];var _0x5540a0=squel['expr']();var _0x57af92;if(_0x23c293[_0xf153('0x3c')][_0xf153('0x5b')]){_0x57af92=as['parseSearch'](_0x23c293[_0xf153('0x3c')][_0xf153('0x5b')]);var _0x557d1e=_0x57af92[_0xf153('0x5c')];for(var _0xe6e023=0x0;_0xe6e023<_0x57af92[_0xf153('0x5d')][_0xf153('0x41')];_0xe6e023++){var _0x3964db=_0x57af92[_0xf153('0x5d')][_0xe6e023];var _0x488baa='i';var _0x19334e=_[_0xf153('0x5e')](_0x1820c3,['name',_0x3964db['field']]);if(!_0x19334e){switch(_0x3964db[_0xf153('0x49')]){case _0xf153('0x5f'):if(_0x3964db[_0xf153('0x60')]==0x1){_0x550d45[_0xf153('0x61')]('`'+_0x3964db[_0xf153('0x49')]+_0xf153('0x62'));}else{_0x550d45['having']('`'+_0x3964db[_0xf153('0x49')]+'`\x20>\x200');}break;case _0xf153('0x63'):if(_0x3964db[_0xf153('0x64')]===_0xf153('0x65')){if(_0x3964db['value'][_0xf153('0x66')]('\x20')[_0xf153('0x41')]>0x1){_0x3b91ed[_0x557d1e](_0xf153('0x67'),qs[_0xf153('0x68')](_0x3964db[_0xf153('0x60')]),null);}else{var _0x18d0ce='%'+_0x3964db[_0xf153('0x60')]+'%';_0x3b91ed[_0x557d1e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x18d0ce,_0x18d0ce,_0x18d0ce);}}else{_0x19334e=_[_0xf153('0x5e')](_0x1820c3,[_0xf153('0x30'),_0xf153('0x69')]);_0x3964db['field']=_0xf153('0x69');_0x2db5b7=as[_0xf153('0x6a')](_0x488baa,_0x19334e[_0xf153('0x3a')],_0x3964db);_0x3b91ed[_0x557d1e](_0x2db5b7[_0xf153('0x6b')],_0x2db5b7[_0xf153('0x60')][_0xf153('0x6c')],_0x2db5b7[_0xf153('0x60')][_0xf153('0x22')]);}break;case'Tag':var _0x308b5f=_0x3964db[_0xf153('0x60')]['split'](',')[_0xf153('0x33')](function(_0x3e160a){return Number(_0x3e160a);});_0x308b5f[_0xf153('0x6d')](function(_0xce9a19){_0x5540a0['or'](_0xf153('0x6e'),'%,'+_0xce9a19+',%');});_0x5c1444=_[_0xf153('0x6f')](_0x5c1444,_0x308b5f);break;case _0xf153('0x70'):if(_0x3964db[_0xf153('0x64')]===_0xf153('0x65')){_0x3b91ed[_0x557d1e](_0xf153('0x71'),'%'+_0x3964db[_0xf153('0x60')]+'%',null);}else{_0x19334e=_['find'](_0x1820c3,[_0xf153('0x30'),_0xf153('0x72')]);_0x3964db['field']=_0xf153('0x72');_0x2db5b7=as[_0xf153('0x6a')](_0x488baa,_0x19334e[_0xf153('0x3a')],_0x3964db);_0x3b91ed[_0x557d1e](_0x2db5b7[_0xf153('0x6b')],_0x2db5b7[_0xf153('0x60')][_0xf153('0x6c')],_0x2db5b7[_0xf153('0x60')]['end']);}break;case _0xf153('0x73'):_0x2db5b7=as[_0xf153('0x6a')]('me',null,_0x3964db);_0x3b91ed[_0x557d1e](_0x2db5b7[_0xf153('0x6b')],_0x2db5b7[_0xf153('0x60')][_0xf153('0x6c')],_0x2db5b7[_0xf153('0x60')][_0xf153('0x22')]);break;}}else{var _0x2db5b7=as[_0xf153('0x6a')](_0x488baa,_0x19334e['type'],_0x3964db);_0x3b91ed[_0x557d1e](_0x2db5b7[_0xf153('0x6b')],_0x2db5b7[_0xf153('0x60')]['start'],_0x2db5b7[_0xf153('0x60')]['end']);}}}else{var _0x4345c2=_(_0x23c293[_0xf153('0x3c')])['keys']()[_0xf153('0x33')](function(_0x55ea2b){return _[_0xf153('0x74')](_0x1820c3,[_0xf153('0x30'),_0x55ea2b])?_0x55ea2b:undefined;})[_0xf153('0x75')]()[_0xf153('0x60')]();if(!_['isEmpty'](_0x4345c2)){_0x4345c2[_0xf153('0x6d')](function(_0xc0095d){if(_0xc0095d==='SmsAccountId'){_0x550d45[_0xf153('0x46')](_0xf153('0x76'),[][_0xf153('0x77')](_0x23c293[_0xf153('0x3c')][_0xc0095d]));}else if(_0xc0095d===_0xf153('0x78')){var _0x55f7c1=JSON[_0xf153('0x79')](_0x23c293['query'][_0xc0095d])[_0xf153('0x7a')];var _0x38a7c4=JSON['parse'](_0x23c293['query'][_0xc0095d])[_0xf153('0x7b')];_0x550d45[_0xf153('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x55f7c1,_0x38a7c4);}else{if(_0x23c293[_0xf153('0x3c')][_0xc0095d]===_0xf153('0x7c')){_0x550d45[_0xf153('0x46')]('i.'+_0xc0095d+'\x20IS\x20NULL');}else{_0x550d45[_0xf153('0x46')]('i.'+_0xc0095d+_0xf153('0x7d'),_0x23c293[_0xf153('0x3c')][_0xc0095d]);}}});}if(_0x23c293[_0xf153('0x3c')][_0xf153('0x7e')]){if(_0x23c293[_0xf153('0x3c')][_0xf153('0x7e')]==0x1){_0x550d45[_0xf153('0x61')](_0xf153('0x7f'));}else{_0x550d45[_0xf153('0x61')](_0xf153('0x80'));}}if(_0x23c293[_0xf153('0x3c')][_0xf153('0x81')]){_0x5c1444=_[_0xf153('0x82')](_0x23c293[_0xf153('0x3c')][_0xf153('0x81')])?_0x23c293['query'][_0xf153('0x81')]:new Array(_0x23c293['query']['tag']);_0x5c1444[_0xf153('0x6d')](function(_0x47d056){_0x5540a0['or'](_0xf153('0x6e'),'%,'+_0x47d056+',%');});}if(_0x23c293[_0xf153('0x3c')][_0xf153('0x83')]){var _0x2ca840=_0x23c293[_0xf153('0x3c')][_0xf153('0x83')]['replace']('\x5c','\x5c\x5c')[_0xf153('0x84')]('\x27\x27',_0xf153('0x85'));if(qs[_0xf153('0x86')](_0x2ca840)){_0x3b91ed['or']('i.id\x20LIKE\x20?',_0x2ca840+'%')['or']('i.phone\x20LIKE\x20?',_0x2ca840+'%');}else{_0x3b91ed['or'](_0xf153('0x87'),qs[_0xf153('0x68')](_0x2ca840))['or'](_0xf153('0x88'),_0x2ca840+'%');}}}_0x550d45['where'](_0x3b91ed);_0x550d45[_0xf153('0x89')]('i.id');var _0x5f3af0={'type':db[_0xf153('0x8a')][_0xf153('0x8b')][_0xf153('0x8c')],'raw':!![]};var _0x583dbf=_0x550d45[_0xf153('0x8d')]();_0x583dbf[_0xf153('0x49')]('i.id');_0x583dbf[_0xf153('0x49')](_0xf153('0x8e'),_0xf153('0x5f'));if(_0x40834b[_0xf153('0x44')]){_0x40834b[_0xf153('0x44')]['forEach'](function(_0x463a3b){_0x550d45[_0xf153('0x44')]('i.'+_0x463a3b[0x0],_0x463a3b[0x1]===_0xf153('0x8f')?![]:!![]);});}if(!_[_0xf153('0x90')](_0x5c1444)){_0x550d45[_0xf153('0x61')](_0x5540a0);_0x583dbf[_0xf153('0x46')](_0xf153('0x91'),_0x5c1444);}BPromise['resolve']()[_0xf153('0x2d')](function(){if(!_0x57af92){if(_0x23c293[_0xf153('0x3c')][_0xf153('0x92')]||_0x23c293[_0xf153('0x3c')][_0xf153('0x93')])return;_0x583dbf[_0xf153('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x550d45[_0xf153('0x46')](_0xf153('0x94'));return;}return _0x23c293[_0xf153('0x95')][_0xf153('0x96')]({'attributes':['id'],'raw':!![]})[_0xf153('0x2d')](function(_0x20db97){if(_[_0xf153('0x90')](_0x20db97)){_0x583dbf[_0xf153('0x46')](_0xf153('0x97'));_0x550d45[_0xf153('0x46')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x583dbf['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x20db97,'id'));_0x550d45[_0xf153('0x46')](_0xf153('0x76'),_[_0xf153('0x33')](_0x20db97,'id'));}});})[_0xf153('0x2d')](function(){db[_0xf153('0x98')]['query'](_0x583dbf[_0xf153('0x99')](),_0x5f3af0)[_0xf153('0x2d')](function(_0x16acf6){_0x9b3f4c[_0xf153('0x24')]=_0x16acf6['length'];if(_0x9b3f4c[_0xf153('0x24')]===0x0)return[];return db[_0xf153('0x98')][_0xf153('0x3c')](_0x3a9cb2['toString'](),_0x5f3af0)[_0xf153('0x2d')](function(_0x4dbf1b){_0x1edf65=_[_0xf153('0x9a')](_0x4dbf1b,'id');_0x5f3af0=_[_0xf153('0x9b')](_0x5f3af0,{'model':db[_0xf153('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23c293['query']['fields']){_0x40834b['attributes'][_0xf153('0x6d')](function(_0x45f965){_0x550d45['field']('i.'+_0x45f965);});}else{_0x550d45['field'](_0xf153('0x8e'),'unreadMessages');_0x550d45[_0xf153('0x49')]('a.key',_0xf153('0x9c'));_0x550d45[_0xf153('0x49')](_0xf153('0x9d'),_0xf153('0x9e'));_0x550d45[_0xf153('0x49')](_0xf153('0x9f'));_0x550d45['field'](_0xf153('0xa0'),_0xf153('0xa1'));_0x550d45['field'](_0xf153('0xa2'),_0xf153('0xa3'));_0x550d45[_0xf153('0x49')](_0xf153('0xa4'),'Contact.email');_0x550d45[_0xf153('0x49')](_0xf153('0xa5'),'Contact.phone');_0x550d45[_0xf153('0x49')](_0xf153('0xa6'),_0xf153('0xa7'));_0x550d45[_0xf153('0x49')]('c.fax',_0xf153('0xa8'));_0x550d45[_0xf153('0x49')](_0xf153('0xa9'),_0xf153('0xaa'));_0x550d45[_0xf153('0x49')](_0xf153('0xab'),_0xf153('0xac'));_0x550d45[_0xf153('0x49')](_0xf153('0xad'),'TagIds');}if(_0x40834b[_0xf153('0x26')])_0x550d45[_0xf153('0x26')](_0x40834b[_0xf153('0x26')]);if(_0x40834b['offset'])_0x550d45['offset'](_0x40834b[_0xf153('0x25')]);return db['sequelize'][_0xf153('0x3c')](_0x550d45[_0xf153('0x99')](),_0x5f3af0);})[_0xf153('0x2d')](function(_0x47cb14){_0x59228a['where'](_0xf153('0xae'),_[_0xf153('0x33')](_0x47cb14,'id'));return db[_0xf153('0x98')]['query'](_0x59228a[_0xf153('0x99')](),_0x5f3af0)[_0xf153('0x2d')](function(_0x2daa79){var _0x168b80=_[_0xf153('0xaf')](_0x2daa79,_0xf153('0xb0'));var _0x3114ec=[];_0x47cb14[_0xf153('0x6d')](function(_0x186011){_0x3114ec[_0xf153('0xb1')](updateSmsInteraction(_0x186011,_0x1edf65,_0x168b80));});return BPromise[_0xf153('0xb2')](_0x3114ec);});});})[_0xf153('0x2d')](function(_0x1c55a8){_0x9b3f4c['rows']=_0x1c55a8;return _0x9b3f4c;})[_0xf153('0x2d')](respondWithFilteredResult(_0x5c333b,_0x40834b));})[_0xf153('0x37')](handleError(_0x5c333b,null));};exports[_0xf153('0xb3')]=function(_0x596118,_0x573032){var _0x22b35b={'raw':![],'where':{'id':_0x596118[_0xf153('0xb4')]['id']}},_0x492f49={};_0x492f49[_0xf153('0x3b')]=_['keys'](db[_0xf153('0x38')][_0xf153('0xb5')]);_0x492f49[_0xf153('0x3c')]=_[_0xf153('0x3d')](_0x596118[_0xf153('0x3c')]);_0x492f49[_0xf153('0x47')]=_[_0xf153('0x3e')](_0x492f49[_0xf153('0x3b')],_0x492f49['query']);_0x22b35b[_0xf153('0x3f')]=_[_0xf153('0x3e')](_0x492f49['model'],qs['fields'](_0x596118[_0xf153('0x3c')]['fields']));_0x22b35b['attributes']=_0x22b35b[_0xf153('0x3f')][_0xf153('0x41')]?_0x22b35b['attributes']:_0x492f49[_0xf153('0x3b')];if(_0x596118[_0xf153('0x3c')][_0xf153('0xb6')]){_0x22b35b[_0xf153('0xb7')]=[{'all':!![]}];}_0x22b35b=_[_0xf153('0x9b')]({},_0x22b35b,_0x596118[_0xf153('0xb8')]);return db[_0xf153('0x38')][_0xf153('0x5e')](_0x22b35b)[_0xf153('0x2d')](handleEntityNotFound(_0x573032,null))['then'](respondWithResult(_0x573032,null))[_0xf153('0x37')](handleError(_0x573032,null));};exports['create']=function(_0x2f3419,_0x5e9a0c){return db[_0xf153('0x38')]['create'](_0x2f3419['body'],{})[_0xf153('0x2d')](respondWithResult(_0x5e9a0c,0xc9))['catch'](handleError(_0x5e9a0c,null));};exports[_0xf153('0x2c')]=function(_0x1f4e89,_0x486027){if(_0x1f4e89['body']['id']){delete _0x1f4e89[_0xf153('0x73')]['id'];}return db[_0xf153('0x38')][_0xf153('0x5e')]({'where':{'id':_0x1f4e89['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x486027,null))[_0xf153('0x2d')](saveUpdates(_0x1f4e89[_0xf153('0x73')],null))[_0xf153('0x2d')](respondWithResult(_0x486027,null))['catch'](handleError(_0x486027,null));};exports[_0xf153('0x2e')]=function(_0x185bc0,_0x67b37a){return db[_0xf153('0x38')][_0xf153('0x5e')]({'where':{'id':_0x185bc0[_0xf153('0xb4')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x67b37a,null))[_0xf153('0x2d')](removeEntity(_0x67b37a,null))[_0xf153('0x37')](handleError(_0x67b37a,null));};exports[_0xf153('0xb9')]=function(_0x3eef78,_0x1875d4){return db['SmsInteraction'][_0xf153('0xb9')]()[_0xf153('0x2d')](respondWithResult(_0x1875d4,null))['catch'](handleError(_0x1875d4,null));};exports[_0xf153('0xba')]=function(_0x4525e1,_0x1b0f01,_0x449f8d){return db[_0xf153('0xbb')]['find']({'where':{'id':_0x4525e1[_0xf153('0xb4')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x1b0f01,null))[_0xf153('0x2d')](function(_0xf711b2){if(_0xf711b2){return _0xf711b2[_0xf153('0xba')](_0x4525e1[_0xf153('0x73')][_0xf153('0xbc')],_[_0xf153('0xbd')](_0x4525e1[_0xf153('0x73')],[_0xf153('0xbc'),'id'])||{});}})[_0xf153('0x2d')](respondWithResult(_0x1b0f01,null))[_0xf153('0x37')](handleError(_0x1b0f01,null));};exports[_0xf153('0xbe')]=function(_0x191861,_0x152964,_0x564ded){var _0x20dd4e={'raw':![],'where':{}};var _0x24ad4d={};var _0x309063={'count':0x0,'rows':[]};return db[_0xf153('0x38')][_0xf153('0xbf')]({'where':{'id':_0x191861[_0xf153('0xb4')]['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x152964,null))[_0xf153('0x2d')](function(_0x573177){if(_0x573177){_0x24ad4d[_0xf153('0x3b')]=_[_0xf153('0x3d')](db[_0xf153('0xbb')][_0xf153('0xb5')]);_0x24ad4d[_0xf153('0x3c')]=_['keys'](_0x191861[_0xf153('0x3c')]);_0x24ad4d[_0xf153('0x47')]=_[_0xf153('0x3e')](_0x24ad4d[_0xf153('0x3b')],_0x24ad4d['query']);_0x20dd4e['attributes']=_[_0xf153('0x3e')](_0x24ad4d[_0xf153('0x3b')],qs['fields'](_0x191861['query'][_0xf153('0x40')]));_0x20dd4e[_0xf153('0x3f')]=_0x20dd4e[_0xf153('0x3f')][_0xf153('0x41')]?_0x20dd4e[_0xf153('0x3f')]:_0x24ad4d[_0xf153('0x3b')];if(!_0x191861[_0xf153('0x3c')][_0xf153('0x42')](_0xf153('0x43'))){_0x20dd4e['limit']=qs[_0xf153('0x26')](_0x191861[_0xf153('0x3c')]['limit']);_0x20dd4e[_0xf153('0x25')]=qs[_0xf153('0x25')](_0x191861[_0xf153('0x3c')][_0xf153('0x25')]);}_0x20dd4e['order']=qs['sort'](_0x191861[_0xf153('0x3c')][_0xf153('0x45')]);_0x20dd4e[_0xf153('0x46')]=qs['filters'](_[_0xf153('0xc0')](_0x191861[_0xf153('0x3c')],_0x24ad4d[_0xf153('0x47')]));_0x20dd4e[_0xf153('0x46')][_0xf153('0xb0')]=_0x573177['id'];if(_0x191861[_0xf153('0x3c')][_0xf153('0x83')]){_0x20dd4e['where']=_[_0xf153('0x9b')](_0x20dd4e[_0xf153('0x46')],{'$or':_[_0xf153('0x33')](_0x20dd4e[_0xf153('0x3f')],function(_0x45d9b7){var _0x1b0043={};_0x1b0043[_0x45d9b7]={'$like':'%'+_0x191861[_0xf153('0x3c')][_0xf153('0x83')]+'%'};return _0x1b0043;})});}if(_0x191861[_0xf153('0x3c')]['$gte']){var _0x2dd1d8=_0x191861[_0xf153('0x3c')][_0xf153('0x7a')][_0xf153('0x66')](',');var _0x1b4f50={};_0x1b4f50[_0x2dd1d8[0x0]]={'$gte':moment(_0x2dd1d8[0x1])[_0xf153('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x20dd4e[_0xf153('0x46')]=_[_0xf153('0x9b')](_0x20dd4e[_0xf153('0x46')],_0x1b4f50);}_0x20dd4e=_[_0xf153('0x9b')]({},_0x20dd4e,_0x191861['options']);return db[_0xf153('0xbb')][_0xf153('0x24')]({'where':_0x20dd4e[_0xf153('0x46')]})[_0xf153('0x2d')](function(_0x3c4961){_0x309063['count']=_0x3c4961;if(_0x191861[_0xf153('0x3c')][_0xf153('0xb6')]){_0x20dd4e['include']=[{'all':!![]}];}return db[_0xf153('0xbb')]['findAll'](_0x20dd4e);})[_0xf153('0x2d')](function(_0x6999a3){_0x309063[_0xf153('0xc2')]=_0x6999a3;return _0x309063;});}})[_0xf153('0x2d')](respondWithFilteredResult(_0x152964,_0x20dd4e))['catch'](handleError(_0x152964,null));};exports[_0xf153('0xc3')]=function(_0x1a0ad5,_0x4d7e1e,_0xa1c6d6){return db['SmsInteraction'][_0xf153('0x5e')]({'where':{'id':_0x1a0ad5[_0xf153('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4d7e1e,null))['then'](function(_0x5c660a){if(_0x5c660a){return _0x5c660a[_0xf153('0xc4')](_0x1a0ad5[_0xf153('0x73')]['ids'],_[_0xf153('0xbd')](_0x1a0ad5[_0xf153('0x73')],['ids','id'])||{})['spread'](function(){return db[_0xf153('0xc5')][_0xf153('0xc6')]({'attributes':['id',_0xf153('0x30'),_0xf153('0x4a')],'where':{'id':_0x1a0ad5[_0xf153('0x73')][_0xf153('0xbc')]}});})[_0xf153('0x2d')](function(_0x1ead05){socket[_0xf153('0xc7')](_0xf153('0xc8'),{'id':Number(_0x1a0ad5['params']['id']),'tags':_0x1ead05||[]});return{'id':Number(_0x1a0ad5[_0xf153('0xb4')]['id']),'tags':_0x1ead05||[]};});}})['then'](respondWithResult(_0x4d7e1e,null))['catch'](handleError(_0x4d7e1e,null));};exports[_0xf153('0xc9')]=function(_0x15f1ee,_0x264968,_0xe61167){return db['SmsInteraction'][_0xf153('0x5e')]({'where':{'id':_0x15f1ee['params']['id']}})[_0xf153('0x2d')](handleEntityNotFound(_0x264968,null))[_0xf153('0x2d')](function(_0x160df9){if(_0x160df9){return _0x160df9['removeTags'](_0x15f1ee[_0xf153('0x3c')][_0xf153('0xbc')]);}})['then'](respondWithStatusCode(_0x264968,null))[_0xf153('0x37')](handleError(_0x264968,null));};exports['download']=function(_0x2d8c95,_0x1ba174){var _0xab67b7=moment()['unix']()['toString']();var _0x2a4a11=path['join'](config[_0xf153('0xca')],_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcd'));var _0x18b932=path[_0xf153('0xce')](config[_0xf153('0xca')],_0xf153('0xcb'),_0xf153('0xcc'),_0xf153('0xcf'));var _0x1a9bfb=path[_0xf153('0xce')](_0x2a4a11,_0xab67b7);var _0x27f5c4=util[_0xf153('0xc1')](_0xf153('0xd0'),_0x2d8c95[_0xf153('0xb4')]['id'],_0xab67b7);var _0x5cb482=path['join'](_0x2a4a11,_0x27f5c4);var _0xcb600=[];_0xcb600[_0xf153('0xb1')]({'model':db[_0xf153('0x70')],'as':'User','attributes':['id',_0xf153('0x34')],'raw':!![]});_0xcb600[_0xf153('0xb1')]({'model':db[_0xf153('0xd1')],'as':'Contact','attributes':['id',_0xf153('0xd2'),_0xf153('0xd3')],'raw':!![]});var _0xeebd4f=[{'model':db[_0xf153('0xbb')],'as':_0xf153('0xd4'),'attributes':['id','body',_0xf153('0x78'),'direction',_0xf153('0xd5'),'read'],'include':_0xcb600}];_0xeebd4f['push']({'model':db['SmsAccount'],'as':_0xf153('0xd6'),'attributes':['id','name']});_0xeebd4f[_0xf153('0xb1')]({'model':db['User'],'as':_0xf153('0xd7'),'attributes':['id',_0xf153('0x34')]});return db[_0xf153('0x38')][_0xf153('0x5e')]({'where':{'id':_0x2d8c95['params']['id']},'include':_0xeebd4f})[_0xf153('0x2d')](handleEntityNotFound(_0x1ba174,null))[_0xf153('0x2d')](function(_0x56e63f){if(_0x56e63f){var _0x4470b8=_0x56e63f[_0xf153('0xd8')]({'plain':!![]});fs[_0xf153('0xd9')](_0x1a9bfb);var _0x27f5b3={'format':'A4','border':_0xf153('0xda'),'header':{'height':_0xf153('0xdb'),'contents':{'first':_0xf153('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0xf153('0xc1')](_0xf153('0xdd'),util[_0xf153('0xc1')](_0xf153('0xde'),_0xf153('0xdf'),_0x4470b8['id']),moment()[_0xf153('0xc1')](_0xf153('0xe0'))['toString']())}}};var _0x40a066={'channel':_0xf153('0xdf'),'account':_0x4470b8[_0xf153('0xd6')][_0xf153('0x30')],'agent':_0x4470b8[_0xf153('0xd7')]?_0x4470b8['Owner']['fullname']:_0xf153('0xe1'),'createdAt':moment(_0x4470b8[_0xf153('0x78')])['format'](_0xf153('0xe2'))[_0xf153('0x99')](),'closedAt':_0x4470b8[_0xf153('0xe3')]?moment(_0x4470b8['closedAt'])['format'](_0xf153('0xe2'))[_0xf153('0x99')]():'','disposition':_0x4470b8[_0xf153('0xe4')],'messages':_(_0x4470b8['Messages'])[_0xf153('0x83')]({'secret':![]})[_0xf153('0x33')](function(_0x3e427e){return{'date':moment(_0x3e427e[_0xf153('0x78')])[_0xf153('0xc1')](_0xf153('0xe2'))[_0xf153('0x99')](),'sender':_0x3e427e[_0xf153('0xe5')]===_0xf153('0xe6')?_0x3e427e[_0xf153('0x70')]?_0x3e427e[_0xf153('0x70')][_0xf153('0x34')]:_0xf153('0xe7'):_0x3e427e[_0xf153('0x63')][_0xf153('0xd2')]+(_0x3e427e[_0xf153('0x63')][_0xf153('0xd3')]?'\x20'+_0x3e427e[_0xf153('0x63')]['lastName']:''),'body':_0x3e427e[_0xf153('0x73')],'direction':_0x3e427e['direction']===_0xf153('0xe6')?'A':'C','secret':_0x3e427e[_0xf153('0xd5')],'read':_0x3e427e['read']};})['value']()};return ejs['renderFile'](path[_0xf153('0xce')](config[_0xf153('0xca')],_0xf153('0xcb'),_0xf153('0xe8'),'downloadInteraction.html'),{'interaction':_0x40a066})[_0xf153('0x2d')](function(_0x2ac13c){return new BPromise(function(_0x1ed570,_0x325daf){pdf[_0xf153('0xe9')](_0x2ac13c,_0x27f5b3)[_0xf153('0xea')](path[_0xf153('0xce')](_0x1a9bfb,_0xf153('0xeb')+_0x4470b8['id']+'-'+_0xab67b7+'.pdf'),function(_0x42424b,_0x2bcedc){if(_0x42424b)return _0x325daf(_0x42424b);_0x1ed570(_0x2bcedc);});});})['then'](function(){return new BPromise(function(_0x5499a4,_0x3021e6){zipdir(_0x1a9bfb,{'saveTo':_0x5cb482},function(_0x1509f9,_0x4e8518){if(_0x1509f9)return _0x3021e6(_0x1509f9);return _0x5499a4(_0x4e8518);});})[_0xf153('0x2d')](function(){return new BPromise(function(_0x511f79,_0x3057f1){rimraf(_0x1a9bfb,function(_0x207255){if(_0x207255)_0x3057f1(_0x207255);return _0x511f79();});});})[_0xf153('0x2d')](function(){return _0x1ba174[_0xf153('0xec')](_0x5cb482,_0x27f5c4,function(_0x3f754d){if(_0x3f754d){console['log'](_0xf153('0xed'),_0x3f754d);}else{fs['unlinkSync'](_0x5cb482);}});});});}else{return _0x1ba174['sendStatus'](0xc8);}})[_0xf153('0x37')](handleError(_0x1ba174,null));}; \ No newline at end of file +var _0xe13a=['t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','some','compact','isEmpty','SmsAccountId','concat','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','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)','t.id\x20IN\x20?','resolve','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','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','push','all','rows','show','params','options','create','body','destroy','describe','SmsMessage','ids','getMessages','findOne','nolimit','format','includeAll','include','findAll','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','createdAt','direction','secret','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','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','renderFile','views','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','count','offset','set','apply','reject','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filters','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags'];(function(_0x2d0215,_0x5c13ba){var _0x487a5d=function(_0x3872af){while(--_0x3872af){_0x2d0215['push'](_0x2d0215['shift']());}};_0x487a5d(++_0x5c13ba);}(_0xe13a,0x178));var _0xae13=function(_0x50ccf7,_0x55774b){_0x50ccf7=_0x50ccf7-0x0;var _0x116dae=_0xe13a[_0x50ccf7];return _0x116dae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var db=require(_0xae13('0x1a'))['db'];config[_0xae13('0x1b')]=_['defaults'](config[_0xae13('0x1b')],{'host':_0xae13('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x52484b,_0x26ff3e){_0x26ff3e=_0x26ff3e||0xcc;return function(_0x148186){if(_0x148186){return _0x52484b[_0xae13('0x1d')](_0x26ff3e);}return _0x52484b[_0xae13('0x1e')](_0x26ff3e)[_0xae13('0x1f')]();};}function respondWithResult(_0x2912a2,_0x5c25a4){_0x5c25a4=_0x5c25a4||0xc8;return function(_0x3c488f){if(_0x3c488f){return _0x2912a2['status'](_0x5c25a4)[_0xae13('0x20')](_0x3c488f);}};}function respondWithFilteredResult(_0x16764b,_0x207363){return function(_0x118e52){if(_0x118e52){var _0x1a9c07=_0x118e52[_0xae13('0x21')],_0x1b33b7=_0x207363['offset'],_0x32dcbe=_0x207363[_0xae13('0x22')]+_0x207363['limit'],_0x326471;if(_0x32dcbe>=_0x1a9c07){_0x32dcbe=_0x1a9c07;_0x326471=0xc8;}else{_0x326471=0xce;}_0x16764b[_0xae13('0x1e')](_0x326471);return _0x16764b[_0xae13('0x23')]('Content-Range',_0x1b33b7+'-'+_0x32dcbe+'/'+_0x1a9c07)[_0xae13('0x20')](_0x118e52);}return null;};}function patchUpdates(_0x39d41c){return function(_0x3e4bc8){try{jsonpatch[_0xae13('0x24')](_0x3e4bc8,_0x39d41c,!![]);}catch(_0x184375){return BPromise[_0xae13('0x25')](_0x184375);}return _0x3e4bc8['save']();};}function saveUpdates(_0x520692,_0x149eda){return function(_0x290fb9){if(_0x290fb9){return _0x290fb9['update'](_0x520692)[_0xae13('0x26')](function(_0x519a37){return _0x519a37;});}return null;};}function removeEntity(_0x13c2de,_0x194437){return function(_0x3f12b0){if(_0x3f12b0){return _0x3f12b0['destroy']()['then'](function(){_0x13c2de['status'](0xcc)[_0xae13('0x1f')]();});}};}function handleEntityNotFound(_0xc5e6a7,_0x17ce58){return function(_0x55a39b){if(!_0x55a39b){_0xc5e6a7[_0xae13('0x1d')](0x194);}return _0x55a39b;};}function handleError(_0x517e71,_0x3d0d60){_0x3d0d60=_0x3d0d60||0x1f4;return function(_0x5de054){logger[_0xae13('0x27')](_0x5de054[_0xae13('0x28')]);if(_0x5de054['name']){delete _0x5de054[_0xae13('0x29')];}_0x517e71[_0xae13('0x1e')](_0x3d0d60)[_0xae13('0x2a')](_0x5de054);};}function getInteractionUsers(_0x306dfb,_0x578e99){return new BPromise(function(_0x41ceb7,_0x27b737){try{if(_0x578e99[_0x306dfb['id']]){_0x306dfb[_0xae13('0x2b')]=_[_0xae13('0x2c')](_0x578e99[_0x306dfb['id']],function(_0x742759){return{'id':_0x742759['id'],'fullname':_0x742759[_0xae13('0x2d')]};});}}catch(_0x277b69){_0x27b737(_0x277b69);}_0x41ceb7(_0x306dfb);});}function getInteractionTags(_0x5bd0ee,_0x133481){return new BPromise(function(_0x591f94,_0xf6289c){try{if(_0x5bd0ee[_0xae13('0x2e')]){_0x5bd0ee[_0xae13('0x2f')]=[];_0x5bd0ee[_0xae13('0x2e')][_0xae13('0x30')](',')[_0xae13('0x31')](function(_0x11c2ba){_0x5bd0ee['Tags']['push'](_0x133481[_0x11c2ba]);});}delete _0x5bd0ee[_0xae13('0x2e')];}catch(_0x233896){_0xf6289c(_0x233896);}_0x591f94(_0x5bd0ee);});}function updateSmsInteraction(_0xb3764d,_0x3710d6,_0x3d4ffd){return new BPromise(function(_0xfac8e7,_0x126686){return getInteractionUsers(_0xb3764d,_0x3d4ffd)[_0xae13('0x26')](function(_0x1fda10){return getInteractionTags(_0x1fda10,_0x3710d6);})[_0xae13('0x26')](function(_0x5f1aeb){_0xfac8e7(_0x5f1aeb);})[_0xae13('0x32')](function(_0x116270){_0x126686(_0x116270);});});}exports[_0xae13('0x33')]=function(_0x597001,_0x53b5f6){var _0x587b6f={},_0x5ba0a8={},_0x5b4060={'count':0x0,'rows':[]};var _0x5ee151=_[_0xae13('0x2c')](db[_0xae13('0x34')][_0xae13('0x35')],function(_0x5bb32a){return{'name':_0x5bb32a[_0xae13('0x36')],'type':_0x5bb32a[_0xae13('0x37')][_0xae13('0x38')]};});_0x5ba0a8[_0xae13('0x39')]=_[_0xae13('0x2c')](_0x5ee151,'name');_0x5ba0a8[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x597001[_0xae13('0x3a')]);_0x5ba0a8['filters']=_['intersection'](_0x5ba0a8[_0xae13('0x39')],_0x5ba0a8[_0xae13('0x3a')]);_0x587b6f[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x5ba0a8['model'],qs[_0xae13('0x3e')](_0x597001[_0xae13('0x3a')]['fields']));_0x587b6f[_0xae13('0x3c')]=_0x587b6f[_0xae13('0x3c')]['length']?_0x587b6f[_0xae13('0x3c')]:_0x5ba0a8[_0xae13('0x39')];if(!_0x597001[_0xae13('0x3a')][_0xae13('0x3f')]('nolimit')){_0x587b6f[_0xae13('0x40')]=qs[_0xae13('0x40')](_0x597001[_0xae13('0x3a')][_0xae13('0x40')]);_0x587b6f['offset']=qs[_0xae13('0x22')](_0x597001[_0xae13('0x3a')][_0xae13('0x22')]);}_0x587b6f[_0xae13('0x41')]=qs['sort'](_0x597001['query'][_0xae13('0x42')]);_0x587b6f[_0xae13('0x43')]=qs['filters'](_[_0xae13('0x44')](_0x597001['query'],_0x5ba0a8[_0xae13('0x45')]),_0x5ee151);var _0x230ba6=[];var _0x3fca0a=squel['select']()[_0xae13('0x46')]('id')[_0xae13('0x46')](_0xae13('0x29'))[_0xae13('0x46')]('color')[_0xae13('0x47')](_0xae13('0x48'));var _0x133f00=squel[_0xae13('0x49')]()[_0xae13('0x46')](_0xae13('0x4a'))[_0xae13('0x46')](_0xae13('0x4b'))['field'](_0xae13('0x4c'))['from'](_0xae13('0x4d'),'ui')[_0xae13('0x4e')](_0xae13('0x4f'),'u',_0xae13('0x50'));var _0x51cbcc=squel[_0xae13('0x49')]()['from'](_0xae13('0x51'),'i')[_0xae13('0x4e')]('cm_contacts','c',_0xae13('0x52'))[_0xae13('0x4e')](_0xae13('0x4f'),'o',_0xae13('0x53'))[_0xae13('0x4e')](_0xae13('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xae13('0x4e')](_0xae13('0x55'),'me',_0xae13('0x56'))[_0xae13('0x4e')](_0xae13('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xae13('0x4e')](_0xae13('0x48'),'t',_0xae13('0x58'));var _0x551ed6=squel['expr']();var _0x498db2=[];var _0x566692=squel[_0xae13('0x59')]();var _0x552efd;if(_0x597001[_0xae13('0x3a')]['search']){_0x552efd=as[_0xae13('0x5a')](_0x597001[_0xae13('0x3a')][_0xae13('0x5b')]);var _0x4029dc=_0x552efd[_0xae13('0x5c')];for(var _0x53d341=0x0;_0x53d341<_0x552efd[_0xae13('0x5d')][_0xae13('0x5e')];_0x53d341++){var _0x5eb0ec=_0x552efd[_0xae13('0x5d')][_0x53d341];var _0x41913a='i';var _0x49c43a=_['find'](_0x5ee151,['name',_0x5eb0ec['field']]);if(!_0x49c43a){switch(_0x5eb0ec[_0xae13('0x46')]){case _0xae13('0x5f'):if(_0x5eb0ec['value']==0x1){_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+'`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+_0xae13('0x61'));}break;case _0xae13('0x62'):if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){if(_0x5eb0ec[_0xae13('0x65')][_0xae13('0x30')]('\x20')[_0xae13('0x5e')]>0x1){_0x551ed6[_0x4029dc](_0xae13('0x66'),qs['getFullTextValue'](_0x5eb0ec[_0xae13('0x65')]),null);}else{var _0xb8beec='%'+_0x5eb0ec[_0xae13('0x65')]+'%';_0x551ed6[_0x4029dc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xb8beec,_0xb8beec,_0xb8beec);}}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,['name',_0xae13('0x68')]);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x68');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a['type'],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case _0xae13('0x6b'):var _0x3b9840=_0x5eb0ec['value'][_0xae13('0x30')](',')[_0xae13('0x2c')](function(_0x1cf135){return Number(_0x1cf135);});_0x3b9840[_0xae13('0x31')](function(_0xcbac5b){_0x566692['or'](_0xae13('0x6c'),'%,'+_0xcbac5b+',%');});_0x498db2=_[_0xae13('0x6d')](_0x498db2,_0x3b9840);break;case'User':if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){_0x551ed6[_0x4029dc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eb0ec[_0xae13('0x65')]+'%',null);}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,[_0xae13('0x29'),'UserId']);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x6e');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case'body':_0x43e176=as['buildExpression']('me',null,_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);break;}}else{var _0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176['value']['start'],_0x43e176['value'][_0xae13('0x1f')]);}}}else{var _0xf998e5=_(_0x597001[_0xae13('0x3a')])[_0xae13('0x3b')]()[_0xae13('0x2c')](function(_0x2754e0){return _[_0xae13('0x6f')](_0x5ee151,[_0xae13('0x29'),_0x2754e0])?_0x2754e0:undefined;})[_0xae13('0x70')]()[_0xae13('0x65')]();if(!_[_0xae13('0x71')](_0xf998e5)){_0xf998e5[_0xae13('0x31')](function(_0x177e9e){if(_0x177e9e===_0xae13('0x72')){_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',[][_0xae13('0x73')](_0x597001[_0xae13('0x3a')][_0x177e9e]));}else if(_0x177e9e==='createdAt'){var _0x37dcdd=JSON['parse'](_0x597001['query'][_0x177e9e])[_0xae13('0x74')];var _0x25cc60=JSON[_0xae13('0x75')](_0x597001[_0xae13('0x3a')][_0x177e9e])[_0xae13('0x76')];_0x51cbcc[_0xae13('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37dcdd,_0x25cc60);}else{if(_0x597001['query'][_0x177e9e]===_0xae13('0x77')){_0x51cbcc[_0xae13('0x43')]('i.'+_0x177e9e+_0xae13('0x78'));}else{_0x51cbcc['where']('i.'+_0x177e9e+_0xae13('0x79'),_0x597001['query'][_0x177e9e]);}}});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]){if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]==0x1){_0x51cbcc[_0xae13('0x60')]('`unreadMessages`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')](_0xae13('0x7b'));}}if(_0x597001['query'][_0xae13('0x7c')]){_0x498db2=_[_0xae13('0x7d')](_0x597001[_0xae13('0x3a')][_0xae13('0x7c')])?_0x597001[_0xae13('0x3a')][_0xae13('0x7c')]:new Array(_0x597001['query'][_0xae13('0x7c')]);_0x498db2['forEach'](function(_0x272e3c){_0x566692['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x272e3c+',%');});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7e')]){var _0x5b1880=_0x597001[_0xae13('0x3a')][_0xae13('0x7e')][_0xae13('0x7f')]('\x5c','\x5c\x5c')[_0xae13('0x7f')]('\x27\x27',_0xae13('0x80'));if(qs[_0xae13('0x81')](_0x5b1880)){_0x551ed6['or'](_0xae13('0x82'),_0x5b1880+'%')['or'](_0xae13('0x83'),_0x5b1880+'%');}else{_0x551ed6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xae13('0x84')](_0x5b1880))['or'](_0xae13('0x85'),_0x5b1880+'%');}}}_0x51cbcc[_0xae13('0x43')](_0x551ed6);_0x51cbcc[_0xae13('0x86')](_0xae13('0x87'));var _0x13c1f3={'type':db[_0xae13('0x88')][_0xae13('0x89')][_0xae13('0x8a')],'raw':!![]};var _0x471f64=_0x51cbcc['clone']();_0x471f64[_0xae13('0x46')]('i.id');_0x471f64['field'](_0xae13('0x8b'),_0xae13('0x5f'));if(_0x587b6f[_0xae13('0x41')]){_0x587b6f['order'][_0xae13('0x31')](function(_0x5d1b1c){_0x51cbcc[_0xae13('0x41')]('i.'+_0x5d1b1c[0x0],_0x5d1b1c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xae13('0x71')](_0x498db2)){_0x51cbcc[_0xae13('0x60')](_0x566692);_0x471f64['where'](_0xae13('0x8c'),_0x498db2);}BPromise[_0xae13('0x8d')]()['then'](function(){if(!_0x552efd){if(_0x597001['query'][_0xae13('0x72')]||_0x597001['query']['journey'])return;_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x597001[_0xae13('0x8e')][_0xae13('0x8f')]({'attributes':['id'],'raw':!![]})[_0xae13('0x26')](function(_0x88d31){if(_[_0xae13('0x71')](_0x88d31)){_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x51cbcc[_0xae13('0x43')](_0xae13('0x90'));}else{_0x471f64['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x88d31,'id'));_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0xae13('0x2c')](_0x88d31,'id'));}});})['then'](function(){db['sequelize'][_0xae13('0x3a')](_0x471f64[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x2cfdc4){_0x5b4060[_0xae13('0x21')]=_0x2cfdc4[_0xae13('0x5e')];if(_0x5b4060['count']===0x0)return[];return db[_0xae13('0x92')][_0xae13('0x3a')](_0x3fca0a[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x4ea1f4){_0x230ba6=_[_0xae13('0x93')](_0x4ea1f4,'id');_0x13c1f3=_[_0xae13('0x94')](_0x13c1f3,{'model':db[_0xae13('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x597001['query']['fields']){_0x587b6f[_0xae13('0x3c')][_0xae13('0x31')](function(_0x405cc2){_0x51cbcc[_0xae13('0x46')]('i.'+_0x405cc2);});}else{_0x51cbcc[_0xae13('0x46')](_0xae13('0x8b'),_0xae13('0x5f'));_0x51cbcc[_0xae13('0x46')]('a.key',_0xae13('0x95'));_0x51cbcc[_0xae13('0x46')]('a.mandatoryDisposition',_0xae13('0x96'));_0x51cbcc[_0xae13('0x46')]('i.*');_0x51cbcc[_0xae13('0x46')](_0xae13('0x97'),'Contact.firstName');_0x51cbcc[_0xae13('0x46')](_0xae13('0x98'),_0xae13('0x99'));_0x51cbcc['field']('c.email',_0xae13('0x9a'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9b'),'Contact.phone');_0x51cbcc[_0xae13('0x46')]('c.mobile',_0xae13('0x9c'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9d'),_0xae13('0x9e'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9f'),_0xae13('0xa0'));_0x51cbcc[_0xae13('0x46')](_0xae13('0xa1'),_0xae13('0xa2'));_0x51cbcc['field'](_0xae13('0xa3'),'TagIds');}if(_0x587b6f[_0xae13('0x40')])_0x51cbcc[_0xae13('0x40')](_0x587b6f[_0xae13('0x40')]);if(_0x587b6f[_0xae13('0x22')])_0x51cbcc[_0xae13('0x22')](_0x587b6f[_0xae13('0x22')]);return db[_0xae13('0x92')][_0xae13('0x3a')](_0x51cbcc[_0xae13('0x91')](),_0x13c1f3);})[_0xae13('0x26')](function(_0x58c874){_0x133f00[_0xae13('0x43')](_0xae13('0xa4'),_[_0xae13('0x2c')](_0x58c874,'id'));return db[_0xae13('0x92')][_0xae13('0x3a')](_0x133f00[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x360b1a){var _0x544f6d=_[_0xae13('0xa5')](_0x360b1a,_0xae13('0xa6'));var _0x3a02c3=[];_0x58c874[_0xae13('0x31')](function(_0x2e8e14){_0x3a02c3[_0xae13('0xa7')](updateSmsInteraction(_0x2e8e14,_0x230ba6,_0x544f6d));});return BPromise[_0xae13('0xa8')](_0x3a02c3);});});})['then'](function(_0x2eaf8b){_0x5b4060[_0xae13('0xa9')]=_0x2eaf8b;return _0x5b4060;})[_0xae13('0x26')](respondWithFilteredResult(_0x53b5f6,_0x587b6f));})[_0xae13('0x32')](handleError(_0x53b5f6,null));};exports[_0xae13('0xaa')]=function(_0x2ced73,_0x4a5551){var _0xbcae23={'raw':![],'where':{'id':_0x2ced73[_0xae13('0xab')]['id']}},_0x17c277={};_0x17c277[_0xae13('0x39')]=_[_0xae13('0x3b')](db[_0xae13('0x34')][_0xae13('0x35')]);_0x17c277[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x2ced73[_0xae13('0x3a')]);_0x17c277[_0xae13('0x45')]=_['intersection'](_0x17c277[_0xae13('0x39')],_0x17c277[_0xae13('0x3a')]);_0xbcae23[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x17c277[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2ced73['query']['fields']));_0xbcae23[_0xae13('0x3c')]=_0xbcae23['attributes'][_0xae13('0x5e')]?_0xbcae23[_0xae13('0x3c')]:_0x17c277[_0xae13('0x39')];if(_0x2ced73[_0xae13('0x3a')]['includeAll']){_0xbcae23['include']=[{'all':!![]}];}_0xbcae23=_[_0xae13('0x94')]({},_0xbcae23,_0x2ced73[_0xae13('0xac')]);return db[_0xae13('0x34')]['find'](_0xbcae23)['then'](handleEntityNotFound(_0x4a5551,null))[_0xae13('0x26')](respondWithResult(_0x4a5551,null))[_0xae13('0x32')](handleError(_0x4a5551,null));};exports[_0xae13('0xad')]=function(_0x22bb08,_0x34276a){return db[_0xae13('0x34')]['create'](_0x22bb08[_0xae13('0xae')],{})[_0xae13('0x26')](respondWithResult(_0x34276a,0xc9))[_0xae13('0x32')](handleError(_0x34276a,null));};exports['update']=function(_0x4d1a9b,_0x1bceda){if(_0x4d1a9b[_0xae13('0xae')]['id']){delete _0x4d1a9b[_0xae13('0xae')]['id'];}return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x4d1a9b[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x1bceda,null))['then'](saveUpdates(_0x4d1a9b[_0xae13('0xae')],null))[_0xae13('0x26')](respondWithResult(_0x1bceda,null))[_0xae13('0x32')](handleError(_0x1bceda,null));};exports[_0xae13('0xaf')]=function(_0x51ff57,_0x388389){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x51ff57[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x388389,null))[_0xae13('0x26')](removeEntity(_0x388389,null))[_0xae13('0x32')](handleError(_0x388389,null));};exports[_0xae13('0xb0')]=function(_0x54af8f,_0xbf1893){return db[_0xae13('0x34')][_0xae13('0xb0')]()[_0xae13('0x26')](respondWithResult(_0xbf1893,null))[_0xae13('0x32')](handleError(_0xbf1893,null));};exports['addMessage']=function(_0x5e6a58,_0x11360b,_0x1954fb){return db[_0xae13('0xb1')][_0xae13('0x67')]({'where':{'id':_0x5e6a58[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x11360b,null))[_0xae13('0x26')](function(_0x175c32){if(_0x175c32){return _0x175c32['addMessage'](_0x5e6a58['body']['ids'],_['omit'](_0x5e6a58['body'],[_0xae13('0xb2'),'id'])||{});}})[_0xae13('0x26')](respondWithResult(_0x11360b,null))['catch'](handleError(_0x11360b,null));};exports[_0xae13('0xb3')]=function(_0x2c28c7,_0x5c6c94,_0x487cd2){var _0x1b7a07={'raw':![],'where':{}};var _0x4965e8={};var _0x25ac7d={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae13('0xb4')]({'where':{'id':_0x2c28c7[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x5c6c94,null))[_0xae13('0x26')](function(_0x503e97){if(_0x503e97){_0x4965e8['model']=_[_0xae13('0x3b')](db['SmsMessage'][_0xae13('0x35')]);_0x4965e8[_0xae13('0x3a')]=_['keys'](_0x2c28c7[_0xae13('0x3a')]);_0x4965e8[_0xae13('0x45')]=_[_0xae13('0x3d')](_0x4965e8[_0xae13('0x39')],_0x4965e8['query']);_0x1b7a07[_0xae13('0x3c')]=_['intersection'](_0x4965e8[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x3e')]));_0x1b7a07['attributes']=_0x1b7a07['attributes'][_0xae13('0x5e')]?_0x1b7a07[_0xae13('0x3c')]:_0x4965e8['model'];if(!_0x2c28c7[_0xae13('0x3a')]['hasOwnProperty'](_0xae13('0xb5'))){_0x1b7a07['limit']=qs[_0xae13('0x40')](_0x2c28c7[_0xae13('0x3a')]['limit']);_0x1b7a07[_0xae13('0x22')]=qs['offset'](_0x2c28c7['query'][_0xae13('0x22')]);}_0x1b7a07[_0xae13('0x41')]=qs[_0xae13('0x42')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x42')]);_0x1b7a07[_0xae13('0x43')]=qs[_0xae13('0x45')](_['pick'](_0x2c28c7[_0xae13('0x3a')],_0x4965e8[_0xae13('0x45')]));_0x1b7a07[_0xae13('0x43')][_0xae13('0xa6')]=_0x503e97['id'];if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x7e')]){_0x1b7a07[_0xae13('0x43')]=_[_0xae13('0x94')](_0x1b7a07[_0xae13('0x43')],{'$or':_[_0xae13('0x2c')](_0x1b7a07[_0xae13('0x3c')],function(_0x47bc0f){var _0x4b5f0e={};_0x4b5f0e[_0x47bc0f]={'$like':'%'+_0x2c28c7['query'][_0xae13('0x7e')]+'%'};return _0x4b5f0e;})});}if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]){var _0x188883=_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]['split'](',');var _0x2da9e2={};_0x2da9e2[_0x188883[0x0]]={'$gte':moment(_0x188883[0x1])[_0xae13('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b7a07['where']=_[_0xae13('0x94')](_0x1b7a07['where'],_0x2da9e2);}_0x1b7a07=_[_0xae13('0x94')]({},_0x1b7a07,_0x2c28c7[_0xae13('0xac')]);return db[_0xae13('0xb1')][_0xae13('0x21')]({'where':_0x1b7a07['where']})[_0xae13('0x26')](function(_0x52f5e1){_0x25ac7d['count']=_0x52f5e1;if(_0x2c28c7['query'][_0xae13('0xb7')]){_0x1b7a07[_0xae13('0xb8')]=[{'all':!![]}];}return db[_0xae13('0xb1')][_0xae13('0xb9')](_0x1b7a07);})[_0xae13('0x26')](function(_0x1403b9){_0x25ac7d[_0xae13('0xa9')]=_0x1403b9;return _0x25ac7d;});}})[_0xae13('0x26')](respondWithFilteredResult(_0x5c6c94,_0x1b7a07))[_0xae13('0x32')](handleError(_0x5c6c94,null));};exports['addTags']=function(_0x393ee9,_0x2c159a,_0x1cfc6d){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x393ee9[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x2c159a,null))[_0xae13('0x26')](function(_0x1d155e){if(_0x1d155e){return _0x1d155e[_0xae13('0xba')](_0x393ee9[_0xae13('0xae')]['ids'],_[_0xae13('0xbb')](_0x393ee9[_0xae13('0xae')],[_0xae13('0xb2'),'id'])||{})[_0xae13('0xbc')](function(){return db[_0xae13('0x6b')][_0xae13('0xb9')]({'attributes':['id','name','color'],'where':{'id':_0x393ee9[_0xae13('0xae')][_0xae13('0xb2')]}});})[_0xae13('0x26')](function(_0x4955e5){socket[_0xae13('0xbd')](_0xae13('0xbe'),{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]});return{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]};});}})[_0xae13('0x26')](respondWithResult(_0x2c159a,null))['catch'](handleError(_0x2c159a,null));};exports[_0xae13('0xbf')]=function(_0x25c841,_0x295bb8,_0x4e7fe4){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x25c841[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x295bb8,null))[_0xae13('0x26')](function(_0x33f6b3){if(_0x33f6b3){return _0x33f6b3[_0xae13('0xbf')](_0x25c841[_0xae13('0x3a')][_0xae13('0xb2')]);}})['then'](respondWithStatusCode(_0x295bb8,null))[_0xae13('0x32')](handleError(_0x295bb8,null));};exports[_0xae13('0xc0')]=function(_0x299bd4,_0x221b23){var _0x21b2d2=moment()[_0xae13('0xc1')]()['toString']();var _0x3f441c=path[_0xae13('0xc2')](config[_0xae13('0xc3')],_0xae13('0xc4'),_0xae13('0xc5'),'tmp');var _0xa0a63b=path['join'](config['root'],_0xae13('0xc4'),_0xae13('0xc5'),_0xae13('0xc6'));var _0x47674a=path[_0xae13('0xc2')](_0x3f441c,_0x21b2d2);var _0x173a07=util[_0xae13('0xb6')](_0xae13('0xc7'),_0x299bd4[_0xae13('0xab')]['id'],_0x21b2d2);var _0x70899a=path['join'](_0x3f441c,_0x173a07);var _0xce2ef=[];_0xce2ef['push']({'model':db[_0xae13('0xc8')],'as':_0xae13('0xc8'),'attributes':['id',_0xae13('0x2d')],'raw':!![]});_0xce2ef[_0xae13('0xa7')]({'model':db[_0xae13('0xc9')],'as':'Contact','attributes':['id',_0xae13('0xca'),_0xae13('0xcb')],'raw':!![]});var _0x41aea2=[{'model':db[_0xae13('0xb1')],'as':'Messages','attributes':['id',_0xae13('0xae'),_0xae13('0xcc'),_0xae13('0xcd'),_0xae13('0xce'),_0xae13('0x7a')],'include':_0xce2ef}];_0x41aea2[_0xae13('0xa7')]({'model':db['SmsAccount'],'as':_0xae13('0xcf'),'attributes':['id','name']});_0x41aea2[_0xae13('0xa7')]({'model':db[_0xae13('0xc8')],'as':'Owner','attributes':['id',_0xae13('0x2d')]});return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x299bd4[_0xae13('0xab')]['id']},'include':_0x41aea2})[_0xae13('0x26')](handleEntityNotFound(_0x221b23,null))[_0xae13('0x26')](function(_0x563dd8){if(_0x563dd8){var _0x5620cd=_0x563dd8[_0xae13('0xd0')]({'plain':!![]});fs[_0xae13('0xd1')](_0x47674a);var _0x2a33e8={'format':'A4','border':_0xae13('0xd2'),'header':{'height':_0xae13('0xd3'),'contents':{'first':_0xae13('0xd4')}},'footer':{'height':_0xae13('0xd5'),'contents':{'default':util[_0xae13('0xb6')](_0xae13('0xd6'),util['format'](_0xae13('0xd7'),_0xae13('0xd8'),_0x5620cd['id']),moment()[_0xae13('0xb6')]('YYYY-MM-DD')[_0xae13('0x91')]())}}};var _0x55f6fa={'channel':_0xae13('0xd8'),'account':_0x5620cd['Account'][_0xae13('0x29')],'agent':_0x5620cd[_0xae13('0xd9')]?_0x5620cd[_0xae13('0xd9')][_0xae13('0x2d')]:_0xae13('0xda'),'createdAt':moment(_0x5620cd[_0xae13('0xcc')])['format'](_0xae13('0xdb'))['toString'](),'closedAt':_0x5620cd[_0xae13('0xdc')]?moment(_0x5620cd[_0xae13('0xdd')])[_0xae13('0xb6')](_0xae13('0xdb'))[_0xae13('0x91')]():'','disposition':_0x5620cd[_0xae13('0xde')],'messages':_(_0x5620cd[_0xae13('0xdf')])[_0xae13('0x7e')]({'secret':![]})[_0xae13('0x2c')](function(_0x5ded79){return{'date':moment(_0x5ded79['createdAt'])['format'](_0xae13('0xdb'))[_0xae13('0x91')](),'sender':_0x5ded79['direction']==='out'?_0x5ded79[_0xae13('0xc8')]?_0x5ded79[_0xae13('0xc8')][_0xae13('0x2d')]:'System':_0x5ded79['Contact']['firstName']+(_0x5ded79[_0xae13('0x62')][_0xae13('0xcb')]?'\x20'+_0x5ded79[_0xae13('0x62')]['lastName']:''),'body':_0x5ded79[_0xae13('0xae')],'direction':_0x5ded79[_0xae13('0xcd')]===_0xae13('0xe0')?'A':'C','secret':_0x5ded79['secret'],'read':_0x5ded79[_0xae13('0x7a')]};})[_0xae13('0x65')]()};return ejs[_0xae13('0xe1')](path[_0xae13('0xc2')](config['root'],'server',_0xae13('0xe2'),'downloadInteraction.html'),{'interaction':_0x55f6fa})[_0xae13('0x26')](function(_0x234810){return new BPromise(function(_0x5274c1,_0x46adf0){pdf[_0xae13('0xad')](_0x234810,_0x2a33e8)[_0xae13('0xe3')](path[_0xae13('0xc2')](_0x47674a,_0xae13('0xe4')+_0x5620cd['id']+'-'+_0x21b2d2+'.pdf'),function(_0xadfa9a,_0x39aa9c){if(_0xadfa9a)return _0x46adf0(_0xadfa9a);_0x5274c1(_0x39aa9c);});});})['then'](function(){return new BPromise(function(_0xd92578,_0x18f155){zipdir(_0x47674a,{'saveTo':_0x70899a},function(_0x415cfc,_0x166fc3){if(_0x415cfc)return _0x18f155(_0x415cfc);return _0xd92578(_0x166fc3);});})['then'](function(){return new BPromise(function(_0xaf3d6e,_0x233af8){rimraf(_0x47674a,function(_0x424a2c){if(_0x424a2c)_0x233af8(_0x424a2c);return _0xaf3d6e();});});})[_0xae13('0x26')](function(){return _0x221b23['download'](_0x70899a,_0x173a07,function(_0x4a1d38){if(_0x4a1d38){console[_0xae13('0xe5')](_0xae13('0xe6'),_0x4a1d38);}else{fs[_0xae13('0xe7')](_0x70899a);}});});});}else{return _0x221b23[_0xae13('0x1d')](0xc8);}})[_0xae13('0x32')](handleError(_0x221b23,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index b6597fc..58ef34f 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 _0x2494=['emit','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x2a62dd,_0x446e82){var _0x18ca30=function(_0x3e4968){while(--_0x3e4968){_0x2a62dd['push'](_0x2a62dd['shift']());}};_0x18ca30(++_0x446e82);}(_0x2494,0x82));var _0x4249=function(_0x157b9a,_0x5bca9b){_0x157b9a=_0x157b9a-0x0;var _0x3f9f7b=_0x2494[_0x157b9a];return _0x3f9f7b;};'use strict';var EventEmitter=require(_0x4249('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x4249('0x1')];var SmsMessage=require(_0x4249('0x2'))['db'][_0x4249('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4249('0x4')](0x0);var events={'afterCreate':_0x4249('0x5'),'afterUpdate':_0x4249('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4fdc12){return function(_0x3d42fb,_0x49ac67,_0x3c2d8d){_0x3d42fb[_0x4249('0x7')]({'attributes':['id'],'raw':!![]})[_0x4249('0x8')](function(_0x5b1b17){_0x3d42fb[_0x4249('0x9')](_0x4249('0xa'),_0x5b1b17[_0x4249('0xb')](function(_0x58529b){return{'id':_0x58529b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3d42fb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4249('0x8')](function(_0x44ca3d){_0x3d42fb[_0x4249('0x9')](_0x4249('0xc'),_0x44ca3d[_0x4249('0xd')]);SmsInteractionEvents[_0x4249('0xe')](_0x4fdc12+':'+_0x3d42fb['id'],_0x3d42fb);SmsInteractionEvents[_0x4249('0xe')](_0x4fdc12,_0x3d42fb);_0x3c2d8d(null);})['catch'](_0x3c2d8d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4249('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x6aa7=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6aa7,0x178));var _0x76aa=function(_0xb7402e,_0x44e6ee){_0xb7402e=_0xb7402e-0x0;var _0x5f0201=_0x6aa7[_0xb7402e];return _0x5f0201;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x76aa('0x1')];var SmsMessage=require(_0x76aa('0x2'))['db'][_0x76aa('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x76aa('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76aa('0x5'),'afterDestroy':_0x76aa('0x6')};function emitEvent(_0x1d6e04){return function(_0x511588,_0x588e62,_0x1aceaa){_0x511588['getUsers']({'attributes':['id'],'raw':!![]})[_0x76aa('0x7')](function(_0x36d12b){_0x511588[_0x76aa('0x8')]('Users',_0x36d12b[_0x76aa('0x9')](function(_0x266bd5){return{'id':_0x266bd5['id']};}));return SmsMessage[_0x76aa('0xa')]({'where':{'SmsInteractionId':_0x511588['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcd99aa){_0x511588[_0x76aa('0x8')](_0x76aa('0xb'),_0xcd99aa[_0x76aa('0xc')]);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04+':'+_0x511588['id'],_0x511588);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04,_0x511588);_0x1aceaa(null);})[_0x76aa('0xe')](_0x1aceaa(null));};}for(var e in events){if(events[_0x76aa('0xf')](e)){var event=events[e];SmsInteraction[_0x76aa('0x10')](e,emitEvent(event));}}module[_0x76aa('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c5282f3..48d9bec 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 _0xa5a2=['../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x23f267,_0x5c3be3){var _0x432ba0=function(_0x243dfd){while(--_0x243dfd){_0x23f267['push'](_0x23f267['shift']());}};_0x432ba0(++_0x5c3be3);}(_0xa5a2,0xab));var _0x2a5a=function(_0x40dc76,_0x3bbf1a){_0x40dc76=_0x40dc76-0x0;var _0x3c3b84=_0xa5a2[_0x40dc76];return _0x3c3b84;};'use strict';var _=require(_0x2a5a('0x0'));var util=require(_0x2a5a('0x1'));var logger=require(_0x2a5a('0x2'))(_0x2a5a('0x3'));var moment=require(_0x2a5a('0x4'));var BPromise=require(_0x2a5a('0x5'));var rp=require(_0x2a5a('0x6'));var fs=require('fs');var path=require(_0x2a5a('0x7'));var rimraf=require(_0x2a5a('0x8'));var config=require(_0x2a5a('0x9'));var attributes=require(_0x2a5a('0xa'));module['exports']=function(_0x573ea7,_0x2f5b8c){return _0x573ea7[_0x2a5a('0xb')](_0x2a5a('0xc'),attributes,{'tableName':_0x2a5a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x229614,_0x5a6a16,_0x5c8e4f){if(_0x229614['changed'](_0x2a5a('0xe'))){_0x229614[_0x2a5a('0xf')]=moment()[_0x2a5a('0x10')](_0x2a5a('0x11'));}_0x5c8e4f(null,_0x229614);}}});}; \ No newline at end of file +var _0x5d66=['define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xaf1ca3,_0x2ff5dc){var _0x2d40f0=function(_0x21974){while(--_0x21974){_0xaf1ca3['push'](_0xaf1ca3['shift']());}};_0x2d40f0(++_0x2ff5dc);}(_0x5d66,0x13a));var _0x65d6=function(_0x2b0c79,_0x19e339){_0x2b0c79=_0x2b0c79-0x0;var _0x357174=_0x5d66[_0x2b0c79];return _0x357174;};'use strict';var _=require(_0x65d6('0x0'));var util=require(_0x65d6('0x1'));var logger=require('../../config/logger')(_0x65d6('0x2'));var moment=require(_0x65d6('0x3'));var BPromise=require(_0x65d6('0x4'));var rp=require(_0x65d6('0x5'));var fs=require('fs');var path=require(_0x65d6('0x6'));var rimraf=require(_0x65d6('0x7'));var config=require(_0x65d6('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x65d6('0x9')]=function(_0x280ab4,_0x2ddb4e){return _0x280ab4[_0x65d6('0xa')](_0x65d6('0xb'),attributes,{'tableName':_0x65d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x551f79,_0x3eff12,_0x5bcd56){if(_0x551f79[_0x65d6('0xd')](_0x65d6('0xe'))){_0x551f79[_0x65d6('0xf')]=moment()[_0x65d6('0x10')](_0x65d6('0x11'));}_0x5bcd56(null,_0x551f79);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c9e0195..0113833 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 _0xe73d=['redis','socket.io-emitter','register','request','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','find','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x170287,_0x299328){var _0x318dea=function(_0x19b851){while(--_0x19b851){_0x170287['push'](_0x170287['shift']());}};_0x318dea(++_0x299328);}(_0xe73d,0xc1));var _0xde73=function(_0x5b926b,_0x5ee054){_0x5b926b=_0x5b926b-0x0;var _0x2e1c6f=_0xe73d[_0x5b926b];return _0x2e1c6f;};'use strict';var _=require(_0xde73('0x0'));var util=require('util');var moment=require(_0xde73('0x1'));var BPromise=require(_0xde73('0x2'));var rs=require(_0xde73('0x3'));var fs=require('fs');var Redis=require(_0xde73('0x4'));var db=require(_0xde73('0x5'))['db'];var utils=require(_0xde73('0x6'));var logger=require(_0xde73('0x7'))(_0xde73('0x8'));var config=require(_0xde73('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde73('0xa')][_0xde73('0xb')]({'port':0x232a});config[_0xde73('0xc')]=_['defaults'](config[_0xde73('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xde73('0xd'))(new Redis(config[_0xde73('0xc')]));require('./smsInteraction.socket')[_0xde73('0xe')](socket);function respondWithRpcPromise(_0x24e79b,_0x3dc085,_0x39c84c){return new BPromise(function(_0x687474,_0x580c26){return client[_0xde73('0xf')](_0x24e79b,_0x39c84c)[_0xde73('0x10')](function(_0x2ae7b1){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3dc085,'request\x20sent');logger[_0xde73('0x11')](_0xde73('0x12'),_0x3dc085,'request\x20sent',JSON[_0xde73('0x13')](_0x2ae7b1));if(_0x2ae7b1[_0xde73('0x14')]){if(_0x2ae7b1[_0xde73('0x14')][_0xde73('0x15')]===0x1f4){logger[_0xde73('0x14')](_0xde73('0x16'),_0x3dc085,_0x2ae7b1[_0xde73('0x14')]['message']);return _0x580c26(_0x2ae7b1[_0xde73('0x14')][_0xde73('0x17')]);}logger[_0xde73('0x14')](_0xde73('0x16'),_0x3dc085,_0x2ae7b1[_0xde73('0x14')][_0xde73('0x17')]);return _0x687474(_0x2ae7b1['error'][_0xde73('0x17')]);}else{logger[_0xde73('0x18')](_0xde73('0x16'),_0x3dc085,_0xde73('0x19'));_0x687474(_0x2ae7b1[_0xde73('0x1a')][_0xde73('0x17')]);}})['catch'](function(_0x3b781e){logger[_0xde73('0x14')](_0xde73('0x16'),_0x3dc085,_0x3b781e);_0x580c26(_0x3b781e);});});}exports[_0xde73('0x1b')]=function(_0x58de28){var _0x5abb61=this;return new Promise(function(_0x24355b,_0xc2dcd){return db[_0xde73('0x1c')][_0xde73('0x1d')](_0x58de28[_0xde73('0x1e')],{'raw':_0x58de28[_0xde73('0x1f')]?_0x58de28[_0xde73('0x1f')][_0xde73('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58de28[_0xde73('0x1f')]?_0x58de28['options'][_0xde73('0x21')]||null:null,'attributes':_0x58de28['options']?_0x58de28[_0xde73('0x1f')][_0xde73('0x22')]||null:null,'limit':_0x58de28['options']?_0x58de28['options'][_0xde73('0x23')]||null:null})['then'](function(_0x1657d7){logger['info'](_0xde73('0x1b'),_0x58de28);logger[_0xde73('0x11')]('UpdateSmsInteraction',_0x58de28,JSON[_0xde73('0x13')](_0x1657d7));_0x24355b(_0x1657d7);})[_0xde73('0x24')](function(_0x35b777){logger['error'](_0xde73('0x1b'),_0x35b777[_0xde73('0x17')],_0x58de28);_0xc2dcd(_0x5abb61['error'](0x1f4,_0x35b777[_0xde73('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x465a12){return new Promise(function(_0x4f5541,_0x41df63){return db[_0xde73('0x1c')][_0xde73('0x25')]({'where':_0x465a12['options']?_0x465a12[_0xde73('0x1f')][_0xde73('0x21')]||null:null})[_0xde73('0x10')](function(_0x2809fb){if(_0x2809fb){return _0x2809fb['addTags'](_0x465a12['body'][_0xde73('0x26')],_[_0xde73('0x27')](_0x465a12[_0xde73('0x1e')],[_0xde73('0x26'),'id'])||{});}})['spread'](function(_0x346af6){logger[_0xde73('0x18')](_0xde73('0x28'),_0x465a12);logger[_0xde73('0x11')](_0xde73('0x28'),_0x465a12,JSON[_0xde73('0x13')](_0x346af6));_0x4f5541(_0x346af6);})[_0xde73('0x24')](function(_0x1539f8){logger[_0xde73('0x14')]('AddTags',_0x1539f8[_0xde73('0x17')],_0x465a12);_0x41df63(_this[_0xde73('0x14')](0x1f4,_0x1539f8[_0xde73('0x17')]));});});}; \ No newline at end of file +var _0xe5d8=['error','code','message','info','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb18948,_0x44499c){var _0x3eb80e=function(_0x1c09bb){while(--_0x1c09bb){_0xb18948['push'](_0xb18948['shift']());}};_0x3eb80e(++_0x44499c);}(_0xe5d8,0x125));var _0x8e5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe5d8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8e5d('0x0'));var util=require('util');var moment=require(_0x8e5d('0x1'));var BPromise=require(_0x8e5d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e5d('0x3'));var db=require(_0x8e5d('0x4'))['db'];var utils=require(_0x8e5d('0x5'));var logger=require('../../config/logger')(_0x8e5d('0x6'));var config=require(_0x8e5d('0x7'));var jayson=require(_0x8e5d('0x8'));var client=jayson[_0x8e5d('0x9')]['http']({'port':0x232a});config[_0x8e5d('0xa')]=_[_0x8e5d('0xb')](config[_0x8e5d('0xa')],{'host':_0x8e5d('0xc'),'port':0x18eb});var socket=require(_0x8e5d('0xd'))(new Redis(config[_0x8e5d('0xa')]));require(_0x8e5d('0xe'))[_0x8e5d('0xf')](socket);function respondWithRpcPromise(_0x4ff1b9,_0x3aa5f8,_0x33a787){return new BPromise(function(_0x20d07e,_0x2a5676){return client[_0x8e5d('0x10')](_0x4ff1b9,_0x33a787)[_0x8e5d('0x11')](function(_0x22ea86){logger['info'](_0x8e5d('0x12'),_0x3aa5f8,'request\x20sent');logger[_0x8e5d('0x13')](_0x8e5d('0x14'),_0x3aa5f8,'request\x20sent',JSON[_0x8e5d('0x15')](_0x22ea86));if(_0x22ea86['error']){if(_0x22ea86[_0x8e5d('0x16')][_0x8e5d('0x17')]===0x1f4){logger[_0x8e5d('0x16')](_0x8e5d('0x12'),_0x3aa5f8,_0x22ea86[_0x8e5d('0x16')][_0x8e5d('0x18')]);return _0x2a5676(_0x22ea86[_0x8e5d('0x16')][_0x8e5d('0x18')]);}logger[_0x8e5d('0x16')](_0x8e5d('0x12'),_0x3aa5f8,_0x22ea86[_0x8e5d('0x16')][_0x8e5d('0x18')]);return _0x20d07e(_0x22ea86['error'][_0x8e5d('0x18')]);}else{logger[_0x8e5d('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x3aa5f8,_0x8e5d('0x1a'));_0x20d07e(_0x22ea86[_0x8e5d('0x1b')][_0x8e5d('0x18')]);}})['catch'](function(_0x48f3be){logger[_0x8e5d('0x16')](_0x8e5d('0x12'),_0x3aa5f8,_0x48f3be);_0x2a5676(_0x48f3be);});});}exports[_0x8e5d('0x1c')]=function(_0x829136){var _0xec135e=this;return new Promise(function(_0x59059d,_0x133538){return db[_0x8e5d('0x1d')][_0x8e5d('0x1e')](_0x829136[_0x8e5d('0x1f')],{'raw':_0x829136['options']?_0x829136[_0x8e5d('0x20')][_0x8e5d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x829136['options']?_0x829136[_0x8e5d('0x20')]['where']||null:null,'attributes':_0x829136[_0x8e5d('0x20')]?_0x829136['options'][_0x8e5d('0x22')]||null:null,'limit':_0x829136['options']?_0x829136['options'][_0x8e5d('0x23')]||null:null})[_0x8e5d('0x11')](function(_0x36e24c){logger[_0x8e5d('0x19')]('UpdateSmsInteraction',_0x829136);logger[_0x8e5d('0x13')]('UpdateSmsInteraction',_0x829136,JSON['stringify'](_0x36e24c));_0x59059d(_0x36e24c);})[_0x8e5d('0x24')](function(_0x2fbef8){logger[_0x8e5d('0x16')]('UpdateSmsInteraction',_0x2fbef8[_0x8e5d('0x18')],_0x829136);_0x133538(_0xec135e[_0x8e5d('0x16')](0x1f4,_0x2fbef8[_0x8e5d('0x18')]));});});};exports[_0x8e5d('0x25')]=function(_0x304ebb){return new Promise(function(_0x1b23f2,_0x40bde0){return db[_0x8e5d('0x1d')][_0x8e5d('0x26')]({'where':_0x304ebb[_0x8e5d('0x20')]?_0x304ebb['options'][_0x8e5d('0x27')]||null:null})[_0x8e5d('0x11')](function(_0x113117){if(_0x113117){return _0x113117[_0x8e5d('0x28')](_0x304ebb[_0x8e5d('0x1f')]['ids'],_[_0x8e5d('0x29')](_0x304ebb[_0x8e5d('0x1f')],[_0x8e5d('0x2a'),'id'])||{});}})[_0x8e5d('0x2b')](function(_0x1f2307){logger[_0x8e5d('0x19')](_0x8e5d('0x2c'),_0x304ebb);logger['debug']('AddTags',_0x304ebb,JSON[_0x8e5d('0x15')](_0x1f2307));_0x1b23f2(_0x1f2307);})[_0x8e5d('0x24')](function(_0x495f0c){logger[_0x8e5d('0x16')](_0x8e5d('0x2c'),_0x495f0c[_0x8e5d('0x18')],_0x304ebb);_0x40bde0(_this[_0x8e5d('0x16')](0x1f4,_0x495f0c[_0x8e5d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d22d69e..e9803ff 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 _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x2d7068,_0x571e58){var _0x2ca7be=function(_0x3237c7){while(--_0x3237c7){_0x2d7068['push'](_0x2d7068['shift']());}};_0x2ca7be(++_0x571e58);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x30813d,_0x49bdcd){var _0x14c420=function(_0x5cc7a1){while(--_0x5cc7a1){_0x30813d['push'](_0x30813d['shift']());}};_0x14c420(++_0x49bdcd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 611f1ce..2fdf59e 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 _0xfd9e=['/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','sms','smsmessage:create'];(function(_0x2728b1,_0x3912e4){var _0x42ac37=function(_0x242e5a){while(--_0x242e5a){_0x2728b1['push'](_0x2728b1['shift']());}};_0x42ac37(++_0x3912e4);}(_0xfd9e,0x166));var _0xefd9=function(_0x2f222c,_0xf19b83){_0x2f222c=_0x2f222c-0x0;var _0x39cee1=_0xfd9e[_0x2f222c];return _0x39cee1;};'use strict';var multer=require(_0xefd9('0x0'));var util=require(_0xefd9('0x1'));var path=require('path');var timeout=require(_0xefd9('0x2'));var express=require('express');var router=express[_0xefd9('0x3')]();var auth=require(_0xefd9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xefd9('0x5'));var controller=require(_0xefd9('0x6'));router['get']('/',auth[_0xefd9('0x7')](),controller[_0xefd9('0x8')]);router[_0xefd9('0x9')](_0xefd9('0xa'),auth[_0xefd9('0x7')](),controller[_0xefd9('0xb')]);router[_0xefd9('0x9')](_0xefd9('0xc'),auth[_0xefd9('0x7')](),controller[_0xefd9('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xefd9('0xe')](_0xefd9('0xf'),_0xefd9('0x10')),controller['create']);router['post'](_0xefd9('0x11'),controller['status']);router[_0xefd9('0x12')](_0xefd9('0xc'),auth[_0xefd9('0x7')](),controller[_0xefd9('0x13')]);router['put'](_0xefd9('0x14'),auth[_0xefd9('0x7')](),controller['accept']);router['put'](_0xefd9('0x15'),auth[_0xefd9('0x7')](),controller[_0xefd9('0x16')]);router[_0xefd9('0x17')](_0xefd9('0xc'),auth[_0xefd9('0x7')](),controller[_0xefd9('0x18')]);module['exports']=router; \ No newline at end of file +var _0x88d6=['get','index','/describe','isAuthenticated','/:id','show','post','sms','create','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x88d6,0x189));var _0x688d=function(_0xb94d3f,_0x1bd653){_0xb94d3f=_0xb94d3f-0x0;var _0x43c075=_0x88d6[_0xb94d3f];return _0x43c075;};'use strict';var multer=require('multer');var util=require(_0x688d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x688d('0x1'));var router=express[_0x688d('0x2')]();var auth=require(_0x688d('0x3'));var interaction=require(_0x688d('0x4'));var config=require(_0x688d('0x5'));var controller=require(_0x688d('0x6'));router[_0x688d('0x7')]('/',auth['isAuthenticated'](),controller[_0x688d('0x8')]);router[_0x688d('0x7')](_0x688d('0x9'),auth[_0x688d('0xa')](),controller['describe']);router[_0x688d('0x7')](_0x688d('0xb'),auth[_0x688d('0xa')](),controller[_0x688d('0xc')]);router[_0x688d('0xd')]('/',auth[_0x688d('0xa')](),interaction['tracked'](_0x688d('0xe'),'smsmessage:create'),controller[_0x688d('0xf')]);router[_0x688d('0xd')]('/:id/status',controller[_0x688d('0x10')]);router['put'](_0x688d('0xb'),auth[_0x688d('0xa')](),controller[_0x688d('0x11')]);router['put'](_0x688d('0x12'),auth['isAuthenticated'](),controller[_0x688d('0x13')]);router[_0x688d('0x14')](_0x688d('0x15'),auth[_0x688d('0xa')](),controller[_0x688d('0x16')]);router[_0x688d('0x17')]('/:id',auth[_0x688d('0xa')](),controller[_0x688d('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 590aaab..fed98a4 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 _0xb0bb=['sequelize','exports','TEXT','medium','out','STRING','BOOLEAN'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xb0bb,0xaf));var _0xbb0b=function(_0x12925e,_0x301d77){_0x12925e=_0x12925e-0x0;var _0x4f8297=_0xb0bb[_0x12925e];return _0x4f8297;};'use strict';var Sequelize=require(_0xbb0b('0x0'));module[_0xbb0b('0x1')]={'body':{'type':Sequelize[_0xbb0b('0x2')](_0xbb0b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbb0b('0x4')),'defaultValue':_0xbb0b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbb0b('0x5')](0xbe)},'phone':{'type':Sequelize[_0xbb0b('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbb0b('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x58b7=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x5bd2ce,_0x7c21f1){var _0x4722c2=function(_0x4a8c6c){while(--_0x4a8c6c){_0x5bd2ce['push'](_0x5bd2ce['shift']());}};_0x4722c2(++_0x7c21f1);}(_0x58b7,0x16e));var _0x758b=function(_0x2f4c73,_0x4a9590){_0x2f4c73=_0x2f4c73-0x0;var _0xcadb69=_0x58b7[_0x2f4c73];return _0xcadb69;};'use strict';var Sequelize=require(_0x758b('0x0'));module[_0x758b('0x1')]={'body':{'type':Sequelize[_0x758b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x758b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x758b('0x4')]('in',_0x758b('0x5')),'defaultValue':_0x758b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x758b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x758b('0x6')]},'readAt':{'type':Sequelize[_0x758b('0x7')]},'secret':{'type':Sequelize[_0x758b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6c3021c..8988d23 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 _0xc17f=['find','body','destroy','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','SmsInteraction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','SmsInteractionId','role','rejectMessage','interface','rejectmessage','SmsAccountId','inspect','twilio','messageId','plivo','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','groupName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','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','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','name','send','index','map','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','SmsMessage','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','update'];(function(_0x339963,_0x4d8f8c){var _0x3b01a6=function(_0x4cef7b){while(--_0x4cef7b){_0x339963['push'](_0x339963['shift']());}};_0x3b01a6(++_0x4d8f8c);}(_0xc17f,0xb8));var _0xfc17=function(_0x1538db,_0x380120){_0x1538db=_0x1538db-0x0;var _0x46da9c=_0xc17f[_0x1538db];return _0x46da9c;};'use strict';var pdf=require(_0xfc17('0x0'));var emlformat=require(_0xfc17('0x1'));var rimraf=require(_0xfc17('0x2'));var zipdir=require(_0xfc17('0x3'));var jsonpatch=require(_0xfc17('0x4'));var rp=require(_0xfc17('0x5'));var moment=require('moment');var BPromise=require(_0xfc17('0x6'));var Mustache=require(_0xfc17('0x7'));var util=require(_0xfc17('0x8'));var path=require(_0xfc17('0x9'));var sox=require('sox');var csv=require(_0xfc17('0xa'));var ejs=require(_0xfc17('0xb'));var fs=require('fs');var _=require(_0xfc17('0xc'));var squel=require(_0xfc17('0xd'));var crypto=require(_0xfc17('0xe'));var jsforce=require(_0xfc17('0xf'));var deskjs=require(_0xfc17('0x10'));var toCsv=require(_0xfc17('0xa'));var querystring=require('querystring');var Papa=require(_0xfc17('0x11'));var Redis=require(_0xfc17('0x12'));var authService=require(_0xfc17('0x13'));var qs=require(_0xfc17('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc17('0x15'))(_0xfc17('0x16'));var utils=require(_0xfc17('0x17'));var config=require(_0xfc17('0x18'));var db=require(_0xfc17('0x19'))['db'];config[_0xfc17('0x1a')]=_[_0xfc17('0x1b')](config[_0xfc17('0x1a')],{'host':_0xfc17('0x1c'),'port':0x18eb});var socket=require(_0xfc17('0x1d'))(new Redis(config['redis']));require(_0xfc17('0x1e'))[_0xfc17('0x1f')](socket);var jayson=require(_0xfc17('0x20'));var client=jayson['client'][_0xfc17('0x21')]({'port':0x232c});var client9002=jayson[_0xfc17('0x22')][_0xfc17('0x21')]({'port':0x232a});function checkPasswordPattern(_0x25d5fe,_0x313d98,_0x11c259){if(_0x11c259){var _0x773e25=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x773e25[_0xfc17('0x23')](_0x313d98)){return _0x25d5fe;}else{throw new db[(_0xfc17('0x24'))][(_0xfc17('0x25'))](_0xfc17('0x26'));}}else{return _0x25d5fe;}}function respondWithRpcPromise(_0x4168ab,_0x2bbb0e,_0x5b2c7c,_0x544740){return new BPromise(function(_0x2aa3a2,_0x57034){var _0x33bc2e=_0x544740||client;return _0x33bc2e[_0xfc17('0x27')](_0x4168ab,_0x5b2c7c)[_0xfc17('0x28')](function(_0x12ec9b){logger[_0xfc17('0x29')](_0xfc17('0x2a'),_0x2bbb0e,'request\x20sent');logger[_0xfc17('0x2b')](_0xfc17('0x2c'),_0x2bbb0e,_0xfc17('0x2d'),JSON[_0xfc17('0x2e')](_0x12ec9b));if(_0x12ec9b[_0xfc17('0x2f')]){if(_0x12ec9b[_0xfc17('0x2f')][_0xfc17('0x30')]===0x1f4){logger[_0xfc17('0x2f')](_0xfc17('0x2a'),_0x2bbb0e,_0x12ec9b[_0xfc17('0x2f')]['message']);return _0x57034(_0x12ec9b[_0xfc17('0x2f')][_0xfc17('0x31')]);}logger[_0xfc17('0x2f')](_0xfc17('0x2a'),_0x2bbb0e,_0x12ec9b[_0xfc17('0x2f')][_0xfc17('0x31')]);return _0x2aa3a2(_0x12ec9b['error'][_0xfc17('0x31')]);}else{logger[_0xfc17('0x29')]('SmsMessage,\x20%s,\x20%s',_0x2bbb0e,_0xfc17('0x2d'));_0x2aa3a2(_0x12ec9b[_0xfc17('0x32')]['message']);}})['catch'](function(_0xd0144c){logger[_0xfc17('0x2f')]('SmsMessage,\x20%s,\x20%s',_0x2bbb0e,_0xd0144c);_0x57034(_0xd0144c);});});}function respondWithStatusCode(_0x4301c3,_0x194d33){_0x194d33=_0x194d33||0xcc;return function(_0x538a5c){if(_0x538a5c){return _0x4301c3[_0xfc17('0x33')](_0x194d33);}return _0x4301c3[_0xfc17('0x34')](_0x194d33)['end']();};}function respondWithResult(_0x28f08a,_0xfbd493){_0xfbd493=_0xfbd493||0xc8;return function(_0x534c6c){if(_0x534c6c){return _0x28f08a['status'](_0xfbd493)[_0xfc17('0x35')](_0x534c6c);}};}function respondWithFilteredResult(_0x39dbf9,_0x2bd0f6){return function(_0x23dd28){if(_0x23dd28){var _0x3e5da3=_0x23dd28[_0xfc17('0x36')],_0x149930=_0x2bd0f6['offset'],_0x3637e8=_0x2bd0f6[_0xfc17('0x37')]+_0x2bd0f6[_0xfc17('0x38')],_0x3085f9;if(_0x3637e8>=_0x3e5da3){_0x3637e8=_0x3e5da3;_0x3085f9=0xc8;}else{_0x3085f9=0xce;}_0x39dbf9[_0xfc17('0x34')](_0x3085f9);return _0x39dbf9['set'](_0xfc17('0x39'),_0x149930+'-'+_0x3637e8+'/'+_0x3e5da3)['json'](_0x23dd28);}return null;};}function patchUpdates(_0x431938){return function(_0x24538a){try{jsonpatch[_0xfc17('0x3a')](_0x24538a,_0x431938,!![]);}catch(_0xe04c84){return BPromise['reject'](_0xe04c84);}return _0x24538a[_0xfc17('0x3b')]();};}function saveUpdates(_0x3a8cdd,_0x4fa8aa){return function(_0x52d411){if(_0x52d411){return _0x52d411['update'](_0x3a8cdd)[_0xfc17('0x28')](function(_0x461be2){return _0x461be2;});}return null;};}function removeEntity(_0x3bec23,_0x8fb143){return function(_0x1f0fa7){if(_0x1f0fa7){return _0x1f0fa7['destroy']()[_0xfc17('0x28')](function(){_0x3bec23[_0xfc17('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e7ca,_0x30207b){return function(_0x5d08c9){if(!_0x5d08c9){_0x35e7ca['sendStatus'](0x194);}return _0x5d08c9;};}function handleError(_0x49d8e4,_0x578ed2){_0x578ed2=_0x578ed2||0x1f4;return function(_0x41a960){logger['error'](_0x41a960['stack']);if(_0x41a960[_0xfc17('0x3c')]){delete _0x41a960[_0xfc17('0x3c')];}_0x49d8e4[_0xfc17('0x34')](_0x578ed2)[_0xfc17('0x3d')](_0x41a960);};}exports[_0xfc17('0x3e')]=function(_0x300e52,_0x10c46f){var _0x5f571a={},_0x37be2c={},_0x1dbe51={'count':0x0,'rows':[]};var _0x58deb7=_[_0xfc17('0x3f')](db['SmsMessage']['rawAttributes'],function(_0x390916){return{'name':_0x390916[_0xfc17('0x40')],'type':_0x390916[_0xfc17('0x41')][_0xfc17('0x42')]};});_0x37be2c[_0xfc17('0x43')]=_['map'](_0x58deb7,_0xfc17('0x3c'));_0x37be2c['query']=_[_0xfc17('0x44')](_0x300e52['query']);_0x37be2c[_0xfc17('0x45')]=_['intersection'](_0x37be2c[_0xfc17('0x43')],_0x37be2c[_0xfc17('0x46')]);_0x5f571a[_0xfc17('0x47')]=_[_0xfc17('0x48')](_0x37be2c[_0xfc17('0x43')],qs[_0xfc17('0x49')](_0x300e52['query'][_0xfc17('0x49')]));_0x5f571a[_0xfc17('0x47')]=_0x5f571a[_0xfc17('0x47')][_0xfc17('0x4a')]?_0x5f571a['attributes']:_0x37be2c[_0xfc17('0x43')];if(!_0x300e52['query'][_0xfc17('0x4b')]('nolimit')){_0x5f571a[_0xfc17('0x38')]=qs[_0xfc17('0x38')](_0x300e52['query'][_0xfc17('0x38')]);_0x5f571a[_0xfc17('0x37')]=qs[_0xfc17('0x37')](_0x300e52['query'][_0xfc17('0x37')]);}_0x5f571a['order']=qs[_0xfc17('0x4c')](_0x300e52[_0xfc17('0x46')][_0xfc17('0x4c')]);_0x5f571a[_0xfc17('0x4d')]=qs['filters'](_[_0xfc17('0x4e')](_0x300e52[_0xfc17('0x46')],_0x37be2c['filters']),_0x58deb7);if(_0x300e52[_0xfc17('0x46')]['filter']){_0x5f571a[_0xfc17('0x4d')]=_[_0xfc17('0x4f')](_0x5f571a['where'],{'$or':_[_0xfc17('0x3f')](_0x58deb7,function(_0x540a31){if(_0x540a31[_0xfc17('0x41')]!==_0xfc17('0x50')){var _0x7cffb5={};_0x7cffb5[_0x540a31[_0xfc17('0x3c')]]={'$like':'%'+_0x300e52[_0xfc17('0x46')][_0xfc17('0x51')]+'%'};return _0x7cffb5;}})});}_0x5f571a=_['merge']({},_0x5f571a,_0x300e52[_0xfc17('0x52')]);var _0x4ee621={'where':_0x5f571a[_0xfc17('0x4d')]};return db[_0xfc17('0x53')][_0xfc17('0x36')](_0x4ee621)[_0xfc17('0x28')](function(_0xba87b6){_0x1dbe51[_0xfc17('0x36')]=_0xba87b6;if(_0x300e52[_0xfc17('0x46')][_0xfc17('0x54')]){_0x5f571a[_0xfc17('0x55')]=[{'all':!![]}];}return db['SmsMessage'][_0xfc17('0x56')](_0x5f571a);})['then'](function(_0x53011f){_0x1dbe51[_0xfc17('0x57')]=_0x53011f;return _0x1dbe51;})[_0xfc17('0x28')](respondWithFilteredResult(_0x10c46f,_0x5f571a))[_0xfc17('0x58')](handleError(_0x10c46f,null));};exports[_0xfc17('0x59')]=function(_0x505ecb,_0x52d9d5){var _0x51cee7={'raw':!![],'where':{'id':_0x505ecb[_0xfc17('0x5a')]['id']}},_0x5ef80f={};_0x5ef80f[_0xfc17('0x43')]=_[_0xfc17('0x44')](db['SmsMessage'][_0xfc17('0x5b')]);_0x5ef80f[_0xfc17('0x46')]=_[_0xfc17('0x44')](_0x505ecb[_0xfc17('0x46')]);_0x5ef80f[_0xfc17('0x45')]=_['intersection'](_0x5ef80f['model'],_0x5ef80f['query']);_0x51cee7[_0xfc17('0x47')]=_['intersection'](_0x5ef80f[_0xfc17('0x43')],qs[_0xfc17('0x49')](_0x505ecb['query'][_0xfc17('0x49')]));_0x51cee7['attributes']=_0x51cee7['attributes'][_0xfc17('0x4a')]?_0x51cee7[_0xfc17('0x47')]:_0x5ef80f[_0xfc17('0x43')];if(_0x505ecb[_0xfc17('0x46')]['includeAll']){_0x51cee7[_0xfc17('0x55')]=[{'all':!![]}];}_0x51cee7=_['merge']({},_0x51cee7,_0x505ecb['options']);return db['SmsMessage']['find'](_0x51cee7)[_0xfc17('0x28')](handleEntityNotFound(_0x52d9d5,null))['then'](respondWithResult(_0x52d9d5,null))['catch'](handleError(_0x52d9d5,null));};exports[_0xfc17('0x5c')]=function(_0x29edf1,_0x3fe697){return db[_0xfc17('0x53')][_0xfc17('0x5c')](_0x29edf1['body'],{})[_0xfc17('0x28')](respondWithResult(_0x3fe697,0xc9))[_0xfc17('0x58')](handleError(_0x3fe697,null));};exports[_0xfc17('0x5d')]=function(_0x3cb9cf,_0x480134){if(_0x3cb9cf['body']['id']){delete _0x3cb9cf['body']['id'];}return db[_0xfc17('0x53')][_0xfc17('0x5e')]({'where':{'id':_0x3cb9cf[_0xfc17('0x5a')]['id']}})[_0xfc17('0x28')](handleEntityNotFound(_0x480134,null))[_0xfc17('0x28')](saveUpdates(_0x3cb9cf[_0xfc17('0x5f')],null))[_0xfc17('0x28')](respondWithResult(_0x480134,null))['catch'](handleError(_0x480134,null));};exports[_0xfc17('0x60')]=function(_0xb975a1,_0x505cb5){return db[_0xfc17('0x53')][_0xfc17('0x5e')]({'where':{'id':_0xb975a1[_0xfc17('0x5a')]['id']}})[_0xfc17('0x28')](handleEntityNotFound(_0x505cb5,null))[_0xfc17('0x28')](removeEntity(_0x505cb5,null))['catch'](handleError(_0x505cb5,null));};exports[_0xfc17('0x61')]=function(_0x2b3959,_0x116ed8){return db[_0xfc17('0x53')]['describe']()[_0xfc17('0x28')](respondWithResult(_0x116ed8,null))[_0xfc17('0x58')](handleError(_0x116ed8,null));};var interaction_log=require(_0xfc17('0x15'))(_0xfc17('0x62'));exports[_0xfc17('0x63')]=function(_0x12cda5,_0x189157,_0x2900a4){var _0x31c69a={'channel':_0xfc17('0x64')};if(_0x12cda5[_0xfc17('0x5f')]['id']){delete _0x12cda5['body']['id'];}_0x12cda5[_0xfc17('0x5f')][_0xfc17('0x65')]=!![];_0x12cda5[_0xfc17('0x5f')][_0xfc17('0x66')]=moment()[_0xfc17('0x67')](_0xfc17('0x68'));_0x12cda5[_0xfc17('0x5f')]['UserId']=_0x12cda5['body'][_0xfc17('0x69')]||_0x12cda5[_0xfc17('0x6a')]['id'];return db['SmsMessage'][_0xfc17('0x5e')]({'where':{'id':_0x12cda5[_0xfc17('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xfc17('0x6b')],'as':'Contact'}]})[_0xfc17('0x28')](handleEntityNotFound(_0x189157,null))[_0xfc17('0x28')](saveUpdates(_0x12cda5[_0xfc17('0x5f')],null))[_0xfc17('0x28')](function(_0x539306){if(_0x539306){_0x31c69a[_0xfc17('0x31')]=_0x539306[_0xfc17('0x6c')]({'plain':!![]});return db[_0xfc17('0x6d')][_0xfc17('0x5e')]({'where':{'id':_0x539306['SmsInteractionId']}});}return null;})[_0xfc17('0x28')](handleEntityNotFound(_0x189157,null))[_0xfc17('0x28')](function(_0x1b21ad){if(_0x1b21ad){return _0x1b21ad[_0xfc17('0x5d')]({'UserId':_0x12cda5[_0xfc17('0x5f')][_0xfc17('0x69')],'read1stAt':_['isNil'](_0x1b21ad['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfc17('0x28')](function(_0x86bb1){if(_0x86bb1){_0x31c69a['interaction']=_0x86bb1[_0xfc17('0x6c')]({'plain':!![]});interaction_log['info'](_0xfc17('0x6e'),_0x12cda5['user']['id'],_0x12cda5[_0xfc17('0x6a')][_0xfc17('0x3c')],_0x12cda5[_0xfc17('0x6a')]['role'],_0x31c69a[_0xfc17('0x6f')]['id'],_0x12cda5[_0xfc17('0x5f')]?JSON[_0xfc17('0x2e')](_0x12cda5[_0xfc17('0x5f')]):_0xfc17('0x70'));return respondWithRpcPromise('AcceptMessage',_0xfc17('0x71'),_0x31c69a);}return null;})[_0xfc17('0x28')](function(_0x4bfe7f){if(_0x4bfe7f){if(_0x12cda5['body'][_0xfc17('0x72')]){_0x31c69a[_0xfc17('0x31')]['interface']=util[_0xfc17('0x67')](_0xfc17('0x73'),_0x12cda5[_0xfc17('0x6a')][_0xfc17('0x3c')]);_0x31c69a['message'][_0xfc17('0x74')]=_0x31c69a[_0xfc17('0x74')];_0x31c69a['message'][_0xfc17('0x75')]=_0xfc17('0x63');return respondWithRpcPromise(_0xfc17('0x76'),_0xfc17('0x76'),{'event':_0xfc17('0x77'),'message':_0x31c69a[_0xfc17('0x31')]},client9002)[_0xfc17('0x28')](function(){return _0x31c69a;});}return _0x31c69a;}return null;})[_0xfc17('0x28')](respondWithResult(_0x189157,null))['catch'](handleError(_0x189157,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xfc17('0x78')]=function(_0x3fdeef,_0x4ffebf,_0x5376ff){var _0x387361={'agent':{},'channel':_0xfc17('0x64')};if(_0x3fdeef[_0xfc17('0x5f')]['id']){delete _0x3fdeef[_0xfc17('0x5f')]['id'];}_0x3fdeef['body'][_0xfc17('0x69')]=_0x3fdeef[_0xfc17('0x5f')][_0xfc17('0x69')]||_0x3fdeef['user']['id'];_0x387361[_0xfc17('0x79')]['id']=_0x3fdeef['body'][_0xfc17('0x69')];return db[_0xfc17('0x53')]['find']({'where':{'id':_0x3fdeef[_0xfc17('0x5a')]['id'],'UserId':null}})[_0xfc17('0x28')](handleEntityNotFound(_0x4ffebf,null))[_0xfc17('0x28')](function(_0x3dc171){if(_0x3dc171){_0x387361[_0xfc17('0x31')]=_0x3dc171[_0xfc17('0x6c')]({'plain':!![]});return db[_0xfc17('0x6d')]['find']({'where':{'id':_0x3dc171[_0xfc17('0x7a')]}});}return null;})[_0xfc17('0x28')](handleEntityNotFound(_0x4ffebf,null))[_0xfc17('0x28')](function(_0x5c783f){if(_0x5c783f){_0x387361['interaction']=_0x5c783f[_0xfc17('0x6c')]({'plain':!![]});interaction_log[_0xfc17('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3fdeef[_0xfc17('0x6a')]['id'],_0x3fdeef[_0xfc17('0x6a')]['name'],_0x3fdeef['user'][_0xfc17('0x7b')],_0x387361[_0xfc17('0x6f')]['id'],_0x3fdeef[_0xfc17('0x5f')]?JSON[_0xfc17('0x2e')](_0x3fdeef[_0xfc17('0x5f')]):_0xfc17('0x70'));return respondWithRpcPromise('RejectMessage',_0xfc17('0x7c'),_0x387361);}return null;})[_0xfc17('0x28')](function(_0x36dbc7){if(_0x36dbc7){_0x36dbc7[_0xfc17('0x31')][_0xfc17('0x7d')]=util[_0xfc17('0x67')](_0xfc17('0x73'),_0x3fdeef[_0xfc17('0x6a')][_0xfc17('0x3c')]);_0x36dbc7['message']['channel']=_0x387361[_0xfc17('0x74')];_0x36dbc7[_0xfc17('0x31')][_0xfc17('0x75')]='reject';respondWithRpcPromise('EventManager',_0xfc17('0x76'),{'event':_0xfc17('0x7e'),'message':_0x36dbc7[_0xfc17('0x31')]},client9002);return _0x387361;}return null;})[_0xfc17('0x28')](respondWithResult(_0x4ffebf,null))[_0xfc17('0x58')](handleError(_0x4ffebf,null));};exports[_0xfc17('0x34')]=function(_0x5282bb,_0x224f5,_0x1bd72e){if(_0x5282bb[_0xfc17('0x5f')]['id']){delete _0x5282bb[_0xfc17('0x5f')]['id'];}var _0x2a42ff;return db[_0xfc17('0x53')][_0xfc17('0x5e')]({'where':{'id':_0x5282bb[_0xfc17('0x5a')]['id']}})[_0xfc17('0x28')](handleEntityNotFound(_0x224f5,null))[_0xfc17('0x28')](function(_0x3cc9ba){if(_0x3cc9ba){_0x2a42ff=_0x3cc9ba;return db['SmsAccount'][_0xfc17('0x5e')]({'where':{'id':_0x3cc9ba[_0xfc17('0x7f')]}});}})[_0xfc17('0x28')](handleEntityNotFound(_0x224f5,null))[_0xfc17('0x28')](function(_0x5699dd){if(_0x5699dd){logger[_0xfc17('0x2b')](_0xfc17('0x2c'),_0xfc17('0x34'),'received\x20delivery\x20report\x20from',_0x5699dd['type'],util[_0xfc17('0x80')](_0x5282bb['body'],{'showHidden':![],'depth':null}));switch(_0x5699dd[_0xfc17('0x41')]){case _0xfc17('0x81'):if(_0x5282bb['body']['MessageSid']&&_0x5282bb['body']['MessageSid']===_0x2a42ff[_0xfc17('0x82')]){return _0x2a42ff[_0xfc17('0x5d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfc17('0x34'),_0xfc17('0x81'),util[_0xfc17('0x80')](_0x5282bb[_0xfc17('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfc17('0x83'):if(_0x5282bb[_0xfc17('0x5f')][_0xfc17('0x84')]&&_0x5282bb[_0xfc17('0x5f')]['MessageUUID']===_0x2a42ff[_0xfc17('0x82')]&&_['indexOf']([_0xfc17('0x85'),_0xfc17('0x86')],_0x5282bb[_0xfc17('0x5f')][_0xfc17('0x87')])>=0x0){return _0x2a42ff[_0xfc17('0x5d')]({'read':!![]});}else{logger['error'](_0xfc17('0x88'),_0xfc17('0x34'),'plivio',util[_0xfc17('0x80')](_0x5282bb[_0xfc17('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xfc17('0x89'):var _0x449ce0=_0x5282bb[_0xfc17('0x5f')]['results'][0x0];if(_0x449ce0[_0xfc17('0x34')][_0xfc17('0x8a')]==='DELIVERED'){return _0x2a42ff[_0xfc17('0x5d')]({'read':!![]});}else{logger[_0xfc17('0x2f')](_0xfc17('0x88'),'status',_0xfc17('0x89'),util[_0xfc17('0x80')](_0x5282bb[_0xfc17('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x2a42ff;}})['then'](respondWithResult(_0x224f5,null))[_0xfc17('0x58')](handleError(_0x224f5,null));}; \ No newline at end of file +var _0x4a47=['UserId','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','interaction','info','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.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~!@#$%^&-_=+[{]}.','then','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','includeAll','include','SmsMessage','findAll','rows','show','create','body','find','params','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x36ab93,_0x383ddc){var _0x43136b=function(_0x63e0cb){while(--_0x63e0cb){_0x36ab93['push'](_0x36ab93['shift']());}};_0x43136b(++_0x383ddc);}(_0x4a47,0xb5));var _0x74a4=function(_0x58fdc5,_0x5986a){_0x58fdc5=_0x58fdc5-0x0;var _0x121190=_0x4a47[_0x58fdc5];return _0x121190;};'use strict';var pdf=require(_0x74a4('0x0'));var emlformat=require(_0x74a4('0x1'));var rimraf=require(_0x74a4('0x2'));var zipdir=require(_0x74a4('0x3'));var jsonpatch=require(_0x74a4('0x4'));var rp=require('request-promise');var moment=require(_0x74a4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74a4('0x6'));var util=require(_0x74a4('0x7'));var path=require('path');var sox=require(_0x74a4('0x8'));var csv=require(_0x74a4('0x9'));var ejs=require(_0x74a4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74a4('0x9'));var querystring=require(_0x74a4('0xd'));var Papa=require(_0x74a4('0xe'));var Redis=require(_0x74a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74a4('0x10'));var as=require(_0x74a4('0x11'));var hardwareService=require(_0x74a4('0x12'));var logger=require(_0x74a4('0x13'))('api');var utils=require(_0x74a4('0x14'));var config=require(_0x74a4('0x15'));var db=require(_0x74a4('0x16'))['db'];config['redis']=_['defaults'](config[_0x74a4('0x17')],{'host':_0x74a4('0x18'),'port':0x18eb});var socket=require(_0x74a4('0x19'))(new Redis(config[_0x74a4('0x17')]));require(_0x74a4('0x1a'))[_0x74a4('0x1b')](socket);var jayson=require(_0x74a4('0x1c'));var client=jayson[_0x74a4('0x1d')][_0x74a4('0x1e')]({'port':0x232c});var client9002=jayson[_0x74a4('0x1d')][_0x74a4('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x28c364,_0xc6796e,_0x3c9fc9){if(_0x3c9fc9){var _0x3d9b8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d9b8c[_0x74a4('0x1f')](_0xc6796e)){return _0x28c364;}else{throw new db['Sequelize'][(_0x74a4('0x20'))](_0x74a4('0x21'));}}else{return _0x28c364;}}function respondWithRpcPromise(_0x327562,_0x2c9130,_0x55cf53,_0xf224ef){return new BPromise(function(_0x105998,_0x42d72a){var _0x34a43d=_0xf224ef||client;return _0x34a43d['request'](_0x327562,_0x55cf53)[_0x74a4('0x22')](function(_0x3adb7c){logger['info'](_0x74a4('0x23'),_0x2c9130,_0x74a4('0x24'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c9130,_0x74a4('0x24'),JSON[_0x74a4('0x25')](_0x3adb7c));if(_0x3adb7c[_0x74a4('0x26')]){if(_0x3adb7c[_0x74a4('0x26')]['code']===0x1f4){logger[_0x74a4('0x26')]('SmsMessage,\x20%s,\x20%s',_0x2c9130,_0x3adb7c['error'][_0x74a4('0x27')]);return _0x42d72a(_0x3adb7c[_0x74a4('0x26')][_0x74a4('0x27')]);}logger['error'](_0x74a4('0x23'),_0x2c9130,_0x3adb7c[_0x74a4('0x26')]['message']);return _0x105998(_0x3adb7c[_0x74a4('0x26')][_0x74a4('0x27')]);}else{logger['info'](_0x74a4('0x23'),_0x2c9130,_0x74a4('0x24'));_0x105998(_0x3adb7c[_0x74a4('0x28')]['message']);}})[_0x74a4('0x29')](function(_0x23a74c){logger[_0x74a4('0x26')](_0x74a4('0x23'),_0x2c9130,_0x23a74c);_0x42d72a(_0x23a74c);});});}function respondWithStatusCode(_0xe933f6,_0x1703be){_0x1703be=_0x1703be||0xcc;return function(_0x5a0cb5){if(_0x5a0cb5){return _0xe933f6['sendStatus'](_0x1703be);}return _0xe933f6[_0x74a4('0x2a')](_0x1703be)['end']();};}function respondWithResult(_0x1d252f,_0x4a4a3d){_0x4a4a3d=_0x4a4a3d||0xc8;return function(_0x446340){if(_0x446340){return _0x1d252f['status'](_0x4a4a3d)['json'](_0x446340);}};}function respondWithFilteredResult(_0x1fc75c,_0x376f29){return function(_0x309846){if(_0x309846){var _0x4b833d=_0x309846['count'],_0x4abc27=_0x376f29['offset'],_0x5b9308=_0x376f29[_0x74a4('0x2b')]+_0x376f29['limit'],_0x480770;if(_0x5b9308>=_0x4b833d){_0x5b9308=_0x4b833d;_0x480770=0xc8;}else{_0x480770=0xce;}_0x1fc75c[_0x74a4('0x2a')](_0x480770);return _0x1fc75c[_0x74a4('0x2c')](_0x74a4('0x2d'),_0x4abc27+'-'+_0x5b9308+'/'+_0x4b833d)['json'](_0x309846);}return null;};}function patchUpdates(_0x3e89b5){return function(_0x3c99bd){try{jsonpatch[_0x74a4('0x2e')](_0x3c99bd,_0x3e89b5,!![]);}catch(_0x42ff79){return BPromise[_0x74a4('0x2f')](_0x42ff79);}return _0x3c99bd[_0x74a4('0x30')]();};}function saveUpdates(_0x333e89,_0x990d0a){return function(_0x5e091c){if(_0x5e091c){return _0x5e091c[_0x74a4('0x31')](_0x333e89)[_0x74a4('0x22')](function(_0x54e1dc){return _0x54e1dc;});}return null;};}function removeEntity(_0x2434ae,_0x58401b){return function(_0x4f8f82){if(_0x4f8f82){return _0x4f8f82[_0x74a4('0x32')]()[_0x74a4('0x22')](function(){_0x2434ae[_0x74a4('0x2a')](0xcc)[_0x74a4('0x33')]();});}};}function handleEntityNotFound(_0x1d4e14,_0x431264){return function(_0x299179){if(!_0x299179){_0x1d4e14[_0x74a4('0x34')](0x194);}return _0x299179;};}function handleError(_0xa52e2,_0x4cd59a){_0x4cd59a=_0x4cd59a||0x1f4;return function(_0xee3c04){logger[_0x74a4('0x26')](_0xee3c04[_0x74a4('0x35')]);if(_0xee3c04[_0x74a4('0x36')]){delete _0xee3c04[_0x74a4('0x36')];}_0xa52e2['status'](_0x4cd59a)[_0x74a4('0x37')](_0xee3c04);};}exports[_0x74a4('0x38')]=function(_0x5e2944,_0x2d503d){var _0x43f44d={},_0x461b22={},_0x16da46={'count':0x0,'rows':[]};var _0x1de439=_[_0x74a4('0x39')](db['SmsMessage'][_0x74a4('0x3a')],function(_0x2a0d4c){return{'name':_0x2a0d4c['fieldName'],'type':_0x2a0d4c[_0x74a4('0x3b')][_0x74a4('0x3c')]};});_0x461b22[_0x74a4('0x3d')]=_[_0x74a4('0x39')](_0x1de439,_0x74a4('0x36'));_0x461b22['query']=_[_0x74a4('0x3e')](_0x5e2944[_0x74a4('0x3f')]);_0x461b22['filters']=_[_0x74a4('0x40')](_0x461b22[_0x74a4('0x3d')],_0x461b22[_0x74a4('0x3f')]);_0x43f44d[_0x74a4('0x41')]=_['intersection'](_0x461b22['model'],qs[_0x74a4('0x42')](_0x5e2944['query']['fields']));_0x43f44d[_0x74a4('0x41')]=_0x43f44d[_0x74a4('0x41')][_0x74a4('0x43')]?_0x43f44d['attributes']:_0x461b22[_0x74a4('0x3d')];if(!_0x5e2944[_0x74a4('0x3f')]['hasOwnProperty'](_0x74a4('0x44'))){_0x43f44d[_0x74a4('0x45')]=qs[_0x74a4('0x45')](_0x5e2944[_0x74a4('0x3f')]['limit']);_0x43f44d[_0x74a4('0x2b')]=qs[_0x74a4('0x2b')](_0x5e2944['query'][_0x74a4('0x2b')]);}_0x43f44d[_0x74a4('0x46')]=qs[_0x74a4('0x47')](_0x5e2944[_0x74a4('0x3f')][_0x74a4('0x47')]);_0x43f44d[_0x74a4('0x48')]=qs[_0x74a4('0x49')](_[_0x74a4('0x4a')](_0x5e2944[_0x74a4('0x3f')],_0x461b22[_0x74a4('0x49')]),_0x1de439);if(_0x5e2944[_0x74a4('0x3f')]['filter']){_0x43f44d[_0x74a4('0x48')]=_['merge'](_0x43f44d[_0x74a4('0x48')],{'$or':_[_0x74a4('0x39')](_0x1de439,function(_0x2a799c){if(_0x2a799c['type']!==_0x74a4('0x4b')){var _0x1684eb={};_0x1684eb[_0x2a799c['name']]={'$like':'%'+_0x5e2944[_0x74a4('0x3f')][_0x74a4('0x4c')]+'%'};return _0x1684eb;}})});}_0x43f44d=_[_0x74a4('0x4d')]({},_0x43f44d,_0x5e2944[_0x74a4('0x4e')]);var _0x47865d={'where':_0x43f44d['where']};return db['SmsMessage']['count'](_0x47865d)[_0x74a4('0x22')](function(_0x10111a){_0x16da46[_0x74a4('0x4f')]=_0x10111a;if(_0x5e2944['query'][_0x74a4('0x50')]){_0x43f44d[_0x74a4('0x51')]=[{'all':!![]}];}return db[_0x74a4('0x52')][_0x74a4('0x53')](_0x43f44d);})['then'](function(_0x3cebcf){_0x16da46[_0x74a4('0x54')]=_0x3cebcf;return _0x16da46;})['then'](respondWithFilteredResult(_0x2d503d,_0x43f44d))['catch'](handleError(_0x2d503d,null));};exports[_0x74a4('0x55')]=function(_0x386c38,_0x522181){var _0x42ade1={'raw':!![],'where':{'id':_0x386c38['params']['id']}},_0x44df66={};_0x44df66[_0x74a4('0x3d')]=_[_0x74a4('0x3e')](db[_0x74a4('0x52')][_0x74a4('0x3a')]);_0x44df66[_0x74a4('0x3f')]=_[_0x74a4('0x3e')](_0x386c38[_0x74a4('0x3f')]);_0x44df66[_0x74a4('0x49')]=_[_0x74a4('0x40')](_0x44df66[_0x74a4('0x3d')],_0x44df66[_0x74a4('0x3f')]);_0x42ade1[_0x74a4('0x41')]=_[_0x74a4('0x40')](_0x44df66[_0x74a4('0x3d')],qs['fields'](_0x386c38[_0x74a4('0x3f')]['fields']));_0x42ade1[_0x74a4('0x41')]=_0x42ade1[_0x74a4('0x41')][_0x74a4('0x43')]?_0x42ade1[_0x74a4('0x41')]:_0x44df66[_0x74a4('0x3d')];if(_0x386c38[_0x74a4('0x3f')][_0x74a4('0x50')]){_0x42ade1[_0x74a4('0x51')]=[{'all':!![]}];}_0x42ade1=_['merge']({},_0x42ade1,_0x386c38[_0x74a4('0x4e')]);return db[_0x74a4('0x52')]['find'](_0x42ade1)[_0x74a4('0x22')](handleEntityNotFound(_0x522181,null))['then'](respondWithResult(_0x522181,null))[_0x74a4('0x29')](handleError(_0x522181,null));};exports[_0x74a4('0x56')]=function(_0x11a863,_0xf51a2d){return db[_0x74a4('0x52')][_0x74a4('0x56')](_0x11a863[_0x74a4('0x57')],{})['then'](respondWithResult(_0xf51a2d,0xc9))[_0x74a4('0x29')](handleError(_0xf51a2d,null));};exports[_0x74a4('0x31')]=function(_0x4077cd,_0x60dfe2){if(_0x4077cd[_0x74a4('0x57')]['id']){delete _0x4077cd['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x4077cd['params']['id']}})[_0x74a4('0x22')](handleEntityNotFound(_0x60dfe2,null))[_0x74a4('0x22')](saveUpdates(_0x4077cd[_0x74a4('0x57')],null))[_0x74a4('0x22')](respondWithResult(_0x60dfe2,null))[_0x74a4('0x29')](handleError(_0x60dfe2,null));};exports[_0x74a4('0x32')]=function(_0x10c74c,_0x36cca7){return db[_0x74a4('0x52')][_0x74a4('0x58')]({'where':{'id':_0x10c74c[_0x74a4('0x59')]['id']}})[_0x74a4('0x22')](handleEntityNotFound(_0x36cca7,null))[_0x74a4('0x22')](removeEntity(_0x36cca7,null))[_0x74a4('0x29')](handleError(_0x36cca7,null));};exports['describe']=function(_0x17df43,_0x4708a5){return db['SmsMessage']['describe']()[_0x74a4('0x22')](respondWithResult(_0x4708a5,null))['catch'](handleError(_0x4708a5,null));};var interaction_log=require(_0x74a4('0x13'))(_0x74a4('0x5a'));exports[_0x74a4('0x5b')]=function(_0x3a9898,_0x2e07c2,_0x568f5d){var _0x4867f4={'channel':_0x74a4('0x5c')};if(_0x3a9898['body']['id']){delete _0x3a9898[_0x74a4('0x57')]['id'];}_0x3a9898['body'][_0x74a4('0x5d')]=!![];_0x3a9898[_0x74a4('0x57')][_0x74a4('0x5e')]=moment()[_0x74a4('0x5f')](_0x74a4('0x60'));_0x3a9898[_0x74a4('0x57')][_0x74a4('0x61')]=_0x3a9898[_0x74a4('0x57')]['UserId']||_0x3a9898['user']['id'];return db['SmsMessage']['find']({'where':{'id':_0x3a9898['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x74a4('0x62')}]})[_0x74a4('0x22')](handleEntityNotFound(_0x2e07c2,null))[_0x74a4('0x22')](saveUpdates(_0x3a9898['body'],null))[_0x74a4('0x22')](function(_0x256d8e){if(_0x256d8e){_0x4867f4[_0x74a4('0x27')]=_0x256d8e[_0x74a4('0x63')]({'plain':!![]});return db[_0x74a4('0x64')][_0x74a4('0x58')]({'where':{'id':_0x256d8e[_0x74a4('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2e07c2,null))[_0x74a4('0x22')](function(_0xa92355){if(_0xa92355){return _0xa92355[_0x74a4('0x31')]({'UserId':_0x3a9898[_0x74a4('0x57')][_0x74a4('0x61')],'read1stAt':_[_0x74a4('0x66')](_0xa92355[_0x74a4('0x67')])?moment()['format'](_0x74a4('0x60')):undefined});}return null;})[_0x74a4('0x22')](function(_0x3a1a8c){if(_0x3a1a8c){_0x4867f4['interaction']=_0x3a1a8c[_0x74a4('0x63')]({'plain':!![]});interaction_log['info'](_0x74a4('0x68'),_0x3a9898[_0x74a4('0x69')]['id'],_0x3a9898[_0x74a4('0x69')][_0x74a4('0x36')],_0x3a9898[_0x74a4('0x69')][_0x74a4('0x6a')],_0x4867f4['interaction']['id'],_0x3a9898['body']?JSON[_0x74a4('0x25')](_0x3a9898[_0x74a4('0x57')]):_0x74a4('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x74a4('0x6c'),_0x4867f4);}return null;})[_0x74a4('0x22')](function(_0x58b8e4){if(_0x58b8e4){if(_0x3a9898[_0x74a4('0x57')][_0x74a4('0x6d')]){_0x4867f4[_0x74a4('0x27')][_0x74a4('0x6e')]=util['format'](_0x74a4('0x6f'),_0x3a9898[_0x74a4('0x69')][_0x74a4('0x36')]);_0x4867f4['message'][_0x74a4('0x70')]=_0x4867f4[_0x74a4('0x70')];_0x4867f4[_0x74a4('0x27')]['event']=_0x74a4('0x5b');return respondWithRpcPromise(_0x74a4('0x71'),_0x74a4('0x71'),{'event':_0x74a4('0x72'),'message':_0x4867f4[_0x74a4('0x27')]},client9002)[_0x74a4('0x22')](function(){return _0x4867f4;});}return _0x4867f4;}return null;})[_0x74a4('0x22')](respondWithResult(_0x2e07c2,null))[_0x74a4('0x29')](handleError(_0x2e07c2,null));};var interaction_log=require(_0x74a4('0x13'))(_0x74a4('0x5a'));exports[_0x74a4('0x2f')]=function(_0x1292b4,_0x338692,_0x214708){var _0x63e733={'agent':{},'channel':_0x74a4('0x5c')};if(_0x1292b4['body']['id']){delete _0x1292b4['body']['id'];}_0x1292b4[_0x74a4('0x57')][_0x74a4('0x61')]=_0x1292b4[_0x74a4('0x57')][_0x74a4('0x61')]||_0x1292b4[_0x74a4('0x69')]['id'];_0x63e733[_0x74a4('0x73')]['id']=_0x1292b4[_0x74a4('0x57')][_0x74a4('0x61')];return db[_0x74a4('0x52')][_0x74a4('0x58')]({'where':{'id':_0x1292b4['params']['id'],'UserId':null}})[_0x74a4('0x22')](handleEntityNotFound(_0x338692,null))['then'](function(_0x49e248){if(_0x49e248){_0x63e733['message']=_0x49e248[_0x74a4('0x63')]({'plain':!![]});return db[_0x74a4('0x64')][_0x74a4('0x58')]({'where':{'id':_0x49e248['SmsInteractionId']}});}return null;})[_0x74a4('0x22')](handleEntityNotFound(_0x338692,null))['then'](function(_0x56d28d){if(_0x56d28d){_0x63e733[_0x74a4('0x74')]=_0x56d28d['get']({'plain':!![]});interaction_log[_0x74a4('0x75')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1292b4[_0x74a4('0x69')]['id'],_0x1292b4[_0x74a4('0x69')][_0x74a4('0x36')],_0x1292b4[_0x74a4('0x69')][_0x74a4('0x6a')],_0x63e733[_0x74a4('0x74')]['id'],_0x1292b4['body']?JSON['stringify'](_0x1292b4[_0x74a4('0x57')]):_0x74a4('0x6b'));return respondWithRpcPromise('RejectMessage',_0x74a4('0x76'),_0x63e733);}return null;})['then'](function(_0x4d7db2){if(_0x4d7db2){_0x4d7db2[_0x74a4('0x27')]['interface']=util[_0x74a4('0x5f')]('SIP/%s',_0x1292b4[_0x74a4('0x69')]['name']);_0x4d7db2[_0x74a4('0x27')][_0x74a4('0x70')]=_0x63e733[_0x74a4('0x70')];_0x4d7db2[_0x74a4('0x27')]['event']=_0x74a4('0x2f');respondWithRpcPromise(_0x74a4('0x71'),_0x74a4('0x71'),{'event':_0x74a4('0x77'),'message':_0x4d7db2['message']},client9002);return _0x63e733;}return null;})[_0x74a4('0x22')](respondWithResult(_0x338692,null))['catch'](handleError(_0x338692,null));};exports[_0x74a4('0x2a')]=function(_0x8b8a2c,_0x4336b9,_0x20b06b){if(_0x8b8a2c[_0x74a4('0x57')]['id']){delete _0x8b8a2c['body']['id'];}var _0x303295;return db[_0x74a4('0x52')][_0x74a4('0x58')]({'where':{'id':_0x8b8a2c[_0x74a4('0x59')]['id']}})[_0x74a4('0x22')](handleEntityNotFound(_0x4336b9,null))[_0x74a4('0x22')](function(_0x2e33be){if(_0x2e33be){_0x303295=_0x2e33be;return db[_0x74a4('0x78')][_0x74a4('0x58')]({'where':{'id':_0x2e33be[_0x74a4('0x79')]}});}})[_0x74a4('0x22')](handleEntityNotFound(_0x4336b9,null))[_0x74a4('0x22')](function(_0xc4de31){if(_0xc4de31){logger[_0x74a4('0x7a')](_0x74a4('0x7b'),_0x74a4('0x2a'),_0x74a4('0x7c'),_0xc4de31[_0x74a4('0x3b')],util[_0x74a4('0x7d')](_0x8b8a2c[_0x74a4('0x57')],{'showHidden':![],'depth':null}));switch(_0xc4de31['type']){case _0x74a4('0x7e'):if(_0x8b8a2c[_0x74a4('0x57')][_0x74a4('0x7f')]&&_0x8b8a2c['body'][_0x74a4('0x7f')]===_0x303295[_0x74a4('0x80')]){return _0x303295['update']({'read':!![]});}else{logger['error'](_0x74a4('0x81'),_0x74a4('0x2a'),_0x74a4('0x7e'),util[_0x74a4('0x7d')](_0x8b8a2c[_0x74a4('0x57')],{'showHidden':![],'depth':null}));}break;case _0x74a4('0x82'):if(_0x8b8a2c[_0x74a4('0x57')][_0x74a4('0x83')]&&_0x8b8a2c[_0x74a4('0x57')][_0x74a4('0x83')]===_0x303295['messageId']&&_[_0x74a4('0x84')]([_0x74a4('0x85'),_0x74a4('0x86')],_0x8b8a2c[_0x74a4('0x57')][_0x74a4('0x87')])>=0x0){return _0x303295[_0x74a4('0x31')]({'read':!![]});}else{logger[_0x74a4('0x26')](_0x74a4('0x81'),_0x74a4('0x2a'),'plivio',util[_0x74a4('0x7d')](_0x8b8a2c['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x119ef8=_0x8b8a2c[_0x74a4('0x57')]['results'][0x0];if(_0x119ef8[_0x74a4('0x2a')][_0x74a4('0x88')]===_0x74a4('0x89')){return _0x303295[_0x74a4('0x31')]({'read':!![]});}else{logger[_0x74a4('0x26')](_0x74a4('0x81'),_0x74a4('0x2a'),_0x74a4('0x8a'),util['inspect'](_0x8b8a2c[_0x74a4('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x303295;}})['then'](respondWithResult(_0x4336b9,null))[_0x74a4('0x29')](handleError(_0x4336b9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2d5bdcb..e22ffae 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 _0x4faa=['emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove'];(function(_0x28fa7b,_0x1e4927){var _0x54e575=function(_0x572587){while(--_0x572587){_0x28fa7b['push'](_0x28fa7b['shift']());}};_0x54e575(++_0x1e4927);}(_0x4faa,0x81));var _0xa4fa=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4faa[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0xa4fa('0x0'));var SmsMessage=require(_0xa4fa('0x1'))['db'][_0xa4fa('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa4fa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4fa('0x4'),'afterDestroy':_0xa4fa('0x5')};function emitEvent(_0x3041b0){return function(_0x23f7e4,_0x48816e,_0x5bb1a8){SmsMessageEvents[_0xa4fa('0x6')](_0x3041b0+':'+_0x23f7e4['id'],_0x23f7e4);SmsMessageEvents['emit'](_0x3041b0,_0x23f7e4);_0x5bb1a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xa4fa('0x7')](e,emitEvent(event));}}module[_0xa4fa('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xad58=['SmsMessage','setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xb11c6b,_0x3de143){var _0x2a92e0=function(_0x27ceb2){while(--_0x27ceb2){_0xb11c6b['push'](_0xb11c6b['shift']());}};_0x2a92e0(++_0x3de143);}(_0xad58,0x18e));var _0x8ad5=function(_0x1d66e2,_0x195dc7){_0x1d66e2=_0x1d66e2-0x0;var _0x3765d0=_0xad58[_0x1d66e2];return _0x3765d0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x8ad5('0x0'))['db'][_0x8ad5('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8ad5('0x2')](0x0);var events={'afterCreate':_0x8ad5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c3514){return function(_0x2638c4,_0x18cfb0,_0x38d505){SmsMessageEvents['emit'](_0x3c3514+':'+_0x2638c4['id'],_0x2638c4);SmsMessageEvents[_0x8ad5('0x4')](_0x3c3514,_0x2638c4);_0x38d505(null);};}for(var e in events){if(events[_0x8ad5('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x8ad5('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 9149cd2..595a5e0 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 _0xf259=['token','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','smsMethod','login?username=','password','GET','split','POST','user_key','session_key','internal_order_id','read','connectel','senderString','https://smsapi.connectel.se/api/send/','deliveryReport','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','sort','createHash','md5','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','SmsInteractionId','then','update','createdAt','catch','secret','SmsAccount','find','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token='];(function(_0x387b91,_0x1b362a){var _0x52759e=function(_0x19a12f){while(--_0x19a12f){_0x387b91['push'](_0x387b91['shift']());}};_0x52759e(++_0x1b362a);}(_0xf259,0xb8));var _0x9f25=function(_0x19d73a,_0xb0cd0f){_0x19d73a=_0x19d73a-0x0;var _0x244d9a=_0xf259[_0x19d73a];return _0x244d9a;};'use strict';var _=require(_0x9f25('0x0'));var util=require(_0x9f25('0x1'));var logger=require(_0x9f25('0x2'))('api');var moment=require(_0x9f25('0x3'));var BPromise=require(_0x9f25('0x4'));var rp=require(_0x9f25('0x5'));var fs=require('fs');var path=require(_0x9f25('0x6'));var rimraf=require(_0x9f25('0x7'));var config=require(_0x9f25('0x8'));var attributes=require(_0x9f25('0x9'));module[_0x9f25('0xa')]=function(_0x5f24b2,_0x28fc5d){return _0x5f24b2[_0x9f25('0xb')](_0x9f25('0xc'),attributes,{'tableName':_0x9f25('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9f25('0xe')]},{'name':'fti_sms_messages','fields':[_0x9f25('0xf')],'type':_0x9f25('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xca87b2,_0x4adb71,_0x26a0f4){var _0xb1b771=_0x5f24b2[_0x9f25('0x11')];var _0x38f0b9=_0xca87b2[_0x9f25('0x12')]({'plain':!![]});if(_0x38f0b9[_0x9f25('0x13')][_0x9f25('0x14')]()==='in'||_0x38f0b9['direction']['toLowerCase']()===_0x9f25('0x15')&&!_0x38f0b9['secret']&&!_[_0x9f25('0x16')](_0x38f0b9['UserId'])){_0xb1b771['SmsInteraction']['findOne']({'where':{'id':_0x38f0b9[_0x9f25('0x17')]}})[_0x9f25('0x18')](function(_0x51a791){if(_0x51a791){_0x51a791[_0x9f25('0x19')]({'lastMsgAt':_0x38f0b9[_0x9f25('0x1a')],'lastMsgDirection':_0x38f0b9[_0x9f25('0x13')]['toLowerCase']()});}})[_0x9f25('0x1b')](function(_0x3f0c28){console['error'](_0x3f0c28);});}if(_0x38f0b9[_0x9f25('0x13')]===_0x9f25('0x15')&&!_0x38f0b9[_0x9f25('0x1c')]){var _0x39e7bf;_0xb1b771[_0x9f25('0x1d')][_0x9f25('0x1e')]({'where':{'id':_0x38f0b9['SmsAccountId']},'raw':!![]})[_0x9f25('0x18')](function(_0x2800ae){_0x39e7bf=_0x2800ae;if(_0x39e7bf&&_0x39e7bf[_0x9f25('0x1f')]){switch(_0x39e7bf[_0x9f25('0x1f')]){case _0x9f25('0x20'):var _0x119b32=require(_0x9f25('0x20'));if(_0x39e7bf['accountSid']&&_0x39e7bf[_0x9f25('0x21')]&&_0x39e7bf[_0x9f25('0x22')]){var _0x2f836c=new _0x119b32(_0x39e7bf['accountSid'],_0x39e7bf['authToken']);_0x2f836c[_0x9f25('0x23')][_0x9f25('0x24')]({'body':_0x38f0b9['body'],'to':_0x38f0b9[_0x9f25('0x22')],'from':_0x39e7bf[_0x9f25('0x22')],'statusCallback':_0x39e7bf[_0x9f25('0x25')]+_0x9f25('0x26')+_0x38f0b9['id']+_0x9f25('0x27')+_0x39e7bf[_0x9f25('0x28')]})[_0x9f25('0x18')](function(_0x4dd7c2){if(_0x4dd7c2['sid']){return _0xca87b2['update']({'messageId':_0x4dd7c2['sid']});}})[_0x9f25('0x1b')](function(_0x3cf3c6){logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),'twilio',util[_0x9f25('0x2c')](_0x3cf3c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9f25('0x2d'):var _0x672d67='https://api.skebby.it/API/v1.0/REST/';if(_0x39e7bf[_0x9f25('0x2e')]&&_0x39e7bf['password']){var _0x3ea2bd={'recipient':[_0x38f0b9[_0x9f25('0x22')]],'message':_0x38f0b9[_0x9f25('0xf')],'message_type':_0x39e7bf[_0x9f25('0x2f')]};if(_0x39e7bf[_0x9f25('0x2f')]&&_0x39e7bf[_0x9f25('0x2f')]!=='SI'){_0x3ea2bd['sender']=_0x39e7bf[_0x9f25('0x22')];}var _0x3565d0={'url':_0x672d67+_0x9f25('0x30')+_0x39e7bf[_0x9f25('0x2e')]+'&password='+_0x39e7bf[_0x9f25('0x31')],'method':_0x9f25('0x32')};rp(_0x3565d0)[_0x9f25('0x18')](function(_0x14c258){var _0x446819=_0x14c258[_0x9f25('0x33')](';');var _0x367560={'user_key':_0x446819[0x0],'session_key':_0x446819[0x1]};_0x3565d0={'url':_0x672d67+'sms','method':_0x9f25('0x34'),'headers':{'user_key':_0x367560[_0x9f25('0x35')],'Session_key':_0x367560[_0x9f25('0x36')]},'json':!![],'body':_0x3ea2bd};return rp(_0x3565d0);})[_0x9f25('0x18')](function(_0x5a85f1){if(_0x5a85f1['total_sent']>=0x1){var _0x4ffd9e={'messageId':_0x5a85f1[_0x9f25('0x37')]};if(_0x39e7bf[_0x9f25('0x2f')]!=='GP'||!_0x39e7bf['deliveryReport']){_0x4ffd9e[_0x9f25('0x38')]=!![];}return _0xca87b2[_0x9f25('0x19')](_0x4ffd9e);}else{return logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x2d'),util['inspect'](_0x5a85f1,{'showHidden':![],'depth':null}));}})[_0x9f25('0x1b')](function(_0x2cea1f){return logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x2d'),util['inspect'](_0x2cea1f,{'showHidden':![],'depth':null}));});}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9f25('0x39'):if(_0x39e7bf[_0x9f25('0x21')]){var _0x459472={'recipient':_0x38f0b9[_0x9f25('0x22')],'message':_0x38f0b9['body'],'sender':_0x39e7bf[_0x9f25('0x3a')]||_0x39e7bf[_0x9f25('0x22')],'authorization':_0x39e7bf[_0x9f25('0x21')]};var _0x4adb71={'method':_0x9f25('0x34'),'uri':_0x9f25('0x3b'),'body':_0x459472,'json':!![]};rp(_0x4adb71)[_0x9f25('0x18')](function(_0x4295b0){var _0x468b12={'messageId':_0x4295b0['requestid']};if(!_0x39e7bf[_0x9f25('0x3c')]){_0x468b12[_0x9f25('0x38')]=!![];}return _0xca87b2['update'](_0x468b12);})[_0x9f25('0x1b')](function(_0x5e1b69){logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x39'),util[_0x9f25('0x2c')](_0x5e1b69,{'showHidden':![],'depth':null}));});}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x39'),_0x9f25('0x3d'));}break;case'clicksend':if(_0x39e7bf[_0x9f25('0x2e')]&&_0x39e7bf[_0x9f25('0x31')]){var _0x459472={'messages':[{'source':'xCALLY\x20Motion','to':_0x38f0b9[_0x9f25('0x22')],'body':_0x38f0b9[_0x9f25('0xf')],'from':_0x39e7bf['senderString']||_0x39e7bf[_0x9f25('0x22')]}]};var _0x367749=util[_0x9f25('0x3e')]('%s:%s',_0x39e7bf[_0x9f25('0x2e')],_0x39e7bf['password']);var _0x4adb71={'method':_0x9f25('0x34'),'uri':_0x9f25('0x3f'),'body':_0x459472,'headers':{'Authorization':util[_0x9f25('0x3e')](_0x9f25('0x40'),new Buffer(_0x367749)['toString'](_0x9f25('0x41')))},'json':!![]};rp(_0x4adb71)['then'](function(_0x4475d7){if(_0x4475d7[_0x9f25('0x42')]>=0xc8&&_0x4475d7[_0x9f25('0x42')]<=0xce){if(_0x4475d7[_0x9f25('0x43')]&&_0x4475d7[_0x9f25('0x43')][_0x9f25('0x44')]>0x0){var _0x1efb9f=_[_0x9f25('0x45')](_0x4475d7[_0x9f25('0x43')][_0x9f25('0x23')]);var _0x5aa901={'messageId':_0x1efb9f['message_id']};if(!_0x39e7bf['deliveryReport']){_0x5aa901[_0x9f25('0x38')]=!![];}return _0xca87b2[_0x9f25('0x19')](_0x5aa901);}else{logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),'clickSend',util[_0x9f25('0x2c')](_0x4475d7,{'showHidden':![],'depth':null}));}}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x46'),util[_0x9f25('0x2c')](_0x4475d7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x260057){logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x46'),util[_0x9f25('0x2c')](_0x260057,{'showHidden':![],'depth':null}));});}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x46'),_0x9f25('0x47'));}break;case _0x9f25('0x48'):if(_0x39e7bf[_0x9f25('0x49')]&&_0x39e7bf[_0x9f25('0x21')]){var _0x459472={'dst':_0x38f0b9[_0x9f25('0x22')],'text':_0x38f0b9[_0x9f25('0xf')],'src':_0x39e7bf[_0x9f25('0x3a')]||_0x39e7bf[_0x9f25('0x22')],'url':_0x39e7bf[_0x9f25('0x25')]+_0x9f25('0x26')+_0x38f0b9['id']+_0x9f25('0x27')+_0x39e7bf[_0x9f25('0x28')]};var _0x367749=util['format']('%s:%s',_0x39e7bf[_0x9f25('0x49')],_0x39e7bf[_0x9f25('0x21')]);var _0x4adb71={'method':_0x9f25('0x34'),'uri':util['format'](_0x9f25('0x4a'),_0x39e7bf['authId']),'body':_0x459472,'headers':{'Authorization':util['format'](_0x9f25('0x40'),new Buffer(_0x367749)['toString'](_0x9f25('0x41')))},'json':!![]};rp(_0x4adb71)[_0x9f25('0x18')](function(_0x6f42ad){var _0x3a7564={'messageId':_0x6f42ad[_0x9f25('0x4b')][0x0]};return _0xca87b2['update'](_0x3a7564);})[_0x9f25('0x1b')](function(_0x5e673c){logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x48'),util[_0x9f25('0x2c')](_0x5e673c,{'showHidden':![],'depth':null}));});}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x48'),_0x9f25('0x4c'));}break;case _0x9f25('0x4d'):if(_0x39e7bf[_0x9f25('0x2e')]&&_0x39e7bf[_0x9f25('0x31')]){if(_0x39e7bf[_0x9f25('0x4e')]){var _0x12aad9={'method':_0x9f25('0x34'),'uri':_0x39e7bf[_0x9f25('0x4e')]+'/auth/1/session','body':{'username':_0x39e7bf['username'],'password':_0x39e7bf['password']},'json':!![]};return rp(_0x12aad9)[_0x9f25('0x18')](function(_0x40fa51){var _0x8dea5f={'method':_0x9f25('0x34'),'uri':_0x39e7bf[_0x9f25('0x4e')]+_0x9f25('0x4f'),'body':{'messages':[{'from':_0x39e7bf[_0x9f25('0x22')],'destinations':[{'to':_0x38f0b9[_0x9f25('0x22')]}],'text':_0x38f0b9[_0x9f25('0xf')],'notifyUrl':_0x39e7bf[_0x9f25('0x25')]+_0x9f25('0x26')+_0x38f0b9['id']+'/status?token='+_0x39e7bf[_0x9f25('0x28')],'notifyContentType':_0x9f25('0x50'),'callbackData':_0x39e7bf[_0x9f25('0x22')]+';'+_0x38f0b9[_0x9f25('0xf')]}]},'headers':{'Authorization':_0x9f25('0x51')+_0x40fa51[_0x9f25('0x28')]},'json':!![]};return rp(_0x8dea5f)[_0x9f25('0x18')](function(_0x1a02b3){if(_0x1a02b3['messages']){var _0x3bd68d={'messageId':_0x1a02b3[_0x9f25('0x23')][0x0][_0x9f25('0xe')]};if(!_0x39e7bf['deliveryReport']){_0x3bd68d[_0x9f25('0x38')]=!![];}return _0xca87b2['update'](_0x3bd68d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x9f25('0x2c')](_0x1a02b3,{'showHidden':![],'depth':null}));}});})[_0x9f25('0x1b')](function(_0x4f2429){return logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x4d'),util[_0x9f25('0x2c')](_0x4f2429,{'showHidden':![],'depth':null}));});}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),'afterCreate',_0x9f25('0x4d'),_0x9f25('0x52'));}}else{logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9f25('0x53'):var _0x1a51c0=require(_0x9f25('0x54'));if(_0x39e7bf['apiKey']){var _0x2e970f={};_0x2e970f[_0x9f25('0x55')]=_0x39e7bf[_0x9f25('0x2e')];_0x2e970f[_0x9f25('0x22')]=_0x38f0b9[_0x9f25('0x22')];_0x2e970f[_0x9f25('0x56')]=_0x39e7bf[_0x9f25('0x22')];_0x2e970f[_0x9f25('0x57')]=_0x38f0b9[_0x9f25('0xf')];_0x2e970f[_0x9f25('0x58')]=+new Date();var _0x1db955='';var _0x24cbfd='';var _0x2c66a1=Object[_0x9f25('0x59')](_0x2e970f);_0x2c66a1[_0x9f25('0x5a')]();for(var _0xbc0a86=0x0;_0xbc0a86<_0x2c66a1['length'];_0xbc0a86++){if(_0x1db955!=''){_0x1db955+='&';}_0x1db955+=_0x2c66a1[_0xbc0a86]+'='+encodeURIComponent(_0x2e970f[_0x2c66a1[_0xbc0a86]]);_0x24cbfd+=_0x2e970f[_0x2c66a1[_0xbc0a86]];}_0x24cbfd+=_0x39e7bf['apiKey'];_0x24cbfd=_0x1a51c0[_0x9f25('0x5b')](_0x9f25('0x5c'))[_0x9f25('0x19')](_0x24cbfd)['digest'](_0x9f25('0x5d'));if(_0x1db955!==''){_0x1db955+='&';}_0x1db955+='signature='+_0x24cbfd;var _0x3565d0={'method':'GET','uri':_0x39e7bf[_0x9f25('0x4e')]+_0x9f25('0x5e')+_0x1db955,'json':!![]};return rp(_0x3565d0)[_0x9f25('0x18')](function(_0x34db58){var _0x5c8af7=Object[_0x9f25('0x59')](_0x34db58);if(_0x34db58[_0x5c8af7[0x0]][_0x9f25('0x29')]&&parseInt(_0x34db58[_0x5c8af7[0x0]]['error'])===0x0){var _0x2177a9={'messageId':_0x34db58[_0x5c8af7[0x0]]['id_sms']};if(!_0x39e7bf[_0x9f25('0x3c')]){_0x2177a9[_0x9f25('0x38')]=!![];}return _0xca87b2['update'](_0x2177a9);}else{return logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x53'),util[_0x9f25('0x2c')](_0x34db58[_0x9f25('0x29')],{'showHidden':![],'depth':null}));}})[_0x9f25('0x1b')](function(_0x20bcb3){return logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x53'),util[_0x9f25('0x2c')](_0x20bcb3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x53'),_0x9f25('0x5f'));}break;case _0x9f25('0x60'):if(_0x39e7bf[_0x9f25('0x61')]){var _0xe99465={'method':_0x9f25('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x39e7bf['apiKey']},'body':{'content':_0x38f0b9['body'],'to':[_0x38f0b9['phone']],'from':_0x39e7bf[_0x9f25('0x22')],'binary':![],'clientMessageId':_0x9f25('0x62'),'charset':_0x9f25('0x63')},'json':!![]};rp(_0xe99465)[_0x9f25('0x18')](function(_0x142b62){if(!_0x142b62['error']){var _0x190ea0={'messageId':_0x142b62[_0x9f25('0x23')][0x0][_0x9f25('0x64')]};if(!_0x39e7bf['deliveryReport']){_0x190ea0[_0x9f25('0x38')]=!![];}return _0xca87b2[_0x9f25('0x19')](_0x190ea0);}else{return logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x60'),util[_0x9f25('0x2c')](_0x142b62[_0x9f25('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x39b860){return logger[_0x9f25('0x29')](_0x9f25('0x2a'),'afterCreate',_0x9f25('0x60'),util['inspect'](_0x39b860,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9f25('0x2a'),_0x9f25('0x2b'),'clickatell',_0x9f25('0x5f'));}break;case _0x9f25('0x65'):if(_0x39e7bf[_0x9f25('0x61')]){var _0x41cc6f={};var _0x3565d0={'method':_0x9f25('0x34'),'uri':_0x9f25('0x66'),'headers':{'Authorization':_0x9f25('0x67')+_0x39e7bf['apiKey'],'Content-Type':_0x9f25('0x50')},'body':{'from':_0x39e7bf[_0x9f25('0x22')],'to':_0x38f0b9['phone'],'text':_0x38f0b9[_0x9f25('0xf')]},'json':!![]};return rp(_0x3565d0)[_0x9f25('0x18')](function(_0xad6486){if(_0xad6486[_0x9f25('0x68')]==0xca){_0x41cc6f[_0x9f25('0x69')]=_0xad6486;var _0x84dc62={'method':_0x9f25('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x9f25('0x67')+_0x39e7bf[_0x9f25('0x61')],'Content-Type':_0x9f25('0x50')},'body':{'refid':_0x41cc6f['message'][_0x9f25('0x6a')]},'json':!![]};return rp(_0x84dc62)[_0x9f25('0x18')](function(_0xed6031){_0x41cc6f[_0x9f25('0x6b')]=_0xed6031;var _0x5caeb6={'messageId':_0x41cc6f[_0x9f25('0x69')][_0x9f25('0x6a')],'read':!![]};return _0xca87b2['update'](_0x5caeb6);});}else{return logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),_0x9f25('0x65'),util[_0x9f25('0x2c')](_0xad6486,{'showHidden':![],'depth':null}));}})[_0x9f25('0x1b')](function(_0x1db427){return logger[_0x9f25('0x29')](_0x9f25('0x2a'),_0x9f25('0x2b'),'intelepeer',util[_0x9f25('0x2c')](_0x1db427,{'showHidden':![],'depth':null}));});}else{return logger[_0x9f25('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',_0x9f25('0x6c'));}break;}}})[_0x9f25('0x6d')](function(){_0x26a0f4();});}else{_0x26a0f4();}}},'charset':_0x9f25('0x6e'),'collate':_0x9f25('0x6f')});}; \ No newline at end of file +var _0x69e3=['message','refid','Token\x20not\x20received','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','type','twilio','authToken','phone','accountSid','messages','create','body','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','error','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','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','length','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr'];(function(_0x11280c,_0x4e8f92){var _0x5999ac=function(_0x3fe60e){while(--_0x3fe60e){_0x11280c['push'](_0x11280c['shift']());}};_0x5999ac(++_0x4e8f92);}(_0x69e3,0x1e4));var _0x369e=function(_0x1084c3,_0x525d3d){_0x1084c3=_0x1084c3-0x0;var _0x2e1a25=_0x69e3[_0x1084c3];return _0x2e1a25;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x369e('0x0'))(_0x369e('0x1'));var moment=require(_0x369e('0x2'));var BPromise=require('bluebird');var rp=require(_0x369e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x369e('0x4'));var config=require(_0x369e('0x5'));var attributes=require(_0x369e('0x6'));module[_0x369e('0x7')]=function(_0xcb8439,_0x101669){return _0xcb8439[_0x369e('0x8')](_0x369e('0x9'),attributes,{'tableName':_0x369e('0xa'),'paranoid':![],'indexes':[{'name':_0x369e('0xb'),'fields':[_0x369e('0xb')]},{'name':_0x369e('0xc'),'fields':['body'],'type':_0x369e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x83cd99,_0x277895,_0x22a28e){var _0x185d4f=_0xcb8439['models'];var _0x25e2d0=_0x83cd99[_0x369e('0xe')]({'plain':!![]});if(_0x25e2d0[_0x369e('0xf')][_0x369e('0x10')]()==='in'||_0x25e2d0[_0x369e('0xf')][_0x369e('0x10')]()===_0x369e('0x11')&&!_0x25e2d0[_0x369e('0x12')]&&!_['isNil'](_0x25e2d0[_0x369e('0x13')])){_0x185d4f[_0x369e('0x14')][_0x369e('0x15')]({'where':{'id':_0x25e2d0['SmsInteractionId']}})[_0x369e('0x16')](function(_0x5be3a9){if(_0x5be3a9){_0x5be3a9[_0x369e('0x17')]({'lastMsgAt':_0x25e2d0['createdAt'],'lastMsgDirection':_0x25e2d0[_0x369e('0xf')]['toLowerCase']()});}})[_0x369e('0x18')](function(_0x326a46){console['error'](_0x326a46);});}if(_0x25e2d0[_0x369e('0xf')]===_0x369e('0x11')&&!_0x25e2d0['secret']){var _0xed3089;_0x185d4f[_0x369e('0x19')][_0x369e('0x1a')]({'where':{'id':_0x25e2d0['SmsAccountId']},'raw':!![]})[_0x369e('0x16')](function(_0xb81d67){_0xed3089=_0xb81d67;if(_0xed3089&&_0xed3089[_0x369e('0x1b')]){switch(_0xed3089[_0x369e('0x1b')]){case'twilio':var _0x44d36d=require(_0x369e('0x1c'));if(_0xed3089['accountSid']&&_0xed3089[_0x369e('0x1d')]&&_0xed3089[_0x369e('0x1e')]){var _0x263a25=new _0x44d36d(_0xed3089[_0x369e('0x1f')],_0xed3089[_0x369e('0x1d')]);_0x263a25[_0x369e('0x20')][_0x369e('0x21')]({'body':_0x25e2d0[_0x369e('0x22')],'to':_0x25e2d0[_0x369e('0x1e')],'from':_0xed3089[_0x369e('0x1e')],'statusCallback':_0xed3089[_0x369e('0x23')]+'/api/sms/messages/'+_0x25e2d0['id']+_0x369e('0x24')+_0xed3089[_0x369e('0x25')]})['then'](function(_0x5adbd9){if(_0x5adbd9['sid']){return _0x83cd99[_0x369e('0x17')]({'messageId':_0x5adbd9[_0x369e('0x26')]});}})[_0x369e('0x18')](function(_0x13dae1){logger['error'](_0x369e('0x27'),'afterCreate','twilio',util[_0x369e('0x28')](_0x13dae1,{'showHidden':![],'depth':null}));});}else{logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x1c'),_0x369e('0x2b'));}break;case _0x369e('0x2c'):var _0x4f4a59=_0x369e('0x2d');if(_0xed3089[_0x369e('0x2e')]&&_0xed3089[_0x369e('0x2f')]){var _0x5e331f={'recipient':[_0x25e2d0[_0x369e('0x1e')]],'message':_0x25e2d0['body'],'message_type':_0xed3089[_0x369e('0x30')]};if(_0xed3089[_0x369e('0x30')]&&_0xed3089['smsMethod']!=='SI'){_0x5e331f[_0x369e('0x31')]=_0xed3089[_0x369e('0x1e')];}var _0x32db4b={'url':_0x4f4a59+_0x369e('0x32')+_0xed3089[_0x369e('0x2e')]+_0x369e('0x33')+_0xed3089[_0x369e('0x2f')],'method':_0x369e('0x34')};rp(_0x32db4b)[_0x369e('0x16')](function(_0x2adff2){var _0xf968d=_0x2adff2[_0x369e('0x35')](';');var _0x5d5330={'user_key':_0xf968d[0x0],'session_key':_0xf968d[0x1]};_0x32db4b={'url':_0x4f4a59+_0x369e('0x36'),'method':'POST','headers':{'user_key':_0x5d5330[_0x369e('0x37')],'Session_key':_0x5d5330['session_key']},'json':!![],'body':_0x5e331f};return rp(_0x32db4b);})['then'](function(_0x53fc5e){if(_0x53fc5e[_0x369e('0x38')]>=0x1){var _0x3a3123={'messageId':_0x53fc5e[_0x369e('0x39')]};if(_0xed3089[_0x369e('0x30')]!=='GP'||!_0xed3089[_0x369e('0x3a')]){_0x3a3123[_0x369e('0x3b')]=!![];}return _0x83cd99[_0x369e('0x17')](_0x3a3123);}else{return logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x2c'),util[_0x369e('0x28')](_0x53fc5e,{'showHidden':![],'depth':null}));}})[_0x369e('0x18')](function(_0x1ec2cf){return logger[_0x369e('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x369e('0x2c'),util['inspect'](_0x1ec2cf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x2c'),_0x369e('0x3c'));}break;case _0x369e('0x3d'):if(_0xed3089[_0x369e('0x1d')]){var _0x558f8b={'recipient':_0x25e2d0[_0x369e('0x1e')],'message':_0x25e2d0[_0x369e('0x22')],'sender':_0xed3089[_0x369e('0x3e')]||_0xed3089[_0x369e('0x1e')],'authorization':_0xed3089[_0x369e('0x1d')]};var _0x277895={'method':_0x369e('0x3f'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x558f8b,'json':!![]};rp(_0x277895)[_0x369e('0x16')](function(_0x146a94){var _0x4e68fd={'messageId':_0x146a94[_0x369e('0x40')]};if(!_0xed3089[_0x369e('0x3a')]){_0x4e68fd[_0x369e('0x3b')]=!![];}return _0x83cd99[_0x369e('0x17')](_0x4e68fd);})[_0x369e('0x18')](function(_0xfb8770){logger[_0x369e('0x29')](_0x369e('0x27'),'afterCreate',_0x369e('0x3d'),util[_0x369e('0x28')](_0xfb8770,{'showHidden':![],'depth':null}));});}else{logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x3d'),_0x369e('0x41'));}break;case _0x369e('0x42'):if(_0xed3089['username']&&_0xed3089[_0x369e('0x2f')]){var _0x558f8b={'messages':[{'source':_0x369e('0x43'),'to':_0x25e2d0[_0x369e('0x1e')],'body':_0x25e2d0[_0x369e('0x22')],'from':_0xed3089['senderString']||_0xed3089[_0x369e('0x1e')]}]};var _0x28b8ac=util[_0x369e('0x44')]('%s:%s',_0xed3089['username'],_0xed3089['password']);var _0x277895={'method':_0x369e('0x3f'),'uri':_0x369e('0x45'),'body':_0x558f8b,'headers':{'Authorization':util[_0x369e('0x44')](_0x369e('0x46'),new Buffer(_0x28b8ac)['toString'](_0x369e('0x47')))},'json':!![]};rp(_0x277895)[_0x369e('0x16')](function(_0x1fcd52){if(_0x1fcd52['http_code']>=0xc8&&_0x1fcd52[_0x369e('0x48')]<=0xce){if(_0x1fcd52[_0x369e('0x49')]&&_0x1fcd52[_0x369e('0x49')][_0x369e('0x4a')]>0x0){var _0x46f46e=_[_0x369e('0x4b')](_0x1fcd52[_0x369e('0x49')][_0x369e('0x20')]);var _0x1fd391={'messageId':_0x46f46e[_0x369e('0x4c')]};if(!_0xed3089[_0x369e('0x3a')]){_0x1fd391[_0x369e('0x3b')]=!![];}return _0x83cd99[_0x369e('0x17')](_0x1fd391);}else{logger[_0x369e('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x369e('0x2a'),_0x369e('0x4d'),util[_0x369e('0x28')](_0x1fcd52,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x4d'),util[_0x369e('0x28')](_0x1fcd52,{'showHidden':![],'depth':null}));}})[_0x369e('0x18')](function(_0xd279cc){logger['error'](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x4d'),util['inspect'](_0xd279cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x369e('0x27'),'afterCreate','clickSend',_0x369e('0x3c'));}break;case _0x369e('0x4e'):if(_0xed3089[_0x369e('0x4f')]&&_0xed3089[_0x369e('0x1d')]){var _0x558f8b={'dst':_0x25e2d0[_0x369e('0x1e')],'text':_0x25e2d0['body'],'src':_0xed3089[_0x369e('0x3e')]||_0xed3089['phone'],'url':_0xed3089[_0x369e('0x23')]+_0x369e('0x50')+_0x25e2d0['id']+_0x369e('0x24')+_0xed3089[_0x369e('0x25')]};var _0x28b8ac=util[_0x369e('0x44')](_0x369e('0x51'),_0xed3089[_0x369e('0x4f')],_0xed3089['authToken']);var _0x277895={'method':_0x369e('0x3f'),'uri':util['format'](_0x369e('0x52'),_0xed3089['authId']),'body':_0x558f8b,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x28b8ac)[_0x369e('0x53')](_0x369e('0x47')))},'json':!![]};rp(_0x277895)[_0x369e('0x16')](function(_0x393b68){var _0xdb027c={'messageId':_0x393b68[_0x369e('0x54')][0x0]};return _0x83cd99[_0x369e('0x17')](_0xdb027c);})[_0x369e('0x18')](function(_0x3c2378){logger[_0x369e('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x369e('0x2a'),_0x369e('0x4e'),util[_0x369e('0x28')](_0x3c2378,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x369e('0x4e'),_0x369e('0x55'));}break;case _0x369e('0x56'):if(_0xed3089[_0x369e('0x2e')]&&_0xed3089[_0x369e('0x2f')]){if(_0xed3089['baseUrl']){var _0x433b5e={'method':_0x369e('0x3f'),'uri':_0xed3089['baseUrl']+_0x369e('0x57'),'body':{'username':_0xed3089['username'],'password':_0xed3089[_0x369e('0x2f')]},'json':!![]};return rp(_0x433b5e)[_0x369e('0x16')](function(_0x2bec21){var _0x1bc91d={'method':'POST','uri':_0xed3089[_0x369e('0x58')]+_0x369e('0x59'),'body':{'messages':[{'from':_0xed3089[_0x369e('0x1e')],'destinations':[{'to':_0x25e2d0['phone']}],'text':_0x25e2d0['body'],'notifyUrl':_0xed3089[_0x369e('0x23')]+_0x369e('0x50')+_0x25e2d0['id']+_0x369e('0x24')+_0xed3089[_0x369e('0x25')],'notifyContentType':_0x369e('0x5a'),'callbackData':_0xed3089['phone']+';'+_0x25e2d0[_0x369e('0x22')]}]},'headers':{'Authorization':_0x369e('0x5b')+_0x2bec21[_0x369e('0x25')]},'json':!![]};return rp(_0x1bc91d)[_0x369e('0x16')](function(_0x1f572c){if(_0x1f572c[_0x369e('0x20')]){var _0x4617a3={'messageId':_0x1f572c[_0x369e('0x20')][0x0][_0x369e('0xb')]};if(!_0xed3089[_0x369e('0x3a')]){_0x4617a3['read']=!![];}return _0x83cd99[_0x369e('0x17')](_0x4617a3);}else{return logger['error'](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x56'),util[_0x369e('0x28')](_0x1f572c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1b9c8a){return logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x56'),util[_0x369e('0x28')](_0x1b9c8a,{'showHidden':![],'depth':null}));});}else{logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x369e('0x2a'),_0x369e('0x56'),_0x369e('0x3c'));}break;case _0x369e('0x5c'):var _0x3e0c30=require(_0x369e('0x5d'));if(_0xed3089['apiKey']){var _0x53a64c={};_0x53a64c[_0x369e('0x5e')]=_0xed3089[_0x369e('0x2e')];_0x53a64c[_0x369e('0x1e')]=_0x25e2d0[_0x369e('0x1e')];_0x53a64c[_0x369e('0x31')]=_0xed3089[_0x369e('0x1e')];_0x53a64c[_0x369e('0x5f')]=_0x25e2d0[_0x369e('0x22')];_0x53a64c[_0x369e('0x60')]=+new Date();var _0x35f180='';var _0xe5abfb='';var _0xfd7f7d=Object[_0x369e('0x61')](_0x53a64c);_0xfd7f7d[_0x369e('0x62')]();for(var _0x4fc215=0x0;_0x4fc215<_0xfd7f7d[_0x369e('0x63')];_0x4fc215++){if(_0x35f180!=''){_0x35f180+='&';}_0x35f180+=_0xfd7f7d[_0x4fc215]+'='+encodeURIComponent(_0x53a64c[_0xfd7f7d[_0x4fc215]]);_0xe5abfb+=_0x53a64c[_0xfd7f7d[_0x4fc215]];}_0xe5abfb+=_0xed3089['apiKey'];_0xe5abfb=_0x3e0c30['createHash'](_0x369e('0x64'))[_0x369e('0x17')](_0xe5abfb)[_0x369e('0x65')](_0x369e('0x66'));if(_0x35f180!==''){_0x35f180+='&';}_0x35f180+=_0x369e('0x67')+_0xe5abfb;var _0x32db4b={'method':_0x369e('0x34'),'uri':_0xed3089[_0x369e('0x58')]+'/external/get/send.php?'+_0x35f180,'json':!![]};return rp(_0x32db4b)[_0x369e('0x16')](function(_0x168a25){var _0x1a3bbe=Object[_0x369e('0x61')](_0x168a25);if(_0x168a25[_0x1a3bbe[0x0]][_0x369e('0x29')]&&parseInt(_0x168a25[_0x1a3bbe[0x0]]['error'])===0x0){var _0x1c13a8={'messageId':_0x168a25[_0x1a3bbe[0x0]][_0x369e('0x68')]};if(!_0xed3089[_0x369e('0x3a')]){_0x1c13a8[_0x369e('0x3b')]=!![];}return _0x83cd99[_0x369e('0x17')](_0x1c13a8);}else{return logger['error'](_0x369e('0x27'),'afterCreate',_0x369e('0x5c'),util[_0x369e('0x28')](_0x168a25[_0x369e('0x29')],{'showHidden':![],'depth':null}));}})[_0x369e('0x18')](function(_0x41f368){return logger[_0x369e('0x29')](_0x369e('0x27'),'afterCreate',_0x369e('0x5c'),util['inspect'](_0x41f368,{'showHidden':![],'depth':null}));});}else{logger[_0x369e('0x29')](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x5c'),_0x369e('0x69'));}break;case _0x369e('0x6a'):if(_0xed3089[_0x369e('0x6b')]){var _0x1341bd={'method':'POST','uri':_0x369e('0x6c'),'headers':{'Authorization':_0xed3089[_0x369e('0x6b')]},'body':{'content':_0x25e2d0[_0x369e('0x22')],'to':[_0x25e2d0[_0x369e('0x1e')]],'from':_0xed3089[_0x369e('0x1e')],'binary':![],'clientMessageId':'uuid','charset':_0x369e('0x6d')},'json':!![]};rp(_0x1341bd)[_0x369e('0x16')](function(_0x186eec){if(!_0x186eec['error']){var _0x581c76={'messageId':_0x186eec['messages'][0x0][_0x369e('0x6e')]};if(!_0xed3089[_0x369e('0x3a')]){_0x581c76['read']=!![];}return _0x83cd99['update'](_0x581c76);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x369e('0x2a'),_0x369e('0x6a'),util[_0x369e('0x28')](_0x186eec['error'],{'showHidden':![],'depth':null}));}})[_0x369e('0x18')](function(_0x2736b2){return logger['error'](_0x369e('0x27'),_0x369e('0x2a'),'clickatell',util[_0x369e('0x28')](_0x2736b2,{'showHidden':![],'depth':null}));});}else{logger[_0x369e('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x369e('0x2a'),_0x369e('0x6a'),_0x369e('0x69'));}break;case _0x369e('0x6f'):if(_0xed3089[_0x369e('0x6b')]){var _0x5ddde8={};var _0x32db4b={'method':_0x369e('0x3f'),'uri':_0x369e('0x70'),'headers':{'Authorization':_0x369e('0x71')+_0xed3089[_0x369e('0x6b')],'Content-Type':_0x369e('0x5a')},'body':{'from':_0xed3089[_0x369e('0x1e')],'to':_0x25e2d0[_0x369e('0x1e')],'text':_0x25e2d0[_0x369e('0x22')]},'json':!![]};return rp(_0x32db4b)[_0x369e('0x16')](function(_0x2a72cd){if(_0x2a72cd[_0x369e('0x72')]==0xca){_0x5ddde8['message']=_0x2a72cd;var _0x345ebf={'method':_0x369e('0x3f'),'uri':_0x369e('0x73'),'headers':{'Authorization':_0x369e('0x71')+_0xed3089[_0x369e('0x6b')],'Content-Type':_0x369e('0x5a')},'body':{'refid':_0x5ddde8[_0x369e('0x74')][_0x369e('0x75')]},'json':!![]};return rp(_0x345ebf)[_0x369e('0x16')](function(_0x69a542){_0x5ddde8['status']=_0x69a542;var _0x58ac1c={'messageId':_0x5ddde8[_0x369e('0x74')]['refid'],'read':!![]};return _0x83cd99[_0x369e('0x17')](_0x58ac1c);});}else{return logger['error'](_0x369e('0x27'),_0x369e('0x2a'),_0x369e('0x6f'),util[_0x369e('0x28')](_0x2a72cd,{'showHidden':![],'depth':null}));}})[_0x369e('0x18')](function(_0x314745){return logger['error'](_0x369e('0x27'),'afterCreate',_0x369e('0x6f'),util['inspect'](_0x314745,{'showHidden':![],'depth':null}));});}else{return logger[_0x369e('0x29')](_0x369e('0x27'),'afterCreate',_0x369e('0x6f'),_0x369e('0x76'));}break;}}})['finally'](function(){_0x22a28e();});}else{_0x22a28e();}}},'charset':'utf8mb4','collate':_0x369e('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index efefcb5..a7c91b2 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 _0x5f66=['stringify','error','code','message','info','result','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2d9011,_0x61a96f){var _0x17cc50=function(_0x455fd3){while(--_0x455fd3){_0x2d9011['push'](_0x2d9011['shift']());}};_0x17cc50(++_0x61a96f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateSmsMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateSmsMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x57ca=['jayson/promise','client','http','redis','defaults','localhost','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','then','info','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x57ca,0x108));var _0xa57c=function(_0x6a4c6,_0x10d866){_0x6a4c6=_0x6a4c6-0x0;var _0x2d89b7=_0x57ca[_0x6a4c6];return _0x2d89b7;};'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});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./smsMessage.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}exports['CreateSmsMessage']=function(_0x8a8856){var _0x4a53ab=this;return new Promise(function(_0x4a35bb,_0x418415){return db[_0xa57c('0x19')][_0xa57c('0x1a')](_0x8a8856[_0xa57c('0x1b')],{'raw':_0x8a8856['options']?_0x8a8856[_0xa57c('0x1c')][_0xa57c('0x1d')]===undefined?!![]:![]:!![]})[_0xa57c('0x1e')](function(_0x2213b2){logger[_0xa57c('0x1f')](_0xa57c('0x20'),_0x8a8856);logger[_0xa57c('0x12')](_0xa57c('0x20'),_0x8a8856,JSON[_0xa57c('0x21')](_0x2213b2));_0x4a35bb(_0x2213b2);})[_0xa57c('0x18')](function(_0x382a26){logger[_0xa57c('0x14')](_0xa57c('0x20'),_0x382a26[_0xa57c('0x16')],_0x8a8856);_0x418415(_0x4a53ab[_0xa57c('0x14')](0x1f4,_0x382a26['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ce00479..fa4ef97 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 _0x3954=['save','remove','update','emit','smsMessage:'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3954,0xa0));var _0x4395=function(_0x15a27b,_0x293cb9){_0x15a27b=_0x15a27b-0x0;var _0x1e11f0=_0x3954[_0x15a27b];return _0x1e11f0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x4395('0x0'),_0x4395('0x1'),_0x4395('0x2')];function createListener(_0x12ad4b,_0x568f4a){return function(_0x3f263a){_0x568f4a[_0x4395('0x3')](_0x12ad4b,_0x3f263a);};}function removeListener(_0x8c657e,_0x5551b){return function(){SmsMessageEvents['removeListener'](_0x8c657e,_0x5551b);};}exports['register']=function(_0x59ac44){for(var _0x13075f=0x0,_0x3c1fc7=events['length'];_0x13075f<_0x3c1fc7;_0x13075f++){var _0x11d9e0=events[_0x13075f];var _0x5a430d=createListener(_0x4395('0x4')+_0x11d9e0,_0x59ac44);SmsMessageEvents['on'](_0x11d9e0,_0x5a430d);}}; \ No newline at end of file +var _0xe734=['update','removeListener','register','save','remove'];(function(_0x135d6e,_0x25eee2){var _0x5b07b0=function(_0x4e7587){while(--_0x4e7587){_0x135d6e['push'](_0x135d6e['shift']());}};_0x5b07b0(++_0x25eee2);}(_0xe734,0xf8));var _0x4e73=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe734[_0x87b0ff];return _0x3bc0b2;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x4e73('0x0'),_0x4e73('0x1'),_0x4e73('0x2')];function createListener(_0x53dada,_0x414dc7){return function(_0x5016ee){_0x414dc7['emit'](_0x53dada,_0x5016ee);};}function removeListener(_0x3817e7,_0x43790e){return function(){SmsMessageEvents[_0x4e73('0x3')](_0x3817e7,_0x43790e);};}exports[_0x4e73('0x4')]=function(_0x13a977){for(var _0xff28d7=0x0,_0x1f520e=events['length'];_0xff28d7<_0x1f520e;_0xff28d7++){var _0x20bac4=events[_0xff28d7];var _0x530f56=createListener('smsMessage:'+_0x20bac4,_0x13a977);SmsMessageEvents['on'](_0x20bac4,_0x530f56);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a87e831..300a788 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 _0x2f2e=['removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete'];(function(_0xec666f,_0x3ad454){var _0x3f3f93=function(_0x2c37f2){while(--_0x2c37f2){_0xec666f['push'](_0xec666f['shift']());}};_0x3f3f93(++_0x3ad454);}(_0x2f2e,0x146));var _0xe2f2=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x2f2e[_0x3f4dd9];return _0x31c54a;};'use strict';var multer=require('multer');var util=require(_0xe2f2('0x0'));var path=require(_0xe2f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2f2('0x2'));var router=express['Router']();var auth=require(_0xe2f2('0x3'));var interaction=require(_0xe2f2('0x4'));var config=require(_0xe2f2('0x5'));var controller=require(_0xe2f2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe2f2('0x7')](_0xe2f2('0x8'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe2f2('0xb')]);router['get'](_0xe2f2('0xc'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0xd')]);router[_0xe2f2('0x7')]('/:id/teams',auth[_0xe2f2('0x9')](),controller[_0xe2f2('0xe')]);router['get'](_0xe2f2('0xf'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0x10')]);router[_0xe2f2('0x11')]('/',auth[_0xe2f2('0x9')](),controller[_0xe2f2('0x12')]);router[_0xe2f2('0x11')](_0xe2f2('0x13'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0x14')]);router['post'](_0xe2f2('0xf'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0x15')]);router[_0xe2f2('0x16')](_0xe2f2('0x17'),auth['isAuthenticated'](),controller['update']);router[_0xe2f2('0x18')](_0xe2f2('0x17'),auth[_0xe2f2('0x9')](),controller['destroy']);router[_0xe2f2('0x18')](_0xe2f2('0x13'),auth[_0xe2f2('0x9')](),controller['removeTeams']);router[_0xe2f2('0x18')](_0xe2f2('0xf'),auth[_0xe2f2('0x9')](),controller[_0xe2f2('0x19')]);module[_0xe2f2('0x1a')]=router; \ No newline at end of file +var _0x94ba=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','index','get','/describe','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents'];(function(_0x26ba36,_0x1d28da){var _0x2289bb=function(_0xa12b72){while(--_0xa12b72){_0x26ba36['push'](_0x26ba36['shift']());}};_0x2289bb(++_0x1d28da);}(_0x94ba,0xbe));var _0xa94b=function(_0x5b0fcc,_0x449df1){_0x5b0fcc=_0x5b0fcc-0x0;var _0x16eb1e=_0x94ba[_0x5b0fcc];return _0x16eb1e;};'use strict';var multer=require(_0xa94b('0x0'));var util=require(_0xa94b('0x1'));var path=require(_0xa94b('0x2'));var timeout=require(_0xa94b('0x3'));var express=require(_0xa94b('0x4'));var router=express['Router']();var auth=require(_0xa94b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa94b('0x6'));var controller=require(_0xa94b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa94b('0x8')]);router[_0xa94b('0x9')](_0xa94b('0xa'),auth[_0xa94b('0xb')](),controller['describe']);router[_0xa94b('0x9')](_0xa94b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa94b('0x9')](_0xa94b('0xd'),auth[_0xa94b('0xb')](),controller['getMembers']);router[_0xa94b('0x9')](_0xa94b('0xe'),auth[_0xa94b('0xb')](),controller[_0xa94b('0xf')]);router[_0xa94b('0x9')](_0xa94b('0x10'),auth['isAuthenticated'](),controller[_0xa94b('0x11')]);router[_0xa94b('0x12')]('/',auth[_0xa94b('0xb')](),controller[_0xa94b('0x13')]);router[_0xa94b('0x12')](_0xa94b('0xe'),auth[_0xa94b('0xb')](),controller[_0xa94b('0x14')]);router['post'](_0xa94b('0x10'),auth[_0xa94b('0xb')](),controller['addAgents']);router[_0xa94b('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa94b('0x16')](_0xa94b('0xc'),auth[_0xa94b('0xb')](),controller[_0xa94b('0x17')]);router[_0xa94b('0x16')](_0xa94b('0xe'),auth[_0xa94b('0xb')](),controller[_0xa94b('0x18')]);router[_0xa94b('0x16')](_0xa94b('0x10'),auth[_0xa94b('0xb')](),controller[_0xa94b('0x19')]);module[_0xa94b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 92d4626..b3bbb67 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 _0x6e3f=['INTEGER','rrmemory','beepall','roundrobin','sequelize','name','STRING'];(function(_0x2cc0fb,_0x2e7808){var _0x567fbd=function(_0x99341f){while(--_0x99341f){_0x2cc0fb['push'](_0x2cc0fb['shift']());}};_0x567fbd(++_0x2e7808);}(_0x6e3f,0x82));var _0xf6e3=function(_0x30ae82,_0x2c7e09){_0x30ae82=_0x30ae82-0x0;var _0x3c66f8=_0x6e3f[_0x30ae82];return _0x3c66f8;};'use strict';var Sequelize=require(_0xf6e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf6e3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf6e3('0x2')]},'timeout':{'type':Sequelize[_0xf6e3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf6e3('0x4'),_0xf6e3('0x5'),_0xf6e3('0x6'))}}; \ No newline at end of file +var _0x4470=['exports','STRING','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4315ef,_0x498bdc){var _0x3ba662=function(_0x5dac6a){while(--_0x5dac6a){_0x4315ef['push'](_0x4315ef['shift']());}};_0x3ba662(++_0x498bdc);}(_0x4470,0x1f0));var _0x0447=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x4470[_0xf91841];return _0x4b9c44;};'use strict';var Sequelize=require(_0x0447('0x0'));module[_0x0447('0x1')]={'name':{'type':Sequelize[_0x0447('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0447('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0447('0x3')](_0x0447('0x4'),_0x0447('0x5'),_0x0447('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6ac26c6..ab0c9e1 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 _0xea96=['updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','each','forEach','emit','userSmsQueue:save','ids','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','value','isEmpty','userSmsQueue:remove','addAgents','removeAgents','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','keys','rawAttributes','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','UserId','agent','smsPause'];(function(_0x3acbdc,_0x40f0bf){var _0x153070=function(_0x453330){while(--_0x453330){_0x3acbdc['push'](_0x3acbdc['shift']());}};_0x153070(++_0x40f0bf);}(_0xea96,0xb0));var _0x6ea9=function(_0x69b921,_0x9558b9){_0x69b921=_0x69b921-0x0;var _0x34e13c=_0xea96[_0x69b921];return _0x34e13c;};'use strict';var pdf=require(_0x6ea9('0x0'));var emlformat=require(_0x6ea9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ea9('0x2'));var jsonpatch=require(_0x6ea9('0x3'));var rp=require('request-promise');var moment=require(_0x6ea9('0x4'));var BPromise=require(_0x6ea9('0x5'));var Mustache=require('mustache');var util=require(_0x6ea9('0x6'));var path=require('path');var sox=require(_0x6ea9('0x7'));var csv=require('to-csv');var ejs=require(_0x6ea9('0x8'));var fs=require('fs');var _=require(_0x6ea9('0x9'));var squel=require(_0x6ea9('0xa'));var crypto=require(_0x6ea9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6ea9('0xc'));var toCsv=require(_0x6ea9('0xd'));var querystring=require(_0x6ea9('0xe'));var Papa=require(_0x6ea9('0xf'));var Redis=require(_0x6ea9('0x10'));var authService=require(_0x6ea9('0x11'));var qs=require(_0x6ea9('0x12'));var as=require(_0x6ea9('0x13'));var hardwareService=require(_0x6ea9('0x14'));var logger=require(_0x6ea9('0x15'))(_0x6ea9('0x16'));var utils=require(_0x6ea9('0x17'));var config=require(_0x6ea9('0x18'));var db=require(_0x6ea9('0x19'))['db'];config[_0x6ea9('0x1a')]=_[_0x6ea9('0x1b')](config['redis'],{'host':_0x6ea9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ea9('0x1d'))[_0x6ea9('0x1e')](socket);function respondWithStatusCode(_0x33dab6,_0x59a1d5){_0x59a1d5=_0x59a1d5||0xcc;return function(_0x48a67e){if(_0x48a67e){return _0x33dab6[_0x6ea9('0x1f')](_0x59a1d5);}return _0x33dab6['status'](_0x59a1d5)['end']();};}function respondWithResult(_0x546a21,_0x2e525a){_0x2e525a=_0x2e525a||0xc8;return function(_0x5b0a5f){if(_0x5b0a5f){return _0x546a21[_0x6ea9('0x20')](_0x2e525a)[_0x6ea9('0x21')](_0x5b0a5f);}};}function respondWithFilteredResult(_0x3485a2,_0x4d8339){return function(_0x3562e4){if(_0x3562e4){var _0x407693=_0x3562e4[_0x6ea9('0x22')],_0x2ea765=_0x4d8339[_0x6ea9('0x23')],_0x3073c9=_0x4d8339[_0x6ea9('0x23')]+_0x4d8339[_0x6ea9('0x24')],_0x1bb06d;if(_0x3073c9>=_0x407693){_0x3073c9=_0x407693;_0x1bb06d=0xc8;}else{_0x1bb06d=0xce;}_0x3485a2['status'](_0x1bb06d);return _0x3485a2[_0x6ea9('0x25')](_0x6ea9('0x26'),_0x2ea765+'-'+_0x3073c9+'/'+_0x407693)[_0x6ea9('0x21')](_0x3562e4);}return null;};}function patchUpdates(_0x487120){return function(_0xe2b0d3){try{jsonpatch[_0x6ea9('0x27')](_0xe2b0d3,_0x487120,!![]);}catch(_0x3894c5){return BPromise[_0x6ea9('0x28')](_0x3894c5);}return _0xe2b0d3[_0x6ea9('0x29')]();};}function saveUpdates(_0x330c4e,_0x5c47b9){return function(_0x43e756){if(_0x43e756){return _0x43e756[_0x6ea9('0x2a')](_0x330c4e)['then'](function(_0xdb178e){return _0xdb178e;});}return null;};}function removeEntity(_0x413168,_0x5ab016){return function(_0x5f59a5){if(_0x5f59a5){return _0x5f59a5[_0x6ea9('0x2b')]()[_0x6ea9('0x2c')](function(){var _0xdd6540=_0x5f59a5[_0x6ea9('0x2d')]({'plain':!![]});var _0x5327c8='SmsQueues';return db[_0x6ea9('0x2e')][_0x6ea9('0x2b')]({'where':{'type':_0x5327c8,'resourceId':_0xdd6540['id']}})[_0x6ea9('0x2c')](function(){return _0x5f59a5;});})[_0x6ea9('0x2c')](function(){_0x413168[_0x6ea9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196837,_0x4641e9){return function(_0x4a8890){if(!_0x4a8890){_0x196837[_0x6ea9('0x1f')](0x194);}return _0x4a8890;};}function handleError(_0xaae675,_0x5012fc){_0x5012fc=_0x5012fc||0x1f4;return function(_0x35da69){logger['error'](_0x35da69[_0x6ea9('0x2f')]);if(_0x35da69[_0x6ea9('0x30')]){delete _0x35da69[_0x6ea9('0x30')];}_0xaae675['status'](_0x5012fc)[_0x6ea9('0x31')](_0x35da69);};}exports[_0x6ea9('0x32')]=function(_0x359757,_0x1923d8){var _0x53a28d={},_0x2c35d3={},_0x28f9fc={'count':0x0,'rows':[]};var _0x150616=_[_0x6ea9('0x33')](db[_0x6ea9('0x34')]['rawAttributes'],function(_0x58eb0d){return{'name':_0x58eb0d[_0x6ea9('0x35')],'type':_0x58eb0d[_0x6ea9('0x36')][_0x6ea9('0x37')]};});_0x2c35d3[_0x6ea9('0x38')]=_[_0x6ea9('0x33')](_0x150616,_0x6ea9('0x30'));_0x2c35d3[_0x6ea9('0x39')]=_['keys'](_0x359757[_0x6ea9('0x39')]);_0x2c35d3[_0x6ea9('0x3a')]=_['intersection'](_0x2c35d3['model'],_0x2c35d3[_0x6ea9('0x39')]);_0x53a28d['attributes']=_[_0x6ea9('0x3b')](_0x2c35d3[_0x6ea9('0x38')],qs[_0x6ea9('0x3c')](_0x359757[_0x6ea9('0x39')]['fields']));_0x53a28d[_0x6ea9('0x3d')]=_0x53a28d[_0x6ea9('0x3d')][_0x6ea9('0x3e')]?_0x53a28d[_0x6ea9('0x3d')]:_0x2c35d3[_0x6ea9('0x38')];if(!_0x359757[_0x6ea9('0x39')][_0x6ea9('0x3f')](_0x6ea9('0x40'))){_0x53a28d['limit']=qs[_0x6ea9('0x24')](_0x359757[_0x6ea9('0x39')][_0x6ea9('0x24')]);_0x53a28d['offset']=qs['offset'](_0x359757[_0x6ea9('0x39')][_0x6ea9('0x23')]);}_0x53a28d[_0x6ea9('0x41')]=qs[_0x6ea9('0x42')](_0x359757[_0x6ea9('0x39')][_0x6ea9('0x42')]);_0x53a28d[_0x6ea9('0x43')]=qs['filters'](_[_0x6ea9('0x44')](_0x359757['query'],_0x2c35d3[_0x6ea9('0x3a')]),_0x150616);if(_0x359757[_0x6ea9('0x39')][_0x6ea9('0x45')]){_0x53a28d['where']=_['merge'](_0x53a28d[_0x6ea9('0x43')],{'$or':_[_0x6ea9('0x33')](_0x150616,function(_0x47cabf){if(_0x47cabf[_0x6ea9('0x36')]!==_0x6ea9('0x46')){var _0x3d4e90={};_0x3d4e90[_0x47cabf['name']]={'$like':'%'+_0x359757[_0x6ea9('0x39')][_0x6ea9('0x45')]+'%'};return _0x3d4e90;}})});}_0x53a28d=_[_0x6ea9('0x47')]({},_0x53a28d,_0x359757[_0x6ea9('0x48')]);var _0x282e24={'where':_0x53a28d[_0x6ea9('0x43')]};return db[_0x6ea9('0x34')]['count'](_0x282e24)['then'](function(_0x1959f0){_0x28f9fc[_0x6ea9('0x22')]=_0x1959f0;if(_0x359757[_0x6ea9('0x39')][_0x6ea9('0x49')]){_0x53a28d[_0x6ea9('0x4a')]=[{'all':!![]}];}return db[_0x6ea9('0x34')]['findAll'](_0x53a28d);})[_0x6ea9('0x2c')](function(_0x4280a2){_0x28f9fc[_0x6ea9('0x4b')]=_0x4280a2;return _0x28f9fc;})[_0x6ea9('0x2c')](respondWithFilteredResult(_0x1923d8,_0x53a28d))['catch'](handleError(_0x1923d8,null));};exports['show']=function(_0x378376,_0x3a1e99){var _0x52f3d2={'raw':!![],'where':{'id':_0x378376[_0x6ea9('0x4c')]['id']}},_0xc1ac1a={};_0xc1ac1a['model']=_[_0x6ea9('0x4d')](db['SmsQueue'][_0x6ea9('0x4e')]);_0xc1ac1a[_0x6ea9('0x39')]=_['keys'](_0x378376[_0x6ea9('0x39')]);_0xc1ac1a[_0x6ea9('0x3a')]=_[_0x6ea9('0x3b')](_0xc1ac1a['model'],_0xc1ac1a[_0x6ea9('0x39')]);_0x52f3d2[_0x6ea9('0x3d')]=_['intersection'](_0xc1ac1a[_0x6ea9('0x38')],qs[_0x6ea9('0x3c')](_0x378376[_0x6ea9('0x39')]['fields']));_0x52f3d2[_0x6ea9('0x3d')]=_0x52f3d2['attributes'][_0x6ea9('0x3e')]?_0x52f3d2[_0x6ea9('0x3d')]:_0xc1ac1a['model'];if(_0x378376[_0x6ea9('0x39')]['includeAll']){_0x52f3d2[_0x6ea9('0x4a')]=[{'all':!![]}];}_0x52f3d2=_[_0x6ea9('0x47')]({},_0x52f3d2,_0x378376['options']);return db['SmsQueue']['find'](_0x52f3d2)['then'](handleEntityNotFound(_0x3a1e99,null))[_0x6ea9('0x2c')](respondWithResult(_0x3a1e99,null))[_0x6ea9('0x4f')](handleError(_0x3a1e99,null));};exports[_0x6ea9('0x50')]=function(_0x2a1a80,_0x1607e1){return db[_0x6ea9('0x34')][_0x6ea9('0x50')](_0x2a1a80['body'],{})[_0x6ea9('0x2c')](function(_0x40899e){var _0x5983c4=_0x2a1a80['user'][_0x6ea9('0x2d')]({'plain':!![]});if(!_0x5983c4)throw new Error(_0x6ea9('0x51'));if(_0x5983c4[_0x6ea9('0x52')]===_0x6ea9('0x53')){var _0x50e6be=_0x40899e[_0x6ea9('0x2d')]({'plain':!![]});var _0x10ae61=_0x6ea9('0x54');return db['UserProfileSection'][_0x6ea9('0x55')]({'where':{'name':_0x10ae61,'userProfileId':_0x5983c4['userProfileId']},'raw':!![]})['then'](function(_0x35d1ce){if(_0x35d1ce&&_0x35d1ce[_0x6ea9('0x56')]===0x0){return db[_0x6ea9('0x2e')][_0x6ea9('0x50')]({'name':_0x50e6be[_0x6ea9('0x30')],'resourceId':_0x50e6be['id'],'type':_0x35d1ce['name'],'sectionId':_0x35d1ce['id']},{})[_0x6ea9('0x2c')](function(){return _0x40899e;});}else{return _0x40899e;}})['catch'](function(_0x508760){logger[_0x6ea9('0x57')](_0x6ea9('0x58'),_0x508760);throw _0x508760;});}return _0x40899e;})['then'](respondWithResult(_0x1607e1,0xc9))[_0x6ea9('0x4f')](handleError(_0x1607e1,null));};exports[_0x6ea9('0x2a')]=function(_0x3f71f0,_0x3f740b){if(_0x3f71f0[_0x6ea9('0x59')]['id']){delete _0x3f71f0[_0x6ea9('0x59')]['id'];}return db[_0x6ea9('0x34')]['find']({'where':{'id':_0x3f71f0[_0x6ea9('0x4c')]['id']}})[_0x6ea9('0x2c')](handleEntityNotFound(_0x3f740b,null))[_0x6ea9('0x2c')](saveUpdates(_0x3f71f0[_0x6ea9('0x59')],null))[_0x6ea9('0x2c')](respondWithResult(_0x3f740b,null))[_0x6ea9('0x4f')](handleError(_0x3f740b,null));};exports['destroy']=function(_0x4b963d,_0x192274){return db[_0x6ea9('0x34')][_0x6ea9('0x55')]({'where':{'id':_0x4b963d['params']['id']}})[_0x6ea9('0x2c')](handleEntityNotFound(_0x192274,null))['then'](removeEntity(_0x192274,null))['catch'](handleError(_0x192274,null));};exports[_0x6ea9('0x5a')]=function(_0x356041,_0x1ac9c6){return db['SmsQueue'][_0x6ea9('0x5a')]()[_0x6ea9('0x2c')](respondWithResult(_0x1ac9c6,null))[_0x6ea9('0x4f')](handleError(_0x1ac9c6,null));};exports[_0x6ea9('0x5b')]=function(_0x3cb0b9,_0x43bc2b,_0x213b04){var _0x37edcb={'raw':!![],'where':{}},_0x4504ac={},_0x151c87;return db[_0x6ea9('0x34')][_0x6ea9('0x5c')]({'where':{'id':_0x3cb0b9['params']['id']}})['then'](handleEntityNotFound(_0x43bc2b,null))['then'](function(_0x1fedec){if(_0x1fedec){_0x151c87=_0x1fedec['get']({'plain':!![]});_0x4504ac[_0x6ea9('0x38')]=_[_0x6ea9('0x4d')](db[_0x6ea9('0x5d')][_0x6ea9('0x4e')]);_0x4504ac['query']=_[_0x6ea9('0x4d')](_0x3cb0b9[_0x6ea9('0x39')]);_0x4504ac[_0x6ea9('0x3a')]=_[_0x6ea9('0x3b')](_0x4504ac[_0x6ea9('0x38')],_0x4504ac[_0x6ea9('0x39')]);_0x37edcb[_0x6ea9('0x3d')]=_[_0x6ea9('0x3b')](_0x4504ac['model'],qs[_0x6ea9('0x3c')](_0x3cb0b9[_0x6ea9('0x39')]['fields']));_0x37edcb['attributes']=_0x37edcb[_0x6ea9('0x3d')][_0x6ea9('0x3e')]?_0x37edcb[_0x6ea9('0x3d')]:_0x4504ac['model'];if(!_0x3cb0b9[_0x6ea9('0x39')][_0x6ea9('0x3f')](_0x6ea9('0x40'))){_0x37edcb[_0x6ea9('0x24')]=qs[_0x6ea9('0x24')](_0x3cb0b9['query']['limit']);_0x37edcb[_0x6ea9('0x23')]=qs[_0x6ea9('0x23')](_0x3cb0b9[_0x6ea9('0x39')][_0x6ea9('0x23')]);}_0x37edcb[_0x6ea9('0x41')]=qs[_0x6ea9('0x42')](_0x3cb0b9[_0x6ea9('0x39')]['sort']);_0x37edcb['where']=qs['filters'](_['pick'](_0x3cb0b9[_0x6ea9('0x39')],_0x4504ac[_0x6ea9('0x3a')]));_0x37edcb[_0x6ea9('0x43')][_0x6ea9('0x5e')]=_0x1fedec['id'];if(_0x3cb0b9['query']['filter']){_0x37edcb[_0x6ea9('0x43')]=_[_0x6ea9('0x47')](_0x37edcb[_0x6ea9('0x43')],{'$or':_[_0x6ea9('0x33')](_0x37edcb[_0x6ea9('0x3d')],function(_0x236954){var _0x179405={};_0x179405[_0x236954]={'$like':'%'+_0x3cb0b9[_0x6ea9('0x39')]['filter']+'%'};return _0x179405;})});}_0x37edcb=_[_0x6ea9('0x47')]({},_0x37edcb,_0x3cb0b9[_0x6ea9('0x48')]);return db[_0x6ea9('0x5d')][_0x6ea9('0x5f')](_0x37edcb);}})['then'](function(_0x2e258c){if(_0x2e258c){return db[_0x6ea9('0x60')]['findAndCountAll']({'where':{'id':_[_0x6ea9('0x33')](_0x2e258c,_0x6ea9('0x61')),'role':_0x6ea9('0x62')},'attributes':['id',_0x6ea9('0x30'),_0x6ea9('0x63'),_0x6ea9('0x64'),_0x6ea9('0x65')]});}})['then'](function(_0x15bdf8){if(_0x15bdf8){return{'count':_0x15bdf8[_0x6ea9('0x22')],'rows':_[_0x6ea9('0x33')](_0x15bdf8['rows'],function(_0x22f498){return{'membername':_0x22f498[_0x6ea9('0x30')],'UserId':_0x22f498['id'],'queue_name':_0x151c87[_0x6ea9('0x30')],'SmsQueueId':_0x151c87['id'],'interface':util[_0x6ea9('0x66')]('%s/%s',_0x6ea9('0x67'),_0x22f498[_0x6ea9('0x30')]),'penalty':0x0,'paused':_0x22f498['smsPause'],'createdAt':_0x22f498[_0x6ea9('0x65')],'updatedAt':_0x22f498[_0x6ea9('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ea9('0x2c')](respondWithFilteredResult(_0x43bc2b,_0x37edcb))[_0x6ea9('0x4f')](handleError(_0x43bc2b,null));};exports[_0x6ea9('0x68')]=function(_0x26265b,_0x3ebd7c,_0x224139){var _0x417da6={};var _0x3fb543={};var _0x47c6db;var _0x810306;return db[_0x6ea9('0x34')][_0x6ea9('0x5c')]({'where':{'id':_0x26265b['params']['id']}})[_0x6ea9('0x2c')](handleEntityNotFound(_0x3ebd7c,null))['then'](function(_0x3eab03){if(_0x3eab03){_0x47c6db=_0x3eab03;_0x3fb543['model']=_[_0x6ea9('0x4d')](db[_0x6ea9('0x69')]['rawAttributes']);_0x3fb543[_0x6ea9('0x39')]=_[_0x6ea9('0x4d')](_0x26265b[_0x6ea9('0x39')]);_0x3fb543[_0x6ea9('0x3a')]=_['intersection'](_0x3fb543[_0x6ea9('0x38')],_0x3fb543[_0x6ea9('0x39')]);_0x417da6[_0x6ea9('0x3d')]=_[_0x6ea9('0x3b')](_0x3fb543['model'],qs[_0x6ea9('0x3c')](_0x26265b[_0x6ea9('0x39')]['fields']));_0x417da6[_0x6ea9('0x3d')]=_0x417da6[_0x6ea9('0x3d')][_0x6ea9('0x3e')]?_0x417da6['attributes']:_0x3fb543[_0x6ea9('0x38')];_0x417da6['order']=qs[_0x6ea9('0x42')](_0x26265b[_0x6ea9('0x39')][_0x6ea9('0x42')]);_0x417da6[_0x6ea9('0x43')]=qs[_0x6ea9('0x3a')](_[_0x6ea9('0x44')](_0x26265b[_0x6ea9('0x39')],_0x3fb543[_0x6ea9('0x3a')]));if(_0x26265b[_0x6ea9('0x39')]['filter']){_0x417da6[_0x6ea9('0x43')]=_[_0x6ea9('0x47')](_0x417da6[_0x6ea9('0x43')],{'$or':_[_0x6ea9('0x33')](_0x417da6[_0x6ea9('0x3d')],function(_0x162ace){var _0x146579={};_0x146579[_0x162ace]={'$like':'%'+_0x26265b[_0x6ea9('0x39')][_0x6ea9('0x45')]+'%'};return _0x146579;})});}_0x417da6=_[_0x6ea9('0x47')]({},_0x417da6,_0x26265b[_0x6ea9('0x48')]);return _0x47c6db[_0x6ea9('0x68')](_0x417da6);}})['then'](function(_0x337160){if(_0x337160){_0x810306=_0x337160[_0x6ea9('0x3e')];if(!_0x26265b[_0x6ea9('0x39')][_0x6ea9('0x3f')](_0x6ea9('0x40'))){_0x417da6['limit']=qs[_0x6ea9('0x24')](_0x26265b['query'][_0x6ea9('0x24')]);_0x417da6[_0x6ea9('0x23')]=qs['offset'](_0x26265b['query'][_0x6ea9('0x23')]);}return _0x47c6db[_0x6ea9('0x68')](_0x417da6);}})[_0x6ea9('0x2c')](function(_0x22c93b){if(_0x22c93b){return _0x22c93b?{'count':_0x810306,'rows':_0x22c93b}:null;}})[_0x6ea9('0x2c')](respondWithResult(_0x3ebd7c,null))[_0x6ea9('0x4f')](handleError(_0x3ebd7c,null));};exports[_0x6ea9('0x6a')]=function(_0x9d822e,_0x5bcc3e,_0x59ddd5){var _0x273157=_0x9d822e[_0x6ea9('0x59')]['ids'];return db[_0x6ea9('0x69')]['findAll']({'where':{'id':_0x273157},'attributes':['id'],'include':[{'model':db[_0x6ea9('0x60')],'as':_0x6ea9('0x6b'),'attributes':['id',_0x6ea9('0x30'),_0x6ea9('0x6c'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x24e9ad){if(_0x24e9ad){var _0x1e6b0d=_[_0x6ea9('0x6d')](_0x24e9ad,function(_0x2fd258){var _0x1288e7=_0x2fd258[_0x6ea9('0x2d')]({'plain':!![]});return _0x1288e7[_0x6ea9('0x6b')];});return db[_0x6ea9('0x34')][_0x6ea9('0x55')]({'where':{'id':_0x9d822e['params']['id']}})[_0x6ea9('0x2c')](function(_0x5416f3){return db[_0x6ea9('0x6e')]['transaction'](function(_0x39cc11){return _0x5416f3['addTeams'](_0x273157,{'transaction':_0x39cc11})[_0x6ea9('0x2c')](function(){return BPromise[_0x6ea9('0x6f')](_0x1e6b0d,function(_0x438e0e){return db[_0x6ea9('0x5d')]['findOrCreate']({'where':{'UserId':_0x438e0e['id'],'SmsQueueId':_0x9d822e[_0x6ea9('0x4c')]['id']},'transaction':_0x39cc11});});})[_0x6ea9('0x2c')](function(){_0x1e6b0d[_0x6ea9('0x70')](function(_0x2d3b82){socket[_0x6ea9('0x71')](_0x6ea9('0x72'),{'UserId':_0x2d3b82['id'],'SmsQueueId':_0x5416f3['id']});});});});});}})[_0x6ea9('0x2c')](respondWithStatusCode(_0x5bcc3e,null))['catch'](handleError(_0x5bcc3e,null));};exports['removeTeams']=function(_0x2da0fd,_0x2e5775,_0x19fbbd){return db['Team']['findAll']({'where':{'id':_0x2da0fd[_0x6ea9('0x39')][_0x6ea9('0x73')]},'attributes':['id'],'include':[{'model':db[_0x6ea9('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6ea9('0x2c')](handleEntityNotFound(_0x2e5775,null))[_0x6ea9('0x2c')](function(_0x5caa7b){var _0x384780=_[_0x6ea9('0x33')](_0x5caa7b,'id');var _0x2617f0=[];var _0x1394d9=[];var _0x1c4c3f=squel[_0x6ea9('0x74')]();_0x1c4c3f[_0x6ea9('0x75')](_0x6ea9('0x76'))['from'](_0x6ea9('0x77'),'tq')[_0x6ea9('0x78')](_0x6ea9('0x79'),'ut',_0x6ea9('0x7a'))[_0x6ea9('0x43')]('SmsQueueId\x20=\x20?',_0x2da0fd[_0x6ea9('0x4c')]['id']);for(var _0x461eb6=0x0;_0x461eb6<_0x5caa7b[_0x6ea9('0x3e')];_0x461eb6+=0x1){let _0x2a610d=_0x5caa7b[_0x461eb6];for(var _0x36a1f5=0x0;_0x36a1f5<_0x2a610d[_0x6ea9('0x6b')][_0x6ea9('0x3e')];_0x36a1f5+=0x1){let _0x6ecb32=_0x2a610d[_0x6ea9('0x6b')][_0x36a1f5];var _0x1bc6c6=_0x1c4c3f[_0x6ea9('0x7b')]();_0x1bc6c6['where'](_0x6ea9('0x7c'),_0x6ecb32['id']);_0x1394d9[_0x6ea9('0x7d')](db['sequelize'][_0x6ea9('0x39')](_0x1bc6c6[_0x6ea9('0x7e')](),{'type':db[_0x6ea9('0x6e')][_0x6ea9('0x7f')][_0x6ea9('0x80')]})[_0x6ea9('0x2c')](function(_0x14fb37){if(_0x14fb37['length']===0x1){return _0x6ecb32['id'];}else{var _0x722c6a=_[_0x6ea9('0x81')](_[_0x6ea9('0x33')](_0x14fb37,'TeamId'),function(_0x4de410){return _['includes'](_0x384780,_0x4de410);});if(_0x722c6a){return _0x6ecb32['id'];}}}));}}return BPromise[_0x6ea9('0x82')](_0x1394d9)[_0x6ea9('0x2c')](function(_0x26b82f){_0x2617f0=_(_0x2617f0)[_0x6ea9('0x83')](_0x26b82f)['compact']()[_0x6ea9('0x84')]();return db['SmsQueue']['find']({'where':{'id':_0x2da0fd[_0x6ea9('0x4c')]['id']}})[_0x6ea9('0x2c')](function(_0x1401e7){return db[_0x6ea9('0x6e')]['transaction'](function(_0x50efe5){return _0x1401e7['removeTeams'](_0x2da0fd[_0x6ea9('0x39')][_0x6ea9('0x73')],{'transaction':_0x50efe5})['then'](function(){if(!_[_0x6ea9('0x85')](_0x2617f0)){return _0x1401e7['removeAgents'](_0x2617f0,{'transaction':_0x50efe5});}})[_0x6ea9('0x2c')](function(){_0x2617f0[_0x6ea9('0x70')](function(_0x389690){socket[_0x6ea9('0x71')](_0x6ea9('0x86'),{'UserId':_0x389690,'SmsQueueId':_0x1401e7['id']});});});});});});})[_0x6ea9('0x2c')](respondWithStatusCode(_0x2e5775,null))[_0x6ea9('0x4f')](handleError(_0x2e5775,null));};exports[_0x6ea9('0x87')]=function(_0x57338d,_0xa9f488,_0xc0653f){return db[_0x6ea9('0x34')]['find']({'where':{'id':_0x57338d[_0x6ea9('0x4c')]['id']}})[_0x6ea9('0x2c')](handleEntityNotFound(_0xa9f488,null))['then'](function(_0x14ce39){if(_0x14ce39){return _0x14ce39[_0x6ea9('0x87')](_0x57338d[_0x6ea9('0x59')][_0x6ea9('0x73')],_['omit'](_0x57338d[_0x6ea9('0x59')],[_0x6ea9('0x73'),'id'])||{})['spread'](function(_0x1ca960){for(var _0x5376fb=0x0;_0x5376fb<_0x57338d[_0x6ea9('0x59')][_0x6ea9('0x73')][_0x6ea9('0x3e')];_0x5376fb+=0x1){socket[_0x6ea9('0x71')](_0x6ea9('0x72'),{'UserId':_0x57338d[_0x6ea9('0x59')]['ids'][_0x5376fb],'SmsQueueId':_0x57338d[_0x6ea9('0x4c')]['id']});}return _0x1ca960;});}})['then'](respondWithResult(_0xa9f488,null))[_0x6ea9('0x4f')](handleError(_0xa9f488,null));};exports[_0x6ea9('0x88')]=function(_0x313757,_0x2e1583,_0x1a07fb){return db['SmsQueue']['find']({'where':{'id':_0x313757[_0x6ea9('0x4c')]['id']}})[_0x6ea9('0x2c')](handleEntityNotFound(_0x2e1583,null))[_0x6ea9('0x2c')](function(_0x182dc7){if(_0x182dc7){return _0x182dc7['removeAgents'](_0x313757[_0x6ea9('0x39')]['ids'])['then'](function(){if(_['isArray'](_0x313757[_0x6ea9('0x39')]['ids'])){for(var _0x1d70f0=0x0;_0x1d70f0<_0x313757[_0x6ea9('0x39')][_0x6ea9('0x73')][_0x6ea9('0x3e')];_0x1d70f0+=0x1){socket['emit'](_0x6ea9('0x86'),{'UserId':Number(_0x313757[_0x6ea9('0x39')]['ids'][_0x1d70f0]),'SmsQueueId':Number(_0x313757['params']['id'])});}}else{socket[_0x6ea9('0x71')](_0x6ea9('0x86'),{'UserId':Number(_0x313757[_0x6ea9('0x39')][_0x6ea9('0x73')]),'SmsQueueId':Number(_0x313757[_0x6ea9('0x4c')]['id'])});}});}})[_0x6ea9('0x2c')](respondWithStatusCode(_0x2e1583,null))[_0x6ea9('0x4f')](handleError(_0x2e1583,null));};exports[_0x6ea9('0x89')]=function(_0x43833e,_0x118cc8,_0x4ffc3a){var _0x1cf422={};var _0x72c149={};var _0x44595a;var _0x54c469;return db[_0x6ea9('0x34')][_0x6ea9('0x5c')]({'where':{'id':_0x43833e[_0x6ea9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x118cc8,null))[_0x6ea9('0x2c')](function(_0x271c5d){if(_0x271c5d){_0x44595a=_0x271c5d;_0x72c149[_0x6ea9('0x38')]=_[_0x6ea9('0x4d')](db[_0x6ea9('0x60')]['rawAttributes']);_0x72c149[_0x6ea9('0x39')]=_[_0x6ea9('0x4d')](_0x43833e[_0x6ea9('0x39')]);_0x72c149[_0x6ea9('0x3a')]=_[_0x6ea9('0x3b')](_0x72c149['model'],_0x72c149[_0x6ea9('0x39')]);_0x1cf422[_0x6ea9('0x3d')]=_[_0x6ea9('0x3b')](_0x72c149[_0x6ea9('0x38')],qs[_0x6ea9('0x3c')](_0x43833e[_0x6ea9('0x39')]['fields']));_0x1cf422[_0x6ea9('0x3d')]=_0x1cf422[_0x6ea9('0x3d')][_0x6ea9('0x3e')]?_0x1cf422[_0x6ea9('0x3d')]:_0x72c149[_0x6ea9('0x38')];_0x1cf422[_0x6ea9('0x41')]=qs['sort'](_0x43833e[_0x6ea9('0x39')]['sort']);_0x1cf422['where']=qs['filters'](_[_0x6ea9('0x44')](_0x43833e['query'],_0x72c149['filters']));if(_0x43833e[_0x6ea9('0x39')][_0x6ea9('0x45')]){_0x1cf422[_0x6ea9('0x43')]=_[_0x6ea9('0x47')](_0x1cf422[_0x6ea9('0x43')],{'$or':_[_0x6ea9('0x33')](_0x1cf422['attributes'],function(_0x1f3e79){var _0x287699={};_0x287699[_0x1f3e79]={'$like':'%'+_0x43833e[_0x6ea9('0x39')][_0x6ea9('0x45')]+'%'};return _0x287699;})});}_0x1cf422=_[_0x6ea9('0x47')]({},_0x1cf422,_0x43833e[_0x6ea9('0x48')]);return _0x44595a[_0x6ea9('0x89')](_0x1cf422);}})[_0x6ea9('0x2c')](function(_0x392de6){if(_0x392de6){_0x54c469=_0x392de6[_0x6ea9('0x3e')];if(!_0x43833e[_0x6ea9('0x39')]['hasOwnProperty'](_0x6ea9('0x40'))){_0x1cf422[_0x6ea9('0x24')]=qs['limit'](_0x43833e[_0x6ea9('0x39')][_0x6ea9('0x24')]);_0x1cf422['offset']=qs['offset'](_0x43833e[_0x6ea9('0x39')][_0x6ea9('0x23')]);}return _0x44595a['getAgents'](_0x1cf422);}})[_0x6ea9('0x2c')](function(_0x5aae71){if(_0x5aae71){return _0x5aae71?{'count':_0x54c469,'rows':_0x5aae71}:null;}})['then'](respondWithResult(_0x118cc8,null))['catch'](handleError(_0x118cc8,null));}; \ No newline at end of file +var _0x0880=['destroy','get','SmsQueues','UserProfileResource','name','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SmsQueue','includeAll','include','findAll','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','order','User','findAndCountAll','UserId','smsPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','voicePause','interface','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then'];(function(_0x48310d,_0x20f014){var _0x2be27a=function(_0x11a5cb){while(--_0x11a5cb){_0x48310d['push'](_0x48310d['shift']());}};_0x2be27a(++_0x20f014);}(_0x0880,0x16b));var _0x0088=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x0880[_0x21b706];return _0x13b94a;};'use strict';var pdf=require(_0x0088('0x0'));var emlformat=require(_0x0088('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0088('0x2'));var jsonpatch=require(_0x0088('0x3'));var rp=require(_0x0088('0x4'));var moment=require(_0x0088('0x5'));var BPromise=require(_0x0088('0x6'));var Mustache=require('mustache');var util=require(_0x0088('0x7'));var path=require(_0x0088('0x8'));var sox=require(_0x0088('0x9'));var csv=require(_0x0088('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0088('0xb'));var squel=require(_0x0088('0xc'));var crypto=require('crypto');var jsforce=require(_0x0088('0xd'));var deskjs=require(_0x0088('0xe'));var toCsv=require(_0x0088('0xa'));var querystring=require(_0x0088('0xf'));var Papa=require(_0x0088('0x10'));var Redis=require('ioredis');var authService=require(_0x0088('0x11'));var qs=require(_0x0088('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0088('0x13'))(_0x0088('0x14'));var utils=require('../../config/utils');var config=require(_0x0088('0x15'));var db=require('../../mysqldb')['db'];config[_0x0088('0x16')]=_[_0x0088('0x17')](config[_0x0088('0x16')],{'host':_0x0088('0x18'),'port':0x18eb});var socket=require(_0x0088('0x19'))(new Redis(config[_0x0088('0x16')]));require(_0x0088('0x1a'))['register'](socket);function respondWithStatusCode(_0x46f9b1,_0x702f77){_0x702f77=_0x702f77||0xcc;return function(_0x3797d1){if(_0x3797d1){return _0x46f9b1[_0x0088('0x1b')](_0x702f77);}return _0x46f9b1[_0x0088('0x1c')](_0x702f77)[_0x0088('0x1d')]();};}function respondWithResult(_0x4792a4,_0x27b5a8){_0x27b5a8=_0x27b5a8||0xc8;return function(_0x58dc87){if(_0x58dc87){return _0x4792a4['status'](_0x27b5a8)[_0x0088('0x1e')](_0x58dc87);}};}function respondWithFilteredResult(_0x25e2cd,_0x3d34a6){return function(_0xde1598){if(_0xde1598){var _0x34cf20=_0xde1598[_0x0088('0x1f')],_0x4d4ccb=_0x3d34a6[_0x0088('0x20')],_0x4eb2e7=_0x3d34a6[_0x0088('0x20')]+_0x3d34a6[_0x0088('0x21')],_0x59e13e;if(_0x4eb2e7>=_0x34cf20){_0x4eb2e7=_0x34cf20;_0x59e13e=0xc8;}else{_0x59e13e=0xce;}_0x25e2cd[_0x0088('0x1c')](_0x59e13e);return _0x25e2cd['set']('Content-Range',_0x4d4ccb+'-'+_0x4eb2e7+'/'+_0x34cf20)[_0x0088('0x1e')](_0xde1598);}return null;};}function patchUpdates(_0x27b361){return function(_0x3ee15c){try{jsonpatch[_0x0088('0x22')](_0x3ee15c,_0x27b361,!![]);}catch(_0x6971b5){return BPromise[_0x0088('0x23')](_0x6971b5);}return _0x3ee15c[_0x0088('0x24')]();};}function saveUpdates(_0x527c33,_0x2eb9fc){return function(_0x16a231){if(_0x16a231){return _0x16a231[_0x0088('0x25')](_0x527c33)[_0x0088('0x26')](function(_0x194f28){return _0x194f28;});}return null;};}function removeEntity(_0x10801a,_0x2a67df){return function(_0x307351){if(_0x307351){return _0x307351[_0x0088('0x27')]()[_0x0088('0x26')](function(){var _0x50a03f=_0x307351[_0x0088('0x28')]({'plain':!![]});var _0x212845=_0x0088('0x29');return db[_0x0088('0x2a')]['destroy']({'where':{'type':_0x212845,'resourceId':_0x50a03f['id']}})[_0x0088('0x26')](function(){return _0x307351;});})[_0x0088('0x26')](function(){_0x10801a[_0x0088('0x1c')](0xcc)[_0x0088('0x1d')]();});}};}function handleEntityNotFound(_0x5d4055,_0x58e103){return function(_0x4fc0e3){if(!_0x4fc0e3){_0x5d4055[_0x0088('0x1b')](0x194);}return _0x4fc0e3;};}function handleError(_0x410071,_0x2d1151){_0x2d1151=_0x2d1151||0x1f4;return function(_0x44cb6b){logger['error'](_0x44cb6b['stack']);if(_0x44cb6b[_0x0088('0x2b')]){delete _0x44cb6b[_0x0088('0x2b')];}_0x410071[_0x0088('0x1c')](_0x2d1151)['send'](_0x44cb6b);};}exports[_0x0088('0x2c')]=function(_0x1a529a,_0x2282ea){var _0x2224f0={},_0x2e3d43={},_0x16fd94={'count':0x0,'rows':[]};var _0x42bfa5=_[_0x0088('0x2d')](db['SmsQueue'][_0x0088('0x2e')],function(_0x3d15de){return{'name':_0x3d15de['fieldName'],'type':_0x3d15de['type'][_0x0088('0x2f')]};});_0x2e3d43[_0x0088('0x30')]=_[_0x0088('0x2d')](_0x42bfa5,'name');_0x2e3d43[_0x0088('0x31')]=_['keys'](_0x1a529a[_0x0088('0x31')]);_0x2e3d43[_0x0088('0x32')]=_[_0x0088('0x33')](_0x2e3d43[_0x0088('0x30')],_0x2e3d43[_0x0088('0x31')]);_0x2224f0[_0x0088('0x34')]=_[_0x0088('0x33')](_0x2e3d43[_0x0088('0x30')],qs[_0x0088('0x35')](_0x1a529a['query'][_0x0088('0x35')]));_0x2224f0[_0x0088('0x34')]=_0x2224f0['attributes']['length']?_0x2224f0[_0x0088('0x34')]:_0x2e3d43['model'];if(!_0x1a529a[_0x0088('0x31')]['hasOwnProperty'](_0x0088('0x36'))){_0x2224f0[_0x0088('0x21')]=qs['limit'](_0x1a529a[_0x0088('0x31')][_0x0088('0x21')]);_0x2224f0[_0x0088('0x20')]=qs[_0x0088('0x20')](_0x1a529a[_0x0088('0x31')]['offset']);}_0x2224f0['order']=qs[_0x0088('0x37')](_0x1a529a[_0x0088('0x31')]['sort']);_0x2224f0[_0x0088('0x38')]=qs['filters'](_[_0x0088('0x39')](_0x1a529a[_0x0088('0x31')],_0x2e3d43['filters']),_0x42bfa5);if(_0x1a529a[_0x0088('0x31')]['filter']){_0x2224f0['where']=_[_0x0088('0x3a')](_0x2224f0[_0x0088('0x38')],{'$or':_[_0x0088('0x2d')](_0x42bfa5,function(_0xea1169){if(_0xea1169['type']!==_0x0088('0x3b')){var _0xe517bf={};_0xe517bf[_0xea1169[_0x0088('0x2b')]]={'$like':'%'+_0x1a529a[_0x0088('0x31')][_0x0088('0x3c')]+'%'};return _0xe517bf;}})});}_0x2224f0=_[_0x0088('0x3a')]({},_0x2224f0,_0x1a529a[_0x0088('0x3d')]);var _0x555def={'where':_0x2224f0[_0x0088('0x38')]};return db[_0x0088('0x3e')][_0x0088('0x1f')](_0x555def)[_0x0088('0x26')](function(_0x2939c6){_0x16fd94[_0x0088('0x1f')]=_0x2939c6;if(_0x1a529a[_0x0088('0x31')][_0x0088('0x3f')]){_0x2224f0[_0x0088('0x40')]=[{'all':!![]}];}return db[_0x0088('0x3e')][_0x0088('0x41')](_0x2224f0);})[_0x0088('0x26')](function(_0x2b0840){_0x16fd94['rows']=_0x2b0840;return _0x16fd94;})[_0x0088('0x26')](respondWithFilteredResult(_0x2282ea,_0x2224f0))['catch'](handleError(_0x2282ea,null));};exports[_0x0088('0x42')]=function(_0x12ca39,_0x294c18){var _0x42b2ea={'raw':!![],'where':{'id':_0x12ca39[_0x0088('0x43')]['id']}},_0x1f3538={};_0x1f3538[_0x0088('0x30')]=_[_0x0088('0x44')](db[_0x0088('0x3e')][_0x0088('0x2e')]);_0x1f3538[_0x0088('0x31')]=_[_0x0088('0x44')](_0x12ca39[_0x0088('0x31')]);_0x1f3538[_0x0088('0x32')]=_[_0x0088('0x33')](_0x1f3538['model'],_0x1f3538[_0x0088('0x31')]);_0x42b2ea['attributes']=_[_0x0088('0x33')](_0x1f3538[_0x0088('0x30')],qs[_0x0088('0x35')](_0x12ca39[_0x0088('0x31')]['fields']));_0x42b2ea[_0x0088('0x34')]=_0x42b2ea['attributes'][_0x0088('0x45')]?_0x42b2ea[_0x0088('0x34')]:_0x1f3538['model'];if(_0x12ca39['query'][_0x0088('0x3f')]){_0x42b2ea[_0x0088('0x40')]=[{'all':!![]}];}_0x42b2ea=_['merge']({},_0x42b2ea,_0x12ca39[_0x0088('0x3d')]);return db[_0x0088('0x3e')][_0x0088('0x46')](_0x42b2ea)[_0x0088('0x26')](handleEntityNotFound(_0x294c18,null))[_0x0088('0x26')](respondWithResult(_0x294c18,null))['catch'](handleError(_0x294c18,null));};exports[_0x0088('0x47')]=function(_0xb441c6,_0x5a25cd){return db['SmsQueue']['create'](_0xb441c6[_0x0088('0x48')],{})['then'](function(_0x5664d1){var _0x4f80ba=_0xb441c6[_0x0088('0x49')]['get']({'plain':!![]});if(!_0x4f80ba)throw new Error(_0x0088('0x4a'));if(_0x4f80ba['role']===_0x0088('0x49')){var _0x1e8ae0=_0x5664d1[_0x0088('0x28')]({'plain':!![]});var _0x48ee8a=_0x0088('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x48ee8a,'userProfileId':_0x4f80ba[_0x0088('0x4b')]},'raw':!![]})[_0x0088('0x26')](function(_0x18708d){if(_0x18708d&&_0x18708d[_0x0088('0x4c')]===0x0){return db[_0x0088('0x2a')][_0x0088('0x47')]({'name':_0x1e8ae0['name'],'resourceId':_0x1e8ae0['id'],'type':_0x18708d['name'],'sectionId':_0x18708d['id']},{})['then'](function(){return _0x5664d1;});}else{return _0x5664d1;}})[_0x0088('0x4d')](function(_0x5e50ab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e50ab);throw _0x5e50ab;});}return _0x5664d1;})[_0x0088('0x26')](respondWithResult(_0x5a25cd,0xc9))[_0x0088('0x4d')](handleError(_0x5a25cd,null));};exports[_0x0088('0x25')]=function(_0x53fdc7,_0x138645){if(_0x53fdc7['body']['id']){delete _0x53fdc7[_0x0088('0x48')]['id'];}return db[_0x0088('0x3e')][_0x0088('0x46')]({'where':{'id':_0x53fdc7[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x138645,null))['then'](saveUpdates(_0x53fdc7['body'],null))['then'](respondWithResult(_0x138645,null))[_0x0088('0x4d')](handleError(_0x138645,null));};exports['destroy']=function(_0x48e640,_0x159cb0){return db[_0x0088('0x3e')][_0x0088('0x46')]({'where':{'id':_0x48e640[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x159cb0,null))[_0x0088('0x26')](removeEntity(_0x159cb0,null))[_0x0088('0x4d')](handleError(_0x159cb0,null));};exports[_0x0088('0x4e')]=function(_0x1c9b86,_0x53ecd5){return db[_0x0088('0x3e')][_0x0088('0x4e')]()[_0x0088('0x26')](respondWithResult(_0x53ecd5,null))[_0x0088('0x4d')](handleError(_0x53ecd5,null));};exports[_0x0088('0x4f')]=function(_0x39d042,_0x29bd57,_0x21400f){var _0x8adb05={'raw':!![],'where':{}},_0x51f19d={},_0x54e91f;return db[_0x0088('0x3e')][_0x0088('0x50')]({'where':{'id':_0x39d042[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x29bd57,null))['then'](function(_0x6bbac3){if(_0x6bbac3){_0x54e91f=_0x6bbac3['get']({'plain':!![]});_0x51f19d['model']=_[_0x0088('0x44')](db[_0x0088('0x51')]['rawAttributes']);_0x51f19d[_0x0088('0x31')]=_['keys'](_0x39d042[_0x0088('0x31')]);_0x51f19d[_0x0088('0x32')]=_[_0x0088('0x33')](_0x51f19d[_0x0088('0x30')],_0x51f19d['query']);_0x8adb05[_0x0088('0x34')]=_[_0x0088('0x33')](_0x51f19d[_0x0088('0x30')],qs[_0x0088('0x35')](_0x39d042[_0x0088('0x31')][_0x0088('0x35')]));_0x8adb05[_0x0088('0x34')]=_0x8adb05[_0x0088('0x34')][_0x0088('0x45')]?_0x8adb05[_0x0088('0x34')]:_0x51f19d['model'];if(!_0x39d042['query'][_0x0088('0x52')](_0x0088('0x36'))){_0x8adb05[_0x0088('0x21')]=qs[_0x0088('0x21')](_0x39d042[_0x0088('0x31')][_0x0088('0x21')]);_0x8adb05[_0x0088('0x20')]=qs[_0x0088('0x20')](_0x39d042[_0x0088('0x31')][_0x0088('0x20')]);}_0x8adb05[_0x0088('0x53')]=qs['sort'](_0x39d042[_0x0088('0x31')][_0x0088('0x37')]);_0x8adb05[_0x0088('0x38')]=qs[_0x0088('0x32')](_['pick'](_0x39d042[_0x0088('0x31')],_0x51f19d[_0x0088('0x32')]));_0x8adb05['where']['SmsQueueId']=_0x6bbac3['id'];if(_0x39d042['query']['filter']){_0x8adb05['where']=_[_0x0088('0x3a')](_0x8adb05[_0x0088('0x38')],{'$or':_['map'](_0x8adb05[_0x0088('0x34')],function(_0xafe83a){var _0x44d692={};_0x44d692[_0xafe83a]={'$like':'%'+_0x39d042[_0x0088('0x31')][_0x0088('0x3c')]+'%'};return _0x44d692;})});}_0x8adb05=_[_0x0088('0x3a')]({},_0x8adb05,_0x39d042[_0x0088('0x3d')]);return db['UserSmsQueue'][_0x0088('0x41')](_0x8adb05);}})[_0x0088('0x26')](function(_0x3429ab){if(_0x3429ab){return db[_0x0088('0x54')][_0x0088('0x55')]({'where':{'id':_[_0x0088('0x2d')](_0x3429ab,_0x0088('0x56')),'role':'agent'},'attributes':['id',_0x0088('0x2b'),_0x0088('0x57'),_0x0088('0x58'),'createdAt']});}})[_0x0088('0x26')](function(_0x3e88f9){if(_0x3e88f9){return{'count':_0x3e88f9[_0x0088('0x1f')],'rows':_[_0x0088('0x2d')](_0x3e88f9[_0x0088('0x59')],function(_0xb6e374){return{'membername':_0xb6e374['name'],'UserId':_0xb6e374['id'],'queue_name':_0x54e91f[_0x0088('0x2b')],'SmsQueueId':_0x54e91f['id'],'interface':util[_0x0088('0x5a')](_0x0088('0x5b'),_0x0088('0x5c'),_0xb6e374[_0x0088('0x2b')]),'penalty':0x0,'paused':_0xb6e374['smsPause'],'createdAt':_0xb6e374[_0x0088('0x5d')],'updatedAt':_0xb6e374['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0088('0x26')](respondWithFilteredResult(_0x29bd57,_0x8adb05))[_0x0088('0x4d')](handleError(_0x29bd57,null));};exports[_0x0088('0x5e')]=function(_0x523fa6,_0x5a2ac7,_0x7fddd6){var _0x1cc600={};var _0x476128={};var _0x56149a;var _0x52beb4;return db[_0x0088('0x3e')][_0x0088('0x50')]({'where':{'id':_0x523fa6[_0x0088('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a2ac7,null))[_0x0088('0x26')](function(_0x7f2972){if(_0x7f2972){_0x56149a=_0x7f2972;_0x476128['model']=_['keys'](db[_0x0088('0x5f')][_0x0088('0x2e')]);_0x476128[_0x0088('0x31')]=_[_0x0088('0x44')](_0x523fa6[_0x0088('0x31')]);_0x476128['filters']=_[_0x0088('0x33')](_0x476128[_0x0088('0x30')],_0x476128[_0x0088('0x31')]);_0x1cc600[_0x0088('0x34')]=_[_0x0088('0x33')](_0x476128[_0x0088('0x30')],qs[_0x0088('0x35')](_0x523fa6[_0x0088('0x31')][_0x0088('0x35')]));_0x1cc600[_0x0088('0x34')]=_0x1cc600['attributes'][_0x0088('0x45')]?_0x1cc600[_0x0088('0x34')]:_0x476128[_0x0088('0x30')];_0x1cc600[_0x0088('0x53')]=qs[_0x0088('0x37')](_0x523fa6[_0x0088('0x31')][_0x0088('0x37')]);_0x1cc600['where']=qs[_0x0088('0x32')](_[_0x0088('0x39')](_0x523fa6[_0x0088('0x31')],_0x476128[_0x0088('0x32')]));if(_0x523fa6[_0x0088('0x31')]['filter']){_0x1cc600[_0x0088('0x38')]=_[_0x0088('0x3a')](_0x1cc600['where'],{'$or':_[_0x0088('0x2d')](_0x1cc600[_0x0088('0x34')],function(_0x152031){var _0x6e0a60={};_0x6e0a60[_0x152031]={'$like':'%'+_0x523fa6['query'][_0x0088('0x3c')]+'%'};return _0x6e0a60;})});}_0x1cc600=_[_0x0088('0x3a')]({},_0x1cc600,_0x523fa6[_0x0088('0x3d')]);return _0x56149a[_0x0088('0x5e')](_0x1cc600);}})[_0x0088('0x26')](function(_0x189aa4){if(_0x189aa4){_0x52beb4=_0x189aa4[_0x0088('0x45')];if(!_0x523fa6['query']['hasOwnProperty']('nolimit')){_0x1cc600[_0x0088('0x21')]=qs[_0x0088('0x21')](_0x523fa6[_0x0088('0x31')][_0x0088('0x21')]);_0x1cc600[_0x0088('0x20')]=qs[_0x0088('0x20')](_0x523fa6[_0x0088('0x31')][_0x0088('0x20')]);}return _0x56149a[_0x0088('0x5e')](_0x1cc600);}})[_0x0088('0x26')](function(_0x241ec5){if(_0x241ec5){return _0x241ec5?{'count':_0x52beb4,'rows':_0x241ec5}:null;}})[_0x0088('0x26')](respondWithResult(_0x5a2ac7,null))[_0x0088('0x4d')](handleError(_0x5a2ac7,null));};exports[_0x0088('0x60')]=function(_0x190b9b,_0x4cb4c0,_0x55cf47){var _0x5f304a=_0x190b9b[_0x0088('0x48')][_0x0088('0x61')];return db[_0x0088('0x5f')][_0x0088('0x41')]({'where':{'id':_0x5f304a},'attributes':['id'],'include':[{'model':db[_0x0088('0x54')],'as':'Agents','attributes':['id',_0x0088('0x2b'),'online',_0x0088('0x62'),_0x0088('0x63')],'raw':!![]}]})['then'](function(_0x15cbab){if(_0x15cbab){var _0x2353bd=_['flatMap'](_0x15cbab,function(_0x53bde3){var _0x284d2e=_0x53bde3[_0x0088('0x28')]({'plain':!![]});return _0x284d2e[_0x0088('0x64')];});return db[_0x0088('0x3e')][_0x0088('0x46')]({'where':{'id':_0x190b9b['params']['id']}})[_0x0088('0x26')](function(_0x4c75a3){return db[_0x0088('0x65')]['transaction'](function(_0x5cb842){return _0x4c75a3[_0x0088('0x60')](_0x5f304a,{'transaction':_0x5cb842})[_0x0088('0x26')](function(){return BPromise[_0x0088('0x66')](_0x2353bd,function(_0x588de6){return db[_0x0088('0x51')][_0x0088('0x67')]({'where':{'UserId':_0x588de6['id'],'SmsQueueId':_0x190b9b[_0x0088('0x43')]['id']},'transaction':_0x5cb842});});})[_0x0088('0x26')](function(){_0x2353bd[_0x0088('0x68')](function(_0x1ae97f){socket[_0x0088('0x69')](_0x0088('0x6a'),{'UserId':_0x1ae97f['id'],'SmsQueueId':_0x4c75a3['id']});});});});});}})[_0x0088('0x26')](respondWithStatusCode(_0x4cb4c0,null))[_0x0088('0x4d')](handleError(_0x4cb4c0,null));};exports[_0x0088('0x6b')]=function(_0xd71449,_0x5981ec,_0x22a121){return db[_0x0088('0x5f')]['findAll']({'where':{'id':_0xd71449[_0x0088('0x31')][_0x0088('0x61')]},'attributes':['id'],'include':[{'model':db[_0x0088('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0088('0x26')](handleEntityNotFound(_0x5981ec,null))['then'](function(_0x1c1d6a){var _0x3bdb3c=_['map'](_0x1c1d6a,'id');var _0x280705=[];var _0x40ee58=[];var _0x1d5bcb=squel['select']();_0x1d5bcb[_0x0088('0x6c')](_0x0088('0x6d'))[_0x0088('0x6e')](_0x0088('0x6f'),'tq')[_0x0088('0x70')](_0x0088('0x71'),'ut',_0x0088('0x72'))[_0x0088('0x38')]('SmsQueueId\x20=\x20?',_0xd71449['params']['id']);for(var _0x12deb5=0x0;_0x12deb5<_0x1c1d6a['length'];_0x12deb5+=0x1){let _0x35ce1f=_0x1c1d6a[_0x12deb5];for(var _0x4627cb=0x0;_0x4627cb<_0x35ce1f[_0x0088('0x64')][_0x0088('0x45')];_0x4627cb+=0x1){let _0x494231=_0x35ce1f[_0x0088('0x64')][_0x4627cb];var _0x1981fc=_0x1d5bcb[_0x0088('0x73')]();_0x1981fc[_0x0088('0x38')](_0x0088('0x74'),_0x494231['id']);_0x40ee58[_0x0088('0x75')](db[_0x0088('0x65')][_0x0088('0x31')](_0x1981fc[_0x0088('0x76')](),{'type':db[_0x0088('0x65')][_0x0088('0x77')][_0x0088('0x78')]})[_0x0088('0x26')](function(_0x338b76){if(_0x338b76[_0x0088('0x45')]===0x1){return _0x494231['id'];}else{var _0x16c9a4=_[_0x0088('0x79')](_[_0x0088('0x2d')](_0x338b76,'TeamId'),function(_0x1e85fe){return _[_0x0088('0x7a')](_0x3bdb3c,_0x1e85fe);});if(_0x16c9a4){return _0x494231['id'];}}}));}}return BPromise[_0x0088('0x7b')](_0x40ee58)[_0x0088('0x26')](function(_0x3717eb){_0x280705=_(_0x280705)[_0x0088('0x7c')](_0x3717eb)[_0x0088('0x7d')]()['value']();return db['SmsQueue'][_0x0088('0x46')]({'where':{'id':_0xd71449[_0x0088('0x43')]['id']}})[_0x0088('0x26')](function(_0x65f49f){return db[_0x0088('0x65')][_0x0088('0x7e')](function(_0xdd0514){return _0x65f49f[_0x0088('0x6b')](_0xd71449[_0x0088('0x31')]['ids'],{'transaction':_0xdd0514})[_0x0088('0x26')](function(){if(!_[_0x0088('0x7f')](_0x280705)){return _0x65f49f[_0x0088('0x80')](_0x280705,{'transaction':_0xdd0514});}})['then'](function(){_0x280705['forEach'](function(_0x587473){socket[_0x0088('0x69')](_0x0088('0x81'),{'UserId':_0x587473,'SmsQueueId':_0x65f49f['id']});});});});});});})[_0x0088('0x26')](respondWithStatusCode(_0x5981ec,null))[_0x0088('0x4d')](handleError(_0x5981ec,null));};exports[_0x0088('0x82')]=function(_0x3cc835,_0x1014f5,_0x459622){return db[_0x0088('0x3e')]['find']({'where':{'id':_0x3cc835[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x1014f5,null))[_0x0088('0x26')](function(_0x25e647){if(_0x25e647){return _0x25e647[_0x0088('0x82')](_0x3cc835[_0x0088('0x48')]['ids'],_['omit'](_0x3cc835[_0x0088('0x48')],[_0x0088('0x61'),'id'])||{})[_0x0088('0x83')](function(_0x1b1627){for(var _0x1327e1=0x0;_0x1327e1<_0x3cc835['body'][_0x0088('0x61')][_0x0088('0x45')];_0x1327e1+=0x1){socket[_0x0088('0x69')](_0x0088('0x6a'),{'UserId':_0x3cc835['body'][_0x0088('0x61')][_0x1327e1],'SmsQueueId':_0x3cc835[_0x0088('0x43')]['id']});}return _0x1b1627;});}})['then'](respondWithResult(_0x1014f5,null))[_0x0088('0x4d')](handleError(_0x1014f5,null));};exports[_0x0088('0x80')]=function(_0x91a8f1,_0x3ea934,_0x132152){return db[_0x0088('0x3e')][_0x0088('0x46')]({'where':{'id':_0x91a8f1[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x3ea934,null))[_0x0088('0x26')](function(_0x53f37b){if(_0x53f37b){return _0x53f37b[_0x0088('0x80')](_0x91a8f1[_0x0088('0x31')]['ids'])[_0x0088('0x26')](function(){if(_[_0x0088('0x84')](_0x91a8f1[_0x0088('0x31')][_0x0088('0x61')])){for(var _0x78fdd9=0x0;_0x78fdd9<_0x91a8f1[_0x0088('0x31')][_0x0088('0x61')][_0x0088('0x45')];_0x78fdd9+=0x1){socket['emit'](_0x0088('0x81'),{'UserId':Number(_0x91a8f1[_0x0088('0x31')][_0x0088('0x61')][_0x78fdd9]),'SmsQueueId':Number(_0x91a8f1[_0x0088('0x43')]['id'])});}}else{socket[_0x0088('0x69')](_0x0088('0x81'),{'UserId':Number(_0x91a8f1[_0x0088('0x31')][_0x0088('0x61')]),'SmsQueueId':Number(_0x91a8f1[_0x0088('0x43')]['id'])});}});}})[_0x0088('0x26')](respondWithStatusCode(_0x3ea934,null))['catch'](handleError(_0x3ea934,null));};exports[_0x0088('0x85')]=function(_0x121ccd,_0x53580c,_0x40e3a5){var _0x586d3e={};var _0x346d33={};var _0x4c6d21;var _0x1d67ab;return db[_0x0088('0x3e')][_0x0088('0x50')]({'where':{'id':_0x121ccd[_0x0088('0x43')]['id']}})[_0x0088('0x26')](handleEntityNotFound(_0x53580c,null))[_0x0088('0x26')](function(_0xe0168a){if(_0xe0168a){_0x4c6d21=_0xe0168a;_0x346d33['model']=_[_0x0088('0x44')](db[_0x0088('0x54')]['rawAttributes']);_0x346d33['query']=_[_0x0088('0x44')](_0x121ccd[_0x0088('0x31')]);_0x346d33[_0x0088('0x32')]=_[_0x0088('0x33')](_0x346d33[_0x0088('0x30')],_0x346d33['query']);_0x586d3e[_0x0088('0x34')]=_[_0x0088('0x33')](_0x346d33[_0x0088('0x30')],qs[_0x0088('0x35')](_0x121ccd[_0x0088('0x31')]['fields']));_0x586d3e[_0x0088('0x34')]=_0x586d3e[_0x0088('0x34')][_0x0088('0x45')]?_0x586d3e[_0x0088('0x34')]:_0x346d33[_0x0088('0x30')];_0x586d3e[_0x0088('0x53')]=qs['sort'](_0x121ccd[_0x0088('0x31')][_0x0088('0x37')]);_0x586d3e[_0x0088('0x38')]=qs['filters'](_['pick'](_0x121ccd[_0x0088('0x31')],_0x346d33[_0x0088('0x32')]));if(_0x121ccd['query'][_0x0088('0x3c')]){_0x586d3e[_0x0088('0x38')]=_[_0x0088('0x3a')](_0x586d3e['where'],{'$or':_[_0x0088('0x2d')](_0x586d3e[_0x0088('0x34')],function(_0x440185){var _0x1061b7={};_0x1061b7[_0x440185]={'$like':'%'+_0x121ccd[_0x0088('0x31')]['filter']+'%'};return _0x1061b7;})});}_0x586d3e=_[_0x0088('0x3a')]({},_0x586d3e,_0x121ccd[_0x0088('0x3d')]);return _0x4c6d21[_0x0088('0x85')](_0x586d3e);}})[_0x0088('0x26')](function(_0x39dd16){if(_0x39dd16){_0x1d67ab=_0x39dd16[_0x0088('0x45')];if(!_0x121ccd[_0x0088('0x31')][_0x0088('0x52')](_0x0088('0x36'))){_0x586d3e[_0x0088('0x21')]=qs[_0x0088('0x21')](_0x121ccd[_0x0088('0x31')]['limit']);_0x586d3e[_0x0088('0x20')]=qs[_0x0088('0x20')](_0x121ccd[_0x0088('0x31')][_0x0088('0x20')]);}return _0x4c6d21[_0x0088('0x85')](_0x586d3e);}})[_0x0088('0x26')](function(_0x3ea8cf){if(_0x3ea8cf){return _0x3ea8cf?{'count':_0x1d67ab,'rows':_0x3ea8cf}:null;}})[_0x0088('0x26')](respondWithResult(_0x53580c,null))[_0x0088('0x4d')](handleError(_0x53580c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8ad5257..1e52098 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 _0xfa22=['emit','hasOwnProperty','hook','exports','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x5e0102,_0x147dae){var _0x2e8780=function(_0x3a1490){while(--_0x3a1490){_0x5e0102['push'](_0x5e0102['shift']());}};_0x2e8780(++_0x147dae);}(_0xfa22,0x109));var _0x2fa2=function(_0x22d5eb,_0x22ff67){_0x22d5eb=_0x22d5eb-0x0;var _0x2a3baf=_0xfa22[_0x22d5eb];return _0x2a3baf;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x2fa2('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2fa2('0x1')](0x0);var events={'afterCreate':_0x2fa2('0x2'),'afterUpdate':_0x2fa2('0x3'),'afterDestroy':_0x2fa2('0x4')};function emitEvent(_0x5b7c90){return function(_0x25846b,_0x3f9479,_0x220af2){SmsQueueEvents[_0x2fa2('0x5')](_0x5b7c90+':'+_0x25846b['id'],_0x25846b);SmsQueueEvents['emit'](_0x5b7c90,_0x25846b);_0x220af2(null);};}for(var e in events){if(events[_0x2fa2('0x6')](e)){var event=events[e];SmsQueue[_0x2fa2('0x7')](e,emitEvent(event));}}module[_0x2fa2('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd440=['events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1cd376,_0x36226d){var _0x334bfd=function(_0x24b267){while(--_0x24b267){_0x1cd376['push'](_0x1cd376['shift']());}};_0x334bfd(++_0x36226d);}(_0xd440,0x7e));var _0x0d44=function(_0x480557,_0x5643d9){_0x480557=_0x480557-0x0;var _0xbece52=_0xd440[_0x480557];return _0xbece52;};'use strict';var EventEmitter=require(_0x0d44('0x0'));var SmsQueue=require(_0x0d44('0x1'))['db'][_0x0d44('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0d44('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d44('0x4'),'afterDestroy':_0x0d44('0x5')};function emitEvent(_0x292179){return function(_0x124cd0,_0x17816a,_0x535351){SmsQueueEvents[_0x0d44('0x6')](_0x292179+':'+_0x124cd0['id'],_0x124cd0);SmsQueueEvents[_0x0d44('0x6')](_0x292179,_0x124cd0);_0x535351(null);};}for(var e in events){if(events[_0x0d44('0x7')](e)){var event=events[e];SmsQueue[_0x0d44('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9d5ecbc..41ba773 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 _0x3c7b=['../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5dd683,_0xab981e){var _0x24758c=function(_0x373c79){while(--_0x373c79){_0x5dd683['push'](_0x5dd683['shift']());}};_0x24758c(++_0xab981e);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x48baf7,_0x5d682b){_0x48baf7=_0x48baf7-0x0;var _0x45b1b5=_0x3c7b[_0x48baf7];return _0x45b1b5;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5c=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','rimraf','exports'];(function(_0x1b0b0c,_0x184487){var _0x1b10b3=function(_0x5002d7){while(--_0x5002d7){_0x1b0b0c['push'](_0x1b0b0c['shift']());}};_0x1b10b3(++_0x184487);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x5e4926,_0x52d7b3){_0x5e4926=_0x5e4926-0x0;var _0x288e6c=_0xaa5c[_0x5e4926];return _0x288e6c;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var logger=require(_0xcaa5('0x2'))(_0xcaa5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa5('0x4'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xcaa5('0x5')]=function(_0x42afd4,_0x1877d0){return _0x42afd4['define'](_0xcaa5('0x6'),attributes,{'tableName':_0xcaa5('0x7'),'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 3a2c6fd..2923e4b 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 _0xaf84=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','include','map','model','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19e277,_0x18e743){var _0x4e315a=function(_0xa10cbd){while(--_0xa10cbd){_0x19e277['push'](_0x19e277['shift']());}};_0x4e315a(++_0x18e743);}(_0xaf84,0x1a8));var _0x4af8=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0xaf84[_0x42d2af];return _0x1d6d63;};'use strict';var _=require(_0x4af8('0x0'));var util=require('util');var moment=require(_0x4af8('0x1'));var BPromise=require(_0x4af8('0x2'));var rs=require(_0x4af8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4af8('0x4'))['db'];var utils=require(_0x4af8('0x5'));var logger=require(_0x4af8('0x6'))('rpc');var config=require(_0x4af8('0x7'));var jayson=require(_0x4af8('0x8'));var client=jayson['client'][_0x4af8('0x9')]({'port':0x232a});config[_0x4af8('0xa')]=_['defaults'](config['redis'],{'host':_0x4af8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4af8('0xa')]));require(_0x4af8('0xc'))[_0x4af8('0xd')](socket);function respondWithRpcPromise(_0x223055,_0x3c12a6,_0x51ac2c){return new BPromise(function(_0x53db8a,_0x3c0175){return client[_0x4af8('0xe')](_0x223055,_0x51ac2c)[_0x4af8('0xf')](function(_0x29fcdc){logger[_0x4af8('0x10')](_0x4af8('0x11'),_0x3c12a6,_0x4af8('0x12'));logger[_0x4af8('0x13')](_0x4af8('0x14'),_0x3c12a6,_0x4af8('0x12'),JSON[_0x4af8('0x15')](_0x29fcdc));if(_0x29fcdc[_0x4af8('0x16')]){if(_0x29fcdc[_0x4af8('0x16')][_0x4af8('0x17')]===0x1f4){logger[_0x4af8('0x16')](_0x4af8('0x11'),_0x3c12a6,_0x29fcdc[_0x4af8('0x16')]['message']);return _0x3c0175(_0x29fcdc[_0x4af8('0x16')][_0x4af8('0x18')]);}logger[_0x4af8('0x16')](_0x4af8('0x11'),_0x3c12a6,_0x29fcdc[_0x4af8('0x16')]['message']);return _0x53db8a(_0x29fcdc[_0x4af8('0x16')][_0x4af8('0x18')]);}else{logger[_0x4af8('0x10')](_0x4af8('0x11'),_0x3c12a6,'request\x20sent');_0x53db8a(_0x29fcdc[_0x4af8('0x19')][_0x4af8('0x18')]);}})[_0x4af8('0x1a')](function(_0x208abb){logger['error'](_0x4af8('0x11'),_0x3c12a6,_0x208abb);_0x3c0175(_0x208abb);});});}exports[_0x4af8('0x1b')]=function(_0x5b544d){var _0x34eca1=this;return new Promise(function(_0x2e71c3,_0x5d1d59){return db[_0x4af8('0x1c')][_0x4af8('0x1d')]({'raw':_0x5b544d[_0x4af8('0x1e')]?_0x5b544d[_0x4af8('0x1e')][_0x4af8('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b544d['options']?_0x5b544d[_0x4af8('0x1e')]['where']||null:null,'attributes':_0x5b544d[_0x4af8('0x1e')]?_0x5b544d[_0x4af8('0x1e')][_0x4af8('0x20')]||null:null,'limit':_0x5b544d[_0x4af8('0x1e')]?_0x5b544d['options']['limit']||null:null,'include':_0x5b544d[_0x4af8('0x1e')]?_0x5b544d[_0x4af8('0x1e')][_0x4af8('0x21')]?_['map'](_0x5b544d[_0x4af8('0x1e')]['include'],function(_0x3de92c){return{'model':db[_0x3de92c['model']],'as':_0x3de92c['as'],'attributes':_0x3de92c[_0x4af8('0x20')],'include':_0x3de92c['include']?_[_0x4af8('0x22')](_0x3de92c[_0x4af8('0x21')],function(_0xcf8c71){return{'model':db[_0xcf8c71[_0x4af8('0x23')]],'as':_0xcf8c71['as'],'attributes':_0xcf8c71[_0x4af8('0x20')],'include':_0xcf8c71[_0x4af8('0x21')]?_[_0x4af8('0x22')](_0xcf8c71[_0x4af8('0x21')],function(_0x52656a){return{'model':db[_0x52656a[_0x4af8('0x23')]],'as':_0x52656a['as'],'attributes':_0x52656a[_0x4af8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4af8('0xf')](function(_0x308d30){logger[_0x4af8('0x10')](_0x4af8('0x1b'),_0x5b544d);logger[_0x4af8('0x13')](_0x4af8('0x1b'),_0x5b544d,JSON[_0x4af8('0x15')](_0x308d30));_0x2e71c3(_0x308d30);})[_0x4af8('0x1a')](function(_0x369da2){logger[_0x4af8('0x16')](_0x4af8('0x1b'),_0x369da2[_0x4af8('0x18')],_0x5b544d);_0x5d1d59(_0x34eca1[_0x4af8('0x16')](0x1f4,_0x369da2[_0x4af8('0x18')]));});});};exports[_0x4af8('0x24')]=function(_0x16d02c){var _0x29642d=this;return new Promise(function(_0x31d41d,_0x22abed){return db[_0x4af8('0x1c')]['find']({'raw':_0x16d02c[_0x4af8('0x1e')]?_0x16d02c[_0x4af8('0x1e')][_0x4af8('0x1f')]===undefined?!![]:![]:!![],'where':_0x16d02c[_0x4af8('0x1e')]?_0x16d02c[_0x4af8('0x1e')]['where']||null:null,'attributes':_0x16d02c['options']?_0x16d02c[_0x4af8('0x1e')]['attributes']||null:null,'include':_0x16d02c['options']?_0x16d02c[_0x4af8('0x1e')][_0x4af8('0x21')]?_[_0x4af8('0x22')](_0x16d02c[_0x4af8('0x1e')]['include'],function(_0x1e5254){return{'model':db[_0x1e5254['model']],'as':_0x1e5254['as'],'attributes':_0x1e5254[_0x4af8('0x20')],'include':_0x1e5254['include']?_[_0x4af8('0x22')](_0x1e5254['include'],function(_0x36bbd1){return{'model':db[_0x36bbd1[_0x4af8('0x23')]],'as':_0x36bbd1['as'],'attributes':_0x36bbd1[_0x4af8('0x20')],'include':_0x36bbd1[_0x4af8('0x21')]?_[_0x4af8('0x22')](_0x36bbd1['include'],function(_0x555a9c){return{'model':db[_0x555a9c[_0x4af8('0x23')]],'as':_0x555a9c['as'],'attributes':_0x555a9c[_0x4af8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aa2ec){logger[_0x4af8('0x10')](_0x4af8('0x24'),_0x16d02c);logger[_0x4af8('0x13')](_0x4af8('0x24'),_0x16d02c,JSON['stringify'](_0x2aa2ec));_0x31d41d(_0x2aa2ec);})[_0x4af8('0x1a')](function(_0x3c48af){logger[_0x4af8('0x16')](_0x4af8('0x24'),_0x3c48af[_0x4af8('0x18')],_0x16d02c);_0x22abed(_0x29642d[_0x4af8('0x16')](0x1f4,_0x3c48af['message']));});});}; \ No newline at end of file +var _0x7344=['find','raw','ShowSmsQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./smsQueue.socket','register','request','request\x20sent','debug','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','options','where','attributes','include','map','model','then','stringify'];(function(_0x3ce3e7,_0x238bf8){var _0x4cad5b=function(_0x4d6894){while(--_0x4d6894){_0x3ce3e7['push'](_0x3ce3e7['shift']());}};_0x4cad5b(++_0x238bf8);}(_0x7344,0xc6));var _0x4734=function(_0x1495db,_0x1f4120){_0x1495db=_0x1495db-0x0;var _0x145ea9=_0x7344[_0x1495db];return _0x145ea9;};'use strict';var _=require(_0x4734('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4734('0x1'));var rs=require(_0x4734('0x2'));var fs=require('fs');var Redis=require(_0x4734('0x3'));var db=require(_0x4734('0x4'))['db'];var utils=require(_0x4734('0x5'));var logger=require(_0x4734('0x6'))(_0x4734('0x7'));var config=require(_0x4734('0x8'));var jayson=require(_0x4734('0x9'));var client=jayson[_0x4734('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4734('0xb')](config[_0x4734('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4734('0xd'))(new Redis(config[_0x4734('0xc')]));require(_0x4734('0xe'))[_0x4734('0xf')](socket);function respondWithRpcPromise(_0x1104a5,_0x3c0a46,_0x2bfbfd){return new BPromise(function(_0x31a37b,_0x2083ac){return client[_0x4734('0x10')](_0x1104a5,_0x2bfbfd)['then'](function(_0x2fa2ca){logger['info']('SmsQueue,\x20%s,\x20%s',_0x3c0a46,_0x4734('0x11'));logger[_0x4734('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3c0a46,_0x4734('0x11'),JSON['stringify'](_0x2fa2ca));if(_0x2fa2ca['error']){if(_0x2fa2ca[_0x4734('0x13')][_0x4734('0x14')]===0x1f4){logger[_0x4734('0x13')](_0x4734('0x15'),_0x3c0a46,_0x2fa2ca[_0x4734('0x13')][_0x4734('0x16')]);return _0x2083ac(_0x2fa2ca['error']['message']);}logger['error'](_0x4734('0x15'),_0x3c0a46,_0x2fa2ca[_0x4734('0x13')][_0x4734('0x16')]);return _0x31a37b(_0x2fa2ca[_0x4734('0x13')]['message']);}else{logger[_0x4734('0x17')](_0x4734('0x15'),_0x3c0a46,'request\x20sent');_0x31a37b(_0x2fa2ca[_0x4734('0x18')][_0x4734('0x16')]);}})[_0x4734('0x19')](function(_0x4626fd){logger[_0x4734('0x13')](_0x4734('0x15'),_0x3c0a46,_0x4626fd);_0x2083ac(_0x4626fd);});});}exports[_0x4734('0x1a')]=function(_0x43e5d6){var _0x52a727=this;return new Promise(function(_0x5b58ce,_0x11a98a){return db[_0x4734('0x1b')]['findAll']({'raw':_0x43e5d6['options']?_0x43e5d6[_0x4734('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x43e5d6[_0x4734('0x1c')]?_0x43e5d6[_0x4734('0x1c')][_0x4734('0x1d')]||null:null,'attributes':_0x43e5d6[_0x4734('0x1c')]?_0x43e5d6['options'][_0x4734('0x1e')]||null:null,'limit':_0x43e5d6[_0x4734('0x1c')]?_0x43e5d6['options']['limit']||null:null,'include':_0x43e5d6[_0x4734('0x1c')]?_0x43e5d6[_0x4734('0x1c')][_0x4734('0x1f')]?_[_0x4734('0x20')](_0x43e5d6[_0x4734('0x1c')][_0x4734('0x1f')],function(_0x5279f1){return{'model':db[_0x5279f1[_0x4734('0x21')]],'as':_0x5279f1['as'],'attributes':_0x5279f1[_0x4734('0x1e')],'include':_0x5279f1['include']?_[_0x4734('0x20')](_0x5279f1[_0x4734('0x1f')],function(_0x5c77a2){return{'model':db[_0x5c77a2[_0x4734('0x21')]],'as':_0x5c77a2['as'],'attributes':_0x5c77a2[_0x4734('0x1e')],'include':_0x5c77a2[_0x4734('0x1f')]?_[_0x4734('0x20')](_0x5c77a2[_0x4734('0x1f')],function(_0x23bd61){return{'model':db[_0x23bd61[_0x4734('0x21')]],'as':_0x23bd61['as'],'attributes':_0x23bd61[_0x4734('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4734('0x22')](function(_0x346c73){logger['info'](_0x4734('0x1a'),_0x43e5d6);logger[_0x4734('0x12')]('GetSmsQueue',_0x43e5d6,JSON[_0x4734('0x23')](_0x346c73));_0x5b58ce(_0x346c73);})[_0x4734('0x19')](function(_0x378980){logger['error'](_0x4734('0x1a'),_0x378980[_0x4734('0x16')],_0x43e5d6);_0x11a98a(_0x52a727[_0x4734('0x13')](0x1f4,_0x378980['message']));});});};exports['ShowSmsQueue']=function(_0x50f7fb){var _0xbf0809=this;return new Promise(function(_0x447c84,_0x57f99a){return db[_0x4734('0x1b')][_0x4734('0x24')]({'raw':_0x50f7fb[_0x4734('0x1c')]?_0x50f7fb[_0x4734('0x1c')][_0x4734('0x25')]===undefined?!![]:![]:!![],'where':_0x50f7fb[_0x4734('0x1c')]?_0x50f7fb[_0x4734('0x1c')][_0x4734('0x1d')]||null:null,'attributes':_0x50f7fb[_0x4734('0x1c')]?_0x50f7fb[_0x4734('0x1c')][_0x4734('0x1e')]||null:null,'include':_0x50f7fb['options']?_0x50f7fb[_0x4734('0x1c')][_0x4734('0x1f')]?_[_0x4734('0x20')](_0x50f7fb[_0x4734('0x1c')][_0x4734('0x1f')],function(_0x44807a){return{'model':db[_0x44807a[_0x4734('0x21')]],'as':_0x44807a['as'],'attributes':_0x44807a[_0x4734('0x1e')],'include':_0x44807a['include']?_[_0x4734('0x20')](_0x44807a[_0x4734('0x1f')],function(_0x45495e){return{'model':db[_0x45495e['model']],'as':_0x45495e['as'],'attributes':_0x45495e[_0x4734('0x1e')],'include':_0x45495e[_0x4734('0x1f')]?_[_0x4734('0x20')](_0x45495e[_0x4734('0x1f')],function(_0x413bc1){return{'model':db[_0x413bc1[_0x4734('0x21')]],'as':_0x413bc1['as'],'attributes':_0x413bc1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x428572){logger[_0x4734('0x17')](_0x4734('0x26'),_0x50f7fb);logger['debug'](_0x4734('0x26'),_0x50f7fb,JSON[_0x4734('0x23')](_0x428572));_0x447c84(_0x428572);})[_0x4734('0x19')](function(_0x39cca8){logger[_0x4734('0x13')](_0x4734('0x26'),_0x39cca8[_0x4734('0x16')],_0x50f7fb);_0x57f99a(_0xbf0809[_0x4734('0x13')](0x1f4,_0x39cca8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e438c70..37a3156 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 _0xcab1=['save','update','emit','register','smsQueue:','./smsQueue.events'];(function(_0x30e6c4,_0x4887de){var _0x548945=function(_0xa171b6){while(--_0xa171b6){_0x30e6c4['push'](_0x30e6c4['shift']());}};_0x548945(++_0x4887de);}(_0xcab1,0xef));var _0x1cab=function(_0x16e99c,_0x2b1db1){_0x16e99c=_0x16e99c-0x0;var _0x41e98b=_0xcab1[_0x16e99c];return _0x41e98b;};'use strict';var SmsQueueEvents=require(_0x1cab('0x0'));var events=[_0x1cab('0x1'),'remove',_0x1cab('0x2')];function createListener(_0x12e591,_0x555a2a){return function(_0x467b79){_0x555a2a[_0x1cab('0x3')](_0x12e591,_0x467b79);};}function removeListener(_0x465e46,_0x44d7cc){return function(){SmsQueueEvents['removeListener'](_0x465e46,_0x44d7cc);};}exports[_0x1cab('0x4')]=function(_0xdba36e){for(var _0x3dec65=0x0,_0x459468=events['length'];_0x3dec65<_0x459468;_0x3dec65++){var _0xed513b=events[_0x3dec65];var _0x133c07=createListener(_0x1cab('0x5')+_0xed513b,_0xdba36e);SmsQueueEvents['on'](_0xed513b,_0x133c07);}}; \ No newline at end of file +var _0x5f97=['register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0xf4586c,_0x446a77){var _0x3e6f66=function(_0x199245){while(--_0x199245){_0xf4586c['push'](_0xf4586c['shift']());}};_0x3e6f66(++_0x446a77);}(_0x5f97,0xff));var _0x75f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f97[_0xa464c9];return _0x3d73c4;};'use strict';var SmsQueueEvents=require(_0x75f9('0x0'));var events=[_0x75f9('0x1'),_0x75f9('0x2'),'update'];function createListener(_0x3a845f,_0x62977f){return function(_0x466cd9){_0x62977f['emit'](_0x3a845f,_0x466cd9);};}function removeListener(_0x5f2429,_0x581ca3){return function(){SmsQueueEvents['removeListener'](_0x5f2429,_0x581ca3);};}exports[_0x75f9('0x3')]=function(_0x281b9a){for(var _0x50374a=0x0,_0x32db2d=events[_0x75f9('0x4')];_0x50374a<_0x32db2d;_0x50374a++){var _0x49ea07=events[_0x50374a];var _0x2ea55c=createListener(_0x75f9('0x5')+_0x49ea07,_0x281b9a);SmsQueueEvents['on'](_0x49ea07,_0x2ea55c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4dd78c9..656c569 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 _0xef31=['isAuthenticated','index','get','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0xef31,0xdf));var _0x1ef3=function(_0x4c9212,_0xb56971){_0x4c9212=_0x4c9212-0x0;var _0x12b2c6=_0xef31[_0x4c9212];return _0x12b2c6;};'use strict';var multer=require(_0x1ef3('0x0'));var util=require(_0x1ef3('0x1'));var path=require('path');var timeout=require(_0x1ef3('0x2'));var express=require(_0x1ef3('0x3'));var router=express[_0x1ef3('0x4')]();var auth=require(_0x1ef3('0x5'));var interaction=require(_0x1ef3('0x6'));var config=require('../../config/environment');var controller=require(_0x1ef3('0x7'));router['get']('/',auth[_0x1ef3('0x8')](),controller[_0x1ef3('0x9')]);router[_0x1ef3('0xa')](_0x1ef3('0xb'),auth[_0x1ef3('0x8')](),controller['describe']);router[_0x1ef3('0xa')]('/:id',auth[_0x1ef3('0x8')](),controller[_0x1ef3('0xc')]);router[_0x1ef3('0xd')]('/',auth[_0x1ef3('0x8')](),controller[_0x1ef3('0xe')]);router[_0x1ef3('0xf')](_0x1ef3('0x10'),auth[_0x1ef3('0x8')](),controller[_0x1ef3('0x11')]);router[_0x1ef3('0x12')]('/:id',auth[_0x1ef3('0x8')](),controller[_0x1ef3('0x13')]);module[_0x1ef3('0x14')]=router; \ No newline at end of file +var _0xf34b=['describe','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xf34b,0xda));var _0xbf34=function(_0x190821,_0x2e7b8b){_0x190821=_0x190821-0x0;var _0x310505=_0xf34b[_0x190821];return _0x310505;};'use strict';var multer=require(_0xbf34('0x0'));var util=require(_0xbf34('0x1'));var path=require(_0xbf34('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf34('0x3'));var router=express[_0xbf34('0x4')]();var auth=require(_0xbf34('0x5'));var interaction=require(_0xbf34('0x6'));var config=require(_0xbf34('0x7'));var controller=require(_0xbf34('0x8'));router[_0xbf34('0x9')]('/',auth[_0xbf34('0xa')](),controller[_0xbf34('0xb')]);router['get'](_0xbf34('0xc'),auth[_0xbf34('0xa')](),controller[_0xbf34('0xd')]);router[_0xbf34('0x9')](_0xbf34('0xe'),auth[_0xbf34('0xa')](),controller[_0xbf34('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf34('0x10')]);router[_0xbf34('0x11')]('/:id',auth[_0xbf34('0xa')](),controller[_0xbf34('0x12')]);router['delete'](_0xbf34('0xe'),auth[_0xbf34('0xa')](),controller[_0xbf34('0x13')]);module[_0xbf34('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ce51ecd..1d37e03 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 _0x4215=['exports','STRING','DATE','moment','sequelize'];(function(_0xbeb3fb,_0x289ba7){var _0x4b45d5=function(_0xbec96d){while(--_0xbec96d){_0xbeb3fb['push'](_0xbeb3fb['shift']());}};_0x4b45d5(++_0x289ba7);}(_0x4215,0x1ed));var _0x5421=function(_0x41166d,_0x131735){_0x41166d=_0x41166d-0x0;var _0x144758=_0x4215[_0x41166d];return _0x144758;};'use strict';var moment=require(_0x5421('0x0'));var Sequelize=require(_0x5421('0x1'));module[_0x5421('0x2')]={'uniqueid':{'type':Sequelize[_0x5421('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5421('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5421('0x4')]},'reason':{'type':Sequelize[_0x5421('0x3')]}}; \ No newline at end of file +var _0xf59c=['exports','STRING','DATE','moment','sequelize'];(function(_0x2de86d,_0x3f544e){var _0x451227=function(_0x522c9e){while(--_0x522c9e){_0x2de86d['push'](_0x2de86d['shift']());}};_0x451227(++_0x3f544e);}(_0xf59c,0x11b));var _0xcf59=function(_0x588f06,_0x36d85c){_0x588f06=_0x588f06-0x0;var _0x305fef=_0xf59c[_0x588f06];return _0x305fef;};'use strict';var moment=require(_0xcf59('0x0'));var Sequelize=require(_0xcf59('0x1'));module[_0xcf59('0x2')]={'uniqueid':{'type':Sequelize[_0xcf59('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcf59('0x3')]},'joinAt':{'type':Sequelize[_0xcf59('0x4')]},'leaveAt':{'type':Sequelize[_0xcf59('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcf59('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d3e1d98..0b52634 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x229764,_0x3687f1){var _0x143dea=function(_0x473a68){while(--_0x473a68){_0x229764['push'](_0x229764['shift']());}};_0x143dea(++_0x3687f1);}(_0x814b,0x1a2));var _0xb814=function(_0x1e1b18,_0x5d471b){_0x1e1b18=_0x1e1b18-0x0;var _0x3da8f2=_0x814b[_0x1e1b18];return _0x3da8f2;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0xc4aa=['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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['SmsQueueReport']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['SmsQueueReport'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e3849c3..08f8124 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 _0x9dd6=['moment','bluebird','request-promise','../../config/environment','exports','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4797cd,_0x2da09e){var _0x44ca00=function(_0x3f849b){while(--_0x3f849b){_0x4797cd['push'](_0x4797cd['shift']());}};_0x44ca00(++_0x2da09e);}(_0x9dd6,0x15d));var _0x69dd=function(_0x5bc8be,_0x31896f){_0x5bc8be=_0x5bc8be-0x0;var _0x5a3a0c=_0x9dd6[_0x5bc8be];return _0x5a3a0c;};'use strict';var _=require(_0x69dd('0x0'));var util=require(_0x69dd('0x1'));var logger=require(_0x69dd('0x2'))('api');var moment=require(_0x69dd('0x3'));var BPromise=require(_0x69dd('0x4'));var rp=require(_0x69dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x69dd('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0x69dd('0x7')]=function(_0x572c1d,_0x1b3984){return _0x572c1d['define'](_0x69dd('0x8'),attributes,{'tableName':_0x69dd('0x9'),'paranoid':![],'indexes':[{'name':_0x69dd('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x934d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x934d,0x1da));var _0xd934=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x934d[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xd934('0x0'));var util=require(_0xd934('0x1'));var logger=require(_0xd934('0x2'))(_0xd934('0x3'));var moment=require(_0xd934('0x4'));var BPromise=require('bluebird');var rp=require(_0xd934('0x5'));var fs=require('fs');var path=require(_0xd934('0x6'));var rimraf=require(_0xd934('0x7'));var config=require(_0xd934('0x8'));var attributes=require(_0xd934('0x9'));module['exports']=function(_0x29c59e,_0x2e72f7){return _0x29c59e[_0xd934('0xa')](_0xd934('0xb'),attributes,{'tableName':_0xd934('0xc'),'paranoid':![],'indexes':[{'name':_0xd934('0xd'),'fields':[_0xd934('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7798aef..b98865a 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 _0x8597=['request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','raw','UpdateSmsQueueReport','update','options','where','attributes','limit','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x5ed8a4,_0x6c22a5){var _0x36544d=function(_0x1f332b){while(--_0x1f332b){_0x5ed8a4['push'](_0x5ed8a4['shift']());}};_0x36544d(++_0x6c22a5);}(_0x8597,0x1ce));var _0x7859=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8597[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7859('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7859('0x1'));var fs=require('fs');var Redis=require(_0x7859('0x2'));var db=require(_0x7859('0x3'))['db'];var utils=require(_0x7859('0x4'));var logger=require(_0x7859('0x5'))(_0x7859('0x6'));var config=require(_0x7859('0x7'));var jayson=require(_0x7859('0x8'));var client=jayson['client'][_0x7859('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10574e,_0x55bc85,_0x598b0c){return new BPromise(function(_0x3d96c4,_0x1a729e){return client[_0x7859('0xa')](_0x10574e,_0x598b0c)[_0x7859('0xb')](function(_0x1e5648){logger[_0x7859('0xc')](_0x7859('0xd'),_0x55bc85,_0x7859('0xe'));logger['debug'](_0x7859('0xf'),_0x55bc85,_0x7859('0xe'),JSON[_0x7859('0x10')](_0x1e5648));if(_0x1e5648['error']){if(_0x1e5648['error'][_0x7859('0x11')]===0x1f4){logger[_0x7859('0x12')](_0x7859('0xd'),_0x55bc85,_0x1e5648['error'][_0x7859('0x13')]);return _0x1a729e(_0x1e5648[_0x7859('0x12')][_0x7859('0x13')]);}logger['error'](_0x7859('0xd'),_0x55bc85,_0x1e5648[_0x7859('0x12')][_0x7859('0x13')]);return _0x3d96c4(_0x1e5648[_0x7859('0x12')][_0x7859('0x13')]);}else{logger[_0x7859('0xc')](_0x7859('0xd'),_0x55bc85,_0x7859('0xe'));_0x3d96c4(_0x1e5648[_0x7859('0x14')]['message']);}})[_0x7859('0x15')](function(_0x3b7754){logger['error'](_0x7859('0xd'),_0x55bc85,_0x3b7754);_0x1a729e(_0x3b7754);});});}exports[_0x7859('0x16')]=function(_0x4c859c){var _0x475533=this;return new Promise(function(_0x2884c7,_0x30aeb1){return db[_0x7859('0x17')][_0x7859('0x18')](_0x4c859c[_0x7859('0x19')],{'raw':_0x4c859c['options']?_0x4c859c['options'][_0x7859('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5ef237){logger[_0x7859('0xc')](_0x7859('0x16'),_0x4c859c);logger['debug'](_0x7859('0x16'),_0x4c859c,JSON['stringify'](_0x5ef237));_0x2884c7(_0x5ef237);})[_0x7859('0x15')](function(_0x2f04a5){logger['error']('CreateSmsQueueReport',_0x2f04a5[_0x7859('0x13')],_0x4c859c);_0x30aeb1(_0x475533[_0x7859('0x12')](0x1f4,_0x2f04a5[_0x7859('0x13')]));});});};exports[_0x7859('0x1b')]=function(_0x22b8bc){var _0x51629a=this;return new Promise(function(_0x52f1cb,_0x5315c1){return db[_0x7859('0x17')][_0x7859('0x1c')](_0x22b8bc[_0x7859('0x19')],{'raw':_0x22b8bc[_0x7859('0x1d')]?_0x22b8bc[_0x7859('0x1d')][_0x7859('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b8bc[_0x7859('0x1d')]?_0x22b8bc[_0x7859('0x1d')][_0x7859('0x1e')]||null:null,'attributes':_0x22b8bc[_0x7859('0x1d')]?_0x22b8bc[_0x7859('0x1d')][_0x7859('0x1f')]||null:null,'limit':_0x22b8bc[_0x7859('0x1d')]?_0x22b8bc['options'][_0x7859('0x20')]||null:null})['then'](function(_0x5af855){logger[_0x7859('0xc')](_0x7859('0x1b'),_0x22b8bc);logger[_0x7859('0x21')](_0x7859('0x1b'),_0x22b8bc,JSON[_0x7859('0x10')](_0x5af855));_0x52f1cb(_0x5af855);})[_0x7859('0x15')](function(_0x5bcf29){logger[_0x7859('0x12')]('UpdateSmsQueueReport',_0x5bcf29[_0x7859('0x13')],_0x22b8bc);_0x5315c1(_0x51629a[_0x7859('0x12')](0x1f4,_0x5bcf29[_0x7859('0x13')]));});});}; \ No newline at end of file +var _0xa97f=['raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','catch','CreateSmsQueueReport','SmsQueueReport','create','options'];(function(_0x2cb122,_0x5684a0){var _0x21af56=function(_0x582643){while(--_0x582643){_0x2cb122['push'](_0x2cb122['shift']());}};_0x21af56(++_0x5684a0);}(_0xa97f,0x18c));var _0xfa97=function(_0x571481,_0x3ffddc){_0x571481=_0x571481-0x0;var _0x6a421b=_0xa97f[_0x571481];return _0x6a421b;};'use strict';var _=require(_0xfa97('0x0'));var util=require(_0xfa97('0x1'));var moment=require(_0xfa97('0x2'));var BPromise=require(_0xfa97('0x3'));var rs=require(_0xfa97('0x4'));var fs=require('fs');var Redis=require(_0xfa97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa97('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa97('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa97('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b88c3,_0xd75594,_0x168efa){return new BPromise(function(_0x105327,_0x437fd0){return client['request'](_0x1b88c3,_0x168efa)[_0xfa97('0x9')](function(_0x40156d){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xd75594,_0xfa97('0xa'));logger[_0xfa97('0xb')](_0xfa97('0xc'),_0xd75594,'request\x20sent',JSON[_0xfa97('0xd')](_0x40156d));if(_0x40156d[_0xfa97('0xe')]){if(_0x40156d[_0xfa97('0xe')][_0xfa97('0xf')]===0x1f4){logger[_0xfa97('0xe')](_0xfa97('0x10'),_0xd75594,_0x40156d['error'][_0xfa97('0x11')]);return _0x437fd0(_0x40156d[_0xfa97('0xe')][_0xfa97('0x11')]);}logger[_0xfa97('0xe')](_0xfa97('0x10'),_0xd75594,_0x40156d[_0xfa97('0xe')][_0xfa97('0x11')]);return _0x105327(_0x40156d[_0xfa97('0xe')][_0xfa97('0x11')]);}else{logger[_0xfa97('0x12')](_0xfa97('0x10'),_0xd75594,'request\x20sent');_0x105327(_0x40156d['result']['message']);}})[_0xfa97('0x13')](function(_0x55af7d){logger[_0xfa97('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0xd75594,_0x55af7d);_0x437fd0(_0x55af7d);});});}exports[_0xfa97('0x14')]=function(_0x3349ab){var _0x33cf1c=this;return new Promise(function(_0x1ea48e,_0x2646b0){return db[_0xfa97('0x15')][_0xfa97('0x16')](_0x3349ab['body'],{'raw':_0x3349ab[_0xfa97('0x17')]?_0x3349ab[_0xfa97('0x17')][_0xfa97('0x18')]===undefined?!![]:![]:!![]})[_0xfa97('0x9')](function(_0x1bb1ea){logger['info'](_0xfa97('0x14'),_0x3349ab);logger[_0xfa97('0xb')](_0xfa97('0x14'),_0x3349ab,JSON[_0xfa97('0xd')](_0x1bb1ea));_0x1ea48e(_0x1bb1ea);})[_0xfa97('0x13')](function(_0x282c27){logger[_0xfa97('0xe')](_0xfa97('0x14'),_0x282c27[_0xfa97('0x11')],_0x3349ab);_0x2646b0(_0x33cf1c[_0xfa97('0xe')](0x1f4,_0x282c27[_0xfa97('0x11')]));});});};exports[_0xfa97('0x19')]=function(_0x3c7ee8){var _0x3526f3=this;return new Promise(function(_0x2c097d,_0x1b3300){return db[_0xfa97('0x15')][_0xfa97('0x1a')](_0x3c7ee8['body'],{'raw':_0x3c7ee8['options']?_0x3c7ee8[_0xfa97('0x17')][_0xfa97('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7ee8[_0xfa97('0x17')]?_0x3c7ee8[_0xfa97('0x17')][_0xfa97('0x1b')]||null:null,'attributes':_0x3c7ee8[_0xfa97('0x17')]?_0x3c7ee8[_0xfa97('0x17')][_0xfa97('0x1c')]||null:null,'limit':_0x3c7ee8[_0xfa97('0x17')]?_0x3c7ee8[_0xfa97('0x17')][_0xfa97('0x1d')]||null:null})[_0xfa97('0x9')](function(_0x501076){logger[_0xfa97('0x12')](_0xfa97('0x19'),_0x3c7ee8);logger[_0xfa97('0xb')]('UpdateSmsQueueReport',_0x3c7ee8,JSON[_0xfa97('0xd')](_0x501076));_0x2c097d(_0x501076);})[_0xfa97('0x13')](function(_0x49fa8d){logger[_0xfa97('0xe')](_0xfa97('0x19'),_0x49fa8d[_0xfa97('0x11')],_0x3c7ee8);_0x1b3300(_0x3526f3['error'](0x1f4,_0x49fa8d[_0xfa97('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bce4fc5..b53b21c 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6324=['util','path','connect-timeout','Router','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x1fad37,_0x3a0eae){var _0x2c473f=function(_0x13ce79){while(--_0x13ce79){_0x1fad37['push'](_0x1fad37['shift']());}};_0x2c473f(++_0x3a0eae);}(_0x6324,0x142));var _0x4632=function(_0x2bf00b,_0xc27791){_0x2bf00b=_0x2bf00b-0x0;var _0x1bc255=_0x6324[_0x2bf00b];return _0x1bc255;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',auth[_0x4632('0x7')](),controller[_0x4632('0x8')]);router[_0x4632('0x9')](_0x4632('0xa'),auth['isAuthenticated'](),controller[_0x4632('0xb')]);router[_0x4632('0x9')](_0x4632('0xc'),auth['isAuthenticated'](),controller[_0x4632('0xd')]);router[_0x4632('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4632('0xf')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe511=['get','isAuthenticated','/describe','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0xe511,0x16f));var _0x1e51=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0xe511[_0x250bbc];return _0x489e34;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')]('/',auth[_0x1e51('0x8')](),controller['index']);router[_0x1e51('0x7')](_0x1e51('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x1e51('0x7')](_0x1e51('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1e51('0xb')]('/',auth[_0x1e51('0x8')](),controller[_0x1e51('0xc')]);router[_0x1e51('0xd')](_0x1e51('0xa'),auth[_0x1e51('0x8')](),controller['update']);router[_0x1e51('0xe')](_0x1e51('0xa'),auth[_0x1e51('0x8')](),controller[_0x1e51('0xf')]);module[_0x1e51('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index cd36f6b..acc38d4 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 _0xda5d=['sequelize','exports','STRING','ENUM','queue','NOW'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xda5d,0x6c));var _0xdda5=function(_0x21d08f,_0x5445d7){_0x21d08f=_0x21d08f-0x0;var _0x46dab4=_0xda5d[_0x21d08f];return _0x46dab4;};'use strict';var moment=require('moment');var Sequelize=require(_0xdda5('0x0'));module[_0xdda5('0x1')]={'uniqueid':{'type':Sequelize[_0xdda5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdda5('0x3')]('account','agent',_0xdda5('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xdda5('0x5')]}}; \ No newline at end of file +var _0x8134=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x2daa85,_0x55d06c){var _0x1e450f=function(_0x557556){while(--_0x557556){_0x2daa85['push'](_0x2daa85['shift']());}};_0x1e450f(++_0x55d06c);}(_0x8134,0xdb));var _0x4813=function(_0x4cc93e,_0x3dacba){_0x4cc93e=_0x4cc93e-0x0;var _0x45adc1=_0x8134[_0x4cc93e];return _0x45adc1;};'use strict';var moment=require('moment');var Sequelize=require(_0x4813('0x0'));module[_0x4813('0x1')]={'uniqueid':{'type':Sequelize[_0x4813('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4813('0x3')](_0x4813('0x4'),_0x4813('0x5'),_0x4813('0x6')),'allowNull':![],'defaultValue':_0x4813('0x6')},'transferredAt':{'type':Sequelize[_0x4813('0x7')],'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 3768675..6f2ac76 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x361026,_0x2375e2){var _0x37028e=function(_0x4f89e0){while(--_0x4f89e0){_0x361026['push'](_0x361026['shift']());}};_0x37028e(++_0x2375e2);}(_0x70e0,0x17b));var _0x070e=function(_0x56708b,_0x5966d9){_0x56708b=_0x56708b-0x0;var _0x4306fc=_0x70e0[_0x56708b];return _0x4306fc;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));};exports['show']=function(_0x5bd39a,_0x398168){var _0x42c448={'raw':!![],'where':{'id':_0x5bd39a['params']['id']}},_0x38879f={};_0x38879f[_0x070e('0x2b')]=_[_0x070e('0x2c')](db[_0x070e('0x27')][_0x070e('0x28')]);_0x38879f['query']=_[_0x070e('0x2c')](_0x5bd39a['query']);_0x38879f['filters']=_['intersection'](_0x38879f[_0x070e('0x2b')],_0x38879f[_0x070e('0x2d')]);_0x42c448[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x38879f[_0x070e('0x2b')],qs['fields'](_0x5bd39a[_0x070e('0x2d')]['fields']));_0x42c448[_0x070e('0x2f')]=_0x42c448[_0x070e('0x2f')][_0x070e('0x31')]?_0x42c448['attributes']:_0x38879f['model'];if(_0x5bd39a[_0x070e('0x2d')]['includeAll']){_0x42c448[_0x070e('0x41')]=[{'all':!![]}];}_0x42c448=_[_0x070e('0x3a')]({},_0x42c448,_0x5bd39a[_0x070e('0x3b')]);return db['SmsTransferReport'][_0x070e('0x42')](_0x42c448)[_0x070e('0x20')](handleEntityNotFound(_0x398168,null))['then'](respondWithResult(_0x398168,null))['catch'](handleError(_0x398168,null));};exports[_0x070e('0x43')]=function(_0x945901,_0x2d43ce){return db[_0x070e('0x27')][_0x070e('0x43')](_0x945901['body'],{})[_0x070e('0x20')](respondWithResult(_0x2d43ce,0xc9))[_0x070e('0x40')](handleError(_0x2d43ce,null));};exports[_0x070e('0x1f')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x44')]['id']){delete _0x391dee[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x391dee[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x79eaa0,null))[_0x070e('0x40')](handleError(_0x79eaa0,null));};exports['destroy']=function(_0x171621,_0xa7a41b){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x171621[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa7a41b,null))[_0x070e('0x20')](removeEntity(_0xa7a41b,null))[_0x070e('0x40')](handleError(_0xa7a41b,null));};exports[_0x070e('0x46')]=function(_0x5744c5,_0x251696){return db['SmsTransferReport'][_0x070e('0x46')]()[_0x070e('0x20')](respondWithResult(_0x251696,null))['catch'](handleError(_0x251696,null));}; \ No newline at end of file +var _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x4e0e6c,_0x470536){var _0x39c386=function(_0x5d36ca){while(--_0x5d36ca){_0x4e0e6c['push'](_0x4e0e6c['shift']());}};_0x39c386(++_0x470536);}(_0xe706,0xa3));var _0x6e70=function(_0x102470,_0x199a01){_0x102470=_0x102470-0x0;var _0x558eaa=_0xe706[_0x102470];return _0x558eaa;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f149b3f..de40100 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 _0x20ea=['../../config/logger','api','moment','bluebird','request-promise','path','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x20ea,0xce));var _0xa20e=function(_0x1f0ea0,_0x2c2116){_0x1f0ea0=_0x1f0ea0-0x0;var _0x1a1272=_0x20ea[_0x1f0ea0];return _0x1a1272;};'use strict';var _=require(_0xa20e('0x0'));var util=require(_0xa20e('0x1'));var logger=require(_0xa20e('0x2'))(_0xa20e('0x3'));var moment=require(_0xa20e('0x4'));var BPromise=require(_0xa20e('0x5'));var rp=require(_0xa20e('0x6'));var fs=require('fs');var path=require(_0xa20e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa20e('0x8'));module[_0xa20e('0x9')]=function(_0x513a46,_0x24b685){return _0x513a46['define'](_0xa20e('0xa'),attributes,{'tableName':_0xa20e('0xb'),'paranoid':![],'indexes':[{'name':_0xa20e('0xc'),'fields':[_0xa20e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x404c=['./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x404c,0x13a));var _0xc404=function(_0x55850c,_0x21d03a){_0x55850c=_0x55850c-0x0;var _0x43c785=_0x404c[_0x55850c];return _0x43c785;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc404('0x0'))(_0xc404('0x1'));var moment=require('moment');var BPromise=require(_0xc404('0x2'));var rp=require(_0xc404('0x3'));var fs=require('fs');var path=require(_0xc404('0x4'));var rimraf=require(_0xc404('0x5'));var config=require('../../config/environment');var attributes=require(_0xc404('0x6'));module['exports']=function(_0x21c092,_0x3c5f80){return _0x21c092[_0xc404('0x7')](_0xc404('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xc404('0x9'),'fields':[_0xc404('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d2ef8ee..10ad1a3 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 _0x92da=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x2f494e,_0x2c94d1){var _0x111197=function(_0x21ec4c){while(--_0x21ec4c){_0x2f494e['push'](_0x2f494e['shift']());}};_0x111197(++_0x2c94d1);}(_0x92da,0x64));var _0xa92d=function(_0x5479d8,_0x273d3a){_0x5479d8=_0x5479d8-0x0;var _0x58c34a=_0x92da[_0x5479d8];return _0x58c34a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa92d('0x0'));var fs=require('fs');var Redis=require(_0xa92d('0x1'));var db=require(_0xa92d('0x2'))['db'];var utils=require(_0xa92d('0x3'));var logger=require(_0xa92d('0x4'))('rpc');var config=require(_0xa92d('0x5'));var jayson=require(_0xa92d('0x6'));var client=jayson[_0xa92d('0x7')][_0xa92d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2890f6,_0xb75db7,_0x5ea988){return new BPromise(function(_0x29c9b9,_0x4fdca8){return client['request'](_0x2890f6,_0x5ea988)['then'](function(_0x5d02f6){logger['info'](_0xa92d('0x9'),_0xb75db7,_0xa92d('0xa'));logger[_0xa92d('0xb')](_0xa92d('0xc'),_0xb75db7,_0xa92d('0xa'),JSON[_0xa92d('0xd')](_0x5d02f6));if(_0x5d02f6[_0xa92d('0xe')]){if(_0x5d02f6[_0xa92d('0xe')][_0xa92d('0xf')]===0x1f4){logger[_0xa92d('0xe')](_0xa92d('0x9'),_0xb75db7,_0x5d02f6[_0xa92d('0xe')][_0xa92d('0x10')]);return _0x4fdca8(_0x5d02f6[_0xa92d('0xe')]['message']);}logger[_0xa92d('0xe')](_0xa92d('0x9'),_0xb75db7,_0x5d02f6[_0xa92d('0xe')][_0xa92d('0x10')]);return _0x29c9b9(_0x5d02f6[_0xa92d('0xe')]['message']);}else{logger[_0xa92d('0x11')](_0xa92d('0x9'),_0xb75db7,_0xa92d('0xa'));_0x29c9b9(_0x5d02f6[_0xa92d('0x12')][_0xa92d('0x10')]);}})[_0xa92d('0x13')](function(_0x2a9fec){logger[_0xa92d('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0xb75db7,_0x2a9fec);_0x4fdca8(_0x2a9fec);});});} \ No newline at end of file +var _0xd087=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0xc4d59f,_0x45b955){var _0x3dd52c=function(_0x5a5d50){while(--_0x5a5d50){_0xc4d59f['push'](_0xc4d59f['shift']());}};_0x3dd52c(++_0x45b955);}(_0xd087,0x1cb));var _0x7d08=function(_0x17174c,_0x266797){_0x17174c=_0x17174c-0x0;var _0x38125a=_0xd087[_0x17174c];return _0x38125a;};'use strict';var _=require('lodash');var util=require(_0x7d08('0x0'));var moment=require(_0x7d08('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d08('0x2'));var db=require(_0x7d08('0x3'))['db'];var utils=require(_0x7d08('0x4'));var logger=require(_0x7d08('0x5'))(_0x7d08('0x6'));var config=require('../../config/environment');var jayson=require(_0x7d08('0x7'));var client=jayson[_0x7d08('0x8')][_0x7d08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c8c8e,_0x35a9b6,_0x1a579c){return new BPromise(function(_0x58b537,_0x5f4a51){return client[_0x7d08('0xa')](_0x3c8c8e,_0x1a579c)['then'](function(_0x12c8c0){logger['info'](_0x7d08('0xb'),_0x35a9b6,_0x7d08('0xc'));logger['debug'](_0x7d08('0xd'),_0x35a9b6,_0x7d08('0xc'),JSON[_0x7d08('0xe')](_0x12c8c0));if(_0x12c8c0[_0x7d08('0xf')]){if(_0x12c8c0[_0x7d08('0xf')][_0x7d08('0x10')]===0x1f4){logger[_0x7d08('0xf')](_0x7d08('0xb'),_0x35a9b6,_0x12c8c0['error'][_0x7d08('0x11')]);return _0x5f4a51(_0x12c8c0['error'][_0x7d08('0x11')]);}logger[_0x7d08('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x35a9b6,_0x12c8c0[_0x7d08('0xf')]['message']);return _0x58b537(_0x12c8c0['error'][_0x7d08('0x11')]);}else{logger['info'](_0x7d08('0xb'),_0x35a9b6,_0x7d08('0xc'));_0x58b537(_0x12c8c0[_0x7d08('0x12')][_0x7d08('0x11')]);}})[_0x7d08('0x13')](function(_0x5e4cd3){logger[_0x7d08('0xf')](_0x7d08('0xb'),_0x35a9b6,_0x5e4cd3);_0x5f4a51(_0x5e4cd3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d7dce3b..02c129c 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 _0xb285=['format','basename','extname','post','single','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','/:id/download','download','root','server/files/sounds/original/','originalname','replace'];(function(_0x18f733,_0xe38101){var _0x13b465=function(_0x5b8836){while(--_0x5b8836){_0x18f733['push'](_0x18f733['shift']());}};_0x13b465(++_0xe38101);}(_0xb285,0xb9));var _0x5b28=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0xb285[_0x474d97];return _0x1edf25;};'use strict';var multer=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var path=require(_0x5b28('0x2'));var timeout=require(_0x5b28('0x3'));var express=require('express');var router=express[_0x5b28('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b28('0x5'));var config=require(_0x5b28('0x6'));var controller=require(_0x5b28('0x7'));router[_0x5b28('0x8')]('/',auth['isAuthenticated'](),controller[_0x5b28('0x9')]);router[_0x5b28('0x8')]('/:id',auth[_0x5b28('0xa')](),controller[_0x5b28('0xb')]);router[_0x5b28('0x8')](_0x5b28('0xc'),auth['isAuthenticated'](),controller[_0x5b28('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c422b,_0x275b7d,_0x2bae61){_0x2bae61(null,path['join'](config[_0x5b28('0xe')],_0x5b28('0xf')));},'filename':function(_0x4972e3,_0x465c68,_0x538bce){_0x465c68[_0x5b28('0x10')]=_0x465c68[_0x5b28('0x10')][_0x5b28('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x538bce(null,util[_0x5b28('0x12')]('%s-%s%s',path[_0x5b28('0x13')](_0x465c68[_0x5b28('0x10')],path['extname'](_0x465c68[_0x5b28('0x10')])),Date['now'](),path[_0x5b28('0x14')](_0x465c68[_0x5b28('0x10')])));}})});router[_0x5b28('0x15')]('/',upload[_0x5b28('0x16')]('file'),controller[_0x5b28('0x17')]);router[_0x5b28('0x18')](_0x5b28('0x19'),auth[_0x5b28('0xa')](),controller[_0x5b28('0x1a')]);router[_0x5b28('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x5b28('0x1b')]);module[_0x5b28('0x1c')]=router; \ No newline at end of file +var _0x5f7e=['root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','file','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','/:id/download','download','diskStorage','join'];(function(_0x2bfe91,_0x223885){var _0x4d6152=function(_0x34846c){while(--_0x34846c){_0x2bfe91['push'](_0x2bfe91['shift']());}};_0x4d6152(++_0x223885);}(_0x5f7e,0x8b));var _0xe5f7=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x5f7e[_0x238671];return _0x474844;};'use strict';var multer=require(_0xe5f7('0x0'));var util=require(_0xe5f7('0x1'));var path=require(_0xe5f7('0x2'));var timeout=require(_0xe5f7('0x3'));var express=require(_0xe5f7('0x4'));var router=express[_0xe5f7('0x5')]();var auth=require(_0xe5f7('0x6'));var interaction=require(_0xe5f7('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xe5f7('0x8')]('/',auth['isAuthenticated'](),controller[_0xe5f7('0x9')]);router[_0xe5f7('0x8')]('/:id',auth[_0xe5f7('0xa')](),controller[_0xe5f7('0xb')]);router[_0xe5f7('0x8')](_0xe5f7('0xc'),auth['isAuthenticated'](),controller[_0xe5f7('0xd')]);var upload=multer({'storage':multer[_0xe5f7('0xe')]({'destination':function(_0x4f0c74,_0x4d9864,_0x2d7a9d){_0x2d7a9d(null,path[_0xe5f7('0xf')](config[_0xe5f7('0x10')],_0xe5f7('0x11')));},'filename':function(_0x1c7343,_0x5506fa,_0x332000){_0x5506fa[_0xe5f7('0x12')]=_0x5506fa['originalname'][_0xe5f7('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x332000(null,util[_0xe5f7('0x14')]('%s-%s%s',path[_0xe5f7('0x15')](_0x5506fa['originalname'],path[_0xe5f7('0x16')](_0x5506fa[_0xe5f7('0x12')])),Date[_0xe5f7('0x17')](),path[_0xe5f7('0x16')](_0x5506fa[_0xe5f7('0x12')])));}})});router[_0xe5f7('0x18')]('/',upload['single'](_0xe5f7('0x19')),controller[_0xe5f7('0x1a')]);router[_0xe5f7('0x1b')](_0xe5f7('0x1c'),auth[_0xe5f7('0xa')](),controller[_0xe5f7('0x1d')]);router['delete'](_0xe5f7('0x1c'),auth[_0xe5f7('0xa')](),controller[_0xe5f7('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a8291cd..02f9adb 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 _0x592d=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x213916,_0x5f55ce){var _0x26a845=function(_0x272b37){while(--_0x272b37){_0x213916['push'](_0x213916['shift']());}};_0x26a845(++_0x5f55ce);}(_0x592d,0x138));var _0xd592=function(_0x488818,_0x17c6de){_0x488818=_0x488818-0x0;var _0x30783c=_0x592d[_0x488818];return _0x30783c;};'use strict';var Sequelize=require(_0xd592('0x0'));module[_0xd592('0x1')]={'name':{'type':Sequelize[_0xd592('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd592('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd592('0x2')]},'original_format':{'type':Sequelize[_0xd592('0x2')]},'original_duration':{'type':Sequelize[_0xd592('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd592('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd592('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xd592('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd592('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd592('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xeb2d=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x52c503,_0x2013ae){var _0x335f5e=function(_0x1a1e35){while(--_0x1a1e35){_0x52c503['push'](_0x52c503['shift']());}};_0x335f5e(++_0x2013ae);}(_0xeb2d,0x150));var _0xdeb2=function(_0x4f0669,_0x5cb5a4){_0x4f0669=_0x4f0669-0x0;var _0x555106=_0xeb2d[_0x4f0669];return _0x555106;};'use strict';var Sequelize=require(_0xdeb2('0x0'));module[_0xdeb2('0x1')]={'name':{'type':Sequelize[_0xdeb2('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xdeb2('0x2')]},'display_name':{'type':Sequelize[_0xdeb2('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xdeb2('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xdeb2('0x3')]},'original_sampleCount':{'type':Sequelize[_0xdeb2('0x4')]},'original_channelCount':{'type':Sequelize[_0xdeb2('0x5')]},'original_bitRate':{'type':Sequelize[_0xdeb2('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xdeb2('0x2')]},'converted_duration':{'type':Sequelize[_0xdeb2('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xdeb2('0x4')]},'converted_channelCount':{'type':Sequelize[_0xdeb2('0x5')]},'converted_bitRate':{'type':Sequelize[_0xdeb2('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xdeb2('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 26afbc3..fcc057f 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 _0x8125=['Sound\x20not\x20found','format','%s.%s','converted_format','create','basename','extname','file','originalname','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Sounds','UserProfileResource','then','sendStatus','error','stack','name','index','map','Sound','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','download','existsSync','join','root','server/files/sounds/converted','save_name'];(function(_0x5466ea,_0x3d8f00){var _0x3fa3ff=function(_0x253d2a){while(--_0x253d2a){_0x5466ea['push'](_0x5466ea['shift']());}};_0x3fa3ff(++_0x3d8f00);}(_0x8125,0xa2));var _0x5812=function(_0x1ea01a,_0x248771){_0x1ea01a=_0x1ea01a-0x0;var _0x48c526=_0x8125[_0x1ea01a];return _0x48c526;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5812('0x0'));var rimraf=require(_0x5812('0x1'));var zipdir=require(_0x5812('0x2'));var jsonpatch=require(_0x5812('0x3'));var rp=require('request-promise');var moment=require(_0x5812('0x4'));var BPromise=require(_0x5812('0x5'));var Mustache=require(_0x5812('0x6'));var util=require(_0x5812('0x7'));var path=require(_0x5812('0x8'));var sox=require(_0x5812('0x9'));var csv=require(_0x5812('0xa'));var ejs=require(_0x5812('0xb'));var fs=require('fs');var _=require(_0x5812('0xc'));var squel=require(_0x5812('0xd'));var crypto=require('crypto');var jsforce=require(_0x5812('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5812('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5812('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5812('0x10'));var logger=require(_0x5812('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5812('0x12'))['db'];function respondWithStatusCode(_0x14509a,_0x23f98e){_0x23f98e=_0x23f98e||0xcc;return function(_0x1376e8){if(_0x1376e8){return _0x14509a['sendStatus'](_0x23f98e);}return _0x14509a[_0x5812('0x13')](_0x23f98e)[_0x5812('0x14')]();};}function respondWithResult(_0x18a23e,_0x1cd872){_0x1cd872=_0x1cd872||0xc8;return function(_0x358ea3){if(_0x358ea3){return _0x18a23e['status'](_0x1cd872)[_0x5812('0x15')](_0x358ea3);}};}function respondWithFilteredResult(_0x597f3a,_0x4057fc){return function(_0x2c2a9f){if(_0x2c2a9f){var _0x246922=_0x2c2a9f[_0x5812('0x16')],_0x18cbe3=_0x4057fc['offset'],_0x2cc5ea=_0x4057fc[_0x5812('0x17')]+_0x4057fc[_0x5812('0x18')],_0x34f52f;if(_0x2cc5ea>=_0x246922){_0x2cc5ea=_0x246922;_0x34f52f=0xc8;}else{_0x34f52f=0xce;}_0x597f3a['status'](_0x34f52f);return _0x597f3a[_0x5812('0x19')](_0x5812('0x1a'),_0x18cbe3+'-'+_0x2cc5ea+'/'+_0x246922)[_0x5812('0x15')](_0x2c2a9f);}return null;};}function patchUpdates(_0x21d71a){return function(_0x44c50c){try{jsonpatch[_0x5812('0x1b')](_0x44c50c,_0x21d71a,!![]);}catch(_0x2448f5){return BPromise[_0x5812('0x1c')](_0x2448f5);}return _0x44c50c[_0x5812('0x1d')]();};}function saveUpdates(_0xe5c219,_0x479d26){return function(_0x562014){if(_0x562014){return _0x562014[_0x5812('0x1e')](_0xe5c219)['then'](function(_0x20dceb){return _0x20dceb;});}return null;};}function removeEntity(_0x323067,_0x5cf2a3){return function(_0x40b6a8){if(_0x40b6a8){return _0x40b6a8['destroy']()['then'](function(){var _0x69f531=_0x40b6a8[_0x5812('0x1f')]({'plain':!![]});var _0x778814=_0x5812('0x20');return db[_0x5812('0x21')]['destroy']({'where':{'type':_0x778814,'resourceId':_0x69f531['id']}})['then'](function(){return _0x40b6a8;});})[_0x5812('0x22')](function(){_0x323067['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x572496,_0x5e3a02){return function(_0x4a9068){if(!_0x4a9068){_0x572496[_0x5812('0x23')](0x194);}return _0x4a9068;};}function handleError(_0x201dd3,_0x49f95c){_0x49f95c=_0x49f95c||0x1f4;return function(_0x4e083d){logger[_0x5812('0x24')](_0x4e083d[_0x5812('0x25')]);if(_0x4e083d[_0x5812('0x26')]){delete _0x4e083d[_0x5812('0x26')];}_0x201dd3[_0x5812('0x13')](_0x49f95c)['send'](_0x4e083d);};}exports[_0x5812('0x27')]=function(_0x235441,_0x587543){var _0x51ee83={},_0x56de26={},_0x268694={'count':0x0,'rows':[]};var _0x1763e2=_[_0x5812('0x28')](db[_0x5812('0x29')][_0x5812('0x2a')],function(_0x341d2f){return{'name':_0x341d2f['fieldName'],'type':_0x341d2f[_0x5812('0x2b')]['key']};});_0x56de26[_0x5812('0x2c')]=_[_0x5812('0x28')](_0x1763e2,_0x5812('0x26'));_0x56de26[_0x5812('0x2d')]=_[_0x5812('0x2e')](_0x235441[_0x5812('0x2d')]);_0x56de26[_0x5812('0x2f')]=_['intersection'](_0x56de26[_0x5812('0x2c')],_0x56de26[_0x5812('0x2d')]);_0x51ee83['attributes']=_[_0x5812('0x30')](_0x56de26[_0x5812('0x2c')],qs[_0x5812('0x31')](_0x235441[_0x5812('0x2d')][_0x5812('0x31')]));_0x51ee83[_0x5812('0x32')]=_0x51ee83[_0x5812('0x32')]['length']?_0x51ee83[_0x5812('0x32')]:_0x56de26[_0x5812('0x2c')];if(!_0x235441[_0x5812('0x2d')]['hasOwnProperty'](_0x5812('0x33'))){_0x51ee83[_0x5812('0x18')]=qs[_0x5812('0x18')](_0x235441[_0x5812('0x2d')]['limit']);_0x51ee83[_0x5812('0x17')]=qs['offset'](_0x235441[_0x5812('0x2d')]['offset']);}_0x51ee83[_0x5812('0x34')]=qs[_0x5812('0x35')](_0x235441[_0x5812('0x2d')]['sort']);_0x51ee83[_0x5812('0x36')]=qs[_0x5812('0x2f')](_['pick'](_0x235441[_0x5812('0x2d')],_0x56de26['filters']),_0x1763e2);if(_0x235441[_0x5812('0x2d')][_0x5812('0x37')]){_0x51ee83['where']=_[_0x5812('0x38')](_0x51ee83[_0x5812('0x36')],{'$or':_['map'](_0x1763e2,function(_0x6f135f){if(_0x6f135f[_0x5812('0x2b')]!==_0x5812('0x39')){var _0x3a78ed={};_0x3a78ed[_0x6f135f[_0x5812('0x26')]]={'$like':'%'+_0x235441[_0x5812('0x2d')][_0x5812('0x37')]+'%'};return _0x3a78ed;}})});}_0x51ee83=_['merge']({},_0x51ee83,_0x235441[_0x5812('0x3a')]);var _0x162892={'where':_0x51ee83['where']};return db['Sound']['count'](_0x162892)[_0x5812('0x22')](function(_0x494878){_0x268694[_0x5812('0x16')]=_0x494878;if(_0x235441[_0x5812('0x2d')][_0x5812('0x3b')]){_0x51ee83[_0x5812('0x3c')]=[{'all':!![]}];}return db[_0x5812('0x29')]['findAll'](_0x51ee83);})['then'](function(_0x1d9724){_0x268694[_0x5812('0x3d')]=_0x1d9724;return _0x268694;})['then'](respondWithFilteredResult(_0x587543,_0x51ee83))[_0x5812('0x3e')](handleError(_0x587543,null));};exports['show']=function(_0x21d30d,_0x533c2e){var _0x1c79d3={'raw':!![],'where':{'id':_0x21d30d[_0x5812('0x3f')]['id']}},_0x639bd1={};_0x639bd1[_0x5812('0x2c')]=_['keys'](db['Sound'][_0x5812('0x2a')]);_0x639bd1['query']=_[_0x5812('0x2e')](_0x21d30d[_0x5812('0x2d')]);_0x639bd1[_0x5812('0x2f')]=_[_0x5812('0x30')](_0x639bd1[_0x5812('0x2c')],_0x639bd1[_0x5812('0x2d')]);_0x1c79d3['attributes']=_[_0x5812('0x30')](_0x639bd1[_0x5812('0x2c')],qs[_0x5812('0x31')](_0x21d30d[_0x5812('0x2d')]['fields']));_0x1c79d3[_0x5812('0x32')]=_0x1c79d3[_0x5812('0x32')][_0x5812('0x40')]?_0x1c79d3['attributes']:_0x639bd1[_0x5812('0x2c')];if(_0x21d30d[_0x5812('0x2d')][_0x5812('0x3b')]){_0x1c79d3[_0x5812('0x3c')]=[{'all':!![]}];}_0x1c79d3=_[_0x5812('0x38')]({},_0x1c79d3,_0x21d30d[_0x5812('0x3a')]);return db[_0x5812('0x29')][_0x5812('0x41')](_0x1c79d3)[_0x5812('0x22')](handleEntityNotFound(_0x533c2e,null))[_0x5812('0x22')](respondWithResult(_0x533c2e,null))[_0x5812('0x3e')](handleError(_0x533c2e,null));};exports[_0x5812('0x42')]=function(_0x4c4589,_0x5bb0dc,_0x124c57){return db[_0x5812('0x29')][_0x5812('0x41')]({'where':{'id':_0x4c4589[_0x5812('0x3f')]['id']},'attributes':[_0x5812('0x26'),'save_name','converted_format'],'raw':!![]})[_0x5812('0x22')](handleEntityNotFound(_0x5bb0dc,null))['then'](function(_0x45d21a){if(_0x45d21a){if(!fs[_0x5812('0x43')](path[_0x5812('0x44')](config[_0x5812('0x45')],_0x5812('0x46'),_0x45d21a[_0x5812('0x47')]+'.'+_0x45d21a['converted_format']))){throw new db['Sequelize']['ValidationError'](_0x5812('0x48'));}return _0x5bb0dc['download'](path[_0x5812('0x44')](config[_0x5812('0x45')],_0x5812('0x46'),util[_0x5812('0x49')](_0x5812('0x4a'),_0x45d21a[_0x5812('0x47')],_0x45d21a[_0x5812('0x4b')])),util[_0x5812('0x49')](_0x5812('0x4a'),_0x45d21a[_0x5812('0x26')],_0x45d21a[_0x5812('0x4b')]));}return null;})[_0x5812('0x3e')](handleError(_0x5bb0dc,null));};exports[_0x5812('0x4c')]=function(_0x40cab5,_0xacbc94,_0x1c35cb){var _0x324e83={'name':path[_0x5812('0x4d')](_0x40cab5['file']['originalname'],path[_0x5812('0x4e')](_0x40cab5[_0x5812('0x4f')][_0x5812('0x50')])),'save_name':path[_0x5812('0x4d')](_0x40cab5['file'][_0x5812('0x51')],path[_0x5812('0x4e')](_0x40cab5['file'][_0x5812('0x51')])),'original_format':path[_0x5812('0x4e')](_0x40cab5[_0x5812('0x4f')]['originalname'])[_0x5812('0x52')](0x1),'converted_format':'wav'};var _0xa6972c=path[_0x5812('0x44')](config[_0x5812('0x45')],_0x5812('0x53'),_0x40cab5[_0x5812('0x4f')][_0x5812('0x51')]);var _0x4c456a=path['join'](config['root'],_0x5812('0x46'),util[_0x5812('0x49')](_0x5812('0x4a'),path['basename'](_0x40cab5[_0x5812('0x4f')][_0x5812('0x51')],path[_0x5812('0x4e')](_0x40cab5[_0x5812('0x4f')][_0x5812('0x51')])),_0x324e83[_0x5812('0x4b')]));logger['info'](_0x5812('0x54'),_0xa6972c);logger[_0x5812('0x55')](_0x5812('0x56'),_0x4c456a);try{fs['chmodSync'](_0xa6972c,parseInt(_0x5812('0x57'),0x8));var _0x113fbe=sox[_0x5812('0x58')](_0xa6972c,_0x4c456a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x113fbe['on'](_0x5812('0x24'),function(_0xb9e1a6){fs['unlinkSync'](_0xa6972c);_0xacbc94['status'](0x1f4)[_0x5812('0x59')](_0xb9e1a6);});_0x113fbe['on'](_0x5812('0x5a'),function(_0x15cea5){_0x324e83['original_duration']=isNaN(_0x15cea5[_0x5812('0x5b')])?null:_0x15cea5[_0x5812('0x5b')]*0x3e8;_0x324e83[_0x5812('0x5c')]=isNaN(_0x15cea5['sampleCount'])?null:_0x15cea5[_0x5812('0x5d')];_0x324e83[_0x5812('0x5e')]=isNaN(_0x15cea5[_0x5812('0x5f')])?null:_0x15cea5['channelCount'];_0x324e83[_0x5812('0x60')]=isNaN(_0x15cea5[_0x5812('0x61')])?null:_0x15cea5[_0x5812('0x61')];_0x324e83[_0x5812('0x62')]=isNaN(_0x15cea5[_0x5812('0x63')])?null:_0x15cea5[_0x5812('0x63')];});_0x113fbe['on']('dest',function(_0x550356){_0x324e83[_0x5812('0x64')]=isNaN(_0x550356[_0x5812('0x5b')])?null:_0x550356[_0x5812('0x5b')]*0x3e8;_0x324e83[_0x5812('0x65')]=isNaN(_0x550356[_0x5812('0x5d')])?null:_0x550356[_0x5812('0x5d')];_0x324e83[_0x5812('0x66')]=isNaN(_0x550356[_0x5812('0x5f')])?null:_0x550356[_0x5812('0x5f')];_0x324e83[_0x5812('0x67')]=isNaN(_0x550356['bitRate'])?null:_0x550356[_0x5812('0x61')];_0x324e83[_0x5812('0x68')]=isNaN(_0x550356[_0x5812('0x63')])?null:_0x550356[_0x5812('0x63')];});_0x113fbe['on'](_0x5812('0x14'),function(){fs[_0x5812('0x69')](_0x4c456a,parseInt(_0x5812('0x57'),0x8));return db[_0x5812('0x29')]['create'](_0x324e83)[_0x5812('0x22')](function(_0x18e284){var _0x25629f={'role':_0x40cab5['body']['role'],'userProfileId':_0x40cab5[_0x5812('0x6a')][_0x5812('0x6b')]};if(!_0x25629f)throw new Error(_0x5812('0x6c'));if(_0x25629f[_0x5812('0x6d')]===_0x5812('0x6e')){var _0x4849a1=_0x18e284[_0x5812('0x1f')]({'plain':!![]});return db[_0x5812('0x6f')][_0x5812('0x41')]({'where':{'name':'Sounds','userProfileId':_0x25629f[_0x5812('0x6b')]},'raw':!![]})[_0x5812('0x22')](function(_0x4c902f){if(_0x4c902f&&_0x4c902f[_0x5812('0x70')]===0x0){return db[_0x5812('0x21')]['create']({'name':_0x4849a1[_0x5812('0x26')],'resourceId':_0x4849a1['id'],'type':_0x4c902f[_0x5812('0x26')],'sectionId':_0x4c902f['id']},{})[_0x5812('0x22')](function(){return _0x18e284;});}else{return _0x18e284;}})[_0x5812('0x3e')](function(_0x8cf205){logger[_0x5812('0x24')](_0x5812('0x71'),_0x8cf205);throw _0x8cf205;});}return _0x18e284;})[_0x5812('0x22')](respondWithResult(_0xacbc94,null))[_0x5812('0x3e')](handleError(_0xacbc94,null));});_0x113fbe[_0x5812('0x72')]();}catch(_0x59af60){_0xacbc94[_0x5812('0x13')](0x1f4)[_0x5812('0x59')](_0x59af60);}};exports[_0x5812('0x1e')]=function(_0x4de17a,_0x3b8a7e,_0x5559ce){return db[_0x5812('0x29')][_0x5812('0x41')]({'where':{'id':_0x4de17a[_0x5812('0x3f')]['id']}})[_0x5812('0x22')](handleEntityNotFound(_0x3b8a7e,null))[_0x5812('0x22')](saveUpdates(_['pick'](_0x4de17a[_0x5812('0x6a')],[_0x5812('0x26'),_0x5812('0x73')]),null))[_0x5812('0x22')](respondWithResult(_0x3b8a7e,null))[_0x5812('0x3e')](handleError(_0x3b8a7e,null));};exports['delete']=function(_0x488f95,_0x30045d,_0x197f9d){return db[_0x5812('0x29')][_0x5812('0x41')]({'where':{'id':_0x488f95[_0x5812('0x3f')]['id']}})[_0x5812('0x22')](function(_0x1a9bc1){if(_0x1a9bc1){return _0x1a9bc1['destroy']();}})[_0x5812('0x22')](function(_0x47c358){var _0x3f45b6=path['join'](config[_0x5812('0x45')],_0x5812('0x53'),util['format']('%s.%s',_0x47c358[_0x5812('0x47')],_0x47c358['original_format']));var _0x5a3b99=path[_0x5812('0x44')](config[_0x5812('0x45')],_0x5812('0x46'),util[_0x5812('0x49')](_0x5812('0x4a'),_0x47c358[_0x5812('0x47')],_0x47c358[_0x5812('0x4b')]));fs[_0x5812('0x74')](_0x3f45b6);fs[_0x5812('0x74')](_0x5a3b99);return _0x47c358;})[_0x5812('0x22')](function(_0x1aee6a){if(_0x1aee6a){return _0x30045d[_0x5812('0x13')](0xcc)[_0x5812('0x14')]();}})[_0x5812('0x22')](handleEntityNotFound(_0x30045d,null))[_0x5812('0x3e')](handleError(_0x30045d,null));}; \ No newline at end of file +var _0xbb31=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','status','sendStatus','error','stack','send','map','Sound','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','name','count','includeAll','include','rows','catch','show','params','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s','basename','originalname','extname','file','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2b2eed,_0x177b13){var _0x532919=function(_0x427352){while(--_0x427352){_0x2b2eed['push'](_0x2b2eed['shift']());}};_0x532919(++_0x177b13);}(_0xbb31,0x1ef));var _0x1bb3=function(_0x2b7ec1,_0x41d6a4){_0x2b7ec1=_0x2b7ec1-0x0;var _0x552228=_0xbb31[_0x2b7ec1];return _0x552228;};'use strict';var pdf=require(_0x1bb3('0x0'));var emlformat=require(_0x1bb3('0x1'));var rimraf=require(_0x1bb3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bb3('0x3'));var rp=require(_0x1bb3('0x4'));var moment=require(_0x1bb3('0x5'));var BPromise=require(_0x1bb3('0x6'));var Mustache=require(_0x1bb3('0x7'));var util=require(_0x1bb3('0x8'));var path=require('path');var sox=require(_0x1bb3('0x9'));var csv=require(_0x1bb3('0xa'));var ejs=require(_0x1bb3('0xb'));var fs=require('fs');var _=require(_0x1bb3('0xc'));var squel=require(_0x1bb3('0xd'));var crypto=require(_0x1bb3('0xe'));var jsforce=require(_0x1bb3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1bb3('0xa'));var querystring=require(_0x1bb3('0x10'));var Papa=require(_0x1bb3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1bb3('0x12'));var as=require(_0x1bb3('0x13'));var hardwareService=require(_0x1bb3('0x14'));var logger=require(_0x1bb3('0x15'))(_0x1bb3('0x16'));var utils=require(_0x1bb3('0x17'));var config=require('../../config/environment');var db=require(_0x1bb3('0x18'))['db'];function respondWithStatusCode(_0x16a11c,_0x48a860){_0x48a860=_0x48a860||0xcc;return function(_0x2181cc){if(_0x2181cc){return _0x16a11c['sendStatus'](_0x48a860);}return _0x16a11c['status'](_0x48a860)[_0x1bb3('0x19')]();};}function respondWithResult(_0x15860e,_0x358436){_0x358436=_0x358436||0xc8;return function(_0x42ade9){if(_0x42ade9){return _0x15860e['status'](_0x358436)[_0x1bb3('0x1a')](_0x42ade9);}};}function respondWithFilteredResult(_0x35fa3f,_0x5241c4){return function(_0xd09733){if(_0xd09733){var _0x4eda21=_0xd09733['count'],_0x5a0165=_0x5241c4[_0x1bb3('0x1b')],_0x2da9c5=_0x5241c4[_0x1bb3('0x1b')]+_0x5241c4[_0x1bb3('0x1c')],_0x10963e;if(_0x2da9c5>=_0x4eda21){_0x2da9c5=_0x4eda21;_0x10963e=0xc8;}else{_0x10963e=0xce;}_0x35fa3f['status'](_0x10963e);return _0x35fa3f[_0x1bb3('0x1d')](_0x1bb3('0x1e'),_0x5a0165+'-'+_0x2da9c5+'/'+_0x4eda21)['json'](_0xd09733);}return null;};}function patchUpdates(_0x3521f5){return function(_0x37c7f6){try{jsonpatch[_0x1bb3('0x1f')](_0x37c7f6,_0x3521f5,!![]);}catch(_0x527111){return BPromise[_0x1bb3('0x20')](_0x527111);}return _0x37c7f6[_0x1bb3('0x21')]();};}function saveUpdates(_0x20cf8b,_0x606ee3){return function(_0x15ef2a){if(_0x15ef2a){return _0x15ef2a[_0x1bb3('0x22')](_0x20cf8b)[_0x1bb3('0x23')](function(_0x2cd81e){return _0x2cd81e;});}return null;};}function removeEntity(_0x1eb86b,_0x2612c3){return function(_0x4e67cc){if(_0x4e67cc){return _0x4e67cc[_0x1bb3('0x24')]()[_0x1bb3('0x23')](function(){var _0x54f943=_0x4e67cc[_0x1bb3('0x25')]({'plain':!![]});var _0x188a32=_0x1bb3('0x26');return db[_0x1bb3('0x27')]['destroy']({'where':{'type':_0x188a32,'resourceId':_0x54f943['id']}})[_0x1bb3('0x23')](function(){return _0x4e67cc;});})[_0x1bb3('0x23')](function(){_0x1eb86b[_0x1bb3('0x28')](0xcc)[_0x1bb3('0x19')]();});}};}function handleEntityNotFound(_0x2373af,_0x4d3d56){return function(_0x41f40f){if(!_0x41f40f){_0x2373af[_0x1bb3('0x29')](0x194);}return _0x41f40f;};}function handleError(_0x5338a2,_0x27f6dd){_0x27f6dd=_0x27f6dd||0x1f4;return function(_0x8d4a9){logger[_0x1bb3('0x2a')](_0x8d4a9[_0x1bb3('0x2b')]);if(_0x8d4a9['name']){delete _0x8d4a9['name'];}_0x5338a2[_0x1bb3('0x28')](_0x27f6dd)[_0x1bb3('0x2c')](_0x8d4a9);};}exports['index']=function(_0x1d43bf,_0x31f23a){var _0x465c13={},_0x777501={},_0x2b3113={'count':0x0,'rows':[]};var _0x3ade49=_[_0x1bb3('0x2d')](db[_0x1bb3('0x2e')]['rawAttributes'],function(_0x22fe13){return{'name':_0x22fe13['fieldName'],'type':_0x22fe13['type'][_0x1bb3('0x2f')]};});_0x777501['model']=_['map'](_0x3ade49,'name');_0x777501['query']=_[_0x1bb3('0x30')](_0x1d43bf[_0x1bb3('0x31')]);_0x777501[_0x1bb3('0x32')]=_[_0x1bb3('0x33')](_0x777501[_0x1bb3('0x34')],_0x777501[_0x1bb3('0x31')]);_0x465c13[_0x1bb3('0x35')]=_['intersection'](_0x777501[_0x1bb3('0x34')],qs['fields'](_0x1d43bf[_0x1bb3('0x31')][_0x1bb3('0x36')]));_0x465c13[_0x1bb3('0x35')]=_0x465c13['attributes'][_0x1bb3('0x37')]?_0x465c13[_0x1bb3('0x35')]:_0x777501[_0x1bb3('0x34')];if(!_0x1d43bf[_0x1bb3('0x31')][_0x1bb3('0x38')](_0x1bb3('0x39'))){_0x465c13['limit']=qs[_0x1bb3('0x1c')](_0x1d43bf['query'][_0x1bb3('0x1c')]);_0x465c13[_0x1bb3('0x1b')]=qs[_0x1bb3('0x1b')](_0x1d43bf[_0x1bb3('0x31')][_0x1bb3('0x1b')]);}_0x465c13[_0x1bb3('0x3a')]=qs['sort'](_0x1d43bf[_0x1bb3('0x31')]['sort']);_0x465c13[_0x1bb3('0x3b')]=qs[_0x1bb3('0x32')](_[_0x1bb3('0x3c')](_0x1d43bf[_0x1bb3('0x31')],_0x777501[_0x1bb3('0x32')]),_0x3ade49);if(_0x1d43bf['query'][_0x1bb3('0x3d')]){_0x465c13['where']=_[_0x1bb3('0x3e')](_0x465c13[_0x1bb3('0x3b')],{'$or':_['map'](_0x3ade49,function(_0x5cddca){if(_0x5cddca[_0x1bb3('0x3f')]!==_0x1bb3('0x40')){var _0x416a33={};_0x416a33[_0x5cddca[_0x1bb3('0x41')]]={'$like':'%'+_0x1d43bf[_0x1bb3('0x31')][_0x1bb3('0x3d')]+'%'};return _0x416a33;}})});}_0x465c13=_[_0x1bb3('0x3e')]({},_0x465c13,_0x1d43bf['options']);var _0x5c0a03={'where':_0x465c13[_0x1bb3('0x3b')]};return db[_0x1bb3('0x2e')]['count'](_0x5c0a03)[_0x1bb3('0x23')](function(_0x48d486){_0x2b3113[_0x1bb3('0x42')]=_0x48d486;if(_0x1d43bf[_0x1bb3('0x31')][_0x1bb3('0x43')]){_0x465c13[_0x1bb3('0x44')]=[{'all':!![]}];}return db[_0x1bb3('0x2e')]['findAll'](_0x465c13);})[_0x1bb3('0x23')](function(_0x18993b){_0x2b3113[_0x1bb3('0x45')]=_0x18993b;return _0x2b3113;})[_0x1bb3('0x23')](respondWithFilteredResult(_0x31f23a,_0x465c13))[_0x1bb3('0x46')](handleError(_0x31f23a,null));};exports[_0x1bb3('0x47')]=function(_0x2b2713,_0x556727){var _0x584bb4={'raw':!![],'where':{'id':_0x2b2713[_0x1bb3('0x48')]['id']}},_0x86e772={};_0x86e772['model']=_[_0x1bb3('0x30')](db[_0x1bb3('0x2e')]['rawAttributes']);_0x86e772[_0x1bb3('0x31')]=_[_0x1bb3('0x30')](_0x2b2713[_0x1bb3('0x31')]);_0x86e772[_0x1bb3('0x32')]=_[_0x1bb3('0x33')](_0x86e772['model'],_0x86e772[_0x1bb3('0x31')]);_0x584bb4[_0x1bb3('0x35')]=_[_0x1bb3('0x33')](_0x86e772['model'],qs[_0x1bb3('0x36')](_0x2b2713[_0x1bb3('0x31')][_0x1bb3('0x36')]));_0x584bb4['attributes']=_0x584bb4['attributes'][_0x1bb3('0x37')]?_0x584bb4['attributes']:_0x86e772[_0x1bb3('0x34')];if(_0x2b2713[_0x1bb3('0x31')][_0x1bb3('0x43')]){_0x584bb4[_0x1bb3('0x44')]=[{'all':!![]}];}_0x584bb4=_[_0x1bb3('0x3e')]({},_0x584bb4,_0x2b2713[_0x1bb3('0x49')]);return db[_0x1bb3('0x2e')][_0x1bb3('0x4a')](_0x584bb4)[_0x1bb3('0x23')](handleEntityNotFound(_0x556727,null))[_0x1bb3('0x23')](respondWithResult(_0x556727,null))[_0x1bb3('0x46')](handleError(_0x556727,null));};exports[_0x1bb3('0x4b')]=function(_0x64fd77,_0x51259c,_0xa14ef2){return db['Sound'][_0x1bb3('0x4a')]({'where':{'id':_0x64fd77[_0x1bb3('0x48')]['id']},'attributes':['name',_0x1bb3('0x4c'),_0x1bb3('0x4d')],'raw':!![]})[_0x1bb3('0x23')](handleEntityNotFound(_0x51259c,null))[_0x1bb3('0x23')](function(_0x3a0184){if(_0x3a0184){if(!fs[_0x1bb3('0x4e')](path[_0x1bb3('0x4f')](config[_0x1bb3('0x50')],'server/files/sounds/converted',_0x3a0184[_0x1bb3('0x4c')]+'.'+_0x3a0184[_0x1bb3('0x4d')]))){throw new db[(_0x1bb3('0x51'))][(_0x1bb3('0x52'))]('Sound\x20not\x20found');}return _0x51259c[_0x1bb3('0x4b')](path['join'](config['root'],_0x1bb3('0x53'),util[_0x1bb3('0x54')](_0x1bb3('0x55'),_0x3a0184['save_name'],_0x3a0184['converted_format'])),util[_0x1bb3('0x54')](_0x1bb3('0x55'),_0x3a0184[_0x1bb3('0x41')],_0x3a0184[_0x1bb3('0x4d')]));}return null;})[_0x1bb3('0x46')](handleError(_0x51259c,null));};exports['create']=function(_0x314f4b,_0x1f1d66,_0x291b27){var _0x482541={'name':path[_0x1bb3('0x56')](_0x314f4b['file'][_0x1bb3('0x57')],path[_0x1bb3('0x58')](_0x314f4b[_0x1bb3('0x59')][_0x1bb3('0x57')])),'save_name':path[_0x1bb3('0x56')](_0x314f4b['file'][_0x1bb3('0x5a')],path['extname'](_0x314f4b[_0x1bb3('0x59')][_0x1bb3('0x5a')])),'original_format':path[_0x1bb3('0x58')](_0x314f4b[_0x1bb3('0x59')][_0x1bb3('0x57')])['substring'](0x1),'converted_format':_0x1bb3('0x5b')};var _0xd46866=path[_0x1bb3('0x4f')](config['root'],'server/files/sounds/original',_0x314f4b['file']['filename']);var _0x4d6b88=path[_0x1bb3('0x4f')](config['root'],_0x1bb3('0x53'),util[_0x1bb3('0x54')](_0x1bb3('0x55'),path[_0x1bb3('0x56')](_0x314f4b[_0x1bb3('0x59')]['filename'],path[_0x1bb3('0x58')](_0x314f4b['file'][_0x1bb3('0x5a')])),_0x482541[_0x1bb3('0x4d')]));logger[_0x1bb3('0x5c')](_0x1bb3('0x5d'),_0xd46866);logger[_0x1bb3('0x5c')](_0x1bb3('0x5e'),_0x4d6b88);try{fs[_0x1bb3('0x5f')](_0xd46866,parseInt(_0x1bb3('0x60'),0x8));var _0x246499=sox['transcode'](_0xd46866,_0x4d6b88,{'sampleRate':0x1f40,'format':_0x1bb3('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x246499['on']('error',function(_0x2c2ff6){fs[_0x1bb3('0x61')](_0xd46866);_0x1f1d66[_0x1bb3('0x28')](0x1f4)['send'](_0x2c2ff6);});_0x246499['on'](_0x1bb3('0x62'),function(_0x50f132){_0x482541['original_duration']=isNaN(_0x50f132[_0x1bb3('0x63')])?null:_0x50f132['duration']*0x3e8;_0x482541[_0x1bb3('0x64')]=isNaN(_0x50f132[_0x1bb3('0x65')])?null:_0x50f132[_0x1bb3('0x65')];_0x482541[_0x1bb3('0x66')]=isNaN(_0x50f132[_0x1bb3('0x67')])?null:_0x50f132['channelCount'];_0x482541['original_bitRate']=isNaN(_0x50f132[_0x1bb3('0x68')])?null:_0x50f132[_0x1bb3('0x68')];_0x482541[_0x1bb3('0x69')]=isNaN(_0x50f132['sampleRate'])?null:_0x50f132[_0x1bb3('0x6a')];});_0x246499['on'](_0x1bb3('0x6b'),function(_0x21dca5){_0x482541[_0x1bb3('0x6c')]=isNaN(_0x21dca5[_0x1bb3('0x63')])?null:_0x21dca5[_0x1bb3('0x63')]*0x3e8;_0x482541[_0x1bb3('0x6d')]=isNaN(_0x21dca5[_0x1bb3('0x65')])?null:_0x21dca5[_0x1bb3('0x65')];_0x482541[_0x1bb3('0x6e')]=isNaN(_0x21dca5[_0x1bb3('0x67')])?null:_0x21dca5['channelCount'];_0x482541['converted_bitRate']=isNaN(_0x21dca5[_0x1bb3('0x68')])?null:_0x21dca5[_0x1bb3('0x68')];_0x482541[_0x1bb3('0x6f')]=isNaN(_0x21dca5[_0x1bb3('0x6a')])?null:_0x21dca5[_0x1bb3('0x6a')];});_0x246499['on'](_0x1bb3('0x19'),function(){fs['chmodSync'](_0x4d6b88,parseInt(_0x1bb3('0x60'),0x8));return db['Sound'][_0x1bb3('0x70')](_0x482541)['then'](function(_0x312f3a){var _0x57e62a={'role':_0x314f4b[_0x1bb3('0x71')][_0x1bb3('0x72')],'userProfileId':_0x314f4b[_0x1bb3('0x71')]['userProfileId']};if(!_0x57e62a)throw new Error(_0x1bb3('0x73'));if(_0x57e62a['role']===_0x1bb3('0x74')){var _0x5489f7=_0x312f3a[_0x1bb3('0x25')]({'plain':!![]});return db[_0x1bb3('0x75')][_0x1bb3('0x4a')]({'where':{'name':_0x1bb3('0x26'),'userProfileId':_0x57e62a[_0x1bb3('0x76')]},'raw':!![]})[_0x1bb3('0x23')](function(_0x38f440){if(_0x38f440&&_0x38f440[_0x1bb3('0x77')]===0x0){return db[_0x1bb3('0x27')][_0x1bb3('0x70')]({'name':_0x5489f7[_0x1bb3('0x41')],'resourceId':_0x5489f7['id'],'type':_0x38f440[_0x1bb3('0x41')],'sectionId':_0x38f440['id']},{})[_0x1bb3('0x23')](function(){return _0x312f3a;});}else{return _0x312f3a;}})['catch'](function(_0x11c2a5){logger[_0x1bb3('0x2a')](_0x1bb3('0x78'),_0x11c2a5);throw _0x11c2a5;});}return _0x312f3a;})[_0x1bb3('0x23')](respondWithResult(_0x1f1d66,null))[_0x1bb3('0x46')](handleError(_0x1f1d66,null));});_0x246499[_0x1bb3('0x79')]();}catch(_0x2a46d1){_0x1f1d66[_0x1bb3('0x28')](0x1f4)[_0x1bb3('0x2c')](_0x2a46d1);}};exports[_0x1bb3('0x22')]=function(_0x176379,_0x583cb2,_0x1734ad){return db[_0x1bb3('0x2e')][_0x1bb3('0x4a')]({'where':{'id':_0x176379['params']['id']}})[_0x1bb3('0x23')](handleEntityNotFound(_0x583cb2,null))[_0x1bb3('0x23')](saveUpdates(_[_0x1bb3('0x3c')](_0x176379['body'],[_0x1bb3('0x41'),_0x1bb3('0x7a')]),null))[_0x1bb3('0x23')](respondWithResult(_0x583cb2,null))[_0x1bb3('0x46')](handleError(_0x583cb2,null));};exports['delete']=function(_0x277dcc,_0x255ea5,_0x111b29){return db[_0x1bb3('0x2e')][_0x1bb3('0x4a')]({'where':{'id':_0x277dcc['params']['id']}})[_0x1bb3('0x23')](function(_0x195125){if(_0x195125){return _0x195125['destroy']();}})[_0x1bb3('0x23')](function(_0x47313d){var _0x1d4224=path[_0x1bb3('0x4f')](config[_0x1bb3('0x50')],'server/files/sounds/original',util[_0x1bb3('0x54')]('%s.%s',_0x47313d['save_name'],_0x47313d['original_format']));var _0x2a800e=path[_0x1bb3('0x4f')](config['root'],_0x1bb3('0x53'),util[_0x1bb3('0x54')](_0x1bb3('0x55'),_0x47313d['save_name'],_0x47313d[_0x1bb3('0x4d')]));fs[_0x1bb3('0x61')](_0x1d4224);fs[_0x1bb3('0x61')](_0x2a800e);return _0x47313d;})['then'](function(_0x22dd4e){if(_0x22dd4e){return _0x255ea5[_0x1bb3('0x28')](0xcc)[_0x1bb3('0x19')]();}})[_0x1bb3('0x23')](handleEntityNotFound(_0x255ea5,null))[_0x1bb3('0x46')](handleError(_0x255ea5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 215ec3b..38895ab 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 _0xad4a=['request-promise','path','../../config/environment','exports','define','tools_sounds','lodash','bluebird'];(function(_0x185c9c,_0x913754){var _0x29e524=function(_0x16b967){while(--_0x16b967){_0x185c9c['push'](_0x185c9c['shift']());}};_0x29e524(++_0x913754);}(_0xad4a,0x136));var _0xaad4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xad4a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaad4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaad4('0x1'));var rp=require(_0xaad4('0x2'));var fs=require('fs');var path=require(_0xaad4('0x3'));var rimraf=require('rimraf');var config=require(_0xaad4('0x4'));var attributes=require('./sound.attributes');module[_0xaad4('0x5')]=function(_0xa53b0f,_0x43333e){return _0xa53b0f[_0xaad4('0x6')]('Sound',attributes,{'tableName':_0xaad4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b1f=['api','bluebird','path','rimraf','./sound.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x2873d2,_0x3178b6){var _0x31b7c1=function(_0x869dec){while(--_0x869dec){_0x2873d2['push'](_0x2873d2['shift']());}};_0x31b7c1(++_0x3178b6);}(_0x5b1f,0x9d));var _0xf5b1=function(_0xb741b9,_0x1b64ad){_0xb741b9=_0xb741b9-0x0;var _0x483e52=_0x5b1f[_0xb741b9];return _0x483e52;};'use strict';var _=require(_0xf5b1('0x0'));var util=require(_0xf5b1('0x1'));var logger=require(_0xf5b1('0x2'))(_0xf5b1('0x3'));var moment=require('moment');var BPromise=require(_0xf5b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5b1('0x5'));var rimraf=require(_0xf5b1('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5b1('0x7'));module[_0xf5b1('0x8')]=function(_0x51074c,_0x3dc9dd){return _0x51074c[_0xf5b1('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 4753f5c..4553843 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 _0x0924=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','then','lodash','util','moment','bluebird'];(function(_0xff2b04,_0x526c13){var _0x37fd3d=function(_0x26167c){while(--_0x26167c){_0xff2b04['push'](_0xff2b04['shift']());}};_0x37fd3d(++_0x526c13);}(_0x0924,0x15c));var _0x4092=function(_0x5d92d2,_0x399d73){_0x5d92d2=_0x5d92d2-0x0;var _0x5e6d11=_0x0924[_0x5d92d2];return _0x5e6d11;};'use strict';var _=require(_0x4092('0x0'));var util=require(_0x4092('0x1'));var moment=require(_0x4092('0x2'));var BPromise=require(_0x4092('0x3'));var rs=require(_0x4092('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4092('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4092('0x6'));var config=require('../../config/environment');var jayson=require(_0x4092('0x7'));var client=jayson[_0x4092('0x8')][_0x4092('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ad05a,_0x2afa1e,_0x375e8c){return new BPromise(function(_0x10ec3a,_0x461b98){return client[_0x4092('0xa')](_0x2ad05a,_0x375e8c)['then'](function(_0x55633d){logger[_0x4092('0xb')](_0x4092('0xc'),_0x2afa1e,_0x4092('0xd'));logger[_0x4092('0xe')](_0x4092('0xf'),_0x2afa1e,_0x4092('0xd'),JSON['stringify'](_0x55633d));if(_0x55633d['error']){if(_0x55633d['error'][_0x4092('0x10')]===0x1f4){logger[_0x4092('0x11')]('Sound,\x20%s,\x20%s',_0x2afa1e,_0x55633d[_0x4092('0x11')][_0x4092('0x12')]);return _0x461b98(_0x55633d[_0x4092('0x11')][_0x4092('0x12')]);}logger[_0x4092('0x11')]('Sound,\x20%s,\x20%s',_0x2afa1e,_0x55633d[_0x4092('0x11')][_0x4092('0x12')]);return _0x10ec3a(_0x55633d[_0x4092('0x11')][_0x4092('0x12')]);}else{logger[_0x4092('0xb')](_0x4092('0xc'),_0x2afa1e,_0x4092('0xd'));_0x10ec3a(_0x55633d[_0x4092('0x13')][_0x4092('0x12')]);}})[_0x4092('0x14')](function(_0x471c58){logger[_0x4092('0x11')]('Sound,\x20%s,\x20%s',_0x2afa1e,_0x471c58);_0x461b98(_0x471c58);});});}exports[_0x4092('0x15')]=function(_0x1d0efa){var _0x233a7f=this;return new Promise(function(_0x307615,_0x5c909d){return db[_0x4092('0x16')][_0x4092('0x17')]({'raw':_0x1d0efa['options']?_0x1d0efa[_0x4092('0x18')][_0x4092('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0efa[_0x4092('0x18')]?_0x1d0efa[_0x4092('0x18')][_0x4092('0x1a')]||null:null,'attributes':_0x1d0efa[_0x4092('0x18')]?_0x1d0efa['options']['attributes']||null:null,'include':_0x1d0efa[_0x4092('0x18')]?_0x1d0efa['options'][_0x4092('0x1b')]?_[_0x4092('0x1c')](_0x1d0efa['options'][_0x4092('0x1b')],function(_0x7e768b){return{'model':db[_0x7e768b[_0x4092('0x1d')]],'as':_0x7e768b['as'],'attributes':_0x7e768b[_0x4092('0x1e')],'include':_0x7e768b['include']?_[_0x4092('0x1c')](_0x7e768b[_0x4092('0x1b')],function(_0x4789da){return{'model':db[_0x4789da[_0x4092('0x1d')]],'as':_0x4789da['as'],'attributes':_0x4789da[_0x4092('0x1e')],'include':_0x4789da['include']?_[_0x4092('0x1c')](_0x4789da[_0x4092('0x1b')],function(_0x321494){return{'model':db[_0x321494[_0x4092('0x1d')]],'as':_0x321494['as'],'attributes':_0x321494[_0x4092('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4092('0x1f')](function(_0x14eff5){logger['info'](_0x4092('0x15'),_0x1d0efa);logger[_0x4092('0xe')]('ShowSound',_0x1d0efa,JSON['stringify'](_0x14eff5));_0x307615(_0x14eff5);})[_0x4092('0x14')](function(_0x1ec15d){logger[_0x4092('0x11')](_0x4092('0x15'),_0x1ec15d[_0x4092('0x12')],_0x1d0efa);_0x5c909d(_0x233a7f[_0x4092('0x11')](0x1f4,_0x1ec15d['message']));});});}; \ No newline at end of file +var _0xa091=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','code','Sound,\x20%s,\x20%s','error','message','result','catch','find','raw','options','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x533d26,_0x3f58ca){var _0x197c6a=function(_0x2c3ae1){while(--_0x2c3ae1){_0x533d26['push'](_0x533d26['shift']());}};_0x197c6a(++_0x3f58ca);}(_0xa091,0x159));var _0x1a09=function(_0x573742,_0x1e7b98){_0x573742=_0x573742-0x0;var _0x435313=_0xa091[_0x573742];return _0x435313;};'use strict';var _=require(_0x1a09('0x0'));var util=require(_0x1a09('0x1'));var moment=require(_0x1a09('0x2'));var BPromise=require(_0x1a09('0x3'));var rs=require(_0x1a09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a09('0x5'))['db'];var utils=require(_0x1a09('0x6'));var logger=require(_0x1a09('0x7'))('rpc');var config=require(_0x1a09('0x8'));var jayson=require(_0x1a09('0x9'));var client=jayson[_0x1a09('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417b4e,_0x2f35af,_0x7dd8c2){return new BPromise(function(_0x190894,_0xcf4901){return client[_0x1a09('0xb')](_0x417b4e,_0x7dd8c2)[_0x1a09('0xc')](function(_0xdeed8c){logger[_0x1a09('0xd')]('Sound,\x20%s,\x20%s',_0x2f35af,_0x1a09('0xe'));logger[_0x1a09('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x2f35af,_0x1a09('0xe'),JSON[_0x1a09('0x10')](_0xdeed8c));if(_0xdeed8c['error']){if(_0xdeed8c['error'][_0x1a09('0x11')]===0x1f4){logger['error'](_0x1a09('0x12'),_0x2f35af,_0xdeed8c[_0x1a09('0x13')][_0x1a09('0x14')]);return _0xcf4901(_0xdeed8c[_0x1a09('0x13')]['message']);}logger[_0x1a09('0x13')](_0x1a09('0x12'),_0x2f35af,_0xdeed8c[_0x1a09('0x13')][_0x1a09('0x14')]);return _0x190894(_0xdeed8c[_0x1a09('0x13')][_0x1a09('0x14')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x2f35af,_0x1a09('0xe'));_0x190894(_0xdeed8c[_0x1a09('0x15')]['message']);}})[_0x1a09('0x16')](function(_0x503ed4){logger[_0x1a09('0x13')](_0x1a09('0x12'),_0x2f35af,_0x503ed4);_0xcf4901(_0x503ed4);});});}exports['ShowSound']=function(_0x2ee300){var _0x3f956e=this;return new Promise(function(_0x81cb67,_0x63eda2){return db['Sound'][_0x1a09('0x17')]({'raw':_0x2ee300['options']?_0x2ee300['options'][_0x1a09('0x18')]===undefined?!![]:![]:!![],'where':_0x2ee300[_0x1a09('0x19')]?_0x2ee300['options'][_0x1a09('0x1a')]||null:null,'attributes':_0x2ee300[_0x1a09('0x19')]?_0x2ee300[_0x1a09('0x19')][_0x1a09('0x1b')]||null:null,'include':_0x2ee300[_0x1a09('0x19')]?_0x2ee300[_0x1a09('0x19')][_0x1a09('0x1c')]?_[_0x1a09('0x1d')](_0x2ee300['options'][_0x1a09('0x1c')],function(_0x5d5bfe){return{'model':db[_0x5d5bfe['model']],'as':_0x5d5bfe['as'],'attributes':_0x5d5bfe[_0x1a09('0x1b')],'include':_0x5d5bfe[_0x1a09('0x1c')]?_[_0x1a09('0x1d')](_0x5d5bfe[_0x1a09('0x1c')],function(_0x420145){return{'model':db[_0x420145[_0x1a09('0x1e')]],'as':_0x420145['as'],'attributes':_0x420145['attributes'],'include':_0x420145[_0x1a09('0x1c')]?_['map'](_0x420145[_0x1a09('0x1c')],function(_0x569da6){return{'model':db[_0x569da6[_0x1a09('0x1e')]],'as':_0x569da6['as'],'attributes':_0x569da6[_0x1a09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a09('0xc')](function(_0x388d18){logger[_0x1a09('0xd')](_0x1a09('0x1f'),_0x2ee300);logger[_0x1a09('0xf')](_0x1a09('0x1f'),_0x2ee300,JSON[_0x1a09('0x10')](_0x388d18));_0x81cb67(_0x388d18);})[_0x1a09('0x16')](function(_0x5b1e3b){logger[_0x1a09('0x13')]('ShowSound',_0x5b1e3b[_0x1a09('0x14')],_0x2ee300);_0x63eda2(_0x3f956e[_0x1a09('0x13')](0x1f4,_0x5b1e3b[_0x1a09('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 27f2ecb..21a3cce 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 _0xcf22=['../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x4b0daa,_0x586f75){var _0x2c1128=function(_0x426e64){while(--_0x426e64){_0x4b0daa['push'](_0x4b0daa['shift']());}};_0x2c1128(++_0x586f75);}(_0xcf22,0x12d));var _0x2cf2=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xcf22[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x2cf2('0x0'));var util=require(_0x2cf2('0x1'));var path=require('path');var timeout=require(_0x2cf2('0x2'));var express=require('express');var router=express[_0x2cf2('0x3')]();var auth=require(_0x2cf2('0x4'));var interaction=require(_0x2cf2('0x5'));var config=require(_0x2cf2('0x6'));var controller=require(_0x2cf2('0x7'));router[_0x2cf2('0x8')]('/',auth[_0x2cf2('0x9')](),controller[_0x2cf2('0xa')]);router[_0x2cf2('0x8')](_0x2cf2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2cf2('0xc')]('/',auth[_0x2cf2('0x9')](),controller[_0x2cf2('0xd')]);router[_0x2cf2('0xe')](_0x2cf2('0xb'),auth[_0x2cf2('0x9')](),controller[_0x2cf2('0xf')]);router[_0x2cf2('0x10')](_0x2cf2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2cf2('0x11')]=router; \ No newline at end of file +var _0xec09=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x215f0e,_0x3be9d6){var _0x4336d9=function(_0x16afd0){while(--_0x16afd0){_0x215f0e['push'](_0x215f0e['shift']());}};_0x4336d9(++_0x3be9d6);}(_0xec09,0x1ae));var _0x9ec0=function(_0x13cb93,_0x3db572){_0x13cb93=_0x13cb93-0x0;var _0x17a251=_0xec09[_0x13cb93];return _0x17a251;};'use strict';var multer=require(_0x9ec0('0x0'));var util=require(_0x9ec0('0x1'));var path=require('path');var timeout=require(_0x9ec0('0x2'));var express=require(_0x9ec0('0x3'));var router=express[_0x9ec0('0x4')]();var auth=require(_0x9ec0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ec0('0x6'));var controller=require('./squareMessage.controller');router[_0x9ec0('0x7')]('/',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x9')]);router[_0x9ec0('0x7')](_0x9ec0('0xa'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xb')]);router[_0x9ec0('0xc')]('/',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xd')]);router[_0x9ec0('0xe')](_0x9ec0('0xa'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xf')]);router['delete']('/:id',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x10')]);module[_0x9ec0('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 22a6b09..7cac9c7 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 _0x2d42=['sequelize','exports','STRING','TEXT','medium','out'];(function(_0x2c2062,_0xa167fa){var _0x5eb1fb=function(_0x16c437){while(--_0x16c437){_0x2c2062['push'](_0x2c2062['shift']());}};_0x5eb1fb(++_0xa167fa);}(_0x2d42,0xea));var _0x22d4=function(_0x521874,_0x11d0bc){_0x521874=_0x521874-0x0;var _0x16888b=_0x2d42[_0x521874];return _0x16888b;};'use strict';var Sequelize=require(_0x22d4('0x0'));module[_0x22d4('0x1')]={'uniqueid':{'type':Sequelize[_0x22d4('0x2')]},'body':{'type':Sequelize[_0x22d4('0x3')](_0x22d4('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x22d4('0x5')),'defaultValue':_0x22d4('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x3cb6=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x3855c5,_0x34cfc2){var _0x24c32c=function(_0x19579b){while(--_0x19579b){_0x3855c5['push'](_0x3855c5['shift']());}};_0x24c32c(++_0x34cfc2);}(_0x3cb6,0xa0));var _0x63cb=function(_0x3b0d4d,_0x2dbd91){_0x3b0d4d=_0x3b0d4d-0x0;var _0x1e1e6b=_0x3cb6[_0x3b0d4d];return _0x1e1e6b;};'use strict';var Sequelize=require(_0x63cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x63cb('0x1')]},'body':{'type':Sequelize[_0x63cb('0x2')](_0x63cb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x63cb('0x4')]('in',_0x63cb('0x5')),'defaultValue':_0x63cb('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 3234d89..edb57a8 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 _0xf860=['find','create','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','show','params'];(function(_0x5510a6,_0x4975b9){var _0x962a10=function(_0x5cca76){while(--_0x5cca76){_0x5510a6['push'](_0x5510a6['shift']());}};_0x962a10(++_0x4975b9);}(_0xf860,0x1c7));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f86('0x0'));var rimraf=require(_0x0f86('0x1'));var zipdir=require(_0x0f86('0x2'));var jsonpatch=require(_0x0f86('0x3'));var rp=require(_0x0f86('0x4'));var moment=require(_0x0f86('0x5'));var BPromise=require(_0x0f86('0x6'));var Mustache=require(_0x0f86('0x7'));var util=require('util');var path=require(_0x0f86('0x8'));var sox=require('sox');var csv=require(_0x0f86('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f86('0xa'));var squel=require('squel');var crypto=require(_0x0f86('0xb'));var jsforce=require(_0x0f86('0xc'));var deskjs=require(_0x0f86('0xd'));var toCsv=require(_0x0f86('0x9'));var querystring=require(_0x0f86('0xe'));var Papa=require(_0x0f86('0xf'));var Redis=require(_0x0f86('0x10'));var authService=require(_0x0f86('0x11'));var qs=require(_0x0f86('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f86('0x13'));var logger=require(_0x0f86('0x14'))(_0x0f86('0x15'));var utils=require(_0x0f86('0x16'));var config=require(_0x0f86('0x17'));var db=require(_0x0f86('0x18'))['db'];function respondWithStatusCode(_0x3448a9,_0xfd9ac9){_0xfd9ac9=_0xfd9ac9||0xcc;return function(_0x5eb692){if(_0x5eb692){return _0x3448a9['sendStatus'](_0xfd9ac9);}return _0x3448a9[_0x0f86('0x19')](_0xfd9ac9)[_0x0f86('0x1a')]();};}function respondWithResult(_0x490900,_0x277285){_0x277285=_0x277285||0xc8;return function(_0x3b5cd2){if(_0x3b5cd2){return _0x490900[_0x0f86('0x19')](_0x277285)['json'](_0x3b5cd2);}};}function respondWithFilteredResult(_0xa8045c,_0x159855){return function(_0x4358ff){if(_0x4358ff){var _0x50ac62=_0x4358ff[_0x0f86('0x1b')],_0x17ba1c=_0x159855[_0x0f86('0x1c')],_0x3a1e46=_0x159855[_0x0f86('0x1c')]+_0x159855['limit'],_0x7c5282;if(_0x3a1e46>=_0x50ac62){_0x3a1e46=_0x50ac62;_0x7c5282=0xc8;}else{_0x7c5282=0xce;}_0xa8045c[_0x0f86('0x19')](_0x7c5282);return _0xa8045c['set'](_0x0f86('0x1d'),_0x17ba1c+'-'+_0x3a1e46+'/'+_0x50ac62)[_0x0f86('0x1e')](_0x4358ff);}return null;};}function patchUpdates(_0x1a054e){return function(_0x5b2c5f){try{jsonpatch[_0x0f86('0x1f')](_0x5b2c5f,_0x1a054e,!![]);}catch(_0x4f53ae){return BPromise[_0x0f86('0x20')](_0x4f53ae);}return _0x5b2c5f[_0x0f86('0x21')]();};}function saveUpdates(_0x1ef279,_0x1cc47c){return function(_0xf480ea){if(_0xf480ea){return _0xf480ea['update'](_0x1ef279)[_0x0f86('0x22')](function(_0x920d52){return _0x920d52;});}return null;};}function removeEntity(_0x1aea86,_0x415897){return function(_0x316fdf){if(_0x316fdf){return _0x316fdf[_0x0f86('0x23')]()['then'](function(){_0x1aea86['status'](0xcc)[_0x0f86('0x1a')]();});}};}function handleEntityNotFound(_0x818ea5,_0x5d16b0){return function(_0x437a12){if(!_0x437a12){_0x818ea5[_0x0f86('0x24')](0x194);}return _0x437a12;};}function handleError(_0xf19296,_0x4bbdf8){_0x4bbdf8=_0x4bbdf8||0x1f4;return function(_0x1bef20){logger[_0x0f86('0x25')](_0x1bef20[_0x0f86('0x26')]);if(_0x1bef20[_0x0f86('0x27')]){delete _0x1bef20[_0x0f86('0x27')];}_0xf19296[_0x0f86('0x19')](_0x4bbdf8)[_0x0f86('0x28')](_0x1bef20);};}exports[_0x0f86('0x29')]=function(_0x9434db,_0x49ee7d){var _0x18aebd={},_0x52be96={},_0x346707={'count':0x0,'rows':[]};var _0x4268b0=_[_0x0f86('0x2a')](db['SquareMessage'][_0x0f86('0x2b')],function(_0x4d0915){return{'name':_0x4d0915[_0x0f86('0x2c')],'type':_0x4d0915[_0x0f86('0x2d')]['key']};});_0x52be96[_0x0f86('0x2e')]=_[_0x0f86('0x2a')](_0x4268b0,_0x0f86('0x27'));_0x52be96['query']=_[_0x0f86('0x2f')](_0x9434db[_0x0f86('0x30')]);_0x52be96[_0x0f86('0x31')]=_[_0x0f86('0x32')](_0x52be96[_0x0f86('0x2e')],_0x52be96[_0x0f86('0x30')]);_0x18aebd[_0x0f86('0x33')]=_['intersection'](_0x52be96[_0x0f86('0x2e')],qs[_0x0f86('0x34')](_0x9434db['query'][_0x0f86('0x34')]));_0x18aebd['attributes']=_0x18aebd[_0x0f86('0x33')][_0x0f86('0x35')]?_0x18aebd[_0x0f86('0x33')]:_0x52be96[_0x0f86('0x2e')];if(!_0x9434db[_0x0f86('0x30')][_0x0f86('0x36')](_0x0f86('0x37'))){_0x18aebd['limit']=qs[_0x0f86('0x38')](_0x9434db[_0x0f86('0x30')][_0x0f86('0x38')]);_0x18aebd['offset']=qs[_0x0f86('0x1c')](_0x9434db[_0x0f86('0x30')][_0x0f86('0x1c')]);}_0x18aebd[_0x0f86('0x39')]=qs[_0x0f86('0x3a')](_0x9434db[_0x0f86('0x30')][_0x0f86('0x3a')]);_0x18aebd[_0x0f86('0x3b')]=qs[_0x0f86('0x31')](_[_0x0f86('0x3c')](_0x9434db[_0x0f86('0x30')],_0x52be96[_0x0f86('0x31')]),_0x4268b0);if(_0x9434db['query'][_0x0f86('0x3d')]){_0x18aebd[_0x0f86('0x3b')]=_[_0x0f86('0x3e')](_0x18aebd[_0x0f86('0x3b')],{'$or':_[_0x0f86('0x2a')](_0x4268b0,function(_0x18bca9){if(_0x18bca9[_0x0f86('0x2d')]!==_0x0f86('0x3f')){var _0x156a64={};_0x156a64[_0x18bca9[_0x0f86('0x27')]]={'$like':'%'+_0x9434db[_0x0f86('0x30')][_0x0f86('0x3d')]+'%'};return _0x156a64;}})});}_0x18aebd=_[_0x0f86('0x3e')]({},_0x18aebd,_0x9434db['options']);var _0x2ddfaf={'where':_0x18aebd[_0x0f86('0x3b')]};return db[_0x0f86('0x40')]['count'](_0x2ddfaf)[_0x0f86('0x22')](function(_0xf22d18){_0x346707[_0x0f86('0x1b')]=_0xf22d18;if(_0x9434db[_0x0f86('0x30')][_0x0f86('0x41')]){_0x18aebd[_0x0f86('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x0f86('0x43')](_0x18aebd);})[_0x0f86('0x22')](function(_0x1a78e9){_0x346707['rows']=_0x1a78e9;return _0x346707;})['then'](respondWithFilteredResult(_0x49ee7d,_0x18aebd))['catch'](handleError(_0x49ee7d,null));};exports[_0x0f86('0x44')]=function(_0x4e1621,_0x9a87){var _0x445fa6={'raw':!![],'where':{'id':_0x4e1621[_0x0f86('0x45')]['id']}},_0x5eaf5d={};_0x5eaf5d['model']=_[_0x0f86('0x2f')](db[_0x0f86('0x40')]['rawAttributes']);_0x5eaf5d[_0x0f86('0x30')]=_[_0x0f86('0x2f')](_0x4e1621[_0x0f86('0x30')]);_0x5eaf5d['filters']=_[_0x0f86('0x32')](_0x5eaf5d[_0x0f86('0x2e')],_0x5eaf5d[_0x0f86('0x30')]);_0x445fa6[_0x0f86('0x33')]=_[_0x0f86('0x32')](_0x5eaf5d[_0x0f86('0x2e')],qs[_0x0f86('0x34')](_0x4e1621[_0x0f86('0x30')][_0x0f86('0x34')]));_0x445fa6[_0x0f86('0x33')]=_0x445fa6['attributes']['length']?_0x445fa6['attributes']:_0x5eaf5d[_0x0f86('0x2e')];if(_0x4e1621['query']['includeAll']){_0x445fa6[_0x0f86('0x42')]=[{'all':!![]}];}_0x445fa6=_['merge']({},_0x445fa6,_0x4e1621['options']);return db[_0x0f86('0x40')][_0x0f86('0x46')](_0x445fa6)[_0x0f86('0x22')](handleEntityNotFound(_0x9a87,null))['then'](respondWithResult(_0x9a87,null))['catch'](handleError(_0x9a87,null));};exports[_0x0f86('0x47')]=function(_0x5f463b,_0x25eec7){return db[_0x0f86('0x40')][_0x0f86('0x47')](_0x5f463b['body'],{})[_0x0f86('0x22')](respondWithResult(_0x25eec7,0xc9))[_0x0f86('0x48')](handleError(_0x25eec7,null));};exports[_0x0f86('0x49')]=function(_0x8244d8,_0x8fc592){if(_0x8244d8[_0x0f86('0x4a')]['id']){delete _0x8244d8['body']['id'];}return db[_0x0f86('0x40')][_0x0f86('0x46')]({'where':{'id':_0x8244d8[_0x0f86('0x45')]['id']}})[_0x0f86('0x22')](handleEntityNotFound(_0x8fc592,null))['then'](saveUpdates(_0x8244d8[_0x0f86('0x4a')],null))[_0x0f86('0x22')](respondWithResult(_0x8fc592,null))[_0x0f86('0x48')](handleError(_0x8fc592,null));};exports[_0x0f86('0x23')]=function(_0x21e881,_0x521840){return db['SquareMessage'][_0x0f86('0x46')]({'where':{'id':_0x21e881[_0x0f86('0x45')]['id']}})['then'](handleEntityNotFound(_0x521840,null))['then'](removeEntity(_0x521840,null))[_0x0f86('0x48')](handleError(_0x521840,null));}; \ No newline at end of file +var _0x83c1=['params','rawAttributes','find','create','body','update','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','name','send','SquareMessage','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','options','include','rows','show'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x83c1,0x1f1));var _0x183c=function(_0x54cc41,_0x492b9b){_0x54cc41=_0x54cc41-0x0;var _0x3e3c6b=_0x83c1[_0x54cc41];return _0x3e3c6b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x183c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x183c('0x1'));var jsonpatch=require(_0x183c('0x2'));var rp=require(_0x183c('0x3'));var moment=require(_0x183c('0x4'));var BPromise=require(_0x183c('0x5'));var Mustache=require('mustache');var util=require(_0x183c('0x6'));var path=require(_0x183c('0x7'));var sox=require(_0x183c('0x8'));var csv=require(_0x183c('0x9'));var ejs=require(_0x183c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x183c('0xb'));var jsforce=require(_0x183c('0xc'));var deskjs=require(_0x183c('0xd'));var toCsv=require(_0x183c('0x9'));var querystring=require(_0x183c('0xe'));var Papa=require(_0x183c('0xf'));var Redis=require(_0x183c('0x10'));var authService=require(_0x183c('0x11'));var qs=require(_0x183c('0x12'));var as=require(_0x183c('0x13'));var hardwareService=require(_0x183c('0x14'));var logger=require(_0x183c('0x15'))(_0x183c('0x16'));var utils=require(_0x183c('0x17'));var config=require(_0x183c('0x18'));var db=require(_0x183c('0x19'))['db'];function respondWithStatusCode(_0x2ee8f8,_0x1f9e41){_0x1f9e41=_0x1f9e41||0xcc;return function(_0x3474b2){if(_0x3474b2){return _0x2ee8f8[_0x183c('0x1a')](_0x1f9e41);}return _0x2ee8f8['status'](_0x1f9e41)['end']();};}function respondWithResult(_0x5e5346,_0x127e04){_0x127e04=_0x127e04||0xc8;return function(_0x204892){if(_0x204892){return _0x5e5346[_0x183c('0x1b')](_0x127e04)['json'](_0x204892);}};}function respondWithFilteredResult(_0x1dfc40,_0x4239e2){return function(_0xf0bd09){if(_0xf0bd09){var _0x1aa3ef=_0xf0bd09[_0x183c('0x1c')],_0x2b174c=_0x4239e2[_0x183c('0x1d')],_0x1c6007=_0x4239e2[_0x183c('0x1d')]+_0x4239e2[_0x183c('0x1e')],_0x2a4372;if(_0x1c6007>=_0x1aa3ef){_0x1c6007=_0x1aa3ef;_0x2a4372=0xc8;}else{_0x2a4372=0xce;}_0x1dfc40[_0x183c('0x1b')](_0x2a4372);return _0x1dfc40[_0x183c('0x1f')](_0x183c('0x20'),_0x2b174c+'-'+_0x1c6007+'/'+_0x1aa3ef)[_0x183c('0x21')](_0xf0bd09);}return null;};}function patchUpdates(_0x1d72a3){return function(_0x15f846){try{jsonpatch[_0x183c('0x22')](_0x15f846,_0x1d72a3,!![]);}catch(_0x574865){return BPromise[_0x183c('0x23')](_0x574865);}return _0x15f846[_0x183c('0x24')]();};}function saveUpdates(_0x14167f,_0x401c12){return function(_0x4a397e){if(_0x4a397e){return _0x4a397e['update'](_0x14167f)['then'](function(_0x48ad39){return _0x48ad39;});}return null;};}function removeEntity(_0x1897b9,_0x6ef79d){return function(_0x2a9864){if(_0x2a9864){return _0x2a9864[_0x183c('0x25')]()[_0x183c('0x26')](function(){_0x1897b9[_0x183c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e659,_0x231e6c){return function(_0x2dad0a){if(!_0x2dad0a){_0x56e659[_0x183c('0x1a')](0x194);}return _0x2dad0a;};}function handleError(_0x3c640f,_0x5e087c){_0x5e087c=_0x5e087c||0x1f4;return function(_0x51746d){logger[_0x183c('0x27')](_0x51746d['stack']);if(_0x51746d['name']){delete _0x51746d[_0x183c('0x28')];}_0x3c640f['status'](_0x5e087c)[_0x183c('0x29')](_0x51746d);};}exports['index']=function(_0x2a2943,_0x2ec937){var _0xa43927={},_0xa8ccd5={},_0x4090a1={'count':0x0,'rows':[]};var _0x4ecbb1=_['map'](db[_0x183c('0x2a')]['rawAttributes'],function(_0x2628b6){return{'name':_0x2628b6[_0x183c('0x2b')],'type':_0x2628b6[_0x183c('0x2c')]['key']};});_0xa8ccd5[_0x183c('0x2d')]=_[_0x183c('0x2e')](_0x4ecbb1,_0x183c('0x28'));_0xa8ccd5[_0x183c('0x2f')]=_[_0x183c('0x30')](_0x2a2943[_0x183c('0x2f')]);_0xa8ccd5[_0x183c('0x31')]=_[_0x183c('0x32')](_0xa8ccd5[_0x183c('0x2d')],_0xa8ccd5[_0x183c('0x2f')]);_0xa43927[_0x183c('0x33')]=_[_0x183c('0x32')](_0xa8ccd5['model'],qs['fields'](_0x2a2943['query'][_0x183c('0x34')]));_0xa43927[_0x183c('0x33')]=_0xa43927[_0x183c('0x33')][_0x183c('0x35')]?_0xa43927[_0x183c('0x33')]:_0xa8ccd5[_0x183c('0x2d')];if(!_0x2a2943[_0x183c('0x2f')]['hasOwnProperty'](_0x183c('0x36'))){_0xa43927[_0x183c('0x1e')]=qs[_0x183c('0x1e')](_0x2a2943[_0x183c('0x2f')][_0x183c('0x1e')]);_0xa43927[_0x183c('0x1d')]=qs[_0x183c('0x1d')](_0x2a2943[_0x183c('0x2f')][_0x183c('0x1d')]);}_0xa43927[_0x183c('0x37')]=qs[_0x183c('0x38')](_0x2a2943[_0x183c('0x2f')]['sort']);_0xa43927[_0x183c('0x39')]=qs['filters'](_['pick'](_0x2a2943[_0x183c('0x2f')],_0xa8ccd5[_0x183c('0x31')]),_0x4ecbb1);if(_0x2a2943[_0x183c('0x2f')]['filter']){_0xa43927['where']=_[_0x183c('0x3a')](_0xa43927[_0x183c('0x39')],{'$or':_[_0x183c('0x2e')](_0x4ecbb1,function(_0x1b742d){if(_0x1b742d[_0x183c('0x2c')]!=='VIRTUAL'){var _0x47863b={};_0x47863b[_0x1b742d[_0x183c('0x28')]]={'$like':'%'+_0x2a2943[_0x183c('0x2f')]['filter']+'%'};return _0x47863b;}})});}_0xa43927=_['merge']({},_0xa43927,_0x2a2943[_0x183c('0x3b')]);var _0x23a377={'where':_0xa43927[_0x183c('0x39')]};return db[_0x183c('0x2a')][_0x183c('0x1c')](_0x23a377)['then'](function(_0x49d915){_0x4090a1['count']=_0x49d915;if(_0x2a2943[_0x183c('0x2f')]['includeAll']){_0xa43927[_0x183c('0x3c')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0xa43927);})[_0x183c('0x26')](function(_0x490c81){_0x4090a1[_0x183c('0x3d')]=_0x490c81;return _0x4090a1;})[_0x183c('0x26')](respondWithFilteredResult(_0x2ec937,_0xa43927))['catch'](handleError(_0x2ec937,null));};exports[_0x183c('0x3e')]=function(_0x157c40,_0x153021){var _0x3e4bfa={'raw':!![],'where':{'id':_0x157c40[_0x183c('0x3f')]['id']}},_0x539817={};_0x539817['model']=_[_0x183c('0x30')](db[_0x183c('0x2a')][_0x183c('0x40')]);_0x539817[_0x183c('0x2f')]=_[_0x183c('0x30')](_0x157c40[_0x183c('0x2f')]);_0x539817['filters']=_[_0x183c('0x32')](_0x539817[_0x183c('0x2d')],_0x539817['query']);_0x3e4bfa[_0x183c('0x33')]=_['intersection'](_0x539817['model'],qs['fields'](_0x157c40[_0x183c('0x2f')][_0x183c('0x34')]));_0x3e4bfa[_0x183c('0x33')]=_0x3e4bfa[_0x183c('0x33')][_0x183c('0x35')]?_0x3e4bfa['attributes']:_0x539817[_0x183c('0x2d')];if(_0x157c40[_0x183c('0x2f')]['includeAll']){_0x3e4bfa[_0x183c('0x3c')]=[{'all':!![]}];}_0x3e4bfa=_[_0x183c('0x3a')]({},_0x3e4bfa,_0x157c40[_0x183c('0x3b')]);return db[_0x183c('0x2a')][_0x183c('0x41')](_0x3e4bfa)[_0x183c('0x26')](handleEntityNotFound(_0x153021,null))[_0x183c('0x26')](respondWithResult(_0x153021,null))['catch'](handleError(_0x153021,null));};exports[_0x183c('0x42')]=function(_0x20f86b,_0x2d9df9){return db[_0x183c('0x2a')][_0x183c('0x42')](_0x20f86b[_0x183c('0x43')],{})[_0x183c('0x26')](respondWithResult(_0x2d9df9,0xc9))['catch'](handleError(_0x2d9df9,null));};exports[_0x183c('0x44')]=function(_0x5d0987,_0x299a14){if(_0x5d0987['body']['id']){delete _0x5d0987['body']['id'];}return db[_0x183c('0x2a')][_0x183c('0x41')]({'where':{'id':_0x5d0987[_0x183c('0x3f')]['id']}})[_0x183c('0x26')](handleEntityNotFound(_0x299a14,null))[_0x183c('0x26')](saveUpdates(_0x5d0987[_0x183c('0x43')],null))[_0x183c('0x26')](respondWithResult(_0x299a14,null))['catch'](handleError(_0x299a14,null));};exports['destroy']=function(_0x4a5ca3,_0x28541b){return db[_0x183c('0x2a')][_0x183c('0x41')]({'where':{'id':_0x4a5ca3[_0x183c('0x3f')]['id']}})[_0x183c('0x26')](handleEntityNotFound(_0x28541b,null))['then'](removeEntity(_0x28541b,null))[_0x183c('0x45')](handleError(_0x28541b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b976ddf..108d154 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x1d4b84,_0x496711){var _0x38c63b=function(_0x3711b7){while(--_0x3711b7){_0x1d4b84['push'](_0x1d4b84['shift']());}};_0x38c63b(++_0x496711);}(_0x5fab,0x177));var _0xb5fa=function(_0x46af7e,_0x3e32c7){_0x46af7e=_0x46af7e-0x0;var _0x4c0447=_0x5fab[_0x46af7e];return _0x4c0447;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes'];(function(_0x39ee7c,_0x4432cd){var _0x50b234=function(_0x593211){while(--_0x593211){_0x39ee7c['push'](_0x39ee7c['shift']());}};_0x50b234(++_0x4432cd);}(_0x187d,0x93));var _0xd187=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x187d[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 70c7ea7..73ec487 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 _0xd916=['CreateSquareMessage','SquareMessage','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd916,0x18a));var _0x6d91=function(_0x4d3c7f,_0x2db0dc){_0x4d3c7f=_0x4d3c7f-0x0;var _0x590dc5=_0xd916[_0x4d3c7f];return _0x590dc5;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var moment=require(_0x6d91('0x2'));var BPromise=require(_0x6d91('0x3'));var rs=require(_0x6d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d91('0x5'))['db'];var utils=require(_0x6d91('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d91('0x7'));var jayson=require(_0x6d91('0x8'));var client=jayson['client'][_0x6d91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fcd82,_0x1fd876,_0x418357){return new BPromise(function(_0x3b7135,_0x215018){return client[_0x6d91('0xa')](_0x3fcd82,_0x418357)['then'](function(_0x574d9e){logger['info']('SquareMessage,\x20%s,\x20%s',_0x1fd876,_0x6d91('0xb'));logger[_0x6d91('0xc')](_0x6d91('0xd'),_0x1fd876,_0x6d91('0xb'),JSON[_0x6d91('0xe')](_0x574d9e));if(_0x574d9e['error']){if(_0x574d9e[_0x6d91('0xf')][_0x6d91('0x10')]===0x1f4){logger[_0x6d91('0xf')](_0x6d91('0x11'),_0x1fd876,_0x574d9e[_0x6d91('0xf')][_0x6d91('0x12')]);return _0x215018(_0x574d9e[_0x6d91('0xf')][_0x6d91('0x12')]);}logger[_0x6d91('0xf')](_0x6d91('0x11'),_0x1fd876,_0x574d9e[_0x6d91('0xf')][_0x6d91('0x12')]);return _0x3b7135(_0x574d9e[_0x6d91('0xf')][_0x6d91('0x12')]);}else{logger[_0x6d91('0x13')]('SquareMessage,\x20%s,\x20%s',_0x1fd876,_0x6d91('0xb'));_0x3b7135(_0x574d9e[_0x6d91('0x14')][_0x6d91('0x12')]);}})[_0x6d91('0x15')](function(_0x3602f3){logger[_0x6d91('0xf')]('SquareMessage,\x20%s,\x20%s',_0x1fd876,_0x3602f3);_0x215018(_0x3602f3);});});}exports[_0x6d91('0x16')]=function(_0x4c81fe){var _0x4dd339=this;return new Promise(function(_0x349249,_0x47d359){return db[_0x6d91('0x17')]['create'](_0x4c81fe['body'],{'raw':_0x4c81fe[_0x6d91('0x18')]?_0x4c81fe[_0x6d91('0x18')][_0x6d91('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x36f8fd){logger[_0x6d91('0x13')](_0x6d91('0x16'),_0x4c81fe);logger[_0x6d91('0xc')](_0x6d91('0x16'),_0x4c81fe,JSON[_0x6d91('0xe')](_0x36f8fd));_0x349249(_0x36f8fd);})[_0x6d91('0x15')](function(_0x351290){logger[_0x6d91('0xf')](_0x6d91('0x16'),_0x351290[_0x6d91('0x12')],_0x4c81fe);_0x47d359(_0x4dd339[_0x6d91('0xf')](0x1f4,_0x351290['message']));});});}; \ No newline at end of file +var _0x8ad5=['message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ad5,0xf1));var _0x58ad=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8ad5[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var moment=require(_0x58ad('0x2'));var BPromise=require(_0x58ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ad('0x4'))['db'];var utils=require(_0x58ad('0x5'));var logger=require(_0x58ad('0x6'))(_0x58ad('0x7'));var config=require(_0x58ad('0x8'));var jayson=require(_0x58ad('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394972,_0x22c63f,_0x220c5f){return new BPromise(function(_0x2033a3,_0xe5d483){return client[_0x58ad('0xa')](_0x394972,_0x220c5f)[_0x58ad('0xb')](function(_0x14fa03){logger[_0x58ad('0xc')]('SquareMessage,\x20%s,\x20%s',_0x22c63f,_0x58ad('0xd'));logger[_0x58ad('0xe')](_0x58ad('0xf'),_0x22c63f,_0x58ad('0xd'),JSON[_0x58ad('0x10')](_0x14fa03));if(_0x14fa03[_0x58ad('0x11')]){if(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x12')]===0x1f4){logger['error'](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);return _0xe5d483(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);}logger[_0x58ad('0x11')](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')]['message']);return _0x2033a3(_0x14fa03['error']['message']);}else{logger['info'](_0x58ad('0x13'),_0x22c63f,'request\x20sent');_0x2033a3(_0x14fa03[_0x58ad('0x15')][_0x58ad('0x14')]);}})[_0x58ad('0x16')](function(_0x280618){logger[_0x58ad('0x11')]('SquareMessage,\x20%s,\x20%s',_0x22c63f,_0x280618);_0xe5d483(_0x280618);});});}exports[_0x58ad('0x17')]=function(_0x24fbe0){var _0x3233d8=this;return new Promise(function(_0xc8b034,_0x397027){return db[_0x58ad('0x18')][_0x58ad('0x19')](_0x24fbe0[_0x58ad('0x1a')],{'raw':_0x24fbe0['options']?_0x24fbe0[_0x58ad('0x1b')][_0x58ad('0x1c')]===undefined?!![]:![]:!![]})[_0x58ad('0xb')](function(_0x5e4ff8){logger[_0x58ad('0xc')](_0x58ad('0x17'),_0x24fbe0);logger[_0x58ad('0xe')]('CreateSquareMessage',_0x24fbe0,JSON[_0x58ad('0x10')](_0x5e4ff8));_0xc8b034(_0x5e4ff8);})[_0x58ad('0x16')](function(_0xb50caf){logger[_0x58ad('0x11')]('CreateSquareMessage',_0xb50caf[_0x58ad('0x14')],_0x24fbe0);_0x397027(_0x3233d8[_0x58ad('0x11')](0x1f4,_0xb50caf[_0x58ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 12330e9..9f45b2e 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 _0x6127=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','post','create'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x6127,0x165));var _0x7612=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x6127[_0x3d9176];return _0x12adc5;};'use strict';var multer=require(_0x7612('0x0'));var util=require(_0x7612('0x1'));var path=require(_0x7612('0x2'));var timeout=require(_0x7612('0x3'));var express=require(_0x7612('0x4'));var router=express[_0x7612('0x5')]();var auth=require(_0x7612('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7612('0x7'));router[_0x7612('0x8')]('/',auth[_0x7612('0x9')](),controller[_0x7612('0xa')]);router[_0x7612('0x8')]('/:id',auth[_0x7612('0x9')](),controller[_0x7612('0xb')]);router[_0x7612('0x8')](_0x7612('0xc'),auth[_0x7612('0x9')](),timeout(_0x7612('0xd')),controller[_0x7612('0xe')]);router[_0x7612('0xf')]('/',auth[_0x7612('0x9')](),controller[_0x7612('0x10')]);router[_0x7612('0x11')](_0x7612('0x12'),auth[_0x7612('0x9')](),controller[_0x7612('0x13')]);router[_0x7612('0x14')](_0x7612('0x12'),auth[_0x7612('0x9')](),controller[_0x7612('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8124=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','15s','test','post','create','put','update','delete'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x8124,0x1b9));var _0x4812=function(_0x78699f,_0x9b5e13){_0x78699f=_0x78699f-0x0;var _0x26bfc7=_0x8124[_0x78699f];return _0x26bfc7;};'use strict';var multer=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var path=require(_0x4812('0x2'));var timeout=require(_0x4812('0x3'));var express=require(_0x4812('0x4'));var router=express['Router']();var auth=require(_0x4812('0x5'));var interaction=require(_0x4812('0x6'));var config=require(_0x4812('0x7'));var controller=require(_0x4812('0x8'));router[_0x4812('0x9')]('/',auth['isAuthenticated'](),controller[_0x4812('0xa')]);router['get'](_0x4812('0xb'),auth[_0x4812('0xc')](),controller[_0x4812('0xd')]);router['get']('/:id/test',auth[_0x4812('0xc')](),timeout(_0x4812('0xe')),controller[_0x4812('0xf')]);router[_0x4812('0x10')]('/',auth[_0x4812('0xc')](),controller[_0x4812('0x11')]);router[_0x4812('0x12')]('/:id',auth[_0x4812('0xc')](),controller[_0x4812('0x13')]);router[_0x4812('0x14')](_0x4812('0xb'),auth[_0x4812('0xc')](),controller[_0x4812('0x15')]);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 6fd4b65..874b114 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 _0x4cad=['exports','STRING','name','sequelize'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x4cad,0x7b));var _0xd4ca=function(_0x1d2034,_0x29dd4e){_0x1d2034=_0x1d2034-0x0;var _0xc3ee3d=_0x4cad[_0x1d2034];return _0xc3ee3d;};'use strict';var Sequelize=require(_0xd4ca('0x0'));module[_0xd4ca('0x1')]={'name':{'type':Sequelize[_0xd4ca('0x2')],'unique':_0xd4ca('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42bd=['name','sequelize','exports','STRING'];(function(_0x3dc9bc,_0x77bc87){var _0x23a813=function(_0x166ab9){while(--_0x166ab9){_0x3dc9bc['push'](_0x3dc9bc['shift']());}};_0x23a813(++_0x77bc87);}(_0x42bd,0x15d));var _0xd42b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x42bd[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xd42b('0x0'));module[_0xd42b('0x1')]={'name':{'type':Sequelize[_0xd42b('0x2')],'unique':_0xd42b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd42b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a1a8885..9d392ac 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 _0x26c0=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','include','rows','params','rawAttributes','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','sox'];(function(_0x94a613,_0x4ce735){var _0x5c8ffe=function(_0x29dd7c){while(--_0x29dd7c){_0x94a613['push'](_0x94a613['shift']());}};_0x5c8ffe(++_0x4ce735);}(_0x26c0,0x1a6));var _0x026c=function(_0x309052,_0x197d28){_0x309052=_0x309052-0x0;var _0x1f1d14=_0x26c0[_0x309052];return _0x1f1d14;};'use strict';var pdf=require(_0x026c('0x0'));var emlformat=require(_0x026c('0x1'));var rimraf=require(_0x026c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x026c('0x3'));var moment=require(_0x026c('0x4'));var BPromise=require(_0x026c('0x5'));var Mustache=require('mustache');var util=require(_0x026c('0x6'));var path=require('path');var sox=require(_0x026c('0x7'));var csv=require(_0x026c('0x8'));var ejs=require(_0x026c('0x9'));var fs=require('fs');var _=require(_0x026c('0xa'));var squel=require(_0x026c('0xb'));var crypto=require(_0x026c('0xc'));var jsforce=require(_0x026c('0xd'));var deskjs=require(_0x026c('0xe'));var toCsv=require(_0x026c('0x8'));var querystring=require(_0x026c('0xf'));var Papa=require(_0x026c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x026c('0x11'));var as=require(_0x026c('0x12'));var hardwareService=require(_0x026c('0x13'));var logger=require(_0x026c('0x14'))(_0x026c('0x15'));var utils=require(_0x026c('0x16'));var config=require('../../config/environment');var db=require(_0x026c('0x17'))['db'];function respondWithStatusCode(_0x43de9f,_0x578e7e){_0x578e7e=_0x578e7e||0xcc;return function(_0x508851){if(_0x508851){return _0x43de9f['sendStatus'](_0x578e7e);}return _0x43de9f[_0x026c('0x18')](_0x578e7e)['end']();};}function respondWithResult(_0x4a79a1,_0x19aa41){_0x19aa41=_0x19aa41||0xc8;return function(_0x24c06d){if(_0x24c06d){return _0x4a79a1['status'](_0x19aa41)['json'](_0x24c06d);}};}function respondWithFilteredResult(_0xe0e853,_0x426b7a){return function(_0x3d4570){if(_0x3d4570){var _0x4df37b=_0x3d4570[_0x026c('0x19')],_0x14b7b5=_0x426b7a[_0x026c('0x1a')],_0x2d46a7=_0x426b7a['offset']+_0x426b7a[_0x026c('0x1b')],_0x232763;if(_0x2d46a7>=_0x4df37b){_0x2d46a7=_0x4df37b;_0x232763=0xc8;}else{_0x232763=0xce;}_0xe0e853[_0x026c('0x18')](_0x232763);return _0xe0e853[_0x026c('0x1c')](_0x026c('0x1d'),_0x14b7b5+'-'+_0x2d46a7+'/'+_0x4df37b)[_0x026c('0x1e')](_0x3d4570);}return null;};}function patchUpdates(_0x40a503){return function(_0x366e00){try{jsonpatch[_0x026c('0x1f')](_0x366e00,_0x40a503,!![]);}catch(_0x399687){return BPromise[_0x026c('0x20')](_0x399687);}return _0x366e00[_0x026c('0x21')]();};}function saveUpdates(_0x1169a4,_0x27c237){return function(_0x2c6d40){if(_0x2c6d40){return _0x2c6d40[_0x026c('0x22')](_0x1169a4)[_0x026c('0x23')](function(_0x5a79c9){return _0x5a79c9;});}return null;};}function removeEntity(_0xe5704f,_0x13f7ae){return function(_0x3f2fff){if(_0x3f2fff){return _0x3f2fff['destroy']()[_0x026c('0x23')](function(){var _0x2c54d6=_0x3f2fff[_0x026c('0x24')]({'plain':!![]});var _0x1ffa08=_0x026c('0x25');return db[_0x026c('0x26')][_0x026c('0x27')]({'where':{'type':_0x1ffa08,'resourceId':_0x2c54d6['id']}})[_0x026c('0x23')](function(){return _0x3f2fff;});})[_0x026c('0x23')](function(){_0xe5704f[_0x026c('0x18')](0xcc)[_0x026c('0x28')]();});}};}function handleEntityNotFound(_0x488318,_0xf46304){return function(_0x4146d4){if(!_0x4146d4){_0x488318[_0x026c('0x29')](0x194);}return _0x4146d4;};}function handleError(_0x3207ae,_0x2f0064){_0x2f0064=_0x2f0064||0x1f4;return function(_0xb9ddab){logger['error'](_0xb9ddab[_0x026c('0x2a')]);if(_0xb9ddab[_0x026c('0x2b')]){delete _0xb9ddab[_0x026c('0x2b')];}_0x3207ae[_0x026c('0x18')](_0x2f0064)[_0x026c('0x2c')](_0xb9ddab);};}exports[_0x026c('0x2d')]=function(_0x3289c0,_0x2b102a){var _0x5676db={},_0x45d398={},_0x3ad81b={'count':0x0,'rows':[]};var _0x11733e=_[_0x026c('0x2e')](db[_0x026c('0x2f')]['rawAttributes'],function(_0x378585){return{'name':_0x378585[_0x026c('0x30')],'type':_0x378585[_0x026c('0x31')][_0x026c('0x32')]};});_0x45d398[_0x026c('0x33')]=_[_0x026c('0x2e')](_0x11733e,_0x026c('0x2b'));_0x45d398[_0x026c('0x34')]=_[_0x026c('0x35')](_0x3289c0[_0x026c('0x34')]);_0x45d398['filters']=_[_0x026c('0x36')](_0x45d398[_0x026c('0x33')],_0x45d398[_0x026c('0x34')]);_0x5676db['attributes']=_[_0x026c('0x36')](_0x45d398[_0x026c('0x33')],qs[_0x026c('0x37')](_0x3289c0[_0x026c('0x34')][_0x026c('0x37')]));_0x5676db[_0x026c('0x38')]=_0x5676db[_0x026c('0x38')][_0x026c('0x39')]?_0x5676db[_0x026c('0x38')]:_0x45d398[_0x026c('0x33')];if(!_0x3289c0[_0x026c('0x34')]['hasOwnProperty'](_0x026c('0x3a'))){_0x5676db[_0x026c('0x1b')]=qs[_0x026c('0x1b')](_0x3289c0[_0x026c('0x34')][_0x026c('0x1b')]);_0x5676db[_0x026c('0x1a')]=qs[_0x026c('0x1a')](_0x3289c0[_0x026c('0x34')][_0x026c('0x1a')]);}_0x5676db[_0x026c('0x3b')]=qs[_0x026c('0x3c')](_0x3289c0[_0x026c('0x34')][_0x026c('0x3c')]);_0x5676db[_0x026c('0x3d')]=qs[_0x026c('0x3e')](_['pick'](_0x3289c0[_0x026c('0x34')],_0x45d398[_0x026c('0x3e')]),_0x11733e);if(_0x3289c0[_0x026c('0x34')]['filter']){_0x5676db[_0x026c('0x3d')]=_['merge'](_0x5676db[_0x026c('0x3d')],{'$or':_[_0x026c('0x2e')](_0x11733e,function(_0xa8495d){if(_0xa8495d[_0x026c('0x31')]!==_0x026c('0x3f')){var _0x554106={};_0x554106[_0xa8495d[_0x026c('0x2b')]]={'$like':'%'+_0x3289c0['query'][_0x026c('0x40')]+'%'};return _0x554106;}})});}_0x5676db=_[_0x026c('0x41')]({},_0x5676db,_0x3289c0[_0x026c('0x42')]);var _0x29020c={'where':_0x5676db[_0x026c('0x3d')]};return db[_0x026c('0x2f')][_0x026c('0x19')](_0x29020c)[_0x026c('0x23')](function(_0x58ef72){_0x3ad81b['count']=_0x58ef72;if(_0x3289c0[_0x026c('0x34')]['includeAll']){_0x5676db[_0x026c('0x43')]=[{'all':!![]}];}return db[_0x026c('0x2f')]['findAll'](_0x5676db);})[_0x026c('0x23')](function(_0x2d5fb1){_0x3ad81b[_0x026c('0x44')]=_0x2d5fb1;return _0x3ad81b;})['then'](respondWithFilteredResult(_0x2b102a,_0x5676db))['catch'](handleError(_0x2b102a,null));};exports['show']=function(_0x3fbcf8,_0x245657){var _0x2893de={'raw':!![],'where':{'id':_0x3fbcf8[_0x026c('0x45')]['id']}},_0x5bb479={};_0x5bb479[_0x026c('0x33')]=_[_0x026c('0x35')](db['SquareOdbc'][_0x026c('0x46')]);_0x5bb479[_0x026c('0x34')]=_[_0x026c('0x35')](_0x3fbcf8['query']);_0x5bb479[_0x026c('0x3e')]=_[_0x026c('0x36')](_0x5bb479['model'],_0x5bb479[_0x026c('0x34')]);_0x2893de['attributes']=_[_0x026c('0x36')](_0x5bb479['model'],qs[_0x026c('0x37')](_0x3fbcf8[_0x026c('0x34')]['fields']));_0x2893de[_0x026c('0x38')]=_0x2893de['attributes'][_0x026c('0x39')]?_0x2893de[_0x026c('0x38')]:_0x5bb479[_0x026c('0x33')];if(_0x3fbcf8[_0x026c('0x34')]['includeAll']){_0x2893de[_0x026c('0x43')]=[{'all':!![]}];}_0x2893de=_[_0x026c('0x41')]({},_0x2893de,_0x3fbcf8['options']);return db[_0x026c('0x2f')][_0x026c('0x47')](_0x2893de)[_0x026c('0x23')](handleEntityNotFound(_0x245657,null))[_0x026c('0x23')](respondWithResult(_0x245657,null))[_0x026c('0x48')](handleError(_0x245657,null));};exports[_0x026c('0x49')]=function(_0x3af4e0,_0x29a246){return db[_0x026c('0x2f')][_0x026c('0x49')](_0x3af4e0[_0x026c('0x4a')],{})[_0x026c('0x23')](function(_0x12f196){var _0x328dc2=_0x3af4e0[_0x026c('0x4b')]['get']({'plain':!![]});if(!_0x328dc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328dc2[_0x026c('0x4c')]===_0x026c('0x4b')){var _0x5704a3=_0x12f196[_0x026c('0x24')]({'plain':!![]});var _0x1a3e73=_0x026c('0x25');return db[_0x026c('0x4d')]['find']({'where':{'name':_0x1a3e73,'userProfileId':_0x328dc2[_0x026c('0x4e')]},'raw':!![]})['then'](function(_0x204e59){if(_0x204e59&&_0x204e59[_0x026c('0x4f')]===0x0){return db['UserProfileResource'][_0x026c('0x49')]({'name':_0x5704a3['name'],'resourceId':_0x5704a3['id'],'type':_0x204e59[_0x026c('0x2b')],'sectionId':_0x204e59['id']},{})[_0x026c('0x23')](function(){return _0x12f196;});}else{return _0x12f196;}})[_0x026c('0x48')](function(_0x3acc81){logger[_0x026c('0x50')](_0x026c('0x51'),_0x3acc81);throw _0x3acc81;});}return _0x12f196;})[_0x026c('0x23')](respondWithResult(_0x29a246,0xc9))[_0x026c('0x48')](handleError(_0x29a246,null));};exports[_0x026c('0x22')]=function(_0x5e7820,_0x3f4712){if(_0x5e7820[_0x026c('0x4a')]['id']){delete _0x5e7820[_0x026c('0x4a')]['id'];}return db[_0x026c('0x2f')][_0x026c('0x47')]({'where':{'id':_0x5e7820[_0x026c('0x45')]['id']}})[_0x026c('0x23')](handleEntityNotFound(_0x3f4712,null))['then'](saveUpdates(_0x5e7820[_0x026c('0x4a')],null))[_0x026c('0x23')](respondWithResult(_0x3f4712,null))[_0x026c('0x48')](handleError(_0x3f4712,null));};exports['destroy']=function(_0x2ce3d9,_0x66bde3){return db['SquareOdbc']['find']({'where':{'id':_0x2ce3d9['params']['id']}})[_0x026c('0x23')](handleEntityNotFound(_0x66bde3,null))[_0x026c('0x23')](removeEntity(_0x66bde3,null))[_0x026c('0x48')](handleError(_0x66bde3,null));};exports[_0x026c('0x52')]=function(_0x9b8923,_0x5f54f2,_0x16c331){var _0x595d72;return db['SquareOdbc'][_0x026c('0x47')]({'where':{'id':_0x9b8923[_0x026c('0x45')]['id']},'attributes':['id',_0x026c('0x53')]})[_0x026c('0x23')](handleEntityNotFound(_0x5f54f2,null))['then'](function(_0x490d5b){if(_0x490d5b){var _0xc4f194=require(_0x026c('0x54'))();_0xc4f194[_0x026c('0x55')](_0x490d5b[_0x026c('0x53')]);_0xc4f194['closeSync']();return _0x490d5b;}})[_0x026c('0x23')](respondWithResult(_0x5f54f2,null))[_0x026c('0x48')](handleError(_0x5f54f2,null));}; \ No newline at end of file +var _0xdafa=['../../config/environment','sendStatus','json','count','offset','limit','status','set','save','update','then','get','ODBC','UserProfileResource','end','error','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','test','dsn','openSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xdafa,0x135));var _0xadaf=function(_0x5593c6,_0x5d76fe){_0x5593c6=_0x5593c6-0x0;var _0x458d6f=_0xdafa[_0x5593c6];return _0x458d6f;};'use strict';var pdf=require(_0xadaf('0x0'));var emlformat=require(_0xadaf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xadaf('0x2'));var jsonpatch=require(_0xadaf('0x3'));var rp=require(_0xadaf('0x4'));var moment=require(_0xadaf('0x5'));var BPromise=require(_0xadaf('0x6'));var Mustache=require(_0xadaf('0x7'));var util=require(_0xadaf('0x8'));var path=require(_0xadaf('0x9'));var sox=require(_0xadaf('0xa'));var csv=require('to-csv');var ejs=require(_0xadaf('0xb'));var fs=require('fs');var _=require(_0xadaf('0xc'));var squel=require(_0xadaf('0xd'));var crypto=require(_0xadaf('0xe'));var jsforce=require(_0xadaf('0xf'));var deskjs=require(_0xadaf('0x10'));var toCsv=require(_0xadaf('0x11'));var querystring=require(_0xadaf('0x12'));var Papa=require(_0xadaf('0x13'));var Redis=require(_0xadaf('0x14'));var authService=require(_0xadaf('0x15'));var qs=require(_0xadaf('0x16'));var as=require(_0xadaf('0x17'));var hardwareService=require(_0xadaf('0x18'));var logger=require(_0xadaf('0x19'))('api');var utils=require(_0xadaf('0x1a'));var config=require(_0xadaf('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356678,_0x964462){_0x964462=_0x964462||0xcc;return function(_0x6e2222){if(_0x6e2222){return _0x356678[_0xadaf('0x1c')](_0x964462);}return _0x356678['status'](_0x964462)['end']();};}function respondWithResult(_0x4d5a46,_0x235b7c){_0x235b7c=_0x235b7c||0xc8;return function(_0x156019){if(_0x156019){return _0x4d5a46['status'](_0x235b7c)[_0xadaf('0x1d')](_0x156019);}};}function respondWithFilteredResult(_0x1be133,_0x270efe){return function(_0x36d14e){if(_0x36d14e){var _0x5db078=_0x36d14e[_0xadaf('0x1e')],_0x2f96b0=_0x270efe[_0xadaf('0x1f')],_0xe37a53=_0x270efe[_0xadaf('0x1f')]+_0x270efe[_0xadaf('0x20')],_0x329e63;if(_0xe37a53>=_0x5db078){_0xe37a53=_0x5db078;_0x329e63=0xc8;}else{_0x329e63=0xce;}_0x1be133[_0xadaf('0x21')](_0x329e63);return _0x1be133[_0xadaf('0x22')]('Content-Range',_0x2f96b0+'-'+_0xe37a53+'/'+_0x5db078)['json'](_0x36d14e);}return null;};}function patchUpdates(_0x370ab9){return function(_0x459249){try{jsonpatch['apply'](_0x459249,_0x370ab9,!![]);}catch(_0x10c3f4){return BPromise['reject'](_0x10c3f4);}return _0x459249[_0xadaf('0x23')]();};}function saveUpdates(_0x5b5e78,_0x11142b){return function(_0x22df4f){if(_0x22df4f){return _0x22df4f[_0xadaf('0x24')](_0x5b5e78)[_0xadaf('0x25')](function(_0x5e2fe9){return _0x5e2fe9;});}return null;};}function removeEntity(_0xadaf6b,_0x997148){return function(_0x4f5883){if(_0x4f5883){return _0x4f5883['destroy']()['then'](function(){var _0x5f543b=_0x4f5883[_0xadaf('0x26')]({'plain':!![]});var _0x5e04d0=_0xadaf('0x27');return db[_0xadaf('0x28')]['destroy']({'where':{'type':_0x5e04d0,'resourceId':_0x5f543b['id']}})[_0xadaf('0x25')](function(){return _0x4f5883;});})['then'](function(){_0xadaf6b[_0xadaf('0x21')](0xcc)[_0xadaf('0x29')]();});}};}function handleEntityNotFound(_0x13ad18,_0x3ddccf){return function(_0x261d2d){if(!_0x261d2d){_0x13ad18[_0xadaf('0x1c')](0x194);}return _0x261d2d;};}function handleError(_0x421c9c,_0x3c32dc){_0x3c32dc=_0x3c32dc||0x1f4;return function(_0x352ef8){logger[_0xadaf('0x2a')](_0x352ef8['stack']);if(_0x352ef8[_0xadaf('0x2b')]){delete _0x352ef8[_0xadaf('0x2b')];}_0x421c9c[_0xadaf('0x21')](_0x3c32dc)[_0xadaf('0x2c')](_0x352ef8);};}exports['index']=function(_0x56da6f,_0x41d3b2){var _0x1a3e27={},_0x2441e9={},_0x17c1e9={'count':0x0,'rows':[]};var _0x2cf702=_['map'](db[_0xadaf('0x2d')][_0xadaf('0x2e')],function(_0x4c244f){return{'name':_0x4c244f[_0xadaf('0x2f')],'type':_0x4c244f[_0xadaf('0x30')][_0xadaf('0x31')]};});_0x2441e9[_0xadaf('0x32')]=_['map'](_0x2cf702,_0xadaf('0x2b'));_0x2441e9[_0xadaf('0x33')]=_[_0xadaf('0x34')](_0x56da6f[_0xadaf('0x33')]);_0x2441e9['filters']=_[_0xadaf('0x35')](_0x2441e9[_0xadaf('0x32')],_0x2441e9['query']);_0x1a3e27[_0xadaf('0x36')]=_[_0xadaf('0x35')](_0x2441e9[_0xadaf('0x32')],qs[_0xadaf('0x37')](_0x56da6f[_0xadaf('0x33')][_0xadaf('0x37')]));_0x1a3e27[_0xadaf('0x36')]=_0x1a3e27[_0xadaf('0x36')][_0xadaf('0x38')]?_0x1a3e27[_0xadaf('0x36')]:_0x2441e9[_0xadaf('0x32')];if(!_0x56da6f[_0xadaf('0x33')][_0xadaf('0x39')]('nolimit')){_0x1a3e27['limit']=qs['limit'](_0x56da6f['query'][_0xadaf('0x20')]);_0x1a3e27[_0xadaf('0x1f')]=qs['offset'](_0x56da6f[_0xadaf('0x33')]['offset']);}_0x1a3e27[_0xadaf('0x3a')]=qs[_0xadaf('0x3b')](_0x56da6f[_0xadaf('0x33')][_0xadaf('0x3b')]);_0x1a3e27[_0xadaf('0x3c')]=qs[_0xadaf('0x3d')](_[_0xadaf('0x3e')](_0x56da6f[_0xadaf('0x33')],_0x2441e9[_0xadaf('0x3d')]),_0x2cf702);if(_0x56da6f[_0xadaf('0x33')]['filter']){_0x1a3e27[_0xadaf('0x3c')]=_[_0xadaf('0x3f')](_0x1a3e27['where'],{'$or':_[_0xadaf('0x40')](_0x2cf702,function(_0x367d18){if(_0x367d18[_0xadaf('0x30')]!==_0xadaf('0x41')){var _0x14c87a={};_0x14c87a[_0x367d18[_0xadaf('0x2b')]]={'$like':'%'+_0x56da6f['query'][_0xadaf('0x42')]+'%'};return _0x14c87a;}})});}_0x1a3e27=_[_0xadaf('0x3f')]({},_0x1a3e27,_0x56da6f[_0xadaf('0x43')]);var _0x53a2f8={'where':_0x1a3e27[_0xadaf('0x3c')]};return db[_0xadaf('0x2d')][_0xadaf('0x1e')](_0x53a2f8)[_0xadaf('0x25')](function(_0x462e82){_0x17c1e9[_0xadaf('0x1e')]=_0x462e82;if(_0x56da6f[_0xadaf('0x33')][_0xadaf('0x44')]){_0x1a3e27[_0xadaf('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0xadaf('0x46')](_0x1a3e27);})['then'](function(_0x1400a2){_0x17c1e9[_0xadaf('0x47')]=_0x1400a2;return _0x17c1e9;})[_0xadaf('0x25')](respondWithFilteredResult(_0x41d3b2,_0x1a3e27))[_0xadaf('0x48')](handleError(_0x41d3b2,null));};exports[_0xadaf('0x49')]=function(_0x35c9f6,_0x3f2401){var _0x142367={'raw':!![],'where':{'id':_0x35c9f6['params']['id']}},_0x4d5b6c={};_0x4d5b6c[_0xadaf('0x32')]=_[_0xadaf('0x34')](db[_0xadaf('0x2d')]['rawAttributes']);_0x4d5b6c[_0xadaf('0x33')]=_['keys'](_0x35c9f6[_0xadaf('0x33')]);_0x4d5b6c[_0xadaf('0x3d')]=_['intersection'](_0x4d5b6c[_0xadaf('0x32')],_0x4d5b6c['query']);_0x142367['attributes']=_[_0xadaf('0x35')](_0x4d5b6c[_0xadaf('0x32')],qs[_0xadaf('0x37')](_0x35c9f6[_0xadaf('0x33')][_0xadaf('0x37')]));_0x142367[_0xadaf('0x36')]=_0x142367[_0xadaf('0x36')][_0xadaf('0x38')]?_0x142367[_0xadaf('0x36')]:_0x4d5b6c['model'];if(_0x35c9f6[_0xadaf('0x33')]['includeAll']){_0x142367[_0xadaf('0x45')]=[{'all':!![]}];}_0x142367=_[_0xadaf('0x3f')]({},_0x142367,_0x35c9f6['options']);return db[_0xadaf('0x2d')]['find'](_0x142367)[_0xadaf('0x25')](handleEntityNotFound(_0x3f2401,null))['then'](respondWithResult(_0x3f2401,null))[_0xadaf('0x48')](handleError(_0x3f2401,null));};exports[_0xadaf('0x4a')]=function(_0x3d15dc,_0x3b53da){return db[_0xadaf('0x2d')]['create'](_0x3d15dc[_0xadaf('0x4b')],{})[_0xadaf('0x25')](function(_0x58fb5f){var _0x2a5e8e=_0x3d15dc[_0xadaf('0x4c')]['get']({'plain':!![]});if(!_0x2a5e8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a5e8e[_0xadaf('0x4d')]===_0xadaf('0x4c')){var _0x1b8702=_0x58fb5f[_0xadaf('0x26')]({'plain':!![]});var _0x5b1605=_0xadaf('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5b1605,'userProfileId':_0x2a5e8e['userProfileId']},'raw':!![]})[_0xadaf('0x25')](function(_0x1297fa){if(_0x1297fa&&_0x1297fa['autoAssociation']===0x0){return db[_0xadaf('0x28')][_0xadaf('0x4a')]({'name':_0x1b8702[_0xadaf('0x2b')],'resourceId':_0x1b8702['id'],'type':_0x1297fa[_0xadaf('0x2b')],'sectionId':_0x1297fa['id']},{})[_0xadaf('0x25')](function(){return _0x58fb5f;});}else{return _0x58fb5f;}})[_0xadaf('0x48')](function(_0x4d2383){logger[_0xadaf('0x2a')](_0xadaf('0x4e'),_0x4d2383);throw _0x4d2383;});}return _0x58fb5f;})[_0xadaf('0x25')](respondWithResult(_0x3b53da,0xc9))[_0xadaf('0x48')](handleError(_0x3b53da,null));};exports['update']=function(_0x3daaaa,_0x2bf662){if(_0x3daaaa['body']['id']){delete _0x3daaaa['body']['id'];}return db[_0xadaf('0x2d')][_0xadaf('0x4f')]({'where':{'id':_0x3daaaa[_0xadaf('0x50')]['id']}})[_0xadaf('0x25')](handleEntityNotFound(_0x2bf662,null))[_0xadaf('0x25')](saveUpdates(_0x3daaaa['body'],null))[_0xadaf('0x25')](respondWithResult(_0x2bf662,null))[_0xadaf('0x48')](handleError(_0x2bf662,null));};exports['destroy']=function(_0x4a288f,_0x47a264){return db[_0xadaf('0x2d')][_0xadaf('0x4f')]({'where':{'id':_0x4a288f['params']['id']}})['then'](handleEntityNotFound(_0x47a264,null))['then'](removeEntity(_0x47a264,null))['catch'](handleError(_0x47a264,null));};exports[_0xadaf('0x51')]=function(_0x562870,_0x403b38,_0xb811d3){var _0x479740;return db['SquareOdbc'][_0xadaf('0x4f')]({'where':{'id':_0x562870[_0xadaf('0x50')]['id']},'attributes':['id',_0xadaf('0x52')]})[_0xadaf('0x25')](handleEntityNotFound(_0x403b38,null))['then'](function(_0x46e832){if(_0x46e832){var _0x8b71fe=require('odbc')();_0x8b71fe[_0xadaf('0x53')](_0x46e832[_0xadaf('0x52')]);_0x8b71fe['closeSync']();return _0x46e832;}})[_0xadaf('0x25')](respondWithResult(_0x403b38,null))[_0xadaf('0x48')](handleError(_0x403b38,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5e92ca2..1c40549 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 _0x9e9b=['../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x483056,_0x34c5eb){var _0x13e41d=function(_0x454043){while(--_0x454043){_0x483056['push'](_0x483056['shift']());}};_0x13e41d(++_0x34c5eb);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x9e9b[_0x1c156e];return _0x58fc22;};'use strict';var _=require(_0xb9e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb9e9('0x1'));var moment=require(_0xb9e9('0x2'));var BPromise=require(_0xb9e9('0x3'));var rp=require(_0xb9e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9e9('0x5'));var config=require(_0xb9e9('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xb9e9('0x7')]=function(_0x7b18d5,_0x3e4023){return _0x7b18d5[_0xb9e9('0x8')](_0xb9e9('0x9'),attributes,{'tableName':_0xb9e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00cd=['SquareOdbc','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./squareOdbc.attributes','exports'];(function(_0x48256f,_0x1c9a0e){var _0x4e9e75=function(_0x2937c6){while(--_0x2937c6){_0x48256f['push'](_0x48256f['shift']());}};_0x4e9e75(++_0x1c9a0e);}(_0x00cd,0x1cd));var _0xd00c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x00cd[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd00c('0x0'));var util=require('util');var logger=require(_0xd00c('0x1'))(_0xd00c('0x2'));var moment=require(_0xd00c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd00c('0x4'));var fs=require('fs');var path=require(_0xd00c('0x5'));var rimraf=require(_0xd00c('0x6'));var config=require('../../config/environment');var attributes=require(_0xd00c('0x7'));module[_0xd00c('0x8')]=function(_0x3cd452,_0x1d1fe3){return _0x3cd452['define'](_0xd00c('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index cd3a12b..d002221 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x3d1754,_0x2d04bc){var _0x2387d5=function(_0x18dbc8){while(--_0x18dbc8){_0x3d1754['push'](_0x3d1754['shift']());}};_0x2387d5(++_0x2d04bc);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x479d47,_0x29c94a){var _0x32862e=function(_0x2e461b){while(--_0x2e461b){_0x479d47['push'](_0x479d47['shift']());}};_0x32862e(++_0x29c94a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5ff3e28..b72f3cb 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 _0x1775=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','delete','destroy','removeUsers','exports','util','path','connect-timeout','express','Router'];(function(_0x4ca026,_0xea3fdf){var _0x160720=function(_0x2b297d){while(--_0x2b297d){_0x4ca026['push'](_0x4ca026['shift']());}};_0x160720(++_0xea3fdf);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')]('/',auth[_0x5177('0xa')](),controller['create']);router['post'](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);router[_0x5177('0x12')](_0x5177('0xc'),auth['isAuthenticated'](),controller[_0x5177('0x13')]);router[_0x5177('0x14')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0x15')]);router[_0x5177('0x14')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x16')]);module[_0x5177('0x17')]=router; \ No newline at end of file +var _0xa571=['put','delete','removeUsers','multer','util','path','connect-timeout','Router','../../components/auth/service','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','create','post','addUsers'];(function(_0x13928e,_0xaff227){var _0x184e8b=function(_0x5aa9ef){while(--_0x5aa9ef){_0x13928e['push'](_0x13928e['shift']());}};_0x184e8b(++_0xaff227);}(_0xa571,0x107));var _0x1a57=function(_0xceade2,_0xc82824){_0xceade2=_0xceade2-0x0;var _0x240a65=_0xa571[_0xceade2];return _0x240a65;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x8')]);router[_0x1a57('0x9')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xb')]);router['get'](_0x1a57('0xc'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xd')]);router['post']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0xe')]);router[_0x1a57('0xf')](_0x1a57('0xc'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1a57('0x12')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller['destroy']);router[_0x1a57('0x12')](_0x1a57('0xc'),auth['isAuthenticated'](),controller[_0x1a57('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 344464e..b785339 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 _0x2412=['name','TEXT','BLOB','long','preproduction','toString','utf8','production','getDataValue','sequelize','exports','STRING'];(function(_0x4276cc,_0x2dce2b){var _0x3def97=function(_0x2c6672){while(--_0x2c6672){_0x4276cc['push'](_0x4276cc['shift']());}};_0x3def97(++_0x2dce2b);}(_0x2412,0x14d));var _0x2241=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2412[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2241('0x0'));module[_0x2241('0x1')]={'name':{'type':Sequelize[_0x2241('0x2')],'unique':_0x2241('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2241('0x2')]},'notes':{'type':Sequelize[_0x2241('0x4')]},'preproduction':{'type':Sequelize[_0x2241('0x5')](_0x2241('0x6')),'get':function(){if(this['getDataValue'](_0x2241('0x7'))){return this['getDataValue'](_0x2241('0x7'))[_0x2241('0x8')](_0x2241('0x9'));}}},'production':{'type':Sequelize[_0x2241('0x5')](_0x2241('0x6')),'get':function(){if(this['getDataValue'](_0x2241('0xa'))){return this[_0x2241('0xb')](_0x2241('0xa'))['toString'](_0x2241('0x9'));}}}}; \ No newline at end of file +var _0x35ea=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize'];(function(_0x498254,_0x1e54eb){var _0x59bf1a=function(_0x4c43b1){while(--_0x4c43b1){_0x498254['push'](_0x498254['shift']());}};_0x59bf1a(++_0x1e54eb);}(_0x35ea,0x196));var _0xa35e=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0x35ea[_0x1bb0b8];return _0x22fc67;};'use strict';var Sequelize=require(_0xa35e('0x0'));module['exports']={'name':{'type':Sequelize[_0xa35e('0x1')],'unique':_0xa35e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa35e('0x1')]},'notes':{'type':Sequelize[_0xa35e('0x3')]},'preproduction':{'type':Sequelize[_0xa35e('0x4')](_0xa35e('0x5')),'get':function(){if(this[_0xa35e('0x6')](_0xa35e('0x7'))){return this[_0xa35e('0x6')](_0xa35e('0x7'))[_0xa35e('0x8')](_0xa35e('0x9'));}}},'production':{'type':Sequelize[_0xa35e('0x4')](_0xa35e('0x5')),'get':function(){if(this['getDataValue'](_0xa35e('0xa'))){return this[_0xa35e('0x6')](_0xa35e('0xa'))[_0xa35e('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 be5733f..c3ee916 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 _0x256d=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','update','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','rawAttributes','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','get','SquareProjects','name','send','map','SquareProject','fieldName'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x256d,0x1f4));var _0xd256=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x256d[_0x21c6b8];return _0x39d474;};'use strict';var pdf=require(_0xd256('0x0'));var emlformat=require(_0xd256('0x1'));var rimraf=require(_0xd256('0x2'));var zipdir=require(_0xd256('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd256('0x4'));var util=require(_0xd256('0x5'));var path=require(_0xd256('0x6'));var sox=require('sox');var csv=require(_0xd256('0x7'));var ejs=require(_0xd256('0x8'));var fs=require('fs');var _=require(_0xd256('0x9'));var squel=require('squel');var crypto=require(_0xd256('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd256('0xb'));var toCsv=require(_0xd256('0x7'));var querystring=require('querystring');var Papa=require(_0xd256('0xc'));var Redis=require(_0xd256('0xd'));var authService=require(_0xd256('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd256('0xf'));var hardwareService=require(_0xd256('0x10'));var logger=require(_0xd256('0x11'))(_0xd256('0x12'));var utils=require(_0xd256('0x13'));var config=require(_0xd256('0x14'));var db=require(_0xd256('0x15'))['db'];config[_0xd256('0x16')]=_[_0xd256('0x17')](config[_0xd256('0x16')],{'host':_0xd256('0x18'),'port':0x18eb});var socket=require(_0xd256('0x19'))(new Redis(config[_0xd256('0x16')]));require(_0xd256('0x1a'))[_0xd256('0x1b')](socket);function respondWithStatusCode(_0x2d0b8b,_0x5d891a){_0x5d891a=_0x5d891a||0xcc;return function(_0x27f2fc){if(_0x27f2fc){return _0x2d0b8b[_0xd256('0x1c')](_0x5d891a);}return _0x2d0b8b[_0xd256('0x1d')](_0x5d891a)[_0xd256('0x1e')]();};}function respondWithResult(_0xa1db27,_0x428e3e){_0x428e3e=_0x428e3e||0xc8;return function(_0x20141c){if(_0x20141c){return _0xa1db27[_0xd256('0x1d')](_0x428e3e)[_0xd256('0x1f')](_0x20141c);}};}function respondWithFilteredResult(_0x4c344c,_0x1ef0d4){return function(_0x5c14ee){if(_0x5c14ee){var _0x2442e6=_0x5c14ee['count'],_0x384f24=_0x1ef0d4['offset'],_0x5d0b2e=_0x1ef0d4[_0xd256('0x20')]+_0x1ef0d4[_0xd256('0x21')],_0x2350e6;if(_0x5d0b2e>=_0x2442e6){_0x5d0b2e=_0x2442e6;_0x2350e6=0xc8;}else{_0x2350e6=0xce;}_0x4c344c[_0xd256('0x1d')](_0x2350e6);return _0x4c344c[_0xd256('0x22')]('Content-Range',_0x384f24+'-'+_0x5d0b2e+'/'+_0x2442e6)['json'](_0x5c14ee);}return null;};}function patchUpdates(_0x90715b){return function(_0x3d007d){try{jsonpatch['apply'](_0x3d007d,_0x90715b,!![]);}catch(_0x426b9f){return BPromise[_0xd256('0x23')](_0x426b9f);}return _0x3d007d[_0xd256('0x24')]();};}function saveUpdates(_0x30d503,_0x51f43b){return function(_0x40478a){if(_0x40478a){return _0x40478a['update'](_0x30d503)[_0xd256('0x25')](function(_0x4cb6d5){return _0x4cb6d5;});}return null;};}function removeEntity(_0x12837f,_0x24e42d){return function(_0x58d941){if(_0x58d941){return _0x58d941[_0xd256('0x26')]()['then'](function(){var _0x28845b=_0x58d941[_0xd256('0x27')]({'plain':!![]});var _0x3678a6=_0xd256('0x28');return db['UserProfileResource'][_0xd256('0x26')]({'where':{'type':_0x3678a6,'resourceId':_0x28845b['id']}})[_0xd256('0x25')](function(){return _0x58d941;});})['then'](function(){_0x12837f[_0xd256('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511606,_0x4177c2){return function(_0x3ca282){if(!_0x3ca282){_0x511606['sendStatus'](0x194);}return _0x3ca282;};}function handleError(_0x47fab1,_0x3bea6f){_0x3bea6f=_0x3bea6f||0x1f4;return function(_0x58d031){logger['error'](_0x58d031['stack']);if(_0x58d031[_0xd256('0x29')]){delete _0x58d031[_0xd256('0x29')];}_0x47fab1[_0xd256('0x1d')](_0x3bea6f)[_0xd256('0x2a')](_0x58d031);};}exports['index']=function(_0x4f345e,_0x1f5099){var _0x474cbf={},_0x3afcc3={},_0xf2b9={'count':0x0,'rows':[]};var _0x3ee8b6=_[_0xd256('0x2b')](db[_0xd256('0x2c')]['rawAttributes'],function(_0x147d1f){return{'name':_0x147d1f[_0xd256('0x2d')],'type':_0x147d1f['type'][_0xd256('0x2e')]};});_0x3afcc3[_0xd256('0x2f')]=_[_0xd256('0x2b')](_0x3ee8b6,_0xd256('0x29'));_0x3afcc3[_0xd256('0x30')]=_[_0xd256('0x31')](_0x4f345e[_0xd256('0x30')]);_0x3afcc3[_0xd256('0x32')]=_[_0xd256('0x33')](_0x3afcc3[_0xd256('0x2f')],_0x3afcc3[_0xd256('0x30')]);_0x474cbf[_0xd256('0x34')]=_[_0xd256('0x33')](_0x3afcc3[_0xd256('0x2f')],qs[_0xd256('0x35')](_0x4f345e[_0xd256('0x30')][_0xd256('0x35')]));_0x474cbf[_0xd256('0x34')]=_0x474cbf[_0xd256('0x34')][_0xd256('0x36')]?_0x474cbf[_0xd256('0x34')]:_0x3afcc3[_0xd256('0x2f')];if(!_0x4f345e[_0xd256('0x30')][_0xd256('0x37')](_0xd256('0x38'))){_0x474cbf[_0xd256('0x21')]=qs[_0xd256('0x21')](_0x4f345e[_0xd256('0x30')][_0xd256('0x21')]);_0x474cbf['offset']=qs[_0xd256('0x20')](_0x4f345e[_0xd256('0x30')][_0xd256('0x20')]);}_0x474cbf['order']=qs[_0xd256('0x39')](_0x4f345e[_0xd256('0x30')][_0xd256('0x39')]);_0x474cbf[_0xd256('0x3a')]=qs[_0xd256('0x32')](_[_0xd256('0x3b')](_0x4f345e[_0xd256('0x30')],_0x3afcc3[_0xd256('0x32')]),_0x3ee8b6);if(_0x4f345e[_0xd256('0x30')][_0xd256('0x3c')]){_0x474cbf[_0xd256('0x3a')]=_[_0xd256('0x3d')](_0x474cbf['where'],{'$or':_[_0xd256('0x2b')](_0x3ee8b6,function(_0x14bffe){if(_0x14bffe['type']!==_0xd256('0x3e')){var _0x1ef103={};_0x1ef103[_0x14bffe[_0xd256('0x29')]]={'$like':'%'+_0x4f345e['query'][_0xd256('0x3c')]+'%'};return _0x1ef103;}})});}_0x474cbf=_[_0xd256('0x3d')]({},_0x474cbf,_0x4f345e[_0xd256('0x3f')]);var _0x14854e={'where':_0x474cbf[_0xd256('0x3a')]};return db[_0xd256('0x2c')]['count'](_0x14854e)[_0xd256('0x25')](function(_0x53f2f1){_0xf2b9[_0xd256('0x40')]=_0x53f2f1;if(_0x4f345e['query'][_0xd256('0x41')]){_0x474cbf[_0xd256('0x42')]=[{'all':!![]}];}return db['SquareProject'][_0xd256('0x43')](_0x474cbf);})[_0xd256('0x25')](function(_0x9b03f6){_0xf2b9[_0xd256('0x44')]=_0x9b03f6;return _0xf2b9;})[_0xd256('0x25')](respondWithFilteredResult(_0x1f5099,_0x474cbf))[_0xd256('0x45')](handleError(_0x1f5099,null));};exports[_0xd256('0x46')]=function(_0x2ccdd9,_0x590fbe){var _0x5d88f3={'raw':![],'where':{'id':_0x2ccdd9[_0xd256('0x47')]['id']}},_0x5e5ea1={};_0x5e5ea1[_0xd256('0x2f')]=_[_0xd256('0x31')](db[_0xd256('0x2c')]['rawAttributes']);_0x5e5ea1['query']=_['keys'](_0x2ccdd9[_0xd256('0x30')]);_0x5e5ea1[_0xd256('0x32')]=_[_0xd256('0x33')](_0x5e5ea1[_0xd256('0x2f')],_0x5e5ea1[_0xd256('0x30')]);_0x5d88f3[_0xd256('0x34')]=_['intersection'](_0x5e5ea1[_0xd256('0x2f')],qs[_0xd256('0x35')](_0x2ccdd9[_0xd256('0x30')][_0xd256('0x35')]));_0x5d88f3['attributes']=_0x5d88f3[_0xd256('0x34')]['length']?_0x5d88f3[_0xd256('0x34')]:_0x5e5ea1['model'];if(_0x2ccdd9[_0xd256('0x30')][_0xd256('0x41')]){_0x5d88f3[_0xd256('0x42')]=[{'all':!![]}];}_0x5d88f3=_['merge']({},_0x5d88f3,_0x2ccdd9[_0xd256('0x3f')]);return db['SquareProject'][_0xd256('0x48')](_0x5d88f3)[_0xd256('0x25')](handleEntityNotFound(_0x590fbe,null))[_0xd256('0x25')](respondWithResult(_0x590fbe,null))['catch'](handleError(_0x590fbe,null));};exports[_0xd256('0x49')]=function(_0x31dbe3,_0x1f707e){return db['SquareProject']['create'](_0x31dbe3[_0xd256('0x4a')],{})[_0xd256('0x25')](function(_0x4eae7d){var _0x514414=_0x31dbe3[_0xd256('0x4b')]['get']({'plain':!![]});if(!_0x514414)throw new Error(_0xd256('0x4c'));if(_0x514414[_0xd256('0x4d')]==='user'){var _0x355860=_0x4eae7d[_0xd256('0x27')]({'plain':!![]});var _0x3af811='SquareProjects';return db['UserProfileSection'][_0xd256('0x48')]({'where':{'name':_0x3af811,'userProfileId':_0x514414['userProfileId']},'raw':!![]})[_0xd256('0x25')](function(_0x36e47f){if(_0x36e47f&&_0x36e47f[_0xd256('0x4e')]===0x0){return db[_0xd256('0x4f')][_0xd256('0x49')]({'name':_0x355860[_0xd256('0x29')],'resourceId':_0x355860['id'],'type':_0x36e47f['name'],'sectionId':_0x36e47f['id']},{})['then'](function(){return _0x4eae7d;});}else{return _0x4eae7d;}})[_0xd256('0x45')](function(_0x189d33){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x189d33);throw _0x189d33;});}return _0x4eae7d;})[_0xd256('0x25')](respondWithResult(_0x1f707e,0xc9))[_0xd256('0x45')](handleError(_0x1f707e,null));};exports[_0xd256('0x50')]=function(_0x2f03ac,_0x30cb38){if(_0x2f03ac[_0xd256('0x4a')]['id']){delete _0x2f03ac[_0xd256('0x4a')]['id'];}return db['SquareProject'][_0xd256('0x48')]({'where':{'id':_0x2f03ac[_0xd256('0x47')]['id']}})['then'](handleEntityNotFound(_0x30cb38,null))['then'](saveUpdates(_0x2f03ac[_0xd256('0x4a')],null))['then'](respondWithResult(_0x30cb38,null))[_0xd256('0x45')](handleError(_0x30cb38,null));};exports[_0xd256('0x26')]=function(_0x3369ab,_0x2e338c){return db[_0xd256('0x2c')][_0xd256('0x48')]({'where':{'id':_0x3369ab[_0xd256('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e338c,null))[_0xd256('0x25')](removeEntity(_0x2e338c,null))[_0xd256('0x45')](handleError(_0x2e338c,null));};exports[_0xd256('0x51')]=function(_0x5f337c,_0x338bdf,_0x280f37){return db[_0xd256('0x2c')][_0xd256('0x48')]({'where':{'id':_0x5f337c[_0xd256('0x47')]['id']}})[_0xd256('0x25')](handleEntityNotFound(_0x338bdf,null))[_0xd256('0x25')](function(_0x237a1f){if(_0x237a1f){return _0x237a1f[_0xd256('0x51')](_0x5f337c[_0xd256('0x4a')][_0xd256('0x52')],_[_0xd256('0x53')](_0x5f337c[_0xd256('0x4a')],['ids','id'])||{});}})[_0xd256('0x25')](respondWithResult(_0x338bdf,null))[_0xd256('0x45')](handleError(_0x338bdf,null));};exports['removeUsers']=function(_0x352921,_0x15ca66,_0xb53c27){return db[_0xd256('0x2c')][_0xd256('0x48')]({'where':{'id':_0x352921['params']['id']}})[_0xd256('0x25')](handleEntityNotFound(_0x15ca66,null))['then'](function(_0x1afae8){if(_0x1afae8){return _0x1afae8[_0xd256('0x54')](_0x352921[_0xd256('0x30')]['ids'])[_0xd256('0x25')](function(){if(_['isArray'](_0x352921[_0xd256('0x30')]['ids'])){for(var _0x149b69=0x0;_0x149b69<_0x352921[_0xd256('0x30')][_0xd256('0x52')]['length'];_0x149b69+=0x1){socket[_0xd256('0x55')]('userSquareProject:remove',{'UserId':Number(_0x352921[_0xd256('0x30')][_0xd256('0x52')][_0x149b69]),'SquareProjectId':Number(_0x352921[_0xd256('0x47')]['id'])});}}else{socket['emit'](_0xd256('0x56'),{'UserId':Number(_0x352921['query'][_0xd256('0x52')]),'SquareProjectId':Number(_0x352921[_0xd256('0x47')]['id'])});}});}})[_0xd256('0x25')](respondWithStatusCode(_0x15ca66,null))[_0xd256('0x45')](handleError(_0x15ca66,null));};exports[_0xd256('0x57')]=function(_0x16d996,_0x246789,_0x46a6ed){var _0x17f912={};var _0x59d598={};var _0x8f6be7;var _0x37b8fd;return db['SquareProject'][_0xd256('0x58')]({'where':{'id':_0x16d996[_0xd256('0x47')]['id']}})[_0xd256('0x25')](handleEntityNotFound(_0x246789,null))[_0xd256('0x25')](function(_0x11cf37){if(_0x11cf37){_0x8f6be7=_0x11cf37;_0x59d598[_0xd256('0x2f')]=_[_0xd256('0x31')](db[_0xd256('0x59')][_0xd256('0x5a')]);_0x59d598[_0xd256('0x30')]=_[_0xd256('0x31')](_0x16d996[_0xd256('0x30')]);_0x59d598[_0xd256('0x32')]=_[_0xd256('0x33')](_0x59d598[_0xd256('0x2f')],_0x59d598[_0xd256('0x30')]);_0x17f912[_0xd256('0x34')]=_['intersection'](_0x59d598['model'],qs[_0xd256('0x35')](_0x16d996[_0xd256('0x30')][_0xd256('0x35')]));_0x17f912[_0xd256('0x34')]=_0x17f912[_0xd256('0x34')][_0xd256('0x36')]?_0x17f912['attributes']:_0x59d598['model'];_0x17f912['order']=qs[_0xd256('0x39')](_0x16d996[_0xd256('0x30')]['sort']);_0x17f912[_0xd256('0x3a')]=qs[_0xd256('0x32')](_[_0xd256('0x3b')](_0x16d996[_0xd256('0x30')],_0x59d598[_0xd256('0x32')]));if(_0x16d996[_0xd256('0x30')][_0xd256('0x3c')]){_0x17f912[_0xd256('0x3a')]=_['merge'](_0x17f912['where'],{'$or':_[_0xd256('0x2b')](_0x17f912[_0xd256('0x34')],function(_0x210367){var _0x4a0208={};_0x4a0208[_0x210367]={'$like':'%'+_0x16d996[_0xd256('0x30')][_0xd256('0x3c')]+'%'};return _0x4a0208;})});}_0x17f912=_[_0xd256('0x3d')]({},_0x17f912,_0x16d996['options']);return _0x8f6be7[_0xd256('0x57')](_0x17f912);}})[_0xd256('0x25')](function(_0xafe48c){if(_0xafe48c){_0x37b8fd=_0xafe48c['length'];if(!_0x16d996[_0xd256('0x30')][_0xd256('0x37')](_0xd256('0x38'))){_0x17f912[_0xd256('0x21')]=qs[_0xd256('0x21')](_0x16d996[_0xd256('0x30')]['limit']);_0x17f912[_0xd256('0x20')]=qs['offset'](_0x16d996[_0xd256('0x30')]['offset']);}return _0x8f6be7['getUsers'](_0x17f912);}})[_0xd256('0x25')](function(_0x34a13d){if(_0x34a13d){return _0x34a13d?{'count':_0x37b8fd,'rows':_0x34a13d}:null;}})[_0xd256('0x25')](respondWithResult(_0x246789,null))[_0xd256('0x45')](handleError(_0x246789,null));}; \ No newline at end of file +var _0xe16d=['name','send','SquareProject','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','map','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addUsers','omit','ids','removeUsers','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','status','end','json','count','offset','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','error','stack'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xe16d,0x148));var _0xde16=function(_0x3b3ee7,_0x4f2576){_0x3b3ee7=_0x3b3ee7-0x0;var _0x3bf02b=_0xe16d[_0x3b3ee7];return _0x3bf02b;};'use strict';var pdf=require(_0xde16('0x0'));var emlformat=require(_0xde16('0x1'));var rimraf=require(_0xde16('0x2'));var zipdir=require(_0xde16('0x3'));var jsonpatch=require(_0xde16('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde16('0x5'));var Mustache=require(_0xde16('0x6'));var util=require(_0xde16('0x7'));var path=require('path');var sox=require(_0xde16('0x8'));var csv=require(_0xde16('0x9'));var ejs=require(_0xde16('0xa'));var fs=require('fs');var _=require(_0xde16('0xb'));var squel=require(_0xde16('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde16('0xd'));var toCsv=require(_0xde16('0x9'));var querystring=require('querystring');var Papa=require(_0xde16('0xe'));var Redis=require(_0xde16('0xf'));var authService=require(_0xde16('0x10'));var qs=require(_0xde16('0x11'));var as=require(_0xde16('0x12'));var hardwareService=require(_0xde16('0x13'));var logger=require(_0xde16('0x14'))('api');var utils=require(_0xde16('0x15'));var config=require(_0xde16('0x16'));var db=require(_0xde16('0x17'))['db'];config[_0xde16('0x18')]=_['defaults'](config[_0xde16('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xde16('0x19'))(new Redis(config[_0xde16('0x18')]));require(_0xde16('0x1a'))[_0xde16('0x1b')](socket);function respondWithStatusCode(_0x3a99ed,_0x27a1ef){_0x27a1ef=_0x27a1ef||0xcc;return function(_0x526245){if(_0x526245){return _0x3a99ed['sendStatus'](_0x27a1ef);}return _0x3a99ed[_0xde16('0x1c')](_0x27a1ef)[_0xde16('0x1d')]();};}function respondWithResult(_0x34d971,_0x1b5882){_0x1b5882=_0x1b5882||0xc8;return function(_0x4b14bc){if(_0x4b14bc){return _0x34d971[_0xde16('0x1c')](_0x1b5882)[_0xde16('0x1e')](_0x4b14bc);}};}function respondWithFilteredResult(_0x569ad3,_0x262cdc){return function(_0x16ced3){if(_0x16ced3){var _0x4dbfda=_0x16ced3[_0xde16('0x1f')],_0x30925a=_0x262cdc['offset'],_0x247474=_0x262cdc[_0xde16('0x20')]+_0x262cdc['limit'],_0x37d3d6;if(_0x247474>=_0x4dbfda){_0x247474=_0x4dbfda;_0x37d3d6=0xc8;}else{_0x37d3d6=0xce;}_0x569ad3[_0xde16('0x1c')](_0x37d3d6);return _0x569ad3[_0xde16('0x21')](_0xde16('0x22'),_0x30925a+'-'+_0x247474+'/'+_0x4dbfda)[_0xde16('0x1e')](_0x16ced3);}return null;};}function patchUpdates(_0x3d9bb2){return function(_0x33de76){try{jsonpatch['apply'](_0x33de76,_0x3d9bb2,!![]);}catch(_0x4a95d1){return BPromise['reject'](_0x4a95d1);}return _0x33de76['save']();};}function saveUpdates(_0x533e3c,_0x3f1c7a){return function(_0x21fc89){if(_0x21fc89){return _0x21fc89[_0xde16('0x23')](_0x533e3c)['then'](function(_0x1680cb){return _0x1680cb;});}return null;};}function removeEntity(_0x4216c0,_0x15b533){return function(_0x2faac6){if(_0x2faac6){return _0x2faac6[_0xde16('0x24')]()[_0xde16('0x25')](function(){var _0x4e6152=_0x2faac6[_0xde16('0x26')]({'plain':!![]});var _0x566c0a=_0xde16('0x27');return db[_0xde16('0x28')]['destroy']({'where':{'type':_0x566c0a,'resourceId':_0x4e6152['id']}})[_0xde16('0x25')](function(){return _0x2faac6;});})[_0xde16('0x25')](function(){_0x4216c0['status'](0xcc)[_0xde16('0x1d')]();});}};}function handleEntityNotFound(_0x55a658,_0x5292ba){return function(_0x323135){if(!_0x323135){_0x55a658[_0xde16('0x29')](0x194);}return _0x323135;};}function handleError(_0x5ce073,_0xffb9a7){_0xffb9a7=_0xffb9a7||0x1f4;return function(_0x2b0dbe){logger[_0xde16('0x2a')](_0x2b0dbe[_0xde16('0x2b')]);if(_0x2b0dbe[_0xde16('0x2c')]){delete _0x2b0dbe[_0xde16('0x2c')];}_0x5ce073[_0xde16('0x1c')](_0xffb9a7)[_0xde16('0x2d')](_0x2b0dbe);};}exports['index']=function(_0x42f6e6,_0xd277cb){var _0xd2627b={},_0x5842d7={},_0x79f448={'count':0x0,'rows':[]};var _0x492b45=_['map'](db[_0xde16('0x2e')][_0xde16('0x2f')],function(_0x16c7db){return{'name':_0x16c7db[_0xde16('0x30')],'type':_0x16c7db['type'][_0xde16('0x31')]};});_0x5842d7[_0xde16('0x32')]=_['map'](_0x492b45,_0xde16('0x2c'));_0x5842d7['query']=_['keys'](_0x42f6e6[_0xde16('0x33')]);_0x5842d7['filters']=_[_0xde16('0x34')](_0x5842d7[_0xde16('0x32')],_0x5842d7[_0xde16('0x33')]);_0xd2627b[_0xde16('0x35')]=_[_0xde16('0x34')](_0x5842d7[_0xde16('0x32')],qs[_0xde16('0x36')](_0x42f6e6[_0xde16('0x33')][_0xde16('0x36')]));_0xd2627b[_0xde16('0x35')]=_0xd2627b[_0xde16('0x35')][_0xde16('0x37')]?_0xd2627b['attributes']:_0x5842d7[_0xde16('0x32')];if(!_0x42f6e6[_0xde16('0x33')][_0xde16('0x38')](_0xde16('0x39'))){_0xd2627b[_0xde16('0x3a')]=qs['limit'](_0x42f6e6['query'][_0xde16('0x3a')]);_0xd2627b[_0xde16('0x20')]=qs[_0xde16('0x20')](_0x42f6e6['query']['offset']);}_0xd2627b[_0xde16('0x3b')]=qs[_0xde16('0x3c')](_0x42f6e6[_0xde16('0x33')]['sort']);_0xd2627b['where']=qs[_0xde16('0x3d')](_[_0xde16('0x3e')](_0x42f6e6[_0xde16('0x33')],_0x5842d7[_0xde16('0x3d')]),_0x492b45);if(_0x42f6e6[_0xde16('0x33')][_0xde16('0x3f')]){_0xd2627b[_0xde16('0x40')]=_['merge'](_0xd2627b['where'],{'$or':_[_0xde16('0x41')](_0x492b45,function(_0x20920c){if(_0x20920c[_0xde16('0x42')]!==_0xde16('0x43')){var _0x329d89={};_0x329d89[_0x20920c[_0xde16('0x2c')]]={'$like':'%'+_0x42f6e6[_0xde16('0x33')][_0xde16('0x3f')]+'%'};return _0x329d89;}})});}_0xd2627b=_[_0xde16('0x44')]({},_0xd2627b,_0x42f6e6[_0xde16('0x45')]);var _0x19be89={'where':_0xd2627b[_0xde16('0x40')]};return db[_0xde16('0x2e')][_0xde16('0x1f')](_0x19be89)[_0xde16('0x25')](function(_0x189547){_0x79f448[_0xde16('0x1f')]=_0x189547;if(_0x42f6e6[_0xde16('0x33')][_0xde16('0x46')]){_0xd2627b['include']=[{'all':!![]}];}return db[_0xde16('0x2e')][_0xde16('0x47')](_0xd2627b);})['then'](function(_0x2ebc31){_0x79f448['rows']=_0x2ebc31;return _0x79f448;})[_0xde16('0x25')](respondWithFilteredResult(_0xd277cb,_0xd2627b))[_0xde16('0x48')](handleError(_0xd277cb,null));};exports[_0xde16('0x49')]=function(_0x30372a,_0x213b34){var _0x387ea4={'raw':![],'where':{'id':_0x30372a[_0xde16('0x4a')]['id']}},_0x53df36={};_0x53df36[_0xde16('0x32')]=_[_0xde16('0x4b')](db[_0xde16('0x2e')][_0xde16('0x2f')]);_0x53df36[_0xde16('0x33')]=_[_0xde16('0x4b')](_0x30372a[_0xde16('0x33')]);_0x53df36['filters']=_['intersection'](_0x53df36[_0xde16('0x32')],_0x53df36[_0xde16('0x33')]);_0x387ea4['attributes']=_[_0xde16('0x34')](_0x53df36[_0xde16('0x32')],qs[_0xde16('0x36')](_0x30372a[_0xde16('0x33')][_0xde16('0x36')]));_0x387ea4['attributes']=_0x387ea4['attributes'][_0xde16('0x37')]?_0x387ea4[_0xde16('0x35')]:_0x53df36[_0xde16('0x32')];if(_0x30372a[_0xde16('0x33')][_0xde16('0x46')]){_0x387ea4[_0xde16('0x4c')]=[{'all':!![]}];}_0x387ea4=_[_0xde16('0x44')]({},_0x387ea4,_0x30372a[_0xde16('0x45')]);return db[_0xde16('0x2e')][_0xde16('0x4d')](_0x387ea4)[_0xde16('0x25')](handleEntityNotFound(_0x213b34,null))[_0xde16('0x25')](respondWithResult(_0x213b34,null))['catch'](handleError(_0x213b34,null));};exports[_0xde16('0x4e')]=function(_0x70d4aa,_0x2b5935){return db['SquareProject'][_0xde16('0x4e')](_0x70d4aa[_0xde16('0x4f')],{})[_0xde16('0x25')](function(_0x3295ab){var _0x5f2529=_0x70d4aa[_0xde16('0x50')][_0xde16('0x26')]({'plain':!![]});if(!_0x5f2529)throw new Error(_0xde16('0x51'));if(_0x5f2529['role']===_0xde16('0x50')){var _0x4a0846=_0x3295ab[_0xde16('0x26')]({'plain':!![]});var _0x45ea6b=_0xde16('0x27');return db[_0xde16('0x52')][_0xde16('0x4d')]({'where':{'name':_0x45ea6b,'userProfileId':_0x5f2529[_0xde16('0x53')]},'raw':!![]})['then'](function(_0x69f78b){if(_0x69f78b&&_0x69f78b[_0xde16('0x54')]===0x0){return db[_0xde16('0x28')][_0xde16('0x4e')]({'name':_0x4a0846['name'],'resourceId':_0x4a0846['id'],'type':_0x69f78b['name'],'sectionId':_0x69f78b['id']},{})['then'](function(){return _0x3295ab;});}else{return _0x3295ab;}})['catch'](function(_0x2a2d13){logger[_0xde16('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a2d13);throw _0x2a2d13;});}return _0x3295ab;})['then'](respondWithResult(_0x2b5935,0xc9))[_0xde16('0x48')](handleError(_0x2b5935,null));};exports[_0xde16('0x23')]=function(_0x5c6560,_0x1ec232){if(_0x5c6560['body']['id']){delete _0x5c6560[_0xde16('0x4f')]['id'];}return db[_0xde16('0x2e')][_0xde16('0x4d')]({'where':{'id':_0x5c6560['params']['id']}})[_0xde16('0x25')](handleEntityNotFound(_0x1ec232,null))['then'](saveUpdates(_0x5c6560['body'],null))[_0xde16('0x25')](respondWithResult(_0x1ec232,null))[_0xde16('0x48')](handleError(_0x1ec232,null));};exports[_0xde16('0x24')]=function(_0x51ce44,_0x17e5ed){return db[_0xde16('0x2e')][_0xde16('0x4d')]({'where':{'id':_0x51ce44[_0xde16('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17e5ed,null))[_0xde16('0x25')](removeEntity(_0x17e5ed,null))[_0xde16('0x48')](handleError(_0x17e5ed,null));};exports[_0xde16('0x55')]=function(_0x281893,_0x281aa8,_0xf09ecb){return db[_0xde16('0x2e')]['find']({'where':{'id':_0x281893['params']['id']}})[_0xde16('0x25')](handleEntityNotFound(_0x281aa8,null))['then'](function(_0x5f44a0){if(_0x5f44a0){return _0x5f44a0['addUsers'](_0x281893[_0xde16('0x4f')]['ids'],_[_0xde16('0x56')](_0x281893[_0xde16('0x4f')],[_0xde16('0x57'),'id'])||{});}})[_0xde16('0x25')](respondWithResult(_0x281aa8,null))[_0xde16('0x48')](handleError(_0x281aa8,null));};exports[_0xde16('0x58')]=function(_0x1dac36,_0x1dce79,_0x3b0e92){return db['SquareProject'][_0xde16('0x4d')]({'where':{'id':_0x1dac36[_0xde16('0x4a')]['id']}})[_0xde16('0x25')](handleEntityNotFound(_0x1dce79,null))[_0xde16('0x25')](function(_0x507046){if(_0x507046){return _0x507046[_0xde16('0x58')](_0x1dac36[_0xde16('0x33')][_0xde16('0x57')])['then'](function(){if(_['isArray'](_0x1dac36['query']['ids'])){for(var _0x5091f9=0x0;_0x5091f9<_0x1dac36['query'][_0xde16('0x57')][_0xde16('0x37')];_0x5091f9+=0x1){socket['emit'](_0xde16('0x59'),{'UserId':Number(_0x1dac36[_0xde16('0x33')][_0xde16('0x57')][_0x5091f9]),'SquareProjectId':Number(_0x1dac36['params']['id'])});}}else{socket['emit'](_0xde16('0x59'),{'UserId':Number(_0x1dac36[_0xde16('0x33')][_0xde16('0x57')]),'SquareProjectId':Number(_0x1dac36['params']['id'])});}});}})[_0xde16('0x25')](respondWithStatusCode(_0x1dce79,null))[_0xde16('0x48')](handleError(_0x1dce79,null));};exports[_0xde16('0x5a')]=function(_0x3c0cba,_0x1c4c1d,_0x27c9a0){var _0x589fbd={};var _0x58580d={};var _0xa412b5;var _0x4e3e10;return db[_0xde16('0x2e')][_0xde16('0x5b')]({'where':{'id':_0x3c0cba[_0xde16('0x4a')]['id']}})[_0xde16('0x25')](handleEntityNotFound(_0x1c4c1d,null))[_0xde16('0x25')](function(_0x2783be){if(_0x2783be){_0xa412b5=_0x2783be;_0x58580d[_0xde16('0x32')]=_['keys'](db[_0xde16('0x5c')][_0xde16('0x2f')]);_0x58580d['query']=_[_0xde16('0x4b')](_0x3c0cba[_0xde16('0x33')]);_0x58580d[_0xde16('0x3d')]=_[_0xde16('0x34')](_0x58580d[_0xde16('0x32')],_0x58580d['query']);_0x589fbd[_0xde16('0x35')]=_['intersection'](_0x58580d['model'],qs[_0xde16('0x36')](_0x3c0cba[_0xde16('0x33')][_0xde16('0x36')]));_0x589fbd[_0xde16('0x35')]=_0x589fbd[_0xde16('0x35')][_0xde16('0x37')]?_0x589fbd[_0xde16('0x35')]:_0x58580d[_0xde16('0x32')];_0x589fbd['order']=qs[_0xde16('0x3c')](_0x3c0cba[_0xde16('0x33')]['sort']);_0x589fbd['where']=qs[_0xde16('0x3d')](_[_0xde16('0x3e')](_0x3c0cba[_0xde16('0x33')],_0x58580d[_0xde16('0x3d')]));if(_0x3c0cba[_0xde16('0x33')][_0xde16('0x3f')]){_0x589fbd[_0xde16('0x40')]=_['merge'](_0x589fbd['where'],{'$or':_[_0xde16('0x41')](_0x589fbd['attributes'],function(_0x1911d2){var _0x51f149={};_0x51f149[_0x1911d2]={'$like':'%'+_0x3c0cba[_0xde16('0x33')][_0xde16('0x3f')]+'%'};return _0x51f149;})});}_0x589fbd=_['merge']({},_0x589fbd,_0x3c0cba[_0xde16('0x45')]);return _0xa412b5[_0xde16('0x5a')](_0x589fbd);}})[_0xde16('0x25')](function(_0x478230){if(_0x478230){_0x4e3e10=_0x478230[_0xde16('0x37')];if(!_0x3c0cba[_0xde16('0x33')]['hasOwnProperty'](_0xde16('0x39'))){_0x589fbd['limit']=qs['limit'](_0x3c0cba[_0xde16('0x33')][_0xde16('0x3a')]);_0x589fbd[_0xde16('0x20')]=qs[_0xde16('0x20')](_0x3c0cba['query']['offset']);}return _0xa412b5[_0xde16('0x5a')](_0x589fbd);}})[_0xde16('0x25')](function(_0x3686d8){if(_0x3686d8){return _0x3686d8?{'count':_0x4e3e10,'rows':_0x3686d8}:null;}})[_0xde16('0x25')](respondWithResult(_0x1c4c1d,null))['catch'](handleError(_0x1c4c1d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e2c4275..0b1a8d9 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 _0xe01d=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x450185,_0x10ba03){var _0x16431a=function(_0x31e3fa){while(--_0x31e3fa){_0x450185['push'](_0x450185['shift']());}};_0x16431a(++_0x10ba03);}(_0xe01d,0x1c2));var _0xde01=function(_0x38cb44,_0x2cfb6a){_0x38cb44=_0x38cb44-0x0;var _0x2d08ab=_0xe01d[_0x38cb44];return _0x2d08ab;};'use strict';var EventEmitter=require(_0xde01('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xde01('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xde01('0x2')](0x0);var events={'afterCreate':_0xde01('0x3'),'afterUpdate':_0xde01('0x4'),'afterDestroy':_0xde01('0x5')};function emitEvent(_0x21d7d3){return function(_0x48bc69,_0x4c07e5,_0x51723f){SquareProjectEvents[_0xde01('0x6')](_0x21d7d3+':'+_0x48bc69['id'],_0x48bc69);SquareProjectEvents[_0xde01('0x6')](_0x21d7d3,_0x48bc69);_0x51723f(null);};}for(var e in events){if(events[_0xde01('0x7')](e)){var event=events[e];SquareProject[_0xde01('0x8')](e,emitEvent(event));}}module[_0xde01('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x3178=['hasOwnProperty','hook','exports','setMaxListeners','update','remove','emit'];(function(_0xbdb1c3,_0x1ceaea){var _0x413fcf=function(_0x3a4bae){while(--_0x3a4bae){_0xbdb1c3['push'](_0xbdb1c3['shift']());}};_0x413fcf(++_0x1ceaea);}(_0x3178,0x176));var _0x8317=function(_0x317e3c,_0x27e519){_0x317e3c=_0x317e3c-0x0;var _0x58b3b6=_0x3178[_0x317e3c];return _0x58b3b6;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8317('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8317('0x1'),'afterDestroy':_0x8317('0x2')};function emitEvent(_0x48a4d9){return function(_0x36cef6,_0x5a2062,_0x26a592){SquareProjectEvents[_0x8317('0x3')](_0x48a4d9+':'+_0x36cef6['id'],_0x36cef6);SquareProjectEvents[_0x8317('0x3')](_0x48a4d9,_0x36cef6);_0x26a592(null);};}for(var e in events){if(events[_0x8317('0x4')](e)){var event=events[e];SquareProject[_0x8317('0x5')](e,emitEvent(event));}}module[_0x8317('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 8ef93aa..7625797 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','util','api','moment'];(function(_0x2fef47,_0x310202){var _0x4abd11=function(_0x334096){while(--_0x334096){_0x2fef47['push'](_0x2fef47['shift']());}};_0x4abd11(++_0x310202);}(_0xadb5,0xad));var _0x5adb=function(_0x5c2780,_0x357f90){_0x5c2780=_0x5c2780-0x0;var _0x590bc9=_0xadb5[_0x5c2780];return _0x590bc9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./squareProject.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x481500,_0x15707c){var _0x25b06e=function(_0x226c42){while(--_0x226c42){_0x481500['push'](_0x481500['shift']());}};_0x25b06e(++_0x15707c);}(_0x0295,0x1f0));var _0x5029=function(_0x4cddc9,_0x5e7f02){_0x4cddc9=_0x4cddc9-0x0;var _0x1b6f2b=_0x0295[_0x4cddc9];return _0x1b6f2b;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5057b52..7f2c852 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 _0x9cae=['http','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareProject','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5f4ff1,_0x5e6543){var _0x4a2284=function(_0x1255f1){while(--_0x1255f1){_0x5f4ff1['push'](_0x5f4ff1['shift']());}};_0x4a2284(++_0x5e6543);}(_0x9cae,0xae));var _0xe9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9cae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe9ca('0x0'));var util=require('util');var moment=require(_0xe9ca('0x1'));var BPromise=require(_0xe9ca('0x2'));var rs=require(_0xe9ca('0x3'));var fs=require('fs');var Redis=require(_0xe9ca('0x4'));var db=require(_0xe9ca('0x5'))['db'];var utils=require(_0xe9ca('0x6'));var logger=require(_0xe9ca('0x7'))('rpc');var config=require(_0xe9ca('0x8'));var jayson=require(_0xe9ca('0x9'));var client=jayson[_0xe9ca('0xa')][_0xe9ca('0xb')]({'port':0x232a});config['redis']=_[_0xe9ca('0xc')](config['redis'],{'host':_0xe9ca('0xd'),'port':0x18eb});var socket=require(_0xe9ca('0xe'))(new Redis(config[_0xe9ca('0xf')]));require(_0xe9ca('0x10'))[_0xe9ca('0x11')](socket);function respondWithRpcPromise(_0x2b464b,_0x2502d1,_0xcdcf97){return new BPromise(function(_0x499537,_0x53167a){return client[_0xe9ca('0x12')](_0x2b464b,_0xcdcf97)['then'](function(_0x539fe2){logger[_0xe9ca('0x13')](_0xe9ca('0x14'),_0x2502d1,_0xe9ca('0x15'));logger[_0xe9ca('0x16')](_0xe9ca('0x17'),_0x2502d1,'request\x20sent',JSON[_0xe9ca('0x18')](_0x539fe2));if(_0x539fe2[_0xe9ca('0x19')]){if(_0x539fe2[_0xe9ca('0x19')][_0xe9ca('0x1a')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x2502d1,_0x539fe2[_0xe9ca('0x19')][_0xe9ca('0x1b')]);return _0x53167a(_0x539fe2[_0xe9ca('0x19')][_0xe9ca('0x1b')]);}logger[_0xe9ca('0x19')](_0xe9ca('0x14'),_0x2502d1,_0x539fe2[_0xe9ca('0x19')][_0xe9ca('0x1b')]);return _0x499537(_0x539fe2[_0xe9ca('0x19')]['message']);}else{logger['info'](_0xe9ca('0x14'),_0x2502d1,'request\x20sent');_0x499537(_0x539fe2['result']['message']);}})[_0xe9ca('0x1c')](function(_0x40bcc7){logger[_0xe9ca('0x19')]('SquareProject,\x20%s,\x20%s',_0x2502d1,_0x40bcc7);_0x53167a(_0x40bcc7);});});}exports[_0xe9ca('0x1d')]=function(_0x488f5e){var _0x5943e9=this;return new Promise(function(_0x353df6,_0x5beb71){return db['SquareProject']['find']({'raw':_0x488f5e[_0xe9ca('0x1e')]?_0x488f5e['options'][_0xe9ca('0x1f')]===undefined?!![]:![]:!![],'where':_0x488f5e[_0xe9ca('0x1e')]?_0x488f5e[_0xe9ca('0x1e')][_0xe9ca('0x20')]||null:null,'attributes':_0x488f5e[_0xe9ca('0x1e')]?_0x488f5e['options'][_0xe9ca('0x21')]||null:null,'include':_0x488f5e[_0xe9ca('0x1e')]?_0x488f5e[_0xe9ca('0x1e')]['include']?_[_0xe9ca('0x22')](_0x488f5e[_0xe9ca('0x1e')][_0xe9ca('0x23')],function(_0x4f99b9){return{'model':db[_0x4f99b9[_0xe9ca('0x24')]],'as':_0x4f99b9['as'],'attributes':_0x4f99b9[_0xe9ca('0x21')],'include':_0x4f99b9[_0xe9ca('0x23')]?_[_0xe9ca('0x22')](_0x4f99b9[_0xe9ca('0x23')],function(_0x548d72){return{'model':db[_0x548d72['model']],'as':_0x548d72['as'],'attributes':_0x548d72[_0xe9ca('0x21')],'include':_0x548d72[_0xe9ca('0x23')]?_[_0xe9ca('0x22')](_0x548d72[_0xe9ca('0x23')],function(_0x3fa5a8){return{'model':db[_0x3fa5a8[_0xe9ca('0x24')]],'as':_0x3fa5a8['as'],'attributes':_0x3fa5a8[_0xe9ca('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x266640){logger['info'](_0xe9ca('0x1d'),_0x488f5e);logger[_0xe9ca('0x16')](_0xe9ca('0x1d'),_0x488f5e,JSON['stringify'](_0x266640));_0x353df6(_0x266640);})[_0xe9ca('0x1c')](function(_0x5c8bf8){logger[_0xe9ca('0x19')](_0xe9ca('0x1d'),_0x5c8bf8[_0xe9ca('0x1b')],_0x488f5e);_0x5beb71(_0x5943e9[_0xe9ca('0x19')](0x1f4,_0x5c8bf8[_0xe9ca('0x1b')]));});});}; \ No newline at end of file +var _0x8614=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5149f0,_0x5ca270){var _0x2b937b=function(_0x2c18ab){while(--_0x2c18ab){_0x5149f0['push'](_0x5149f0['shift']());}};_0x2b937b(++_0x5ca270);}(_0x8614,0x14e));var _0x4861=function(_0xd1d7f9,_0x47a27f){_0xd1d7f9=_0xd1d7f9-0x0;var _0x1a0020=_0x8614[_0xd1d7f9];return _0x1a0020;};'use strict';var _=require(_0x4861('0x0'));var util=require(_0x4861('0x1'));var moment=require(_0x4861('0x2'));var BPromise=require(_0x4861('0x3'));var rs=require(_0x4861('0x4'));var fs=require('fs');var Redis=require(_0x4861('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4861('0x6'));var logger=require(_0x4861('0x7'))('rpc');var config=require(_0x4861('0x8'));var jayson=require(_0x4861('0x9'));var client=jayson[_0x4861('0xa')][_0x4861('0xb')]({'port':0x232a});config[_0x4861('0xc')]=_[_0x4861('0xd')](config[_0x4861('0xc')],{'host':_0x4861('0xe'),'port':0x18eb});var socket=require(_0x4861('0xf'))(new Redis(config['redis']));require('./squareProject.socket')[_0x4861('0x10')](socket);function respondWithRpcPromise(_0x380aec,_0xd4240d,_0x36d11b){return new BPromise(function(_0xd91c32,_0x406508){return client[_0x4861('0x11')](_0x380aec,_0x36d11b)[_0x4861('0x12')](function(_0x40a126){logger[_0x4861('0x13')](_0x4861('0x14'),_0xd4240d,_0x4861('0x15'));logger[_0x4861('0x16')](_0x4861('0x17'),_0xd4240d,_0x4861('0x15'),JSON[_0x4861('0x18')](_0x40a126));if(_0x40a126[_0x4861('0x19')]){if(_0x40a126[_0x4861('0x19')][_0x4861('0x1a')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0xd4240d,_0x40a126[_0x4861('0x19')][_0x4861('0x1b')]);return _0x406508(_0x40a126[_0x4861('0x19')][_0x4861('0x1b')]);}logger['error'](_0x4861('0x14'),_0xd4240d,_0x40a126['error'][_0x4861('0x1b')]);return _0xd91c32(_0x40a126['error'][_0x4861('0x1b')]);}else{logger[_0x4861('0x13')](_0x4861('0x14'),_0xd4240d,_0x4861('0x15'));_0xd91c32(_0x40a126[_0x4861('0x1c')][_0x4861('0x1b')]);}})[_0x4861('0x1d')](function(_0x3e7a35){logger['error'](_0x4861('0x14'),_0xd4240d,_0x3e7a35);_0x406508(_0x3e7a35);});});}exports[_0x4861('0x1e')]=function(_0x10ccbe){var _0x19b56a=this;return new Promise(function(_0x1823b0,_0x331cfe){return db[_0x4861('0x1f')][_0x4861('0x20')]({'raw':_0x10ccbe['options']?_0x10ccbe[_0x4861('0x21')][_0x4861('0x22')]===undefined?!![]:![]:!![],'where':_0x10ccbe[_0x4861('0x21')]?_0x10ccbe[_0x4861('0x21')]['where']||null:null,'attributes':_0x10ccbe[_0x4861('0x21')]?_0x10ccbe[_0x4861('0x21')][_0x4861('0x23')]||null:null,'include':_0x10ccbe['options']?_0x10ccbe[_0x4861('0x21')]['include']?_['map'](_0x10ccbe[_0x4861('0x21')]['include'],function(_0x436d63){return{'model':db[_0x436d63['model']],'as':_0x436d63['as'],'attributes':_0x436d63[_0x4861('0x23')],'include':_0x436d63[_0x4861('0x24')]?_[_0x4861('0x25')](_0x436d63['include'],function(_0xd89547){return{'model':db[_0xd89547['model']],'as':_0xd89547['as'],'attributes':_0xd89547[_0x4861('0x23')],'include':_0xd89547[_0x4861('0x24')]?_[_0x4861('0x25')](_0xd89547[_0x4861('0x24')],function(_0x2d2e35){return{'model':db[_0x2d2e35['model']],'as':_0x2d2e35['as'],'attributes':_0x2d2e35[_0x4861('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4861('0x12')](function(_0x164668){logger[_0x4861('0x13')](_0x4861('0x1e'),_0x10ccbe);logger[_0x4861('0x16')](_0x4861('0x1e'),_0x10ccbe,JSON['stringify'](_0x164668));_0x1823b0(_0x164668);})['catch'](function(_0x2126d9){logger['error'](_0x4861('0x1e'),_0x2126d9['message'],_0x10ccbe);_0x331cfe(_0x19b56a[_0x4861('0x19')](0x1f4,_0x2126d9[_0x4861('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 39948be..0adff64 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 _0x2eb2=['squareProject:','save','remove','update','register','length'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x2eb2[_0x3de8a4];return _0x4635cf;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2')];function createListener(_0x1a002b,_0x1dd079){return function(_0xaf32cf){_0x1dd079['emit'](_0x1a002b,_0xaf32cf);};}function removeListener(_0x27732f,_0x4efe67){return function(){SquareProjectEvents['removeListener'](_0x27732f,_0x4efe67);};}exports[_0x22eb('0x3')]=function(_0x10e116){for(var _0x35dd5b=0x0,_0x2a9850=events[_0x22eb('0x4')];_0x35dd5b<_0x2a9850;_0x35dd5b++){var _0x396806=events[_0x35dd5b];var _0x33ddef=createListener(_0x22eb('0x5')+_0x396806,_0x10e116);SquareProjectEvents['on'](_0x396806,_0x33ddef);}}; \ No newline at end of file +var _0x781d=['squareProject:','./squareProject.events','save','emit','removeListener','register','length'];(function(_0x19df30,_0x59a15e){var _0x5ae3ca=function(_0x577ca3){while(--_0x577ca3){_0x19df30['push'](_0x19df30['shift']());}};_0x5ae3ca(++_0x59a15e);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var SquareProjectEvents=require(_0xd781('0x0'));var events=[_0xd781('0x1'),'remove','update'];function createListener(_0xb125bf,_0x44a72d){return function(_0x3cd308){_0x44a72d[_0xd781('0x2')](_0xb125bf,_0x3cd308);};}function removeListener(_0xfd915d,_0x42258e){return function(){SquareProjectEvents[_0xd781('0x3')](_0xfd915d,_0x42258e);};}exports[_0xd781('0x4')]=function(_0x830b){for(var _0x2f98ee=0x0,_0x5a07f0=events[_0xd781('0x5')];_0x2f98ee<_0x5a07f0;_0x2f98ee++){var _0x1a242d=events[_0x2f98ee];var _0x50610d=createListener(_0xd781('0x6')+_0x1a242d,_0x830b);SquareProjectEvents['on'](_0x1a242d,_0x50610d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 30a8d41..ca0c581 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 _0x913b=['get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x913b,0x1da));var _0xb913=function(_0x29c9eb,_0x3d680b){_0x29c9eb=_0x29c9eb-0x0;var _0x438352=_0x913b[_0x29c9eb];return _0x438352;};'use strict';var multer=require(_0xb913('0x0'));var util=require(_0xb913('0x1'));var path=require(_0xb913('0x2'));var timeout=require(_0xb913('0x3'));var express=require('express');var router=express[_0xb913('0x4')]();var auth=require(_0xb913('0x5'));var interaction=require(_0xb913('0x6'));var config=require(_0xb913('0x7'));var controller=require(_0xb913('0x8'));router[_0xb913('0x9')]('/',auth[_0xb913('0xa')](),controller[_0xb913('0xb')]);router['get'](_0xb913('0xc'),auth['isAuthenticated'](),controller[_0xb913('0xd')]);router[_0xb913('0x9')](_0xb913('0xe'),auth[_0xb913('0xa')](),controller['download']);router[_0xb913('0xf')]('/',auth[_0xb913('0xa')](),controller[_0xb913('0x10')]);router[_0xb913('0x11')](_0xb913('0xc'),auth[_0xb913('0xa')](),controller[_0xb913('0x12')]);router[_0xb913('0x13')](_0xb913('0x14'),auth[_0xb913('0xa')](),controller[_0xb913('0x15')]);module[_0xb913('0x16')]=router; \ No newline at end of file +var _0x64de=['download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','/:id','show','get'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x64de,0x10d));var _0xe64d=function(_0x397f4f,_0x131f3b){_0x397f4f=_0x397f4f-0x0;var _0x3e6fef=_0x64de[_0x397f4f];return _0x3e6fef;};'use strict';var multer=require(_0xe64d('0x0'));var util=require('util');var path=require(_0xe64d('0x1'));var timeout=require(_0xe64d('0x2'));var express=require(_0xe64d('0x3'));var router=express['Router']();var auth=require(_0xe64d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe64d('0x5'));var controller=require(_0xe64d('0x6'));router['get']('/',auth[_0xe64d('0x7')](),controller['index']);router['get'](_0xe64d('0x8'),auth[_0xe64d('0x7')](),controller[_0xe64d('0x9')]);router[_0xe64d('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe64d('0xb')]);router[_0xe64d('0xc')]('/',auth[_0xe64d('0x7')](),controller[_0xe64d('0xd')]);router[_0xe64d('0xe')]('/:id',auth[_0xe64d('0x7')](),controller[_0xe64d('0xf')]);router[_0xe64d('0x10')](_0xe64d('0x11'),auth[_0xe64d('0x7')](),controller[_0xe64d('0x12')]);module[_0xe64d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d406d3e..550e6d5 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 _0xbc77=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x1e7282,_0x3ad3d0){var _0x53a9fb=function(_0x121fe0){while(--_0x121fe0){_0x1e7282['push'](_0x1e7282['shift']());}};_0x53a9fb(++_0x3ad3d0);}(_0xbc77,0x15d));var _0x7bc7=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xbc77[_0x10004e];return _0x5af990;};'use strict';var Sequelize=require(_0x7bc7('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7bc7('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7bc7('0x1')]},'extension':{'type':Sequelize[_0x7bc7('0x1')]},'priority':{'type':Sequelize[_0x7bc7('0x1')]},'accountcode':{'type':Sequelize[_0x7bc7('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7bc7('0x1')]},'saveName':{'type':Sequelize[_0x7bc7('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7bc7('0x2')],'get':function(){var _0x1f56ae='';var _0x1bdb32=this[_0x7bc7('0x3')](_0x7bc7('0x4'));if(_0x1bdb32){_0x1f56ae=_0x1bdb32[_0x7bc7('0x5')](_0x1bdb32[_0x7bc7('0x6')]('.'));}return _0x1f56ae;}}}; \ No newline at end of file +var _0xe567=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize','exports'];(function(_0x541845,_0x2f8b95){var _0x35bfd0=function(_0x49b720){while(--_0x49b720){_0x541845['push'](_0x541845['shift']());}};_0x35bfd0(++_0x2f8b95);}(_0xe567,0xa6));var _0x7e56=function(_0x29c5c4,_0x36fa0a){_0x29c5c4=_0x29c5c4-0x0;var _0x2530b4=_0xe567[_0x29c5c4];return _0x2530b4;};'use strict';var Sequelize=require(_0x7e56('0x0'));module[_0x7e56('0x1')]={'uniqueid':{'type':Sequelize[_0x7e56('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7e56('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7e56('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7e56('0x2')]},'saveName':{'type':Sequelize[_0x7e56('0x2')]},'filename':{'type':Sequelize[_0x7e56('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7e56('0x3')],'get':function(){var _0x259fb6='';var _0x147cb8=this[_0x7e56('0x4')](_0x7e56('0x5'));if(_0x147cb8){_0x259fb6=_0x147cb8[_0x7e56('0x6')](_0x147cb8['lastIndexOf']('.'));}return _0x259fb6;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 95eb001..dc48530 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 _0xa257=['end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','map','SquareRecording','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','rows','catch','show','params','keys','filters','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','secrets','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3498f5,_0x35cbaf){var _0x2273da=function(_0x51b358){while(--_0x51b358){_0x3498f5['push'](_0x3498f5['shift']());}};_0x2273da(++_0x35cbaf);}(_0xa257,0x155));var _0x7a25=function(_0x4e6fd9,_0x22e56e){_0x4e6fd9=_0x4e6fd9-0x0;var _0x4a9e73=_0xa257[_0x4e6fd9];return _0x4a9e73;};'use strict';var pdf=require(_0x7a25('0x0'));var emlformat=require(_0x7a25('0x1'));var rimraf=require(_0x7a25('0x2'));var zipdir=require(_0x7a25('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a25('0x4'));var Mustache=require('mustache');var util=require(_0x7a25('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7a25('0x6'));var ejs=require(_0x7a25('0x7'));var fs=require('fs');var _=require(_0x7a25('0x8'));var squel=require('squel');var crypto=require(_0x7a25('0x9'));var jsforce=require(_0x7a25('0xa'));var deskjs=require(_0x7a25('0xb'));var toCsv=require(_0x7a25('0x6'));var querystring=require(_0x7a25('0xc'));var Papa=require(_0x7a25('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7a25('0xe'));var as=require(_0x7a25('0xf'));var hardwareService=require(_0x7a25('0x10'));var logger=require(_0x7a25('0x11'))('api');var utils=require(_0x7a25('0x12'));var config=require(_0x7a25('0x13'));var db=require(_0x7a25('0x14'))['db'];function respondWithStatusCode(_0x1d09b2,_0x4936c0){_0x4936c0=_0x4936c0||0xcc;return function(_0x52f8a1){if(_0x52f8a1){return _0x1d09b2[_0x7a25('0x15')](_0x4936c0);}return _0x1d09b2[_0x7a25('0x16')](_0x4936c0)[_0x7a25('0x17')]();};}function respondWithResult(_0x2eb3cb,_0x991cfb){_0x991cfb=_0x991cfb||0xc8;return function(_0xc58cef){if(_0xc58cef){return _0x2eb3cb['status'](_0x991cfb)[_0x7a25('0x18')](_0xc58cef);}};}function respondWithFilteredResult(_0x501376,_0x2defb5){return function(_0x3e0339){if(_0x3e0339){var _0x4fc5ef=_0x3e0339[_0x7a25('0x19')],_0x2094cd=_0x2defb5[_0x7a25('0x1a')],_0x355a8d=_0x2defb5[_0x7a25('0x1a')]+_0x2defb5[_0x7a25('0x1b')],_0x5b0a92;if(_0x355a8d>=_0x4fc5ef){_0x355a8d=_0x4fc5ef;_0x5b0a92=0xc8;}else{_0x5b0a92=0xce;}_0x501376[_0x7a25('0x16')](_0x5b0a92);return _0x501376[_0x7a25('0x1c')]('Content-Range',_0x2094cd+'-'+_0x355a8d+'/'+_0x4fc5ef)[_0x7a25('0x18')](_0x3e0339);}return null;};}function patchUpdates(_0x5f4f9d){return function(_0x3170de){try{jsonpatch[_0x7a25('0x1d')](_0x3170de,_0x5f4f9d,!![]);}catch(_0x42d371){return BPromise[_0x7a25('0x1e')](_0x42d371);}return _0x3170de[_0x7a25('0x1f')]();};}function saveUpdates(_0x4cdfd2,_0x1ba840){return function(_0x412c19){if(_0x412c19){return _0x412c19[_0x7a25('0x20')](_0x4cdfd2)['then'](function(_0x5af6e5){return _0x5af6e5;});}return null;};}function removeEntity(_0x5aa075,_0x52832){return function(_0x43c1f9){if(_0x43c1f9){return _0x43c1f9['destroy']()[_0x7a25('0x21')](function(){_0x5aa075[_0x7a25('0x16')](0xcc)[_0x7a25('0x17')]();});}};}function handleEntityNotFound(_0x52ba88,_0x185c46){return function(_0x5c1eec){if(!_0x5c1eec){_0x52ba88[_0x7a25('0x15')](0x194);}return _0x5c1eec;};}function handleError(_0x47f06c,_0x30d8b2){_0x30d8b2=_0x30d8b2||0x1f4;return function(_0x1f9878){logger[_0x7a25('0x22')](_0x1f9878[_0x7a25('0x23')]);if(_0x1f9878[_0x7a25('0x24')]){delete _0x1f9878[_0x7a25('0x24')];}_0x47f06c[_0x7a25('0x16')](_0x30d8b2)['send'](_0x1f9878);};}exports['index']=function(_0x59c0f2,_0xa1a4d3){var _0x1fc49a={},_0x399ad5={},_0x16b6dd={'count':0x0,'rows':[]};var _0x3fc86a=_[_0x7a25('0x25')](db[_0x7a25('0x26')][_0x7a25('0x27')],function(_0x51e7da){return{'name':_0x51e7da['fieldName'],'type':_0x51e7da['type'][_0x7a25('0x28')]};});_0x399ad5[_0x7a25('0x29')]=_[_0x7a25('0x25')](_0x3fc86a,_0x7a25('0x24'));_0x399ad5[_0x7a25('0x2a')]=_['keys'](_0x59c0f2[_0x7a25('0x2a')]);_0x399ad5['filters']=_[_0x7a25('0x2b')](_0x399ad5[_0x7a25('0x29')],_0x399ad5[_0x7a25('0x2a')]);_0x1fc49a[_0x7a25('0x2c')]=_[_0x7a25('0x2b')](_0x399ad5[_0x7a25('0x29')],qs['fields'](_0x59c0f2[_0x7a25('0x2a')][_0x7a25('0x2d')]));_0x1fc49a[_0x7a25('0x2c')]=_0x1fc49a['attributes'][_0x7a25('0x2e')]?_0x1fc49a[_0x7a25('0x2c')]:_0x399ad5['model'];if(!_0x59c0f2['query'][_0x7a25('0x2f')](_0x7a25('0x30'))){_0x1fc49a[_0x7a25('0x1b')]=qs[_0x7a25('0x1b')](_0x59c0f2[_0x7a25('0x2a')][_0x7a25('0x1b')]);_0x1fc49a[_0x7a25('0x1a')]=qs[_0x7a25('0x1a')](_0x59c0f2[_0x7a25('0x2a')][_0x7a25('0x1a')]);}_0x1fc49a[_0x7a25('0x31')]=qs[_0x7a25('0x32')](_0x59c0f2[_0x7a25('0x2a')]['sort']);_0x1fc49a[_0x7a25('0x33')]=qs['filters'](_['pick'](_0x59c0f2[_0x7a25('0x2a')],_0x399ad5['filters']),_0x3fc86a);if(_0x59c0f2['query'][_0x7a25('0x34')]){_0x1fc49a[_0x7a25('0x33')]=_[_0x7a25('0x35')](_0x1fc49a[_0x7a25('0x33')],{'$or':_[_0x7a25('0x25')](_0x3fc86a,function(_0x23e716){if(_0x23e716[_0x7a25('0x36')]!==_0x7a25('0x37')){var _0x587c6a={};_0x587c6a[_0x23e716[_0x7a25('0x24')]]={'$like':'%'+_0x59c0f2[_0x7a25('0x2a')][_0x7a25('0x34')]+'%'};return _0x587c6a;}})});}_0x1fc49a=_[_0x7a25('0x35')]({},_0x1fc49a,_0x59c0f2['options']);var _0x347379={'where':_0x1fc49a[_0x7a25('0x33')]};return db[_0x7a25('0x26')][_0x7a25('0x19')](_0x347379)[_0x7a25('0x21')](function(_0x3aef05){_0x16b6dd['count']=_0x3aef05;if(_0x59c0f2[_0x7a25('0x2a')]['includeAll']){_0x1fc49a[_0x7a25('0x38')]=[{'all':!![]}];}return db[_0x7a25('0x26')]['findAll'](_0x1fc49a);})[_0x7a25('0x21')](function(_0x342621){_0x16b6dd[_0x7a25('0x39')]=_0x342621;return _0x16b6dd;})[_0x7a25('0x21')](respondWithFilteredResult(_0xa1a4d3,_0x1fc49a))[_0x7a25('0x3a')](handleError(_0xa1a4d3,null));};exports[_0x7a25('0x3b')]=function(_0x276ee4,_0x2798d6){var _0x553964={'raw':!![],'where':{'id':_0x276ee4[_0x7a25('0x3c')]['id']}},_0x3ff6de={};_0x3ff6de[_0x7a25('0x29')]=_[_0x7a25('0x3d')](db[_0x7a25('0x26')][_0x7a25('0x27')]);_0x3ff6de[_0x7a25('0x2a')]=_[_0x7a25('0x3d')](_0x276ee4[_0x7a25('0x2a')]);_0x3ff6de[_0x7a25('0x3e')]=_[_0x7a25('0x2b')](_0x3ff6de['model'],_0x3ff6de[_0x7a25('0x2a')]);_0x553964['attributes']=_[_0x7a25('0x2b')](_0x3ff6de[_0x7a25('0x29')],qs[_0x7a25('0x2d')](_0x276ee4[_0x7a25('0x2a')][_0x7a25('0x2d')]));_0x553964[_0x7a25('0x2c')]=_0x553964[_0x7a25('0x2c')][_0x7a25('0x2e')]?_0x553964['attributes']:_0x3ff6de['model'];if(_0x276ee4[_0x7a25('0x2a')]['includeAll']){_0x553964[_0x7a25('0x38')]=[{'all':!![]}];}_0x553964=_['merge']({},_0x553964,_0x276ee4[_0x7a25('0x3f')]);return db[_0x7a25('0x26')]['find'](_0x553964)[_0x7a25('0x21')](handleEntityNotFound(_0x2798d6,null))[_0x7a25('0x21')](respondWithResult(_0x2798d6,null))['catch'](handleError(_0x2798d6,null));};exports[_0x7a25('0x40')]=function(_0x39994c,_0x1ff6d5){return db[_0x7a25('0x26')][_0x7a25('0x40')](_0x39994c[_0x7a25('0x41')],{})[_0x7a25('0x21')](respondWithResult(_0x1ff6d5,0xc9))[_0x7a25('0x3a')](handleError(_0x1ff6d5,null));};exports['update']=function(_0x3df982,_0x2b13bc){if(_0x3df982['body']['id']){delete _0x3df982[_0x7a25('0x41')]['id'];}return db['SquareRecording'][_0x7a25('0x42')]({'where':{'id':_0x3df982[_0x7a25('0x3c')]['id']}})[_0x7a25('0x21')](handleEntityNotFound(_0x2b13bc,null))['then'](saveUpdates(_0x3df982['body'],null))[_0x7a25('0x21')](respondWithResult(_0x2b13bc,null))[_0x7a25('0x3a')](handleError(_0x2b13bc,null));};exports[_0x7a25('0x43')]=function(_0x20f670,_0x3f118e,_0x5db8e8){var _0x1deb1c=require(_0x7a25('0x44'));var _0xc83a4d=![];var _0x1281c7={};if(_0x20f670[_0x7a25('0x2a')][_0x7a25('0x36')]&&_0x20f670[_0x7a25('0x2a')][_0x7a25('0x36')]===_0x7a25('0x45')){_0x1281c7[_0x7a25('0x45')]=_0x20f670[_0x7a25('0x3c')]['id'];}else{_0x1281c7['id']=_0x20f670[_0x7a25('0x3c')]['id'];}return db[_0x7a25('0x26')]['find']({'where':_0x1281c7,'attributes':['id',_0x7a25('0x46'),_0x7a25('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x3f118e,null))[_0x7a25('0x21')](function(_0x53eeed){if(_0x53eeed){var _0x3e58e7=_0x53eeed['savePath'];var _0x4f1818=util[_0x7a25('0x48')]('%s.cypher',_0x3e58e7);if(fs[_0x7a25('0x49')](_0x4f1818)){_0xc83a4d=!![];return _0x1deb1c['decryptFile'](_0x4f1818,_0x3e58e7,config[_0x7a25('0x4a')][_0x7a25('0x4b')])[_0x7a25('0x21')](function(){return _0x53eeed;});}return _0x53eeed;}})[_0x7a25('0x21')](function(_0x2ec96f){if(_0x2ec96f){var _0x5c766f=_0x2ec96f[_0x7a25('0x46')];if(!fs[_0x7a25('0x49')](_0x5c766f)){throw new db[(_0x7a25('0x4c'))][(_0x7a25('0x4d'))]('SquareRecording\x20not\x20found');}if(_0x2ec96f['filename']){return _0x3f118e[_0x7a25('0x43')](_0x5c766f,_0x2ec96f[_0x7a25('0x47')]+path[_0x7a25('0x4e')](_0x5c766f),function(){if(_0xc83a4d){fs[_0x7a25('0x4f')](_0x5c766f);}});}else{return _0x3f118e[_0x7a25('0x43')](_0x5c766f,function(_0x173710){if(_0xc83a4d){fs[_0x7a25('0x4f')](_0x5c766f);}});}}})['catch'](function(_0x567d30){if(_0x567d30[_0x7a25('0x50')]===_0x7a25('0x51')){_0x3f118e[_0x7a25('0x16')](0x194)['send'](_0x7a25('0x52'));}else{return handleError(_0x3f118e,null);}});};exports[_0x7a25('0x53')]=function(_0x447bae,_0xcb727f){return db[_0x7a25('0x26')]['find']({'where':{'id':_0x447bae[_0x7a25('0x3c')]['id']}})['then'](function(_0x8d9dea){if(!_0x8d9dea)throw new ReferenceError(_0x7a25('0x54'));return _0x8d9dea;})[_0x7a25('0x21')](function(_0x1f05fa){var _0x676664=_0x1f05fa[_0x7a25('0x46')];logger['info'](_0x7a25('0x55'),_0x676664);if(!_[_0x7a25('0x56')](_0x1f05fa[_0x7a25('0x46')])&&fs[_0x7a25('0x49')](_0x676664)){logger['info'](_0x7a25('0x57')+_0x676664+_0x7a25('0x58'));fs['unlinkSync'](_0x676664);}_0x676664=_0x676664+_0x7a25('0x59');if(!_['isNil'](_0x1f05fa['savePath'])&&fs[_0x7a25('0x49')](_0x676664)){logger['info']('File:\x20\x22'+_0x676664+_0x7a25('0x58'));fs[_0x7a25('0x5a')](_0x676664);}return _0x1f05fa;})[_0x7a25('0x21')](function(_0x5eaea7){if(!_0x5eaea7)throw new InternalError();return _0x5eaea7[_0x7a25('0x53')]();})['then'](function(){_0xcb727f[_0x7a25('0x16')](0xcc)['end']();})[_0x7a25('0x3a')](handleError(_0xcb727f,null));}; \ No newline at end of file +var _0x519a=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','model','create','body','download','../../components/encryptor','uniqueid','find','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x519a,0xcb));var _0xa519=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x519a[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0xa519('0x0'));var emlformat=require(_0xa519('0x1'));var rimraf=require(_0xa519('0x2'));var zipdir=require(_0xa519('0x3'));var jsonpatch=require(_0xa519('0x4'));var rp=require(_0xa519('0x5'));var moment=require(_0xa519('0x6'));var BPromise=require(_0xa519('0x7'));var Mustache=require(_0xa519('0x8'));var util=require(_0xa519('0x9'));var path=require(_0xa519('0xa'));var sox=require(_0xa519('0xb'));var csv=require('to-csv');var ejs=require(_0xa519('0xc'));var fs=require('fs');var _=require(_0xa519('0xd'));var squel=require('squel');var crypto=require(_0xa519('0xe'));var jsforce=require(_0xa519('0xf'));var deskjs=require(_0xa519('0x10'));var toCsv=require(_0xa519('0x11'));var querystring=require(_0xa519('0x12'));var Papa=require(_0xa519('0x13'));var Redis=require('ioredis');var authService=require(_0xa519('0x14'));var qs=require(_0xa519('0x15'));var as=require(_0xa519('0x16'));var hardwareService=require(_0xa519('0x17'));var logger=require(_0xa519('0x18'))(_0xa519('0x19'));var utils=require('../../config/utils');var config=require(_0xa519('0x1a'));var db=require(_0xa519('0x1b'))['db'];function respondWithStatusCode(_0x58c41c,_0x47a50c){_0x47a50c=_0x47a50c||0xcc;return function(_0x585e6c){if(_0x585e6c){return _0x58c41c[_0xa519('0x1c')](_0x47a50c);}return _0x58c41c['status'](_0x47a50c)[_0xa519('0x1d')]();};}function respondWithResult(_0x5e2836,_0x112522){_0x112522=_0x112522||0xc8;return function(_0x39e121){if(_0x39e121){return _0x5e2836[_0xa519('0x1e')](_0x112522)[_0xa519('0x1f')](_0x39e121);}};}function respondWithFilteredResult(_0x5abc6d,_0x28e7a5){return function(_0x2e05c0){if(_0x2e05c0){var _0x11f83b=_0x2e05c0[_0xa519('0x20')],_0x263ec2=_0x28e7a5[_0xa519('0x21')],_0x17b9e6=_0x28e7a5[_0xa519('0x21')]+_0x28e7a5[_0xa519('0x22')],_0x449b1c;if(_0x17b9e6>=_0x11f83b){_0x17b9e6=_0x11f83b;_0x449b1c=0xc8;}else{_0x449b1c=0xce;}_0x5abc6d[_0xa519('0x1e')](_0x449b1c);return _0x5abc6d['set'](_0xa519('0x23'),_0x263ec2+'-'+_0x17b9e6+'/'+_0x11f83b)[_0xa519('0x1f')](_0x2e05c0);}return null;};}function patchUpdates(_0x29d637){return function(_0x14b0df){try{jsonpatch[_0xa519('0x24')](_0x14b0df,_0x29d637,!![]);}catch(_0x3351bc){return BPromise[_0xa519('0x25')](_0x3351bc);}return _0x14b0df[_0xa519('0x26')]();};}function saveUpdates(_0x5a7b37,_0x79dd9){return function(_0x202592){if(_0x202592){return _0x202592[_0xa519('0x27')](_0x5a7b37)[_0xa519('0x28')](function(_0x328277){return _0x328277;});}return null;};}function removeEntity(_0x504bb6,_0x320b93){return function(_0x3ce944){if(_0x3ce944){return _0x3ce944['destroy']()[_0xa519('0x28')](function(){_0x504bb6[_0xa519('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x668f7,_0x218385){return function(_0x2bf866){if(!_0x2bf866){_0x668f7[_0xa519('0x1c')](0x194);}return _0x2bf866;};}function handleError(_0x564b0f,_0xf0656){_0xf0656=_0xf0656||0x1f4;return function(_0x29c266){logger[_0xa519('0x29')](_0x29c266[_0xa519('0x2a')]);if(_0x29c266[_0xa519('0x2b')]){delete _0x29c266['name'];}_0x564b0f[_0xa519('0x1e')](_0xf0656)['send'](_0x29c266);};}exports[_0xa519('0x2c')]=function(_0x57a408,_0xfa90d2){var _0x554119={},_0x1f998f={},_0x17ffb1={'count':0x0,'rows':[]};var _0x376fd5=_[_0xa519('0x2d')](db[_0xa519('0x2e')][_0xa519('0x2f')],function(_0x5154a9){return{'name':_0x5154a9[_0xa519('0x30')],'type':_0x5154a9[_0xa519('0x31')][_0xa519('0x32')]};});_0x1f998f['model']=_[_0xa519('0x2d')](_0x376fd5,'name');_0x1f998f[_0xa519('0x33')]=_[_0xa519('0x34')](_0x57a408['query']);_0x1f998f[_0xa519('0x35')]=_[_0xa519('0x36')](_0x1f998f['model'],_0x1f998f[_0xa519('0x33')]);_0x554119[_0xa519('0x37')]=_[_0xa519('0x36')](_0x1f998f['model'],qs[_0xa519('0x38')](_0x57a408[_0xa519('0x33')]['fields']));_0x554119[_0xa519('0x37')]=_0x554119['attributes'][_0xa519('0x39')]?_0x554119[_0xa519('0x37')]:_0x1f998f['model'];if(!_0x57a408[_0xa519('0x33')][_0xa519('0x3a')](_0xa519('0x3b'))){_0x554119[_0xa519('0x22')]=qs[_0xa519('0x22')](_0x57a408['query'][_0xa519('0x22')]);_0x554119[_0xa519('0x21')]=qs[_0xa519('0x21')](_0x57a408[_0xa519('0x33')][_0xa519('0x21')]);}_0x554119['order']=qs[_0xa519('0x3c')](_0x57a408['query']['sort']);_0x554119[_0xa519('0x3d')]=qs[_0xa519('0x35')](_['pick'](_0x57a408[_0xa519('0x33')],_0x1f998f[_0xa519('0x35')]),_0x376fd5);if(_0x57a408['query'][_0xa519('0x3e')]){_0x554119['where']=_['merge'](_0x554119[_0xa519('0x3d')],{'$or':_[_0xa519('0x2d')](_0x376fd5,function(_0x2b70fc){if(_0x2b70fc[_0xa519('0x31')]!==_0xa519('0x3f')){var _0x3f3a90={};_0x3f3a90[_0x2b70fc['name']]={'$like':'%'+_0x57a408['query']['filter']+'%'};return _0x3f3a90;}})});}_0x554119=_[_0xa519('0x40')]({},_0x554119,_0x57a408[_0xa519('0x41')]);var _0x286b24={'where':_0x554119['where']};return db[_0xa519('0x2e')]['count'](_0x286b24)[_0xa519('0x28')](function(_0x59f79f){_0x17ffb1['count']=_0x59f79f;if(_0x57a408[_0xa519('0x33')][_0xa519('0x42')]){_0x554119[_0xa519('0x43')]=[{'all':!![]}];}return db[_0xa519('0x2e')][_0xa519('0x44')](_0x554119);})['then'](function(_0x4bda1f){_0x17ffb1[_0xa519('0x45')]=_0x4bda1f;return _0x17ffb1;})[_0xa519('0x28')](respondWithFilteredResult(_0xfa90d2,_0x554119))[_0xa519('0x46')](handleError(_0xfa90d2,null));};exports[_0xa519('0x47')]=function(_0x222140,_0x8b7f48){var _0x57fbdd={'raw':!![],'where':{'id':_0x222140[_0xa519('0x48')]['id']}},_0x3d08f8={};_0x3d08f8['model']=_[_0xa519('0x34')](db[_0xa519('0x2e')][_0xa519('0x2f')]);_0x3d08f8[_0xa519('0x33')]=_[_0xa519('0x34')](_0x222140[_0xa519('0x33')]);_0x3d08f8[_0xa519('0x35')]=_['intersection'](_0x3d08f8['model'],_0x3d08f8['query']);_0x57fbdd[_0xa519('0x37')]=_['intersection'](_0x3d08f8[_0xa519('0x49')],qs[_0xa519('0x38')](_0x222140['query'][_0xa519('0x38')]));_0x57fbdd['attributes']=_0x57fbdd[_0xa519('0x37')][_0xa519('0x39')]?_0x57fbdd['attributes']:_0x3d08f8['model'];if(_0x222140[_0xa519('0x33')]['includeAll']){_0x57fbdd[_0xa519('0x43')]=[{'all':!![]}];}_0x57fbdd=_[_0xa519('0x40')]({},_0x57fbdd,_0x222140[_0xa519('0x41')]);return db[_0xa519('0x2e')]['find'](_0x57fbdd)[_0xa519('0x28')](handleEntityNotFound(_0x8b7f48,null))['then'](respondWithResult(_0x8b7f48,null))[_0xa519('0x46')](handleError(_0x8b7f48,null));};exports[_0xa519('0x4a')]=function(_0x21d128,_0x3925a0){return db[_0xa519('0x2e')][_0xa519('0x4a')](_0x21d128[_0xa519('0x4b')],{})[_0xa519('0x28')](respondWithResult(_0x3925a0,0xc9))['catch'](handleError(_0x3925a0,null));};exports[_0xa519('0x27')]=function(_0x62e212,_0x2dac44){if(_0x62e212[_0xa519('0x4b')]['id']){delete _0x62e212[_0xa519('0x4b')]['id'];}return db[_0xa519('0x2e')]['find']({'where':{'id':_0x62e212[_0xa519('0x48')]['id']}})[_0xa519('0x28')](handleEntityNotFound(_0x2dac44,null))[_0xa519('0x28')](saveUpdates(_0x62e212[_0xa519('0x4b')],null))[_0xa519('0x28')](respondWithResult(_0x2dac44,null))['catch'](handleError(_0x2dac44,null));};exports[_0xa519('0x4c')]=function(_0x18dc71,_0x2044f3,_0x189d94){var _0x52da6b=require(_0xa519('0x4d'));var _0x902f07=![];var _0x4e182e={};if(_0x18dc71[_0xa519('0x33')]['type']&&_0x18dc71[_0xa519('0x33')]['type']===_0xa519('0x4e')){_0x4e182e[_0xa519('0x4e')]=_0x18dc71['params']['id'];}else{_0x4e182e['id']=_0x18dc71[_0xa519('0x48')]['id'];}return db['SquareRecording'][_0xa519('0x4f')]({'where':_0x4e182e,'attributes':['id','savePath',_0xa519('0x50')],'raw':!![]})[_0xa519('0x28')](handleEntityNotFound(_0x2044f3,null))[_0xa519('0x28')](function(_0x5df87d){if(_0x5df87d){var _0x501c7d=_0x5df87d[_0xa519('0x51')];var _0x3c3499=util[_0xa519('0x52')](_0xa519('0x53'),_0x501c7d);if(fs[_0xa519('0x54')](_0x3c3499)){_0x902f07=!![];return _0x52da6b[_0xa519('0x55')](_0x3c3499,_0x501c7d,config[_0xa519('0x56')][_0xa519('0x57')])['then'](function(){return _0x5df87d;});}return _0x5df87d;}})[_0xa519('0x28')](function(_0x172d15){if(_0x172d15){var _0x4f1031=_0x172d15['savePath'];if(!fs[_0xa519('0x54')](_0x4f1031)){throw new db['Sequelize'][(_0xa519('0x58'))](_0xa519('0x59'));}if(_0x172d15['filename']){return _0x2044f3[_0xa519('0x4c')](_0x4f1031,_0x172d15[_0xa519('0x50')]+path[_0xa519('0x5a')](_0x4f1031),function(){if(_0x902f07){fs[_0xa519('0x5b')](_0x4f1031);}});}else{return _0x2044f3[_0xa519('0x4c')](_0x4f1031,function(_0x353512){if(_0x902f07){fs[_0xa519('0x5b')](_0x4f1031);}});}}})[_0xa519('0x46')](function(_0x13ab5c){if(_0x13ab5c['message']==='SquareRecording\x20not\x20found'){_0x2044f3[_0xa519('0x1e')](0x194)[_0xa519('0x5c')]('Not\x20found');}else{return handleError(_0x2044f3,null);}});};exports[_0xa519('0x5d')]=function(_0x101a1d,_0x1115ad){return db[_0xa519('0x2e')]['find']({'where':{'id':_0x101a1d['params']['id']}})['then'](function(_0x4891e9){if(!_0x4891e9)throw new ReferenceError(_0xa519('0x5e'));return _0x4891e9;})[_0xa519('0x28')](function(_0x5d666e){var _0x120a1d=_0x5d666e[_0xa519('0x51')];logger[_0xa519('0x5f')](_0xa519('0x60'),_0x120a1d);if(!_['isNil'](_0x5d666e[_0xa519('0x51')])&&fs[_0xa519('0x54')](_0x120a1d)){logger[_0xa519('0x5f')](_0xa519('0x61')+_0x120a1d+_0xa519('0x62'));fs[_0xa519('0x63')](_0x120a1d);}_0x120a1d=_0x120a1d+'.cypher';if(!_['isNil'](_0x5d666e[_0xa519('0x51')])&&fs[_0xa519('0x54')](_0x120a1d)){logger[_0xa519('0x5f')](_0xa519('0x61')+_0x120a1d+_0xa519('0x62'));fs['unlinkSync'](_0x120a1d);}return _0x5d666e;})[_0xa519('0x28')](function(_0x4b35df){if(!_0x4b35df)throw new InternalError();return _0x4b35df[_0xa519('0x5d')]();})[_0xa519('0x28')](function(){_0x1115ad['status'](0xcc)[_0xa519('0x1d')]();})[_0xa519('0x46')](handleError(_0x1115ad,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a6b1ec5..bf613c7 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 _0xff1c=['./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x3bcecd,_0x415deb){var _0x2760dd=function(_0x1ed28f){while(--_0x1ed28f){_0x3bcecd['push'](_0x3bcecd['shift']());}};_0x2760dd(++_0x415deb);}(_0xff1c,0xf6));var _0xcff1=function(_0x407627,_0x4e0259){_0x407627=_0x407627-0x0;var _0x651cb9=_0xff1c[_0x407627];return _0x651cb9;};'use strict';var _=require(_0xcff1('0x0'));var util=require(_0xcff1('0x1'));var logger=require(_0xcff1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcff1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff1('0x4'));var rimraf=require(_0xcff1('0x5'));var config=require(_0xcff1('0x6'));var attributes=require(_0xcff1('0x7'));module[_0xcff1('0x8')]=function(_0x96bb6d,_0x1eafce){return _0x96bb6d[_0xcff1('0x9')]('SquareRecording',attributes,{'tableName':_0xcff1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a3=['../../config/environment','./squareRecording.attributes','exports','define','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1241d7,_0x2b3e05){var _0x164a23=function(_0x724eeb){while(--_0x724eeb){_0x1241d7['push'](_0x1241d7['shift']());}};_0x164a23(++_0x2b3e05);}(_0xb9a3,0x159));var _0x3b9a=function(_0x4aaa4a,_0x5eff26){_0x4aaa4a=_0x4aaa4a-0x0;var _0x3ced25=_0xb9a3[_0x4aaa4a];return _0x3ced25;};'use strict';var _=require(_0x3b9a('0x0'));var util=require(_0x3b9a('0x1'));var logger=require('../../config/logger')(_0x3b9a('0x2'));var moment=require('moment');var BPromise=require(_0x3b9a('0x3'));var rp=require(_0x3b9a('0x4'));var fs=require('fs');var path=require(_0x3b9a('0x5'));var rimraf=require(_0x3b9a('0x6'));var config=require(_0x3b9a('0x7'));var attributes=require(_0x3b9a('0x8'));module[_0x3b9a('0x9')]=function(_0x466541,_0x11a6a1){return _0x466541[_0x3b9a('0xa')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1e4567f..c4952df 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 _0xb969=['body','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x171131,_0x2a7898){var _0x339d59=function(_0x4a40f9){while(--_0x4a40f9){_0x171131['push'](_0x171131['shift']());}};_0x339d59(++_0x2a7898);}(_0xb969,0x170));var _0x9b96=function(_0x114b3c,_0x30e4d9){_0x114b3c=_0x114b3c-0x0;var _0x2aacad=_0xb969[_0x114b3c];return _0x2aacad;};'use strict';var _=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var moment=require(_0x9b96('0x2'));var BPromise=require(_0x9b96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b96('0x4'));var db=require(_0x9b96('0x5'))['db'];var utils=require(_0x9b96('0x6'));var logger=require('../../config/logger')(_0x9b96('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b96('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x117ff2,_0x150207,_0x3f29ed){return new BPromise(function(_0x5337da,_0xd1c3c3){return client[_0x9b96('0x9')](_0x117ff2,_0x3f29ed)[_0x9b96('0xa')](function(_0x58e343){logger[_0x9b96('0xb')](_0x9b96('0xc'),_0x150207,_0x9b96('0xd'));logger[_0x9b96('0xe')](_0x9b96('0xf'),_0x150207,_0x9b96('0xd'),JSON[_0x9b96('0x10')](_0x58e343));if(_0x58e343[_0x9b96('0x11')]){if(_0x58e343[_0x9b96('0x11')][_0x9b96('0x12')]===0x1f4){logger[_0x9b96('0x11')](_0x9b96('0xc'),_0x150207,_0x58e343[_0x9b96('0x11')][_0x9b96('0x13')]);return _0xd1c3c3(_0x58e343[_0x9b96('0x11')][_0x9b96('0x13')]);}logger['error'](_0x9b96('0xc'),_0x150207,_0x58e343[_0x9b96('0x11')][_0x9b96('0x13')]);return _0x5337da(_0x58e343[_0x9b96('0x11')][_0x9b96('0x13')]);}else{logger[_0x9b96('0xb')](_0x9b96('0xc'),_0x150207,'request\x20sent');_0x5337da(_0x58e343[_0x9b96('0x14')][_0x9b96('0x13')]);}})[_0x9b96('0x15')](function(_0x426a56){logger[_0x9b96('0x11')](_0x9b96('0xc'),_0x150207,_0x426a56);_0xd1c3c3(_0x426a56);});});}exports['CreateSquareRecording']=function(_0x1b049f){var _0x18017e=this;return new Promise(function(_0x203a32,_0x5f42c1){return db['SquareRecording']['create'](_0x1b049f[_0x9b96('0x16')],{'raw':_0x1b049f[_0x9b96('0x17')]?_0x1b049f['options'][_0x9b96('0x18')]===undefined?!![]:![]:!![]})[_0x9b96('0xa')](function(_0x5ea621){logger['info']('CreateSquareRecording',_0x1b049f);logger['debug'](_0x9b96('0x19'),_0x1b049f,JSON['stringify'](_0x5ea621));_0x203a32(_0x5ea621);})['catch'](function(_0x577573){logger[_0x9b96('0x11')](_0x9b96('0x19'),_0x577573[_0x9b96('0x13')],_0x1b049f);_0x5f42c1(_0x18017e[_0x9b96('0x11')](0x1f4,_0x577573[_0x9b96('0x13')]));});});}; \ No newline at end of file +var _0xb1d9=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','SquareRecording,\x20%s,\x20%s','result','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','catch','lodash','util','moment'];(function(_0x367f2c,_0x167aab){var _0x46a76f=function(_0x2ce3f0){while(--_0x2ce3f0){_0x367f2c['push'](_0x367f2c['shift']());}};_0x46a76f(++_0x167aab);}(_0xb1d9,0x1a1));var _0x9b1d=function(_0x35e11e,_0x2c8dee){_0x35e11e=_0x35e11e-0x0;var _0x4b12e0=_0xb1d9[_0x35e11e];return _0x4b12e0;};'use strict';var _=require(_0x9b1d('0x0'));var util=require(_0x9b1d('0x1'));var moment=require(_0x9b1d('0x2'));var BPromise=require(_0x9b1d('0x3'));var rs=require(_0x9b1d('0x4'));var fs=require('fs');var Redis=require(_0x9b1d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9b1d('0x6'))(_0x9b1d('0x7'));var config=require(_0x9b1d('0x8'));var jayson=require(_0x9b1d('0x9'));var client=jayson[_0x9b1d('0xa')][_0x9b1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e5c1f,_0x3480a7,_0x2da762){return new BPromise(function(_0x3b0c2a,_0x3d728a){return client[_0x9b1d('0xc')](_0x3e5c1f,_0x2da762)[_0x9b1d('0xd')](function(_0x4c53eb){logger[_0x9b1d('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3480a7,_0x9b1d('0xf'));logger[_0x9b1d('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3480a7,_0x9b1d('0xf'),JSON['stringify'](_0x4c53eb));if(_0x4c53eb[_0x9b1d('0x11')]){if(_0x4c53eb[_0x9b1d('0x11')][_0x9b1d('0x12')]===0x1f4){logger[_0x9b1d('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3480a7,_0x4c53eb[_0x9b1d('0x11')][_0x9b1d('0x13')]);return _0x3d728a(_0x4c53eb[_0x9b1d('0x11')][_0x9b1d('0x13')]);}logger[_0x9b1d('0x11')](_0x9b1d('0x14'),_0x3480a7,_0x4c53eb['error'][_0x9b1d('0x13')]);return _0x3b0c2a(_0x4c53eb[_0x9b1d('0x11')]['message']);}else{logger[_0x9b1d('0xe')](_0x9b1d('0x14'),_0x3480a7,_0x9b1d('0xf'));_0x3b0c2a(_0x4c53eb[_0x9b1d('0x15')]['message']);}})['catch'](function(_0x38ab4a){logger[_0x9b1d('0x11')](_0x9b1d('0x14'),_0x3480a7,_0x38ab4a);_0x3d728a(_0x38ab4a);});});}exports[_0x9b1d('0x16')]=function(_0x2c03fa){var _0x4a31a7=this;return new Promise(function(_0x1b81a1,_0x435f0d){return db[_0x9b1d('0x17')][_0x9b1d('0x18')](_0x2c03fa[_0x9b1d('0x19')],{'raw':_0x2c03fa[_0x9b1d('0x1a')]?_0x2c03fa[_0x9b1d('0x1a')][_0x9b1d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x54a1eb){logger['info'](_0x9b1d('0x16'),_0x2c03fa);logger[_0x9b1d('0x10')](_0x9b1d('0x16'),_0x2c03fa,JSON[_0x9b1d('0x1c')](_0x54a1eb));_0x1b81a1(_0x54a1eb);})[_0x9b1d('0x1d')](function(_0x52bece){logger[_0x9b1d('0x11')](_0x9b1d('0x16'),_0x52bece['message'],_0x2c03fa);_0x435f0d(_0x4a31a7['error'](0x1f4,_0x52bece['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 54301f9..980c710 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 _0x13ad=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update'];(function(_0x5c2829,_0x2e1482){var _0x4d6544=function(_0x63b01e){while(--_0x63b01e){_0x5c2829['push'](_0x5c2829['shift']());}};_0x4d6544(++_0x2e1482);}(_0x13ad,0x13d));var _0xd13a=function(_0x5c02b7,_0x302ef4){_0x5c02b7=_0x5c02b7-0x0;var _0x183851=_0x13ad[_0x5c02b7];return _0x183851;};'use strict';var multer=require(_0xd13a('0x0'));var util=require(_0xd13a('0x1'));var path=require(_0xd13a('0x2'));var timeout=require(_0xd13a('0x3'));var express=require(_0xd13a('0x4'));var router=express[_0xd13a('0x5')]();var auth=require(_0xd13a('0x6'));var interaction=require(_0xd13a('0x7'));var config=require(_0xd13a('0x8'));var controller=require(_0xd13a('0x9'));router[_0xd13a('0xa')]('/',auth[_0xd13a('0xb')](),controller['index']);router['get'](_0xd13a('0xc'),auth[_0xd13a('0xb')](),controller[_0xd13a('0xd')]);router[_0xd13a('0xa')](_0xd13a('0xe'),auth['isAuthenticated'](),controller[_0xd13a('0xf')]);router[_0xd13a('0x10')]('/',auth[_0xd13a('0xb')](),controller['create']);router[_0xd13a('0x11')](_0xd13a('0xe'),auth[_0xd13a('0xb')](),controller[_0xd13a('0x12')]);router['delete'](_0xd13a('0xe'),auth['isAuthenticated'](),controller[_0xd13a('0x13')]);module[_0xd13a('0x14')]=router; \ No newline at end of file +var _0x571a=['get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','express','Router','../../config/environment','./squareReport.controller'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x571a,0x93));var _0xa571=function(_0x38f720,_0x25efa2){_0x38f720=_0x38f720-0x0;var _0x40d35f=_0x571a[_0x38f720];return _0x40d35f;};'use strict';var multer=require(_0xa571('0x0'));var util=require(_0xa571('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa571('0x2'));var router=express[_0xa571('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa571('0x4'));var controller=require(_0xa571('0x5'));router[_0xa571('0x6')]('/',auth[_0xa571('0x7')](),controller['index']);router[_0xa571('0x6')](_0xa571('0x8'),auth[_0xa571('0x7')](),controller[_0xa571('0x9')]);router['get'](_0xa571('0xa'),auth[_0xa571('0x7')](),controller[_0xa571('0xb')]);router['post']('/',auth[_0xa571('0x7')](),controller[_0xa571('0xc')]);router[_0xa571('0xd')](_0xa571('0xa'),auth[_0xa571('0x7')](),controller[_0xa571('0xe')]);router['delete']('/:id',auth[_0xa571('0x7')](),controller[_0xa571('0xf')]);module[_0xa571('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4c99502..7b648e1 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 _0x6226=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x4dad31,_0x2fc06a){var _0x48cccd=function(_0x576daa){while(--_0x576daa){_0x4dad31['push'](_0x4dad31['shift']());}};_0x48cccd(++_0x2fc06a);}(_0x6226,0x17e));var _0x6622=function(_0x5e1f4b,_0x50b208){_0x5e1f4b=_0x5e1f4b-0x0;var _0x5ce7b4=_0x6226[_0x5e1f4b];return _0x5ce7b4;};'use strict';var Sequelize=require(_0x6622('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6622('0x1')]},'request':{'type':Sequelize[_0x6622('0x1')]},'channel':{'type':Sequelize[_0x6622('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x6622('0x1')]},'callerid':{'type':Sequelize[_0x6622('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6622('0x1')]},'callingani2':{'type':Sequelize[_0x6622('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x6622('0x1')]},'context':{'type':Sequelize[_0x6622('0x1')]},'extension':{'type':Sequelize[_0x6622('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6622('0x1')]},'accountcode':{'type':Sequelize[_0x6622('0x1')]},'threadid':{'type':Sequelize[_0x6622('0x1')]},'project_name':{'type':Sequelize[_0x6622('0x1')]},'joinAt':{'type':Sequelize[_0x6622('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6622('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x52dd=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x54945e,_0x42f71a){var _0x36eabd=function(_0x178ecf){while(--_0x178ecf){_0x54945e['push'](_0x54945e['shift']());}};_0x36eabd(++_0x42f71a);}(_0x52dd,0x9b));var _0xd52d=function(_0x598e09,_0x96d669){_0x598e09=_0x598e09-0x0;var _0x9c89e6=_0x52dd[_0x598e09];return _0x9c89e6;};'use strict';var Sequelize=require(_0xd52d('0x0'));module[_0xd52d('0x1')]={'network':{'type':Sequelize[_0xd52d('0x2')]},'network_script':{'type':Sequelize[_0xd52d('0x2')]},'request':{'type':Sequelize[_0xd52d('0x2')]},'channel':{'type':Sequelize[_0xd52d('0x2')]},'language':{'type':Sequelize[_0xd52d('0x2')]},'type':{'type':Sequelize[_0xd52d('0x2')]},'uniqueid':{'type':Sequelize[_0xd52d('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd52d('0x2')]},'callingpres':{'type':Sequelize[_0xd52d('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd52d('0x2')]},'callingtns':{'type':Sequelize[_0xd52d('0x2')]},'dnid':{'type':Sequelize[_0xd52d('0x2')]},'rdnis':{'type':Sequelize[_0xd52d('0x2')]},'context':{'type':Sequelize[_0xd52d('0x2')]},'extension':{'type':Sequelize[_0xd52d('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xd52d('0x2')]},'accountcode':{'type':Sequelize[_0xd52d('0x2')]},'threadid':{'type':Sequelize[_0xd52d('0x2')]},'project_name':{'type':Sequelize[_0xd52d('0x2')]},'joinAt':{'type':Sequelize[_0xd52d('0x3')]},'leaveAt':{'type':Sequelize[_0xd52d('0x3')]},'bot':{'type':Sequelize[_0xd52d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ae0b2de..e1d6f5a 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 _0xafc6=['fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareReport','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x3fd1a6,_0x42b7eb){var _0x228b71=function(_0x20cfe1){while(--_0x20cfe1){_0x3fd1a6['push'](_0x3fd1a6['shift']());}};_0x228b71(++_0x42b7eb);}(_0xafc6,0xc0));var _0x6afc=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xafc6[_0x5627e1];return _0x2f013f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6afc('0x0'));var rimraf=require(_0x6afc('0x1'));var zipdir=require(_0x6afc('0x2'));var jsonpatch=require(_0x6afc('0x3'));var rp=require('request-promise');var moment=require(_0x6afc('0x4'));var BPromise=require(_0x6afc('0x5'));var Mustache=require('mustache');var util=require(_0x6afc('0x6'));var path=require('path');var sox=require(_0x6afc('0x7'));var csv=require(_0x6afc('0x8'));var ejs=require(_0x6afc('0x9'));var fs=require('fs');var _=require(_0x6afc('0xa'));var squel=require(_0x6afc('0xb'));var crypto=require(_0x6afc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6afc('0x8'));var querystring=require('querystring');var Papa=require(_0x6afc('0xd'));var Redis=require('ioredis');var authService=require(_0x6afc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6afc('0xf'));var hardwareService=require(_0x6afc('0x10'));var logger=require(_0x6afc('0x11'))('api');var utils=require(_0x6afc('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x592f0f,_0x4b39b6){_0x4b39b6=_0x4b39b6||0xcc;return function(_0x28d0af){if(_0x28d0af){return _0x592f0f[_0x6afc('0x13')](_0x4b39b6);}return _0x592f0f[_0x6afc('0x14')](_0x4b39b6)[_0x6afc('0x15')]();};}function respondWithResult(_0x1d78ee,_0x5bf3c1){_0x5bf3c1=_0x5bf3c1||0xc8;return function(_0x5cce3f){if(_0x5cce3f){return _0x1d78ee[_0x6afc('0x14')](_0x5bf3c1)[_0x6afc('0x16')](_0x5cce3f);}};}function respondWithFilteredResult(_0x329314,_0x324563){return function(_0x1f2d8f){if(_0x1f2d8f){var _0x29ea89=_0x1f2d8f[_0x6afc('0x17')],_0x4b76cf=_0x324563['offset'],_0x5a518d=_0x324563[_0x6afc('0x18')]+_0x324563['limit'],_0x46504b;if(_0x5a518d>=_0x29ea89){_0x5a518d=_0x29ea89;_0x46504b=0xc8;}else{_0x46504b=0xce;}_0x329314['status'](_0x46504b);return _0x329314[_0x6afc('0x19')]('Content-Range',_0x4b76cf+'-'+_0x5a518d+'/'+_0x29ea89)[_0x6afc('0x16')](_0x1f2d8f);}return null;};}function patchUpdates(_0xd41328){return function(_0x11dbe9){try{jsonpatch[_0x6afc('0x1a')](_0x11dbe9,_0xd41328,!![]);}catch(_0x468feb){return BPromise[_0x6afc('0x1b')](_0x468feb);}return _0x11dbe9[_0x6afc('0x1c')]();};}function saveUpdates(_0x490ed3,_0x32ae9f){return function(_0x3e7b47){if(_0x3e7b47){return _0x3e7b47[_0x6afc('0x1d')](_0x490ed3)[_0x6afc('0x1e')](function(_0x42cac6){return _0x42cac6;});}return null;};}function removeEntity(_0x37c17b,_0x16e2c6){return function(_0x5561a9){if(_0x5561a9){return _0x5561a9[_0x6afc('0x1f')]()[_0x6afc('0x1e')](function(){_0x37c17b[_0x6afc('0x14')](0xcc)[_0x6afc('0x15')]();});}};}function handleEntityNotFound(_0x33b054,_0x58269b){return function(_0x3bd3b6){if(!_0x3bd3b6){_0x33b054['sendStatus'](0x194);}return _0x3bd3b6;};}function handleError(_0x3444b9,_0x115c7a){_0x115c7a=_0x115c7a||0x1f4;return function(_0x238492){logger[_0x6afc('0x20')](_0x238492['stack']);if(_0x238492[_0x6afc('0x21')]){delete _0x238492[_0x6afc('0x21')];}_0x3444b9[_0x6afc('0x14')](_0x115c7a)[_0x6afc('0x22')](_0x238492);};}exports['index']=function(_0x30d75a,_0x38c8a7){var _0x481210={},_0x4cd231={},_0x1b3af7={'count':0x0,'rows':[]};var _0x18a663=_[_0x6afc('0x23')](db[_0x6afc('0x24')]['rawAttributes'],function(_0x339313){return{'name':_0x339313[_0x6afc('0x25')],'type':_0x339313[_0x6afc('0x26')]['key']};});_0x4cd231['model']=_[_0x6afc('0x23')](_0x18a663,'name');_0x4cd231[_0x6afc('0x27')]=_[_0x6afc('0x28')](_0x30d75a[_0x6afc('0x27')]);_0x4cd231['filters']=_[_0x6afc('0x29')](_0x4cd231[_0x6afc('0x2a')],_0x4cd231[_0x6afc('0x27')]);_0x481210[_0x6afc('0x2b')]=_[_0x6afc('0x29')](_0x4cd231[_0x6afc('0x2a')],qs[_0x6afc('0x2c')](_0x30d75a[_0x6afc('0x27')]['fields']));_0x481210['attributes']=_0x481210['attributes'][_0x6afc('0x2d')]?_0x481210[_0x6afc('0x2b')]:_0x4cd231[_0x6afc('0x2a')];if(!_0x30d75a['query'][_0x6afc('0x2e')]('nolimit')){_0x481210[_0x6afc('0x2f')]=qs[_0x6afc('0x2f')](_0x30d75a[_0x6afc('0x27')][_0x6afc('0x2f')]);_0x481210[_0x6afc('0x18')]=qs['offset'](_0x30d75a[_0x6afc('0x27')]['offset']);}_0x481210['order']=qs[_0x6afc('0x30')](_0x30d75a[_0x6afc('0x27')]['sort']);_0x481210[_0x6afc('0x31')]=qs['filters'](_[_0x6afc('0x32')](_0x30d75a[_0x6afc('0x27')],_0x4cd231[_0x6afc('0x33')]),_0x18a663);if(_0x30d75a['query'][_0x6afc('0x34')]){_0x481210[_0x6afc('0x31')]=_[_0x6afc('0x35')](_0x481210[_0x6afc('0x31')],{'$or':_[_0x6afc('0x23')](_0x18a663,function(_0x535f56){if(_0x535f56[_0x6afc('0x26')]!=='VIRTUAL'){var _0x138d25={};_0x138d25[_0x535f56['name']]={'$like':'%'+_0x30d75a[_0x6afc('0x27')]['filter']+'%'};return _0x138d25;}})});}_0x481210=_['merge']({},_0x481210,_0x30d75a['options']);var _0x232f09={'where':_0x481210[_0x6afc('0x31')]};return db[_0x6afc('0x24')]['count'](_0x232f09)[_0x6afc('0x1e')](function(_0x3b1be2){_0x1b3af7[_0x6afc('0x17')]=_0x3b1be2;if(_0x30d75a[_0x6afc('0x27')]['includeAll']){_0x481210[_0x6afc('0x36')]=[{'all':!![]}];}return db[_0x6afc('0x24')][_0x6afc('0x37')](_0x481210);})['then'](function(_0x13f0fe){_0x1b3af7[_0x6afc('0x38')]=_0x13f0fe;return _0x1b3af7;})['then'](respondWithFilteredResult(_0x38c8a7,_0x481210))[_0x6afc('0x39')](handleError(_0x38c8a7,null));};exports[_0x6afc('0x3a')]=function(_0x2108a8,_0x5b71dc){var _0x35e619={'raw':!![],'where':{'id':_0x2108a8[_0x6afc('0x3b')]['id']}},_0x4bbd62={};_0x4bbd62[_0x6afc('0x2a')]=_[_0x6afc('0x28')](db[_0x6afc('0x24')]['rawAttributes']);_0x4bbd62[_0x6afc('0x27')]=_[_0x6afc('0x28')](_0x2108a8['query']);_0x4bbd62[_0x6afc('0x33')]=_[_0x6afc('0x29')](_0x4bbd62[_0x6afc('0x2a')],_0x4bbd62[_0x6afc('0x27')]);_0x35e619['attributes']=_[_0x6afc('0x29')](_0x4bbd62[_0x6afc('0x2a')],qs[_0x6afc('0x2c')](_0x2108a8['query'][_0x6afc('0x2c')]));_0x35e619[_0x6afc('0x2b')]=_0x35e619[_0x6afc('0x2b')][_0x6afc('0x2d')]?_0x35e619[_0x6afc('0x2b')]:_0x4bbd62[_0x6afc('0x2a')];if(_0x2108a8[_0x6afc('0x27')][_0x6afc('0x3c')]){_0x35e619[_0x6afc('0x36')]=[{'all':!![]}];}_0x35e619=_[_0x6afc('0x35')]({},_0x35e619,_0x2108a8['options']);return db[_0x6afc('0x24')][_0x6afc('0x3d')](_0x35e619)[_0x6afc('0x1e')](handleEntityNotFound(_0x5b71dc,null))[_0x6afc('0x1e')](respondWithResult(_0x5b71dc,null))[_0x6afc('0x39')](handleError(_0x5b71dc,null));};exports[_0x6afc('0x3e')]=function(_0xca0c94,_0x4fd952){return db[_0x6afc('0x24')][_0x6afc('0x3e')](_0xca0c94[_0x6afc('0x3f')],{})[_0x6afc('0x1e')](respondWithResult(_0x4fd952,0xc9))[_0x6afc('0x39')](handleError(_0x4fd952,null));};exports[_0x6afc('0x1d')]=function(_0x4c90f4,_0x540863){if(_0x4c90f4[_0x6afc('0x3f')]['id']){delete _0x4c90f4[_0x6afc('0x3f')]['id'];}return db[_0x6afc('0x24')][_0x6afc('0x3d')]({'where':{'id':_0x4c90f4[_0x6afc('0x3b')]['id']}})[_0x6afc('0x1e')](handleEntityNotFound(_0x540863,null))[_0x6afc('0x1e')](saveUpdates(_0x4c90f4[_0x6afc('0x3f')],null))[_0x6afc('0x1e')](respondWithResult(_0x540863,null))['catch'](handleError(_0x540863,null));};exports[_0x6afc('0x1f')]=function(_0x3c9008,_0x18b7c9){return db['SquareReport'][_0x6afc('0x3d')]({'where':{'id':_0x3c9008[_0x6afc('0x3b')]['id']}})[_0x6afc('0x1e')](handleEntityNotFound(_0x18b7c9,null))[_0x6afc('0x1e')](removeEntity(_0x18b7c9,null))[_0x6afc('0x39')](handleError(_0x18b7c9,null));};exports[_0x6afc('0x40')]=function(_0x307410,_0x50d8dd){return db[_0x6afc('0x24')][_0x6afc('0x40')]()[_0x6afc('0x1e')](respondWithResult(_0x50d8dd,null))[_0x6afc('0x39')](handleError(_0x50d8dd,null));}; \ No newline at end of file +var _0xedf3=['order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','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','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','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','SquareReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xf1dc0c,_0x164417){var _0x598cc4=function(_0x44db44){while(--_0x44db44){_0xf1dc0c['push'](_0xf1dc0c['shift']());}};_0x598cc4(++_0x164417);}(_0xedf3,0x142));var _0x3edf=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xedf3[_0x1aeda2];return _0x32dc6d;};'use strict';var pdf=require(_0x3edf('0x0'));var emlformat=require(_0x3edf('0x1'));var rimraf=require(_0x3edf('0x2'));var zipdir=require(_0x3edf('0x3'));var jsonpatch=require(_0x3edf('0x4'));var rp=require(_0x3edf('0x5'));var moment=require(_0x3edf('0x6'));var BPromise=require(_0x3edf('0x7'));var Mustache=require(_0x3edf('0x8'));var util=require(_0x3edf('0x9'));var path=require(_0x3edf('0xa'));var sox=require(_0x3edf('0xb'));var csv=require('to-csv');var ejs=require(_0x3edf('0xc'));var fs=require('fs');var _=require(_0x3edf('0xd'));var squel=require(_0x3edf('0xe'));var crypto=require(_0x3edf('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3edf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3edf('0x11'));var Papa=require(_0x3edf('0x12'));var Redis=require(_0x3edf('0x13'));var authService=require(_0x3edf('0x14'));var qs=require(_0x3edf('0x15'));var as=require(_0x3edf('0x16'));var hardwareService=require(_0x3edf('0x17'));var logger=require(_0x3edf('0x18'))('api');var utils=require(_0x3edf('0x19'));var config=require('../../config/environment');var db=require(_0x3edf('0x1a'))['db'];function respondWithStatusCode(_0x529e7c,_0x369184){_0x369184=_0x369184||0xcc;return function(_0x202a54){if(_0x202a54){return _0x529e7c[_0x3edf('0x1b')](_0x369184);}return _0x529e7c[_0x3edf('0x1c')](_0x369184)['end']();};}function respondWithResult(_0x3dd057,_0x4e7a99){_0x4e7a99=_0x4e7a99||0xc8;return function(_0x26cff2){if(_0x26cff2){return _0x3dd057['status'](_0x4e7a99)['json'](_0x26cff2);}};}function respondWithFilteredResult(_0x2a6686,_0x577d0e){return function(_0x3d3fc5){if(_0x3d3fc5){var _0x1719fa=_0x3d3fc5[_0x3edf('0x1d')],_0x313fc7=_0x577d0e[_0x3edf('0x1e')],_0x4aa741=_0x577d0e[_0x3edf('0x1e')]+_0x577d0e[_0x3edf('0x1f')],_0x27473b;if(_0x4aa741>=_0x1719fa){_0x4aa741=_0x1719fa;_0x27473b=0xc8;}else{_0x27473b=0xce;}_0x2a6686[_0x3edf('0x1c')](_0x27473b);return _0x2a6686[_0x3edf('0x20')](_0x3edf('0x21'),_0x313fc7+'-'+_0x4aa741+'/'+_0x1719fa)['json'](_0x3d3fc5);}return null;};}function patchUpdates(_0x4b5d17){return function(_0x10492a){try{jsonpatch[_0x3edf('0x22')](_0x10492a,_0x4b5d17,!![]);}catch(_0x1354a1){return BPromise[_0x3edf('0x23')](_0x1354a1);}return _0x10492a[_0x3edf('0x24')]();};}function saveUpdates(_0x39a528,_0x5db657){return function(_0x4d3f80){if(_0x4d3f80){return _0x4d3f80[_0x3edf('0x25')](_0x39a528)[_0x3edf('0x26')](function(_0x18ec35){return _0x18ec35;});}return null;};}function removeEntity(_0x17baa1,_0x103a18){return function(_0x428188){if(_0x428188){return _0x428188[_0x3edf('0x27')]()[_0x3edf('0x26')](function(){_0x17baa1[_0x3edf('0x1c')](0xcc)[_0x3edf('0x28')]();});}};}function handleEntityNotFound(_0x4ecd45,_0x5d5d57){return function(_0x57152d){if(!_0x57152d){_0x4ecd45['sendStatus'](0x194);}return _0x57152d;};}function handleError(_0x5685a8,_0x1dc7d0){_0x1dc7d0=_0x1dc7d0||0x1f4;return function(_0x13afac){logger['error'](_0x13afac['stack']);if(_0x13afac[_0x3edf('0x29')]){delete _0x13afac[_0x3edf('0x29')];}_0x5685a8['status'](_0x1dc7d0)[_0x3edf('0x2a')](_0x13afac);};}exports[_0x3edf('0x2b')]=function(_0x4d15eb,_0x254127){var _0x5968aa={},_0x4ae7e5={},_0x5c801b={'count':0x0,'rows':[]};var _0x47389c=_['map'](db[_0x3edf('0x2c')][_0x3edf('0x2d')],function(_0x162b78){return{'name':_0x162b78[_0x3edf('0x2e')],'type':_0x162b78[_0x3edf('0x2f')]['key']};});_0x4ae7e5[_0x3edf('0x30')]=_[_0x3edf('0x31')](_0x47389c,_0x3edf('0x29'));_0x4ae7e5[_0x3edf('0x32')]=_[_0x3edf('0x33')](_0x4d15eb['query']);_0x4ae7e5[_0x3edf('0x34')]=_[_0x3edf('0x35')](_0x4ae7e5[_0x3edf('0x30')],_0x4ae7e5[_0x3edf('0x32')]);_0x5968aa[_0x3edf('0x36')]=_[_0x3edf('0x35')](_0x4ae7e5['model'],qs[_0x3edf('0x37')](_0x4d15eb[_0x3edf('0x32')][_0x3edf('0x37')]));_0x5968aa[_0x3edf('0x36')]=_0x5968aa[_0x3edf('0x36')][_0x3edf('0x38')]?_0x5968aa[_0x3edf('0x36')]:_0x4ae7e5[_0x3edf('0x30')];if(!_0x4d15eb[_0x3edf('0x32')][_0x3edf('0x39')]('nolimit')){_0x5968aa[_0x3edf('0x1f')]=qs['limit'](_0x4d15eb['query'][_0x3edf('0x1f')]);_0x5968aa[_0x3edf('0x1e')]=qs['offset'](_0x4d15eb[_0x3edf('0x32')][_0x3edf('0x1e')]);}_0x5968aa[_0x3edf('0x3a')]=qs[_0x3edf('0x3b')](_0x4d15eb[_0x3edf('0x32')][_0x3edf('0x3b')]);_0x5968aa['where']=qs[_0x3edf('0x34')](_[_0x3edf('0x3c')](_0x4d15eb['query'],_0x4ae7e5[_0x3edf('0x34')]),_0x47389c);if(_0x4d15eb['query'][_0x3edf('0x3d')]){_0x5968aa[_0x3edf('0x3e')]=_[_0x3edf('0x3f')](_0x5968aa[_0x3edf('0x3e')],{'$or':_['map'](_0x47389c,function(_0x5b17ab){if(_0x5b17ab[_0x3edf('0x2f')]!==_0x3edf('0x40')){var _0x4be6b5={};_0x4be6b5[_0x5b17ab['name']]={'$like':'%'+_0x4d15eb['query'][_0x3edf('0x3d')]+'%'};return _0x4be6b5;}})});}_0x5968aa=_[_0x3edf('0x3f')]({},_0x5968aa,_0x4d15eb[_0x3edf('0x41')]);var _0x4c87da={'where':_0x5968aa['where']};return db[_0x3edf('0x2c')][_0x3edf('0x1d')](_0x4c87da)['then'](function(_0x74ea4c){_0x5c801b[_0x3edf('0x1d')]=_0x74ea4c;if(_0x4d15eb[_0x3edf('0x32')][_0x3edf('0x42')]){_0x5968aa[_0x3edf('0x43')]=[{'all':!![]}];}return db[_0x3edf('0x2c')]['findAll'](_0x5968aa);})[_0x3edf('0x26')](function(_0x812bd9){_0x5c801b[_0x3edf('0x44')]=_0x812bd9;return _0x5c801b;})[_0x3edf('0x26')](respondWithFilteredResult(_0x254127,_0x5968aa))['catch'](handleError(_0x254127,null));};exports[_0x3edf('0x45')]=function(_0x32e6d8,_0x517b91){var _0x489770={'raw':!![],'where':{'id':_0x32e6d8[_0x3edf('0x46')]['id']}},_0x46061b={};_0x46061b[_0x3edf('0x30')]=_[_0x3edf('0x33')](db[_0x3edf('0x2c')][_0x3edf('0x2d')]);_0x46061b[_0x3edf('0x32')]=_[_0x3edf('0x33')](_0x32e6d8[_0x3edf('0x32')]);_0x46061b[_0x3edf('0x34')]=_[_0x3edf('0x35')](_0x46061b['model'],_0x46061b['query']);_0x489770[_0x3edf('0x36')]=_[_0x3edf('0x35')](_0x46061b[_0x3edf('0x30')],qs[_0x3edf('0x37')](_0x32e6d8['query']['fields']));_0x489770[_0x3edf('0x36')]=_0x489770['attributes'][_0x3edf('0x38')]?_0x489770['attributes']:_0x46061b[_0x3edf('0x30')];if(_0x32e6d8[_0x3edf('0x32')][_0x3edf('0x42')]){_0x489770['include']=[{'all':!![]}];}_0x489770=_[_0x3edf('0x3f')]({},_0x489770,_0x32e6d8['options']);return db[_0x3edf('0x2c')][_0x3edf('0x47')](_0x489770)[_0x3edf('0x26')](handleEntityNotFound(_0x517b91,null))['then'](respondWithResult(_0x517b91,null))[_0x3edf('0x48')](handleError(_0x517b91,null));};exports['create']=function(_0x3f632f,_0x34e3c1){return db['SquareReport'][_0x3edf('0x49')](_0x3f632f[_0x3edf('0x4a')],{})[_0x3edf('0x26')](respondWithResult(_0x34e3c1,0xc9))[_0x3edf('0x48')](handleError(_0x34e3c1,null));};exports[_0x3edf('0x25')]=function(_0x45cca1,_0xa68060){if(_0x45cca1['body']['id']){delete _0x45cca1['body']['id'];}return db[_0x3edf('0x2c')][_0x3edf('0x47')]({'where':{'id':_0x45cca1[_0x3edf('0x46')]['id']}})[_0x3edf('0x26')](handleEntityNotFound(_0xa68060,null))[_0x3edf('0x26')](saveUpdates(_0x45cca1[_0x3edf('0x4a')],null))[_0x3edf('0x26')](respondWithResult(_0xa68060,null))['catch'](handleError(_0xa68060,null));};exports[_0x3edf('0x27')]=function(_0x4162c3,_0x3c9fbc){return db[_0x3edf('0x2c')][_0x3edf('0x47')]({'where':{'id':_0x4162c3[_0x3edf('0x46')]['id']}})[_0x3edf('0x26')](handleEntityNotFound(_0x3c9fbc,null))[_0x3edf('0x26')](removeEntity(_0x3c9fbc,null))[_0x3edf('0x48')](handleError(_0x3c9fbc,null));};exports[_0x3edf('0x4b')]=function(_0x71ca2b,_0x160791){return db[_0x3edf('0x2c')]['describe']()['then'](respondWithResult(_0x160791,null))['catch'](handleError(_0x160791,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2d9a568..c8fa72a 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 _0x22e7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','uniqueid','project_name','leaveAt','util','../../config/logger'];(function(_0x180eac,_0x4d5e56){var _0x1ce800=function(_0xedeb4b){while(--_0xedeb4b){_0x180eac['push'](_0x180eac['shift']());}};_0x1ce800(++_0x4d5e56);}(_0x22e7,0xa6));var _0x722e=function(_0x1dbd89,_0x57e490){_0x1dbd89=_0x1dbd89-0x0;var _0x43909d=_0x22e7[_0x1dbd89];return _0x43909d;};'use strict';var _=require('lodash');var util=require(_0x722e('0x0'));var logger=require(_0x722e('0x1'))(_0x722e('0x2'));var moment=require(_0x722e('0x3'));var BPromise=require(_0x722e('0x4'));var rp=require(_0x722e('0x5'));var fs=require('fs');var path=require(_0x722e('0x6'));var rimraf=require(_0x722e('0x7'));var config=require(_0x722e('0x8'));var attributes=require(_0x722e('0x9'));module['exports']=function(_0x14adbb,_0x1dfcc7){return _0x14adbb[_0x722e('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x722e('0xb'),_0x722e('0xc')]},{'name':_0x722e('0xd'),'fields':[_0x722e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5c=['../../config/logger','api','moment','request-promise','path','../../config/environment','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0xfe5c,0x67));var _0xcfe5=function(_0x5f1d17,_0x589cf7){_0x5f1d17=_0x5f1d17-0x0;var _0x3f2712=_0xfe5c[_0x5f1d17];return _0x3f2712;};'use strict';var _=require(_0xcfe5('0x0'));var util=require('util');var logger=require(_0xcfe5('0x1'))(_0xcfe5('0x2'));var moment=require(_0xcfe5('0x3'));var BPromise=require('bluebird');var rp=require(_0xcfe5('0x4'));var fs=require('fs');var path=require(_0xcfe5('0x5'));var rimraf=require('rimraf');var config=require(_0xcfe5('0x6'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1ea507,_0x5e2837){return _0x1ea507[_0xcfe5('0x7')]('SquareReport',attributes,{'tableName':_0xcfe5('0x8'),'paranoid':![],'indexes':[{'name':_0xcfe5('0x9'),'fields':[_0xcfe5('0xa'),_0xcfe5('0xb')]},{'name':_0xcfe5('0xc'),'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 a84a361..8e0fca6 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 _0x98f8=['message','result','catch','CreateSquareReport','create','body','options','raw','stringify','SquareReport','where','attributes','UpdateSquareReport','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x98f8,0xa8));var _0x898f=function(_0x17a68b,_0x479795){_0x17a68b=_0x17a68b-0x0;var _0x3282b8=_0x98f8[_0x17a68b];return _0x3282b8;};'use strict';var _=require(_0x898f('0x0'));var util=require('util');var moment=require(_0x898f('0x1'));var BPromise=require(_0x898f('0x2'));var rs=require(_0x898f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x898f('0x4'));var logger=require(_0x898f('0x5'))(_0x898f('0x6'));var config=require('../../config/environment');var jayson=require(_0x898f('0x7'));var client=jayson[_0x898f('0x8')][_0x898f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8021a0,_0x531465,_0x14b28e){return new BPromise(function(_0x24d0fa,_0x5286d9){return client[_0x898f('0xa')](_0x8021a0,_0x14b28e)[_0x898f('0xb')](function(_0x5c6e41){logger[_0x898f('0xc')](_0x898f('0xd'),_0x531465,_0x898f('0xe'));logger[_0x898f('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x531465,_0x898f('0xe'),JSON['stringify'](_0x5c6e41));if(_0x5c6e41[_0x898f('0x10')]){if(_0x5c6e41[_0x898f('0x10')][_0x898f('0x11')]===0x1f4){logger[_0x898f('0x10')](_0x898f('0xd'),_0x531465,_0x5c6e41[_0x898f('0x10')]['message']);return _0x5286d9(_0x5c6e41[_0x898f('0x10')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x531465,_0x5c6e41[_0x898f('0x10')]['message']);return _0x24d0fa(_0x5c6e41[_0x898f('0x10')][_0x898f('0x12')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x531465,_0x898f('0xe'));_0x24d0fa(_0x5c6e41[_0x898f('0x13')][_0x898f('0x12')]);}})[_0x898f('0x14')](function(_0x506ed8){logger[_0x898f('0x10')]('SquareReport,\x20%s,\x20%s',_0x531465,_0x506ed8);_0x5286d9(_0x506ed8);});});}exports[_0x898f('0x15')]=function(_0x5c564e){var _0x318d66=this;return new Promise(function(_0x563695,_0x404fe9){return db['SquareReport'][_0x898f('0x16')](_0x5c564e[_0x898f('0x17')],{'raw':_0x5c564e[_0x898f('0x18')]?_0x5c564e[_0x898f('0x18')][_0x898f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x550f1e){logger['info']('CreateSquareReport',_0x5c564e);logger[_0x898f('0xf')](_0x898f('0x15'),_0x5c564e,JSON[_0x898f('0x1a')](_0x550f1e));_0x563695(_0x550f1e);})[_0x898f('0x14')](function(_0x215cd2){logger[_0x898f('0x10')](_0x898f('0x15'),_0x215cd2[_0x898f('0x12')],_0x5c564e);_0x404fe9(_0x318d66[_0x898f('0x10')](0x1f4,_0x215cd2['message']));});});};exports['UpdateSquareReport']=function(_0x541c62){var _0x4421fb=this;return new Promise(function(_0x52e8a5,_0x599c0d){return db[_0x898f('0x1b')]['update'](_0x541c62['body'],{'raw':_0x541c62[_0x898f('0x18')]?_0x541c62[_0x898f('0x18')][_0x898f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541c62['options']?_0x541c62['options'][_0x898f('0x1c')]||null:null,'attributes':_0x541c62['options']?_0x541c62[_0x898f('0x18')][_0x898f('0x1d')]||null:null,'limit':_0x541c62[_0x898f('0x18')]?_0x541c62[_0x898f('0x18')]['limit']||null:null})[_0x898f('0xb')](function(_0x274514){logger[_0x898f('0xc')](_0x898f('0x1e'),_0x541c62);logger[_0x898f('0xf')](_0x898f('0x1e'),_0x541c62,JSON[_0x898f('0x1a')](_0x274514));_0x52e8a5(_0x274514);})[_0x898f('0x14')](function(_0x401585){logger[_0x898f('0x10')]('UpdateSquareReport',_0x401585['message'],_0x541c62);_0x599c0d(_0x4421fb[_0x898f('0x10')](0x1f4,_0x401585[_0x898f('0x12')]));});});}; \ No newline at end of file +var _0x8d85=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','CreateSquareReport','SquareReport','create','options','stringify','catch','UpdateSquareReport','update','body','raw','attributes','limit','then','lodash','util'];(function(_0x4bc16e,_0x2a386b){var _0x1612d7=function(_0x1527ad){while(--_0x1527ad){_0x4bc16e['push'](_0x4bc16e['shift']());}};_0x1612d7(++_0x2a386b);}(_0x8d85,0x1c5));var _0x58d8=function(_0xc8cbdb,_0x225016){_0xc8cbdb=_0xc8cbdb-0x0;var _0x4d8f07=_0x8d85[_0xc8cbdb];return _0x4d8f07;};'use strict';var _=require(_0x58d8('0x0'));var util=require(_0x58d8('0x1'));var moment=require(_0x58d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x58d8('0x3'));var fs=require('fs');var Redis=require(_0x58d8('0x4'));var db=require(_0x58d8('0x5'))['db'];var utils=require(_0x58d8('0x6'));var logger=require(_0x58d8('0x7'))(_0x58d8('0x8'));var config=require(_0x58d8('0x9'));var jayson=require(_0x58d8('0xa'));var client=jayson[_0x58d8('0xb')][_0x58d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33cc17,_0x299bbc,_0x55af8f){return new BPromise(function(_0x56886e,_0x35e6e9){return client[_0x58d8('0xd')](_0x33cc17,_0x55af8f)['then'](function(_0x23c30d){logger[_0x58d8('0xe')]('SquareReport,\x20%s,\x20%s',_0x299bbc,_0x58d8('0xf'));logger[_0x58d8('0x10')](_0x58d8('0x11'),_0x299bbc,_0x58d8('0xf'),JSON['stringify'](_0x23c30d));if(_0x23c30d['error']){if(_0x23c30d[_0x58d8('0x12')][_0x58d8('0x13')]===0x1f4){logger[_0x58d8('0x12')](_0x58d8('0x14'),_0x299bbc,_0x23c30d[_0x58d8('0x12')]['message']);return _0x35e6e9(_0x23c30d['error']['message']);}logger['error'](_0x58d8('0x14'),_0x299bbc,_0x23c30d[_0x58d8('0x12')][_0x58d8('0x15')]);return _0x56886e(_0x23c30d[_0x58d8('0x12')][_0x58d8('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x299bbc,_0x58d8('0xf'));_0x56886e(_0x23c30d['result']['message']);}})['catch'](function(_0x561e3c){logger[_0x58d8('0x12')](_0x58d8('0x14'),_0x299bbc,_0x561e3c);_0x35e6e9(_0x561e3c);});});}exports[_0x58d8('0x16')]=function(_0x365e28){var _0x18178b=this;return new Promise(function(_0x5dbb0d,_0x88a452){return db[_0x58d8('0x17')][_0x58d8('0x18')](_0x365e28['body'],{'raw':_0x365e28[_0x58d8('0x19')]?_0x365e28['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4cfe73){logger[_0x58d8('0xe')](_0x58d8('0x16'),_0x365e28);logger[_0x58d8('0x10')](_0x58d8('0x16'),_0x365e28,JSON[_0x58d8('0x1a')](_0x4cfe73));_0x5dbb0d(_0x4cfe73);})[_0x58d8('0x1b')](function(_0x20d268){logger['error']('CreateSquareReport',_0x20d268[_0x58d8('0x15')],_0x365e28);_0x88a452(_0x18178b['error'](0x1f4,_0x20d268['message']));});});};exports[_0x58d8('0x1c')]=function(_0x5276a2){var _0x42dbb2=this;return new Promise(function(_0x301939,_0x4101d5){return db['SquareReport'][_0x58d8('0x1d')](_0x5276a2[_0x58d8('0x1e')],{'raw':_0x5276a2['options']?_0x5276a2[_0x58d8('0x19')][_0x58d8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5276a2['options']?_0x5276a2[_0x58d8('0x19')]['where']||null:null,'attributes':_0x5276a2[_0x58d8('0x19')]?_0x5276a2[_0x58d8('0x19')][_0x58d8('0x20')]||null:null,'limit':_0x5276a2[_0x58d8('0x19')]?_0x5276a2['options'][_0x58d8('0x21')]||null:null})[_0x58d8('0x22')](function(_0x21b96a){logger[_0x58d8('0xe')]('UpdateSquareReport',_0x5276a2);logger[_0x58d8('0x10')](_0x58d8('0x1c'),_0x5276a2,JSON[_0x58d8('0x1a')](_0x21b96a));_0x301939(_0x21b96a);})[_0x58d8('0x1b')](function(_0x2b0766){logger[_0x58d8('0x12')]('UpdateSquareReport',_0x2b0766[_0x58d8('0x15')],_0x5276a2);_0x4101d5(_0x42dbb2['error'](0x1f4,_0x2b0766['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f7789a0..7e23a22 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(_0x54c487,_0x34c153){var _0x4b203c=function(_0x4388e0){while(--_0x4388e0){_0x54c487['push'](_0x54c487['shift']());}};_0x4b203c(++_0x34c153);}(_0x7a54,0x106));var _0x47a5=function(_0x31c156,_0x41a924){_0x31c156=_0x31c156-0x0;var _0x30e4dd=_0x7a54[_0x31c156];return _0x30e4dd;};'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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3394fc,_0x3f9aec){var _0x5b57fc=function(_0x422264){while(--_0x422264){_0x3394fc['push'](_0x3394fc['shift']());}};_0x5b57fc(++_0x3f9aec);}(_0x7a54,0x106));var _0x47a5=function(_0x49c89c,_0x32e8c9){_0x49c89c=_0x49c89c-0x0;var _0x5a03bf=_0x7a54[_0x49c89c];return _0x5a03bf;};'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 diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index d1d2d00..c24c427 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 _0x209c=['STRING','sequelize','exports'];(function(_0x22193e,_0x2ae001){var _0x10c378=function(_0x411e3f){while(--_0x411e3f){_0x22193e['push'](_0x22193e['shift']());}};_0x10c378(++_0x2ae001);}(_0x209c,0x1bd));var _0xc209=function(_0x548e7c,_0x50247d){_0x548e7c=_0x548e7c-0x0;var _0x408429=_0x209c[_0x548e7c];return _0x408429;};'use strict';var Sequelize=require(_0xc209('0x0'));module[_0xc209('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xc209('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc209('0x2')]},'callerid':{'type':Sequelize[_0xc209('0x2')]}}; \ No newline at end of file +var _0xf4e1=['TEXT','sequelize','exports','STRING'];(function(_0x59294f,_0x45d5b7){var _0x385ee0=function(_0x22244c){while(--_0x22244c){_0x59294f['push'](_0x59294f['shift']());}};_0x385ee0(++_0x45d5b7);}(_0xf4e1,0xe1));var _0x1f4e=function(_0x2d5a39,_0x6ef0ae){_0x2d5a39=_0x2d5a39-0x0;var _0x1ceb06=_0xf4e1[_0x2d5a39];return _0x1ceb06;};'use strict';var Sequelize=require(_0x1f4e('0x0'));module[_0x1f4e('0x1')]={'uniqueid':{'type':Sequelize[_0x1f4e('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x1f4e('0x3')]},'project_name':{'type':Sequelize[_0x1f4e('0x2')]},'callerid':{'type':Sequelize[_0x1f4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b92c651..ed5f8b2 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 _0x27ad=['status','end','json','offset','limit','set','apply','reject','save','then','destroy','error','name','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','catch','create','body','update','find','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x24050a,_0x1ce736){var _0x4d27aa=function(_0x77c99a){while(--_0x77c99a){_0x24050a['push'](_0x24050a['shift']());}};_0x4d27aa(++_0x1ce736);}(_0x27ad,0x7b));var _0xd27a=function(_0x45df57,_0x5c45f2){_0x45df57=_0x45df57-0x0;var _0x533ee7=_0x27ad[_0x45df57];return _0x533ee7;};'use strict';var pdf=require(_0xd27a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd27a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd27a('0x2'));var rp=require(_0xd27a('0x3'));var moment=require(_0xd27a('0x4'));var BPromise=require(_0xd27a('0x5'));var Mustache=require(_0xd27a('0x6'));var util=require('util');var path=require(_0xd27a('0x7'));var sox=require(_0xd27a('0x8'));var csv=require(_0xd27a('0x9'));var ejs=require(_0xd27a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd27a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd27a('0xc'));var toCsv=require(_0xd27a('0x9'));var querystring=require('querystring');var Papa=require(_0xd27a('0xd'));var Redis=require(_0xd27a('0xe'));var authService=require(_0xd27a('0xf'));var qs=require(_0xd27a('0x10'));var as=require(_0xd27a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd27a('0x12'));var utils=require(_0xd27a('0x13'));var config=require(_0xd27a('0x14'));var db=require(_0xd27a('0x15'))['db'];function respondWithStatusCode(_0x438949,_0xf72099){_0xf72099=_0xf72099||0xcc;return function(_0x1f630f){if(_0x1f630f){return _0x438949[_0xd27a('0x16')](_0xf72099);}return _0x438949[_0xd27a('0x17')](_0xf72099)[_0xd27a('0x18')]();};}function respondWithResult(_0x379f2f,_0x1b2eaf){_0x1b2eaf=_0x1b2eaf||0xc8;return function(_0xf6b16f){if(_0xf6b16f){return _0x379f2f[_0xd27a('0x17')](_0x1b2eaf)[_0xd27a('0x19')](_0xf6b16f);}};}function respondWithFilteredResult(_0x233e67,_0x2a60c3){return function(_0x194f89){if(_0x194f89){var _0x2f56d8=_0x194f89['count'],_0x4d6b68=_0x2a60c3[_0xd27a('0x1a')],_0x39b101=_0x2a60c3[_0xd27a('0x1a')]+_0x2a60c3[_0xd27a('0x1b')],_0x295981;if(_0x39b101>=_0x2f56d8){_0x39b101=_0x2f56d8;_0x295981=0xc8;}else{_0x295981=0xce;}_0x233e67[_0xd27a('0x17')](_0x295981);return _0x233e67[_0xd27a('0x1c')]('Content-Range',_0x4d6b68+'-'+_0x39b101+'/'+_0x2f56d8)[_0xd27a('0x19')](_0x194f89);}return null;};}function patchUpdates(_0x4f9c99){return function(_0x5f63e3){try{jsonpatch[_0xd27a('0x1d')](_0x5f63e3,_0x4f9c99,!![]);}catch(_0x3b646e){return BPromise[_0xd27a('0x1e')](_0x3b646e);}return _0x5f63e3[_0xd27a('0x1f')]();};}function saveUpdates(_0x9541b2,_0x20fc21){return function(_0x16a3d){if(_0x16a3d){return _0x16a3d['update'](_0x9541b2)[_0xd27a('0x20')](function(_0x45a658){return _0x45a658;});}return null;};}function removeEntity(_0x939dc5,_0x30afb5){return function(_0x3603fa){if(_0x3603fa){return _0x3603fa[_0xd27a('0x21')]()['then'](function(){_0x939dc5[_0xd27a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6809,_0x8d624f){return function(_0x2b8a91){if(!_0x2b8a91){_0x1c6809[_0xd27a('0x16')](0x194);}return _0x2b8a91;};}function handleError(_0x3fd96d,_0x371ad6){_0x371ad6=_0x371ad6||0x1f4;return function(_0x26b9bb){logger[_0xd27a('0x22')](_0x26b9bb['stack']);if(_0x26b9bb[_0xd27a('0x23')]){delete _0x26b9bb[_0xd27a('0x23')];}_0x3fd96d['status'](_0x371ad6)['send'](_0x26b9bb);};}exports['index']=function(_0x41a213,_0x5dbf39){var _0xd872af={},_0x569368={},_0x5aacfa={'count':0x0,'rows':[]};var _0xf009c3=_[_0xd27a('0x24')](db[_0xd27a('0x25')][_0xd27a('0x26')],function(_0x55be40){return{'name':_0x55be40[_0xd27a('0x27')],'type':_0x55be40[_0xd27a('0x28')][_0xd27a('0x29')]};});_0x569368[_0xd27a('0x2a')]=_[_0xd27a('0x24')](_0xf009c3,_0xd27a('0x23'));_0x569368['query']=_[_0xd27a('0x2b')](_0x41a213[_0xd27a('0x2c')]);_0x569368[_0xd27a('0x2d')]=_[_0xd27a('0x2e')](_0x569368['model'],_0x569368[_0xd27a('0x2c')]);_0xd872af['attributes']=_[_0xd27a('0x2e')](_0x569368['model'],qs[_0xd27a('0x2f')](_0x41a213[_0xd27a('0x2c')][_0xd27a('0x2f')]));_0xd872af[_0xd27a('0x30')]=_0xd872af[_0xd27a('0x30')][_0xd27a('0x31')]?_0xd872af['attributes']:_0x569368['model'];if(!_0x41a213[_0xd27a('0x2c')][_0xd27a('0x32')](_0xd27a('0x33'))){_0xd872af[_0xd27a('0x1b')]=qs[_0xd27a('0x1b')](_0x41a213[_0xd27a('0x2c')][_0xd27a('0x1b')]);_0xd872af[_0xd27a('0x1a')]=qs['offset'](_0x41a213[_0xd27a('0x2c')][_0xd27a('0x1a')]);}_0xd872af[_0xd27a('0x34')]=qs[_0xd27a('0x35')](_0x41a213['query']['sort']);_0xd872af['where']=qs['filters'](_[_0xd27a('0x36')](_0x41a213[_0xd27a('0x2c')],_0x569368[_0xd27a('0x2d')]),_0xf009c3);if(_0x41a213[_0xd27a('0x2c')][_0xd27a('0x37')]){_0xd872af[_0xd27a('0x38')]=_['merge'](_0xd872af['where'],{'$or':_[_0xd27a('0x24')](_0xf009c3,function(_0x2c7147){if(_0x2c7147['type']!==_0xd27a('0x39')){var _0x5dbc70={};_0x5dbc70[_0x2c7147[_0xd27a('0x23')]]={'$like':'%'+_0x41a213[_0xd27a('0x2c')][_0xd27a('0x37')]+'%'};return _0x5dbc70;}})});}_0xd872af=_[_0xd27a('0x3a')]({},_0xd872af,_0x41a213[_0xd27a('0x3b')]);var _0x253503={'where':_0xd872af['where']};return db[_0xd27a('0x25')][_0xd27a('0x3c')](_0x253503)[_0xd27a('0x20')](function(_0x21b79f){_0x5aacfa['count']=_0x21b79f;if(_0x41a213[_0xd27a('0x2c')][_0xd27a('0x3d')]){_0xd872af[_0xd27a('0x3e')]=[{'all':!![]}];}return db[_0xd27a('0x25')][_0xd27a('0x3f')](_0xd872af);})[_0xd27a('0x20')](function(_0x4cf191){_0x5aacfa[_0xd27a('0x40')]=_0x4cf191;return _0x5aacfa;})['then'](respondWithFilteredResult(_0x5dbf39,_0xd872af))['catch'](handleError(_0x5dbf39,null));};exports[_0xd27a('0x41')]=function(_0x15ce7f,_0x4e2e21){var _0x5c43d5={'raw':!![],'where':{'id':_0x15ce7f['params']['id']}},_0x25a03b={};_0x25a03b['model']=_['keys'](db[_0xd27a('0x25')][_0xd27a('0x26')]);_0x25a03b[_0xd27a('0x2c')]=_[_0xd27a('0x2b')](_0x15ce7f[_0xd27a('0x2c')]);_0x25a03b['filters']=_[_0xd27a('0x2e')](_0x25a03b[_0xd27a('0x2a')],_0x25a03b[_0xd27a('0x2c')]);_0x5c43d5[_0xd27a('0x30')]=_[_0xd27a('0x2e')](_0x25a03b['model'],qs[_0xd27a('0x2f')](_0x15ce7f[_0xd27a('0x2c')][_0xd27a('0x2f')]));_0x5c43d5[_0xd27a('0x30')]=_0x5c43d5[_0xd27a('0x30')][_0xd27a('0x31')]?_0x5c43d5[_0xd27a('0x30')]:_0x25a03b['model'];if(_0x15ce7f['query']['includeAll']){_0x5c43d5[_0xd27a('0x3e')]=[{'all':!![]}];}_0x5c43d5=_['merge']({},_0x5c43d5,_0x15ce7f[_0xd27a('0x3b')]);return db[_0xd27a('0x25')]['find'](_0x5c43d5)[_0xd27a('0x20')](handleEntityNotFound(_0x4e2e21,null))[_0xd27a('0x20')](respondWithResult(_0x4e2e21,null))[_0xd27a('0x42')](handleError(_0x4e2e21,null));};exports[_0xd27a('0x43')]=function(_0x215d40,_0x33832b){return db[_0xd27a('0x25')][_0xd27a('0x43')](_0x215d40[_0xd27a('0x44')],{})[_0xd27a('0x20')](respondWithResult(_0x33832b,0xc9))['catch'](handleError(_0x33832b,null));};exports[_0xd27a('0x45')]=function(_0x302028,_0x56eb5b){if(_0x302028[_0xd27a('0x44')]['id']){delete _0x302028['body']['id'];}return db[_0xd27a('0x25')][_0xd27a('0x46')]({'where':{'id':_0x302028[_0xd27a('0x47')]['id']}})['then'](handleEntityNotFound(_0x56eb5b,null))[_0xd27a('0x20')](saveUpdates(_0x302028['body'],null))[_0xd27a('0x20')](respondWithResult(_0x56eb5b,null))['catch'](handleError(_0x56eb5b,null));};exports[_0xd27a('0x21')]=function(_0x4978d3,_0x578776){return db[_0xd27a('0x25')][_0xd27a('0x46')]({'where':{'id':_0x4978d3[_0xd27a('0x47')]['id']}})[_0xd27a('0x20')](handleEntityNotFound(_0x578776,null))['then'](removeEntity(_0x578776,null))[_0xd27a('0x42')](handleError(_0x578776,null));};exports[_0xd27a('0x48')]=function(_0x2a25dd,_0x2c6b14){return db[_0xd27a('0x25')][_0xd27a('0x48')]()['then'](respondWithResult(_0x2c6b14,null))[_0xd27a('0x42')](handleError(_0x2c6b14,null));}; \ No newline at end of file +var _0x1d8e=['find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x1d8e,0x1e7));var _0xe1d8=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x1d8e[_0x4907de];return _0x482054;};'use strict';var pdf=require(_0xe1d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe1d8('0x1'));var zipdir=require(_0xe1d8('0x2'));var jsonpatch=require(_0xe1d8('0x3'));var rp=require(_0xe1d8('0x4'));var moment=require(_0xe1d8('0x5'));var BPromise=require(_0xe1d8('0x6'));var Mustache=require(_0xe1d8('0x7'));var util=require(_0xe1d8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe1d8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1d8('0xa'));var squel=require(_0xe1d8('0xb'));var crypto=require(_0xe1d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1d8('0xd'));var toCsv=require(_0xe1d8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1d8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe1d8('0xf'));var hardwareService=require(_0xe1d8('0x10'));var logger=require(_0xe1d8('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe1d8('0x12'))['db'];function respondWithStatusCode(_0x23bb4e,_0x3fffd4){_0x3fffd4=_0x3fffd4||0xcc;return function(_0x436ddd){if(_0x436ddd){return _0x23bb4e[_0xe1d8('0x13')](_0x3fffd4);}return _0x23bb4e[_0xe1d8('0x14')](_0x3fffd4)[_0xe1d8('0x15')]();};}function respondWithResult(_0x443be8,_0x1d36ee){_0x1d36ee=_0x1d36ee||0xc8;return function(_0x91699a){if(_0x91699a){return _0x443be8[_0xe1d8('0x14')](_0x1d36ee)['json'](_0x91699a);}};}function respondWithFilteredResult(_0x36cc3d,_0x45e77b){return function(_0x183387){if(_0x183387){var _0x5c9099=_0x183387[_0xe1d8('0x16')],_0x18bd03=_0x45e77b[_0xe1d8('0x17')],_0x10948d=_0x45e77b[_0xe1d8('0x17')]+_0x45e77b[_0xe1d8('0x18')],_0x31f7c1;if(_0x10948d>=_0x5c9099){_0x10948d=_0x5c9099;_0x31f7c1=0xc8;}else{_0x31f7c1=0xce;}_0x36cc3d[_0xe1d8('0x14')](_0x31f7c1);return _0x36cc3d[_0xe1d8('0x19')](_0xe1d8('0x1a'),_0x18bd03+'-'+_0x10948d+'/'+_0x5c9099)['json'](_0x183387);}return null;};}function patchUpdates(_0x41a5a6){return function(_0x2e4ef7){try{jsonpatch[_0xe1d8('0x1b')](_0x2e4ef7,_0x41a5a6,!![]);}catch(_0x246798){return BPromise[_0xe1d8('0x1c')](_0x246798);}return _0x2e4ef7[_0xe1d8('0x1d')]();};}function saveUpdates(_0x21960f,_0x42a916){return function(_0x60f2f6){if(_0x60f2f6){return _0x60f2f6[_0xe1d8('0x1e')](_0x21960f)['then'](function(_0x36edf1){return _0x36edf1;});}return null;};}function removeEntity(_0x404300,_0x6349b){return function(_0x56041f){if(_0x56041f){return _0x56041f[_0xe1d8('0x1f')]()['then'](function(){_0x404300['status'](0xcc)[_0xe1d8('0x15')]();});}};}function handleEntityNotFound(_0x7b842c,_0x44af72){return function(_0x1c021d){if(!_0x1c021d){_0x7b842c[_0xe1d8('0x13')](0x194);}return _0x1c021d;};}function handleError(_0x17e393,_0x1ee96a){_0x1ee96a=_0x1ee96a||0x1f4;return function(_0x1c0bdd){logger[_0xe1d8('0x20')](_0x1c0bdd[_0xe1d8('0x21')]);if(_0x1c0bdd[_0xe1d8('0x22')]){delete _0x1c0bdd['name'];}_0x17e393[_0xe1d8('0x14')](_0x1ee96a)[_0xe1d8('0x23')](_0x1c0bdd);};}exports['index']=function(_0x40c51d,_0x58c72c){var _0x681634={},_0x29d97e={},_0x3a2fca={'count':0x0,'rows':[]};var _0x1072da=_['map'](db[_0xe1d8('0x24')][_0xe1d8('0x25')],function(_0x484f6a){return{'name':_0x484f6a[_0xe1d8('0x26')],'type':_0x484f6a[_0xe1d8('0x27')]['key']};});_0x29d97e[_0xe1d8('0x28')]=_[_0xe1d8('0x29')](_0x1072da,'name');_0x29d97e[_0xe1d8('0x2a')]=_[_0xe1d8('0x2b')](_0x40c51d[_0xe1d8('0x2a')]);_0x29d97e[_0xe1d8('0x2c')]=_[_0xe1d8('0x2d')](_0x29d97e[_0xe1d8('0x28')],_0x29d97e[_0xe1d8('0x2a')]);_0x681634[_0xe1d8('0x2e')]=_['intersection'](_0x29d97e[_0xe1d8('0x28')],qs[_0xe1d8('0x2f')](_0x40c51d['query'][_0xe1d8('0x2f')]));_0x681634[_0xe1d8('0x2e')]=_0x681634['attributes']['length']?_0x681634[_0xe1d8('0x2e')]:_0x29d97e['model'];if(!_0x40c51d[_0xe1d8('0x2a')]['hasOwnProperty'](_0xe1d8('0x30'))){_0x681634[_0xe1d8('0x18')]=qs[_0xe1d8('0x18')](_0x40c51d[_0xe1d8('0x2a')][_0xe1d8('0x18')]);_0x681634[_0xe1d8('0x17')]=qs[_0xe1d8('0x17')](_0x40c51d[_0xe1d8('0x2a')]['offset']);}_0x681634[_0xe1d8('0x31')]=qs[_0xe1d8('0x32')](_0x40c51d[_0xe1d8('0x2a')][_0xe1d8('0x32')]);_0x681634[_0xe1d8('0x33')]=qs['filters'](_[_0xe1d8('0x34')](_0x40c51d['query'],_0x29d97e[_0xe1d8('0x2c')]),_0x1072da);if(_0x40c51d[_0xe1d8('0x2a')]['filter']){_0x681634['where']=_['merge'](_0x681634['where'],{'$or':_[_0xe1d8('0x29')](_0x1072da,function(_0x35d26a){if(_0x35d26a['type']!==_0xe1d8('0x35')){var _0x95d407={};_0x95d407[_0x35d26a[_0xe1d8('0x22')]]={'$like':'%'+_0x40c51d[_0xe1d8('0x2a')][_0xe1d8('0x36')]+'%'};return _0x95d407;}})});}_0x681634=_['merge']({},_0x681634,_0x40c51d[_0xe1d8('0x37')]);var _0x4a57fd={'where':_0x681634['where']};return db[_0xe1d8('0x24')]['count'](_0x4a57fd)[_0xe1d8('0x38')](function(_0x2e95d7){_0x3a2fca[_0xe1d8('0x16')]=_0x2e95d7;if(_0x40c51d[_0xe1d8('0x2a')][_0xe1d8('0x39')]){_0x681634[_0xe1d8('0x3a')]=[{'all':!![]}];}return db[_0xe1d8('0x24')][_0xe1d8('0x3b')](_0x681634);})['then'](function(_0x40f070){_0x3a2fca[_0xe1d8('0x3c')]=_0x40f070;return _0x3a2fca;})[_0xe1d8('0x38')](respondWithFilteredResult(_0x58c72c,_0x681634))[_0xe1d8('0x3d')](handleError(_0x58c72c,null));};exports[_0xe1d8('0x3e')]=function(_0x49b2f0,_0x583444){var _0x414df9={'raw':!![],'where':{'id':_0x49b2f0[_0xe1d8('0x3f')]['id']}},_0x404f9d={};_0x404f9d[_0xe1d8('0x28')]=_[_0xe1d8('0x2b')](db[_0xe1d8('0x24')]['rawAttributes']);_0x404f9d['query']=_[_0xe1d8('0x2b')](_0x49b2f0[_0xe1d8('0x2a')]);_0x404f9d[_0xe1d8('0x2c')]=_[_0xe1d8('0x2d')](_0x404f9d[_0xe1d8('0x28')],_0x404f9d[_0xe1d8('0x2a')]);_0x414df9[_0xe1d8('0x2e')]=_[_0xe1d8('0x2d')](_0x404f9d[_0xe1d8('0x28')],qs[_0xe1d8('0x2f')](_0x49b2f0['query']['fields']));_0x414df9[_0xe1d8('0x2e')]=_0x414df9[_0xe1d8('0x2e')][_0xe1d8('0x40')]?_0x414df9[_0xe1d8('0x2e')]:_0x404f9d['model'];if(_0x49b2f0[_0xe1d8('0x2a')][_0xe1d8('0x39')]){_0x414df9[_0xe1d8('0x3a')]=[{'all':!![]}];}_0x414df9=_['merge']({},_0x414df9,_0x49b2f0[_0xe1d8('0x37')]);return db[_0xe1d8('0x24')][_0xe1d8('0x41')](_0x414df9)[_0xe1d8('0x38')](handleEntityNotFound(_0x583444,null))[_0xe1d8('0x38')](respondWithResult(_0x583444,null))[_0xe1d8('0x3d')](handleError(_0x583444,null));};exports[_0xe1d8('0x42')]=function(_0x3b5dd3,_0x4a373d){return db[_0xe1d8('0x24')][_0xe1d8('0x42')](_0x3b5dd3[_0xe1d8('0x43')],{})[_0xe1d8('0x38')](respondWithResult(_0x4a373d,0xc9))['catch'](handleError(_0x4a373d,null));};exports[_0xe1d8('0x1e')]=function(_0x26d6f3,_0x281caa){if(_0x26d6f3[_0xe1d8('0x43')]['id']){delete _0x26d6f3['body']['id'];}return db[_0xe1d8('0x24')][_0xe1d8('0x41')]({'where':{'id':_0x26d6f3[_0xe1d8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x281caa,null))['then'](saveUpdates(_0x26d6f3[_0xe1d8('0x43')],null))[_0xe1d8('0x38')](respondWithResult(_0x281caa,null))['catch'](handleError(_0x281caa,null));};exports[_0xe1d8('0x1f')]=function(_0x5c14e7,_0x1fc66b){return db[_0xe1d8('0x24')][_0xe1d8('0x41')]({'where':{'id':_0x5c14e7[_0xe1d8('0x3f')]['id']}})[_0xe1d8('0x38')](handleEntityNotFound(_0x1fc66b,null))[_0xe1d8('0x38')](removeEntity(_0x1fc66b,null))['catch'](handleError(_0x1fc66b,null));};exports['describe']=function(_0x58c5ff,_0x4e968f){return db['SquareDetailsReport'][_0xe1d8('0x44')]()[_0xe1d8('0x38')](respondWithResult(_0x4e968f,null))[_0xe1d8('0x3d')](handleError(_0x4e968f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6609e64..48339a2 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 _0x9c03=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x5cd138,_0x36b3b7){var _0x41b087=function(_0xa5aaea){while(--_0xa5aaea){_0x5cd138['push'](_0x5cd138['shift']());}};_0x41b087(++_0x36b3b7);}(_0x9c03,0x1b6));var _0x39c0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9c03[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x39c0('0x0'));var util=require(_0x39c0('0x1'));var logger=require(_0x39c0('0x2'))(_0x39c0('0x3'));var moment=require(_0x39c0('0x4'));var BPromise=require(_0x39c0('0x5'));var rp=require(_0x39c0('0x6'));var fs=require('fs');var path=require(_0x39c0('0x7'));var rimraf=require(_0x39c0('0x8'));var config=require('../../config/environment');var attributes=require(_0x39c0('0x9'));module[_0x39c0('0xa')]=function(_0x37b834,_0x2130ef){return _0x37b834[_0x39c0('0xb')](_0x39c0('0xc'),attributes,{'tableName':_0x39c0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab6=['api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x52810d,_0x34ac75){var _0x495934=function(_0x2786c4){while(--_0x2786c4){_0x52810d['push'](_0x52810d['shift']());}};_0x495934(++_0x34ac75);}(_0x1ab6,0xc1));var _0x61ab=function(_0x308ee1,_0x337766){_0x308ee1=_0x308ee1-0x0;var _0x4d7769=_0x1ab6[_0x308ee1];return _0x4d7769;};'use strict';var _=require(_0x61ab('0x0'));var util=require(_0x61ab('0x1'));var logger=require(_0x61ab('0x2'))(_0x61ab('0x3'));var moment=require('moment');var BPromise=require(_0x61ab('0x4'));var rp=require(_0x61ab('0x5'));var fs=require('fs');var path=require(_0x61ab('0x6'));var rimraf=require(_0x61ab('0x7'));var config=require(_0x61ab('0x8'));var attributes=require(_0x61ab('0x9'));module[_0x61ab('0xa')]=function(_0x605263,_0xc36d1){return _0x605263[_0x61ab('0xb')](_0x61ab('0xc'),attributes,{'tableName':_0x61ab('0xd'),'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 7b63f56..ca3780d 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 _0xad74=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad74,0x1bb));var _0x4ad7=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0xad74[_0x109dbd];return _0x395644;};'use strict';var _=require(_0x4ad7('0x0'));var util=require(_0x4ad7('0x1'));var moment=require(_0x4ad7('0x2'));var BPromise=require(_0x4ad7('0x3'));var rs=require(_0x4ad7('0x4'));var fs=require('fs');var Redis=require(_0x4ad7('0x5'));var db=require(_0x4ad7('0x6'))['db'];var utils=require(_0x4ad7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ad7('0x8'));var jayson=require(_0x4ad7('0x9'));var client=jayson[_0x4ad7('0xa')][_0x4ad7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x533b52,_0x2a246e,_0x249fd9){return new BPromise(function(_0x807dd4,_0x2c19af){return client['request'](_0x533b52,_0x249fd9)['then'](function(_0x434888){logger[_0x4ad7('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a246e,_0x4ad7('0xd'));logger[_0x4ad7('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2a246e,_0x4ad7('0xd'),JSON[_0x4ad7('0xf')](_0x434888));if(_0x434888[_0x4ad7('0x10')]){if(_0x434888['error'][_0x4ad7('0x11')]===0x1f4){logger[_0x4ad7('0x10')](_0x4ad7('0x12'),_0x2a246e,_0x434888[_0x4ad7('0x10')]['message']);return _0x2c19af(_0x434888['error'][_0x4ad7('0x13')]);}logger[_0x4ad7('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a246e,_0x434888['error']['message']);return _0x807dd4(_0x434888[_0x4ad7('0x10')][_0x4ad7('0x13')]);}else{logger[_0x4ad7('0xc')](_0x4ad7('0x12'),_0x2a246e,_0x4ad7('0xd'));_0x807dd4(_0x434888['result'][_0x4ad7('0x13')]);}})[_0x4ad7('0x14')](function(_0x504907){logger[_0x4ad7('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a246e,_0x504907);_0x2c19af(_0x504907);});});}exports[_0x4ad7('0x15')]=function(_0x38cea9){var _0x5aa89e=this;return new Promise(function(_0x390bcc,_0x5e1a95){return db[_0x4ad7('0x16')][_0x4ad7('0x17')](_0x38cea9[_0x4ad7('0x18')],{'raw':_0x38cea9['options']?_0x38cea9['options']['raw']===undefined?!![]:![]:!![]})[_0x4ad7('0x19')](function(_0x2022f){logger[_0x4ad7('0xc')](_0x4ad7('0x15'),_0x38cea9);logger[_0x4ad7('0xe')]('CreateSquareDetailsReport',_0x38cea9,JSON[_0x4ad7('0xf')](_0x2022f));_0x390bcc(_0x2022f);})['catch'](function(_0x270808){logger['error']('CreateSquareDetailsReport',_0x270808[_0x4ad7('0x13')],_0x38cea9);_0x5e1a95(_0x5aa89e[_0x4ad7('0x10')](0x1f4,_0x270808[_0x4ad7('0x13')]));});});}; \ No newline at end of file +var _0x681b=['result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3fa2ae,_0x425037){var _0x30d156=function(_0x117fcb){while(--_0x117fcb){_0x3fa2ae['push'](_0x3fa2ae['shift']());}};_0x30d156(++_0x425037);}(_0x681b,0x13c));var _0xb681=function(_0x561c7a,_0x51c6d1){_0x561c7a=_0x561c7a-0x0;var _0x50f1a0=_0x681b[_0x561c7a];return _0x50f1a0;};'use strict';var _=require('lodash');var util=require(_0xb681('0x0'));var moment=require(_0xb681('0x1'));var BPromise=require(_0xb681('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb681('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb681('0x4'));var logger=require('../../config/logger')(_0xb681('0x5'));var config=require(_0xb681('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb681('0x7')][_0xb681('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4989e1,_0x42a607,_0x3403a9){return new BPromise(function(_0x2ba21e,_0x28f076){return client[_0xb681('0x9')](_0x4989e1,_0x3403a9)[_0xb681('0xa')](function(_0x4ed5dc){logger['info'](_0xb681('0xb'),_0x42a607,'request\x20sent');logger[_0xb681('0xc')](_0xb681('0xd'),_0x42a607,_0xb681('0xe'),JSON[_0xb681('0xf')](_0x4ed5dc));if(_0x4ed5dc[_0xb681('0x10')]){if(_0x4ed5dc['error'][_0xb681('0x11')]===0x1f4){logger['error'](_0xb681('0xb'),_0x42a607,_0x4ed5dc['error'][_0xb681('0x12')]);return _0x28f076(_0x4ed5dc['error'][_0xb681('0x12')]);}logger[_0xb681('0x10')](_0xb681('0xb'),_0x42a607,_0x4ed5dc[_0xb681('0x10')][_0xb681('0x12')]);return _0x2ba21e(_0x4ed5dc[_0xb681('0x10')][_0xb681('0x12')]);}else{logger[_0xb681('0x13')](_0xb681('0xb'),_0x42a607,_0xb681('0xe'));_0x2ba21e(_0x4ed5dc[_0xb681('0x14')]['message']);}})[_0xb681('0x15')](function(_0x419b77){logger[_0xb681('0x10')](_0xb681('0xb'),_0x42a607,_0x419b77);_0x28f076(_0x419b77);});});}exports[_0xb681('0x16')]=function(_0x248684){var _0x79b135=this;return new Promise(function(_0x106456,_0x379a14){return db[_0xb681('0x17')][_0xb681('0x18')](_0x248684[_0xb681('0x19')],{'raw':_0x248684[_0xb681('0x1a')]?_0x248684[_0xb681('0x1a')][_0xb681('0x1b')]===undefined?!![]:![]:!![]})[_0xb681('0xa')](function(_0x45df3d){logger[_0xb681('0x13')]('CreateSquareDetailsReport',_0x248684);logger[_0xb681('0xc')]('CreateSquareDetailsReport',_0x248684,JSON[_0xb681('0xf')](_0x45df3d));_0x106456(_0x45df3d);})[_0xb681('0x15')](function(_0x20f9c3){logger[_0xb681('0x10')](_0xb681('0x16'),_0x20f9c3[_0xb681('0x12')],_0x248684);_0x379a14(_0x79b135[_0xb681('0x10')](0x1f4,_0x20f9c3[_0xb681('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c4828fe..cba91bf 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 _0xad60=['get','isAuthenticated','index','/process/:pid/kill','express','./system.controller'];(function(_0x4c8d4c,_0x692307){var _0x43281f=function(_0x1405a4){while(--_0x1405a4){_0x4c8d4c['push'](_0x4c8d4c['shift']());}};_0x43281f(++_0x692307);}(_0xad60,0x196));var _0x0ad6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xad60[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x0ad6('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x0ad6('0x1'));router[_0x0ad6('0x2')]('/',auth[_0x0ad6('0x3')](),controller[_0x0ad6('0x4')]);router[_0x0ad6('0x2')](_0x0ad6('0x5'),auth[_0x0ad6('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x269b=['./system.controller','get','isAuthenticated','exports','express','../../components/auth/service'];(function(_0x3c4cc4,_0x10e3a0){var _0x44890a=function(_0x443a25){while(--_0x443a25){_0x3c4cc4['push'](_0x3c4cc4['shift']());}};_0x44890a(++_0x10e3a0);}(_0x269b,0x9a));var _0xb269=function(_0x362c1f,_0x4fccd9){_0x362c1f=_0x362c1f-0x0;var _0x32bd2a=_0x269b[_0x362c1f];return _0x32bd2a;};'use strict';var express=require(_0xb269('0x0'));var router=express['Router']();var auth=require(_0xb269('0x1'));var controller=require(_0xb269('0x2'));router[_0xb269('0x3')]('/',auth[_0xb269('0x4')](),controller['index']);router[_0xb269('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module[_0xb269('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 98c8be6..32c582e 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 _0x7d8a=['systeminformation','child_process','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x7d8a,0x1cb));var _0xa7d8=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x7d8a[_0x556bb1];return _0x45455f;};'use strict';var info=require(_0xa7d8('0x0'));var exec=require(_0xa7d8('0x1'))['exec'];var logger=require(_0xa7d8('0x2'))(_0xa7d8('0x3'));var util=require(_0xa7d8('0x4'));var BPromise=require(_0xa7d8('0x5'));var _=require('lodash');function handleError(_0x410c79,_0x519bd8,_0x36d976){_0x519bd8=_0x519bd8||0x1f4;return function(_0x16185e){logger['error'](_0xa7d8('0x6'),_0x36d976,_0x519bd8,util[_0xa7d8('0x7')](_0x16185e,{'showHidden':![],'depth':null}));delete _0x16185e[_0xa7d8('0x8')];_0x410c79[_0xa7d8('0x9')](_0x519bd8)[_0xa7d8('0xa')](_0x16185e);};}exports[_0xa7d8('0xb')]=function(_0x6dcf8c,_0x2ead14){return info[_0xa7d8('0xc')]()[_0xa7d8('0xd')](function(_0x1235f0){return _0x2ead14[_0xa7d8('0x9')](0xc8)[_0xa7d8('0xe')](_0x1235f0);})[_0xa7d8('0xf')](function(_0x505141){return _0x2ead14[_0xa7d8('0x9')](0x1f4)[_0xa7d8('0xe')](_0x505141);});};exports[_0xa7d8('0x10')]=function(_0x1e1d67,_0x40b063){var _0x4d4aa3=[_0xa7d8('0x11')];return new BPromise(function(_0x40af48,_0x227d27){return exec(util[_0xa7d8('0x12')](_0xa7d8('0x13'),_0x1e1d67[_0xa7d8('0x14')][_0xa7d8('0x15')]),function(_0x1d3934,_0x57aca6,_0x38ca48){if(_0x1d3934){return _0x227d27(_0x1d3934);}return _0x40af48(_0x57aca6);});})['then'](function(_0x4ec116){var _0x131737=![];var _0x3f2456=_0x4ec116['split'](/\n/);for(var _0x45c4f2=0x0,_0x295da2=_0x4d4aa3[_0xa7d8('0x16')];_0x45c4f2<_0x295da2,_0x131737===![];_0x45c4f2+=0x1){if(_0x4ec116[_0xa7d8('0x17')](_0x4d4aa3[_0x45c4f2])>=0x0){_0x131737=!![];}}if(!_0x131737){throw new Error(util['format'](_0xa7d8('0x18'),_0x1e1d67['params'][_0xa7d8('0x15')]));}process['kill'](_0x1e1d67[_0xa7d8('0x14')][_0xa7d8('0x15')],_0xa7d8('0x19'));return _0x40b063[_0xa7d8('0x9')](0xc8)['json']({'message':util[_0xa7d8('0x12')](_0xa7d8('0x1a'),_0x1e1d67[_0xa7d8('0x14')][_0xa7d8('0x15')])});})[_0xa7d8('0xf')](handleError(_0x40b063,null,_0xa7d8('0x10')));}; \ No newline at end of file +var _0xc962=['params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xc962,0x6d));var _0x2c96=function(_0x118600,_0x212743){_0x118600=_0x118600-0x0;var _0x8a1f53=_0xc962[_0x118600];return _0x8a1f53;};'use strict';var info=require(_0x2c96('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')(_0x2c96('0x1'));var util=require(_0x2c96('0x2'));var BPromise=require(_0x2c96('0x3'));var _=require(_0x2c96('0x4'));function handleError(_0x305702,_0x83568f,_0x451d99){_0x83568f=_0x83568f||0x1f4;return function(_0x11a936){logger['error'](_0x2c96('0x5'),_0x451d99,_0x83568f,util[_0x2c96('0x6')](_0x11a936,{'showHidden':![],'depth':null}));delete _0x11a936[_0x2c96('0x7')];_0x305702[_0x2c96('0x8')](_0x83568f)[_0x2c96('0x9')](_0x11a936);};}exports[_0x2c96('0xa')]=function(_0x1115b7,_0x6ebc03){return info[_0x2c96('0xb')]()['then'](function(_0x4860c3){return _0x6ebc03[_0x2c96('0x8')](0xc8)[_0x2c96('0xc')](_0x4860c3);})[_0x2c96('0xd')](function(_0x2fa105){return _0x6ebc03[_0x2c96('0x8')](0x1f4)[_0x2c96('0xc')](_0x2fa105);});};exports['killProcess']=function(_0x48e5a9,_0xfbe0bd){var _0x43d83f=[_0x2c96('0xe')];return new BPromise(function(_0x2491a4,_0x188e75){return exec(util[_0x2c96('0xf')](_0x2c96('0x10'),_0x48e5a9['params']['pid']),function(_0x4c1d9a,_0x1d955d,_0x442149){if(_0x4c1d9a){return _0x188e75(_0x4c1d9a);}return _0x2491a4(_0x1d955d);});})['then'](function(_0x35ad10){var _0x3903a7=![];var _0x54649f=_0x35ad10[_0x2c96('0x11')](/\n/);for(var _0x3232c0=0x0,_0x2b26b4=_0x43d83f[_0x2c96('0x12')];_0x3232c0<_0x2b26b4,_0x3903a7===![];_0x3232c0+=0x1){if(_0x35ad10[_0x2c96('0x13')](_0x43d83f[_0x3232c0])>=0x0){_0x3903a7=!![];}}if(!_0x3903a7){throw new Error(util[_0x2c96('0xf')](_0x2c96('0x14'),_0x48e5a9[_0x2c96('0x15')][_0x2c96('0x16')]));}process['kill'](_0x48e5a9['params'][_0x2c96('0x16')],_0x2c96('0x17'));return _0xfbe0bd[_0x2c96('0x8')](0xc8)['json']({'message':util[_0x2c96('0xf')](_0x2c96('0x18'),_0x48e5a9[_0x2c96('0x15')]['pid'])});})[_0x2c96('0xd')](handleError(_0xfbe0bd,null,_0x2c96('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8ef6904..2a01274 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 _0x9bde=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x3f2b13,_0x30d4d4){var _0x127fbe=function(_0x666362){while(--_0x666362){_0x3f2b13['push'](_0x3f2b13['shift']());}};_0x127fbe(++_0x30d4d4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x12fc28,_0x5d78bb){_0x12fc28=_0x12fc28-0x0;var _0x3666fa=_0x9bde[_0x12fc28];return _0x3666fa;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var auth=require(_0xe9bd('0x3'));var interaction=require(_0xe9bd('0x4'));var config=require(_0xe9bd('0x5'));var controller=require(_0xe9bd('0x6'));router[_0xe9bd('0x7')]('/',auth[_0xe9bd('0x8')](),controller['index']);router[_0xe9bd('0x7')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0xb')]('/',auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0xd')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller['update']);router['delete'](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x1c6c74,_0xc49acd){var _0x221b8b=function(_0x5402d9){while(--_0x5402d9){_0x1c6c74['push'](_0x1c6c74['shift']());}};_0x221b8b(++_0xc49acd);}(_0x750a,0x140));var _0xa750=function(_0x5411d6,_0x2fac44){_0x5411d6=_0x5411d6-0x0;var _0x1d7a86=_0x750a[_0x5411d6];return _0x1d7a86;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8dff26d..2cdd422 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(_0xf1aee,_0x591ef9){var _0x584328=function(_0xd6367f){while(--_0xd6367f){_0xf1aee['push'](_0xf1aee['shift']());}};_0x584328(++_0x591ef9);}(_0x878f,0x173));var _0xf878=function(_0x2f420a,_0x3302f5){_0x2f420a=_0x2f420a-0x0;var _0x324906=_0x878f[_0x2f420a];return _0x324906;};'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 _0x878f=['STRING','name','#0091EA','exports'];(function(_0x5c3b58,_0x5c737c){var _0x1c068e=function(_0x25ea68){while(--_0x25ea68){_0x5c3b58['push'](_0x5c3b58['shift']());}};_0x1c068e(++_0x5c737c);}(_0x878f,0x173));var _0xf878=function(_0x216e23,_0x564550){_0x216e23=_0x216e23-0x0;var _0xdabd94=_0x878f[_0x216e23];return _0xdabd94;};'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 diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 901a569..e68c4bb 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 _0x531d=['UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role'];(function(_0x18d3e5,_0x58eb9e){var _0x160fd7=function(_0x4aafd3){while(--_0x4aafd3){_0x18d3e5['push'](_0x18d3e5['shift']());}};_0x160fd7(++_0x58eb9e);}(_0x531d,0xa7));var _0xd531=function(_0x30d8f8,_0x2795eb){_0x30d8f8=_0x30d8f8-0x0;var _0x1d546e=_0x531d[_0x30d8f8];return _0x1d546e;};'use strict';var pdf=require(_0xd531('0x0'));var emlformat=require(_0xd531('0x1'));var rimraf=require(_0xd531('0x2'));var zipdir=require(_0xd531('0x3'));var jsonpatch=require(_0xd531('0x4'));var rp=require('request-promise');var moment=require(_0xd531('0x5'));var BPromise=require(_0xd531('0x6'));var Mustache=require(_0xd531('0x7'));var util=require(_0xd531('0x8'));var path=require(_0xd531('0x9'));var sox=require(_0xd531('0xa'));var csv=require(_0xd531('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd531('0xc'));var squel=require(_0xd531('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd531('0xe'));var toCsv=require(_0xd531('0xb'));var querystring=require(_0xd531('0xf'));var Papa=require(_0xd531('0x10'));var Redis=require(_0xd531('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd531('0x12'));var as=require(_0xd531('0x13'));var hardwareService=require(_0xd531('0x14'));var logger=require(_0xd531('0x15'))(_0xd531('0x16'));var utils=require('../../config/utils');var config=require(_0xd531('0x17'));var db=require(_0xd531('0x18'))['db'];function respondWithStatusCode(_0x2bd517,_0x55829c){_0x55829c=_0x55829c||0xcc;return function(_0x3b0715){if(_0x3b0715){return _0x2bd517[_0xd531('0x19')](_0x55829c);}return _0x2bd517[_0xd531('0x1a')](_0x55829c)[_0xd531('0x1b')]();};}function respondWithResult(_0x5000c1,_0x238fd0){_0x238fd0=_0x238fd0||0xc8;return function(_0x2b63a2){if(_0x2b63a2){return _0x5000c1[_0xd531('0x1a')](_0x238fd0)[_0xd531('0x1c')](_0x2b63a2);}};}function respondWithFilteredResult(_0x2ac6cc,_0x3683e4){return function(_0x3a5cba){if(_0x3a5cba){var _0x31b206=_0x3a5cba[_0xd531('0x1d')],_0x5ae199=_0x3683e4[_0xd531('0x1e')],_0x5a189e=_0x3683e4[_0xd531('0x1e')]+_0x3683e4[_0xd531('0x1f')],_0x4e92ff;if(_0x5a189e>=_0x31b206){_0x5a189e=_0x31b206;_0x4e92ff=0xc8;}else{_0x4e92ff=0xce;}_0x2ac6cc['status'](_0x4e92ff);return _0x2ac6cc['set'](_0xd531('0x20'),_0x5ae199+'-'+_0x5a189e+'/'+_0x31b206)['json'](_0x3a5cba);}return null;};}function patchUpdates(_0x384ede){return function(_0x3d7aea){try{jsonpatch[_0xd531('0x21')](_0x3d7aea,_0x384ede,!![]);}catch(_0x535093){return BPromise[_0xd531('0x22')](_0x535093);}return _0x3d7aea[_0xd531('0x23')]();};}function saveUpdates(_0x4cbd0e,_0x59f5fb){return function(_0x204b60){if(_0x204b60){return _0x204b60[_0xd531('0x24')](_0x4cbd0e)['then'](function(_0x12f595){return _0x12f595;});}return null;};}function removeEntity(_0x32dfe6,_0x2678bd){return function(_0x162d22){if(_0x162d22){return _0x162d22[_0xd531('0x25')]()[_0xd531('0x26')](function(){var _0x374a5d=_0x162d22[_0xd531('0x27')]({'plain':!![]});var _0x145188=_0xd531('0x28');return db[_0xd531('0x29')][_0xd531('0x25')]({'where':{'type':_0x145188,'resourceId':_0x374a5d['id']}})[_0xd531('0x26')](function(){return _0x162d22;});})['then'](function(){_0x32dfe6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x578d29,_0x3aa5ea){return function(_0x15e760){if(!_0x15e760){_0x578d29[_0xd531('0x19')](0x194);}return _0x15e760;};}function handleError(_0x41d741,_0x10c2be){_0x10c2be=_0x10c2be||0x1f4;return function(_0x424521){logger[_0xd531('0x2a')](_0x424521[_0xd531('0x2b')]);if(_0x424521[_0xd531('0x2c')]){delete _0x424521['name'];}_0x41d741[_0xd531('0x1a')](_0x10c2be)[_0xd531('0x2d')](_0x424521);};}exports['index']=function(_0x37ccb3,_0x57c1a0){var _0x63cc48={},_0x21aa70={},_0x3f7300={'count':0x0,'rows':[]};var _0xa60fa8=_[_0xd531('0x2e')](db[_0xd531('0x2f')][_0xd531('0x30')],function(_0x2cc708){return{'name':_0x2cc708[_0xd531('0x31')],'type':_0x2cc708['type']['key']};});_0x21aa70[_0xd531('0x32')]=_[_0xd531('0x2e')](_0xa60fa8,_0xd531('0x2c'));_0x21aa70[_0xd531('0x33')]=_[_0xd531('0x34')](_0x37ccb3[_0xd531('0x33')]);_0x21aa70[_0xd531('0x35')]=_[_0xd531('0x36')](_0x21aa70['model'],_0x21aa70[_0xd531('0x33')]);_0x63cc48[_0xd531('0x37')]=_[_0xd531('0x36')](_0x21aa70[_0xd531('0x32')],qs[_0xd531('0x38')](_0x37ccb3[_0xd531('0x33')][_0xd531('0x38')]));_0x63cc48[_0xd531('0x37')]=_0x63cc48['attributes'][_0xd531('0x39')]?_0x63cc48[_0xd531('0x37')]:_0x21aa70[_0xd531('0x32')];if(!_0x37ccb3[_0xd531('0x33')]['hasOwnProperty'](_0xd531('0x3a'))){_0x63cc48['limit']=qs[_0xd531('0x1f')](_0x37ccb3[_0xd531('0x33')][_0xd531('0x1f')]);_0x63cc48[_0xd531('0x1e')]=qs[_0xd531('0x1e')](_0x37ccb3[_0xd531('0x33')][_0xd531('0x1e')]);}_0x63cc48[_0xd531('0x3b')]=qs[_0xd531('0x3c')](_0x37ccb3[_0xd531('0x33')][_0xd531('0x3c')]);_0x63cc48[_0xd531('0x3d')]=qs['filters'](_[_0xd531('0x3e')](_0x37ccb3[_0xd531('0x33')],_0x21aa70['filters']),_0xa60fa8);if(_0x37ccb3[_0xd531('0x33')][_0xd531('0x3f')]){_0x63cc48[_0xd531('0x3d')]=_[_0xd531('0x40')](_0x63cc48[_0xd531('0x3d')],{'$or':_[_0xd531('0x2e')](_0xa60fa8,function(_0x932f1d){if(_0x932f1d[_0xd531('0x41')]!==_0xd531('0x42')){var _0x32ba50={};_0x32ba50[_0x932f1d[_0xd531('0x2c')]]={'$like':'%'+_0x37ccb3[_0xd531('0x33')][_0xd531('0x3f')]+'%'};return _0x32ba50;}})});}_0x63cc48=_['merge']({},_0x63cc48,_0x37ccb3[_0xd531('0x43')]);var _0x131230={'where':_0x63cc48[_0xd531('0x3d')]};return db[_0xd531('0x2f')][_0xd531('0x1d')](_0x131230)['then'](function(_0x4c7db0){_0x3f7300[_0xd531('0x1d')]=_0x4c7db0;if(_0x37ccb3[_0xd531('0x33')][_0xd531('0x44')]){_0x63cc48[_0xd531('0x45')]=[{'all':!![]}];}return db[_0xd531('0x2f')]['findAll'](_0x63cc48);})[_0xd531('0x26')](function(_0x2f128f){_0x3f7300[_0xd531('0x46')]=_0x2f128f;return _0x3f7300;})[_0xd531('0x26')](respondWithFilteredResult(_0x57c1a0,_0x63cc48))[_0xd531('0x47')](handleError(_0x57c1a0,null));};exports[_0xd531('0x48')]=function(_0x4a32c6,_0x3c5838){var _0x14cd0e={'raw':!![],'where':{'id':_0x4a32c6[_0xd531('0x49')]['id']}},_0x15c782={};_0x15c782[_0xd531('0x32')]=_['keys'](db[_0xd531('0x2f')][_0xd531('0x30')]);_0x15c782[_0xd531('0x33')]=_['keys'](_0x4a32c6[_0xd531('0x33')]);_0x15c782[_0xd531('0x35')]=_[_0xd531('0x36')](_0x15c782['model'],_0x15c782[_0xd531('0x33')]);_0x14cd0e['attributes']=_[_0xd531('0x36')](_0x15c782['model'],qs[_0xd531('0x38')](_0x4a32c6[_0xd531('0x33')][_0xd531('0x38')]));_0x14cd0e[_0xd531('0x37')]=_0x14cd0e[_0xd531('0x37')][_0xd531('0x39')]?_0x14cd0e['attributes']:_0x15c782[_0xd531('0x32')];if(_0x4a32c6[_0xd531('0x33')][_0xd531('0x44')]){_0x14cd0e[_0xd531('0x45')]=[{'all':!![]}];}_0x14cd0e=_[_0xd531('0x40')]({},_0x14cd0e,_0x4a32c6[_0xd531('0x43')]);return db[_0xd531('0x2f')][_0xd531('0x4a')](_0x14cd0e)['then'](handleEntityNotFound(_0x3c5838,null))[_0xd531('0x26')](respondWithResult(_0x3c5838,null))[_0xd531('0x47')](handleError(_0x3c5838,null));};exports[_0xd531('0x4b')]=function(_0x5b4e23,_0xf5325f){return db[_0xd531('0x2f')][_0xd531('0x4b')](_0x5b4e23[_0xd531('0x4c')],{})[_0xd531('0x26')](function(_0x5d6d4d){var _0x3a4df9=_0x5b4e23[_0xd531('0x4d')][_0xd531('0x27')]({'plain':!![]});if(!_0x3a4df9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a4df9[_0xd531('0x4e')]==='user'){var _0x438407=_0x5d6d4d['get']({'plain':!![]});var _0x35ac0d=_0xd531('0x28');return db[_0xd531('0x4f')][_0xd531('0x4a')]({'where':{'name':_0x35ac0d,'userProfileId':_0x3a4df9[_0xd531('0x50')]},'raw':!![]})[_0xd531('0x26')](function(_0x39412f){if(_0x39412f&&_0x39412f[_0xd531('0x51')]===0x0){return db[_0xd531('0x29')]['create']({'name':_0x438407['name'],'resourceId':_0x438407['id'],'type':_0x39412f[_0xd531('0x2c')],'sectionId':_0x39412f['id']},{})[_0xd531('0x26')](function(){return _0x5d6d4d;});}else{return _0x5d6d4d;}})[_0xd531('0x47')](function(_0xbcee4d){logger[_0xd531('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbcee4d);throw _0xbcee4d;});}return _0x5d6d4d;})['then'](respondWithResult(_0xf5325f,0xc9))[_0xd531('0x47')](handleError(_0xf5325f,null));};exports[_0xd531('0x24')]=function(_0x20d4d0,_0x233d1e){if(_0x20d4d0['body']['id']){delete _0x20d4d0[_0xd531('0x4c')]['id'];}return db[_0xd531('0x2f')][_0xd531('0x4a')]({'where':{'id':_0x20d4d0[_0xd531('0x49')]['id']}})[_0xd531('0x26')](handleEntityNotFound(_0x233d1e,null))[_0xd531('0x26')](saveUpdates(_0x20d4d0[_0xd531('0x4c')],null))[_0xd531('0x26')](respondWithResult(_0x233d1e,null))[_0xd531('0x47')](handleError(_0x233d1e,null));};exports[_0xd531('0x25')]=function(_0x5a11e1,_0x1f1f03){return db['Tag']['find']({'where':{'id':_0x5a11e1[_0xd531('0x49')]['id']}})[_0xd531('0x26')](handleEntityNotFound(_0x1f1f03,null))[_0xd531('0x26')](removeEntity(_0x1f1f03,null))[_0xd531('0x47')](handleError(_0x1f1f03,null));}; \ No newline at end of file +var _0x7d57=['where','type','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter'];(function(_0x1fef5a,_0x3a2b7f){var _0x19a90a=function(_0x37b722){while(--_0x37b722){_0x1fef5a['push'](_0x1fef5a['shift']());}};_0x19a90a(++_0x3a2b7f);}(_0x7d57,0xfe));var _0x77d5=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0x7d57[_0x33d4a2];return _0x2c793f;};'use strict';var pdf=require(_0x77d5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x77d5('0x1'));var jsonpatch=require(_0x77d5('0x2'));var rp=require(_0x77d5('0x3'));var moment=require(_0x77d5('0x4'));var BPromise=require(_0x77d5('0x5'));var Mustache=require('mustache');var util=require(_0x77d5('0x6'));var path=require(_0x77d5('0x7'));var sox=require(_0x77d5('0x8'));var csv=require(_0x77d5('0x9'));var ejs=require(_0x77d5('0xa'));var fs=require('fs');var _=require(_0x77d5('0xb'));var squel=require(_0x77d5('0xc'));var crypto=require(_0x77d5('0xd'));var jsforce=require(_0x77d5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x77d5('0x9'));var querystring=require(_0x77d5('0xf'));var Papa=require(_0x77d5('0x10'));var Redis=require(_0x77d5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x77d5('0x12'));var hardwareService=require(_0x77d5('0x13'));var logger=require(_0x77d5('0x14'))(_0x77d5('0x15'));var utils=require(_0x77d5('0x16'));var config=require(_0x77d5('0x17'));var db=require(_0x77d5('0x18'))['db'];function respondWithStatusCode(_0x2844a4,_0x31b68a){_0x31b68a=_0x31b68a||0xcc;return function(_0x153261){if(_0x153261){return _0x2844a4[_0x77d5('0x19')](_0x31b68a);}return _0x2844a4['status'](_0x31b68a)[_0x77d5('0x1a')]();};}function respondWithResult(_0x241a18,_0x450f09){_0x450f09=_0x450f09||0xc8;return function(_0x16b0ce){if(_0x16b0ce){return _0x241a18[_0x77d5('0x1b')](_0x450f09)[_0x77d5('0x1c')](_0x16b0ce);}};}function respondWithFilteredResult(_0x22bebf,_0x54ad9d){return function(_0x47fd62){if(_0x47fd62){var _0x2f64e8=_0x47fd62[_0x77d5('0x1d')],_0x1d0a1c=_0x54ad9d[_0x77d5('0x1e')],_0x139d6b=_0x54ad9d[_0x77d5('0x1e')]+_0x54ad9d[_0x77d5('0x1f')],_0x3427b4;if(_0x139d6b>=_0x2f64e8){_0x139d6b=_0x2f64e8;_0x3427b4=0xc8;}else{_0x3427b4=0xce;}_0x22bebf['status'](_0x3427b4);return _0x22bebf[_0x77d5('0x20')](_0x77d5('0x21'),_0x1d0a1c+'-'+_0x139d6b+'/'+_0x2f64e8)[_0x77d5('0x1c')](_0x47fd62);}return null;};}function patchUpdates(_0x51e8bc){return function(_0x3ee2e4){try{jsonpatch[_0x77d5('0x22')](_0x3ee2e4,_0x51e8bc,!![]);}catch(_0x133269){return BPromise['reject'](_0x133269);}return _0x3ee2e4[_0x77d5('0x23')]();};}function saveUpdates(_0x3aec74,_0x93958b){return function(_0x312678){if(_0x312678){return _0x312678[_0x77d5('0x24')](_0x3aec74)[_0x77d5('0x25')](function(_0x58380f){return _0x58380f;});}return null;};}function removeEntity(_0x13e68e,_0x19ffb2){return function(_0x58e894){if(_0x58e894){return _0x58e894['destroy']()[_0x77d5('0x25')](function(){var _0x2aa49a=_0x58e894[_0x77d5('0x26')]({'plain':!![]});var _0x38cd25=_0x77d5('0x27');return db[_0x77d5('0x28')][_0x77d5('0x29')]({'where':{'type':_0x38cd25,'resourceId':_0x2aa49a['id']}})['then'](function(){return _0x58e894;});})['then'](function(){_0x13e68e[_0x77d5('0x1b')](0xcc)[_0x77d5('0x1a')]();});}};}function handleEntityNotFound(_0x11dda6,_0x4ec99c){return function(_0x5f2e9d){if(!_0x5f2e9d){_0x11dda6[_0x77d5('0x19')](0x194);}return _0x5f2e9d;};}function handleError(_0x4b80a7,_0x5dbea9){_0x5dbea9=_0x5dbea9||0x1f4;return function(_0x1239f8){logger[_0x77d5('0x2a')](_0x1239f8[_0x77d5('0x2b')]);if(_0x1239f8[_0x77d5('0x2c')]){delete _0x1239f8[_0x77d5('0x2c')];}_0x4b80a7['status'](_0x5dbea9)[_0x77d5('0x2d')](_0x1239f8);};}exports['index']=function(_0x2e9682,_0x23ee33){var _0x1f27dd={},_0x25071f={},_0x3f100f={'count':0x0,'rows':[]};var _0x3a5f55=_[_0x77d5('0x2e')](db[_0x77d5('0x2f')][_0x77d5('0x30')],function(_0xbf1a3f){return{'name':_0xbf1a3f[_0x77d5('0x31')],'type':_0xbf1a3f['type'][_0x77d5('0x32')]};});_0x25071f[_0x77d5('0x33')]=_[_0x77d5('0x2e')](_0x3a5f55,_0x77d5('0x2c'));_0x25071f[_0x77d5('0x34')]=_[_0x77d5('0x35')](_0x2e9682['query']);_0x25071f[_0x77d5('0x36')]=_[_0x77d5('0x37')](_0x25071f['model'],_0x25071f[_0x77d5('0x34')]);_0x1f27dd[_0x77d5('0x38')]=_['intersection'](_0x25071f[_0x77d5('0x33')],qs[_0x77d5('0x39')](_0x2e9682[_0x77d5('0x34')][_0x77d5('0x39')]));_0x1f27dd[_0x77d5('0x38')]=_0x1f27dd[_0x77d5('0x38')][_0x77d5('0x3a')]?_0x1f27dd[_0x77d5('0x38')]:_0x25071f['model'];if(!_0x2e9682[_0x77d5('0x34')]['hasOwnProperty']('nolimit')){_0x1f27dd[_0x77d5('0x1f')]=qs[_0x77d5('0x1f')](_0x2e9682[_0x77d5('0x34')][_0x77d5('0x1f')]);_0x1f27dd[_0x77d5('0x1e')]=qs[_0x77d5('0x1e')](_0x2e9682[_0x77d5('0x34')]['offset']);}_0x1f27dd['order']=qs['sort'](_0x2e9682[_0x77d5('0x34')][_0x77d5('0x3b')]);_0x1f27dd['where']=qs['filters'](_[_0x77d5('0x3c')](_0x2e9682[_0x77d5('0x34')],_0x25071f[_0x77d5('0x36')]),_0x3a5f55);if(_0x2e9682[_0x77d5('0x34')][_0x77d5('0x3d')]){_0x1f27dd[_0x77d5('0x3e')]=_['merge'](_0x1f27dd[_0x77d5('0x3e')],{'$or':_['map'](_0x3a5f55,function(_0x127b17){if(_0x127b17[_0x77d5('0x3f')]!=='VIRTUAL'){var _0x439289={};_0x439289[_0x127b17['name']]={'$like':'%'+_0x2e9682[_0x77d5('0x34')]['filter']+'%'};return _0x439289;}})});}_0x1f27dd=_[_0x77d5('0x40')]({},_0x1f27dd,_0x2e9682['options']);var _0x37fb89={'where':_0x1f27dd[_0x77d5('0x3e')]};return db['Tag'][_0x77d5('0x1d')](_0x37fb89)[_0x77d5('0x25')](function(_0x40cd68){_0x3f100f[_0x77d5('0x1d')]=_0x40cd68;if(_0x2e9682[_0x77d5('0x34')][_0x77d5('0x41')]){_0x1f27dd[_0x77d5('0x42')]=[{'all':!![]}];}return db[_0x77d5('0x2f')][_0x77d5('0x43')](_0x1f27dd);})[_0x77d5('0x25')](function(_0x92e6c0){_0x3f100f[_0x77d5('0x44')]=_0x92e6c0;return _0x3f100f;})[_0x77d5('0x25')](respondWithFilteredResult(_0x23ee33,_0x1f27dd))[_0x77d5('0x45')](handleError(_0x23ee33,null));};exports[_0x77d5('0x46')]=function(_0x185581,_0x53f41e){var _0x2a6082={'raw':!![],'where':{'id':_0x185581[_0x77d5('0x47')]['id']}},_0x545a4b={};_0x545a4b[_0x77d5('0x33')]=_[_0x77d5('0x35')](db['Tag']['rawAttributes']);_0x545a4b[_0x77d5('0x34')]=_[_0x77d5('0x35')](_0x185581[_0x77d5('0x34')]);_0x545a4b[_0x77d5('0x36')]=_['intersection'](_0x545a4b[_0x77d5('0x33')],_0x545a4b[_0x77d5('0x34')]);_0x2a6082[_0x77d5('0x38')]=_['intersection'](_0x545a4b[_0x77d5('0x33')],qs['fields'](_0x185581['query']['fields']));_0x2a6082['attributes']=_0x2a6082[_0x77d5('0x38')]['length']?_0x2a6082[_0x77d5('0x38')]:_0x545a4b['model'];if(_0x185581[_0x77d5('0x34')]['includeAll']){_0x2a6082[_0x77d5('0x42')]=[{'all':!![]}];}_0x2a6082=_[_0x77d5('0x40')]({},_0x2a6082,_0x185581[_0x77d5('0x48')]);return db[_0x77d5('0x2f')]['find'](_0x2a6082)[_0x77d5('0x25')](handleEntityNotFound(_0x53f41e,null))['then'](respondWithResult(_0x53f41e,null))[_0x77d5('0x45')](handleError(_0x53f41e,null));};exports['create']=function(_0x1f62d3,_0x4b4728){return db[_0x77d5('0x2f')][_0x77d5('0x49')](_0x1f62d3[_0x77d5('0x4a')],{})[_0x77d5('0x25')](function(_0x54310f){var _0x2124f7=_0x1f62d3[_0x77d5('0x4b')][_0x77d5('0x26')]({'plain':!![]});if(!_0x2124f7)throw new Error(_0x77d5('0x4c'));if(_0x2124f7['role']===_0x77d5('0x4b')){var _0x3f408d=_0x54310f[_0x77d5('0x26')]({'plain':!![]});var _0x4767ba=_0x77d5('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4767ba,'userProfileId':_0x2124f7[_0x77d5('0x4d')]},'raw':!![]})['then'](function(_0x5c6e0a){if(_0x5c6e0a&&_0x5c6e0a['autoAssociation']===0x0){return db[_0x77d5('0x28')][_0x77d5('0x49')]({'name':_0x3f408d[_0x77d5('0x2c')],'resourceId':_0x3f408d['id'],'type':_0x5c6e0a[_0x77d5('0x2c')],'sectionId':_0x5c6e0a['id']},{})[_0x77d5('0x25')](function(){return _0x54310f;});}else{return _0x54310f;}})[_0x77d5('0x45')](function(_0x5cdf99){logger[_0x77d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cdf99);throw _0x5cdf99;});}return _0x54310f;})[_0x77d5('0x25')](respondWithResult(_0x4b4728,0xc9))[_0x77d5('0x45')](handleError(_0x4b4728,null));};exports[_0x77d5('0x24')]=function(_0x352738,_0x10cb4f){if(_0x352738[_0x77d5('0x4a')]['id']){delete _0x352738['body']['id'];}return db[_0x77d5('0x2f')][_0x77d5('0x4e')]({'where':{'id':_0x352738[_0x77d5('0x47')]['id']}})[_0x77d5('0x25')](handleEntityNotFound(_0x10cb4f,null))[_0x77d5('0x25')](saveUpdates(_0x352738[_0x77d5('0x4a')],null))[_0x77d5('0x25')](respondWithResult(_0x10cb4f,null))[_0x77d5('0x45')](handleError(_0x10cb4f,null));};exports[_0x77d5('0x29')]=function(_0x3f5359,_0x2ec73c){return db['Tag'][_0x77d5('0x4e')]({'where':{'id':_0x3f5359['params']['id']}})[_0x77d5('0x25')](handleEntityNotFound(_0x2ec73c,null))[_0x77d5('0x25')](removeEntity(_0x2ec73c,null))[_0x77d5('0x45')](handleError(_0x2ec73c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1b1cb18..f1f9813 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 _0x1fde=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','Tag','tools_tags','lodash'];(function(_0x1b2df2,_0x27ac74){var _0x944445=function(_0x3e793b){while(--_0x3e793b){_0x1b2df2['push'](_0x1b2df2['shift']());}};_0x944445(++_0x27ac74);}(_0x1fde,0xf9));var _0xe1fd=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x1fde[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xe1fd('0x0'));var util=require(_0xe1fd('0x1'));var logger=require(_0xe1fd('0x2'))(_0xe1fd('0x3'));var moment=require(_0xe1fd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1fd('0x5'));var rimraf=require(_0xe1fd('0x6'));var config=require(_0xe1fd('0x7'));var attributes=require('./tag.attributes');module['exports']=function(_0x708b55,_0x252764){return _0x708b55['define'](_0xe1fd('0x8'),attributes,{'tableName':_0xe1fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa9=['request-promise','path','rimraf','./tag.attributes','Tag','lodash','util','api','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3aa9,0x145));var _0x93aa=function(_0x162093,_0x560f82){_0x162093=_0x162093-0x0;var _0x1a2e54=_0x3aa9[_0x162093];return _0x1a2e54;};'use strict';var _=require(_0x93aa('0x0'));var util=require(_0x93aa('0x1'));var logger=require('../../config/logger')(_0x93aa('0x2'));var moment=require(_0x93aa('0x3'));var BPromise=require(_0x93aa('0x4'));var rp=require(_0x93aa('0x5'));var fs=require('fs');var path=require(_0x93aa('0x6'));var rimraf=require(_0x93aa('0x7'));var config=require('../../config/environment');var attributes=require(_0x93aa('0x8'));module['exports']=function(_0x2074e3,_0x5324b1){return _0x2074e3['define'](_0x93aa('0x9'),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 a42545e..e7c6b75 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 _0x4e81=['Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c6a07,_0x2dcad3){var _0x448029=function(_0x322959){while(--_0x322959){_0x3c6a07['push'](_0x3c6a07['shift']());}};_0x448029(++_0x2dcad3);}(_0x4e81,0x1bc));var _0x14e8=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x4e81[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('Tag,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});} \ No newline at end of file +var _0x0713=['Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x56e791,_0x3976d5){var _0x398398=function(_0x3d1eb2){while(--_0x3d1eb2){_0x56e791['push'](_0x56e791['shift']());}};_0x398398(++_0x3976d5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Tag,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Tag,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Tag,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 095a253..c1fe28c 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 _0x944d=['post','addQueues','addAgents','put','delete','destroy','/:id/queues','removeAgents','exports','util','path','express','../../components/interaction/service','../../config/environment','./team.controller','index','get','/:id','isAuthenticated','show','/:id/users','getAgents','create'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x944d,0xd8));var _0xd944=function(_0x360097,_0x14092f){_0x360097=_0x360097-0x0;var _0x31f384=_0x944d[_0x360097];return _0x31f384;};'use strict';var multer=require('multer');var util=require(_0xd944('0x0'));var path=require(_0xd944('0x1'));var timeout=require('connect-timeout');var express=require(_0xd944('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd944('0x3'));var config=require(_0xd944('0x4'));var controller=require(_0xd944('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd944('0x6')]);router[_0xd944('0x7')](_0xd944('0x8'),auth[_0xd944('0x9')](),controller[_0xd944('0xa')]);router[_0xd944('0x7')]('/:id/queues',auth[_0xd944('0x9')](),controller['getQueues']);router[_0xd944('0x7')](_0xd944('0xb'),auth[_0xd944('0x9')](),controller[_0xd944('0xc')]);router['post']('/',auth[_0xd944('0x9')](),controller[_0xd944('0xd')]);router[_0xd944('0xe')]('/:id/queues',auth['isAuthenticated'](),controller[_0xd944('0xf')]);router[_0xd944('0xe')](_0xd944('0xb'),auth[_0xd944('0x9')](),controller[_0xd944('0x10')]);router[_0xd944('0x11')](_0xd944('0x8'),auth[_0xd944('0x9')](),controller['update']);router[_0xd944('0x12')]('/:id',auth[_0xd944('0x9')](),controller[_0xd944('0x13')]);router[_0xd944('0x12')](_0xd944('0x14'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xd944('0x12')]('/:id/users',auth[_0xd944('0x9')](),controller[_0xd944('0x15')]);module[_0xd944('0x16')]=router; \ No newline at end of file +var _0x2c0d=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','getAgents','post','/:id/queues','addQueues','addAgents','put','update','delete','destroy','removeQueues','/:id/users','removeAgents','exports','util'];(function(_0x54e9eb,_0x4462b6){var _0x1f5f74=function(_0x2972cb){while(--_0x2972cb){_0x54e9eb['push'](_0x54e9eb['shift']());}};_0x1f5f74(++_0x4462b6);}(_0x2c0d,0x19f));var _0xd2c0=function(_0x357fdf,_0x5349e6){_0x357fdf=_0x357fdf-0x0;var _0x28de14=_0x2c0d[_0x357fdf];return _0x28de14;};'use strict';var multer=require('multer');var util=require(_0xd2c0('0x0'));var path=require(_0xd2c0('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2c0('0x2'));var router=express[_0xd2c0('0x3')]();var auth=require(_0xd2c0('0x4'));var interaction=require(_0xd2c0('0x5'));var config=require(_0xd2c0('0x6'));var controller=require(_0xd2c0('0x7'));router[_0xd2c0('0x8')]('/',auth[_0xd2c0('0x9')](),controller[_0xd2c0('0xa')]);router['get'](_0xd2c0('0xb'),auth[_0xd2c0('0x9')](),controller[_0xd2c0('0xc')]);router[_0xd2c0('0x8')]('/:id/queues',auth[_0xd2c0('0x9')](),controller['getQueues']);router[_0xd2c0('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xd2c0('0xd')]);router[_0xd2c0('0xe')]('/',auth[_0xd2c0('0x9')](),controller['create']);router[_0xd2c0('0xe')](_0xd2c0('0xf'),auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x10')]);router[_0xd2c0('0xe')]('/:id/users',auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x11')]);router[_0xd2c0('0x12')](_0xd2c0('0xb'),auth['isAuthenticated'](),controller[_0xd2c0('0x13')]);router[_0xd2c0('0x14')](_0xd2c0('0xb'),auth['isAuthenticated'](),controller[_0xd2c0('0x15')]);router[_0xd2c0('0x14')](_0xd2c0('0xf'),auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x16')]);router['delete'](_0xd2c0('0x17'),auth[_0xd2c0('0x9')](),controller[_0xd2c0('0x18')]);module[_0xd2c0('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e4ed502..11884a1 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 _0x4d64=['STRING','sequelize','exports'];(function(_0x5a6a56,_0xdc5f5){var _0x38547f=function(_0xcc08f1){while(--_0xcc08f1){_0x5a6a56['push'](_0x5a6a56['shift']());}};_0x38547f(++_0xdc5f5);}(_0x4d64,0x13f));var _0x44d6=function(_0x1034f4,_0x11c67f){_0x1034f4=_0x1034f4-0x0;var _0xc4c71d=_0x4d64[_0x1034f4];return _0xc4c71d;};'use strict';var Sequelize=require(_0x44d6('0x0'));module[_0x44d6('0x1')]={'name':{'type':Sequelize[_0x44d6('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91a3=['sequelize','exports','STRING','name'];(function(_0x4c3640,_0x4334f0){var _0xe40692=function(_0x2fbf8d){while(--_0x2fbf8d){_0x4c3640['push'](_0x4c3640['shift']());}};_0xe40692(++_0x4334f0);}(_0x91a3,0x160));var _0x391a=function(_0x383f28,_0x415f11){_0x383f28=_0x383f28-0x0;var _0x56b1f8=_0x91a3[_0x383f28];return _0x56b1f8;};'use strict';var Sequelize=require(_0x391a('0x0'));module[_0x391a('0x1')]={'name':{'type':Sequelize[_0x391a('0x2')],'allowNull':![],'unique':_0x391a('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a567db1..bdc4ff8 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 _0x1c59=['capitalize','Queue','toLowerCase','Queues','findOne','remove','Voice','Chat','Mail','Fax','Openchannel','each','addAgents','ids','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','sms','fax','openchannel','voice','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','socket.io-emitter','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','Teams','destroy','error','stack','name','send','map','Team','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel'];(function(_0x577369,_0x3933e9){var _0x274239=function(_0x2fe33f){while(--_0x2fe33f){_0x577369['push'](_0x577369['shift']());}};_0x274239(++_0x3933e9);}(_0x1c59,0x18e));var _0x91c5=function(_0x4fec16,_0x308856){_0x4fec16=_0x4fec16-0x0;var _0x17bd45=_0x1c59[_0x4fec16];return _0x17bd45;};'use strict';var pdf=require(_0x91c5('0x0'));var emlformat=require(_0x91c5('0x1'));var rimraf=require(_0x91c5('0x2'));var zipdir=require(_0x91c5('0x3'));var jsonpatch=require(_0x91c5('0x4'));var rp=require(_0x91c5('0x5'));var moment=require('moment');var BPromise=require(_0x91c5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x91c5('0x7'));var csv=require('to-csv');var ejs=require(_0x91c5('0x8'));var fs=require('fs');var _=require(_0x91c5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91c5('0xa'));var deskjs=require(_0x91c5('0xb'));var toCsv=require(_0x91c5('0xc'));var querystring=require('querystring');var Papa=require(_0x91c5('0xd'));var Redis=require(_0x91c5('0xe'));var authService=require(_0x91c5('0xf'));var qs=require(_0x91c5('0x10'));var as=require(_0x91c5('0x11'));var hardwareService=require(_0x91c5('0x12'));var logger=require('../../config/logger')(_0x91c5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x91c5('0x14'))['db'];config[_0x91c5('0x15')]=_['defaults'](config[_0x91c5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x91c5('0x16'))(new Redis(config[_0x91c5('0x15')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x6ca300,_0x248fc5){_0x248fc5=_0x248fc5||0xcc;return function(_0x36e3c6){if(_0x36e3c6){return _0x6ca300[_0x91c5('0x17')](_0x248fc5);}return _0x6ca300['status'](_0x248fc5)[_0x91c5('0x18')]();};}function respondWithResult(_0x185e53,_0x25c005){_0x25c005=_0x25c005||0xc8;return function(_0x25aaa6){if(_0x25aaa6){return _0x185e53[_0x91c5('0x19')](_0x25c005)['json'](_0x25aaa6);}};}function respondWithFilteredResult(_0x1585e0,_0x52614c){return function(_0x5c3a16){if(_0x5c3a16){var _0x415473=_0x5c3a16['count'],_0x4fe7c9=_0x52614c[_0x91c5('0x1a')],_0x3aaae8=_0x52614c[_0x91c5('0x1a')]+_0x52614c[_0x91c5('0x1b')],_0x48967e;if(_0x3aaae8>=_0x415473){_0x3aaae8=_0x415473;_0x48967e=0xc8;}else{_0x48967e=0xce;}_0x1585e0[_0x91c5('0x19')](_0x48967e);return _0x1585e0[_0x91c5('0x1c')](_0x91c5('0x1d'),_0x4fe7c9+'-'+_0x3aaae8+'/'+_0x415473)[_0x91c5('0x1e')](_0x5c3a16);}return null;};}function patchUpdates(_0x1ec95a){return function(_0x3ca84e){try{jsonpatch[_0x91c5('0x1f')](_0x3ca84e,_0x1ec95a,!![]);}catch(_0x5811c8){return BPromise[_0x91c5('0x20')](_0x5811c8);}return _0x3ca84e[_0x91c5('0x21')]();};}function saveUpdates(_0x3fa581,_0x455f21){return function(_0x3e3961){if(_0x3e3961){return _0x3e3961[_0x91c5('0x22')](_0x3fa581)[_0x91c5('0x23')](function(_0x2f01b8){return _0x2f01b8;});}return null;};}function removeEntity(_0x21f5f7,_0x6b92b4){return function(_0x46ec92){if(_0x46ec92){return _0x46ec92['destroy']()[_0x91c5('0x23')](function(){var _0x107507=_0x46ec92['get']({'plain':!![]});var _0x5aab55=_0x91c5('0x24');return db['UserProfileResource'][_0x91c5('0x25')]({'where':{'type':_0x5aab55,'resourceId':_0x107507['id']}})['then'](function(){return _0x46ec92;});})[_0x91c5('0x23')](function(){_0x21f5f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1977aa,_0x52b77f){return function(_0x9923f8){if(!_0x9923f8){_0x1977aa[_0x91c5('0x17')](0x194);}return _0x9923f8;};}function handleError(_0x154fe9,_0x337467){_0x337467=_0x337467||0x1f4;return function(_0xa6c4a1){logger[_0x91c5('0x26')](_0xa6c4a1[_0x91c5('0x27')]);if(_0xa6c4a1[_0x91c5('0x28')]){delete _0xa6c4a1['name'];}_0x154fe9[_0x91c5('0x19')](_0x337467)[_0x91c5('0x29')](_0xa6c4a1);};}exports['index']=function(_0x25b288,_0x25ef4f){var _0x2e5127={},_0x2ebd63={},_0x121dc3={'count':0x0,'rows':[]};var _0x2023c1=_[_0x91c5('0x2a')](db[_0x91c5('0x2b')][_0x91c5('0x2c')],function(_0x5e65b5){return{'name':_0x5e65b5[_0x91c5('0x2d')],'type':_0x5e65b5[_0x91c5('0x2e')][_0x91c5('0x2f')]};});_0x2ebd63['model']=_[_0x91c5('0x2a')](_0x2023c1,_0x91c5('0x28'));_0x2ebd63[_0x91c5('0x30')]=_['keys'](_0x25b288[_0x91c5('0x30')]);_0x2ebd63[_0x91c5('0x31')]=_[_0x91c5('0x32')](_0x2ebd63['model'],_0x2ebd63[_0x91c5('0x30')]);_0x2e5127[_0x91c5('0x33')]=_[_0x91c5('0x32')](_0x2ebd63['model'],qs[_0x91c5('0x34')](_0x25b288['query'][_0x91c5('0x34')]));_0x2e5127[_0x91c5('0x33')]=_0x2e5127['attributes'][_0x91c5('0x35')]?_0x2e5127[_0x91c5('0x33')]:_0x2ebd63[_0x91c5('0x36')];if(!_0x25b288[_0x91c5('0x30')][_0x91c5('0x37')](_0x91c5('0x38'))){_0x2e5127[_0x91c5('0x1b')]=qs['limit'](_0x25b288[_0x91c5('0x30')][_0x91c5('0x1b')]);_0x2e5127[_0x91c5('0x1a')]=qs['offset'](_0x25b288[_0x91c5('0x30')][_0x91c5('0x1a')]);}_0x2e5127[_0x91c5('0x39')]=qs[_0x91c5('0x3a')](_0x25b288['query'][_0x91c5('0x3a')]);_0x2e5127['where']=qs[_0x91c5('0x31')](_[_0x91c5('0x3b')](_0x25b288['query'],_0x2ebd63['filters']),_0x2023c1);if(_0x25b288[_0x91c5('0x30')]['filter']){_0x2e5127[_0x91c5('0x3c')]=_[_0x91c5('0x3d')](_0x2e5127['where'],{'$or':_[_0x91c5('0x2a')](_0x2023c1,function(_0x5a1600){if(_0x5a1600[_0x91c5('0x2e')]!==_0x91c5('0x3e')){var _0x16362a={};_0x16362a[_0x5a1600[_0x91c5('0x28')]]={'$like':'%'+_0x25b288['query'][_0x91c5('0x3f')]+'%'};return _0x16362a;}})});}_0x2e5127=_[_0x91c5('0x3d')]({},_0x2e5127,_0x25b288[_0x91c5('0x40')]);var _0x19afba={'where':_0x2e5127[_0x91c5('0x3c')]};return db['Team'][_0x91c5('0x41')](_0x19afba)[_0x91c5('0x23')](function(_0x4bec2f){_0x121dc3[_0x91c5('0x41')]=_0x4bec2f;if(_0x25b288[_0x91c5('0x30')][_0x91c5('0x42')]){_0x2e5127[_0x91c5('0x43')]=[{'all':!![]}];}return db[_0x91c5('0x2b')][_0x91c5('0x44')](_0x2e5127);})['then'](function(_0x5da491){_0x121dc3[_0x91c5('0x45')]=_0x5da491;return _0x121dc3;})[_0x91c5('0x23')](respondWithFilteredResult(_0x25ef4f,_0x2e5127))[_0x91c5('0x46')](handleError(_0x25ef4f,null));};exports[_0x91c5('0x47')]=function(_0x4e2efc,_0x15955c){var _0x1bbf48={'raw':![],'where':{'id':_0x4e2efc[_0x91c5('0x48')]['id']}},_0x7f8bda={};_0x7f8bda[_0x91c5('0x36')]=_[_0x91c5('0x49')](db['Team'][_0x91c5('0x2c')]);_0x7f8bda['query']=_[_0x91c5('0x49')](_0x4e2efc[_0x91c5('0x30')]);_0x7f8bda[_0x91c5('0x31')]=_[_0x91c5('0x32')](_0x7f8bda['model'],_0x7f8bda[_0x91c5('0x30')]);_0x1bbf48[_0x91c5('0x33')]=_['intersection'](_0x7f8bda[_0x91c5('0x36')],qs['fields'](_0x4e2efc[_0x91c5('0x30')]['fields']));_0x1bbf48[_0x91c5('0x33')]=_0x1bbf48[_0x91c5('0x33')][_0x91c5('0x35')]?_0x1bbf48[_0x91c5('0x33')]:_0x7f8bda[_0x91c5('0x36')];if(_0x4e2efc[_0x91c5('0x30')][_0x91c5('0x42')]){_0x1bbf48[_0x91c5('0x43')]=[{'all':!![]}];}_0x1bbf48=_[_0x91c5('0x3d')]({},_0x1bbf48,_0x4e2efc[_0x91c5('0x40')]);return db[_0x91c5('0x2b')]['find'](_0x1bbf48)[_0x91c5('0x23')](handleEntityNotFound(_0x15955c,null))[_0x91c5('0x23')](respondWithResult(_0x15955c,null))[_0x91c5('0x46')](handleError(_0x15955c,null));};exports[_0x91c5('0x4a')]=function(_0x1a555a,_0x39f0b3){return db[_0x91c5('0x2b')][_0x91c5('0x4a')](_0x1a555a[_0x91c5('0x4b')],{})['then'](function(_0x329734){var _0x534901=_0x1a555a[_0x91c5('0x4c')][_0x91c5('0x4d')]({'plain':!![]});if(!_0x534901)throw new Error(_0x91c5('0x4e'));if(_0x534901['role']===_0x91c5('0x4c')){var _0x21ea40=_0x329734[_0x91c5('0x4d')]({'plain':!![]});var _0x302c5d=_0x91c5('0x24');return db[_0x91c5('0x4f')][_0x91c5('0x50')]({'where':{'name':_0x302c5d,'userProfileId':_0x534901[_0x91c5('0x51')]},'raw':!![]})['then'](function(_0x364b0c){if(_0x364b0c&&_0x364b0c[_0x91c5('0x52')]===0x0){return db[_0x91c5('0x53')]['create']({'name':_0x21ea40[_0x91c5('0x28')],'resourceId':_0x21ea40['id'],'type':_0x364b0c['name'],'sectionId':_0x364b0c['id']},{})[_0x91c5('0x23')](function(){return _0x329734;});}else{return _0x329734;}})[_0x91c5('0x46')](function(_0x554ccc){logger[_0x91c5('0x26')](_0x91c5('0x54'),_0x554ccc);throw _0x554ccc;});}return _0x329734;})['then'](respondWithResult(_0x39f0b3,0xc9))[_0x91c5('0x46')](handleError(_0x39f0b3,null));};exports[_0x91c5('0x22')]=function(_0x197a13,_0x4c474a){if(_0x197a13[_0x91c5('0x4b')]['id']){delete _0x197a13[_0x91c5('0x4b')]['id'];}return db[_0x91c5('0x2b')][_0x91c5('0x50')]({'where':{'id':_0x197a13['params']['id']}})[_0x91c5('0x23')](handleEntityNotFound(_0x4c474a,null))[_0x91c5('0x23')](saveUpdates(_0x197a13[_0x91c5('0x4b')],null))[_0x91c5('0x23')](respondWithResult(_0x4c474a,null))[_0x91c5('0x46')](handleError(_0x4c474a,null));};exports[_0x91c5('0x25')]=function(_0x4d5224,_0xb746c8){return db[_0x91c5('0x2b')][_0x91c5('0x50')]({'where':{'id':_0x4d5224['params']['id']}})[_0x91c5('0x23')](handleEntityNotFound(_0xb746c8,null))[_0x91c5('0x23')](removeEntity(_0xb746c8,null))[_0x91c5('0x46')](handleError(_0xb746c8,null));};exports[_0x91c5('0x55')]=function(_0x21916e,_0x36eabc,_0x4134ae){return db[_0x91c5('0x2b')]['findOne']({'where':{'id':_0x21916e[_0x91c5('0x48')]['id']}})[_0x91c5('0x23')](handleEntityNotFound(_0x36eabc,null))[_0x91c5('0x23')](function(_0x1dfc1a){if(!_0x21916e[_0x91c5('0x30')]['channel']||!utils[_0x91c5('0x56')](_0x21916e[_0x91c5('0x30')][_0x91c5('0x57')])){throw new db['Sequelize'][(_0x91c5('0x58'))](_0x91c5('0x59'));}var _0x1cecd1={};var _0x2095d7={};_0x2095d7[_0x91c5('0x36')]=_[_0x91c5('0x49')](db[_[_0x91c5('0x5a')](_0x21916e[_0x91c5('0x30')][_0x91c5('0x57')]['toLowerCase']())+_0x91c5('0x5b')][_0x91c5('0x2c')]);_0x2095d7[_0x91c5('0x30')]=_[_0x91c5('0x49')](_0x21916e['query']);_0x2095d7[_0x91c5('0x31')]=_['intersection'](_0x2095d7['model'],_0x2095d7['query']);_0x1cecd1[_0x91c5('0x33')]=_['intersection'](_0x2095d7['model'],qs['fields'](_0x21916e['query']['fields']));_0x1cecd1[_0x91c5('0x33')]=_0x1cecd1['attributes'][_0x91c5('0x35')]?_0x1cecd1[_0x91c5('0x33')]:_0x2095d7[_0x91c5('0x36')];_0x1cecd1[_0x91c5('0x1b')]=qs['limit'](_0x21916e[_0x91c5('0x30')][_0x91c5('0x1b')]);_0x1cecd1['offset']=qs['offset'](_0x21916e['query'][_0x91c5('0x1a')]);_0x1cecd1[_0x91c5('0x39')]=qs['sort'](_0x21916e[_0x91c5('0x30')][_0x91c5('0x3a')]);_0x1cecd1[_0x91c5('0x3c')]=qs[_0x91c5('0x31')](_[_0x91c5('0x3b')](_0x21916e['query'],_0x2095d7[_0x91c5('0x31')]));_0x1cecd1=_['merge']({},_0x1cecd1,_0x21916e[_0x91c5('0x40')]);return _0x1dfc1a[_0x91c5('0x4d')+_[_0x91c5('0x5a')](_0x21916e['query']['channel'][_0x91c5('0x5c')]())+_0x91c5('0x5d')](_0x1cecd1);})[_0x91c5('0x23')](respondWithResult(_0x36eabc,null))[_0x91c5('0x46')](handleError(_0x36eabc,null));};exports['addQueues']=function(_0x447397,_0x23616b,_0x508621){return db[_0x91c5('0x2b')][_0x91c5('0x5e')]({'where':{'id':_0x447397[_0x91c5('0x48')]['id']}})[_0x91c5('0x23')](function(_0x511a05){if(_0x511a05){if(!_0x447397[_0x91c5('0x4b')][_0x91c5('0x57')]||!utils[_0x91c5('0x56')](_0x447397['body']['channel'])){throw new db['Sequelize']['ValidationError'](_0x91c5('0x59'));}return _0x511a05['add'+_[_0x91c5('0x5a')](_0x447397['body']['channel'][_0x91c5('0x5c')]())+_0x91c5('0x5d')](_0x447397[_0x91c5('0x4b')]['ids']);}return null;})[_0x91c5('0x23')](handleEntityNotFound(_0x23616b,null))[_0x91c5('0x23')](respondWithStatusCode(_0x23616b,null))[_0x91c5('0x46')](handleError(_0x23616b,null));};exports['removeQueues']=function(_0x17ac8f,_0x560d85,_0x10846c){return db[_0x91c5('0x2b')][_0x91c5('0x5e')]({'where':{'id':_0x17ac8f[_0x91c5('0x48')]['id']}})[_0x91c5('0x23')](function(_0x1840ca){if(_0x1840ca){if(!_0x17ac8f[_0x91c5('0x30')]['channel']||!utils[_0x91c5('0x56')](_0x17ac8f[_0x91c5('0x30')]['channel'])){throw new db['Sequelize'][(_0x91c5('0x58'))](_0x91c5('0x59'));}return _0x1840ca[_0x91c5('0x5f')+_['capitalize'](_0x17ac8f['query'][_0x91c5('0x57')][_0x91c5('0x5c')]())+_0x91c5('0x5d')](_0x17ac8f[_0x91c5('0x30')]['ids']);}return null;})[_0x91c5('0x23')](handleEntityNotFound(_0x560d85,null))['then'](respondWithStatusCode(_0x560d85,null))[_0x91c5('0x46')](handleError(_0x560d85,null));};exports['addAgents']=function(_0x2034ab,_0x38e31a,_0x153403){return db[_0x91c5('0x2b')][_0x91c5('0x50')]({'where':{'id':_0x2034ab[_0x91c5('0x48')]['id']}})['then'](handleEntityNotFound(_0x38e31a,null))[_0x91c5('0x23')](function(_0x6eb3a0){if(_0x6eb3a0){var _0x12bbe3=[_0x91c5('0x60'),_0x91c5('0x61'),_0x91c5('0x62'),'Sms',_0x91c5('0x63'),_0x91c5('0x64'),'Whatsapp'];return BPromise[_0x91c5('0x65')](_0x12bbe3,function(_0x18d139){return _0x6eb3a0[_0x91c5('0x4d')+_0x18d139+'Queues']({'attributes':['id','name']})[_0x91c5('0x23')](function(_0x28cb02){return BPromise[_0x91c5('0x65')](_0x28cb02,function(_0x85fb5c){return _0x85fb5c[_0x91c5('0x66')](_0x2034ab['body'][_0x91c5('0x67')])[_0x91c5('0x23')](function(){if(_0x18d139==='Voice'){return db[_0x91c5('0x68')][_0x91c5('0x44')]({'where':{'id':_0x2034ab['body'][_0x91c5('0x67')]},'attributes':['id','name',_0x91c5('0x69'),'voicePause',_0x91c5('0x6a')],'raw':!![]})['then'](function(_0x46a20c){return BPromise[_0x91c5('0x65')](_[_0x91c5('0x3f')](_0x46a20c,{'online':0x1}),function(_0x50eb4c){return db[_0x91c5('0x6b')][_0x91c5('0x6c')]({'membername':_0x50eb4c[_0x91c5('0x28')],'UserId':_0x50eb4c['id'],'queue_name':_0x85fb5c[_0x91c5('0x28')],'VoiceQueueId':_0x85fb5c['id'],'interface':_[_0x91c5('0x6d')](_0x50eb4c[_0x91c5('0x6a')])?util[_0x91c5('0x6e')](_0x91c5('0x6f'),_0x50eb4c['name']):_0x50eb4c[_0x91c5('0x6a')],'paused':_0x50eb4c['voicePause']||![],'penalty':0x0});});});}});});})[_0x91c5('0x23')](function(){return _0x6eb3a0;});})[_0x91c5('0x23')](function(){return _0x6eb3a0;});}})[_0x91c5('0x23')](function(_0x5d96a9){if(_0x5d96a9){return _0x5d96a9[_0x91c5('0x66')](_0x2034ab[_0x91c5('0x4b')][_0x91c5('0x67')],_[_0x91c5('0x70')](_0x2034ab[_0x91c5('0x4b')],[_0x91c5('0x67'),'id'])||{})[_0x91c5('0x71')](function(_0x30c5b6){for(var _0x34850f=0x0;_0x34850f<_0x2034ab[_0x91c5('0x4b')]['ids'][_0x91c5('0x35')];_0x34850f+=0x1){socket[_0x91c5('0x72')](_0x91c5('0x73'),{'UserId':_0x2034ab[_0x91c5('0x4b')][_0x91c5('0x67')][_0x34850f],'TeamId':_0x2034ab[_0x91c5('0x48')]['id']});}return _0x30c5b6;});}})[_0x91c5('0x23')](respondWithResult(_0x38e31a,null))[_0x91c5('0x46')](handleError(_0x38e31a,null));};exports[_0x91c5('0x74')]=function(_0x4d8f99,_0x119055,_0x5ea6f5){return db[_0x91c5('0x2b')]['find']({'where':{'id':_0x4d8f99[_0x91c5('0x48')]['id']}})['then'](handleEntityNotFound(_0x119055,null))['then'](function(_0x87aba){if(_0x87aba){return BPromise[_0x91c5('0x65')](['voice','chat','mail',_0x91c5('0x75'),_0x91c5('0x76'),_0x91c5('0x77'),'whatsapp'],function(_0x261f8f){return _0x87aba['get'+_[_0x91c5('0x5a')](_0x261f8f)+'Queues']({'attributes':['id',_0x91c5('0x28')]})[_0x91c5('0x23')](function(_0x45d032){return BPromise['each'](_0x45d032,function(_0x52ee8c){return _0x52ee8c[_0x91c5('0x74')](_0x4d8f99[_0x91c5('0x30')]['ids'])[_0x91c5('0x23')](function(){if(_0x261f8f===_0x91c5('0x78')){return db[_0x91c5('0x6b')][_0x91c5('0x25')]({'where':{'VoiceQueueId':_0x52ee8c['id'],'UserId':_0x4d8f99[_0x91c5('0x30')][_0x91c5('0x67')]}});}});});})[_0x91c5('0x23')](function(){return _0x87aba;});})[_0x91c5('0x23')](function(){return _0x87aba;});}})[_0x91c5('0x23')](function(_0x432221){if(_0x432221){return _0x432221['removeAgents'](_0x4d8f99['query'][_0x91c5('0x67')])[_0x91c5('0x23')](function(){if(_['isArray'](_0x4d8f99[_0x91c5('0x30')]['ids'])){for(var _0x507b62=0x0;_0x507b62<_0x4d8f99['query']['ids']['length'];_0x507b62+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x4d8f99[_0x91c5('0x30')][_0x91c5('0x67')][_0x507b62]),'TeamId':Number(_0x4d8f99[_0x91c5('0x48')]['id'])});}}else{socket[_0x91c5('0x72')]('userTeam:remove',{'UserId':Number(_0x4d8f99[_0x91c5('0x30')][_0x91c5('0x67')]),'TeamId':Number(_0x4d8f99[_0x91c5('0x48')]['id'])});}});}})[_0x91c5('0x23')](respondWithStatusCode(_0x119055,null))[_0x91c5('0x46')](handleError(_0x119055,null));};exports[_0x91c5('0x79')]=function(_0x379fbe,_0x12f7e7,_0x2b31f2){var _0x9e21fc={};var _0x45f2a2={};var _0x55bcea;var _0x1b2b6a;return db[_0x91c5('0x2b')][_0x91c5('0x5e')]({'where':{'id':_0x379fbe[_0x91c5('0x48')]['id']}})[_0x91c5('0x23')](handleEntityNotFound(_0x12f7e7,null))[_0x91c5('0x23')](function(_0xe3dcd8){if(_0xe3dcd8){_0x55bcea=_0xe3dcd8;_0x45f2a2[_0x91c5('0x36')]=_[_0x91c5('0x49')](db['User'][_0x91c5('0x2c')]);_0x45f2a2[_0x91c5('0x30')]=_[_0x91c5('0x49')](_0x379fbe['query']);_0x45f2a2[_0x91c5('0x31')]=_[_0x91c5('0x32')](_0x45f2a2[_0x91c5('0x36')],_0x45f2a2[_0x91c5('0x30')]);_0x9e21fc[_0x91c5('0x33')]=_[_0x91c5('0x32')](_0x45f2a2[_0x91c5('0x36')],qs['fields'](_0x379fbe[_0x91c5('0x30')]['fields']));_0x9e21fc['attributes']=_0x9e21fc['attributes']['length']?_0x9e21fc[_0x91c5('0x33')]:_0x45f2a2[_0x91c5('0x36')];_0x9e21fc[_0x91c5('0x39')]=qs['sort'](_0x379fbe[_0x91c5('0x30')][_0x91c5('0x3a')]);_0x9e21fc[_0x91c5('0x3c')]=qs[_0x91c5('0x31')](_['pick'](_0x379fbe[_0x91c5('0x30')],_0x45f2a2[_0x91c5('0x31')]));if(_0x379fbe['query'][_0x91c5('0x3f')]){_0x9e21fc[_0x91c5('0x3c')]=_[_0x91c5('0x3d')](_0x9e21fc['where'],{'$or':_[_0x91c5('0x2a')](_0x9e21fc[_0x91c5('0x33')],function(_0x52b197){var _0x2c0dd4={};_0x2c0dd4[_0x52b197]={'$like':'%'+_0x379fbe['query'][_0x91c5('0x3f')]+'%'};return _0x2c0dd4;})});}_0x9e21fc=_[_0x91c5('0x3d')]({},_0x9e21fc,_0x379fbe['options']);return _0x55bcea[_0x91c5('0x79')](_0x9e21fc);}})[_0x91c5('0x23')](function(_0xfe137b){if(_0xfe137b){_0x1b2b6a=_0xfe137b[_0x91c5('0x35')];if(!_0x379fbe[_0x91c5('0x30')][_0x91c5('0x37')](_0x91c5('0x38'))){_0x9e21fc[_0x91c5('0x1b')]=qs[_0x91c5('0x1b')](_0x379fbe[_0x91c5('0x30')][_0x91c5('0x1b')]);_0x9e21fc[_0x91c5('0x1a')]=qs[_0x91c5('0x1a')](_0x379fbe['query'][_0x91c5('0x1a')]);}return _0x55bcea['getAgents'](_0x9e21fc);}})['then'](function(_0x238306){if(_0x238306){return _0x238306?{'count':_0x1b2b6a,'rows':_0x238306}:null;}})['then'](respondWithResult(_0x12f7e7,null))['catch'](handleError(_0x12f7e7,null));}; \ No newline at end of file +var _0xb381=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','apply','save','then','Teams','destroy','end','name','send','Team','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','length','Queues','addQueues','ValidationError','add','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','each','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','omit','spread','emit','userTeam:save','removeAgents','chat','fax','openchannel','whatsapp','voice','isArray','userTeam:remove','getAgents','nolimit','html-pdf','eml-format','request-promise'];(function(_0x439a2c,_0x382c62){var _0x28c78c=function(_0x242137){while(--_0x242137){_0x439a2c['push'](_0x439a2c['shift']());}};_0x28c78c(++_0x382c62);}(_0xb381,0x177));var _0x1b38=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb381[_0x122096];return _0x3d1966;};'use strict';var pdf=require(_0x1b38('0x0'));var emlformat=require(_0x1b38('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b38('0x2'));var moment=require('moment');var BPromise=require(_0x1b38('0x3'));var Mustache=require(_0x1b38('0x4'));var util=require(_0x1b38('0x5'));var path=require(_0x1b38('0x6'));var sox=require(_0x1b38('0x7'));var csv=require(_0x1b38('0x8'));var ejs=require(_0x1b38('0x9'));var fs=require('fs');var _=require(_0x1b38('0xa'));var squel=require(_0x1b38('0xb'));var crypto=require(_0x1b38('0xc'));var jsforce=require(_0x1b38('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1b38('0x8'));var querystring=require(_0x1b38('0xe'));var Papa=require(_0x1b38('0xf'));var Redis=require(_0x1b38('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1b38('0x11'));var as=require(_0x1b38('0x12'));var hardwareService=require(_0x1b38('0x13'));var logger=require('../../config/logger')(_0x1b38('0x14'));var utils=require(_0x1b38('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1b38('0x16')]=_[_0x1b38('0x17')](config[_0x1b38('0x16')],{'host':_0x1b38('0x18'),'port':0x18eb});var socket=require(_0x1b38('0x19'))(new Redis(config[_0x1b38('0x16')]));require('./team.socket')[_0x1b38('0x1a')](socket);function respondWithStatusCode(_0x2a1c89,_0x4a28ed){_0x4a28ed=_0x4a28ed||0xcc;return function(_0xb1fd0a){if(_0xb1fd0a){return _0x2a1c89[_0x1b38('0x1b')](_0x4a28ed);}return _0x2a1c89[_0x1b38('0x1c')](_0x4a28ed)['end']();};}function respondWithResult(_0x2ba6ca,_0x4bc2bb){_0x4bc2bb=_0x4bc2bb||0xc8;return function(_0x12c1fc){if(_0x12c1fc){return _0x2ba6ca[_0x1b38('0x1c')](_0x4bc2bb)[_0x1b38('0x1d')](_0x12c1fc);}};}function respondWithFilteredResult(_0x3e83e9,_0x5a3e8d){return function(_0x3c7774){if(_0x3c7774){var _0x31e42d=_0x3c7774[_0x1b38('0x1e')],_0x1979b1=_0x5a3e8d[_0x1b38('0x1f')],_0x1764d8=_0x5a3e8d['offset']+_0x5a3e8d[_0x1b38('0x20')],_0x66d113;if(_0x1764d8>=_0x31e42d){_0x1764d8=_0x31e42d;_0x66d113=0xc8;}else{_0x66d113=0xce;}_0x3e83e9[_0x1b38('0x1c')](_0x66d113);return _0x3e83e9[_0x1b38('0x21')]('Content-Range',_0x1979b1+'-'+_0x1764d8+'/'+_0x31e42d)[_0x1b38('0x1d')](_0x3c7774);}return null;};}function patchUpdates(_0x20174a){return function(_0x18e5a1){try{jsonpatch[_0x1b38('0x22')](_0x18e5a1,_0x20174a,!![]);}catch(_0x51501e){return BPromise['reject'](_0x51501e);}return _0x18e5a1[_0x1b38('0x23')]();};}function saveUpdates(_0x392970,_0x1f426c){return function(_0x54158d){if(_0x54158d){return _0x54158d['update'](_0x392970)[_0x1b38('0x24')](function(_0x54f13f){return _0x54f13f;});}return null;};}function removeEntity(_0x3855e5,_0x557de5){return function(_0x93f309){if(_0x93f309){return _0x93f309['destroy']()[_0x1b38('0x24')](function(){var _0x1ef0ab=_0x93f309['get']({'plain':!![]});var _0x2c4f4c=_0x1b38('0x25');return db['UserProfileResource'][_0x1b38('0x26')]({'where':{'type':_0x2c4f4c,'resourceId':_0x1ef0ab['id']}})['then'](function(){return _0x93f309;});})[_0x1b38('0x24')](function(){_0x3855e5[_0x1b38('0x1c')](0xcc)[_0x1b38('0x27')]();});}};}function handleEntityNotFound(_0x2e5a56,_0x3bf7ba){return function(_0x4e3e92){if(!_0x4e3e92){_0x2e5a56[_0x1b38('0x1b')](0x194);}return _0x4e3e92;};}function handleError(_0x4112f7,_0x195fd3){_0x195fd3=_0x195fd3||0x1f4;return function(_0x25492b){logger['error'](_0x25492b['stack']);if(_0x25492b[_0x1b38('0x28')]){delete _0x25492b['name'];}_0x4112f7['status'](_0x195fd3)[_0x1b38('0x29')](_0x25492b);};}exports['index']=function(_0xf8dfc6,_0x155a7c){var _0x597d67={},_0x31f8f1={},_0x35e5d9={'count':0x0,'rows':[]};var _0x29eef8=_['map'](db[_0x1b38('0x2a')]['rawAttributes'],function(_0x4d5bc5){return{'name':_0x4d5bc5[_0x1b38('0x2b')],'type':_0x4d5bc5['type'][_0x1b38('0x2c')]};});_0x31f8f1['model']=_[_0x1b38('0x2d')](_0x29eef8,_0x1b38('0x28'));_0x31f8f1[_0x1b38('0x2e')]=_[_0x1b38('0x2f')](_0xf8dfc6[_0x1b38('0x2e')]);_0x31f8f1[_0x1b38('0x30')]=_[_0x1b38('0x31')](_0x31f8f1['model'],_0x31f8f1[_0x1b38('0x2e')]);_0x597d67[_0x1b38('0x32')]=_[_0x1b38('0x31')](_0x31f8f1[_0x1b38('0x33')],qs[_0x1b38('0x34')](_0xf8dfc6[_0x1b38('0x2e')][_0x1b38('0x34')]));_0x597d67[_0x1b38('0x32')]=_0x597d67[_0x1b38('0x32')]['length']?_0x597d67[_0x1b38('0x32')]:_0x31f8f1['model'];if(!_0xf8dfc6['query'][_0x1b38('0x35')]('nolimit')){_0x597d67[_0x1b38('0x20')]=qs[_0x1b38('0x20')](_0xf8dfc6[_0x1b38('0x2e')]['limit']);_0x597d67[_0x1b38('0x1f')]=qs[_0x1b38('0x1f')](_0xf8dfc6[_0x1b38('0x2e')][_0x1b38('0x1f')]);}_0x597d67[_0x1b38('0x36')]=qs[_0x1b38('0x37')](_0xf8dfc6['query'][_0x1b38('0x37')]);_0x597d67[_0x1b38('0x38')]=qs[_0x1b38('0x30')](_[_0x1b38('0x39')](_0xf8dfc6['query'],_0x31f8f1[_0x1b38('0x30')]),_0x29eef8);if(_0xf8dfc6[_0x1b38('0x2e')][_0x1b38('0x3a')]){_0x597d67[_0x1b38('0x38')]=_[_0x1b38('0x3b')](_0x597d67[_0x1b38('0x38')],{'$or':_['map'](_0x29eef8,function(_0x40eb90){if(_0x40eb90[_0x1b38('0x3c')]!==_0x1b38('0x3d')){var _0x543154={};_0x543154[_0x40eb90[_0x1b38('0x28')]]={'$like':'%'+_0xf8dfc6[_0x1b38('0x2e')][_0x1b38('0x3a')]+'%'};return _0x543154;}})});}_0x597d67=_['merge']({},_0x597d67,_0xf8dfc6[_0x1b38('0x3e')]);var _0x3c0cc8={'where':_0x597d67[_0x1b38('0x38')]};return db['Team'][_0x1b38('0x1e')](_0x3c0cc8)[_0x1b38('0x24')](function(_0x44c0cc){_0x35e5d9[_0x1b38('0x1e')]=_0x44c0cc;if(_0xf8dfc6[_0x1b38('0x2e')]['includeAll']){_0x597d67[_0x1b38('0x3f')]=[{'all':!![]}];}return db[_0x1b38('0x2a')][_0x1b38('0x40')](_0x597d67);})['then'](function(_0x25f31c){_0x35e5d9[_0x1b38('0x41')]=_0x25f31c;return _0x35e5d9;})[_0x1b38('0x24')](respondWithFilteredResult(_0x155a7c,_0x597d67))[_0x1b38('0x42')](handleError(_0x155a7c,null));};exports[_0x1b38('0x43')]=function(_0x22beff,_0x134b54){var _0x156661={'raw':![],'where':{'id':_0x22beff[_0x1b38('0x44')]['id']}},_0x4e95be={};_0x4e95be[_0x1b38('0x33')]=_[_0x1b38('0x2f')](db['Team'][_0x1b38('0x45')]);_0x4e95be[_0x1b38('0x2e')]=_[_0x1b38('0x2f')](_0x22beff[_0x1b38('0x2e')]);_0x4e95be[_0x1b38('0x30')]=_['intersection'](_0x4e95be[_0x1b38('0x33')],_0x4e95be[_0x1b38('0x2e')]);_0x156661[_0x1b38('0x32')]=_[_0x1b38('0x31')](_0x4e95be[_0x1b38('0x33')],qs[_0x1b38('0x34')](_0x22beff[_0x1b38('0x2e')]['fields']));_0x156661[_0x1b38('0x32')]=_0x156661['attributes']['length']?_0x156661[_0x1b38('0x32')]:_0x4e95be['model'];if(_0x22beff['query'][_0x1b38('0x46')]){_0x156661['include']=[{'all':!![]}];}_0x156661=_[_0x1b38('0x3b')]({},_0x156661,_0x22beff['options']);return db[_0x1b38('0x2a')][_0x1b38('0x47')](_0x156661)[_0x1b38('0x24')](handleEntityNotFound(_0x134b54,null))['then'](respondWithResult(_0x134b54,null))[_0x1b38('0x42')](handleError(_0x134b54,null));};exports[_0x1b38('0x48')]=function(_0x34650a,_0xa9e3cf){return db[_0x1b38('0x2a')][_0x1b38('0x48')](_0x34650a[_0x1b38('0x49')],{})['then'](function(_0x1f0613){var _0x32284b=_0x34650a[_0x1b38('0x4a')][_0x1b38('0x4b')]({'plain':!![]});if(!_0x32284b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32284b[_0x1b38('0x4c')]==='user'){var _0x2a1560=_0x1f0613[_0x1b38('0x4b')]({'plain':!![]});var _0x1aea56=_0x1b38('0x25');return db[_0x1b38('0x4d')][_0x1b38('0x47')]({'where':{'name':_0x1aea56,'userProfileId':_0x32284b[_0x1b38('0x4e')]},'raw':!![]})[_0x1b38('0x24')](function(_0x121c58){if(_0x121c58&&_0x121c58['autoAssociation']===0x0){return db['UserProfileResource'][_0x1b38('0x48')]({'name':_0x2a1560[_0x1b38('0x28')],'resourceId':_0x2a1560['id'],'type':_0x121c58[_0x1b38('0x28')],'sectionId':_0x121c58['id']},{})[_0x1b38('0x24')](function(){return _0x1f0613;});}else{return _0x1f0613;}})[_0x1b38('0x42')](function(_0x5519e4){logger[_0x1b38('0x4f')](_0x1b38('0x50'),_0x5519e4);throw _0x5519e4;});}return _0x1f0613;})[_0x1b38('0x24')](respondWithResult(_0xa9e3cf,0xc9))[_0x1b38('0x42')](handleError(_0xa9e3cf,null));};exports[_0x1b38('0x51')]=function(_0x45fb4f,_0x3805c4){if(_0x45fb4f[_0x1b38('0x49')]['id']){delete _0x45fb4f[_0x1b38('0x49')]['id'];}return db[_0x1b38('0x2a')][_0x1b38('0x47')]({'where':{'id':_0x45fb4f[_0x1b38('0x44')]['id']}})['then'](handleEntityNotFound(_0x3805c4,null))[_0x1b38('0x24')](saveUpdates(_0x45fb4f[_0x1b38('0x49')],null))[_0x1b38('0x24')](respondWithResult(_0x3805c4,null))[_0x1b38('0x42')](handleError(_0x3805c4,null));};exports[_0x1b38('0x26')]=function(_0x34a6e8,_0x32a7aa){return db['Team']['find']({'where':{'id':_0x34a6e8['params']['id']}})[_0x1b38('0x24')](handleEntityNotFound(_0x32a7aa,null))[_0x1b38('0x24')](removeEntity(_0x32a7aa,null))[_0x1b38('0x42')](handleError(_0x32a7aa,null));};exports[_0x1b38('0x52')]=function(_0x2bb58e,_0x54e93f,_0x31e307){return db[_0x1b38('0x2a')][_0x1b38('0x53')]({'where':{'id':_0x2bb58e[_0x1b38('0x44')]['id']}})[_0x1b38('0x24')](handleEntityNotFound(_0x54e93f,null))[_0x1b38('0x24')](function(_0x1ea90b){if(!_0x2bb58e[_0x1b38('0x2e')][_0x1b38('0x54')]||!utils[_0x1b38('0x55')](_0x2bb58e[_0x1b38('0x2e')][_0x1b38('0x54')])){throw new db[(_0x1b38('0x56'))]['ValidationError'](_0x1b38('0x57'));}var _0x57603c={};var _0x3f90b7={};_0x3f90b7[_0x1b38('0x33')]=_[_0x1b38('0x2f')](db[_[_0x1b38('0x58')](_0x2bb58e[_0x1b38('0x2e')][_0x1b38('0x54')][_0x1b38('0x59')]())+_0x1b38('0x5a')]['rawAttributes']);_0x3f90b7['query']=_[_0x1b38('0x2f')](_0x2bb58e['query']);_0x3f90b7[_0x1b38('0x30')]=_[_0x1b38('0x31')](_0x3f90b7[_0x1b38('0x33')],_0x3f90b7[_0x1b38('0x2e')]);_0x57603c['attributes']=_[_0x1b38('0x31')](_0x3f90b7[_0x1b38('0x33')],qs['fields'](_0x2bb58e[_0x1b38('0x2e')][_0x1b38('0x34')]));_0x57603c[_0x1b38('0x32')]=_0x57603c['attributes'][_0x1b38('0x5b')]?_0x57603c['attributes']:_0x3f90b7[_0x1b38('0x33')];_0x57603c[_0x1b38('0x20')]=qs[_0x1b38('0x20')](_0x2bb58e[_0x1b38('0x2e')]['limit']);_0x57603c[_0x1b38('0x1f')]=qs[_0x1b38('0x1f')](_0x2bb58e['query']['offset']);_0x57603c['order']=qs[_0x1b38('0x37')](_0x2bb58e[_0x1b38('0x2e')]['sort']);_0x57603c[_0x1b38('0x38')]=qs[_0x1b38('0x30')](_[_0x1b38('0x39')](_0x2bb58e['query'],_0x3f90b7[_0x1b38('0x30')]));_0x57603c=_[_0x1b38('0x3b')]({},_0x57603c,_0x2bb58e[_0x1b38('0x3e')]);return _0x1ea90b[_0x1b38('0x4b')+_[_0x1b38('0x58')](_0x2bb58e['query']['channel']['toLowerCase']())+_0x1b38('0x5c')](_0x57603c);})[_0x1b38('0x24')](respondWithResult(_0x54e93f,null))[_0x1b38('0x42')](handleError(_0x54e93f,null));};exports[_0x1b38('0x5d')]=function(_0x36bd11,_0x4c3073,_0x222c59){return db['Team'][_0x1b38('0x53')]({'where':{'id':_0x36bd11[_0x1b38('0x44')]['id']}})[_0x1b38('0x24')](function(_0x34a9e3){if(_0x34a9e3){if(!_0x36bd11[_0x1b38('0x49')][_0x1b38('0x54')]||!utils[_0x1b38('0x55')](_0x36bd11['body']['channel'])){throw new db[(_0x1b38('0x56'))][(_0x1b38('0x5e'))]('Unknown\x20channel');}return _0x34a9e3[_0x1b38('0x5f')+_['capitalize'](_0x36bd11[_0x1b38('0x49')][_0x1b38('0x54')]['toLowerCase']())+_0x1b38('0x5c')](_0x36bd11['body'][_0x1b38('0x60')]);}return null;})[_0x1b38('0x24')](handleEntityNotFound(_0x4c3073,null))[_0x1b38('0x24')](respondWithStatusCode(_0x4c3073,null))['catch'](handleError(_0x4c3073,null));};exports[_0x1b38('0x61')]=function(_0x3ccd91,_0x208db2,_0x303ea7){return db[_0x1b38('0x2a')]['findOne']({'where':{'id':_0x3ccd91[_0x1b38('0x44')]['id']}})[_0x1b38('0x24')](function(_0x2a9370){if(_0x2a9370){if(!_0x3ccd91[_0x1b38('0x2e')]['channel']||!utils[_0x1b38('0x55')](_0x3ccd91[_0x1b38('0x2e')][_0x1b38('0x54')])){throw new db[(_0x1b38('0x56'))]['ValidationError']('Unknown\x20channel');}return _0x2a9370['remove'+_['capitalize'](_0x3ccd91[_0x1b38('0x2e')][_0x1b38('0x54')][_0x1b38('0x59')]())+_0x1b38('0x5c')](_0x3ccd91[_0x1b38('0x2e')][_0x1b38('0x60')]);}return null;})[_0x1b38('0x24')](handleEntityNotFound(_0x208db2,null))[_0x1b38('0x24')](respondWithStatusCode(_0x208db2,null))['catch'](handleError(_0x208db2,null));};exports[_0x1b38('0x62')]=function(_0x29c6f7,_0x363013,_0x3d2996){return db[_0x1b38('0x2a')][_0x1b38('0x47')]({'where':{'id':_0x29c6f7[_0x1b38('0x44')]['id']}})[_0x1b38('0x24')](handleEntityNotFound(_0x363013,null))['then'](function(_0x4c7ebc){if(_0x4c7ebc){var _0x17add2=[_0x1b38('0x63'),_0x1b38('0x64'),_0x1b38('0x65'),_0x1b38('0x66'),_0x1b38('0x67'),_0x1b38('0x68'),'Whatsapp'];return BPromise[_0x1b38('0x69')](_0x17add2,function(_0x59e2e5){return _0x4c7ebc['get'+_0x59e2e5+_0x1b38('0x5c')]({'attributes':['id','name']})[_0x1b38('0x24')](function(_0x1280ed){return BPromise[_0x1b38('0x69')](_0x1280ed,function(_0x387927){return _0x387927[_0x1b38('0x62')](_0x29c6f7[_0x1b38('0x49')][_0x1b38('0x60')])[_0x1b38('0x24')](function(){if(_0x59e2e5==='Voice'){return db[_0x1b38('0x6a')]['findAll']({'where':{'id':_0x29c6f7[_0x1b38('0x49')][_0x1b38('0x60')]},'attributes':['id','name','online',_0x1b38('0x6b'),_0x1b38('0x6c')],'raw':!![]})['then'](function(_0x312ad0){return BPromise[_0x1b38('0x69')](_[_0x1b38('0x3a')](_0x312ad0,{'online':0x1}),function(_0x98dc39){return db[_0x1b38('0x6d')][_0x1b38('0x6e')]({'membername':_0x98dc39[_0x1b38('0x28')],'UserId':_0x98dc39['id'],'queue_name':_0x387927['name'],'VoiceQueueId':_0x387927['id'],'interface':_[_0x1b38('0x6f')](_0x98dc39['interface'])?util['format']('SIP/%s',_0x98dc39['name']):_0x98dc39['interface'],'paused':_0x98dc39[_0x1b38('0x6b')]||![],'penalty':0x0});});});}});});})[_0x1b38('0x24')](function(){return _0x4c7ebc;});})['then'](function(){return _0x4c7ebc;});}})[_0x1b38('0x24')](function(_0x4de1f9){if(_0x4de1f9){return _0x4de1f9['addAgents'](_0x29c6f7[_0x1b38('0x49')][_0x1b38('0x60')],_[_0x1b38('0x70')](_0x29c6f7['body'],['ids','id'])||{})[_0x1b38('0x71')](function(_0x5b382c){for(var _0xadc8ef=0x0;_0xadc8ef<_0x29c6f7[_0x1b38('0x49')][_0x1b38('0x60')][_0x1b38('0x5b')];_0xadc8ef+=0x1){socket[_0x1b38('0x72')](_0x1b38('0x73'),{'UserId':_0x29c6f7[_0x1b38('0x49')][_0x1b38('0x60')][_0xadc8ef],'TeamId':_0x29c6f7[_0x1b38('0x44')]['id']});}return _0x5b382c;});}})['then'](respondWithResult(_0x363013,null))[_0x1b38('0x42')](handleError(_0x363013,null));};exports[_0x1b38('0x74')]=function(_0x1a6dbc,_0x448479,_0x5935e6){return db[_0x1b38('0x2a')][_0x1b38('0x47')]({'where':{'id':_0x1a6dbc[_0x1b38('0x44')]['id']}})['then'](handleEntityNotFound(_0x448479,null))[_0x1b38('0x24')](function(_0x1fccdf){if(_0x1fccdf){return BPromise['each'](['voice',_0x1b38('0x75'),'mail','sms',_0x1b38('0x76'),_0x1b38('0x77'),_0x1b38('0x78')],function(_0x569c51){return _0x1fccdf[_0x1b38('0x4b')+_[_0x1b38('0x58')](_0x569c51)+_0x1b38('0x5c')]({'attributes':['id',_0x1b38('0x28')]})['then'](function(_0x349112){return BPromise[_0x1b38('0x69')](_0x349112,function(_0x374545){return _0x374545['removeAgents'](_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')])[_0x1b38('0x24')](function(){if(_0x569c51===_0x1b38('0x79')){return db['UserVoiceQueueRt'][_0x1b38('0x26')]({'where':{'VoiceQueueId':_0x374545['id'],'UserId':_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')]}});}});});})[_0x1b38('0x24')](function(){return _0x1fccdf;});})[_0x1b38('0x24')](function(){return _0x1fccdf;});}})[_0x1b38('0x24')](function(_0xf7e152){if(_0xf7e152){return _0xf7e152[_0x1b38('0x74')](_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')])['then'](function(){if(_[_0x1b38('0x7a')](_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')])){for(var _0x1c85e6=0x0;_0x1c85e6<_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')][_0x1b38('0x5b')];_0x1c85e6+=0x1){socket[_0x1b38('0x72')](_0x1b38('0x7b'),{'UserId':Number(_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')][_0x1c85e6]),'TeamId':Number(_0x1a6dbc[_0x1b38('0x44')]['id'])});}}else{socket[_0x1b38('0x72')](_0x1b38('0x7b'),{'UserId':Number(_0x1a6dbc[_0x1b38('0x2e')][_0x1b38('0x60')]),'TeamId':Number(_0x1a6dbc[_0x1b38('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x448479,null))['catch'](handleError(_0x448479,null));};exports['getAgents']=function(_0x3f6edc,_0x3879e8,_0x1ce38d){var _0x57f01b={};var _0x1abba2={};var _0x4f3697;var _0x24ea40;return db[_0x1b38('0x2a')]['findOne']({'where':{'id':_0x3f6edc[_0x1b38('0x44')]['id']}})[_0x1b38('0x24')](handleEntityNotFound(_0x3879e8,null))[_0x1b38('0x24')](function(_0x33dd9a){if(_0x33dd9a){_0x4f3697=_0x33dd9a;_0x1abba2[_0x1b38('0x33')]=_[_0x1b38('0x2f')](db[_0x1b38('0x6a')][_0x1b38('0x45')]);_0x1abba2[_0x1b38('0x2e')]=_['keys'](_0x3f6edc['query']);_0x1abba2[_0x1b38('0x30')]=_[_0x1b38('0x31')](_0x1abba2[_0x1b38('0x33')],_0x1abba2[_0x1b38('0x2e')]);_0x57f01b[_0x1b38('0x32')]=_[_0x1b38('0x31')](_0x1abba2[_0x1b38('0x33')],qs[_0x1b38('0x34')](_0x3f6edc[_0x1b38('0x2e')][_0x1b38('0x34')]));_0x57f01b[_0x1b38('0x32')]=_0x57f01b['attributes'][_0x1b38('0x5b')]?_0x57f01b[_0x1b38('0x32')]:_0x1abba2['model'];_0x57f01b[_0x1b38('0x36')]=qs['sort'](_0x3f6edc[_0x1b38('0x2e')][_0x1b38('0x37')]);_0x57f01b[_0x1b38('0x38')]=qs[_0x1b38('0x30')](_[_0x1b38('0x39')](_0x3f6edc[_0x1b38('0x2e')],_0x1abba2[_0x1b38('0x30')]));if(_0x3f6edc[_0x1b38('0x2e')][_0x1b38('0x3a')]){_0x57f01b['where']=_[_0x1b38('0x3b')](_0x57f01b[_0x1b38('0x38')],{'$or':_[_0x1b38('0x2d')](_0x57f01b[_0x1b38('0x32')],function(_0x4f1f2e){var _0xb0e55e={};_0xb0e55e[_0x4f1f2e]={'$like':'%'+_0x3f6edc[_0x1b38('0x2e')]['filter']+'%'};return _0xb0e55e;})});}_0x57f01b=_[_0x1b38('0x3b')]({},_0x57f01b,_0x3f6edc[_0x1b38('0x3e')]);return _0x4f3697[_0x1b38('0x7c')](_0x57f01b);}})['then'](function(_0x3da8d1){if(_0x3da8d1){_0x24ea40=_0x3da8d1[_0x1b38('0x5b')];if(!_0x3f6edc[_0x1b38('0x2e')][_0x1b38('0x35')](_0x1b38('0x7d'))){_0x57f01b['limit']=qs[_0x1b38('0x20')](_0x3f6edc['query'][_0x1b38('0x20')]);_0x57f01b[_0x1b38('0x1f')]=qs[_0x1b38('0x1f')](_0x3f6edc['query'][_0x1b38('0x1f')]);}return _0x4f3697[_0x1b38('0x7c')](_0x57f01b);}})[_0x1b38('0x24')](function(_0x49ca3e){if(_0x49ca3e){return _0x49ca3e?{'count':_0x24ea40,'rows':_0x49ca3e}:null;}})[_0x1b38('0x24')](respondWithResult(_0x3879e8,null))[_0x1b38('0x42')](handleError(_0x3879e8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d2e892d..952c5b5 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 _0xdb08=['events','../../mysqldb','Team','save','update','remove','hasOwnProperty','hook'];(function(_0x5cabe7,_0x578bf0){var _0x5c9572=function(_0x318668){while(--_0x318668){_0x5cabe7['push'](_0x5cabe7['shift']());}};_0x5c9572(++_0x578bf0);}(_0xdb08,0xc0));var _0x8db0=function(_0x47ed9e,_0x5e3fbf){_0x47ed9e=_0x47ed9e-0x0;var _0x29af7d=_0xdb08[_0x47ed9e];return _0x29af7d;};'use strict';var EventEmitter=require(_0x8db0('0x0'));var Team=require(_0x8db0('0x1'))['db'][_0x8db0('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8db0('0x3'),'afterUpdate':_0x8db0('0x4'),'afterDestroy':_0x8db0('0x5')};function emitEvent(_0x845df8){return function(_0x21554b,_0x1902d5,_0x48d946){TeamEvents['emit'](_0x845df8+':'+_0x21554b['id'],_0x21554b);TeamEvents['emit'](_0x845df8,_0x21554b);_0x48d946(null);};}for(var e in events){if(events[_0x8db0('0x6')](e)){var event=events[e];Team[_0x8db0('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xebc5=['Team','save','emit','exports','events','../../mysqldb'];(function(_0x2aee57,_0x35e9b5){var _0x33eef9=function(_0x387887){while(--_0x387887){_0x2aee57['push'](_0x2aee57['shift']());}};_0x33eef9(++_0x35e9b5);}(_0xebc5,0x190));var _0x5ebc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xebc5[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x5ebc('0x0'));var Team=require(_0x5ebc('0x1'))['db'][_0x5ebc('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ebc('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cf90c){return function(_0x404d97,_0x29282f,_0x2a0800){TeamEvents[_0x5ebc('0x4')](_0x4cf90c+':'+_0x404d97['id'],_0x404d97);TeamEvents[_0x5ebc('0x4')](_0x4cf90c,_0x404d97);_0x2a0800(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x5ebc('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2c46d7d..1389553 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 _0x9e9a=['util','api','moment','bluebird','request-promise','path','./team.attributes','exports','define','Team','teams','lodash'];(function(_0x1274d4,_0x3c1633){var _0x44ffed=function(_0x42934e){while(--_0x42934e){_0x1274d4['push'](_0x1274d4['shift']());}};_0x44ffed(++_0x3c1633);}(_0x9e9a,0xef));var _0xa9e9=function(_0x44594d,_0x44470c){_0x44594d=_0x44594d-0x0;var _0x1bff66=_0x9e9a[_0x44594d];return _0x1bff66;};'use strict';var _=require(_0xa9e9('0x0'));var util=require(_0xa9e9('0x1'));var logger=require('../../config/logger')(_0xa9e9('0x2'));var moment=require(_0xa9e9('0x3'));var BPromise=require(_0xa9e9('0x4'));var rp=require(_0xa9e9('0x5'));var fs=require('fs');var path=require(_0xa9e9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9e9('0x7'));module[_0xa9e9('0x8')]=function(_0x408d3d,_0x59e6c2){return _0x408d3d[_0xa9e9('0x9')](_0xa9e9('0xa'),attributes,{'tableName':_0xa9e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf331=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash'];(function(_0x94dc85,_0x26d406){var _0x140d46=function(_0x32076c){while(--_0x32076c){_0x94dc85['push'](_0x94dc85['shift']());}};_0x140d46(++_0x26d406);}(_0xf331,0x1b9));var _0x1f33=function(_0x2440ae,_0x568b2e){_0x2440ae=_0x2440ae-0x0;var _0x2c28de=_0xf331[_0x2440ae];return _0x2c28de;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var logger=require(_0x1f33('0x2'))(_0x1f33('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1f33('0x4'));var fs=require('fs');var path=require(_0x1f33('0x5'));var rimraf=require(_0x1f33('0x6'));var config=require(_0x1f33('0x7'));var attributes=require(_0x1f33('0x8'));module[_0x1f33('0x9')]=function(_0x4b314c,_0x3b8ca8){return _0x4b314c[_0x1f33('0xa')](_0x1f33('0xb'),attributes,{'tableName':_0x1f33('0xc'),'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 da27723..3e4f40f 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 _0x0195=['./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0195,0x108));var _0x5019=function(_0x102102,_0x4c645f){_0x102102=_0x102102-0x0;var _0x10037a=_0x0195[_0x102102];return _0x10037a;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require(_0x5019('0x3'));var rs=require(_0x5019('0x4'));var fs=require('fs');var Redis=require(_0x5019('0x5'));var db=require(_0x5019('0x6'))['db'];var utils=require(_0x5019('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5019('0x8'));var jayson=require(_0x5019('0x9'));var client=jayson[_0x5019('0xa')][_0x5019('0xb')]({'port':0x232a});config[_0x5019('0xc')]=_[_0x5019('0xd')](config[_0x5019('0xc')],{'host':_0x5019('0xe'),'port':0x18eb});var socket=require(_0x5019('0xf'))(new Redis(config['redis']));require(_0x5019('0x10'))[_0x5019('0x11')](socket);function respondWithRpcPromise(_0x5e3ae9,_0xcde58c,_0x289ced){return new BPromise(function(_0x374436,_0xe4f90f){return client[_0x5019('0x12')](_0x5e3ae9,_0x289ced)[_0x5019('0x13')](function(_0x4ae475){logger['info'](_0x5019('0x14'),_0xcde58c,_0x5019('0x15'));logger[_0x5019('0x16')](_0x5019('0x17'),_0xcde58c,_0x5019('0x15'),JSON['stringify'](_0x4ae475));if(_0x4ae475[_0x5019('0x18')]){if(_0x4ae475[_0x5019('0x18')]['code']===0x1f4){logger['error'](_0x5019('0x14'),_0xcde58c,_0x4ae475['error'][_0x5019('0x19')]);return _0xe4f90f(_0x4ae475[_0x5019('0x18')][_0x5019('0x19')]);}logger['error'](_0x5019('0x14'),_0xcde58c,_0x4ae475['error'][_0x5019('0x19')]);return _0x374436(_0x4ae475[_0x5019('0x18')][_0x5019('0x19')]);}else{logger[_0x5019('0x1a')](_0x5019('0x14'),_0xcde58c,_0x5019('0x15'));_0x374436(_0x4ae475[_0x5019('0x1b')]['message']);}})['catch'](function(_0xc640cc){logger[_0x5019('0x18')]('Team,\x20%s,\x20%s',_0xcde58c,_0xc640cc);_0xe4f90f(_0xc640cc);});});} \ No newline at end of file +var _0xf593=['defaults','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x257ebb,_0x201f51){var _0x3befdf=function(_0x50a88f){while(--_0x50a88f){_0x257ebb['push'](_0x257ebb['shift']());}};_0x3befdf(++_0x201f51);}(_0xf593,0x15c));var _0x3f59=function(_0x102048,_0x11df07){_0x102048=_0x102048-0x0;var _0x16be30=_0xf593[_0x102048];return _0x16be30;};'use strict';var _=require(_0x3f59('0x0'));var util=require('util');var moment=require(_0x3f59('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f59('0x2'));var fs=require('fs');var Redis=require(_0x3f59('0x3'));var db=require(_0x3f59('0x4'))['db'];var utils=require(_0x3f59('0x5'));var logger=require(_0x3f59('0x6'))('rpc');var config=require(_0x3f59('0x7'));var jayson=require(_0x3f59('0x8'));var client=jayson[_0x3f59('0x9')][_0x3f59('0xa')]({'port':0x232a});config[_0x3f59('0xb')]=_[_0x3f59('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3f59('0xd'))(new Redis(config['redis']));require(_0x3f59('0xe'))['register'](socket);function respondWithRpcPromise(_0x5bf23f,_0x19a349,_0x3deb6c){return new BPromise(function(_0x27de73,_0x229595){return client[_0x3f59('0xf')](_0x5bf23f,_0x3deb6c)['then'](function(_0x508c66){logger[_0x3f59('0x10')](_0x3f59('0x11'),_0x19a349,_0x3f59('0x12'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x19a349,_0x3f59('0x12'),JSON[_0x3f59('0x13')](_0x508c66));if(_0x508c66[_0x3f59('0x14')]){if(_0x508c66[_0x3f59('0x14')][_0x3f59('0x15')]===0x1f4){logger[_0x3f59('0x14')](_0x3f59('0x11'),_0x19a349,_0x508c66['error'][_0x3f59('0x16')]);return _0x229595(_0x508c66[_0x3f59('0x14')][_0x3f59('0x16')]);}logger['error'](_0x3f59('0x11'),_0x19a349,_0x508c66['error']['message']);return _0x27de73(_0x508c66[_0x3f59('0x14')][_0x3f59('0x16')]);}else{logger[_0x3f59('0x10')]('Team,\x20%s,\x20%s',_0x19a349,'request\x20sent');_0x27de73(_0x508c66[_0x3f59('0x17')][_0x3f59('0x16')]);}})['catch'](function(_0x43e26e){logger[_0x3f59('0x14')](_0x3f59('0x11'),_0x19a349,_0x43e26e);_0x229595(_0x43e26e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ce93a1c..69786d9 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 _0xc9c3=['remove','emit','removeListener','length','team:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9c3,0x96));var _0x3c9c=function(_0x22917b,_0x317a5){_0x22917b=_0x22917b-0x0;var _0x185e62=_0xc9c3[_0x22917b];return _0x185e62;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3c9c('0x0'),'update'];function createListener(_0xf34a69,_0x11a901){return function(_0x4185dc){_0x11a901[_0x3c9c('0x1')](_0xf34a69,_0x4185dc);};}function removeListener(_0x2b0045,_0xe07e05){return function(){TeamEvents[_0x3c9c('0x2')](_0x2b0045,_0xe07e05);};}exports['register']=function(_0x48b219){for(var _0x5c86bd=0x0,_0x5a2836=events[_0x3c9c('0x3')];_0x5c86bd<_0x5a2836;_0x5c86bd++){var _0xc35e75=events[_0x5c86bd];var _0x2eb946=createListener(_0x3c9c('0x4')+_0xc35e75,_0x48b219);TeamEvents['on'](_0xc35e75,_0x2eb946);}}; \ No newline at end of file +var _0x4753=['length','team:','./team.events','save','remove','emit'];(function(_0x52edfb,_0x3a111c){var _0x100cf5=function(_0x13fa54){while(--_0x13fa54){_0x52edfb['push'](_0x52edfb['shift']());}};_0x100cf5(++_0x3a111c);}(_0x4753,0x1f4));var _0x3475=function(_0x3ffda4,_0x34f391){_0x3ffda4=_0x3ffda4-0x0;var _0x5c6211=_0x4753[_0x3ffda4];return _0x5c6211;};'use strict';var TeamEvents=require(_0x3475('0x0'));var events=[_0x3475('0x1'),_0x3475('0x2'),'update'];function createListener(_0x18bd20,_0x3a494a){return function(_0x5adfed){_0x3a494a[_0x3475('0x3')](_0x18bd20,_0x5adfed);};}function removeListener(_0x4c6fd2,_0x5a801b){return function(){TeamEvents['removeListener'](_0x4c6fd2,_0x5a801b);};}exports['register']=function(_0x12df57){for(var _0x18bd53=0x0,_0x48c6af=events[_0x3475('0x4')];_0x18bd53<_0x48c6af;_0x18bd53++){var _0x157c1e=events[_0x18bd53];var _0x409bfc=createListener(_0x3475('0x5')+_0x157c1e,_0x12df57);TeamEvents['on'](_0x157c1e,_0x409bfc);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 36189fa..5d848e1 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 _0x563c=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x563c,0x1c5));var _0xc563=function(_0x13f8bd,_0x57786f){_0x13f8bd=_0x13f8bd-0x0;var _0x5ab669=_0x563c[_0x13f8bd];return _0x5ab669;};'use strict';var multer=require(_0xc563('0x0'));var util=require(_0xc563('0x1'));var path=require(_0xc563('0x2'));var timeout=require(_0xc563('0x3'));var express=require(_0xc563('0x4'));var router=express[_0xc563('0x5')]();var auth=require(_0xc563('0x6'));var interaction=require(_0xc563('0x7'));var config=require(_0xc563('0x8'));var controller=require(_0xc563('0x9'));router[_0xc563('0xa')]('/',auth[_0xc563('0xb')](),controller[_0xc563('0xc')]);router[_0xc563('0xa')](_0xc563('0xd'),auth[_0xc563('0xb')](),controller[_0xc563('0xe')]);router[_0xc563('0xf')]('/',auth[_0xc563('0xb')](),controller[_0xc563('0x10')]);router[_0xc563('0x11')](_0xc563('0xd'),auth[_0xc563('0xb')](),controller[_0xc563('0x12')]);router[_0xc563('0x13')](_0xc563('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc563('0x14')]=router; \ No newline at end of file +var _0xec2a=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','post','/:id'];(function(_0x2b6e7c,_0xdb7ac4){var _0x29b018=function(_0x2dae14){while(--_0x2dae14){_0x2b6e7c['push'](_0x2b6e7c['shift']());}};_0x29b018(++_0xdb7ac4);}(_0xec2a,0x78));var _0xaec2=function(_0x566438,_0x3abb6a){_0x566438=_0x566438-0x0;var _0x2d8c26=_0xec2a[_0x566438];return _0x2d8c26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaec2('0x0'));var timeout=require(_0xaec2('0x1'));var express=require(_0xaec2('0x2'));var router=express[_0xaec2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaec2('0x4'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xaec2('0x5')]('/',auth[_0xaec2('0x6')](),controller[_0xaec2('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xaec2('0x8')]('/',auth[_0xaec2('0x6')](),controller['create']);router['put'](_0xaec2('0x9'),auth[_0xaec2('0x6')](),controller['update']);router[_0xaec2('0xa')]('/:id',auth[_0xaec2('0x6')](),controller[_0xaec2('0xb')]);module[_0xaec2('0xc')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 5e99aa3..acbdf4f 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 _0x3b19=['sequelize','exports','TEXT'];(function(_0x41273e,_0x1a8d3f){var _0x340241=function(_0x4fc648){while(--_0x4fc648){_0x41273e['push'](_0x41273e['shift']());}};_0x340241(++_0x1a8d3f);}(_0x3b19,0x1e3));var _0x93b1=function(_0x903a11,_0x27c893){_0x903a11=_0x903a11-0x0;var _0x546ac6=_0x3b19[_0x903a11];return _0x546ac6;};'use strict';var Sequelize=require(_0x93b1('0x0'));module[_0x93b1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x93b1('0x2')]}}; \ No newline at end of file +var _0x6881=['TEXT','sequelize','exports','STRING'];(function(_0x3bd815,_0x55c5a0){var _0xe5d391=function(_0x4be3bb){while(--_0x4be3bb){_0x3bd815['push'](_0x3bd815['shift']());}};_0xe5d391(++_0x55c5a0);}(_0x6881,0x1bd));var _0x1688=function(_0x9f7c3e,_0x20eef1){_0x9f7c3e=_0x9f7c3e-0x0;var _0x3dcd77=_0x6881[_0x9f7c3e];return _0x3dcd77;};'use strict';var Sequelize=require(_0x1688('0x0'));module[_0x1688('0x1')]={'name':{'type':Sequelize[_0x1688('0x2')]},'description':{'type':Sequelize[_0x1688('0x2')]},'html':{'type':Sequelize[_0x1688('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c163c6a..7323e3b 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 _0xfbd7=['moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','get','Templates','UserProfileResource','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x9607f6,_0x53fc57){var _0x5bf605=function(_0x168da7){while(--_0x168da7){_0x9607f6['push'](_0x9607f6['shift']());}};_0x5bf605(++_0x53fc57);}(_0xfbd7,0x191));var _0x7fbd=function(_0xd7d2ae,_0x99f8b2){_0xd7d2ae=_0xd7d2ae-0x0;var _0xc899a3=_0xfbd7[_0xd7d2ae];return _0xc899a3;};'use strict';var pdf=require(_0x7fbd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fbd('0x1'));var jsonpatch=require(_0x7fbd('0x2'));var rp=require(_0x7fbd('0x3'));var moment=require(_0x7fbd('0x4'));var BPromise=require(_0x7fbd('0x5'));var Mustache=require(_0x7fbd('0x6'));var util=require(_0x7fbd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7fbd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7fbd('0x9'));var squel=require(_0x7fbd('0xa'));var crypto=require(_0x7fbd('0xb'));var jsforce=require(_0x7fbd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7fbd('0x8'));var querystring=require(_0x7fbd('0xd'));var Papa=require(_0x7fbd('0xe'));var Redis=require('ioredis');var authService=require(_0x7fbd('0xf'));var qs=require(_0x7fbd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fbd('0x11'));var logger=require(_0x7fbd('0x12'))(_0x7fbd('0x13'));var utils=require(_0x7fbd('0x14'));var config=require(_0x7fbd('0x15'));var db=require(_0x7fbd('0x16'))['db'];function respondWithStatusCode(_0x58ebc5,_0x3d5c2a){_0x3d5c2a=_0x3d5c2a||0xcc;return function(_0x45ff57){if(_0x45ff57){return _0x58ebc5[_0x7fbd('0x17')](_0x3d5c2a);}return _0x58ebc5[_0x7fbd('0x18')](_0x3d5c2a)[_0x7fbd('0x19')]();};}function respondWithResult(_0x584d8c,_0x2b69cf){_0x2b69cf=_0x2b69cf||0xc8;return function(_0x553317){if(_0x553317){return _0x584d8c['status'](_0x2b69cf)['json'](_0x553317);}};}function respondWithFilteredResult(_0x4ecb70,_0x2846b8){return function(_0x33d4f0){if(_0x33d4f0){var _0x100397=_0x33d4f0[_0x7fbd('0x1a')],_0xeb0571=_0x2846b8['offset'],_0x447df9=_0x2846b8[_0x7fbd('0x1b')]+_0x2846b8[_0x7fbd('0x1c')],_0xc8a2e8;if(_0x447df9>=_0x100397){_0x447df9=_0x100397;_0xc8a2e8=0xc8;}else{_0xc8a2e8=0xce;}_0x4ecb70[_0x7fbd('0x18')](_0xc8a2e8);return _0x4ecb70['set'](_0x7fbd('0x1d'),_0xeb0571+'-'+_0x447df9+'/'+_0x100397)[_0x7fbd('0x1e')](_0x33d4f0);}return null;};}function patchUpdates(_0x52d1dd){return function(_0x293f32){try{jsonpatch[_0x7fbd('0x1f')](_0x293f32,_0x52d1dd,!![]);}catch(_0x5d8f16){return BPromise[_0x7fbd('0x20')](_0x5d8f16);}return _0x293f32['save']();};}function saveUpdates(_0x229619,_0x1c3d12){return function(_0x76ae5b){if(_0x76ae5b){return _0x76ae5b[_0x7fbd('0x21')](_0x229619)[_0x7fbd('0x22')](function(_0x3df8a5){return _0x3df8a5;});}return null;};}function removeEntity(_0x38c344,_0x4a1bae){return function(_0xaec716){if(_0xaec716){return _0xaec716[_0x7fbd('0x23')]()[_0x7fbd('0x22')](function(){var _0x21fcc6=_0xaec716[_0x7fbd('0x24')]({'plain':!![]});var _0x244f83=_0x7fbd('0x25');return db[_0x7fbd('0x26')][_0x7fbd('0x23')]({'where':{'type':_0x244f83,'resourceId':_0x21fcc6['id']}})[_0x7fbd('0x22')](function(){return _0xaec716;});})['then'](function(){_0x38c344['status'](0xcc)[_0x7fbd('0x19')]();});}};}function handleEntityNotFound(_0x56cce5,_0x4eca73){return function(_0x589bb8){if(!_0x589bb8){_0x56cce5[_0x7fbd('0x17')](0x194);}return _0x589bb8;};}function handleError(_0x36fa52,_0x2339fe){_0x2339fe=_0x2339fe||0x1f4;return function(_0x3a4363){logger['error'](_0x3a4363[_0x7fbd('0x27')]);if(_0x3a4363[_0x7fbd('0x28')]){delete _0x3a4363['name'];}_0x36fa52[_0x7fbd('0x18')](_0x2339fe)[_0x7fbd('0x29')](_0x3a4363);};}exports[_0x7fbd('0x2a')]=function(_0x4f1683,_0x19586c){var _0x4ce077={},_0x50a57e={},_0x5eb56f={'count':0x0,'rows':[]};var _0x44961a=_[_0x7fbd('0x2b')](db[_0x7fbd('0x2c')][_0x7fbd('0x2d')],function(_0xd04259){return{'name':_0xd04259[_0x7fbd('0x2e')],'type':_0xd04259[_0x7fbd('0x2f')][_0x7fbd('0x30')]};});_0x50a57e['model']=_[_0x7fbd('0x2b')](_0x44961a,'name');_0x50a57e[_0x7fbd('0x31')]=_['keys'](_0x4f1683['query']);_0x50a57e[_0x7fbd('0x32')]=_[_0x7fbd('0x33')](_0x50a57e[_0x7fbd('0x34')],_0x50a57e[_0x7fbd('0x31')]);_0x4ce077['attributes']=_[_0x7fbd('0x33')](_0x50a57e['model'],qs['fields'](_0x4f1683[_0x7fbd('0x31')][_0x7fbd('0x35')]));_0x4ce077[_0x7fbd('0x36')]=_0x4ce077['attributes'][_0x7fbd('0x37')]?_0x4ce077[_0x7fbd('0x36')]:_0x50a57e[_0x7fbd('0x34')];if(!_0x4f1683['query'][_0x7fbd('0x38')](_0x7fbd('0x39'))){_0x4ce077['limit']=qs['limit'](_0x4f1683[_0x7fbd('0x31')][_0x7fbd('0x1c')]);_0x4ce077['offset']=qs[_0x7fbd('0x1b')](_0x4f1683[_0x7fbd('0x31')]['offset']);}_0x4ce077[_0x7fbd('0x3a')]=qs[_0x7fbd('0x3b')](_0x4f1683[_0x7fbd('0x31')][_0x7fbd('0x3b')]);_0x4ce077[_0x7fbd('0x3c')]=qs[_0x7fbd('0x32')](_[_0x7fbd('0x3d')](_0x4f1683['query'],_0x50a57e[_0x7fbd('0x32')]),_0x44961a);if(_0x4f1683['query'][_0x7fbd('0x3e')]){_0x4ce077[_0x7fbd('0x3c')]=_[_0x7fbd('0x3f')](_0x4ce077[_0x7fbd('0x3c')],{'$or':_['map'](_0x44961a,function(_0x248c2e){if(_0x248c2e[_0x7fbd('0x2f')]!==_0x7fbd('0x40')){var _0x1f5762={};_0x1f5762[_0x248c2e['name']]={'$like':'%'+_0x4f1683[_0x7fbd('0x31')][_0x7fbd('0x3e')]+'%'};return _0x1f5762;}})});}_0x4ce077=_[_0x7fbd('0x3f')]({},_0x4ce077,_0x4f1683[_0x7fbd('0x41')]);var _0x40605b={'where':_0x4ce077[_0x7fbd('0x3c')]};return db[_0x7fbd('0x2c')][_0x7fbd('0x1a')](_0x40605b)[_0x7fbd('0x22')](function(_0x2d914c){_0x5eb56f['count']=_0x2d914c;if(_0x4f1683[_0x7fbd('0x31')]['includeAll']){_0x4ce077['include']=[{'all':!![]}];}return db[_0x7fbd('0x2c')]['findAll'](_0x4ce077);})[_0x7fbd('0x22')](function(_0x24b8ce){_0x5eb56f['rows']=_0x24b8ce;return _0x5eb56f;})[_0x7fbd('0x22')](respondWithFilteredResult(_0x19586c,_0x4ce077))[_0x7fbd('0x42')](handleError(_0x19586c,null));};exports[_0x7fbd('0x43')]=function(_0x18b369,_0x229752){var _0x52cb8c={'raw':!![],'where':{'id':_0x18b369[_0x7fbd('0x44')]['id']}},_0xbf715a={};_0xbf715a[_0x7fbd('0x34')]=_[_0x7fbd('0x45')](db[_0x7fbd('0x2c')][_0x7fbd('0x2d')]);_0xbf715a[_0x7fbd('0x31')]=_[_0x7fbd('0x45')](_0x18b369[_0x7fbd('0x31')]);_0xbf715a['filters']=_['intersection'](_0xbf715a[_0x7fbd('0x34')],_0xbf715a['query']);_0x52cb8c[_0x7fbd('0x36')]=_[_0x7fbd('0x33')](_0xbf715a[_0x7fbd('0x34')],qs[_0x7fbd('0x35')](_0x18b369[_0x7fbd('0x31')][_0x7fbd('0x35')]));_0x52cb8c[_0x7fbd('0x36')]=_0x52cb8c[_0x7fbd('0x36')][_0x7fbd('0x37')]?_0x52cb8c['attributes']:_0xbf715a[_0x7fbd('0x34')];if(_0x18b369[_0x7fbd('0x31')][_0x7fbd('0x46')]){_0x52cb8c['include']=[{'all':!![]}];}_0x52cb8c=_[_0x7fbd('0x3f')]({},_0x52cb8c,_0x18b369[_0x7fbd('0x41')]);return db['Template'][_0x7fbd('0x47')](_0x52cb8c)[_0x7fbd('0x22')](handleEntityNotFound(_0x229752,null))['then'](respondWithResult(_0x229752,null))['catch'](handleError(_0x229752,null));};exports[_0x7fbd('0x48')]=function(_0x54607a,_0x37e632){return db['Template'][_0x7fbd('0x48')](_0x54607a[_0x7fbd('0x49')],{})[_0x7fbd('0x22')](function(_0x372e11){var _0x3855e5=_0x54607a[_0x7fbd('0x4a')][_0x7fbd('0x24')]({'plain':!![]});if(!_0x3855e5)throw new Error(_0x7fbd('0x4b'));if(_0x3855e5[_0x7fbd('0x4c')]===_0x7fbd('0x4a')){var _0x283edb=_0x372e11['get']({'plain':!![]});var _0x2523ab=_0x7fbd('0x25');return db[_0x7fbd('0x4d')][_0x7fbd('0x47')]({'where':{'name':_0x2523ab,'userProfileId':_0x3855e5['userProfileId']},'raw':!![]})[_0x7fbd('0x22')](function(_0x27069b){if(_0x27069b&&_0x27069b[_0x7fbd('0x4e')]===0x0){return db[_0x7fbd('0x26')][_0x7fbd('0x48')]({'name':_0x283edb[_0x7fbd('0x28')],'resourceId':_0x283edb['id'],'type':_0x27069b[_0x7fbd('0x28')],'sectionId':_0x27069b['id']},{})[_0x7fbd('0x22')](function(){return _0x372e11;});}else{return _0x372e11;}})[_0x7fbd('0x42')](function(_0x139ca7){logger[_0x7fbd('0x4f')](_0x7fbd('0x50'),_0x139ca7);throw _0x139ca7;});}return _0x372e11;})[_0x7fbd('0x22')](respondWithResult(_0x37e632,0xc9))['catch'](handleError(_0x37e632,null));};exports[_0x7fbd('0x21')]=function(_0x5be755,_0x28dd13){if(_0x5be755[_0x7fbd('0x49')]['id']){delete _0x5be755[_0x7fbd('0x49')]['id'];}return db[_0x7fbd('0x2c')][_0x7fbd('0x47')]({'where':{'id':_0x5be755[_0x7fbd('0x44')]['id']}})[_0x7fbd('0x22')](handleEntityNotFound(_0x28dd13,null))['then'](saveUpdates(_0x5be755['body'],null))[_0x7fbd('0x22')](respondWithResult(_0x28dd13,null))[_0x7fbd('0x42')](handleError(_0x28dd13,null));};exports[_0x7fbd('0x23')]=function(_0x276897,_0x34bdc1){return db[_0x7fbd('0x2c')]['find']({'where':{'id':_0x276897[_0x7fbd('0x44')]['id']}})['then'](handleEntityNotFound(_0x34bdc1,null))[_0x7fbd('0x22')](removeEntity(_0x34bdc1,null))[_0x7fbd('0x42')](handleError(_0x34bdc1,null));}; \ No newline at end of file +var _0xef85=['limit','set','apply','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','count','offset'];(function(_0x5296fe,_0x52bf5b){var _0x43cadc=function(_0x364d87){while(--_0x364d87){_0x5296fe['push'](_0x5296fe['shift']());}};_0x43cadc(++_0x52bf5b);}(_0xef85,0x1d6));var _0x5ef8=function(_0x3ca578,_0x3f167d){_0x3ca578=_0x3ca578-0x0;var _0x2eee4e=_0xef85[_0x3ca578];return _0x2eee4e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5ef8('0x0'));var zipdir=require(_0x5ef8('0x1'));var jsonpatch=require(_0x5ef8('0x2'));var rp=require(_0x5ef8('0x3'));var moment=require(_0x5ef8('0x4'));var BPromise=require(_0x5ef8('0x5'));var Mustache=require(_0x5ef8('0x6'));var util=require(_0x5ef8('0x7'));var path=require(_0x5ef8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ef8('0x9'));var fs=require('fs');var _=require(_0x5ef8('0xa'));var squel=require(_0x5ef8('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ef8('0xc'));var deskjs=require(_0x5ef8('0xd'));var toCsv=require(_0x5ef8('0xe'));var querystring=require('querystring');var Papa=require(_0x5ef8('0xf'));var Redis=require(_0x5ef8('0x10'));var authService=require(_0x5ef8('0x11'));var qs=require(_0x5ef8('0x12'));var as=require(_0x5ef8('0x13'));var hardwareService=require(_0x5ef8('0x14'));var logger=require(_0x5ef8('0x15'))(_0x5ef8('0x16'));var utils=require('../../config/utils');var config=require(_0x5ef8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x300fe0,_0x48ccf4){_0x48ccf4=_0x48ccf4||0xcc;return function(_0x1873a2){if(_0x1873a2){return _0x300fe0['sendStatus'](_0x48ccf4);}return _0x300fe0[_0x5ef8('0x18')](_0x48ccf4)['end']();};}function respondWithResult(_0x206900,_0x1995a0){_0x1995a0=_0x1995a0||0xc8;return function(_0x195513){if(_0x195513){return _0x206900['status'](_0x1995a0)[_0x5ef8('0x19')](_0x195513);}};}function respondWithFilteredResult(_0x2dd7f9,_0x3e2cde){return function(_0x1ab21b){if(_0x1ab21b){var _0x2d83b2=_0x1ab21b[_0x5ef8('0x1a')],_0x325e77=_0x3e2cde[_0x5ef8('0x1b')],_0x72eb58=_0x3e2cde['offset']+_0x3e2cde[_0x5ef8('0x1c')],_0x84e4e6;if(_0x72eb58>=_0x2d83b2){_0x72eb58=_0x2d83b2;_0x84e4e6=0xc8;}else{_0x84e4e6=0xce;}_0x2dd7f9[_0x5ef8('0x18')](_0x84e4e6);return _0x2dd7f9[_0x5ef8('0x1d')]('Content-Range',_0x325e77+'-'+_0x72eb58+'/'+_0x2d83b2)[_0x5ef8('0x19')](_0x1ab21b);}return null;};}function patchUpdates(_0x470d0f){return function(_0xc0934){try{jsonpatch[_0x5ef8('0x1e')](_0xc0934,_0x470d0f,!![]);}catch(_0x3bcdcd){return BPromise['reject'](_0x3bcdcd);}return _0xc0934['save']();};}function saveUpdates(_0xa62585,_0x45e592){return function(_0x5a21bf){if(_0x5a21bf){return _0x5a21bf[_0x5ef8('0x1f')](_0xa62585)[_0x5ef8('0x20')](function(_0x1df287){return _0x1df287;});}return null;};}function removeEntity(_0x4d5779,_0x1ba6e7){return function(_0x1869a9){if(_0x1869a9){return _0x1869a9[_0x5ef8('0x21')]()['then'](function(){var _0x20c982=_0x1869a9[_0x5ef8('0x22')]({'plain':!![]});var _0x3dc042=_0x5ef8('0x23');return db[_0x5ef8('0x24')][_0x5ef8('0x21')]({'where':{'type':_0x3dc042,'resourceId':_0x20c982['id']}})[_0x5ef8('0x20')](function(){return _0x1869a9;});})[_0x5ef8('0x20')](function(){_0x4d5779[_0x5ef8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32bdd7,_0x4bbe1b){return function(_0x3ddcd6){if(!_0x3ddcd6){_0x32bdd7[_0x5ef8('0x25')](0x194);}return _0x3ddcd6;};}function handleError(_0x219145,_0x6fa26d){_0x6fa26d=_0x6fa26d||0x1f4;return function(_0x355815){logger[_0x5ef8('0x26')](_0x355815[_0x5ef8('0x27')]);if(_0x355815[_0x5ef8('0x28')]){delete _0x355815[_0x5ef8('0x28')];}_0x219145[_0x5ef8('0x18')](_0x6fa26d)[_0x5ef8('0x29')](_0x355815);};}exports[_0x5ef8('0x2a')]=function(_0x9cefab,_0x16530e){var _0x319709={},_0x535098={},_0x493e5a={'count':0x0,'rows':[]};var _0x2d75b6=_[_0x5ef8('0x2b')](db[_0x5ef8('0x2c')][_0x5ef8('0x2d')],function(_0x21066b){return{'name':_0x21066b['fieldName'],'type':_0x21066b[_0x5ef8('0x2e')][_0x5ef8('0x2f')]};});_0x535098[_0x5ef8('0x30')]=_[_0x5ef8('0x2b')](_0x2d75b6,_0x5ef8('0x28'));_0x535098[_0x5ef8('0x31')]=_[_0x5ef8('0x32')](_0x9cefab[_0x5ef8('0x31')]);_0x535098['filters']=_[_0x5ef8('0x33')](_0x535098[_0x5ef8('0x30')],_0x535098[_0x5ef8('0x31')]);_0x319709[_0x5ef8('0x34')]=_['intersection'](_0x535098[_0x5ef8('0x30')],qs[_0x5ef8('0x35')](_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x35')]));_0x319709[_0x5ef8('0x34')]=_0x319709[_0x5ef8('0x34')][_0x5ef8('0x36')]?_0x319709[_0x5ef8('0x34')]:_0x535098[_0x5ef8('0x30')];if(!_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x37')](_0x5ef8('0x38'))){_0x319709[_0x5ef8('0x1c')]=qs[_0x5ef8('0x1c')](_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x1c')]);_0x319709['offset']=qs[_0x5ef8('0x1b')](_0x9cefab['query'][_0x5ef8('0x1b')]);}_0x319709[_0x5ef8('0x39')]=qs[_0x5ef8('0x3a')](_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x3a')]);_0x319709[_0x5ef8('0x3b')]=qs[_0x5ef8('0x3c')](_[_0x5ef8('0x3d')](_0x9cefab['query'],_0x535098['filters']),_0x2d75b6);if(_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x3e')]){_0x319709[_0x5ef8('0x3b')]=_[_0x5ef8('0x3f')](_0x319709[_0x5ef8('0x3b')],{'$or':_[_0x5ef8('0x2b')](_0x2d75b6,function(_0xcd8fc4){if(_0xcd8fc4[_0x5ef8('0x2e')]!==_0x5ef8('0x40')){var _0x3093f0={};_0x3093f0[_0xcd8fc4[_0x5ef8('0x28')]]={'$like':'%'+_0x9cefab[_0x5ef8('0x31')][_0x5ef8('0x3e')]+'%'};return _0x3093f0;}})});}_0x319709=_[_0x5ef8('0x3f')]({},_0x319709,_0x9cefab[_0x5ef8('0x41')]);var _0x13c878={'where':_0x319709['where']};return db[_0x5ef8('0x2c')][_0x5ef8('0x1a')](_0x13c878)[_0x5ef8('0x20')](function(_0x551df1){_0x493e5a[_0x5ef8('0x1a')]=_0x551df1;if(_0x9cefab[_0x5ef8('0x31')]['includeAll']){_0x319709[_0x5ef8('0x42')]=[{'all':!![]}];}return db[_0x5ef8('0x2c')][_0x5ef8('0x43')](_0x319709);})['then'](function(_0x3b9740){_0x493e5a[_0x5ef8('0x44')]=_0x3b9740;return _0x493e5a;})[_0x5ef8('0x20')](respondWithFilteredResult(_0x16530e,_0x319709))['catch'](handleError(_0x16530e,null));};exports[_0x5ef8('0x45')]=function(_0x32b5dd,_0x5aad8a){var _0x2642cd={'raw':!![],'where':{'id':_0x32b5dd['params']['id']}},_0x19df84={};_0x19df84[_0x5ef8('0x30')]=_[_0x5ef8('0x32')](db[_0x5ef8('0x2c')]['rawAttributes']);_0x19df84[_0x5ef8('0x31')]=_[_0x5ef8('0x32')](_0x32b5dd[_0x5ef8('0x31')]);_0x19df84[_0x5ef8('0x3c')]=_[_0x5ef8('0x33')](_0x19df84[_0x5ef8('0x30')],_0x19df84[_0x5ef8('0x31')]);_0x2642cd[_0x5ef8('0x34')]=_[_0x5ef8('0x33')](_0x19df84[_0x5ef8('0x30')],qs['fields'](_0x32b5dd[_0x5ef8('0x31')][_0x5ef8('0x35')]));_0x2642cd[_0x5ef8('0x34')]=_0x2642cd[_0x5ef8('0x34')][_0x5ef8('0x36')]?_0x2642cd[_0x5ef8('0x34')]:_0x19df84[_0x5ef8('0x30')];if(_0x32b5dd[_0x5ef8('0x31')][_0x5ef8('0x46')]){_0x2642cd[_0x5ef8('0x42')]=[{'all':!![]}];}_0x2642cd=_[_0x5ef8('0x3f')]({},_0x2642cd,_0x32b5dd['options']);return db['Template'][_0x5ef8('0x47')](_0x2642cd)['then'](handleEntityNotFound(_0x5aad8a,null))[_0x5ef8('0x20')](respondWithResult(_0x5aad8a,null))[_0x5ef8('0x48')](handleError(_0x5aad8a,null));};exports[_0x5ef8('0x49')]=function(_0x5e764c,_0xd414ed){return db['Template'][_0x5ef8('0x49')](_0x5e764c[_0x5ef8('0x4a')],{})[_0x5ef8('0x20')](function(_0x5d39ef){var _0x493dbe=_0x5e764c['user'][_0x5ef8('0x22')]({'plain':!![]});if(!_0x493dbe)throw new Error(_0x5ef8('0x4b'));if(_0x493dbe[_0x5ef8('0x4c')]===_0x5ef8('0x4d')){var _0x4eab4a=_0x5d39ef['get']({'plain':!![]});var _0x28a821='Templates';return db[_0x5ef8('0x4e')][_0x5ef8('0x47')]({'where':{'name':_0x28a821,'userProfileId':_0x493dbe[_0x5ef8('0x4f')]},'raw':!![]})[_0x5ef8('0x20')](function(_0x5438a2){if(_0x5438a2&&_0x5438a2[_0x5ef8('0x50')]===0x0){return db[_0x5ef8('0x24')][_0x5ef8('0x49')]({'name':_0x4eab4a[_0x5ef8('0x28')],'resourceId':_0x4eab4a['id'],'type':_0x5438a2[_0x5ef8('0x28')],'sectionId':_0x5438a2['id']},{})['then'](function(){return _0x5d39ef;});}else{return _0x5d39ef;}})[_0x5ef8('0x48')](function(_0x42df7a){logger[_0x5ef8('0x26')](_0x5ef8('0x51'),_0x42df7a);throw _0x42df7a;});}return _0x5d39ef;})[_0x5ef8('0x20')](respondWithResult(_0xd414ed,0xc9))[_0x5ef8('0x48')](handleError(_0xd414ed,null));};exports[_0x5ef8('0x1f')]=function(_0x11aa7f,_0x350a44){if(_0x11aa7f[_0x5ef8('0x4a')]['id']){delete _0x11aa7f[_0x5ef8('0x4a')]['id'];}return db[_0x5ef8('0x2c')][_0x5ef8('0x47')]({'where':{'id':_0x11aa7f[_0x5ef8('0x52')]['id']}})[_0x5ef8('0x20')](handleEntityNotFound(_0x350a44,null))[_0x5ef8('0x20')](saveUpdates(_0x11aa7f[_0x5ef8('0x4a')],null))[_0x5ef8('0x20')](respondWithResult(_0x350a44,null))[_0x5ef8('0x48')](handleError(_0x350a44,null));};exports[_0x5ef8('0x21')]=function(_0x1bd156,_0x150733){return db[_0x5ef8('0x2c')][_0x5ef8('0x47')]({'where':{'id':_0x1bd156['params']['id']}})['then'](handleEntityNotFound(_0x150733,null))[_0x5ef8('0x20')](removeEntity(_0x150733,null))[_0x5ef8('0x48')](handleError(_0x150733,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8076cd5..c35626c 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 _0x6439=['tools_templates','util','../../config/logger','moment','bluebird','request-promise','./template.attributes','exports','define','Template'];(function(_0x37e011,_0x34144f){var _0x5a4c87=function(_0x5e07fe){while(--_0x5e07fe){_0x37e011['push'](_0x37e011['shift']());}};_0x5a4c87(++_0x34144f);}(_0x6439,0xc9));var _0x9643=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x6439[_0x20589d];return _0x422de9;};'use strict';var _=require('lodash');var util=require(_0x9643('0x0'));var logger=require(_0x9643('0x1'))('api');var moment=require(_0x9643('0x2'));var BPromise=require(_0x9643('0x3'));var rp=require(_0x9643('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9643('0x5'));module[_0x9643('0x6')]=function(_0x1b7c53,_0x30b64b){return _0x1b7c53[_0x9643('0x7')](_0x9643('0x8'),attributes,{'tableName':_0x9643('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x901e=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash'];(function(_0x5d3396,_0x29fbd3){var _0x5196d1=function(_0x540617){while(--_0x540617){_0x5d3396['push'](_0x5d3396['shift']());}};_0x5196d1(++_0x29fbd3);}(_0x901e,0x1a1));var _0xe901=function(_0x4152fa,_0x6dc7a3){_0x4152fa=_0x4152fa-0x0;var _0x3c3779=_0x901e[_0x4152fa];return _0x3c3779;};'use strict';var _=require(_0xe901('0x0'));var util=require(_0xe901('0x1'));var logger=require(_0xe901('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe901('0x3'));var rp=require(_0xe901('0x4'));var fs=require('fs');var path=require(_0xe901('0x5'));var rimraf=require('rimraf');var config=require(_0xe901('0x6'));var attributes=require(_0xe901('0x7'));module['exports']=function(_0x93a36a,_0x5632da){return _0x93a36a[_0xe901('0x8')](_0xe901('0x9'),attributes,{'tableName':_0xe901('0xa'),'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 64bc8f1..e0eb43b 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 _0xb2f4=['info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Template','findAll','options','where','attributes','limit','include','model','map','then','GetTemplate','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb2f4,0x180));var _0x4b2f=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xb2f4[_0x368587];return _0x42d33c;};'use strict';var _=require(_0x4b2f('0x0'));var util=require(_0x4b2f('0x1'));var moment=require(_0x4b2f('0x2'));var BPromise=require(_0x4b2f('0x3'));var rs=require(_0x4b2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b2f('0x5'))['db'];var utils=require(_0x4b2f('0x6'));var logger=require(_0x4b2f('0x7'))(_0x4b2f('0x8'));var config=require(_0x4b2f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4b2f('0xa')][_0x4b2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b7c3f,_0x292e4c,_0x37c39d){return new BPromise(function(_0x48661e,_0xa5ad69){return client['request'](_0x2b7c3f,_0x37c39d)['then'](function(_0x2836be){logger[_0x4b2f('0xc')](_0x4b2f('0xd'),_0x292e4c,_0x4b2f('0xe'));logger['debug'](_0x4b2f('0xf'),_0x292e4c,_0x4b2f('0xe'),JSON[_0x4b2f('0x10')](_0x2836be));if(_0x2836be[_0x4b2f('0x11')]){if(_0x2836be['error']['code']===0x1f4){logger['error'](_0x4b2f('0xd'),_0x292e4c,_0x2836be[_0x4b2f('0x11')][_0x4b2f('0x12')]);return _0xa5ad69(_0x2836be[_0x4b2f('0x11')][_0x4b2f('0x12')]);}logger['error'](_0x4b2f('0xd'),_0x292e4c,_0x2836be['error'][_0x4b2f('0x12')]);return _0x48661e(_0x2836be['error'][_0x4b2f('0x12')]);}else{logger[_0x4b2f('0xc')](_0x4b2f('0xd'),_0x292e4c,'request\x20sent');_0x48661e(_0x2836be[_0x4b2f('0x13')][_0x4b2f('0x12')]);}})['catch'](function(_0x401dfc){logger[_0x4b2f('0x11')](_0x4b2f('0xd'),_0x292e4c,_0x401dfc);_0xa5ad69(_0x401dfc);});});}exports['GetTemplate']=function(_0x556ca5){var _0x49d4a7=this;return new Promise(function(_0x5a2567,_0xae0ada){return db[_0x4b2f('0x14')][_0x4b2f('0x15')]({'raw':_0x556ca5[_0x4b2f('0x16')]?_0x556ca5[_0x4b2f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x556ca5[_0x4b2f('0x16')]?_0x556ca5[_0x4b2f('0x16')][_0x4b2f('0x17')]||null:null,'attributes':_0x556ca5['options']?_0x556ca5['options'][_0x4b2f('0x18')]||null:null,'limit':_0x556ca5['options']?_0x556ca5[_0x4b2f('0x16')][_0x4b2f('0x19')]||null:null,'include':_0x556ca5['options']?_0x556ca5[_0x4b2f('0x16')][_0x4b2f('0x1a')]?_['map'](_0x556ca5[_0x4b2f('0x16')][_0x4b2f('0x1a')],function(_0x4952af){return{'model':db[_0x4952af['model']],'as':_0x4952af['as'],'attributes':_0x4952af['attributes'],'include':_0x4952af[_0x4b2f('0x1a')]?_['map'](_0x4952af[_0x4b2f('0x1a')],function(_0x3456d8){return{'model':db[_0x3456d8[_0x4b2f('0x1b')]],'as':_0x3456d8['as'],'attributes':_0x3456d8[_0x4b2f('0x18')],'include':_0x3456d8['include']?_[_0x4b2f('0x1c')](_0x3456d8[_0x4b2f('0x1a')],function(_0x2fbe47){return{'model':db[_0x2fbe47[_0x4b2f('0x1b')]],'as':_0x2fbe47['as'],'attributes':_0x2fbe47[_0x4b2f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4b2f('0x1d')](function(_0x502a82){logger[_0x4b2f('0xc')](_0x4b2f('0x1e'),_0x556ca5);logger[_0x4b2f('0x1f')]('GetTemplate',_0x556ca5,JSON[_0x4b2f('0x10')](_0x502a82));_0x5a2567(_0x502a82);})[_0x4b2f('0x20')](function(_0x2a88d4){logger[_0x4b2f('0x11')]('GetTemplate',_0x2a88d4['message'],_0x556ca5);_0xae0ada(_0x49d4a7['error'](0x1f4,_0x2a88d4[_0x4b2f('0x12')]));});});}; \ No newline at end of file +var _0xe983=['http','request','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Template','findAll','options','raw','where','limit','include','map','attributes','model','GetTemplate','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23928f,_0x14dbba){var _0x59b366=function(_0x4a2ae5){while(--_0x4a2ae5){_0x23928f['push'](_0x23928f['shift']());}};_0x59b366(++_0x14dbba);}(_0xe983,0x137));var _0x3e98=function(_0x2d4e6b,_0x3fdc30){_0x2d4e6b=_0x2d4e6b-0x0;var _0x222517=_0xe983[_0x2d4e6b];return _0x222517;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e98('0x0'));var BPromise=require(_0x3e98('0x1'));var rs=require(_0x3e98('0x2'));var fs=require('fs');var Redis=require(_0x3e98('0x3'));var db=require(_0x3e98('0x4'))['db'];var utils=require(_0x3e98('0x5'));var logger=require(_0x3e98('0x6'))(_0x3e98('0x7'));var config=require(_0x3e98('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x190770,_0x27441c,_0x3d0265){return new BPromise(function(_0x42ebc2,_0x42b489){return client[_0x3e98('0xa')](_0x190770,_0x3d0265)['then'](function(_0x41e898){logger['info'](_0x3e98('0xb'),_0x27441c,_0x3e98('0xc'));logger['debug'](_0x3e98('0xd'),_0x27441c,_0x3e98('0xc'),JSON[_0x3e98('0xe')](_0x41e898));if(_0x41e898[_0x3e98('0xf')]){if(_0x41e898['error'][_0x3e98('0x10')]===0x1f4){logger['error'](_0x3e98('0xb'),_0x27441c,_0x41e898[_0x3e98('0xf')][_0x3e98('0x11')]);return _0x42b489(_0x41e898[_0x3e98('0xf')][_0x3e98('0x11')]);}logger[_0x3e98('0xf')](_0x3e98('0xb'),_0x27441c,_0x41e898[_0x3e98('0xf')]['message']);return _0x42ebc2(_0x41e898['error']['message']);}else{logger[_0x3e98('0x12')]('Template,\x20%s,\x20%s',_0x27441c,_0x3e98('0xc'));_0x42ebc2(_0x41e898[_0x3e98('0x13')][_0x3e98('0x11')]);}})[_0x3e98('0x14')](function(_0x1923eb){logger[_0x3e98('0xf')](_0x3e98('0xb'),_0x27441c,_0x1923eb);_0x42b489(_0x1923eb);});});}exports['GetTemplate']=function(_0x197458){var _0x419aab=this;return new Promise(function(_0x12f4e8,_0x750e9c){return db[_0x3e98('0x15')][_0x3e98('0x16')]({'raw':_0x197458[_0x3e98('0x17')]?_0x197458[_0x3e98('0x17')][_0x3e98('0x18')]===undefined?!![]:![]:!![],'where':_0x197458[_0x3e98('0x17')]?_0x197458['options'][_0x3e98('0x19')]||null:null,'attributes':_0x197458['options']?_0x197458[_0x3e98('0x17')]['attributes']||null:null,'limit':_0x197458[_0x3e98('0x17')]?_0x197458['options'][_0x3e98('0x1a')]||null:null,'include':_0x197458['options']?_0x197458[_0x3e98('0x17')][_0x3e98('0x1b')]?_[_0x3e98('0x1c')](_0x197458[_0x3e98('0x17')][_0x3e98('0x1b')],function(_0xe6329b){return{'model':db[_0xe6329b['model']],'as':_0xe6329b['as'],'attributes':_0xe6329b[_0x3e98('0x1d')],'include':_0xe6329b[_0x3e98('0x1b')]?_['map'](_0xe6329b[_0x3e98('0x1b')],function(_0x175fef){return{'model':db[_0x175fef[_0x3e98('0x1e')]],'as':_0x175fef['as'],'attributes':_0x175fef[_0x3e98('0x1d')],'include':_0x175fef[_0x3e98('0x1b')]?_[_0x3e98('0x1c')](_0x175fef[_0x3e98('0x1b')],function(_0x4f4ba6){return{'model':db[_0x4f4ba6[_0x3e98('0x1e')]],'as':_0x4f4ba6['as'],'attributes':_0x4f4ba6[_0x3e98('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2638f4){logger[_0x3e98('0x12')](_0x3e98('0x1f'),_0x197458);logger['debug'](_0x3e98('0x1f'),_0x197458,JSON['stringify'](_0x2638f4));_0x12f4e8(_0x2638f4);})[_0x3e98('0x14')](function(_0x418b78){logger[_0x3e98('0xf')]('GetTemplate',_0x418b78[_0x3e98('0x11')],_0x197458);_0x750e9c(_0x419aab['error'](0x1f4,_0x418b78[_0x3e98('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index eca3270..c9b531a 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 _0x9029=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','create','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x300516,_0x3d8128){var _0x4ea541=function(_0xdfddde){while(--_0xdfddde){_0x300516['push'](_0x300516['shift']());}};_0x4ea541(++_0x3d8128);}(_0x9029,0xed));var _0x9902=function(_0x56231f,_0x55bb4d){_0x56231f=_0x56231f-0x0;var _0x31bc44=_0x9029[_0x56231f];return _0x31bc44;};'use strict';var multer=require('multer');var util=require(_0x9902('0x0'));var path=require(_0x9902('0x1'));var timeout=require(_0x9902('0x2'));var express=require(_0x9902('0x3'));var router=express[_0x9902('0x4')]();var auth=require(_0x9902('0x5'));var interaction=require(_0x9902('0x6'));var config=require(_0x9902('0x7'));var controller=require('./trigger.controller');router[_0x9902('0x8')]('/',auth[_0x9902('0x9')](),controller[_0x9902('0xa')]);router[_0x9902('0x8')](_0x9902('0xb'),auth[_0x9902('0x9')](),controller[_0x9902('0xc')]);router['get'](_0x9902('0xd'),auth[_0x9902('0x9')](),controller['getAllConditions']);router['get'](_0x9902('0xe'),auth[_0x9902('0x9')](),controller[_0x9902('0xf')]);router[_0x9902('0x8')]('/:id/actions',auth[_0x9902('0x9')](),controller[_0x9902('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9902('0x11')]);router[_0x9902('0x12')](_0x9902('0xd'),auth[_0x9902('0x9')](),controller[_0x9902('0x13')]);router[_0x9902('0x12')](_0x9902('0xe'),auth[_0x9902('0x9')](),controller[_0x9902('0x14')]);router[_0x9902('0x12')](_0x9902('0x15'),auth['isAuthenticated'](),controller[_0x9902('0x16')]);router[_0x9902('0x17')]('/:id',auth[_0x9902('0x9')](),controller['update']);router['delete'](_0x9902('0xb'),auth['isAuthenticated'](),controller[_0x9902('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1c81=['create','/:id/all_conditions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x236daf,_0x485b75){var _0x43f75e=function(_0x3b91b1){while(--_0x3b91b1){_0x236daf['push'](_0x236daf['shift']());}};_0x43f75e(++_0x485b75);}(_0x1c81,0x1a6));var _0x11c8=function(_0x6fcdcc,_0x34e546){_0x6fcdcc=_0x6fcdcc-0x0;var _0x15b584=_0x1c81[_0x6fcdcc];return _0x15b584;};'use strict';var multer=require(_0x11c8('0x0'));var util=require(_0x11c8('0x1'));var path=require(_0x11c8('0x2'));var timeout=require(_0x11c8('0x3'));var express=require(_0x11c8('0x4'));var router=express[_0x11c8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x11c8('0x6'));var config=require(_0x11c8('0x7'));var controller=require(_0x11c8('0x8'));router[_0x11c8('0x9')]('/',auth[_0x11c8('0xa')](),controller[_0x11c8('0xb')]);router[_0x11c8('0x9')](_0x11c8('0xc'),auth['isAuthenticated'](),controller[_0x11c8('0xd')]);router['get']('/:id/all_conditions',auth[_0x11c8('0xa')](),controller[_0x11c8('0xe')]);router[_0x11c8('0x9')](_0x11c8('0xf'),auth[_0x11c8('0xa')](),controller[_0x11c8('0x10')]);router[_0x11c8('0x9')](_0x11c8('0x11'),auth[_0x11c8('0xa')](),controller[_0x11c8('0x12')]);router[_0x11c8('0x13')]('/',auth[_0x11c8('0xa')](),controller[_0x11c8('0x14')]);router[_0x11c8('0x13')](_0x11c8('0x15'),auth[_0x11c8('0xa')](),controller['addAllCondition']);router['post'](_0x11c8('0xf'),auth[_0x11c8('0xa')](),controller['addAnyCondition']);router[_0x11c8('0x13')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x11c8('0x16')](_0x11c8('0xc'),auth[_0x11c8('0xa')](),controller[_0x11c8('0x17')]);router['delete'](_0x11c8('0xc'),auth['isAuthenticated'](),controller[_0x11c8('0x18')]);module[_0x11c8('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8bc73cf..b319ce2 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 _0x5ce1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1ba88a,_0x30b1d8){var _0x5d0fe7=function(_0x3dfd87){while(--_0x3dfd87){_0x1ba88a['push'](_0x1ba88a['shift']());}};_0x5d0fe7(++_0x30b1d8);}(_0x5ce1,0xe7));var _0x15ce=function(_0x1557b1,_0x3d4ff4){_0x1557b1=_0x1557b1-0x0;var _0xb673c6=_0x5ce1[_0x1557b1];return _0xb673c6;};'use strict';var Sequelize=require(_0x15ce('0x0'));module[_0x15ce('0x1')]={'name':{'type':Sequelize[_0x15ce('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x15ce('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe56b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe56b,0x148));var _0xbe56=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe56b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xbe56('0x0'));module[_0xbe56('0x1')]={'name':{'type':Sequelize[_0xbe56('0x2')]},'channel':{'type':Sequelize[_0xbe56('0x2')]},'description':{'type':Sequelize[_0xbe56('0x2')]},'status':{'type':Sequelize[_0xbe56('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4e68889..4bfe8ce 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 _0x6f27=['end','send','index','map','Trigger','rawAttributes','type','name','query','keys','model','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','create','addAnyCondition','TriggerAnyId','getAllConditions','nolimit','findOne','getAnyConditions','Action','getActions','html-pdf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','destroy','Triggers','UserProfileResource'];(function(_0x46c6a2,_0x441de6){var _0x3d6fe8=function(_0x3791a9){while(--_0x3791a9){_0x46c6a2['push'](_0x46c6a2['shift']());}};_0x3d6fe8(++_0x441de6);}(_0x6f27,0x1ac));var _0x76f2=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0x6f27[_0x38a6c6];return _0x142f0a;};'use strict';var pdf=require(_0x76f2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x76f2('0x1'));var moment=require(_0x76f2('0x2'));var BPromise=require(_0x76f2('0x3'));var Mustache=require(_0x76f2('0x4'));var util=require(_0x76f2('0x5'));var path=require(_0x76f2('0x6'));var sox=require('sox');var csv=require(_0x76f2('0x7'));var ejs=require(_0x76f2('0x8'));var fs=require('fs');var _=require(_0x76f2('0x9'));var squel=require(_0x76f2('0xa'));var crypto=require(_0x76f2('0xb'));var jsforce=require(_0x76f2('0xc'));var deskjs=require(_0x76f2('0xd'));var toCsv=require(_0x76f2('0x7'));var querystring=require(_0x76f2('0xe'));var Papa=require(_0x76f2('0xf'));var Redis=require(_0x76f2('0x10'));var authService=require(_0x76f2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76f2('0x12'));var logger=require(_0x76f2('0x13'))(_0x76f2('0x14'));var utils=require(_0x76f2('0x15'));var config=require(_0x76f2('0x16'));var db=require(_0x76f2('0x17'))['db'];function respondWithStatusCode(_0x2a12d3,_0x77565d){_0x77565d=_0x77565d||0xcc;return function(_0x2fc3f5){if(_0x2fc3f5){return _0x2a12d3[_0x76f2('0x18')](_0x77565d);}return _0x2a12d3['status'](_0x77565d)['end']();};}function respondWithResult(_0x2051cd,_0x3482ff){_0x3482ff=_0x3482ff||0xc8;return function(_0x382dd7){if(_0x382dd7){return _0x2051cd[_0x76f2('0x19')](_0x3482ff)[_0x76f2('0x1a')](_0x382dd7);}};}function respondWithFilteredResult(_0x3bed5d,_0x2bbdb0){return function(_0x541c17){if(_0x541c17){var _0x16390b=_0x541c17['count'],_0x1ecca5=_0x2bbdb0[_0x76f2('0x1b')],_0x5ec7e6=_0x2bbdb0['offset']+_0x2bbdb0['limit'],_0x3dfd2a;if(_0x5ec7e6>=_0x16390b){_0x5ec7e6=_0x16390b;_0x3dfd2a=0xc8;}else{_0x3dfd2a=0xce;}_0x3bed5d[_0x76f2('0x19')](_0x3dfd2a);return _0x3bed5d[_0x76f2('0x1c')](_0x76f2('0x1d'),_0x1ecca5+'-'+_0x5ec7e6+'/'+_0x16390b)[_0x76f2('0x1a')](_0x541c17);}return null;};}function patchUpdates(_0x53f825){return function(_0x2a18d8){try{jsonpatch['apply'](_0x2a18d8,_0x53f825,!![]);}catch(_0xa89a71){return BPromise[_0x76f2('0x1e')](_0xa89a71);}return _0x2a18d8[_0x76f2('0x1f')]();};}function saveUpdates(_0x39f711,_0x57a4c9){return function(_0x4ec40a){if(_0x4ec40a){return _0x4ec40a[_0x76f2('0x20')](_0x39f711)[_0x76f2('0x21')](function(_0x5cdca7){return _0x5cdca7;});}return null;};}function removeEntity(_0x4f89ba,_0x198df5){return function(_0x314c47){if(_0x314c47){return _0x314c47[_0x76f2('0x22')]()[_0x76f2('0x21')](function(){var _0xff7bf1=_0x314c47['get']({'plain':!![]});var _0x399723=_0x76f2('0x23');return db[_0x76f2('0x24')][_0x76f2('0x22')]({'where':{'type':_0x399723,'resourceId':_0xff7bf1['id']}})[_0x76f2('0x21')](function(){return _0x314c47;});})[_0x76f2('0x21')](function(){_0x4f89ba[_0x76f2('0x19')](0xcc)[_0x76f2('0x25')]();});}};}function handleEntityNotFound(_0x28c224,_0x10ee5e){return function(_0x5f2b81){if(!_0x5f2b81){_0x28c224[_0x76f2('0x18')](0x194);}return _0x5f2b81;};}function handleError(_0x439b8f,_0x724c27){_0x724c27=_0x724c27||0x1f4;return function(_0x183a57){logger['error'](_0x183a57['stack']);if(_0x183a57['name']){delete _0x183a57['name'];}_0x439b8f[_0x76f2('0x19')](_0x724c27)[_0x76f2('0x26')](_0x183a57);};}exports[_0x76f2('0x27')]=function(_0x38154f,_0x40fe8d){var _0x586e40={},_0x3a84fa={},_0x1537c7={'count':0x0,'rows':[]};var _0x34aa5d=_[_0x76f2('0x28')](db[_0x76f2('0x29')][_0x76f2('0x2a')],function(_0x5ab58c){return{'name':_0x5ab58c['fieldName'],'type':_0x5ab58c[_0x76f2('0x2b')]['key']};});_0x3a84fa['model']=_['map'](_0x34aa5d,_0x76f2('0x2c'));_0x3a84fa[_0x76f2('0x2d')]=_[_0x76f2('0x2e')](_0x38154f[_0x76f2('0x2d')]);_0x3a84fa['filters']=_['intersection'](_0x3a84fa[_0x76f2('0x2f')],_0x3a84fa[_0x76f2('0x2d')]);_0x586e40['attributes']=_[_0x76f2('0x30')](_0x3a84fa[_0x76f2('0x2f')],qs['fields'](_0x38154f['query'][_0x76f2('0x31')]));_0x586e40[_0x76f2('0x32')]=_0x586e40[_0x76f2('0x32')]['length']?_0x586e40[_0x76f2('0x32')]:_0x3a84fa['model'];if(!_0x38154f[_0x76f2('0x2d')][_0x76f2('0x33')]('nolimit')){_0x586e40['limit']=qs[_0x76f2('0x34')](_0x38154f[_0x76f2('0x2d')]['limit']);_0x586e40[_0x76f2('0x1b')]=qs['offset'](_0x38154f[_0x76f2('0x2d')]['offset']);}_0x586e40[_0x76f2('0x35')]=qs[_0x76f2('0x36')](_0x38154f[_0x76f2('0x2d')][_0x76f2('0x36')]);_0x586e40[_0x76f2('0x37')]=qs[_0x76f2('0x38')](_[_0x76f2('0x39')](_0x38154f[_0x76f2('0x2d')],_0x3a84fa[_0x76f2('0x38')]),_0x34aa5d);if(_0x38154f[_0x76f2('0x2d')][_0x76f2('0x3a')]){_0x586e40[_0x76f2('0x37')]=_['merge'](_0x586e40[_0x76f2('0x37')],{'$or':_[_0x76f2('0x28')](_0x34aa5d,function(_0x3d1412){if(_0x3d1412[_0x76f2('0x2b')]!==_0x76f2('0x3b')){var _0x394105={};_0x394105[_0x3d1412[_0x76f2('0x2c')]]={'$like':'%'+_0x38154f['query'][_0x76f2('0x3a')]+'%'};return _0x394105;}})});}_0x586e40=_[_0x76f2('0x3c')]({},_0x586e40,_0x38154f[_0x76f2('0x3d')]);var _0x116c93={'where':_0x586e40[_0x76f2('0x37')]};return db['Trigger'][_0x76f2('0x3e')](_0x116c93)['then'](function(_0x2cda49){_0x1537c7[_0x76f2('0x3e')]=_0x2cda49;if(_0x38154f[_0x76f2('0x2d')][_0x76f2('0x3f')]){_0x586e40[_0x76f2('0x40')]=[{'all':!![]}];}return db['Trigger'][_0x76f2('0x41')](_0x586e40);})[_0x76f2('0x21')](function(_0x4637b4){_0x1537c7[_0x76f2('0x42')]=_0x4637b4;return _0x1537c7;})['then'](respondWithFilteredResult(_0x40fe8d,_0x586e40))['catch'](handleError(_0x40fe8d,null));};exports[_0x76f2('0x43')]=function(_0x9a8bb9,_0x3b8cac){var _0x36c204={'raw':![],'where':{'id':_0x9a8bb9['params']['id']}},_0x3b245b={};_0x3b245b['model']=_[_0x76f2('0x2e')](db[_0x76f2('0x29')][_0x76f2('0x2a')]);_0x3b245b[_0x76f2('0x2d')]=_['keys'](_0x9a8bb9['query']);_0x3b245b['filters']=_['intersection'](_0x3b245b[_0x76f2('0x2f')],_0x3b245b[_0x76f2('0x2d')]);_0x36c204[_0x76f2('0x32')]=_[_0x76f2('0x30')](_0x3b245b['model'],qs['fields'](_0x9a8bb9[_0x76f2('0x2d')][_0x76f2('0x31')]));_0x36c204[_0x76f2('0x32')]=_0x36c204[_0x76f2('0x32')][_0x76f2('0x44')]?_0x36c204[_0x76f2('0x32')]:_0x3b245b[_0x76f2('0x2f')];if(_0x9a8bb9['query'][_0x76f2('0x3f')]){_0x36c204[_0x76f2('0x40')]=[{'all':!![]}];}_0x36c204=_['merge']({},_0x36c204,_0x9a8bb9[_0x76f2('0x3d')]);return db['Trigger'][_0x76f2('0x45')](_0x36c204)['then'](handleEntityNotFound(_0x3b8cac,null))[_0x76f2('0x21')](respondWithResult(_0x3b8cac,null))['catch'](handleError(_0x3b8cac,null));};exports['create']=function(_0x286aa6,_0x535301){return db[_0x76f2('0x29')]['create'](_0x286aa6[_0x76f2('0x46')],{})[_0x76f2('0x21')](function(_0xf46156){var _0x5b1e08=_0x286aa6[_0x76f2('0x47')][_0x76f2('0x48')]({'plain':!![]});if(!_0x5b1e08)throw new Error(_0x76f2('0x49'));if(_0x5b1e08[_0x76f2('0x4a')]===_0x76f2('0x47')){var _0x3ad1b0=_0xf46156[_0x76f2('0x48')]({'plain':!![]});var _0x4b715f='Triggers';return db[_0x76f2('0x4b')][_0x76f2('0x45')]({'where':{'name':_0x4b715f,'userProfileId':_0x5b1e08[_0x76f2('0x4c')]},'raw':!![]})['then'](function(_0x889aab){if(_0x889aab&&_0x889aab['autoAssociation']===0x0){return db[_0x76f2('0x24')]['create']({'name':_0x3ad1b0[_0x76f2('0x2c')],'resourceId':_0x3ad1b0['id'],'type':_0x889aab[_0x76f2('0x2c')],'sectionId':_0x889aab['id']},{})[_0x76f2('0x21')](function(){return _0xf46156;});}else{return _0xf46156;}})[_0x76f2('0x4d')](function(_0x110aac){logger[_0x76f2('0x4e')](_0x76f2('0x4f'),_0x110aac);throw _0x110aac;});}return _0xf46156;})['then'](respondWithResult(_0x535301,0xc9))[_0x76f2('0x4d')](handleError(_0x535301,null));};exports[_0x76f2('0x20')]=function(_0x299c4b,_0x1f4178){if(_0x299c4b['body']['id']){delete _0x299c4b['body']['id'];}return db[_0x76f2('0x29')][_0x76f2('0x45')]({'where':{'id':_0x299c4b[_0x76f2('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f4178,null))[_0x76f2('0x21')](saveUpdates(_0x299c4b['body'],null))[_0x76f2('0x21')](respondWithResult(_0x1f4178,null))[_0x76f2('0x4d')](handleError(_0x1f4178,null));};exports[_0x76f2('0x22')]=function(_0x2bbf33,_0x55b532){return db[_0x76f2('0x29')]['find']({'where':{'id':_0x2bbf33[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x55b532,null))[_0x76f2('0x21')](removeEntity(_0x55b532,null))[_0x76f2('0x4d')](handleError(_0x55b532,null));};exports[_0x76f2('0x51')]=function(_0x1715d7,_0x28d6e0,_0x2c7254){if(_0x1715d7[_0x76f2('0x46')]['id']){delete _0x1715d7[_0x76f2('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1715d7[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x28d6e0,null))[_0x76f2('0x21')](function(_0x2984ed){if(_0x2984ed){_0x1715d7[_0x76f2('0x46')][_0x76f2('0x52')]=_0x2984ed['id'];return db[_0x76f2('0x53')][_0x76f2('0x54')](_0x1715d7[_0x76f2('0x46')]);}})[_0x76f2('0x21')](respondWithResult(_0x28d6e0,null))[_0x76f2('0x4d')](handleError(_0x28d6e0,null));};exports[_0x76f2('0x55')]=function(_0x3fe1a8,_0x97bef9,_0x2b7ccb){if(_0x3fe1a8[_0x76f2('0x46')]['id']){delete _0x3fe1a8[_0x76f2('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3fe1a8[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x97bef9,null))['then'](function(_0x6b9361){if(_0x6b9361){_0x3fe1a8['body'][_0x76f2('0x56')]=_0x6b9361['id'];return db[_0x76f2('0x53')][_0x76f2('0x54')](_0x3fe1a8[_0x76f2('0x46')]);}})[_0x76f2('0x21')](respondWithResult(_0x97bef9,null))[_0x76f2('0x4d')](handleError(_0x97bef9,null));};exports[_0x76f2('0x57')]=function(_0x3cf573,_0x5a8d2a,_0x3a82dd){var _0xbee1e8={};var _0x55d3f={};var _0x3321d5;var _0x35d132;return db[_0x76f2('0x29')]['findOne']({'where':{'id':_0x3cf573['params']['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x5a8d2a,null))[_0x76f2('0x21')](function(_0x1e0839){if(_0x1e0839){_0x3321d5=_0x1e0839;_0x55d3f[_0x76f2('0x2f')]=_[_0x76f2('0x2e')](db[_0x76f2('0x53')]['rawAttributes']);_0x55d3f[_0x76f2('0x2d')]=_['keys'](_0x3cf573[_0x76f2('0x2d')]);_0x55d3f[_0x76f2('0x38')]=_[_0x76f2('0x30')](_0x55d3f[_0x76f2('0x2f')],_0x55d3f[_0x76f2('0x2d')]);_0xbee1e8[_0x76f2('0x32')]=_[_0x76f2('0x30')](_0x55d3f['model'],qs[_0x76f2('0x31')](_0x3cf573['query'][_0x76f2('0x31')]));_0xbee1e8[_0x76f2('0x32')]=_0xbee1e8['attributes'][_0x76f2('0x44')]?_0xbee1e8[_0x76f2('0x32')]:_0x55d3f[_0x76f2('0x2f')];_0xbee1e8['order']=qs[_0x76f2('0x36')](_0x3cf573[_0x76f2('0x2d')][_0x76f2('0x36')]);_0xbee1e8[_0x76f2('0x37')]=qs[_0x76f2('0x38')](_[_0x76f2('0x39')](_0x3cf573['query'],_0x55d3f[_0x76f2('0x38')]));if(_0x3cf573[_0x76f2('0x2d')][_0x76f2('0x3a')]){_0xbee1e8[_0x76f2('0x37')]=_[_0x76f2('0x3c')](_0xbee1e8[_0x76f2('0x37')],{'$or':_[_0x76f2('0x28')](_0xbee1e8[_0x76f2('0x32')],function(_0x4e5586){var _0xd1299f={};_0xd1299f[_0x4e5586]={'$like':'%'+_0x3cf573[_0x76f2('0x2d')]['filter']+'%'};return _0xd1299f;})});}_0xbee1e8=_[_0x76f2('0x3c')]({},_0xbee1e8,_0x3cf573['options']);return _0x3321d5[_0x76f2('0x57')](_0xbee1e8);}})[_0x76f2('0x21')](function(_0x15a743){if(_0x15a743){_0x35d132=_0x15a743[_0x76f2('0x44')];if(!_0x3cf573[_0x76f2('0x2d')][_0x76f2('0x33')](_0x76f2('0x58'))){_0xbee1e8[_0x76f2('0x34')]=qs[_0x76f2('0x34')](_0x3cf573[_0x76f2('0x2d')][_0x76f2('0x34')]);_0xbee1e8[_0x76f2('0x1b')]=qs[_0x76f2('0x1b')](_0x3cf573['query'][_0x76f2('0x1b')]);}return _0x3321d5[_0x76f2('0x57')](_0xbee1e8);}})[_0x76f2('0x21')](function(_0x53e2c9){if(_0x53e2c9){return _0x53e2c9?{'count':_0x35d132,'rows':_0x53e2c9}:null;}})[_0x76f2('0x21')](respondWithResult(_0x5a8d2a,null))['catch'](handleError(_0x5a8d2a,null));};exports['getAnyConditions']=function(_0x215675,_0x19f9e1,_0x302437){var _0x126752={};var _0x30fdb4={};var _0x196265;var _0x2cbeb3;return db[_0x76f2('0x29')][_0x76f2('0x59')]({'where':{'id':_0x215675[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x19f9e1,null))[_0x76f2('0x21')](function(_0x34bb67){if(_0x34bb67){_0x196265=_0x34bb67;_0x30fdb4['model']=_[_0x76f2('0x2e')](db[_0x76f2('0x53')]['rawAttributes']);_0x30fdb4[_0x76f2('0x2d')]=_[_0x76f2('0x2e')](_0x215675['query']);_0x30fdb4[_0x76f2('0x38')]=_[_0x76f2('0x30')](_0x30fdb4[_0x76f2('0x2f')],_0x30fdb4[_0x76f2('0x2d')]);_0x126752[_0x76f2('0x32')]=_[_0x76f2('0x30')](_0x30fdb4['model'],qs[_0x76f2('0x31')](_0x215675[_0x76f2('0x2d')][_0x76f2('0x31')]));_0x126752['attributes']=_0x126752[_0x76f2('0x32')]['length']?_0x126752[_0x76f2('0x32')]:_0x30fdb4[_0x76f2('0x2f')];_0x126752[_0x76f2('0x35')]=qs[_0x76f2('0x36')](_0x215675[_0x76f2('0x2d')][_0x76f2('0x36')]);_0x126752['where']=qs['filters'](_['pick'](_0x215675[_0x76f2('0x2d')],_0x30fdb4[_0x76f2('0x38')]));if(_0x215675[_0x76f2('0x2d')]['filter']){_0x126752[_0x76f2('0x37')]=_[_0x76f2('0x3c')](_0x126752[_0x76f2('0x37')],{'$or':_[_0x76f2('0x28')](_0x126752[_0x76f2('0x32')],function(_0x235e1e){var _0x136685={};_0x136685[_0x235e1e]={'$like':'%'+_0x215675[_0x76f2('0x2d')][_0x76f2('0x3a')]+'%'};return _0x136685;})});}_0x126752=_[_0x76f2('0x3c')]({},_0x126752,_0x215675['options']);return _0x196265[_0x76f2('0x5a')](_0x126752);}})[_0x76f2('0x21')](function(_0x1d356f){if(_0x1d356f){_0x2cbeb3=_0x1d356f[_0x76f2('0x44')];if(!_0x215675[_0x76f2('0x2d')][_0x76f2('0x33')](_0x76f2('0x58'))){_0x126752['limit']=qs[_0x76f2('0x34')](_0x215675[_0x76f2('0x2d')][_0x76f2('0x34')]);_0x126752[_0x76f2('0x1b')]=qs['offset'](_0x215675['query'][_0x76f2('0x1b')]);}return _0x196265[_0x76f2('0x5a')](_0x126752);}})[_0x76f2('0x21')](function(_0x386815){if(_0x386815){return _0x386815?{'count':_0x2cbeb3,'rows':_0x386815}:null;}})['then'](respondWithResult(_0x19f9e1,null))[_0x76f2('0x4d')](handleError(_0x19f9e1,null));};exports['addAction']=function(_0x10fe77,_0x40dbf0,_0xa88c33){if(_0x10fe77[_0x76f2('0x46')]['id']){delete _0x10fe77[_0x76f2('0x46')]['id'];}return db[_0x76f2('0x29')][_0x76f2('0x45')]({'where':{'id':_0x10fe77[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x40dbf0,null))['then'](function(_0x48da13){if(_0x48da13){_0x10fe77[_0x76f2('0x46')]['TriggerId']=_0x48da13['id'];return db[_0x76f2('0x5b')][_0x76f2('0x54')](_0x10fe77[_0x76f2('0x46')]);}})[_0x76f2('0x21')](respondWithResult(_0x40dbf0,null))['catch'](handleError(_0x40dbf0,null));};exports[_0x76f2('0x5c')]=function(_0x18f499,_0x220aa9,_0xa84b88){var _0x5955bf={};var _0x212477={};var _0x2e87c0;var _0x46c980;return db[_0x76f2('0x29')][_0x76f2('0x59')]({'where':{'id':_0x18f499[_0x76f2('0x50')]['id']}})[_0x76f2('0x21')](handleEntityNotFound(_0x220aa9,null))[_0x76f2('0x21')](function(_0x5a88a8){if(_0x5a88a8){_0x2e87c0=_0x5a88a8;_0x212477['model']=_[_0x76f2('0x2e')](db['Action'][_0x76f2('0x2a')]);_0x212477[_0x76f2('0x2d')]=_[_0x76f2('0x2e')](_0x18f499[_0x76f2('0x2d')]);_0x212477[_0x76f2('0x38')]=_['intersection'](_0x212477[_0x76f2('0x2f')],_0x212477[_0x76f2('0x2d')]);_0x5955bf[_0x76f2('0x32')]=_[_0x76f2('0x30')](_0x212477[_0x76f2('0x2f')],qs[_0x76f2('0x31')](_0x18f499[_0x76f2('0x2d')]['fields']));_0x5955bf[_0x76f2('0x32')]=_0x5955bf[_0x76f2('0x32')][_0x76f2('0x44')]?_0x5955bf[_0x76f2('0x32')]:_0x212477['model'];_0x5955bf['order']=qs['sort'](_0x18f499[_0x76f2('0x2d')][_0x76f2('0x36')]);_0x5955bf['where']=qs[_0x76f2('0x38')](_['pick'](_0x18f499['query'],_0x212477[_0x76f2('0x38')]));if(_0x18f499[_0x76f2('0x2d')][_0x76f2('0x3a')]){_0x5955bf['where']=_[_0x76f2('0x3c')](_0x5955bf['where'],{'$or':_[_0x76f2('0x28')](_0x5955bf['attributes'],function(_0x498776){var _0x3db084={};_0x3db084[_0x498776]={'$like':'%'+_0x18f499['query'][_0x76f2('0x3a')]+'%'};return _0x3db084;})});}_0x5955bf=_[_0x76f2('0x3c')]({},_0x5955bf,_0x18f499[_0x76f2('0x3d')]);return _0x2e87c0[_0x76f2('0x5c')](_0x5955bf);}})['then'](function(_0x435097){if(_0x435097){_0x46c980=_0x435097['length'];if(!_0x18f499[_0x76f2('0x2d')][_0x76f2('0x33')](_0x76f2('0x58'))){_0x5955bf[_0x76f2('0x34')]=qs[_0x76f2('0x34')](_0x18f499[_0x76f2('0x2d')][_0x76f2('0x34')]);_0x5955bf['offset']=qs[_0x76f2('0x1b')](_0x18f499[_0x76f2('0x2d')]['offset']);}return _0x2e87c0[_0x76f2('0x5c')](_0x5955bf);}})[_0x76f2('0x21')](function(_0x3bcc68){if(_0x3bcc68){return _0x3bcc68?{'count':_0x46c980,'rows':_0x3bcc68}:null;}})[_0x76f2('0x21')](respondWithResult(_0x220aa9,null))[_0x76f2('0x4d')](handleError(_0x220aa9,null));}; \ No newline at end of file +var _0x4fbc=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','get','Triggers','then','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filters'];(function(_0x58fde6,_0xc21077){var _0x4b4433=function(_0x52fb8b){while(--_0x52fb8b){_0x58fde6['push'](_0x58fde6['shift']());}};_0x4b4433(++_0xc21077);}(_0x4fbc,0x1a2));var _0xc4fb=function(_0x43cd7d,_0x41396d){_0x43cd7d=_0x43cd7d-0x0;var _0xac56e0=_0x4fbc[_0x43cd7d];return _0xac56e0;};'use strict';var pdf=require(_0xc4fb('0x0'));var emlformat=require(_0xc4fb('0x1'));var rimraf=require(_0xc4fb('0x2'));var zipdir=require(_0xc4fb('0x3'));var jsonpatch=require(_0xc4fb('0x4'));var rp=require(_0xc4fb('0x5'));var moment=require(_0xc4fb('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc4fb('0x7'));var util=require(_0xc4fb('0x8'));var path=require(_0xc4fb('0x9'));var sox=require(_0xc4fb('0xa'));var csv=require('to-csv');var ejs=require(_0xc4fb('0xb'));var fs=require('fs');var _=require(_0xc4fb('0xc'));var squel=require('squel');var crypto=require(_0xc4fb('0xd'));var jsforce=require(_0xc4fb('0xe'));var deskjs=require(_0xc4fb('0xf'));var toCsv=require(_0xc4fb('0x10'));var querystring=require(_0xc4fb('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc4fb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc4fb('0x13'));var hardwareService=require(_0xc4fb('0x14'));var logger=require('../../config/logger')(_0xc4fb('0x15'));var utils=require(_0xc4fb('0x16'));var config=require('../../config/environment');var db=require(_0xc4fb('0x17'))['db'];function respondWithStatusCode(_0x23a9be,_0x9ae238){_0x9ae238=_0x9ae238||0xcc;return function(_0x378ba8){if(_0x378ba8){return _0x23a9be[_0xc4fb('0x18')](_0x9ae238);}return _0x23a9be[_0xc4fb('0x19')](_0x9ae238)[_0xc4fb('0x1a')]();};}function respondWithResult(_0x26284b,_0x33de67){_0x33de67=_0x33de67||0xc8;return function(_0xb1d501){if(_0xb1d501){return _0x26284b[_0xc4fb('0x19')](_0x33de67)[_0xc4fb('0x1b')](_0xb1d501);}};}function respondWithFilteredResult(_0x2f0b78,_0xe96dd1){return function(_0x3dfa86){if(_0x3dfa86){var _0xde21cd=_0x3dfa86[_0xc4fb('0x1c')],_0x2fda58=_0xe96dd1[_0xc4fb('0x1d')],_0x122fd4=_0xe96dd1[_0xc4fb('0x1d')]+_0xe96dd1['limit'],_0x263a77;if(_0x122fd4>=_0xde21cd){_0x122fd4=_0xde21cd;_0x263a77=0xc8;}else{_0x263a77=0xce;}_0x2f0b78[_0xc4fb('0x19')](_0x263a77);return _0x2f0b78[_0xc4fb('0x1e')](_0xc4fb('0x1f'),_0x2fda58+'-'+_0x122fd4+'/'+_0xde21cd)[_0xc4fb('0x1b')](_0x3dfa86);}return null;};}function patchUpdates(_0x562609){return function(_0x40c974){try{jsonpatch[_0xc4fb('0x20')](_0x40c974,_0x562609,!![]);}catch(_0x44f553){return BPromise['reject'](_0x44f553);}return _0x40c974[_0xc4fb('0x21')]();};}function saveUpdates(_0x435a31,_0x212cb6){return function(_0x5d2c27){if(_0x5d2c27){return _0x5d2c27[_0xc4fb('0x22')](_0x435a31)['then'](function(_0x18a509){return _0x18a509;});}return null;};}function removeEntity(_0x48957c,_0x84bd2e){return function(_0x56a476){if(_0x56a476){return _0x56a476[_0xc4fb('0x23')]()['then'](function(){var _0x57cb82=_0x56a476[_0xc4fb('0x24')]({'plain':!![]});var _0x3eda73=_0xc4fb('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x3eda73,'resourceId':_0x57cb82['id']}})['then'](function(){return _0x56a476;});})[_0xc4fb('0x26')](function(){_0x48957c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x428a13,_0x31f6ef){return function(_0x2cff54){if(!_0x2cff54){_0x428a13['sendStatus'](0x194);}return _0x2cff54;};}function handleError(_0x1c463f,_0x538a9a){_0x538a9a=_0x538a9a||0x1f4;return function(_0x3e2254){logger['error'](_0x3e2254[_0xc4fb('0x27')]);if(_0x3e2254[_0xc4fb('0x28')]){delete _0x3e2254[_0xc4fb('0x28')];}_0x1c463f['status'](_0x538a9a)[_0xc4fb('0x29')](_0x3e2254);};}exports[_0xc4fb('0x2a')]=function(_0x36e1cc,_0x1db989){var _0x4cac63={},_0x258ff7={},_0x49e23e={'count':0x0,'rows':[]};var _0x50c6d8=_[_0xc4fb('0x2b')](db[_0xc4fb('0x2c')][_0xc4fb('0x2d')],function(_0x436aae){return{'name':_0x436aae[_0xc4fb('0x2e')],'type':_0x436aae[_0xc4fb('0x2f')][_0xc4fb('0x30')]};});_0x258ff7[_0xc4fb('0x31')]=_[_0xc4fb('0x2b')](_0x50c6d8,_0xc4fb('0x28'));_0x258ff7[_0xc4fb('0x32')]=_['keys'](_0x36e1cc[_0xc4fb('0x32')]);_0x258ff7['filters']=_[_0xc4fb('0x33')](_0x258ff7['model'],_0x258ff7['query']);_0x4cac63['attributes']=_[_0xc4fb('0x33')](_0x258ff7['model'],qs[_0xc4fb('0x34')](_0x36e1cc['query'][_0xc4fb('0x34')]));_0x4cac63[_0xc4fb('0x35')]=_0x4cac63[_0xc4fb('0x35')][_0xc4fb('0x36')]?_0x4cac63[_0xc4fb('0x35')]:_0x258ff7['model'];if(!_0x36e1cc[_0xc4fb('0x32')]['hasOwnProperty'](_0xc4fb('0x37'))){_0x4cac63['limit']=qs['limit'](_0x36e1cc[_0xc4fb('0x32')][_0xc4fb('0x38')]);_0x4cac63['offset']=qs[_0xc4fb('0x1d')](_0x36e1cc[_0xc4fb('0x32')][_0xc4fb('0x1d')]);}_0x4cac63[_0xc4fb('0x39')]=qs[_0xc4fb('0x3a')](_0x36e1cc['query'][_0xc4fb('0x3a')]);_0x4cac63[_0xc4fb('0x3b')]=qs['filters'](_[_0xc4fb('0x3c')](_0x36e1cc[_0xc4fb('0x32')],_0x258ff7[_0xc4fb('0x3d')]),_0x50c6d8);if(_0x36e1cc[_0xc4fb('0x32')][_0xc4fb('0x3e')]){_0x4cac63[_0xc4fb('0x3b')]=_[_0xc4fb('0x3f')](_0x4cac63[_0xc4fb('0x3b')],{'$or':_[_0xc4fb('0x2b')](_0x50c6d8,function(_0x38613e){if(_0x38613e[_0xc4fb('0x2f')]!==_0xc4fb('0x40')){var _0x10cc96={};_0x10cc96[_0x38613e['name']]={'$like':'%'+_0x36e1cc[_0xc4fb('0x32')][_0xc4fb('0x3e')]+'%'};return _0x10cc96;}})});}_0x4cac63=_['merge']({},_0x4cac63,_0x36e1cc[_0xc4fb('0x41')]);var _0xd23678={'where':_0x4cac63[_0xc4fb('0x3b')]};return db['Trigger'][_0xc4fb('0x1c')](_0xd23678)['then'](function(_0x4f4dc3){_0x49e23e[_0xc4fb('0x1c')]=_0x4f4dc3;if(_0x36e1cc[_0xc4fb('0x32')][_0xc4fb('0x42')]){_0x4cac63[_0xc4fb('0x43')]=[{'all':!![]}];}return db[_0xc4fb('0x2c')][_0xc4fb('0x44')](_0x4cac63);})[_0xc4fb('0x26')](function(_0x1d2661){_0x49e23e[_0xc4fb('0x45')]=_0x1d2661;return _0x49e23e;})[_0xc4fb('0x26')](respondWithFilteredResult(_0x1db989,_0x4cac63))[_0xc4fb('0x46')](handleError(_0x1db989,null));};exports[_0xc4fb('0x47')]=function(_0x1408c7,_0x4f28fb){var _0x1fca16={'raw':![],'where':{'id':_0x1408c7[_0xc4fb('0x48')]['id']}},_0x5e919d={};_0x5e919d[_0xc4fb('0x31')]=_[_0xc4fb('0x49')](db[_0xc4fb('0x2c')][_0xc4fb('0x2d')]);_0x5e919d[_0xc4fb('0x32')]=_[_0xc4fb('0x49')](_0x1408c7[_0xc4fb('0x32')]);_0x5e919d[_0xc4fb('0x3d')]=_[_0xc4fb('0x33')](_0x5e919d[_0xc4fb('0x31')],_0x5e919d[_0xc4fb('0x32')]);_0x1fca16[_0xc4fb('0x35')]=_[_0xc4fb('0x33')](_0x5e919d[_0xc4fb('0x31')],qs[_0xc4fb('0x34')](_0x1408c7[_0xc4fb('0x32')][_0xc4fb('0x34')]));_0x1fca16['attributes']=_0x1fca16['attributes']['length']?_0x1fca16['attributes']:_0x5e919d['model'];if(_0x1408c7['query'][_0xc4fb('0x42')]){_0x1fca16[_0xc4fb('0x43')]=[{'all':!![]}];}_0x1fca16=_['merge']({},_0x1fca16,_0x1408c7['options']);return db['Trigger'][_0xc4fb('0x4a')](_0x1fca16)[_0xc4fb('0x26')](handleEntityNotFound(_0x4f28fb,null))[_0xc4fb('0x26')](respondWithResult(_0x4f28fb,null))['catch'](handleError(_0x4f28fb,null));};exports[_0xc4fb('0x4b')]=function(_0x2d9600,_0x376c14){return db[_0xc4fb('0x2c')]['create'](_0x2d9600['body'],{})[_0xc4fb('0x26')](function(_0x19d24d){var _0x4ebc04=_0x2d9600['user'][_0xc4fb('0x24')]({'plain':!![]});if(!_0x4ebc04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ebc04[_0xc4fb('0x4c')]==='user'){var _0x5d1ceb=_0x19d24d[_0xc4fb('0x24')]({'plain':!![]});var _0x4b250d='Triggers';return db[_0xc4fb('0x4d')][_0xc4fb('0x4a')]({'where':{'name':_0x4b250d,'userProfileId':_0x4ebc04[_0xc4fb('0x4e')]},'raw':!![]})[_0xc4fb('0x26')](function(_0x3548c9){if(_0x3548c9&&_0x3548c9[_0xc4fb('0x4f')]===0x0){return db[_0xc4fb('0x50')][_0xc4fb('0x4b')]({'name':_0x5d1ceb[_0xc4fb('0x28')],'resourceId':_0x5d1ceb['id'],'type':_0x3548c9['name'],'sectionId':_0x3548c9['id']},{})[_0xc4fb('0x26')](function(){return _0x19d24d;});}else{return _0x19d24d;}})['catch'](function(_0x41fd66){logger[_0xc4fb('0x51')](_0xc4fb('0x52'),_0x41fd66);throw _0x41fd66;});}return _0x19d24d;})[_0xc4fb('0x26')](respondWithResult(_0x376c14,0xc9))[_0xc4fb('0x46')](handleError(_0x376c14,null));};exports[_0xc4fb('0x22')]=function(_0x41696d,_0x5404b5){if(_0x41696d['body']['id']){delete _0x41696d[_0xc4fb('0x53')]['id'];}return db[_0xc4fb('0x2c')]['find']({'where':{'id':_0x41696d[_0xc4fb('0x48')]['id']}})[_0xc4fb('0x26')](handleEntityNotFound(_0x5404b5,null))[_0xc4fb('0x26')](saveUpdates(_0x41696d[_0xc4fb('0x53')],null))[_0xc4fb('0x26')](respondWithResult(_0x5404b5,null))[_0xc4fb('0x46')](handleError(_0x5404b5,null));};exports[_0xc4fb('0x23')]=function(_0xeb2080,_0x1dae08){return db[_0xc4fb('0x2c')][_0xc4fb('0x4a')]({'where':{'id':_0xeb2080[_0xc4fb('0x48')]['id']}})[_0xc4fb('0x26')](handleEntityNotFound(_0x1dae08,null))['then'](removeEntity(_0x1dae08,null))[_0xc4fb('0x46')](handleError(_0x1dae08,null));};exports[_0xc4fb('0x54')]=function(_0x3bb990,_0x46b920,_0x444a23){if(_0x3bb990[_0xc4fb('0x53')]['id']){delete _0x3bb990[_0xc4fb('0x53')]['id'];}return db[_0xc4fb('0x2c')][_0xc4fb('0x4a')]({'where':{'id':_0x3bb990[_0xc4fb('0x48')]['id']}})['then'](handleEntityNotFound(_0x46b920,null))[_0xc4fb('0x26')](function(_0x28f02d){if(_0x28f02d){_0x3bb990['body'][_0xc4fb('0x55')]=_0x28f02d['id'];return db[_0xc4fb('0x56')][_0xc4fb('0x4b')](_0x3bb990[_0xc4fb('0x53')]);}})[_0xc4fb('0x26')](respondWithResult(_0x46b920,null))[_0xc4fb('0x46')](handleError(_0x46b920,null));};exports[_0xc4fb('0x57')]=function(_0x46bfa5,_0x2f7123,_0x76ad8d){if(_0x46bfa5['body']['id']){delete _0x46bfa5[_0xc4fb('0x53')]['id'];}return db[_0xc4fb('0x2c')]['find']({'where':{'id':_0x46bfa5[_0xc4fb('0x48')]['id']}})[_0xc4fb('0x26')](handleEntityNotFound(_0x2f7123,null))['then'](function(_0x435976){if(_0x435976){_0x46bfa5['body'][_0xc4fb('0x58')]=_0x435976['id'];return db[_0xc4fb('0x56')][_0xc4fb('0x4b')](_0x46bfa5[_0xc4fb('0x53')]);}})[_0xc4fb('0x26')](respondWithResult(_0x2f7123,null))['catch'](handleError(_0x2f7123,null));};exports[_0xc4fb('0x59')]=function(_0x2aaf76,_0xd49def,_0x352607){var _0x281b7d={};var _0x12c840={};var _0x301087;var _0x48f2cd;return db[_0xc4fb('0x2c')][_0xc4fb('0x5a')]({'where':{'id':_0x2aaf76[_0xc4fb('0x48')]['id']}})[_0xc4fb('0x26')](handleEntityNotFound(_0xd49def,null))[_0xc4fb('0x26')](function(_0x3057ae){if(_0x3057ae){_0x301087=_0x3057ae;_0x12c840['model']=_['keys'](db[_0xc4fb('0x56')][_0xc4fb('0x2d')]);_0x12c840[_0xc4fb('0x32')]=_[_0xc4fb('0x49')](_0x2aaf76[_0xc4fb('0x32')]);_0x12c840[_0xc4fb('0x3d')]=_[_0xc4fb('0x33')](_0x12c840['model'],_0x12c840[_0xc4fb('0x32')]);_0x281b7d[_0xc4fb('0x35')]=_[_0xc4fb('0x33')](_0x12c840[_0xc4fb('0x31')],qs[_0xc4fb('0x34')](_0x2aaf76[_0xc4fb('0x32')]['fields']));_0x281b7d[_0xc4fb('0x35')]=_0x281b7d['attributes'][_0xc4fb('0x36')]?_0x281b7d[_0xc4fb('0x35')]:_0x12c840[_0xc4fb('0x31')];_0x281b7d[_0xc4fb('0x39')]=qs['sort'](_0x2aaf76[_0xc4fb('0x32')]['sort']);_0x281b7d[_0xc4fb('0x3b')]=qs[_0xc4fb('0x3d')](_[_0xc4fb('0x3c')](_0x2aaf76['query'],_0x12c840[_0xc4fb('0x3d')]));if(_0x2aaf76[_0xc4fb('0x32')][_0xc4fb('0x3e')]){_0x281b7d[_0xc4fb('0x3b')]=_[_0xc4fb('0x3f')](_0x281b7d[_0xc4fb('0x3b')],{'$or':_[_0xc4fb('0x2b')](_0x281b7d[_0xc4fb('0x35')],function(_0x400f67){var _0x448492={};_0x448492[_0x400f67]={'$like':'%'+_0x2aaf76['query'][_0xc4fb('0x3e')]+'%'};return _0x448492;})});}_0x281b7d=_[_0xc4fb('0x3f')]({},_0x281b7d,_0x2aaf76['options']);return _0x301087[_0xc4fb('0x59')](_0x281b7d);}})[_0xc4fb('0x26')](function(_0x1921a6){if(_0x1921a6){_0x48f2cd=_0x1921a6[_0xc4fb('0x36')];if(!_0x2aaf76['query'][_0xc4fb('0x5b')](_0xc4fb('0x37'))){_0x281b7d[_0xc4fb('0x38')]=qs[_0xc4fb('0x38')](_0x2aaf76[_0xc4fb('0x32')]['limit']);_0x281b7d[_0xc4fb('0x1d')]=qs[_0xc4fb('0x1d')](_0x2aaf76[_0xc4fb('0x32')][_0xc4fb('0x1d')]);}return _0x301087[_0xc4fb('0x59')](_0x281b7d);}})[_0xc4fb('0x26')](function(_0x1ee456){if(_0x1ee456){return _0x1ee456?{'count':_0x48f2cd,'rows':_0x1ee456}:null;}})[_0xc4fb('0x26')](respondWithResult(_0xd49def,null))['catch'](handleError(_0xd49def,null));};exports[_0xc4fb('0x5c')]=function(_0x8521bf,_0x32f959,_0x57bb40){var _0x494abb={};var _0x319cb1={};var _0x257fc8;var _0x10401f;return db[_0xc4fb('0x2c')][_0xc4fb('0x5a')]({'where':{'id':_0x8521bf[_0xc4fb('0x48')]['id']}})['then'](handleEntityNotFound(_0x32f959,null))[_0xc4fb('0x26')](function(_0x55cab2){if(_0x55cab2){_0x257fc8=_0x55cab2;_0x319cb1['model']=_['keys'](db[_0xc4fb('0x56')][_0xc4fb('0x2d')]);_0x319cb1[_0xc4fb('0x32')]=_[_0xc4fb('0x49')](_0x8521bf[_0xc4fb('0x32')]);_0x319cb1['filters']=_[_0xc4fb('0x33')](_0x319cb1[_0xc4fb('0x31')],_0x319cb1['query']);_0x494abb[_0xc4fb('0x35')]=_[_0xc4fb('0x33')](_0x319cb1[_0xc4fb('0x31')],qs[_0xc4fb('0x34')](_0x8521bf[_0xc4fb('0x32')]['fields']));_0x494abb['attributes']=_0x494abb[_0xc4fb('0x35')]['length']?_0x494abb[_0xc4fb('0x35')]:_0x319cb1[_0xc4fb('0x31')];_0x494abb[_0xc4fb('0x39')]=qs[_0xc4fb('0x3a')](_0x8521bf[_0xc4fb('0x32')][_0xc4fb('0x3a')]);_0x494abb[_0xc4fb('0x3b')]=qs[_0xc4fb('0x3d')](_[_0xc4fb('0x3c')](_0x8521bf['query'],_0x319cb1[_0xc4fb('0x3d')]));if(_0x8521bf[_0xc4fb('0x32')][_0xc4fb('0x3e')]){_0x494abb[_0xc4fb('0x3b')]=_[_0xc4fb('0x3f')](_0x494abb['where'],{'$or':_[_0xc4fb('0x2b')](_0x494abb[_0xc4fb('0x35')],function(_0x3e2b92){var _0x4e6212={};_0x4e6212[_0x3e2b92]={'$like':'%'+_0x8521bf[_0xc4fb('0x32')]['filter']+'%'};return _0x4e6212;})});}_0x494abb=_['merge']({},_0x494abb,_0x8521bf[_0xc4fb('0x41')]);return _0x257fc8[_0xc4fb('0x5c')](_0x494abb);}})[_0xc4fb('0x26')](function(_0x26b752){if(_0x26b752){_0x10401f=_0x26b752['length'];if(!_0x8521bf[_0xc4fb('0x32')][_0xc4fb('0x5b')](_0xc4fb('0x37'))){_0x494abb[_0xc4fb('0x38')]=qs[_0xc4fb('0x38')](_0x8521bf['query'][_0xc4fb('0x38')]);_0x494abb[_0xc4fb('0x1d')]=qs[_0xc4fb('0x1d')](_0x8521bf[_0xc4fb('0x32')]['offset']);}return _0x257fc8[_0xc4fb('0x5c')](_0x494abb);}})[_0xc4fb('0x26')](function(_0x259414){if(_0x259414){return _0x259414?{'count':_0x10401f,'rows':_0x259414}:null;}})[_0xc4fb('0x26')](respondWithResult(_0x32f959,null))[_0xc4fb('0x46')](handleError(_0x32f959,null));};exports[_0xc4fb('0x5d')]=function(_0x3a12ff,_0xf79ba9,_0x3088cc){if(_0x3a12ff[_0xc4fb('0x53')]['id']){delete _0x3a12ff['body']['id'];}return db['Trigger'][_0xc4fb('0x4a')]({'where':{'id':_0x3a12ff[_0xc4fb('0x48')]['id']}})['then'](handleEntityNotFound(_0xf79ba9,null))[_0xc4fb('0x26')](function(_0x9ffcd8){if(_0x9ffcd8){_0x3a12ff[_0xc4fb('0x53')][_0xc4fb('0x5e')]=_0x9ffcd8['id'];return db['Action'][_0xc4fb('0x4b')](_0x3a12ff[_0xc4fb('0x53')]);}})[_0xc4fb('0x26')](respondWithResult(_0xf79ba9,null))[_0xc4fb('0x46')](handleError(_0xf79ba9,null));};exports[_0xc4fb('0x5f')]=function(_0x50ed8b,_0x56604c,_0x37c8de){var _0x1efd1f={};var _0x36dfa3={};var _0x676c48;var _0x4ba77e;return db[_0xc4fb('0x2c')]['findOne']({'where':{'id':_0x50ed8b[_0xc4fb('0x48')]['id']}})[_0xc4fb('0x26')](handleEntityNotFound(_0x56604c,null))[_0xc4fb('0x26')](function(_0x4f180e){if(_0x4f180e){_0x676c48=_0x4f180e;_0x36dfa3['model']=_[_0xc4fb('0x49')](db['Action'][_0xc4fb('0x2d')]);_0x36dfa3['query']=_[_0xc4fb('0x49')](_0x50ed8b[_0xc4fb('0x32')]);_0x36dfa3[_0xc4fb('0x3d')]=_[_0xc4fb('0x33')](_0x36dfa3[_0xc4fb('0x31')],_0x36dfa3[_0xc4fb('0x32')]);_0x1efd1f[_0xc4fb('0x35')]=_['intersection'](_0x36dfa3[_0xc4fb('0x31')],qs[_0xc4fb('0x34')](_0x50ed8b['query'][_0xc4fb('0x34')]));_0x1efd1f[_0xc4fb('0x35')]=_0x1efd1f[_0xc4fb('0x35')][_0xc4fb('0x36')]?_0x1efd1f[_0xc4fb('0x35')]:_0x36dfa3[_0xc4fb('0x31')];_0x1efd1f[_0xc4fb('0x39')]=qs['sort'](_0x50ed8b['query'][_0xc4fb('0x3a')]);_0x1efd1f[_0xc4fb('0x3b')]=qs[_0xc4fb('0x3d')](_[_0xc4fb('0x3c')](_0x50ed8b[_0xc4fb('0x32')],_0x36dfa3['filters']));if(_0x50ed8b['query'][_0xc4fb('0x3e')]){_0x1efd1f['where']=_['merge'](_0x1efd1f[_0xc4fb('0x3b')],{'$or':_['map'](_0x1efd1f['attributes'],function(_0x5a5c59){var _0x32dc5b={};_0x32dc5b[_0x5a5c59]={'$like':'%'+_0x50ed8b['query'][_0xc4fb('0x3e')]+'%'};return _0x32dc5b;})});}_0x1efd1f=_['merge']({},_0x1efd1f,_0x50ed8b[_0xc4fb('0x41')]);return _0x676c48['getActions'](_0x1efd1f);}})[_0xc4fb('0x26')](function(_0x8e5a40){if(_0x8e5a40){_0x4ba77e=_0x8e5a40[_0xc4fb('0x36')];if(!_0x50ed8b[_0xc4fb('0x32')][_0xc4fb('0x5b')](_0xc4fb('0x37'))){_0x1efd1f['limit']=qs[_0xc4fb('0x38')](_0x50ed8b[_0xc4fb('0x32')][_0xc4fb('0x38')]);_0x1efd1f['offset']=qs[_0xc4fb('0x1d')](_0x50ed8b[_0xc4fb('0x32')][_0xc4fb('0x1d')]);}return _0x676c48[_0xc4fb('0x5f')](_0x1efd1f);}})[_0xc4fb('0x26')](function(_0x98ce2d){if(_0x98ce2d){return _0x98ce2d?{'count':_0x4ba77e,'rows':_0x98ce2d}:null;}})['then'](respondWithResult(_0x56604c,null))[_0xc4fb('0x46')](handleError(_0x56604c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d1e053a..fcbc14b 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 _0x0b0e=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4a10e0,_0x14c51e){var _0x5ab2ca=function(_0x38c768){while(--_0x38c768){_0x4a10e0['push'](_0x4a10e0['shift']());}};_0x5ab2ca(++_0x14c51e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0x0b0e[_0x53e29e];return _0x54c118;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment'];(function(_0x2188ee,_0x56cf4d){var _0x19876e=function(_0x5e938f){while(--_0x5e938f){_0x2188ee['push'](_0x2188ee['shift']());}};_0x19876e(++_0x56cf4d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x10e648,_0x43ad58){_0x10e648=_0x10e648-0x0;var _0x2720b6=_0x5f2f[_0x10e648];return _0x2720b6;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'tools_triggers','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 314af8b..57c3186 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 _0x93e9=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','options','raw','where','limit','map','include','model','attributes','stringify','ShowTrigger','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x417ecd,_0x26397a){var _0x2e0343=function(_0x29d979){while(--_0x29d979){_0x417ecd['push'](_0x417ecd['shift']());}};_0x2e0343(++_0x26397a);}(_0x93e9,0xcc));var _0x993e=function(_0x4bba7b,_0x481fcf){_0x4bba7b=_0x4bba7b-0x0;var _0x51df19=_0x93e9[_0x4bba7b];return _0x51df19;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('Trigger,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('Trigger,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['findAll']({'raw':_0x1acd21[_0x993e('0x18')]?_0x1acd21[_0x993e('0x18')][_0x993e('0x19')]===undefined?!![]:![]:!![],'where':_0x1acd21[_0x993e('0x18')]?_0x1acd21[_0x993e('0x18')][_0x993e('0x1a')]||null:null,'attributes':_0x1acd21[_0x993e('0x18')]?_0x1acd21[_0x993e('0x18')]['attributes']||null:null,'limit':_0x1acd21[_0x993e('0x18')]?_0x1acd21['options'][_0x993e('0x1b')]||null:null,'include':_0x1acd21[_0x993e('0x18')]?_0x1acd21[_0x993e('0x18')]['include']?_[_0x993e('0x1c')](_0x1acd21[_0x993e('0x18')][_0x993e('0x1d')],function(_0x1c52fd){return{'model':db[_0x1c52fd[_0x993e('0x1e')]],'as':_0x1c52fd['as'],'attributes':_0x1c52fd[_0x993e('0x1f')],'include':_0x1c52fd[_0x993e('0x1d')]?_[_0x993e('0x1c')](_0x1c52fd[_0x993e('0x1d')],function(_0x18f6ac){return{'model':db[_0x18f6ac[_0x993e('0x1e')]],'as':_0x18f6ac['as'],'attributes':_0x18f6ac[_0x993e('0x1f')],'include':_0x18f6ac['include']?_[_0x993e('0x1c')](_0x18f6ac[_0x993e('0x1d')],function(_0x52b727){return{'model':db[_0x52b727[_0x993e('0x1e')]],'as':_0x52b727['as'],'attributes':_0x52b727['attributes']};}):[]};}):[]};}):[]:[]})[_0x993e('0xd')](function(_0xa03fbd){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger['debug']('GetTrigger',_0x1acd21,JSON[_0x993e('0x20')](_0xa03fbd));_0x3d6109(_0xa03fbd);})[_0x993e('0x15')](function(_0x4a4f00){logger[_0x993e('0x12')](_0x993e('0x16'),_0x4a4f00[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9['error'](0x1f4,_0x4a4f00[_0x993e('0x13')]));});});};exports[_0x993e('0x21')]=function(_0x1f5d51){var _0x1fa8a5=this;return new Promise(function(_0x2599ec,_0x54da4e){return db[_0x993e('0x17')]['find']({'raw':_0x1f5d51[_0x993e('0x18')]?_0x1f5d51['options'][_0x993e('0x19')]===undefined?!![]:![]:!![],'where':_0x1f5d51['options']?_0x1f5d51[_0x993e('0x18')][_0x993e('0x1a')]||null:null,'attributes':_0x1f5d51[_0x993e('0x18')]?_0x1f5d51[_0x993e('0x18')][_0x993e('0x1f')]||null:null,'include':_0x1f5d51[_0x993e('0x18')]?_0x1f5d51['options'][_0x993e('0x1d')]?_['map'](_0x1f5d51['options'][_0x993e('0x1d')],function(_0x497d29){return{'model':db[_0x497d29[_0x993e('0x1e')]],'as':_0x497d29['as'],'attributes':_0x497d29[_0x993e('0x1f')],'include':_0x497d29[_0x993e('0x1d')]?_[_0x993e('0x1c')](_0x497d29[_0x993e('0x1d')],function(_0x339fb6){return{'model':db[_0x339fb6[_0x993e('0x1e')]],'as':_0x339fb6['as'],'attributes':_0x339fb6[_0x993e('0x1f')],'include':_0x339fb6[_0x993e('0x1d')]?_[_0x993e('0x1c')](_0x339fb6[_0x993e('0x1d')],function(_0x110504){return{'model':db[_0x110504[_0x993e('0x1e')]],'as':_0x110504['as'],'attributes':_0x110504[_0x993e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x993e('0xd')](function(_0x5818c5){logger[_0x993e('0xe')](_0x993e('0x21'),_0x1f5d51);logger[_0x993e('0x22')](_0x993e('0x21'),_0x1f5d51,JSON[_0x993e('0x20')](_0x5818c5));_0x2599ec(_0x5818c5);})[_0x993e('0x15')](function(_0x1913c0){logger[_0x993e('0x12')](_0x993e('0x21'),_0x1913c0['message'],_0x1f5d51);_0x54da4e(_0x1fa8a5[_0x993e('0x12')](0x1f4,_0x1913c0['message']));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowTrigger','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger'];(function(_0x2d5197,_0x266fcd){var _0x283a8d=function(_0x1cc2f0){while(--_0x1cc2f0){_0x2d5197['push'](_0x2d5197['shift']());}};_0x283a8d(++_0x266fcd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Trigger,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Trigger,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Trigger,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetTrigger',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowTrigger',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3554775..b679a19 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 _0x032e=['post','/:id/clone','clone','create','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2c058a,_0x2f505a){var _0xc24ff9=function(_0x3187fc){while(--_0x3187fc){_0x2c058a['push'](_0x2c058a['shift']());}};_0xc24ff9(++_0x2f505a);}(_0x032e,0x124));var _0xe032=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x032e[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe032('0x3'));var interaction=require(_0xe032('0x4'));var config=require(_0xe032('0x5'));var controller=require(_0xe032('0x6'));router[_0xe032('0x7')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0x9')]);router[_0xe032('0x7')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')](_0xe032('0xd'),auth[_0xe032('0x8')](),controller[_0xe032('0xe')]);router[_0xe032('0xc')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0xf')]);router['put'](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x10')]);router[_0xe032('0x11')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4c4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4649ca,_0x53bc2d){_0x4649ca=_0x4649ca-0x0;var _0x847593=_0x4c4e[_0x4649ca];return _0x847593;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./trunk.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0xc')](_0xe4c4('0xd'),auth[_0xe4c4('0xa')](),controller['clone']);router['post']('/',auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xe')]);router[_0xe4c4('0xf')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x10')]);router['delete'](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x11')]);module[_0xe4c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6772499..d530ff5 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 _0x5c7e=['update','outgoing','yes','force_rport,comedia','setDataValue','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat'];(function(_0x543f49,_0x483f69){var _0x3145fd=function(_0x6bb7fd){while(--_0x6bb7fd){_0x543f49['push'](_0x543f49['shift']());}};_0x3145fd(++_0x483f69);}(_0x5c7e,0xbb));var _0xe5c7=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x5c7e[_0x39cf70];return _0x580424;};'use strict';var Sequelize=require(_0xe5c7('0x0'));module[_0xe5c7('0x1')]={'name':{'type':Sequelize[_0xe5c7('0x2')],'allowNull':![],'unique':_0xe5c7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x5'),_0xe5c7('0x6'),'peer'),'allowNull':![],'defaultValue':_0xe5c7('0x5')},'context':{'type':Sequelize[_0xe5c7('0x2')],'allowNull':![],'defaultValue':_0xe5c7('0x7')},'callingpres':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x8'),_0xe5c7('0x9'),_0xe5c7('0xa'),_0xe5c7('0xb'),_0xe5c7('0xc'),'PROHIB_PASSED_SCREEN',_0xe5c7('0xd'),_0xe5c7('0xe'))},'deny':{'type':Sequelize[_0xe5c7('0x2')]},'permit':{'type':Sequelize[_0xe5c7('0x2')]},'secret':{'type':Sequelize[_0xe5c7('0x2')]},'md5secret':{'type':Sequelize[_0xe5c7('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':_0xe5c7('0xf'),'set':function(_0x8bfe4e){this['setDataValue'](_0xe5c7('0x10'),_0x8bfe4e?_0x8bfe4e['join'](','):null);},'get':function(){return this[_0xe5c7('0x11')](_0xe5c7('0x10'))?this[_0xe5c7('0x11')](_0xe5c7('0x10'))[_0xe5c7('0x12')](','):null;},'comment':_0xe5c7('0x13')},'dtmfmode':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x14'),_0xe5c7('0x15'),'shortinfo',_0xe5c7('0x16'),_0xe5c7('0x17')),'defaultValue':_0xe5c7('0x14')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xe5c7('0x18'),_0xe5c7('0x19'),_0xe5c7('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xe5c7('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xe5c7('0x1c'),'set':function(_0x1358d7){this[_0xe5c7('0x1d')]('nat',_0x1358d7?_0x1358d7[_0xe5c7('0x1e')](','):null);},'get':function(){return this[_0xe5c7('0x11')]('nat')?this[_0xe5c7('0x11')](_0xe5c7('0x1f'))[_0xe5c7('0x12')](','):null;},'comment':_0xe5c7('0x20')},'callgroup':{'type':Sequelize[_0xe5c7('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe5c7('0x2')]},'pickupgroup':{'type':Sequelize[_0xe5c7('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe5c7('0x2')]},'language':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':_0xe5c7('0x21')},'allow':{'type':Sequelize[_0xe5c7('0x2')],'allowNull':![],'defaultValue':_0xe5c7('0x22'),'set':function(_0x208cab){this[_0xe5c7('0x1d')]('allow',_0x208cab?_0x208cab[_0xe5c7('0x1e')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe5c7('0x11')](_0xe5c7('0x23'))?this[_0xe5c7('0x11')](_0xe5c7('0x23'))[_0xe5c7('0x12')](';'):null;},'comment':_0xe5c7('0x24')},'autoframing':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'insecure':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':'port,invite','set':function(_0x469c8c){this[_0xe5c7('0x1d')](_0xe5c7('0x25'),_0x469c8c?_0x469c8c[_0xe5c7('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0xe5c7('0x25'))?this[_0xe5c7('0x11')](_0xe5c7('0x25'))[_0xe5c7('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe5c7('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xe5c7('0x26'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xe5c7('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'setvar':{'type':Sequelize[_0xe5c7('0x2')]},'callerid':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':_0xe5c7('0x28')},'amaflags':{'type':Sequelize[_0xe5c7('0x2')]},'callcounter':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no'),'defaultValue':_0xe5c7('0x1b')},'busylevel':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xe5c7('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe5c7('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xe5c7('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xe5c7('0x4')]('yes','no',_0xe5c7('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe5c7('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xe5c7('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xe5c7('0x2a'),_0xe5c7('0x2b'),_0xe5c7('0x2c'))},'session_expires':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xe5c7('0x4')]('uac',_0xe5c7('0x2d')),'defaultValue':_0xe5c7('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xe5c7('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe5c7('0x2')]},'port':{'type':Sequelize[_0xe5c7('0x27')](0x5)},'qualify':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no'),'defaultValue':_0xe5c7('0x1b')},'keepalive':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xe5c7('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no',_0xe5c7('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe5c7('0x2')]},'callbackextension':{'type':Sequelize[_0xe5c7('0x2')]},'timert1':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'timerb':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xe5c7('0x2')]},'contactdeny':{'type':Sequelize[_0xe5c7('0x2')]},'contactacl':{'type':Sequelize[_0xe5c7('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xe5c7('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xe5c7('0x27')](0xb)},'encryption':{'type':Sequelize[_0xe5c7('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xe5c7('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no',_0xe5c7('0x2f'),_0xe5c7('0x30'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xe5c7('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xe5c7('0x2')]},'dtlscafile':{'type':Sequelize[_0xe5c7('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xe5c7('0x31'),_0xe5c7('0x32'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe5c7('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xe5c7('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xe5c7('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xe5c7('0x4')](_0xe5c7('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xe5c7('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xe5c7('0x2')]},'parkinglot':{'type':Sequelize[_0xe5c7('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe5c7('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xe5c7('0x4')]('yes','no',_0xe5c7('0x18'),_0xe5c7('0x19'),_0xe5c7('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe5c7('0x2')]},'otherFields':{'type':Sequelize[_0xe5c7('0x2')]},'active':{'type':Sequelize[_0xe5c7('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x51d3=['BOOLEAN','friend','STRING','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','pai','fingerprint','certificate','active','passive','actpass','dynamic'];(function(_0x33b110,_0x877e4e){var _0x55f99f=function(_0x38e0f4){while(--_0x38e0f4){_0x33b110['push'](_0x33b110['shift']());}};_0x55f99f(++_0x877e4e);}(_0x51d3,0x67));var _0x351d=function(_0x39fa53,_0x55fcd6){_0x39fa53=_0x39fa53-0x0;var _0x3a60e9=_0x51d3[_0x39fa53];return _0x3a60e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x351d('0x0'),'user','peer'),'allowNull':![],'defaultValue':_0x351d('0x0')},'context':{'type':Sequelize[_0x351d('0x1')],'allowNull':![],'defaultValue':_0x351d('0x2')},'callingpres':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x4'),_0x351d('0x5'),_0x351d('0x6'),_0x351d('0x7'),_0x351d('0x8'),'PROHIB_PASSED_SCREEN',_0x351d('0x9'),_0x351d('0xa'))},'deny':{'type':Sequelize[_0x351d('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x351d('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x351d('0x1')],'defaultValue':_0x351d('0xb'),'set':function(_0x29a43b){this[_0x351d('0xc')](_0x351d('0xd'),_0x29a43b?_0x29a43b[_0x351d('0xe')](','):null);},'get':function(){return this[_0x351d('0xf')](_0x351d('0xd'))?this[_0x351d('0xf')](_0x351d('0xd'))['split'](','):null;},'comment':_0x351d('0x10')},'dtmfmode':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x11'),_0x351d('0x12'),_0x351d('0x13'),_0x351d('0x14'),_0x351d('0x15')),'defaultValue':_0x351d('0x11')},'directmedia':{'type':Sequelize['ENUM'](_0x351d('0x16'),'no',_0x351d('0x17'),_0x351d('0x18'),_0x351d('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x351d('0x1')]},'nat':{'type':Sequelize[_0x351d('0x1')],'defaultValue':_0x351d('0x1a'),'set':function(_0x3d2e2f){this[_0x351d('0xc')](_0x351d('0x1b'),_0x3d2e2f?_0x3d2e2f[_0x351d('0xe')](','):null);},'get':function(){return this[_0x351d('0xf')]('nat')?this[_0x351d('0xf')](_0x351d('0x1b'))[_0x351d('0x1c')](','):null;},'comment':_0x351d('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x351d('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x351d('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x351d('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x351d('0x1')],'allowNull':![],'defaultValue':_0x351d('0x1e'),'set':function(_0x23fccc){this[_0x351d('0xc')](_0x351d('0x1f'),_0x23fccc?_0x23fccc[_0x351d('0xe')](';'):_0x351d('0x1e'));},'get':function(){return this[_0x351d('0xf')](_0x351d('0x1f'))?this['getDataValue']('allow')[_0x351d('0x1c')](';'):null;},'comment':_0x351d('0x20')},'autoframing':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'insecure':{'type':Sequelize[_0x351d('0x1')],'defaultValue':_0x351d('0x21'),'set':function(_0x288e0a){this[_0x351d('0xc')](_0x351d('0x22'),_0x288e0a?_0x288e0a[_0x351d('0xe')](','):null);},'get':function(){return this[_0x351d('0xf')](_0x351d('0x22'))?this[_0x351d('0xf')](_0x351d('0x22'))[_0x351d('0x1c')](','):null;},'comment':_0x351d('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x351d('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no',_0x351d('0x24'))},'promiscredir':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'accountcode':{'type':Sequelize[_0x351d('0x25')](0xb)},'setvar':{'type':Sequelize[_0x351d('0x1')]},'callerid':{'type':Sequelize[_0x351d('0x1')],'defaultValue':_0x351d('0x26')},'amaflags':{'type':Sequelize[_0x351d('0x1')]},'callcounter':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x351d('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x351d('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x351d('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x351d('0x1')]},'template':{'type':Sequelize[_0x351d('0x1')]},'videosupport':{'type':Sequelize[_0x351d('0x3')]('yes','no',_0x351d('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x351d('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x28'),_0x351d('0x29'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x351d('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x351d('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x351d('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x351d('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x351d('0x16')},'keepalive':{'type':Sequelize[_0x351d('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x351d('0x1')]},'rtptimeout':{'type':Sequelize[_0x351d('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x351d('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no',_0x351d('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x351d('0x1')]},'timert1':{'type':Sequelize[_0x351d('0x25')](0xb)},'timerb':{'type':Sequelize[_0x351d('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x351d('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x351d('0x1')]},'contactacl':{'type':Sequelize[_0x351d('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x351d('0x1')]},'use_q850_reason':{'type':Sequelize[_0x351d('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'force_avp':{'type':Sequelize[_0x351d('0x3')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x351d('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x351d('0x16'),'no',_0x351d('0x2c'),_0x351d('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x351d('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x351d('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x351d('0x1')]},'dtlscipher':{'type':Sequelize[_0x351d('0x1')]},'dtlscafile':{'type':Sequelize[_0x351d('0x1')]},'dtlscapath':{'type':Sequelize[_0x351d('0x1')]},'dtlssetup':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x2e'),_0x351d('0x2f'),_0x351d('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x351d('0x1')]},'usereqphone':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x351d('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x351d('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x351d('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x351d('0x1')]},'mohsuggest':{'type':Sequelize[_0x351d('0x1')]},'parkinglot':{'type':Sequelize[_0x351d('0x1')]},'description':{'type':Sequelize[_0x351d('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x351d('0x31')},'canreinvite':{'type':Sequelize[_0x351d('0x3')](_0x351d('0x16'),'no','nonat',_0x351d('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x351d('0x1')]},'otherFields':{'type':Sequelize[_0x351d('0x1')]},'active':{'type':Sequelize[_0x351d('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x351d('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index fe743da..119ce6c 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 _0x7117=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','find','clone','get','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','readFileSync','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','utf8','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','update','destroy','Trunks','UserProfileResource','name','index','map','Trunk','type','key','model'];(function(_0x37cf62,_0xda1b58){var _0x55ad5f=function(_0x2a3dea){while(--_0x2a3dea){_0x37cf62['push'](_0x37cf62['shift']());}};_0x55ad5f(++_0xda1b58);}(_0x7117,0x1ec));var _0x7711=function(_0x547a85,_0x2f4173){_0x547a85=_0x547a85-0x0;var _0x1ec140=_0x7117[_0x547a85];return _0x1ec140;};'use strict';var pdf=require(_0x7711('0x0'));var emlformat=require(_0x7711('0x1'));var rimraf=require(_0x7711('0x2'));var zipdir=require(_0x7711('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7711('0x4'));var moment=require(_0x7711('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7711('0x6'));var util=require('util');var path=require(_0x7711('0x7'));var sox=require(_0x7711('0x8'));var csv=require(_0x7711('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7711('0xa'));var deskjs=require(_0x7711('0xb'));var toCsv=require(_0x7711('0x9'));var querystring=require(_0x7711('0xc'));var Papa=require('papaparse');var Redis=require(_0x7711('0xd'));var authService=require(_0x7711('0xe'));var qs=require(_0x7711('0xf'));var as=require(_0x7711('0x10'));var hardwareService=require(_0x7711('0x11'));var logger=require('../../config/logger')(_0x7711('0x12'));var utils=require(_0x7711('0x13'));var config=require('../../config/environment');var db=require(_0x7711('0x14'))['db'];var jayson=require(_0x7711('0x15'));var client=jayson[_0x7711('0x16')][_0x7711('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2b13cb,_0x259478,_0x5d4e9d){if(_0x5d4e9d){var _0x472312=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x472312[_0x7711('0x18')](_0x259478)){return _0x2b13cb;}else{throw new db[(_0x7711('0x19'))][(_0x7711('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 _0x2b13cb;}}function respondWithRpcPromise(_0xe508f7,_0x2dbb60,_0xee7b2d,_0x8ad57e){return new BPromise(function(_0x28b28e,_0x44320f){var _0x1f25fc=_0x8ad57e||client;return _0x1f25fc[_0x7711('0x1b')](_0xe508f7,_0xee7b2d)[_0x7711('0x1c')](function(_0x3e3dcd){logger['info'](_0x7711('0x1d'),_0x2dbb60,'request\x20sent');logger[_0x7711('0x1e')](_0x7711('0x1f'),_0x2dbb60,_0x7711('0x20'),JSON[_0x7711('0x21')](_0x3e3dcd));if(_0x3e3dcd[_0x7711('0x22')]){if(_0x3e3dcd[_0x7711('0x22')][_0x7711('0x23')]===0x1f4){logger[_0x7711('0x22')](_0x7711('0x1d'),_0x2dbb60,_0x3e3dcd[_0x7711('0x22')][_0x7711('0x24')]);return _0x44320f(_0x3e3dcd[_0x7711('0x22')][_0x7711('0x24')]);}logger['error'](_0x7711('0x1d'),_0x2dbb60,_0x3e3dcd['error'][_0x7711('0x24')]);return _0x28b28e(_0x3e3dcd[_0x7711('0x22')][_0x7711('0x24')]);}else{logger[_0x7711('0x25')](_0x7711('0x1d'),_0x2dbb60,_0x7711('0x20'));_0x28b28e(_0x3e3dcd[_0x7711('0x26')][_0x7711('0x24')]);}})[_0x7711('0x27')](function(_0x30e9ab){logger[_0x7711('0x22')](_0x7711('0x1d'),_0x2dbb60,_0x30e9ab);_0x44320f(_0x30e9ab);});});}function respondWithStatusCode(_0xb2a5aa,_0x180404){_0x180404=_0x180404||0xcc;return function(_0x460330){if(_0x460330){return _0xb2a5aa[_0x7711('0x28')](_0x180404);}return _0xb2a5aa[_0x7711('0x29')](_0x180404)[_0x7711('0x2a')]();};}function respondWithResult(_0x2da5f8,_0x447f33){_0x447f33=_0x447f33||0xc8;return function(_0x182675){if(_0x182675){return _0x2da5f8[_0x7711('0x29')](_0x447f33)[_0x7711('0x2b')](_0x182675);}};}function respondWithFilteredResult(_0xa19645,_0x21004f){return function(_0x2b8a00){if(_0x2b8a00){var _0x4d1fd9=_0x2b8a00['count'],_0x30172e=_0x21004f[_0x7711('0x2c')],_0x2873e8=_0x21004f[_0x7711('0x2c')]+_0x21004f['limit'],_0x4d4c32;if(_0x2873e8>=_0x4d1fd9){_0x2873e8=_0x4d1fd9;_0x4d4c32=0xc8;}else{_0x4d4c32=0xce;}_0xa19645['status'](_0x4d4c32);return _0xa19645[_0x7711('0x2d')]('Content-Range',_0x30172e+'-'+_0x2873e8+'/'+_0x4d1fd9)[_0x7711('0x2b')](_0x2b8a00);}return null;};}function patchUpdates(_0x3b9a07){return function(_0x4077b3){try{jsonpatch[_0x7711('0x2e')](_0x4077b3,_0x3b9a07,!![]);}catch(_0x26f39b){return BPromise['reject'](_0x26f39b);}return _0x4077b3['save']();};}function saveUpdates(_0x13445a,_0x55564b){return function(_0x19b9ba){if(_0x19b9ba){return _0x19b9ba[_0x7711('0x2f')](_0x13445a)[_0x7711('0x1c')](function(_0x2eb9fc){return _0x2eb9fc;});}return null;};}function removeEntity(_0x55b479,_0x4e9316){return function(_0x560433){if(_0x560433){return _0x560433[_0x7711('0x30')]()[_0x7711('0x1c')](function(){var _0x4c7b8a=_0x560433['get']({'plain':!![]});var _0x25dc07=_0x7711('0x31');return db[_0x7711('0x32')][_0x7711('0x30')]({'where':{'type':_0x25dc07,'resourceId':_0x4c7b8a['id']}})[_0x7711('0x1c')](function(){return _0x560433;});})[_0x7711('0x1c')](function(){_0x55b479[_0x7711('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b32b9,_0x380287){return function(_0x4f5164){if(!_0x4f5164){_0x5b32b9['sendStatus'](0x194);}return _0x4f5164;};}function handleError(_0x5d338a,_0x3fa71f){_0x3fa71f=_0x3fa71f||0x1f4;return function(_0x1aea2d){logger[_0x7711('0x22')](_0x1aea2d['stack']);if(_0x1aea2d[_0x7711('0x33')]){delete _0x1aea2d['name'];}_0x5d338a[_0x7711('0x29')](_0x3fa71f)['send'](_0x1aea2d);};}exports[_0x7711('0x34')]=function(_0x224537,_0x12a5bf){var _0x1fffd9={},_0x5294d9={},_0x23ce60={'count':0x0,'rows':[]};var _0x3ba510=_[_0x7711('0x35')](db[_0x7711('0x36')]['rawAttributes'],function(_0x2bd389){return{'name':_0x2bd389['fieldName'],'type':_0x2bd389[_0x7711('0x37')][_0x7711('0x38')]};});_0x5294d9[_0x7711('0x39')]=_['map'](_0x3ba510,_0x7711('0x33'));_0x5294d9['query']=_[_0x7711('0x3a')](_0x224537[_0x7711('0x3b')]);_0x5294d9[_0x7711('0x3c')]=_[_0x7711('0x3d')](_0x5294d9[_0x7711('0x39')],_0x5294d9[_0x7711('0x3b')]);_0x1fffd9['attributes']=_[_0x7711('0x3d')](_0x5294d9[_0x7711('0x39')],qs[_0x7711('0x3e')](_0x224537['query']['fields']));_0x1fffd9[_0x7711('0x3f')]=_0x1fffd9['attributes'][_0x7711('0x40')]?_0x1fffd9[_0x7711('0x3f')]:_0x5294d9['model'];if(!_0x224537[_0x7711('0x3b')][_0x7711('0x41')](_0x7711('0x42'))){_0x1fffd9['limit']=qs[_0x7711('0x43')](_0x224537[_0x7711('0x3b')][_0x7711('0x43')]);_0x1fffd9[_0x7711('0x2c')]=qs['offset'](_0x224537[_0x7711('0x3b')][_0x7711('0x2c')]);}_0x1fffd9[_0x7711('0x44')]=qs[_0x7711('0x45')](_0x224537[_0x7711('0x3b')]['sort']);_0x1fffd9[_0x7711('0x46')]=qs[_0x7711('0x3c')](_[_0x7711('0x47')](_0x224537[_0x7711('0x3b')],_0x5294d9['filters']),_0x3ba510);if(_0x224537[_0x7711('0x3b')][_0x7711('0x48')]){_0x1fffd9['where']=_[_0x7711('0x49')](_0x1fffd9[_0x7711('0x46')],{'$or':_[_0x7711('0x35')](_0x3ba510,function(_0x584ad8){if(_0x584ad8[_0x7711('0x37')]!==_0x7711('0x4a')){var _0x2da589={};_0x2da589[_0x584ad8[_0x7711('0x33')]]={'$like':'%'+_0x224537[_0x7711('0x3b')]['filter']+'%'};return _0x2da589;}})});}_0x1fffd9=_[_0x7711('0x49')]({},_0x1fffd9,_0x224537[_0x7711('0x4b')]);var _0x30da33={'where':_0x1fffd9[_0x7711('0x46')]};return db['Trunk'][_0x7711('0x4c')](_0x30da33)['then'](function(_0x153ede){_0x23ce60[_0x7711('0x4c')]=_0x153ede;if(_0x224537[_0x7711('0x3b')][_0x7711('0x4d')]){_0x1fffd9[_0x7711('0x4e')]=[{'all':!![]}];}return db[_0x7711('0x36')][_0x7711('0x4f')](_0x1fffd9);})[_0x7711('0x1c')](function(_0x3598fa){_0x23ce60['rows']=_0x3598fa;return _0x23ce60;})[_0x7711('0x1c')](respondWithFilteredResult(_0x12a5bf,_0x1fffd9))['catch'](handleError(_0x12a5bf,null));};exports[_0x7711('0x50')]=function(_0x3ddda1,_0x569456){var _0x26694e={'raw':![],'where':{'id':_0x3ddda1[_0x7711('0x51')]['id']}},_0x32be5e={};_0x32be5e[_0x7711('0x39')]=_[_0x7711('0x3a')](db[_0x7711('0x36')][_0x7711('0x52')]);_0x32be5e[_0x7711('0x3b')]=_[_0x7711('0x3a')](_0x3ddda1[_0x7711('0x3b')]);_0x32be5e[_0x7711('0x3c')]=_[_0x7711('0x3d')](_0x32be5e[_0x7711('0x39')],_0x32be5e[_0x7711('0x3b')]);_0x26694e[_0x7711('0x3f')]=_['intersection'](_0x32be5e[_0x7711('0x39')],qs['fields'](_0x3ddda1[_0x7711('0x3b')][_0x7711('0x3e')]));_0x26694e[_0x7711('0x3f')]=_0x26694e[_0x7711('0x3f')][_0x7711('0x40')]?_0x26694e[_0x7711('0x3f')]:_0x32be5e['model'];if(_0x3ddda1[_0x7711('0x3b')][_0x7711('0x4d')]){_0x26694e[_0x7711('0x4e')]=[{'all':!![]}];}_0x26694e=_[_0x7711('0x49')]({},_0x26694e,_0x3ddda1['options']);return db['Trunk'][_0x7711('0x53')](_0x26694e)[_0x7711('0x1c')](handleEntityNotFound(_0x569456,null))[_0x7711('0x1c')](respondWithResult(_0x569456,null))[_0x7711('0x27')](handleError(_0x569456,null));};exports[_0x7711('0x54')]=function(_0xc27fe,_0x444c47){var _0x40c424={'where':{'id':_0xc27fe[_0x7711('0x51')]['id']}},_0x5ea62a={};_0x5ea62a[_0x7711('0x39')]=_[_0x7711('0x3a')](db[_0x7711('0x36')][_0x7711('0x52')]);_0x40c424[_0x7711('0x3f')]=_['intersection'](_0x5ea62a[_0x7711('0x39')],qs[_0x7711('0x3e')](_0xc27fe[_0x7711('0x3b')][_0x7711('0x3e')]));_0x40c424[_0x7711('0x3f')]=_0x40c424['attributes'][_0x7711('0x40')]?_0x40c424['attributes']:_0x5ea62a[_0x7711('0x39')];if(_0xc27fe['query']['includeAll']){_0x40c424[_0x7711('0x4e')]=[{'all':!![]}];}_0x40c424=_['merge']({},_0x40c424,_0xc27fe['options']);return db[_0x7711('0x36')][_0x7711('0x53')](_0x40c424)[_0x7711('0x1c')](handleEntityNotFound(_0x444c47,null))[_0x7711('0x1c')](function(_0x362678){if(_0x362678){var _0x4613a7=_0x362678[_0x7711('0x55')]({'plain':!![]});_0x4613a7=qs[_0x7711('0x56')](_0x4613a7,['id',_0x7711('0x57'),_0x7711('0x58')]);_0xc27fe[_0x7711('0x59')]=_[_0x7711('0x56')](_0xc27fe[_0x7711('0x59')],['id',_0x7711('0x57'),_0x7711('0x58')]);return db[_0x7711('0x36')][_0x7711('0x5a')](_[_0x7711('0x49')](_0x4613a7,_0xc27fe[_0x7711('0x59')]),{'include':_0xc27fe[_0x7711('0x3b')][_0x7711('0x4d')]?[{'all':!![]}]:undefined})[_0x7711('0x1c')](function(_0x4eb792){var _0x18e031=_0xc27fe[_0x7711('0x5b')][_0x7711('0x55')]({'plain':!![]});if(!_0x18e031)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e031[_0x7711('0x5c')]===_0x7711('0x5b')){var _0x3f8c5e=_0x4eb792['get']({'plain':!![]});var _0x2cedc0=_0x7711('0x31');return db[_0x7711('0x5d')][_0x7711('0x53')]({'where':{'name':_0x2cedc0,'userProfileId':_0x18e031[_0x7711('0x5e')]},'raw':!![]})[_0x7711('0x1c')](function(_0x45d812){if(_0x45d812&&_0x45d812['autoAssociation']===0x0){return db['UserProfileResource'][_0x7711('0x5a')]({'name':_0x3f8c5e['name'],'resourceId':_0x3f8c5e['id'],'type':_0x45d812['name'],'sectionId':_0x45d812['id']},{})[_0x7711('0x1c')](function(){return _0x4eb792;});}else{return _0x4eb792;}})['catch'](function(_0x1db699){logger[_0x7711('0x22')](_0x7711('0x5f'),_0x1db699);throw _0x1db699;});}return _0x4eb792;});}})[_0x7711('0x1c')](respondWithResult(_0x444c47,0xc9))['catch'](handleError(_0x444c47,null));};exports[_0x7711('0x5a')]=function(_0x2f6020,_0x4cbd89,_0x4f3964){var _0x354233;return db[_0x7711('0x36')]['create'](_0x2f6020[_0x7711('0x59')],{'raw':!![]})[_0x7711('0x1c')](function(_0x36c500){_0x354233=_0x36c500;return db[_0x7711('0x36')]['findAll']({'raw':!![]});})[_0x7711('0x1c')](function(_0x582891){var _0x3ee75d=fs['readFileSync'](path[_0x7711('0x60')](config['root'],_0x7711('0x61')),'utf8');var _0x4e2adf=fs[_0x7711('0x62')](path[_0x7711('0x60')](config[_0x7711('0x63')],_0x7711('0x64')),'utf8');var _0x56d095=ejs['render'](_0x3ee75d,{'trunks':_0x582891||[]});fs[_0x7711('0x65')](_0x7711('0x66'),_0x56d095);if(_0x354233['registry']){var _0x42f2ae=ejs[_0x7711('0x67')](_0x4e2adf,{'trunks':_0x582891||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x42f2ae);}})['then'](function(){return respondWithRpcPromise(_0x7711('0x68'),_0x7711('0x5a'),{'module':_0x7711('0x69')});})[_0x7711('0x1c')](function(){var _0x44dbbe=_0x2f6020[_0x7711('0x5b')]['get']({'plain':!![]});if(!_0x44dbbe)throw new Error(_0x7711('0x6a'));if(_0x44dbbe[_0x7711('0x5c')]===_0x7711('0x5b')){var _0x11b34b=_0x354233[_0x7711('0x55')]({'plain':!![]});return db['UserProfileSection'][_0x7711('0x53')]({'where':{'name':_0x7711('0x31'),'userProfileId':_0x44dbbe[_0x7711('0x5e')]},'raw':!![]})[_0x7711('0x1c')](function(_0x317be6){if(_0x317be6&&_0x317be6[_0x7711('0x6b')]===0x0){return db[_0x7711('0x32')][_0x7711('0x5a')]({'name':_0x11b34b['name'],'resourceId':_0x11b34b['id'],'type':_0x317be6[_0x7711('0x33')],'sectionId':_0x317be6['id']},{})[_0x7711('0x1c')](function(){return _0x354233;});}else{return _0x354233;}})[_0x7711('0x27')](function(_0x5048d0){logger[_0x7711('0x22')](_0x7711('0x5f'),_0x5048d0);throw _0x5048d0;});}return _0x354233;})[_0x7711('0x1c')](respondWithResult(_0x4cbd89,0xc9))['catch'](handleError(_0x4cbd89,null));};exports['update']=function(_0x368697,_0x353685,_0x29972b){var _0x1a6047;return db['Trunk']['find']({'where':{'id':_0x368697[_0x7711('0x51')]['id']}})[_0x7711('0x1c')](handleEntityNotFound(_0x353685,null))[_0x7711('0x1c')](saveUpdates(_0x368697[_0x7711('0x59')],null))['then'](function(_0x20151b){if(_0x20151b){_0x1a6047=_0x20151b;return db['Trunk'][_0x7711('0x4f')]({'raw':!![]});}})[_0x7711('0x1c')](function(_0x3b0b3e){if(_0x3b0b3e){var _0x541813=fs['readFileSync'](path[_0x7711('0x60')](config[_0x7711('0x63')],_0x7711('0x61')),_0x7711('0x6c'));var _0xf3e1d6=fs[_0x7711('0x62')](path[_0x7711('0x60')](config[_0x7711('0x63')],_0x7711('0x64')),_0x7711('0x6c'));var _0x365ec6=ejs[_0x7711('0x67')](_0x541813,{'trunks':_0x3b0b3e||[]});fs[_0x7711('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x365ec6);var _0xd694af=ejs[_0x7711('0x67')](_0xf3e1d6,{'trunks':_0x3b0b3e||[]});fs[_0x7711('0x65')](_0x7711('0x6d'),_0xd694af);return respondWithRpcPromise(_0x7711('0x68'),'update',{'module':_0x7711('0x69')});}return null;})[_0x7711('0x1c')](function(_0x1ceef2){if(_0x1ceef2){return _0x1a6047;}})['then'](respondWithResult(_0x353685,null))['catch'](handleError(_0x353685,null));};exports[_0x7711('0x30')]=function(_0x46b16d,_0x36a3ea,_0x4161b5){var _0x74b53f;return db[_0x7711('0x36')][_0x7711('0x53')]({'where':{'id':_0x46b16d[_0x7711('0x51')]['id']}})[_0x7711('0x1c')](handleEntityNotFound(_0x36a3ea,null))['then'](removeEntity(_0x36a3ea,null))[_0x7711('0x1c')](function(){return db[_0x7711('0x36')][_0x7711('0x4f')]({'raw':!![]});})[_0x7711('0x1c')](function(_0x1758a9){var _0x385d59=fs['readFileSync'](path[_0x7711('0x60')](config[_0x7711('0x63')],_0x7711('0x61')),_0x7711('0x6c'));var _0x130760=fs[_0x7711('0x62')](path[_0x7711('0x60')](config[_0x7711('0x63')],_0x7711('0x64')),_0x7711('0x6c'));var _0x1d4fd0=ejs[_0x7711('0x67')](_0x385d59,{'trunks':_0x1758a9});var _0x5c50c9=ejs['render'](_0x130760,{'trunks':_0x1758a9});fs[_0x7711('0x65')](_0x7711('0x66'),_0x1d4fd0);fs['writeFileSync'](_0x7711('0x6d'),_0x5c50c9);return respondWithRpcPromise('Reload','destroy',{'module':_0x7711('0x69')});})['catch'](handleError(_0x36a3ea,null));}; \ No newline at end of file +var _0x7633=['path','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','name','send','index','map','Trunk','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','where','count','include','findAll','rows','show','length','includeAll','find','clone','params','rawAttributes','get','createdAt','omit','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','autoAssociation','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x55cdc5,_0x2b2297){var _0x29acd5=function(_0x405234){while(--_0x405234){_0x55cdc5['push'](_0x55cdc5['shift']());}};_0x29acd5(++_0x2b2297);}(_0x7633,0x1c4));var _0x3763=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7633[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0x3763('0x0'));var emlformat=require(_0x3763('0x1'));var rimraf=require(_0x3763('0x2'));var zipdir=require(_0x3763('0x3'));var jsonpatch=require(_0x3763('0x4'));var rp=require('request-promise');var moment=require(_0x3763('0x5'));var BPromise=require(_0x3763('0x6'));var Mustache=require('mustache');var util=require(_0x3763('0x7'));var path=require(_0x3763('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3763('0x9'));var fs=require('fs');var _=require(_0x3763('0xa'));var squel=require(_0x3763('0xb'));var crypto=require(_0x3763('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3763('0xd'));var querystring=require(_0x3763('0xe'));var Papa=require('papaparse');var Redis=require(_0x3763('0xf'));var authService=require(_0x3763('0x10'));var qs=require(_0x3763('0x11'));var as=require(_0x3763('0x12'));var hardwareService=require(_0x3763('0x13'));var logger=require(_0x3763('0x14'))(_0x3763('0x15'));var utils=require(_0x3763('0x16'));var config=require('../../config/environment');var db=require(_0x3763('0x17'))['db'];var jayson=require(_0x3763('0x18'));var client=jayson[_0x3763('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x59980c,_0x10602e,_0x58e8c9){if(_0x58e8c9){var _0x12f0ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12f0ea[_0x3763('0x1a')](_0x10602e)){return _0x59980c;}else{throw new db[(_0x3763('0x1b'))][(_0x3763('0x1c'))](_0x3763('0x1d'));}}else{return _0x59980c;}}function respondWithRpcPromise(_0x1d1a10,_0x1110e0,_0x4c877a,_0xa95c5b){return new BPromise(function(_0x368434,_0x3fba25){var _0x49b50e=_0xa95c5b||client;return _0x49b50e['request'](_0x1d1a10,_0x4c877a)['then'](function(_0x1bb7bc){logger[_0x3763('0x1e')](_0x3763('0x1f'),_0x1110e0,_0x3763('0x20'));logger[_0x3763('0x21')](_0x3763('0x22'),_0x1110e0,_0x3763('0x20'),JSON['stringify'](_0x1bb7bc));if(_0x1bb7bc[_0x3763('0x23')]){if(_0x1bb7bc[_0x3763('0x23')][_0x3763('0x24')]===0x1f4){logger[_0x3763('0x23')]('Trunk,\x20%s,\x20%s',_0x1110e0,_0x1bb7bc['error'][_0x3763('0x25')]);return _0x3fba25(_0x1bb7bc[_0x3763('0x23')][_0x3763('0x25')]);}logger[_0x3763('0x23')]('Trunk,\x20%s,\x20%s',_0x1110e0,_0x1bb7bc[_0x3763('0x23')]['message']);return _0x368434(_0x1bb7bc[_0x3763('0x23')][_0x3763('0x25')]);}else{logger['info'](_0x3763('0x1f'),_0x1110e0,_0x3763('0x20'));_0x368434(_0x1bb7bc[_0x3763('0x26')][_0x3763('0x25')]);}})[_0x3763('0x27')](function(_0x422607){logger[_0x3763('0x23')]('Trunk,\x20%s,\x20%s',_0x1110e0,_0x422607);_0x3fba25(_0x422607);});});}function respondWithStatusCode(_0x57036c,_0x51e77a){_0x51e77a=_0x51e77a||0xcc;return function(_0x434fa3){if(_0x434fa3){return _0x57036c[_0x3763('0x28')](_0x51e77a);}return _0x57036c[_0x3763('0x29')](_0x51e77a)[_0x3763('0x2a')]();};}function respondWithResult(_0x3f6644,_0x1ccd28){_0x1ccd28=_0x1ccd28||0xc8;return function(_0x53e7ba){if(_0x53e7ba){return _0x3f6644[_0x3763('0x29')](_0x1ccd28)[_0x3763('0x2b')](_0x53e7ba);}};}function respondWithFilteredResult(_0x1bd690,_0x339870){return function(_0x136c67){if(_0x136c67){var _0x4f9a96=_0x136c67['count'],_0xd128d8=_0x339870[_0x3763('0x2c')],_0xb1b938=_0x339870[_0x3763('0x2c')]+_0x339870[_0x3763('0x2d')],_0x2f6e9d;if(_0xb1b938>=_0x4f9a96){_0xb1b938=_0x4f9a96;_0x2f6e9d=0xc8;}else{_0x2f6e9d=0xce;}_0x1bd690['status'](_0x2f6e9d);return _0x1bd690[_0x3763('0x2e')](_0x3763('0x2f'),_0xd128d8+'-'+_0xb1b938+'/'+_0x4f9a96)[_0x3763('0x2b')](_0x136c67);}return null;};}function patchUpdates(_0x21b7a4){return function(_0x44cce6){try{jsonpatch['apply'](_0x44cce6,_0x21b7a4,!![]);}catch(_0x482c63){return BPromise[_0x3763('0x30')](_0x482c63);}return _0x44cce6[_0x3763('0x31')]();};}function saveUpdates(_0xb9e1c2,_0x4258e6){return function(_0x173f31){if(_0x173f31){return _0x173f31[_0x3763('0x32')](_0xb9e1c2)[_0x3763('0x33')](function(_0x8dd210){return _0x8dd210;});}return null;};}function removeEntity(_0x52e0f7,_0x11293e){return function(_0x195acd){if(_0x195acd){return _0x195acd[_0x3763('0x34')]()[_0x3763('0x33')](function(){var _0x5057f5=_0x195acd['get']({'plain':!![]});var _0x4b6a56='Trunks';return db[_0x3763('0x35')][_0x3763('0x34')]({'where':{'type':_0x4b6a56,'resourceId':_0x5057f5['id']}})['then'](function(){return _0x195acd;});})[_0x3763('0x33')](function(){_0x52e0f7[_0x3763('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x805718,_0x324e18){return function(_0x427692){if(!_0x427692){_0x805718[_0x3763('0x28')](0x194);}return _0x427692;};}function handleError(_0x3fdd2f,_0x3dc171){_0x3dc171=_0x3dc171||0x1f4;return function(_0xc1d8a7){logger[_0x3763('0x23')](_0xc1d8a7['stack']);if(_0xc1d8a7[_0x3763('0x36')]){delete _0xc1d8a7[_0x3763('0x36')];}_0x3fdd2f['status'](_0x3dc171)[_0x3763('0x37')](_0xc1d8a7);};}exports[_0x3763('0x38')]=function(_0x11735f,_0x545e7c){var _0x37f6c3={},_0x5bd257={},_0x434dbe={'count':0x0,'rows':[]};var _0x4b0612=_[_0x3763('0x39')](db[_0x3763('0x3a')]['rawAttributes'],function(_0x3279be){return{'name':_0x3279be[_0x3763('0x3b')],'type':_0x3279be[_0x3763('0x3c')][_0x3763('0x3d')]};});_0x5bd257['model']=_[_0x3763('0x39')](_0x4b0612,_0x3763('0x36'));_0x5bd257['query']=_[_0x3763('0x3e')](_0x11735f[_0x3763('0x3f')]);_0x5bd257['filters']=_[_0x3763('0x40')](_0x5bd257[_0x3763('0x41')],_0x5bd257[_0x3763('0x3f')]);_0x37f6c3[_0x3763('0x42')]=_['intersection'](_0x5bd257[_0x3763('0x41')],qs[_0x3763('0x43')](_0x11735f[_0x3763('0x3f')][_0x3763('0x43')]));_0x37f6c3['attributes']=_0x37f6c3['attributes']['length']?_0x37f6c3['attributes']:_0x5bd257['model'];if(!_0x11735f[_0x3763('0x3f')][_0x3763('0x44')](_0x3763('0x45'))){_0x37f6c3['limit']=qs[_0x3763('0x2d')](_0x11735f[_0x3763('0x3f')][_0x3763('0x2d')]);_0x37f6c3[_0x3763('0x2c')]=qs[_0x3763('0x2c')](_0x11735f[_0x3763('0x3f')][_0x3763('0x2c')]);}_0x37f6c3[_0x3763('0x46')]=qs[_0x3763('0x47')](_0x11735f[_0x3763('0x3f')][_0x3763('0x47')]);_0x37f6c3['where']=qs['filters'](_['pick'](_0x11735f[_0x3763('0x3f')],_0x5bd257[_0x3763('0x48')]),_0x4b0612);if(_0x11735f[_0x3763('0x3f')][_0x3763('0x49')]){_0x37f6c3['where']=_[_0x3763('0x4a')](_0x37f6c3['where'],{'$or':_[_0x3763('0x39')](_0x4b0612,function(_0x2e59b4){if(_0x2e59b4[_0x3763('0x3c')]!==_0x3763('0x4b')){var _0x39e06b={};_0x39e06b[_0x2e59b4[_0x3763('0x36')]]={'$like':'%'+_0x11735f[_0x3763('0x3f')]['filter']+'%'};return _0x39e06b;}})});}_0x37f6c3=_[_0x3763('0x4a')]({},_0x37f6c3,_0x11735f[_0x3763('0x4c')]);var _0x1e1d23={'where':_0x37f6c3[_0x3763('0x4d')]};return db['Trunk']['count'](_0x1e1d23)[_0x3763('0x33')](function(_0x5ad064){_0x434dbe[_0x3763('0x4e')]=_0x5ad064;if(_0x11735f['query']['includeAll']){_0x37f6c3[_0x3763('0x4f')]=[{'all':!![]}];}return db[_0x3763('0x3a')][_0x3763('0x50')](_0x37f6c3);})[_0x3763('0x33')](function(_0x350093){_0x434dbe[_0x3763('0x51')]=_0x350093;return _0x434dbe;})[_0x3763('0x33')](respondWithFilteredResult(_0x545e7c,_0x37f6c3))['catch'](handleError(_0x545e7c,null));};exports[_0x3763('0x52')]=function(_0x14f0ca,_0x13cdab){var _0x46334a={'raw':![],'where':{'id':_0x14f0ca['params']['id']}},_0x4048be={};_0x4048be[_0x3763('0x41')]=_[_0x3763('0x3e')](db[_0x3763('0x3a')]['rawAttributes']);_0x4048be[_0x3763('0x3f')]=_[_0x3763('0x3e')](_0x14f0ca['query']);_0x4048be[_0x3763('0x48')]=_['intersection'](_0x4048be[_0x3763('0x41')],_0x4048be[_0x3763('0x3f')]);_0x46334a['attributes']=_['intersection'](_0x4048be['model'],qs[_0x3763('0x43')](_0x14f0ca[_0x3763('0x3f')][_0x3763('0x43')]));_0x46334a[_0x3763('0x42')]=_0x46334a[_0x3763('0x42')][_0x3763('0x53')]?_0x46334a[_0x3763('0x42')]:_0x4048be[_0x3763('0x41')];if(_0x14f0ca['query'][_0x3763('0x54')]){_0x46334a['include']=[{'all':!![]}];}_0x46334a=_[_0x3763('0x4a')]({},_0x46334a,_0x14f0ca[_0x3763('0x4c')]);return db['Trunk'][_0x3763('0x55')](_0x46334a)['then'](handleEntityNotFound(_0x13cdab,null))['then'](respondWithResult(_0x13cdab,null))[_0x3763('0x27')](handleError(_0x13cdab,null));};exports[_0x3763('0x56')]=function(_0x3ebc1a,_0x5b66c7){var _0x4578fd={'where':{'id':_0x3ebc1a[_0x3763('0x57')]['id']}},_0x52d80e={};_0x52d80e['model']=_[_0x3763('0x3e')](db[_0x3763('0x3a')][_0x3763('0x58')]);_0x4578fd[_0x3763('0x42')]=_[_0x3763('0x40')](_0x52d80e[_0x3763('0x41')],qs[_0x3763('0x43')](_0x3ebc1a[_0x3763('0x3f')][_0x3763('0x43')]));_0x4578fd['attributes']=_0x4578fd[_0x3763('0x42')]['length']?_0x4578fd[_0x3763('0x42')]:_0x52d80e['model'];if(_0x3ebc1a[_0x3763('0x3f')][_0x3763('0x54')]){_0x4578fd[_0x3763('0x4f')]=[{'all':!![]}];}_0x4578fd=_[_0x3763('0x4a')]({},_0x4578fd,_0x3ebc1a['options']);return db[_0x3763('0x3a')][_0x3763('0x55')](_0x4578fd)[_0x3763('0x33')](handleEntityNotFound(_0x5b66c7,null))[_0x3763('0x33')](function(_0x579982){if(_0x579982){var _0x34ff67=_0x579982[_0x3763('0x59')]({'plain':!![]});_0x34ff67=qs['omit'](_0x34ff67,['id',_0x3763('0x5a'),'updatedAt']);_0x3ebc1a['body']=_[_0x3763('0x5b')](_0x3ebc1a[_0x3763('0x5c')],['id',_0x3763('0x5a'),_0x3763('0x5d')]);return db[_0x3763('0x3a')][_0x3763('0x5e')](_['merge'](_0x34ff67,_0x3ebc1a[_0x3763('0x5c')]),{'include':_0x3ebc1a['query'][_0x3763('0x54')]?[{'all':!![]}]:undefined})[_0x3763('0x33')](function(_0x295912){var _0x25235e=_0x3ebc1a[_0x3763('0x5f')]['get']({'plain':!![]});if(!_0x25235e)throw new Error(_0x3763('0x60'));if(_0x25235e[_0x3763('0x61')]===_0x3763('0x5f')){var _0x3eda4d=_0x295912[_0x3763('0x59')]({'plain':!![]});var _0x47865a=_0x3763('0x62');return db[_0x3763('0x63')][_0x3763('0x55')]({'where':{'name':_0x47865a,'userProfileId':_0x25235e['userProfileId']},'raw':!![]})[_0x3763('0x33')](function(_0xe98726){if(_0xe98726&&_0xe98726[_0x3763('0x64')]===0x0){return db[_0x3763('0x35')]['create']({'name':_0x3eda4d[_0x3763('0x36')],'resourceId':_0x3eda4d['id'],'type':_0xe98726[_0x3763('0x36')],'sectionId':_0xe98726['id']},{})['then'](function(){return _0x295912;});}else{return _0x295912;}})[_0x3763('0x27')](function(_0x27debc){logger[_0x3763('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27debc);throw _0x27debc;});}return _0x295912;});}})[_0x3763('0x33')](respondWithResult(_0x5b66c7,0xc9))[_0x3763('0x27')](handleError(_0x5b66c7,null));};exports[_0x3763('0x5e')]=function(_0x3fae03,_0x47aa3e,_0xf5c13d){var _0x202f58;return db['Trunk'][_0x3763('0x5e')](_0x3fae03['body'],{'raw':!![]})[_0x3763('0x33')](function(_0x3f42fe){_0x202f58=_0x3f42fe;return db[_0x3763('0x3a')][_0x3763('0x50')]({'raw':!![]});})[_0x3763('0x33')](function(_0x46758e){var _0x3c75c9=fs[_0x3763('0x65')](path[_0x3763('0x66')](config['root'],_0x3763('0x67')),_0x3763('0x68'));var _0xbc4dad=fs[_0x3763('0x65')](path['join'](config['root'],_0x3763('0x69')),'utf8');var _0x150a64=ejs[_0x3763('0x6a')](_0x3c75c9,{'trunks':_0x46758e||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x150a64);if(_0x202f58[_0x3763('0x6b')]){var _0x434cf9=ejs[_0x3763('0x6a')](_0xbc4dad,{'trunks':_0x46758e||[]});fs[_0x3763('0x6c')](_0x3763('0x6d'),_0x434cf9);}})[_0x3763('0x33')](function(){return respondWithRpcPromise(_0x3763('0x6e'),'create',{'module':_0x3763('0x6f')});})[_0x3763('0x33')](function(){var _0x2ccf7e=_0x3fae03[_0x3763('0x5f')]['get']({'plain':!![]});if(!_0x2ccf7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ccf7e[_0x3763('0x61')]===_0x3763('0x5f')){var _0x26c685=_0x202f58[_0x3763('0x59')]({'plain':!![]});return db[_0x3763('0x63')]['find']({'where':{'name':'Trunks','userProfileId':_0x2ccf7e['userProfileId']},'raw':!![]})[_0x3763('0x33')](function(_0x142ce8){if(_0x142ce8&&_0x142ce8['autoAssociation']===0x0){return db[_0x3763('0x35')][_0x3763('0x5e')]({'name':_0x26c685[_0x3763('0x36')],'resourceId':_0x26c685['id'],'type':_0x142ce8['name'],'sectionId':_0x142ce8['id']},{})['then'](function(){return _0x202f58;});}else{return _0x202f58;}})[_0x3763('0x27')](function(_0x1bc116){logger[_0x3763('0x23')](_0x3763('0x70'),_0x1bc116);throw _0x1bc116;});}return _0x202f58;})[_0x3763('0x33')](respondWithResult(_0x47aa3e,0xc9))['catch'](handleError(_0x47aa3e,null));};exports['update']=function(_0x140d86,_0x554f57,_0x5cec0e){var _0x31904d;return db[_0x3763('0x3a')]['find']({'where':{'id':_0x140d86[_0x3763('0x57')]['id']}})[_0x3763('0x33')](handleEntityNotFound(_0x554f57,null))[_0x3763('0x33')](saveUpdates(_0x140d86[_0x3763('0x5c')],null))[_0x3763('0x33')](function(_0x40782e){if(_0x40782e){_0x31904d=_0x40782e;return db[_0x3763('0x3a')]['findAll']({'raw':!![]});}})[_0x3763('0x33')](function(_0x3c7d68){if(_0x3c7d68){var _0x557a44=fs[_0x3763('0x65')](path[_0x3763('0x66')](config['root'],_0x3763('0x67')),_0x3763('0x68'));var _0x21a1e9=fs['readFileSync'](path['join'](config[_0x3763('0x71')],_0x3763('0x69')),_0x3763('0x68'));var _0x3033fd=ejs[_0x3763('0x6a')](_0x557a44,{'trunks':_0x3c7d68||[]});fs[_0x3763('0x6c')](_0x3763('0x72'),_0x3033fd);var _0x176551=ejs[_0x3763('0x6a')](_0x21a1e9,{'trunks':_0x3c7d68||[]});fs[_0x3763('0x6c')](_0x3763('0x6d'),_0x176551);return respondWithRpcPromise('Reload',_0x3763('0x32'),{'module':_0x3763('0x6f')});}return null;})[_0x3763('0x33')](function(_0x228e40){if(_0x228e40){return _0x31904d;}})[_0x3763('0x33')](respondWithResult(_0x554f57,null))[_0x3763('0x27')](handleError(_0x554f57,null));};exports[_0x3763('0x34')]=function(_0xe7135d,_0x22cae2,_0x36ab9b){var _0x3b09ca;return db[_0x3763('0x3a')]['find']({'where':{'id':_0xe7135d[_0x3763('0x57')]['id']}})[_0x3763('0x33')](handleEntityNotFound(_0x22cae2,null))[_0x3763('0x33')](removeEntity(_0x22cae2,null))[_0x3763('0x33')](function(){return db[_0x3763('0x3a')][_0x3763('0x50')]({'raw':!![]});})[_0x3763('0x33')](function(_0x351aa7){var _0x385dbb=fs[_0x3763('0x65')](path[_0x3763('0x66')](config['root'],_0x3763('0x67')),_0x3763('0x68'));var _0x3b1617=fs[_0x3763('0x65')](path[_0x3763('0x66')](config[_0x3763('0x71')],_0x3763('0x69')),'utf8');var _0x102b4a=ejs[_0x3763('0x6a')](_0x385dbb,{'trunks':_0x351aa7});var _0x10d6b3=ejs[_0x3763('0x6a')](_0x3b1617,{'trunks':_0x351aa7});fs[_0x3763('0x6c')](_0x3763('0x72'),_0x102b4a);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x10d6b3);return respondWithRpcPromise(_0x3763('0x6e'),'destroy',{'module':_0x3763('0x6f')});})[_0x3763('0x27')](handleError(_0x22cae2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 096938f..659d390 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 _0xf322=['moment','request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api'];(function(_0x5d3f34,_0x12b1e7){var _0x20fe0a=function(_0x119502){while(--_0x119502){_0x5d3f34['push'](_0x5d3f34['shift']());}};_0x20fe0a(++_0x12b1e7);}(_0xf322,0x141));var _0x2f32=function(_0x45d3ba,_0x52d823){_0x45d3ba=_0x45d3ba-0x0;var _0x4f3a8a=_0xf322[_0x45d3ba];return _0x4f3a8a;};'use strict';var _=require(_0x2f32('0x0'));var util=require(_0x2f32('0x1'));var logger=require('../../config/logger')(_0x2f32('0x2'));var moment=require(_0x2f32('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f32('0x4'));var fs=require('fs');var path=require(_0x2f32('0x5'));var rimraf=require('rimraf');var config=require(_0x2f32('0x6'));var attributes=require(_0x2f32('0x7'));module[_0x2f32('0x8')]=function(_0x1ae861,_0x57ffa5){return _0x1ae861[_0x2f32('0x9')](_0x2f32('0xa'),attributes,{'tableName':_0x2f32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8db9=['lodash','util','../../config/logger','moment','bluebird','request-promise','./trunk.attributes','tools_trunks'];(function(_0x302251,_0x1a1a37){var _0x1d6774=function(_0x5b63f0){while(--_0x5b63f0){_0x302251['push'](_0x302251['shift']());}};_0x1d6774(++_0x1a1a37);}(_0x8db9,0x1a0));var _0x98db=function(_0x3a8ef2,_0x4a34e2){_0x3a8ef2=_0x3a8ef2-0x0;var _0x53a0d6=_0x8db9[_0x3a8ef2];return _0x53a0d6;};'use strict';var _=require(_0x98db('0x0'));var util=require(_0x98db('0x1'));var logger=require(_0x98db('0x2'))('api');var moment=require(_0x98db('0x3'));var BPromise=require(_0x98db('0x4'));var rp=require(_0x98db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98db('0x6'));module['exports']=function(_0x15e3fc,_0x1416ac){return _0x15e3fc['define']('Trunk',attributes,{'tableName':_0x98db('0x7'),'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 0a814a9..e29dae2 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 _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x12b294,_0x192e53){var _0x7b92cb=function(_0x16898e){while(--_0x16898e){_0x12b294['push'](_0x12b294['shift']());}};_0x7b92cb(++_0x192e53);}(_0x14a0,0x8e));var _0x014a=function(_0x151b19,_0x397bd5){_0x151b19=_0x151b19-0x0;var _0x6eb276=_0x14a0[_0x151b19];return _0x6eb276;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c2a49,_0x16b02c){_0x1c2a49=_0x1c2a49-0x0;var _0x11639e=_0x5f2f[_0x1c2a49];return _0x11639e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 26a8a5d..37a0ccc 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 _0x3a96=['/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','/:id','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','/:id/scheduled_calls','/:id/api_key','getApiKey','bulkCreate','post','addQueues','diskStorage','join','root','format','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x5238d3,_0x589838){var _0x535bd8=function(_0x431a1f){while(--_0x431a1f){_0x5238d3['push'](_0x5238d3['shift']());}};_0x535bd8(++_0x589838);}(_0x3a96,0x1bd));var _0x63a9=function(_0x1f88bc,_0x2950c6){_0x1f88bc=_0x1f88bc-0x0;var _0x3f6735=_0x3a96[_0x1f88bc];return _0x3f6735;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x63a9('0x0'));var express=require(_0x63a9('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x63a9('0x2'));var config=require(_0x63a9('0x3'));var controller=require('./user.controller');router[_0x63a9('0x4')]('/',auth[_0x63a9('0x5')](),controller[_0x63a9('0x6')]);router['get'](_0x63a9('0x7'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x8')]);router[_0x63a9('0x4')](_0x63a9('0x9'),auth[_0x63a9('0x5')](),controller[_0x63a9('0xa')]);router[_0x63a9('0x4')]('/:id',auth[_0x63a9('0x5')](),controller[_0x63a9('0xb')]);router[_0x63a9('0x4')](_0x63a9('0xc'),controller['getAvatar']);router[_0x63a9('0x4')](_0x63a9('0xd'),auth[_0x63a9('0x5')](),controller[_0x63a9('0xe')]);router['get'](_0x63a9('0xf'),auth['isAuthenticated'](),controller['getQueues']);router['get'](_0x63a9('0x10'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x11')]);router[_0x63a9('0x4')](_0x63a9('0x12'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x13')]);router[_0x63a9('0x4')](_0x63a9('0x14'),auth[_0x63a9('0x5')](),controller['getRecordings']);router[_0x63a9('0x4')](_0x63a9('0x15'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x16')]);router[_0x63a9('0x4')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x63a9('0x4')]('/:id/openchannel/interactions',auth[_0x63a9('0x5')](),controller[_0x63a9('0x17')]);router[_0x63a9('0x4')]('/:id/mail/interactions',auth[_0x63a9('0x5')](),controller[_0x63a9('0x18')]);router[_0x63a9('0x4')](_0x63a9('0x19'),auth[_0x63a9('0x5')](),controller['getSmsInteractions']);router[_0x63a9('0x4')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x63a9('0x1a')]);router[_0x63a9('0x4')](_0x63a9('0x1b'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x1c')]);router['get'](_0x63a9('0x1d'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x1e')]);router[_0x63a9('0x4')]('/:id/lists',auth[_0x63a9('0x5')](),controller['getLists']);router['get'](_0x63a9('0x1f'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x20')]);router[_0x63a9('0x4')](_0x63a9('0x21'),auth[_0x63a9('0x5')](),controller['getVoicePrefixes']);router[_0x63a9('0x4')](_0x63a9('0x22'),auth[_0x63a9('0x5')](),controller['getFaxAccounts']);router['get'](_0x63a9('0x23'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x24')]);router[_0x63a9('0x4')](_0x63a9('0x25'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x63a9('0x4')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x63a9('0x26')]);router[_0x63a9('0x4')]('/:id/chat_websites',auth[_0x63a9('0x5')](),controller[_0x63a9('0x27')]);router['get']('/:id/whatsapp_accounts',auth[_0x63a9('0x5')](),controller['getWhatsappAccounts']);router[_0x63a9('0x4')]('/:id/square_projects',auth[_0x63a9('0x5')](),controller['getSquareProjects']);router['get'](_0x63a9('0x28'),auth[_0x63a9('0x5')](),controller['getScheduledCalls']);router[_0x63a9('0x4')](_0x63a9('0x29'),auth['isAuthenticated'](),controller[_0x63a9('0x2a')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x63a9('0x2b')]);router['post'](_0x63a9('0xd'),auth[_0x63a9('0x5')](),controller['addContacts']);router[_0x63a9('0x2c')]('/',auth[_0x63a9('0x5')](),controller['create']);router[_0x63a9('0x2c')]('/:id/queues',auth[_0x63a9('0x5')](),controller[_0x63a9('0x2d')]);var upload=multer({'storage':multer[_0x63a9('0x2e')]({'destination':function(_0xb3505d,_0x3ba0e2,_0x53d1a3){_0x53d1a3(null,path[_0x63a9('0x2f')](config[_0x63a9('0x30')],'server/files/images/'));},'filename':function(_0x2839a9,_0x4c0454,_0x2dad21){_0x2dad21(null,util[_0x63a9('0x31')]('%s-%s',Date[_0x63a9('0x32')](),_0x4c0454[_0x63a9('0x33')]));}})});router[_0x63a9('0x2c')](_0x63a9('0xc'),upload[_0x63a9('0x34')]('file'),controller[_0x63a9('0x35')]);router[_0x63a9('0x2c')](_0x63a9('0x36'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x37')]);router[_0x63a9('0x2c')](_0x63a9('0x38'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x39')]);router['post'](_0x63a9('0x3a'),auth['isAuthenticated'](),controller[_0x63a9('0x3b')]);router[_0x63a9('0x2c')](_0x63a9('0x3c'),auth['isAuthenticated'](),controller[_0x63a9('0x3d')]);router[_0x63a9('0x2c')](_0x63a9('0x1d'),auth[_0x63a9('0x5')](),controller['addTeams']);router[_0x63a9('0x2c')](_0x63a9('0x3e'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x3f')]);router[_0x63a9('0x2c')](_0x63a9('0x40'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x41')]);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x63a9('0x42')]);router[_0x63a9('0x2c')](_0x63a9('0x43'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x44')]);router[_0x63a9('0x2c')]('/:id/openchannel_interactions',auth[_0x63a9('0x5')](),controller[_0x63a9('0x45')]);router[_0x63a9('0x2c')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x63a9('0x46')]);router['post'](_0x63a9('0x22'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x47')]);router[_0x63a9('0x2c')]('/:id/mail_accounts',auth[_0x63a9('0x5')](),controller[_0x63a9('0x48')]);router['post'](_0x63a9('0x25'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x49')]);router[_0x63a9('0x2c')]('/:id/sms_accounts',auth[_0x63a9('0x5')](),controller[_0x63a9('0x4a')]);router[_0x63a9('0x2c')](_0x63a9('0x4b'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x4c')]);router[_0x63a9('0x2c')](_0x63a9('0x4d'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x4e')]);router[_0x63a9('0x2c')](_0x63a9('0x4f'),auth['isAuthenticated'](),controller[_0x63a9('0x50')]);router['post'](_0x63a9('0x29'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x51')]);router['put'](_0x63a9('0x52'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x53')]);router['put']('/:id/password',auth[_0x63a9('0x5')](),controller[_0x63a9('0x54')]);router[_0x63a9('0x55')](_0x63a9('0xf'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x56')]);router['delete']('/:id/teams',auth[_0x63a9('0x5')](),controller[_0x63a9('0x57')]);router['delete'](_0x63a9('0x52'),auth['isAuthenticated'](),controller[_0x63a9('0x58')]);router[_0x63a9('0x55')](_0x63a9('0x3e'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x59')]);router[_0x63a9('0x55')](_0x63a9('0x40'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x63a9('0x55')](_0x63a9('0x5a'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x5b')]);router[_0x63a9('0x55')](_0x63a9('0x43'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x5c')]);router[_0x63a9('0x55')](_0x63a9('0x5d'),auth[_0x63a9('0x5')](),controller['removeOpenchannelInteractions']);router[_0x63a9('0x55')](_0x63a9('0x5e'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x5f')]);router[_0x63a9('0x55')](_0x63a9('0x22'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x60')]);router[_0x63a9('0x55')](_0x63a9('0x23'),auth['isAuthenticated'](),controller[_0x63a9('0x61')]);router['delete']('/:id/openchannel_accounts',auth[_0x63a9('0x5')](),controller[_0x63a9('0x62')]);router[_0x63a9('0x55')](_0x63a9('0x63'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x64')]);router[_0x63a9('0x55')](_0x63a9('0x4b'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x65')]);router[_0x63a9('0x55')](_0x63a9('0x4d'),auth['isAuthenticated'](),controller[_0x63a9('0x66')]);router['delete'](_0x63a9('0x4f'),auth[_0x63a9('0x5')](),controller[_0x63a9('0x67')]);router[_0x63a9('0x55')]('/:id/api_key',auth[_0x63a9('0x5')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x204e=['/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','/:id/mail_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeSquareProjects','/:id/api_key','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./user.controller','get','index','isAuthenticated','describe','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x204e,0xc8));var _0xe204=function(_0x5c37b2,_0xd39c38){_0x5c37b2=_0x5c37b2-0x0;var _0x435450=_0x204e[_0x5c37b2];return _0x435450;};'use strict';var multer=require(_0xe204('0x0'));var util=require(_0xe204('0x1'));var path=require(_0xe204('0x2'));var timeout=require(_0xe204('0x3'));var express=require('express');var router=express[_0xe204('0x4')]();var auth=require(_0xe204('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe204('0x6'));router[_0xe204('0x7')]('/',auth['isAuthenticated'](),controller[_0xe204('0x8')]);router[_0xe204('0x7')]('/describe',auth[_0xe204('0x9')](),controller[_0xe204('0xa')]);router[_0xe204('0x7')]('/whoami',auth[_0xe204('0x9')](),controller[_0xe204('0xb')]);router[_0xe204('0x7')](_0xe204('0xc'),auth[_0xe204('0x9')](),controller[_0xe204('0xd')]);router[_0xe204('0x7')](_0xe204('0xe'),controller[_0xe204('0xf')]);router[_0xe204('0x7')](_0xe204('0x10'),auth['isAuthenticated'](),controller[_0xe204('0x11')]);router[_0xe204('0x7')](_0xe204('0x12'),auth[_0xe204('0x9')](),controller[_0xe204('0x13')]);router[_0xe204('0x7')](_0xe204('0x14'),auth[_0xe204('0x9')](),controller['getVoiceQueuesRt']);router['get'](_0xe204('0x15'),auth['isAuthenticated'](),controller[_0xe204('0x16')]);router[_0xe204('0x7')](_0xe204('0x17'),auth[_0xe204('0x9')](),controller['getRecordings']);router[_0xe204('0x7')]('/:id/screen_recordings',auth[_0xe204('0x9')](),controller['getScreenRecordings']);router[_0xe204('0x7')](_0xe204('0x18'),auth[_0xe204('0x9')](),controller[_0xe204('0x19')]);router[_0xe204('0x7')]('/:id/openchannel/interactions',auth[_0xe204('0x9')](),controller[_0xe204('0x1a')]);router['get'](_0xe204('0x1b'),auth['isAuthenticated'](),controller[_0xe204('0x1c')]);router[_0xe204('0x7')](_0xe204('0x1d'),auth[_0xe204('0x9')](),controller[_0xe204('0x1e')]);router['get'](_0xe204('0x1f'),auth['isAuthenticated'](),controller[_0xe204('0x20')]);router[_0xe204('0x7')](_0xe204('0x21'),auth['isAuthenticated'](),controller[_0xe204('0x22')]);router[_0xe204('0x7')](_0xe204('0x23'),auth[_0xe204('0x9')](),controller['getTeams']);router[_0xe204('0x7')](_0xe204('0x24'),auth[_0xe204('0x9')](),controller['getLists']);router[_0xe204('0x7')](_0xe204('0x25'),auth['isAuthenticated'](),controller[_0xe204('0x26')]);router[_0xe204('0x7')](_0xe204('0x27'),auth[_0xe204('0x9')](),controller[_0xe204('0x28')]);router[_0xe204('0x7')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe204('0x29')]);router[_0xe204('0x7')](_0xe204('0x2a'),auth[_0xe204('0x9')](),controller['getMailAccounts']);router[_0xe204('0x7')](_0xe204('0x2b'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xe204('0x7')]('/:id/sms_accounts',auth[_0xe204('0x9')](),controller[_0xe204('0x2c')]);router[_0xe204('0x7')](_0xe204('0x2d'),auth[_0xe204('0x9')](),controller['getChatWebsites']);router[_0xe204('0x7')](_0xe204('0x2e'),auth[_0xe204('0x9')](),controller[_0xe204('0x2f')]);router['get'](_0xe204('0x30'),auth['isAuthenticated'](),controller[_0xe204('0x31')]);router['get'](_0xe204('0x32'),auth[_0xe204('0x9')](),controller[_0xe204('0x33')]);router[_0xe204('0x7')]('/:id/api_key',auth[_0xe204('0x9')](),controller[_0xe204('0x34')]);router[_0xe204('0x35')](_0xe204('0x36'),auth[_0xe204('0x9')](),controller[_0xe204('0x37')]);router[_0xe204('0x35')](_0xe204('0x10'),auth[_0xe204('0x9')](),controller[_0xe204('0x38')]);router[_0xe204('0x35')]('/',auth[_0xe204('0x9')](),controller[_0xe204('0x39')]);router[_0xe204('0x35')](_0xe204('0x12'),auth[_0xe204('0x9')](),controller[_0xe204('0x3a')]);var upload=multer({'storage':multer[_0xe204('0x3b')]({'destination':function(_0x52fcfb,_0x574d4e,_0x47f20e){_0x47f20e(null,path[_0xe204('0x3c')](config[_0xe204('0x3d')],_0xe204('0x3e')));},'filename':function(_0x4e92a6,_0x59bf85,_0x45999e){_0x45999e(null,util['format'](_0xe204('0x3f'),Date['now'](),_0x59bf85[_0xe204('0x40')]));}})});router[_0xe204('0x35')](_0xe204('0xe'),upload[_0xe204('0x41')]('file'),controller[_0xe204('0x42')]);router[_0xe204('0x35')](_0xe204('0x43'),auth['isAuthenticated'](),controller[_0xe204('0x44')]);router[_0xe204('0x35')](_0xe204('0x45'),auth[_0xe204('0x9')](),controller[_0xe204('0x46')]);router[_0xe204('0x35')]('/:id/pause',auth[_0xe204('0x9')](),controller[_0xe204('0x47')]);router['post'](_0xe204('0x48'),auth[_0xe204('0x9')](),controller[_0xe204('0x49')]);router[_0xe204('0x35')]('/:id/teams',auth[_0xe204('0x9')](),controller['addTeams']);router[_0xe204('0x35')](_0xe204('0x4a'),auth[_0xe204('0x9')](),controller[_0xe204('0x4b')]);router['post']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xe204('0x4c')]);router[_0xe204('0x35')](_0xe204('0x4d'),auth[_0xe204('0x9')](),controller[_0xe204('0x4e')]);router[_0xe204('0x35')](_0xe204('0x4f'),auth[_0xe204('0x9')](),controller[_0xe204('0x50')]);router[_0xe204('0x35')](_0xe204('0x51'),auth[_0xe204('0x9')](),controller['addOpenchannelInteractions']);router[_0xe204('0x35')](_0xe204('0x52'),auth[_0xe204('0x9')](),controller[_0xe204('0x53')]);router[_0xe204('0x35')](_0xe204('0x54'),auth['isAuthenticated'](),controller[_0xe204('0x55')]);router[_0xe204('0x35')](_0xe204('0x2a'),auth[_0xe204('0x9')](),controller[_0xe204('0x56')]);router['post']('/:id/openchannel_accounts',auth[_0xe204('0x9')](),controller[_0xe204('0x57')]);router['post'](_0xe204('0x58'),auth[_0xe204('0x9')](),controller[_0xe204('0x59')]);router[_0xe204('0x35')](_0xe204('0x2d'),auth['isAuthenticated'](),controller[_0xe204('0x5a')]);router[_0xe204('0x35')](_0xe204('0x2e'),auth[_0xe204('0x9')](),controller[_0xe204('0x5b')]);router[_0xe204('0x35')](_0xe204('0x30'),auth[_0xe204('0x9')](),controller[_0xe204('0x5c')]);router[_0xe204('0x35')]('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router[_0xe204('0x5d')](_0xe204('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe204('0x5d')]('/:id/password',auth['isAuthenticated'](),controller[_0xe204('0x5e')]);router[_0xe204('0x5f')]('/:id/queues',auth[_0xe204('0x9')](),controller[_0xe204('0x60')]);router[_0xe204('0x5f')]('/:id/teams',auth[_0xe204('0x9')](),controller[_0xe204('0x61')]);router[_0xe204('0x5f')](_0xe204('0xc'),auth[_0xe204('0x9')](),controller['destroy']);router[_0xe204('0x5f')](_0xe204('0x4a'),auth[_0xe204('0x9')](),controller[_0xe204('0x62')]);router['delete'](_0xe204('0x63'),auth[_0xe204('0x9')](),controller['removeMailInteractions']);router['delete'](_0xe204('0x4d'),auth[_0xe204('0x9')](),controller[_0xe204('0x64')]);router[_0xe204('0x5f')](_0xe204('0x4f'),auth[_0xe204('0x9')](),controller['removeSmsInteractions']);router[_0xe204('0x5f')]('/:id/openchannel_interactions',auth[_0xe204('0x9')](),controller[_0xe204('0x65')]);router[_0xe204('0x5f')](_0xe204('0x52'),auth[_0xe204('0x9')](),controller[_0xe204('0x66')]);router[_0xe204('0x5f')](_0xe204('0x54'),auth[_0xe204('0x9')](),controller[_0xe204('0x67')]);router[_0xe204('0x5f')](_0xe204('0x2a'),auth[_0xe204('0x9')](),controller[_0xe204('0x68')]);router[_0xe204('0x5f')](_0xe204('0x2b'),auth[_0xe204('0x9')](),controller['removeOpenchannelAccounts']);router['delete'](_0xe204('0x58'),auth[_0xe204('0x9')](),controller['removeSmsAccounts']);router[_0xe204('0x5f')]('/:id/chat_websites',auth[_0xe204('0x9')](),controller[_0xe204('0x69')]);router[_0xe204('0x5f')](_0xe204('0x2e'),auth[_0xe204('0x9')](),controller['removeWhatsappAccounts']);router[_0xe204('0x5f')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xe204('0x6a')]);router['delete'](_0xe204('0x6b'),auth['isAuthenticated'](),controller[_0xe204('0x6c')]);module[_0xe204('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d6d4482..6d7f66e 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 _0x893f=['permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','moment','util','lodash','name','setDataValue','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','ENUM','admin','user','agent','local','INTEGER','internal','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT'];(function(_0x1ce0ff,_0x1d224c){var _0x448b56=function(_0x508338){while(--_0x508338){_0x1ce0ff['push'](_0x1ce0ff['shift']());}};_0x448b56(++_0x1d224c);}(_0x893f,0xb6));var _0xf893=function(_0x25b482,_0x479a72){_0x25b482=_0x25b482-0x0;var _0xa0fbdf=_0x893f[_0x25b482];return _0xa0fbdf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf893('0x0'));var util=require(_0xf893('0x1'));var _=require(_0xf893('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf893('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3c8271){this[_0xf893('0x4')](_0xf893('0x3'),_0x3c8271);this[_0xf893('0x4')]('defaultuser',_0x3c8271);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xf893('0x5')],'allowNull':![],'set':function(_0x1cea12){this[_0xf893('0x4')](_0xf893('0x6'),_0x1cea12);this[_0xf893('0x4')](_0xf893('0x7'),util[_0xf893('0x8')](_0xf893('0x9'),_0x1cea12,this[_0xf893('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf893('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3bbc73){if(_0x3bbc73){this['setDataValue']('email',_0x3bbc73['toLowerCase']());}}},'role':{'type':Sequelize[_0xf893('0xb')](_0xf893('0xc'),_0xf893('0xd'),_0xf893('0xe'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xf893('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xf893('0xf')},'internal':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':![],'unique':_0xf893('0x11'),'set':function(_0x49ecdd){this[_0xf893('0x4')](_0xf893('0x11'),_0x49ecdd);this['setDataValue']('accountcode',_0x49ecdd);this['setDataValue'](_0xf893('0x7'),util[_0xf893('0x8')](_0xf893('0x9'),this[_0xf893('0xa')](_0xf893('0x6')),_0x49ecdd));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf893('0x5')]},'mobile':{'type':Sequelize[_0xf893('0x5')]},'address':{'type':Sequelize[_0xf893('0x5')]},'zipcode':{'type':Sequelize[_0xf893('0x5')]},'userpic':{'type':Sequelize[_0xf893('0x5')]},'city':{'type':Sequelize[_0xf893('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf893('0x13')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf893('0x5')],'defaultValue':_0xf893('0x14')},'lastPauseAt':{'type':Sequelize[_0xf893('0x13')]},'chatCapacity':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf893('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf893('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf893('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![],'defaultValue':_0xf893('0x15')},'ipaddr':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xf893('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf893('0xb')]('friend','user',_0xf893('0x16')),'allowNull':!![],'defaultValue':_0xf893('0x17')},'context':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![],'defaultValue':_0xf893('0x18')},'callingpres':{'type':Sequelize['ENUM'](_0xf893('0x19'),_0xf893('0x1a'),_0xf893('0x1b'),_0xf893('0x1c'),'PROHIB_NOT_SCREENED',_0xf893('0x1d'),_0xf893('0x1e'),_0xf893('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf893('0x20'),'set':function(_0x105c6c){this[_0xf893('0x4')](_0xf893('0x21'),_0x105c6c?_0x105c6c[_0xf893('0x22')](','):null);},'get':function(){return this[_0xf893('0xa')]('transport')?this['getDataValue'](_0xf893('0x21'))['split'](','):null;},'comment':_0xf893('0x23')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xf893('0x24'),_0xf893('0x25'),_0xf893('0x26'),_0xf893('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no',_0xf893('0x29'),_0xf893('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![],'defaultValue':_0xf893('0x2b'),'set':function(_0x58adbd){this[_0xf893('0x4')](_0xf893('0x2c'),_0x58adbd?_0x58adbd[_0xf893('0x22')](','):null);},'get':function(){return this[_0xf893('0xa')](_0xf893('0x2c'))?this[_0xf893('0xa')](_0xf893('0x2c'))[_0xf893('0x2d')](','):null;},'comment':_0xf893('0x2e')},'callgroup':{'type':Sequelize[_0xf893('0x5')]},'namedcallgroup':{'type':Sequelize[_0xf893('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf893('0x5')]},'language':{'type':Sequelize[_0xf893('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf893('0x5')]},'disallow':{'type':Sequelize[_0xf893('0x5')],'allowNull':![],'defaultValue':_0xf893('0x2f')},'allow':{'type':Sequelize[_0xf893('0x5')],'allowNull':![],'defaultValue':_0xf893('0x30'),'set':function(_0x23c359){this['setDataValue'](_0xf893('0x31'),_0x23c359?_0x23c359[_0xf893('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf893('0xa')](_0xf893('0x31'))?this[_0xf893('0xa')](_0xf893('0x31'))[_0xf893('0x2d')](';'):null;},'comment':_0xf893('0x32')},'autoframing':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![],'set':function(_0x255860){this[_0xf893('0x4')]('insecure',_0x255860?_0x255860[_0xf893('0x22')](','):null);},'get':function(){return this[_0xf893('0xa')](_0xf893('0x33'))?this[_0xf893('0xa')](_0xf893('0x33'))[_0xf893('0x2d')](','):null;},'comment':_0xf893('0x34')},'trustrpid':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![],'defaultValue':_0xf893('0x35')},'amaflags':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':_0xf893('0x28')},'busylevel':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf893('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no',_0xf893('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x37'),_0xf893('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x39'),_0xf893('0x3a')),'allowNull':!![],'defaultValue':_0xf893('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':_0xf893('0x28')},'keepalive':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf893('0xb')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xf893('0x28'),'no',_0xf893('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf893('0xb')]('active','passive',_0xf893('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf893('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no','nonat','update',_0xf893('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf893('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xf893('0x13')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4147b9){this['setDataValue'](_0xf893('0x3e'),_0x4147b9);var _0x2faac4=this[_0xf893('0x3f')]({'plain':!![]});switch(_0x4147b9){case 0x0:case 0x1:var _0x6f075a=_0x2faac4[_0xf893('0x21')]?_[_0xf893('0x40')](_0x2faac4[_0xf893('0x21')])?_0x2faac4['transport'][_0xf893('0x22')]():_0x2faac4[_0xf893('0x21')]:'udp';if(_0x6f075a===_0xf893('0x41')){_0x6f075a=_0xf893('0x20');}this['setDataValue'](_0xf893('0x21'),_0x6f075a);this[_0xf893('0x4')](_0xf893('0x42'),'no');this[_0xf893('0x4')](_0xf893('0x43'),null);this['setDataValue'](_0xf893('0x44'),null);this[_0xf893('0x4')](_0xf893('0x45'),null);this['setDataValue'](_0xf893('0x46'),null);this[_0xf893('0x4')]('dtlsverify',null);this['setDataValue'](_0xf893('0x47'),null);this[_0xf893('0x4')]('dtlscertfile',null);this['setDataValue'](_0xf893('0x48'),null);this[_0xf893('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xf893('0x4')](_0xf893('0x21'),_0xf893('0x41'));this[_0xf893('0x4')](_0xf893('0x42'),'yes');this[_0xf893('0x4')](_0xf893('0x43'),_0xf893('0x28'));this[_0xf893('0x4')](_0xf893('0x44'),_0xf893('0x28'));this[_0xf893('0x4')](_0xf893('0x45'),_0xf893('0x28'));this[_0xf893('0x4')]('dtlsenable',_0xf893('0x28'));this[_0xf893('0x4')](_0xf893('0x49'),'no');this[_0xf893('0x4')](_0xf893('0x47'),'actpass');this[_0xf893('0x4')](_0xf893('0x4a'),_0x2faac4[_0xf893('0x4a')]||_0xf893('0x4b'));this[_0xf893('0x4')](_0xf893('0x48'),_0x2faac4[_0xf893('0x48')]||_0xf893('0x4c'));this[_0xf893('0x4')](_0xf893('0x4d'),_0xf893('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xf893('0x4e')],'set':function(_0x1fa55b){this['setDataValue'](_0xf893('0x4f'),_0x1fa55b?_0x1fa55b['join'](','):[]);},'get':function(){return this[_0xf893('0xa')](_0xf893('0x4f'))?_['map'](this[_0xf893('0xa')](_0xf893('0x4f'))['split'](','),function(_0x114b05){return parseInt(_0x114b05,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf893('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xf893('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf893('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf893('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf893('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf893('0xb')](_0xf893('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf893('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf893('0x50')],'get':function(){return this[_0xf893('0xa')](_0xf893('0x51'))?this['getDataValue'](_0xf893('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xf893('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf893('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x588c58){if(typeof _0x588c58==='string'){var _0x41e4e0=_0x588c58==='1'?!![]:_0x588c58==='0'?![]:_0x588c58===_0xf893('0x52')?!![]:_0x588c58===_0xf893('0x53')?![]:![];this['setDataValue'](_0xf893('0x54'),_0x41e4e0);}else{this[_0xf893('0x4')](_0xf893('0x54'),_0x588c58);}}},'blocked':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![],'set':function(_0x366ad6){this[_0xf893('0x4')](_0xf893('0x55'),_0x366ad6);if(_0x366ad6===!![]){this[_0xf893('0x4')]('blockedAt',moment());this[_0xf893('0x4')](_0xf893('0x56'),0x0);}else{this[_0xf893('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xf893('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf893('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf893('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0xb0f6=['PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uas','fingerprint','certificate','passive','actpass','update,nonat','get','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','user','agent','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN'];(function(_0xbd482f,_0x5b7159){var _0x1e804f=function(_0x3fb656){while(--_0x3fb656){_0xbd482f['push'](_0xbd482f['shift']());}};_0x1e804f(++_0x5b7159);}(_0xb0f6,0x1e9));var _0x6b0f=function(_0x317d60,_0x22eac7){_0x317d60=_0x317d60-0x0;var _0x5a9f68=_0xb0f6[_0x317d60];return _0x5a9f68;};'use strict';var Sequelize=require(_0x6b0f('0x0'));var moment=require(_0x6b0f('0x1'));var util=require('util');var _=require(_0x6b0f('0x2'));module[_0x6b0f('0x3')]={'name':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'unique':_0x6b0f('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x10daf5){this[_0x6b0f('0x6')](_0x6b0f('0x5'),_0x10daf5);this['setDataValue'](_0x6b0f('0x7'),_0x10daf5);},'comment':_0x6b0f('0x8')},'fullname':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'set':function(_0x22971c){this[_0x6b0f('0x6')](_0x6b0f('0x9'),_0x22971c);this[_0x6b0f('0x6')](_0x6b0f('0xa'),util[_0x6b0f('0xb')](_0x6b0f('0xc'),_0x22971c,this[_0x6b0f('0xd')](_0x6b0f('0xe'))));}},'alias':{'type':Sequelize[_0x6b0f('0x4')]},'email':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'unique':_0x6b0f('0xf'),'validate':{'isEmail':!![]},'set':function(_0x1c4dfd){if(_0x1c4dfd){this['setDataValue']('email',_0x1c4dfd['toLowerCase']());}}},'role':{'type':Sequelize[_0x6b0f('0x10')]('admin',_0x6b0f('0x11'),_0x6b0f('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x2d7cf3){this[_0x6b0f('0x6')]('internal',_0x2d7cf3);this[_0x6b0f('0x6')](_0x6b0f('0x13'),_0x2d7cf3);this[_0x6b0f('0x6')](_0x6b0f('0xa'),util[_0x6b0f('0xb')](_0x6b0f('0xc'),this['getDataValue']('fullname'),_0x2d7cf3));}},'salt':{'type':Sequelize[_0x6b0f('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6b0f('0x4')]},'address':{'type':Sequelize[_0x6b0f('0x4')]},'zipcode':{'type':Sequelize[_0x6b0f('0x4')]},'userpic':{'type':Sequelize[_0x6b0f('0x4')]},'city':{'type':Sequelize[_0x6b0f('0x4')]},'country':{'type':Sequelize[_0x6b0f('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6b0f('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6b0f('0x4')],'defaultValue':_0x6b0f('0x16')},'lastPauseAt':{'type':Sequelize[_0x6b0f('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6b0f('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6b0f('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'defaultValue':_0x6b0f('0x18')},'ipaddr':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6b0f('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x19'),_0x6b0f('0x11'),_0x6b0f('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'defaultValue':_0x6b0f('0x1b')},'callingpres':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x1c'),'ALLOWED_PASSED_SCREEN',_0x6b0f('0x1d'),_0x6b0f('0x1e'),_0x6b0f('0x1f'),'PROHIB_PASSED_SCREEN',_0x6b0f('0x20'),_0x6b0f('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'defaultValue':_0x6b0f('0x22'),'set':function(_0x2a891c){this[_0x6b0f('0x6')](_0x6b0f('0x23'),_0x2a891c?_0x2a891c['join'](','):null);},'get':function(){return this['getDataValue'](_0x6b0f('0x23'))?this[_0x6b0f('0xd')](_0x6b0f('0x23'))['split'](','):null;},'comment':_0x6b0f('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6b0f('0x25'),_0x6b0f('0x26'),_0x6b0f('0x27'),'inband',_0x6b0f('0x28')),'allowNull':!![],'defaultValue':_0x6b0f('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x6b0f('0x29'),'no',_0x6b0f('0x2a'),_0x6b0f('0x2b'),_0x6b0f('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'defaultValue':_0x6b0f('0x2d'),'set':function(_0x22e755){this[_0x6b0f('0x6')](_0x6b0f('0x2e'),_0x22e755?_0x22e755[_0x6b0f('0x2f')](','):null);},'get':function(){return this[_0x6b0f('0xd')](_0x6b0f('0x2e'))?this[_0x6b0f('0xd')](_0x6b0f('0x2e'))[_0x6b0f('0x30')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6b0f('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6b0f('0x4')]},'pickupgroup':{'type':Sequelize[_0x6b0f('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6b0f('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'defaultValue':_0x6b0f('0x31')},'allow':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':![],'defaultValue':_0x6b0f('0x32'),'set':function(_0x538495){this[_0x6b0f('0x6')]('allow',_0x538495?_0x538495[_0x6b0f('0x2f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6b0f('0xd')](_0x6b0f('0x33'))?this[_0x6b0f('0xd')]('allow')[_0x6b0f('0x30')](';'):null;},'comment':_0x6b0f('0x34')},'autoframing':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'set':function(_0x6ef7fa){this['setDataValue']('insecure',_0x6ef7fa?_0x6ef7fa[_0x6b0f('0x2f')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x6b0f('0xd')]('insecure')['split'](','):null;},'comment':_0x6b0f('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no',_0x6b0f('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x6b0f('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':_0x6b0f('0x29')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x6b0f('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6b0f('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no',_0x6b0f('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6b0f('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6b0f('0x10')]('accept',_0x6b0f('0x38'),_0x6b0f('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6b0f('0x10')]('uac','uas'),'allowNull':!![],'defaultValue':_0x6b0f('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':_0x6b0f('0x29')},'keepalive':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6b0f('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6b0f('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6b0f('0x10')]('yes','no',_0x6b0f('0x3b'),_0x6b0f('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6b0f('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6b0f('0x10')]('active',_0x6b0f('0x3d'),_0x6b0f('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6b0f('0x10')](_0x6b0f('0x29'),'no',_0x6b0f('0x2a'),_0x6b0f('0x2b'),_0x6b0f('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6b0f('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6b0f('0x14')]},'showWebBar':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0,'set':function(_0x57b60a){this[_0x6b0f('0x6')]('showWebBar',_0x57b60a);var _0x1f7ed5=this[_0x6b0f('0x40')]({'plain':!![]});switch(_0x57b60a){case 0x0:case 0x1:var _0x2e683b=_0x1f7ed5[_0x6b0f('0x23')]?_['isArray'](_0x1f7ed5['transport'])?_0x1f7ed5[_0x6b0f('0x23')][_0x6b0f('0x2f')]():_0x1f7ed5['transport']:_0x6b0f('0x22');if(_0x2e683b===_0x6b0f('0x41')){_0x2e683b=_0x6b0f('0x22');}this[_0x6b0f('0x6')](_0x6b0f('0x23'),_0x2e683b);this['setDataValue'](_0x6b0f('0x42'),'no');this[_0x6b0f('0x6')]('avpf',null);this[_0x6b0f('0x6')](_0x6b0f('0x43'),null);this['setDataValue'](_0x6b0f('0x44'),null);this[_0x6b0f('0x6')](_0x6b0f('0x45'),null);this[_0x6b0f('0x6')](_0x6b0f('0x46'),null);this[_0x6b0f('0x6')](_0x6b0f('0x47'),null);this[_0x6b0f('0x6')]('dtlscertfile',null);this[_0x6b0f('0x6')](_0x6b0f('0x48'),null);this[_0x6b0f('0x6')](_0x6b0f('0x49'),'no');break;case 0x2:this[_0x6b0f('0x6')]('transport',_0x6b0f('0x41'));this[_0x6b0f('0x6')](_0x6b0f('0x42'),'yes');this[_0x6b0f('0x6')]('avpf','yes');this[_0x6b0f('0x6')](_0x6b0f('0x43'),_0x6b0f('0x29'));this['setDataValue'](_0x6b0f('0x44'),_0x6b0f('0x29'));this['setDataValue'](_0x6b0f('0x45'),_0x6b0f('0x29'));this['setDataValue'](_0x6b0f('0x46'),'no');this[_0x6b0f('0x6')](_0x6b0f('0x47'),_0x6b0f('0x3e'));this['setDataValue'](_0x6b0f('0x4a'),_0x1f7ed5[_0x6b0f('0x4a')]||_0x6b0f('0x4b'));this[_0x6b0f('0x6')](_0x6b0f('0x48'),_0x1f7ed5[_0x6b0f('0x48')]||'/etc/pki/tls/private/motion.key');this[_0x6b0f('0x6')]('rtcp_mux',_0x6b0f('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x6b0f('0x4c')],'set':function(_0x30374e){this[_0x6b0f('0x6')](_0x6b0f('0x4d'),_0x30374e?_0x30374e['join'](','):[]);},'get':function(){return this[_0x6b0f('0xd')](_0x6b0f('0x4d'))?_[_0x6b0f('0x4e')](this[_0x6b0f('0xd')](_0x6b0f('0x4d'))[_0x6b0f('0x30')](','),function(_0x337dad){return parseInt(_0x337dad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6b0f('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6b0f('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6b0f('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6b0f('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6b0f('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6b0f('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6b0f('0x4')]},'passwordResetAt':{'type':Sequelize[_0x6b0f('0x14')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6b0f('0x4f')],'get':function(){return this[_0x6b0f('0xd')](_0x6b0f('0x50'))?this[_0x6b0f('0xd')](_0x6b0f('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6b0f('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6b0f('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![],'set':function(_0x377de8){if(typeof _0x377de8===_0x6b0f('0x51')){var _0xde486e=_0x377de8==='1'?!![]:_0x377de8==='0'?![]:_0x377de8===_0x6b0f('0x52')?!![]:_0x377de8===_0x6b0f('0x53')?![]:![];this[_0x6b0f('0x6')](_0x6b0f('0x54'),_0xde486e);}else{this[_0x6b0f('0x6')](_0x6b0f('0x54'),_0x377de8);}}},'blocked':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![],'set':function(_0x33a35b){this['setDataValue']('blocked',_0x33a35b);if(_0x33a35b===!![]){this['setDataValue'](_0x6b0f('0x55'),moment());this[_0x6b0f('0x6')](_0x6b0f('0x56'),0x0);}else{this[_0x6b0f('0x6')](_0x6b0f('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x6b0f('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6b0f('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0b12eeb..78e0c33 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 _0x178e=['UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','loginInPause','format','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','chat','%s%s','Pause','getTeams','Team','addTeams','getChatQueues','setDataValue','Chat','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','penalty','removeAgent','Queue:remove','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','phone','CmContact','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./user.socket','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','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','Users','agent','Telephones','filter','map','value','includes','role','find','name','UserProfileResource','sendStatus','stack','send','User','fieldName','type','key','model','differenceBy','salt','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','sequelize','where','lower','col','options','findAll','rows','show','params','rawAttributes','password','include','body','describe','addContacts','ids','omit','agent\x20role','telephone','user','../../config/license/util','telephones','License\x20limit\x20reached','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','fullname','101','103','110','104','105','106','107','108','109','100','114','VoiceMail','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','channel','voicePause','Unknown\x20channel','add','toLowerCase','spread','emit','capitalize','Queue:save','voice','VoiceQueue','online','push','interface','SIP/%s','each','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','QueueId','addAvatar','file','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','download','getContacts','includeAll','List','Tag','Tags','color','tag','getQueues','Queue','admin','Queues','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups'];(function(_0x10101a,_0xe6ad8a){var _0x49cad2=function(_0x3f63a2){while(--_0x3f63a2){_0x10101a['push'](_0x10101a['shift']());}};_0x49cad2(++_0xe6ad8a);}(_0x178e,0xa6));var _0xe178=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x178e[_0x3e112d];return _0x531c31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe178('0x0'));var rimraf=require(_0xe178('0x1'));var zipdir=require(_0xe178('0x2'));var jsonpatch=require(_0xe178('0x3'));var rp=require(_0xe178('0x4'));var moment=require('moment');var BPromise=require(_0xe178('0x5'));var Mustache=require('mustache');var util=require(_0xe178('0x6'));var path=require(_0xe178('0x7'));var sox=require(_0xe178('0x8'));var csv=require(_0xe178('0x9'));var ejs=require(_0xe178('0xa'));var fs=require('fs');var _=require(_0xe178('0xb'));var squel=require(_0xe178('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe178('0xd'));var toCsv=require(_0xe178('0x9'));var querystring=require(_0xe178('0xe'));var Papa=require(_0xe178('0xf'));var Redis=require(_0xe178('0x10'));var authService=require(_0xe178('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe178('0x12'));var hardwareService=require(_0xe178('0x13'));var logger=require(_0xe178('0x14'))(_0xe178('0x15'));var utils=require(_0xe178('0x16'));var config=require(_0xe178('0x17'));var db=require(_0xe178('0x18'))['db'];config['redis']=_[_0xe178('0x19')](config['redis'],{'host':_0xe178('0x1a'),'port':0x18eb});var socket=require(_0xe178('0x1b'))(new Redis(config['redis']));require(_0xe178('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe178('0x1d')][_0xe178('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x77c0dd,_0x16f0ce,_0x5b205e){if(_0x5b205e){var _0x1a74cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a74cb[_0xe178('0x1f')](_0x16f0ce)){return _0x77c0dd;}else{throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))](_0xe178('0x22'));}}else{return _0x77c0dd;}}function respondWithRpcPromise(_0x41e669,_0x376826,_0x2cd55a,_0x23d8d7){return new BPromise(function(_0x431d3c,_0x2fb89c){var _0x3631bd=_0x23d8d7||client;return _0x3631bd['request'](_0x41e669,_0x2cd55a)[_0xe178('0x23')](function(_0x56ff3a){logger[_0xe178('0x24')](_0xe178('0x25'),_0x376826,_0xe178('0x26'));logger['debug'](_0xe178('0x27'),_0x376826,_0xe178('0x26'),JSON[_0xe178('0x28')](_0x56ff3a));if(_0x56ff3a[_0xe178('0x29')]){if(_0x56ff3a['error'][_0xe178('0x2a')]===0x1f4){logger[_0xe178('0x29')]('User,\x20%s,\x20%s',_0x376826,_0x56ff3a[_0xe178('0x29')][_0xe178('0x2b')]);return _0x2fb89c(_0x56ff3a[_0xe178('0x29')][_0xe178('0x2b')]);}logger['error']('User,\x20%s,\x20%s',_0x376826,_0x56ff3a[_0xe178('0x29')]['message']);return _0x431d3c(_0x56ff3a[_0xe178('0x29')][_0xe178('0x2b')]);}else{logger[_0xe178('0x24')](_0xe178('0x25'),_0x376826,_0xe178('0x26'));_0x431d3c(_0x56ff3a[_0xe178('0x2c')]['message']);}})[_0xe178('0x2d')](function(_0x5bc405){logger[_0xe178('0x29')](_0xe178('0x25'),_0x376826,_0x5bc405);_0x2fb89c(_0x5bc405);});});}function respondWithStatusCode(_0x225649,_0x3cd9d8){_0x3cd9d8=_0x3cd9d8||0xcc;return function(_0x2e9275){if(_0x2e9275){return _0x225649['sendStatus'](_0x3cd9d8);}return _0x225649[_0xe178('0x2e')](_0x3cd9d8)[_0xe178('0x2f')]();};}function respondWithResult(_0x26b8fc,_0x5c572c){_0x5c572c=_0x5c572c||0xc8;return function(_0x506b03){if(_0x506b03){return _0x26b8fc[_0xe178('0x2e')](_0x5c572c)['json'](_0x506b03);}};}function respondWithFilteredResult(_0x29ff42,_0x14bf25){return function(_0x18a90a){if(_0x18a90a){var _0x3ac7c4=_0x18a90a[_0xe178('0x30')],_0x5164a0=_0x14bf25[_0xe178('0x31')],_0x2fbe01=_0x14bf25[_0xe178('0x31')]+_0x14bf25[_0xe178('0x32')],_0x4cffe5;if(_0x2fbe01>=_0x3ac7c4){_0x2fbe01=_0x3ac7c4;_0x4cffe5=0xc8;}else{_0x4cffe5=0xce;}_0x29ff42['status'](_0x4cffe5);return _0x29ff42['set'](_0xe178('0x33'),_0x5164a0+'-'+_0x2fbe01+'/'+_0x3ac7c4)[_0xe178('0x34')](_0x18a90a);}return null;};}function patchUpdates(_0x1ce0c4){return function(_0x5cb839){try{jsonpatch[_0xe178('0x35')](_0x5cb839,_0x1ce0c4,!![]);}catch(_0x4559bd){return BPromise[_0xe178('0x36')](_0x4559bd);}return _0x5cb839[_0xe178('0x37')]();};}function saveUpdates(_0x44e457,_0x31403c){return function(_0x9c1c8e){if(_0x9c1c8e){return _0x9c1c8e[_0xe178('0x38')](_0x44e457)[_0xe178('0x23')](function(_0x369444){return _0x369444;});}return null;};}function removeEntity(_0x26b637,_0x238a59){return function(_0x24ab3f){if(_0x24ab3f){return _0x24ab3f[_0xe178('0x39')]()[_0xe178('0x23')](function(){var _0x49f766=_0x24ab3f[_0xe178('0x3a')]({'plain':!![]});var _0x2a9ed9=[{'name':_0xe178('0x3b'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xe178('0x3c'),'ignore':![]},{'name':_0xe178('0x3d'),'value':'telephone','ignore':![]}];var _0x4e8ee3=_(_0x2a9ed9)[_0xe178('0x3e')]('ignore')[_0xe178('0x3f')](_0xe178('0x40'))[_0xe178('0x40')]();if(_[_0xe178('0x41')](_0x4e8ee3,_0x49f766[_0xe178('0x42')])){return;}var _0x5cfbb7=_[_0xe178('0x43')](_0x2a9ed9,[_0xe178('0x40'),_0x49f766['role']])[_0xe178('0x44')];return db[_0xe178('0x45')][_0xe178('0x39')]({'where':{'type':_0x5cfbb7,'resourceId':_0x49f766['id']}})['then'](function(){return _0x24ab3f;});})[_0xe178('0x23')](function(){_0x26b637['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13afbf,_0x47071d){return function(_0x3fced8){if(!_0x3fced8){_0x13afbf[_0xe178('0x46')](0x194);}return _0x3fced8;};}function handleError(_0x50d475,_0x5089e7){_0x5089e7=_0x5089e7||0x1f4;return function(_0x4de2d2){logger[_0xe178('0x29')](_0x4de2d2[_0xe178('0x47')]);if(_0x4de2d2[_0xe178('0x44')]){delete _0x4de2d2[_0xe178('0x44')];}_0x50d475[_0xe178('0x2e')](_0x5089e7)[_0xe178('0x48')](_0x4de2d2);};}exports['index']=function(_0x46b5f0,_0x12dc7e){var _0x57ac9d={},_0x28d6ce={},_0x343153={'count':0x0,'rows':[]};var _0x2c6444=_['map'](db[_0xe178('0x49')]['rawAttributes'],function(_0x580a7c){return{'name':_0x580a7c[_0xe178('0x4a')],'type':_0x580a7c[_0xe178('0x4b')][_0xe178('0x4c')]};});_0x28d6ce[_0xe178('0x4d')]=_[_0xe178('0x4e')](_['map'](_0x2c6444,_0xe178('0x44')),['password',_0xe178('0x4f')]);_0x28d6ce[_0xe178('0x50')]=_[_0xe178('0x51')](_0x46b5f0[_0xe178('0x50')]);_0x28d6ce['filters']=_[_0xe178('0x52')](_0x28d6ce[_0xe178('0x4d')],_0x28d6ce[_0xe178('0x50')]);_0x57ac9d[_0xe178('0x53')]=_[_0xe178('0x52')](_0x28d6ce[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x46b5f0['query'][_0xe178('0x54')]));_0x57ac9d['attributes']=_0x57ac9d[_0xe178('0x53')][_0xe178('0x55')]?_0x57ac9d[_0xe178('0x53')]:_0x28d6ce[_0xe178('0x4d')];if(!_0x46b5f0[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x57ac9d[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x46b5f0[_0xe178('0x50')][_0xe178('0x32')]);_0x57ac9d[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x46b5f0[_0xe178('0x50')][_0xe178('0x31')]);}_0x57ac9d[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x46b5f0[_0xe178('0x50')][_0xe178('0x59')]);_0x57ac9d['where']=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x46b5f0['query'],_0x28d6ce[_0xe178('0x5a')]),_0x2c6444);if(_0x46b5f0[_0xe178('0x50')][_0xe178('0x3e')]){_0x57ac9d['where']=_[_0xe178('0x5c')](_0x57ac9d['where'],{'$or':_['map'](_0x2c6444,function(_0x2004f1){if(_0x2004f1[_0xe178('0x4b')]!=='VIRTUAL'){return db[_0xe178('0x5d')][_0xe178('0x5e')](db[_0xe178('0x5d')]['fn'](_0xe178('0x5f'),db[_0xe178('0x5d')][_0xe178('0x60')](_0x2004f1[_0xe178('0x44')])),{'$like':db[_0xe178('0x5d')]['fn'](_0xe178('0x5f'),'%'+_0x46b5f0[_0xe178('0x50')][_0xe178('0x3e')]+'%')});}})});}_0x57ac9d=_[_0xe178('0x5c')]({},_0x57ac9d,_0x46b5f0[_0xe178('0x61')]);var _0x5b278e={'where':_0x57ac9d[_0xe178('0x5e')]};return db[_0xe178('0x49')][_0xe178('0x30')](_0x5b278e)['then'](function(_0x537a53){_0x343153['count']=_0x537a53;if(_0x46b5f0[_0xe178('0x50')]['includeAll']){_0x57ac9d['include']=[{'all':!![]}];}return db[_0xe178('0x49')][_0xe178('0x62')](_0x57ac9d);})['then'](function(_0x932704){_0x343153[_0xe178('0x63')]=_0x932704;return _0x343153;})['then'](respondWithFilteredResult(_0x12dc7e,_0x57ac9d))[_0xe178('0x2d')](handleError(_0x12dc7e,null));};exports[_0xe178('0x64')]=function(_0x5f52c1,_0x3f9707){var _0x4832d2={'raw':![],'where':{'id':_0x5f52c1[_0xe178('0x65')]['id']}},_0x1942d0={};_0x1942d0[_0xe178('0x4d')]=_[_0xe178('0x4e')](_['keys'](db['User'][_0xe178('0x66')]),[_0xe178('0x67'),_0xe178('0x4f')]);_0x1942d0['query']=_['keys'](_0x5f52c1[_0xe178('0x50')]);_0x1942d0[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x1942d0[_0xe178('0x4d')],_0x1942d0[_0xe178('0x50')]);_0x4832d2[_0xe178('0x53')]=_[_0xe178('0x52')](_0x1942d0['model'],qs[_0xe178('0x54')](_0x5f52c1[_0xe178('0x50')][_0xe178('0x54')]));_0x4832d2[_0xe178('0x53')]=_0x4832d2[_0xe178('0x53')]['length']?_0x4832d2[_0xe178('0x53')]:_0x1942d0[_0xe178('0x4d')];if(_0x5f52c1[_0xe178('0x50')]['includeAll']){_0x4832d2[_0xe178('0x68')]=[{'all':!![]}];}_0x4832d2=_[_0xe178('0x5c')]({},_0x4832d2,_0x5f52c1[_0xe178('0x61')]);return db[_0xe178('0x49')][_0xe178('0x43')](_0x4832d2)['then'](handleEntityNotFound(_0x3f9707,null))['then'](respondWithResult(_0x3f9707,null))['catch'](handleError(_0x3f9707,null));};exports['bulkCreate']=function(_0x1695b6,_0x4a9c84){return db[_0xe178('0x49')]['bulkCreate'](_0x1695b6[_0xe178('0x69')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a9c84,0xc9))[_0xe178('0x2d')](handleError(_0x4a9c84,null));};exports[_0xe178('0x38')]=function(_0x6463f6,_0x3a8fc7){if(_0x6463f6[_0xe178('0x69')]['id']){delete _0x6463f6[_0xe178('0x69')]['id'];}delete _0x6463f6['body'][_0xe178('0x42')];return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0x6463f6[_0xe178('0x65')]['id']}})['then'](handleEntityNotFound(_0x3a8fc7,null))[_0xe178('0x23')](saveUpdates(_0x6463f6[_0xe178('0x69')],null))['then'](respondWithResult(_0x3a8fc7,null))[_0xe178('0x2d')](handleError(_0x3a8fc7,null));};exports[_0xe178('0x6a')]=function(_0x2f8033,_0x53e9c5){return db[_0xe178('0x49')][_0xe178('0x6a')]()[_0xe178('0x23')](respondWithResult(_0x53e9c5,null))[_0xe178('0x2d')](handleError(_0x53e9c5,null));};exports[_0xe178('0x6b')]=function(_0x59f24d,_0x31138e,_0x3deaa6){return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0x59f24d[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x31138e,null))[_0xe178('0x23')](function(_0x342d86){if(_0x342d86){return _0x342d86[_0xe178('0x6b')](_0x59f24d['body'][_0xe178('0x6c')],_[_0xe178('0x6d')](_0x59f24d[_0xe178('0x69')],[_0xe178('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x31138e,null))[_0xe178('0x2d')](handleError(_0x31138e,null));};var getLicense=function(_0x398ef2){return new BPromise(function(_0x3d61a2,_0x90123){var _0x2e2112=0x0;_0x398ef2[_0xe178('0x69')]['role']===_0xe178('0x3c')&&_0x3d61a2(_0xe178('0x6e'));return db['User'][_0xe178('0x30')]({'where':{'$or':[{'role':_0x398ef2[_0xe178('0x69')]['role']===_0xe178('0x6f')?'telephone':['admin',_0xe178('0x70')]}]}})[_0xe178('0x23')](function(_0x1506a7){_0x2e2112=_0x1506a7;return require(_0xe178('0x71'))['getLicense']();})[_0xe178('0x23')](function(_0x12ebcf){var _0x165416=_0x398ef2[_0xe178('0x69')][_0xe178('0x42')]==='telephone'?_0xe178('0x72'):'users';if(!_['isNil'](_0x12ebcf[_0x165416])&&_0x2e2112>=_0x12ebcf[_0x165416]){return _0x90123({'message':_0xe178('0x73')});}return _0x3d61a2(util['format'](_0xe178('0x74'),_0x165416,_0x2e2112));})[_0xe178('0x2d')](function(_0x32bdc1){return _0x90123(_0x32bdc1);});});};exports[_0xe178('0x75')]=function(_0xe0dc01,_0x5df037){return getLicense(_0xe0dc01)[_0xe178('0x23')](function(_0x1e35c7){if(!_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]){var _0x321af6;return db[_0xe178('0x77')][_0xe178('0x78')](0x1)[_0xe178('0x23')](function(_0x396a9b){return checkPasswordPattern(_0x396a9b,_0xe0dc01[_0xe178('0x69')][_0xe178('0x67')],_0x396a9b[_0xe178('0x79')]);})[_0xe178('0x23')](function(_0xce814b){_0x321af6=_0xce814b[_0xe178('0x7a')];return db[_0xe178('0x49')]['max'](_0xe178('0x76'));})[_0xe178('0x23')](function(_0x33878f){if(_['isNil'](_0x33878f)){if(_0x321af6){_0xe0dc01['body'][_0xe178('0x76')]=_0x321af6;}else{_0xe0dc01['body'][_0xe178('0x76')]=0x1;}}else{if(_[_0xe178('0x7b')](_0x321af6)||_0x321af6==_0x33878f){_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]=_0x33878f+0x1;}else if(_0x321af6>_0x33878f){_0xe0dc01['body']['internal']=_0x321af6;}else{return db[_0xe178('0x5d')][_0xe178('0x50')](_0xe178('0x7c'),{'type':db[_0xe178('0x5d')][_0xe178('0x7d')]['SELECT']})['then'](function(_0x35b2fe){if(_0x35b2fe&&_0x35b2fe[_0xe178('0x55')]){for(var _0x3e1221=0x0,_0x8d2a37=_0x35b2fe['length'];_0x3e1221<_0x8d2a37&&_['isNil'](_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]);_0x3e1221++){if(_0x321af6<=_0x35b2fe[_0x3e1221][_0xe178('0x7e')]){_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]=_0x35b2fe[_0x3e1221]['from'];}else if(_0x321af6>_0x35b2fe[_0x3e1221][_0xe178('0x7e')]&&_0x321af6<=_0x35b2fe[_0x3e1221]['to']){_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]=_0x321af6;}}}if(_[_0xe178('0x7b')](_0xe0dc01['body']['internal'])){_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')]=_0x33878f+0x1;}});}}});}})[_0xe178('0x23')](function(){if(_0xe0dc01[_0xe178('0x69')][_0xe178('0x7f')]){_0xe0dc01[_0xe178('0x69')][_0xe178('0x80')]=_0xe0dc01[_0xe178('0x69')][_0xe178('0x76')];_0xe0dc01[_0xe178('0x69')]['VoiceMail']={'mailbox':_0xe0dc01['body'][_0xe178('0x76')],'password':_0xe0dc01[_0xe178('0x69')]['password'],'fullname':_0xe0dc01['body'][_0xe178('0x81')],'email':_0xe0dc01['body']['email']};}if(_0xe0dc01[_0xe178('0x69')]&&_0xe0dc01[_0xe178('0x69')][_0xe178('0x42')]===_0xe178('0x3c')){if(!_0xe0dc01[_0xe178('0x69')]['permissions']){_0xe0dc01[_0xe178('0x69')]['permissions']=[_0xe178('0x82'),'102',_0xe178('0x83'),'113',_0xe178('0x84'),_0xe178('0x85'),_0xe178('0x86'),_0xe178('0x87'),_0xe178('0x88'),_0xe178('0x89'),_0xe178('0x8a'),_0xe178('0x8b'),'111',_0xe178('0x8c')];}}return db[_0xe178('0x49')][_0xe178('0x75')](_0xe0dc01[_0xe178('0x69')],{'include':[{'model':db[_0xe178('0x8d')],'as':_0xe178('0x8d')}]});})['then'](function(_0x2c0071){if(_0xe0dc01[_0xe178('0x69')]['role']===_0xe178('0x70'))return _0x2c0071;var _0x12c822=_0xe0dc01[_0xe178('0x70')][_0xe178('0x3a')]({'plain':!![]});if(!_0x12c822)throw new Error(_0xe178('0x8e'));if(_0x12c822[_0xe178('0x42')]===_0xe178('0x70')){var _0x27c9e0=_0x2c0071['get']({'plain':!![]});var _0x195430=[{'name':_0xe178('0x8f'),'value':'agent'},{'name':_0xe178('0x3d'),'value':_0xe178('0x6f')}];var _0x131172=_['find'](_0x195430,[_0xe178('0x40'),_0x27c9e0[_0xe178('0x42')]])[_0xe178('0x44')];return db[_0xe178('0x90')]['find']({'where':{'name':_0x131172,'userProfileId':_0x12c822[_0xe178('0x91')]},'raw':!![]})['then'](function(_0x31ee62){if(_0x31ee62&&_0x31ee62[_0xe178('0x92')]===0x0){return db[_0xe178('0x45')][_0xe178('0x75')]({'name':_0x27c9e0[_0xe178('0x44')],'resourceId':_0x27c9e0['id'],'type':_0x31ee62['name'],'sectionId':_0x31ee62['id']},{})[_0xe178('0x23')](function(){return _0x2c0071;});}else{return _0x2c0071;}})[_0xe178('0x2d')](function(_0x362645){logger['error'](_0xe178('0x93'),_0x362645);throw _0x362645;});}return _0x2c0071;})[_0xe178('0x23')](respondWithResult(_0x5df037,0xc9))['catch'](handleError(_0x5df037,null));};exports[_0xe178('0x94')]=function(_0x46bdf6,_0xf04031,_0x487453){var _0x1af804=![];if(_0x46bdf6[_0xe178('0x69')]['id']){delete _0x46bdf6['body']['id'];}return db[_0xe178('0x77')][_0xe178('0x95')]({'attributes':['id',_0xe178('0x79')]})[_0xe178('0x23')](function(_0x5b4b2b){_0x1af804=_0x5b4b2b[_0xe178('0x79')];return db['User'][_0xe178('0x43')]({'where':{'id':_0x46bdf6['params']['id']}});})[_0xe178('0x23')](function(_0x4a424e){if(_0x4a424e){if(_0x4a424e['id']==_0x46bdf6[_0xe178('0x70')]['id']){if(!_0x46bdf6[_0xe178('0x69')][_0xe178('0x96')]||!_0x46bdf6[_0xe178('0x69')]['newPassword']){throw new db[(_0xe178('0x20'))]['ValidationError'](_0xe178('0x97'));}if(!_0x4a424e[_0xe178('0x98')](_0x46bdf6['body'][_0xe178('0x96')])){throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))](_0xe178('0x99'));}if(_0x46bdf6[_0xe178('0x69')]['oldPassword']==_0x46bdf6[_0xe178('0x69')][_0xe178('0x9a')]){throw new db[(_0xe178('0x20'))]['ValidationError'](_0xe178('0x9b'));}return _0x4a424e;}else if(_0x46bdf6[_0xe178('0x70')][_0xe178('0x42')]=='admin'){if(!_0x46bdf6[_0xe178('0x69')][_0xe178('0x9a')]){throw new db['Sequelize']['ValidationError'](_0xe178('0x9c'));}return _0x4a424e;}else if(_0x46bdf6[_0xe178('0x70')][_0xe178('0x42')]=='user'){if(!_0x46bdf6[_0xe178('0x69')][_0xe178('0x9a')]){throw new db[(_0xe178('0x20'))]['ValidationError'](_0xe178('0x9c'));}if(_0x4a424e[_0xe178('0x42')]!=_0xe178('0x3c')){throw new db['Sequelize'][(_0xe178('0x21'))]('Unauthorized');}return _0x4a424e;}else{throw new db['Sequelize'][(_0xe178('0x21'))](_0xe178('0x9d'));}}return null;})[_0xe178('0x23')](handleEntityNotFound(_0xf04031,null))['then'](function(_0x32a9dc){return checkPasswordPattern(_0x32a9dc,_0x46bdf6['body'][_0xe178('0x9a')],_0x1af804);})['then'](saveUpdates({'password':_0x46bdf6[_0xe178('0x69')][_0xe178('0x9a')],'passwordResetAt':_0x46bdf6[_0xe178('0x70')]['id']==_0x46bdf6[_0xe178('0x65')]['id']?moment():null},null))['then'](respondWithResult(_0xf04031,null))[_0xe178('0x2d')](handleError(_0xf04031,null));};exports['addQueues']=function(_0x3ecc41,_0xed8b90,_0x45e2f6){var _0x1ea6e9=_0x3ecc41[_0xe178('0x69')][_0xe178('0x9e')];return db['User'][_0xe178('0x43')]({'where':{'id':_0x3ecc41['params']['id']},'attributes':['id',_0xe178('0x44'),_0xe178('0x42'),'online','loginInPause',_0xe178('0x9f'),'interface']})[_0xe178('0x23')](handleEntityNotFound(_0xed8b90,null))[_0xe178('0x23')](function(_0x142f08){if(_0x142f08){if(!utils['isValidChannel'](_0x1ea6e9)){throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))](_0xe178('0xa0'));}return _0x142f08[_0xe178('0xa1')+_['capitalize'](_0x1ea6e9[_0xe178('0xa2')]())+'Queues'](_0x3ecc41[_0xe178('0x69')][_0xe178('0x6c')],{'penalty':_0x3ecc41[_0xe178('0x69')]['penalty']||0x0})[_0xe178('0xa3')](function(_0x46d99d){for(var _0x2dda02=0x0;_0x2dda02<_0x3ecc41['body']['ids']['length'];_0x2dda02+=0x1){var _0x3abc0c={'UserId':_0x3ecc41[_0xe178('0x65')]['id']};_0x3abc0c[_['capitalize'](_0x1ea6e9[_0xe178('0xa2')]())+'QueueId']=_0x3ecc41[_0xe178('0x69')]['ids'][_0x2dda02];socket[_0xe178('0xa4')](_0xe178('0x70')+_[_0xe178('0xa5')](_0x1ea6e9[_0xe178('0xa2')]())+_0xe178('0xa6'),_0x3abc0c);}return _0x46d99d;})[_0xe178('0x23')](function(){if(_0x1ea6e9===_0xe178('0xa7')){return db[_0xe178('0xa8')][_0xe178('0x62')]({'where':{'id':_0x3ecc41['body'][_0xe178('0x6c')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xe178('0x23')](function(_0x2eb07a){var _0x4940d8=_0x142f08[_0xe178('0x3a')]({'plain':!![]});var _0x47797a=[];if(_0x1ea6e9===_0xe178('0xa7')&&_0x4940d8['role']===_0xe178('0x3c')&&_0x4940d8[_0xe178('0xa9')]){for(var _0x59a5af=0x0;_0x59a5af<_0x2eb07a['length'];_0x59a5af+=0x1){_0x47797a[_0xe178('0xaa')]({'membername':_0x4940d8[_0xe178('0x44')],'UserId':_0x4940d8['id'],'queue_name':_0x2eb07a[_0x59a5af][_0xe178('0x44')],'VoiceQueueId':_0x2eb07a[_0x59a5af]['id'],'interface':_[_0xe178('0x7b')](_0x4940d8[_0xe178('0xab')])?util['format'](_0xe178('0xac'),_0x4940d8[_0xe178('0x44')]):_0x4940d8[_0xe178('0xab')],'paused':_0x4940d8[_0xe178('0x9f')]||![],'penalty':_0x3ecc41[_0xe178('0x69')]['penalty']||0x0});}return BPromise[_0xe178('0xad')](_0x47797a,function(_0x449fa6){return db[_0xe178('0xae')][_0xe178('0xaf')](_0x449fa6);});}return _0x142f08;});}})[_0xe178('0x23')](respondWithStatusCode(_0xed8b90,null))[_0xe178('0x2d')](handleError(_0xed8b90,null));};exports[_0xe178('0xb0')]=function(_0x42e8e7,_0x334843,_0x482880){var _0x4f0539;return db[_0xe178('0x49')]['find']({'where':{'id':_0x42e8e7[_0xe178('0x65')]['id']},'attributes':['id',_0xe178('0x44'),_0xe178('0x42')]})['then'](handleEntityNotFound(_0x334843,null))[_0xe178('0x23')](function(_0x1b8328){if(_0x1b8328){_0x4f0539=_0x1b8328;if(!_0x42e8e7[_0xe178('0x50')][_0xe178('0x9e')]||!utils[_0xe178('0xb1')](_0x42e8e7[_0xe178('0x50')][_0xe178('0x9e')])){throw new db['Sequelize'][(_0xe178('0x21'))]('Unknown\x20channel');}return _0x1b8328[_0xe178('0xb2')+_[_0xe178('0xa5')](_0x42e8e7[_0xe178('0x50')][_0xe178('0x9e')]['toLowerCase']())+'Queues'](_0x42e8e7[_0xe178('0x50')]['ids']);}})[_0xe178('0x23')](function(_0x3eb33e){for(var _0x2cbbb5=0x0;_0x2cbbb5<_0x42e8e7[_0xe178('0x50')]['ids']['length'];_0x2cbbb5+=0x1){var _0x110b47={'UserId':_0x42e8e7['params']['id']};_0x110b47[_[_0xe178('0xa5')](_0x42e8e7['query']['channel'][_0xe178('0xa2')]())+_0xe178('0xb3')]=_0x42e8e7[_0xe178('0x50')]['ids'][_0x2cbbb5];socket[_0xe178('0xa4')]('user'+_['capitalize'](_0x42e8e7[_0xe178('0x50')][_0xe178('0x9e')]['toLowerCase']())+'Queue:remove',_0x110b47);}return _0x3eb33e;})[_0xe178('0x23')](function(){if(_0x42e8e7[_0xe178('0x50')][_0xe178('0x9e')]===_0xe178('0xa7')){return db['UserVoiceQueueRt'][_0xe178('0x39')]({'where':{'UserId':_0x42e8e7[_0xe178('0x65')]['id'],'VoiceQueueId':_0x42e8e7['query']['ids']},'individualHooks':!![]})[_0xe178('0x23')](function(){return _0x4f0539;});}return _0x4f0539;})[_0xe178('0x23')](respondWithStatusCode(_0x334843,null))[_0xe178('0x2d')](handleError(_0x334843,null));};exports[_0xe178('0xb4')]=function(_0x46d010,_0x13a416,_0x3ef770){_0x46d010[_0xe178('0x69')]['userpic']=_0x46d010[_0xe178('0xb5')]['filename'];return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0x46d010[_0xe178('0x65')]['id']}})['then'](handleEntityNotFound(_0x13a416,null))['then'](saveUpdates(_0x46d010['body'],null))[_0xe178('0x23')](respondWithResult(_0x13a416,null))['catch'](handleError(_0x13a416,null));};exports[_0xe178('0xb6')]=function(_0x32215d,_0xd06c7c,_0xc78b05){var _0x14f851=path[_0xe178('0xb7')](config[_0xe178('0xb8')],_0xe178('0xb9'));return db['User'][_0xe178('0x43')]({'where':{'id':_0x32215d[_0xe178('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xe178('0x23')](handleEntityNotFound(_0xd06c7c,null))[_0xe178('0x23')](function(_0x14af65){if(_0x14af65){if(_['isNil'](_0x14af65[_0xe178('0xba')])){return _0xd06c7c['download'](_0x14f851);}else{if(!fs[_0xe178('0xbb')](path[_0xe178('0xb7')](config[_0xe178('0xb8')],_0xe178('0xbc'),_0x14af65[_0xe178('0xba')]))){return _0xd06c7c['download'](_0x14f851);}return _0xd06c7c[_0xe178('0xbd')](path[_0xe178('0xb7')](config['root'],_0xe178('0xbc'),_0x14af65['userpic']));}}})['catch'](handleError(_0xd06c7c,null));};exports[_0xe178('0xbe')]=function(_0x587c02,_0x3c8c34,_0x54ec91){var _0x23d7bf={};var _0x5c3141={};var _0x1a9ba8;var _0x49f987;return db[_0xe178('0x49')]['findOne']({'where':{'id':_0x587c02[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x3c8c34,null))[_0xe178('0x23')](function(_0x41342a){if(_0x41342a){_0x1a9ba8=_0x41342a;_0x5c3141[_0xe178('0x4d')]=_[_0xe178('0x51')](db['CmContact'][_0xe178('0x66')]);_0x5c3141[_0xe178('0x50')]=_[_0xe178('0x51')](_0x587c02[_0xe178('0x50')]);_0x5c3141[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x5c3141['model'],_0x5c3141[_0xe178('0x50')]);_0x23d7bf[_0xe178('0x53')]=_[_0xe178('0x52')](_0x5c3141[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x587c02[_0xe178('0x50')]['fields']));_0x23d7bf[_0xe178('0x53')]=_0x23d7bf[_0xe178('0x53')][_0xe178('0x55')]?_0x23d7bf[_0xe178('0x53')]:_0x5c3141[_0xe178('0x4d')];_0x23d7bf[_0xe178('0x58')]=qs['sort'](_0x587c02[_0xe178('0x50')][_0xe178('0x59')]);_0x23d7bf[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_['pick'](_0x587c02['query'],_0x5c3141[_0xe178('0x5a')]));if(_0x587c02['query'][_0xe178('0x3e')]){_0x23d7bf[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x23d7bf[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x23d7bf[_0xe178('0x53')],function(_0xf3ccf4){var _0x3f058c={};_0x3f058c[_0xf3ccf4]={'$like':'%'+_0x587c02[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x3f058c;})});}_0x23d7bf=_[_0xe178('0x5c')]({},_0x23d7bf,_0x587c02[_0xe178('0x61')]);return _0x1a9ba8[_0xe178('0xbe')](_0x23d7bf);}})['then'](function(_0x20a18f){if(_0x20a18f){_0x49f987=_0x20a18f[_0xe178('0x55')];if(_0x587c02[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0xbf'))){_0x23d7bf[_0xe178('0x68')]=[{'model':db['CmList'],'as':_0xe178('0xc0'),'required':![]},{'model':db[_0xe178('0xc1')],'as':_0xe178('0xc2'),'attributes':['id',_0xe178('0x44'),_0xe178('0xc3')],'where':_0x587c02['query'][_0xe178('0xc4')]?{'id':_0x587c02[_0xe178('0x50')][_0xe178('0xc4')]}:undefined,'required':_0x587c02[_0xe178('0x50')][_0xe178('0xc4')]?!![]:![]}];}if(!_0x587c02['query'][_0xe178('0x56')]('nolimit')){_0x23d7bf[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x587c02[_0xe178('0x50')]['limit']);_0x23d7bf['offset']=qs[_0xe178('0x31')](_0x587c02[_0xe178('0x50')][_0xe178('0x31')]);}return _0x1a9ba8['getContacts'](_0x23d7bf);}})['then'](function(_0x190596){if(_0x190596){return _0x190596?{'count':_0x49f987,'rows':_0x190596}:null;}})[_0xe178('0x23')](respondWithResult(_0x3c8c34,null))[_0xe178('0x2d')](handleError(_0x3c8c34,null));};exports[_0xe178('0xc5')]=function(_0x217771,_0x109650,_0xb9a9fb){var _0x15617b;var _0x15924f;var _0x3aae91={};var _0x1c89bc;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x217771[_0xe178('0x65')]['id']},'attributes':['id',_0xe178('0x44'),_0xe178('0x42')]})[_0xe178('0x23')](handleEntityNotFound(_0x109650,null))['then'](function(_0x52c8e2){if(!utils[_0xe178('0xb1')](_0x217771[_0xe178('0x50')]['channel'])){throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))]('Unknown\x20channel');}_0x15617b=_0x52c8e2;var _0x307ccd={};_0x307ccd[_0xe178('0x4d')]=_['keys'](db[_[_0xe178('0xa5')](_0x217771['query'][_0xe178('0x9e')])+_0xe178('0xc6')][_0xe178('0x66')]);_0x307ccd[_0xe178('0x50')]=_[_0xe178('0x51')](_0x217771[_0xe178('0x50')]);_0x307ccd['filters']=_['intersection'](_0x307ccd[_0xe178('0x4d')],_0x307ccd[_0xe178('0x50')]);_0x3aae91[_0xe178('0x53')]=_['intersection'](_0x307ccd[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x217771[_0xe178('0x50')][_0xe178('0x54')]));_0x3aae91['attributes']=_0x3aae91[_0xe178('0x53')][_0xe178('0x55')]?_0x3aae91[_0xe178('0x53')]:_0x307ccd['model'];_0x3aae91[_0xe178('0x58')]=qs['sort'](_0x217771[_0xe178('0x50')][_0xe178('0x59')]);_0x3aae91[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_['pick'](_0x217771[_0xe178('0x50')],_0x307ccd[_0xe178('0x5a')]));if(_0x217771[_0xe178('0x50')]['filter']){_0x3aae91[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x3aae91['where'],{'$or':_['map'](_0x3aae91['attributes'],function(_0x28c097){var _0x3f2f68={};_0x3f2f68[_0x28c097]={'$like':'%'+_0x217771[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x3f2f68;})});}_0x3aae91=_[_0xe178('0x5c')]({},_0x3aae91,_0x217771[_0xe178('0x61')]);switch(_0x15617b['role']){case _0xe178('0xc7'):return db[_[_0xe178('0xa5')](_0x217771['query'][_0xe178('0x9e')])+_0xe178('0xc6')][_0xe178('0x62')](_0x3aae91);case _0xe178('0x70'):case _0xe178('0x3c'):return _0x15617b[_0xe178('0x3a')+_[_0xe178('0xa5')](_0x217771[_0xe178('0x50')][_0xe178('0x9e')])+_0xe178('0xc8')](_0x3aae91);default:throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))](_0xe178('0xc9'));}})['then'](function(_0x4e8685){_0x1c89bc=_0x4e8685[_0xe178('0x55')];if(!_0x217771[_0xe178('0x50')]['hasOwnProperty']('nolimit')){_0x3aae91[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x217771['query'][_0xe178('0x32')]);_0x3aae91['offset']=qs[_0xe178('0x31')](_0x217771['query']['offset']);}switch(_0x15617b[_0xe178('0x42')]){case _0xe178('0xc7'):return db[_['capitalize'](_0x217771[_0xe178('0x50')]['channel'])+'Queue'][_0xe178('0x62')](_0x3aae91);case _0xe178('0x70'):case _0xe178('0x3c'):return _0x15617b[_0xe178('0x3a')+_[_0xe178('0xa5')](_0x217771[_0xe178('0x50')][_0xe178('0x9e')])+_0xe178('0xc8')](_0x3aae91);}})[_0xe178('0x23')](function(_0x63c0ef){return{'count':_0x1c89bc,'rows':_0x63c0ef};})[_0xe178('0x23')](respondWithResult(_0x109650,null))[_0xe178('0x2d')](handleError(_0x109650,null));};exports[_0xe178('0xca')]=function(_0x582abf,_0x979e8c,_0x506f6f){var _0x2e2fe3={};var _0x342aba={};var _0x6693df;var _0x4e4485;return db[_0xe178('0x49')]['findOne']({'where':{'id':_0x582abf[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x979e8c,null))[_0xe178('0x23')](function(_0x1319f4){if(_0x1319f4){_0x6693df=_0x1319f4;_0x342aba[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0xae')][_0xe178('0x66')]);_0x342aba[_0xe178('0x50')]=_['keys'](_0x582abf[_0xe178('0x50')]);_0x342aba[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x342aba[_0xe178('0x4d')],_0x342aba['query']);_0x2e2fe3[_0xe178('0x53')]=_[_0xe178('0x52')](_0x342aba[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x582abf['query'][_0xe178('0x54')]));_0x2e2fe3['attributes']=_0x2e2fe3[_0xe178('0x53')][_0xe178('0x55')]?_0x2e2fe3[_0xe178('0x53')]:_0x342aba['model'];_0x2e2fe3[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x582abf[_0xe178('0x50')][_0xe178('0x59')]);_0x2e2fe3['where']=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x582abf['query'],_0x342aba[_0xe178('0x5a')]));if(_0x582abf[_0xe178('0x50')][_0xe178('0x3e')]){_0x2e2fe3[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x2e2fe3[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x2e2fe3[_0xe178('0x53')],function(_0x6b822e){var _0x86cfc1={};_0x86cfc1[_0x6b822e]={'$like':'%'+_0x582abf[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x86cfc1;})});}_0x2e2fe3=_[_0xe178('0x5c')]({},_0x2e2fe3,_0x582abf[_0xe178('0x61')]);return _0x6693df[_0xe178('0xca')](_0x2e2fe3);}})[_0xe178('0x23')](function(_0x178811){if(_0x178811){_0x4e4485=_0x178811[_0xe178('0x55')];if(!_0x582abf[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x2e2fe3[_0xe178('0x32')]=qs['limit'](_0x582abf[_0xe178('0x50')][_0xe178('0x32')]);_0x2e2fe3[_0xe178('0x31')]=qs['offset'](_0x582abf[_0xe178('0x50')][_0xe178('0x31')]);}return _0x6693df[_0xe178('0xca')](_0x2e2fe3);}})[_0xe178('0x23')](function(_0x38d110){if(_0x38d110){return _0x38d110?{'count':_0x4e4485,'rows':_0x38d110}:null;}})[_0xe178('0x23')](respondWithResult(_0x979e8c,null))[_0xe178('0x2d')](handleError(_0x979e8c,null));};exports['getGroups']=function(_0x59a609,_0x2ee77b,_0x3d22ca){var _0x1e1e9d={};var _0x195043={};var _0x485e11;var _0x5d4403;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x59a609['params']['id']}})['then'](handleEntityNotFound(_0x2ee77b,null))['then'](function(_0x45e604){if(_0x45e604){_0x485e11=_0x45e604;_0x195043['model']=_[_0xe178('0x51')](db[_0xe178('0xcb')][_0xe178('0x66')]);_0x195043[_0xe178('0x50')]=_['keys'](_0x59a609[_0xe178('0x50')]);_0x195043['filters']=_['intersection'](_0x195043[_0xe178('0x4d')],_0x195043[_0xe178('0x50')]);_0x1e1e9d[_0xe178('0x53')]=_[_0xe178('0x52')](_0x195043[_0xe178('0x4d')],qs['fields'](_0x59a609[_0xe178('0x50')][_0xe178('0x54')]));_0x1e1e9d[_0xe178('0x53')]=_0x1e1e9d[_0xe178('0x53')][_0xe178('0x55')]?_0x1e1e9d[_0xe178('0x53')]:_0x195043['model'];_0x1e1e9d[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x59a609[_0xe178('0x50')][_0xe178('0x59')]);_0x1e1e9d['where']=qs['filters'](_[_0xe178('0x5b')](_0x59a609[_0xe178('0x50')],_0x195043[_0xe178('0x5a')]));if(_0x59a609[_0xe178('0x50')]['filter']){_0x1e1e9d['where']=_['merge'](_0x1e1e9d[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x1e1e9d[_0xe178('0x53')],function(_0x456a85){var _0xfc5017={};_0xfc5017[_0x456a85]={'$like':'%'+_0x59a609[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0xfc5017;})});}_0x1e1e9d=_[_0xe178('0x5c')]({},_0x1e1e9d,_0x59a609[_0xe178('0x61')]);return _0x485e11[_0xe178('0xcc')](_0x1e1e9d);}})[_0xe178('0x23')](function(_0x36e9a6){if(_0x36e9a6){_0x5d4403=_0x36e9a6[_0xe178('0x55')];if(!_0x59a609['query']['hasOwnProperty']('nolimit')){_0x1e1e9d['limit']=qs[_0xe178('0x32')](_0x59a609[_0xe178('0x50')][_0xe178('0x32')]);_0x1e1e9d[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x59a609[_0xe178('0x50')][_0xe178('0x31')]);}return _0x485e11[_0xe178('0xcc')](_0x1e1e9d);}})[_0xe178('0x23')](function(_0x52b771){if(_0x52b771){return _0x52b771?{'count':_0x5d4403,'rows':_0x52b771}:null;}})['then'](respondWithResult(_0x2ee77b,null))[_0xe178('0x2d')](handleError(_0x2ee77b,null));};exports['getRecordings']=function(_0x46deed,_0x3b2a46,_0x366120){var _0x126767={'raw':!![],'where':{}};var _0xe047b={};var _0x1a3980={'count':0x0,'rows':[]};return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x46deed[_0xe178('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b2a46,null))['then'](function(_0x154cb6){if(_0x154cb6){_0xe047b['model']=_[_0xe178('0x51')](db['VoiceRecording']['rawAttributes']);_0xe047b['query']=_[_0xe178('0x51')](_0x46deed[_0xe178('0x50')]);_0xe047b[_0xe178('0x5a')]=_[_0xe178('0x52')](_0xe047b[_0xe178('0x4d')],_0xe047b['query']);_0x126767[_0xe178('0x53')]=_[_0xe178('0x52')](_0xe047b[_0xe178('0x4d')],qs['fields'](_0x46deed[_0xe178('0x50')]['fields']));_0x126767[_0xe178('0x53')]=_0x126767[_0xe178('0x53')][_0xe178('0x55')]?_0x126767[_0xe178('0x53')]:_0xe047b[_0xe178('0x4d')];if(!_0x46deed['query'][_0xe178('0x56')](_0xe178('0x57'))){_0x126767['limit']=qs['limit'](_0x46deed[_0xe178('0x50')][_0xe178('0x32')]);_0x126767['offset']=qs[_0xe178('0x31')](_0x46deed[_0xe178('0x50')][_0xe178('0x31')]);}_0x126767[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x46deed[_0xe178('0x50')]['sort']);_0x126767[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_['pick'](_0x46deed[_0xe178('0x50')],_0xe047b[_0xe178('0x5a')]));_0x126767[_0xe178('0x5e')][_0xe178('0xcd')]=_0x154cb6['id'];if(_0x46deed[_0xe178('0x50')][_0xe178('0x3e')]){_0x126767[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x126767[_0xe178('0x5e')],{'$or':_['map'](_0x126767['attributes'],function(_0x57f016){var _0x2c08fb={};_0x2c08fb[_0x57f016]={'$like':'%'+_0x46deed[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x2c08fb;})});}_0x126767=_[_0xe178('0x5c')]({},_0x126767,_0x46deed[_0xe178('0x61')]);return db[_0xe178('0xce')][_0xe178('0x30')]({'where':_0x126767[_0xe178('0x5e')]})[_0xe178('0x23')](function(_0x4296f9){_0x1a3980[_0xe178('0x30')]=_0x4296f9;if(_0x46deed['query'][_0xe178('0xbf')]){_0x126767['include']=[{'all':!![]}];}return db[_0xe178('0xce')][_0xe178('0x62')](_0x126767);})[_0xe178('0x23')](function(_0x348b99){_0x1a3980['rows']=_0x348b99;return _0x1a3980;});}})['then'](respondWithFilteredResult(_0x3b2a46,_0x126767))[_0xe178('0x2d')](handleError(_0x3b2a46,null));};exports[_0xe178('0xcf')]=function(_0x417084,_0x76b88d,_0x941906){var _0x491129={'raw':!![],'where':{}};var _0x263cc8={};var _0x361d36={'count':0x0,'rows':[]};return db[_0xe178('0x49')]['findOne']({'where':{'id':_0x417084[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x76b88d,null))['then'](function(_0x20deaa){if(_0x20deaa){_0x263cc8[_0xe178('0x4d')]=_['keys'](db[_0xe178('0xd0')][_0xe178('0x66')]);_0x263cc8[_0xe178('0x50')]=_[_0xe178('0x51')](_0x417084[_0xe178('0x50')]);_0x263cc8[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x263cc8[_0xe178('0x4d')],_0x263cc8[_0xe178('0x50')]);_0x491129['attributes']=_['intersection'](_0x263cc8['model'],qs[_0xe178('0x54')](_0x417084[_0xe178('0x50')][_0xe178('0x54')]));_0x491129[_0xe178('0x53')]=_0x491129[_0xe178('0x53')][_0xe178('0x55')]?_0x491129[_0xe178('0x53')]:_0x263cc8[_0xe178('0x4d')];if(!_0x417084[_0xe178('0x50')]['hasOwnProperty'](_0xe178('0x57'))){_0x491129[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x417084[_0xe178('0x50')][_0xe178('0x32')]);_0x491129[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x417084['query']['offset']);}_0x491129[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x417084[_0xe178('0x50')][_0xe178('0x59')]);_0x491129['where']=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x417084[_0xe178('0x50')],_0x263cc8['filters']));_0x491129[_0xe178('0x5e')][_0xe178('0xcd')]=_0x20deaa['id'];if(_0x417084['query'][_0xe178('0x3e')]){_0x491129[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x491129['where'],{'$or':_[_0xe178('0x3f')](_0x491129[_0xe178('0x53')],function(_0x1c20c9){var _0x3af052={};_0x3af052[_0x1c20c9]={'$like':'%'+_0x417084['query'][_0xe178('0x3e')]+'%'};return _0x3af052;})});}_0x491129=_[_0xe178('0x5c')]({},_0x491129,_0x417084['options']);return db[_0xe178('0xd0')][_0xe178('0x30')]({'where':_0x491129[_0xe178('0x5e')]})[_0xe178('0x23')](function(_0xd70d3d){_0x361d36[_0xe178('0x30')]=_0xd70d3d;if(_0x417084[_0xe178('0x50')][_0xe178('0xbf')]){_0x491129[_0xe178('0x68')]=[{'all':!![]}];}return db[_0xe178('0xd0')][_0xe178('0x62')](_0x491129);})[_0xe178('0x23')](function(_0x3c4b1f){_0x361d36[_0xe178('0x63')]=_0x3c4b1f;return _0x361d36;});}})[_0xe178('0x23')](respondWithFilteredResult(_0x76b88d,_0x491129))['catch'](handleError(_0x76b88d,null));};exports[_0xe178('0xd1')]=function(_0x3a9886,_0x388dbf,_0x13d59d){var _0x139698={};var _0x49efdb={};var _0x4e3be0;var _0x242939;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x3a9886['params']['id']}})['then'](handleEntityNotFound(_0x388dbf,null))[_0xe178('0x23')](function(_0x246ddc){if(_0x246ddc){_0x4e3be0=_0x246ddc;_0x49efdb['model']=_[_0xe178('0x51')](db[_0xe178('0xd2')][_0xe178('0x66')]);_0x49efdb['query']=_[_0xe178('0x51')](_0x3a9886['query']);_0x49efdb[_0xe178('0x5a')]=_['intersection'](_0x49efdb[_0xe178('0x4d')],_0x49efdb['query']);_0x139698[_0xe178('0x53')]=_[_0xe178('0x52')](_0x49efdb[_0xe178('0x4d')],qs['fields'](_0x3a9886['query'][_0xe178('0x54')]));_0x139698['attributes']=_0x139698[_0xe178('0x53')]['length']?_0x139698[_0xe178('0x53')]:_0x49efdb[_0xe178('0x4d')];_0x139698['order']=qs[_0xe178('0x59')](_0x3a9886[_0xe178('0x50')][_0xe178('0x59')]);_0x139698[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x3a9886[_0xe178('0x50')],_0x49efdb[_0xe178('0x5a')]));if(_0x3a9886[_0xe178('0x50')][_0xe178('0x3e')]){_0x139698[_0xe178('0x5e')]=_['merge'](_0x139698['where'],{'$or':_[_0xe178('0x3f')](_0x139698[_0xe178('0x53')],function(_0x492efa){var _0x5d4e48={};_0x5d4e48[_0x492efa]={'$like':'%'+_0x3a9886['query'][_0xe178('0x3e')]+'%'};return _0x5d4e48;})});}_0x139698=_[_0xe178('0x5c')]({},_0x139698,_0x3a9886['options']);return _0x4e3be0[_0xe178('0xd1')](_0x139698);}})[_0xe178('0x23')](function(_0x54e8a8){if(_0x54e8a8){_0x242939=_0x54e8a8[_0xe178('0x55')];if(!_0x3a9886[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x139698[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x3a9886[_0xe178('0x50')][_0xe178('0x32')]);_0x139698[_0xe178('0x31')]=qs['offset'](_0x3a9886[_0xe178('0x50')][_0xe178('0x31')]);}return _0x4e3be0[_0xe178('0xd1')](_0x139698);}})['then'](function(_0x5e1c3d){if(_0x5e1c3d){return _0x5e1c3d?{'count':_0x242939,'rows':_0x5e1c3d}:null;}})['then'](respondWithResult(_0x388dbf,null))['catch'](handleError(_0x388dbf,null));};exports[_0xe178('0xd3')]=function(_0x39ed38,_0x30619a,_0xa3a113){var _0x14f0a8={};var _0x514563={};var _0x23293b;var _0x2b2468;return db[_0xe178('0x49')]['findOne']({'where':{'id':_0x39ed38[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x30619a,null))[_0xe178('0x23')](function(_0x1cdb38){if(_0x1cdb38){_0x23293b=_0x1cdb38;_0x514563[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0xd4')]['rawAttributes']);_0x514563[_0xe178('0x50')]=_['keys'](_0x39ed38[_0xe178('0x50')]);_0x514563['filters']=_['intersection'](_0x514563['model'],_0x514563['query']);_0x14f0a8['attributes']=_[_0xe178('0x52')](_0x514563[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x39ed38[_0xe178('0x50')][_0xe178('0x54')]));_0x14f0a8['attributes']=_0x14f0a8[_0xe178('0x53')]['length']?_0x14f0a8[_0xe178('0x53')]:_0x514563[_0xe178('0x4d')];_0x14f0a8[_0xe178('0x58')]=qs['sort'](_0x39ed38[_0xe178('0x50')][_0xe178('0x59')]);_0x14f0a8[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x39ed38[_0xe178('0x50')],_0x514563[_0xe178('0x5a')]));if(_0x39ed38['query'][_0xe178('0x3e')]){_0x14f0a8[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x14f0a8['where'],{'$or':_[_0xe178('0x3f')](_0x14f0a8[_0xe178('0x53')],function(_0x413b2d){var _0x27204a={};_0x27204a[_0x413b2d]={'$like':'%'+_0x39ed38['query']['filter']+'%'};return _0x27204a;})});}_0x14f0a8=_[_0xe178('0x5c')]({},_0x14f0a8,_0x39ed38[_0xe178('0x61')]);return _0x23293b[_0xe178('0xd3')](_0x14f0a8);}})[_0xe178('0x23')](function(_0x13c42d){if(_0x13c42d){_0x2b2468=_0x13c42d[_0xe178('0x55')];if(!_0x39ed38[_0xe178('0x50')]['hasOwnProperty'](_0xe178('0x57'))){_0x14f0a8[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x39ed38['query'][_0xe178('0x32')]);_0x14f0a8['offset']=qs[_0xe178('0x31')](_0x39ed38[_0xe178('0x50')][_0xe178('0x31')]);}return _0x23293b['getOpenchannelInteractions'](_0x14f0a8);}})[_0xe178('0x23')](function(_0xe8824){if(_0xe8824){return _0xe8824?{'count':_0x2b2468,'rows':_0xe8824}:null;}})[_0xe178('0x23')](respondWithResult(_0x30619a,null))['catch'](handleError(_0x30619a,null));};exports['getMailInteractions']=function(_0x4e5f4b,_0x2f6284,_0x4fdf9f){var _0x140830={'raw':!![],'where':{}};var _0x246e85={};var _0x3cb511={'count':0x0,'rows':[]};return db[_0xe178('0x49')]['findOne']({'where':{'id':_0x4e5f4b[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x2f6284,null))[_0xe178('0x23')](function(_0x4f4da6){if(_0x4f4da6){_0x246e85['model']=_['keys'](db[_0xe178('0xd5')][_0xe178('0x66')]);_0x246e85[_0xe178('0x50')]=_[_0xe178('0x51')](_0x4e5f4b[_0xe178('0x50')]);_0x246e85[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x246e85[_0xe178('0x4d')],_0x246e85[_0xe178('0x50')]);_0x140830[_0xe178('0x53')]=_['intersection'](_0x246e85[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x4e5f4b['query']['fields']));_0x140830[_0xe178('0x53')]=_0x140830[_0xe178('0x53')][_0xe178('0x55')]?_0x140830[_0xe178('0x53')]:_0x246e85[_0xe178('0x4d')];if(!_0x4e5f4b[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x140830[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x4e5f4b[_0xe178('0x50')][_0xe178('0x32')]);_0x140830['offset']=qs[_0xe178('0x31')](_0x4e5f4b[_0xe178('0x50')]['offset']);}_0x140830['order']=qs[_0xe178('0x59')](_0x4e5f4b[_0xe178('0x50')][_0xe178('0x59')]);_0x140830[_0xe178('0x5e')]=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x4e5f4b[_0xe178('0x50')],_0x246e85[_0xe178('0x5a')]));_0x140830[_0xe178('0x5e')][_0xe178('0xcd')]=_0x4f4da6['id'];if(_0x4e5f4b[_0xe178('0x50')]['filter']){_0x140830['where']=_['merge'](_0x140830['where'],{'$or':_[_0xe178('0x3f')](_0x140830[_0xe178('0x53')],function(_0x470c85){var _0x287166={};_0x287166[_0x470c85]={'$like':'%'+_0x4e5f4b[_0xe178('0x50')]['filter']+'%'};return _0x287166;})});}_0x140830=_[_0xe178('0x5c')]({},_0x140830,_0x4e5f4b[_0xe178('0x61')]);return db[_0xe178('0xd5')][_0xe178('0x30')]({'where':_0x140830[_0xe178('0x5e')]})[_0xe178('0x23')](function(_0xef4a50){_0x3cb511[_0xe178('0x30')]=_0xef4a50;if(_0x4e5f4b[_0xe178('0x50')][_0xe178('0xbf')]){_0x140830[_0xe178('0x68')]=[{'all':!![]}];}return db[_0xe178('0xd5')]['findAll'](_0x140830);})['then'](function(_0x24e6f7){_0x3cb511[_0xe178('0x63')]=_0x24e6f7;return _0x3cb511;});}})['then'](respondWithFilteredResult(_0x2f6284,_0x140830))['catch'](handleError(_0x2f6284,null));};exports['getSmsInteractions']=function(_0x2224ec,_0x359228,_0x1ffefb){var _0x354d21={};var _0x536d99={};var _0x2ec863;var _0x889e55;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x2224ec[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x359228,null))[_0xe178('0x23')](function(_0x512e29){if(_0x512e29){_0x2ec863=_0x512e29;_0x536d99[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0xd6')]['rawAttributes']);_0x536d99[_0xe178('0x50')]=_['keys'](_0x2224ec['query']);_0x536d99[_0xe178('0x5a')]=_['intersection'](_0x536d99[_0xe178('0x4d')],_0x536d99[_0xe178('0x50')]);_0x354d21[_0xe178('0x53')]=_[_0xe178('0x52')](_0x536d99['model'],qs[_0xe178('0x54')](_0x2224ec[_0xe178('0x50')]['fields']));_0x354d21['attributes']=_0x354d21[_0xe178('0x53')]['length']?_0x354d21[_0xe178('0x53')]:_0x536d99['model'];_0x354d21[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x2224ec[_0xe178('0x50')][_0xe178('0x59')]);_0x354d21['where']=qs['filters'](_[_0xe178('0x5b')](_0x2224ec['query'],_0x536d99['filters']));if(_0x2224ec['query'][_0xe178('0x3e')]){_0x354d21[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x354d21[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x354d21[_0xe178('0x53')],function(_0x3f6b9c){var _0x3bedd5={};_0x3bedd5[_0x3f6b9c]={'$like':'%'+_0x2224ec[_0xe178('0x50')]['filter']+'%'};return _0x3bedd5;})});}_0x354d21=_[_0xe178('0x5c')]({},_0x354d21,_0x2224ec[_0xe178('0x61')]);return _0x2ec863['getSmsInteractions'](_0x354d21);}})[_0xe178('0x23')](function(_0x12b88b){if(_0x12b88b){_0x889e55=_0x12b88b['length'];if(!_0x2224ec[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x354d21[_0xe178('0x32')]=qs['limit'](_0x2224ec[_0xe178('0x50')][_0xe178('0x32')]);_0x354d21[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x2224ec[_0xe178('0x50')][_0xe178('0x31')]);}return _0x2ec863['getSmsInteractions'](_0x354d21);}})[_0xe178('0x23')](function(_0x466433){if(_0x466433){return _0x466433?{'count':_0x889e55,'rows':_0x466433}:null;}})[_0xe178('0x23')](respondWithResult(_0x359228,null))[_0xe178('0x2d')](handleError(_0x359228,null));};exports[_0xe178('0xd7')]=function(_0x4640d7,_0x1de103,_0x2afe04){var _0x2f7ffb={};var _0x28667d={};var _0x5c8768;var _0x45cbda;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x4640d7[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x1de103,null))[_0xe178('0x23')](function(_0x5a2fdc){if(_0x5a2fdc){_0x5c8768=_0x5a2fdc;_0x28667d[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0xd8')]['rawAttributes']);_0x28667d[_0xe178('0x50')]=_[_0xe178('0x51')](_0x4640d7[_0xe178('0x50')]);_0x28667d['filters']=_[_0xe178('0x52')](_0x28667d['model'],_0x28667d[_0xe178('0x50')]);_0x2f7ffb['attributes']=_[_0xe178('0x52')](_0x28667d[_0xe178('0x4d')],qs['fields'](_0x4640d7[_0xe178('0x50')][_0xe178('0x54')]));_0x2f7ffb[_0xe178('0x53')]=_0x2f7ffb[_0xe178('0x53')][_0xe178('0x55')]?_0x2f7ffb[_0xe178('0x53')]:_0x28667d['model'];_0x2f7ffb[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x4640d7[_0xe178('0x50')][_0xe178('0x59')]);_0x2f7ffb['where']=qs['filters'](_['pick'](_0x4640d7[_0xe178('0x50')],_0x28667d[_0xe178('0x5a')]));if(_0x4640d7['query']['filter']){_0x2f7ffb[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x2f7ffb[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x2f7ffb['attributes'],function(_0xce6e72){var _0x2a09ef={};_0x2a09ef[_0xce6e72]={'$like':'%'+_0x4640d7[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x2a09ef;})});}_0x2f7ffb=_['merge']({},_0x2f7ffb,_0x4640d7['options']);return _0x5c8768['getFaxInteractions'](_0x2f7ffb);}})[_0xe178('0x23')](function(_0x30d9bb){if(_0x30d9bb){_0x45cbda=_0x30d9bb[_0xe178('0x55')];if(!_0x4640d7[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0x2f7ffb[_0xe178('0x32')]=qs['limit'](_0x4640d7[_0xe178('0x50')][_0xe178('0x32')]);_0x2f7ffb['offset']=qs[_0xe178('0x31')](_0x4640d7['query'][_0xe178('0x31')]);}return _0x5c8768[_0xe178('0xd7')](_0x2f7ffb);}})[_0xe178('0x23')](function(_0x21d48d){if(_0x21d48d){return _0x21d48d?{'count':_0x45cbda,'rows':_0x21d48d}:null;}})['then'](respondWithResult(_0x1de103,null))[_0xe178('0x2d')](handleError(_0x1de103,null));};exports['getWhatsappInteractions']=function(_0x2e1f34,_0x4186e1,_0x343a09){var _0x14fa09={};var _0x1d7cc1={};var _0x241e4c;var _0x2b4bc6;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x2e1f34[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x4186e1,null))[_0xe178('0x23')](function(_0x4a3df3){if(_0x4a3df3){_0x241e4c=_0x4a3df3;_0x1d7cc1[_0xe178('0x4d')]=_[_0xe178('0x51')](db['WhatsappInteraction'][_0xe178('0x66')]);_0x1d7cc1[_0xe178('0x50')]=_['keys'](_0x2e1f34['query']);_0x1d7cc1['filters']=_[_0xe178('0x52')](_0x1d7cc1[_0xe178('0x4d')],_0x1d7cc1[_0xe178('0x50')]);_0x14fa09[_0xe178('0x53')]=_[_0xe178('0x52')](_0x1d7cc1[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x2e1f34[_0xe178('0x50')][_0xe178('0x54')]));_0x14fa09[_0xe178('0x53')]=_0x14fa09[_0xe178('0x53')][_0xe178('0x55')]?_0x14fa09['attributes']:_0x1d7cc1[_0xe178('0x4d')];_0x14fa09[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x2e1f34[_0xe178('0x50')][_0xe178('0x59')]);_0x14fa09['where']=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x2e1f34[_0xe178('0x50')],_0x1d7cc1['filters']));if(_0x2e1f34[_0xe178('0x50')][_0xe178('0x3e')]){_0x14fa09[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x14fa09[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x14fa09[_0xe178('0x53')],function(_0x3fc28b){var _0x3e31a0={};_0x3e31a0[_0x3fc28b]={'$like':'%'+_0x2e1f34[_0xe178('0x50')]['filter']+'%'};return _0x3e31a0;})});}_0x14fa09=_[_0xe178('0x5c')]({},_0x14fa09,_0x2e1f34[_0xe178('0x61')]);return _0x241e4c[_0xe178('0xd9')](_0x14fa09);}})[_0xe178('0x23')](function(_0x17b6f2){if(_0x17b6f2){_0x2b4bc6=_0x17b6f2[_0xe178('0x55')];if(!_0x2e1f34['query'][_0xe178('0x56')](_0xe178('0x57'))){_0x14fa09[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x2e1f34[_0xe178('0x50')]['limit']);_0x14fa09['offset']=qs['offset'](_0x2e1f34['query']['offset']);}return _0x241e4c[_0xe178('0xd9')](_0x14fa09);}})['then'](function(_0x22bc3f){if(_0x22bc3f){return _0x22bc3f?{'count':_0x2b4bc6,'rows':_0x22bc3f}:null;}})['then'](respondWithResult(_0x4186e1,null))[_0xe178('0x2d')](handleError(_0x4186e1,null));};exports[_0xe178('0xda')]=function(_0x5d7f46,_0x5da99c,_0x422ff9){var _0x3e0765;var _0x534280;var _0x2df9de;var _0x58817c=!_[_0xe178('0x7b')](_0x5d7f46[_0xe178('0x65')]['id'])?_0x5d7f46[_0xe178('0x65')]['id']:!_['isNil'](_0x5d7f46[_0xe178('0x70')]['id'])?_0x5d7f46[_0xe178('0x70')]['id']:null;return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0x58817c,'role':{'$or':['admin','user',_0xe178('0x3c')]}},'attributes':['id',_0xe178('0x44'),'phone',_0xe178('0xdb'),'role',_0xe178('0x76'),_0xe178('0xdc')]})['then'](function(_0x549776){if(_0x549776){if(_0x549776[_0xe178('0x42')]===_0xe178('0x3c')){_0x3e0765=_0x549776;if(_0x5d7f46[_0xe178('0x69')][_0xe178('0xab')]){_0x2df9de=util[_0xe178('0xdd')](_0xe178('0xde'),_0x3e0765[_0x5d7f46[_0xe178('0x69')][_0xe178('0xab')]]);}else if(_0x5d7f46[_0xe178('0x69')][_0xe178('0xdf')]){_0x2df9de=util[_0xe178('0xdd')](_0xe178('0xac'),_0x5d7f46[_0xe178('0x69')][_0xe178('0xdf')]);}else{_0x2df9de=util[_0xe178('0xdd')](_0xe178('0xac'),_0x3e0765['name']);}socket['to'](util['format'](_0xe178('0xe0'),_0x3e0765[_0xe178('0x44')]))[_0xe178('0xa4')]('user:forcelogout',{'ip':_0x5d7f46[_0xe178('0xe1')][_0xe178('0xe2')]||_0x5d7f46[_0xe178('0xe3')][_0xe178('0xe4')]||_0x5d7f46[_0xe178('0xe5')]['remoteAddress']||_0x5d7f46[_0xe178('0xe3')][_0xe178('0xe5')][_0xe178('0xe4')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3e0765['name']},'individualHooks':!![]});}}else{throw new db[(_0xe178('0x20'))][(_0xe178('0x21'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xe178('0x23')](function(){if(_0x3e0765){return _0x3e0765[_0xe178('0xe6')]({'raw':!![]});}})[_0xe178('0x23')](function(_0x4feb48){if(_0x3e0765){var _0x56134f=[];if(_0x4feb48){_0x534280=_0x4feb48;if(_0x534280[_0xe178('0x55')]){for(var _0x298428=0x0;_0x298428<_0x534280[_0xe178('0x55')];_0x298428++){_0x56134f['push']({'membername':_0x3e0765[_0xe178('0x44')],'UserId':_0x3e0765['id'],'queue_name':_0x534280[_0x298428]['name'],'VoiceQueueId':_0x534280[_0x298428]['id'],'interface':_0x2df9de,'paused':_0x3e0765['loginInPause']||![],'penalty':_0x534280[_0x298428][_0xe178('0xe7')]||0x0});}return BPromise[_0xe178('0xad')](_0x56134f,function(_0x32fd02){return db['UserVoiceQueueRt']['upsert'](_0x32fd02);});}}}})[_0xe178('0x23')](function(){if(_0x3e0765){return db[_0xe178('0xe8')][_0xe178('0x62')]({'where':{'membername':_0x3e0765[_0xe178('0x44')],'exitAt':null}});}})[_0xe178('0x23')](function(_0xb3f1a2){if(_0x3e0765){var _0x30e050=[];_0xb3f1a2[_0xe178('0xe9')](function(_0x2e7a55){_0x30e050[_0xe178('0xaa')](_0x2e7a55[_0xe178('0x38')]({'exitAt':moment()[_0xe178('0xdd')](_0xe178('0xea'))}));});return BPromise[_0xe178('0xeb')](_0x30e050);}})['then'](function(){if(_0x3e0765){var _0x25946a=[];var _0x27ed15=[];var _0x489513=utils[_0xe178('0xec')]();var _0xda6b55={'membername':_0x3e0765[_0xe178('0x44')],'interface':_0x2df9de,'enterAt':moment()[_0xe178('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3e0765[_0xe178('0x42')],'internal':_0x3e0765[_0xe178('0x76')]};_0x489513[_0xe178('0xe9')](function(_0x2a4a2c){_0x25946a[_0xe178('0xaa')](_['merge']({'channel':_0x2a4a2c,'type':'LOGIN','data1':_0x5d7f46['body'][_0xe178('0xed')],'data2':_0x2df9de},_0xda6b55));if(_0x3e0765[_0xe178('0xdc')]){_0x27ed15[_0xe178('0xaa')](_[_0xe178('0x5c')]({'channel':_0x2a4a2c,'type':_0xe178('0xee'),'data1':_0xe178('0xef')},_0xda6b55));}});return db[_0xe178('0xe8')][_0xe178('0xf0')](_0x25946a[_0xe178('0xf1')](_0x27ed15),{'individualHooks':!![]});}})[_0xe178('0x23')](function(){if(_0x3e0765){return _0x3e0765[_0xe178('0x38')]({'online':!![],'lastLoginAt':moment()[_0xe178('0xdd')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3e0765[_0xe178('0xdc')]||![],'mailPause':_0x3e0765[_0xe178('0xdc')]||![],'chatPause':_0x3e0765['loginInPause']||![],'faxPause':_0x3e0765[_0xe178('0xdc')]||![],'smsPause':_0x3e0765[_0xe178('0xdc')]||![],'openchannelPause':_0x3e0765[_0xe178('0xdc')]||![],'whatsappPause':_0x3e0765[_0xe178('0xdc')]||![],'pauseType':_0x3e0765[_0xe178('0xdc')]?_0xe178('0xef'):null,'interface':_0x2df9de,'lastPauseAt':moment()[_0xe178('0xdd')](_0xe178('0xea'))});}})[_0xe178('0x23')](function(_0x21a083){if(_0x5d7f46[_0xe178('0xf2')]){return _0x422ff9();}else{return BPromise[_0xe178('0xf3')](_0x21a083)[_0xe178('0x23')](respondWithResult(_0x5da99c,null));}})[_0xe178('0x2d')](handleError(_0x5da99c,null));};exports[_0xe178('0xf4')]=function(_0xb8bec1,_0xfcd7b9,_0x9a8b4b){var _0x3ee1d9;return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0xb8bec1[_0xe178('0x65')]['id'],'role':_0xe178('0x3c')},'attributes':['id',_0xe178('0x44'),_0xe178('0x42')]})['then'](handleEntityNotFound(_0xfcd7b9,null))[_0xe178('0x23')](function(_0x1dc003){if(_0x1dc003){_0x3ee1d9=_0x1dc003;return db[_0xe178('0xae')]['destroy']({'where':{'membername':_0x3ee1d9[_0xe178('0x44')]},'individualHooks':!![]});}})[_0xe178('0x23')](function(){return db['MemberReport'][_0xe178('0x62')]({'where':{'membername':_0x3ee1d9[_0xe178('0x44')],'exitAt':null}});})[_0xe178('0x23')](function(_0x2a4cb0){var _0x455e08=[];_0x2a4cb0[_0xe178('0xe9')](function(_0x590795){_0x455e08['push'](_0x590795[_0xe178('0x38')]({'exitAt':moment()['format'](_0xe178('0xea'))}));});return BPromise[_0xe178('0xeb')](_0x455e08);})[_0xe178('0x23')](function(){return _0x3ee1d9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe178('0x23')](respondWithResult(_0xfcd7b9,null))['catch'](handleError(_0xfcd7b9,null));};exports[_0xe178('0xf5')]=function(_0x1b1713,_0x54fe1e,_0x4af5da){var _0x566760;return db[_0xe178('0xae')][_0xe178('0x38')]({'paused':0x1},{'where':{'UserId':_0x1b1713[_0xe178('0x65')]['id']},'individualHooks':!![]})[_0xe178('0x23')](function(){return db['User']['find']({'where':{'id':_0x1b1713['params']['id'],'role':_0xe178('0x3c')},'attributes':['id',_0xe178('0x44'),_0xe178('0x42'),_0xe178('0x76'),_0xe178('0xab')]});})[_0xe178('0x23')](handleEntityNotFound(_0x54fe1e,null))[_0xe178('0x23')](function(_0x4d56ab){if(_0x4d56ab){_0x566760=_0x4d56ab;return respondWithRpcPromise(_0xe178('0xf6'),_0xe178('0xf5'),{'id':_0x566760['id'],'name':_0x566760[_0xe178('0x44')],'pause':!![]});}})['then'](function(){if(_0x566760){return db['MemberReport'][_0xe178('0x62')]({'where':{'membername':_0x566760[_0xe178('0x44')],'type':_0xe178('0xee'),'exitAt':null}});}})[_0xe178('0x23')](function(_0x47461b){if(_0x47461b[_0xe178('0x55')]){var _0x7d5256=moment()['format'](_0xe178('0xea'));for(var _0x33a6e5=0x0,_0x13784c=_0x47461b['length'];_0x33a6e5<_0x13784c;_0x33a6e5++){_0x47461b[_0x33a6e5][_0xe178('0xf7')]({'exitAt':_0x7d5256});}}})['then'](function(){var _0x3e03c5=[];var _0x266ff6=utils[_0xe178('0xec')]();_0x266ff6[_0xe178('0xe9')](function(_0x15eea0){_0x3e03c5[_0xe178('0xaa')]({'channel':_0x15eea0,'membername':_0x566760[_0xe178('0x44')],'interface':_[_0xe178('0x7b')](_0x566760[_0xe178('0xab')])?util[_0xe178('0xdd')](_0xe178('0xac'),_0x566760[_0xe178('0x44')]):_0x566760[_0xe178('0xab')],'type':_0xe178('0xee'),'enterAt':moment()['format'](_0xe178('0xea')),'data1':_0x1b1713['body']['type']||'DEFAULT\x20PAUSE','role':_0x566760[_0xe178('0x42')],'internal':_0x566760['internal']});});return db['MemberReport'][_0xe178('0xf0')](_0x3e03c5,{'individualHooks':!![]});})[_0xe178('0x23')](function(){return _0x566760['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b1713[_0xe178('0x69')][_0xe178('0x4b')]||_0xe178('0xf8'),'lastPauseAt':moment()['format'](_0xe178('0xea'))});})[_0xe178('0x23')](respondWithResult(_0x54fe1e,null))['catch'](handleError(_0x54fe1e,null));};exports[_0xe178('0xf9')]=function(_0x5eb6c2,_0x4c605c,_0x50b8fb){var _0x2680ab;return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0x5eb6c2[_0xe178('0x65')]['id']},'attributes':['id',_0xe178('0x44'),'role',_0xe178('0x9f'),_0xe178('0xfa'),_0xe178('0xfb'),_0xe178('0xfc'),_0xe178('0xfd'),_0xe178('0xfe'),_0xe178('0xff'),_0xe178('0x100'),_0xe178('0x101')]})[_0xe178('0x23')](handleEntityNotFound(_0x4c605c,null))[_0xe178('0x23')](function(_0x27ffc9){if(_0x27ffc9){_0x2680ab=_0x27ffc9;if(_0x5eb6c2[_0xe178('0x69')][_0xe178('0x9e')]&&!utils[_0xe178('0xb1')](_0x5eb6c2[_0xe178('0x69')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xe178('0xa0'));}switch(_0x5eb6c2['body'][_0xe178('0x9e')]){case _0xe178('0xa7'):return respondWithRpcPromise(_0xe178('0xf6'),'unpause',{'id':_0x2680ab['id'],'name':_0x2680ab[_0xe178('0x44')],'pause':![]})[_0xe178('0x23')](function(){return db[_0xe178('0xae')][_0xe178('0x38')]({'paused':0x0},{'where':{'UserId':_0x2680ab['id']},'individualHooks':!![]});})['then'](function(){return db[_0xe178('0xe8')]['find']({'where':{'channel':_0x5eb6c2['body'][_0xe178('0x9e')],'membername':_0x2680ab[_0xe178('0x44')],'type':_0xe178('0xee'),'exitAt':null}});})[_0xe178('0x23')](function(_0x3478f9){if(_0x3478f9){return _0x3478f9[_0xe178('0x38')]({'exitAt':moment()['format'](_0xe178('0xea')),'data2':_0xe178('0x102')},{'individualHooks':!![]});}return null;})[_0xe178('0x23')](function(){return _0x2680ab[_0xe178('0x38')]({'voicePause':![]});});case'mail':case _0xe178('0x103'):case'fax':case'sms':case'whatsapp':case'openchannel':return db[_0xe178('0xe8')][_0xe178('0x43')]({'where':{'channel':_0x5eb6c2[_0xe178('0x69')]['channel'],'membername':_0x2680ab['name'],'type':_0xe178('0xee'),'exitAt':null}})[_0xe178('0x23')](function(_0x47969e){if(_0x47969e){return _0x47969e['update']({'exitAt':moment()[_0xe178('0xdd')](_0xe178('0xea')),'data2':_0xe178('0x102')},{'individualHooks':!![]});}return null;})[_0xe178('0x23')](function(){var _0x1a2610={};_['set'](_0x1a2610,util[_0xe178('0xdd')](_0xe178('0x104'),_0x5eb6c2[_0xe178('0x69')][_0xe178('0x9e')],_0xe178('0x105')),![]);return _0x2680ab[_0xe178('0x38')](_0x1a2610);});default:return respondWithRpcPromise('QueuePause',_0xe178('0xf9'),{'id':_0x2680ab['id'],'name':_0x2680ab[_0xe178('0x44')],'pause':![]})[_0xe178('0x23')](function(){return db[_0xe178('0xae')][_0xe178('0x38')]({'paused':0x0},{'where':{'UserId':_0x2680ab['id']}});})['then'](function(){return db[_0xe178('0xe8')][_0xe178('0x62')]({'where':{'membername':_0x2680ab[_0xe178('0x44')],'type':_0xe178('0xee'),'exitAt':null}});})['then'](function(_0x18f97f){var _0x43b550=[];_0x18f97f[_0xe178('0xe9')](function(_0x4f350e){_0x43b550[_0xe178('0xaa')](_0x4f350e[_0xe178('0x38')]({'exitAt':moment()[_0xe178('0xdd')](_0xe178('0xea')),'data2':_0xe178('0x102')}));});return BPromise['all'](_0x43b550);})[_0xe178('0x23')](function(){return _0x2680ab[_0xe178('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xe178('0x23')](respondWithResult(_0x4c605c,null))[_0xe178('0x2d')](handleError(_0x4c605c,null));};exports[_0xe178('0x106')]=function(_0x3ea8e7,_0xa8dfeb,_0x74519){var _0xc2bd19={};var _0x3ff62e={};var _0x9eb267;var _0x457ea2;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x3ea8e7['params']['id']}})[_0xe178('0x23')](handleEntityNotFound(_0xa8dfeb,null))[_0xe178('0x23')](function(_0x15a95e){if(_0x15a95e){_0x9eb267=_0x15a95e;_0x3ff62e[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0x107')][_0xe178('0x66')]);_0x3ff62e[_0xe178('0x50')]=_[_0xe178('0x51')](_0x3ea8e7[_0xe178('0x50')]);_0x3ff62e[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x3ff62e[_0xe178('0x4d')],_0x3ff62e[_0xe178('0x50')]);_0xc2bd19[_0xe178('0x53')]=_[_0xe178('0x52')](_0x3ff62e[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x3ea8e7[_0xe178('0x50')]['fields']));_0xc2bd19['attributes']=_0xc2bd19['attributes'][_0xe178('0x55')]?_0xc2bd19[_0xe178('0x53')]:_0x3ff62e[_0xe178('0x4d')];_0xc2bd19[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x3ea8e7[_0xe178('0x50')][_0xe178('0x59')]);_0xc2bd19[_0xe178('0x5e')]=qs['filters'](_[_0xe178('0x5b')](_0x3ea8e7[_0xe178('0x50')],_0x3ff62e[_0xe178('0x5a')]));if(_0x3ea8e7[_0xe178('0x50')][_0xe178('0x3e')]){_0xc2bd19[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0xc2bd19[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0xc2bd19[_0xe178('0x53')],function(_0xa5a120){var _0x167c2b={};_0x167c2b[_0xa5a120]={'$like':'%'+_0x3ea8e7[_0xe178('0x50')]['filter']+'%'};return _0x167c2b;})});}_0xc2bd19=_[_0xe178('0x5c')]({},_0xc2bd19,_0x3ea8e7['options']);return _0x9eb267[_0xe178('0x106')](_0xc2bd19);}})['then'](function(_0x443a81){if(_0x443a81){_0x457ea2=_0x443a81['length'];if(!_0x3ea8e7[_0xe178('0x50')][_0xe178('0x56')](_0xe178('0x57'))){_0xc2bd19[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x3ea8e7['query'][_0xe178('0x32')]);_0xc2bd19[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x3ea8e7['query'][_0xe178('0x31')]);}return _0x9eb267[_0xe178('0x106')](_0xc2bd19);}})['then'](function(_0x33f6b7){if(_0x33f6b7){return _0x33f6b7?{'count':_0x457ea2,'rows':_0x33f6b7}:null;}})[_0xe178('0x23')](respondWithResult(_0xa8dfeb,null))[_0xe178('0x2d')](handleError(_0xa8dfeb,null));};exports['addTeams']=function(_0xe9f89e,_0x5cac0d){return db[_0xe178('0x49')][_0xe178('0x43')]({'where':{'id':_0xe9f89e['params']['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x5cac0d,null))[_0xe178('0x23')](function(_0x1f3b10){if(_0x1f3b10){var _0x3d8608=_0x1f3b10['get']({'plain':!![]});return _0x1f3b10[_0xe178('0x108')](_0xe9f89e[_0xe178('0x69')][_0xe178('0x6c')],_[_0xe178('0x6d')](_0xe9f89e[_0xe178('0x69')],['ids','id'])||{})[_0xe178('0x23')](function(){for(var _0x3d56b3=0x0;_0x3d56b3<_0xe9f89e[_0xe178('0x69')][_0xe178('0x6c')][_0xe178('0x55')];_0x3d56b3++){var _0x2fd03e=[];db[_0xe178('0x107')][_0xe178('0x95')]({'where':{'id':_0xe9f89e[_0xe178('0x69')][_0xe178('0x6c')][_0x3d56b3]}})[_0xe178('0x23')](function(_0x225692){_0x2fd03e[_0xe178('0xaa')](_0x225692[_0xe178('0xe6')]()['then'](function(_0x102410){for(var _0xe6c4ec=0x0;_0xe6c4ec<_0x102410['length'];_0xe6c4ec++){_0x102410[_0xe6c4ec]['setDataValue'](_0xe178('0x9e'),'Voice');}return _0x102410;}));_0x2fd03e[_0xe178('0xaa')](_0x225692[_0xe178('0x109')]()[_0xe178('0x23')](function(_0x1299d5){for(var _0x2bcbed=0x0;_0x2bcbed<_0x1299d5[_0xe178('0x55')];_0x2bcbed++){_0x1299d5[_0x2bcbed][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x10b'));}return _0x1299d5;}));_0x2fd03e[_0xe178('0xaa')](_0x225692['getMailQueues']()[_0xe178('0x23')](function(_0x5088bc){for(var _0x27e0ed=0x0;_0x27e0ed<_0x5088bc[_0xe178('0x55')];_0x27e0ed++){_0x5088bc[_0x27e0ed]['setDataValue'](_0xe178('0x9e'),'Mail');}return _0x5088bc;}));_0x2fd03e[_0xe178('0xaa')](_0x225692[_0xe178('0x10c')]()['then'](function(_0x389ac7){for(var _0x9d1a43=0x0;_0x9d1a43<_0x389ac7[_0xe178('0x55')];_0x9d1a43++){_0x389ac7[_0x9d1a43][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x10d'));}return _0x389ac7;}));_0x2fd03e['push'](_0x225692[_0xe178('0x10e')]()[_0xe178('0x23')](function(_0x29921f){for(var _0x53414f=0x0;_0x53414f<_0x29921f[_0xe178('0x55')];_0x53414f++){_0x29921f[_0x53414f]['setDataValue'](_0xe178('0x9e'),_0xe178('0x10f'));}return _0x29921f;}));_0x2fd03e[_0xe178('0xaa')](_0x225692[_0xe178('0x110')]()[_0xe178('0x23')](function(_0x3d4f06){for(var _0x56d65c=0x0;_0x56d65c<_0x3d4f06['length'];_0x56d65c++){_0x3d4f06[_0x56d65c]['setDataValue']('channel',_0xe178('0x111'));}return _0x3d4f06;}));_0x2fd03e[_0xe178('0xaa')](_0x225692[_0xe178('0x112')]()['then'](function(_0x415fdb){for(var _0x1c9daa=0x0;_0x1c9daa<_0x415fdb[_0xe178('0x55')];_0x1c9daa++){_0x415fdb[_0x1c9daa]['setDataValue'](_0xe178('0x9e'),_0xe178('0x113'));}return _0x415fdb;}));return BPromise[_0xe178('0xeb')](_0x2fd03e);})[_0xe178('0x23')](function(_0x189e3b){var _0x5682cf=_[_0xe178('0x114')](_0x189e3b);_0x2fd03e=[];return db['sequelize'][_0xe178('0x115')](function(_0x15bc55){for(var _0x3a899f=0x0;_0x3a899f<_0x5682cf[_0xe178('0x55')];_0x3a899f++){_0x2fd03e[_0xe178('0xaa')](_0x5682cf[_0x3a899f][_0xe178('0x116')](_0x3d8608['id']),{'transaction':_0x15bc55});}return BPromise[_0xe178('0xeb')](_0x2fd03e)[_0xe178('0x23')](function(){if(_0x3d8608[_0xe178('0xa9')]){return BPromise[_0xe178('0xad')](_[_0xe178('0x3e')](_0x5682cf,function(_0x42ac3c){return _0x42ac3c[_0xe178('0x117')]('channel')===_0xe178('0x118');}),function(_0x58b7b0){return db[_0xe178('0xae')][_0xe178('0xaf')]({'membername':_0x3d8608[_0xe178('0x44')],'UserId':_0x3d8608['id'],'queue_name':_0x58b7b0['name'],'VoiceQueueId':_0x58b7b0['id'],'interface':_[_0xe178('0x7b')](_0x3d8608[_0xe178('0xab')])?util[_0xe178('0xdd')](_0xe178('0xac'),_0x3d8608['name']):_0x3d8608[_0xe178('0xab')],'paused':_0x3d8608[_0xe178('0x9f')]||![],'penalty':_0x3d8608[_0xe178('0x119')]},{'transaction':_0x15bc55});});}else{return;}})[_0xe178('0x23')](function(){for(var _0x5c9675=0x0;_0x5c9675<_0x5682cf[_0xe178('0x55')];_0x5c9675++){var _0x37a121=_0x5682cf[_0x5c9675][_0xe178('0x117')](_0xe178('0x9e'));var _0xf87e20=_0x37a121+_0xe178('0xb3');socket[_0xe178('0xa4')](_0xe178('0x70')+_0x37a121+_0xe178('0xa6'),{'UserId':_0x3d8608['id'],['queueField']:_0x5682cf[_0x5c9675]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x5cac0d,null))[_0xe178('0x2d')](handleError(_0x5cac0d,null));};exports['removeTeams']=function(_0x2df996,_0x361cea){return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x2df996[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x361cea,null))[_0xe178('0x23')](function(_0x51aefa){if(_0x51aefa){var _0x1dfe72=_0x51aefa['get']({'plain':!![]});var _0x219d79=_0x2df996[_0xe178('0x50')][_0xe178('0x6c')];return _0x51aefa['removeTeams'](_0x219d79)['then'](function(){for(var _0x249747=0x0;_0x249747<_0x219d79[_0xe178('0x55')];_0x249747++){var _0x21920d=[];db[_0xe178('0x107')][_0xe178('0x95')]({'where':{'id':_0x219d79[_0x249747]}})[_0xe178('0x23')](function(_0x4a5e15){_0x21920d[_0xe178('0xaa')](_0x4a5e15[_0xe178('0xe6')]()['then'](function(_0x1066e6){for(var _0x53e19d=0x0;_0x53e19d<_0x1066e6['length'];_0x53e19d++){_0x1066e6[_0x53e19d][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x118'));}return _0x1066e6;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15[_0xe178('0x109')]()[_0xe178('0x23')](function(_0x28a340){for(var _0xda5a59=0x0;_0xda5a59<_0x28a340[_0xe178('0x55')];_0xda5a59++){_0x28a340[_0xda5a59][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x10b'));}return _0x28a340;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15['getMailQueues']()[_0xe178('0x23')](function(_0x15f919){for(var _0x5abd6d=0x0;_0x5abd6d<_0x15f919[_0xe178('0x55')];_0x5abd6d++){_0x15f919[_0x5abd6d][_0xe178('0x10a')](_0xe178('0x9e'),'Mail');}return _0x15f919;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15[_0xe178('0x10c')]()[_0xe178('0x23')](function(_0x27d4f6){for(var _0x5bdeab=0x0;_0x5bdeab<_0x27d4f6['length'];_0x5bdeab++){_0x27d4f6[_0x5bdeab][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x10d'));}return _0x27d4f6;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15['getWhatsappQueues']()[_0xe178('0x23')](function(_0x4762b2){for(var _0x14ca39=0x0;_0x14ca39<_0x4762b2[_0xe178('0x55')];_0x14ca39++){_0x4762b2[_0x14ca39][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x10f'));}return _0x4762b2;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15['getFaxQueues']()['then'](function(_0x1d4015){for(var _0x4e443b=0x0;_0x4e443b<_0x1d4015[_0xe178('0x55')];_0x4e443b++){_0x1d4015[_0x4e443b][_0xe178('0x10a')](_0xe178('0x9e'),_0xe178('0x111'));}return _0x1d4015;}));_0x21920d[_0xe178('0xaa')](_0x4a5e15[_0xe178('0x112')]()[_0xe178('0x23')](function(_0x2cb5fb){for(var _0x5abe54=0x0;_0x5abe54<_0x2cb5fb['length'];_0x5abe54++){_0x2cb5fb[_0x5abe54][_0xe178('0x10a')](_0xe178('0x9e'),'Openchannel');}return _0x2cb5fb;}));return BPromise[_0xe178('0xeb')](_0x21920d);})[_0xe178('0x23')](function(_0x4edadf){var _0x7dee7c=_[_0xe178('0x114')](_0x4edadf);_0x21920d=[];return db[_0xe178('0x5d')]['transaction'](function(_0x4a9f1c){for(var _0x2b1db9=0x0;_0x2b1db9<_0x7dee7c[_0xe178('0x55')];_0x2b1db9++){_0x21920d['push'](_0x7dee7c[_0x2b1db9][_0xe178('0x11a')](_0x1dfe72['id']),{'transaction':_0x4a9f1c});}return BPromise[_0xe178('0xeb')](_0x21920d)['then'](function(){if(_0x1dfe72[_0xe178('0xa9')]){return BPromise['each'](_[_0xe178('0x3e')](_0x7dee7c,function(_0x205a99){return _0x205a99[_0xe178('0x117')](_0xe178('0x9e'))===_0xe178('0x118');}),function(_0x2fad1e){return db[_0xe178('0xae')][_0xe178('0x39')]({'where':{'VoiceQueueId':_0x2fad1e['id'],'UserId':_0x1dfe72['id']},'transaction':_0x4a9f1c});});}else{return;}})[_0xe178('0x23')](function(){for(var _0x49403b=0x0;_0x49403b<_0x7dee7c[_0xe178('0x55')];_0x49403b++){var _0x3d05f9=_0x7dee7c[_0x49403b][_0xe178('0x117')](_0xe178('0x9e'));var _0x30f5cc=_0x3d05f9+_0xe178('0xb3');socket[_0xe178('0xa4')](_0xe178('0x70')+_0x3d05f9+_0xe178('0x11b'),{'UserId':_0x1dfe72['id'],['queueField']:_0x7dee7c[_0x49403b]['id']});}});});});}});}})[_0xe178('0x23')](respondWithStatusCode(_0x361cea,null))['catch'](handleError(_0x361cea,null));};exports[_0xe178('0x11c')]=function(_0x3543db,_0x472bd7,_0x430df4){var _0x5e3bb2={};var _0x11c34f={};var _0x18dd0e;var _0x5003e4;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x3543db[_0xe178('0x65')]['id']}})[_0xe178('0x23')](handleEntityNotFound(_0x472bd7,null))[_0xe178('0x23')](function(_0x1ad0b5){if(_0x1ad0b5){_0x18dd0e=_0x1ad0b5;_0x11c34f[_0xe178('0x4d')]=_[_0xe178('0x51')](db[_0xe178('0x11d')][_0xe178('0x66')]);_0x11c34f[_0xe178('0x50')]=_[_0xe178('0x51')](_0x3543db[_0xe178('0x50')]);_0x11c34f['filters']=_[_0xe178('0x52')](_0x11c34f['model'],_0x11c34f[_0xe178('0x50')]);_0x5e3bb2['attributes']=_['intersection'](_0x11c34f[_0xe178('0x4d')],qs[_0xe178('0x54')](_0x3543db[_0xe178('0x50')]['fields']));_0x5e3bb2['attributes']=_0x5e3bb2['attributes'][_0xe178('0x55')]?_0x5e3bb2[_0xe178('0x53')]:_0x11c34f[_0xe178('0x4d')];_0x5e3bb2[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x3543db[_0xe178('0x50')][_0xe178('0x59')]);_0x5e3bb2[_0xe178('0x5e')]=qs['filters'](_[_0xe178('0x5b')](_0x3543db[_0xe178('0x50')],_0x11c34f[_0xe178('0x5a')]));if(_0x3543db['query']['filter']){_0x5e3bb2['where']=_[_0xe178('0x5c')](_0x5e3bb2[_0xe178('0x5e')],{'$or':_['map'](_0x5e3bb2['attributes'],function(_0xb57ef7){var _0x193281={};_0x193281[_0xb57ef7]={'$like':'%'+_0x3543db[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x193281;})});}_0x5e3bb2=_[_0xe178('0x5c')]({},_0x5e3bb2,_0x3543db[_0xe178('0x61')]);return _0x18dd0e[_0xe178('0x11c')](_0x5e3bb2);}})[_0xe178('0x23')](function(_0x1a3fd0){if(_0x1a3fd0){_0x5003e4=_0x1a3fd0[_0xe178('0x55')];if(!_0x3543db[_0xe178('0x50')]['hasOwnProperty'](_0xe178('0x57'))){_0x5e3bb2[_0xe178('0x32')]=qs[_0xe178('0x32')](_0x3543db[_0xe178('0x50')][_0xe178('0x32')]);_0x5e3bb2[_0xe178('0x31')]=qs[_0xe178('0x31')](_0x3543db[_0xe178('0x50')][_0xe178('0x31')]);}return _0x18dd0e[_0xe178('0x11c')](_0x5e3bb2);}})[_0xe178('0x23')](function(_0x5bb51e){if(_0x5bb51e){return _0x5bb51e?{'count':_0x5003e4,'rows':_0x5bb51e}:null;}})[_0xe178('0x23')](respondWithResult(_0x472bd7,null))['catch'](handleError(_0x472bd7,null));};exports[_0xe178('0x11e')]=function(_0x40a9d8,_0x25167e,_0x19ec91){var _0x3fecb3={};var _0x28e0e1={};var _0x5e1069;var _0x352be5;return db[_0xe178('0x49')][_0xe178('0x95')]({'where':{'id':_0x40a9d8[_0xe178('0x65')]['id']}})['then'](handleEntityNotFound(_0x25167e,null))[_0xe178('0x23')](function(_0x2fc7a6){if(_0x2fc7a6){_0x5e1069=_0x2fc7a6;_0x28e0e1[_0xe178('0x4d')]=_['keys'](db[_0xe178('0x49')][_0xe178('0x66')]);_0x28e0e1[_0xe178('0x50')]=_[_0xe178('0x51')](_0x40a9d8[_0xe178('0x50')]);_0x28e0e1[_0xe178('0x5a')]=_[_0xe178('0x52')](_0x28e0e1[_0xe178('0x4d')],_0x28e0e1[_0xe178('0x50')]);_0x3fecb3[_0xe178('0x53')]=_['intersection'](_0x28e0e1[_0xe178('0x4d')],qs['fields'](_0x40a9d8[_0xe178('0x50')][_0xe178('0x54')]));_0x3fecb3[_0xe178('0x53')]=_0x3fecb3[_0xe178('0x53')][_0xe178('0x55')]?_0x3fecb3[_0xe178('0x53')]:_0x28e0e1[_0xe178('0x4d')];_0x3fecb3[_0xe178('0x58')]=qs[_0xe178('0x59')](_0x40a9d8[_0xe178('0x50')]['sort']);_0x3fecb3['where']=qs[_0xe178('0x5a')](_[_0xe178('0x5b')](_0x40a9d8['query'],_0x28e0e1[_0xe178('0x5a')]));if(_0x40a9d8['query'][_0xe178('0x3e')]){_0x3fecb3[_0xe178('0x5e')]=_[_0xe178('0x5c')](_0x3fecb3[_0xe178('0x5e')],{'$or':_[_0xe178('0x3f')](_0x3fecb3[_0xe178('0x53')],function(_0x2dced3){var _0x54ef37={};_0x54ef37[_0x2dced3]={'$like':'%'+_0x40a9d8[_0xe178('0x50')][_0xe178('0x3e')]+'%'};return _0x54ef37;})});}_0x3fecb3['model']=db[_0xe178('0x49')];_0x3fecb3['as']=_0xe178('0x8f');_0x3fecb3=_[_0xe178('0x5c')]({},_0x3fecb3,_0x40a9d8[_0xe178('0x61')]);return _0x5e1069[_0xe178('0xe6')]({'include':[_0x3fecb3]});}})[_0xe178('0x23')](function(_0x3d893d){if(_0x3d893d){var _0x13088f={},_0x203bff=[],_0x5a50c1=0x0;for(var _0x2f9d34=0x0;_0x2f9d34<_0x3d893d[_0xe178('0x55')];_0x2f9d34+=0x1){for(var _0xab98a4=0x0,_0x15ce82;_0xab98a4<_0x3d893d[_0x2f9d34][_0xe178('0x8f')][_0xe178('0x55')];_0xab98a4+=0x1){_0x15ce82=_0x3d893d[_0x2f9d34][_0xe178('0x8f')][_0xab98a4][_0xe178('0x3a')]({'plain':!![]});_0x13088f[_0x15ce82['id']]=_0x15ce82;}}_0x13088f=_[_0xe178('0x11f')](_0x13088f);for(var _0x3b2bf7=qs[_0xe178('0x31')](_0x40a9d8[_0xe178('0x50')]['offset']);_0x3b2bf7<_0x13088f['length']&&_0x203bff['length']=_0x16614a){_0x435863=_0x16614a;_0x52ca5d=0xc8;}else{_0x52ca5d=0xce;}_0x4f3690[_0xaa0d('0x2d')](_0x52ca5d);return _0x4f3690['set']('Content-Range',_0x933e15+'-'+_0x435863+'/'+_0x16614a)['json'](_0x5d52b3);}return null;};}function patchUpdates(_0x3b5dbc){return function(_0x53cebb){try{jsonpatch[_0xaa0d('0x32')](_0x53cebb,_0x3b5dbc,!![]);}catch(_0x22c39f){return BPromise[_0xaa0d('0x33')](_0x22c39f);}return _0x53cebb['save']();};}function saveUpdates(_0x3cfe5a,_0x24addb){return function(_0x131f02){if(_0x131f02){return _0x131f02['update'](_0x3cfe5a)['then'](function(_0x152066){return _0x152066;});}return null;};}function removeEntity(_0x68197f,_0x207359){return function(_0x353640){if(_0x353640){return _0x353640[_0xaa0d('0x34')]()['then'](function(){var _0x168a22=_0x353640[_0xaa0d('0x35')]({'plain':!![]});var _0x1c758c=[{'name':_0xaa0d('0x36'),'value':'user','ignore':!![]},{'name':_0xaa0d('0x37'),'value':_0xaa0d('0x38'),'ignore':![]},{'name':'Telephones','value':_0xaa0d('0x39'),'ignore':![]}];var _0x26b45e=_(_0x1c758c)[_0xaa0d('0x3a')](_0xaa0d('0x3b'))['map'](_0xaa0d('0x3c'))[_0xaa0d('0x3c')]();if(_[_0xaa0d('0x3d')](_0x26b45e,_0x168a22[_0xaa0d('0x3e')])){return;}var _0x570e06=_[_0xaa0d('0x3f')](_0x1c758c,['value',_0x168a22[_0xaa0d('0x3e')]])['name'];return db['UserProfileResource'][_0xaa0d('0x34')]({'where':{'type':_0x570e06,'resourceId':_0x168a22['id']}})['then'](function(){return _0x353640;});})['then'](function(){_0x68197f['status'](0xcc)[_0xaa0d('0x2c')]();});}};}function handleEntityNotFound(_0x12d22e,_0x28b880){return function(_0x465450){if(!_0x465450){_0x12d22e['sendStatus'](0x194);}return _0x465450;};}function handleError(_0x4bd811,_0x5a99e6){_0x5a99e6=_0x5a99e6||0x1f4;return function(_0x5bf049){logger[_0xaa0d('0x27')](_0x5bf049['stack']);if(_0x5bf049[_0xaa0d('0x40')]){delete _0x5bf049[_0xaa0d('0x40')];}_0x4bd811[_0xaa0d('0x2d')](_0x5a99e6)['send'](_0x5bf049);};}exports[_0xaa0d('0x41')]=function(_0x227207,_0x10edf2){var _0x38eaca={},_0x45a29e={},_0x358ae5={'count':0x0,'rows':[]};var _0x67c73b=_['map'](db[_0xaa0d('0x42')][_0xaa0d('0x43')],function(_0x104f24){return{'name':_0x104f24[_0xaa0d('0x44')],'type':_0x104f24[_0xaa0d('0x45')]['key']};});_0x45a29e[_0xaa0d('0x46')]=_['differenceBy'](_[_0xaa0d('0x47')](_0x67c73b,_0xaa0d('0x40')),[_0xaa0d('0x48'),_0xaa0d('0x49')]);_0x45a29e[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x227207['query']);_0x45a29e['filters']=_['intersection'](_0x45a29e['model'],_0x45a29e[_0xaa0d('0x4a')]);_0x38eaca[_0xaa0d('0x4c')]=_['intersection'](_0x45a29e['model'],qs['fields'](_0x227207[_0xaa0d('0x4a')]['fields']));_0x38eaca['attributes']=_0x38eaca[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x38eaca[_0xaa0d('0x4c')]:_0x45a29e[_0xaa0d('0x46')];if(!_0x227207['query'][_0xaa0d('0x4e')]('nolimit')){_0x38eaca[_0xaa0d('0x31')]=qs[_0xaa0d('0x31')](_0x227207[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x38eaca[_0xaa0d('0x30')]=qs['offset'](_0x227207[_0xaa0d('0x4a')][_0xaa0d('0x30')]);}_0x38eaca[_0xaa0d('0x4f')]=qs['sort'](_0x227207['query'][_0xaa0d('0x50')]);_0x38eaca[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_['pick'](_0x227207[_0xaa0d('0x4a')],_0x45a29e[_0xaa0d('0x52')]),_0x67c73b);if(_0x227207[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x38eaca[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x38eaca[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x67c73b,function(_0x811c67){if(_0x811c67[_0xaa0d('0x45')]!==_0xaa0d('0x54')){return db[_0xaa0d('0x55')][_0xaa0d('0x51')](db[_0xaa0d('0x55')]['fn']('lower',db['sequelize'][_0xaa0d('0x56')](_0x811c67[_0xaa0d('0x40')])),{'$like':db[_0xaa0d('0x55')]['fn'](_0xaa0d('0x57'),'%'+_0x227207['query']['filter']+'%')});}})});}_0x38eaca=_[_0xaa0d('0x53')]({},_0x38eaca,_0x227207[_0xaa0d('0x58')]);var _0x44faf7={'where':_0x38eaca['where']};return db[_0xaa0d('0x42')]['count'](_0x44faf7)[_0xaa0d('0x59')](function(_0x2e55c8){_0x358ae5['count']=_0x2e55c8;if(_0x227207[_0xaa0d('0x4a')][_0xaa0d('0x5a')]){_0x38eaca['include']=[{'all':!![]}];}return db[_0xaa0d('0x42')][_0xaa0d('0x5b')](_0x38eaca);})[_0xaa0d('0x59')](function(_0x312e9d){_0x358ae5[_0xaa0d('0x5c')]=_0x312e9d;return _0x358ae5;})[_0xaa0d('0x59')](respondWithFilteredResult(_0x10edf2,_0x38eaca))[_0xaa0d('0x5d')](handleError(_0x10edf2,null));};exports[_0xaa0d('0x5e')]=function(_0x41cca1,_0x56ac70){var _0x55dcf6={'raw':![],'where':{'id':_0x41cca1['params']['id']}},_0x539bc7={};_0x539bc7[_0xaa0d('0x46')]=_[_0xaa0d('0x5f')](_['keys'](db[_0xaa0d('0x42')][_0xaa0d('0x43')]),[_0xaa0d('0x48'),_0xaa0d('0x49')]);_0x539bc7[_0xaa0d('0x4a')]=_['keys'](_0x41cca1['query']);_0x539bc7[_0xaa0d('0x52')]=_['intersection'](_0x539bc7[_0xaa0d('0x46')],_0x539bc7[_0xaa0d('0x4a')]);_0x55dcf6[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x539bc7[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x41cca1[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x55dcf6[_0xaa0d('0x4c')]=_0x55dcf6[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x55dcf6[_0xaa0d('0x4c')]:_0x539bc7[_0xaa0d('0x46')];if(_0x41cca1[_0xaa0d('0x4a')][_0xaa0d('0x5a')]){_0x55dcf6['include']=[{'all':!![]}];}_0x55dcf6=_['merge']({},_0x55dcf6,_0x41cca1['options']);return db[_0xaa0d('0x42')][_0xaa0d('0x3f')](_0x55dcf6)[_0xaa0d('0x59')](handleEntityNotFound(_0x56ac70,null))['then'](respondWithResult(_0x56ac70,null))[_0xaa0d('0x5d')](handleError(_0x56ac70,null));};exports[_0xaa0d('0x62')]=function(_0x383cd1,_0x198adf){return db['User']['bulkCreate'](_0x383cd1[_0xaa0d('0x63')],{'raw':![],'individualHooks':!![]})[_0xaa0d('0x59')](respondWithResult(_0x198adf,0xc9))[_0xaa0d('0x5d')](handleError(_0x198adf,null));};exports['update']=function(_0x15c679,_0x51203b){if(_0x15c679[_0xaa0d('0x63')]['id']){delete _0x15c679[_0xaa0d('0x63')]['id'];}delete _0x15c679[_0xaa0d('0x63')][_0xaa0d('0x3e')];return db['User'][_0xaa0d('0x3f')]({'where':{'id':_0x15c679['params']['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x51203b,null))[_0xaa0d('0x59')](saveUpdates(_0x15c679[_0xaa0d('0x63')],null))[_0xaa0d('0x59')](respondWithResult(_0x51203b,null))[_0xaa0d('0x5d')](handleError(_0x51203b,null));};exports[_0xaa0d('0x64')]=function(_0x37e431,_0x442369){return db[_0xaa0d('0x42')][_0xaa0d('0x64')]()['then'](respondWithResult(_0x442369,null))[_0xaa0d('0x5d')](handleError(_0x442369,null));};exports[_0xaa0d('0x65')]=function(_0x520c00,_0x48b756,_0x455d3b){return db['User'][_0xaa0d('0x3f')]({'where':{'id':_0x520c00[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x48b756,null))[_0xaa0d('0x59')](function(_0x3c4322){if(_0x3c4322){return _0x3c4322[_0xaa0d('0x65')](_0x520c00[_0xaa0d('0x63')][_0xaa0d('0x67')],_[_0xaa0d('0x68')](_0x520c00[_0xaa0d('0x63')],[_0xaa0d('0x67'),'id'])||{});}})['then'](respondWithResult(_0x48b756,null))[_0xaa0d('0x5d')](handleError(_0x48b756,null));};var getLicense=function(_0x17b498){return new BPromise(function(_0x183495,_0x4d934d){var _0x3ec503=0x0;_0x17b498[_0xaa0d('0x63')][_0xaa0d('0x3e')]===_0xaa0d('0x38')&&_0x183495(_0xaa0d('0x69'));return db[_0xaa0d('0x42')]['count']({'where':{'$or':[{'role':_0x17b498['body'][_0xaa0d('0x3e')]===_0xaa0d('0x39')?_0xaa0d('0x39'):['admin',_0xaa0d('0x6a')]}]}})['then'](function(_0x3217c6){_0x3ec503=_0x3217c6;return require('../../config/license/util')[_0xaa0d('0x6b')]();})[_0xaa0d('0x59')](function(_0x3ce0d7){var _0x4b04a8=_0x17b498[_0xaa0d('0x63')][_0xaa0d('0x3e')]===_0xaa0d('0x39')?'telephones':'users';if(!_['isNil'](_0x3ce0d7[_0x4b04a8])&&_0x3ec503>=_0x3ce0d7[_0x4b04a8]){return _0x4d934d({'message':_0xaa0d('0x6c')});}return _0x183495(util['format'](_0xaa0d('0x6d'),_0x4b04a8,_0x3ec503));})[_0xaa0d('0x5d')](function(_0x2200db){return _0x4d934d(_0x2200db);});});};exports[_0xaa0d('0x6e')]=function(_0x4e750a,_0x37e861){return getLicense(_0x4e750a)['then'](function(_0x367968){if(!_0x4e750a[_0xaa0d('0x63')]['internal']){var _0x34cd1e;return db[_0xaa0d('0x6f')][_0xaa0d('0x70')](0x1)[_0xaa0d('0x59')](function(_0x259652){return checkPasswordPattern(_0x259652,_0x4e750a['body'][_0xaa0d('0x48')],_0x259652[_0xaa0d('0x71')]);})[_0xaa0d('0x59')](function(_0x1db95c){_0x34cd1e=_0x1db95c[_0xaa0d('0x72')];return db['User']['max']('internal');})['then'](function(_0x44ddec){if(_[_0xaa0d('0x73')](_0x44ddec)){if(_0x34cd1e){_0x4e750a[_0xaa0d('0x63')]['internal']=_0x34cd1e;}else{_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x74')]=0x1;}}else{if(_[_0xaa0d('0x73')](_0x34cd1e)||_0x34cd1e==_0x44ddec){_0x4e750a['body'][_0xaa0d('0x74')]=_0x44ddec+0x1;}else if(_0x34cd1e>_0x44ddec){_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x74')]=_0x34cd1e;}else{return db[_0xaa0d('0x55')][_0xaa0d('0x4a')]('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['sequelize'][_0xaa0d('0x75')][_0xaa0d('0x76')]})[_0xaa0d('0x59')](function(_0x10388d){if(_0x10388d&&_0x10388d[_0xaa0d('0x4d')]){for(var _0x36a464=0x0,_0x5d285e=_0x10388d[_0xaa0d('0x4d')];_0x36a464<_0x5d285e&&_[_0xaa0d('0x73')](_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x74')]);_0x36a464++){if(_0x34cd1e<=_0x10388d[_0x36a464][_0xaa0d('0x77')]){_0x4e750a['body']['internal']=_0x10388d[_0x36a464][_0xaa0d('0x77')];}else if(_0x34cd1e>_0x10388d[_0x36a464][_0xaa0d('0x77')]&&_0x34cd1e<=_0x10388d[_0x36a464]['to']){_0x4e750a['body'][_0xaa0d('0x74')]=_0x34cd1e;}}}if(_[_0xaa0d('0x73')](_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x74')])){_0x4e750a['body'][_0xaa0d('0x74')]=_0x44ddec+0x1;}});}}});}})[_0xaa0d('0x59')](function(){if(_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x78')]){_0x4e750a['body'][_0xaa0d('0x79')]=_0x4e750a[_0xaa0d('0x63')]['internal'];_0x4e750a[_0xaa0d('0x63')]['VoiceMail']={'mailbox':_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x74')],'password':_0x4e750a['body'][_0xaa0d('0x48')],'fullname':_0x4e750a['body']['fullname'],'email':_0x4e750a['body'][_0xaa0d('0x7a')]};}if(_0x4e750a[_0xaa0d('0x63')]&&_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x3e')]===_0xaa0d('0x38')){if(!_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x7b')]){_0x4e750a[_0xaa0d('0x63')][_0xaa0d('0x7b')]=[_0xaa0d('0x7c'),_0xaa0d('0x7d'),'103',_0xaa0d('0x7e'),_0xaa0d('0x7f'),_0xaa0d('0x80'),'105',_0xaa0d('0x81'),_0xaa0d('0x82'),_0xaa0d('0x83'),'109',_0xaa0d('0x84'),_0xaa0d('0x85'),_0xaa0d('0x86')];}}return db[_0xaa0d('0x42')][_0xaa0d('0x6e')](_0x4e750a[_0xaa0d('0x63')],{'include':[{'model':db[_0xaa0d('0x87')],'as':_0xaa0d('0x87')}]});})[_0xaa0d('0x59')](function(_0xae4327){if(_0x4e750a[_0xaa0d('0x63')]['role']===_0xaa0d('0x6a'))return _0xae4327;var _0x516f0e=_0x4e750a['user']['get']({'plain':!![]});if(!_0x516f0e)throw new Error(_0xaa0d('0x88'));if(_0x516f0e[_0xaa0d('0x3e')]===_0xaa0d('0x6a')){var _0x1d3eea=_0xae4327[_0xaa0d('0x35')]({'plain':!![]});var _0x5a415f=[{'name':_0xaa0d('0x37'),'value':_0xaa0d('0x38')},{'name':_0xaa0d('0x89'),'value':_0xaa0d('0x39')}];var _0x4d74d9=_[_0xaa0d('0x3f')](_0x5a415f,[_0xaa0d('0x3c'),_0x1d3eea[_0xaa0d('0x3e')]])['name'];return db[_0xaa0d('0x8a')][_0xaa0d('0x3f')]({'where':{'name':_0x4d74d9,'userProfileId':_0x516f0e[_0xaa0d('0x8b')]},'raw':!![]})['then'](function(_0x5a72b6){if(_0x5a72b6&&_0x5a72b6['autoAssociation']===0x0){return db[_0xaa0d('0x8c')][_0xaa0d('0x6e')]({'name':_0x1d3eea['name'],'resourceId':_0x1d3eea['id'],'type':_0x5a72b6[_0xaa0d('0x40')],'sectionId':_0x5a72b6['id']},{})[_0xaa0d('0x59')](function(){return _0xae4327;});}else{return _0xae4327;}})[_0xaa0d('0x5d')](function(_0x539973){logger[_0xaa0d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x539973);throw _0x539973;});}return _0xae4327;})[_0xaa0d('0x59')](respondWithResult(_0x37e861,0xc9))[_0xaa0d('0x5d')](handleError(_0x37e861,null));};exports['changePassword']=function(_0x337f8d,_0x43d245,_0x4b71a1){var _0x1a38cf=![];if(_0x337f8d[_0xaa0d('0x63')]['id']){delete _0x337f8d[_0xaa0d('0x63')]['id'];}return db[_0xaa0d('0x6f')][_0xaa0d('0x8d')]({'attributes':['id',_0xaa0d('0x71')]})[_0xaa0d('0x59')](function(_0x97b547){_0x1a38cf=_0x97b547[_0xaa0d('0x71')];return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0x337f8d['params']['id']}});})[_0xaa0d('0x59')](function(_0x47e988){if(_0x47e988){if(_0x47e988['id']==_0x337f8d[_0xaa0d('0x6a')]['id']){if(!_0x337f8d['body'][_0xaa0d('0x8e')]||!_0x337f8d[_0xaa0d('0x63')][_0xaa0d('0x8f')]){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x90'));}if(!_0x47e988[_0xaa0d('0x91')](_0x337f8d[_0xaa0d('0x63')][_0xaa0d('0x8e')])){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x92'));}if(_0x337f8d[_0xaa0d('0x63')][_0xaa0d('0x8e')]==_0x337f8d['body']['newPassword']){throw new db['Sequelize'][(_0xaa0d('0x1f'))](_0xaa0d('0x93'));}return _0x47e988;}else if(_0x337f8d[_0xaa0d('0x6a')][_0xaa0d('0x3e')]==_0xaa0d('0x94')){if(!_0x337f8d[_0xaa0d('0x63')][_0xaa0d('0x8f')]){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x95'));}return _0x47e988;}else if(_0x337f8d[_0xaa0d('0x6a')][_0xaa0d('0x3e')]=='user'){if(!_0x337f8d[_0xaa0d('0x63')][_0xaa0d('0x8f')]){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x95'));}if(_0x47e988['role']!=_0xaa0d('0x38')){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x96'));}return _0x47e988;}else{throw new db['Sequelize'][(_0xaa0d('0x1f'))](_0xaa0d('0x96'));}}return null;})[_0xaa0d('0x59')](handleEntityNotFound(_0x43d245,null))['then'](function(_0x1aee2e){return checkPasswordPattern(_0x1aee2e,_0x337f8d['body'][_0xaa0d('0x8f')],_0x1a38cf);})[_0xaa0d('0x59')](saveUpdates({'password':_0x337f8d[_0xaa0d('0x63')]['newPassword'],'passwordResetAt':_0x337f8d[_0xaa0d('0x6a')]['id']==_0x337f8d[_0xaa0d('0x66')]['id']?moment():null},null))[_0xaa0d('0x59')](respondWithResult(_0x43d245,null))[_0xaa0d('0x5d')](handleError(_0x43d245,null));};exports['addQueues']=function(_0x30f5b1,_0x484dd5,_0x2b15ab){var _0x4972a3=_0x30f5b1['body'][_0xaa0d('0x97')];return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0x30f5b1[_0xaa0d('0x66')]['id']},'attributes':['id',_0xaa0d('0x40'),'role',_0xaa0d('0x98'),'loginInPause','voicePause',_0xaa0d('0x99')]})[_0xaa0d('0x59')](handleEntityNotFound(_0x484dd5,null))['then'](function(_0x5e4f36){if(_0x5e4f36){if(!utils[_0xaa0d('0x9a')](_0x4972a3)){throw new db['Sequelize'][(_0xaa0d('0x1f'))](_0xaa0d('0x9b'));}return _0x5e4f36[_0xaa0d('0x9c')+_[_0xaa0d('0x9d')](_0x4972a3[_0xaa0d('0x9e')]())+'Queues'](_0x30f5b1['body'][_0xaa0d('0x67')],{'penalty':_0x30f5b1[_0xaa0d('0x63')][_0xaa0d('0x9f')]||0x0})[_0xaa0d('0xa0')](function(_0x2d300e){for(var _0x460c58=0x0;_0x460c58<_0x30f5b1[_0xaa0d('0x63')][_0xaa0d('0x67')]['length'];_0x460c58+=0x1){var _0x104e92={'UserId':_0x30f5b1[_0xaa0d('0x66')]['id']};_0x104e92[_[_0xaa0d('0x9d')](_0x4972a3[_0xaa0d('0x9e')]())+_0xaa0d('0xa1')]=_0x30f5b1['body'][_0xaa0d('0x67')][_0x460c58];socket[_0xaa0d('0xa2')](_0xaa0d('0x6a')+_[_0xaa0d('0x9d')](_0x4972a3['toLowerCase']())+'Queue:save',_0x104e92);}return _0x2d300e;})[_0xaa0d('0x59')](function(){if(_0x4972a3===_0xaa0d('0xa3')){return db[_0xaa0d('0xa4')][_0xaa0d('0x5b')]({'where':{'id':_0x30f5b1[_0xaa0d('0x63')][_0xaa0d('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xaa0d('0x59')](function(_0x1343b5){var _0xbec06c=_0x5e4f36[_0xaa0d('0x35')]({'plain':!![]});var _0x28b19a=[];if(_0x4972a3===_0xaa0d('0xa3')&&_0xbec06c[_0xaa0d('0x3e')]==='agent'&&_0xbec06c[_0xaa0d('0x98')]){for(var _0x389818=0x0;_0x389818<_0x1343b5[_0xaa0d('0x4d')];_0x389818+=0x1){_0x28b19a['push']({'membername':_0xbec06c[_0xaa0d('0x40')],'UserId':_0xbec06c['id'],'queue_name':_0x1343b5[_0x389818][_0xaa0d('0x40')],'VoiceQueueId':_0x1343b5[_0x389818]['id'],'interface':_['isNil'](_0xbec06c[_0xaa0d('0x99')])?util[_0xaa0d('0xa5')](_0xaa0d('0xa6'),_0xbec06c[_0xaa0d('0x40')]):_0xbec06c[_0xaa0d('0x99')],'paused':_0xbec06c[_0xaa0d('0xa7')]||![],'penalty':_0x30f5b1[_0xaa0d('0x63')][_0xaa0d('0x9f')]||0x0});}return BPromise['each'](_0x28b19a,function(_0x5d006c){return db['UserVoiceQueueRt'][_0xaa0d('0xa8')](_0x5d006c);});}return _0x5e4f36;});}})['then'](respondWithStatusCode(_0x484dd5,null))[_0xaa0d('0x5d')](handleError(_0x484dd5,null));};exports[_0xaa0d('0xa9')]=function(_0x4e1ea3,_0x3e8808,_0x10d11f){var _0xbf9a39;return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0x4e1ea3[_0xaa0d('0x66')]['id']},'attributes':['id','name','role']})[_0xaa0d('0x59')](handleEntityNotFound(_0x3e8808,null))['then'](function(_0x548131){if(_0x548131){_0xbf9a39=_0x548131;if(!_0x4e1ea3['query'][_0xaa0d('0x97')]||!utils[_0xaa0d('0x9a')](_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x97')])){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0x9b'));}return _0x548131[_0xaa0d('0xaa')+_[_0xaa0d('0x9d')](_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x97')]['toLowerCase']())+'Queues'](_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x67')]);}})[_0xaa0d('0x59')](function(_0x526c6a){for(var _0x1c0014=0x0;_0x1c0014<_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x67')][_0xaa0d('0x4d')];_0x1c0014+=0x1){var _0x4502f8={'UserId':_0x4e1ea3[_0xaa0d('0x66')]['id']};_0x4502f8[_[_0xaa0d('0x9d')](_0x4e1ea3[_0xaa0d('0x4a')]['channel'][_0xaa0d('0x9e')]())+_0xaa0d('0xa1')]=_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x67')][_0x1c0014];socket[_0xaa0d('0xa2')](_0xaa0d('0x6a')+_['capitalize'](_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x97')][_0xaa0d('0x9e')]())+_0xaa0d('0xab'),_0x4502f8);}return _0x526c6a;})[_0xaa0d('0x59')](function(){if(_0x4e1ea3[_0xaa0d('0x4a')]['channel']==='voice'){return db[_0xaa0d('0xac')][_0xaa0d('0x34')]({'where':{'UserId':_0x4e1ea3['params']['id'],'VoiceQueueId':_0x4e1ea3[_0xaa0d('0x4a')][_0xaa0d('0x67')]},'individualHooks':!![]})['then'](function(){return _0xbf9a39;});}return _0xbf9a39;})[_0xaa0d('0x59')](respondWithStatusCode(_0x3e8808,null))[_0xaa0d('0x5d')](handleError(_0x3e8808,null));};exports[_0xaa0d('0xad')]=function(_0x2dd14f,_0x407fd5,_0x12e537){_0x2dd14f[_0xaa0d('0x63')][_0xaa0d('0xae')]=_0x2dd14f['file'][_0xaa0d('0xaf')];return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0x2dd14f['params']['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x407fd5,null))[_0xaa0d('0x59')](saveUpdates(_0x2dd14f[_0xaa0d('0x63')],null))[_0xaa0d('0x59')](respondWithResult(_0x407fd5,null))[_0xaa0d('0x5d')](handleError(_0x407fd5,null));};exports[_0xaa0d('0xb0')]=function(_0x54ddfc,_0x25b859,_0x4a95ee){var _0x25ff21=path[_0xaa0d('0xb1')](config['root'],_0xaa0d('0xb2'));return db['User'][_0xaa0d('0x3f')]({'where':{'id':_0x54ddfc[_0xaa0d('0x66')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xaa0d('0x59')](handleEntityNotFound(_0x25b859,null))['then'](function(_0x2119b1){if(_0x2119b1){if(_[_0xaa0d('0x73')](_0x2119b1['userpic'])){return _0x25b859[_0xaa0d('0xb3')](_0x25ff21);}else{if(!fs['existsSync'](path[_0xaa0d('0xb1')](config['root'],'server/files/images/',_0x2119b1[_0xaa0d('0xae')]))){return _0x25b859[_0xaa0d('0xb3')](_0x25ff21);}return _0x25b859[_0xaa0d('0xb3')](path[_0xaa0d('0xb1')](config[_0xaa0d('0xb4')],_0xaa0d('0xb5'),_0x2119b1[_0xaa0d('0xae')]));}}})[_0xaa0d('0x5d')](handleError(_0x25b859,null));};exports[_0xaa0d('0xb6')]=function(_0x7b4c1d,_0x406d26,_0x7c9f58){var _0x238dc7={};var _0x25ead1={};var _0x4f2058;var _0x20d8bb;return db[_0xaa0d('0x42')]['findOne']({'where':{'id':_0x7b4c1d[_0xaa0d('0x66')]['id']}})['then'](handleEntityNotFound(_0x406d26,null))['then'](function(_0x356914){if(_0x356914){_0x4f2058=_0x356914;_0x25ead1[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db[_0xaa0d('0xb7')][_0xaa0d('0x43')]);_0x25ead1[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x7b4c1d[_0xaa0d('0x4a')]);_0x25ead1['filters']=_[_0xaa0d('0x60')](_0x25ead1[_0xaa0d('0x46')],_0x25ead1['query']);_0x238dc7[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x25ead1[_0xaa0d('0x46')],qs['fields'](_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x238dc7['attributes']=_0x238dc7['attributes']['length']?_0x238dc7[_0xaa0d('0x4c')]:_0x25ead1[_0xaa0d('0x46')];_0x238dc7['order']=qs[_0xaa0d('0x50')](_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x238dc7[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_['pick'](_0x7b4c1d[_0xaa0d('0x4a')],_0x25ead1[_0xaa0d('0x52')]));if(_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x238dc7[_0xaa0d('0x51')]=_['merge'](_0x238dc7[_0xaa0d('0x51')],{'$or':_['map'](_0x238dc7[_0xaa0d('0x4c')],function(_0x234ab7){var _0x51021d={};_0x51021d[_0x234ab7]={'$like':'%'+_0x7b4c1d['query'][_0xaa0d('0x3a')]+'%'};return _0x51021d;})});}_0x238dc7=_['merge']({},_0x238dc7,_0x7b4c1d[_0xaa0d('0x58')]);return _0x4f2058[_0xaa0d('0xb6')](_0x238dc7);}})['then'](function(_0x5ad334){if(_0x5ad334){_0x20d8bb=_0x5ad334[_0xaa0d('0x4d')];if(_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0x4e')]('includeAll')){_0x238dc7[_0xaa0d('0xb8')]=[{'model':db[_0xaa0d('0xb9')],'as':_0xaa0d('0xba'),'required':![]},{'model':db[_0xaa0d('0xbb')],'as':_0xaa0d('0xbc'),'attributes':['id','name',_0xaa0d('0xbd')],'where':_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0xbe')]?{'id':_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0xbe')]}:undefined,'required':_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0xbe')]?!![]:![]}];}if(!_0x7b4c1d['query']['hasOwnProperty']('nolimit')){_0x238dc7[_0xaa0d('0x31')]=qs['limit'](_0x7b4c1d[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x238dc7[_0xaa0d('0x30')]=qs[_0xaa0d('0x30')](_0x7b4c1d['query'][_0xaa0d('0x30')]);}return _0x4f2058[_0xaa0d('0xb6')](_0x238dc7);}})[_0xaa0d('0x59')](function(_0x23959b){if(_0x23959b){return _0x23959b?{'count':_0x20d8bb,'rows':_0x23959b}:null;}})['then'](respondWithResult(_0x406d26,null))[_0xaa0d('0x5d')](handleError(_0x406d26,null));};exports[_0xaa0d('0xbf')]=function(_0x4a8af5,_0x490393,_0x25d647){var _0x2e6a36;var _0x5f034f;var _0x4200c2={};var _0x2f9830;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x4a8af5[_0xaa0d('0x66')]['id']},'attributes':['id',_0xaa0d('0x40'),'role']})['then'](handleEntityNotFound(_0x490393,null))['then'](function(_0xd73690){if(!utils[_0xaa0d('0x9a')](_0x4a8af5[_0xaa0d('0x4a')]['channel'])){throw new db[(_0xaa0d('0x1e'))]['ValidationError'](_0xaa0d('0x9b'));}_0x2e6a36=_0xd73690;var _0x772a35={};_0x772a35[_0xaa0d('0x46')]=_['keys'](db[_['capitalize'](_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x97')])+'Queue'][_0xaa0d('0x43')]);_0x772a35[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x4a8af5['query']);_0x772a35[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x772a35[_0xaa0d('0x46')],_0x772a35[_0xaa0d('0x4a')]);_0x4200c2[_0xaa0d('0x4c')]=_['intersection'](_0x772a35[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x4a8af5['query'][_0xaa0d('0x61')]));_0x4200c2[_0xaa0d('0x4c')]=_0x4200c2[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x4200c2[_0xaa0d('0x4c')]:_0x772a35['model'];_0x4200c2[_0xaa0d('0x4f')]=qs['sort'](_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x4200c2['where']=qs[_0xaa0d('0x52')](_['pick'](_0x4a8af5['query'],_0x772a35[_0xaa0d('0x52')]));if(_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x4200c2[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x4200c2[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x4200c2[_0xaa0d('0x4c')],function(_0xad7f08){var _0x1fb337={};_0x1fb337[_0xad7f08]={'$like':'%'+_0x4a8af5[_0xaa0d('0x4a')]['filter']+'%'};return _0x1fb337;})});}_0x4200c2=_[_0xaa0d('0x53')]({},_0x4200c2,_0x4a8af5[_0xaa0d('0x58')]);switch(_0x2e6a36['role']){case'admin':return db[_[_0xaa0d('0x9d')](_0x4a8af5['query'][_0xaa0d('0x97')])+_0xaa0d('0xc0')]['findAll'](_0x4200c2);case'user':case'agent':return _0x2e6a36[_0xaa0d('0x35')+_[_0xaa0d('0x9d')](_0x4a8af5[_0xaa0d('0x4a')]['channel'])+'Queues'](_0x4200c2);default:throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0xc1'));}})[_0xaa0d('0x59')](function(_0x40a15e){_0x2f9830=_0x40a15e['length'];if(!_0x4a8af5[_0xaa0d('0x4a')]['hasOwnProperty'](_0xaa0d('0xc2'))){_0x4200c2['limit']=qs['limit'](_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x4200c2[_0xaa0d('0x30')]=qs[_0xaa0d('0x30')](_0x4a8af5['query'][_0xaa0d('0x30')]);}switch(_0x2e6a36[_0xaa0d('0x3e')]){case'admin':return db[_[_0xaa0d('0x9d')](_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x97')])+_0xaa0d('0xc0')][_0xaa0d('0x5b')](_0x4200c2);case _0xaa0d('0x6a'):case _0xaa0d('0x38'):return _0x2e6a36[_0xaa0d('0x35')+_['capitalize'](_0x4a8af5[_0xaa0d('0x4a')][_0xaa0d('0x97')])+'Queues'](_0x4200c2);}})['then'](function(_0x4b97af){return{'count':_0x2f9830,'rows':_0x4b97af};})[_0xaa0d('0x59')](respondWithResult(_0x490393,null))['catch'](handleError(_0x490393,null));};exports['getVoiceQueuesRt']=function(_0x23beda,_0x296957,_0x4ffbb6){var _0x4b761f={};var _0x523b70={};var _0x47b932;var _0x46bc2a;return db['User'][_0xaa0d('0x8d')]({'where':{'id':_0x23beda[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x296957,null))[_0xaa0d('0x59')](function(_0x44831a){if(_0x44831a){_0x47b932=_0x44831a;_0x523b70[_0xaa0d('0x46')]=_['keys'](db[_0xaa0d('0xac')][_0xaa0d('0x43')]);_0x523b70['query']=_[_0xaa0d('0x4b')](_0x23beda['query']);_0x523b70['filters']=_[_0xaa0d('0x60')](_0x523b70[_0xaa0d('0x46')],_0x523b70[_0xaa0d('0x4a')]);_0x4b761f[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x523b70['model'],qs[_0xaa0d('0x61')](_0x23beda[_0xaa0d('0x4a')]['fields']));_0x4b761f[_0xaa0d('0x4c')]=_0x4b761f[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x4b761f[_0xaa0d('0x4c')]:_0x523b70[_0xaa0d('0x46')];_0x4b761f[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x23beda['query'][_0xaa0d('0x50')]);_0x4b761f[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x23beda[_0xaa0d('0x4a')],_0x523b70[_0xaa0d('0x52')]));if(_0x23beda[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x4b761f[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x4b761f['where'],{'$or':_['map'](_0x4b761f[_0xaa0d('0x4c')],function(_0x2f3659){var _0x5dfafe={};_0x5dfafe[_0x2f3659]={'$like':'%'+_0x23beda[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x5dfafe;})});}_0x4b761f=_[_0xaa0d('0x53')]({},_0x4b761f,_0x23beda[_0xaa0d('0x58')]);return _0x47b932['getVoiceQueuesRt'](_0x4b761f);}})['then'](function(_0x379a1e){if(_0x379a1e){_0x46bc2a=_0x379a1e['length'];if(!_0x23beda['query']['hasOwnProperty'](_0xaa0d('0xc2'))){_0x4b761f[_0xaa0d('0x31')]=qs['limit'](_0x23beda[_0xaa0d('0x4a')]['limit']);_0x4b761f['offset']=qs[_0xaa0d('0x30')](_0x23beda[_0xaa0d('0x4a')]['offset']);}return _0x47b932[_0xaa0d('0xc4')](_0x4b761f);}})[_0xaa0d('0x59')](function(_0x51c94a){if(_0x51c94a){return _0x51c94a?{'count':_0x46bc2a,'rows':_0x51c94a}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x296957,null))[_0xaa0d('0x5d')](handleError(_0x296957,null));};exports[_0xaa0d('0xc5')]=function(_0x3eb9ef,_0x59a6cb,_0x2cfd34){var _0x327dfc={};var _0x1334cc={};var _0x1e7ca9;var _0x48952e;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x3eb9ef[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x59a6cb,null))[_0xaa0d('0x59')](function(_0x472950){if(_0x472950){_0x1e7ca9=_0x472950;_0x1334cc[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db[_0xaa0d('0xc6')][_0xaa0d('0x43')]);_0x1334cc['query']=_[_0xaa0d('0x4b')](_0x3eb9ef['query']);_0x1334cc[_0xaa0d('0x52')]=_['intersection'](_0x1334cc[_0xaa0d('0x46')],_0x1334cc['query']);_0x327dfc[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x1334cc[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x3eb9ef['query'][_0xaa0d('0x61')]));_0x327dfc[_0xaa0d('0x4c')]=_0x327dfc[_0xaa0d('0x4c')]['length']?_0x327dfc[_0xaa0d('0x4c')]:_0x1334cc['model'];_0x327dfc[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x3eb9ef[_0xaa0d('0x4a')]['sort']);_0x327dfc[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_['pick'](_0x3eb9ef[_0xaa0d('0x4a')],_0x1334cc[_0xaa0d('0x52')]));if(_0x3eb9ef[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x327dfc[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x327dfc[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x327dfc[_0xaa0d('0x4c')],function(_0x2f391a){var _0x269ec0={};_0x269ec0[_0x2f391a]={'$like':'%'+_0x3eb9ef[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x269ec0;})});}_0x327dfc=_['merge']({},_0x327dfc,_0x3eb9ef[_0xaa0d('0x58')]);return _0x1e7ca9[_0xaa0d('0xc5')](_0x327dfc);}})[_0xaa0d('0x59')](function(_0x598401){if(_0x598401){_0x48952e=_0x598401[_0xaa0d('0x4d')];if(!_0x3eb9ef[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x327dfc[_0xaa0d('0x31')]=qs[_0xaa0d('0x31')](_0x3eb9ef[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x327dfc['offset']=qs['offset'](_0x3eb9ef['query'][_0xaa0d('0x30')]);}return _0x1e7ca9[_0xaa0d('0xc5')](_0x327dfc);}})[_0xaa0d('0x59')](function(_0x16a7bc){if(_0x16a7bc){return _0x16a7bc?{'count':_0x48952e,'rows':_0x16a7bc}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x59a6cb,null))['catch'](handleError(_0x59a6cb,null));};exports[_0xaa0d('0xc7')]=function(_0x5c45fa,_0x351ad7,_0x1252cb){var _0x5d2d86={'raw':!![],'where':{}};var _0x57a461={};var _0x311849={'count':0x0,'rows':[]};return db[_0xaa0d('0x42')]['findOne']({'where':{'id':_0x5c45fa[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x351ad7,null))[_0xaa0d('0x59')](function(_0x4a8ed9){if(_0x4a8ed9){_0x57a461[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db['VoiceRecording'][_0xaa0d('0x43')]);_0x57a461['query']=_[_0xaa0d('0x4b')](_0x5c45fa[_0xaa0d('0x4a')]);_0x57a461[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x57a461[_0xaa0d('0x46')],_0x57a461['query']);_0x5d2d86[_0xaa0d('0x4c')]=_['intersection'](_0x57a461[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x5d2d86['attributes']=_0x5d2d86[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x5d2d86[_0xaa0d('0x4c')]:_0x57a461[_0xaa0d('0x46')];if(!_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x4e')]('nolimit')){_0x5d2d86[_0xaa0d('0x31')]=qs[_0xaa0d('0x31')](_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x5d2d86[_0xaa0d('0x30')]=qs['offset'](_0x5c45fa[_0xaa0d('0x4a')]['offset']);}_0x5d2d86[_0xaa0d('0x4f')]=qs['sort'](_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x5d2d86[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x5c45fa['query'],_0x57a461[_0xaa0d('0x52')]));_0x5d2d86['where']['UserId']=_0x4a8ed9['id'];if(_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x5d2d86[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x5d2d86['where'],{'$or':_[_0xaa0d('0x47')](_0x5d2d86[_0xaa0d('0x4c')],function(_0x18c89a){var _0x16ef07={};_0x16ef07[_0x18c89a]={'$like':'%'+_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x16ef07;})});}_0x5d2d86=_[_0xaa0d('0x53')]({},_0x5d2d86,_0x5c45fa[_0xaa0d('0x58')]);return db['VoiceRecording']['count']({'where':_0x5d2d86[_0xaa0d('0x51')]})[_0xaa0d('0x59')](function(_0x757b0b){_0x311849[_0xaa0d('0x2f')]=_0x757b0b;if(_0x5c45fa[_0xaa0d('0x4a')][_0xaa0d('0x5a')]){_0x5d2d86['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xaa0d('0x5b')](_0x5d2d86);})[_0xaa0d('0x59')](function(_0x6835a0){_0x311849['rows']=_0x6835a0;return _0x311849;});}})[_0xaa0d('0x59')](respondWithFilteredResult(_0x351ad7,_0x5d2d86))[_0xaa0d('0x5d')](handleError(_0x351ad7,null));};exports['getScreenRecordings']=function(_0x407d4f,_0x3d2f33,_0x4f8ff5){var _0x1e486f={'raw':!![],'where':{}};var _0x9820db={};var _0x134b10={'count':0x0,'rows':[]};return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x407d4f['params']['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x3d2f33,null))[_0xaa0d('0x59')](function(_0x4bda16){if(_0x4bda16){_0x9820db[_0xaa0d('0x46')]=_['keys'](db[_0xaa0d('0xc8')][_0xaa0d('0x43')]);_0x9820db[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x407d4f[_0xaa0d('0x4a')]);_0x9820db[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x9820db[_0xaa0d('0x46')],_0x9820db[_0xaa0d('0x4a')]);_0x1e486f[_0xaa0d('0x4c')]=_['intersection'](_0x9820db['model'],qs[_0xaa0d('0x61')](_0x407d4f[_0xaa0d('0x4a')]['fields']));_0x1e486f[_0xaa0d('0x4c')]=_0x1e486f[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x1e486f[_0xaa0d('0x4c')]:_0x9820db[_0xaa0d('0x46')];if(!_0x407d4f[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x1e486f[_0xaa0d('0x31')]=qs[_0xaa0d('0x31')](_0x407d4f[_0xaa0d('0x4a')]['limit']);_0x1e486f['offset']=qs[_0xaa0d('0x30')](_0x407d4f[_0xaa0d('0x4a')][_0xaa0d('0x30')]);}_0x1e486f[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x407d4f[_0xaa0d('0x4a')]['sort']);_0x1e486f[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x407d4f[_0xaa0d('0x4a')],_0x9820db[_0xaa0d('0x52')]));_0x1e486f[_0xaa0d('0x51')][_0xaa0d('0xc9')]=_0x4bda16['id'];if(_0x407d4f[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x1e486f[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x1e486f[_0xaa0d('0x51')],{'$or':_['map'](_0x1e486f[_0xaa0d('0x4c')],function(_0x3fec75){var _0x27bfb9={};_0x27bfb9[_0x3fec75]={'$like':'%'+_0x407d4f[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x27bfb9;})});}_0x1e486f=_[_0xaa0d('0x53')]({},_0x1e486f,_0x407d4f[_0xaa0d('0x58')]);return db[_0xaa0d('0xc8')][_0xaa0d('0x2f')]({'where':_0x1e486f['where']})[_0xaa0d('0x59')](function(_0x49bdf4){_0x134b10['count']=_0x49bdf4;if(_0x407d4f[_0xaa0d('0x4a')][_0xaa0d('0x5a')]){_0x1e486f[_0xaa0d('0xb8')]=[{'all':!![]}];}return db[_0xaa0d('0xc8')]['findAll'](_0x1e486f);})['then'](function(_0x5b67c9){_0x134b10[_0xaa0d('0x5c')]=_0x5b67c9;return _0x134b10;});}})[_0xaa0d('0x59')](respondWithFilteredResult(_0x3d2f33,_0x1e486f))[_0xaa0d('0x5d')](handleError(_0x3d2f33,null));};exports[_0xaa0d('0xca')]=function(_0x208e2d,_0x354523,_0x32cbfc){var _0x2596cc={};var _0xb05a35={};var _0x50f278;var _0x24a406;return db['User'][_0xaa0d('0x8d')]({'where':{'id':_0x208e2d['params']['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x354523,null))[_0xaa0d('0x59')](function(_0x226128){if(_0x226128){_0x50f278=_0x226128;_0xb05a35[_0xaa0d('0x46')]=_['keys'](db[_0xaa0d('0xcb')][_0xaa0d('0x43')]);_0xb05a35[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x208e2d[_0xaa0d('0x4a')]);_0xb05a35['filters']=_[_0xaa0d('0x60')](_0xb05a35[_0xaa0d('0x46')],_0xb05a35[_0xaa0d('0x4a')]);_0x2596cc[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0xb05a35[_0xaa0d('0x46')],qs['fields'](_0x208e2d[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x2596cc['attributes']=_0x2596cc['attributes'][_0xaa0d('0x4d')]?_0x2596cc[_0xaa0d('0x4c')]:_0xb05a35[_0xaa0d('0x46')];_0x2596cc['order']=qs[_0xaa0d('0x50')](_0x208e2d[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x2596cc[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x208e2d[_0xaa0d('0x4a')],_0xb05a35[_0xaa0d('0x52')]));if(_0x208e2d['query'][_0xaa0d('0x3a')]){_0x2596cc[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x2596cc['where'],{'$or':_['map'](_0x2596cc[_0xaa0d('0x4c')],function(_0x3b9352){var _0x14b215={};_0x14b215[_0x3b9352]={'$like':'%'+_0x208e2d[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x14b215;})});}_0x2596cc=_[_0xaa0d('0x53')]({},_0x2596cc,_0x208e2d[_0xaa0d('0x58')]);return _0x50f278[_0xaa0d('0xca')](_0x2596cc);}})[_0xaa0d('0x59')](function(_0x5994a2){if(_0x5994a2){_0x24a406=_0x5994a2['length'];if(!_0x208e2d[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x2596cc[_0xaa0d('0x31')]=qs['limit'](_0x208e2d[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x2596cc['offset']=qs[_0xaa0d('0x30')](_0x208e2d[_0xaa0d('0x4a')]['offset']);}return _0x50f278[_0xaa0d('0xca')](_0x2596cc);}})[_0xaa0d('0x59')](function(_0x538d73){if(_0x538d73){return _0x538d73?{'count':_0x24a406,'rows':_0x538d73}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x354523,null))[_0xaa0d('0x5d')](handleError(_0x354523,null));};exports['getOpenchannelInteractions']=function(_0x5f1ca8,_0x48da82,_0x258f48){var _0x10bdab={};var _0x46ebbc={};var _0x40237d;var _0x5115a4;return db['User'][_0xaa0d('0x8d')]({'where':{'id':_0x5f1ca8[_0xaa0d('0x66')]['id']}})['then'](handleEntityNotFound(_0x48da82,null))['then'](function(_0x48784c){if(_0x48784c){_0x40237d=_0x48784c;_0x46ebbc[_0xaa0d('0x46')]=_['keys'](db[_0xaa0d('0xcc')][_0xaa0d('0x43')]);_0x46ebbc[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x5f1ca8['query']);_0x46ebbc[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x46ebbc[_0xaa0d('0x46')],_0x46ebbc[_0xaa0d('0x4a')]);_0x10bdab[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x46ebbc[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x5f1ca8[_0xaa0d('0x4a')]['fields']));_0x10bdab[_0xaa0d('0x4c')]=_0x10bdab[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x10bdab[_0xaa0d('0x4c')]:_0x46ebbc[_0xaa0d('0x46')];_0x10bdab[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x5f1ca8[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x10bdab[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x5f1ca8['query'],_0x46ebbc['filters']));if(_0x5f1ca8[_0xaa0d('0x4a')]['filter']){_0x10bdab[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x10bdab['where'],{'$or':_[_0xaa0d('0x47')](_0x10bdab[_0xaa0d('0x4c')],function(_0x3bd49f){var _0x14a764={};_0x14a764[_0x3bd49f]={'$like':'%'+_0x5f1ca8[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x14a764;})});}_0x10bdab=_['merge']({},_0x10bdab,_0x5f1ca8['options']);return _0x40237d[_0xaa0d('0xcd')](_0x10bdab);}})['then'](function(_0x59f8c0){if(_0x59f8c0){_0x5115a4=_0x59f8c0[_0xaa0d('0x4d')];if(!_0x5f1ca8[_0xaa0d('0x4a')][_0xaa0d('0x4e')]('nolimit')){_0x10bdab[_0xaa0d('0x31')]=qs['limit'](_0x5f1ca8['query']['limit']);_0x10bdab[_0xaa0d('0x30')]=qs[_0xaa0d('0x30')](_0x5f1ca8[_0xaa0d('0x4a')][_0xaa0d('0x30')]);}return _0x40237d[_0xaa0d('0xcd')](_0x10bdab);}})[_0xaa0d('0x59')](function(_0x1ef5b8){if(_0x1ef5b8){return _0x1ef5b8?{'count':_0x5115a4,'rows':_0x1ef5b8}:null;}})['then'](respondWithResult(_0x48da82,null))['catch'](handleError(_0x48da82,null));};exports[_0xaa0d('0xce')]=function(_0xebca1f,_0x463802,_0x57df18){var _0x4f92e4={'raw':!![],'where':{}};var _0x7e54f3={};var _0x22e5b6={'count':0x0,'rows':[]};return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0xebca1f['params']['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x463802,null))[_0xaa0d('0x59')](function(_0x5939c5){if(_0x5939c5){_0x7e54f3['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x7e54f3[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0xebca1f['query']);_0x7e54f3[_0xaa0d('0x52')]=_['intersection'](_0x7e54f3['model'],_0x7e54f3[_0xaa0d('0x4a')]);_0x4f92e4[_0xaa0d('0x4c')]=_['intersection'](_0x7e54f3['model'],qs[_0xaa0d('0x61')](_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x4f92e4['attributes']=_0x4f92e4['attributes']['length']?_0x4f92e4[_0xaa0d('0x4c')]:_0x7e54f3[_0xaa0d('0x46')];if(!_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x4f92e4['limit']=qs[_0xaa0d('0x31')](_0xebca1f['query'][_0xaa0d('0x31')]);_0x4f92e4[_0xaa0d('0x30')]=qs[_0xaa0d('0x30')](_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x30')]);}_0x4f92e4[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x4f92e4[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0xebca1f['query'],_0x7e54f3['filters']));_0x4f92e4['where']['UserId']=_0x5939c5['id'];if(_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x4f92e4[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x4f92e4[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x4f92e4['attributes'],function(_0x5d7255){var _0x226227={};_0x226227[_0x5d7255]={'$like':'%'+_0xebca1f[_0xaa0d('0x4a')]['filter']+'%'};return _0x226227;})});}_0x4f92e4=_[_0xaa0d('0x53')]({},_0x4f92e4,_0xebca1f['options']);return db[_0xaa0d('0xcf')][_0xaa0d('0x2f')]({'where':_0x4f92e4['where']})[_0xaa0d('0x59')](function(_0x27a4fd){_0x22e5b6[_0xaa0d('0x2f')]=_0x27a4fd;if(_0xebca1f[_0xaa0d('0x4a')][_0xaa0d('0x5a')]){_0x4f92e4['include']=[{'all':!![]}];}return db[_0xaa0d('0xcf')]['findAll'](_0x4f92e4);})[_0xaa0d('0x59')](function(_0x4726e2){_0x22e5b6['rows']=_0x4726e2;return _0x22e5b6;});}})['then'](respondWithFilteredResult(_0x463802,_0x4f92e4))[_0xaa0d('0x5d')](handleError(_0x463802,null));};exports['getSmsInteractions']=function(_0x36bd2b,_0x3ac42f,_0x3f212c){var _0x57106d={};var _0x8a4420={};var _0x52a5a8;var _0x1effe3;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x36bd2b[_0xaa0d('0x66')]['id']}})['then'](handleEntityNotFound(_0x3ac42f,null))[_0xaa0d('0x59')](function(_0x166cd7){if(_0x166cd7){_0x52a5a8=_0x166cd7;_0x8a4420['model']=_[_0xaa0d('0x4b')](db[_0xaa0d('0xd0')][_0xaa0d('0x43')]);_0x8a4420[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x36bd2b['query']);_0x8a4420['filters']=_[_0xaa0d('0x60')](_0x8a4420[_0xaa0d('0x46')],_0x8a4420['query']);_0x57106d[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x8a4420[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x57106d[_0xaa0d('0x4c')]=_0x57106d[_0xaa0d('0x4c')]['length']?_0x57106d[_0xaa0d('0x4c')]:_0x8a4420[_0xaa0d('0x46')];_0x57106d[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x57106d[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x36bd2b['query'],_0x8a4420[_0xaa0d('0x52')]));if(_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x57106d[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x57106d[_0xaa0d('0x51')],{'$or':_['map'](_0x57106d[_0xaa0d('0x4c')],function(_0x407396){var _0x588042={};_0x588042[_0x407396]={'$like':'%'+_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x588042;})});}_0x57106d=_['merge']({},_0x57106d,_0x36bd2b[_0xaa0d('0x58')]);return _0x52a5a8['getSmsInteractions'](_0x57106d);}})['then'](function(_0x1461c4){if(_0x1461c4){_0x1effe3=_0x1461c4['length'];if(!_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x57106d['limit']=qs[_0xaa0d('0x31')](_0x36bd2b[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x57106d[_0xaa0d('0x30')]=qs['offset'](_0x36bd2b['query'][_0xaa0d('0x30')]);}return _0x52a5a8[_0xaa0d('0xd1')](_0x57106d);}})[_0xaa0d('0x59')](function(_0x43bf6a){if(_0x43bf6a){return _0x43bf6a?{'count':_0x1effe3,'rows':_0x43bf6a}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x3ac42f,null))[_0xaa0d('0x5d')](handleError(_0x3ac42f,null));};exports['getFaxInteractions']=function(_0x3b9c08,_0x207b4d,_0x36a193){var _0x3a7dfc={};var _0x3918e7={};var _0x16e74c;var _0x54de0b;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x3b9c08[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x207b4d,null))[_0xaa0d('0x59')](function(_0x1a2e72){if(_0x1a2e72){_0x16e74c=_0x1a2e72;_0x3918e7[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db['FaxInteraction'][_0xaa0d('0x43')]);_0x3918e7[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x3b9c08[_0xaa0d('0x4a')]);_0x3918e7[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x3918e7[_0xaa0d('0x46')],_0x3918e7[_0xaa0d('0x4a')]);_0x3a7dfc[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x3918e7[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x3b9c08[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x3a7dfc[_0xaa0d('0x4c')]=_0x3a7dfc[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x3a7dfc[_0xaa0d('0x4c')]:_0x3918e7[_0xaa0d('0x46')];_0x3a7dfc['order']=qs[_0xaa0d('0x50')](_0x3b9c08['query']['sort']);_0x3a7dfc[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x3b9c08[_0xaa0d('0x4a')],_0x3918e7['filters']));if(_0x3b9c08[_0xaa0d('0x4a')]['filter']){_0x3a7dfc['where']=_[_0xaa0d('0x53')](_0x3a7dfc[_0xaa0d('0x51')],{'$or':_['map'](_0x3a7dfc[_0xaa0d('0x4c')],function(_0x372eee){var _0x36ec55={};_0x36ec55[_0x372eee]={'$like':'%'+_0x3b9c08[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x36ec55;})});}_0x3a7dfc=_[_0xaa0d('0x53')]({},_0x3a7dfc,_0x3b9c08['options']);return _0x16e74c[_0xaa0d('0xd2')](_0x3a7dfc);}})[_0xaa0d('0x59')](function(_0x1861be){if(_0x1861be){_0x54de0b=_0x1861be[_0xaa0d('0x4d')];if(!_0x3b9c08['query']['hasOwnProperty'](_0xaa0d('0xc2'))){_0x3a7dfc['limit']=qs[_0xaa0d('0x31')](_0x3b9c08['query']['limit']);_0x3a7dfc[_0xaa0d('0x30')]=qs[_0xaa0d('0x30')](_0x3b9c08[_0xaa0d('0x4a')][_0xaa0d('0x30')]);}return _0x16e74c['getFaxInteractions'](_0x3a7dfc);}})[_0xaa0d('0x59')](function(_0x5e08f3){if(_0x5e08f3){return _0x5e08f3?{'count':_0x54de0b,'rows':_0x5e08f3}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x207b4d,null))[_0xaa0d('0x5d')](handleError(_0x207b4d,null));};exports['getWhatsappInteractions']=function(_0x123be4,_0x3ad38d,_0x978bcd){var _0x21464c={};var _0x399a57={};var _0x15a567;var _0x558eb1;return db['User'][_0xaa0d('0x8d')]({'where':{'id':_0x123be4[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x3ad38d,null))[_0xaa0d('0x59')](function(_0x32867b){if(_0x32867b){_0x15a567=_0x32867b;_0x399a57[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db['WhatsappInteraction'][_0xaa0d('0x43')]);_0x399a57[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x123be4[_0xaa0d('0x4a')]);_0x399a57['filters']=_[_0xaa0d('0x60')](_0x399a57[_0xaa0d('0x46')],_0x399a57[_0xaa0d('0x4a')]);_0x21464c[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x399a57[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x123be4[_0xaa0d('0x4a')]['fields']));_0x21464c['attributes']=_0x21464c[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x21464c[_0xaa0d('0x4c')]:_0x399a57['model'];_0x21464c[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x123be4[_0xaa0d('0x4a')]['sort']);_0x21464c['where']=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x123be4['query'],_0x399a57[_0xaa0d('0x52')]));if(_0x123be4['query']['filter']){_0x21464c[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x21464c[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x21464c[_0xaa0d('0x4c')],function(_0x50fc7c){var _0x312a7b={};_0x312a7b[_0x50fc7c]={'$like':'%'+_0x123be4['query'][_0xaa0d('0x3a')]+'%'};return _0x312a7b;})});}_0x21464c=_[_0xaa0d('0x53')]({},_0x21464c,_0x123be4[_0xaa0d('0x58')]);return _0x15a567['getWhatsappInteractions'](_0x21464c);}})[_0xaa0d('0x59')](function(_0x2e0baa){if(_0x2e0baa){_0x558eb1=_0x2e0baa[_0xaa0d('0x4d')];if(!_0x123be4[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x21464c[_0xaa0d('0x31')]=qs['limit'](_0x123be4[_0xaa0d('0x4a')]['limit']);_0x21464c['offset']=qs[_0xaa0d('0x30')](_0x123be4['query'][_0xaa0d('0x30')]);}return _0x15a567[_0xaa0d('0xd3')](_0x21464c);}})['then'](function(_0x5f3f82){if(_0x5f3f82){return _0x5f3f82?{'count':_0x558eb1,'rows':_0x5f3f82}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x3ad38d,null))[_0xaa0d('0x5d')](handleError(_0x3ad38d,null));};exports[_0xaa0d('0xd4')]=function(_0x34c9e5,_0x5f1922,_0x370eea){var _0x21cf11;var _0x1fbe8f;var _0x4498e7;var _0x2024f5=!_['isNil'](_0x34c9e5['params']['id'])?_0x34c9e5[_0xaa0d('0x66')]['id']:!_[_0xaa0d('0x73')](_0x34c9e5['user']['id'])?_0x34c9e5[_0xaa0d('0x6a')]['id']:null;return db['User'][_0xaa0d('0x3f')]({'where':{'id':_0x2024f5,'role':{'$or':[_0xaa0d('0x94'),_0xaa0d('0x6a'),_0xaa0d('0x38')]}},'attributes':['id',_0xaa0d('0x40'),_0xaa0d('0xd5'),_0xaa0d('0xd6'),_0xaa0d('0x3e'),_0xaa0d('0x74'),_0xaa0d('0xd7')]})[_0xaa0d('0x59')](function(_0xe354c3){if(_0xe354c3){if(_0xe354c3[_0xaa0d('0x3e')]===_0xaa0d('0x38')){_0x21cf11=_0xe354c3;if(_0x34c9e5[_0xaa0d('0x63')]['interface']){_0x4498e7=util[_0xaa0d('0xa5')](_0xaa0d('0xd8'),_0x21cf11[_0x34c9e5[_0xaa0d('0x63')][_0xaa0d('0x99')]]);}else if(_0x34c9e5[_0xaa0d('0x63')]['intrf']){_0x4498e7=util['format'](_0xaa0d('0xa6'),_0x34c9e5['body']['intrf']);}else{_0x4498e7=util['format']('SIP/%s',_0x21cf11[_0xaa0d('0x40')]);}socket['to'](util[_0xaa0d('0xa5')]('user:%s',_0x21cf11[_0xaa0d('0x40')]))[_0xaa0d('0xa2')](_0xaa0d('0xd9'),{'ip':_0x34c9e5[_0xaa0d('0xda')][_0xaa0d('0xdb')]||_0x34c9e5['connection'][_0xaa0d('0xdc')]||_0x34c9e5['socket'][_0xaa0d('0xdc')]||_0x34c9e5[_0xaa0d('0xdd')][_0xaa0d('0xde')][_0xaa0d('0xdc')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x21cf11[_0xaa0d('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))](_0xaa0d('0xdf'));}})['then'](function(){if(_0x21cf11){return _0x21cf11['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x1553b4){if(_0x21cf11){var _0x4e8b8b=[];if(_0x1553b4){_0x1fbe8f=_0x1553b4;if(_0x1fbe8f[_0xaa0d('0x4d')]){for(var _0x2425a0=0x0;_0x2425a0<_0x1fbe8f[_0xaa0d('0x4d')];_0x2425a0++){_0x4e8b8b['push']({'membername':_0x21cf11[_0xaa0d('0x40')],'UserId':_0x21cf11['id'],'queue_name':_0x1fbe8f[_0x2425a0][_0xaa0d('0x40')],'VoiceQueueId':_0x1fbe8f[_0x2425a0]['id'],'interface':_0x4498e7,'paused':_0x21cf11[_0xaa0d('0xd7')]||![],'penalty':_0x1fbe8f[_0x2425a0][_0xaa0d('0xe0')]||0x0});}return BPromise[_0xaa0d('0xe1')](_0x4e8b8b,function(_0x5d1919){return db[_0xaa0d('0xac')]['upsert'](_0x5d1919);});}}}})[_0xaa0d('0x59')](function(){if(_0x21cf11){return db[_0xaa0d('0xe2')][_0xaa0d('0x5b')]({'where':{'membername':_0x21cf11[_0xaa0d('0x40')],'exitAt':null}});}})[_0xaa0d('0x59')](function(_0x481cef){if(_0x21cf11){var _0x51a5e5=[];_0x481cef['forEach'](function(_0x2f4912){_0x51a5e5[_0xaa0d('0xe3')](_0x2f4912[_0xaa0d('0xe4')]({'exitAt':moment()[_0xaa0d('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xaa0d('0xe5')](_0x51a5e5);}})['then'](function(){if(_0x21cf11){var _0x5193b7=[];var _0x1bf99e=[];var _0x3bbe2a=utils[_0xaa0d('0xe6')]();var _0x8fb666={'membername':_0x21cf11[_0xaa0d('0x40')],'interface':_0x4498e7,'enterAt':moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7')),'role':_0x21cf11[_0xaa0d('0x3e')],'internal':_0x21cf11[_0xaa0d('0x74')]};_0x3bbe2a['forEach'](function(_0x1a882d){_0x5193b7['push'](_[_0xaa0d('0x53')]({'channel':_0x1a882d,'type':_0xaa0d('0xe8'),'data1':_0x34c9e5[_0xaa0d('0x63')]['device'],'data2':_0x4498e7},_0x8fb666));if(_0x21cf11[_0xaa0d('0xd7')]){_0x1bf99e['push'](_[_0xaa0d('0x53')]({'channel':_0x1a882d,'type':_0xaa0d('0xe9'),'data1':_0xaa0d('0xea')},_0x8fb666));}});return db[_0xaa0d('0xe2')][_0xaa0d('0x62')](_0x5193b7[_0xaa0d('0xeb')](_0x1bf99e),{'individualHooks':!![]});}})['then'](function(){if(_0x21cf11){return _0x21cf11[_0xaa0d('0xe4')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x21cf11[_0xaa0d('0xd7')]||![],'mailPause':_0x21cf11['loginInPause']||![],'chatPause':_0x21cf11[_0xaa0d('0xd7')]||![],'faxPause':_0x21cf11[_0xaa0d('0xd7')]||![],'smsPause':_0x21cf11['loginInPause']||![],'openchannelPause':_0x21cf11[_0xaa0d('0xd7')]||![],'whatsappPause':_0x21cf11[_0xaa0d('0xd7')]||![],'pauseType':_0x21cf11[_0xaa0d('0xd7')]?_0xaa0d('0xea'):null,'interface':_0x4498e7,'lastPauseAt':moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7'))});}})[_0xaa0d('0x59')](function(_0x303c54){if(_0x34c9e5[_0xaa0d('0xec')]){return _0x370eea();}else{return BPromise[_0xaa0d('0xed')](_0x303c54)[_0xaa0d('0x59')](respondWithResult(_0x5f1922,null));}})[_0xaa0d('0x5d')](handleError(_0x5f1922,null));};exports['logout']=function(_0x326ac3,_0x53fae2,_0x11e027){var _0x32e3c2;return db[_0xaa0d('0x42')]['find']({'where':{'id':_0x326ac3[_0xaa0d('0x66')]['id'],'role':_0xaa0d('0x38')},'attributes':['id',_0xaa0d('0x40'),'role']})[_0xaa0d('0x59')](handleEntityNotFound(_0x53fae2,null))[_0xaa0d('0x59')](function(_0x185133){if(_0x185133){_0x32e3c2=_0x185133;return db[_0xaa0d('0xac')][_0xaa0d('0x34')]({'where':{'membername':_0x32e3c2[_0xaa0d('0x40')]},'individualHooks':!![]});}})[_0xaa0d('0x59')](function(){return db[_0xaa0d('0xe2')][_0xaa0d('0x5b')]({'where':{'membername':_0x32e3c2['name'],'exitAt':null}});})[_0xaa0d('0x59')](function(_0x39c347){var _0x365a19=[];_0x39c347[_0xaa0d('0xee')](function(_0x396c82){_0x365a19[_0xaa0d('0xe3')](_0x396c82[_0xaa0d('0xe4')]({'exitAt':moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7'))}));});return BPromise[_0xaa0d('0xe5')](_0x365a19);})[_0xaa0d('0x59')](function(){return _0x32e3c2[_0xaa0d('0xe4')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xaa0d('0x59')](respondWithResult(_0x53fae2,null))[_0xaa0d('0x5d')](handleError(_0x53fae2,null));};exports[_0xaa0d('0xef')]=function(_0xaae2ed,_0x51a161,_0xd08d3e){var _0x5cdb58;return db[_0xaa0d('0xac')][_0xaa0d('0xe4')]({'paused':0x1},{'where':{'UserId':_0xaae2ed[_0xaa0d('0x66')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0xaae2ed[_0xaa0d('0x66')]['id'],'role':'agent'},'attributes':['id',_0xaa0d('0x40'),'role',_0xaa0d('0x74'),_0xaa0d('0x99')]});})['then'](handleEntityNotFound(_0x51a161,null))['then'](function(_0x41b0ad){if(_0x41b0ad){_0x5cdb58=_0x41b0ad;return respondWithRpcPromise(_0xaa0d('0xf0'),_0xaa0d('0xef'),{'id':_0x5cdb58['id'],'name':_0x5cdb58[_0xaa0d('0x40')],'pause':!![]});}})[_0xaa0d('0x59')](function(){if(_0x5cdb58){return db[_0xaa0d('0xe2')][_0xaa0d('0x5b')]({'where':{'membername':_0x5cdb58[_0xaa0d('0x40')],'type':_0xaa0d('0xe9'),'exitAt':null}});}})['then'](function(_0x28ad7b){if(_0x28ad7b[_0xaa0d('0x4d')]){var _0x30e79c=moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7'));for(var _0x1f1503=0x0,_0x2d6d4e=_0x28ad7b[_0xaa0d('0x4d')];_0x1f1503<_0x2d6d4e;_0x1f1503++){_0x28ad7b[_0x1f1503][_0xaa0d('0xf1')]({'exitAt':_0x30e79c});}}})[_0xaa0d('0x59')](function(){var _0x42821e=[];var _0xb9dc12=utils['getChannels']();_0xb9dc12[_0xaa0d('0xee')](function(_0x3372b9){_0x42821e[_0xaa0d('0xe3')]({'channel':_0x3372b9,'membername':_0x5cdb58[_0xaa0d('0x40')],'interface':_['isNil'](_0x5cdb58[_0xaa0d('0x99')])?util['format'](_0xaa0d('0xa6'),_0x5cdb58[_0xaa0d('0x40')]):_0x5cdb58['interface'],'type':'PAUSE','enterAt':moment()['format'](_0xaa0d('0xe7')),'data1':_0xaae2ed[_0xaa0d('0x63')][_0xaa0d('0x45')]||_0xaa0d('0xf2'),'role':_0x5cdb58[_0xaa0d('0x3e')],'internal':_0x5cdb58[_0xaa0d('0x74')]});});return db[_0xaa0d('0xe2')][_0xaa0d('0x62')](_0x42821e,{'individualHooks':!![]});})[_0xaa0d('0x59')](function(){return _0x5cdb58[_0xaa0d('0xe4')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xaae2ed[_0xaa0d('0x63')]['type']||_0xaa0d('0xf2'),'lastPauseAt':moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7'))});})[_0xaa0d('0x59')](respondWithResult(_0x51a161,null))['catch'](handleError(_0x51a161,null));};exports[_0xaa0d('0xf3')]=function(_0x701a1d,_0x5656fb,_0x2e8d22){var _0x59c499;return db['User']['find']({'where':{'id':_0x701a1d['params']['id']},'attributes':['id','name',_0xaa0d('0x3e'),'voicePause',_0xaa0d('0xf4'),'chatPause',_0xaa0d('0xf5'),'openchannelPause',_0xaa0d('0xf6'),_0xaa0d('0xf7'),_0xaa0d('0xf8'),'lastPauseAt']})[_0xaa0d('0x59')](handleEntityNotFound(_0x5656fb,null))['then'](function(_0x186c3a){if(_0x186c3a){_0x59c499=_0x186c3a;if(_0x701a1d['body']['channel']&&!utils[_0xaa0d('0x9a')](_0x701a1d['body'][_0xaa0d('0x97')])){throw new db[(_0xaa0d('0x1e'))][(_0xaa0d('0x1f'))]('Unknown\x20channel');}switch(_0x701a1d[_0xaa0d('0x63')][_0xaa0d('0x97')]){case'voice':return respondWithRpcPromise(_0xaa0d('0xf0'),'unpause',{'id':_0x59c499['id'],'name':_0x59c499[_0xaa0d('0x40')],'pause':![]})[_0xaa0d('0x59')](function(){return db['UserVoiceQueueRt'][_0xaa0d('0xe4')]({'paused':0x0},{'where':{'UserId':_0x59c499['id']},'individualHooks':!![]});})[_0xaa0d('0x59')](function(){return db[_0xaa0d('0xe2')][_0xaa0d('0x3f')]({'where':{'channel':_0x701a1d[_0xaa0d('0x63')][_0xaa0d('0x97')],'membername':_0x59c499['name'],'type':_0xaa0d('0xe9'),'exitAt':null}});})[_0xaa0d('0x59')](function(_0xfd6589){if(_0xfd6589){return _0xfd6589[_0xaa0d('0xe4')]({'exitAt':moment()[_0xaa0d('0xa5')](_0xaa0d('0xe7')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x59c499[_0xaa0d('0xe4')]({'voicePause':![]});});case _0xaa0d('0xf9'):case _0xaa0d('0xfa'):case _0xaa0d('0xfb'):case'sms':case _0xaa0d('0xfc'):case'openchannel':return db['MemberReport'][_0xaa0d('0x3f')]({'where':{'channel':_0x701a1d['body'][_0xaa0d('0x97')],'membername':_0x59c499['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x5d3cd1){if(_0x5d3cd1){return _0x5d3cd1[_0xaa0d('0xe4')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xaa0d('0x59')](function(){var _0x1f5e9f={};_['set'](_0x1f5e9f,util[_0xaa0d('0xa5')](_0xaa0d('0xfd'),_0x701a1d['body'][_0xaa0d('0x97')],_0xaa0d('0xfe')),![]);return _0x59c499['update'](_0x1f5e9f);});default:return respondWithRpcPromise('QueuePause',_0xaa0d('0xf3'),{'id':_0x59c499['id'],'name':_0x59c499['name'],'pause':![]})[_0xaa0d('0x59')](function(){return db[_0xaa0d('0xac')][_0xaa0d('0xe4')]({'paused':0x0},{'where':{'UserId':_0x59c499['id']}});})[_0xaa0d('0x59')](function(){return db['MemberReport'][_0xaa0d('0x5b')]({'where':{'membername':_0x59c499[_0xaa0d('0x40')],'type':_0xaa0d('0xe9'),'exitAt':null}});})[_0xaa0d('0x59')](function(_0x5c89e3){var _0x3cf6f3=[];_0x5c89e3[_0xaa0d('0xee')](function(_0x9eb53d){_0x3cf6f3[_0xaa0d('0xe3')](_0x9eb53d[_0xaa0d('0xe4')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xaa0d('0xff')}));});return BPromise[_0xaa0d('0xe5')](_0x3cf6f3);})[_0xaa0d('0x59')](function(){return _0x59c499[_0xaa0d('0xe4')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xaa0d('0x59')](respondWithResult(_0x5656fb,null))[_0xaa0d('0x5d')](handleError(_0x5656fb,null));};exports['getTeams']=function(_0x3ee94d,_0x42594c,_0x56a321){var _0x5af86e={};var _0x40d7b5={};var _0x5b4764;var _0x50b71f;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x3ee94d[_0xaa0d('0x66')]['id']}})['then'](handleEntityNotFound(_0x42594c,null))[_0xaa0d('0x59')](function(_0x311af5){if(_0x311af5){_0x5b4764=_0x311af5;_0x40d7b5[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db[_0xaa0d('0x100')][_0xaa0d('0x43')]);_0x40d7b5[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x3ee94d['query']);_0x40d7b5[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x40d7b5[_0xaa0d('0x46')],_0x40d7b5[_0xaa0d('0x4a')]);_0x5af86e[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x40d7b5[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x5af86e[_0xaa0d('0x4c')]=_0x5af86e['attributes'][_0xaa0d('0x4d')]?_0x5af86e[_0xaa0d('0x4c')]:_0x40d7b5[_0xaa0d('0x46')];_0x5af86e[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x5af86e[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_['pick'](_0x3ee94d['query'],_0x40d7b5[_0xaa0d('0x52')]));if(_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x5af86e[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x5af86e['where'],{'$or':_[_0xaa0d('0x47')](_0x5af86e[_0xaa0d('0x4c')],function(_0x151a56){var _0x5232c8={};_0x5232c8[_0x151a56]={'$like':'%'+_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x3a')]+'%'};return _0x5232c8;})});}_0x5af86e=_[_0xaa0d('0x53')]({},_0x5af86e,_0x3ee94d[_0xaa0d('0x58')]);return _0x5b4764['getTeams'](_0x5af86e);}})[_0xaa0d('0x59')](function(_0x27e74f){if(_0x27e74f){_0x50b71f=_0x27e74f['length'];if(!_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x4e')](_0xaa0d('0xc2'))){_0x5af86e[_0xaa0d('0x31')]=qs[_0xaa0d('0x31')](_0x3ee94d[_0xaa0d('0x4a')][_0xaa0d('0x31')]);_0x5af86e['offset']=qs[_0xaa0d('0x30')](_0x3ee94d[_0xaa0d('0x4a')]['offset']);}return _0x5b4764[_0xaa0d('0x101')](_0x5af86e);}})[_0xaa0d('0x59')](function(_0x3a7b6c){if(_0x3a7b6c){return _0x3a7b6c?{'count':_0x50b71f,'rows':_0x3a7b6c}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x42594c,null))[_0xaa0d('0x5d')](handleError(_0x42594c,null));};exports[_0xaa0d('0x102')]=function(_0x40a2b7,_0x4a3e16){return db[_0xaa0d('0x42')][_0xaa0d('0x3f')]({'where':{'id':_0x40a2b7[_0xaa0d('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a3e16,null))[_0xaa0d('0x59')](function(_0x1607d1){if(_0x1607d1){var _0x39bbe7=_0x1607d1['get']({'plain':!![]});return _0x1607d1[_0xaa0d('0x102')](_0x40a2b7[_0xaa0d('0x63')]['ids'],_[_0xaa0d('0x68')](_0x40a2b7['body'],[_0xaa0d('0x67'),'id'])||{})['then'](function(){for(var _0x444870=0x0;_0x444870<_0x40a2b7[_0xaa0d('0x63')][_0xaa0d('0x67')][_0xaa0d('0x4d')];_0x444870++){var _0x2112fc=[];db['Team'][_0xaa0d('0x8d')]({'where':{'id':_0x40a2b7[_0xaa0d('0x63')][_0xaa0d('0x67')][_0x444870]}})[_0xaa0d('0x59')](function(_0x17db64){_0x2112fc[_0xaa0d('0xe3')](_0x17db64[_0xaa0d('0x103')]()[_0xaa0d('0x59')](function(_0x5c0c6b){for(var _0x5cab41=0x0;_0x5cab41<_0x5c0c6b[_0xaa0d('0x4d')];_0x5cab41++){_0x5c0c6b[_0x5cab41][_0xaa0d('0x104')](_0xaa0d('0x97'),'Voice');}return _0x5c0c6b;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64[_0xaa0d('0x105')]()[_0xaa0d('0x59')](function(_0x471cb2){for(var _0x4cb8a0=0x0;_0x4cb8a0<_0x471cb2[_0xaa0d('0x4d')];_0x4cb8a0++){_0x471cb2[_0x4cb8a0]['setDataValue'](_0xaa0d('0x97'),_0xaa0d('0x106'));}return _0x471cb2;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64['getMailQueues']()[_0xaa0d('0x59')](function(_0x1334b8){for(var _0x21e705=0x0;_0x21e705<_0x1334b8[_0xaa0d('0x4d')];_0x21e705++){_0x1334b8[_0x21e705][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x107'));}return _0x1334b8;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64['getSmsQueues']()[_0xaa0d('0x59')](function(_0x492a0f){for(var _0x5672d9=0x0;_0x5672d9<_0x492a0f[_0xaa0d('0x4d')];_0x5672d9++){_0x492a0f[_0x5672d9]['setDataValue'](_0xaa0d('0x97'),'Sms');}return _0x492a0f;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64['getWhatsappQueues']()[_0xaa0d('0x59')](function(_0x44cdc8){for(var _0x5091d5=0x0;_0x5091d5<_0x44cdc8[_0xaa0d('0x4d')];_0x5091d5++){_0x44cdc8[_0x5091d5][_0xaa0d('0x104')](_0xaa0d('0x97'),'Whatsapp');}return _0x44cdc8;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64[_0xaa0d('0x108')]()[_0xaa0d('0x59')](function(_0x4dd962){for(var _0x3bb38c=0x0;_0x3bb38c<_0x4dd962[_0xaa0d('0x4d')];_0x3bb38c++){_0x4dd962[_0x3bb38c][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x109'));}return _0x4dd962;}));_0x2112fc[_0xaa0d('0xe3')](_0x17db64[_0xaa0d('0x10a')]()[_0xaa0d('0x59')](function(_0x58c0b1){for(var _0x2a38b9=0x0;_0x2a38b9<_0x58c0b1[_0xaa0d('0x4d')];_0x2a38b9++){_0x58c0b1[_0x2a38b9][_0xaa0d('0x104')]('channel',_0xaa0d('0x10b'));}return _0x58c0b1;}));return BPromise[_0xaa0d('0xe5')](_0x2112fc);})[_0xaa0d('0x59')](function(_0x3a26c9){var _0x8afda8=_[_0xaa0d('0x10c')](_0x3a26c9);_0x2112fc=[];return db[_0xaa0d('0x55')]['transaction'](function(_0x18af19){for(var _0xaa8486=0x0;_0xaa8486<_0x8afda8[_0xaa0d('0x4d')];_0xaa8486++){_0x2112fc[_0xaa0d('0xe3')](_0x8afda8[_0xaa8486]['addAgent'](_0x39bbe7['id']),{'transaction':_0x18af19});}return BPromise[_0xaa0d('0xe5')](_0x2112fc)[_0xaa0d('0x59')](function(){if(_0x39bbe7[_0xaa0d('0x98')]){return BPromise[_0xaa0d('0xe1')](_[_0xaa0d('0x3a')](_0x8afda8,function(_0x4cbeed){return _0x4cbeed[_0xaa0d('0x10d')](_0xaa0d('0x97'))===_0xaa0d('0x10e');}),function(_0x516862){return db[_0xaa0d('0xac')][_0xaa0d('0xa8')]({'membername':_0x39bbe7[_0xaa0d('0x40')],'UserId':_0x39bbe7['id'],'queue_name':_0x516862[_0xaa0d('0x40')],'VoiceQueueId':_0x516862['id'],'interface':_[_0xaa0d('0x73')](_0x39bbe7['interface'])?util['format'](_0xaa0d('0xa6'),_0x39bbe7[_0xaa0d('0x40')]):_0x39bbe7[_0xaa0d('0x99')],'paused':_0x39bbe7[_0xaa0d('0xa7')]||![],'penalty':_0x39bbe7[_0xaa0d('0x9f')]},{'transaction':_0x18af19});});}else{return;}})['then'](function(){for(var _0x3a0c34=0x0;_0x3a0c34<_0x8afda8['length'];_0x3a0c34++){var _0x384e27=_0x8afda8[_0x3a0c34][_0xaa0d('0x10d')](_0xaa0d('0x97'));var _0x17d04e=_0x384e27+_0xaa0d('0xa1');socket[_0xaa0d('0xa2')]('user'+_0x384e27+_0xaa0d('0x10f'),{'UserId':_0x39bbe7['id'],['queueField']:_0x8afda8[_0x3a0c34]['id']});}});});});}});}})[_0xaa0d('0x59')](respondWithStatusCode(_0x4a3e16,null))['catch'](handleError(_0x4a3e16,null));};exports[_0xaa0d('0x110')]=function(_0x1a72dd,_0x414dc7){return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x1a72dd[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x414dc7,null))[_0xaa0d('0x59')](function(_0x6d0aa8){if(_0x6d0aa8){var _0x58c564=_0x6d0aa8['get']({'plain':!![]});var _0x4da6aa=_0x1a72dd[_0xaa0d('0x4a')][_0xaa0d('0x67')];return _0x6d0aa8[_0xaa0d('0x110')](_0x4da6aa)[_0xaa0d('0x59')](function(){for(var _0x1922a0=0x0;_0x1922a0<_0x4da6aa[_0xaa0d('0x4d')];_0x1922a0++){var _0x18c778=[];db['Team']['findOne']({'where':{'id':_0x4da6aa[_0x1922a0]}})[_0xaa0d('0x59')](function(_0x238652){_0x18c778[_0xaa0d('0xe3')](_0x238652['getVoiceQueues']()['then'](function(_0x5716b1){for(var _0xd3a740=0x0;_0xd3a740<_0x5716b1['length'];_0xd3a740++){_0x5716b1[_0xd3a740][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x10e'));}return _0x5716b1;}));_0x18c778[_0xaa0d('0xe3')](_0x238652['getChatQueues']()[_0xaa0d('0x59')](function(_0x352209){for(var _0x2a5718=0x0;_0x2a5718<_0x352209[_0xaa0d('0x4d')];_0x2a5718++){_0x352209[_0x2a5718][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x106'));}return _0x352209;}));_0x18c778[_0xaa0d('0xe3')](_0x238652[_0xaa0d('0x111')]()['then'](function(_0xdd2db4){for(var _0x3143d3=0x0;_0x3143d3<_0xdd2db4[_0xaa0d('0x4d')];_0x3143d3++){_0xdd2db4[_0x3143d3]['setDataValue'](_0xaa0d('0x97'),'Mail');}return _0xdd2db4;}));_0x18c778[_0xaa0d('0xe3')](_0x238652[_0xaa0d('0x112')]()[_0xaa0d('0x59')](function(_0x28b40d){for(var _0x3c2fe4=0x0;_0x3c2fe4<_0x28b40d['length'];_0x3c2fe4++){_0x28b40d[_0x3c2fe4][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x113'));}return _0x28b40d;}));_0x18c778[_0xaa0d('0xe3')](_0x238652[_0xaa0d('0x114')]()['then'](function(_0x562d41){for(var _0x5dcbc1=0x0;_0x5dcbc1<_0x562d41[_0xaa0d('0x4d')];_0x5dcbc1++){_0x562d41[_0x5dcbc1]['setDataValue']('channel',_0xaa0d('0x115'));}return _0x562d41;}));_0x18c778[_0xaa0d('0xe3')](_0x238652[_0xaa0d('0x108')]()['then'](function(_0x2b66b0){for(var _0x53cd8d=0x0;_0x53cd8d<_0x2b66b0[_0xaa0d('0x4d')];_0x53cd8d++){_0x2b66b0[_0x53cd8d][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x109'));}return _0x2b66b0;}));_0x18c778[_0xaa0d('0xe3')](_0x238652[_0xaa0d('0x10a')]()[_0xaa0d('0x59')](function(_0x3daa0f){for(var _0x465dc2=0x0;_0x465dc2<_0x3daa0f[_0xaa0d('0x4d')];_0x465dc2++){_0x3daa0f[_0x465dc2][_0xaa0d('0x104')](_0xaa0d('0x97'),_0xaa0d('0x10b'));}return _0x3daa0f;}));return BPromise[_0xaa0d('0xe5')](_0x18c778);})[_0xaa0d('0x59')](function(_0x740a00){var _0x58cffe=_[_0xaa0d('0x10c')](_0x740a00);_0x18c778=[];return db[_0xaa0d('0x55')][_0xaa0d('0x116')](function(_0x2799dc){for(var _0x232633=0x0;_0x232633<_0x58cffe[_0xaa0d('0x4d')];_0x232633++){_0x18c778[_0xaa0d('0xe3')](_0x58cffe[_0x232633][_0xaa0d('0x117')](_0x58c564['id']),{'transaction':_0x2799dc});}return BPromise[_0xaa0d('0xe5')](_0x18c778)[_0xaa0d('0x59')](function(){if(_0x58c564[_0xaa0d('0x98')]){return BPromise[_0xaa0d('0xe1')](_[_0xaa0d('0x3a')](_0x58cffe,function(_0xbc3571){return _0xbc3571[_0xaa0d('0x10d')](_0xaa0d('0x97'))==='Voice';}),function(_0xb0853c){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xb0853c['id'],'UserId':_0x58c564['id']},'transaction':_0x2799dc});});}else{return;}})['then'](function(){for(var _0x4d6077=0x0;_0x4d6077<_0x58cffe[_0xaa0d('0x4d')];_0x4d6077++){var _0x3be722=_0x58cffe[_0x4d6077][_0xaa0d('0x10d')](_0xaa0d('0x97'));var _0x55c58b=_0x3be722+_0xaa0d('0xa1');socket[_0xaa0d('0xa2')](_0xaa0d('0x6a')+_0x3be722+_0xaa0d('0xab'),{'UserId':_0x58c564['id'],['queueField']:_0x58cffe[_0x4d6077]['id']});}});});});}});}})[_0xaa0d('0x59')](respondWithStatusCode(_0x414dc7,null))[_0xaa0d('0x5d')](handleError(_0x414dc7,null));};exports['getLists']=function(_0x3c9f55,_0x41bd69,_0x37b569){var _0x55427c={};var _0x567935={};var _0x360a0f;var _0x1580bf;return db[_0xaa0d('0x42')]['findOne']({'where':{'id':_0x3c9f55[_0xaa0d('0x66')]['id']}})[_0xaa0d('0x59')](handleEntityNotFound(_0x41bd69,null))[_0xaa0d('0x59')](function(_0x3eb521){if(_0x3eb521){_0x360a0f=_0x3eb521;_0x567935[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db['CmList']['rawAttributes']);_0x567935[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x3c9f55['query']);_0x567935[_0xaa0d('0x52')]=_['intersection'](_0x567935[_0xaa0d('0x46')],_0x567935[_0xaa0d('0x4a')]);_0x55427c[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x567935['model'],qs[_0xaa0d('0x61')](_0x3c9f55[_0xaa0d('0x4a')][_0xaa0d('0x61')]));_0x55427c[_0xaa0d('0x4c')]=_0x55427c[_0xaa0d('0x4c')][_0xaa0d('0x4d')]?_0x55427c[_0xaa0d('0x4c')]:_0x567935[_0xaa0d('0x46')];_0x55427c[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x3c9f55[_0xaa0d('0x4a')][_0xaa0d('0x50')]);_0x55427c['where']=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x3c9f55[_0xaa0d('0x4a')],_0x567935[_0xaa0d('0x52')]));if(_0x3c9f55['query'][_0xaa0d('0x3a')]){_0x55427c[_0xaa0d('0x51')]=_['merge'](_0x55427c[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x55427c[_0xaa0d('0x4c')],function(_0xdfe66c){var _0x4e41a3={};_0x4e41a3[_0xdfe66c]={'$like':'%'+_0x3c9f55[_0xaa0d('0x4a')]['filter']+'%'};return _0x4e41a3;})});}_0x55427c=_[_0xaa0d('0x53')]({},_0x55427c,_0x3c9f55[_0xaa0d('0x58')]);return _0x360a0f[_0xaa0d('0x118')](_0x55427c);}})[_0xaa0d('0x59')](function(_0x5800a4){if(_0x5800a4){_0x1580bf=_0x5800a4[_0xaa0d('0x4d')];if(!_0x3c9f55['query']['hasOwnProperty'](_0xaa0d('0xc2'))){_0x55427c['limit']=qs['limit'](_0x3c9f55[_0xaa0d('0x4a')]['limit']);_0x55427c[_0xaa0d('0x30')]=qs['offset'](_0x3c9f55['query'][_0xaa0d('0x30')]);}return _0x360a0f[_0xaa0d('0x118')](_0x55427c);}})['then'](function(_0x43f1fa){if(_0x43f1fa){return _0x43f1fa?{'count':_0x1580bf,'rows':_0x43f1fa}:null;}})[_0xaa0d('0x59')](respondWithResult(_0x41bd69,null))[_0xaa0d('0x5d')](handleError(_0x41bd69,null));};exports[_0xaa0d('0x119')]=function(_0x255b29,_0x5e9464,_0x448953){var _0x23fcdc={};var _0x59376b={};var _0xfe238a;var _0x53f88a;return db[_0xaa0d('0x42')][_0xaa0d('0x8d')]({'where':{'id':_0x255b29['params']['id']}})['then'](handleEntityNotFound(_0x5e9464,null))[_0xaa0d('0x59')](function(_0x3ef1d7){if(_0x3ef1d7){_0xfe238a=_0x3ef1d7;_0x59376b[_0xaa0d('0x46')]=_[_0xaa0d('0x4b')](db[_0xaa0d('0x42')][_0xaa0d('0x43')]);_0x59376b[_0xaa0d('0x4a')]=_[_0xaa0d('0x4b')](_0x255b29[_0xaa0d('0x4a')]);_0x59376b[_0xaa0d('0x52')]=_[_0xaa0d('0x60')](_0x59376b[_0xaa0d('0x46')],_0x59376b[_0xaa0d('0x4a')]);_0x23fcdc[_0xaa0d('0x4c')]=_[_0xaa0d('0x60')](_0x59376b[_0xaa0d('0x46')],qs[_0xaa0d('0x61')](_0x255b29[_0xaa0d('0x4a')]['fields']));_0x23fcdc[_0xaa0d('0x4c')]=_0x23fcdc['attributes'][_0xaa0d('0x4d')]?_0x23fcdc[_0xaa0d('0x4c')]:_0x59376b[_0xaa0d('0x46')];_0x23fcdc[_0xaa0d('0x4f')]=qs[_0xaa0d('0x50')](_0x255b29[_0xaa0d('0x4a')]['sort']);_0x23fcdc[_0xaa0d('0x51')]=qs[_0xaa0d('0x52')](_[_0xaa0d('0xc3')](_0x255b29['query'],_0x59376b['filters']));if(_0x255b29[_0xaa0d('0x4a')][_0xaa0d('0x3a')]){_0x23fcdc[_0xaa0d('0x51')]=_[_0xaa0d('0x53')](_0x23fcdc[_0xaa0d('0x51')],{'$or':_[_0xaa0d('0x47')](_0x23fcdc[_0xaa0d('0x4c')],function(_0x29ea2f){var _0x4aa823={};_0x4aa823[_0x29ea2f]={'$like':'%'+_0x255b29['query'][_0xaa0d('0x3a')]+'%'};return _0x4aa823;})});}_0x23fcdc[_0xaa0d('0x46')]=db['User'];_0x23fcdc['as']='Agents';_0x23fcdc=_[_0xaa0d('0x53')]({},_0x23fcdc,_0x255b29['options']);return _0xfe238a[_0xaa0d('0x103')]({'include':[_0x23fcdc]});}})['then'](function(_0x147ef0){if(_0x147ef0){var _0x12d376={},_0x30be0f=[],_0x8d7cfd=0x0;for(var _0x127075=0x0;_0x127075<_0x147ef0[_0xaa0d('0x4d')];_0x127075+=0x1){for(var _0x57cb50=0x0,_0x3e0415;_0x57cb50<_0x147ef0[_0x127075][_0xaa0d('0x37')][_0xaa0d('0x4d')];_0x57cb50+=0x1){_0x3e0415=_0x147ef0[_0x127075][_0xaa0d('0x37')][_0x57cb50]['get']({'plain':!![]});_0x12d376[_0x3e0415['id']]=_0x3e0415;}}_0x12d376=_[_0xaa0d('0x11a')](_0x12d376);for(var _0x2438d8=qs['offset'](_0x255b29[_0xaa0d('0x4a')][_0xaa0d('0x30')]);_0x2438d8<_0x12d376['length']&&_0x30be0f['length']=_0x5c715c['agents']){throw new Error(_0x435a('0x4f'));}})[_0x435a('0xe')](function(){if(_0x5db6ad){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x5db6ad[_0x435a('0x2c')]},'individualHooks':!![]});}})['then'](function(){if(_0x5db6ad){return _0x5db6ad[_0x435a('0x50')]({'raw':!![]});}})[_0x435a('0xe')](function(_0x1fe788){if(_0x5db6ad){if(_0x1fe788){var _0x326123=[];_0x247234=_0x1fe788;if(_0x247234['length']){for(var _0x215f6c=0x0;_0x215f6c<_0x247234[_0x435a('0x2e')];_0x215f6c++){_0x326123['push'](db[_0x435a('0x2a')][_0x435a('0x51')]({'membername':_0x5db6ad['name'],'UserId':_0x5db6ad['id'],'queue_name':_0x247234[_0x215f6c][_0x435a('0x2c')],'VoiceQueueId':_0x247234[_0x215f6c]['id'],'interface':_0x46193c,'paused':_0x5db6ad['loginInPause']||![],'penalty':_0x247234[_0x215f6c][_0x435a('0x52')]||0x0}));}return BPromise[_0x435a('0x48')](_0x326123);}}}})[_0x435a('0xe')](function(){if(_0x5db6ad){return db[_0x435a('0x3b')][_0x435a('0x1b')]({'where':{'membername':_0x5db6ad[_0x435a('0x2c')],'exitAt':null}});}})['then'](function(_0x4202c3){if(_0x5db6ad){if(_0x4202c3&&_0x4202c3['length']){var _0x323032=[];_0x4202c3[_0x435a('0x32')](function(_0x579664){_0x323032[_0x435a('0x33')](_0x579664[_0x435a('0x2b')]({'exitAt':moment()[_0x435a('0x2f')](_0x435a('0x30'))}));});return BPromise['all'](_0x323032);}}})[_0x435a('0xe')](function(_0x17d45a){if(_0x5db6ad){var _0x1b8e98=[];var _0x2bf506=[];var _0x3fab40=utils[_0x435a('0x31')]();var _0x58c9be={'membername':_0x5db6ad['name'],'interface':_0x46193c,'enterAt':moment()[_0x435a('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5db6ad['role'],'internal':_0x5db6ad[_0x435a('0x28')]};_0x3fab40[_0x435a('0x32')](function(_0x5b9a90){_0x1b8e98[_0x435a('0x33')](_[_0x435a('0x53')]({'channel':_0x5b9a90,'type':_0x435a('0x54'),'data1':'callysquare','data2':_0x46193c},_0x58c9be));if(_0x5db6ad[_0x435a('0x55')]){_0x2bf506[_0x435a('0x33')](_[_0x435a('0x53')]({'channel':_0x5b9a90,'type':'PAUSE','data1':_0x435a('0x56')},_0x58c9be));}});return db[_0x435a('0x3b')][_0x435a('0x3c')](_0x1b8e98['concat'](_0x2bf506),{'individualHooks':!![]});}})['then'](function(){if(_0x5db6ad){return _0x5db6ad['update']({'online':!![],'lastLoginAt':moment()[_0x435a('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5db6ad[_0x435a('0x55')]||![],'mailPause':_0x5db6ad[_0x435a('0x55')]||![],'chatPause':_0x5db6ad[_0x435a('0x55')]||![],'faxPause':_0x5db6ad[_0x435a('0x55')]||![],'smsPause':_0x5db6ad[_0x435a('0x55')]||![],'openchannelPause':_0x5db6ad['loginInPause']||![],'pauseType':_0x5db6ad['loginInPause']?_0x435a('0x56'):null,'lastPauseAt':moment()[_0x435a('0x2f')](_0x435a('0x30')),'interface':_0x46193c});}})['then'](function(_0x3fee4c){_0x36dd96(_0x3fee4c);})[_0x435a('0x19')](function(_0x3c103f){_0x2dfd8c(_0x4ddc87['error'](0x1f4,_0x3c103f[_0x435a('0x17')]));});});}; \ No newline at end of file +var _0xdffc=['socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','findAll','raw','options','map','model','attributes','include','ShowUser','User','find','where','PauseUser','name','role','interface','UserVoiceQueueRt','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','format','type','DEFAULT\x20PAUSE','internal','uniqueid','MemberReport','body','UnpauseUser','isValidChannel','channel','voice','update','mail','fax','sms','openchannel','system','set','%s%s','Pause','all','destroy','LoginUser','mobile','SIP/%s','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2da3d7,_0x4fdce2){var _0xabbfdb=function(_0x368424){while(--_0x368424){_0x2da3d7['push'](_0x2da3d7['shift']());}};_0xabbfdb(++_0x4fdce2);}(_0xdffc,0x15c));var _0xcdff=function(_0x4f7705,_0x450656){_0x4f7705=_0x4f7705-0x0;var _0x15e815=_0xdffc[_0x4f7705];return _0x15e815;};'use strict';var _=require(_0xcdff('0x0'));var util=require(_0xcdff('0x1'));var moment=require(_0xcdff('0x2'));var BPromise=require(_0xcdff('0x3'));var rs=require(_0xcdff('0x4'));var fs=require('fs');var Redis=require(_0xcdff('0x5'));var db=require(_0xcdff('0x6'))['db'];var utils=require(_0xcdff('0x7'));var logger=require(_0xcdff('0x8'))(_0xcdff('0x9'));var config=require(_0xcdff('0xa'));var jayson=require(_0xcdff('0xb'));var client=jayson[_0xcdff('0xc')][_0xcdff('0xd')]({'port':0x232a});config[_0xcdff('0xe')]=_[_0xcdff('0xf')](config[_0xcdff('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdff('0x10'))(new Redis(config[_0xcdff('0xe')]));require(_0xcdff('0x11'))['register'](socket);function respondWithRpcPromise(_0x5c642d,_0x10925d,_0x2460dc){return new BPromise(function(_0x3b3e6a,_0x46f0d3){return client[_0xcdff('0x12')](_0x5c642d,_0x2460dc)[_0xcdff('0x13')](function(_0xe484bb){logger[_0xcdff('0x14')](_0xcdff('0x15'),_0x10925d,_0xcdff('0x16'));logger[_0xcdff('0x17')](_0xcdff('0x18'),_0x10925d,_0xcdff('0x16'),JSON[_0xcdff('0x19')](_0xe484bb));if(_0xe484bb[_0xcdff('0x1a')]){if(_0xe484bb[_0xcdff('0x1a')][_0xcdff('0x1b')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x10925d,_0xe484bb[_0xcdff('0x1a')][_0xcdff('0x1c')]);return _0x46f0d3(_0xe484bb[_0xcdff('0x1a')][_0xcdff('0x1c')]);}logger[_0xcdff('0x1a')]('User,\x20%s,\x20%s',_0x10925d,_0xe484bb[_0xcdff('0x1a')][_0xcdff('0x1c')]);return _0x3b3e6a(_0xe484bb[_0xcdff('0x1a')][_0xcdff('0x1c')]);}else{logger['info']('User,\x20%s,\x20%s',_0x10925d,_0xcdff('0x16'));_0x3b3e6a(_0xe484bb['result']['message']);}})[_0xcdff('0x1d')](function(_0x42a40d){logger[_0xcdff('0x1a')]('User,\x20%s,\x20%s',_0x10925d,_0x42a40d);_0x46f0d3(_0x42a40d);});});}exports[_0xcdff('0x1e')]=function(_0x3f9cc9){var _0x4a8ce0=this;return new Promise(function(_0x3d2cab,_0x11b3da){return db['User'][_0xcdff('0x1f')]({'raw':_0x3f9cc9['options']?_0x3f9cc9['options'][_0xcdff('0x20')]===undefined?!![]:![]:!![],'where':_0x3f9cc9[_0xcdff('0x21')]?_0x3f9cc9[_0xcdff('0x21')]['where']||null:null,'attributes':_0x3f9cc9[_0xcdff('0x21')]?_0x3f9cc9[_0xcdff('0x21')]['attributes']||null:null,'limit':_0x3f9cc9['options']?_0x3f9cc9[_0xcdff('0x21')]['limit']||null:null,'include':_0x3f9cc9[_0xcdff('0x21')]?_0x3f9cc9[_0xcdff('0x21')]['include']?_[_0xcdff('0x22')](_0x3f9cc9[_0xcdff('0x21')]['include'],function(_0x1695a9){return{'model':db[_0x1695a9[_0xcdff('0x23')]],'as':_0x1695a9['as'],'attributes':_0x1695a9[_0xcdff('0x24')],'include':_0x1695a9[_0xcdff('0x25')]?_[_0xcdff('0x22')](_0x1695a9['include'],function(_0x512d06){return{'model':db[_0x512d06[_0xcdff('0x23')]],'as':_0x512d06['as'],'attributes':_0x512d06[_0xcdff('0x24')],'include':_0x512d06['include']?_[_0xcdff('0x22')](_0x512d06[_0xcdff('0x25')],function(_0x383858){return{'model':db[_0x383858[_0xcdff('0x23')]],'as':_0x383858['as'],'attributes':_0x383858[_0xcdff('0x24')]};}):[]};}):[]};}):[]:[]})[_0xcdff('0x13')](function(_0x239c71){logger[_0xcdff('0x14')](_0xcdff('0x1e'),_0x3f9cc9);logger[_0xcdff('0x17')]('GetUser',_0x3f9cc9,JSON[_0xcdff('0x19')](_0x239c71));_0x3d2cab(_0x239c71);})[_0xcdff('0x1d')](function(_0x1cbc26){logger[_0xcdff('0x1a')](_0xcdff('0x1e'),_0x1cbc26['message'],_0x3f9cc9);_0x11b3da(_0x4a8ce0[_0xcdff('0x1a')](0x1f4,_0x1cbc26[_0xcdff('0x1c')]));});});};exports[_0xcdff('0x26')]=function(_0x3333a7){var _0x4de3c0=this;return new Promise(function(_0x5cdea4,_0xbd2d9e){return db[_0xcdff('0x27')][_0xcdff('0x28')]({'raw':_0x3333a7[_0xcdff('0x21')]?_0x3333a7[_0xcdff('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3333a7[_0xcdff('0x21')]?_0x3333a7[_0xcdff('0x21')][_0xcdff('0x29')]||null:null,'attributes':_0x3333a7['options']?_0x3333a7['options'][_0xcdff('0x24')]||null:null,'include':_0x3333a7[_0xcdff('0x21')]?_0x3333a7[_0xcdff('0x21')][_0xcdff('0x25')]?_[_0xcdff('0x22')](_0x3333a7[_0xcdff('0x21')][_0xcdff('0x25')],function(_0x11cffc){return{'model':db[_0x11cffc[_0xcdff('0x23')]],'as':_0x11cffc['as'],'attributes':_0x11cffc[_0xcdff('0x24')],'include':_0x11cffc[_0xcdff('0x25')]?_[_0xcdff('0x22')](_0x11cffc[_0xcdff('0x25')],function(_0xc8ee71){return{'model':db[_0xc8ee71[_0xcdff('0x23')]],'as':_0xc8ee71['as'],'attributes':_0xc8ee71[_0xcdff('0x24')],'include':_0xc8ee71[_0xcdff('0x25')]?_[_0xcdff('0x22')](_0xc8ee71['include'],function(_0x47c956){return{'model':db[_0x47c956[_0xcdff('0x23')]],'as':_0x47c956['as'],'attributes':_0x47c956[_0xcdff('0x24')]};}):[]};}):[]};}):[]:[]})[_0xcdff('0x13')](function(_0x3183e5){logger['info'](_0xcdff('0x26'),_0x3333a7);logger[_0xcdff('0x17')](_0xcdff('0x26'),_0x3333a7,JSON[_0xcdff('0x19')](_0x3183e5));_0x5cdea4(_0x3183e5);})[_0xcdff('0x1d')](function(_0x223aca){logger[_0xcdff('0x1a')](_0xcdff('0x26'),_0x223aca[_0xcdff('0x1c')],_0x3333a7);_0xbd2d9e(_0x4de3c0[_0xcdff('0x1a')](0x1f4,_0x223aca[_0xcdff('0x1c')]));});});};exports[_0xcdff('0x2a')]=function(_0x18b59f){var _0x5a80be=this;return new Promise(function(_0x1f12e4,_0x581019){var _0x4491d9;return db[_0xcdff('0x27')][_0xcdff('0x28')]({'where':_0x18b59f[_0xcdff('0x21')][_0xcdff('0x29')]||{},'attributes':['id',_0xcdff('0x2b'),_0xcdff('0x2c'),'internal',_0xcdff('0x2d')]})[_0xcdff('0x13')](function(_0xc3daa0){if(_0xc3daa0){_0x4491d9=_0xc3daa0;return db[_0xcdff('0x2e')]['update']({'paused':0x1},{'where':{'UserId':_0x4491d9['id']},'individualHooks':!![]});}})['then'](function(){if(_0x4491d9){return db['MemberReport'][_0xcdff('0x1f')]({'where':{'membername':_0x4491d9[_0xcdff('0x2b')],'type':_0xcdff('0x2f'),'exitAt':null}});}})['then'](function(_0x36401a){if(_0x4491d9){if(_0x36401a&&_0x36401a[_0xcdff('0x30')]){var _0x237c99=moment()['format'](_0xcdff('0x31'));for(var _0x2c7779=0x0,_0x13cfe0=_0x36401a['length'];_0x2c7779<_0x13cfe0;_0x2c7779++){_0x36401a[_0x2c7779]['updateAttributes']({'exitAt':_0x237c99});}}}})[_0xcdff('0x13')](function(){if(_0x4491d9){var _0xd03945=[];var _0x326cf8=utils[_0xcdff('0x32')]();_0x326cf8[_0xcdff('0x33')](function(_0x2654bf){_0xd03945[_0xcdff('0x34')]({'channel':_0x2654bf,'membername':_0x4491d9['name'],'interface':_[_0xcdff('0x35')](_0x4491d9['interface'])?util['format']('SIP/%s',_0x4491d9[_0xcdff('0x2b')]):_0x4491d9[_0xcdff('0x2d')],'type':_0xcdff('0x2f'),'enterAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'data1':_0x18b59f['body'][_0xcdff('0x37')]||_0xcdff('0x38'),'role':_0x4491d9[_0xcdff('0x2c')],'internal':_0x4491d9[_0xcdff('0x39')],'uniqueid':_0x18b59f['body'][_0xcdff('0x3a')]||null});});return db[_0xcdff('0x3b')]['bulkCreate'](_0xd03945,{'individualHooks':!![]});}})[_0xcdff('0x13')](function(){if(_0x4491d9){return _0x4491d9['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x18b59f[_0xcdff('0x3c')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xcdff('0x31'))});}})[_0xcdff('0x13')](function(_0x3513c0){_0x1f12e4(_0x3513c0);})[_0xcdff('0x1d')](function(_0x5b9434){_0x581019(_0x5a80be[_0xcdff('0x1a')](0x1f4,_0x5b9434[_0xcdff('0x1c')]));});});};exports[_0xcdff('0x3d')]=function(_0x1b3c92){var _0x388365=this;return new Promise(function(_0x4bf0f8,_0x33da30){var _0x5f60a2;return db[_0xcdff('0x27')]['findOne']({'where':_0x1b3c92['options']['where']||{},'attributes':['id',_0xcdff('0x2b')]})[_0xcdff('0x13')](function(_0x26793a){if(_0x26793a){_0x5f60a2=_0x26793a;if(_0x1b3c92[_0xcdff('0x3c')]['channel']&&!utils[_0xcdff('0x3e')](_0x1b3c92[_0xcdff('0x3c')][_0xcdff('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0x1b3c92[_0xcdff('0x3c')]['channel']){case _0xcdff('0x40'):return db[_0xcdff('0x2e')][_0xcdff('0x41')]({'paused':0x0},{'where':{'UserId':_0x5f60a2['id']}})[_0xcdff('0x13')](function(){return db['MemberReport'][_0xcdff('0x28')]({'where':{'channel':_0x1b3c92[_0xcdff('0x3c')]['channel'],'membername':_0x5f60a2[_0xcdff('0x2b')],'type':_0xcdff('0x2f'),'exitAt':null}});})[_0xcdff('0x13')](function(_0x51fa3e){if(_0x51fa3e){return _0x51fa3e['update']({'exitAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xcdff('0x13')](function(){return _0x5f60a2[_0xcdff('0x41')]({'voicePause':![]});});case _0xcdff('0x42'):case'chat':case _0xcdff('0x43'):case _0xcdff('0x44'):case _0xcdff('0x45'):return db[_0xcdff('0x3b')]['find']({'where':{'channel':_0x1b3c92[_0xcdff('0x3c')][_0xcdff('0x3f')],'membername':_0x5f60a2[_0xcdff('0x2b')],'type':_0xcdff('0x2f'),'exitAt':null}})[_0xcdff('0x13')](function(_0x307bc1){return _0x307bc1[_0xcdff('0x41')]({'exitAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'data2':_0xcdff('0x46')},{'individualHooks':!![]});})['then'](function(){var _0x292830={};_[_0xcdff('0x47')](_0x292830,util['format'](_0xcdff('0x48'),_0x1b3c92[_0xcdff('0x3c')]['channel'],_0xcdff('0x49')),![]);return _0x5f60a2[_0xcdff('0x41')](_0x292830);});default:return db[_0xcdff('0x2e')][_0xcdff('0x41')]({'paused':0x0},{'where':{'UserId':_0x5f60a2['id']}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x5f60a2['name'],'type':_0xcdff('0x2f'),'exitAt':null}});})['then'](function(_0x36d3ef){var _0x2a62a9=[];_0x36d3ef['forEach'](function(_0x9f3d19){_0x2a62a9['push'](_0x9f3d19[_0xcdff('0x41')]({'exitAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'data2':_0xcdff('0x46')}));});return BPromise[_0xcdff('0x4a')](_0x2a62a9);})[_0xcdff('0x13')](function(){return _0x5f60a2[_0xcdff('0x41')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xcdff('0x13')](function(_0x45d360){_0x4bf0f8(_0x45d360);})['catch'](function(_0x572a14){_0x33da30(_0x388365[_0xcdff('0x1a')](0x1f4,_0x572a14[_0xcdff('0x1c')]));});});};exports['LogoutUser']=function(_0x15cefa){var _0x13299a=this;return new Promise(function(_0x27c35f,_0x4cf561){var _0xd4a28;return db['User']['findOne']({'where':_0x15cefa[_0xcdff('0x21')][_0xcdff('0x29')]||{},'attributes':['id',_0xcdff('0x2b')]})[_0xcdff('0x13')](function(_0x33a4a2){if(_0x33a4a2){_0xd4a28=_0x33a4a2;return db['UserVoiceQueueRt'][_0xcdff('0x4b')]({'where':{'membername':_0xd4a28[_0xcdff('0x2b')]},'individualHooks':!![]});}})['then'](function(){if(_0xd4a28){return db[_0xcdff('0x3b')]['findAll']({'where':{'membername':_0xd4a28['name'],'exitAt':null}});}})[_0xcdff('0x13')](function(_0xfdedd6){if(_0xd4a28){if(_0xfdedd6&&_0xfdedd6['length']){var _0x3de178=[];_0xfdedd6[_0xcdff('0x33')](function(_0x40adec){_0x3de178['push'](_0x40adec['update']({'exitAt':moment()[_0xcdff('0x36')](_0xcdff('0x31'))}));});return BPromise['all'](_0x3de178);}}})[_0xcdff('0x13')](function(){if(_0xd4a28){return _0xd4a28[_0xcdff('0x41')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xcdff('0x13')](function(_0x1c0349){_0x27c35f(_0x1c0349);})[_0xcdff('0x1d')](function(_0x5249a2){_0x4cf561(_0x13299a[_0xcdff('0x1a')](0x1f4,_0x5249a2[_0xcdff('0x1c')]));});});};exports[_0xcdff('0x4c')]=function(_0x4b9417){var _0x56de38=this;return new Promise(function(_0x32ade6,_0x37bc17){var _0x4119b8;var _0xc6ddbb;var _0x85c7c4;var _0x45315e;return db[_0xcdff('0x27')]['findOne']({'where':_0x4b9417['options'][_0xcdff('0x29')]||{},'attributes':['id',_0xcdff('0x2b'),'role',_0xcdff('0x4d'),'phone',_0xcdff('0x39'),'loginInPause','interface']})[_0xcdff('0x13')](function(_0x3c44f9){if(_0x3c44f9){_0x4119b8=_0x3c44f9;_0x45315e=_0x4b9417[_0xcdff('0x3c')]['interface']?_0x4b9417[_0xcdff('0x3c')]['interface']:util['format'](_0xcdff('0x4e'),_0x4119b8[_0xcdff('0x2b')]);return db[_0xcdff('0x27')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4119b8['id']}}});}})[_0xcdff('0x13')](function(_0x5a4fa2){if(_0x5a4fa2){_0x85c7c4=_0x5a4fa2;return require(_0xcdff('0x4f'))[_0xcdff('0x50')]();}})[_0xcdff('0x13')](function(_0x3527cd){if(_0x3527cd&&_0x3527cd[_0xcdff('0x51')]&&_0x85c7c4>=_0x3527cd[_0xcdff('0x51')]){throw new Error(_0xcdff('0x52'));}})[_0xcdff('0x13')](function(){if(_0x4119b8){return db[_0xcdff('0x2e')]['destroy']({'where':{'membername':_0x4119b8['name']},'individualHooks':!![]});}})['then'](function(){if(_0x4119b8){return _0x4119b8[_0xcdff('0x53')]({'raw':!![]});}})[_0xcdff('0x13')](function(_0x54e659){if(_0x4119b8){if(_0x54e659){var _0xd4166d=[];_0xc6ddbb=_0x54e659;if(_0xc6ddbb[_0xcdff('0x30')]){for(var _0x41610c=0x0;_0x41610c<_0xc6ddbb[_0xcdff('0x30')];_0x41610c++){_0xd4166d[_0xcdff('0x34')](db[_0xcdff('0x2e')][_0xcdff('0x54')]({'membername':_0x4119b8[_0xcdff('0x2b')],'UserId':_0x4119b8['id'],'queue_name':_0xc6ddbb[_0x41610c]['name'],'VoiceQueueId':_0xc6ddbb[_0x41610c]['id'],'interface':_0x45315e,'paused':_0x4119b8[_0xcdff('0x55')]||![],'penalty':_0xc6ddbb[_0x41610c][_0xcdff('0x56')]||0x0}));}return BPromise[_0xcdff('0x4a')](_0xd4166d);}}}})['then'](function(){if(_0x4119b8){return db[_0xcdff('0x3b')][_0xcdff('0x1f')]({'where':{'membername':_0x4119b8[_0xcdff('0x2b')],'exitAt':null}});}})['then'](function(_0x24b140){if(_0x4119b8){if(_0x24b140&&_0x24b140[_0xcdff('0x30')]){var _0x1c3705=[];_0x24b140[_0xcdff('0x33')](function(_0x14f4ed){_0x1c3705[_0xcdff('0x34')](_0x14f4ed[_0xcdff('0x41')]({'exitAt':moment()[_0xcdff('0x36')](_0xcdff('0x31'))}));});return BPromise[_0xcdff('0x4a')](_0x1c3705);}}})[_0xcdff('0x13')](function(_0x39df48){if(_0x4119b8){var _0x3c4a9d=[];var _0x58589b=[];var _0x380d69=utils[_0xcdff('0x32')]();var _0x1c1439={'membername':_0x4119b8[_0xcdff('0x2b')],'interface':_0x45315e,'enterAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'role':_0x4119b8['role'],'internal':_0x4119b8[_0xcdff('0x39')]};_0x380d69[_0xcdff('0x33')](function(_0x194dfd){_0x3c4a9d[_0xcdff('0x34')](_[_0xcdff('0x57')]({'channel':_0x194dfd,'type':_0xcdff('0x58'),'data1':_0xcdff('0x59'),'data2':_0x45315e},_0x1c1439));if(_0x4119b8[_0xcdff('0x55')]){_0x58589b[_0xcdff('0x34')](_['merge']({'channel':_0x194dfd,'type':_0xcdff('0x2f'),'data1':_0xcdff('0x5a')},_0x1c1439));}});return db[_0xcdff('0x3b')]['bulkCreate'](_0x3c4a9d['concat'](_0x58589b),{'individualHooks':!![]});}})[_0xcdff('0x13')](function(){if(_0x4119b8){return _0x4119b8[_0xcdff('0x41')]({'online':!![],'lastLoginAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'voicePause':_0x4119b8['loginInPause']||![],'mailPause':_0x4119b8[_0xcdff('0x55')]||![],'chatPause':_0x4119b8['loginInPause']||![],'faxPause':_0x4119b8[_0xcdff('0x55')]||![],'smsPause':_0x4119b8['loginInPause']||![],'openchannelPause':_0x4119b8[_0xcdff('0x55')]||![],'pauseType':_0x4119b8[_0xcdff('0x55')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xcdff('0x36')](_0xcdff('0x31')),'interface':_0x45315e});}})[_0xcdff('0x13')](function(_0xdd9112){_0x32ade6(_0xdd9112);})[_0xcdff('0x1d')](function(_0x382b52){_0x37bc17(_0x56de38['error'](0x1f4,_0x382b52[_0xcdff('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4515a01..2962fd6 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 _0xad7f=['./user.events','save','remove','update','removeListener','register','length','user:'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xad7f,0xa0));var _0xfad7=function(_0x8e2d4d,_0x310930){_0x8e2d4d=_0x8e2d4d-0x0;var _0x5e3047=_0xad7f[_0x8e2d4d];return _0x5e3047;};'use strict';var UserEvents=require(_0xfad7('0x0'));var events=[_0xfad7('0x1'),_0xfad7('0x2'),_0xfad7('0x3')];function createListener(_0x133423,_0xd4202a){return function(_0x246ab6){_0xd4202a['emit'](_0x133423,_0x246ab6);};}function removeListener(_0x51df2d,_0x3f05e9){return function(){UserEvents[_0xfad7('0x4')](_0x51df2d,_0x3f05e9);};}exports[_0xfad7('0x5')]=function(_0x1d9be0){for(var _0x1f8bd8=0x0,_0x494dbb=events[_0xfad7('0x6')];_0x1f8bd8<_0x494dbb;_0x1f8bd8++){var _0x3a1079=events[_0x1f8bd8];var _0x4b1706=createListener(_0xfad7('0x7')+_0x3a1079,_0x1d9be0);UserEvents['on'](_0x3a1079,_0x4b1706);}}; \ No newline at end of file +var _0x8d2c=['length','user:','./user.events','save','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8d2c,0x17e));var _0xc8d2=function(_0x273c84,_0x3b9ef3){_0x273c84=_0x273c84-0x0;var _0x369743=_0x8d2c[_0x273c84];return _0x369743;};'use strict';var UserEvents=require(_0xc8d2('0x0'));var events=[_0xc8d2('0x1'),'remove','update'];function createListener(_0x17c055,_0x5fa368){return function(_0x3ae36d){_0x5fa368['emit'](_0x17c055,_0x3ae36d);};}function removeListener(_0x3643c0,_0x549bd9){return function(){UserEvents['removeListener'](_0x3643c0,_0x549bd9);};}exports[_0xc8d2('0x2')]=function(_0x1797fb){for(var _0x1f0eff=0x0,_0xaf0af1=events[_0xc8d2('0x3')];_0x1f0eff<_0xaf0af1;_0x1f0eff++){var _0x3d7720=events[_0x1f0eff];var _0x55afab=createListener(_0xc8d2('0x4')+_0x3d7720,_0x1797fb);UserEvents['on'](_0x3d7720,_0x55afab);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index dc47a9e..64954e0 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 _0x0892=['../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout','Router'];(function(_0x26d5d6,_0x4d5d5c){var _0x3fb8b1=function(_0x101604){while(--_0x101604){_0x26d5d6['push'](_0x26d5d6['shift']());}};_0x3fb8b1(++_0x4d5d5c);}(_0x0892,0x15b));var _0x2089=function(_0x57bbcf,_0x5e8738){_0x57bbcf=_0x57bbcf-0x0;var _0x4d7e26=_0x0892[_0x57bbcf];return _0x4d7e26;};'use strict';var multer=require(_0x2089('0x0'));var util=require(_0x2089('0x1'));var path=require(_0x2089('0x2'));var timeout=require(_0x2089('0x3'));var express=require('express');var router=express[_0x2089('0x4')]();var auth=require(_0x2089('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2089('0x6'));module[_0x2089('0x7')]=router; \ No newline at end of file +var _0x49b1=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4bc413,_0x4a5161){var _0x13910d=function(_0xdb5c53){while(--_0xdb5c53){_0x4bc413['push'](_0x4bc413['shift']());}};_0x13910d(++_0x4a5161);}(_0x49b1,0x1e9));var _0x149b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49b1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x149b('0x0'));var util=require(_0x149b('0x1'));var path=require(_0x149b('0x2'));var timeout=require('connect-timeout');var express=require(_0x149b('0x3'));var router=express[_0x149b('0x4')]();var auth=require(_0x149b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x149b('0x6'));module[_0x149b('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8f65f2f..0befcf1 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5925e9,_0x51b161){var _0x72efff=function(_0x428750){while(--_0x428750){_0x5925e9['push'](_0x5925e9['shift']());}};_0x72efff(++_0x51b161);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x991532,_0x541f18){var _0x369333=function(_0x57df9d){while(--_0x57df9d){_0x991532['push'](_0x991532['shift']());}};_0x369333(++_0x541f18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 c5414f2..90fd0f9 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 _0x4983=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues'];(function(_0x12e6a9,_0x29ac7f){var _0xb5e433=function(_0x3b98e5){while(--_0x3b98e5){_0x12e6a9['push'](_0x12e6a9['shift']());}};_0xb5e433(++_0x29ac7f);}(_0x4983,0xa8));var _0x3498=function(_0x3fb55e,_0x4fe830){_0x3fb55e=_0x3fb55e-0x0;var _0x374c38=_0x4983[_0x3fb55e];return _0x374c38;};'use strict';var _=require(_0x3498('0x0'));var util=require(_0x3498('0x1'));var logger=require(_0x3498('0x2'))(_0x3498('0x3'));var moment=require(_0x3498('0x4'));var BPromise=require(_0x3498('0x5'));var rp=require(_0x3498('0x6'));var fs=require('fs');var path=require(_0x3498('0x7'));var rimraf=require(_0x3498('0x8'));var config=require(_0x3498('0x9'));var attributes=require(_0x3498('0xa'));module[_0x3498('0xb')]=function(_0x1bf8aa,_0xf72af4){return _0x1bf8aa[_0x3498('0xc')]('UserChatQueue',attributes,{'tableName':_0x3498('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb8a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0xfb8a,0xc3));var _0xafb8=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xfb8a[_0xd02bb];return _0x1cdf23;};'use strict';var _=require('lodash');var util=require(_0xafb8('0x0'));var logger=require(_0xafb8('0x1'))(_0xafb8('0x2'));var moment=require(_0xafb8('0x3'));var BPromise=require(_0xafb8('0x4'));var rp=require(_0xafb8('0x5'));var fs=require('fs');var path=require(_0xafb8('0x6'));var rimraf=require(_0xafb8('0x7'));var config=require(_0xafb8('0x8'));var attributes=require(_0xafb8('0x9'));module[_0xafb8('0xa')]=function(_0x5aeea5,_0x5d597b){return _0x5aeea5[_0xafb8('0xb')](_0xafb8('0xc'),attributes,{'tableName':_0xafb8('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 d42481e..8c91a75 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 _0x1fa0=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s'];(function(_0x700bd5,_0x4b7949){var _0x3455a8=function(_0x4f8846){while(--_0x4f8846){_0x700bd5['push'](_0x700bd5['shift']());}};_0x3455a8(++_0x4b7949);}(_0x1fa0,0x17e));var _0x01fa=function(_0x13453e,_0x409732){_0x13453e=_0x13453e-0x0;var _0x19d7ce=_0x1fa0[_0x13453e];return _0x19d7ce;};'use strict';var _=require(_0x01fa('0x0'));var util=require('util');var moment=require(_0x01fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x01fa('0x2'));var fs=require('fs');var Redis=require(_0x01fa('0x3'));var db=require(_0x01fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01fa('0x5'))(_0x01fa('0x6'));var config=require(_0x01fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x01fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c761,_0x46b399,_0x93609b){return new BPromise(function(_0x8ed104,_0x4c83ed){return client[_0x01fa('0x9')](_0x42c761,_0x93609b)[_0x01fa('0xa')](function(_0x27acd3){logger[_0x01fa('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x46b399,_0x01fa('0xc'));logger[_0x01fa('0xd')](_0x01fa('0xe'),_0x46b399,'request\x20sent',JSON['stringify'](_0x27acd3));if(_0x27acd3[_0x01fa('0xf')]){if(_0x27acd3[_0x01fa('0xf')][_0x01fa('0x10')]===0x1f4){logger[_0x01fa('0xf')](_0x01fa('0x11'),_0x46b399,_0x27acd3[_0x01fa('0xf')][_0x01fa('0x12')]);return _0x4c83ed(_0x27acd3[_0x01fa('0xf')][_0x01fa('0x12')]);}logger[_0x01fa('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x46b399,_0x27acd3['error'][_0x01fa('0x12')]);return _0x8ed104(_0x27acd3[_0x01fa('0xf')][_0x01fa('0x12')]);}else{logger[_0x01fa('0xb')](_0x01fa('0x11'),_0x46b399,'request\x20sent');_0x8ed104(_0x27acd3[_0x01fa('0x13')][_0x01fa('0x12')]);}})['catch'](function(_0x3dea8b){logger[_0x01fa('0xf')](_0x01fa('0x11'),_0x46b399,_0x3dea8b);_0x4c83ed(_0x3dea8b);});});} \ No newline at end of file +var _0xe319=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment'];(function(_0x4081c6,_0x1f8d72){var _0x10e512=function(_0x15195b){while(--_0x15195b){_0x4081c6['push'](_0x4081c6['shift']());}};_0x10e512(++_0x1f8d72);}(_0xe319,0x1e2));var _0x9e31=function(_0x2573f1,_0x21e06d){_0x2573f1=_0x2573f1-0x0;var _0x5d4885=_0xe319[_0x2573f1];return _0x5d4885;};'use strict';var _=require(_0x9e31('0x0'));var util=require('util');var moment=require(_0x9e31('0x1'));var BPromise=require(_0x9e31('0x2'));var rs=require(_0x9e31('0x3'));var fs=require('fs');var Redis=require(_0x9e31('0x4'));var db=require(_0x9e31('0x5'))['db'];var utils=require(_0x9e31('0x6'));var logger=require(_0x9e31('0x7'))(_0x9e31('0x8'));var config=require(_0x9e31('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9e31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf6b7db,_0x4e8823,_0x14f27f){return new BPromise(function(_0x2a9828,_0x555b9b){return client[_0x9e31('0xb')](_0xf6b7db,_0x14f27f)[_0x9e31('0xc')](function(_0x56d313){logger[_0x9e31('0xd')](_0x9e31('0xe'),_0x4e8823,_0x9e31('0xf'));logger[_0x9e31('0x10')](_0x9e31('0x11'),_0x4e8823,'request\x20sent',JSON['stringify'](_0x56d313));if(_0x56d313['error']){if(_0x56d313['error']['code']===0x1f4){logger[_0x9e31('0x12')](_0x9e31('0xe'),_0x4e8823,_0x56d313[_0x9e31('0x12')][_0x9e31('0x13')]);return _0x555b9b(_0x56d313[_0x9e31('0x12')][_0x9e31('0x13')]);}logger[_0x9e31('0x12')](_0x9e31('0xe'),_0x4e8823,_0x56d313[_0x9e31('0x12')][_0x9e31('0x13')]);return _0x2a9828(_0x56d313[_0x9e31('0x12')][_0x9e31('0x13')]);}else{logger[_0x9e31('0xd')](_0x9e31('0xe'),_0x4e8823,_0x9e31('0xf'));_0x2a9828(_0x56d313[_0x9e31('0x14')][_0x9e31('0x13')]);}})[_0x9e31('0x15')](function(_0x348ef5){logger[_0x9e31('0x12')](_0x9e31('0xe'),_0x4e8823,_0x348ef5);_0x555b9b(_0x348ef5);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cb630a6..6e1d5ee 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 _0x91cb=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','path'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x91cb,0x179));var _0xb91c=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x91cb[_0x485201];return _0x9ca98a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb91c('0x0'));var timeout=require(_0xb91c('0x1'));var express=require(_0xb91c('0x2'));var router=express[_0xb91c('0x3')]();var auth=require(_0xb91c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb91c('0x5'));module[_0xb91c('0x6')]=router; \ No newline at end of file +var _0xc073=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55694c,_0x2b7400){var _0x271bb9=function(_0x5c082d){while(--_0x5c082d){_0x55694c['push'](_0x55694c['shift']());}};_0x271bb9(++_0x2b7400);}(_0xc073,0x1c3));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3c07('0x0'));var util=require(_0x3c07('0x1'));var path=require(_0x3c07('0x2'));var timeout=require(_0x3c07('0x3'));var express=require('express');var router=express[_0x3c07('0x4')]();var auth=require(_0x3c07('0x5'));var interaction=require(_0x3c07('0x6'));var config=require(_0x3c07('0x7'));module[_0x3c07('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ce14359..8cd563f 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 _0xd7d1=['exports','INTEGER','STRING','sequelize'];(function(_0x571215,_0x27f773){var _0x120c19=function(_0x6531bc){while(--_0x6531bc){_0x571215['push'](_0x571215['shift']());}};_0x120c19(++_0x27f773);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3e6875,_0x22a1ec){_0x3e6875=_0x3e6875-0x0;var _0x1cdd2f=_0xd7d1[_0x3e6875];return _0x1cdd2f;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'penalty':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1d7d('0x3')]}}; \ No newline at end of file +var _0xd4a2=['INTEGER','sequelize'];(function(_0x70eda8,_0x342471){var _0x48f95f=function(_0x388772){while(--_0x388772){_0x70eda8['push'](_0x70eda8['shift']());}};_0x48f95f(++_0x342471);}(_0xd4a2,0x173));var _0x2d4a=function(_0x10ea06,_0x25823a){_0x10ea06=_0x10ea06-0x0;var _0x2e434f=_0xd4a2[_0x10ea06];return _0x2e434f;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2d4a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 6502025..89b8407 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xb10b,0x12a));var _0xbb10=function(_0x17044c,_0x208790){_0x17044c=_0x17044c-0x0;var _0x5e6db0=_0xb10b[_0x17044c];return _0x5e6db0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x111257,_0xa98bd2){var _0x1ddaec=function(_0x370ca3){while(--_0x370ca3){_0x111257['push'](_0x111257['shift']());}};_0x1ddaec(++_0xa98bd2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b8b81,_0xb30fc5){_0x1b8b81=_0x1b8b81-0x0;var _0x4a84ca=_0x5f2f[_0x1b8b81];return _0x4a84ca;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'user_has_fax_queues','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 2e22534..106efff 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 _0xfc4e=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x476ede,_0x4a15e2){var _0x439fe8=function(_0x87338e){while(--_0x87338e){_0x476ede['push'](_0x476ede['shift']());}};_0x439fe8(++_0x4a15e2);}(_0xfc4e,0xd6));var _0xefc4=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xfc4e[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xefc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xefc4('0x1'));var rs=require(_0xefc4('0x2'));var fs=require('fs');var Redis=require(_0xefc4('0x3'));var db=require(_0xefc4('0x4'))['db'];var utils=require(_0xefc4('0x5'));var logger=require('../../config/logger')(_0xefc4('0x6'));var config=require(_0xefc4('0x7'));var jayson=require(_0xefc4('0x8'));var client=jayson[_0xefc4('0x9')][_0xefc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffc5aa,_0x1b8d39,_0x12b58a){return new BPromise(function(_0x43b9c2,_0x1542a8){return client[_0xefc4('0xb')](_0xffc5aa,_0x12b58a)['then'](function(_0x5dba6f){logger[_0xefc4('0xc')](_0xefc4('0xd'),_0x1b8d39,_0xefc4('0xe'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1b8d39,'request\x20sent',JSON['stringify'](_0x5dba6f));if(_0x5dba6f[_0xefc4('0xf')]){if(_0x5dba6f['error'][_0xefc4('0x10')]===0x1f4){logger[_0xefc4('0xf')](_0xefc4('0xd'),_0x1b8d39,_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);return _0x1542a8(_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);}logger[_0xefc4('0xf')](_0xefc4('0xd'),_0x1b8d39,_0x5dba6f[_0xefc4('0xf')][_0xefc4('0x11')]);return _0x43b9c2(_0x5dba6f['error'][_0xefc4('0x11')]);}else{logger[_0xefc4('0xc')](_0xefc4('0xd'),_0x1b8d39,_0xefc4('0xe'));_0x43b9c2(_0x5dba6f[_0xefc4('0x12')]['message']);}})[_0xefc4('0x13')](function(_0x292aa0){logger['error'](_0xefc4('0xd'),_0x1b8d39,_0x292aa0);_0x1542a8(_0x292aa0);});});} \ No newline at end of file +var _0x1868=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0xc83285,_0x3860f3){var _0x59ef36=function(_0x375eaf){while(--_0x375eaf){_0xc83285['push'](_0xc83285['shift']());}};_0x59ef36(++_0x3860f3);}(_0x1868,0xe3));var _0x8186=function(_0x2b90e2,_0x3c0729){_0x2b90e2=_0x2b90e2-0x0;var _0x1431e6=_0x1868[_0x2b90e2];return _0x1431e6;};'use strict';var _=require(_0x8186('0x0'));var util=require('util');var moment=require(_0x8186('0x1'));var BPromise=require(_0x8186('0x2'));var rs=require(_0x8186('0x3'));var fs=require('fs');var Redis=require(_0x8186('0x4'));var db=require(_0x8186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8186('0x6'))('rpc');var config=require(_0x8186('0x7'));var jayson=require(_0x8186('0x8'));var client=jayson[_0x8186('0x9')][_0x8186('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506c43,_0x1ec0b8,_0x3f02d5){return new BPromise(function(_0x5d729,_0x309b8d){return client[_0x8186('0xb')](_0x506c43,_0x3f02d5)[_0x8186('0xc')](function(_0x2427cb){logger[_0x8186('0xd')](_0x8186('0xe'),_0x1ec0b8,_0x8186('0xf'));logger[_0x8186('0x10')](_0x8186('0x11'),_0x1ec0b8,'request\x20sent',JSON[_0x8186('0x12')](_0x2427cb));if(_0x2427cb[_0x8186('0x13')]){if(_0x2427cb['error'][_0x8186('0x14')]===0x1f4){logger[_0x8186('0x13')](_0x8186('0xe'),_0x1ec0b8,_0x2427cb[_0x8186('0x13')][_0x8186('0x15')]);return _0x309b8d(_0x2427cb[_0x8186('0x13')][_0x8186('0x15')]);}logger[_0x8186('0x13')](_0x8186('0xe'),_0x1ec0b8,_0x2427cb['error'][_0x8186('0x15')]);return _0x5d729(_0x2427cb[_0x8186('0x13')][_0x8186('0x15')]);}else{logger['info'](_0x8186('0xe'),_0x1ec0b8,'request\x20sent');_0x5d729(_0x2427cb['result'][_0x8186('0x15')]);}})[_0x8186('0x16')](function(_0x15f1e5){logger[_0x8186('0x13')](_0x8186('0xe'),_0x1ec0b8,_0x15f1e5);_0x309b8d(_0x15f1e5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ae7ddc0..16b9edf 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 _0x0852=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0852,0x174));var _0x2085=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0852[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x2085('0x0'));var util=require(_0x2085('0x1'));var path=require(_0x2085('0x2'));var timeout=require(_0x2085('0x3'));var express=require('express');var router=express[_0x2085('0x4')]();var auth=require(_0x2085('0x5'));var interaction=require(_0x2085('0x6'));var config=require(_0x2085('0x7'));module[_0x2085('0x8')]=router; \ No newline at end of file +var _0xf75e=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x35f3c9,_0x1aaafe){var _0x483f61=function(_0x4022f3){while(--_0x4022f3){_0x35f3c9['push'](_0x35f3c9['shift']());}};_0x483f61(++_0x1aaafe);}(_0xf75e,0x1ec));var _0xef75=function(_0x4a27a9,_0x694408){_0x4a27a9=_0x4a27a9-0x0;var _0x457581=_0xf75e[_0x4a27a9];return _0x457581;};'use strict';var multer=require(_0xef75('0x0'));var util=require(_0xef75('0x1'));var path=require(_0xef75('0x2'));var timeout=require(_0xef75('0x3'));var express=require(_0xef75('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xef75('0x5'));var config=require(_0xef75('0x6'));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 94aab22..14815f1 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(_0x31ddba,_0x28ec26){var _0x3f014c=function(_0x24aa10){while(--_0x24aa10){_0x31ddba['push'](_0x31ddba['shift']());}};_0x3f014c(++_0x28ec26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x53908d,_0x449aa4){var _0x5bba96=function(_0xff29b8){while(--_0xff29b8){_0x53908d['push'](_0x53908d['shift']());}};_0x5bba96(++_0x449aa4);}(_0xe706,0xa3));var _0x6e70=function(_0x2f9c02,_0x15719e){_0x2f9c02=_0x2f9c02-0x0;var _0x5d33f3=_0xe706[_0x2f9c02];return _0x5d33f3;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index daf4b8f..2430506 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3e5442,_0x7ef17f){var _0x411a8e=function(_0x2f933e){while(--_0x2f933e){_0x3e5442['push'](_0x3e5442['shift']());}};_0x411a8e(++_0x7ef17f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x131e40,_0x36921c){var _0x4ef164=function(_0xf49672){while(--_0xf49672){_0x131e40['push'](_0x131e40['shift']());}};_0x4ef164(++_0x36921c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index be94a2e..237cd5b 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 _0xaa3f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserMailQueue,\x20%s,\x20%s','catch','lodash','util'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x31317e,_0x2ccb12){_0x31317e=_0x31317e-0x0;var _0x45ae37=_0xaa3f[_0x31317e];return _0x45ae37;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeecce5,_0x352958,_0xbf270c){return new BPromise(function(_0x328d5f,_0x2e422d){return client[_0xfaa3('0xb')](_0xeecce5,_0xbf270c)['then'](function(_0x37bcd5){logger[_0xfaa3('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x352958,'request\x20sent');logger[_0xfaa3('0xd')](_0xfaa3('0xe'),_0x352958,_0xfaa3('0xf'),JSON[_0xfaa3('0x10')](_0x37bcd5));if(_0x37bcd5[_0xfaa3('0x11')]){if(_0x37bcd5[_0xfaa3('0x11')]['code']===0x1f4){logger[_0xfaa3('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x2e422d(_0x37bcd5[_0xfaa3('0x11')]['message']);}logger[_0xfaa3('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x328d5f(_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);}else{logger[_0xfaa3('0xc')](_0xfaa3('0x13'),_0x352958,'request\x20sent');_0x328d5f(_0x37bcd5['result'][_0xfaa3('0x12')]);}})[_0xfaa3('0x14')](function(_0x407384){logger[_0xfaa3('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x352958,_0x407384);_0x2e422d(_0x407384);});});} \ No newline at end of file +var _0x3cb7=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0x3cb7,0xcf));var _0x73cb=function(_0x487702,_0x49f5d4){_0x487702=_0x487702-0x0;var _0x5e7150=_0x3cb7[_0x487702];return _0x5e7150;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28c95e,_0x1a3637,_0x2319d0){return new BPromise(function(_0x40d9d2,_0x4aab5e){return client[_0x73cb('0xa')](_0x28c95e,_0x2319d0)[_0x73cb('0xb')](function(_0x680a54){logger[_0x73cb('0xc')](_0x73cb('0xd'),_0x1a3637,_0x73cb('0xe'));logger[_0x73cb('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x1a3637,_0x73cb('0xe'),JSON[_0x73cb('0x10')](_0x680a54));if(_0x680a54[_0x73cb('0x11')]){if(_0x680a54[_0x73cb('0x11')][_0x73cb('0x12')]===0x1f4){logger[_0x73cb('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x1a3637,_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);return _0x4aab5e(_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);}logger[_0x73cb('0x11')](_0x73cb('0xd'),_0x1a3637,_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);return _0x40d9d2(_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x1a3637,'request\x20sent');_0x40d9d2(_0x680a54[_0x73cb('0x14')][_0x73cb('0x13')]);}})[_0x73cb('0x15')](function(_0x199988){logger[_0x73cb('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x1a3637,_0x199988);_0x4aab5e(_0x199988);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9a8807f..06e343e 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 _0x9b43=['express','Router','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x5d7616,_0x2be566){var _0x4f5e7b=function(_0xc31d7b){while(--_0xc31d7b){_0x5d7616['push'](_0x5d7616['shift']());}};_0x4f5e7b(++_0x2be566);}(_0x9b43,0x15b));var _0x39b4=function(_0x2df042,_0x2b2f42){_0x2df042=_0x2df042-0x0;var _0x5e3ad0=_0x9b43[_0x2df042];return _0x5e3ad0;};'use strict';var multer=require(_0x39b4('0x0'));var util=require(_0x39b4('0x1'));var path=require(_0x39b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x39b4('0x3'));var router=express[_0x39b4('0x4')]();var auth=require(_0x39b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39b4('0x6'));module['exports']=router; \ No newline at end of file +var _0xbb6b=['Router','../../components/interaction/service','exports','multer','util','connect-timeout','express'];(function(_0x2b76c0,_0x3ae2cd){var _0x3eed54=function(_0x15a559){while(--_0x15a559){_0x2b76c0['push'](_0x2b76c0['shift']());}};_0x3eed54(++_0x3ae2cd);}(_0xbb6b,0x1ed));var _0xbbb6=function(_0x57418e,_0x35a1b3){_0x57418e=_0x57418e-0x0;var _0x595be1=_0xbb6b[_0x57418e];return _0x595be1;};'use strict';var multer=require(_0xbbb6('0x0'));var util=require(_0xbbb6('0x1'));var path=require('path');var timeout=require(_0xbbb6('0x2'));var express=require(_0xbbb6('0x3'));var router=express[_0xbbb6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbb6('0x5'));var config=require('../../config/environment');module[_0xbbb6('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 a35afba..43606e4 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(_0x5801d7,_0x2a4d94){var _0x363808=function(_0x5d18ab){while(--_0x5d18ab){_0x5801d7['push'](_0x5801d7['shift']());}};_0x363808(++_0x2a4d94);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x340f2d,_0x13708e){var _0x7f3e4f=function(_0x58ea2e){while(--_0x58ea2e){_0x340f2d['push'](_0x340f2d['shift']());}};_0x7f3e4f(++_0x13708e);}(_0xe706,0xa3));var _0x6e70=function(_0x414810,_0x5e924d){_0x414810=_0x414810-0x0;var _0x2d4df5=_0xe706[_0x414810];return _0x2d4df5;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index afdd98d..31f4cae 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 _0x5984=['util','api','bluebird','request-promise','path','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x541066,_0x553b7a){var _0x2698e4=function(_0x8a0de4){while(--_0x8a0de4){_0x541066['push'](_0x541066['shift']());}};_0x2698e4(++_0x553b7a);}(_0x5984,0x105));var _0x4598=function(_0x301f88,_0x3efe41){_0x301f88=_0x301f88-0x0;var _0xcf80f8=_0x5984[_0x301f88];return _0xcf80f8;};'use strict';var _=require('lodash');var util=require(_0x4598('0x0'));var logger=require('../../config/logger')(_0x4598('0x1'));var moment=require('moment');var BPromise=require(_0x4598('0x2'));var rp=require(_0x4598('0x3'));var fs=require('fs');var path=require(_0x4598('0x4'));var rimraf=require('rimraf');var config=require(_0x4598('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x3e01c4,_0x45c676){return _0x3e01c4[_0x4598('0x6')](_0x4598('0x7'),attributes,{'tableName':_0x4598('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5827=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x4e0ab8,_0x401afb){var _0x4c1f40=function(_0x7f95ef){while(--_0x7f95ef){_0x4e0ab8['push'](_0x4e0ab8['shift']());}};_0x4c1f40(++_0x401afb);}(_0x5827,0x107));var _0x7582=function(_0x15194c,_0x5ca287){_0x15194c=_0x15194c-0x0;var _0x312a9a=_0x5827[_0x15194c];return _0x312a9a;};'use strict';var _=require(_0x7582('0x0'));var util=require('util');var logger=require(_0x7582('0x1'))(_0x7582('0x2'));var moment=require(_0x7582('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7582('0x4'));var rimraf=require('rimraf');var config=require(_0x7582('0x5'));var attributes=require(_0x7582('0x6'));module['exports']=function(_0x5b2188,_0xbb49a7){return _0x5b2188['define'](_0x7582('0x7'),attributes,{'tableName':_0x7582('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 76f35f5..1e7d47f 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 _0x0439=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xfcfc35,_0x41125e){var _0x13a3c7=function(_0x594a49){while(--_0x594a49){_0xfcfc35['push'](_0xfcfc35['shift']());}};_0x13a3c7(++_0x41125e);}(_0x0439,0x14c));var _0x9043=function(_0x1acb07,_0x44fa67){_0x1acb07=_0x1acb07-0x0;var _0x4df84e=_0x0439[_0x1acb07];return _0x4df84e;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require(_0x9043('0x7'));var logger=require(_0x9043('0x8'))(_0x9043('0x9'));var config=require(_0x9043('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xb')][_0x9043('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25acec,_0x231c54,_0x3d0080){return new BPromise(function(_0x4e2ce4,_0x4fc2df){return client[_0x9043('0xd')](_0x25acec,_0x3d0080)[_0x9043('0xe')](function(_0x4b5e90){logger[_0x9043('0xf')](_0x9043('0x10'),_0x231c54,'request\x20sent');logger[_0x9043('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x231c54,'request\x20sent',JSON['stringify'](_0x4b5e90));if(_0x4b5e90[_0x9043('0x12')]){if(_0x4b5e90[_0x9043('0x12')][_0x9043('0x13')]===0x1f4){logger[_0x9043('0x12')](_0x9043('0x10'),_0x231c54,_0x4b5e90[_0x9043('0x12')]['message']);return _0x4fc2df(_0x4b5e90[_0x9043('0x12')][_0x9043('0x14')]);}logger[_0x9043('0x12')](_0x9043('0x10'),_0x231c54,_0x4b5e90[_0x9043('0x12')][_0x9043('0x14')]);return _0x4e2ce4(_0x4b5e90[_0x9043('0x12')][_0x9043('0x14')]);}else{logger[_0x9043('0xf')](_0x9043('0x10'),_0x231c54,_0x9043('0x15'));_0x4e2ce4(_0x4b5e90['result'][_0x9043('0x14')]);}})[_0x9043('0x16')](function(_0x5b17e0){logger[_0x9043('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x231c54,_0x5b17e0);_0x4fc2df(_0x5b17e0);});});} \ No newline at end of file +var _0x0dad=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x53b10f,_0x4bda8e){var _0x3b39e8=function(_0x3f305f){while(--_0x3f305f){_0x53b10f['push'](_0x53b10f['shift']());}};_0x3b39e8(++_0x4bda8e);}(_0x0dad,0xa8));var _0xd0da=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x0dad[_0x26b5ff];return _0x58603e;};'use strict';var _=require('lodash');var util=require(_0xd0da('0x0'));var moment=require(_0xd0da('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0da('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0da('0x4'))('rpc');var config=require(_0xd0da('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd0da('0x6')][_0xd0da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2eb959,_0x4af897,_0x116c5e){return new BPromise(function(_0x3de1a6,_0x38a164){return client[_0xd0da('0x8')](_0x2eb959,_0x116c5e)[_0xd0da('0x9')](function(_0x4c5e2a){logger[_0xd0da('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af897,_0xd0da('0xb'));logger[_0xd0da('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4af897,'request\x20sent',JSON[_0xd0da('0xd')](_0x4c5e2a));if(_0x4c5e2a[_0xd0da('0xe')]){if(_0x4c5e2a[_0xd0da('0xe')][_0xd0da('0xf')]===0x1f4){logger[_0xd0da('0xe')](_0xd0da('0x10'),_0x4af897,_0x4c5e2a[_0xd0da('0xe')][_0xd0da('0x11')]);return _0x38a164(_0x4c5e2a[_0xd0da('0xe')]['message']);}logger[_0xd0da('0xe')](_0xd0da('0x10'),_0x4af897,_0x4c5e2a['error']['message']);return _0x3de1a6(_0x4c5e2a[_0xd0da('0xe')][_0xd0da('0x11')]);}else{logger[_0xd0da('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af897,_0xd0da('0xb'));_0x3de1a6(_0x4c5e2a[_0xd0da('0x12')][_0xd0da('0x11')]);}})['catch'](function(_0x376984){logger[_0xd0da('0xe')](_0xd0da('0x10'),_0x4af897,_0x376984);_0x38a164(_0x376984);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2b42543..752a652 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 _0x1b1f=['exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get','getSections','/:id/resources','getResources','post','create','clone','/:id/sections','addSections','addResources','put','delete','destroy','removeSections','removeResources'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1b1f,0x151));var _0xf1b1=function(_0x595975,_0x59b4e6){_0x595975=_0x595975-0x0;var _0x453482=_0x1b1f[_0x595975];return _0x453482;};'use strict';var multer=require(_0xf1b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf1b1('0x1'));var express=require(_0xf1b1('0x2'));var router=express['Router']();var auth=require(_0xf1b1('0x3'));var interaction=require(_0xf1b1('0x4'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0xf1b1('0x5')](),controller[_0xf1b1('0x6')]);router['get']('/describe',auth[_0xf1b1('0x5')](),controller['describe']);router['get'](_0xf1b1('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xf1b1('0x8')]('/:id/sections',auth['isAuthenticated'](),controller[_0xf1b1('0x9')]);router[_0xf1b1('0x8')](_0xf1b1('0xa'),auth['isAuthenticated'](),controller[_0xf1b1('0xb')]);router[_0xf1b1('0xc')]('/',auth[_0xf1b1('0x5')](),controller[_0xf1b1('0xd')]);router[_0xf1b1('0xc')]('/:id/clone',auth[_0xf1b1('0x5')](),controller[_0xf1b1('0xe')]);router[_0xf1b1('0xc')](_0xf1b1('0xf'),auth[_0xf1b1('0x5')](),controller[_0xf1b1('0x10')]);router[_0xf1b1('0xc')](_0xf1b1('0xa'),auth[_0xf1b1('0x5')](),controller[_0xf1b1('0x11')]);router[_0xf1b1('0x12')](_0xf1b1('0x7'),auth[_0xf1b1('0x5')](),controller['update']);router[_0xf1b1('0x13')](_0xf1b1('0x7'),auth[_0xf1b1('0x5')](),controller[_0xf1b1('0x14')]);router[_0xf1b1('0x13')](_0xf1b1('0xf'),auth[_0xf1b1('0x5')](),controller[_0xf1b1('0x15')]);router[_0xf1b1('0x13')](_0xf1b1('0xa'),auth['isAuthenticated'](),controller[_0xf1b1('0x16')]);module[_0xf1b1('0x17')]=router; \ No newline at end of file +var _0xa1b0=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','describe','show','getSections','/:id/resources','getResources','post','clone','/:id/sections','addSections','addResources','update','delete','/:id','destroy'];(function(_0x53af70,_0xd47426){var _0x4893ed=function(_0x556eaf){while(--_0x556eaf){_0x53af70['push'](_0x53af70['shift']());}};_0x4893ed(++_0xd47426);}(_0xa1b0,0xd1));var _0x0a1b=function(_0x44aecb,_0xe2912){_0x44aecb=_0x44aecb-0x0;var _0x21eecd=_0xa1b0[_0x44aecb];return _0x21eecd;};'use strict';var multer=require(_0x0a1b('0x0'));var util=require(_0x0a1b('0x1'));var path=require(_0x0a1b('0x2'));var timeout=require(_0x0a1b('0x3'));var express=require(_0x0a1b('0x4'));var router=express[_0x0a1b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a1b('0x6'));var config=require('../../config/environment');var controller=require(_0x0a1b('0x7'));router[_0x0a1b('0x8')]('/',auth[_0x0a1b('0x9')](),controller['index']);router['get'](_0x0a1b('0xa'),auth['isAuthenticated'](),controller[_0x0a1b('0xb')]);router[_0x0a1b('0x8')]('/:id',auth[_0x0a1b('0x9')](),controller[_0x0a1b('0xc')]);router['get']('/:id/sections',auth[_0x0a1b('0x9')](),controller[_0x0a1b('0xd')]);router['get'](_0x0a1b('0xe'),auth[_0x0a1b('0x9')](),controller[_0x0a1b('0xf')]);router[_0x0a1b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x0a1b('0x9')](),controller[_0x0a1b('0x11')]);router[_0x0a1b('0x10')](_0x0a1b('0x12'),auth[_0x0a1b('0x9')](),controller[_0x0a1b('0x13')]);router[_0x0a1b('0x10')]('/:id/resources',auth[_0x0a1b('0x9')](),controller[_0x0a1b('0x14')]);router['put']('/:id',auth[_0x0a1b('0x9')](),controller[_0x0a1b('0x15')]);router[_0x0a1b('0x16')](_0x0a1b('0x17'),auth['isAuthenticated'](),controller[_0x0a1b('0x18')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x0a1b('0x16')](_0x0a1b('0xe'),auth[_0x0a1b('0x9')](),controller['removeResources']);module[_0x0a1b('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5a1e95c..3c79301 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 _0xb4e2=['sequelize','name','crudPermissions','join','getDataValue','split'];(function(_0x5a8716,_0x3b07f7){var _0x52b405=function(_0x12e3c2){while(--_0x12e3c2){_0x5a8716['push'](_0x5a8716['shift']());}};_0x52b405(++_0x3b07f7);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x4af97f,_0x5d9f70){_0x4af97f=_0x4af97f-0x0;var _0x246a99=_0xb4e2[_0x4af97f];return _0x246a99;};'use strict';var Sequelize=require(_0x2b4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b4e('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4b0499){this['setDataValue'](_0x2b4e('0x2'),_0x4b0499?_0x4b0499[_0x2b4e('0x3')](''):[]);},'get':function(){return this[_0x2b4e('0x4')](_0x2b4e('0x2'))?this[_0x2b4e('0x4')](_0x2b4e('0x2'))[_0x2b4e('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x1336=['split','sequelize','STRING','name','setDataValue','getDataValue','crudPermissions'];(function(_0x2f4470,_0x3d4fa4){var _0x4b98a8=function(_0x40cd4c){while(--_0x40cd4c){_0x2f4470['push'](_0x2f4470['shift']());}};_0x4b98a8(++_0x3d4fa4);}(_0x1336,0xe1));var _0x6133=function(_0x154b74,_0x282bc5){_0x154b74=_0x154b74-0x0;var _0x44d768=_0x1336[_0x154b74];return _0x44d768;};'use strict';var Sequelize=require(_0x6133('0x0'));module['exports']={'name':{'type':Sequelize[_0x6133('0x1')],'allowNull':![],'unique':_0x6133('0x2')},'crudPermissions':{'type':Sequelize[_0x6133('0x1')],'set':function(_0x1091f5){this[_0x6133('0x3')]('crudPermissions',_0x1091f5?_0x1091f5['join'](''):[]);},'get':function(){return this[_0x6133('0x4')]('crudPermissions')?this['getDataValue'](_0x6133('0x5'))[_0x6133('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6133('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index aa19a24..4ae845b 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 _0x9422=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','Content-Range','reject','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','create','clone','options','find','get','omit','createdAt','crudPermissions','body','updatedAt','transaction','UserProfileSection','each','autoAssociation','findAll','userProfileId','UserProfileResource','Resources','describe','push','removeSections','getSections','enabled','includes','isEmpty','sectionId','subsections','Dashboard','Plugin','forEach','addResources','sequelize','bulkCreate','removeResources','ids','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','parentSections','all','ignore','union','childModel','nolimit','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','Agents','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoicePrefix','mailqueues','mailaccounts','mailsubstatuses','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','teams','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','Sound','tags','Trigger','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9422,0xe3));var _0x2942=function(_0x182b7a,_0x4044db){_0x182b7a=_0x182b7a-0x0;var _0x29f145=_0x9422[_0x182b7a];return _0x29f145;};'use strict';var pdf=require(_0x2942('0x0'));var emlformat=require(_0x2942('0x1'));var rimraf=require(_0x2942('0x2'));var zipdir=require(_0x2942('0x3'));var jsonpatch=require(_0x2942('0x4'));var rp=require(_0x2942('0x5'));var moment=require(_0x2942('0x6'));var BPromise=require(_0x2942('0x7'));var Mustache=require(_0x2942('0x8'));var util=require(_0x2942('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x2942('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2942('0xb'));var squel=require(_0x2942('0xc'));var crypto=require(_0x2942('0xd'));var jsforce=require(_0x2942('0xe'));var deskjs=require(_0x2942('0xf'));var toCsv=require(_0x2942('0xa'));var querystring=require(_0x2942('0x10'));var Papa=require(_0x2942('0x11'));var Redis=require(_0x2942('0x12'));var authService=require(_0x2942('0x13'));var qs=require(_0x2942('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2942('0x15'))(_0x2942('0x16'));var utils=require('../../config/utils');var config=require(_0x2942('0x17'));var db=require(_0x2942('0x18'))['db'];config['redis']=_['defaults'](config[_0x2942('0x19')],{'host':_0x2942('0x1a'),'port':0x18eb});var socket=require(_0x2942('0x1b'))(new Redis(config[_0x2942('0x19')]));require(_0x2942('0x1c'))[_0x2942('0x1d')](socket);function respondWithStatusCode(_0x93b7cd,_0x157a1d){_0x157a1d=_0x157a1d||0xcc;return function(_0x250d91){if(_0x250d91){return _0x93b7cd[_0x2942('0x1e')](_0x157a1d);}return _0x93b7cd[_0x2942('0x1f')](_0x157a1d)[_0x2942('0x20')]();};}function respondWithResult(_0x3f2206,_0xc830ba){_0xc830ba=_0xc830ba||0xc8;return function(_0x2e6b5d){if(_0x2e6b5d){return _0x3f2206['status'](_0xc830ba)['json'](_0x2e6b5d);}};}function respondWithFilteredResult(_0x216bf4,_0x3f22a3){return function(_0x490013){if(_0x490013){var _0x19beae=_0x490013[_0x2942('0x21')],_0x42f04b=_0x3f22a3[_0x2942('0x22')],_0x5c3765=_0x3f22a3['offset']+_0x3f22a3['limit'],_0x378e7e;if(_0x5c3765>=_0x19beae){_0x5c3765=_0x19beae;_0x378e7e=0xc8;}else{_0x378e7e=0xce;}_0x216bf4['status'](_0x378e7e);return _0x216bf4['set'](_0x2942('0x23'),_0x42f04b+'-'+_0x5c3765+'/'+_0x19beae)['json'](_0x490013);}return null;};}function patchUpdates(_0x345b56){return function(_0x35ef73){try{jsonpatch['apply'](_0x35ef73,_0x345b56,!![]);}catch(_0x55a33c){return BPromise[_0x2942('0x24')](_0x55a33c);}return _0x35ef73['save']();};}function saveUpdates(_0xaa7265,_0xbfded){return function(_0x7a1dac){if(_0x7a1dac){return _0x7a1dac[_0x2942('0x25')](_0xaa7265)[_0x2942('0x26')](function(_0x48a110){return _0x48a110;});}return null;};}function removeEntity(_0x5f179d,_0x37c4f7){return function(_0x3293de){if(_0x3293de){return _0x3293de[_0x2942('0x27')]()[_0x2942('0x26')](function(){_0x5f179d[_0x2942('0x1f')](0xcc)[_0x2942('0x20')]();});}};}function handleEntityNotFound(_0x1fa077,_0x4eb93d){return function(_0x5ad0b0){if(!_0x5ad0b0){_0x1fa077[_0x2942('0x1e')](0x194);}return _0x5ad0b0;};}function handleError(_0x36f977,_0x1a3cb0){_0x1a3cb0=_0x1a3cb0||0x1f4;return function(_0x2841e5){logger[_0x2942('0x28')](_0x2841e5['stack']);if(_0x2841e5['name']){delete _0x2841e5[_0x2942('0x29')];}_0x36f977[_0x2942('0x1f')](_0x1a3cb0)[_0x2942('0x2a')](_0x2841e5);};}exports[_0x2942('0x2b')]=function(_0x9121,_0x3c8cf2){var _0x16045b={},_0x4837d1={},_0x13f98d={'count':0x0,'rows':[]};var _0x5f1364=_[_0x2942('0x2c')](db[_0x2942('0x2d')][_0x2942('0x2e')],function(_0x492a7f){return{'name':_0x492a7f[_0x2942('0x2f')],'type':_0x492a7f[_0x2942('0x30')][_0x2942('0x31')]};});_0x4837d1[_0x2942('0x32')]=_[_0x2942('0x2c')](_0x5f1364,_0x2942('0x29'));_0x4837d1['query']=_[_0x2942('0x33')](_0x9121[_0x2942('0x34')]);_0x4837d1[_0x2942('0x35')]=_[_0x2942('0x36')](_0x4837d1[_0x2942('0x32')],_0x4837d1[_0x2942('0x34')]);_0x16045b[_0x2942('0x37')]=_[_0x2942('0x36')](_0x4837d1[_0x2942('0x32')],qs['fields'](_0x9121[_0x2942('0x34')][_0x2942('0x38')]));_0x16045b[_0x2942('0x37')]=_0x16045b['attributes'][_0x2942('0x39')]?_0x16045b[_0x2942('0x37')]:_0x4837d1[_0x2942('0x32')];if(!_0x9121[_0x2942('0x34')][_0x2942('0x3a')]('nolimit')){_0x16045b[_0x2942('0x3b')]=qs[_0x2942('0x3b')](_0x9121[_0x2942('0x34')][_0x2942('0x3b')]);_0x16045b['offset']=qs[_0x2942('0x22')](_0x9121['query']['offset']);}_0x16045b[_0x2942('0x3c')]=qs[_0x2942('0x3d')](_0x9121['query'][_0x2942('0x3d')]);_0x16045b[_0x2942('0x3e')]=qs[_0x2942('0x35')](_[_0x2942('0x3f')](_0x9121[_0x2942('0x34')],_0x4837d1[_0x2942('0x35')]),_0x5f1364);if(_0x9121[_0x2942('0x34')][_0x2942('0x40')]){_0x16045b[_0x2942('0x3e')]=_[_0x2942('0x41')](_0x16045b['where'],{'$or':_[_0x2942('0x2c')](_0x5f1364,function(_0x1d0c81){if(_0x1d0c81[_0x2942('0x30')]!==_0x2942('0x42')){var _0x5a5906={};_0x5a5906[_0x1d0c81[_0x2942('0x29')]]={'$like':'%'+_0x9121[_0x2942('0x34')][_0x2942('0x40')]+'%'};return _0x5a5906;}})});}_0x16045b=_[_0x2942('0x41')]({},_0x16045b,_0x9121['options']);var _0x5b9578={'where':_0x16045b[_0x2942('0x3e')]};return db[_0x2942('0x2d')]['count'](_0x5b9578)[_0x2942('0x26')](function(_0x53fc84){_0x13f98d['count']=_0x53fc84;if(_0x9121[_0x2942('0x34')][_0x2942('0x43')]){_0x16045b[_0x2942('0x44')]=[{'all':!![]}];}return db[_0x2942('0x2d')]['findAll'](_0x16045b);})[_0x2942('0x26')](function(_0x1d7d2a){_0x13f98d[_0x2942('0x45')]=_0x1d7d2a;return _0x13f98d;})[_0x2942('0x26')](respondWithFilteredResult(_0x3c8cf2,_0x16045b))[_0x2942('0x46')](handleError(_0x3c8cf2,null));};exports[_0x2942('0x47')]=function(_0x28efc0,_0x42534c){var _0xb82631={'raw':![],'where':{'id':_0x28efc0[_0x2942('0x48')]['id']}},_0x223feb={};_0x223feb[_0x2942('0x32')]=_[_0x2942('0x33')](db[_0x2942('0x2d')][_0x2942('0x2e')]);_0x223feb[_0x2942('0x34')]=_[_0x2942('0x33')](_0x28efc0[_0x2942('0x34')]);_0x223feb['filters']=_[_0x2942('0x36')](_0x223feb[_0x2942('0x32')],_0x223feb[_0x2942('0x34')]);_0xb82631[_0x2942('0x37')]=_[_0x2942('0x36')](_0x223feb[_0x2942('0x32')],qs[_0x2942('0x38')](_0x28efc0['query']['fields']));_0xb82631['attributes']=_0xb82631[_0x2942('0x37')][_0x2942('0x39')]?_0xb82631[_0x2942('0x37')]:_0x223feb[_0x2942('0x32')];if(_0x28efc0[_0x2942('0x34')]['includeAll']){_0xb82631[_0x2942('0x44')]=[{'all':!![]}];}_0xb82631=_[_0x2942('0x41')]({},_0xb82631,_0x28efc0['options']);return db[_0x2942('0x2d')]['find'](_0xb82631)['then'](handleEntityNotFound(_0x42534c,null))[_0x2942('0x26')](respondWithResult(_0x42534c,null))['catch'](handleError(_0x42534c,null));};exports['create']=function(_0x1bac35,_0x107de6){return db[_0x2942('0x2d')][_0x2942('0x49')](_0x1bac35['body'],{})[_0x2942('0x26')](respondWithResult(_0x107de6,0xc9))[_0x2942('0x46')](handleError(_0x107de6,null));};exports[_0x2942('0x4a')]=function(_0x853f9,_0x8fa161){var _0x1cf6f3={'where':{'id':_0x853f9[_0x2942('0x48')]['id']}},_0x28c73d={};_0x28c73d[_0x2942('0x32')]=_[_0x2942('0x33')](db[_0x2942('0x2d')][_0x2942('0x2e')]);_0x1cf6f3[_0x2942('0x37')]=_[_0x2942('0x36')](_0x28c73d['model'],qs['fields'](_0x853f9[_0x2942('0x34')]['fields']));_0x1cf6f3['attributes']=_0x1cf6f3[_0x2942('0x37')][_0x2942('0x39')]?_0x1cf6f3['attributes']:_0x28c73d[_0x2942('0x32')];if(_0x853f9['query']['includeAll']){_0x1cf6f3['include']=[{'all':!![]}];}_0x1cf6f3=_[_0x2942('0x41')]({},_0x1cf6f3,_0x853f9[_0x2942('0x4b')]);return db[_0x2942('0x2d')][_0x2942('0x4c')](_0x1cf6f3)[_0x2942('0x26')](handleEntityNotFound(_0x8fa161,null))[_0x2942('0x26')](function(_0x2b8cc3){if(_0x2b8cc3){var _0x412e93=_0x2b8cc3[_0x2942('0x4d')]({'plain':!![]});_0x412e93=qs[_0x2942('0x4e')](_0x412e93,['id',_0x2942('0x4f'),'updatedAt',_0x2942('0x50')]);_0x853f9['body']=_['omit'](_0x853f9[_0x2942('0x51')],['id',_0x2942('0x4f'),_0x2942('0x52')]);return db['sequelize'][_0x2942('0x53')](function(_0x17c729){return db['UserProfile'][_0x2942('0x49')](_[_0x2942('0x41')](_0x412e93,_0x853f9[_0x2942('0x51')]),{'include':_0x853f9[_0x2942('0x34')][_0x2942('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x17c729})[_0x2942('0x26')](function(_0x211ad8){var _0x493f4f=_0x211ad8[_0x2942('0x4d')]({'plain':!![]});return db[_0x2942('0x54')]['findAll']({'where':{'userProfileId':_0x853f9[_0x2942('0x48')]['id']},'raw':!![]})[_0x2942('0x26')](function(_0x7c620f){if(_0x7c620f){return BPromise[_0x2942('0x55')](_0x7c620f,function(_0x421fe2){return new BPromise(function(_0xbe9cc7,_0x1b90f3){if(_0x421fe2[_0x2942('0x56')]===null||_0x421fe2['autoAssociation']===0x1)_0xbe9cc7(null);return db['UserProfileResource'][_0x2942('0x57')]({'where':{'sectionId':_0x421fe2['id']},'raw':!![]})[_0x2942('0x26')](function(_0x38871f){var _0x15afdc=_[_0x2942('0x2c')](_0x38871f,function(_0x18daca){return qs[_0x2942('0x4e')](_0x18daca,['id','createdAt',_0x2942('0x52'),'sectionId']);});_0xbe9cc7(_0x15afdc);})[_0x2942('0x46')](function(_0x448c4d){_0x1b90f3(_0x448c4d);});})['then'](function(_0x18f538){var _0x4d34c7=qs[_0x2942('0x4e')](_0x421fe2,['id',_0x2942('0x4f'),'updatedAt']);_0x4d34c7[_0x2942('0x58')]=_0x493f4f['id'];if(_0x18f538)_0x4d34c7['Resources']=_0x18f538;return _0x4d34c7;})['then'](function(_0x2f33a0){return db[_0x2942('0x54')][_0x2942('0x49')](_0x2f33a0,{'include':[{'model':db[_0x2942('0x59')],'as':_0x2942('0x5a')}],'raw':!![],'transaction':_0x17c729});});})['then'](function(){return _0x493f4f;});}});});});}})[_0x2942('0x26')](respondWithResult(_0x8fa161,0xc9))[_0x2942('0x46')](handleError(_0x8fa161,null));};exports[_0x2942('0x25')]=function(_0x219e0f,_0x316fa4){if(_0x219e0f[_0x2942('0x51')]['id']){delete _0x219e0f['body']['id'];}return db[_0x2942('0x2d')][_0x2942('0x4c')]({'where':{'id':_0x219e0f[_0x2942('0x48')]['id']}})[_0x2942('0x26')](handleEntityNotFound(_0x316fa4,null))[_0x2942('0x26')](saveUpdates(_0x219e0f[_0x2942('0x51')],null))[_0x2942('0x26')](respondWithResult(_0x316fa4,null))[_0x2942('0x46')](handleError(_0x316fa4,null));};exports['destroy']=function(_0x562581,_0x4601b3){return db[_0x2942('0x2d')][_0x2942('0x4c')]({'where':{'id':_0x562581[_0x2942('0x48')]['id']}})['then'](handleEntityNotFound(_0x4601b3,null))['then'](removeEntity(_0x4601b3,null))['catch'](handleError(_0x4601b3,null));};exports[_0x2942('0x5b')]=function(_0x16d4b7,_0x39bb1c){return db[_0x2942('0x2d')][_0x2942('0x5b')]()['then'](respondWithResult(_0x39bb1c,null))['catch'](handleError(_0x39bb1c,null));};exports['addSections']=function(_0x3990e1,_0x226ae4){var _0x1ee355=_0x3990e1[_0x2942('0x51')];return db[_0x2942('0x2d')][_0x2942('0x4c')]({'where':{'id':_0x3990e1[_0x2942('0x48')]['id']}})[_0x2942('0x26')](handleEntityNotFound(_0x226ae4,null))[_0x2942('0x26')](function(_0x5afae5){if(_0x5afae5){return db['sequelize'][_0x2942('0x53')](function(_0x1d16d6){return db[_0x2942('0x54')][_0x2942('0x27')]({'where':{'userProfileId':_0x3990e1[_0x2942('0x48')]['id'],'sectionId':_['map'](_0x1ee355,function(_0x332a1e){return _0x332a1e['sectionId'];})},'transaction':_0x1d16d6})[_0x2942('0x26')](function(){var _0x3d734c=_[_0x2942('0x2c')](_0x1ee355,function(_0x5d8036){_0x5d8036[_0x2942('0x58')]=_0x3990e1[_0x2942('0x48')]['id'];return _0x5d8036;});var _0x5b027d=[];return BPromise[_0x2942('0x55')](_0x3d734c,function(_0x435c03){return db['UserProfileSection']['create'](_0x435c03,{'include':[{'model':db['UserProfileResource'],'as':_0x2942('0x5a')}],'raw':!![],'transaction':_0x1d16d6})[_0x2942('0x26')](function(_0x457e2e){_0x5b027d[_0x2942('0x5c')](_0x457e2e[_0x2942('0x4d')]({'plain':!![]}));});})[_0x2942('0x26')](function(){return _0x5b027d;});});});}})[_0x2942('0x26')](function(_0x28bca7){return _0x28bca7;})['then'](respondWithResult(_0x226ae4,null))[_0x2942('0x46')](handleError(_0x226ae4,null));};exports[_0x2942('0x5d')]=function(_0x4c4972,_0x141eda){var _0xd99a0e;return db[_0x2942('0x2d')]['find']({'where':{'id':_0x4c4972[_0x2942('0x48')]['id']},'attributes':['id',_0x2942('0x29')]})['then'](handleEntityNotFound(_0x141eda,null))[_0x2942('0x26')](function(_0x1e6383){if(_0x1e6383){_0xd99a0e=_0x1e6383;return db['UserProfileSection'][_0x2942('0x27')]({'where':{'userProfileId':_0x4c4972[_0x2942('0x48')]['id'],'sectionId':_0x4c4972[_0x2942('0x34')]['ids']}});}})['then'](function(){return _0xd99a0e;})[_0x2942('0x26')](respondWithStatusCode(_0x141eda,null))[_0x2942('0x46')](handleError(_0x141eda,null));};exports[_0x2942('0x5e')]=function(_0x108229,_0x5cf381){var _0x109786=[];var _0x580bbc=[];return db[_0x2942('0x54')][_0x2942('0x57')]({'where':{'userProfileId':_0x108229['params']['id']},'raw':!![]})[_0x2942('0x26')](function(_0x5dc274){_0x109786=_[_0x2942('0x40')](_0x5dc274,function(_0x152cb7){return _0x152cb7[_0x2942('0x5f')]===0x1||_[_0x2942('0x60')]([0x3eb,0x709],_0x152cb7['sectionId']);});if(!_[_0x2942('0x61')](_0x109786)){return _[_0x2942('0x2c')](_0x109786,function(_0x2b6831){return _0x2b6831[_0x2942('0x62')];});}else{return;}})[_0x2942('0x26')](function(_0x173d85){if(_0x173d85)_0x580bbc=_0x173d85;if(_[_0x2942('0x60')](_0x580bbc,0x64)){var _0x4b1df1=_[_0x2942('0x4c')](_0x109786,{'sectionId':0x64});return hasDefaultDashboard(_0x4b1df1)[_0x2942('0x26')](function(_0x29c94b){return _[_0x2942('0x2c')](_0x109786,function(_0x1ce95f){if(_0x1ce95f['sectionId']===0x64){_0x1ce95f[_0x2942('0x63')]=_0x29c94b;}return _0x1ce95f;});});}else{return;}})[_0x2942('0x26')](function(_0x5796f8){if(_0x5796f8)_0x109786=_0x5796f8;if(_[_0x2942('0x60')](_0x580bbc,0x3eb)){var _0x5e0243=_['find'](_0x109786,{'sectionId':0x3eb});return getCustomDashboards(_0x5e0243)['then'](function(_0x359405){return _['map'](_0x109786,function(_0x415545){if(_0x5e0243['enabled']){if(_0x415545[_0x2942('0x62')]===0x3eb){_0x415545[_0x2942('0x63')]=_0x359405;}}else{if(_0x415545[_0x2942('0x62')]===0x64){_0x415545['subsections']=_0x359405;}}return _0x415545;});});}else{return;}})[_0x2942('0x26')](function(_0xb6389a){if(_0xb6389a)_0x109786=_0xb6389a;if(_[_0x2942('0x60')](_0x580bbc,0x709)){var _0x3aab6e=_[_0x2942('0x4c')](_0x109786,{'sectionId':0x709});return getPlugins(_0x3aab6e)[_0x2942('0x26')](function(_0x34ee2b){if(_0x3aab6e['enabled']){return _[_0x2942('0x2c')](_0x109786,function(_0x34f28e){if(_0x34f28e[_0x2942('0x62')]===0x709){_0x34f28e[_0x2942('0x63')]=_0x34ee2b;}return _0x34f28e;});}else{var _0x2d98c4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34ee2b};var _0x15b0c5=_[_0x2942('0x2c')](_0x109786);_0x15b0c5[_0x2942('0x5c')](_0x2d98c4);return _0x15b0c5;}});}else{return;}})[_0x2942('0x26')](function(_0x398fb4){if(_0x398fb4)_0x109786=_0x398fb4;return _[_0x2942('0x40')](_0x109786,[_0x2942('0x5f'),0x1]);})[_0x2942('0x26')](respondWithResult(_0x5cf381,null))[_0x2942('0x46')](handleError(_0x5cf381,null));};function hasDefaultDashboard(_0x1b423d){var _0x3dacde=[0x65];return new BPromise(function(_0x580d80,_0x6e7dd0){try{if(_0x1b423d[_0x2942('0x56')]){_0x580d80(_0x3dacde);}else{return db[_0x2942('0x59')]['findOne']({'where':{'sectionId':_0x1b423d['id']},'raw':!![]})[_0x2942('0x26')](function(_0x8abfd6){_0x8abfd6?_0x580d80(_0x3dacde):_0x580d80();});}}catch(_0x40583b){_0x6e7dd0(_0x40583b);}});}function getCustomDashboards(_0x353c80){var _0x1cdf7d=[];return new BPromise(function(_0x4238ef,_0x3b597e){try{if(_0x353c80[_0x2942('0x56')]){return db[_0x2942('0x64')][_0x2942('0x57')]({'raw':!![]})[_0x2942('0x26')](function(_0xfd41a4){_0xfd41a4['forEach'](function(_0x8194d2){_0x1cdf7d['push'](_0x8194d2['id']+0x1869f);});_0x4238ef(_0x1cdf7d);});}else{return db[_0x2942('0x59')][_0x2942('0x57')]({'where':{'sectionId':_0x353c80['id']},'raw':!![]})[_0x2942('0x26')](function(_0x4dced0){_0x4dced0['forEach'](function(_0x4c8bda){_0x1cdf7d['push'](_0x4c8bda['resourceId']+0x1869f);});_0x4238ef(_0x1cdf7d);});}}catch(_0x57b0c4){_0x3b597e(_0x57b0c4);}});}function getPlugins(_0x3afd7b){var _0x9f81d=[];return new BPromise(function(_0x3bde8b,_0x25a44d){try{if(_0x3afd7b[_0x2942('0x56')]){return db[_0x2942('0x65')][_0x2942('0x57')]({'raw':!![]})['then'](function(_0x12c2fb){_0x12c2fb[_0x2942('0x66')](function(_0x24d08d){_0x9f81d[_0x2942('0x5c')](_0x24d08d['id']+0x15b38);});_0x3bde8b(_0x9f81d);});}else{return db[_0x2942('0x59')][_0x2942('0x57')]({'where':{'sectionId':_0x3afd7b['id']},'raw':!![]})[_0x2942('0x26')](function(_0x1fb322){_0x1fb322[_0x2942('0x66')](function(_0x336947){_0x9f81d['push'](_0x336947['resourceId']+0x15b38);});_0x3bde8b(_0x9f81d);});}}catch(_0x49f3a4){_0x25a44d(_0x49f3a4);}});}exports[_0x2942('0x67')]=function(_0xa346c4,_0x355711){return db[_0x2942('0x2d')][_0x2942('0x4c')]({'where':{'id':_0xa346c4[_0x2942('0x48')]['id']}})[_0x2942('0x26')](handleEntityNotFound(_0x355711,null))[_0x2942('0x26')](function(_0x5eaec4){if(_0x5eaec4){return db[_0x2942('0x68')][_0x2942('0x53')](function(_0xd14d33){return db[_0x2942('0x54')]['findAll']({'where':{'userProfileId':_0xa346c4[_0x2942('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x230966){if(_0x230966){return db[_0x2942('0x54')][_0x2942('0x27')]({'where':{'userProfileId':_0xa346c4[_0x2942('0x48')]['id'],'id':_[_0x2942('0x2c')](_0x230966,function(_0x5aee42){return _0x5aee42['id'];})},'transaction':_0xd14d33});}})[_0x2942('0x26')](function(_0x4a58a6){var _0x2a1907=_[_0x2942('0x2c')](_0xa346c4[_0x2942('0x51')],function(_0x2cb406){_0x2cb406[_0x2942('0x58')]=_0xa346c4[_0x2942('0x48')]['id'];return _0x2cb406;});return db[_0x2942('0x54')][_0x2942('0x69')](_0x2a1907,{'raw':!![],'transaction':_0xd14d33});})['then'](function(_0x3193f7){var _0x407dc5=_[_0x2942('0x40')](_[_0x2942('0x2c')](_0x3193f7,function(_0x318cc6){return _0x318cc6[_0x2942('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x407dc5){return db[_0x2942('0x54')][_0x2942('0x57')]({'where':{'userProfileId':_0xa346c4[_0x2942('0x48')]['id'],'sectionId':_[_0x2942('0x2c')](_0x407dc5,function(_0x2a7574){return _0x2a7574[_0x2942('0x62')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2942('0x26')](function(_0x310f00){var _0x301a96=_['map'](_0xa346c4[_0x2942('0x51')],function(_0x3d6023){_0x3d6023[_0x2942('0x58')]=_0xa346c4['params']['id'];return _0x3d6023;});return db[_0x2942('0x59')]['bulkCreate'](_0x301a96,{'raw':!![],'transaction':_0xd14d33});});}})[_0x2942('0x46')](handleError(_0x355711,null));});}})['then'](function(_0x31adcf){var _0x3c1c50=_[_0x2942('0x2c')](_0x31adcf,function(_0x3dcd33){return _0x3dcd33[_0x2942('0x4d')]({'plain':!![]});});})[_0x2942('0x26')](respondWithResult(_0x355711,null))[_0x2942('0x46')](handleError(_0x355711,null));};exports['removeResources']=function(_0x2e2d05,_0x1c4f8e,_0x357090){return db[_0x2942('0x2d')][_0x2942('0x4c')]({'where':{'id':_0x2e2d05['params']['id']}})[_0x2942('0x26')](handleEntityNotFound(_0x1c4f8e,null))[_0x2942('0x26')](function(_0xd45514){if(_0xd45514){return _0xd45514[_0x2942('0x6a')](_0x2e2d05[_0x2942('0x34')][_0x2942('0x6b')]);}})[_0x2942('0x26')](respondWithStatusCode(_0x1c4f8e,null))[_0x2942('0x46')](handleError(_0x1c4f8e,null));};exports['getResources']=function(_0x382f2b,_0x3877a7){var _0x5e39a9={'raw':![],'where':{}};var _0x1406e3={};var _0x5eb19c={'count':0x0,'rows':[]};var _0xef0d11=_0x382f2b['query'][_0x2942('0x6c')];if(typeof _0xef0d11===_0x2942('0x6d')){throw new db[(_0x2942('0x6e'))][(_0x2942('0x6f'))](_0x2942('0x70'));}var _0x4a12a0=_0x382f2b['query'][_0x2942('0x71')]||![];var _0x58ca19=getQueryModels(_0xef0d11,_0x4a12a0);if(typeof _0x58ca19['childModel']===_0x2942('0x6d')){throw new db[(_0x2942('0x6e'))][(_0x2942('0x6f'))]('Invalid\x20section\x20\x27'+_0xef0d11+'\x27');}var _0x388f65=[];if(!_['isEmpty'](_0x58ca19[_0x2942('0x72')])){_0x388f65=_0x58ca19['parentSections'];}else{_0x388f65=[{'name':_0xef0d11}];}return db[_0x2942('0x2d')]['findOne']({'where':{'id':_0x382f2b[_0x2942('0x48')]['id']}})[_0x2942('0x26')](handleEntityNotFound(_0x3877a7,null))[_0x2942('0x26')](function(_0x1b6321){if(_0x1b6321){var _0x571296=[];for(var _0x210541=0x0;_0x210541<_0x388f65[_0x2942('0x39')];_0x210541++){_0x571296[_0x2942('0x5c')](db[_0x2942('0x54')]['findOne']({'where':{'userProfileId':_0x1b6321['id'],'name':_0x388f65[_0x210541][_0x2942('0x29')]},'raw':!![]}));}return BPromise[_0x2942('0x73')](_0x571296);}})[_0x2942('0x26')](function(_0x3ed2d1){var _0x11b640=_[_0x2942('0x40')](_0x3ed2d1,function(_0x24c15b){return _0x24c15b?_0x24c15b:undefined;});var _0x286199=_[_0x2942('0x40')](_0x388f65,[_0x2942('0x74'),!![]]);var _0x198ec4=_['isEmpty'](_0x11b640)&&_[_0x2942('0x61')](_0x286199)?null:_[_0x2942('0x75')](_0x286199,_0x11b640);if(_0x198ec4){var _0x50c6d9=[];for(var _0x4fcfb9=0x0;_0x4fcfb9<_0x198ec4[_0x2942('0x39')];_0x4fcfb9++){var _0x10643b=_[_0x2942('0x4c')](_0x388f65,function(_0x183d21){return _0x198ec4[_0x4fcfb9]?_0x183d21[_0x2942('0x29')]===_0x198ec4[_0x4fcfb9][_0x2942('0x29')]:null;});if(_0x10643b){if(_0x198ec4[_0x4fcfb9][_0x2942('0x74')]){_0x50c6d9[_0x2942('0x5c')](getAllResources(_0x58ca19[_0x2942('0x76')],_0x198ec4[_0x4fcfb9]));}else{if(!_0x198ec4[_0x4fcfb9][_0x2942('0x56')]){_0x50c6d9[_0x2942('0x5c')](getAllowedResources(_0x10643b,_0x198ec4[_0x4fcfb9],_0x58ca19['childModel']));}else{if(_0x10643b[_0x2942('0x32')]){_0x50c6d9[_0x2942('0x5c')](getAllFilteredResources(_0x10643b,_0x198ec4[_0x4fcfb9]));}}}}}return BPromise[_0x2942('0x73')](_0x50c6d9);}else{return null;}})[_0x2942('0x26')](function(_0x1f8836){var _0x25220c=_0x1f8836;var _0x543482=null;if(_0x25220c){_0x543482=_0x25220c[_0x2942('0x39')]===0x1?_0x25220c[0x0]:null;}if(_0x543482||_0x25220c){var _0x3837c6=db[_0x58ca19['childModel']][_0x2942('0x2e')];_0x1406e3[_0x2942('0x32')]=_['keys'](_0x3837c6);_0x1406e3[_0x2942('0x34')]=_[_0x2942('0x33')](_0x382f2b[_0x2942('0x34')]);_0x1406e3[_0x2942('0x35')]=_[_0x2942('0x36')](_0x1406e3[_0x2942('0x32')],_0x1406e3[_0x2942('0x34')]);_0x5e39a9['attributes']=_['intersection'](_0x1406e3[_0x2942('0x32')],qs['fields'](_0x382f2b[_0x2942('0x34')][_0x2942('0x38')]));_0x5e39a9['attributes']=_0x5e39a9['attributes'][_0x2942('0x39')]?_0x5e39a9[_0x2942('0x37')]:_0x1406e3['model'];if(!_0x382f2b['query']['hasOwnProperty'](_0x2942('0x77'))){_0x5e39a9[_0x2942('0x3b')]=qs[_0x2942('0x3b')](_0x382f2b[_0x2942('0x34')][_0x2942('0x3b')]);_0x5e39a9[_0x2942('0x22')]=qs[_0x2942('0x22')](_0x382f2b[_0x2942('0x34')][_0x2942('0x22')]);}_0x5e39a9[_0x2942('0x3c')]=qs[_0x2942('0x3d')](_0x382f2b[_0x2942('0x34')][_0x2942('0x3d')]);_0x5e39a9[_0x2942('0x3e')]=qs['filters'](_[_0x2942('0x3f')](_0x382f2b[_0x2942('0x34')],_0x1406e3[_0x2942('0x35')]));if(_0x382f2b['query'][_0x2942('0x40')]){_0x5e39a9[_0x2942('0x3e')]=_[_0x2942('0x41')](_0x5e39a9[_0x2942('0x3e')],{'$or':_[_0x2942('0x2c')](_0x3837c6,function(_0x2af85d){if(_0x2af85d[_0x2942('0x30')][_0x2942('0x31')]!==_0x2942('0x42')){var _0x390cfe={};_0x390cfe[_0x2af85d[_0x2942('0x78')]]={'$like':'%'+_0x382f2b[_0x2942('0x34')][_0x2942('0x40')]+'%'};return _0x390cfe;}})});}var _0x2730e5=[];if(_0x543482){var _0x57e3cf=_['find'](_0x388f65,[_0x2942('0x29'),_0x543482[_0x2942('0x29')]]);if(_0x57e3cf[_0x2942('0x78')]){var _0x1bcf8e={};if(_0x58ca19[_0x2942('0x76')]===_0x2942('0x79')){_0x1bcf8e[_0x57e3cf[_0x2942('0x7a')]]=_[_0x2942('0x2c')](_0x543482[_0x2942('0x7b')],'id');}else{_0x1bcf8e[_0x57e3cf[_0x2942('0x7a')]]=_0x543482[_0x2942('0x7b')];}_0x2730e5[_0x2942('0x5c')](_0x1bcf8e);}else{_0x5e39a9[_0x2942('0x3e')]['id']=_0x543482[_0x2942('0x7b')];}}else{for(var _0xb2f799=0x0;_0xb2f799<_0x25220c[_0x2942('0x39')];_0xb2f799++){var _0x57e3cf=_[_0x2942('0x4c')](_0x388f65,[_0x2942('0x29'),_0x25220c[_0xb2f799][_0x2942('0x29')]]);if(_0x57e3cf[_0x2942('0x78')]){var _0x1bcf8e={};_0x1bcf8e[_0x57e3cf[_0x2942('0x7a')]]=_0x25220c[_0xb2f799]['associatedResources'];_0x2730e5[_0x2942('0x5c')](_0x1bcf8e);}else{if(!_0x5e39a9[_0x2942('0x3e')]['id'])_0x5e39a9['where']['id']=[];_0x25220c[_0xb2f799]['associatedResources'][_0x2942('0x66')](function(_0x55d4b5){_0x5e39a9[_0x2942('0x3e')]['id']['push'](_0x55d4b5);});}}}if(!_['isEmpty'](_0x2730e5)){_0x5e39a9['where']=_[_0x2942('0x41')](_0x5e39a9[_0x2942('0x3e')],{'$and':{'$or':_0x2730e5}});}_0x5e39a9=_[_0x2942('0x41')]({},_0x5e39a9,_0x382f2b[_0x2942('0x4b')]);if(_0x543482&&!_0x543482['autoAssociation']&&_0x58ca19['childModel']===_0x2942('0x79')){if(_0x382f2b[_0x2942('0x34')]['includeAll']){_0x5e39a9[_0x2942('0x44')]=[{'all':!![]}];}return db[_0x58ca19[_0x2942('0x76')]][_0x2942('0x57')](_0x5e39a9)[_0x2942('0x26')](function(_0x21cd48){var _0x212ee8=[];_0x21cd48['forEach'](function(_0xf166af){var _0x4cbcb5;switch(_0xf166af['reportType']){case _0x2942('0x7c'):_0x4cbcb5=_[_0x2942('0x4c')](_0x543482[_0x2942('0x7b')],function(_0x4bfb3f){return _0x4bfb3f['id']===_0xf166af[_0x2942('0x7d')]&&_0x4bfb3f[_0x2942('0x30')]===_0x2942('0x7e');});break;case _0x2942('0x7f'):_0x4cbcb5=_[_0x2942('0x4c')](_0x543482[_0x2942('0x7b')],function(_0x8ce93e){return _0x8ce93e['id']===_0xf166af[_0x2942('0x7d')]&&_0x8ce93e[_0x2942('0x30')]===_0x2942('0x80');});break;}if(_0x4cbcb5)_0x212ee8[_0x2942('0x5c')](_0xf166af);});_0x5eb19c['count']=_0x212ee8[_0x2942('0x39')];_0x5eb19c[_0x2942('0x45')]=_0x212ee8;return _0x5eb19c;});}else{return db[_0x58ca19[_0x2942('0x76')]][_0x2942('0x21')]({'where':_0x5e39a9['where']})[_0x2942('0x26')](function(_0xf88782){_0x5eb19c['count']=_0xf88782;if(_0x382f2b['query'][_0x2942('0x43')]){if(_0x58ca19['childModel']===_0x2942('0x81')){_0x5e39a9[_0x2942('0x44')]=[{'model':db[_0x2942('0x82')],'as':_0x2942('0x83'),'attributes':['id',_0x2942('0x29'),_0x2942('0x84')],'required':_0x382f2b['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0x2942('0x85'),'attributes':['id','name',_0x2942('0x84')],'through':_0x382f2b[_0x2942('0x34')][_0x2942('0x86')]?{'attributes':[],'where':{'TagId':_0x382f2b[_0x2942('0x34')][_0x2942('0x86')]||undefined}}:{},'required':_0x382f2b[_0x2942('0x34')][_0x2942('0x86')]?!![]:![]}];}else{_0x5e39a9['include']=[{'all':!![]}];}}return db[_0x58ca19['childModel']][_0x2942('0x57')](_0x5e39a9);})['then'](function(_0x432167){_0x5eb19c[_0x2942('0x45')]=_0x432167;return _0x5eb19c;});}}else{return _0x5eb19c;}})['then'](respondWithFilteredResult(_0x3877a7,_0x5e39a9))['catch'](handleError(_0x3877a7,null));};function getAllResources(_0x2afac1,_0x558cc5){return new BPromise(function(_0x4b4c87,_0x48542b){if(_0x558cc5){var _0x346619=_0x558cc5[_0x2942('0x40')]?{[_0x558cc5['filter'][_0x2942('0x78')]]:_0x558cc5[_0x2942('0x40')][_0x2942('0x87')]}:undefined;return db[_0x2afac1][_0x2942('0x57')]({'where':_0x346619,'raw':!![]})['then'](function(_0x1e6f71){_0x558cc5[_0x2942('0x7b')]=_[_0x2942('0x2c')](_0x1e6f71,'id');_0x4b4c87(_0x558cc5);})[_0x2942('0x46')](function(_0x43f887){_0x48542b(_0x43f887);});}else{_0x4b4c87(null);}});}function getAllFilteredResources(_0x158bf5,_0x363760){return new BPromise(function(_0xb23afa,_0x559202){var _0x33a012=_0x158bf5['filter']?{[_0x158bf5['filter'][_0x2942('0x78')]]:_0x158bf5['filter']['value']}:undefined;return db[_0x158bf5[_0x2942('0x32')]][_0x2942('0x57')]({'where':_0x33a012,'raw':!![]})[_0x2942('0x26')](function(_0x2840a8){_0x363760[_0x2942('0x7b')]=_[_0x2942('0x2c')](_0x2840a8,function(_0x28f880){return _0x28f880[_0x2942('0x29')];});_0xb23afa(_0x363760);})['catch'](function(_0x11d613){_0x559202(_0x11d613);});});}function getAllowedResources(_0x2f93d5,_0x5dd738,_0x5b5273){return new BPromise(function(_0x45009d,_0x493dc4){if(_0x5dd738){return db['UserProfileResource'][_0x2942('0x57')]({'where':{'sectionId':_0x5dd738['id']},'raw':!![]})[_0x2942('0x26')](function(_0x2dbaa7){if(_0x2f93d5[_0x2942('0x78')]&&_0x2f93d5[_0x2942('0x78')]!=='id'){_0x5dd738[_0x2942('0x7b')]=_[_0x2942('0x2c')](_0x2dbaa7,function(_0x3cee4c){return _0x3cee4c[_0x2f93d5[_0x2942('0x78')]];});}else{if(_0x5b5273==='AnalyticExtractedReport'){_0x5dd738[_0x2942('0x7b')]=_[_0x2942('0x2c')](_0x2dbaa7,function(_0x6ae5a1){return{'id':_0x6ae5a1[_0x2942('0x88')],'type':_0x6ae5a1[_0x2942('0x30')]};});}else{_0x5dd738['associatedResources']=_[_0x2942('0x2c')](_0x2dbaa7,function(_0x2a7698){return _0x2a7698[_0x2942('0x88')];});}}_0x45009d(_0x5dd738);})[_0x2942('0x46')](function(_0x7ee82e){_0x493dc4(_0x7ee82e);});}else{_0x45009d(null);}});}function getQueryModels(_0x30cd4c,_0x30256e){var _0x3125ca=_0x30cd4c[_0x2942('0x89')]();var _0x386975={'childModel':undefined,'parentSections':[]};switch(_0x3125ca){case _0x2942('0x8a'):_0x386975[_0x2942('0x76')]=_0x2942('0x8b');break;case _0x2942('0x8c'):_0x386975[_0x2942('0x76')]='SquareOdbc';break;case'squarerecordings':_0x386975[_0x2942('0x76')]=_0x2942('0x8d');_0x386975[_0x2942('0x72')]=[{'name':_0x2942('0x8e'),'field':_0x2942('0x29'),'foreignKey':_0x2942('0x8f')}];break;case _0x2942('0x90'):_0x386975[_0x2942('0x76')]=_0x2942('0x91');break;case _0x2942('0x92'):_0x386975['childModel']=_0x2942('0x81');_0x386975[_0x2942('0x72')]=[{'name':'Lists','field':'id','foreignKey':_0x2942('0x93')}];break;case _0x2942('0x94'):_0x386975[_0x2942('0x76')]=_0x2942('0x95');break;case _0x2942('0x96'):_0x386975[_0x2942('0x76')]=_0x2942('0x97');break;case _0x2942('0x98'):_0x386975[_0x2942('0x76')]='CmCustomField';break;case _0x2942('0x99'):_0x386975['childModel']='ChatQueue';break;case _0x2942('0x9a'):_0x386975[_0x2942('0x76')]=_0x2942('0x9b');break;case'faxqueues':_0x386975[_0x2942('0x76')]='FaxQueue';break;case _0x2942('0x9c'):_0x386975[_0x2942('0x76')]=_0x2942('0x9d');break;case _0x2942('0x9e'):case _0x2942('0x9f'):case _0x2942('0xa0'):_0x386975[_0x2942('0x76')]=_0x2942('0xa1');break;case _0x2942('0xa2'):_0x386975[_0x2942('0x76')]='VoiceContext';break;case _0x2942('0xa3'):_0x386975['childModel']='VoiceMail';break;case _0x2942('0xa4'):_0x386975['childModel']='VoiceRecording';_0x386975[_0x2942('0x72')]=[{'name':_0x2942('0xa5'),'field':_0x2942('0x29'),'foreignKey':'membername','model':_0x2942('0xa6'),'filter':{'field':'role','value':[_0x2942('0xa7')]}},{'name':_0x2942('0xa8'),'field':'name','foreignKey':_0x2942('0xa9'),'model':'User','filter':{'field':_0x2942('0xaa'),'value':[_0x2942('0xab')]}},{'name':_0x2942('0xac'),'field':_0x2942('0x29'),'foreignKey':_0x2942('0xad'),'model':_0x2942('0xae'),'filter':{'field':_0x2942('0x30'),'value':[_0x2942('0xaf')]}},{'name':_0x2942('0xb0'),'field':_0x2942('0x29'),'foreignKey':_0x2942('0xad'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x2942('0xb1')]}}];break;case _0x2942('0xb2'):_0x386975['childModel']='VoiceMusicOnHold';break;case _0x2942('0xb3'):_0x386975['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x386975[_0x2942('0x76')]=_0x2942('0xb4');break;case'ivrcampaigns':_0x386975[_0x2942('0x76')]='Campaign';break;case _0x2942('0xb5'):_0x386975[_0x2942('0x76')]='MailQueue';break;case _0x2942('0xb6'):_0x386975['childModel']='MailAccount';break;case _0x2942('0xb7'):_0x386975[_0x2942('0x76')]='MailSubstatus';break;case'openchannelqueues':_0x386975['childModel']=_0x2942('0xb8');break;case'openchannelaccounts':_0x386975[_0x2942('0x76')]=_0x2942('0xb9');break;case _0x2942('0xba'):_0x386975[_0x2942('0x76')]=_0x2942('0xbb');break;case _0x2942('0xbc'):_0x386975[_0x2942('0x76')]=_0x2942('0xbd');break;case'whatsappqueues':_0x386975['childModel']='WhatsappQueue';break;case _0x2942('0xbe'):_0x386975[_0x2942('0x76')]='WhatsappAccount';break;case _0x2942('0xbf'):_0x386975[_0x2942('0x76')]='Team';break;case _0x2942('0xc0'):case _0x2942('0xc1'):_0x386975[_0x2942('0x76')]=_0x2942('0xae');if(_0x30256e){_0x386975[_0x2942('0x72')]=[{'name':_0x2942('0xac')},{'name':'QueueCampaigns'}];}break;case _0x2942('0xc2'):case _0x2942('0xc3'):case _0x2942('0xc4'):_0x386975[_0x2942('0x76')]='User';if(_0x30256e){_0x386975[_0x2942('0x72')]=[{'name':'Users','filter':{'field':_0x2942('0xaa'),'value':[_0x2942('0xc5'),_0x2942('0xc6')]},'ignore':!![]},{'name':_0x2942('0xa5')},{'name':_0x2942('0xa8')}];}break;case _0x2942('0xc7'):_0x386975[_0x2942('0x76')]=_0x2942('0xc8');break;case _0x2942('0xc9'):_0x386975[_0x2942('0x76')]=_0x2942('0xca');break;case'freshdeskaccounts':_0x386975[_0x2942('0x76')]=_0x2942('0xcb');break;case _0x2942('0xcc'):_0x386975[_0x2942('0x76')]=_0x2942('0xcd');break;case'deskaccounts':_0x386975[_0x2942('0x76')]=_0x2942('0xce');break;case _0x2942('0xcf'):_0x386975[_0x2942('0x76')]=_0x2942('0xd0');break;case'vtigeraccounts':_0x386975['childModel']=_0x2942('0xa6');break;case _0x2942('0xd1'):_0x386975['childModel']=_0x2942('0xd2');break;case _0x2942('0xd3'):_0x386975[_0x2942('0x76')]=_0x2942('0xd4');break;case _0x2942('0xd5'):_0x386975['childModel']='Dashboard';break;case _0x2942('0xd6'):_0x386975['childModel']='Interval';break;case'pauses':_0x386975[_0x2942('0x76')]=_0x2942('0xd7');break;case _0x2942('0xd8'):_0x386975['childModel']=_0x2942('0xd9');break;case'sounds':_0x386975[_0x2942('0x76')]=_0x2942('0xda');break;case _0x2942('0xdb'):_0x386975[_0x2942('0x76')]=_0x2942('0x82');break;case'templates':_0x386975[_0x2942('0x76')]='Template';break;case'triggers':_0x386975[_0x2942('0x76')]=_0x2942('0xdc');break;case'trunks':_0x386975[_0x2942('0x76')]='Trunk';break;case'variables':_0x386975[_0x2942('0x76')]=_0x2942('0xdd');break;case _0x2942('0xde'):_0x386975[_0x2942('0x76')]=_0x2942('0x65');break;case _0x2942('0xdf'):_0x386975[_0x2942('0x76')]=_0x2942('0x79');_0x386975[_0x2942('0x72')]=[{'name':_0x2942('0xe0'),'field':'id','foreignKey':_0x2942('0x7d')}];break;case _0x2942('0xe1'):_0x386975[_0x2942('0x76')]=_0x2942('0xe2');break;case _0x2942('0xbe'):_0x386975['childModel']='WhatsappAccount';break;default:return _0x386975;}return _0x386975;} \ No newline at end of file +var _0x8e63=['metrics','AnalyticMetric','WhatsappAccount','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','UserProfile','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','include','show','rawAttributes','includeAll','find','catch','create','body','clone','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','Resources','params','describe','addSections','UserProfileResource','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','childModel','Sequelize','Invalid\x20section\x20\x27','parentSections','all','ignore','hasOwnProperty','field','AnalyticExtractedReport','foreignKey','associatedResources','DefaultReports','reportId','CustomReports','rows','CmContact','Tag','ThroughTags','tag','value','odbc','SquareOdbc','SquareRecording','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','users','agents','telephones','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','triggers','Trigger','trunks','Variable','extractedreports','Reports'];(function(_0x410918,_0x5d4ee0){var _0x4151e6=function(_0x437058){while(--_0x437058){_0x410918['push'](_0x410918['shift']());}};_0x4151e6(++_0x5d4ee0);}(_0x8e63,0x1c7));var _0x38e6=function(_0x2bde77,_0x493180){_0x2bde77=_0x2bde77-0x0;var _0x5a780b=_0x8e63[_0x2bde77];return _0x5a780b;};'use strict';var pdf=require(_0x38e6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x38e6('0x1'));var rp=require(_0x38e6('0x2'));var moment=require(_0x38e6('0x3'));var BPromise=require(_0x38e6('0x4'));var Mustache=require(_0x38e6('0x5'));var util=require(_0x38e6('0x6'));var path=require(_0x38e6('0x7'));var sox=require(_0x38e6('0x8'));var csv=require(_0x38e6('0x9'));var ejs=require(_0x38e6('0xa'));var fs=require('fs');var _=require(_0x38e6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38e6('0xc'));var deskjs=require(_0x38e6('0xd'));var toCsv=require(_0x38e6('0x9'));var querystring=require('querystring');var Papa=require(_0x38e6('0xe'));var Redis=require(_0x38e6('0xf'));var authService=require(_0x38e6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x38e6('0x11'));var hardwareService=require(_0x38e6('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x38e6('0x13'));var config=require('../../config/environment');var db=require(_0x38e6('0x14'))['db'];config[_0x38e6('0x15')]=_[_0x38e6('0x16')](config[_0x38e6('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x38e6('0x17'))(new Redis(config[_0x38e6('0x15')]));require(_0x38e6('0x18'))['register'](socket);function respondWithStatusCode(_0x3b680e,_0x9ef7bf){_0x9ef7bf=_0x9ef7bf||0xcc;return function(_0xa6b85f){if(_0xa6b85f){return _0x3b680e[_0x38e6('0x19')](_0x9ef7bf);}return _0x3b680e[_0x38e6('0x1a')](_0x9ef7bf)[_0x38e6('0x1b')]();};}function respondWithResult(_0x2ee98e,_0x191123){_0x191123=_0x191123||0xc8;return function(_0x292414){if(_0x292414){return _0x2ee98e[_0x38e6('0x1a')](_0x191123)['json'](_0x292414);}};}function respondWithFilteredResult(_0x2e0f80,_0x2902f4){return function(_0x590918){if(_0x590918){var _0x3f2468=_0x590918['count'],_0x245572=_0x2902f4['offset'],_0x17de90=_0x2902f4[_0x38e6('0x1c')]+_0x2902f4[_0x38e6('0x1d')],_0x529534;if(_0x17de90>=_0x3f2468){_0x17de90=_0x3f2468;_0x529534=0xc8;}else{_0x529534=0xce;}_0x2e0f80[_0x38e6('0x1a')](_0x529534);return _0x2e0f80[_0x38e6('0x1e')](_0x38e6('0x1f'),_0x245572+'-'+_0x17de90+'/'+_0x3f2468)[_0x38e6('0x20')](_0x590918);}return null;};}function patchUpdates(_0xa8a7e1){return function(_0x3b6224){try{jsonpatch[_0x38e6('0x21')](_0x3b6224,_0xa8a7e1,!![]);}catch(_0x880e4a){return BPromise[_0x38e6('0x22')](_0x880e4a);}return _0x3b6224[_0x38e6('0x23')]();};}function saveUpdates(_0x1541de,_0x462f98){return function(_0x1f270c){if(_0x1f270c){return _0x1f270c[_0x38e6('0x24')](_0x1541de)['then'](function(_0x4a521e){return _0x4a521e;});}return null;};}function removeEntity(_0x2a7171,_0x9197fd){return function(_0x21d0a1){if(_0x21d0a1){return _0x21d0a1[_0x38e6('0x25')]()[_0x38e6('0x26')](function(){_0x2a7171[_0x38e6('0x1a')](0xcc)[_0x38e6('0x1b')]();});}};}function handleEntityNotFound(_0x383831,_0xbdae4d){return function(_0x32e6a8){if(!_0x32e6a8){_0x383831[_0x38e6('0x19')](0x194);}return _0x32e6a8;};}function handleError(_0x2eaffd,_0x2f638a){_0x2f638a=_0x2f638a||0x1f4;return function(_0x3b9141){logger[_0x38e6('0x27')](_0x3b9141[_0x38e6('0x28')]);if(_0x3b9141[_0x38e6('0x29')]){delete _0x3b9141[_0x38e6('0x29')];}_0x2eaffd[_0x38e6('0x1a')](_0x2f638a)['send'](_0x3b9141);};}exports[_0x38e6('0x2a')]=function(_0x217058,_0x4e187e){var _0x54be87={},_0x55a0e0={},_0x5742ff={'count':0x0,'rows':[]};var _0xb49b48=_['map'](db[_0x38e6('0x2b')]['rawAttributes'],function(_0x4af319){return{'name':_0x4af319[_0x38e6('0x2c')],'type':_0x4af319[_0x38e6('0x2d')][_0x38e6('0x2e')]};});_0x55a0e0[_0x38e6('0x2f')]=_[_0x38e6('0x30')](_0xb49b48,'name');_0x55a0e0[_0x38e6('0x31')]=_[_0x38e6('0x32')](_0x217058[_0x38e6('0x31')]);_0x55a0e0[_0x38e6('0x33')]=_[_0x38e6('0x34')](_0x55a0e0[_0x38e6('0x2f')],_0x55a0e0[_0x38e6('0x31')]);_0x54be87[_0x38e6('0x35')]=_[_0x38e6('0x34')](_0x55a0e0[_0x38e6('0x2f')],qs[_0x38e6('0x36')](_0x217058[_0x38e6('0x31')][_0x38e6('0x36')]));_0x54be87[_0x38e6('0x35')]=_0x54be87[_0x38e6('0x35')][_0x38e6('0x37')]?_0x54be87['attributes']:_0x55a0e0[_0x38e6('0x2f')];if(!_0x217058['query']['hasOwnProperty'](_0x38e6('0x38'))){_0x54be87['limit']=qs[_0x38e6('0x1d')](_0x217058[_0x38e6('0x31')][_0x38e6('0x1d')]);_0x54be87[_0x38e6('0x1c')]=qs[_0x38e6('0x1c')](_0x217058[_0x38e6('0x31')]['offset']);}_0x54be87[_0x38e6('0x39')]=qs[_0x38e6('0x3a')](_0x217058[_0x38e6('0x31')][_0x38e6('0x3a')]);_0x54be87['where']=qs[_0x38e6('0x33')](_[_0x38e6('0x3b')](_0x217058[_0x38e6('0x31')],_0x55a0e0['filters']),_0xb49b48);if(_0x217058['query']['filter']){_0x54be87['where']=_[_0x38e6('0x3c')](_0x54be87[_0x38e6('0x3d')],{'$or':_[_0x38e6('0x30')](_0xb49b48,function(_0x218671){if(_0x218671[_0x38e6('0x2d')]!==_0x38e6('0x3e')){var _0xe8d620={};_0xe8d620[_0x218671[_0x38e6('0x29')]]={'$like':'%'+_0x217058['query'][_0x38e6('0x3f')]+'%'};return _0xe8d620;}})});}_0x54be87=_[_0x38e6('0x3c')]({},_0x54be87,_0x217058[_0x38e6('0x40')]);var _0x20e035={'where':_0x54be87['where']};return db['UserProfile'][_0x38e6('0x41')](_0x20e035)[_0x38e6('0x26')](function(_0x571336){_0x5742ff['count']=_0x571336;if(_0x217058[_0x38e6('0x31')]['includeAll']){_0x54be87[_0x38e6('0x42')]=[{'all':!![]}];}return db[_0x38e6('0x2b')]['findAll'](_0x54be87);})[_0x38e6('0x26')](function(_0x257991){_0x5742ff['rows']=_0x257991;return _0x5742ff;})[_0x38e6('0x26')](respondWithFilteredResult(_0x4e187e,_0x54be87))['catch'](handleError(_0x4e187e,null));};exports[_0x38e6('0x43')]=function(_0x2d93e3,_0x23b1bb){var _0x55fc27={'raw':![],'where':{'id':_0x2d93e3['params']['id']}},_0x5eb4c6={};_0x5eb4c6[_0x38e6('0x2f')]=_[_0x38e6('0x32')](db[_0x38e6('0x2b')][_0x38e6('0x44')]);_0x5eb4c6[_0x38e6('0x31')]=_[_0x38e6('0x32')](_0x2d93e3[_0x38e6('0x31')]);_0x5eb4c6[_0x38e6('0x33')]=_['intersection'](_0x5eb4c6['model'],_0x5eb4c6[_0x38e6('0x31')]);_0x55fc27['attributes']=_[_0x38e6('0x34')](_0x5eb4c6[_0x38e6('0x2f')],qs[_0x38e6('0x36')](_0x2d93e3[_0x38e6('0x31')]['fields']));_0x55fc27[_0x38e6('0x35')]=_0x55fc27[_0x38e6('0x35')][_0x38e6('0x37')]?_0x55fc27[_0x38e6('0x35')]:_0x5eb4c6[_0x38e6('0x2f')];if(_0x2d93e3[_0x38e6('0x31')][_0x38e6('0x45')]){_0x55fc27[_0x38e6('0x42')]=[{'all':!![]}];}_0x55fc27=_[_0x38e6('0x3c')]({},_0x55fc27,_0x2d93e3[_0x38e6('0x40')]);return db[_0x38e6('0x2b')][_0x38e6('0x46')](_0x55fc27)[_0x38e6('0x26')](handleEntityNotFound(_0x23b1bb,null))['then'](respondWithResult(_0x23b1bb,null))[_0x38e6('0x47')](handleError(_0x23b1bb,null));};exports['create']=function(_0x5c3387,_0x4312af){return db[_0x38e6('0x2b')][_0x38e6('0x48')](_0x5c3387[_0x38e6('0x49')],{})['then'](respondWithResult(_0x4312af,0xc9))['catch'](handleError(_0x4312af,null));};exports[_0x38e6('0x4a')]=function(_0x5dd94b,_0x102840){var _0x508f1f={'where':{'id':_0x5dd94b['params']['id']}},_0x2a1332={};_0x2a1332['model']=_[_0x38e6('0x32')](db[_0x38e6('0x2b')][_0x38e6('0x44')]);_0x508f1f[_0x38e6('0x35')]=_[_0x38e6('0x34')](_0x2a1332['model'],qs[_0x38e6('0x36')](_0x5dd94b[_0x38e6('0x31')][_0x38e6('0x36')]));_0x508f1f[_0x38e6('0x35')]=_0x508f1f[_0x38e6('0x35')]['length']?_0x508f1f[_0x38e6('0x35')]:_0x2a1332[_0x38e6('0x2f')];if(_0x5dd94b[_0x38e6('0x31')][_0x38e6('0x45')]){_0x508f1f[_0x38e6('0x42')]=[{'all':!![]}];}_0x508f1f=_[_0x38e6('0x3c')]({},_0x508f1f,_0x5dd94b[_0x38e6('0x40')]);return db['UserProfile'][_0x38e6('0x46')](_0x508f1f)['then'](handleEntityNotFound(_0x102840,null))[_0x38e6('0x26')](function(_0x1f2def){if(_0x1f2def){var _0x5799c9=_0x1f2def['get']({'plain':!![]});_0x5799c9=qs[_0x38e6('0x4b')](_0x5799c9,['id','createdAt',_0x38e6('0x4c'),_0x38e6('0x4d')]);_0x5dd94b[_0x38e6('0x49')]=_[_0x38e6('0x4b')](_0x5dd94b[_0x38e6('0x49')],['id',_0x38e6('0x4e'),_0x38e6('0x4c')]);return db[_0x38e6('0x4f')][_0x38e6('0x50')](function(_0x378f82){return db[_0x38e6('0x2b')][_0x38e6('0x48')](_[_0x38e6('0x3c')](_0x5799c9,_0x5dd94b[_0x38e6('0x49')]),{'include':_0x5dd94b['query'][_0x38e6('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x378f82})[_0x38e6('0x26')](function(_0x463475){var _0x20cdd3=_0x463475[_0x38e6('0x51')]({'plain':!![]});return db[_0x38e6('0x52')][_0x38e6('0x53')]({'where':{'userProfileId':_0x5dd94b['params']['id']},'raw':!![]})[_0x38e6('0x26')](function(_0x42cc94){if(_0x42cc94){return BPromise[_0x38e6('0x54')](_0x42cc94,function(_0x2360d0){return new BPromise(function(_0xece45a,_0x5df0ed){if(_0x2360d0[_0x38e6('0x55')]===null||_0x2360d0[_0x38e6('0x55')]===0x1)_0xece45a(null);return db['UserProfileResource'][_0x38e6('0x53')]({'where':{'sectionId':_0x2360d0['id']},'raw':!![]})[_0x38e6('0x26')](function(_0x69dcc5){var _0x47b15e=_[_0x38e6('0x30')](_0x69dcc5,function(_0x50d5d3){return qs['omit'](_0x50d5d3,['id',_0x38e6('0x4e'),_0x38e6('0x4c'),_0x38e6('0x56')]);});_0xece45a(_0x47b15e);})[_0x38e6('0x47')](function(_0x1053e3){_0x5df0ed(_0x1053e3);});})['then'](function(_0x2e7a0e){var _0x57541d=qs[_0x38e6('0x4b')](_0x2360d0,['id',_0x38e6('0x4e'),_0x38e6('0x4c')]);_0x57541d[_0x38e6('0x57')]=_0x20cdd3['id'];if(_0x2e7a0e)_0x57541d[_0x38e6('0x58')]=_0x2e7a0e;return _0x57541d;})[_0x38e6('0x26')](function(_0x40d373){return db['UserProfileSection'][_0x38e6('0x48')](_0x40d373,{'include':[{'model':db['UserProfileResource'],'as':_0x38e6('0x58')}],'raw':!![],'transaction':_0x378f82});});})[_0x38e6('0x26')](function(){return _0x20cdd3;});}});});});}})[_0x38e6('0x26')](respondWithResult(_0x102840,0xc9))[_0x38e6('0x47')](handleError(_0x102840,null));};exports[_0x38e6('0x24')]=function(_0x4c00cf,_0x23d42d){if(_0x4c00cf[_0x38e6('0x49')]['id']){delete _0x4c00cf[_0x38e6('0x49')]['id'];}return db[_0x38e6('0x2b')]['find']({'where':{'id':_0x4c00cf[_0x38e6('0x59')]['id']}})[_0x38e6('0x26')](handleEntityNotFound(_0x23d42d,null))['then'](saveUpdates(_0x4c00cf['body'],null))[_0x38e6('0x26')](respondWithResult(_0x23d42d,null))['catch'](handleError(_0x23d42d,null));};exports[_0x38e6('0x25')]=function(_0x52e389,_0xbcc34f){return db[_0x38e6('0x2b')][_0x38e6('0x46')]({'where':{'id':_0x52e389[_0x38e6('0x59')]['id']}})['then'](handleEntityNotFound(_0xbcc34f,null))[_0x38e6('0x26')](removeEntity(_0xbcc34f,null))['catch'](handleError(_0xbcc34f,null));};exports[_0x38e6('0x5a')]=function(_0x12b175,_0x412333){return db[_0x38e6('0x2b')][_0x38e6('0x5a')]()['then'](respondWithResult(_0x412333,null))[_0x38e6('0x47')](handleError(_0x412333,null));};exports[_0x38e6('0x5b')]=function(_0x5bd792,_0x4a8b9c){var _0xc6e7cc=_0x5bd792[_0x38e6('0x49')];return db[_0x38e6('0x2b')]['find']({'where':{'id':_0x5bd792[_0x38e6('0x59')]['id']}})[_0x38e6('0x26')](handleEntityNotFound(_0x4a8b9c,null))['then'](function(_0x40753d){if(_0x40753d){return db[_0x38e6('0x4f')][_0x38e6('0x50')](function(_0x4d8257){return db[_0x38e6('0x52')][_0x38e6('0x25')]({'where':{'userProfileId':_0x5bd792['params']['id'],'sectionId':_[_0x38e6('0x30')](_0xc6e7cc,function(_0x212b40){return _0x212b40[_0x38e6('0x56')];})},'transaction':_0x4d8257})[_0x38e6('0x26')](function(){var _0x34fdd3=_[_0x38e6('0x30')](_0xc6e7cc,function(_0x2ddc1b){_0x2ddc1b['userProfileId']=_0x5bd792[_0x38e6('0x59')]['id'];return _0x2ddc1b;});var _0x4a8d90=[];return BPromise[_0x38e6('0x54')](_0x34fdd3,function(_0x5760a7){return db['UserProfileSection'][_0x38e6('0x48')](_0x5760a7,{'include':[{'model':db[_0x38e6('0x5c')],'as':_0x38e6('0x58')}],'raw':!![],'transaction':_0x4d8257})[_0x38e6('0x26')](function(_0x5763be){_0x4a8d90[_0x38e6('0x5d')](_0x5763be[_0x38e6('0x51')]({'plain':!![]}));});})[_0x38e6('0x26')](function(){return _0x4a8d90;});});});}})[_0x38e6('0x26')](function(_0x3fb267){return _0x3fb267;})[_0x38e6('0x26')](respondWithResult(_0x4a8b9c,null))[_0x38e6('0x47')](handleError(_0x4a8b9c,null));};exports[_0x38e6('0x5e')]=function(_0x4a9bb3,_0xc2138e){var _0x3d57db;return db[_0x38e6('0x2b')][_0x38e6('0x46')]({'where':{'id':_0x4a9bb3[_0x38e6('0x59')]['id']},'attributes':['id','name']})[_0x38e6('0x26')](handleEntityNotFound(_0xc2138e,null))[_0x38e6('0x26')](function(_0x494959){if(_0x494959){_0x3d57db=_0x494959;return db['UserProfileSection'][_0x38e6('0x25')]({'where':{'userProfileId':_0x4a9bb3[_0x38e6('0x59')]['id'],'sectionId':_0x4a9bb3['query']['ids']}});}})['then'](function(){return _0x3d57db;})[_0x38e6('0x26')](respondWithStatusCode(_0xc2138e,null))[_0x38e6('0x47')](handleError(_0xc2138e,null));};exports['getSections']=function(_0x589719,_0x36764d){var _0x3aa1bf=[];var _0x3eb829=[];return db[_0x38e6('0x52')]['findAll']({'where':{'userProfileId':_0x589719['params']['id']},'raw':!![]})['then'](function(_0x498866){_0x3aa1bf=_[_0x38e6('0x3f')](_0x498866,function(_0x6ea76a){return _0x6ea76a[_0x38e6('0x5f')]===0x1||_[_0x38e6('0x60')]([0x3eb,0x709],_0x6ea76a[_0x38e6('0x56')]);});if(!_[_0x38e6('0x61')](_0x3aa1bf)){return _[_0x38e6('0x30')](_0x3aa1bf,function(_0x261cf5){return _0x261cf5[_0x38e6('0x56')];});}else{return;}})[_0x38e6('0x26')](function(_0x199b67){if(_0x199b67)_0x3eb829=_0x199b67;if(_[_0x38e6('0x60')](_0x3eb829,0x64)){var _0x3b7b16=_[_0x38e6('0x46')](_0x3aa1bf,{'sectionId':0x64});return hasDefaultDashboard(_0x3b7b16)[_0x38e6('0x26')](function(_0x2214b9){return _[_0x38e6('0x30')](_0x3aa1bf,function(_0x492245){if(_0x492245[_0x38e6('0x56')]===0x64){_0x492245[_0x38e6('0x62')]=_0x2214b9;}return _0x492245;});});}else{return;}})[_0x38e6('0x26')](function(_0x526904){if(_0x526904)_0x3aa1bf=_0x526904;if(_['includes'](_0x3eb829,0x3eb)){var _0x314594=_[_0x38e6('0x46')](_0x3aa1bf,{'sectionId':0x3eb});return getCustomDashboards(_0x314594)[_0x38e6('0x26')](function(_0x96bc5d){return _[_0x38e6('0x30')](_0x3aa1bf,function(_0xf7a369){if(_0x314594['enabled']){if(_0xf7a369[_0x38e6('0x56')]===0x3eb){_0xf7a369['subsections']=_0x96bc5d;}}else{if(_0xf7a369[_0x38e6('0x56')]===0x64){_0xf7a369[_0x38e6('0x62')]=_0x96bc5d;}}return _0xf7a369;});});}else{return;}})['then'](function(_0x571ad2){if(_0x571ad2)_0x3aa1bf=_0x571ad2;if(_['includes'](_0x3eb829,0x709)){var _0x447749=_['find'](_0x3aa1bf,{'sectionId':0x709});return getPlugins(_0x447749)[_0x38e6('0x26')](function(_0x1c1755){if(_0x447749[_0x38e6('0x5f')]){return _['map'](_0x3aa1bf,function(_0x262641){if(_0x262641[_0x38e6('0x56')]===0x709){_0x262641[_0x38e6('0x62')]=_0x1c1755;}return _0x262641;});}else{var _0x33e765={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1c1755};var _0x52682c=_[_0x38e6('0x30')](_0x3aa1bf);_0x52682c[_0x38e6('0x5d')](_0x33e765);return _0x52682c;}});}else{return;}})[_0x38e6('0x26')](function(_0x4d976a){if(_0x4d976a)_0x3aa1bf=_0x4d976a;return _[_0x38e6('0x3f')](_0x3aa1bf,[_0x38e6('0x5f'),0x1]);})['then'](respondWithResult(_0x36764d,null))['catch'](handleError(_0x36764d,null));};function hasDefaultDashboard(_0x1c09f0){var _0x52645d=[0x65];return new BPromise(function(_0x621ff7,_0x587014){try{if(_0x1c09f0[_0x38e6('0x55')]){_0x621ff7(_0x52645d);}else{return db['UserProfileResource'][_0x38e6('0x63')]({'where':{'sectionId':_0x1c09f0['id']},'raw':!![]})[_0x38e6('0x26')](function(_0xbba669){_0xbba669?_0x621ff7(_0x52645d):_0x621ff7();});}}catch(_0x54b60b){_0x587014(_0x54b60b);}});}function getCustomDashboards(_0x39715c){var _0x424f99=[];return new BPromise(function(_0xca587,_0x4b72f8){try{if(_0x39715c[_0x38e6('0x55')]){return db[_0x38e6('0x64')]['findAll']({'raw':!![]})[_0x38e6('0x26')](function(_0x5261dc){_0x5261dc[_0x38e6('0x65')](function(_0x2893cc){_0x424f99[_0x38e6('0x5d')](_0x2893cc['id']+0x1869f);});_0xca587(_0x424f99);});}else{return db[_0x38e6('0x5c')][_0x38e6('0x53')]({'where':{'sectionId':_0x39715c['id']},'raw':!![]})[_0x38e6('0x26')](function(_0x4a5e8e){_0x4a5e8e[_0x38e6('0x65')](function(_0x3a5f63){_0x424f99['push'](_0x3a5f63[_0x38e6('0x66')]+0x1869f);});_0xca587(_0x424f99);});}}catch(_0x38b03d){_0x4b72f8(_0x38b03d);}});}function getPlugins(_0x3c4aa6){var _0x3ed48d=[];return new BPromise(function(_0x4dd5b4,_0xa0882d){try{if(_0x3c4aa6[_0x38e6('0x55')]){return db[_0x38e6('0x67')][_0x38e6('0x53')]({'raw':!![]})[_0x38e6('0x26')](function(_0x4f240d){_0x4f240d['forEach'](function(_0x36d457){_0x3ed48d['push'](_0x36d457['id']+0x15b38);});_0x4dd5b4(_0x3ed48d);});}else{return db[_0x38e6('0x5c')][_0x38e6('0x53')]({'where':{'sectionId':_0x3c4aa6['id']},'raw':!![]})[_0x38e6('0x26')](function(_0x5b3455){_0x5b3455[_0x38e6('0x65')](function(_0x1fd3ed){_0x3ed48d[_0x38e6('0x5d')](_0x1fd3ed['resourceId']+0x15b38);});_0x4dd5b4(_0x3ed48d);});}}catch(_0x5e93f7){_0xa0882d(_0x5e93f7);}});}exports['addResources']=function(_0x5e19f1,_0x1c2211){return db[_0x38e6('0x2b')][_0x38e6('0x46')]({'where':{'id':_0x5e19f1['params']['id']}})[_0x38e6('0x26')](handleEntityNotFound(_0x1c2211,null))['then'](function(_0x156ac6){if(_0x156ac6){return db[_0x38e6('0x4f')]['transaction'](function(_0x8e989c){return db['UserProfileSection'][_0x38e6('0x53')]({'where':{'userProfileId':_0x5e19f1[_0x38e6('0x59')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5ed54f){if(_0x5ed54f){return db[_0x38e6('0x52')]['destroy']({'where':{'userProfileId':_0x5e19f1[_0x38e6('0x59')]['id'],'id':_[_0x38e6('0x30')](_0x5ed54f,function(_0x2cbc09){return _0x2cbc09['id'];})},'transaction':_0x8e989c});}})[_0x38e6('0x26')](function(_0x4bcc3a){var _0x58e26a=_[_0x38e6('0x30')](_0x5e19f1[_0x38e6('0x49')],function(_0x5666f5){_0x5666f5[_0x38e6('0x57')]=_0x5e19f1[_0x38e6('0x59')]['id'];return _0x5666f5;});return db[_0x38e6('0x52')]['bulkCreate'](_0x58e26a,{'raw':!![],'transaction':_0x8e989c});})[_0x38e6('0x26')](function(_0x3ba21d){var _0x423964=_[_0x38e6('0x3f')](_[_0x38e6('0x30')](_0x3ba21d,function(_0x46da75){return _0x46da75['get']({'plain':!![]});}),{'includeAll':![]});if(_0x423964){return db[_0x38e6('0x52')][_0x38e6('0x53')]({'where':{'userProfileId':_0x5e19f1[_0x38e6('0x59')]['id'],'sectionId':_[_0x38e6('0x30')](_0x423964,function(_0x181471){return _0x181471[_0x38e6('0x56')];})},'attributes':['id',_0x38e6('0x56')],'raw':!![]})[_0x38e6('0x26')](function(_0x39a791){var _0x164405=_['map'](_0x5e19f1[_0x38e6('0x49')],function(_0x20a3a8){_0x20a3a8[_0x38e6('0x57')]=_0x5e19f1[_0x38e6('0x59')]['id'];return _0x20a3a8;});return db[_0x38e6('0x5c')][_0x38e6('0x68')](_0x164405,{'raw':!![],'transaction':_0x8e989c});});}})['catch'](handleError(_0x1c2211,null));});}})['then'](function(_0x2fdbf0){var _0x3eda9c=_[_0x38e6('0x30')](_0x2fdbf0,function(_0x25509e){return _0x25509e[_0x38e6('0x51')]({'plain':!![]});});})[_0x38e6('0x26')](respondWithResult(_0x1c2211,null))['catch'](handleError(_0x1c2211,null));};exports['removeResources']=function(_0x5e47fd,_0x3e48f7,_0x27b7eb){return db['UserProfile'][_0x38e6('0x46')]({'where':{'id':_0x5e47fd[_0x38e6('0x59')]['id']}})[_0x38e6('0x26')](handleEntityNotFound(_0x3e48f7,null))[_0x38e6('0x26')](function(_0x59570e){if(_0x59570e){return _0x59570e[_0x38e6('0x69')](_0x5e47fd['query']['ids']);}})[_0x38e6('0x26')](respondWithStatusCode(_0x3e48f7,null))[_0x38e6('0x47')](handleError(_0x3e48f7,null));};exports[_0x38e6('0x6a')]=function(_0x1c3fa7,_0x1d113e){var _0x5a4cd7={'raw':![],'where':{}};var _0x5d6c27={};var _0x278d4c={'count':0x0,'rows':[]};var _0x459b7c=_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x6b')];if(typeof _0x459b7c===_0x38e6('0x6c')){throw new db['Sequelize'][(_0x38e6('0x6d'))](_0x38e6('0x6e'));}var _0x422146=_0x1c3fa7['query']['mergeResources']||![];var _0x249342=getQueryModels(_0x459b7c,_0x422146);if(typeof _0x249342[_0x38e6('0x6f')]===_0x38e6('0x6c')){throw new db[(_0x38e6('0x70'))]['ValidationError'](_0x38e6('0x71')+_0x459b7c+'\x27');}var _0x2923fe=[];if(!_[_0x38e6('0x61')](_0x249342[_0x38e6('0x72')])){_0x2923fe=_0x249342['parentSections'];}else{_0x2923fe=[{'name':_0x459b7c}];}return db['UserProfile'][_0x38e6('0x63')]({'where':{'id':_0x1c3fa7[_0x38e6('0x59')]['id']}})[_0x38e6('0x26')](handleEntityNotFound(_0x1d113e,null))['then'](function(_0x2c6a1e){if(_0x2c6a1e){var _0x9ffa5b=[];for(var _0x165317=0x0;_0x165317<_0x2923fe[_0x38e6('0x37')];_0x165317++){_0x9ffa5b[_0x38e6('0x5d')](db[_0x38e6('0x52')]['findOne']({'where':{'userProfileId':_0x2c6a1e['id'],'name':_0x2923fe[_0x165317][_0x38e6('0x29')]},'raw':!![]}));}return BPromise[_0x38e6('0x73')](_0x9ffa5b);}})['then'](function(_0x498571){var _0x2bc21c=_[_0x38e6('0x3f')](_0x498571,function(_0x526b7f){return _0x526b7f?_0x526b7f:undefined;});var _0x1b77e8=_['filter'](_0x2923fe,[_0x38e6('0x74'),!![]]);var _0x186cb2=_[_0x38e6('0x61')](_0x2bc21c)&&_[_0x38e6('0x61')](_0x1b77e8)?null:_['union'](_0x1b77e8,_0x2bc21c);if(_0x186cb2){var _0x3e0424=[];for(var _0x3b473b=0x0;_0x3b473b<_0x186cb2['length'];_0x3b473b++){var _0xb90b97=_['find'](_0x2923fe,function(_0x49585e){return _0x186cb2[_0x3b473b]?_0x49585e['name']===_0x186cb2[_0x3b473b]['name']:null;});if(_0xb90b97){if(_0x186cb2[_0x3b473b]['ignore']){_0x3e0424[_0x38e6('0x5d')](getAllResources(_0x249342[_0x38e6('0x6f')],_0x186cb2[_0x3b473b]));}else{if(!_0x186cb2[_0x3b473b][_0x38e6('0x55')]){_0x3e0424[_0x38e6('0x5d')](getAllowedResources(_0xb90b97,_0x186cb2[_0x3b473b],_0x249342['childModel']));}else{if(_0xb90b97[_0x38e6('0x2f')]){_0x3e0424[_0x38e6('0x5d')](getAllFilteredResources(_0xb90b97,_0x186cb2[_0x3b473b]));}}}}}return BPromise[_0x38e6('0x73')](_0x3e0424);}else{return null;}})['then'](function(_0x50f970){var _0x43ed8b=_0x50f970;var _0x4cad9=null;if(_0x43ed8b){_0x4cad9=_0x43ed8b[_0x38e6('0x37')]===0x1?_0x43ed8b[0x0]:null;}if(_0x4cad9||_0x43ed8b){var _0x2d70f7=db[_0x249342[_0x38e6('0x6f')]][_0x38e6('0x44')];_0x5d6c27['model']=_['keys'](_0x2d70f7);_0x5d6c27[_0x38e6('0x31')]=_[_0x38e6('0x32')](_0x1c3fa7[_0x38e6('0x31')]);_0x5d6c27[_0x38e6('0x33')]=_[_0x38e6('0x34')](_0x5d6c27[_0x38e6('0x2f')],_0x5d6c27['query']);_0x5a4cd7[_0x38e6('0x35')]=_['intersection'](_0x5d6c27[_0x38e6('0x2f')],qs['fields'](_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x36')]));_0x5a4cd7['attributes']=_0x5a4cd7[_0x38e6('0x35')][_0x38e6('0x37')]?_0x5a4cd7['attributes']:_0x5d6c27[_0x38e6('0x2f')];if(!_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x75')](_0x38e6('0x38'))){_0x5a4cd7[_0x38e6('0x1d')]=qs[_0x38e6('0x1d')](_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x1d')]);_0x5a4cd7[_0x38e6('0x1c')]=qs[_0x38e6('0x1c')](_0x1c3fa7[_0x38e6('0x31')]['offset']);}_0x5a4cd7[_0x38e6('0x39')]=qs[_0x38e6('0x3a')](_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x3a')]);_0x5a4cd7[_0x38e6('0x3d')]=qs[_0x38e6('0x33')](_[_0x38e6('0x3b')](_0x1c3fa7[_0x38e6('0x31')],_0x5d6c27[_0x38e6('0x33')]));if(_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x3f')]){_0x5a4cd7['where']=_['merge'](_0x5a4cd7['where'],{'$or':_[_0x38e6('0x30')](_0x2d70f7,function(_0x29d230){if(_0x29d230[_0x38e6('0x2d')][_0x38e6('0x2e')]!==_0x38e6('0x3e')){var _0x3918c3={};_0x3918c3[_0x29d230[_0x38e6('0x76')]]={'$like':'%'+_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x3f')]+'%'};return _0x3918c3;}})});}var _0x13d46e=[];if(_0x4cad9){var _0x297881=_[_0x38e6('0x46')](_0x2923fe,[_0x38e6('0x29'),_0x4cad9[_0x38e6('0x29')]]);if(_0x297881[_0x38e6('0x76')]){var _0x2344ff={};if(_0x249342['childModel']===_0x38e6('0x77')){_0x2344ff[_0x297881[_0x38e6('0x78')]]=_['map'](_0x4cad9[_0x38e6('0x79')],'id');}else{_0x2344ff[_0x297881['foreignKey']]=_0x4cad9[_0x38e6('0x79')];}_0x13d46e[_0x38e6('0x5d')](_0x2344ff);}else{_0x5a4cd7[_0x38e6('0x3d')]['id']=_0x4cad9[_0x38e6('0x79')];}}else{for(var _0x30b327=0x0;_0x30b327<_0x43ed8b[_0x38e6('0x37')];_0x30b327++){var _0x297881=_[_0x38e6('0x46')](_0x2923fe,[_0x38e6('0x29'),_0x43ed8b[_0x30b327][_0x38e6('0x29')]]);if(_0x297881[_0x38e6('0x76')]){var _0x2344ff={};_0x2344ff[_0x297881[_0x38e6('0x78')]]=_0x43ed8b[_0x30b327][_0x38e6('0x79')];_0x13d46e['push'](_0x2344ff);}else{if(!_0x5a4cd7['where']['id'])_0x5a4cd7['where']['id']=[];_0x43ed8b[_0x30b327][_0x38e6('0x79')]['forEach'](function(_0xd75391){_0x5a4cd7[_0x38e6('0x3d')]['id'][_0x38e6('0x5d')](_0xd75391);});}}}if(!_[_0x38e6('0x61')](_0x13d46e)){_0x5a4cd7[_0x38e6('0x3d')]=_['merge'](_0x5a4cd7['where'],{'$and':{'$or':_0x13d46e}});}_0x5a4cd7=_[_0x38e6('0x3c')]({},_0x5a4cd7,_0x1c3fa7['options']);if(_0x4cad9&&!_0x4cad9[_0x38e6('0x55')]&&_0x249342[_0x38e6('0x6f')]==='AnalyticExtractedReport'){if(_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x45')]){_0x5a4cd7['include']=[{'all':!![]}];}return db[_0x249342[_0x38e6('0x6f')]][_0x38e6('0x53')](_0x5a4cd7)[_0x38e6('0x26')](function(_0x190f81){var _0xcccee3=[];_0x190f81[_0x38e6('0x65')](function(_0x322ba6){var _0x3f9635;switch(_0x322ba6['reportType']){case'default':_0x3f9635=_[_0x38e6('0x46')](_0x4cad9[_0x38e6('0x79')],function(_0x143358){return _0x143358['id']===_0x322ba6['reportId']&&_0x143358[_0x38e6('0x2d')]===_0x38e6('0x7a');});break;case'custom':_0x3f9635=_[_0x38e6('0x46')](_0x4cad9[_0x38e6('0x79')],function(_0x7f2348){return _0x7f2348['id']===_0x322ba6[_0x38e6('0x7b')]&&_0x7f2348[_0x38e6('0x2d')]===_0x38e6('0x7c');});break;}if(_0x3f9635)_0xcccee3[_0x38e6('0x5d')](_0x322ba6);});_0x278d4c[_0x38e6('0x41')]=_0xcccee3['length'];_0x278d4c[_0x38e6('0x7d')]=_0xcccee3;return _0x278d4c;});}else{return db[_0x249342[_0x38e6('0x6f')]]['count']({'where':_0x5a4cd7[_0x38e6('0x3d')]})[_0x38e6('0x26')](function(_0xc64ec1){_0x278d4c[_0x38e6('0x41')]=_0xc64ec1;if(_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x45')]){if(_0x249342[_0x38e6('0x6f')]===_0x38e6('0x7e')){_0x5a4cd7[_0x38e6('0x42')]=[{'model':db[_0x38e6('0x7f')],'as':'Tags','attributes':['id',_0x38e6('0x29'),'color'],'required':_0x1c3fa7[_0x38e6('0x31')]['tag']?!![]:![]},{'model':db[_0x38e6('0x7f')],'as':_0x38e6('0x80'),'attributes':['id','name','color'],'through':_0x1c3fa7[_0x38e6('0x31')]['tag']?{'attributes':[],'where':{'TagId':_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x81')]||undefined}}:{},'required':_0x1c3fa7[_0x38e6('0x31')][_0x38e6('0x81')]?!![]:![]}];}else{_0x5a4cd7[_0x38e6('0x42')]=[{'all':!![]}];}}return db[_0x249342['childModel']][_0x38e6('0x53')](_0x5a4cd7);})[_0x38e6('0x26')](function(_0x5f3d1c){_0x278d4c[_0x38e6('0x7d')]=_0x5f3d1c;return _0x278d4c;});}}else{return _0x278d4c;}})[_0x38e6('0x26')](respondWithFilteredResult(_0x1d113e,_0x5a4cd7))[_0x38e6('0x47')](handleError(_0x1d113e,null));};function getAllResources(_0x4aaf29,_0x43dd88){return new BPromise(function(_0x15413c,_0x43ceef){if(_0x43dd88){var _0x4b0360=_0x43dd88[_0x38e6('0x3f')]?{[_0x43dd88[_0x38e6('0x3f')][_0x38e6('0x76')]]:_0x43dd88['filter']['value']}:undefined;return db[_0x4aaf29][_0x38e6('0x53')]({'where':_0x4b0360,'raw':!![]})[_0x38e6('0x26')](function(_0x35dccf){_0x43dd88[_0x38e6('0x79')]=_['map'](_0x35dccf,'id');_0x15413c(_0x43dd88);})[_0x38e6('0x47')](function(_0x39a99d){_0x43ceef(_0x39a99d);});}else{_0x15413c(null);}});}function getAllFilteredResources(_0x24c471,_0x35a6da){return new BPromise(function(_0x12173e,_0x1328c9){var _0x1d18d7=_0x24c471[_0x38e6('0x3f')]?{[_0x24c471['filter'][_0x38e6('0x76')]]:_0x24c471[_0x38e6('0x3f')][_0x38e6('0x82')]}:undefined;return db[_0x24c471['model']][_0x38e6('0x53')]({'where':_0x1d18d7,'raw':!![]})['then'](function(_0x3175d5){_0x35a6da[_0x38e6('0x79')]=_['map'](_0x3175d5,function(_0x365956){return _0x365956[_0x38e6('0x29')];});_0x12173e(_0x35a6da);})[_0x38e6('0x47')](function(_0x4585a9){_0x1328c9(_0x4585a9);});});}function getAllowedResources(_0x34d8cf,_0x5e491d,_0x4f75d3){return new BPromise(function(_0x362f3e,_0x347399){if(_0x5e491d){return db['UserProfileResource'][_0x38e6('0x53')]({'where':{'sectionId':_0x5e491d['id']},'raw':!![]})[_0x38e6('0x26')](function(_0x442673){if(_0x34d8cf['field']&&_0x34d8cf[_0x38e6('0x76')]!=='id'){_0x5e491d[_0x38e6('0x79')]=_[_0x38e6('0x30')](_0x442673,function(_0xb5a5ca){return _0xb5a5ca[_0x34d8cf['field']];});}else{if(_0x4f75d3===_0x38e6('0x77')){_0x5e491d[_0x38e6('0x79')]=_['map'](_0x442673,function(_0x319055){return{'id':_0x319055[_0x38e6('0x66')],'type':_0x319055[_0x38e6('0x2d')]};});}else{_0x5e491d['associatedResources']=_[_0x38e6('0x30')](_0x442673,function(_0x5d5067){return _0x5d5067[_0x38e6('0x66')];});}}_0x362f3e(_0x5e491d);})['catch'](function(_0x1e6c6e){_0x347399(_0x1e6c6e);});}else{_0x362f3e(null);}});}function getQueryModels(_0x34f6d2,_0x2ce0a4){var _0x4b62c1=_0x34f6d2['toLowerCase']();var _0x313f1d={'childModel':undefined,'parentSections':[]};switch(_0x4b62c1){case'squareprojects':_0x313f1d[_0x38e6('0x6f')]='SquareProject';break;case _0x38e6('0x83'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x84');break;case'squarerecordings':_0x313f1d['childModel']=_0x38e6('0x85');_0x313f1d['parentSections']=[{'name':'SquareProjects','field':_0x38e6('0x29'),'foreignKey':'projectName'}];break;case _0x38e6('0x86'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x87');break;case _0x38e6('0x88'):_0x313f1d['childModel']=_0x38e6('0x7e');_0x313f1d['parentSections']=[{'name':_0x38e6('0x89'),'field':'id','foreignKey':'ListId'}];break;case _0x38e6('0x8a'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x8b');break;case _0x38e6('0x8c'):_0x313f1d['childModel']=_0x38e6('0x8d');break;case _0x38e6('0x8e'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x8f');break;case _0x38e6('0x90'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x91');break;case _0x38e6('0x92'):_0x313f1d['childModel']='ChatWebsite';break;case _0x38e6('0x93'):_0x313f1d[_0x38e6('0x6f')]='FaxQueue';break;case _0x38e6('0x94'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x95');break;case _0x38e6('0x96'):case _0x38e6('0x97'):case _0x38e6('0x98'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x99');break;case'contexts':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x9a');break;case _0x38e6('0x9b'):_0x313f1d['childModel']=_0x38e6('0x9c');break;case _0x38e6('0x9d'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x9e');_0x313f1d[_0x38e6('0x72')]=[{'name':_0x38e6('0x9f'),'field':_0x38e6('0x29'),'foreignKey':_0x38e6('0xa0'),'model':'User','filter':{'field':'role','value':[_0x38e6('0xa1')]}},{'name':_0x38e6('0xa2'),'field':_0x38e6('0x29'),'foreignKey':'membername','model':_0x38e6('0xa3'),'filter':{'field':'role','value':['telephone']}},{'name':_0x38e6('0xa4'),'field':_0x38e6('0x29'),'foreignKey':_0x38e6('0xa5'),'model':_0x38e6('0xa6'),'filter':{'field':_0x38e6('0x2d'),'value':[_0x38e6('0xa7')]}},{'name':_0x38e6('0xa8'),'field':_0x38e6('0x29'),'foreignKey':_0x38e6('0xa5'),'model':'VoiceQueue','filter':{'field':_0x38e6('0x2d'),'value':['outbound']}}];break;case _0x38e6('0xa9'):_0x313f1d['childModel']=_0x38e6('0xaa');break;case _0x38e6('0xab'):_0x313f1d['childModel']=_0x38e6('0xac');break;case _0x38e6('0xad'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xae');break;case _0x38e6('0xaf'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xb0');break;case'mailqueues':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xb1');break;case _0x38e6('0xb2'):_0x313f1d['childModel']=_0x38e6('0xb3');break;case _0x38e6('0xb4'):_0x313f1d['childModel']='MailSubstatus';break;case _0x38e6('0xb5'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xb6');break;case _0x38e6('0xb7'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xb8');break;case'smsqueues':_0x313f1d[_0x38e6('0x6f')]='SmsQueue';break;case'smsaccounts':_0x313f1d[_0x38e6('0x6f')]='SmsAccount';break;case'whatsappqueues':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xb9');break;case _0x38e6('0xba'):_0x313f1d[_0x38e6('0x6f')]='WhatsappAccount';break;case _0x38e6('0xbb'):_0x313f1d['childModel']='Team';break;case _0x38e6('0xbc'):case _0x38e6('0xbd'):_0x313f1d['childModel']=_0x38e6('0xa6');if(_0x2ce0a4){_0x313f1d['parentSections']=[{'name':'VoiceQueues'},{'name':_0x38e6('0xa8')}];}break;case _0x38e6('0xbe'):case _0x38e6('0xbf'):case _0x38e6('0xc0'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xa3');if(_0x2ce0a4){_0x313f1d[_0x38e6('0x72')]=[{'name':'Users','filter':{'field':_0x38e6('0xc1'),'value':[_0x38e6('0xc2'),_0x38e6('0xc3')]},'ignore':!![]},{'name':_0x38e6('0x9f')},{'name':_0x38e6('0xa2')}];}break;case _0x38e6('0xc4'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xc5');break;case _0x38e6('0xc6'):_0x313f1d['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xc7');break;case _0x38e6('0xc8'):_0x313f1d[_0x38e6('0x6f')]='SugarcrmAccount';break;case'deskaccounts':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xc9');break;case _0x38e6('0xca'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xcb');break;case'vtigeraccounts':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xa3');break;case _0x38e6('0xcc'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xcd');break;case _0x38e6('0xce'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xcf');break;case _0x38e6('0xd0'):_0x313f1d[_0x38e6('0x6f')]='Dashboard';break;case'intervals':_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xd1');break;case _0x38e6('0xd2'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xd3');break;case _0x38e6('0xd4'):_0x313f1d[_0x38e6('0x6f')]='Schedule';break;case _0x38e6('0xd5'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xd6');break;case _0x38e6('0xd7'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x7f');break;case _0x38e6('0xd8'):_0x313f1d['childModel']='Template';break;case _0x38e6('0xd9'):_0x313f1d['childModel']=_0x38e6('0xda');break;case _0x38e6('0xdb'):_0x313f1d[_0x38e6('0x6f')]='Trunk';break;case'variables':_0x313f1d['childModel']=_0x38e6('0xdc');break;case'plugins':_0x313f1d[_0x38e6('0x6f')]='Plugin';break;case _0x38e6('0xdd'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0x77');_0x313f1d['parentSections']=[{'name':_0x38e6('0xde'),'field':'id','foreignKey':'reportId'}];break;case _0x38e6('0xdf'):_0x313f1d['childModel']=_0x38e6('0xe0');break;case _0x38e6('0xba'):_0x313f1d[_0x38e6('0x6f')]=_0x38e6('0xe1');break;default:return _0x313f1d;}return _0x313f1d;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 06b683d..13bf71e 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 _0x883a=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0x883a,0x19d));var _0xa883=function(_0x30ea39,_0xfe89d2){_0x30ea39=_0x30ea39-0x0;var _0x3d65f5=_0x883a[_0x30ea39];return _0x3d65f5;};'use strict';var EventEmitter=require(_0xa883('0x0'));var UserProfile=require(_0xa883('0x1'))['db'][_0xa883('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa883('0x3')](0x0);var events={'afterCreate':_0xa883('0x4'),'afterUpdate':_0xa883('0x5'),'afterDestroy':_0xa883('0x6')};function emitEvent(_0x33d826){return function(_0x471444,_0x3bb8a5,_0x2b5598){UserProfileEvents[_0xa883('0x7')](_0x33d826+':'+_0x471444['id'],_0x471444);UserProfileEvents[_0xa883('0x7')](_0x33d826,_0x471444);_0x2b5598(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xa883('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x07f2=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','save','update','emit'];(function(_0x7c7da,_0x4e4ad1){var _0x3f1318=function(_0x25b0f4){while(--_0x25b0f4){_0x7c7da['push'](_0x7c7da['shift']());}};_0x3f1318(++_0x4e4ad1);}(_0x07f2,0xb3));var _0x207f=function(_0xb902de,_0x49806c){_0xb902de=_0xb902de-0x0;var _0x1ab896=_0x07f2[_0xb902de];return _0x1ab896;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x207f('0x0'))['db'][_0x207f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x207f('0x2'),'afterUpdate':_0x207f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x46680f){return function(_0x267a68,_0x57996f,_0x3d0a1f){UserProfileEvents[_0x207f('0x4')](_0x46680f+':'+_0x267a68['id'],_0x267a68);UserProfileEvents[_0x207f('0x4')](_0x46680f,_0x267a68);_0x3d0a1f(null);};}for(var e in events){if(events[_0x207f('0x5')](e)){var event=events[e];UserProfile[_0x207f('0x6')](e,emitEvent(event));}}module[_0x207f('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9f5728b..c734924 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 _0x8e3d=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','define','user_profiles','util','../../config/logger','api','moment'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x8e3d,0x80));var _0xd8e3=function(_0x4c217f,_0x82a1ae){_0x4c217f=_0x4c217f-0x0;var _0x4033b2=_0x8e3d[_0x4c217f];return _0x4033b2;};'use strict';var _=require('lodash');var util=require(_0xd8e3('0x0'));var logger=require(_0xd8e3('0x1'))(_0xd8e3('0x2'));var moment=require(_0xd8e3('0x3'));var BPromise=require(_0xd8e3('0x4'));var rp=require(_0xd8e3('0x5'));var fs=require('fs');var path=require(_0xd8e3('0x6'));var rimraf=require(_0xd8e3('0x7'));var config=require(_0xd8e3('0x8'));var attributes=require(_0xd8e3('0x9'));module['exports']=function(_0x46ecd9,_0xc345e6){return _0x46ecd9[_0xd8e3('0xa')]('UserProfile',attributes,{'tableName':_0xd8e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6bf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api'];(function(_0x2ad5f0,_0x3dbe7e){var _0x1782d3=function(_0x813fe5){while(--_0x813fe5){_0x2ad5f0['push'](_0x2ad5f0['shift']());}};_0x1782d3(++_0x3dbe7e);}(_0xf6bf,0xce));var _0xff6b=function(_0x401baa,_0x51722a){_0x401baa=_0x401baa-0x0;var _0x5c435a=_0xf6bf[_0x401baa];return _0x5c435a;};'use strict';var _=require(_0xff6b('0x0'));var util=require(_0xff6b('0x1'));var logger=require(_0xff6b('0x2'))(_0xff6b('0x3'));var moment=require(_0xff6b('0x4'));var BPromise=require(_0xff6b('0x5'));var rp=require(_0xff6b('0x6'));var fs=require('fs');var path=require(_0xff6b('0x7'));var rimraf=require(_0xff6b('0x8'));var config=require(_0xff6b('0x9'));var attributes=require(_0xff6b('0xa'));module[_0xff6b('0xb')]=function(_0x57e942,_0x82ed50){return _0x57e942[_0xff6b('0xc')](_0xff6b('0xd'),attributes,{'tableName':_0xff6b('0xe'),'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 f90272a..b4a6f73 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 _0x7dfd=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});config[_0xd7df('0xe')]=_[_0xd7df('0xf')](config[_0xd7df('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7df('0x10'))(new Redis(config[_0xd7df('0xe')]));require(_0xd7df('0x11'))[_0xd7df('0x12')](socket);function respondWithRpcPromise(_0x5e59c3,_0x32c5b5,_0x532c14){return new BPromise(function(_0x183ace,_0x567e83){return client[_0xd7df('0x13')](_0x5e59c3,_0x532c14)[_0xd7df('0x14')](function(_0x28d358){logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,_0xd7df('0x17'));logger[_0xd7df('0x18')](_0xd7df('0x19'),_0x32c5b5,_0xd7df('0x17'),JSON[_0xd7df('0x1a')](_0x28d358));if(_0x28d358[_0xd7df('0x1b')]){if(_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1c')]===0x1f4){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x567e83(_0x28d358['error'][_0xd7df('0x1d')]);}logger[_0xd7df('0x1b')]('UserProfile,\x20%s,\x20%s',_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x183ace(_0x28d358['error'][_0xd7df('0x1d')]);}else{logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,'request\x20sent');_0x183ace(_0x28d358[_0xd7df('0x1e')][_0xd7df('0x1d')]);}})[_0xd7df('0x1f')](function(_0x5ba653){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x5ba653);_0x567e83(_0x5ba653);});});} \ No newline at end of file +var _0x33c5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x3b88a5,_0x5907c0){var _0x47867b=function(_0x5b2454){while(--_0x5b2454){_0x3b88a5['push'](_0x3b88a5['shift']());}};_0x47867b(++_0x5907c0);}(_0x33c5,0xe6));var _0x533c=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0x33c5[_0x3e3f27];return _0x15c868;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});config[_0x533c('0xb')]=_[_0x533c('0xc')](config[_0x533c('0xb')],{'host':_0x533c('0xd'),'port':0x18eb});var socket=require(_0x533c('0xe'))(new Redis(config[_0x533c('0xb')]));require(_0x533c('0xf'))[_0x533c('0x10')](socket);function respondWithRpcPromise(_0x2c0214,_0x249f1a,_0x430c51){return new BPromise(function(_0x1b312e,_0x5a150f){return client[_0x533c('0x11')](_0x2c0214,_0x430c51)[_0x533c('0x12')](function(_0x272a11){logger[_0x533c('0x13')](_0x533c('0x14'),_0x249f1a,_0x533c('0x15'));logger['debug'](_0x533c('0x16'),_0x249f1a,_0x533c('0x15'),JSON[_0x533c('0x17')](_0x272a11));if(_0x272a11[_0x533c('0x18')]){if(_0x272a11[_0x533c('0x18')][_0x533c('0x19')]===0x1f4){logger[_0x533c('0x18')](_0x533c('0x14'),_0x249f1a,_0x272a11['error'][_0x533c('0x1a')]);return _0x5a150f(_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);}logger[_0x533c('0x18')]('UserProfile,\x20%s,\x20%s',_0x249f1a,_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);return _0x1b312e(_0x272a11[_0x533c('0x18')][_0x533c('0x1a')]);}else{logger[_0x533c('0x13')](_0x533c('0x14'),_0x249f1a,_0x533c('0x15'));_0x1b312e(_0x272a11[_0x533c('0x1b')][_0x533c('0x1a')]);}})[_0x533c('0x1c')](function(_0x287b9e){logger[_0x533c('0x18')](_0x533c('0x14'),_0x249f1a,_0x287b9e);_0x5a150f(_0x287b9e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4d575c6..65ada8b 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 _0x783e=['length','userProfile:','./userProfile.events','remove','emit','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x783e,0x194));var _0xe783=function(_0x4d7ce7,_0x14b640){_0x4d7ce7=_0x4d7ce7-0x0;var _0x4111a6=_0x783e[_0x4d7ce7];return _0x4111a6;};'use strict';var UserProfileEvents=require(_0xe783('0x0'));var events=['save',_0xe783('0x1'),'update'];function createListener(_0xaaa554,_0x1af4d2){return function(_0xe86d9){_0x1af4d2[_0xe783('0x2')](_0xaaa554,_0xe86d9);};}function removeListener(_0x36984b,_0x37502b){return function(){UserProfileEvents['removeListener'](_0x36984b,_0x37502b);};}exports[_0xe783('0x3')]=function(_0x55097a){for(var _0x1c16ff=0x0,_0x275bc5=events[_0xe783('0x4')];_0x1c16ff<_0x275bc5;_0x1c16ff++){var _0x18e1a2=events[_0x1c16ff];var _0x4e6398=createListener(_0xe783('0x5')+_0x18e1a2,_0x55097a);UserProfileEvents['on'](_0x18e1a2,_0x4e6398);}}; \ No newline at end of file +var _0xe319=['update','emit','removeListener','register','userProfile:','./userProfile.events','save','remove'];(function(_0x4edf61,_0x2734ca){var _0x58a4a7=function(_0x303f56){while(--_0x303f56){_0x4edf61['push'](_0x4edf61['shift']());}};_0x58a4a7(++_0x2734ca);}(_0xe319,0x12d));var _0x9e31=function(_0x48d90d,_0x48affe){_0x48d90d=_0x48d90d-0x0;var _0x3f8b11=_0xe319[_0x48d90d];return _0x3f8b11;};'use strict';var UserProfileEvents=require(_0x9e31('0x0'));var events=[_0x9e31('0x1'),_0x9e31('0x2'),_0x9e31('0x3')];function createListener(_0x204c16,_0x15ba9b){return function(_0xf61cad){_0x15ba9b[_0x9e31('0x4')](_0x204c16,_0xf61cad);};}function removeListener(_0x59c5d6,_0x3170ea){return function(){UserProfileEvents[_0x9e31('0x5')](_0x59c5d6,_0x3170ea);};}exports[_0x9e31('0x6')]=function(_0x910989){for(var _0x529855=0x0,_0x2eb4e8=events['length'];_0x529855<_0x2eb4e8;_0x529855++){var _0x10fac0=events[_0x529855];var _0x26ffe4=createListener(_0x9e31('0x7')+_0x10fac0,_0x910989);UserProfileEvents['on'](_0x10fac0,_0x26ffe4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3b18a50..8948ca3 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 _0x657b=['show','post','create','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4be888,_0x3ba1a3){var _0x58f940=function(_0x21eade){while(--_0x21eade){_0x4be888['push'](_0x4be888['shift']());}};_0x58f940(++_0x3ba1a3);}(_0x657b,0x77));var _0xb657=function(_0x32dfc8,_0x37848a){_0x32dfc8=_0x32dfc8-0x0;var _0x8b0e66=_0x657b[_0x32dfc8];return _0x8b0e66;};'use strict';var multer=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var path=require(_0xb657('0x2'));var timeout=require('connect-timeout');var express=require(_0xb657('0x3'));var router=express[_0xb657('0x4')]();var auth=require(_0xb657('0x5'));var interaction=require(_0xb657('0x6'));var config=require('../../config/environment');var controller=require(_0xb657('0x7'));router[_0xb657('0x8')]('/',auth['isAuthenticated'](),controller[_0xb657('0x9')]);router['get'](_0xb657('0xa'),auth[_0xb657('0xb')](),controller[_0xb657('0xc')]);router[_0xb657('0x8')](_0xb657('0xd'),auth[_0xb657('0xb')](),controller[_0xb657('0xe')]);router[_0xb657('0xf')]('/',auth['isAuthenticated'](),controller[_0xb657('0x10')]);router['put'](_0xb657('0xd'),auth[_0xb657('0xb')](),controller['update']);router[_0xb657('0x11')](_0xb657('0xd'),auth[_0xb657('0xb')](),controller['destroy']);module[_0xb657('0x12')]=router; \ No newline at end of file +var _0x53aa=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0x35bca3,_0x9ad128){var _0x45c6f5=function(_0x2992b3){while(--_0x2992b3){_0x35bca3['push'](_0x35bca3['shift']());}};_0x45c6f5(++_0x9ad128);}(_0x53aa,0x6d));var _0xa53a=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x53aa[_0x580647];return _0x5f0792;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa53a('0x0'));var timeout=require(_0xa53a('0x1'));var express=require('express');var router=express[_0xa53a('0x2')]();var auth=require(_0xa53a('0x3'));var interaction=require(_0xa53a('0x4'));var config=require(_0xa53a('0x5'));var controller=require(_0xa53a('0x6'));router[_0xa53a('0x7')]('/',auth[_0xa53a('0x8')](),controller[_0xa53a('0x9')]);router[_0xa53a('0x7')](_0xa53a('0xa'),auth['isAuthenticated'](),controller[_0xa53a('0xb')]);router['get'](_0xa53a('0xc'),auth['isAuthenticated'](),controller[_0xa53a('0xd')]);router['post']('/',auth[_0xa53a('0x8')](),controller[_0xa53a('0xe')]);router[_0xa53a('0xf')](_0xa53a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa53a('0x10')](_0xa53a('0xc'),auth[_0xa53a('0x8')](),controller['destroy']);module[_0xa53a('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 bd708e8..a18c3a0 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 _0x46ba=['INTEGER','sequelize','exports','STRING'];(function(_0x4bdb20,_0x244ecc){var _0xbb59f8=function(_0x5ac483){while(--_0x5ac483){_0x4bdb20['push'](_0x4bdb20['shift']());}};_0xbb59f8(++_0x244ecc);}(_0x46ba,0x75));var _0xa46b=function(_0x1387a1,_0xc2f262){_0x1387a1=_0x1387a1-0x0;var _0x5d9f86=_0x46ba[_0x1387a1];return _0x5d9f86;};'use strict';var Sequelize=require(_0xa46b('0x0'));module[_0xa46b('0x1')]={'name':{'type':Sequelize[_0xa46b('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa46b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa46b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8728=['sequelize','INTEGER'];(function(_0x49124a,_0x3bdc48){var _0x3fe4a5=function(_0x41ce5a){while(--_0x41ce5a){_0x49124a['push'](_0x49124a['shift']());}};_0x3fe4a5(++_0x3bdc48);}(_0x8728,0x17a));var _0x8872=function(_0x588794,_0xf9b41a){_0x588794=_0x588794-0x0;var _0x495ef1=_0x8728[_0x588794];return _0x495ef1;};'use strict';var Sequelize=require(_0x8872('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8872('0x1')],'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 b62041b..281d95a 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 _0x6b8f=['map','UserProfileResource','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','intersection','create','body','catch','find','destroy','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','offset','set','apply','update','then','sendStatus','error','name','send','index'];(function(_0x1c62ed,_0x14bd68){var _0x14a5ce=function(_0x765efe){while(--_0x765efe){_0x1c62ed['push'](_0x1c62ed['shift']());}};_0x14a5ce(++_0x14bd68);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x480a9a,_0x116dfc){_0x480a9a=_0x480a9a-0x0;var _0x4627f2=_0x6b8f[_0x480a9a];return _0x4627f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var Mustache=require('mustache');var util=require(_0xf6b8('0x4'));var path=require(_0xf6b8('0x5'));var sox=require(_0xf6b8('0x6'));var csv=require('to-csv');var ejs=require(_0xf6b8('0x7'));var fs=require('fs');var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0xb'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xc'));var Redis=require(_0xf6b8('0xd'));var authService=require(_0xf6b8('0xe'));var qs=require(_0xf6b8('0xf'));var as=require(_0xf6b8('0x10'));var hardwareService=require(_0xf6b8('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x29c278,_0x1d96b9){_0x1d96b9=_0x1d96b9||0xcc;return function(_0x5a6118){if(_0x5a6118){return _0x29c278['sendStatus'](_0x1d96b9);}return _0x29c278[_0xf6b8('0x14')](_0x1d96b9)[_0xf6b8('0x15')]();};}function respondWithResult(_0x5104d3,_0xfcecc9){_0xfcecc9=_0xfcecc9||0xc8;return function(_0x2db10c){if(_0x2db10c){return _0x5104d3[_0xf6b8('0x14')](_0xfcecc9)['json'](_0x2db10c);}};}function respondWithFilteredResult(_0x3e162e,_0x53d744){return function(_0x410345){if(_0x410345){var _0x1ee041=_0x410345['count'],_0x2e1748=_0x53d744['offset'],_0x1a4b65=_0x53d744[_0xf6b8('0x16')]+_0x53d744['limit'],_0x12f9a8;if(_0x1a4b65>=_0x1ee041){_0x1a4b65=_0x1ee041;_0x12f9a8=0xc8;}else{_0x12f9a8=0xce;}_0x3e162e[_0xf6b8('0x14')](_0x12f9a8);return _0x3e162e[_0xf6b8('0x17')]('Content-Range',_0x2e1748+'-'+_0x1a4b65+'/'+_0x1ee041)['json'](_0x410345);}return null;};}function patchUpdates(_0x1d0ee9){return function(_0x2e2b29){try{jsonpatch[_0xf6b8('0x18')](_0x2e2b29,_0x1d0ee9,!![]);}catch(_0x2cac60){return BPromise['reject'](_0x2cac60);}return _0x2e2b29['save']();};}function saveUpdates(_0x5a9553,_0x3298a4){return function(_0x2a8195){if(_0x2a8195){return _0x2a8195[_0xf6b8('0x19')](_0x5a9553)['then'](function(_0x136bc6){return _0x136bc6;});}return null;};}function removeEntity(_0x193e84,_0x3d2c57){return function(_0x9c660c){if(_0x9c660c){return _0x9c660c['destroy']()[_0xf6b8('0x1a')](function(){_0x193e84['status'](0xcc)[_0xf6b8('0x15')]();});}};}function handleEntityNotFound(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(!_0x4127c9){_0x2b5bd3[_0xf6b8('0x1b')](0x194);}return _0x4127c9;};}function handleError(_0x55c72,_0x4edd29){_0x4edd29=_0x4edd29||0x1f4;return function(_0x1aca8a){logger[_0xf6b8('0x1c')](_0x1aca8a['stack']);if(_0x1aca8a[_0xf6b8('0x1d')]){delete _0x1aca8a[_0xf6b8('0x1d')];}_0x55c72[_0xf6b8('0x14')](_0x4edd29)[_0xf6b8('0x1e')](_0x1aca8a);};}exports[_0xf6b8('0x1f')]=function(_0x573ad8,_0x5e5b1c){var _0xfa77d3={},_0x9050c6={},_0x5a9514={'count':0x0,'rows':[]};var _0x459ed0=_[_0xf6b8('0x20')](db[_0xf6b8('0x21')]['rawAttributes'],function(_0x458935){return{'name':_0x458935[_0xf6b8('0x22')],'type':_0x458935['type'][_0xf6b8('0x23')]};});_0x9050c6[_0xf6b8('0x24')]=_[_0xf6b8('0x20')](_0x459ed0,_0xf6b8('0x1d'));_0x9050c6['query']=_[_0xf6b8('0x25')](_0x573ad8[_0xf6b8('0x26')]);_0x9050c6[_0xf6b8('0x27')]=_['intersection'](_0x9050c6[_0xf6b8('0x24')],_0x9050c6[_0xf6b8('0x26')]);_0xfa77d3[_0xf6b8('0x28')]=_['intersection'](_0x9050c6[_0xf6b8('0x24')],qs[_0xf6b8('0x29')](_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x29')]));_0xfa77d3['attributes']=_0xfa77d3[_0xf6b8('0x28')][_0xf6b8('0x2a')]?_0xfa77d3[_0xf6b8('0x28')]:_0x9050c6['model'];if(!_0x573ad8['query'][_0xf6b8('0x2b')](_0xf6b8('0x2c'))){_0xfa77d3[_0xf6b8('0x2d')]=qs[_0xf6b8('0x2d')](_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x2d')]);_0xfa77d3[_0xf6b8('0x16')]=qs[_0xf6b8('0x16')](_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x16')]);}_0xfa77d3[_0xf6b8('0x2e')]=qs[_0xf6b8('0x2f')](_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x2f')]);_0xfa77d3[_0xf6b8('0x30')]=qs[_0xf6b8('0x27')](_[_0xf6b8('0x31')](_0x573ad8[_0xf6b8('0x26')],_0x9050c6['filters']),_0x459ed0);if(_0x573ad8['query'][_0xf6b8('0x32')]){_0xfa77d3[_0xf6b8('0x30')]=_[_0xf6b8('0x33')](_0xfa77d3[_0xf6b8('0x30')],{'$or':_[_0xf6b8('0x20')](_0x459ed0,function(_0x374aa7){if(_0x374aa7[_0xf6b8('0x34')]!==_0xf6b8('0x35')){var _0x4307b4={};_0x4307b4[_0x374aa7[_0xf6b8('0x1d')]]={'$like':'%'+_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x32')]+'%'};return _0x4307b4;}})});}_0xfa77d3=_['merge']({},_0xfa77d3,_0x573ad8[_0xf6b8('0x36')]);var _0x3d2f18={'where':_0xfa77d3['where']};return db[_0xf6b8('0x21')][_0xf6b8('0x37')](_0x3d2f18)[_0xf6b8('0x1a')](function(_0x456cb5){_0x5a9514[_0xf6b8('0x37')]=_0x456cb5;if(_0x573ad8[_0xf6b8('0x26')][_0xf6b8('0x38')]){_0xfa77d3[_0xf6b8('0x39')]=[{'all':!![]}];}return db[_0xf6b8('0x21')][_0xf6b8('0x3a')](_0xfa77d3);})[_0xf6b8('0x1a')](function(_0x3b0554){_0x5a9514[_0xf6b8('0x3b')]=_0x3b0554;return _0x5a9514;})[_0xf6b8('0x1a')](respondWithFilteredResult(_0x5e5b1c,_0xfa77d3))['catch'](handleError(_0x5e5b1c,null));};exports['show']=function(_0x5f42c2,_0x3bb212){var _0x2c68f5={'raw':![],'where':{'id':_0x5f42c2[_0xf6b8('0x3c')]['id']}},_0x45daea={};_0x45daea[_0xf6b8('0x24')]=_[_0xf6b8('0x25')](db[_0xf6b8('0x21')]['rawAttributes']);_0x45daea[_0xf6b8('0x26')]=_['keys'](_0x5f42c2[_0xf6b8('0x26')]);_0x45daea[_0xf6b8('0x27')]=_[_0xf6b8('0x3d')](_0x45daea[_0xf6b8('0x24')],_0x45daea[_0xf6b8('0x26')]);_0x2c68f5['attributes']=_[_0xf6b8('0x3d')](_0x45daea[_0xf6b8('0x24')],qs[_0xf6b8('0x29')](_0x5f42c2[_0xf6b8('0x26')][_0xf6b8('0x29')]));_0x2c68f5['attributes']=_0x2c68f5[_0xf6b8('0x28')][_0xf6b8('0x2a')]?_0x2c68f5[_0xf6b8('0x28')]:_0x45daea['model'];if(_0x5f42c2['query'][_0xf6b8('0x38')]){_0x2c68f5[_0xf6b8('0x39')]=[{'all':!![]}];}_0x2c68f5=_[_0xf6b8('0x33')]({},_0x2c68f5,_0x5f42c2[_0xf6b8('0x36')]);return db['UserProfileResource']['find'](_0x2c68f5)['then'](handleEntityNotFound(_0x3bb212,null))[_0xf6b8('0x1a')](respondWithResult(_0x3bb212,null))['catch'](handleError(_0x3bb212,null));};exports[_0xf6b8('0x3e')]=function(_0x1fc4e0,_0x12f582){return db[_0xf6b8('0x21')][_0xf6b8('0x3e')](_0x1fc4e0[_0xf6b8('0x3f')],{})[_0xf6b8('0x1a')](respondWithResult(_0x12f582,0xc9))[_0xf6b8('0x40')](handleError(_0x12f582,null));};exports[_0xf6b8('0x19')]=function(_0x597511,_0x1144b3){if(_0x597511['body']['id']){delete _0x597511[_0xf6b8('0x3f')]['id'];}return db[_0xf6b8('0x21')][_0xf6b8('0x41')]({'where':{'id':_0x597511[_0xf6b8('0x3c')]['id']}})[_0xf6b8('0x1a')](handleEntityNotFound(_0x1144b3,null))[_0xf6b8('0x1a')](saveUpdates(_0x597511[_0xf6b8('0x3f')],null))['then'](respondWithResult(_0x1144b3,null))[_0xf6b8('0x40')](handleError(_0x1144b3,null));};exports[_0xf6b8('0x42')]=function(_0x7cb02b,_0xa1cb8){return db['UserProfileResource'][_0xf6b8('0x41')]({'where':{'id':_0x7cb02b[_0xf6b8('0x3c')]['id']}})['then'](handleEntityNotFound(_0xa1cb8,null))[_0xf6b8('0x1a')](removeEntity(_0xa1cb8,null))[_0xf6b8('0x40')](handleError(_0xa1cb8,null));};exports[_0xf6b8('0x43')]=function(_0x55eeb5,_0x41ea1f){return db['UserProfileResource'][_0xf6b8('0x43')]()[_0xf6b8('0x1a')](respondWithResult(_0x41ea1f,null))['catch'](handleError(_0x41ea1f,null));}; \ No newline at end of file +var _0x33c5=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x33c5,0xe6));var _0x533c=function(_0x4f8b2b,_0x1dc8dd){_0x4f8b2b=_0x4f8b2b-0x0;var _0x2f230a=_0x33c5[_0x4f8b2b];return _0x2f230a;};'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'];function respondWithStatusCode(_0x346e0f,_0x530e10){_0x530e10=_0x530e10||0xcc;return function(_0x5c9462){if(_0x5c9462){return _0x346e0f[_0x533c('0x1b')](_0x530e10);}return _0x346e0f[_0x533c('0x1c')](_0x530e10)[_0x533c('0x1d')]();};}function respondWithResult(_0x2d5bc8,_0x1a2a83){_0x1a2a83=_0x1a2a83||0xc8;return function(_0x8d7c66){if(_0x8d7c66){return _0x2d5bc8[_0x533c('0x1c')](_0x1a2a83)['json'](_0x8d7c66);}};}function respondWithFilteredResult(_0x335f73,_0x7c1d33){return function(_0x3f4a5c){if(_0x3f4a5c){var _0x3e544f=_0x3f4a5c[_0x533c('0x1e')],_0x56dfb7=_0x7c1d33[_0x533c('0x1f')],_0x1031e7=_0x7c1d33[_0x533c('0x1f')]+_0x7c1d33[_0x533c('0x20')],_0x1ed6ba;if(_0x1031e7>=_0x3e544f){_0x1031e7=_0x3e544f;_0x1ed6ba=0xc8;}else{_0x1ed6ba=0xce;}_0x335f73[_0x533c('0x1c')](_0x1ed6ba);return _0x335f73[_0x533c('0x21')](_0x533c('0x22'),_0x56dfb7+'-'+_0x1031e7+'/'+_0x3e544f)[_0x533c('0x23')](_0x3f4a5c);}return null;};}function patchUpdates(_0x287b9e){return function(_0x2c41e9){try{jsonpatch[_0x533c('0x24')](_0x2c41e9,_0x287b9e,!![]);}catch(_0x23f970){return BPromise[_0x533c('0x25')](_0x23f970);}return _0x2c41e9[_0x533c('0x26')]();};}function saveUpdates(_0x1ded76,_0x2bc58f){return function(_0x4ba0bd){if(_0x4ba0bd){return _0x4ba0bd[_0x533c('0x27')](_0x1ded76)['then'](function(_0x57f5aa){return _0x57f5aa;});}return null;};}function removeEntity(_0x44ff98,_0x36d4e4){return function(_0x5f5090){if(_0x5f5090){return _0x5f5090[_0x533c('0x28')]()[_0x533c('0x29')](function(){_0x44ff98[_0x533c('0x1c')](0xcc)[_0x533c('0x1d')]();});}};}function handleEntityNotFound(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(!_0x42c87b){_0x5ebbe0[_0x533c('0x1b')](0x194);}return _0x42c87b;};}function handleError(_0x107a97,_0x25f6ef){_0x25f6ef=_0x25f6ef||0x1f4;return function(_0x140269){logger[_0x533c('0x2a')](_0x140269[_0x533c('0x2b')]);if(_0x140269[_0x533c('0x2c')]){delete _0x140269[_0x533c('0x2c')];}_0x107a97['status'](_0x25f6ef)[_0x533c('0x2d')](_0x140269);};}exports[_0x533c('0x2e')]=function(_0x503c2e,_0x3caaa5){var _0x4f9f4a={},_0x21f58d={},_0x14d783={'count':0x0,'rows':[]};var _0x4a0e86=_[_0x533c('0x2f')](db[_0x533c('0x30')][_0x533c('0x31')],function(_0x212d1b){return{'name':_0x212d1b[_0x533c('0x32')],'type':_0x212d1b[_0x533c('0x33')][_0x533c('0x34')]};});_0x21f58d[_0x533c('0x35')]=_[_0x533c('0x2f')](_0x4a0e86,'name');_0x21f58d[_0x533c('0x36')]=_['keys'](_0x503c2e[_0x533c('0x36')]);_0x21f58d[_0x533c('0x37')]=_[_0x533c('0x38')](_0x21f58d[_0x533c('0x35')],_0x21f58d[_0x533c('0x36')]);_0x4f9f4a[_0x533c('0x39')]=_[_0x533c('0x38')](_0x21f58d[_0x533c('0x35')],qs[_0x533c('0x3a')](_0x503c2e[_0x533c('0x36')][_0x533c('0x3a')]));_0x4f9f4a[_0x533c('0x39')]=_0x4f9f4a[_0x533c('0x39')][_0x533c('0x3b')]?_0x4f9f4a[_0x533c('0x39')]:_0x21f58d['model'];if(!_0x503c2e[_0x533c('0x36')][_0x533c('0x3c')](_0x533c('0x3d'))){_0x4f9f4a[_0x533c('0x20')]=qs['limit'](_0x503c2e[_0x533c('0x36')][_0x533c('0x20')]);_0x4f9f4a[_0x533c('0x1f')]=qs[_0x533c('0x1f')](_0x503c2e[_0x533c('0x36')]['offset']);}_0x4f9f4a['order']=qs['sort'](_0x503c2e['query']['sort']);_0x4f9f4a[_0x533c('0x3e')]=qs['filters'](_[_0x533c('0x3f')](_0x503c2e['query'],_0x21f58d[_0x533c('0x37')]),_0x4a0e86);if(_0x503c2e[_0x533c('0x36')][_0x533c('0x40')]){_0x4f9f4a['where']=_[_0x533c('0x41')](_0x4f9f4a[_0x533c('0x3e')],{'$or':_[_0x533c('0x2f')](_0x4a0e86,function(_0x55b010){if(_0x55b010[_0x533c('0x33')]!==_0x533c('0x42')){var _0x30e5eb={};_0x30e5eb[_0x55b010['name']]={'$like':'%'+_0x503c2e[_0x533c('0x36')][_0x533c('0x40')]+'%'};return _0x30e5eb;}})});}_0x4f9f4a=_[_0x533c('0x41')]({},_0x4f9f4a,_0x503c2e[_0x533c('0x43')]);var _0x454dbc={'where':_0x4f9f4a[_0x533c('0x3e')]};return db[_0x533c('0x30')][_0x533c('0x1e')](_0x454dbc)[_0x533c('0x29')](function(_0x2c03fa){_0x14d783[_0x533c('0x1e')]=_0x2c03fa;if(_0x503c2e['query'][_0x533c('0x44')]){_0x4f9f4a[_0x533c('0x45')]=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x46')](_0x4f9f4a);})[_0x533c('0x29')](function(_0x1b83b2){_0x14d783['rows']=_0x1b83b2;return _0x14d783;})[_0x533c('0x29')](respondWithFilteredResult(_0x3caaa5,_0x4f9f4a))[_0x533c('0x47')](handleError(_0x3caaa5,null));};exports[_0x533c('0x48')]=function(_0x5e462e,_0x1fb236){var _0x4170e4={'raw':![],'where':{'id':_0x5e462e[_0x533c('0x49')]['id']}},_0x315e67={};_0x315e67['model']=_[_0x533c('0x4a')](db['UserProfileResource'][_0x533c('0x31')]);_0x315e67[_0x533c('0x36')]=_['keys'](_0x5e462e[_0x533c('0x36')]);_0x315e67[_0x533c('0x37')]=_[_0x533c('0x38')](_0x315e67['model'],_0x315e67['query']);_0x4170e4['attributes']=_['intersection'](_0x315e67[_0x533c('0x35')],qs['fields'](_0x5e462e[_0x533c('0x36')]['fields']));_0x4170e4[_0x533c('0x39')]=_0x4170e4['attributes'][_0x533c('0x3b')]?_0x4170e4[_0x533c('0x39')]:_0x315e67['model'];if(_0x5e462e[_0x533c('0x36')][_0x533c('0x44')]){_0x4170e4[_0x533c('0x45')]=[{'all':!![]}];}_0x4170e4=_[_0x533c('0x41')]({},_0x4170e4,_0x5e462e[_0x533c('0x43')]);return db['UserProfileResource'][_0x533c('0x4b')](_0x4170e4)[_0x533c('0x29')](handleEntityNotFound(_0x1fb236,null))[_0x533c('0x29')](respondWithResult(_0x1fb236,null))[_0x533c('0x47')](handleError(_0x1fb236,null));};exports['create']=function(_0x40cbe0,_0x5080a6){return db['UserProfileResource']['create'](_0x40cbe0[_0x533c('0x4c')],{})['then'](respondWithResult(_0x5080a6,0xc9))[_0x533c('0x47')](handleError(_0x5080a6,null));};exports[_0x533c('0x27')]=function(_0x19878d,_0x471c59){if(_0x19878d[_0x533c('0x4c')]['id']){delete _0x19878d[_0x533c('0x4c')]['id'];}return db[_0x533c('0x30')][_0x533c('0x4b')]({'where':{'id':_0x19878d['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x471c59,null))[_0x533c('0x29')](saveUpdates(_0x19878d[_0x533c('0x4c')],null))['then'](respondWithResult(_0x471c59,null))[_0x533c('0x47')](handleError(_0x471c59,null));};exports[_0x533c('0x28')]=function(_0x5ce027,_0x1d081c){return db['UserProfileResource'][_0x533c('0x4b')]({'where':{'id':_0x5ce027[_0x533c('0x49')]['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x1d081c,null))[_0x533c('0x29')](removeEntity(_0x1d081c,null))[_0x533c('0x47')](handleError(_0x1d081c,null));};exports[_0x533c('0x4d')]=function(_0x1745d5,_0x59a4f0){return db[_0x533c('0x30')][_0x533c('0x4d')]()[_0x533c('0x29')](respondWithResult(_0x59a4f0,null))[_0x533c('0x47')](handleError(_0x59a4f0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ce3b4ec..1376a7e 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 _0x2750=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x215a30,_0x33482c){var _0x2c70f4=function(_0x269d6a){while(--_0x269d6a){_0x215a30['push'](_0x215a30['shift']());}};_0x2c70f4(++_0x33482c);}(_0x2750,0x13b));var _0x0275=function(_0x4d1df0,_0x2703e5){_0x4d1df0=_0x4d1df0-0x0;var _0x2738db=_0x2750[_0x4d1df0];return _0x2738db;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x0275('0xe'),_0x0275('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['../../config/logger','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xa74f,0x9a));var _0xfa74=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xa74f[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[{'name':_0xfa74('0x9'),'fields':[_0xfa74('0xa'),'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 9e52561..e55a417 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 _0x80cc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','catch'];(function(_0x4c061c,_0x4054f8){var _0x3f9a13=function(_0x5f21e2){while(--_0x5f21e2){_0x4c061c['push'](_0x4c061c['shift']());}};_0x3f9a13(++_0x4054f8);}(_0x80cc,0x12b));var _0xc80c=function(_0x3be1fc,_0x7fa7df){_0x3be1fc=_0x3be1fc-0x0;var _0x152730=_0x80cc[_0x3be1fc];return _0x152730;};'use strict';var _=require(_0xc80c('0x0'));var util=require(_0xc80c('0x1'));var moment=require(_0xc80c('0x2'));var BPromise=require(_0xc80c('0x3'));var rs=require(_0xc80c('0x4'));var fs=require('fs');var Redis=require(_0xc80c('0x5'));var db=require(_0xc80c('0x6'))['db'];var utils=require(_0xc80c('0x7'));var logger=require(_0xc80c('0x8'))(_0xc80c('0x9'));var config=require(_0xc80c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc80c('0xb')][_0xc80c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x536b66,_0x58c351,_0x2f6e33){return new BPromise(function(_0x2c3173,_0x8623b9){return client[_0xc80c('0xd')](_0x536b66,_0x2f6e33)['then'](function(_0x4bc7f8){logger[_0xc80c('0xe')](_0xc80c('0xf'),_0x58c351,'request\x20sent');logger[_0xc80c('0x10')](_0xc80c('0x11'),_0x58c351,'request\x20sent',JSON['stringify'](_0x4bc7f8));if(_0x4bc7f8['error']){if(_0x4bc7f8['error'][_0xc80c('0x12')]===0x1f4){logger[_0xc80c('0x13')](_0xc80c('0xf'),_0x58c351,_0x4bc7f8[_0xc80c('0x13')][_0xc80c('0x14')]);return _0x8623b9(_0x4bc7f8[_0xc80c('0x13')]['message']);}logger[_0xc80c('0x13')](_0xc80c('0xf'),_0x58c351,_0x4bc7f8['error'][_0xc80c('0x14')]);return _0x2c3173(_0x4bc7f8['error'][_0xc80c('0x14')]);}else{logger['info'](_0xc80c('0xf'),_0x58c351,_0xc80c('0x15'));_0x2c3173(_0x4bc7f8['result'][_0xc80c('0x14')]);}})[_0xc80c('0x16')](function(_0x347391){logger['error'](_0xc80c('0xf'),_0x58c351,_0x347391);_0x8623b9(_0x347391);});});} \ No newline at end of file +var _0xcebc=['UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf61129,_0x523668){var _0xefa38a=function(_0x3c965f){while(--_0x3c965f){_0xf61129['push'](_0xf61129['shift']());}};_0xefa38a(++_0x523668);}(_0xcebc,0xce));var _0xcceb=function(_0x4b1843,_0x42a1ee){_0x4b1843=_0x4b1843-0x0;var _0x3e9984=_0xcebc[_0x4b1843];return _0x3e9984;};'use strict';var _=require(_0xcceb('0x0'));var util=require(_0xcceb('0x1'));var moment=require(_0xcceb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcceb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcceb('0x4'));var logger=require('../../config/logger')(_0xcceb('0x5'));var config=require(_0xcceb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcceb('0x7')][_0xcceb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e151f,_0x537abb,_0x2d5564){return new BPromise(function(_0x316526,_0x167a2){return client[_0xcceb('0x9')](_0x1e151f,_0x2d5564)[_0xcceb('0xa')](function(_0x337581){logger['info'](_0xcceb('0xb'),_0x537abb,_0xcceb('0xc'));logger[_0xcceb('0xd')](_0xcceb('0xe'),_0x537abb,_0xcceb('0xc'),JSON['stringify'](_0x337581));if(_0x337581[_0xcceb('0xf')]){if(_0x337581[_0xcceb('0xf')][_0xcceb('0x10')]===0x1f4){logger['error'](_0xcceb('0xb'),_0x537abb,_0x337581[_0xcceb('0xf')][_0xcceb('0x11')]);return _0x167a2(_0x337581['error'][_0xcceb('0x11')]);}logger[_0xcceb('0xf')](_0xcceb('0xb'),_0x537abb,_0x337581[_0xcceb('0xf')]['message']);return _0x316526(_0x337581[_0xcceb('0xf')][_0xcceb('0x11')]);}else{logger[_0xcceb('0x12')](_0xcceb('0xb'),_0x537abb,_0xcceb('0xc'));_0x316526(_0x337581['result'][_0xcceb('0x11')]);}})[_0xcceb('0x13')](function(_0x326e48){logger[_0xcceb('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x537abb,_0x326e48);_0x167a2(_0x326e48);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index eb457b1..3b65029 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 _0xe747=['./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a7e6c,_0x16a78e){var _0x196594=function(_0x3a8e8c){while(--_0x3a8e8c){_0x3a7e6c['push'](_0x3a7e6c['shift']());}};_0x196594(++_0x16a78e);}(_0xe747,0x13d));var _0x7e74=function(_0x42b782,_0x51c4ae){_0x42b782=_0x42b782-0x0;var _0x572393=_0xe747[_0x42b782];return _0x572393;};'use strict';var multer=require(_0x7e74('0x0'));var util=require(_0x7e74('0x1'));var path=require('path');var timeout=require(_0x7e74('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x7e74('0x3'));var interaction=require(_0x7e74('0x4'));var config=require(_0x7e74('0x5'));var controller=require(_0x7e74('0x6'));router[_0x7e74('0x7')]('/',auth['isAuthenticated'](),controller[_0x7e74('0x8')]);router[_0x7e74('0x7')](_0x7e74('0x9'),auth[_0x7e74('0xa')](),controller['describe']);router[_0x7e74('0x7')](_0x7e74('0xb'),auth[_0x7e74('0xa')](),controller[_0x7e74('0xc')]);router[_0x7e74('0xd')]('/',auth[_0x7e74('0xa')](),controller['create']);router[_0x7e74('0xe')](_0x7e74('0xb'),auth[_0x7e74('0xa')](),controller[_0x7e74('0xf')]);router[_0x7e74('0x10')](_0x7e74('0xb'),auth['isAuthenticated'](),controller[_0x7e74('0x11')]);module[_0x7e74('0x12')]=router; \ No newline at end of file +var _0x023b=['isAuthenticated','index','/describe','describe','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x5d466c,_0x59eff6){var _0x3f8763=function(_0x4af390){while(--_0x4af390){_0x5d466c['push'](_0x5d466c['shift']());}};_0x3f8763(++_0x59eff6);}(_0x023b,0x123));var _0xb023=function(_0x2139be,_0xfba541){_0x2139be=_0x2139be-0x0;var _0x4b121a=_0x023b[_0x2139be];return _0x4b121a;};'use strict';var multer=require(_0xb023('0x0'));var util=require('util');var path=require(_0xb023('0x1'));var timeout=require('connect-timeout');var express=require(_0xb023('0x2'));var router=express[_0xb023('0x3')]();var auth=require(_0xb023('0x4'));var interaction=require(_0xb023('0x5'));var config=require(_0xb023('0x6'));var controller=require(_0xb023('0x7'));router[_0xb023('0x8')]('/',auth[_0xb023('0x9')](),controller[_0xb023('0xa')]);router['get'](_0xb023('0xb'),auth[_0xb023('0x9')](),controller[_0xb023('0xc')]);router[_0xb023('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb023('0xd')]);router[_0xb023('0xe')]('/',auth[_0xb023('0x9')](),controller[_0xb023('0xf')]);router[_0xb023('0x10')]('/:id',auth[_0xb023('0x9')](),controller[_0xb023('0x11')]);router['delete']('/:id',auth[_0xb023('0x9')](),controller[_0xb023('0x12')]);module[_0xb023('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3fd2e69..a547a28 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 _0x2308=['INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize','STRING'];(function(_0x4c5bf4,_0x40b02c){var _0x489020=function(_0x40619e){while(--_0x40619e){_0x4c5bf4['push'](_0x4c5bf4['shift']());}};_0x489020(++_0x40b02c);}(_0x2308,0x108));var _0x8230=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x2308[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x8230('0x0'));module['exports']={'name':{'type':Sequelize[_0x8230('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8230('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8230('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8230('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8230('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8230('0x1')],'set':function(_0xc28549){this['setDataValue'](_0x8230('0x4'),_0xc28549?_0xc28549['join'](''):[]);},'get':function(){return this[_0x8230('0x5')]('crudPermissions')?this[_0x8230('0x5')](_0x8230('0x4'))[_0x8230('0x6')](''):[];}}}; \ No newline at end of file +var _0x5144=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x49d40c,_0x3e759a){var _0x499cff=function(_0x31e439){while(--_0x31e439){_0x49d40c['push'](_0x49d40c['shift']());}};_0x499cff(++_0x3e759a);}(_0x5144,0xe2));var _0x4514=function(_0x175479,_0x101985){_0x175479=_0x175479-0x0;var _0x224b3c=_0x5144[_0x175479];return _0x224b3c;};'use strict';var Sequelize=require('sequelize');module[_0x4514('0x0')]={'name':{'type':Sequelize[_0x4514('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x4514('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4514('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4514('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4514('0x1')],'set':function(_0x58803f){this[_0x4514('0x4')](_0x4514('0x5'),_0x58803f?_0x58803f[_0x4514('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x4514('0x5'))?this[_0x4514('0x7')](_0x4514('0x5'))[_0x4514('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 124582f..b8b959d 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 _0x2b51=['name','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','reject','save','update','then','destroy','error','send','UserProfileSection','rawAttributes','fieldName','type','map'];(function(_0x577f08,_0x4b0e87){var _0x504205=function(_0x4c5ee6){while(--_0x4c5ee6){_0x577f08['push'](_0x577f08['shift']());}};_0x504205(++_0x4b0e87);}(_0x2b51,0x1c5));var _0x12b5=function(_0x35ef51,_0x6f0163){_0x35ef51=_0x35ef51-0x0;var _0x199d5c=_0x2b51[_0x35ef51];return _0x199d5c;};'use strict';var pdf=require(_0x12b5('0x0'));var emlformat=require(_0x12b5('0x1'));var rimraf=require(_0x12b5('0x2'));var zipdir=require(_0x12b5('0x3'));var jsonpatch=require(_0x12b5('0x4'));var rp=require(_0x12b5('0x5'));var moment=require('moment');var BPromise=require(_0x12b5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x12b5('0x7'));var sox=require(_0x12b5('0x8'));var csv=require(_0x12b5('0x9'));var ejs=require(_0x12b5('0xa'));var fs=require('fs');var _=require(_0x12b5('0xb'));var squel=require(_0x12b5('0xc'));var crypto=require(_0x12b5('0xd'));var jsforce=require(_0x12b5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x12b5('0xf'));var Papa=require('papaparse');var Redis=require(_0x12b5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12b5('0x11'));var as=require(_0x12b5('0x12'));var hardwareService=require(_0x12b5('0x13'));var logger=require(_0x12b5('0x14'))(_0x12b5('0x15'));var utils=require(_0x12b5('0x16'));var config=require(_0x12b5('0x17'));var db=require(_0x12b5('0x18'))['db'];function respondWithStatusCode(_0x48a910,_0x5e8c62){_0x5e8c62=_0x5e8c62||0xcc;return function(_0x549a43){if(_0x549a43){return _0x48a910[_0x12b5('0x19')](_0x5e8c62);}return _0x48a910[_0x12b5('0x1a')](_0x5e8c62)[_0x12b5('0x1b')]();};}function respondWithResult(_0x20ac1b,_0x34c877){_0x34c877=_0x34c877||0xc8;return function(_0x30e818){if(_0x30e818){return _0x20ac1b['status'](_0x34c877)['json'](_0x30e818);}};}function respondWithFilteredResult(_0x4a6cb4,_0x5a615e){return function(_0xaebe02){if(_0xaebe02){var _0x2c75dd=_0xaebe02[_0x12b5('0x1c')],_0x395e96=_0x5a615e[_0x12b5('0x1d')],_0x1c648d=_0x5a615e[_0x12b5('0x1d')]+_0x5a615e['limit'],_0x2d8afa;if(_0x1c648d>=_0x2c75dd){_0x1c648d=_0x2c75dd;_0x2d8afa=0xc8;}else{_0x2d8afa=0xce;}_0x4a6cb4['status'](_0x2d8afa);return _0x4a6cb4[_0x12b5('0x1e')]('Content-Range',_0x395e96+'-'+_0x1c648d+'/'+_0x2c75dd)[_0x12b5('0x1f')](_0xaebe02);}return null;};}function patchUpdates(_0x347997){return function(_0x61aa37){try{jsonpatch['apply'](_0x61aa37,_0x347997,!![]);}catch(_0x1ae4ec){return BPromise[_0x12b5('0x20')](_0x1ae4ec);}return _0x61aa37[_0x12b5('0x21')]();};}function saveUpdates(_0x4cfdec,_0x4111fb){return function(_0x5dc11b){if(_0x5dc11b){return _0x5dc11b[_0x12b5('0x22')](_0x4cfdec)[_0x12b5('0x23')](function(_0x4e9c27){return _0x4e9c27;});}return null;};}function removeEntity(_0x4cd9e2,_0x54aa64){return function(_0x1d7374){if(_0x1d7374){return _0x1d7374[_0x12b5('0x24')]()[_0x12b5('0x23')](function(){_0x4cd9e2[_0x12b5('0x1a')](0xcc)[_0x12b5('0x1b')]();});}};}function handleEntityNotFound(_0x2b3c9e,_0x5df7ec){return function(_0x255e07){if(!_0x255e07){_0x2b3c9e[_0x12b5('0x19')](0x194);}return _0x255e07;};}function handleError(_0x149cb6,_0x3d016c){_0x3d016c=_0x3d016c||0x1f4;return function(_0x108eef){logger[_0x12b5('0x25')](_0x108eef['stack']);if(_0x108eef['name']){delete _0x108eef['name'];}_0x149cb6[_0x12b5('0x1a')](_0x3d016c)[_0x12b5('0x26')](_0x108eef);};}exports['index']=function(_0x5ddd5a,_0x4c04fb){var _0x43ec56={},_0x3de7b8={},_0x449c96={'count':0x0,'rows':[]};var _0x4f4bfd=_['map'](db[_0x12b5('0x27')][_0x12b5('0x28')],function(_0x3744b8){return{'name':_0x3744b8[_0x12b5('0x29')],'type':_0x3744b8[_0x12b5('0x2a')]['key']};});_0x3de7b8['model']=_[_0x12b5('0x2b')](_0x4f4bfd,_0x12b5('0x2c'));_0x3de7b8['query']=_[_0x12b5('0x2d')](_0x5ddd5a['query']);_0x3de7b8['filters']=_[_0x12b5('0x2e')](_0x3de7b8[_0x12b5('0x2f')],_0x3de7b8[_0x12b5('0x30')]);_0x43ec56[_0x12b5('0x31')]=_[_0x12b5('0x2e')](_0x3de7b8[_0x12b5('0x2f')],qs['fields'](_0x5ddd5a['query'][_0x12b5('0x32')]));_0x43ec56['attributes']=_0x43ec56['attributes'][_0x12b5('0x33')]?_0x43ec56['attributes']:_0x3de7b8[_0x12b5('0x2f')];if(!_0x5ddd5a[_0x12b5('0x30')][_0x12b5('0x34')](_0x12b5('0x35'))){_0x43ec56[_0x12b5('0x36')]=qs[_0x12b5('0x36')](_0x5ddd5a[_0x12b5('0x30')][_0x12b5('0x36')]);_0x43ec56['offset']=qs[_0x12b5('0x1d')](_0x5ddd5a['query']['offset']);}_0x43ec56[_0x12b5('0x37')]=qs[_0x12b5('0x38')](_0x5ddd5a[_0x12b5('0x30')][_0x12b5('0x38')]);_0x43ec56[_0x12b5('0x39')]=qs[_0x12b5('0x3a')](_['pick'](_0x5ddd5a['query'],_0x3de7b8[_0x12b5('0x3a')]),_0x4f4bfd);if(_0x5ddd5a[_0x12b5('0x30')]['filter']){_0x43ec56[_0x12b5('0x39')]=_[_0x12b5('0x3b')](_0x43ec56[_0x12b5('0x39')],{'$or':_[_0x12b5('0x2b')](_0x4f4bfd,function(_0x32aa36){if(_0x32aa36[_0x12b5('0x2a')]!==_0x12b5('0x3c')){var _0x4d9e43={};_0x4d9e43[_0x32aa36[_0x12b5('0x2c')]]={'$like':'%'+_0x5ddd5a[_0x12b5('0x30')][_0x12b5('0x3d')]+'%'};return _0x4d9e43;}})});}_0x43ec56=_[_0x12b5('0x3b')]({},_0x43ec56,_0x5ddd5a[_0x12b5('0x3e')]);var _0xe4465e={'where':_0x43ec56['where']};return db[_0x12b5('0x27')][_0x12b5('0x1c')](_0xe4465e)[_0x12b5('0x23')](function(_0x11fb83){_0x449c96['count']=_0x11fb83;if(_0x5ddd5a[_0x12b5('0x30')][_0x12b5('0x3f')]){_0x43ec56['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x12b5('0x40')](_0x43ec56);})[_0x12b5('0x23')](function(_0x490083){_0x449c96['rows']=_0x490083;return _0x449c96;})['then'](respondWithFilteredResult(_0x4c04fb,_0x43ec56))[_0x12b5('0x41')](handleError(_0x4c04fb,null));};exports[_0x12b5('0x42')]=function(_0x494b80,_0x2c6955){var _0x377880={'raw':![],'where':{'id':_0x494b80['params']['id']}},_0x2d77e2={};_0x2d77e2['model']=_[_0x12b5('0x2d')](db[_0x12b5('0x27')][_0x12b5('0x28')]);_0x2d77e2[_0x12b5('0x30')]=_[_0x12b5('0x2d')](_0x494b80[_0x12b5('0x30')]);_0x2d77e2['filters']=_['intersection'](_0x2d77e2[_0x12b5('0x2f')],_0x2d77e2[_0x12b5('0x30')]);_0x377880[_0x12b5('0x31')]=_[_0x12b5('0x2e')](_0x2d77e2[_0x12b5('0x2f')],qs[_0x12b5('0x32')](_0x494b80[_0x12b5('0x30')][_0x12b5('0x32')]));_0x377880[_0x12b5('0x31')]=_0x377880[_0x12b5('0x31')][_0x12b5('0x33')]?_0x377880['attributes']:_0x2d77e2['model'];if(_0x494b80[_0x12b5('0x30')][_0x12b5('0x3f')]){_0x377880['include']=[{'all':!![]}];}_0x377880=_[_0x12b5('0x3b')]({},_0x377880,_0x494b80[_0x12b5('0x3e')]);return db[_0x12b5('0x27')][_0x12b5('0x43')](_0x377880)[_0x12b5('0x23')](handleEntityNotFound(_0x2c6955,null))['then'](respondWithResult(_0x2c6955,null))[_0x12b5('0x41')](handleError(_0x2c6955,null));};exports[_0x12b5('0x44')]=function(_0x472730,_0x1ff7be){return db[_0x12b5('0x27')]['create'](_0x472730[_0x12b5('0x45')],{})[_0x12b5('0x23')](respondWithResult(_0x1ff7be,0xc9))['catch'](handleError(_0x1ff7be,null));};exports['update']=function(_0x593874,_0x5ce792){if(_0x593874[_0x12b5('0x45')]['id']){delete _0x593874[_0x12b5('0x45')]['id'];}return db[_0x12b5('0x27')]['find']({'where':{'id':_0x593874['params']['id']}})[_0x12b5('0x23')](handleEntityNotFound(_0x5ce792,null))[_0x12b5('0x23')](saveUpdates(_0x593874['body'],null))[_0x12b5('0x23')](respondWithResult(_0x5ce792,null))[_0x12b5('0x41')](handleError(_0x5ce792,null));};exports['destroy']=function(_0x337e23,_0x3ca9cc){return db[_0x12b5('0x27')][_0x12b5('0x43')]({'where':{'id':_0x337e23['params']['id']}})['then'](handleEntityNotFound(_0x3ca9cc,null))['then'](removeEntity(_0x3ca9cc,null))['catch'](handleError(_0x3ca9cc,null));};exports[_0x12b5('0x46')]=function(_0x26b4c7,_0x562460){return db[_0x12b5('0x27')][_0x12b5('0x46')]()[_0x12b5('0x23')](respondWithResult(_0x562460,null))[_0x12b5('0x41')](handleError(_0x562460,null));}; \ No newline at end of file +var _0xa1f4=['name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','save','update','destroy','then','sendStatus','error','stack'];(function(_0x4356f6,_0x31a221){var _0x49cf75=function(_0x50aa2f){while(--_0x50aa2f){_0x4356f6['push'](_0x4356f6['shift']());}};_0x49cf75(++_0x31a221);}(_0xa1f4,0x1d3));var _0x4a1f=function(_0x2813da,_0x231821){_0x2813da=_0x2813da-0x0;var _0x2eb353=_0xa1f4[_0x2813da];return _0x2eb353;};'use strict';var pdf=require(_0x4a1f('0x0'));var emlformat=require(_0x4a1f('0x1'));var rimraf=require(_0x4a1f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a1f('0x3'));var rp=require(_0x4a1f('0x4'));var moment=require(_0x4a1f('0x5'));var BPromise=require(_0x4a1f('0x6'));var Mustache=require(_0x4a1f('0x7'));var util=require(_0x4a1f('0x8'));var path=require(_0x4a1f('0x9'));var sox=require('sox');var csv=require(_0x4a1f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a1f('0xb'));var squel=require('squel');var crypto=require(_0x4a1f('0xc'));var jsforce=require(_0x4a1f('0xd'));var deskjs=require(_0x4a1f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4a1f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a1f('0x10'));var qs=require(_0x4a1f('0x11'));var as=require(_0x4a1f('0x12'));var hardwareService=require(_0x4a1f('0x13'));var logger=require(_0x4a1f('0x14'))('api');var utils=require(_0x4a1f('0x15'));var config=require('../../config/environment');var db=require(_0x4a1f('0x16'))['db'];function respondWithStatusCode(_0x46d7c0,_0xf0b6d3){_0xf0b6d3=_0xf0b6d3||0xcc;return function(_0x5b631b){if(_0x5b631b){return _0x46d7c0['sendStatus'](_0xf0b6d3);}return _0x46d7c0[_0x4a1f('0x17')](_0xf0b6d3)[_0x4a1f('0x18')]();};}function respondWithResult(_0x5eeee2,_0x3c21ce){_0x3c21ce=_0x3c21ce||0xc8;return function(_0x4ef5e6){if(_0x4ef5e6){return _0x5eeee2[_0x4a1f('0x17')](_0x3c21ce)[_0x4a1f('0x19')](_0x4ef5e6);}};}function respondWithFilteredResult(_0xc7dcd2,_0x143bdb){return function(_0x139c88){if(_0x139c88){var _0x2315e=_0x139c88[_0x4a1f('0x1a')],_0xb69b92=_0x143bdb[_0x4a1f('0x1b')],_0x247ba3=_0x143bdb['offset']+_0x143bdb[_0x4a1f('0x1c')],_0x23a7ea;if(_0x247ba3>=_0x2315e){_0x247ba3=_0x2315e;_0x23a7ea=0xc8;}else{_0x23a7ea=0xce;}_0xc7dcd2[_0x4a1f('0x17')](_0x23a7ea);return _0xc7dcd2['set'](_0x4a1f('0x1d'),_0xb69b92+'-'+_0x247ba3+'/'+_0x2315e)[_0x4a1f('0x19')](_0x139c88);}return null;};}function patchUpdates(_0x10b316){return function(_0x5b1cdb){try{jsonpatch['apply'](_0x5b1cdb,_0x10b316,!![]);}catch(_0x3c65d1){return BPromise['reject'](_0x3c65d1);}return _0x5b1cdb[_0x4a1f('0x1e')]();};}function saveUpdates(_0xc57d82,_0x116ad0){return function(_0x9c0100){if(_0x9c0100){return _0x9c0100[_0x4a1f('0x1f')](_0xc57d82)['then'](function(_0x213c75){return _0x213c75;});}return null;};}function removeEntity(_0x3ba336,_0x9a0b8a){return function(_0x49af2e){if(_0x49af2e){return _0x49af2e[_0x4a1f('0x20')]()[_0x4a1f('0x21')](function(){_0x3ba336[_0x4a1f('0x17')](0xcc)[_0x4a1f('0x18')]();});}};}function handleEntityNotFound(_0x1fa12e,_0x564d59){return function(_0x4a6280){if(!_0x4a6280){_0x1fa12e[_0x4a1f('0x22')](0x194);}return _0x4a6280;};}function handleError(_0x53c8fc,_0x28f5c4){_0x28f5c4=_0x28f5c4||0x1f4;return function(_0xb2e8ee){logger[_0x4a1f('0x23')](_0xb2e8ee[_0x4a1f('0x24')]);if(_0xb2e8ee[_0x4a1f('0x25')]){delete _0xb2e8ee[_0x4a1f('0x25')];}_0x53c8fc['status'](_0x28f5c4)[_0x4a1f('0x26')](_0xb2e8ee);};}exports[_0x4a1f('0x27')]=function(_0x306659,_0x49ecc1){var _0x3b3cee={},_0x3bf8f4={},_0x466b4d={'count':0x0,'rows':[]};var _0x5c329c=_[_0x4a1f('0x28')](db[_0x4a1f('0x29')][_0x4a1f('0x2a')],function(_0x51e031){return{'name':_0x51e031[_0x4a1f('0x2b')],'type':_0x51e031[_0x4a1f('0x2c')][_0x4a1f('0x2d')]};});_0x3bf8f4[_0x4a1f('0x2e')]=_[_0x4a1f('0x28')](_0x5c329c,_0x4a1f('0x25'));_0x3bf8f4['query']=_['keys'](_0x306659[_0x4a1f('0x2f')]);_0x3bf8f4['filters']=_['intersection'](_0x3bf8f4['model'],_0x3bf8f4[_0x4a1f('0x2f')]);_0x3b3cee[_0x4a1f('0x30')]=_[_0x4a1f('0x31')](_0x3bf8f4[_0x4a1f('0x2e')],qs['fields'](_0x306659[_0x4a1f('0x2f')][_0x4a1f('0x32')]));_0x3b3cee[_0x4a1f('0x30')]=_0x3b3cee[_0x4a1f('0x30')][_0x4a1f('0x33')]?_0x3b3cee[_0x4a1f('0x30')]:_0x3bf8f4[_0x4a1f('0x2e')];if(!_0x306659[_0x4a1f('0x2f')]['hasOwnProperty']('nolimit')){_0x3b3cee['limit']=qs[_0x4a1f('0x1c')](_0x306659['query'][_0x4a1f('0x1c')]);_0x3b3cee[_0x4a1f('0x1b')]=qs[_0x4a1f('0x1b')](_0x306659[_0x4a1f('0x2f')]['offset']);}_0x3b3cee[_0x4a1f('0x34')]=qs[_0x4a1f('0x35')](_0x306659[_0x4a1f('0x2f')]['sort']);_0x3b3cee[_0x4a1f('0x36')]=qs['filters'](_[_0x4a1f('0x37')](_0x306659[_0x4a1f('0x2f')],_0x3bf8f4[_0x4a1f('0x38')]),_0x5c329c);if(_0x306659['query'][_0x4a1f('0x39')]){_0x3b3cee[_0x4a1f('0x36')]=_[_0x4a1f('0x3a')](_0x3b3cee['where'],{'$or':_['map'](_0x5c329c,function(_0x5b510f){if(_0x5b510f['type']!==_0x4a1f('0x3b')){var _0x569b55={};_0x569b55[_0x5b510f[_0x4a1f('0x25')]]={'$like':'%'+_0x306659[_0x4a1f('0x2f')]['filter']+'%'};return _0x569b55;}})});}_0x3b3cee=_[_0x4a1f('0x3a')]({},_0x3b3cee,_0x306659[_0x4a1f('0x3c')]);var _0x358f7c={'where':_0x3b3cee[_0x4a1f('0x36')]};return db[_0x4a1f('0x29')][_0x4a1f('0x1a')](_0x358f7c)[_0x4a1f('0x21')](function(_0x3d1a5c){_0x466b4d['count']=_0x3d1a5c;if(_0x306659[_0x4a1f('0x2f')][_0x4a1f('0x3d')]){_0x3b3cee['include']=[{'all':!![]}];}return db[_0x4a1f('0x29')][_0x4a1f('0x3e')](_0x3b3cee);})[_0x4a1f('0x21')](function(_0x5edfb1){_0x466b4d[_0x4a1f('0x3f')]=_0x5edfb1;return _0x466b4d;})[_0x4a1f('0x21')](respondWithFilteredResult(_0x49ecc1,_0x3b3cee))[_0x4a1f('0x40')](handleError(_0x49ecc1,null));};exports[_0x4a1f('0x41')]=function(_0x3d5ac3,_0x226b12){var _0x2819c2={'raw':![],'where':{'id':_0x3d5ac3[_0x4a1f('0x42')]['id']}},_0x97ec95={};_0x97ec95['model']=_['keys'](db[_0x4a1f('0x29')]['rawAttributes']);_0x97ec95[_0x4a1f('0x2f')]=_[_0x4a1f('0x43')](_0x3d5ac3[_0x4a1f('0x2f')]);_0x97ec95[_0x4a1f('0x38')]=_[_0x4a1f('0x31')](_0x97ec95['model'],_0x97ec95[_0x4a1f('0x2f')]);_0x2819c2['attributes']=_[_0x4a1f('0x31')](_0x97ec95[_0x4a1f('0x2e')],qs[_0x4a1f('0x32')](_0x3d5ac3[_0x4a1f('0x2f')][_0x4a1f('0x32')]));_0x2819c2[_0x4a1f('0x30')]=_0x2819c2[_0x4a1f('0x30')][_0x4a1f('0x33')]?_0x2819c2[_0x4a1f('0x30')]:_0x97ec95['model'];if(_0x3d5ac3[_0x4a1f('0x2f')][_0x4a1f('0x3d')]){_0x2819c2[_0x4a1f('0x44')]=[{'all':!![]}];}_0x2819c2=_[_0x4a1f('0x3a')]({},_0x2819c2,_0x3d5ac3['options']);return db['UserProfileSection'][_0x4a1f('0x45')](_0x2819c2)['then'](handleEntityNotFound(_0x226b12,null))[_0x4a1f('0x21')](respondWithResult(_0x226b12,null))[_0x4a1f('0x40')](handleError(_0x226b12,null));};exports['create']=function(_0x1d15e0,_0x87e8c0){return db[_0x4a1f('0x29')]['create'](_0x1d15e0[_0x4a1f('0x46')],{})['then'](respondWithResult(_0x87e8c0,0xc9))['catch'](handleError(_0x87e8c0,null));};exports[_0x4a1f('0x1f')]=function(_0xf8304f,_0x230209){if(_0xf8304f[_0x4a1f('0x46')]['id']){delete _0xf8304f[_0x4a1f('0x46')]['id'];}return db[_0x4a1f('0x29')]['find']({'where':{'id':_0xf8304f[_0x4a1f('0x42')]['id']}})[_0x4a1f('0x21')](handleEntityNotFound(_0x230209,null))['then'](saveUpdates(_0xf8304f['body'],null))[_0x4a1f('0x21')](respondWithResult(_0x230209,null))[_0x4a1f('0x40')](handleError(_0x230209,null));};exports['destroy']=function(_0x5e4396,_0x202a0d){return db[_0x4a1f('0x29')]['find']({'where':{'id':_0x5e4396[_0x4a1f('0x42')]['id']}})['then'](handleEntityNotFound(_0x202a0d,null))[_0x4a1f('0x21')](removeEntity(_0x202a0d,null))['catch'](handleError(_0x202a0d,null));};exports[_0x4a1f('0x47')]=function(_0x2ed6b3,_0x209e54){return db['UserProfileSection']['describe']()[_0x4a1f('0x21')](respondWithResult(_0x209e54,null))['catch'](handleError(_0x209e54,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 135cee0..94cae49 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 _0x586a=['exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x55626a,_0x10e043){var _0x3c56f9=function(_0x1ce8c7){while(--_0x1ce8c7){_0x55626a['push'](_0x55626a['shift']());}};_0x3c56f9(++_0x10e043);}(_0x586a,0x164));var _0xa586=function(_0x153549,_0x31aff3){_0x153549=_0x153549-0x0;var _0x2838da=_0x586a[_0x153549];return _0x2838da;};'use strict';var _=require(_0xa586('0x0'));var util=require('util');var logger=require(_0xa586('0x1'))('api');var moment=require(_0xa586('0x2'));var BPromise=require('bluebird');var rp=require(_0xa586('0x3'));var fs=require('fs');var path=require(_0xa586('0x4'));var rimraf=require(_0xa586('0x5'));var config=require(_0xa586('0x6'));var attributes=require(_0xa586('0x7'));module[_0xa586('0x8')]=function(_0x30b5f0,_0x4e0deb){return _0x30b5f0[_0xa586('0x9')](_0xa586('0xa'),attributes,{'tableName':_0xa586('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa586('0xc'),_0xa586('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f8a=['exports','UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileSection.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f8a,0x1e5));var _0xa1f8=function(_0x31d9f7,_0x5c6d71){_0x31d9f7=_0x31d9f7-0x0;var _0x17d78c=_0x1f8a[_0x31d9f7];return _0x17d78c;};'use strict';var _=require(_0xa1f8('0x0'));var util=require(_0xa1f8('0x1'));var logger=require(_0xa1f8('0x2'))(_0xa1f8('0x3'));var moment=require(_0xa1f8('0x4'));var BPromise=require(_0xa1f8('0x5'));var rp=require(_0xa1f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa1f8('0x7'));var attributes=require(_0xa1f8('0x8'));module[_0xa1f8('0x9')]=function(_0x15d3c6,_0x5577bf){return _0x15d3c6['define'](_0xa1f8('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xa1f8('0xb'),'fields':['sectionId',_0xa1f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5ad3fd0..1497c6c 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 _0x8de8=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8de8,0x19d));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x88de('0x0'));var util=require('util');var moment=require(_0x88de('0x1'));var BPromise=require(_0x88de('0x2'));var rs=require(_0x88de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88de('0x4'))['db'];var utils=require(_0x88de('0x5'));var logger=require(_0x88de('0x6'))(_0x88de('0x7'));var config=require(_0x88de('0x8'));var jayson=require(_0x88de('0x9'));var client=jayson['client'][_0x88de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcd2390,_0x5837f7,_0x3219a9){return new BPromise(function(_0x2eafef,_0x196cc9){return client['request'](_0xcd2390,_0x3219a9)[_0x88de('0xb')](function(_0x5e4ec0){logger[_0x88de('0xc')](_0x88de('0xd'),_0x5837f7,'request\x20sent');logger[_0x88de('0xe')](_0x88de('0xf'),_0x5837f7,_0x88de('0x10'),JSON[_0x88de('0x11')](_0x5e4ec0));if(_0x5e4ec0[_0x88de('0x12')]){if(_0x5e4ec0[_0x88de('0x12')][_0x88de('0x13')]===0x1f4){logger[_0x88de('0x12')](_0x88de('0xd'),_0x5837f7,_0x5e4ec0[_0x88de('0x12')][_0x88de('0x14')]);return _0x196cc9(_0x5e4ec0[_0x88de('0x12')][_0x88de('0x14')]);}logger[_0x88de('0x12')](_0x88de('0xd'),_0x5837f7,_0x5e4ec0[_0x88de('0x12')][_0x88de('0x14')]);return _0x2eafef(_0x5e4ec0[_0x88de('0x12')]['message']);}else{logger[_0x88de('0xc')](_0x88de('0xd'),_0x5837f7,_0x88de('0x10'));_0x2eafef(_0x5e4ec0[_0x88de('0x15')][_0x88de('0x14')]);}})[_0x88de('0x16')](function(_0x3c0616){logger[_0x88de('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x5837f7,_0x3c0616);_0x196cc9(_0x3c0616);});});} \ No newline at end of file +var _0x61f6=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x365a27,_0x3680e1){var _0xadda73=function(_0x2b14af){while(--_0x2b14af){_0x365a27['push'](_0x365a27['shift']());}};_0xadda73(++_0x3680e1);}(_0x61f6,0x128));var _0x661f=function(_0x3e186f,_0x2eb7be){_0x3e186f=_0x3e186f-0x0;var _0x3595bf=_0x61f6[_0x3e186f];return _0x3595bf;};'use strict';var _=require(_0x661f('0x0'));var util=require(_0x661f('0x1'));var moment=require(_0x661f('0x2'));var BPromise=require(_0x661f('0x3'));var rs=require(_0x661f('0x4'));var fs=require('fs');var Redis=require(_0x661f('0x5'));var db=require(_0x661f('0x6'))['db'];var utils=require(_0x661f('0x7'));var logger=require(_0x661f('0x8'))(_0x661f('0x9'));var config=require('../../config/environment');var jayson=require(_0x661f('0xa'));var client=jayson[_0x661f('0xb')][_0x661f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x81d5c5,_0x1fba97,_0xb54801){return new BPromise(function(_0x210e1d,_0x239efd){return client[_0x661f('0xd')](_0x81d5c5,_0xb54801)['then'](function(_0x547fb7){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1fba97,_0x661f('0xe'));logger['debug'](_0x661f('0xf'),_0x1fba97,_0x661f('0xe'),JSON[_0x661f('0x10')](_0x547fb7));if(_0x547fb7['error']){if(_0x547fb7[_0x661f('0x11')][_0x661f('0x12')]===0x1f4){logger[_0x661f('0x11')](_0x661f('0x13'),_0x1fba97,_0x547fb7[_0x661f('0x11')][_0x661f('0x14')]);return _0x239efd(_0x547fb7[_0x661f('0x11')][_0x661f('0x14')]);}logger[_0x661f('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x1fba97,_0x547fb7[_0x661f('0x11')][_0x661f('0x14')]);return _0x210e1d(_0x547fb7[_0x661f('0x11')][_0x661f('0x14')]);}else{logger[_0x661f('0x15')](_0x661f('0x13'),_0x1fba97,_0x661f('0xe'));_0x210e1d(_0x547fb7[_0x661f('0x16')][_0x661f('0x14')]);}})[_0x661f('0x17')](function(_0x2d2ab9){logger[_0x661f('0x11')](_0x661f('0x13'),_0x1fba97,_0x2d2ab9);_0x239efd(_0x2d2ab9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index dd916fd..2cbb532 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 _0xf935=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0xf935,0xbc));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5f93('0x0'));var util=require(_0x5f93('0x1'));var path=require(_0x5f93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f93('0x3')]();var auth=require(_0x5f93('0x4'));var interaction=require(_0x5f93('0x5'));var config=require(_0x5f93('0x6'));module[_0x5f93('0x7')]=router; \ No newline at end of file +var _0x0cd4=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2a3dd0,_0x5a187d){var _0x1892b0=function(_0xdf56b8){while(--_0xdf56b8){_0x2a3dd0['push'](_0x2a3dd0['shift']());}};_0x1892b0(++_0x5a187d);}(_0x0cd4,0x12f));var _0x40cd=function(_0x22e9b4,_0x4bdb67){_0x22e9b4=_0x22e9b4-0x0;var _0x242c1e=_0x0cd4[_0x22e9b4];return _0x242c1e;};'use strict';var multer=require(_0x40cd('0x0'));var util=require(_0x40cd('0x1'));var path=require('path');var timeout=require(_0x40cd('0x2'));var express=require('express');var router=express[_0x40cd('0x3')]();var auth=require(_0x40cd('0x4'));var interaction=require(_0x40cd('0x5'));var config=require(_0x40cd('0x6'));module[_0x40cd('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index aef6117..6807b2f 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x129a7c,_0x5c7eae){var _0x33d5cc=function(_0x24988b){while(--_0x24988b){_0x129a7c['push'](_0x129a7c['shift']());}};_0x33d5cc(++_0x5c7eae);}(_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(_0x239875,_0x52a793){var _0x55a8d6=function(_0x1c48db){while(--_0x1c48db){_0x239875['push'](_0x239875['shift']());}};_0x55a8d6(++_0x52a793);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8f14cff..e025766 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 _0x2750=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1d5e0d,_0x4394b7){var _0x5cba87=function(_0x4d1548){while(--_0x4d1548){_0x1d5e0d['push'](_0x1d5e0d['shift']());}};_0x5cba87(++_0x4394b7);}(_0x2750,0x13b));var _0x0275=function(_0x479ea4,_0x5e1c64){_0x479ea4=_0x479ea4-0x0;var _0x46a59a=_0x2750[_0x479ea4];return _0x46a59a;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b05=['user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x7b05,0x91));var _0x57b0=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x7b05[_0xd0cd0b];return _0x59cced;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var logger=require(_0x57b0('0x2'))(_0x57b0('0x3'));var moment=require('moment');var BPromise=require(_0x57b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57b0('0x5'));var rimraf=require(_0x57b0('0x6'));var config=require(_0x57b0('0x7'));var attributes=require(_0x57b0('0x8'));module[_0x57b0('0x9')]=function(_0x5ce0f2,_0x94ef9b){return _0x5ce0f2['define'](_0x57b0('0xa'),attributes,{'tableName':_0x57b0('0xb'),'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 39b60a4..2f6e9a2 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 _0x9595=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9595,0x70));var _0x5959=function(_0x72619b,_0x109e23){_0x72619b=_0x72619b-0x0;var _0x11c10b=_0x9595[_0x72619b];return _0x11c10b;};'use strict';var _=require(_0x5959('0x0'));var util=require('util');var moment=require(_0x5959('0x1'));var BPromise=require('bluebird');var rs=require(_0x5959('0x2'));var fs=require('fs');var Redis=require(_0x5959('0x3'));var db=require(_0x5959('0x4'))['db'];var utils=require(_0x5959('0x5'));var logger=require(_0x5959('0x6'))(_0x5959('0x7'));var config=require(_0x5959('0x8'));var jayson=require(_0x5959('0x9'));var client=jayson[_0x5959('0xa')][_0x5959('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321f55,_0x40b671,_0x1e80ae){return new BPromise(function(_0x373e88,_0x5ba54e){return client['request'](_0x321f55,_0x1e80ae)[_0x5959('0xc')](function(_0x1cd564){logger['info'](_0x5959('0xd'),_0x40b671,_0x5959('0xe'));logger[_0x5959('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x40b671,_0x5959('0xe'),JSON[_0x5959('0x10')](_0x1cd564));if(_0x1cd564[_0x5959('0x11')]){if(_0x1cd564[_0x5959('0x11')][_0x5959('0x12')]===0x1f4){logger['error'](_0x5959('0xd'),_0x40b671,_0x1cd564[_0x5959('0x11')][_0x5959('0x13')]);return _0x5ba54e(_0x1cd564[_0x5959('0x11')][_0x5959('0x13')]);}logger[_0x5959('0x11')](_0x5959('0xd'),_0x40b671,_0x1cd564[_0x5959('0x11')][_0x5959('0x13')]);return _0x373e88(_0x1cd564[_0x5959('0x11')][_0x5959('0x13')]);}else{logger[_0x5959('0x14')](_0x5959('0xd'),_0x40b671,_0x5959('0xe'));_0x373e88(_0x1cd564[_0x5959('0x15')]['message']);}})[_0x5959('0x16')](function(_0x5a7f9a){logger[_0x5959('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x40b671,_0x5a7f9a);_0x5ba54e(_0x5a7f9a);});});} \ No newline at end of file +var _0x51d5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x51d5,0x1c7));var _0x551d=function(_0x212125,_0x42d099){_0x212125=_0x212125-0x0;var _0x4c6474=_0x51d5[_0x212125];return _0x4c6474;};'use strict';var _=require(_0x551d('0x0'));var util=require('util');var moment=require(_0x551d('0x1'));var BPromise=require(_0x551d('0x2'));var rs=require(_0x551d('0x3'));var fs=require('fs');var Redis=require(_0x551d('0x4'));var db=require(_0x551d('0x5'))['db'];var utils=require(_0x551d('0x6'));var logger=require(_0x551d('0x7'))(_0x551d('0x8'));var config=require(_0x551d('0x9'));var jayson=require(_0x551d('0xa'));var client=jayson[_0x551d('0xb')][_0x551d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ddec9,_0x30df51,_0x45e6aa){return new BPromise(function(_0x34fe0e,_0x35d488){return client['request'](_0x4ddec9,_0x45e6aa)[_0x551d('0xd')](function(_0x3052a1){logger[_0x551d('0xe')](_0x551d('0xf'),_0x30df51,_0x551d('0x10'));logger[_0x551d('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x30df51,_0x551d('0x10'),JSON['stringify'](_0x3052a1));if(_0x3052a1[_0x551d('0x12')]){if(_0x3052a1[_0x551d('0x12')][_0x551d('0x13')]===0x1f4){logger[_0x551d('0x12')](_0x551d('0xf'),_0x30df51,_0x3052a1[_0x551d('0x12')][_0x551d('0x14')]);return _0x35d488(_0x3052a1['error']['message']);}logger[_0x551d('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x30df51,_0x3052a1[_0x551d('0x12')][_0x551d('0x14')]);return _0x34fe0e(_0x3052a1['error'][_0x551d('0x14')]);}else{logger[_0x551d('0xe')](_0x551d('0xf'),_0x30df51,'request\x20sent');_0x34fe0e(_0x3052a1[_0x551d('0x15')][_0x551d('0x14')]);}})[_0x551d('0x16')](function(_0x5ed9d8){logger[_0x551d('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x30df51,_0x5ed9d8);_0x35d488(_0x5ed9d8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index cda7eef..3c4caf7 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 _0x080c=['Router','../../components/auth/service','multer','path','connect-timeout','express'];(function(_0xa1de8d,_0x1399a8){var _0x478b44=function(_0x3c8db7){while(--_0x3c8db7){_0xa1de8d['push'](_0xa1de8d['shift']());}};_0x478b44(++_0x1399a8);}(_0x080c,0x74));var _0xc080=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x080c[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xc080('0x0'));var util=require('util');var path=require(_0xc080('0x1'));var timeout=require(_0xc080('0x2'));var express=require(_0xc080('0x3'));var router=express[_0xc080('0x4')]();var auth=require(_0xc080('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x58f9=['../../config/environment','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x58f9,0x1c2));var _0x958f=function(_0x54c869,_0x3a8203){_0x54c869=_0x54c869-0x0;var _0x5a224e=_0x58f9[_0x54c869];return _0x5a224e;};'use strict';var multer=require(_0x958f('0x0'));var util=require(_0x958f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x958f('0x2'));var router=express[_0x958f('0x3')]();var auth=require(_0x958f('0x4'));var interaction=require(_0x958f('0x5'));var config=require(_0x958f('0x6'));module[_0x958f('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 37bbb0b..725e61b 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(_0x22df4d,_0xa4790a){var _0x6a2020=function(_0x215c88){while(--_0x215c88){_0x22df4d['push'](_0x22df4d['shift']());}};_0x6a2020(++_0xa4790a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1d41b6,_0x5990fa){var _0x455a94=function(_0x40842c){while(--_0x40842c){_0x1d41b6['push'](_0x1d41b6['shift']());}};_0x455a94(++_0x5990fa);}(_0xe706,0xa3));var _0x6e70=function(_0x437663,_0x4b1832){_0x437663=_0x437663-0x0;var _0x1f3d51=_0xe706[_0x437663];return _0x1f3d51;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1ed238f..bfde5b3 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 _0xb114=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x2083d2,_0x4b7a1e){var _0x27e44a=function(_0x130867){while(--_0x130867){_0x2083d2['push'](_0x2083d2['shift']());}};_0x27e44a(++_0x4b7a1e);}(_0xb114,0x11f));var _0x4b11=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb114[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x4b11('0x0'));var util=require('util');var logger=require(_0x4b11('0x1'))(_0x4b11('0x2'));var moment=require('moment');var BPromise=require(_0x4b11('0x3'));var rp=require(_0x4b11('0x4'));var fs=require('fs');var path=require(_0x4b11('0x5'));var rimraf=require(_0x4b11('0x6'));var config=require(_0x4b11('0x7'));var attributes=require(_0x4b11('0x8'));module['exports']=function(_0x139a82,_0x57aec8){return _0x139a82[_0x4b11('0x9')](_0x4b11('0xa'),attributes,{'tableName':_0x4b11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab8=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x542afc,_0x32bfe2){var _0x25bae9=function(_0x54f4cf){while(--_0x54f4cf){_0x542afc['push'](_0x542afc['shift']());}};_0x25bae9(++_0x32bfe2);}(_0x6ab8,0x165));var _0x86ab=function(_0x996ebf,_0x3c7dd8){_0x996ebf=_0x996ebf-0x0;var _0x4cc487=_0x6ab8[_0x996ebf];return _0x4cc487;};'use strict';var _=require('lodash');var util=require(_0x86ab('0x0'));var logger=require(_0x86ab('0x1'))(_0x86ab('0x2'));var moment=require(_0x86ab('0x3'));var BPromise=require(_0x86ab('0x4'));var rp=require(_0x86ab('0x5'));var fs=require('fs');var path=require(_0x86ab('0x6'));var rimraf=require(_0x86ab('0x7'));var config=require(_0x86ab('0x8'));var attributes=require(_0x86ab('0x9'));module['exports']=function(_0x33a856,_0x1d58a8){return _0x33a856['define'](_0x86ab('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8a7ac79..197f607 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 _0x126c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x21cc4e,_0x24a7ac){var _0x3b7125=function(_0x1f37db){while(--_0x1f37db){_0x21cc4e['push'](_0x21cc4e['shift']());}};_0x3b7125(++_0x24a7ac);}(_0x126c,0x110));var _0xc126=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x126c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc126('0x0'));var util=require(_0xc126('0x1'));var moment=require(_0xc126('0x2'));var BPromise=require(_0xc126('0x3'));var rs=require(_0xc126('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc126('0x5'))['db'];var utils=require(_0xc126('0x6'));var logger=require(_0xc126('0x7'))(_0xc126('0x8'));var config=require(_0xc126('0x9'));var jayson=require(_0xc126('0xa'));var client=jayson['client'][_0xc126('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b2a16,_0x58c73e,_0x5274aa){return new BPromise(function(_0x1d82f6,_0xc64c66){return client[_0xc126('0xc')](_0x2b2a16,_0x5274aa)['then'](function(_0x3a0a83){logger[_0xc126('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x58c73e,_0xc126('0xe'));logger[_0xc126('0xf')](_0xc126('0x10'),_0x58c73e,_0xc126('0xe'),JSON['stringify'](_0x3a0a83));if(_0x3a0a83[_0xc126('0x11')]){if(_0x3a0a83[_0xc126('0x11')][_0xc126('0x12')]===0x1f4){logger[_0xc126('0x11')](_0xc126('0x13'),_0x58c73e,_0x3a0a83[_0xc126('0x11')]['message']);return _0xc64c66(_0x3a0a83['error'][_0xc126('0x14')]);}logger[_0xc126('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x58c73e,_0x3a0a83['error'][_0xc126('0x14')]);return _0x1d82f6(_0x3a0a83[_0xc126('0x11')][_0xc126('0x14')]);}else{logger[_0xc126('0xd')](_0xc126('0x13'),_0x58c73e,_0xc126('0xe'));_0x1d82f6(_0x3a0a83[_0xc126('0x15')][_0xc126('0x14')]);}})[_0xc126('0x16')](function(_0x133a34){logger[_0xc126('0x11')](_0xc126('0x13'),_0x58c73e,_0x133a34);_0xc64c66(_0x133a34);});});} \ No newline at end of file +var _0x2e65=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e65,0x1e3));var _0x52e6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x2e65[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x52e6('0x0'));var moment=require(_0x52e6('0x1'));var BPromise=require(_0x52e6('0x2'));var rs=require(_0x52e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52e6('0x5'))(_0x52e6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x52e6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x388c4e,_0x557b16,_0x500931){return new BPromise(function(_0x2bf919,_0x277ca5){return client[_0x52e6('0x8')](_0x388c4e,_0x500931)['then'](function(_0x20ec2a){logger[_0x52e6('0x9')](_0x52e6('0xa'),_0x557b16,_0x52e6('0xb'));logger['debug'](_0x52e6('0xc'),_0x557b16,_0x52e6('0xb'),JSON['stringify'](_0x20ec2a));if(_0x20ec2a[_0x52e6('0xd')]){if(_0x20ec2a[_0x52e6('0xd')][_0x52e6('0xe')]===0x1f4){logger[_0x52e6('0xd')](_0x52e6('0xa'),_0x557b16,_0x20ec2a[_0x52e6('0xd')]['message']);return _0x277ca5(_0x20ec2a[_0x52e6('0xd')]['message']);}logger[_0x52e6('0xd')](_0x52e6('0xa'),_0x557b16,_0x20ec2a[_0x52e6('0xd')]['message']);return _0x2bf919(_0x20ec2a[_0x52e6('0xd')][_0x52e6('0xf')]);}else{logger['info'](_0x52e6('0xa'),_0x557b16,_0x52e6('0xb'));_0x2bf919(_0x20ec2a['result']['message']);}})[_0x52e6('0x10')](function(_0x482954){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x557b16,_0x482954);_0x277ca5(_0x482954);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a7772e2..b82ebe0 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 _0x033b=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x511005,_0x2d926d){var _0x1a4c71=function(_0x30c51d){while(--_0x30c51d){_0x511005['push'](_0x511005['shift']());}};_0x1a4c71(++_0x2d926d);}(_0x033b,0x111));var _0xb033=function(_0x3a30cf,_0x474df1){_0x3a30cf=_0x3a30cf-0x0;var _0x123483=_0x033b[_0x3a30cf];return _0x123483;};'use strict';var multer=require(_0xb033('0x0'));var util=require(_0xb033('0x1'));var path=require(_0xb033('0x2'));var timeout=require(_0xb033('0x3'));var express=require(_0xb033('0x4'));var router=express[_0xb033('0x5')]();var auth=require(_0xb033('0x6'));var interaction=require(_0xb033('0x7'));var config=require('../../config/environment');module[_0xb033('0x8')]=router; \ No newline at end of file +var _0xc9ab=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x597be4,_0x27e874){var _0x2b2608=function(_0x37ca34){while(--_0x37ca34){_0x597be4['push'](_0x597be4['shift']());}};_0x2b2608(++_0x27e874);}(_0xc9ab,0x125));var _0xbc9a=function(_0x147697,_0x3ac9bc){_0x147697=_0x147697-0x0;var _0x4e00ec=_0xc9ab[_0x147697];return _0x4e00ec;};'use strict';var multer=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var path=require(_0xbc9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbc9a('0x3'));var interaction=require(_0xbc9a('0x4'));var config=require(_0xbc9a('0x5'));module[_0xbc9a('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d8ec5aa..c894627 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 _0x9b21=['queue_interface','STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x9b21,0x1ee));var _0x19b2=function(_0x4d5c67,_0x2c59f9){_0x4d5c67=_0x4d5c67-0x0;var _0x50e2a4=_0x9b21[_0x4d5c67];return _0x50e2a4;};'use strict';var Sequelize=require(_0x19b2('0x0'));module[_0x19b2('0x1')]={'uniqueid':{'type':Sequelize[_0x19b2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x19b2('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x19b2('0x3')},'UserId':{'type':Sequelize[_0x19b2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x19b2('0x4'),'comment':_0x19b2('0x3')},'VoiceQueueId':{'type':Sequelize[_0x19b2('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x19b2('0x5')],'allowNull':![],'unique':_0x19b2('0x4'),'comment':_0x19b2('0x3')},'penalty':{'type':Sequelize[_0x19b2('0x2')](0xb),'defaultValue':0x0,'comment':_0x19b2('0x3')},'paused':{'type':Sequelize[_0x19b2('0x2')](0xb),'defaultValue':0x0,'comment':_0x19b2('0x3')}}; \ No newline at end of file +var _0x0db0=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x0db0,0xd3));var _0x00db=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0x0db0[_0x7729b1];return _0x349504;};'use strict';var Sequelize=require('sequelize');module[_0x00db('0x0')]={'uniqueid':{'type':Sequelize[_0x00db('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x00db('0x2')},'membername':{'type':Sequelize[_0x00db('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x00db('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x00db('0x4'),'comment':_0x00db('0x2')},'VoiceQueueId':{'type':Sequelize[_0x00db('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x00db('0x3')],'allowNull':![],'unique':_0x00db('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x00db('0x1')](0xb),'defaultValue':0x0,'comment':_0x00db('0x2')},'paused':{'type':Sequelize[_0x00db('0x1')](0xb),'defaultValue':0x0,'comment':_0x00db('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 649b99b..b5a61b9 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 _0xca18=['remove','emit','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x13cf5e,_0x216f0b){var _0xb26f15=function(_0x5b5e60){while(--_0x5b5e60){_0x13cf5e['push'](_0x13cf5e['shift']());}};_0xb26f15(++_0x216f0b);}(_0xca18,0x1ce));var _0x8ca1=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0xca18[_0x44474f];return _0x427d97;};'use strict';var EventEmitter=require(_0x8ca1('0x0'));var UserVoiceQueueRt=require(_0x8ca1('0x1'))['db'][_0x8ca1('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8ca1('0x3')](0x0);var events={'afterCreate':_0x8ca1('0x4'),'afterUpdate':_0x8ca1('0x5'),'afterDestroy':_0x8ca1('0x6')};function emitEvent(_0x2648da){return function(_0x59b1e4,_0x4f59c5,_0x372b1e){UserVoiceQueueRtEvents[_0x8ca1('0x7')](_0x2648da+':'+_0x59b1e4['id'],_0x59b1e4);UserVoiceQueueRtEvents[_0x8ca1('0x7')](_0x2648da,_0x59b1e4);_0x372b1e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x8ca1('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2c93=['hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x3d21d7,_0xda9291){var _0x3decff=function(_0x2c5df7){while(--_0x2c5df7){_0x3d21d7['push'](_0x3d21d7['shift']());}};_0x3decff(++_0xda9291);}(_0x2c93,0xaa));var _0x32c9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2c93[_0x1203f];return _0x365f0a;};'use strict';var EventEmitter=require(_0x32c9('0x0'));var UserVoiceQueueRt=require(_0x32c9('0x1'))['db'][_0x32c9('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x32c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32c9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b177f){return function(_0x143a77,_0x408c67,_0x316b65){UserVoiceQueueRtEvents['emit'](_0x1b177f+':'+_0x143a77['id'],_0x143a77);UserVoiceQueueRtEvents['emit'](_0x1b177f,_0x143a77);_0x316b65(null);};}for(var e in events){if(events[_0x32c9('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x32c9('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7ffbd80..b348b3b 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 _0x4bbf=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','request-promise'];(function(_0x30900b,_0x2c1d22){var _0x14cfa1=function(_0x10f668){while(--_0x10f668){_0x30900b['push'](_0x30900b['shift']());}};_0x14cfa1(++_0x2c1d22);}(_0x4bbf,0x125));var _0xf4bb=function(_0x37f4a6,_0xd66231){_0x37f4a6=_0x37f4a6-0x0;var _0x2a2f99=_0x4bbf[_0x37f4a6];return _0x2a2f99;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4bb('0x0'))(_0xf4bb('0x1'));var moment=require(_0xf4bb('0x2'));var BPromise=require('bluebird');var rp=require(_0xf4bb('0x3'));var fs=require('fs');var path=require(_0xf4bb('0x4'));var rimraf=require(_0xf4bb('0x5'));var config=require(_0xf4bb('0x6'));var attributes=require(_0xf4bb('0x7'));module['exports']=function(_0x5bfb36,_0xca22e8){return _0x5bfb36[_0xf4bb('0x8')](_0xf4bb('0x9'),attributes,{'tableName':_0xf4bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aa1=['UserVoiceQueueRt','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0x7aa1,0x169));var _0x17aa=function(_0x1677e9,_0x2e297c){_0x1677e9=_0x1677e9-0x0;var _0x32db12=_0x7aa1[_0x1677e9];return _0x32db12;};'use strict';var _=require(_0x17aa('0x0'));var util=require(_0x17aa('0x1'));var logger=require(_0x17aa('0x2'))(_0x17aa('0x3'));var moment=require('moment');var BPromise=require(_0x17aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17aa('0x5'));var rimraf=require('rimraf');var config=require(_0x17aa('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x17aa('0x7')]=function(_0x32f2ed,_0x2e2cd3){return _0x32f2ed[_0x17aa('0x8')](_0x17aa('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','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 7f6ec56..57cd491 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 _0xe059=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x453ae9,_0x1188a0){var _0x15b5ac=function(_0x47ff7b){while(--_0x47ff7b){_0x453ae9['push'](_0x453ae9['shift']());}};_0x15b5ac(++_0x1188a0);}(_0xe059,0xa5));var _0x9e05=function(_0x457d51,_0x259c93){_0x457d51=_0x457d51-0x0;var _0x266b92=_0xe059[_0x457d51];return _0x266b92;};'use strict';var _=require('lodash');var util=require(_0x9e05('0x0'));var moment=require('moment');var BPromise=require(_0x9e05('0x1'));var rs=require(_0x9e05('0x2'));var fs=require('fs');var Redis=require(_0x9e05('0x3'));var db=require(_0x9e05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e05('0x5'))(_0x9e05('0x6'));var config=require(_0x9e05('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9e05('0x8')]({'port':0x232a});config[_0x9e05('0x9')]=_['defaults'](config[_0x9e05('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e05('0xa'))(new Redis(config[_0x9e05('0x9')]));require(_0x9e05('0xb'))[_0x9e05('0xc')](socket);function respondWithRpcPromise(_0x1a18a3,_0x20561c,_0x2c6104){return new BPromise(function(_0x985ad2,_0x164d79){return client[_0x9e05('0xd')](_0x1a18a3,_0x2c6104)[_0x9e05('0xe')](function(_0x43266f){logger[_0x9e05('0xf')](_0x9e05('0x10'),_0x20561c,_0x9e05('0x11'));logger['debug'](_0x9e05('0x12'),_0x20561c,_0x9e05('0x11'),JSON[_0x9e05('0x13')](_0x43266f));if(_0x43266f[_0x9e05('0x14')]){if(_0x43266f['error'][_0x9e05('0x15')]===0x1f4){logger['error'](_0x9e05('0x10'),_0x20561c,_0x43266f[_0x9e05('0x14')][_0x9e05('0x16')]);return _0x164d79(_0x43266f[_0x9e05('0x14')]['message']);}logger[_0x9e05('0x14')](_0x9e05('0x10'),_0x20561c,_0x43266f[_0x9e05('0x14')][_0x9e05('0x16')]);return _0x985ad2(_0x43266f[_0x9e05('0x14')]['message']);}else{logger['info'](_0x9e05('0x10'),_0x20561c,_0x9e05('0x11'));_0x985ad2(_0x43266f[_0x9e05('0x17')]['message']);}})[_0x9e05('0x18')](function(_0x33f8b0){logger[_0x9e05('0x14')](_0x9e05('0x10'),_0x20561c,_0x33f8b0);_0x164d79(_0x33f8b0);});});}exports['GetVoiceQueueRtPauses']=function(_0x4a0dac){var _0x2e08f4=this;return new Promise(function(_0x11770c,_0xa45a20){return db[_0x9e05('0x19')][_0x9e05('0x1a')]({'raw':_0x4a0dac[_0x9e05('0x1b')]?_0x4a0dac[_0x9e05('0x1b')][_0x9e05('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a0dac[_0x9e05('0x1b')]?_0x4a0dac[_0x9e05('0x1b')][_0x9e05('0x1d')]||null:null,'attributes':[[db[_0x9e05('0x1e')]['fn']('COUNT',db[_0x9e05('0x1e')]['fn']('IF',db[_0x9e05('0x1e')][_0x9e05('0x1f')](_0x9e05('0x20')))),_0x9e05('0x21')]]})[_0x9e05('0xe')](function(_0x59bfb4){logger['info']('GetVoiceQueueRtPauses',_0x4a0dac);logger['debug'](_0x9e05('0x22'),_0x4a0dac,JSON[_0x9e05('0x13')](_0x59bfb4));_0x11770c(_0x59bfb4);})['catch'](function(_0x30b47e){logger['error'](_0x9e05('0x22'),_0x30b47e[_0x9e05('0x16')],_0x4a0dac);_0xa45a20(_0x2e08f4[_0x9e05('0x14')](0x1f4,_0x30b47e[_0x9e05('0x16')]));});});}; \ No newline at end of file +var _0x6cf6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring'];(function(_0x3644d9,_0x2912a4){var _0x1f67fe=function(_0x5a8e96){while(--_0x5a8e96){_0x3644d9['push'](_0x3644d9['shift']());}};_0x1f67fe(++_0x2912a4);}(_0x6cf6,0x15b));var _0x66cf=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6cf6[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x66cf('0x0'));var util=require(_0x66cf('0x1'));var moment=require(_0x66cf('0x2'));var BPromise=require('bluebird');var rs=require(_0x66cf('0x3'));var fs=require('fs');var Redis=require(_0x66cf('0x4'));var db=require(_0x66cf('0x5'))['db'];var utils=require(_0x66cf('0x6'));var logger=require(_0x66cf('0x7'))('rpc');var config=require(_0x66cf('0x8'));var jayson=require(_0x66cf('0x9'));var client=jayson[_0x66cf('0xa')][_0x66cf('0xb')]({'port':0x232a});config['redis']=_[_0x66cf('0xc')](config[_0x66cf('0xd')],{'host':_0x66cf('0xe'),'port':0x18eb});var socket=require(_0x66cf('0xf'))(new Redis(config[_0x66cf('0xd')]));require(_0x66cf('0x10'))['register'](socket);function respondWithRpcPromise(_0x5360d1,_0x11fff1,_0x17879b){return new BPromise(function(_0x5a074c,_0x12d69d){return client[_0x66cf('0x11')](_0x5360d1,_0x17879b)[_0x66cf('0x12')](function(_0x3b0a8d){logger[_0x66cf('0x13')](_0x66cf('0x14'),_0x11fff1,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x11fff1,_0x66cf('0x15'),JSON['stringify'](_0x3b0a8d));if(_0x3b0a8d['error']){if(_0x3b0a8d['error'][_0x66cf('0x16')]===0x1f4){logger['error'](_0x66cf('0x14'),_0x11fff1,_0x3b0a8d[_0x66cf('0x17')][_0x66cf('0x18')]);return _0x12d69d(_0x3b0a8d[_0x66cf('0x17')][_0x66cf('0x18')]);}logger[_0x66cf('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x11fff1,_0x3b0a8d['error'][_0x66cf('0x18')]);return _0x5a074c(_0x3b0a8d[_0x66cf('0x17')][_0x66cf('0x18')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x11fff1,'request\x20sent');_0x5a074c(_0x3b0a8d[_0x66cf('0x19')][_0x66cf('0x18')]);}})[_0x66cf('0x1a')](function(_0x2622f0){logger[_0x66cf('0x17')](_0x66cf('0x14'),_0x11fff1,_0x2622f0);_0x12d69d(_0x2622f0);});});}exports[_0x66cf('0x1b')]=function(_0x12f8ba){var _0x1d39d5=this;return new Promise(function(_0x305d93,_0x319bf5){return db[_0x66cf('0x1c')][_0x66cf('0x1d')]({'raw':_0x12f8ba['options']?_0x12f8ba[_0x66cf('0x1e')][_0x66cf('0x1f')]===undefined?!![]:![]:!![],'where':_0x12f8ba[_0x66cf('0x1e')]?_0x12f8ba['options'][_0x66cf('0x20')]||null:null,'attributes':[[db[_0x66cf('0x21')]['fn'](_0x66cf('0x22'),db[_0x66cf('0x21')]['fn']('IF',db[_0x66cf('0x21')][_0x66cf('0x23')](_0x66cf('0x24')))),_0x66cf('0x25')]]})[_0x66cf('0x12')](function(_0x36d854){logger[_0x66cf('0x13')](_0x66cf('0x1b'),_0x12f8ba);logger[_0x66cf('0x26')](_0x66cf('0x1b'),_0x12f8ba,JSON['stringify'](_0x36d854));_0x305d93(_0x36d854);})[_0x66cf('0x1a')](function(_0x37ff6b){logger[_0x66cf('0x17')](_0x66cf('0x1b'),_0x37ff6b[_0x66cf('0x18')],_0x12f8ba);_0x319bf5(_0x1d39d5['error'](0x1f4,_0x37ff6b[_0x66cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 45d6613..4c6380a 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 _0xc1f6=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc1f6,0x6d));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0x6c1f('0x0'));var events=['save',_0x6c1f('0x1'),_0x6c1f('0x2')];function createListener(_0x1e6e77,_0x2fac23){return function(_0x4e80ef){_0x2fac23[_0x6c1f('0x3')](_0x1e6e77,_0x4e80ef);};}function removeListener(_0x281511,_0x1c007a){return function(){UserVoiceQueueRtEvents[_0x6c1f('0x4')](_0x281511,_0x1c007a);};}exports['register']=function(_0x245a79){for(var _0x16e6fa=0x0,_0x43b626=events[_0x6c1f('0x5')];_0x16e6fa<_0x43b626;_0x16e6fa++){var _0x2b77b8=events[_0x16e6fa];var _0xa56850=createListener(_0x6c1f('0x6')+_0x2b77b8,_0x245a79);UserVoiceQueueRtEvents['on'](_0x2b77b8,_0xa56850);}}; \ No newline at end of file +var _0xab43=['remove','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x52af5a,_0xd2cab3){var _0x41cdbb=function(_0x1b9b87){while(--_0x1b9b87){_0x52af5a['push'](_0x52af5a['shift']());}};_0x41cdbb(++_0xd2cab3);}(_0xab43,0x118));var _0x3ab4=function(_0x5d9f02,_0x44e61a){_0x5d9f02=_0x5d9f02-0x0;var _0x2d39c0=_0xab43[_0x5d9f02];return _0x2d39c0;};'use strict';var UserVoiceQueueRtEvents=require(_0x3ab4('0x0'));var events=[_0x3ab4('0x1'),_0x3ab4('0x2'),'update'];function createListener(_0x40c3f7,_0x65ba6d){return function(_0x4cc787){_0x65ba6d['emit'](_0x40c3f7,_0x4cc787);};}function removeListener(_0x303bfc,_0x3e9d26){return function(){UserVoiceQueueRtEvents[_0x3ab4('0x3')](_0x303bfc,_0x3e9d26);};}exports['register']=function(_0x3a587a){for(var _0x15ec6a=0x0,_0x34a264=events[_0x3ab4('0x4')];_0x15ec6a<_0x34a264;_0x15ec6a++){var _0x3a17c6=events[_0x15ec6a];var _0x52ca21=createListener(_0x3ab4('0x5')+_0x3a17c6,_0x3a587a);UserVoiceQueueRtEvents['on'](_0x3a17c6,_0x52ca21);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index caff67d..e9605e7 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 _0xbc0b=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path'];(function(_0x5d1e0c,_0x19f687){var _0x31029e=function(_0x11a920){while(--_0x11a920){_0x5d1e0c['push'](_0x5d1e0c['shift']());}};_0x31029e(++_0x19f687);}(_0xbc0b,0x1b1));var _0xbbc0=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xbc0b[_0x1b4b23];return _0x2a325b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbbc0('0x0'));var timeout=require(_0xbbc0('0x1'));var express=require('express');var router=express[_0xbbc0('0x2')]();var auth=require(_0xbbc0('0x3'));var interaction=require(_0xbbc0('0x4'));var config=require(_0xbbc0('0x5'));module[_0xbbc0('0x6')]=router; \ No newline at end of file +var _0xf629=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf629,0x12a));var _0x9f62=function(_0xda1de5,_0x231f2c){_0xda1de5=_0xda1de5-0x0;var _0x52079b=_0xf629[_0xda1de5];return _0x52079b;};'use strict';var multer=require(_0x9f62('0x0'));var util=require(_0x9f62('0x1'));var path=require(_0x9f62('0x2'));var timeout=require(_0x9f62('0x3'));var express=require(_0x9f62('0x4'));var router=express[_0x9f62('0x5')]();var auth=require(_0x9f62('0x6'));var interaction=require(_0x9f62('0x7'));var config=require(_0x9f62('0x8'));module[_0x9f62('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8d920e3..26b1620 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 _0xbaf0=['exports','INTEGER'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_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 +var _0xbaf0=['exports','INTEGER'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 70d985d..f74f389 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 _0x77cf=['moment','rimraf','../../config/environment','exports','UserWhatsappQueue','lodash','util','api'];(function(_0x319fa0,_0x31377a){var _0x464fee=function(_0x503a37){while(--_0x503a37){_0x319fa0['push'](_0x319fa0['shift']());}};_0x464fee(++_0x31377a);}(_0x77cf,0x1cd));var _0xf77c=function(_0x1ef9ae,_0x37e9cf){_0x1ef9ae=_0x1ef9ae-0x0;var _0x1de630=_0x77cf[_0x1ef9ae];return _0x1de630;};'use strict';var _=require(_0xf77c('0x0'));var util=require(_0xf77c('0x1'));var logger=require('../../config/logger')(_0xf77c('0x2'));var moment=require(_0xf77c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf77c('0x4'));var config=require(_0xf77c('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xf77c('0x6')]=function(_0x26b626,_0x2e3347){return _0x26b626['define'](_0xf77c('0x7'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef97=['exports','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0xee871d,_0x5888f6){var _0x4e7054=function(_0x21eeba){while(--_0x21eeba){_0xee871d['push'](_0xee871d['shift']());}};_0x4e7054(++_0x5888f6);}(_0xef97,0xc6));var _0x7ef9=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0xef97[_0x1ebc6c];return _0x3a826d;};'use strict';var _=require('lodash');var util=require(_0x7ef9('0x0'));var logger=require(_0x7ef9('0x1'))(_0x7ef9('0x2'));var moment=require(_0x7ef9('0x3'));var BPromise=require(_0x7ef9('0x4'));var rp=require(_0x7ef9('0x5'));var fs=require('fs');var path=require(_0x7ef9('0x6'));var rimraf=require(_0x7ef9('0x7'));var config=require(_0x7ef9('0x8'));var attributes=require(_0x7ef9('0x9'));module[_0x7ef9('0xa')]=function(_0x1400b,_0xfdbac){return _0x1400b['define'](_0x7ef9('0xb'),attributes,{'tableName':_0x7ef9('0xc'),'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 0a422c2..0cb7bc7 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(_0x1daae8,_0x3bb542){var _0x2fb2db=function(_0x14ecf8){while(--_0x14ecf8){_0x1daae8['push'](_0x1daae8['shift']());}};_0x2fb2db(++_0x3bb542);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x328982,_0x2c0fe1){var _0x4a5be8=function(_0x47087c){while(--_0x47087c){_0x328982['push'](_0x328982['shift']());}};_0x4a5be8(++_0x2c0fe1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 b24e326..cad5081 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 _0x6e1c=['create','put','/:id','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get','show','post'];(function(_0x47dc1c,_0x3b156a){var _0x4aafab=function(_0x44d904){while(--_0x44d904){_0x47dc1c['push'](_0x47dc1c['shift']());}};_0x4aafab(++_0x3b156a);}(_0x6e1c,0x145));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6e1('0x1'));var express=require('express');var router=express[_0xc6e1('0x2')]();var auth=require(_0xc6e1('0x3'));var interaction=require(_0xc6e1('0x4'));var config=require(_0xc6e1('0x5'));var controller=require(_0xc6e1('0x6'));router['get']('/',auth[_0xc6e1('0x7')](),controller['index']);router[_0xc6e1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc6e1('0x9')]);router[_0xc6e1('0xa')]('/',auth[_0xc6e1('0x7')](),controller[_0xc6e1('0xb')]);router[_0xc6e1('0xc')](_0xc6e1('0xd'),auth[_0xc6e1('0x7')](),controller['update']);router[_0xc6e1('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc6e1('0xf')]=router; \ No newline at end of file +var _0x2ece=['path','../../components/auth/service','../../components/interaction/service','./variable.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','util'];(function(_0x324e58,_0x5667bf){var _0x41bda1=function(_0x370b04){while(--_0x370b04){_0x324e58['push'](_0x324e58['shift']());}};_0x41bda1(++_0x5667bf);}(_0x2ece,0x99));var _0xe2ec=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x2ece[_0x3181cc];return _0x547a4a;};'use strict';var multer=require('multer');var util=require(_0xe2ec('0x0'));var path=require(_0xe2ec('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xe2ec('0x2'));var interaction=require(_0xe2ec('0x3'));var config=require('../../config/environment');var controller=require(_0xe2ec('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe2ec('0x5')](_0xe2ec('0x6'),auth[_0xe2ec('0x7')](),controller[_0xe2ec('0x8')]);router[_0xe2ec('0x9')]('/',auth[_0xe2ec('0x7')](),controller[_0xe2ec('0xa')]);router[_0xe2ec('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe2ec('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe2ec('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e05dcda..fea56d6 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 _0x1172=['name','sequelize','exports','STRING'];(function(_0xcb12e6,_0xd8a931){var _0x4f8c62=function(_0x50c21d){while(--_0x50c21d){_0xcb12e6['push'](_0xcb12e6['shift']());}};_0x4f8c62(++_0xd8a931);}(_0x1172,0xf1));var _0x2117=function(_0x11f395,_0x4017d3){_0x11f395=_0x11f395-0x0;var _0x29334b=_0x1172[_0x11f395];return _0x29334b;};'use strict';var Sequelize=require(_0x2117('0x0'));module[_0x2117('0x1')]={'name':{'type':Sequelize[_0x2117('0x2')],'unique':_0x2117('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e27=['sequelize','STRING','name'];(function(_0x389aca,_0x1177ab){var _0x17ef4c=function(_0x3cd92f){while(--_0x3cd92f){_0x389aca['push'](_0x389aca['shift']());}};_0x17ef4c(++_0x1177ab);}(_0x2e27,0x198));var _0x72e2=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x2e27[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x72e2('0x0'));module['exports']={'name':{'type':Sequelize[_0x72e2('0x1')],'unique':_0x72e2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x72e2('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8ad4ea2..7a7f2b5 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 _0x420d=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','Variables','UserProfileResource','end','error','stack','index','map','Variable','fieldName','key','model','name','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x19ccda,_0x2a4a14){var _0x51047f=function(_0xd2fc81){while(--_0xd2fc81){_0x19ccda['push'](_0x19ccda['shift']());}};_0x51047f(++_0x2a4a14);}(_0x420d,0x19e));var _0xd420=function(_0x2c2e2f,_0x1387a8){_0x2c2e2f=_0x2c2e2f-0x0;var _0x1928fe=_0x420d[_0x2c2e2f];return _0x1928fe;};'use strict';var pdf=require(_0xd420('0x0'));var emlformat=require(_0xd420('0x1'));var rimraf=require(_0xd420('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd420('0x3'));var rp=require(_0xd420('0x4'));var moment=require(_0xd420('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd420('0x6'));var path=require(_0xd420('0x7'));var sox=require(_0xd420('0x8'));var csv=require(_0xd420('0x9'));var ejs=require(_0xd420('0xa'));var fs=require('fs');var _=require(_0xd420('0xb'));var squel=require(_0xd420('0xc'));var crypto=require(_0xd420('0xd'));var jsforce=require(_0xd420('0xe'));var deskjs=require(_0xd420('0xf'));var toCsv=require(_0xd420('0x9'));var querystring=require(_0xd420('0x10'));var Papa=require(_0xd420('0x11'));var Redis=require('ioredis');var authService=require(_0xd420('0x12'));var qs=require(_0xd420('0x13'));var as=require(_0xd420('0x14'));var hardwareService=require(_0xd420('0x15'));var logger=require(_0xd420('0x16'))(_0xd420('0x17'));var utils=require(_0xd420('0x18'));var config=require(_0xd420('0x19'));var db=require(_0xd420('0x1a'))['db'];function respondWithStatusCode(_0xb4d68,_0x4fb961){_0x4fb961=_0x4fb961||0xcc;return function(_0x31b94a){if(_0x31b94a){return _0xb4d68[_0xd420('0x1b')](_0x4fb961);}return _0xb4d68[_0xd420('0x1c')](_0x4fb961)['end']();};}function respondWithResult(_0x7aa386,_0x35fb0e){_0x35fb0e=_0x35fb0e||0xc8;return function(_0x6d69ef){if(_0x6d69ef){return _0x7aa386[_0xd420('0x1c')](_0x35fb0e)[_0xd420('0x1d')](_0x6d69ef);}};}function respondWithFilteredResult(_0x32e606,_0x4e4c7b){return function(_0x5da181){if(_0x5da181){var _0x1ab7ec=_0x5da181[_0xd420('0x1e')],_0x1d1205=_0x4e4c7b[_0xd420('0x1f')],_0x70e04a=_0x4e4c7b[_0xd420('0x1f')]+_0x4e4c7b[_0xd420('0x20')],_0x27358b;if(_0x70e04a>=_0x1ab7ec){_0x70e04a=_0x1ab7ec;_0x27358b=0xc8;}else{_0x27358b=0xce;}_0x32e606[_0xd420('0x1c')](_0x27358b);return _0x32e606[_0xd420('0x21')](_0xd420('0x22'),_0x1d1205+'-'+_0x70e04a+'/'+_0x1ab7ec)[_0xd420('0x1d')](_0x5da181);}return null;};}function patchUpdates(_0x43a70d){return function(_0x5a0002){try{jsonpatch[_0xd420('0x23')](_0x5a0002,_0x43a70d,!![]);}catch(_0x5f2418){return BPromise[_0xd420('0x24')](_0x5f2418);}return _0x5a0002['save']();};}function saveUpdates(_0x4885b0,_0x293ec6){return function(_0x37a855){if(_0x37a855){return _0x37a855[_0xd420('0x25')](_0x4885b0)[_0xd420('0x26')](function(_0x11a0c5){return _0x11a0c5;});}return null;};}function removeEntity(_0x1b3849,_0xdb02e9){return function(_0x1950a1){if(_0x1950a1){return _0x1950a1['destroy']()[_0xd420('0x26')](function(){var _0x94cf2a=_0x1950a1['get']({'plain':!![]});var _0x3a24bd=_0xd420('0x27');return db[_0xd420('0x28')]['destroy']({'where':{'type':_0x3a24bd,'resourceId':_0x94cf2a['id']}})[_0xd420('0x26')](function(){return _0x1950a1;});})[_0xd420('0x26')](function(){_0x1b3849['status'](0xcc)[_0xd420('0x29')]();});}};}function handleEntityNotFound(_0x56de68,_0x586c7e){return function(_0x3aa514){if(!_0x3aa514){_0x56de68[_0xd420('0x1b')](0x194);}return _0x3aa514;};}function handleError(_0x4321f7,_0x31f40f){_0x31f40f=_0x31f40f||0x1f4;return function(_0x63176){logger[_0xd420('0x2a')](_0x63176[_0xd420('0x2b')]);if(_0x63176['name']){delete _0x63176['name'];}_0x4321f7[_0xd420('0x1c')](_0x31f40f)['send'](_0x63176);};}exports[_0xd420('0x2c')]=function(_0x560a98,_0x528e0c){var _0x5a5b5b={},_0x423c0d={},_0x2ee529={'count':0x0,'rows':[]};var _0x245748=_[_0xd420('0x2d')](db[_0xd420('0x2e')]['rawAttributes'],function(_0x2fa5b8){return{'name':_0x2fa5b8[_0xd420('0x2f')],'type':_0x2fa5b8['type'][_0xd420('0x30')]};});_0x423c0d[_0xd420('0x31')]=_[_0xd420('0x2d')](_0x245748,_0xd420('0x32'));_0x423c0d[_0xd420('0x33')]=_[_0xd420('0x34')](_0x560a98[_0xd420('0x33')]);_0x423c0d[_0xd420('0x35')]=_['intersection'](_0x423c0d[_0xd420('0x31')],_0x423c0d['query']);_0x5a5b5b['attributes']=_['intersection'](_0x423c0d[_0xd420('0x31')],qs[_0xd420('0x36')](_0x560a98[_0xd420('0x33')][_0xd420('0x36')]));_0x5a5b5b[_0xd420('0x37')]=_0x5a5b5b[_0xd420('0x37')]['length']?_0x5a5b5b['attributes']:_0x423c0d[_0xd420('0x31')];if(!_0x560a98[_0xd420('0x33')][_0xd420('0x38')](_0xd420('0x39'))){_0x5a5b5b[_0xd420('0x20')]=qs[_0xd420('0x20')](_0x560a98[_0xd420('0x33')][_0xd420('0x20')]);_0x5a5b5b['offset']=qs[_0xd420('0x1f')](_0x560a98['query'][_0xd420('0x1f')]);}_0x5a5b5b['order']=qs[_0xd420('0x3a')](_0x560a98[_0xd420('0x33')][_0xd420('0x3a')]);_0x5a5b5b[_0xd420('0x3b')]=qs[_0xd420('0x35')](_['pick'](_0x560a98[_0xd420('0x33')],_0x423c0d[_0xd420('0x35')]),_0x245748);if(_0x560a98[_0xd420('0x33')][_0xd420('0x3c')]){_0x5a5b5b[_0xd420('0x3b')]=_['merge'](_0x5a5b5b[_0xd420('0x3b')],{'$or':_[_0xd420('0x2d')](_0x245748,function(_0x5b8426){if(_0x5b8426['type']!=='VIRTUAL'){var _0x1c2336={};_0x1c2336[_0x5b8426['name']]={'$like':'%'+_0x560a98['query'][_0xd420('0x3c')]+'%'};return _0x1c2336;}})});}_0x5a5b5b=_[_0xd420('0x3d')]({},_0x5a5b5b,_0x560a98[_0xd420('0x3e')]);var _0x426edb={'where':_0x5a5b5b[_0xd420('0x3b')]};return db[_0xd420('0x2e')][_0xd420('0x1e')](_0x426edb)[_0xd420('0x26')](function(_0x4d6ff8){_0x2ee529[_0xd420('0x1e')]=_0x4d6ff8;if(_0x560a98[_0xd420('0x33')][_0xd420('0x3f')]){_0x5a5b5b['include']=[{'all':!![]}];}return db[_0xd420('0x2e')][_0xd420('0x40')](_0x5a5b5b);})[_0xd420('0x26')](function(_0x57997e){_0x2ee529[_0xd420('0x41')]=_0x57997e;return _0x2ee529;})[_0xd420('0x26')](respondWithFilteredResult(_0x528e0c,_0x5a5b5b))['catch'](handleError(_0x528e0c,null));};exports[_0xd420('0x42')]=function(_0x287b77,_0xba0ee){var _0x5567af={'raw':!![],'where':{'id':_0x287b77[_0xd420('0x43')]['id']}},_0x4a7645={};_0x4a7645[_0xd420('0x31')]=_[_0xd420('0x34')](db[_0xd420('0x2e')][_0xd420('0x44')]);_0x4a7645[_0xd420('0x33')]=_[_0xd420('0x34')](_0x287b77[_0xd420('0x33')]);_0x4a7645[_0xd420('0x35')]=_[_0xd420('0x45')](_0x4a7645[_0xd420('0x31')],_0x4a7645[_0xd420('0x33')]);_0x5567af[_0xd420('0x37')]=_['intersection'](_0x4a7645[_0xd420('0x31')],qs[_0xd420('0x36')](_0x287b77[_0xd420('0x33')][_0xd420('0x36')]));_0x5567af[_0xd420('0x37')]=_0x5567af[_0xd420('0x37')]['length']?_0x5567af['attributes']:_0x4a7645[_0xd420('0x31')];if(_0x287b77[_0xd420('0x33')][_0xd420('0x3f')]){_0x5567af['include']=[{'all':!![]}];}_0x5567af=_['merge']({},_0x5567af,_0x287b77[_0xd420('0x3e')]);return db[_0xd420('0x2e')][_0xd420('0x46')](_0x5567af)[_0xd420('0x26')](handleEntityNotFound(_0xba0ee,null))[_0xd420('0x26')](respondWithResult(_0xba0ee,null))[_0xd420('0x47')](handleError(_0xba0ee,null));};exports[_0xd420('0x48')]=function(_0x2266c3,_0xd8c35b){return db[_0xd420('0x2e')][_0xd420('0x48')](_0x2266c3[_0xd420('0x49')],{})['then'](function(_0x348979){var _0x3dcb93=_0x2266c3[_0xd420('0x4a')][_0xd420('0x4b')]({'plain':!![]});if(!_0x3dcb93)throw new Error(_0xd420('0x4c'));if(_0x3dcb93[_0xd420('0x4d')]==='user'){var _0x1bdae7=_0x348979[_0xd420('0x4b')]({'plain':!![]});var _0x4b1c4e='Variables';return db[_0xd420('0x4e')][_0xd420('0x46')]({'where':{'name':_0x4b1c4e,'userProfileId':_0x3dcb93[_0xd420('0x4f')]},'raw':!![]})[_0xd420('0x26')](function(_0x312677){if(_0x312677&&_0x312677[_0xd420('0x50')]===0x0){return db[_0xd420('0x28')]['create']({'name':_0x1bdae7[_0xd420('0x32')],'resourceId':_0x1bdae7['id'],'type':_0x312677[_0xd420('0x32')],'sectionId':_0x312677['id']},{})[_0xd420('0x26')](function(){return _0x348979;});}else{return _0x348979;}})['catch'](function(_0x3c5288){logger[_0xd420('0x2a')](_0xd420('0x51'),_0x3c5288);throw _0x3c5288;});}return _0x348979;})[_0xd420('0x26')](respondWithResult(_0xd8c35b,0xc9))['catch'](handleError(_0xd8c35b,null));};exports[_0xd420('0x25')]=function(_0x471b68,_0x35aba3){if(_0x471b68[_0xd420('0x49')]['id']){delete _0x471b68[_0xd420('0x49')]['id'];}return db[_0xd420('0x2e')][_0xd420('0x46')]({'where':{'id':_0x471b68['params']['id']}})['then'](handleEntityNotFound(_0x35aba3,null))[_0xd420('0x26')](saveUpdates(_0x471b68['body'],null))[_0xd420('0x26')](respondWithResult(_0x35aba3,null))[_0xd420('0x47')](handleError(_0x35aba3,null));};exports['destroy']=function(_0x1409d8,_0x3780b9){return db[_0xd420('0x2e')][_0xd420('0x46')]({'where':{'id':_0x1409d8[_0xd420('0x43')]['id']}})[_0xd420('0x26')](handleEntityNotFound(_0x3780b9,null))[_0xd420('0x26')](removeEntity(_0x3780b9,null))[_0xd420('0x47')](handleError(_0x3780b9,null));}; \ No newline at end of file +var _0xa940=['name','send','index','map','Variable','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','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','json','offset','limit','set','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','end'];(function(_0x275b75,_0x492241){var _0x412a3b=function(_0x1783e4){while(--_0x1783e4){_0x275b75['push'](_0x275b75['shift']());}};_0x412a3b(++_0x492241);}(_0xa940,0x113));var _0x0a94=function(_0x22e8c9,_0x1670ae){_0x22e8c9=_0x22e8c9-0x0;var _0x3508a9=_0xa940[_0x22e8c9];return _0x3508a9;};'use strict';var pdf=require(_0x0a94('0x0'));var emlformat=require(_0x0a94('0x1'));var rimraf=require(_0x0a94('0x2'));var zipdir=require(_0x0a94('0x3'));var jsonpatch=require(_0x0a94('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a94('0x5'));var Mustache=require(_0x0a94('0x6'));var util=require(_0x0a94('0x7'));var path=require(_0x0a94('0x8'));var sox=require(_0x0a94('0x9'));var csv=require(_0x0a94('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a94('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a94('0xc'));var deskjs=require(_0x0a94('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0a94('0xe'));var Papa=require(_0x0a94('0xf'));var Redis=require(_0x0a94('0x10'));var authService=require(_0x0a94('0x11'));var qs=require(_0x0a94('0x12'));var as=require(_0x0a94('0x13'));var hardwareService=require(_0x0a94('0x14'));var logger=require(_0x0a94('0x15'))(_0x0a94('0x16'));var utils=require(_0x0a94('0x17'));var config=require('../../config/environment');var db=require(_0x0a94('0x18'))['db'];function respondWithStatusCode(_0x4c57d5,_0x128aac){_0x128aac=_0x128aac||0xcc;return function(_0x3f7fc3){if(_0x3f7fc3){return _0x4c57d5[_0x0a94('0x19')](_0x128aac);}return _0x4c57d5[_0x0a94('0x1a')](_0x128aac)['end']();};}function respondWithResult(_0xdbb5a9,_0x2f3071){_0x2f3071=_0x2f3071||0xc8;return function(_0x1e1b1f){if(_0x1e1b1f){return _0xdbb5a9[_0x0a94('0x1a')](_0x2f3071)[_0x0a94('0x1b')](_0x1e1b1f);}};}function respondWithFilteredResult(_0x369471,_0x338bc4){return function(_0x322c32){if(_0x322c32){var _0x5b6240=_0x322c32['count'],_0x250472=_0x338bc4[_0x0a94('0x1c')],_0x19ffe0=_0x338bc4[_0x0a94('0x1c')]+_0x338bc4[_0x0a94('0x1d')],_0x388a90;if(_0x19ffe0>=_0x5b6240){_0x19ffe0=_0x5b6240;_0x388a90=0xc8;}else{_0x388a90=0xce;}_0x369471[_0x0a94('0x1a')](_0x388a90);return _0x369471[_0x0a94('0x1e')]('Content-Range',_0x250472+'-'+_0x19ffe0+'/'+_0x5b6240)['json'](_0x322c32);}return null;};}function patchUpdates(_0x3b0f78){return function(_0x4856cf){try{jsonpatch[_0x0a94('0x1f')](_0x4856cf,_0x3b0f78,!![]);}catch(_0x16412b){return BPromise[_0x0a94('0x20')](_0x16412b);}return _0x4856cf[_0x0a94('0x21')]();};}function saveUpdates(_0x413683,_0x5d2771){return function(_0x33f0a2){if(_0x33f0a2){return _0x33f0a2[_0x0a94('0x22')](_0x413683)[_0x0a94('0x23')](function(_0x218d92){return _0x218d92;});}return null;};}function removeEntity(_0x5370bb,_0x572ec2){return function(_0x4b1227){if(_0x4b1227){return _0x4b1227['destroy']()[_0x0a94('0x23')](function(){var _0x310d3c=_0x4b1227[_0x0a94('0x24')]({'plain':!![]});var _0x47d787=_0x0a94('0x25');return db[_0x0a94('0x26')][_0x0a94('0x27')]({'where':{'type':_0x47d787,'resourceId':_0x310d3c['id']}})[_0x0a94('0x23')](function(){return _0x4b1227;});})[_0x0a94('0x23')](function(){_0x5370bb[_0x0a94('0x1a')](0xcc)[_0x0a94('0x28')]();});}};}function handleEntityNotFound(_0x115ed1,_0x40f85d){return function(_0x90335c){if(!_0x90335c){_0x115ed1['sendStatus'](0x194);}return _0x90335c;};}function handleError(_0x4dc1b3,_0x3f9bb0){_0x3f9bb0=_0x3f9bb0||0x1f4;return function(_0x27c351){logger['error'](_0x27c351['stack']);if(_0x27c351[_0x0a94('0x29')]){delete _0x27c351[_0x0a94('0x29')];}_0x4dc1b3[_0x0a94('0x1a')](_0x3f9bb0)[_0x0a94('0x2a')](_0x27c351);};}exports[_0x0a94('0x2b')]=function(_0x2e7bca,_0x441578){var _0x197911={},_0x5a62ee={},_0x39686a={'count':0x0,'rows':[]};var _0x1f1b1f=_[_0x0a94('0x2c')](db[_0x0a94('0x2d')][_0x0a94('0x2e')],function(_0x4fee65){return{'name':_0x4fee65['fieldName'],'type':_0x4fee65[_0x0a94('0x2f')]['key']};});_0x5a62ee['model']=_[_0x0a94('0x2c')](_0x1f1b1f,_0x0a94('0x29'));_0x5a62ee[_0x0a94('0x30')]=_['keys'](_0x2e7bca[_0x0a94('0x30')]);_0x5a62ee['filters']=_[_0x0a94('0x31')](_0x5a62ee['model'],_0x5a62ee[_0x0a94('0x30')]);_0x197911[_0x0a94('0x32')]=_[_0x0a94('0x31')](_0x5a62ee[_0x0a94('0x33')],qs[_0x0a94('0x34')](_0x2e7bca[_0x0a94('0x30')]['fields']));_0x197911[_0x0a94('0x32')]=_0x197911[_0x0a94('0x32')][_0x0a94('0x35')]?_0x197911[_0x0a94('0x32')]:_0x5a62ee['model'];if(!_0x2e7bca['query'][_0x0a94('0x36')](_0x0a94('0x37'))){_0x197911[_0x0a94('0x1d')]=qs[_0x0a94('0x1d')](_0x2e7bca[_0x0a94('0x30')]['limit']);_0x197911[_0x0a94('0x1c')]=qs['offset'](_0x2e7bca[_0x0a94('0x30')][_0x0a94('0x1c')]);}_0x197911[_0x0a94('0x38')]=qs[_0x0a94('0x39')](_0x2e7bca[_0x0a94('0x30')][_0x0a94('0x39')]);_0x197911[_0x0a94('0x3a')]=qs[_0x0a94('0x3b')](_['pick'](_0x2e7bca[_0x0a94('0x30')],_0x5a62ee[_0x0a94('0x3b')]),_0x1f1b1f);if(_0x2e7bca['query'][_0x0a94('0x3c')]){_0x197911[_0x0a94('0x3a')]=_[_0x0a94('0x3d')](_0x197911[_0x0a94('0x3a')],{'$or':_[_0x0a94('0x2c')](_0x1f1b1f,function(_0xbf4409){if(_0xbf4409[_0x0a94('0x2f')]!==_0x0a94('0x3e')){var _0x41b7da={};_0x41b7da[_0xbf4409['name']]={'$like':'%'+_0x2e7bca[_0x0a94('0x30')][_0x0a94('0x3c')]+'%'};return _0x41b7da;}})});}_0x197911=_[_0x0a94('0x3d')]({},_0x197911,_0x2e7bca[_0x0a94('0x3f')]);var _0x164855={'where':_0x197911[_0x0a94('0x3a')]};return db[_0x0a94('0x2d')]['count'](_0x164855)[_0x0a94('0x23')](function(_0x6f4843){_0x39686a[_0x0a94('0x40')]=_0x6f4843;if(_0x2e7bca[_0x0a94('0x30')][_0x0a94('0x41')]){_0x197911[_0x0a94('0x42')]=[{'all':!![]}];}return db[_0x0a94('0x2d')][_0x0a94('0x43')](_0x197911);})['then'](function(_0x43640e){_0x39686a['rows']=_0x43640e;return _0x39686a;})['then'](respondWithFilteredResult(_0x441578,_0x197911))[_0x0a94('0x44')](handleError(_0x441578,null));};exports['show']=function(_0xfe016c,_0x4d9d31){var _0x28322d={'raw':!![],'where':{'id':_0xfe016c[_0x0a94('0x45')]['id']}},_0x13f7b8={};_0x13f7b8['model']=_[_0x0a94('0x46')](db['Variable'][_0x0a94('0x2e')]);_0x13f7b8[_0x0a94('0x30')]=_['keys'](_0xfe016c['query']);_0x13f7b8[_0x0a94('0x3b')]=_[_0x0a94('0x31')](_0x13f7b8[_0x0a94('0x33')],_0x13f7b8[_0x0a94('0x30')]);_0x28322d[_0x0a94('0x32')]=_['intersection'](_0x13f7b8['model'],qs[_0x0a94('0x34')](_0xfe016c[_0x0a94('0x30')][_0x0a94('0x34')]));_0x28322d[_0x0a94('0x32')]=_0x28322d['attributes'][_0x0a94('0x35')]?_0x28322d[_0x0a94('0x32')]:_0x13f7b8[_0x0a94('0x33')];if(_0xfe016c[_0x0a94('0x30')]['includeAll']){_0x28322d['include']=[{'all':!![]}];}_0x28322d=_[_0x0a94('0x3d')]({},_0x28322d,_0xfe016c[_0x0a94('0x3f')]);return db['Variable'][_0x0a94('0x47')](_0x28322d)['then'](handleEntityNotFound(_0x4d9d31,null))[_0x0a94('0x23')](respondWithResult(_0x4d9d31,null))['catch'](handleError(_0x4d9d31,null));};exports['create']=function(_0xa127bd,_0x1d205c){return db[_0x0a94('0x2d')]['create'](_0xa127bd[_0x0a94('0x48')],{})[_0x0a94('0x23')](function(_0x51787f){var _0x55007d=_0xa127bd['user'][_0x0a94('0x24')]({'plain':!![]});if(!_0x55007d)throw new Error(_0x0a94('0x49'));if(_0x55007d['role']===_0x0a94('0x4a')){var _0x4fbf4b=_0x51787f[_0x0a94('0x24')]({'plain':!![]});var _0x174403=_0x0a94('0x25');return db[_0x0a94('0x4b')][_0x0a94('0x47')]({'where':{'name':_0x174403,'userProfileId':_0x55007d['userProfileId']},'raw':!![]})['then'](function(_0x4cfdcc){if(_0x4cfdcc&&_0x4cfdcc['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a94('0x4c')]({'name':_0x4fbf4b[_0x0a94('0x29')],'resourceId':_0x4fbf4b['id'],'type':_0x4cfdcc[_0x0a94('0x29')],'sectionId':_0x4cfdcc['id']},{})[_0x0a94('0x23')](function(){return _0x51787f;});}else{return _0x51787f;}})[_0x0a94('0x44')](function(_0x2b90ca){logger[_0x0a94('0x4d')](_0x0a94('0x4e'),_0x2b90ca);throw _0x2b90ca;});}return _0x51787f;})['then'](respondWithResult(_0x1d205c,0xc9))[_0x0a94('0x44')](handleError(_0x1d205c,null));};exports[_0x0a94('0x22')]=function(_0x230c1d,_0x34fe7c){if(_0x230c1d[_0x0a94('0x48')]['id']){delete _0x230c1d['body']['id'];}return db[_0x0a94('0x2d')]['find']({'where':{'id':_0x230c1d['params']['id']}})['then'](handleEntityNotFound(_0x34fe7c,null))[_0x0a94('0x23')](saveUpdates(_0x230c1d[_0x0a94('0x48')],null))[_0x0a94('0x23')](respondWithResult(_0x34fe7c,null))[_0x0a94('0x44')](handleError(_0x34fe7c,null));};exports[_0x0a94('0x27')]=function(_0x2d8af0,_0x32c543){return db[_0x0a94('0x2d')]['find']({'where':{'id':_0x2d8af0[_0x0a94('0x45')]['id']}})[_0x0a94('0x23')](handleEntityNotFound(_0x32c543,null))[_0x0a94('0x23')](removeEntity(_0x32c543,null))[_0x0a94('0x44')](handleError(_0x32c543,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index da87b6b..1b47a39 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 _0x03bb=['bluebird','request-promise','path','rimraf','exports','define','Variable','tools_variables','util','../../config/logger'];(function(_0x1a7da8,_0xb46af5){var _0x1841fd=function(_0xe3d823){while(--_0xe3d823){_0x1a7da8['push'](_0x1a7da8['shift']());}};_0x1841fd(++_0xb46af5);}(_0x03bb,0x17a));var _0xb03b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x03bb[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xb03b('0x0'));var logger=require(_0xb03b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb03b('0x2'));var rp=require(_0xb03b('0x3'));var fs=require('fs');var path=require(_0xb03b('0x4'));var rimraf=require(_0xb03b('0x5'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xb03b('0x6')]=function(_0x27aad4,_0x4353bf){return _0x27aad4[_0xb03b('0x7')](_0xb03b('0x8'),attributes,{'tableName':_0xb03b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e49=['util','../../config/logger','api','bluebird','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e49,0x19a));var _0x96e4=function(_0x2d4fd7,_0x71827c){_0x2d4fd7=_0x2d4fd7-0x0;var _0x3bc90e=_0x6e49[_0x2d4fd7];return _0x3bc90e;};'use strict';var _=require('lodash');var util=require(_0x96e4('0x0'));var logger=require(_0x96e4('0x1'))(_0x96e4('0x2'));var moment=require('moment');var BPromise=require(_0x96e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96e4('0x4'));var rimraf=require('rimraf');var config=require(_0x96e4('0x5'));var attributes=require(_0x96e4('0x6'));module[_0x96e4('0x7')]=function(_0x31e9ed,_0x4343d2){return _0x31e9ed['define'](_0x96e4('0x8'),attributes,{'tableName':_0x96e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 42ba47a..f920cb2 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 _0x1578=['client','http','request','then','info','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','code','Variable,\x20%s,\x20%s','message','catch','ShowVariable','Variable','find','options','raw','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1925c6,_0x154d01){var _0x236a1a=function(_0x310236){while(--_0x310236){_0x1925c6['push'](_0x1925c6['shift']());}};_0x236a1a(++_0x154d01);}(_0x1578,0x161));var _0x8157=function(_0x147127,_0x3756c7){_0x147127=_0x147127-0x0;var _0x5d227a=_0x1578[_0x147127];return _0x5d227a;};'use strict';var _=require(_0x8157('0x0'));var util=require(_0x8157('0x1'));var moment=require(_0x8157('0x2'));var BPromise=require(_0x8157('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8157('0x4'));var db=require(_0x8157('0x5'))['db'];var utils=require(_0x8157('0x6'));var logger=require(_0x8157('0x7'))(_0x8157('0x8'));var config=require(_0x8157('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8157('0xa')][_0x8157('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x295a18,_0x426192,_0x123d83){return new BPromise(function(_0x5a9cab,_0x2aebc7){return client[_0x8157('0xc')](_0x295a18,_0x123d83)[_0x8157('0xd')](function(_0x5ada6d){logger[_0x8157('0xe')]('Variable,\x20%s,\x20%s',_0x426192,_0x8157('0xf'));logger['debug'](_0x8157('0x10'),_0x426192,_0x8157('0xf'),JSON['stringify'](_0x5ada6d));if(_0x5ada6d[_0x8157('0x11')]){if(_0x5ada6d[_0x8157('0x11')][_0x8157('0x12')]===0x1f4){logger[_0x8157('0x11')](_0x8157('0x13'),_0x426192,_0x5ada6d[_0x8157('0x11')][_0x8157('0x14')]);return _0x2aebc7(_0x5ada6d['error'][_0x8157('0x14')]);}logger['error'](_0x8157('0x13'),_0x426192,_0x5ada6d[_0x8157('0x11')]['message']);return _0x5a9cab(_0x5ada6d[_0x8157('0x11')][_0x8157('0x14')]);}else{logger[_0x8157('0xe')]('Variable,\x20%s,\x20%s',_0x426192,_0x8157('0xf'));_0x5a9cab(_0x5ada6d['result']['message']);}})[_0x8157('0x15')](function(_0x2c9249){logger[_0x8157('0x11')](_0x8157('0x13'),_0x426192,_0x2c9249);_0x2aebc7(_0x2c9249);});});}exports[_0x8157('0x16')]=function(_0x114816){var _0x5405d7=this;return new Promise(function(_0x5df0ca,_0x5af85e){return db[_0x8157('0x17')][_0x8157('0x18')]({'raw':_0x114816[_0x8157('0x19')]?_0x114816['options'][_0x8157('0x1a')]===undefined?!![]:![]:!![],'where':_0x114816[_0x8157('0x19')]?_0x114816[_0x8157('0x19')][_0x8157('0x1b')]||null:null,'attributes':_0x114816['options']?_0x114816[_0x8157('0x19')]['attributes']||null:null,'include':_0x114816[_0x8157('0x19')]?_0x114816[_0x8157('0x19')][_0x8157('0x1c')]?_[_0x8157('0x1d')](_0x114816[_0x8157('0x19')][_0x8157('0x1c')],function(_0x375041){return{'model':db[_0x375041[_0x8157('0x1e')]],'as':_0x375041['as'],'attributes':_0x375041[_0x8157('0x1f')],'include':_0x375041[_0x8157('0x1c')]?_[_0x8157('0x1d')](_0x375041[_0x8157('0x1c')],function(_0x115cd2){return{'model':db[_0x115cd2[_0x8157('0x1e')]],'as':_0x115cd2['as'],'attributes':_0x115cd2[_0x8157('0x1f')],'include':_0x115cd2['include']?_[_0x8157('0x1d')](_0x115cd2[_0x8157('0x1c')],function(_0x23dcd0){return{'model':db[_0x23dcd0[_0x8157('0x1e')]],'as':_0x23dcd0['as'],'attributes':_0x23dcd0[_0x8157('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8157('0xd')](function(_0x342184){logger['info'](_0x8157('0x16'),_0x114816);logger['debug']('ShowVariable',_0x114816,JSON[_0x8157('0x20')](_0x342184));_0x5df0ca(_0x342184);})[_0x8157('0x15')](function(_0x2719cb){logger[_0x8157('0x11')](_0x8157('0x16'),_0x2719cb[_0x8157('0x14')],_0x114816);_0x5af85e(_0x5405d7[_0x8157('0x11')](0x1f4,_0x2719cb[_0x8157('0x14')]));});});}; \ No newline at end of file +var _0x110b=['map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','Variable','find','options','raw','attributes','include','model'];(function(_0x40fa93,_0x1c6e35){var _0x264438=function(_0x6975cb){while(--_0x6975cb){_0x40fa93['push'](_0x40fa93['shift']());}};_0x264438(++_0x1c6e35);}(_0x110b,0x175));var _0xb110=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x110b[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xb110('0x0'));var util=require(_0xb110('0x1'));var moment=require(_0xb110('0x2'));var BPromise=require(_0xb110('0x3'));var rs=require(_0xb110('0x4'));var fs=require('fs');var Redis=require(_0xb110('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb110('0x6'));var logger=require('../../config/logger')(_0xb110('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb110('0x8')][_0xb110('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba17b,_0x2065c4,_0x2617c8){return new BPromise(function(_0xc3b2f6,_0x8c9e1a){return client['request'](_0x1ba17b,_0x2617c8)[_0xb110('0xa')](function(_0xaefacf){logger[_0xb110('0xb')]('Variable,\x20%s,\x20%s',_0x2065c4,_0xb110('0xc'));logger[_0xb110('0xd')](_0xb110('0xe'),_0x2065c4,_0xb110('0xc'),JSON[_0xb110('0xf')](_0xaefacf));if(_0xaefacf[_0xb110('0x10')]){if(_0xaefacf[_0xb110('0x10')][_0xb110('0x11')]===0x1f4){logger[_0xb110('0x10')](_0xb110('0x12'),_0x2065c4,_0xaefacf['error'][_0xb110('0x13')]);return _0x8c9e1a(_0xaefacf[_0xb110('0x10')][_0xb110('0x13')]);}logger[_0xb110('0x10')]('Variable,\x20%s,\x20%s',_0x2065c4,_0xaefacf[_0xb110('0x10')][_0xb110('0x13')]);return _0xc3b2f6(_0xaefacf[_0xb110('0x10')][_0xb110('0x13')]);}else{logger[_0xb110('0xb')](_0xb110('0x12'),_0x2065c4,_0xb110('0xc'));_0xc3b2f6(_0xaefacf[_0xb110('0x14')][_0xb110('0x13')]);}})[_0xb110('0x15')](function(_0xfb1e94){logger[_0xb110('0x10')]('Variable,\x20%s,\x20%s',_0x2065c4,_0xfb1e94);_0x8c9e1a(_0xfb1e94);});});}exports[_0xb110('0x16')]=function(_0x3228e6){var _0x3c7f5c=this;return new Promise(function(_0x455988,_0x13ff92){return db[_0xb110('0x17')][_0xb110('0x18')]({'raw':_0x3228e6[_0xb110('0x19')]?_0x3228e6[_0xb110('0x19')][_0xb110('0x1a')]===undefined?!![]:![]:!![],'where':_0x3228e6[_0xb110('0x19')]?_0x3228e6[_0xb110('0x19')]['where']||null:null,'attributes':_0x3228e6[_0xb110('0x19')]?_0x3228e6[_0xb110('0x19')][_0xb110('0x1b')]||null:null,'include':_0x3228e6['options']?_0x3228e6[_0xb110('0x19')][_0xb110('0x1c')]?_['map'](_0x3228e6[_0xb110('0x19')][_0xb110('0x1c')],function(_0x53ab3c){return{'model':db[_0x53ab3c[_0xb110('0x1d')]],'as':_0x53ab3c['as'],'attributes':_0x53ab3c[_0xb110('0x1b')],'include':_0x53ab3c['include']?_[_0xb110('0x1e')](_0x53ab3c[_0xb110('0x1c')],function(_0xb81dcd){return{'model':db[_0xb81dcd[_0xb110('0x1d')]],'as':_0xb81dcd['as'],'attributes':_0xb81dcd[_0xb110('0x1b')],'include':_0xb81dcd['include']?_[_0xb110('0x1e')](_0xb81dcd['include'],function(_0x52e6f3){return{'model':db[_0x52e6f3[_0xb110('0x1d')]],'as':_0x52e6f3['as'],'attributes':_0x52e6f3[_0xb110('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb110('0xa')](function(_0x1fca90){logger['info'](_0xb110('0x16'),_0x3228e6);logger['debug'](_0xb110('0x16'),_0x3228e6,JSON[_0xb110('0xf')](_0x1fca90));_0x455988(_0x1fca90);})['catch'](function(_0x3b53ee){logger[_0xb110('0x10')](_0xb110('0x16'),_0x3b53ee[_0xb110('0x13')],_0x3228e6);_0x13ff92(_0x3c7f5c['error'](0x1f4,_0x3b53ee[_0xb110('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2b35c14..683e7cc 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 _0xe9e3=['canUpdate','pull','restart','migrations','../../components/auth/service','index','get','isAuthenticated','/reset'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0xe9e3,0x1ea));var _0x3e9e=function(_0x306086,_0x494520){_0x306086=_0x306086-0x0;var _0x2f805d=_0xe9e3[_0x306086];return _0x2f805d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3e9e('0x0'));var controller=require('./version.controller');router['get']('/',controller[_0x3e9e('0x1')]);router[_0x3e9e('0x2')]('/fetch',auth[_0x3e9e('0x3')](),auth['canUpdate'](),controller['fetch']);router[_0x3e9e('0x2')](_0x3e9e('0x4'),auth[_0x3e9e('0x3')](),auth[_0x3e9e('0x5')](),controller['reset']);router[_0x3e9e('0x2')]('/pull',auth[_0x3e9e('0x3')](),auth['canUpdate'](),controller[_0x3e9e('0x6')]);router[_0x3e9e('0x2')]('/restart',auth[_0x3e9e('0x3')](),controller[_0x3e9e('0x7')]);router[_0x3e9e('0x2')]('/migrations',controller[_0x3e9e('0x8')]);module['exports']=router; \ No newline at end of file +var _0x0d77=['isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0d77,0xd1));var _0x70d7=function(_0x1f3600,_0x567554){_0x1f3600=_0x1f3600-0x0;var _0x431db2=_0x0d77[_0x1f3600];return _0x431db2;};'use strict';var express=require(_0x70d7('0x0'));var router=express[_0x70d7('0x1')]();var auth=require(_0x70d7('0x2'));var controller=require(_0x70d7('0x3'));router['get']('/',controller[_0x70d7('0x4')]);router[_0x70d7('0x5')](_0x70d7('0x6'),auth[_0x70d7('0x7')](),auth['canUpdate'](),controller[_0x70d7('0x8')]);router[_0x70d7('0x5')](_0x70d7('0x9'),auth[_0x70d7('0x7')](),auth[_0x70d7('0xa')](),controller[_0x70d7('0xb')]);router[_0x70d7('0x5')]('/pull',auth[_0x70d7('0x7')](),auth[_0x70d7('0xa')](),controller[_0x70d7('0xc')]);router['get'](_0x70d7('0xd'),auth['isAuthenticated'](),controller[_0x70d7('0xe')]);router[_0x70d7('0x5')](_0x70d7('0xf'),controller[_0x70d7('0x10')]);module[_0x70d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8cf3da3..cd3d6d4 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 _0x20de=['../../config/logger','update','root','exports','query','latest','tags','json','status','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','server','migrations','replace','.js','push','length','Migration','sequelize','getQueryInterface','join','map','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'];(function(_0x4ee8e6,_0x26a9e0){var _0x361a6e=function(_0x574554){while(--_0x574554){_0x4ee8e6['push'](_0x4ee8e6['shift']());}};_0x361a6e(++_0x26a9e0);}(_0x20de,0x134));var _0xe20d=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x20de[_0xda464c];return _0x19e222;};'use strict';var Umzug=require(_0xe20d('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe20d('0x1'));var pkginfo=require(_0xe20d('0x2'))(module,_0xe20d('0x3'));var compareVersions=require(_0xe20d('0x4'));var exec=require(_0xe20d('0x5'))[_0xe20d('0x6')];var db=require(_0xe20d('0x7'))['db'];var config=require(_0xe20d('0x8'));var pm2=require(_0xe20d('0x9'));var logger=require(_0xe20d('0xa'))(_0xe20d('0xb'));var git=require('simple-git')(config[_0xe20d('0xc')]);exports['index']=function(_0x4e1fb9,_0x4909c9){var _0x110ff5={'current':module[_0xe20d('0xd')][_0xe20d('0x3')],'phonebar':0x2};if(_0x4e1fb9['query']&&_0x4e1fb9[_0xe20d('0xe')][_0xe20d('0xf')]){return git['fetch']()[_0xe20d('0x10')](function(_0x337c85,_0x49913b){_0x110ff5[_0xe20d('0xf')]=(_0x337c85?module[_0xe20d('0xd')][_0xe20d('0x3')]:_0x49913b[_0xe20d('0xf')])||'2.0.0';return _0x4909c9['status'](0xc8)[_0xe20d('0x11')](_0x110ff5);});}else{return _0x4909c9[_0xe20d('0x12')](0xc8)[_0xe20d('0x11')](_0x110ff5);}};exports[_0xe20d('0x13')]=function(_0x1b2c37,_0x26f1dd){return git[_0xe20d('0x13')]([_0xe20d('0x14'),_0xe20d('0x15')],function(_0x56eeea){if(_0x56eeea){logger[_0xe20d('0x16')](_0x56eeea);return _0x26f1dd['status'](0x1f4)[_0xe20d('0x11')](_0x56eeea);}logger[_0xe20d('0x17')](_0xe20d('0x18'));return _0x26f1dd['status'](0xc8)[_0xe20d('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xe20d('0x19')]=function(_0x1f2058,_0x285916){return git['reset']([_0xe20d('0x1a'),_0xe20d('0x1b')],function(_0xd96fa7){if(_0xd96fa7){logger[_0xe20d('0x16')](_0xd96fa7);return _0x285916['status'](0x1f4)[_0xe20d('0x11')](_0xd96fa7);}logger[_0xe20d('0x17')](_0xe20d('0x1c'));return _0x285916[_0xe20d('0x12')](0xc8)['json']({'output':_0xe20d('0x1d')});});};exports['pull']=function(_0x4ac635,_0x1fae60){exec(_0xe20d('0x1e'),function(_0x4baa28,_0x5e7237,_0x1552d8){logger[_0xe20d('0x17')](_0x5e7237);logger['info'](_0x1552d8);if(_0x4baa28){logger[_0xe20d('0x16')](_0x4baa28);return _0x1fae60[_0xe20d('0x12')](0x1f4)[_0xe20d('0x11')](_0x4baa28);}return _0x1fae60[_0xe20d('0x12')](0xc8)[_0xe20d('0x11')]({'output':_0x5e7237});});};exports['restart']=function(_0x1d88fd,_0x292fa0){return pm2[_0xe20d('0x1f')](_0xe20d('0x20'))[_0xe20d('0x21')](function(_0x51f395){logger['info'](_0xe20d('0x22'),_0x51f395);return _0x292fa0['status'](0xc8)[_0xe20d('0x11')]({'output':_0xe20d('0x23')});})[_0xe20d('0x24')](function(_0x46fc0e){logger[_0xe20d('0x16')](_0x46fc0e);return _0x292fa0[_0xe20d('0x12')](0x1f4)[_0xe20d('0x11')](_0x46fc0e);});};exports['migrations']=function(_0x8b7386,_0x5ecc55){var _0x555eb5=fs['readdirSync'](path['join'](config['root'],_0xe20d('0x25'),_0xe20d('0x26')));var _0x41e140=[];for(var _0x4f2d27=0x0;_0x4f2d27<_0x555eb5['length'];_0x4f2d27++){var _0x243311=_0x555eb5[_0x4f2d27][_0xe20d('0x27')](_0xe20d('0x28'),'');if(compareVersions(module[_0xe20d('0xd')][_0xe20d('0x3')],_0x243311)===-0x1){_0x41e140[_0xe20d('0x29')](_0x243311);}}if(_0x41e140[_0xe20d('0x2a')]){var _0x3a1dcb=_0x41e140['sort'](compareVersions);var _0x3772b5=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xe20d('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xe20d('0x2c')][_0xe20d('0x2d')](),db['sequelize']['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xe20d('0x2e')](config[_0xe20d('0xc')],_0xe20d('0x25'),_0xe20d('0x26')),'pattern':/\.js$/}});_0x3772b5['up']({'migrations':_[_0xe20d('0x2f')](_0x3a1dcb,function(_0x298b85){return _0x298b85+'.js';})})[_0xe20d('0x21')](function(){return _0x5ecc55[_0xe20d('0x12')](0xc8)[_0xe20d('0x11')]({'output':_0xe20d('0x30')+module['exports'][_0xe20d('0x3')]+_0xe20d('0x31')+_[_0xe20d('0x32')](_0x3a1dcb),'migrations':_[_0xe20d('0x2e')](_0x3a1dcb)});})['catch'](function(_0x5c4ccf){if(_0x5c4ccf instanceof db[_0xe20d('0x2c')][_0xe20d('0x33')]){return _0x5ecc55['status'](0xc8)[_0xe20d('0x11')]({'output':_0xe20d('0x34')});}else{return _0x5ecc55[_0xe20d('0x12')](0x1f4)[_0xe20d('0x11')](_0x5c4ccf);}});}else{return _0x5ecc55[_0xe20d('0x12')](0xc8)[_0xe20d('0x11')]({'output':_0xe20d('0x34')});}}; \ No newline at end of file +var _0xf108=['.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','join','UniqueConstraintError','umzug','lodash','pkginfo','version','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','push','length','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x32e19d,_0x4be044){var _0x2a3900=function(_0x7c582e){while(--_0x7c582e){_0x32e19d['push'](_0x32e19d['shift']());}};_0x2a3900(++_0x4be044);}(_0xf108,0x1d9));var _0x8f10=function(_0x10df41,_0x298805){_0x10df41=_0x10df41-0x0;var _0x1025a6=_0xf108[_0x10df41];return _0x1025a6;};'use strict';var Umzug=require(_0x8f10('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x8f10('0x1'));var pkginfo=require(_0x8f10('0x2'))(module,_0x8f10('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require(_0x8f10('0x4'))['db'];var config=require(_0x8f10('0x5'));var pm2=require(_0x8f10('0x6'));var logger=require(_0x8f10('0x7'))(_0x8f10('0x8'));var git=require(_0x8f10('0x9'))(config[_0x8f10('0xa')]);exports[_0x8f10('0xb')]=function(_0x9cf8af,_0x22e5df){var _0x3a5d06={'current':module['exports'][_0x8f10('0x3')],'phonebar':0x2};if(_0x9cf8af[_0x8f10('0xc')]&&_0x9cf8af[_0x8f10('0xc')][_0x8f10('0xd')]){return git[_0x8f10('0xe')]()[_0x8f10('0xf')](function(_0x2e00f7,_0x3ebfd4){_0x3a5d06[_0x8f10('0xd')]=(_0x2e00f7?module[_0x8f10('0x10')][_0x8f10('0x3')]:_0x3ebfd4[_0x8f10('0xd')])||_0x8f10('0x11');return _0x22e5df[_0x8f10('0x12')](0xc8)[_0x8f10('0x13')](_0x3a5d06);});}else{return _0x22e5df['status'](0xc8)['json'](_0x3a5d06);}};exports[_0x8f10('0xe')]=function(_0x455d66,_0x472b6f){return git[_0x8f10('0xe')]([_0x8f10('0x14'),_0x8f10('0x15')],function(_0x34952c){if(_0x34952c){logger[_0x8f10('0x16')](_0x34952c);return _0x472b6f[_0x8f10('0x12')](0x1f4)['json'](_0x34952c);}logger[_0x8f10('0x17')](_0x8f10('0x18'));return _0x472b6f[_0x8f10('0x12')](0xc8)['json']({'output':_0x8f10('0x19')});});};exports[_0x8f10('0x1a')]=function(_0x59aa0e,_0xdfd335){return git[_0x8f10('0x1a')]([_0x8f10('0x1b'),_0x8f10('0x1c')],function(_0x48eb4f){if(_0x48eb4f){logger['error'](_0x48eb4f);return _0xdfd335[_0x8f10('0x12')](0x1f4)[_0x8f10('0x13')](_0x48eb4f);}logger[_0x8f10('0x17')](_0x8f10('0x1d'));return _0xdfd335[_0x8f10('0x12')](0xc8)[_0x8f10('0x13')]({'output':_0x8f10('0x1e')});});};exports[_0x8f10('0x1f')]=function(_0x7bde34,_0x551cc5){exec(_0x8f10('0x20'),function(_0x506a8f,_0x2550e1,_0x485e83){logger['info'](_0x2550e1);logger['info'](_0x485e83);if(_0x506a8f){logger[_0x8f10('0x16')](_0x506a8f);return _0x551cc5['status'](0x1f4)[_0x8f10('0x13')](_0x506a8f);}return _0x551cc5[_0x8f10('0x12')](0xc8)[_0x8f10('0x13')]({'output':_0x2550e1});});};exports[_0x8f10('0x21')]=function(_0x419cd7,_0x2a823e){return pm2[_0x8f10('0x21')](_0x8f10('0x22'))[_0x8f10('0x23')](function(_0x44dd23){logger[_0x8f10('0x17')](_0x8f10('0x24'),_0x44dd23);return _0x2a823e[_0x8f10('0x12')](0xc8)[_0x8f10('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x8f10('0x25')](function(_0x369b11){logger['error'](_0x369b11);return _0x2a823e['status'](0x1f4)['json'](_0x369b11);});};exports[_0x8f10('0x26')]=function(_0x11db52,_0x41fe92){var _0x31033a=fs[_0x8f10('0x27')](path['join'](config[_0x8f10('0xa')],'server',_0x8f10('0x26')));var _0x3126ec=[];for(var _0x429a99=0x0;_0x429a99<_0x31033a['length'];_0x429a99++){var _0x20b587=_0x31033a[_0x429a99]['replace']('.js','');if(compareVersions(module[_0x8f10('0x10')][_0x8f10('0x3')],_0x20b587)===-0x1){_0x3126ec[_0x8f10('0x28')](_0x20b587);}}if(_0x3126ec[_0x8f10('0x29')]){var _0x2cb960=_0x3126ec[_0x8f10('0x2a')](compareVersions);var _0x19e6f8=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x8f10('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x8f10('0x2c')][_0x8f10('0x2d')](),db['sequelize']['constructor'],function(){throw new Error(_0x8f10('0x2e'));}],'path':path['join'](config[_0x8f10('0xa')],'server',_0x8f10('0x26')),'pattern':/\.js$/}});_0x19e6f8['up']({'migrations':_['map'](_0x2cb960,function(_0x5ccbce){return _0x5ccbce+_0x8f10('0x2f');})})['then'](function(){return _0x41fe92[_0x8f10('0x12')](0xc8)[_0x8f10('0x13')]({'output':_0x8f10('0x30')+module[_0x8f10('0x10')][_0x8f10('0x3')]+'\x20to\x20'+_[_0x8f10('0x31')](_0x2cb960),'migrations':_[_0x8f10('0x32')](_0x2cb960)});})['catch'](function(_0xd81898){if(_0xd81898 instanceof db['sequelize'][_0x8f10('0x33')]){return _0x41fe92['status'](0xc8)[_0x8f10('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x41fe92[_0x8f10('0x12')](0x1f4)['json'](_0xd81898);}});}else{return _0x41fe92['status'](0xc8)[_0x8f10('0x13')]({'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 9a895a3..b76032d 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 _0xd36c=['Router','../../components/auth/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x51c354,_0x4d9604){var _0x372aa3=function(_0x58aecd){while(--_0x58aecd){_0x51c354['push'](_0x51c354['shift']());}};_0x372aa3(++_0x4d9604);}(_0xd36c,0x145));var _0xcd36=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd36c[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xcd36('0x0'));var util=require(_0xcd36('0x1'));var path=require(_0xcd36('0x2'));var timeout=require(_0xcd36('0x3'));var express=require(_0xcd36('0x4'));var router=express[_0xcd36('0x5')]();var auth=require(_0xcd36('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd36('0x7'));router['get']('/',auth[_0xcd36('0x8')](),controller[_0xcd36('0x9')]);router[_0xcd36('0xa')](_0xcd36('0xb'),auth['isAuthenticated'](),controller[_0xcd36('0xc')]);router[_0xcd36('0xa')](_0xcd36('0xd'),auth[_0xcd36('0x8')](),controller[_0xcd36('0xe')]);router[_0xcd36('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd36('0x10')]);router[_0xcd36('0x11')](_0xcd36('0xd'),auth[_0xcd36('0x8')](),controller[_0xcd36('0x12')]);router[_0xcd36('0x13')](_0xcd36('0xd'),auth[_0xcd36('0x8')](),controller[_0xcd36('0x14')]);module[_0xcd36('0x15')]=router; \ No newline at end of file +var _0x65f5=['show','post','create','put','delete','destroy','multer','util','express','Router','../../components/auth/service','./voiceAgentReport.controller','index','/describe','isAuthenticated','describe','get','/:id'];(function(_0x25f3e3,_0x207891){var _0xa89b6d=function(_0xa51f2){while(--_0xa51f2){_0x25f3e3['push'](_0x25f3e3['shift']());}};_0xa89b6d(++_0x207891);}(_0x65f5,0x15c));var _0x565f=function(_0x3dd049,_0x4b5331){_0x3dd049=_0x3dd049-0x0;var _0x4754d7=_0x65f5[_0x3dd049];return _0x4754d7;};'use strict';var multer=require(_0x565f('0x0'));var util=require(_0x565f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x565f('0x2'));var router=express[_0x565f('0x3')]();var auth=require(_0x565f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x565f('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x565f('0x6')]);router['get'](_0x565f('0x7'),auth[_0x565f('0x8')](),controller[_0x565f('0x9')]);router[_0x565f('0xa')](_0x565f('0xb'),auth[_0x565f('0x8')](),controller[_0x565f('0xc')]);router[_0x565f('0xd')]('/',auth[_0x565f('0x8')](),controller[_0x565f('0xe')]);router[_0x565f('0xf')](_0x565f('0xb'),auth[_0x565f('0x8')](),controller['update']);router[_0x565f('0x10')](_0x565f('0xb'),auth['isAuthenticated'](),controller[_0x565f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 81d3481..b52b03b 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 _0x5fd1=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x1b0845,_0x36c690){var _0x410374=function(_0x51ef83){while(--_0x51ef83){_0x1b0845['push'](_0x1b0845['shift']());}};_0x410374(++_0x36c690);}(_0x5fd1,0x155));var _0x15fd=function(_0x95edb4,_0x1f8d14){_0x95edb4=_0x95edb4-0x0;var _0x24d030=_0x5fd1[_0x95edb4];return _0x24d030;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x15fd('0x1')]},'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'calleridnum':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x15fd('0x1')]},'membername':{'type':Sequelize[_0x15fd('0x1')]},'agentcalledAt':{'type':Sequelize[_0x15fd('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x15fd('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x15fd('0x2')]},'agentdumpAt':{'type':Sequelize[_0x15fd('0x2')]},'holdtime':{'type':Sequelize[_0x15fd('0x3')]},'agentcomplete':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x15fd('0x3')]},'agentacw':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x15fd('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x15fd('0x1')]},'channelstate':{'type':Sequelize[_0x15fd('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize[_0x15fd('0x1')]},'exten':{'type':Sequelize[_0x15fd('0x1')]},'priority':{'type':Sequelize[_0x15fd('0x1')]},'destchannel':{'type':Sequelize[_0x15fd('0x1')]},'destchannelstate':{'type':Sequelize[_0x15fd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x15fd('0x1')]},'destaccountcode':{'type':Sequelize[_0x15fd('0x1')]},'destcontext':{'type':Sequelize[_0x15fd('0x1')]},'destexten':{'type':Sequelize[_0x15fd('0x1')]},'destpriority':{'type':Sequelize[_0x15fd('0x1')]},'destuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x15fd('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x15fd('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x53ec=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x45427d,_0x502fa5){var _0x429808=function(_0xf15e9e){while(--_0xf15e9e){_0x45427d['push'](_0x45427d['shift']());}};_0x429808(++_0x502fa5);}(_0x53ec,0x192));var _0xc53e=function(_0x3498f5,_0x35cbaf){_0x3498f5=_0x3498f5-0x0;var _0x2273da=_0x53ec[_0x3498f5];return _0x2273da;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'type':{'type':Sequelize[_0xc53e('0x2')]},'uniqueid':{'type':Sequelize[_0xc53e('0x2')]},'calleridnum':{'type':Sequelize[_0xc53e('0x2')]},'calleridname':{'type':Sequelize[_0xc53e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc53e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc53e('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc53e('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc53e('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc53e('0x4')]},'agentcomplete':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc53e('0x4')]},'agentacw':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc53e('0x4')]},'reason':{'type':Sequelize[_0xc53e('0x2')]},'lastevent':{'type':Sequelize[_0xc53e('0x2')]},'channel':{'type':Sequelize[_0xc53e('0x2')]},'channelstate':{'type':Sequelize[_0xc53e('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc53e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc53e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc53e('0x2')]},'priority':{'type':Sequelize[_0xc53e('0x2')]},'destchannel':{'type':Sequelize[_0xc53e('0x2')]},'destchannelstate':{'type':Sequelize[_0xc53e('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc53e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc53e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc53e('0x2')]},'destlanguage':{'type':Sequelize[_0xc53e('0x2')]},'destaccountcode':{'type':Sequelize[_0xc53e('0x2')]},'destcontext':{'type':Sequelize[_0xc53e('0x2')]},'destexten':{'type':Sequelize[_0xc53e('0x2')]},'destpriority':{'type':Sequelize[_0xc53e('0x2')]},'destuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc53e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc53e('0x2')],'comment':_0xc53e('0x6')},'transferexten':{'type':Sequelize[_0xc53e('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc53e('0x2')]},'agententerreason':{'type':Sequelize[_0xc53e('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 bdb2603..4db3ae7 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 _0x9d6f=['create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','keys','options'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9d6f,0x141));var _0xf9d6=function(_0x2c8a26,_0x30b103){_0x2c8a26=_0x2c8a26-0x0;var _0xd43db5=_0x9d6f[_0x2c8a26];return _0xd43db5;};'use strict';var pdf=require(_0xf9d6('0x0'));var emlformat=require(_0xf9d6('0x1'));var rimraf=require(_0xf9d6('0x2'));var zipdir=require(_0xf9d6('0x3'));var jsonpatch=require(_0xf9d6('0x4'));var rp=require(_0xf9d6('0x5'));var moment=require(_0xf9d6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf9d6('0x7'));var util=require(_0xf9d6('0x8'));var path=require(_0xf9d6('0x9'));var sox=require(_0xf9d6('0xa'));var csv=require(_0xf9d6('0xb'));var ejs=require(_0xf9d6('0xc'));var fs=require('fs');var _=require(_0xf9d6('0xd'));var squel=require(_0xf9d6('0xe'));var crypto=require(_0xf9d6('0xf'));var jsforce=require(_0xf9d6('0x10'));var deskjs=require(_0xf9d6('0x11'));var toCsv=require(_0xf9d6('0xb'));var querystring=require(_0xf9d6('0x12'));var Papa=require(_0xf9d6('0x13'));var Redis=require(_0xf9d6('0x14'));var authService=require(_0xf9d6('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf9d6('0x16'));var hardwareService=require(_0xf9d6('0x17'));var logger=require(_0xf9d6('0x18'))(_0xf9d6('0x19'));var utils=require(_0xf9d6('0x1a'));var config=require(_0xf9d6('0x1b'));var db=require(_0xf9d6('0x1c'))['db'];function respondWithStatusCode(_0x340486,_0x31cba){_0x31cba=_0x31cba||0xcc;return function(_0x24d2f9){if(_0x24d2f9){return _0x340486[_0xf9d6('0x1d')](_0x31cba);}return _0x340486['status'](_0x31cba)[_0xf9d6('0x1e')]();};}function respondWithResult(_0x58df34,_0x239dcf){_0x239dcf=_0x239dcf||0xc8;return function(_0x5e83bd){if(_0x5e83bd){return _0x58df34['status'](_0x239dcf)[_0xf9d6('0x1f')](_0x5e83bd);}};}function respondWithFilteredResult(_0x3410e6,_0x377c57){return function(_0x4ca10f){if(_0x4ca10f){var _0x9d6161=_0x4ca10f[_0xf9d6('0x20')],_0x2d4096=_0x377c57[_0xf9d6('0x21')],_0x1e365b=_0x377c57[_0xf9d6('0x21')]+_0x377c57[_0xf9d6('0x22')],_0x868988;if(_0x1e365b>=_0x9d6161){_0x1e365b=_0x9d6161;_0x868988=0xc8;}else{_0x868988=0xce;}_0x3410e6[_0xf9d6('0x23')](_0x868988);return _0x3410e6[_0xf9d6('0x24')](_0xf9d6('0x25'),_0x2d4096+'-'+_0x1e365b+'/'+_0x9d6161)[_0xf9d6('0x1f')](_0x4ca10f);}return null;};}function patchUpdates(_0x2de0b6){return function(_0x508a2c){try{jsonpatch[_0xf9d6('0x26')](_0x508a2c,_0x2de0b6,!![]);}catch(_0x5bc5c4){return BPromise[_0xf9d6('0x27')](_0x5bc5c4);}return _0x508a2c[_0xf9d6('0x28')]();};}function saveUpdates(_0x4799cb,_0x1dd76e){return function(_0x49905b){if(_0x49905b){return _0x49905b[_0xf9d6('0x29')](_0x4799cb)[_0xf9d6('0x2a')](function(_0xf0838){return _0xf0838;});}return null;};}function removeEntity(_0xcf849d,_0x49c622){return function(_0x9a8913){if(_0x9a8913){return _0x9a8913[_0xf9d6('0x2b')]()[_0xf9d6('0x2a')](function(){_0xcf849d[_0xf9d6('0x23')](0xcc)[_0xf9d6('0x1e')]();});}};}function handleEntityNotFound(_0xc637aa,_0x3f2a6d){return function(_0x3d8318){if(!_0x3d8318){_0xc637aa[_0xf9d6('0x1d')](0x194);}return _0x3d8318;};}function handleError(_0xf24a72,_0x945fad){_0x945fad=_0x945fad||0x1f4;return function(_0x443f5f){logger[_0xf9d6('0x2c')](_0x443f5f['stack']);if(_0x443f5f[_0xf9d6('0x2d')]){delete _0x443f5f[_0xf9d6('0x2d')];}_0xf24a72['status'](_0x945fad)['send'](_0x443f5f);};}exports[_0xf9d6('0x2e')]=function(_0x2854ab,_0x219170){var _0x1d8693={},_0x27c175={},_0x4bdd07={'count':0x0,'rows':[]};var _0x3b27a3=_[_0xf9d6('0x2f')](db[_0xf9d6('0x30')][_0xf9d6('0x31')],function(_0x409d92){return{'name':_0x409d92[_0xf9d6('0x32')],'type':_0x409d92[_0xf9d6('0x33')][_0xf9d6('0x34')]};});_0x27c175[_0xf9d6('0x35')]=_[_0xf9d6('0x2f')](_0x3b27a3,_0xf9d6('0x2d'));_0x27c175['query']=_['keys'](_0x2854ab[_0xf9d6('0x36')]);_0x27c175[_0xf9d6('0x37')]=_[_0xf9d6('0x38')](_0x27c175[_0xf9d6('0x35')],_0x27c175['query']);_0x1d8693[_0xf9d6('0x39')]=_[_0xf9d6('0x38')](_0x27c175[_0xf9d6('0x35')],qs[_0xf9d6('0x3a')](_0x2854ab[_0xf9d6('0x36')]['fields']));_0x1d8693['attributes']=_0x1d8693['attributes']['length']?_0x1d8693[_0xf9d6('0x39')]:_0x27c175[_0xf9d6('0x35')];if(!_0x2854ab[_0xf9d6('0x36')][_0xf9d6('0x3b')](_0xf9d6('0x3c'))){_0x1d8693[_0xf9d6('0x22')]=qs['limit'](_0x2854ab[_0xf9d6('0x36')][_0xf9d6('0x22')]);_0x1d8693[_0xf9d6('0x21')]=qs[_0xf9d6('0x21')](_0x2854ab[_0xf9d6('0x36')][_0xf9d6('0x21')]);}_0x1d8693[_0xf9d6('0x3d')]=qs['sort'](_0x2854ab['query']['sort']);_0x1d8693['where']=qs['filters'](_[_0xf9d6('0x3e')](_0x2854ab[_0xf9d6('0x36')],_0x27c175[_0xf9d6('0x37')]),_0x3b27a3);if(_0x2854ab['query']['filter']){_0x1d8693[_0xf9d6('0x3f')]=_['merge'](_0x1d8693[_0xf9d6('0x3f')],{'$or':_['map'](_0x3b27a3,function(_0x34f5b0){if(_0x34f5b0[_0xf9d6('0x33')]!==_0xf9d6('0x40')){var _0x168a62={};_0x168a62[_0x34f5b0[_0xf9d6('0x2d')]]={'$like':'%'+_0x2854ab[_0xf9d6('0x36')][_0xf9d6('0x41')]+'%'};return _0x168a62;}})});}_0x1d8693=_[_0xf9d6('0x42')]({},_0x1d8693,_0x2854ab['options']);var _0x59eab3={'where':_0x1d8693[_0xf9d6('0x3f')]};return db[_0xf9d6('0x30')]['count'](_0x59eab3)['then'](function(_0x1f54fc){_0x4bdd07[_0xf9d6('0x20')]=_0x1f54fc;if(_0x2854ab[_0xf9d6('0x36')][_0xf9d6('0x43')]){_0x1d8693[_0xf9d6('0x44')]=[{'all':!![]}];}return db[_0xf9d6('0x30')][_0xf9d6('0x45')](_0x1d8693);})['then'](function(_0xb97321){_0x4bdd07['rows']=_0xb97321;return _0x4bdd07;})['then'](respondWithFilteredResult(_0x219170,_0x1d8693))[_0xf9d6('0x46')](handleError(_0x219170,null));};exports[_0xf9d6('0x47')]=function(_0x501825,_0x1381c0){var _0x343297={'raw':![],'where':{'id':_0x501825['params']['id']}},_0x1f6e22={};_0x1f6e22[_0xf9d6('0x35')]=_[_0xf9d6('0x48')](db[_0xf9d6('0x30')][_0xf9d6('0x31')]);_0x1f6e22[_0xf9d6('0x36')]=_[_0xf9d6('0x48')](_0x501825[_0xf9d6('0x36')]);_0x1f6e22[_0xf9d6('0x37')]=_[_0xf9d6('0x38')](_0x1f6e22[_0xf9d6('0x35')],_0x1f6e22[_0xf9d6('0x36')]);_0x343297['attributes']=_[_0xf9d6('0x38')](_0x1f6e22[_0xf9d6('0x35')],qs[_0xf9d6('0x3a')](_0x501825['query'][_0xf9d6('0x3a')]));_0x343297[_0xf9d6('0x39')]=_0x343297[_0xf9d6('0x39')]['length']?_0x343297['attributes']:_0x1f6e22[_0xf9d6('0x35')];if(_0x501825[_0xf9d6('0x36')][_0xf9d6('0x43')]){_0x343297[_0xf9d6('0x44')]=[{'all':!![]}];}_0x343297=_['merge']({},_0x343297,_0x501825[_0xf9d6('0x49')]);return db[_0xf9d6('0x30')]['find'](_0x343297)['then'](handleEntityNotFound(_0x1381c0,null))[_0xf9d6('0x2a')](respondWithResult(_0x1381c0,null))[_0xf9d6('0x46')](handleError(_0x1381c0,null));};exports[_0xf9d6('0x4a')]=function(_0x251c16,_0xa1e274){return db[_0xf9d6('0x30')]['create'](_0x251c16['body'],{})['then'](respondWithResult(_0xa1e274,0xc9))[_0xf9d6('0x46')](handleError(_0xa1e274,null));};exports[_0xf9d6('0x29')]=function(_0x415802,_0x4245e5){if(_0x415802['body']['id']){delete _0x415802[_0xf9d6('0x4b')]['id'];}return db[_0xf9d6('0x30')][_0xf9d6('0x4c')]({'where':{'id':_0x415802['params']['id']}})[_0xf9d6('0x2a')](handleEntityNotFound(_0x4245e5,null))[_0xf9d6('0x2a')](saveUpdates(_0x415802[_0xf9d6('0x4b')],null))[_0xf9d6('0x2a')](respondWithResult(_0x4245e5,null))[_0xf9d6('0x46')](handleError(_0x4245e5,null));};exports[_0xf9d6('0x2b')]=function(_0x47da42,_0xb5a8e0){return db[_0xf9d6('0x30')][_0xf9d6('0x4c')]({'where':{'id':_0x47da42[_0xf9d6('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb5a8e0,null))[_0xf9d6('0x2a')](removeEntity(_0xb5a8e0,null))[_0xf9d6('0x46')](handleError(_0xb5a8e0,null));};exports[_0xf9d6('0x4e')]=function(_0x5158f9,_0x323932){return db[_0xf9d6('0x30')][_0xf9d6('0x4e')]()[_0xf9d6('0x2a')](respondWithResult(_0x323932,null))[_0xf9d6('0x46')](handleError(_0x323932,null));}; \ No newline at end of file +var _0xf526=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','filter','count','includeAll','rows','catch','params','options','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','type','key'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0xf526,0x122));var _0x6f52=function(_0x7f26ab,_0x41ab21){_0x7f26ab=_0x7f26ab-0x0;var _0x33bb48=_0xf526[_0x7f26ab];return _0x33bb48;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f52('0x0'));var zipdir=require(_0x6f52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f52('0x2'));var moment=require(_0x6f52('0x3'));var BPromise=require(_0x6f52('0x4'));var Mustache=require(_0x6f52('0x5'));var util=require(_0x6f52('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6f52('0x7'));var ejs=require(_0x6f52('0x8'));var fs=require('fs');var _=require(_0x6f52('0x9'));var squel=require(_0x6f52('0xa'));var crypto=require(_0x6f52('0xb'));var jsforce=require(_0x6f52('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f52('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f52('0xd'));var hardwareService=require(_0x6f52('0xe'));var logger=require(_0x6f52('0xf'))('api');var utils=require(_0x6f52('0x10'));var config=require('../../config/environment');var db=require(_0x6f52('0x11'))['db'];function respondWithStatusCode(_0xf51b8d,_0x40e63b){_0x40e63b=_0x40e63b||0xcc;return function(_0x56d7cf){if(_0x56d7cf){return _0xf51b8d[_0x6f52('0x12')](_0x40e63b);}return _0xf51b8d[_0x6f52('0x13')](_0x40e63b)['end']();};}function respondWithResult(_0x11cd14,_0x2e3394){_0x2e3394=_0x2e3394||0xc8;return function(_0x1a5c65){if(_0x1a5c65){return _0x11cd14[_0x6f52('0x13')](_0x2e3394)['json'](_0x1a5c65);}};}function respondWithFilteredResult(_0x3b89ad,_0x10bda3){return function(_0x187578){if(_0x187578){var _0x57feaa=_0x187578['count'],_0xb5932f=_0x10bda3[_0x6f52('0x14')],_0x4c443a=_0x10bda3[_0x6f52('0x14')]+_0x10bda3[_0x6f52('0x15')],_0x411215;if(_0x4c443a>=_0x57feaa){_0x4c443a=_0x57feaa;_0x411215=0xc8;}else{_0x411215=0xce;}_0x3b89ad[_0x6f52('0x13')](_0x411215);return _0x3b89ad[_0x6f52('0x16')](_0x6f52('0x17'),_0xb5932f+'-'+_0x4c443a+'/'+_0x57feaa)[_0x6f52('0x18')](_0x187578);}return null;};}function patchUpdates(_0x1f9a5f){return function(_0x53ea3a){try{jsonpatch[_0x6f52('0x19')](_0x53ea3a,_0x1f9a5f,!![]);}catch(_0x5df42f){return BPromise[_0x6f52('0x1a')](_0x5df42f);}return _0x53ea3a['save']();};}function saveUpdates(_0x4c87a6,_0x14f7b2){return function(_0x38a5bc){if(_0x38a5bc){return _0x38a5bc['update'](_0x4c87a6)[_0x6f52('0x1b')](function(_0x394371){return _0x394371;});}return null;};}function removeEntity(_0x95a305,_0x48cb4b){return function(_0x5a8b9f){if(_0x5a8b9f){return _0x5a8b9f[_0x6f52('0x1c')]()[_0x6f52('0x1b')](function(){_0x95a305[_0x6f52('0x13')](0xcc)[_0x6f52('0x1d')]();});}};}function handleEntityNotFound(_0x2e7740,_0x2b97fb){return function(_0x4cd60f){if(!_0x4cd60f){_0x2e7740[_0x6f52('0x12')](0x194);}return _0x4cd60f;};}function handleError(_0x27a7f5,_0x2462a9){_0x2462a9=_0x2462a9||0x1f4;return function(_0xebc967){logger[_0x6f52('0x1e')](_0xebc967[_0x6f52('0x1f')]);if(_0xebc967['name']){delete _0xebc967[_0x6f52('0x20')];}_0x27a7f5[_0x6f52('0x13')](_0x2462a9)[_0x6f52('0x21')](_0xebc967);};}exports[_0x6f52('0x22')]=function(_0x1c14fc,_0x3746cd){var _0x13a845={},_0x277257={},_0x46be32={'count':0x0,'rows':[]};var _0x48ba76=_[_0x6f52('0x23')](db[_0x6f52('0x24')][_0x6f52('0x25')],function(_0x4462f0){return{'name':_0x4462f0['fieldName'],'type':_0x4462f0[_0x6f52('0x26')][_0x6f52('0x27')]};});_0x277257[_0x6f52('0x28')]=_['map'](_0x48ba76,_0x6f52('0x20'));_0x277257[_0x6f52('0x29')]=_[_0x6f52('0x2a')](_0x1c14fc[_0x6f52('0x29')]);_0x277257['filters']=_[_0x6f52('0x2b')](_0x277257['model'],_0x277257['query']);_0x13a845[_0x6f52('0x2c')]=_['intersection'](_0x277257['model'],qs[_0x6f52('0x2d')](_0x1c14fc[_0x6f52('0x29')]['fields']));_0x13a845[_0x6f52('0x2c')]=_0x13a845[_0x6f52('0x2c')][_0x6f52('0x2e')]?_0x13a845[_0x6f52('0x2c')]:_0x277257[_0x6f52('0x28')];if(!_0x1c14fc[_0x6f52('0x29')][_0x6f52('0x2f')]('nolimit')){_0x13a845[_0x6f52('0x15')]=qs['limit'](_0x1c14fc[_0x6f52('0x29')][_0x6f52('0x15')]);_0x13a845[_0x6f52('0x14')]=qs[_0x6f52('0x14')](_0x1c14fc['query'][_0x6f52('0x14')]);}_0x13a845[_0x6f52('0x30')]=qs[_0x6f52('0x31')](_0x1c14fc[_0x6f52('0x29')]['sort']);_0x13a845[_0x6f52('0x32')]=qs['filters'](_[_0x6f52('0x33')](_0x1c14fc[_0x6f52('0x29')],_0x277257[_0x6f52('0x34')]),_0x48ba76);if(_0x1c14fc[_0x6f52('0x29')]['filter']){_0x13a845[_0x6f52('0x32')]=_[_0x6f52('0x35')](_0x13a845[_0x6f52('0x32')],{'$or':_[_0x6f52('0x23')](_0x48ba76,function(_0x4fdaae){if(_0x4fdaae[_0x6f52('0x26')]!=='VIRTUAL'){var _0x323c97={};_0x323c97[_0x4fdaae[_0x6f52('0x20')]]={'$like':'%'+_0x1c14fc[_0x6f52('0x29')][_0x6f52('0x36')]+'%'};return _0x323c97;}})});}_0x13a845=_[_0x6f52('0x35')]({},_0x13a845,_0x1c14fc['options']);var _0xedbdfd={'where':_0x13a845['where']};return db[_0x6f52('0x24')]['count'](_0xedbdfd)[_0x6f52('0x1b')](function(_0x8e17de){_0x46be32[_0x6f52('0x37')]=_0x8e17de;if(_0x1c14fc[_0x6f52('0x29')][_0x6f52('0x38')]){_0x13a845['include']=[{'all':!![]}];}return db[_0x6f52('0x24')]['findAll'](_0x13a845);})[_0x6f52('0x1b')](function(_0xa4c65c){_0x46be32[_0x6f52('0x39')]=_0xa4c65c;return _0x46be32;})[_0x6f52('0x1b')](respondWithFilteredResult(_0x3746cd,_0x13a845))[_0x6f52('0x3a')](handleError(_0x3746cd,null));};exports['show']=function(_0x14d95f,_0xd41cd6){var _0x3dd72d={'raw':![],'where':{'id':_0x14d95f[_0x6f52('0x3b')]['id']}},_0xedd03a={};_0xedd03a['model']=_['keys'](db[_0x6f52('0x24')][_0x6f52('0x25')]);_0xedd03a[_0x6f52('0x29')]=_[_0x6f52('0x2a')](_0x14d95f['query']);_0xedd03a[_0x6f52('0x34')]=_[_0x6f52('0x2b')](_0xedd03a[_0x6f52('0x28')],_0xedd03a[_0x6f52('0x29')]);_0x3dd72d[_0x6f52('0x2c')]=_[_0x6f52('0x2b')](_0xedd03a[_0x6f52('0x28')],qs['fields'](_0x14d95f['query'][_0x6f52('0x2d')]));_0x3dd72d[_0x6f52('0x2c')]=_0x3dd72d[_0x6f52('0x2c')][_0x6f52('0x2e')]?_0x3dd72d[_0x6f52('0x2c')]:_0xedd03a[_0x6f52('0x28')];if(_0x14d95f[_0x6f52('0x29')][_0x6f52('0x38')]){_0x3dd72d['include']=[{'all':!![]}];}_0x3dd72d=_[_0x6f52('0x35')]({},_0x3dd72d,_0x14d95f[_0x6f52('0x3c')]);return db['VoiceAgentReport'][_0x6f52('0x3d')](_0x3dd72d)[_0x6f52('0x1b')](handleEntityNotFound(_0xd41cd6,null))[_0x6f52('0x1b')](respondWithResult(_0xd41cd6,null))[_0x6f52('0x3a')](handleError(_0xd41cd6,null));};exports[_0x6f52('0x3e')]=function(_0x240a4d,_0x1afb03){return db[_0x6f52('0x24')][_0x6f52('0x3e')](_0x240a4d[_0x6f52('0x3f')],{})['then'](respondWithResult(_0x1afb03,0xc9))[_0x6f52('0x3a')](handleError(_0x1afb03,null));};exports[_0x6f52('0x40')]=function(_0x2cf2ff,_0x385ece){if(_0x2cf2ff[_0x6f52('0x3f')]['id']){delete _0x2cf2ff[_0x6f52('0x3f')]['id'];}return db[_0x6f52('0x24')]['find']({'where':{'id':_0x2cf2ff[_0x6f52('0x3b')]['id']}})[_0x6f52('0x1b')](handleEntityNotFound(_0x385ece,null))['then'](saveUpdates(_0x2cf2ff[_0x6f52('0x3f')],null))['then'](respondWithResult(_0x385ece,null))[_0x6f52('0x3a')](handleError(_0x385ece,null));};exports[_0x6f52('0x1c')]=function(_0x489901,_0x5bac71){return db[_0x6f52('0x24')][_0x6f52('0x3d')]({'where':{'id':_0x489901[_0x6f52('0x3b')]['id']}})[_0x6f52('0x1b')](handleEntityNotFound(_0x5bac71,null))['then'](removeEntity(_0x5bac71,null))[_0x6f52('0x3a')](handleError(_0x5bac71,null));};exports['describe']=function(_0x39c3a1,_0x5c5d79){return db[_0x6f52('0x24')][_0x6f52('0x41')]()['then'](respondWithResult(_0x5c5d79,null))[_0x6f52('0x3a')](handleError(_0x5c5d79,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e6f2fe2..8910dd2 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 _0xe706=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0xe706,0xa3));var _0x6e70=function(_0x5b8320,_0x2ab5e5){_0x5b8320=_0x5b8320-0x0;var _0x5239ff=_0xe706[_0x5b8320];return _0x5239ff;};'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':[{'fields':[_0x6e70('0xe'),_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0xe706,0xa3));var _0x6e70=function(_0x463f89,_0xf317cf){_0x463f89=_0x463f89-0x0;var _0x1e0849=_0xe706[_0x463f89];return _0x1e0849;};'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':[{'fields':[_0x6e70('0xe'),_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1fc1324..307f98a 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 _0x9b99=['where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','create','body','options','raw','then','debug','UpdateVoiceAgentReport','VoiceAgentReport','update'];(function(_0x3b0339,_0x2eaeae){var _0x20bfcd=function(_0x41d86e){while(--_0x41d86e){_0x3b0339['push'](_0x3b0339['shift']());}};_0x20bfcd(++_0x2eaeae);}(_0x9b99,0x14d));var _0x99b9=function(_0x2e7800,_0x1208bd){_0x2e7800=_0x2e7800-0x0;var _0x53ab6d=_0x9b99[_0x2e7800];return _0x53ab6d;};'use strict';var _=require(_0x99b9('0x0'));var util=require(_0x99b9('0x1'));var moment=require('moment');var BPromise=require(_0x99b9('0x2'));var rs=require(_0x99b9('0x3'));var fs=require('fs');var Redis=require(_0x99b9('0x4'));var db=require(_0x99b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b9('0x6'))(_0x99b9('0x7'));var config=require(_0x99b9('0x8'));var jayson=require(_0x99b9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21a3ba,_0x51ec75,_0x1fcc0d){return new BPromise(function(_0x1887f3,_0x50ec96){return client[_0x99b9('0xa')](_0x21a3ba,_0x1fcc0d)['then'](function(_0x7a177){logger[_0x99b9('0xb')](_0x99b9('0xc'),_0x51ec75,_0x99b9('0xd'));logger['debug'](_0x99b9('0xe'),_0x51ec75,_0x99b9('0xd'),JSON[_0x99b9('0xf')](_0x7a177));if(_0x7a177[_0x99b9('0x10')]){if(_0x7a177[_0x99b9('0x10')][_0x99b9('0x11')]===0x1f4){logger[_0x99b9('0x10')](_0x99b9('0xc'),_0x51ec75,_0x7a177[_0x99b9('0x10')][_0x99b9('0x12')]);return _0x50ec96(_0x7a177[_0x99b9('0x10')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x51ec75,_0x7a177['error'][_0x99b9('0x12')]);return _0x1887f3(_0x7a177['error'][_0x99b9('0x12')]);}else{logger[_0x99b9('0xb')](_0x99b9('0xc'),_0x51ec75,_0x99b9('0xd'));_0x1887f3(_0x7a177['result'][_0x99b9('0x12')]);}})[_0x99b9('0x13')](function(_0x4f2898){logger[_0x99b9('0x10')](_0x99b9('0xc'),_0x51ec75,_0x4f2898);_0x50ec96(_0x4f2898);});});}exports[_0x99b9('0x14')]=function(_0x33172b){var _0x46ae38=this;return new Promise(function(_0x3b813b,_0x4a319b){return db['VoiceAgentReport'][_0x99b9('0x15')](_0x33172b[_0x99b9('0x16')],{'raw':_0x33172b[_0x99b9('0x17')]?_0x33172b[_0x99b9('0x17')][_0x99b9('0x18')]===undefined?!![]:![]:!![]})[_0x99b9('0x19')](function(_0x398c25){logger[_0x99b9('0xb')]('CreateVoiceAgentReport',_0x33172b);logger[_0x99b9('0x1a')](_0x99b9('0x14'),_0x33172b,JSON[_0x99b9('0xf')](_0x398c25));_0x3b813b(_0x398c25);})[_0x99b9('0x13')](function(_0x2d2f90){logger[_0x99b9('0x10')](_0x99b9('0x14'),_0x2d2f90[_0x99b9('0x12')],_0x33172b);_0x4a319b(_0x46ae38[_0x99b9('0x10')](0x1f4,_0x2d2f90[_0x99b9('0x12')]));});});};exports[_0x99b9('0x1b')]=function(_0x5f1d23){var _0x50e45d=this;return new Promise(function(_0x5ec758,_0x27205c){return db[_0x99b9('0x1c')][_0x99b9('0x1d')](_0x5f1d23[_0x99b9('0x16')],{'raw':_0x5f1d23['options']?_0x5f1d23['options'][_0x99b9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1d23[_0x99b9('0x17')]?_0x5f1d23['options'][_0x99b9('0x1e')]||null:null,'attributes':_0x5f1d23[_0x99b9('0x17')]?_0x5f1d23[_0x99b9('0x17')][_0x99b9('0x1f')]||null:null,'limit':_0x5f1d23[_0x99b9('0x17')]?_0x5f1d23[_0x99b9('0x17')][_0x99b9('0x20')]||null:null})[_0x99b9('0x19')](function(_0x232c98){logger[_0x99b9('0xb')](_0x99b9('0x1b'),_0x5f1d23);logger[_0x99b9('0x1a')](_0x99b9('0x1b'),_0x5f1d23,JSON[_0x99b9('0xf')](_0x232c98));_0x5ec758(_0x232c98);})[_0x99b9('0x13')](function(_0x4c7bd4){logger[_0x99b9('0x10')](_0x99b9('0x1b'),_0x4c7bd4[_0x99b9('0x12')],_0x5f1d23);_0x27205c(_0x50e45d[_0x99b9('0x10')](0x1f4,_0x4c7bd4[_0x99b9('0x12')]));});});}; \ No newline at end of file +var _0x0ac4=['../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','UpdateVoiceAgentReport','update','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x27c504,_0x5827ce){var _0x5a58e3=function(_0x388c48){while(--_0x388c48){_0x27c504['push'](_0x27c504['shift']());}};_0x5a58e3(++_0x5827ce);}(_0x0ac4,0x155));var _0x40ac=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x0ac4[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x40ac('0x0'));var util=require(_0x40ac('0x1'));var moment=require(_0x40ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x40ac('0x3'));var fs=require('fs');var Redis=require(_0x40ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40ac('0x5'))(_0x40ac('0x6'));var config=require(_0x40ac('0x7'));var jayson=require(_0x40ac('0x8'));var client=jayson[_0x40ac('0x9')][_0x40ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eb346,_0x5c4cef,_0x4d8077){return new BPromise(function(_0x342db2,_0x3db136){return client['request'](_0x4eb346,_0x4d8077)[_0x40ac('0xb')](function(_0x408b89){logger['info'](_0x40ac('0xc'),_0x5c4cef,_0x40ac('0xd'));logger['debug'](_0x40ac('0xe'),_0x5c4cef,'request\x20sent',JSON[_0x40ac('0xf')](_0x408b89));if(_0x408b89[_0x40ac('0x10')]){if(_0x408b89['error'][_0x40ac('0x11')]===0x1f4){logger[_0x40ac('0x10')](_0x40ac('0xc'),_0x5c4cef,_0x408b89[_0x40ac('0x10')][_0x40ac('0x12')]);return _0x3db136(_0x408b89[_0x40ac('0x10')]['message']);}logger[_0x40ac('0x10')](_0x40ac('0xc'),_0x5c4cef,_0x408b89[_0x40ac('0x10')][_0x40ac('0x12')]);return _0x342db2(_0x408b89['error'][_0x40ac('0x12')]);}else{logger[_0x40ac('0x13')](_0x40ac('0xc'),_0x5c4cef,_0x40ac('0xd'));_0x342db2(_0x408b89['result']['message']);}})[_0x40ac('0x14')](function(_0x24fd31){logger[_0x40ac('0x10')](_0x40ac('0xc'),_0x5c4cef,_0x24fd31);_0x3db136(_0x24fd31);});});}exports[_0x40ac('0x15')]=function(_0x17ff49){var _0x3fba23=this;return new Promise(function(_0x45d40c,_0x443bf6){return db[_0x40ac('0x16')][_0x40ac('0x17')](_0x17ff49[_0x40ac('0x18')],{'raw':_0x17ff49[_0x40ac('0x19')]?_0x17ff49[_0x40ac('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28db3a){logger[_0x40ac('0x13')](_0x40ac('0x15'),_0x17ff49);logger[_0x40ac('0x1a')]('CreateVoiceAgentReport',_0x17ff49,JSON['stringify'](_0x28db3a));_0x45d40c(_0x28db3a);})[_0x40ac('0x14')](function(_0x134294){logger[_0x40ac('0x10')]('CreateVoiceAgentReport',_0x134294[_0x40ac('0x12')],_0x17ff49);_0x443bf6(_0x3fba23['error'](0x1f4,_0x134294[_0x40ac('0x12')]));});});};exports[_0x40ac('0x1b')]=function(_0x4e92f0){var _0x942aea=this;return new Promise(function(_0x35a1ed,_0xcdfd10){return db[_0x40ac('0x16')][_0x40ac('0x1c')](_0x4e92f0[_0x40ac('0x18')],{'raw':_0x4e92f0[_0x40ac('0x19')]?_0x4e92f0[_0x40ac('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e92f0[_0x40ac('0x19')]?_0x4e92f0[_0x40ac('0x19')]['where']||null:null,'attributes':_0x4e92f0[_0x40ac('0x19')]?_0x4e92f0[_0x40ac('0x19')]['attributes']||null:null,'limit':_0x4e92f0[_0x40ac('0x19')]?_0x4e92f0[_0x40ac('0x19')]['limit']||null:null})[_0x40ac('0xb')](function(_0x28c006){logger['info']('UpdateVoiceAgentReport',_0x4e92f0);logger[_0x40ac('0x1a')]('UpdateVoiceAgentReport',_0x4e92f0,JSON['stringify'](_0x28c006));_0x35a1ed(_0x28c006);})[_0x40ac('0x14')](function(_0x131eb2){logger[_0x40ac('0x10')](_0x40ac('0x1b'),_0x131eb2[_0x40ac('0x12')],_0x4e92f0);_0xcdfd10(_0x942aea[_0x40ac('0x10')](0x1f4,_0x131eb2[_0x40ac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7813f37..c50ff34 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 _0x9e08=['post','create','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x433d65,_0x5d119b){var _0x24799c=function(_0x1da4e8){while(--_0x1da4e8){_0x433d65['push'](_0x433d65['shift']());}};_0x24799c(++_0x5d119b);}(_0x9e08,0x126));var _0x89e0=function(_0x4d2a79,_0x4c7633){_0x4d2a79=_0x4d2a79-0x0;var _0x372fb6=_0x9e08[_0x4d2a79];return _0x372fb6;};'use strict';var multer=require(_0x89e0('0x0'));var util=require(_0x89e0('0x1'));var path=require(_0x89e0('0x2'));var timeout=require('connect-timeout');var express=require(_0x89e0('0x3'));var router=express[_0x89e0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x89e0('0x5'));var config=require(_0x89e0('0x6'));var controller=require(_0x89e0('0x7'));router[_0x89e0('0x8')]('/',auth[_0x89e0('0x9')](),controller[_0x89e0('0xa')]);router['get'](_0x89e0('0xb'),auth[_0x89e0('0x9')](),controller['describe']);router[_0x89e0('0x8')]('/:id',auth[_0x89e0('0x9')](),controller['show']);router[_0x89e0('0xc')]('/',auth[_0x89e0('0x9')](),controller[_0x89e0('0xd')]);router['put'](_0x89e0('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x89e0('0x9')](),controller[_0x89e0('0xf')]);module[_0x89e0('0x10')]=router; \ No newline at end of file +var _0xd6cd=['../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xdafc00,_0x2a6fce){var _0x3bc5be=function(_0x349b1d){while(--_0x349b1d){_0xdafc00['push'](_0xdafc00['shift']());}};_0x3bc5be(++_0x2a6fce);}(_0xd6cd,0x1ce));var _0xdd6c=function(_0x4c3cf6,_0x31c8ff){_0x4c3cf6=_0x4c3cf6-0x0;var _0x1ef47b=_0xd6cd[_0x4c3cf6];return _0x1ef47b;};'use strict';var multer=require(_0xdd6c('0x0'));var util=require('util');var path=require(_0xdd6c('0x1'));var timeout=require(_0xdd6c('0x2'));var express=require(_0xdd6c('0x3'));var router=express[_0xdd6c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdd6c('0x5'));var config=require(_0xdd6c('0x6'));var controller=require(_0xdd6c('0x7'));router[_0xdd6c('0x8')]('/',auth[_0xdd6c('0x9')](),controller['index']);router[_0xdd6c('0x8')](_0xdd6c('0xa'),auth['isAuthenticated'](),controller[_0xdd6c('0xb')]);router[_0xdd6c('0x8')]('/:id',auth[_0xdd6c('0x9')](),controller[_0xdd6c('0xc')]);router[_0xdd6c('0xd')]('/',auth[_0xdd6c('0x9')](),controller['create']);router[_0xdd6c('0xe')]('/:id',auth[_0xdd6c('0x9')](),controller[_0xdd6c('0xf')]);router[_0xdd6c('0x10')]('/:id',auth[_0xdd6c('0x9')](),controller[_0xdd6c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b861e40..bf6c276 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(_0x2db667,_0x4faeec){var _0x284a38=function(_0x120feb){while(--_0x120feb){_0x2db667['push'](_0x2db667['shift']());}};_0x284a38(++_0x4faeec);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x4f2540,_0x10e19b){var _0x151dd6=function(_0x57c8ec){while(--_0x57c8ec){_0x4f2540['push'](_0x4f2540['shift']());}};_0x151dd6(++_0x10e19b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 f2160bf..c9277db 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 _0x68cd=['alias','User','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','uniqueid','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceCallReport','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include'];(function(_0x54016e,_0x1cb63d){var _0x42cb4a=function(_0x260b56){while(--_0x260b56){_0x54016e['push'](_0x54016e['shift']());}};_0x42cb4a(++_0x1cb63d);}(_0x68cd,0x145));var _0xd68c=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0x68cd[_0x2a7210];return _0x460766;};'use strict';var pdf=require(_0xd68c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd68c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd68c('0x2'));var rp=require(_0xd68c('0x3'));var moment=require(_0xd68c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd68c('0x5'));var util=require('util');var path=require(_0xd68c('0x6'));var sox=require(_0xd68c('0x7'));var csv=require('to-csv');var ejs=require(_0xd68c('0x8'));var fs=require('fs');var _=require(_0xd68c('0x9'));var squel=require(_0xd68c('0xa'));var crypto=require(_0xd68c('0xb'));var jsforce=require(_0xd68c('0xc'));var deskjs=require(_0xd68c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd68c('0xe'));var Papa=require(_0xd68c('0xf'));var Redis=require(_0xd68c('0x10'));var authService=require(_0xd68c('0x11'));var qs=require(_0xd68c('0x12'));var as=require(_0xd68c('0x13'));var hardwareService=require(_0xd68c('0x14'));var logger=require(_0xd68c('0x15'))('api');var utils=require(_0xd68c('0x16'));var config=require(_0xd68c('0x17'));var db=require(_0xd68c('0x18'))['db'];function respondWithStatusCode(_0x3cbfdb,_0xc50a8d){_0xc50a8d=_0xc50a8d||0xcc;return function(_0x54d9d3){if(_0x54d9d3){return _0x3cbfdb[_0xd68c('0x19')](_0xc50a8d);}return _0x3cbfdb[_0xd68c('0x1a')](_0xc50a8d)[_0xd68c('0x1b')]();};}function respondWithResult(_0xab929,_0x2bbaa4){_0x2bbaa4=_0x2bbaa4||0xc8;return function(_0x12881c){if(_0x12881c){return _0xab929['status'](_0x2bbaa4)['json'](_0x12881c);}};}function respondWithFilteredResult(_0x3cf62d,_0x589018){return function(_0x19fa0a){if(_0x19fa0a){var _0x1c6731=_0x19fa0a['count'],_0x890f54=_0x589018['offset'],_0x274559=_0x589018[_0xd68c('0x1c')]+_0x589018[_0xd68c('0x1d')],_0x19185b;if(_0x274559>=_0x1c6731){_0x274559=_0x1c6731;_0x19185b=0xc8;}else{_0x19185b=0xce;}_0x3cf62d[_0xd68c('0x1a')](_0x19185b);return _0x3cf62d[_0xd68c('0x1e')](_0xd68c('0x1f'),_0x890f54+'-'+_0x274559+'/'+_0x1c6731)[_0xd68c('0x20')](_0x19fa0a);}return null;};}function patchUpdates(_0x26182b){return function(_0x461df9){try{jsonpatch[_0xd68c('0x21')](_0x461df9,_0x26182b,!![]);}catch(_0x452afc){return BPromise[_0xd68c('0x22')](_0x452afc);}return _0x461df9[_0xd68c('0x23')]();};}function saveUpdates(_0x19f2bf,_0x266d92){return function(_0x17c2fc){if(_0x17c2fc){return _0x17c2fc[_0xd68c('0x24')](_0x19f2bf)['then'](function(_0x38f10c){return _0x38f10c;});}return null;};}function removeEntity(_0x4c3931,_0x468242){return function(_0x3d279b){if(_0x3d279b){return _0x3d279b[_0xd68c('0x25')]()[_0xd68c('0x26')](function(){_0x4c3931[_0xd68c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc927d1,_0x66867b){return function(_0x4d5ea6){if(!_0x4d5ea6){_0xc927d1[_0xd68c('0x19')](0x194);}return _0x4d5ea6;};}function handleError(_0x3ed0d3,_0x188c3a){_0x188c3a=_0x188c3a||0x1f4;return function(_0x1f62ef){logger[_0xd68c('0x27')](_0x1f62ef[_0xd68c('0x28')]);if(_0x1f62ef[_0xd68c('0x29')]){delete _0x1f62ef[_0xd68c('0x29')];}_0x3ed0d3[_0xd68c('0x1a')](_0x188c3a)[_0xd68c('0x2a')](_0x1f62ef);};}exports[_0xd68c('0x2b')]=function(_0x332599,_0x5acad9){var _0x10929a={},_0x81e045={},_0x547ee2={'count':0x0,'rows':[]};var _0x1590bb=_[_0xd68c('0x2c')](db[_0xd68c('0x2d')]['rawAttributes'],function(_0x4b674e){return{'name':_0x4b674e['fieldName'],'type':_0x4b674e[_0xd68c('0x2e')]['key']};});_0x81e045[_0xd68c('0x2f')]=_[_0xd68c('0x2c')](_0x1590bb,_0xd68c('0x29'));_0x81e045[_0xd68c('0x30')]=_[_0xd68c('0x31')](_0x332599[_0xd68c('0x30')]);_0x81e045['filters']=_[_0xd68c('0x32')](_0x81e045['model'],_0x81e045[_0xd68c('0x30')]);_0x10929a['attributes']=_[_0xd68c('0x32')](_0x81e045[_0xd68c('0x2f')],qs['fields'](_0x332599[_0xd68c('0x30')][_0xd68c('0x33')]));_0x10929a['attributes']=_0x10929a[_0xd68c('0x34')][_0xd68c('0x35')]?_0x10929a[_0xd68c('0x34')]:_0x81e045[_0xd68c('0x2f')];if(!_0x332599[_0xd68c('0x30')][_0xd68c('0x36')](_0xd68c('0x37'))){_0x10929a[_0xd68c('0x1d')]=qs[_0xd68c('0x1d')](_0x332599['query'][_0xd68c('0x1d')]);_0x10929a[_0xd68c('0x1c')]=qs['offset'](_0x332599[_0xd68c('0x30')][_0xd68c('0x1c')]);}_0x10929a['order']=qs[_0xd68c('0x38')](_0x332599[_0xd68c('0x30')][_0xd68c('0x38')]);_0x10929a[_0xd68c('0x39')]=qs['filters'](_['pick'](_0x332599['query'],_0x81e045['filters']),_0x1590bb);if(_0x332599[_0xd68c('0x30')][_0xd68c('0x3a')]){_0x10929a[_0xd68c('0x39')]=_['merge'](_0x10929a[_0xd68c('0x39')],{'$or':_['map'](_0x1590bb,function(_0x55e59c){if(_0x55e59c[_0xd68c('0x2e')]!==_0xd68c('0x3b')){var _0x58c9f1={};_0x58c9f1[_0x55e59c[_0xd68c('0x29')]]={'$like':'%'+_0x332599[_0xd68c('0x30')]['filter']+'%'};return _0x58c9f1;}})});}_0x10929a=_[_0xd68c('0x3c')]({},_0x10929a,_0x332599[_0xd68c('0x3d')]);var _0x332cf3={'where':_0x10929a[_0xd68c('0x39')]};return db[_0xd68c('0x2d')][_0xd68c('0x3e')](_0x332cf3)[_0xd68c('0x26')](function(_0x3285f8){_0x547ee2[_0xd68c('0x3e')]=_0x3285f8;if(_0x332599[_0xd68c('0x30')][_0xd68c('0x3f')]){_0x10929a[_0xd68c('0x40')]=[{'attributes':['id',_0xd68c('0x29'),'fullname',_0xd68c('0x41')],'model':db[_0xd68c('0x42')],'as':_0xd68c('0x42')}];}return db['VoiceCallReport'][_0xd68c('0x43')](_0x10929a);})[_0xd68c('0x26')](function(_0x261910){_0x547ee2[_0xd68c('0x44')]=_0x261910;return _0x547ee2;})[_0xd68c('0x26')](respondWithFilteredResult(_0x5acad9,_0x10929a))['catch'](handleError(_0x5acad9,null));};exports[_0xd68c('0x45')]=function(_0x39749e,_0x570346){var _0x595fb1={'raw':!![],'where':{'id':_0x39749e[_0xd68c('0x46')]['id']}},_0x50f0d8={};_0x50f0d8['model']=_['keys'](db[_0xd68c('0x2d')][_0xd68c('0x47')]);_0x50f0d8[_0xd68c('0x30')]=_[_0xd68c('0x31')](_0x39749e['query']);_0x50f0d8['filters']=_[_0xd68c('0x32')](_0x50f0d8['model'],_0x50f0d8[_0xd68c('0x30')]);_0x595fb1[_0xd68c('0x34')]=_[_0xd68c('0x32')](_0x50f0d8[_0xd68c('0x2f')],qs['fields'](_0x39749e['query'][_0xd68c('0x33')]));_0x595fb1[_0xd68c('0x34')]=_0x595fb1['attributes'][_0xd68c('0x35')]?_0x595fb1['attributes']:_0x50f0d8[_0xd68c('0x2f')];if(_0x39749e[_0xd68c('0x30')][_0xd68c('0x3f')]){_0x595fb1[_0xd68c('0x40')]=[{'all':!![]}];}_0x595fb1=_[_0xd68c('0x3c')]({},_0x595fb1,_0x39749e['options']);return db[_0xd68c('0x2d')][_0xd68c('0x48')](_0x595fb1)['then'](handleEntityNotFound(_0x570346,null))['then'](respondWithResult(_0x570346,null))[_0xd68c('0x49')](handleError(_0x570346,null));};exports['create']=function(_0x24d8fe,_0xf5385d){return db[_0xd68c('0x2d')][_0xd68c('0x4a')](_0x24d8fe[_0xd68c('0x4b')],{})['then'](respondWithResult(_0xf5385d,0xc9))[_0xd68c('0x49')](handleError(_0xf5385d,null));};exports[_0xd68c('0x25')]=function(_0x47592c,_0x41b6ad){return db['VoiceCallReport'][_0xd68c('0x48')]({'where':{'id':_0x47592c[_0xd68c('0x46')]['id']}})[_0xd68c('0x26')](handleEntityNotFound(_0x41b6ad,null))['then'](removeEntity(_0x41b6ad,null))['catch'](handleError(_0x41b6ad,null));};exports['describe']=function(_0x3a38b8,_0x8a29e6){return db['VoiceCallReport'][_0xd68c('0x4c')]()[_0xd68c('0x26')](respondWithResult(_0x8a29e6,null))['catch'](handleError(_0x8a29e6,null));};exports[_0xd68c('0x24')]=function(_0x34d4a9,_0x103a60){if(_0x34d4a9[_0xd68c('0x4b')][_0xd68c('0x4d')]){delete _0x34d4a9['body']['uniqueid'];}return db['VoiceCallReport'][_0xd68c('0x48')]({'where':{'uniqueid':_0x34d4a9[_0xd68c('0x46')]['id'],'UserId':{'$or':[null,_0x34d4a9['user']['id']]}}})[_0xd68c('0x26')](handleEntityNotFound(_0x103a60,null))[_0xd68c('0x26')](saveUpdates(_0x34d4a9[_0xd68c('0x4b')],null))[_0xd68c('0x26')](respondWithResult(_0x103a60,null))[_0xd68c('0x49')](handleError(_0x103a60,null));}; \ No newline at end of file +var _0xd7d8=['where','pick','type','VIRTUAL','filter','merge','includeAll','include','User','findAll','rows','catch','show','options','find','create','params','body','uniqueid','user','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xd7d8,0x1e2));var _0x8d7d=function(_0x12af58,_0x5ebe31){_0x12af58=_0x12af58-0x0;var _0x517d57=_0xd7d8[_0x12af58];return _0x517d57;};'use strict';var pdf=require(_0x8d7d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d7d('0x1'));var zipdir=require(_0x8d7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d7d('0x3'));var moment=require('moment');var BPromise=require(_0x8d7d('0x4'));var Mustache=require(_0x8d7d('0x5'));var util=require(_0x8d7d('0x6'));var path=require(_0x8d7d('0x7'));var sox=require('sox');var csv=require(_0x8d7d('0x8'));var ejs=require(_0x8d7d('0x9'));var fs=require('fs');var _=require(_0x8d7d('0xa'));var squel=require(_0x8d7d('0xb'));var crypto=require(_0x8d7d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8d7d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d7d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8d7d('0xf'));var qs=require(_0x8d7d('0x10'));var as=require(_0x8d7d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d7d('0x12'))(_0x8d7d('0x13'));var utils=require(_0x8d7d('0x14'));var config=require('../../config/environment');var db=require(_0x8d7d('0x15'))['db'];function respondWithStatusCode(_0x902fdc,_0x340f96){_0x340f96=_0x340f96||0xcc;return function(_0x499360){if(_0x499360){return _0x902fdc[_0x8d7d('0x16')](_0x340f96);}return _0x902fdc[_0x8d7d('0x17')](_0x340f96)[_0x8d7d('0x18')]();};}function respondWithResult(_0xcb1f8e,_0x49b5ed){_0x49b5ed=_0x49b5ed||0xc8;return function(_0x26bbc5){if(_0x26bbc5){return _0xcb1f8e[_0x8d7d('0x17')](_0x49b5ed)['json'](_0x26bbc5);}};}function respondWithFilteredResult(_0x4ea323,_0x431dc1){return function(_0x18727f){if(_0x18727f){var _0x102174=_0x18727f[_0x8d7d('0x19')],_0x5d7e2d=_0x431dc1[_0x8d7d('0x1a')],_0x2183ff=_0x431dc1[_0x8d7d('0x1a')]+_0x431dc1[_0x8d7d('0x1b')],_0x3c643b;if(_0x2183ff>=_0x102174){_0x2183ff=_0x102174;_0x3c643b=0xc8;}else{_0x3c643b=0xce;}_0x4ea323[_0x8d7d('0x17')](_0x3c643b);return _0x4ea323[_0x8d7d('0x1c')](_0x8d7d('0x1d'),_0x5d7e2d+'-'+_0x2183ff+'/'+_0x102174)[_0x8d7d('0x1e')](_0x18727f);}return null;};}function patchUpdates(_0x8cf7f2){return function(_0x5c4e40){try{jsonpatch[_0x8d7d('0x1f')](_0x5c4e40,_0x8cf7f2,!![]);}catch(_0x26e31f){return BPromise[_0x8d7d('0x20')](_0x26e31f);}return _0x5c4e40[_0x8d7d('0x21')]();};}function saveUpdates(_0x59c590,_0x24b2ff){return function(_0x486ecc){if(_0x486ecc){return _0x486ecc[_0x8d7d('0x22')](_0x59c590)[_0x8d7d('0x23')](function(_0x47afcc){return _0x47afcc;});}return null;};}function removeEntity(_0x25e1e3,_0x190803){return function(_0x2a9ae7){if(_0x2a9ae7){return _0x2a9ae7[_0x8d7d('0x24')]()[_0x8d7d('0x23')](function(){_0x25e1e3[_0x8d7d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20c105,_0x7b618f){return function(_0x43cc0c){if(!_0x43cc0c){_0x20c105[_0x8d7d('0x16')](0x194);}return _0x43cc0c;};}function handleError(_0x3a898d,_0x5bf970){_0x5bf970=_0x5bf970||0x1f4;return function(_0x575c09){logger[_0x8d7d('0x25')](_0x575c09[_0x8d7d('0x26')]);if(_0x575c09['name']){delete _0x575c09[_0x8d7d('0x27')];}_0x3a898d['status'](_0x5bf970)[_0x8d7d('0x28')](_0x575c09);};}exports[_0x8d7d('0x29')]=function(_0x45bab8,_0x1cc7e0){var _0x1c123d={},_0x548c8d={},_0xc9501={'count':0x0,'rows':[]};var _0x42e092=_[_0x8d7d('0x2a')](db[_0x8d7d('0x2b')][_0x8d7d('0x2c')],function(_0x31ef19){return{'name':_0x31ef19['fieldName'],'type':_0x31ef19['type']['key']};});_0x548c8d[_0x8d7d('0x2d')]=_['map'](_0x42e092,_0x8d7d('0x27'));_0x548c8d[_0x8d7d('0x2e')]=_[_0x8d7d('0x2f')](_0x45bab8[_0x8d7d('0x2e')]);_0x548c8d[_0x8d7d('0x30')]=_[_0x8d7d('0x31')](_0x548c8d['model'],_0x548c8d['query']);_0x1c123d[_0x8d7d('0x32')]=_[_0x8d7d('0x31')](_0x548c8d[_0x8d7d('0x2d')],qs[_0x8d7d('0x33')](_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x33')]));_0x1c123d[_0x8d7d('0x32')]=_0x1c123d[_0x8d7d('0x32')][_0x8d7d('0x34')]?_0x1c123d[_0x8d7d('0x32')]:_0x548c8d['model'];if(!_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x35')](_0x8d7d('0x36'))){_0x1c123d[_0x8d7d('0x1b')]=qs[_0x8d7d('0x1b')](_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x1b')]);_0x1c123d[_0x8d7d('0x1a')]=qs[_0x8d7d('0x1a')](_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x1a')]);}_0x1c123d[_0x8d7d('0x37')]=qs[_0x8d7d('0x38')](_0x45bab8['query'][_0x8d7d('0x38')]);_0x1c123d[_0x8d7d('0x39')]=qs[_0x8d7d('0x30')](_[_0x8d7d('0x3a')](_0x45bab8[_0x8d7d('0x2e')],_0x548c8d[_0x8d7d('0x30')]),_0x42e092);if(_0x45bab8[_0x8d7d('0x2e')]['filter']){_0x1c123d[_0x8d7d('0x39')]=_['merge'](_0x1c123d[_0x8d7d('0x39')],{'$or':_[_0x8d7d('0x2a')](_0x42e092,function(_0x4b900c){if(_0x4b900c[_0x8d7d('0x3b')]!==_0x8d7d('0x3c')){var _0x196028={};_0x196028[_0x4b900c[_0x8d7d('0x27')]]={'$like':'%'+_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x3d')]+'%'};return _0x196028;}})});}_0x1c123d=_[_0x8d7d('0x3e')]({},_0x1c123d,_0x45bab8['options']);var _0x5ccd35={'where':_0x1c123d[_0x8d7d('0x39')]};return db[_0x8d7d('0x2b')][_0x8d7d('0x19')](_0x5ccd35)['then'](function(_0x510993){_0xc9501['count']=_0x510993;if(_0x45bab8[_0x8d7d('0x2e')][_0x8d7d('0x3f')]){_0x1c123d[_0x8d7d('0x40')]=[{'attributes':['id','name','fullname','alias'],'model':db[_0x8d7d('0x41')],'as':_0x8d7d('0x41')}];}return db[_0x8d7d('0x2b')][_0x8d7d('0x42')](_0x1c123d);})[_0x8d7d('0x23')](function(_0x19b72e){_0xc9501[_0x8d7d('0x43')]=_0x19b72e;return _0xc9501;})[_0x8d7d('0x23')](respondWithFilteredResult(_0x1cc7e0,_0x1c123d))[_0x8d7d('0x44')](handleError(_0x1cc7e0,null));};exports[_0x8d7d('0x45')]=function(_0x40326e,_0x2a3821){var _0x22e601={'raw':!![],'where':{'id':_0x40326e['params']['id']}},_0x925ddc={};_0x925ddc[_0x8d7d('0x2d')]=_[_0x8d7d('0x2f')](db[_0x8d7d('0x2b')][_0x8d7d('0x2c')]);_0x925ddc[_0x8d7d('0x2e')]=_['keys'](_0x40326e[_0x8d7d('0x2e')]);_0x925ddc[_0x8d7d('0x30')]=_[_0x8d7d('0x31')](_0x925ddc['model'],_0x925ddc[_0x8d7d('0x2e')]);_0x22e601[_0x8d7d('0x32')]=_[_0x8d7d('0x31')](_0x925ddc['model'],qs[_0x8d7d('0x33')](_0x40326e['query'][_0x8d7d('0x33')]));_0x22e601['attributes']=_0x22e601['attributes'][_0x8d7d('0x34')]?_0x22e601[_0x8d7d('0x32')]:_0x925ddc[_0x8d7d('0x2d')];if(_0x40326e[_0x8d7d('0x2e')][_0x8d7d('0x3f')]){_0x22e601[_0x8d7d('0x40')]=[{'all':!![]}];}_0x22e601=_[_0x8d7d('0x3e')]({},_0x22e601,_0x40326e[_0x8d7d('0x46')]);return db[_0x8d7d('0x2b')][_0x8d7d('0x47')](_0x22e601)['then'](handleEntityNotFound(_0x2a3821,null))[_0x8d7d('0x23')](respondWithResult(_0x2a3821,null))[_0x8d7d('0x44')](handleError(_0x2a3821,null));};exports[_0x8d7d('0x48')]=function(_0x180510,_0x24e5a8){return db[_0x8d7d('0x2b')][_0x8d7d('0x48')](_0x180510['body'],{})[_0x8d7d('0x23')](respondWithResult(_0x24e5a8,0xc9))['catch'](handleError(_0x24e5a8,null));};exports['destroy']=function(_0x36485e,_0x973604){return db['VoiceCallReport'][_0x8d7d('0x47')]({'where':{'id':_0x36485e[_0x8d7d('0x49')]['id']}})[_0x8d7d('0x23')](handleEntityNotFound(_0x973604,null))[_0x8d7d('0x23')](removeEntity(_0x973604,null))['catch'](handleError(_0x973604,null));};exports['describe']=function(_0x4439c9,_0x41a45f){return db[_0x8d7d('0x2b')]['describe']()[_0x8d7d('0x23')](respondWithResult(_0x41a45f,null))['catch'](handleError(_0x41a45f,null));};exports[_0x8d7d('0x22')]=function(_0xbe2b6f,_0x4f1f37){if(_0xbe2b6f[_0x8d7d('0x4a')][_0x8d7d('0x4b')]){delete _0xbe2b6f[_0x8d7d('0x4a')][_0x8d7d('0x4b')];}return db[_0x8d7d('0x2b')][_0x8d7d('0x47')]({'where':{'uniqueid':_0xbe2b6f[_0x8d7d('0x49')]['id'],'UserId':{'$or':[null,_0xbe2b6f[_0x8d7d('0x4c')]['id']]}}})[_0x8d7d('0x23')](handleEntityNotFound(_0x4f1f37,null))['then'](saveUpdates(_0xbe2b6f[_0x8d7d('0x4a')],null))[_0x8d7d('0x23')](respondWithResult(_0x4f1f37,null))['catch'](handleError(_0x4f1f37,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 793391a..8483e7a 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 _0x0136=['request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash','../../config/logger','bluebird'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x0136,0x18d));var _0x6013=function(_0x288055,_0x3125a5){_0x288055=_0x288055-0x0;var _0x491f0a=_0x0136[_0x288055];return _0x491f0a;};'use strict';var _=require(_0x6013('0x0'));var util=require('util');var logger=require(_0x6013('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6013('0x2'));var rp=require(_0x6013('0x3'));var fs=require('fs');var path=require(_0x6013('0x4'));var rimraf=require(_0x6013('0x5'));var config=require(_0x6013('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x6013('0x7')]=function(_0x206406,_0x208ec0){return _0x206406[_0x6013('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6013('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc96=['util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid'];(function(_0x164909,_0x1c1d15){var _0x4a7693=function(_0x26e8d1){while(--_0x26e8d1){_0x164909['push'](_0x164909['shift']());}};_0x4a7693(++_0x1c1d15);}(_0xcc96,0x134));var _0x6cc9=function(_0x2ef569,_0x424150){_0x2ef569=_0x2ef569-0x0;var _0x42f909=_0xcc96[_0x2ef569];return _0x42f909;};'use strict';var _=require('lodash');var util=require(_0x6cc9('0x0'));var logger=require('../../config/logger')(_0x6cc9('0x1'));var moment=require(_0x6cc9('0x2'));var BPromise=require(_0x6cc9('0x3'));var rp=require(_0x6cc9('0x4'));var fs=require('fs');var path=require(_0x6cc9('0x5'));var rimraf=require('rimraf');var config=require(_0x6cc9('0x6'));var attributes=require(_0x6cc9('0x7'));module[_0x6cc9('0x8')]=function(_0x154bbe,_0x3b3520){return _0x154bbe['define']('VoiceCallReport',attributes,{'tableName':_0x6cc9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6cc9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1f70838..0fa8706 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 _0x0daf=['then','info','debug','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','request\x20sent','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x474fdd,_0x295663){var _0x577ebc=function(_0x35f7ff){while(--_0x35f7ff){_0x474fdd['push'](_0x474fdd['shift']());}};_0x577ebc(++_0x295663);}(_0x0daf,0x116));var _0xf0da=function(_0x473a79,_0x5e608b){_0x473a79=_0x473a79-0x0;var _0x5a91b3=_0x0daf[_0x473a79];return _0x5a91b3;};'use strict';var _=require(_0xf0da('0x0'));var util=require(_0xf0da('0x1'));var moment=require('moment');var BPromise=require(_0xf0da('0x2'));var rs=require(_0xf0da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0da('0x4'))['db'];var utils=require(_0xf0da('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0da('0x6'));var jayson=require(_0xf0da('0x7'));var client=jayson['client'][_0xf0da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ae933,_0x5338e2,_0x3c5b9b){return new BPromise(function(_0x1e8b0e,_0x141343){return client[_0xf0da('0x9')](_0x2ae933,_0x3c5b9b)[_0xf0da('0xa')](function(_0x5e6bde){logger[_0xf0da('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x5338e2,'request\x20sent');logger[_0xf0da('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5338e2,'request\x20sent',JSON[_0xf0da('0xd')](_0x5e6bde));if(_0x5e6bde[_0xf0da('0xe')]){if(_0x5e6bde['error'][_0xf0da('0xf')]===0x1f4){logger[_0xf0da('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x5338e2,_0x5e6bde[_0xf0da('0xe')][_0xf0da('0x10')]);return _0x141343(_0x5e6bde[_0xf0da('0xe')][_0xf0da('0x10')]);}logger[_0xf0da('0xe')](_0xf0da('0x11'),_0x5338e2,_0x5e6bde[_0xf0da('0xe')][_0xf0da('0x10')]);return _0x1e8b0e(_0x5e6bde[_0xf0da('0xe')][_0xf0da('0x10')]);}else{logger[_0xf0da('0xb')](_0xf0da('0x11'),_0x5338e2,_0xf0da('0x12'));_0x1e8b0e(_0x5e6bde['result']['message']);}})[_0xf0da('0x13')](function(_0x1e0e7b){logger[_0xf0da('0xe')](_0xf0da('0x11'),_0x5338e2,_0x1e0e7b);_0x141343(_0x1e0e7b);});});}exports[_0xf0da('0x14')]=function(_0x1c3465){var _0x3f8f33=this;return new Promise(function(_0x189785,_0x36291d){return db[_0xf0da('0x15')][_0xf0da('0x16')]({'raw':_0x1c3465['options']?_0x1c3465[_0xf0da('0x17')][_0xf0da('0x18')]===undefined?!![]:![]:!![],'where':_0x1c3465[_0xf0da('0x17')]?_0x1c3465['options']['where']||null:null,'attributes':_0x1c3465[_0xf0da('0x17')]?_0x1c3465[_0xf0da('0x17')][_0xf0da('0x19')]||null:null,'limit':_0x1c3465[_0xf0da('0x17')]?_0x1c3465['options'][_0xf0da('0x1a')]||null:null,'include':_0x1c3465[_0xf0da('0x17')]?_0x1c3465[_0xf0da('0x17')][_0xf0da('0x1b')]?_[_0xf0da('0x1c')](_0x1c3465[_0xf0da('0x17')][_0xf0da('0x1b')],function(_0x136be6){return{'model':db[_0x136be6[_0xf0da('0x1d')]],'as':_0x136be6['as'],'attributes':_0x136be6[_0xf0da('0x19')],'include':_0x136be6[_0xf0da('0x1b')]?_[_0xf0da('0x1c')](_0x136be6[_0xf0da('0x1b')],function(_0x20b576){return{'model':db[_0x20b576[_0xf0da('0x1d')]],'as':_0x20b576['as'],'attributes':_0x20b576[_0xf0da('0x19')],'include':_0x20b576[_0xf0da('0x1b')]?_[_0xf0da('0x1c')](_0x20b576[_0xf0da('0x1b')],function(_0x5db823){return{'model':db[_0x5db823['model']],'as':_0x5db823['as'],'attributes':_0x5db823[_0xf0da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf0da('0xa')](function(_0x3c93d1){logger[_0xf0da('0xb')]('GetVoiceCallReport',_0x1c3465);logger[_0xf0da('0xc')](_0xf0da('0x14'),_0x1c3465,JSON[_0xf0da('0xd')](_0x3c93d1));_0x189785(_0x3c93d1);})[_0xf0da('0x13')](function(_0x172c28){logger[_0xf0da('0xe')]('GetVoiceCallReport',_0x172c28['message'],_0x1c3465);_0x36291d(_0x3f8f33[_0xf0da('0xe')](0x1f4,_0x172c28[_0xf0da('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x42a109){var _0x46fcb5=this;return new Promise(function(_0x22bb6c,_0x339366){return db[_0xf0da('0x15')][_0xf0da('0x1e')](_0x42a109[_0xf0da('0x1f')],{'raw':_0x42a109['options']?_0x42a109[_0xf0da('0x17')][_0xf0da('0x18')]===undefined?!![]:![]:!![]})[_0xf0da('0xa')](function(_0x31dcbb){logger[_0xf0da('0xb')]('CreateVoiceCallReport',_0x42a109);logger[_0xf0da('0xc')](_0xf0da('0x20'),_0x42a109,JSON[_0xf0da('0xd')](_0x31dcbb));_0x22bb6c(_0x31dcbb);})[_0xf0da('0x13')](function(_0x3793ad){logger[_0xf0da('0xe')]('CreateVoiceCallReport',_0x3793ad[_0xf0da('0x10')],_0x42a109);_0x339366(_0x46fcb5[_0xf0da('0xe')](0x1f4,_0x3793ad['message']));});});};exports[_0xf0da('0x21')]=function(_0x113955){var _0x239493=this;return new Promise(function(_0x3a8966,_0x3acbb8){return db['VoiceCallReport'][_0xf0da('0x22')](_0x113955['body'],{'raw':_0x113955['options']?_0x113955['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x113955[_0xf0da('0x17')]?_0x113955[_0xf0da('0x17')][_0xf0da('0x23')]||null:null,'attributes':_0x113955[_0xf0da('0x17')]?_0x113955[_0xf0da('0x17')][_0xf0da('0x19')]||null:null,'limit':_0x113955[_0xf0da('0x17')]?_0x113955[_0xf0da('0x17')]['limit']||null:null})[_0xf0da('0xa')](function(_0x530923){logger[_0xf0da('0xb')]('UpdateVoiceCallReport',_0x113955);logger[_0xf0da('0xc')](_0xf0da('0x21'),_0x113955,JSON[_0xf0da('0xd')](_0x530923));_0x3a8966(_0x530923);})[_0xf0da('0x13')](function(_0x46d1d3){logger[_0xf0da('0xe')]('UpdateVoiceCallReport',_0x46d1d3['message'],_0x113955);_0x3acbb8(_0x239493[_0xf0da('0xe')](0x1f4,_0x46d1d3[_0xf0da('0x10')]));});});}; \ No newline at end of file +var _0xa906=['jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','include','map','model','then','CreateVoiceCallReport','VoiceCallReport','info','update','where','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x38ce0a,_0x35ffa3){var _0x51f631=function(_0x4c1b49){while(--_0x4c1b49){_0x38ce0a['push'](_0x38ce0a['shift']());}};_0x51f631(++_0x35ffa3);}(_0xa906,0x88));var _0x6a90=function(_0x356fb3,_0x1660db){_0x356fb3=_0x356fb3-0x0;var _0x26b7b0=_0xa906[_0x356fb3];return _0x26b7b0;};'use strict';var _=require(_0x6a90('0x0'));var util=require(_0x6a90('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a90('0x2'));var fs=require('fs');var Redis=require(_0x6a90('0x3'));var db=require(_0x6a90('0x4'))['db'];var utils=require(_0x6a90('0x5'));var logger=require(_0x6a90('0x6'))('rpc');var config=require(_0x6a90('0x7'));var jayson=require(_0x6a90('0x8'));var client=jayson[_0x6a90('0x9')][_0x6a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e80fe,_0x1a710f,_0x31756e){return new BPromise(function(_0x2aba13,_0x18d159){return client[_0x6a90('0xb')](_0x5e80fe,_0x31756e)['then'](function(_0x169fb9){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1a710f,_0x6a90('0xc'));logger[_0x6a90('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1a710f,_0x6a90('0xc'),JSON[_0x6a90('0xe')](_0x169fb9));if(_0x169fb9[_0x6a90('0xf')]){if(_0x169fb9[_0x6a90('0xf')][_0x6a90('0x10')]===0x1f4){logger['error'](_0x6a90('0x11'),_0x1a710f,_0x169fb9[_0x6a90('0xf')][_0x6a90('0x12')]);return _0x18d159(_0x169fb9['error']['message']);}logger[_0x6a90('0xf')](_0x6a90('0x11'),_0x1a710f,_0x169fb9[_0x6a90('0xf')]['message']);return _0x2aba13(_0x169fb9[_0x6a90('0xf')][_0x6a90('0x12')]);}else{logger['info'](_0x6a90('0x11'),_0x1a710f,_0x6a90('0xc'));_0x2aba13(_0x169fb9[_0x6a90('0x13')][_0x6a90('0x12')]);}})[_0x6a90('0x14')](function(_0xf69a79){logger['error'](_0x6a90('0x11'),_0x1a710f,_0xf69a79);_0x18d159(_0xf69a79);});});}exports[_0x6a90('0x15')]=function(_0x3e7f17){var _0xd87d1d=this;return new Promise(function(_0x4c50ef,_0x5691a8){return db['VoiceCallReport'][_0x6a90('0x16')]({'raw':_0x3e7f17[_0x6a90('0x17')]?_0x3e7f17[_0x6a90('0x17')][_0x6a90('0x18')]===undefined?!![]:![]:!![],'where':_0x3e7f17[_0x6a90('0x17')]?_0x3e7f17[_0x6a90('0x17')]['where']||null:null,'attributes':_0x3e7f17['options']?_0x3e7f17[_0x6a90('0x17')][_0x6a90('0x19')]||null:null,'limit':_0x3e7f17[_0x6a90('0x17')]?_0x3e7f17[_0x6a90('0x17')]['limit']||null:null,'include':_0x3e7f17[_0x6a90('0x17')]?_0x3e7f17[_0x6a90('0x17')][_0x6a90('0x1a')]?_[_0x6a90('0x1b')](_0x3e7f17[_0x6a90('0x17')][_0x6a90('0x1a')],function(_0x4399f0){return{'model':db[_0x4399f0[_0x6a90('0x1c')]],'as':_0x4399f0['as'],'attributes':_0x4399f0[_0x6a90('0x19')],'include':_0x4399f0['include']?_[_0x6a90('0x1b')](_0x4399f0[_0x6a90('0x1a')],function(_0x362924){return{'model':db[_0x362924[_0x6a90('0x1c')]],'as':_0x362924['as'],'attributes':_0x362924[_0x6a90('0x19')],'include':_0x362924[_0x6a90('0x1a')]?_[_0x6a90('0x1b')](_0x362924[_0x6a90('0x1a')],function(_0x2ed1c4){return{'model':db[_0x2ed1c4[_0x6a90('0x1c')]],'as':_0x2ed1c4['as'],'attributes':_0x2ed1c4[_0x6a90('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6a90('0x1d')](function(_0x119b55){logger['info'](_0x6a90('0x15'),_0x3e7f17);logger[_0x6a90('0xd')](_0x6a90('0x15'),_0x3e7f17,JSON[_0x6a90('0xe')](_0x119b55));_0x4c50ef(_0x119b55);})[_0x6a90('0x14')](function(_0x224ca7){logger[_0x6a90('0xf')](_0x6a90('0x15'),_0x224ca7['message'],_0x3e7f17);_0x5691a8(_0xd87d1d[_0x6a90('0xf')](0x1f4,_0x224ca7[_0x6a90('0x12')]));});});};exports[_0x6a90('0x1e')]=function(_0x12209b){var _0x575097=this;return new Promise(function(_0x2b1e95,_0x4ad961){return db[_0x6a90('0x1f')]['create'](_0x12209b['body'],{'raw':_0x12209b[_0x6a90('0x17')]?_0x12209b['options'][_0x6a90('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5541b3){logger[_0x6a90('0x20')](_0x6a90('0x1e'),_0x12209b);logger[_0x6a90('0xd')](_0x6a90('0x1e'),_0x12209b,JSON[_0x6a90('0xe')](_0x5541b3));_0x2b1e95(_0x5541b3);})[_0x6a90('0x14')](function(_0x2388ec){logger[_0x6a90('0xf')](_0x6a90('0x1e'),_0x2388ec[_0x6a90('0x12')],_0x12209b);_0x4ad961(_0x575097[_0x6a90('0xf')](0x1f4,_0x2388ec['message']));});});};exports['UpdateVoiceCallReport']=function(_0x193e70){var _0x5a6590=this;return new Promise(function(_0x4acba3,_0x4235b2){return db[_0x6a90('0x1f')][_0x6a90('0x21')](_0x193e70['body'],{'raw':_0x193e70['options']?_0x193e70['options'][_0x6a90('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x193e70[_0x6a90('0x17')]?_0x193e70[_0x6a90('0x17')][_0x6a90('0x22')]||null:null,'attributes':_0x193e70[_0x6a90('0x17')]?_0x193e70[_0x6a90('0x17')][_0x6a90('0x19')]||null:null,'limit':_0x193e70[_0x6a90('0x17')]?_0x193e70['options']['limit']||null:null})[_0x6a90('0x1d')](function(_0x53354c){logger[_0x6a90('0x20')](_0x6a90('0x23'),_0x193e70);logger[_0x6a90('0xd')](_0x6a90('0x23'),_0x193e70,JSON[_0x6a90('0xe')](_0x53354c));_0x4acba3(_0x53354c);})[_0x6a90('0x14')](function(_0x461f55){logger[_0x6a90('0xf')](_0x6a90('0x23'),_0x461f55[_0x6a90('0x12')],_0x193e70);_0x4235b2(_0x5a6590[_0x6a90('0xf')](0x1f4,_0x461f55[_0x6a90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f90684e..5ea6f1d 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 _0x2f70=['put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x3889ae,_0x4770c3){var _0x6533dd=function(_0x4275f7){while(--_0x4275f7){_0x3889ae['push'](_0x3889ae['shift']());}};_0x6533dd(++_0x4770c3);}(_0x2f70,0xb8));var _0x02f7=function(_0x4ebff3,_0x327a1a){_0x4ebff3=_0x4ebff3-0x0;var _0x1b419d=_0x2f70[_0x4ebff3];return _0x1b419d;};'use strict';var multer=require(_0x02f7('0x0'));var util=require(_0x02f7('0x1'));var path=require(_0x02f7('0x2'));var timeout=require(_0x02f7('0x3'));var express=require(_0x02f7('0x4'));var router=express['Router']();var auth=require(_0x02f7('0x5'));var interaction=require(_0x02f7('0x6'));var config=require(_0x02f7('0x7'));var controller=require(_0x02f7('0x8'));router[_0x02f7('0x9')]('/',auth['isAuthenticated'](),controller[_0x02f7('0xa')]);router[_0x02f7('0x9')](_0x02f7('0xb'),auth[_0x02f7('0xc')](),controller[_0x02f7('0xd')]);router[_0x02f7('0xe')]('/',auth[_0x02f7('0xc')](),controller[_0x02f7('0xf')]);router[_0x02f7('0x10')]('/:id',auth[_0x02f7('0xc')](),controller[_0x02f7('0x11')]);router['delete'](_0x02f7('0xb'),auth[_0x02f7('0xc')](),controller[_0x02f7('0x12')]);module[_0x02f7('0x13')]=router; \ No newline at end of file +var _0x8a01=['isAuthenticated','index','/:id','show','post','create','put','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8a01,0x198));var _0x18a0=function(_0x13d878,_0x3ac33){_0x13d878=_0x13d878-0x0;var _0x4f9280=_0x8a01[_0x13d878];return _0x4f9280;};'use strict';var multer=require('multer');var util=require(_0x18a0('0x0'));var path=require(_0x18a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x18a0('0x2'));var router=express[_0x18a0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x18a0('0x4'));var config=require(_0x18a0('0x5'));var controller=require(_0x18a0('0x6'));router[_0x18a0('0x7')]('/',auth[_0x18a0('0x8')](),controller[_0x18a0('0x9')]);router[_0x18a0('0x7')](_0x18a0('0xa'),auth[_0x18a0('0x8')](),controller[_0x18a0('0xb')]);router[_0x18a0('0xc')]('/',auth['isAuthenticated'](),controller[_0x18a0('0xd')]);router[_0x18a0('0xe')](_0x18a0('0xa'),auth[_0x18a0('0x8')](),controller['update']);router['delete'](_0x18a0('0xa'),auth[_0x18a0('0x8')](),controller['destroy']);module[_0x18a0('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0d35a52..c0fe86d 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 _0xb243=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x1ace8b,_0x3066f3){var _0xd6971f=function(_0x1faa5e){while(--_0x1faa5e){_0x1ace8b['push'](_0x1ace8b['shift']());}};_0xd6971f(++_0x3066f3);}(_0xb243,0x1f0));var _0x3b24=function(_0x3c80d5,_0x334a71){_0x3c80d5=_0x3c80d5-0x0;var _0x282826=_0xb243[_0x3c80d5];return _0x282826;};'use strict';var Sequelize=require(_0x3b24('0x0'));module[_0x3b24('0x1')]={'name':{'type':Sequelize[_0x3b24('0x2')]},'prefix':{'type':Sequelize[_0x3b24('0x2')],'unique':_0x3b24('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x3b24('0x2')],'set':function(_0x506f9c){this[_0x3b24('0x4')](_0x3b24('0x5'),_0x506f9c?_0x506f9c['join'](''):[]);},'get':function(){return this[_0x3b24('0x6')](_0x3b24('0x5'))?this[_0x3b24('0x6')](_0x3b24('0x5'))[_0x3b24('0x7')](''):[];}},'auth':{'type':Sequelize[_0x3b24('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x3b24('0x2')]},'record':{'type':Sequelize[_0x3b24('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3b24('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa688=['BOOLEAN','exports','STRING','name','setDataValue','options','getDataValue','split'];(function(_0x1ece00,_0x29e271){var _0x3019aa=function(_0x4d73d3){while(--_0x4d73d3){_0x1ece00['push'](_0x1ece00['shift']());}};_0x3019aa(++_0x29e271);}(_0xa688,0x1a1));var _0x8a68=function(_0x12fc36,_0x6530d3){_0x12fc36=_0x12fc36-0x0;var _0x55c667=_0xa688[_0x12fc36];return _0x55c667;};'use strict';var Sequelize=require('sequelize');module[_0x8a68('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8a68('0x1')],'unique':_0x8a68('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8a68('0x1')],'set':function(_0x3f4484){this[_0x8a68('0x3')](_0x8a68('0x4'),_0x3f4484?_0x3f4484['join'](''):[]);},'get':function(){return this[_0x8a68('0x5')](_0x8a68('0x4'))?this[_0x8a68('0x5')](_0x8a68('0x4'))[_0x8a68('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8a68('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8a68('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8a68('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 95e4a5f..05d127e 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 _0x6714=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','VoiceChanSpy','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','length','create','body','user','ChanSpies','find','userProfileId','autoAssociation','error','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring'];(function(_0x4e9344,_0x197622){var _0x1ea8e9=function(_0x4f8a59){while(--_0x4f8a59){_0x4e9344['push'](_0x4e9344['shift']());}};_0x1ea8e9(++_0x197622);}(_0x6714,0x1ae));var _0x4671=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x6714[_0x9dfc10];return _0x4f938a;};'use strict';var pdf=require(_0x4671('0x0'));var emlformat=require(_0x4671('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4671('0x2'));var jsonpatch=require(_0x4671('0x3'));var rp=require(_0x4671('0x4'));var moment=require(_0x4671('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4671('0x6'));var util=require(_0x4671('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4671('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4671('0x9'));var squel=require(_0x4671('0xa'));var crypto=require(_0x4671('0xb'));var jsforce=require(_0x4671('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4671('0xd'));var Papa=require('papaparse');var Redis=require(_0x4671('0xe'));var authService=require(_0x4671('0xf'));var qs=require(_0x4671('0x10'));var as=require(_0x4671('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4671('0x12'));var utils=require(_0x4671('0x13'));var config=require(_0x4671('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec376,_0x27148a){_0x27148a=_0x27148a||0xcc;return function(_0x34b294){if(_0x34b294){return _0x5ec376[_0x4671('0x15')](_0x27148a);}return _0x5ec376[_0x4671('0x16')](_0x27148a)[_0x4671('0x17')]();};}function respondWithResult(_0x3bcee5,_0x4a9013){_0x4a9013=_0x4a9013||0xc8;return function(_0x4f7a44){if(_0x4f7a44){return _0x3bcee5[_0x4671('0x16')](_0x4a9013)[_0x4671('0x18')](_0x4f7a44);}};}function respondWithFilteredResult(_0x53e3e8,_0x2d0f66){return function(_0x17ee70){if(_0x17ee70){var _0x4c0ed1=_0x17ee70[_0x4671('0x19')],_0x503496=_0x2d0f66['offset'],_0x56f789=_0x2d0f66[_0x4671('0x1a')]+_0x2d0f66['limit'],_0x5cfa42;if(_0x56f789>=_0x4c0ed1){_0x56f789=_0x4c0ed1;_0x5cfa42=0xc8;}else{_0x5cfa42=0xce;}_0x53e3e8[_0x4671('0x16')](_0x5cfa42);return _0x53e3e8[_0x4671('0x1b')](_0x4671('0x1c'),_0x503496+'-'+_0x56f789+'/'+_0x4c0ed1)['json'](_0x17ee70);}return null;};}function patchUpdates(_0x372bf8){return function(_0x57bd9f){try{jsonpatch[_0x4671('0x1d')](_0x57bd9f,_0x372bf8,!![]);}catch(_0x2aeda6){return BPromise['reject'](_0x2aeda6);}return _0x57bd9f[_0x4671('0x1e')]();};}function saveUpdates(_0x2618dc,_0x34e891){return function(_0x197d2e){if(_0x197d2e){return _0x197d2e[_0x4671('0x1f')](_0x2618dc)[_0x4671('0x20')](function(_0x5bbd34){return _0x5bbd34;});}return null;};}function removeEntity(_0x59d4b2,_0x3ac2e8){return function(_0x537630){if(_0x537630){return _0x537630['destroy']()[_0x4671('0x20')](function(){var _0x177736=_0x537630[_0x4671('0x21')]({'plain':!![]});var _0x5e6a33='ChanSpies';return db[_0x4671('0x22')][_0x4671('0x23')]({'where':{'type':_0x5e6a33,'resourceId':_0x177736['id']}})[_0x4671('0x20')](function(){return _0x537630;});})[_0x4671('0x20')](function(){_0x59d4b2['status'](0xcc)[_0x4671('0x17')]();});}};}function handleEntityNotFound(_0x1d62c1,_0x414a37){return function(_0x5b7a50){if(!_0x5b7a50){_0x1d62c1['sendStatus'](0x194);}return _0x5b7a50;};}function handleError(_0x5b74e2,_0x4b0d2b){_0x4b0d2b=_0x4b0d2b||0x1f4;return function(_0x2c92cf){logger['error'](_0x2c92cf[_0x4671('0x24')]);if(_0x2c92cf[_0x4671('0x25')]){delete _0x2c92cf['name'];}_0x5b74e2['status'](_0x4b0d2b)[_0x4671('0x26')](_0x2c92cf);};}exports[_0x4671('0x27')]=function(_0x3c8b51,_0x60460f){var _0x49d868={},_0x484783={},_0x2f7f5b={'count':0x0,'rows':[]};var _0x1b2795=_[_0x4671('0x28')](db[_0x4671('0x29')]['rawAttributes'],function(_0x440c20){return{'name':_0x440c20['fieldName'],'type':_0x440c20[_0x4671('0x2a')][_0x4671('0x2b')]};});_0x484783['model']=_['map'](_0x1b2795,_0x4671('0x25'));_0x484783[_0x4671('0x2c')]=_[_0x4671('0x2d')](_0x3c8b51[_0x4671('0x2c')]);_0x484783['filters']=_[_0x4671('0x2e')](_0x484783[_0x4671('0x2f')],_0x484783[_0x4671('0x2c')]);_0x49d868[_0x4671('0x30')]=_[_0x4671('0x2e')](_0x484783['model'],qs[_0x4671('0x31')](_0x3c8b51[_0x4671('0x2c')][_0x4671('0x31')]));_0x49d868[_0x4671('0x30')]=_0x49d868[_0x4671('0x30')]['length']?_0x49d868[_0x4671('0x30')]:_0x484783[_0x4671('0x2f')];if(!_0x3c8b51[_0x4671('0x2c')][_0x4671('0x32')]('nolimit')){_0x49d868[_0x4671('0x33')]=qs['limit'](_0x3c8b51[_0x4671('0x2c')][_0x4671('0x33')]);_0x49d868[_0x4671('0x1a')]=qs[_0x4671('0x1a')](_0x3c8b51[_0x4671('0x2c')][_0x4671('0x1a')]);}_0x49d868[_0x4671('0x34')]=qs[_0x4671('0x35')](_0x3c8b51[_0x4671('0x2c')][_0x4671('0x35')]);_0x49d868[_0x4671('0x36')]=qs['filters'](_['pick'](_0x3c8b51[_0x4671('0x2c')],_0x484783[_0x4671('0x37')]),_0x1b2795);if(_0x3c8b51[_0x4671('0x2c')][_0x4671('0x38')]){_0x49d868[_0x4671('0x36')]=_[_0x4671('0x39')](_0x49d868[_0x4671('0x36')],{'$or':_[_0x4671('0x28')](_0x1b2795,function(_0x269960){if(_0x269960[_0x4671('0x2a')]!==_0x4671('0x3a')){var _0x1c158f={};_0x1c158f[_0x269960[_0x4671('0x25')]]={'$like':'%'+_0x3c8b51['query'][_0x4671('0x38')]+'%'};return _0x1c158f;}})});}_0x49d868=_[_0x4671('0x39')]({},_0x49d868,_0x3c8b51[_0x4671('0x3b')]);var _0x2f67b5={'where':_0x49d868['where']};return db[_0x4671('0x29')][_0x4671('0x19')](_0x2f67b5)[_0x4671('0x20')](function(_0x268ec6){_0x2f7f5b[_0x4671('0x19')]=_0x268ec6;if(_0x3c8b51['query'][_0x4671('0x3c')]){_0x49d868[_0x4671('0x3d')]=[{'all':!![]}];}return db[_0x4671('0x29')][_0x4671('0x3e')](_0x49d868);})[_0x4671('0x20')](function(_0x437122){_0x2f7f5b['rows']=_0x437122;return _0x2f7f5b;})[_0x4671('0x20')](respondWithFilteredResult(_0x60460f,_0x49d868))[_0x4671('0x3f')](handleError(_0x60460f,null));};exports['show']=function(_0x5c80ea,_0x39133e){var _0x5546a3={'raw':![],'where':{'id':_0x5c80ea['params']['id']}},_0x283658={};_0x283658[_0x4671('0x2f')]=_['keys'](db[_0x4671('0x29')]['rawAttributes']);_0x283658[_0x4671('0x2c')]=_[_0x4671('0x2d')](_0x5c80ea[_0x4671('0x2c')]);_0x283658['filters']=_[_0x4671('0x2e')](_0x283658[_0x4671('0x2f')],_0x283658[_0x4671('0x2c')]);_0x5546a3[_0x4671('0x30')]=_[_0x4671('0x2e')](_0x283658[_0x4671('0x2f')],qs[_0x4671('0x31')](_0x5c80ea[_0x4671('0x2c')]['fields']));_0x5546a3[_0x4671('0x30')]=_0x5546a3[_0x4671('0x30')][_0x4671('0x40')]?_0x5546a3['attributes']:_0x283658[_0x4671('0x2f')];if(_0x5c80ea[_0x4671('0x2c')][_0x4671('0x3c')]){_0x5546a3['include']=[{'all':!![]}];}_0x5546a3=_[_0x4671('0x39')]({},_0x5546a3,_0x5c80ea[_0x4671('0x3b')]);return db[_0x4671('0x29')]['find'](_0x5546a3)['then'](handleEntityNotFound(_0x39133e,null))['then'](respondWithResult(_0x39133e,null))[_0x4671('0x3f')](handleError(_0x39133e,null));};exports[_0x4671('0x41')]=function(_0x2443d7,_0x36154f){return db['VoiceChanSpy'][_0x4671('0x41')](_0x2443d7[_0x4671('0x42')],{})[_0x4671('0x20')](function(_0x4b4c5d){var _0x271250=_0x2443d7[_0x4671('0x43')][_0x4671('0x21')]({'plain':!![]});if(!_0x271250)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x271250['role']===_0x4671('0x43')){var _0x21f507=_0x4b4c5d[_0x4671('0x21')]({'plain':!![]});var _0x1e0068=_0x4671('0x44');return db['UserProfileSection'][_0x4671('0x45')]({'where':{'name':_0x1e0068,'userProfileId':_0x271250[_0x4671('0x46')]},'raw':!![]})[_0x4671('0x20')](function(_0x246019){if(_0x246019&&_0x246019[_0x4671('0x47')]===0x0){return db[_0x4671('0x22')][_0x4671('0x41')]({'name':_0x21f507['name'],'resourceId':_0x21f507['id'],'type':_0x246019['name'],'sectionId':_0x246019['id']},{})[_0x4671('0x20')](function(){return _0x4b4c5d;});}else{return _0x4b4c5d;}})[_0x4671('0x3f')](function(_0x22b2ee){logger[_0x4671('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22b2ee);throw _0x22b2ee;});}return _0x4b4c5d;})[_0x4671('0x20')](respondWithResult(_0x36154f,0xc9))['catch'](handleError(_0x36154f,null));};exports[_0x4671('0x1f')]=function(_0x5c661e,_0x12f981){if(_0x5c661e[_0x4671('0x42')]['id']){delete _0x5c661e['body']['id'];}return db[_0x4671('0x29')][_0x4671('0x45')]({'where':{'id':_0x5c661e['params']['id']}})[_0x4671('0x20')](handleEntityNotFound(_0x12f981,null))[_0x4671('0x20')](saveUpdates(_0x5c661e[_0x4671('0x42')],null))[_0x4671('0x20')](respondWithResult(_0x12f981,null))[_0x4671('0x3f')](handleError(_0x12f981,null));};exports[_0x4671('0x23')]=function(_0x4ef1cf,_0x40b9f7){return db[_0x4671('0x29')]['find']({'where':{'id':_0x4ef1cf[_0x4671('0x49')]['id']}})[_0x4671('0x20')](handleEntityNotFound(_0x40b9f7,null))[_0x4671('0x20')](removeEntity(_0x40b9f7,null))['catch'](handleError(_0x40b9f7,null));}; \ No newline at end of file +var _0x2a3f=['show','params','create','body','role','user','find','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','get','ChanSpies','stack','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','name','merge','options','VoiceChanSpy','includeAll','include','findAll','rows','catch'];(function(_0x386719,_0x257fdf){var _0x552797=function(_0x43927f){while(--_0x43927f){_0x386719['push'](_0x386719['shift']());}};_0x552797(++_0x257fdf);}(_0x2a3f,0xac));var _0xf2a3=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x2a3f[_0x3b96cf];return _0x2e315a;};'use strict';var pdf=require(_0xf2a3('0x0'));var emlformat=require(_0xf2a3('0x1'));var rimraf=require(_0xf2a3('0x2'));var zipdir=require(_0xf2a3('0x3'));var jsonpatch=require(_0xf2a3('0x4'));var rp=require(_0xf2a3('0x5'));var moment=require(_0xf2a3('0x6'));var BPromise=require(_0xf2a3('0x7'));var Mustache=require(_0xf2a3('0x8'));var util=require(_0xf2a3('0x9'));var path=require(_0xf2a3('0xa'));var sox=require(_0xf2a3('0xb'));var csv=require(_0xf2a3('0xc'));var ejs=require(_0xf2a3('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf2a3('0xe'));var crypto=require(_0xf2a3('0xf'));var jsforce=require(_0xf2a3('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf2a3('0x11'));var Papa=require(_0xf2a3('0x12'));var Redis=require(_0xf2a3('0x13'));var authService=require(_0xf2a3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf2a3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2a3('0x16'))(_0xf2a3('0x17'));var utils=require(_0xf2a3('0x18'));var config=require('../../config/environment');var db=require(_0xf2a3('0x19'))['db'];function respondWithStatusCode(_0x3a5adc,_0x1dd907){_0x1dd907=_0x1dd907||0xcc;return function(_0x2e7153){if(_0x2e7153){return _0x3a5adc[_0xf2a3('0x1a')](_0x1dd907);}return _0x3a5adc[_0xf2a3('0x1b')](_0x1dd907)[_0xf2a3('0x1c')]();};}function respondWithResult(_0x4bbd6a,_0x3a6b08){_0x3a6b08=_0x3a6b08||0xc8;return function(_0xfe5df8){if(_0xfe5df8){return _0x4bbd6a['status'](_0x3a6b08)[_0xf2a3('0x1d')](_0xfe5df8);}};}function respondWithFilteredResult(_0x3377cf,_0x85ada){return function(_0x48d1a3){if(_0x48d1a3){var _0x5d5510=_0x48d1a3[_0xf2a3('0x1e')],_0x684562=_0x85ada[_0xf2a3('0x1f')],_0x47d472=_0x85ada['offset']+_0x85ada[_0xf2a3('0x20')],_0xab9e5d;if(_0x47d472>=_0x5d5510){_0x47d472=_0x5d5510;_0xab9e5d=0xc8;}else{_0xab9e5d=0xce;}_0x3377cf[_0xf2a3('0x1b')](_0xab9e5d);return _0x3377cf[_0xf2a3('0x21')]('Content-Range',_0x684562+'-'+_0x47d472+'/'+_0x5d5510)[_0xf2a3('0x1d')](_0x48d1a3);}return null;};}function patchUpdates(_0x4ef0e5){return function(_0x2a3f26){try{jsonpatch[_0xf2a3('0x22')](_0x2a3f26,_0x4ef0e5,!![]);}catch(_0x54ca29){return BPromise[_0xf2a3('0x23')](_0x54ca29);}return _0x2a3f26['save']();};}function saveUpdates(_0x5557dc,_0x425be3){return function(_0x5af91e){if(_0x5af91e){return _0x5af91e['update'](_0x5557dc)[_0xf2a3('0x24')](function(_0x1244c3){return _0x1244c3;});}return null;};}function removeEntity(_0x2edff0,_0x38d158){return function(_0x2491f5){if(_0x2491f5){return _0x2491f5[_0xf2a3('0x25')]()[_0xf2a3('0x24')](function(){var _0x242176=_0x2491f5[_0xf2a3('0x26')]({'plain':!![]});var _0x133436=_0xf2a3('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x133436,'resourceId':_0x242176['id']}})[_0xf2a3('0x24')](function(){return _0x2491f5;});})[_0xf2a3('0x24')](function(){_0x2edff0[_0xf2a3('0x1b')](0xcc)[_0xf2a3('0x1c')]();});}};}function handleEntityNotFound(_0x199db4,_0x1f4961){return function(_0x52b8a7){if(!_0x52b8a7){_0x199db4[_0xf2a3('0x1a')](0x194);}return _0x52b8a7;};}function handleError(_0xbb3651,_0x4d3a01){_0x4d3a01=_0x4d3a01||0x1f4;return function(_0x381695){logger['error'](_0x381695[_0xf2a3('0x28')]);if(_0x381695['name']){delete _0x381695['name'];}_0xbb3651[_0xf2a3('0x1b')](_0x4d3a01)[_0xf2a3('0x29')](_0x381695);};}exports[_0xf2a3('0x2a')]=function(_0x34f78c,_0x315b2a){var _0x5168e1={},_0x53afa4={},_0x301034={'count':0x0,'rows':[]};var _0xefbfd8=_[_0xf2a3('0x2b')](db['VoiceChanSpy'][_0xf2a3('0x2c')],function(_0x5b9af6){return{'name':_0x5b9af6['fieldName'],'type':_0x5b9af6[_0xf2a3('0x2d')][_0xf2a3('0x2e')]};});_0x53afa4['model']=_[_0xf2a3('0x2b')](_0xefbfd8,'name');_0x53afa4[_0xf2a3('0x2f')]=_[_0xf2a3('0x30')](_0x34f78c['query']);_0x53afa4[_0xf2a3('0x31')]=_['intersection'](_0x53afa4[_0xf2a3('0x32')],_0x53afa4['query']);_0x5168e1[_0xf2a3('0x33')]=_[_0xf2a3('0x34')](_0x53afa4[_0xf2a3('0x32')],qs[_0xf2a3('0x35')](_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x35')]));_0x5168e1[_0xf2a3('0x33')]=_0x5168e1[_0xf2a3('0x33')][_0xf2a3('0x36')]?_0x5168e1['attributes']:_0x53afa4[_0xf2a3('0x32')];if(!_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x37')](_0xf2a3('0x38'))){_0x5168e1[_0xf2a3('0x20')]=qs['limit'](_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x20')]);_0x5168e1[_0xf2a3('0x1f')]=qs[_0xf2a3('0x1f')](_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x1f')]);}_0x5168e1[_0xf2a3('0x39')]=qs['sort'](_0x34f78c[_0xf2a3('0x2f')]['sort']);_0x5168e1[_0xf2a3('0x3a')]=qs[_0xf2a3('0x31')](_[_0xf2a3('0x3b')](_0x34f78c[_0xf2a3('0x2f')],_0x53afa4[_0xf2a3('0x31')]),_0xefbfd8);if(_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x3c')]){_0x5168e1['where']=_['merge'](_0x5168e1[_0xf2a3('0x3a')],{'$or':_['map'](_0xefbfd8,function(_0x548c0a){if(_0x548c0a[_0xf2a3('0x2d')]!==_0xf2a3('0x3d')){var _0x325776={};_0x325776[_0x548c0a[_0xf2a3('0x3e')]]={'$like':'%'+_0x34f78c['query'][_0xf2a3('0x3c')]+'%'};return _0x325776;}})});}_0x5168e1=_[_0xf2a3('0x3f')]({},_0x5168e1,_0x34f78c[_0xf2a3('0x40')]);var _0x83b795={'where':_0x5168e1['where']};return db[_0xf2a3('0x41')][_0xf2a3('0x1e')](_0x83b795)[_0xf2a3('0x24')](function(_0x1791cb){_0x301034[_0xf2a3('0x1e')]=_0x1791cb;if(_0x34f78c[_0xf2a3('0x2f')][_0xf2a3('0x42')]){_0x5168e1[_0xf2a3('0x43')]=[{'all':!![]}];}return db[_0xf2a3('0x41')][_0xf2a3('0x44')](_0x5168e1);})['then'](function(_0x1624e6){_0x301034[_0xf2a3('0x45')]=_0x1624e6;return _0x301034;})[_0xf2a3('0x24')](respondWithFilteredResult(_0x315b2a,_0x5168e1))[_0xf2a3('0x46')](handleError(_0x315b2a,null));};exports[_0xf2a3('0x47')]=function(_0x1a6da1,_0x1ab52f){var _0x31c71d={'raw':![],'where':{'id':_0x1a6da1[_0xf2a3('0x48')]['id']}},_0x29b399={};_0x29b399[_0xf2a3('0x32')]=_[_0xf2a3('0x30')](db[_0xf2a3('0x41')][_0xf2a3('0x2c')]);_0x29b399[_0xf2a3('0x2f')]=_[_0xf2a3('0x30')](_0x1a6da1['query']);_0x29b399['filters']=_['intersection'](_0x29b399['model'],_0x29b399['query']);_0x31c71d[_0xf2a3('0x33')]=_[_0xf2a3('0x34')](_0x29b399[_0xf2a3('0x32')],qs[_0xf2a3('0x35')](_0x1a6da1[_0xf2a3('0x2f')][_0xf2a3('0x35')]));_0x31c71d[_0xf2a3('0x33')]=_0x31c71d[_0xf2a3('0x33')][_0xf2a3('0x36')]?_0x31c71d[_0xf2a3('0x33')]:_0x29b399['model'];if(_0x1a6da1['query'][_0xf2a3('0x42')]){_0x31c71d[_0xf2a3('0x43')]=[{'all':!![]}];}_0x31c71d=_[_0xf2a3('0x3f')]({},_0x31c71d,_0x1a6da1[_0xf2a3('0x40')]);return db['VoiceChanSpy']['find'](_0x31c71d)[_0xf2a3('0x24')](handleEntityNotFound(_0x1ab52f,null))['then'](respondWithResult(_0x1ab52f,null))[_0xf2a3('0x46')](handleError(_0x1ab52f,null));};exports['create']=function(_0x2bcbd4,_0x10917c){return db[_0xf2a3('0x41')][_0xf2a3('0x49')](_0x2bcbd4[_0xf2a3('0x4a')],{})[_0xf2a3('0x24')](function(_0x47a9e0){var _0x124152=_0x2bcbd4['user']['get']({'plain':!![]});if(!_0x124152)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x124152[_0xf2a3('0x4b')]===_0xf2a3('0x4c')){var _0x5afe48=_0x47a9e0[_0xf2a3('0x26')]({'plain':!![]});var _0x4a52db='ChanSpies';return db['UserProfileSection'][_0xf2a3('0x4d')]({'where':{'name':_0x4a52db,'userProfileId':_0x124152[_0xf2a3('0x4e')]},'raw':!![]})[_0xf2a3('0x24')](function(_0x5deff9){if(_0x5deff9&&_0x5deff9[_0xf2a3('0x4f')]===0x0){return db[_0xf2a3('0x50')][_0xf2a3('0x49')]({'name':_0x5afe48[_0xf2a3('0x3e')],'resourceId':_0x5afe48['id'],'type':_0x5deff9[_0xf2a3('0x3e')],'sectionId':_0x5deff9['id']},{})[_0xf2a3('0x24')](function(){return _0x47a9e0;});}else{return _0x47a9e0;}})[_0xf2a3('0x46')](function(_0xc2fea2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc2fea2);throw _0xc2fea2;});}return _0x47a9e0;})[_0xf2a3('0x24')](respondWithResult(_0x10917c,0xc9))[_0xf2a3('0x46')](handleError(_0x10917c,null));};exports['update']=function(_0x4baa09,_0x509313){if(_0x4baa09[_0xf2a3('0x4a')]['id']){delete _0x4baa09[_0xf2a3('0x4a')]['id'];}return db['VoiceChanSpy'][_0xf2a3('0x4d')]({'where':{'id':_0x4baa09[_0xf2a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x509313,null))['then'](saveUpdates(_0x4baa09['body'],null))[_0xf2a3('0x24')](respondWithResult(_0x509313,null))[_0xf2a3('0x46')](handleError(_0x509313,null));};exports['destroy']=function(_0x21894d,_0x2d1b6d){return db[_0xf2a3('0x41')][_0xf2a3('0x4d')]({'where':{'id':_0x21894d[_0xf2a3('0x48')]['id']}})[_0xf2a3('0x24')](handleEntityNotFound(_0x2d1b6d,null))[_0xf2a3('0x24')](removeEntity(_0x2d1b6d,null))[_0xf2a3('0x46')](handleError(_0x2d1b6d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0aea0a0..d6a69e4 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 _0x795a=['system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','util','bluebird','context','from-sip','prefix'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x795a,0xeb));var _0xa795=function(_0xb0e53,_0x5d297b){_0xb0e53=_0xb0e53-0x0;var _0x5595ae=_0x795a[_0xb0e53];return _0x5595ae;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var BPromise=require(_0xa795('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5e1a3d,_0x166e77,_0x5d8d89){var _0x1ea665=0x1;var _0x1cf79a=[];var _0x38579b={'context':_0x166e77[_0xa795('0x2')]||_0xa795('0x3'),'exten':util['format']('%s%s',_0x5e1a3d[_0xa795('0x4')],_0x5d8d89),'type':_0xa795('0x5'),'isApp':![],'ChanSpyId':_0x5e1a3d['id'],'UserId':_0x166e77['id']};_0x1cf79a[_0xa795('0x6')](_[_0xa795('0x7')]({'app':_0xa795('0x8'),'appdata':util[_0xa795('0x9')](_0xa795('0xa'),_0xa795('0xb')),'priority':_0x1ea665++},_0x38579b));if(_0x5e1a3d[_0xa795('0xc')]){_0x1cf79a[_0xa795('0x6')](_[_0xa795('0x7')]({'app':_0xa795('0xd'),'appdata':util[_0xa795('0x9')](_0xa795('0xe'),_0x5e1a3d[_0xa795('0xf')]),'priority':_0x1ea665++},_0x38579b));}if(_0x5e1a3d[_0xa795('0x10')]){_0x1cf79a[_0xa795('0x6')](_['merge']({'app':_0xa795('0x11'),'appdata':_0x5e1a3d[_0xa795('0x12')],'priority':_0x1ea665++},_0x38579b));}_0x1cf79a[_0xa795('0x6')](_[_0xa795('0x7')]({'app':_0xa795('0x13'),'appdata':util['format'](_0xa795('0x14'),_0x166e77[_0xa795('0x15')],_0x5e1a3d[_0xa795('0x16')]?_0x5e1a3d['options'][_0xa795('0x17')](''):''),'priority':_0x1ea665++},_0x38579b));if(_0x5e1a3d[_0xa795('0xc')]){_0x1cf79a[_0xa795('0x6')](_[_0xa795('0x7')]({'app':_0xa795('0x18'),'priority':_0x1ea665++},_0x38579b));}return _0x1cf79a;};var getChanSpyApplications=function(_0x5bdc33,_0x92ba60){var _0x1286ee=[];for(var _0x3577e4=0x0,_0x3a68db=0x1;_0x3577e4<_0x92ba60[_0xa795('0x19')];_0x3577e4++,_0x3a68db=0x1){_0x1286ee=_0x1286ee[_0xa795('0x1a')](getUserApplications(_0x5bdc33,_0x92ba60[_0x3577e4],_0x92ba60[_0x3577e4][_0xa795('0x1b')]));if(_0x92ba60[_0x3577e4][_0xa795('0x1b')]!=_0x92ba60[_0x3577e4][_0xa795('0x15')]){_0x1286ee=_0x1286ee[_0xa795('0x1a')](getUserApplications(_0x5bdc33,_0x92ba60[_0x3577e4],_0x92ba60[_0x3577e4][_0xa795('0x15')]));}}return _0x1286ee;};var getChanSpyPromise=function(_0x102d1a,_0x181415){return new BPromise(function(_0x57355d,_0x51598d){return _0x102d1a[_0xa795('0x1c')]['findAll']({'attributes':['id','name',_0xa795('0x1b')],'where':{'role':_0xa795('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5bc1e3){if(_0x5bc1e3){return _0x57355d(getChanSpyApplications(_0x181415,_0x5bc1e3));}return _0x57355d([]);})[_0xa795('0x1e')](function(_0x5e24ca){_0x51598d(_0x5e24ca);});});};module[_0xa795('0x1f')]=function(_0x40b4ff,_0x380510){var _0x561167=_0x40b4ff[_0xa795('0x20')];return _0x40b4ff[_0xa795('0x21')](_0xa795('0x22'),attributes,{'tableName':_0xa795('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5527a6,_0x52b1af,_0x40c2b4){return getChanSpyPromise(_0x561167,_0x5527a6)[_0xa795('0x24')](function(_0x347fe0){if(_0x347fe0&&_0x347fe0['length']){return _0x561167['VoiceExtension'][_0xa795('0x25')](_0x347fe0);}})['then'](function(){_0x40c2b4();})[_0xa795('0x1e')](function(_0x57de59){_0x40c2b4(_0x57de59);});},'afterUpdate':function(_0x39b727,_0x3c6271,_0xac82b4){return _0x561167[_0xa795('0x26')][_0xa795('0x27')]({'where':{'ChanSpyId':_0x39b727['id']}})['then'](function(){return getChanSpyPromise(_0x561167,_0x39b727);})['then'](function(_0x87abcf){if(_0x87abcf&&_0x87abcf['length']){return _0x561167[_0xa795('0x26')][_0xa795('0x25')](_0x87abcf);}})[_0xa795('0x24')](function(){_0xac82b4();})[_0xa795('0x1e')](function(_0x2bff3b){_0xac82b4(_0x2bff3b);});},'afterDestroy':function(_0x42a83e,_0x4511d5,_0x453816){return _0x561167[_0xa795('0x26')][_0xa795('0x27')]({'where':{'ChanSpyId':_0x42a83e['id']}})[_0xa795('0x24')](function(){_0x453816();})[_0xa795('0x1e')](function(_0xbd4dd0){_0x453816(_0xbd4dd0);});}}});}; \ No newline at end of file +var _0xfaa4=['Set','CDR(type)=%s','record','push','merge','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','length','concat','User','findAll','internal','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','then','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x23f1e5,_0x47fa06){_0x23f1e5=_0x23f1e5-0x0;var _0x5355a0=_0xfaa4[_0x23f1e5];return _0x5355a0;};'use strict';var _=require(_0x4faa('0x0'));var util=require(_0x4faa('0x1'));var BPromise=require(_0x4faa('0x2'));var attributes=require(_0x4faa('0x3'));var getUserApplications=function(_0x122c51,_0x1f79b7,_0x5141d1){var _0x1d9494=0x1;var _0x819149=[];var _0x144600={'context':_0x1f79b7[_0x4faa('0x4')]||'from-sip','exten':util[_0x4faa('0x5')](_0x4faa('0x6'),_0x122c51[_0x4faa('0x7')],_0x5141d1),'type':'system','isApp':![],'ChanSpyId':_0x122c51['id'],'UserId':_0x1f79b7['id']};_0x819149['push'](_['merge']({'app':_0x4faa('0x8'),'appdata':util[_0x4faa('0x5')](_0x4faa('0x9'),'chanspy'),'priority':_0x1d9494++},_0x144600));if(_0x122c51[_0x4faa('0xa')]){_0x819149[_0x4faa('0xb')](_[_0x4faa('0xc')]({'app':_0x4faa('0xd'),'appdata':util[_0x4faa('0x5')]('${UNIQUEID}.%s,a',_0x122c51['recordingFormat']),'priority':_0x1d9494++},_0x144600));}if(_0x122c51[_0x4faa('0xe')]){_0x819149[_0x4faa('0xb')](_[_0x4faa('0xc')]({'app':_0x4faa('0xf'),'appdata':_0x122c51[_0x4faa('0x10')],'priority':_0x1d9494++},_0x144600));}_0x819149[_0x4faa('0xb')](_[_0x4faa('0xc')]({'app':_0x4faa('0x11'),'appdata':util[_0x4faa('0x5')](_0x4faa('0x12'),_0x1f79b7[_0x4faa('0x13')],_0x122c51[_0x4faa('0x14')]?_0x122c51[_0x4faa('0x14')]['join'](''):''),'priority':_0x1d9494++},_0x144600));if(_0x122c51[_0x4faa('0xa')]){_0x819149[_0x4faa('0xb')](_[_0x4faa('0xc')]({'app':'StopMixMonitor','priority':_0x1d9494++},_0x144600));}return _0x819149;};var getChanSpyApplications=function(_0xb2a974,_0x14d780){var _0x3cf31a=[];for(var _0x536a2b=0x0,_0x1cd86b=0x1;_0x536a2b<_0x14d780[_0x4faa('0x15')];_0x536a2b++,_0x1cd86b=0x1){_0x3cf31a=_0x3cf31a['concat'](getUserApplications(_0xb2a974,_0x14d780[_0x536a2b],_0x14d780[_0x536a2b]['internal']));if(_0x14d780[_0x536a2b]['internal']!=_0x14d780[_0x536a2b][_0x4faa('0x13')]){_0x3cf31a=_0x3cf31a[_0x4faa('0x16')](getUserApplications(_0xb2a974,_0x14d780[_0x536a2b],_0x14d780[_0x536a2b][_0x4faa('0x13')]));}}return _0x3cf31a;};var getChanSpyPromise=function(_0x178ccb,_0x4ab91c){return new BPromise(function(_0xdc472b,_0xbd90b1){return _0x178ccb[_0x4faa('0x17')][_0x4faa('0x18')]({'attributes':['id','name',_0x4faa('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x1b1017){if(_0x1b1017){return _0xdc472b(getChanSpyApplications(_0x4ab91c,_0x1b1017));}return _0xdc472b([]);})['catch'](function(_0x59e077){_0xbd90b1(_0x59e077);});});};module[_0x4faa('0x1a')]=function(_0xb7f23c,_0x3659f8){var _0x183aa8=_0xb7f23c[_0x4faa('0x1b')];return _0xb7f23c[_0x4faa('0x1c')](_0x4faa('0x1d'),attributes,{'tableName':_0x4faa('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5087ca,_0x1049a6,_0xe6992){return getChanSpyPromise(_0x183aa8,_0x5087ca)['then'](function(_0x3d4545){if(_0x3d4545&&_0x3d4545[_0x4faa('0x15')]){return _0x183aa8[_0x4faa('0x1f')][_0x4faa('0x20')](_0x3d4545);}})['then'](function(){_0xe6992();})[_0x4faa('0x21')](function(_0x5beae8){_0xe6992(_0x5beae8);});},'afterUpdate':function(_0x2e4306,_0x11f216,_0x4681b7){return _0x183aa8[_0x4faa('0x1f')][_0x4faa('0x22')]({'where':{'ChanSpyId':_0x2e4306['id']}})[_0x4faa('0x23')](function(){return getChanSpyPromise(_0x183aa8,_0x2e4306);})['then'](function(_0x6a4ce8){if(_0x6a4ce8&&_0x6a4ce8[_0x4faa('0x15')]){return _0x183aa8[_0x4faa('0x1f')][_0x4faa('0x20')](_0x6a4ce8);}})['then'](function(){_0x4681b7();})['catch'](function(_0x3724c0){_0x4681b7(_0x3724c0);});},'afterDestroy':function(_0x303430,_0x200b97,_0x55ea1e){return _0x183aa8[_0x4faa('0x1f')][_0x4faa('0x22')]({'where':{'ChanSpyId':_0x303430['id']}})[_0x4faa('0x23')](function(){_0x55ea1e();})[_0x4faa('0x21')](function(_0x428e30){_0x55ea1e(_0x428e30);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index aebbf87..09acd9b 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 _0x708a=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x5526e9,_0x451573){var _0xf2a3b6=function(_0xe5dc8b){while(--_0xe5dc8b){_0x5526e9['push'](_0x5526e9['shift']());}};_0xf2a3b6(++_0x451573);}(_0x708a,0x1ae));var _0xa708=function(_0x1ea123,_0x14199a){_0x1ea123=_0x1ea123-0x0;var _0x1cd5a3=_0x708a[_0x1ea123];return _0x1cd5a3;};'use strict';var _=require(_0xa708('0x0'));var util=require(_0xa708('0x1'));var moment=require(_0xa708('0x2'));var BPromise=require(_0xa708('0x3'));var rs=require(_0xa708('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa708('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa708('0x6'))(_0xa708('0x7'));var config=require(_0xa708('0x8'));var jayson=require(_0xa708('0x9'));var client=jayson[_0xa708('0xa')][_0xa708('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cb44d,_0x5461cf,_0x20cf8b){return new BPromise(function(_0x4be47c,_0x4df18f){return client[_0xa708('0xc')](_0x1cb44d,_0x20cf8b)[_0xa708('0xd')](function(_0x6e6a51){logger[_0xa708('0xe')](_0xa708('0xf'),_0x5461cf,_0xa708('0x10'));logger[_0xa708('0x11')](_0xa708('0x12'),_0x5461cf,_0xa708('0x10'),JSON[_0xa708('0x13')](_0x6e6a51));if(_0x6e6a51['error']){if(_0x6e6a51[_0xa708('0x14')][_0xa708('0x15')]===0x1f4){logger[_0xa708('0x14')](_0xa708('0xf'),_0x5461cf,_0x6e6a51['error'][_0xa708('0x16')]);return _0x4df18f(_0x6e6a51[_0xa708('0x14')][_0xa708('0x16')]);}logger[_0xa708('0x14')](_0xa708('0xf'),_0x5461cf,_0x6e6a51[_0xa708('0x14')][_0xa708('0x16')]);return _0x4be47c(_0x6e6a51[_0xa708('0x14')][_0xa708('0x16')]);}else{logger['info'](_0xa708('0xf'),_0x5461cf,_0xa708('0x10'));_0x4be47c(_0x6e6a51[_0xa708('0x17')][_0xa708('0x16')]);}})['catch'](function(_0x4a219b){logger[_0xa708('0x14')](_0xa708('0xf'),_0x5461cf,_0x4a219b);_0x4df18f(_0x4a219b);});});} \ No newline at end of file +var _0xc193=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x449c41,_0x53a110){var _0x30b068=function(_0x28dee6){while(--_0x28dee6){_0x449c41['push'](_0x449c41['shift']());}};_0x30b068(++_0x53a110);}(_0xc193,0x130));var _0x3c19=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc193[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3c19('0x0'));var util=require(_0x3c19('0x1'));var moment=require(_0x3c19('0x2'));var BPromise=require(_0x3c19('0x3'));var rs=require(_0x3c19('0x4'));var fs=require('fs');var Redis=require(_0x3c19('0x5'));var db=require(_0x3c19('0x6'))['db'];var utils=require(_0x3c19('0x7'));var logger=require('../../config/logger')(_0x3c19('0x8'));var config=require('../../config/environment');var jayson=require(_0x3c19('0x9'));var client=jayson[_0x3c19('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a226a,_0x5a9652,_0x2f6a47){return new BPromise(function(_0x263f4e,_0xb1793){return client['request'](_0x4a226a,_0x2f6a47)[_0x3c19('0xb')](function(_0x536bc5){logger[_0x3c19('0xc')](_0x3c19('0xd'),_0x5a9652,_0x3c19('0xe'));logger[_0x3c19('0xf')](_0x3c19('0x10'),_0x5a9652,_0x3c19('0xe'),JSON[_0x3c19('0x11')](_0x536bc5));if(_0x536bc5[_0x3c19('0x12')]){if(_0x536bc5[_0x3c19('0x12')]['code']===0x1f4){logger[_0x3c19('0x12')](_0x3c19('0xd'),_0x5a9652,_0x536bc5['error'][_0x3c19('0x13')]);return _0xb1793(_0x536bc5['error'][_0x3c19('0x13')]);}logger['error'](_0x3c19('0xd'),_0x5a9652,_0x536bc5[_0x3c19('0x12')][_0x3c19('0x13')]);return _0x263f4e(_0x536bc5[_0x3c19('0x12')]['message']);}else{logger['info'](_0x3c19('0xd'),_0x5a9652,_0x3c19('0xe'));_0x263f4e(_0x536bc5[_0x3c19('0x14')][_0x3c19('0x13')]);}})[_0x3c19('0x15')](function(_0x2377db){logger[_0x3c19('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a9652,_0x2377db);_0xb1793(_0x2377db);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fb56f21..9cc08bf 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 _0x5a32=['post','create','put','update','/:id','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show'];(function(_0x4d1485,_0x2ffcd8){var _0x2c83d3=function(_0x9abb8f){while(--_0x9abb8f){_0x4d1485['push'](_0x4d1485['shift']());}};_0x2c83d3(++_0x2ffcd8);}(_0x5a32,0x97));var _0x25a3=function(_0x927670,_0x4c5e1a){_0x927670=_0x927670-0x0;var _0x1d137e=_0x5a32[_0x927670];return _0x1d137e;};'use strict';var multer=require(_0x25a3('0x0'));var util=require(_0x25a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x25a3('0x2'));var router=express[_0x25a3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x25a3('0x4'));var config=require(_0x25a3('0x5'));var controller=require(_0x25a3('0x6'));router[_0x25a3('0x7')]('/',auth[_0x25a3('0x8')](),controller[_0x25a3('0x9')]);router['get']('/:id',auth[_0x25a3('0x8')](),controller[_0x25a3('0xa')]);router[_0x25a3('0xb')]('/',auth[_0x25a3('0x8')](),controller[_0x25a3('0xc')]);router[_0x25a3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x25a3('0xe')]);router['delete'](_0x25a3('0xf'),auth[_0x25a3('0x8')](),controller[_0x25a3('0x10')]);module[_0x25a3('0x11')]=router; \ No newline at end of file +var _0x4e74=['index','/:id','post','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x4e74,0x1c6));var _0x44e7=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x4e74[_0x242a98];return _0x580999;};'use strict';var multer=require(_0x44e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x44e7('0x1'));var express=require(_0x44e7('0x2'));var router=express[_0x44e7('0x3')]();var auth=require(_0x44e7('0x4'));var interaction=require(_0x44e7('0x5'));var config=require(_0x44e7('0x6'));var controller=require(_0x44e7('0x7'));router[_0x44e7('0x8')]('/',auth[_0x44e7('0x9')](),controller[_0x44e7('0xa')]);router[_0x44e7('0x8')](_0x44e7('0xb'),auth[_0x44e7('0x9')](),controller['show']);router[_0x44e7('0xc')]('/',auth[_0x44e7('0x9')](),controller['create']);router['put'](_0x44e7('0xb'),auth['isAuthenticated'](),controller[_0x44e7('0xd')]);router[_0x44e7('0xe')](_0x44e7('0xb'),auth[_0x44e7('0x9')](),controller['destroy']);module[_0x44e7('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 01af0bc..5c80037 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x57d769,_0x2e10a8){var _0x362cc6=function(_0x2e3b60){while(--_0x2e3b60){_0x57d769['push'](_0x57d769['shift']());}};_0x362cc6(++_0x2e10a8);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x471fd2,_0x2f6ef3){var _0x5a4ff9=function(_0x309989){while(--_0x309989){_0x471fd2['push'](_0x471fd2['shift']());}};_0x5a4ff9(++_0x2f6ef3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index be80a95..60ad714 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 _0xedd9=['VoiceContext','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','update','params','root','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../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','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index'];(function(_0x305452,_0x505b4c){var _0x28253f=function(_0x823c27){while(--_0x823c27){_0x305452['push'](_0x305452['shift']());}};_0x28253f(++_0x505b4c);}(_0xedd9,0xfc));var _0x9edd=function(_0x207be5,_0x344a2c){_0x207be5=_0x207be5-0x0;var _0x1bf58e=_0xedd9[_0x207be5];return _0x1bf58e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var jayson=require(_0x9edd('0x17'));var client=jayson[_0x9edd('0x18')][_0x9edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3a7b84,_0xfca576,_0xef5498){if(_0xef5498){var _0x47eb64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47eb64[_0x9edd('0x1a')](_0xfca576)){return _0x3a7b84;}else{throw new db[(_0x9edd('0x1b'))][(_0x9edd('0x1c'))](_0x9edd('0x1d'));}}else{return _0x3a7b84;}}function respondWithRpcPromise(_0x13b6b6,_0x338f3c,_0x1042aa,_0x75a4ab){return new BPromise(function(_0x4ea60f,_0x5f5bf4){var _0x448996=_0x75a4ab||client;return _0x448996[_0x9edd('0x1e')](_0x13b6b6,_0x1042aa)['then'](function(_0x1b54c0){logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,'request\x20sent');logger[_0x9edd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x338f3c,_0x9edd('0x22'),JSON[_0x9edd('0x23')](_0x1b54c0));if(_0x1b54c0['error']){if(_0x1b54c0['error'][_0x9edd('0x24')]===0x1f4){logger['error'](_0x9edd('0x20'),_0x338f3c,_0x1b54c0['error']['message']);return _0x5f5bf4(_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x338f3c,_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);return _0x4ea60f(_0x1b54c0[_0x9edd('0x25')]['message']);}else{logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,_0x9edd('0x22'));_0x4ea60f(_0x1b54c0[_0x9edd('0x27')][_0x9edd('0x26')]);}})['catch'](function(_0x46c383){logger[_0x9edd('0x25')](_0x9edd('0x20'),_0x338f3c,_0x46c383);_0x5f5bf4(_0x46c383);});});}function respondWithStatusCode(_0x2f9f86,_0x310a4d){_0x310a4d=_0x310a4d||0xcc;return function(_0x4d507f){if(_0x4d507f){return _0x2f9f86['sendStatus'](_0x310a4d);}return _0x2f9f86[_0x9edd('0x28')](_0x310a4d)[_0x9edd('0x29')]();};}function respondWithResult(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0xc8;return function(_0x3c2227){if(_0x3c2227){return _0x8d67aa['status'](_0x25e135)['json'](_0x3c2227);}};}function respondWithFilteredResult(_0x214d0a,_0x257a26){return function(_0x1c762c){if(_0x1c762c){var _0x52746a=_0x1c762c[_0x9edd('0x2a')],_0x238b22=_0x257a26['offset'],_0x28cfae=_0x257a26[_0x9edd('0x2b')]+_0x257a26[_0x9edd('0x2c')],_0x2ae8dd;if(_0x28cfae>=_0x52746a){_0x28cfae=_0x52746a;_0x2ae8dd=0xc8;}else{_0x2ae8dd=0xce;}_0x214d0a[_0x9edd('0x28')](_0x2ae8dd);return _0x214d0a[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x238b22+'-'+_0x28cfae+'/'+_0x52746a)[_0x9edd('0x2f')](_0x1c762c);}return null;};}function patchUpdates(_0x209aba){return function(_0x1fba7b){try{jsonpatch[_0x9edd('0x30')](_0x1fba7b,_0x209aba,!![]);}catch(_0x1c2e2b){return BPromise[_0x9edd('0x31')](_0x1c2e2b);}return _0x1fba7b[_0x9edd('0x32')]();};}function saveUpdates(_0x6907a5,_0xa55906){return function(_0x1a6c23){if(_0x1a6c23){return _0x1a6c23['update'](_0x6907a5)[_0x9edd('0x33')](function(_0x259259){return _0x259259;});}return null;};}function removeEntity(_0x267c74,_0x5d1707){return function(_0x2d2f88){if(_0x2d2f88){return _0x2d2f88[_0x9edd('0x34')]()[_0x9edd('0x33')](function(){var _0x38a7be=_0x2d2f88[_0x9edd('0x35')]({'plain':!![]});var _0x2bc4ed=_0x9edd('0x36');return db[_0x9edd('0x37')][_0x9edd('0x34')]({'where':{'type':_0x2bc4ed,'resourceId':_0x38a7be['id']}})[_0x9edd('0x33')](function(){return _0x2d2f88;});})[_0x9edd('0x33')](function(){_0x267c74[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x14f780,_0x5757fc){return function(_0x37fcb2){if(!_0x37fcb2){_0x14f780['sendStatus'](0x194);}return _0x37fcb2;};}function handleError(_0x968303,_0x148630){_0x148630=_0x148630||0x1f4;return function(_0x10d6fd){logger[_0x9edd('0x25')](_0x10d6fd[_0x9edd('0x38')]);if(_0x10d6fd['name']){delete _0x10d6fd[_0x9edd('0x39')];}_0x968303[_0x9edd('0x28')](_0x148630)[_0x9edd('0x3a')](_0x10d6fd);};}exports[_0x9edd('0x3b')]=function(_0x1be77f,_0x337e6c){var _0x5c0627={},_0x1cbbac={},_0x1ccee8={'count':0x0,'rows':[]};var _0x35c16f=_['map'](db[_0x9edd('0x3c')]['rawAttributes'],function(_0x3ef1d5){return{'name':_0x3ef1d5['fieldName'],'type':_0x3ef1d5[_0x9edd('0x3d')][_0x9edd('0x3e')]};});_0x1cbbac[_0x9edd('0x3f')]=_['map'](_0x35c16f,_0x9edd('0x39'));_0x1cbbac[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x1be77f['query']);_0x1cbbac[_0x9edd('0x42')]=_['intersection'](_0x1cbbac[_0x9edd('0x3f')],_0x1cbbac[_0x9edd('0x40')]);_0x5c0627['attributes']=_[_0x9edd('0x43')](_0x1cbbac[_0x9edd('0x3f')],qs[_0x9edd('0x44')](_0x1be77f[_0x9edd('0x40')]['fields']));_0x5c0627[_0x9edd('0x45')]=_0x5c0627['attributes'][_0x9edd('0x46')]?_0x5c0627[_0x9edd('0x45')]:_0x1cbbac['model'];if(!_0x1be77f[_0x9edd('0x40')]['hasOwnProperty']('nolimit')){_0x5c0627[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2c')]);_0x5c0627[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2b')]);}_0x5c0627[_0x9edd('0x47')]=qs[_0x9edd('0x48')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x48')]);_0x5c0627[_0x9edd('0x49')]=qs[_0x9edd('0x42')](_[_0x9edd('0x4a')](_0x1be77f['query'],_0x1cbbac[_0x9edd('0x42')]),_0x35c16f);if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]){_0x5c0627[_0x9edd('0x49')]=_[_0x9edd('0x4c')](_0x5c0627[_0x9edd('0x49')],{'$or':_[_0x9edd('0x4d')](_0x35c16f,function(_0x4e9ad1){if(_0x4e9ad1['type']!=='VIRTUAL'){var _0x4a7dc9={};_0x4a7dc9[_0x4e9ad1['name']]={'$like':'%'+_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]+'%'};return _0x4a7dc9;}})});}_0x5c0627=_[_0x9edd('0x4c')]({},_0x5c0627,_0x1be77f[_0x9edd('0x4e')]);var _0x367791={'where':_0x5c0627['where']};return db[_0x9edd('0x3c')][_0x9edd('0x2a')](_0x367791)[_0x9edd('0x33')](function(_0x4a89ae){_0x1ccee8[_0x9edd('0x2a')]=_0x4a89ae;if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x5c0627[_0x9edd('0x50')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x51')](_0x5c0627);})['then'](function(_0x441e4a){_0x1ccee8[_0x9edd('0x52')]=_0x441e4a;return _0x1ccee8;})['then'](respondWithFilteredResult(_0x337e6c,_0x5c0627))[_0x9edd('0x53')](handleError(_0x337e6c,null));};exports[_0x9edd('0x54')]=function(_0x4bb324,_0x2bd089){var _0x8134cd={'raw':![],'where':{'id':_0x4bb324['params']['id']}},_0x468239={};_0x468239[_0x9edd('0x3f')]=_[_0x9edd('0x41')](db[_0x9edd('0x3c')][_0x9edd('0x55')]);_0x468239['query']=_[_0x9edd('0x41')](_0x4bb324[_0x9edd('0x40')]);_0x468239[_0x9edd('0x42')]=_['intersection'](_0x468239[_0x9edd('0x3f')],_0x468239[_0x9edd('0x40')]);_0x8134cd['attributes']=_[_0x9edd('0x43')](_0x468239['model'],qs[_0x9edd('0x44')](_0x4bb324[_0x9edd('0x40')][_0x9edd('0x44')]));_0x8134cd[_0x9edd('0x45')]=_0x8134cd[_0x9edd('0x45')][_0x9edd('0x46')]?_0x8134cd[_0x9edd('0x45')]:_0x468239[_0x9edd('0x3f')];if(_0x4bb324[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x8134cd[_0x9edd('0x50')]=[{'all':!![]}];}_0x8134cd=_['merge']({},_0x8134cd,_0x4bb324[_0x9edd('0x4e')]);return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x8134cd)['then'](handleEntityNotFound(_0x2bd089,null))[_0x9edd('0x33')](respondWithResult(_0x2bd089,null))['catch'](handleError(_0x2bd089,null));};exports['create']=function(_0x54ecfa,_0x1348a7,_0x45f47c){var _0x366316;return db[_0x9edd('0x3c')]['create'](_0x54ecfa['body'],{'raw':!![]})['then'](function(_0x71820f){_0x366316=_0x71820f;return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x2e2920){var _0x41ec97=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],_0x9edd('0x59')),'utf8');var _0x421e82=ejs[_0x9edd('0x5a')](_0x41ec97,{'contexts':_0x2e2920||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x421e82);})[_0x9edd('0x33')](function(){return respondWithRpcPromise(_0x9edd('0x5c'),'create',{'module':_0x9edd('0x5d')});})[_0x9edd('0x33')](function(){var _0x430eb4=_0x54ecfa[_0x9edd('0x5e')][_0x9edd('0x35')]({'plain':!![]});if(!_0x430eb4)throw new Error(_0x9edd('0x5f'));if(_0x430eb4['role']==='user'){var _0x452ca5=_0x366316['get']({'plain':!![]});return db[_0x9edd('0x60')][_0x9edd('0x56')]({'where':{'name':_0x9edd('0x36'),'userProfileId':_0x430eb4[_0x9edd('0x61')]},'raw':!![]})['then'](function(_0x21ead2){if(_0x21ead2&&_0x21ead2['autoAssociation']===0x0){return db[_0x9edd('0x37')][_0x9edd('0x62')]({'name':_0x452ca5[_0x9edd('0x39')],'resourceId':_0x452ca5['id'],'type':_0x21ead2['name'],'sectionId':_0x21ead2['id']},{})[_0x9edd('0x33')](function(){return _0x366316;});}else{return _0x366316;}})['catch'](function(_0x37e603){logger[_0x9edd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e603);throw _0x37e603;});}return _0x366316;})[_0x9edd('0x33')](respondWithResult(_0x1348a7,0xc9))['catch'](handleError(_0x1348a7,null));};exports[_0x9edd('0x63')]=function(_0x134c9c,_0x307a61,_0x50f4fc){var _0x4181b9;return db[_0x9edd('0x3c')][_0x9edd('0x56')]({'where':{'id':_0x134c9c[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x307a61,null))['then'](saveUpdates(_0x134c9c['body'],null))[_0x9edd('0x33')](function(_0x211526){if(_0x211526){_0x4181b9=_0x211526;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bc89b){var _0x4e003a=fs['readFileSync'](path[_0x9edd('0x58')](config[_0x9edd('0x65')],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x11e082=ejs[_0x9edd('0x5a')](_0x4e003a,{'contexts':_0x1bc89b||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x11e082);})['then'](function(){return respondWithRpcPromise(_0x9edd('0x5c'),_0x9edd('0x63'),{'module':'chan_sip.so'});})[_0x9edd('0x33')](function(){return _0x4181b9;})[_0x9edd('0x33')](respondWithResult(_0x307a61,null))['catch'](handleError(_0x307a61,null));};exports[_0x9edd('0x34')]=function(_0x475dc3,_0x460a92,_0x1d9536){var _0x5ce70b;return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x475dc3[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x460a92,null))[_0x9edd('0x33')](removeEntity(_0x460a92,null))['then'](function(){return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x383cb9){var _0x25626a=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x3c7874=ejs[_0x9edd('0x5a')](_0x25626a,{'contexts':_0x383cb9});fs[_0x9edd('0x67')](_0x9edd('0x5b'),_0x3c7874);return respondWithRpcPromise('Reload',_0x9edd('0x34'),{'module':_0x9edd('0x5d')});})[_0x9edd('0x53')](handleError(_0x460a92,null));}; \ No newline at end of file +var _0xe14b=['query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','filter','include','rows','catch','show','params','includeAll','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','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','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model'];(function(_0x5a6da9,_0x32df4d){var _0x29d30f=function(_0x2b6742){while(--_0x2b6742){_0x5a6da9['push'](_0x5a6da9['shift']());}};_0x29d30f(++_0x32df4d);}(_0xe14b,0x93));var _0xbe14=function(_0x1d8edc,_0x3dc8c8){_0x1d8edc=_0x1d8edc-0x0;var _0x10d35f=_0xe14b[_0x1d8edc];return _0x10d35f;};'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(){var _0x50cb09=_0x243524['get']({'plain':!![]});var _0x412ad5=_0xbe14('0x32');return db['UserProfileResource'][_0xbe14('0x31')]({'where':{'type':_0x412ad5,'resourceId':_0x50cb09['id']}})[_0xbe14('0x1c')](function(){return _0x243524;});})[_0xbe14('0x1c')](function(){_0x46c2d1[_0xbe14('0x26')](0xcc)[_0xbe14('0x33')]();});}};}function handleEntityNotFound(_0x5ef1e5,_0x591a36){return function(_0x15a997){if(!_0x15a997){_0x5ef1e5['sendStatus'](0x194);}return _0x15a997;};}function handleError(_0x5dd7aa,_0x5c5e9f){_0x5c5e9f=_0x5c5e9f||0x1f4;return function(_0x163ef7){logger[_0xbe14('0x22')](_0x163ef7[_0xbe14('0x34')]);if(_0x163ef7[_0xbe14('0x35')]){delete _0x163ef7[_0xbe14('0x35')];}_0x5dd7aa[_0xbe14('0x26')](_0x5c5e9f)[_0xbe14('0x36')](_0x163ef7);};}exports[_0xbe14('0x37')]=function(_0x2d9c12,_0x2dfd5a){var _0x41652d={},_0x32c59d={},_0x539c41={'count':0x0,'rows':[]};var _0x4f51f8=_[_0xbe14('0x38')](db[_0xbe14('0x39')][_0xbe14('0x3a')],function(_0x520e09){return{'name':_0x520e09[_0xbe14('0x3b')],'type':_0x520e09[_0xbe14('0x3c')][_0xbe14('0x3d')]};});_0x32c59d[_0xbe14('0x3e')]=_[_0xbe14('0x38')](_0x4f51f8,_0xbe14('0x35'));_0x32c59d[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0x2d9c12[_0xbe14('0x3f')]);_0x32c59d['filters']=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],_0x32c59d[_0xbe14('0x3f')]);_0x41652d[_0xbe14('0x42')]=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],qs['fields'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x43')]));_0x41652d[_0xbe14('0x42')]=_0x41652d[_0xbe14('0x42')]['length']?_0x41652d['attributes']:_0x32c59d[_0xbe14('0x3e')];if(!_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x44')]('nolimit')){_0x41652d['limit']=qs[_0xbe14('0x29')](_0x2d9c12['query']['limit']);_0x41652d[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x2d9c12[_0xbe14('0x3f')]['offset']);}_0x41652d['order']=qs['sort'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x45')]);_0x41652d[_0xbe14('0x46')]=qs['filters'](_[_0xbe14('0x47')](_0x2d9c12[_0xbe14('0x3f')],_0x32c59d[_0xbe14('0x48')]),_0x4f51f8);if(_0x2d9c12[_0xbe14('0x3f')]['filter']){_0x41652d['where']=_[_0xbe14('0x49')](_0x41652d[_0xbe14('0x46')],{'$or':_[_0xbe14('0x38')](_0x4f51f8,function(_0xb2b285){if(_0xb2b285[_0xbe14('0x3c')]!=='VIRTUAL'){var _0x51023a={};_0x51023a[_0xb2b285[_0xbe14('0x35')]]={'$like':'%'+_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x4a')]+'%'};return _0x51023a;}})});}_0x41652d=_[_0xbe14('0x49')]({},_0x41652d,_0x2d9c12['options']);var _0x28b6e3={'where':_0x41652d[_0xbe14('0x46')]};return db['VoiceContext'][_0xbe14('0x27')](_0x28b6e3)[_0xbe14('0x1c')](function(_0x2d6ee8){_0x539c41[_0xbe14('0x27')]=_0x2d6ee8;if(_0x2d9c12['query']['includeAll']){_0x41652d[_0xbe14('0x4b')]=[{'all':!![]}];}return db[_0xbe14('0x39')]['findAll'](_0x41652d);})['then'](function(_0xca8cdb){_0x539c41[_0xbe14('0x4c')]=_0xca8cdb;return _0x539c41;})[_0xbe14('0x1c')](respondWithFilteredResult(_0x2dfd5a,_0x41652d))[_0xbe14('0x4d')](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x4e')]=function(_0xd04fd5,_0x10cd86){var _0x5a4068={'raw':![],'where':{'id':_0xd04fd5[_0xbe14('0x4f')]['id']}},_0xf32e93={};_0xf32e93[_0xbe14('0x3e')]=_[_0xbe14('0x40')](db[_0xbe14('0x39')]['rawAttributes']);_0xf32e93[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0xd04fd5[_0xbe14('0x3f')]);_0xf32e93[_0xbe14('0x48')]=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],_0xf32e93['query']);_0x5a4068['attributes']=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],qs[_0xbe14('0x43')](_0xd04fd5['query']['fields']));_0x5a4068[_0xbe14('0x42')]=_0x5a4068[_0xbe14('0x42')]['length']?_0x5a4068[_0xbe14('0x42')]:_0xf32e93[_0xbe14('0x3e')];if(_0xd04fd5['query'][_0xbe14('0x50')]){_0x5a4068['include']=[{'all':!![]}];}_0x5a4068=_[_0xbe14('0x49')]({},_0x5a4068,_0xd04fd5[_0xbe14('0x51')]);return db[_0xbe14('0x39')]['find'](_0x5a4068)[_0xbe14('0x1c')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x1c')](respondWithResult(_0x10cd86,null))['catch'](handleError(_0x10cd86,null));};exports[_0xbe14('0x52')]=function(_0x42ca15,_0x2210cc,_0x20c48d){var _0x49322f;return db['VoiceContext'][_0xbe14('0x52')](_0x42ca15[_0xbe14('0x53')],{'raw':!![]})[_0xbe14('0x1c')](function(_0x243b9e){_0x49322f=_0x243b9e;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x56ab61){var _0x72c875=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd8f78f=ejs[_0xbe14('0x5a')](_0x72c875,{'contexts':_0x56ab61||[]});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0xd8f78f);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xbe14('0x1c')](function(){var _0x1bfcbf=_0x42ca15[_0xbe14('0x5d')][_0xbe14('0x5e')]({'plain':!![]});if(!_0x1bfcbf)throw new Error(_0xbe14('0x5f'));if(_0x1bfcbf[_0xbe14('0x60')]===_0xbe14('0x5d')){var _0x22bf69=_0x49322f[_0xbe14('0x5e')]({'plain':!![]});return db[_0xbe14('0x61')][_0xbe14('0x62')]({'where':{'name':_0xbe14('0x32'),'userProfileId':_0x1bfcbf[_0xbe14('0x63')]},'raw':!![]})[_0xbe14('0x1c')](function(_0x1c831a){if(_0x1c831a&&_0x1c831a[_0xbe14('0x64')]===0x0){return db[_0xbe14('0x65')][_0xbe14('0x52')]({'name':_0x22bf69[_0xbe14('0x35')],'resourceId':_0x22bf69['id'],'type':_0x1c831a[_0xbe14('0x35')],'sectionId':_0x1c831a['id']},{})['then'](function(){return _0x49322f;});}else{return _0x49322f;}})[_0xbe14('0x4d')](function(_0x9333d){logger[_0xbe14('0x22')](_0xbe14('0x66'),_0x9333d);throw _0x9333d;});}return _0x49322f;})[_0xbe14('0x1c')](respondWithResult(_0x2210cc,0xc9))[_0xbe14('0x4d')](handleError(_0x2210cc,null));};exports[_0xbe14('0x30')]=function(_0x310311,_0x23cb36,_0x100d43){var _0x5917d5;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x310311[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x23cb36,null))[_0xbe14('0x1c')](saveUpdates(_0x310311['body'],null))[_0xbe14('0x1c')](function(_0x120077){if(_0x120077){_0x5917d5=_0x120077;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});}})[_0xbe14('0x1c')](function(_0x5ed9b3){var _0x48da19=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd9dd1c=ejs[_0xbe14('0x5a')](_0x48da19,{'contexts':_0x5ed9b3||[]});fs['writeFileSync'](_0xbe14('0x5c'),_0xd9dd1c);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x30'),{'module':_0xbe14('0x68')});})[_0xbe14('0x1c')](function(){return _0x5917d5;})[_0xbe14('0x1c')](respondWithResult(_0x23cb36,null))['catch'](handleError(_0x23cb36,null));};exports['destroy']=function(_0x12941d,_0x3c2b58,_0x2d2643){var _0x2510a0;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x12941d[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x3c2b58,null))['then'](removeEntity(_0x3c2b58,null))['then'](function(){return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x57729f){var _0x76e91e=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0x12e23a=ejs['render'](_0x76e91e,{'contexts':_0x57729f});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0x12e23a);return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x31'),{'module':_0xbe14('0x68')});})[_0xbe14('0x4d')](handleError(_0x3c2b58,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0cf5f93..f2d494d 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 _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1d5e9d2..6751680 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 _0x50ac=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x38b347,_0x432d5e){var _0x4d5a0d=function(_0x2b2562){while(--_0x2b2562){_0x38b347['push'](_0x38b347['shift']());}};_0x4d5a0d(++_0x432d5e);}(_0x50ac,0x68));var _0xc50a=function(_0x272949,_0x3b575a){_0x272949=_0x272949-0x0;var _0x41f151=_0x50ac[_0x272949];return _0x41f151;};'use strict';var _=require('lodash');var util=require(_0xc50a('0x0'));var moment=require('moment');var BPromise=require(_0xc50a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc50a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc50a('0x3'));var logger=require('../../config/logger')(_0xc50a('0x4'));var config=require(_0xc50a('0x5'));var jayson=require(_0xc50a('0x6'));var client=jayson[_0xc50a('0x7')][_0xc50a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40715b,_0x2c0620,_0x2569e7){return new BPromise(function(_0x156717,_0x3011aa){return client[_0xc50a('0x9')](_0x40715b,_0x2569e7)[_0xc50a('0xa')](function(_0x1ad74f){logger[_0xc50a('0xb')](_0xc50a('0xc'),_0x2c0620,_0xc50a('0xd'));logger[_0xc50a('0xe')](_0xc50a('0xf'),_0x2c0620,'request\x20sent',JSON[_0xc50a('0x10')](_0x1ad74f));if(_0x1ad74f[_0xc50a('0x11')]){if(_0x1ad74f['error']['code']===0x1f4){logger[_0xc50a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2c0620,_0x1ad74f[_0xc50a('0x11')][_0xc50a('0x12')]);return _0x3011aa(_0x1ad74f[_0xc50a('0x11')][_0xc50a('0x12')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2c0620,_0x1ad74f[_0xc50a('0x11')][_0xc50a('0x12')]);return _0x156717(_0x1ad74f[_0xc50a('0x11')][_0xc50a('0x12')]);}else{logger[_0xc50a('0xb')](_0xc50a('0xc'),_0x2c0620,_0xc50a('0xd'));_0x156717(_0x1ad74f[_0xc50a('0x13')][_0xc50a('0x12')]);}})[_0xc50a('0x14')](function(_0x249941){logger[_0xc50a('0x11')](_0xc50a('0xc'),_0x2c0620,_0x249941);_0x3011aa(_0x249941);});});} \ No newline at end of file +var _0xd46c=['http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c1811,_0x53270f){var _0x13aea5=function(_0x12b7b6){while(--_0x12b7b6){_0x5c1811['push'](_0x5c1811['shift']());}};_0x13aea5(++_0x53270f);}(_0xd46c,0xa6));var _0xcd46=function(_0x5a14a6,_0x3f1f68){_0x5a14a6=_0x5a14a6-0x0;var _0x4346c0=_0xd46c[_0x5a14a6];return _0x4346c0;};'use strict';var _=require(_0xcd46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd46('0x1'));var rs=require(_0xcd46('0x2'));var fs=require('fs');var Redis=require(_0xcd46('0x3'));var db=require(_0xcd46('0x4'))['db'];var utils=require(_0xcd46('0x5'));var logger=require('../../config/logger')(_0xcd46('0x6'));var config=require(_0xcd46('0x7'));var jayson=require(_0xcd46('0x8'));var client=jayson[_0xcd46('0x9')][_0xcd46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x254a0c,_0x51e364,_0x51c70b){return new BPromise(function(_0x375d40,_0x3d393d){return client[_0xcd46('0xb')](_0x254a0c,_0x51c70b)[_0xcd46('0xc')](function(_0x3eb4dc){logger[_0xcd46('0xd')]('VoiceContext,\x20%s,\x20%s',_0x51e364,_0xcd46('0xe'));logger[_0xcd46('0xf')](_0xcd46('0x10'),_0x51e364,_0xcd46('0xe'),JSON[_0xcd46('0x11')](_0x3eb4dc));if(_0x3eb4dc[_0xcd46('0x12')]){if(_0x3eb4dc[_0xcd46('0x12')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x51e364,_0x3eb4dc[_0xcd46('0x12')][_0xcd46('0x13')]);return _0x3d393d(_0x3eb4dc[_0xcd46('0x12')]['message']);}logger[_0xcd46('0x12')]('VoiceContext,\x20%s,\x20%s',_0x51e364,_0x3eb4dc[_0xcd46('0x12')][_0xcd46('0x13')]);return _0x375d40(_0x3eb4dc[_0xcd46('0x12')][_0xcd46('0x13')]);}else{logger[_0xcd46('0xd')](_0xcd46('0x14'),_0x51e364,_0xcd46('0xe'));_0x375d40(_0x3eb4dc['result'][_0xcd46('0x13')]);}})[_0xcd46('0x15')](function(_0x3f2ed6){logger[_0xcd46('0x12')](_0xcd46('0x14'),_0x51e364,_0x3f2ed6);_0x3d393d(_0x3f2ed6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 779ca93..d2209a7 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 _0x2b6c=['describe','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x124289,_0x57ed80){var _0x5b188d=function(_0x16d8de){while(--_0x16d8de){_0x124289['push'](_0x124289['shift']());}};_0x5b188d(++_0x57ed80);}(_0x2b6c,0xac));var _0xc2b6=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x2b6c[_0x4ed4d2];return _0x15ae2e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc2b6('0x0'));var express=require(_0xc2b6('0x1'));var router=express['Router']();var auth=require(_0xc2b6('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc2b6('0x3'));var controller=require('./voiceDialReport.controller');router[_0xc2b6('0x4')]('/',auth[_0xc2b6('0x5')](),controller[_0xc2b6('0x6')]);router[_0xc2b6('0x4')](_0xc2b6('0x7'),auth[_0xc2b6('0x5')](),controller[_0xc2b6('0x8')]);router[_0xc2b6('0x4')](_0xc2b6('0x9'),auth['isAuthenticated'](),controller[_0xc2b6('0xa')]);router[_0xc2b6('0xb')]('/',auth['isAuthenticated'](),controller[_0xc2b6('0xc')]);router[_0xc2b6('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc2b6('0xe')]);router[_0xc2b6('0xf')]('/:id',auth[_0xc2b6('0x5')](),controller[_0xc2b6('0x10')]);module[_0xc2b6('0x11')]=router; \ No newline at end of file +var _0xea84=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1f53c6,_0x503bf6){var _0x478f49=function(_0x28084a){while(--_0x28084a){_0x1f53c6['push'](_0x1f53c6['shift']());}};_0x478f49(++_0x503bf6);}(_0xea84,0x18a));var _0x4ea8=function(_0x5bd59c,_0x386f47){_0x5bd59c=_0x5bd59c-0x0;var _0x30e8b1=_0xea84[_0x5bd59c];return _0x30e8b1;};'use strict';var multer=require(_0x4ea8('0x0'));var util=require(_0x4ea8('0x1'));var path=require(_0x4ea8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ea8('0x3'));var router=express[_0x4ea8('0x4')]();var auth=require(_0x4ea8('0x5'));var interaction=require(_0x4ea8('0x6'));var config=require(_0x4ea8('0x7'));var controller=require(_0x4ea8('0x8'));router[_0x4ea8('0x9')]('/',auth[_0x4ea8('0xa')](),controller[_0x4ea8('0xb')]);router[_0x4ea8('0x9')](_0x4ea8('0xc'),auth[_0x4ea8('0xa')](),controller[_0x4ea8('0xd')]);router['get'](_0x4ea8('0xe'),auth['isAuthenticated'](),controller[_0x4ea8('0xf')]);router[_0x4ea8('0x10')]('/',auth[_0x4ea8('0xa')](),controller[_0x4ea8('0x11')]);router[_0x4ea8('0x12')](_0x4ea8('0xe'),auth[_0x4ea8('0xa')](),controller[_0x4ea8('0x13')]);router[_0x4ea8('0x14')](_0x4ea8('0xe'),auth['isAuthenticated'](),controller[_0x4ea8('0x15')]);module[_0x4ea8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2c6e402..31e2ff5 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 _0xf56c=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x4b4f05,_0x39a268){var _0x2dbf4f=function(_0x36f6fa){while(--_0x36f6fa){_0x4b4f05['push'](_0x4b4f05['shift']());}};_0x2dbf4f(++_0x39a268);}(_0xf56c,0xf2));var _0xcf56=function(_0x161cb1,_0x7930a){_0x161cb1=_0x161cb1-0x0;var _0x36dd92=_0xf56c[_0x161cb1];return _0x36dd92;};'use strict';var Sequelize=require(_0xcf56('0x0'));module[_0xcf56('0x1')]={'privilege':{'type':Sequelize[_0xcf56('0x2')]},'channel':{'type':Sequelize[_0xcf56('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcf56('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcf56('0x2')]},'connectedlinenum':{'type':Sequelize[_0xcf56('0x2')]},'connectedlinename':{'type':Sequelize[_0xcf56('0x2')]},'language':{'type':Sequelize[_0xcf56('0x2')]},'accountcode':{'type':Sequelize[_0xcf56('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xcf56('0x2')]},'priority':{'type':Sequelize[_0xcf56('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xcf56('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xcf56('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xcf56('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xcf56('0x2')]},'destlanguage':{'type':Sequelize[_0xcf56('0x2')]},'destaccountcode':{'type':Sequelize[_0xcf56('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xcf56('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xcf56('0x2')]},'dialstring':{'type':Sequelize[_0xcf56('0x2')]},'dialstatus':{'type':Sequelize[_0xcf56('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xcf56('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xcf56('0x2')],'comment':_0xcf56('0x5')},'routeId':{'type':Sequelize[_0xcf56('0x3')]},'duration':{'type':Sequelize[_0xcf56('0x3')]},'holdtime':{'type':Sequelize[_0xcf56('0x3')]},'billableseconds':{'type':Sequelize[_0xcf56('0x3')]}}; \ No newline at end of file +var _0xda0b=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x14aa7c,_0x1b2e5b){var _0x5340cb=function(_0x1084f2){while(--_0x1084f2){_0x14aa7c['push'](_0x14aa7c['shift']());}};_0x5340cb(++_0x1b2e5b);}(_0xda0b,0x1d3));var _0xbda0=function(_0x4f6bc7,_0x327bfd){_0x4f6bc7=_0x4f6bc7-0x0;var _0x544685=_0xda0b[_0x4f6bc7];return _0x544685;};'use strict';var Sequelize=require(_0xbda0('0x0'));module[_0xbda0('0x1')]={'privilege':{'type':Sequelize[_0xbda0('0x2')]},'channel':{'type':Sequelize[_0xbda0('0x2')]},'channelstate':{'type':Sequelize[_0xbda0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbda0('0x2')]},'calleridnum':{'type':Sequelize[_0xbda0('0x2')]},'calleridname':{'type':Sequelize[_0xbda0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbda0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbda0('0x2')]},'accountcode':{'type':Sequelize[_0xbda0('0x2')]},'context':{'type':Sequelize[_0xbda0('0x2')]},'exten':{'type':Sequelize[_0xbda0('0x2')]},'priority':{'type':Sequelize[_0xbda0('0x3')]},'uniqueid':{'type':Sequelize[_0xbda0('0x2')]},'linkedid':{'type':Sequelize[_0xbda0('0x2')]},'destchannel':{'type':Sequelize[_0xbda0('0x2')]},'destchannelstate':{'type':Sequelize[_0xbda0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbda0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbda0('0x2')]},'destcalleridname':{'type':Sequelize[_0xbda0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbda0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbda0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbda0('0x2')]},'destpriority':{'type':Sequelize[_0xbda0('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xbda0('0x2')]},'dialstring':{'type':Sequelize[_0xbda0('0x2')]},'dialstatus':{'type':Sequelize[_0xbda0('0x2')]},'starttime':{'type':Sequelize[_0xbda0('0x4')]},'answertime':{'type':Sequelize[_0xbda0('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xbda0('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xbda0('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5b468b6..fe23b5f 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 _0x85c8=['json','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','VoiceDialReport','fields','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x85c8,0x1e0));var _0x885c=function(_0x47e3af,_0x234b11){_0x47e3af=_0x47e3af-0x0;var _0x1313d6=_0x85c8[_0x47e3af];return _0x1313d6;};'use strict';var pdf=require(_0x885c('0x0'));var emlformat=require(_0x885c('0x1'));var rimraf=require(_0x885c('0x2'));var zipdir=require(_0x885c('0x3'));var jsonpatch=require(_0x885c('0x4'));var rp=require('request-promise');var moment=require(_0x885c('0x5'));var BPromise=require(_0x885c('0x6'));var Mustache=require('mustache');var util=require(_0x885c('0x7'));var path=require(_0x885c('0x8'));var sox=require('sox');var csv=require(_0x885c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x885c('0xa'));var squel=require(_0x885c('0xb'));var crypto=require(_0x885c('0xc'));var jsforce=require(_0x885c('0xd'));var deskjs=require(_0x885c('0xe'));var toCsv=require(_0x885c('0x9'));var querystring=require(_0x885c('0xf'));var Papa=require('papaparse');var Redis=require(_0x885c('0x10'));var authService=require(_0x885c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x885c('0x12'));var hardwareService=require(_0x885c('0x13'));var logger=require(_0x885c('0x14'))(_0x885c('0x15'));var utils=require('../../config/utils');var config=require(_0x885c('0x16'));var db=require(_0x885c('0x17'))['db'];function respondWithStatusCode(_0x569c81,_0x2d056c){_0x2d056c=_0x2d056c||0xcc;return function(_0xd120f0){if(_0xd120f0){return _0x569c81[_0x885c('0x18')](_0x2d056c);}return _0x569c81[_0x885c('0x19')](_0x2d056c)[_0x885c('0x1a')]();};}function respondWithResult(_0x526e57,_0x19aa4b){_0x19aa4b=_0x19aa4b||0xc8;return function(_0x5595cc){if(_0x5595cc){return _0x526e57['status'](_0x19aa4b)['json'](_0x5595cc);}};}function respondWithFilteredResult(_0xbac4cc,_0x50c1aa){return function(_0x30dcc2){if(_0x30dcc2){var _0x4937f6=_0x30dcc2[_0x885c('0x1b')],_0x5e9418=_0x50c1aa['offset'],_0x1c33b6=_0x50c1aa[_0x885c('0x1c')]+_0x50c1aa[_0x885c('0x1d')],_0x8137b2;if(_0x1c33b6>=_0x4937f6){_0x1c33b6=_0x4937f6;_0x8137b2=0xc8;}else{_0x8137b2=0xce;}_0xbac4cc[_0x885c('0x19')](_0x8137b2);return _0xbac4cc[_0x885c('0x1e')]('Content-Range',_0x5e9418+'-'+_0x1c33b6+'/'+_0x4937f6)[_0x885c('0x1f')](_0x30dcc2);}return null;};}function patchUpdates(_0x3445fd){return function(_0x443cfd){try{jsonpatch[_0x885c('0x20')](_0x443cfd,_0x3445fd,!![]);}catch(_0x5899aa){return BPromise[_0x885c('0x21')](_0x5899aa);}return _0x443cfd[_0x885c('0x22')]();};}function saveUpdates(_0x53a705,_0x5446ed){return function(_0x38ed24){if(_0x38ed24){return _0x38ed24[_0x885c('0x23')](_0x53a705)[_0x885c('0x24')](function(_0x57aadd){return _0x57aadd;});}return null;};}function removeEntity(_0x261a7d,_0x3b8f3f){return function(_0x4adb71){if(_0x4adb71){return _0x4adb71[_0x885c('0x25')]()['then'](function(){_0x261a7d[_0x885c('0x19')](0xcc)[_0x885c('0x1a')]();});}};}function handleEntityNotFound(_0x496de5,_0x3b567e){return function(_0xd77231){if(!_0xd77231){_0x496de5[_0x885c('0x18')](0x194);}return _0xd77231;};}function handleError(_0x5804c8,_0xd70b84){_0xd70b84=_0xd70b84||0x1f4;return function(_0x55efd9){logger[_0x885c('0x26')](_0x55efd9['stack']);if(_0x55efd9[_0x885c('0x27')]){delete _0x55efd9[_0x885c('0x27')];}_0x5804c8[_0x885c('0x19')](_0xd70b84)['send'](_0x55efd9);};}exports[_0x885c('0x28')]=function(_0x39fd23,_0x3543c1){var _0x2b2bc0={},_0x57255d={},_0x516915={'count':0x0,'rows':[]};var _0x1c7a93=_[_0x885c('0x29')](db['VoiceDialReport'][_0x885c('0x2a')],function(_0x3ff07b){return{'name':_0x3ff07b[_0x885c('0x2b')],'type':_0x3ff07b[_0x885c('0x2c')][_0x885c('0x2d')]};});_0x57255d[_0x885c('0x2e')]=_[_0x885c('0x29')](_0x1c7a93,_0x885c('0x27'));_0x57255d[_0x885c('0x2f')]=_['keys'](_0x39fd23[_0x885c('0x2f')]);_0x57255d['filters']=_['intersection'](_0x57255d[_0x885c('0x2e')],_0x57255d[_0x885c('0x2f')]);_0x2b2bc0['attributes']=_[_0x885c('0x30')](_0x57255d[_0x885c('0x2e')],qs['fields'](_0x39fd23[_0x885c('0x2f')]['fields']));_0x2b2bc0[_0x885c('0x31')]=_0x2b2bc0[_0x885c('0x31')][_0x885c('0x32')]?_0x2b2bc0[_0x885c('0x31')]:_0x57255d[_0x885c('0x2e')];if(!_0x39fd23[_0x885c('0x2f')]['hasOwnProperty'](_0x885c('0x33'))){_0x2b2bc0[_0x885c('0x1d')]=qs[_0x885c('0x1d')](_0x39fd23[_0x885c('0x2f')][_0x885c('0x1d')]);_0x2b2bc0[_0x885c('0x1c')]=qs['offset'](_0x39fd23[_0x885c('0x2f')][_0x885c('0x1c')]);}_0x2b2bc0[_0x885c('0x34')]=qs[_0x885c('0x35')](_0x39fd23[_0x885c('0x2f')][_0x885c('0x35')]);_0x2b2bc0['where']=qs[_0x885c('0x36')](_[_0x885c('0x37')](_0x39fd23[_0x885c('0x2f')],_0x57255d['filters']),_0x1c7a93);if(_0x39fd23['query'][_0x885c('0x38')]){_0x2b2bc0[_0x885c('0x39')]=_['merge'](_0x2b2bc0[_0x885c('0x39')],{'$or':_[_0x885c('0x29')](_0x1c7a93,function(_0x3dedfb){if(_0x3dedfb['type']!==_0x885c('0x3a')){var _0x27f7e3={};_0x27f7e3[_0x3dedfb[_0x885c('0x27')]]={'$like':'%'+_0x39fd23[_0x885c('0x2f')][_0x885c('0x38')]+'%'};return _0x27f7e3;}})});}_0x2b2bc0=_[_0x885c('0x3b')]({},_0x2b2bc0,_0x39fd23[_0x885c('0x3c')]);var _0x49791f={'where':_0x2b2bc0[_0x885c('0x39')]};return db['VoiceDialReport'][_0x885c('0x1b')](_0x49791f)[_0x885c('0x24')](function(_0x5b4a10){_0x516915[_0x885c('0x1b')]=_0x5b4a10;if(_0x39fd23['query'][_0x885c('0x3d')]){_0x2b2bc0[_0x885c('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x885c('0x3f')](_0x2b2bc0);})[_0x885c('0x24')](function(_0x5b9719){_0x516915[_0x885c('0x40')]=_0x5b9719;return _0x516915;})['then'](respondWithFilteredResult(_0x3543c1,_0x2b2bc0))['catch'](handleError(_0x3543c1,null));};exports['show']=function(_0x2c4d18,_0x7b7901){var _0x65ec28={'raw':!![],'where':{'id':_0x2c4d18[_0x885c('0x41')]['id']}},_0x51330b={};_0x51330b[_0x885c('0x2e')]=_['keys'](db[_0x885c('0x42')][_0x885c('0x2a')]);_0x51330b[_0x885c('0x2f')]=_['keys'](_0x2c4d18['query']);_0x51330b[_0x885c('0x36')]=_[_0x885c('0x30')](_0x51330b[_0x885c('0x2e')],_0x51330b[_0x885c('0x2f')]);_0x65ec28[_0x885c('0x31')]=_[_0x885c('0x30')](_0x51330b['model'],qs['fields'](_0x2c4d18[_0x885c('0x2f')][_0x885c('0x43')]));_0x65ec28[_0x885c('0x31')]=_0x65ec28[_0x885c('0x31')]['length']?_0x65ec28[_0x885c('0x31')]:_0x51330b[_0x885c('0x2e')];if(_0x2c4d18['query'][_0x885c('0x3d')]){_0x65ec28['include']=[{'all':!![]}];}_0x65ec28=_[_0x885c('0x3b')]({},_0x65ec28,_0x2c4d18[_0x885c('0x3c')]);return db[_0x885c('0x42')][_0x885c('0x44')](_0x65ec28)[_0x885c('0x24')](handleEntityNotFound(_0x7b7901,null))[_0x885c('0x24')](respondWithResult(_0x7b7901,null))[_0x885c('0x45')](handleError(_0x7b7901,null));};exports[_0x885c('0x46')]=function(_0x224f3e,_0x3a2620){return db[_0x885c('0x42')]['create'](_0x224f3e[_0x885c('0x47')],{})[_0x885c('0x24')](respondWithResult(_0x3a2620,0xc9))[_0x885c('0x45')](handleError(_0x3a2620,null));};exports[_0x885c('0x23')]=function(_0x5012f7,_0x5c99d8){if(_0x5012f7[_0x885c('0x47')]['id']){delete _0x5012f7[_0x885c('0x47')]['id'];}return db['VoiceDialReport'][_0x885c('0x44')]({'where':{'id':_0x5012f7['params']['id']}})[_0x885c('0x24')](handleEntityNotFound(_0x5c99d8,null))[_0x885c('0x24')](saveUpdates(_0x5012f7[_0x885c('0x47')],null))[_0x885c('0x24')](respondWithResult(_0x5c99d8,null))[_0x885c('0x45')](handleError(_0x5c99d8,null));};exports['destroy']=function(_0x14296e,_0x5569a5){return db['VoiceDialReport'][_0x885c('0x44')]({'where':{'id':_0x14296e[_0x885c('0x41')]['id']}})[_0x885c('0x24')](handleEntityNotFound(_0x5569a5,null))[_0x885c('0x24')](removeEntity(_0x5569a5,null))[_0x885c('0x45')](handleError(_0x5569a5,null));};exports[_0x885c('0x48')]=function(_0x485837,_0xffcfc8){return db[_0x885c('0x42')][_0x885c('0x48')]()['then'](respondWithResult(_0xffcfc8,null))[_0x885c('0x45')](handleError(_0xffcfc8,null));}; \ No newline at end of file +var _0x5c4d=['offset','Content-Range','json','save','update','destroy','then','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceDialReport','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','describe','html-pdf','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x157c81,_0x2c0224){var _0x1bfb12=function(_0x4b5c5b){while(--_0x4b5c5b){_0x157c81['push'](_0x157c81['shift']());}};_0x1bfb12(++_0x2c0224);}(_0x5c4d,0x18f));var _0xd5c4=function(_0x185c5e,_0x1b05f5){_0x185c5e=_0x185c5e-0x0;var _0x14053a=_0x5c4d[_0x185c5e];return _0x14053a;};'use strict';var pdf=require(_0xd5c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd5c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd5c4('0x2'));var BPromise=require(_0xd5c4('0x3'));var Mustache=require(_0xd5c4('0x4'));var util=require('util');var path=require(_0xd5c4('0x5'));var sox=require(_0xd5c4('0x6'));var csv=require(_0xd5c4('0x7'));var ejs=require(_0xd5c4('0x8'));var fs=require('fs');var _=require(_0xd5c4('0x9'));var squel=require(_0xd5c4('0xa'));var crypto=require(_0xd5c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd5c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd5c4('0xd'));var Papa=require(_0xd5c4('0xe'));var Redis=require(_0xd5c4('0xf'));var authService=require(_0xd5c4('0x10'));var qs=require(_0xd5c4('0x11'));var as=require(_0xd5c4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5c4('0x13'))('api');var utils=require(_0xd5c4('0x14'));var config=require(_0xd5c4('0x15'));var db=require(_0xd5c4('0x16'))['db'];function respondWithStatusCode(_0x1986b1,_0x5b9c54){_0x5b9c54=_0x5b9c54||0xcc;return function(_0x515970){if(_0x515970){return _0x1986b1[_0xd5c4('0x17')](_0x5b9c54);}return _0x1986b1[_0xd5c4('0x18')](_0x5b9c54)[_0xd5c4('0x19')]();};}function respondWithResult(_0x45fa57,_0x46172c){_0x46172c=_0x46172c||0xc8;return function(_0x4b018a){if(_0x4b018a){return _0x45fa57[_0xd5c4('0x18')](_0x46172c)['json'](_0x4b018a);}};}function respondWithFilteredResult(_0x1789d9,_0x56c771){return function(_0x34c210){if(_0x34c210){var _0x34e03e=_0x34c210[_0xd5c4('0x1a')],_0x30db2e=_0x56c771[_0xd5c4('0x1b')],_0x5d5fa4=_0x56c771[_0xd5c4('0x1b')]+_0x56c771['limit'],_0x30cc58;if(_0x5d5fa4>=_0x34e03e){_0x5d5fa4=_0x34e03e;_0x30cc58=0xc8;}else{_0x30cc58=0xce;}_0x1789d9[_0xd5c4('0x18')](_0x30cc58);return _0x1789d9['set'](_0xd5c4('0x1c'),_0x30db2e+'-'+_0x5d5fa4+'/'+_0x34e03e)[_0xd5c4('0x1d')](_0x34c210);}return null;};}function patchUpdates(_0x243c04){return function(_0xa5742e){try{jsonpatch['apply'](_0xa5742e,_0x243c04,!![]);}catch(_0x39ac03){return BPromise['reject'](_0x39ac03);}return _0xa5742e[_0xd5c4('0x1e')]();};}function saveUpdates(_0x10caf7,_0x103fb3){return function(_0x1b3d72){if(_0x1b3d72){return _0x1b3d72[_0xd5c4('0x1f')](_0x10caf7)['then'](function(_0xbabba){return _0xbabba;});}return null;};}function removeEntity(_0x1720bf,_0x22b850){return function(_0x587eb6){if(_0x587eb6){return _0x587eb6[_0xd5c4('0x20')]()[_0xd5c4('0x21')](function(){_0x1720bf['status'](0xcc)[_0xd5c4('0x19')]();});}};}function handleEntityNotFound(_0x364365,_0x57c27a){return function(_0x4bd0f1){if(!_0x4bd0f1){_0x364365[_0xd5c4('0x17')](0x194);}return _0x4bd0f1;};}function handleError(_0x289cd8,_0x5e9b0f){_0x5e9b0f=_0x5e9b0f||0x1f4;return function(_0x339d97){logger['error'](_0x339d97['stack']);if(_0x339d97['name']){delete _0x339d97[_0xd5c4('0x22')];}_0x289cd8[_0xd5c4('0x18')](_0x5e9b0f)['send'](_0x339d97);};}exports[_0xd5c4('0x23')]=function(_0x800607,_0x38f092){var _0x1374bc={},_0x1f10d2={},_0x55c244={'count':0x0,'rows':[]};var _0x511641=_[_0xd5c4('0x24')](db['VoiceDialReport']['rawAttributes'],function(_0x186666){return{'name':_0x186666[_0xd5c4('0x25')],'type':_0x186666[_0xd5c4('0x26')][_0xd5c4('0x27')]};});_0x1f10d2[_0xd5c4('0x28')]=_[_0xd5c4('0x24')](_0x511641,_0xd5c4('0x22'));_0x1f10d2['query']=_['keys'](_0x800607[_0xd5c4('0x29')]);_0x1f10d2[_0xd5c4('0x2a')]=_[_0xd5c4('0x2b')](_0x1f10d2[_0xd5c4('0x28')],_0x1f10d2['query']);_0x1374bc[_0xd5c4('0x2c')]=_['intersection'](_0x1f10d2['model'],qs['fields'](_0x800607['query'][_0xd5c4('0x2d')]));_0x1374bc[_0xd5c4('0x2c')]=_0x1374bc['attributes']['length']?_0x1374bc['attributes']:_0x1f10d2[_0xd5c4('0x28')];if(!_0x800607[_0xd5c4('0x29')][_0xd5c4('0x2e')](_0xd5c4('0x2f'))){_0x1374bc[_0xd5c4('0x30')]=qs[_0xd5c4('0x30')](_0x800607[_0xd5c4('0x29')]['limit']);_0x1374bc[_0xd5c4('0x1b')]=qs[_0xd5c4('0x1b')](_0x800607[_0xd5c4('0x29')][_0xd5c4('0x1b')]);}_0x1374bc[_0xd5c4('0x31')]=qs[_0xd5c4('0x32')](_0x800607['query'][_0xd5c4('0x32')]);_0x1374bc[_0xd5c4('0x33')]=qs['filters'](_[_0xd5c4('0x34')](_0x800607[_0xd5c4('0x29')],_0x1f10d2[_0xd5c4('0x2a')]),_0x511641);if(_0x800607[_0xd5c4('0x29')][_0xd5c4('0x35')]){_0x1374bc[_0xd5c4('0x33')]=_[_0xd5c4('0x36')](_0x1374bc[_0xd5c4('0x33')],{'$or':_[_0xd5c4('0x24')](_0x511641,function(_0x4f2e10){if(_0x4f2e10[_0xd5c4('0x26')]!==_0xd5c4('0x37')){var _0x42599a={};_0x42599a[_0x4f2e10[_0xd5c4('0x22')]]={'$like':'%'+_0x800607[_0xd5c4('0x29')][_0xd5c4('0x35')]+'%'};return _0x42599a;}})});}_0x1374bc=_[_0xd5c4('0x36')]({},_0x1374bc,_0x800607[_0xd5c4('0x38')]);var _0x5138e5={'where':_0x1374bc[_0xd5c4('0x33')]};return db['VoiceDialReport'][_0xd5c4('0x1a')](_0x5138e5)[_0xd5c4('0x21')](function(_0x5a80e7){_0x55c244['count']=_0x5a80e7;if(_0x800607[_0xd5c4('0x29')][_0xd5c4('0x39')]){_0x1374bc[_0xd5c4('0x3a')]=[{'all':!![]}];}return db[_0xd5c4('0x3b')][_0xd5c4('0x3c')](_0x1374bc);})[_0xd5c4('0x21')](function(_0x1a670a){_0x55c244[_0xd5c4('0x3d')]=_0x1a670a;return _0x55c244;})[_0xd5c4('0x21')](respondWithFilteredResult(_0x38f092,_0x1374bc))[_0xd5c4('0x3e')](handleError(_0x38f092,null));};exports['show']=function(_0xc5ae67,_0x325ae7){var _0x304eb3={'raw':!![],'where':{'id':_0xc5ae67[_0xd5c4('0x3f')]['id']}},_0x5928fc={};_0x5928fc[_0xd5c4('0x28')]=_[_0xd5c4('0x40')](db[_0xd5c4('0x3b')][_0xd5c4('0x41')]);_0x5928fc[_0xd5c4('0x29')]=_[_0xd5c4('0x40')](_0xc5ae67[_0xd5c4('0x29')]);_0x5928fc[_0xd5c4('0x2a')]=_[_0xd5c4('0x2b')](_0x5928fc[_0xd5c4('0x28')],_0x5928fc[_0xd5c4('0x29')]);_0x304eb3['attributes']=_[_0xd5c4('0x2b')](_0x5928fc[_0xd5c4('0x28')],qs[_0xd5c4('0x2d')](_0xc5ae67[_0xd5c4('0x29')][_0xd5c4('0x2d')]));_0x304eb3[_0xd5c4('0x2c')]=_0x304eb3[_0xd5c4('0x2c')][_0xd5c4('0x42')]?_0x304eb3[_0xd5c4('0x2c')]:_0x5928fc[_0xd5c4('0x28')];if(_0xc5ae67[_0xd5c4('0x29')][_0xd5c4('0x39')]){_0x304eb3[_0xd5c4('0x3a')]=[{'all':!![]}];}_0x304eb3=_[_0xd5c4('0x36')]({},_0x304eb3,_0xc5ae67[_0xd5c4('0x38')]);return db[_0xd5c4('0x3b')][_0xd5c4('0x43')](_0x304eb3)[_0xd5c4('0x21')](handleEntityNotFound(_0x325ae7,null))['then'](respondWithResult(_0x325ae7,null))[_0xd5c4('0x3e')](handleError(_0x325ae7,null));};exports['create']=function(_0x484978,_0x4d15d3){return db[_0xd5c4('0x3b')][_0xd5c4('0x44')](_0x484978[_0xd5c4('0x45')],{})['then'](respondWithResult(_0x4d15d3,0xc9))['catch'](handleError(_0x4d15d3,null));};exports[_0xd5c4('0x1f')]=function(_0x19e76c,_0xbf1d8e){if(_0x19e76c[_0xd5c4('0x45')]['id']){delete _0x19e76c[_0xd5c4('0x45')]['id'];}return db[_0xd5c4('0x3b')]['find']({'where':{'id':_0x19e76c[_0xd5c4('0x3f')]['id']}})[_0xd5c4('0x21')](handleEntityNotFound(_0xbf1d8e,null))['then'](saveUpdates(_0x19e76c['body'],null))['then'](respondWithResult(_0xbf1d8e,null))[_0xd5c4('0x3e')](handleError(_0xbf1d8e,null));};exports[_0xd5c4('0x20')]=function(_0x354e07,_0x431ce5){return db['VoiceDialReport'][_0xd5c4('0x43')]({'where':{'id':_0x354e07['params']['id']}})['then'](handleEntityNotFound(_0x431ce5,null))[_0xd5c4('0x21')](removeEntity(_0x431ce5,null))['catch'](handleError(_0x431ce5,null));};exports[_0xd5c4('0x46')]=function(_0x3c4da1,_0x906e8e){return db[_0xd5c4('0x3b')][_0xd5c4('0x46')]()[_0xd5c4('0x21')](respondWithResult(_0x906e8e,null))[_0xd5c4('0x3e')](handleError(_0x906e8e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5ce9b85..6c51957 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 _0xec44=['../../config/environment','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a558e,_0x2c0473){var _0x44eb26=function(_0x1841b4){while(--_0x1841b4){_0x5a558e['push'](_0x5a558e['shift']());}};_0x44eb26(++_0x2c0473);}(_0xec44,0xe0));var _0x4ec4=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xec44[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x4ec4('0x0'));var util=require(_0x4ec4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ec4('0x2'));var BPromise=require(_0x4ec4('0x3'));var rp=require(_0x4ec4('0x4'));var fs=require('fs');var path=require(_0x4ec4('0x5'));var rimraf=require(_0x4ec4('0x6'));var config=require(_0x4ec4('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x437b47,_0x55f63a){return _0x437b47['define'](_0x4ec4('0x8'),attributes,{'tableName':_0x4ec4('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4ec4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec62=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes'];(function(_0x585228,_0x223672){var _0x5b3223=function(_0x33496a){while(--_0x33496a){_0x585228['push'](_0x585228['shift']());}};_0x5b3223(++_0x223672);}(_0xec62,0x1bf));var _0x2ec6=function(_0x1ff2c7,_0x506fa9){_0x1ff2c7=_0x1ff2c7-0x0;var _0xe6362=_0xec62[_0x1ff2c7];return _0xe6362;};'use strict';var _=require(_0x2ec6('0x0'));var util=require(_0x2ec6('0x1'));var logger=require('../../config/logger')(_0x2ec6('0x2'));var moment=require('moment');var BPromise=require(_0x2ec6('0x3'));var rp=require(_0x2ec6('0x4'));var fs=require('fs');var path=require(_0x2ec6('0x5'));var rimraf=require('rimraf');var config=require(_0x2ec6('0x6'));var attributes=require(_0x2ec6('0x7'));module[_0x2ec6('0x8')]=function(_0x57ac20,_0xbebefa){return _0x57ac20[_0x2ec6('0x9')](_0x2ec6('0xa'),attributes,{'tableName':_0x2ec6('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2ec6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d6d3784..2646145 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 _0x4ea3=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x5cbe79,_0x147723){var _0x416ce0=function(_0x49f478){while(--_0x49f478){_0x5cbe79['push'](_0x5cbe79['shift']());}};_0x416ce0(++_0x147723);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});}exports[_0x34ea('0x15')]=function(_0x34caea){var _0x5aeea3=this;return new Promise(function(_0x5340a4,_0x72fef0){return db[_0x34ea('0x16')][_0x34ea('0x17')](_0x34caea[_0x34ea('0x18')],{'raw':_0x34caea['options']?_0x34caea[_0x34ea('0x19')][_0x34ea('0x1a')]===undefined?!![]:![]:!![]})[_0x34ea('0xb')](function(_0x247ee7){logger['info']('CreateVoiceDialReport',_0x34caea);logger[_0x34ea('0x1b')](_0x34ea('0x15'),_0x34caea,JSON[_0x34ea('0x10')](_0x247ee7));_0x5340a4(_0x247ee7);})['catch'](function(_0x5197a2){logger[_0x34ea('0x11')](_0x34ea('0x15'),_0x5197a2[_0x34ea('0x13')],_0x34caea);_0x72fef0(_0x5aeea3[_0x34ea('0x11')](0x1f4,_0x5197a2[_0x34ea('0x13')]));});});};exports[_0x34ea('0x1c')]=function(_0x5ade46){var _0xf24962=this;return new Promise(function(_0x46671f,_0x3c0983){return db[_0x34ea('0x16')]['update'](_0x5ade46['body'],{'raw':_0x5ade46['options']?_0x5ade46[_0x34ea('0x19')][_0x34ea('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ade46[_0x34ea('0x19')]?_0x5ade46[_0x34ea('0x19')]['where']||null:null,'attributes':_0x5ade46[_0x34ea('0x19')]?_0x5ade46[_0x34ea('0x19')][_0x34ea('0x1d')]||null:null,'limit':_0x5ade46['options']?_0x5ade46['options']['limit']||null:null})['then'](function(_0x2942ce){logger[_0x34ea('0xc')](_0x34ea('0x1c'),_0x5ade46);logger[_0x34ea('0x1b')]('UpdateVoiceDialReport',_0x5ade46,JSON[_0x34ea('0x10')](_0x2942ce));_0x46671f(_0x2942ce);})['catch'](function(_0x2c6de8){logger['error'](_0x34ea('0x1c'),_0x2c6de8[_0x34ea('0x13')],_0x5ade46);_0x3c0983(_0xf24962[_0x34ea('0x11')](0x1f4,_0x2c6de8['message']));});});}; \ No newline at end of file +var _0x7ee1=['options','raw','UpdateVoiceDialReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x53309c,_0x21c68a){var _0x13d243=function(_0x3e4932){while(--_0x3e4932){_0x53309c['push'](_0x53309c['shift']());}};_0x13d243(++_0x21c68a);}(_0x7ee1,0xab));var _0x17ee=function(_0x1d2602,_0x4e75ea){_0x1d2602=_0x1d2602-0x0;var _0x5665a7=_0x7ee1[_0x1d2602];return _0x5665a7;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rs=require(_0x17ee('0x3'));var fs=require('fs');var Redis=require(_0x17ee('0x4'));var db=require(_0x17ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17ee('0x7'));var client=jayson[_0x17ee('0x8')][_0x17ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6b4c,_0x28cc37,_0x59b876){return new BPromise(function(_0x314088,_0x59a51e){return client[_0x17ee('0xa')](_0x3e6b4c,_0x59b876)[_0x17ee('0xb')](function(_0x56b583){logger[_0x17ee('0xc')](_0x17ee('0xd'),_0x28cc37,_0x17ee('0xe'));logger[_0x17ee('0xf')](_0x17ee('0x10'),_0x28cc37,_0x17ee('0xe'),JSON[_0x17ee('0x11')](_0x56b583));if(_0x56b583[_0x17ee('0x12')]){if(_0x56b583[_0x17ee('0x12')][_0x17ee('0x13')]===0x1f4){logger[_0x17ee('0x12')](_0x17ee('0xd'),_0x28cc37,_0x56b583['error'][_0x17ee('0x14')]);return _0x59a51e(_0x56b583[_0x17ee('0x12')]['message']);}logger[_0x17ee('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x28cc37,_0x56b583[_0x17ee('0x12')][_0x17ee('0x14')]);return _0x314088(_0x56b583[_0x17ee('0x12')][_0x17ee('0x14')]);}else{logger['info'](_0x17ee('0xd'),_0x28cc37,_0x17ee('0xe'));_0x314088(_0x56b583[_0x17ee('0x15')]['message']);}})[_0x17ee('0x16')](function(_0x47c346){logger[_0x17ee('0x12')](_0x17ee('0xd'),_0x28cc37,_0x47c346);_0x59a51e(_0x47c346);});});}exports[_0x17ee('0x17')]=function(_0x3785ed){var _0x15d245=this;return new Promise(function(_0x5506a3,_0x536c75){return db[_0x17ee('0x18')][_0x17ee('0x19')](_0x3785ed[_0x17ee('0x1a')],{'raw':_0x3785ed[_0x17ee('0x1b')]?_0x3785ed['options'][_0x17ee('0x1c')]===undefined?!![]:![]:!![]})[_0x17ee('0xb')](function(_0x25782c){logger[_0x17ee('0xc')]('CreateVoiceDialReport',_0x3785ed);logger[_0x17ee('0xf')](_0x17ee('0x17'),_0x3785ed,JSON[_0x17ee('0x11')](_0x25782c));_0x5506a3(_0x25782c);})['catch'](function(_0x3672df){logger[_0x17ee('0x12')](_0x17ee('0x17'),_0x3672df[_0x17ee('0x14')],_0x3785ed);_0x536c75(_0x15d245[_0x17ee('0x12')](0x1f4,_0x3672df['message']));});});};exports[_0x17ee('0x1d')]=function(_0xc01da5){var _0xf20fe0=this;return new Promise(function(_0x1ce8c7,_0x88a4af){return db[_0x17ee('0x18')][_0x17ee('0x1e')](_0xc01da5[_0x17ee('0x1a')],{'raw':_0xc01da5['options']?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x1f')]||null:null,'attributes':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5['options']['attributes']||null:null,'limit':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x20')]||null:null})['then'](function(_0x393231){logger[_0x17ee('0xc')](_0x17ee('0x1d'),_0xc01da5);logger['debug'](_0x17ee('0x1d'),_0xc01da5,JSON[_0x17ee('0x11')](_0x393231));_0x1ce8c7(_0x393231);})[_0x17ee('0x16')](function(_0x1e5727){logger['error'](_0x17ee('0x1d'),_0x1e5727[_0x17ee('0x14')],_0xc01da5);_0x88a4af(_0xf20fe0[_0x17ee('0x12')](0x1f4,_0x1e5727['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8229f61..1413f50 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 _0xf18c=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','post','/:id/applications'];(function(_0x1e01ef,_0x110097){var _0x123a12=function(_0x2034fa){while(--_0x2034fa){_0x1e01ef['push'](_0x1e01ef['shift']());}};_0x123a12(++_0x110097);}(_0xf18c,0x1a7));var _0xcf18=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xf18c[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xcf18('0x0'));var util=require(_0xcf18('0x1'));var path=require('path');var timeout=require(_0xcf18('0x2'));var express=require(_0xcf18('0x3'));var router=express[_0xcf18('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf18('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xcf18('0x6')]('/',auth[_0xcf18('0x7')](),controller[_0xcf18('0x8')]);router[_0xcf18('0x6')](_0xcf18('0x9'),auth[_0xcf18('0x7')](),controller[_0xcf18('0xa')]);router['post']('/',auth[_0xcf18('0x7')](),controller[_0xcf18('0xb')]);router[_0xcf18('0xc')](_0xcf18('0xd'),auth[_0xcf18('0x7')](),controller['addApplications']);router[_0xcf18('0xe')](_0xcf18('0x9'),auth[_0xcf18('0x7')](),controller[_0xcf18('0xf')]);router[_0xcf18('0x10')](_0xcf18('0x9'),auth['isAuthenticated'](),controller[_0xcf18('0x11')]);module[_0xcf18('0x12')]=router; \ No newline at end of file +var _0xbb72=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0xbb72,0xce));var _0x2bb7=function(_0x13ab4b,_0x1cdd73){_0x13ab4b=_0x13ab4b-0x0;var _0x4d8f18=_0xbb72[_0x13ab4b];return _0x4d8f18;};'use strict';var multer=require(_0x2bb7('0x0'));var util=require(_0x2bb7('0x1'));var path=require(_0x2bb7('0x2'));var timeout=require(_0x2bb7('0x3'));var express=require('express');var router=express[_0x2bb7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2bb7('0x5'));var config=require(_0x2bb7('0x6'));var controller=require(_0x2bb7('0x7'));router[_0x2bb7('0x8')]('/',auth['isAuthenticated'](),controller[_0x2bb7('0x9')]);router[_0x2bb7('0x8')](_0x2bb7('0xa'),auth[_0x2bb7('0xb')](),controller[_0x2bb7('0xc')]);router['post']('/',auth[_0x2bb7('0xb')](),controller['create']);router['post'](_0x2bb7('0xd'),auth[_0x2bb7('0xb')](),controller[_0x2bb7('0xe')]);router[_0x2bb7('0xf')](_0x2bb7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2bb7('0x10')](_0x2bb7('0xa'),auth[_0x2bb7('0xb')](),controller[_0x2bb7('0x11')]);module[_0x2bb7('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 198d940..631ee8b 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(_0x13dba8,_0x1bcc59){var _0x2c4438=function(_0x388a97){while(--_0x388a97){_0x13dba8['push'](_0x13dba8['shift']());}};_0x2c4438(++_0x1bcc59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x4552ad,_0xb1a6e4){var _0xe9700b=function(_0x29a723){while(--_0x29a723){_0x4552ad['push'](_0x4552ad['shift']());}};_0xe9700b(++_0xb1a6e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 6e07d3e..b5f2143 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 _0x1261=['includeAll','include','rows','params','catch','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','mandatoryDisposition','transaction','VoiceExtensionId','cast(priority\x20as\x20unsigned)','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','./voiceExtension.socket','register','sendStatus','status','json','offset','set','Content-Range','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','find','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','count'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1261,0x144));var _0x1126=function(_0x5bce33,_0x4a4b06){_0x5bce33=_0x5bce33-0x0;var _0x15bc20=_0x1261[_0x5bce33];return _0x15bc20;};'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(){var _0x329914=_0x4b57ab[_0x1126('0x28')]({'plain':!![]});var _0x566c09=[{'name':_0x1126('0x29'),'value':_0x1126('0x2a'),'ignore':![]},{'name':_0x1126('0x2b'),'value':'outbound','ignore':![]},{'name':_0x1126('0x2c'),'value':_0x1126('0x2d'),'ignore':![]}];var _0xa293f4=_(_0x566c09)['filter']('ignore')[_0x1126('0x2e')](_0x1126('0x2f'))['value']();if(_[_0x1126('0x30')](_0xa293f4,_0x329914[_0x1126('0x31')])){return;}var _0x4a334a=_[_0x1126('0x32')](_0x566c09,['value',_0x329914[_0x1126('0x31')]])['name'];return db[_0x1126('0x33')]['destroy']({'where':{'type':_0x4a334a,'resourceId':_0x329914['id']}})[_0x1126('0x27')](function(){return _0x4b57ab;});})['then'](function(){_0x59cd8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17646e,_0xa8906d){return function(_0x1cef48){if(!_0x1cef48){_0x17646e['sendStatus'](0x194);}return _0x1cef48;};}function handleError(_0x2a3055,_0x226afb){_0x226afb=_0x226afb||0x1f4;return function(_0x56f7f8){logger[_0x1126('0x34')](_0x56f7f8[_0x1126('0x35')]);if(_0x56f7f8[_0x1126('0x36')]){delete _0x56f7f8[_0x1126('0x36')];}_0x2a3055['status'](_0x226afb)['send'](_0x56f7f8);};}exports[_0x1126('0x37')]=function(_0x19e6e4,_0x2d9bd2){var _0x2c67eb={},_0x55244a={},_0x145314={'count':0x0,'rows':[]};var _0x6f4312=_[_0x1126('0x2e')](db[_0x1126('0x38')][_0x1126('0x39')],function(_0x5df232){return{'name':_0x5df232[_0x1126('0x3a')],'type':_0x5df232[_0x1126('0x31')][_0x1126('0x3b')]};});_0x55244a[_0x1126('0x3c')]=_['map'](_0x6f4312,'name');_0x55244a[_0x1126('0x3d')]=_[_0x1126('0x3e')](_0x19e6e4['query']);_0x55244a[_0x1126('0x3f')]=_[_0x1126('0x40')](_0x55244a[_0x1126('0x3c')],_0x55244a['query']);_0x2c67eb['attributes']=_[_0x1126('0x40')](_0x55244a[_0x1126('0x3c')],qs[_0x1126('0x41')](_0x19e6e4[_0x1126('0x3d')]['fields']));_0x2c67eb[_0x1126('0x42')]=_0x2c67eb['attributes'][_0x1126('0x43')]?_0x2c67eb[_0x1126('0x42')]:_0x55244a[_0x1126('0x3c')];if(!_0x19e6e4[_0x1126('0x3d')][_0x1126('0x44')]('nolimit')){_0x2c67eb[_0x1126('0x45')]=qs[_0x1126('0x45')](_0x19e6e4[_0x1126('0x3d')][_0x1126('0x45')]);_0x2c67eb[_0x1126('0x20')]=qs[_0x1126('0x20')](_0x19e6e4[_0x1126('0x3d')]['offset']);}_0x2c67eb[_0x1126('0x46')]=qs[_0x1126('0x47')](_0x19e6e4[_0x1126('0x3d')][_0x1126('0x47')]);_0x2c67eb[_0x1126('0x48')]=qs['filters'](_['pick'](_0x19e6e4[_0x1126('0x3d')],_0x55244a[_0x1126('0x3f')]),_0x6f4312);if(_0x19e6e4[_0x1126('0x3d')][_0x1126('0x49')]){_0x2c67eb[_0x1126('0x48')]=_[_0x1126('0x4a')](_0x2c67eb['where'],{'$or':_['map'](_0x6f4312,function(_0x4cb1db){if(_0x4cb1db[_0x1126('0x31')]!=='VIRTUAL'){var _0xf84005={};_0xf84005[_0x4cb1db[_0x1126('0x36')]]={'$like':'%'+_0x19e6e4[_0x1126('0x3d')][_0x1126('0x49')]+'%'};return _0xf84005;}})});}_0x2c67eb=_['merge']({},_0x2c67eb,_0x19e6e4['options']);var _0x353042={'where':_0x2c67eb[_0x1126('0x48')]};return db[_0x1126('0x38')]['count'](_0x353042)[_0x1126('0x27')](function(_0x5f35fa){_0x145314[_0x1126('0x4b')]=_0x5f35fa;if(_0x19e6e4['query'][_0x1126('0x4c')]){_0x2c67eb[_0x1126('0x4d')]=[{'all':!![]}];}return db[_0x1126('0x38')]['findAll'](_0x2c67eb);})[_0x1126('0x27')](function(_0x2ffccc){_0x145314[_0x1126('0x4e')]=_0x2ffccc;return _0x145314;})['then'](respondWithFilteredResult(_0x2d9bd2,_0x2c67eb))['catch'](handleError(_0x2d9bd2,null));};exports['show']=function(_0x6e78cf,_0x520b62){var _0x1e197e={'raw':![],'where':{'id':_0x6e78cf[_0x1126('0x4f')]['id']}},_0x507568={};_0x507568[_0x1126('0x3c')]=_[_0x1126('0x3e')](db[_0x1126('0x38')][_0x1126('0x39')]);_0x507568['query']=_[_0x1126('0x3e')](_0x6e78cf[_0x1126('0x3d')]);_0x507568['filters']=_[_0x1126('0x40')](_0x507568[_0x1126('0x3c')],_0x507568['query']);_0x1e197e[_0x1126('0x42')]=_[_0x1126('0x40')](_0x507568['model'],qs[_0x1126('0x41')](_0x6e78cf[_0x1126('0x3d')][_0x1126('0x41')]));_0x1e197e['attributes']=_0x1e197e[_0x1126('0x42')][_0x1126('0x43')]?_0x1e197e[_0x1126('0x42')]:_0x507568[_0x1126('0x3c')];if(_0x6e78cf[_0x1126('0x3d')][_0x1126('0x4c')]){_0x1e197e[_0x1126('0x4d')]=[{'all':!![]}];}_0x1e197e=_[_0x1126('0x4a')]({},_0x1e197e,_0x6e78cf['options']);return db[_0x1126('0x38')]['find'](_0x1e197e)[_0x1126('0x27')](handleEntityNotFound(_0x520b62,null))[_0x1126('0x27')](respondWithResult(_0x520b62,null))['catch'](handleError(_0x520b62,null));};exports['destroy']=function(_0x324995,_0x3c1d16){return db[_0x1126('0x38')]['find']({'where':{'id':_0x324995[_0x1126('0x4f')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x3c1d16,null))[_0x1126('0x27')](removeEntity(_0x3c1d16,null))[_0x1126('0x50')](handleError(_0x3c1d16,null));};exports['create']=function(_0x30d1b3,_0x46551f){if(_0x30d1b3['body']['type']==='outbound'&&!_['startsWith'](_0x30d1b3[_0x1126('0x51')][_0x1126('0x52')],'_')){_0x30d1b3['body'][_0x1126('0x52')]='_'[_0x1126('0x53')](_0x30d1b3[_0x1126('0x51')][_0x1126('0x52')]);}return db[_0x1126('0x38')]['create'](_0x30d1b3[_0x1126('0x51')],{'raw':![]})[_0x1126('0x27')](function(_0x5d6414){var _0x322016=_0x30d1b3[_0x1126('0x54')][_0x1126('0x28')]({'plain':!![]});if(!_0x322016)throw new Error(_0x1126('0x55'));if(_0x322016[_0x1126('0x56')]==='user'){var _0x673c09=_0x5d6414['get']({'plain':!![]});var _0x868b2c=[{'name':_0x1126('0x29'),'value':_0x1126('0x2a')},{'name':'OutboundRoutes','value':_0x1126('0x57')},{'name':_0x1126('0x2c'),'value':'internal'}];var _0x30812d=_[_0x1126('0x32')](_0x868b2c,[_0x1126('0x2f'),_0x673c09['type']])[_0x1126('0x36')];return db[_0x1126('0x58')][_0x1126('0x32')]({'where':{'name':_0x30812d,'userProfileId':_0x322016[_0x1126('0x59')]},'raw':!![]})[_0x1126('0x27')](function(_0x26949c){if(_0x26949c&&_0x26949c[_0x1126('0x5a')]===0x0){return db[_0x1126('0x33')]['create']({'name':_0x673c09[_0x1126('0x36')],'resourceId':_0x673c09['id'],'type':_0x26949c[_0x1126('0x36')],'sectionId':_0x26949c['id']},{})[_0x1126('0x27')](function(){return _0x5d6414;});}else{return _0x5d6414;}})[_0x1126('0x50')](function(_0x425193){logger['error'](_0x1126('0x5b'),_0x425193);throw _0x425193;});}return _0x5d6414;})[_0x1126('0x27')](respondWithResult(_0x46551f,0xc9))['catch'](handleError(_0x46551f,null));};exports[_0x1126('0x25')]=function(_0x5246aa,_0x272274){if(_0x5246aa[_0x1126('0x51')]['id']){delete _0x5246aa['body']['id'];}return db[_0x1126('0x38')][_0x1126('0x32')]({'where':{'id':_0x5246aa[_0x1126('0x4f')]['id']}})['then'](handleEntityNotFound(_0x272274,null))[_0x1126('0x27')](function(_0x4c1384){if(_0x4c1384){return db['VoiceExtension'][_0x1126('0x25')](_[_0x1126('0x5c')](_0x5246aa[_0x1126('0x51')],[_0x1126('0x52'),_0x1126('0x5d'),_0x1126('0x5e'),_0x1126('0x5f'),'cutdigits',_0x1126('0x60')]),{'where':{'context':_0x4c1384[_0x1126('0x5d')],'exten':_0x4c1384[_0x1126('0x52')]},'individualHooks':!![]})[_0x1126('0x27')](function(_0x3f87aa){return _0x3f87aa;});}return null;})[_0x1126('0x27')](respondWithStatusCode(_0x272274,null))['catch'](handleError(_0x272274,null));};exports['addApplications']=function(_0x16a343,_0x3921c2,_0x4bf2b3){return db['VoiceExtension']['findOne']({'where':{'id':_0x16a343['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x3921c2,null))[_0x1126('0x27')](function(_0x3440c5){if(_0x3440c5){return db['sequelize'][_0x1126('0x61')](function(_0x45c782){return db[_0x1126('0x38')][_0x1126('0x26')]({'where':{'VoiceExtensionId':_0x16a343[_0x1126('0x4f')]['id']},'transaction':_0x45c782})[_0x1126('0x27')](function(_0x131056){var _0x49a0a3=_[_0x1126('0x2e')](_0x16a343[_0x1126('0x51')],function(_0x43bd70){_0x43bd70[_0x1126('0x62')]=_0x16a343[_0x1126('0x4f')]['id'];return _0x43bd70;});return db['VoiceExtension']['bulkCreate'](_0x49a0a3,{'transaction':_0x45c782});});})[_0x1126('0x27')](function(){return db[_0x1126('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x16a343[_0x1126('0x4f')]['id']},'order':_0x1126('0x63')});});}})[_0x1126('0x27')](respondWithResult(_0x3921c2,null))[_0x1126('0x50')](handleError(_0x3921c2,null));}; \ No newline at end of file +var _0xba34=['inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','length','include','create','body','outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','context','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','get','InboundRoutes'];(function(_0x37c109,_0x181d37){var _0x42fdec=function(_0x12bd0e){while(--_0x12bd0e){_0x37c109['push'](_0x37c109['shift']());}};_0x42fdec(++_0x181d37);}(_0xba34,0x119));var _0x4ba3=function(_0x63dea0,_0x24d71e){_0x63dea0=_0x63dea0-0x0;var _0x116caa=_0xba34[_0x63dea0];return _0x116caa;};'use strict';var pdf=require(_0x4ba3('0x0'));var emlformat=require(_0x4ba3('0x1'));var rimraf=require(_0x4ba3('0x2'));var zipdir=require(_0x4ba3('0x3'));var jsonpatch=require(_0x4ba3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ba3('0x5'));var util=require(_0x4ba3('0x6'));var path=require(_0x4ba3('0x7'));var sox=require(_0x4ba3('0x8'));var csv=require(_0x4ba3('0x9'));var ejs=require(_0x4ba3('0xa'));var fs=require('fs');var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x9'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var db=require(_0x4ba3('0x18'))['db'];config['redis']=_[_0x4ba3('0x19')](config['redis'],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x1c')]));require(_0x4ba3('0x1d'))[_0x4ba3('0x1e')](socket);function respondWithStatusCode(_0x3d2ace,_0x3a74f7){_0x3a74f7=_0x3a74f7||0xcc;return function(_0x12ac90){if(_0x12ac90){return _0x3d2ace[_0x4ba3('0x1f')](_0x3a74f7);}return _0x3d2ace[_0x4ba3('0x20')](_0x3a74f7)[_0x4ba3('0x21')]();};}function respondWithResult(_0x301359,_0x29a9d1){_0x29a9d1=_0x29a9d1||0xc8;return function(_0x25f584){if(_0x25f584){return _0x301359[_0x4ba3('0x20')](_0x29a9d1)[_0x4ba3('0x22')](_0x25f584);}};}function respondWithFilteredResult(_0x58d20a,_0x382fd0){return function(_0x788277){if(_0x788277){var _0x5ff7ce=_0x788277[_0x4ba3('0x23')],_0x451c92=_0x382fd0[_0x4ba3('0x24')],_0x556290=_0x382fd0[_0x4ba3('0x24')]+_0x382fd0[_0x4ba3('0x25')],_0x2519bb;if(_0x556290>=_0x5ff7ce){_0x556290=_0x5ff7ce;_0x2519bb=0xc8;}else{_0x2519bb=0xce;}_0x58d20a[_0x4ba3('0x20')](_0x2519bb);return _0x58d20a['set']('Content-Range',_0x451c92+'-'+_0x556290+'/'+_0x5ff7ce)[_0x4ba3('0x22')](_0x788277);}return null;};}function patchUpdates(_0x579d9f){return function(_0x18dff5){try{jsonpatch[_0x4ba3('0x26')](_0x18dff5,_0x579d9f,!![]);}catch(_0x413bb3){return BPromise[_0x4ba3('0x27')](_0x413bb3);}return _0x18dff5[_0x4ba3('0x28')]();};}function saveUpdates(_0x278a23,_0x4a0823){return function(_0x143c78){if(_0x143c78){return _0x143c78[_0x4ba3('0x29')](_0x278a23)['then'](function(_0x28bb3d){return _0x28bb3d;});}return null;};}function removeEntity(_0x4ffe39,_0x1ae4de){return function(_0x18abb3){if(_0x18abb3){return _0x18abb3[_0x4ba3('0x2a')]()[_0x4ba3('0x2b')](function(){var _0x152e41=_0x18abb3[_0x4ba3('0x2c')]({'plain':!![]});var _0x159596=[{'name':_0x4ba3('0x2d'),'value':_0x4ba3('0x2e'),'ignore':![]},{'name':_0x4ba3('0x2f'),'value':'outbound','ignore':![]},{'name':_0x4ba3('0x30'),'value':_0x4ba3('0x31'),'ignore':![]}];var _0x2311ed=_(_0x159596)['filter'](_0x4ba3('0x32'))[_0x4ba3('0x33')](_0x4ba3('0x34'))['value']();if(_[_0x4ba3('0x35')](_0x2311ed,_0x152e41[_0x4ba3('0x36')])){return;}var _0x34ecb4=_[_0x4ba3('0x37')](_0x159596,['value',_0x152e41['type']])[_0x4ba3('0x38')];return db[_0x4ba3('0x39')][_0x4ba3('0x2a')]({'where':{'type':_0x34ecb4,'resourceId':_0x152e41['id']}})[_0x4ba3('0x2b')](function(){return _0x18abb3;});})[_0x4ba3('0x2b')](function(){_0x4ffe39[_0x4ba3('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27444b,_0x28f36c){return function(_0x24d8fc){if(!_0x24d8fc){_0x27444b[_0x4ba3('0x1f')](0x194);}return _0x24d8fc;};}function handleError(_0x2a6757,_0x1a7a2c){_0x1a7a2c=_0x1a7a2c||0x1f4;return function(_0x457236){logger[_0x4ba3('0x3a')](_0x457236[_0x4ba3('0x3b')]);if(_0x457236[_0x4ba3('0x38')]){delete _0x457236['name'];}_0x2a6757['status'](_0x1a7a2c)['send'](_0x457236);};}exports[_0x4ba3('0x3c')]=function(_0xd033d7,_0x41b4eb){var _0x4372cb={},_0x3eea33={},_0x137f9b={'count':0x0,'rows':[]};var _0x137551=_[_0x4ba3('0x33')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')],function(_0x437a20){return{'name':_0x437a20[_0x4ba3('0x3f')],'type':_0x437a20['type'][_0x4ba3('0x40')]};});_0x3eea33[_0x4ba3('0x41')]=_[_0x4ba3('0x33')](_0x137551,'name');_0x3eea33[_0x4ba3('0x42')]=_['keys'](_0xd033d7[_0x4ba3('0x42')]);_0x3eea33[_0x4ba3('0x43')]=_[_0x4ba3('0x44')](_0x3eea33[_0x4ba3('0x41')],_0x3eea33[_0x4ba3('0x42')]);_0x4372cb[_0x4ba3('0x45')]=_['intersection'](_0x3eea33[_0x4ba3('0x41')],qs[_0x4ba3('0x46')](_0xd033d7[_0x4ba3('0x42')]['fields']));_0x4372cb[_0x4ba3('0x45')]=_0x4372cb[_0x4ba3('0x45')]['length']?_0x4372cb[_0x4ba3('0x45')]:_0x3eea33['model'];if(!_0xd033d7['query'][_0x4ba3('0x47')](_0x4ba3('0x48'))){_0x4372cb[_0x4ba3('0x25')]=qs[_0x4ba3('0x25')](_0xd033d7[_0x4ba3('0x42')]['limit']);_0x4372cb[_0x4ba3('0x24')]=qs[_0x4ba3('0x24')](_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x24')]);}_0x4372cb[_0x4ba3('0x49')]=qs[_0x4ba3('0x4a')](_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x4a')]);_0x4372cb['where']=qs[_0x4ba3('0x43')](_[_0x4ba3('0x4b')](_0xd033d7[_0x4ba3('0x42')],_0x3eea33[_0x4ba3('0x43')]),_0x137551);if(_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x4c')]){_0x4372cb[_0x4ba3('0x4d')]=_[_0x4ba3('0x4e')](_0x4372cb[_0x4ba3('0x4d')],{'$or':_[_0x4ba3('0x33')](_0x137551,function(_0x3b9a0a){if(_0x3b9a0a[_0x4ba3('0x36')]!==_0x4ba3('0x4f')){var _0x28b649={};_0x28b649[_0x3b9a0a['name']]={'$like':'%'+_0xd033d7['query']['filter']+'%'};return _0x28b649;}})});}_0x4372cb=_['merge']({},_0x4372cb,_0xd033d7['options']);var _0x1df753={'where':_0x4372cb['where']};return db[_0x4ba3('0x3d')]['count'](_0x1df753)[_0x4ba3('0x2b')](function(_0x2ac317){_0x137f9b[_0x4ba3('0x23')]=_0x2ac317;if(_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x50')]){_0x4372cb['include']=[{'all':!![]}];}return db[_0x4ba3('0x3d')]['findAll'](_0x4372cb);})[_0x4ba3('0x2b')](function(_0x50f27a){_0x137f9b[_0x4ba3('0x51')]=_0x50f27a;return _0x137f9b;})[_0x4ba3('0x2b')](respondWithFilteredResult(_0x41b4eb,_0x4372cb))[_0x4ba3('0x52')](handleError(_0x41b4eb,null));};exports[_0x4ba3('0x53')]=function(_0xc23afe,_0xb5b940){var _0x1e8e96={'raw':![],'where':{'id':_0xc23afe[_0x4ba3('0x54')]['id']}},_0x5d5714={};_0x5d5714[_0x4ba3('0x41')]=_[_0x4ba3('0x55')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')]);_0x5d5714['query']=_['keys'](_0xc23afe[_0x4ba3('0x42')]);_0x5d5714[_0x4ba3('0x43')]=_[_0x4ba3('0x44')](_0x5d5714['model'],_0x5d5714[_0x4ba3('0x42')]);_0x1e8e96[_0x4ba3('0x45')]=_[_0x4ba3('0x44')](_0x5d5714['model'],qs['fields'](_0xc23afe[_0x4ba3('0x42')]['fields']));_0x1e8e96[_0x4ba3('0x45')]=_0x1e8e96[_0x4ba3('0x45')][_0x4ba3('0x56')]?_0x1e8e96[_0x4ba3('0x45')]:_0x5d5714[_0x4ba3('0x41')];if(_0xc23afe[_0x4ba3('0x42')]['includeAll']){_0x1e8e96[_0x4ba3('0x57')]=[{'all':!![]}];}_0x1e8e96=_[_0x4ba3('0x4e')]({},_0x1e8e96,_0xc23afe['options']);return db[_0x4ba3('0x3d')][_0x4ba3('0x37')](_0x1e8e96)[_0x4ba3('0x2b')](handleEntityNotFound(_0xb5b940,null))[_0x4ba3('0x2b')](respondWithResult(_0xb5b940,null))[_0x4ba3('0x52')](handleError(_0xb5b940,null));};exports['destroy']=function(_0x37a312,_0x38de05){return db['VoiceExtension'][_0x4ba3('0x37')]({'where':{'id':_0x37a312[_0x4ba3('0x54')]['id']}})[_0x4ba3('0x2b')](handleEntityNotFound(_0x38de05,null))[_0x4ba3('0x2b')](removeEntity(_0x38de05,null))[_0x4ba3('0x52')](handleError(_0x38de05,null));};exports[_0x4ba3('0x58')]=function(_0x45dae5,_0x1ab3fe){if(_0x45dae5[_0x4ba3('0x59')][_0x4ba3('0x36')]===_0x4ba3('0x5a')&&!_[_0x4ba3('0x5b')](_0x45dae5[_0x4ba3('0x59')][_0x4ba3('0x5c')],'_')){_0x45dae5[_0x4ba3('0x59')]['exten']='_'['concat'](_0x45dae5['body'][_0x4ba3('0x5c')]);}return db[_0x4ba3('0x3d')][_0x4ba3('0x58')](_0x45dae5[_0x4ba3('0x59')],{'raw':![]})[_0x4ba3('0x2b')](function(_0x57e25a){var _0x3920c0=_0x45dae5[_0x4ba3('0x5d')][_0x4ba3('0x2c')]({'plain':!![]});if(!_0x3920c0)throw new Error(_0x4ba3('0x5e'));if(_0x3920c0[_0x4ba3('0x5f')]===_0x4ba3('0x5d')){var _0xd2327c=_0x57e25a[_0x4ba3('0x2c')]({'plain':!![]});var _0x37a0a0=[{'name':_0x4ba3('0x2d'),'value':_0x4ba3('0x2e')},{'name':_0x4ba3('0x2f'),'value':_0x4ba3('0x5a')},{'name':_0x4ba3('0x30'),'value':'internal'}];var _0x20c849=_[_0x4ba3('0x37')](_0x37a0a0,[_0x4ba3('0x34'),_0xd2327c[_0x4ba3('0x36')]])[_0x4ba3('0x38')];return db[_0x4ba3('0x60')][_0x4ba3('0x37')]({'where':{'name':_0x20c849,'userProfileId':_0x3920c0[_0x4ba3('0x61')]},'raw':!![]})['then'](function(_0x8ea419){if(_0x8ea419&&_0x8ea419[_0x4ba3('0x62')]===0x0){return db[_0x4ba3('0x39')]['create']({'name':_0xd2327c[_0x4ba3('0x38')],'resourceId':_0xd2327c['id'],'type':_0x8ea419['name'],'sectionId':_0x8ea419['id']},{})[_0x4ba3('0x2b')](function(){return _0x57e25a;});}else{return _0x57e25a;}})[_0x4ba3('0x52')](function(_0x33ee10){logger[_0x4ba3('0x3a')](_0x4ba3('0x63'),_0x33ee10);throw _0x33ee10;});}return _0x57e25a;})['then'](respondWithResult(_0x1ab3fe,0xc9))[_0x4ba3('0x52')](handleError(_0x1ab3fe,null));};exports[_0x4ba3('0x29')]=function(_0x2a48fe,_0x65890d){if(_0x2a48fe[_0x4ba3('0x59')]['id']){delete _0x2a48fe['body']['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x37')]({'where':{'id':_0x2a48fe[_0x4ba3('0x54')]['id']}})[_0x4ba3('0x2b')](handleEntityNotFound(_0x65890d,null))[_0x4ba3('0x2b')](function(_0x4070cd){if(_0x4070cd){return db[_0x4ba3('0x3d')][_0x4ba3('0x29')](_[_0x4ba3('0x4b')](_0x2a48fe[_0x4ba3('0x59')],[_0x4ba3('0x5c'),'context',_0x4ba3('0x64'),_0x4ba3('0x65'),'cutdigits','mandatoryDisposition']),{'where':{'context':_0x4070cd[_0x4ba3('0x66')],'exten':_0x4070cd[_0x4ba3('0x5c')]},'individualHooks':!![]})['then'](function(_0x220c83){return _0x220c83;});}return null;})[_0x4ba3('0x2b')](respondWithStatusCode(_0x65890d,null))[_0x4ba3('0x52')](handleError(_0x65890d,null));};exports['addApplications']=function(_0x1f5815,_0x46224,_0x1af489){return db[_0x4ba3('0x3d')][_0x4ba3('0x67')]({'where':{'id':_0x1f5815[_0x4ba3('0x54')]['id']}})['then'](handleEntityNotFound(_0x46224,null))[_0x4ba3('0x2b')](function(_0x2c0408){if(_0x2c0408){return db[_0x4ba3('0x68')]['transaction'](function(_0x3de990){return db[_0x4ba3('0x3d')][_0x4ba3('0x2a')]({'where':{'VoiceExtensionId':_0x1f5815[_0x4ba3('0x54')]['id']},'transaction':_0x3de990})[_0x4ba3('0x2b')](function(_0x2d75a3){var _0x1db4f1=_[_0x4ba3('0x33')](_0x1f5815['body'],function(_0x540f5c){_0x540f5c[_0x4ba3('0x69')]=_0x1f5815['params']['id'];return _0x540f5c;});return db[_0x4ba3('0x3d')][_0x4ba3('0x6a')](_0x1db4f1,{'transaction':_0x3de990});});})[_0x4ba3('0x2b')](function(){return db['VoiceExtension'][_0x4ba3('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f5815[_0x4ba3('0x54')]['id']},'order':_0x4ba3('0x6c')});});}})['then'](respondWithResult(_0x46224,null))[_0x4ba3('0x52')](handleError(_0x46224,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a7b2402..fbdae30 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 _0x2ed6=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x142175,_0x21ef65){var _0x18e2f4=function(_0x12466f){while(--_0x12466f){_0x142175['push'](_0x142175['shift']());}};_0x18e2f4(++_0x21ef65);}(_0x2ed6,0x128));var _0x62ed=function(_0x5d63dd,_0x5cd661){_0x5d63dd=_0x5d63dd-0x0;var _0x451c52=_0x2ed6[_0x5d63dd];return _0x451c52;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x62ed('0x0'))['db'][_0x62ed('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x62ed('0x2')](0x0);var events={'afterCreate':_0x62ed('0x3'),'afterUpdate':_0x62ed('0x4'),'afterDestroy':_0x62ed('0x5')};function emitEvent(_0x2781b8){return function(_0x469eed,_0x24b4aa,_0x30e2c6){VoiceExtensionEvents[_0x62ed('0x6')](_0x2781b8+':'+_0x469eed['id'],_0x469eed);VoiceExtensionEvents['emit'](_0x2781b8,_0x469eed);_0x30e2c6(null);};}for(var e in events){if(events[_0x62ed('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x62ed('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb098=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x2040ec,_0x191b0b){var _0x5edf94=function(_0x531434){while(--_0x531434){_0x2040ec['push'](_0x2040ec['shift']());}};_0x5edf94(++_0x191b0b);}(_0xb098,0x1c4));var _0x8b09=function(_0x4cd750,_0x152193){_0x4cd750=_0x4cd750-0x0;var _0x4fb5f1=_0xb098[_0x4cd750];return _0x4fb5f1;};'use strict';var EventEmitter=require(_0x8b09('0x0'));var VoiceExtension=require(_0x8b09('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b09('0x2'),'afterUpdate':_0x8b09('0x3'),'afterDestroy':_0x8b09('0x4')};function emitEvent(_0x334736){return function(_0x4b820c,_0x4078bd,_0x5689f3){VoiceExtensionEvents[_0x8b09('0x5')](_0x334736+':'+_0x4b820c['id'],_0x4b820c);VoiceExtensionEvents[_0x8b09('0x5')](_0x334736,_0x4b820c);_0x5689f3(null);};}for(var e in events){if(events[_0x8b09('0x6')](e)){var event=events[e];VoiceExtension[_0x8b09('0x7')](e,emitEvent(event));}}module[_0x8b09('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 74d5fd8..eae2972 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','define','voice_extensions'];(function(_0x2c88d7,_0x115b71){var _0x8d591=function(_0x5bb793){while(--_0x5bb793){_0x2c88d7['push'](_0x2c88d7['shift']());}};_0x8d591(++_0x115b71);}(_0x1261,0x144));var _0x1126=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x1261[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('VoiceExtension',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x57ebf5,_0x3de518){var _0x2523c6=function(_0x29a242){while(--_0x29a242){_0x57ebf5['push'](_0x57ebf5['shift']());}};_0x2523c6(++_0x3de518);}(_0x7a54,0x106));var _0x47a5=function(_0x26be41,_0x1eab39){_0x26be41=_0x26be41-0x0;var _0x2d7479=_0x7a54[_0x26be41];return _0x2d7479;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 949b2d8..438b722 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 _0x6658=['result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x4d45d6,_0x2c74f0){var _0x19cd3f=function(_0x3c060a){while(--_0x3c060a){_0x4d45d6['push'](_0x4d45d6['shift']());}};_0x19cd3f(++_0x2c74f0);}(_0x6658,0xaa));var _0x8665=function(_0xdcafa8,_0x5c4019){_0xdcafa8=_0xdcafa8-0x0;var _0x8b422e=_0x6658[_0xdcafa8];return _0x8b422e;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var moment=require(_0x8665('0x2'));var BPromise=require(_0x8665('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8665('0x4'));var db=require(_0x8665('0x5'))['db'];var utils=require(_0x8665('0x6'));var logger=require(_0x8665('0x7'))(_0x8665('0x8'));var config=require(_0x8665('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8665('0xa')][_0x8665('0xb')]({'port':0x232a});config['redis']=_[_0x8665('0xc')](config[_0x8665('0xd')],{'host':_0x8665('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8665('0xd')]));require(_0x8665('0xf'))[_0x8665('0x10')](socket);function respondWithRpcPromise(_0x54e793,_0x5745dc,_0x5798fa){return new BPromise(function(_0x1eab24,_0x4d1abe){return client[_0x8665('0x11')](_0x54e793,_0x5798fa)[_0x8665('0x12')](function(_0x179838){logger[_0x8665('0x13')](_0x8665('0x14'),_0x5745dc,_0x8665('0x15'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5745dc,'request\x20sent',JSON['stringify'](_0x179838));if(_0x179838[_0x8665('0x16')]){if(_0x179838[_0x8665('0x16')][_0x8665('0x17')]===0x1f4){logger[_0x8665('0x16')](_0x8665('0x14'),_0x5745dc,_0x179838[_0x8665('0x16')]['message']);return _0x4d1abe(_0x179838[_0x8665('0x16')]['message']);}logger[_0x8665('0x16')](_0x8665('0x14'),_0x5745dc,_0x179838[_0x8665('0x16')][_0x8665('0x18')]);return _0x1eab24(_0x179838[_0x8665('0x16')][_0x8665('0x18')]);}else{logger[_0x8665('0x13')](_0x8665('0x14'),_0x5745dc,_0x8665('0x15'));_0x1eab24(_0x179838[_0x8665('0x19')][_0x8665('0x18')]);}})[_0x8665('0x1a')](function(_0x431ab8){logger[_0x8665('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x5745dc,_0x431ab8);_0x4d1abe(_0x431ab8);});});}exports[_0x8665('0x1b')]=function(_0x33ba00){var _0x5a6e50=this;return new Promise(function(_0x5f540f,_0x4104b8){return db[_0x8665('0x1c')]['findAll']({'raw':_0x33ba00[_0x8665('0x1d')]?_0x33ba00[_0x8665('0x1d')][_0x8665('0x1e')]===undefined?!![]:![]:!![],'where':_0x33ba00[_0x8665('0x1d')]?_0x33ba00[_0x8665('0x1d')][_0x8665('0x1f')]||null:null,'attributes':_0x33ba00[_0x8665('0x1d')]?_0x33ba00[_0x8665('0x1d')][_0x8665('0x20')]||null:null,'limit':_0x33ba00['options']?_0x33ba00[_0x8665('0x1d')][_0x8665('0x21')]||null:null,'include':_0x33ba00[_0x8665('0x1d')]?_0x33ba00['options'][_0x8665('0x22')]?_[_0x8665('0x23')](_0x33ba00[_0x8665('0x1d')]['include'],function(_0x101568){return{'model':db[_0x101568[_0x8665('0x24')]],'as':_0x101568['as'],'attributes':_0x101568[_0x8665('0x20')],'include':_0x101568[_0x8665('0x22')]?_[_0x8665('0x23')](_0x101568[_0x8665('0x22')],function(_0x37cd26){return{'model':db[_0x37cd26[_0x8665('0x24')]],'as':_0x37cd26['as'],'attributes':_0x37cd26[_0x8665('0x20')],'include':_0x37cd26[_0x8665('0x22')]?_[_0x8665('0x23')](_0x37cd26[_0x8665('0x22')],function(_0xfe429d){return{'model':db[_0xfe429d[_0x8665('0x24')]],'as':_0xfe429d['as'],'attributes':_0xfe429d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8665('0x12')](function(_0x2e0c49){logger[_0x8665('0x13')](_0x8665('0x1b'),_0x33ba00);logger[_0x8665('0x25')](_0x8665('0x1b'),_0x33ba00,JSON[_0x8665('0x26')](_0x2e0c49));_0x5f540f(_0x2e0c49);})[_0x8665('0x1a')](function(_0x46a220){logger[_0x8665('0x16')](_0x8665('0x1b'),_0x46a220[_0x8665('0x18')],_0x33ba00);_0x4104b8(_0x5a6e50[_0x8665('0x16')](0x1f4,_0x46a220[_0x8665('0x18')]));});});}; \ No newline at end of file +var _0x509e=['client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','limit','map','include','attributes','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e8a10,_0x22f427){var _0x32e67a=function(_0x4711b8){while(--_0x4711b8){_0x2e8a10['push'](_0x2e8a10['shift']());}};_0x32e67a(++_0x22f427);}(_0x509e,0xda));var _0xe509=function(_0x4bbbef,_0x76ece0){_0x4bbbef=_0x4bbbef-0x0;var _0x550c92=_0x509e[_0x4bbbef];return _0x550c92;};'use strict';var _=require(_0xe509('0x0'));var util=require(_0xe509('0x1'));var moment=require(_0xe509('0x2'));var BPromise=require(_0xe509('0x3'));var rs=require(_0xe509('0x4'));var fs=require('fs');var Redis=require(_0xe509('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe509('0x6'));var logger=require(_0xe509('0x7'))(_0xe509('0x8'));var config=require(_0xe509('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe509('0xa')][_0xe509('0xb')]({'port':0x232a});config[_0xe509('0xc')]=_[_0xe509('0xd')](config[_0xe509('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe509('0xe'))(new Redis(config[_0xe509('0xc')]));require(_0xe509('0xf'))[_0xe509('0x10')](socket);function respondWithRpcPromise(_0x2a1283,_0x3ffb49,_0x5260cc){return new BPromise(function(_0x49bb8f,_0x38b1f9){return client['request'](_0x2a1283,_0x5260cc)['then'](function(_0x1f17c2){logger['info'](_0xe509('0x11'),_0x3ffb49,_0xe509('0x12'));logger[_0xe509('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3ffb49,'request\x20sent',JSON[_0xe509('0x14')](_0x1f17c2));if(_0x1f17c2[_0xe509('0x15')]){if(_0x1f17c2['error'][_0xe509('0x16')]===0x1f4){logger[_0xe509('0x15')](_0xe509('0x11'),_0x3ffb49,_0x1f17c2[_0xe509('0x15')][_0xe509('0x17')]);return _0x38b1f9(_0x1f17c2[_0xe509('0x15')][_0xe509('0x17')]);}logger[_0xe509('0x15')](_0xe509('0x11'),_0x3ffb49,_0x1f17c2[_0xe509('0x15')][_0xe509('0x17')]);return _0x49bb8f(_0x1f17c2[_0xe509('0x15')]['message']);}else{logger[_0xe509('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3ffb49,'request\x20sent');_0x49bb8f(_0x1f17c2[_0xe509('0x19')][_0xe509('0x17')]);}})[_0xe509('0x1a')](function(_0x5ec7f8){logger[_0xe509('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x3ffb49,_0x5ec7f8);_0x38b1f9(_0x5ec7f8);});});}exports[_0xe509('0x1b')]=function(_0x7d21ff){var _0x25a590=this;return new Promise(function(_0x109764,_0x5dedbd){return db[_0xe509('0x1c')]['findAll']({'raw':_0x7d21ff[_0xe509('0x1d')]?_0x7d21ff[_0xe509('0x1d')][_0xe509('0x1e')]===undefined?!![]:![]:!![],'where':_0x7d21ff[_0xe509('0x1d')]?_0x7d21ff[_0xe509('0x1d')][_0xe509('0x1f')]||null:null,'attributes':_0x7d21ff[_0xe509('0x1d')]?_0x7d21ff[_0xe509('0x1d')]['attributes']||null:null,'limit':_0x7d21ff[_0xe509('0x1d')]?_0x7d21ff[_0xe509('0x1d')][_0xe509('0x20')]||null:null,'include':_0x7d21ff[_0xe509('0x1d')]?_0x7d21ff[_0xe509('0x1d')]['include']?_[_0xe509('0x21')](_0x7d21ff[_0xe509('0x1d')][_0xe509('0x22')],function(_0x20b83f){return{'model':db[_0x20b83f['model']],'as':_0x20b83f['as'],'attributes':_0x20b83f['attributes'],'include':_0x20b83f[_0xe509('0x22')]?_[_0xe509('0x21')](_0x20b83f[_0xe509('0x22')],function(_0x4507f7){return{'model':db[_0x4507f7['model']],'as':_0x4507f7['as'],'attributes':_0x4507f7[_0xe509('0x23')],'include':_0x4507f7[_0xe509('0x22')]?_[_0xe509('0x21')](_0x4507f7[_0xe509('0x22')],function(_0x25d35f){return{'model':db[_0x25d35f[_0xe509('0x24')]],'as':_0x25d35f['as'],'attributes':_0x25d35f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe509('0x25')](function(_0x226959){logger[_0xe509('0x18')]('GetVoiceExtension',_0x7d21ff);logger[_0xe509('0x13')](_0xe509('0x1b'),_0x7d21ff,JSON[_0xe509('0x14')](_0x226959));_0x109764(_0x226959);})[_0xe509('0x1a')](function(_0xe15767){logger['error'](_0xe509('0x1b'),_0xe15767[_0xe509('0x17')],_0x7d21ff);_0x5dedbd(_0x25a590[_0xe509('0x15')](0x1f4,_0xe15767[_0xe509('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a76c5e6..c39155f 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 _0x6a74=['length','voiceExtension:','./voiceExtension.events','save','update','removeListener','register'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6a74,0xb1));var _0x46a7=function(_0x532ca8,_0x3b4e21){_0x532ca8=_0x532ca8-0x0;var _0x3ae0a5=_0x6a74[_0x532ca8];return _0x3ae0a5;};'use strict';var VoiceExtensionEvents=require(_0x46a7('0x0'));var events=[_0x46a7('0x1'),'remove',_0x46a7('0x2')];function createListener(_0x319c6e,_0x2c814b){return function(_0x14d94e){_0x2c814b['emit'](_0x319c6e,_0x14d94e);};}function removeListener(_0xfc7646,_0x7c24cc){return function(){VoiceExtensionEvents[_0x46a7('0x3')](_0xfc7646,_0x7c24cc);};}exports[_0x46a7('0x4')]=function(_0xff2fda){for(var _0x17dc8c=0x0,_0x214115=events[_0x46a7('0x5')];_0x17dc8c<_0x214115;_0x17dc8c++){var _0x2468a6=events[_0x17dc8c];var _0x5902b5=createListener(_0x46a7('0x6')+_0x2468a6,_0xff2fda);VoiceExtensionEvents['on'](_0x2468a6,_0x5902b5);}}; \ No newline at end of file +var _0x864e=['update','emit','register','length','voiceExtension:','save','remove'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x864e,0x83));var _0xe864=function(_0x3fc5ca,_0x575782){_0x3fc5ca=_0x3fc5ca-0x0;var _0x33b644=_0x864e[_0x3fc5ca];return _0x33b644;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xe864('0x0'),_0xe864('0x1'),_0xe864('0x2')];function createListener(_0x36e461,_0x4f2809){return function(_0x2d9cac){_0x4f2809[_0xe864('0x3')](_0x36e461,_0x2d9cac);};}function removeListener(_0x384f9e,_0x22dc6e){return function(){VoiceExtensionEvents['removeListener'](_0x384f9e,_0x22dc6e);};}exports[_0xe864('0x4')]=function(_0x45bdda){for(var _0x4a9f6f=0x0,_0xe3d49b=events[_0xe864('0x5')];_0x4a9f6f<_0xe3d49b;_0x4a9f6f++){var _0x451a11=events[_0x4a9f6f];var _0x2e77d6=createListener(_0xe864('0x6')+_0x451a11,_0x45bdda);VoiceExtensionEvents['on'](_0x451a11,_0x2e77d6);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c51d961..fd7c8d9 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 _0x34d2=['/:id/messages','getMessages','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2b8f0e,_0x38e9ca){var _0x374892=function(_0x1f9838){while(--_0x1f9838){_0x2b8f0e['push'](_0x2b8f0e['shift']());}};_0x374892(++_0x38e9ca);}(_0x34d2,0x7d));var _0x234d=function(_0x3b507d,_0x1246f9){_0x3b507d=_0x3b507d-0x0;var _0x16a128=_0x34d2[_0x3b507d];return _0x16a128;};'use strict';var multer=require(_0x234d('0x0'));var util=require(_0x234d('0x1'));var path=require(_0x234d('0x2'));var timeout=require(_0x234d('0x3'));var express=require(_0x234d('0x4'));var router=express[_0x234d('0x5')]();var auth=require(_0x234d('0x6'));var interaction=require(_0x234d('0x7'));var config=require(_0x234d('0x8'));var controller=require(_0x234d('0x9'));router[_0x234d('0xa')]('/',auth[_0x234d('0xb')](),controller[_0x234d('0xc')]);router['get'](_0x234d('0xd'),auth[_0x234d('0xb')](),controller[_0x234d('0xe')]);router[_0x234d('0xa')](_0x234d('0xf'),auth[_0x234d('0xb')](),controller[_0x234d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x234d('0x11')](_0x234d('0xd'),auth[_0x234d('0xb')](),controller['update']);router[_0x234d('0x12')]('/:id',auth[_0x234d('0xb')](),controller[_0x234d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x873f=['../../config/environment','./voiceMail.controller','isAuthenticated','index','show','get','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x54cebe,_0x54fd72){var _0xceeeb1=function(_0x114942){while(--_0x114942){_0x54cebe['push'](_0x54cebe['shift']());}};_0xceeeb1(++_0x54fd72);}(_0x873f,0x8e));var _0xf873=function(_0x56e3f3,_0x7bc8c5){_0x56e3f3=_0x56e3f3-0x0;var _0x205198=_0x873f[_0x56e3f3];return _0x205198;};'use strict';var multer=require('multer');var util=require(_0xf873('0x0'));var path=require(_0xf873('0x1'));var timeout=require('connect-timeout');var express=require(_0xf873('0x2'));var router=express[_0xf873('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf873('0x4'));var config=require(_0xf873('0x5'));var controller=require(_0xf873('0x6'));router['get']('/',auth[_0xf873('0x7')](),controller[_0xf873('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf873('0x9')]);router[_0xf873('0xa')](_0xf873('0xb'),auth['isAuthenticated'](),controller[_0xf873('0xc')]);router[_0xf873('0xd')]('/',auth[_0xf873('0x7')](),controller[_0xf873('0xe')]);router[_0xf873('0xf')](_0xf873('0x10'),auth[_0xf873('0x7')](),controller[_0xf873('0x11')]);router[_0xf873('0x12')]('/:id',auth[_0xf873('0x7')](),controller[_0xf873('0x13')]);module[_0xf873('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 02cfb9c..bbc0b36 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 _0xe5b5=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0xe5b5[_0x3fb030];return _0xd6899b;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'customer_id':{'type':Sequelize[_0x5e5b('0x2')]},'context':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x3'),'unique':_0x5e5b('0x4')},'mailbox':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e5b('0x4')},'password':{'type':Sequelize[_0x5e5b('0x2')]},'fullname':{'type':Sequelize[_0x5e5b('0x2')]},'email':{'type':Sequelize[_0x5e5b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x40bc5b){this[_0x5e5b('0x5')](_0x5e5b('0x6'),typeof _0x40bc5b===_0x5e5b('0x7')&&_0x40bc5b[_0x5e5b('0x8')]()?_0x40bc5b[_0x5e5b('0x8')]():null);}},'pager':{'type':Sequelize[_0x5e5b('0x2')]},'tz':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x9')},'attach':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':_0x5e5b('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5e5b('0x2')]},'callback':{'type':Sequelize[_0x5e5b('0x2')]},'review':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e5b('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x5e5b('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5e5b('0x2')]},'maxsecs':{'type':Sequelize[_0x5e5b('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e5b('0xf')],'get':function(){return this[_0x5e5b('0x10')](_0x5e5b('0x11'))+'\x20-\x20'+this[_0x5e5b('0x10')](_0x5e5b('0x12'));}}}; \ No newline at end of file +var _0x4483=['email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x277a50,_0x1b5383){var _0x47aeae=function(_0x141d7a){while(--_0x141d7a){_0x277a50['push'](_0x277a50['shift']());}};_0x47aeae(++_0x1b5383);}(_0x4483,0x1a3));var _0x3448=function(_0x1aea74,_0x4ef317){_0x1aea74=_0x1aea74-0x0;var _0x56d498=_0x4483[_0x1aea74];return _0x56d498;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'customer_id':{'type':Sequelize[_0x3448('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x3448('0x3'),'unique':_0x3448('0x4')},'mailbox':{'type':Sequelize[_0x3448('0x2')],'defaultValue':'','allowNull':![],'unique':_0x3448('0x4')},'password':{'type':Sequelize[_0x3448('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3448('0x2')],'validate':{'isEmail':!![]},'set':function(_0x6a89b){this[_0x3448('0x5')](_0x3448('0x6'),typeof _0x6a89b===_0x3448('0x7')&&_0x6a89b[_0x3448('0x8')]()?_0x6a89b[_0x3448('0x8')]():null);}},'pager':{'type':Sequelize[_0x3448('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3448('0x2')]},'callback':{'type':Sequelize[_0x3448('0x2')]},'review':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3448('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'stamp':{'type':_0x3448('0xc')},'emailsubject':{'type':Sequelize[_0x3448('0x2')]},'emailbody':{'type':Sequelize[_0x3448('0x2')]},'maxsecs':{'type':Sequelize[_0x3448('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3448('0xe')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x3448('0xf')](_0x3448('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b7a5c31..7700f39 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 _0x02c6=['sox','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','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','rows','catch','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x226fec,_0x15e6bf){var _0x8d98db=function(_0x7cefdd){while(--_0x7cefdd){_0x226fec['push'](_0x226fec['shift']());}};_0x8d98db(++_0x15e6bf);}(_0x02c6,0x15f));var _0x602c=function(_0x420f22,_0x16b6ea){_0x420f22=_0x420f22-0x0;var _0x573bc9=_0x02c6[_0x420f22];return _0x573bc9;};'use strict';var pdf=require(_0x602c('0x0'));var emlformat=require(_0x602c('0x1'));var rimraf=require(_0x602c('0x2'));var zipdir=require(_0x602c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x602c('0x4'));var moment=require(_0x602c('0x5'));var BPromise=require(_0x602c('0x6'));var Mustache=require(_0x602c('0x7'));var util=require(_0x602c('0x8'));var path=require('path');var sox=require(_0x602c('0x9'));var csv=require(_0x602c('0xa'));var ejs=require(_0x602c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x602c('0xc'));var crypto=require(_0x602c('0xd'));var jsforce=require(_0x602c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x602c('0xa'));var querystring=require(_0x602c('0xf'));var Papa=require(_0x602c('0x10'));var Redis=require(_0x602c('0x11'));var authService=require(_0x602c('0x12'));var qs=require(_0x602c('0x13'));var as=require(_0x602c('0x14'));var hardwareService=require(_0x602c('0x15'));var logger=require(_0x602c('0x16'))(_0x602c('0x17'));var utils=require(_0x602c('0x18'));var config=require(_0x602c('0x19'));var db=require(_0x602c('0x1a'))['db'];function respondWithStatusCode(_0x47a84e,_0x1cebdf){_0x1cebdf=_0x1cebdf||0xcc;return function(_0x293c42){if(_0x293c42){return _0x47a84e['sendStatus'](_0x1cebdf);}return _0x47a84e[_0x602c('0x1b')](_0x1cebdf)[_0x602c('0x1c')]();};}function respondWithResult(_0x3cfe11,_0x4ba2c6){_0x4ba2c6=_0x4ba2c6||0xc8;return function(_0x16a18a){if(_0x16a18a){return _0x3cfe11['status'](_0x4ba2c6)[_0x602c('0x1d')](_0x16a18a);}};}function respondWithFilteredResult(_0x332436,_0x1eda40){return function(_0x353b62){if(_0x353b62){var _0x3bbdc7=_0x353b62['count'],_0x300f60=_0x1eda40[_0x602c('0x1e')],_0x117358=_0x1eda40[_0x602c('0x1e')]+_0x1eda40[_0x602c('0x1f')],_0x264719;if(_0x117358>=_0x3bbdc7){_0x117358=_0x3bbdc7;_0x264719=0xc8;}else{_0x264719=0xce;}_0x332436[_0x602c('0x1b')](_0x264719);return _0x332436[_0x602c('0x20')](_0x602c('0x21'),_0x300f60+'-'+_0x117358+'/'+_0x3bbdc7)[_0x602c('0x1d')](_0x353b62);}return null;};}function patchUpdates(_0x5265a2){return function(_0x59d2e3){try{jsonpatch[_0x602c('0x22')](_0x59d2e3,_0x5265a2,!![]);}catch(_0x46771f){return BPromise[_0x602c('0x23')](_0x46771f);}return _0x59d2e3['save']();};}function saveUpdates(_0x4c4383,_0x121d26){return function(_0x35ae36){if(_0x35ae36){return _0x35ae36[_0x602c('0x24')](_0x4c4383)[_0x602c('0x25')](function(_0x23238c){return _0x23238c;});}return null;};}function removeEntity(_0x254e70,_0x23f3ae){return function(_0x2b9ce7){if(_0x2b9ce7){return _0x2b9ce7[_0x602c('0x26')]()[_0x602c('0x25')](function(){var _0x381c0d=_0x2b9ce7[_0x602c('0x27')]({'plain':!![]});var _0x10ee48=_0x602c('0x28');return db[_0x602c('0x29')][_0x602c('0x26')]({'where':{'type':_0x10ee48,'resourceId':_0x381c0d['id']}})[_0x602c('0x25')](function(){return _0x2b9ce7;});})[_0x602c('0x25')](function(){_0x254e70[_0x602c('0x1b')](0xcc)[_0x602c('0x1c')]();});}};}function handleEntityNotFound(_0x3d60d9,_0x434ff0){return function(_0x2c7cef){if(!_0x2c7cef){_0x3d60d9[_0x602c('0x2a')](0x194);}return _0x2c7cef;};}function handleError(_0x41c9e1,_0xd331bf){_0xd331bf=_0xd331bf||0x1f4;return function(_0x13b357){logger[_0x602c('0x2b')](_0x13b357[_0x602c('0x2c')]);if(_0x13b357[_0x602c('0x2d')]){delete _0x13b357['name'];}_0x41c9e1[_0x602c('0x1b')](_0xd331bf)[_0x602c('0x2e')](_0x13b357);};}exports[_0x602c('0x2f')]=function(_0x3812d8,_0x199144){var _0xdc6786={},_0x5ce10c={},_0x2aed8c={'count':0x0,'rows':[]};var _0x121cc9=_[_0x602c('0x30')](db[_0x602c('0x31')][_0x602c('0x32')],function(_0x44da69){return{'name':_0x44da69[_0x602c('0x33')],'type':_0x44da69[_0x602c('0x34')][_0x602c('0x35')]};});_0x5ce10c['model']=_['map'](_0x121cc9,_0x602c('0x2d'));_0x5ce10c[_0x602c('0x36')]=_['keys'](_0x3812d8[_0x602c('0x36')]);_0x5ce10c[_0x602c('0x37')]=_['intersection'](_0x5ce10c[_0x602c('0x38')],_0x5ce10c[_0x602c('0x36')]);_0xdc6786['attributes']=_[_0x602c('0x39')](_0x5ce10c[_0x602c('0x38')],qs[_0x602c('0x3a')](_0x3812d8['query'][_0x602c('0x3a')]));_0xdc6786[_0x602c('0x3b')]=_0xdc6786['attributes']['length']?_0xdc6786[_0x602c('0x3b')]:_0x5ce10c[_0x602c('0x38')];if(!_0x3812d8[_0x602c('0x36')][_0x602c('0x3c')](_0x602c('0x3d'))){_0xdc6786[_0x602c('0x1f')]=qs['limit'](_0x3812d8[_0x602c('0x36')][_0x602c('0x1f')]);_0xdc6786[_0x602c('0x1e')]=qs[_0x602c('0x1e')](_0x3812d8[_0x602c('0x36')][_0x602c('0x1e')]);}_0xdc6786[_0x602c('0x3e')]=qs['sort'](_0x3812d8[_0x602c('0x36')][_0x602c('0x3f')]);_0xdc6786[_0x602c('0x40')]=qs[_0x602c('0x37')](_[_0x602c('0x41')](_0x3812d8[_0x602c('0x36')],_0x5ce10c[_0x602c('0x37')]),_0x121cc9);if(_0x3812d8[_0x602c('0x36')]['filter']){_0xdc6786[_0x602c('0x40')]=_['merge'](_0xdc6786[_0x602c('0x40')],{'$or':_['map'](_0x121cc9,function(_0x166eda){if(_0x166eda[_0x602c('0x34')]!==_0x602c('0x42')){var _0x586123={};_0x586123[_0x166eda[_0x602c('0x2d')]]={'$like':'%'+_0x3812d8[_0x602c('0x36')][_0x602c('0x43')]+'%'};return _0x586123;}})});}_0xdc6786=_[_0x602c('0x44')]({},_0xdc6786,_0x3812d8['options']);var _0x2266a5={'where':_0xdc6786[_0x602c('0x40')]};return db['VoiceMail'][_0x602c('0x45')](_0x2266a5)[_0x602c('0x25')](function(_0x1f35af){_0x2aed8c['count']=_0x1f35af;if(_0x3812d8[_0x602c('0x36')][_0x602c('0x46')]){_0xdc6786[_0x602c('0x47')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0xdc6786);})['then'](function(_0xbf6b56){_0x2aed8c[_0x602c('0x48')]=_0xbf6b56;return _0x2aed8c;})[_0x602c('0x25')](respondWithFilteredResult(_0x199144,_0xdc6786))[_0x602c('0x49')](handleError(_0x199144,null));};exports['show']=function(_0x11f3e0,_0x5dbe83){var _0x503111={'raw':!![],'where':{'id':_0x11f3e0['params']['id']}},_0xce7f9f={};_0xce7f9f[_0x602c('0x38')]=_[_0x602c('0x4a')](db[_0x602c('0x31')][_0x602c('0x32')]);_0xce7f9f['query']=_['keys'](_0x11f3e0[_0x602c('0x36')]);_0xce7f9f[_0x602c('0x37')]=_[_0x602c('0x39')](_0xce7f9f[_0x602c('0x38')],_0xce7f9f['query']);_0x503111[_0x602c('0x3b')]=_[_0x602c('0x39')](_0xce7f9f[_0x602c('0x38')],qs[_0x602c('0x3a')](_0x11f3e0[_0x602c('0x36')][_0x602c('0x3a')]));_0x503111[_0x602c('0x3b')]=_0x503111[_0x602c('0x3b')]['length']?_0x503111[_0x602c('0x3b')]:_0xce7f9f[_0x602c('0x38')];if(_0x11f3e0[_0x602c('0x36')][_0x602c('0x46')]){_0x503111['include']=[{'all':!![]}];}_0x503111=_['merge']({},_0x503111,_0x11f3e0[_0x602c('0x4b')]);return db[_0x602c('0x31')][_0x602c('0x4c')](_0x503111)[_0x602c('0x25')](handleEntityNotFound(_0x5dbe83,null))[_0x602c('0x25')](respondWithResult(_0x5dbe83,null))['catch'](handleError(_0x5dbe83,null));};exports[_0x602c('0x4d')]=function(_0x1e47a9,_0x35b83d){return db['VoiceMail']['create'](_0x1e47a9[_0x602c('0x4e')],{})['then'](function(_0xf05a50){var _0x375f0e=_0x1e47a9[_0x602c('0x4f')][_0x602c('0x27')]({'plain':!![]});if(!_0x375f0e)throw new Error(_0x602c('0x50'));if(_0x375f0e[_0x602c('0x51')]===_0x602c('0x4f')){var _0x443a37=_0xf05a50[_0x602c('0x27')]({'plain':!![]});var _0x49fb3e=_0x602c('0x28');return db[_0x602c('0x52')]['find']({'where':{'name':_0x49fb3e,'userProfileId':_0x375f0e['userProfileId']},'raw':!![]})[_0x602c('0x25')](function(_0x584629){if(_0x584629&&_0x584629[_0x602c('0x53')]===0x0){return db['UserProfileResource'][_0x602c('0x4d')]({'name':_0x443a37[_0x602c('0x2d')],'resourceId':_0x443a37['id'],'type':_0x584629['name'],'sectionId':_0x584629['id']},{})[_0x602c('0x25')](function(){return _0xf05a50;});}else{return _0xf05a50;}})[_0x602c('0x49')](function(_0x159014){logger['error'](_0x602c('0x54'),_0x159014);throw _0x159014;});}return _0xf05a50;})[_0x602c('0x25')](respondWithResult(_0x35b83d,0xc9))[_0x602c('0x49')](handleError(_0x35b83d,null));};exports['update']=function(_0x3b48bc,_0x3aa048){if(_0x3b48bc[_0x602c('0x4e')]['id']){delete _0x3b48bc[_0x602c('0x4e')]['id'];}return db['VoiceMail'][_0x602c('0x4c')]({'where':{'id':_0x3b48bc[_0x602c('0x55')]['id']}})[_0x602c('0x25')](handleEntityNotFound(_0x3aa048,null))[_0x602c('0x25')](saveUpdates(_0x3b48bc[_0x602c('0x4e')],null))[_0x602c('0x25')](respondWithResult(_0x3aa048,null))['catch'](handleError(_0x3aa048,null));};exports[_0x602c('0x26')]=function(_0x2fa70f,_0x459011){return db['VoiceMail'][_0x602c('0x4c')]({'where':{'id':_0x2fa70f[_0x602c('0x55')]['id']}})[_0x602c('0x25')](handleEntityNotFound(_0x459011,null))[_0x602c('0x25')](removeEntity(_0x459011,null))[_0x602c('0x49')](handleError(_0x459011,null));};exports[_0x602c('0x56')]=function(_0x1a8a5a,_0x2cf2b1,_0x28c62d){return db[_0x602c('0x31')][_0x602c('0x57')]({'where':{'id':_0x1a8a5a['params']['id']}})[_0x602c('0x25')](handleEntityNotFound(_0x2cf2b1,null))[_0x602c('0x25')](function(_0x1d22e6){var _0x59642e;var _0x845e94={},_0x2b82eb={};_0x2b82eb['model']=_['keys'](db['VoiceMailMessage'][_0x602c('0x32')]);_0x2b82eb[_0x602c('0x36')]=_[_0x602c('0x4a')](_0x1a8a5a[_0x602c('0x36')]);_0x2b82eb['filters']=_[_0x602c('0x39')](_0x2b82eb[_0x602c('0x38')],_0x2b82eb[_0x602c('0x36')]);_0x845e94[_0x602c('0x3b')]=_['intersection'](_0x2b82eb[_0x602c('0x38')],qs[_0x602c('0x3a')](_0x1a8a5a[_0x602c('0x36')][_0x602c('0x3a')]));_0x845e94[_0x602c('0x3b')]=_0x845e94[_0x602c('0x3b')]['length']?_0x845e94[_0x602c('0x3b')]:_0x2b82eb[_0x602c('0x38')];if(!_0x1a8a5a[_0x602c('0x36')][_0x602c('0x3c')](_0x602c('0x3d'))){_0x845e94[_0x602c('0x1f')]=qs[_0x602c('0x1f')](_0x1a8a5a[_0x602c('0x36')][_0x602c('0x1f')]);_0x845e94[_0x602c('0x1e')]=qs[_0x602c('0x1e')](_0x1a8a5a[_0x602c('0x36')]['offset']);}_0x845e94[_0x602c('0x3e')]=qs['sort'](_0x1a8a5a[_0x602c('0x36')][_0x602c('0x3f')]);_0x845e94[_0x602c('0x40')]=qs[_0x602c('0x37')](_[_0x602c('0x41')](_0x1a8a5a[_0x602c('0x36')],_0x2b82eb[_0x602c('0x37')]));if(_0x1a8a5a['query']['filter']){_0x845e94[_0x602c('0x40')]=_[_0x602c('0x44')](_0x845e94['where'],{'$or':_[_0x602c('0x30')](_0x845e94[_0x602c('0x3b')],function(_0x31353f){var _0x4448a8={};_0x4448a8[_0x31353f]={'$like':'%'+_0x1a8a5a[_0x602c('0x36')][_0x602c('0x43')]+'%'};return _0x4448a8;})});}_0x845e94['where']=_[_0x602c('0x44')](_0x845e94['where'],{'mailboxuser':_0x1d22e6['mailbox']});_0x845e94=_[_0x602c('0x44')]({},_0x845e94,_0x1a8a5a[_0x602c('0x4b')]);return db[_0x602c('0x58')][_0x602c('0x59')](_0x845e94)[_0x602c('0x25')](respondWithFilteredResult(_0x2cf2b1,_0x845e94));})[_0x602c('0x49')](handleError(_0x2cf2b1,null));}; \ No newline at end of file +var _0xb617=['findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','getMessages','findOne','hasOwnProperty','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','reject','update','then','destroy','get','Voicemails','UserProfileResource','end','stack','name','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','offset','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','VoiceMail','include'];(function(_0x39e19e,_0x5d539e){var _0xec1beb=function(_0x476a72){while(--_0x476a72){_0x39e19e['push'](_0x39e19e['shift']());}};_0xec1beb(++_0x5d539e);}(_0xb617,0x174));var _0x7b61=function(_0x3f2b05,_0x53adad){_0x3f2b05=_0x3f2b05-0x0;var _0x3061a9=_0xb617[_0x3f2b05];return _0x3061a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b61('0x0'));var rimraf=require(_0x7b61('0x1'));var zipdir=require(_0x7b61('0x2'));var jsonpatch=require(_0x7b61('0x3'));var rp=require('request-promise');var moment=require(_0x7b61('0x4'));var BPromise=require(_0x7b61('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7b61('0x6'));var sox=require(_0x7b61('0x7'));var csv=require(_0x7b61('0x8'));var ejs=require(_0x7b61('0x9'));var fs=require('fs');var _=require(_0x7b61('0xa'));var squel=require(_0x7b61('0xb'));var crypto=require(_0x7b61('0xc'));var jsforce=require(_0x7b61('0xd'));var deskjs=require(_0x7b61('0xe'));var toCsv=require(_0x7b61('0x8'));var querystring=require(_0x7b61('0xf'));var Papa=require(_0x7b61('0x10'));var Redis=require(_0x7b61('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7b61('0x12'));var as=require(_0x7b61('0x13'));var hardwareService=require(_0x7b61('0x14'));var logger=require(_0x7b61('0x15'))(_0x7b61('0x16'));var utils=require(_0x7b61('0x17'));var config=require(_0x7b61('0x18'));var db=require(_0x7b61('0x19'))['db'];function respondWithStatusCode(_0x4aaede,_0x31db93){_0x31db93=_0x31db93||0xcc;return function(_0x1d5043){if(_0x1d5043){return _0x4aaede[_0x7b61('0x1a')](_0x31db93);}return _0x4aaede[_0x7b61('0x1b')](_0x31db93)['end']();};}function respondWithResult(_0x4ae67a,_0x1d7143){_0x1d7143=_0x1d7143||0xc8;return function(_0x5df497){if(_0x5df497){return _0x4ae67a[_0x7b61('0x1b')](_0x1d7143)['json'](_0x5df497);}};}function respondWithFilteredResult(_0x17cd24,_0x347963){return function(_0x3980d0){if(_0x3980d0){var _0x462b70=_0x3980d0[_0x7b61('0x1c')],_0x1ec3bf=_0x347963['offset'],_0x12e90b=_0x347963['offset']+_0x347963[_0x7b61('0x1d')],_0x21d9fe;if(_0x12e90b>=_0x462b70){_0x12e90b=_0x462b70;_0x21d9fe=0xc8;}else{_0x21d9fe=0xce;}_0x17cd24[_0x7b61('0x1b')](_0x21d9fe);return _0x17cd24[_0x7b61('0x1e')](_0x7b61('0x1f'),_0x1ec3bf+'-'+_0x12e90b+'/'+_0x462b70)[_0x7b61('0x20')](_0x3980d0);}return null;};}function patchUpdates(_0x3eac46){return function(_0x230b66){try{jsonpatch['apply'](_0x230b66,_0x3eac46,!![]);}catch(_0xf69a72){return BPromise[_0x7b61('0x21')](_0xf69a72);}return _0x230b66['save']();};}function saveUpdates(_0x44c595,_0x103fcb){return function(_0x38d7cf){if(_0x38d7cf){return _0x38d7cf[_0x7b61('0x22')](_0x44c595)[_0x7b61('0x23')](function(_0x524736){return _0x524736;});}return null;};}function removeEntity(_0x451cd4,_0x2b066c){return function(_0x129df8){if(_0x129df8){return _0x129df8[_0x7b61('0x24')]()['then'](function(){var _0x4de6d1=_0x129df8[_0x7b61('0x25')]({'plain':!![]});var _0x5d7881=_0x7b61('0x26');return db[_0x7b61('0x27')][_0x7b61('0x24')]({'where':{'type':_0x5d7881,'resourceId':_0x4de6d1['id']}})[_0x7b61('0x23')](function(){return _0x129df8;});})[_0x7b61('0x23')](function(){_0x451cd4[_0x7b61('0x1b')](0xcc)[_0x7b61('0x28')]();});}};}function handleEntityNotFound(_0x5ce834,_0xa1a3a4){return function(_0x9775f5){if(!_0x9775f5){_0x5ce834['sendStatus'](0x194);}return _0x9775f5;};}function handleError(_0xab1b6e,_0xa115e5){_0xa115e5=_0xa115e5||0x1f4;return function(_0x5b9f8c){logger['error'](_0x5b9f8c[_0x7b61('0x29')]);if(_0x5b9f8c['name']){delete _0x5b9f8c[_0x7b61('0x2a')];}_0xab1b6e[_0x7b61('0x1b')](_0xa115e5)['send'](_0x5b9f8c);};}exports[_0x7b61('0x2b')]=function(_0x4e661c,_0x503616){var _0x435a79={},_0x30a03f={},_0x232d2a={'count':0x0,'rows':[]};var _0x4e6658=_[_0x7b61('0x2c')](db['VoiceMail'][_0x7b61('0x2d')],function(_0x2c7b14){return{'name':_0x2c7b14[_0x7b61('0x2e')],'type':_0x2c7b14['type'][_0x7b61('0x2f')]};});_0x30a03f['model']=_[_0x7b61('0x2c')](_0x4e6658,_0x7b61('0x2a'));_0x30a03f[_0x7b61('0x30')]=_[_0x7b61('0x31')](_0x4e661c[_0x7b61('0x30')]);_0x30a03f['filters']=_[_0x7b61('0x32')](_0x30a03f[_0x7b61('0x33')],_0x30a03f['query']);_0x435a79[_0x7b61('0x34')]=_[_0x7b61('0x32')](_0x30a03f[_0x7b61('0x33')],qs['fields'](_0x4e661c[_0x7b61('0x30')][_0x7b61('0x35')]));_0x435a79[_0x7b61('0x34')]=_0x435a79[_0x7b61('0x34')][_0x7b61('0x36')]?_0x435a79[_0x7b61('0x34')]:_0x30a03f[_0x7b61('0x33')];if(!_0x4e661c[_0x7b61('0x30')]['hasOwnProperty']('nolimit')){_0x435a79[_0x7b61('0x1d')]=qs[_0x7b61('0x1d')](_0x4e661c[_0x7b61('0x30')][_0x7b61('0x1d')]);_0x435a79[_0x7b61('0x37')]=qs[_0x7b61('0x37')](_0x4e661c[_0x7b61('0x30')][_0x7b61('0x37')]);}_0x435a79[_0x7b61('0x38')]=qs[_0x7b61('0x39')](_0x4e661c[_0x7b61('0x30')][_0x7b61('0x39')]);_0x435a79['where']=qs[_0x7b61('0x3a')](_[_0x7b61('0x3b')](_0x4e661c[_0x7b61('0x30')],_0x30a03f[_0x7b61('0x3a')]),_0x4e6658);if(_0x4e661c[_0x7b61('0x30')][_0x7b61('0x3c')]){_0x435a79[_0x7b61('0x3d')]=_['merge'](_0x435a79[_0x7b61('0x3d')],{'$or':_[_0x7b61('0x2c')](_0x4e6658,function(_0x443ed1){if(_0x443ed1[_0x7b61('0x3e')]!==_0x7b61('0x3f')){var _0xa943db={};_0xa943db[_0x443ed1['name']]={'$like':'%'+_0x4e661c[_0x7b61('0x30')][_0x7b61('0x3c')]+'%'};return _0xa943db;}})});}_0x435a79=_[_0x7b61('0x40')]({},_0x435a79,_0x4e661c[_0x7b61('0x41')]);var _0x181255={'where':_0x435a79[_0x7b61('0x3d')]};return db[_0x7b61('0x42')][_0x7b61('0x1c')](_0x181255)[_0x7b61('0x23')](function(_0x405016){_0x232d2a[_0x7b61('0x1c')]=_0x405016;if(_0x4e661c[_0x7b61('0x30')]['includeAll']){_0x435a79[_0x7b61('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x7b61('0x44')](_0x435a79);})['then'](function(_0x193773){_0x232d2a[_0x7b61('0x45')]=_0x193773;return _0x232d2a;})[_0x7b61('0x23')](respondWithFilteredResult(_0x503616,_0x435a79))[_0x7b61('0x46')](handleError(_0x503616,null));};exports['show']=function(_0x1b0435,_0x309094){var _0x4e2106={'raw':!![],'where':{'id':_0x1b0435[_0x7b61('0x47')]['id']}},_0x43c0ba={};_0x43c0ba[_0x7b61('0x33')]=_[_0x7b61('0x31')](db[_0x7b61('0x42')]['rawAttributes']);_0x43c0ba[_0x7b61('0x30')]=_[_0x7b61('0x31')](_0x1b0435[_0x7b61('0x30')]);_0x43c0ba[_0x7b61('0x3a')]=_[_0x7b61('0x32')](_0x43c0ba[_0x7b61('0x33')],_0x43c0ba[_0x7b61('0x30')]);_0x4e2106[_0x7b61('0x34')]=_[_0x7b61('0x32')](_0x43c0ba['model'],qs[_0x7b61('0x35')](_0x1b0435[_0x7b61('0x30')][_0x7b61('0x35')]));_0x4e2106[_0x7b61('0x34')]=_0x4e2106[_0x7b61('0x34')][_0x7b61('0x36')]?_0x4e2106['attributes']:_0x43c0ba[_0x7b61('0x33')];if(_0x1b0435['query'][_0x7b61('0x48')]){_0x4e2106['include']=[{'all':!![]}];}_0x4e2106=_[_0x7b61('0x40')]({},_0x4e2106,_0x1b0435[_0x7b61('0x41')]);return db[_0x7b61('0x42')][_0x7b61('0x49')](_0x4e2106)[_0x7b61('0x23')](handleEntityNotFound(_0x309094,null))['then'](respondWithResult(_0x309094,null))[_0x7b61('0x46')](handleError(_0x309094,null));};exports[_0x7b61('0x4a')]=function(_0x594770,_0x171f9c){return db['VoiceMail']['create'](_0x594770['body'],{})[_0x7b61('0x23')](function(_0x13a574){var _0x10bef8=_0x594770[_0x7b61('0x4b')][_0x7b61('0x25')]({'plain':!![]});if(!_0x10bef8)throw new Error(_0x7b61('0x4c'));if(_0x10bef8['role']===_0x7b61('0x4b')){var _0x44c1ae=_0x13a574[_0x7b61('0x25')]({'plain':!![]});var _0x2858d=_0x7b61('0x26');return db[_0x7b61('0x4d')][_0x7b61('0x49')]({'where':{'name':_0x2858d,'userProfileId':_0x10bef8[_0x7b61('0x4e')]},'raw':!![]})[_0x7b61('0x23')](function(_0x557038){if(_0x557038&&_0x557038[_0x7b61('0x4f')]===0x0){return db['UserProfileResource'][_0x7b61('0x4a')]({'name':_0x44c1ae[_0x7b61('0x2a')],'resourceId':_0x44c1ae['id'],'type':_0x557038[_0x7b61('0x2a')],'sectionId':_0x557038['id']},{})[_0x7b61('0x23')](function(){return _0x13a574;});}else{return _0x13a574;}})[_0x7b61('0x46')](function(_0x45ff4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45ff4d);throw _0x45ff4d;});}return _0x13a574;})[_0x7b61('0x23')](respondWithResult(_0x171f9c,0xc9))[_0x7b61('0x46')](handleError(_0x171f9c,null));};exports[_0x7b61('0x22')]=function(_0x3d5d7c,_0x1dec26){if(_0x3d5d7c[_0x7b61('0x50')]['id']){delete _0x3d5d7c[_0x7b61('0x50')]['id'];}return db['VoiceMail'][_0x7b61('0x49')]({'where':{'id':_0x3d5d7c[_0x7b61('0x47')]['id']}})[_0x7b61('0x23')](handleEntityNotFound(_0x1dec26,null))[_0x7b61('0x23')](saveUpdates(_0x3d5d7c[_0x7b61('0x50')],null))[_0x7b61('0x23')](respondWithResult(_0x1dec26,null))[_0x7b61('0x46')](handleError(_0x1dec26,null));};exports['destroy']=function(_0x1af78d,_0x186678){return db['VoiceMail'][_0x7b61('0x49')]({'where':{'id':_0x1af78d[_0x7b61('0x47')]['id']}})[_0x7b61('0x23')](handleEntityNotFound(_0x186678,null))[_0x7b61('0x23')](removeEntity(_0x186678,null))[_0x7b61('0x46')](handleError(_0x186678,null));};exports[_0x7b61('0x51')]=function(_0x5c7695,_0x4283e2,_0x2da13e){return db['VoiceMail'][_0x7b61('0x52')]({'where':{'id':_0x5c7695['params']['id']}})[_0x7b61('0x23')](handleEntityNotFound(_0x4283e2,null))[_0x7b61('0x23')](function(_0x5883c9){var _0x4f3166;var _0x5949e5={},_0x224385={};_0x224385[_0x7b61('0x33')]=_[_0x7b61('0x31')](db['VoiceMailMessage'][_0x7b61('0x2d')]);_0x224385[_0x7b61('0x30')]=_['keys'](_0x5c7695[_0x7b61('0x30')]);_0x224385[_0x7b61('0x3a')]=_[_0x7b61('0x32')](_0x224385[_0x7b61('0x33')],_0x224385[_0x7b61('0x30')]);_0x5949e5[_0x7b61('0x34')]=_['intersection'](_0x224385[_0x7b61('0x33')],qs[_0x7b61('0x35')](_0x5c7695[_0x7b61('0x30')][_0x7b61('0x35')]));_0x5949e5[_0x7b61('0x34')]=_0x5949e5[_0x7b61('0x34')][_0x7b61('0x36')]?_0x5949e5[_0x7b61('0x34')]:_0x224385[_0x7b61('0x33')];if(!_0x5c7695[_0x7b61('0x30')][_0x7b61('0x53')](_0x7b61('0x54'))){_0x5949e5[_0x7b61('0x1d')]=qs[_0x7b61('0x1d')](_0x5c7695[_0x7b61('0x30')]['limit']);_0x5949e5[_0x7b61('0x37')]=qs[_0x7b61('0x37')](_0x5c7695[_0x7b61('0x30')][_0x7b61('0x37')]);}_0x5949e5[_0x7b61('0x38')]=qs[_0x7b61('0x39')](_0x5c7695[_0x7b61('0x30')][_0x7b61('0x39')]);_0x5949e5['where']=qs[_0x7b61('0x3a')](_['pick'](_0x5c7695['query'],_0x224385[_0x7b61('0x3a')]));if(_0x5c7695[_0x7b61('0x30')][_0x7b61('0x3c')]){_0x5949e5['where']=_[_0x7b61('0x40')](_0x5949e5[_0x7b61('0x3d')],{'$or':_[_0x7b61('0x2c')](_0x5949e5[_0x7b61('0x34')],function(_0x378cb4){var _0x3b9adb={};_0x3b9adb[_0x378cb4]={'$like':'%'+_0x5c7695[_0x7b61('0x30')][_0x7b61('0x3c')]+'%'};return _0x3b9adb;})});}_0x5949e5[_0x7b61('0x3d')]=_['merge'](_0x5949e5[_0x7b61('0x3d')],{'mailboxuser':_0x5883c9[_0x7b61('0x55')]});_0x5949e5=_['merge']({},_0x5949e5,_0x5c7695[_0x7b61('0x41')]);return db[_0x7b61('0x56')][_0x7b61('0x57')](_0x5949e5)['then'](respondWithFilteredResult(_0x4283e2,_0x5949e5));})[_0x7b61('0x46')](handleError(_0x4283e2,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4eceed3..4570d8d 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 _0x6139=['rimraf','../../config/environment','exports','VoiceMail','mailbox','util','api','bluebird','request-promise','path'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x6139,0x145));var _0x9613=function(_0x143e47,_0x1b61c8){_0x143e47=_0x143e47-0x0;var _0x51366f=_0x6139[_0x143e47];return _0x51366f;};'use strict';var _=require('lodash');var util=require(_0x9613('0x0'));var logger=require('../../config/logger')(_0x9613('0x1'));var moment=require('moment');var BPromise=require(_0x9613('0x2'));var rp=require(_0x9613('0x3'));var fs=require('fs');var path=require(_0x9613('0x4'));var rimraf=require(_0x9613('0x5'));var config=require(_0x9613('0x6'));var attributes=require('./voiceMail.attributes');module[_0x9613('0x7')]=function(_0x2393a1,_0x12ce64){return _0x2393a1['define'](_0x9613('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9613('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf4=['mailbox_context','mailbox','context','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x196ab3,_0x1e8ed8){var _0x5112f6=function(_0x3db682){while(--_0x3db682){_0x196ab3['push'](_0x196ab3['shift']());}};_0x5112f6(++_0x1e8ed8);}(_0xdbf4,0x1d7));var _0x4dbf=function(_0xcf341d,_0x51e2cb){_0xcf341d=_0xcf341d-0x0;var _0x482c2d=_0xdbf4[_0xcf341d];return _0x482c2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4dbf('0x0'))('api');var moment=require('moment');var BPromise=require(_0x4dbf('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dbf('0x2'));var rimraf=require(_0x4dbf('0x3'));var config=require(_0x4dbf('0x4'));var attributes=require(_0x4dbf('0x5'));module[_0x4dbf('0x6')]=function(_0x40481d,_0x30e1f5){return _0x40481d[_0x4dbf('0x7')](_0x4dbf('0x8'),attributes,{'tableName':_0x4dbf('0x9'),'paranoid':![],'indexes':[{'name':_0x4dbf('0xa'),'fields':[_0x4dbf('0xb'),_0x4dbf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c500408..fd983c7 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 _0x8023=['jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8023,0x1b0));var _0x3802=function(_0x50b58a,_0x4b11b0){_0x50b58a=_0x50b58a-0x0;var _0x39759c=_0x8023[_0x50b58a];return _0x39759c;};'use strict';var _=require('lodash');var util=require(_0x3802('0x0'));var moment=require(_0x3802('0x1'));var BPromise=require(_0x3802('0x2'));var rs=require(_0x3802('0x3'));var fs=require('fs');var Redis=require(_0x3802('0x4'));var db=require(_0x3802('0x5'))['db'];var utils=require(_0x3802('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3802('0x7'));var jayson=require(_0x3802('0x8'));var client=jayson[_0x3802('0x9')][_0x3802('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38cad1,_0x5569dd,_0x12ac8f){return new BPromise(function(_0x5a438a,_0x55655a){return client['request'](_0x38cad1,_0x12ac8f)[_0x3802('0xb')](function(_0x259c94){logger['info'](_0x3802('0xc'),_0x5569dd,_0x3802('0xd'));logger[_0x3802('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5569dd,_0x3802('0xd'),JSON[_0x3802('0xf')](_0x259c94));if(_0x259c94[_0x3802('0x10')]){if(_0x259c94[_0x3802('0x10')][_0x3802('0x11')]===0x1f4){logger[_0x3802('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5569dd,_0x259c94[_0x3802('0x10')]['message']);return _0x55655a(_0x259c94['error'][_0x3802('0x12')]);}logger['error'](_0x3802('0xc'),_0x5569dd,_0x259c94[_0x3802('0x10')][_0x3802('0x12')]);return _0x5a438a(_0x259c94[_0x3802('0x10')][_0x3802('0x12')]);}else{logger[_0x3802('0x13')]('VoiceMail,\x20%s,\x20%s',_0x5569dd,_0x3802('0xd'));_0x5a438a(_0x259c94[_0x3802('0x14')][_0x3802('0x12')]);}})[_0x3802('0x15')](function(_0x912f8e){logger[_0x3802('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5569dd,_0x912f8e);_0x55655a(_0x912f8e);});});} \ No newline at end of file +var _0x521d=['../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','randomstring','rpc'];(function(_0x594cc5,_0x977c6b){var _0x221454=function(_0x933814){while(--_0x933814){_0x594cc5['push'](_0x594cc5['shift']());}};_0x221454(++_0x977c6b);}(_0x521d,0xe7));var _0xd521=function(_0x3ee7e5,_0x5969ee){_0x3ee7e5=_0x3ee7e5-0x0;var _0x243fd1=_0x521d[_0x3ee7e5];return _0x243fd1;};'use strict';var _=require(_0xd521('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd521('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd521('0x2'));var config=require(_0xd521('0x3'));var jayson=require(_0xd521('0x4'));var client=jayson[_0xd521('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11746f,_0x2155c5,_0x2d2240){return new BPromise(function(_0x5a12b0,_0x27433a){return client[_0xd521('0x6')](_0x11746f,_0x2d2240)[_0xd521('0x7')](function(_0x2ee2fd){logger[_0xd521('0x8')](_0xd521('0x9'),_0x2155c5,'request\x20sent');logger[_0xd521('0xa')](_0xd521('0xb'),_0x2155c5,'request\x20sent',JSON[_0xd521('0xc')](_0x2ee2fd));if(_0x2ee2fd[_0xd521('0xd')]){if(_0x2ee2fd[_0xd521('0xd')][_0xd521('0xe')]===0x1f4){logger['error'](_0xd521('0x9'),_0x2155c5,_0x2ee2fd[_0xd521('0xd')]['message']);return _0x27433a(_0x2ee2fd[_0xd521('0xd')]['message']);}logger[_0xd521('0xd')](_0xd521('0x9'),_0x2155c5,_0x2ee2fd[_0xd521('0xd')][_0xd521('0xf')]);return _0x5a12b0(_0x2ee2fd[_0xd521('0xd')][_0xd521('0xf')]);}else{logger[_0xd521('0x8')](_0xd521('0x9'),_0x2155c5,_0xd521('0x10'));_0x5a12b0(_0x2ee2fd[_0xd521('0x11')]['message']);}})['catch'](function(_0x35b85c){logger[_0xd521('0xd')](_0xd521('0x9'),_0x2155c5,_0x35b85c);_0x27433a(_0x35b85c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d26674a..7ad59ba 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 _0x31f0=['get','/:id','show','/:id/download','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x65ffb5,_0x22296c){var _0x1988d7=function(_0x14951a){while(--_0x14951a){_0x65ffb5['push'](_0x65ffb5['shift']());}};_0x1988d7(++_0x22296c);}(_0x31f0,0xb7));var _0x031f=function(_0x34acae,_0x1472d8){_0x34acae=_0x34acae-0x0;var _0x2d475f=_0x31f0[_0x34acae];return _0x2d475f;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['download']);router[_0x031f('0xc')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router[_0x031f('0x10')]('/:id',auth[_0x031f('0xb')](),controller[_0x031f('0x11')]);module[_0x031f('0x12')]=router; \ No newline at end of file +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(_0x30b3be,_0x4f052f){var _0x46c9b7=function(_0x43d990){while(--_0x43d990){_0x30b3be['push'](_0x30b3be['shift']());}};_0x46c9b7(++_0x4f052f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x284181,_0x1a6e29){_0x284181=_0x284181-0x0;var _0x2d96cf=_0x3f8a[_0x284181];return _0x2d96cf;};'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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index e060a3f..b65b621 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 _0x1621=['TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB','long'];(function(_0x2a1e84,_0x2f5bb1){var _0xbf5e7=function(_0x30e83c){while(--_0x30e83c){_0x2a1e84['push'](_0x2a1e84['shift']());}};_0xbf5e7(++_0x2f5bb1);}(_0x1621,0x78));var _0x1162=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x1621[_0x4fa166];return _0x5dd974;};'use strict';var Sequelize=require(_0x1162('0x0'));module['exports']={'name':{'type':Sequelize[_0x1162('0x1')],'get':function(_0x432c84){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1162('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x1162('0x4')](_0x1162('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1162('0x3')],'defaultValue':''},'stamp':{'type':_0x1162('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x31a7=['INTEGER','STRING','long','sequelize','getDataValue'];(function(_0x4ab342,_0x225d67){var _0x186df2=function(_0x57bfec){while(--_0x57bfec){_0x4ab342['push'](_0x4ab342['shift']());}};_0x186df2(++_0x225d67);}(_0x31a7,0x1d4));var _0x731a=function(_0x5bc850,_0x38c1b7){_0x5bc850=_0x5bc850-0x0;var _0x1c7894=_0x31a7[_0x5bc850];return _0x1c7894;};'use strict';var Sequelize=require(_0x731a('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4b8c8c){return this[_0x731a('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x731a('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x731a('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x731a('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x731a('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x731a('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x731a('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x731a('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index cd38b29..302e2bd 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 _0x3eec=['apply','reject','save','update','then','error','stack','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','download','recording','Sequelize','ValidationError','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x31b1f0,_0x360237){_0x31b1f0=_0x31b1f0-0x0;var _0x1475da=_0x3eec[_0x31b1f0];return _0x1475da;};'use strict';var pdf=require(_0xc3ee('0x0'));var emlformat=require(_0xc3ee('0x1'));var rimraf=require(_0xc3ee('0x2'));var zipdir=require(_0xc3ee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3ee('0x4'));var moment=require(_0xc3ee('0x5'));var BPromise=require(_0xc3ee('0x6'));var Mustache=require(_0xc3ee('0x7'));var util=require(_0xc3ee('0x8'));var path=require(_0xc3ee('0x9'));var sox=require('sox');var csv=require(_0xc3ee('0xa'));var ejs=require(_0xc3ee('0xb'));var fs=require('fs');var _=require(_0xc3ee('0xc'));var squel=require(_0xc3ee('0xd'));var crypto=require(_0xc3ee('0xe'));var jsforce=require(_0xc3ee('0xf'));var deskjs=require(_0xc3ee('0x10'));var toCsv=require(_0xc3ee('0xa'));var querystring=require(_0xc3ee('0x11'));var Papa=require(_0xc3ee('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3ee('0x13'));var as=require(_0xc3ee('0x14'));var hardwareService=require(_0xc3ee('0x15'));var logger=require(_0xc3ee('0x16'))('api');var utils=require(_0xc3ee('0x17'));var config=require('../../config/environment');var db=require(_0xc3ee('0x18'))['db'];function respondWithStatusCode(_0x416fd2,_0x4beb01){_0x4beb01=_0x4beb01||0xcc;return function(_0x5f2c3a){if(_0x5f2c3a){return _0x416fd2[_0xc3ee('0x19')](_0x4beb01);}return _0x416fd2['status'](_0x4beb01)[_0xc3ee('0x1a')]();};}function respondWithResult(_0x535d1a,_0x19feb3){_0x19feb3=_0x19feb3||0xc8;return function(_0x58ebe7){if(_0x58ebe7){return _0x535d1a[_0xc3ee('0x1b')](_0x19feb3)[_0xc3ee('0x1c')](_0x58ebe7);}};}function respondWithFilteredResult(_0x1c819a,_0x664bad){return function(_0x476f8f){if(_0x476f8f){var _0xf63359=_0x476f8f['count'],_0x277e11=_0x664bad[_0xc3ee('0x1d')],_0x4e1c51=_0x664bad[_0xc3ee('0x1d')]+_0x664bad[_0xc3ee('0x1e')],_0xbd384b;if(_0x4e1c51>=_0xf63359){_0x4e1c51=_0xf63359;_0xbd384b=0xc8;}else{_0xbd384b=0xce;}_0x1c819a[_0xc3ee('0x1b')](_0xbd384b);return _0x1c819a[_0xc3ee('0x1f')](_0xc3ee('0x20'),_0x277e11+'-'+_0x4e1c51+'/'+_0xf63359)[_0xc3ee('0x1c')](_0x476f8f);}return null;};}function patchUpdates(_0x25a583){return function(_0xc831c){try{jsonpatch[_0xc3ee('0x21')](_0xc831c,_0x25a583,!![]);}catch(_0x2ce864){return BPromise[_0xc3ee('0x22')](_0x2ce864);}return _0xc831c[_0xc3ee('0x23')]();};}function saveUpdates(_0x2361f1,_0x3e7224){return function(_0x46a8c9){if(_0x46a8c9){return _0x46a8c9[_0xc3ee('0x24')](_0x2361f1)[_0xc3ee('0x25')](function(_0x327c45){return _0x327c45;});}return null;};}function removeEntity(_0x1c33a7,_0x11778f){return function(_0x493fea){if(_0x493fea){return _0x493fea['destroy']()[_0xc3ee('0x25')](function(){_0x1c33a7[_0xc3ee('0x1b')](0xcc)[_0xc3ee('0x1a')]();});}};}function handleEntityNotFound(_0x464ffc,_0x28bfeb){return function(_0x238df7){if(!_0x238df7){_0x464ffc['sendStatus'](0x194);}return _0x238df7;};}function handleError(_0x450cd1,_0x3f8f7b){_0x3f8f7b=_0x3f8f7b||0x1f4;return function(_0x2d2750){logger[_0xc3ee('0x26')](_0x2d2750[_0xc3ee('0x27')]);if(_0x2d2750['name']){delete _0x2d2750['name'];}_0x450cd1[_0xc3ee('0x1b')](_0x3f8f7b)[_0xc3ee('0x28')](_0x2d2750);};}exports[_0xc3ee('0x29')]=function(_0xb9a672,_0x836fac){var _0x4ecfec={},_0x56201a={},_0x4e0bc0={'count':0x0,'rows':[]};var _0x1be005=_[_0xc3ee('0x2a')](db[_0xc3ee('0x2b')][_0xc3ee('0x2c')],function(_0x2cdd85){return{'name':_0x2cdd85['fieldName'],'type':_0x2cdd85[_0xc3ee('0x2d')][_0xc3ee('0x2e')]};});_0x56201a[_0xc3ee('0x2f')]=_[_0xc3ee('0x30')](_[_0xc3ee('0x2a')](_0x1be005,_0xc3ee('0x31')),[_0xc3ee('0x31')]);_0x56201a['query']=_[_0xc3ee('0x32')](_0xb9a672[_0xc3ee('0x33')]);_0x56201a[_0xc3ee('0x34')]=_['intersection'](_0x56201a[_0xc3ee('0x2f')],_0x56201a[_0xc3ee('0x33')]);_0x4ecfec[_0xc3ee('0x35')]=_[_0xc3ee('0x36')](_0x56201a[_0xc3ee('0x2f')],qs[_0xc3ee('0x37')](_0xb9a672[_0xc3ee('0x33')]['fields']));_0x4ecfec[_0xc3ee('0x35')]=_0x4ecfec['attributes'][_0xc3ee('0x38')]?_0x4ecfec[_0xc3ee('0x35')]:_0x56201a[_0xc3ee('0x2f')];if(!_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x39')](_0xc3ee('0x3a'))){_0x4ecfec['limit']=qs[_0xc3ee('0x1e')](_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x1e')]);_0x4ecfec[_0xc3ee('0x1d')]=qs[_0xc3ee('0x1d')](_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x1d')]);}_0x4ecfec[_0xc3ee('0x3b')]=qs[_0xc3ee('0x3c')](_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x3c')]);_0x4ecfec[_0xc3ee('0x3d')]=qs[_0xc3ee('0x34')](_[_0xc3ee('0x3e')](_0xb9a672[_0xc3ee('0x33')],_0x56201a[_0xc3ee('0x34')]),_0x1be005);if(_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x3f')]){_0x4ecfec[_0xc3ee('0x3d')]=_[_0xc3ee('0x40')](_0x4ecfec[_0xc3ee('0x3d')],{'$or':_['map'](_0x1be005,function(_0x37adf3){if(_0x37adf3['type']!==_0xc3ee('0x41')){var _0x29419f={};_0x29419f[_0x37adf3[_0xc3ee('0x31')]]={'$like':'%'+_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x3f')]+'%'};return _0x29419f;}})});}_0x4ecfec=_[_0xc3ee('0x40')]({},_0x4ecfec,_0xb9a672['options']);var _0x2a80aa={'where':_0x4ecfec[_0xc3ee('0x3d')]};return db[_0xc3ee('0x2b')]['count'](_0x2a80aa)[_0xc3ee('0x25')](function(_0x105ecc){_0x4e0bc0[_0xc3ee('0x42')]=_0x105ecc;if(_0xb9a672[_0xc3ee('0x33')][_0xc3ee('0x43')]){_0x4ecfec[_0xc3ee('0x44')]=[{'all':!![]}];}return db[_0xc3ee('0x2b')][_0xc3ee('0x45')](_0x4ecfec);})[_0xc3ee('0x25')](function(_0x23d365){_0x4e0bc0[_0xc3ee('0x46')]=_0x23d365;return _0x4e0bc0;})['then'](respondWithFilteredResult(_0x836fac,_0x4ecfec))[_0xc3ee('0x47')](handleError(_0x836fac,null));};exports[_0xc3ee('0x48')]=function(_0x4a89b7,_0x4ec2a2){var _0x60ae59={'raw':!![],'where':{'id':_0x4a89b7[_0xc3ee('0x49')]['id']}},_0x45cef7={};_0x45cef7['model']=_[_0xc3ee('0x32')](db[_0xc3ee('0x2b')][_0xc3ee('0x2c')]);_0x45cef7[_0xc3ee('0x33')]=_[_0xc3ee('0x32')](_0x4a89b7[_0xc3ee('0x33')]);_0x45cef7[_0xc3ee('0x34')]=_[_0xc3ee('0x36')](_0x45cef7[_0xc3ee('0x2f')],_0x45cef7[_0xc3ee('0x33')]);_0x60ae59[_0xc3ee('0x35')]=_[_0xc3ee('0x36')](_0x45cef7[_0xc3ee('0x2f')],qs[_0xc3ee('0x37')](_0x4a89b7['query'][_0xc3ee('0x37')]));_0x60ae59['attributes']=_0x60ae59['attributes'][_0xc3ee('0x38')]?_0x60ae59[_0xc3ee('0x35')]:_0x45cef7['model'];if(_0x4a89b7[_0xc3ee('0x33')][_0xc3ee('0x43')]){_0x60ae59['include']=[{'all':!![]}];}_0x60ae59=_[_0xc3ee('0x40')]({},_0x60ae59,_0x4a89b7['options']);return db[_0xc3ee('0x2b')]['find'](_0x60ae59)[_0xc3ee('0x25')](handleEntityNotFound(_0x4ec2a2,null))[_0xc3ee('0x25')](respondWithResult(_0x4ec2a2,null))['catch'](handleError(_0x4ec2a2,null));};exports['create']=function(_0x5e54ec,_0x454ba0){return db[_0xc3ee('0x2b')][_0xc3ee('0x4a')](_0x5e54ec[_0xc3ee('0x4b')],{})[_0xc3ee('0x25')](respondWithResult(_0x454ba0,0xc9))['catch'](handleError(_0x454ba0,null));};exports['update']=function(_0x915fec,_0x27e4fc){if(_0x915fec['body']['id']){delete _0x915fec[_0xc3ee('0x4b')]['id'];}return db['VoiceMailMessage'][_0xc3ee('0x4c')]({'where':{'id':_0x915fec['params']['id']}})[_0xc3ee('0x25')](handleEntityNotFound(_0x27e4fc,null))[_0xc3ee('0x25')](saveUpdates(_0x915fec[_0xc3ee('0x4b')],null))[_0xc3ee('0x25')](respondWithResult(_0x27e4fc,null))[_0xc3ee('0x47')](handleError(_0x27e4fc,null));};exports[_0xc3ee('0x4d')]=function(_0xe02bba,_0x4daf91){return db[_0xc3ee('0x2b')][_0xc3ee('0x4c')]({'where':{'id':_0xe02bba[_0xc3ee('0x49')]['id']}})[_0xc3ee('0x25')](handleEntityNotFound(_0x4daf91,null))['then'](removeEntity(_0x4daf91,null))[_0xc3ee('0x47')](handleError(_0x4daf91,null));};exports[_0xc3ee('0x4e')]=function(_0x24dd0f,_0x3264c5,_0x2ed66c){return db[_0xc3ee('0x2b')][_0xc3ee('0x4c')]({'where':{'id':_0x24dd0f['params']['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0x3264c5,null))[_0xc3ee('0x25')](function(_0x2f3e48){if(_0x2f3e48){if(!_0x2f3e48[_0xc3ee('0x4f')]){throw new db[(_0xc3ee('0x50'))][(_0xc3ee('0x51'))]('VoiceMailMessage\x20not\x20found');}var _0x5de43a={'Content-Type':_0xc3ee('0x52'),'Content-Disposition':'attachment'};if(_0x2f3e48[_0xc3ee('0x53')]){_0x5de43a[_0xc3ee('0x54')]=_0xc3ee('0x55')+_0x2f3e48['msg_id']+_0xc3ee('0x56');}_0x3264c5[_0xc3ee('0x1f')](_0x5de43a);return _0x3264c5[_0xc3ee('0x28')](new Buffer(_0x2f3e48[_0xc3ee('0x4f')]));}})[_0xc3ee('0x47')](handleError(_0x3264c5,null));}; \ No newline at end of file +var _0xa571=['merge','VoiceMailMessage','includeAll','include','findAll','rows','show','params','length','options','find','create','body','catch','update','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','set','apply','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x47a224,_0x3438c6){var _0xb91da6=function(_0x4ae9cc){while(--_0x4ae9cc){_0x47a224['push'](_0x47a224['shift']());}};_0xb91da6(++_0x3438c6);}(_0xa571,0x107));var _0x1a57=function(_0x39e1f0,_0x560848){_0x39e1f0=_0x39e1f0-0x0;var _0x240e82=_0xa571[_0x39e1f0];return _0x240e82;};'use strict';var pdf=require(_0x1a57('0x0'));var emlformat=require(_0x1a57('0x1'));var rimraf=require(_0x1a57('0x2'));var zipdir=require(_0x1a57('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x4'));var moment=require(_0x1a57('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a57('0x6'));var path=require('path');var sox=require(_0x1a57('0x7'));var csv=require(_0x1a57('0x8'));var ejs=require(_0x1a57('0x9'));var fs=require('fs');var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x8'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2256af,_0x1911b2){_0x1911b2=_0x1911b2||0xcc;return function(_0x202d9a){if(_0x202d9a){return _0x2256af['sendStatus'](_0x1911b2);}return _0x2256af[_0x1a57('0x17')](_0x1911b2)[_0x1a57('0x18')]();};}function respondWithResult(_0x4c5ed4,_0x503278){_0x503278=_0x503278||0xc8;return function(_0x587422){if(_0x587422){return _0x4c5ed4[_0x1a57('0x17')](_0x503278)[_0x1a57('0x19')](_0x587422);}};}function respondWithFilteredResult(_0x27e824,_0x153d01){return function(_0x5802d6){if(_0x5802d6){var _0x20f7ad=_0x5802d6[_0x1a57('0x1a')],_0x53c61f=_0x153d01[_0x1a57('0x1b')],_0x49ee05=_0x153d01['offset']+_0x153d01[_0x1a57('0x1c')],_0x1b58d7;if(_0x49ee05>=_0x20f7ad){_0x49ee05=_0x20f7ad;_0x1b58d7=0xc8;}else{_0x1b58d7=0xce;}_0x27e824[_0x1a57('0x17')](_0x1b58d7);return _0x27e824[_0x1a57('0x1d')]('Content-Range',_0x53c61f+'-'+_0x49ee05+'/'+_0x20f7ad)[_0x1a57('0x19')](_0x5802d6);}return null;};}function patchUpdates(_0x4262c8){return function(_0x451b34){try{jsonpatch[_0x1a57('0x1e')](_0x451b34,_0x4262c8,!![]);}catch(_0xe936dd){return BPromise['reject'](_0xe936dd);}return _0x451b34['save']();};}function saveUpdates(_0x439844,_0x21e811){return function(_0x211c63){if(_0x211c63){return _0x211c63['update'](_0x439844)['then'](function(_0x51e271){return _0x51e271;});}return null;};}function removeEntity(_0x154cf3,_0x113ad4){return function(_0x3f52b9){if(_0x3f52b9){return _0x3f52b9[_0x1a57('0x1f')]()[_0x1a57('0x20')](function(){_0x154cf3[_0x1a57('0x17')](0xcc)[_0x1a57('0x18')]();});}};}function handleEntityNotFound(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(!_0x35d5dc){_0x2f8b00[_0x1a57('0x21')](0x194);}return _0x35d5dc;};}function handleError(_0x36b17e,_0x26cdd3){_0x26cdd3=_0x26cdd3||0x1f4;return function(_0x1b4cb5){logger[_0x1a57('0x22')](_0x1b4cb5[_0x1a57('0x23')]);if(_0x1b4cb5[_0x1a57('0x24')]){delete _0x1b4cb5[_0x1a57('0x24')];}_0x36b17e[_0x1a57('0x17')](_0x26cdd3)[_0x1a57('0x25')](_0x1b4cb5);};}exports[_0x1a57('0x26')]=function(_0x1dd939,_0x5a53c8){var _0x530401={},_0x139d8c={},_0x22549f={'count':0x0,'rows':[]};var _0x545041=_[_0x1a57('0x27')](db['VoiceMailMessage'][_0x1a57('0x28')],function(_0x4a2901){return{'name':_0x4a2901['fieldName'],'type':_0x4a2901[_0x1a57('0x29')][_0x1a57('0x2a')]};});_0x139d8c[_0x1a57('0x2b')]=_[_0x1a57('0x2c')](_['map'](_0x545041,_0x1a57('0x24')),[_0x1a57('0x24')]);_0x139d8c[_0x1a57('0x2d')]=_[_0x1a57('0x2e')](_0x1dd939['query']);_0x139d8c[_0x1a57('0x2f')]=_[_0x1a57('0x30')](_0x139d8c[_0x1a57('0x2b')],_0x139d8c[_0x1a57('0x2d')]);_0x530401[_0x1a57('0x31')]=_[_0x1a57('0x30')](_0x139d8c[_0x1a57('0x2b')],qs[_0x1a57('0x32')](_0x1dd939[_0x1a57('0x2d')]['fields']));_0x530401[_0x1a57('0x31')]=_0x530401[_0x1a57('0x31')]['length']?_0x530401['attributes']:_0x139d8c[_0x1a57('0x2b')];if(!_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x33')](_0x1a57('0x34'))){_0x530401[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x1c')]);_0x530401[_0x1a57('0x1b')]=qs[_0x1a57('0x1b')](_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x1b')]);}_0x530401[_0x1a57('0x35')]=qs[_0x1a57('0x36')](_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x36')]);_0x530401[_0x1a57('0x37')]=qs[_0x1a57('0x2f')](_['pick'](_0x1dd939[_0x1a57('0x2d')],_0x139d8c[_0x1a57('0x2f')]),_0x545041);if(_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x38')]){_0x530401[_0x1a57('0x37')]=_[_0x1a57('0x39')](_0x530401[_0x1a57('0x37')],{'$or':_[_0x1a57('0x27')](_0x545041,function(_0x1b6514){if(_0x1b6514['type']!=='VIRTUAL'){var _0x5da96f={};_0x5da96f[_0x1b6514['name']]={'$like':'%'+_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x38')]+'%'};return _0x5da96f;}})});}_0x530401=_[_0x1a57('0x39')]({},_0x530401,_0x1dd939['options']);var _0x364797={'where':_0x530401[_0x1a57('0x37')]};return db[_0x1a57('0x3a')][_0x1a57('0x1a')](_0x364797)['then'](function(_0x1be254){_0x22549f['count']=_0x1be254;if(_0x1dd939[_0x1a57('0x2d')][_0x1a57('0x3b')]){_0x530401[_0x1a57('0x3c')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x1a57('0x3d')](_0x530401);})[_0x1a57('0x20')](function(_0x61e9f6){_0x22549f[_0x1a57('0x3e')]=_0x61e9f6;return _0x22549f;})[_0x1a57('0x20')](respondWithFilteredResult(_0x5a53c8,_0x530401))['catch'](handleError(_0x5a53c8,null));};exports[_0x1a57('0x3f')]=function(_0x47e998,_0x4ba6b3){var _0x135e81={'raw':!![],'where':{'id':_0x47e998[_0x1a57('0x40')]['id']}},_0x5b42bd={};_0x5b42bd[_0x1a57('0x2b')]=_[_0x1a57('0x2e')](db['VoiceMailMessage'][_0x1a57('0x28')]);_0x5b42bd[_0x1a57('0x2d')]=_[_0x1a57('0x2e')](_0x47e998[_0x1a57('0x2d')]);_0x5b42bd['filters']=_[_0x1a57('0x30')](_0x5b42bd[_0x1a57('0x2b')],_0x5b42bd['query']);_0x135e81[_0x1a57('0x31')]=_['intersection'](_0x5b42bd['model'],qs[_0x1a57('0x32')](_0x47e998[_0x1a57('0x2d')][_0x1a57('0x32')]));_0x135e81[_0x1a57('0x31')]=_0x135e81['attributes'][_0x1a57('0x41')]?_0x135e81[_0x1a57('0x31')]:_0x5b42bd[_0x1a57('0x2b')];if(_0x47e998[_0x1a57('0x2d')][_0x1a57('0x3b')]){_0x135e81['include']=[{'all':!![]}];}_0x135e81=_[_0x1a57('0x39')]({},_0x135e81,_0x47e998[_0x1a57('0x42')]);return db[_0x1a57('0x3a')][_0x1a57('0x43')](_0x135e81)['then'](handleEntityNotFound(_0x4ba6b3,null))[_0x1a57('0x20')](respondWithResult(_0x4ba6b3,null))['catch'](handleError(_0x4ba6b3,null));};exports[_0x1a57('0x44')]=function(_0x36f8dc,_0x167b40){return db[_0x1a57('0x3a')][_0x1a57('0x44')](_0x36f8dc[_0x1a57('0x45')],{})[_0x1a57('0x20')](respondWithResult(_0x167b40,0xc9))[_0x1a57('0x46')](handleError(_0x167b40,null));};exports[_0x1a57('0x47')]=function(_0x424065,_0x7413df){if(_0x424065[_0x1a57('0x45')]['id']){delete _0x424065[_0x1a57('0x45')]['id'];}return db['VoiceMailMessage'][_0x1a57('0x43')]({'where':{'id':_0x424065[_0x1a57('0x40')]['id']}})[_0x1a57('0x20')](handleEntityNotFound(_0x7413df,null))[_0x1a57('0x20')](saveUpdates(_0x424065[_0x1a57('0x45')],null))[_0x1a57('0x20')](respondWithResult(_0x7413df,null))[_0x1a57('0x46')](handleError(_0x7413df,null));};exports[_0x1a57('0x1f')]=function(_0x3c17a9,_0x2c8daa){return db[_0x1a57('0x3a')]['find']({'where':{'id':_0x3c17a9[_0x1a57('0x40')]['id']}})[_0x1a57('0x20')](handleEntityNotFound(_0x2c8daa,null))['then'](removeEntity(_0x2c8daa,null))[_0x1a57('0x46')](handleError(_0x2c8daa,null));};exports[_0x1a57('0x48')]=function(_0x594f94,_0x48f798,_0x2155d7){return db['VoiceMailMessage']['find']({'where':{'id':_0x594f94['params']['id']},'attributes':['id',_0x1a57('0x49'),_0x1a57('0x4a')]})['then'](handleEntityNotFound(_0x48f798,null))[_0x1a57('0x20')](function(_0x18267c){if(_0x18267c){if(!_0x18267c['recording']){throw new db['Sequelize']['ValidationError'](_0x1a57('0x4b'));}var _0x23d1c3={'Content-Type':_0x1a57('0x4c'),'Content-Disposition':_0x1a57('0x4d')};if(_0x18267c[_0x1a57('0x4a')]){_0x23d1c3[_0x1a57('0x4e')]=_0x1a57('0x4f')+_0x18267c[_0x1a57('0x4a')]+'.wav\x22';}_0x48f798['set'](_0x23d1c3);return _0x48f798['send'](new Buffer(_0x18267c['recording']));}})['catch'](handleError(_0x48f798,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b122277..029c2f9 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 _0x72a1=['voice_voicemail_messages','dir','util','api','bluebird','request-promise','path','../../config/environment','exports','VoiceMailMessage'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0x72a1,0x1ce));var _0x172a=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x72a1[_0x4953da];return _0x2d3780;};'use strict';var _=require('lodash');var util=require(_0x172a('0x0'));var logger=require('../../config/logger')(_0x172a('0x1'));var moment=require('moment');var BPromise=require(_0x172a('0x2'));var rp=require(_0x172a('0x3'));var fs=require('fs');var path=require(_0x172a('0x4'));var rimraf=require('rimraf');var config=require(_0x172a('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0x172a('0x6')]=function(_0x5bc607,_0x13724a){return _0x5bc607['define'](_0x172a('0x7'),attributes,{'tableName':_0x172a('0x8'),'paranoid':![],'indexes':[{'name':_0x172a('0x9'),'fields':[_0x172a('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9d62=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3acb0f,_0x422e6f){var _0x5bdb4f=function(_0x424444){while(--_0x424444){_0x3acb0f['push'](_0x3acb0f['shift']());}};_0x5bdb4f(++_0x422e6f);}(_0x9d62,0xaf));var _0x29d6=function(_0x23c83c,_0x336e67){_0x23c83c=_0x23c83c-0x0;var _0x50e146=_0x9d62[_0x23c83c];return _0x50e146;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var logger=require(_0x29d6('0x2'))(_0x29d6('0x3'));var moment=require(_0x29d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x29d6('0x5'));var fs=require('fs');var path=require(_0x29d6('0x6'));var rimraf=require(_0x29d6('0x7'));var config=require(_0x29d6('0x8'));var attributes=require(_0x29d6('0x9'));module['exports']=function(_0x2962a9,_0x468e41){return _0x2962a9[_0x29d6('0xa')](_0x29d6('0xb'),attributes,{'tableName':_0x29d6('0xc'),'paranoid':![],'indexes':[{'name':_0x29d6('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index fd2eb5a..29bba9d 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x0b0e[_0x609988];return _0x159984;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x7a54=['info','VoiceMailMessage,\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(_0x4c8064,_0xb705a2){_0x4c8064=_0x4c8064-0x0;var _0x4efa61=_0x7a54[_0x4c8064];return _0x4efa61;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 15700a0..78c5a87 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 _0x7321=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','post','create','addSound','update','delete','/:id/sounds/:id2','removeSound','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x58c8fd,_0x2d395e){var _0x548eef=function(_0x2b1129){while(--_0x2b1129){_0x58c8fd['push'](_0x58c8fd['shift']());}};_0x548eef(++_0x2d395e);}(_0x7321,0x1e1));var _0x1732=function(_0x48f3d7,_0x3dbff1){_0x48f3d7=_0x48f3d7-0x0;var _0x29f2b2=_0x7321[_0x48f3d7];return _0x29f2b2;};'use strict';var multer=require('multer');var util=require(_0x1732('0x0'));var path=require('path');var timeout=require(_0x1732('0x1'));var express=require(_0x1732('0x2'));var router=express[_0x1732('0x3')]();var auth=require(_0x1732('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1732('0x5'));var controller=require(_0x1732('0x6'));router[_0x1732('0x7')]('/',auth[_0x1732('0x8')](),controller['index']);router['get'](_0x1732('0x9'),auth[_0x1732('0x8')](),controller[_0x1732('0xa')]);router[_0x1732('0x7')]('/:id/sounds',auth[_0x1732('0x8')](),controller['getSounds']);router[_0x1732('0xb')]('/',auth[_0x1732('0x8')](),controller[_0x1732('0xc')]);router['post']('/:id/sounds',auth[_0x1732('0x8')](),controller[_0x1732('0xd')]);router['put'](_0x1732('0x9'),auth[_0x1732('0x8')](),controller[_0x1732('0xe')]);router[_0x1732('0xf')](_0x1732('0x9'),auth[_0x1732('0x8')](),controller['destroy']);router[_0x1732('0xf')](_0x1732('0x10'),auth[_0x1732('0x8')](),controller[_0x1732('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7317=['index','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x31fbc1,_0x4e575f){var _0x3131e7=function(_0x21f72d){while(--_0x21f72d){_0x31fbc1['push'](_0x31fbc1['shift']());}};_0x3131e7(++_0x4e575f);}(_0x7317,0x1c4));var _0x7731=function(_0x440a94,_0x571dd0){_0x440a94=_0x440a94-0x0;var _0x177238=_0x7317[_0x440a94];return _0x177238;};'use strict';var multer=require('multer');var util=require(_0x7731('0x0'));var path=require(_0x7731('0x1'));var timeout=require(_0x7731('0x2'));var express=require(_0x7731('0x3'));var router=express[_0x7731('0x4')]();var auth=require(_0x7731('0x5'));var interaction=require(_0x7731('0x6'));var config=require('../../config/environment');var controller=require(_0x7731('0x7'));router[_0x7731('0x8')]('/',auth[_0x7731('0x9')](),controller[_0x7731('0xa')]);router[_0x7731('0x8')](_0x7731('0xb'),auth['isAuthenticated'](),controller[_0x7731('0xc')]);router[_0x7731('0x8')](_0x7731('0xd'),auth[_0x7731('0x9')](),controller[_0x7731('0xe')]);router[_0x7731('0xf')]('/',auth[_0x7731('0x9')](),controller[_0x7731('0x10')]);router[_0x7731('0xf')]('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router[_0x7731('0x11')](_0x7731('0xb'),auth[_0x7731('0x9')](),controller[_0x7731('0x12')]);router[_0x7731('0x13')](_0x7731('0xb'),auth[_0x7731('0x9')](),controller[_0x7731('0x14')]);router[_0x7731('0x13')](_0x7731('0x15'),auth[_0x7731('0x9')](),controller['removeSound']);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 2bc683a..0085af3 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 _0x5339=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x30a8e6,_0x4f23d1){var _0x5a3220=function(_0x211c47){while(--_0x211c47){_0x30a8e6['push'](_0x30a8e6['shift']());}};_0x5a3220(++_0x4f23d1);}(_0x5339,0x75));var _0x9533=function(_0x35c5dd,_0x1b3c19){_0x35c5dd=_0x35c5dd-0x0;var _0x53c5b4=_0x5339[_0x35c5dd];return _0x53c5b4;};'use strict';var Sequelize=require(_0x9533('0x0'));module[_0x9533('0x1')]={'name':{'type':Sequelize[_0x9533('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9533('0x3')]('custom',_0x9533('0x4'),_0x9533('0x5'),_0x9533('0x6'),_0x9533('0x7'),_0x9533('0x8')),'allowNull':!![],'defaultValue':_0x9533('0x4')},'directory':{'type':Sequelize[_0x9533('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9533('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9533('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9533('0x2')],'allowNull':!![],'defaultValue':_0x9533('0x9')},'format':{'type':Sequelize[_0x9533('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x9533('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xecf9=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports'];(function(_0x430fef,_0x575f8c){var _0x143b62=function(_0x773fd0){while(--_0x773fd0){_0x430fef['push'](_0x430fef['shift']());}};_0x143b62(++_0x575f8c);}(_0xecf9,0x19e));var _0x9ecf=function(_0x8e2d4d,_0x310930){_0x8e2d4d=_0x8e2d4d-0x0;var _0x5e3047=_0xecf9[_0x8e2d4d];return _0x5e3047;};'use strict';var Sequelize=require(_0x9ecf('0x0'));module[_0x9ecf('0x1')]={'name':{'type':Sequelize[_0x9ecf('0x2')],'allowNull':![],'unique':_0x9ecf('0x3')},'mode':{'type':Sequelize[_0x9ecf('0x4')](_0x9ecf('0x5'),_0x9ecf('0x6'),_0x9ecf('0x7'),_0x9ecf('0x8'),_0x9ecf('0x9'),_0x9ecf('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9ecf('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9ecf('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9ecf('0xb')},'format':{'type':Sequelize[_0x9ecf('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x9ecf('0xc')],'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 b4fe95d..ade6bbe 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 _0x5f2f=['getSounds','nolimit','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','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x249ae7,_0x4cf9e7){var _0x581c24=function(_0x5d12ed){while(--_0x5d12ed){_0x249ae7['push'](_0x249ae7['shift']());}};_0x581c24(++_0x4cf9e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4deca4,_0x18dab3){_0x4deca4=_0x4deca4-0x0;var _0x427c34=_0x5f2f[_0x4deca4];return _0x427c34;};'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(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x492ef6,_0x55463f){var _0x1d3801=function(_0x2460ce){while(--_0x2460ce){_0x492ef6['push'](_0x492ef6['shift']());}};_0x1d3801(++_0x55463f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c081d,_0x10b432){_0x1c081d=_0x1c081d-0x0;var _0x2deb0e=_0xb10b[_0x1c081d];return _0x2deb0e;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 65949c6..cf1e9e3 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 _0x20da=['api','moment','bluebird','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x1b700f,_0x53604e){var _0x41c8fe=function(_0x2fe005){while(--_0x2fe005){_0x1b700f['push'](_0x1b700f['shift']());}};_0x41c8fe(++_0x53604e);}(_0x20da,0x172));var _0xa20d=function(_0xa4ccc9,_0x508ad2){_0xa4ccc9=_0xa4ccc9-0x0;var _0x51f495=_0x20da[_0xa4ccc9];return _0x51f495;};'use strict';var _=require(_0xa20d('0x0'));var util=require(_0xa20d('0x1'));var logger=require('../../config/logger')(_0xa20d('0x2'));var moment=require(_0xa20d('0x3'));var BPromise=require(_0xa20d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa20d('0x5'));var rimraf=require(_0xa20d('0x6'));var config=require('../../config/environment');var attributes=require(_0xa20d('0x7'));module[_0xa20d('0x8')]=function(_0x24dd5e,_0x516d68){return _0x24dd5e[_0xa20d('0x9')](_0xa20d('0xa'),attributes,{'tableName':_0xa20d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17b8=['api','moment','bluebird','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x1a675c,_0x4648bc){var _0x4ee1dc=function(_0x4ab719){while(--_0x4ab719){_0x1a675c['push'](_0x1a675c['shift']());}};_0x4ee1dc(++_0x4648bc);}(_0x17b8,0x110));var _0x817b=function(_0x1422f7,_0x463084){_0x1422f7=_0x1422f7-0x0;var _0x1e9995=_0x17b8[_0x1422f7];return _0x1e9995;};'use strict';var _=require(_0x817b('0x0'));var util=require(_0x817b('0x1'));var logger=require(_0x817b('0x2'))(_0x817b('0x3'));var moment=require(_0x817b('0x4'));var BPromise=require(_0x817b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x817b('0x6'));var attributes=require(_0x817b('0x7'));module[_0x817b('0x8')]=function(_0x55fb35,_0x4af4bc){return _0x55fb35[_0x817b('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x817b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f23a826..c214064 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 _0x5781=['VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug'];(function(_0x5df647,_0x348d59){var _0xb8a284=function(_0x4b3b3e){while(--_0x4b3b3e){_0x5df647['push'](_0x5df647['shift']());}};_0xb8a284(++_0x348d59);}(_0x5781,0x92));var _0x1578=function(_0x1cad4c,_0x318b83){_0x1cad4c=_0x1cad4c-0x0;var _0x5cc49a=_0x5781[_0x1cad4c];return _0x5cc49a;};'use strict';var _=require('lodash');var util=require(_0x1578('0x0'));var moment=require(_0x1578('0x1'));var BPromise=require(_0x1578('0x2'));var rs=require(_0x1578('0x3'));var fs=require('fs');var Redis=require(_0x1578('0x4'));var db=require(_0x1578('0x5'))['db'];var utils=require(_0x1578('0x6'));var logger=require('../../config/logger')(_0x1578('0x7'));var config=require(_0x1578('0x8'));var jayson=require(_0x1578('0x9'));var client=jayson['client'][_0x1578('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55ed55,_0x15114d,_0x4403b7){return new BPromise(function(_0x3b87af,_0x3cf3ac){return client['request'](_0x55ed55,_0x4403b7)[_0x1578('0xb')](function(_0x21977d){logger[_0x1578('0xc')](_0x1578('0xd'),_0x15114d,'request\x20sent');logger[_0x1578('0xe')](_0x1578('0xf'),_0x15114d,'request\x20sent',JSON[_0x1578('0x10')](_0x21977d));if(_0x21977d[_0x1578('0x11')]){if(_0x21977d[_0x1578('0x11')][_0x1578('0x12')]===0x1f4){logger[_0x1578('0x11')](_0x1578('0xd'),_0x15114d,_0x21977d['error'][_0x1578('0x13')]);return _0x3cf3ac(_0x21977d[_0x1578('0x11')][_0x1578('0x13')]);}logger[_0x1578('0x11')](_0x1578('0xd'),_0x15114d,_0x21977d['error'][_0x1578('0x13')]);return _0x3b87af(_0x21977d[_0x1578('0x11')][_0x1578('0x13')]);}else{logger[_0x1578('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x15114d,_0x1578('0x14'));_0x3b87af(_0x21977d[_0x1578('0x15')][_0x1578('0x13')]);}})[_0x1578('0x16')](function(_0x385b86){logger[_0x1578('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x15114d,_0x385b86);_0x3cf3ac(_0x385b86);});});} \ No newline at end of file +var _0x8145=['VoiceMusicOnHold,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request\x20sent','stringify','error'];(function(_0x343c9a,_0x23b026){var _0x24a990=function(_0x1bd616){while(--_0x1bd616){_0x343c9a['push'](_0x343c9a['shift']());}};_0x24a990(++_0x23b026);}(_0x8145,0x1b4));var _0x5814=function(_0x11722b,_0x247eb2){_0x11722b=_0x11722b-0x0;var _0x2065f0=_0x8145[_0x11722b];return _0x2065f0;};'use strict';var _=require(_0x5814('0x0'));var util=require('util');var moment=require(_0x5814('0x1'));var BPromise=require(_0x5814('0x2'));var rs=require(_0x5814('0x3'));var fs=require('fs');var Redis=require(_0x5814('0x4'));var db=require(_0x5814('0x5'))['db'];var utils=require(_0x5814('0x6'));var logger=require(_0x5814('0x7'))(_0x5814('0x8'));var config=require(_0x5814('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5814('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fbad8,_0x4e7945,_0x122cbe){return new BPromise(function(_0x2278a7,_0x39ca27){return client['request'](_0x2fbad8,_0x122cbe)['then'](function(_0x3db1d5){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x4e7945,_0x5814('0xb'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4e7945,'request\x20sent',JSON[_0x5814('0xc')](_0x3db1d5));if(_0x3db1d5[_0x5814('0xd')]){if(_0x3db1d5[_0x5814('0xd')]['code']===0x1f4){logger[_0x5814('0xd')](_0x5814('0xe'),_0x4e7945,_0x3db1d5[_0x5814('0xd')][_0x5814('0xf')]);return _0x39ca27(_0x3db1d5[_0x5814('0xd')]['message']);}logger[_0x5814('0xd')](_0x5814('0xe'),_0x4e7945,_0x3db1d5[_0x5814('0xd')][_0x5814('0xf')]);return _0x2278a7(_0x3db1d5[_0x5814('0xd')][_0x5814('0xf')]);}else{logger[_0x5814('0x10')](_0x5814('0xe'),_0x4e7945,_0x5814('0xb'));_0x2278a7(_0x3db1d5[_0x5814('0x11')][_0x5814('0xf')]);}})['catch'](function(_0x1769a2){logger[_0x5814('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4e7945,_0x1769a2);_0x39ca27(_0x1769a2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e6f6885..5bec2ec 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 _0x092f=['destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete'];(function(_0x36ee90,_0x2932ac){var _0xa8a83e=function(_0x181261){while(--_0x181261){_0x36ee90['push'](_0x36ee90['shift']());}};_0xa8a83e(++_0x2932ac);}(_0x092f,0x9d));var _0xf092=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0x092f[_0x36436d];return _0x34615d;};'use strict';var multer=require('multer');var util=require(_0xf092('0x0'));var path=require(_0xf092('0x1'));var timeout=require('connect-timeout');var express=require(_0xf092('0x2'));var router=express['Router']();var auth=require(_0xf092('0x3'));var interaction=require(_0xf092('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xf092('0x5')]('/',auth[_0xf092('0x6')](),controller[_0xf092('0x7')]);router[_0xf092('0x5')](_0xf092('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xf092('0x5')](_0xf092('0x9'),auth['isAuthenticated'](),controller[_0xf092('0xa')]);router[_0xf092('0x5')](_0xf092('0xb'),auth[_0xf092('0x6')](),controller[_0xf092('0xc')]);router[_0xf092('0xd')]('/',auth[_0xf092('0x6')](),controller[_0xf092('0xe')]);router[_0xf092('0xd')](_0xf092('0xb'),auth[_0xf092('0x6')](),controller[_0xf092('0xf')]);router[_0xf092('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf092('0x11')]);router[_0xf092('0x12')]('/:id',auth[_0xf092('0x6')](),controller[_0xf092('0x13')]);router[_0xf092('0x12')](_0xf092('0xb'),auth['isAuthenticated'](),controller[_0xf092('0x14')]);module[_0xf092('0x15')]=router; \ No newline at end of file +var _0x8d5e=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','/:id/users','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x300a25,_0x5931c7){var _0x44ca63=function(_0xf9fb41){while(--_0xf9fb41){_0x300a25['push'](_0x300a25['shift']());}};_0x44ca63(++_0x5931c7);}(_0x8d5e,0xb8));var _0xe8d5=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x8d5e[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0xe8d5('0x0'));var util=require('util');var path=require(_0xe8d5('0x1'));var timeout=require(_0xe8d5('0x2'));var express=require('express');var router=express[_0xe8d5('0x3')]();var auth=require(_0xe8d5('0x4'));var interaction=require(_0xe8d5('0x5'));var config=require(_0xe8d5('0x6'));var controller=require(_0xe8d5('0x7'));router['get']('/',auth[_0xe8d5('0x8')](),controller[_0xe8d5('0x9')]);router[_0xe8d5('0xa')](_0xe8d5('0xb'),auth[_0xe8d5('0x8')](),controller[_0xe8d5('0xc')]);router[_0xe8d5('0xa')](_0xe8d5('0xd'),auth[_0xe8d5('0x8')](),controller[_0xe8d5('0xe')]);router['get']('/:id/users',auth[_0xe8d5('0x8')](),controller['getAgents']);router[_0xe8d5('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe8d5('0xf')](_0xe8d5('0x10'),auth['isAuthenticated'](),controller[_0xe8d5('0x11')]);router[_0xe8d5('0x12')](_0xe8d5('0xd'),auth[_0xe8d5('0x8')](),controller[_0xe8d5('0x13')]);router[_0xe8d5('0x14')](_0xe8d5('0xd'),auth[_0xe8d5('0x8')](),controller[_0xe8d5('0x15')]);router[_0xe8d5('0x14')](_0xe8d5('0x10'),auth['isAuthenticated'](),controller[_0xe8d5('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7b72294..78b8107 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 _0xf67d=['VIRTUAL','getDataValue','sequelize','exports','STRING','name'];(function(_0x2063b4,_0x42144c){var _0x6c215f=function(_0x5e509c){while(--_0x5e509c){_0x2063b4['push'](_0x2063b4['shift']());}};_0x6c215f(++_0x42144c);}(_0xf67d,0x1d0));var _0xdf67=function(_0x39b02d,_0x1abb66){_0x39b02d=_0x39b02d-0x0;var _0x2cc042=_0xf67d[_0x39b02d];return _0x2cc042;};'use strict';var Sequelize=require(_0xdf67('0x0'));module[_0xdf67('0x1')]={'name':{'type':Sequelize[_0xdf67('0x2')],'allowNull':![],'unique':_0xdf67('0x3')},'prefix':{'type':Sequelize[_0xdf67('0x4')],'get':function(_0x421eb1){return'system-'+this[_0xdf67('0x5')](_0xdf67('0x3'))+'-';}},'description':{'type':Sequelize[_0xdf67('0x2')]},'callerIdAll':{'type':Sequelize[_0xdf67('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2346=['exports','STRING','name','system-','getDataValue','INTEGER'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0x2346,0xc6));var _0x6234=function(_0x346dba,_0x4301dd){_0x346dba=_0x346dba-0x0;var _0x3fafe1=_0x2346[_0x346dba];return _0x3fafe1;};'use strict';var Sequelize=require('sequelize');module[_0x6234('0x0')]={'name':{'type':Sequelize[_0x6234('0x1')],'allowNull':![],'unique':_0x6234('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x520c5f){return _0x6234('0x3')+this[_0x6234('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x6234('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6234('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 66d8647..e20e504 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 _0xbb28=['reject','save','then','get','VoicePrefixes','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','params','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','prefix','NoOp','VoicePrefixId','VoiceExtension','VoiceExtensionId','Set','callerIdAll','push','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','sequelize','findById','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x4bab8e,_0x3e973b){var _0x3778a4=function(_0x110bca){while(--_0x110bca){_0x4bab8e['push'](_0x4bab8e['shift']());}};_0x3778a4(++_0x3e973b);}(_0xbb28,0x1bd));var _0x8bb2=function(_0x2248e2,_0x56e51c){_0x2248e2=_0x2248e2-0x0;var _0x3b23b9=_0xbb28[_0x2248e2];return _0x3b23b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8bb2('0x0'));var rimraf=require(_0x8bb2('0x1'));var zipdir=require(_0x8bb2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8bb2('0x3'));var BPromise=require(_0x8bb2('0x4'));var Mustache=require(_0x8bb2('0x5'));var util=require(_0x8bb2('0x6'));var path=require('path');var sox=require(_0x8bb2('0x7'));var csv=require(_0x8bb2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8bb2('0x9'));var squel=require(_0x8bb2('0xa'));var crypto=require(_0x8bb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8bb2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8bb2('0xd'));var Papa=require(_0x8bb2('0xe'));var Redis=require(_0x8bb2('0xf'));var authService=require(_0x8bb2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bb2('0x11'));var logger=require(_0x8bb2('0x12'))(_0x8bb2('0x13'));var utils=require(_0x8bb2('0x14'));var config=require(_0x8bb2('0x15'));var db=require(_0x8bb2('0x16'))['db'];config[_0x8bb2('0x17')]=_[_0x8bb2('0x18')](config[_0x8bb2('0x17')],{'host':_0x8bb2('0x19'),'port':0x18eb});var socket=require(_0x8bb2('0x1a'))(new Redis(config[_0x8bb2('0x17')]));require(_0x8bb2('0x1b'))[_0x8bb2('0x1c')](socket);function respondWithStatusCode(_0x5d720e,_0x150804){_0x150804=_0x150804||0xcc;return function(_0xc47418){if(_0xc47418){return _0x5d720e[_0x8bb2('0x1d')](_0x150804);}return _0x5d720e[_0x8bb2('0x1e')](_0x150804)[_0x8bb2('0x1f')]();};}function respondWithResult(_0x37eda6,_0x660e56){_0x660e56=_0x660e56||0xc8;return function(_0x3a1982){if(_0x3a1982){return _0x37eda6['status'](_0x660e56)[_0x8bb2('0x20')](_0x3a1982);}};}function respondWithFilteredResult(_0x32b976,_0x587a68){return function(_0x594b34){if(_0x594b34){var _0x7e2f6=_0x594b34[_0x8bb2('0x21')],_0xb85844=_0x587a68[_0x8bb2('0x22')],_0x47dbde=_0x587a68[_0x8bb2('0x22')]+_0x587a68[_0x8bb2('0x23')],_0x3f9f38;if(_0x47dbde>=_0x7e2f6){_0x47dbde=_0x7e2f6;_0x3f9f38=0xc8;}else{_0x3f9f38=0xce;}_0x32b976['status'](_0x3f9f38);return _0x32b976[_0x8bb2('0x24')](_0x8bb2('0x25'),_0xb85844+'-'+_0x47dbde+'/'+_0x7e2f6)['json'](_0x594b34);}return null;};}function patchUpdates(_0x75261e){return function(_0x3859f2){try{jsonpatch[_0x8bb2('0x26')](_0x3859f2,_0x75261e,!![]);}catch(_0x2ebc46){return BPromise[_0x8bb2('0x27')](_0x2ebc46);}return _0x3859f2[_0x8bb2('0x28')]();};}function saveUpdates(_0x24c3ae,_0x424da9){return function(_0x291816){if(_0x291816){return _0x291816['update'](_0x24c3ae)[_0x8bb2('0x29')](function(_0x3ad399){return _0x3ad399;});}return null;};}function removeEntity(_0x2da88b,_0x10e69e){return function(_0x5d9d07){if(_0x5d9d07){return _0x5d9d07['destroy']()[_0x8bb2('0x29')](function(){var _0x1518cb=_0x5d9d07[_0x8bb2('0x2a')]({'plain':!![]});var _0x349b72=_0x8bb2('0x2b');return db['UserProfileResource'][_0x8bb2('0x2c')]({'where':{'type':_0x349b72,'resourceId':_0x1518cb['id']}})[_0x8bb2('0x29')](function(){return _0x5d9d07;});})[_0x8bb2('0x29')](function(){_0x2da88b[_0x8bb2('0x1e')](0xcc)[_0x8bb2('0x1f')]();});}};}function handleEntityNotFound(_0x5f1bd6,_0x52df22){return function(_0x26c078){if(!_0x26c078){_0x5f1bd6[_0x8bb2('0x1d')](0x194);}return _0x26c078;};}function handleError(_0x29b12a,_0x5c4573){_0x5c4573=_0x5c4573||0x1f4;return function(_0x563990){logger[_0x8bb2('0x2d')](_0x563990[_0x8bb2('0x2e')]);if(_0x563990[_0x8bb2('0x2f')]){delete _0x563990[_0x8bb2('0x2f')];}_0x29b12a[_0x8bb2('0x1e')](_0x5c4573)[_0x8bb2('0x30')](_0x563990);};}exports[_0x8bb2('0x31')]=function(_0x3fb208,_0x5455e3){var _0x1ff4e1={},_0x10d144={},_0xa8e05e={'count':0x0,'rows':[]};var _0x574b44=_[_0x8bb2('0x32')](db[_0x8bb2('0x33')][_0x8bb2('0x34')],function(_0x3418ca){return{'name':_0x3418ca['fieldName'],'type':_0x3418ca['type']['key']};});_0x10d144[_0x8bb2('0x35')]=_[_0x8bb2('0x32')](_0x574b44,_0x8bb2('0x2f'));_0x10d144[_0x8bb2('0x36')]=_[_0x8bb2('0x37')](_0x3fb208[_0x8bb2('0x36')]);_0x10d144[_0x8bb2('0x38')]=_['intersection'](_0x10d144[_0x8bb2('0x35')],_0x10d144[_0x8bb2('0x36')]);_0x1ff4e1['attributes']=_['intersection'](_0x10d144['model'],qs['fields'](_0x3fb208[_0x8bb2('0x36')][_0x8bb2('0x39')]));_0x1ff4e1[_0x8bb2('0x3a')]=_0x1ff4e1[_0x8bb2('0x3a')][_0x8bb2('0x3b')]?_0x1ff4e1[_0x8bb2('0x3a')]:_0x10d144[_0x8bb2('0x35')];if(!_0x3fb208['query'][_0x8bb2('0x3c')](_0x8bb2('0x3d'))){_0x1ff4e1[_0x8bb2('0x23')]=qs[_0x8bb2('0x23')](_0x3fb208[_0x8bb2('0x36')]['limit']);_0x1ff4e1[_0x8bb2('0x22')]=qs[_0x8bb2('0x22')](_0x3fb208[_0x8bb2('0x36')][_0x8bb2('0x22')]);}_0x1ff4e1[_0x8bb2('0x3e')]=qs[_0x8bb2('0x3f')](_0x3fb208[_0x8bb2('0x36')]['sort']);_0x1ff4e1[_0x8bb2('0x40')]=qs['filters'](_['pick'](_0x3fb208[_0x8bb2('0x36')],_0x10d144[_0x8bb2('0x38')]),_0x574b44);if(_0x3fb208[_0x8bb2('0x36')][_0x8bb2('0x41')]){_0x1ff4e1['where']=_[_0x8bb2('0x42')](_0x1ff4e1[_0x8bb2('0x40')],{'$or':_[_0x8bb2('0x32')](_0x574b44,function(_0x58ee4b){if(_0x58ee4b[_0x8bb2('0x43')]!==_0x8bb2('0x44')){var _0x16d82e={};_0x16d82e[_0x58ee4b[_0x8bb2('0x2f')]]={'$like':'%'+_0x3fb208[_0x8bb2('0x36')][_0x8bb2('0x41')]+'%'};return _0x16d82e;}})});}_0x1ff4e1=_[_0x8bb2('0x42')]({},_0x1ff4e1,_0x3fb208[_0x8bb2('0x45')]);var _0x35c3cd={'where':_0x1ff4e1[_0x8bb2('0x40')]};return db[_0x8bb2('0x33')][_0x8bb2('0x21')](_0x35c3cd)['then'](function(_0x1953fb){_0xa8e05e[_0x8bb2('0x21')]=_0x1953fb;if(_0x3fb208[_0x8bb2('0x36')][_0x8bb2('0x46')]){_0x1ff4e1[_0x8bb2('0x47')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8bb2('0x48')](_0x1ff4e1);})[_0x8bb2('0x29')](function(_0x4a0cc5){_0xa8e05e[_0x8bb2('0x49')]=_0x4a0cc5;return _0xa8e05e;})[_0x8bb2('0x29')](respondWithFilteredResult(_0x5455e3,_0x1ff4e1))[_0x8bb2('0x4a')](handleError(_0x5455e3,null));};exports[_0x8bb2('0x4b')]=function(_0x527fe8,_0x379986){var _0x2f1bc8={'raw':![],'where':{'id':_0x527fe8['params']['id']}},_0x3751bb={};_0x3751bb['model']=_[_0x8bb2('0x37')](db['VoicePrefix'][_0x8bb2('0x34')]);_0x3751bb[_0x8bb2('0x36')]=_[_0x8bb2('0x37')](_0x527fe8[_0x8bb2('0x36')]);_0x3751bb['filters']=_[_0x8bb2('0x4c')](_0x3751bb[_0x8bb2('0x35')],_0x3751bb[_0x8bb2('0x36')]);_0x2f1bc8[_0x8bb2('0x3a')]=_[_0x8bb2('0x4c')](_0x3751bb['model'],qs['fields'](_0x527fe8[_0x8bb2('0x36')]['fields']));_0x2f1bc8[_0x8bb2('0x3a')]=_0x2f1bc8['attributes'][_0x8bb2('0x3b')]?_0x2f1bc8[_0x8bb2('0x3a')]:_0x3751bb['model'];if(_0x527fe8[_0x8bb2('0x36')][_0x8bb2('0x46')]){_0x2f1bc8[_0x8bb2('0x47')]=[{'all':!![]}];}_0x2f1bc8=_['merge']({},_0x2f1bc8,_0x527fe8[_0x8bb2('0x45')]);return db[_0x8bb2('0x33')][_0x8bb2('0x4d')](_0x2f1bc8)[_0x8bb2('0x29')](handleEntityNotFound(_0x379986,null))[_0x8bb2('0x29')](respondWithResult(_0x379986,null))[_0x8bb2('0x4a')](handleError(_0x379986,null));};exports['destroy']=function(_0x36ce10,_0x48d281){return db[_0x8bb2('0x33')][_0x8bb2('0x4d')]({'where':{'id':_0x36ce10[_0x8bb2('0x4e')]['id']}})[_0x8bb2('0x29')](handleEntityNotFound(_0x48d281,null))['then'](removeEntity(_0x48d281,null))[_0x8bb2('0x4a')](handleError(_0x48d281,null));};exports[_0x8bb2('0x4f')]=function(_0x41f452,_0x17e8cb){return db[_0x8bb2('0x33')][_0x8bb2('0x4f')]()[_0x8bb2('0x29')](respondWithResult(_0x17e8cb,null))[_0x8bb2('0x4a')](handleError(_0x17e8cb,null));};exports[_0x8bb2('0x50')]=function(_0x3b4276,_0xa3c039){var _0x498f54;return db['sequelize']['transaction'](function(_0x560e83){return db[_0x8bb2('0x33')][_0x8bb2('0x50')](_0x3b4276[_0x8bb2('0x51')],{'transaction':_0x560e83})['then'](function(_0x2bd15a){_0x498f54=_0x2bd15a[_0x8bb2('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0x8bb2('0x4d')]({'where':{'id':_0x498f54['VoiceExtensionId']},'raw':!![]})[_0x8bb2('0x29')](function(_0x4afb6b){return createVoicePrefixExtensions(_0x498f54,_0x4afb6b,_0x560e83);});});})[_0x8bb2('0x29')](function(){var _0xb4e917=_0x3b4276[_0x8bb2('0x52')]['get']({'plain':!![]});if(!_0xb4e917)throw new Error(_0x8bb2('0x53'));if(_0xb4e917['role']==='user'){var _0x4e0ad3=_0x498f54;return db[_0x8bb2('0x54')][_0x8bb2('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0xb4e917[_0x8bb2('0x55')]},'raw':!![]})['then'](function(_0x144c69){if(_0x144c69&&_0x144c69[_0x8bb2('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x4e0ad3['name'],'resourceId':_0x4e0ad3['id'],'type':_0x144c69[_0x8bb2('0x2f')],'sectionId':_0x144c69['id']},{})[_0x8bb2('0x29')](function(){return _0x498f54;});}else{return _0x498f54;}})[_0x8bb2('0x4a')](function(_0x243961){logger[_0x8bb2('0x2d')](_0x8bb2('0x57'),_0x243961);throw _0x243961;});}return _0x498f54;})[_0x8bb2('0x29')](respondWithResult(_0xa3c039,null))[_0x8bb2('0x4a')](handleError(_0xa3c039,null));};function Extension(_0x4042b8,_0x450c8d,_0x2cee60,_0x14aa3c){this[_0x8bb2('0x58')]=_0x8bb2('0x59');this[_0x8bb2('0x5a')]=_0x4042b8;this[_0x8bb2('0x5b')]=_0x2cee60;this[_0x8bb2('0x43')]=_0x8bb2('0x5c');this[_0x8bb2('0x5d')]='Voice\x20Prefix\x20Extension';this[_0x8bb2('0x5e')]=_0x450c8d;this['appdata']=_0x14aa3c;}function createVoicePrefixExtensions(_0x291035,_0x516457,_0x468ce3){return new BPromise(function(_0x5aa3ef,_0x594b2d){var _0x177218=new Extension(formatPrefixName(_0x291035[_0x8bb2('0x5f')]),0x1,_0x8bb2('0x60'),'Voice\x20Prefix');_0x177218[_0x8bb2('0x61')]=_0x291035['id'];return db[_0x8bb2('0x62')][_0x8bb2('0x50')](_0x177218,{'transaction':_0x468ce3})[_0x8bb2('0x29')](function(_0x41d974){var _0x517a4e=_0x41d974['get']({'plain':!![]});var _0x49a20f=_[_0x8bb2('0x32')](addVoicePrefixExtensions(_0x291035,_0x516457),function(_0x4d0532){_0x4d0532[_0x8bb2('0x63')]=_0x517a4e['id'];_0x4d0532['VoicePrefixId']=_0x291035['id'];return _0x4d0532;});return db[_0x8bb2('0x62')]['bulkCreate'](_0x49a20f,{'transaction':_0x468ce3})[_0x8bb2('0x29')](function(_0x4fb8f8){if(!_0x4fb8f8){return _0x594b2d('Extensions\x20creation\x20failed');}else{return _0x5aa3ef(_0x4fb8f8);}})[_0x8bb2('0x4a')](function(_0x48a55d){return _0x594b2d(_0x48a55d);});});;});};function addVoicePrefixExtensions(_0x6b1fe0,_0x49065b){var _0x2367aa=[];var _0x23f671=formatPrefixName(_0x6b1fe0[_0x8bb2('0x5f')]);_0x2367aa['push'](new Extension(_0x23f671,0x2,_0x8bb2('0x64'),'CDR(prefix)='+_0x6b1fe0['name']));if(_0x6b1fe0['callerIdAll']){_0x2367aa['push'](new Extension(_0x23f671,0x3,_0x8bb2('0x64'),'PREFIX-CALLERIDALL='+_0x6b1fe0[_0x8bb2('0x65')]));}else{_0x2367aa[_0x8bb2('0x66')](new Extension(_0x23f671,0x3,_0x8bb2('0x60'),_0x8bb2('0x67')));}_0x2367aa['push'](new Extension(_0x23f671,0x4,'goto',_0x49065b[_0x8bb2('0x58')]+','+_0x8bb2('0x68')+(0x8+_0x6b1fe0[_0x8bb2('0x2f')][_0x8bb2('0x3b')])+'}'+','+0x1));return _0x2367aa;}function formatPrefixName(_0x433bec){var _0x531154='_';for(var _0x1d973a=0x0;_0x1d973a<_0x433bec[_0x8bb2('0x3b')];_0x1d973a++){if(_0x433bec[_0x8bb2('0x69')](_0x1d973a)=='-'){_0x531154+=_0x433bec[_0x8bb2('0x69')](_0x1d973a);}else{_0x531154+='['+_0x433bec[_0x8bb2('0x69')](_0x1d973a)+']';}}_0x531154+='.';return _0x531154;}exports[_0x8bb2('0x6a')]=function(_0x3b9bdf,_0xd260d9,_0x3a8602){var _0x353778=_0x3b9bdf[_0x8bb2('0x51')];_0x353778[_0x8bb2('0x5f')]=_0x8bb2('0x6b')+_0x353778['name']+'-';return db[_0x8bb2('0x6c')]['transaction'](function(_0x448c8c){return db[_0x8bb2('0x33')][_0x8bb2('0x6a')](_0x353778,{'where':{'id':_0x353778['id']},'transaction':_0x448c8c})['then'](function(){return db[_0x8bb2('0x62')][_0x8bb2('0x2c')]({'where':{'VoicePrefixId':_0x353778['id']},'transaction':_0x448c8c})[_0x8bb2('0x29')](function(){return db['VoiceExtension'][_0x8bb2('0x4d')]({'where':{'id':_0x353778[_0x8bb2('0x63')]},'raw':!![]})[_0x8bb2('0x29')](function(_0x4ffbee){return createVoicePrefixExtensions(_0x353778,_0x4ffbee,_0x448c8c);});});});})[_0x8bb2('0x29')](function(){return db[_0x8bb2('0x33')][_0x8bb2('0x6d')](_0x353778['id']);})[_0x8bb2('0x29')](respondWithResult(_0xd260d9,null))[_0x8bb2('0x4a')](handleError(_0xd260d9,null));};exports['addAgents']=function(_0x441e61,_0x205347,_0x15c82e){return db[_0x8bb2('0x33')][_0x8bb2('0x4d')]({'where':{'id':_0x441e61[_0x8bb2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x205347,null))[_0x8bb2('0x29')](function(_0x52942b){if(_0x52942b){return _0x52942b['addAgents'](_0x441e61[_0x8bb2('0x51')][_0x8bb2('0x6e')],_[_0x8bb2('0x6f')](_0x441e61['body'],['ids','id'])||{})[_0x8bb2('0x70')](function(_0x42a54a){for(var _0x1ce955=0x0;_0x1ce955<_0x441e61['body'][_0x8bb2('0x6e')][_0x8bb2('0x3b')];_0x1ce955+=0x1){socket[_0x8bb2('0x71')](_0x8bb2('0x72'),{'UserId':_0x441e61['body'][_0x8bb2('0x6e')][_0x1ce955],'VoicePrefixId':_0x441e61[_0x8bb2('0x4e')]['id']});}return _0x42a54a;});}})[_0x8bb2('0x29')](respondWithResult(_0x205347,null))['catch'](handleError(_0x205347,null));};exports[_0x8bb2('0x73')]=function(_0x2c7d27,_0x2490b9,_0x4b3644){return db[_0x8bb2('0x33')][_0x8bb2('0x4d')]({'where':{'id':_0x2c7d27[_0x8bb2('0x4e')]['id']}})[_0x8bb2('0x29')](handleEntityNotFound(_0x2490b9,null))[_0x8bb2('0x29')](function(_0x4fdd52){if(_0x4fdd52){return _0x4fdd52[_0x8bb2('0x73')](_0x2c7d27[_0x8bb2('0x36')][_0x8bb2('0x6e')])[_0x8bb2('0x29')](function(){if(_[_0x8bb2('0x74')](_0x2c7d27[_0x8bb2('0x36')]['ids'])){for(var _0x2862ea=0x0;_0x2862ea<_0x2c7d27[_0x8bb2('0x36')][_0x8bb2('0x6e')][_0x8bb2('0x3b')];_0x2862ea+=0x1){socket[_0x8bb2('0x71')](_0x8bb2('0x75'),{'UserId':Number(_0x2c7d27[_0x8bb2('0x36')][_0x8bb2('0x6e')][_0x2862ea]),'VoicePrefixId':Number(_0x2c7d27[_0x8bb2('0x4e')]['id'])});}}else{socket[_0x8bb2('0x71')](_0x8bb2('0x75'),{'UserId':Number(_0x2c7d27['query']['ids']),'VoicePrefixId':Number(_0x2c7d27[_0x8bb2('0x4e')]['id'])});}});}})[_0x8bb2('0x29')](respondWithStatusCode(_0x2490b9,null))[_0x8bb2('0x4a')](handleError(_0x2490b9,null));};exports[_0x8bb2('0x76')]=function(_0x3789ca,_0x3844bc,_0x4748b9){var _0xae014b={};var _0x44d886={};var _0x5bc581;var _0x26cd28;return db[_0x8bb2('0x33')]['findOne']({'where':{'id':_0x3789ca[_0x8bb2('0x4e')]['id']}})[_0x8bb2('0x29')](handleEntityNotFound(_0x3844bc,null))[_0x8bb2('0x29')](function(_0x28183c){if(_0x28183c){_0x5bc581=_0x28183c;_0x44d886[_0x8bb2('0x35')]=_[_0x8bb2('0x37')](db[_0x8bb2('0x77')][_0x8bb2('0x34')]);_0x44d886[_0x8bb2('0x36')]=_['keys'](_0x3789ca['query']);_0x44d886[_0x8bb2('0x38')]=_[_0x8bb2('0x4c')](_0x44d886[_0x8bb2('0x35')],_0x44d886[_0x8bb2('0x36')]);_0xae014b[_0x8bb2('0x3a')]=_[_0x8bb2('0x4c')](_0x44d886[_0x8bb2('0x35')],qs[_0x8bb2('0x39')](_0x3789ca[_0x8bb2('0x36')][_0x8bb2('0x39')]));_0xae014b['attributes']=_0xae014b[_0x8bb2('0x3a')][_0x8bb2('0x3b')]?_0xae014b[_0x8bb2('0x3a')]:_0x44d886[_0x8bb2('0x35')];_0xae014b[_0x8bb2('0x3e')]=qs[_0x8bb2('0x3f')](_0x3789ca[_0x8bb2('0x36')][_0x8bb2('0x3f')]);_0xae014b[_0x8bb2('0x40')]=qs[_0x8bb2('0x38')](_[_0x8bb2('0x78')](_0x3789ca[_0x8bb2('0x36')],_0x44d886['filters']));if(_0x3789ca['query'][_0x8bb2('0x41')]){_0xae014b[_0x8bb2('0x40')]=_['merge'](_0xae014b['where'],{'$or':_[_0x8bb2('0x32')](_0xae014b[_0x8bb2('0x3a')],function(_0x1886cb){var _0x3db103={};_0x3db103[_0x1886cb]={'$like':'%'+_0x3789ca['query']['filter']+'%'};return _0x3db103;})});}_0xae014b=_['merge']({},_0xae014b,_0x3789ca[_0x8bb2('0x45')]);return _0x5bc581[_0x8bb2('0x76')](_0xae014b);}})[_0x8bb2('0x29')](function(_0xbe3ef9){if(_0xbe3ef9){_0x26cd28=_0xbe3ef9['length'];if(!_0x3789ca[_0x8bb2('0x36')][_0x8bb2('0x3c')](_0x8bb2('0x3d'))){_0xae014b[_0x8bb2('0x23')]=qs['limit'](_0x3789ca[_0x8bb2('0x36')][_0x8bb2('0x23')]);_0xae014b[_0x8bb2('0x22')]=qs[_0x8bb2('0x22')](_0x3789ca['query'][_0x8bb2('0x22')]);}return _0x5bc581[_0x8bb2('0x76')](_0xae014b);}})[_0x8bb2('0x29')](function(_0x4a1ad6){if(_0x4a1ad6){return _0x4a1ad6?{'count':_0x26cd28,'rows':_0x4a1ad6}:null;}})[_0x8bb2('0x29')](respondWithResult(_0x3844bc,null))[_0x8bb2('0x4a')](handleError(_0x3844bc,null));}; \ No newline at end of file +var _0x4d8f=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','sendStatus','status','offset','limit','set','Content-Range','json','apply','save','update','then','get','VoicePrefixes','destroy','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','options','count','includeAll','findAll','catch','length','include','merge','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x599875,_0x58a7ab){var _0x35689a=function(_0x455f09){while(--_0x455f09){_0x599875['push'](_0x599875['shift']());}};_0x35689a(++_0x58a7ab);}(_0x4d8f,0xfb));var _0xf4d8=function(_0x5f15d1,_0x12a319){_0x5f15d1=_0x5f15d1-0x0;var _0x778ef9=_0x4d8f[_0x5f15d1];return _0x778ef9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf4d8('0x0'));var rimraf=require(_0xf4d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf4d8('0x2'));var moment=require(_0xf4d8('0x3'));var BPromise=require(_0xf4d8('0x4'));var Mustache=require(_0xf4d8('0x5'));var util=require('util');var path=require(_0xf4d8('0x6'));var sox=require(_0xf4d8('0x7'));var csv=require(_0xf4d8('0x8'));var ejs=require(_0xf4d8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf4d8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4d8('0xb'));var toCsv=require(_0xf4d8('0x8'));var querystring=require(_0xf4d8('0xc'));var Papa=require(_0xf4d8('0xd'));var Redis=require('ioredis');var authService=require(_0xf4d8('0xe'));var qs=require(_0xf4d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4d8('0x10'))(_0xf4d8('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf4d8('0x12'))['db'];config[_0xf4d8('0x13')]=_['defaults'](config[_0xf4d8('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4d8('0x14'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x5df636,_0x1fdf80){_0x1fdf80=_0x1fdf80||0xcc;return function(_0x3401c4){if(_0x3401c4){return _0x5df636[_0xf4d8('0x15')](_0x1fdf80);}return _0x5df636[_0xf4d8('0x16')](_0x1fdf80)['end']();};}function respondWithResult(_0x2ff5c1,_0x331c3e){_0x331c3e=_0x331c3e||0xc8;return function(_0xf701dd){if(_0xf701dd){return _0x2ff5c1[_0xf4d8('0x16')](_0x331c3e)['json'](_0xf701dd);}};}function respondWithFilteredResult(_0x2aa3d4,_0x3f926b){return function(_0x434504){if(_0x434504){var _0x21f0fd=_0x434504['count'],_0x567d88=_0x3f926b[_0xf4d8('0x17')],_0x58c7e0=_0x3f926b[_0xf4d8('0x17')]+_0x3f926b[_0xf4d8('0x18')],_0x32e732;if(_0x58c7e0>=_0x21f0fd){_0x58c7e0=_0x21f0fd;_0x32e732=0xc8;}else{_0x32e732=0xce;}_0x2aa3d4[_0xf4d8('0x16')](_0x32e732);return _0x2aa3d4[_0xf4d8('0x19')](_0xf4d8('0x1a'),_0x567d88+'-'+_0x58c7e0+'/'+_0x21f0fd)[_0xf4d8('0x1b')](_0x434504);}return null;};}function patchUpdates(_0x2f12d7){return function(_0x42fc7a){try{jsonpatch[_0xf4d8('0x1c')](_0x42fc7a,_0x2f12d7,!![]);}catch(_0x445294){return BPromise['reject'](_0x445294);}return _0x42fc7a[_0xf4d8('0x1d')]();};}function saveUpdates(_0x510873,_0xa49918){return function(_0x24ec68){if(_0x24ec68){return _0x24ec68[_0xf4d8('0x1e')](_0x510873)['then'](function(_0x44cc6a){return _0x44cc6a;});}return null;};}function removeEntity(_0x1254c5,_0x1bd88f){return function(_0x3003bf){if(_0x3003bf){return _0x3003bf['destroy']()[_0xf4d8('0x1f')](function(){var _0x1d9e18=_0x3003bf[_0xf4d8('0x20')]({'plain':!![]});var _0x3dbdfd=_0xf4d8('0x21');return db['UserProfileResource'][_0xf4d8('0x22')]({'where':{'type':_0x3dbdfd,'resourceId':_0x1d9e18['id']}})[_0xf4d8('0x1f')](function(){return _0x3003bf;});})[_0xf4d8('0x1f')](function(){_0x1254c5[_0xf4d8('0x16')](0xcc)[_0xf4d8('0x23')]();});}};}function handleEntityNotFound(_0x1734dd,_0x4a3471){return function(_0x16d737){if(!_0x16d737){_0x1734dd[_0xf4d8('0x15')](0x194);}return _0x16d737;};}function handleError(_0x281482,_0x12b037){_0x12b037=_0x12b037||0x1f4;return function(_0x5d5f19){logger[_0xf4d8('0x24')](_0x5d5f19[_0xf4d8('0x25')]);if(_0x5d5f19[_0xf4d8('0x26')]){delete _0x5d5f19['name'];}_0x281482['status'](_0x12b037)[_0xf4d8('0x27')](_0x5d5f19);};}exports[_0xf4d8('0x28')]=function(_0x2d1cf6,_0x9f7fd6){var _0x4fbb33={},_0x30534c={},_0x239bac={'count':0x0,'rows':[]};var _0x4eb1a5=_[_0xf4d8('0x29')](db[_0xf4d8('0x2a')][_0xf4d8('0x2b')],function(_0x191a7f){return{'name':_0x191a7f['fieldName'],'type':_0x191a7f[_0xf4d8('0x2c')][_0xf4d8('0x2d')]};});_0x30534c[_0xf4d8('0x2e')]=_[_0xf4d8('0x29')](_0x4eb1a5,'name');_0x30534c[_0xf4d8('0x2f')]=_[_0xf4d8('0x30')](_0x2d1cf6[_0xf4d8('0x2f')]);_0x30534c[_0xf4d8('0x31')]=_[_0xf4d8('0x32')](_0x30534c[_0xf4d8('0x2e')],_0x30534c['query']);_0x4fbb33['attributes']=_[_0xf4d8('0x32')](_0x30534c[_0xf4d8('0x2e')],qs[_0xf4d8('0x33')](_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x33')]));_0x4fbb33['attributes']=_0x4fbb33[_0xf4d8('0x34')]['length']?_0x4fbb33[_0xf4d8('0x34')]:_0x30534c[_0xf4d8('0x2e')];if(!_0x2d1cf6[_0xf4d8('0x2f')]['hasOwnProperty']('nolimit')){_0x4fbb33['limit']=qs['limit'](_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x18')]);_0x4fbb33['offset']=qs[_0xf4d8('0x17')](_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x17')]);}_0x4fbb33[_0xf4d8('0x35')]=qs['sort'](_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x36')]);_0x4fbb33[_0xf4d8('0x37')]=qs[_0xf4d8('0x31')](_[_0xf4d8('0x38')](_0x2d1cf6[_0xf4d8('0x2f')],_0x30534c[_0xf4d8('0x31')]),_0x4eb1a5);if(_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x39')]){_0x4fbb33[_0xf4d8('0x37')]=_['merge'](_0x4fbb33['where'],{'$or':_[_0xf4d8('0x29')](_0x4eb1a5,function(_0x181f47){if(_0x181f47[_0xf4d8('0x2c')]!=='VIRTUAL'){var _0x1e9180={};_0x1e9180[_0x181f47[_0xf4d8('0x26')]]={'$like':'%'+_0x2d1cf6[_0xf4d8('0x2f')]['filter']+'%'};return _0x1e9180;}})});}_0x4fbb33=_['merge']({},_0x4fbb33,_0x2d1cf6[_0xf4d8('0x3a')]);var _0x575b2a={'where':_0x4fbb33['where']};return db[_0xf4d8('0x2a')]['count'](_0x575b2a)[_0xf4d8('0x1f')](function(_0x2310a1){_0x239bac[_0xf4d8('0x3b')]=_0x2310a1;if(_0x2d1cf6[_0xf4d8('0x2f')][_0xf4d8('0x3c')]){_0x4fbb33['include']=[{'all':!![]}];}return db[_0xf4d8('0x2a')][_0xf4d8('0x3d')](_0x4fbb33);})['then'](function(_0x39e880){_0x239bac['rows']=_0x39e880;return _0x239bac;})['then'](respondWithFilteredResult(_0x9f7fd6,_0x4fbb33))[_0xf4d8('0x3e')](handleError(_0x9f7fd6,null));};exports['show']=function(_0x184825,_0x1f57f1){var _0x27039b={'raw':![],'where':{'id':_0x184825['params']['id']}},_0x4069ba={};_0x4069ba[_0xf4d8('0x2e')]=_[_0xf4d8('0x30')](db[_0xf4d8('0x2a')][_0xf4d8('0x2b')]);_0x4069ba[_0xf4d8('0x2f')]=_[_0xf4d8('0x30')](_0x184825[_0xf4d8('0x2f')]);_0x4069ba[_0xf4d8('0x31')]=_['intersection'](_0x4069ba['model'],_0x4069ba[_0xf4d8('0x2f')]);_0x27039b[_0xf4d8('0x34')]=_[_0xf4d8('0x32')](_0x4069ba[_0xf4d8('0x2e')],qs['fields'](_0x184825['query'][_0xf4d8('0x33')]));_0x27039b[_0xf4d8('0x34')]=_0x27039b[_0xf4d8('0x34')][_0xf4d8('0x3f')]?_0x27039b[_0xf4d8('0x34')]:_0x4069ba[_0xf4d8('0x2e')];if(_0x184825[_0xf4d8('0x2f')][_0xf4d8('0x3c')]){_0x27039b[_0xf4d8('0x40')]=[{'all':!![]}];}_0x27039b=_[_0xf4d8('0x41')]({},_0x27039b,_0x184825[_0xf4d8('0x3a')]);return db[_0xf4d8('0x2a')][_0xf4d8('0x42')](_0x27039b)['then'](handleEntityNotFound(_0x1f57f1,null))['then'](respondWithResult(_0x1f57f1,null))['catch'](handleError(_0x1f57f1,null));};exports[_0xf4d8('0x22')]=function(_0x20847a,_0x207d33){return db['VoicePrefix'][_0xf4d8('0x42')]({'where':{'id':_0x20847a[_0xf4d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x207d33,null))[_0xf4d8('0x1f')](removeEntity(_0x207d33,null))[_0xf4d8('0x3e')](handleError(_0x207d33,null));};exports[_0xf4d8('0x44')]=function(_0x2ca63f,_0xa0e9f0){return db[_0xf4d8('0x2a')][_0xf4d8('0x44')]()[_0xf4d8('0x1f')](respondWithResult(_0xa0e9f0,null))[_0xf4d8('0x3e')](handleError(_0xa0e9f0,null));};exports[_0xf4d8('0x45')]=function(_0x194410,_0x174628){var _0x419aae;return db[_0xf4d8('0x46')][_0xf4d8('0x47')](function(_0xc2a801){return db[_0xf4d8('0x2a')][_0xf4d8('0x45')](_0x194410[_0xf4d8('0x48')],{'transaction':_0xc2a801})[_0xf4d8('0x1f')](function(_0x584b79){_0x419aae=_0x584b79[_0xf4d8('0x20')]({'plain':!![]});return db[_0xf4d8('0x49')][_0xf4d8('0x42')]({'where':{'id':_0x419aae[_0xf4d8('0x4a')]},'raw':!![]})['then'](function(_0x5f0704){return createVoicePrefixExtensions(_0x419aae,_0x5f0704,_0xc2a801);});});})[_0xf4d8('0x1f')](function(){var _0x327573=_0x194410['user']['get']({'plain':!![]});if(!_0x327573)throw new Error(_0xf4d8('0x4b'));if(_0x327573[_0xf4d8('0x4c')]==='user'){var _0x2fceba=_0x419aae;return db[_0xf4d8('0x4d')][_0xf4d8('0x42')]({'where':{'name':_0xf4d8('0x21'),'userProfileId':_0x327573[_0xf4d8('0x4e')]},'raw':!![]})['then'](function(_0x579a04){if(_0x579a04&&_0x579a04[_0xf4d8('0x4f')]===0x0){return db['UserProfileResource'][_0xf4d8('0x45')]({'name':_0x2fceba[_0xf4d8('0x26')],'resourceId':_0x2fceba['id'],'type':_0x579a04[_0xf4d8('0x26')],'sectionId':_0x579a04['id']},{})['then'](function(){return _0x419aae;});}else{return _0x419aae;}})[_0xf4d8('0x3e')](function(_0x24dd57){logger['error'](_0xf4d8('0x50'),_0x24dd57);throw _0x24dd57;});}return _0x419aae;})[_0xf4d8('0x1f')](respondWithResult(_0x174628,null))[_0xf4d8('0x3e')](handleError(_0x174628,null));};function Extension(_0x3484d8,_0x4d0228,_0x445ff1,_0x3762e0){this['context']='from-sip';this[_0xf4d8('0x51')]=_0x3484d8;this[_0xf4d8('0x52')]=_0x445ff1;this[_0xf4d8('0x2c')]=_0xf4d8('0x53');this['description']='Voice\x20Prefix\x20Extension';this[_0xf4d8('0x54')]=_0x4d0228;this[_0xf4d8('0x55')]=_0x3762e0;}function createVoicePrefixExtensions(_0x225c66,_0x3d42ff,_0x4b5bc8){return new BPromise(function(_0x331913,_0x311c94){var _0x26da4b=new Extension(formatPrefixName(_0x225c66[_0xf4d8('0x56')]),0x1,_0xf4d8('0x57'),_0xf4d8('0x58'));_0x26da4b[_0xf4d8('0x59')]=_0x225c66['id'];return db[_0xf4d8('0x49')][_0xf4d8('0x45')](_0x26da4b,{'transaction':_0x4b5bc8})[_0xf4d8('0x1f')](function(_0x2eed2e){var _0x3c05ff=_0x2eed2e[_0xf4d8('0x20')]({'plain':!![]});var _0x801b8b=_['map'](addVoicePrefixExtensions(_0x225c66,_0x3d42ff),function(_0x1086f7){_0x1086f7['VoiceExtensionId']=_0x3c05ff['id'];_0x1086f7['VoicePrefixId']=_0x225c66['id'];return _0x1086f7;});return db[_0xf4d8('0x49')][_0xf4d8('0x5a')](_0x801b8b,{'transaction':_0x4b5bc8})['then'](function(_0x73649){if(!_0x73649){return _0x311c94(_0xf4d8('0x5b'));}else{return _0x331913(_0x73649);}})['catch'](function(_0x4b566a){return _0x311c94(_0x4b566a);});});;});};function addVoicePrefixExtensions(_0x42bd3b,_0x5b3ff9){var _0x20cb86=[];var _0x51915e=formatPrefixName(_0x42bd3b[_0xf4d8('0x56')]);_0x20cb86[_0xf4d8('0x5c')](new Extension(_0x51915e,0x2,'Set','CDR(prefix)='+_0x42bd3b['name']));if(_0x42bd3b[_0xf4d8('0x5d')]){_0x20cb86['push'](new Extension(_0x51915e,0x3,'Set',_0xf4d8('0x5e')+_0x42bd3b[_0xf4d8('0x5d')]));}else{_0x20cb86[_0xf4d8('0x5c')](new Extension(_0x51915e,0x3,_0xf4d8('0x57'),'No\x20callerid\x20available'));}_0x20cb86['push'](new Extension(_0x51915e,0x4,'goto',_0x5b3ff9[_0xf4d8('0x5f')]+','+_0xf4d8('0x60')+(0x8+_0x42bd3b[_0xf4d8('0x26')][_0xf4d8('0x3f')])+'}'+','+0x1));return _0x20cb86;}function formatPrefixName(_0x1dc912){var _0x5abe51='_';for(var _0x18e8a5=0x0;_0x18e8a5<_0x1dc912[_0xf4d8('0x3f')];_0x18e8a5++){if(_0x1dc912[_0xf4d8('0x61')](_0x18e8a5)=='-'){_0x5abe51+=_0x1dc912[_0xf4d8('0x61')](_0x18e8a5);}else{_0x5abe51+='['+_0x1dc912[_0xf4d8('0x61')](_0x18e8a5)+']';}}_0x5abe51+='.';return _0x5abe51;}exports['update']=function(_0x3a574b,_0x2dc92c,_0x56f34e){var _0x19d986=_0x3a574b[_0xf4d8('0x48')];_0x19d986[_0xf4d8('0x56')]=_0xf4d8('0x62')+_0x19d986[_0xf4d8('0x26')]+'-';return db[_0xf4d8('0x46')][_0xf4d8('0x47')](function(_0x3fc0b7){return db[_0xf4d8('0x2a')][_0xf4d8('0x1e')](_0x19d986,{'where':{'id':_0x19d986['id']},'transaction':_0x3fc0b7})[_0xf4d8('0x1f')](function(){return db[_0xf4d8('0x49')][_0xf4d8('0x22')]({'where':{'VoicePrefixId':_0x19d986['id']},'transaction':_0x3fc0b7})[_0xf4d8('0x1f')](function(){return db[_0xf4d8('0x49')]['find']({'where':{'id':_0x19d986['VoiceExtensionId']},'raw':!![]})[_0xf4d8('0x1f')](function(_0x589818){return createVoicePrefixExtensions(_0x19d986,_0x589818,_0x3fc0b7);});});});})['then'](function(){return db[_0xf4d8('0x2a')][_0xf4d8('0x63')](_0x19d986['id']);})[_0xf4d8('0x1f')](respondWithResult(_0x2dc92c,null))[_0xf4d8('0x3e')](handleError(_0x2dc92c,null));};exports['addAgents']=function(_0x2abe1a,_0x36f7fd,_0x5e58ea){return db[_0xf4d8('0x2a')][_0xf4d8('0x42')]({'where':{'id':_0x2abe1a[_0xf4d8('0x43')]['id']}})[_0xf4d8('0x1f')](handleEntityNotFound(_0x36f7fd,null))[_0xf4d8('0x1f')](function(_0x9947cb){if(_0x9947cb){return _0x9947cb[_0xf4d8('0x64')](_0x2abe1a['body'][_0xf4d8('0x65')],_['omit'](_0x2abe1a[_0xf4d8('0x48')],[_0xf4d8('0x65'),'id'])||{})['spread'](function(_0x5ae05c){for(var _0x313a68=0x0;_0x313a68<_0x2abe1a['body']['ids'][_0xf4d8('0x3f')];_0x313a68+=0x1){socket[_0xf4d8('0x66')]('userVoicePrefix:save',{'UserId':_0x2abe1a[_0xf4d8('0x48')][_0xf4d8('0x65')][_0x313a68],'VoicePrefixId':_0x2abe1a[_0xf4d8('0x43')]['id']});}return _0x5ae05c;});}})[_0xf4d8('0x1f')](respondWithResult(_0x36f7fd,null))[_0xf4d8('0x3e')](handleError(_0x36f7fd,null));};exports['removeAgents']=function(_0x9eba39,_0x2dfb0b,_0x5ccd38){return db[_0xf4d8('0x2a')]['find']({'where':{'id':_0x9eba39[_0xf4d8('0x43')]['id']}})[_0xf4d8('0x1f')](handleEntityNotFound(_0x2dfb0b,null))[_0xf4d8('0x1f')](function(_0x578683){if(_0x578683){return _0x578683[_0xf4d8('0x67')](_0x9eba39[_0xf4d8('0x2f')][_0xf4d8('0x65')])[_0xf4d8('0x1f')](function(){if(_[_0xf4d8('0x68')](_0x9eba39['query'][_0xf4d8('0x65')])){for(var _0x41016c=0x0;_0x41016c<_0x9eba39[_0xf4d8('0x2f')]['ids'][_0xf4d8('0x3f')];_0x41016c+=0x1){socket[_0xf4d8('0x66')](_0xf4d8('0x69'),{'UserId':Number(_0x9eba39[_0xf4d8('0x2f')][_0xf4d8('0x65')][_0x41016c]),'VoicePrefixId':Number(_0x9eba39[_0xf4d8('0x43')]['id'])});}}else{socket[_0xf4d8('0x66')](_0xf4d8('0x69'),{'UserId':Number(_0x9eba39[_0xf4d8('0x2f')][_0xf4d8('0x65')]),'VoicePrefixId':Number(_0x9eba39['params']['id'])});}});}})[_0xf4d8('0x1f')](respondWithStatusCode(_0x2dfb0b,null))[_0xf4d8('0x3e')](handleError(_0x2dfb0b,null));};exports[_0xf4d8('0x6a')]=function(_0x508782,_0x3652a7,_0xbaa097){var _0x30761e={};var _0x3d7cc9={};var _0x18f226;var _0x590a86;return db[_0xf4d8('0x2a')][_0xf4d8('0x6b')]({'where':{'id':_0x508782['params']['id']}})[_0xf4d8('0x1f')](handleEntityNotFound(_0x3652a7,null))[_0xf4d8('0x1f')](function(_0x2b78e1){if(_0x2b78e1){_0x18f226=_0x2b78e1;_0x3d7cc9['model']=_[_0xf4d8('0x30')](db[_0xf4d8('0x6c')][_0xf4d8('0x2b')]);_0x3d7cc9[_0xf4d8('0x2f')]=_[_0xf4d8('0x30')](_0x508782[_0xf4d8('0x2f')]);_0x3d7cc9[_0xf4d8('0x31')]=_[_0xf4d8('0x32')](_0x3d7cc9[_0xf4d8('0x2e')],_0x3d7cc9[_0xf4d8('0x2f')]);_0x30761e[_0xf4d8('0x34')]=_[_0xf4d8('0x32')](_0x3d7cc9[_0xf4d8('0x2e')],qs[_0xf4d8('0x33')](_0x508782[_0xf4d8('0x2f')]['fields']));_0x30761e[_0xf4d8('0x34')]=_0x30761e[_0xf4d8('0x34')][_0xf4d8('0x3f')]?_0x30761e[_0xf4d8('0x34')]:_0x3d7cc9['model'];_0x30761e[_0xf4d8('0x35')]=qs[_0xf4d8('0x36')](_0x508782[_0xf4d8('0x2f')]['sort']);_0x30761e[_0xf4d8('0x37')]=qs[_0xf4d8('0x31')](_[_0xf4d8('0x38')](_0x508782[_0xf4d8('0x2f')],_0x3d7cc9[_0xf4d8('0x31')]));if(_0x508782[_0xf4d8('0x2f')]['filter']){_0x30761e[_0xf4d8('0x37')]=_[_0xf4d8('0x41')](_0x30761e['where'],{'$or':_[_0xf4d8('0x29')](_0x30761e['attributes'],function(_0x4e2506){var _0x5d0a36={};_0x5d0a36[_0x4e2506]={'$like':'%'+_0x508782[_0xf4d8('0x2f')][_0xf4d8('0x39')]+'%'};return _0x5d0a36;})});}_0x30761e=_['merge']({},_0x30761e,_0x508782[_0xf4d8('0x3a')]);return _0x18f226[_0xf4d8('0x6a')](_0x30761e);}})[_0xf4d8('0x1f')](function(_0x468374){if(_0x468374){_0x590a86=_0x468374['length'];if(!_0x508782[_0xf4d8('0x2f')][_0xf4d8('0x6d')]('nolimit')){_0x30761e[_0xf4d8('0x18')]=qs[_0xf4d8('0x18')](_0x508782[_0xf4d8('0x2f')]['limit']);_0x30761e[_0xf4d8('0x17')]=qs[_0xf4d8('0x17')](_0x508782['query'][_0xf4d8('0x17')]);}return _0x18f226[_0xf4d8('0x6a')](_0x30761e);}})[_0xf4d8('0x1f')](function(_0x371ad4){if(_0x371ad4){return _0x371ad4?{'count':_0x590a86,'rows':_0x371ad4}:null;}})[_0xf4d8('0x1f')](respondWithResult(_0x3652a7,null))['catch'](handleError(_0x3652a7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 465e72c..48a3ed3 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x3b32c6,_0xaeb063){var _0x1e63ae=function(_0x5bc4b8){while(--_0x5bc4b8){_0x3b32c6['push'](_0x3b32c6['shift']());}};_0x1e63ae(++_0xaeb063);}(_0x70e0,0x17b));var _0x070e=function(_0x212ce7,_0x2c79b5){_0x212ce7=_0x212ce7-0x0;var _0x4668ad=_0x70e0[_0x212ce7];return _0x4668ad;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x34e8,0x12c));var _0x834e=function(_0x422c81,_0x140b75){_0x422c81=_0x422c81-0x0;var _0x2b95d5=_0x34e8[_0x422c81];return _0x2b95d5;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index c33e59d..9a8cafc 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 _0x90ad=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x90ad,0x190));var _0xd90a=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x90ad[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0xd90a('0x0'));var util=require(_0xd90a('0x1'));var logger=require(_0xd90a('0x2'))(_0xd90a('0x3'));var moment=require(_0xd90a('0x4'));var BPromise=require(_0xd90a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd90a('0x6'));var rimraf=require(_0xd90a('0x7'));var config=require(_0xd90a('0x8'));var attributes=require(_0xd90a('0x9'));module[_0xd90a('0xa')]=function(_0x2754e8,_0xb19163){return _0x2754e8[_0xd90a('0xb')](_0xd90a('0xc'),attributes,{'tableName':_0xd90a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4651=['bluebird','request-promise','path','rimraf','voice_prefixes','lodash','util','api','moment'];(function(_0x3483ce,_0x554654){var _0x1a3510=function(_0x5de3e8){while(--_0x5de3e8){_0x3483ce['push'](_0x3483ce['shift']());}};_0x1a3510(++_0x554654);}(_0x4651,0x176));var _0x1465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4651[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1465('0x0'));var util=require(_0x1465('0x1'));var logger=require('../../config/logger')(_0x1465('0x2'));var moment=require(_0x1465('0x3'));var BPromise=require(_0x1465('0x4'));var rp=require(_0x1465('0x5'));var fs=require('fs');var path=require(_0x1465('0x6'));var rimraf=require(_0x1465('0x7'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x83bd6b,_0x43634e){return _0x83bd6b['define']('VoicePrefix',attributes,{'tableName':_0x1465('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 92ecf2f..5f7b622 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 _0x6125=['defaults','redis','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x6125,0x162));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5612('0x0'));var util=require(_0x5612('0x1'));var moment=require(_0x5612('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5612('0x3'));var db=require(_0x5612('0x4'))['db'];var utils=require(_0x5612('0x5'));var logger=require('../../config/logger')(_0x5612('0x6'));var config=require(_0x5612('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5612('0x8')][_0x5612('0x9')]({'port':0x232a});config['redis']=_[_0x5612('0xa')](config[_0x5612('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5612('0xc'))(new Redis(config[_0x5612('0xb')]));require(_0x5612('0xd'))['register'](socket);function respondWithRpcPromise(_0xb856e7,_0xf2f7c2,_0x456c2d){return new BPromise(function(_0x2280a5,_0x1ccc3a){return client[_0x5612('0xe')](_0xb856e7,_0x456c2d)[_0x5612('0xf')](function(_0x25685d){logger['info'](_0x5612('0x10'),_0xf2f7c2,'request\x20sent');logger[_0x5612('0x11')](_0x5612('0x12'),_0xf2f7c2,_0x5612('0x13'),JSON[_0x5612('0x14')](_0x25685d));if(_0x25685d[_0x5612('0x15')]){if(_0x25685d[_0x5612('0x15')][_0x5612('0x16')]===0x1f4){logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x25685d[_0x5612('0x15')]['message']);return _0x1ccc3a(_0x25685d[_0x5612('0x15')][_0x5612('0x17')]);}logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x25685d[_0x5612('0x15')]['message']);return _0x2280a5(_0x25685d[_0x5612('0x15')][_0x5612('0x17')]);}else{logger[_0x5612('0x18')]('VoicePrefix,\x20%s,\x20%s',_0xf2f7c2,_0x5612('0x13'));_0x2280a5(_0x25685d['result'][_0x5612('0x17')]);}})[_0x5612('0x19')](function(_0x5e6928){logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x5e6928);_0x1ccc3a(_0x5e6928);});});} \ No newline at end of file +var _0xfd43=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xbc9b18,_0x4b8e42){var _0x432f8a=function(_0x44ab81){while(--_0x44ab81){_0xbc9b18['push'](_0xbc9b18['shift']());}};_0x432f8a(++_0x4b8e42);}(_0xfd43,0x185));var _0x3fd4=function(_0x1ddfdd,_0x3a3c1e){_0x1ddfdd=_0x1ddfdd-0x0;var _0x402db9=_0xfd43[_0x1ddfdd];return _0x402db9;};'use strict';var _=require(_0x3fd4('0x0'));var util=require('util');var moment=require(_0x3fd4('0x1'));var BPromise=require(_0x3fd4('0x2'));var rs=require(_0x3fd4('0x3'));var fs=require('fs');var Redis=require(_0x3fd4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fd4('0x5'));var logger=require(_0x3fd4('0x6'))('rpc');var config=require(_0x3fd4('0x7'));var jayson=require(_0x3fd4('0x8'));var client=jayson['client'][_0x3fd4('0x9')]({'port':0x232a});config[_0x3fd4('0xa')]=_[_0x3fd4('0xb')](config[_0x3fd4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3fd4('0xc'))(new Redis(config[_0x3fd4('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0xb23b7e,_0x37b497,_0x100302){return new BPromise(function(_0x14abb9,_0x495269){return client[_0x3fd4('0xd')](_0xb23b7e,_0x100302)[_0x3fd4('0xe')](function(_0x2f05b5){logger['info'](_0x3fd4('0xf'),_0x37b497,_0x3fd4('0x10'));logger['debug'](_0x3fd4('0x11'),_0x37b497,_0x3fd4('0x10'),JSON['stringify'](_0x2f05b5));if(_0x2f05b5[_0x3fd4('0x12')]){if(_0x2f05b5[_0x3fd4('0x12')][_0x3fd4('0x13')]===0x1f4){logger[_0x3fd4('0x12')](_0x3fd4('0xf'),_0x37b497,_0x2f05b5[_0x3fd4('0x12')]['message']);return _0x495269(_0x2f05b5[_0x3fd4('0x12')]['message']);}logger[_0x3fd4('0x12')](_0x3fd4('0xf'),_0x37b497,_0x2f05b5[_0x3fd4('0x12')]['message']);return _0x14abb9(_0x2f05b5[_0x3fd4('0x12')][_0x3fd4('0x14')]);}else{logger[_0x3fd4('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x37b497,_0x3fd4('0x10'));_0x14abb9(_0x2f05b5['result'][_0x3fd4('0x14')]);}})['catch'](function(_0x3509b9){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x37b497,_0x3509b9);_0x495269(_0x3509b9);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f1d2f08..d811cb8 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 _0xc46d=['remove','update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save'];(function(_0x25ff42,_0x1dd28a){var _0x2b9f64=function(_0x417733){while(--_0x417733){_0x25ff42['push'](_0x25ff42['shift']());}};_0x2b9f64(++_0x1dd28a);}(_0xc46d,0x14e));var _0xdc46=function(_0x55ee94,_0x5d6a52){_0x55ee94=_0x55ee94-0x0;var _0x1e92fe=_0xc46d[_0x55ee94];return _0x1e92fe;};'use strict';var VoicePrefixEvents=require(_0xdc46('0x0'));var events=[_0xdc46('0x1'),_0xdc46('0x2'),_0xdc46('0x3')];function createListener(_0x226033,_0x10a46c){return function(_0x478c43){_0x10a46c[_0xdc46('0x4')](_0x226033,_0x478c43);};}function removeListener(_0x22ea8b,_0x12040f){return function(){VoicePrefixEvents[_0xdc46('0x5')](_0x22ea8b,_0x12040f);};}exports[_0xdc46('0x6')]=function(_0xe7893d){for(var _0x18fb88=0x0,_0x4f338c=events['length'];_0x18fb88<_0x4f338c;_0x18fb88++){var _0x5a5f31=events[_0x18fb88];var _0x5c6709=createListener(_0xdc46('0x7')+_0x5a5f31,_0xe7893d);VoicePrefixEvents['on'](_0x5a5f31,_0x5c6709);}}; \ No newline at end of file +var _0xb3f6=['register','length','./voicePrefix.events','save','remove','update','emit'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xb3f6,0x87));var _0x6b3f=function(_0x37a95a,_0x4eda71){_0x37a95a=_0x37a95a-0x0;var _0x44d560=_0xb3f6[_0x37a95a];return _0x44d560;};'use strict';var VoicePrefixEvents=require(_0x6b3f('0x0'));var events=[_0x6b3f('0x1'),_0x6b3f('0x2'),_0x6b3f('0x3')];function createListener(_0x56fafb,_0x5bc5ed){return function(_0xf353b2){_0x5bc5ed[_0x6b3f('0x4')](_0x56fafb,_0xf353b2);};}function removeListener(_0x5f165a,_0x5cc202){return function(){VoicePrefixEvents['removeListener'](_0x5f165a,_0x5cc202);};}exports[_0x6b3f('0x5')]=function(_0x1e71fc){for(var _0x5646a8=0x0,_0x450f67=events[_0x6b3f('0x6')];_0x5646a8<_0x450f67;_0x5646a8++){var _0x25f7e9=events[_0x5646a8];var _0x52d5e8=createListener('voicePrefix:'+_0x25f7e9,_0x1e71fc);VoicePrefixEvents['on'](_0x25f7e9,_0x52d5e8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7de7e4d..31729b2 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 _0x38a5=['express','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addTeams','addAgents','addLists','addBlackLists','/:id','update','destroy','removeTeams','delete','removeAgents','removeLists','exports','multer'];(function(_0x4b41f9,_0x20653d){var _0x1d04bd=function(_0x54640b){while(--_0x54640b){_0x4b41f9['push'](_0x4b41f9['shift']());}};_0x1d04bd(++_0x20653d);}(_0x38a5,0xf4));var _0x538a=function(_0x4b87d2,_0x5237a1){_0x4b87d2=_0x4b87d2-0x0;var _0x451df0=_0x38a5[_0x4b87d2];return _0x451df0;};'use strict';var multer=require(_0x538a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x538a('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x538a('0x2'));var config=require(_0x538a('0x3'));var controller=require(_0x538a('0x4'));router[_0x538a('0x5')]('/',auth[_0x538a('0x6')](),controller[_0x538a('0x7')]);router['get']('/:id',auth[_0x538a('0x6')](),controller[_0x538a('0x8')]);router[_0x538a('0x5')](_0x538a('0x9'),auth[_0x538a('0x6')](),controller[_0x538a('0xa')]);router[_0x538a('0x5')]('/:id/hopper_histories',auth[_0x538a('0x6')](),controller['getHopperHistories']);router[_0x538a('0x5')](_0x538a('0xb'),auth[_0x538a('0x6')](),controller[_0x538a('0xc')]);router['get']('/:id/hopper_black',auth[_0x538a('0x6')](),controller[_0x538a('0xd')]);router['get'](_0x538a('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x538a('0x5')](_0x538a('0xf'),auth[_0x538a('0x6')](),controller['getAgents']);router[_0x538a('0x5')](_0x538a('0x10'),auth[_0x538a('0x6')](),controller[_0x538a('0x11')]);router[_0x538a('0x5')](_0x538a('0x12'),auth[_0x538a('0x6')](),controller[_0x538a('0x13')]);router[_0x538a('0x5')](_0x538a('0x14'),auth[_0x538a('0x6')](),controller['getBlackLists']);router[_0x538a('0x15')]('/',auth[_0x538a('0x6')](),controller['create']);router[_0x538a('0x15')](_0x538a('0x16'),auth[_0x538a('0x6')](),controller['clone']);router[_0x538a('0x15')](_0x538a('0xe'),auth[_0x538a('0x6')](),controller[_0x538a('0x17')]);router[_0x538a('0x15')](_0x538a('0xf'),auth[_0x538a('0x6')](),controller[_0x538a('0x18')]);router[_0x538a('0x15')]('/:id/lists',auth[_0x538a('0x6')](),controller[_0x538a('0x19')]);router[_0x538a('0x15')](_0x538a('0x14'),auth[_0x538a('0x6')](),controller[_0x538a('0x1a')]);router['put'](_0x538a('0x1b'),auth[_0x538a('0x6')](),controller[_0x538a('0x1c')]);router['delete']('/:id',auth[_0x538a('0x6')](),controller[_0x538a('0x1d')]);router['delete'](_0x538a('0xe'),auth[_0x538a('0x6')](),controller[_0x538a('0x1e')]);router[_0x538a('0x1f')](_0x538a('0xf'),auth['isAuthenticated'](),controller[_0x538a('0x20')]);router[_0x538a('0x1f')]('/:id/lists',auth['isAuthenticated'](),controller[_0x538a('0x21')]);router[_0x538a('0x1f')](_0x538a('0x14'),auth[_0x538a('0x6')](),controller['removeBlackLists']);module[_0x538a('0x22')]=router; \ No newline at end of file +var _0xf54f=['get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','getMembers','/:id/blacklists','getBlackLists','post','addTeams','addAgents','/:id/lists','addBlackLists','put','update','delete','destroy','/:id/users','removeAgents','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index'];(function(_0x2346c2,_0x3de330){var _0x1f6002=function(_0x96b5b0){while(--_0x96b5b0){_0x2346c2['push'](_0x2346c2['shift']());}};_0x1f6002(++_0x3de330);}(_0xf54f,0x1d6));var _0xff54=function(_0x37a580,_0x3135a6){_0x37a580=_0x37a580-0x0;var _0x77d8d1=_0xf54f[_0x37a580];return _0x77d8d1;};'use strict';var multer=require(_0xff54('0x0'));var util=require(_0xff54('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff54('0x2'));var router=express[_0xff54('0x3')]();var auth=require(_0xff54('0x4'));var interaction=require(_0xff54('0x5'));var config=require(_0xff54('0x6'));var controller=require(_0xff54('0x7'));router['get']('/',auth[_0xff54('0x8')](),controller[_0xff54('0x9')]);router[_0xff54('0xa')](_0xff54('0xb'),auth[_0xff54('0x8')](),controller[_0xff54('0xc')]);router[_0xff54('0xa')](_0xff54('0xd'),auth[_0xff54('0x8')](),controller[_0xff54('0xe')]);router[_0xff54('0xa')](_0xff54('0xf'),auth[_0xff54('0x8')](),controller[_0xff54('0x10')]);router[_0xff54('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xff54('0x11')]);router[_0xff54('0xa')](_0xff54('0x12'),auth[_0xff54('0x8')](),controller[_0xff54('0x13')]);router[_0xff54('0xa')](_0xff54('0x14'),auth[_0xff54('0x8')](),controller[_0xff54('0x15')]);router['get']('/:id/users',auth[_0xff54('0x8')](),controller[_0xff54('0x16')]);router[_0xff54('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xff54('0x17')]);router[_0xff54('0xa')]('/:id/lists',auth[_0xff54('0x8')](),controller['getLists']);router[_0xff54('0xa')](_0xff54('0x18'),auth[_0xff54('0x8')](),controller[_0xff54('0x19')]);router[_0xff54('0x1a')]('/',auth[_0xff54('0x8')](),controller['create']);router[_0xff54('0x1a')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xff54('0x1a')]('/:id/teams',auth[_0xff54('0x8')](),controller[_0xff54('0x1b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xff54('0x1c')]);router[_0xff54('0x1a')](_0xff54('0x1d'),auth[_0xff54('0x8')](),controller['addLists']);router[_0xff54('0x1a')]('/:id/blacklists',auth[_0xff54('0x8')](),controller[_0xff54('0x1e')]);router[_0xff54('0x1f')]('/:id',auth[_0xff54('0x8')](),controller[_0xff54('0x20')]);router[_0xff54('0x21')]('/:id',auth[_0xff54('0x8')](),controller[_0xff54('0x22')]);router[_0xff54('0x21')](_0xff54('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xff54('0x21')](_0xff54('0x23'),auth['isAuthenticated'](),controller[_0xff54('0x24')]);router[_0xff54('0x21')]('/:id/lists',auth[_0xff54('0x8')](),controller[_0xff54('0x25')]);router['delete'](_0xff54('0x18'),auth[_0xff54('0x8')](),controller[_0xff54('0x26')]);module[_0xff54('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 64c01d9..ffad06b 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(_0x2073f8,_0x34a29d){var _0x11c069=function(_0x1c49ab){while(--_0x1c49ab){_0x2073f8['push'](_0x2073f8['shift']());}};_0x11c069(++_0x34a29d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x26c323,_0x559fa7){var _0xaa4f94=function(_0x7b9080){while(--_0x7b9080){_0x26c323['push'](_0x26c323['shift']());}};_0xaa4f94(++_0x559fa7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 732b4bc..34e05e3 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 _0x4c99=['index','map','VoiceQueue','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','catch','body','user','role','inbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','create','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','online','flatMap','Agents','forEach','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','voicePause','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','format','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','ListId','select','NOW()','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','insert','fromQuery','CmListId','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','push','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','moment','bluebird','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','VoiceQueues','QueueCampaigns','outbound','ignore','value','includes','type','find','name','UserProfileResource','status','error','stack','send'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4c99,0x1ec));var _0x94c9=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4c99[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require(_0x94c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94c9('0x2'));var BPromise=require(_0x94c9('0x3'));var Mustache=require('mustache');var util=require(_0x94c9('0x4'));var path=require(_0x94c9('0x5'));var sox=require('sox');var csv=require(_0x94c9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x94c9('0x7'));var jsforce=require(_0x94c9('0x8'));var deskjs=require(_0x94c9('0x9'));var toCsv=require(_0x94c9('0x6'));var querystring=require(_0x94c9('0xa'));var Papa=require(_0x94c9('0xb'));var Redis=require(_0x94c9('0xc'));var authService=require(_0x94c9('0xd'));var qs=require(_0x94c9('0xe'));var as=require(_0x94c9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94c9('0x10'))(_0x94c9('0x11'));var utils=require(_0x94c9('0x12'));var config=require('../../config/environment');var db=require(_0x94c9('0x13'))['db'];config[_0x94c9('0x14')]=_[_0x94c9('0x15')](config[_0x94c9('0x14')],{'host':_0x94c9('0x16'),'port':0x18eb});var socket=require(_0x94c9('0x17'))(new Redis(config[_0x94c9('0x14')]));require(_0x94c9('0x18'))['register'](socket);function respondWithStatusCode(_0x5990e8,_0x5801d3){_0x5801d3=_0x5801d3||0xcc;return function(_0x3afa3){if(_0x3afa3){return _0x5990e8[_0x94c9('0x19')](_0x5801d3);}return _0x5990e8['status'](_0x5801d3)[_0x94c9('0x1a')]();};}function respondWithResult(_0x3abfa5,_0x372b66){_0x372b66=_0x372b66||0xc8;return function(_0x56609d){if(_0x56609d){return _0x3abfa5['status'](_0x372b66)[_0x94c9('0x1b')](_0x56609d);}};}function respondWithFilteredResult(_0x465886,_0x8778dc){return function(_0x459e86){if(_0x459e86){var _0x5ab49f=_0x459e86[_0x94c9('0x1c')],_0xb3d5d6=_0x8778dc[_0x94c9('0x1d')],_0x2bca02=_0x8778dc[_0x94c9('0x1d')]+_0x8778dc[_0x94c9('0x1e')],_0x3a38cc;if(_0x2bca02>=_0x5ab49f){_0x2bca02=_0x5ab49f;_0x3a38cc=0xc8;}else{_0x3a38cc=0xce;}_0x465886['status'](_0x3a38cc);return _0x465886[_0x94c9('0x1f')](_0x94c9('0x20'),_0xb3d5d6+'-'+_0x2bca02+'/'+_0x5ab49f)['json'](_0x459e86);}return null;};}function patchUpdates(_0x35b03c){return function(_0x10c163){try{jsonpatch[_0x94c9('0x21')](_0x10c163,_0x35b03c,!![]);}catch(_0x1bb3f0){return BPromise[_0x94c9('0x22')](_0x1bb3f0);}return _0x10c163[_0x94c9('0x23')]();};}function saveUpdates(_0x410f00,_0x45f33f){return function(_0x24445d){if(_0x24445d){return _0x24445d[_0x94c9('0x24')](_0x410f00)['then'](function(_0x2f20bd){return _0x2f20bd;});}return null;};}function removeEntity(_0x50ee41,_0xf5ce65){return function(_0x497c31){if(_0x497c31){return _0x497c31[_0x94c9('0x25')]()[_0x94c9('0x26')](function(){var _0x2e5398=_0x497c31[_0x94c9('0x27')]({'plain':!![]});var _0x1821a2=[{'name':_0x94c9('0x28'),'value':'inbound','ignore':![]},{'name':_0x94c9('0x29'),'value':_0x94c9('0x2a'),'ignore':![]}];var _0x15718d=_(_0x1821a2)['filter'](_0x94c9('0x2b'))['map'](_0x94c9('0x2c'))[_0x94c9('0x2c')]();if(_[_0x94c9('0x2d')](_0x15718d,_0x2e5398[_0x94c9('0x2e')])){return;}var _0x299ad1=_[_0x94c9('0x2f')](_0x1821a2,['value',_0x2e5398[_0x94c9('0x2e')]])[_0x94c9('0x30')];return db[_0x94c9('0x31')]['destroy']({'where':{'type':_0x299ad1,'resourceId':_0x2e5398['id']}})[_0x94c9('0x26')](function(){return _0x497c31;});})[_0x94c9('0x26')](function(){_0x50ee41[_0x94c9('0x32')](0xcc)[_0x94c9('0x1a')]();});}};}function handleEntityNotFound(_0x569977,_0x9e09c4){return function(_0x15efd6){if(!_0x15efd6){_0x569977['sendStatus'](0x194);}return _0x15efd6;};}function handleError(_0xd079d8,_0x4b62ea){_0x4b62ea=_0x4b62ea||0x1f4;return function(_0x2d20c6){logger[_0x94c9('0x33')](_0x2d20c6[_0x94c9('0x34')]);if(_0x2d20c6[_0x94c9('0x30')]){delete _0x2d20c6[_0x94c9('0x30')];}_0xd079d8['status'](_0x4b62ea)[_0x94c9('0x35')](_0x2d20c6);};}exports[_0x94c9('0x36')]=function(_0x2f726f,_0x378db5){var _0x59f164={},_0x4725be={},_0x1c6453={'count':0x0,'rows':[]};var _0x50204a=_[_0x94c9('0x37')](db[_0x94c9('0x38')][_0x94c9('0x39')],function(_0x5399f9){return{'name':_0x5399f9[_0x94c9('0x3a')],'type':_0x5399f9[_0x94c9('0x2e')]['key']};});_0x4725be[_0x94c9('0x3b')]=_['map'](_0x50204a,'name');_0x4725be[_0x94c9('0x3c')]=_['keys'](_0x2f726f[_0x94c9('0x3c')]);_0x4725be[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x4725be[_0x94c9('0x3b')],_0x4725be[_0x94c9('0x3c')]);_0x59f164[_0x94c9('0x3f')]=_['intersection'](_0x4725be[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x59f164['attributes']=_0x59f164[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x59f164[_0x94c9('0x3f')]:_0x4725be[_0x94c9('0x3b')];if(!_0x2f726f['query'][_0x94c9('0x42')](_0x94c9('0x43'))){_0x59f164[_0x94c9('0x1e')]=qs['limit'](_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x1e')]);_0x59f164[_0x94c9('0x1d')]=qs[_0x94c9('0x1d')](_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x1d')]);}_0x59f164[_0x94c9('0x44')]=qs[_0x94c9('0x45')](_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x45')]);_0x59f164[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x2f726f[_0x94c9('0x3c')],_0x4725be[_0x94c9('0x3d')]),_0x50204a);if(_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x48')]){_0x59f164[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x59f164[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x50204a,function(_0x5e68bf){if(_0x5e68bf[_0x94c9('0x2e')]!==_0x94c9('0x4a')){var _0x2e6da2={};_0x2e6da2[_0x5e68bf['name']]={'$like':'%'+_0x2f726f[_0x94c9('0x3c')]['filter']+'%'};return _0x2e6da2;}})});}_0x59f164=_[_0x94c9('0x49')]({},_0x59f164,_0x2f726f[_0x94c9('0x4b')]);var _0x333852={'where':_0x59f164['where']};return db[_0x94c9('0x38')]['count'](_0x333852)[_0x94c9('0x26')](function(_0xe8bbb9){_0x1c6453[_0x94c9('0x1c')]=_0xe8bbb9;if(_0x2f726f[_0x94c9('0x3c')][_0x94c9('0x4c')]){_0x59f164[_0x94c9('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x59f164);})['then'](function(_0x25f34e){_0x1c6453[_0x94c9('0x4e')]=_0x25f34e;return _0x1c6453;})[_0x94c9('0x26')](respondWithFilteredResult(_0x378db5,_0x59f164))['catch'](handleError(_0x378db5,null));};exports[_0x94c9('0x4f')]=function(_0x484420,_0x326126){var _0x27bcd6={'raw':![],'where':{'id':_0x484420[_0x94c9('0x50')]['id']}},_0x1b521f={};_0x1b521f[_0x94c9('0x3b')]=_[_0x94c9('0x51')](db[_0x94c9('0x38')]['rawAttributes']);_0x1b521f[_0x94c9('0x3c')]=_['keys'](_0x484420[_0x94c9('0x3c')]);_0x1b521f[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x1b521f[_0x94c9('0x3b')],_0x1b521f[_0x94c9('0x3c')]);_0x27bcd6[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x1b521f[_0x94c9('0x3b')],qs['fields'](_0x484420[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x27bcd6[_0x94c9('0x3f')]=_0x27bcd6[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x27bcd6['attributes']:_0x1b521f[_0x94c9('0x3b')];if(_0x484420[_0x94c9('0x3c')]['includeAll']){_0x27bcd6[_0x94c9('0x4d')]=[{'all':!![]}];}_0x27bcd6=_['merge']({},_0x27bcd6,_0x484420[_0x94c9('0x4b')]);return db['VoiceQueue']['find'](_0x27bcd6)[_0x94c9('0x26')](handleEntityNotFound(_0x326126,null))['then'](respondWithResult(_0x326126,null))[_0x94c9('0x52')](handleError(_0x326126,null));};exports['create']=function(_0x28ac9f,_0x30956b){return db[_0x94c9('0x38')]['create'](_0x28ac9f[_0x94c9('0x53')],{})[_0x94c9('0x26')](function(_0x421e2b){var _0x25b075=_0x28ac9f[_0x94c9('0x54')]['get']({'plain':!![]});if(!_0x25b075)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25b075[_0x94c9('0x55')]===_0x94c9('0x54')){var _0xd3db73=_0x421e2b['get']({'plain':!![]});var _0x433b6e=[{'name':_0x94c9('0x28'),'value':_0x94c9('0x56')},{'name':'QueueCampaigns','value':_0x94c9('0x2a')}];var _0x866e9b=_[_0x94c9('0x2f')](_0x433b6e,[_0x94c9('0x2c'),_0xd3db73[_0x94c9('0x2e')]])[_0x94c9('0x30')];return db[_0x94c9('0x57')][_0x94c9('0x2f')]({'where':{'name':_0x866e9b,'userProfileId':_0x25b075['userProfileId']},'raw':!![]})[_0x94c9('0x26')](function(_0x2592ba){if(_0x2592ba&&_0x2592ba[_0x94c9('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0xd3db73['name'],'resourceId':_0xd3db73['id'],'type':_0x2592ba['name'],'sectionId':_0x2592ba['id']},{})['then'](function(){return _0x421e2b;});}else{return _0x421e2b;}})[_0x94c9('0x52')](function(_0x262bc1){logger[_0x94c9('0x33')](_0x94c9('0x59'),_0x262bc1);throw _0x262bc1;});}return _0x421e2b;})[_0x94c9('0x26')](respondWithResult(_0x30956b,0xc9))['catch'](handleError(_0x30956b,null));};exports[_0x94c9('0x5a')]=function(_0x22338c,_0x8f143f){var _0x438809={'where':{'id':_0x22338c['params']['id']}},_0x2ea254={};_0x2ea254['model']=_['keys'](db[_0x94c9('0x38')]['rawAttributes']);_0x438809[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x2ea254[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0x22338c['query'][_0x94c9('0x40')]));_0x438809[_0x94c9('0x3f')]=_0x438809[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x438809[_0x94c9('0x3f')]:_0x2ea254[_0x94c9('0x3b')];if(_0x22338c[_0x94c9('0x3c')][_0x94c9('0x4c')]){_0x438809[_0x94c9('0x4d')]=[{'all':!![]}];}_0x438809=_[_0x94c9('0x49')]({},_0x438809,_0x22338c[_0x94c9('0x4b')]);return db[_0x94c9('0x38')][_0x94c9('0x2f')](_0x438809)[_0x94c9('0x26')](handleEntityNotFound(_0x8f143f,null))[_0x94c9('0x26')](function(_0x535b43){if(_0x535b43){var _0x2f5476=_0x535b43[_0x94c9('0x27')]({'plain':!![]});_0x2f5476=qs[_0x94c9('0x5b')](_0x2f5476,['id',_0x94c9('0x5c'),_0x94c9('0x5d')]);_0x22338c[_0x94c9('0x53')]=_[_0x94c9('0x5b')](_0x22338c[_0x94c9('0x53')],['id',_0x94c9('0x5c'),_0x94c9('0x5d')]);return db[_0x94c9('0x38')][_0x94c9('0x5e')](_[_0x94c9('0x49')](_0x2f5476,_0x22338c[_0x94c9('0x53')]),{'include':_0x22338c[_0x94c9('0x3c')][_0x94c9('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x449592){var _0x15cfd0=_0x22338c[_0x94c9('0x54')][_0x94c9('0x27')]({'plain':!![]});if(!_0x15cfd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15cfd0['role']===_0x94c9('0x54')){var _0x2a7fff=_0x449592[_0x94c9('0x27')]({'plain':!![]});var _0xdb86a8=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x94c9('0x29'),'value':_0x94c9('0x2a')}];var _0x166da5=_[_0x94c9('0x2f')](_0xdb86a8,[_0x94c9('0x2c'),_0x2a7fff[_0x94c9('0x2e')]])[_0x94c9('0x30')];return db['UserProfileSection']['find']({'where':{'name':_0x166da5,'userProfileId':_0x15cfd0[_0x94c9('0x5f')]},'raw':!![]})[_0x94c9('0x26')](function(_0x5f5547){if(_0x5f5547&&_0x5f5547['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2a7fff['name'],'resourceId':_0x2a7fff['id'],'type':_0x5f5547['name'],'sectionId':_0x5f5547['id']},{})[_0x94c9('0x26')](function(){return _0x449592;});}else{return _0x449592;}})[_0x94c9('0x52')](function(_0x4746ad){logger[_0x94c9('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4746ad);throw _0x4746ad;});}return _0x449592;});}})[_0x94c9('0x26')](respondWithResult(_0x8f143f,0xc9))['catch'](handleError(_0x8f143f,null));};exports[_0x94c9('0x24')]=function(_0x37adea,_0x5bf6b0){if(_0x37adea[_0x94c9('0x53')]['id']){delete _0x37adea[_0x94c9('0x53')]['id'];}return db[_0x94c9('0x38')]['find']({'where':{'id':_0x37adea['params']['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x5bf6b0,null))[_0x94c9('0x26')](saveUpdates(_0x37adea[_0x94c9('0x53')],null))['then'](respondWithResult(_0x5bf6b0,null))['catch'](handleError(_0x5bf6b0,null));};exports['destroy']=function(_0x203ebd,_0x4bb68d){return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x203ebd[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x4bb68d,null))[_0x94c9('0x26')](removeEntity(_0x4bb68d,null))[_0x94c9('0x52')](handleError(_0x4bb68d,null));};exports[_0x94c9('0x60')]=function(_0x432ed8,_0x57eb7d,_0x577273){var _0x305dff={'raw':![],'where':{}};var _0x4eb33a={};var _0x2353e6={'count':0x0,'rows':[]};return db[_0x94c9('0x38')][_0x94c9('0x61')]({'where':{'id':_0x432ed8[_0x94c9('0x50')]['id']}})['then'](handleEntityNotFound(_0x57eb7d,null))['then'](function(_0x9406fd){if(_0x9406fd){_0x4eb33a[_0x94c9('0x3b')]=_[_0x94c9('0x51')](db['CmHopper'][_0x94c9('0x39')]);_0x4eb33a[_0x94c9('0x3c')]=_['keys'](_0x432ed8[_0x94c9('0x3c')]);_0x4eb33a[_0x94c9('0x3d')]=_['intersection'](_0x4eb33a['model'],_0x4eb33a[_0x94c9('0x3c')]);_0x305dff[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x4eb33a[_0x94c9('0x3b')],qs['fields'](_0x432ed8['query'][_0x94c9('0x40')]));_0x305dff[_0x94c9('0x3f')]=_0x305dff[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x305dff[_0x94c9('0x3f')]:_0x4eb33a[_0x94c9('0x3b')];if(!_0x432ed8[_0x94c9('0x3c')]['hasOwnProperty'](_0x94c9('0x43'))){_0x305dff['limit']=qs[_0x94c9('0x1e')](_0x432ed8[_0x94c9('0x3c')]['limit']);_0x305dff[_0x94c9('0x1d')]=qs['offset'](_0x432ed8[_0x94c9('0x3c')][_0x94c9('0x1d')]);}_0x305dff['order']=qs[_0x94c9('0x45')](_0x432ed8[_0x94c9('0x3c')][_0x94c9('0x45')]);_0x305dff['where']=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x432ed8['query'],_0x4eb33a['filters']));_0x305dff[_0x94c9('0x46')][_0x94c9('0x62')]=_0x9406fd['id'];if(_0x432ed8[_0x94c9('0x3c')][_0x94c9('0x48')]){_0x305dff[_0x94c9('0x46')]=_['merge'](_0x305dff[_0x94c9('0x46')],{'$or':_['map'](_0x305dff['attributes'],function(_0x1345e9){var _0x19e934={};_0x19e934[_0x1345e9]={'$like':'%'+_0x432ed8[_0x94c9('0x3c')]['filter']+'%'};return _0x19e934;})});}_0x305dff=_['merge']({},_0x305dff,_0x432ed8[_0x94c9('0x4b')]);return db[_0x94c9('0x63')][_0x94c9('0x1c')]({'where':_0x305dff['where']})[_0x94c9('0x26')](function(_0xb3c02f){_0x2353e6['count']=_0xb3c02f;if(_0x432ed8[_0x94c9('0x3c')][_0x94c9('0x4c')]){_0x305dff[_0x94c9('0x4d')]=[{'all':!![]}];}return db[_0x94c9('0x63')][_0x94c9('0x64')](_0x305dff);})[_0x94c9('0x26')](function(_0x429168){_0x2353e6['rows']=_0x429168;return _0x2353e6;});}})[_0x94c9('0x26')](respondWithFilteredResult(_0x57eb7d,_0x305dff))[_0x94c9('0x52')](handleError(_0x57eb7d,null));};exports['getHopperHistories']=function(_0x545e2a,_0x548d04,_0x515bd7){var _0xce3bb7={'raw':!![],'where':{}};var _0x3dbea8={};var _0x4ce7f7={'count':0x0,'rows':[]};return db[_0x94c9('0x38')][_0x94c9('0x61')]({'where':{'id':_0x545e2a['params']['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x548d04,null))[_0x94c9('0x26')](function(_0x59a67d){if(_0x59a67d){_0x3dbea8['model']=_[_0x94c9('0x51')](db[_0x94c9('0x65')][_0x94c9('0x39')]);_0x3dbea8[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0x545e2a['query']);_0x3dbea8['filters']=_[_0x94c9('0x3e')](_0x3dbea8['model'],_0x3dbea8[_0x94c9('0x3c')]);_0xce3bb7[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x3dbea8['model'],qs['fields'](_0x545e2a[_0x94c9('0x3c')]['fields']));_0xce3bb7[_0x94c9('0x3f')]=_0xce3bb7[_0x94c9('0x3f')][_0x94c9('0x41')]?_0xce3bb7[_0x94c9('0x3f')]:_0x3dbea8[_0x94c9('0x3b')];if(!_0x545e2a['query'][_0x94c9('0x42')](_0x94c9('0x43'))){_0xce3bb7[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0x545e2a['query'][_0x94c9('0x1e')]);_0xce3bb7['offset']=qs['offset'](_0x545e2a[_0x94c9('0x3c')][_0x94c9('0x1d')]);}_0xce3bb7[_0x94c9('0x44')]=qs[_0x94c9('0x45')](_0x545e2a['query'][_0x94c9('0x45')]);_0xce3bb7[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x545e2a[_0x94c9('0x3c')],_0x3dbea8['filters']));_0xce3bb7[_0x94c9('0x46')][_0x94c9('0x62')]=_0x59a67d['id'];if(_0x545e2a['query'][_0x94c9('0x48')]){_0xce3bb7[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0xce3bb7[_0x94c9('0x46')],{'$or':_['map'](_0xce3bb7[_0x94c9('0x3f')],function(_0x7857a7){var _0x1707a2={};_0x1707a2[_0x7857a7]={'$like':'%'+_0x545e2a['query'][_0x94c9('0x48')]+'%'};return _0x1707a2;})});}_0xce3bb7=_[_0x94c9('0x49')]({},_0xce3bb7,_0x545e2a[_0x94c9('0x4b')]);return db[_0x94c9('0x65')][_0x94c9('0x1c')]({'where':_0xce3bb7['where']})[_0x94c9('0x26')](function(_0x51687b){_0x4ce7f7['count']=_0x51687b;if(_0x545e2a[_0x94c9('0x3c')]['includeAll']){_0xce3bb7[_0x94c9('0x4d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x94c9('0x64')](_0xce3bb7);})['then'](function(_0x2d7a17){_0x4ce7f7[_0x94c9('0x4e')]=_0x2d7a17;return _0x4ce7f7;});}})[_0x94c9('0x26')](respondWithFilteredResult(_0x548d04,_0xce3bb7))[_0x94c9('0x52')](handleError(_0x548d04,null));};exports[_0x94c9('0x66')]=function(_0xaf8a9a,_0x516f40,_0x355b5e){var _0x3b29f1={'raw':!![],'where':{}};var _0x4851c2={};var _0x17ef76={'count':0x0,'rows':[]};return db[_0x94c9('0x38')][_0x94c9('0x61')]({'where':{'id':_0xaf8a9a['params']['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x516f40,null))[_0x94c9('0x26')](function(_0x19209f){if(_0x19209f){_0x4851c2['model']=_[_0x94c9('0x51')](db[_0x94c9('0x67')][_0x94c9('0x39')]);_0x4851c2[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0xaf8a9a['query']);_0x4851c2[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x4851c2[_0x94c9('0x3b')],_0x4851c2[_0x94c9('0x3c')]);_0x3b29f1['attributes']=_[_0x94c9('0x3e')](_0x4851c2['model'],qs[_0x94c9('0x40')](_0xaf8a9a[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x3b29f1[_0x94c9('0x3f')]=_0x3b29f1[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x3b29f1[_0x94c9('0x3f')]:_0x4851c2[_0x94c9('0x3b')];if(!_0xaf8a9a[_0x94c9('0x3c')]['hasOwnProperty']('nolimit')){_0x3b29f1[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0xaf8a9a[_0x94c9('0x3c')]['limit']);_0x3b29f1[_0x94c9('0x1d')]=qs[_0x94c9('0x1d')](_0xaf8a9a[_0x94c9('0x3c')][_0x94c9('0x1d')]);}_0x3b29f1[_0x94c9('0x44')]=qs['sort'](_0xaf8a9a['query']['sort']);_0x3b29f1[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_['pick'](_0xaf8a9a[_0x94c9('0x3c')],_0x4851c2[_0x94c9('0x3d')]));_0x3b29f1[_0x94c9('0x46')]['VoiceQueueId']=_0x19209f['id'];if(_0xaf8a9a['query'][_0x94c9('0x48')]){_0x3b29f1[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x3b29f1[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x3b29f1[_0x94c9('0x3f')],function(_0x343846){var _0x4ae3f8={};_0x4ae3f8[_0x343846]={'$like':'%'+_0xaf8a9a[_0x94c9('0x3c')][_0x94c9('0x48')]+'%'};return _0x4ae3f8;})});}_0x3b29f1=_[_0x94c9('0x49')]({},_0x3b29f1,_0xaf8a9a['options']);return db[_0x94c9('0x67')][_0x94c9('0x1c')]({'where':_0x3b29f1[_0x94c9('0x46')]})['then'](function(_0x36532e){_0x17ef76[_0x94c9('0x1c')]=_0x36532e;if(_0xaf8a9a[_0x94c9('0x3c')]['includeAll']){_0x3b29f1[_0x94c9('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x94c9('0x64')](_0x3b29f1);})[_0x94c9('0x26')](function(_0x5c5114){_0x17ef76[_0x94c9('0x4e')]=_0x5c5114;return _0x17ef76;});}})[_0x94c9('0x26')](respondWithFilteredResult(_0x516f40,_0x3b29f1))[_0x94c9('0x52')](handleError(_0x516f40,null));};exports[_0x94c9('0x68')]=function(_0x522655,_0x48fbce,_0x1848e3){var _0x4e16a4={'raw':!![],'where':{}};var _0x5aae40={};var _0x41003e={'count':0x0,'rows':[]};return db[_0x94c9('0x38')][_0x94c9('0x61')]({'where':{'id':_0x522655[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x48fbce,null))[_0x94c9('0x26')](function(_0x1b2e90){if(_0x1b2e90){_0x5aae40[_0x94c9('0x3b')]=_['keys'](db[_0x94c9('0x69')][_0x94c9('0x39')]);_0x5aae40[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0x522655[_0x94c9('0x3c')]);_0x5aae40['filters']=_[_0x94c9('0x3e')](_0x5aae40[_0x94c9('0x3b')],_0x5aae40[_0x94c9('0x3c')]);_0x4e16a4[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x5aae40[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0x522655[_0x94c9('0x3c')]['fields']));_0x4e16a4['attributes']=_0x4e16a4[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x4e16a4[_0x94c9('0x3f')]:_0x5aae40[_0x94c9('0x3b')];if(!_0x522655[_0x94c9('0x3c')][_0x94c9('0x42')](_0x94c9('0x43'))){_0x4e16a4[_0x94c9('0x1e')]=qs['limit'](_0x522655[_0x94c9('0x3c')][_0x94c9('0x1e')]);_0x4e16a4[_0x94c9('0x1d')]=qs['offset'](_0x522655[_0x94c9('0x3c')][_0x94c9('0x1d')]);}_0x4e16a4[_0x94c9('0x44')]=qs['sort'](_0x522655['query'][_0x94c9('0x45')]);_0x4e16a4[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x522655['query'],_0x5aae40[_0x94c9('0x3d')]));_0x4e16a4['where'][_0x94c9('0x62')]=_0x1b2e90['id'];if(_0x522655[_0x94c9('0x3c')]['filter']){_0x4e16a4[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x4e16a4[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x4e16a4[_0x94c9('0x3f')],function(_0x3bc6d5){var _0x5a6aa0={};_0x5a6aa0[_0x3bc6d5]={'$like':'%'+_0x522655[_0x94c9('0x3c')][_0x94c9('0x48')]+'%'};return _0x5a6aa0;})});}_0x4e16a4=_[_0x94c9('0x49')]({},_0x4e16a4,_0x522655[_0x94c9('0x4b')]);return db['CmHopperBlack'][_0x94c9('0x1c')]({'where':_0x4e16a4[_0x94c9('0x46')]})[_0x94c9('0x26')](function(_0x46f94e){_0x41003e[_0x94c9('0x1c')]=_0x46f94e;if(_0x522655[_0x94c9('0x3c')][_0x94c9('0x4c')]){_0x4e16a4[_0x94c9('0x4d')]=[{'all':!![]}];}return db[_0x94c9('0x69')]['findAll'](_0x4e16a4);})[_0x94c9('0x26')](function(_0xf11a8d){_0x41003e[_0x94c9('0x4e')]=_0xf11a8d;return _0x41003e;});}})[_0x94c9('0x26')](respondWithFilteredResult(_0x48fbce,_0x4e16a4))['catch'](handleError(_0x48fbce,null));};exports[_0x94c9('0x6a')]=function(_0xa40086,_0x1858b8,_0x3909f5){var _0x33c015={};var _0x382316={};var _0x523864;var _0x24cdba;return db['VoiceQueue']['findOne']({'where':{'id':_0xa40086[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x1858b8,null))['then'](function(_0x40e236){if(_0x40e236){_0x523864=_0x40e236;_0x382316['model']=_[_0x94c9('0x51')](db[_0x94c9('0x6b')][_0x94c9('0x39')]);_0x382316[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0xa40086[_0x94c9('0x3c')]);_0x382316[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x382316[_0x94c9('0x3b')],_0x382316['query']);_0x33c015[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x382316[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0xa40086[_0x94c9('0x3c')]['fields']));_0x33c015[_0x94c9('0x3f')]=_0x33c015[_0x94c9('0x3f')][_0x94c9('0x41')]?_0x33c015[_0x94c9('0x3f')]:_0x382316[_0x94c9('0x3b')];_0x33c015[_0x94c9('0x44')]=qs[_0x94c9('0x45')](_0xa40086[_0x94c9('0x3c')]['sort']);_0x33c015[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_['pick'](_0xa40086['query'],_0x382316[_0x94c9('0x3d')]));if(_0xa40086[_0x94c9('0x3c')][_0x94c9('0x48')]){_0x33c015[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x33c015['where'],{'$or':_[_0x94c9('0x37')](_0x33c015[_0x94c9('0x3f')],function(_0x542b07){var _0x165084={};_0x165084[_0x542b07]={'$like':'%'+_0xa40086[_0x94c9('0x3c')][_0x94c9('0x48')]+'%'};return _0x165084;})});}_0x33c015=_[_0x94c9('0x49')]({},_0x33c015,_0xa40086['options']);return _0x523864[_0x94c9('0x6a')](_0x33c015);}})[_0x94c9('0x26')](function(_0xd74fc1){if(_0xd74fc1){_0x24cdba=_0xd74fc1[_0x94c9('0x41')];if(!_0xa40086[_0x94c9('0x3c')][_0x94c9('0x42')](_0x94c9('0x43'))){_0x33c015[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0xa40086[_0x94c9('0x3c')]['limit']);_0x33c015[_0x94c9('0x1d')]=qs[_0x94c9('0x1d')](_0xa40086['query'][_0x94c9('0x1d')]);}return _0x523864['getTeams'](_0x33c015);}})[_0x94c9('0x26')](function(_0x207a9f){if(_0x207a9f){return _0x207a9f?{'count':_0x24cdba,'rows':_0x207a9f}:null;}})[_0x94c9('0x26')](respondWithResult(_0x1858b8,null))['catch'](handleError(_0x1858b8,null));};exports['addTeams']=function(_0x5c52df,_0x13007c,_0x109168){var _0xa4c678=_0x5c52df[_0x94c9('0x53')]['teams'];var _0x2240ae=_[_0x94c9('0x37')](_0xa4c678,'id');return db[_0x94c9('0x6b')][_0x94c9('0x64')]({'where':{'id':_0x2240ae},'attributes':['id'],'include':[{'model':db[_0x94c9('0x6c')],'as':'Agents','attributes':['id',_0x94c9('0x30'),_0x94c9('0x6d'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x2a04ae){if(_0x2a04ae){var _0x24b174=_[_0x94c9('0x6e')](_0x2a04ae,function(_0x1d6116){var _0x2406d7=_0x1d6116[_0x94c9('0x27')]({'plain':!![]});_0x2406d7[_0x94c9('0x6f')][_0x94c9('0x70')](function(_0x37b401){_0x37b401[_0x94c9('0x71')]=_[_0x94c9('0x2f')](_0xa4c678,{'id':_0x2406d7['id']})[_0x94c9('0x71')];});return _0x2406d7[_0x94c9('0x6f')];});return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x5c52df[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](function(_0x2d22f3){return db[_0x94c9('0x72')][_0x94c9('0x73')](function(_0x2f32c3){return _0x2d22f3['addTeams'](_0x2240ae,{'transaction':_0x2f32c3})[_0x94c9('0x26')](function(){return BPromise[_0x94c9('0x74')](_0x24b174,function(_0x24cc2c){return db['UserVoiceQueue'][_0x94c9('0x75')]({'where':{'UserId':_0x24cc2c['id'],'VoiceQueueId':_0x5c52df[_0x94c9('0x50')]['id']},'defaults':{'penalty':_0x24cc2c[_0x94c9('0x71')]},'transaction':_0x2f32c3});});})[_0x94c9('0x26')](function(){return BPromise[_0x94c9('0x74')](_[_0x94c9('0x48')](_0x24b174,{'online':!![]}),function(_0x3505b8){return db[_0x94c9('0x76')][_0x94c9('0x77')]({'membername':_0x3505b8[_0x94c9('0x30')],'UserId':_0x3505b8['id'],'queue_name':_0x2d22f3[_0x94c9('0x30')],'VoiceQueueId':_0x2d22f3['id'],'interface':_[_0x94c9('0x78')](_0x3505b8[_0x94c9('0x79')])?util['format']('SIP/%s',_0x3505b8[_0x94c9('0x30')]):_0x3505b8[_0x94c9('0x79')],'paused':_0x3505b8[_0x94c9('0x7a')]||![],'penalty':_0x3505b8[_0x94c9('0x71')]},{'transaction':_0x2f32c3});});})[_0x94c9('0x26')](function(){_0x24b174[_0x94c9('0x70')](function(_0x2821c6){socket[_0x94c9('0x7b')]('userVoiceQueue:save',{'UserId':_0x2821c6['id'],'VoiceQueueId':_0x2d22f3['id']});});});});});}})[_0x94c9('0x26')](respondWithStatusCode(_0x13007c,null))[_0x94c9('0x52')](handleError(_0x13007c,null));};exports[_0x94c9('0x7c')]=function(_0x48d442,_0x44832b,_0x4e02a1){return db[_0x94c9('0x6b')][_0x94c9('0x64')]({'where':{'id':_0x48d442[_0x94c9('0x3c')][_0x94c9('0x7d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x94c9('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x94c9('0x26')](handleEntityNotFound(_0x44832b,null))[_0x94c9('0x26')](function(_0x41cca9){var _0x403e26=_[_0x94c9('0x37')](_0x41cca9,'id');var _0x3f81a3=[];var _0x21b107=[];var _0x93e935=squel['select']();_0x93e935[_0x94c9('0x7e')](_0x94c9('0x7f'))[_0x94c9('0x80')](_0x94c9('0x81'),'tq')[_0x94c9('0x82')](_0x94c9('0x83'),'ut',_0x94c9('0x84'))['where'](_0x94c9('0x85'),_0x48d442[_0x94c9('0x50')]['id']);for(var _0x4ace4e=0x0;_0x4ace4e<_0x41cca9[_0x94c9('0x41')];_0x4ace4e+=0x1){let _0x5e7fad=_0x41cca9[_0x4ace4e];for(var _0x3a87c1=0x0;_0x3a87c1<_0x5e7fad['Agents'][_0x94c9('0x41')];_0x3a87c1+=0x1){let _0x10358e=_0x5e7fad[_0x94c9('0x6f')][_0x3a87c1];var _0xfe4fa0=_0x93e935[_0x94c9('0x5a')]();_0xfe4fa0[_0x94c9('0x46')](_0x94c9('0x86'),_0x10358e['id']);_0x21b107['push'](db[_0x94c9('0x72')][_0x94c9('0x3c')](_0xfe4fa0['toString'](),{'type':db[_0x94c9('0x72')][_0x94c9('0x87')][_0x94c9('0x88')]})[_0x94c9('0x26')](function(_0x50cff7){if(_0x50cff7[_0x94c9('0x41')]===0x1){return _0x10358e['id'];}else{var _0x5cc273=_[_0x94c9('0x89')](_[_0x94c9('0x37')](_0x50cff7,_0x94c9('0x8a')),function(_0x48739d){return _[_0x94c9('0x2d')](_0x403e26,_0x48739d);});if(_0x5cc273){return _0x10358e['id'];}}}));}}return BPromise[_0x94c9('0x8b')](_0x21b107)[_0x94c9('0x26')](function(_0x4b09cc){_0x3f81a3=_(_0x3f81a3)[_0x94c9('0x8c')](_0x4b09cc)[_0x94c9('0x8d')]()[_0x94c9('0x2c')]();return db[_0x94c9('0x38')]['find']({'where':{'id':_0x48d442['params']['id']}})[_0x94c9('0x26')](function(_0xea69b1){return db['sequelize']['transaction'](function(_0x3a5a21){return _0xea69b1[_0x94c9('0x7c')](_0x48d442[_0x94c9('0x3c')][_0x94c9('0x7d')],{'transaction':_0x3a5a21})['then'](function(){if(!_[_0x94c9('0x8e')](_0x3f81a3)){return _0xea69b1['removeAgents'](_0x3f81a3,{'transaction':_0x3a5a21})[_0x94c9('0x26')](function(){return db['UserVoiceQueueRt'][_0x94c9('0x25')]({'where':{'VoiceQueueId':_0x48d442[_0x94c9('0x50')]['id'],'UserId':_0x3f81a3},'transaction':_0x3a5a21});});}})[_0x94c9('0x26')](function(){_0x3f81a3[_0x94c9('0x70')](function(_0x45d5f0){socket[_0x94c9('0x7b')](_0x94c9('0x8f'),{'UserId':_0x45d5f0,'VoiceQueueId':_0xea69b1['id']});});});});});});})[_0x94c9('0x26')](respondWithStatusCode(_0x44832b,null))[_0x94c9('0x52')](handleError(_0x44832b,null));};exports[_0x94c9('0x90')]=function(_0x3890c6,_0x64eca8,_0x3bbc6f){var _0x433d86,_0x43b303;return db['VoiceQueue']['find']({'where':{'id':_0x3890c6['params']['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x64eca8,null))[_0x94c9('0x26')](function(_0x2654d0){if(_0x2654d0){_0x43b303=_0x2654d0;return _0x2654d0['addAgents'](_0x3890c6[_0x94c9('0x53')][_0x94c9('0x7d')],_['omit'](_0x3890c6[_0x94c9('0x53')],['ids','id'])||{})['spread'](function(_0x45991a){for(var _0x35fb44=0x0;_0x35fb44<_0x3890c6[_0x94c9('0x53')][_0x94c9('0x7d')][_0x94c9('0x41')];_0x35fb44+=0x1){socket[_0x94c9('0x7b')]('userVoiceQueue:save',{'UserId':_0x3890c6['body'][_0x94c9('0x7d')][_0x35fb44],'VoiceQueueId':_0x3890c6['params']['id']});}return _0x45991a;});}})['then'](function(_0x54c305){_0x433d86=_0x54c305||[];if(_0x43b303){return db[_0x94c9('0x6c')][_0x94c9('0x64')]({'where':{'id':_0x3890c6['body']['ids']},'attributes':['id',_0x94c9('0x30'),_0x94c9('0x6d'),_0x94c9('0x7a'),_0x94c9('0x79')],'raw':!![]});}})['then'](function(_0x2de927){if(!_['isEmpty'](_0x2de927)){var _0x56ec0b=[];for(var _0xd776f4=0x0;_0xd776f4<_0x2de927[_0x94c9('0x41')];_0xd776f4++){if(_0x2de927[_0xd776f4]['online']){_0x56ec0b['push'](db[_0x94c9('0x76')][_0x94c9('0x77')]({'membername':_0x2de927[_0xd776f4][_0x94c9('0x30')],'UserId':_0x2de927[_0xd776f4]['id'],'queue_name':_0x43b303['name'],'VoiceQueueId':_0x43b303['id'],'interface':_[_0x94c9('0x78')](_0x2de927[_0xd776f4][_0x94c9('0x79')])?util[_0x94c9('0x91')](_0x94c9('0x92'),_0x2de927[_0xd776f4][_0x94c9('0x30')]):_0x2de927[_0xd776f4][_0x94c9('0x79')],'paused':_0x2de927[_0xd776f4][_0x94c9('0x7a')]||![],'penalty':_0x3890c6[_0x94c9('0x53')]['penalty']||0x0}));}}return BPromise[_0x94c9('0x8b')](_0x56ec0b);}})[_0x94c9('0x26')](function(){return _0x433d86;})[_0x94c9('0x26')](respondWithResult(_0x64eca8,null))[_0x94c9('0x52')](handleError(_0x64eca8,null));};exports[_0x94c9('0x93')]=function(_0x42b0e0,_0x4cecff,_0x5d2da0){return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x42b0e0['params']['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x4cecff,null))['then'](function(_0x4f1c2e){if(_0x4f1c2e){return _0x4f1c2e['removeAgents'](_0x42b0e0[_0x94c9('0x3c')]['ids'])['then'](function(){if(_[_0x94c9('0x94')](_0x42b0e0[_0x94c9('0x3c')]['ids'])){for(var _0x57134c=0x0;_0x57134c<_0x42b0e0[_0x94c9('0x3c')]['ids']['length'];_0x57134c+=0x1){socket[_0x94c9('0x7b')](_0x94c9('0x8f'),{'UserId':Number(_0x42b0e0['query']['ids'][_0x57134c]),'VoiceQueueId':Number(_0x42b0e0['params']['id'])});}}else{socket[_0x94c9('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x42b0e0['query']['ids']),'VoiceQueueId':Number(_0x42b0e0[_0x94c9('0x50')]['id'])});}});}})[_0x94c9('0x26')](function(_0x5d034e){return db[_0x94c9('0x76')][_0x94c9('0x25')]({'where':{'VoiceQueueId':_0x42b0e0[_0x94c9('0x50')]['id'],'UserId':_0x42b0e0[_0x94c9('0x3c')][_0x94c9('0x7d')]}})[_0x94c9('0x26')](function(){return _0x5d034e;});})[_0x94c9('0x26')](respondWithStatusCode(_0x4cecff,null))[_0x94c9('0x52')](handleError(_0x4cecff,null));};exports[_0x94c9('0x95')]=function(_0x38efc6,_0x3050b8,_0x3266bd){var _0x581d7f={};var _0x56bd88={};var _0x233e50;var _0x3b7109;return db[_0x94c9('0x38')]['findOne']({'where':{'id':_0x38efc6[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x3050b8,null))['then'](function(_0x2985e8){if(_0x2985e8){_0x233e50=_0x2985e8;_0x56bd88[_0x94c9('0x3b')]=_[_0x94c9('0x51')](db['User'][_0x94c9('0x39')]);_0x56bd88[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0x38efc6[_0x94c9('0x3c')]);_0x56bd88[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x56bd88[_0x94c9('0x3b')],_0x56bd88[_0x94c9('0x3c')]);_0x581d7f[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x56bd88[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0x38efc6[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x581d7f['attributes']=_0x581d7f['attributes']['length']?_0x581d7f[_0x94c9('0x3f')]:_0x56bd88['model'];_0x581d7f['order']=qs[_0x94c9('0x45')](_0x38efc6[_0x94c9('0x3c')][_0x94c9('0x45')]);_0x581d7f[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x38efc6['query'],_0x56bd88[_0x94c9('0x3d')]));if(_0x38efc6[_0x94c9('0x3c')][_0x94c9('0x48')]){_0x581d7f[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x581d7f[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x581d7f[_0x94c9('0x3f')],function(_0x3abbc6){var _0x4a4f36={};_0x4a4f36[_0x3abbc6]={'$like':'%'+_0x38efc6[_0x94c9('0x3c')]['filter']+'%'};return _0x4a4f36;})});}_0x581d7f=_[_0x94c9('0x49')]({},_0x581d7f,_0x38efc6['options']);return _0x233e50[_0x94c9('0x95')](_0x581d7f);}})[_0x94c9('0x26')](function(_0x16214a){if(_0x16214a){_0x3b7109=_0x16214a[_0x94c9('0x41')];if(!_0x38efc6[_0x94c9('0x3c')][_0x94c9('0x42')](_0x94c9('0x43'))){_0x581d7f['limit']=qs[_0x94c9('0x1e')](_0x38efc6[_0x94c9('0x3c')]['limit']);_0x581d7f[_0x94c9('0x1d')]=qs['offset'](_0x38efc6[_0x94c9('0x3c')]['offset']);}return _0x233e50['getAgents'](_0x581d7f);}})[_0x94c9('0x26')](function(_0x24ea57){if(_0x24ea57){return _0x24ea57?{'count':_0x3b7109,'rows':_0x24ea57}:null;}})[_0x94c9('0x26')](respondWithResult(_0x3050b8,null))[_0x94c9('0x52')](handleError(_0x3050b8,null));};exports[_0x94c9('0x96')]=function(_0x1c4301,_0xdda3cf,_0x562f71){var _0x35edf4={};var _0x5aab58={};var _0x12d78c;var _0x45eaf4;return db[_0x94c9('0x38')][_0x94c9('0x61')]({'where':{'id':_0x1c4301[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0xdda3cf,null))[_0x94c9('0x26')](function(_0x4971a0){if(_0x4971a0){_0x12d78c=_0x4971a0;_0x5aab58[_0x94c9('0x3b')]=_['keys'](db[_0x94c9('0x76')][_0x94c9('0x39')]);_0x5aab58[_0x94c9('0x3c')]=_['keys'](_0x1c4301[_0x94c9('0x3c')]);_0x5aab58[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x5aab58[_0x94c9('0x3b')],_0x5aab58['query']);_0x35edf4[_0x94c9('0x3f')]=_['intersection'](_0x5aab58[_0x94c9('0x3b')],qs[_0x94c9('0x40')](_0x1c4301[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x35edf4[_0x94c9('0x3f')]=_0x35edf4['attributes'][_0x94c9('0x41')]?_0x35edf4[_0x94c9('0x3f')]:_0x5aab58[_0x94c9('0x3b')];_0x35edf4[_0x94c9('0x44')]=qs[_0x94c9('0x45')](_0x1c4301[_0x94c9('0x3c')][_0x94c9('0x45')]);_0x35edf4[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x1c4301[_0x94c9('0x3c')],_0x5aab58[_0x94c9('0x3d')]));if(_0x1c4301[_0x94c9('0x3c')][_0x94c9('0x48')]){_0x35edf4[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x35edf4[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x35edf4[_0x94c9('0x3f')],function(_0x1d2626){var _0x2f9c71={};_0x2f9c71[_0x1d2626]={'$like':'%'+_0x1c4301[_0x94c9('0x3c')]['filter']+'%'};return _0x2f9c71;})});}_0x35edf4=_[_0x94c9('0x49')]({},_0x35edf4,_0x1c4301['options']);return _0x12d78c[_0x94c9('0x96')](_0x35edf4);}})[_0x94c9('0x26')](function(_0xda8f7c){if(_0xda8f7c){_0x45eaf4=_0xda8f7c['length'];if(!_0x1c4301[_0x94c9('0x3c')][_0x94c9('0x42')]('nolimit')){_0x35edf4[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0x1c4301[_0x94c9('0x3c')][_0x94c9('0x1e')]);_0x35edf4[_0x94c9('0x1d')]=qs[_0x94c9('0x1d')](_0x1c4301['query'][_0x94c9('0x1d')]);}return _0x12d78c[_0x94c9('0x96')](_0x35edf4);}})[_0x94c9('0x26')](function(_0x20cc71){return _0x20cc71?{'count':_0x45eaf4,'rows':_0x20cc71}:null;})[_0x94c9('0x26')](respondWithResult(_0xdda3cf,null))[_0x94c9('0x52')](handleError(_0xdda3cf,null));};exports[_0x94c9('0x97')]=function(_0x1f04c5,_0x37dab5,_0x350d0b){var _0x509fd5={};var _0x34645f={};var _0x575e01;var _0x379aa0;return db['VoiceQueue']['findOne']({'where':{'id':_0x1f04c5[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x37dab5,null))['then'](function(_0xe07c2f){if(_0xe07c2f){_0x575e01=_0xe07c2f;_0x34645f[_0x94c9('0x3b')]=_[_0x94c9('0x51')](db['CmList'][_0x94c9('0x39')]);_0x34645f[_0x94c9('0x3c')]=_[_0x94c9('0x51')](_0x1f04c5[_0x94c9('0x3c')]);_0x34645f[_0x94c9('0x3d')]=_[_0x94c9('0x3e')](_0x34645f['model'],_0x34645f[_0x94c9('0x3c')]);_0x509fd5[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x34645f['model'],qs[_0x94c9('0x40')](_0x1f04c5[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x509fd5[_0x94c9('0x3f')]=_0x509fd5['attributes'][_0x94c9('0x41')]?_0x509fd5['attributes']:_0x34645f[_0x94c9('0x3b')];_0x509fd5['order']=qs[_0x94c9('0x45')](_0x1f04c5[_0x94c9('0x3c')][_0x94c9('0x45')]);_0x509fd5[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_['pick'](_0x1f04c5['query'],_0x34645f['filters']));if(_0x1f04c5[_0x94c9('0x3c')]['filter']){_0x509fd5[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x509fd5[_0x94c9('0x46')],{'$or':_['map'](_0x509fd5[_0x94c9('0x3f')],function(_0x108dde){var _0x37be73={};_0x37be73[_0x108dde]={'$like':'%'+_0x1f04c5[_0x94c9('0x3c')][_0x94c9('0x48')]+'%'};return _0x37be73;})});}_0x509fd5=_[_0x94c9('0x49')]({},_0x509fd5,_0x1f04c5['options']);return _0x575e01['getLists'](_0x509fd5);}})['then'](function(_0x5aaf24){if(_0x5aaf24){_0x379aa0=_0x5aaf24[_0x94c9('0x41')];if(!_0x1f04c5['query']['hasOwnProperty'](_0x94c9('0x43'))){_0x509fd5[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0x1f04c5[_0x94c9('0x3c')]['limit']);_0x509fd5[_0x94c9('0x1d')]=qs['offset'](_0x1f04c5[_0x94c9('0x3c')][_0x94c9('0x1d')]);}return _0x575e01[_0x94c9('0x97')](_0x509fd5);}})[_0x94c9('0x26')](function(_0x53265d){if(_0x53265d){return _0x53265d?{'count':_0x379aa0,'rows':_0x53265d}:null;}})[_0x94c9('0x26')](respondWithResult(_0x37dab5,null))['catch'](handleError(_0x37dab5,null));};exports[_0x94c9('0x98')]=function(_0x4ae570,_0x2a992a,_0x59e058){var _0xcc1a94,_0x4c3e7f;return db[_0x94c9('0x38')]['find']({'where':{'id':_0x4ae570[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x2a992a,null))[_0x94c9('0x26')](function(_0x5d3c03){if(_0x5d3c03){_0x4c3e7f=_0x5d3c03;return _0x5d3c03['addLists'](_0x4ae570[_0x94c9('0x53')][_0x94c9('0x7d')],_[_0x94c9('0x5b')](_0x4ae570[_0x94c9('0x53')],[_0x94c9('0x7d'),'id'])||{});}return null;})['spread'](function(_0x1042fa){var _0x2be07b;_0xcc1a94=_0x1042fa||[];var _0x19ede8=[];if(_0x1042fa){for(var _0xc5916d=0x0;_0xc5916d<_0x1042fa[_0x94c9('0x41')];_0xc5916d+=0x1){var _0x3f259a=_0x1042fa[_0xc5916d][_0x94c9('0x27')]({'plain':!![]});_0x4c3e7f[_0x94c9('0x99')]=_0x4ae570[_0x94c9('0x53')][_0x94c9('0x99')]?_0x4ae570[_0x94c9('0x53')][_0x94c9('0x99')]:_0x4c3e7f[_0x94c9('0x99')];switch(_0x4c3e7f[_0x94c9('0x99')]){case _0x94c9('0x9a'):_0x2be07b=squel['insert']()[_0x94c9('0x9b')]('cm_hopper')['fromQuery']([_0x94c9('0x9c'),_0x94c9('0x9d'),_0x94c9('0x9e'),_0x94c9('0x9f'),_0x94c9('0x62'),_0x94c9('0x5c'),_0x94c9('0x5d')],squel[_0x94c9('0xa0')]()[_0x94c9('0x7e')](_0x94c9('0x9c'),'phone')[_0x94c9('0x7e')](_0x94c9('0xa1'),'scheduledAt')[_0x94c9('0x7e')]('id','ContactId')[_0x94c9('0x7e')](_0x3f259a['CmListId'][_0x94c9('0xa2')](),_0x94c9('0x9f'))[_0x94c9('0x7e')](_0x4ae570[_0x94c9('0x50')]['id'][_0x94c9('0xa2')](),_0x94c9('0x62'))[_0x94c9('0x7e')](_0x94c9('0xa1'),_0x94c9('0x5c'))['field']('NOW()',_0x94c9('0x5d'))['from'](_0x94c9('0xa3'))[_0x94c9('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x94c9('0xa4'),_0x3f259a['CmListId'][_0x94c9('0xa2')]())['where'](_0x94c9('0xa5'))[_0x94c9('0x46')](_0x94c9('0xa6'),squel[_0x94c9('0xa0')]()[_0x94c9('0x7e')](_0x94c9('0xa7'))[_0x94c9('0x80')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x4ae570['params']['id'][_0x94c9('0xa2')]()))[_0x94c9('0x46')](_0x94c9('0xa6'),squel[_0x94c9('0xa0')]()[_0x94c9('0x7e')]('COALESCE(phone,\x27\x27)')[_0x94c9('0x80')](_0x94c9('0xa8'))[_0x94c9('0x46')](_0x94c9('0x85'),_0x4ae570['params']['id'][_0x94c9('0xa2')]())))[_0x94c9('0xa2')]();break;case _0x94c9('0xa9'):_0x2be07b=squel[_0x94c9('0xaa')]()['into'](_0x94c9('0xa8'))[_0x94c9('0xab')]([_0x94c9('0x9c'),_0x94c9('0x9d'),_0x94c9('0x9e'),'ListId','VoiceQueueId',_0x94c9('0x5c'),_0x94c9('0x5d')],squel['select']()[_0x94c9('0x7e')](_0x94c9('0x9c'),'phone')[_0x94c9('0x7e')]('NOW()',_0x94c9('0x9d'))[_0x94c9('0x7e')]('id','ContactId')[_0x94c9('0x7e')](_0x3f259a[_0x94c9('0xac')][_0x94c9('0xa2')](),'ListId')['field'](_0x4ae570['params']['id']['toString'](),_0x94c9('0x62'))[_0x94c9('0x7e')](_0x94c9('0xa1'),_0x94c9('0x5c'))[_0x94c9('0x7e')](_0x94c9('0xa1'),_0x94c9('0x5d'))[_0x94c9('0x80')](_0x94c9('0xa3'))['where'](_0x94c9('0xad'))[_0x94c9('0x46')](_0x94c9('0xa4'),_0x3f259a[_0x94c9('0xac')][_0x94c9('0xa2')]())[_0x94c9('0x46')](_0x94c9('0xa5'))[_0x94c9('0x46')](_0x94c9('0xa6'),squel[_0x94c9('0xa0')]()['field'](_0x94c9('0xae'))[_0x94c9('0x80')](_0x94c9('0xa8'))[_0x94c9('0x46')](_0x94c9('0x85'),_0x4ae570[_0x94c9('0x50')]['id']['toString']())))[_0x94c9('0xa2')]();break;default:_0x2be07b=squel[_0x94c9('0xaa')]()['into'](_0x94c9('0xa8'))[_0x94c9('0xab')]([_0x94c9('0x9c'),'scheduledAt',_0x94c9('0x9e'),'ListId',_0x94c9('0x62'),_0x94c9('0x5c'),'updatedAt'],squel['select']()[_0x94c9('0x7e')]('phone',_0x94c9('0x9c'))[_0x94c9('0x7e')](_0x94c9('0xa1'),_0x94c9('0x9d'))[_0x94c9('0x7e')]('id','ContactId')[_0x94c9('0x7e')](_0x3f259a[_0x94c9('0xac')][_0x94c9('0xa2')](),_0x94c9('0x9f'))[_0x94c9('0x7e')](_0x4ae570[_0x94c9('0x50')]['id'][_0x94c9('0xa2')](),_0x94c9('0x62'))[_0x94c9('0x7e')]('NOW()',_0x94c9('0x5c'))[_0x94c9('0x7e')]('NOW()',_0x94c9('0x5d'))[_0x94c9('0x80')]('cm_contacts')[_0x94c9('0x46')](_0x94c9('0xad'))['where'](_0x94c9('0xa4'),_0x3f259a['CmListId'][_0x94c9('0xa2')]())['where'](_0x94c9('0xa5')))[_0x94c9('0xa2')]();}_0x19ede8[_0x94c9('0xaf')](db['sequelize'][_0x94c9('0x3c')](_0x2be07b));}return BPromise[_0x94c9('0x8b')](_0x19ede8);}})[_0x94c9('0x26')](function(){return _0xcc1a94;})[_0x94c9('0x26')](respondWithResult(_0x2a992a,null))[_0x94c9('0x52')](handleError(_0x2a992a,null));};exports['removeLists']=function(_0x28c594,_0x470b16,_0x214350){return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x28c594[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x470b16,null))[_0x94c9('0x26')](function(_0xb65dea){if(_0xb65dea){return _0xb65dea[_0x94c9('0xb0')](_0x28c594[_0x94c9('0x3c')][_0x94c9('0x7d')]);}})[_0x94c9('0x26')](function(_0x1cdda6){if(_0x1cdda6){return db[_0x94c9('0x63')][_0x94c9('0x25')]({'where':{'ListId':_0x28c594[_0x94c9('0x3c')]['ids'],'VoiceQueueId':_0x28c594[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](function(){return _0x1cdda6;});}})['then'](respondWithStatusCode(_0x470b16,null))['catch'](handleError(_0x470b16,null));};exports[_0x94c9('0xb1')]=function(_0x1b04d5,_0x44e057,_0x35d65d){var _0x35e386={};var _0x2504c7={};var _0x43f735;var _0x3e44c8;return db['VoiceQueue'][_0x94c9('0x61')]({'where':{'id':_0x1b04d5[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x44e057,null))[_0x94c9('0x26')](function(_0x3069aa){if(_0x3069aa){_0x43f735=_0x3069aa;_0x2504c7['model']=_[_0x94c9('0x51')](db[_0x94c9('0xb2')][_0x94c9('0x39')]);_0x2504c7['query']=_[_0x94c9('0x51')](_0x1b04d5['query']);_0x2504c7['filters']=_['intersection'](_0x2504c7[_0x94c9('0x3b')],_0x2504c7[_0x94c9('0x3c')]);_0x35e386[_0x94c9('0x3f')]=_[_0x94c9('0x3e')](_0x2504c7['model'],qs[_0x94c9('0x40')](_0x1b04d5[_0x94c9('0x3c')][_0x94c9('0x40')]));_0x35e386[_0x94c9('0x3f')]=_0x35e386[_0x94c9('0x3f')]['length']?_0x35e386[_0x94c9('0x3f')]:_0x2504c7[_0x94c9('0x3b')];_0x35e386['order']=qs['sort'](_0x1b04d5[_0x94c9('0x3c')]['sort']);_0x35e386[_0x94c9('0x46')]=qs[_0x94c9('0x3d')](_[_0x94c9('0x47')](_0x1b04d5['query'],_0x2504c7['filters']));if(_0x1b04d5['query'][_0x94c9('0x48')]){_0x35e386[_0x94c9('0x46')]=_[_0x94c9('0x49')](_0x35e386[_0x94c9('0x46')],{'$or':_[_0x94c9('0x37')](_0x35e386[_0x94c9('0x3f')],function(_0x592d59){var _0x49ab33={};_0x49ab33[_0x592d59]={'$like':'%'+_0x1b04d5[_0x94c9('0x3c')][_0x94c9('0x48')]+'%'};return _0x49ab33;})});}_0x35e386=_[_0x94c9('0x49')]({},_0x35e386,_0x1b04d5[_0x94c9('0x4b')]);return _0x43f735[_0x94c9('0xb1')](_0x35e386);}})['then'](function(_0x3c486d){if(_0x3c486d){_0x3e44c8=_0x3c486d[_0x94c9('0x41')];if(!_0x1b04d5['query'][_0x94c9('0x42')](_0x94c9('0x43'))){_0x35e386[_0x94c9('0x1e')]=qs[_0x94c9('0x1e')](_0x1b04d5[_0x94c9('0x3c')][_0x94c9('0x1e')]);_0x35e386[_0x94c9('0x1d')]=qs['offset'](_0x1b04d5[_0x94c9('0x3c')][_0x94c9('0x1d')]);}return _0x43f735[_0x94c9('0xb1')](_0x35e386);}})[_0x94c9('0x26')](function(_0x5edafb){if(_0x5edafb){return _0x5edafb?{'count':_0x3e44c8,'rows':_0x5edafb}:null;}})[_0x94c9('0x26')](respondWithResult(_0x44e057,null))[_0x94c9('0x52')](handleError(_0x44e057,null));};exports[_0x94c9('0xb3')]=function(_0x2ae7b5,_0x453da7,_0x47a467){var _0x116084,_0x54b60d;return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x2ae7b5[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x453da7,null))[_0x94c9('0x26')](function(_0xc906f3){if(_0xc906f3){_0x54b60d=_0xc906f3;return _0xc906f3[_0x94c9('0xb3')](_0x2ae7b5[_0x94c9('0x53')][_0x94c9('0x7d')],_['omit'](_0x2ae7b5[_0x94c9('0x53')],['ids','id'])||{});}return null;})['spread'](function(_0x5275e6){var _0x15d051;_0x116084=_0x5275e6||[];var _0x35b3e6=[];if(_0x5275e6){for(var _0x22815d=0x0;_0x22815d<_0x5275e6[_0x94c9('0x41')];_0x22815d+=0x1){var _0x17df87=_0x5275e6[_0x22815d]['get']({'plain':!![]});_0x15d051=squel[_0x94c9('0xaa')]()[_0x94c9('0x9b')](_0x94c9('0xb4'))[_0x94c9('0xab')]([_0x94c9('0x9c'),_0x94c9('0x9e'),_0x94c9('0x9f'),_0x94c9('0x62'),_0x94c9('0x5c'),_0x94c9('0x5d')],squel[_0x94c9('0xa0')]()[_0x94c9('0x7e')]('phone',_0x94c9('0x9c'))['field']('id',_0x94c9('0x9e'))[_0x94c9('0x7e')](_0x17df87[_0x94c9('0xac')][_0x94c9('0xa2')](),_0x94c9('0x9f'))[_0x94c9('0x7e')](_0x2ae7b5[_0x94c9('0x50')]['id'][_0x94c9('0xa2')](),_0x94c9('0x62'))[_0x94c9('0x7e')](_0x94c9('0xa1'),_0x94c9('0x5c'))['field'](_0x94c9('0xa1'),_0x94c9('0x5d'))[_0x94c9('0x80')]('cm_contacts')[_0x94c9('0x46')](_0x94c9('0xad'))[_0x94c9('0x46')]('ListId\x20=\x20?',_0x17df87[_0x94c9('0xac')][_0x94c9('0xa2')]())[_0x94c9('0x46')](_0x94c9('0xa5')))['toString']();_0x35b3e6[_0x94c9('0xaf')](db[_0x94c9('0x72')]['query'](_0x15d051));}return BPromise['all'](_0x35b3e6);}})[_0x94c9('0x26')](function(){return _0x116084;})[_0x94c9('0x26')](respondWithResult(_0x453da7,null))[_0x94c9('0x52')](handleError(_0x453da7,null));};exports[_0x94c9('0xb5')]=function(_0x467941,_0x29a472,_0x425057){return db[_0x94c9('0x38')][_0x94c9('0x2f')]({'where':{'id':_0x467941[_0x94c9('0x50')]['id']}})[_0x94c9('0x26')](handleEntityNotFound(_0x29a472,null))['then'](function(_0xe47d02){if(_0xe47d02){return _0xe47d02[_0x94c9('0xb5')](_0x467941[_0x94c9('0x3c')][_0x94c9('0x7d')]);}})[_0x94c9('0x26')](function(_0x132fd1){if(_0x132fd1){return db[_0x94c9('0x69')][_0x94c9('0x25')]({'where':{'ListId':_0x467941['query'][_0x94c9('0x7d')],'VoiceQueueId':_0x467941['params']['id']}})[_0x94c9('0x26')](function(){return _0x132fd1;});}})[_0x94c9('0x26')](respondWithStatusCode(_0x29a472,null))[_0x94c9('0x52')](handleError(_0x29a472,null));}; \ No newline at end of file +var _0xa228=['cm_hopper','onlyIfOpen','into','scheduledAt','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','map','value','type','find','name','error','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','catch','show','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','params','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','upsert','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','SELECT','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','online','push','isNil','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','fromQuery','ListId','select','phone','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','from'];(function(_0x4411b4,_0x46ea64){var _0x2560c3=function(_0x598bda){while(--_0x598bda){_0x4411b4['push'](_0x4411b4['shift']());}};_0x2560c3(++_0x46ea64);}(_0xa228,0x16e));var _0x8a22=function(_0x2a5c01,_0x1d4a70){_0x2a5c01=_0x2a5c01-0x0;var _0xa07bf0=_0xa228[_0x2a5c01];return _0xa07bf0;};'use strict';var pdf=require(_0x8a22('0x0'));var emlformat=require(_0x8a22('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8a22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a22('0x3'));var moment=require(_0x8a22('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a22('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8a22('0x6'));var csv=require(_0x8a22('0x7'));var ejs=require(_0x8a22('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8a22('0x9'));var jsforce=require(_0x8a22('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8a22('0x7'));var querystring=require(_0x8a22('0xb'));var Papa=require(_0x8a22('0xc'));var Redis=require('ioredis');var authService=require(_0x8a22('0xd'));var qs=require(_0x8a22('0xe'));var as=require(_0x8a22('0xf'));var hardwareService=require(_0x8a22('0x10'));var logger=require(_0x8a22('0x11'))(_0x8a22('0x12'));var utils=require(_0x8a22('0x13'));var config=require('../../config/environment');var db=require(_0x8a22('0x14'))['db'];config[_0x8a22('0x15')]=_[_0x8a22('0x16')](config[_0x8a22('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8a22('0x17'))[_0x8a22('0x18')](socket);function respondWithStatusCode(_0x5c33ee,_0x3e5322){_0x3e5322=_0x3e5322||0xcc;return function(_0x26adbd){if(_0x26adbd){return _0x5c33ee[_0x8a22('0x19')](_0x3e5322);}return _0x5c33ee[_0x8a22('0x1a')](_0x3e5322)[_0x8a22('0x1b')]();};}function respondWithResult(_0x198138,_0x1c4342){_0x1c4342=_0x1c4342||0xc8;return function(_0x149d0){if(_0x149d0){return _0x198138['status'](_0x1c4342)[_0x8a22('0x1c')](_0x149d0);}};}function respondWithFilteredResult(_0x19d869,_0x1fb5a3){return function(_0x6ac3ca){if(_0x6ac3ca){var _0x4b7f8d=_0x6ac3ca[_0x8a22('0x1d')],_0x18e1c3=_0x1fb5a3[_0x8a22('0x1e')],_0x879f8e=_0x1fb5a3[_0x8a22('0x1e')]+_0x1fb5a3[_0x8a22('0x1f')],_0x4b4959;if(_0x879f8e>=_0x4b7f8d){_0x879f8e=_0x4b7f8d;_0x4b4959=0xc8;}else{_0x4b4959=0xce;}_0x19d869[_0x8a22('0x1a')](_0x4b4959);return _0x19d869[_0x8a22('0x20')]('Content-Range',_0x18e1c3+'-'+_0x879f8e+'/'+_0x4b7f8d)[_0x8a22('0x1c')](_0x6ac3ca);}return null;};}function patchUpdates(_0x3ce8dc){return function(_0x373742){try{jsonpatch['apply'](_0x373742,_0x3ce8dc,!![]);}catch(_0x16f6ba){return BPromise[_0x8a22('0x21')](_0x16f6ba);}return _0x373742[_0x8a22('0x22')]();};}function saveUpdates(_0x26472a,_0x3dede5){return function(_0x5a1245){if(_0x5a1245){return _0x5a1245[_0x8a22('0x23')](_0x26472a)[_0x8a22('0x24')](function(_0xe64a50){return _0xe64a50;});}return null;};}function removeEntity(_0x185318,_0x4c21f1){return function(_0x56458f){if(_0x56458f){return _0x56458f[_0x8a22('0x25')]()[_0x8a22('0x24')](function(){var _0x4fd1a8=_0x56458f['get']({'plain':!![]});var _0x10f4cf=[{'name':'VoiceQueues','value':_0x8a22('0x26'),'ignore':![]},{'name':_0x8a22('0x27'),'value':_0x8a22('0x28'),'ignore':![]}];var _0x531685=_(_0x10f4cf)[_0x8a22('0x29')]('ignore')[_0x8a22('0x2a')](_0x8a22('0x2b'))[_0x8a22('0x2b')]();if(_['includes'](_0x531685,_0x4fd1a8[_0x8a22('0x2c')])){return;}var _0x53b900=_[_0x8a22('0x2d')](_0x10f4cf,[_0x8a22('0x2b'),_0x4fd1a8[_0x8a22('0x2c')]])[_0x8a22('0x2e')];return db['UserProfileResource'][_0x8a22('0x25')]({'where':{'type':_0x53b900,'resourceId':_0x4fd1a8['id']}})['then'](function(){return _0x56458f;});})[_0x8a22('0x24')](function(){_0x185318[_0x8a22('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145bec,_0x51d519){return function(_0x52dc13){if(!_0x52dc13){_0x145bec[_0x8a22('0x19')](0x194);}return _0x52dc13;};}function handleError(_0x92f4f9,_0x27c360){_0x27c360=_0x27c360||0x1f4;return function(_0x2c0297){logger[_0x8a22('0x2f')](_0x2c0297['stack']);if(_0x2c0297[_0x8a22('0x2e')]){delete _0x2c0297[_0x8a22('0x2e')];}_0x92f4f9[_0x8a22('0x1a')](_0x27c360)[_0x8a22('0x30')](_0x2c0297);};}exports[_0x8a22('0x31')]=function(_0xd31120,_0xd163df){var _0x29a06c={},_0x5bcc48={},_0x16255e={'count':0x0,'rows':[]};var _0x26fed2=_[_0x8a22('0x2a')](db[_0x8a22('0x32')][_0x8a22('0x33')],function(_0x4e240f){return{'name':_0x4e240f['fieldName'],'type':_0x4e240f[_0x8a22('0x2c')]['key']};});_0x5bcc48[_0x8a22('0x34')]=_[_0x8a22('0x2a')](_0x26fed2,_0x8a22('0x2e'));_0x5bcc48[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0xd31120['query']);_0x5bcc48[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x5bcc48[_0x8a22('0x34')],_0x5bcc48['query']);_0x29a06c[_0x8a22('0x39')]=_['intersection'](_0x5bcc48[_0x8a22('0x34')],qs[_0x8a22('0x3a')](_0xd31120[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x29a06c[_0x8a22('0x39')]=_0x29a06c[_0x8a22('0x39')][_0x8a22('0x3b')]?_0x29a06c[_0x8a22('0x39')]:_0x5bcc48[_0x8a22('0x34')];if(!_0xd31120['query'][_0x8a22('0x3c')](_0x8a22('0x3d'))){_0x29a06c[_0x8a22('0x1f')]=qs[_0x8a22('0x1f')](_0xd31120[_0x8a22('0x35')][_0x8a22('0x1f')]);_0x29a06c[_0x8a22('0x1e')]=qs['offset'](_0xd31120[_0x8a22('0x35')]['offset']);}_0x29a06c[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0xd31120[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x29a06c[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0xd31120[_0x8a22('0x35')],_0x5bcc48[_0x8a22('0x37')]),_0x26fed2);if(_0xd31120[_0x8a22('0x35')][_0x8a22('0x29')]){_0x29a06c['where']=_['merge'](_0x29a06c[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0x26fed2,function(_0x587bc0){if(_0x587bc0[_0x8a22('0x2c')]!==_0x8a22('0x42')){var _0x17ab2e={};_0x17ab2e[_0x587bc0['name']]={'$like':'%'+_0xd31120[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x17ab2e;}})});}_0x29a06c=_[_0x8a22('0x43')]({},_0x29a06c,_0xd31120[_0x8a22('0x44')]);var _0x147e73={'where':_0x29a06c[_0x8a22('0x40')]};return db[_0x8a22('0x32')][_0x8a22('0x1d')](_0x147e73)[_0x8a22('0x24')](function(_0x36d90a){_0x16255e[_0x8a22('0x1d')]=_0x36d90a;if(_0xd31120['query'][_0x8a22('0x45')]){_0x29a06c['include']=[{'all':!![]}];}return db[_0x8a22('0x32')][_0x8a22('0x46')](_0x29a06c);})['then'](function(_0x16562c){_0x16255e['rows']=_0x16562c;return _0x16255e;})[_0x8a22('0x24')](respondWithFilteredResult(_0xd163df,_0x29a06c))[_0x8a22('0x47')](handleError(_0xd163df,null));};exports[_0x8a22('0x48')]=function(_0x4d022f,_0x48cc9d){var _0x5a0b00={'raw':![],'where':{'id':_0x4d022f['params']['id']}},_0x233aff={};_0x233aff[_0x8a22('0x34')]=_[_0x8a22('0x36')](db[_0x8a22('0x32')][_0x8a22('0x33')]);_0x233aff[_0x8a22('0x35')]=_['keys'](_0x4d022f[_0x8a22('0x35')]);_0x233aff['filters']=_[_0x8a22('0x38')](_0x233aff['model'],_0x233aff[_0x8a22('0x35')]);_0x5a0b00[_0x8a22('0x39')]=_[_0x8a22('0x38')](_0x233aff['model'],qs[_0x8a22('0x3a')](_0x4d022f[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x5a0b00[_0x8a22('0x39')]=_0x5a0b00['attributes'][_0x8a22('0x3b')]?_0x5a0b00[_0x8a22('0x39')]:_0x233aff[_0x8a22('0x34')];if(_0x4d022f[_0x8a22('0x35')][_0x8a22('0x45')]){_0x5a0b00[_0x8a22('0x49')]=[{'all':!![]}];}_0x5a0b00=_[_0x8a22('0x43')]({},_0x5a0b00,_0x4d022f[_0x8a22('0x44')]);return db[_0x8a22('0x32')]['find'](_0x5a0b00)[_0x8a22('0x24')](handleEntityNotFound(_0x48cc9d,null))['then'](respondWithResult(_0x48cc9d,null))[_0x8a22('0x47')](handleError(_0x48cc9d,null));};exports[_0x8a22('0x4a')]=function(_0xc9874e,_0x4b49d){return db[_0x8a22('0x32')]['create'](_0xc9874e[_0x8a22('0x4b')],{})['then'](function(_0x263914){var _0x19bff9=_0xc9874e[_0x8a22('0x4c')][_0x8a22('0x4d')]({'plain':!![]});if(!_0x19bff9)throw new Error(_0x8a22('0x4e'));if(_0x19bff9['role']==='user'){var _0x37117d=_0x263914[_0x8a22('0x4d')]({'plain':!![]});var _0x1f4c9d=[{'name':_0x8a22('0x4f'),'value':_0x8a22('0x26')},{'name':_0x8a22('0x27'),'value':_0x8a22('0x28')}];var _0x2d35f4=_[_0x8a22('0x2d')](_0x1f4c9d,[_0x8a22('0x2b'),_0x37117d[_0x8a22('0x2c')]])[_0x8a22('0x2e')];return db[_0x8a22('0x50')][_0x8a22('0x2d')]({'where':{'name':_0x2d35f4,'userProfileId':_0x19bff9['userProfileId']},'raw':!![]})['then'](function(_0x19e4ee){if(_0x19e4ee&&_0x19e4ee[_0x8a22('0x51')]===0x0){return db[_0x8a22('0x52')][_0x8a22('0x4a')]({'name':_0x37117d['name'],'resourceId':_0x37117d['id'],'type':_0x19e4ee[_0x8a22('0x2e')],'sectionId':_0x19e4ee['id']},{})[_0x8a22('0x24')](function(){return _0x263914;});}else{return _0x263914;}})[_0x8a22('0x47')](function(_0x244c8e){logger['error'](_0x8a22('0x53'),_0x244c8e);throw _0x244c8e;});}return _0x263914;})['then'](respondWithResult(_0x4b49d,0xc9))['catch'](handleError(_0x4b49d,null));};exports[_0x8a22('0x54')]=function(_0x270f5d,_0x596df0){var _0x1302d0={'where':{'id':_0x270f5d['params']['id']}},_0x52262b={};_0x52262b[_0x8a22('0x34')]=_[_0x8a22('0x36')](db[_0x8a22('0x32')][_0x8a22('0x33')]);_0x1302d0[_0x8a22('0x39')]=_['intersection'](_0x52262b[_0x8a22('0x34')],qs['fields'](_0x270f5d[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x1302d0['attributes']=_0x1302d0[_0x8a22('0x39')][_0x8a22('0x3b')]?_0x1302d0[_0x8a22('0x39')]:_0x52262b[_0x8a22('0x34')];if(_0x270f5d['query'][_0x8a22('0x45')]){_0x1302d0[_0x8a22('0x49')]=[{'all':!![]}];}_0x1302d0=_[_0x8a22('0x43')]({},_0x1302d0,_0x270f5d[_0x8a22('0x44')]);return db['VoiceQueue']['find'](_0x1302d0)[_0x8a22('0x24')](handleEntityNotFound(_0x596df0,null))[_0x8a22('0x24')](function(_0x217655){if(_0x217655){var _0xbd8f4a=_0x217655[_0x8a22('0x4d')]({'plain':!![]});_0xbd8f4a=qs['omit'](_0xbd8f4a,['id','createdAt','updatedAt']);_0x270f5d[_0x8a22('0x4b')]=_[_0x8a22('0x55')](_0x270f5d[_0x8a22('0x4b')],['id',_0x8a22('0x56'),_0x8a22('0x57')]);return db[_0x8a22('0x32')][_0x8a22('0x4a')](_[_0x8a22('0x43')](_0xbd8f4a,_0x270f5d[_0x8a22('0x4b')]),{'include':_0x270f5d[_0x8a22('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x8a22('0x24')](function(_0xb42ef3){var _0x49d657=_0x270f5d['user'][_0x8a22('0x4d')]({'plain':!![]});if(!_0x49d657)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49d657[_0x8a22('0x58')]===_0x8a22('0x4c')){var _0x59443f=_0xb42ef3[_0x8a22('0x4d')]({'plain':!![]});var _0x96c9af=[{'name':_0x8a22('0x4f'),'value':_0x8a22('0x26')},{'name':_0x8a22('0x27'),'value':_0x8a22('0x28')}];var _0x507e48=_['find'](_0x96c9af,[_0x8a22('0x2b'),_0x59443f[_0x8a22('0x2c')]])['name'];return db[_0x8a22('0x50')][_0x8a22('0x2d')]({'where':{'name':_0x507e48,'userProfileId':_0x49d657[_0x8a22('0x59')]},'raw':!![]})[_0x8a22('0x24')](function(_0x461610){if(_0x461610&&_0x461610[_0x8a22('0x51')]===0x0){return db[_0x8a22('0x52')][_0x8a22('0x4a')]({'name':_0x59443f[_0x8a22('0x2e')],'resourceId':_0x59443f['id'],'type':_0x461610[_0x8a22('0x2e')],'sectionId':_0x461610['id']},{})[_0x8a22('0x24')](function(){return _0xb42ef3;});}else{return _0xb42ef3;}})[_0x8a22('0x47')](function(_0x65012f){logger[_0x8a22('0x2f')](_0x8a22('0x53'),_0x65012f);throw _0x65012f;});}return _0xb42ef3;});}})[_0x8a22('0x24')](respondWithResult(_0x596df0,0xc9))[_0x8a22('0x47')](handleError(_0x596df0,null));};exports[_0x8a22('0x23')]=function(_0x4dd16,_0x42d0b4){if(_0x4dd16['body']['id']){delete _0x4dd16[_0x8a22('0x4b')]['id'];}return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x4dd16[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x42d0b4,null))[_0x8a22('0x24')](saveUpdates(_0x4dd16['body'],null))[_0x8a22('0x24')](respondWithResult(_0x42d0b4,null))[_0x8a22('0x47')](handleError(_0x42d0b4,null));};exports[_0x8a22('0x25')]=function(_0x4ac8fb,_0x70cd79){return db[_0x8a22('0x32')]['find']({'where':{'id':_0x4ac8fb[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x70cd79,null))['then'](removeEntity(_0x70cd79,null))['catch'](handleError(_0x70cd79,null));};exports[_0x8a22('0x5b')]=function(_0x1ae0d9,_0x2aca5d,_0x4e9784){var _0x2c1ef5={'raw':![],'where':{}};var _0x59fb60={};var _0x5f08dd={'count':0x0,'rows':[]};return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x1ae0d9[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x2aca5d,null))[_0x8a22('0x24')](function(_0x5c888c){if(_0x5c888c){_0x59fb60['model']=_[_0x8a22('0x36')](db['CmHopper']['rawAttributes']);_0x59fb60['query']=_['keys'](_0x1ae0d9[_0x8a22('0x35')]);_0x59fb60[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x59fb60[_0x8a22('0x34')],_0x59fb60[_0x8a22('0x35')]);_0x2c1ef5['attributes']=_[_0x8a22('0x38')](_0x59fb60[_0x8a22('0x34')],qs['fields'](_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x2c1ef5['attributes']=_0x2c1ef5['attributes'][_0x8a22('0x3b')]?_0x2c1ef5[_0x8a22('0x39')]:_0x59fb60['model'];if(!_0x1ae0d9['query'][_0x8a22('0x3c')](_0x8a22('0x3d'))){_0x2c1ef5[_0x8a22('0x1f')]=qs['limit'](_0x1ae0d9[_0x8a22('0x35')]['limit']);_0x2c1ef5[_0x8a22('0x1e')]=qs[_0x8a22('0x1e')](_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x1e')]);}_0x2c1ef5[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x2c1ef5[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_['pick'](_0x1ae0d9[_0x8a22('0x35')],_0x59fb60[_0x8a22('0x37')]));_0x2c1ef5[_0x8a22('0x40')][_0x8a22('0x5d')]=_0x5c888c['id'];if(_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x29')]){_0x2c1ef5[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0x2c1ef5[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0x2c1ef5[_0x8a22('0x39')],function(_0x233cae){var _0x3dc2c3={};_0x3dc2c3[_0x233cae]={'$like':'%'+_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x3dc2c3;})});}_0x2c1ef5=_[_0x8a22('0x43')]({},_0x2c1ef5,_0x1ae0d9[_0x8a22('0x44')]);return db[_0x8a22('0x5e')][_0x8a22('0x1d')]({'where':_0x2c1ef5[_0x8a22('0x40')]})[_0x8a22('0x24')](function(_0x3549fe){_0x5f08dd[_0x8a22('0x1d')]=_0x3549fe;if(_0x1ae0d9[_0x8a22('0x35')][_0x8a22('0x45')]){_0x2c1ef5[_0x8a22('0x49')]=[{'all':!![]}];}return db[_0x8a22('0x5e')][_0x8a22('0x46')](_0x2c1ef5);})[_0x8a22('0x24')](function(_0x485bcd){_0x5f08dd['rows']=_0x485bcd;return _0x5f08dd;});}})[_0x8a22('0x24')](respondWithFilteredResult(_0x2aca5d,_0x2c1ef5))[_0x8a22('0x47')](handleError(_0x2aca5d,null));};exports[_0x8a22('0x5f')]=function(_0x160132,_0x21ab6d,_0x3c8c6a){var _0x7e9715={'raw':!![],'where':{}};var _0x4f58bd={};var _0x16ba56={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x8a22('0x5c')]({'where':{'id':_0x160132[_0x8a22('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21ab6d,null))['then'](function(_0x205425){if(_0x205425){_0x4f58bd[_0x8a22('0x34')]=_[_0x8a22('0x36')](db['CmHopperHistory'][_0x8a22('0x33')]);_0x4f58bd[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x160132['query']);_0x4f58bd[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x4f58bd[_0x8a22('0x34')],_0x4f58bd[_0x8a22('0x35')]);_0x7e9715['attributes']=_[_0x8a22('0x38')](_0x4f58bd[_0x8a22('0x34')],qs[_0x8a22('0x3a')](_0x160132[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x7e9715[_0x8a22('0x39')]=_0x7e9715[_0x8a22('0x39')]['length']?_0x7e9715[_0x8a22('0x39')]:_0x4f58bd[_0x8a22('0x34')];if(!_0x160132[_0x8a22('0x35')][_0x8a22('0x3c')]('nolimit')){_0x7e9715['limit']=qs[_0x8a22('0x1f')](_0x160132[_0x8a22('0x35')][_0x8a22('0x1f')]);_0x7e9715[_0x8a22('0x1e')]=qs[_0x8a22('0x1e')](_0x160132['query']['offset']);}_0x7e9715[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x160132[_0x8a22('0x35')]['sort']);_0x7e9715[_0x8a22('0x40')]=qs['filters'](_[_0x8a22('0x41')](_0x160132[_0x8a22('0x35')],_0x4f58bd[_0x8a22('0x37')]));_0x7e9715['where']['VoiceQueueId']=_0x205425['id'];if(_0x160132['query']['filter']){_0x7e9715['where']=_[_0x8a22('0x43')](_0x7e9715['where'],{'$or':_['map'](_0x7e9715[_0x8a22('0x39')],function(_0x1aa9d6){var _0x5fe384={};_0x5fe384[_0x1aa9d6]={'$like':'%'+_0x160132[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x5fe384;})});}_0x7e9715=_[_0x8a22('0x43')]({},_0x7e9715,_0x160132[_0x8a22('0x44')]);return db[_0x8a22('0x60')][_0x8a22('0x1d')]({'where':_0x7e9715[_0x8a22('0x40')]})[_0x8a22('0x24')](function(_0x56c50d){_0x16ba56[_0x8a22('0x1d')]=_0x56c50d;if(_0x160132[_0x8a22('0x35')][_0x8a22('0x45')]){_0x7e9715[_0x8a22('0x49')]=[{'all':!![]}];}return db[_0x8a22('0x60')][_0x8a22('0x46')](_0x7e9715);})['then'](function(_0x32175c){_0x16ba56[_0x8a22('0x61')]=_0x32175c;return _0x16ba56;});}})['then'](respondWithFilteredResult(_0x21ab6d,_0x7e9715))[_0x8a22('0x47')](handleError(_0x21ab6d,null));};exports[_0x8a22('0x62')]=function(_0x45a5e1,_0x3f74bb,_0x255b6c){var _0xef8259={'raw':!![],'where':{}};var _0x370dee={};var _0x2cc500={'count':0x0,'rows':[]};return db[_0x8a22('0x32')]['findOne']({'where':{'id':_0x45a5e1[_0x8a22('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3f74bb,null))[_0x8a22('0x24')](function(_0x6dadcd){if(_0x6dadcd){_0x370dee[_0x8a22('0x34')]=_[_0x8a22('0x36')](db['CmHopperFinal'][_0x8a22('0x33')]);_0x370dee['query']=_[_0x8a22('0x36')](_0x45a5e1[_0x8a22('0x35')]);_0x370dee[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x370dee['model'],_0x370dee[_0x8a22('0x35')]);_0xef8259['attributes']=_[_0x8a22('0x38')](_0x370dee['model'],qs[_0x8a22('0x3a')](_0x45a5e1[_0x8a22('0x35')][_0x8a22('0x3a')]));_0xef8259[_0x8a22('0x39')]=_0xef8259[_0x8a22('0x39')][_0x8a22('0x3b')]?_0xef8259[_0x8a22('0x39')]:_0x370dee[_0x8a22('0x34')];if(!_0x45a5e1[_0x8a22('0x35')][_0x8a22('0x3c')](_0x8a22('0x3d'))){_0xef8259['limit']=qs[_0x8a22('0x1f')](_0x45a5e1['query'][_0x8a22('0x1f')]);_0xef8259[_0x8a22('0x1e')]=qs['offset'](_0x45a5e1['query']['offset']);}_0xef8259['order']=qs[_0x8a22('0x3f')](_0x45a5e1[_0x8a22('0x35')][_0x8a22('0x3f')]);_0xef8259[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x45a5e1[_0x8a22('0x35')],_0x370dee['filters']));_0xef8259[_0x8a22('0x40')][_0x8a22('0x5d')]=_0x6dadcd['id'];if(_0x45a5e1[_0x8a22('0x35')]['filter']){_0xef8259[_0x8a22('0x40')]=_['merge'](_0xef8259[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0xef8259[_0x8a22('0x39')],function(_0x54a88d){var _0x3ebbbe={};_0x3ebbbe[_0x54a88d]={'$like':'%'+_0x45a5e1['query'][_0x8a22('0x29')]+'%'};return _0x3ebbbe;})});}_0xef8259=_[_0x8a22('0x43')]({},_0xef8259,_0x45a5e1['options']);return db[_0x8a22('0x63')][_0x8a22('0x1d')]({'where':_0xef8259[_0x8a22('0x40')]})[_0x8a22('0x24')](function(_0x87b26e){_0x2cc500['count']=_0x87b26e;if(_0x45a5e1[_0x8a22('0x35')][_0x8a22('0x45')]){_0xef8259['include']=[{'all':!![]}];}return db[_0x8a22('0x63')][_0x8a22('0x46')](_0xef8259);})['then'](function(_0x2a87cd){_0x2cc500[_0x8a22('0x61')]=_0x2a87cd;return _0x2cc500;});}})[_0x8a22('0x24')](respondWithFilteredResult(_0x3f74bb,_0xef8259))[_0x8a22('0x47')](handleError(_0x3f74bb,null));};exports[_0x8a22('0x64')]=function(_0x17ce0a,_0x2294f9,_0x48ffde){var _0x30aa53={'raw':!![],'where':{}};var _0x350648={};var _0x37ef48={'count':0x0,'rows':[]};return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x17ce0a['params']['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x2294f9,null))['then'](function(_0x33246b){if(_0x33246b){_0x350648[_0x8a22('0x34')]=_[_0x8a22('0x36')](db[_0x8a22('0x65')][_0x8a22('0x33')]);_0x350648['query']=_[_0x8a22('0x36')](_0x17ce0a[_0x8a22('0x35')]);_0x350648['filters']=_[_0x8a22('0x38')](_0x350648[_0x8a22('0x34')],_0x350648['query']);_0x30aa53[_0x8a22('0x39')]=_['intersection'](_0x350648[_0x8a22('0x34')],qs['fields'](_0x17ce0a[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x30aa53[_0x8a22('0x39')]=_0x30aa53['attributes'][_0x8a22('0x3b')]?_0x30aa53[_0x8a22('0x39')]:_0x350648['model'];if(!_0x17ce0a[_0x8a22('0x35')]['hasOwnProperty'](_0x8a22('0x3d'))){_0x30aa53[_0x8a22('0x1f')]=qs['limit'](_0x17ce0a[_0x8a22('0x35')][_0x8a22('0x1f')]);_0x30aa53['offset']=qs['offset'](_0x17ce0a[_0x8a22('0x35')][_0x8a22('0x1e')]);}_0x30aa53[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x17ce0a[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x30aa53[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x17ce0a[_0x8a22('0x35')],_0x350648[_0x8a22('0x37')]));_0x30aa53[_0x8a22('0x40')][_0x8a22('0x5d')]=_0x33246b['id'];if(_0x17ce0a['query'][_0x8a22('0x29')]){_0x30aa53['where']=_['merge'](_0x30aa53[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0x30aa53[_0x8a22('0x39')],function(_0x39424d){var _0x39be8a={};_0x39be8a[_0x39424d]={'$like':'%'+_0x17ce0a['query'][_0x8a22('0x29')]+'%'};return _0x39be8a;})});}_0x30aa53=_[_0x8a22('0x43')]({},_0x30aa53,_0x17ce0a['options']);return db[_0x8a22('0x65')]['count']({'where':_0x30aa53[_0x8a22('0x40')]})[_0x8a22('0x24')](function(_0x296677){_0x37ef48[_0x8a22('0x1d')]=_0x296677;if(_0x17ce0a[_0x8a22('0x35')]['includeAll']){_0x30aa53[_0x8a22('0x49')]=[{'all':!![]}];}return db[_0x8a22('0x65')]['findAll'](_0x30aa53);})[_0x8a22('0x24')](function(_0x1549b9){_0x37ef48[_0x8a22('0x61')]=_0x1549b9;return _0x37ef48;});}})[_0x8a22('0x24')](respondWithFilteredResult(_0x2294f9,_0x30aa53))[_0x8a22('0x47')](handleError(_0x2294f9,null));};exports['getTeams']=function(_0x36ab55,_0x4c8747,_0x1131a6){var _0x415655={};var _0x3fefc7={};var _0x8934db;var _0x29ba7d;return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x36ab55[_0x8a22('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c8747,null))['then'](function(_0x33919b){if(_0x33919b){_0x8934db=_0x33919b;_0x3fefc7[_0x8a22('0x34')]=_[_0x8a22('0x36')](db['Team']['rawAttributes']);_0x3fefc7[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x36ab55['query']);_0x3fefc7[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x3fefc7[_0x8a22('0x34')],_0x3fefc7['query']);_0x415655[_0x8a22('0x39')]=_[_0x8a22('0x38')](_0x3fefc7[_0x8a22('0x34')],qs[_0x8a22('0x3a')](_0x36ab55[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x415655['attributes']=_0x415655['attributes'][_0x8a22('0x3b')]?_0x415655[_0x8a22('0x39')]:_0x3fefc7[_0x8a22('0x34')];_0x415655[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x36ab55[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x415655[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x36ab55[_0x8a22('0x35')],_0x3fefc7[_0x8a22('0x37')]));if(_0x36ab55[_0x8a22('0x35')][_0x8a22('0x29')]){_0x415655[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0x415655[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0x415655[_0x8a22('0x39')],function(_0x333c42){var _0x26abdd={};_0x26abdd[_0x333c42]={'$like':'%'+_0x36ab55[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x26abdd;})});}_0x415655=_[_0x8a22('0x43')]({},_0x415655,_0x36ab55[_0x8a22('0x44')]);return _0x8934db[_0x8a22('0x66')](_0x415655);}})[_0x8a22('0x24')](function(_0x3b4395){if(_0x3b4395){_0x29ba7d=_0x3b4395['length'];if(!_0x36ab55[_0x8a22('0x35')]['hasOwnProperty'](_0x8a22('0x3d'))){_0x415655[_0x8a22('0x1f')]=qs['limit'](_0x36ab55[_0x8a22('0x35')][_0x8a22('0x1f')]);_0x415655[_0x8a22('0x1e')]=qs['offset'](_0x36ab55[_0x8a22('0x35')][_0x8a22('0x1e')]);}return _0x8934db[_0x8a22('0x66')](_0x415655);}})[_0x8a22('0x24')](function(_0x7a4f4d){if(_0x7a4f4d){return _0x7a4f4d?{'count':_0x29ba7d,'rows':_0x7a4f4d}:null;}})[_0x8a22('0x24')](respondWithResult(_0x4c8747,null))[_0x8a22('0x47')](handleError(_0x4c8747,null));};exports[_0x8a22('0x67')]=function(_0x47a6b5,_0x276d63,_0x33e77b){var _0x23ce43=_0x47a6b5[_0x8a22('0x4b')][_0x8a22('0x68')];var _0x5af146=_['map'](_0x23ce43,'id');return db[_0x8a22('0x69')][_0x8a22('0x46')]({'where':{'id':_0x5af146},'attributes':['id'],'include':[{'model':db[_0x8a22('0x6a')],'as':_0x8a22('0x6b'),'attributes':['id',_0x8a22('0x2e'),'online',_0x8a22('0x6c'),_0x8a22('0x6d')],'raw':!![]}]})[_0x8a22('0x24')](function(_0x403c4c){if(_0x403c4c){var _0x36140d=_['flatMap'](_0x403c4c,function(_0x29f50c){var _0x27b7e3=_0x29f50c[_0x8a22('0x4d')]({'plain':!![]});_0x27b7e3[_0x8a22('0x6b')][_0x8a22('0x6e')](function(_0x3fcbde){_0x3fcbde[_0x8a22('0x6f')]=_[_0x8a22('0x2d')](_0x23ce43,{'id':_0x27b7e3['id']})[_0x8a22('0x6f')];});return _0x27b7e3[_0x8a22('0x6b')];});return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x47a6b5['params']['id']}})[_0x8a22('0x24')](function(_0x302ef2){return db['sequelize'][_0x8a22('0x70')](function(_0x30a5e6){return _0x302ef2[_0x8a22('0x67')](_0x5af146,{'transaction':_0x30a5e6})['then'](function(){return BPromise[_0x8a22('0x71')](_0x36140d,function(_0xbe4fc6){return db[_0x8a22('0x72')][_0x8a22('0x73')]({'where':{'UserId':_0xbe4fc6['id'],'VoiceQueueId':_0x47a6b5['params']['id']},'defaults':{'penalty':_0xbe4fc6['penalty']},'transaction':_0x30a5e6});});})['then'](function(){return BPromise['each'](_['filter'](_0x36140d,{'online':!![]}),function(_0x381fe3){return db['UserVoiceQueueRt'][_0x8a22('0x74')]({'membername':_0x381fe3['name'],'UserId':_0x381fe3['id'],'queue_name':_0x302ef2[_0x8a22('0x2e')],'VoiceQueueId':_0x302ef2['id'],'interface':_['isNil'](_0x381fe3[_0x8a22('0x6d')])?util[_0x8a22('0x75')](_0x8a22('0x76'),_0x381fe3[_0x8a22('0x2e')]):_0x381fe3[_0x8a22('0x6d')],'paused':_0x381fe3[_0x8a22('0x6c')]||![],'penalty':_0x381fe3[_0x8a22('0x6f')]},{'transaction':_0x30a5e6});});})[_0x8a22('0x24')](function(){_0x36140d[_0x8a22('0x6e')](function(_0x1b7d1e){socket[_0x8a22('0x77')](_0x8a22('0x78'),{'UserId':_0x1b7d1e['id'],'VoiceQueueId':_0x302ef2['id']});});});});});}})[_0x8a22('0x24')](respondWithStatusCode(_0x276d63,null))['catch'](handleError(_0x276d63,null));};exports[_0x8a22('0x79')]=function(_0x53da09,_0x3b8d0d,_0x5206e3){return db[_0x8a22('0x69')][_0x8a22('0x46')]({'where':{'id':_0x53da09[_0x8a22('0x35')][_0x8a22('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x8a22('0x6a')],'as':_0x8a22('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8a22('0x24')](handleEntityNotFound(_0x3b8d0d,null))[_0x8a22('0x24')](function(_0x5aefe1){var _0x4a0233=_[_0x8a22('0x2a')](_0x5aefe1,'id');var _0x5d3193=[];var _0x3c8187=[];var _0x2b3a1a=squel['select']();_0x2b3a1a[_0x8a22('0x7b')](_0x8a22('0x7c'))['from'](_0x8a22('0x7d'),'tq')['join'](_0x8a22('0x7e'),'ut',_0x8a22('0x7f'))['where']('VoiceQueueId\x20=\x20?',_0x53da09[_0x8a22('0x5a')]['id']);for(var _0x19d26f=0x0;_0x19d26f<_0x5aefe1[_0x8a22('0x3b')];_0x19d26f+=0x1){let _0x289dfd=_0x5aefe1[_0x19d26f];for(var _0x41addb=0x0;_0x41addb<_0x289dfd[_0x8a22('0x6b')][_0x8a22('0x3b')];_0x41addb+=0x1){let _0x35271b=_0x289dfd['Agents'][_0x41addb];var _0x553802=_0x2b3a1a['clone']();_0x553802[_0x8a22('0x40')](_0x8a22('0x80'),_0x35271b['id']);_0x3c8187['push'](db['sequelize'][_0x8a22('0x35')](_0x553802['toString'](),{'type':db[_0x8a22('0x81')]['QueryTypes'][_0x8a22('0x82')]})['then'](function(_0x1f110c){if(_0x1f110c[_0x8a22('0x3b')]===0x1){return _0x35271b['id'];}else{var _0x45c25b=_['every'](_[_0x8a22('0x2a')](_0x1f110c,'TeamId'),function(_0x180791){return _['includes'](_0x4a0233,_0x180791);});if(_0x45c25b){return _0x35271b['id'];}}}));}}return BPromise[_0x8a22('0x83')](_0x3c8187)['then'](function(_0x89649b){_0x5d3193=_(_0x5d3193)[_0x8a22('0x84')](_0x89649b)[_0x8a22('0x85')]()[_0x8a22('0x2b')]();return db['VoiceQueue'][_0x8a22('0x2d')]({'where':{'id':_0x53da09[_0x8a22('0x5a')]['id']}})['then'](function(_0x4e940f){return db['sequelize'][_0x8a22('0x70')](function(_0x427ba2){return _0x4e940f['removeTeams'](_0x53da09['query'][_0x8a22('0x7a')],{'transaction':_0x427ba2})[_0x8a22('0x24')](function(){if(!_[_0x8a22('0x86')](_0x5d3193)){return _0x4e940f[_0x8a22('0x87')](_0x5d3193,{'transaction':_0x427ba2})[_0x8a22('0x24')](function(){return db[_0x8a22('0x88')][_0x8a22('0x25')]({'where':{'VoiceQueueId':_0x53da09['params']['id'],'UserId':_0x5d3193},'transaction':_0x427ba2});});}})['then'](function(){_0x5d3193['forEach'](function(_0x35c374){socket[_0x8a22('0x77')]('userVoiceQueue:remove',{'UserId':_0x35c374,'VoiceQueueId':_0x4e940f['id']});});});});});});})[_0x8a22('0x24')](respondWithStatusCode(_0x3b8d0d,null))[_0x8a22('0x47')](handleError(_0x3b8d0d,null));};exports['addAgents']=function(_0x338e99,_0x5867dd,_0x38203f){var _0x354f6b,_0x3ace1a;return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x338e99['params']['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x5867dd,null))[_0x8a22('0x24')](function(_0x55465f){if(_0x55465f){_0x3ace1a=_0x55465f;return _0x55465f[_0x8a22('0x89')](_0x338e99[_0x8a22('0x4b')][_0x8a22('0x7a')],_[_0x8a22('0x55')](_0x338e99[_0x8a22('0x4b')],[_0x8a22('0x7a'),'id'])||{})[_0x8a22('0x8a')](function(_0x274f95){for(var _0x515253=0x0;_0x515253<_0x338e99[_0x8a22('0x4b')][_0x8a22('0x7a')][_0x8a22('0x3b')];_0x515253+=0x1){socket[_0x8a22('0x77')](_0x8a22('0x78'),{'UserId':_0x338e99['body'][_0x8a22('0x7a')][_0x515253],'VoiceQueueId':_0x338e99[_0x8a22('0x5a')]['id']});}return _0x274f95;});}})[_0x8a22('0x24')](function(_0x1fbcb8){_0x354f6b=_0x1fbcb8||[];if(_0x3ace1a){return db['User']['findAll']({'where':{'id':_0x338e99[_0x8a22('0x4b')]['ids']},'attributes':['id',_0x8a22('0x2e'),_0x8a22('0x8b'),_0x8a22('0x6c'),'interface'],'raw':!![]});}})[_0x8a22('0x24')](function(_0x41e02f){if(!_[_0x8a22('0x86')](_0x41e02f)){var _0x5bccba=[];for(var _0x2bc1cb=0x0;_0x2bc1cb<_0x41e02f[_0x8a22('0x3b')];_0x2bc1cb++){if(_0x41e02f[_0x2bc1cb][_0x8a22('0x8b')]){_0x5bccba[_0x8a22('0x8c')](db[_0x8a22('0x88')][_0x8a22('0x74')]({'membername':_0x41e02f[_0x2bc1cb][_0x8a22('0x2e')],'UserId':_0x41e02f[_0x2bc1cb]['id'],'queue_name':_0x3ace1a['name'],'VoiceQueueId':_0x3ace1a['id'],'interface':_[_0x8a22('0x8d')](_0x41e02f[_0x2bc1cb][_0x8a22('0x6d')])?util[_0x8a22('0x75')]('SIP/%s',_0x41e02f[_0x2bc1cb][_0x8a22('0x2e')]):_0x41e02f[_0x2bc1cb][_0x8a22('0x6d')],'paused':_0x41e02f[_0x2bc1cb][_0x8a22('0x6c')]||![],'penalty':_0x338e99[_0x8a22('0x4b')][_0x8a22('0x6f')]||0x0}));}}return BPromise[_0x8a22('0x83')](_0x5bccba);}})[_0x8a22('0x24')](function(){return _0x354f6b;})[_0x8a22('0x24')](respondWithResult(_0x5867dd,null))[_0x8a22('0x47')](handleError(_0x5867dd,null));};exports[_0x8a22('0x87')]=function(_0x302022,_0x35cf55,_0x4e7cfc){return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x302022[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x35cf55,null))[_0x8a22('0x24')](function(_0x2b543e){if(_0x2b543e){return _0x2b543e[_0x8a22('0x87')](_0x302022['query']['ids'])['then'](function(){if(_['isArray'](_0x302022[_0x8a22('0x35')][_0x8a22('0x7a')])){for(var _0x314bcb=0x0;_0x314bcb<_0x302022[_0x8a22('0x35')][_0x8a22('0x7a')][_0x8a22('0x3b')];_0x314bcb+=0x1){socket[_0x8a22('0x77')](_0x8a22('0x8e'),{'UserId':Number(_0x302022[_0x8a22('0x35')][_0x8a22('0x7a')][_0x314bcb]),'VoiceQueueId':Number(_0x302022[_0x8a22('0x5a')]['id'])});}}else{socket[_0x8a22('0x77')](_0x8a22('0x8e'),{'UserId':Number(_0x302022[_0x8a22('0x35')][_0x8a22('0x7a')]),'VoiceQueueId':Number(_0x302022[_0x8a22('0x5a')]['id'])});}});}})[_0x8a22('0x24')](function(_0x18999e){return db[_0x8a22('0x88')]['destroy']({'where':{'VoiceQueueId':_0x302022[_0x8a22('0x5a')]['id'],'UserId':_0x302022[_0x8a22('0x35')][_0x8a22('0x7a')]}})[_0x8a22('0x24')](function(){return _0x18999e;});})[_0x8a22('0x24')](respondWithStatusCode(_0x35cf55,null))[_0x8a22('0x47')](handleError(_0x35cf55,null));};exports['getAgents']=function(_0x1e86ad,_0x4c35c1,_0x518ea5){var _0x261adf={};var _0x196999={};var _0xfd9e27;var _0x27fbdd;return db[_0x8a22('0x32')]['findOne']({'where':{'id':_0x1e86ad[_0x8a22('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c35c1,null))['then'](function(_0x52b869){if(_0x52b869){_0xfd9e27=_0x52b869;_0x196999['model']=_['keys'](db['User'][_0x8a22('0x33')]);_0x196999[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x1e86ad[_0x8a22('0x35')]);_0x196999[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x196999[_0x8a22('0x34')],_0x196999[_0x8a22('0x35')]);_0x261adf['attributes']=_[_0x8a22('0x38')](_0x196999[_0x8a22('0x34')],qs[_0x8a22('0x3a')](_0x1e86ad[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x261adf[_0x8a22('0x39')]=_0x261adf['attributes']['length']?_0x261adf['attributes']:_0x196999[_0x8a22('0x34')];_0x261adf[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x1e86ad[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x261adf[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x1e86ad[_0x8a22('0x35')],_0x196999[_0x8a22('0x37')]));if(_0x1e86ad[_0x8a22('0x35')][_0x8a22('0x29')]){_0x261adf[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0x261adf[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0x261adf['attributes'],function(_0x1c8c61){var _0x45f01e={};_0x45f01e[_0x1c8c61]={'$like':'%'+_0x1e86ad[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x45f01e;})});}_0x261adf=_[_0x8a22('0x43')]({},_0x261adf,_0x1e86ad[_0x8a22('0x44')]);return _0xfd9e27[_0x8a22('0x8f')](_0x261adf);}})[_0x8a22('0x24')](function(_0x157b78){if(_0x157b78){_0x27fbdd=_0x157b78[_0x8a22('0x3b')];if(!_0x1e86ad['query']['hasOwnProperty'](_0x8a22('0x3d'))){_0x261adf[_0x8a22('0x1f')]=qs['limit'](_0x1e86ad[_0x8a22('0x35')][_0x8a22('0x1f')]);_0x261adf['offset']=qs[_0x8a22('0x1e')](_0x1e86ad['query'][_0x8a22('0x1e')]);}return _0xfd9e27['getAgents'](_0x261adf);}})['then'](function(_0x4e04d4){if(_0x4e04d4){return _0x4e04d4?{'count':_0x27fbdd,'rows':_0x4e04d4}:null;}})[_0x8a22('0x24')](respondWithResult(_0x4c35c1,null))[_0x8a22('0x47')](handleError(_0x4c35c1,null));};exports[_0x8a22('0x90')]=function(_0x48835a,_0x2bff62,_0x58ea9d){var _0xca25f0={};var _0x1eed9c={};var _0x3dc122;var _0x38299f;return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x48835a['params']['id']}})['then'](handleEntityNotFound(_0x2bff62,null))[_0x8a22('0x24')](function(_0x23ee58){if(_0x23ee58){_0x3dc122=_0x23ee58;_0x1eed9c[_0x8a22('0x34')]=_[_0x8a22('0x36')](db['UserVoiceQueueRt'][_0x8a22('0x33')]);_0x1eed9c[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x48835a[_0x8a22('0x35')]);_0x1eed9c['filters']=_['intersection'](_0x1eed9c['model'],_0x1eed9c['query']);_0xca25f0['attributes']=_[_0x8a22('0x38')](_0x1eed9c['model'],qs[_0x8a22('0x3a')](_0x48835a[_0x8a22('0x35')]['fields']));_0xca25f0[_0x8a22('0x39')]=_0xca25f0[_0x8a22('0x39')][_0x8a22('0x3b')]?_0xca25f0[_0x8a22('0x39')]:_0x1eed9c[_0x8a22('0x34')];_0xca25f0[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x48835a['query']['sort']);_0xca25f0['where']=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x48835a[_0x8a22('0x35')],_0x1eed9c['filters']));if(_0x48835a[_0x8a22('0x35')][_0x8a22('0x29')]){_0xca25f0[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0xca25f0[_0x8a22('0x40')],{'$or':_['map'](_0xca25f0[_0x8a22('0x39')],function(_0x4e6dde){var _0x310ec4={};_0x310ec4[_0x4e6dde]={'$like':'%'+_0x48835a[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x310ec4;})});}_0xca25f0=_[_0x8a22('0x43')]({},_0xca25f0,_0x48835a[_0x8a22('0x44')]);return _0x3dc122['getMembers'](_0xca25f0);}})[_0x8a22('0x24')](function(_0x32f274){if(_0x32f274){_0x38299f=_0x32f274[_0x8a22('0x3b')];if(!_0x48835a[_0x8a22('0x35')][_0x8a22('0x3c')](_0x8a22('0x3d'))){_0xca25f0[_0x8a22('0x1f')]=qs[_0x8a22('0x1f')](_0x48835a[_0x8a22('0x35')][_0x8a22('0x1f')]);_0xca25f0[_0x8a22('0x1e')]=qs['offset'](_0x48835a['query'][_0x8a22('0x1e')]);}return _0x3dc122[_0x8a22('0x90')](_0xca25f0);}})[_0x8a22('0x24')](function(_0x1e64a0){return _0x1e64a0?{'count':_0x38299f,'rows':_0x1e64a0}:null;})['then'](respondWithResult(_0x2bff62,null))['catch'](handleError(_0x2bff62,null));};exports[_0x8a22('0x91')]=function(_0x220036,_0x60c69f,_0x25167d){var _0x373806={};var _0x1b9666={};var _0x44fdf7;var _0x3bda41;return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x220036['params']['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x60c69f,null))[_0x8a22('0x24')](function(_0x5e2d38){if(_0x5e2d38){_0x44fdf7=_0x5e2d38;_0x1b9666['model']=_[_0x8a22('0x36')](db[_0x8a22('0x92')][_0x8a22('0x33')]);_0x1b9666[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x220036['query']);_0x1b9666[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x1b9666[_0x8a22('0x34')],_0x1b9666[_0x8a22('0x35')]);_0x373806[_0x8a22('0x39')]=_[_0x8a22('0x38')](_0x1b9666[_0x8a22('0x34')],qs[_0x8a22('0x3a')](_0x220036[_0x8a22('0x35')][_0x8a22('0x3a')]));_0x373806[_0x8a22('0x39')]=_0x373806[_0x8a22('0x39')]['length']?_0x373806[_0x8a22('0x39')]:_0x1b9666[_0x8a22('0x34')];_0x373806[_0x8a22('0x3e')]=qs[_0x8a22('0x3f')](_0x220036[_0x8a22('0x35')][_0x8a22('0x3f')]);_0x373806[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x220036['query'],_0x1b9666[_0x8a22('0x37')]));if(_0x220036['query'][_0x8a22('0x29')]){_0x373806[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0x373806['where'],{'$or':_['map'](_0x373806[_0x8a22('0x39')],function(_0x447957){var _0x35146a={};_0x35146a[_0x447957]={'$like':'%'+_0x220036['query']['filter']+'%'};return _0x35146a;})});}_0x373806=_['merge']({},_0x373806,_0x220036[_0x8a22('0x44')]);return _0x44fdf7[_0x8a22('0x91')](_0x373806);}})[_0x8a22('0x24')](function(_0x120f1b){if(_0x120f1b){_0x3bda41=_0x120f1b['length'];if(!_0x220036[_0x8a22('0x35')][_0x8a22('0x3c')]('nolimit')){_0x373806[_0x8a22('0x1f')]=qs[_0x8a22('0x1f')](_0x220036['query'][_0x8a22('0x1f')]);_0x373806[_0x8a22('0x1e')]=qs[_0x8a22('0x1e')](_0x220036[_0x8a22('0x35')]['offset']);}return _0x44fdf7[_0x8a22('0x91')](_0x373806);}})[_0x8a22('0x24')](function(_0x583230){if(_0x583230){return _0x583230?{'count':_0x3bda41,'rows':_0x583230}:null;}})[_0x8a22('0x24')](respondWithResult(_0x60c69f,null))[_0x8a22('0x47')](handleError(_0x60c69f,null));};exports['addLists']=function(_0x51a08e,_0x4c9479,_0x5bdac9){var _0x5185a1,_0x27b8d6;return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x51a08e[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x4c9479,null))[_0x8a22('0x24')](function(_0x151c8d){if(_0x151c8d){_0x27b8d6=_0x151c8d;return _0x151c8d[_0x8a22('0x93')](_0x51a08e[_0x8a22('0x4b')][_0x8a22('0x7a')],_[_0x8a22('0x55')](_0x51a08e[_0x8a22('0x4b')],['ids','id'])||{});}return null;})[_0x8a22('0x8a')](function(_0x26432c){var _0x3907d4;_0x5185a1=_0x26432c||[];var _0x161221=[];if(_0x26432c){for(var _0x3305a7=0x0;_0x3305a7<_0x26432c[_0x8a22('0x3b')];_0x3305a7+=0x1){var _0x5a475c=_0x26432c[_0x3305a7]['get']({'plain':!![]});_0x27b8d6[_0x8a22('0x94')]=_0x51a08e['body'][_0x8a22('0x94')]?_0x51a08e[_0x8a22('0x4b')][_0x8a22('0x94')]:_0x27b8d6[_0x8a22('0x94')];switch(_0x27b8d6[_0x8a22('0x94')]){case _0x8a22('0x95'):_0x3907d4=squel[_0x8a22('0x96')]()['into']('cm_hopper')[_0x8a22('0x97')](['phone','scheduledAt','ContactId',_0x8a22('0x98'),_0x8a22('0x5d'),_0x8a22('0x56'),_0x8a22('0x57')],squel[_0x8a22('0x99')]()['field'](_0x8a22('0x9a'),_0x8a22('0x9a'))[_0x8a22('0x7b')](_0x8a22('0x9b'),'scheduledAt')[_0x8a22('0x7b')]('id',_0x8a22('0x9c'))['field'](_0x5a475c['CmListId']['toString'](),_0x8a22('0x98'))[_0x8a22('0x7b')](_0x51a08e[_0x8a22('0x5a')]['id'][_0x8a22('0x9d')](),_0x8a22('0x5d'))[_0x8a22('0x7b')]('NOW()',_0x8a22('0x56'))['field'](_0x8a22('0x9b'),'updatedAt')['from'](_0x8a22('0x9e'))[_0x8a22('0x40')](_0x8a22('0x9f'))[_0x8a22('0x40')]('ListId\x20=\x20?',_0x5a475c[_0x8a22('0xa0')][_0x8a22('0x9d')]())[_0x8a22('0x40')](_0x8a22('0xa1'))[_0x8a22('0x40')](_0x8a22('0xa2'),squel[_0x8a22('0x99')]()[_0x8a22('0x7b')](_0x8a22('0xa3'))['from'](_0x8a22('0xa4'))['where'](_0x8a22('0xa5'),_0x51a08e[_0x8a22('0x5a')]['id'][_0x8a22('0x9d')]()))['where'](_0x8a22('0xa2'),squel[_0x8a22('0x99')]()['field'](_0x8a22('0xa6'))[_0x8a22('0xa7')](_0x8a22('0xa8'))['where'](_0x8a22('0xa5'),_0x51a08e[_0x8a22('0x5a')]['id']['toString']())))[_0x8a22('0x9d')]();break;case _0x8a22('0xa9'):_0x3907d4=squel[_0x8a22('0x96')]()[_0x8a22('0xaa')](_0x8a22('0xa8'))[_0x8a22('0x97')]([_0x8a22('0x9a'),_0x8a22('0xab'),'ContactId',_0x8a22('0x98'),_0x8a22('0x5d'),_0x8a22('0x56'),_0x8a22('0x57')],squel[_0x8a22('0x99')]()[_0x8a22('0x7b')](_0x8a22('0x9a'),_0x8a22('0x9a'))['field'](_0x8a22('0x9b'),_0x8a22('0xab'))[_0x8a22('0x7b')]('id','ContactId')[_0x8a22('0x7b')](_0x5a475c['CmListId'][_0x8a22('0x9d')](),_0x8a22('0x98'))['field'](_0x51a08e[_0x8a22('0x5a')]['id'][_0x8a22('0x9d')](),'VoiceQueueId')['field'](_0x8a22('0x9b'),_0x8a22('0x56'))[_0x8a22('0x7b')](_0x8a22('0x9b'),_0x8a22('0x57'))['from'](_0x8a22('0x9e'))[_0x8a22('0x40')](_0x8a22('0x9f'))['where'](_0x8a22('0xac'),_0x5a475c[_0x8a22('0xa0')][_0x8a22('0x9d')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x8a22('0xa2'),squel['select']()[_0x8a22('0x7b')](_0x8a22('0xa6'))[_0x8a22('0xa7')](_0x8a22('0xa8'))[_0x8a22('0x40')](_0x8a22('0xa5'),_0x51a08e[_0x8a22('0x5a')]['id']['toString']())))[_0x8a22('0x9d')]();break;default:_0x3907d4=squel[_0x8a22('0x96')]()[_0x8a22('0xaa')](_0x8a22('0xa8'))[_0x8a22('0x97')]([_0x8a22('0x9a'),_0x8a22('0xab'),_0x8a22('0x9c'),'ListId',_0x8a22('0x5d'),_0x8a22('0x56'),_0x8a22('0x57')],squel['select']()[_0x8a22('0x7b')]('phone',_0x8a22('0x9a'))[_0x8a22('0x7b')](_0x8a22('0x9b'),_0x8a22('0xab'))[_0x8a22('0x7b')]('id',_0x8a22('0x9c'))[_0x8a22('0x7b')](_0x5a475c['CmListId']['toString'](),_0x8a22('0x98'))['field'](_0x51a08e[_0x8a22('0x5a')]['id'][_0x8a22('0x9d')](),_0x8a22('0x5d'))[_0x8a22('0x7b')](_0x8a22('0x9b'),_0x8a22('0x56'))[_0x8a22('0x7b')](_0x8a22('0x9b'),'updatedAt')[_0x8a22('0xa7')]('cm_contacts')['where'](_0x8a22('0x9f'))['where']('ListId\x20=\x20?',_0x5a475c[_0x8a22('0xa0')][_0x8a22('0x9d')]())['where'](_0x8a22('0xa1')))['toString']();}_0x161221[_0x8a22('0x8c')](db[_0x8a22('0x81')]['query'](_0x3907d4));}return BPromise['all'](_0x161221);}})[_0x8a22('0x24')](function(){return _0x5185a1;})[_0x8a22('0x24')](respondWithResult(_0x4c9479,null))[_0x8a22('0x47')](handleError(_0x4c9479,null));};exports[_0x8a22('0xad')]=function(_0x1a058e,_0x20c130,_0x1da734){return db[_0x8a22('0x32')][_0x8a22('0x2d')]({'where':{'id':_0x1a058e[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x20c130,null))['then'](function(_0xe2e08b){if(_0xe2e08b){return _0xe2e08b[_0x8a22('0xad')](_0x1a058e[_0x8a22('0x35')][_0x8a22('0x7a')]);}})[_0x8a22('0x24')](function(_0x212f03){if(_0x212f03){return db['CmHopper'][_0x8a22('0x25')]({'where':{'ListId':_0x1a058e[_0x8a22('0x35')][_0x8a22('0x7a')],'VoiceQueueId':_0x1a058e['params']['id']}})[_0x8a22('0x24')](function(){return _0x212f03;});}})[_0x8a22('0x24')](respondWithStatusCode(_0x20c130,null))['catch'](handleError(_0x20c130,null));};exports['getBlackLists']=function(_0x1f308b,_0x50d3ab,_0x4c48ea){var _0xa4a4ea={};var _0x560a68={};var _0xeb1798;var _0xd6cb31;return db[_0x8a22('0x32')][_0x8a22('0x5c')]({'where':{'id':_0x1f308b['params']['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x50d3ab,null))[_0x8a22('0x24')](function(_0xece6a6){if(_0xece6a6){_0xeb1798=_0xece6a6;_0x560a68['model']=_[_0x8a22('0x36')](db[_0x8a22('0x92')][_0x8a22('0x33')]);_0x560a68[_0x8a22('0x35')]=_[_0x8a22('0x36')](_0x1f308b[_0x8a22('0x35')]);_0x560a68[_0x8a22('0x37')]=_[_0x8a22('0x38')](_0x560a68[_0x8a22('0x34')],_0x560a68['query']);_0xa4a4ea[_0x8a22('0x39')]=_[_0x8a22('0x38')](_0x560a68['model'],qs[_0x8a22('0x3a')](_0x1f308b[_0x8a22('0x35')][_0x8a22('0x3a')]));_0xa4a4ea[_0x8a22('0x39')]=_0xa4a4ea['attributes'][_0x8a22('0x3b')]?_0xa4a4ea[_0x8a22('0x39')]:_0x560a68['model'];_0xa4a4ea[_0x8a22('0x3e')]=qs['sort'](_0x1f308b[_0x8a22('0x35')][_0x8a22('0x3f')]);_0xa4a4ea[_0x8a22('0x40')]=qs[_0x8a22('0x37')](_[_0x8a22('0x41')](_0x1f308b[_0x8a22('0x35')],_0x560a68['filters']));if(_0x1f308b[_0x8a22('0x35')][_0x8a22('0x29')]){_0xa4a4ea[_0x8a22('0x40')]=_[_0x8a22('0x43')](_0xa4a4ea[_0x8a22('0x40')],{'$or':_[_0x8a22('0x2a')](_0xa4a4ea[_0x8a22('0x39')],function(_0x42e2f6){var _0x2b1eb4={};_0x2b1eb4[_0x42e2f6]={'$like':'%'+_0x1f308b[_0x8a22('0x35')][_0x8a22('0x29')]+'%'};return _0x2b1eb4;})});}_0xa4a4ea=_[_0x8a22('0x43')]({},_0xa4a4ea,_0x1f308b[_0x8a22('0x44')]);return _0xeb1798[_0x8a22('0xae')](_0xa4a4ea);}})[_0x8a22('0x24')](function(_0x36b3ad){if(_0x36b3ad){_0xd6cb31=_0x36b3ad[_0x8a22('0x3b')];if(!_0x1f308b[_0x8a22('0x35')][_0x8a22('0x3c')](_0x8a22('0x3d'))){_0xa4a4ea[_0x8a22('0x1f')]=qs['limit'](_0x1f308b[_0x8a22('0x35')][_0x8a22('0x1f')]);_0xa4a4ea['offset']=qs[_0x8a22('0x1e')](_0x1f308b[_0x8a22('0x35')][_0x8a22('0x1e')]);}return _0xeb1798[_0x8a22('0xae')](_0xa4a4ea);}})[_0x8a22('0x24')](function(_0x31fd77){if(_0x31fd77){return _0x31fd77?{'count':_0xd6cb31,'rows':_0x31fd77}:null;}})[_0x8a22('0x24')](respondWithResult(_0x50d3ab,null))[_0x8a22('0x47')](handleError(_0x50d3ab,null));};exports['addBlackLists']=function(_0x356b99,_0x39ea86,_0x41b28d){var _0x5cb95b,_0x792e2c;return db[_0x8a22('0x32')]['find']({'where':{'id':_0x356b99[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](handleEntityNotFound(_0x39ea86,null))[_0x8a22('0x24')](function(_0x24614e){if(_0x24614e){_0x792e2c=_0x24614e;return _0x24614e[_0x8a22('0xaf')](_0x356b99['body'][_0x8a22('0x7a')],_['omit'](_0x356b99[_0x8a22('0x4b')],['ids','id'])||{});}return null;})[_0x8a22('0x8a')](function(_0x235d82){var _0x41d710;_0x5cb95b=_0x235d82||[];var _0x350bd9=[];if(_0x235d82){for(var _0x383d8b=0x0;_0x383d8b<_0x235d82['length'];_0x383d8b+=0x1){var _0x3850a7=_0x235d82[_0x383d8b]['get']({'plain':!![]});_0x41d710=squel[_0x8a22('0x96')]()[_0x8a22('0xaa')](_0x8a22('0xb0'))[_0x8a22('0x97')](['phone',_0x8a22('0x9c'),_0x8a22('0x98'),_0x8a22('0x5d'),'createdAt','updatedAt'],squel[_0x8a22('0x99')]()[_0x8a22('0x7b')](_0x8a22('0x9a'),_0x8a22('0x9a'))[_0x8a22('0x7b')]('id',_0x8a22('0x9c'))[_0x8a22('0x7b')](_0x3850a7[_0x8a22('0xa0')][_0x8a22('0x9d')](),'ListId')[_0x8a22('0x7b')](_0x356b99[_0x8a22('0x5a')]['id']['toString'](),'VoiceQueueId')['field'](_0x8a22('0x9b'),_0x8a22('0x56'))[_0x8a22('0x7b')](_0x8a22('0x9b'),_0x8a22('0x57'))['from'](_0x8a22('0x9e'))['where'](_0x8a22('0x9f'))['where'](_0x8a22('0xac'),_0x3850a7[_0x8a22('0xa0')][_0x8a22('0x9d')]())['where'](_0x8a22('0xa1')))[_0x8a22('0x9d')]();_0x350bd9[_0x8a22('0x8c')](db[_0x8a22('0x81')][_0x8a22('0x35')](_0x41d710));}return BPromise[_0x8a22('0x83')](_0x350bd9);}})['then'](function(){return _0x5cb95b;})[_0x8a22('0x24')](respondWithResult(_0x39ea86,null))[_0x8a22('0x47')](handleError(_0x39ea86,null));};exports['removeBlackLists']=function(_0x51509d,_0x29eaf9,_0x129bfc){return db[_0x8a22('0x32')]['find']({'where':{'id':_0x51509d[_0x8a22('0x5a')]['id']}})['then'](handleEntityNotFound(_0x29eaf9,null))['then'](function(_0x579afe){if(_0x579afe){return _0x579afe[_0x8a22('0xb1')](_0x51509d[_0x8a22('0x35')]['ids']);}})[_0x8a22('0x24')](function(_0x1f606f){if(_0x1f606f){return db[_0x8a22('0x65')]['destroy']({'where':{'ListId':_0x51509d[_0x8a22('0x35')]['ids'],'VoiceQueueId':_0x51509d[_0x8a22('0x5a')]['id']}})[_0x8a22('0x24')](function(){return _0x1f606f;});}})[_0x8a22('0x24')](respondWithStatusCode(_0x29eaf9,null))[_0x8a22('0x47')](handleError(_0x29eaf9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 91ad0d8..603f63c 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 _0x128e=['exports','../../mysqldb','VoiceQueue','emit','hook'];(function(_0x183d59,_0x41fa78){var _0x3b67a9=function(_0x28010c){while(--_0x28010c){_0x183d59['push'](_0x183d59['shift']());}};_0x3b67a9(++_0x41fa78);}(_0x128e,0x1a5));var _0xe128=function(_0x347835,_0x32ddb6){_0x347835=_0x347835-0x0;var _0x1eef8e=_0x128e[_0x347835];return _0x1eef8e;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe128('0x0'))['db'][_0xe128('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3616cf){return function(_0xa274ba,_0x4b7294,_0x39b393){VoiceQueueEvents[_0xe128('0x2')](_0x3616cf+':'+_0xa274ba['id'],_0xa274ba);VoiceQueueEvents[_0xe128('0x2')](_0x3616cf,_0xa274ba);_0x39b393(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe128('0x3')](e,emitEvent(event));}}module[_0xe128('0x4')]=VoiceQueueEvents; \ No newline at end of file +var _0x29f2=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x29f2,0x1dc));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x229f('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x229f('0x1')](0x0);var events={'afterCreate':_0x229f('0x2'),'afterUpdate':'update','afterDestroy':_0x229f('0x3')};function emitEvent(_0x3ccc6c){return function(_0x31a261,_0xc43f81,_0x172ea4){VoiceQueueEvents[_0x229f('0x4')](_0x3ccc6c+':'+_0x31a261['id'],_0x31a261);VoiceQueueEvents[_0x229f('0x4')](_0x3ccc6c,_0x31a261);_0x172ea4(null);};}for(var e in events){if(events[_0x229f('0x5')](e)){var event=events[e];VoiceQueue[_0x229f('0x6')](e,emitEvent(event));}}module[_0x229f('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a1805ec..1e9c7eb 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 _0xb38a=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util'];(function(_0x42a5b4,_0x11ab28){var _0x19b9f9=function(_0x297242){while(--_0x297242){_0x42a5b4['push'](_0x42a5b4['shift']());}};_0x19b9f9(++_0x11ab28);}(_0xb38a,0x1ba));var _0xab38=function(_0x322d9d,_0x5f2291){_0x322d9d=_0x322d9d-0x0;var _0x123bef=_0xb38a[_0x322d9d];return _0x123bef;};'use strict';var _=require(_0xab38('0x0'));var util=require(_0xab38('0x1'));var logger=require(_0xab38('0x2'))(_0xab38('0x3'));var moment=require(_0xab38('0x4'));var BPromise=require(_0xab38('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab38('0x6'));var config=require(_0xab38('0x7'));var attributes=require(_0xab38('0x8'));module[_0xab38('0x9')]=function(_0x4bfd0a,_0x269b8c){return _0x4bfd0a[_0xab38('0xa')](_0xab38('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf3=['../../config/environment','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x24d6d7,_0x33727e){var _0x5767a2=function(_0x534a47){while(--_0x534a47){_0x24d6d7['push'](_0x24d6d7['shift']());}};_0x5767a2(++_0x33727e);}(_0xfaf3,0x13d));var _0x3faf=function(_0x333550,_0xb1633b){_0x333550=_0x333550-0x0;var _0x211b53=_0xfaf3[_0x333550];return _0x211b53;};'use strict';var _=require(_0x3faf('0x0'));var util=require(_0x3faf('0x1'));var logger=require(_0x3faf('0x2'))(_0x3faf('0x3'));var moment=require(_0x3faf('0x4'));var BPromise=require(_0x3faf('0x5'));var rp=require(_0x3faf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3faf('0x7'));var config=require(_0x3faf('0x8'));var attributes=require('./voiceQueue.attributes');module[_0x3faf('0x9')]=function(_0x261109,_0x475516){return _0x261109[_0x3faf('0xa')](_0x3faf('0xb'),attributes,{'tableName':_0x3faf('0xc'),'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 1edb60d..e59930b 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 _0x83ba=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d8d01,_0x2977a5){var _0x30e7ce=function(_0x28e666){while(--_0x28e666){_0x5d8d01['push'](_0x5d8d01['shift']());}};_0x30e7ce(++_0x2977a5);}(_0x83ba,0x189));var _0xa83b=function(_0x345cf3,_0x1114ca){_0x345cf3=_0x345cf3-0x0;var _0x1364e3=_0x83ba[_0x345cf3];return _0x1364e3;};'use strict';var _=require('lodash');var util=require(_0xa83b('0x0'));var moment=require(_0xa83b('0x1'));var BPromise=require(_0xa83b('0x2'));var rs=require(_0xa83b('0x3'));var fs=require('fs');var Redis=require(_0xa83b('0x4'));var db=require(_0xa83b('0x5'))['db'];var utils=require(_0xa83b('0x6'));var logger=require(_0xa83b('0x7'))('rpc');var config=require(_0xa83b('0x8'));var jayson=require(_0xa83b('0x9'));var client=jayson[_0xa83b('0xa')][_0xa83b('0xb')]({'port':0x232a});config[_0xa83b('0xc')]=_['defaults'](config['redis'],{'host':_0xa83b('0xd'),'port':0x18eb});var socket=require(_0xa83b('0xe'))(new Redis(config[_0xa83b('0xc')]));require(_0xa83b('0xf'))[_0xa83b('0x10')](socket);function respondWithRpcPromise(_0xb14c5,_0x20d963,_0x3bb43d){return new BPromise(function(_0x5df0d7,_0x18c871){return client['request'](_0xb14c5,_0x3bb43d)[_0xa83b('0x11')](function(_0x5ae205){logger['info'](_0xa83b('0x12'),_0x20d963,_0xa83b('0x13'));logger['debug'](_0xa83b('0x14'),_0x20d963,'request\x20sent',JSON[_0xa83b('0x15')](_0x5ae205));if(_0x5ae205['error']){if(_0x5ae205[_0xa83b('0x16')][_0xa83b('0x17')]===0x1f4){logger[_0xa83b('0x16')](_0xa83b('0x12'),_0x20d963,_0x5ae205[_0xa83b('0x16')][_0xa83b('0x18')]);return _0x18c871(_0x5ae205[_0xa83b('0x16')][_0xa83b('0x18')]);}logger['error'](_0xa83b('0x12'),_0x20d963,_0x5ae205[_0xa83b('0x16')][_0xa83b('0x18')]);return _0x5df0d7(_0x5ae205['error'][_0xa83b('0x18')]);}else{logger[_0xa83b('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x20d963,'request\x20sent');_0x5df0d7(_0x5ae205[_0xa83b('0x1a')][_0xa83b('0x18')]);}})[_0xa83b('0x1b')](function(_0x1334b8){logger[_0xa83b('0x16')](_0xa83b('0x12'),_0x20d963,_0x1334b8);_0x18c871(_0x1334b8);});});}exports[_0xa83b('0x1c')]=function(_0x9ef92d){var _0x3241b8=this;return new Promise(function(_0x1a927c,_0x53d6c2){return db['VoiceQueue']['findAll']({'raw':_0x9ef92d[_0xa83b('0x1d')]?_0x9ef92d[_0xa83b('0x1d')][_0xa83b('0x1e')]===undefined?!![]:![]:!![],'where':_0x9ef92d[_0xa83b('0x1d')]?_0x9ef92d[_0xa83b('0x1d')][_0xa83b('0x1f')]||null:null,'attributes':_0x9ef92d['options']?_0x9ef92d[_0xa83b('0x1d')][_0xa83b('0x20')]||null:null,'limit':_0x9ef92d[_0xa83b('0x1d')]?_0x9ef92d[_0xa83b('0x1d')][_0xa83b('0x21')]||null:null,'include':_0x9ef92d[_0xa83b('0x1d')]?_0x9ef92d[_0xa83b('0x1d')]['include']?_['map'](_0x9ef92d['options'][_0xa83b('0x22')],function(_0x528df4){return{'model':db[_0x528df4['model']],'as':_0x528df4['as'],'attributes':_0x528df4[_0xa83b('0x20')],'include':_0x528df4[_0xa83b('0x22')]?_[_0xa83b('0x23')](_0x528df4[_0xa83b('0x22')],function(_0x3e835e){return{'model':db[_0x3e835e[_0xa83b('0x24')]],'as':_0x3e835e['as'],'attributes':_0x3e835e[_0xa83b('0x20')],'include':_0x3e835e[_0xa83b('0x22')]?_['map'](_0x3e835e['include'],function(_0x5216f8){return{'model':db[_0x5216f8[_0xa83b('0x24')]],'as':_0x5216f8['as'],'attributes':_0x5216f8[_0xa83b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83b('0x11')](function(_0xe62eec){logger[_0xa83b('0x19')](_0xa83b('0x1c'),_0x9ef92d);logger[_0xa83b('0x25')](_0xa83b('0x1c'),_0x9ef92d,JSON[_0xa83b('0x15')](_0xe62eec));_0x1a927c(_0xe62eec);})['catch'](function(_0x5b7272){logger[_0xa83b('0x16')]('GetVoiceQueue',_0x5b7272['message'],_0x9ef92d);_0x53d6c2(_0x3241b8['error'](0x1f4,_0x5b7272[_0xa83b('0x18')]));});});};exports[_0xa83b('0x26')]=function(_0x21f713){var _0x5092fe=this;return new Promise(function(_0x403de1,_0x3cf17d){return db['VoiceQueue'][_0xa83b('0x27')]({'raw':_0x21f713[_0xa83b('0x1d')]?_0x21f713[_0xa83b('0x1d')][_0xa83b('0x1e')]===undefined?!![]:![]:!![],'where':_0x21f713[_0xa83b('0x1d')]?_0x21f713[_0xa83b('0x1d')][_0xa83b('0x1f')]||null:null,'attributes':_0x21f713[_0xa83b('0x1d')]?_0x21f713[_0xa83b('0x1d')][_0xa83b('0x20')]||null:null,'include':_0x21f713[_0xa83b('0x1d')]?_0x21f713[_0xa83b('0x1d')]['include']?_[_0xa83b('0x23')](_0x21f713[_0xa83b('0x1d')][_0xa83b('0x22')],function(_0x108d6a){return{'model':db[_0x108d6a[_0xa83b('0x24')]],'as':_0x108d6a['as'],'attributes':_0x108d6a[_0xa83b('0x20')],'include':_0x108d6a[_0xa83b('0x22')]?_[_0xa83b('0x23')](_0x108d6a['include'],function(_0x4eb0d9){return{'model':db[_0x4eb0d9[_0xa83b('0x24')]],'as':_0x4eb0d9['as'],'attributes':_0x4eb0d9[_0xa83b('0x20')],'include':_0x4eb0d9[_0xa83b('0x22')]?_[_0xa83b('0x23')](_0x4eb0d9[_0xa83b('0x22')],function(_0x4afc05){return{'model':db[_0x4afc05[_0xa83b('0x24')]],'as':_0x4afc05['as'],'attributes':_0x4afc05[_0xa83b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83b('0x11')](function(_0x40b8d0){logger[_0xa83b('0x19')](_0xa83b('0x26'),_0x21f713);logger['debug'](_0xa83b('0x26'),_0x21f713,JSON['stringify'](_0x40b8d0));_0x403de1(_0x40b8d0);})[_0xa83b('0x1b')](function(_0x967b22){logger['error'](_0xa83b('0x26'),_0x967b22[_0xa83b('0x18')],_0x21f713);_0x3cf17d(_0x5092fe[_0xa83b('0x16')](0x1f4,_0x967b22[_0xa83b('0x18')]));});});}; \ No newline at end of file +var _0x36b1=['redis','defaults','localhost','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','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36b1,0x97));var _0x136b=function(_0x571e15,_0xef1609){_0x571e15=_0x571e15-0x0;var _0x4fd857=_0x36b1[_0x571e15];return _0x4fd857;};'use strict';var _=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var moment=require(_0x136b('0x2'));var BPromise=require(_0x136b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x136b('0x4'));var db=require(_0x136b('0x5'))['db'];var utils=require(_0x136b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x136b('0x7')][_0x136b('0x8')]({'port':0x232a});config[_0x136b('0x9')]=_[_0x136b('0xa')](config[_0x136b('0x9')],{'host':_0x136b('0xb'),'port':0x18eb});var socket=require(_0x136b('0xc'))(new Redis(config[_0x136b('0x9')]));require(_0x136b('0xd'))[_0x136b('0xe')](socket);function respondWithRpcPromise(_0x4af67b,_0x3d8333,_0x18029c){return new BPromise(function(_0x1cbc6d,_0x3463f4){return client[_0x136b('0xf')](_0x4af67b,_0x18029c)[_0x136b('0x10')](function(_0x495098){logger['info'](_0x136b('0x11'),_0x3d8333,_0x136b('0x12'));logger[_0x136b('0x13')](_0x136b('0x14'),_0x3d8333,_0x136b('0x12'),JSON[_0x136b('0x15')](_0x495098));if(_0x495098[_0x136b('0x16')]){if(_0x495098[_0x136b('0x16')][_0x136b('0x17')]===0x1f4){logger[_0x136b('0x16')](_0x136b('0x11'),_0x3d8333,_0x495098[_0x136b('0x16')]['message']);return _0x3463f4(_0x495098[_0x136b('0x16')][_0x136b('0x18')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3d8333,_0x495098[_0x136b('0x16')][_0x136b('0x18')]);return _0x1cbc6d(_0x495098['error'][_0x136b('0x18')]);}else{logger[_0x136b('0x19')](_0x136b('0x11'),_0x3d8333,_0x136b('0x12'));_0x1cbc6d(_0x495098[_0x136b('0x1a')][_0x136b('0x18')]);}})[_0x136b('0x1b')](function(_0xa6b505){logger['error'](_0x136b('0x11'),_0x3d8333,_0xa6b505);_0x3463f4(_0xa6b505);});});}exports[_0x136b('0x1c')]=function(_0x4f7afe){var _0x45c812=this;return new Promise(function(_0x312181,_0x160d14){return db[_0x136b('0x1d')][_0x136b('0x1e')]({'raw':_0x4f7afe['options']?_0x4f7afe['options'][_0x136b('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f7afe[_0x136b('0x20')]?_0x4f7afe[_0x136b('0x20')][_0x136b('0x21')]||null:null,'attributes':_0x4f7afe[_0x136b('0x20')]?_0x4f7afe[_0x136b('0x20')][_0x136b('0x22')]||null:null,'limit':_0x4f7afe['options']?_0x4f7afe[_0x136b('0x20')]['limit']||null:null,'include':_0x4f7afe[_0x136b('0x20')]?_0x4f7afe['options'][_0x136b('0x23')]?_[_0x136b('0x24')](_0x4f7afe['options']['include'],function(_0x5ea3c3){return{'model':db[_0x5ea3c3['model']],'as':_0x5ea3c3['as'],'attributes':_0x5ea3c3[_0x136b('0x22')],'include':_0x5ea3c3[_0x136b('0x23')]?_[_0x136b('0x24')](_0x5ea3c3[_0x136b('0x23')],function(_0x4a01a6){return{'model':db[_0x4a01a6['model']],'as':_0x4a01a6['as'],'attributes':_0x4a01a6['attributes'],'include':_0x4a01a6[_0x136b('0x23')]?_[_0x136b('0x24')](_0x4a01a6[_0x136b('0x23')],function(_0x943588){return{'model':db[_0x943588[_0x136b('0x25')]],'as':_0x943588['as'],'attributes':_0x943588[_0x136b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe6107){logger['info'](_0x136b('0x1c'),_0x4f7afe);logger[_0x136b('0x13')](_0x136b('0x1c'),_0x4f7afe,JSON[_0x136b('0x15')](_0xfe6107));_0x312181(_0xfe6107);})[_0x136b('0x1b')](function(_0x4e2de8){logger['error'](_0x136b('0x1c'),_0x4e2de8[_0x136b('0x18')],_0x4f7afe);_0x160d14(_0x45c812[_0x136b('0x16')](0x1f4,_0x4e2de8['message']));});});};exports[_0x136b('0x26')]=function(_0x51c192){var _0x2d4c80=this;return new Promise(function(_0x57dec5,_0x1d47d2){return db[_0x136b('0x1d')][_0x136b('0x27')]({'raw':_0x51c192[_0x136b('0x20')]?_0x51c192[_0x136b('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x51c192[_0x136b('0x20')]?_0x51c192['options'][_0x136b('0x21')]||null:null,'attributes':_0x51c192[_0x136b('0x20')]?_0x51c192[_0x136b('0x20')][_0x136b('0x22')]||null:null,'include':_0x51c192[_0x136b('0x20')]?_0x51c192[_0x136b('0x20')][_0x136b('0x23')]?_[_0x136b('0x24')](_0x51c192[_0x136b('0x20')]['include'],function(_0x3755d0){return{'model':db[_0x3755d0[_0x136b('0x25')]],'as':_0x3755d0['as'],'attributes':_0x3755d0['attributes'],'include':_0x3755d0[_0x136b('0x23')]?_[_0x136b('0x24')](_0x3755d0[_0x136b('0x23')],function(_0x31afeb){return{'model':db[_0x31afeb['model']],'as':_0x31afeb['as'],'attributes':_0x31afeb[_0x136b('0x22')],'include':_0x31afeb[_0x136b('0x23')]?_[_0x136b('0x24')](_0x31afeb['include'],function(_0x51ed7b){return{'model':db[_0x51ed7b['model']],'as':_0x51ed7b['as'],'attributes':_0x51ed7b[_0x136b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c232f){logger[_0x136b('0x19')](_0x136b('0x26'),_0x51c192);logger[_0x136b('0x13')]('ShowVoiceQueue',_0x51c192,JSON[_0x136b('0x15')](_0x3c232f));_0x57dec5(_0x3c232f);})[_0x136b('0x1b')](function(_0x31fe46){logger['error']('ShowVoiceQueue',_0x31fe46[_0x136b('0x18')],_0x51c192);_0x1d47d2(_0x2d4c80[_0x136b('0x16')](0x1f4,_0x31fe46['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c03331e..2c73fce 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 _0x0de3=['removeListener','register','voiceQueue:','./voiceQueue.events','save','update','emit'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0x0de3,0x184));var _0x30de=function(_0x817684,_0x4b4df7){_0x817684=_0x817684-0x0;var _0x529af1=_0x0de3[_0x817684];return _0x529af1;};'use strict';var VoiceQueueEvents=require(_0x30de('0x0'));var events=[_0x30de('0x1'),'remove',_0x30de('0x2')];function createListener(_0x8f875c,_0x2b15a6){return function(_0x1675fc){_0x2b15a6[_0x30de('0x3')](_0x8f875c,_0x1675fc);};}function removeListener(_0x2ff3b7,_0x3213f7){return function(){VoiceQueueEvents[_0x30de('0x4')](_0x2ff3b7,_0x3213f7);};}exports[_0x30de('0x5')]=function(_0x512874){for(var _0x55e5e9=0x0,_0x281b9c=events['length'];_0x55e5e9<_0x281b9c;_0x55e5e9++){var _0x508d29=events[_0x55e5e9];var _0x4c7de3=createListener(_0x30de('0x6')+_0x508d29,_0x512874);VoiceQueueEvents['on'](_0x508d29,_0x4c7de3);}}; \ No newline at end of file +var _0x7fee=['remove','update','emit','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x108b30,_0x1d8297){var _0xcdf5a0=function(_0x8c629e){while(--_0x8c629e){_0x108b30['push'](_0x108b30['shift']());}};_0xcdf5a0(++_0x1d8297);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7fee[_0x87b0ff];return _0x3bc0b2;};'use strict';var VoiceQueueEvents=require(_0xe7fe('0x0'));var events=[_0xe7fe('0x1'),_0xe7fe('0x2'),_0xe7fe('0x3')];function createListener(_0x3b9731,_0x2d5410){return function(_0x583cad){_0x2d5410[_0xe7fe('0x4')](_0x3b9731,_0x583cad);};}function removeListener(_0x16df96,_0x219bdb){return function(){VoiceQueueEvents['removeListener'](_0x16df96,_0x219bdb);};}exports[_0xe7fe('0x5')]=function(_0x5b6d58){for(var _0x183b0b=0x0,_0xeca7d9=events[_0xe7fe('0x6')];_0x183b0b<_0xeca7d9;_0x183b0b++){var _0x9b55e8=events[_0x183b0b];var _0x1f3366=createListener(_0xe7fe('0x7')+_0x9b55e8,_0x5b6d58);VoiceQueueEvents['on'](_0x9b55e8,_0x1f3366);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index df49b36..5e1c3fd 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 _0xeda8=['post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','show'];(function(_0x2528a9,_0xcc4247){var _0x28ab93=function(_0x48180f){while(--_0x48180f){_0x2528a9['push'](_0x2528a9['shift']());}};_0x28ab93(++_0xcc4247);}(_0xeda8,0x104));var _0x8eda=function(_0x1a144d,_0x404087){_0x1a144d=_0x1a144d-0x0;var _0x686c10=_0xeda8[_0x1a144d];return _0x686c10;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0x9')](_0x8eda('0xe'),auth[_0x8eda('0xa')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/',auth[_0x8eda('0xa')](),controller['create']);router[_0x8eda('0x11')]('/:id',auth[_0x8eda('0xa')](),controller[_0x8eda('0x12')]);router[_0x8eda('0x13')](_0x8eda('0x14'),auth[_0x8eda('0xa')](),controller[_0x8eda('0x15')]);module[_0x8eda('0x16')]=router; \ No newline at end of file +var _0xafc4=['/describe','describe','/index','getVoiceQueuesReport','/:id','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x55f6d7,_0x5bd984){var _0x2153cc=function(_0x11ff8b){while(--_0x11ff8b){_0x55f6d7['push'](_0x55f6d7['shift']());}};_0x2153cc(++_0x5bd984);}(_0xafc4,0x69));var _0x4afc=function(_0x535f93,_0x48e3ab){_0x535f93=_0x535f93-0x0;var _0x4acc76=_0xafc4[_0x535f93];return _0x4acc76;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['get'](_0x4afc('0xb'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xc')]);router[_0x4afc('0x8')](_0x4afc('0xd'),auth[_0x4afc('0x6')](),controller['show']);router['post']('/',auth[_0x4afc('0x6')](),controller['create']);router[_0x4afc('0xe')](_0x4afc('0xd'),auth['isAuthenticated'](),controller[_0x4afc('0xf')]);router[_0x4afc('0x10')](_0x4afc('0xd'),auth[_0x4afc('0x6')](),controller[_0x4afc('0x11')]);module[_0x4afc('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 05e5bb2..984ab6e 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 _0xd3c1=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x283952,_0x442596){var _0x57bb99=function(_0x5cd9b6){while(--_0x5cd9b6){_0x283952['push'](_0x283952['shift']());}};_0x57bb99(++_0x442596);}(_0xd3c1,0x1e5));var _0x1d3c=function(_0x2186f2,_0x429eb5){_0x2186f2=_0x2186f2-0x0;var _0x36d766=_0xd3c1[_0x2186f2];return _0x36d766;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1d3c('0x0'));module[_0x1d3c('0x1')]={'type':{'type':Sequelize[_0x1d3c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1d3c('0x2')]},'queue':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1d3c('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x50edbe){var _0x4de2ca=moment(_0x50edbe);var _0x5ca4dc=moment(this[_0x1d3c('0x4')]('queuecallerjoinAt'))[_0x1d3c('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b7e52=_0x4de2ca[_0x1d3c('0x6')](_0x5ca4dc,_0x1d3c('0x7'));this[_0x1d3c('0x8')](_0x1d3c('0x9'),_0x50edbe);this[_0x1d3c('0x8')](_0x1d3c('0xa'),_0x3b7e52||null);}},'position':{'type':Sequelize[_0x1d3c('0xb')]},'count':{'type':Sequelize[_0x1d3c('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1d3c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1d3c('0x3')]},'queuecallerexit':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1d3c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1d3c('0x2')],'comment':_0x1d3c('0xd')},'originalposition':{'type':Sequelize[_0x1d3c('0xb')]},'channel':{'type':Sequelize[_0x1d3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1d3c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1d3c('0x2')]},'context':{'type':Sequelize[_0x1d3c('0x2')]},'exten':{'type':Sequelize[_0x1d3c('0x2')]},'priority':{'type':Sequelize[_0x1d3c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1d3c('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1d3c('0x2')]},'transfer':{'type':Sequelize[_0x1d3c('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1d3c('0x2')],'comment':_0x1d3c('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x1d3c('0x2')]},'disposition':{'type':Sequelize[_0x1d3c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1d3c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xef7e=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef7e,0x194));var _0xeef7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef7e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xeef7('0x0'));var moment=require('moment');module[_0xeef7('0x1')]={'type':{'type':Sequelize[_0xeef7('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xeef7('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xeef7('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xeef7('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xeef7('0x3')],'set':function(_0x3f8f09){var _0x1a66c0=moment(_0x3f8f09);var _0x124d3e=moment(this[_0xeef7('0x4')](_0xeef7('0x5')))[_0xeef7('0x6')](_0xeef7('0x7'));var _0xc41c2d=_0x1a66c0[_0xeef7('0x8')](_0x124d3e,_0xeef7('0x9'));this[_0xeef7('0xa')](_0xeef7('0xb'),_0x3f8f09);this[_0xeef7('0xa')]('holdtime',_0xc41c2d||null);}},'position':{'type':Sequelize[_0xeef7('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xeef7('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xeef7('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xeef7('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xeef7('0x3')]},'queuecallerexit':{'type':Sequelize[_0xeef7('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xeef7('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xeef7('0xc')]},'channel':{'type':Sequelize[_0xeef7('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeef7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xeef7('0x2')]},'context':{'type':Sequelize[_0xeef7('0x2')]},'exten':{'type':Sequelize[_0xeef7('0x2')]},'priority':{'type':Sequelize[_0xeef7('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xeef7('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeef7('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xeef7('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeef7('0x2')],'comment':_0xeef7('0xe')},'transferexten':{'type':Sequelize[_0xeef7('0x2')]},'transferuniqueid':{'type':Sequelize[_0xeef7('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 52c19ac..c24545a 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x7a54,0x106));var _0x47a5=function(_0x3245eb,_0x2aad06){_0x3245eb=_0x3245eb-0x0;var _0x4d72a5=_0x7a54[_0x3245eb];return _0x4d72a5;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7a54,0x106));var _0x47a5=function(_0x5516d5,_0x35b9e2){_0x5516d5=_0x5516d5-0x0;var _0x2424e5=_0x7a54[_0x5516d5];return _0x2424e5;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 2cf9c6c..5e69333 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 _0x7a49=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7a49,0x111));var _0x97a4=function(_0x204835,_0x573b4c){_0x204835=_0x204835-0x0;var _0x4eb525=_0x7a49[_0x204835];return _0x4eb525;};'use strict';var EventEmitter=require(_0x97a4('0x0'));var VoiceQueueReport=require(_0x97a4('0x1'))['db'][_0x97a4('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x97a4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x97a4('0x4'),'afterDestroy':_0x97a4('0x5')};function emitEvent(_0x1a266d){return function(_0x5062ef,_0x516cb0,_0x5617e5){VoiceQueueReportEvents[_0x97a4('0x6')](_0x1a266d+':'+_0x5062ef['id'],_0x5062ef);VoiceQueueReportEvents[_0x97a4('0x6')](_0x1a266d,_0x5062ef);_0x5617e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x1467=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x2b2ea5,_0x3b2fed){var _0x5b8dae=function(_0x25202b){while(--_0x25202b){_0x2b2ea5['push'](_0x2b2ea5['shift']());}};_0x5b8dae(++_0x3b2fed);}(_0x1467,0x164));var _0x7146=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0x1467[_0x494986];return _0x1c805b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x7146('0x0'))['db'][_0x7146('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7146('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7146('0x3'),'afterDestroy':_0x7146('0x4')};function emitEvent(_0x46d6ff){return function(_0x1b58d3,_0x39f675,_0x5173cb){VoiceQueueReportEvents['emit'](_0x46d6ff+':'+_0x1b58d3['id'],_0x1b58d3);VoiceQueueReportEvents[_0x7146('0x5')](_0x46d6ff,_0x1b58d3);_0x5173cb(null);};}for(var e in events){if(events[_0x7146('0x6')](e)){var event=events[e];VoiceQueueReport[_0x7146('0x7')](e,emitEvent(event));}}module[_0x7146('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 3de465d..9c99c08 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 _0x4117=['moment','bluebird','path','rimraf','../../config/environment','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x4a60b7,_0x56ab9c){var _0x56be7a=function(_0x3bb047){while(--_0x3bb047){_0x4a60b7['push'](_0x4a60b7['shift']());}};_0x56be7a(++_0x56ab9c);}(_0x4117,0x71));var _0x7411=function(_0x370b7b,_0x1abf7a){_0x370b7b=_0x370b7b-0x0;var _0x56c95d=_0x4117[_0x370b7b];return _0x56c95d;};'use strict';var _=require(_0x7411('0x0'));var util=require(_0x7411('0x1'));var logger=require(_0x7411('0x2'))(_0x7411('0x3'));var moment=require(_0x7411('0x4'));var BPromise=require(_0x7411('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7411('0x6'));var rimraf=require(_0x7411('0x7'));var config=require(_0x7411('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x7411('0x9')]=function(_0x420d4b,_0x13d783){return _0x420d4b['define'](_0x7411('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x7411('0xb')]},{'fields':[_0x7411('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd860=['path','rimraf','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','api','moment','request-promise'];(function(_0x3b881a,_0x4b4cd9){var _0x47436d=function(_0x4cc9a0){while(--_0x4cc9a0){_0x3b881a['push'](_0x3b881a['shift']());}};_0x47436d(++_0x4b4cd9);}(_0xd860,0x181));var _0x0d86=function(_0x488baa,_0x4e435e){_0x488baa=_0x488baa-0x0;var _0x3598d8=_0xd860[_0x488baa];return _0x3598d8;};'use strict';var _=require(_0x0d86('0x0'));var util=require(_0x0d86('0x1'));var logger=require('../../config/logger')(_0x0d86('0x2'));var moment=require(_0x0d86('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d86('0x4'));var fs=require('fs');var path=require(_0x0d86('0x5'));var rimraf=require(_0x0d86('0x6'));var config=require(_0x0d86('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x0d86('0x8')]=function(_0xbad19,_0x425877){return _0xbad19[_0x0d86('0x9')](_0x0d86('0xa'),attributes,{'tableName':_0x0d86('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0d86('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e89d51c..9ff307d 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 _0xad03=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','register'];(function(_0x3ee8d1,_0x54afbd){var _0x5e6660=function(_0x3414a5){while(--_0x3414a5){_0x3ee8d1['push'](_0x3ee8d1['shift']());}};_0x5e6660(++_0x54afbd);}(_0xad03,0x11f));var _0x3ad0=function(_0x2c4252,_0x2936ca){_0x2c4252=_0x2c4252-0x0;var _0x3b353a=_0xad03[_0x2c4252];return _0x3b353a;};'use strict';var _=require(_0x3ad0('0x0'));var util=require('util');var moment=require(_0x3ad0('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ad0('0x2'));var fs=require('fs');var Redis=require(_0x3ad0('0x3'));var db=require(_0x3ad0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ad0('0x5'));var config=require(_0x3ad0('0x6'));var jayson=require(_0x3ad0('0x7'));var client=jayson[_0x3ad0('0x8')][_0x3ad0('0x9')]({'port':0x232a});config[_0x3ad0('0xa')]=_[_0x3ad0('0xb')](config[_0x3ad0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ad0('0xc'))[_0x3ad0('0xd')](socket);function respondWithRpcPromise(_0x2ed5de,_0x20b87f,_0x35847f){return new BPromise(function(_0x5d0362,_0x1e9e00){return client[_0x3ad0('0xe')](_0x2ed5de,_0x35847f)[_0x3ad0('0xf')](function(_0x557fe1){logger[_0x3ad0('0x10')](_0x3ad0('0x11'),_0x20b87f,'request\x20sent');logger['debug'](_0x3ad0('0x12'),_0x20b87f,_0x3ad0('0x13'),JSON[_0x3ad0('0x14')](_0x557fe1));if(_0x557fe1['error']){if(_0x557fe1[_0x3ad0('0x15')][_0x3ad0('0x16')]===0x1f4){logger[_0x3ad0('0x15')](_0x3ad0('0x11'),_0x20b87f,_0x557fe1[_0x3ad0('0x15')][_0x3ad0('0x17')]);return _0x1e9e00(_0x557fe1[_0x3ad0('0x15')][_0x3ad0('0x17')]);}logger[_0x3ad0('0x15')](_0x3ad0('0x11'),_0x20b87f,_0x557fe1['error'][_0x3ad0('0x17')]);return _0x5d0362(_0x557fe1[_0x3ad0('0x15')][_0x3ad0('0x17')]);}else{logger[_0x3ad0('0x10')](_0x3ad0('0x11'),_0x20b87f,_0x3ad0('0x13'));_0x5d0362(_0x557fe1[_0x3ad0('0x18')][_0x3ad0('0x17')]);}})[_0x3ad0('0x19')](function(_0x50e3e9){logger[_0x3ad0('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x20b87f,_0x50e3e9);_0x1e9e00(_0x50e3e9);});});}exports[_0x3ad0('0x1a')]=function(_0x27aa7a){var _0x5818b7=this;return new Promise(function(_0xe7ca5e,_0x17792d){return db[_0x3ad0('0x1b')][_0x3ad0('0x1c')]({'raw':_0x27aa7a['options']?_0x27aa7a[_0x3ad0('0x1d')][_0x3ad0('0x1e')]===undefined?!![]:![]:!![],'where':_0x27aa7a['options']?_0x27aa7a[_0x3ad0('0x1d')][_0x3ad0('0x1f')]||null:null,'attributes':_0x27aa7a[_0x3ad0('0x1d')]?_0x27aa7a[_0x3ad0('0x1d')][_0x3ad0('0x20')]||null:null,'limit':_0x27aa7a[_0x3ad0('0x1d')]?_0x27aa7a['options'][_0x3ad0('0x21')]||null:null,'include':_0x27aa7a[_0x3ad0('0x1d')]?_0x27aa7a[_0x3ad0('0x1d')][_0x3ad0('0x22')]?_[_0x3ad0('0x23')](_0x27aa7a[_0x3ad0('0x1d')]['include'],function(_0x47e0f1){return{'model':db[_0x47e0f1[_0x3ad0('0x24')]],'as':_0x47e0f1['as'],'attributes':_0x47e0f1[_0x3ad0('0x20')],'include':_0x47e0f1['include']?_[_0x3ad0('0x23')](_0x47e0f1[_0x3ad0('0x22')],function(_0x89c4c8){return{'model':db[_0x89c4c8['model']],'as':_0x89c4c8['as'],'attributes':_0x89c4c8[_0x3ad0('0x20')],'include':_0x89c4c8[_0x3ad0('0x22')]?_[_0x3ad0('0x23')](_0x89c4c8[_0x3ad0('0x22')],function(_0x575f6b){return{'model':db[_0x575f6b[_0x3ad0('0x24')]],'as':_0x575f6b['as'],'attributes':_0x575f6b[_0x3ad0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ad0('0xf')](function(_0x7cbc17){logger[_0x3ad0('0x10')]('GetVoiceQueueReport',_0x27aa7a);logger[_0x3ad0('0x25')](_0x3ad0('0x1a'),_0x27aa7a,JSON[_0x3ad0('0x14')](_0x7cbc17));_0xe7ca5e(_0x7cbc17);})[_0x3ad0('0x19')](function(_0x594dd0){logger[_0x3ad0('0x15')](_0x3ad0('0x1a'),_0x594dd0[_0x3ad0('0x17')],_0x27aa7a);_0x17792d(_0x5818b7['error'](0x1f4,_0x594dd0[_0x3ad0('0x17')]));});});};exports[_0x3ad0('0x26')]=function(_0x1f8da6){var _0x67e00a=this;return new Promise(function(_0x31dbf2,_0x90ce7e){return db['VoiceQueueReport'][_0x3ad0('0x27')](_0x1f8da6['body'],{'raw':_0x1f8da6[_0x3ad0('0x1d')]?_0x1f8da6[_0x3ad0('0x1d')][_0x3ad0('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x3d0191){logger['info'](_0x3ad0('0x26'),_0x1f8da6);logger[_0x3ad0('0x25')](_0x3ad0('0x26'),_0x1f8da6,JSON[_0x3ad0('0x14')](_0x3d0191));_0x31dbf2(_0x3d0191);})[_0x3ad0('0x19')](function(_0x1e76b9){logger[_0x3ad0('0x15')](_0x3ad0('0x26'),_0x1e76b9[_0x3ad0('0x17')],_0x1f8da6);_0x90ce7e(_0x67e00a[_0x3ad0('0x15')](0x1f4,_0x1e76b9[_0x3ad0('0x17')]));});});};exports[_0x3ad0('0x28')]=function(_0x1a7305){var _0x52c06c=this;return new Promise(function(_0x4dd45,_0x2977de){return db[_0x3ad0('0x1b')][_0x3ad0('0x29')](_0x1a7305[_0x3ad0('0x2a')],{'raw':_0x1a7305[_0x3ad0('0x1d')]?_0x1a7305['options'][_0x3ad0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a7305['options']?_0x1a7305[_0x3ad0('0x1d')][_0x3ad0('0x1f')]||null:null,'attributes':_0x1a7305[_0x3ad0('0x1d')]?_0x1a7305[_0x3ad0('0x1d')][_0x3ad0('0x20')]||null:null,'limit':_0x1a7305['options']?_0x1a7305[_0x3ad0('0x1d')]['limit']||null:null})['then'](function(_0xbf153a){logger[_0x3ad0('0x10')]('UpdateVoiceQueueReport',_0x1a7305);logger[_0x3ad0('0x25')]('UpdateVoiceQueueReport',_0x1a7305,JSON[_0x3ad0('0x14')](_0xbf153a));_0x4dd45(_0xbf153a);})['catch'](function(_0x17c00d){logger[_0x3ad0('0x15')](_0x3ad0('0x28'),_0x17c00d[_0x3ad0('0x17')],_0x1a7305);_0x2977de(_0x52c06c[_0x3ad0('0x15')](0x1f4,_0x17c00d['message']));});});}; \ No newline at end of file +var _0xf07c=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','catch','body','raw','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x89967e,_0x2f4ad5){var _0x5cc15d=function(_0x499d0e){while(--_0x499d0e){_0x89967e['push'](_0x89967e['shift']());}};_0x5cc15d(++_0x2f4ad5);}(_0xf07c,0x92));var _0xcf07=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xf07c[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xcf07('0x0'));var util=require(_0xcf07('0x1'));var moment=require(_0xcf07('0x2'));var BPromise=require(_0xcf07('0x3'));var rs=require(_0xcf07('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf07('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf07('0x6'))(_0xcf07('0x7'));var config=require(_0xcf07('0x8'));var jayson=require(_0xcf07('0x9'));var client=jayson[_0xcf07('0xa')][_0xcf07('0xb')]({'port':0x232a});config[_0xcf07('0xc')]=_['defaults'](config[_0xcf07('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf07('0xd'))(new Redis(config[_0xcf07('0xc')]));require(_0xcf07('0xe'))[_0xcf07('0xf')](socket);function respondWithRpcPromise(_0x3e6e03,_0x27a496,_0x292831){return new BPromise(function(_0x3f7126,_0x14ddb9){return client[_0xcf07('0x10')](_0x3e6e03,_0x292831)[_0xcf07('0x11')](function(_0x5c875a){logger[_0xcf07('0x12')](_0xcf07('0x13'),_0x27a496,_0xcf07('0x14'));logger[_0xcf07('0x15')](_0xcf07('0x16'),_0x27a496,_0xcf07('0x14'),JSON[_0xcf07('0x17')](_0x5c875a));if(_0x5c875a[_0xcf07('0x18')]){if(_0x5c875a[_0xcf07('0x18')]['code']===0x1f4){logger[_0xcf07('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x27a496,_0x5c875a['error'][_0xcf07('0x19')]);return _0x14ddb9(_0x5c875a[_0xcf07('0x18')]['message']);}logger['error'](_0xcf07('0x13'),_0x27a496,_0x5c875a[_0xcf07('0x18')][_0xcf07('0x19')]);return _0x3f7126(_0x5c875a[_0xcf07('0x18')][_0xcf07('0x19')]);}else{logger[_0xcf07('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x27a496,_0xcf07('0x14'));_0x3f7126(_0x5c875a['result']['message']);}})['catch'](function(_0xc5edae){logger[_0xcf07('0x18')](_0xcf07('0x13'),_0x27a496,_0xc5edae);_0x14ddb9(_0xc5edae);});});}exports['GetVoiceQueueReport']=function(_0x221b67){var _0x1bd4e7=this;return new Promise(function(_0x436f2e,_0x270119){return db[_0xcf07('0x1a')][_0xcf07('0x1b')]({'raw':_0x221b67['options']?_0x221b67[_0xcf07('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x221b67['options']?_0x221b67[_0xcf07('0x1c')][_0xcf07('0x1d')]||null:null,'attributes':_0x221b67[_0xcf07('0x1c')]?_0x221b67['options'][_0xcf07('0x1e')]||null:null,'limit':_0x221b67[_0xcf07('0x1c')]?_0x221b67[_0xcf07('0x1c')][_0xcf07('0x1f')]||null:null,'include':_0x221b67[_0xcf07('0x1c')]?_0x221b67[_0xcf07('0x1c')][_0xcf07('0x20')]?_[_0xcf07('0x21')](_0x221b67['options']['include'],function(_0x3031c1){return{'model':db[_0x3031c1['model']],'as':_0x3031c1['as'],'attributes':_0x3031c1[_0xcf07('0x1e')],'include':_0x3031c1[_0xcf07('0x20')]?_[_0xcf07('0x21')](_0x3031c1[_0xcf07('0x20')],function(_0x19d0db){return{'model':db[_0x19d0db[_0xcf07('0x22')]],'as':_0x19d0db['as'],'attributes':_0x19d0db[_0xcf07('0x1e')],'include':_0x19d0db[_0xcf07('0x20')]?_[_0xcf07('0x21')](_0x19d0db[_0xcf07('0x20')],function(_0x1d71ae){return{'model':db[_0x1d71ae[_0xcf07('0x22')]],'as':_0x1d71ae['as'],'attributes':_0x1d71ae[_0xcf07('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcf07('0x11')](function(_0x305c50){logger[_0xcf07('0x12')](_0xcf07('0x23'),_0x221b67);logger['debug'](_0xcf07('0x23'),_0x221b67,JSON[_0xcf07('0x17')](_0x305c50));_0x436f2e(_0x305c50);})[_0xcf07('0x24')](function(_0x28bbaa){logger[_0xcf07('0x18')](_0xcf07('0x23'),_0x28bbaa[_0xcf07('0x19')],_0x221b67);_0x270119(_0x1bd4e7[_0xcf07('0x18')](0x1f4,_0x28bbaa['message']));});});};exports['CreateVoiceQueueReport']=function(_0x5b1710){var _0x2d0f96=this;return new Promise(function(_0x341624,_0x4ddf65){return db[_0xcf07('0x1a')]['create'](_0x5b1710[_0xcf07('0x25')],{'raw':_0x5b1710['options']?_0x5b1710['options'][_0xcf07('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x170232){logger[_0xcf07('0x12')](_0xcf07('0x27'),_0x5b1710);logger['debug']('CreateVoiceQueueReport',_0x5b1710,JSON['stringify'](_0x170232));_0x341624(_0x170232);})[_0xcf07('0x24')](function(_0x5590fc){logger[_0xcf07('0x18')](_0xcf07('0x27'),_0x5590fc[_0xcf07('0x19')],_0x5b1710);_0x4ddf65(_0x2d0f96[_0xcf07('0x18')](0x1f4,_0x5590fc[_0xcf07('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3f363d){var _0xda02=this;return new Promise(function(_0x467d2d,_0x550732){return db[_0xcf07('0x1a')][_0xcf07('0x28')](_0x3f363d[_0xcf07('0x25')],{'raw':_0x3f363d['options']?_0x3f363d[_0xcf07('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f363d[_0xcf07('0x1c')]?_0x3f363d[_0xcf07('0x1c')][_0xcf07('0x1d')]||null:null,'attributes':_0x3f363d[_0xcf07('0x1c')]?_0x3f363d[_0xcf07('0x1c')][_0xcf07('0x1e')]||null:null,'limit':_0x3f363d[_0xcf07('0x1c')]?_0x3f363d[_0xcf07('0x1c')][_0xcf07('0x1f')]||null:null})['then'](function(_0xfe6451){logger[_0xcf07('0x12')]('UpdateVoiceQueueReport',_0x3f363d);logger[_0xcf07('0x15')]('UpdateVoiceQueueReport',_0x3f363d,JSON[_0xcf07('0x17')](_0xfe6451));_0x467d2d(_0xfe6451);})[_0xcf07('0x24')](function(_0x5bfb72){logger[_0xcf07('0x18')](_0xcf07('0x29'),_0x5bfb72[_0xcf07('0x19')],_0x3f363d);_0x550732(_0xda02['error'](0x1f4,_0x5bfb72[_0xcf07('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 431433f..3aa938c 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 _0xaef2=['update','emit','removeListener','register','length','./voiceQueueReport.events','save'];(function(_0x4c246c,_0xc56432){var _0x2ae356=function(_0x4d0662){while(--_0x4d0662){_0x4c246c['push'](_0x4c246c['shift']());}};_0x2ae356(++_0xc56432);}(_0xaef2,0xf3));var _0x2aef=function(_0x5ebaa6,_0x599753){_0x5ebaa6=_0x5ebaa6-0x0;var _0x4d6cc8=_0xaef2[_0x5ebaa6];return _0x4d6cc8;};'use strict';var VoiceQueueReportEvents=require(_0x2aef('0x0'));var events=[_0x2aef('0x1'),'remove',_0x2aef('0x2')];function createListener(_0x420601,_0x199e7f){return function(_0x3046af){_0x199e7f[_0x2aef('0x3')](_0x420601,_0x3046af);};}function removeListener(_0x194a20,_0x17a40f){return function(){VoiceQueueReportEvents[_0x2aef('0x4')](_0x194a20,_0x17a40f);};}exports[_0x2aef('0x5')]=function(_0x5a49fa){for(var _0x1b97df=0x0,_0x2ad395=events[_0x2aef('0x6')];_0x1b97df<_0x2ad395;_0x1b97df++){var _0x1b24b5=events[_0x1b97df];var _0x1ae89a=createListener('voiceQueueReport:'+_0x1b24b5,_0x5a49fa);VoiceQueueReportEvents['on'](_0x1b24b5,_0x1ae89a);}}; \ No newline at end of file +var _0xcf7d=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x5b4701,_0x22bf1c){var _0x212815=function(_0x4516ef){while(--_0x4516ef){_0x5b4701['push'](_0x5b4701['shift']());}};_0x212815(++_0x22bf1c);}(_0xcf7d,0x1c9));var _0xdcf7=function(_0x29586b,_0x313dc2){_0x29586b=_0x29586b-0x0;var _0x1ceaa0=_0xcf7d[_0x29586b];return _0x1ceaa0;};'use strict';var VoiceQueueReportEvents=require(_0xdcf7('0x0'));var events=[_0xdcf7('0x1'),_0xdcf7('0x2'),_0xdcf7('0x3')];function createListener(_0x3ba82d,_0x582a92){return function(_0x360983){_0x582a92[_0xdcf7('0x4')](_0x3ba82d,_0x360983);};}function removeListener(_0x36fb1a,_0x8f53a4){return function(){VoiceQueueReportEvents[_0xdcf7('0x5')](_0x36fb1a,_0x8f53a4);};}exports[_0xdcf7('0x6')]=function(_0x2512e9){for(var _0x1aba1c=0x0,_0x5528bb=events[_0xdcf7('0x7')];_0x1aba1c<_0x5528bb;_0x1aba1c++){var _0x508796=events[_0x1aba1c];var _0x4dfd94=createListener(_0xdcf7('0x8')+_0x508796,_0x2512e9);VoiceQueueReportEvents['on'](_0x508796,_0x4dfd94);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d8622c2..06e1112 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 _0xe9a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5e3a45,_0x300bf1){var _0x4280bc=function(_0x542e06){while(--_0x542e06){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x4280bc(++_0x300bf1);}(_0xe9a6,0x64));var _0x6e9a=function(_0x1bd6a3,_0x205fa4){_0x1bd6a3=_0x1bd6a3-0x0;var _0x373be8=_0xe9a6[_0x1bd6a3];return _0x373be8;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require('util');var path=require(_0x6e9a('0x1'));var timeout=require(_0x6e9a('0x2'));var express=require(_0x6e9a('0x3'));var router=express[_0x6e9a('0x4')]();var auth=require(_0x6e9a('0x5'));var interaction=require(_0x6e9a('0x6'));var config=require(_0x6e9a('0x7'));var controller=require(_0x6e9a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e9a('0x9')]);router[_0x6e9a('0xa')](_0x6e9a('0xb'),auth['isAuthenticated'](),controller[_0x6e9a('0xc')]);router[_0x6e9a('0xd')]('/',auth[_0x6e9a('0xe')](),controller[_0x6e9a('0xf')]);router[_0x6e9a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6e9a('0x11')]);router[_0x6e9a('0x12')](_0x6e9a('0xb'),auth[_0x6e9a('0xe')](),controller[_0x6e9a('0x13')]);module[_0x6e9a('0x14')]=router; \ No newline at end of file +var _0xcb32=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x17d8d9,_0x4c3df2){var _0xb24f46=function(_0x5c53d3){while(--_0x5c53d3){_0x17d8d9['push'](_0x17d8d9['shift']());}};_0xb24f46(++_0x4c3df2);}(_0xcb32,0x151));var _0x2cb3=function(_0x4d2a73,_0x4eb942){_0x4d2a73=_0x4d2a73-0x0;var _0x5eb30e=_0xcb32[_0x4d2a73];return _0x5eb30e;};'use strict';var multer=require(_0x2cb3('0x0'));var util=require(_0x2cb3('0x1'));var path=require(_0x2cb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cb3('0x3'));var router=express[_0x2cb3('0x4')]();var auth=require(_0x2cb3('0x5'));var interaction=require(_0x2cb3('0x6'));var config=require('../../config/environment');var controller=require(_0x2cb3('0x7'));router[_0x2cb3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x2cb3('0x9')](),controller[_0x2cb3('0xa')]);router[_0x2cb3('0xb')]('/',auth[_0x2cb3('0x9')](),controller[_0x2cb3('0xc')]);router['put'](_0x2cb3('0xd'),auth[_0x2cb3('0x9')](),controller[_0x2cb3('0xe')]);router[_0x2cb3('0xf')](_0x2cb3('0xd'),auth['isAuthenticated'](),controller[_0x2cb3('0x10')]);module[_0x2cb3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 1a05fef..1a9ef3b 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 _0x1d8b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x5ddd4c,_0x1168dd){var _0x50754b=function(_0x9952ca){while(--_0x9952ca){_0x5ddd4c['push'](_0x5ddd4c['shift']());}};_0x50754b(++_0x1168dd);}(_0x1d8b,0x183));var _0xb1d8=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x1d8b[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb1d8('0x0'));module[_0xb1d8('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb1d8('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb1d8('0x3')],'allowNull':![],'defaultValue':moment()[_0xb1d8('0x4')](_0xb1d8('0x5'))}}; \ No newline at end of file +var _0xa575=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x5e3a1f,_0x24c078){var _0x3c27fd=function(_0x2736eb){while(--_0x2736eb){_0x5e3a1f['push'](_0x5e3a1f['shift']());}};_0x3c27fd(++_0x24c078);}(_0xa575,0xc8));var _0x5a57=function(_0x583513,_0x34e323){_0x583513=_0x583513-0x0;var _0x15e3ec=_0xa575[_0x583513];return _0x15e3ec;};'use strict';var Sequelize=require(_0x5a57('0x0'));var moment=require('moment');module[_0x5a57('0x1')]={'time':{'type':Sequelize[_0x5a57('0x2')]},'callid':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5a57('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5a57('0x3')],'allowNull':![],'defaultValue':moment()[_0x5a57('0x4')](_0x5a57('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0dca098..3c94d44 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 _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x4bed36,_0x141048){var _0x2b4913=function(_0x88d2de){while(--_0x88d2de){_0x4bed36['push'](_0x4bed36['shift']());}};_0x2b4913(++_0x141048);}(_0xb10b,0x12a));var _0xbb10=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xb10b[_0x1269c6];return _0x4868c7;};'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['VoiceQueuesLog'][_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')]),_0x20d946);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));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x2bc53f,_0x1bd14c){var _0x173601=function(_0x18a865){while(--_0x18a865){_0x2bc53f['push'](_0x2bc53f['shift']());}};_0x173601(++_0x1bd14c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ac9ded8..4ffd64b 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 _0xeff8=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0xeff8,0x186));var _0x8eff=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xeff8[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xc'),_0x8eff('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xacf4=['bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','../../config/logger','api','moment'];(function(_0x24ce9a,_0x2a97ee){var _0x94013b=function(_0x2bcf09){while(--_0x2bcf09){_0x24ce9a['push'](_0x24ce9a['shift']());}};_0x94013b(++_0x2a97ee);}(_0xacf4,0xe7));var _0x4acf=function(_0x4975c5,_0x1ca463){_0x4975c5=_0x4975c5-0x0;var _0x5ebf72=_0xacf4[_0x4975c5];return _0x5ebf72;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 78a8b04..6b67601 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 _0xfff0=['../../config/environment','client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x493976,_0x5a0641){var _0x3cef39=function(_0x5e3795){while(--_0x5e3795){_0x493976['push'](_0x493976['shift']());}};_0x3cef39(++_0x5a0641);}(_0xfff0,0x139));var _0x0fff=function(_0x227af8,_0x2ed543){_0x227af8=_0x227af8-0x0;var _0x3fa817=_0xfff0[_0x227af8];return _0x3fa817;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});} \ No newline at end of file +var _0xbee3=['error','code','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x57ca23,_0x53bb43){var _0x173524=function(_0x593195){while(--_0x593195){_0x57ca23['push'](_0x57ca23['shift']());}};_0x173524(++_0x53bb43);}(_0xbee3,0xd5));var _0x3bee=function(_0x539be4,_0x34c69b){_0x539be4=_0x539be4-0x0;var _0x1217fb=_0xbee3[_0x539be4];return _0x1217fb;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index bf46be0..ab8c01e 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x2c8528,_0x17aade){var _0x459053=function(_0x14217b){while(--_0x14217b){_0x2c8528['push'](_0x2c8528['shift']());}};_0x459053(++_0x17aade);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x1ad589,_0x3a52e8){var _0x57d7cb=function(_0x2e8541){while(--_0x2e8541){_0x1ad589['push'](_0x1ad589['shift']());}};_0x57d7cb(++_0x3a52e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5973bcf..7ed5ab5 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 _0x8fa6=['extname','STRING','setDataValue','channel','membername','TEXT','NEW','FLOAT','BOOLEAN','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value'];(function(_0x90af9e,_0x3310a7){var _0x1d2eee=function(_0x213519){while(--_0x213519){_0x90af9e['push'](_0x90af9e['shift']());}};_0x1d2eee(++_0x3310a7);}(_0x8fa6,0xf6));var _0x68fa=function(_0x1aec03,_0xbf9ae0){_0x1aec03=_0x1aec03-0x0;var _0x4e1b79=_0x8fa6[_0x1aec03];return _0x4e1b79;};'use strict';var Sequelize=require(_0x68fa('0x0'));var moment=require(_0x68fa('0x1'));var path=require(_0x68fa('0x2'));module[_0x68fa('0x3')]={'format':{'type':Sequelize[_0x68fa('0x4')],'get':function(){return this['getDataValue'](_0x68fa('0x5'))?path[_0x68fa('0x6')](this['getDataValue'](_0x68fa('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x68fa('0x7')]},'channel':{'type':Sequelize[_0x68fa('0x7')],'set':function(_0x29ef9f){if(_0x29ef9f){this[_0x68fa('0x8')](_0x68fa('0x9'),_0x29ef9f);this[_0x68fa('0x8')](_0x68fa('0xa'),_0x29ef9f['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x68fa('0x7')]},'calleridname':{'type':Sequelize[_0x68fa('0x7')]},'connectedlinenum':{'type':Sequelize[_0x68fa('0x7')]},'connectedlinename':{'type':Sequelize[_0x68fa('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x68fa('0x7')]},'exten':{'type':Sequelize[_0x68fa('0x7')]},'value':{'type':Sequelize[_0x68fa('0x7')]},'type':{'type':Sequelize[_0x68fa('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x68fa('0x7')]},'userDisposition':{'type':Sequelize[_0x68fa('0x7')]},'location':{'type':Sequelize[_0x68fa('0xb')]},'transcribeName':{'type':Sequelize[_0x68fa('0x7')]},'transcribeStatus':{'type':Sequelize[_0x68fa('0x7')],'defaultValue':_0x68fa('0xc')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x68fa('0xb')]},'sentiment':{'type':Sequelize[_0x68fa('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x68fa('0xd')]},'sNeutral':{'type':Sequelize[_0x68fa('0xd')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x68fa('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x68fa('0xf')],'get':function(){return moment(this[_0x68fa('0x10')]('createdAt'))[_0x68fa('0x11')](_0x68fa('0x12'))[_0x68fa('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x68fa('0x10')](_0x68fa('0x14')))[_0x68fa('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x68fa('0x13')]();}}}; \ No newline at end of file +var _0xc1e8=['toString','MM-DD-YYYY\x20HH:mm','sequelize','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format'];(function(_0x4e8190,_0x1e485f){var _0x11b432=function(_0x370746){while(--_0x370746){_0x4e8190['push'](_0x4e8190['shift']());}};_0x11b432(++_0x1e485f);}(_0xc1e8,0x10c));var _0x8c1e=function(_0x17ac5b,_0x1a2d16){_0x17ac5b=_0x17ac5b-0x0;var _0x2dcec9=_0xc1e8[_0x17ac5b];return _0x2dcec9;};'use strict';var Sequelize=require(_0x8c1e('0x0'));var moment=require('moment');var path=require('path');module[_0x8c1e('0x1')]={'format':{'type':Sequelize[_0x8c1e('0x2')],'get':function(){return this[_0x8c1e('0x3')](_0x8c1e('0x4'))?path[_0x8c1e('0x5')](this['getDataValue'](_0x8c1e('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x8c1e('0x6')]},'channel':{'type':Sequelize[_0x8c1e('0x6')],'set':function(_0x543178){if(_0x543178){this[_0x8c1e('0x7')](_0x8c1e('0x8'),_0x543178);this[_0x8c1e('0x7')](_0x8c1e('0x9'),_0x543178['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x8c1e('0x6')]},'calleridnum':{'type':Sequelize[_0x8c1e('0x6')]},'calleridname':{'type':Sequelize[_0x8c1e('0x6')]},'connectedlinenum':{'type':Sequelize[_0x8c1e('0x6')]},'connectedlinename':{'type':Sequelize[_0x8c1e('0x6')]},'accountcode':{'type':Sequelize[_0x8c1e('0x6')]},'context':{'type':Sequelize[_0x8c1e('0x6')]},'exten':{'type':Sequelize[_0x8c1e('0x6')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8c1e('0x6')]},'rating':{'type':Sequelize[_0x8c1e('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x8c1e('0x6')]},'userDisposition':{'type':Sequelize[_0x8c1e('0x6')]},'location':{'type':Sequelize[_0x8c1e('0xb')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x8c1e('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x8c1e('0xb')]},'fileText':{'type':Sequelize[_0x8c1e('0xb')]},'failureReason':{'type':Sequelize[_0x8c1e('0xb')]},'sentiment':{'type':Sequelize[_0x8c1e('0x6')]},'sPositive':{'type':Sequelize[_0x8c1e('0xc')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x8c1e('0xc')]},'sMixed':{'type':Sequelize[_0x8c1e('0xc')]},'tempSentiment':{'type':Sequelize[_0x8c1e('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x8c1e('0xe')],'get':function(){return moment(this['getDataValue'](_0x8c1e('0xf')))[_0x8c1e('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x8c1e('0x11')]();}},'updatedAt':{'type':Sequelize[_0x8c1e('0xe')],'get':function(){return moment(this[_0x8c1e('0x3')]('updatedAt'))[_0x8c1e('0x10')](_0x8c1e('0x12'))[_0x8c1e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 10b0c46..ef92d85 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 _0x65fb=['count','includeAll','include','rows','catch','show','params','merge','options','find','create','body','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','download','filename','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','ValidationError','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x1a7c69,_0xa98081){var _0x1128cb=function(_0x5e2f9c){while(--_0x5e2f9c){_0x1a7c69['push'](_0x1a7c69['shift']());}};_0x1128cb(++_0xa98081);}(_0x65fb,0xf2));var _0xb65f=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x65fb[_0x3b90ab];return _0x206e92;};'use strict';var pdf=require(_0xb65f('0x0'));var emlformat=require(_0xb65f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb65f('0x2'));var jsonpatch=require(_0xb65f('0x3'));var rp=require(_0xb65f('0x4'));var moment=require('moment');var BPromise=require(_0xb65f('0x5'));var Mustache=require('mustache');var util=require(_0xb65f('0x6'));var path=require(_0xb65f('0x7'));var sox=require(_0xb65f('0x8'));var csv=require(_0xb65f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb65f('0xa'));var squel=require(_0xb65f('0xb'));var crypto=require(_0xb65f('0xc'));var jsforce=require(_0xb65f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb65f('0x9'));var querystring=require('querystring');var Papa=require(_0xb65f('0xe'));var AWS=require(_0xb65f('0xf'));var uuidv4=require(_0xb65f('0x10'));var Redis=require(_0xb65f('0x11'));var authService=require(_0xb65f('0x12'));var qs=require(_0xb65f('0x13'));var as=require(_0xb65f('0x14'));var hardwareService=require(_0xb65f('0x15'));var logger=require(_0xb65f('0x16'))(_0xb65f('0x17'));var utils=require('../../config/utils');var config=require(_0xb65f('0x18'));var db=require(_0xb65f('0x19'))['db'];function respondWithStatusCode(_0x5b3bde,_0x25e606){_0x25e606=_0x25e606||0xcc;return function(_0x151015){if(_0x151015){return _0x5b3bde[_0xb65f('0x1a')](_0x25e606);}return _0x5b3bde[_0xb65f('0x1b')](_0x25e606)[_0xb65f('0x1c')]();};}function respondWithResult(_0x44fc2e,_0x36cd8d){_0x36cd8d=_0x36cd8d||0xc8;return function(_0x190d37){if(_0x190d37){return _0x44fc2e[_0xb65f('0x1b')](_0x36cd8d)[_0xb65f('0x1d')](_0x190d37);}};}function respondWithFilteredResult(_0x2b18cb,_0x20f18e){return function(_0x52bd0b){if(_0x52bd0b){var _0x5abdd8=_0x52bd0b['count'],_0xf4d18b=_0x20f18e[_0xb65f('0x1e')],_0x1f03ed=_0x20f18e['offset']+_0x20f18e[_0xb65f('0x1f')],_0x500310;if(_0x1f03ed>=_0x5abdd8){_0x1f03ed=_0x5abdd8;_0x500310=0xc8;}else{_0x500310=0xce;}_0x2b18cb[_0xb65f('0x1b')](_0x500310);return _0x2b18cb[_0xb65f('0x20')]('Content-Range',_0xf4d18b+'-'+_0x1f03ed+'/'+_0x5abdd8)['json'](_0x52bd0b);}return null;};}function patchUpdates(_0x50defe){return function(_0x3933c2){try{jsonpatch[_0xb65f('0x21')](_0x3933c2,_0x50defe,!![]);}catch(_0x567df1){return BPromise[_0xb65f('0x22')](_0x567df1);}return _0x3933c2[_0xb65f('0x23')]();};}function saveUpdates(_0x263a46,_0x27d3eb){return function(_0x43ef43){if(_0x43ef43){return _0x43ef43[_0xb65f('0x24')](_0x263a46)[_0xb65f('0x25')](function(_0x29627b){return _0x29627b;});}return null;};}function removeEntity(_0x193201,_0x2e3534){return function(_0x2fa483){if(_0x2fa483){return _0x2fa483[_0xb65f('0x26')]()['then'](function(){_0x193201[_0xb65f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e5919,_0x2aff49){return function(_0x4c6241){if(!_0x4c6241){_0x2e5919[_0xb65f('0x1a')](0x194);}return _0x4c6241;};}function handleError(_0x59a45b,_0x22c1dc){_0x22c1dc=_0x22c1dc||0x1f4;return function(_0x29cb9d){logger[_0xb65f('0x27')](_0x29cb9d[_0xb65f('0x28')]);if(_0x29cb9d['name']){delete _0x29cb9d['name'];}_0x59a45b[_0xb65f('0x1b')](_0x22c1dc)[_0xb65f('0x29')](_0x29cb9d);};}exports[_0xb65f('0x2a')]=function(_0x42fc52,_0x928a0a){var _0x51726e={},_0x426d8c={},_0x37d2f8={'count':0x0,'rows':[]};var _0x472832=_[_0xb65f('0x2b')](db[_0xb65f('0x2c')][_0xb65f('0x2d')],function(_0xebc9b0){return{'name':_0xebc9b0['fieldName'],'type':_0xebc9b0[_0xb65f('0x2e')][_0xb65f('0x2f')]};});_0x426d8c[_0xb65f('0x30')]=_[_0xb65f('0x31')](_['map'](_0x472832,_0xb65f('0x32')),[_0xb65f('0x33')]);_0x426d8c[_0xb65f('0x34')]=_[_0xb65f('0x35')](_0x42fc52[_0xb65f('0x34')]);_0x426d8c[_0xb65f('0x36')]=_[_0xb65f('0x37')](_0x426d8c[_0xb65f('0x30')],_0x426d8c[_0xb65f('0x34')]);_0x51726e[_0xb65f('0x38')]=_[_0xb65f('0x37')](_0x426d8c['model'],qs[_0xb65f('0x39')](_0x42fc52[_0xb65f('0x34')][_0xb65f('0x39')]));_0x51726e[_0xb65f('0x38')]=_0x51726e[_0xb65f('0x38')][_0xb65f('0x3a')]?_0x51726e[_0xb65f('0x38')]:_0x426d8c[_0xb65f('0x30')];if(!_0x42fc52['query'][_0xb65f('0x3b')]('nolimit')){_0x51726e[_0xb65f('0x1f')]=qs[_0xb65f('0x1f')](_0x42fc52[_0xb65f('0x34')][_0xb65f('0x1f')]);_0x51726e[_0xb65f('0x1e')]=qs[_0xb65f('0x1e')](_0x42fc52[_0xb65f('0x34')][_0xb65f('0x1e')]);}_0x51726e['order']=qs[_0xb65f('0x3c')](_0x42fc52[_0xb65f('0x34')]['sort']);_0x51726e[_0xb65f('0x3d')]=qs['filters'](_[_0xb65f('0x3e')](_0x42fc52[_0xb65f('0x34')],_0x426d8c[_0xb65f('0x36')]),_0x472832);if(_0x42fc52[_0xb65f('0x34')][_0xb65f('0x3f')]){_0x51726e[_0xb65f('0x3d')]=_['merge'](_0x51726e['where'],{'$or':_[_0xb65f('0x2b')](_0x472832,function(_0x337864){if(_0x337864[_0xb65f('0x2e')]!=='VIRTUAL'){var _0x171e5a={};_0x171e5a[_0x337864[_0xb65f('0x32')]]={'$like':'%'+_0x42fc52[_0xb65f('0x34')][_0xb65f('0x3f')]+'%'};return _0x171e5a;}})});}_0x51726e=_['merge']({},_0x51726e,_0x42fc52['options']);var _0x3c0fb5={'where':_0x51726e[_0xb65f('0x3d')]};return db[_0xb65f('0x2c')]['count'](_0x3c0fb5)[_0xb65f('0x25')](function(_0x42a6b1){_0x37d2f8[_0xb65f('0x40')]=_0x42a6b1;if(_0x42fc52[_0xb65f('0x34')][_0xb65f('0x41')]){_0x51726e[_0xb65f('0x42')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x51726e);})[_0xb65f('0x25')](function(_0x8efc65){_0x37d2f8[_0xb65f('0x43')]=_0x8efc65;return _0x37d2f8;})[_0xb65f('0x25')](respondWithFilteredResult(_0x928a0a,_0x51726e))[_0xb65f('0x44')](handleError(_0x928a0a,null));};exports[_0xb65f('0x45')]=function(_0x10b387,_0x566595){var _0x29446e={'raw':![],'where':{'id':_0x10b387[_0xb65f('0x46')]['id']}},_0x5a71fb={};_0x5a71fb['model']=_[_0xb65f('0x35')](db[_0xb65f('0x2c')][_0xb65f('0x2d')]);_0x5a71fb[_0xb65f('0x34')]=_[_0xb65f('0x35')](_0x10b387[_0xb65f('0x34')]);_0x5a71fb[_0xb65f('0x36')]=_[_0xb65f('0x37')](_0x5a71fb[_0xb65f('0x30')],_0x5a71fb['query']);_0x29446e[_0xb65f('0x38')]=_[_0xb65f('0x37')](_0x5a71fb[_0xb65f('0x30')],qs[_0xb65f('0x39')](_0x10b387['query']['fields']));_0x29446e[_0xb65f('0x38')]=_0x29446e[_0xb65f('0x38')]['length']?_0x29446e['attributes']:_0x5a71fb['model'];if(_0x10b387['query']['includeAll']){_0x29446e[_0xb65f('0x42')]=[{'all':!![]}];}_0x29446e=_[_0xb65f('0x47')]({},_0x29446e,_0x10b387[_0xb65f('0x48')]);return db[_0xb65f('0x2c')][_0xb65f('0x49')](_0x29446e)[_0xb65f('0x25')](handleEntityNotFound(_0x566595,null))[_0xb65f('0x25')](respondWithResult(_0x566595,null))['catch'](handleError(_0x566595,null));};exports[_0xb65f('0x4a')]=function(_0x37f441,_0x25304b){return db[_0xb65f('0x2c')][_0xb65f('0x4a')](_0x37f441[_0xb65f('0x4b')],{})[_0xb65f('0x25')](respondWithResult(_0x25304b,0xc9))[_0xb65f('0x44')](handleError(_0x25304b,null));};exports[_0xb65f('0x24')]=function(_0x2c3181,_0x2cc5f9){if(_0x2c3181['body']['id']){delete _0x2c3181[_0xb65f('0x4b')]['id'];}return db[_0xb65f('0x2c')][_0xb65f('0x49')]({'where':{'id':_0x2c3181[_0xb65f('0x46')]['id']}})[_0xb65f('0x25')](handleEntityNotFound(_0x2cc5f9,null))['then'](saveUpdates(_0x2c3181['body'],null))['then'](respondWithResult(_0x2cc5f9,null))[_0xb65f('0x44')](handleError(_0x2cc5f9,null));};exports[_0xb65f('0x4c')]=function(_0x5ea4d2,_0x401be4){return db[_0xb65f('0x2c')]['describe']()[_0xb65f('0x25')](respondWithResult(_0x401be4,null))['catch'](handleError(_0x401be4,null));};exports['download']=function(_0x51c939,_0x252fae,_0x492559){var _0x299a33=require('../../components/encryptor');var _0x4d69df=![];var _0x13d519={};if(_0x51c939['query']['type']&&_0x51c939[_0xb65f('0x34')][_0xb65f('0x2e')]==='uniqueid'){_0x13d519[_0xb65f('0x4d')]=_0x51c939[_0xb65f('0x46')]['id'];}else{_0x13d519['id']=_0x51c939[_0xb65f('0x46')]['id'];}return db[_0xb65f('0x2c')]['find']({'where':_0x13d519,'attributes':['id','value'],'raw':!![]})[_0xb65f('0x25')](handleEntityNotFound(_0x252fae,null))['then'](function(_0x5e388e){if(_0x5e388e){var _0x175111=_0x5e388e[_0xb65f('0x4e')];var _0x541869=util[_0xb65f('0x33')](_0xb65f('0x4f'),_0x175111);if(fs[_0xb65f('0x50')](_0x541869)){_0x4d69df=!![];return _0x299a33[_0xb65f('0x51')](_0x541869,_0x175111,config[_0xb65f('0x52')][_0xb65f('0x53')])[_0xb65f('0x25')](function(){return _0x5e388e;});}return _0x5e388e;}})[_0xb65f('0x25')](function(_0x25162c){if(_0x25162c){var _0x3108de=_0x25162c[_0xb65f('0x4e')];if(!fs[_0xb65f('0x50')](_0x3108de)){throw new db[(_0xb65f('0x54'))]['ValidationError'](_0xb65f('0x55'));}if(_0x25162c['filename']){return _0x252fae[_0xb65f('0x56')](_0x3108de,_0x25162c[_0xb65f('0x57')]+path['extname'](_0x3108de),function(){if(_0x4d69df){fs['unlink'](_0x3108de);}});}else{return _0x252fae[_0xb65f('0x56')](_0x3108de,function(_0x53f858){if(_0x4d69df){fs[_0xb65f('0x58')](_0x3108de);}});}}})[_0xb65f('0x44')](function(_0x5aa064){if(_0x5aa064[_0xb65f('0x59')]===_0xb65f('0x55')){_0x252fae[_0xb65f('0x1b')](0x194)[_0xb65f('0x29')]('Not\x20found');}else{return handleError(_0x252fae,null);}});};exports[_0xb65f('0x5a')]=function(_0x1ac1de,_0x1e9f47,_0x5bec0c){var _0x370a3a=require(_0xb65f('0x5b'));var _0x1345df=![];var _0x391c0b={'$and':[db[_0xb65f('0x5c')][_0xb65f('0x3d')](db[_0xb65f('0x5c')]['fn'](_0xb65f('0x5d'),db[_0xb65f('0x5c')][_0xb65f('0x5e')](_0xb65f('0x4d'))),_0x1ac1de[_0xb65f('0x34')][_0xb65f('0x5f')])]};if(_0x1ac1de[_0xb65f('0x34')]['type']&&_0x1ac1de[_0xb65f('0x34')][_0xb65f('0x2e')]===_0xb65f('0x4d')){_0x391c0b[_0xb65f('0x60')]['push']({'uniqueid':_0x1ac1de[_0xb65f('0x46')]['id']});}else{_0x391c0b[_0xb65f('0x60')][_0xb65f('0x61')]({'id':_0x1ac1de[_0xb65f('0x46')]['id']});}return db['VoiceRecording'][_0xb65f('0x49')]({'where':_0x391c0b,'attributes':['id',_0xb65f('0x4e')],'raw':!![]})[_0xb65f('0x25')](handleEntityNotFound(_0x1e9f47,null))['then'](function(_0x39f5dc){if(_0x39f5dc){var _0x13ffca=util['format']('%s.cypher',_0x39f5dc[_0xb65f('0x4e')]);if(fs['existsSync'](_0x13ffca)){_0x1345df=!![];return _0x370a3a[_0xb65f('0x51')](_0x13ffca,_0x39f5dc['value'],config[_0xb65f('0x52')][_0xb65f('0x53')])['then'](function(){return _0x39f5dc;});}return _0x39f5dc;}})['then'](function(_0x362909){if(_0x362909){if(!fs[_0xb65f('0x50')](_0x362909['value'])){throw new db[(_0xb65f('0x54'))][(_0xb65f('0x62'))](_0xb65f('0x55'));}if(_0x362909[_0xb65f('0x57')]){return _0x1e9f47[_0xb65f('0x56')](_0x362909['value'],_0x362909[_0xb65f('0x57')]+path['extname'](_0x362909[_0xb65f('0x4e')]),function(){if(_0x1345df){fs[_0xb65f('0x58')](_0x362909['value']);}});}else{return _0x1e9f47[_0xb65f('0x56')](_0x362909[_0xb65f('0x4e')],function(_0xbfb194){if(_0x1345df){fs[_0xb65f('0x58')](_0x362909['value']);}});}}})[_0xb65f('0x44')](handleError(_0x1e9f47,null));};exports[_0xb65f('0x26')]=function(_0x5113bb,_0x4ce05f){return db[_0xb65f('0x2c')][_0xb65f('0x49')]({'where':{'id':_0x5113bb[_0xb65f('0x46')]['id']}})[_0xb65f('0x25')](function(_0x42e219){if(!_0x42e219)throw new ReferenceError('Entity\x20not\x20found');return _0x42e219;})[_0xb65f('0x25')](function(_0x468893){var _0x15be57=_0x468893['value'];logger['info'](_0xb65f('0x63'),_0x15be57);if(!_['isNil'](_0x468893[_0xb65f('0x4e')])&&fs[_0xb65f('0x50')](_0x15be57)){logger[_0xb65f('0x64')](_0xb65f('0x65')+_0x15be57+_0xb65f('0x66'));fs[_0xb65f('0x67')](_0x15be57);}_0x15be57=_0x15be57+_0xb65f('0x68');if(!_[_0xb65f('0x69')](_0x468893[_0xb65f('0x4e')])&&fs['existsSync'](_0x15be57)){logger[_0xb65f('0x64')](_0xb65f('0x65')+_0x15be57+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x15be57);}return _0x468893;})[_0xb65f('0x25')](function(_0x5b501d){if(!_0x5b501d)throw new InternalError();return _0x5b501d[_0xb65f('0x26')]();})[_0xb65f('0x25')](function(){_0x4ce05f[_0xb65f('0x1b')](0xcc)[_0xb65f('0x1c')]();})[_0xb65f('0x44')](handleError(_0x4ce05f,null));};function getBucketslist(_0x30ca8c,_0x569a10,_0x4e83f2){return new Promise(function(_0x2f922b,_0x312e6c){var _0x268cb2=new AWS['S3']({'accessKeyId':_0x569a10,'secretAccessKey':_0x30ca8c,'region':_0x4e83f2});_0x268cb2[_0xb65f('0x6a')]({},function(_0xa22362,_0x3ae32b){if(_0xa22362){return _0x312e6c(_0xa22362);}else{return _0x2f922b(_0x3ae32b);}});});}function createBucket(_0x42bb5c,_0x2517f5,_0x497d7c,_0x27fc38){return new Promise(function(_0x4c8bae,_0x3a1fdc){var _0x5468b4=new AWS['S3']({'accessKeyId':_0x2517f5,'secretAccessKey':_0x42bb5c,'region':_0x497d7c});_0x5468b4[_0xb65f('0x6b')]({'Bucket':_0x27fc38},function(_0x33f29b,_0x147c12){if(_0x33f29b){return _0x3a1fdc(_0x33f29b);}else{return _0x4c8bae(_0x147c12);}});});}function uploadFile(_0x1a6a35,_0x2ea2c9,_0x316e1b,_0x5f1199,_0x1fcb66,_0x1e8e0d){return new Promise(function(_0x87f3fe,_0x2b5a1b){var _0x22e18b=new AWS['S3']({'accessKeyId':_0x2ea2c9,'secretAccessKey':_0x1a6a35,'region':_0x316e1b});_0x22e18b[_0xb65f('0x6c')]({'Bucket':_0x5f1199,'Key':_0x1fcb66,'Body':_0x1e8e0d},function(_0x27cd95,_0x748390){if(_0x27cd95){return _0x2b5a1b(_0x27cd95);}else{return _0x87f3fe(_0x748390);}});});}function startTranscribe(_0x368aa9,_0x1b0beb,_0x5b3521,_0x79db20,_0x1ad48d,_0x20665c){return new Promise(function(_0xe1cc8a,_0x2caf0f){var _0x459e81=new AWS[(_0xb65f('0x6d'))]({'accessKeyId':_0x1b0beb,'secretAccessKey':_0x368aa9,'region':_0x5b3521});_0x459e81['startTranscriptionJob']({'TranscriptionJobName':_0x79db20,'LanguageCode':_0x1ad48d,'Media':{'MediaFileUri':_0x20665c}},function(_0x2247a6,_0x15f084){if(_0x2247a6){return _0x2caf0f(_0x2247a6);}else{return _0xe1cc8a(_0x15f084);}});});}function transcribe(_0x1cf433,_0x5dde18,_0x5b17f2,_0x9ef7dc,_0x3dc1ee,_0x5d1819,_0x238025){return new Promise(function(_0x4c8267,_0x294475){var _0x4e6093={};logger[_0xb65f('0x64')](util['format'](_0xb65f('0x6e'),_0x1cf433,_0x3dc1ee));return uploadFile(_0x5dde18,_0x5b17f2,_0x9ef7dc,_0x3dc1ee,path[_0xb65f('0x6f')](_0x5d1819),fs[_0xb65f('0x70')](_0x5d1819))[_0xb65f('0x25')](function(_0x505717){logger[_0xb65f('0x64')](util['format'](_0xb65f('0x71'),_0x1cf433,_0x3dc1ee,_0x505717['Location']));_0x4e6093[_0xb65f('0x72')]=_0x505717[_0xb65f('0x73')];_0x4e6093['location']=_0x505717[_0xb65f('0x74')];logger[_0xb65f('0x64')](util[_0xb65f('0x33')](_0xb65f('0x75'),_0x1cf433));return startTranscribe(_0x5dde18,_0x5b17f2,_0x9ef7dc,uuidv4(),_0x238025,_0x505717['Location']);})[_0xb65f('0x25')](function(_0x53faeb){logger['info'](util['format'](_0xb65f('0x76'),_0x1cf433,_0x53faeb[_0xb65f('0x77')]['TranscriptionJobName']));_0x4e6093[_0xb65f('0x78')]=_0x53faeb[_0xb65f('0x77')]['TranscriptionJobName'];_0x4e6093[_0xb65f('0x79')]=_0x53faeb[_0xb65f('0x77')][_0xb65f('0x7a')];return _0x4c8267(_0x4e6093);})[_0xb65f('0x44')](function(_0x354773){return _0x294475(_0x354773);});});}exports[_0xb65f('0x7b')]=function(_0x2b99f7,_0x504b36,_0x4bd4c9){var _0xc752fa;var _0x5d6955;var _0x4beea9;var _0x297ace=require(_0xb65f('0x5b'));return db['VoiceRecording'][_0xb65f('0x7c')]({'where':{'id':_0x2b99f7[_0xb65f('0x46')]['id']}})['then'](function(_0x42d189){if(_0x42d189){var _0x4bde65=util[_0xb65f('0x33')]('%s.cypher',_0x42d189[_0xb65f('0x4e')]);if(fs[_0xb65f('0x50')](_0x4bde65)){cypher=!![];return _0x297ace[_0xb65f('0x51')](_0x4bde65,_0x42d189[_0xb65f('0x4e')],config[_0xb65f('0x52')]['recording'])['then'](function(){return _0x42d189;});}return _0x42d189;}})[_0xb65f('0x25')](function(_0x4c6b49){if(!_0x4c6b49){throw new db[(_0xb65f('0x54'))]['ValidationError'](_0xb65f('0x7d'));}_0x5d6955=_0x4c6b49;return db[_0xb65f('0x7e')][_0xb65f('0x7c')]({'where':{'id':0x1}});})[_0xb65f('0x25')](handleEntityNotFound(_0x504b36,null))['then'](function(_0x4d5650){if(_0x4d5650){_0xc752fa=_0x4d5650;if(!_0xc752fa[_0xb65f('0x7f')]||!_0xc752fa[_0xb65f('0x80')]||!_0xc752fa[_0xb65f('0x81')]||!_0xc752fa['language']||!_0xc752fa[_0xb65f('0x72')]){throw new db[(_0xb65f('0x54'))][(_0xb65f('0x62'))](_0xb65f('0x82'));}if(_0x2b99f7[_0xb65f('0x4b')]['runSentiment']&&(!_0xc752fa['sentiment']||!_0xc752fa[_0xb65f('0x83')]||!_0xc752fa[_0xb65f('0x84')]||!_0xc752fa[_0xb65f('0x85')]||!_0xc752fa[_0xb65f('0x72')])){throw new db[(_0xb65f('0x54'))]['ValidationError'](_0xb65f('0x86'));}return db[_0xb65f('0x87')][_0xb65f('0x7c')]({'where':{'id':_0xc752fa[_0xb65f('0x80')]}});}})[_0xb65f('0x25')](function(_0x8411a5){if(!_0x8411a5){throw new db[(_0xb65f('0x54'))][(_0xb65f('0x62'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x8411a5[_0xb65f('0x88')]||!_0x8411a5[_0xb65f('0x89')]){throw new db['Sequelize'][(_0xb65f('0x62'))](_0xb65f('0x8a'));}_0x4beea9=_0x8411a5;return getBucketslist(_0x4beea9[_0xb65f('0x88')],_0x4beea9[_0xb65f('0x89')],_0xc752fa[_0xb65f('0x81')]);})[_0xb65f('0x25')](function(_0x3c2e05){if(_0x3c2e05&&_0x3c2e05[_0xb65f('0x8b')]){var _0x3d9db1=_[_0xb65f('0x49')](_0x3c2e05['Buckets'],function(_0x2df84d){return _0x2df84d[_0xb65f('0x8c')]===_0xc752fa[_0xb65f('0x72')];});if(!_0x3d9db1){logger[_0xb65f('0x64')](util['format'](_0xb65f('0x8d'),_0x2b99f7[_0xb65f('0x46')]['id'],_0xc752fa['bucket']));return createBucket(_0x4beea9[_0xb65f('0x88')],_0x4beea9[_0xb65f('0x89')],_0xc752fa[_0xb65f('0x81')],_0xc752fa[_0xb65f('0x72')]);}logger[_0xb65f('0x64')](util[_0xb65f('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2b99f7[_0xb65f('0x46')]['id'],_0xc752fa['bucket']));return;}})[_0xb65f('0x25')](function(_0x3bd39f){if(_0x5d6955[_0xb65f('0x79')]===_0xb65f('0x8e')){return transcribe(_0x2b99f7['params']['id'],_0x4beea9[_0xb65f('0x88')],_0x4beea9[_0xb65f('0x89')],_0xc752fa[_0xb65f('0x81')],_0xc752fa[_0xb65f('0x72')],_0x5d6955[_0xb65f('0x4e')],_0xc752fa[_0xb65f('0x85')]);}else{logger[_0xb65f('0x64')](util[_0xb65f('0x33')](_0xb65f('0x8f'),_0x2b99f7[_0xb65f('0x46')]['id']));return{'transcribeStatus':_0xb65f('0x90')};}})[_0xb65f('0x25')](function(_0x5ebde3){if(_0x5ebde3){_0x5ebde3[_0xb65f('0x91')]=_0x2b99f7['body'][_0xb65f('0x92')];return _0x5d6955['updateAttributes'](_0x5ebde3);}})[_0xb65f('0x25')](respondWithResult(_0x504b36,null))[_0xb65f('0x44')](handleError(_0x504b36,null));};function writeFile(_0x18f042,_0x4a2fe2){return new Promise(function(_0x4996ad,_0x433359){fs[_0xb65f('0x93')](_0x4a2fe2,_0x18f042,function(_0x280337,_0x384dbd){if(_0x280337){return _0x433359(_0x280337);}else{return _0x4996ad(_0x384dbd);}});});}exports[_0xb65f('0x94')]=function(_0x227327,_0x21e862,_0x1ed283){return db[_0xb65f('0x2c')]['findOne']({'where':{'id':_0x227327[_0xb65f('0x46')]['id']}})[_0xb65f('0x25')](handleEntityNotFound(_0x21e862))[_0xb65f('0x25')](function(_0x3dd2c7){if(_0x3dd2c7&&_0x3dd2c7[_0xb65f('0x95')]){var _0x46d907=_0x3dd2c7[_0xb65f('0x95')];var _0x55b7c5=config[_0xb65f('0x96')]+'/server/files/transcribes/transcribe_'+_0x3dd2c7['id']+_0xb65f('0x97');if(fs['existsSync'](_0x55b7c5)){return _0x55b7c5;}return writeFile(_0x46d907,_0x55b7c5)['then'](function(){return _0x55b7c5;});}else{throw new db['Sequelize']['ValidationError'](_0xb65f('0x98'));}})['then'](function(_0x49d6af){return _0x21e862['download'](_0x49d6af);})[_0xb65f('0x44')](handleError(_0x21e862));}; \ No newline at end of file +var _0xe80c=['VoiceRecording','fieldName','type','model','differenceBy','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','include','rows','catch','show','params','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','$and','push','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map'];(function(_0x3b3392,_0x548235){var _0x4e1267=function(_0x358a22){while(--_0x358a22){_0x3b3392['push'](_0x3b3392['shift']());}};_0x4e1267(++_0x548235);}(_0xe80c,0x10b));var _0xce80=function(_0x50c8e8,_0x11a850){_0x50c8e8=_0x50c8e8-0x0;var _0x521ce2=_0xe80c[_0x50c8e8];return _0x521ce2;};'use strict';var pdf=require(_0xce80('0x0'));var emlformat=require(_0xce80('0x1'));var rimraf=require(_0xce80('0x2'));var zipdir=require(_0xce80('0x3'));var jsonpatch=require(_0xce80('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce80('0x5'));var Mustache=require('mustache');var util=require(_0xce80('0x6'));var path=require('path');var sox=require(_0xce80('0x7'));var csv=require(_0xce80('0x8'));var ejs=require(_0xce80('0x9'));var fs=require('fs');var _=require(_0xce80('0xa'));var squel=require(_0xce80('0xb'));var crypto=require('crypto');var jsforce=require(_0xce80('0xc'));var deskjs=require(_0xce80('0xd'));var toCsv=require(_0xce80('0x8'));var querystring=require(_0xce80('0xe'));var Papa=require('papaparse');var AWS=require(_0xce80('0xf'));var uuidv4=require(_0xce80('0x10'));var Redis=require(_0xce80('0x11'));var authService=require(_0xce80('0x12'));var qs=require(_0xce80('0x13'));var as=require(_0xce80('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce80('0x15'));var utils=require(_0xce80('0x16'));var config=require('../../config/environment');var db=require(_0xce80('0x17'))['db'];function respondWithStatusCode(_0x378e7c,_0x22b10b){_0x22b10b=_0x22b10b||0xcc;return function(_0x2e547a){if(_0x2e547a){return _0x378e7c[_0xce80('0x18')](_0x22b10b);}return _0x378e7c[_0xce80('0x19')](_0x22b10b)[_0xce80('0x1a')]();};}function respondWithResult(_0x38b76d,_0x3c554a){_0x3c554a=_0x3c554a||0xc8;return function(_0x5d7f6e){if(_0x5d7f6e){return _0x38b76d['status'](_0x3c554a)[_0xce80('0x1b')](_0x5d7f6e);}};}function respondWithFilteredResult(_0x2fc474,_0x11d977){return function(_0x1f1ed7){if(_0x1f1ed7){var _0x158463=_0x1f1ed7['count'],_0x3bbb0d=_0x11d977[_0xce80('0x1c')],_0x435bf0=_0x11d977[_0xce80('0x1c')]+_0x11d977['limit'],_0x771394;if(_0x435bf0>=_0x158463){_0x435bf0=_0x158463;_0x771394=0xc8;}else{_0x771394=0xce;}_0x2fc474['status'](_0x771394);return _0x2fc474[_0xce80('0x1d')](_0xce80('0x1e'),_0x3bbb0d+'-'+_0x435bf0+'/'+_0x158463)[_0xce80('0x1b')](_0x1f1ed7);}return null;};}function patchUpdates(_0x5d1e7e){return function(_0x2e12d0){try{jsonpatch[_0xce80('0x1f')](_0x2e12d0,_0x5d1e7e,!![]);}catch(_0x4fba95){return BPromise[_0xce80('0x20')](_0x4fba95);}return _0x2e12d0['save']();};}function saveUpdates(_0x19de0d,_0x2899e7){return function(_0x293f4f){if(_0x293f4f){return _0x293f4f[_0xce80('0x21')](_0x19de0d)[_0xce80('0x22')](function(_0x5ce7a5){return _0x5ce7a5;});}return null;};}function removeEntity(_0x4e6a0e,_0x46d5f7){return function(_0x29af64){if(_0x29af64){return _0x29af64[_0xce80('0x23')]()[_0xce80('0x22')](function(){_0x4e6a0e['status'](0xcc)[_0xce80('0x1a')]();});}};}function handleEntityNotFound(_0x2d7111,_0x3f1efd){return function(_0x3259cd){if(!_0x3259cd){_0x2d7111[_0xce80('0x18')](0x194);}return _0x3259cd;};}function handleError(_0x2b6c34,_0x51971e){_0x51971e=_0x51971e||0x1f4;return function(_0x333e8d){logger[_0xce80('0x24')](_0x333e8d['stack']);if(_0x333e8d[_0xce80('0x25')]){delete _0x333e8d[_0xce80('0x25')];}_0x2b6c34[_0xce80('0x19')](_0x51971e)[_0xce80('0x26')](_0x333e8d);};}exports[_0xce80('0x27')]=function(_0x1baccb,_0x27bedf){var _0x3f0085={},_0x4c6156={},_0x431a36={'count':0x0,'rows':[]};var _0x57cd14=_[_0xce80('0x28')](db[_0xce80('0x29')]['rawAttributes'],function(_0x3e1d8b){return{'name':_0x3e1d8b[_0xce80('0x2a')],'type':_0x3e1d8b[_0xce80('0x2b')]['key']};});_0x4c6156[_0xce80('0x2c')]=_[_0xce80('0x2d')](_[_0xce80('0x28')](_0x57cd14,_0xce80('0x25')),[_0xce80('0x2e')]);_0x4c6156[_0xce80('0x2f')]=_[_0xce80('0x30')](_0x1baccb[_0xce80('0x2f')]);_0x4c6156['filters']=_[_0xce80('0x31')](_0x4c6156[_0xce80('0x2c')],_0x4c6156[_0xce80('0x2f')]);_0x3f0085['attributes']=_[_0xce80('0x31')](_0x4c6156['model'],qs[_0xce80('0x32')](_0x1baccb[_0xce80('0x2f')]['fields']));_0x3f0085[_0xce80('0x33')]=_0x3f0085[_0xce80('0x33')][_0xce80('0x34')]?_0x3f0085['attributes']:_0x4c6156['model'];if(!_0x1baccb[_0xce80('0x2f')][_0xce80('0x35')](_0xce80('0x36'))){_0x3f0085[_0xce80('0x37')]=qs[_0xce80('0x37')](_0x1baccb['query']['limit']);_0x3f0085[_0xce80('0x1c')]=qs[_0xce80('0x1c')](_0x1baccb[_0xce80('0x2f')][_0xce80('0x1c')]);}_0x3f0085[_0xce80('0x38')]=qs[_0xce80('0x39')](_0x1baccb['query']['sort']);_0x3f0085[_0xce80('0x3a')]=qs[_0xce80('0x3b')](_['pick'](_0x1baccb[_0xce80('0x2f')],_0x4c6156[_0xce80('0x3b')]),_0x57cd14);if(_0x1baccb['query']['filter']){_0x3f0085['where']=_[_0xce80('0x3c')](_0x3f0085[_0xce80('0x3a')],{'$or':_[_0xce80('0x28')](_0x57cd14,function(_0xbfd695){if(_0xbfd695['type']!==_0xce80('0x3d')){var _0x20d37a={};_0x20d37a[_0xbfd695['name']]={'$like':'%'+_0x1baccb['query'][_0xce80('0x3e')]+'%'};return _0x20d37a;}})});}_0x3f0085=_[_0xce80('0x3c')]({},_0x3f0085,_0x1baccb[_0xce80('0x3f')]);var _0x1ce45c={'where':_0x3f0085['where']};return db['VoiceRecording'][_0xce80('0x40')](_0x1ce45c)[_0xce80('0x22')](function(_0x36d952){_0x431a36[_0xce80('0x40')]=_0x36d952;if(_0x1baccb[_0xce80('0x2f')]['includeAll']){_0x3f0085[_0xce80('0x41')]=[{'all':!![]}];}return db[_0xce80('0x29')]['findAll'](_0x3f0085);})['then'](function(_0x4bdaba){_0x431a36[_0xce80('0x42')]=_0x4bdaba;return _0x431a36;})[_0xce80('0x22')](respondWithFilteredResult(_0x27bedf,_0x3f0085))[_0xce80('0x43')](handleError(_0x27bedf,null));};exports[_0xce80('0x44')]=function(_0x105879,_0x533199){var _0xb17496={'raw':![],'where':{'id':_0x105879[_0xce80('0x45')]['id']}},_0x24418b={};_0x24418b[_0xce80('0x2c')]=_['keys'](db[_0xce80('0x29')]['rawAttributes']);_0x24418b[_0xce80('0x2f')]=_[_0xce80('0x30')](_0x105879['query']);_0x24418b['filters']=_[_0xce80('0x31')](_0x24418b['model'],_0x24418b[_0xce80('0x2f')]);_0xb17496[_0xce80('0x33')]=_[_0xce80('0x31')](_0x24418b[_0xce80('0x2c')],qs[_0xce80('0x32')](_0x105879[_0xce80('0x2f')][_0xce80('0x32')]));_0xb17496[_0xce80('0x33')]=_0xb17496[_0xce80('0x33')][_0xce80('0x34')]?_0xb17496[_0xce80('0x33')]:_0x24418b[_0xce80('0x2c')];if(_0x105879[_0xce80('0x2f')][_0xce80('0x46')]){_0xb17496[_0xce80('0x41')]=[{'all':!![]}];}_0xb17496=_['merge']({},_0xb17496,_0x105879[_0xce80('0x3f')]);return db[_0xce80('0x29')][_0xce80('0x47')](_0xb17496)['then'](handleEntityNotFound(_0x533199,null))[_0xce80('0x22')](respondWithResult(_0x533199,null))[_0xce80('0x43')](handleError(_0x533199,null));};exports[_0xce80('0x48')]=function(_0x901a74,_0x19e2f7){return db['VoiceRecording'][_0xce80('0x48')](_0x901a74['body'],{})[_0xce80('0x22')](respondWithResult(_0x19e2f7,0xc9))[_0xce80('0x43')](handleError(_0x19e2f7,null));};exports['update']=function(_0x38add8,_0x11eb24){if(_0x38add8['body']['id']){delete _0x38add8[_0xce80('0x49')]['id'];}return db[_0xce80('0x29')][_0xce80('0x47')]({'where':{'id':_0x38add8[_0xce80('0x45')]['id']}})['then'](handleEntityNotFound(_0x11eb24,null))[_0xce80('0x22')](saveUpdates(_0x38add8[_0xce80('0x49')],null))[_0xce80('0x22')](respondWithResult(_0x11eb24,null))[_0xce80('0x43')](handleError(_0x11eb24,null));};exports[_0xce80('0x4a')]=function(_0x4b0acb,_0x55c724){return db['VoiceRecording'][_0xce80('0x4a')]()[_0xce80('0x22')](respondWithResult(_0x55c724,null))['catch'](handleError(_0x55c724,null));};exports[_0xce80('0x4b')]=function(_0x1cf20d,_0x3286f4,_0x5f1fa6){var _0x2584a8=require(_0xce80('0x4c'));var _0x254332=![];var _0x1bf96a={};if(_0x1cf20d[_0xce80('0x2f')][_0xce80('0x2b')]&&_0x1cf20d[_0xce80('0x2f')][_0xce80('0x2b')]==='uniqueid'){_0x1bf96a[_0xce80('0x4d')]=_0x1cf20d[_0xce80('0x45')]['id'];}else{_0x1bf96a['id']=_0x1cf20d['params']['id'];}return db[_0xce80('0x29')][_0xce80('0x47')]({'where':_0x1bf96a,'attributes':['id',_0xce80('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x3286f4,null))['then'](function(_0x29e75d){if(_0x29e75d){var _0x40a37b=_0x29e75d[_0xce80('0x4e')];var _0x4a2e50=util['format'](_0xce80('0x4f'),_0x40a37b);if(fs[_0xce80('0x50')](_0x4a2e50)){_0x254332=!![];return _0x2584a8[_0xce80('0x51')](_0x4a2e50,_0x40a37b,config[_0xce80('0x52')][_0xce80('0x53')])[_0xce80('0x22')](function(){return _0x29e75d;});}return _0x29e75d;}})[_0xce80('0x22')](function(_0x3f34d8){if(_0x3f34d8){var _0xd22eb9=_0x3f34d8[_0xce80('0x4e')];if(!fs['existsSync'](_0xd22eb9)){throw new db[(_0xce80('0x54'))][(_0xce80('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x3f34d8[_0xce80('0x56')]){return _0x3286f4[_0xce80('0x4b')](_0xd22eb9,_0x3f34d8['filename']+path['extname'](_0xd22eb9),function(){if(_0x254332){fs[_0xce80('0x57')](_0xd22eb9);}});}else{return _0x3286f4[_0xce80('0x4b')](_0xd22eb9,function(_0x4d2834){if(_0x254332){fs[_0xce80('0x57')](_0xd22eb9);}});}}})['catch'](function(_0x331cc3){if(_0x331cc3[_0xce80('0x58')]===_0xce80('0x59')){_0x3286f4[_0xce80('0x19')](0x194)[_0xce80('0x26')](_0xce80('0x5a'));}else{return handleError(_0x3286f4,null);}});};exports[_0xce80('0x5b')]=function(_0x126a96,_0x3808ed,_0xa9293e){var _0x27c27f=require('../../components/encryptor');var _0x9dbefb=![];var _0x6e6c63={'$and':[db[_0xce80('0x5c')]['where'](db[_0xce80('0x5c')]['fn'](_0xce80('0x5d'),db[_0xce80('0x5c')][_0xce80('0x5e')]('uniqueid')),_0x126a96[_0xce80('0x2f')]['token'])]};if(_0x126a96[_0xce80('0x2f')][_0xce80('0x2b')]&&_0x126a96['query'][_0xce80('0x2b')]===_0xce80('0x4d')){_0x6e6c63[_0xce80('0x5f')]['push']({'uniqueid':_0x126a96[_0xce80('0x45')]['id']});}else{_0x6e6c63[_0xce80('0x5f')][_0xce80('0x60')]({'id':_0x126a96[_0xce80('0x45')]['id']});}return db[_0xce80('0x29')][_0xce80('0x47')]({'where':_0x6e6c63,'attributes':['id','value'],'raw':!![]})[_0xce80('0x22')](handleEntityNotFound(_0x3808ed,null))['then'](function(_0x412203){if(_0x412203){var _0x14cc00=util['format']('%s.cypher',_0x412203['value']);if(fs[_0xce80('0x50')](_0x14cc00)){_0x9dbefb=!![];return _0x27c27f[_0xce80('0x51')](_0x14cc00,_0x412203[_0xce80('0x4e')],config[_0xce80('0x52')][_0xce80('0x53')])[_0xce80('0x22')](function(){return _0x412203;});}return _0x412203;}})['then'](function(_0x11d9a0){if(_0x11d9a0){if(!fs[_0xce80('0x50')](_0x11d9a0[_0xce80('0x4e')])){throw new db['Sequelize'][(_0xce80('0x55'))](_0xce80('0x59'));}if(_0x11d9a0[_0xce80('0x56')]){return _0x3808ed[_0xce80('0x4b')](_0x11d9a0[_0xce80('0x4e')],_0x11d9a0['filename']+path[_0xce80('0x61')](_0x11d9a0['value']),function(){if(_0x9dbefb){fs[_0xce80('0x57')](_0x11d9a0[_0xce80('0x4e')]);}});}else{return _0x3808ed[_0xce80('0x4b')](_0x11d9a0[_0xce80('0x4e')],function(_0x2ed4d5){if(_0x9dbefb){fs[_0xce80('0x57')](_0x11d9a0[_0xce80('0x4e')]);}});}}})[_0xce80('0x43')](handleError(_0x3808ed,null));};exports[_0xce80('0x23')]=function(_0x476267,_0x24afcd){return db[_0xce80('0x29')][_0xce80('0x47')]({'where':{'id':_0x476267[_0xce80('0x45')]['id']}})['then'](function(_0x5d5284){if(!_0x5d5284)throw new ReferenceError(_0xce80('0x62'));return _0x5d5284;})[_0xce80('0x22')](function(_0x4b47de){var _0x377fe7=_0x4b47de[_0xce80('0x4e')];logger[_0xce80('0x63')](_0xce80('0x64'),_0x377fe7);if(!_[_0xce80('0x65')](_0x4b47de[_0xce80('0x4e')])&&fs[_0xce80('0x50')](_0x377fe7)){logger['info']('File:\x20\x22'+_0x377fe7+_0xce80('0x66'));fs[_0xce80('0x67')](_0x377fe7);}_0x377fe7=_0x377fe7+_0xce80('0x68');if(!_['isNil'](_0x4b47de['value'])&&fs[_0xce80('0x50')](_0x377fe7)){logger[_0xce80('0x63')]('File:\x20\x22'+_0x377fe7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xce80('0x67')](_0x377fe7);}return _0x4b47de;})[_0xce80('0x22')](function(_0x52355a){if(!_0x52355a)throw new InternalError();return _0x52355a['destroy']();})[_0xce80('0x22')](function(){_0x24afcd['status'](0xcc)[_0xce80('0x1a')]();})[_0xce80('0x43')](handleError(_0x24afcd,null));};function getBucketslist(_0x1b9c90,_0x71c601,_0x36e2c3){return new Promise(function(_0x10b2ef,_0x1fdfbe){var _0x3bee2d=new AWS['S3']({'accessKeyId':_0x71c601,'secretAccessKey':_0x1b9c90,'region':_0x36e2c3});_0x3bee2d[_0xce80('0x69')]({},function(_0x326b63,_0x585084){if(_0x326b63){return _0x1fdfbe(_0x326b63);}else{return _0x10b2ef(_0x585084);}});});}function createBucket(_0x3d0137,_0x4db04b,_0x48a4c2,_0x3ff8dd){return new Promise(function(_0x321112,_0x371066){var _0x2a50bb=new AWS['S3']({'accessKeyId':_0x4db04b,'secretAccessKey':_0x3d0137,'region':_0x48a4c2});_0x2a50bb[_0xce80('0x6a')]({'Bucket':_0x3ff8dd},function(_0x4c71af,_0xe17047){if(_0x4c71af){return _0x371066(_0x4c71af);}else{return _0x321112(_0xe17047);}});});}function uploadFile(_0x545b70,_0x539a23,_0x1d9704,_0x4f16d9,_0x31c2ad,_0x54b244){return new Promise(function(_0x533339,_0x38828e){var _0x20617f=new AWS['S3']({'accessKeyId':_0x539a23,'secretAccessKey':_0x545b70,'region':_0x1d9704});_0x20617f[_0xce80('0x6b')]({'Bucket':_0x4f16d9,'Key':_0x31c2ad,'Body':_0x54b244},function(_0xf787b5,_0x40f05e){if(_0xf787b5){return _0x38828e(_0xf787b5);}else{return _0x533339(_0x40f05e);}});});}function startTranscribe(_0x4d2673,_0x5b965a,_0x573944,_0x3f095b,_0x1cf3d5,_0x35f6f8){return new Promise(function(_0x225c82,_0x4651b2){var _0x1c7e3d=new AWS[(_0xce80('0x6c'))]({'accessKeyId':_0x5b965a,'secretAccessKey':_0x4d2673,'region':_0x573944});_0x1c7e3d[_0xce80('0x6d')]({'TranscriptionJobName':_0x3f095b,'LanguageCode':_0x1cf3d5,'Media':{'MediaFileUri':_0x35f6f8}},function(_0x3234a1,_0x2ae815){if(_0x3234a1){return _0x4651b2(_0x3234a1);}else{return _0x225c82(_0x2ae815);}});});}function transcribe(_0x443a33,_0x34a0e6,_0x2cdde8,_0x58019c,_0x18fa4a,_0x13775f,_0x145618){return new Promise(function(_0x56df6b,_0x2fa32f){var _0x13f021={};logger[_0xce80('0x63')](util[_0xce80('0x2e')](_0xce80('0x6e'),_0x443a33,_0x18fa4a));return uploadFile(_0x34a0e6,_0x2cdde8,_0x58019c,_0x18fa4a,path[_0xce80('0x6f')](_0x13775f),fs['readFileSync'](_0x13775f))[_0xce80('0x22')](function(_0x3a28db){logger[_0xce80('0x63')](util['format'](_0xce80('0x70'),_0x443a33,_0x18fa4a,_0x3a28db['Location']));_0x13f021[_0xce80('0x71')]=_0x3a28db[_0xce80('0x72')];_0x13f021[_0xce80('0x73')]=_0x3a28db[_0xce80('0x74')];logger[_0xce80('0x63')](util[_0xce80('0x2e')](_0xce80('0x75'),_0x443a33));return startTranscribe(_0x34a0e6,_0x2cdde8,_0x58019c,uuidv4(),_0x145618,_0x3a28db[_0xce80('0x74')]);})['then'](function(_0x1df9bd){logger[_0xce80('0x63')](util[_0xce80('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x443a33,_0x1df9bd[_0xce80('0x76')][_0xce80('0x77')]));_0x13f021[_0xce80('0x78')]=_0x1df9bd[_0xce80('0x76')][_0xce80('0x77')];_0x13f021[_0xce80('0x79')]=_0x1df9bd[_0xce80('0x76')][_0xce80('0x7a')];return _0x56df6b(_0x13f021);})[_0xce80('0x43')](function(_0xc79e38){return _0x2fa32f(_0xc79e38);});});}exports['runTranscribe']=function(_0x3916a2,_0x2e12c1,_0x28a06e){var _0x537bf0;var _0x542257;var _0xd0a4d;var _0x420f18=require(_0xce80('0x4c'));return db[_0xce80('0x29')][_0xce80('0x7b')]({'where':{'id':_0x3916a2[_0xce80('0x45')]['id']}})['then'](function(_0x4b4c55){if(_0x4b4c55){var _0x2b4fc1=util[_0xce80('0x2e')](_0xce80('0x4f'),_0x4b4c55[_0xce80('0x4e')]);if(fs['existsSync'](_0x2b4fc1)){cypher=!![];return _0x420f18[_0xce80('0x51')](_0x2b4fc1,_0x4b4c55[_0xce80('0x4e')],config[_0xce80('0x52')][_0xce80('0x53')])['then'](function(){return _0x4b4c55;});}return _0x4b4c55;}})[_0xce80('0x22')](function(_0x9df139){if(!_0x9df139){throw new db['Sequelize']['ValidationError'](_0xce80('0x7c'));}_0x542257=_0x9df139;return db[_0xce80('0x7d')][_0xce80('0x7b')]({'where':{'id':0x1}});})[_0xce80('0x22')](handleEntityNotFound(_0x2e12c1,null))[_0xce80('0x22')](function(_0x38dbce){if(_0x38dbce){_0x537bf0=_0x38dbce;if(!_0x537bf0[_0xce80('0x7e')]||!_0x537bf0['transcribeAccountId']||!_0x537bf0[_0xce80('0x7f')]||!_0x537bf0[_0xce80('0x80')]||!_0x537bf0[_0xce80('0x71')]){throw new db['Sequelize'][(_0xce80('0x55'))](_0xce80('0x81'));}if(_0x3916a2[_0xce80('0x49')][_0xce80('0x82')]&&(!_0x537bf0[_0xce80('0x83')]||!_0x537bf0[_0xce80('0x84')]||!_0x537bf0['sentimentRegion']||!_0x537bf0[_0xce80('0x80')]||!_0x537bf0[_0xce80('0x71')])){throw new db[(_0xce80('0x54'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xce80('0x85')][_0xce80('0x7b')]({'where':{'id':_0x537bf0[_0xce80('0x86')]}});}})[_0xce80('0x22')](function(_0x3971aa){if(!_0x3971aa){throw new db[(_0xce80('0x54'))]['ValidationError'](_0xce80('0x87'));}if(!_0x3971aa[_0xce80('0x88')]||!_0x3971aa['data2']){throw new db[(_0xce80('0x54'))][(_0xce80('0x55'))](_0xce80('0x89'));}_0xd0a4d=_0x3971aa;return getBucketslist(_0xd0a4d['data1'],_0xd0a4d['data2'],_0x537bf0['transcribeRegion']);})[_0xce80('0x22')](function(_0x5e9ea2){if(_0x5e9ea2&&_0x5e9ea2[_0xce80('0x8a')]){var _0x2e1a84=_[_0xce80('0x47')](_0x5e9ea2[_0xce80('0x8a')],function(_0x5fe064){return _0x5fe064[_0xce80('0x8b')]===_0x537bf0[_0xce80('0x71')];});if(!_0x2e1a84){logger[_0xce80('0x63')](util['format'](_0xce80('0x8c'),_0x3916a2[_0xce80('0x45')]['id'],_0x537bf0[_0xce80('0x71')]));return createBucket(_0xd0a4d[_0xce80('0x88')],_0xd0a4d[_0xce80('0x8d')],_0x537bf0['transcribeRegion'],_0x537bf0[_0xce80('0x71')]);}logger[_0xce80('0x63')](util[_0xce80('0x2e')](_0xce80('0x8e'),_0x3916a2['params']['id'],_0x537bf0[_0xce80('0x71')]));return;}})[_0xce80('0x22')](function(_0x40a93e){if(_0x542257['transcribeStatus']===_0xce80('0x8f')){return transcribe(_0x3916a2['params']['id'],_0xd0a4d['data1'],_0xd0a4d[_0xce80('0x8d')],_0x537bf0[_0xce80('0x7f')],_0x537bf0[_0xce80('0x71')],_0x542257[_0xce80('0x4e')],_0x537bf0['language']);}else{logger[_0xce80('0x63')](util[_0xce80('0x2e')](_0xce80('0x90'),_0x3916a2[_0xce80('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xce80('0x22')](function(_0x3c729f){if(_0x3c729f){_0x3c729f[_0xce80('0x91')]=_0x3916a2[_0xce80('0x49')][_0xce80('0x82')];return _0x542257[_0xce80('0x92')](_0x3c729f);}})[_0xce80('0x22')](respondWithResult(_0x2e12c1,null))[_0xce80('0x43')](handleError(_0x2e12c1,null));};function writeFile(_0x40c1e3,_0x5a75f8){return new Promise(function(_0xa2c916,_0x1c7c4f){fs[_0xce80('0x93')](_0x5a75f8,_0x40c1e3,function(_0x167668,_0x220d6d){if(_0x167668){return _0x1c7c4f(_0x167668);}else{return _0xa2c916(_0x220d6d);}});});}exports[_0xce80('0x94')]=function(_0x18b3f8,_0x16b684,_0xebd9c5){return db[_0xce80('0x29')][_0xce80('0x7b')]({'where':{'id':_0x18b3f8['params']['id']}})[_0xce80('0x22')](handleEntityNotFound(_0x16b684))['then'](function(_0x18a395){if(_0x18a395&&_0x18a395[_0xce80('0x95')]){var _0x2a5626=_0x18a395['fileText'];var _0x305421=config[_0xce80('0x96')]+_0xce80('0x97')+_0x18a395['id']+_0xce80('0x98');if(fs[_0xce80('0x50')](_0x305421)){return _0x305421;}return writeFile(_0x2a5626,_0x305421)[_0xce80('0x22')](function(){return _0x305421;});}else{throw new db[(_0xce80('0x54'))][(_0xce80('0x55'))](_0xce80('0x99'));}})[_0xce80('0x22')](function(_0x359941){return _0x16b684[_0xce80('0x4b')](_0x359941);})[_0xce80('0x43')](handleError(_0x16b684));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 38c71b5..5ef0650 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 _0xbd10=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording'];(function(_0x43f9d8,_0x4f5a7a){var _0x4c0720=function(_0xbfef72){while(--_0xbfef72){_0x43f9d8['push'](_0x43f9d8['shift']());}};_0x4c0720(++_0x4f5a7a);}(_0xbd10,0x85));var _0x0bd1=function(_0x1d09ba,_0x56233b){_0x1d09ba=_0x1d09ba-0x0;var _0x77d133=_0xbd10[_0x1d09ba];return _0x77d133;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var logger=require(_0x0bd1('0x2'))('api');var moment=require(_0x0bd1('0x3'));var BPromise=require(_0x0bd1('0x4'));var rp=require(_0x0bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var attributes=require(_0x0bd1('0x8'));module[_0x0bd1('0x9')]=function(_0x453508,_0x46c432){return _0x453508['define'](_0x0bd1('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x0bd1('0xb'),'fields':[_0x0bd1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0618=['util','api','moment','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x46eed5,_0x607464){var _0x914677=function(_0x811732){while(--_0x811732){_0x46eed5['push'](_0x46eed5['shift']());}};_0x914677(++_0x607464);}(_0x0618,0x1c6));var _0x8061=function(_0x24e91e,_0x38b947){_0x24e91e=_0x24e91e-0x0;var _0x51252c=_0x0618[_0x24e91e];return _0x51252c;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var logger=require('../../config/logger')(_0x8061('0x2'));var moment=require(_0x8061('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8061('0x4'));var rimraf=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var attributes=require(_0x8061('0x7'));module[_0x8061('0x8')]=function(_0x2c47b6,_0x1cca7f){return _0x2c47b6[_0x8061('0x9')](_0x8061('0xa'),attributes,{'tableName':_0x8061('0xb'),'paranoid':![],'indexes':[{'name':_0x8061('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 64c9dc3..88709cb 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(_0x403c57,_0x280a51){var _0x35fa69=function(_0x13a356){while(--_0x13a356){_0x403c57['push'](_0x403c57['shift']());}};_0x35fa69(++_0x280a51);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x2079e7,_0xdc5145){var _0x5a26c9=function(_0x29422d){while(--_0x29422d){_0x2079e7['push'](_0x2079e7['shift']());}};_0x5a26c9(++_0xdc5145);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 afe4fe2..efc184c 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 _0x5496=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','/:id','show','post','isAuthenticated','put','update','delete','exports','multer'];(function(_0x2c9c31,_0x36a6de){var _0x516365=function(_0x28030b){while(--_0x28030b){_0x2c9c31['push'](_0x2c9c31['shift']());}};_0x516365(++_0x36a6de);}(_0x5496,0x175));var _0x6549=function(_0x470160,_0x1a45df){_0x470160=_0x470160-0x0;var _0x84424b=_0x5496[_0x470160];return _0x84424b;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var auth=require(_0x6549('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6549('0x6'));var controller=require(_0x6549('0x7'));router[_0x6549('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6549('0x8')](_0x6549('0x9'),auth['isAuthenticated'](),controller[_0x6549('0xa')]);router[_0x6549('0xb')]('/',auth[_0x6549('0xc')](),controller['create']);router[_0x6549('0xd')](_0x6549('0x9'),auth[_0x6549('0xc')](),controller[_0x6549('0xe')]);router[_0x6549('0xf')](_0x6549('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6549('0x10')]=router; \ No newline at end of file +var _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x3f0611,_0x1b6d55){var _0x7ac001=function(_0x2e3098){while(--_0x2e3098){_0x3f0611['push'](_0x3f0611['shift']());}};_0x7ac001(++_0x1b6d55);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x542f30,_0x2bb456){_0x542f30=_0x542f30-0x0;var _0x135349=_0xbd51[_0x542f30];return _0x135349;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e52f55e..02920ff 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 _0xeac5=['blind','STRING','Yes','moment','exports','ENUM'];(function(_0x4ac729,_0x49ac8c){var _0x5493cb=function(_0x558b1a){while(--_0x558b1a){_0x4ac729['push'](_0x4ac729['shift']());}};_0x5493cb(++_0x49ac8c);}(_0xeac5,0x135));var _0x5eac=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xeac5[_0x172ed7];return _0xfa8f61;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5eac('0x0'));module[_0x5eac('0x1')]={'type':{'type':Sequelize[_0x5eac('0x2')](_0x5eac('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5eac('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5eac('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x5eac('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x5eac('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5eac('0x4')]},'transfereechannel':{'type':Sequelize[_0x5eac('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x5eac('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x5eac('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5eac('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5eac('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x5eac('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x5eac('0x4')]},'isexternal':{'type':Sequelize[_0x5eac('0x2')](_0x5eac('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6f2=['ENUM','STRING','Yes','sequelize','moment'];(function(_0x109828,_0x44c0ef){var _0x3585b7=function(_0x12e76d){while(--_0x12e76d){_0x109828['push'](_0x109828['shift']());}};_0x3585b7(++_0x44c0ef);}(_0xf6f2,0x11b));var _0x2f6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6f2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2f6f('0x0'));var moment=require(_0x2f6f('0x1'));module['exports']={'type':{'type':Sequelize[_0x2f6f('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x2f6f('0x3')]},'transfererchannel':{'type':Sequelize[_0x2f6f('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2f6f('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2f6f('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x2f6f('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x2f6f('0x3')]},'transferercontext':{'type':Sequelize[_0x2f6f('0x3')]},'transfererexten':{'type':Sequelize[_0x2f6f('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2f6f('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x2f6f('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2f6f('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2f6f('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x2f6f('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x2f6f('0x2')](_0x2f6f('0x4'),'No')},'context':{'type':Sequelize[_0x2f6f('0x3')]},'extension':{'type':Sequelize[_0x2f6f('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8a4e6d2..e888e28 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 _0x163c=['then','include','findAll','rows','catch','show','length','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x163c,0x143));var _0xc163=function(_0x1f0e48,_0x494553){_0x1f0e48=_0x1f0e48-0x0;var _0x569709=_0x163c[_0x1f0e48];return _0x569709;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc163('0x0'));var zipdir=require(_0xc163('0x1'));var jsonpatch=require(_0xc163('0x2'));var rp=require(_0xc163('0x3'));var moment=require(_0xc163('0x4'));var BPromise=require(_0xc163('0x5'));var Mustache=require(_0xc163('0x6'));var util=require(_0xc163('0x7'));var path=require(_0xc163('0x8'));var sox=require(_0xc163('0x9'));var csv=require(_0xc163('0xa'));var ejs=require(_0xc163('0xb'));var fs=require('fs');var _=require(_0xc163('0xc'));var squel=require(_0xc163('0xd'));var crypto=require(_0xc163('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc163('0xa'));var querystring=require(_0xc163('0xf'));var Papa=require(_0xc163('0x10'));var Redis=require(_0xc163('0x11'));var authService=require(_0xc163('0x12'));var qs=require(_0xc163('0x13'));var as=require(_0xc163('0x14'));var hardwareService=require(_0xc163('0x15'));var logger=require('../../config/logger')(_0xc163('0x16'));var utils=require(_0xc163('0x17'));var config=require(_0xc163('0x18'));var db=require(_0xc163('0x19'))['db'];function respondWithStatusCode(_0x17ea85,_0x4136e9){_0x4136e9=_0x4136e9||0xcc;return function(_0x13c60e){if(_0x13c60e){return _0x17ea85['sendStatus'](_0x4136e9);}return _0x17ea85['status'](_0x4136e9)[_0xc163('0x1a')]();};}function respondWithResult(_0x26a023,_0x9791){_0x9791=_0x9791||0xc8;return function(_0x5ee766){if(_0x5ee766){return _0x26a023[_0xc163('0x1b')](_0x9791)[_0xc163('0x1c')](_0x5ee766);}};}function respondWithFilteredResult(_0x41048f,_0x15623c){return function(_0x47f1af){if(_0x47f1af){var _0x58b0c1=_0x47f1af['count'],_0x5f107f=_0x15623c[_0xc163('0x1d')],_0x4ed69c=_0x15623c[_0xc163('0x1d')]+_0x15623c[_0xc163('0x1e')],_0x576e2a;if(_0x4ed69c>=_0x58b0c1){_0x4ed69c=_0x58b0c1;_0x576e2a=0xc8;}else{_0x576e2a=0xce;}_0x41048f[_0xc163('0x1b')](_0x576e2a);return _0x41048f[_0xc163('0x1f')](_0xc163('0x20'),_0x5f107f+'-'+_0x4ed69c+'/'+_0x58b0c1)[_0xc163('0x1c')](_0x47f1af);}return null;};}function patchUpdates(_0x5a8f57){return function(_0x1f6324){try{jsonpatch[_0xc163('0x21')](_0x1f6324,_0x5a8f57,!![]);}catch(_0x1c16cf){return BPromise[_0xc163('0x22')](_0x1c16cf);}return _0x1f6324[_0xc163('0x23')]();};}function saveUpdates(_0x15e1a1,_0x20849d){return function(_0x2b6c0d){if(_0x2b6c0d){return _0x2b6c0d[_0xc163('0x24')](_0x15e1a1)['then'](function(_0xbd234c){return _0xbd234c;});}return null;};}function removeEntity(_0x4c0c4a,_0x48ec03){return function(_0x5eb684){if(_0x5eb684){return _0x5eb684[_0xc163('0x25')]()['then'](function(){_0x4c0c4a[_0xc163('0x1b')](0xcc)[_0xc163('0x1a')]();});}};}function handleEntityNotFound(_0xf24f57,_0x1a28af){return function(_0x438644){if(!_0x438644){_0xf24f57[_0xc163('0x26')](0x194);}return _0x438644;};}function handleError(_0xbc4489,_0x2acdd2){_0x2acdd2=_0x2acdd2||0x1f4;return function(_0xbfcf4f){logger[_0xc163('0x27')](_0xbfcf4f[_0xc163('0x28')]);if(_0xbfcf4f[_0xc163('0x29')]){delete _0xbfcf4f[_0xc163('0x29')];}_0xbc4489[_0xc163('0x1b')](_0x2acdd2)[_0xc163('0x2a')](_0xbfcf4f);};}exports[_0xc163('0x2b')]=function(_0x4d59c6,_0x31eb3d){var _0x4a0072={},_0xc7e278={},_0x14e7a3={'count':0x0,'rows':[]};var _0x44cfe5=_[_0xc163('0x2c')](db[_0xc163('0x2d')][_0xc163('0x2e')],function(_0x2a8a45){return{'name':_0x2a8a45[_0xc163('0x2f')],'type':_0x2a8a45[_0xc163('0x30')][_0xc163('0x31')]};});_0xc7e278[_0xc163('0x32')]=_[_0xc163('0x2c')](_0x44cfe5,_0xc163('0x29'));_0xc7e278['query']=_[_0xc163('0x33')](_0x4d59c6[_0xc163('0x34')]);_0xc7e278[_0xc163('0x35')]=_[_0xc163('0x36')](_0xc7e278['model'],_0xc7e278[_0xc163('0x34')]);_0x4a0072[_0xc163('0x37')]=_[_0xc163('0x36')](_0xc7e278[_0xc163('0x32')],qs[_0xc163('0x38')](_0x4d59c6['query'][_0xc163('0x38')]));_0x4a0072[_0xc163('0x37')]=_0x4a0072[_0xc163('0x37')]['length']?_0x4a0072['attributes']:_0xc7e278[_0xc163('0x32')];if(!_0x4d59c6[_0xc163('0x34')][_0xc163('0x39')](_0xc163('0x3a'))){_0x4a0072[_0xc163('0x1e')]=qs['limit'](_0x4d59c6[_0xc163('0x34')][_0xc163('0x1e')]);_0x4a0072[_0xc163('0x1d')]=qs[_0xc163('0x1d')](_0x4d59c6[_0xc163('0x34')][_0xc163('0x1d')]);}_0x4a0072[_0xc163('0x3b')]=qs[_0xc163('0x3c')](_0x4d59c6[_0xc163('0x34')][_0xc163('0x3c')]);_0x4a0072[_0xc163('0x3d')]=qs[_0xc163('0x35')](_['pick'](_0x4d59c6[_0xc163('0x34')],_0xc7e278[_0xc163('0x35')]),_0x44cfe5);if(_0x4d59c6[_0xc163('0x34')][_0xc163('0x3e')]){_0x4a0072[_0xc163('0x3d')]=_[_0xc163('0x3f')](_0x4a0072[_0xc163('0x3d')],{'$or':_[_0xc163('0x2c')](_0x44cfe5,function(_0x36368a){if(_0x36368a[_0xc163('0x30')]!==_0xc163('0x40')){var _0x462664={};_0x462664[_0x36368a[_0xc163('0x29')]]={'$like':'%'+_0x4d59c6[_0xc163('0x34')][_0xc163('0x3e')]+'%'};return _0x462664;}})});}_0x4a0072=_[_0xc163('0x3f')]({},_0x4a0072,_0x4d59c6[_0xc163('0x41')]);var _0x1cbe2b={'where':_0x4a0072[_0xc163('0x3d')]};return db['VoiceTransferReport'][_0xc163('0x42')](_0x1cbe2b)[_0xc163('0x43')](function(_0x564b05){_0x14e7a3[_0xc163('0x42')]=_0x564b05;if(_0x4d59c6[_0xc163('0x34')]['includeAll']){_0x4a0072[_0xc163('0x44')]=[{'all':!![]}];}return db[_0xc163('0x2d')][_0xc163('0x45')](_0x4a0072);})[_0xc163('0x43')](function(_0x2cbd65){_0x14e7a3[_0xc163('0x46')]=_0x2cbd65;return _0x14e7a3;})[_0xc163('0x43')](respondWithFilteredResult(_0x31eb3d,_0x4a0072))[_0xc163('0x47')](handleError(_0x31eb3d,null));};exports[_0xc163('0x48')]=function(_0x519fb0,_0x39e274){var _0x4ec779={'raw':!![],'where':{'id':_0x519fb0['params']['id']}},_0x309e83={};_0x309e83[_0xc163('0x32')]=_[_0xc163('0x33')](db[_0xc163('0x2d')][_0xc163('0x2e')]);_0x309e83[_0xc163('0x34')]=_[_0xc163('0x33')](_0x519fb0[_0xc163('0x34')]);_0x309e83[_0xc163('0x35')]=_[_0xc163('0x36')](_0x309e83[_0xc163('0x32')],_0x309e83[_0xc163('0x34')]);_0x4ec779[_0xc163('0x37')]=_[_0xc163('0x36')](_0x309e83[_0xc163('0x32')],qs['fields'](_0x519fb0[_0xc163('0x34')][_0xc163('0x38')]));_0x4ec779['attributes']=_0x4ec779[_0xc163('0x37')][_0xc163('0x49')]?_0x4ec779[_0xc163('0x37')]:_0x309e83[_0xc163('0x32')];if(_0x519fb0[_0xc163('0x34')]['includeAll']){_0x4ec779[_0xc163('0x44')]=[{'all':!![]}];}_0x4ec779=_[_0xc163('0x3f')]({},_0x4ec779,_0x519fb0['options']);return db[_0xc163('0x2d')][_0xc163('0x4a')](_0x4ec779)[_0xc163('0x43')](handleEntityNotFound(_0x39e274,null))[_0xc163('0x43')](respondWithResult(_0x39e274,null))[_0xc163('0x47')](handleError(_0x39e274,null));};exports[_0xc163('0x4b')]=function(_0x7c2171,_0x20989d){return db[_0xc163('0x2d')][_0xc163('0x4b')](_0x7c2171['body'],{})[_0xc163('0x43')](respondWithResult(_0x20989d,0xc9))['catch'](handleError(_0x20989d,null));};exports[_0xc163('0x24')]=function(_0x265b4b,_0x6a675f){if(_0x265b4b[_0xc163('0x4c')]['id']){delete _0x265b4b[_0xc163('0x4c')]['id'];}return db[_0xc163('0x2d')][_0xc163('0x4a')]({'where':{'id':_0x265b4b[_0xc163('0x4d')]['id']}})[_0xc163('0x43')](handleEntityNotFound(_0x6a675f,null))[_0xc163('0x43')](saveUpdates(_0x265b4b['body'],null))[_0xc163('0x43')](respondWithResult(_0x6a675f,null))[_0xc163('0x47')](handleError(_0x6a675f,null));};exports[_0xc163('0x25')]=function(_0x3af34b,_0x15c635){return db[_0xc163('0x2d')][_0xc163('0x4a')]({'where':{'id':_0x3af34b[_0xc163('0x4d')]['id']}})['then'](handleEntityNotFound(_0x15c635,null))['then'](removeEntity(_0x15c635,null))['catch'](handleError(_0x15c635,null));}; \ No newline at end of file +var _0xdccd=['VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','params','destroy','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0xdccd,0x1bc));var _0xddcc=function(_0x3cc5ac,_0x46b2b3){_0x3cc5ac=_0x3cc5ac-0x0;var _0x32eff5=_0xdccd[_0x3cc5ac];return _0x32eff5;};'use strict';var pdf=require(_0xddcc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xddcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddcc('0x2'));var rp=require(_0xddcc('0x3'));var moment=require('moment');var BPromise=require(_0xddcc('0x4'));var Mustache=require(_0xddcc('0x5'));var util=require(_0xddcc('0x6'));var path=require(_0xddcc('0x7'));var sox=require(_0xddcc('0x8'));var csv=require(_0xddcc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xddcc('0xa'));var squel=require(_0xddcc('0xb'));var crypto=require('crypto');var jsforce=require(_0xddcc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xddcc('0x9'));var querystring=require(_0xddcc('0xd'));var Papa=require(_0xddcc('0xe'));var Redis=require(_0xddcc('0xf'));var authService=require(_0xddcc('0x10'));var qs=require(_0xddcc('0x11'));var as=require(_0xddcc('0x12'));var hardwareService=require(_0xddcc('0x13'));var logger=require(_0xddcc('0x14'))(_0xddcc('0x15'));var utils=require('../../config/utils');var config=require(_0xddcc('0x16'));var db=require(_0xddcc('0x17'))['db'];function respondWithStatusCode(_0x40d8de,_0x47c042){_0x47c042=_0x47c042||0xcc;return function(_0x145c35){if(_0x145c35){return _0x40d8de[_0xddcc('0x18')](_0x47c042);}return _0x40d8de['status'](_0x47c042)['end']();};}function respondWithResult(_0x373109,_0x58527c){_0x58527c=_0x58527c||0xc8;return function(_0x19e33a){if(_0x19e33a){return _0x373109[_0xddcc('0x19')](_0x58527c)[_0xddcc('0x1a')](_0x19e33a);}};}function respondWithFilteredResult(_0x28a162,_0x242960){return function(_0x16a597){if(_0x16a597){var _0x376b3a=_0x16a597[_0xddcc('0x1b')],_0xae9400=_0x242960[_0xddcc('0x1c')],_0x52824b=_0x242960[_0xddcc('0x1c')]+_0x242960[_0xddcc('0x1d')],_0x3e6132;if(_0x52824b>=_0x376b3a){_0x52824b=_0x376b3a;_0x3e6132=0xc8;}else{_0x3e6132=0xce;}_0x28a162[_0xddcc('0x19')](_0x3e6132);return _0x28a162[_0xddcc('0x1e')](_0xddcc('0x1f'),_0xae9400+'-'+_0x52824b+'/'+_0x376b3a)[_0xddcc('0x1a')](_0x16a597);}return null;};}function patchUpdates(_0x2d5055){return function(_0x5f0d4f){try{jsonpatch[_0xddcc('0x20')](_0x5f0d4f,_0x2d5055,!![]);}catch(_0x3326ac){return BPromise[_0xddcc('0x21')](_0x3326ac);}return _0x5f0d4f[_0xddcc('0x22')]();};}function saveUpdates(_0x125a19,_0x40bfad){return function(_0x387751){if(_0x387751){return _0x387751[_0xddcc('0x23')](_0x125a19)[_0xddcc('0x24')](function(_0x211810){return _0x211810;});}return null;};}function removeEntity(_0x137400,_0x5bed5b){return function(_0x50647b){if(_0x50647b){return _0x50647b['destroy']()[_0xddcc('0x24')](function(){_0x137400[_0xddcc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x179d66,_0x11b2bc){return function(_0x5049c1){if(!_0x5049c1){_0x179d66[_0xddcc('0x18')](0x194);}return _0x5049c1;};}function handleError(_0xce980c,_0x495efb){_0x495efb=_0x495efb||0x1f4;return function(_0x5b649a){logger[_0xddcc('0x25')](_0x5b649a[_0xddcc('0x26')]);if(_0x5b649a[_0xddcc('0x27')]){delete _0x5b649a[_0xddcc('0x27')];}_0xce980c[_0xddcc('0x19')](_0x495efb)['send'](_0x5b649a);};}exports[_0xddcc('0x28')]=function(_0x7fdb96,_0x33cfb3){var _0x557c46={},_0x1564a0={},_0x16896d={'count':0x0,'rows':[]};var _0x3222ef=_[_0xddcc('0x29')](db[_0xddcc('0x2a')][_0xddcc('0x2b')],function(_0x27dfdb){return{'name':_0x27dfdb[_0xddcc('0x2c')],'type':_0x27dfdb[_0xddcc('0x2d')][_0xddcc('0x2e')]};});_0x1564a0[_0xddcc('0x2f')]=_[_0xddcc('0x29')](_0x3222ef,_0xddcc('0x27'));_0x1564a0[_0xddcc('0x30')]=_[_0xddcc('0x31')](_0x7fdb96[_0xddcc('0x30')]);_0x1564a0['filters']=_[_0xddcc('0x32')](_0x1564a0[_0xddcc('0x2f')],_0x1564a0[_0xddcc('0x30')]);_0x557c46[_0xddcc('0x33')]=_[_0xddcc('0x32')](_0x1564a0['model'],qs[_0xddcc('0x34')](_0x7fdb96[_0xddcc('0x30')][_0xddcc('0x34')]));_0x557c46[_0xddcc('0x33')]=_0x557c46['attributes']['length']?_0x557c46[_0xddcc('0x33')]:_0x1564a0[_0xddcc('0x2f')];if(!_0x7fdb96['query']['hasOwnProperty']('nolimit')){_0x557c46[_0xddcc('0x1d')]=qs[_0xddcc('0x1d')](_0x7fdb96[_0xddcc('0x30')][_0xddcc('0x1d')]);_0x557c46[_0xddcc('0x1c')]=qs[_0xddcc('0x1c')](_0x7fdb96['query'][_0xddcc('0x1c')]);}_0x557c46[_0xddcc('0x35')]=qs[_0xddcc('0x36')](_0x7fdb96[_0xddcc('0x30')]['sort']);_0x557c46[_0xddcc('0x37')]=qs[_0xddcc('0x38')](_[_0xddcc('0x39')](_0x7fdb96[_0xddcc('0x30')],_0x1564a0[_0xddcc('0x38')]),_0x3222ef);if(_0x7fdb96[_0xddcc('0x30')][_0xddcc('0x3a')]){_0x557c46[_0xddcc('0x37')]=_[_0xddcc('0x3b')](_0x557c46[_0xddcc('0x37')],{'$or':_[_0xddcc('0x29')](_0x3222ef,function(_0x5a698d){if(_0x5a698d[_0xddcc('0x2d')]!==_0xddcc('0x3c')){var _0x5f121f={};_0x5f121f[_0x5a698d[_0xddcc('0x27')]]={'$like':'%'+_0x7fdb96[_0xddcc('0x30')]['filter']+'%'};return _0x5f121f;}})});}_0x557c46=_['merge']({},_0x557c46,_0x7fdb96[_0xddcc('0x3d')]);var _0x4669b1={'where':_0x557c46[_0xddcc('0x37')]};return db['VoiceTransferReport'][_0xddcc('0x1b')](_0x4669b1)[_0xddcc('0x24')](function(_0x5a471c){_0x16896d[_0xddcc('0x1b')]=_0x5a471c;if(_0x7fdb96[_0xddcc('0x30')][_0xddcc('0x3e')]){_0x557c46['include']=[{'all':!![]}];}return db[_0xddcc('0x2a')][_0xddcc('0x3f')](_0x557c46);})[_0xddcc('0x24')](function(_0x181455){_0x16896d[_0xddcc('0x40')]=_0x181455;return _0x16896d;})[_0xddcc('0x24')](respondWithFilteredResult(_0x33cfb3,_0x557c46))[_0xddcc('0x41')](handleError(_0x33cfb3,null));};exports['show']=function(_0xc40607,_0x3d3718){var _0x290dd2={'raw':!![],'where':{'id':_0xc40607['params']['id']}},_0x64f15f={};_0x64f15f['model']=_[_0xddcc('0x31')](db[_0xddcc('0x2a')][_0xddcc('0x2b')]);_0x64f15f[_0xddcc('0x30')]=_['keys'](_0xc40607[_0xddcc('0x30')]);_0x64f15f['filters']=_[_0xddcc('0x32')](_0x64f15f[_0xddcc('0x2f')],_0x64f15f[_0xddcc('0x30')]);_0x290dd2[_0xddcc('0x33')]=_[_0xddcc('0x32')](_0x64f15f[_0xddcc('0x2f')],qs['fields'](_0xc40607['query'][_0xddcc('0x34')]));_0x290dd2[_0xddcc('0x33')]=_0x290dd2[_0xddcc('0x33')][_0xddcc('0x42')]?_0x290dd2['attributes']:_0x64f15f['model'];if(_0xc40607[_0xddcc('0x30')]['includeAll']){_0x290dd2[_0xddcc('0x43')]=[{'all':!![]}];}_0x290dd2=_['merge']({},_0x290dd2,_0xc40607['options']);return db[_0xddcc('0x2a')]['find'](_0x290dd2)[_0xddcc('0x24')](handleEntityNotFound(_0x3d3718,null))[_0xddcc('0x24')](respondWithResult(_0x3d3718,null))[_0xddcc('0x41')](handleError(_0x3d3718,null));};exports[_0xddcc('0x44')]=function(_0x20ca87,_0x1ca6c5){return db[_0xddcc('0x2a')][_0xddcc('0x44')](_0x20ca87['body'],{})[_0xddcc('0x24')](respondWithResult(_0x1ca6c5,0xc9))[_0xddcc('0x41')](handleError(_0x1ca6c5,null));};exports['update']=function(_0xce1142,_0x3aa715){if(_0xce1142[_0xddcc('0x45')]['id']){delete _0xce1142[_0xddcc('0x45')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0xce1142[_0xddcc('0x46')]['id']}})[_0xddcc('0x24')](handleEntityNotFound(_0x3aa715,null))['then'](saveUpdates(_0xce1142[_0xddcc('0x45')],null))['then'](respondWithResult(_0x3aa715,null))[_0xddcc('0x41')](handleError(_0x3aa715,null));};exports[_0xddcc('0x47')]=function(_0x5b5c14,_0x440ff2){return db[_0xddcc('0x2a')]['find']({'where':{'id':_0x5b5c14[_0xddcc('0x46')]['id']}})[_0xddcc('0x24')](handleEntityNotFound(_0x440ff2,null))[_0xddcc('0x24')](removeEntity(_0x440ff2,null))[_0xddcc('0x41')](handleError(_0x440ff2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4b61660..66c7360 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 _0xf434=['exports','VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x7783b3,_0x594d55){var _0x1c2c67=function(_0x9c5076){while(--_0x9c5076){_0x7783b3['push'](_0x7783b3['shift']());}};_0x1c2c67(++_0x594d55);}(_0xf434,0xce));var _0x4f43=function(_0x1c48a1,_0x100e45){_0x1c48a1=_0x1c48a1-0x0;var _0x3f3b63=_0xf434[_0x1c48a1];return _0x3f3b63;};'use strict';var _=require(_0x4f43('0x0'));var util=require(_0x4f43('0x1'));var logger=require(_0x4f43('0x2'))(_0x4f43('0x3'));var moment=require(_0x4f43('0x4'));var BPromise=require(_0x4f43('0x5'));var rp=require(_0x4f43('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f43('0x7'));var config=require(_0x4f43('0x8'));var attributes=require(_0x4f43('0x9'));module[_0x4f43('0xa')]=function(_0x572d3a,_0x2a9525){return _0x572d3a['define'](_0x4f43('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea4e=['exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','request-promise','path','rimraf','./voiceTransferReport.attributes'];(function(_0x595344,_0x509e59){var _0xadf6da=function(_0x23dfc3){while(--_0x23dfc3){_0x595344['push'](_0x595344['shift']());}};_0xadf6da(++_0x509e59);}(_0xea4e,0x10b));var _0xeea4=function(_0x20b1ca,_0xcaa99b){_0x20b1ca=_0x20b1ca-0x0;var _0x13a457=_0xea4e[_0x20b1ca];return _0x13a457;};'use strict';var _=require(_0xeea4('0x0'));var util=require(_0xeea4('0x1'));var logger=require(_0xeea4('0x2'))(_0xeea4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeea4('0x4'));var fs=require('fs');var path=require(_0xeea4('0x5'));var rimraf=require(_0xeea4('0x6'));var config=require('../../config/environment');var attributes=require(_0xeea4('0x7'));module[_0xeea4('0x8')]=function(_0x2a8cbe,_0xd156eb){return _0x2a8cbe[_0xeea4('0x9')](_0xeea4('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 5e8b5c8..afdcb96 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 _0xbeb7=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x41405b,_0x110dea){var _0x554bfa=function(_0x53ae9c){while(--_0x53ae9c){_0x41405b['push'](_0x41405b['shift']());}};_0x554bfa(++_0x110dea);}(_0xbeb7,0x183));var _0x7beb=function(_0x4b5017,_0x117e76){_0x4b5017=_0x4b5017-0x0;var _0xd9da1d=_0xbeb7[_0x4b5017];return _0xd9da1d;};'use strict';var _=require(_0x7beb('0x0'));var util=require(_0x7beb('0x1'));var moment=require(_0x7beb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7beb('0x3'));var db=require(_0x7beb('0x4'))['db'];var utils=require(_0x7beb('0x5'));var logger=require(_0x7beb('0x6'))(_0x7beb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7beb('0x8')][_0x7beb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e996,_0x454f0b,_0x5f2c2a){return new BPromise(function(_0x4ae816,_0x46c4f7){return client[_0x7beb('0xa')](_0x16e996,_0x5f2c2a)[_0x7beb('0xb')](function(_0x12927f){logger[_0x7beb('0xc')](_0x7beb('0xd'),_0x454f0b,'request\x20sent');logger['debug'](_0x7beb('0xe'),_0x454f0b,_0x7beb('0xf'),JSON[_0x7beb('0x10')](_0x12927f));if(_0x12927f[_0x7beb('0x11')]){if(_0x12927f['error'][_0x7beb('0x12')]===0x1f4){logger[_0x7beb('0x11')](_0x7beb('0xd'),_0x454f0b,_0x12927f['error'][_0x7beb('0x13')]);return _0x46c4f7(_0x12927f['error'][_0x7beb('0x13')]);}logger[_0x7beb('0x11')](_0x7beb('0xd'),_0x454f0b,_0x12927f['error'][_0x7beb('0x13')]);return _0x4ae816(_0x12927f[_0x7beb('0x11')][_0x7beb('0x13')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x454f0b,_0x7beb('0xf'));_0x4ae816(_0x12927f[_0x7beb('0x14')][_0x7beb('0x13')]);}})[_0x7beb('0x15')](function(_0x3a2f34){logger['error'](_0x7beb('0xd'),_0x454f0b,_0x3a2f34);_0x46c4f7(_0x3a2f34);});});}exports['CreateVoiceTransferReport']=function(_0x3cb837){var _0x1372bb=this;return new Promise(function(_0x5eae59,_0x4983d1){return db[_0x7beb('0x16')][_0x7beb('0x17')](_0x3cb837[_0x7beb('0x18')],{'raw':_0x3cb837[_0x7beb('0x19')]?_0x3cb837[_0x7beb('0x19')][_0x7beb('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x589389){logger[_0x7beb('0xc')](_0x7beb('0x1b'),_0x3cb837);logger['debug'](_0x7beb('0x1b'),_0x3cb837,JSON[_0x7beb('0x10')](_0x589389));_0x5eae59(_0x589389);})['catch'](function(_0x227eaf){logger[_0x7beb('0x11')](_0x7beb('0x1b'),_0x227eaf['message'],_0x3cb837);_0x4983d1(_0x1372bb['error'](0x1f4,_0x227eaf[_0x7beb('0x13')]));});});}; \ No newline at end of file +var _0x0440=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info'];(function(_0x15b1d2,_0x477ba2){var _0x33f85b=function(_0x146a3f){while(--_0x146a3f){_0x15b1d2['push'](_0x15b1d2['shift']());}};_0x33f85b(++_0x477ba2);}(_0x0440,0x109));var _0x0044=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x0440[_0x35c5a8];return _0x34782c;};'use strict';var _=require(_0x0044('0x0'));var util=require('util');var moment=require(_0x0044('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0044('0x2'));var db=require(_0x0044('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0044('0x4'))(_0x0044('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0044('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c75e,_0x433daf,_0x57d879){return new BPromise(function(_0x53ba03,_0x410214){return client[_0x0044('0x7')](_0x25c75e,_0x57d879)[_0x0044('0x8')](function(_0x3b4057){logger[_0x0044('0x9')](_0x0044('0xa'),_0x433daf,'request\x20sent');logger[_0x0044('0xb')](_0x0044('0xc'),_0x433daf,_0x0044('0xd'),JSON[_0x0044('0xe')](_0x3b4057));if(_0x3b4057[_0x0044('0xf')]){if(_0x3b4057[_0x0044('0xf')][_0x0044('0x10')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x433daf,_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);return _0x410214(_0x3b4057[_0x0044('0xf')]['message']);}logger[_0x0044('0xf')](_0x0044('0xa'),_0x433daf,_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);return _0x53ba03(_0x3b4057[_0x0044('0xf')][_0x0044('0x11')]);}else{logger[_0x0044('0x9')](_0x0044('0xa'),_0x433daf,_0x0044('0xd'));_0x53ba03(_0x3b4057[_0x0044('0x12')]['message']);}})[_0x0044('0x13')](function(_0xcd7370){logger[_0x0044('0xf')](_0x0044('0xa'),_0x433daf,_0xcd7370);_0x410214(_0xcd7370);});});}exports[_0x0044('0x14')]=function(_0x4ba251){var _0x3e46af=this;return new Promise(function(_0x129dd8,_0x1542f5){return db[_0x0044('0x15')][_0x0044('0x16')](_0x4ba251[_0x0044('0x17')],{'raw':_0x4ba251['options']?_0x4ba251['options'][_0x0044('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7386){logger[_0x0044('0x9')](_0x0044('0x14'),_0x4ba251);logger[_0x0044('0xb')](_0x0044('0x14'),_0x4ba251,JSON[_0x0044('0xe')](_0x1c7386));_0x129dd8(_0x1c7386);})['catch'](function(_0x59175a){logger[_0x0044('0xf')](_0x0044('0x14'),_0x59175a[_0x0044('0x11')],_0x4ba251);_0x1542f5(_0x3e46af[_0x0044('0xf')](0x1f4,_0x59175a['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8356d20..9deea4a 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 _0x3d15=['hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','post','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','/hold'];(function(_0x914276,_0x399164){var _0x2cf960=function(_0x372fc5){while(--_0x372fc5){_0x914276['push'](_0x914276['shift']());}};_0x2cf960(++_0x399164);}(_0x3d15,0x127));var _0x53d1=function(_0x288615,_0x4f46d0){_0x288615=_0x288615-0x0;var _0x50991d=_0x3d15[_0x288615];return _0x50991d;};'use strict';var express=require('express');var router=express[_0x53d1('0x0')]();var auth=require(_0x53d1('0x1'));var controller=require('./webbar.controller');router[_0x53d1('0x2')](_0x53d1('0x3'),auth[_0x53d1('0x4')](),auth['canUpdate'](),controller[_0x53d1('0x5')]);router[_0x53d1('0x2')](_0x53d1('0x6'),auth['isAuthenticated'](),auth[_0x53d1('0x7')](),controller[_0x53d1('0x8')]);router['post'](_0x53d1('0x9'),auth[_0x53d1('0x4')](),auth[_0x53d1('0x7')](),controller['answer']);router[_0x53d1('0x2')](_0x53d1('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x53d1('0xb')]);router['post'](_0x53d1('0xc'),auth[_0x53d1('0x4')](),auth[_0x53d1('0x7')](),controller[_0x53d1('0xd')]);router[_0x53d1('0x2')](_0x53d1('0xe'),auth[_0x53d1('0x4')](),auth[_0x53d1('0x7')](),controller['calls']);router[_0x53d1('0x2')](_0x53d1('0xf'),auth[_0x53d1('0x4')](),auth[_0x53d1('0x7')](),controller[_0x53d1('0x10')]);module[_0x53d1('0x11')]=router; \ No newline at end of file +var _0x976a=['/hold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','/hangup','/answer','answer'];(function(_0xcf2440,_0x3947da){var _0x148f2e=function(_0x279f62){while(--_0x279f62){_0xcf2440['push'](_0xcf2440['shift']());}};_0x148f2e(++_0x3947da);}(_0x976a,0xf4));var _0xa976=function(_0x234459,_0x8da0cc){_0x234459=_0x234459-0x0;var _0x2a73fb=_0x976a[_0x234459];return _0x2a73fb;};'use strict';var express=require(_0xa976('0x0'));var router=express[_0xa976('0x1')]();var auth=require(_0xa976('0x2'));var controller=require('./webbar.controller');router[_0xa976('0x3')](_0xa976('0x4'),auth[_0xa976('0x5')](),auth[_0xa976('0x6')](),controller[_0xa976('0x7')]);router[_0xa976('0x3')](_0xa976('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0xa976('0x3')](_0xa976('0x9'),auth[_0xa976('0x5')](),auth[_0xa976('0x6')](),controller[_0xa976('0xa')]);router[_0xa976('0x3')](_0xa976('0xb'),auth[_0xa976('0x5')](),auth[_0xa976('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xa976('0x5')](),auth[_0xa976('0x6')](),controller[_0xa976('0xc')]);router[_0xa976('0x3')]('/calls',auth[_0xa976('0x5')](),auth[_0xa976('0x6')](),controller[_0xa976('0xd')]);router[_0xa976('0x3')](_0xa976('0xe'),auth[_0xa976('0x5')](),auth['canUpdate'](),controller[_0xa976('0xf')]);module[_0xa976('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4247afa..ac367ec 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 _0xb332=['../../config/environment','bluebird','client','../../config/logger','ioredis','redis','defaults','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','stack','name','send','status','NotFound','request','then','error','code','message','result','User','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','json','originate\x20executed!','hangup\x20fired:','user:%s','catch','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','path','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb332,0xd9));var _0x2b33=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xb332[_0xdeac17];return _0x33aabd;};'use strict';var path=require(_0x2b33('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x2b33('0x1'))['db'];var config=require(_0x2b33('0x2'));var util=require('util');var BPromise=require(_0x2b33('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x2b33('0x4')]['http']({'port':0x232a});var logger=require(_0x2b33('0x5'))('webbarapi');var Redis=require(_0x2b33('0x6'));config[_0x2b33('0x7')]=_[_0x2b33('0x8')](config[_0x2b33('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2b33('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]},'callNumber':{'type':_0x2b33('0xb'),'required':[!![],_0x2b33('0xc')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x2b33('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]},'sessionId':{'type':_0x2b33('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]},'sessionId':{'type':_0x2b33('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]},'sessionId':{'type':_0x2b33('0xb'),'required':[!![],_0x2b33('0xd')]},'transferNumber':{'type':'string','required':[!![],_0x2b33('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2b33('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2b33('0x9'),'required':[!![],_0x2b33('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x1d8e75,_0x1d50d0,_0x409428){logger[_0x2b33('0xf')](_0x1d8e75,_0x1d50d0,JSON[_0x2b33('0x10')](_0x409428));io['to'](_0x1d8e75)['emit'](_0x1d50d0,_0x409428);}function handleError(_0x554ab3){return function(_0x59f0b6){console[_0x2b33('0x11')]('handleError:',_0x59f0b6,_0x59f0b6 instanceof RangeError);logger['error'](_0x59f0b6[_0x2b33('0x12')]);if(_0x59f0b6 instanceof RangeError){if(_0x59f0b6[_0x2b33('0x13')]){delete _0x59f0b6[_0x2b33('0x13')];}_0x554ab3['status'](0x194)[_0x2b33('0x14')](_0x59f0b6);}else{if(_0x59f0b6['name']){delete _0x59f0b6[_0x2b33('0x13')];}_0x554ab3[_0x2b33('0x15')](0x1f4)[_0x2b33('0x14')](_0x59f0b6);}};}function checkError(){return function(_0x2998dd){if(!_0x2998dd){throw new RangeError(_0x2b33('0x16'));}return _0x2998dd;};}function respondWithRpcPromise(_0x6d20b,_0x39567f){return new BPromise(function(_0x4fb725,_0x23024c){var _0x1d9c98=amiClient;return _0x1d9c98[_0x2b33('0x17')](_0x6d20b,_0x39567f)[_0x2b33('0x18')](function(_0x58998e){if(_0x58998e[_0x2b33('0x19')]){if(_0x58998e[_0x2b33('0x19')][_0x2b33('0x1a')]===0x1f4){return _0x23024c(_0x58998e['error'][_0x2b33('0x1b')]);}return _0x4fb725(_0x58998e[_0x2b33('0x19')][_0x2b33('0x1b')]);}else{_0x4fb725(_0x58998e[_0x2b33('0x1c')]);}})['catch'](function(_0x2ec9db){_0x23024c(_0x2ec9db);});});}function getAgent(_0x530098){return db[_0x2b33('0x1d')]['findOne']({'where':{'id':_0x530098,'role':_0x2b33('0x1e')}})[_0x2b33('0x18')](checkError());}function getAgentCheckSession(_0x5d8d05,_0x195aa2){return new BPromise(function(_0x53c2ad,_0x267969){var _0x5b16a8=respondWithRpcPromise(_0x2b33('0x1f'));var _0xa109f4=getAgent(_0x5d8d05);Promise[_0x2b33('0x20')]([_0x5b16a8,_0xa109f4])[_0x2b33('0x18')](function(_0xaa6643){var _0x312d4d=_0xaa6643[0x0];var _0x2be034=_0xaa6643[0x1];var _0x1fadc5=_[_0x2b33('0x21')](_0x312d4d[_0x2b33('0x22')],function(_0x4cf72f){return _0x4cf72f['UserId']==_0x2be034['id']&&_0x4cf72f[_0x2b33('0x23')]==_0x195aa2;});if(_0x1fadc5[_0x2b33('0x24')]==0x1){_0x53c2ad(_0x2be034);}else{_0x267969(new RangeError(_0x2b33('0x25')+_0x195aa2+_0x2b33('0x26')));}});});}exports[_0x2b33('0x27')]=function(_0x5893bc,_0x570765){logger[_0x2b33('0xf')](_0x2b33('0x28'),_0x5893bc[_0x2b33('0x29')]);var _0x1d2168=originateValidation[_0x2b33('0x2a')](_0x5893bc[_0x2b33('0x29')]);if(_0x1d2168['length']>0x0){return _0x570765[_0x2b33('0x15')](0x190)['json'](_0x1d2168);}var _0x370faf=_0x5893bc[_0x2b33('0x29')][_0x2b33('0x2b')];var _0x23ba3e=_0x5893bc[_0x2b33('0x29')][_0x2b33('0x2c')];var _0x2bfdda=_0x5893bc[_0x2b33('0x29')][_0x2b33('0x2d')];var _0x2b9af8=_0x5893bc[_0x2b33('0x29')][_0x2b33('0x2e')];return getAgent(_0x370faf)[_0x2b33('0x18')](function(_0x19e351){logger[_0x2b33('0xf')](_0x2b33('0x2f'),_0x19e351['name']);emit(util['format']('user:%s',_0x19e351[_0x2b33('0x13')]),_0x2b33('0x30'),{'callNumber':_0x23ba3e,'callerId':_0x2bfdda,'callbackUrl':_0x2b9af8});return _0x570765[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':_0x2b33('0x32')});})['catch'](handleError(_0x570765));};exports['hangup']=function(_0x1cfe5c,_0x4c3997){logger[_0x2b33('0xf')](_0x2b33('0x33'),_0x1cfe5c[_0x2b33('0x29')]);var _0xa638d6=hangupValidation[_0x2b33('0x2a')](_0x1cfe5c[_0x2b33('0x29')]);if(_0xa638d6[_0x2b33('0x24')]>0x0){return _0x4c3997[_0x2b33('0x15')](0x190)[_0x2b33('0x31')](_0xa638d6);}var _0x17bd1e=_0x1cfe5c['body'][_0x2b33('0x2b')];var _0x4661eb=_0x1cfe5c[_0x2b33('0x29')]['sessionId'];return getAgent(_0x17bd1e)['then'](function(_0x3afaa5){logger['info'](_0x2b33('0x2f'),_0x3afaa5[_0x2b33('0x13')]);emit(util['format'](_0x2b33('0x34'),_0x3afaa5[_0x2b33('0x13')]),'webbar:hangup',{'sessionId':_0x4661eb});return _0x4c3997[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x2b33('0x35')](handleError(_0x4c3997));};exports[_0x2b33('0x36')]=function(_0x264e64,_0x49348c){logger[_0x2b33('0xf')](_0x2b33('0x37'),_0x264e64[_0x2b33('0x29')]);var _0x22f321=answerValidation[_0x2b33('0x2a')](_0x264e64['body']);if(_0x22f321[_0x2b33('0x24')]>0x0){return _0x49348c[_0x2b33('0x15')](0x190)[_0x2b33('0x31')](_0x22f321);}var _0x5ad3b2=_0x264e64[_0x2b33('0x29')][_0x2b33('0x2b')];var _0x3c61d6=_0x264e64[_0x2b33('0x29')]['sessionId'];return getAgent(_0x5ad3b2)[_0x2b33('0x18')](function(_0x416f3e){logger['info']('entityFound:',_0x416f3e['name']);emit(util[_0x2b33('0x38')]('user:%s',_0x416f3e[_0x2b33('0x13')]),_0x2b33('0x39'),{'sessionId':_0x3c61d6});return _0x49348c[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':_0x2b33('0x3a')});})[_0x2b33('0x35')](handleError(_0x49348c));};exports[_0x2b33('0x3b')]=function(_0x13bb23,_0x56224a){logger[_0x2b33('0xf')](_0x2b33('0x3c'),_0x13bb23[_0x2b33('0x29')]);var _0x83de95=holdValidation[_0x2b33('0x2a')](_0x13bb23[_0x2b33('0x29')]);if(_0x83de95['length']>0x0){return _0x56224a['status'](0x190)['json'](_0x83de95);}var _0x493123=_0x13bb23[_0x2b33('0x29')]['userId'];var _0x1c5019=_0x13bb23['body']['sessionId'];return getAgent(_0x493123)[_0x2b33('0x18')](function(_0xd15da9){logger[_0x2b33('0xf')]('entityFound:',_0xd15da9[_0x2b33('0x13')]);emit(util['format'](_0x2b33('0x34'),_0xd15da9[_0x2b33('0x13')]),_0x2b33('0x3d'),{'sessionId':_0x1c5019});return _0x56224a[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':_0x2b33('0x3e')});})['catch'](handleError(_0x56224a));};exports[_0x2b33('0x3f')]=function(_0x27f766,_0xc3fd2e){logger['info'](_0x2b33('0x40'),_0x27f766[_0x2b33('0x29')]);var _0x434f0f=unholdValidation['validate'](_0x27f766[_0x2b33('0x29')]);if(_0x434f0f['length']>0x0){return _0xc3fd2e['status'](0x190)[_0x2b33('0x31')](_0x434f0f);}var _0x108d9a=_0x27f766[_0x2b33('0x29')][_0x2b33('0x2b')];var _0x307370=_0x27f766[_0x2b33('0x29')][_0x2b33('0x23')];return getAgent(_0x108d9a)[_0x2b33('0x18')](function(_0x486f74){logger[_0x2b33('0xf')](_0x2b33('0x2f'),_0x486f74['name']);emit(util[_0x2b33('0x38')](_0x2b33('0x34'),_0x486f74['name']),_0x2b33('0x41'),{'sessionId':_0x307370});return _0xc3fd2e[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':_0x2b33('0x42')});})['catch'](handleError(_0xc3fd2e));};exports[_0x2b33('0x43')]=function(_0x1d55fd,_0x5528fe){logger[_0x2b33('0xf')](_0x2b33('0x44'),_0x5528fe[_0x2b33('0x29')]);var _0x26e0ca=callsValidation[_0x2b33('0x2a')](_0x1d55fd[_0x2b33('0x29')]);if(_0x26e0ca[_0x2b33('0x24')]>0x0){return _0x5528fe['status'](0x190)['json'](_0x26e0ca);}var _0x3b0877=_0x1d55fd[_0x2b33('0x29')]['userId'];var _0x3ba2c6=respondWithRpcPromise(_0x2b33('0x1f'));var _0x2b4d10=getAgent(_0x3b0877);return Promise['all']([_0x3ba2c6,_0x2b4d10])[_0x2b33('0x18')](function(_0x134c48){var _0x59aca5=_0x134c48[0x0];var _0x1af9a3=_0x134c48[0x1];var _0x464ac8=_[_0x2b33('0x21')](_0x59aca5[_0x2b33('0x22')],function(_0x150695){return _0x150695['UserId']==_0x1af9a3['id'];});return _0x5528fe['status'](0xc8)[_0x2b33('0x31')]({'count':_0x464ac8[_0x2b33('0x24')],'rows':_0x464ac8});})[_0x2b33('0x35')](handleError(_0x5528fe));};exports[_0x2b33('0x45')]=function(_0x280b85,_0x4e7971){logger['info'](_0x2b33('0x46'),_0x280b85[_0x2b33('0x29')]);var _0x2eafb2=conferenceValidation[_0x2b33('0x2a')](_0x280b85[_0x2b33('0x29')]);if(_0x2eafb2[_0x2b33('0x24')]>0x0){return _0x4e7971['status'](0x190)[_0x2b33('0x31')](_0x2eafb2);}var _0x2e0e12=_0x280b85[_0x2b33('0x29')][_0x2b33('0x2b')];return getAgent(_0x2e0e12)[_0x2b33('0x18')](function(_0x5c8246){logger[_0x2b33('0xf')](_0x2b33('0x2f'),_0x5c8246[_0x2b33('0x13')]);emit(util[_0x2b33('0x38')]('user:%s',_0x5c8246[_0x2b33('0x13')]),'webbar:conference');return _0x4e7971[_0x2b33('0x15')](0xc8)[_0x2b33('0x31')]({'error':![],'message':_0x2b33('0x47')});})[_0x2b33('0x35')](handleError(_0x4e7971));};exports[_0x2b33('0x48')]=function(_0x321940,_0x23fdb7){logger[_0x2b33('0xf')]('transfer\x20fired:',_0x321940[_0x2b33('0x29')]);var _0x22d518=transferValidation[_0x2b33('0x2a')](_0x321940[_0x2b33('0x29')]);if(_0x22d518[_0x2b33('0x24')]>0x0){return _0x23fdb7[_0x2b33('0x15')](0x190)[_0x2b33('0x31')](_0x22d518);}var _0x3305c5=_0x321940[_0x2b33('0x29')][_0x2b33('0x2b')];var _0xfd05df=_0x321940[_0x2b33('0x29')]['sessionId'];var _0x452cca=_0x321940['body']['transferNumber'];return getAgent(_0x3305c5)[_0x2b33('0x18')](function(_0x5404f8){logger[_0x2b33('0xf')]('entityFound:',_0x5404f8[_0x2b33('0x13')]);emit(util[_0x2b33('0x38')](_0x2b33('0x34'),_0x5404f8[_0x2b33('0x13')]),'webbar:transfer',{'sessionId':_0xfd05df,'transferNumber':_0x452cca});return _0x23fdb7['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x23fdb7));}; \ No newline at end of file +var _0x1978=['calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','error','name','status','send','NotFound','request','then','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','info','originate\x20fired:','json','userId','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','unhold\x20executed!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1978,0x174));var _0x8197=function(_0x4460d3,_0x193b86){_0x4460d3=_0x4460d3-0x0;var _0x379733=_0x1978[_0x4460d3];return _0x379733;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8197('0x0'));var db=require(_0x8197('0x1'))['db'];var config=require(_0x8197('0x2'));var util=require(_0x8197('0x3'));var BPromise=require(_0x8197('0x4'));var jayson=require(_0x8197('0x5'));var amiClient=jayson[_0x8197('0x6')][_0x8197('0x7')]({'port':0x232a});var logger=require(_0x8197('0x8'))(_0x8197('0x9'));var Redis=require('ioredis');config[_0x8197('0xa')]=_[_0x8197('0xb')](config[_0x8197('0xa')],{'host':_0x8197('0xc'),'port':0x18eb});var io=require(_0x8197('0xd'))(new Redis(config[_0x8197('0xa')]));var Schema=require(_0x8197('0xe'));var originateValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'callNumber':{'type':_0x8197('0x11'),'required':[!![],_0x8197('0x12')]},'callerId':{'type':_0x8197('0x11')},'callbackUrl':{'type':_0x8197('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x8197('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8197('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8197('0x10')]}});function emit(_0x4d60fb,_0x233202,_0x12015d){logger['info'](_0x4d60fb,_0x233202,JSON[_0x8197('0x14')](_0x12015d));io['to'](_0x4d60fb)['emit'](_0x233202,_0x12015d);}function handleError(_0x4ad61a){return function(_0x4695a5){console['log'](_0x8197('0x15'),_0x4695a5,_0x4695a5 instanceof RangeError);logger[_0x8197('0x16')](_0x4695a5['stack']);if(_0x4695a5 instanceof RangeError){if(_0x4695a5[_0x8197('0x17')]){delete _0x4695a5['name'];}_0x4ad61a[_0x8197('0x18')](0x194)[_0x8197('0x19')](_0x4695a5);}else{if(_0x4695a5[_0x8197('0x17')]){delete _0x4695a5[_0x8197('0x17')];}_0x4ad61a[_0x8197('0x18')](0x1f4)[_0x8197('0x19')](_0x4695a5);}};}function checkError(){return function(_0x58e763){if(!_0x58e763){throw new RangeError(_0x8197('0x1a'));}return _0x58e763;};}function respondWithRpcPromise(_0x46b971,_0x100852){return new BPromise(function(_0x505ea8,_0x4c06d1){var _0x137d60=amiClient;return _0x137d60[_0x8197('0x1b')](_0x46b971,_0x100852)[_0x8197('0x1c')](function(_0x4c8e6f){if(_0x4c8e6f[_0x8197('0x16')]){if(_0x4c8e6f[_0x8197('0x16')]['code']===0x1f4){return _0x4c06d1(_0x4c8e6f[_0x8197('0x16')][_0x8197('0x1d')]);}return _0x505ea8(_0x4c8e6f[_0x8197('0x16')]['message']);}else{_0x505ea8(_0x4c8e6f[_0x8197('0x1e')]);}})[_0x8197('0x1f')](function(_0x276d45){_0x4c06d1(_0x276d45);});});}function getAgent(_0x279a9d){return db[_0x8197('0x20')][_0x8197('0x21')]({'where':{'id':_0x279a9d,'role':_0x8197('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x88c64e,_0x4640cb){return new BPromise(function(_0x1344bf,_0x2def83){var _0x1b80b8=respondWithRpcPromise(_0x8197('0x23'));var _0x4b8729=getAgent(_0x88c64e);Promise[_0x8197('0x24')]([_0x1b80b8,_0x4b8729])[_0x8197('0x1c')](function(_0x485692){var _0x456d95=_0x485692[0x0];var _0x23d374=_0x485692[0x1];var _0x554325=_[_0x8197('0x25')](_0x456d95[_0x8197('0x26')],function(_0x18fbc0){return _0x18fbc0[_0x8197('0x27')]==_0x23d374['id']&&_0x18fbc0[_0x8197('0x28')]==_0x4640cb;});if(_0x554325[_0x8197('0x29')]==0x1){_0x1344bf(_0x23d374);}else{_0x2def83(new RangeError(_0x8197('0x2a')+_0x4640cb+'\x20not\x20found!'));}});});}exports['originate']=function(_0x485f8e,_0x2d8a49){logger[_0x8197('0x2b')](_0x8197('0x2c'),_0x485f8e['body']);var _0x23740e=originateValidation[_0x8197('0xe')](_0x485f8e['body']);if(_0x23740e['length']>0x0){return _0x2d8a49[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x23740e);}var _0x4c5882=_0x485f8e['body'][_0x8197('0x2e')];var _0x217cd7=_0x485f8e[_0x8197('0x2f')][_0x8197('0x30')];var _0x3867e2=_0x485f8e[_0x8197('0x2f')][_0x8197('0x31')];var _0x39d77d=_0x485f8e[_0x8197('0x2f')][_0x8197('0x32')];return getAgent(_0x4c5882)[_0x8197('0x1c')](function(_0x404da3){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x404da3[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x404da3[_0x8197('0x17')]),_0x8197('0x36'),{'callNumber':_0x217cd7,'callerId':_0x3867e2,'callbackUrl':_0x39d77d});return _0x2d8a49[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x37')});})[_0x8197('0x1f')](handleError(_0x2d8a49));};exports['hangup']=function(_0x76b35a,_0x4ce35e){logger[_0x8197('0x2b')]('hangup\x20fired:',_0x76b35a[_0x8197('0x2f')]);var _0x31beee=hangupValidation[_0x8197('0xe')](_0x76b35a[_0x8197('0x2f')]);if(_0x31beee[_0x8197('0x29')]>0x0){return _0x4ce35e[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x31beee);}var _0x335cb9=_0x76b35a['body'][_0x8197('0x2e')];var _0x4752f6=_0x76b35a[_0x8197('0x2f')][_0x8197('0x28')];return getAgent(_0x335cb9)[_0x8197('0x1c')](function(_0x1a2d7e){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x1a2d7e[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x1a2d7e[_0x8197('0x17')]),_0x8197('0x38'),{'sessionId':_0x4752f6});return _0x4ce35e[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x39')});})[_0x8197('0x1f')](handleError(_0x4ce35e));};exports['answer']=function(_0x56aa31,_0x44f452){logger[_0x8197('0x2b')](_0x8197('0x3a'),_0x56aa31[_0x8197('0x2f')]);var _0x2bfe7b=answerValidation[_0x8197('0xe')](_0x56aa31[_0x8197('0x2f')]);if(_0x2bfe7b[_0x8197('0x29')]>0x0){return _0x44f452[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x2bfe7b);}var _0x3d7490=_0x56aa31['body']['userId'];var _0x37c0fc=_0x56aa31[_0x8197('0x2f')]['sessionId'];return getAgent(_0x3d7490)['then'](function(_0x1eb7d7){logger['info']('entityFound:',_0x1eb7d7[_0x8197('0x17')]);emit(util['format'](_0x8197('0x35'),_0x1eb7d7[_0x8197('0x17')]),_0x8197('0x3b'),{'sessionId':_0x37c0fc});return _0x44f452[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x3c')});})[_0x8197('0x1f')](handleError(_0x44f452));};exports[_0x8197('0x3d')]=function(_0x2c2d35,_0x39a319){logger[_0x8197('0x2b')](_0x8197('0x3e'),_0x2c2d35['body']);var _0x25f0eb=holdValidation[_0x8197('0xe')](_0x2c2d35[_0x8197('0x2f')]);if(_0x25f0eb[_0x8197('0x29')]>0x0){return _0x39a319[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x25f0eb);}var _0xdd3927=_0x2c2d35[_0x8197('0x2f')][_0x8197('0x2e')];var _0x46788b=_0x2c2d35[_0x8197('0x2f')][_0x8197('0x28')];return getAgent(_0xdd3927)[_0x8197('0x1c')](function(_0x177af5){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x177af5['name']);emit(util['format'](_0x8197('0x35'),_0x177af5[_0x8197('0x17')]),'webbar:hold',{'sessionId':_0x46788b});return _0x39a319['status'](0xc8)['json']({'error':![],'message':_0x8197('0x3f')});})['catch'](handleError(_0x39a319));};exports['unhold']=function(_0x58fde1,_0x4c9122){logger[_0x8197('0x2b')](_0x8197('0x40'),_0x58fde1['body']);var _0x3b41f9=unholdValidation[_0x8197('0xe')](_0x58fde1[_0x8197('0x2f')]);if(_0x3b41f9['length']>0x0){return _0x4c9122[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x3b41f9);}var _0x9d5f02=_0x58fde1[_0x8197('0x2f')][_0x8197('0x2e')];var _0x9ed42d=_0x58fde1['body'][_0x8197('0x28')];return getAgent(_0x9d5f02)[_0x8197('0x1c')](function(_0x2b14ff){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x2b14ff['name']);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x2b14ff['name']),'webbar:unhold',{'sessionId':_0x9ed42d});return _0x4c9122['status'](0xc8)['json']({'error':![],'message':_0x8197('0x41')});})[_0x8197('0x1f')](handleError(_0x4c9122));};exports[_0x8197('0x42')]=function(_0x56a880,_0x523e35){logger['info'](_0x8197('0x43'),_0x523e35[_0x8197('0x2f')]);var _0x1480b0=callsValidation['validate'](_0x56a880[_0x8197('0x2f')]);if(_0x1480b0[_0x8197('0x29')]>0x0){return _0x523e35[_0x8197('0x18')](0x190)['json'](_0x1480b0);}var _0x46f775=_0x56a880[_0x8197('0x2f')][_0x8197('0x2e')];var _0x26c0e8=respondWithRpcPromise(_0x8197('0x23'));var _0x16e339=getAgent(_0x46f775);return Promise[_0x8197('0x24')]([_0x26c0e8,_0x16e339])['then'](function(_0xfcc56){var _0x42227a=_0xfcc56[0x0];var _0x1ee075=_0xfcc56[0x1];var _0x456846=_[_0x8197('0x25')](_0x42227a[_0x8197('0x26')],function(_0x894a6e){return _0x894a6e[_0x8197('0x27')]==_0x1ee075['id'];});return _0x523e35[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'count':_0x456846['length'],'rows':_0x456846});})[_0x8197('0x1f')](handleError(_0x523e35));};exports[_0x8197('0x44')]=function(_0x4930de,_0x3b3df0){logger[_0x8197('0x2b')](_0x8197('0x45'),_0x4930de[_0x8197('0x2f')]);var _0x347a69=conferenceValidation[_0x8197('0xe')](_0x4930de[_0x8197('0x2f')]);if(_0x347a69['length']>0x0){return _0x3b3df0[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x347a69);}var _0x3aaaa8=_0x4930de[_0x8197('0x2f')]['userId'];return getAgent(_0x3aaaa8)[_0x8197('0x1c')](function(_0x57a4c0){logger['info'](_0x8197('0x33'),_0x57a4c0['name']);emit(util['format'](_0x8197('0x35'),_0x57a4c0[_0x8197('0x17')]),'webbar:conference');return _0x3b3df0[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x46')});})[_0x8197('0x1f')](handleError(_0x3b3df0));};exports[_0x8197('0x47')]=function(_0x1cabb4,_0x375f73){logger[_0x8197('0x2b')](_0x8197('0x48'),_0x1cabb4[_0x8197('0x2f')]);var _0x34e0a7=transferValidation['validate'](_0x1cabb4[_0x8197('0x2f')]);if(_0x34e0a7[_0x8197('0x29')]>0x0){return _0x375f73[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x34e0a7);}var _0x134131=_0x1cabb4[_0x8197('0x2f')][_0x8197('0x2e')];var _0x357f7c=_0x1cabb4['body']['sessionId'];var _0x506796=_0x1cabb4[_0x8197('0x2f')]['transferNumber'];return getAgent(_0x134131)[_0x8197('0x1c')](function(_0x44e212){logger['info']('entityFound:',_0x44e212[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x44e212[_0x8197('0x17')]),'webbar:transfer',{'sessionId':_0x357f7c,'transferNumber':_0x506796});return _0x375f73[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0x8197('0x1f')](handleError(_0x375f73));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 30ae592..f9f7232 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 _0x6ec9=['express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path'];(function(_0x522eb8,_0xaf0729){var _0x32b68a=function(_0x8d6de9){while(--_0x8d6de9){_0x522eb8['push'](_0x522eb8['shift']());}};_0x32b68a(++_0xaf0729);}(_0x6ec9,0x174));var _0x96ec=function(_0x599f55,_0x2d4f80){_0x599f55=_0x599f55-0x0;var _0xa7a8e8=_0x6ec9[_0x599f55];return _0xa7a8e8;};'use strict';var multer=require(_0x96ec('0x0'));var util=require('util');var path=require(_0x96ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x96ec('0x2'));var router=express['Router']();var auth=require(_0x96ec('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x96ec('0x4'));var controller=require(_0x96ec('0x5'));router['get']('/',auth[_0x96ec('0x6')](),controller[_0x96ec('0x7')]);router[_0x96ec('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x96ec('0x8')](_0x96ec('0x9'),auth['isAuthenticated'](),controller[_0x96ec('0xa')]);router[_0x96ec('0x8')](_0x96ec('0xb'),auth[_0x96ec('0x6')](),controller['getDispositions']);router['get'](_0x96ec('0xc'),auth[_0x96ec('0x6')](),controller[_0x96ec('0xd')]);router[_0x96ec('0x8')](_0x96ec('0xe'),auth[_0x96ec('0x6')](),controller[_0x96ec('0xf')]);router['get'](_0x96ec('0x10'),auth[_0x96ec('0x6')](),controller[_0x96ec('0x11')]);router[_0x96ec('0x12')]('/',auth[_0x96ec('0x6')](),controller[_0x96ec('0x13')]);router[_0x96ec('0x12')](_0x96ec('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x96ec('0x12')](_0x96ec('0xc'),auth[_0x96ec('0x6')](),controller[_0x96ec('0x14')]);router[_0x96ec('0x12')](_0x96ec('0xe'),auth['isAuthenticated'](),controller[_0x96ec('0x15')]);router[_0x96ec('0x12')](_0x96ec('0x10'),auth['isAuthenticated'](),controller[_0x96ec('0x16')]);router['post'](_0x96ec('0x17'),controller['notify']);router[_0x96ec('0x12')](_0x96ec('0x18'),auth[_0x96ec('0x6')](),controller[_0x96ec('0x19')]);router[_0x96ec('0x1a')](_0x96ec('0x9'),auth['isAuthenticated'](),controller[_0x96ec('0x1b')]);router[_0x96ec('0x1c')](_0x96ec('0x9'),auth[_0x96ec('0x6')](),controller[_0x96ec('0x1d')]);router[_0x96ec('0x1c')]('/:id/dispositions',auth[_0x96ec('0x6')](),controller[_0x96ec('0x1e')]);router['delete'](_0x96ec('0xc'),auth['isAuthenticated'](),controller[_0x96ec('0x1f')]);router['delete'](_0x96ec('0xe'),auth['isAuthenticated'](),controller[_0x96ec('0x20')]);module[_0x96ec('0x21')]=router; \ No newline at end of file +var _0x621f=['addAnswer','addAgents','addApplications','notify','/:id/send','update','delete','destroy','removeDispositions','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','addDisposition'];(function(_0x521785,_0x104af1){var _0x30a7d2=function(_0x41671e){while(--_0x41671e){_0x521785['push'](_0x521785['shift']());}};_0x30a7d2(++_0x104af1);}(_0x621f,0xe3));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf621('0x0'));var timeout=require('connect-timeout');var express=require(_0xf621('0x1'));var router=express[_0xf621('0x2')]();var auth=require(_0xf621('0x3'));var interaction=require(_0xf621('0x4'));var config=require(_0xf621('0x5'));var controller=require(_0xf621('0x6'));router[_0xf621('0x7')]('/',auth[_0xf621('0x8')](),controller[_0xf621('0x9')]);router[_0xf621('0x7')](_0xf621('0xa'),auth[_0xf621('0x8')](),controller['describe']);router[_0xf621('0x7')](_0xf621('0xb'),auth['isAuthenticated'](),controller[_0xf621('0xc')]);router[_0xf621('0x7')](_0xf621('0xd'),auth['isAuthenticated'](),controller[_0xf621('0xe')]);router[_0xf621('0x7')](_0xf621('0xf'),auth[_0xf621('0x8')](),controller['getAnswers']);router[_0xf621('0x7')](_0xf621('0x10'),auth[_0xf621('0x8')](),controller['getAgents']);router[_0xf621('0x7')](_0xf621('0x11'),auth['isAuthenticated'](),controller[_0xf621('0x12')]);router[_0xf621('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf621('0xd'),auth['isAuthenticated'](),controller[_0xf621('0x14')]);router[_0xf621('0x13')](_0xf621('0xf'),auth[_0xf621('0x8')](),controller[_0xf621('0x15')]);router[_0xf621('0x13')](_0xf621('0x10'),auth[_0xf621('0x8')](),controller[_0xf621('0x16')]);router[_0xf621('0x13')](_0xf621('0x11'),auth[_0xf621('0x8')](),controller[_0xf621('0x17')]);router[_0xf621('0x13')]('/:id/notify',controller[_0xf621('0x18')]);router[_0xf621('0x13')](_0xf621('0x19'),auth[_0xf621('0x8')](),controller['send']);router['put']('/:id',auth[_0xf621('0x8')](),controller[_0xf621('0x1a')]);router[_0xf621('0x1b')]('/:id',auth[_0xf621('0x8')](),controller[_0xf621('0x1c')]);router[_0xf621('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf621('0x1d')]);router[_0xf621('0x1b')](_0xf621('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xf621('0x8')](),controller['removeAgents']);module[_0xf621('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 71b85d4..b9439e8 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 _0x8fb0=['randomstring','exports','STRING','name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x8fb0,0x167));var _0x08fb=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x8fb0[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x08fb('0x0'));var rs=require(_0x08fb('0x1'));module[_0x08fb('0x2')]={'name':{'type':Sequelize[_0x08fb('0x3')],'unique':_0x08fb('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x08fb('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x08fb('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x08fb('0x3')],'defaultValue':function(){return rs[_0x08fb('0x5')]();}},'phone':{'type':Sequelize[_0x08fb('0x3')]},'type':{'type':Sequelize[_0x08fb('0x6')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x08fb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x08fb('0x7')],'defaultValue':function(){return _0x08fb('0x8');}},'notificationSound':{'type':Sequelize[_0x08fb('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08fb('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08fb('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x08fb('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x08fb('0x9')],'defaultValue':![],'comment':_0x08fb('0xc'),'set':function(_0x5e56ef){if(!_0x5e56ef){this[_0x08fb('0xd')](_0x08fb('0xe'),null);}this[_0x08fb('0xd')]('mandatoryDisposition',_0x5e56ef);}},'description':{'type':Sequelize[_0x08fb('0x3')]}}; \ No newline at end of file +var _0xbf0e=['sequelize','randomstring','STRING','name','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x573a5d,_0x1ca790){var _0x3994eb=function(_0x4001e1){while(--_0x4001e1){_0x573a5d['push'](_0x573a5d['shift']());}};_0x3994eb(++_0x1ca790);}(_0xbf0e,0xf7));var _0xebf0=function(_0x1de82a,_0x3390fa){_0x1de82a=_0x1de82a-0x0;var _0x27deca=_0xbf0e[_0x1de82a];return _0x27deca;};'use strict';var Sequelize=require(_0xebf0('0x0'));var rs=require(_0xebf0('0x1'));module['exports']={'name':{'type':Sequelize[_0xebf0('0x2')],'unique':_0xebf0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xebf0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xebf0('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xebf0('0x2')]},'type':{'type':Sequelize[_0xebf0('0x4')](_0xebf0('0x5'))},'accountSid':{'type':Sequelize[_0xebf0('0x2')]},'authToken':{'type':Sequelize[_0xebf0('0x2')]},'notificationTemplate':{'type':Sequelize[_0xebf0('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xebf0('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xebf0('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xebf0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xebf0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xebf0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xebf0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xebf0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xebf0('0x8')],'comment':_0xebf0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xebf0('0x7')],'defaultValue':![],'comment':_0xebf0('0xa'),'set':function(_0x2898bb){if(!_0x2898bb){this['setDataValue'](_0xebf0('0xb'),null);}this['setDataValue'](_0xebf0('0xc'),_0x2898bb);}},'description':{'type':Sequelize[_0xebf0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 76de1b6..b006afa 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 _0xd404=['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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getDispositions','findOne','rawAttributes','sort','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','account','applications','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','From','replace','whatsapp:','Body','messageId','isNil','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','from','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xd404,0x15b));var _0x4d40=function(_0x582a79,_0x1705b6){_0x582a79=_0x582a79-0x0;var _0x1a2f39=_0xd404[_0x582a79];return _0x1a2f39;};'use strict';var pdf=require(_0x4d40('0x0'));var emlformat=require(_0x4d40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d40('0x2'));var jsonpatch=require(_0x4d40('0x3'));var rp=require('request-promise');var moment=require(_0x4d40('0x4'));var BPromise=require(_0x4d40('0x5'));var Mustache=require(_0x4d40('0x6'));var util=require(_0x4d40('0x7'));var path=require(_0x4d40('0x8'));var sox=require(_0x4d40('0x9'));var csv=require(_0x4d40('0xa'));var ejs=require(_0x4d40('0xb'));var fs=require('fs');var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var db=require(_0x4d40('0x18'))['db'];config[_0x4d40('0x19')]=_[_0x4d40('0x1a')](config[_0x4d40('0x19')],{'host':_0x4d40('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d40('0x19')]));require(_0x4d40('0x1c'))[_0x4d40('0x1d')](socket);var jayson=require(_0x4d40('0x1e'));var client=jayson[_0x4d40('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x23de7b,_0x4077ce,_0x20bc1b){if(_0x20bc1b){var _0xcee25a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcee25a[_0x4d40('0x20')](_0x4077ce)){return _0x23de7b;}else{throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x23'));}}else{return _0x23de7b;}}function respondWithRpcPromise(_0x1439a7,_0x4b5d23,_0x535989,_0x1ae5c7){return new BPromise(function(_0x1c0cd8,_0x4e505f){var _0x23b8fd=_0x1ae5c7||client;return _0x23b8fd[_0x4d40('0x24')](_0x1439a7,_0x535989)['then'](function(_0x36d031){logger['info'](_0x4d40('0x25'),_0x4b5d23,_0x4d40('0x26'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4b5d23,_0x4d40('0x26'),JSON[_0x4d40('0x27')](_0x36d031));if(_0x36d031['error']){if(_0x36d031[_0x4d40('0x28')][_0x4d40('0x29')]===0x1f4){logger[_0x4d40('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x4b5d23,_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);return _0x4e505f(_0x36d031[_0x4d40('0x28')]['message']);}logger['error'](_0x4d40('0x25'),_0x4b5d23,_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);return _0x1c0cd8(_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);}else{logger['info'](_0x4d40('0x25'),_0x4b5d23,_0x4d40('0x26'));_0x1c0cd8(_0x36d031['result']['message']);}})[_0x4d40('0x2b')](function(_0x2a0c82){logger[_0x4d40('0x28')](_0x4d40('0x25'),_0x4b5d23,_0x2a0c82);_0x4e505f(_0x2a0c82);});});}function respondWithStatusCode(_0x4a8ad6,_0x325f6f){_0x325f6f=_0x325f6f||0xcc;return function(_0x105635){if(_0x105635){return _0x4a8ad6[_0x4d40('0x2c')](_0x325f6f);}return _0x4a8ad6[_0x4d40('0x2d')](_0x325f6f)[_0x4d40('0x2e')]();};}function respondWithResult(_0x1c0fcf,_0x4ca431){_0x4ca431=_0x4ca431||0xc8;return function(_0x4e4e61){if(_0x4e4e61){return _0x1c0fcf['status'](_0x4ca431)[_0x4d40('0x2f')](_0x4e4e61);}};}function respondWithFilteredResult(_0x350488,_0x1ac240){return function(_0x18f18f){if(_0x18f18f){var _0x598ca9=_0x18f18f['count'],_0x18e601=_0x1ac240[_0x4d40('0x30')],_0x1c8a1b=_0x1ac240[_0x4d40('0x30')]+_0x1ac240[_0x4d40('0x31')],_0x429da9;if(_0x1c8a1b>=_0x598ca9){_0x1c8a1b=_0x598ca9;_0x429da9=0xc8;}else{_0x429da9=0xce;}_0x350488[_0x4d40('0x2d')](_0x429da9);return _0x350488[_0x4d40('0x32')]('Content-Range',_0x18e601+'-'+_0x1c8a1b+'/'+_0x598ca9)[_0x4d40('0x2f')](_0x18f18f);}return null;};}function patchUpdates(_0x4ae4ce){return function(_0x263d0a){try{jsonpatch[_0x4d40('0x33')](_0x263d0a,_0x4ae4ce,!![]);}catch(_0x3cd439){return BPromise[_0x4d40('0x34')](_0x3cd439);}return _0x263d0a['save']();};}function saveUpdates(_0x5bbe0b,_0x5e483c){return function(_0x3642ee){if(_0x3642ee){return _0x3642ee[_0x4d40('0x35')](_0x5bbe0b)[_0x4d40('0x36')](function(_0x5e195a){return _0x5e195a;});}return null;};}function removeEntity(_0xf5f494,_0x5f1d1c){return function(_0x2fde16){if(_0x2fde16){return _0x2fde16[_0x4d40('0x37')]()[_0x4d40('0x36')](function(){var _0x1b8b68=_0x2fde16[_0x4d40('0x38')]({'plain':!![]});var _0x2c6a94=_0x4d40('0x39');return db[_0x4d40('0x3a')][_0x4d40('0x37')]({'where':{'type':_0x2c6a94,'resourceId':_0x1b8b68['id']}})[_0x4d40('0x36')](function(){return _0x2fde16;});})['then'](function(){_0xf5f494[_0x4d40('0x2d')](0xcc)[_0x4d40('0x2e')]();});}};}function handleEntityNotFound(_0x537a6a,_0x5bad1c){return function(_0x5087e1){if(!_0x5087e1){_0x537a6a[_0x4d40('0x2c')](0x194);}return _0x5087e1;};}function handleError(_0xcb42f6,_0x5784aa){_0x5784aa=_0x5784aa||0x1f4;return function(_0x256cc8){logger[_0x4d40('0x28')](_0x256cc8[_0x4d40('0x3b')]);if(_0x256cc8[_0x4d40('0x3c')]){delete _0x256cc8[_0x4d40('0x3c')];}_0xcb42f6['status'](_0x5784aa)[_0x4d40('0x3d')](_0x256cc8);};}exports[_0x4d40('0x3e')]=function(_0x4a84fa,_0x4eb405){var _0x3a4924={'include':[{'model':db[_0x4d40('0x3f')],'as':_0x4d40('0x40')}]},_0x11ed1a={},_0x56f52e={'count':0x0,'rows':[]};var _0x4ab819=_[_0x4d40('0x41')](db[_0x4d40('0x42')]['rawAttributes'],function(_0x3ed6c2){return{'name':_0x3ed6c2[_0x4d40('0x43')],'type':_0x3ed6c2['type'][_0x4d40('0x44')]};});_0x11ed1a['model']=_[_0x4d40('0x41')](_0x4ab819,_0x4d40('0x3c'));_0x11ed1a[_0x4d40('0x45')]=_[_0x4d40('0x46')](_0x4a84fa[_0x4d40('0x45')]);_0x11ed1a[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x11ed1a[_0x4d40('0x49')],_0x11ed1a[_0x4d40('0x45')]);_0x3a4924['attributes']=_[_0x4d40('0x48')](_0x11ed1a[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x3a4924['attributes']=_0x3a4924[_0x4d40('0x4b')]['length']?_0x3a4924[_0x4d40('0x4b')]:_0x11ed1a[_0x4d40('0x49')];if(!_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x4c')]('nolimit')){_0x3a4924[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x4a84fa['query'][_0x4d40('0x31')]);_0x3a4924['offset']=qs[_0x4d40('0x30')](_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x30')]);}_0x3a4924[_0x4d40('0x4d')]=qs['sort'](_0x4a84fa[_0x4d40('0x45')]['sort']);_0x3a4924[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x4a84fa[_0x4d40('0x45')],_0x11ed1a['filters']),_0x4ab819);if(_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x50')]){_0x3a4924[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x3a4924['where'],{'$or':_[_0x4d40('0x41')](_0x4ab819,function(_0x3b057d){if(_0x3b057d['type']!==_0x4d40('0x52')){var _0x493d8e={};_0x493d8e[_0x3b057d[_0x4d40('0x3c')]]={'$like':'%'+_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x50')]+'%'};return _0x493d8e;}})});}_0x3a4924=_[_0x4d40('0x51')]({},_0x3a4924,_0x4a84fa[_0x4d40('0x53')]);var _0x351900={'where':_0x3a4924[_0x4d40('0x4e')]};return db[_0x4d40('0x42')][_0x4d40('0x54')](_0x351900)['then'](function(_0x532fde){_0x56f52e[_0x4d40('0x54')]=_0x532fde;if(_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x55')]){_0x3a4924[_0x4d40('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x4d40('0x57')](_0x3a4924);})[_0x4d40('0x36')](function(_0x4f7b36){_0x56f52e[_0x4d40('0x58')]=_0x4f7b36;return _0x56f52e;})['then'](respondWithFilteredResult(_0x4eb405,_0x3a4924))[_0x4d40('0x2b')](handleError(_0x4eb405,null));};exports[_0x4d40('0x59')]=function(_0x3e294e,_0x53d73a){var _0x2937bb={'raw':![],'where':{'id':_0x3e294e[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x3f')],'as':_0x4d40('0x40')}]},_0x17e039={};_0x17e039['model']=_[_0x4d40('0x46')](db[_0x4d40('0x42')]['rawAttributes']);_0x17e039[_0x4d40('0x45')]=_['keys'](_0x3e294e[_0x4d40('0x45')]);_0x17e039['filters']=_[_0x4d40('0x48')](_0x17e039[_0x4d40('0x49')],_0x17e039['query']);_0x2937bb[_0x4d40('0x4b')]=_[_0x4d40('0x48')](_0x17e039[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x3e294e[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x2937bb[_0x4d40('0x4b')]=_0x2937bb[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x2937bb[_0x4d40('0x4b')]:_0x17e039[_0x4d40('0x49')];if(_0x3e294e[_0x4d40('0x45')][_0x4d40('0x55')]){_0x2937bb[_0x4d40('0x56')]=[{'all':!![]}];}_0x2937bb=_[_0x4d40('0x51')]({},_0x2937bb,_0x3e294e[_0x4d40('0x53')]);return db[_0x4d40('0x42')][_0x4d40('0x5c')](_0x2937bb)[_0x4d40('0x36')](handleEntityNotFound(_0x53d73a,null))['then'](respondWithResult(_0x53d73a,null))[_0x4d40('0x2b')](handleError(_0x53d73a,null));};exports[_0x4d40('0x5d')]=function(_0x4de203,_0x5cebfc){return db[_0x4d40('0x42')][_0x4d40('0x5d')](_0x4de203['body'],{})['then'](function(_0x33b61b){var _0x4c9df4=_0x4de203[_0x4d40('0x5e')]['get']({'plain':!![]});if(!_0x4c9df4)throw new Error(_0x4d40('0x5f'));if(_0x4c9df4[_0x4d40('0x60')]===_0x4d40('0x5e')){var _0x3e3160=_0x33b61b[_0x4d40('0x38')]({'plain':!![]});var _0x4a6e3e='WhatsappAccounts';return db['UserProfileSection'][_0x4d40('0x5c')]({'where':{'name':_0x4a6e3e,'userProfileId':_0x4c9df4[_0x4d40('0x61')]},'raw':!![]})[_0x4d40('0x36')](function(_0x21a798){if(_0x21a798&&_0x21a798[_0x4d40('0x62')]===0x0){return db['UserProfileResource'][_0x4d40('0x5d')]({'name':_0x3e3160['name'],'resourceId':_0x3e3160['id'],'type':_0x21a798[_0x4d40('0x3c')],'sectionId':_0x21a798['id']},{})[_0x4d40('0x36')](function(){return _0x33b61b;});}else{return _0x33b61b;}})[_0x4d40('0x2b')](function(_0x22305e){logger[_0x4d40('0x28')](_0x4d40('0x63'),_0x22305e);throw _0x22305e;});}return _0x33b61b;})['then'](respondWithResult(_0x5cebfc,0xc9))['catch'](handleError(_0x5cebfc,null));};exports[_0x4d40('0x35')]=function(_0x221552,_0x9f16bb){if(_0x221552[_0x4d40('0x64')]['id']){delete _0x221552[_0x4d40('0x64')]['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x221552[_0x4d40('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x4d40('0x40')}]})['then'](handleEntityNotFound(_0x9f16bb,null))['then'](saveUpdates(_0x221552['body'],null))[_0x4d40('0x36')](respondWithResult(_0x9f16bb,null))[_0x4d40('0x2b')](handleError(_0x9f16bb,null));};exports[_0x4d40('0x37')]=function(_0x36f590,_0x4d0af5){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x36f590[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x4d0af5,null))[_0x4d40('0x36')](removeEntity(_0x4d0af5,null))['catch'](handleError(_0x4d0af5,null));};exports['describe']=function(_0x23bc80,_0x4b24a7){return db[_0x4d40('0x42')][_0x4d40('0x65')]()[_0x4d40('0x36')](respondWithResult(_0x4b24a7,null))['catch'](handleError(_0x4b24a7,null));};exports['addDisposition']=function(_0x3ede3b,_0x506ac3,_0x19b92c){if(_0x3ede3b[_0x4d40('0x64')]['id']){delete _0x3ede3b['body']['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x3ede3b[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x506ac3,null))[_0x4d40('0x36')](function(_0x2061a3){if(_0x2061a3){_0x3ede3b['body']['WhatsappAccountId']=_0x2061a3['id'];return db['Disposition'][_0x4d40('0x5d')](_0x3ede3b[_0x4d40('0x64')]);}})[_0x4d40('0x36')](respondWithResult(_0x506ac3,null))['catch'](handleError(_0x506ac3,null));};exports[_0x4d40('0x66')]=function(_0x22b423,_0x4bb2df,_0x595fa5){var _0x1e8a5f={'raw':![],'where':{}};var _0x1b5aa9={};var _0x4db818={'count':0x0,'rows':[]};return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x22b423[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x4bb2df,null))[_0x4d40('0x36')](function(_0x717bc1){if(_0x717bc1){_0x1b5aa9['model']=_[_0x4d40('0x46')](db['Disposition'][_0x4d40('0x68')]);_0x1b5aa9[_0x4d40('0x45')]=_['keys'](_0x22b423[_0x4d40('0x45')]);_0x1b5aa9[_0x4d40('0x47')]=_['intersection'](_0x1b5aa9[_0x4d40('0x49')],_0x1b5aa9[_0x4d40('0x45')]);_0x1e8a5f['attributes']=_[_0x4d40('0x48')](_0x1b5aa9[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x22b423[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x1e8a5f['attributes']=_0x1e8a5f[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x1e8a5f[_0x4d40('0x4b')]:_0x1b5aa9[_0x4d40('0x49')];if(!_0x22b423[_0x4d40('0x45')][_0x4d40('0x4c')]('nolimit')){_0x1e8a5f[_0x4d40('0x31')]=qs['limit'](_0x22b423[_0x4d40('0x45')][_0x4d40('0x31')]);_0x1e8a5f[_0x4d40('0x30')]=qs[_0x4d40('0x30')](_0x22b423[_0x4d40('0x45')]['offset']);}_0x1e8a5f[_0x4d40('0x4d')]=qs[_0x4d40('0x69')](_0x22b423[_0x4d40('0x45')][_0x4d40('0x69')]);_0x1e8a5f['where']=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x22b423[_0x4d40('0x45')],_0x1b5aa9[_0x4d40('0x47')]));_0x1e8a5f['where'][_0x4d40('0x6a')]=_0x717bc1['id'];if(_0x22b423['query'][_0x4d40('0x50')]){_0x1e8a5f[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x1e8a5f[_0x4d40('0x4e')],{'$or':_['map'](_0x1e8a5f['attributes'],function(_0x3c14b6){var _0x4660b8={};_0x4660b8[_0x3c14b6]={'$like':'%'+_0x22b423['query'][_0x4d40('0x50')]+'%'};return _0x4660b8;})});}_0x1e8a5f=_[_0x4d40('0x51')]({},_0x1e8a5f,_0x22b423[_0x4d40('0x53')]);return db[_0x4d40('0x6b')][_0x4d40('0x54')]({'where':_0x1e8a5f['where']})[_0x4d40('0x36')](function(_0x2036a8){_0x4db818[_0x4d40('0x54')]=_0x2036a8;if(_0x22b423[_0x4d40('0x45')][_0x4d40('0x55')]){_0x1e8a5f[_0x4d40('0x56')]=[{'all':!![]}];}return db[_0x4d40('0x6b')][_0x4d40('0x57')](_0x1e8a5f);})[_0x4d40('0x36')](function(_0x27085b){_0x4db818[_0x4d40('0x58')]=_0x27085b;return _0x4db818;});}})['then'](respondWithFilteredResult(_0x4bb2df,_0x1e8a5f))[_0x4d40('0x2b')](handleError(_0x4bb2df,null));};exports[_0x4d40('0x6c')]=function(_0x599727,_0xbb9020,_0xbec312){return db['WhatsappAccount']['find']({'where':{'id':_0x599727[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0xbb9020,null))['then'](function(_0x233f77){if(_0x233f77){return _0x233f77[_0x4d40('0x6c')](_0x599727['query'][_0x4d40('0x6d')]);}})[_0x4d40('0x36')](respondWithStatusCode(_0xbb9020,null))['catch'](handleError(_0xbb9020,null));};exports['addAnswer']=function(_0x50d012,_0x5e5004,_0xc7ec7d){if(_0x50d012['body']['id']){delete _0x50d012['body']['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x50d012[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x5e5004,null))[_0x4d40('0x36')](function(_0xf8b560){if(_0xf8b560){_0x50d012[_0x4d40('0x64')]['WhatsappAccountId']=_0xf8b560['id'];return db[_0x4d40('0x6e')][_0x4d40('0x5d')](_0x50d012[_0x4d40('0x64')]);}})[_0x4d40('0x36')](respondWithResult(_0x5e5004,null))[_0x4d40('0x2b')](handleError(_0x5e5004,null));};exports[_0x4d40('0x6f')]=function(_0x43760a,_0x6f0128,_0x560121){var _0x570fe5={'raw':![],'where':{}};var _0x3bdda3={};var _0x9ea21d={'count':0x0,'rows':[]};return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x43760a[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x6f0128,null))['then'](function(_0x185574){if(_0x185574){_0x3bdda3[_0x4d40('0x49')]=_['keys'](db[_0x4d40('0x6e')]['rawAttributes']);_0x3bdda3['query']=_['keys'](_0x43760a[_0x4d40('0x45')]);_0x3bdda3[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x3bdda3[_0x4d40('0x49')],_0x3bdda3['query']);_0x570fe5[_0x4d40('0x4b')]=_['intersection'](_0x3bdda3[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x570fe5[_0x4d40('0x4b')]=_0x570fe5[_0x4d40('0x4b')]['length']?_0x570fe5[_0x4d40('0x4b')]:_0x3bdda3[_0x4d40('0x49')];if(!_0x43760a['query']['hasOwnProperty'](_0x4d40('0x70'))){_0x570fe5[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x31')]);_0x570fe5['offset']=qs[_0x4d40('0x30')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x30')]);}_0x570fe5['order']=qs[_0x4d40('0x69')](_0x43760a['query'][_0x4d40('0x69')]);_0x570fe5[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_['pick'](_0x43760a[_0x4d40('0x45')],_0x3bdda3[_0x4d40('0x47')]));_0x570fe5['where'][_0x4d40('0x6a')]=_0x185574['id'];if(_0x43760a[_0x4d40('0x45')][_0x4d40('0x50')]){_0x570fe5[_0x4d40('0x4e')]=_['merge'](_0x570fe5[_0x4d40('0x4e')],{'$or':_['map'](_0x570fe5[_0x4d40('0x4b')],function(_0x16373c){var _0x4c74ff={};_0x4c74ff[_0x16373c]={'$like':'%'+_0x43760a[_0x4d40('0x45')]['filter']+'%'};return _0x4c74ff;})});}_0x570fe5=_['merge']({},_0x570fe5,_0x43760a[_0x4d40('0x53')]);return db['CannedAnswer'][_0x4d40('0x54')]({'where':_0x570fe5[_0x4d40('0x4e')]})[_0x4d40('0x36')](function(_0x283796){_0x9ea21d[_0x4d40('0x54')]=_0x283796;if(_0x43760a[_0x4d40('0x45')][_0x4d40('0x55')]){_0x570fe5['include']=[{'all':!![]}];}return db[_0x4d40('0x6e')]['findAll'](_0x570fe5);})[_0x4d40('0x36')](function(_0x58e05b){_0x9ea21d['rows']=_0x58e05b;return _0x9ea21d;});}})['then'](respondWithFilteredResult(_0x6f0128,_0x570fe5))['catch'](handleError(_0x6f0128,null));};exports[_0x4d40('0x71')]=function(_0x14ef80,_0x3593fe,_0x1be4ea){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x14ef80[_0x4d40('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3593fe,null))[_0x4d40('0x36')](function(_0x7f96d0){if(_0x7f96d0){return _0x7f96d0['removeAnswers'](_0x14ef80[_0x4d40('0x45')][_0x4d40('0x6d')]);}})[_0x4d40('0x36')](respondWithStatusCode(_0x3593fe,null))['catch'](handleError(_0x3593fe,null));};exports[_0x4d40('0x72')]=function(_0x38cd6f,_0x14c6a8,_0x30e51c){return db['WhatsappAccount'][_0x4d40('0x5c')]({'where':{'id':_0x38cd6f[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x14c6a8,null))[_0x4d40('0x36')](function(_0x345dde){if(_0x345dde){return _0x345dde[_0x4d40('0x72')](_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')],_[_0x4d40('0x73')](_0x38cd6f['body'],[_0x4d40('0x6d'),'id'])||{})[_0x4d40('0x74')](function(_0x111363){for(var _0x334eb9=0x0;_0x334eb9<_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')][_0x4d40('0x5b')];_0x334eb9+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')][_0x334eb9],'WhatsappAccountId':_0x38cd6f[_0x4d40('0x5a')]['id']});}return _0x111363;});}})[_0x4d40('0x36')](respondWithResult(_0x14c6a8,null))[_0x4d40('0x2b')](handleError(_0x14c6a8,null));};exports[_0x4d40('0x75')]=function(_0x455170,_0x3b6eea,_0x2ad153){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x455170[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x3b6eea,null))[_0x4d40('0x36')](function(_0xcd3354){if(_0xcd3354){return _0xcd3354[_0x4d40('0x75')](_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')])[_0x4d40('0x36')](function(){if(_['isArray'](_0x455170['query'][_0x4d40('0x6d')])){for(var _0x3afa95=0x0;_0x3afa95<_0x455170[_0x4d40('0x45')]['ids'][_0x4d40('0x5b')];_0x3afa95+=0x1){socket[_0x4d40('0x76')](_0x4d40('0x77'),{'UserId':Number(_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')][_0x3afa95]),'WhatsappAccountId':Number(_0x455170[_0x4d40('0x5a')]['id'])});}}else{socket[_0x4d40('0x76')](_0x4d40('0x77'),{'UserId':Number(_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')]),'WhatsappAccountId':Number(_0x455170['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b6eea,null))[_0x4d40('0x2b')](handleError(_0x3b6eea,null));};exports['getAgents']=function(_0x599c98,_0x4c58ad,_0x33ef8a){var _0x37ca45={};var _0x219acc={};var _0x2f1747;var _0x267d64;return db['WhatsappAccount'][_0x4d40('0x67')]({'where':{'id':_0x599c98['params']['id']}})['then'](handleEntityNotFound(_0x4c58ad,null))[_0x4d40('0x36')](function(_0x1d5533){if(_0x1d5533){_0x2f1747=_0x1d5533;_0x219acc['model']=_[_0x4d40('0x46')](db[_0x4d40('0x78')][_0x4d40('0x68')]);_0x219acc['query']=_[_0x4d40('0x46')](_0x599c98['query']);_0x219acc[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x219acc[_0x4d40('0x49')],_0x219acc[_0x4d40('0x45')]);_0x37ca45['attributes']=_[_0x4d40('0x48')](_0x219acc[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x37ca45[_0x4d40('0x4b')]=_0x37ca45[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x37ca45['attributes']:_0x219acc[_0x4d40('0x49')];_0x37ca45['order']=qs[_0x4d40('0x69')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x69')]);_0x37ca45[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x599c98[_0x4d40('0x45')],_0x219acc[_0x4d40('0x47')]));if(_0x599c98['query'][_0x4d40('0x50')]){_0x37ca45[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x37ca45[_0x4d40('0x4e')],{'$or':_[_0x4d40('0x41')](_0x37ca45['attributes'],function(_0x3a0458){var _0x3c35d8={};_0x3c35d8[_0x3a0458]={'$like':'%'+_0x599c98[_0x4d40('0x45')][_0x4d40('0x50')]+'%'};return _0x3c35d8;})});}_0x37ca45=_[_0x4d40('0x51')]({},_0x37ca45,_0x599c98[_0x4d40('0x53')]);return _0x2f1747[_0x4d40('0x79')](_0x37ca45);}})[_0x4d40('0x36')](function(_0xd70130){if(_0xd70130){_0x267d64=_0xd70130[_0x4d40('0x5b')];if(!_0x599c98['query']['hasOwnProperty'](_0x4d40('0x70'))){_0x37ca45[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x31')]);_0x37ca45['offset']=qs['offset'](_0x599c98['query'][_0x4d40('0x30')]);}return _0x2f1747[_0x4d40('0x79')](_0x37ca45);}})[_0x4d40('0x36')](function(_0x5464f8){if(_0x5464f8){return _0x5464f8?{'count':_0x267d64,'rows':_0x5464f8}:null;}})[_0x4d40('0x36')](respondWithResult(_0x4c58ad,null))[_0x4d40('0x2b')](handleError(_0x4c58ad,null));};exports[_0x4d40('0x7a')]=function(_0x594211,_0x1b106d,_0x571704){return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x594211[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x1b106d,null))['then'](function(_0x411a4c){if(_0x411a4c){return db['sequelize'][_0x4d40('0x7b')](function(_0x3dd6a1){return db[_0x4d40('0x7c')][_0x4d40('0x37')]({'where':{'WhatsappAccountId':_0x594211['params']['id']},'transaction':_0x3dd6a1})[_0x4d40('0x36')](function(_0x3a59d3){var _0x5141c6=_[_0x4d40('0x41')](_0x594211[_0x4d40('0x64')],function(_0x1340bd){_0x1340bd[_0x4d40('0x6a')]=_0x594211['params']['id'];return _0x1340bd;});return db[_0x4d40('0x7c')][_0x4d40('0x7d')](_0x5141c6,{'transaction':_0x3dd6a1});});})[_0x4d40('0x36')](function(){return db[_0x4d40('0x7c')][_0x4d40('0x7e')]({'where':{'WhatsappAccountId':_0x594211[_0x4d40('0x5a')]['id']},'order':'priority'});});}})[_0x4d40('0x36')](respondWithResult(_0x1b106d,null))[_0x4d40('0x2b')](handleError(_0x1b106d,null));};exports[_0x4d40('0x7f')]=function(_0x4f92f4,_0x37ca4d,_0x3079b9){var _0x5b44b0={};var _0xd6c220={};var _0x39ea8e;var _0x346d9c;return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x4f92f4[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x37ca4d,null))[_0x4d40('0x36')](function(_0x4001af){if(_0x4001af){_0x39ea8e=_0x4001af;_0xd6c220[_0x4d40('0x49')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0xd6c220[_0x4d40('0x45')]=_[_0x4d40('0x46')](_0x4f92f4[_0x4d40('0x45')]);_0xd6c220['filters']=_['intersection'](_0xd6c220[_0x4d40('0x49')],_0xd6c220[_0x4d40('0x45')]);_0x5b44b0['attributes']=_[_0x4d40('0x48')](_0xd6c220['model'],qs[_0x4d40('0x4a')](_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x5b44b0['attributes']=_0x5b44b0[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x5b44b0[_0x4d40('0x4b')]:_0xd6c220['model'];_0x5b44b0[_0x4d40('0x4d')]=qs[_0x4d40('0x69')](_0x4f92f4[_0x4d40('0x45')]['sort']);_0x5b44b0[_0x4d40('0x4e')]=qs['filters'](_[_0x4d40('0x4f')](_0x4f92f4[_0x4d40('0x45')],_0xd6c220['filters']));if(_0x4f92f4['query'][_0x4d40('0x50')]){_0x5b44b0[_0x4d40('0x4e')]=_['merge'](_0x5b44b0['where'],{'$or':_['map'](_0x5b44b0[_0x4d40('0x4b')],function(_0x36605e){var _0x4839a1={};_0x4839a1[_0x36605e]={'$like':'%'+_0x4f92f4[_0x4d40('0x45')]['filter']+'%'};return _0x4839a1;})});}_0x5b44b0=_['merge']({},_0x5b44b0,_0x4f92f4[_0x4d40('0x53')]);return _0x39ea8e[_0x4d40('0x7f')](_0x5b44b0);}})[_0x4d40('0x36')](function(_0x1cd057){if(_0x1cd057){_0x346d9c=_0x1cd057[_0x4d40('0x5b')];if(!_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x4c')](_0x4d40('0x70'))){_0x5b44b0[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x31')]);_0x5b44b0['offset']=qs['offset'](_0x4f92f4[_0x4d40('0x45')]['offset']);}return _0x39ea8e[_0x4d40('0x7f')](_0x5b44b0);}})[_0x4d40('0x36')](function(_0x3df448){if(_0x3df448){return _0x3df448?{'count':_0x346d9c,'rows':_0x3df448}:null;}})[_0x4d40('0x36')](respondWithResult(_0x37ca4d,null))[_0x4d40('0x2b')](handleError(_0x37ca4d,null));};exports[_0x4d40('0x80')]=function(_0x2e2b5a,_0xdeb15b,_0x3efc1a){var _0x456cc6={'channel':'whatsapp'};var _0x3b97e5=[];var _0xbc145=[];var _0x3b3e7a={};return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x2e2b5a[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x7c')],'as':'Applications'}]})[_0x4d40('0x36')](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x2b7726){_0x456cc6[_0x4d40('0x81')]=_0x2b7726;_0x456cc6[_0x4d40('0x82')]=_['orderBy'](_0x2b7726['Applications'],[_0x4d40('0x83')],[_0x4d40('0x84')]);if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0x85')]){delete _0x456cc6[_0x4d40('0x81')][_0x4d40('0x85')];}return db[_0x4d40('0x86')][_0x4d40('0x65')]();})[_0x4d40('0x36')](function(_0x177109){if(!_0x177109){throw new db[(_0x4d40('0x21'))]['ValidationError'](_0x4d40('0x87'));}_0x3b97e5=_[_0x4d40('0x88')](_[_0x4d40('0x46')](_0x177109),[_0x4d40('0x89'),_0x4d40('0x8a')]);_0xbc145=_['difference'](_[_0x4d40('0x46')](_0x177109),[_0x4d40('0x89'),'updatedAt','CompanyId',_0x4d40('0x8b')]);_0x456cc6[_0x4d40('0x64')]={'mapKey':_0x4d40('0x8c')};if(_0x456cc6[_0x4d40('0x81')]['type']&&_0x456cc6[_0x4d40('0x81')][_0x4d40('0x8d')]===_0x4d40('0x8e')){_0x456cc6[_0x4d40('0x64')]['from']=_0x2e2b5a[_0x4d40('0x64')][_0x4d40('0x8f')][_0x4d40('0x90')](_0x4d40('0x91'),'');_0x456cc6['body'][_0x4d40('0x64')]=_0x2e2b5a[_0x4d40('0x64')][_0x4d40('0x92')];_0x456cc6['body'][_0x4d40('0x93')]=_0x2e2b5a[_0x4d40('0x64')]['MessageSid'];}if(_0x456cc6[_0x4d40('0x64')]['id']){delete _0x456cc6['body']['id'];}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')]['from'])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x95'));}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')]['body'])||_0x456cc6[_0x4d40('0x64')][_0x4d40('0x64')]===''){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x96'));}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')])){throw new db[(_0x4d40('0x21'))]['ValidationError'](_0x4d40('0x98')+_0xbc145);}if(!_[_0x4d40('0x99')](_0xbc145,_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x9a')+_0xbc145);}_0x3b3e7a[_0x456cc6[_0x4d40('0x64')]['mapKey']]=_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')];return db[_0x4d40('0x9c')][_0x4d40('0x5c')]({'where':{'id':_0x456cc6['account'][_0x4d40('0x8b')]},'include':[{'model':db[_0x4d40('0x86')],'as':_0x4d40('0x9d'),'where':_0x3b3e7a,'limit':0x1,'order':[['updatedAt',_0x4d40('0x9e')]]}]});})[_0x4d40('0x36')](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x193bce){if(_0x193bce){_0x456cc6['list']=_['omit'](_0x193bce,[_0x4d40('0x9d')]);if(_0x193bce['Contacts']['length']){return _0x193bce[_0x4d40('0x9d')][0x0];}var _0x44926f=_[_0x4d40('0x1a')](_0x456cc6[_0x4d40('0x64')],{'firstName':_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')],'ListId':_0x193bce['id']});_0x44926f[_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')]]=_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')];return db[_0x4d40('0x86')][_0x4d40('0x5d')](_0x44926f,{'fields':_0x3b97e5,'raw':!![]});}})['then'](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x383021){if(_0x383021){_0x456cc6[_0x4d40('0x9f')]=_0x383021;var _0x5c06d1={'ContactId':_0x383021['id'],'phone':_0x456cc6[_0x4d40('0x64')]['from'],'WhatsappAccountId':_0x2e2b5a['params']['id']};var _0x4c0533={'ContactId':_0x383021['id'],'WhatsappAccountId':_0x2e2b5a[_0x4d40('0x5a')]['id'],'closed':![]};return db[_0x4d40('0xa0')][_0x4d40('0x5c')]({'where':_0x4c0533})[_0x4d40('0x36')](function(_0x5a5585){if(_0x5a5585){return[_0x5a5585,![]];}return db['WhatsappInteraction'][_0x4d40('0x5d')](_0x5c06d1)[_0x4d40('0x36')](function(_0x1b6207){return[_0x1b6207,!![]];});});}})[_0x4d40('0x74')](function(_0x13a6dc,_0x4f2ecb){_0x456cc6[_0x4d40('0xa1')]=_0x13a6dc['get']({'plain':!![]});_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa2')]=![];if(_0x4f2ecb){if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0xa3')]){_0x456cc6[_0x4d40('0x82')]['push']({'id':0x0,'priority':_0x456cc6['applications'][_0x4d40('0x5b')]+0x1,'app':_0x4d40('0xa4'),'appdata':_0x4d40('0xa5'),'interval':'*,*,*,*'});}_0x456cc6[_0x4d40('0xa1')]['created']=!![];}return db[_0x4d40('0xa6')][_0x4d40('0x5d')]({'phone':_0x456cc6['body'][_0x4d40('0x9b')],'messageId':_0x456cc6[_0x4d40('0x64')]['messageId'],'body':_0x456cc6['body'][_0x4d40('0x64')],'WhatsappAccountId':_0x2e2b5a[_0x4d40('0x5a')]['id'],'WhatsappInteractionId':_0x13a6dc['id'],'direction':'in','ContactId':_0x13a6dc[_0x4d40('0xa7')],'AttachmentId':_0x456cc6[_0x4d40('0x64')][_0x4d40('0xa8')]});})['then'](function(_0x465da3){_0x456cc6[_0x4d40('0x2a')]=_0x465da3;if(_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa9')]){return db[_0x4d40('0x78')]['find']({'attributes':['id',_0x4d40('0x3c')],'where':{'id':_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa9')]}})[_0x4d40('0x36')](function(_0x199885){if(_0x199885){_0x456cc6[_0x4d40('0x82')][_0x4d40('0xaa')]({'id':0x0,'priority':0x0,'app':_0x4d40('0xab'),'appdata':_0x199885[_0x4d40('0x3c')]+','+(_0x456cc6[_0x4d40('0x81')][_0x4d40('0xac')]||0xa),'interval':_0x4d40('0xad')});}return respondWithRpcPromise('Start',_0x4d40('0xae'),_0x456cc6);});}return respondWithRpcPromise(_0x4d40('0xaf'),_0x4d40('0xae'),_0x456cc6);})[_0x4d40('0x36')](function(_0x22cf44){if(_0x22cf44){var _0x1332e3=0xc8;var _0xc86cc2=_0x4d40('0xb0');logger[_0x4d40('0xb1')](_0x4d40('0xb2'),_0xc86cc2,_0x1332e3,_0x4d40('0xb3'));logger[_0x4d40('0xb4')](_0x4d40('0xb5'),_0xc86cc2,_0x1332e3,_0x4d40('0xb3'),JSON[_0x4d40('0x27')](_0x22cf44));if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0x8d')]===_0x4d40('0x8e')){return _0xdeb15b[_0x4d40('0x2d')](_0x1332e3)['set'](_0x4d40('0xb6'),'text/xml')[_0x4d40('0x3d')](_0x4d40('0xb7'));}else{return _0xdeb15b['status'](_0x1332e3)[_0x4d40('0x2f')](_0x22cf44);}}})[_0x4d40('0x2b')](handleError(_0xdeb15b,null));};exports[_0x4d40('0x3d')]=function(_0x50dcda,_0x55774f,_0x47faa9){var _0x2b6cfd,_0x494d0c,_0x296dac;if(_['isNil'](_0x50dcda[_0x4d40('0x64')]['body'])||_0x50dcda['body'][_0x4d40('0x64')]===''){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4d40('0x94')](_0x50dcda['body']['to'])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0xb8'));}_0x2b6cfd=_0x50dcda[_0x4d40('0x64')]['to'];return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x50dcda[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x9c')],'as':_0x4d40('0xb9'),'include':[{'model':db['CmContact'],'as':_0x4d40('0x9d'),'where':{'mobile':_0x2b6cfd},'limit':0x1,'order':[[_0x4d40('0x8a'),_0x4d40('0x9e')]]}]}]})[_0x4d40('0x36')](handleEntityNotFound(_0x55774f,null))[_0x4d40('0x36')](function(_0x5ddcdb){if(_0x5ddcdb&&_0x5ddcdb[_0x4d40('0xb9')]){_0x494d0c=_0x5ddcdb[_0x4d40('0x38')]({'plain':!![]});if(_0x494d0c[_0x4d40('0xb9')]&&_0x494d0c[_0x4d40('0xb9')][_0x4d40('0x9d')][_0x4d40('0x5b')]){return _0x494d0c[_0x4d40('0xb9')][_0x4d40('0x9d')][0x0];}return db['CmContact'][_0x4d40('0x5d')](_[_0x4d40('0x1a')](_0x50dcda[_0x4d40('0x64')],{'firstName':_0x2b6cfd,'mobile':_0x2b6cfd,'phone':_0x2b6cfd,'ListId':_0x494d0c['ListId']}));}})[_0x4d40('0x36')](handleEntityNotFound(_0x55774f,null))[_0x4d40('0x36')](function(_0x523d37){if(_0x523d37){_0x296dac=_0x523d37;return db[_0x4d40('0xa0')]['find']({'where':{'ContactId':_0x296dac['id'],'closed':![],'WhatsappAccountId':_0x494d0c['id']}})[_0x4d40('0x36')](function(_0x558de3){if(_0x558de3){return[_0x558de3,![]];}return db[_0x4d40('0xa0')]['create']({'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id'],'WhatsappAccountId':_0x494d0c['id'],'phone':_0x2b6cfd,'firstMsgDirection':_0x4d40('0xba'),'Messages':[_[_0x4d40('0x51')](_0x50dcda[_0x4d40('0x64')],{'read':![],'body':_0x50dcda[_0x4d40('0x64')][_0x4d40('0x64')],'phone':_0x2b6cfd,'WhatsappAccountId':_0x494d0c['id'],'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id']})]},{'include':[{'model':db[_0x4d40('0xa6')],'as':_0x4d40('0xbb')}]})[_0x4d40('0x36')](function(_0x53a8ec){return[_0x53a8ec,!![]];});});}})[_0x4d40('0x74')](function(_0x41d30c,_0x2bbfe1){if(_0x2bbfe1){return _0x41d30c;}return db['WhatsappMessage'][_0x4d40('0x5d')](_['merge'](_0x50dcda['body'],{'read':![],'body':_0x50dcda[_0x4d40('0x64')]['body'],'phone':_0x2b6cfd,'WhatsappAccountId':_0x494d0c['id'],'WhatsappInteractionId':_0x41d30c['id'],'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id']}))[_0x4d40('0x36')](function(_0x4d1e19){_0x41d30c[_0x4d40('0xbc')]['Messages']=[];_0x41d30c['dataValues']['Messages']['push'](_0x4d1e19[_0x4d40('0xbc')]);return _0x41d30c;});})[_0x4d40('0x36')](respondWithResult(_0x55774f,null))[_0x4d40('0x2b')](handleError(_0x55774f,null));}; \ No newline at end of file +var _0x282b=['twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','spread','interaction','created','applications','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','limit','where','pick','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','nolimit','order','sort','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId'];(function(_0x15c3bf,_0x1c11e2){var _0x3a21a6=function(_0x5c9544){while(--_0x5c9544){_0x15c3bf['push'](_0x15c3bf['shift']());}};_0x3a21a6(++_0x1c11e2);}(_0x282b,0xec));var _0xb282=function(_0x48a60a,_0x918048){_0x48a60a=_0x48a60a-0x0;var _0x213bdb=_0x282b[_0x48a60a];return _0x213bdb;};'use strict';var pdf=require(_0xb282('0x0'));var emlformat=require(_0xb282('0x1'));var rimraf=require(_0xb282('0x2'));var zipdir=require(_0xb282('0x3'));var jsonpatch=require(_0xb282('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb282('0x5'));var Mustache=require('mustache');var util=require(_0xb282('0x6'));var path=require(_0xb282('0x7'));var sox=require(_0xb282('0x8'));var csv=require(_0xb282('0x9'));var ejs=require(_0xb282('0xa'));var fs=require('fs');var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb282('0x17')](config[_0xb282('0x18')],{'host':_0xb282('0x19'),'port':0x18eb});var socket=require(_0xb282('0x1a'))(new Redis(config[_0xb282('0x18')]));require('./whatsappAccount.socket')[_0xb282('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb282('0x1c')][_0xb282('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x4af892,_0x525cfa,_0x5bc7c3){if(_0x5bc7c3){var _0x13cea1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13cea1[_0xb282('0x1e')](_0x525cfa)){return _0x4af892;}else{throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))](_0xb282('0x21'));}}else{return _0x4af892;}}function respondWithRpcPromise(_0x5307ed,_0x191a31,_0x5519bf,_0xca5f12){return new BPromise(function(_0x45b070,_0x3f8a3f){var _0x492d20=_0xca5f12||client;return _0x492d20['request'](_0x5307ed,_0x5519bf)[_0xb282('0x22')](function(_0x2cdeb1){logger['info'](_0xb282('0x23'),_0x191a31,_0xb282('0x24'));logger[_0xb282('0x25')](_0xb282('0x26'),_0x191a31,_0xb282('0x24'),JSON['stringify'](_0x2cdeb1));if(_0x2cdeb1[_0xb282('0x27')]){if(_0x2cdeb1[_0xb282('0x27')][_0xb282('0x28')]===0x1f4){logger['error'](_0xb282('0x23'),_0x191a31,_0x2cdeb1[_0xb282('0x27')][_0xb282('0x29')]);return _0x3f8a3f(_0x2cdeb1[_0xb282('0x27')][_0xb282('0x29')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x191a31,_0x2cdeb1[_0xb282('0x27')][_0xb282('0x29')]);return _0x45b070(_0x2cdeb1['error']['message']);}else{logger[_0xb282('0x2a')](_0xb282('0x23'),_0x191a31,_0xb282('0x24'));_0x45b070(_0x2cdeb1[_0xb282('0x2b')][_0xb282('0x29')]);}})[_0xb282('0x2c')](function(_0x5b1d3d){logger[_0xb282('0x27')](_0xb282('0x23'),_0x191a31,_0x5b1d3d);_0x3f8a3f(_0x5b1d3d);});});}function respondWithStatusCode(_0x50bd73,_0x22d895){_0x22d895=_0x22d895||0xcc;return function(_0x38a1f8){if(_0x38a1f8){return _0x50bd73[_0xb282('0x2d')](_0x22d895);}return _0x50bd73[_0xb282('0x2e')](_0x22d895)['end']();};}function respondWithResult(_0x1520b1,_0x1fb89f){_0x1fb89f=_0x1fb89f||0xc8;return function(_0xe337b8){if(_0xe337b8){return _0x1520b1[_0xb282('0x2e')](_0x1fb89f)[_0xb282('0x2f')](_0xe337b8);}};}function respondWithFilteredResult(_0xfddd2e,_0x22f657){return function(_0x499e3d){if(_0x499e3d){var _0x1b15b5=_0x499e3d[_0xb282('0x30')],_0x1e2861=_0x22f657['offset'],_0x3eb294=_0x22f657[_0xb282('0x31')]+_0x22f657['limit'],_0xd8780b;if(_0x3eb294>=_0x1b15b5){_0x3eb294=_0x1b15b5;_0xd8780b=0xc8;}else{_0xd8780b=0xce;}_0xfddd2e[_0xb282('0x2e')](_0xd8780b);return _0xfddd2e[_0xb282('0x32')](_0xb282('0x33'),_0x1e2861+'-'+_0x3eb294+'/'+_0x1b15b5)['json'](_0x499e3d);}return null;};}function patchUpdates(_0x22fefc){return function(_0x548bca){try{jsonpatch[_0xb282('0x34')](_0x548bca,_0x22fefc,!![]);}catch(_0x2aff13){return BPromise[_0xb282('0x35')](_0x2aff13);}return _0x548bca[_0xb282('0x36')]();};}function saveUpdates(_0x1c58c2,_0x1b740c){return function(_0x50bf75){if(_0x50bf75){return _0x50bf75[_0xb282('0x37')](_0x1c58c2)[_0xb282('0x22')](function(_0x4ede9d){return _0x4ede9d;});}return null;};}function removeEntity(_0x5d206c,_0x2dec75){return function(_0x271643){if(_0x271643){return _0x271643[_0xb282('0x38')]()['then'](function(){var _0x4a76ce=_0x271643['get']({'plain':!![]});var _0x27073b=_0xb282('0x39');return db[_0xb282('0x3a')][_0xb282('0x38')]({'where':{'type':_0x27073b,'resourceId':_0x4a76ce['id']}})[_0xb282('0x22')](function(){return _0x271643;});})[_0xb282('0x22')](function(){_0x5d206c[_0xb282('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc171,_0x5c2d92){return function(_0x439eb4){if(!_0x439eb4){_0x3dc171[_0xb282('0x2d')](0x194);}return _0x439eb4;};}function handleError(_0x3514cf,_0x4f6cf1){_0x4f6cf1=_0x4f6cf1||0x1f4;return function(_0x11a477){logger['error'](_0x11a477[_0xb282('0x3b')]);if(_0x11a477[_0xb282('0x3c')]){delete _0x11a477[_0xb282('0x3c')];}_0x3514cf[_0xb282('0x2e')](_0x4f6cf1)['send'](_0x11a477);};}exports['index']=function(_0x397fa1,_0x12c5b8){var _0x3791fd={'include':[{'model':db[_0xb282('0x3d')],'as':'mandatoryDispositionPause'}]},_0x20d56c={},_0x488902={'count':0x0,'rows':[]};var _0x475895=_[_0xb282('0x3e')](db['WhatsappAccount'][_0xb282('0x3f')],function(_0x8b03ce){return{'name':_0x8b03ce[_0xb282('0x40')],'type':_0x8b03ce[_0xb282('0x41')][_0xb282('0x42')]};});_0x20d56c[_0xb282('0x43')]=_[_0xb282('0x3e')](_0x475895,_0xb282('0x3c'));_0x20d56c[_0xb282('0x44')]=_[_0xb282('0x45')](_0x397fa1[_0xb282('0x44')]);_0x20d56c[_0xb282('0x46')]=_[_0xb282('0x47')](_0x20d56c[_0xb282('0x43')],_0x20d56c[_0xb282('0x44')]);_0x3791fd[_0xb282('0x48')]=_[_0xb282('0x47')](_0x20d56c[_0xb282('0x43')],qs['fields'](_0x397fa1[_0xb282('0x44')]['fields']));_0x3791fd[_0xb282('0x48')]=_0x3791fd[_0xb282('0x48')][_0xb282('0x49')]?_0x3791fd[_0xb282('0x48')]:_0x20d56c[_0xb282('0x43')];if(!_0x397fa1[_0xb282('0x44')]['hasOwnProperty']('nolimit')){_0x3791fd[_0xb282('0x4a')]=qs['limit'](_0x397fa1[_0xb282('0x44')][_0xb282('0x4a')]);_0x3791fd['offset']=qs[_0xb282('0x31')](_0x397fa1[_0xb282('0x44')][_0xb282('0x31')]);}_0x3791fd['order']=qs['sort'](_0x397fa1[_0xb282('0x44')]['sort']);_0x3791fd[_0xb282('0x4b')]=qs[_0xb282('0x46')](_[_0xb282('0x4c')](_0x397fa1[_0xb282('0x44')],_0x20d56c[_0xb282('0x46')]),_0x475895);if(_0x397fa1[_0xb282('0x44')]['filter']){_0x3791fd[_0xb282('0x4b')]=_[_0xb282('0x4d')](_0x3791fd[_0xb282('0x4b')],{'$or':_['map'](_0x475895,function(_0xacf42e){if(_0xacf42e['type']!==_0xb282('0x4e')){var _0x4b0822={};_0x4b0822[_0xacf42e[_0xb282('0x3c')]]={'$like':'%'+_0x397fa1['query']['filter']+'%'};return _0x4b0822;}})});}_0x3791fd=_['merge']({},_0x3791fd,_0x397fa1[_0xb282('0x4f')]);var _0x32765f={'where':_0x3791fd[_0xb282('0x4b')]};return db[_0xb282('0x50')]['count'](_0x32765f)['then'](function(_0x57e527){_0x488902[_0xb282('0x30')]=_0x57e527;if(_0x397fa1[_0xb282('0x44')][_0xb282('0x51')]){_0x3791fd[_0xb282('0x52')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb282('0x53')](_0x3791fd);})[_0xb282('0x22')](function(_0x552703){_0x488902[_0xb282('0x54')]=_0x552703;return _0x488902;})[_0xb282('0x22')](respondWithFilteredResult(_0x12c5b8,_0x3791fd))[_0xb282('0x2c')](handleError(_0x12c5b8,null));};exports[_0xb282('0x55')]=function(_0x1d356e,_0x5522be){var _0x6a295c={'raw':![],'where':{'id':_0x1d356e[_0xb282('0x56')]['id']},'include':[{'model':db[_0xb282('0x3d')],'as':_0xb282('0x57')}]},_0x3d4182={};_0x3d4182[_0xb282('0x43')]=_['keys'](db[_0xb282('0x50')]['rawAttributes']);_0x3d4182[_0xb282('0x44')]=_[_0xb282('0x45')](_0x1d356e['query']);_0x3d4182[_0xb282('0x46')]=_[_0xb282('0x47')](_0x3d4182[_0xb282('0x43')],_0x3d4182['query']);_0x6a295c['attributes']=_[_0xb282('0x47')](_0x3d4182[_0xb282('0x43')],qs[_0xb282('0x58')](_0x1d356e['query'][_0xb282('0x58')]));_0x6a295c['attributes']=_0x6a295c[_0xb282('0x48')][_0xb282('0x49')]?_0x6a295c['attributes']:_0x3d4182[_0xb282('0x43')];if(_0x1d356e['query'][_0xb282('0x51')]){_0x6a295c[_0xb282('0x52')]=[{'all':!![]}];}_0x6a295c=_[_0xb282('0x4d')]({},_0x6a295c,_0x1d356e[_0xb282('0x4f')]);return db[_0xb282('0x50')][_0xb282('0x59')](_0x6a295c)['then'](handleEntityNotFound(_0x5522be,null))[_0xb282('0x22')](respondWithResult(_0x5522be,null))['catch'](handleError(_0x5522be,null));};exports[_0xb282('0x5a')]=function(_0x34baf2,_0x53d50a){return db['WhatsappAccount'][_0xb282('0x5a')](_0x34baf2[_0xb282('0x5b')],{})[_0xb282('0x22')](function(_0x5225d7){var _0x593a93=_0x34baf2[_0xb282('0x5c')][_0xb282('0x5d')]({'plain':!![]});if(!_0x593a93)throw new Error(_0xb282('0x5e'));if(_0x593a93['role']===_0xb282('0x5c')){var _0x5d5318=_0x5225d7[_0xb282('0x5d')]({'plain':!![]});var _0x1de487=_0xb282('0x39');return db[_0xb282('0x5f')][_0xb282('0x59')]({'where':{'name':_0x1de487,'userProfileId':_0x593a93[_0xb282('0x60')]},'raw':!![]})[_0xb282('0x22')](function(_0x5c0bf1){if(_0x5c0bf1&&_0x5c0bf1[_0xb282('0x61')]===0x0){return db[_0xb282('0x3a')][_0xb282('0x5a')]({'name':_0x5d5318['name'],'resourceId':_0x5d5318['id'],'type':_0x5c0bf1['name'],'sectionId':_0x5c0bf1['id']},{})[_0xb282('0x22')](function(){return _0x5225d7;});}else{return _0x5225d7;}})[_0xb282('0x2c')](function(_0x1d2d00){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d2d00);throw _0x1d2d00;});}return _0x5225d7;})[_0xb282('0x22')](respondWithResult(_0x53d50a,0xc9))[_0xb282('0x2c')](handleError(_0x53d50a,null));};exports['update']=function(_0x7bd956,_0x4648ac){if(_0x7bd956[_0xb282('0x5b')]['id']){delete _0x7bd956['body']['id'];}return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x7bd956['params']['id']},'include':[{'model':db[_0xb282('0x3d')],'as':_0xb282('0x57')}]})[_0xb282('0x22')](handleEntityNotFound(_0x4648ac,null))[_0xb282('0x22')](saveUpdates(_0x7bd956['body'],null))['then'](respondWithResult(_0x4648ac,null))[_0xb282('0x2c')](handleError(_0x4648ac,null));};exports[_0xb282('0x38')]=function(_0x54e55c,_0x3cdcf5){return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x54e55c[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x3cdcf5,null))[_0xb282('0x22')](removeEntity(_0x3cdcf5,null))[_0xb282('0x2c')](handleError(_0x3cdcf5,null));};exports[_0xb282('0x62')]=function(_0x4ef228,_0x1dd730){return db[_0xb282('0x50')][_0xb282('0x62')]()['then'](respondWithResult(_0x1dd730,null))[_0xb282('0x2c')](handleError(_0x1dd730,null));};exports[_0xb282('0x63')]=function(_0x599757,_0x5d8532,_0x1bb9b3){if(_0x599757[_0xb282('0x5b')]['id']){delete _0x599757[_0xb282('0x5b')]['id'];}return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x599757[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x5d8532,null))[_0xb282('0x22')](function(_0x1d8e6a){if(_0x1d8e6a){_0x599757[_0xb282('0x5b')][_0xb282('0x64')]=_0x1d8e6a['id'];return db[_0xb282('0x65')][_0xb282('0x5a')](_0x599757[_0xb282('0x5b')]);}})[_0xb282('0x22')](respondWithResult(_0x5d8532,null))[_0xb282('0x2c')](handleError(_0x5d8532,null));};exports['getDispositions']=function(_0x2cffa2,_0x2c7986,_0x3cf767){var _0x2b6db9={'raw':![],'where':{}};var _0x277769={};var _0x24c1fa={'count':0x0,'rows':[]};return db[_0xb282('0x50')][_0xb282('0x66')]({'where':{'id':_0x2cffa2[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x2c7986,null))[_0xb282('0x22')](function(_0x4ed895){if(_0x4ed895){_0x277769[_0xb282('0x43')]=_[_0xb282('0x45')](db[_0xb282('0x65')][_0xb282('0x3f')]);_0x277769[_0xb282('0x44')]=_['keys'](_0x2cffa2['query']);_0x277769[_0xb282('0x46')]=_[_0xb282('0x47')](_0x277769[_0xb282('0x43')],_0x277769[_0xb282('0x44')]);_0x2b6db9[_0xb282('0x48')]=_[_0xb282('0x47')](_0x277769[_0xb282('0x43')],qs['fields'](_0x2cffa2['query'][_0xb282('0x58')]));_0x2b6db9[_0xb282('0x48')]=_0x2b6db9['attributes']['length']?_0x2b6db9[_0xb282('0x48')]:_0x277769[_0xb282('0x43')];if(!_0x2cffa2[_0xb282('0x44')][_0xb282('0x67')](_0xb282('0x68'))){_0x2b6db9[_0xb282('0x4a')]=qs[_0xb282('0x4a')](_0x2cffa2['query'][_0xb282('0x4a')]);_0x2b6db9[_0xb282('0x31')]=qs[_0xb282('0x31')](_0x2cffa2[_0xb282('0x44')][_0xb282('0x31')]);}_0x2b6db9[_0xb282('0x69')]=qs[_0xb282('0x6a')](_0x2cffa2[_0xb282('0x44')][_0xb282('0x6a')]);_0x2b6db9[_0xb282('0x4b')]=qs['filters'](_[_0xb282('0x4c')](_0x2cffa2[_0xb282('0x44')],_0x277769[_0xb282('0x46')]));_0x2b6db9[_0xb282('0x4b')][_0xb282('0x64')]=_0x4ed895['id'];if(_0x2cffa2[_0xb282('0x44')][_0xb282('0x6b')]){_0x2b6db9[_0xb282('0x4b')]=_['merge'](_0x2b6db9[_0xb282('0x4b')],{'$or':_[_0xb282('0x3e')](_0x2b6db9[_0xb282('0x48')],function(_0x313018){var _0x314183={};_0x314183[_0x313018]={'$like':'%'+_0x2cffa2[_0xb282('0x44')]['filter']+'%'};return _0x314183;})});}_0x2b6db9=_[_0xb282('0x4d')]({},_0x2b6db9,_0x2cffa2[_0xb282('0x4f')]);return db[_0xb282('0x65')]['count']({'where':_0x2b6db9[_0xb282('0x4b')]})[_0xb282('0x22')](function(_0x4e894e){_0x24c1fa[_0xb282('0x30')]=_0x4e894e;if(_0x2cffa2[_0xb282('0x44')][_0xb282('0x51')]){_0x2b6db9[_0xb282('0x52')]=[{'all':!![]}];}return db[_0xb282('0x65')][_0xb282('0x53')](_0x2b6db9);})[_0xb282('0x22')](function(_0x5cb2ce){_0x24c1fa['rows']=_0x5cb2ce;return _0x24c1fa;});}})[_0xb282('0x22')](respondWithFilteredResult(_0x2c7986,_0x2b6db9))['catch'](handleError(_0x2c7986,null));};exports[_0xb282('0x6c')]=function(_0x45b772,_0x3ca8d9,_0x47331b){return db[_0xb282('0x50')]['find']({'where':{'id':_0x45b772[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x3ca8d9,null))[_0xb282('0x22')](function(_0x5d7eb3){if(_0x5d7eb3){return _0x5d7eb3[_0xb282('0x6c')](_0x45b772[_0xb282('0x44')][_0xb282('0x6d')]);}})[_0xb282('0x22')](respondWithStatusCode(_0x3ca8d9,null))[_0xb282('0x2c')](handleError(_0x3ca8d9,null));};exports[_0xb282('0x6e')]=function(_0x534465,_0x28f5c3,_0x1c17f5){if(_0x534465[_0xb282('0x5b')]['id']){delete _0x534465[_0xb282('0x5b')]['id'];}return db['WhatsappAccount'][_0xb282('0x59')]({'where':{'id':_0x534465[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x28f5c3,null))[_0xb282('0x22')](function(_0x353962){if(_0x353962){_0x534465[_0xb282('0x5b')][_0xb282('0x64')]=_0x353962['id'];return db[_0xb282('0x6f')][_0xb282('0x5a')](_0x534465[_0xb282('0x5b')]);}})[_0xb282('0x22')](respondWithResult(_0x28f5c3,null))['catch'](handleError(_0x28f5c3,null));};exports[_0xb282('0x70')]=function(_0x129818,_0x5c4404,_0x22b2c4){var _0x401a3b={'raw':![],'where':{}};var _0x357327={};var _0x14deef={'count':0x0,'rows':[]};return db[_0xb282('0x50')][_0xb282('0x66')]({'where':{'id':_0x129818[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x5c4404,null))[_0xb282('0x22')](function(_0x1948f8){if(_0x1948f8){_0x357327['model']=_[_0xb282('0x45')](db[_0xb282('0x6f')][_0xb282('0x3f')]);_0x357327[_0xb282('0x44')]=_[_0xb282('0x45')](_0x129818[_0xb282('0x44')]);_0x357327[_0xb282('0x46')]=_[_0xb282('0x47')](_0x357327[_0xb282('0x43')],_0x357327[_0xb282('0x44')]);_0x401a3b[_0xb282('0x48')]=_['intersection'](_0x357327['model'],qs[_0xb282('0x58')](_0x129818[_0xb282('0x44')][_0xb282('0x58')]));_0x401a3b[_0xb282('0x48')]=_0x401a3b[_0xb282('0x48')][_0xb282('0x49')]?_0x401a3b[_0xb282('0x48')]:_0x357327[_0xb282('0x43')];if(!_0x129818[_0xb282('0x44')][_0xb282('0x67')](_0xb282('0x68'))){_0x401a3b['limit']=qs['limit'](_0x129818['query']['limit']);_0x401a3b[_0xb282('0x31')]=qs[_0xb282('0x31')](_0x129818[_0xb282('0x44')]['offset']);}_0x401a3b[_0xb282('0x69')]=qs[_0xb282('0x6a')](_0x129818[_0xb282('0x44')][_0xb282('0x6a')]);_0x401a3b['where']=qs[_0xb282('0x46')](_[_0xb282('0x4c')](_0x129818[_0xb282('0x44')],_0x357327[_0xb282('0x46')]));_0x401a3b[_0xb282('0x4b')][_0xb282('0x64')]=_0x1948f8['id'];if(_0x129818[_0xb282('0x44')][_0xb282('0x6b')]){_0x401a3b[_0xb282('0x4b')]=_[_0xb282('0x4d')](_0x401a3b[_0xb282('0x4b')],{'$or':_[_0xb282('0x3e')](_0x401a3b[_0xb282('0x48')],function(_0xbe7893){var _0x2339fd={};_0x2339fd[_0xbe7893]={'$like':'%'+_0x129818[_0xb282('0x44')][_0xb282('0x6b')]+'%'};return _0x2339fd;})});}_0x401a3b=_[_0xb282('0x4d')]({},_0x401a3b,_0x129818[_0xb282('0x4f')]);return db[_0xb282('0x6f')][_0xb282('0x30')]({'where':_0x401a3b[_0xb282('0x4b')]})['then'](function(_0xb60381){_0x14deef['count']=_0xb60381;if(_0x129818['query']['includeAll']){_0x401a3b[_0xb282('0x52')]=[{'all':!![]}];}return db[_0xb282('0x6f')][_0xb282('0x53')](_0x401a3b);})[_0xb282('0x22')](function(_0x28e21f){_0x14deef[_0xb282('0x54')]=_0x28e21f;return _0x14deef;});}})['then'](respondWithFilteredResult(_0x5c4404,_0x401a3b))[_0xb282('0x2c')](handleError(_0x5c4404,null));};exports[_0xb282('0x71')]=function(_0x3dcb42,_0x505f39,_0x494d54){return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x3dcb42[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x505f39,null))['then'](function(_0x2f5d7b){if(_0x2f5d7b){return _0x2f5d7b[_0xb282('0x71')](_0x3dcb42[_0xb282('0x44')][_0xb282('0x6d')]);}})[_0xb282('0x22')](respondWithStatusCode(_0x505f39,null))[_0xb282('0x2c')](handleError(_0x505f39,null));};exports[_0xb282('0x72')]=function(_0x46b117,_0x170f35,_0x2cce39){return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x46b117[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x170f35,null))[_0xb282('0x22')](function(_0x194798){if(_0x194798){return _0x194798[_0xb282('0x72')](_0x46b117[_0xb282('0x5b')][_0xb282('0x6d')],_['omit'](_0x46b117[_0xb282('0x5b')],[_0xb282('0x6d'),'id'])||{})['spread'](function(_0x584740){for(var _0x15acf4=0x0;_0x15acf4<_0x46b117[_0xb282('0x5b')]['ids']['length'];_0x15acf4+=0x1){socket[_0xb282('0x73')](_0xb282('0x74'),{'UserId':_0x46b117[_0xb282('0x5b')][_0xb282('0x6d')][_0x15acf4],'WhatsappAccountId':_0x46b117['params']['id']});}return _0x584740;});}})[_0xb282('0x22')](respondWithResult(_0x170f35,null))[_0xb282('0x2c')](handleError(_0x170f35,null));};exports[_0xb282('0x75')]=function(_0x3e2abb,_0x5d4e6a,_0x541029){return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x3e2abb[_0xb282('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d4e6a,null))['then'](function(_0x594731){if(_0x594731){return _0x594731[_0xb282('0x75')](_0x3e2abb[_0xb282('0x44')][_0xb282('0x6d')])[_0xb282('0x22')](function(){if(_[_0xb282('0x76')](_0x3e2abb['query']['ids'])){for(var _0x115dcf=0x0;_0x115dcf<_0x3e2abb[_0xb282('0x44')][_0xb282('0x6d')][_0xb282('0x49')];_0x115dcf+=0x1){socket['emit'](_0xb282('0x77'),{'UserId':Number(_0x3e2abb[_0xb282('0x44')][_0xb282('0x6d')][_0x115dcf]),'WhatsappAccountId':Number(_0x3e2abb[_0xb282('0x56')]['id'])});}}else{socket[_0xb282('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e2abb['query'][_0xb282('0x6d')]),'WhatsappAccountId':Number(_0x3e2abb[_0xb282('0x56')]['id'])});}});}})[_0xb282('0x22')](respondWithStatusCode(_0x5d4e6a,null))[_0xb282('0x2c')](handleError(_0x5d4e6a,null));};exports[_0xb282('0x78')]=function(_0x3ad1ba,_0x139c9b,_0x8e4f6){var _0x33776c={};var _0x1b3d73={};var _0x759d66;var _0x4fc472;return db['WhatsappAccount'][_0xb282('0x66')]({'where':{'id':_0x3ad1ba[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x139c9b,null))[_0xb282('0x22')](function(_0x1fead1){if(_0x1fead1){_0x759d66=_0x1fead1;_0x1b3d73[_0xb282('0x43')]=_[_0xb282('0x45')](db[_0xb282('0x79')][_0xb282('0x3f')]);_0x1b3d73['query']=_[_0xb282('0x45')](_0x3ad1ba[_0xb282('0x44')]);_0x1b3d73[_0xb282('0x46')]=_['intersection'](_0x1b3d73[_0xb282('0x43')],_0x1b3d73[_0xb282('0x44')]);_0x33776c['attributes']=_['intersection'](_0x1b3d73[_0xb282('0x43')],qs['fields'](_0x3ad1ba[_0xb282('0x44')][_0xb282('0x58')]));_0x33776c[_0xb282('0x48')]=_0x33776c[_0xb282('0x48')][_0xb282('0x49')]?_0x33776c[_0xb282('0x48')]:_0x1b3d73['model'];_0x33776c[_0xb282('0x69')]=qs[_0xb282('0x6a')](_0x3ad1ba[_0xb282('0x44')][_0xb282('0x6a')]);_0x33776c[_0xb282('0x4b')]=qs[_0xb282('0x46')](_[_0xb282('0x4c')](_0x3ad1ba['query'],_0x1b3d73[_0xb282('0x46')]));if(_0x3ad1ba[_0xb282('0x44')][_0xb282('0x6b')]){_0x33776c[_0xb282('0x4b')]=_['merge'](_0x33776c[_0xb282('0x4b')],{'$or':_[_0xb282('0x3e')](_0x33776c[_0xb282('0x48')],function(_0x5b7294){var _0x1d4f0e={};_0x1d4f0e[_0x5b7294]={'$like':'%'+_0x3ad1ba[_0xb282('0x44')][_0xb282('0x6b')]+'%'};return _0x1d4f0e;})});}_0x33776c=_[_0xb282('0x4d')]({},_0x33776c,_0x3ad1ba[_0xb282('0x4f')]);return _0x759d66[_0xb282('0x78')](_0x33776c);}})[_0xb282('0x22')](function(_0x1dfa79){if(_0x1dfa79){_0x4fc472=_0x1dfa79['length'];if(!_0x3ad1ba['query'][_0xb282('0x67')](_0xb282('0x68'))){_0x33776c[_0xb282('0x4a')]=qs[_0xb282('0x4a')](_0x3ad1ba[_0xb282('0x44')][_0xb282('0x4a')]);_0x33776c['offset']=qs[_0xb282('0x31')](_0x3ad1ba[_0xb282('0x44')][_0xb282('0x31')]);}return _0x759d66[_0xb282('0x78')](_0x33776c);}})[_0xb282('0x22')](function(_0x44481a){if(_0x44481a){return _0x44481a?{'count':_0x4fc472,'rows':_0x44481a}:null;}})[_0xb282('0x22')](respondWithResult(_0x139c9b,null))[_0xb282('0x2c')](handleError(_0x139c9b,null));};exports[_0xb282('0x7a')]=function(_0x291f41,_0x120cb4,_0x4dfffc){return db['WhatsappAccount']['findOne']({'where':{'id':_0x291f41[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x120cb4,null))[_0xb282('0x22')](function(_0x3f452c){if(_0x3f452c){return db[_0xb282('0x7b')][_0xb282('0x7c')](function(_0x427155){return db[_0xb282('0x7d')][_0xb282('0x38')]({'where':{'WhatsappAccountId':_0x291f41[_0xb282('0x56')]['id']},'transaction':_0x427155})['then'](function(_0x2d3227){var _0x4765ec=_[_0xb282('0x3e')](_0x291f41['body'],function(_0x206cd7){_0x206cd7[_0xb282('0x64')]=_0x291f41[_0xb282('0x56')]['id'];return _0x206cd7;});return db[_0xb282('0x7d')][_0xb282('0x7e')](_0x4765ec,{'transaction':_0x427155});});})[_0xb282('0x22')](function(){return db[_0xb282('0x7d')][_0xb282('0x7f')]({'where':{'WhatsappAccountId':_0x291f41[_0xb282('0x56')]['id']},'order':_0xb282('0x80')});});}})['then'](respondWithResult(_0x120cb4,null))['catch'](handleError(_0x120cb4,null));};exports['getApplications']=function(_0x30759b,_0x38b0c0,_0x4b484f){var _0x517327={};var _0x5edd2b={};var _0x30ea9e;var _0x4d9068;return db[_0xb282('0x50')][_0xb282('0x66')]({'where':{'id':_0x30759b[_0xb282('0x56')]['id']}})[_0xb282('0x22')](handleEntityNotFound(_0x38b0c0,null))[_0xb282('0x22')](function(_0xa645c3){if(_0xa645c3){_0x30ea9e=_0xa645c3;_0x5edd2b[_0xb282('0x43')]=_[_0xb282('0x45')](db[_0xb282('0x7d')][_0xb282('0x3f')]);_0x5edd2b[_0xb282('0x44')]=_[_0xb282('0x45')](_0x30759b[_0xb282('0x44')]);_0x5edd2b[_0xb282('0x46')]=_['intersection'](_0x5edd2b[_0xb282('0x43')],_0x5edd2b['query']);_0x517327[_0xb282('0x48')]=_[_0xb282('0x47')](_0x5edd2b[_0xb282('0x43')],qs[_0xb282('0x58')](_0x30759b[_0xb282('0x44')]['fields']));_0x517327['attributes']=_0x517327[_0xb282('0x48')][_0xb282('0x49')]?_0x517327[_0xb282('0x48')]:_0x5edd2b[_0xb282('0x43')];_0x517327[_0xb282('0x69')]=qs[_0xb282('0x6a')](_0x30759b['query'][_0xb282('0x6a')]);_0x517327[_0xb282('0x4b')]=qs[_0xb282('0x46')](_[_0xb282('0x4c')](_0x30759b[_0xb282('0x44')],_0x5edd2b['filters']));if(_0x30759b[_0xb282('0x44')][_0xb282('0x6b')]){_0x517327['where']=_[_0xb282('0x4d')](_0x517327[_0xb282('0x4b')],{'$or':_[_0xb282('0x3e')](_0x517327[_0xb282('0x48')],function(_0x4ca252){var _0x133cf8={};_0x133cf8[_0x4ca252]={'$like':'%'+_0x30759b[_0xb282('0x44')]['filter']+'%'};return _0x133cf8;})});}_0x517327=_[_0xb282('0x4d')]({},_0x517327,_0x30759b['options']);return _0x30ea9e['getApplications'](_0x517327);}})[_0xb282('0x22')](function(_0x2a33a2){if(_0x2a33a2){_0x4d9068=_0x2a33a2['length'];if(!_0x30759b[_0xb282('0x44')]['hasOwnProperty'](_0xb282('0x68'))){_0x517327['limit']=qs[_0xb282('0x4a')](_0x30759b[_0xb282('0x44')][_0xb282('0x4a')]);_0x517327[_0xb282('0x31')]=qs[_0xb282('0x31')](_0x30759b[_0xb282('0x44')][_0xb282('0x31')]);}return _0x30ea9e[_0xb282('0x81')](_0x517327);}})[_0xb282('0x22')](function(_0x32bdf8){if(_0x32bdf8){return _0x32bdf8?{'count':_0x4d9068,'rows':_0x32bdf8}:null;}})[_0xb282('0x22')](respondWithResult(_0x38b0c0,null))[_0xb282('0x2c')](handleError(_0x38b0c0,null));};exports[_0xb282('0x82')]=function(_0x291de2,_0x2d4008,_0x20ab84){var _0x344f8d={'channel':'whatsapp'};var _0x13624e=[];var _0x452ca6=[];var _0x266687={};return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x291de2[_0xb282('0x56')]['id']},'include':[{'model':db[_0xb282('0x7d')],'as':_0xb282('0x83')}]})[_0xb282('0x22')](handleEntityNotFound(_0x2d4008,null))[_0xb282('0x22')](function(_0x897d86){_0x344f8d[_0xb282('0x84')]=_0x897d86;_0x344f8d['applications']=_[_0xb282('0x85')](_0x897d86[_0xb282('0x83')],[_0xb282('0x80')],[_0xb282('0x86')]);if(_0x344f8d[_0xb282('0x84')]['Applications']){delete _0x344f8d[_0xb282('0x84')][_0xb282('0x83')];}return db[_0xb282('0x87')]['describe']();})[_0xb282('0x22')](function(_0x3bc7b0){if(!_0x3bc7b0){throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))](_0xb282('0x88'));}_0x13624e=_[_0xb282('0x89')](_[_0xb282('0x45')](_0x3bc7b0),[_0xb282('0x8a'),_0xb282('0x8b')]);_0x452ca6=_[_0xb282('0x89')](_[_0xb282('0x45')](_0x3bc7b0),['createdAt',_0xb282('0x8b'),_0xb282('0x8c'),_0xb282('0x8d')]);_0x344f8d['body']={'mapKey':'mobile'};if(_0x344f8d[_0xb282('0x84')][_0xb282('0x41')]&&_0x344f8d[_0xb282('0x84')]['type']===_0xb282('0x8e')){_0x344f8d['body'][_0xb282('0x8f')]=_0x291de2[_0xb282('0x5b')][_0xb282('0x90')][_0xb282('0x91')](_0xb282('0x92'),'');_0x344f8d[_0xb282('0x5b')][_0xb282('0x5b')]=_0x291de2[_0xb282('0x5b')][_0xb282('0x93')];_0x344f8d[_0xb282('0x5b')][_0xb282('0x94')]=_0x291de2[_0xb282('0x5b')][_0xb282('0x95')];}if(_0x344f8d[_0xb282('0x5b')]['id']){delete _0x344f8d[_0xb282('0x5b')]['id'];}if(_[_0xb282('0x96')](_0x344f8d['body']['from'])){throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))](_0xb282('0x97'));}if(_['isNil'](_0x344f8d[_0xb282('0x5b')][_0xb282('0x5b')])||_0x344f8d['body'][_0xb282('0x5b')]===''){throw new db['Sequelize'][(_0xb282('0x20'))](_0xb282('0x98'));}if(_['isNil'](_0x344f8d['body'][_0xb282('0x99')])){throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))](_0xb282('0x9a')+_0x452ca6);}if(!_['includes'](_0x452ca6,_0x344f8d[_0xb282('0x5b')][_0xb282('0x99')])){throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x452ca6);}_0x266687[_0x344f8d[_0xb282('0x5b')][_0xb282('0x99')]]=_0x344f8d[_0xb282('0x5b')][_0xb282('0x8f')];return db[_0xb282('0x9b')][_0xb282('0x59')]({'where':{'id':_0x344f8d[_0xb282('0x84')]['ListId']},'include':[{'model':db[_0xb282('0x87')],'as':_0xb282('0x9c'),'where':_0x266687,'limit':0x1,'order':[[_0xb282('0x8b'),_0xb282('0x9d')]]}]});})[_0xb282('0x22')](handleEntityNotFound(_0x2d4008,null))[_0xb282('0x22')](function(_0x14b1c1){if(_0x14b1c1){_0x344f8d[_0xb282('0x9e')]=_[_0xb282('0x9f')](_0x14b1c1,[_0xb282('0x9c')]);if(_0x14b1c1[_0xb282('0x9c')]['length']){return _0x14b1c1[_0xb282('0x9c')][0x0];}var _0x5c44d7=_[_0xb282('0x17')](_0x344f8d[_0xb282('0x5b')],{'firstName':_0x344f8d[_0xb282('0x5b')]['from'],'ListId':_0x14b1c1['id']});_0x5c44d7[_0x344f8d['body'][_0xb282('0x99')]]=_0x344f8d['body']['from'];return db['CmContact'][_0xb282('0x5a')](_0x5c44d7,{'fields':_0x13624e,'raw':!![]});}})[_0xb282('0x22')](handleEntityNotFound(_0x2d4008,null))[_0xb282('0x22')](function(_0x2348e9){if(_0x2348e9){_0x344f8d[_0xb282('0xa0')]=_0x2348e9;var _0x50dd28={'ContactId':_0x2348e9['id'],'phone':_0x344f8d[_0xb282('0x5b')][_0xb282('0x8f')],'WhatsappAccountId':_0x291de2[_0xb282('0x56')]['id']};var _0x716324={'ContactId':_0x2348e9['id'],'WhatsappAccountId':_0x291de2[_0xb282('0x56')]['id'],'closed':![]};return db[_0xb282('0xa1')][_0xb282('0x59')]({'where':_0x716324})['then'](function(_0x24cd1f){if(_0x24cd1f){return[_0x24cd1f,![]];}return db[_0xb282('0xa1')][_0xb282('0x5a')](_0x50dd28)[_0xb282('0x22')](function(_0x1264d9){return[_0x1264d9,!![]];});});}})[_0xb282('0xa2')](function(_0x3d15ed,_0x46d53f){_0x344f8d[_0xb282('0xa3')]=_0x3d15ed[_0xb282('0x5d')]({'plain':!![]});_0x344f8d['interaction'][_0xb282('0xa4')]=![];if(_0x46d53f){if(_0x344f8d[_0xb282('0x84')]['autoclose']){_0x344f8d[_0xb282('0xa5')]['push']({'id':0x0,'priority':_0x344f8d['applications'][_0xb282('0x49')]+0x1,'app':_0xb282('0xa6'),'appdata':'unmanaged','interval':_0xb282('0xa7')});}_0x344f8d[_0xb282('0xa3')]['created']=!![];}return db[_0xb282('0xa8')][_0xb282('0x5a')]({'phone':_0x344f8d['body'][_0xb282('0x8f')],'messageId':_0x344f8d[_0xb282('0x5b')][_0xb282('0x94')],'body':_0x344f8d[_0xb282('0x5b')][_0xb282('0x5b')],'WhatsappAccountId':_0x291de2[_0xb282('0x56')]['id'],'WhatsappInteractionId':_0x3d15ed['id'],'direction':'in','ContactId':_0x3d15ed[_0xb282('0xa9')],'AttachmentId':_0x344f8d['body'][_0xb282('0xaa')]});})[_0xb282('0x22')](function(_0x44723d){_0x344f8d[_0xb282('0x29')]=_0x44723d;if(_0x344f8d['interaction'][_0xb282('0xab')]){return db[_0xb282('0x79')][_0xb282('0x59')]({'attributes':['id',_0xb282('0x3c')],'where':{'id':_0x344f8d[_0xb282('0xa3')][_0xb282('0xab')]}})[_0xb282('0x22')](function(_0x22dad8){if(_0x22dad8){_0x344f8d[_0xb282('0xa5')][_0xb282('0xac')]({'id':0x0,'priority':0x0,'app':_0xb282('0xad'),'appdata':_0x22dad8[_0xb282('0x3c')]+','+(_0x344f8d['account'][_0xb282('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb282('0xaf'),_0xb282('0xb0'),_0x344f8d);});}return respondWithRpcPromise(_0xb282('0xaf'),_0xb282('0xb0'),_0x344f8d);})[_0xb282('0x22')](function(_0x5d4130){if(_0x5d4130){var _0x6c7bf7=0xc8;var _0x27c060=_0xb282('0xb1');logger[_0xb282('0x2a')](_0xb282('0x26'),_0x27c060,_0x6c7bf7,_0xb282('0xb2'));logger[_0xb282('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x27c060,_0x6c7bf7,_0xb282('0xb2'),JSON[_0xb282('0xb3')](_0x5d4130));if(_0x344f8d[_0xb282('0x84')][_0xb282('0x41')]===_0xb282('0x8e')){return _0x2d4008[_0xb282('0x2e')](_0x6c7bf7)[_0xb282('0x32')](_0xb282('0xb4'),_0xb282('0xb5'))['send']('\x0a');}else{return _0x2d4008[_0xb282('0x2e')](_0x6c7bf7)[_0xb282('0x2f')](_0x5d4130);}}})[_0xb282('0x2c')](handleError(_0x2d4008,null));};exports[_0xb282('0xb6')]=function(_0x5aa594,_0x1e6c1a,_0x247958){var _0x49e30b,_0x4a8e4b,_0x32cc4e;if(_[_0xb282('0x96')](_0x5aa594[_0xb282('0x5b')][_0xb282('0x5b')])||_0x5aa594[_0xb282('0x5b')]['body']===''){throw new db[(_0xb282('0x1f'))][(_0xb282('0x20'))](_0xb282('0x98'));}if(_[_0xb282('0x96')](_0x5aa594[_0xb282('0x5b')]['to'])){throw new db['Sequelize']['ValidationError'](_0xb282('0xb7'));}_0x49e30b=_0x5aa594['body']['to'];return db[_0xb282('0x50')][_0xb282('0x59')]({'where':{'id':_0x5aa594[_0xb282('0x56')]['id']},'include':[{'model':db[_0xb282('0x9b')],'as':_0xb282('0xb8'),'include':[{'model':db[_0xb282('0x87')],'as':_0xb282('0x9c'),'where':{'mobile':_0x49e30b},'limit':0x1,'order':[[_0xb282('0x8b'),_0xb282('0x9d')]]}]}]})[_0xb282('0x22')](handleEntityNotFound(_0x1e6c1a,null))[_0xb282('0x22')](function(_0x1973dd){if(_0x1973dd&&_0x1973dd[_0xb282('0xb8')]){_0x4a8e4b=_0x1973dd[_0xb282('0x5d')]({'plain':!![]});if(_0x4a8e4b[_0xb282('0xb8')]&&_0x4a8e4b[_0xb282('0xb8')][_0xb282('0x9c')][_0xb282('0x49')]){return _0x4a8e4b[_0xb282('0xb8')]['Contacts'][0x0];}return db['CmContact'][_0xb282('0x5a')](_[_0xb282('0x17')](_0x5aa594[_0xb282('0x5b')],{'firstName':_0x49e30b,'mobile':_0x49e30b,'phone':_0x49e30b,'ListId':_0x4a8e4b[_0xb282('0x8d')]}));}})['then'](handleEntityNotFound(_0x1e6c1a,null))[_0xb282('0x22')](function(_0x5a40c8){if(_0x5a40c8){_0x32cc4e=_0x5a40c8;return db[_0xb282('0xa1')][_0xb282('0x59')]({'where':{'ContactId':_0x32cc4e['id'],'closed':![],'WhatsappAccountId':_0x4a8e4b['id']}})[_0xb282('0x22')](function(_0x42c199){if(_0x42c199){return[_0x42c199,![]];}return db[_0xb282('0xa1')]['create']({'UserId':_0x5aa594[_0xb282('0x5c')]['id'],'ContactId':_0x32cc4e['id'],'WhatsappAccountId':_0x4a8e4b['id'],'phone':_0x49e30b,'firstMsgDirection':_0xb282('0xb9'),'Messages':[_[_0xb282('0x4d')](_0x5aa594['body'],{'read':![],'body':_0x5aa594[_0xb282('0x5b')][_0xb282('0x5b')],'phone':_0x49e30b,'WhatsappAccountId':_0x4a8e4b['id'],'UserId':_0x5aa594[_0xb282('0x5c')]['id'],'ContactId':_0x32cc4e['id']})]},{'include':[{'model':db[_0xb282('0xa8')],'as':_0xb282('0xba')}]})[_0xb282('0x22')](function(_0x5d5c0e){return[_0x5d5c0e,!![]];});});}})[_0xb282('0xa2')](function(_0x56ebbd,_0x1be729){if(_0x1be729){return _0x56ebbd;}return db[_0xb282('0xa8')][_0xb282('0x5a')](_[_0xb282('0x4d')](_0x5aa594[_0xb282('0x5b')],{'read':![],'body':_0x5aa594[_0xb282('0x5b')]['body'],'phone':_0x49e30b,'WhatsappAccountId':_0x4a8e4b['id'],'WhatsappInteractionId':_0x56ebbd['id'],'UserId':_0x5aa594[_0xb282('0x5c')]['id'],'ContactId':_0x32cc4e['id']}))[_0xb282('0x22')](function(_0x2d8d36){_0x56ebbd[_0xb282('0xbb')][_0xb282('0xba')]=[];_0x56ebbd['dataValues'][_0xb282('0xba')][_0xb282('0xbc')](_0x2d8d36[_0xb282('0xbb')]);return _0x56ebbd;});})[_0xb282('0x22')](respondWithResult(_0x1e6c1a,null))[_0xb282('0x2c')](handleError(_0x1e6c1a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a76a9c6..31d2d92 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 _0x11e5=['emit','hasOwnProperty','hook','events','WhatsappAccount','setMaxListeners','update','remove'];(function(_0x4e455d,_0x5262b0){var _0x23725c=function(_0x117b0c){while(--_0x117b0c){_0x4e455d['push'](_0x4e455d['shift']());}};_0x23725c(++_0x5262b0);}(_0x11e5,0x8b));var _0x511e=function(_0x3222ad,_0x2df6b3){_0x3222ad=_0x3222ad-0x0;var _0x69314b=_0x11e5[_0x3222ad];return _0x69314b;};'use strict';var EventEmitter=require(_0x511e('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x511e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x511e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x511e('0x3'),'afterDestroy':_0x511e('0x4')};function emitEvent(_0x101e06){return function(_0x5cab33,_0x249e4d,_0x4fbd4f){WhatsappAccountEvents['emit'](_0x101e06+':'+_0x5cab33['id'],_0x5cab33);WhatsappAccountEvents[_0x511e('0x5')](_0x101e06,_0x5cab33);_0x4fbd4f(null);};}for(var e in events){if(events[_0x511e('0x6')](e)){var event=events[e];WhatsappAccount[_0x511e('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x1623=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x1623,0xab));var _0x3162=function(_0x5db062,_0x261a0e){_0x5db062=_0x5db062-0x0;var _0xe9783f=_0x1623[_0x5db062];return _0xe9783f;};'use strict';var EventEmitter=require(_0x3162('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3162('0x1')](0x0);var events={'afterCreate':_0x3162('0x2'),'afterUpdate':_0x3162('0x3'),'afterDestroy':_0x3162('0x4')};function emitEvent(_0x428dd7){return function(_0x4ce2bd,_0x5d49d0,_0x7a4559){WhatsappAccountEvents['emit'](_0x428dd7+':'+_0x4ce2bd['id'],_0x4ce2bd);WhatsappAccountEvents[_0x3162('0x5')](_0x428dd7,_0x4ce2bd);_0x7a4559(null);};}for(var e in events){if(events[_0x3162('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x3162('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e663785..23a5d2e 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 _0xf3e0=['rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','api','bluebird','request-promise'];(function(_0x3e1283,_0x40ae7b){var _0x1ca86f=function(_0x192950){while(--_0x192950){_0x3e1283['push'](_0x3e1283['shift']());}};_0x1ca86f(++_0x40ae7b);}(_0xf3e0,0x1f0));var _0x0f3e=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf3e0[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x0f3e('0x0'));var logger=require('../../config/logger')(_0x0f3e('0x1'));var moment=require('moment');var BPromise=require(_0x0f3e('0x2'));var rp=require(_0x0f3e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f3e('0x4'));var config=require('../../config/environment');var attributes=require(_0x0f3e('0x5'));module[_0x0f3e('0x6')]=function(_0x405c94,_0x50b392){return _0x405c94[_0x0f3e('0x7')](_0x0f3e('0x8'),attributes,{'tableName':_0x0f3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0813=['path','rimraf','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x5c16e1,_0x12ea72){var _0x4f59d0=function(_0x48ed32){while(--_0x48ed32){_0x5c16e1['push'](_0x5c16e1['shift']());}};_0x4f59d0(++_0x12ea72);}(_0x0813,0x164));var _0x3081=function(_0x105aa9,_0x704c9a){_0x105aa9=_0x105aa9-0x0;var _0x5984e9=_0x0813[_0x105aa9];return _0x5984e9;};'use strict';var _=require(_0x3081('0x0'));var util=require('util');var logger=require(_0x3081('0x1'))(_0x3081('0x2'));var moment=require('moment');var BPromise=require(_0x3081('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3081('0x4'));var rimraf=require(_0x3081('0x5'));var config=require(_0x3081('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x3081('0x7')]=function(_0x3b719f,_0x1d7ba9){return _0x3b719f['define'](_0x3081('0x8'),attributes,{'tableName':_0x3081('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2e22372..cb6cafb 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 _0x5228=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39271e,_0x3006f6){var _0x336183=function(_0x2d7d89){while(--_0x2d7d89){_0x39271e['push'](_0x39271e['shift']());}};_0x336183(++_0x3006f6);}(_0x5228,0xcc));var _0x8522=function(_0x45678c,_0xf7ba35){_0x45678c=_0x45678c-0x0;var _0x271704=_0x5228[_0x45678c];return _0x271704;};'use strict';var _=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var moment=require(_0x8522('0x2'));var BPromise=require(_0x8522('0x3'));var rs=require(_0x8522('0x4'));var fs=require('fs');var Redis=require(_0x8522('0x5'));var db=require(_0x8522('0x6'))['db'];var utils=require(_0x8522('0x7'));var logger=require('../../config/logger')(_0x8522('0x8'));var config=require(_0x8522('0x9'));var jayson=require(_0x8522('0xa'));var client=jayson[_0x8522('0xb')]['http']({'port':0x232a});config[_0x8522('0xc')]=_[_0x8522('0xd')](config[_0x8522('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8522('0xe'))(new Redis(config[_0x8522('0xc')]));require(_0x8522('0xf'))[_0x8522('0x10')](socket);function respondWithRpcPromise(_0x180a0d,_0xbe4680,_0x325840){return new BPromise(function(_0x36ddbb,_0x4510b1){return client['request'](_0x180a0d,_0x325840)[_0x8522('0x11')](function(_0x5edf4d){logger[_0x8522('0x12')](_0x8522('0x13'),_0xbe4680,_0x8522('0x14'));logger['debug'](_0x8522('0x15'),_0xbe4680,'request\x20sent',JSON[_0x8522('0x16')](_0x5edf4d));if(_0x5edf4d['error']){if(_0x5edf4d['error']['code']===0x1f4){logger[_0x8522('0x17')](_0x8522('0x13'),_0xbe4680,_0x5edf4d[_0x8522('0x17')][_0x8522('0x18')]);return _0x4510b1(_0x5edf4d[_0x8522('0x17')]['message']);}logger['error'](_0x8522('0x13'),_0xbe4680,_0x5edf4d['error'][_0x8522('0x18')]);return _0x36ddbb(_0x5edf4d[_0x8522('0x17')]['message']);}else{logger[_0x8522('0x12')](_0x8522('0x13'),_0xbe4680,_0x8522('0x14'));_0x36ddbb(_0x5edf4d['result'][_0x8522('0x18')]);}})['catch'](function(_0x4ec05b){logger[_0x8522('0x17')](_0x8522('0x13'),_0xbe4680,_0x4ec05b);_0x4510b1(_0x4ec05b);});});}exports[_0x8522('0x19')]=function(_0x1ff8e2){var _0x44083e=this;return new Promise(function(_0x3248b1,_0x52244c){return db['WhatsappAccount'][_0x8522('0x1a')]({'raw':_0x1ff8e2['options']?_0x1ff8e2[_0x8522('0x1b')][_0x8522('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ff8e2[_0x8522('0x1b')]?_0x1ff8e2['options'][_0x8522('0x1d')]||null:null,'attributes':_0x1ff8e2[_0x8522('0x1b')]?_0x1ff8e2[_0x8522('0x1b')][_0x8522('0x1e')]||null:null,'include':_0x1ff8e2[_0x8522('0x1b')]?_0x1ff8e2[_0x8522('0x1b')][_0x8522('0x1f')]?_[_0x8522('0x20')](_0x1ff8e2[_0x8522('0x1b')][_0x8522('0x1f')],function(_0xaff67d){return{'model':db[_0xaff67d[_0x8522('0x21')]],'as':_0xaff67d['as'],'attributes':_0xaff67d[_0x8522('0x1e')],'include':_0xaff67d['include']?_[_0x8522('0x20')](_0xaff67d[_0x8522('0x1f')],function(_0x294827){return{'model':db[_0x294827['model']],'as':_0x294827['as'],'attributes':_0x294827[_0x8522('0x1e')],'include':_0x294827[_0x8522('0x1f')]?_['map'](_0x294827[_0x8522('0x1f')],function(_0xe45d3b){return{'model':db[_0xe45d3b['model']],'as':_0xe45d3b['as'],'attributes':_0xe45d3b[_0x8522('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8522('0x11')](function(_0x17ceeb){logger[_0x8522('0x12')](_0x8522('0x19'),_0x1ff8e2);logger['debug'](_0x8522('0x19'),_0x1ff8e2,JSON[_0x8522('0x16')](_0x17ceeb));_0x3248b1(_0x17ceeb);})[_0x8522('0x22')](function(_0x27bbb3){logger[_0x8522('0x17')](_0x8522('0x19'),_0x27bbb3[_0x8522('0x18')],_0x1ff8e2);_0x52244c(_0x44083e[_0x8522('0x17')](0x1f4,_0x27bbb3[_0x8522('0x18')]));});});}; \ No newline at end of file +var _0x793a=['request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','model','include','debug','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappAccount.socket','register'];(function(_0x185caa,_0x3d6882){var _0x59649a=function(_0xc40a2a){while(--_0xc40a2a){_0x185caa['push'](_0x185caa['shift']());}};_0x59649a(++_0x3d6882);}(_0x793a,0x86));var _0xa793=function(_0x2dd8f0,_0x52b42f){_0x2dd8f0=_0x2dd8f0-0x0;var _0x14cd98=_0x793a[_0x2dd8f0];return _0x14cd98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa793('0x0'));var fs=require('fs');var Redis=require(_0xa793('0x1'));var db=require(_0xa793('0x2'))['db'];var utils=require(_0xa793('0x3'));var logger=require(_0xa793('0x4'))(_0xa793('0x5'));var config=require('../../config/environment');var jayson=require(_0xa793('0x6'));var client=jayson[_0xa793('0x7')][_0xa793('0x8')]({'port':0x232a});config['redis']=_[_0xa793('0x9')](config[_0xa793('0xa')],{'host':_0xa793('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa793('0xa')]));require(_0xa793('0xc'))[_0xa793('0xd')](socket);function respondWithRpcPromise(_0x17cf9b,_0x4fa232,_0x72e1e7){return new BPromise(function(_0x4e48e9,_0xf98e6){return client[_0xa793('0xe')](_0x17cf9b,_0x72e1e7)[_0xa793('0xf')](function(_0x579c21){logger[_0xa793('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x4fa232,'request\x20sent');logger['debug'](_0xa793('0x11'),_0x4fa232,_0xa793('0x12'),JSON[_0xa793('0x13')](_0x579c21));if(_0x579c21[_0xa793('0x14')]){if(_0x579c21['error'][_0xa793('0x15')]===0x1f4){logger[_0xa793('0x14')](_0xa793('0x16'),_0x4fa232,_0x579c21[_0xa793('0x14')][_0xa793('0x17')]);return _0xf98e6(_0x579c21[_0xa793('0x14')]['message']);}logger[_0xa793('0x14')](_0xa793('0x16'),_0x4fa232,_0x579c21[_0xa793('0x14')][_0xa793('0x17')]);return _0x4e48e9(_0x579c21[_0xa793('0x14')][_0xa793('0x17')]);}else{logger[_0xa793('0x10')](_0xa793('0x16'),_0x4fa232,'request\x20sent');_0x4e48e9(_0x579c21[_0xa793('0x18')][_0xa793('0x17')]);}})['catch'](function(_0x4417d6){logger[_0xa793('0x14')](_0xa793('0x16'),_0x4fa232,_0x4417d6);_0xf98e6(_0x4417d6);});});}exports[_0xa793('0x19')]=function(_0x3ad353){var _0x1a614a=this;return new Promise(function(_0x499c9c,_0x3e9781){return db[_0xa793('0x1a')][_0xa793('0x1b')]({'raw':_0x3ad353[_0xa793('0x1c')]?_0x3ad353[_0xa793('0x1c')][_0xa793('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ad353['options']?_0x3ad353[_0xa793('0x1c')][_0xa793('0x1e')]||null:null,'attributes':_0x3ad353[_0xa793('0x1c')]?_0x3ad353[_0xa793('0x1c')][_0xa793('0x1f')]||null:null,'include':_0x3ad353[_0xa793('0x1c')]?_0x3ad353[_0xa793('0x1c')]['include']?_[_0xa793('0x20')](_0x3ad353[_0xa793('0x1c')]['include'],function(_0xa61de){return{'model':db[_0xa61de[_0xa793('0x21')]],'as':_0xa61de['as'],'attributes':_0xa61de[_0xa793('0x1f')],'include':_0xa61de[_0xa793('0x22')]?_[_0xa793('0x20')](_0xa61de[_0xa793('0x22')],function(_0x43227b){return{'model':db[_0x43227b['model']],'as':_0x43227b['as'],'attributes':_0x43227b[_0xa793('0x1f')],'include':_0x43227b[_0xa793('0x22')]?_[_0xa793('0x20')](_0x43227b['include'],function(_0x51cf33){return{'model':db[_0x51cf33[_0xa793('0x21')]],'as':_0x51cf33['as'],'attributes':_0x51cf33[_0xa793('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa793('0xf')](function(_0xe39734){logger[_0xa793('0x10')](_0xa793('0x19'),_0x3ad353);logger[_0xa793('0x23')](_0xa793('0x19'),_0x3ad353,JSON[_0xa793('0x13')](_0xe39734));_0x499c9c(_0xe39734);})[_0xa793('0x24')](function(_0x1e0be9){logger[_0xa793('0x14')](_0xa793('0x19'),_0x1e0be9[_0xa793('0x17')],_0x3ad353);_0x3e9781(_0x1a614a[_0xa793('0x14')](0x1f4,_0x1e0be9[_0xa793('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 78515a1..2e78867 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 _0x9053=['length','whatsappAccount:','./whatsappAccount.events','emit','register'];(function(_0x437b37,_0x272812){var _0x2b5dfd=function(_0x489ca9){while(--_0x489ca9){_0x437b37['push'](_0x437b37['shift']());}};_0x2b5dfd(++_0x272812);}(_0x9053,0x147));var _0x3905=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x9053[_0x2f1114];return _0x2fe856;};'use strict';var WhatsappAccountEvents=require(_0x3905('0x0'));var events=['save','remove','update'];function createListener(_0x233ada,_0x5a2568){return function(_0x32738b){_0x5a2568[_0x3905('0x1')](_0x233ada,_0x32738b);};}function removeListener(_0x691f4e,_0xda5f7){return function(){WhatsappAccountEvents['removeListener'](_0x691f4e,_0xda5f7);};}exports[_0x3905('0x2')]=function(_0x5cb5f1){for(var _0x2a5142=0x0,_0xb868e0=events[_0x3905('0x3')];_0x2a5142<_0xb868e0;_0x2a5142++){var _0x32d597=events[_0x2a5142];var _0x406317=createListener(_0x3905('0x4')+_0x32d597,_0x5cb5f1);WhatsappAccountEvents['on'](_0x32d597,_0x406317);}}; \ No newline at end of file +var _0x68d8=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove'];(function(_0x506326,_0x255110){var _0x522849=function(_0x3a2102){while(--_0x3a2102){_0x506326['push'](_0x506326['shift']());}};_0x522849(++_0x255110);}(_0x68d8,0xfe));var _0x868d=function(_0xd8e080,_0x24c5cf){_0xd8e080=_0xd8e080-0x0;var _0x3bba68=_0x68d8[_0xd8e080];return _0x3bba68;};'use strict';var WhatsappAccountEvents=require(_0x868d('0x0'));var events=['save',_0x868d('0x1'),_0x868d('0x2')];function createListener(_0x944e88,_0x5480e1){return function(_0x1421f2){_0x5480e1[_0x868d('0x3')](_0x944e88,_0x1421f2);};}function removeListener(_0x4c215e,_0xc86213){return function(){WhatsappAccountEvents[_0x868d('0x4')](_0x4c215e,_0xc86213);};}exports[_0x868d('0x5')]=function(_0x4b75d5){for(var _0x1a0895=0x0,_0x38429e=events[_0x868d('0x6')];_0x1a0895<_0x38429e;_0x1a0895++){var _0x18f1c0=events[_0x1a0895];var _0x20ccff=createListener(_0x868d('0x7')+_0x18f1c0,_0x4b75d5);WhatsappAccountEvents['on'](_0x18f1c0,_0x20ccff);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9413eb4..1682948 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 _0x000e=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','/:id','create','put','update'];(function(_0x5c6b51,_0x4e9a8f){var _0x132ad7=function(_0x230462){while(--_0x230462){_0x5c6b51['push'](_0x5c6b51['shift']());}};_0x132ad7(++_0x4e9a8f);}(_0x000e,0x112));var _0xe000=function(_0x23487f,_0x3920e2){_0x23487f=_0x23487f-0x0;var _0x61cf22=_0x000e[_0x23487f];return _0x61cf22;};'use strict';var multer=require(_0xe000('0x0'));var util=require('util');var path=require(_0xe000('0x1'));var timeout=require(_0xe000('0x2'));var express=require(_0xe000('0x3'));var router=express[_0xe000('0x4')]();var auth=require(_0xe000('0x5'));var interaction=require(_0xe000('0x6'));var config=require('../../config/environment');var controller=require(_0xe000('0x7'));router[_0xe000('0x8')]('/',auth[_0xe000('0x9')](),controller['index']);router[_0xe000('0x8')](_0xe000('0xa'),auth[_0xe000('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe000('0xb')]);router[_0xe000('0xc')](_0xe000('0xa'),auth[_0xe000('0x9')](),controller[_0xe000('0xd')]);router[_0xe000('0xe')](_0xe000('0xa'),auth['isAuthenticated'](),controller[_0xe000('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5d17=['delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x7c220b,_0x28c84d){var _0x3b5f7e=function(_0x5af67e){while(--_0x5af67e){_0x7c220b['push'](_0x7c220b['shift']());}};_0x3b5f7e(++_0x28c84d);}(_0x5d17,0x1bc));var _0x75d1=function(_0x3644b9,_0x5cd3a6){_0x3644b9=_0x3644b9-0x0;var _0x4d196d=_0x5d17[_0x3644b9];return _0x4d196d;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require(_0x75d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x75d1('0x3'));var router=express[_0x75d1('0x4')]();var auth=require(_0x75d1('0x5'));var interaction=require(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var controller=require(_0x75d1('0x8'));router[_0x75d1('0x9')]('/',auth[_0x75d1('0xa')](),controller[_0x75d1('0xb')]);router[_0x75d1('0x9')](_0x75d1('0xc'),auth[_0x75d1('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x75d1('0xd')]);router[_0x75d1('0xe')](_0x75d1('0xc'),auth[_0x75d1('0xa')](),controller['update']);router[_0x75d1('0xf')](_0x75d1('0xc'),auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ecd2265..0c6d41c 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 _0x4fd0=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x217523,_0x5d793a){var _0x43e3e1=function(_0x477f77){while(--_0x477f77){_0x217523['push'](_0x217523['shift']());}};_0x43e3e1(++_0x5d793a);}(_0x4fd0,0x81));var _0x04fd=function(_0x28da10,_0x29470c){_0x28da10=_0x28da10-0x0;var _0x298372=_0x4fd0[_0x28da10];return _0x298372;};'use strict';var Sequelize=require(_0x04fd('0x0'));module[_0x04fd('0x1')]={'priority':{'type':Sequelize[_0x04fd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04fd('0x3')},'appdata':{'type':Sequelize[_0x04fd('0x4')]()},'description':{'type':Sequelize[_0x04fd('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x04fd('0x6')}}; \ No newline at end of file +var _0xe31b=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0xcf68f2,_0xc3ff7e){var _0x567417=function(_0x3dca2d){while(--_0x3dca2d){_0xcf68f2['push'](_0xcf68f2['shift']());}};_0x567417(++_0xc3ff7e);}(_0xe31b,0x160));var _0xbe31=function(_0x41f33c,_0xdba0f5){_0x41f33c=_0x41f33c-0x0;var _0x3e8ee3=_0xe31b[_0x41f33c];return _0x3e8ee3;};'use strict';var Sequelize=require('sequelize');module[_0xbe31('0x0')]={'priority':{'type':Sequelize[_0xbe31('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe31('0x2')],'allowNull':![],'defaultValue':_0xbe31('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbe31('0x2')]},'interval':{'type':Sequelize[_0xbe31('0x2')],'defaultValue':_0xbe31('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8d2b5a4..3659370 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 _0x9fb1=['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','reject','save','update','then','destroy','name','index','map','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','show','params','find','create','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x213dd7,_0x12f787){var _0xe558b8=function(_0x130648){while(--_0x130648){_0x213dd7['push'](_0x213dd7['shift']());}};_0xe558b8(++_0x12f787);}(_0x9fb1,0xc3));var _0x19fb=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9fb1[_0x16d10f];return _0x50c823;};'use strict';var pdf=require(_0x19fb('0x0'));var emlformat=require(_0x19fb('0x1'));var rimraf=require(_0x19fb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19fb('0x3'));var rp=require(_0x19fb('0x4'));var moment=require('moment');var BPromise=require(_0x19fb('0x5'));var Mustache=require('mustache');var util=require(_0x19fb('0x6'));var path=require('path');var sox=require(_0x19fb('0x7'));var csv=require(_0x19fb('0x8'));var ejs=require(_0x19fb('0x9'));var fs=require('fs');var _=require(_0x19fb('0xa'));var squel=require(_0x19fb('0xb'));var crypto=require(_0x19fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x19fb('0xd'));var toCsv=require(_0x19fb('0x8'));var querystring=require(_0x19fb('0xe'));var Papa=require(_0x19fb('0xf'));var Redis=require('ioredis');var authService=require(_0x19fb('0x10'));var qs=require(_0x19fb('0x11'));var as=require(_0x19fb('0x12'));var hardwareService=require(_0x19fb('0x13'));var logger=require(_0x19fb('0x14'))(_0x19fb('0x15'));var utils=require(_0x19fb('0x16'));var config=require('../../config/environment');var db=require(_0x19fb('0x17'))['db'];function respondWithStatusCode(_0xf83d5e,_0xd458c3){_0xd458c3=_0xd458c3||0xcc;return function(_0x2dc2ae){if(_0x2dc2ae){return _0xf83d5e[_0x19fb('0x18')](_0xd458c3);}return _0xf83d5e[_0x19fb('0x19')](_0xd458c3)[_0x19fb('0x1a')]();};}function respondWithResult(_0x218e68,_0x2a886a){_0x2a886a=_0x2a886a||0xc8;return function(_0x376419){if(_0x376419){return _0x218e68[_0x19fb('0x19')](_0x2a886a)[_0x19fb('0x1b')](_0x376419);}};}function respondWithFilteredResult(_0x45f047,_0x637ece){return function(_0x1bed92){if(_0x1bed92){var _0x3c22ff=_0x1bed92[_0x19fb('0x1c')],_0x3a033b=_0x637ece[_0x19fb('0x1d')],_0x4bd27d=_0x637ece[_0x19fb('0x1d')]+_0x637ece[_0x19fb('0x1e')],_0x31547f;if(_0x4bd27d>=_0x3c22ff){_0x4bd27d=_0x3c22ff;_0x31547f=0xc8;}else{_0x31547f=0xce;}_0x45f047[_0x19fb('0x19')](_0x31547f);return _0x45f047[_0x19fb('0x1f')]('Content-Range',_0x3a033b+'-'+_0x4bd27d+'/'+_0x3c22ff)['json'](_0x1bed92);}return null;};}function patchUpdates(_0x37be9e){return function(_0x4c8075){try{jsonpatch['apply'](_0x4c8075,_0x37be9e,!![]);}catch(_0x53eebd){return BPromise[_0x19fb('0x20')](_0x53eebd);}return _0x4c8075[_0x19fb('0x21')]();};}function saveUpdates(_0x401bff,_0x1e9c27){return function(_0x7ce14){if(_0x7ce14){return _0x7ce14[_0x19fb('0x22')](_0x401bff)[_0x19fb('0x23')](function(_0x34c1da){return _0x34c1da;});}return null;};}function removeEntity(_0x319e15,_0x5a8940){return function(_0x103141){if(_0x103141){return _0x103141[_0x19fb('0x24')]()[_0x19fb('0x23')](function(){_0x319e15['status'](0xcc)[_0x19fb('0x1a')]();});}};}function handleEntityNotFound(_0x20659f,_0x4a18e7){return function(_0x5399d3){if(!_0x5399d3){_0x20659f[_0x19fb('0x18')](0x194);}return _0x5399d3;};}function handleError(_0x485097,_0x40eebc){_0x40eebc=_0x40eebc||0x1f4;return function(_0x582686){logger['error'](_0x582686['stack']);if(_0x582686[_0x19fb('0x25')]){delete _0x582686[_0x19fb('0x25')];}_0x485097[_0x19fb('0x19')](_0x40eebc)['send'](_0x582686);};}exports[_0x19fb('0x26')]=function(_0x23cf32,_0x3b3a55){var _0x33fb80={},_0xbb519={},_0x205a94={'count':0x0,'rows':[]};var _0x228df4=_[_0x19fb('0x27')](db['WhatsappApplication'][_0x19fb('0x28')],function(_0x483db9){return{'name':_0x483db9['fieldName'],'type':_0x483db9[_0x19fb('0x29')]['key']};});_0xbb519['model']=_['map'](_0x228df4,_0x19fb('0x25'));_0xbb519[_0x19fb('0x2a')]=_[_0x19fb('0x2b')](_0x23cf32[_0x19fb('0x2a')]);_0xbb519[_0x19fb('0x2c')]=_[_0x19fb('0x2d')](_0xbb519[_0x19fb('0x2e')],_0xbb519[_0x19fb('0x2a')]);_0x33fb80['attributes']=_[_0x19fb('0x2d')](_0xbb519['model'],qs[_0x19fb('0x2f')](_0x23cf32[_0x19fb('0x2a')][_0x19fb('0x2f')]));_0x33fb80[_0x19fb('0x30')]=_0x33fb80[_0x19fb('0x30')][_0x19fb('0x31')]?_0x33fb80[_0x19fb('0x30')]:_0xbb519[_0x19fb('0x2e')];if(!_0x23cf32[_0x19fb('0x2a')][_0x19fb('0x32')](_0x19fb('0x33'))){_0x33fb80['limit']=qs['limit'](_0x23cf32['query']['limit']);_0x33fb80['offset']=qs[_0x19fb('0x1d')](_0x23cf32['query'][_0x19fb('0x1d')]);}_0x33fb80['order']=qs[_0x19fb('0x34')](_0x23cf32[_0x19fb('0x2a')][_0x19fb('0x34')]);_0x33fb80[_0x19fb('0x35')]=qs[_0x19fb('0x2c')](_[_0x19fb('0x36')](_0x23cf32[_0x19fb('0x2a')],_0xbb519['filters']),_0x228df4);if(_0x23cf32[_0x19fb('0x2a')][_0x19fb('0x37')]){_0x33fb80['where']=_[_0x19fb('0x38')](_0x33fb80[_0x19fb('0x35')],{'$or':_[_0x19fb('0x27')](_0x228df4,function(_0x7e6c7b){if(_0x7e6c7b[_0x19fb('0x29')]!==_0x19fb('0x39')){var _0x23f3a2={};_0x23f3a2[_0x7e6c7b[_0x19fb('0x25')]]={'$like':'%'+_0x23cf32['query'][_0x19fb('0x37')]+'%'};return _0x23f3a2;}})});}_0x33fb80=_[_0x19fb('0x38')]({},_0x33fb80,_0x23cf32[_0x19fb('0x3a')]);var _0x5ab3e2={'where':_0x33fb80[_0x19fb('0x35')]};return db[_0x19fb('0x3b')][_0x19fb('0x1c')](_0x5ab3e2)['then'](function(_0x2c392a){_0x205a94['count']=_0x2c392a;if(_0x23cf32[_0x19fb('0x2a')][_0x19fb('0x3c')]){_0x33fb80[_0x19fb('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x19fb('0x3e')](_0x33fb80);})['then'](function(_0x3dac4f){_0x205a94[_0x19fb('0x3f')]=_0x3dac4f;return _0x205a94;})[_0x19fb('0x23')](respondWithFilteredResult(_0x3b3a55,_0x33fb80))['catch'](handleError(_0x3b3a55,null));};exports[_0x19fb('0x40')]=function(_0x88cbd1,_0x388fa6){var _0x46ad6c={'raw':!![],'where':{'id':_0x88cbd1[_0x19fb('0x41')]['id']}},_0xfda714={};_0xfda714[_0x19fb('0x2e')]=_[_0x19fb('0x2b')](db[_0x19fb('0x3b')][_0x19fb('0x28')]);_0xfda714['query']=_['keys'](_0x88cbd1[_0x19fb('0x2a')]);_0xfda714[_0x19fb('0x2c')]=_[_0x19fb('0x2d')](_0xfda714[_0x19fb('0x2e')],_0xfda714[_0x19fb('0x2a')]);_0x46ad6c[_0x19fb('0x30')]=_['intersection'](_0xfda714['model'],qs[_0x19fb('0x2f')](_0x88cbd1[_0x19fb('0x2a')]['fields']));_0x46ad6c['attributes']=_0x46ad6c[_0x19fb('0x30')]['length']?_0x46ad6c[_0x19fb('0x30')]:_0xfda714[_0x19fb('0x2e')];if(_0x88cbd1[_0x19fb('0x2a')][_0x19fb('0x3c')]){_0x46ad6c[_0x19fb('0x3d')]=[{'all':!![]}];}_0x46ad6c=_[_0x19fb('0x38')]({},_0x46ad6c,_0x88cbd1[_0x19fb('0x3a')]);return db[_0x19fb('0x3b')][_0x19fb('0x42')](_0x46ad6c)['then'](handleEntityNotFound(_0x388fa6,null))[_0x19fb('0x23')](respondWithResult(_0x388fa6,null))['catch'](handleError(_0x388fa6,null));};exports[_0x19fb('0x43')]=function(_0x38ef6d,_0x33ce4e){return db[_0x19fb('0x3b')][_0x19fb('0x43')](_0x38ef6d[_0x19fb('0x44')],{})['then'](respondWithResult(_0x33ce4e,0xc9))[_0x19fb('0x45')](handleError(_0x33ce4e,null));};exports[_0x19fb('0x22')]=function(_0x3356b0,_0xb49276){if(_0x3356b0[_0x19fb('0x44')]['id']){delete _0x3356b0['body']['id'];}return db[_0x19fb('0x3b')]['find']({'where':{'id':_0x3356b0['params']['id']}})[_0x19fb('0x23')](handleEntityNotFound(_0xb49276,null))['then'](saveUpdates(_0x3356b0[_0x19fb('0x44')],null))['then'](respondWithResult(_0xb49276,null))['catch'](handleError(_0xb49276,null));};exports[_0x19fb('0x24')]=function(_0x133cd6,_0x24b93d){return db['WhatsappApplication'][_0x19fb('0x42')]({'where':{'id':_0x133cd6['params']['id']}})[_0x19fb('0x23')](handleEntityNotFound(_0x24b93d,null))[_0x19fb('0x23')](removeEntity(_0x24b93d,null))[_0x19fb('0x45')](handleError(_0x24b93d,null));}; \ No newline at end of file +var _0x5101=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x5101,0x7f));var _0x1510=function(_0x1f1e66,_0xc9ac8c){_0x1f1e66=_0x1f1e66-0x0;var _0x5c79b3=_0x5101[_0x1f1e66];return _0x5c79b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1510('0x0'));var rimraf=require(_0x1510('0x1'));var zipdir=require(_0x1510('0x2'));var jsonpatch=require(_0x1510('0x3'));var rp=require(_0x1510('0x4'));var moment=require('moment');var BPromise=require(_0x1510('0x5'));var Mustache=require(_0x1510('0x6'));var util=require(_0x1510('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1510('0x8'));var ejs=require(_0x1510('0x9'));var fs=require('fs');var _=require(_0x1510('0xa'));var squel=require(_0x1510('0xb'));var crypto=require(_0x1510('0xc'));var jsforce=require(_0x1510('0xd'));var deskjs=require(_0x1510('0xe'));var toCsv=require(_0x1510('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1510('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1510('0x10'));var as=require(_0x1510('0x11'));var hardwareService=require(_0x1510('0x12'));var logger=require(_0x1510('0x13'))(_0x1510('0x14'));var utils=require('../../config/utils');var config=require(_0x1510('0x15'));var db=require(_0x1510('0x16'))['db'];function respondWithStatusCode(_0x11f609,_0x475e8f){_0x475e8f=_0x475e8f||0xcc;return function(_0x33a0d3){if(_0x33a0d3){return _0x11f609[_0x1510('0x17')](_0x475e8f);}return _0x11f609[_0x1510('0x18')](_0x475e8f)['end']();};}function respondWithResult(_0x50c734,_0x422b4d){_0x422b4d=_0x422b4d||0xc8;return function(_0x597110){if(_0x597110){return _0x50c734[_0x1510('0x18')](_0x422b4d)[_0x1510('0x19')](_0x597110);}};}function respondWithFilteredResult(_0x15a209,_0x2865fa){return function(_0x54f710){if(_0x54f710){var _0x7b7e3d=_0x54f710[_0x1510('0x1a')],_0x5f261c=_0x2865fa[_0x1510('0x1b')],_0x481a4e=_0x2865fa['offset']+_0x2865fa[_0x1510('0x1c')],_0x186b97;if(_0x481a4e>=_0x7b7e3d){_0x481a4e=_0x7b7e3d;_0x186b97=0xc8;}else{_0x186b97=0xce;}_0x15a209['status'](_0x186b97);return _0x15a209[_0x1510('0x1d')](_0x1510('0x1e'),_0x5f261c+'-'+_0x481a4e+'/'+_0x7b7e3d)['json'](_0x54f710);}return null;};}function patchUpdates(_0x58af04){return function(_0x24dea7){try{jsonpatch[_0x1510('0x1f')](_0x24dea7,_0x58af04,!![]);}catch(_0x2f5413){return BPromise[_0x1510('0x20')](_0x2f5413);}return _0x24dea7[_0x1510('0x21')]();};}function saveUpdates(_0x3989cb,_0x29c74f){return function(_0x1d9748){if(_0x1d9748){return _0x1d9748[_0x1510('0x22')](_0x3989cb)[_0x1510('0x23')](function(_0x29fc92){return _0x29fc92;});}return null;};}function removeEntity(_0x5df7cc,_0x110211){return function(_0x478744){if(_0x478744){return _0x478744['destroy']()[_0x1510('0x23')](function(){_0x5df7cc[_0x1510('0x18')](0xcc)[_0x1510('0x24')]();});}};}function handleEntityNotFound(_0x55bf8e,_0x2bf113){return function(_0x3cfb21){if(!_0x3cfb21){_0x55bf8e[_0x1510('0x17')](0x194);}return _0x3cfb21;};}function handleError(_0x2c328f,_0x4a5952){_0x4a5952=_0x4a5952||0x1f4;return function(_0x1a417c){logger['error'](_0x1a417c[_0x1510('0x25')]);if(_0x1a417c['name']){delete _0x1a417c[_0x1510('0x26')];}_0x2c328f['status'](_0x4a5952)[_0x1510('0x27')](_0x1a417c);};}exports[_0x1510('0x28')]=function(_0x5a8553,_0x1f8b88){var _0xa95777={},_0x89b335={},_0x3e45ae={'count':0x0,'rows':[]};var _0x2c5f20=_[_0x1510('0x29')](db[_0x1510('0x2a')][_0x1510('0x2b')],function(_0x19fd5c){return{'name':_0x19fd5c[_0x1510('0x2c')],'type':_0x19fd5c[_0x1510('0x2d')]['key']};});_0x89b335['model']=_['map'](_0x2c5f20,_0x1510('0x26'));_0x89b335[_0x1510('0x2e')]=_['keys'](_0x5a8553[_0x1510('0x2e')]);_0x89b335['filters']=_[_0x1510('0x2f')](_0x89b335[_0x1510('0x30')],_0x89b335[_0x1510('0x2e')]);_0xa95777[_0x1510('0x31')]=_[_0x1510('0x2f')](_0x89b335[_0x1510('0x30')],qs[_0x1510('0x32')](_0x5a8553[_0x1510('0x2e')][_0x1510('0x32')]));_0xa95777[_0x1510('0x31')]=_0xa95777[_0x1510('0x31')][_0x1510('0x33')]?_0xa95777['attributes']:_0x89b335[_0x1510('0x30')];if(!_0x5a8553[_0x1510('0x2e')][_0x1510('0x34')](_0x1510('0x35'))){_0xa95777['limit']=qs[_0x1510('0x1c')](_0x5a8553[_0x1510('0x2e')]['limit']);_0xa95777['offset']=qs[_0x1510('0x1b')](_0x5a8553[_0x1510('0x2e')][_0x1510('0x1b')]);}_0xa95777[_0x1510('0x36')]=qs['sort'](_0x5a8553[_0x1510('0x2e')][_0x1510('0x37')]);_0xa95777[_0x1510('0x38')]=qs[_0x1510('0x39')](_[_0x1510('0x3a')](_0x5a8553[_0x1510('0x2e')],_0x89b335[_0x1510('0x39')]),_0x2c5f20);if(_0x5a8553[_0x1510('0x2e')][_0x1510('0x3b')]){_0xa95777[_0x1510('0x38')]=_[_0x1510('0x3c')](_0xa95777[_0x1510('0x38')],{'$or':_[_0x1510('0x29')](_0x2c5f20,function(_0x519291){if(_0x519291[_0x1510('0x2d')]!==_0x1510('0x3d')){var _0x392e95={};_0x392e95[_0x519291[_0x1510('0x26')]]={'$like':'%'+_0x5a8553[_0x1510('0x2e')][_0x1510('0x3b')]+'%'};return _0x392e95;}})});}_0xa95777=_['merge']({},_0xa95777,_0x5a8553[_0x1510('0x3e')]);var _0x4ed65f={'where':_0xa95777[_0x1510('0x38')]};return db[_0x1510('0x2a')][_0x1510('0x1a')](_0x4ed65f)[_0x1510('0x23')](function(_0x4225f4){_0x3e45ae['count']=_0x4225f4;if(_0x5a8553[_0x1510('0x2e')][_0x1510('0x3f')]){_0xa95777[_0x1510('0x40')]=[{'all':!![]}];}return db[_0x1510('0x2a')][_0x1510('0x41')](_0xa95777);})[_0x1510('0x23')](function(_0x2bdfe0){_0x3e45ae[_0x1510('0x42')]=_0x2bdfe0;return _0x3e45ae;})[_0x1510('0x23')](respondWithFilteredResult(_0x1f8b88,_0xa95777))[_0x1510('0x43')](handleError(_0x1f8b88,null));};exports[_0x1510('0x44')]=function(_0x29b869,_0x14fbae){var _0x5bad9e={'raw':!![],'where':{'id':_0x29b869[_0x1510('0x45')]['id']}},_0x99fea6={};_0x99fea6['model']=_['keys'](db[_0x1510('0x2a')]['rawAttributes']);_0x99fea6[_0x1510('0x2e')]=_[_0x1510('0x46')](_0x29b869['query']);_0x99fea6['filters']=_[_0x1510('0x2f')](_0x99fea6['model'],_0x99fea6['query']);_0x5bad9e['attributes']=_[_0x1510('0x2f')](_0x99fea6[_0x1510('0x30')],qs['fields'](_0x29b869[_0x1510('0x2e')][_0x1510('0x32')]));_0x5bad9e[_0x1510('0x31')]=_0x5bad9e[_0x1510('0x31')][_0x1510('0x33')]?_0x5bad9e['attributes']:_0x99fea6['model'];if(_0x29b869['query'][_0x1510('0x3f')]){_0x5bad9e[_0x1510('0x40')]=[{'all':!![]}];}_0x5bad9e=_[_0x1510('0x3c')]({},_0x5bad9e,_0x29b869[_0x1510('0x3e')]);return db[_0x1510('0x2a')][_0x1510('0x47')](_0x5bad9e)['then'](handleEntityNotFound(_0x14fbae,null))[_0x1510('0x23')](respondWithResult(_0x14fbae,null))[_0x1510('0x43')](handleError(_0x14fbae,null));};exports['create']=function(_0x485163,_0x577009){return db['WhatsappApplication'][_0x1510('0x48')](_0x485163[_0x1510('0x49')],{})[_0x1510('0x23')](respondWithResult(_0x577009,0xc9))['catch'](handleError(_0x577009,null));};exports['update']=function(_0x27b5fa,_0x5db888){if(_0x27b5fa[_0x1510('0x49')]['id']){delete _0x27b5fa['body']['id'];}return db[_0x1510('0x2a')][_0x1510('0x47')]({'where':{'id':_0x27b5fa[_0x1510('0x45')]['id']}})[_0x1510('0x23')](handleEntityNotFound(_0x5db888,null))[_0x1510('0x23')](saveUpdates(_0x27b5fa[_0x1510('0x49')],null))[_0x1510('0x23')](respondWithResult(_0x5db888,null))[_0x1510('0x43')](handleError(_0x5db888,null));};exports[_0x1510('0x4a')]=function(_0x205df6,_0x573e05){return db['WhatsappApplication'][_0x1510('0x47')]({'where':{'id':_0x205df6[_0x1510('0x45')]['id']}})[_0x1510('0x23')](handleEntityNotFound(_0x573e05,null))[_0x1510('0x23')](removeEntity(_0x573e05,null))[_0x1510('0x43')](handleError(_0x573e05,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e86a36e..9ea5fcc 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 _0x1df7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','util','../../config/logger'];(function(_0x1eedbb,_0xd8f512){var _0x39907b=function(_0x54f0e0){while(--_0x54f0e0){_0x1eedbb['push'](_0x1eedbb['shift']());}};_0x39907b(++_0xd8f512);}(_0x1df7,0x6e));var _0x71df=function(_0xb045d2,_0x258206){_0xb045d2=_0xb045d2-0x0;var _0x577872=_0x1df7[_0xb045d2];return _0x577872;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var logger=require(_0x71df('0x1'))(_0x71df('0x2'));var moment=require(_0x71df('0x3'));var BPromise=require(_0x71df('0x4'));var rp=require(_0x71df('0x5'));var fs=require('fs');var path=require(_0x71df('0x6'));var rimraf=require(_0x71df('0x7'));var config=require(_0x71df('0x8'));var attributes=require(_0x71df('0x9'));module[_0x71df('0xa')]=function(_0x4364ea,_0x481a2f){return _0x4364ea[_0x71df('0xb')]('WhatsappApplication',attributes,{'tableName':_0x71df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x71df('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x151b=['api','bluebird','request-promise','path','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x45693b,_0x18832c){var _0x4e820c=function(_0x1b9a3d){while(--_0x1b9a3d){_0x45693b['push'](_0x45693b['shift']());}};_0x4e820c(++_0x18832c);}(_0x151b,0x153));var _0xb151=function(_0x5625f9,_0x40240e){_0x5625f9=_0x5625f9-0x0;var _0x545341=_0x151b[_0x5625f9];return _0x545341;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb151('0x1'));var moment=require('moment');var BPromise=require(_0xb151('0x2'));var rp=require(_0xb151('0x3'));var fs=require('fs');var path=require(_0xb151('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb151('0x5'));module[_0xb151('0x6')]=function(_0x56b93e,_0x3ef028){return _0x56b93e['define'](_0xb151('0x7'),attributes,{'tableName':_0xb151('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb151('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e07f3ae..657fa5d 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 _0x5162=['jayson/promise','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5162,0x103));var _0x2516=function(_0x46aa6f,_0xf7b072){_0x46aa6f=_0x46aa6f-0x0;var _0x44759c=_0x5162[_0x46aa6f];return _0x44759c;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2516('0x1'));var db=require(_0x2516('0x2'))['db'];var utils=require(_0x2516('0x3'));var logger=require(_0x2516('0x4'))(_0x2516('0x5'));var config=require(_0x2516('0x6'));var jayson=require(_0x2516('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5beeb3,_0x20a4a4,_0xba4b36){return new BPromise(function(_0xa1557,_0x3a8834){return client[_0x2516('0x8')](_0x5beeb3,_0xba4b36)[_0x2516('0x9')](function(_0x1cb817){logger['info'](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));logger[_0x2516('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x20a4a4,'request\x20sent',JSON['stringify'](_0x1cb817));if(_0x1cb817['error']){if(_0x1cb817[_0x2516('0xd')][_0x2516('0xe')]===0x1f4){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817['error'][_0x2516('0xf')]);return _0x3a8834(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);return _0xa1557(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}else{logger[_0x2516('0x10')](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));_0xa1557(_0x1cb817[_0x2516('0x11')][_0x2516('0xf')]);}})[_0x2516('0x12')](function(_0x5623be){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x5623be);_0x3a8834(_0x5623be);});});} \ No newline at end of file +var _0x4f0d=['ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5a07f4,_0x411786){var _0x1e8699=function(_0x52643c){while(--_0x52643c){_0x5a07f4['push'](_0x5a07f4['shift']());}};_0x1e8699(++_0x411786);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x4f0d[_0x16a637];return _0x25126d;};'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(_0xd4f0('0x0'));var db=require(_0xd4f0('0x1'))['db'];var utils=require(_0xd4f0('0x2'));var logger=require('../../config/logger')(_0xd4f0('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16da18,_0x4dd938,_0x50e79f){return new BPromise(function(_0x19a779,_0x69309d){return client[_0xd4f0('0x5')](_0x16da18,_0x50e79f)[_0xd4f0('0x6')](function(_0x9b959f){logger['info'](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4dd938,_0xd4f0('0x8'),JSON[_0xd4f0('0x9')](_0x9b959f));if(_0x9b959f['error']){if(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xb')]===0x1f4){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')]['message']);return _0x69309d(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);return _0x19a779(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}else{logger[_0xd4f0('0xd')](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));_0x19a779(_0x9b959f[_0xd4f0('0xe')]['message']);}})['catch'](function(_0x169443){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x169443);_0x69309d(_0x169443);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c7cdcc9..6993cae 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 _0x5010=['tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','whatsapp','whatsappinteraction:addtags','addTags','put'];(function(_0x2b8a8c,_0x9ffa22){var _0x53c338=function(_0x326455){while(--_0x326455){_0x2b8a8c['push'](_0x2b8a8c['shift']());}};_0x53c338(++_0x9ffa22);}(_0x5010,0x1c9));var _0x0501=function(_0x19aca2,_0x4da700){_0x19aca2=_0x19aca2-0x0;var _0x358051=_0x5010[_0x19aca2];return _0x358051;};'use strict';var multer=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var path=require(_0x0501('0x2'));var timeout=require(_0x0501('0x3'));var express=require(_0x0501('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0501('0x5'));var config=require(_0x0501('0x6'));var controller=require(_0x0501('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0501('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0501('0x9')]);router[_0x0501('0x8')](_0x0501('0xa'),auth[_0x0501('0xb')](),controller[_0x0501('0xc')]);router['get'](_0x0501('0xd'),auth[_0x0501('0xb')](),controller[_0x0501('0xe')]);router[_0x0501('0x8')](_0x0501('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0501('0xb')](),controller[_0x0501('0x10')]);router[_0x0501('0x11')](_0x0501('0xd'),auth[_0x0501('0xb')](),controller[_0x0501('0x12')]);router[_0x0501('0x11')]('/:id/tags',auth[_0x0501('0xb')](),interaction['tracked'](_0x0501('0x13'),_0x0501('0x14')),controller[_0x0501('0x15')]);router[_0x0501('0x16')](_0x0501('0xa'),auth[_0x0501('0xb')](),interaction[_0x0501('0x17')](_0x0501('0x13'),_0x0501('0x18')),controller[_0x0501('0x19')]);router[_0x0501('0x1a')]('/:id',auth[_0x0501('0xb')](),interaction[_0x0501('0x17')](_0x0501('0x13'),_0x0501('0x1b')),controller[_0x0501('0x1c')]);router['delete'](_0x0501('0x1d'),auth[_0x0501('0xb')](),controller[_0x0501('0x1e')]);module[_0x0501('0x1f')]=router; \ No newline at end of file +var _0xdf1f=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4be21f,_0x513920){var _0x3d3076=function(_0x4f4e14){while(--_0x4f4e14){_0x4be21f['push'](_0x4be21f['shift']());}};_0x3d3076(++_0x513920);}(_0xdf1f,0x1ec));var _0xfdf1=function(_0x434812,_0x23b1e2){_0x434812=_0x434812-0x0;var _0x15f61e=_0xdf1f[_0x434812];return _0x15f61e;};'use strict';var multer=require(_0xfdf1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfdf1('0x1'));var express=require(_0xfdf1('0x2'));var router=express[_0xfdf1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdf1('0x4'));var config=require('../../config/environment');var controller=require(_0xfdf1('0x5'));router[_0xfdf1('0x6')]('/',auth[_0xfdf1('0x7')](),controller[_0xfdf1('0x8')]);router[_0xfdf1('0x6')](_0xfdf1('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xfdf1('0x6')](_0xfdf1('0xa'),auth[_0xfdf1('0x7')](),controller[_0xfdf1('0xb')]);router['get'](_0xfdf1('0xc'),auth['isAuthenticated'](),controller[_0xfdf1('0xd')]);router[_0xfdf1('0x6')](_0xfdf1('0xe'),auth[_0xfdf1('0x7')](),controller[_0xfdf1('0xf')]);router['post']('/',auth[_0xfdf1('0x7')](),controller[_0xfdf1('0x10')]);router[_0xfdf1('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfdf1('0x12')]);router[_0xfdf1('0x11')](_0xfdf1('0x13'),auth[_0xfdf1('0x7')](),interaction[_0xfdf1('0x14')](_0xfdf1('0x15'),_0xfdf1('0x16')),controller[_0xfdf1('0x17')]);router[_0xfdf1('0x18')](_0xfdf1('0xa'),auth[_0xfdf1('0x7')](),interaction[_0xfdf1('0x14')](_0xfdf1('0x15'),'whatsappinteraction:update'),controller[_0xfdf1('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xfdf1('0x14')]('whatsapp','whatsappinteraction:destroy'),controller[_0xfdf1('0x1a')]);router['delete'](_0xfdf1('0x13'),auth[_0xfdf1('0x7')](),controller['removeTags']);module[_0xfdf1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index aa20995..89bf683 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 _0x0eeb=['out','ENUM','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x0eeb,0x92));var _0xb0ee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0eeb[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xb0ee('0x0'));var moment=require(_0xb0ee('0x1'));module[_0xb0ee('0x2')]={'closed':{'type':Sequelize[_0xb0ee('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb0ee('0x4')]},'phone':{'type':Sequelize[_0xb0ee('0x4')]},'read1stAt':{'type':Sequelize[_0xb0ee('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb0ee('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb0ee('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xb0ee('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9e2c=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e2c,0x179));var _0xc9e2=function(_0x1c0e9d,_0x3944b0){_0x1c0e9d=_0x1c0e9d-0x0;var _0x320711=_0x9e2c[_0x1c0e9d];return _0x320711;};'use strict';var Sequelize=require(_0xc9e2('0x0'));var moment=require('moment');module[_0xc9e2('0x1')]={'closed':{'type':Sequelize[_0xc9e2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc9e2('0x3')]},'disposition':{'type':Sequelize[_0xc9e2('0x4')]},'note':{'type':Sequelize[_0xc9e2('0x4')]},'phone':{'type':Sequelize[_0xc9e2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc9e2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc9e2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc9e2('0x6')]('in',_0xc9e2('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 cca2935..8e3d44c 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 _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','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','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x2a178d,_0x4b9a0e){var _0x304515=function(_0x783739){while(--_0x783739){_0x2a178d['push'](_0x2a178d['shift']());}};_0x304515(++_0x4b9a0e);}(_0xadb5,0xad));var _0x5adb=function(_0x4506c4,_0x5478c9){_0x4506c4=_0x4506c4-0x0;var _0x12d3e2=_0xadb5[_0x4506c4];return _0x12d3e2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'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':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,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(_0x4bcfc1,_0x32a5be){var _0x18b0ff=function(_0x4d83bb){while(--_0x4d83bb){_0x4bcfc1['push'](_0x4bcfc1['shift']());}};_0x18b0ff(++_0x32a5be);}(_0x814b,0x1a2));var _0xb814=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x814b[_0x1f1fb4];return _0x12fa15;};'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 d8c42b3..1ee36af 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 _0x8a2e=['getUsers','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x8a2e,0x119));var _0xe8a2=function(_0x3387d9,_0x9f28d9){_0x3387d9=_0x3387d9-0x0;var _0x512706=_0x8a2e[_0x3387d9];return _0x512706;};'use strict';var EventEmitter=require(_0xe8a2('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xe8a2('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xe8a2('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8a2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37ca22){return function(_0x5c3cee,_0x1d6a8f,_0x553c04){_0x5c3cee[_0xe8a2('0x4')]({'attributes':['id'],'raw':!![]})[_0xe8a2('0x5')](function(_0x262d03){_0x5c3cee['setDataValue'](_0xe8a2('0x6'),_0x262d03['map'](function(_0x19ace5){return{'id':_0x19ace5['id']};}));return WhatsappMessage[_0xe8a2('0x7')]({'where':{'WhatsappInteractionId':_0x5c3cee['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe8a2('0x5')](function(_0x9053c3){_0x5c3cee[_0xe8a2('0x8')](_0xe8a2('0x9'),_0x9053c3['length']);WhatsappInteractionEvents['emit'](_0x37ca22+':'+_0x5c3cee['id'],_0x5c3cee);WhatsappInteractionEvents[_0xe8a2('0xa')](_0x37ca22,_0x5c3cee);_0x553c04(null);})[_0xe8a2('0xb')](_0x553c04(null));};}for(var e in events){if(events[_0xe8a2('0xc')](e)){var event=events[e];WhatsappInteraction[_0xe8a2('0xd')](e,emitEvent(event));}}module[_0xe8a2('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6e85=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','getUsers','then'];(function(_0x31c984,_0x58a478){var _0x3ed0e9=function(_0xeb5608){while(--_0xeb5608){_0x31c984['push'](_0x31c984['shift']());}};_0x3ed0e9(++_0x58a478);}(_0x6e85,0x1ac));var _0x56e8=function(_0x5bbf2a,_0x5aeb3d){_0x5bbf2a=_0x5bbf2a-0x0;var _0x19261f=_0x6e85[_0x5bbf2a];return _0x19261f;};'use strict';var EventEmitter=require(_0x56e8('0x0'));var WhatsappInteraction=require(_0x56e8('0x1'))['db'][_0x56e8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x56e8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdb0892){return function(_0x539c06,_0x4b922e,_0x231223){_0x539c06[_0x56e8('0x4')]({'attributes':['id'],'raw':!![]})[_0x56e8('0x5')](function(_0x54de94){_0x539c06['setDataValue']('Users',_0x54de94['map'](function(_0x318631){return{'id':_0x318631['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x539c06['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56e8('0x5')](function(_0x57719a){_0x539c06[_0x56e8('0x6')](_0x56e8('0x7'),_0x57719a[_0x56e8('0x8')]);WhatsappInteractionEvents[_0x56e8('0x9')](_0xdb0892+':'+_0x539c06['id'],_0x539c06);WhatsappInteractionEvents['emit'](_0xdb0892,_0x539c06);_0x231223(null);})[_0x56e8('0xa')](_0x231223(null));};}for(var e in events){if(events[_0x56e8('0xb')](e)){var event=events[e];WhatsappInteraction[_0x56e8('0xc')](e,emitEvent(event));}}module[_0x56e8('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index be1e9e8..d0344b1 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x3fb9eb,_0x468c58){var _0x1f29bb=function(_0x4c5e7b){while(--_0x4c5e7b){_0x3fb9eb['push'](_0x3fb9eb['shift']());}};_0x1f29bb(++_0x468c58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x287052,_0x277706){var _0x13ec54=function(_0x2da25e){while(--_0x2da25e){_0x287052['push'](_0x287052['shift']());}};_0x13ec54(++_0x277706);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d0e9192..57d88d4 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 _0xc47f=['ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','WhatsappInteraction','update','body','options','raw','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags'];(function(_0x5d8987,_0x14d054){var _0x2997eb=function(_0x56f92a){while(--_0x56f92a){_0x5d8987['push'](_0x5d8987['shift']());}};_0x2997eb(++_0x14d054);}(_0xc47f,0x15c));var _0xfc47=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc47f[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xfc47('0x0'));var util=require(_0xfc47('0x1'));var moment=require(_0xfc47('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc47('0x3'));var fs=require('fs');var Redis=require(_0xfc47('0x4'));var db=require(_0xfc47('0x5'))['db'];var utils=require(_0xfc47('0x6'));var logger=require('../../config/logger')(_0xfc47('0x7'));var config=require(_0xfc47('0x8'));var jayson=require(_0xfc47('0x9'));var client=jayson[_0xfc47('0xa')][_0xfc47('0xb')]({'port':0x232a});config[_0xfc47('0xc')]=_['defaults'](config[_0xfc47('0xc')],{'host':_0xfc47('0xd'),'port':0x18eb});var socket=require(_0xfc47('0xe'))(new Redis(config[_0xfc47('0xc')]));require(_0xfc47('0xf'))[_0xfc47('0x10')](socket);function respondWithRpcPromise(_0x494365,_0xc2af23,_0x551418){return new BPromise(function(_0x3d6322,_0x416cde){return client[_0xfc47('0x11')](_0x494365,_0x551418)[_0xfc47('0x12')](function(_0x1e3e77){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xc2af23,_0xfc47('0x13'));logger[_0xfc47('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xc2af23,_0xfc47('0x13'),JSON[_0xfc47('0x15')](_0x1e3e77));if(_0x1e3e77['error']){if(_0x1e3e77[_0xfc47('0x16')][_0xfc47('0x17')]===0x1f4){logger['error'](_0xfc47('0x18'),_0xc2af23,_0x1e3e77[_0xfc47('0x16')][_0xfc47('0x19')]);return _0x416cde(_0x1e3e77[_0xfc47('0x16')][_0xfc47('0x19')]);}logger[_0xfc47('0x16')](_0xfc47('0x18'),_0xc2af23,_0x1e3e77[_0xfc47('0x16')]['message']);return _0x3d6322(_0x1e3e77['error'][_0xfc47('0x19')]);}else{logger[_0xfc47('0x1a')](_0xfc47('0x18'),_0xc2af23,_0xfc47('0x13'));_0x3d6322(_0x1e3e77[_0xfc47('0x1b')][_0xfc47('0x19')]);}})[_0xfc47('0x1c')](function(_0x98cc94){logger[_0xfc47('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xc2af23,_0x98cc94);_0x416cde(_0x98cc94);});});}exports['UpdateWhatsappInteraction']=function(_0xe8e392){var _0x5a34da=this;return new Promise(function(_0x997818,_0x2a9359){return db[_0xfc47('0x1d')][_0xfc47('0x1e')](_0xe8e392[_0xfc47('0x1f')],{'raw':_0xe8e392['options']?_0xe8e392[_0xfc47('0x20')][_0xfc47('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe8e392[_0xfc47('0x20')]?_0xe8e392[_0xfc47('0x20')]['where']||null:null,'attributes':_0xe8e392[_0xfc47('0x20')]?_0xe8e392['options'][_0xfc47('0x22')]||null:null,'limit':_0xe8e392[_0xfc47('0x20')]?_0xe8e392[_0xfc47('0x20')]['limit']||null:null})[_0xfc47('0x12')](function(_0x323289){logger[_0xfc47('0x1a')]('UpdateWhatsappInteraction',_0xe8e392);logger[_0xfc47('0x14')](_0xfc47('0x23'),_0xe8e392,JSON[_0xfc47('0x15')](_0x323289));_0x997818(_0x323289);})[_0xfc47('0x1c')](function(_0x26f35d){logger[_0xfc47('0x16')]('UpdateWhatsappInteraction',_0x26f35d[_0xfc47('0x19')],_0xe8e392);_0x2a9359(_0x5a34da['error'](0x1f4,_0x26f35d[_0xfc47('0x19')]));});});};exports[_0xfc47('0x24')]=function(_0x5a26e0){return new Promise(function(_0x54f6d8,_0x276b61){return db[_0xfc47('0x1d')][_0xfc47('0x25')]({'where':_0x5a26e0[_0xfc47('0x20')]?_0x5a26e0[_0xfc47('0x20')]['where']||null:null})['then'](function(_0x453c1f){if(_0x453c1f){return _0x453c1f[_0xfc47('0x26')](_0x5a26e0[_0xfc47('0x1f')][_0xfc47('0x27')],_[_0xfc47('0x28')](_0x5a26e0[_0xfc47('0x1f')],[_0xfc47('0x27'),'id'])||{});}})[_0xfc47('0x29')](function(_0x1ccb16){logger['info']('AddTags',_0x5a26e0);logger[_0xfc47('0x14')](_0xfc47('0x2a'),_0x5a26e0,JSON[_0xfc47('0x15')](_0x1ccb16));_0x54f6d8(_0x1ccb16);})[_0xfc47('0x1c')](function(_0x5b379a){logger['error'](_0xfc47('0x2a'),_0x5b379a[_0xfc47('0x19')],_0x5a26e0);_0x276b61(_this['error'](0x1f4,_0x5b379a[_0xfc47('0x19')]));});});}; \ No newline at end of file +var _0xe5da=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','WhatsappInteraction','update','options','raw','where','attributes','limit','info','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent'];(function(_0x3d5fc9,_0x48bb9f){var _0x4c5fef=function(_0x5385ef){while(--_0x5385ef){_0x3d5fc9['push'](_0x3d5fc9['shift']());}};_0x4c5fef(++_0x48bb9f);}(_0xe5da,0x1b7));var _0xae5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe5da[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xae5d('0x0'));var util=require(_0xae5d('0x1'));var moment=require(_0xae5d('0x2'));var BPromise=require(_0xae5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae5d('0x4'));var db=require(_0xae5d('0x5'))['db'];var utils=require(_0xae5d('0x6'));var logger=require(_0xae5d('0x7'))(_0xae5d('0x8'));var config=require(_0xae5d('0x9'));var jayson=require(_0xae5d('0xa'));var client=jayson['client'][_0xae5d('0xb')]({'port':0x232a});config['redis']=_[_0xae5d('0xc')](config[_0xae5d('0xd')],{'host':_0xae5d('0xe'),'port':0x18eb});var socket=require(_0xae5d('0xf'))(new Redis(config['redis']));require(_0xae5d('0x10'))[_0xae5d('0x11')](socket);function respondWithRpcPromise(_0x16e865,_0x2a804a,_0x5b4dfd){return new BPromise(function(_0x559b71,_0x44091d){return client[_0xae5d('0x12')](_0x16e865,_0x5b4dfd)[_0xae5d('0x13')](function(_0x35a9df){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x2a804a,_0xae5d('0x14'));logger[_0xae5d('0x15')](_0xae5d('0x16'),_0x2a804a,_0xae5d('0x14'),JSON[_0xae5d('0x17')](_0x35a9df));if(_0x35a9df['error']){if(_0x35a9df[_0xae5d('0x18')][_0xae5d('0x19')]===0x1f4){logger[_0xae5d('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2a804a,_0x35a9df[_0xae5d('0x18')][_0xae5d('0x1a')]);return _0x44091d(_0x35a9df['error'][_0xae5d('0x1a')]);}logger[_0xae5d('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2a804a,_0x35a9df[_0xae5d('0x18')]['message']);return _0x559b71(_0x35a9df[_0xae5d('0x18')][_0xae5d('0x1a')]);}else{logger['info'](_0xae5d('0x1b'),_0x2a804a,_0xae5d('0x14'));_0x559b71(_0x35a9df[_0xae5d('0x1c')][_0xae5d('0x1a')]);}})[_0xae5d('0x1d')](function(_0x280d30){logger[_0xae5d('0x18')](_0xae5d('0x1b'),_0x2a804a,_0x280d30);_0x44091d(_0x280d30);});});}exports['UpdateWhatsappInteraction']=function(_0x363fa4){var _0x58c63f=this;return new Promise(function(_0x52ac02,_0x5bf13d){return db[_0xae5d('0x1e')][_0xae5d('0x1f')](_0x363fa4['body'],{'raw':_0x363fa4[_0xae5d('0x20')]?_0x363fa4[_0xae5d('0x20')][_0xae5d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x363fa4[_0xae5d('0x20')]?_0x363fa4[_0xae5d('0x20')][_0xae5d('0x22')]||null:null,'attributes':_0x363fa4[_0xae5d('0x20')]?_0x363fa4[_0xae5d('0x20')][_0xae5d('0x23')]||null:null,'limit':_0x363fa4[_0xae5d('0x20')]?_0x363fa4[_0xae5d('0x20')][_0xae5d('0x24')]||null:null})[_0xae5d('0x13')](function(_0xe86a58){logger[_0xae5d('0x25')](_0xae5d('0x26'),_0x363fa4);logger['debug']('UpdateWhatsappInteraction',_0x363fa4,JSON[_0xae5d('0x17')](_0xe86a58));_0x52ac02(_0xe86a58);})[_0xae5d('0x1d')](function(_0x177a90){logger[_0xae5d('0x18')](_0xae5d('0x26'),_0x177a90[_0xae5d('0x1a')],_0x363fa4);_0x5bf13d(_0x58c63f[_0xae5d('0x18')](0x1f4,_0x177a90[_0xae5d('0x1a')]));});});};exports[_0xae5d('0x27')]=function(_0x56589c){return new Promise(function(_0x471b85,_0x55b7fa){return db[_0xae5d('0x1e')][_0xae5d('0x28')]({'where':_0x56589c[_0xae5d('0x20')]?_0x56589c[_0xae5d('0x20')][_0xae5d('0x22')]||null:null})[_0xae5d('0x13')](function(_0x50aee2){if(_0x50aee2){return _0x50aee2[_0xae5d('0x29')](_0x56589c[_0xae5d('0x2a')][_0xae5d('0x2b')],_['omit'](_0x56589c[_0xae5d('0x2a')],[_0xae5d('0x2b'),'id'])||{});}})[_0xae5d('0x2c')](function(_0x1cb973){logger[_0xae5d('0x25')](_0xae5d('0x2d'),_0x56589c);logger['debug'](_0xae5d('0x2d'),_0x56589c,JSON[_0xae5d('0x17')](_0x1cb973));_0x471b85(_0x1cb973);})['catch'](function(_0xa49ed3){logger[_0xae5d('0x18')](_0xae5d('0x2d'),_0xa49ed3[_0xae5d('0x1a')],_0x56589c);_0x55b7fa(_this['error'](0x1f4,_0xa49ed3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1269152..1916d22 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 _0xba33=['save','update','length','whatsappInteraction:'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xba33,0x12c));var _0x3ba3=function(_0x773a2e,_0x4196b3){_0x773a2e=_0x773a2e-0x0;var _0x19683d=_0xba33[_0x773a2e];return _0x19683d;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x3ba3('0x0'),'remove',_0x3ba3('0x1')];function createListener(_0x2318c3,_0x502a72){return function(_0xfbad86){_0x502a72['emit'](_0x2318c3,_0xfbad86);};}function removeListener(_0x1c046e,_0x1ad5e3){return function(){WhatsappInteractionEvents['removeListener'](_0x1c046e,_0x1ad5e3);};}exports['register']=function(_0xfa044b){for(var _0x2e25e7=0x0,_0x5a17bf=events[_0x3ba3('0x2')];_0x2e25e7<_0x5a17bf;_0x2e25e7++){var _0x49876b=events[_0x2e25e7];var _0x512517=createListener(_0x3ba3('0x3')+_0x49876b,_0xfa044b);WhatsappInteractionEvents['on'](_0x49876b,_0x512517);}}; \ No newline at end of file +var _0xa1f2=['removeListener','length','whatsappInteraction:','save','remove','update'];(function(_0x48b04b,_0x44f24f){var _0x4d9076=function(_0x356da7){while(--_0x356da7){_0x48b04b['push'](_0x48b04b['shift']());}};_0x4d9076(++_0x44f24f);}(_0xa1f2,0xa5));var _0x2a1f=function(_0x74610c,_0xf8d050){_0x74610c=_0x74610c-0x0;var _0x111ecb=_0xa1f2[_0x74610c];return _0x111ecb;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x2a1f('0x0'),_0x2a1f('0x1'),_0x2a1f('0x2')];function createListener(_0xc0e7b1,_0xc5a8e){return function(_0x4036b0){_0xc5a8e['emit'](_0xc0e7b1,_0x4036b0);};}function removeListener(_0xdbcc72,_0x596054){return function(){WhatsappInteractionEvents[_0x2a1f('0x3')](_0xdbcc72,_0x596054);};}exports['register']=function(_0x545828){for(var _0x2e2539=0x0,_0x3f8986=events[_0x2a1f('0x4')];_0x2e2539<_0x3f8986;_0x2e2539++){var _0x54ee05=events[_0x2e2539];var _0x1a458d=createListener(_0x2a1f('0x5')+_0x54ee05,_0x545828);WhatsappInteractionEvents['on'](_0x54ee05,_0x1a458d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 1241790..ebb0846 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 _0xd301=['isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','express','Router','../../config/environment','./whatsappMessage.controller','get'];(function(_0x310841,_0x39239e){var _0x422cd8=function(_0x43d6f9){while(--_0x43d6f9){_0x310841['push'](_0x310841['shift']());}};_0x422cd8(++_0x39239e);}(_0xd301,0xe2));var _0x1d30=function(_0x5e9383,_0x268888){_0x5e9383=_0x5e9383-0x0;var _0x4e830a=_0xd301[_0x5e9383];return _0x4e830a;};'use strict';var multer=require(_0x1d30('0x0'));var util=require(_0x1d30('0x1'));var path=require(_0x1d30('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d30('0x3'));var router=express[_0x1d30('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1d30('0x5'));var controller=require(_0x1d30('0x6'));router[_0x1d30('0x7')]('/',auth[_0x1d30('0x8')](),controller[_0x1d30('0x9')]);router[_0x1d30('0x7')](_0x1d30('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1d30('0x7')](_0x1d30('0xb'),auth['isAuthenticated'](),controller[_0x1d30('0xc')]);router[_0x1d30('0xd')]('/',auth[_0x1d30('0x8')](),interaction[_0x1d30('0xe')](_0x1d30('0xf'),_0x1d30('0x10')),controller[_0x1d30('0x11')]);router[_0x1d30('0xd')](_0x1d30('0x12'),controller['status']);router[_0x1d30('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x1d30('0x14')]);router[_0x1d30('0x13')](_0x1d30('0x15'),auth['isAuthenticated'](),controller[_0x1d30('0x16')]);router[_0x1d30('0x13')](_0x1d30('0x17'),auth[_0x1d30('0x8')](),controller['reject']);router['delete'](_0x1d30('0xb'),auth['isAuthenticated'](),controller[_0x1d30('0x18')]);module[_0x1d30('0x19')]=router; \ No newline at end of file +var _0x041e=['Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','util','path','express'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x041e,0x1d8));var _0xe041=function(_0x53f9c4,_0x1637dc){_0x53f9c4=_0x53f9c4-0x0;var _0x497419=_0x041e[_0x53f9c4];return _0x497419;};'use strict';var multer=require('multer');var util=require(_0xe041('0x0'));var path=require(_0xe041('0x1'));var timeout=require('connect-timeout');var express=require(_0xe041('0x2'));var router=express[_0xe041('0x3')]();var auth=require(_0xe041('0x4'));var interaction=require(_0xe041('0x5'));var config=require('../../config/environment');var controller=require(_0xe041('0x6'));router[_0xe041('0x7')]('/',auth[_0xe041('0x8')](),controller[_0xe041('0x9')]);router[_0xe041('0x7')](_0xe041('0xa'),auth[_0xe041('0x8')](),controller['describe']);router['get'](_0xe041('0xb'),auth[_0xe041('0x8')](),controller[_0xe041('0xc')]);router[_0xe041('0xd')]('/',auth['isAuthenticated'](),interaction[_0xe041('0xe')](_0xe041('0xf'),'whatsappmessage:create'),controller['create']);router['post'](_0xe041('0x10'),controller[_0xe041('0x11')]);router[_0xe041('0x12')](_0xe041('0xb'),auth['isAuthenticated'](),controller[_0xe041('0x13')]);router['put'](_0xe041('0x14'),auth['isAuthenticated'](),controller[_0xe041('0x15')]);router[_0xe041('0x12')](_0xe041('0x16'),auth['isAuthenticated'](),controller[_0xe041('0x17')]);router[_0xe041('0x18')](_0xe041('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1df62c2..47549d7 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 _0xd624=['medium','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1d535f,_0xc42b6b){var _0x3a2a48=function(_0x1944ee){while(--_0x1944ee){_0x1d535f['push'](_0x1d535f['shift']());}};_0x3a2a48(++_0xc42b6b);}(_0xd624,0x124));var _0x4d62=function(_0x4e916b,_0x430f33){_0x4e916b=_0x4e916b-0x0;var _0x378909=_0xd624[_0x4e916b];return _0x378909;};'use strict';var Sequelize=require(_0x4d62('0x0'));module[_0x4d62('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4d62('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x4d62('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4d62('0x4')](0xbe)},'phone':{'type':Sequelize[_0x4d62('0x4')]},'readAt':{'type':Sequelize[_0x4d62('0x5')]},'secret':{'type':Sequelize[_0x4d62('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x41b7=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5a65bb,_0x5779fd){var _0x524d94=function(_0x4dec57){while(--_0x4dec57){_0x5a65bb['push'](_0x5a65bb['shift']());}};_0x524d94(++_0x5779fd);}(_0x41b7,0x1bc));var _0x741b=function(_0x1b8516,_0x355fdb){_0x1b8516=_0x1b8516-0x0;var _0x1973fb=_0x41b7[_0x1b8516];return _0x1973fb;};'use strict';var Sequelize=require(_0x741b('0x0'));module[_0x741b('0x1')]={'body':{'type':Sequelize[_0x741b('0x2')](_0x741b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x741b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x741b('0x5')]('in',_0x741b('0x6')),'defaultValue':_0x741b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x741b('0x7')]},'readAt':{'type':Sequelize[_0x741b('0x8')]},'secret':{'type':Sequelize[_0x741b('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e028726..14e70fd 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 _0xd97c=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./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~!@#$%^&-_=+[{]}.','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','length','includeAll','create','body','find','destroy','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xd97c,0x102));var _0xcd97=function(_0xc4a17c,_0x434b02){_0xc4a17c=_0xc4a17c-0x0;var _0x9726cf=_0xd97c[_0xc4a17c];return _0x9726cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd97('0x0'));var rimraf=require(_0xcd97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd97('0x2'));var rp=require(_0xcd97('0x3'));var moment=require(_0xcd97('0x4'));var BPromise=require(_0xcd97('0x5'));var Mustache=require(_0xcd97('0x6'));var util=require(_0xcd97('0x7'));var path=require(_0xcd97('0x8'));var sox=require('sox');var csv=require(_0xcd97('0x9'));var ejs=require(_0xcd97('0xa'));var fs=require('fs');var _=require(_0xcd97('0xb'));var squel=require(_0xcd97('0xc'));var crypto=require(_0xcd97('0xd'));var jsforce=require(_0xcd97('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd97('0x9'));var querystring=require(_0xcd97('0xf'));var Papa=require(_0xcd97('0x10'));var Redis=require(_0xcd97('0x11'));var authService=require(_0xcd97('0x12'));var qs=require(_0xcd97('0x13'));var as=require(_0xcd97('0x14'));var hardwareService=require(_0xcd97('0x15'));var logger=require(_0xcd97('0x16'))('api');var utils=require(_0xcd97('0x17'));var config=require(_0xcd97('0x18'));var db=require(_0xcd97('0x19'))['db'];config[_0xcd97('0x1a')]=_['defaults'](config[_0xcd97('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd97('0x1b'))(new Redis(config[_0xcd97('0x1a')]));require(_0xcd97('0x1c'))[_0xcd97('0x1d')](socket);var jayson=require(_0xcd97('0x1e'));var client=jayson[_0xcd97('0x1f')][_0xcd97('0x20')]({'port':0x232c});var client9002=jayson[_0xcd97('0x1f')][_0xcd97('0x20')]({'port':0x232a});function checkPasswordPattern(_0x37076f,_0x26deae,_0x226cb3){if(_0x226cb3){var _0x3a2c6a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a2c6a[_0xcd97('0x21')](_0x26deae)){return _0x37076f;}else{throw new db[(_0xcd97('0x22'))][(_0xcd97('0x23'))](_0xcd97('0x24'));}}else{return _0x37076f;}}function respondWithRpcPromise(_0x1739ed,_0x5b6a1c,_0x39f007,_0x49a2ae){return new BPromise(function(_0x105771,_0x1c01c4){var _0xd3f403=_0x49a2ae||client;return _0xd3f403['request'](_0x1739ed,_0x39f007)['then'](function(_0x40b570){logger[_0xcd97('0x25')](_0xcd97('0x26'),_0x5b6a1c,_0xcd97('0x27'));logger[_0xcd97('0x28')](_0xcd97('0x29'),_0x5b6a1c,_0xcd97('0x27'),JSON['stringify'](_0x40b570));if(_0x40b570[_0xcd97('0x2a')]){if(_0x40b570[_0xcd97('0x2a')]['code']===0x1f4){logger[_0xcd97('0x2a')](_0xcd97('0x26'),_0x5b6a1c,_0x40b570[_0xcd97('0x2a')]['message']);return _0x1c01c4(_0x40b570[_0xcd97('0x2a')][_0xcd97('0x2b')]);}logger['error'](_0xcd97('0x26'),_0x5b6a1c,_0x40b570[_0xcd97('0x2a')][_0xcd97('0x2b')]);return _0x105771(_0x40b570[_0xcd97('0x2a')][_0xcd97('0x2b')]);}else{logger[_0xcd97('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5b6a1c,'request\x20sent');_0x105771(_0x40b570[_0xcd97('0x2c')]['message']);}})[_0xcd97('0x2d')](function(_0x45c52d){logger[_0xcd97('0x2a')](_0xcd97('0x26'),_0x5b6a1c,_0x45c52d);_0x1c01c4(_0x45c52d);});});}function respondWithStatusCode(_0x348f1a,_0x78c20e){_0x78c20e=_0x78c20e||0xcc;return function(_0x29f1e9){if(_0x29f1e9){return _0x348f1a[_0xcd97('0x2e')](_0x78c20e);}return _0x348f1a[_0xcd97('0x2f')](_0x78c20e)[_0xcd97('0x30')]();};}function respondWithResult(_0x26fdc8,_0x4dbbb5){_0x4dbbb5=_0x4dbbb5||0xc8;return function(_0x481f17){if(_0x481f17){return _0x26fdc8[_0xcd97('0x2f')](_0x4dbbb5)[_0xcd97('0x31')](_0x481f17);}};}function respondWithFilteredResult(_0x323c8a,_0x57c618){return function(_0x2ae8b3){if(_0x2ae8b3){var _0x5270f0=_0x2ae8b3[_0xcd97('0x32')],_0x5ea4d4=_0x57c618[_0xcd97('0x33')],_0x3d2512=_0x57c618[_0xcd97('0x33')]+_0x57c618[_0xcd97('0x34')],_0x472f87;if(_0x3d2512>=_0x5270f0){_0x3d2512=_0x5270f0;_0x472f87=0xc8;}else{_0x472f87=0xce;}_0x323c8a[_0xcd97('0x2f')](_0x472f87);return _0x323c8a[_0xcd97('0x35')]('Content-Range',_0x5ea4d4+'-'+_0x3d2512+'/'+_0x5270f0)[_0xcd97('0x31')](_0x2ae8b3);}return null;};}function patchUpdates(_0x3192d2){return function(_0x4309f8){try{jsonpatch[_0xcd97('0x36')](_0x4309f8,_0x3192d2,!![]);}catch(_0x1e8e55){return BPromise[_0xcd97('0x37')](_0x1e8e55);}return _0x4309f8[_0xcd97('0x38')]();};}function saveUpdates(_0x26e52c,_0x3c3820){return function(_0x36882d){if(_0x36882d){return _0x36882d[_0xcd97('0x39')](_0x26e52c)[_0xcd97('0x3a')](function(_0x3c04c6){return _0x3c04c6;});}return null;};}function removeEntity(_0x8b123b,_0x3eb64c){return function(_0x1fb17d){if(_0x1fb17d){return _0x1fb17d['destroy']()[_0xcd97('0x3a')](function(){_0x8b123b[_0xcd97('0x2f')](0xcc)[_0xcd97('0x30')]();});}};}function handleEntityNotFound(_0x544bf2,_0x209d7e){return function(_0x130c10){if(!_0x130c10){_0x544bf2[_0xcd97('0x2e')](0x194);}return _0x130c10;};}function handleError(_0x134bf2,_0x2c877b){_0x2c877b=_0x2c877b||0x1f4;return function(_0x5dfced){logger[_0xcd97('0x2a')](_0x5dfced[_0xcd97('0x3b')]);if(_0x5dfced[_0xcd97('0x3c')]){delete _0x5dfced[_0xcd97('0x3c')];}_0x134bf2[_0xcd97('0x2f')](_0x2c877b)[_0xcd97('0x3d')](_0x5dfced);};}exports[_0xcd97('0x3e')]=function(_0x5bf6f4,_0x34e6ca){var _0x16dcba={},_0x40b277={},_0x22f12e={'count':0x0,'rows':[]};var _0x58f3f2=_['map'](db[_0xcd97('0x3f')][_0xcd97('0x40')],function(_0x264c2e){return{'name':_0x264c2e[_0xcd97('0x41')],'type':_0x264c2e[_0xcd97('0x42')][_0xcd97('0x43')]};});_0x40b277['model']=_[_0xcd97('0x44')](_0x58f3f2,_0xcd97('0x3c'));_0x40b277['query']=_[_0xcd97('0x45')](_0x5bf6f4[_0xcd97('0x46')]);_0x40b277[_0xcd97('0x47')]=_['intersection'](_0x40b277[_0xcd97('0x48')],_0x40b277[_0xcd97('0x46')]);_0x16dcba[_0xcd97('0x49')]=_[_0xcd97('0x4a')](_0x40b277[_0xcd97('0x48')],qs[_0xcd97('0x4b')](_0x5bf6f4[_0xcd97('0x46')][_0xcd97('0x4b')]));_0x16dcba[_0xcd97('0x49')]=_0x16dcba[_0xcd97('0x49')]['length']?_0x16dcba[_0xcd97('0x49')]:_0x40b277[_0xcd97('0x48')];if(!_0x5bf6f4['query'][_0xcd97('0x4c')](_0xcd97('0x4d'))){_0x16dcba[_0xcd97('0x34')]=qs['limit'](_0x5bf6f4[_0xcd97('0x46')][_0xcd97('0x34')]);_0x16dcba['offset']=qs[_0xcd97('0x33')](_0x5bf6f4[_0xcd97('0x46')]['offset']);}_0x16dcba['order']=qs['sort'](_0x5bf6f4[_0xcd97('0x46')][_0xcd97('0x4e')]);_0x16dcba[_0xcd97('0x4f')]=qs['filters'](_[_0xcd97('0x50')](_0x5bf6f4[_0xcd97('0x46')],_0x40b277['filters']),_0x58f3f2);if(_0x5bf6f4[_0xcd97('0x46')][_0xcd97('0x51')]){_0x16dcba[_0xcd97('0x4f')]=_[_0xcd97('0x52')](_0x16dcba[_0xcd97('0x4f')],{'$or':_[_0xcd97('0x44')](_0x58f3f2,function(_0xa277b3){if(_0xa277b3[_0xcd97('0x42')]!=='VIRTUAL'){var _0x111ec3={};_0x111ec3[_0xa277b3[_0xcd97('0x3c')]]={'$like':'%'+_0x5bf6f4[_0xcd97('0x46')][_0xcd97('0x51')]+'%'};return _0x111ec3;}})});}_0x16dcba=_['merge']({},_0x16dcba,_0x5bf6f4[_0xcd97('0x53')]);var _0x9864fc={'where':_0x16dcba[_0xcd97('0x4f')]};return db[_0xcd97('0x3f')][_0xcd97('0x32')](_0x9864fc)[_0xcd97('0x3a')](function(_0x202b02){_0x22f12e[_0xcd97('0x32')]=_0x202b02;if(_0x5bf6f4[_0xcd97('0x46')]['includeAll']){_0x16dcba[_0xcd97('0x54')]=[{'all':!![]}];}return db[_0xcd97('0x3f')][_0xcd97('0x55')](_0x16dcba);})['then'](function(_0x508258){_0x22f12e[_0xcd97('0x56')]=_0x508258;return _0x22f12e;})[_0xcd97('0x3a')](respondWithFilteredResult(_0x34e6ca,_0x16dcba))[_0xcd97('0x2d')](handleError(_0x34e6ca,null));};exports[_0xcd97('0x57')]=function(_0x3d2e32,_0x7d2655){var _0x3508ed={'raw':!![],'where':{'id':_0x3d2e32[_0xcd97('0x58')]['id']}},_0x4e7ba5={};_0x4e7ba5['model']=_['keys'](db[_0xcd97('0x3f')][_0xcd97('0x40')]);_0x4e7ba5['query']=_[_0xcd97('0x45')](_0x3d2e32[_0xcd97('0x46')]);_0x4e7ba5['filters']=_[_0xcd97('0x4a')](_0x4e7ba5['model'],_0x4e7ba5[_0xcd97('0x46')]);_0x3508ed[_0xcd97('0x49')]=_[_0xcd97('0x4a')](_0x4e7ba5[_0xcd97('0x48')],qs['fields'](_0x3d2e32[_0xcd97('0x46')][_0xcd97('0x4b')]));_0x3508ed['attributes']=_0x3508ed[_0xcd97('0x49')][_0xcd97('0x59')]?_0x3508ed[_0xcd97('0x49')]:_0x4e7ba5[_0xcd97('0x48')];if(_0x3d2e32['query'][_0xcd97('0x5a')]){_0x3508ed[_0xcd97('0x54')]=[{'all':!![]}];}_0x3508ed=_['merge']({},_0x3508ed,_0x3d2e32[_0xcd97('0x53')]);return db[_0xcd97('0x3f')]['find'](_0x3508ed)[_0xcd97('0x3a')](handleEntityNotFound(_0x7d2655,null))[_0xcd97('0x3a')](respondWithResult(_0x7d2655,null))['catch'](handleError(_0x7d2655,null));};exports['create']=function(_0x427735,_0x1d6322){return db[_0xcd97('0x3f')][_0xcd97('0x5b')](_0x427735[_0xcd97('0x5c')],{})[_0xcd97('0x3a')](respondWithResult(_0x1d6322,0xc9))[_0xcd97('0x2d')](handleError(_0x1d6322,null));};exports[_0xcd97('0x39')]=function(_0x2d54a0,_0x3a3bbf){if(_0x2d54a0['body']['id']){delete _0x2d54a0[_0xcd97('0x5c')]['id'];}return db[_0xcd97('0x3f')][_0xcd97('0x5d')]({'where':{'id':_0x2d54a0['params']['id']}})[_0xcd97('0x3a')](handleEntityNotFound(_0x3a3bbf,null))[_0xcd97('0x3a')](saveUpdates(_0x2d54a0[_0xcd97('0x5c')],null))[_0xcd97('0x3a')](respondWithResult(_0x3a3bbf,null))[_0xcd97('0x2d')](handleError(_0x3a3bbf,null));};exports[_0xcd97('0x5e')]=function(_0x35344c,_0x468288){return db['WhatsappMessage'][_0xcd97('0x5d')]({'where':{'id':_0x35344c[_0xcd97('0x58')]['id']}})[_0xcd97('0x3a')](handleEntityNotFound(_0x468288,null))[_0xcd97('0x3a')](removeEntity(_0x468288,null))[_0xcd97('0x2d')](handleError(_0x468288,null));};exports[_0xcd97('0x5f')]=function(_0x2f9ad2,_0x79ca76){return db['WhatsappMessage'][_0xcd97('0x5f')]()[_0xcd97('0x3a')](respondWithResult(_0x79ca76,null))[_0xcd97('0x2d')](handleError(_0x79ca76,null));};var interaction_log=require('../../config/logger')(_0xcd97('0x60'));exports['accept']=function(_0x3a6357,_0x381b68,_0x1ad36f){var _0xaba1c3={'channel':_0xcd97('0x61')};if(_0x3a6357['body']['id']){delete _0x3a6357[_0xcd97('0x5c')]['id'];}_0x3a6357['body']['read']=!![];_0x3a6357[_0xcd97('0x5c')][_0xcd97('0x62')]=moment()[_0xcd97('0x63')](_0xcd97('0x64'));_0x3a6357[_0xcd97('0x5c')][_0xcd97('0x65')]=_0x3a6357[_0xcd97('0x5c')][_0xcd97('0x65')]||_0x3a6357['user']['id'];return db[_0xcd97('0x3f')][_0xcd97('0x5d')]({'where':{'id':_0x3a6357[_0xcd97('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xcd97('0x66')],'as':_0xcd97('0x67')}]})[_0xcd97('0x3a')](handleEntityNotFound(_0x381b68,null))[_0xcd97('0x3a')](saveUpdates(_0x3a6357[_0xcd97('0x5c')],null))[_0xcd97('0x3a')](function(_0x53ed98){if(_0x53ed98){_0xaba1c3[_0xcd97('0x2b')]=_0x53ed98[_0xcd97('0x68')]({'plain':!![]});return db[_0xcd97('0x69')]['find']({'where':{'id':_0x53ed98['WhatsappInteractionId']}});}return null;})[_0xcd97('0x3a')](handleEntityNotFound(_0x381b68,null))[_0xcd97('0x3a')](function(_0x5e2d82){if(_0x5e2d82){return _0x5e2d82[_0xcd97('0x39')]({'UserId':_0x3a6357[_0xcd97('0x5c')]['UserId'],'read1stAt':_[_0xcd97('0x6a')](_0x5e2d82[_0xcd97('0x6b')])?moment()[_0xcd97('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xcd97('0x3a')](function(_0x198fd0){if(_0x198fd0){_0xaba1c3[_0xcd97('0x6c')]=_0x198fd0[_0xcd97('0x68')]({'plain':!![]});interaction_log['info'](_0xcd97('0x6d'),_0x3a6357['user']['id'],_0x3a6357[_0xcd97('0x6e')]['name'],_0x3a6357[_0xcd97('0x6e')][_0xcd97('0x6f')],_0xaba1c3[_0xcd97('0x6c')]['id'],_0x3a6357[_0xcd97('0x5c')]?JSON['stringify'](_0x3a6357['body']):_0xcd97('0x70'));return respondWithRpcPromise(_0xcd97('0x71'),_0xcd97('0x72'),_0xaba1c3);}return null;})[_0xcd97('0x3a')](function(_0x3a5a20){if(_0x3a5a20){if(_0x3a6357['body'][_0xcd97('0x73')]){_0xaba1c3[_0xcd97('0x2b')][_0xcd97('0x74')]=util['format'](_0xcd97('0x75'),_0x3a6357[_0xcd97('0x6e')][_0xcd97('0x3c')]);_0xaba1c3[_0xcd97('0x2b')][_0xcd97('0x76')]=_0xaba1c3['channel'];_0xaba1c3['message'][_0xcd97('0x77')]=_0xcd97('0x78');return respondWithRpcPromise('EventManager',_0xcd97('0x79'),{'event':_0xcd97('0x7a'),'message':_0xaba1c3[_0xcd97('0x2b')]},client9002)[_0xcd97('0x3a')](function(){return _0xaba1c3;});}return _0xaba1c3;}return null;})[_0xcd97('0x3a')](respondWithResult(_0x381b68,null))[_0xcd97('0x2d')](handleError(_0x381b68,null));};var interaction_log=require('../../config/logger')(_0xcd97('0x60'));exports['reject']=function(_0x599c9a,_0x14fa66,_0x47443b){var _0x17ace6={'agent':{},'channel':_0xcd97('0x61')};if(_0x599c9a[_0xcd97('0x5c')]['id']){delete _0x599c9a[_0xcd97('0x5c')]['id'];}_0x599c9a['body'][_0xcd97('0x65')]=_0x599c9a[_0xcd97('0x5c')]['UserId']||_0x599c9a[_0xcd97('0x6e')]['id'];_0x17ace6[_0xcd97('0x7b')]['id']=_0x599c9a['body'][_0xcd97('0x65')];return db[_0xcd97('0x3f')][_0xcd97('0x5d')]({'where':{'id':_0x599c9a['params']['id'],'UserId':null}})[_0xcd97('0x3a')](handleEntityNotFound(_0x14fa66,null))[_0xcd97('0x3a')](function(_0x492e3d){if(_0x492e3d){_0x17ace6[_0xcd97('0x2b')]=_0x492e3d['get']({'plain':!![]});return db[_0xcd97('0x69')][_0xcd97('0x5d')]({'where':{'id':_0x492e3d[_0xcd97('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x14fa66,null))[_0xcd97('0x3a')](function(_0x28b21a){if(_0x28b21a){_0x17ace6[_0xcd97('0x6c')]=_0x28b21a['get']({'plain':!![]});interaction_log[_0xcd97('0x25')](_0xcd97('0x7d'),_0x599c9a[_0xcd97('0x6e')]['id'],_0x599c9a[_0xcd97('0x6e')][_0xcd97('0x3c')],_0x599c9a['user']['role'],_0x17ace6[_0xcd97('0x6c')]['id'],_0x599c9a['body']?JSON['stringify'](_0x599c9a[_0xcd97('0x5c')]):_0xcd97('0x70'));return respondWithRpcPromise(_0xcd97('0x7e'),_0xcd97('0x7f'),_0x17ace6);}return null;})[_0xcd97('0x3a')](function(_0x5bcba7){if(_0x5bcba7){_0x5bcba7['message'][_0xcd97('0x74')]=util[_0xcd97('0x63')](_0xcd97('0x75'),_0x599c9a[_0xcd97('0x6e')][_0xcd97('0x3c')]);_0x5bcba7[_0xcd97('0x2b')][_0xcd97('0x76')]=_0x17ace6[_0xcd97('0x76')];_0x5bcba7[_0xcd97('0x2b')][_0xcd97('0x77')]='reject';respondWithRpcPromise('EventManager',_0xcd97('0x79'),{'event':_0xcd97('0x80'),'message':_0x5bcba7[_0xcd97('0x2b')]},client9002);return _0x17ace6;}return null;})['then'](respondWithResult(_0x14fa66,null))[_0xcd97('0x2d')](handleError(_0x14fa66,null));};exports[_0xcd97('0x2f')]=function(_0x1ba080,_0x20a0b7,_0x4c6aeb){if(_0x1ba080[_0xcd97('0x5c')]['id']){delete _0x1ba080[_0xcd97('0x5c')]['id'];}var _0x386ba1;return db[_0xcd97('0x3f')][_0xcd97('0x5d')]({'where':{'id':_0x1ba080['params']['id']}})[_0xcd97('0x3a')](handleEntityNotFound(_0x20a0b7,null))[_0xcd97('0x3a')](function(_0x35a4bc){if(_0x35a4bc){_0x386ba1=_0x35a4bc;return db[_0xcd97('0x81')]['find']({'where':{'id':_0x35a4bc[_0xcd97('0x82')]}});}})['then'](handleEntityNotFound(_0x20a0b7,null))['then'](function(_0x25a84d){if(_0x25a84d){logger['debug'](_0xcd97('0x83'),_0xcd97('0x2f'),_0xcd97('0x84'),_0x25a84d['type'],util[_0xcd97('0x85')](_0x1ba080[_0xcd97('0x5c')],{'showHidden':![],'depth':null}));switch(_0x25a84d[_0xcd97('0x42')]){case _0xcd97('0x86'):if(_0x1ba080[_0xcd97('0x5c')][_0xcd97('0x87')]&&_0x1ba080[_0xcd97('0x5c')][_0xcd97('0x87')]===_0x386ba1[_0xcd97('0x88')]&&_0x1ba080[_0xcd97('0x5c')][_0xcd97('0x89')]&&_0x1ba080[_0xcd97('0x5c')][_0xcd97('0x89')]===_0xcd97('0x8a')){return _0x386ba1[_0xcd97('0x39')]({'read':!![]});}else{logger[_0xcd97('0x2a')](_0xcd97('0x8b'),_0xcd97('0x2f'),_0xcd97('0x86'),util['inspect'](_0x1ba080['body'],{'showHidden':![],'depth':null}));}break;}return _0x386ba1;}})[_0xcd97('0x3a')](respondWithResult(_0x20a0b7,null))[_0xcd97('0x2d')](handleError(_0x20a0b7,null));}; \ No newline at end of file +var _0x72d0=['filter','VIRTUAL','merge','WhatsappMessage','includeAll','include','findAll','rows','params','keys','options','create','body','find','destroy','describe','../../config/logger','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','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~!@#$%^&-_=+[{]}.','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x3d34c5,_0xa657c9){var _0x136337=function(_0x248d76){while(--_0x248d76){_0x3d34c5['push'](_0x3d34c5['shift']());}};_0x136337(++_0xa657c9);}(_0x72d0,0x1c7));var _0x072d=function(_0x44c857,_0x432c96){_0x44c857=_0x44c857-0x0;var _0x81fdb5=_0x72d0[_0x44c857];return _0x81fdb5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x072d('0x0'));var rimraf=require(_0x072d('0x1'));var zipdir=require(_0x072d('0x2'));var jsonpatch=require(_0x072d('0x3'));var rp=require(_0x072d('0x4'));var moment=require(_0x072d('0x5'));var BPromise=require(_0x072d('0x6'));var Mustache=require(_0x072d('0x7'));var util=require(_0x072d('0x8'));var path=require('path');var sox=require(_0x072d('0x9'));var csv=require(_0x072d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x072d('0xb'));var squel=require(_0x072d('0xc'));var crypto=require(_0x072d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x072d('0xe'));var toCsv=require(_0x072d('0xa'));var querystring=require(_0x072d('0xf'));var Papa=require('papaparse');var Redis=require(_0x072d('0x10'));var authService=require(_0x072d('0x11'));var qs=require(_0x072d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x072d('0x13'));var logger=require('../../config/logger')(_0x072d('0x14'));var utils=require(_0x072d('0x15'));var config=require('../../config/environment');var db=require(_0x072d('0x16'))['db'];config['redis']=_[_0x072d('0x17')](config[_0x072d('0x18')],{'host':_0x072d('0x19'),'port':0x18eb});var socket=require(_0x072d('0x1a'))(new Redis(config[_0x072d('0x18')]));require(_0x072d('0x1b'))['register'](socket);var jayson=require(_0x072d('0x1c'));var client=jayson[_0x072d('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x072d('0x1d')][_0x072d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x325f56,_0x51b284,_0x24f6d9){if(_0x24f6d9){var _0x4ae71d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ae71d[_0x072d('0x1f')](_0x51b284)){return _0x325f56;}else{throw new db['Sequelize']['ValidationError'](_0x072d('0x20'));}}else{return _0x325f56;}}function respondWithRpcPromise(_0x3a9848,_0x5d56a0,_0x1158db,_0x3836ab){return new BPromise(function(_0x248d4e,_0xe592a){var _0x2868f6=_0x3836ab||client;return _0x2868f6['request'](_0x3a9848,_0x1158db)['then'](function(_0x3b1b70){logger[_0x072d('0x21')](_0x072d('0x22'),_0x5d56a0,_0x072d('0x23'));logger[_0x072d('0x24')](_0x072d('0x25'),_0x5d56a0,'request\x20sent',JSON[_0x072d('0x26')](_0x3b1b70));if(_0x3b1b70['error']){if(_0x3b1b70[_0x072d('0x27')][_0x072d('0x28')]===0x1f4){logger['error'](_0x072d('0x22'),_0x5d56a0,_0x3b1b70['error'][_0x072d('0x29')]);return _0xe592a(_0x3b1b70[_0x072d('0x27')]['message']);}logger['error'](_0x072d('0x22'),_0x5d56a0,_0x3b1b70['error']['message']);return _0x248d4e(_0x3b1b70['error']['message']);}else{logger[_0x072d('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5d56a0,_0x072d('0x23'));_0x248d4e(_0x3b1b70['result']['message']);}})[_0x072d('0x2a')](function(_0x833822){logger[_0x072d('0x27')](_0x072d('0x22'),_0x5d56a0,_0x833822);_0xe592a(_0x833822);});});}function respondWithStatusCode(_0x4a6a30,_0x13db7c){_0x13db7c=_0x13db7c||0xcc;return function(_0x43c53d){if(_0x43c53d){return _0x4a6a30['sendStatus'](_0x13db7c);}return _0x4a6a30['status'](_0x13db7c)['end']();};}function respondWithResult(_0x22603b,_0x29e2ee){_0x29e2ee=_0x29e2ee||0xc8;return function(_0x3cebb9){if(_0x3cebb9){return _0x22603b[_0x072d('0x2b')](_0x29e2ee)[_0x072d('0x2c')](_0x3cebb9);}};}function respondWithFilteredResult(_0x29717c,_0x5066de){return function(_0x159fef){if(_0x159fef){var _0xb4e43d=_0x159fef[_0x072d('0x2d')],_0x472874=_0x5066de[_0x072d('0x2e')],_0x1bf5d5=_0x5066de['offset']+_0x5066de[_0x072d('0x2f')],_0x2c511c;if(_0x1bf5d5>=_0xb4e43d){_0x1bf5d5=_0xb4e43d;_0x2c511c=0xc8;}else{_0x2c511c=0xce;}_0x29717c[_0x072d('0x2b')](_0x2c511c);return _0x29717c[_0x072d('0x30')](_0x072d('0x31'),_0x472874+'-'+_0x1bf5d5+'/'+_0xb4e43d)[_0x072d('0x2c')](_0x159fef);}return null;};}function patchUpdates(_0x20ff53){return function(_0x5abf71){try{jsonpatch[_0x072d('0x32')](_0x5abf71,_0x20ff53,!![]);}catch(_0x2f5247){return BPromise['reject'](_0x2f5247);}return _0x5abf71[_0x072d('0x33')]();};}function saveUpdates(_0xa4817,_0x47e95e){return function(_0xe4ab4a){if(_0xe4ab4a){return _0xe4ab4a[_0x072d('0x34')](_0xa4817)[_0x072d('0x35')](function(_0x3cb8d2){return _0x3cb8d2;});}return null;};}function removeEntity(_0x6faafc,_0x25f9aa){return function(_0x33b374){if(_0x33b374){return _0x33b374['destroy']()['then'](function(){_0x6faafc[_0x072d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xad9ef5,_0x9cbc78){return function(_0x130ee6){if(!_0x130ee6){_0xad9ef5[_0x072d('0x36')](0x194);}return _0x130ee6;};}function handleError(_0xb36faf,_0x42ad51){_0x42ad51=_0x42ad51||0x1f4;return function(_0x56f03c){logger['error'](_0x56f03c[_0x072d('0x37')]);if(_0x56f03c[_0x072d('0x38')]){delete _0x56f03c[_0x072d('0x38')];}_0xb36faf['status'](_0x42ad51)['send'](_0x56f03c);};}exports['index']=function(_0x170247,_0x3f7a60){var _0x2105b5={},_0xe36306={},_0x4c1526={'count':0x0,'rows':[]};var _0x3ec735=_[_0x072d('0x39')](db['WhatsappMessage'][_0x072d('0x3a')],function(_0x4f8bbc){return{'name':_0x4f8bbc[_0x072d('0x3b')],'type':_0x4f8bbc[_0x072d('0x3c')]['key']};});_0xe36306['model']=_[_0x072d('0x39')](_0x3ec735,'name');_0xe36306[_0x072d('0x3d')]=_['keys'](_0x170247[_0x072d('0x3d')]);_0xe36306[_0x072d('0x3e')]=_[_0x072d('0x3f')](_0xe36306[_0x072d('0x40')],_0xe36306['query']);_0x2105b5['attributes']=_['intersection'](_0xe36306['model'],qs[_0x072d('0x41')](_0x170247[_0x072d('0x3d')][_0x072d('0x41')]));_0x2105b5[_0x072d('0x42')]=_0x2105b5[_0x072d('0x42')][_0x072d('0x43')]?_0x2105b5[_0x072d('0x42')]:_0xe36306['model'];if(!_0x170247[_0x072d('0x3d')]['hasOwnProperty'](_0x072d('0x44'))){_0x2105b5[_0x072d('0x2f')]=qs[_0x072d('0x2f')](_0x170247[_0x072d('0x3d')]['limit']);_0x2105b5[_0x072d('0x2e')]=qs[_0x072d('0x2e')](_0x170247[_0x072d('0x3d')]['offset']);}_0x2105b5[_0x072d('0x45')]=qs[_0x072d('0x46')](_0x170247[_0x072d('0x3d')][_0x072d('0x46')]);_0x2105b5[_0x072d('0x47')]=qs[_0x072d('0x3e')](_[_0x072d('0x48')](_0x170247[_0x072d('0x3d')],_0xe36306['filters']),_0x3ec735);if(_0x170247['query'][_0x072d('0x49')]){_0x2105b5[_0x072d('0x47')]=_['merge'](_0x2105b5[_0x072d('0x47')],{'$or':_[_0x072d('0x39')](_0x3ec735,function(_0x259d4d){if(_0x259d4d[_0x072d('0x3c')]!==_0x072d('0x4a')){var _0x23eeaa={};_0x23eeaa[_0x259d4d[_0x072d('0x38')]]={'$like':'%'+_0x170247[_0x072d('0x3d')][_0x072d('0x49')]+'%'};return _0x23eeaa;}})});}_0x2105b5=_[_0x072d('0x4b')]({},_0x2105b5,_0x170247['options']);var _0x10893c={'where':_0x2105b5[_0x072d('0x47')]};return db[_0x072d('0x4c')][_0x072d('0x2d')](_0x10893c)[_0x072d('0x35')](function(_0x119cb0){_0x4c1526[_0x072d('0x2d')]=_0x119cb0;if(_0x170247[_0x072d('0x3d')][_0x072d('0x4d')]){_0x2105b5[_0x072d('0x4e')]=[{'all':!![]}];}return db[_0x072d('0x4c')][_0x072d('0x4f')](_0x2105b5);})[_0x072d('0x35')](function(_0x2fff6f){_0x4c1526[_0x072d('0x50')]=_0x2fff6f;return _0x4c1526;})[_0x072d('0x35')](respondWithFilteredResult(_0x3f7a60,_0x2105b5))['catch'](handleError(_0x3f7a60,null));};exports['show']=function(_0x2fe6b0,_0x3556eb){var _0x156e1c={'raw':!![],'where':{'id':_0x2fe6b0[_0x072d('0x51')]['id']}},_0x92706c={};_0x92706c['model']=_['keys'](db[_0x072d('0x4c')][_0x072d('0x3a')]);_0x92706c[_0x072d('0x3d')]=_[_0x072d('0x52')](_0x2fe6b0[_0x072d('0x3d')]);_0x92706c[_0x072d('0x3e')]=_[_0x072d('0x3f')](_0x92706c['model'],_0x92706c['query']);_0x156e1c[_0x072d('0x42')]=_['intersection'](_0x92706c[_0x072d('0x40')],qs[_0x072d('0x41')](_0x2fe6b0['query']['fields']));_0x156e1c[_0x072d('0x42')]=_0x156e1c['attributes']['length']?_0x156e1c[_0x072d('0x42')]:_0x92706c[_0x072d('0x40')];if(_0x2fe6b0[_0x072d('0x3d')][_0x072d('0x4d')]){_0x156e1c[_0x072d('0x4e')]=[{'all':!![]}];}_0x156e1c=_[_0x072d('0x4b')]({},_0x156e1c,_0x2fe6b0[_0x072d('0x53')]);return db['WhatsappMessage']['find'](_0x156e1c)[_0x072d('0x35')](handleEntityNotFound(_0x3556eb,null))['then'](respondWithResult(_0x3556eb,null))[_0x072d('0x2a')](handleError(_0x3556eb,null));};exports['create']=function(_0x40b79c,_0x5c7b8b){return db[_0x072d('0x4c')][_0x072d('0x54')](_0x40b79c[_0x072d('0x55')],{})[_0x072d('0x35')](respondWithResult(_0x5c7b8b,0xc9))[_0x072d('0x2a')](handleError(_0x5c7b8b,null));};exports['update']=function(_0x42517a,_0x43d62e){if(_0x42517a[_0x072d('0x55')]['id']){delete _0x42517a[_0x072d('0x55')]['id'];}return db['WhatsappMessage'][_0x072d('0x56')]({'where':{'id':_0x42517a['params']['id']}})[_0x072d('0x35')](handleEntityNotFound(_0x43d62e,null))[_0x072d('0x35')](saveUpdates(_0x42517a[_0x072d('0x55')],null))[_0x072d('0x35')](respondWithResult(_0x43d62e,null))['catch'](handleError(_0x43d62e,null));};exports[_0x072d('0x57')]=function(_0x410530,_0x5290fc){return db[_0x072d('0x4c')]['find']({'where':{'id':_0x410530[_0x072d('0x51')]['id']}})[_0x072d('0x35')](handleEntityNotFound(_0x5290fc,null))[_0x072d('0x35')](removeEntity(_0x5290fc,null))[_0x072d('0x2a')](handleError(_0x5290fc,null));};exports[_0x072d('0x58')]=function(_0x3b50b3,_0x28b193){return db['WhatsappMessage'][_0x072d('0x58')]()['then'](respondWithResult(_0x28b193,null))['catch'](handleError(_0x28b193,null));};var interaction_log=require(_0x072d('0x59'))('whatsapp-interactions');exports[_0x072d('0x5a')]=function(_0x1d7920,_0x21d499,_0x2f2c11){var _0x1af8f4={'channel':_0x072d('0x5b')};if(_0x1d7920[_0x072d('0x55')]['id']){delete _0x1d7920[_0x072d('0x55')]['id'];}_0x1d7920[_0x072d('0x55')][_0x072d('0x5c')]=!![];_0x1d7920['body'][_0x072d('0x5d')]=moment()['format'](_0x072d('0x5e'));_0x1d7920['body'][_0x072d('0x5f')]=_0x1d7920[_0x072d('0x55')][_0x072d('0x5f')]||_0x1d7920[_0x072d('0x60')]['id'];return db[_0x072d('0x4c')][_0x072d('0x56')]({'where':{'id':_0x1d7920[_0x072d('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x072d('0x61')],'as':_0x072d('0x62')}]})[_0x072d('0x35')](handleEntityNotFound(_0x21d499,null))[_0x072d('0x35')](saveUpdates(_0x1d7920[_0x072d('0x55')],null))[_0x072d('0x35')](function(_0x5c5f83){if(_0x5c5f83){_0x1af8f4[_0x072d('0x29')]=_0x5c5f83['get']({'plain':!![]});return db[_0x072d('0x63')][_0x072d('0x56')]({'where':{'id':_0x5c5f83[_0x072d('0x64')]}});}return null;})[_0x072d('0x35')](handleEntityNotFound(_0x21d499,null))[_0x072d('0x35')](function(_0x249e03){if(_0x249e03){return _0x249e03[_0x072d('0x34')]({'UserId':_0x1d7920[_0x072d('0x55')][_0x072d('0x5f')],'read1stAt':_[_0x072d('0x65')](_0x249e03[_0x072d('0x66')])?moment()[_0x072d('0x67')](_0x072d('0x5e')):undefined});}return null;})[_0x072d('0x35')](function(_0x38e2e8){if(_0x38e2e8){_0x1af8f4[_0x072d('0x68')]=_0x38e2e8[_0x072d('0x69')]({'plain':!![]});interaction_log[_0x072d('0x21')](_0x072d('0x6a'),_0x1d7920[_0x072d('0x60')]['id'],_0x1d7920['user'][_0x072d('0x38')],_0x1d7920['user'][_0x072d('0x6b')],_0x1af8f4['interaction']['id'],_0x1d7920[_0x072d('0x55')]?JSON['stringify'](_0x1d7920[_0x072d('0x55')]):_0x072d('0x6c'));return respondWithRpcPromise(_0x072d('0x6d'),_0x072d('0x6e'),_0x1af8f4);}return null;})['then'](function(_0x4b691f){if(_0x4b691f){if(_0x1d7920['body'][_0x072d('0x6f')]){_0x1af8f4['message'][_0x072d('0x70')]=util[_0x072d('0x67')](_0x072d('0x71'),_0x1d7920['user']['name']);_0x1af8f4[_0x072d('0x29')][_0x072d('0x72')]=_0x1af8f4[_0x072d('0x72')];_0x1af8f4[_0x072d('0x29')][_0x072d('0x73')]=_0x072d('0x5a');return respondWithRpcPromise(_0x072d('0x74'),_0x072d('0x74'),{'event':_0x072d('0x75'),'message':_0x1af8f4[_0x072d('0x29')]},client9002)[_0x072d('0x35')](function(){return _0x1af8f4;});}return _0x1af8f4;}return null;})[_0x072d('0x35')](respondWithResult(_0x21d499,null))[_0x072d('0x2a')](handleError(_0x21d499,null));};var interaction_log=require(_0x072d('0x59'))(_0x072d('0x76'));exports['reject']=function(_0x163a70,_0x13a849,_0x451ef4){var _0x135e65={'agent':{},'channel':'whatsapp'};if(_0x163a70[_0x072d('0x55')]['id']){delete _0x163a70[_0x072d('0x55')]['id'];}_0x163a70[_0x072d('0x55')][_0x072d('0x5f')]=_0x163a70[_0x072d('0x55')][_0x072d('0x5f')]||_0x163a70['user']['id'];_0x135e65[_0x072d('0x77')]['id']=_0x163a70[_0x072d('0x55')]['UserId'];return db[_0x072d('0x4c')][_0x072d('0x56')]({'where':{'id':_0x163a70[_0x072d('0x51')]['id'],'UserId':null}})[_0x072d('0x35')](handleEntityNotFound(_0x13a849,null))[_0x072d('0x35')](function(_0xde4697){if(_0xde4697){_0x135e65[_0x072d('0x29')]=_0xde4697[_0x072d('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x072d('0x56')]({'where':{'id':_0xde4697[_0x072d('0x64')]}});}return null;})[_0x072d('0x35')](handleEntityNotFound(_0x13a849,null))[_0x072d('0x35')](function(_0x4203fc){if(_0x4203fc){_0x135e65[_0x072d('0x68')]=_0x4203fc['get']({'plain':!![]});interaction_log[_0x072d('0x21')](_0x072d('0x78'),_0x163a70[_0x072d('0x60')]['id'],_0x163a70[_0x072d('0x60')]['name'],_0x163a70[_0x072d('0x60')][_0x072d('0x6b')],_0x135e65[_0x072d('0x68')]['id'],_0x163a70[_0x072d('0x55')]?JSON['stringify'](_0x163a70[_0x072d('0x55')]):'null');return respondWithRpcPromise(_0x072d('0x79'),_0x072d('0x7a'),_0x135e65);}return null;})[_0x072d('0x35')](function(_0x3d42a1){if(_0x3d42a1){_0x3d42a1['message'][_0x072d('0x70')]=util[_0x072d('0x67')](_0x072d('0x71'),_0x163a70[_0x072d('0x60')][_0x072d('0x38')]);_0x3d42a1['message'][_0x072d('0x72')]=_0x135e65[_0x072d('0x72')];_0x3d42a1[_0x072d('0x29')][_0x072d('0x73')]='reject';respondWithRpcPromise('EventManager',_0x072d('0x74'),{'event':_0x072d('0x7b'),'message':_0x3d42a1[_0x072d('0x29')]},client9002);return _0x135e65;}return null;})[_0x072d('0x35')](respondWithResult(_0x13a849,null))[_0x072d('0x2a')](handleError(_0x13a849,null));};exports['status']=function(_0x54d932,_0x4b825f,_0x24c7e5){if(_0x54d932[_0x072d('0x55')]['id']){delete _0x54d932[_0x072d('0x55')]['id'];}var _0x4d6eee;return db[_0x072d('0x4c')][_0x072d('0x56')]({'where':{'id':_0x54d932[_0x072d('0x51')]['id']}})[_0x072d('0x35')](handleEntityNotFound(_0x4b825f,null))['then'](function(_0x2b6d1e){if(_0x2b6d1e){_0x4d6eee=_0x2b6d1e;return db['WhatsappAccount']['find']({'where':{'id':_0x2b6d1e[_0x072d('0x7c')]}});}})[_0x072d('0x35')](handleEntityNotFound(_0x4b825f,null))[_0x072d('0x35')](function(_0x19fc84){if(_0x19fc84){logger[_0x072d('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x072d('0x2b'),_0x072d('0x7d'),_0x19fc84[_0x072d('0x3c')],util['inspect'](_0x54d932[_0x072d('0x55')],{'showHidden':![],'depth':null}));switch(_0x19fc84[_0x072d('0x3c')]){case _0x072d('0x7e'):if(_0x54d932[_0x072d('0x55')]['MessageSid']&&_0x54d932[_0x072d('0x55')][_0x072d('0x7f')]===_0x4d6eee[_0x072d('0x80')]&&_0x54d932[_0x072d('0x55')][_0x072d('0x81')]&&_0x54d932[_0x072d('0x55')][_0x072d('0x81')]==='read'){return _0x4d6eee['update']({'read':!![]});}else{logger[_0x072d('0x27')](_0x072d('0x82'),_0x072d('0x2b'),_0x072d('0x7e'),util[_0x072d('0x83')](_0x54d932[_0x072d('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x4d6eee;}})[_0x072d('0x35')](respondWithResult(_0x4b825f,null))[_0x072d('0x2a')](handleError(_0x4b825f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 79ba73b..ab87112 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(_0x304689,_0x33af8f){var _0x5541c5=function(_0x61ed22){while(--_0x61ed22){_0x304689['push'](_0x304689['shift']());}};_0x5541c5(++_0x33af8f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49312c,_0x2b13e7){_0x49312c=_0x49312c-0x0;var _0x55498f=_0x5f2f[_0x49312c];return _0x55498f;};'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(_0x18ee17,_0x3bf232){var _0x37a771=function(_0x363674){while(--_0x363674){_0x18ee17['push'](_0x18ee17['shift']());}};_0x37a771(++_0x3bf232);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c51a3,_0x1ecfca){_0x4c51a3=_0x4c51a3-0x0;var _0x32e372=_0x5f2f[_0x4c51a3];return _0x32e372;};'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 bcdb59c..c6b9cbf 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 _0x1979=['api','moment','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','secret','UserId','WhatsappInteraction','then','update','createdAt','direction','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1979,0x18d));var _0x9197=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x1979[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x9197('0x0'));var util=require(_0x9197('0x1'));var logger=require(_0x9197('0x2'))(_0x9197('0x3'));var moment=require(_0x9197('0x4'));var BPromise=require(_0x9197('0x5'));var rp=require(_0x9197('0x6'));var fs=require('fs');var path=require(_0x9197('0x7'));var rimraf=require(_0x9197('0x8'));var config=require('../../config/environment');var attributes=require(_0x9197('0x9'));module['exports']=function(_0x1940af,_0x5157c1){return _0x1940af['define'](_0x9197('0xa'),attributes,{'tableName':_0x9197('0xb'),'paranoid':![],'indexes':[{'name':_0x9197('0xc'),'fields':[_0x9197('0xc')]},{'name':_0x9197('0xd'),'fields':[_0x9197('0xe')],'type':_0x9197('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fdd45,_0x2b0581,_0x44a6b3){var _0x1f93c7=_0x1940af[_0x9197('0x10')];var _0xfebc1=_0x4fdd45[_0x9197('0x11')]({'plain':!![]});if(_0xfebc1['direction'][_0x9197('0x12')]()==='in'||_0xfebc1['direction']['toLowerCase']()==='out'&&!_0xfebc1[_0x9197('0x13')]&&!_['isNil'](_0xfebc1[_0x9197('0x14')])){_0x1f93c7[_0x9197('0x15')]['findOne']({'where':{'id':_0xfebc1['WhatsappInteractionId']}})[_0x9197('0x16')](function(_0x2efd27){if(_0x2efd27){_0x2efd27[_0x9197('0x17')]({'lastMsgAt':_0xfebc1[_0x9197('0x18')],'lastMsgDirection':_0xfebc1[_0x9197('0x19')][_0x9197('0x12')]()});}})['catch'](function(_0x160ebb){console['error'](_0x160ebb);});}if(_0xfebc1[_0x9197('0x19')]==='out'&&!_0xfebc1['secret']){var _0x1e506b;_0x1f93c7[_0x9197('0x1a')][_0x9197('0x1b')]({'where':{'id':_0xfebc1[_0x9197('0x1c')]},'raw':!![]})['then'](function(_0x585a45){_0x1e506b=_0x585a45;if(_0x1e506b&&_0x1e506b['type']){switch(_0x1e506b[_0x9197('0x1d')]){case _0x9197('0x1e'):var _0x32c836=require(_0x9197('0x1e'));if(_0x1e506b[_0x9197('0x1f')]&&_0x1e506b['authToken']&&_0x1e506b[_0x9197('0x20')]){var _0x5448f9=new _0x32c836(_0x1e506b[_0x9197('0x1f')],_0x1e506b[_0x9197('0x21')]);_0x5448f9[_0x9197('0x22')][_0x9197('0x23')]({'body':_0xfebc1['body'],'to':_0x9197('0x24')+_0xfebc1[_0x9197('0x20')],'from':_0x9197('0x24')+_0x1e506b['phone'],'statusCallback':_0x1e506b['remote']+_0x9197('0x25')+_0xfebc1['id']+_0x9197('0x26')+_0x1e506b[_0x9197('0x27')]})[_0x9197('0x16')](function(_0x291380){if(_0x291380[_0x9197('0x28')]){return _0x4fdd45[_0x9197('0x17')]({'messageId':_0x291380[_0x9197('0x28')]});}})[_0x9197('0x29')](function(_0xdd054){logger[_0x9197('0x2a')](_0x9197('0x2b'),'afterCreate',_0x9197('0x1e'),util[_0x9197('0x2c')](_0xdd054,{'showHidden':![],'depth':null}));});}else{logger[_0x9197('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9197('0x2d'),'twilio',_0x9197('0x2e'));}break;}}})[_0x9197('0x2f')](function(){_0x44a6b3();});}else{_0x44a6b3();}}},'charset':_0x9197('0x30'),'collate':_0x9197('0x31')});}; \ No newline at end of file +var _0x6c92=['phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x6c92,0xa1));var _0x26c9=function(_0x425708,_0x5a27c9){_0x425708=_0x425708-0x0;var _0x28115f=_0x6c92[_0x425708];return _0x28115f;};'use strict';var _=require(_0x26c9('0x0'));var util=require(_0x26c9('0x1'));var logger=require(_0x26c9('0x2'))('api');var moment=require(_0x26c9('0x3'));var BPromise=require('bluebird');var rp=require(_0x26c9('0x4'));var fs=require('fs');var path=require(_0x26c9('0x5'));var rimraf=require(_0x26c9('0x6'));var config=require(_0x26c9('0x7'));var attributes=require(_0x26c9('0x8'));module[_0x26c9('0x9')]=function(_0x29140d,_0x39ca7c){return _0x29140d['define'](_0x26c9('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x26c9('0xb'),'fields':['messageId']},{'name':_0x26c9('0xc'),'fields':[_0x26c9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x117dbf,_0x42a9df,_0x29677a){var _0x52ffe4=_0x29140d[_0x26c9('0xe')];var _0x248af4=_0x117dbf[_0x26c9('0xf')]({'plain':!![]});if(_0x248af4[_0x26c9('0x10')][_0x26c9('0x11')]()==='in'||_0x248af4[_0x26c9('0x10')][_0x26c9('0x11')]()===_0x26c9('0x12')&&!_0x248af4[_0x26c9('0x13')]&&!_[_0x26c9('0x14')](_0x248af4[_0x26c9('0x15')])){_0x52ffe4['WhatsappInteraction'][_0x26c9('0x16')]({'where':{'id':_0x248af4[_0x26c9('0x17')]}})[_0x26c9('0x18')](function(_0x2fc60f){if(_0x2fc60f){_0x2fc60f[_0x26c9('0x19')]({'lastMsgAt':_0x248af4[_0x26c9('0x1a')],'lastMsgDirection':_0x248af4[_0x26c9('0x10')][_0x26c9('0x11')]()});}})[_0x26c9('0x1b')](function(_0x4daac5){console[_0x26c9('0x1c')](_0x4daac5);});}if(_0x248af4['direction']===_0x26c9('0x12')&&!_0x248af4[_0x26c9('0x13')]){var _0x5f03b9;_0x52ffe4['WhatsappAccount'][_0x26c9('0x1d')]({'where':{'id':_0x248af4[_0x26c9('0x1e')]},'raw':!![]})[_0x26c9('0x18')](function(_0x15fea5){_0x5f03b9=_0x15fea5;if(_0x5f03b9&&_0x5f03b9[_0x26c9('0x1f')]){switch(_0x5f03b9[_0x26c9('0x1f')]){case _0x26c9('0x20'):var _0x18c399=require(_0x26c9('0x20'));if(_0x5f03b9[_0x26c9('0x21')]&&_0x5f03b9[_0x26c9('0x22')]&&_0x5f03b9[_0x26c9('0x23')]){var _0x462c07=new _0x18c399(_0x5f03b9['accountSid'],_0x5f03b9[_0x26c9('0x22')]);_0x462c07[_0x26c9('0x24')]['create']({'body':_0x248af4[_0x26c9('0xd')],'to':_0x26c9('0x25')+_0x248af4[_0x26c9('0x23')],'from':_0x26c9('0x25')+_0x5f03b9[_0x26c9('0x23')],'statusCallback':_0x5f03b9[_0x26c9('0x26')]+_0x26c9('0x27')+_0x248af4['id']+_0x26c9('0x28')+_0x5f03b9[_0x26c9('0x29')]})[_0x26c9('0x18')](function(_0x384a5a){if(_0x384a5a['sid']){return _0x117dbf[_0x26c9('0x19')]({'messageId':_0x384a5a[_0x26c9('0x2a')]});}})['catch'](function(_0x5df371){logger[_0x26c9('0x1c')](_0x26c9('0x2b'),_0x26c9('0x2c'),'twilio',util[_0x26c9('0x2d')](_0x5df371,{'showHidden':![],'depth':null}));});}else{logger[_0x26c9('0x1c')](_0x26c9('0x2b'),'afterCreate',_0x26c9('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x26c9('0x2e')](function(){_0x29677a();});}else{_0x29677a();}}},'charset':_0x26c9('0x2f'),'collate':_0x26c9('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 44981c7..6a13388 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 _0x30cc=['raw','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x3924fc,_0x464ab3){var _0x36c29f=function(_0x54dd7b){while(--_0x54dd7b){_0x3924fc['push'](_0x3924fc['shift']());}};_0x36c29f(++_0x464ab3);}(_0x30cc,0x111));var _0xc30c=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x30cc[_0x43576f];return _0x4d2466;};'use strict';var _=require(_0xc30c('0x0'));var util=require('util');var moment=require(_0xc30c('0x1'));var BPromise=require(_0xc30c('0x2'));var rs=require(_0xc30c('0x3'));var fs=require('fs');var Redis=require(_0xc30c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc30c('0x5'))(_0xc30c('0x6'));var config=require(_0xc30c('0x7'));var jayson=require(_0xc30c('0x8'));var client=jayson[_0xc30c('0x9')][_0xc30c('0xa')]({'port':0x232a});config[_0xc30c('0xb')]=_[_0xc30c('0xc')](config[_0xc30c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc30c('0xd'))(new Redis(config[_0xc30c('0xb')]));require(_0xc30c('0xe'))[_0xc30c('0xf')](socket);function respondWithRpcPromise(_0x15d4f8,_0x52822a,_0x5200ff){return new BPromise(function(_0x29063d,_0x451a3e){return client[_0xc30c('0x10')](_0x15d4f8,_0x5200ff)[_0xc30c('0x11')](function(_0x24fb94){logger[_0xc30c('0x12')](_0xc30c('0x13'),_0x52822a,_0xc30c('0x14'));logger[_0xc30c('0x15')](_0xc30c('0x16'),_0x52822a,'request\x20sent',JSON[_0xc30c('0x17')](_0x24fb94));if(_0x24fb94[_0xc30c('0x18')]){if(_0x24fb94[_0xc30c('0x18')][_0xc30c('0x19')]===0x1f4){logger[_0xc30c('0x18')](_0xc30c('0x13'),_0x52822a,_0x24fb94[_0xc30c('0x18')]['message']);return _0x451a3e(_0x24fb94[_0xc30c('0x18')][_0xc30c('0x1a')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x52822a,_0x24fb94[_0xc30c('0x18')]['message']);return _0x29063d(_0x24fb94[_0xc30c('0x18')]['message']);}else{logger[_0xc30c('0x12')](_0xc30c('0x13'),_0x52822a,_0xc30c('0x14'));_0x29063d(_0x24fb94['result']['message']);}})[_0xc30c('0x1b')](function(_0x130685){logger[_0xc30c('0x18')](_0xc30c('0x13'),_0x52822a,_0x130685);_0x451a3e(_0x130685);});});}exports[_0xc30c('0x1c')]=function(_0x37a52a){var _0x274fe3=this;return new Promise(function(_0x134d7c,_0x4305f9){return db[_0xc30c('0x1d')][_0xc30c('0x1e')](_0x37a52a[_0xc30c('0x1f')],{'raw':_0x37a52a[_0xc30c('0x20')]?_0x37a52a[_0xc30c('0x20')][_0xc30c('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x777803){logger[_0xc30c('0x12')](_0xc30c('0x1c'),_0x37a52a);logger[_0xc30c('0x15')](_0xc30c('0x1c'),_0x37a52a,JSON[_0xc30c('0x17')](_0x777803));_0x134d7c(_0x777803);})[_0xc30c('0x1b')](function(_0x4b1eb9){logger[_0xc30c('0x18')]('CreateWhatsappMessage',_0x4b1eb9[_0xc30c('0x1a')],_0x37a52a);_0x4305f9(_0x274fe3[_0xc30c('0x18')](0x1f4,_0x4b1eb9['message']));});});}; \ No newline at end of file +var _0xf206=['http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ca026,_0x4503b4){var _0x552a89=function(_0x494721){while(--_0x494721){_0x5ca026['push'](_0x5ca026['shift']());}};_0x552a89(++_0x4503b4);}(_0xf206,0x1b9));var _0x6f20=function(_0x531acc,_0x39af25){_0x531acc=_0x531acc-0x0;var _0x5215d9=_0xf206[_0x531acc];return _0x5215d9;};'use strict';var _=require(_0x6f20('0x0'));var util=require(_0x6f20('0x1'));var moment=require('moment');var BPromise=require(_0x6f20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f20('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f20('0x4'))(_0x6f20('0x5'));var config=require(_0x6f20('0x6'));var jayson=require(_0x6f20('0x7'));var client=jayson[_0x6f20('0x8')][_0x6f20('0x9')]({'port':0x232a});config[_0x6f20('0xa')]=_[_0x6f20('0xb')](config[_0x6f20('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f20('0xc'))(new Redis(config['redis']));require(_0x6f20('0xd'))[_0x6f20('0xe')](socket);function respondWithRpcPromise(_0x433dcf,_0x2a36be,_0x53ffca){return new BPromise(function(_0x2c965d,_0x57fc56){return client[_0x6f20('0xf')](_0x433dcf,_0x53ffca)[_0x6f20('0x10')](function(_0x172972){logger['info'](_0x6f20('0x11'),_0x2a36be,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2a36be,'request\x20sent',JSON[_0x6f20('0x12')](_0x172972));if(_0x172972[_0x6f20('0x13')]){if(_0x172972['error'][_0x6f20('0x14')]===0x1f4){logger[_0x6f20('0x13')](_0x6f20('0x11'),_0x2a36be,_0x172972[_0x6f20('0x13')]['message']);return _0x57fc56(_0x172972['error']['message']);}logger[_0x6f20('0x13')](_0x6f20('0x11'),_0x2a36be,_0x172972[_0x6f20('0x13')]['message']);return _0x2c965d(_0x172972[_0x6f20('0x13')][_0x6f20('0x15')]);}else{logger[_0x6f20('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2a36be,'request\x20sent');_0x2c965d(_0x172972[_0x6f20('0x17')][_0x6f20('0x15')]);}})['catch'](function(_0x44f6b9){logger['error'](_0x6f20('0x11'),_0x2a36be,_0x44f6b9);_0x57fc56(_0x44f6b9);});});}exports[_0x6f20('0x18')]=function(_0x487ff3){var _0x449a21=this;return new Promise(function(_0x12ecc9,_0x2f399b){return db[_0x6f20('0x19')]['create'](_0x487ff3[_0x6f20('0x1a')],{'raw':_0x487ff3[_0x6f20('0x1b')]?_0x487ff3[_0x6f20('0x1b')][_0x6f20('0x1c')]===undefined?!![]:![]:!![]})[_0x6f20('0x10')](function(_0x16dae9){logger[_0x6f20('0x16')](_0x6f20('0x18'),_0x487ff3);logger['debug'](_0x6f20('0x18'),_0x487ff3,JSON[_0x6f20('0x12')](_0x16dae9));_0x12ecc9(_0x16dae9);})[_0x6f20('0x1d')](function(_0x1df304){logger['error'](_0x6f20('0x18'),_0x1df304['message'],_0x487ff3);_0x2f399b(_0x449a21[_0x6f20('0x13')](0x1f4,_0x1df304[_0x6f20('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 71bc970..5a89cc9 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 _0x0b03=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x0b03,0x19a));var _0x30b0=function(_0x57c17a,_0x32e378){_0x57c17a=_0x57c17a-0x0;var _0x391b0b=_0x0b03[_0x57c17a];return _0x391b0b;};'use strict';var WhatsappMessageEvents=require(_0x30b0('0x0'));var events=[_0x30b0('0x1'),_0x30b0('0x2'),_0x30b0('0x3')];function createListener(_0x552296,_0x15d9ff){return function(_0x24fb4a){_0x15d9ff[_0x30b0('0x4')](_0x552296,_0x24fb4a);};}function removeListener(_0x34bcb2,_0x13ee41){return function(){WhatsappMessageEvents[_0x30b0('0x5')](_0x34bcb2,_0x13ee41);};}exports['register']=function(_0x40fa9f){for(var _0x56adac=0x0,_0x17a96d=events[_0x30b0('0x6')];_0x56adac<_0x17a96d;_0x56adac++){var _0x16890a=events[_0x56adac];var _0x457f78=createListener(_0x30b0('0x7')+_0x16890a,_0x40fa9f);WhatsappMessageEvents['on'](_0x16890a,_0x457f78);}}; \ No newline at end of file +var _0xa69d=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x237d34,_0x42c3cd){var _0x303e56=function(_0xc6452a){while(--_0xc6452a){_0x237d34['push'](_0x237d34['shift']());}};_0x303e56(++_0x42c3cd);}(_0xa69d,0x15d));var _0xda69=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xa69d[_0x580576];return _0x3f55a0;};'use strict';var WhatsappMessageEvents=require(_0xda69('0x0'));var events=[_0xda69('0x1'),_0xda69('0x2'),_0xda69('0x3')];function createListener(_0x47e734,_0x1afd22){return function(_0x175699){_0x1afd22[_0xda69('0x4')](_0x47e734,_0x175699);};}function removeListener(_0x1abe8d,_0x1dab99){return function(){WhatsappMessageEvents[_0xda69('0x5')](_0x1abe8d,_0x1dab99);};}exports[_0xda69('0x6')]=function(_0xf70072){for(var _0x1a7aae=0x0,_0x49cc72=events[_0xda69('0x7')];_0x1a7aae<_0x49cc72;_0x1a7aae++){var _0x315743=events[_0x1a7aae];var _0x2b76d9=createListener(_0xda69('0x8')+_0x315743,_0xf70072);WhatsappMessageEvents['on'](_0x315743,_0x2b76d9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6c1164c..1f96986 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 _0x69e5=['./whatsappQueue.controller','isAuthenticated','get','/describe','describe','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','/:id','destroy','removeTeams','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x69e5,0x1e7));var _0x569e=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0x69e5[_0x5e2489];return _0xa87596;};'use strict';var multer=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var path=require(_0x569e('0x2'));var timeout=require(_0x569e('0x3'));var express=require('express');var router=express[_0x569e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x569e('0x5'));var config=require(_0x569e('0x6'));var controller=require(_0x569e('0x7'));router['get']('/',auth[_0x569e('0x8')](),controller['index']);router[_0x569e('0x9')](_0x569e('0xa'),auth['isAuthenticated'](),controller[_0x569e('0xb')]);router[_0x569e('0x9')]('/:id',auth[_0x569e('0x8')](),controller[_0x569e('0xc')]);router[_0x569e('0x9')]('/:id/members',auth[_0x569e('0x8')](),controller['getMembers']);router[_0x569e('0x9')](_0x569e('0xd'),auth[_0x569e('0x8')](),controller[_0x569e('0xe')]);router[_0x569e('0x9')](_0x569e('0xf'),auth['isAuthenticated'](),controller[_0x569e('0x10')]);router[_0x569e('0x11')]('/',auth[_0x569e('0x8')](),controller[_0x569e('0x12')]);router[_0x569e('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x569e('0x11')](_0x569e('0xf'),auth[_0x569e('0x8')](),controller[_0x569e('0x13')]);router[_0x569e('0x14')]('/:id',auth[_0x569e('0x8')](),controller[_0x569e('0x15')]);router[_0x569e('0x16')](_0x569e('0x17'),auth['isAuthenticated'](),controller[_0x569e('0x18')]);router[_0x569e('0x16')](_0x569e('0xd'),auth[_0x569e('0x8')](),controller[_0x569e('0x19')]);router[_0x569e('0x16')](_0x569e('0xf'),auth[_0x569e('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x60ac=['describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','/:id/users','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated'];(function(_0x555d87,_0x207a9c){var _0x47a78e=function(_0x20691b){while(--_0x20691b){_0x555d87['push'](_0x555d87['shift']());}};_0x47a78e(++_0x207a9c);}(_0x60ac,0xe0));var _0xc60a=function(_0x9686d7,_0x991465){_0x9686d7=_0x9686d7-0x0;var _0x28172d=_0x60ac[_0x9686d7];return _0x28172d;};'use strict';var multer=require(_0xc60a('0x0'));var util=require(_0xc60a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc60a('0x2'));var router=express[_0xc60a('0x3')]();var auth=require(_0xc60a('0x4'));var interaction=require(_0xc60a('0x5'));var config=require(_0xc60a('0x6'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc60a('0x7')]);router[_0xc60a('0x8')]('/describe',auth[_0xc60a('0x9')](),controller[_0xc60a('0xa')]);router['get'](_0xc60a('0xb'),auth['isAuthenticated'](),controller[_0xc60a('0xc')]);router[_0xc60a('0x8')](_0xc60a('0xd'),auth[_0xc60a('0x9')](),controller['getMembers']);router[_0xc60a('0x8')](_0xc60a('0xe'),auth[_0xc60a('0x9')](),controller[_0xc60a('0xf')]);router['get']('/:id/users',auth[_0xc60a('0x9')](),controller['getAgents']);router[_0xc60a('0x10')]('/',auth[_0xc60a('0x9')](),controller[_0xc60a('0x11')]);router[_0xc60a('0x10')](_0xc60a('0xe'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x12')]);router['post']('/:id/users',auth[_0xc60a('0x9')](),controller[_0xc60a('0x13')]);router[_0xc60a('0x14')](_0xc60a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc60a('0x15')](_0xc60a('0xb'),auth[_0xc60a('0x9')](),controller[_0xc60a('0x16')]);router[_0xc60a('0x15')](_0xc60a('0xe'),auth['isAuthenticated'](),controller[_0xc60a('0x17')]);router['delete'](_0xc60a('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc60a('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 cd5eb7c..4a169ba 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 _0xae4b=['name','INTEGER','ENUM','rrmemory','roundrobin','STRING'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0xae4b,0xdd));var _0xbae4=function(_0x1f1089,_0x12d4a9){_0x1f1089=_0x1f1089-0x0;var _0x19d8ce=_0xae4b[_0x1f1089];return _0x19d8ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbae4('0x0')],'unique':_0xbae4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbae4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbae4('0x3')](_0xbae4('0x4'),'beepall',_0xbae4('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc52f=['ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x51004d,_0x2612cb){var _0x15a773=function(_0x3500b3){while(--_0x3500b3){_0x51004d['push'](_0x51004d['shift']());}};_0x15a773(++_0x2612cb);}(_0xc52f,0x1e3));var _0xfc52=function(_0x4f8dab,_0x26aca9){_0x4f8dab=_0x4f8dab-0x0;var _0x2f2285=_0xc52f[_0x4f8dab];return _0x2f2285;};'use strict';var Sequelize=require(_0xfc52('0x0'));module[_0xfc52('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfc52('0x2')](_0xfc52('0x3'),_0xfc52('0x4'),'roundrobin')},'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 3845475..032d8cc 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 _0x94f1=['join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','keys','filters','intersection','query','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','UserId','agent','whatsappPause','format','%s/%s','createdAt','getTeams','findOne','Team','ids','User','Agents','online','voicePause','interface','flatMap','find','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues'];(function(_0x5042d5,_0x45c937){var _0x17870b=function(_0x23ff54){while(--_0x23ff54){_0x5042d5['push'](_0x5042d5['shift']());}};_0x17870b(++_0x45c937);}(_0x94f1,0x129));var _0x194f=function(_0x388cd7,_0x1ce8ad){_0x388cd7=_0x388cd7-0x0;var _0x480c68=_0x94f1[_0x388cd7];return _0x480c68;};'use strict';var pdf=require(_0x194f('0x0'));var emlformat=require(_0x194f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x194f('0x2'));var jsonpatch=require(_0x194f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x194f('0x4'));var Mustache=require(_0x194f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x194f('0x6'));var csv=require(_0x194f('0x7'));var ejs=require(_0x194f('0x8'));var fs=require('fs');var _=require(_0x194f('0x9'));var squel=require(_0x194f('0xa'));var crypto=require('crypto');var jsforce=require(_0x194f('0xb'));var deskjs=require(_0x194f('0xc'));var toCsv=require(_0x194f('0x7'));var querystring=require(_0x194f('0xd'));var Papa=require(_0x194f('0xe'));var Redis=require(_0x194f('0xf'));var authService=require(_0x194f('0x10'));var qs=require(_0x194f('0x11'));var as=require(_0x194f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x194f('0x13'))('api');var utils=require(_0x194f('0x14'));var config=require(_0x194f('0x15'));var db=require(_0x194f('0x16'))['db'];config[_0x194f('0x17')]=_[_0x194f('0x18')](config[_0x194f('0x17')],{'host':_0x194f('0x19'),'port':0x18eb});var socket=require(_0x194f('0x1a'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x194f('0x1b')](socket);function respondWithStatusCode(_0x5b3932,_0x55ab4a){_0x55ab4a=_0x55ab4a||0xcc;return function(_0x555ef1){if(_0x555ef1){return _0x5b3932[_0x194f('0x1c')](_0x55ab4a);}return _0x5b3932[_0x194f('0x1d')](_0x55ab4a)[_0x194f('0x1e')]();};}function respondWithResult(_0x5eadc9,_0x53a82a){_0x53a82a=_0x53a82a||0xc8;return function(_0x377382){if(_0x377382){return _0x5eadc9[_0x194f('0x1d')](_0x53a82a)[_0x194f('0x1f')](_0x377382);}};}function respondWithFilteredResult(_0x1497db,_0x364e2a){return function(_0x219d8c){if(_0x219d8c){var _0x4fa1e8=_0x219d8c[_0x194f('0x20')],_0x1d5815=_0x364e2a[_0x194f('0x21')],_0x36bd3f=_0x364e2a[_0x194f('0x21')]+_0x364e2a['limit'],_0x4ad98a;if(_0x36bd3f>=_0x4fa1e8){_0x36bd3f=_0x4fa1e8;_0x4ad98a=0xc8;}else{_0x4ad98a=0xce;}_0x1497db[_0x194f('0x1d')](_0x4ad98a);return _0x1497db[_0x194f('0x22')](_0x194f('0x23'),_0x1d5815+'-'+_0x36bd3f+'/'+_0x4fa1e8)[_0x194f('0x1f')](_0x219d8c);}return null;};}function patchUpdates(_0x32bab1){return function(_0x20fa56){try{jsonpatch[_0x194f('0x24')](_0x20fa56,_0x32bab1,!![]);}catch(_0x3aaf7d){return BPromise[_0x194f('0x25')](_0x3aaf7d);}return _0x20fa56['save']();};}function saveUpdates(_0x203401,_0x31f4ad){return function(_0x3a0362){if(_0x3a0362){return _0x3a0362[_0x194f('0x26')](_0x203401)[_0x194f('0x27')](function(_0x32065c){return _0x32065c;});}return null;};}function removeEntity(_0x2a5e9f,_0x4682e2){return function(_0x22c6eb){if(_0x22c6eb){return _0x22c6eb[_0x194f('0x28')]()[_0x194f('0x27')](function(){var _0x531ca6=_0x22c6eb[_0x194f('0x29')]({'plain':!![]});var _0x129b3d='WhatsappQueues';return db[_0x194f('0x2a')][_0x194f('0x28')]({'where':{'type':_0x129b3d,'resourceId':_0x531ca6['id']}})[_0x194f('0x27')](function(){return _0x22c6eb;});})[_0x194f('0x27')](function(){_0x2a5e9f[_0x194f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5cdb,_0x1ba198){return function(_0x5dbcec){if(!_0x5dbcec){_0x4e5cdb[_0x194f('0x1c')](0x194);}return _0x5dbcec;};}function handleError(_0x483921,_0x3d3280){_0x3d3280=_0x3d3280||0x1f4;return function(_0x27c98a){logger[_0x194f('0x2b')](_0x27c98a['stack']);if(_0x27c98a[_0x194f('0x2c')]){delete _0x27c98a[_0x194f('0x2c')];}_0x483921['status'](_0x3d3280)[_0x194f('0x2d')](_0x27c98a);};}exports[_0x194f('0x2e')]=function(_0x1df013,_0x76c543){var _0xa8e6a2={},_0x3f9e36={},_0x35421a={'count':0x0,'rows':[]};var _0x39014f=_[_0x194f('0x2f')](db[_0x194f('0x30')][_0x194f('0x31')],function(_0x5ceea5){return{'name':_0x5ceea5[_0x194f('0x32')],'type':_0x5ceea5[_0x194f('0x33')]['key']};});_0x3f9e36['model']=_['map'](_0x39014f,_0x194f('0x2c'));_0x3f9e36['query']=_[_0x194f('0x34')](_0x1df013['query']);_0x3f9e36[_0x194f('0x35')]=_[_0x194f('0x36')](_0x3f9e36['model'],_0x3f9e36[_0x194f('0x37')]);_0xa8e6a2['attributes']=_[_0x194f('0x36')](_0x3f9e36[_0x194f('0x38')],qs['fields'](_0x1df013['query']['fields']));_0xa8e6a2[_0x194f('0x39')]=_0xa8e6a2[_0x194f('0x39')][_0x194f('0x3a')]?_0xa8e6a2[_0x194f('0x39')]:_0x3f9e36[_0x194f('0x38')];if(!_0x1df013[_0x194f('0x37')][_0x194f('0x3b')](_0x194f('0x3c'))){_0xa8e6a2['limit']=qs[_0x194f('0x3d')](_0x1df013[_0x194f('0x37')][_0x194f('0x3d')]);_0xa8e6a2[_0x194f('0x21')]=qs[_0x194f('0x21')](_0x1df013[_0x194f('0x37')][_0x194f('0x21')]);}_0xa8e6a2[_0x194f('0x3e')]=qs['sort'](_0x1df013[_0x194f('0x37')][_0x194f('0x3f')]);_0xa8e6a2['where']=qs[_0x194f('0x35')](_[_0x194f('0x40')](_0x1df013[_0x194f('0x37')],_0x3f9e36[_0x194f('0x35')]),_0x39014f);if(_0x1df013[_0x194f('0x37')][_0x194f('0x41')]){_0xa8e6a2['where']=_[_0x194f('0x42')](_0xa8e6a2[_0x194f('0x43')],{'$or':_[_0x194f('0x2f')](_0x39014f,function(_0x221c8a){if(_0x221c8a['type']!==_0x194f('0x44')){var _0x60bc92={};_0x60bc92[_0x221c8a['name']]={'$like':'%'+_0x1df013['query'][_0x194f('0x41')]+'%'};return _0x60bc92;}})});}_0xa8e6a2=_[_0x194f('0x42')]({},_0xa8e6a2,_0x1df013[_0x194f('0x45')]);var _0x301d05={'where':_0xa8e6a2['where']};return db['WhatsappQueue']['count'](_0x301d05)[_0x194f('0x27')](function(_0x56d440){_0x35421a[_0x194f('0x20')]=_0x56d440;if(_0x1df013[_0x194f('0x37')][_0x194f('0x46')]){_0xa8e6a2[_0x194f('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x194f('0x48')](_0xa8e6a2);})['then'](function(_0x4303b9){_0x35421a[_0x194f('0x49')]=_0x4303b9;return _0x35421a;})[_0x194f('0x27')](respondWithFilteredResult(_0x76c543,_0xa8e6a2))[_0x194f('0x4a')](handleError(_0x76c543,null));};exports[_0x194f('0x4b')]=function(_0x3e26e6,_0x1264c7){var _0x1b37cd={'raw':!![],'where':{'id':_0x3e26e6[_0x194f('0x4c')]['id']}},_0x35b31d={};_0x35b31d[_0x194f('0x38')]=_[_0x194f('0x34')](db[_0x194f('0x30')][_0x194f('0x31')]);_0x35b31d[_0x194f('0x37')]=_[_0x194f('0x34')](_0x3e26e6[_0x194f('0x37')]);_0x35b31d[_0x194f('0x35')]=_['intersection'](_0x35b31d['model'],_0x35b31d[_0x194f('0x37')]);_0x1b37cd[_0x194f('0x39')]=_[_0x194f('0x36')](_0x35b31d[_0x194f('0x38')],qs[_0x194f('0x4d')](_0x3e26e6['query'][_0x194f('0x4d')]));_0x1b37cd[_0x194f('0x39')]=_0x1b37cd[_0x194f('0x39')][_0x194f('0x3a')]?_0x1b37cd[_0x194f('0x39')]:_0x35b31d['model'];if(_0x3e26e6[_0x194f('0x37')][_0x194f('0x46')]){_0x1b37cd[_0x194f('0x47')]=[{'all':!![]}];}_0x1b37cd=_[_0x194f('0x42')]({},_0x1b37cd,_0x3e26e6[_0x194f('0x45')]);return db[_0x194f('0x30')]['find'](_0x1b37cd)[_0x194f('0x27')](handleEntityNotFound(_0x1264c7,null))['then'](respondWithResult(_0x1264c7,null))[_0x194f('0x4a')](handleError(_0x1264c7,null));};exports['create']=function(_0x36a033,_0x34c09d){return db[_0x194f('0x30')][_0x194f('0x4e')](_0x36a033[_0x194f('0x4f')],{})[_0x194f('0x27')](function(_0x3b9770){var _0x56e56f=_0x36a033[_0x194f('0x50')][_0x194f('0x29')]({'plain':!![]});if(!_0x56e56f)throw new Error(_0x194f('0x51'));if(_0x56e56f['role']==='user'){var _0x507bff=_0x3b9770[_0x194f('0x29')]({'plain':!![]});var _0x291c12='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x291c12,'userProfileId':_0x56e56f[_0x194f('0x52')]},'raw':!![]})[_0x194f('0x27')](function(_0x3a6687){if(_0x3a6687&&_0x3a6687[_0x194f('0x53')]===0x0){return db[_0x194f('0x2a')][_0x194f('0x4e')]({'name':_0x507bff['name'],'resourceId':_0x507bff['id'],'type':_0x3a6687[_0x194f('0x2c')],'sectionId':_0x3a6687['id']},{})[_0x194f('0x27')](function(){return _0x3b9770;});}else{return _0x3b9770;}})[_0x194f('0x4a')](function(_0x8f31bc){logger[_0x194f('0x2b')](_0x194f('0x54'),_0x8f31bc);throw _0x8f31bc;});}return _0x3b9770;})['then'](respondWithResult(_0x34c09d,0xc9))[_0x194f('0x4a')](handleError(_0x34c09d,null));};exports[_0x194f('0x26')]=function(_0x35ff69,_0x21d687){if(_0x35ff69[_0x194f('0x4f')]['id']){delete _0x35ff69[_0x194f('0x4f')]['id'];}return db[_0x194f('0x30')]['find']({'where':{'id':_0x35ff69[_0x194f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21d687,null))['then'](saveUpdates(_0x35ff69[_0x194f('0x4f')],null))[_0x194f('0x27')](respondWithResult(_0x21d687,null))[_0x194f('0x4a')](handleError(_0x21d687,null));};exports[_0x194f('0x28')]=function(_0x927d3e,_0xda0b69){return db[_0x194f('0x30')]['find']({'where':{'id':_0x927d3e[_0x194f('0x4c')]['id']}})['then'](handleEntityNotFound(_0xda0b69,null))[_0x194f('0x27')](removeEntity(_0xda0b69,null))[_0x194f('0x4a')](handleError(_0xda0b69,null));};exports['describe']=function(_0x1f8ad9,_0x3851e4){return db[_0x194f('0x30')][_0x194f('0x55')]()[_0x194f('0x27')](respondWithResult(_0x3851e4,null))[_0x194f('0x4a')](handleError(_0x3851e4,null));};exports[_0x194f('0x56')]=function(_0x49d3ac,_0x6d3cdc,_0x1f026a){var _0x13f736={'raw':!![],'where':{}},_0xe1b2df={},_0x331ce4;return db['WhatsappQueue']['findOne']({'where':{'id':_0x49d3ac[_0x194f('0x4c')]['id']}})[_0x194f('0x27')](handleEntityNotFound(_0x6d3cdc,null))[_0x194f('0x27')](function(_0x3ade10){if(_0x3ade10){_0x331ce4=_0x3ade10[_0x194f('0x29')]({'plain':!![]});_0xe1b2df['model']=_[_0x194f('0x34')](db[_0x194f('0x57')][_0x194f('0x31')]);_0xe1b2df[_0x194f('0x37')]=_[_0x194f('0x34')](_0x49d3ac['query']);_0xe1b2df[_0x194f('0x35')]=_[_0x194f('0x36')](_0xe1b2df[_0x194f('0x38')],_0xe1b2df[_0x194f('0x37')]);_0x13f736['attributes']=_[_0x194f('0x36')](_0xe1b2df[_0x194f('0x38')],qs[_0x194f('0x4d')](_0x49d3ac[_0x194f('0x37')][_0x194f('0x4d')]));_0x13f736['attributes']=_0x13f736[_0x194f('0x39')][_0x194f('0x3a')]?_0x13f736['attributes']:_0xe1b2df['model'];if(!_0x49d3ac[_0x194f('0x37')][_0x194f('0x3b')](_0x194f('0x3c'))){_0x13f736[_0x194f('0x3d')]=qs['limit'](_0x49d3ac['query']['limit']);_0x13f736[_0x194f('0x21')]=qs['offset'](_0x49d3ac[_0x194f('0x37')][_0x194f('0x21')]);}_0x13f736[_0x194f('0x3e')]=qs[_0x194f('0x3f')](_0x49d3ac[_0x194f('0x37')][_0x194f('0x3f')]);_0x13f736[_0x194f('0x43')]=qs[_0x194f('0x35')](_[_0x194f('0x40')](_0x49d3ac[_0x194f('0x37')],_0xe1b2df['filters']));_0x13f736[_0x194f('0x43')][_0x194f('0x58')]=_0x3ade10['id'];if(_0x49d3ac[_0x194f('0x37')][_0x194f('0x41')]){_0x13f736[_0x194f('0x43')]=_[_0x194f('0x42')](_0x13f736[_0x194f('0x43')],{'$or':_[_0x194f('0x2f')](_0x13f736[_0x194f('0x39')],function(_0x34b987){var _0x188865={};_0x188865[_0x34b987]={'$like':'%'+_0x49d3ac[_0x194f('0x37')][_0x194f('0x41')]+'%'};return _0x188865;})});}_0x13f736=_[_0x194f('0x42')]({},_0x13f736,_0x49d3ac['options']);return db[_0x194f('0x57')][_0x194f('0x48')](_0x13f736);}})[_0x194f('0x27')](function(_0x262cbe){if(_0x262cbe){return db['User']['findAndCountAll']({'where':{'id':_[_0x194f('0x2f')](_0x262cbe,_0x194f('0x59')),'role':_0x194f('0x5a')},'attributes':['id','name',_0x194f('0x5b'),'updatedAt','createdAt']});}})[_0x194f('0x27')](function(_0x2e3f85){if(_0x2e3f85){return{'count':_0x2e3f85[_0x194f('0x20')],'rows':_[_0x194f('0x2f')](_0x2e3f85['rows'],function(_0x129270){return{'membername':_0x129270['name'],'UserId':_0x129270['id'],'queue_name':_0x331ce4[_0x194f('0x2c')],'WhatsappQueueId':_0x331ce4['id'],'interface':util[_0x194f('0x5c')](_0x194f('0x5d'),'SIP',_0x129270[_0x194f('0x2c')]),'penalty':0x0,'paused':_0x129270[_0x194f('0x5b')],'createdAt':_0x129270[_0x194f('0x5e')],'updatedAt':_0x129270['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x194f('0x27')](respondWithFilteredResult(_0x6d3cdc,_0x13f736))[_0x194f('0x4a')](handleError(_0x6d3cdc,null));};exports[_0x194f('0x5f')]=function(_0x4c7731,_0x4ffeeb,_0x1aef38){var _0x54cd46={};var _0xdca600={};var _0x12a35e;var _0x36b954;return db[_0x194f('0x30')][_0x194f('0x60')]({'where':{'id':_0x4c7731[_0x194f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ffeeb,null))[_0x194f('0x27')](function(_0x5b58e4){if(_0x5b58e4){_0x12a35e=_0x5b58e4;_0xdca600[_0x194f('0x38')]=_[_0x194f('0x34')](db[_0x194f('0x61')][_0x194f('0x31')]);_0xdca600['query']=_[_0x194f('0x34')](_0x4c7731[_0x194f('0x37')]);_0xdca600[_0x194f('0x35')]=_[_0x194f('0x36')](_0xdca600[_0x194f('0x38')],_0xdca600['query']);_0x54cd46[_0x194f('0x39')]=_[_0x194f('0x36')](_0xdca600[_0x194f('0x38')],qs[_0x194f('0x4d')](_0x4c7731[_0x194f('0x37')][_0x194f('0x4d')]));_0x54cd46[_0x194f('0x39')]=_0x54cd46[_0x194f('0x39')][_0x194f('0x3a')]?_0x54cd46[_0x194f('0x39')]:_0xdca600['model'];_0x54cd46[_0x194f('0x3e')]=qs[_0x194f('0x3f')](_0x4c7731[_0x194f('0x37')][_0x194f('0x3f')]);_0x54cd46[_0x194f('0x43')]=qs['filters'](_[_0x194f('0x40')](_0x4c7731['query'],_0xdca600[_0x194f('0x35')]));if(_0x4c7731[_0x194f('0x37')][_0x194f('0x41')]){_0x54cd46['where']=_['merge'](_0x54cd46[_0x194f('0x43')],{'$or':_[_0x194f('0x2f')](_0x54cd46[_0x194f('0x39')],function(_0x56bb33){var _0x286a6f={};_0x286a6f[_0x56bb33]={'$like':'%'+_0x4c7731['query'][_0x194f('0x41')]+'%'};return _0x286a6f;})});}_0x54cd46=_[_0x194f('0x42')]({},_0x54cd46,_0x4c7731[_0x194f('0x45')]);return _0x12a35e[_0x194f('0x5f')](_0x54cd46);}})['then'](function(_0x4e9dbc){if(_0x4e9dbc){_0x36b954=_0x4e9dbc[_0x194f('0x3a')];if(!_0x4c7731['query'][_0x194f('0x3b')]('nolimit')){_0x54cd46[_0x194f('0x3d')]=qs[_0x194f('0x3d')](_0x4c7731[_0x194f('0x37')]['limit']);_0x54cd46[_0x194f('0x21')]=qs[_0x194f('0x21')](_0x4c7731[_0x194f('0x37')][_0x194f('0x21')]);}return _0x12a35e['getTeams'](_0x54cd46);}})[_0x194f('0x27')](function(_0x4d6e60){if(_0x4d6e60){return _0x4d6e60?{'count':_0x36b954,'rows':_0x4d6e60}:null;}})[_0x194f('0x27')](respondWithResult(_0x4ffeeb,null))[_0x194f('0x4a')](handleError(_0x4ffeeb,null));};exports['addTeams']=function(_0x5f3ee3,_0x5a41ba,_0xa09a64){var _0x109f5f=_0x5f3ee3['body'][_0x194f('0x62')];return db[_0x194f('0x61')]['findAll']({'where':{'id':_0x109f5f},'attributes':['id'],'include':[{'model':db[_0x194f('0x63')],'as':_0x194f('0x64'),'attributes':['id','name',_0x194f('0x65'),_0x194f('0x66'),_0x194f('0x67')],'raw':!![]}]})[_0x194f('0x27')](function(_0xf7db9a){if(_0xf7db9a){var _0x2604b1=_[_0x194f('0x68')](_0xf7db9a,function(_0x5bceea){var _0x2ea615=_0x5bceea['get']({'plain':!![]});return _0x2ea615['Agents'];});return db[_0x194f('0x30')][_0x194f('0x69')]({'where':{'id':_0x5f3ee3['params']['id']}})[_0x194f('0x27')](function(_0x3211ea){return db[_0x194f('0x6a')][_0x194f('0x6b')](function(_0x3f4611){return _0x3211ea[_0x194f('0x6c')](_0x109f5f,{'transaction':_0x3f4611})['then'](function(){return BPromise[_0x194f('0x6d')](_0x2604b1,function(_0x368e67){return db['UserWhatsappQueue'][_0x194f('0x6e')]({'where':{'UserId':_0x368e67['id'],'WhatsappQueueId':_0x5f3ee3[_0x194f('0x4c')]['id']},'transaction':_0x3f4611});});})[_0x194f('0x27')](function(){_0x2604b1[_0x194f('0x6f')](function(_0x367c1a){socket[_0x194f('0x70')](_0x194f('0x71'),{'UserId':_0x367c1a['id'],'WhatsappQueueId':_0x3211ea['id']});});});});});}})[_0x194f('0x27')](respondWithStatusCode(_0x5a41ba,null))[_0x194f('0x4a')](handleError(_0x5a41ba,null));};exports[_0x194f('0x72')]=function(_0x22dafc,_0xe55a6b,_0x1bbb4e){return db[_0x194f('0x61')][_0x194f('0x48')]({'where':{'id':_0x22dafc[_0x194f('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x194f('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x194f('0x27')](handleEntityNotFound(_0xe55a6b,null))['then'](function(_0x6676bf){var _0x23138d=_['map'](_0x6676bf,'id');var _0x327dfe=[];var _0x4cb618=[];var _0x19ef87=squel[_0x194f('0x73')]();_0x19ef87[_0x194f('0x74')](_0x194f('0x75'))[_0x194f('0x76')](_0x194f('0x77'),'tq')[_0x194f('0x78')](_0x194f('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x194f('0x7a'),_0x22dafc[_0x194f('0x4c')]['id']);for(var _0x5b0807=0x0;_0x5b0807<_0x6676bf[_0x194f('0x3a')];_0x5b0807+=0x1){let _0x4ca6ac=_0x6676bf[_0x5b0807];for(var _0x4f89a1=0x0;_0x4f89a1<_0x4ca6ac[_0x194f('0x64')]['length'];_0x4f89a1+=0x1){let _0x3a023e=_0x4ca6ac[_0x194f('0x64')][_0x4f89a1];var _0x3e14a8=_0x19ef87[_0x194f('0x7b')]();_0x3e14a8[_0x194f('0x43')](_0x194f('0x7c'),_0x3a023e['id']);_0x4cb618[_0x194f('0x7d')](db['sequelize'][_0x194f('0x37')](_0x3e14a8[_0x194f('0x7e')](),{'type':db['sequelize'][_0x194f('0x7f')][_0x194f('0x80')]})[_0x194f('0x27')](function(_0x52d8c8){if(_0x52d8c8['length']===0x1){return _0x3a023e['id'];}else{var _0x25d103=_[_0x194f('0x81')](_[_0x194f('0x2f')](_0x52d8c8,_0x194f('0x82')),function(_0xa8f7ee){return _[_0x194f('0x83')](_0x23138d,_0xa8f7ee);});if(_0x25d103){return _0x3a023e['id'];}}}));}}return BPromise['all'](_0x4cb618)[_0x194f('0x27')](function(_0x2d0efc){_0x327dfe=_(_0x327dfe)['union'](_0x2d0efc)[_0x194f('0x84')]()[_0x194f('0x85')]();return db['WhatsappQueue']['find']({'where':{'id':_0x22dafc[_0x194f('0x4c')]['id']}})['then'](function(_0x3a7e84){return db['sequelize']['transaction'](function(_0x3fe627){return _0x3a7e84[_0x194f('0x72')](_0x22dafc[_0x194f('0x37')][_0x194f('0x62')],{'transaction':_0x3fe627})[_0x194f('0x27')](function(){if(!_['isEmpty'](_0x327dfe)){return _0x3a7e84[_0x194f('0x86')](_0x327dfe,{'transaction':_0x3fe627});}})[_0x194f('0x27')](function(){_0x327dfe[_0x194f('0x6f')](function(_0x4365c2){socket[_0x194f('0x70')](_0x194f('0x87'),{'UserId':_0x4365c2,'WhatsappQueueId':_0x3a7e84['id']});});});});});});})[_0x194f('0x27')](respondWithStatusCode(_0xe55a6b,null))[_0x194f('0x4a')](handleError(_0xe55a6b,null));};exports['addAgents']=function(_0x25bc3c,_0x239dee,_0x3bc79f){return db[_0x194f('0x30')][_0x194f('0x69')]({'where':{'id':_0x25bc3c[_0x194f('0x4c')]['id']}})[_0x194f('0x27')](handleEntityNotFound(_0x239dee,null))[_0x194f('0x27')](function(_0x31ebfe){if(_0x31ebfe){return _0x31ebfe[_0x194f('0x88')](_0x25bc3c[_0x194f('0x4f')][_0x194f('0x62')],_['omit'](_0x25bc3c[_0x194f('0x4f')],[_0x194f('0x62'),'id'])||{})['spread'](function(_0x268bab){for(var _0x47970d=0x0;_0x47970d<_0x25bc3c['body'][_0x194f('0x62')][_0x194f('0x3a')];_0x47970d+=0x1){socket[_0x194f('0x70')]('userWhatsappQueue:save',{'UserId':_0x25bc3c['body'][_0x194f('0x62')][_0x47970d],'WhatsappQueueId':_0x25bc3c[_0x194f('0x4c')]['id']});}return _0x268bab;});}})[_0x194f('0x27')](respondWithResult(_0x239dee,null))[_0x194f('0x4a')](handleError(_0x239dee,null));};exports[_0x194f('0x86')]=function(_0x21d125,_0x23e4dd,_0x321bbf){return db[_0x194f('0x30')][_0x194f('0x69')]({'where':{'id':_0x21d125['params']['id']}})[_0x194f('0x27')](handleEntityNotFound(_0x23e4dd,null))[_0x194f('0x27')](function(_0x2dbd0a){if(_0x2dbd0a){return _0x2dbd0a[_0x194f('0x86')](_0x21d125[_0x194f('0x37')]['ids'])[_0x194f('0x27')](function(){if(_[_0x194f('0x89')](_0x21d125[_0x194f('0x37')][_0x194f('0x62')])){for(var _0x1b3068=0x0;_0x1b3068<_0x21d125[_0x194f('0x37')][_0x194f('0x62')][_0x194f('0x3a')];_0x1b3068+=0x1){socket[_0x194f('0x70')](_0x194f('0x87'),{'UserId':Number(_0x21d125[_0x194f('0x37')][_0x194f('0x62')][_0x1b3068]),'WhatsappQueueId':Number(_0x21d125[_0x194f('0x4c')]['id'])});}}else{socket[_0x194f('0x70')](_0x194f('0x87'),{'UserId':Number(_0x21d125['query'][_0x194f('0x62')]),'WhatsappQueueId':Number(_0x21d125['params']['id'])});}});}})[_0x194f('0x27')](respondWithStatusCode(_0x23e4dd,null))['catch'](handleError(_0x23e4dd,null));};exports[_0x194f('0x8a')]=function(_0x1055e9,_0x111f54,_0x255e6a){var _0x7c1fe8={};var _0x5d54ab={};var _0x1827cb;var _0x4793dc;return db['WhatsappQueue'][_0x194f('0x60')]({'where':{'id':_0x1055e9['params']['id']}})[_0x194f('0x27')](handleEntityNotFound(_0x111f54,null))[_0x194f('0x27')](function(_0x3ecdad){if(_0x3ecdad){_0x1827cb=_0x3ecdad;_0x5d54ab[_0x194f('0x38')]=_[_0x194f('0x34')](db[_0x194f('0x63')][_0x194f('0x31')]);_0x5d54ab['query']=_[_0x194f('0x34')](_0x1055e9[_0x194f('0x37')]);_0x5d54ab['filters']=_['intersection'](_0x5d54ab[_0x194f('0x38')],_0x5d54ab[_0x194f('0x37')]);_0x7c1fe8[_0x194f('0x39')]=_[_0x194f('0x36')](_0x5d54ab['model'],qs[_0x194f('0x4d')](_0x1055e9['query'][_0x194f('0x4d')]));_0x7c1fe8[_0x194f('0x39')]=_0x7c1fe8['attributes'][_0x194f('0x3a')]?_0x7c1fe8[_0x194f('0x39')]:_0x5d54ab[_0x194f('0x38')];_0x7c1fe8[_0x194f('0x3e')]=qs[_0x194f('0x3f')](_0x1055e9[_0x194f('0x37')][_0x194f('0x3f')]);_0x7c1fe8[_0x194f('0x43')]=qs[_0x194f('0x35')](_['pick'](_0x1055e9[_0x194f('0x37')],_0x5d54ab['filters']));if(_0x1055e9[_0x194f('0x37')][_0x194f('0x41')]){_0x7c1fe8[_0x194f('0x43')]=_['merge'](_0x7c1fe8[_0x194f('0x43')],{'$or':_[_0x194f('0x2f')](_0x7c1fe8[_0x194f('0x39')],function(_0x2add12){var _0x4ea9c1={};_0x4ea9c1[_0x2add12]={'$like':'%'+_0x1055e9[_0x194f('0x37')][_0x194f('0x41')]+'%'};return _0x4ea9c1;})});}_0x7c1fe8=_[_0x194f('0x42')]({},_0x7c1fe8,_0x1055e9[_0x194f('0x45')]);return _0x1827cb[_0x194f('0x8a')](_0x7c1fe8);}})['then'](function(_0x45739a){if(_0x45739a){_0x4793dc=_0x45739a[_0x194f('0x3a')];if(!_0x1055e9[_0x194f('0x37')][_0x194f('0x3b')](_0x194f('0x3c'))){_0x7c1fe8[_0x194f('0x3d')]=qs[_0x194f('0x3d')](_0x1055e9[_0x194f('0x37')]['limit']);_0x7c1fe8[_0x194f('0x21')]=qs[_0x194f('0x21')](_0x1055e9[_0x194f('0x37')][_0x194f('0x21')]);}return _0x1827cb[_0x194f('0x8a')](_0x7c1fe8);}})[_0x194f('0x27')](function(_0xb3a8d7){if(_0xb3a8d7){return _0xb3a8d7?{'count':_0x4793dc,'rows':_0xb3a8d7}:null;}})['then'](respondWithResult(_0x111f54,null))[_0x194f('0x4a')](handleError(_0x111f54,null));}; \ No newline at end of file +var _0xc878=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','end','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','field'];(function(_0x14bbf3,_0xca820f){var _0x1b280c=function(_0x2a5314){while(--_0x2a5314){_0x14bbf3['push'](_0x14bbf3['shift']());}};_0x1b280c(++_0xca820f);}(_0xc878,0x133));var _0x8c87=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xc878[_0xe66cf2];return _0x2d84e7;};'use strict';var pdf=require(_0x8c87('0x0'));var emlformat=require(_0x8c87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c87('0x2'));var jsonpatch=require(_0x8c87('0x3'));var rp=require(_0x8c87('0x4'));var moment=require(_0x8c87('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8c87('0x6'));var util=require(_0x8c87('0x7'));var path=require('path');var sox=require(_0x8c87('0x8'));var csv=require(_0x8c87('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c87('0xa'));var squel=require(_0x8c87('0xb'));var crypto=require(_0x8c87('0xc'));var jsforce=require(_0x8c87('0xd'));var deskjs=require(_0x8c87('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8c87('0xf'));var Papa=require(_0x8c87('0x10'));var Redis=require(_0x8c87('0x11'));var authService=require(_0x8c87('0x12'));var qs=require(_0x8c87('0x13'));var as=require(_0x8c87('0x14'));var hardwareService=require(_0x8c87('0x15'));var logger=require(_0x8c87('0x16'))(_0x8c87('0x17'));var utils=require(_0x8c87('0x18'));var config=require('../../config/environment');var db=require(_0x8c87('0x19'))['db'];config[_0x8c87('0x1a')]=_[_0x8c87('0x1b')](config[_0x8c87('0x1a')],{'host':_0x8c87('0x1c'),'port':0x18eb});var socket=require(_0x8c87('0x1d'))(new Redis(config[_0x8c87('0x1a')]));require(_0x8c87('0x1e'))[_0x8c87('0x1f')](socket);function respondWithStatusCode(_0x45355e,_0x3520b7){_0x3520b7=_0x3520b7||0xcc;return function(_0x53eb2e){if(_0x53eb2e){return _0x45355e['sendStatus'](_0x3520b7);}return _0x45355e['status'](_0x3520b7)[_0x8c87('0x20')]();};}function respondWithResult(_0x57f338,_0x437532){_0x437532=_0x437532||0xc8;return function(_0x5da7d1){if(_0x5da7d1){return _0x57f338['status'](_0x437532)['json'](_0x5da7d1);}};}function respondWithFilteredResult(_0x29da4a,_0x452801){return function(_0x12b86e){if(_0x12b86e){var _0x99b015=_0x12b86e[_0x8c87('0x21')],_0x5574ea=_0x452801[_0x8c87('0x22')],_0x35a5b9=_0x452801[_0x8c87('0x22')]+_0x452801[_0x8c87('0x23')],_0x5324f9;if(_0x35a5b9>=_0x99b015){_0x35a5b9=_0x99b015;_0x5324f9=0xc8;}else{_0x5324f9=0xce;}_0x29da4a[_0x8c87('0x24')](_0x5324f9);return _0x29da4a[_0x8c87('0x25')](_0x8c87('0x26'),_0x5574ea+'-'+_0x35a5b9+'/'+_0x99b015)['json'](_0x12b86e);}return null;};}function patchUpdates(_0x3fe7ed){return function(_0x325068){try{jsonpatch[_0x8c87('0x27')](_0x325068,_0x3fe7ed,!![]);}catch(_0xc0a9a8){return BPromise[_0x8c87('0x28')](_0xc0a9a8);}return _0x325068[_0x8c87('0x29')]();};}function saveUpdates(_0x59c0b8,_0x17478a){return function(_0x2870d6){if(_0x2870d6){return _0x2870d6[_0x8c87('0x2a')](_0x59c0b8)['then'](function(_0x4f177d){return _0x4f177d;});}return null;};}function removeEntity(_0x1df243,_0x2e70ed){return function(_0x7b765d){if(_0x7b765d){return _0x7b765d[_0x8c87('0x2b')]()[_0x8c87('0x2c')](function(){var _0x17a72e=_0x7b765d[_0x8c87('0x2d')]({'plain':!![]});var _0x223978=_0x8c87('0x2e');return db['UserProfileResource'][_0x8c87('0x2b')]({'where':{'type':_0x223978,'resourceId':_0x17a72e['id']}})[_0x8c87('0x2c')](function(){return _0x7b765d;});})[_0x8c87('0x2c')](function(){_0x1df243[_0x8c87('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b4de,_0x181acf){return function(_0xae407d){if(!_0xae407d){_0x12b4de[_0x8c87('0x2f')](0x194);}return _0xae407d;};}function handleError(_0x26ecc9,_0x1452ec){_0x1452ec=_0x1452ec||0x1f4;return function(_0x5b0d08){logger[_0x8c87('0x30')](_0x5b0d08[_0x8c87('0x31')]);if(_0x5b0d08[_0x8c87('0x32')]){delete _0x5b0d08[_0x8c87('0x32')];}_0x26ecc9['status'](_0x1452ec)[_0x8c87('0x33')](_0x5b0d08);};}exports[_0x8c87('0x34')]=function(_0xb09b27,_0xab3a41){var _0x20f8a0={},_0x2dfb21={},_0x4d5994={'count':0x0,'rows':[]};var _0x5d0cab=_[_0x8c87('0x35')](db[_0x8c87('0x36')][_0x8c87('0x37')],function(_0x2cb945){return{'name':_0x2cb945[_0x8c87('0x38')],'type':_0x2cb945[_0x8c87('0x39')][_0x8c87('0x3a')]};});_0x2dfb21[_0x8c87('0x3b')]=_[_0x8c87('0x35')](_0x5d0cab,_0x8c87('0x32'));_0x2dfb21['query']=_['keys'](_0xb09b27['query']);_0x2dfb21[_0x8c87('0x3c')]=_[_0x8c87('0x3d')](_0x2dfb21['model'],_0x2dfb21[_0x8c87('0x3e')]);_0x20f8a0[_0x8c87('0x3f')]=_[_0x8c87('0x3d')](_0x2dfb21[_0x8c87('0x3b')],qs[_0x8c87('0x40')](_0xb09b27['query'][_0x8c87('0x40')]));_0x20f8a0['attributes']=_0x20f8a0['attributes'][_0x8c87('0x41')]?_0x20f8a0[_0x8c87('0x3f')]:_0x2dfb21[_0x8c87('0x3b')];if(!_0xb09b27['query'][_0x8c87('0x42')]('nolimit')){_0x20f8a0[_0x8c87('0x23')]=qs[_0x8c87('0x23')](_0xb09b27[_0x8c87('0x3e')][_0x8c87('0x23')]);_0x20f8a0[_0x8c87('0x22')]=qs[_0x8c87('0x22')](_0xb09b27[_0x8c87('0x3e')][_0x8c87('0x22')]);}_0x20f8a0[_0x8c87('0x43')]=qs[_0x8c87('0x44')](_0xb09b27[_0x8c87('0x3e')][_0x8c87('0x44')]);_0x20f8a0[_0x8c87('0x45')]=qs[_0x8c87('0x3c')](_[_0x8c87('0x46')](_0xb09b27[_0x8c87('0x3e')],_0x2dfb21[_0x8c87('0x3c')]),_0x5d0cab);if(_0xb09b27['query'][_0x8c87('0x47')]){_0x20f8a0['where']=_[_0x8c87('0x48')](_0x20f8a0[_0x8c87('0x45')],{'$or':_[_0x8c87('0x35')](_0x5d0cab,function(_0x45d64c){if(_0x45d64c['type']!=='VIRTUAL'){var _0x33763a={};_0x33763a[_0x45d64c[_0x8c87('0x32')]]={'$like':'%'+_0xb09b27[_0x8c87('0x3e')][_0x8c87('0x47')]+'%'};return _0x33763a;}})});}_0x20f8a0=_['merge']({},_0x20f8a0,_0xb09b27[_0x8c87('0x49')]);var _0x504111={'where':_0x20f8a0[_0x8c87('0x45')]};return db[_0x8c87('0x36')][_0x8c87('0x21')](_0x504111)['then'](function(_0x534fc5){_0x4d5994[_0x8c87('0x21')]=_0x534fc5;if(_0xb09b27['query'][_0x8c87('0x4a')]){_0x20f8a0['include']=[{'all':!![]}];}return db[_0x8c87('0x36')][_0x8c87('0x4b')](_0x20f8a0);})[_0x8c87('0x2c')](function(_0x10969f){_0x4d5994[_0x8c87('0x4c')]=_0x10969f;return _0x4d5994;})[_0x8c87('0x2c')](respondWithFilteredResult(_0xab3a41,_0x20f8a0))[_0x8c87('0x4d')](handleError(_0xab3a41,null));};exports[_0x8c87('0x4e')]=function(_0x429d13,_0x2db49a){var _0x45a8e7={'raw':!![],'where':{'id':_0x429d13[_0x8c87('0x4f')]['id']}},_0x584ecf={};_0x584ecf[_0x8c87('0x3b')]=_[_0x8c87('0x50')](db[_0x8c87('0x36')][_0x8c87('0x37')]);_0x584ecf[_0x8c87('0x3e')]=_[_0x8c87('0x50')](_0x429d13['query']);_0x584ecf[_0x8c87('0x3c')]=_[_0x8c87('0x3d')](_0x584ecf[_0x8c87('0x3b')],_0x584ecf['query']);_0x45a8e7['attributes']=_[_0x8c87('0x3d')](_0x584ecf['model'],qs['fields'](_0x429d13['query'][_0x8c87('0x40')]));_0x45a8e7[_0x8c87('0x3f')]=_0x45a8e7[_0x8c87('0x3f')][_0x8c87('0x41')]?_0x45a8e7[_0x8c87('0x3f')]:_0x584ecf[_0x8c87('0x3b')];if(_0x429d13['query'][_0x8c87('0x4a')]){_0x45a8e7[_0x8c87('0x51')]=[{'all':!![]}];}_0x45a8e7=_[_0x8c87('0x48')]({},_0x45a8e7,_0x429d13[_0x8c87('0x49')]);return db[_0x8c87('0x36')][_0x8c87('0x52')](_0x45a8e7)[_0x8c87('0x2c')](handleEntityNotFound(_0x2db49a,null))['then'](respondWithResult(_0x2db49a,null))['catch'](handleError(_0x2db49a,null));};exports[_0x8c87('0x53')]=function(_0x1b2348,_0x47d514){return db[_0x8c87('0x36')][_0x8c87('0x53')](_0x1b2348[_0x8c87('0x54')],{})[_0x8c87('0x2c')](function(_0x21182f){var _0x1c90b8=_0x1b2348[_0x8c87('0x55')][_0x8c87('0x2d')]({'plain':!![]});if(!_0x1c90b8)throw new Error(_0x8c87('0x56'));if(_0x1c90b8[_0x8c87('0x57')]===_0x8c87('0x55')){var _0x23c7f2=_0x21182f[_0x8c87('0x2d')]({'plain':!![]});var _0x5bd596=_0x8c87('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x5bd596,'userProfileId':_0x1c90b8[_0x8c87('0x58')]},'raw':!![]})['then'](function(_0x4d1a98){if(_0x4d1a98&&_0x4d1a98[_0x8c87('0x59')]===0x0){return db[_0x8c87('0x5a')][_0x8c87('0x53')]({'name':_0x23c7f2[_0x8c87('0x32')],'resourceId':_0x23c7f2['id'],'type':_0x4d1a98[_0x8c87('0x32')],'sectionId':_0x4d1a98['id']},{})[_0x8c87('0x2c')](function(){return _0x21182f;});}else{return _0x21182f;}})[_0x8c87('0x4d')](function(_0x1bcc97){logger[_0x8c87('0x30')](_0x8c87('0x5b'),_0x1bcc97);throw _0x1bcc97;});}return _0x21182f;})[_0x8c87('0x2c')](respondWithResult(_0x47d514,0xc9))['catch'](handleError(_0x47d514,null));};exports[_0x8c87('0x2a')]=function(_0x1a0001,_0xd41a46){if(_0x1a0001[_0x8c87('0x54')]['id']){delete _0x1a0001[_0x8c87('0x54')]['id'];}return db[_0x8c87('0x36')][_0x8c87('0x52')]({'where':{'id':_0x1a0001['params']['id']}})['then'](handleEntityNotFound(_0xd41a46,null))[_0x8c87('0x2c')](saveUpdates(_0x1a0001[_0x8c87('0x54')],null))[_0x8c87('0x2c')](respondWithResult(_0xd41a46,null))['catch'](handleError(_0xd41a46,null));};exports[_0x8c87('0x2b')]=function(_0x59d2bf,_0x35d9d1){return db[_0x8c87('0x36')][_0x8c87('0x52')]({'where':{'id':_0x59d2bf[_0x8c87('0x4f')]['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0x35d9d1,null))[_0x8c87('0x2c')](removeEntity(_0x35d9d1,null))[_0x8c87('0x4d')](handleError(_0x35d9d1,null));};exports[_0x8c87('0x5c')]=function(_0x24ed91,_0x1d9141){return db['WhatsappQueue'][_0x8c87('0x5c')]()[_0x8c87('0x2c')](respondWithResult(_0x1d9141,null))['catch'](handleError(_0x1d9141,null));};exports['getMembers']=function(_0x33fda6,_0x1a73b7,_0x3df7bc){var _0x10c4a3={'raw':!![],'where':{}},_0x1e2f05={},_0x3b055c;return db[_0x8c87('0x36')][_0x8c87('0x5d')]({'where':{'id':_0x33fda6['params']['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0x1a73b7,null))[_0x8c87('0x2c')](function(_0x17d800){if(_0x17d800){_0x3b055c=_0x17d800['get']({'plain':!![]});_0x1e2f05[_0x8c87('0x3b')]=_[_0x8c87('0x50')](db[_0x8c87('0x5e')]['rawAttributes']);_0x1e2f05['query']=_['keys'](_0x33fda6[_0x8c87('0x3e')]);_0x1e2f05[_0x8c87('0x3c')]=_[_0x8c87('0x3d')](_0x1e2f05[_0x8c87('0x3b')],_0x1e2f05[_0x8c87('0x3e')]);_0x10c4a3[_0x8c87('0x3f')]=_[_0x8c87('0x3d')](_0x1e2f05[_0x8c87('0x3b')],qs['fields'](_0x33fda6['query'][_0x8c87('0x40')]));_0x10c4a3['attributes']=_0x10c4a3[_0x8c87('0x3f')][_0x8c87('0x41')]?_0x10c4a3[_0x8c87('0x3f')]:_0x1e2f05['model'];if(!_0x33fda6['query'][_0x8c87('0x42')]('nolimit')){_0x10c4a3[_0x8c87('0x23')]=qs[_0x8c87('0x23')](_0x33fda6['query']['limit']);_0x10c4a3[_0x8c87('0x22')]=qs[_0x8c87('0x22')](_0x33fda6[_0x8c87('0x3e')]['offset']);}_0x10c4a3[_0x8c87('0x43')]=qs[_0x8c87('0x44')](_0x33fda6['query'][_0x8c87('0x44')]);_0x10c4a3[_0x8c87('0x45')]=qs[_0x8c87('0x3c')](_[_0x8c87('0x46')](_0x33fda6[_0x8c87('0x3e')],_0x1e2f05[_0x8c87('0x3c')]));_0x10c4a3[_0x8c87('0x45')][_0x8c87('0x5f')]=_0x17d800['id'];if(_0x33fda6['query'][_0x8c87('0x47')]){_0x10c4a3['where']=_[_0x8c87('0x48')](_0x10c4a3[_0x8c87('0x45')],{'$or':_[_0x8c87('0x35')](_0x10c4a3[_0x8c87('0x3f')],function(_0x27a14f){var _0x33b85a={};_0x33b85a[_0x27a14f]={'$like':'%'+_0x33fda6['query'][_0x8c87('0x47')]+'%'};return _0x33b85a;})});}_0x10c4a3=_[_0x8c87('0x48')]({},_0x10c4a3,_0x33fda6[_0x8c87('0x49')]);return db[_0x8c87('0x5e')][_0x8c87('0x4b')](_0x10c4a3);}})['then'](function(_0x4a4357){if(_0x4a4357){return db[_0x8c87('0x60')]['findAndCountAll']({'where':{'id':_[_0x8c87('0x35')](_0x4a4357,_0x8c87('0x61')),'role':'agent'},'attributes':['id','name',_0x8c87('0x62'),'updatedAt',_0x8c87('0x63')]});}})[_0x8c87('0x2c')](function(_0x2efe98){if(_0x2efe98){return{'count':_0x2efe98[_0x8c87('0x21')],'rows':_[_0x8c87('0x35')](_0x2efe98['rows'],function(_0xddf074){return{'membername':_0xddf074['name'],'UserId':_0xddf074['id'],'queue_name':_0x3b055c[_0x8c87('0x32')],'WhatsappQueueId':_0x3b055c['id'],'interface':util[_0x8c87('0x64')](_0x8c87('0x65'),_0x8c87('0x66'),_0xddf074[_0x8c87('0x32')]),'penalty':0x0,'paused':_0xddf074['whatsappPause'],'createdAt':_0xddf074[_0x8c87('0x63')],'updatedAt':_0xddf074[_0x8c87('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8c87('0x2c')](respondWithFilteredResult(_0x1a73b7,_0x10c4a3))[_0x8c87('0x4d')](handleError(_0x1a73b7,null));};exports[_0x8c87('0x68')]=function(_0x34a272,_0xa30f7f,_0xd22928){var _0x19ac1c={};var _0x5141e6={};var _0x281020;var _0xc733e9;return db['WhatsappQueue'][_0x8c87('0x5d')]({'where':{'id':_0x34a272[_0x8c87('0x4f')]['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0xa30f7f,null))[_0x8c87('0x2c')](function(_0x5c326e){if(_0x5c326e){_0x281020=_0x5c326e;_0x5141e6['model']=_[_0x8c87('0x50')](db[_0x8c87('0x69')][_0x8c87('0x37')]);_0x5141e6[_0x8c87('0x3e')]=_[_0x8c87('0x50')](_0x34a272['query']);_0x5141e6[_0x8c87('0x3c')]=_[_0x8c87('0x3d')](_0x5141e6[_0x8c87('0x3b')],_0x5141e6[_0x8c87('0x3e')]);_0x19ac1c[_0x8c87('0x3f')]=_['intersection'](_0x5141e6[_0x8c87('0x3b')],qs[_0x8c87('0x40')](_0x34a272[_0x8c87('0x3e')][_0x8c87('0x40')]));_0x19ac1c[_0x8c87('0x3f')]=_0x19ac1c[_0x8c87('0x3f')][_0x8c87('0x41')]?_0x19ac1c['attributes']:_0x5141e6['model'];_0x19ac1c[_0x8c87('0x43')]=qs[_0x8c87('0x44')](_0x34a272['query'][_0x8c87('0x44')]);_0x19ac1c[_0x8c87('0x45')]=qs['filters'](_[_0x8c87('0x46')](_0x34a272[_0x8c87('0x3e')],_0x5141e6['filters']));if(_0x34a272[_0x8c87('0x3e')]['filter']){_0x19ac1c[_0x8c87('0x45')]=_[_0x8c87('0x48')](_0x19ac1c[_0x8c87('0x45')],{'$or':_['map'](_0x19ac1c[_0x8c87('0x3f')],function(_0x47a286){var _0x2e44d4={};_0x2e44d4[_0x47a286]={'$like':'%'+_0x34a272['query'][_0x8c87('0x47')]+'%'};return _0x2e44d4;})});}_0x19ac1c=_[_0x8c87('0x48')]({},_0x19ac1c,_0x34a272['options']);return _0x281020[_0x8c87('0x68')](_0x19ac1c);}})[_0x8c87('0x2c')](function(_0x158e3a){if(_0x158e3a){_0xc733e9=_0x158e3a[_0x8c87('0x41')];if(!_0x34a272[_0x8c87('0x3e')][_0x8c87('0x42')](_0x8c87('0x6a'))){_0x19ac1c[_0x8c87('0x23')]=qs[_0x8c87('0x23')](_0x34a272['query'][_0x8c87('0x23')]);_0x19ac1c['offset']=qs[_0x8c87('0x22')](_0x34a272[_0x8c87('0x3e')][_0x8c87('0x22')]);}return _0x281020['getTeams'](_0x19ac1c);}})[_0x8c87('0x2c')](function(_0x3f4428){if(_0x3f4428){return _0x3f4428?{'count':_0xc733e9,'rows':_0x3f4428}:null;}})[_0x8c87('0x2c')](respondWithResult(_0xa30f7f,null))['catch'](handleError(_0xa30f7f,null));};exports['addTeams']=function(_0x3d9b56,_0x5c4379,_0x6af8b6){var _0x4a6e78=_0x3d9b56[_0x8c87('0x54')][_0x8c87('0x6b')];return db[_0x8c87('0x69')][_0x8c87('0x4b')]({'where':{'id':_0x4a6e78},'attributes':['id'],'include':[{'model':db[_0x8c87('0x60')],'as':_0x8c87('0x6c'),'attributes':['id',_0x8c87('0x32'),_0x8c87('0x6d'),_0x8c87('0x6e'),_0x8c87('0x6f')],'raw':!![]}]})[_0x8c87('0x2c')](function(_0xf540b3){if(_0xf540b3){var _0x3c5202=_[_0x8c87('0x70')](_0xf540b3,function(_0x208b36){var _0x15f6b1=_0x208b36['get']({'plain':!![]});return _0x15f6b1['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x3d9b56[_0x8c87('0x4f')]['id']}})['then'](function(_0x56559c){return db[_0x8c87('0x71')][_0x8c87('0x72')](function(_0xfeb736){return _0x56559c[_0x8c87('0x73')](_0x4a6e78,{'transaction':_0xfeb736})['then'](function(){return BPromise[_0x8c87('0x74')](_0x3c5202,function(_0x339f9e){return db[_0x8c87('0x5e')][_0x8c87('0x75')]({'where':{'UserId':_0x339f9e['id'],'WhatsappQueueId':_0x3d9b56[_0x8c87('0x4f')]['id']},'transaction':_0xfeb736});});})[_0x8c87('0x2c')](function(){_0x3c5202[_0x8c87('0x76')](function(_0xb49bdc){socket[_0x8c87('0x77')]('userWhatsappQueue:save',{'UserId':_0xb49bdc['id'],'WhatsappQueueId':_0x56559c['id']});});});});});}})[_0x8c87('0x2c')](respondWithStatusCode(_0x5c4379,null))[_0x8c87('0x4d')](handleError(_0x5c4379,null));};exports[_0x8c87('0x78')]=function(_0xeb0bd3,_0x3db3ea,_0x1fe7b8){return db[_0x8c87('0x69')][_0x8c87('0x4b')]({'where':{'id':_0xeb0bd3[_0x8c87('0x3e')][_0x8c87('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x8c87('0x60')],'as':_0x8c87('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x8c87('0x2c')](handleEntityNotFound(_0x3db3ea,null))[_0x8c87('0x2c')](function(_0x5c05ac){var _0x4d2c12=_[_0x8c87('0x35')](_0x5c05ac,'id');var _0x9a0da1=[];var _0x2d9efd=[];var _0x5f33f7=squel['select']();_0x5f33f7[_0x8c87('0x79')]('tq.TeamId')[_0x8c87('0x7a')](_0x8c87('0x7b'),'tq')[_0x8c87('0x7c')](_0x8c87('0x7d'),'ut',_0x8c87('0x7e'))[_0x8c87('0x45')]('WhatsappQueueId\x20=\x20?',_0xeb0bd3[_0x8c87('0x4f')]['id']);for(var _0x1c97c1=0x0;_0x1c97c1<_0x5c05ac[_0x8c87('0x41')];_0x1c97c1+=0x1){let _0x38a737=_0x5c05ac[_0x1c97c1];for(var _0x2abf8d=0x0;_0x2abf8d<_0x38a737['Agents']['length'];_0x2abf8d+=0x1){let _0x1e800c=_0x38a737[_0x8c87('0x6c')][_0x2abf8d];var _0x302588=_0x5f33f7[_0x8c87('0x7f')]();_0x302588[_0x8c87('0x45')]('ut.UserId\x20=\x20?',_0x1e800c['id']);_0x2d9efd[_0x8c87('0x80')](db[_0x8c87('0x71')][_0x8c87('0x3e')](_0x302588[_0x8c87('0x81')](),{'type':db[_0x8c87('0x71')][_0x8c87('0x82')]['SELECT']})[_0x8c87('0x2c')](function(_0x487303){if(_0x487303[_0x8c87('0x41')]===0x1){return _0x1e800c['id'];}else{var _0xd0fb4d=_[_0x8c87('0x83')](_['map'](_0x487303,'TeamId'),function(_0x160d92){return _['includes'](_0x4d2c12,_0x160d92);});if(_0xd0fb4d){return _0x1e800c['id'];}}}));}}return BPromise[_0x8c87('0x84')](_0x2d9efd)[_0x8c87('0x2c')](function(_0x5e94ee){_0x9a0da1=_(_0x9a0da1)[_0x8c87('0x85')](_0x5e94ee)[_0x8c87('0x86')]()['value']();return db['WhatsappQueue'][_0x8c87('0x52')]({'where':{'id':_0xeb0bd3['params']['id']}})[_0x8c87('0x2c')](function(_0x130467){return db[_0x8c87('0x71')][_0x8c87('0x72')](function(_0x62fbe4){return _0x130467[_0x8c87('0x78')](_0xeb0bd3[_0x8c87('0x3e')]['ids'],{'transaction':_0x62fbe4})['then'](function(){if(!_[_0x8c87('0x87')](_0x9a0da1)){return _0x130467[_0x8c87('0x88')](_0x9a0da1,{'transaction':_0x62fbe4});}})['then'](function(){_0x9a0da1[_0x8c87('0x76')](function(_0x4c17d4){socket['emit'](_0x8c87('0x89'),{'UserId':_0x4c17d4,'WhatsappQueueId':_0x130467['id']});});});});});});})[_0x8c87('0x2c')](respondWithStatusCode(_0x3db3ea,null))[_0x8c87('0x4d')](handleError(_0x3db3ea,null));};exports[_0x8c87('0x8a')]=function(_0x3d3583,_0x153d92,_0x1b3690){return db[_0x8c87('0x36')][_0x8c87('0x52')]({'where':{'id':_0x3d3583['params']['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0x153d92,null))[_0x8c87('0x2c')](function(_0x1949c4){if(_0x1949c4){return _0x1949c4[_0x8c87('0x8a')](_0x3d3583[_0x8c87('0x54')][_0x8c87('0x6b')],_[_0x8c87('0x8b')](_0x3d3583['body'],['ids','id'])||{})[_0x8c87('0x8c')](function(_0x5511a2){for(var _0x31beac=0x0;_0x31beac<_0x3d3583[_0x8c87('0x54')][_0x8c87('0x6b')]['length'];_0x31beac+=0x1){socket[_0x8c87('0x77')](_0x8c87('0x8d'),{'UserId':_0x3d3583[_0x8c87('0x54')][_0x8c87('0x6b')][_0x31beac],'WhatsappQueueId':_0x3d3583[_0x8c87('0x4f')]['id']});}return _0x5511a2;});}})[_0x8c87('0x2c')](respondWithResult(_0x153d92,null))[_0x8c87('0x4d')](handleError(_0x153d92,null));};exports[_0x8c87('0x88')]=function(_0x22d236,_0xbb0328,_0x3ad7b6){return db[_0x8c87('0x36')]['find']({'where':{'id':_0x22d236['params']['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0xbb0328,null))[_0x8c87('0x2c')](function(_0xf3269f){if(_0xf3269f){return _0xf3269f['removeAgents'](_0x22d236['query'][_0x8c87('0x6b')])[_0x8c87('0x2c')](function(){if(_['isArray'](_0x22d236[_0x8c87('0x3e')][_0x8c87('0x6b')])){for(var _0x63e4d9=0x0;_0x63e4d9<_0x22d236[_0x8c87('0x3e')][_0x8c87('0x6b')]['length'];_0x63e4d9+=0x1){socket['emit'](_0x8c87('0x89'),{'UserId':Number(_0x22d236[_0x8c87('0x3e')][_0x8c87('0x6b')][_0x63e4d9]),'WhatsappQueueId':Number(_0x22d236[_0x8c87('0x4f')]['id'])});}}else{socket[_0x8c87('0x77')]('userWhatsappQueue:remove',{'UserId':Number(_0x22d236[_0x8c87('0x3e')]['ids']),'WhatsappQueueId':Number(_0x22d236[_0x8c87('0x4f')]['id'])});}});}})[_0x8c87('0x2c')](respondWithStatusCode(_0xbb0328,null))[_0x8c87('0x4d')](handleError(_0xbb0328,null));};exports['getAgents']=function(_0x21f9ce,_0x44ec2c,_0x3b5f22){var _0x1ae16d={};var _0x149cef={};var _0xb6114;var _0x5d297e;return db[_0x8c87('0x36')][_0x8c87('0x5d')]({'where':{'id':_0x21f9ce[_0x8c87('0x4f')]['id']}})[_0x8c87('0x2c')](handleEntityNotFound(_0x44ec2c,null))['then'](function(_0x52e6e6){if(_0x52e6e6){_0xb6114=_0x52e6e6;_0x149cef[_0x8c87('0x3b')]=_[_0x8c87('0x50')](db[_0x8c87('0x60')][_0x8c87('0x37')]);_0x149cef[_0x8c87('0x3e')]=_[_0x8c87('0x50')](_0x21f9ce[_0x8c87('0x3e')]);_0x149cef['filters']=_[_0x8c87('0x3d')](_0x149cef[_0x8c87('0x3b')],_0x149cef[_0x8c87('0x3e')]);_0x1ae16d[_0x8c87('0x3f')]=_[_0x8c87('0x3d')](_0x149cef[_0x8c87('0x3b')],qs['fields'](_0x21f9ce[_0x8c87('0x3e')][_0x8c87('0x40')]));_0x1ae16d[_0x8c87('0x3f')]=_0x1ae16d[_0x8c87('0x3f')][_0x8c87('0x41')]?_0x1ae16d['attributes']:_0x149cef[_0x8c87('0x3b')];_0x1ae16d['order']=qs[_0x8c87('0x44')](_0x21f9ce['query']['sort']);_0x1ae16d[_0x8c87('0x45')]=qs[_0x8c87('0x3c')](_[_0x8c87('0x46')](_0x21f9ce[_0x8c87('0x3e')],_0x149cef[_0x8c87('0x3c')]));if(_0x21f9ce['query'][_0x8c87('0x47')]){_0x1ae16d[_0x8c87('0x45')]=_[_0x8c87('0x48')](_0x1ae16d[_0x8c87('0x45')],{'$or':_['map'](_0x1ae16d[_0x8c87('0x3f')],function(_0x408192){var _0x38a413={};_0x38a413[_0x408192]={'$like':'%'+_0x21f9ce[_0x8c87('0x3e')][_0x8c87('0x47')]+'%'};return _0x38a413;})});}_0x1ae16d=_[_0x8c87('0x48')]({},_0x1ae16d,_0x21f9ce[_0x8c87('0x49')]);return _0xb6114[_0x8c87('0x8e')](_0x1ae16d);}})[_0x8c87('0x2c')](function(_0x4e4932){if(_0x4e4932){_0x5d297e=_0x4e4932[_0x8c87('0x41')];if(!_0x21f9ce['query'][_0x8c87('0x42')](_0x8c87('0x6a'))){_0x1ae16d[_0x8c87('0x23')]=qs[_0x8c87('0x23')](_0x21f9ce[_0x8c87('0x3e')]['limit']);_0x1ae16d[_0x8c87('0x22')]=qs[_0x8c87('0x22')](_0x21f9ce[_0x8c87('0x3e')]['offset']);}return _0xb6114[_0x8c87('0x8e')](_0x1ae16d);}})[_0x8c87('0x2c')](function(_0x26efca){if(_0x26efca){return _0x26efca?{'count':_0x5d297e,'rows':_0x26efca}:null;}})['then'](respondWithResult(_0x44ec2c,null))[_0x8c87('0x4d')](handleError(_0x44ec2c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index bd9ce99..64ee112 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 _0x52df=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','emit'];(function(_0x4e248e,_0xe53e0e){var _0x3ea7bc=function(_0x1d57fe){while(--_0x1d57fe){_0x4e248e['push'](_0x4e248e['shift']());}};_0x3ea7bc(++_0xe53e0e);}(_0x52df,0xc9));var _0xf52d=function(_0x5cbb33,_0x372f06){_0x5cbb33=_0x5cbb33-0x0;var _0x16e5d0=_0x52df[_0x5cbb33];return _0x16e5d0;};'use strict';var EventEmitter=require(_0xf52d('0x0'));var WhatsappQueue=require(_0xf52d('0x1'))['db'][_0xf52d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf52d('0x3')](0x0);var events={'afterCreate':_0xf52d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7362a2){return function(_0x266001,_0x145a5b,_0x226aa0){WhatsappQueueEvents[_0xf52d('0x5')](_0x7362a2+':'+_0x266001['id'],_0x266001);WhatsappQueueEvents[_0xf52d('0x5')](_0x7362a2,_0x266001);_0x226aa0(null);};}for(var e in events){if(events[_0xf52d('0x6')](e)){var event=events[e];WhatsappQueue[_0xf52d('0x7')](e,emitEvent(event));}}module[_0xf52d('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9d27=['../../mysqldb','setMaxListeners','save','emit','hook','events'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9d27,0xe9));var _0x79d2=function(_0x47cd62,_0x19bbf3){_0x47cd62=_0x47cd62-0x0;var _0x7923b9=_0x9d27[_0x47cd62];return _0x7923b9;};'use strict';var EventEmitter=require(_0x79d2('0x0'));var WhatsappQueue=require(_0x79d2('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x79d2('0x2')](0x0);var events={'afterCreate':_0x79d2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50ebdf){return function(_0x5e3216,_0x2ea3af,_0x18c91a){WhatsappQueueEvents[_0x79d2('0x4')](_0x50ebdf+':'+_0x5e3216['id'],_0x5e3216);WhatsappQueueEvents[_0x79d2('0x4')](_0x50ebdf,_0x5e3216);_0x18c91a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x79d2('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 70ecc44..4b5cb2a 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 _0xc84e=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x36a680,_0x298c65){var _0x308a59=function(_0x553dba){while(--_0x553dba){_0x36a680['push'](_0x36a680['shift']());}};_0x308a59(++_0x298c65);}(_0xc84e,0x1e1));var _0xec84=function(_0x36d648,_0x38043f){_0x36d648=_0x36d648-0x0;var _0x34217b=_0xc84e[_0x36d648];return _0x34217b;};'use strict';var _=require(_0xec84('0x0'));var util=require('util');var logger=require(_0xec84('0x1'))(_0xec84('0x2'));var moment=require('moment');var BPromise=require(_0xec84('0x3'));var rp=require(_0xec84('0x4'));var fs=require('fs');var path=require(_0xec84('0x5'));var rimraf=require(_0xec84('0x6'));var config=require(_0xec84('0x7'));var attributes=require(_0xec84('0x8'));module['exports']=function(_0xfab8d2,_0x45da3c){return _0xfab8d2[_0xec84('0x9')](_0xec84('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1497=['rimraf','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','util','moment','bluebird','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1497,0x10a));var _0x7149=function(_0x57ba46,_0x37e7b2){_0x57ba46=_0x57ba46-0x0;var _0x308d48=_0x1497[_0x57ba46];return _0x308d48;};'use strict';var _=require('lodash');var util=require(_0x7149('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7149('0x1'));var BPromise=require(_0x7149('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7149('0x3'));var rimraf=require(_0x7149('0x4'));var config=require('../../config/environment');var attributes=require(_0x7149('0x5'));module['exports']=function(_0x1274bd,_0x386d4c){return _0x1274bd[_0x7149('0x6')](_0x7149('0x7'),attributes,{'tableName':_0x7149('0x8'),'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 bd184fb..ebf7254 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 _0xaa3b=['include','map','attributes','model','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa3b,0x116));var _0xbaa3=function(_0xe5287b,_0x26b8ab){_0xe5287b=_0xe5287b-0x0;var _0x346f77=_0xaa3b[_0xe5287b];return _0x346f77;};'use strict';var _=require(_0xbaa3('0x0'));var util=require(_0xbaa3('0x1'));var moment=require(_0xbaa3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbaa3('0x3'));var fs=require('fs');var Redis=require(_0xbaa3('0x4'));var db=require(_0xbaa3('0x5'))['db'];var utils=require(_0xbaa3('0x6'));var logger=require('../../config/logger')(_0xbaa3('0x7'));var config=require(_0xbaa3('0x8'));var jayson=require(_0xbaa3('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbaa3('0xa')](config[_0xbaa3('0xb')],{'host':_0xbaa3('0xc'),'port':0x18eb});var socket=require(_0xbaa3('0xd'))(new Redis(config[_0xbaa3('0xb')]));require(_0xbaa3('0xe'))[_0xbaa3('0xf')](socket);function respondWithRpcPromise(_0x10adf6,_0x486e8f,_0x3a41f6){return new BPromise(function(_0x24140c,_0x16a15e){return client[_0xbaa3('0x10')](_0x10adf6,_0x3a41f6)[_0xbaa3('0x11')](function(_0x46b8bf){logger[_0xbaa3('0x12')](_0xbaa3('0x13'),_0x486e8f,_0xbaa3('0x14'));logger[_0xbaa3('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x486e8f,'request\x20sent',JSON[_0xbaa3('0x16')](_0x46b8bf));if(_0x46b8bf[_0xbaa3('0x17')]){if(_0x46b8bf[_0xbaa3('0x17')][_0xbaa3('0x18')]===0x1f4){logger['error'](_0xbaa3('0x13'),_0x486e8f,_0x46b8bf[_0xbaa3('0x17')]['message']);return _0x16a15e(_0x46b8bf[_0xbaa3('0x17')][_0xbaa3('0x19')]);}logger['error'](_0xbaa3('0x13'),_0x486e8f,_0x46b8bf[_0xbaa3('0x17')][_0xbaa3('0x19')]);return _0x24140c(_0x46b8bf['error'][_0xbaa3('0x19')]);}else{logger[_0xbaa3('0x12')](_0xbaa3('0x13'),_0x486e8f,'request\x20sent');_0x24140c(_0x46b8bf['result']['message']);}})[_0xbaa3('0x1a')](function(_0x300599){logger[_0xbaa3('0x17')](_0xbaa3('0x13'),_0x486e8f,_0x300599);_0x16a15e(_0x300599);});});}exports[_0xbaa3('0x1b')]=function(_0x5296aa){var _0x332f10=this;return new Promise(function(_0x5a55ec,_0x319c72){return db[_0xbaa3('0x1c')][_0xbaa3('0x1d')]({'raw':_0x5296aa[_0xbaa3('0x1e')]?_0x5296aa['options'][_0xbaa3('0x1f')]===undefined?!![]:![]:!![],'where':_0x5296aa[_0xbaa3('0x1e')]?_0x5296aa['options'][_0xbaa3('0x20')]||null:null,'attributes':_0x5296aa[_0xbaa3('0x1e')]?_0x5296aa[_0xbaa3('0x1e')]['attributes']||null:null,'limit':_0x5296aa['options']?_0x5296aa['options'][_0xbaa3('0x21')]||null:null,'include':_0x5296aa[_0xbaa3('0x1e')]?_0x5296aa[_0xbaa3('0x1e')][_0xbaa3('0x22')]?_[_0xbaa3('0x23')](_0x5296aa[_0xbaa3('0x1e')]['include'],function(_0x438a94){return{'model':db[_0x438a94['model']],'as':_0x438a94['as'],'attributes':_0x438a94[_0xbaa3('0x24')],'include':_0x438a94[_0xbaa3('0x22')]?_['map'](_0x438a94['include'],function(_0x4abbab){return{'model':db[_0x4abbab[_0xbaa3('0x25')]],'as':_0x4abbab['as'],'attributes':_0x4abbab['attributes'],'include':_0x4abbab['include']?_[_0xbaa3('0x23')](_0x4abbab[_0xbaa3('0x22')],function(_0x32b98c){return{'model':db[_0x32b98c[_0xbaa3('0x25')]],'as':_0x32b98c['as'],'attributes':_0x32b98c[_0xbaa3('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f2766){logger[_0xbaa3('0x12')](_0xbaa3('0x1b'),_0x5296aa);logger[_0xbaa3('0x15')]('GetWhatsappQueue',_0x5296aa,JSON[_0xbaa3('0x16')](_0x3f2766));_0x5a55ec(_0x3f2766);})['catch'](function(_0x4b0a6e){logger['error']('GetWhatsappQueue',_0x4b0a6e[_0xbaa3('0x19')],_0x5296aa);_0x319c72(_0x332f10['error'](0x1f4,_0x4b0a6e[_0xbaa3('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x10bd57){var _0x550498=this;return new Promise(function(_0x18c2c0,_0x4a6c85){return db[_0xbaa3('0x1c')]['find']({'raw':_0x10bd57[_0xbaa3('0x1e')]?_0x10bd57[_0xbaa3('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x10bd57['options']?_0x10bd57['options'][_0xbaa3('0x20')]||null:null,'attributes':_0x10bd57[_0xbaa3('0x1e')]?_0x10bd57[_0xbaa3('0x1e')][_0xbaa3('0x24')]||null:null,'include':_0x10bd57[_0xbaa3('0x1e')]?_0x10bd57[_0xbaa3('0x1e')][_0xbaa3('0x22')]?_[_0xbaa3('0x23')](_0x10bd57[_0xbaa3('0x1e')][_0xbaa3('0x22')],function(_0x2f612f){return{'model':db[_0x2f612f['model']],'as':_0x2f612f['as'],'attributes':_0x2f612f[_0xbaa3('0x24')],'include':_0x2f612f[_0xbaa3('0x22')]?_[_0xbaa3('0x23')](_0x2f612f['include'],function(_0x111cbf){return{'model':db[_0x111cbf[_0xbaa3('0x25')]],'as':_0x111cbf['as'],'attributes':_0x111cbf[_0xbaa3('0x24')],'include':_0x111cbf[_0xbaa3('0x22')]?_[_0xbaa3('0x23')](_0x111cbf[_0xbaa3('0x22')],function(_0x35cf7e){return{'model':db[_0x35cf7e[_0xbaa3('0x25')]],'as':_0x35cf7e['as'],'attributes':_0x35cf7e[_0xbaa3('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b6658){logger[_0xbaa3('0x12')](_0xbaa3('0x26'),_0x10bd57);logger[_0xbaa3('0x15')]('ShowWhatsappQueue',_0x10bd57,JSON[_0xbaa3('0x16')](_0x3b6658));_0x18c2c0(_0x3b6658);})[_0xbaa3('0x1a')](function(_0xdbf6fb){logger[_0xbaa3('0x17')](_0xbaa3('0x26'),_0xdbf6fb['message'],_0x10bd57);_0x4a6c85(_0x550498[_0xbaa3('0x17')](0x1f4,_0xdbf6fb[_0xbaa3('0x19')]));});});}; \ No newline at end of file +var _0xe22f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowWhatsappQueue','WhatsappQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fc69c,_0xd49934){var _0x377017=function(_0x2c6c79){while(--_0x2c6c79){_0x3fc69c['push'](_0x3fc69c['shift']());}};_0x377017(++_0xd49934);}(_0xe22f,0x19e));var _0xfe22=function(_0x95e76f,_0x27cd44){_0x95e76f=_0x95e76f-0x0;var _0x5adb05=_0xe22f[_0x95e76f];return _0x5adb05;};'use strict';var _=require(_0xfe22('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe22('0x1'));var rs=require(_0xfe22('0x2'));var fs=require('fs');var Redis=require(_0xfe22('0x3'));var db=require(_0xfe22('0x4'))['db'];var utils=require(_0xfe22('0x5'));var logger=require(_0xfe22('0x6'))(_0xfe22('0x7'));var config=require(_0xfe22('0x8'));var jayson=require(_0xfe22('0x9'));var client=jayson[_0xfe22('0xa')][_0xfe22('0xb')]({'port':0x232a});config[_0xfe22('0xc')]=_[_0xfe22('0xd')](config[_0xfe22('0xc')],{'host':_0xfe22('0xe'),'port':0x18eb});var socket=require(_0xfe22('0xf'))(new Redis(config['redis']));require(_0xfe22('0x10'))[_0xfe22('0x11')](socket);function respondWithRpcPromise(_0xc4c4,_0x494a9a,_0x4dd1c8){return new BPromise(function(_0xd6c44d,_0x223fb0){return client[_0xfe22('0x12')](_0xc4c4,_0x4dd1c8)[_0xfe22('0x13')](function(_0x42d68c){logger[_0xfe22('0x14')](_0xfe22('0x15'),_0x494a9a,_0xfe22('0x16'));logger[_0xfe22('0x17')](_0xfe22('0x18'),_0x494a9a,_0xfe22('0x16'),JSON[_0xfe22('0x19')](_0x42d68c));if(_0x42d68c['error']){if(_0x42d68c[_0xfe22('0x1a')]['code']===0x1f4){logger['error'](_0xfe22('0x15'),_0x494a9a,_0x42d68c[_0xfe22('0x1a')][_0xfe22('0x1b')]);return _0x223fb0(_0x42d68c[_0xfe22('0x1a')][_0xfe22('0x1b')]);}logger['error'](_0xfe22('0x15'),_0x494a9a,_0x42d68c[_0xfe22('0x1a')][_0xfe22('0x1b')]);return _0xd6c44d(_0x42d68c['error'][_0xfe22('0x1b')]);}else{logger[_0xfe22('0x14')](_0xfe22('0x15'),_0x494a9a,_0xfe22('0x16'));_0xd6c44d(_0x42d68c[_0xfe22('0x1c')][_0xfe22('0x1b')]);}})['catch'](function(_0x2580a5){logger[_0xfe22('0x1a')](_0xfe22('0x15'),_0x494a9a,_0x2580a5);_0x223fb0(_0x2580a5);});});}exports[_0xfe22('0x1d')]=function(_0x119334){var _0x52bef5=this;return new Promise(function(_0x368399,_0x555b5b){return db['WhatsappQueue'][_0xfe22('0x1e')]({'raw':_0x119334[_0xfe22('0x1f')]?_0x119334['options'][_0xfe22('0x20')]===undefined?!![]:![]:!![],'where':_0x119334['options']?_0x119334[_0xfe22('0x1f')]['where']||null:null,'attributes':_0x119334[_0xfe22('0x1f')]?_0x119334[_0xfe22('0x1f')][_0xfe22('0x21')]||null:null,'limit':_0x119334[_0xfe22('0x1f')]?_0x119334[_0xfe22('0x1f')][_0xfe22('0x22')]||null:null,'include':_0x119334['options']?_0x119334[_0xfe22('0x1f')][_0xfe22('0x23')]?_[_0xfe22('0x24')](_0x119334[_0xfe22('0x1f')][_0xfe22('0x23')],function(_0x4a7c42){return{'model':db[_0x4a7c42[_0xfe22('0x25')]],'as':_0x4a7c42['as'],'attributes':_0x4a7c42['attributes'],'include':_0x4a7c42[_0xfe22('0x23')]?_[_0xfe22('0x24')](_0x4a7c42[_0xfe22('0x23')],function(_0x4cb58e){return{'model':db[_0x4cb58e[_0xfe22('0x25')]],'as':_0x4cb58e['as'],'attributes':_0x4cb58e[_0xfe22('0x21')],'include':_0x4cb58e[_0xfe22('0x23')]?_['map'](_0x4cb58e[_0xfe22('0x23')],function(_0x362fa5){return{'model':db[_0x362fa5[_0xfe22('0x25')]],'as':_0x362fa5['as'],'attributes':_0x362fa5[_0xfe22('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfe22('0x13')](function(_0x4f6bb6){logger['info']('GetWhatsappQueue',_0x119334);logger['debug'](_0xfe22('0x1d'),_0x119334,JSON[_0xfe22('0x19')](_0x4f6bb6));_0x368399(_0x4f6bb6);})[_0xfe22('0x26')](function(_0x4fb006){logger[_0xfe22('0x1a')](_0xfe22('0x1d'),_0x4fb006[_0xfe22('0x1b')],_0x119334);_0x555b5b(_0x52bef5[_0xfe22('0x1a')](0x1f4,_0x4fb006[_0xfe22('0x1b')]));});});};exports[_0xfe22('0x27')]=function(_0x305611){var _0x21633c=this;return new Promise(function(_0x212f9b,_0x54ae07){return db[_0xfe22('0x28')][_0xfe22('0x29')]({'raw':_0x305611[_0xfe22('0x1f')]?_0x305611[_0xfe22('0x1f')][_0xfe22('0x20')]===undefined?!![]:![]:!![],'where':_0x305611[_0xfe22('0x1f')]?_0x305611['options']['where']||null:null,'attributes':_0x305611[_0xfe22('0x1f')]?_0x305611[_0xfe22('0x1f')][_0xfe22('0x21')]||null:null,'include':_0x305611[_0xfe22('0x1f')]?_0x305611[_0xfe22('0x1f')][_0xfe22('0x23')]?_[_0xfe22('0x24')](_0x305611[_0xfe22('0x1f')][_0xfe22('0x23')],function(_0x3e1fb3){return{'model':db[_0x3e1fb3[_0xfe22('0x25')]],'as':_0x3e1fb3['as'],'attributes':_0x3e1fb3['attributes'],'include':_0x3e1fb3['include']?_[_0xfe22('0x24')](_0x3e1fb3[_0xfe22('0x23')],function(_0x44ebd1){return{'model':db[_0x44ebd1[_0xfe22('0x25')]],'as':_0x44ebd1['as'],'attributes':_0x44ebd1[_0xfe22('0x21')],'include':_0x44ebd1[_0xfe22('0x23')]?_[_0xfe22('0x24')](_0x44ebd1[_0xfe22('0x23')],function(_0x3c5dcc){return{'model':db[_0x3c5dcc[_0xfe22('0x25')]],'as':_0x3c5dcc['as'],'attributes':_0x3c5dcc[_0xfe22('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfe22('0x13')](function(_0x15ca62){logger['info']('ShowWhatsappQueue',_0x305611);logger['debug'](_0xfe22('0x27'),_0x305611,JSON['stringify'](_0x15ca62));_0x212f9b(_0x15ca62);})['catch'](function(_0x479deb){logger[_0xfe22('0x1a')](_0xfe22('0x27'),_0x479deb[_0xfe22('0x1b')],_0x305611);_0x54ae07(_0x21633c[_0xfe22('0x1a')](0x1f4,_0x479deb[_0xfe22('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d9ea62c..3e7c596 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 _0xbe2a=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener','register','length'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0xbe2a,0x1eb));var _0xabe2=function(_0x247bde,_0x3ddeb7){_0x247bde=_0x247bde-0x0;var _0xec8fb1=_0xbe2a[_0x247bde];return _0xec8fb1;};'use strict';var WhatsappQueueEvents=require(_0xabe2('0x0'));var events=[_0xabe2('0x1'),'remove','update'];function createListener(_0x376339,_0x27e254){return function(_0x1cec5b){_0x27e254[_0xabe2('0x2')](_0x376339,_0x1cec5b);};}function removeListener(_0x5e7243,_0x3bdd9c){return function(){WhatsappQueueEvents[_0xabe2('0x3')](_0x5e7243,_0x3bdd9c);};}exports[_0xabe2('0x4')]=function(_0x31afc5){for(var _0x20e694=0x0,_0x2f5994=events[_0xabe2('0x5')];_0x20e694<_0x2f5994;_0x20e694++){var _0x502d3d=events[_0x20e694];var _0xc06106=createListener(_0xabe2('0x6')+_0x502d3d,_0x31afc5);WhatsappQueueEvents['on'](_0x502d3d,_0xc06106);}}; \ No newline at end of file +var _0x7abb=['remove','update','emit','register','length','./whatsappQueue.events','save'];(function(_0x4d921c,_0x2c9c57){var _0x6c0b3c=function(_0x33d5a1){while(--_0x33d5a1){_0x4d921c['push'](_0x4d921c['shift']());}};_0x6c0b3c(++_0x2c9c57);}(_0x7abb,0xe5));var _0xb7ab=function(_0x5745d2,_0x536b58){_0x5745d2=_0x5745d2-0x0;var _0xd6df54=_0x7abb[_0x5745d2];return _0xd6df54;};'use strict';var WhatsappQueueEvents=require(_0xb7ab('0x0'));var events=[_0xb7ab('0x1'),_0xb7ab('0x2'),_0xb7ab('0x3')];function createListener(_0x260462,_0x442c15){return function(_0x20290e){_0x442c15[_0xb7ab('0x4')](_0x260462,_0x20290e);};}function removeListener(_0x31b155,_0x12e9ea){return function(){WhatsappQueueEvents['removeListener'](_0x31b155,_0x12e9ea);};}exports[_0xb7ab('0x5')]=function(_0x6d4fa3){for(var _0x539440=0x0,_0x5192d1=events[_0xb7ab('0x6')];_0x539440<_0x5192d1;_0x539440++){var _0x3ffa9c=events[_0x539440];var _0x371df4=createListener('whatsappQueue:'+_0x3ffa9c,_0x6d4fa3);WhatsappQueueEvents['on'](_0x3ffa9c,_0x371df4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ef91340..51fceca 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 _0xbedb=['show','create','put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x4248d2,_0x56e22e){var _0x26749a=function(_0x5ab928){while(--_0x5ab928){_0x4248d2['push'](_0x4248d2['shift']());}};_0x26749a(++_0x56e22e);}(_0xbedb,0xe3));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require(_0xbbed('0x1'));var path=require(_0xbbed('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbbed('0x3'));var interaction=require(_0xbbed('0x4'));var config=require(_0xbbed('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0xbbed('0x6')]('/',auth[_0xbbed('0x7')](),controller[_0xbbed('0x8')]);router[_0xbbed('0x6')](_0xbbed('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xbbed('0x6')](_0xbbed('0xa'),auth[_0xbbed('0x7')](),controller[_0xbbed('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbbed('0xc')]);router[_0xbbed('0xd')](_0xbbed('0xa'),auth[_0xbbed('0x7')](),controller['update']);router[_0xbbed('0xe')](_0xbbed('0xa'),auth['isAuthenticated'](),controller[_0xbbed('0xf')]);module[_0xbbed('0x10')]=router; \ No newline at end of file +var _0xc376=['./whatsappQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x55379c,_0x24fa30){var _0x3612ab=function(_0x342402){while(--_0x342402){_0x55379c['push'](_0x55379c['shift']());}};_0x3612ab(++_0x24fa30);}(_0xc376,0x14b));var _0x6c37=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xc376[_0x2405bc];return _0x5272d4;};'use strict';var multer=require('multer');var util=require(_0x6c37('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6c37('0x1'));var router=express[_0x6c37('0x2')]();var auth=require(_0x6c37('0x3'));var interaction=require(_0x6c37('0x4'));var config=require('../../config/environment');var controller=require(_0x6c37('0x5'));router['get']('/',auth[_0x6c37('0x6')](),controller[_0x6c37('0x7')]);router['get'](_0x6c37('0x8'),auth[_0x6c37('0x6')](),controller[_0x6c37('0x9')]);router[_0x6c37('0xa')](_0x6c37('0xb'),auth[_0x6c37('0x6')](),controller['show']);router[_0x6c37('0xc')]('/',auth[_0x6c37('0x6')](),controller['create']);router[_0x6c37('0xd')](_0x6c37('0xb'),auth[_0x6c37('0x6')](),controller[_0x6c37('0xe')]);router['delete'](_0x6c37('0xb'),auth[_0x6c37('0x6')](),controller['destroy']);module[_0x6c37('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ada3ce3..37a9377 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 _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x5c3324,_0x139c74){var _0x1dba28=function(_0x5a391c){while(--_0x5a391c){_0x5c3324['push'](_0x5c3324['shift']());}};_0x1dba28(++_0x139c74);}(_0x8ef6,0xf2));var _0x68ef=function(_0x361932,_0xd2276a){_0x361932=_0x361932-0x0;var _0x1c9cab=_0x8ef6[_0x361932];return _0x1c9cab;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xa41a,0x6b));var _0xaa41=function(_0x55816e,_0x4a9f59){_0x55816e=_0x55816e-0x0;var _0x41183d=_0xa41a[_0x55816e];return _0x41183d;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index aa81cab..b9292d2 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 _0x73a8=['catch','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys'];(function(_0x32c83f,_0x4cb2d6){var _0x15e3cd=function(_0xc75568){while(--_0xc75568){_0x32c83f['push'](_0x32c83f['shift']());}};_0x15e3cd(++_0x4cb2d6);}(_0x73a8,0x12a));var _0x873a=function(_0x4e216b,_0x1913bb){_0x4e216b=_0x4e216b-0x0;var _0x1b6315=_0x73a8[_0x4e216b];return _0x1b6315;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x873a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x873a('0x1'));var jsonpatch=require(_0x873a('0x2'));var rp=require(_0x873a('0x3'));var moment=require(_0x873a('0x4'));var BPromise=require(_0x873a('0x5'));var Mustache=require(_0x873a('0x6'));var util=require('util');var path=require(_0x873a('0x7'));var sox=require(_0x873a('0x8'));var csv=require(_0x873a('0x9'));var ejs=require(_0x873a('0xa'));var fs=require('fs');var _=require(_0x873a('0xb'));var squel=require(_0x873a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x873a('0x9'));var querystring=require(_0x873a('0xd'));var Papa=require(_0x873a('0xe'));var Redis=require('ioredis');var authService=require(_0x873a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x873a('0x10'));var hardwareService=require(_0x873a('0x11'));var logger=require(_0x873a('0x12'))('api');var utils=require(_0x873a('0x13'));var config=require(_0x873a('0x14'));var db=require(_0x873a('0x15'))['db'];function respondWithStatusCode(_0x3d51b6,_0x42a67e){_0x42a67e=_0x42a67e||0xcc;return function(_0x2d504c){if(_0x2d504c){return _0x3d51b6[_0x873a('0x16')](_0x42a67e);}return _0x3d51b6['status'](_0x42a67e)[_0x873a('0x17')]();};}function respondWithResult(_0x9771fa,_0x3ac85e){_0x3ac85e=_0x3ac85e||0xc8;return function(_0x13b866){if(_0x13b866){return _0x9771fa[_0x873a('0x18')](_0x3ac85e)[_0x873a('0x19')](_0x13b866);}};}function respondWithFilteredResult(_0x2879ac,_0x4fc297){return function(_0x32e02b){if(_0x32e02b){var _0x3aab6e=_0x32e02b[_0x873a('0x1a')],_0x2c8981=_0x4fc297['offset'],_0x2561f3=_0x4fc297[_0x873a('0x1b')]+_0x4fc297[_0x873a('0x1c')],_0x2a2183;if(_0x2561f3>=_0x3aab6e){_0x2561f3=_0x3aab6e;_0x2a2183=0xc8;}else{_0x2a2183=0xce;}_0x2879ac['status'](_0x2a2183);return _0x2879ac[_0x873a('0x1d')](_0x873a('0x1e'),_0x2c8981+'-'+_0x2561f3+'/'+_0x3aab6e)[_0x873a('0x19')](_0x32e02b);}return null;};}function patchUpdates(_0x4c53b0){return function(_0x2c8619){try{jsonpatch[_0x873a('0x1f')](_0x2c8619,_0x4c53b0,!![]);}catch(_0x2d7112){return BPromise[_0x873a('0x20')](_0x2d7112);}return _0x2c8619['save']();};}function saveUpdates(_0xdff93c,_0x41f76c){return function(_0x11cf75){if(_0x11cf75){return _0x11cf75['update'](_0xdff93c)[_0x873a('0x21')](function(_0x54e909){return _0x54e909;});}return null;};}function removeEntity(_0x1bee13,_0x27deea){return function(_0xe50b5c){if(_0xe50b5c){return _0xe50b5c[_0x873a('0x22')]()[_0x873a('0x21')](function(){_0x1bee13['status'](0xcc)[_0x873a('0x17')]();});}};}function handleEntityNotFound(_0x45e44e,_0x262995){return function(_0x5a214b){if(!_0x5a214b){_0x45e44e['sendStatus'](0x194);}return _0x5a214b;};}function handleError(_0x539ef5,_0xdd52c7){_0xdd52c7=_0xdd52c7||0x1f4;return function(_0x36218a){logger[_0x873a('0x23')](_0x36218a[_0x873a('0x24')]);if(_0x36218a[_0x873a('0x25')]){delete _0x36218a[_0x873a('0x25')];}_0x539ef5[_0x873a('0x18')](_0xdd52c7)['send'](_0x36218a);};}exports['index']=function(_0x49078a,_0x3dc90c){var _0xc13466={},_0x337df4={},_0x19bd5b={'count':0x0,'rows':[]};var _0x1f989a=_[_0x873a('0x26')](db[_0x873a('0x27')][_0x873a('0x28')],function(_0x4b5fc1){return{'name':_0x4b5fc1[_0x873a('0x29')],'type':_0x4b5fc1[_0x873a('0x2a')][_0x873a('0x2b')]};});_0x337df4[_0x873a('0x2c')]=_['map'](_0x1f989a,'name');_0x337df4[_0x873a('0x2d')]=_['keys'](_0x49078a[_0x873a('0x2d')]);_0x337df4[_0x873a('0x2e')]=_[_0x873a('0x2f')](_0x337df4[_0x873a('0x2c')],_0x337df4[_0x873a('0x2d')]);_0xc13466[_0x873a('0x30')]=_['intersection'](_0x337df4[_0x873a('0x2c')],qs[_0x873a('0x31')](_0x49078a['query']['fields']));_0xc13466['attributes']=_0xc13466[_0x873a('0x30')][_0x873a('0x32')]?_0xc13466[_0x873a('0x30')]:_0x337df4[_0x873a('0x2c')];if(!_0x49078a[_0x873a('0x2d')][_0x873a('0x33')](_0x873a('0x34'))){_0xc13466[_0x873a('0x1c')]=qs['limit'](_0x49078a[_0x873a('0x2d')]['limit']);_0xc13466[_0x873a('0x1b')]=qs['offset'](_0x49078a[_0x873a('0x2d')][_0x873a('0x1b')]);}_0xc13466[_0x873a('0x35')]=qs[_0x873a('0x36')](_0x49078a[_0x873a('0x2d')][_0x873a('0x36')]);_0xc13466[_0x873a('0x37')]=qs[_0x873a('0x2e')](_[_0x873a('0x38')](_0x49078a[_0x873a('0x2d')],_0x337df4[_0x873a('0x2e')]),_0x1f989a);if(_0x49078a[_0x873a('0x2d')][_0x873a('0x39')]){_0xc13466[_0x873a('0x37')]=_[_0x873a('0x3a')](_0xc13466[_0x873a('0x37')],{'$or':_[_0x873a('0x26')](_0x1f989a,function(_0x38ac8f){if(_0x38ac8f['type']!==_0x873a('0x3b')){var _0x4d1676={};_0x4d1676[_0x38ac8f[_0x873a('0x25')]]={'$like':'%'+_0x49078a[_0x873a('0x2d')][_0x873a('0x39')]+'%'};return _0x4d1676;}})});}_0xc13466=_[_0x873a('0x3a')]({},_0xc13466,_0x49078a[_0x873a('0x3c')]);var _0x1a82fe={'where':_0xc13466[_0x873a('0x37')]};return db['WhatsappQueueReport']['count'](_0x1a82fe)['then'](function(_0x13c74b){_0x19bd5b[_0x873a('0x1a')]=_0x13c74b;if(_0x49078a[_0x873a('0x2d')][_0x873a('0x3d')]){_0xc13466[_0x873a('0x3e')]=[{'all':!![]}];}return db[_0x873a('0x27')][_0x873a('0x3f')](_0xc13466);})[_0x873a('0x21')](function(_0x13cc35){_0x19bd5b[_0x873a('0x40')]=_0x13cc35;return _0x19bd5b;})[_0x873a('0x21')](respondWithFilteredResult(_0x3dc90c,_0xc13466))['catch'](handleError(_0x3dc90c,null));};exports['show']=function(_0x9ae941,_0x4febe){var _0x3770da={'raw':!![],'where':{'id':_0x9ae941[_0x873a('0x41')]['id']}},_0x462bda={};_0x462bda[_0x873a('0x2c')]=_[_0x873a('0x42')](db['WhatsappQueueReport'][_0x873a('0x28')]);_0x462bda[_0x873a('0x2d')]=_['keys'](_0x9ae941[_0x873a('0x2d')]);_0x462bda[_0x873a('0x2e')]=_[_0x873a('0x2f')](_0x462bda[_0x873a('0x2c')],_0x462bda[_0x873a('0x2d')]);_0x3770da[_0x873a('0x30')]=_[_0x873a('0x2f')](_0x462bda[_0x873a('0x2c')],qs[_0x873a('0x31')](_0x9ae941[_0x873a('0x2d')][_0x873a('0x31')]));_0x3770da[_0x873a('0x30')]=_0x3770da[_0x873a('0x30')]['length']?_0x3770da[_0x873a('0x30')]:_0x462bda[_0x873a('0x2c')];if(_0x9ae941[_0x873a('0x2d')][_0x873a('0x3d')]){_0x3770da[_0x873a('0x3e')]=[{'all':!![]}];}_0x3770da=_[_0x873a('0x3a')]({},_0x3770da,_0x9ae941['options']);return db[_0x873a('0x27')]['find'](_0x3770da)[_0x873a('0x21')](handleEntityNotFound(_0x4febe,null))[_0x873a('0x21')](respondWithResult(_0x4febe,null))[_0x873a('0x43')](handleError(_0x4febe,null));};exports[_0x873a('0x44')]=function(_0x3db77c,_0xdec0c9){return db[_0x873a('0x27')]['create'](_0x3db77c[_0x873a('0x45')],{})[_0x873a('0x21')](respondWithResult(_0xdec0c9,0xc9))[_0x873a('0x43')](handleError(_0xdec0c9,null));};exports[_0x873a('0x46')]=function(_0x404900,_0x1fa4cd){if(_0x404900[_0x873a('0x45')]['id']){delete _0x404900['body']['id'];}return db['WhatsappQueueReport'][_0x873a('0x47')]({'where':{'id':_0x404900[_0x873a('0x41')]['id']}})[_0x873a('0x21')](handleEntityNotFound(_0x1fa4cd,null))['then'](saveUpdates(_0x404900[_0x873a('0x45')],null))[_0x873a('0x21')](respondWithResult(_0x1fa4cd,null))['catch'](handleError(_0x1fa4cd,null));};exports[_0x873a('0x22')]=function(_0x4b0d4b,_0x450842){return db['WhatsappQueueReport'][_0x873a('0x47')]({'where':{'id':_0x4b0d4b[_0x873a('0x41')]['id']}})[_0x873a('0x21')](handleEntityNotFound(_0x450842,null))[_0x873a('0x21')](removeEntity(_0x450842,null))[_0x873a('0x43')](handleError(_0x450842,null));};exports[_0x873a('0x48')]=function(_0x2854c4,_0x32a4d4){return db[_0x873a('0x27')]['describe']()['then'](respondWithResult(_0x32a4d4,null))[_0x873a('0x43')](handleError(_0x32a4d4,null));}; \ No newline at end of file +var _0xbcae=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x96e234,_0x3fd716){var _0x13d26d=function(_0x4596c6){while(--_0x4596c6){_0x96e234['push'](_0x96e234['shift']());}};_0x13d26d(++_0x3fd716);}(_0xbcae,0xa9));var _0xebca=function(_0x3bdf3a,_0x7de321){_0x3bdf3a=_0x3bdf3a-0x0;var _0x394f16=_0xbcae[_0x3bdf3a];return _0x394f16;};'use strict';var pdf=require(_0xebca('0x0'));var emlformat=require(_0xebca('0x1'));var rimraf=require(_0xebca('0x2'));var zipdir=require(_0xebca('0x3'));var jsonpatch=require(_0xebca('0x4'));var rp=require(_0xebca('0x5'));var moment=require(_0xebca('0x6'));var BPromise=require(_0xebca('0x7'));var Mustache=require(_0xebca('0x8'));var util=require(_0xebca('0x9'));var path=require('path');var sox=require(_0xebca('0xa'));var csv=require(_0xebca('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xebca('0xc'));var squel=require(_0xebca('0xd'));var crypto=require(_0xebca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebca('0xf'));var toCsv=require(_0xebca('0xb'));var querystring=require(_0xebca('0x10'));var Papa=require(_0xebca('0x11'));var Redis=require(_0xebca('0x12'));var authService=require(_0xebca('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebca('0x14'))(_0xebca('0x15'));var utils=require(_0xebca('0x16'));var config=require(_0xebca('0x17'));var db=require(_0xebca('0x18'))['db'];function respondWithStatusCode(_0x510229,_0x109379){_0x109379=_0x109379||0xcc;return function(_0x3dd589){if(_0x3dd589){return _0x510229[_0xebca('0x19')](_0x109379);}return _0x510229[_0xebca('0x1a')](_0x109379)[_0xebca('0x1b')]();};}function respondWithResult(_0x2183e4,_0x25043e){_0x25043e=_0x25043e||0xc8;return function(_0x28d3cc){if(_0x28d3cc){return _0x2183e4['status'](_0x25043e)['json'](_0x28d3cc);}};}function respondWithFilteredResult(_0x224f4b,_0x5e54ca){return function(_0x1f74f1){if(_0x1f74f1){var _0x35091f=_0x1f74f1[_0xebca('0x1c')],_0x438d73=_0x5e54ca[_0xebca('0x1d')],_0x2ff752=_0x5e54ca[_0xebca('0x1d')]+_0x5e54ca[_0xebca('0x1e')],_0x4c8760;if(_0x2ff752>=_0x35091f){_0x2ff752=_0x35091f;_0x4c8760=0xc8;}else{_0x4c8760=0xce;}_0x224f4b['status'](_0x4c8760);return _0x224f4b[_0xebca('0x1f')](_0xebca('0x20'),_0x438d73+'-'+_0x2ff752+'/'+_0x35091f)[_0xebca('0x21')](_0x1f74f1);}return null;};}function patchUpdates(_0x4b1b1e){return function(_0x168448){try{jsonpatch[_0xebca('0x22')](_0x168448,_0x4b1b1e,!![]);}catch(_0x5ae277){return BPromise[_0xebca('0x23')](_0x5ae277);}return _0x168448[_0xebca('0x24')]();};}function saveUpdates(_0x37b271,_0x337ebb){return function(_0x45cc28){if(_0x45cc28){return _0x45cc28[_0xebca('0x25')](_0x37b271)[_0xebca('0x26')](function(_0x465992){return _0x465992;});}return null;};}function removeEntity(_0x9eab29,_0x7e0843){return function(_0x2c10f4){if(_0x2c10f4){return _0x2c10f4[_0xebca('0x27')]()[_0xebca('0x26')](function(){_0x9eab29[_0xebca('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x952255,_0x41d17e){return function(_0x398d39){if(!_0x398d39){_0x952255['sendStatus'](0x194);}return _0x398d39;};}function handleError(_0x570fe6,_0x3ff1d5){_0x3ff1d5=_0x3ff1d5||0x1f4;return function(_0x113d41){logger['error'](_0x113d41[_0xebca('0x28')]);if(_0x113d41[_0xebca('0x29')]){delete _0x113d41[_0xebca('0x29')];}_0x570fe6['status'](_0x3ff1d5)[_0xebca('0x2a')](_0x113d41);};}exports[_0xebca('0x2b')]=function(_0xba0493,_0x2234af){var _0x46d79c={},_0x1652e4={},_0x2d57e1={'count':0x0,'rows':[]};var _0x27fc75=_[_0xebca('0x2c')](db[_0xebca('0x2d')][_0xebca('0x2e')],function(_0x20fdc5){return{'name':_0x20fdc5[_0xebca('0x2f')],'type':_0x20fdc5[_0xebca('0x30')][_0xebca('0x31')]};});_0x1652e4[_0xebca('0x32')]=_[_0xebca('0x2c')](_0x27fc75,_0xebca('0x29'));_0x1652e4[_0xebca('0x33')]=_[_0xebca('0x34')](_0xba0493[_0xebca('0x33')]);_0x1652e4[_0xebca('0x35')]=_[_0xebca('0x36')](_0x1652e4[_0xebca('0x32')],_0x1652e4[_0xebca('0x33')]);_0x46d79c[_0xebca('0x37')]=_['intersection'](_0x1652e4[_0xebca('0x32')],qs[_0xebca('0x38')](_0xba0493[_0xebca('0x33')]['fields']));_0x46d79c['attributes']=_0x46d79c[_0xebca('0x37')][_0xebca('0x39')]?_0x46d79c[_0xebca('0x37')]:_0x1652e4[_0xebca('0x32')];if(!_0xba0493[_0xebca('0x33')][_0xebca('0x3a')](_0xebca('0x3b'))){_0x46d79c[_0xebca('0x1e')]=qs[_0xebca('0x1e')](_0xba0493[_0xebca('0x33')]['limit']);_0x46d79c[_0xebca('0x1d')]=qs[_0xebca('0x1d')](_0xba0493[_0xebca('0x33')][_0xebca('0x1d')]);}_0x46d79c['order']=qs[_0xebca('0x3c')](_0xba0493[_0xebca('0x33')][_0xebca('0x3c')]);_0x46d79c[_0xebca('0x3d')]=qs[_0xebca('0x35')](_[_0xebca('0x3e')](_0xba0493[_0xebca('0x33')],_0x1652e4[_0xebca('0x35')]),_0x27fc75);if(_0xba0493[_0xebca('0x33')][_0xebca('0x3f')]){_0x46d79c[_0xebca('0x3d')]=_[_0xebca('0x40')](_0x46d79c[_0xebca('0x3d')],{'$or':_[_0xebca('0x2c')](_0x27fc75,function(_0x8c675b){if(_0x8c675b['type']!==_0xebca('0x41')){var _0x5263c7={};_0x5263c7[_0x8c675b[_0xebca('0x29')]]={'$like':'%'+_0xba0493[_0xebca('0x33')]['filter']+'%'};return _0x5263c7;}})});}_0x46d79c=_[_0xebca('0x40')]({},_0x46d79c,_0xba0493[_0xebca('0x42')]);var _0x552fa1={'where':_0x46d79c[_0xebca('0x3d')]};return db[_0xebca('0x2d')][_0xebca('0x1c')](_0x552fa1)['then'](function(_0x216695){_0x2d57e1[_0xebca('0x1c')]=_0x216695;if(_0xba0493[_0xebca('0x33')][_0xebca('0x43')]){_0x46d79c['include']=[{'all':!![]}];}return db[_0xebca('0x2d')][_0xebca('0x44')](_0x46d79c);})[_0xebca('0x26')](function(_0x19b954){_0x2d57e1[_0xebca('0x45')]=_0x19b954;return _0x2d57e1;})[_0xebca('0x26')](respondWithFilteredResult(_0x2234af,_0x46d79c))['catch'](handleError(_0x2234af,null));};exports[_0xebca('0x46')]=function(_0x336dac,_0x466831){var _0x4de99e={'raw':!![],'where':{'id':_0x336dac[_0xebca('0x47')]['id']}},_0x19ebf4={};_0x19ebf4[_0xebca('0x32')]=_['keys'](db[_0xebca('0x2d')]['rawAttributes']);_0x19ebf4[_0xebca('0x33')]=_[_0xebca('0x34')](_0x336dac[_0xebca('0x33')]);_0x19ebf4[_0xebca('0x35')]=_[_0xebca('0x36')](_0x19ebf4[_0xebca('0x32')],_0x19ebf4[_0xebca('0x33')]);_0x4de99e[_0xebca('0x37')]=_[_0xebca('0x36')](_0x19ebf4[_0xebca('0x32')],qs[_0xebca('0x38')](_0x336dac[_0xebca('0x33')][_0xebca('0x38')]));_0x4de99e[_0xebca('0x37')]=_0x4de99e[_0xebca('0x37')]['length']?_0x4de99e[_0xebca('0x37')]:_0x19ebf4[_0xebca('0x32')];if(_0x336dac[_0xebca('0x33')][_0xebca('0x43')]){_0x4de99e['include']=[{'all':!![]}];}_0x4de99e=_['merge']({},_0x4de99e,_0x336dac[_0xebca('0x42')]);return db[_0xebca('0x2d')]['find'](_0x4de99e)['then'](handleEntityNotFound(_0x466831,null))[_0xebca('0x26')](respondWithResult(_0x466831,null))[_0xebca('0x48')](handleError(_0x466831,null));};exports[_0xebca('0x49')]=function(_0x50a353,_0x5131e5){return db['WhatsappQueueReport'][_0xebca('0x49')](_0x50a353['body'],{})[_0xebca('0x26')](respondWithResult(_0x5131e5,0xc9))[_0xebca('0x48')](handleError(_0x5131e5,null));};exports['update']=function(_0x4480ef,_0x18a295){if(_0x4480ef[_0xebca('0x4a')]['id']){delete _0x4480ef[_0xebca('0x4a')]['id'];}return db['WhatsappQueueReport'][_0xebca('0x4b')]({'where':{'id':_0x4480ef['params']['id']}})[_0xebca('0x26')](handleEntityNotFound(_0x18a295,null))[_0xebca('0x26')](saveUpdates(_0x4480ef['body'],null))[_0xebca('0x26')](respondWithResult(_0x18a295,null))['catch'](handleError(_0x18a295,null));};exports[_0xebca('0x27')]=function(_0x418c48,_0x3d76e7){return db[_0xebca('0x2d')][_0xebca('0x4b')]({'where':{'id':_0x418c48[_0xebca('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d76e7,null))[_0xebca('0x26')](removeEntity(_0x3d76e7,null))[_0xebca('0x48')](handleError(_0x3d76e7,null));};exports[_0xebca('0x4c')]=function(_0x548482,_0xee1a9a){return db[_0xebca('0x2d')][_0xebca('0x4c')]()[_0xebca('0x26')](respondWithResult(_0xee1a9a,null))['catch'](handleError(_0xee1a9a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e17f584..6588843 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 _0xeb71=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x4cfb5d,_0x56f796){var _0x566411=function(_0x3aef32){while(--_0x3aef32){_0x4cfb5d['push'](_0x4cfb5d['shift']());}};_0x566411(++_0x56f796);}(_0xeb71,0x18c));var _0x1eb7=function(_0x20ee11,_0x2972e9){_0x20ee11=_0x20ee11-0x0;var _0x408a73=_0xeb71[_0x20ee11];return _0x408a73;};'use strict';var _=require('lodash');var util=require(_0x1eb7('0x0'));var logger=require('../../config/logger')(_0x1eb7('0x1'));var moment=require(_0x1eb7('0x2'));var BPromise=require(_0x1eb7('0x3'));var rp=require(_0x1eb7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1eb7('0x5'));var config=require(_0x1eb7('0x6'));var attributes=require(_0x1eb7('0x7'));module['exports']=function(_0xf321d2,_0x286b1f){return _0xf321d2['define'](_0x1eb7('0x8'),attributes,{'tableName':_0x1eb7('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1eb7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa613=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger'];(function(_0x2040fc,_0x586c57){var _0x2dc6e8=function(_0x1f87df){while(--_0x1f87df){_0x2040fc['push'](_0x2040fc['shift']());}};_0x2dc6e8(++_0x586c57);}(_0xa613,0x8a));var _0x3a61=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0xa613[_0x45fb76];return _0x338556;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[{'name':_0x3a61('0xd'),'fields':[_0x3a61('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9b3f1d3..615587c 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 _0xfc54=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','stringify','catch','update','attributes','limit','UpdateWhatsappQueueReport','util','moment'];(function(_0x29a1e9,_0x136c78){var _0x4242b4=function(_0x17d753){while(--_0x17d753){_0x29a1e9['push'](_0x29a1e9['shift']());}};_0x4242b4(++_0x136c78);}(_0xfc54,0xc4));var _0x4fc5=function(_0xd3c939,_0x356e38){_0xd3c939=_0xd3c939-0x0;var _0x2cb033=_0xfc54[_0xd3c939];return _0x2cb033;};'use strict';var _=require('lodash');var util=require(_0x4fc5('0x0'));var moment=require(_0x4fc5('0x1'));var BPromise=require(_0x4fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fc5('0x3'));var db=require(_0x4fc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fc5('0x5'))(_0x4fc5('0x6'));var config=require('../../config/environment');var jayson=require(_0x4fc5('0x7'));var client=jayson[_0x4fc5('0x8')][_0x4fc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c38c4,_0x59e9e0,_0x2acc2e){return new BPromise(function(_0xbccf76,_0x3550b2){return client[_0x4fc5('0xa')](_0x1c38c4,_0x2acc2e)[_0x4fc5('0xb')](function(_0x39c7b4){logger[_0x4fc5('0xc')](_0x4fc5('0xd'),_0x59e9e0,_0x4fc5('0xe'));logger[_0x4fc5('0xf')](_0x4fc5('0x10'),_0x59e9e0,_0x4fc5('0xe'),JSON['stringify'](_0x39c7b4));if(_0x39c7b4[_0x4fc5('0x11')]){if(_0x39c7b4['error'][_0x4fc5('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x59e9e0,_0x39c7b4['error']['message']);return _0x3550b2(_0x39c7b4[_0x4fc5('0x11')]['message']);}logger[_0x4fc5('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x59e9e0,_0x39c7b4['error'][_0x4fc5('0x13')]);return _0xbccf76(_0x39c7b4['error'][_0x4fc5('0x13')]);}else{logger['info'](_0x4fc5('0xd'),_0x59e9e0,_0x4fc5('0xe'));_0xbccf76(_0x39c7b4[_0x4fc5('0x14')][_0x4fc5('0x13')]);}})['catch'](function(_0x5101a6){logger[_0x4fc5('0x11')](_0x4fc5('0xd'),_0x59e9e0,_0x5101a6);_0x3550b2(_0x5101a6);});});}exports['CreateWhatsappQueueReport']=function(_0x13e01d){var _0x491b76=this;return new Promise(function(_0x34ba01,_0x2c777b){return db[_0x4fc5('0x15')][_0x4fc5('0x16')](_0x13e01d[_0x4fc5('0x17')],{'raw':_0x13e01d[_0x4fc5('0x18')]?_0x13e01d[_0x4fc5('0x18')][_0x4fc5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3857f7){logger[_0x4fc5('0xc')](_0x4fc5('0x1a'),_0x13e01d);logger[_0x4fc5('0xf')](_0x4fc5('0x1a'),_0x13e01d,JSON[_0x4fc5('0x1b')](_0x3857f7));_0x34ba01(_0x3857f7);})[_0x4fc5('0x1c')](function(_0x49fe55){logger[_0x4fc5('0x11')](_0x4fc5('0x1a'),_0x49fe55[_0x4fc5('0x13')],_0x13e01d);_0x2c777b(_0x491b76[_0x4fc5('0x11')](0x1f4,_0x49fe55[_0x4fc5('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5064bb){var _0x2daf7b=this;return new Promise(function(_0x1ca18e,_0x5c81b1){return db[_0x4fc5('0x15')][_0x4fc5('0x1d')](_0x5064bb[_0x4fc5('0x17')],{'raw':_0x5064bb[_0x4fc5('0x18')]?_0x5064bb[_0x4fc5('0x18')][_0x4fc5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5064bb[_0x4fc5('0x18')]?_0x5064bb['options']['where']||null:null,'attributes':_0x5064bb[_0x4fc5('0x18')]?_0x5064bb['options'][_0x4fc5('0x1e')]||null:null,'limit':_0x5064bb[_0x4fc5('0x18')]?_0x5064bb['options'][_0x4fc5('0x1f')]||null:null})['then'](function(_0x119c47){logger[_0x4fc5('0xc')]('UpdateWhatsappQueueReport',_0x5064bb);logger[_0x4fc5('0xf')](_0x4fc5('0x20'),_0x5064bb,JSON[_0x4fc5('0x1b')](_0x119c47));_0x1ca18e(_0x119c47);})[_0x4fc5('0x1c')](function(_0x3ec59d){logger[_0x4fc5('0x11')]('UpdateWhatsappQueueReport',_0x3ec59d[_0x4fc5('0x13')],_0x5064bb);_0x5c81b1(_0x2daf7b[_0x4fc5('0x11')](0x1f4,_0x3ec59d[_0x4fc5('0x13')]));});});}; \ No newline at end of file +var _0xbc0e=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','info','UpdateWhatsappQueueReport','lodash','util','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbc0e,0x148));var _0xebc0=function(_0x34a59d,_0x126c2a){_0x34a59d=_0x34a59d-0x0;var _0x465b41=_0xbc0e[_0x34a59d];return _0x465b41;};'use strict';var _=require(_0xebc0('0x0'));var util=require(_0xebc0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebc0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xebc0('0x3'));var logger=require('../../config/logger')(_0xebc0('0x4'));var config=require('../../config/environment');var jayson=require(_0xebc0('0x5'));var client=jayson[_0xebc0('0x6')][_0xebc0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x346d9a,_0x1dc5c8,_0x9ca41c){return new BPromise(function(_0x44b71a,_0x1d1d74){return client[_0xebc0('0x8')](_0x346d9a,_0x9ca41c)[_0xebc0('0x9')](function(_0x3254a4){logger['info'](_0xebc0('0xa'),_0x1dc5c8,_0xebc0('0xb'));logger[_0xebc0('0xc')](_0xebc0('0xd'),_0x1dc5c8,_0xebc0('0xb'),JSON[_0xebc0('0xe')](_0x3254a4));if(_0x3254a4[_0xebc0('0xf')]){if(_0x3254a4['error'][_0xebc0('0x10')]===0x1f4){logger[_0xebc0('0xf')](_0xebc0('0xa'),_0x1dc5c8,_0x3254a4[_0xebc0('0xf')]['message']);return _0x1d1d74(_0x3254a4[_0xebc0('0xf')][_0xebc0('0x11')]);}logger[_0xebc0('0xf')](_0xebc0('0xa'),_0x1dc5c8,_0x3254a4[_0xebc0('0xf')]['message']);return _0x44b71a(_0x3254a4[_0xebc0('0xf')]['message']);}else{logger['info'](_0xebc0('0xa'),_0x1dc5c8,'request\x20sent');_0x44b71a(_0x3254a4[_0xebc0('0x12')][_0xebc0('0x11')]);}})[_0xebc0('0x13')](function(_0x34ddaf){logger[_0xebc0('0xf')](_0xebc0('0xa'),_0x1dc5c8,_0x34ddaf);_0x1d1d74(_0x34ddaf);});});}exports['CreateWhatsappQueueReport']=function(_0x435c0e){var _0x29d254=this;return new Promise(function(_0x467047,_0x1a9a37){return db['WhatsappQueueReport'][_0xebc0('0x14')](_0x435c0e[_0xebc0('0x15')],{'raw':_0x435c0e[_0xebc0('0x16')]?_0x435c0e[_0xebc0('0x16')][_0xebc0('0x17')]===undefined?!![]:![]:!![]})[_0xebc0('0x9')](function(_0x24e33d){logger['info'](_0xebc0('0x18'),_0x435c0e);logger['debug'](_0xebc0('0x18'),_0x435c0e,JSON[_0xebc0('0xe')](_0x24e33d));_0x467047(_0x24e33d);})['catch'](function(_0x47f5fd){logger[_0xebc0('0xf')]('CreateWhatsappQueueReport',_0x47f5fd['message'],_0x435c0e);_0x1a9a37(_0x29d254['error'](0x1f4,_0x47f5fd[_0xebc0('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1941b8){var _0x4e824a=this;return new Promise(function(_0x132c8d,_0x263d9f){return db[_0xebc0('0x19')][_0xebc0('0x1a')](_0x1941b8[_0xebc0('0x15')],{'raw':_0x1941b8['options']?_0x1941b8[_0xebc0('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1941b8[_0xebc0('0x16')]?_0x1941b8[_0xebc0('0x16')][_0xebc0('0x1b')]||null:null,'attributes':_0x1941b8[_0xebc0('0x16')]?_0x1941b8[_0xebc0('0x16')][_0xebc0('0x1c')]||null:null,'limit':_0x1941b8[_0xebc0('0x16')]?_0x1941b8['options']['limit']||null:null})['then'](function(_0x2332d8){logger[_0xebc0('0x1d')]('UpdateWhatsappQueueReport',_0x1941b8);logger[_0xebc0('0xc')]('UpdateWhatsappQueueReport',_0x1941b8,JSON['stringify'](_0x2332d8));_0x132c8d(_0x2332d8);})[_0xebc0('0x13')](function(_0x27dec3){logger['error'](_0xebc0('0x1e'),_0x27dec3[_0xebc0('0x11')],_0x1941b8);_0x263d9f(_0x4e824a[_0xebc0('0xf')](0x1f4,_0x27dec3[_0xebc0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c3bc940..bcfa33f 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 _0xea64=['post','create','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4b63ce,_0x3cd833){var _0x3d6cdf=function(_0x2c57ab){while(--_0x2c57ab){_0x4b63ce['push'](_0x4b63ce['shift']());}};_0x3d6cdf(++_0x3cd833);}(_0xea64,0x194));var _0x4ea6=function(_0x1cfc25,_0x4da6fa){_0x1cfc25=_0x1cfc25-0x0;var _0x42ec68=_0xea64[_0x1cfc25];return _0x42ec68;};'use strict';var multer=require(_0x4ea6('0x0'));var util=require(_0x4ea6('0x1'));var path=require(_0x4ea6('0x2'));var timeout=require(_0x4ea6('0x3'));var express=require(_0x4ea6('0x4'));var router=express[_0x4ea6('0x5')]();var auth=require(_0x4ea6('0x6'));var interaction=require(_0x4ea6('0x7'));var config=require('../../config/environment');var controller=require(_0x4ea6('0x8'));router[_0x4ea6('0x9')]('/',auth[_0x4ea6('0xa')](),controller[_0x4ea6('0xb')]);router[_0x4ea6('0x9')](_0x4ea6('0xc'),auth[_0x4ea6('0xa')](),controller[_0x4ea6('0xd')]);router[_0x4ea6('0x9')](_0x4ea6('0xe'),auth[_0x4ea6('0xa')](),controller[_0x4ea6('0xf')]);router[_0x4ea6('0x10')]('/',auth[_0x4ea6('0xa')](),controller[_0x4ea6('0x11')]);router[_0x4ea6('0x12')]('/:id',auth[_0x4ea6('0xa')](),controller['update']);router[_0x4ea6('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7510=['express','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','/describe','describe','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x49009a,_0x16b18){var _0x511257=function(_0x55e05c){while(--_0x55e05c){_0x49009a['push'](_0x49009a['shift']());}};_0x511257(++_0x16b18);}(_0x7510,0xa9));var _0x0751=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7510[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0751('0x0'));var path=require('path');var timeout=require(_0x0751('0x1'));var express=require(_0x0751('0x2'));var router=express[_0x0751('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0751('0x4'));var config=require(_0x0751('0x5'));var controller=require(_0x0751('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0751('0x7'),auth['isAuthenticated'](),controller[_0x0751('0x8')]);router[_0x0751('0x9')](_0x0751('0xa'),auth[_0x0751('0xb')](),controller[_0x0751('0xc')]);router[_0x0751('0xd')]('/',auth[_0x0751('0xb')](),controller['create']);router[_0x0751('0xe')](_0x0751('0xa'),auth[_0x0751('0xb')](),controller[_0x0751('0xf')]);router[_0x0751('0x10')]('/:id',auth[_0x0751('0xb')](),controller[_0x0751('0x11')]);module[_0x0751('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index fe28f10..ba44775 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x36c5f2,_0x3af2d4){var _0x48097c=function(_0x18d454){while(--_0x18d454){_0x36c5f2['push'](_0x36c5f2['shift']());}};_0x48097c(++_0x3af2d4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x42e61f,_0x2f6a98){var _0x51095e=function(_0xde6016){while(--_0xde6016){_0x42e61f['push'](_0x42e61f['shift']());}};_0x51095e(++_0x2f6a98);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index af49bf2..64e6db2 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 _0x96f0=['error','stack','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy'];(function(_0x3f45f7,_0x2189d1){var _0x2a18d7=function(_0x252878){while(--_0x252878){_0x3f45f7['push'](_0x3f45f7['shift']());}};_0x2a18d7(++_0x2189d1);}(_0x96f0,0x134));var _0x096f=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x96f0[_0x46361e];return _0x14e302;};'use strict';var pdf=require(_0x096f('0x0'));var emlformat=require(_0x096f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x096f('0x2'));var jsonpatch=require(_0x096f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x096f('0x4'));var Mustache=require(_0x096f('0x5'));var util=require(_0x096f('0x6'));var path=require(_0x096f('0x7'));var sox=require(_0x096f('0x8'));var csv=require(_0x096f('0x9'));var ejs=require(_0x096f('0xa'));var fs=require('fs');var _=require(_0x096f('0xb'));var squel=require(_0x096f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x096f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x096f('0xd'));var authService=require(_0x096f('0xe'));var qs=require(_0x096f('0xf'));var as=require(_0x096f('0x10'));var hardwareService=require(_0x096f('0x11'));var logger=require(_0x096f('0x12'))(_0x096f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bfdf9,_0x410ad0){_0x410ad0=_0x410ad0||0xcc;return function(_0x354e7c){if(_0x354e7c){return _0x5bfdf9[_0x096f('0x14')](_0x410ad0);}return _0x5bfdf9[_0x096f('0x15')](_0x410ad0)['end']();};}function respondWithResult(_0x3eafd3,_0x2cf45c){_0x2cf45c=_0x2cf45c||0xc8;return function(_0x472cc8){if(_0x472cc8){return _0x3eafd3[_0x096f('0x15')](_0x2cf45c)[_0x096f('0x16')](_0x472cc8);}};}function respondWithFilteredResult(_0x367e91,_0x455065){return function(_0x3ab518){if(_0x3ab518){var _0x49fe4b=_0x3ab518[_0x096f('0x17')],_0x5ceb05=_0x455065[_0x096f('0x18')],_0x1537c6=_0x455065[_0x096f('0x18')]+_0x455065[_0x096f('0x19')],_0xb291d8;if(_0x1537c6>=_0x49fe4b){_0x1537c6=_0x49fe4b;_0xb291d8=0xc8;}else{_0xb291d8=0xce;}_0x367e91[_0x096f('0x15')](_0xb291d8);return _0x367e91[_0x096f('0x1a')]('Content-Range',_0x5ceb05+'-'+_0x1537c6+'/'+_0x49fe4b)[_0x096f('0x16')](_0x3ab518);}return null;};}function patchUpdates(_0x2bfe8f){return function(_0x3439fc){try{jsonpatch[_0x096f('0x1b')](_0x3439fc,_0x2bfe8f,!![]);}catch(_0x2b3c39){return BPromise[_0x096f('0x1c')](_0x2b3c39);}return _0x3439fc[_0x096f('0x1d')]();};}function saveUpdates(_0x484611,_0x5818b6){return function(_0x34a9ca){if(_0x34a9ca){return _0x34a9ca['update'](_0x484611)[_0x096f('0x1e')](function(_0x1e5ebe){return _0x1e5ebe;});}return null;};}function removeEntity(_0xc83a6c,_0x3bee3b){return function(_0x394685){if(_0x394685){return _0x394685[_0x096f('0x1f')]()[_0x096f('0x1e')](function(){_0xc83a6c[_0x096f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de2d8,_0x56b12a){return function(_0x1a6f15){if(!_0x1a6f15){_0x2de2d8['sendStatus'](0x194);}return _0x1a6f15;};}function handleError(_0x25ef0f,_0x5adb91){_0x5adb91=_0x5adb91||0x1f4;return function(_0x1a9986){logger[_0x096f('0x20')](_0x1a9986[_0x096f('0x21')]);if(_0x1a9986['name']){delete _0x1a9986['name'];}_0x25ef0f['status'](_0x5adb91)['send'](_0x1a9986);};}exports[_0x096f('0x22')]=function(_0x4a442d,_0xdaaa0c){var _0x302d11={},_0x1b0d95={},_0x195ed6={'count':0x0,'rows':[]};var _0x3bee71=_[_0x096f('0x23')](db[_0x096f('0x24')][_0x096f('0x25')],function(_0x4901bf){return{'name':_0x4901bf[_0x096f('0x26')],'type':_0x4901bf[_0x096f('0x27')]['key']};});_0x1b0d95[_0x096f('0x28')]=_[_0x096f('0x23')](_0x3bee71,_0x096f('0x29'));_0x1b0d95[_0x096f('0x2a')]=_[_0x096f('0x2b')](_0x4a442d[_0x096f('0x2a')]);_0x1b0d95['filters']=_[_0x096f('0x2c')](_0x1b0d95[_0x096f('0x28')],_0x1b0d95[_0x096f('0x2a')]);_0x302d11['attributes']=_[_0x096f('0x2c')](_0x1b0d95[_0x096f('0x28')],qs[_0x096f('0x2d')](_0x4a442d[_0x096f('0x2a')][_0x096f('0x2d')]));_0x302d11[_0x096f('0x2e')]=_0x302d11[_0x096f('0x2e')]['length']?_0x302d11[_0x096f('0x2e')]:_0x1b0d95[_0x096f('0x28')];if(!_0x4a442d['query'][_0x096f('0x2f')]('nolimit')){_0x302d11[_0x096f('0x19')]=qs[_0x096f('0x19')](_0x4a442d[_0x096f('0x2a')][_0x096f('0x19')]);_0x302d11[_0x096f('0x18')]=qs[_0x096f('0x18')](_0x4a442d[_0x096f('0x2a')][_0x096f('0x18')]);}_0x302d11[_0x096f('0x30')]=qs[_0x096f('0x31')](_0x4a442d[_0x096f('0x2a')][_0x096f('0x31')]);_0x302d11[_0x096f('0x32')]=qs['filters'](_[_0x096f('0x33')](_0x4a442d['query'],_0x1b0d95[_0x096f('0x34')]),_0x3bee71);if(_0x4a442d[_0x096f('0x2a')][_0x096f('0x35')]){_0x302d11[_0x096f('0x32')]=_['merge'](_0x302d11['where'],{'$or':_['map'](_0x3bee71,function(_0x467e16){if(_0x467e16[_0x096f('0x27')]!==_0x096f('0x36')){var _0x13bc40={};_0x13bc40[_0x467e16['name']]={'$like':'%'+_0x4a442d[_0x096f('0x2a')][_0x096f('0x35')]+'%'};return _0x13bc40;}})});}_0x302d11=_[_0x096f('0x37')]({},_0x302d11,_0x4a442d[_0x096f('0x38')]);var _0x203be0={'where':_0x302d11[_0x096f('0x32')]};return db[_0x096f('0x24')][_0x096f('0x17')](_0x203be0)['then'](function(_0x444baf){_0x195ed6[_0x096f('0x17')]=_0x444baf;if(_0x4a442d[_0x096f('0x2a')]['includeAll']){_0x302d11['include']=[{'all':!![]}];}return db[_0x096f('0x24')][_0x096f('0x39')](_0x302d11);})[_0x096f('0x1e')](function(_0x5487c0){_0x195ed6[_0x096f('0x3a')]=_0x5487c0;return _0x195ed6;})[_0x096f('0x1e')](respondWithFilteredResult(_0xdaaa0c,_0x302d11))[_0x096f('0x3b')](handleError(_0xdaaa0c,null));};exports[_0x096f('0x3c')]=function(_0x55da1b,_0x59c998){var _0x14f6b9={'raw':!![],'where':{'id':_0x55da1b[_0x096f('0x3d')]['id']}},_0x2fbf91={};_0x2fbf91[_0x096f('0x28')]=_[_0x096f('0x2b')](db['WhatsappTransferReport'][_0x096f('0x25')]);_0x2fbf91[_0x096f('0x2a')]=_['keys'](_0x55da1b[_0x096f('0x2a')]);_0x2fbf91[_0x096f('0x34')]=_[_0x096f('0x2c')](_0x2fbf91[_0x096f('0x28')],_0x2fbf91['query']);_0x14f6b9[_0x096f('0x2e')]=_[_0x096f('0x2c')](_0x2fbf91[_0x096f('0x28')],qs[_0x096f('0x2d')](_0x55da1b[_0x096f('0x2a')][_0x096f('0x2d')]));_0x14f6b9[_0x096f('0x2e')]=_0x14f6b9[_0x096f('0x2e')][_0x096f('0x3e')]?_0x14f6b9[_0x096f('0x2e')]:_0x2fbf91[_0x096f('0x28')];if(_0x55da1b[_0x096f('0x2a')][_0x096f('0x3f')]){_0x14f6b9['include']=[{'all':!![]}];}_0x14f6b9=_['merge']({},_0x14f6b9,_0x55da1b[_0x096f('0x38')]);return db[_0x096f('0x24')][_0x096f('0x40')](_0x14f6b9)[_0x096f('0x1e')](handleEntityNotFound(_0x59c998,null))[_0x096f('0x1e')](respondWithResult(_0x59c998,null))[_0x096f('0x3b')](handleError(_0x59c998,null));};exports[_0x096f('0x41')]=function(_0xe62736,_0x557192){return db[_0x096f('0x24')][_0x096f('0x41')](_0xe62736[_0x096f('0x42')],{})['then'](respondWithResult(_0x557192,0xc9))[_0x096f('0x3b')](handleError(_0x557192,null));};exports['update']=function(_0x4e2c85,_0x2975c1){if(_0x4e2c85[_0x096f('0x42')]['id']){delete _0x4e2c85[_0x096f('0x42')]['id'];}return db[_0x096f('0x24')][_0x096f('0x40')]({'where':{'id':_0x4e2c85[_0x096f('0x3d')]['id']}})[_0x096f('0x1e')](handleEntityNotFound(_0x2975c1,null))[_0x096f('0x1e')](saveUpdates(_0x4e2c85['body'],null))['then'](respondWithResult(_0x2975c1,null))[_0x096f('0x3b')](handleError(_0x2975c1,null));};exports[_0x096f('0x1f')]=function(_0x4d7c93,_0x3bc862){return db[_0x096f('0x24')][_0x096f('0x40')]({'where':{'id':_0x4d7c93[_0x096f('0x3d')]['id']}})[_0x096f('0x1e')](handleEntityNotFound(_0x3bc862,null))[_0x096f('0x1e')](removeEntity(_0x3bc862,null))[_0x096f('0x3b')](handleError(_0x3bc862,null));};exports[_0x096f('0x43')]=function(_0x2b0c81,_0x299ba9){return db[_0x096f('0x24')]['describe']()['then'](respondWithResult(_0x299ba9,null))['catch'](handleError(_0x299ba9,null));}; \ No newline at end of file +var _0xefc5=['fast-json-patch','request-promise','moment','bluebird','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x31ad1e,_0x5fdfb8){var _0x21215c=function(_0x1ad9d4){while(--_0x1ad9d4){_0x31ad1e['push'](_0x31ad1e['shift']());}};_0x21215c(++_0x5fdfb8);}(_0xefc5,0x1b3));var _0x5efc=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0xefc5[_0x4f32de];return _0x149821;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5efc('0x0'));var rimraf=require(_0x5efc('0x1'));var zipdir=require(_0x5efc('0x2'));var jsonpatch=require(_0x5efc('0x3'));var rp=require(_0x5efc('0x4'));var moment=require(_0x5efc('0x5'));var BPromise=require(_0x5efc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5efc('0x7'));var csv=require(_0x5efc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5efc('0x9'));var crypto=require(_0x5efc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5efc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5efc('0xc'));var Papa=require(_0x5efc('0xd'));var Redis=require(_0x5efc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5efc('0xf'));var as=require(_0x5efc('0x10'));var hardwareService=require(_0x5efc('0x11'));var logger=require(_0x5efc('0x12'))('api');var utils=require(_0x5efc('0x13'));var config=require(_0x5efc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa12a58,_0x3a6804){_0x3a6804=_0x3a6804||0xcc;return function(_0xcfbfb8){if(_0xcfbfb8){return _0xa12a58[_0x5efc('0x15')](_0x3a6804);}return _0xa12a58['status'](_0x3a6804)['end']();};}function respondWithResult(_0x1a2d4d,_0x2f134f){_0x2f134f=_0x2f134f||0xc8;return function(_0xd1e820){if(_0xd1e820){return _0x1a2d4d[_0x5efc('0x16')](_0x2f134f)[_0x5efc('0x17')](_0xd1e820);}};}function respondWithFilteredResult(_0x20ae01,_0x90bf4){return function(_0x338be9){if(_0x338be9){var _0x27c2cf=_0x338be9[_0x5efc('0x18')],_0x33c322=_0x90bf4[_0x5efc('0x19')],_0x35ddae=_0x90bf4[_0x5efc('0x19')]+_0x90bf4[_0x5efc('0x1a')],_0x387f13;if(_0x35ddae>=_0x27c2cf){_0x35ddae=_0x27c2cf;_0x387f13=0xc8;}else{_0x387f13=0xce;}_0x20ae01[_0x5efc('0x16')](_0x387f13);return _0x20ae01[_0x5efc('0x1b')](_0x5efc('0x1c'),_0x33c322+'-'+_0x35ddae+'/'+_0x27c2cf)[_0x5efc('0x17')](_0x338be9);}return null;};}function patchUpdates(_0x4a8a88){return function(_0x218fee){try{jsonpatch[_0x5efc('0x1d')](_0x218fee,_0x4a8a88,!![]);}catch(_0x4372aa){return BPromise[_0x5efc('0x1e')](_0x4372aa);}return _0x218fee['save']();};}function saveUpdates(_0x4a34a2,_0x43549d){return function(_0x2a0067){if(_0x2a0067){return _0x2a0067[_0x5efc('0x1f')](_0x4a34a2)['then'](function(_0x41dee6){return _0x41dee6;});}return null;};}function removeEntity(_0x235e65,_0x40c484){return function(_0xf3811f){if(_0xf3811f){return _0xf3811f[_0x5efc('0x20')]()[_0x5efc('0x21')](function(){_0x235e65[_0x5efc('0x16')](0xcc)[_0x5efc('0x22')]();});}};}function handleEntityNotFound(_0x42daeb,_0x3cbe9b){return function(_0x1ac45c){if(!_0x1ac45c){_0x42daeb[_0x5efc('0x15')](0x194);}return _0x1ac45c;};}function handleError(_0x13646d,_0x2d6988){_0x2d6988=_0x2d6988||0x1f4;return function(_0x4245a3){logger[_0x5efc('0x23')](_0x4245a3[_0x5efc('0x24')]);if(_0x4245a3[_0x5efc('0x25')]){delete _0x4245a3[_0x5efc('0x25')];}_0x13646d['status'](_0x2d6988)[_0x5efc('0x26')](_0x4245a3);};}exports[_0x5efc('0x27')]=function(_0x3a17f9,_0xaf17c4){var _0x4c742c={},_0x525c55={},_0x498c6b={'count':0x0,'rows':[]};var _0x324184=_[_0x5efc('0x28')](db[_0x5efc('0x29')][_0x5efc('0x2a')],function(_0x212b97){return{'name':_0x212b97['fieldName'],'type':_0x212b97['type'][_0x5efc('0x2b')]};});_0x525c55[_0x5efc('0x2c')]=_[_0x5efc('0x28')](_0x324184,_0x5efc('0x25'));_0x525c55['query']=_['keys'](_0x3a17f9[_0x5efc('0x2d')]);_0x525c55[_0x5efc('0x2e')]=_[_0x5efc('0x2f')](_0x525c55[_0x5efc('0x2c')],_0x525c55[_0x5efc('0x2d')]);_0x4c742c[_0x5efc('0x30')]=_[_0x5efc('0x2f')](_0x525c55[_0x5efc('0x2c')],qs[_0x5efc('0x31')](_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x31')]));_0x4c742c[_0x5efc('0x30')]=_0x4c742c[_0x5efc('0x30')][_0x5efc('0x32')]?_0x4c742c[_0x5efc('0x30')]:_0x525c55[_0x5efc('0x2c')];if(!_0x3a17f9['query'][_0x5efc('0x33')](_0x5efc('0x34'))){_0x4c742c[_0x5efc('0x1a')]=qs['limit'](_0x3a17f9['query'][_0x5efc('0x1a')]);_0x4c742c[_0x5efc('0x19')]=qs[_0x5efc('0x19')](_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x19')]);}_0x4c742c[_0x5efc('0x35')]=qs['sort'](_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x36')]);_0x4c742c['where']=qs[_0x5efc('0x2e')](_[_0x5efc('0x37')](_0x3a17f9['query'],_0x525c55[_0x5efc('0x2e')]),_0x324184);if(_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x38')]){_0x4c742c[_0x5efc('0x39')]=_[_0x5efc('0x3a')](_0x4c742c[_0x5efc('0x39')],{'$or':_['map'](_0x324184,function(_0xae151b){if(_0xae151b[_0x5efc('0x3b')]!==_0x5efc('0x3c')){var _0x11a296={};_0x11a296[_0xae151b[_0x5efc('0x25')]]={'$like':'%'+_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x38')]+'%'};return _0x11a296;}})});}_0x4c742c=_[_0x5efc('0x3a')]({},_0x4c742c,_0x3a17f9[_0x5efc('0x3d')]);var _0x3411b6={'where':_0x4c742c[_0x5efc('0x39')]};return db[_0x5efc('0x29')][_0x5efc('0x18')](_0x3411b6)[_0x5efc('0x21')](function(_0x112392){_0x498c6b[_0x5efc('0x18')]=_0x112392;if(_0x3a17f9[_0x5efc('0x2d')][_0x5efc('0x3e')]){_0x4c742c[_0x5efc('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x5efc('0x40')](_0x4c742c);})[_0x5efc('0x21')](function(_0x446057){_0x498c6b['rows']=_0x446057;return _0x498c6b;})[_0x5efc('0x21')](respondWithFilteredResult(_0xaf17c4,_0x4c742c))[_0x5efc('0x41')](handleError(_0xaf17c4,null));};exports[_0x5efc('0x42')]=function(_0x18267b,_0x1a1417){var _0x594ddc={'raw':!![],'where':{'id':_0x18267b[_0x5efc('0x43')]['id']}},_0x1ccef8={};_0x1ccef8[_0x5efc('0x2c')]=_['keys'](db[_0x5efc('0x29')]['rawAttributes']);_0x1ccef8[_0x5efc('0x2d')]=_[_0x5efc('0x44')](_0x18267b['query']);_0x1ccef8[_0x5efc('0x2e')]=_[_0x5efc('0x2f')](_0x1ccef8[_0x5efc('0x2c')],_0x1ccef8[_0x5efc('0x2d')]);_0x594ddc[_0x5efc('0x30')]=_[_0x5efc('0x2f')](_0x1ccef8[_0x5efc('0x2c')],qs[_0x5efc('0x31')](_0x18267b['query'][_0x5efc('0x31')]));_0x594ddc[_0x5efc('0x30')]=_0x594ddc[_0x5efc('0x30')][_0x5efc('0x32')]?_0x594ddc[_0x5efc('0x30')]:_0x1ccef8[_0x5efc('0x2c')];if(_0x18267b[_0x5efc('0x2d')][_0x5efc('0x3e')]){_0x594ddc[_0x5efc('0x3f')]=[{'all':!![]}];}_0x594ddc=_[_0x5efc('0x3a')]({},_0x594ddc,_0x18267b[_0x5efc('0x3d')]);return db[_0x5efc('0x29')][_0x5efc('0x45')](_0x594ddc)[_0x5efc('0x21')](handleEntityNotFound(_0x1a1417,null))['then'](respondWithResult(_0x1a1417,null))[_0x5efc('0x41')](handleError(_0x1a1417,null));};exports[_0x5efc('0x46')]=function(_0x23306c,_0x5ce315){return db[_0x5efc('0x29')][_0x5efc('0x46')](_0x23306c[_0x5efc('0x47')],{})[_0x5efc('0x21')](respondWithResult(_0x5ce315,0xc9))['catch'](handleError(_0x5ce315,null));};exports[_0x5efc('0x1f')]=function(_0x23ffa8,_0x33bc23){if(_0x23ffa8[_0x5efc('0x47')]['id']){delete _0x23ffa8[_0x5efc('0x47')]['id'];}return db['WhatsappTransferReport'][_0x5efc('0x45')]({'where':{'id':_0x23ffa8[_0x5efc('0x43')]['id']}})[_0x5efc('0x21')](handleEntityNotFound(_0x33bc23,null))[_0x5efc('0x21')](saveUpdates(_0x23ffa8['body'],null))[_0x5efc('0x21')](respondWithResult(_0x33bc23,null))[_0x5efc('0x41')](handleError(_0x33bc23,null));};exports['destroy']=function(_0x3a0249,_0x4b9dea){return db[_0x5efc('0x29')][_0x5efc('0x45')]({'where':{'id':_0x3a0249[_0x5efc('0x43')]['id']}})[_0x5efc('0x21')](handleEntityNotFound(_0x4b9dea,null))['then'](removeEntity(_0x4b9dea,null))[_0x5efc('0x41')](handleError(_0x4b9dea,null));};exports[_0x5efc('0x48')]=function(_0xa9ca6e,_0x1c5dc2){return db['WhatsappTransferReport'][_0x5efc('0x48')]()[_0x5efc('0x21')](respondWithResult(_0x1c5dc2,null))[_0x5efc('0x41')](handleError(_0x1c5dc2,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 77e21af..c8c144a 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 _0xc11c=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xc11c,0x11e));var _0xcc11=function(_0x518d88,_0x101f35){_0x518d88=_0x518d88-0x0;var _0x10875b=_0xc11c[_0x518d88];return _0x10875b;};'use strict';var _=require(_0xcc11('0x0'));var util=require(_0xcc11('0x1'));var logger=require(_0xcc11('0x2'))(_0xcc11('0x3'));var moment=require(_0xcc11('0x4'));var BPromise=require(_0xcc11('0x5'));var rp=require(_0xcc11('0x6'));var fs=require('fs');var path=require(_0xcc11('0x7'));var rimraf=require(_0xcc11('0x8'));var config=require(_0xcc11('0x9'));var attributes=require(_0xcc11('0xa'));module[_0xcc11('0xb')]=function(_0x85b114,_0x5278d6){return _0x85b114['define']('WhatsappTransferReport',attributes,{'tableName':_0xcc11('0xc'),'paranoid':![],'indexes':[{'name':_0xcc11('0xd'),'fields':[_0xcc11('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a62=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x766847,_0x5a02c8){var _0x1689dd=function(_0x927627){while(--_0x927627){_0x766847['push'](_0x766847['shift']());}};_0x1689dd(++_0x5a02c8);}(_0x4a62,0xb4));var _0x24a6=function(_0x3eb4db,_0x38e249){_0x3eb4db=_0x3eb4db-0x0;var _0x15b736=_0x4a62[_0x3eb4db];return _0x15b736;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x24a6('0x0'))('api');var moment=require(_0x24a6('0x1'));var BPromise=require('bluebird');var rp=require(_0x24a6('0x2'));var fs=require('fs');var path=require(_0x24a6('0x3'));var rimraf=require('rimraf');var config=require(_0x24a6('0x4'));var attributes=require(_0x24a6('0x5'));module[_0x24a6('0x6')]=function(_0x921629,_0x321abf){return _0x921629[_0x24a6('0x7')](_0x24a6('0x8'),attributes,{'tableName':_0x24a6('0x9'),'paranoid':![],'indexes':[{'name':_0x24a6('0xa'),'fields':[_0x24a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c9a9463..0100062 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(_0x4b7f90,_0x55fc03){var _0x3059e2=function(_0x1a05db){while(--_0x1a05db){_0x4b7f90['push'](_0x4b7f90['shift']());}};_0x3059e2(++_0x55fc03);}(_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);});});} \ 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(_0x4a3cb5,_0x1cf1fa){var _0x2f0766=function(_0x143575){while(--_0x143575){_0x4a3cb5['push'](_0x4a3cb5['shift']());}};_0x2f0766(++_0x1cf1fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8219f76..8b68bea 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b9f=['./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x4b9f,0x158));var _0xf4b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b9f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var mysqldb=require(_0xf4b9('0x0'));var rpc=require(_0xf4b9('0x1'));var config=require(_0xf4b9('0x2'));var logger=require(_0xf4b9('0x3'))(_0xf4b9('0x4'));var pm2=require(_0xf4b9('0x5'));var pm2Config=require(_0xf4b9('0x6'));var schedule=require(_0xf4b9('0x7'));var chat=require(_0xf4b9('0x8'));var transcribe=require(_0xf4b9('0x9'));function main(){return mysqldb['db'][_0xf4b9('0xa')][_0xf4b9('0xb')]()[_0xf4b9('0xc')](function(){return rpc[_0xf4b9('0xd')]();})[_0xf4b9('0xc')](function(_0x4a9ac6){logger['info'](_0x4a9ac6);return chat['start']();})['then'](function(){return schedule[_0xf4b9('0xe')]();})['then'](function(){return transcribe[_0xf4b9('0xe')]();})[_0xf4b9('0xc')](function(_0x4c9abd){logger[_0xf4b9('0xf')](_0x4c9abd);return pm2['start'](pm2Config);})[_0xf4b9('0xc')](function(_0x43e967){logger[_0xf4b9('0xf')](_0xf4b9('0x10'),_[_0xf4b9('0x11')](_[_0xf4b9('0x12')](_0x43e967,{'status':_0xf4b9('0x13')}),'name')[_0xf4b9('0x14')]());logger[_0xf4b9('0xf')](_0xf4b9('0x15'),_[_0xf4b9('0x11')](_['filter'](_0x43e967,function(_0x5f5121){return _0x5f5121[_0xf4b9('0x16')]!=='online';}),_0xf4b9('0x17'))[_0xf4b9('0x14')]()||_0xf4b9('0x18'));config[_0xf4b9('0x19')]&&require(_0xf4b9('0x1a'))[_0xf4b9('0x1b')]();require(_0xf4b9('0x1c'))[_0xf4b9('0x1b')]();})[_0xf4b9('0x1d')](function(_0x2ed89f){logger[_0xf4b9('0x1e')](_0xf4b9('0x1f'),_0x2ed89f);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x911d=['./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','map','online','name','join','filter','status','None','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule/chat'];(function(_0x59c2de,_0x4862ce){var _0x23c8ef=function(_0x85d085){while(--_0x85d085){_0x59c2de['push'](_0x59c2de['shift']());}};_0x23c8ef(++_0x4862ce);}(_0x911d,0xaa));var _0xd911=function(_0x3a6922,_0xc728be){_0x3a6922=_0x3a6922-0x0;var _0x9c1b44=_0x911d[_0x3a6922];return _0x9c1b44;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0xd911('0x0'));var config=require(_0xd911('0x1'));var logger=require(_0xd911('0x2'))('app');var pm2=require(_0xd911('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xd911('0x4'));var transcribe=require(_0xd911('0x5'));function main(){return mysqldb['db'][_0xd911('0x6')][_0xd911('0x7')]()[_0xd911('0x8')](function(){return rpc['listen']();})[_0xd911('0x8')](function(_0x3fb50c){logger[_0xd911('0x9')](_0x3fb50c);return chat[_0xd911('0xa')]();})[_0xd911('0x8')](function(){return schedule['start']();})['then'](function(){return transcribe['start']();})[_0xd911('0x8')](function(_0x19cf63){logger['info'](_0x19cf63);return pm2['start'](pm2Config);})[_0xd911('0x8')](function(_0x483c85){logger[_0xd911('0x9')](_0xd911('0xb'),_[_0xd911('0xc')](_['filter'](_0x483c85,{'status':_0xd911('0xd')}),_0xd911('0xe'))[_0xd911('0xf')]());logger[_0xd911('0x9')]('Offline\x20apps:',_[_0xd911('0xc')](_[_0xd911('0x10')](_0x483c85,function(_0x466ce1){return _0x466ce1[_0xd911('0x11')]!==_0xd911('0xd');}),_0xd911('0xe'))['join']()||_0xd911('0x12'));config[_0xd911('0x13')]&&require(_0xd911('0x14'))[_0xd911('0x15')]();require(_0xd911('0x16'))[_0xd911('0x15')]();})['catch'](function(_0x28a402){logger[_0xd911('0x17')](_0xd911('0x18'),_0x28a402);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 676dd4e..a23295d 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 _0xede3=['../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','secrets','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','pass','status','Wrong\x20credentials.','Bearer','apikey','getUuid','find','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','verify','session','randomBytes','toString','floor','HS512','../../mysqldb'];(function(_0x1149b2,_0x33eebc){var _0x2b7ec0=function(_0x5512e9){while(--_0x5512e9){_0x1149b2['push'](_0x1149b2['shift']());}};_0x2b7ec0(++_0x33eebc);}(_0xede3,0x1d5));var _0x3ede=function(_0x266445,_0x193d5a){_0x266445=_0x266445-0x0;var _0x442e77=_0xede3[_0x266445];return _0x442e77;};'use strict';var db=require(_0x3ede('0x0'))['db'];var config=require(_0x3ede('0x1'));var hardwareConf=require(_0x3ede('0x2'));var _=require('lodash');var jwt=require(_0x3ede('0x3'));var expressJwt=require(_0x3ede('0x4'));var compose=require(_0x3ede('0x5'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x3ede('0x6')]['session']});var userAttributes=['id','role',_0x3ede('0x7'),_0x3ede('0x8'),'internal',_0x3ede('0x9'),_0x3ede('0xa'),_0x3ede('0xb'),_0x3ede('0xc'),_0x3ede('0xd'),_0x3ede('0xe'),'mailPause',_0x3ede('0xf'),_0x3ede('0x10'),_0x3ede('0x11'),_0x3ede('0x12'),'showWebBar',_0x3ede('0x13'),'lastPauseAt','crudPermissions',_0x3ede('0x14'),_0x3ede('0x15'),_0x3ede('0x16'),_0x3ede('0x17'),_0x3ede('0x18'),_0x3ede('0x19'),_0x3ede('0x1a'),'phoneBarEnableDtmfTone',_0x3ede('0x1b'),'phoneBarExpires',_0x3ede('0x1c'),_0x3ede('0x1d'),_0x3ede('0x1e'),_0x3ede('0x1f'),'interface','userProfileId'];exports[_0x3ede('0x20')]=function(){return this[_0x3ede('0x21')](!![])[_0x3ede('0x22')](function(_0x444f58,_0x3dd39c,_0x839a29){if(_0x444f58[_0x3ede('0x23')]){_0x839a29();}else{return db[_0x3ede('0x24')][_0x3ede('0x25')]({'where':{'id':_0x444f58['params']['id']},'attributes':['id',_0x3ede('0x26'),_0x3ede('0x27')],'raw':!![]})[_0x3ede('0x28')](function(_0x595975){if(_0x595975&&_0x595975[_0x3ede('0x26')]){return _0x3dd39c['status'](_0x595975[_0x3ede('0x27')]===_0x3ede('0x29')?0x195:0x193)[_0x3ede('0x2a')]({'message':_0x595975[_0x3ede('0x27')]==='unmanaged'?_0x3ede('0x2b'):_0x3ede('0x2c')});}else{_0x839a29();}})[_0x3ede('0x2d')](function(_0x2fe84d){_0x839a29(_0x2fe84d);});}});};exports[_0x3ede('0x21')]=function isAuthenticated(_0x4d5457){return compose()[_0x3ede('0x22')](function(_0x3bd1a0,_0x1163e7,_0x837170){if(_0x3bd1a0[_0x3ede('0x2e')][_0x3ede('0x2f')]){if(_[_0x3ede('0x30')](_0x3bd1a0['headers'][_0x3ede('0x2f')],_0x3ede('0x31'))){var _0x3900fa=basicAuth(_0x3bd1a0);db[_0x3ede('0x32')]['find']({'where':{'name':_0x3900fa['name']}})[_0x3ede('0x28')](function(_0x34b338){if(!_0x34b338||!_0x34b338['authenticate'](_0x3900fa[_0x3ede('0x33')])){return _0x1163e7[_0x3ede('0x34')](0x191)['json']({'message':_0x3ede('0x35')});}_0x3bd1a0[_0x3ede('0x23')]={'id':_0x34b338['id']};_0x837170();})[_0x3ede('0x2d')](function(_0x271b72){_0x837170(_0x271b72);});}else if(_[_0x3ede('0x30')](_0x3bd1a0[_0x3ede('0x2e')][_0x3ede('0x2f')],_0x3ede('0x36'))){validateJwt(_0x3bd1a0,_0x1163e7,_0x837170);}else{if(_0x4d5457){_0x837170();}else{return _0x1163e7[_0x3ede('0x34')](0x193)[_0x3ede('0x2a')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3bd1a0['query'][_0x3ede('0x37')]){try{var _0x232475={'audience':hardwareConf[_0x3ede('0x38')](),'issuer':hardwareConf[_0x3ede('0x38')]()};verifyJwt(_0x3bd1a0['query']['apikey'],_0x232475)[_0x3ede('0x28')](function(_0x36710a){return db['User'][_0x3ede('0x39')]({'where':{'id':_0x36710a['sub']}})[_0x3ede('0x28')](function(_0x3d6b49){if(!_0x3d6b49||!_[_0x3ede('0x3a')](_0x3d6b49[_0x3ede('0x3b')],_0x36710a[_0x3ede('0x3c')])){return _0x1163e7[_0x3ede('0x34')](0x191)[_0x3ede('0x2a')]({'message':_0x3ede('0x3d')});}_0x3bd1a0[_0x3ede('0x23')]={'id':_0x3d6b49['id']};_0x837170();});})[_0x3ede('0x2d')](function(){return _0x1163e7[_0x3ede('0x34')](0x191)[_0x3ede('0x2a')]({'message':_0x3ede('0x3e')});});}catch(_0x81a12c){_0x837170(_0x81a12c);}}else if(_0x4d5457){_0x837170();}else{return _0x1163e7[_0x3ede('0x34')](0x193)[_0x3ede('0x2a')]({'message':_0x3ede('0x3f')});}})['use'](function(_0x361f03,_0x4c72e8,_0x365a3d){if(_0x361f03[_0x3ede('0x23')]){db[_0x3ede('0x32')][_0x3ede('0x39')]({'where':{'id':_0x361f03['user']['id']},'attributes':userAttributes})[_0x3ede('0x28')](function(_0xd81eb){if(!_0xd81eb){return _0x4c72e8[_0x3ede('0x34')](0x194)['json']({'message':_0x3ede('0x40')});}_0x361f03[_0x3ede('0x23')]=_0xd81eb;_0x365a3d();})[_0x3ede('0x2d')](function(_0xa5d82b){_0x365a3d(_0xa5d82b);});}else if(_0x4d5457){_0x365a3d();}else{return _0x4c72e8[_0x3ede('0x34')](0x194)['json']({'message':_0x3ede('0x41')});}});};exports[_0x3ede('0x42')]=function canUpdate(){return compose()[_0x3ede('0x22')](function(_0x8d1009,_0x4d242e,_0x510e2a){return require(_0x3ede('0x43'))[_0x3ede('0x44')]()[_0x3ede('0x28')](function(_0xbf3b3c){if(_0xbf3b3c['update']){_0x510e2a();}else{return _0x4d242e['status'](0x193)[_0x3ede('0x2a')]({'message':_0x3ede('0x45')});}})['catch'](function(_0x21b728){_0x510e2a(_0x21b728);});});};exports[_0x3ede('0x46')]=function(_0x35a486,_0x49e768,_0x241f25){_0x35a486[_0x3ede('0x46')]=!![];return _0x241f25();};exports[_0x3ede('0x47')]=function signToken(_0x2c03ff){return signJwt(_0x2c03ff);};exports[_0x3ede('0x48')]=function(_0x4b4a31,_0x438139){if(!_0x4b4a31[_0x3ede('0x23')]){return _0x438139[_0x3ede('0x34')](0x194)[_0x3ede('0x2a')]({'message':_0x3ede('0x49')});}var _0x4a79f7={'payload':{'id':_0x4b4a31['user']['id'],'role':_0x4b4a31[_0x3ede('0x23')][_0x3ede('0x4a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a79f7)[_0x3ede('0x28')](function(_0x12c4ca){_0x438139[_0x3ede('0x4b')](_0x3ede('0x4c'),_0x12c4ca);_0x438139['redirect'](_0x3ede('0x4d'));})[_0x3ede('0x2d')](function(_0x930abf){return _0x438139[_0x3ede('0x34')](0x1f4)[_0x3ede('0x4e')](_0x930abf);});};exports['retrieveApiKey']=function(_0x4d56c1){if(_['isNil'](_0x4d56c1[_0x3ede('0x3b')])||_[_0x3ede('0x4f')](_0x4d56c1[_0x3ede('0x50')])){return null;}else{return createJwt(_0x4d56c1);}};exports['generateApiKey']=function(_0xee7124){_0xee7124[_0x3ede('0x3b')]=generateNonce();_0xee7124['apiKeyIat']=generateIssuedAt();return createJwt(_0xee7124);};exports[_0x3ede('0x51')]=function(_0x13fae7,_0x2f21d5){var _0x1d682e=_0x13fae7['query']['apikey'];if(_0x1d682e){var _0x38ea8f={'nonce':_0x2f21d5[_0x3ede('0x3b')],'iat':_0x2f21d5[_0x3ede('0x50')],'audience':hardwareConf[_0x3ede('0x38')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1d682e,_0x38ea8f)[_0x3ede('0x28')](function(){return generateApiKey(_0x2f21d5);});}else{throw{'message':_0x3ede('0x52')};}};function signJwt(_0x4e5af2){var _0x520bb8=BPromise[_0x3ede('0x53')](jwt[_0x3ede('0x54')],{'context':jwt});var _0xb7a87e=_0x4e5af2[_0x3ede('0x55')]||config[_0x3ede('0x6')]['session'];return new BPromise(function(_0x17221b,_0x431d27){_0x520bb8(_0x4e5af2[_0x3ede('0x56')],_0xb7a87e,_0x4e5af2[_0x3ede('0x57')])[_0x3ede('0x28')](function(_0x5aae1c){_0x17221b(_0x5aae1c);})[_0x3ede('0x2d')](function(_0x141a8a){_0x431d27(_0x141a8a);});});}function verifyJwt(_0x13fcdc,_0x140223,_0x995597){var _0x4bb2e0=BPromise[_0x3ede('0x53')](jwt[_0x3ede('0x58')],{'context':jwt});var _0x4c0226=_0x995597||config[_0x3ede('0x6')][_0x3ede('0x59')];return new BPromise(function(_0x19cf41,_0x18e8cf){_0x4bb2e0(_0x13fcdc,_0x4c0226,_0x140223)[_0x3ede('0x28')](function(_0x4098a3){_0x19cf41(_0x4098a3);})[_0x3ede('0x2d')](function(_0x5b31d8){_0x18e8cf(_0x5b31d8);});});}function generateNonce(){return crypto[_0x3ede('0x5a')](0x10)[_0x3ede('0x5b')]('hex');}function generateIssuedAt(){return Math[_0x3ede('0x5c')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x495cdb){var _0xffcac4={'payload':{'iat':_0x495cdb[_0x3ede('0x50')],'nonce':_0x495cdb[_0x3ede('0x3b')]},'options':{'algorithm':_0x3ede('0x5d'),'subject':_0x495cdb['id'][_0x3ede('0x5b')](),'issuer':hardwareConf[_0x3ede('0x38')](),'audience':hardwareConf[_0x3ede('0x38')]()}};return signJwt(_0xffcac4)['then'](function(_0x45b442){return{'iat':_0x495cdb['apiKeyIat'],'nonce':_0x495cdb[_0x3ede('0x3b')],'token':_0x45b442};});} \ No newline at end of file +var _0x6b0a=['Basic','User','find','authenticate','pass','Wrong\x20credentials.','apikey','getUuid','query','sub','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','catch','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','secret','payload','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','express-jwt','composable-middleware','basic-auth','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','then','closed','status','disposition','json','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith'];(function(_0x15e2d7,_0x468ff3){var _0xff3a09=function(_0x78c22a){while(--_0x78c22a){_0x15e2d7['push'](_0x15e2d7['shift']());}};_0xff3a09(++_0x468ff3);}(_0x6b0a,0xe0));var _0xa6b0=function(_0x404eb4,_0x310a9b){_0x404eb4=_0x404eb4-0x0;var _0x3a656c=_0x6b0a[_0x404eb4];return _0x3a656c;};'use strict';var db=require(_0xa6b0('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xa6b0('0x1'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xa6b0('0x2'));var compose=require(_0xa6b0('0x3'));var basicAuth=require(_0xa6b0('0x4'));var crypto=require('crypto');var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xa6b0('0x5')][_0xa6b0('0x6')]});var userAttributes=['id',_0xa6b0('0x7'),_0xa6b0('0x8'),_0xa6b0('0x9'),_0xa6b0('0xa'),_0xa6b0('0xb'),'userpic',_0xa6b0('0xc'),_0xa6b0('0xd'),_0xa6b0('0xe'),_0xa6b0('0xf'),'mailPause',_0xa6b0('0x10'),_0xa6b0('0x11'),_0xa6b0('0x12'),_0xa6b0('0x13'),_0xa6b0('0x14'),_0xa6b0('0x15'),_0xa6b0('0x16'),_0xa6b0('0x17'),_0xa6b0('0x18'),_0xa6b0('0x19'),_0xa6b0('0x1a'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xa6b0('0x1b'),_0xa6b0('0x1c'),_0xa6b0('0x1d'),_0xa6b0('0x1e'),_0xa6b0('0x1f'),_0xa6b0('0x20'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xa6b0('0x21'),'interface',_0xa6b0('0x22')];exports[_0xa6b0('0x23')]=function(){return this['isAuthenticated'](!![])[_0xa6b0('0x24')](function(_0x3d8021,_0x1b01e2,_0x443eed){if(_0x3d8021[_0xa6b0('0x25')]){_0x443eed();}else{return db[_0xa6b0('0x26')][_0xa6b0('0x27')]({'where':{'id':_0x3d8021[_0xa6b0('0x28')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xa6b0('0x29')](function(_0x17375f){if(_0x17375f&&_0x17375f[_0xa6b0('0x2a')]){return _0x1b01e2[_0xa6b0('0x2b')](_0x17375f[_0xa6b0('0x2c')]==='unmanaged'?0x195:0x193)[_0xa6b0('0x2d')]({'message':_0x17375f[_0xa6b0('0x2c')]===_0xa6b0('0x2e')?_0xa6b0('0x2f'):_0xa6b0('0x30')});}else{_0x443eed();}})['catch'](function(_0x2c3eac){_0x443eed(_0x2c3eac);});}});};exports['isAuthenticated']=function isAuthenticated(_0x722b7f){return compose()[_0xa6b0('0x24')](function(_0x1ae411,_0x595b4c,_0x14aab2){if(_0x1ae411[_0xa6b0('0x31')][_0xa6b0('0x32')]){if(_[_0xa6b0('0x33')](_0x1ae411[_0xa6b0('0x31')][_0xa6b0('0x32')],_0xa6b0('0x34'))){var _0x3029e6=basicAuth(_0x1ae411);db[_0xa6b0('0x35')][_0xa6b0('0x36')]({'where':{'name':_0x3029e6[_0xa6b0('0x9')]}})[_0xa6b0('0x29')](function(_0x454ead){if(!_0x454ead||!_0x454ead[_0xa6b0('0x37')](_0x3029e6[_0xa6b0('0x38')])){return _0x595b4c[_0xa6b0('0x2b')](0x191)[_0xa6b0('0x2d')]({'message':_0xa6b0('0x39')});}_0x1ae411[_0xa6b0('0x25')]={'id':_0x454ead['id']};_0x14aab2();})['catch'](function(_0x375d5a){_0x14aab2(_0x375d5a);});}else if(_[_0xa6b0('0x33')](_0x1ae411[_0xa6b0('0x31')][_0xa6b0('0x32')],'Bearer')){validateJwt(_0x1ae411,_0x595b4c,_0x14aab2);}else{if(_0x722b7f){_0x14aab2();}else{return _0x595b4c['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1ae411['query'][_0xa6b0('0x3a')]){try{var _0x506852={'audience':hardwareConf[_0xa6b0('0x3b')](),'issuer':hardwareConf[_0xa6b0('0x3b')]()};verifyJwt(_0x1ae411[_0xa6b0('0x3c')]['apikey'],_0x506852)[_0xa6b0('0x29')](function(_0x4570c8){return db[_0xa6b0('0x35')][_0xa6b0('0x36')]({'where':{'id':_0x4570c8[_0xa6b0('0x3d')]}})['then'](function(_0x2c603e){if(!_0x2c603e||!_[_0xa6b0('0x3e')](_0x2c603e[_0xa6b0('0x3f')],_0x4570c8['nonce'])){return _0x595b4c[_0xa6b0('0x2b')](0x191)[_0xa6b0('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x1ae411[_0xa6b0('0x25')]={'id':_0x2c603e['id']};_0x14aab2();});})['catch'](function(){return _0x595b4c['status'](0x191)['json']({'message':_0xa6b0('0x40')});});}catch(_0x2d5912){_0x14aab2(_0x2d5912);}}else if(_0x722b7f){_0x14aab2();}else{return _0x595b4c['status'](0x193)[_0xa6b0('0x2d')]({'message':_0xa6b0('0x41')});}})['use'](function(_0x4339fb,_0x346c10,_0x4cd639){if(_0x4339fb[_0xa6b0('0x25')]){db['User'][_0xa6b0('0x36')]({'where':{'id':_0x4339fb[_0xa6b0('0x25')]['id']},'attributes':userAttributes})['then'](function(_0x1fb0c1){if(!_0x1fb0c1){return _0x346c10[_0xa6b0('0x2b')](0x194)['json']({'message':_0xa6b0('0x42')});}_0x4339fb[_0xa6b0('0x25')]=_0x1fb0c1;_0x4cd639();})[_0xa6b0('0x43')](function(_0x7372fe){_0x4cd639(_0x7372fe);});}else if(_0x722b7f){_0x4cd639();}else{return _0x346c10[_0xa6b0('0x2b')](0x194)[_0xa6b0('0x2d')]({'message':_0xa6b0('0x44')});}});};exports[_0xa6b0('0x45')]=function canUpdate(){return compose()[_0xa6b0('0x24')](function(_0x4c9d2e,_0x4b70a4,_0x267a8b){return require(_0xa6b0('0x46'))[_0xa6b0('0x47')]()[_0xa6b0('0x29')](function(_0x51d97c){if(_0x51d97c[_0xa6b0('0x48')]){_0x267a8b();}else{return _0x4b70a4[_0xa6b0('0x2b')](0x193)[_0xa6b0('0x2d')]({'message':_0xa6b0('0x49')});}})[_0xa6b0('0x43')](function(_0x43c019){_0x267a8b(_0x43c019);});});};exports[_0xa6b0('0x4a')]=function(_0x17aa23,_0x49d459,_0x5176d5){_0x17aa23[_0xa6b0('0x4a')]=!![];return _0x5176d5();};exports[_0xa6b0('0x4b')]=function signToken(_0x5ce31e){return signJwt(_0x5ce31e);};exports[_0xa6b0('0x4c')]=function(_0x5deec8,_0x18d3d7){if(!_0x5deec8[_0xa6b0('0x25')]){return _0x18d3d7['status'](0x194)[_0xa6b0('0x2d')]({'message':_0xa6b0('0x4d')});}var _0x33c8e9={'payload':{'id':_0x5deec8['user']['id'],'role':_0x5deec8[_0xa6b0('0x25')][_0xa6b0('0x7')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33c8e9)['then'](function(_0x43557f){_0x18d3d7['cookie']('motion.token',_0x43557f);_0x18d3d7['redirect'](_0xa6b0('0x4e'));})[_0xa6b0('0x43')](function(_0x2cb6d5){return _0x18d3d7['status'](0x1f4)[_0xa6b0('0x4f')](_0x2cb6d5);});};exports[_0xa6b0('0x50')]=function(_0x1c837a){if(_[_0xa6b0('0x51')](_0x1c837a[_0xa6b0('0x3f')])||_[_0xa6b0('0x51')](_0x1c837a[_0xa6b0('0x52')])){return null;}else{return createJwt(_0x1c837a);}};exports[_0xa6b0('0x53')]=function(_0x1e2c7f){_0x1e2c7f[_0xa6b0('0x3f')]=generateNonce();_0x1e2c7f[_0xa6b0('0x52')]=generateIssuedAt();return createJwt(_0x1e2c7f);};exports['regenerateApiKey']=function(_0x19efe1,_0x3db585){var _0x28c8e0=_0x19efe1['query'][_0xa6b0('0x3a')];if(_0x28c8e0){var _0x1ceaf4={'nonce':_0x3db585[_0xa6b0('0x3f')],'iat':_0x3db585[_0xa6b0('0x52')],'audience':hardwareConf[_0xa6b0('0x3b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x28c8e0,_0x1ceaf4)['then'](function(){return generateApiKey(_0x3db585);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x1dbf13){var _0x429ef3=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x86fc72=_0x1dbf13[_0xa6b0('0x54')]||config['secrets']['session'];return new BPromise(function(_0x1748f2,_0x1f565f){_0x429ef3(_0x1dbf13[_0xa6b0('0x55')],_0x86fc72,_0x1dbf13['options'])['then'](function(_0x5e37b2){_0x1748f2(_0x5e37b2);})['catch'](function(_0x25a905){_0x1f565f(_0x25a905);});});}function verifyJwt(_0x5ba912,_0x55b897,_0x48e462){var _0xe64f17=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x35945b=_0x48e462||config[_0xa6b0('0x5')][_0xa6b0('0x6')];return new BPromise(function(_0x42f623,_0x5f2440){_0xe64f17(_0x5ba912,_0x35945b,_0x55b897)[_0xa6b0('0x29')](function(_0x5cb2bd){_0x42f623(_0x5cb2bd);})[_0xa6b0('0x43')](function(_0x5f310d){_0x5f2440(_0x5f310d);});});}function generateNonce(){return crypto[_0xa6b0('0x56')](0x10)[_0xa6b0('0x57')](_0xa6b0('0x58'));}function generateIssuedAt(){return Math[_0xa6b0('0x59')](Date[_0xa6b0('0x5a')]()/0x3e8)[_0xa6b0('0x57')]();}function createJwt(_0x43ccf6){var _0x5bf53f={'payload':{'iat':_0x43ccf6['apiKeyIat'],'nonce':_0x43ccf6[_0xa6b0('0x3f')]},'options':{'algorithm':_0xa6b0('0x5b'),'subject':_0x43ccf6['id'][_0xa6b0('0x57')](),'issuer':hardwareConf[_0xa6b0('0x3b')](),'audience':hardwareConf[_0xa6b0('0x3b')]()}};return signJwt(_0x5bf53f)[_0xa6b0('0x29')](function(_0x584bbe){return{'iat':_0x43ccf6[_0xa6b0('0x52')],'nonce':_0x43ccf6['apiKeyNonce'],'token':_0x584bbe};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ceb7d9e..a32ca08 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 _0xb7e7=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','createDecipher','data','close','unlink'];(function(_0x31bbb8,_0x19fb32){var _0x306be5=function(_0x4c80df){while(--_0x4c80df){_0x31bbb8['push'](_0x31bbb8['shift']());}};_0x306be5(++_0x19fb32);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb7e7[_0x4d8ed9];return _0x1e2140;};'use strict';var crypto=require(_0x7b7e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x7b7e('0x1')};function combineOptions(_0x518dc6){var _0x1b7cc7={};for(var _0x54a37f in defaultOptions){if(defaultOptions[_0x7b7e('0x2')](_0x54a37f)){_0x1b7cc7[_0x54a37f]=defaultOptions[_0x54a37f];}}if(_0x518dc6){for(var _0x556d68 in _0x518dc6){if(_0x518dc6[_0x7b7e('0x2')](_0x556d68)){_0x1b7cc7[_0x556d68]=_0x518dc6[_0x556d68];}}}return _0x1b7cc7;}exports[_0x7b7e('0x3')]=function(_0x1d9384,_0x52047f,_0x53ed64,_0x333fa4){return new BPromise(function(_0x372bde,_0x7f87e0){_0x333fa4=combineOptions(_0x333fa4);var _0x55ce81=new Buffer(_0x53ed64);var _0x42b871=fs[_0x7b7e('0x4')](_0x1d9384);var _0x2917f9=fs[_0x7b7e('0x5')](_0x52047f);var _0x148964=crypto[_0x7b7e('0x6')](_0x333fa4[_0x7b7e('0x7')],_0x55ce81);_0x42b871['on']('data',function(_0x299519){var _0x1eef0a=new Buffer(_0x148964[_0x7b7e('0x8')](_0x299519),_0x7b7e('0x9'));_0x2917f9[_0x7b7e('0xa')](_0x1eef0a);});_0x42b871['on'](_0x7b7e('0xb'),function(){try{var _0x36d2a3=new Buffer(_0x148964[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x2917f9[_0x7b7e('0xa')](_0x36d2a3);_0x2917f9[_0x7b7e('0xb')]();_0x2917f9['on']('close',function(){return _0x372bde(_0x52047f);});}catch(_0x422d3a){fs['unlink'](_0x52047f);return _0x7f87e0(_0x422d3a);}});});};exports['decryptFile']=function(_0x2889ed,_0xd304f5,_0xf067da,_0x457ec5){return new BPromise(function(_0x3d2fb2,_0x5703fd){_0x457ec5=combineOptions(_0x457ec5);var _0x51baf6=new Buffer(_0xf067da);var _0xc7f087=fs[_0x7b7e('0x4')](_0x2889ed);var _0x27f999=fs[_0x7b7e('0x5')](_0xd304f5);var _0x2cc400=crypto[_0x7b7e('0xd')](_0x457ec5[_0x7b7e('0x7')],_0x51baf6);_0xc7f087['on'](_0x7b7e('0xe'),function(_0x2acb8c){var _0x429a0e=new Buffer(_0x2cc400[_0x7b7e('0x8')](_0x2acb8c),_0x7b7e('0x9'));_0x27f999[_0x7b7e('0xa')](_0x429a0e);});_0xc7f087['on'](_0x7b7e('0xb'),function(){try{var _0x9776c3=new Buffer(_0x2cc400[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x27f999[_0x7b7e('0xa')](_0x9776c3);_0x27f999[_0x7b7e('0xb')]();_0x27f999['on'](_0x7b7e('0xf'),function(){return _0x3d2fb2(_0xd304f5);});}catch(_0x4c0647){fs[_0x7b7e('0x10')](_0xd304f5);return _0x5703fd(_0x4c0647);}});});}; \ No newline at end of file +var _0xb7e7=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','createDecipher','data','close','unlink'];(function(_0x4a6861,_0x212131){var _0x2b01c0=function(_0x2c959c){while(--_0x2c959c){_0x4a6861['push'](_0x4a6861['shift']());}};_0x2b01c0(++_0x212131);}(_0xb7e7,0x121));var _0x7b7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb7e7[_0x46d0c9];return _0x174506;};'use strict';var crypto=require(_0x7b7e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x7b7e('0x1')};function combineOptions(_0x518dc6){var _0x1b7cc7={};for(var _0x54a37f in defaultOptions){if(defaultOptions[_0x7b7e('0x2')](_0x54a37f)){_0x1b7cc7[_0x54a37f]=defaultOptions[_0x54a37f];}}if(_0x518dc6){for(var _0x556d68 in _0x518dc6){if(_0x518dc6[_0x7b7e('0x2')](_0x556d68)){_0x1b7cc7[_0x556d68]=_0x518dc6[_0x556d68];}}}return _0x1b7cc7;}exports[_0x7b7e('0x3')]=function(_0x1d9384,_0x52047f,_0x53ed64,_0x333fa4){return new BPromise(function(_0x372bde,_0x7f87e0){_0x333fa4=combineOptions(_0x333fa4);var _0x55ce81=new Buffer(_0x53ed64);var _0x42b871=fs[_0x7b7e('0x4')](_0x1d9384);var _0x2917f9=fs[_0x7b7e('0x5')](_0x52047f);var _0x148964=crypto[_0x7b7e('0x6')](_0x333fa4[_0x7b7e('0x7')],_0x55ce81);_0x42b871['on']('data',function(_0x299519){var _0x1eef0a=new Buffer(_0x148964[_0x7b7e('0x8')](_0x299519),_0x7b7e('0x9'));_0x2917f9[_0x7b7e('0xa')](_0x1eef0a);});_0x42b871['on'](_0x7b7e('0xb'),function(){try{var _0x36d2a3=new Buffer(_0x148964[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x2917f9[_0x7b7e('0xa')](_0x36d2a3);_0x2917f9[_0x7b7e('0xb')]();_0x2917f9['on']('close',function(){return _0x372bde(_0x52047f);});}catch(_0x422d3a){fs['unlink'](_0x52047f);return _0x7f87e0(_0x422d3a);}});});};exports['decryptFile']=function(_0x2889ed,_0xd304f5,_0xf067da,_0x457ec5){return new BPromise(function(_0x3d2fb2,_0x5703fd){_0x457ec5=combineOptions(_0x457ec5);var _0x51baf6=new Buffer(_0xf067da);var _0xc7f087=fs[_0x7b7e('0x4')](_0x2889ed);var _0x27f999=fs[_0x7b7e('0x5')](_0xd304f5);var _0x2cc400=crypto[_0x7b7e('0xd')](_0x457ec5[_0x7b7e('0x7')],_0x51baf6);_0xc7f087['on'](_0x7b7e('0xe'),function(_0x2acb8c){var _0x429a0e=new Buffer(_0x2cc400[_0x7b7e('0x8')](_0x2acb8c),_0x7b7e('0x9'));_0x27f999[_0x7b7e('0xa')](_0x429a0e);});_0xc7f087['on'](_0x7b7e('0xb'),function(){try{var _0x9776c3=new Buffer(_0x2cc400[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x27f999[_0x7b7e('0xa')](_0x9776c3);_0x27f999[_0x7b7e('0xb')]();_0x27f999['on'](_0x7b7e('0xf'),function(){return _0x3d2fb2(_0xd304f5);});}catch(_0x4c0647){fs[_0x7b7e('0x10')](_0xd304f5);return _0x5703fd(_0x4c0647);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c6eb4e2..0a57bad 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 _0x41bb=['format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','QueryTypes','SELECT','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x1a9dac,_0x1ff6c3){var _0x1663a1=function(_0x27f5ae){while(--_0x27f5ae){_0x1a9dac['push'](_0x1a9dac['shift']());}};_0x1663a1(++_0x1ff6c3);}(_0x41bb,0xc5));var _0xb41b=function(_0x39e45f,_0x391c7c){_0x39e45f=_0x39e45f-0x0;var _0xd033d0=_0x41bb[_0x39e45f];return _0xd033d0;};'use strict';var util=require(_0xb41b('0x0'));var path=require(_0xb41b('0x1'));var _=require('lodash');var csv=require(_0xb41b('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb41b('0x3'));var rimraf=require(_0xb41b('0x4'));var db=require(_0xb41b('0x5'))['db'];var dbH=require(_0xb41b('0x5'))['dbH'];var logger=require(_0xb41b('0x6'))(_0xb41b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb41b('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x497242,_0x2704f0){var _0x29c30d={'status':_0x497242};var _0x53722a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2704f0){_0x29c30d[_0xb41b('0x9')]=_0x2704f0;}return db[_0xb41b('0xa')][_0xb41b('0xb')](_0x29c30d,_0x53722a);}function main(){var _0xa2aa66=0x1388;var _0x26d531;logger[_0xb41b('0xc')](util[_0xb41b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb41b('0xe')));return db['Setting'][_0xb41b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb41b('0x10'),_0xb41b('0x11')]})[_0xb41b('0x12')](function(_0x2066d5){if(_0x2066d5){_0x26d531=_0x2066d5;_0xa2aa66=_0x26d531['splitSizeCsv']||0x1388;}})[_0xb41b('0x12')](function(){return dbH[_0xb41b('0x13')][_0xb41b('0x14')](util[_0xb41b('0xd')](_0xb41b('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xb41b('0x12')](function(_0xdc5fb0){if(!_0xdc5fb0[0x0][_0xb41b('0x16')]){return analyticExtractedReport(_0xb41b('0x17'));}var _0x29ea51=[];var _0x54591e=0x0;var _0x2f3673=!![];if(_0xdc5fb0&&_0xdc5fb0[_0xb41b('0x18')]){var _0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66);if(_0x26d531[_0xb41b('0x10')]){for(;_0x2f3673;_0x54591e+=_0xa2aa66,_0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66)){if(_0x401dd9==0x0||_0x401dd9==_0xdc5fb0[0x0][_0xb41b('0x16')]){_0x2f3673=![];}_0x29ea51['push'](dbH['sequelize']['query'](util[_0xb41b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa2aa66,_0x54591e),{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}else{_0x29ea51['push'](dbH['sequelize'][_0xb41b('0x14')](QUERY,{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}var _0x232ff1=path[_0xb41b('0x1b')](PATH);var _0x4c73da=path['basename'](PATH,_0xb41b('0x1c'));var _0x21045f=_0x26d531[_0xb41b('0x10')]&&_0x29ea51['length']>0x1;var _0x14e9c8=[];if(!fs[_0xb41b('0x1d')](path['join'](_0x232ff1,_0x4c73da))&&_0x21045f){fs[_0xb41b('0x1e')](path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da));}return BPromise['each'](_0x29ea51,function(_0xed3c7e){_0x14e9c8['push'](_0xed3c7e);})[_0xb41b('0x12')](function(){for(var _0x4c6a91=0x0;_0x4c6a91<_0x14e9c8['length'];_0x4c6a91+=0x1){var _0x3af2c;var _0x4265b8=_0x14e9c8[_0x4c6a91];if(_0x21045f){_0x3af2c=path['join'](_0x232ff1,_0x4c73da,util['format'](_0xb41b('0x20'),_0x4c73da,_0x4c6a91,_0xb41b('0x21')));}else{_0x3af2c=path[_0xb41b('0x1f')](_0x232ff1,util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0xb41b('0x21')));}fs[_0xb41b('0x23')](_0x3af2c,csv(_0x4265b8));}})['then'](function(){if(_0x21045f){zipdir(path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da),{'saveTo':path[_0xb41b('0x1f')](_0x232ff1,util['format'](_0xb41b('0x22'),_0x4c73da,'zip'))},function(_0x38277f,_0x31d4cd){});rimraf(path['join'](_0x232ff1,_0x4c73da),function(){});}})[_0xb41b('0x12')](function(){logger['info'](util[_0xb41b('0xd')](_0xb41b('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb41b('0x25'),_0x21045f?util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0x21045f?_0xb41b('0x26'):_0xb41b('0x21')):null);});})[_0xb41b('0x27')](function(_0x157048){logger[_0xb41b('0xc')](util[_0xb41b('0xd')](_0xb41b('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xb41b('0x29')](_0x157048,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xdace=['Empty','length','split','push','QueryTypes','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num'];(function(_0x5e31b3,_0x45764f){var _0x54f6ed=function(_0x41c37f){while(--_0x41c37f){_0x5e31b3['push'](_0x5e31b3['shift']());}};_0x54f6ed(++_0x45764f);}(_0xdace,0xc5));var _0xedac=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xdace[_0x5d4607];return _0x5e4a86;};'use strict';var util=require(_0xedac('0x0'));var path=require('path');var _=require(_0xedac('0x1'));var csv=require(_0xedac('0x2'));var fs=require('fs');var BPromise=require(_0xedac('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xedac('0x4'));var db=require(_0xedac('0x5'))['db'];var dbH=require(_0xedac('0x5'))[_0xedac('0x6')];var logger=require('../../config/logger')(_0xedac('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xedac('0x8')][0x2]);var QUERY=process[_0xedac('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x4081c6,_0x21440e){var _0x162eea={'status':_0x4081c6};var _0x53fa43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x21440e){_0x162eea[_0xedac('0x9')]=_0x21440e;}return db[_0xedac('0xa')][_0xedac('0xb')](_0x162eea,_0x53fa43);}function main(){var _0x4af030=0x1388;var _0x5e188c;logger[_0xedac('0xc')](util[_0xedac('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xedac('0xe')][_0xedac('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xedac('0x10')]})['then'](function(_0x21c6ae){if(_0x21c6ae){_0x5e188c=_0x21c6ae;_0x4af030=_0x5e188c[_0xedac('0x10')]||0x1388;}})[_0xedac('0x11')](function(){return dbH[_0xedac('0x12')][_0xedac('0x13')](util[_0xedac('0xd')](_0xedac('0x14'),QUERY),{'type':dbH[_0xedac('0x12')]['QueryTypes'][_0xedac('0x15')]});})[_0xedac('0x11')](function(_0x2f0c7c){if(!_0x2f0c7c[0x0][_0xedac('0x16')]){return analyticExtractedReport(_0xedac('0x17'));}var _0x590e9b=[];var _0xed25bb=0x0;var _0x594b11=!![];if(_0x2f0c7c&&_0x2f0c7c[_0xedac('0x18')]){var _0x2eeac9=_0x2f0c7c[0x0][_0xedac('0x16')]%(_0xed25bb+_0x4af030);if(_0x5e188c[_0xedac('0x19')]){for(;_0x594b11;_0xed25bb+=_0x4af030,_0x2eeac9=_0x2f0c7c[0x0]['num']%(_0xed25bb+_0x4af030)){if(_0x2eeac9==0x0||_0x2eeac9==_0x2f0c7c[0x0]['num']){_0x594b11=![];}_0x590e9b[_0xedac('0x1a')](dbH[_0xedac('0x12')][_0xedac('0x13')](util[_0xedac('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4af030,_0xed25bb),{'type':dbH['sequelize'][_0xedac('0x1b')][_0xedac('0x15')]}));}}else{_0x590e9b[_0xedac('0x1a')](dbH[_0xedac('0x12')][_0xedac('0x13')](QUERY,{'type':dbH[_0xedac('0x12')][_0xedac('0x1b')][_0xedac('0x15')]}));}}var _0x5353e3=path[_0xedac('0x1c')](PATH);var _0x510005=path[_0xedac('0x1d')](PATH,_0xedac('0x1e'));var _0x5111e6=_0x5e188c[_0xedac('0x19')]&&_0x590e9b[_0xedac('0x18')]>0x1;var _0x1c87bf=[];if(!fs[_0xedac('0x1f')](path[_0xedac('0x20')](_0x5353e3,_0x510005))&&_0x5111e6){fs[_0xedac('0x21')](path['join'](_0x5353e3,_0x510005));}return BPromise[_0xedac('0x22')](_0x590e9b,function(_0x87d343){_0x1c87bf[_0xedac('0x1a')](_0x87d343);})[_0xedac('0x11')](function(){for(var _0x1ff33e=0x0;_0x1ff33e<_0x1c87bf[_0xedac('0x18')];_0x1ff33e+=0x1){var _0x40ba53;var _0x26c6f7=_0x1c87bf[_0x1ff33e];if(_0x5111e6){_0x40ba53=path[_0xedac('0x20')](_0x5353e3,_0x510005,util[_0xedac('0xd')]('%s%d.%s',_0x510005,_0x1ff33e,_0xedac('0x23')));}else{_0x40ba53=path[_0xedac('0x20')](_0x5353e3,util[_0xedac('0xd')]('%s.%s',_0x510005,_0xedac('0x23')));}fs['writeFileSync'](_0x40ba53,csv(_0x26c6f7));}})['then'](function(){if(_0x5111e6){zipdir(path[_0xedac('0x20')](_0x5353e3,_0x510005),{'saveTo':path[_0xedac('0x20')](_0x5353e3,util[_0xedac('0xd')](_0xedac('0x24'),_0x510005,'zip'))},function(_0x4e25da,_0xe813e6){});rimraf(path[_0xedac('0x20')](_0x5353e3,_0x510005),function(){});}})[_0xedac('0x11')](function(){logger[_0xedac('0xc')](util[_0xedac('0xd')](_0xedac('0x25'),EXTRACTED_REPORT_ID,_0xedac('0x26')));return analyticExtractedReport('Completed',_0x5111e6?util[_0xedac('0xd')](_0xedac('0x24'),_0x510005,_0x5111e6?_0xedac('0x27'):'csv'):null);});})[_0xedac('0x28')](function(_0x1213dc){logger['info'](util[_0xedac('0xd')](_0xedac('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0xedac('0x2a')](_0x1213dc,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xedac('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 99372e8..7d63f5a 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 _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x1507cc,_0x1f7720){var _0x32c3fc=function(_0x217698){while(--_0x217698){_0x1507cc['push'](_0x1507cc['shift']());}};_0x32c3fc(++_0x1f7720);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e5a0c,_0x3a16fc){_0x1e5a0c=_0x1e5a0c-0x0;var _0x5cc15b=_0x5f2f[_0x1e5a0c];return _0x5cc15b;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x2957c1,_0x12072b){var _0x56233d=function(_0xb5d248){while(--_0xb5d248){_0x2957c1['push'](_0x2957c1['shift']());}};_0x56233d(++_0x12072b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xb10b[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index de52279..494036b 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 _0xf4da=['existsSync','join','mkdirSync','each','format','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx'];(function(_0x22b1a3,_0x500ab5){var _0xf735c9=function(_0x386204){while(--_0x386204){_0x22b1a3['push'](_0x22b1a3['shift']());}};_0xf735c9(++_0x500ab5);}(_0xf4da,0x190));var _0xaf4d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xf4da[_0x138f59];return _0x3d114d;};'use strict';var util=require(_0xaf4d('0x0'));var path=require(_0xaf4d('0x1'));var _=require(_0xaf4d('0x2'));var fs=require('fs');var json2xls=require(_0xaf4d('0x3'));var BPromise=require(_0xaf4d('0x4'));var zipdir=require(_0xaf4d('0x5'));var rimraf=require(_0xaf4d('0x6'));var db=require(_0xaf4d('0x7'))['db'];var dbH=require(_0xaf4d('0x7'))[_0xaf4d('0x8')];var logger=require(_0xaf4d('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xaf4d('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xaf4d('0xa')][0x4];function analyticExtractedReport(_0x354c53,_0x2dd901){var _0x4e9c4a={'status':_0x354c53};var _0x4feab3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2dd901){_0x4e9c4a[_0xaf4d('0xb')]=_0x2dd901;}return db[_0xaf4d('0xc')][_0xaf4d('0xd')](_0x4e9c4a,_0x4feab3);}function main(){var _0x2b3403=0x1388;var _0x5a5ee1;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xaf4d('0xe')));return db[_0xaf4d('0xf')][_0xaf4d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaf4d('0x11'),_0xaf4d('0x12')]})[_0xaf4d('0x13')](function(_0x31b0df){if(_0x31b0df){_0x5a5ee1=_0x31b0df;_0x2b3403=_0x5a5ee1[_0xaf4d('0x12')]||0x1388;}})[_0xaf4d('0x13')](function(){return dbH[_0xaf4d('0x14')]['query'](util['format'](_0xaf4d('0x15'),QUERY),{'type':dbH[_0xaf4d('0x14')][_0xaf4d('0x16')][_0xaf4d('0x17')]});})[_0xaf4d('0x13')](function(_0x29fcd6){if(!_0x29fcd6[0x0][_0xaf4d('0x18')]){return analyticExtractedReport(_0xaf4d('0x19'));}var _0x555076=[];var _0x17f064=0x0;var _0x56c738=!![];if(_0x5a5ee1[_0xaf4d('0x11')]){if(_0x29fcd6&&_0x29fcd6[_0xaf4d('0x1a')]){var _0x3c4429=_0x29fcd6[0x0]['num']%(_0x17f064+_0x2b3403);for(;_0x56c738;_0x17f064+=_0x2b3403,_0x3c4429=_0x29fcd6[0x0][_0xaf4d('0x18')]%(_0x17f064+_0x2b3403)){if(_0x3c4429==0x0||_0x3c4429==_0x29fcd6[0x0][_0xaf4d('0x18')]){_0x56c738=![];}_0x555076['push'](dbH[_0xaf4d('0x14')]['query'](util['format'](_0xaf4d('0x1b'),QUERY,_0x2b3403,_0x17f064),{'type':dbH[_0xaf4d('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x555076[_0xaf4d('0x1c')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xaf4d('0x14')][_0xaf4d('0x16')]['SELECT']}));}var _0x2ccd87=path[_0xaf4d('0x1d')](PATH);var _0x2cd70b=path[_0xaf4d('0x1e')](PATH,_0xaf4d('0x1f'));var _0x3c5976=_0x5a5ee1[_0xaf4d('0x11')]&&_0x555076['length']>0x1;var _0x4a1892=[];if(!fs[_0xaf4d('0x20')](path[_0xaf4d('0x21')](_0x2ccd87,_0x2cd70b))&&_0x3c5976){fs[_0xaf4d('0x22')](path[_0xaf4d('0x21')](_0x2ccd87,_0x2cd70b));}return BPromise[_0xaf4d('0x23')](_0x555076,function(_0x58264b){_0x4a1892[_0xaf4d('0x1c')](_0x58264b);})['then'](function(){for(var _0x59679a=0x0;_0x59679a<_0x4a1892[_0xaf4d('0x1a')];_0x59679a+=0x1){var _0x4fa72a;var _0x42cf71=_0x4a1892[_0x59679a];if(_0x3c5976){_0x4fa72a=path['join'](_0x2ccd87,_0x2cd70b,util[_0xaf4d('0x24')](_0xaf4d('0x25'),_0x2cd70b,_0x59679a,_0xaf4d('0x26')));}else{_0x4fa72a=path[_0xaf4d('0x21')](_0x2ccd87,util[_0xaf4d('0x24')](_0xaf4d('0x27'),_0x2cd70b,_0xaf4d('0x26')));}fs[_0xaf4d('0x28')](_0x4fa72a,json2xls(_0x42cf71),'binary');}})[_0xaf4d('0x13')](function(){if(_0x3c5976){zipdir(path[_0xaf4d('0x21')](_0x2ccd87,_0x2cd70b),{'saveTo':path[_0xaf4d('0x21')](_0x2ccd87,util[_0xaf4d('0x24')](_0xaf4d('0x27'),_0x2cd70b,_0xaf4d('0x29')))},function(_0x40144d,_0x3d187a){});rimraf(path[_0xaf4d('0x21')](_0x2ccd87,_0x2cd70b),function(){});}})[_0xaf4d('0x13')](function(){logger['info'](util[_0xaf4d('0x24')](_0xaf4d('0x2a'),EXTRACTED_REPORT_ID,_0xaf4d('0xe')));return analyticExtractedReport(_0xaf4d('0x2b'),_0x3c5976?util[_0xaf4d('0x24')]('%s.%s',_0x2cd70b,_0x3c5976?_0xaf4d('0x29'):'xlsx'):null);});})['catch'](function(_0x43647a){logger[_0xaf4d('0x2c')](util['format'](_0xaf4d('0x2d'),EXTRACTED_REPORT_ID,_0xaf4d('0xe')),util[_0xaf4d('0x2e')](_0x43647a,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xaf4d('0x2f'));});}main(); \ No newline at end of file +var _0x3482=['Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','query','format','QueryTypes','SELECT','split','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','.xlsx','existsSync','join','mkdirSync','length','%s%d.%s','xlsx','writeFileSync','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x3482,0x1cd));var _0x2348=function(_0x248238,_0xe31996){_0x248238=_0x248238-0x0;var _0xb93bc4=_0x3482[_0x248238];return _0xb93bc4;};'use strict';var util=require(_0x2348('0x0'));var path=require(_0x2348('0x1'));var _=require(_0x2348('0x2'));var fs=require('fs');var json2xls=require(_0x2348('0x3'));var BPromise=require(_0x2348('0x4'));var zipdir=require(_0x2348('0x5'));var rimraf=require(_0x2348('0x6'));var db=require(_0x2348('0x7'))['db'];var dbH=require(_0x2348('0x7'))[_0x2348('0x8')];var logger=require(_0x2348('0x9'))(_0x2348('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x2348('0xb')][0x2]);var QUERY=process[_0x2348('0xb')][0x3];var PATH=process[_0x2348('0xb')][0x4];function analyticExtractedReport(_0x34cd06,_0x1c33b7){var _0x38c825={'status':_0x34cd06};var _0x33f884={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c33b7){_0x38c825[_0x2348('0xc')]=_0x1c33b7;}return db[_0x2348('0xd')][_0x2348('0xe')](_0x38c825,_0x33f884);}function main(){var _0x24979b=0x1388;var _0x5b95c7;logger[_0x2348('0xf')](util['format'](_0x2348('0x10'),EXTRACTED_REPORT_ID,_0x2348('0x11')));return db['Setting'][_0x2348('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0xec5c1d){if(_0xec5c1d){_0x5b95c7=_0xec5c1d;_0x24979b=_0x5b95c7[_0x2348('0x13')]||0x1388;}})[_0x2348('0x14')](function(){return dbH['sequelize'][_0x2348('0x15')](util[_0x2348('0x16')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x2348('0x17')][_0x2348('0x18')]});})[_0x2348('0x14')](function(_0xe3affc){if(!_0xe3affc[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3f4ca=[];var _0x15381d=0x0;var _0x421b8e=!![];if(_0x5b95c7[_0x2348('0x19')]){if(_0xe3affc&&_0xe3affc['length']){var _0x5e72da=_0xe3affc[0x0][_0x2348('0x1a')]%(_0x15381d+_0x24979b);for(;_0x421b8e;_0x15381d+=_0x24979b,_0x5e72da=_0xe3affc[0x0][_0x2348('0x1a')]%(_0x15381d+_0x24979b)){if(_0x5e72da==0x0||_0x5e72da==_0xe3affc[0x0][_0x2348('0x1a')]){_0x421b8e=![];}_0x3f4ca[_0x2348('0x1b')](dbH['sequelize'][_0x2348('0x15')](util[_0x2348('0x16')](_0x2348('0x1c'),QUERY,_0x24979b,_0x15381d),{'type':dbH[_0x2348('0x1d')][_0x2348('0x17')][_0x2348('0x18')]}));}}}else{_0x3f4ca[_0x2348('0x1b')](dbH[_0x2348('0x1d')]['query'](QUERY,{'type':dbH[_0x2348('0x1d')][_0x2348('0x17')]['SELECT']}));}var _0x18cf19=path[_0x2348('0x1e')](PATH);var _0x5a7359=path[_0x2348('0x1f')](PATH,_0x2348('0x20'));var _0x4fe93c=_0x5b95c7[_0x2348('0x19')]&&_0x3f4ca['length']>0x1;var _0x965c2b=[];if(!fs[_0x2348('0x21')](path[_0x2348('0x22')](_0x18cf19,_0x5a7359))&&_0x4fe93c){fs[_0x2348('0x23')](path[_0x2348('0x22')](_0x18cf19,_0x5a7359));}return BPromise['each'](_0x3f4ca,function(_0x1be6ad){_0x965c2b[_0x2348('0x1b')](_0x1be6ad);})['then'](function(){for(var _0x53ebfd=0x0;_0x53ebfd<_0x965c2b[_0x2348('0x24')];_0x53ebfd+=0x1){var _0x348d9d;var _0x2a9acd=_0x965c2b[_0x53ebfd];if(_0x4fe93c){_0x348d9d=path['join'](_0x18cf19,_0x5a7359,util[_0x2348('0x16')](_0x2348('0x25'),_0x5a7359,_0x53ebfd,_0x2348('0x26')));}else{_0x348d9d=path[_0x2348('0x22')](_0x18cf19,util[_0x2348('0x16')]('%s.%s',_0x5a7359,'xlsx'));}fs[_0x2348('0x27')](_0x348d9d,json2xls(_0x2a9acd),'binary');}})[_0x2348('0x14')](function(){if(_0x4fe93c){zipdir(path[_0x2348('0x22')](_0x18cf19,_0x5a7359),{'saveTo':path[_0x2348('0x22')](_0x18cf19,util[_0x2348('0x16')](_0x2348('0x28'),_0x5a7359,'zip'))},function(_0x5a20ba,_0xde2d32){});rimraf(path[_0x2348('0x22')](_0x18cf19,_0x5a7359),function(){});}})[_0x2348('0x14')](function(){logger['info'](util[_0x2348('0x16')](_0x2348('0x29'),EXTRACTED_REPORT_ID,_0x2348('0x11')));return analyticExtractedReport(_0x2348('0x2a'),_0x4fe93c?util[_0x2348('0x16')](_0x2348('0x28'),_0x5a7359,_0x4fe93c?'zip':_0x2348('0x26')):null);});})['catch'](function(_0x3a25fc){logger['info'](util[_0x2348('0x16')](_0x2348('0x2b'),EXTRACTED_REPORT_ID,_0x2348('0x11')),util[_0x2348('0x2c')](_0x3a25fc,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x2348('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 724c9da..1617d96 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 _0xe2b4=['hasOwnProperty','priority','extensions','extension','find','push','type','format','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN:','context','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue'];(function(_0x2c94d4,_0x43af5a){var _0x138a94=function(_0x1ab63e){while(--_0x1ab63e){_0x2c94d4['push'](_0x2c94d4['shift']());}};_0x138a94(++_0x43af5a);}(_0xe2b4,0x1d3));var _0x4e2b=function(_0x1e254c,_0x4af662){_0x1e254c=_0x1e254c-0x0;var _0x21f70e=_0xe2b4[_0x1e254c];return _0x21f70e;};'use strict';var _=require(_0x4e2b('0x0'));var util=require('util');function rewrite(_0x20fc7e,_0x10212d){var _0x31fb7b=this;return _0x20fc7e[_0x4e2b('0x1')][_0x4e2b('0x2')][_0x4e2b('0x3')]({'raw':!![]})[_0x4e2b('0x4')](function(_0x26609f){_0x31fb7b['intervals']=_0x26609f;return _0x20fc7e[_0x4e2b('0x1')][_0x4e2b('0x5')][_0x4e2b('0x3')]({'where':{'IntervalId':_0x10212d[_0x4e2b('0x6')]},'raw':!![]});})[_0x4e2b('0x4')](function(_0x2a2516){return _0x20fc7e[_0x4e2b('0x1')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x4e2b('0x7')](_0x2a2516,_0x4e2b('0x8')))}},'order':[{'raw':_0x4e2b('0x9')}],'raw':!![]});})[_0x4e2b('0x4')](function(_0x264bbd){var _0x3fa239=_[_0x4e2b('0xa')](_0x264bbd,{'priority':'1'});var _0x1b3682=_['filter'](_0x264bbd,{'isApp':0x1});var _0x194ed2=_[_0x4e2b('0xb')](_0x1b3682,'exten');var _0xec4ac2=[_0x4e2b('0xc'),'playback'];var _0x26f845=[];var _0x4dc5d4=[];for(var _0x12d336 in _0x194ed2){if(_0x194ed2[_0x4e2b('0xd')](_0x12d336)){_0x31fb7b[_0x4e2b('0xe')]=0x2;_0x31fb7b[_0x4e2b('0xf')]=[];_0x31fb7b[_0x4e2b('0x10')]=_[_0x4e2b('0x11')](_0x3fa239,{'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')]});_0x31fb7b[_0x4e2b('0xf')][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':'Set','appdata':util[_0x4e2b('0x14')]('CDR(type)=%s',_0x194ed2[_0x12d336][0x0]['type']),'context':_0x194ed2[_0x12d336][0x0]['context'],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});if(_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')]===_0x4e2b('0x16')){if(_0x31fb7b[_0x4e2b('0x10')]){_0x31fb7b[_0x4e2b('0xf')][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0]['type'],'app':_0x4e2b('0x17'),'appdata':_0x4e2b('0x18')+(_0x31fb7b[_0x4e2b('0x10')][_0x4e2b('0x19')]?_0x4e2b('0x1a')+_0x31fb7b[_0x4e2b('0x10')][_0x4e2b('0x19')]+'}':'${EXTEN}'),'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});}_0x31fb7b[_0x4e2b('0xf')]['push']({'type':_0x194ed2[_0x12d336][0x0]['type'],'app':_0x4e2b('0x17'),'appdata':_0x4e2b('0x1c')+_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')],'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});var _0x1375c0=_0x31fb7b['priority']++;_0x31fb7b[_0x4e2b('0xf')][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0]['type'],'app':'ExecIf','appdata':_0x4e2b('0x1d')+(_0x1375c0+0x2)+'):Goto('+(_0x1375c0+0x1)+')','context':_0x194ed2[_0x12d336][0x0]['context'],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x1375c0,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});if(_0x31fb7b[_0x4e2b('0x10')]){_0x31fb7b['extensions'][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':_0x31fb7b['extension'][_0x4e2b('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x31fb7b['extension']['cutdigits']+'}':_0x4e2b('0x1e'),'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0]['VoiceExtensionId']});}_0x31fb7b[_0x4e2b('0xf')]['push']({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':'Set','appdata':_0x4e2b('0x1f')+_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')],'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0]['exten'],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});if(_0x31fb7b[_0x4e2b('0x10')]&&_0x31fb7b[_0x4e2b('0x10')]['hasOwnProperty'](_0x4e2b('0x20'))&&_0x31fb7b['extension'][_0x4e2b('0x20')]!==_0x4e2b('0x21')){_0x31fb7b['extensions'][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':_0x4e2b('0x22'),'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});_0x31fb7b['extensions'][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x31fb7b['extension']['recordingFormat']||'wav','context':_0x194ed2[_0x12d336][0x0]['context'],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});}}_0x31fb7b['extensions']['push']({'type':_0x194ed2[_0x12d336][0x0]['type'],'app':_0x4e2b('0x17'),'appdata':_0x4e2b('0x23'),'context':_0x194ed2[_0x12d336][0x0]['context'],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});_0x31fb7b[_0x4e2b('0xf')][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0]['type'],'app':'Set','appdata':_0x4e2b('0x24'),'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});_0x31fb7b['extensions'][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':_0x4e2b('0x25'),'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'priority':_0x31fb7b[_0x4e2b('0xe')]++,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});for(var _0x892956=0x0,_0x5b439c=0x0;_0x892956<_0x194ed2[_0x12d336][_0x4e2b('0x26')];_0x892956+=0x1,_0x5b439c=0x0){var _0x331025=_0x194ed2[_0x12d336][_0x892956];if(_0x331025['type']){_0x331025[_0x4e2b('0x13')]=_0x331025[_0x4e2b('0x13')]['toLowerCase']();}var _0x4212f2=[];var _0x509fc6=[];delete _0x331025['id'];delete _0x331025['createdAt'];delete _0x331025[_0x4e2b('0x27')];var _0x47ca11=_0x331025[_0x4e2b('0x28')]!=='*,*,*,*'?[_0x331025[_0x4e2b('0x28')]]:_0x331025[_0x4e2b('0x6')]?_[_0x4e2b('0x7')](_[_0x4e2b('0xa')](_0x31fb7b['intervals'],{'IntervalId':_0x331025[_0x4e2b('0x6')]}),_0x4e2b('0x28')):[];if(_0x331025[_0x4e2b('0xd')](_0x4e2b('0x29'))){if(_0x331025[_0x4e2b('0x29')]&&_0x331025['tag']!=='--'){_0x4212f2[_0x4e2b('0x12')]({'type':_0x331025[_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':'CDR(tag)='+_0x331025[_0x4e2b('0x29')],'context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025['exten'],'priority':_0x47ca11[_0x4e2b('0x26')]+_0x31fb7b['priority']+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});}}if(_0x331025[_0x4e2b('0x13')]===_0x4e2b('0x16')&&_0x331025['hasOwnProperty'](_0x4e2b('0x2a'))){if(_0x331025['callerID']){_0x4212f2[_0x4e2b('0x12')]({'type':_0x331025['type'],'app':_0x4e2b('0x2b'),'appdata':_0x4e2b('0x2c')+_0x331025[_0x4e2b('0x2a')]+')','context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025[_0x4e2b('0x8')],'priority':_0x47ca11[_0x4e2b('0x26')]+_0x31fb7b[_0x4e2b('0xe')]+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});}else{_0x4212f2['push']({'type':_0x331025[_0x4e2b('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025['exten'],'priority':_0x47ca11[_0x4e2b('0x26')]+_0x31fb7b[_0x4e2b('0xe')]+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});}}if(_0x331025[_0x4e2b('0xd')](_0x4e2b('0x2d'))){if(_0xec4ac2[_0x4e2b('0x2e')](_0x331025[_0x4e2b('0x2f')][_0x4e2b('0x30')]())>=0x0&&_0x331025[_0x4e2b('0x31')]!=='custom'){if(_0x331025[_0x4e2b('0x2d')]){_0x4212f2[_0x4e2b('0x12')]({'type':_0x331025[_0x4e2b('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x331025['context'],'exten':_0x331025['exten'],'priority':_0x47ca11[_0x4e2b('0x26')]+_0x31fb7b[_0x4e2b('0xe')]+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});_0x4212f2['push']({'type':_0x331025[_0x4e2b('0x13')],'app':_0x4e2b('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025[_0x4e2b('0x8')],'priority':_0x47ca11[_0x4e2b('0x26')]+_0x31fb7b[_0x4e2b('0xe')]+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});}else{_0x4212f2[_0x4e2b('0x12')]({'type':_0x331025[_0x4e2b('0x13')],'app':_0x4e2b('0x2b'),'appdata':_0x4e2b('0x32'),'context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025[_0x4e2b('0x8')],'priority':_0x47ca11['length']+_0x31fb7b['priority']+_0x5b439c++,'VoiceExtensionId':_0x331025['VoiceExtensionId']});_0x4212f2[_0x4e2b('0x12')]({'type':_0x331025['type'],'app':'Set','appdata':_0x4e2b('0x33'),'context':_0x331025[_0x4e2b('0x1b')],'exten':_0x331025[_0x4e2b('0x8')],'priority':_0x47ca11['length']+_0x31fb7b[_0x4e2b('0xe')]+_0x5b439c++,'VoiceExtensionId':_0x331025[_0x4e2b('0x15')]});}}}for(var _0x526af0=0x0;_0x526af0<_0x47ca11[_0x4e2b('0x26')];_0x526af0+=0x1){var _0x306a80=_0x31fb7b[_0x4e2b('0xe')]+_0x47ca11[_0x4e2b('0x26')];var _0xa8254b=_0x526af0===_0x47ca11[_0x4e2b('0x26')]-0x1?_0x31fb7b[_0x4e2b('0xe')]+_0x4212f2['length']+_0x509fc6['length']+0x2:_0x31fb7b[_0x4e2b('0xe')]+_0x526af0+0x1;_0x4212f2[_0x4e2b('0x34')](_0x526af0,0x0,{'type':_0x331025[_0x4e2b('0x13')],'app':'GotoIfTime','appdata':_0x47ca11[_0x526af0]+'?'+_0x331025[_0x4e2b('0x1b')]+_0x4e2b('0x35')+_0x306a80+':'+_0x331025[_0x4e2b('0x1b')]+_0x4e2b('0x35')+_0xa8254b,'exten':_0x331025[_0x4e2b('0x8')],'context':_0x331025['context'],'priority':_0x31fb7b['priority']+_0x526af0,'VoiceExtensionId':_0x194ed2[_0x12d336][0x0]['VoiceExtensionId']});}_0x331025['priority']=_0x4212f2[_0x4e2b('0x26')]?_['last'](_0x4212f2)[_0x4e2b('0xe')]+0x1:_0x31fb7b[_0x4e2b('0xe')];_0x31fb7b['priority']=(_0x509fc6['length']?_[_0x4e2b('0x36')](_0x509fc6)[_0x4e2b('0xe')]:_0x331025['priority'])+0x1;_0x31fb7b[_0x4e2b('0xf')]=_[_0x4e2b('0x37')](_0x31fb7b[_0x4e2b('0xf')],_0x4212f2,[_0x331025],_0x509fc6);}_0x31fb7b['extensions'][_0x4e2b('0x12')]({'type':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x13')],'app':_0x4e2b('0x38'),'exten':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x8')],'context':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x1b')],'priority':_0x31fb7b[_0x4e2b('0xe')],'VoiceExtensionId':_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]});_0x26f845[_0x4e2b('0x12')](_0x194ed2[_0x12d336][0x0][_0x4e2b('0x15')]);_0x4dc5d4=_['concat'](_0x4dc5d4,_0x31fb7b[_0x4e2b('0xf')]);}}return _0x20fc7e[_0x4e2b('0x39')](function(_0x1d45e9){return _0x20fc7e[_0x4e2b('0x1')]['VoiceExtension'][_0x4e2b('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x26f845}},'transaction':_0x1d45e9})[_0x4e2b('0x4')](function(_0x3c7777){return _0x20fc7e['models']['VoiceExtension'][_0x4e2b('0x3b')](_['sortBy'](_0x4dc5d4,_0x4e2b('0xe')),{'transaction':_0x1d45e9});});});})['catch'](function(_0x33161d){console['error'](_0x33161d);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x8bc9=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','error','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','format','CDR(type)=%s','type','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','Set','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x3c31b2,_0x3796b7){var _0xca9321=function(_0x414124){while(--_0x414124){_0x3c31b2['push'](_0x3c31b2['shift']());}};_0xca9321(++_0x3796b7);}(_0x8bc9,0x1c3));var _0x98bc=function(_0x4dde7d,_0x19dee5){_0x4dde7d=_0x4dde7d-0x0;var _0x3967a0=_0x8bc9[_0x4dde7d];return _0x3967a0;};'use strict';var _=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));function rewrite(_0x5359e3,_0x12fd71){var _0x1a560a=this;return _0x5359e3[_0x98bc('0x2')][_0x98bc('0x3')]['findAll']({'raw':!![]})[_0x98bc('0x4')](function(_0x210369){_0x1a560a[_0x98bc('0x5')]=_0x210369;return _0x5359e3[_0x98bc('0x2')][_0x98bc('0x6')][_0x98bc('0x7')]({'where':{'IntervalId':_0x12fd71[_0x98bc('0x8')]},'raw':!![]});})[_0x98bc('0x4')](function(_0x1d277a){return _0x5359e3[_0x98bc('0x2')][_0x98bc('0x6')][_0x98bc('0x7')]({'where':{'exten':{'$in':_[_0x98bc('0x9')](_[_0x98bc('0xa')](_0x1d277a,_0x98bc('0xb')))}},'order':[{'raw':_0x98bc('0xc')}],'raw':!![]});})[_0x98bc('0x4')](function(_0x455c99){var _0x1b4265=_[_0x98bc('0xd')](_0x455c99,{'priority':'1'});var _0x496b97=_[_0x98bc('0xd')](_0x455c99,{'isApp':0x1});var _0x38923e=_[_0x98bc('0xe')](_0x496b97,_0x98bc('0xb'));var _0x2effc5=[_0x98bc('0xf'),_0x98bc('0x10')];var _0x29ec30=[];var _0x2e4de0=[];for(var _0x5eabda in _0x38923e){if(_0x38923e[_0x98bc('0x11')](_0x5eabda)){_0x1a560a[_0x98bc('0x12')]=0x2;_0x1a560a['extensions']=[];_0x1a560a[_0x98bc('0x13')]=_[_0x98bc('0x14')](_0x1b4265,{'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')]});_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0]['type'],'app':'Set','appdata':util[_0x98bc('0x17')](_0x98bc('0x18'),_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')]),'context':_0x38923e[_0x5eabda][0x0]['context'],'exten':_0x38923e[_0x5eabda][0x0]['exten'],'priority':_0x1a560a[_0x98bc('0x12')]++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});if(_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')]==='outbound'){if(_0x1a560a['extension']){_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':'Set','appdata':_0x98bc('0x1b')+(_0x1a560a[_0x98bc('0x13')][_0x98bc('0x1c')]?_0x98bc('0x1d')+_0x1a560a[_0x98bc('0x13')][_0x98bc('0x1c')]+'}':_0x98bc('0x1e')),'context':_0x38923e[_0x5eabda][0x0]['context'],'exten':_0x38923e[_0x5eabda][0x0]['exten'],'priority':_0x1a560a['priority']++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});}_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':'Set','appdata':'CDR(routeid)='+_0x38923e[_0x5eabda][0x0]['VoiceExtensionId'],'context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a['priority']++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});var _0x5ae04e=_0x1a560a[_0x98bc('0x12')]++;_0x1a560a['extensions']['push']({'type':_0x38923e[_0x5eabda][0x0]['type'],'app':_0x98bc('0x20'),'appdata':_0x98bc('0x21')+(_0x5ae04e+0x2)+_0x98bc('0x22')+(_0x5ae04e+0x1)+')','context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x5ae04e,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});if(_0x1a560a[_0x98bc('0x13')]){_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':'Set','appdata':_0x1a560a['extension'][_0x98bc('0x1c')]?_0x98bc('0x23')+_0x1a560a[_0x98bc('0x13')][_0x98bc('0x1c')]+'}':_0x98bc('0x24'),'context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a['priority']++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0]['VoiceExtensionId']});}_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':'Set','appdata':_0x98bc('0x25')+_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')],'context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a['priority']++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});if(_0x1a560a['extension']&&_0x1a560a[_0x98bc('0x13')][_0x98bc('0x11')](_0x98bc('0x26'))&&_0x1a560a[_0x98bc('0x13')][_0x98bc('0x26')]!=='none'){_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a[_0x98bc('0x12')]++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':_0x98bc('0x27'),'appdata':_0x98bc('0x28')+_0x1a560a[_0x98bc('0x13')][_0x98bc('0x26')]||'wav','context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a['priority']++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});}}_0x1a560a['extensions'][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':_0x98bc('0x27'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a[_0x98bc('0x12')]++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0]['VoiceExtensionId']});_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':_0x98bc('0x27'),'appdata':_0x98bc('0x29'),'context':_0x38923e[_0x5eabda][0x0]['context'],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a[_0x98bc('0x12')]++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});_0x1a560a[_0x98bc('0x15')]['push']({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':_0x98bc('0x27'),'appdata':_0x98bc('0x2a'),'context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'priority':_0x1a560a[_0x98bc('0x12')]++,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});for(var _0x44bec1=0x0,_0x42de21=0x0;_0x44bec1<_0x38923e[_0x5eabda]['length'];_0x44bec1+=0x1,_0x42de21=0x0){var _0x300a06=_0x38923e[_0x5eabda][_0x44bec1];if(_0x300a06['type']){_0x300a06[_0x98bc('0x19')]=_0x300a06[_0x98bc('0x19')]['toLowerCase']();}var _0x40dbf8=[];var _0xbdc418=[];delete _0x300a06['id'];delete _0x300a06[_0x98bc('0x2b')];delete _0x300a06[_0x98bc('0x2c')];var _0x3c70e9=_0x300a06[_0x98bc('0x2d')]!==_0x98bc('0x2e')?[_0x300a06[_0x98bc('0x2d')]]:_0x300a06[_0x98bc('0x8')]?_[_0x98bc('0xa')](_[_0x98bc('0xd')](_0x1a560a[_0x98bc('0x5')],{'IntervalId':_0x300a06[_0x98bc('0x8')]}),_0x98bc('0x2d')):[];if(_0x300a06[_0x98bc('0x11')](_0x98bc('0x2f'))){if(_0x300a06['tag']&&_0x300a06['tag']!=='--'){_0x40dbf8[_0x98bc('0x16')]({'type':_0x300a06[_0x98bc('0x19')],'app':'Set','appdata':'CDR(tag)='+_0x300a06[_0x98bc('0x2f')],'context':_0x300a06['context'],'exten':_0x300a06[_0x98bc('0xb')],'priority':_0x3c70e9[_0x98bc('0x30')]+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06[_0x98bc('0x1a')]});}}if(_0x300a06[_0x98bc('0x19')]===_0x98bc('0x31')&&_0x300a06[_0x98bc('0x11')](_0x98bc('0x32'))){if(_0x300a06[_0x98bc('0x32')]){_0x40dbf8[_0x98bc('0x16')]({'type':_0x300a06[_0x98bc('0x19')],'app':'ExecIf','appdata':_0x98bc('0x33')+_0x300a06[_0x98bc('0x32')]+')','context':_0x300a06[_0x98bc('0x1f')],'exten':_0x300a06[_0x98bc('0xb')],'priority':_0x3c70e9[_0x98bc('0x30')]+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06[_0x98bc('0x1a')]});}else{_0x40dbf8['push']({'type':_0x300a06[_0x98bc('0x19')],'app':_0x98bc('0x20'),'appdata':_0x98bc('0x34'),'context':_0x300a06[_0x98bc('0x1f')],'exten':_0x300a06[_0x98bc('0xb')],'priority':_0x3c70e9[_0x98bc('0x30')]+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06['VoiceExtensionId']});}}if(_0x300a06[_0x98bc('0x11')](_0x98bc('0x35'))){if(_0x2effc5['indexOf'](_0x300a06[_0x98bc('0x36')][_0x98bc('0x37')]())>=0x0&&_0x300a06[_0x98bc('0x38')]!==_0x98bc('0x39')){if(_0x300a06[_0x98bc('0x35')]){_0x40dbf8[_0x98bc('0x16')]({'type':_0x300a06[_0x98bc('0x19')],'app':_0x98bc('0x20'),'appdata':_0x98bc('0x3a'),'context':_0x300a06[_0x98bc('0x1f')],'exten':_0x300a06['exten'],'priority':_0x3c70e9[_0x98bc('0x30')]+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06['VoiceExtensionId']});_0x40dbf8['push']({'type':_0x300a06[_0x98bc('0x19')],'app':'Set','appdata':_0x98bc('0x3b'),'context':_0x300a06[_0x98bc('0x1f')],'exten':_0x300a06[_0x98bc('0xb')],'priority':_0x3c70e9['length']+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06['VoiceExtensionId']});}else{_0x40dbf8['push']({'type':_0x300a06['type'],'app':_0x98bc('0x20'),'appdata':_0x98bc('0x3c'),'context':_0x300a06['context'],'exten':_0x300a06['exten'],'priority':_0x3c70e9['length']+_0x1a560a['priority']+_0x42de21++,'VoiceExtensionId':_0x300a06[_0x98bc('0x1a')]});_0x40dbf8[_0x98bc('0x16')]({'type':_0x300a06['type'],'app':_0x98bc('0x27'),'appdata':_0x98bc('0x3d'),'context':_0x300a06[_0x98bc('0x1f')],'exten':_0x300a06[_0x98bc('0xb')],'priority':_0x3c70e9[_0x98bc('0x30')]+_0x1a560a[_0x98bc('0x12')]+_0x42de21++,'VoiceExtensionId':_0x300a06[_0x98bc('0x1a')]});}}}for(var _0x48c086=0x0;_0x48c086<_0x3c70e9[_0x98bc('0x30')];_0x48c086+=0x1){var _0x313932=_0x1a560a[_0x98bc('0x12')]+_0x3c70e9[_0x98bc('0x30')];var _0x484341=_0x48c086===_0x3c70e9['length']-0x1?_0x1a560a[_0x98bc('0x12')]+_0x40dbf8['length']+_0xbdc418[_0x98bc('0x30')]+0x2:_0x1a560a['priority']+_0x48c086+0x1;_0x40dbf8[_0x98bc('0x3e')](_0x48c086,0x0,{'type':_0x300a06['type'],'app':_0x98bc('0x3f'),'appdata':_0x3c70e9[_0x48c086]+'?'+_0x300a06[_0x98bc('0x1f')]+_0x98bc('0x40')+_0x313932+':'+_0x300a06[_0x98bc('0x1f')]+_0x98bc('0x40')+_0x484341,'exten':_0x300a06[_0x98bc('0xb')],'context':_0x300a06[_0x98bc('0x1f')],'priority':_0x1a560a['priority']+_0x48c086,'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});}_0x300a06[_0x98bc('0x12')]=_0x40dbf8[_0x98bc('0x30')]?_['last'](_0x40dbf8)[_0x98bc('0x12')]+0x1:_0x1a560a[_0x98bc('0x12')];_0x1a560a[_0x98bc('0x12')]=(_0xbdc418[_0x98bc('0x30')]?_[_0x98bc('0x41')](_0xbdc418)[_0x98bc('0x12')]:_0x300a06[_0x98bc('0x12')])+0x1;_0x1a560a['extensions']=_['concat'](_0x1a560a['extensions'],_0x40dbf8,[_0x300a06],_0xbdc418);}_0x1a560a[_0x98bc('0x15')][_0x98bc('0x16')]({'type':_0x38923e[_0x5eabda][0x0][_0x98bc('0x19')],'app':_0x98bc('0x42'),'exten':_0x38923e[_0x5eabda][0x0][_0x98bc('0xb')],'context':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1f')],'priority':_0x1a560a[_0x98bc('0x12')],'VoiceExtensionId':_0x38923e[_0x5eabda][0x0][_0x98bc('0x1a')]});_0x29ec30[_0x98bc('0x16')](_0x38923e[_0x5eabda][0x0]['VoiceExtensionId']);_0x2e4de0=_[_0x98bc('0x43')](_0x2e4de0,_0x1a560a[_0x98bc('0x15')]);}}return _0x5359e3[_0x98bc('0x44')](function(_0x20fa67){return _0x5359e3[_0x98bc('0x2')][_0x98bc('0x6')][_0x98bc('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x29ec30}},'transaction':_0x20fa67})['then'](function(_0x10d9ea){return _0x5359e3[_0x98bc('0x2')][_0x98bc('0x6')][_0x98bc('0x46')](_[_0x98bc('0x47')](_0x2e4de0,'priority'),{'transaction':_0x20fa67});});});})['catch'](function(_0x2a4e01){console[_0x98bc('0x48')](_0x2a4e01);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 75bfc96..b7c4ae4 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 _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb7e7[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file +var _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x1c0f17,_0x3ca574){var _0x531b34=function(_0x13fb6f){while(--_0x13fb6f){_0x1c0f17['push'](_0x1c0f17['shift']());}};_0x531b34(++_0x3ca574);}(_0xe706,0xa3));var _0x6e70=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xe706[_0x50cfc3];return _0x5c11ef;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){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'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1336d00..124ccdb 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x7a54,0x106));var _0x47a5=function(_0x1ad707,_0x25901a){_0x1ad707=_0x1ad707-0x0;var _0x331468=_0x7a54[_0x1ad707];return _0x331468;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x24dca3,_0x2f50ea){var _0x4ab253=function(_0x37ff37){while(--_0x37ff37){_0x24dca3['push'](_0x24dca3['shift']());}};_0x4ab253(++_0x2f50ea);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index c4d197e..1e7d8a4 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cfb=['isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','each','contact','contactId','contactTypeId','orderBy','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','UserId','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','squel','ioredis','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','phone','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','message','split','findOne','CmContactHasItem','update','updated','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','into','fromQuery','ContactId','updatedAt','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','ListId','cm_contacts','cm_contacts.createdAt\x20=\x20?','field','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','createdAt',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','min_id','group','toString','Received\x20SIGINT','error','exit','errors','code','info','sequelize','main','stringify','send','binding','clone','root','findAll','name','header','createReadStream','rows','data','find','hasOwnProperty','replace','scheduledat','isValid','priority'];(function(_0x3bb481,_0x2ae3a4){var _0x1f620a=function(_0xf6b632){while(--_0xf6b632){_0x3bb481['push'](_0x3bb481['shift']());}};_0x1f620a(++_0x2ae3a4);}(_0x0cfb,0x156));var _0xb0cf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0cfb[_0x2d7f0e];return _0x110b07;};'use strict';var fs=require('fs');var path=require(_0xb0cf('0x0'));var _=require(_0xb0cf('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xb0cf('0x2'));var moment=require('moment');var squel=require(_0xb0cf('0x3'));var Redis=require(_0xb0cf('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xb0cf('0x5'))(_0xb0cf('0x6'));config[_0xb0cf('0x7')]=_['defaults'](config['redis'],{'host':_0xb0cf('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0cf('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb0cf('0x9')](_0xb0cf('0xa'));var tempTableName=_0xb0cf('0xb')+moment()[_0xb0cf('0x9')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x558b5d){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))*$/[_0xb0cf('0xc')](_0x558b5d);}function selectNotIn(_0x4399da,_0x19a5ed,_0x43bd57,_0x483758,_0x39a55b){return squel['select']()['field'](_0xb0cf('0xd'))[_0xb0cf('0xe')](_0x483758)[_0xb0cf('0xf')](_0x19a5ed,null,_0x19a5ed+_0xb0cf('0x10')+_0x483758+'.'+_0x43bd57)[_0xb0cf('0x11')](_0x483758+'.'+_0x43bd57+_0xb0cf('0x12')+_0x4399da+'.'+_0x43bd57)[_0xb0cf('0x11')](_0x19a5ed+'.dialCheckDuplicateType\x20IN\x20('+_0x39a55b[_0xb0cf('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3e6833,_0x523423){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xb0cf('0x13')](_0xb0cf('0x14')+tempTableName)[_0xb0cf('0x15')](function(_0x28a377){if(_0x28a377!==null){var _0x37c4d2=[];for(var _0x222899=0x0;_0x222899<_0x28a377[_0xb0cf('0x16')];_0x222899++){var _0x48c61e=_0x28a377[_0x222899];if(!_['isNil'](_0x48c61e[_0xb0cf('0xd')])){if(!_[_0xb0cf('0x17')](_0x48c61e[_0xb0cf('0x18')]))_0x37c4d2[_0xb0cf('0x19')](insertAdditionalPhones(_0x48c61e));promisesContact[_0xb0cf('0x19')]({'contact':_0x48c61e});}}}Promise[_0xb0cf('0x1a')](_0x37c4d2)[_0xb0cf('0x1b')](function(){_0x3e6833({'val':0x1});});})[_0xb0cf('0x1c')](function(_0x5389cd){logger['error'](_0x5389cd[_0xb0cf('0x1d')]);});});}function insertAdditionalPhones(_0x3a0a9f){return new Promise(function(_0x6aaee0,_0x2a6ccf){var _0x1c9d0c=_0x3a0a9f['AdditionalPhones'];if(_['isNil'](_0x1c9d0c))_0x2a6ccf({'val':0x0});else{var _0x1e172a=_0x1c9d0c[_0xb0cf('0x1e')](';');var _0x135842=[];orderBy=0x0;for(var _0x7491a9=0x0;_0x7491a9<_0x1e172a[_0xb0cf('0x16')];_0x7491a9++){_0x135842['push'](splitAdditionalPhone(_0x3a0a9f['id'],_0x1e172a[_0x7491a9]));}Promise[_0xb0cf('0x1a')](_0x135842)[_0xb0cf('0x1b')](function(){_0x6aaee0({'val':_0x1e172a['length']});});}});}function splitAdditionalPhone(_0x7747b5,_0x26e0a7){return new Promise(function(_0x34c883,_0x3c6634){var _0x12850a=_0x26e0a7['split'](':');var _0x1e7ea8=_0x12850a[0x0];var _0x187866=_0x12850a[0x1];if(_0x187866!==''){var _0x35be70=_0x187866['split']('|');var _0x4c8091=[];for(var _0x2f94a6=0x0;_0x2f94a6<_0x35be70[_0xb0cf('0x16')];_0x2f94a6++){if(_0x35be70[_0x2f94a6]!==''){var _0x2e8627=_['filter'](promisesAdditionalPhones,{'contactId':_0x7747b5,'phone':_0x35be70[_0x2f94a6]});if(_0x2e8627[_0xb0cf('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xb0cf('0x19')]({'contactId':_0x7747b5,'contactTypeId':_0x1e7ea8,'phone':_0x35be70[_0x2f94a6],'orderBy':orderBy});}}}_0x34c883({'ok':0x1});}else _0x34c883({'res':0x0});});}function createAdditionalPhone(_0x2a812f,_0x36f089,_0xbf3a7a,_0x27f126){return new Promise(function(_0x56ebe1,_0x3b522d){return db['CmContactHasItem'][_0xb0cf('0x1f')]({'where':{'CmContactId':_0x2a812f,'item':_0xbf3a7a}})[_0xb0cf('0x1b')](function(_0x367417){if(_0x367417){return db[_0xb0cf('0x20')][_0xb0cf('0x21')]({'ItemTypeId':_0x36f089,'OrderBy':_0x27f126},{'where':{'CmContactId':_0x2a812f,'item':_0xbf3a7a}})[_0xb0cf('0x1b')](function(_0x2e61b1){_0x56ebe1({'res':_0xb0cf('0x22')});});}else{return db[_0xb0cf('0x20')]['create']({'CmContactId':_0x2a812f,'item':_0xbf3a7a,'ItemTypeId':_0x36f089,'OrderBy':_0x27f126,'ItemClass':'PHONE'})[_0xb0cf('0x1b')](function(_0x2881c2){_0x56ebe1({'res':_0xb0cf('0x23')});});}});});}function updateContact(_0x2c35bd){return new Promise(function(_0x3273c6,_0x318179){var _0x191d52=_0x2c35bd['id'];delete _0x2c35bd['id'];return db[_0xb0cf('0x24')][_0xb0cf('0x21')](_0x2c35bd,{'where':{'id':_0x191d52}})['then'](function(_0x2e2509){updatedRows+=0x1;return db[_0xb0cf('0x25')][_0xb0cf('0x21')]({'phone':_0x2c35bd[_0xb0cf('0xd')]},{'where':{'ContactId':_0x191d52}})['then'](function(_0x46a7e9){_0x3273c6({'ret':'OK'});});});});}function insertCmHopper(_0x524939,_0x165971,_0x5279a5,_0x249ebc,_0x255cb6){var _0x5376e2=[_0xb0cf('0x26'),_0xb0cf('0x27'),_0xb0cf('0x28'),_0xb0cf('0x29'),_0x165971+'.'+_0x249ebc,_0xb0cf('0x2a'),'cm_contacts.updatedAt','cm_contacts.priority',_0xb0cf('0x2b'),'\x22'+_0x255cb6+'\x22'];return squel['insert']()[_0xb0cf('0x2c')]('cm_hopper')[_0xb0cf('0x2d')](['phone','scheduledat',_0xb0cf('0x2e'),'ListId',_0x249ebc,'createdAt',_0xb0cf('0x2f'),'priority','UserId',_0xb0cf('0x30')],squel[_0xb0cf('0x31')]()[_0xb0cf('0x32')](_0x5376e2)[_0xb0cf('0xe')](_0x165971)[_0xb0cf('0xf')]('cm_contacts',null,_0xb0cf('0x33')+_0x165971+_0xb0cf('0x34'))[_0xb0cf('0xf')](_0x5279a5,null,_0x5279a5+_0xb0cf('0x10')+_0x165971+'.'+_0x249ebc)['where'](_0x165971+_0xb0cf('0x35'),_0x524939)[_0xb0cf('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb0cf('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x165971,_0x5279a5,_0x249ebc,_0xb0cf('0x36'),[_0xb0cf('0x37'),_0xb0cf('0x38')]))[_0xb0cf('0x11')](_0xb0cf('0x39'),selectNotIn(_0x165971,_0x5279a5,_0x249ebc,'cm_hopper',[_0xb0cf('0x37')])))['toString']();}function insertCmHopperBlack(_0x1c8813,_0x31ddd8,_0x42967d,_0x249fe2){var _0x572dea=[_0xb0cf('0x26'),_0xb0cf('0x28'),_0xb0cf('0x29'),_0x31ddd8+'.'+_0x249fe2,_0xb0cf('0x2a'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb0cf('0x2c')](_0xb0cf('0x3a'))['fromQuery']([_0xb0cf('0xd'),'ContactId',_0xb0cf('0x3b'),_0x249fe2,'createdAt','updatedAt'],squel[_0xb0cf('0x31')]()[_0xb0cf('0x32')](_0x572dea)['from'](_0x31ddd8)[_0xb0cf('0xf')](_0xb0cf('0x3c'),null,_0xb0cf('0x33')+_0x31ddd8+'.CmListId')['join'](_0x42967d,null,_0x42967d+_0xb0cf('0x10')+_0x31ddd8+'.'+_0x249fe2)[_0xb0cf('0x11')](_0x31ddd8+_0xb0cf('0x35'),_0x1c8813)[_0xb0cf('0x11')](_0xb0cf('0x3d'),NOW)[_0xb0cf('0x11')](_0xb0cf('0x39'),squel[_0xb0cf('0x31')]()[_0xb0cf('0x3e')]('phone')[_0xb0cf('0xe')](_0xb0cf('0x3a'))[_0xb0cf('0x11')]('ListId\x20=\x20?',_0x1c8813)[_0xb0cf('0x11')](_0x249fe2+'\x20=\x20?',_0x31ddd8+'.'+_0x249fe2)))['toString']();}function insertCmHopperAdditionalPhones(_0x51adeb){var _0x940919=['cm_hopper.id',_0xb0cf('0x3f'),'cm_contact_has_items.OrderBy',_0xb0cf('0x40'),_0xb0cf('0x41')];return squel[_0xb0cf('0x42')]()[_0xb0cf('0x2c')](_0xb0cf('0x43'))[_0xb0cf('0x2d')]([_0xb0cf('0x44'),'phone',_0xb0cf('0x45'),'createdAt',_0xb0cf('0x2f')],squel[_0xb0cf('0x31')]()[_0xb0cf('0x32')](_0x940919)[_0xb0cf('0xe')](_0xb0cf('0x36'))[_0xb0cf('0xf')](_0xb0cf('0x3c'),null,_0xb0cf('0x46'))[_0xb0cf('0xf')](_0xb0cf('0x47'),null,_0xb0cf('0x48'))['where'](_0xb0cf('0x49'),_0x51adeb)['where'](_0xb0cf('0x3d'),NOW))['toString']();}function insertCmContact(_0x8f5f7e,_0x48c02e,_0x75f760,_0x532890){var _0x486aa2=_[_0xb0cf('0x4a')](_[_0xb0cf('0x4b')](_0x532890),[_0xb0cf('0x3b'),'CompanyId',_0xb0cf('0x4c'),_0xb0cf('0x2f')]);return squel['insert']()[_0xb0cf('0x2c')](_0xb0cf('0x3c'))[_0xb0cf('0x2d')](_0x486aa2,squel[_0xb0cf('0x31')]()[_0xb0cf('0x32')](_0x486aa2)[_0xb0cf('0xe')](_0x48c02e)[_0xb0cf('0x11')]('('+_0x75f760[_0xb0cf('0xf')](',')+_0xb0cf('0x4d'),squel['select']()[_0xb0cf('0x32')](_0x75f760)[_0xb0cf('0xe')]('cm_contacts')['where'](_0xb0cf('0x4e'),_0x8f5f7e))[_0xb0cf('0x11')](_0xb0cf('0x4f'),squel[_0xb0cf('0x31')]()[_0xb0cf('0x3e')]('MIN(id)',_0xb0cf('0x50'))[_0xb0cf('0xe')](_0x48c02e)[_0xb0cf('0x51')](_0x75f760[_0xb0cf('0xf')](','))))[_0xb0cf('0x52')]();}function handleStop(){logger['info'](_0xb0cf('0x53'));stopped=!![];}function handleUncaughtException(_0x39e710){logger[_0xb0cf('0x54')](_0x39e710[_0xb0cf('0x1d')]);process[_0xb0cf('0x55')](0x1);}function handleError(_0x3e8c18,_0x310111){stats[_0xb0cf('0x56')]['push']({'name':_0x310111[_0xb0cf('0x57')],'message':_0x310111[_0xb0cf('0x1d')],'row':_0x3e8c18});}function handleQuery(_0x369d9a){logger[_0xb0cf('0x58')](_0x369d9a);return db[_0xb0cf('0x59')][_0xb0cf('0x13')](_0x369d9a)[_0xb0cf('0x15')](function(_0x3c1add){results['push'](_0x3c1add);})['catch'](function(_0x340e18){logger[_0xb0cf('0x54')](_0x340e18[_0xb0cf('0x1d')]);});}function main(_0x5722d4,_0xb573ba,_0x39c80e,_0x27b1d1){logger['info'](_0xb0cf('0x5a'),_0x5722d4,JSON[_0xb0cf('0x5b')](_0xb573ba));process[_0xb0cf('0x5c')]('start');var _0x28395a=_0xb573ba[_0xb0cf('0x5d')];var _0x49b1b1=_[_0xb0cf('0x5e')](_0x28395a);var _0xe74b70=_0xb573ba['socket_timestamp'];var _0x27ad51=path[_0xb0cf('0xf')](config[_0xb0cf('0x5f')],'server/files/tmp',_0xe74b70+'.csv');logger[_0xb0cf('0x58')]('body',_0xb573ba);db['ContactItemType'][_0xb0cf('0x60')]({'raw':!![],'attributes':['id',_0xb0cf('0x61')]})['then'](function(_0x51aef6){for(var _0x3e5c88=0x0;_0x3e5c88<_0x51aef6[_0xb0cf('0x16')];_0x3e5c88++){if(_0x51aef6[_0x3e5c88][_0xb0cf('0x61')]in _0x28395a){contactItemTypes['push'](_0x51aef6[_0x3e5c88]);delete _0x49b1b1[_0x51aef6[_0x3e5c88][_0xb0cf('0x61')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x49b1b1[_0xb0cf('0x18')]='';var _0x1e9485=_['keys'](_0x49b1b1)[_0xb0cf('0xf')]();logger[_0xb0cf('0x58')](_0xb0cf('0x62'),_0x1e9485);fs['writeFileSync'](_0x27ad51,_0x1e9485+'\x0a');Papa['parse'](fs[_0xb0cf('0x63')](_0x5722d4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x567ca2,_0x3471c6){try{for(var _0x208e1d=0x0,_0x572982=[];_0x208e1d<_0x567ca2['data'][_0xb0cf('0x16')];_0x208e1d++){stats[_0xb0cf('0x64')]+=0x1;if(_0x567ca2['errors'][_0x208e1d]){handleError(_0x567ca2[_0xb0cf('0x65')][_0x208e1d],_0x567ca2[_0xb0cf('0x56')][_0x208e1d]);}else{var _0x1f5526=[];var _0x3d5bcd=[];for(var _0x42457a in _0x28395a){let _0x56bd25=contactItemTypes[_0xb0cf('0x66')](_0x2fca51=>_0x2fca51[_0xb0cf('0x61')]===_0x42457a);if(_['isNil'](_0x56bd25)){if(_0x28395a[_0xb0cf('0x67')](_0x42457a)){if(_0x567ca2['data'][_0x208e1d][_0x28395a[_0x42457a]]){var _0x335910=_['trim'](_0x567ca2[_0xb0cf('0x65')][_0x208e1d][_0x28395a[_0x42457a]][_0xb0cf('0x68')](/"/g,'\x27'));switch(_0x42457a){case _0xb0cf('0x69'):var _0x336947=moment(_0x335910,_0xb0cf('0xa'),!![]);if(_0x336947[_0xb0cf('0x6a')]()){_0x572982[_0xb0cf('0x19')]('\x22'+_0x335910+'\x22');}else{_0x1f5526[_0xb0cf('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb0cf('0x6b'):var _0x376cff=parseInt(_0x335910);_0x335910=_['isNaN'](_0x376cff)||_0x376cff<0x0||_0x376cff>0x4?_0x27b1d1?0x3:0x2:_0x376cff;_0x572982['push']('\x22'+_0x335910+'\x22');break;case'UserId':var _0x98bbda=parseInt(_0x335910);if(_[_0xb0cf('0x6c')](_0x98bbda)&&_[_0xb0cf('0x6d')](_0x39c80e,_0x98bbda)){_0x572982[_0xb0cf('0x19')]('\x22'+_0x98bbda+'\x22');}else{_0x1f5526[_0xb0cf('0x19')](_0xb0cf('0x6e'));}break;case _0xb0cf('0x6f'):if(isEmail(_0x335910)){_0x572982[_0xb0cf('0x19')]('\x22'+_0x335910+'\x22');}else{_0x1f5526[_0xb0cf('0x19')](_0xb0cf('0x70'));}break;case _0xb0cf('0x71'):var _0x12651a=moment(_0x335910,'YYYY-MM-DD',!![]);if(_0x12651a[_0xb0cf('0x6a')]()){_0x572982[_0xb0cf('0x19')]('\x22'+_0x335910+'\x22');}else{_0x1f5526['push'](_0xb0cf('0x72'));}break;default:_0x572982[_0xb0cf('0x19')]('\x22'+_0x335910+'\x22');}}else{switch(_0x42457a){case _0xb0cf('0x73'):case _0xb0cf('0xd'):_0x1f5526['push'](_0x42457a+_0xb0cf('0x74'));break;default:_0x572982[_0xb0cf('0x19')]('\x22\x22');}}}}else{var _0x2973b0='';for(var _0x76cf2d=0x0;_0x76cf2d<_0x28395a[_0x42457a][_0xb0cf('0x16')];_0x76cf2d++){var _0x335910=_[_0xb0cf('0x75')](_0x567ca2[_0xb0cf('0x65')][_0x208e1d][_0x28395a[_0x42457a][_0x76cf2d]][_0xb0cf('0x68')](/"/g,'\x27'));if(_0x2973b0=='')_0x2973b0=_0x335910;else _0x2973b0+='|'+_0x335910;}_0x3d5bcd[_0xb0cf('0x19')](_0x56bd25['id']+':'+_0x2973b0);}}if(hasAdditionalPhones){_0x572982['push']('\x22'+_0x3d5bcd['join'](';')+'\x22');}if(_0x1f5526[_0xb0cf('0x16')]){handleError(_0x567ca2[_0xb0cf('0x65')][_0x208e1d],{'code':_0xb0cf('0x76'),'message':_0x1f5526[_0xb0cf('0xf')]()});}else{fs[_0xb0cf('0x77')](_0x27ad51,_0x572982['join']()+'\x0a');}_0x572982=[];}if(!(stats[_0xb0cf('0x64')]%0xc8)){socket[_0xb0cf('0x78')](_0xb0cf('0x79')+_0xe74b70,stats);stats[_0xb0cf('0x56')]=[];}}if(stopped){logger[_0xb0cf('0x58')](_0xb0cf('0x7a'));_0x3471c6[_0xb0cf('0x7b')]();}}catch(_0x5ab7d4){handleError(_0x567ca2[_0xb0cf('0x65')][_0x208e1d],{'code':_0xb0cf('0x7c'),'message':_0x5ab7d4['message']});logger[_0xb0cf('0x54')](_0xb0cf('0x7d'),_0x5ab7d4[_0xb0cf('0x1d')]);}},'complete':function(){try{var _0x2fb9fb=[];var _0x10f5d6=tempTableName;_0x2fb9fb[_0xb0cf('0x19')](_0xb0cf('0x7e')+_0x10f5d6+_0xb0cf('0x7f'));logger[_0xb0cf('0x58')](_0xb0cf('0x80'),contactItemTypes[_0xb0cf('0x16')]);var _0x152a07=util[_0xb0cf('0x9')](_0xb0cf('0x81'),_0x27ad51,_0x10f5d6,_0x1e9485,_0xb573ba[_0xb0cf('0x3b')],_0xb573ba[_0xb0cf('0x82')]||null,NOW,NOW);if(_[_0xb0cf('0x17')](_0x28395a[_0xb0cf('0x69')])){_0x152a07+=',\x20scheduledAt\x20=\x20NOW()';}_0x2fb9fb['push'](_0x152a07);BPromise[_0xb0cf('0x83')](_0x2fb9fb,handleQuery)['then'](function(_0x2bd2bf){BPromise[_0xb0cf('0x1a')]([handleAdditionalPhones()])[_0xb0cf('0x1b')](function(){_0x2fb9fb=[];for(var _0x787de3=0x0;_0x787de3_0x1d2709[_0xe570('0x6b')]===_0x21b4e2);if(_['isNil'](_0x374741)){if(_0x441b8c[_0xe570('0x72')](_0x21b4e2)){if(_0x4c55b2[_0xe570('0x70')][_0x385fa1][_0x441b8c[_0x21b4e2]]){var _0x3ed0ad=_[_0xe570('0x73')](_0x4c55b2[_0xe570('0x70')][_0x385fa1][_0x441b8c[_0x21b4e2]][_0xe570('0x74')](/"/g,'\x27'));switch(_0x21b4e2){case'scheduledat':var _0x137e2b=moment(_0x3ed0ad,_0xe570('0x75'),!![]);if(_0x137e2b[_0xe570('0x76')]()){_0x17d8a7[_0xe570('0x1b')]('\x22'+_0x3ed0ad+'\x22');}else{_0x623b52[_0xe570('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe570('0x39'):var _0x351b75=parseInt(_0x3ed0ad);_0x3ed0ad=_[_0xe570('0x77')](_0x351b75)||_0x351b75<0x0||_0x351b75>0x4?_0x50a9e9?0x3:0x2:_0x351b75;_0x17d8a7[_0xe570('0x1b')]('\x22'+_0x3ed0ad+'\x22');break;case _0xe570('0x3a'):var _0x57e2f7=parseInt(_0x3ed0ad);if(_[_0xe570('0x78')](_0x57e2f7)&&_['includes'](_0x2b9c4b,_0x57e2f7)){_0x17d8a7['push']('\x22'+_0x57e2f7+'\x22');}else{_0x623b52[_0xe570('0x1b')](_0xe570('0x79'));}break;case'email':if(isEmail(_0x3ed0ad)){_0x17d8a7[_0xe570('0x1b')]('\x22'+_0x3ed0ad+'\x22');}else{_0x623b52[_0xe570('0x1b')](_0xe570('0x7a'));}break;case'dateOfBirth':var _0x7a9b70=moment(_0x3ed0ad,_0xe570('0x7b'),!![]);if(_0x7a9b70[_0xe570('0x76')]()){_0x17d8a7['push']('\x22'+_0x3ed0ad+'\x22');}else{_0x623b52[_0xe570('0x1b')](_0xe570('0x7c'));}break;default:_0x17d8a7[_0xe570('0x1b')]('\x22'+_0x3ed0ad+'\x22');}}else{switch(_0x21b4e2){case _0xe570('0x7d'):case _0xe570('0x10'):_0x623b52[_0xe570('0x1b')](_0x21b4e2+_0xe570('0x7e'));break;default:_0x17d8a7[_0xe570('0x1b')]('\x22\x22');}}}}else{var _0x257a4a='';for(var _0x420033=0x0;_0x420033<_0x441b8c[_0x21b4e2]['length'];_0x420033++){var _0x3ed0ad=_[_0xe570('0x73')](_0x4c55b2[_0xe570('0x70')][_0x385fa1][_0x441b8c[_0x21b4e2][_0x420033]][_0xe570('0x74')](/"/g,'\x27'));if(_0x257a4a=='')_0x257a4a=_0x3ed0ad;else _0x257a4a+='|'+_0x3ed0ad;}_0x55ed64['push'](_0x374741['id']+':'+_0x257a4a);}}if(hasAdditionalPhones){_0x17d8a7[_0xe570('0x1b')]('\x22'+_0x55ed64['join'](';')+'\x22');}if(_0x623b52[_0xe570('0x19')]){handleError(_0x4c55b2['data'][_0x385fa1],{'code':_0xe570('0x7f'),'message':_0x623b52['join']()});}else{fs[_0xe570('0x80')](_0x2a07e4,_0x17d8a7[_0xe570('0x11')]()+'\x0a');}_0x17d8a7=[];}if(!(stats['rows']%0xc8)){socket[_0xe570('0x81')]('contact:import:'+_0x4924c9,stats);stats[_0xe570('0x5d')]=[];}}if(stopped){logger[_0xe570('0x5e')](_0xe570('0x82'));_0x4bf71c['abort']();}}catch(_0x353213){handleError(_0x4c55b2[_0xe570('0x70')][_0x385fa1],{'code':'SystemError','message':_0x353213['message']});logger['error'](_0xe570('0x83'),_0x353213[_0xe570('0x1f')]);}},'complete':function(){try{var _0x3c1e41=[];var _0x498d98=tempTableName;_0x3c1e41[_0xe570('0x1b')]('CREATE\x20TABLE\x20'+_0x498d98+_0xe570('0x84'));logger[_0xe570('0x5e')](_0xe570('0x85'),contactItemTypes[_0xe570('0x19')]);var _0x57cc18=util[_0xe570('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2a07e4,_0x498d98,_0x3362ca,_0x2af1b1[_0xe570('0x47')],_0x2af1b1[_0xe570('0x57')]||null,NOW,NOW);if(_[_0xe570('0x1a')](_0x441b8c[_0xe570('0x36')])){_0x57cc18+=',\x20scheduledAt\x20=\x20NOW()';}_0x3c1e41['push'](_0x57cc18);BPromise[_0xe570('0x86')](_0x3c1e41,handleQuery)[_0xe570('0x22')](function(_0x1c25af){BPromise['all']([handleAdditionalPhones()])[_0xe570('0x22')](function(){_0x3c1e41=[];for(var _0x3b8429=0x0;_0x3b8429\x20\x20');}var _0x430ba2=path[_0xe570('0x11')](config[_0xe570('0x65')],_0xe570('0x66'),process[_0xe570('0x92')][0x2]);if(!fs[_0xe570('0x93')](_0x430ba2)){throw new Error(_0xe570('0x94'));}var _0x139c00={};try{_0x139c00=JSON[_0xe570('0x6e')](process[_0xe570('0x92')][0x3]);if(!_0x139c00['binding']){throw new Error(_0xe570('0x95'));}var _0x1e3f24=0x0;if(_0x139c00['binding'][_0xe570('0x3a')]){_0x1e3f24=0x1;}if(!_0x139c00[_0xe570('0x47')]){throw new Error(_0xe570('0x96'));}}catch(_0x205b3b){throw new Error(_0xe570('0x97'));}var _0x349449=[];try{_0x349449=_['map'](JSON[_0xe570('0x6e')](process[_0xe570('0x92')][0x4]),'id');}catch(_0x453fcf){logger['info'](_0xe570('0x98'));}main(_0x430ba2,_0x139c00,_0x349449,_0x1e3f24);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe570('0x99'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 8aff355..aafdcf3 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 _0x6f2f=['Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6f2f[_0x231e16];return _0x570a7c;};'use strict';exports[_0xf6f2('0x0')]=function(_0x1d4df6,_0x4ef916){var _0x4e24e1=[{'type':'string','content':_0xf6f2('0x1'),'variableName':null}];switch(_0x1d4df6['toLowerCase']()){case'voice':switch(_0x4ef916[_0xf6f2('0x2')]()){case _0xf6f2('0x3'):_0x4e24e1[_0xf6f2('0x4')]({'type':'variable','content':'','variableName':'queue'});_0x4e24e1[_0xf6f2('0x4')]({'type':_0xf6f2('0x5'),'content':'','variableName':_0xf6f2('0x6')});break;case _0xf6f2('0x7'):_0x4e24e1[_0xf6f2('0x4')]({'type':_0xf6f2('0x8'),'content':_0xf6f2('0x9'),'variableName':null});_0x4e24e1[_0xf6f2('0x4')]({'type':_0xf6f2('0x5'),'content':'','variableName':_0xf6f2('0xa')});break;}}return _0x4e24e1;};exports['getDescriptions']=function(_0x109271,_0x266c6e){var _0x2a4325=[];switch(_0x109271[_0xf6f2('0x2')]()){case'voice':switch(_0x266c6e['toLowerCase']()){case'inbound':_0x2a4325=[{'type':_0xf6f2('0x8'),'content':_0xf6f2('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0xd'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0x6')},{'type':'keyValue','content':'','key':_0xf6f2('0xe'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0xf')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x10'),'keyType':'variable','variableName':_0xf6f2('0x11')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x12'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0x13')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x14'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0x15')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x16'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0x17')},{'type':_0xf6f2('0x8'),'content':_0xf6f2('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xf6f2('0x5'),'variableName':'destcalleridname'},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x19'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0xa')},{'type':'string','content':_0xf6f2('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x1b'),'keyType':_0xf6f2('0x5'),'variableName':'agentcalledAt'},{'type':_0xf6f2('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0xf6f2('0x5'),'variableName':'agentconnectAt'},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x1c'),'keyType':'variable','variableName':_0xf6f2('0x1d')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x1e'),'keyType':_0xf6f2('0x5'),'variableName':_0xf6f2('0x1f')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x20'),'keyType':_0xf6f2('0x5'),'variableName':'talktime'}];break;case _0xf6f2('0x7'):_0x2a4325=[{'type':_0xf6f2('0x8'),'content':_0xf6f2('0xb'),'variableName':null},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x21'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0xa')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x22'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x23')},{'type':'keyValue','content':'','key':_0xf6f2('0x14'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x15')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x16'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x24')},{'type':_0xf6f2('0x8'),'content':_0xf6f2('0x1a')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x25'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x26'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x27')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x28'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x29')},{'type':_0xf6f2('0xc'),'content':'','key':_0xf6f2('0x2a'),'keyType':_0xf6f2('0x5'),'keyContent':'','variableName':_0xf6f2('0x2b')}];break;}}return _0x2a4325;}; \ No newline at end of file +var _0x36ee=['toLowerCase','voice','inbound','push','variable','queue','calleridnum','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';exports['getSubjects']=function(_0x4889d8,_0x34e33c){var _0x521ff3=[{'type':_0xe36e('0x0'),'content':_0xe36e('0x1'),'variableName':null}];switch(_0x4889d8[_0xe36e('0x2')]()){case _0xe36e('0x3'):switch(_0x34e33c[_0xe36e('0x2')]()){case _0xe36e('0x4'):_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':_0xe36e('0x7')});_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':_0xe36e('0x8')});break;case'outbound':_0x521ff3[_0xe36e('0x5')]({'type':'string','content':_0xe36e('0x9'),'variableName':null});_0x521ff3[_0xe36e('0x5')]({'type':_0xe36e('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x521ff3;};exports[_0xe36e('0xa')]=function(_0x48981b,_0x2e968d){var _0x2133cf=[];switch(_0x48981b[_0xe36e('0x2')]()){case _0xe36e('0x3'):switch(_0x2e968d[_0xe36e('0x2')]()){case _0xe36e('0x4'):_0x2133cf=[{'type':_0xe36e('0x0'),'content':_0xe36e('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xe36e('0xc'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x8')},{'type':_0xe36e('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xe36e('0x6'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0xe36e('0xe'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0xf')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x10'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x7')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x11'),'keyType':_0xe36e('0x6'),'variableName':'uniqueid'},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x12'),'keyType':'variable','variableName':_0xe36e('0x13')},{'type':'string','content':_0xe36e('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xe36e('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x15')},{'type':_0xe36e('0xd'),'content':'','key':'Agent\x20Number','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x16')},{'type':_0xe36e('0x0'),'content':_0xe36e('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x18'),'keyType':'variable','variableName':_0xe36e('0x13')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x19'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1b')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x1c'),'keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1d')},{'type':_0xe36e('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xe36e('0x6'),'variableName':_0xe36e('0x1e')}];break;case _0xe36e('0x1f'):_0x2133cf=[{'type':_0xe36e('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xe36e('0xd'),'content':'','key':'Called\x20Number','keyType':_0xe36e('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xe36e('0xd'),'content':'','key':'Member\x20Name','keyType':_0xe36e('0x6'),'keyContent':'','variableName':'membername'},{'type':_0xe36e('0xd'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xe36e('0x12'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0xe36e('0x17')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x20'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x21')},{'type':_0xe36e('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x22')},{'type':'keyValue','content':'','key':_0xe36e('0x23'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x24')},{'type':_0xe36e('0xd'),'content':'','key':_0xe36e('0x25'),'keyType':_0xe36e('0x6'),'keyContent':'','variableName':_0xe36e('0x26')}];break;}}return _0x2133cf;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 71d9756..ff68c0b 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 _0x4536=['error','tracked','user','query','clone','body','omit','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','then','update','info','catch'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x4536,0xe9));var _0x6453=function(_0x2b6d85,_0x238bbc){_0x2b6d85=_0x2b6d85-0x0;var _0x2d1f1d=_0x4536[_0x2b6d85];return _0x2d1f1d;};'use strict';var _=require(_0x6453('0x0'));var db=require(_0x6453('0x1'))['db'];var loggers={'openchannel':require(_0x6453('0x2'))(_0x6453('0x3')),'mail':require('../../config/logger')(_0x6453('0x4')),'fax':require(_0x6453('0x2'))('fax-interactions'),'sms':require(_0x6453('0x2'))(_0x6453('0x5')),'chat':require(_0x6453('0x2'))('chat-interactions'),'whatsapp':require(_0x6453('0x2'))(_0x6453('0x6'))};function getInteractionId(_0x4cd062,_0x1c02d8,_0x2462e4){if(_0x4cd062&&_0x4cd062[_['upperFirst'](_0x2462e4)+_0x6453('0x7')]){return _0x4cd062[_[_0x6453('0x8')](_0x2462e4)+_0x6453('0x7')];}else if(_0x4cd062&&_0x4cd062['id']){return _0x4cd062['id'];}else if(_0x1c02d8&&_0x1c02d8['id']){return _0x1c02d8['id'];}else{return _0x6453('0x9');}}function log(_0x3bf9fb,_0x1d939d,_0x5eb169,_0x46b362,_0x43b184,_0x5aa557){loggers[_0x43b184['toLowerCase']()][_0x3bf9fb](_0x6453('0xa'),_0x5aa557[_0x6453('0xb')](),_0x1d939d?_0x1d939d['id']:null,_0x1d939d?_0x1d939d[_0x6453('0xc')]:null,_0x1d939d?_0x1d939d[_0x6453('0xd')]:null,getInteractionId(_0x5eb169,_0x46b362,_0x43b184),_0x5eb169?JSON[_0x6453('0xe')](_0x5eb169):'null');}function updateUser(_0x435d0a,_0xc45302,_0x4debf5,_0x1963c3,_0x11fcc5){db[_[_0x6453('0x8')](_0x1963c3)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0xc45302,_0x4debf5,_0x1963c3)}})[_0x6453('0xf')](function(_0x2f111d){if(_0x2f111d){return _0x2f111d[_0x6453('0x10')]({'UserId':_0x435d0a?_0x435d0a['id']:null});}})[_0x6453('0xf')](function(_0x3e7c5e){if(_0x3e7c5e){log(_0x6453('0x11'),_0x435d0a,_0xc45302,_0x4debf5,_0x1963c3,_0x11fcc5);}})[_0x6453('0x12')](function(){log(_0x6453('0x13'),_0x435d0a,_0xc45302,_0x4debf5,_0x1963c3,_0x11fcc5);});}exports[_0x6453('0x14')]=function(_0x579331,_0x334128){return function(_0x446707,_0x32b391,_0xbbc06a){var _0x17260d=_0x446707[_0x6453('0x15')];var _0x43332e={};var _0x4ac4fd=_0x446707[_0x6453('0x16')];if(_0x43332e){_0x43332e=_[_0x6453('0x17')](_0x446707[_0x6453('0x18')]);_0x43332e=_[_0x6453('0x19')](_0x43332e,[_0x6453('0x18'),'html',_0x6453('0x1a'),'fax',_0x6453('0x1b')]);}updateUser(_0x17260d,_0x43332e,_0x4ac4fd,_0x579331,_0x334128);_0xbbc06a(null);};}; \ No newline at end of file +var _0x1f10=['body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','info','catch','error','tracked','user','query','clone'];(function(_0x16d369,_0xbbaa52){var _0x53c1ca=function(_0x49908d){while(--_0x49908d){_0x16d369['push'](_0x16d369['shift']());}};_0x53c1ca(++_0xbbaa52);}(_0x1f10,0x69));var _0x01f1=function(_0x3d3ffc,_0x39cc32){_0x3d3ffc=_0x3d3ffc-0x0;var _0x5b2bb1=_0x1f10[_0x3d3ffc];return _0x5b2bb1;};'use strict';var _=require(_0x01f1('0x0'));var db=require(_0x01f1('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x01f1('0x2')),'mail':require(_0x01f1('0x3'))('mail-interactions'),'fax':require('../../config/logger')(_0x01f1('0x4')),'sms':require('../../config/logger')(_0x01f1('0x5')),'chat':require(_0x01f1('0x3'))(_0x01f1('0x6')),'whatsapp':require('../../config/logger')(_0x01f1('0x7'))};function getInteractionId(_0x35b9d4,_0x33e3d5,_0x17f4d1){if(_0x35b9d4&&_0x35b9d4[_[_0x01f1('0x8')](_0x17f4d1)+_0x01f1('0x9')]){return _0x35b9d4[_[_0x01f1('0x8')](_0x17f4d1)+_0x01f1('0x9')];}else if(_0x35b9d4&&_0x35b9d4['id']){return _0x35b9d4['id'];}else if(_0x33e3d5&&_0x33e3d5['id']){return _0x33e3d5['id'];}else{return'unknown';}}function log(_0x120bd1,_0x413939,_0x46dd46,_0x38c644,_0x4fee68,_0x4a510b){loggers[_0x4fee68[_0x01f1('0xa')]()][_0x120bd1](_0x01f1('0xb'),_0x4a510b[_0x01f1('0xc')](),_0x413939?_0x413939['id']:null,_0x413939?_0x413939[_0x01f1('0xd')]:null,_0x413939?_0x413939[_0x01f1('0xe')]:null,getInteractionId(_0x46dd46,_0x38c644,_0x4fee68),_0x46dd46?JSON[_0x01f1('0xf')](_0x46dd46):_0x01f1('0x10'));}function updateUser(_0x28b3d0,_0x486b89,_0x42373f,_0xecd06d,_0x177e69){db[_[_0x01f1('0x8')](_0xecd06d)+_0x01f1('0x11')]['findOne']({'where':{'id':getInteractionId(_0x486b89,_0x42373f,_0xecd06d)}})[_0x01f1('0x12')](function(_0x51116e){if(_0x51116e){return _0x51116e[_0x01f1('0x13')]({'UserId':_0x28b3d0?_0x28b3d0['id']:null});}})[_0x01f1('0x12')](function(_0xa7c876){if(_0xa7c876){log(_0x01f1('0x14'),_0x28b3d0,_0x486b89,_0x42373f,_0xecd06d,_0x177e69);}})[_0x01f1('0x15')](function(){log(_0x01f1('0x16'),_0x28b3d0,_0x486b89,_0x42373f,_0xecd06d,_0x177e69);});}exports[_0x01f1('0x17')]=function(_0x29d37d,_0x3e6612){return function(_0x2ea799,_0x1465c2,_0x3b0e2e){var _0x234024=_0x2ea799[_0x01f1('0x18')];var _0x57a5c1={};var _0xb1cbdc=_0x2ea799[_0x01f1('0x19')];if(_0x57a5c1){_0x57a5c1=_[_0x01f1('0x1a')](_0x2ea799[_0x01f1('0x1b')]);_0x57a5c1=_[_0x01f1('0x1c')](_0x57a5c1,['body',_0x01f1('0x1d'),_0x01f1('0x1e'),_0x01f1('0x1f'),_0x01f1('0x20')]);}updateUser(_0x234024,_0x57a5c1,_0xb1cbdc,_0x29d37d,_0x3e6612);_0x3b0e2e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3cb4d7e..b1602bc 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 _0xb574=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','crypto','util'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xb574,0x120));var _0x4b57=function(_0x5617e6,_0x505a74){_0x5617e6=_0x5617e6-0x0;var _0x590661=_0xb574[_0x5617e6];return _0x590661;};'use strict';var crypto=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var compose=require(_0x4b57('0x2'));var db=require(_0x4b57('0x3'))['db'];var config=require(_0x4b57('0x4'));function getValueFromLicense(_0x5686ea,_0x3f82b1){if(_0x5686ea&&_0x3f82b1){if(_0x3f82b1[_0x4b57('0x5')]&&_0x3f82b1[_0x4b57('0x6')]){var _0x283fe3=_0x3f82b1[_0x4b57('0x5')];var _0x11940f=_0x3f82b1[_0x4b57('0x6')];var _0x547413=_0x283fe3['split']('-')[0x4];var _0x345dae=_0x283fe3[_0x4b57('0x7')]('-')[0x0];var _0x54e74f=crypto['createDecipher'](_0x4b57('0x8'),util[_0x4b57('0x9')](_0x4b57('0xa'),_0x547413,_0x283fe3,_0x345dae));var _0x2f25db=_0x54e74f['update'](_0x11940f,_0x4b57('0xb'),_0x4b57('0xc'));_0x2f25db+=_0x54e74f[_0x4b57('0xd')](_0x4b57('0xc'));var _0x375d05=JSON[_0x4b57('0xe')](_0x2f25db);return _0x375d05[_0x4b57('0xf')](_0x5686ea)?_0x375d05[_0x5686ea]:null;}}return null;}function isLimit(_0x2a7d0c,_0x5b5bfc,_0x193e22,_0x13df85){var _0x13cc39=_0x5b5bfc;return compose()[_0x4b57('0x10')](function(_0x48f6b9,_0x2b4d48,_0x4667e0){return db[_0x4b57('0x11')][_0x4b57('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x4b57('0x13')](function(_0x5daea2){var _0xd941ff=getValueFromLicense(_0x2a7d0c,_0x5daea2);return _0xd941ff?_0xd941ff:_0x13cc39;})[_0x4b57('0x13')](function(_0x19abda){_0x13cc39=_0x19abda;return _0x193e22[_0x4b57('0x14')](_0x13df85);})['then'](function(_0x59ab58){if(_0x59ab58>=_0x13cc39){return _0x2b4d48[_0x4b57('0x15')](0x193)[_0x4b57('0x16')]({'message':util[_0x4b57('0x9')](_0x4b57('0x17'),_0x2a7d0c)});}_0x4667e0();})[_0x4b57('0x18')](function(_0x35d7cf){_0x4667e0(_0x35d7cf);});});}function isUserLimit(){return isLimit(_0x4b57('0x19'),0x1,db[_0x4b57('0x1a')],{'where':{'$or':[{'role':_0x4b57('0x1b')},{'role':'user'}]}});}exports[_0x4b57('0x1c')]=isUserLimit; \ No newline at end of file +var _0x6183=['%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','License','findOne','then','count','status','json','catch','users','User','admin','user','util','composable-middleware','../../config/environment','license','split','createDecipher','aes-256-ctr','format'];(function(_0x295406,_0xcf19b6){var _0x3aeb29=function(_0x4c98a6){while(--_0x4c98a6){_0x295406['push'](_0x295406['shift']());}};_0x3aeb29(++_0xcf19b6);}(_0x6183,0xf2));var _0x3618=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x6183[_0x215dc8];return _0x583ea3;};'use strict';var crypto=require('crypto');var util=require(_0x3618('0x0'));var compose=require(_0x3618('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x3618('0x2'));function getValueFromLicense(_0xeb8a7d,_0x2b9d93){if(_0xeb8a7d&&_0x2b9d93){if(_0x2b9d93['data1']&&_0x2b9d93[_0x3618('0x3')]){var _0x5d9a5b=_0x2b9d93['data1'];var _0x36024a=_0x2b9d93[_0x3618('0x3')];var _0x1a0a5a=_0x5d9a5b[_0x3618('0x4')]('-')[0x4];var _0x38b2b3=_0x5d9a5b[_0x3618('0x4')]('-')[0x0];var _0xa559e2=crypto[_0x3618('0x5')](_0x3618('0x6'),util[_0x3618('0x7')](_0x3618('0x8'),_0x1a0a5a,_0x5d9a5b,_0x38b2b3));var _0xeab35c=_0xa559e2[_0x3618('0x9')](_0x36024a,_0x3618('0xa'),_0x3618('0xb'));_0xeab35c+=_0xa559e2['final'](_0x3618('0xb'));var _0x2e686d=JSON[_0x3618('0xc')](_0xeab35c);return _0x2e686d[_0x3618('0xd')](_0xeb8a7d)?_0x2e686d[_0xeb8a7d]:null;}}return null;}function isLimit(_0x38e68d,_0x3356ba,_0x11ecfe,_0x3d21f9){var _0x28c708=_0x3356ba;return compose()['use'](function(_0xdc33c8,_0x36db84,_0xa7e34f){return db[_0x3618('0xe')][_0x3618('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x3618('0x10')](function(_0x4d6a62){var _0x43145c=getValueFromLicense(_0x38e68d,_0x4d6a62);return _0x43145c?_0x43145c:_0x28c708;})[_0x3618('0x10')](function(_0x430c1d){_0x28c708=_0x430c1d;return _0x11ecfe[_0x3618('0x11')](_0x3d21f9);})[_0x3618('0x10')](function(_0x146b03){if(_0x146b03>=_0x28c708){return _0x36db84[_0x3618('0x12')](0x193)[_0x3618('0x13')]({'message':util[_0x3618('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x38e68d)});}_0xa7e34f();})[_0x3618('0x14')](function(_0x1eddd8){_0xa7e34f(_0x1eddd8);});});}function isUserLimit(){return isLimit(_0x3618('0x15'),0x1,db[_0x3618('0x16')],{'where':{'$or':[{'role':_0x3618('0x17')},{'role':_0x3618('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 7bf42d0..8d2c123 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 _0xd59c=['replace','[$and]','[$or]','split','length','slice','shift','forEach','filter','map','conditions','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','and'];(function(_0x39ce5a,_0x260622){var _0x46cd9a=function(_0x39fcba){while(--_0x39fcba){_0x39ce5a['push'](_0x39ce5a['shift']());}};_0x46cd9a(++_0x260622);}(_0xd59c,0x113));var _0xcd59=function(_0x3e3557,_0xa9fee9){_0x3e3557=_0x3e3557-0x0;var _0x30e3fd=_0xd59c[_0x3e3557];return _0x30e3fd;};'use strict';var _=require(_0xcd59('0x0'));var moment=require('moment');exports[_0xcd59('0x1')]=function(_0x12ccc0){var _0x2bacc2={'conditions':[]};_0x2bacc2[_0xcd59('0x2')]=_[_0xcd59('0x3')](_0x12ccc0,'[$or]')?'or':_0xcd59('0x4');var _0x1ff0a5=_0x12ccc0[_0xcd59('0x5')](_0xcd59('0x6'),'')[_0xcd59('0x5')](_0xcd59('0x7'),'')[_0xcd59('0x8')]('||');for(var _0x1d3baf=0x0;_0x1d3baf<_0x1ff0a5[_0xcd59('0x9')];_0x1d3baf++){var _0x574870=_0x1ff0a5[_0x1d3baf][_0xcd59('0x8')](':=');var _0x2268e0=_0x574870[0x0];var _0x156445=_0x574870[_0xcd59('0xa')](0x1);_0x156445['forEach'](function(_0x341272){var _0x523a97=_0x341272[_0xcd59('0x8')]('[')[_0xcd59('0xb')]();var _0x262a89=_0x341272['match'](/\[(.*?)\]/g);_0x262a89[_0xcd59('0xc')](function(_0x31ccd6){var _0x1efa19=_0x31ccd6[_0xcd59('0x8')]('[')[_0xcd59('0xd')](function(_0x5b0c57){return _0x5b0c57['indexOf'](']')>-0x1;})[_0xcd59('0xe')](function(_0x43f89a){return _0x43f89a[_0xcd59('0x8')](']')[0x0];})[0x0];_0x2bacc2[_0xcd59('0xf')]['push']({'field':_0x2268e0,'operator':_0x523a97,'value':_0x1efa19});});});}return _0x2bacc2;};exports['buildExpression']=function(_0x2e73df,_0x6b4e25,_0x5f034f){var _0x242f65={};if(_0x6b4e25===_0xcd59('0x10')){if(_0x5f034f[_0xcd59('0x11')]===_0xcd59('0x12')){_0x5f034f[_0xcd59('0x11')]=_0xcd59('0x13');_0x5f034f[_0xcd59('0x14')]+=','+_0x5f034f['value'];}else if(_[_0xcd59('0x15')](['$gt',_0xcd59('0x16')],_0x5f034f['operator'])){_0x5f034f['value']=moment(_0x5f034f['value'])[_0xcd59('0x17')](0x1,_0xcd59('0x18'))[_0xcd59('0x19')](_0xcd59('0x1a'));}}if(_0x5f034f[_0xcd59('0x1b')]){_0x6b4e25=_0x5f034f['castTo'];_0x242f65['text']=_0xcd59('0x1c')+_0x2e73df+'.'+_0x5f034f[_0xcd59('0x1d')]+'\x20AS\x20'+_0x5f034f[_0xcd59('0x1b')]+')\x20'+parseOperator(_0x5f034f[_0xcd59('0x11')]);}else{_0x242f65[_0xcd59('0x1e')]=_0x2e73df+'.'+_0x5f034f['field']+'\x20'+parseOperator(_0x5f034f['operator']);}if(_[_0xcd59('0x15')](['$ne',_0xcd59('0x1f')],_0x5f034f['operator']))_0x242f65['text']='('+_0x242f65['text']+_0xcd59('0x20')+_0x2e73df+'.'+_0x5f034f['field']+_0xcd59('0x21');_0x242f65[_0xcd59('0x14')]=parseValue(_0x6b4e25,_0x5f034f[_0xcd59('0x11')],_0x5f034f[_0xcd59('0x14')]);return _0x242f65;};function parseOperator(_0x5b23fc){var _0x5abb68;switch(_0x5b23fc){case _0xcd59('0x22'):_0x5abb68=_0xcd59('0x23');break;case _0xcd59('0x1f'):_0x5abb68=_0xcd59('0x24');break;case _0xcd59('0x12'):_0x5abb68=_0xcd59('0x25');break;case _0xcd59('0x26'):_0x5abb68=_0xcd59('0x27');break;case _0xcd59('0x28'):case _0xcd59('0x29'):case'$endsWith':_0x5abb68=_0xcd59('0x2a');break;case _0xcd59('0x2b'):_0x5abb68='<\x20?';break;case _0xcd59('0x2c'):_0x5abb68=_0xcd59('0x2d');break;case _0xcd59('0x16'):_0x5abb68=_0xcd59('0x2e');break;case _0xcd59('0x2f'):_0x5abb68=_0xcd59('0x30');break;case'$between':_0x5abb68=_0xcd59('0x31');break;}return _0x5abb68;}function parseValue(_0xf139bb,_0x178e05,_0x1a0a4d){var _0xef4955={'start':undefined,'end':undefined};switch(_0x178e05){case'$in':case _0xcd59('0x1f'):_0xef4955[_0xcd59('0x32')]=_0x1a0a4d[_0xcd59('0x8')](',');break;case'$substring':_0xef4955[_0xcd59('0x32')]='%'+_0x1a0a4d+'%';break;case _0xcd59('0x29'):_0xef4955[_0xcd59('0x32')]=_0x1a0a4d+'%';break;case _0xcd59('0x33'):_0xef4955[_0xcd59('0x32')]='%'+_0x1a0a4d;break;case'$between':var _0x13a6d9=_0x1a0a4d[_0xcd59('0x8')](',');var _0x1a0a4d=_0x13a6d9['shift']();var _0x5ed21a=_0x13a6d9[_0xcd59('0x34')]();if(_0xf139bb==='DATE'){_0x1a0a4d=moment(_0x1a0a4d)[_0xcd59('0x35')](0x0,!![])[_0xcd59('0x19')]();_0x5ed21a=moment(_0x5ed21a)[_0xcd59('0x35')](0x0,!![])[_0xcd59('0x17')](0x17,_0xcd59('0x36'))[_0xcd59('0x17')](0x3b,'minutes')[_0xcd59('0x17')](0x3b,_0xcd59('0x37'))[_0xcd59('0x19')]();}_0xef4955={'start':_0x1a0a4d,'end':_0x5ed21a};break;default:_0xef4955[_0xcd59('0x32')]=_0x1a0a4d;break;}return _0xef4955;} \ No newline at end of file +var _0xdedd=['castTo','text','CAST(','\x20AS\x20','field','includes','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','buildExpression','DATE','operator','$between','value','$lte','add','days','format','YYYY-MM-DD'];(function(_0x2159fb,_0x5ac620){var _0x1c1acd=function(_0x2e4e34){while(--_0x2e4e34){_0x2159fb['push'](_0x2159fb['shift']());}};_0x1c1acd(++_0x5ac620);}(_0xdedd,0x174));var _0xdded=function(_0x2c4454,_0x2a7d6d){_0x2c4454=_0x2c4454-0x0;var _0x2a8a20=_0xdedd[_0x2c4454];return _0x2a8a20;};'use strict';var _=require(_0xdded('0x0'));var moment=require(_0xdded('0x1'));exports[_0xdded('0x2')]=function(_0x38c5c9){var _0x38a794={'conditions':[]};_0x38a794['sqlOperator']=_[_0xdded('0x3')](_0x38c5c9,_0xdded('0x4'))?'or':_0xdded('0x5');var _0x2b9382=_0x38c5c9[_0xdded('0x6')](_0xdded('0x7'),'')[_0xdded('0x6')](_0xdded('0x4'),'')[_0xdded('0x8')]('||');for(var _0x3d11f5=0x0;_0x3d11f5<_0x2b9382[_0xdded('0x9')];_0x3d11f5++){var _0xb8052f=_0x2b9382[_0x3d11f5][_0xdded('0x8')](':=');var _0x25a550=_0xb8052f[0x0];var _0x1730f4=_0xb8052f[_0xdded('0xa')](0x1);_0x1730f4[_0xdded('0xb')](function(_0x573385){var _0xf1a767=_0x573385[_0xdded('0x8')]('[')[_0xdded('0xc')]();var _0x413442=_0x573385[_0xdded('0xd')](/\[(.*?)\]/g);_0x413442[_0xdded('0xb')](function(_0x56cbdb){var _0x501ad6=_0x56cbdb[_0xdded('0x8')]('[')[_0xdded('0xe')](function(_0xd34ba3){return _0xd34ba3[_0xdded('0xf')](']')>-0x1;})['map'](function(_0x1bdc22){return _0x1bdc22['split'](']')[0x0];})[0x0];_0x38a794[_0xdded('0x10')]['push']({'field':_0x25a550,'operator':_0xf1a767,'value':_0x501ad6});});});}return _0x38a794;};exports[_0xdded('0x11')]=function(_0x363c3d,_0x17d7ea,_0x2d5dd0){var _0x3cfd83={};if(_0x17d7ea===_0xdded('0x12')){if(_0x2d5dd0[_0xdded('0x13')]==='$eq'){_0x2d5dd0[_0xdded('0x13')]=_0xdded('0x14');_0x2d5dd0[_0xdded('0x15')]+=','+_0x2d5dd0[_0xdded('0x15')];}else if(_['includes'](['$gt',_0xdded('0x16')],_0x2d5dd0[_0xdded('0x13')])){_0x2d5dd0[_0xdded('0x15')]=moment(_0x2d5dd0[_0xdded('0x15')])[_0xdded('0x17')](0x1,_0xdded('0x18'))[_0xdded('0x19')](_0xdded('0x1a'));}}if(_0x2d5dd0[_0xdded('0x1b')]){_0x17d7ea=_0x2d5dd0[_0xdded('0x1b')];_0x3cfd83[_0xdded('0x1c')]=_0xdded('0x1d')+_0x363c3d+'.'+_0x2d5dd0['field']+_0xdded('0x1e')+_0x2d5dd0['castTo']+')\x20'+parseOperator(_0x2d5dd0[_0xdded('0x13')]);}else{_0x3cfd83[_0xdded('0x1c')]=_0x363c3d+'.'+_0x2d5dd0[_0xdded('0x1f')]+'\x20'+parseOperator(_0x2d5dd0['operator']);}if(_[_0xdded('0x20')]([_0xdded('0x21'),_0xdded('0x22')],_0x2d5dd0[_0xdded('0x13')]))_0x3cfd83[_0xdded('0x1c')]='('+_0x3cfd83[_0xdded('0x1c')]+_0xdded('0x23')+_0x363c3d+'.'+_0x2d5dd0[_0xdded('0x1f')]+'\x20IS\x20NULL)';_0x3cfd83[_0xdded('0x15')]=parseValue(_0x17d7ea,_0x2d5dd0[_0xdded('0x13')],_0x2d5dd0[_0xdded('0x15')]);return _0x3cfd83;};function parseOperator(_0x4b812a){var _0x6b1906;switch(_0x4b812a){case _0xdded('0x24'):_0x6b1906='IN\x20?';break;case'$notIn':_0x6b1906=_0xdded('0x25');break;case _0xdded('0x26'):_0x6b1906=_0xdded('0x27');break;case _0xdded('0x21'):_0x6b1906='<>\x20?';break;case _0xdded('0x28'):case _0xdded('0x29'):case _0xdded('0x2a'):_0x6b1906=_0xdded('0x2b');break;case _0xdded('0x2c'):_0x6b1906='<\x20?';break;case _0xdded('0x2d'):_0x6b1906=_0xdded('0x2e');break;case _0xdded('0x16'):_0x6b1906=_0xdded('0x2f');break;case _0xdded('0x30'):_0x6b1906=_0xdded('0x31');break;case _0xdded('0x14'):_0x6b1906=_0xdded('0x32');break;}return _0x6b1906;}function parseValue(_0x1c73c0,_0x4bd395,_0x43179c){var _0x1e2cf3={'start':undefined,'end':undefined};switch(_0x4bd395){case _0xdded('0x24'):case'$notIn':_0x1e2cf3[_0xdded('0x33')]=_0x43179c['split'](',');break;case _0xdded('0x28'):_0x1e2cf3[_0xdded('0x33')]='%'+_0x43179c+'%';break;case _0xdded('0x29'):_0x1e2cf3[_0xdded('0x33')]=_0x43179c+'%';break;case _0xdded('0x2a'):_0x1e2cf3['start']='%'+_0x43179c;break;case'$between':var _0x59fe70=_0x43179c['split'](',');var _0x43179c=_0x59fe70[_0xdded('0xc')]();var _0x3c46f2=_0x59fe70[_0xdded('0x34')]();if(_0x1c73c0===_0xdded('0x12')){_0x43179c=moment(_0x43179c)[_0xdded('0x35')](0x0,!![])[_0xdded('0x19')]();_0x3c46f2=moment(_0x3c46f2)[_0xdded('0x35')](0x0,!![])[_0xdded('0x17')](0x17,_0xdded('0x36'))[_0xdded('0x17')](0x3b,_0xdded('0x37'))['add'](0x3b,_0xdded('0x38'))[_0xdded('0x19')]();}_0x1e2cf3={'start':_0x43179c,'end':_0x3c46f2};break;default:_0x1e2cf3['start']=_0x43179c;break;}return _0x1e2cf3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c7d0e98..6bf2ece 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 _0x0a2c=['filters','find','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','split','map','cast','priority','unsigned','substr','DESC','ASC','omit','isEmpty','isObject','isString','length','unset','hasOwnProperty','isNumeric','isEmail','match','getFullTextValue','forEach','push','lodash','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x17799a,_0xa999a2){_0x17799a=_0x17799a-0x0;var _0x2a8569=_0x0a2c[_0x17799a];return _0x2a8569;};'use strict';var _=require(_0xc0a2('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xc0a2('0x1')]=function(_0x3b26a1){var _0x353e3d=null;if(_0x3b26a1){_0x353e3d=_0x3b26a1['split'](',');}return _0x353e3d;};exports[_0xc0a2('0x2')]=function(_0x1e8eec,_0x1655e0){var _0x48b6a1={};if(!_['isEmpty'](_0x1e8eec)){_['forOwn'](_0x1e8eec,function(_0x7f0e5,_0x1609a3){try{if(_0x1655e0){var _0x4d23f7=_[_0xc0a2('0x3')](_0x1655e0,{'name':_0x1609a3})||{};if(_0x4d23f7[_0xc0a2('0x4')]===_0xc0a2('0x5')&&_['isPlainObject'](_0x7f0e5)){var _0x2e5870=JSON[_0xc0a2('0x6')](_0x7f0e5);var _0x2b8240={'$gte':moment(moment(_0x2e5870[_0xc0a2('0x7')])[_0xc0a2('0x8')](_0xc0a2('0x9')))[_0xc0a2('0xa')]()['format'](),'$lte':moment(moment(_0x2e5870['$lte'])[_0xc0a2('0x8')](_0xc0a2('0x9')))[_0xc0a2('0xa')]()[_0xc0a2('0xb')](0x1,'s')[_0xc0a2('0x8')]()};_0x48b6a1[_0x1609a3]=_0x2b8240;}else{_0x48b6a1[_0x1609a3]=_[_0xc0a2('0xc')](_0x7f0e5)?_0x7f0e5:JSON['parse'](_0x7f0e5);}}else{_0x48b6a1[_0x1609a3]=_[_0xc0a2('0xc')](_0x7f0e5)?_0x7f0e5:JSON[_0xc0a2('0x6')](_0x7f0e5);}}catch(_0x490670){_0x48b6a1[_0x1609a3]=_0x7f0e5['split'](',');}});}return _0x48b6a1;};exports[_0xc0a2('0xd')]=function(_0x38c0b4){_0x38c0b4=parseInt(_0x38c0b4,0xa);if(!_0x38c0b4||_0x38c0b4<0x0){_0x38c0b4=LIMIT_VALUE;}return _0x38c0b4;};exports[_0xc0a2('0xe')]=function(_0x57b361){_0x57b361=parseInt(_0x57b361,0xa);if(!_0x57b361||_0x57b361<0x0){_0x57b361=0x0;}return _0x57b361;};exports[_0xc0a2('0xf')]=function(_0x5667b2){var _0xe6d647,_0x2961de=null;if(_0x5667b2){_0xe6d647=_0x5667b2[_0xc0a2('0x10')](',');_0x2961de=_[_0xc0a2('0x11')](_0xe6d647,function(_0x334701){if(_0x334701['indexOf']('-')===0x0){return[_0x334701==='priority'?sequelize[_0xc0a2('0x12')](sequelize['col'](_0xc0a2('0x13')),_0xc0a2('0x14')):_0x334701[_0xc0a2('0x15')](0x1),_0xc0a2('0x16')];}else{return[_0x334701===_0xc0a2('0x13')?sequelize['cast'](sequelize['col'](_0xc0a2('0x13')),_0xc0a2('0x14')):_0x334701,_0xc0a2('0x17')];}});}return _0x2961de;};exports[_0xc0a2('0x18')]=function(_0x432844,_0x4e9509){if(_[_0xc0a2('0x19')](_0x432844)){return _0x432844;}if(_[_0xc0a2('0xc')](_0x432844)){for(var _0x40fe00=0x0;_0x40fe00<_0x432844['length'];_0x40fe00+=0x1){_0x432844[_0x40fe00]=this[_0xc0a2('0x18')](_0x432844[_0x40fe00],_0x4e9509);}return _0x432844;}if(!_[_0xc0a2('0x1a')](_0x432844)){return _0x432844;}if(_[_0xc0a2('0x1b')](_0x4e9509)){_0x4e9509=[_0x4e9509];}if(!_[_0xc0a2('0xc')](_0x4e9509)){return _0x432844;}for(var _0x1cd160=0x0;_0x1cd160<_0x4e9509[_0xc0a2('0x1c')];_0x1cd160+=0x1){_[_0xc0a2('0x1d')](_0x432844,_0x4e9509[_0x1cd160]);}for(var _0x503e18 in _0x432844){if(_0x432844[_0xc0a2('0x1e')](_0x503e18)){_0x432844[_0x503e18]=this[_0xc0a2('0x18')](_0x432844[_0x503e18],_0x4e9509);}}return _0x432844;};exports[_0xc0a2('0x1f')]=function(_0x47cca6){return _0x47cca6['match'](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xc0a2('0x20')]=function(_0x52fce7){return _0x52fce7[_0xc0a2('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xc0a2('0x22')]=function(_0x32ff26){var _0x3b4804=[];_0x32ff26[_0xc0a2('0x10')]('\x20')[_0xc0a2('0x23')](function(_0x31fa10){_0x3b4804[_0xc0a2('0x24')]('+'+_0x31fa10['toString']()+'*');});return _0x3b4804['join']('\x20');}; \ No newline at end of file +var _0x56a0=['type','format','YYYY-MM-DD','utc','$lte','isArray','parse','offset','map','indexOf','priority','col','unsigned','substr','cast','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find'];(function(_0x1032ac,_0x38577b){var _0x34d4fd=function(_0x58594f){while(--_0x58594f){_0x1032ac['push'](_0x1032ac['shift']());}};_0x34d4fd(++_0x38577b);}(_0x56a0,0x101));var _0x056a=function(_0x4a92ff,_0x215eea){_0x4a92ff=_0x4a92ff-0x0;var _0x3cd15=_0x56a0[_0x4a92ff];return _0x3cd15;};'use strict';var _=require(_0x056a('0x0'));var sequelize=require(_0x056a('0x1'));var moment=require(_0x056a('0x2'));var LIMIT_VALUE=0xfa;exports[_0x056a('0x3')]=function(_0x451ead){var _0x2177c3=null;if(_0x451ead){_0x2177c3=_0x451ead[_0x056a('0x4')](',');}return _0x2177c3;};exports[_0x056a('0x5')]=function(_0x2991a7,_0x21222e){var _0x15a34a={};if(!_[_0x056a('0x6')](_0x2991a7)){_[_0x056a('0x7')](_0x2991a7,function(_0xf3b872,_0x477b7){try{if(_0x21222e){var _0x54123d=_[_0x056a('0x8')](_0x21222e,{'name':_0x477b7})||{};if(_0x54123d[_0x056a('0x9')]==='DATE'&&_['isPlainObject'](_0xf3b872)){var _0x46c017=JSON['parse'](_0xf3b872);var _0x12c555={'$gte':moment(moment(_0x46c017['$gte'])[_0x056a('0xa')](_0x056a('0xb')))[_0x056a('0xc')]()[_0x056a('0xa')](),'$lte':moment(moment(_0x46c017[_0x056a('0xd')])['format'](_0x056a('0xb')))[_0x056a('0xc')]()['subtract'](0x1,'s')[_0x056a('0xa')]()};_0x15a34a[_0x477b7]=_0x12c555;}else{_0x15a34a[_0x477b7]=_[_0x056a('0xe')](_0xf3b872)?_0xf3b872:JSON[_0x056a('0xf')](_0xf3b872);}}else{_0x15a34a[_0x477b7]=_['isArray'](_0xf3b872)?_0xf3b872:JSON[_0x056a('0xf')](_0xf3b872);}}catch(_0x9d9864){_0x15a34a[_0x477b7]=_0xf3b872[_0x056a('0x4')](',');}});}return _0x15a34a;};exports['limit']=function(_0x41a3cb){_0x41a3cb=parseInt(_0x41a3cb,0xa);if(!_0x41a3cb||_0x41a3cb<0x0){_0x41a3cb=LIMIT_VALUE;}return _0x41a3cb;};exports[_0x056a('0x10')]=function(_0x4b5daf){_0x4b5daf=parseInt(_0x4b5daf,0xa);if(!_0x4b5daf||_0x4b5daf<0x0){_0x4b5daf=0x0;}return _0x4b5daf;};exports['sort']=function(_0x5d91a2){var _0x3162a9,_0x365b74=null;if(_0x5d91a2){_0x3162a9=_0x5d91a2[_0x056a('0x4')](',');_0x365b74=_[_0x056a('0x11')](_0x3162a9,function(_0x1e3486){if(_0x1e3486[_0x056a('0x12')]('-')===0x0){return[_0x1e3486===_0x056a('0x13')?sequelize['cast'](sequelize[_0x056a('0x14')]('priority'),_0x056a('0x15')):_0x1e3486[_0x056a('0x16')](0x1),'DESC'];}else{return[_0x1e3486===_0x056a('0x13')?sequelize[_0x056a('0x17')](sequelize[_0x056a('0x14')](_0x056a('0x13')),_0x056a('0x15')):_0x1e3486,'ASC'];}});}return _0x365b74;};exports[_0x056a('0x18')]=function(_0x35c9ff,_0x21acb6){if(_['isEmpty'](_0x35c9ff)){return _0x35c9ff;}if(_[_0x056a('0xe')](_0x35c9ff)){for(var _0x3cf17e=0x0;_0x3cf17e<_0x35c9ff[_0x056a('0x19')];_0x3cf17e+=0x1){_0x35c9ff[_0x3cf17e]=this[_0x056a('0x18')](_0x35c9ff[_0x3cf17e],_0x21acb6);}return _0x35c9ff;}if(!_[_0x056a('0x1a')](_0x35c9ff)){return _0x35c9ff;}if(_['isString'](_0x21acb6)){_0x21acb6=[_0x21acb6];}if(!_[_0x056a('0xe')](_0x21acb6)){return _0x35c9ff;}for(var _0x2059b1=0x0;_0x2059b1<_0x21acb6[_0x056a('0x19')];_0x2059b1+=0x1){_[_0x056a('0x1b')](_0x35c9ff,_0x21acb6[_0x2059b1]);}for(var _0x419acb in _0x35c9ff){if(_0x35c9ff[_0x056a('0x1c')](_0x419acb)){_0x35c9ff[_0x419acb]=this[_0x056a('0x18')](_0x35c9ff[_0x419acb],_0x21acb6);}}return _0x35c9ff;};exports[_0x056a('0x1d')]=function(_0x41db1d){return _0x41db1d[_0x056a('0x1e')](RegExp(_0x056a('0x1f')))?!![]:![];};exports[_0x056a('0x20')]=function(_0x1fb3e0){return _0x1fb3e0['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x056a('0x21')]=function(_0x5cec17){var _0x2518cc=[];_0x5cec17[_0x056a('0x4')]('\x20')[_0x056a('0x22')](function(_0x39c915){_0x2518cc[_0x056a('0x23')]('+'+_0x39c915[_0x056a('0x24')]()+'*');});return _0x2518cc[_0x056a('0x25')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index bf6151f..2f1d8b6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x609e=['set','client','use','json\x20replacer','toISOString','static','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','initialize','express','cookie-parser','errorhandler','passport','cors','./environment','../mysqldb','default','get','env','production','appPath','root','public','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x609e,0x195));var _0xe609=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x609e[_0x6cf19c];return _0xce14f3;};'use strict';var express=require(_0xe609('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0xe609('0x1'));var errorHandler=require(_0xe609('0x2'));var path=require('path');var passport=require(_0xe609('0x3'));var cors=require(_0xe609('0x4'));var moment=require('moment');var config=require(_0xe609('0x5'));var db=require(_0xe609('0x6'))['db'];exports[_0xe609('0x7')]=function(_0x1a844f){var _0x3cdf79=_0x1a844f[_0xe609('0x8')](_0xe609('0x9'));if(_0x3cdf79===_0xe609('0xa')){_0x1a844f['set'](_0xe609('0xb'),path['join'](config[_0xe609('0xc')],_0xe609('0xd')));}if(_0x3cdf79==='development'||_0x3cdf79===_0xe609('0xe')){_0x1a844f[_0xe609('0xf')](_0xe609('0xb'),path['join'](config[_0xe609('0xc')],_0xe609('0x10')));_0x1a844f[_0xe609('0x11')](errorHandler());}_0x1a844f[_0xe609('0xf')](_0xe609('0x12'),function(_0x539750,_0x42c854){if(this[_0x539750]instanceof Date){_0x42c854=this[_0x539750][_0xe609('0x13')]()['split']('.')[0x0]+'Z';}return _0x42c854;});_0x1a844f[_0xe609('0x11')](express[_0xe609('0x14')](_0x1a844f[_0xe609('0x8')](_0xe609('0xb'))));_0x1a844f[_0xe609('0xf')](_0xe609('0x15'),config['root']+_0xe609('0x16'));_0x1a844f[_0xe609('0x17')](_0xe609('0x18'),require(_0xe609('0x19'))[_0xe609('0x1a')]);_0x1a844f[_0xe609('0xf')]('view\x20engine',_0xe609('0x18'));_0x1a844f['use'](bodyParser[_0xe609('0x1b')]({'limit':_0xe609('0x1c'),'extended':!![]}));_0x1a844f['use'](bodyParser['json']({'limit':_0xe609('0x1c')}));_0x1a844f['use'](cors());_0x1a844f[_0xe609('0x11')](methodOverride());_0x1a844f[_0xe609('0x11')](cookieParser());_0x1a844f[_0xe609('0x11')](passport[_0xe609('0x1d')]());}; \ No newline at end of file +var _0x90e5=['public','development','use','toISOString','split','static','views','/server/views','html','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','./environment','../mysqldb','default','get','env','set','appPath','join','root'];(function(_0x30e1ed,_0x47a2b9){var _0xed0819=function(_0x18989d){while(--_0x18989d){_0x30e1ed['push'](_0x30e1ed['shift']());}};_0xed0819(++_0x47a2b9);}(_0x90e5,0x81));var _0x590e=function(_0x2ed03d,_0x5dd3b9){_0x2ed03d=_0x2ed03d-0x0;var _0x3b6439=_0x90e5[_0x2ed03d];return _0x3b6439;};'use strict';var express=require(_0x590e('0x0'));var favicon=require(_0x590e('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x590e('0x2'));var cookieParser=require(_0x590e('0x3'));var errorHandler=require(_0x590e('0x4'));var path=require(_0x590e('0x5'));var passport=require(_0x590e('0x6'));var cors=require('cors');var moment=require('moment');var config=require(_0x590e('0x7'));var db=require(_0x590e('0x8'))['db'];exports[_0x590e('0x9')]=function(_0x5a40d0){var _0x16096c=_0x5a40d0[_0x590e('0xa')](_0x590e('0xb'));if(_0x16096c==='production'){_0x5a40d0[_0x590e('0xc')](_0x590e('0xd'),path[_0x590e('0xe')](config[_0x590e('0xf')],_0x590e('0x10')));}if(_0x16096c===_0x590e('0x11')||_0x16096c==='test'){_0x5a40d0['set'](_0x590e('0xd'),path['join'](config['root'],'client'));_0x5a40d0[_0x590e('0x12')](errorHandler());}_0x5a40d0[_0x590e('0xc')]('json\x20replacer',function(_0x127ab6,_0x44abfa){if(this[_0x127ab6]instanceof Date){_0x44abfa=this[_0x127ab6][_0x590e('0x13')]()[_0x590e('0x14')]('.')[0x0]+'Z';}return _0x44abfa;});_0x5a40d0['use'](express[_0x590e('0x15')](_0x5a40d0[_0x590e('0xa')]('appPath')));_0x5a40d0[_0x590e('0xc')](_0x590e('0x16'),config[_0x590e('0xf')]+_0x590e('0x17'));_0x5a40d0['engine']('html',require('ejs')['renderFile']);_0x5a40d0['set']('view\x20engine',_0x590e('0x18'));_0x5a40d0[_0x590e('0x12')](bodyParser[_0x590e('0x19')]({'limit':_0x590e('0x1a'),'extended':!![]}));_0x5a40d0[_0x590e('0x12')](bodyParser[_0x590e('0x1b')]({'limit':'50mb'}));_0x5a40d0['use'](cors());_0x5a40d0['use'](methodOverride());_0x5a40d0[_0x590e('0x12')](cookieParser());_0x5a40d0[_0x590e('0x12')](passport[_0x590e('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 11b4b7b..dc05ed3 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 _0xee14=['platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','md5','update','digest','hex','getUuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x439936,_0x534c07){_0x439936=_0x439936-0x0;var _0x5c718e=_0xee14[_0x439936];return _0x5c718e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x4ee1('0x0'));var exec=require(_0x4ee1('0x1'))[_0x4ee1('0x2')];function getInterfaces(){var _0x1fa407=[];var _0x18e3c4=os[_0x4ee1('0x3')]();var _0x34a0ae=_[_0x4ee1('0x4')](_[_0x4ee1('0x5')](_0x18e3c4));for(var _0x4bc729=0x0;_0x4bc729<_0x34a0ae[_0x4ee1('0x6')];_0x4bc729++){var _0x573700=_0x18e3c4[_0x34a0ae[_0x4bc729]][_0x4ee1('0x7')](function(_0x3a45a3){return _0x3a45a3[_0x4ee1('0x8')]===_0x4ee1('0x9')&&_0x3a45a3[_0x4ee1('0xa')]===![];});_0x1fa407=_0x1fa407[_0x4ee1('0xb')](_0x573700);}return _0x1fa407;}function getFirstInterface(){var _0x58a32f=_[_0x4ee1('0xc')](getInterfaces());return{'macAddress':_0x58a32f&&_0x58a32f[_0x4ee1('0xd')]?_0x58a32f['mac']:_0x4ee1('0xe'),'ipAddress':_0x58a32f&&_0x58a32f[_0x4ee1('0xf')]?_0x58a32f[_0x4ee1('0xf')]:_0x4ee1('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1b3737=_[_0x4ee1('0x4')](os[_0x4ee1('0x11')]()[_0x4ee1('0x12')](function(_0x2f864e){return _0x2f864e[_0x4ee1('0x13')];}))['join'](':');return crypto[_0x4ee1('0x14')](_0x4ee1('0x15'))[_0x4ee1('0x16')](_0x1b3737)[_0x4ee1('0x17')](_0x4ee1('0x18'));}exports[_0x4ee1('0x19')]=function(){switch(os[_0x4ee1('0x1a')]()){case _0x4ee1('0x1b'):return exec(_0x4ee1('0x1c'),{'encoding':'utf8'})[_0x4ee1('0x1d')]('\x0d\x0a','');default:var _0x38008f=getFirstInterface();var _0x34651b=getCPUhash();var _0x1b1e0e=_0x34651b+'|'+os[_0x4ee1('0x1e')]()+'|'+_0x38008f[_0x4ee1('0x1f')]+'|'+_0x38008f[_0x4ee1('0x20')];var _0x2b8f0e=crypto[_0x4ee1('0x14')](_0x4ee1('0x15'))[_0x4ee1('0x16')](_0x1b1e0e)['digest'](_0x4ee1('0x18'));return _0x2b8f0e[_0x4ee1('0x21')](0x0,0x8)+'-'+_0x2b8f0e[_0x4ee1('0x21')](0x8,0xc)+'-'+_0x2b8f0e[_0x4ee1('0x21')](0xc,0x10)+'-'+_0x2b8f0e[_0x4ee1('0x21')](0x10,0x14)+'-'+_0x2b8f0e[_0x4ee1('0x21')](0x14);}}; \ No newline at end of file +var _0xf69d=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','join','createHash','md5','update','digest','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','hex'];(function(_0x3bbd1f,_0x119571){var _0x4cb1fe=function(_0x354967){while(--_0x354967){_0x3bbd1f['push'](_0x3bbd1f['shift']());}};_0x4cb1fe(++_0x119571);}(_0xf69d,0xd3));var _0xdf69=function(_0x375c52,_0x4d9cbf){_0x375c52=_0x375c52-0x0;var _0x52150d=_0xf69d[_0x375c52];return _0x52150d;};'use strict';var _=require(_0xdf69('0x0'));var os=require('os');var crypto=require(_0xdf69('0x1'));var machine=require(_0xdf69('0x2'));var exec=require(_0xdf69('0x3'))[_0xdf69('0x4')];function getInterfaces(){var _0x4e4bdd=[];var _0x3013e5=os[_0xdf69('0x5')]();var _0x5b5eec=_[_0xdf69('0x6')](_[_0xdf69('0x7')](_0x3013e5));for(var _0x18ce2b=0x0;_0x18ce2b<_0x5b5eec[_0xdf69('0x8')];_0x18ce2b++){var _0x465b1b=_0x3013e5[_0x5b5eec[_0x18ce2b]][_0xdf69('0x9')](function(_0x12c186){return _0x12c186[_0xdf69('0xa')]===_0xdf69('0xb')&&_0x12c186[_0xdf69('0xc')]===![];});_0x4e4bdd=_0x4e4bdd[_0xdf69('0xd')](_0x465b1b);}return _0x4e4bdd;}function getFirstInterface(){var _0x40217f=_[_0xdf69('0xe')](getInterfaces());return{'macAddress':_0x40217f&&_0x40217f[_0xdf69('0xf')]?_0x40217f['mac']:_0xdf69('0x10'),'ipAddress':_0x40217f&&_0x40217f[_0xdf69('0x11')]?_0x40217f[_0xdf69('0x11')]:_0xdf69('0x12')};}exports[_0xdf69('0x13')]=getFirstInterface;function getCPUhash(){var _0x1b86d4=_['orderBy'](os['cpus']()['map'](function(_0x5df98a){return _0x5df98a[_0xdf69('0x14')];}))[_0xdf69('0x15')](':');return crypto[_0xdf69('0x16')](_0xdf69('0x17'))[_0xdf69('0x18')](_0x1b86d4)[_0xdf69('0x19')]('hex');}exports[_0xdf69('0x1a')]=function(){switch(os[_0xdf69('0x1b')]()){case _0xdf69('0x1c'):return exec(_0xdf69('0x1d'),{'encoding':'utf8'})[_0xdf69('0x1e')]('\x0d\x0a','');default:var _0x56be66=getFirstInterface();var _0x2a6e55=getCPUhash();var _0x1899a2=_0x2a6e55+'|'+os['hostname']()+'|'+_0x56be66[_0xdf69('0x1f')]+'|'+_0x56be66[_0xdf69('0x20')];var _0x1af696=crypto[_0xdf69('0x16')]('md5')['update'](_0x1899a2)[_0xdf69('0x19')](_0xdf69('0x21'));return _0x1af696['substring'](0x0,0x8)+'-'+_0x1af696[_0xdf69('0x22')](0x8,0xc)+'-'+_0x1af696[_0xdf69('0x22')](0xc,0x10)+'-'+_0x1af696[_0xdf69('0x22')](0x10,0x14)+'-'+_0x1af696['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d03101d..0e41630 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 _0xc0d7=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','session','update','utf8','base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1'];(function(_0x4119c3,_0x2a2220){var _0x4f2d55=function(_0xf30e75){while(--_0xf30e75){_0x4119c3['push'](_0x4119c3['shift']());}};_0x4f2d55(++_0x2a2220);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x3b1365,_0x275f15){_0x3b1365=_0x3b1365-0x0;var _0xbf817c=_0xc0d7[_0x3b1365];return _0xbf817c;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require('moment');var rp=require(_0x7c0d('0x0'));var BPromise=require(_0x7c0d('0x1'));var pkginfo=require(_0x7c0d('0x2'))(module,_0x7c0d('0x3'));var db=require(_0x7c0d('0x4'))['db'];var config=require(_0x7c0d('0x5'));var hardware=require(_0x7c0d('0x6'));var logger=require(_0x7c0d('0x7'))(_0x7c0d('0x8'));var jira=require('../../api/jira/jira.controller');var HOST=_0x7c0d('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x14f205){return new BPromise(function(_0x22101d,_0x3ffcff){var _0x5e6d16=util[_0x7c0d('0xa')](_0x7c0d('0xb'),HOST,_0x14f205,module[_0x7c0d('0xc')][_0x7c0d('0x3')]);if(oldToken){_0x5e6d16=util['format'](_0x7c0d('0xd'),HOST,_0x14f205,module[_0x7c0d('0xc')]['version'],oldToken);}var _0x5320fa={'uri':_0x5e6d16,'method':_0x7c0d('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5320fa)[_0x7c0d('0xf')](function(_0x496398){_0x22101d(_0x496398);})[_0x7c0d('0x10')](function(_0x316ca9){_0x3ffcff(_0x316ca9);});});}function encryptDate(_0x31b829){var _0x198dde=crypto[_0x7c0d('0x11')](_0x7c0d('0x12'),config['secrets'][_0x7c0d('0x13')]);var _0x3d2a6b=_0x198dde[_0x7c0d('0x14')](_0x31b829,_0x7c0d('0x15'),_0x7c0d('0x16'));_0x3d2a6b+=_0x198dde[_0x7c0d('0x17')](_0x7c0d('0x16'));return _0x3d2a6b;}function decryptDate(_0x13f301){var _0x4a5fb4=crypto[_0x7c0d('0x18')]('aes-256-ctr',config[_0x7c0d('0x19')]['session']);var _0x2a8f3f=_0x4a5fb4[_0x7c0d('0x14')](_0x13f301,_0x7c0d('0x16'),_0x7c0d('0x15'));_0x2a8f3f+=_0x4a5fb4[_0x7c0d('0x17')](_0x7c0d('0x15'));return _0x2a8f3f;}function sendJiraAlert(_0x1418ee,_0x1fb052,_0x34f2ef){var _0xf0657e=_0x7c0d('0x1a');return db[_0x7c0d('0x1b')][_0x7c0d('0x1c')]({'where':{'role':_0x7c0d('0x1d')},'attributes':[_0x7c0d('0x1e'),_0x7c0d('0x1f')],'raw':!![]})[_0x7c0d('0xf')](function(_0x51af31){ADMIN=_0x51af31;_0xf0657e+=_0x7c0d('0x20')+_0x34f2ef+'|\x0a';_0xf0657e+='|uuid|'+_0x1418ee+'|\x0a';_0xf0657e+='|machineUuid|'+_0x1fb052+'|\x0a';_0xf0657e+='|name|'+ADMIN['fullname']+'|\x0a';_0xf0657e+='|email|'+ADMIN[_0x7c0d('0x1f')]+'|\x0a';return _0xf0657e;})[_0x7c0d('0xf')](function(_0x1c7b84){var _0x2f657e=hardware[_0x7c0d('0x21')]()[_0x7c0d('0x22')];return jira[_0x7c0d('0x23')]({'key':'MOTLICENSE','summary':_0x7c0d('0x24'),'description':_0x1c7b84,'issuetype':_0x7c0d('0x25'),'oldToken':_0x1418ee,'newToken':_0x1fb052,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x2f657e});});}function manageLicense(_0x357cca,_0x5a0d69){var _0x236973=_0x5a0d69[_0x7c0d('0x26')]({'plain':!![]});httpRequest(_0x357cca)[_0x7c0d('0xf')](function(_0x34309){if(oldToken){oldToken=undefined;}if(_0x34309[_0x7c0d('0x27')]){if(!_0x236973['license']&&_0x236973[_0x7c0d('0x8')]!=_0x34309[_0x7c0d('0x8')]||_0x236973[_0x7c0d('0x8')]&&_0x236973[_0x7c0d('0x28')]){logger[_0x7c0d('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x236973[_0x7c0d('0x8')]&&!_0x236973['data2']&&_0x236973[_0x7c0d('0x8')]!=_0x34309[_0x7c0d('0x8')]){logger[_0x7c0d('0x29')](_0x7c0d('0x2a'));}if(_0x236973[_0x7c0d('0x8')]&&!_0x236973[_0x7c0d('0x28')]&&_0x236973['license']==_0x34309[_0x7c0d('0x8')]){return _0x5a0d69;}return _0x5a0d69['update']({'data1':_0x357cca,'data2':null,'license':_0x34309[_0x7c0d('0x8')]});}else{if(_0x34309[_0x7c0d('0x8')]||_0x236973['license']){if(!_0x236973['data2']){if(_0x236973[_0x7c0d('0x2b')]==_0x357cca){GRAY_PERIOD_REASON='Disabled';logger[_0x7c0d('0x29')](_0x7c0d('0x2c'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x236973['data1'];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x236973[_0x7c0d('0x2b')],_0x357cca);}sendJiraAlert(_0x236973['data1'],_0x34309[_0x7c0d('0x2d')],GRAY_PERIOD_REASON);logger[_0x7c0d('0x29')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x7c0d('0x2e')](),moment()[_0x7c0d('0xa')](_0x7c0d('0x2f')));return _0x5a0d69[_0x7c0d('0x14')]({'data2':encryptDate(moment()['format'](_0x7c0d('0x2f')))});}else{if(moment()[_0x7c0d('0x30')](decryptDate(_0x236973[_0x7c0d('0x28')]),_0x7c0d('0x31'))>DAYS){logger[_0x7c0d('0x29')](_0x7c0d('0x32'),moment()[_0x7c0d('0xa')](_0x7c0d('0x2f')));return _0x5a0d69[_0x7c0d('0x14')]({'data1':_0x357cca,'data2':null,'license':null});}}}else{if(_0x236973[_0x7c0d('0x2b')]!=_0x357cca){logger['info'](_0x7c0d('0x33'),_0x236973[_0x7c0d('0x2b')],_0x357cca);return _0x5a0d69['update']({'data1':_0x357cca,'data2':null,'license':null});}}}return _0x5a0d69;})[_0x7c0d('0xf')](function(_0x142ad0){_0x5a0d69=_0x142ad0;})[_0x7c0d('0x10')](function(_0x1b723b){logger[_0x7c0d('0x34')](_0x1b723b[_0x7c0d('0x35')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x7c0d('0x36')](),_0x5a0d69);},TIME);});}function defaultLicense(){var _0x169eff=hardware[_0x7c0d('0x36')]();if(_0x169eff){return db[_0x7c0d('0x37')][_0x7c0d('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x169eff}})['spread'](function(_0x5ccc68,_0x653e1f){logger[_0x7c0d('0x29')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x169eff);manageLicense(_0x169eff,_0x5ccc68);})[_0x7c0d('0x10')](function(_0x4c87d8){logger[_0x7c0d('0x34')](_0x4c87d8[_0x7c0d('0x35')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x7da6=['base64','createDecipher','aes-256-ctr','||FIELD||VALUE||\x0a','User','admin','then','|reason|','|uuid|','|email|','email','getFirstInterface','openIssue','MOTLICENSE','Alert','fullname','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','%s/api/servers/%s/check?version=%s','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','createCipher','secrets','session','update','utf8','final'];(function(_0x2545a2,_0x25787d){var _0x55147c=function(_0x487a47){while(--_0x487a47){_0x2545a2['push'](_0x2545a2['shift']());}};_0x55147c(++_0x25787d);}(_0x7da6,0x124));var _0x67da=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x7da6[_0x470f24];return _0x2c6fc8;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require(_0x67da('0x0'));var rp=require(_0x67da('0x1'));var BPromise=require(_0x67da('0x2'));var pkginfo=require(_0x67da('0x3'))(module,'version');var db=require(_0x67da('0x4'))['db'];var config=require(_0x67da('0x5'));var hardware=require(_0x67da('0x6'));var logger=require(_0x67da('0x7'))(_0x67da('0x8'));var jira=require(_0x67da('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xb7f52){return new BPromise(function(_0x49025f,_0x4cfe49){var _0x3d971d=util['format'](_0x67da('0xa'),HOST,_0xb7f52,module['exports'][_0x67da('0xb')]);if(oldToken){_0x3d971d=util[_0x67da('0xc')](_0x67da('0xd'),HOST,_0xb7f52,module[_0x67da('0xe')][_0x67da('0xb')],oldToken);}var _0x26198c={'uri':_0x3d971d,'method':_0x67da('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x26198c)['then'](function(_0x5bfa4f){_0x49025f(_0x5bfa4f);})[_0x67da('0x10')](function(_0x329a9c){_0x4cfe49(_0x329a9c);});});}function encryptDate(_0x3e2305){var _0x2450aa=crypto[_0x67da('0x11')]('aes-256-ctr',config[_0x67da('0x12')][_0x67da('0x13')]);var _0x3929fb=_0x2450aa[_0x67da('0x14')](_0x3e2305,_0x67da('0x15'),'base64');_0x3929fb+=_0x2450aa[_0x67da('0x16')](_0x67da('0x17'));return _0x3929fb;}function decryptDate(_0x5e0802){var _0x11e151=crypto[_0x67da('0x18')](_0x67da('0x19'),config[_0x67da('0x12')][_0x67da('0x13')]);var _0xb3a67=_0x11e151[_0x67da('0x14')](_0x5e0802,_0x67da('0x17'),'utf8');_0xb3a67+=_0x11e151[_0x67da('0x16')]('utf8');return _0xb3a67;}function sendJiraAlert(_0x31454f,_0x5765d5,_0x263517){var _0xa53a90=_0x67da('0x1a');return db[_0x67da('0x1b')]['findOne']({'where':{'role':_0x67da('0x1c')},'attributes':['fullname','email'],'raw':!![]})[_0x67da('0x1d')](function(_0x31c6c5){ADMIN=_0x31c6c5;_0xa53a90+=_0x67da('0x1e')+_0x263517+'|\x0a';_0xa53a90+=_0x67da('0x1f')+_0x31454f+'|\x0a';_0xa53a90+='|machineUuid|'+_0x5765d5+'|\x0a';_0xa53a90+='|name|'+ADMIN['fullname']+'|\x0a';_0xa53a90+=_0x67da('0x20')+ADMIN[_0x67da('0x21')]+'|\x0a';return _0xa53a90;})[_0x67da('0x1d')](function(_0xd32481){var _0x2460c3=hardware[_0x67da('0x22')]()['ipAddress'];return jira[_0x67da('0x23')]({'key':_0x67da('0x24'),'summary':'Motion\x20License\x20Alert','description':_0xd32481,'issuetype':_0x67da('0x25'),'oldToken':_0x31454f,'newToken':_0x5765d5,'email':ADMIN['email'],'name':ADMIN[_0x67da('0x26')],'reason':GRAY_PERIOD_REASON,'ip':_0x2460c3});});}function manageLicense(_0x15207c,_0x29a0ce){var _0x17e76f=_0x29a0ce[_0x67da('0x27')]({'plain':!![]});httpRequest(_0x15207c)[_0x67da('0x1d')](function(_0x4c4bfe){if(oldToken){oldToken=undefined;}if(_0x4c4bfe[_0x67da('0x28')]){if(!_0x17e76f[_0x67da('0x8')]&&_0x17e76f['license']!=_0x4c4bfe['license']||_0x17e76f[_0x67da('0x8')]&&_0x17e76f[_0x67da('0x29')]){logger[_0x67da('0x2a')](_0x67da('0x2b'));}if(_0x17e76f['license']&&!_0x17e76f[_0x67da('0x29')]&&_0x17e76f[_0x67da('0x8')]!=_0x4c4bfe[_0x67da('0x8')]){logger[_0x67da('0x2a')](_0x67da('0x2c'));}if(_0x17e76f[_0x67da('0x8')]&&!_0x17e76f[_0x67da('0x29')]&&_0x17e76f[_0x67da('0x8')]==_0x4c4bfe[_0x67da('0x8')]){return _0x29a0ce;}return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':_0x4c4bfe[_0x67da('0x8')]});}else{if(_0x4c4bfe[_0x67da('0x8')]||_0x17e76f[_0x67da('0x8')]){if(!_0x17e76f[_0x67da('0x29')]){if(_0x17e76f['data1']==_0x15207c){GRAY_PERIOD_REASON=_0x67da('0x2d');logger[_0x67da('0x2a')](_0x67da('0x2e'));}else{GRAY_PERIOD_REASON=_0x67da('0x2f');oldToken=_0x17e76f[_0x67da('0x30')];logger[_0x67da('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x17e76f[_0x67da('0x30')],_0x15207c);}sendJiraAlert(_0x17e76f[_0x67da('0x30')],_0x4c4bfe[_0x67da('0x31')],GRAY_PERIOD_REASON);logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x67da('0x32')));return _0x29a0ce['update']({'data2':encryptDate(moment()[_0x67da('0xc')](_0x67da('0x32')))});}else{if(moment()[_0x67da('0x33')](decryptDate(_0x17e76f[_0x67da('0x29')]),_0x67da('0x34'))>DAYS){logger[_0x67da('0x2a')](_0x67da('0x35'),moment()[_0x67da('0xc')](_0x67da('0x32')));return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':null});}}}else{if(_0x17e76f[_0x67da('0x30')]!=_0x15207c){logger[_0x67da('0x2a')](_0x67da('0x36'),_0x17e76f[_0x67da('0x30')],_0x15207c);return _0x29a0ce[_0x67da('0x14')]({'data1':_0x15207c,'data2':null,'license':null});}}}return _0x29a0ce;})[_0x67da('0x1d')](function(_0x2ee9fe){_0x29a0ce=_0x2ee9fe;})[_0x67da('0x10')](function(_0x380bc1){logger[_0x67da('0x37')](_0x380bc1[_0x67da('0x38')]);})[_0x67da('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x67da('0x3a')](),_0x29a0ce);},TIME);});}function defaultLicense(){var _0x2985f6=hardware[_0x67da('0x3a')]();if(_0x2985f6){return db[_0x67da('0x3b')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2985f6}})[_0x67da('0x3c')](function(_0x273173,_0x5e6bdc){logger[_0x67da('0x2a')](_0x67da('0x3d'),_0x2985f6);manageLicense(_0x2985f6,_0x273173);})['catch'](function(_0x4dcc69){logger['error'](_0x4dcc69[_0x67da('0x38')]);});}}exports[_0x67da('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 986afbb..9393ea9 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 _0x6f6b=['days','grayReason','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','defaults','then','crypto','util','moment','./hardware','../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','demo','uuid','machineUuid','getUuid','secrets','session','gray','add'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6f6b,0x77));var _0xb6f6=function(_0x4d5721,_0x51a33d){_0x4d5721=_0x4d5721-0x0;var _0x88a224=_0x6f6b[_0x4d5721];return _0x88a224;};'use strict';var crypto=require(_0xb6f6('0x0'));var util=require(_0xb6f6('0x1'));var _=require('lodash');var moment=require(_0xb6f6('0x2'));var hardware=require(_0xb6f6('0x3'));var config=require(_0xb6f6('0x4'));var db=require(_0xb6f6('0x5'))['db'];function checkLicense(_0x3aaee1,_0xee2d12){if(_0x3aaee1){try{var _0x1adb26=_0xee2d12||_0x3aaee1['license'];if(_[_0xb6f6('0x6')](_0x1adb26)){throw new Error(_0xb6f6('0x7'));}var _0x5226b8=_0x3aaee1[_0xb6f6('0x8')];var _0x4de7ac=_0x3aaee1['data2'];var _0x1244e0=_0x5226b8[_0xb6f6('0x9')]('-')[0x4];var _0x88a344=_0x5226b8['split']('-')[0x0];var _0x829d66=crypto[_0xb6f6('0xa')](_0xb6f6('0xb'),util[_0xb6f6('0xc')]('%s:%s:%s',_0x1244e0,_0x5226b8,_0x88a344));var _0x4d8711=_0x829d66[_0xb6f6('0xd')](_0x1adb26,_0xb6f6('0xe'),_0xb6f6('0xf'));_0x4d8711+=_0x829d66[_0xb6f6('0x10')](_0xb6f6('0xf'));var _0x383296=JSON['parse'](_0x4d8711);_0x383296[_0xb6f6('0x11')]=![];_0x383296[_0xb6f6('0x12')]=_0x5226b8;_0x383296[_0xb6f6('0x13')]=hardware[_0xb6f6('0x14')]();if(_0x4de7ac){var _0x19e8e9=crypto[_0xb6f6('0xa')](_0xb6f6('0xb'),config[_0xb6f6('0x15')][_0xb6f6('0x16')]);var _0x1a93a0=_0x19e8e9['update'](_0x4de7ac,_0xb6f6('0xe'),_0xb6f6('0xf'));_0x1a93a0+=_0x19e8e9[_0xb6f6('0x10')](_0xb6f6('0xf'));_0x383296[_0xb6f6('0x17')]=_0x1a93a0;_0x383296['deadline']=moment(_0x1a93a0)[_0xb6f6('0x18')](0x7,_0xb6f6('0x19'))[_0xb6f6('0xc')]();_0x383296[_0xb6f6('0x1a')]=_0x383296[_0xb6f6('0x12')]!=_0x383296[_0xb6f6('0x13')]?'changed':'disabled';}return _0x383296;}catch(_0x5a1395){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb6f6('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb6f6('0x1c'),'uuid':_0x3aaee1['data1'],'machineUuid':hardware[_0xb6f6('0x14')](),'message':_0x5a1395[_0xb6f6('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb6f6('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb6f6('0x1e'),'uuid':_0x3aaee1[_0xb6f6('0x8')],'machineUuid':hardware[_0xb6f6('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xb6f6('0x1f')]=function(_0x27f674){return db[_0xb6f6('0x20')][_0xb6f6('0x21')](_[_0xb6f6('0x22')](_0x27f674,{'raw':!![],'where':{'id':0x1}}))[_0xb6f6('0x23')](function(_0x5a5efd){return checkLicense(_0x5a5efd,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x1360=['../../mysqldb','license','isEmpty','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','final','parse','uuid','machineUuid','secrets','session','update','gray','deadline','add','days','format','changed','disabled','Breaking\x20license','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment'];(function(_0x338c20,_0xe92a7d){var _0x3ba905=function(_0x26c276){while(--_0x26c276){_0x338c20['push'](_0x338c20['shift']());}};_0x3ba905(++_0xe92a7d);}(_0x1360,0x180));var _0x0136=function(_0x16aa70,_0x5b1f73){_0x16aa70=_0x16aa70-0x0;var _0x11875f=_0x1360[_0x16aa70];return _0x11875f;};'use strict';var crypto=require(_0x0136('0x0'));var util=require(_0x0136('0x1'));var _=require(_0x0136('0x2'));var moment=require(_0x0136('0x3'));var hardware=require(_0x0136('0x4'));var config=require(_0x0136('0x5'));var db=require(_0x0136('0x6'))['db'];function checkLicense(_0x421eda,_0x44180e){if(_0x421eda){try{var _0x331bc0=_0x44180e||_0x421eda[_0x0136('0x7')];if(_[_0x0136('0x8')](_0x331bc0)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1aad3c=_0x421eda[_0x0136('0x9')];var _0x321bf1=_0x421eda['data2'];var _0xb26733=_0x1aad3c['split']('-')[0x4];var _0x11308d=_0x1aad3c[_0x0136('0xa')]('-')[0x0];var _0x3a31d7=crypto[_0x0136('0xb')](_0x0136('0xc'),util['format'](_0x0136('0xd'),_0xb26733,_0x1aad3c,_0x11308d));var _0x4f33d5=_0x3a31d7['update'](_0x331bc0,_0x0136('0xe'),_0x0136('0xf'));_0x4f33d5+=_0x3a31d7[_0x0136('0x10')]('utf8');var _0x1ef30b=JSON[_0x0136('0x11')](_0x4f33d5);_0x1ef30b['demo']=![];_0x1ef30b[_0x0136('0x12')]=_0x1aad3c;_0x1ef30b[_0x0136('0x13')]=hardware['getUuid']();if(_0x321bf1){var _0x294b7f=crypto['createDecipher'](_0x0136('0xc'),config[_0x0136('0x14')][_0x0136('0x15')]);var _0x2f9ca5=_0x294b7f[_0x0136('0x16')](_0x321bf1,_0x0136('0xe'),_0x0136('0xf'));_0x2f9ca5+=_0x294b7f['final'](_0x0136('0xf'));_0x1ef30b[_0x0136('0x17')]=_0x2f9ca5;_0x1ef30b[_0x0136('0x18')]=moment(_0x2f9ca5)[_0x0136('0x19')](0x7,_0x0136('0x1a'))[_0x0136('0x1b')]();_0x1ef30b['grayReason']=_0x1ef30b[_0x0136('0x12')]!=_0x1ef30b[_0x0136('0x13')]?_0x0136('0x1c'):_0x0136('0x1d');}return _0x1ef30b;}catch(_0x5b79bb){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0136('0x1e'),'uuid':_0x421eda['data1'],'machineUuid':hardware['getUuid'](),'message':_0x5b79bb['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0136('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0136('0x20'),'uuid':_0x421eda[_0x0136('0x9')],'machineUuid':hardware[_0x0136('0x21')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x54327c){return db[_0x0136('0x22')][_0x0136('0x23')](_[_0x0136('0x24')](_0x54327c,{'raw':!![],'where':{'id':0x1}}))[_0x0136('0x25')](function(_0x49d555){return checkLicense(_0x49d555,null);});};exports[_0x0136('0x26')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 22bf3d7..ac62ab0 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 _0x7f25=['http://localhost:9000','secret'];(function(_0x243b2f,_0x520f3b){var _0xb83691=function(_0x52262d){while(--_0x52262d){_0x243b2f['push'](_0x243b2f['shift']());}};_0xb83691(++_0x520f3b);}(_0x7f25,0x19a));var _0x57f2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f25[_0x432682];return _0x463d05;};'use strict';module['exports']={'DOMAIN':_0x57f2('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x57f2('0x1'),'DEBUG':''}; \ No newline at end of file +var _0x9823=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x9823,0xf8));var _0x3982=function(_0x26f30c,_0x1d582c){_0x26f30c=_0x26f30c-0x0;var _0x5f4f2e=_0x9823[_0x26f30c];return _0x5f4f2e;};'use strict';module[_0x3982('0x0')]={'DOMAIN':_0x3982('0x1'),'SESSION_SECRET':_0x3982('0x2'),'GOOGLE_ID':_0x3982('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c4f5501..4836e16 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b51=['util','INFO','join','/var','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','Logger','transports','%s-%s','error','File','info','Console','moment','winston'];(function(_0x54faff,_0x9a3b5e){var _0x5a784c=function(_0x3d1147){while(--_0x3d1147){_0x54faff['push'](_0x54faff['shift']());}};_0x5a784c(++_0x9a3b5e);}(_0x6b51,0x96));var _0x16b5=function(_0x447919,_0x12607e){_0x447919=_0x447919-0x0;var _0x1b1081=_0x6b51[_0x447919];return _0x1b1081;};'use strict';var moment=require(_0x16b5('0x0'));var winston=require(_0x16b5('0x1'));var util=require(_0x16b5('0x2'));var path=require('path');var debugLevel=_0x16b5('0x3');function filename(_0x295c86,_0xd02791){return path[_0x16b5('0x4')](_0x16b5('0x5'),'log','xcally',util[_0x16b5('0x6')](_0x16b5('0x7'),_0x295c86,_0xd02791));}function formatter(_0x2a69b0,_0xa1b173){return util[_0x16b5('0x6')](_0x16b5('0x8'),moment()['format'](_0x16b5('0x9')),_0xa1b173['level'][_0x16b5('0xa')](),_0x2a69b0,_0xa1b173[_0x16b5('0xb')]);}module['exports']=function(_0x2248e0){return new winston[(_0x16b5('0xc'))]({'transports':[new winston[(_0x16b5('0xd'))]['File']({'name':util[_0x16b5('0x6')](_0x16b5('0xe'),_0x2248e0,_0x16b5('0xf')),'filename':filename(_0x2248e0,_0x16b5('0xf')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x52e74d){return formatter(_0x2248e0,_0x52e74d);}}),new winston[(_0x16b5('0xd'))][(_0x16b5('0x10'))]({'name':util[_0x16b5('0x6')](_0x16b5('0xe'),_0x2248e0,_0x16b5('0x11')),'filename':filename(_0x2248e0,_0x16b5('0x11')),'level':_0x16b5('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x495714){return formatter(_0x2248e0,_0x495714);}}),new winston[(_0x16b5('0xd'))][(_0x16b5('0x12'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x50842c){return formatter(_0x2248e0,_0x50842c);}})]});}; \ No newline at end of file +var _0x7ca5=['info','transports','Console','env','debugLevel','moment','winston','path','INFO','join','/var','log','xcally','%s-%s.log','format','level','toUpperCase','Logger','error','File','%s-%s'];(function(_0x2aff26,_0x3edbc6){var _0x4ccf1a=function(_0x2f3b68){while(--_0x2f3b68){_0x2aff26['push'](_0x2aff26['shift']());}};_0x4ccf1a(++_0x3edbc6);}(_0x7ca5,0xc2));var _0x57ca=function(_0x4b563a,_0xed87cd){_0x4b563a=_0x4b563a-0x0;var _0x27c794=_0x7ca5[_0x4b563a];return _0x27c794;};'use strict';var moment=require(_0x57ca('0x0'));var winston=require(_0x57ca('0x1'));var util=require('util');var path=require(_0x57ca('0x2'));var debugLevel=_0x57ca('0x3');function filename(_0x1d369b,_0xf8df59){return path[_0x57ca('0x4')](_0x57ca('0x5'),_0x57ca('0x6'),_0x57ca('0x7'),util['format'](_0x57ca('0x8'),_0x1d369b,_0xf8df59));}function formatter(_0x412eaf,_0x219612){return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x57ca('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x219612[_0x57ca('0xa')][_0x57ca('0xb')](),_0x412eaf,_0x219612['message']);}module['exports']=function(_0x1522b3){return new winston[(_0x57ca('0xc'))]({'transports':[new winston['transports']['File']({'name':util['format']('%s-%s',_0x1522b3,_0x57ca('0xd')),'filename':filename(_0x1522b3,_0x57ca('0xd')),'level':_0x57ca('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51712f){return formatter(_0x1522b3,_0x51712f);}}),new winston['transports'][(_0x57ca('0xe'))]({'name':util[_0x57ca('0x9')](_0x57ca('0xf'),_0x1522b3,_0x57ca('0x10')),'filename':filename(_0x1522b3,_0x57ca('0x10')),'level':_0x57ca('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1335fd){return formatter(_0x1522b3,_0x1335fd);}}),new winston[(_0x57ca('0x11'))][(_0x57ca('0x12'))]({'level':process[_0x57ca('0x13')][_0x57ca('0x14')]||debugLevel,'json':![],'formatter':function(_0x54bc71){return formatter(_0x1522b3,_0x54bc71);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7bbf1a3..c0f16ae 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 _0x8558=['join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8558,0x1c5));var _0x8855=function(_0x34ea12,_0x4a47c8){_0x34ea12=_0x34ea12-0x0;var _0x1fac43=_0x8558[_0x34ea12];return _0x1fac43;};'use strict';var path=require(_0x8855('0x0'));var os=require('os');var config={'apps':[{'name':_0x8855('0x1'),'script':path[_0x8855('0x2')](__dirname,_0x8855('0x3'))},{'name':_0x8855('0x4'),'script':path[_0x8855('0x2')](__dirname,_0x8855('0x5'))},{'name':_0x8855('0x6'),'script':path[_0x8855('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x8855('0x7'),'script':path[_0x8855('0x2')](__dirname,_0x8855('0x8'))},{'name':_0x8855('0x9'),'script':path[_0x8855('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x8855('0xa'),'script':path['join'](__dirname,_0x8855('0xb'))}]};module[_0x8855('0xc')]=config; \ No newline at end of file +var _0x2dae=['xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x24210f,_0x3510de){var _0x37b6db=function(_0x53a3ba){while(--_0x53a3ba){_0x24210f['push'](_0x24210f['shift']());}};_0x37b6db(++_0x3510de);}(_0x2dae,0xc3));var _0xe2da=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x2dae[_0xd578cb];return _0x775533;};'use strict';var path=require(_0xe2da('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xe2da('0x1')](__dirname,_0xe2da('0x2'))},{'name':_0xe2da('0x3'),'script':path[_0xe2da('0x1')](__dirname,_0xe2da('0x4'))},{'name':'agi','script':path[_0xe2da('0x1')](__dirname,_0xe2da('0x5'))},{'name':_0xe2da('0x6'),'script':path[_0xe2da('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xe2da('0x7'),'script':path[_0xe2da('0x1')](__dirname,_0xe2da('0x8'))},{'name':_0xe2da('0x9'),'script':path[_0xe2da('0x1')](__dirname,_0xe2da('0xa'))}]};module[_0xe2da('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1164167..5b54aad 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 _0x1298=['then','list','describe','delete','dump','saved','bluebird','connect','connected','start','disconnect','stop'];(function(_0x50f171,_0x2f3545){var _0x6d62d7=function(_0x135556){while(--_0x135556){_0x50f171['push'](_0x50f171['shift']());}};_0x6d62d7(++_0x2f3545);}(_0x1298,0x19e));var _0x8129=function(_0x426323,_0x589019){_0x426323=_0x426323-0x0;var _0x373257=_0x1298[_0x426323];return _0x373257;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8129('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x2a138c,_0x11c863){return pm2[_0x8129('0x1')](function(_0x3a133f){if(_0x3a133f){return _0x11c863(_0x3a133f);}return _0x2a138c(_0x8129('0x2'));});});};exports[_0x8129('0x3')]=function(_0x39e214){return connect()['then'](function(){return new BPromise(function(_0x5b5ab8,_0x193d60){return pm2['start'](_0x39e214,function(_0x4f0a40,_0x1cd6a6){if(_0x4f0a40){return _0x193d60(_0x4f0a40);}pm2[_0x8129('0x4')]();return _0x5b5ab8(_0x1cd6a6);});});});};exports[_0x8129('0x5')]=function(_0x3d94f8){return connect()[_0x8129('0x6')](function(){return new BPromise(function(_0x53a78b,_0x5a0545){return pm2['stop'](_0x3d94f8,function(_0x50b960,_0x2f27a7){if(_0x50b960){return _0x5a0545(_0x50b960);}pm2[_0x8129('0x4')]();return _0x53a78b(_0x2f27a7);});});});};exports['restart']=function(_0x5e4fbe){return connect()['then'](function(){return new BPromise(function(_0x511313,_0x2784ed){return pm2['restart'](_0x5e4fbe,function(_0x4b02b5,_0x392d45){if(_0x4b02b5){return _0x2784ed(_0x4b02b5);}pm2[_0x8129('0x4')]();return _0x511313(_0x392d45);});});});};exports[_0x8129('0x7')]=function(){return connect()[_0x8129('0x6')](function(){return new BPromise(function(_0x15942c,_0xce0d4d){return pm2['list'](function(_0x4dbd35,_0x4027bf){if(_0x4dbd35){return _0xce0d4d(_0x4dbd35);}pm2['disconnect']();return _0x15942c(_0x4027bf);});});});};exports[_0x8129('0x8')]=function(_0x584da9){return connect()[_0x8129('0x6')](function(){return new BPromise(function(_0x23f01c,_0x5544c4){return pm2[_0x8129('0x8')](_0x584da9,function(_0x55fa91,_0x3b15ac){if(_0x55fa91){return _0x5544c4(_0x55fa91);}pm2[_0x8129('0x4')]();return _0x23f01c(_0x3b15ac);});});});};exports[_0x8129('0x9')]=function(_0x56efa1){return connect()[_0x8129('0x6')](function(){return new BPromise(function(_0x1ec668,_0x21c6c2){return pm2[_0x8129('0x9')](_0x56efa1,function(_0x3050b4,_0x1767af){if(_0x3050b4){return _0x21c6c2(_0x3050b4);}pm2['disconnect']();return _0x1ec668(_0x1767af);});});});};exports['dump']=function(){return connect()[_0x8129('0x6')](function(){return new BPromise(function(_0x4b96a6,_0x22c68d){return pm2[_0x8129('0xa')](function(_0x18eb3e){if(_0x18eb3e){return _0x22c68d(_0x18eb3e);}return _0x4b96a6(_0x8129('0xb'));});});});}; \ No newline at end of file +var _0x44e8=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x4a80b9,_0x40689){var _0x328f00=function(_0x3d3ab2){while(--_0x3d3ab2){_0x4a80b9['push'](_0x4a80b9['shift']());}};_0x328f00(++_0x40689);}(_0x44e8,0xd7));var _0x844e=function(_0x296727,_0x5b5791){_0x296727=_0x296727-0x0;var _0x730c94=_0x44e8[_0x296727];return _0x730c94;};'use strict';var pm2=require(_0x844e('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1b5be7,_0x21307e){return pm2[_0x844e('0x1')](function(_0x164ecc){if(_0x164ecc){return _0x21307e(_0x164ecc);}return _0x1b5be7('connected');});});};exports[_0x844e('0x2')]=function(_0x167368){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x446f47,_0x5c8f67){return pm2[_0x844e('0x2')](_0x167368,function(_0x238796,_0x1706b3){if(_0x238796){return _0x5c8f67(_0x238796);}pm2[_0x844e('0x4')]();return _0x446f47(_0x1706b3);});});});};exports['stop']=function(_0x31ab50){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x336881,_0x134672){return pm2[_0x844e('0x5')](_0x31ab50,function(_0x1f9921,_0x536601){if(_0x1f9921){return _0x134672(_0x1f9921);}pm2[_0x844e('0x4')]();return _0x336881(_0x536601);});});});};exports[_0x844e('0x6')]=function(_0x183c7e){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x14909f,_0x37b2a3){return pm2[_0x844e('0x6')](_0x183c7e,function(_0x5c6c08,_0x8d3bea){if(_0x5c6c08){return _0x37b2a3(_0x5c6c08);}pm2[_0x844e('0x4')]();return _0x14909f(_0x8d3bea);});});});};exports['list']=function(){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x1cd556,_0x492094){return pm2[_0x844e('0x7')](function(_0x6b542d,_0x1c1689){if(_0x6b542d){return _0x492094(_0x6b542d);}pm2['disconnect']();return _0x1cd556(_0x1c1689);});});});};exports[_0x844e('0x8')]=function(_0x465e49){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x935134,_0x2588a3){return pm2[_0x844e('0x8')](_0x465e49,function(_0x2227c6,_0x5506ef){if(_0x2227c6){return _0x2588a3(_0x2227c6);}pm2['disconnect']();return _0x935134(_0x5506ef);});});});};exports[_0x844e('0x9')]=function(_0x56791b){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x4b0c6c,_0x315c50){return pm2['delete'](_0x56791b,function(_0x43f05d,_0x10739f){if(_0x43f05d){return _0x315c50(_0x43f05d);}pm2[_0x844e('0x4')]();return _0x4b0c6c(_0x10739f);});});});};exports[_0x844e('0xa')]=function(){return connect()[_0x844e('0x3')](function(){return new BPromise(function(_0x2b58c7,_0x181afd){return pm2[_0x844e('0xa')](function(_0x4ffb86){if(_0x4ffb86){return _0x181afd(_0x4ffb86);}return _0x2b58c7(_0x844e('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8074d25..19fbbaa 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 _0x5038=['localhost','socket.io-emitter','Setting','find','then','ChatInteraction','lastMsgAt','subtract','chatTimeout','minutes','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','chatInteraction:update','catch','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis'];(function(_0x5ea9c8,_0x5de943){var _0x4d1f37=function(_0x22526d){while(--_0x22526d){_0x5ea9c8['push'](_0x5ea9c8['shift']());}};_0x4d1f37(++_0x5de943);}(_0x5038,0x171));var _0x8503=function(_0x4706eb,_0x482ed8){_0x4706eb=_0x4706eb-0x0;var _0x321974=_0x5038[_0x4706eb];return _0x321974;};'use strict';var _=require(_0x8503('0x0'));var moment=require(_0x8503('0x1'));var Redis=require(_0x8503('0x2'));var db=require(_0x8503('0x3'))['db'];var config=require(_0x8503('0x4'));config[_0x8503('0x5')]=_['defaults'](config[_0x8503('0x5')],{'host':_0x8503('0x6'),'port':0x18eb});var io=require(_0x8503('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x490011=0x0;var _0x499ad6=[];return db[_0x8503('0x8')][_0x8503('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x8503('0xa')](function(_0x420d76){_0x490011=_0x420d76['chatTimeout'];if(_0x490011){return db[_0x8503('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x8503('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8503('0xd')](_0x420d76[_0x8503('0xe')],_0x8503('0xf'))}}});}else{return[];}})[_0x8503('0xa')](function(_0x33149e){_0x499ad6=_0x33149e;if(_0x490011){return db[_0x8503('0xb')][_0x8503('0x10')]({'closeReason':_0x8503('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x8503('0x12')](_0x8503('0x13'))},{'where':{'id':_[_0x8503('0x14')](_0x499ad6||[],'id')}});}})['then'](function(_0x1c38ac){for(var _0x596388=0x0;_0x596388<_0x499ad6[_0x8503('0x15')];_0x596388++){io['emit'](_0x8503('0x16'),{'id':_0x499ad6[_0x596388]['id'],'closed':!![]});}})[_0x8503('0x17')](function(_0x19280d){console['error'](_0x19280d);});}exports[_0x8503('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0e30=['YYYY-MM-DD\x20HH:mm:ss','length','emit','catch','error','lodash','moment','ioredis','../../config/environment','redis','defaults','Setting','find','then','chatTimeout','minutes','ChatInteraction','update','system','timeout','format'];(function(_0x54719e,_0x4cde8b){var _0x5e65fa=function(_0x5056c8){while(--_0x5056c8){_0x54719e['push'](_0x54719e['shift']());}};_0x5e65fa(++_0x4cde8b);}(_0x0e30,0x12b));var _0x00e3=function(_0x150bd6,_0x2a55b0){_0x150bd6=_0x150bd6-0x0;var _0x3e4e4e=_0x0e30[_0x150bd6];return _0x3e4e4e;};'use strict';var _=require(_0x00e3('0x0'));var moment=require(_0x00e3('0x1'));var Redis=require(_0x00e3('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x00e3('0x3'));config[_0x00e3('0x4')]=_[_0x00e3('0x5')](config[_0x00e3('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x00e3('0x4')]));function closeInteractions(){var _0x47ecc0=0x0;var _0x128c49=[];return db[_0x00e3('0x6')][_0x00e3('0x7')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x00e3('0x8')](function(_0x5f367f){_0x47ecc0=_0x5f367f[_0x00e3('0x9')];if(_0x47ecc0){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5f367f[_0x00e3('0x9')],_0x00e3('0xa'))}}});}else{return[];}})[_0x00e3('0x8')](function(_0x4ca397){_0x128c49=_0x4ca397;if(_0x47ecc0){return db[_0x00e3('0xb')][_0x00e3('0xc')]({'closeReason':_0x00e3('0xd'),'disposition':_0x00e3('0xe'),'closed':!![],'closedAt':moment()[_0x00e3('0xf')](_0x00e3('0x10'))},{'where':{'id':_['map'](_0x128c49||[],'id')}});}})['then'](function(_0x10eb83){for(var _0x4f12a8=0x0;_0x4f12a8<_0x128c49[_0x00e3('0x11')];_0x4f12a8++){io[_0x00e3('0x12')]('chatInteraction:update',{'id':_0x128c49[_0x4f12a8]['id'],'closed':!![]});}})[_0x00e3('0x13')](function(_0x11fc9c){console[_0x00e3('0x14')](_0x11fc9c);});}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 d33c1f8..2ad1d9e 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 _0x12d1=['http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','format','basename','extname','existsSync','status','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','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','difference','intersection','length','deleteJob','delete\x20cron','index','my\x20id','resolve','cron','active','isBetween','startAt','add','start','add\x20cron','exists','stop\x20cron','endAt','update','stop','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client'];(function(_0x4b6c03,_0x289c4f){var _0x38dc49=function(_0x3cb6eb){while(--_0x3cb6eb){_0x4b6c03['push'](_0x4b6c03['shift']());}};_0x38dc49(++_0x289c4f);}(_0x12d1,0x10a));var _0x112d=function(_0x43a598,_0x4ed851){_0x43a598=_0x43a598-0x0;var _0x53246a=_0x12d1[_0x43a598];return _0x53246a;};'use strict';var fs=require('fs');var util=require(_0x112d('0x0'));var path=require(_0x112d('0x1'));var _=require(_0x112d('0x2'));var moment=require(_0x112d('0x3'));var CronJobManager=require(_0x112d('0x4'));var jayson=require(_0x112d('0x5'));var BPromise=require(_0x112d('0x6'));var logger=require('../logger')('schedule');var db=require(_0x112d('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x112d('0x8'));var client=jayson[_0x112d('0x9')][_0x112d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x19ce03,_0x29eccd){return function(){logger[_0x112d('0xb')](_0x112d('0xc'),_0x19ce03[_0x112d('0xd')]);var _0x1e0e80=!![];var _0x18d2ca={'tls':{'rejectUnauthorized':![]}};if(_0x19ce03[_0x112d('0xe')][_0x112d('0xf')][_0x112d('0x10')]){_0x18d2ca[_0x112d('0x10')]=_0x19ce03[_0x112d('0xe')]['Smtp'][_0x112d('0x10')];}else{_0x18d2ca[_0x112d('0x11')]=_0x19ce03[_0x112d('0xe')][_0x112d('0xf')][_0x112d('0x11')];_0x18d2ca[_0x112d('0x12')]=_0x19ce03[_0x112d('0xe')][_0x112d('0xf')][_0x112d('0x12')];_0x18d2ca['secure']=_0x19ce03['MailAccount'][_0x112d('0xf')][_0x112d('0x13')];}if(_0x19ce03[_0x112d('0xe')][_0x112d('0xf')][_0x112d('0x14')]){_0x18d2ca[_0x112d('0x15')]={'user':_0x19ce03['MailAccount'][_0x112d('0xf')][_0x112d('0x16')],'pass':_0x19ce03['MailAccount'][_0x112d('0xf')][_0x112d('0x17')]};}var _0x3e73a7={'account':_0x18d2ca,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x19ce03['MailAccount'][_0x112d('0x18')],_0x19ce03[_0x112d('0xe')][_0x112d('0xd')]||_0x19ce03[_0x112d('0xe')][_0x112d('0xf')]['user']),'to':_0x19ce03[_0x112d('0xd')],'cc':_0x19ce03['cc'],'bcc':_0x19ce03[_0x112d('0x19')],'subject':util['format'](_0x112d('0x1a'),_0x29eccd['name'],_0x19ce03[_0x112d('0x1b')],_0x19ce03[_0x112d('0x1c')])}};var _0x254ba9=path[_0x112d('0x1d')](__dirname,_0x112d('0x1e'));var _0x411afb=_0x29eccd[_0x112d('0x1f')];var _0x40dd85=util[_0x112d('0x20')]('%s.%s',path[_0x112d('0x21')](_0x29eccd[_0x112d('0x1f')],path[_0x112d('0x22')](_0x29eccd[_0x112d('0x1f')])),'zip');var _0x18bbb2=path[_0x112d('0x1d')](_0x254ba9,_0x411afb);var _0x28dbcb=path['join'](_0x254ba9,_0x40dd85);if(fs[_0x112d('0x23')](_0x18bbb2)){_0x29eccd[_0x112d('0x24')]='Sent';_0x3e73a7[_0x112d('0x25')][_0x112d('0x26')]=[{'filename':_0x411afb,'path':_0x18bbb2}];_0x3e73a7[_0x112d('0x25')][_0x112d('0x27')]=util[_0x112d('0x20')](_0x112d('0x28'),JSON[_0x112d('0x29')](_0x29eccd,null,0x2));}else if(fs[_0x112d('0x23')](_0x28dbcb)){_0x29eccd['status']='Sent';_0x3e73a7['message'][_0x112d('0x26')]=[{'filename':_0x40dd85,'path':_0x28dbcb}];}else{_0x3e73a7[_0x112d('0x25')][_0x112d('0x27')]=_0x112d('0x2a');if(!_0x19ce03[_0x112d('0x2b')]){_0x1e0e80=![];logger[_0x112d('0xb')](_0x112d('0x2c'));}}if(_0x1e0e80){return client[_0x112d('0x2d')](_0x112d('0x2e'),_0x3e73a7)['then'](function(_0x3bb7b7){if(_0x3bb7b7[_0x112d('0x2f')]){return logger[_0x112d('0x2f')](_0x112d('0x30'),JSON[_0x112d('0x29')](_0x3bb7b7));}return logger[_0x112d('0xb')](_0x112d('0x31'));})['catch'](function(_0x56042b){return logger[_0x112d('0x2f')]('error\x20mail',JSON[_0x112d('0x29')](_0x56042b));});}};}function handleError(){return function(_0x306fbc){return logger[_0x112d('0x2f')](JSON[_0x112d('0x29')](_0x306fbc));};}function handleResult(_0x44bff3){return function(_0x343645){logger[_0x112d('0xb')](_0x112d('0x32'),JSON[_0x112d('0x29')](_0x343645));if(_0x44bff3[_0x112d('0xe')]&&_0x44bff3['MailAccount'][_0x112d('0xf')]&&!_[_0x112d('0x33')](_0x44bff3[_0x112d('0xd')])){setTimeout(handleSendEmail(_0x44bff3,_0x343645),0x3c*0x3e8);}};}function handleJob(_0x46ae7b){return function(){try{if(_[_0x112d('0x33')](_0x46ae7b[_0x112d('0x1b')])){return logger['info'](_0x112d('0x34'));}if(_[_0x112d('0x33')](_0x46ae7b[_0x112d('0x1c')])){return logger[_0x112d('0xb')](_0x112d('0x35'));}var _0x4b95fb={'startDate':moment()[_0x112d('0x36')](_0x46ae7b['subtractNumber'],_0x46ae7b['subtractUnit'])[_0x112d('0x20')](_0x112d('0x37')),'endDate':moment()[_0x112d('0x20')](_0x112d('0x37')),'type':_0x112d('0x38'),'output':_0x46ae7b[_0x112d('0x39')],'name':_0x46ae7b['name']};if(!_[_0x112d('0x33')](_0x46ae7b[_0x112d('0x3a')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x46ae7b[_0x112d('0x3a')]);return analyticDefaultReportController[_0x112d('0x3b')]({'id':_0x46ae7b['DefaultReportId']},_0x4b95fb)[_0x112d('0x3c')](handleResult(_0x46ae7b))[_0x112d('0x3d')](handleError());}if(!_[_0x112d('0x33')](_0x46ae7b['CustomReportId'])){logger[_0x112d('0xb')](_0x112d('0x3e'),_0x46ae7b[_0x112d('0x3f')]);return analyticCustomReportController[_0x112d('0x3b')]({'id':_0x46ae7b['CustomReportId']},_0x4b95fb)[_0x112d('0x3c')](handleResult(_0x46ae7b))['catch'](handleError());}}catch(_0x4061f1){logger[_0x112d('0x2f')](JSON[_0x112d('0x29')](_0x4061f1));}return logger[_0x112d('0xb')](_0x112d('0x40'));};}function getJobs(_0xc44d17){var _0x4e4c10={};if(_0xc44d17){_0x4e4c10['id']=_0xc44d17;}return db[_0x112d('0x41')][_0x112d('0x42')]({'where':_0x4e4c10,'include':[{'model':db[_0x112d('0xe')],'attributes':['id',_0x112d('0x18'),'email'],'include':[{'model':db[_0x112d('0x43')],'as':'Smtp'}]}]})['then'](function(_0xc70b4f){var _0x31c7a1=_[_0x112d('0x44')](manager['jobs']);var _0x4555fe=_[_0x112d('0x45')](_0xc70b4f,function(_0x1242bf){return _0x1242bf['id'][_0x112d('0x46')]();});var _0x5354a9=_['keyBy'](_0xc70b4f,function(_0x352d6c){return _0x352d6c['id']['toString']();});var _0x2119e4=_0xc44d17?_0x4555fe:_[_0x112d('0x47')](_0x4555fe,_0x31c7a1);var _0x4dbfb3=_[_0x112d('0x48')](_0x4555fe,_0x31c7a1);var _0x26a08a=_['difference'](_0x31c7a1,_0x4555fe);var _0xb498b6;var _0x1c6a8b;for(_0xb498b6=0x0;_0xb498b6<_0x26a08a[_0x112d('0x49')]&&!_0xc44d17;_0xb498b6+=0x1){_0x1c6a8b=_0x26a08a[_0xb498b6][_0x112d('0x46')]();if(manager['exists'](_0x1c6a8b)){manager['stop'](_0x1c6a8b);manager[_0x112d('0x4a')](_0x1c6a8b);logger[_0x112d('0xb')](_0x112d('0x4b'),_0x1c6a8b);}}logger[_0x112d('0xb')]('toRun',JSON['stringify'](_0x2119e4));for(_0xb498b6=0x0;_0xb498b6<_0x2119e4[_0x112d('0x49')];_0xb498b6+=0x1){_0x1c6a8b=_0x2119e4[_0xb498b6][_0x112d('0x46')]();logger[_0x112d('0xb')](_0x112d('0x4c'),_0x1c6a8b);if(_0xc44d17){logger[_0x112d('0xb')](_0x112d('0x4d'),_0xc44d17);logger[_0x112d('0xb')](JSON[_0x112d('0x29')](_0x5354a9[_0x1c6a8b]));BPromise[_0x112d('0x4e')]()[_0x112d('0x3c')](handleJob(_0x5354a9[_0x1c6a8b]));logger[_0x112d('0xb')]('run\x20job',_0x5354a9[_0x1c6a8b][_0x112d('0x18')],_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]);}else if(_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]&&_0x5354a9[_0x1c6a8b][_0x112d('0x50')]&&moment()[_0x112d('0x51')](_0x5354a9[_0x1c6a8b][_0x112d('0x52')],_0x5354a9[_0x1c6a8b]['endAt'])){manager[_0x112d('0x53')](_0x1c6a8b,_0x5354a9[_0x1c6a8b]['cron'],handleJob(_0x5354a9[_0x1c6a8b]));manager[_0x112d('0x54')](_0x1c6a8b);logger[_0x112d('0xb')](_0x112d('0x55'),_0x5354a9[_0x1c6a8b]['name'],_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]);}else if(manager[_0x112d('0x56')](_0x1c6a8b)){manager['stop'](_0x1c6a8b);manager[_0x112d('0x4a')](_0x1c6a8b);logger['info'](_0x112d('0x57'),_0x5354a9[_0x1c6a8b][_0x112d('0x18')],_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]);}}for(_0xb498b6=0x0,_0x1c6a8b;_0xb498b6<_0x4dbfb3[_0x112d('0x49')]&&!_0xc44d17;_0xb498b6+=0x1){_0x1c6a8b=_0x4dbfb3[_0xb498b6][_0x112d('0x46')]();if(manager[_0x112d('0x56')](_0x1c6a8b)){if(_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]&&_0x5354a9[_0x1c6a8b]['active']&&moment()['isBetween'](_0x5354a9[_0x1c6a8b]['startAt'],_0x5354a9[_0x1c6a8b][_0x112d('0x58')])){manager[_0x112d('0x59')](_0x1c6a8b,_0x5354a9[_0x1c6a8b][_0x112d('0x4f')],handleJob(_0x5354a9[_0x1c6a8b]));logger[_0x112d('0xb')]('update\x20cron',_0x5354a9[_0x1c6a8b][_0x112d('0x18')],_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]);}else{manager[_0x112d('0x5a')](_0x1c6a8b);manager[_0x112d('0x4a')](_0x1c6a8b);logger[_0x112d('0xb')](_0x112d('0x57'),_0x5354a9[_0x1c6a8b][_0x112d('0x18')],_0x5354a9[_0x1c6a8b][_0x112d('0x4f')]);}}}})[_0x112d('0x3d')](function(_0x5ae122){logger[_0x112d('0x2f')](JSON['stringify'](_0x5ae122));});}exports[_0x112d('0x5b')]=function(_0x3a8ee8){return getJobs(_0x3a8ee8);};exports[_0x112d('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x24fc=['bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','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','Sent','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','stringify','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','jobs','map','toString','intersection','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','update','stop\x20cron','run','path','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','user'];(function(_0x157725,_0x1460f9){var _0x3b34c4=function(_0x564856){while(--_0x564856){_0x157725['push'](_0x157725['shift']());}};_0x3b34c4(++_0x1460f9);}(_0x24fc,0xf9));var _0xc24f=function(_0x29b7d6,_0x5384cf){_0x29b7d6=_0x29b7d6-0x0;var _0x2cd722=_0x24fc[_0x29b7d6];return _0x2cd722;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xc24f('0x0'));var _=require('lodash');var moment=require(_0xc24f('0x1'));var CronJobManager=require(_0xc24f('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xc24f('0x3'));var logger=require('../logger')(_0xc24f('0x4'));var db=require(_0xc24f('0x5'))['db'];var analyticCustomReportController=require(_0xc24f('0x6'));var analyticDefaultReportController=require(_0xc24f('0x7'));var client=jayson[_0xc24f('0x8')][_0xc24f('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1c5898,_0x3826d4){return function(){logger[_0xc24f('0xa')](_0xc24f('0xb'),_0x1c5898[_0xc24f('0xc')]);var _0x36a115=!![];var _0x5b2f13={'tls':{'rejectUnauthorized':![]}};if(_0x1c5898['MailAccount']['Smtp'][_0xc24f('0xd')]){_0x5b2f13[_0xc24f('0xd')]=_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')][_0xc24f('0xd')];}else{_0x5b2f13['host']=_0x1c5898['MailAccount'][_0xc24f('0xf')][_0xc24f('0x10')];_0x5b2f13[_0xc24f('0x11')]=_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')]['port'];_0x5b2f13[_0xc24f('0x12')]=_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')][_0xc24f('0x12')];}if(_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')][_0xc24f('0x13')]){_0x5b2f13['auth']={'user':_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')]['user'],'pass':_0x1c5898[_0xc24f('0xe')][_0xc24f('0xf')][_0xc24f('0x14')]};}var _0x56d326={'account':_0x5b2f13,'message':{'from':util[_0xc24f('0x15')](_0xc24f('0x16'),_0x1c5898[_0xc24f('0xe')]['name'],_0x1c5898['MailAccount']['email']||_0x1c5898[_0xc24f('0xe')]['Smtp'][_0xc24f('0x17')]),'to':_0x1c5898[_0xc24f('0xc')],'cc':_0x1c5898['cc'],'bcc':_0x1c5898[_0xc24f('0x18')],'subject':util['format'](_0xc24f('0x19'),_0x3826d4['name'],_0x1c5898['subtractNumber'],_0x1c5898[_0xc24f('0x1a')])}};var _0x14cdad=path[_0xc24f('0x1b')](__dirname,_0xc24f('0x1c'));var _0x13ec82=_0x3826d4['savename'];var _0x31c97b=util['format'](_0xc24f('0x1d'),path[_0xc24f('0x1e')](_0x3826d4[_0xc24f('0x1f')],path[_0xc24f('0x20')](_0x3826d4[_0xc24f('0x1f')])),_0xc24f('0x21'));var _0x4a7ac4=path['join'](_0x14cdad,_0x13ec82);var _0x3f88f6=path[_0xc24f('0x1b')](_0x14cdad,_0x31c97b);if(fs[_0xc24f('0x22')](_0x4a7ac4)){_0x3826d4[_0xc24f('0x23')]='Sent';_0x56d326[_0xc24f('0x24')][_0xc24f('0x25')]=[{'filename':_0x13ec82,'path':_0x4a7ac4}];_0x56d326['message'][_0xc24f('0x26')]=util[_0xc24f('0x15')](_0xc24f('0x27'),JSON['stringify'](_0x3826d4,null,0x2));}else if(fs[_0xc24f('0x22')](_0x3f88f6)){_0x3826d4['status']=_0xc24f('0x28');_0x56d326[_0xc24f('0x24')][_0xc24f('0x25')]=[{'filename':_0x31c97b,'path':_0x3f88f6}];}else{_0x56d326[_0xc24f('0x24')][_0xc24f('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1c5898['sendIfEmpty']){_0x36a115=![];logger[_0xc24f('0xa')](_0xc24f('0x29'));}}if(_0x36a115){return client[_0xc24f('0x2a')](_0xc24f('0x2b'),_0x56d326)[_0xc24f('0x2c')](function(_0x3161a1){if(_0x3161a1[_0xc24f('0x2d')]){return logger[_0xc24f('0x2d')]('error\x20mail',JSON['stringify'](_0x3161a1));}return logger[_0xc24f('0xa')](_0xc24f('0x2e'));})[_0xc24f('0x2f')](function(_0x5d46c0){return logger[_0xc24f('0x2d')]('error\x20mail',JSON[_0xc24f('0x30')](_0x5d46c0));});}};}function handleError(){return function(_0x371126){return logger[_0xc24f('0x2d')](JSON[_0xc24f('0x30')](_0x371126));};}function handleResult(_0xdb2cf9){return function(_0x400ef3){logger['info'](_0xc24f('0x31'),JSON[_0xc24f('0x30')](_0x400ef3));if(_0xdb2cf9[_0xc24f('0xe')]&&_0xdb2cf9['MailAccount'][_0xc24f('0xf')]&&!_[_0xc24f('0x32')](_0xdb2cf9[_0xc24f('0xc')])){setTimeout(handleSendEmail(_0xdb2cf9,_0x400ef3),0x3c*0x3e8);}};}function handleJob(_0x49f62c){return function(){try{if(_[_0xc24f('0x32')](_0x49f62c[_0xc24f('0x33')])){return logger['info'](_0xc24f('0x34'));}if(_[_0xc24f('0x32')](_0x49f62c[_0xc24f('0x1a')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x34a6a2={'startDate':moment()['subtract'](_0x49f62c[_0xc24f('0x33')],_0x49f62c[_0xc24f('0x1a')])[_0xc24f('0x15')](_0xc24f('0x35')),'endDate':moment()['format'](_0xc24f('0x35')),'type':_0xc24f('0x36'),'output':_0x49f62c[_0xc24f('0x37')],'name':_0x49f62c[_0xc24f('0x38')]};if(!_[_0xc24f('0x32')](_0x49f62c['DefaultReportId'])){logger[_0xc24f('0xa')](_0xc24f('0x39'),_0x49f62c[_0xc24f('0x3a')]);return analyticDefaultReportController[_0xc24f('0x3b')]({'id':_0x49f62c[_0xc24f('0x3a')]},_0x34a6a2)[_0xc24f('0x2c')](handleResult(_0x49f62c))[_0xc24f('0x2f')](handleError());}if(!_[_0xc24f('0x32')](_0x49f62c[_0xc24f('0x3c')])){logger[_0xc24f('0xa')](_0xc24f('0x3d'),_0x49f62c[_0xc24f('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x49f62c['CustomReportId']},_0x34a6a2)[_0xc24f('0x2c')](handleResult(_0x49f62c))[_0xc24f('0x2f')](handleError());}}catch(_0x574e29){logger[_0xc24f('0x2d')](JSON['stringify'](_0x574e29));}return logger[_0xc24f('0xa')]('no\x20report\x20id');};}function getJobs(_0x102cf5){var _0x3393bd={};if(_0x102cf5){_0x3393bd['id']=_0x102cf5;}return db[_0xc24f('0x3e')][_0xc24f('0x3f')]({'where':_0x3393bd,'include':[{'model':db[_0xc24f('0xe')],'attributes':['id',_0xc24f('0x38'),_0xc24f('0xc')],'include':[{'model':db[_0xc24f('0x40')],'as':'Smtp'}]}]})[_0xc24f('0x2c')](function(_0xa7ec7){var _0x48058b=_['keys'](manager[_0xc24f('0x41')]);var _0x163728=_[_0xc24f('0x42')](_0xa7ec7,function(_0x234cb5){return _0x234cb5['id'][_0xc24f('0x43')]();});var _0x4c13f5=_['keyBy'](_0xa7ec7,function(_0x3b911e){return _0x3b911e['id'][_0xc24f('0x43')]();});var _0x5ea0d9=_0x102cf5?_0x163728:_['difference'](_0x163728,_0x48058b);var _0x59aa44=_[_0xc24f('0x44')](_0x163728,_0x48058b);var _0x871e28=_[_0xc24f('0x45')](_0x48058b,_0x163728);var _0x3d15a0;var _0x1a5bf2;for(_0x3d15a0=0x0;_0x3d15a0<_0x871e28[_0xc24f('0x46')]&&!_0x102cf5;_0x3d15a0+=0x1){_0x1a5bf2=_0x871e28[_0x3d15a0][_0xc24f('0x43')]();if(manager['exists'](_0x1a5bf2)){manager[_0xc24f('0x47')](_0x1a5bf2);manager[_0xc24f('0x48')](_0x1a5bf2);logger[_0xc24f('0xa')](_0xc24f('0x49'),_0x1a5bf2);}}logger[_0xc24f('0xa')](_0xc24f('0x4a'),JSON[_0xc24f('0x30')](_0x5ea0d9));for(_0x3d15a0=0x0;_0x3d15a0<_0x5ea0d9['length'];_0x3d15a0+=0x1){_0x1a5bf2=_0x5ea0d9[_0x3d15a0][_0xc24f('0x43')]();logger[_0xc24f('0xa')](_0xc24f('0x4b'),_0x1a5bf2);if(_0x102cf5){logger[_0xc24f('0xa')](_0xc24f('0x4c'),_0x102cf5);logger[_0xc24f('0xa')](JSON[_0xc24f('0x30')](_0x4c13f5[_0x1a5bf2]));BPromise[_0xc24f('0x4d')]()[_0xc24f('0x2c')](handleJob(_0x4c13f5[_0x1a5bf2]));logger[_0xc24f('0xa')](_0xc24f('0x4e'),_0x4c13f5[_0x1a5bf2]['name'],_0x4c13f5[_0x1a5bf2][_0xc24f('0x4f')]);}else if(_0x4c13f5[_0x1a5bf2]['cron']&&_0x4c13f5[_0x1a5bf2][_0xc24f('0x50')]&&moment()[_0xc24f('0x51')](_0x4c13f5[_0x1a5bf2][_0xc24f('0x52')],_0x4c13f5[_0x1a5bf2][_0xc24f('0x53')])){manager[_0xc24f('0x54')](_0x1a5bf2,_0x4c13f5[_0x1a5bf2][_0xc24f('0x4f')],handleJob(_0x4c13f5[_0x1a5bf2]));manager[_0xc24f('0x55')](_0x1a5bf2);logger[_0xc24f('0xa')](_0xc24f('0x56'),_0x4c13f5[_0x1a5bf2][_0xc24f('0x38')],_0x4c13f5[_0x1a5bf2]['cron']);}else if(manager[_0xc24f('0x57')](_0x1a5bf2)){manager['stop'](_0x1a5bf2);manager[_0xc24f('0x48')](_0x1a5bf2);logger[_0xc24f('0xa')]('stop\x20cron',_0x4c13f5[_0x1a5bf2][_0xc24f('0x38')],_0x4c13f5[_0x1a5bf2]['cron']);}}for(_0x3d15a0=0x0,_0x1a5bf2;_0x3d15a0<_0x59aa44[_0xc24f('0x46')]&&!_0x102cf5;_0x3d15a0+=0x1){_0x1a5bf2=_0x59aa44[_0x3d15a0][_0xc24f('0x43')]();if(manager[_0xc24f('0x57')](_0x1a5bf2)){if(_0x4c13f5[_0x1a5bf2][_0xc24f('0x4f')]&&_0x4c13f5[_0x1a5bf2]['active']&&moment()['isBetween'](_0x4c13f5[_0x1a5bf2][_0xc24f('0x52')],_0x4c13f5[_0x1a5bf2][_0xc24f('0x53')])){manager[_0xc24f('0x58')](_0x1a5bf2,_0x4c13f5[_0x1a5bf2][_0xc24f('0x4f')],handleJob(_0x4c13f5[_0x1a5bf2]));logger[_0xc24f('0xa')]('update\x20cron',_0x4c13f5[_0x1a5bf2]['name'],_0x4c13f5[_0x1a5bf2][_0xc24f('0x4f')]);}else{manager[_0xc24f('0x47')](_0x1a5bf2);manager['deleteJob'](_0x1a5bf2);logger[_0xc24f('0xa')](_0xc24f('0x59'),_0x4c13f5[_0x1a5bf2][_0xc24f('0x38')],_0x4c13f5[_0x1a5bf2]['cron']);}}}})[_0xc24f('0x2f')](function(_0x504265){logger[_0xc24f('0x2d')](JSON['stringify'](_0x504265));});}exports[_0xc24f('0x5a')]=function(_0x213c0c){return getJobs(_0x213c0c);};exports['start']=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 6544b73..21f858d 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 _0xd7cf=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Neutral','COMPLETED','catch','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','name','error','start','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0xd7cf,0x1de));var _0xfd7c=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xd7cf[_0x2d994d];return _0xd54be4;};var _=require('lodash');var AWS=require(_0xfd7c('0x0'));var rp=require(_0xfd7c('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xfd7c('0x2'))['db'];var logger=require(_0xfd7c('0x3'))(_0xfd7c('0x4'));function getTranscriptionJob(_0x4afbdb,_0x419666,_0x4f0d49,_0x2d13b3){return new Promise(function(_0x355f21,_0x1db7c1){var _0x21c4cd=new AWS[(_0xfd7c('0x5'))]({'accessKeyId':_0x419666,'secretAccessKey':_0x4afbdb,'region':_0x4f0d49});_0x21c4cd[_0xfd7c('0x6')]({'TranscriptionJobName':_0x2d13b3},function(_0xc955f5,_0x8ad55b){if(_0xc955f5){return _0x1db7c1(_0xc955f5);}else{return _0x355f21(_0x8ad55b);}});});}function sentiment(_0x1ed964,_0x5b8b50,_0x214243,_0xaf45bb,_0x329e98){return new Promise(function(_0x1bb386,_0x5d95c7){var _0x5a6f32=new AWS[(_0xfd7c('0x7'))]({'accessKeyId':_0x5b8b50,'secretAccessKey':_0x1ed964,'region':_0x214243});_0x5a6f32[_0xfd7c('0x8')]({'Text':_0xaf45bb,'LanguageCode':_0x329e98[_0xfd7c('0x9')](0x0,0x2)},function(_0x45fd15,_0x3db379){if(_0x45fd15){return _0x5d95c7(_0x45fd15);}else{return _0x1bb386(_0x3db379);}});});}function checkTranscribeJob(_0x21d78a,_0x4df7de,_0x577421){var _0x40b2dd;return new BPromise(function(_0x40fbbb,_0x2cf5bd){logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0xc'),_0x21d78a['id'],_0x21d78a[_0xfd7c('0xd')]));return getTranscriptionJob(_0x577421[_0xfd7c('0xe')],_0x577421['data2'],_0x4df7de['transcribeRegion'],_0x21d78a[_0xfd7c('0xd')])[_0xfd7c('0xf')](function(_0x25a933){logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0x10'),_0x21d78a['id'],_0x21d78a['transcribeName'],_0x25a933[_0xfd7c('0x11')][_0xfd7c('0x12')]));if(!_0x21d78a[_0xfd7c('0x13')]){switch(_0x25a933[_0xfd7c('0x11')]['TranscriptionJobStatus']){case'COMPLETED':var _0x1311cf={'transcribeStatus':_0x25a933[_0xfd7c('0x11')][_0xfd7c('0x12')],'fileUri':_0x25a933[_0xfd7c('0x11')][_0xfd7c('0x14')][_0xfd7c('0x15')]};logger['info'](util[_0xfd7c('0xb')](_0xfd7c('0x16'),_0x21d78a['id']));return rp({'uri':_0x25a933[_0xfd7c('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xfd7c('0xf')](function(_0x1f4cb6){logger[_0xfd7c('0xa')](util['format'](_0xfd7c('0x17'),_0x21d78a['id']));if(_0x1f4cb6&&_0x1f4cb6['results']&&_0x1f4cb6[_0xfd7c('0x18')][_0xfd7c('0x19')]&&_0x1f4cb6[_0xfd7c('0x18')][_0xfd7c('0x19')]['length']){_0x1311cf[_0xfd7c('0x13')]='';for(var _0x56b616=0x0;_0x56b616<_0x1f4cb6[_0xfd7c('0x18')][_0xfd7c('0x19')][_0xfd7c('0x1a')];_0x56b616++){_0x1311cf[_0xfd7c('0x13')]+=_0x1f4cb6[_0xfd7c('0x18')]['transcripts'][_0x56b616]['transcript']+'';}}return _0x21d78a[_0xfd7c('0x1b')](_0x1311cf);})[_0xfd7c('0xf')](function(){logger[_0xfd7c('0xa')](util['format'](_0xfd7c('0x1c'),_0x21d78a['id']));if(!_0x21d78a[_0xfd7c('0x1d')]){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x20'));}if(!_0x4df7de[_0xfd7c('0x21')]||!_0x4df7de[_0xfd7c('0x22')]||!_0x4df7de[_0xfd7c('0x23')]||!_0x4df7de[_0xfd7c('0x24')]||!_0x4df7de['bucket']){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x25'));}if(!_0x1311cf[_0xfd7c('0x13')]){throw new Error(_0xfd7c('0x26'));}if(_0x4df7de[_0xfd7c('0x22')]===_0x577421['id']){return _0x577421;}else{return db[_0xfd7c('0x27')][_0xfd7c('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xfd7c('0xf')](function(_0x168023){if(!_0x168023){throw new db['Sequelize'][(_0xfd7c('0x1f'))](_0xfd7c('0x29'));}if(!_0x168023['data1']||!_0x168023[_0xfd7c('0x2a')]){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x2b'));}_0x40b2dd=_0x168023;logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0x2c'),_0x21d78a['id']));return sentiment(_0x40b2dd[_0xfd7c('0xe')],_0x40b2dd[_0xfd7c('0x2a')],_0x4df7de[_0xfd7c('0x23')],_0x1311cf['fileText'],_0x4df7de[_0xfd7c('0x24')]);})['then'](function(_0x31a546){logger['info'](util[_0xfd7c('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x21d78a['id']));return _0x21d78a[_0xfd7c('0x1b')]({'sentiment':_0x31a546[_0xfd7c('0x2d')],'sPositive':_0x31a546['SentimentScore']['Positive'],'sNegative':_0x31a546[_0xfd7c('0x2e')][_0xfd7c('0x2f')],'sMixed':_0x31a546['SentimentScore'][_0xfd7c('0x30')],'sNeutral':_0x31a546[_0xfd7c('0x2e')]['Neutral']});})['then'](function(){logger['info'](util['format'](_0xfd7c('0x1c'),_0x21d78a['id']));_0x40fbbb();});case'FAILED':return _0x21d78a[_0xfd7c('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x25a933['TranscriptionJob'][_0xfd7c('0x31')]})[_0xfd7c('0xf')](function(){logger['info'](util['format'](_0xfd7c('0x1c'),_0x21d78a['id']));_0x40fbbb();});default:logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0x32'),_0x21d78a['id']));break;}}else{return BPromise['resolve']()[_0xfd7c('0xf')](function(){if(!_0x21d78a[_0xfd7c('0x1d')]){throw new db['Sequelize'][(_0xfd7c('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4df7de[_0xfd7c('0x21')]||!_0x4df7de[_0xfd7c('0x22')]||!_0x4df7de['sentimentRegion']||!_0x4df7de['language']||!_0x4df7de[_0xfd7c('0x33')]){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x21d78a['fileText']){throw new Error(_0xfd7c('0x26'));}if(_0x4df7de['sentimentAccountId']===_0x577421['id']){return _0x577421;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xfd7c('0x22')]}});}})[_0xfd7c('0xf')](function(_0x147213){if(!_0x147213){throw new db['Sequelize'][(_0xfd7c('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x147213[_0xfd7c('0xe')]||!_0x147213[_0xfd7c('0x2a')]){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x2b'));}_0x40b2dd=_0x147213;logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0x2c'),_0x21d78a['id']));return sentiment(_0x40b2dd[_0xfd7c('0xe')],_0x40b2dd['data2'],_0x4df7de[_0xfd7c('0x23')],_0x21d78a[_0xfd7c('0x13')],_0x4df7de['language']);})[_0xfd7c('0xf')](function(_0x367e8f){logger[_0xfd7c('0xa')](util[_0xfd7c('0xb')](_0xfd7c('0x34'),_0x21d78a['id']));return _0x21d78a[_0xfd7c('0x1b')]({'sentiment':_0x367e8f[_0xfd7c('0x2d')],'sPositive':_0x367e8f[_0xfd7c('0x2e')][_0xfd7c('0x35')],'sNegative':_0x367e8f['SentimentScore'][_0xfd7c('0x2f')],'sMixed':_0x367e8f['SentimentScore'][_0xfd7c('0x30')],'sNeutral':_0x367e8f[_0xfd7c('0x2e')][_0xfd7c('0x36')],'transcribeStatus':_0xfd7c('0x37')});})[_0xfd7c('0xf')](function(){logger[_0xfd7c('0xa')](util['format'](_0xfd7c('0x1c'),_0x21d78a['id']));_0x40fbbb();});}})[_0xfd7c('0x38')](function(_0x187400){if(_0x187400){if(!_0x187400['name']||_0x187400['name']!==_0xfd7c('0x39')){logger['error'](util[_0xfd7c('0xb')](_0xfd7c('0x3a'),_0x21d78a['id']),util['inspect'](_0x187400,{'showHidden':![],'depth':null}));}}_0x40fbbb();});});}function checkTranscribe(){var _0x4eef6b;var _0x525eac;var _0x1ff685;return db[_0xfd7c('0x3b')]['findAll']({'where':{'transcribeStatus':_0xfd7c('0x3c')}})[_0xfd7c('0xf')](function(_0x5e7105){if(!_0x5e7105||!_0x5e7105[_0xfd7c('0x1a')]){throw new db['Sequelize'][(_0xfd7c('0x1f'))](_0xfd7c('0x3d'));}_0x4eef6b=_0x5e7105;return db[_0xfd7c('0x3e')]['findOne']({'where':{'id':0x1}});})[_0xfd7c('0xf')](function(_0x4d4e0c){if(!_0x4d4e0c){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x3f'));}_0x525eac=_0x4d4e0c;if(!_0x525eac[_0xfd7c('0x4')]||!_0x525eac[_0xfd7c('0x40')]||!_0x525eac[_0xfd7c('0x41')]||!_0x525eac['language']||!_0x525eac[_0xfd7c('0x33')]){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))](_0xfd7c('0x42'));}return db['CloudProvider']['findOne']({'where':{'id':_0x525eac[_0xfd7c('0x40')]}});})[_0xfd7c('0xf')](function(_0x5f3a10){if(!_0x5f3a10){throw new db[(_0xfd7c('0x1e'))][(_0xfd7c('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5f3a10['data1']||!_0x5f3a10[_0xfd7c('0x2a')]){throw new db['Sequelize'][(_0xfd7c('0x1f'))](_0xfd7c('0x2b'));}_0x1ff685=_0x5f3a10;var _0x1ba2b3=[];_0x4eef6b['forEach'](function(_0x10d6dd){_0x1ba2b3['push'](checkTranscribeJob(_0x10d6dd,_0x525eac,_0x1ff685));});return BPromise['all'](_0x1ba2b3);})[_0xfd7c('0x38')](function(_0xc0a9d5){if(_0xc0a9d5){if(!_0xc0a9d5['name']||_0xc0a9d5[_0xfd7c('0x43')]!==_0xfd7c('0x39')){logger[_0xfd7c('0x44')](util['inspect'](_0xc0a9d5,{'showHidden':![],'depth':null}));}}});}exports[_0xfd7c('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb404=['language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20available','Mixed','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','lodash','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0xb404,0x186));var _0x4b40=function(_0x361c07,_0x508b81){_0x361c07=_0x361c07-0x0;var _0x4fe846=_0xb404[_0x361c07];return _0x4fe846;};var _=require(_0x4b40('0x0'));var AWS=require('aws-sdk');var rp=require(_0x4b40('0x1'));var util=require('util');var BPromise=require(_0x4b40('0x2'));var db=require(_0x4b40('0x3'))['db'];var logger=require(_0x4b40('0x4'))(_0x4b40('0x5'));function getTranscriptionJob(_0x2f5d8c,_0x3580b8,_0x9fce71,_0x389eb8){return new Promise(function(_0x53a0cd,_0x504a6d){var _0x1ba519=new AWS['TranscribeService']({'accessKeyId':_0x3580b8,'secretAccessKey':_0x2f5d8c,'region':_0x9fce71});_0x1ba519[_0x4b40('0x6')]({'TranscriptionJobName':_0x389eb8},function(_0x11edc9,_0x46cc3d){if(_0x11edc9){return _0x504a6d(_0x11edc9);}else{return _0x53a0cd(_0x46cc3d);}});});}function sentiment(_0x176c84,_0x34ff85,_0x5057b9,_0xbe0e87,_0x358b07){return new Promise(function(_0x1a08f1,_0x330d39){var _0x3fd220=new AWS['Comprehend']({'accessKeyId':_0x34ff85,'secretAccessKey':_0x176c84,'region':_0x5057b9});_0x3fd220[_0x4b40('0x7')]({'Text':_0xbe0e87,'LanguageCode':_0x358b07['substring'](0x0,0x2)},function(_0x415a42,_0x535038){if(_0x415a42){return _0x330d39(_0x415a42);}else{return _0x1a08f1(_0x535038);}});});}function checkTranscribeJob(_0x11b5d2,_0x2d8ae3,_0x3ea6c1){var _0x154915;return new BPromise(function(_0xeeed92,_0x180177){logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0xa'),_0x11b5d2['id'],_0x11b5d2[_0x4b40('0xb')]));return getTranscriptionJob(_0x3ea6c1[_0x4b40('0xc')],_0x3ea6c1[_0x4b40('0xd')],_0x2d8ae3[_0x4b40('0xe')],_0x11b5d2[_0x4b40('0xb')])['then'](function(_0x25e9c2){logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0xf'),_0x11b5d2['id'],_0x11b5d2[_0x4b40('0xb')],_0x25e9c2[_0x4b40('0x10')][_0x4b40('0x11')]));if(!_0x11b5d2[_0x4b40('0x12')]){switch(_0x25e9c2[_0x4b40('0x10')][_0x4b40('0x11')]){case _0x4b40('0x13'):var _0x195888={'transcribeStatus':_0x25e9c2[_0x4b40('0x10')][_0x4b40('0x11')],'fileUri':_0x25e9c2[_0x4b40('0x10')][_0x4b40('0x14')][_0x4b40('0x15')]};logger['info'](util[_0x4b40('0x9')](_0x4b40('0x16'),_0x11b5d2['id']));return rp({'uri':_0x25e9c2['TranscriptionJob'][_0x4b40('0x14')]['TranscriptFileUri'],'json':!![]})[_0x4b40('0x17')](function(_0x44e863){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x11b5d2['id']));if(_0x44e863&&_0x44e863[_0x4b40('0x18')]&&_0x44e863[_0x4b40('0x18')][_0x4b40('0x19')]&&_0x44e863['results'][_0x4b40('0x19')][_0x4b40('0x1a')]){_0x195888[_0x4b40('0x12')]='';for(var _0x59ea47=0x0;_0x59ea47<_0x44e863[_0x4b40('0x18')][_0x4b40('0x19')]['length'];_0x59ea47++){_0x195888['fileText']+=_0x44e863[_0x4b40('0x18')][_0x4b40('0x19')][_0x59ea47][_0x4b40('0x1b')]+'';}}return _0x11b5d2[_0x4b40('0x1c')](_0x195888);})[_0x4b40('0x17')](function(){logger[_0x4b40('0x8')](util['format'](_0x4b40('0x1d'),_0x11b5d2['id']));if(!_0x11b5d2[_0x4b40('0x1e')]){throw new db[(_0x4b40('0x1f'))]['ValidationError'](_0x4b40('0x20'));}if(!_0x2d8ae3[_0x4b40('0x21')]||!_0x2d8ae3[_0x4b40('0x22')]||!_0x2d8ae3[_0x4b40('0x23')]||!_0x2d8ae3[_0x4b40('0x24')]||!_0x2d8ae3[_0x4b40('0x25')]){throw new db['Sequelize'][(_0x4b40('0x26'))](_0x4b40('0x27'));}if(!_0x195888[_0x4b40('0x12')]){throw new Error(_0x4b40('0x28'));}if(_0x2d8ae3['sentimentAccountId']===_0x3ea6c1['id']){return _0x3ea6c1;}else{return db[_0x4b40('0x29')][_0x4b40('0x2a')]({'where':{'id':_settings[_0x4b40('0x22')]}});}})[_0x4b40('0x17')](function(_0x27e4c4){if(!_0x27e4c4){throw new db[(_0x4b40('0x1f'))][(_0x4b40('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x27e4c4[_0x4b40('0xc')]||!_0x27e4c4[_0x4b40('0xd')]){throw new db[(_0x4b40('0x1f'))][(_0x4b40('0x26'))](_0x4b40('0x2b'));}_0x154915=_0x27e4c4;logger[_0x4b40('0x8')](util['format'](_0x4b40('0x2c'),_0x11b5d2['id']));return sentiment(_0x154915[_0x4b40('0xc')],_0x154915['data2'],_0x2d8ae3[_0x4b40('0x23')],_0x195888['fileText'],_0x2d8ae3[_0x4b40('0x24')]);})[_0x4b40('0x17')](function(_0x282df2){logger['info'](util['format'](_0x4b40('0x2d'),_0x11b5d2['id']));return _0x11b5d2[_0x4b40('0x1c')]({'sentiment':_0x282df2[_0x4b40('0x2e')],'sPositive':_0x282df2[_0x4b40('0x2f')][_0x4b40('0x30')],'sNegative':_0x282df2[_0x4b40('0x2f')][_0x4b40('0x31')],'sMixed':_0x282df2[_0x4b40('0x2f')]['Mixed'],'sNeutral':_0x282df2[_0x4b40('0x2f')][_0x4b40('0x32')]});})[_0x4b40('0x17')](function(){logger[_0x4b40('0x8')](util['format'](_0x4b40('0x1d'),_0x11b5d2['id']));_0xeeed92();});case _0x4b40('0x33'):return _0x11b5d2[_0x4b40('0x1c')]({'transcribeStatus':_0x4b40('0x33'),'failureReason':_0x25e9c2['TranscriptionJob'][_0x4b40('0x34')]})['then'](function(){logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0x1d'),_0x11b5d2['id']));_0xeeed92();});default:logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0x35'),_0x11b5d2['id']));break;}}else{return BPromise['resolve']()[_0x4b40('0x17')](function(){if(!_0x11b5d2[_0x4b40('0x1e')]){throw new db[(_0x4b40('0x1f'))]['ValidationError'](_0x4b40('0x20'));}if(!_0x2d8ae3[_0x4b40('0x21')]||!_0x2d8ae3[_0x4b40('0x22')]||!_0x2d8ae3['sentimentRegion']||!_0x2d8ae3['language']||!_0x2d8ae3[_0x4b40('0x25')]){throw new db['Sequelize'][(_0x4b40('0x26'))](_0x4b40('0x27'));}if(!_0x11b5d2[_0x4b40('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x2d8ae3[_0x4b40('0x22')]===_0x3ea6c1['id']){return _0x3ea6c1;}else{return db[_0x4b40('0x29')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4b40('0x17')](function(_0x39a5da){if(!_0x39a5da){throw new db[(_0x4b40('0x1f'))][(_0x4b40('0x26'))](_0x4b40('0x36'));}if(!_0x39a5da[_0x4b40('0xc')]||!_0x39a5da[_0x4b40('0xd')]){throw new db[(_0x4b40('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x154915=_0x39a5da;logger[_0x4b40('0x8')](util[_0x4b40('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x11b5d2['id']));return sentiment(_0x154915[_0x4b40('0xc')],_0x154915['data2'],_0x2d8ae3[_0x4b40('0x23')],_0x11b5d2[_0x4b40('0x12')],_0x2d8ae3[_0x4b40('0x24')]);})[_0x4b40('0x17')](function(_0x5e478b){logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0x2d'),_0x11b5d2['id']));return _0x11b5d2[_0x4b40('0x1c')]({'sentiment':_0x5e478b[_0x4b40('0x2e')],'sPositive':_0x5e478b['SentimentScore']['Positive'],'sNegative':_0x5e478b[_0x4b40('0x2f')][_0x4b40('0x31')],'sMixed':_0x5e478b['SentimentScore'][_0x4b40('0x37')],'sNeutral':_0x5e478b['SentimentScore'][_0x4b40('0x32')],'transcribeStatus':'COMPLETED'});})[_0x4b40('0x17')](function(){logger[_0x4b40('0x8')](util[_0x4b40('0x9')](_0x4b40('0x1d'),_0x11b5d2['id']));_0xeeed92();});}})[_0x4b40('0x38')](function(_0x2d4655){if(_0x2d4655){if(!_0x2d4655[_0x4b40('0x39')]||_0x2d4655[_0x4b40('0x39')]!==_0x4b40('0x3a')){logger[_0x4b40('0x3b')](util[_0x4b40('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x11b5d2['id']),util[_0x4b40('0x3c')](_0x2d4655,{'showHidden':![],'depth':null}));}}_0xeeed92();});});}function checkTranscribe(){var _0x4c4096;var _0x1b8627;var _0x3f262b;return db[_0x4b40('0x3d')][_0x4b40('0x3e')]({'where':{'transcribeStatus':_0x4b40('0x3f')}})[_0x4b40('0x17')](function(_0xd526ba){if(!_0xd526ba||!_0xd526ba[_0x4b40('0x1a')]){throw new db[(_0x4b40('0x1f'))]['ValidationError'](_0x4b40('0x40'));}_0x4c4096=_0xd526ba;return db[_0x4b40('0x41')][_0x4b40('0x2a')]({'where':{'id':0x1}});})[_0x4b40('0x17')](function(_0x1ee049){if(!_0x1ee049){throw new db[(_0x4b40('0x1f'))][(_0x4b40('0x26'))]('Settings\x20not\x20available');}_0x1b8627=_0x1ee049;if(!_0x1b8627['transcribe']||!_0x1b8627['transcribeAccountId']||!_0x1b8627['transcribeRegion']||!_0x1b8627['language']||!_0x1b8627['bucket']){throw new db[(_0x4b40('0x1f'))]['ValidationError'](_0x4b40('0x42'));}return db[_0x4b40('0x29')][_0x4b40('0x2a')]({'where':{'id':_0x1b8627[_0x4b40('0x43')]}});})[_0x4b40('0x17')](function(_0x3b70a2){if(!_0x3b70a2){throw new db[(_0x4b40('0x1f'))][(_0x4b40('0x26'))](_0x4b40('0x36'));}if(!_0x3b70a2[_0x4b40('0xc')]||!_0x3b70a2[_0x4b40('0xd')]){throw new db['Sequelize'][(_0x4b40('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x3f262b=_0x3b70a2;var _0x10d43d=[];_0x4c4096[_0x4b40('0x44')](function(_0x14ad73){_0x10d43d[_0x4b40('0x45')](checkTranscribeJob(_0x14ad73,_0x1b8627,_0x3f262b));});return BPromise[_0x4b40('0x46')](_0x10d43d);})[_0x4b40('0x38')](function(_0x1f1f0a){if(_0x1f1f0a){if(!_0x1f1f0a[_0x4b40('0x39')]||_0x1f1f0a[_0x4b40('0x39')]!=='SequelizeValidationError'){logger['error'](util[_0x4b40('0x3c')](_0x1f1f0a,{'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 db7e1c4..8d04267 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cae=['util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','contacts2','hopper2'];(function(_0x4bda9c,_0x598c10){var _0x57bd0d=function(_0x20ba18){while(--_0x20ba18){_0x4bda9c['push'](_0x4bda9c['shift']());}};_0x57bd0d(++_0x598c10);}(_0x1cae,0x66));var _0xe1ca=function(_0x259602,_0x3ffd83){_0x259602=_0x259602-0x0;var _0x145ef5=_0x1cae[_0x259602];return _0x145ef5;};'use strict';var util=require(_0xe1ca('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe1ca('0x1')]({'id':i,'firstName':_0xe1ca('0x2')+i,'lastName':_0xe1ca('0x3')+i,'phone':0xf879fb460+i,'email':_0xe1ca('0x4')+i+_0xe1ca('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe1ca('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1ca('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe1ca('0x1')]({'id':i,'firstName':_0xe1ca('0x2')+i,'lastName':_0xe1ca('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe1ca('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe1ca('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe1ca('0x6')](),'updatedAt':Date[_0xe1ca('0x6')]()});}db[_0xe1ca('0x7')][_0xe1ca('0x8')]({'where':{}})['then'](function(){return db[_0xe1ca('0x7')][_0xe1ca('0x9')](contacts);})['then'](function(){console[_0xe1ca('0xa')](_0xe1ca('0xb'),_0xe1ca('0xc'));return db[_0xe1ca('0xd')][_0xe1ca('0x8')]({'where':{}});})[_0xe1ca('0xe')](function(){return db[_0xe1ca('0xd')][_0xe1ca('0x9')](hopper);})[_0xe1ca('0xe')](function(){console[_0xe1ca('0xa')](_0xe1ca('0xb'),'hopper1');return db[_0xe1ca('0x7')][_0xe1ca('0x9')](contacts2);})[_0xe1ca('0xe')](function(){console[_0xe1ca('0xa')]('finished\x20populating',_0xe1ca('0xf'));return db[_0xe1ca('0xd')][_0xe1ca('0x9')](hopper2);})['then'](function(){console[_0xe1ca('0xa')](_0xe1ca('0xb'),_0xe1ca('0x10'));})['catch'](function(_0x3b65bf){console['log'](_0x3b65bf);}); \ No newline at end of file +var _0xfcb9=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','CmContact','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','then'];(function(_0x574f56,_0x24404f){var _0x2e8c7e=function(_0xeb0bac){while(--_0xeb0bac){_0x574f56['push'](_0x574f56['shift']());}};_0x2e8c7e(++_0x24404f);}(_0xfcb9,0x139));var _0x9fcb=function(_0x5abb81,_0x52199d){_0x5abb81=_0x5abb81-0x0;var _0x4c6f73=_0xfcb9[_0x5abb81];return _0x4c6f73;};'use strict';var util=require(_0x9fcb('0x0'));var db=require(_0x9fcb('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9fcb('0x2')]({'id':i,'firstName':_0x9fcb('0x3')+i,'lastName':_0x9fcb('0x4')+i,'phone':0xf879fb460+i,'email':_0x9fcb('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9fcb('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9fcb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9fcb('0x6')](),'updatedAt':Date[_0x9fcb('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9fcb('0x2')]({'id':i,'firstName':_0x9fcb('0x3')+i,'lastName':_0x9fcb('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9fcb('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9fcb('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9fcb('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9fcb('0x6')]()});}db['CmContact'][_0x9fcb('0x8')]({'where':{}})[_0x9fcb('0x9')](function(){return db['CmContact'][_0x9fcb('0xa')](contacts);})['then'](function(){console[_0x9fcb('0xb')](_0x9fcb('0xc'),_0x9fcb('0xd'));return db[_0x9fcb('0xe')][_0x9fcb('0x8')]({'where':{}});})[_0x9fcb('0x9')](function(){return db[_0x9fcb('0xe')][_0x9fcb('0xa')](hopper);})[_0x9fcb('0x9')](function(){console[_0x9fcb('0xb')]('finished\x20populating','hopper1');return db[_0x9fcb('0xf')][_0x9fcb('0xa')](contacts2);})[_0x9fcb('0x9')](function(){console[_0x9fcb('0xb')](_0x9fcb('0xc'),_0x9fcb('0x10'));return db[_0x9fcb('0xe')]['bulkCreate'](hopper2);})[_0x9fcb('0x9')](function(){console[_0x9fcb('0xb')]('finished\x20populating',_0x9fcb('0x11'));})[_0x9fcb('0x12')](function(_0x41a88d){console[_0x9fcb('0xb')](_0x41a88d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d936070..e8a6ef2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe290=['actpass','User','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x1d54d2,_0x2fbd7b){var _0xdd9acc=function(_0x59fa81){while(--_0x59fa81){_0x1d54d2['push'](_0x1d54d2['shift']());}};_0xdd9acc(++_0x2fbd7b);}(_0xe290,0x146));var _0x0e29=function(_0x437e8a,_0x44dfba){_0x437e8a=_0x437e8a-0x0;var _0x5e9910=_0xe290[_0x437e8a];return _0x5e9910;};'use strict';var util=require(_0x0e29('0x0'));var db=require(_0x0e29('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0e29('0x2')]({'name':util[_0x0e29('0x3')](_0x0e29('0x4'),_0x0e29('0x5'),i),'fullname':util[_0x0e29('0x3')](_0x0e29('0x4'),_0x0e29('0x5'),i),'email':util['format'](_0x0e29('0x6'),'agent',i),'role':_0x0e29('0x5'),'password':_0x0e29('0x7'),'internal':0xfa0+i,'type':_0x0e29('0x8'),'transport':['udp','ws',_0x0e29('0x9')],'disallow':[_0x0e29('0xa')],'allow':[_0x0e29('0xb')],'defaultuser':util['format'](_0x0e29('0x4'),_0x0e29('0x5'),i),'encryption':'yes','avpf':_0x0e29('0xc'),'force_avp':_0x0e29('0xc'),'icesupport':_0x0e29('0xc'),'dtlsenable':_0x0e29('0xc'),'dtlsverify':'no','dtlscertfile':_0x0e29('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x0e29('0xe'),'callerid':util[_0x0e29('0x3')]('\x22%s\x22\x20<%s>',util[_0x0e29('0x3')](_0x0e29('0x4'),_0x0e29('0x5'),i),0xfa0+i)});}db[_0x0e29('0xf')][_0x0e29('0x10')](users)[_0x0e29('0x11')](function(){console[_0x0e29('0x12')]('add\x20user');})[_0x0e29('0x13')](function(_0x51eb00){console[_0x0e29('0x12')](_0x51eb00);}); \ No newline at end of file +var _0x5a36=['../mysqldb','push','%s%s','agent','format','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','catch','log'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x5a36,0xf7));var _0x65a3=function(_0x22bb26,_0x2c30ea){_0x22bb26=_0x22bb26-0x0;var _0x354f3f=_0x5a36[_0x22bb26];return _0x354f3f;};'use strict';var util=require('util');var db=require(_0x65a3('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x65a3('0x1')]({'name':util['format'](_0x65a3('0x2'),'agent',i),'fullname':util['format'](_0x65a3('0x2'),_0x65a3('0x3'),i),'email':util[_0x65a3('0x4')]('%s%s@xcally.com',_0x65a3('0x3'),i),'role':_0x65a3('0x3'),'password':_0x65a3('0x5'),'internal':0xfa0+i,'type':_0x65a3('0x6'),'transport':[_0x65a3('0x7'),'ws',_0x65a3('0x8')],'disallow':[_0x65a3('0x9')],'allow':[_0x65a3('0xa')],'defaultuser':util[_0x65a3('0x4')]('%s%s',_0x65a3('0x3'),i),'encryption':_0x65a3('0xb'),'avpf':_0x65a3('0xb'),'force_avp':_0x65a3('0xb'),'icesupport':_0x65a3('0xb'),'dtlsenable':_0x65a3('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x65a3('0xc'),'dtlssetup':_0x65a3('0xd'),'callerid':util[_0x65a3('0x4')](_0x65a3('0xe'),util[_0x65a3('0x4')](_0x65a3('0x2'),_0x65a3('0x3'),i),0xfa0+i)});}db['User'][_0x65a3('0xf')](users)[_0x65a3('0x10')](function(){console['log']('add\x20user');})[_0x65a3('0x11')](function(_0x2691d2){console[_0x65a3('0x12')](_0x2691d2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 66e5c6c..c5df6da 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1620=['WhatsappQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','mail','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','ivr','format','handshake','find','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','userProfileId','FaxQueue'];(function(_0x2e3aaf,_0x4584e0){var _0x581ee5=function(_0x554f2d){while(--_0x554f2d){_0x2e3aaf['push'](_0x2e3aaf['shift']());}};_0x581ee5(++_0x4584e0);}(_0x1620,0x145));var _0x0162=function(_0x5f493d,_0x26c7b3){_0x5f493d=_0x5f493d-0x0;var _0x429c23=_0x1620[_0x5f493d];return _0x429c23;};'use strict';var _=require(_0x0162('0x0'));var util=require('util');var BPromise=require(_0x0162('0x1'));var db=require(_0x0162('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x0162('0x3')],'include':[{'as':_0x0162('0x4'),'model':db[_0x0162('0x5')],'attributes':['id','name',_0x0162('0x6')],'raw':!![],'where':{'role':_0x0162('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0162('0x3')],'where':{'role':_0x0162('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0162('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0162('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0162('0x3'),_0x0162('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5994dc,_0x3a7a7b,_0x2a8ec4){return db['UserProfileSection'][_0x0162('0xa')]({'where':{'name':_0x5994dc,'userProfileId':_0x3a7a7b},'raw':!![]})[_0x0162('0xb')](function(_0x5700e4){if(_0x5700e4){if(_0x5700e4[_0x0162('0xc')]){switch(_0x5994dc){case _0x0162('0xd'):case _0x0162('0xe'):case _0x0162('0xf'):case _0x0162('0x10'):case _0x0162('0x11'):case _0x0162('0x12'):case'WhatsappQueues':return db[_0x2a8ec4][_0x0162('0x13')](queryQueues);case _0x0162('0x14'):return db[_0x2a8ec4][_0x0162('0x13')](queryTelephones);case'Trunks':return db[_0x2a8ec4][_0x0162('0x13')](queryTrunks);case _0x0162('0x15'):return db[_0x2a8ec4][_0x0162('0x13')](queryCampaigns);}}else{return db[_0x0162('0x16')]['findAll']({'attributes':[_0x0162('0x17')],'where':{'sectionId':_0x5700e4['id']},'raw':!![]})[_0x0162('0xb')](function(_0x19e625){if(_0x19e625){var _0x125fa5={'where':{'id':_[_0x0162('0x18')](_0x19e625,_0x0162('0x17'))},'raw':!![]};switch(_0x2a8ec4){case'User':_0x125fa5[_0x0162('0x19')][_0x0162('0x6')]=_0x0162('0x8');break;case _0x0162('0x1a'):_0x125fa5[_0x0162('0x19')][_0x0162('0x9')]=_0x0162('0x1b');break;}return db[_0x2a8ec4][_0x0162('0x13')](_0x125fa5);}else{return[];}});}}else{return[];}})[_0x0162('0xb')](function(_0x74c528){return _0x74c528;});}function joinOrLeaveQueues(_0x10f3c9,_0x23511c,_0x4204fd,_0x5e7eab){_0x10f3c9[_0x23511c](util[_0x0162('0x1c')]('%s:queue:%s',_0x4204fd,_0x5e7eab[_0x0162('0x3')]));if(_0x5e7eab[_0x0162('0x4')]){for(var _0x503240=0x0;_0x503240<_0x5e7eab[_0x0162('0x4')]['length'];_0x503240+=0x1){_0x10f3c9[_0x23511c](util['format']('user:%s',_0x5e7eab[_0x0162('0x4')][_0x503240][_0x0162('0x3')]));}}}function joinOrLeave(_0x9e0ec4,_0x3f0b03,_0x2a9c13){var _0x38154d;if(_0x9e0ec4[_0x0162('0x1d')]['query']['id']){db[_0x0162('0x5')][_0x0162('0x1e')]({'attributes':['id',_0x0162('0x3'),'role','userProfileId'],'where':{'id':_0x9e0ec4[_0x0162('0x1d')][_0x0162('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x0162('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0162('0x21')],'as':_0x0162('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x0162('0x23')],'as':_0x0162('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0162('0x25')],'as':_0x0162('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0162('0x27')],'as':_0x0162('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x0162('0x29')],'as':_0x0162('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x0162('0xb')](function(_0x370992){if(_0x370992){_0x38154d=_0x370992;_0x9e0ec4[_0x3f0b03](util[_0x0162('0x1c')](_0x0162('0x2b'),_0x370992['name']));var _0x5153e1=[];switch(_0x370992[_0x0162('0x6')]){case'admin':_0x9e0ec4[_0x3f0b03](_0x0162('0x2c'));_0x9e0ec4[_0x3f0b03](_0x0162('0x2d'));if(queryQueues[_0x0162('0x2e')](_0x0162('0x2f'))){delete queryQueues['include'];}_0x5153e1[_0x0162('0x30')](db['VoiceQueue'][_0x0162('0x13')](queryQueues));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x31')][_0x0162('0x13')](queryQueues));_0x5153e1[_0x0162('0x30')](db['FaxQueue'][_0x0162('0x13')](queryQueues));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x32')]['findAll'](queryQueues));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x33')][_0x0162('0x13')](queryQueues));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x34')][_0x0162('0x13')](queryQueues));_0x5153e1['push'](db[_0x0162('0x35')][_0x0162('0x13')](queryQueues));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x5')][_0x0162('0x13')](queryTelephones));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x36')]['findAll'](queryTrunks));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x1a')][_0x0162('0x13')](queryCampaigns));_0x5153e1['push'](db['User']['findAll'](queryAgents));break;case _0x0162('0x37'):_0x9e0ec4[_0x3f0b03](_0x0162('0x2c'));_0x9e0ec4[_0x3f0b03]('voice:outbound');_0x5153e1[_0x0162('0x30')](getAssociatedResources(_0x0162('0xd'),_0x370992['userProfileId'],_0x0162('0x38')));_0x5153e1['push'](getAssociatedResources(_0x0162('0xe'),_0x370992[_0x0162('0x39')],_0x0162('0x31')));_0x5153e1[_0x0162('0x30')](getAssociatedResources('FaxQueues',_0x370992[_0x0162('0x39')],_0x0162('0x3a')));_0x5153e1['push'](getAssociatedResources(_0x0162('0x10'),_0x370992[_0x0162('0x39')],'SmsQueue'));_0x5153e1[_0x0162('0x30')](getAssociatedResources(_0x0162('0x11'),_0x370992[_0x0162('0x39')],_0x0162('0x33')));_0x5153e1[_0x0162('0x30')](getAssociatedResources('OpenchannelQueues',_0x370992['userProfileId'],'OpenchannelQueue'));_0x5153e1[_0x0162('0x30')](getAssociatedResources(_0x0162('0x3b'),_0x370992[_0x0162('0x39')],_0x0162('0x35')));_0x5153e1[_0x0162('0x30')](getAssociatedResources(_0x0162('0x14'),_0x370992['userProfileId'],_0x0162('0x5')));_0x5153e1['push'](getAssociatedResources(_0x0162('0x3c'),_0x370992[_0x0162('0x39')],'Trunk'));_0x5153e1[_0x0162('0x30')](getAssociatedResources('IvrCampaigns',_0x370992['userProfileId'],_0x0162('0x1a')));_0x5153e1[_0x0162('0x30')](db[_0x0162('0x5')]['findAll'](queryAgents));break;case _0x0162('0x7'):_0x9e0ec4[_0x3f0b03]('voice:inbound');_0x9e0ec4[_0x3f0b03]('voice:outbound');_0x5153e1['push'](_0x370992[_0x0162('0x3d')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1[_0x0162('0x30')](_0x370992[_0x0162('0x3e')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1[_0x0162('0x30')](_0x370992[_0x0162('0x3f')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1['push'](_0x370992[_0x0162('0x40')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1[_0x0162('0x30')](_0x370992[_0x0162('0x41')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1['push'](_0x370992[_0x0162('0x42')]({'attributes':['id',_0x0162('0x3')]}));_0x5153e1[_0x0162('0x30')](_0x370992[_0x0162('0x43')]({'attributes':['id',_0x0162('0x3')]}));break;}return BPromise[_0x0162('0x44')](_0x5153e1);}})['then'](function(_0x187995){if(_0x187995&&_0x187995[_0x0162('0x45')]){for(var _0x232d11=0x0;_0x232d11<_0x187995[_0x0162('0x45')];_0x232d11+=0x1){for(var _0x1ffeda=0x0;_0x1ffeda<_0x187995[_0x232d11]['length'];_0x1ffeda+=0x1){switch(_0x232d11){case 0x0:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,'voice',_0x187995[_0x232d11][_0x1ffeda]);break;case 0x1:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,_0x0162('0x46'),_0x187995[_0x232d11][_0x1ffeda]);break;case 0x2:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,'fax',_0x187995[_0x232d11][_0x1ffeda]);break;case 0x3:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,'sms',_0x187995[_0x232d11][_0x1ffeda]);break;case 0x4:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,_0x0162('0x47'),_0x187995[_0x232d11][_0x1ffeda]);break;case 0x5:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,'openchannel',_0x187995[_0x232d11][_0x1ffeda]);break;case 0x6:joinOrLeaveQueues(_0x9e0ec4,_0x3f0b03,_0x0162('0x48'),_0x187995[_0x232d11][_0x1ffeda]);break;case 0x7:_0x9e0ec4[_0x3f0b03](util[_0x0162('0x1c')]('telephone:%s',_0x187995[_0x232d11][_0x1ffeda]['name']));break;case 0x8:_0x9e0ec4[_0x3f0b03](util[_0x0162('0x1c')]('trunk:%s',_0x187995[_0x232d11][_0x1ffeda][_0x0162('0x3')]));break;case 0x9:_0x9e0ec4[_0x3f0b03](util['format'](_0x0162('0x49'),_0x187995[_0x232d11][_0x1ffeda][_0x0162('0x9')],_0x187995[_0x232d11][_0x1ffeda][_0x0162('0x3')]));break;case 0xa:_0x9e0ec4[_0x3f0b03](util['format'](_0x0162('0x2b'),_0x187995[_0x232d11][_0x1ffeda][_0x0162('0x3')]));break;}}}}})[_0x0162('0xb')](function(){if(_0x3f0b03===_0x0162('0x4a')){var _0x3b9918=_[_0x0162('0x18')](_0x38154d[_0x0162('0x20')],'id');return _0x38154d[_0x0162('0x4b')](_0x3b9918)[_0x0162('0xb')](function(){for(var _0x1b239d=0x0;_0x1b239d<_0x3b9918[_0x0162('0x45')];_0x1b239d+=0x1){_0x2a9c13[_0x0162('0x4c')](_0x0162('0x4d'),{'ChatInteractionId':Number(_0x3b9918[_0x1b239d]),'UserId':Number(_0x38154d['id'])});}});}})[_0x0162('0xb')](function(){if(_0x3f0b03===_0x0162('0x4a')){var _0x1ecf41=_['map'](_0x38154d[_0x0162('0x22')],'id');return _0x38154d[_0x0162('0x4e')](_0x1ecf41)[_0x0162('0xb')](function(){for(var _0x2b684a=0x0;_0x2b684a<_0x1ecf41['length'];_0x2b684a+=0x1){_0x2a9c13[_0x0162('0x4c')](_0x0162('0x4f'),{'MailInteractionId':Number(_0x1ecf41[_0x2b684a]),'UserId':Number(_0x38154d['id'])});}});}})[_0x0162('0xb')](function(){if(_0x3f0b03===_0x0162('0x4a')){var _0x469b18=_[_0x0162('0x18')](_0x38154d[_0x0162('0x24')],'id');return _0x38154d[_0x0162('0x50')](_0x469b18)[_0x0162('0xb')](function(){for(var _0x3dbc73=0x0;_0x3dbc73<_0x469b18[_0x0162('0x45')];_0x3dbc73+=0x1){_0x2a9c13[_0x0162('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x469b18[_0x3dbc73]),'UserId':Number(_0x38154d['id'])});}});}})['then'](function(){if(_0x3f0b03===_0x0162('0x4a')){var _0x50d7f2=_[_0x0162('0x18')](_0x38154d[_0x0162('0x26')],'id');return _0x38154d['removeSmsInteractions'](_0x50d7f2)[_0x0162('0xb')](function(){for(var _0x1fc7f5=0x0;_0x1fc7f5<_0x50d7f2[_0x0162('0x45')];_0x1fc7f5+=0x1){_0x2a9c13[_0x0162('0x4c')](_0x0162('0x51'),{'SmsInteractionId':Number(_0x50d7f2[_0x1fc7f5]),'UserId':Number(_0x38154d['id'])});}});}})[_0x0162('0xb')](function(){if(_0x3f0b03==='leave'){var _0x187ff4=_['map'](_0x38154d[_0x0162('0x28')],'id');return _0x38154d[_0x0162('0x52')](_0x187ff4)['then'](function(){for(var _0x1c9548=0x0;_0x1c9548<_0x187ff4['length'];_0x1c9548+=0x1){_0x2a9c13[_0x0162('0x4c')](_0x0162('0x53'),{'OpenchannelInteractionId':Number(_0x187ff4[_0x1c9548]),'UserId':Number(_0x38154d['id'])});}});}})['then'](function(){if(_0x3f0b03===_0x0162('0x4a')){var _0x427fea=_['map'](_0x38154d[_0x0162('0x2a')],'id');return _0x38154d['removeWhatsappInteractions'](_0x427fea)[_0x0162('0xb')](function(){for(var _0x586988=0x0;_0x586988<_0x427fea[_0x0162('0x45')];_0x586988+=0x1){_0x2a9c13[_0x0162('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x427fea[_0x586988]),'UserId':Number(_0x38154d['id'])});}});}})[_0x0162('0x54')](function(_0x561563){_0x9e0ec4[_0x0162('0x55')](_0x561563);});}}function onDisconnect(_0x189321,_0x5a2bf){joinOrLeave(_0x189321,_0x0162('0x4a'),_0x5a2bf);}function onConnect(_0x1cc111){joinOrLeave(_0x1cc111,_0x0162('0x56'));}exports['default']=function(_0x3296f7){_0x3296f7['on'](_0x0162('0x57'),function(_0x4df87){_0x4df87[_0x0162('0x58')](0x0);_0x4df87[_0x0162('0x59')]=_0x4df87[_0x0162('0x5a')][_0x0162('0x57')][_0x0162('0x5b')]+':'+_0x4df87[_0x0162('0x5a')][_0x0162('0x57')]['remotePort'];_0x4df87[_0x0162('0x5c')]=new Date();_0x4df87[_0x0162('0x55')]=function(_0x38ebd2){console[_0x0162('0x55')](_0x0162('0x5d')+_0x4df87[_0x0162('0x5e')]['name']+'['+_0x4df87[_0x0162('0x59')]+']',_0x38ebd2);};_0x4df87['on']('disconnect',function(){onDisconnect(_0x4df87,_0x3296f7);_0x4df87['log'](_0x0162('0x5f'));});onConnect(_0x4df87);_0x4df87['log']('CONNECTED');});}; \ No newline at end of file +var _0x1f89=['MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','user','userProfileId','MailQueues','OpenchannelQueue','WhatsappQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','ChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','role','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','Campaign','format','length','user:%s','query','User','find','handshake'];(function(_0x515b02,_0x3d2e8b){var _0x1a639c=function(_0x35bb47){while(--_0x35bb47){_0x515b02['push'](_0x515b02['shift']());}};_0x1a639c(++_0x3d2e8b);}(_0x1f89,0x1d7));var _0x91f8=function(_0x11cf69,_0xa95edf){_0x11cf69=_0x11cf69-0x0;var _0x2ffcd4=_0x1f89[_0x11cf69];return _0x2ffcd4;};'use strict';var _=require(_0x91f8('0x0'));var util=require(_0x91f8('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x91f8('0x2'));var queryQueues={'attributes':['id',_0x91f8('0x3')],'include':[{'as':_0x91f8('0x4'),'model':db['User'],'attributes':['id',_0x91f8('0x3'),_0x91f8('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x91f8('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x91f8('0x3')],'where':{'role':_0x91f8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x91f8('0x8')],'where':{'type':_0x91f8('0x9')}};function getAssociatedResources(_0x1b0347,_0x1771ae,_0x25ef97){return db[_0x91f8('0xa')][_0x91f8('0xb')]({'where':{'name':_0x1b0347,'userProfileId':_0x1771ae},'raw':!![]})['then'](function(_0x23cc68){if(_0x23cc68){if(_0x23cc68[_0x91f8('0xc')]){switch(_0x1b0347){case _0x91f8('0xd'):case _0x91f8('0xe'):case _0x91f8('0xf'):case _0x91f8('0x10'):case'MailQueues':case _0x91f8('0x11'):case'WhatsappQueues':return db[_0x25ef97][_0x91f8('0x12')](queryQueues);case _0x91f8('0x13'):return db[_0x25ef97]['findAll'](queryTelephones);case _0x91f8('0x14'):return db[_0x25ef97][_0x91f8('0x12')](queryTrunks);case _0x91f8('0x15'):return db[_0x25ef97][_0x91f8('0x12')](queryCampaigns);}}else{return db[_0x91f8('0x16')][_0x91f8('0x12')]({'attributes':[_0x91f8('0x17')],'where':{'sectionId':_0x23cc68['id']},'raw':!![]})[_0x91f8('0x18')](function(_0x5385d7){if(_0x5385d7){var _0x4d60e9={'where':{'id':_[_0x91f8('0x19')](_0x5385d7,_0x91f8('0x17'))},'raw':!![]};switch(_0x25ef97){case'User':_0x4d60e9['where']['role']=_0x91f8('0x6');break;case _0x91f8('0x1a'):_0x4d60e9['where'][_0x91f8('0x8')]='ivr';break;}return db[_0x25ef97][_0x91f8('0x12')](_0x4d60e9);}else{return[];}});}}else{return[];}})[_0x91f8('0x18')](function(_0x4340fe){return _0x4340fe;});}function joinOrLeaveQueues(_0x47f97b,_0x5738f0,_0x1b07ff,_0x5634be){_0x47f97b[_0x5738f0](util[_0x91f8('0x1b')]('%s:queue:%s',_0x1b07ff,_0x5634be[_0x91f8('0x3')]));if(_0x5634be[_0x91f8('0x4')]){for(var _0x593fe3=0x0;_0x593fe3<_0x5634be[_0x91f8('0x4')][_0x91f8('0x1c')];_0x593fe3+=0x1){_0x47f97b[_0x5738f0](util[_0x91f8('0x1b')](_0x91f8('0x1d'),_0x5634be[_0x91f8('0x4')][_0x593fe3][_0x91f8('0x3')]));}}}function joinOrLeave(_0x5eb5a6,_0x5dbcad,_0x21377a){var _0x32e14b;if(_0x5eb5a6['handshake'][_0x91f8('0x1e')]['id']){db[_0x91f8('0x1f')][_0x91f8('0x20')]({'attributes':['id','name',_0x91f8('0x5'),'userProfileId'],'where':{'id':_0x5eb5a6[_0x91f8('0x21')][_0x91f8('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x91f8('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x91f8('0x23')],'as':_0x91f8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x91f8('0x25')],'as':_0x91f8('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x91f8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x91f8('0x28')],'as':_0x91f8('0x29'),'attributes':['id'],'raw':!![]}]})[_0x91f8('0x18')](function(_0x1bee8d){if(_0x1bee8d){_0x32e14b=_0x1bee8d;_0x5eb5a6[_0x5dbcad](util[_0x91f8('0x1b')](_0x91f8('0x1d'),_0x1bee8d['name']));var _0x317e36=[];switch(_0x1bee8d[_0x91f8('0x5')]){case _0x91f8('0x2a'):_0x5eb5a6[_0x5dbcad](_0x91f8('0x2b'));_0x5eb5a6[_0x5dbcad](_0x91f8('0x2c'));if(queryQueues[_0x91f8('0x2d')](_0x91f8('0x2e'))){delete queryQueues[_0x91f8('0x2e')];}_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x30')][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x31')][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x32')][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x33')][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x34')][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db['OpenchannelQueue'][_0x91f8('0x12')](queryQueues));_0x317e36[_0x91f8('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x317e36['push'](db['User']['findAll'](queryTelephones));_0x317e36[_0x91f8('0x2f')](db['Trunk'][_0x91f8('0x12')](queryTrunks));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x1a')]['findAll'](queryCampaigns));_0x317e36[_0x91f8('0x2f')](db['User']['findAll'](queryAgents));break;case _0x91f8('0x35'):_0x5eb5a6[_0x5dbcad](_0x91f8('0x2b'));_0x5eb5a6[_0x5dbcad](_0x91f8('0x2c'));_0x317e36['push'](getAssociatedResources(_0x91f8('0xd'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x30')));_0x317e36[_0x91f8('0x2f')](getAssociatedResources(_0x91f8('0xe'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x31')));_0x317e36['push'](getAssociatedResources(_0x91f8('0xf'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x32')));_0x317e36[_0x91f8('0x2f')](getAssociatedResources(_0x91f8('0x10'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x33')));_0x317e36['push'](getAssociatedResources(_0x91f8('0x37'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x34')));_0x317e36['push'](getAssociatedResources(_0x91f8('0x11'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x38')));_0x317e36[_0x91f8('0x2f')](getAssociatedResources(_0x91f8('0x39'),_0x1bee8d['userProfileId'],'WhatsappQueue'));_0x317e36[_0x91f8('0x2f')](getAssociatedResources(_0x91f8('0x13'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x1f')));_0x317e36[_0x91f8('0x2f')](getAssociatedResources(_0x91f8('0x14'),_0x1bee8d[_0x91f8('0x36')],_0x91f8('0x3a')));_0x317e36['push'](getAssociatedResources(_0x91f8('0x15'),_0x1bee8d['userProfileId'],_0x91f8('0x1a')));_0x317e36[_0x91f8('0x2f')](db[_0x91f8('0x1f')][_0x91f8('0x12')](queryAgents));break;case _0x91f8('0x7'):_0x5eb5a6[_0x5dbcad](_0x91f8('0x2b'));_0x5eb5a6[_0x5dbcad](_0x91f8('0x2c'));_0x317e36[_0x91f8('0x2f')](_0x1bee8d[_0x91f8('0x3b')]({'attributes':['id',_0x91f8('0x3')]}));_0x317e36[_0x91f8('0x2f')](_0x1bee8d[_0x91f8('0x3c')]({'attributes':['id',_0x91f8('0x3')]}));_0x317e36['push'](_0x1bee8d[_0x91f8('0x3d')]({'attributes':['id',_0x91f8('0x3')]}));_0x317e36['push'](_0x1bee8d[_0x91f8('0x3e')]({'attributes':['id',_0x91f8('0x3')]}));_0x317e36['push'](_0x1bee8d['getMailQueues']({'attributes':['id',_0x91f8('0x3')]}));_0x317e36[_0x91f8('0x2f')](_0x1bee8d['getOpenchannelQueues']({'attributes':['id','name']}));_0x317e36[_0x91f8('0x2f')](_0x1bee8d[_0x91f8('0x3f')]({'attributes':['id',_0x91f8('0x3')]}));break;}return BPromise[_0x91f8('0x40')](_0x317e36);}})[_0x91f8('0x18')](function(_0x1a4715){if(_0x1a4715&&_0x1a4715[_0x91f8('0x1c')]){for(var _0x50b8ad=0x0;_0x50b8ad<_0x1a4715[_0x91f8('0x1c')];_0x50b8ad+=0x1){for(var _0x4afae1=0x0;_0x4afae1<_0x1a4715[_0x50b8ad][_0x91f8('0x1c')];_0x4afae1+=0x1){switch(_0x50b8ad){case 0x0:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,'voice',_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x1:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,'chat',_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x2:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,_0x91f8('0x41'),_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x3:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,_0x91f8('0x42'),_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x4:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,_0x91f8('0x43'),_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x5:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,_0x91f8('0x44'),_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x6:joinOrLeaveQueues(_0x5eb5a6,_0x5dbcad,_0x91f8('0x45'),_0x1a4715[_0x50b8ad][_0x4afae1]);break;case 0x7:_0x5eb5a6[_0x5dbcad](util[_0x91f8('0x1b')]('telephone:%s',_0x1a4715[_0x50b8ad][_0x4afae1][_0x91f8('0x3')]));break;case 0x8:_0x5eb5a6[_0x5dbcad](util[_0x91f8('0x1b')](_0x91f8('0x46'),_0x1a4715[_0x50b8ad][_0x4afae1][_0x91f8('0x3')]));break;case 0x9:_0x5eb5a6[_0x5dbcad](util[_0x91f8('0x1b')](_0x91f8('0x47'),_0x1a4715[_0x50b8ad][_0x4afae1]['type'],_0x1a4715[_0x50b8ad][_0x4afae1]['name']));break;case 0xa:_0x5eb5a6[_0x5dbcad](util['format']('user:%s',_0x1a4715[_0x50b8ad][_0x4afae1][_0x91f8('0x3')]));break;}}}}})[_0x91f8('0x18')](function(){if(_0x5dbcad==='leave'){var _0x5380d4=_[_0x91f8('0x19')](_0x32e14b[_0x91f8('0x48')],'id');return _0x32e14b['removeChatInteractions'](_0x5380d4)['then'](function(){for(var _0x139fa8=0x0;_0x139fa8<_0x5380d4[_0x91f8('0x1c')];_0x139fa8+=0x1){_0x21377a[_0x91f8('0x49')](_0x91f8('0x4a'),{'ChatInteractionId':Number(_0x5380d4[_0x139fa8]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x18')](function(){if(_0x5dbcad===_0x91f8('0x4b')){var _0x1a8b54=_[_0x91f8('0x19')](_0x32e14b[_0x91f8('0x4c')],'id');return _0x32e14b[_0x91f8('0x4d')](_0x1a8b54)[_0x91f8('0x18')](function(){for(var _0x554db1=0x0;_0x554db1<_0x1a8b54[_0x91f8('0x1c')];_0x554db1+=0x1){_0x21377a[_0x91f8('0x49')](_0x91f8('0x4e'),{'MailInteractionId':Number(_0x1a8b54[_0x554db1]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x18')](function(){if(_0x5dbcad===_0x91f8('0x4b')){var _0x384f2f=_['map'](_0x32e14b[_0x91f8('0x24')],'id');return _0x32e14b['removeFaxInteractions'](_0x384f2f)[_0x91f8('0x18')](function(){for(var _0x34e495=0x0;_0x34e495<_0x384f2f[_0x91f8('0x1c')];_0x34e495+=0x1){_0x21377a['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x384f2f[_0x34e495]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x18')](function(){if(_0x5dbcad===_0x91f8('0x4b')){var _0x48ef9a=_[_0x91f8('0x19')](_0x32e14b['SmsInteractions'],'id');return _0x32e14b[_0x91f8('0x4f')](_0x48ef9a)['then'](function(){for(var _0x268f7f=0x0;_0x268f7f<_0x48ef9a[_0x91f8('0x1c')];_0x268f7f+=0x1){_0x21377a[_0x91f8('0x49')](_0x91f8('0x50'),{'SmsInteractionId':Number(_0x48ef9a[_0x268f7f]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x18')](function(){if(_0x5dbcad==='leave'){var _0xc62f36=_[_0x91f8('0x19')](_0x32e14b[_0x91f8('0x27')],'id');return _0x32e14b[_0x91f8('0x51')](_0xc62f36)['then'](function(){for(var _0x3c5ce1=0x0;_0x3c5ce1<_0xc62f36[_0x91f8('0x1c')];_0x3c5ce1+=0x1){_0x21377a[_0x91f8('0x49')](_0x91f8('0x52'),{'OpenchannelInteractionId':Number(_0xc62f36[_0x3c5ce1]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x18')](function(){if(_0x5dbcad===_0x91f8('0x4b')){var _0x1b4e6f=_[_0x91f8('0x19')](_0x32e14b[_0x91f8('0x29')],'id');return _0x32e14b[_0x91f8('0x53')](_0x1b4e6f)[_0x91f8('0x18')](function(){for(var _0x51ab7b=0x0;_0x51ab7b<_0x1b4e6f[_0x91f8('0x1c')];_0x51ab7b+=0x1){_0x21377a[_0x91f8('0x49')](_0x91f8('0x54'),{'WhatsappInteractionId':Number(_0x1b4e6f[_0x51ab7b]),'UserId':Number(_0x32e14b['id'])});}});}})[_0x91f8('0x55')](function(_0x46f4fc){_0x5eb5a6[_0x91f8('0x56')](_0x46f4fc);});}}function onDisconnect(_0xec2a47,_0x23a9a2){joinOrLeave(_0xec2a47,'leave',_0x23a9a2);}function onConnect(_0x5c79cc){joinOrLeave(_0x5c79cc,_0x91f8('0x57'));}exports[_0x91f8('0x58')]=function(_0x575878){_0x575878['on']('connection',function(_0x2713d4){_0x2713d4[_0x91f8('0x59')](0x0);_0x2713d4[_0x91f8('0x5a')]=_0x2713d4[_0x91f8('0x5b')][_0x91f8('0x5c')][_0x91f8('0x5d')]+':'+_0x2713d4[_0x91f8('0x5b')][_0x91f8('0x5c')][_0x91f8('0x5e')];_0x2713d4[_0x91f8('0x5f')]=new Date();_0x2713d4[_0x91f8('0x56')]=function(_0x3c973c){console[_0x91f8('0x56')](_0x91f8('0x60')+_0x2713d4[_0x91f8('0x61')][_0x91f8('0x3')]+'['+_0x2713d4[_0x91f8('0x5a')]+']',_0x3c973c);};_0x2713d4['on'](_0x91f8('0x62'),function(){onDisconnect(_0x2713d4,_0x575878);_0x2713d4['log'](_0x91f8('0x63'));});onConnect(_0x2713d4);_0x2713d4[_0x91f8('0x56')](_0x91f8('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 80f2dd6..ae4141e 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 _0x3754=['callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','http','ChatInteraction','afterCreate','Chat','afterUpdate','ChatMessage','newmessage','Sms','newinteraction','SmsInteraction','closedinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','User','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','closed','default','length','hasOwnProperty','model','hook'];(function(_0x1d9c84,_0x172781){var _0x301c1f=function(_0x1f06a8){while(--_0x1f06a8){_0x1d9c84['push'](_0x1d9c84['shift']());}};_0x301c1f(++_0x172781);}(_0x3754,0x72));var _0x4375=function(_0x2577a9,_0x5a8b84){_0x2577a9=_0x2577a9-0x0;var _0x2f86ef=_0x3754[_0x2577a9];return _0x2f86ef;};'use strict';var util=require(_0x4375('0x0'));var db=require(_0x4375('0x1'))['db'];var jayson=require(_0x4375('0x2'));var logger=require(_0x4375('0x3'))('triggers');var client=jayson['client'][_0x4375('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x4375('0x5'),'event':_0x4375('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4375('0x7'),'model':_0x4375('0x5'),'event':_0x4375('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4375('0x7'),'model':_0x4375('0x9'),'event':_0x4375('0x6'),'condition':_0x4375('0xa'),'callback':afterCreateMessage},{'channel':_0x4375('0xb'),'model':'SmsInteraction','event':_0x4375('0x6'),'condition':_0x4375('0xc'),'callback':afterCreate},{'channel':_0x4375('0xb'),'model':_0x4375('0xd'),'event':_0x4375('0x8'),'condition':_0x4375('0xe'),'callback':afterUpdate},{'channel':_0x4375('0xb'),'model':'SmsMessage','event':_0x4375('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4375('0xf'),'model':_0x4375('0x10'),'event':_0x4375('0x6'),'condition':_0x4375('0xc'),'callback':afterCreate},{'channel':_0x4375('0xf'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x4375('0xe'),'callback':afterUpdate},{'channel':_0x4375('0xf'),'model':_0x4375('0x11'),'event':_0x4375('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4375('0x12'),'model':_0x4375('0x13'),'event':_0x4375('0x6'),'condition':_0x4375('0xc'),'callback':afterCreate},{'channel':_0x4375('0x12'),'model':_0x4375('0x13'),'event':_0x4375('0x8'),'condition':_0x4375('0xe'),'callback':afterUpdate},{'channel':_0x4375('0x12'),'model':_0x4375('0x14'),'event':'afterCreate','condition':_0x4375('0xa'),'callback':afterCreateMessage},{'channel':_0x4375('0x15'),'model':_0x4375('0x16'),'event':'afterCreate','condition':_0x4375('0xc'),'callback':afterCreate},{'channel':_0x4375('0x15'),'model':'MailInteraction','event':_0x4375('0x8'),'condition':_0x4375('0xe'),'callback':afterUpdate},{'channel':_0x4375('0x15'),'model':_0x4375('0x17'),'event':_0x4375('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4375('0x18'),'model':_0x4375('0x19'),'event':_0x4375('0x6'),'condition':_0x4375('0xc'),'callback':afterCreate},{'channel':_0x4375('0x18'),'model':_0x4375('0x19'),'event':'afterUpdate','condition':_0x4375('0xe'),'callback':afterUpdate},{'channel':_0x4375('0x18'),'model':'OpenchannelMessage','event':_0x4375('0x6'),'condition':_0x4375('0xa'),'callback':afterCreateMessage}];function request(_0x1a21cb){return client[_0x4375('0x1a')](_0x4375('0x1b'),_0x1a21cb)[_0x4375('0x1c')](function(_0x470602){logger[_0x4375('0x1d')](_0x4375('0x1e'),'EventManager',_0x470602);if(_0x470602[_0x4375('0x1f')]){if(_0x470602[_0x4375('0x1f')][_0x4375('0x20')]===0x1f4){logger[_0x4375('0x1f')](_0x4375('0x1e'),_0x4375('0x1b'),_0x470602[_0x4375('0x1f')]);}}})[_0x4375('0x21')](function(_0x1d5547){logger[_0x4375('0x1f')](_0x4375('0x1e'),_0x4375('0x1b'),_0x1d5547);});}function afterCreateMessage(_0x4589d8,_0x5f10a3){return function(_0x5e7772,_0x5cbaef){_0x5e7772=_0x5e7772[_0x4375('0x22')]({'plain':!![]});_0x5e7772[_0x4375('0x23')]=_0x4589d8;_0x5e7772[_0x4375('0x24')]=_0x5e7772[_0x4375('0x25')];if(_0x5e7772[_0x4375('0x26')]){return db[_0x4375('0x27')][_0x4375('0x28')]({'where':{'id':_0x5e7772['UserId']},'attributes':['id',_0x4375('0x29')],'raw':!![]})[_0x4375('0x1c')](function(_0x56e36d){_0x5e7772[_0x4375('0x2a')]=util[_0x4375('0x2b')](_0x4375('0x2c'),_0x56e36d[_0x4375('0x29')]);_0x5e7772['channel']=_0x4589d8;return request({'event':_0x4375('0x2d'),'message':_0x5e7772});})[_0x4375('0x21')](function(_0x334cfc){console['error'](_0x334cfc);});}else{return request({'event':_0x4375('0x2e'),'message':_0x5e7772});}};}function afterCreate(_0x2b5796,_0x468170){return function(_0x1901c2,_0x195646){_0x1901c2=_0x1901c2[_0x4375('0x22')]({'plain':!![]});_0x1901c2[_0x4375('0x23')]=_0x2b5796;_0x1901c2[_0x4375('0x24')]=_0x4375('0x2f');return request({'event':_0x468170,'message':_0x1901c2});};}function afterUpdate(_0x2396cc,_0x3422f5){return function(_0x4dd498,_0x1d5530){if(_0x4dd498['changed'](_0x4375('0x30'))&&_0x4dd498[_0x4375('0x30')]){_0x4dd498=_0x4dd498['get']({'plain':!![]});_0x4dd498[_0x4375('0x23')]=_0x2396cc;_0x4dd498[_0x4375('0x24')]=_0x4375('0x30');if(_0x4dd498[_0x4375('0x26')]){return db['User'][_0x4375('0x28')]({'where':{'id':_0x4dd498[_0x4375('0x26')]},'attributes':['id',_0x4375('0x29')],'raw':!![]})[_0x4375('0x1c')](function(_0x1867f2){_0x4dd498[_0x4375('0x2a')]=util['format'](_0x4375('0x2c'),_0x1867f2[_0x4375('0x29')]);return request({'event':_0x3422f5,'message':_0x4dd498});})[_0x4375('0x21')](function(_0x492c80){console['error'](_0x492c80);});}else{return request({'event':_0x3422f5,'message':_0x4dd498});}}};}exports[_0x4375('0x31')]=function(){for(var _0x30f678=0x0;_0x30f678=_0x235653[_0x14b3('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3e9209(_0x552933);})[_0x14b3('0x16')](function(_0x3ed109){_0x1eb40f(_0x3ed109);});});}; \ No newline at end of file +var _0xf246=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense','role','agent','User','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xf246,0x1aa));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f24('0x0'));var BPromise=require(_0x6f24('0x1'));var db=require(_0x6f24('0x2'))['db'];var util=require(_0x6f24('0x3'));var channels=[_0x6f24('0x4'),_0x6f24('0x5'),_0x6f24('0x6'),_0x6f24('0x7'),_0x6f24('0x8'),_0x6f24('0x9'),_0x6f24('0xa')];exports[_0x6f24('0xb')]=function(){return channels;};exports[_0x6f24('0xc')]=function(_0x104eb6){_0x104eb6=_0x104eb6[_0x6f24('0xd')]();return _[_0x6f24('0xe')](channels,_0x104eb6);};exports[_0x6f24('0xf')]=function(_0x521003,_0x49975b,_0x4e9d32,_0x3b5cd0){var _0x314bf2={'loginAttempts':_0x49975b,'blocked':_0x4e9d32};if(!_['isUndefined'](_0x3b5cd0)){_0x314bf2['blockedAt']=_0x3b5cd0;}return _0x521003[_0x6f24('0x10')](_0x314bf2);};exports[_0x6f24('0x11')]=function(_0x3ae478){return new BPromise(function(_0x5b0a04,_0x1755a6){var _0x19dd2f=0x0;if(_0x3ae478[_0x6f24('0x12')]!==_0x6f24('0x13')){_0x5b0a04(_0x3ae478);}db[_0x6f24('0x14')]['count']({'where':{'role':_0x6f24('0x13'),'online':!![],'id':{'$ne':_0x3ae478['id']}}})['then'](function(_0x489063){_0x19dd2f=_0x489063;return util[_0x6f24('0x11')]();})[_0x6f24('0x15')](function(_0x5acd7a){if(_0x5acd7a&&_0x5acd7a[_0x6f24('0x16')]&&_0x19dd2f>=_0x5acd7a[_0x6f24('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5b0a04(_0x3ae478);})[_0x6f24('0x17')](function(_0x262f04){_0x1755a6(_0x262f04);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c671c2d..9a10755 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x156e=['404','status','send','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x156e,0x1f3));var _0xe156=function(_0x50000b,_0x201785){_0x50000b=_0x50000b-0x0;var _0x47124b=_0x156e[_0x50000b];return _0x47124b;};'use strict';module[_0xe156('0x0')][0x194]=function pageNotFound(_0x20e78c,_0x595d46){var _0x4949c6=_0xe156('0x1');var _0x54dfc7=0x194;var _0x4f5c9a={'status':_0x54dfc7};_0x595d46['status'](_0x4f5c9a[_0xe156('0x2')]);_0x595d46['render'](_0x4949c6,{},function(_0x334332,_0x487825){if(_0x334332){return _0x595d46[_0xe156('0x2')](_0x4f5c9a[_0xe156('0x2')])['json'](_0x4f5c9a);}_0x595d46[_0xe156('0x3')](_0x487825);});}; \ No newline at end of file +var _0x3fff=['json','exports','404','status','render'];(function(_0x121b3a,_0x20f954){var _0x3ee540=function(_0xe83b7c){while(--_0xe83b7c){_0x121b3a['push'](_0x121b3a['shift']());}};_0x3ee540(++_0x20f954);}(_0x3fff,0x173));var _0xf3ff=function(_0x2393c0,_0x5d5d61){_0x2393c0=_0x2393c0-0x0;var _0x188aa9=_0x3fff[_0x2393c0];return _0x188aa9;};'use strict';module[_0xf3ff('0x0')][0x194]=function pageNotFound(_0x192feb,_0x1f5b9e){var _0x4294b1=_0xf3ff('0x1');var _0x4206a9=0x194;var _0x3b8c6e={'status':_0x4206a9};_0x1f5b9e[_0xf3ff('0x2')](_0x3b8c6e[_0xf3ff('0x2')]);_0x1f5b9e[_0xf3ff('0x3')](_0x4294b1,{},function(_0x396640,_0x4b09d2){if(_0x396640){return _0x1f5b9e[_0xf3ff('0x2')](_0x3b8c6e[_0xf3ff('0x2')])[_0xf3ff('0x4')](_0x3b8c6e);}_0x1f5b9e['send'](_0x4b09d2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 49ceb53..eddf21c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b6d=['../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappApplication','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','Notifications','SenderId','belongsTo','userProfileId','Groups','CmContact','Contacts','belongsToMany','Lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteraction','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','CmList','cm_user_has_lists','user_has_voice_prefixes','user_has_chat_websites','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Interval','IntervalId','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','ListId','mandatoryDispositionPause','mandatoryDispositionPauseId','user_has_mail_accounts','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','restrict','TagId','List','Items','FaxAccountId','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatInteraction','ChatMessage','ChatApplication','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','chat_group_has_users','CmCompany','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyCondition','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','AccountId','Subjects','DescriptionId','Subject','SubjectId','Description','Field','SugarcrmAccount','Configurations','Descriptions','FieldId','VariableId','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesField','ToId','SessionId','JscriptyProject','ProjectId','user_has_teams','team_has_voice_queues','VoiceQueues','team_has_chat_queues','OpenchannelQueues','team_has_whatsapp_queues','TrunkId','TrunkBackup','TrunkBackupId','SquareProjectId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappAccount','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x23516c,_0x16ea34){var _0x591310=function(_0x428292){while(--_0x428292){_0x23516c['push'](_0x23516c['shift']());}};_0x591310(++_0x16ea34);}(_0x9b6d,0x105));var _0xd9b6=function(_0x5c186d,_0x26fc85){_0x5c186d=_0x5c186d-0x0;var _0x397853=_0x9b6d[_0x5c186d];return _0x397853;};'use strict';var path=require('path');var config=require(_0xd9b6('0x0'));var Sequelize=require(_0xd9b6('0x1'));var _=require(_0xd9b6('0x2'));var jstz=require(_0xd9b6('0x3'));var timezone=jstz[_0xd9b6('0x4')]();config[_0xd9b6('0x1')]=_[_0xd9b6('0x5')](config[_0xd9b6('0x1')],{'database':_0xd9b6('0x6'),'username':_0xd9b6('0x7'),'password':_0xd9b6('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd9b6('0x9'),'dialectOptions':{'charset':_0xd9b6('0xa')},'logging':![],'timezone':timezone[_0xd9b6('0xb')](),'define':{'charset':_0xd9b6('0xc'),'collate':'utf8_general_ci'}}});config[_0xd9b6('0xd')]=_['defaultsDeep'](config[_0xd9b6('0xd')],{'database':_0xd9b6('0x6'),'username':_0xd9b6('0x7'),'password':_0xd9b6('0x8'),'options':{'host':_0xd9b6('0xe'),'port':0xcea,'dialect':_0xd9b6('0x9'),'dialectOptions':{'charset':_0xd9b6('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd9b6('0xc'),'collate':_0xd9b6('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xd9b6('0x10')],config[_0xd9b6('0x1')][_0xd9b6('0x11')],config[_0xd9b6('0x1')][_0xd9b6('0x12')],config[_0xd9b6('0x1')][_0xd9b6('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xd9b6('0x10')],config['sequelizeHistory'][_0xd9b6('0x11')],config[_0xd9b6('0xd')][_0xd9b6('0x12')],config[_0xd9b6('0xd')][_0xd9b6('0x13')])};db['User']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x15'));db[_0xd9b6('0x16')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x17'));db[_0xd9b6('0x18')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x19'));db[_0xd9b6('0x1a')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x1b'));db['VoiceMusicOnHold']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x1c'));db[_0xd9b6('0x1d')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0xd9b6('0x1e')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x1f'));db[_0xd9b6('0x20')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x21'));db[_0xd9b6('0x22')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x23'));db[_0xd9b6('0x24')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x25'));db['VoiceCallReport']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x26'));db['VoiceDialReport']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x27'));db['VoiceAgentReport']=db[_0xd9b6('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xd9b6('0x28')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x29'));db[_0xd9b6('0x2a')]=db['sequelize']['import'](_0xd9b6('0x2b'));db[_0xd9b6('0x2c')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/trunk/trunk.model');db[_0xd9b6('0x2d')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xd9b6('0x2e')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x2f'));db[_0xd9b6('0x30')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd9b6('0x31')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x32'));db[_0xd9b6('0x33')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x34'));db['UserFaxQueue']=db['sequelize'][_0xd9b6('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xd9b6('0x35')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xd9b6('0x36')]=db[_0xd9b6('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xd9b6('0x37')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x38'));db[_0xd9b6('0x39')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x3a'));db[_0xd9b6('0x3b')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0xd9b6('0x3c')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x3d'));db[_0xd9b6('0x3e')]=db['sequelize']['import'](_0xd9b6('0x3f'));db[_0xd9b6('0x40')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x41'));db[_0xd9b6('0x42')]=db['sequelize'][_0xd9b6('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0xd9b6('0x43')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x44'));db[_0xd9b6('0x45')]=db['sequelize'][_0xd9b6('0x14')]('../api/mailApplication/mailApplication.model');db[_0xd9b6('0x46')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x47'));db[_0xd9b6('0x48')]=db[_0xd9b6('0x1')]['import']('../api/dashboard/dashboard.model');db[_0xd9b6('0x49')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x4a'));db[_0xd9b6('0x4b')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/faxAccount/faxAccount.model');db[_0xd9b6('0x4c')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x4d'));db['FaxInteraction']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x4e'));db[_0xd9b6('0x4f')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x50'));db[_0xd9b6('0x51')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x52'));db['FaxQueueReport']=db['sequelize']['import'](_0xd9b6('0x53'));db[_0xd9b6('0x54')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/smsAccount/smsAccount.model');db[_0xd9b6('0x55')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x56'));db[_0xd9b6('0x57')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x58'));db[_0xd9b6('0x59')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0xd9b6('0x5a')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x5b'));db[_0xd9b6('0x5c')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x5d'));db[_0xd9b6('0x5e')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x5f'));db[_0xd9b6('0x60')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x61'));db[_0xd9b6('0x62')]=db['sequelize']['import'](_0xd9b6('0x63'));db[_0xd9b6('0x64')]=db['sequelize'][_0xd9b6('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0xd9b6('0x65')]=db['sequelize']['import'](_0xd9b6('0x66'));db[_0xd9b6('0x67')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x68'));db['ChatApplication']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x69'));db['ChatInteraction']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x6a'));db['ChatMessage']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x6b'));db[_0xd9b6('0x6c')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x6d'));db[_0xd9b6('0x6e')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/chatQueue/chatQueue.model');db[_0xd9b6('0x6f')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/chatGroup/chatGroup.model');db[_0xd9b6('0x70')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x71'));db['CmCompany']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x72'));db['CmContact']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x73'));db[_0xd9b6('0x74')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x75'));db[_0xd9b6('0x76')]=db['sequelize'][_0xd9b6('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xd9b6('0x77')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x78'));db[_0xd9b6('0x79')]=db['sequelize'][_0xd9b6('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xd9b6('0x7a')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x7b'));db[_0xd9b6('0x7c')]=db['sequelize']['import'](_0xd9b6('0x7d'));db[_0xd9b6('0x7e')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x7f'));db[_0xd9b6('0x80')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x81'));db[_0xd9b6('0x82')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0xd9b6('0x83')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x84'));db[_0xd9b6('0x85')]=db[_0xd9b6('0x1')]['import']('../api/condition/condition.model');db['Interval']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x86'));db[_0xd9b6('0x87')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x88'));db[_0xd9b6('0x89')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x8a'));db['VoiceQueuesLog']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x8b'));db[_0xd9b6('0x8c')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x8d'));db[_0xd9b6('0x8e')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x8f'));db[_0xd9b6('0x90')]=db['sequelize'][_0xd9b6('0x14')]('../api/tag/tag.model');db[_0xd9b6('0x91')]=db[_0xd9b6('0x1')]['import']('../api/template/template.model');db[_0xd9b6('0x92')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/trigger/trigger.model');db[_0xd9b6('0x93')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x94'));db['Integration']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x95'));db[_0xd9b6('0x96')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x97'));db[_0xd9b6('0x98')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x99'));db[_0xd9b6('0x9a')]=db['sequelize']['import'](_0xd9b6('0x9b'));db['AnalyticExtractedReport']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x9c'));db[_0xd9b6('0x9d')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0x9e'));db[_0xd9b6('0x9f')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xd9b6('0xa0')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xa1'));db['SalesforceAccount']=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xa2'));db[_0xd9b6('0xa3')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xa4'));db['SugarcrmAccount']=db[_0xd9b6('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xd9b6('0xa5')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xa6'));db[_0xd9b6('0xa7')]=db['sequelize'][_0xd9b6('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xd9b6('0xa8')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xa9'));db[_0xd9b6('0xaa')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xab'));db[_0xd9b6('0xac')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xad'));db[_0xd9b6('0xae')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xaf'));db[_0xd9b6('0xb0')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xb1'));db[_0xd9b6('0xb2')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xb3'));db[_0xd9b6('0xb4')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xb5'));db[_0xd9b6('0xb6')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xb7'));db['ZendeskField']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xb8'));db[_0xd9b6('0xb9')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xba'));db[_0xd9b6('0xbb')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xbc'));db[_0xd9b6('0xbd')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xbe'));db[_0xd9b6('0xbf')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xc0'));db[_0xd9b6('0xc1')]=db['sequelize'][_0xd9b6('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xd9b6('0xc2')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xc3'));db[_0xd9b6('0xc4')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xd9b6('0xc5')]=db[_0xd9b6('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xd9b6('0xc6')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xc7'));db[_0xd9b6('0xc8')]=db[_0xd9b6('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xd9b6('0xc9')]=db['sequelize']['import'](_0xd9b6('0xca'));db[_0xd9b6('0xcb')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xcc'));db[_0xd9b6('0xcd')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xce'));db[_0xd9b6('0xcf')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xd0'));db['FreshsalesField']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xd1'));db[_0xd9b6('0xd2')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xd3'));db[_0xd9b6('0xd4')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xd9b6('0xd5')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xd6'));db[_0xd9b6('0xd7')]=db['sequelize']['import'](_0xd9b6('0xd8'));db[_0xd9b6('0xd9')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xda'));db['JscriptySessionReport']=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd9b6('0xdb')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xdc'));db[_0xd9b6('0xdd')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xde'));db[_0xd9b6('0xdf')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xe0'));db['JscriptyProject']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xe1'));db[_0xd9b6('0xe2')]=db['sequelize']['import']('../api/setting/setting.model');db[_0xd9b6('0xe3')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xe4'));db[_0xd9b6('0xe5')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xe6'));db['SquareRecording']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xe7'));db[_0xd9b6('0xe8')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xe9'));db[_0xd9b6('0xea')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xeb'));db['License']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0xec'));db[_0xd9b6('0xed')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xee'));db[_0xd9b6('0xef')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xf0'));db[_0xd9b6('0xf1')]=db['sequelize']['import'](_0xd9b6('0xf2'));db['Plugin']=db['sequelize']['import']('../api/plugin/plugin.model');db[_0xd9b6('0xf3')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xf4'));db[_0xd9b6('0xf5')]=db['sequelize'][_0xd9b6('0x14')](_0xd9b6('0xf6'));db[_0xd9b6('0xf7')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xf8'));db[_0xd9b6('0xf9')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xfa'));db[_0xd9b6('0xfb')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xfc'));db['CmList']=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0xfd'));db[_0xd9b6('0xfe')]=db['sequelize']['import'](_0xd9b6('0xff'));db[_0xd9b6('0x100')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x101'));db[_0xd9b6('0x102')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x103'));db[_0xd9b6('0x104')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x105'));db[_0xd9b6('0x106')]=db['sequelize'][_0xd9b6('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xd9b6('0x107')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xd9b6('0x108')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x109'));db[_0xd9b6('0x10a')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x10b'));db['WhatsappTransferReport']=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x10c'));db[_0xd9b6('0x10d')]=db[_0xd9b6('0x1')]['import'](_0xd9b6('0x10e'));db[_0xd9b6('0x10f')]=db[_0xd9b6('0x1')][_0xd9b6('0x14')](_0xd9b6('0x110'));db[_0xd9b6('0x111')][_0xd9b6('0x112')](db[_0xd9b6('0x22')],{'as':_0xd9b6('0x22'),'onDelete':'cascade','foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x1e')],{'as':_0xd9b6('0x115'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x2e')],{'as':_0xd9b6('0x116'),'foreignKey':'UserId'});db[_0xd9b6('0x111')]['hasMany'](db[_0xd9b6('0x1a')],{'as':_0xd9b6('0x117'),'onDelete':_0xd9b6('0x118'),'hooks':!![]});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x77')],{'as':_0xd9b6('0x119'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x79')],{'as':_0xd9b6('0x11a'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x7a')],{'as':_0xd9b6('0x7a'),'foreignKey':_0xd9b6('0x113')});db['User']['hasMany'](db[_0xd9b6('0x60')],{'as':'OpenchannelInteractions','foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db['ChatInteraction'],{'as':_0xd9b6('0x11b'),'foreignKey':_0xd9b6('0x113')});db['User']['hasMany'](db[_0xd9b6('0x57')],{'as':_0xd9b6('0x11c'),'foreignKey':_0xd9b6('0x113')});db['User']['hasMany'](db[_0xd9b6('0x11d')],{'as':_0xd9b6('0x11e'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xd9b6('0x42')],{'as':_0xd9b6('0x11f'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x111')][_0xd9b6('0x114')](db[_0xd9b6('0x106')],{'as':_0xd9b6('0x120'),'foreignKey':_0xd9b6('0x121')});db['User'][_0xd9b6('0x122')](db[_0xd9b6('0x100')],{'as':'UserProfile','foreignKey':_0xd9b6('0x123')});db['User']['belongsToMany'](db[_0xd9b6('0x6f')],{'as':_0xd9b6('0x124'),'through':'chat_group_has_users'});db[_0xd9b6('0x111')]['belongsToMany'](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x126'),'through':'cm_user_has_contacts'});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db['CmList'],{'as':_0xd9b6('0x128'),'through':'cm_user_has_lists'});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0xea')],{'through':'user_has_teams'});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x42')],{'as':'MailInteractions','through':_0xd9b6('0x129')});db['User'][_0xd9b6('0x127')](db['ChatInteraction'],{'as':_0xd9b6('0x11b'),'through':_0xd9b6('0x12a')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x11d')],{'as':_0xd9b6('0x11e'),'through':_0xd9b6('0x12b')});db['User']['belongsToMany'](db[_0xd9b6('0x57')],{'as':_0xd9b6('0x11c'),'through':_0xd9b6('0x12c')});db[_0xd9b6('0x111')]['belongsToMany'](db[_0xd9b6('0x60')],{'as':_0xd9b6('0x12d'),'through':_0xd9b6('0x12e')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x12f')],{'as':_0xd9b6('0x130'),'through':_0xd9b6('0x131')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x1d')],{'as':'VoiceQueues','through':_0xd9b6('0x30'),'required':![]});db['User']['belongsToMany'](db[_0xd9b6('0x3e')],{'as':_0xd9b6('0x132'),'through':_0xd9b6('0x33'),'required':![]});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x6e')],{'as':_0xd9b6('0x133'),'through':_0xd9b6('0x31'),'required':![],'hooks':!![]});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x51')],{'as':_0xd9b6('0x134'),'through':'UserFaxQueue','required':![]});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x5a')],{'as':_0xd9b6('0x135'),'through':_0xd9b6('0x35'),'required':![]});db['User'][_0xd9b6('0x127')](db[_0xd9b6('0x64')],{'as':'OpenchannelQueues','through':_0xd9b6('0x36'),'required':![]});db[_0xd9b6('0x111')]['belongsToMany'](db[_0xd9b6('0x10d')],{'as':_0xd9b6('0x136'),'through':_0xd9b6('0x37'),'required':![]});db['User'][_0xd9b6('0x127')](db[_0xd9b6('0x137')],{'through':_0xd9b6('0x138')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0xd9b6('0x139'),'required':![]});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x65')],{'as':'ChatWebsites','through':_0xd9b6('0x13a')});db[_0xd9b6('0x111')]['belongsToMany'](db[_0xd9b6('0x4b')],{'as':'FaxAccounts','through':_0xd9b6('0x13b')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0x3c')],{'as':_0xd9b6('0x13c'),'through':'user_has_mail_accounts'});db['User'][_0xd9b6('0x127')](db[_0xd9b6('0x5c')],{'as':_0xd9b6('0x13d'),'through':_0xd9b6('0x13e')});db[_0xd9b6('0x111')]['belongsToMany'](db[_0xd9b6('0x54')],{'as':_0xd9b6('0x13f'),'through':'user_has_sms_accounts'});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db['WhatsappAccount'],{'as':_0xd9b6('0x140'),'through':_0xd9b6('0x141')});db[_0xd9b6('0x111')][_0xd9b6('0x127')](db[_0xd9b6('0xe5')],{'as':_0xd9b6('0x142'),'through':_0xd9b6('0x143')});db[_0xd9b6('0x16')]['hasMany'](db[_0xd9b6('0x1a')],{'as':'SpiedAgents','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x144')});db['VoiceContext'][_0xd9b6('0x114')](db[_0xd9b6('0x1a')],{'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x1a')][_0xd9b6('0x114')](db['VoiceExtension'],{'as':_0xd9b6('0x145'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x146')][_0xd9b6('0x127')](db['Sound'],{'as':_0xd9b6('0x147'),'through':_0xd9b6('0x148')});db[_0xd9b6('0x1d')][_0xd9b6('0x114')](db[_0xd9b6('0x2e')],{'as':_0xd9b6('0x149'),'foreignKey':_0xd9b6('0x14a')});db[_0xd9b6('0x1d')][_0xd9b6('0x114')](db['CmHopper'],{'as':_0xd9b6('0x14b'),'foreignKey':_0xd9b6('0x14a')});db[_0xd9b6('0x1d')][_0xd9b6('0x114')](db[_0xd9b6('0x77')],{'as':'HopperFinals','foreignKey':_0xd9b6('0x14a')});db[_0xd9b6('0x1d')][_0xd9b6('0x114')](db[_0xd9b6('0x79')],{'as':_0xd9b6('0x14c'),'foreignKey':_0xd9b6('0x14a')});db['VoiceQueue'][_0xd9b6('0x114')](db['ReportAgentPreview'],{'as':_0xd9b6('0x7a'),'foreignKey':_0xd9b6('0x14a')});db['VoiceQueue'][_0xd9b6('0x114')](db[_0xd9b6('0x76')],{'as':_0xd9b6('0x14d'),'foreignKey':_0xd9b6('0x14a')});db[_0xd9b6('0x1d')][_0xd9b6('0x114')](db[_0xd9b6('0x14e')],{'as':_0xd9b6('0x14f'),'foreignKey':_0xd9b6('0x14a')});db[_0xd9b6('0x1d')]['belongsTo'](db[_0xd9b6('0x2c')],{'as':_0xd9b6('0x2c'),'foreignKey':'TrunkId'});db[_0xd9b6('0x1d')][_0xd9b6('0x122')](db[_0xd9b6('0x2c')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xd9b6('0x1d')][_0xd9b6('0x122')](db[_0xd9b6('0x150')],{'as':_0xd9b6('0x150'),'foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x1d')][_0xd9b6('0x122')](db[_0xd9b6('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd9b6('0x1d')][_0xd9b6('0x127')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x128'),'through':'voice_queues_has_cm_lists'});db[_0xd9b6('0x1d')]['belongsToMany'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x30')});db[_0xd9b6('0x1d')][_0xd9b6('0x127')](db[_0xd9b6('0xea')],{'as':_0xd9b6('0x153'),'through':'team_has_voice_queues'});db[_0xd9b6('0x1d')][_0xd9b6('0x127')](db['CmList'],{'as':_0xd9b6('0x154'),'through':'voice_queues_has_cm_blacklists'});db[_0xd9b6('0x1e')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x111'),'foreignKey':_0xd9b6('0x113')});db['ScreenRecording'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x111'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x22')]['hasMany'](db[_0xd9b6('0x24')],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x156'),'sourceKey':_0xd9b6('0x157')});db[_0xd9b6('0x24')][_0xd9b6('0x122')](db[_0xd9b6('0x22')],{'foreignKey':'mailboxuser','targetKey':_0xd9b6('0x157')});db[_0xd9b6('0x158')][_0xd9b6('0x114')](db['VoiceQueueReport'],{'as':_0xd9b6('0x159'),'foreignKey':'uniqueid','constraints':![]});db[_0xd9b6('0x158')][_0xd9b6('0x114')](db[_0xd9b6('0x15a')],{'as':_0xd9b6('0x15b'),'foreignKey':'uniqueid','constraints':![]});db[_0xd9b6('0x158')]['belongsTo'](db['User'],{'as':_0xd9b6('0x111'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x158')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x39')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'as':'MailAccount','foreignKey':_0xd9b6('0x15e')});db[_0xd9b6('0x3b')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'as':'MailAccount','foreignKey':_0xd9b6('0x15e')});db[_0xd9b6('0x3c')][_0xd9b6('0x112')](db['MailServerIn'],{'as':_0xd9b6('0x15f'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x3c')][_0xd9b6('0x112')](db[_0xd9b6('0x3b')],{'as':_0xd9b6('0x160'),'onDelete':'cascade'});db[_0xd9b6('0x3c')]['hasMany'](db['Disposition'],{'as':_0xd9b6('0x161'),'foreignKey':'MailAccountId'});db[_0xd9b6('0x3c')][_0xd9b6('0x114')](db[_0xd9b6('0x82')],{'as':_0xd9b6('0x162'),'foreignKey':'MailAccountId'});db[_0xd9b6('0x3c')]['hasMany'](db[_0xd9b6('0x43')],{'as':_0xd9b6('0x155'),'foreignKey':_0xd9b6('0x15e')});db[_0xd9b6('0x3c')][_0xd9b6('0x114')](db[_0xd9b6('0x42')],{'as':_0xd9b6('0x163')});db[_0xd9b6('0x3c')]['hasMany'](db[_0xd9b6('0x45')],{'as':_0xd9b6('0x145')});db[_0xd9b6('0x3c')]['belongsTo'](db[_0xd9b6('0x137')],{'as':'List','foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x3c')][_0xd9b6('0x122')](db[_0xd9b6('0x91')],{'as':'Template','foreignKey':'TemplateId'});db[_0xd9b6('0x3c')][_0xd9b6('0x122')](db['Pause'],{'as':_0xd9b6('0x165'),'foreignKey':_0xd9b6('0x166')});db[_0xd9b6('0x3c')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':'Agents','through':_0xd9b6('0x167')});db['MailQueue']['belongsToMany'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x33')});db[_0xd9b6('0x3e')][_0xd9b6('0x127')](db['Team'],{'through':'team_has_mail_queues','as':_0xd9b6('0x153')});db[_0xd9b6('0x42')][_0xd9b6('0x114')](db['MailMessage'],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x168')});db[_0xd9b6('0x42')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x15e')});db[_0xd9b6('0x42')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x42')][_0xd9b6('0x122')](db['User'],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x16a'),'as':_0xd9b6('0x16b')});db['MailInteraction'][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x16a'),'as':_0xd9b6('0x16c')});db[_0xd9b6('0x42')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x16d'),'through':_0xd9b6('0x129'),'foreignKey':'MailInteractionId'});db[_0xd9b6('0x43')][_0xd9b6('0x114')](db[_0xd9b6('0xf1')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':'User'});db[_0xd9b6('0x43')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c')});db[_0xd9b6('0x43')][_0xd9b6('0x122')](db[_0xd9b6('0x42')],{'as':_0xd9b6('0x16e'),'foreignKey':_0xd9b6('0x168')});db[_0xd9b6('0x43')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x15e')});db[_0xd9b6('0x45')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x45')][_0xd9b6('0x122')](db[_0xd9b6('0x3e')],{'onDelete':_0xd9b6('0x16f')});db['MailApplication'][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x45')][_0xd9b6('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x45')][_0xd9b6('0x122')](db[_0xd9b6('0x90')],{'onDelete':'restrict','foreignKey':_0xd9b6('0x170')});db[_0xd9b6('0x46')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{});db[_0xd9b6('0x46')]['belongsTo'](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x46')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x46')][_0xd9b6('0x122')](db['MailInteraction'],{});db[_0xd9b6('0x46')]['belongsTo'](db[_0xd9b6('0x43')],{});db[_0xd9b6('0x46')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{});db[_0xd9b6('0x46')][_0xd9b6('0x122')](db['MailQueue'],{});db[_0xd9b6('0x48')][_0xd9b6('0x114')](db[_0xd9b6('0x49')],{'as':_0xd9b6('0x172'),'onDelete':'cascade'});db['FaxAccount'][_0xd9b6('0x114')](db[_0xd9b6('0x83')],{'as':_0xd9b6('0x161'),'foreignKey':_0xd9b6('0x173')});db[_0xd9b6('0x4b')][_0xd9b6('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xd9b6('0x173')});db[_0xd9b6('0x4b')][_0xd9b6('0x114')](db[_0xd9b6('0x11d')],{'as':_0xd9b6('0x163')});db[_0xd9b6('0x4b')][_0xd9b6('0x114')](db[_0xd9b6('0x4c')],{'as':_0xd9b6('0x145')});db['FaxAccount']['hasMany'](db[_0xd9b6('0x1a')],{'as':_0xd9b6('0x174'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x4b')]['hasMany'](db[_0xd9b6('0x4f')],{'as':'Messages'});db[_0xd9b6('0x4b')][_0xd9b6('0x122')](db[_0xd9b6('0x2c')],{'as':_0xd9b6('0x2c')});db[_0xd9b6('0x4b')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db['FaxAccount']['belongsTo'](db[_0xd9b6('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0xd9b6('0x166')});db[_0xd9b6('0x4b')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x13b')});db[_0xd9b6('0x4c')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':'restrict'});db[_0xd9b6('0x4c')][_0xd9b6('0x122')](db['FaxQueue'],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x4c')]['belongsTo'](db[_0xd9b6('0x4b')],{'onDelete':'restrict'});db[_0xd9b6('0x4c')][_0xd9b6('0x122')](db['Tag'],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x170')});db['FaxInteraction'][_0xd9b6('0x114')](db[_0xd9b6('0x4f')],{'as':'Messages','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x175')});db['FaxInteraction'][_0xd9b6('0x122')](db[_0xd9b6('0x4b')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x173')});db[_0xd9b6('0x11d')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':'ContactId'});db[_0xd9b6('0x11d')]['belongsTo'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x176'),'foreignKey':'UserId'});db[_0xd9b6('0x11d')][_0xd9b6('0x127')](db['Tag'],{'through':_0xd9b6('0x177'),'as':'Tags'});db[_0xd9b6('0x11d')]['belongsToMany'](db[_0xd9b6('0x90')],{'through':'fax_interaction_has_tags','as':_0xd9b6('0x16c')});db[_0xd9b6('0x11d')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':'Users','through':_0xd9b6('0x12b'),'foreignKey':'FaxInteractionId'});db[_0xd9b6('0x4f')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':'cascade','as':_0xd9b6('0x111')});db[_0xd9b6('0x4f')][_0xd9b6('0x122')](db[_0xd9b6('0x11d')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xd9b6('0x4f')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c')});db[_0xd9b6('0x4f')][_0xd9b6('0x122')](db[_0xd9b6('0xf1')],{'as':_0xd9b6('0xf1'),'foreignKey':_0xd9b6('0x178')});db[_0xd9b6('0x4f')]['belongsTo'](db[_0xd9b6('0x4b')],{'as':'Account','foreignKey':_0xd9b6('0x173')});db['FaxQueue'][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x179')});db[_0xd9b6('0x51')][_0xd9b6('0x127')](db[_0xd9b6('0xea')],{'through':_0xd9b6('0x17a'),'as':_0xd9b6('0x153')});db[_0xd9b6('0x17b')][_0xd9b6('0x122')](db[_0xd9b6('0x4b')],{});db[_0xd9b6('0x17b')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db['FaxQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':'Contact','foreignKey':_0xd9b6('0x15d')});db['FaxQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x11d')],{});db['FaxQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x4f')],{});db[_0xd9b6('0x17b')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{});db[_0xd9b6('0x17b')][_0xd9b6('0x122')](db[_0xd9b6('0x51')],{});db[_0xd9b6('0x54')]['hasMany'](db['Disposition'],{'as':_0xd9b6('0x161'),'foreignKey':_0xd9b6('0x17c')});db[_0xd9b6('0x54')][_0xd9b6('0x114')](db[_0xd9b6('0x82')],{'as':_0xd9b6('0x162'),'foreignKey':_0xd9b6('0x17c')});db[_0xd9b6('0x54')][_0xd9b6('0x114')](db[_0xd9b6('0x59')],{'as':_0xd9b6('0x155'),'foreignKey':_0xd9b6('0x17c')});db[_0xd9b6('0x54')]['hasMany'](db[_0xd9b6('0x57')],{'as':_0xd9b6('0x163')});db[_0xd9b6('0x54')][_0xd9b6('0x114')](db[_0xd9b6('0x55')],{'as':_0xd9b6('0x145')});db[_0xd9b6('0x54')]['belongsTo'](db[_0xd9b6('0x137')],{'as':'List','foreignKey':_0xd9b6('0x164')});db['SmsAccount'][_0xd9b6('0x122')](db[_0xd9b6('0x87')],{'as':_0xd9b6('0x165'),'foreignKey':_0xd9b6('0x166')});db['SmsAccount'][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x17d')});db[_0xd9b6('0x55')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x55')]['belongsTo'](db[_0xd9b6('0x5a')],{'onDelete':'restrict'});db['SmsApplication'][_0xd9b6('0x122')](db[_0xd9b6('0x54')],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x55')][_0xd9b6('0x122')](db[_0xd9b6('0x150')],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x55')]['belongsTo'](db['Tag'],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x170')});db[_0xd9b6('0x57')][_0xd9b6('0x114')](db['SmsMessage'],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x17e')});db[_0xd9b6('0x57')][_0xd9b6('0x122')](db['SmsAccount'],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x17c')});db[_0xd9b6('0x57')]['belongsTo'](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x57')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x57')][_0xd9b6('0x127')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xd9b6('0x16b')});db['SmsInteraction'][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x17f'),'as':_0xd9b6('0x16c')});db[_0xd9b6('0x57')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':'Users','through':_0xd9b6('0x12c'),'foreignKey':_0xd9b6('0x17e')});db[_0xd9b6('0x59')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':'User'});db[_0xd9b6('0x59')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c')});db[_0xd9b6('0x59')]['belongsTo'](db[_0xd9b6('0x57')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x16e'),'foreignKey':_0xd9b6('0x17e')});db['SmsMessage'][_0xd9b6('0x122')](db['SmsAccount'],{'as':'Account','foreignKey':_0xd9b6('0x17c')});db[_0xd9b6('0x5a')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':'UserSmsQueue','foreignKey':_0xd9b6('0x180')});db[_0xd9b6('0x5a')]['belongsToMany'](db['Team'],{'through':_0xd9b6('0x181'),'as':_0xd9b6('0x153')});db[_0xd9b6('0x5c')][_0xd9b6('0x114')](db[_0xd9b6('0x83')],{'as':_0xd9b6('0x161'),'foreignKey':_0xd9b6('0x182')});db[_0xd9b6('0x5c')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xd9b6('0x5c')][_0xd9b6('0x114')](db[_0xd9b6('0x60')],{'as':_0xd9b6('0x163'),'foreignKey':_0xd9b6('0x182')});db['OpenchannelAccount'][_0xd9b6('0x114')](db[_0xd9b6('0x62')],{'as':'Messages','foreignKey':_0xd9b6('0x182')});db[_0xd9b6('0x5c')][_0xd9b6('0x114')](db[_0xd9b6('0x5e')],{'as':_0xd9b6('0x145'),'foreignKey':_0xd9b6('0x182')});db[_0xd9b6('0x5c')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x5c')][_0xd9b6('0x122')](db[_0xd9b6('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0xd9b6('0x166')});db[_0xd9b6('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xd9b6('0x13e')});db['OpenchannelApplication'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x183')});db['OpenchannelApplication'][_0xd9b6('0x122')](db[_0xd9b6('0x5c')],{'onDelete':'restrict','foreignKey':_0xd9b6('0x182')});db[_0xd9b6('0x5e')][_0xd9b6('0x122')](db['Interval'],{'onDelete':_0xd9b6('0x16f'),'foreignKey':'IntervalId'});db[_0xd9b6('0x5e')][_0xd9b6('0x122')](db['Tag'],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x170')});db['OpenchannelInteraction'][_0xd9b6('0x114')](db[_0xd9b6('0x62')],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x184')});db[_0xd9b6('0x60')][_0xd9b6('0x122')](db[_0xd9b6('0x5c')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x182')});db[_0xd9b6('0x60')][_0xd9b6('0x122')](db['CmContact'],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x60')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':'Owner','foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x60')]['belongsToMany'](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x185'),'as':_0xd9b6('0x16b')});db[_0xd9b6('0x60')][_0xd9b6('0x127')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xd9b6('0x16c')});db[_0xd9b6('0x60')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x16d'),'through':'user_has_openchannel_interactions','foreignKey':_0xd9b6('0x184')});db['OpenchannelMessage'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x111')});db[_0xd9b6('0x62')][_0xd9b6('0x122')](db['CmContact'],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c')});db[_0xd9b6('0x62')]['belongsTo'](db[_0xd9b6('0x60')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x16e'),'foreignKey':'OpenchannelInteractionId'});db[_0xd9b6('0x62')][_0xd9b6('0x122')](db[_0xd9b6('0xf1')],{'as':'Attachment','foreignKey':_0xd9b6('0x178')});db[_0xd9b6('0x62')][_0xd9b6('0x122')](db[_0xd9b6('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xd9b6('0x64')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x36'),'foreignKey':_0xd9b6('0x183')});db['OpenchannelQueue'][_0xd9b6('0x127')](db['Team'],{'through':_0xd9b6('0x186'),'as':'Teams'});db['ChatWebsite'][_0xd9b6('0x114')](db[_0xd9b6('0x83')],{'as':_0xd9b6('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xd9b6('0x114')](db[_0xd9b6('0x82')],{'as':_0xd9b6('0x162'),'foreignKey':_0xd9b6('0x187')});db['ChatWebsite'][_0xd9b6('0x114')](db[_0xd9b6('0x70')],{'as':_0xd9b6('0x188')});db[_0xd9b6('0x65')][_0xd9b6('0x114')](db[_0xd9b6('0x189')],{'as':_0xd9b6('0x163')});db[_0xd9b6('0x65')][_0xd9b6('0x114')](db['ChatApplication'],{'as':_0xd9b6('0x145')});db[_0xd9b6('0x65')][_0xd9b6('0x114')](db[_0xd9b6('0x18a')],{'as':_0xd9b6('0x155')});db[_0xd9b6('0x65')]['belongsTo'](db[_0xd9b6('0x137')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0xd9b6('0x122')](db[_0xd9b6('0x150')],{'as':_0xd9b6('0x150'),'foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x65')][_0xd9b6('0x122')](db[_0xd9b6('0x87')],{'as':_0xd9b6('0x165'),'foreignKey':_0xd9b6('0x166')});db[_0xd9b6('0x65')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x13a')});db[_0xd9b6('0x67')]['belongsTo'](db[_0xd9b6('0x5c')],{});db[_0xd9b6('0x67')][_0xd9b6('0x122')](db['CmList'],{'as':'List','foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x67')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x67')][_0xd9b6('0x122')](db[_0xd9b6('0x60')],{});db[_0xd9b6('0x67')][_0xd9b6('0x122')](db[_0xd9b6('0x62')],{});db[_0xd9b6('0x67')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{});db['OpenchannelQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x64')],{});db[_0xd9b6('0x18b')][_0xd9b6('0x122')](db['User'],{'as':_0xd9b6('0x18c'),'foreignKey':_0xd9b6('0x113'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x18b')][_0xd9b6('0x122')](db[_0xd9b6('0x6e')],{'as':_0xd9b6('0x18d'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{'as':_0xd9b6('0x18e'),'foreignKey':_0xd9b6('0x187'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x18b')]['belongsTo'](db[_0xd9b6('0x90')],{'onDelete':_0xd9b6('0x16f'),'foreignKey':'TagId'});db[_0xd9b6('0x189')][_0xd9b6('0x114')](db[_0xd9b6('0x18a')],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x18f')});db[_0xd9b6('0x189')][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x187')});db['ChatInteraction'][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x189')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x176'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x189')][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x190'),'as':'Tags'});db[_0xd9b6('0x189')][_0xd9b6('0x127')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xd9b6('0x189')][_0xd9b6('0x127')](db['User'],{'as':_0xd9b6('0x16d'),'through':_0xd9b6('0x12a'),'foreignKey':_0xd9b6('0x18f')});db[_0xd9b6('0x18a')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':'cascade','as':_0xd9b6('0x111')});db[_0xd9b6('0x18a')]['belongsTo'](db['CmContact'],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x18a')]['belongsTo'](db[_0xd9b6('0x189')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x16e'),'foreignKey':'ChatInteractionId'});db[_0xd9b6('0x18a')][_0xd9b6('0x122')](db[_0xd9b6('0xf1')],{'as':_0xd9b6('0xf1'),'foreignKey':_0xd9b6('0x178')});db[_0xd9b6('0x18a')][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x187')});db[_0xd9b6('0x6c')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'onDelete':_0xd9b6('0x118'),'as':'Contact','foreignKey':'ContactId'});db['ChatOfflineMessage'][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x187')});db[_0xd9b6('0x6e')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xd9b6('0x6e')][_0xd9b6('0x127')](db['Team'],{'through':'team_has_chat_queues','as':_0xd9b6('0x153')});db[_0xd9b6('0x6f')][_0xd9b6('0x114')](db[_0xd9b6('0xd5')],{'as':_0xd9b6('0x155'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x149'),'through':_0xd9b6('0x191')});db['ChatProactiveAction']['belongsTo'](db[_0xd9b6('0x65')],{'as':'Website','foreignKey':_0xd9b6('0x187')});db[_0xd9b6('0x192')]['hasMany'](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x126'),'foreignKey':_0xd9b6('0x193')});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x74')],{'as':'Hoppers','foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x77')],{'as':_0xd9b6('0x119'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x125')]['hasMany'](db[_0xd9b6('0x79')],{'as':'HopperHistories','foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x14e')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x60')],{'as':_0xd9b6('0x12d'),'foreignKey':_0xd9b6('0x15d'),'onDelete':'restrict'});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x189')],{'as':_0xd9b6('0x11b'),'foreignKey':_0xd9b6('0x15d'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x57')],{'as':_0xd9b6('0x11c'),'foreignKey':'ContactId','onDelete':_0xd9b6('0x16f')});db['CmContact'][_0xd9b6('0x114')](db[_0xd9b6('0x11d')],{'as':_0xd9b6('0x11e'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xd9b6('0x125')][_0xd9b6('0x114')](db[_0xd9b6('0x42')],{'as':_0xd9b6('0x11f'),'foreignKey':_0xd9b6('0x15d'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x125')]['belongsTo'](db['CmCompany'],{'as':_0xd9b6('0x194'),'foreignKey':'CompanyId'});db[_0xd9b6('0x125')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164'),'onDelete':_0xd9b6('0x118')});db['CmContact'][_0xd9b6('0x127')](db['User'],{'as':'Users','through':_0xd9b6('0x195')});db[_0xd9b6('0x125')][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'as':_0xd9b6('0x16b'),'through':_0xd9b6('0x196')});db[_0xd9b6('0x125')][_0xd9b6('0x127')](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xd9b6('0x74')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x74')]['belongsTo'](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x74')]['belongsTo'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x18c'),'foreignKey':_0xd9b6('0x113')});db[_0xd9b6('0x74')][_0xd9b6('0x122')](db[_0xd9b6('0x1d')],{'as':_0xd9b6('0x18d'),'foreignKey':_0xd9b6('0x14a'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x74')][_0xd9b6('0x122')](db[_0xd9b6('0xed')],{'as':_0xd9b6('0xed'),'foreignKey':_0xd9b6('0x197'),'onDelete':'cascade'});db[_0xd9b6('0x74')][_0xd9b6('0x122')](db['User'],{'as':'Owner','foreignKey':_0xd9b6('0x198')});db['CmHopperBlack'][_0xd9b6('0x122')](db['CmContact'],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d'),'onDelete':'cascade'});db[_0xd9b6('0x76')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xd9b6('0x76')][_0xd9b6('0x122')](db[_0xd9b6('0x1d')],{'as':_0xd9b6('0x18d'),'foreignKey':_0xd9b6('0x14a'),'onDelete':'cascade'});db['CmHopperBlack'][_0xd9b6('0x122')](db[_0xd9b6('0xed')],{'as':_0xd9b6('0xed'),'foreignKey':'CampaignId','onDelete':_0xd9b6('0x118')});db[_0xd9b6('0x80')]['hasMany'](db[_0xd9b6('0x85')],{'as':{'plural':'All','singular':_0xd9b6('0x199')},'foreignKey':_0xd9b6('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0xd9b6('0x80')][_0xd9b6('0x114')](db['Condition'],{'as':{'plural':'Any','singular':_0xd9b6('0x19b')},'foreignKey':_0xd9b6('0x19c'),'onDelete':_0xd9b6('0x118'),'hooks':!![]});db[_0xd9b6('0x80')][_0xd9b6('0x114')](db['Action'],{'as':_0xd9b6('0x19d'),'foreignKey':_0xd9b6('0x19e'),'onDelete':_0xd9b6('0x118'),'hooks':!![]});db[_0xd9b6('0x150')][_0xd9b6('0x114')](db[_0xd9b6('0x150')],{'as':_0xd9b6('0x19f'),'foreignKey':_0xd9b6('0x151'),'onDelete':_0xd9b6('0x118'),'hooks':!![],'required':![]});db[_0xd9b6('0x150')]['hasMany'](db[_0xd9b6('0x1a')],{'as':_0xd9b6('0x117'),'foreignKey':_0xd9b6('0x151'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x150')][_0xd9b6('0x114')](db['MailApplication'],{'as':_0xd9b6('0x1a0'),'foreignKey':'IntervalId'});db[_0xd9b6('0x150')][_0xd9b6('0x114')](db[_0xd9b6('0x18b')],{'as':_0xd9b6('0x1a1'),'foreignKey':'IntervalId'});db[_0xd9b6('0x150')]['hasMany'](db[_0xd9b6('0x4c')],{'as':'FaxApplications','foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x150')][_0xd9b6('0x114')](db[_0xd9b6('0x55')],{'as':_0xd9b6('0x1a2'),'foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x8c')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{});db[_0xd9b6('0x8c')][_0xd9b6('0x122')](db[_0xd9b6('0x9a')],{'foreignKey':_0xd9b6('0x1a3')});db['Schedule'][_0xd9b6('0x122')](db[_0xd9b6('0x98')],{'foreignKey':_0xd9b6('0x1a4')});db[_0xd9b6('0x8e')][_0xd9b6('0x127')](db['VoiceMusicOnHold'],{'as':_0xd9b6('0x1a5'),'through':_0xd9b6('0x148'),'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x90')][_0xd9b6('0x127')](db[_0xd9b6('0x125')],{'through':_0xd9b6('0x196')});db['Tag']['belongsToMany'](db[_0xd9b6('0x189')],{'through':_0xd9b6('0x190')});db[_0xd9b6('0x90')][_0xd9b6('0x127')](db[_0xd9b6('0x42')],{'through':_0xd9b6('0x16a')});db[_0xd9b6('0x90')]['belongsToMany'](db[_0xd9b6('0x57')],{'through':_0xd9b6('0x17f')});db['Tag'][_0xd9b6('0x127')](db[_0xd9b6('0x11d')],{'through':_0xd9b6('0x177')});db['Tag'][_0xd9b6('0x127')](db[_0xd9b6('0x60')],{'through':_0xd9b6('0x185')});db[_0xd9b6('0x90')][_0xd9b6('0x127')](db['WhatsappInteraction'],{'through':_0xd9b6('0x1a6')});db['Trigger']['hasMany'](db[_0xd9b6('0x85')],{'as':{'plural':_0xd9b6('0x1a7'),'singular':_0xd9b6('0x1a8')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0xd9b6('0x92')][_0xd9b6('0x114')](db[_0xd9b6('0x85')],{'as':{'plural':'AnyConditions','singular':_0xd9b6('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xd9b6('0x92')][_0xd9b6('0x114')](db[_0xd9b6('0x7e')],{'as':'Actions','foreignKey':_0xd9b6('0x1aa'),'onDelete':_0xd9b6('0x118'),'hooks':!![]});db[_0xd9b6('0x98')][_0xd9b6('0x114')](db['AnalyticFieldReport'],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1a4'),'hooks':!![]});db[_0xd9b6('0x9a')][_0xd9b6('0x114')](db['AnalyticFieldReport'],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1a3')});db[_0xd9b6('0x9d')][_0xd9b6('0x114')](db[_0xd9b6('0x9f')],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1ac')});db[_0xd9b6('0x9f')]['belongsTo'](db[_0xd9b6('0x9d')],{'foreignKey':_0xd9b6('0x1ac')});db[_0xd9b6('0x1ad')][_0xd9b6('0x114')](db[_0xd9b6('0x1ae')],{'as':'Configurations','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0x1ae')][_0xd9b6('0x114')](db[_0xd9b6('0xa3')],{'as':_0xd9b6('0x1b0'),'onDelete':_0xd9b6('0x118'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xd9b6('0x114')](db[_0xd9b6('0xa3')],{'as':'Descriptions','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0x1ae')][_0xd9b6('0x114')](db[_0xd9b6('0xa3')],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':'FieldId'});db[_0xd9b6('0x1ae')][_0xd9b6('0x122')](db[_0xd9b6('0x1ad')],{'as':'Account','foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xa3')][_0xd9b6('0x114')](db['SalesforceField'],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xa3')][_0xd9b6('0x114')](db[_0xd9b6('0xa3')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xa3')]['hasMany'](db[_0xd9b6('0xa3')],{'as':_0xd9b6('0x1b5'),'foreignKey':'FieldId'});db['SalesforceField'][_0xd9b6('0x122')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xd9b6('0x1b6')][_0xd9b6('0x114')](db[_0xd9b6('0xa5')],{'as':_0xd9b6('0x1b7'),'onDelete':_0xd9b6('0x118'),'foreignKey':'AccountId'});db[_0xd9b6('0xa5')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xa5')][_0xd9b6('0x114')](db['SugarcrmField'],{'as':_0xd9b6('0x1b8'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xa5')][_0xd9b6('0x114')](db[_0xd9b6('0xa7')],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xa5')][_0xd9b6('0x122')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xa7')][_0xd9b6('0x114')](db[_0xd9b6('0xa7')],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xa7')][_0xd9b6('0x114')](db[_0xd9b6('0xa7')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xa7')]['hasMany'](db[_0xd9b6('0xa7')],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xa7')]['belongsTo'](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':'VariableId'});db[_0xd9b6('0xa8')][_0xd9b6('0x114')](db[_0xd9b6('0xaa')],{'as':_0xd9b6('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd9b6('0xaa')][_0xd9b6('0x114')](db[_0xd9b6('0xac')],{'as':_0xd9b6('0x1b0'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b3')});db['DeskConfiguration']['hasMany'](db[_0xd9b6('0xac')],{'as':_0xd9b6('0x1b8'),'onDelete':'cascade','foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xaa')]['hasMany'](db[_0xd9b6('0xac')],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xaa')][_0xd9b6('0x122')](db[_0xd9b6('0xa8')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xaa')][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0xd9b6('0xac')][_0xd9b6('0x114')](db[_0xd9b6('0xac')],{'as':'Subject','foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xac')][_0xd9b6('0x114')](db['DeskField'],{'as':_0xd9b6('0x1b4'),'foreignKey':'DescriptionId'});db[_0xd9b6('0xac')]['hasMany'](db['DeskField'],{'as':_0xd9b6('0x1b5'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':_0xd9b6('0x1ba')});db[_0xd9b6('0xae')][_0xd9b6('0x114')](db[_0xd9b6('0xb0')],{'as':'Configurations','onDelete':_0xd9b6('0x118'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0xd9b6('0xb2')],{'as':_0xd9b6('0x1b0'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b3')});db['ZohoConfiguration'][_0xd9b6('0x114')](db[_0xd9b6('0xb2')],{'as':'Descriptions','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xb0')][_0xd9b6('0x114')](db[_0xd9b6('0xb2')],{'as':'Fields','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xb0')][_0xd9b6('0x122')](db[_0xd9b6('0xae')],{'as':'Account','foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xb2')][_0xd9b6('0x114')](db[_0xd9b6('0xb2')],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xb2')]['hasMany'](db[_0xd9b6('0xb2')],{'as':_0xd9b6('0x1b4'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0xd9b6('0xb2')],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xb2')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xd9b6('0xb4')]['hasMany'](db[_0xd9b6('0xb6')],{'as':_0xd9b6('0x1b7'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xb6')]['hasMany'](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1b0'),'foreignKey':'SubjectId'});db[_0xd9b6('0xb6')][_0xd9b6('0x114')](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1b8'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xb6')][_0xd9b6('0x114')](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1ab'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xb6')][_0xd9b6('0x122')](db['ZendeskAccount'],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xb6')][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x1bc')});db[_0xd9b6('0x1bb')][_0xd9b6('0x114')](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0x1bb')][_0xd9b6('0x114')](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0x1bb')][_0xd9b6('0x114')](db[_0xd9b6('0x1bb')],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0x1bb')][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':_0xd9b6('0x1ba')});db[_0xd9b6('0xb9')][_0xd9b6('0x114')](db[_0xd9b6('0xbb')],{'as':_0xd9b6('0x1b7'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1af')});db['FreshdeskConfiguration'][_0xd9b6('0x114')](db[_0xd9b6('0xbd')],{'as':_0xd9b6('0x1b0'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0xd9b6('0x1b8'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xbb')][_0xd9b6('0x114')](db['FreshdeskField'],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':'FieldId'});db[_0xd9b6('0xbb')][_0xd9b6('0x122')](db['FreshdeskAccount'],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xbb')][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x1bd')});db[_0xd9b6('0xbd')][_0xd9b6('0x114')](db[_0xd9b6('0xbd')],{'as':'Subject','foreignKey':_0xd9b6('0x1b3')});db['FreshdeskField'][_0xd9b6('0x114')](db[_0xd9b6('0xbd')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xbd')][_0xd9b6('0x114')](db[_0xd9b6('0xbd')],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db['FreshdeskField'][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':_0xd9b6('0x1ba')});db[_0xd9b6('0xbf')][_0xd9b6('0x114')](db[_0xd9b6('0xc1')],{'as':_0xd9b6('0x1b7'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0xc1')][_0xd9b6('0x114')](db[_0xd9b6('0xc2')],{'as':_0xd9b6('0x1b0'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xc1')][_0xd9b6('0x114')](db['VtigerField'],{'as':_0xd9b6('0x1b8'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xc1')][_0xd9b6('0x114')](db['VtigerField'],{'as':_0xd9b6('0x1ab'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xc1')][_0xd9b6('0x122')](db[_0xd9b6('0xbf')],{'as':_0xd9b6('0x169'),'foreignKey':'AccountId'});db[_0xd9b6('0xc2')][_0xd9b6('0x114')](db['VtigerField'],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xc2')][_0xd9b6('0x114')](db[_0xd9b6('0xc2')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xc2')][_0xd9b6('0x114')](db[_0xd9b6('0xc2')],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xc2')][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0xd9b6('0x114')](db[_0xd9b6('0xc5')],{'as':'Configurations','onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1af')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xd9b6('0x1b3')});db['ServicenowConfiguration'][_0xd9b6('0x114')](db[_0xd9b6('0xc6')],{'as':_0xd9b6('0x1b8'),'foreignKey':_0xd9b6('0x1b1')});db['ServicenowConfiguration'][_0xd9b6('0x114')](db[_0xd9b6('0xc6')],{'as':_0xd9b6('0x1ab'),'foreignKey':_0xd9b6('0x1b9')});db['ServicenowConfiguration'][_0xd9b6('0x122')](db[_0xd9b6('0xc4')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x1af')});db['ServicenowField'][_0xd9b6('0x114')](db[_0xd9b6('0xc6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd9b6('0xc6')][_0xd9b6('0x114')](db[_0xd9b6('0xc6')],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xc6')][_0xd9b6('0x114')](db[_0xd9b6('0xc6')],{'as':'Field','foreignKey':'FieldId'});db[_0xd9b6('0xc6')][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':'VariableId'});db[_0xd9b6('0xc8')][_0xd9b6('0x114')](db[_0xd9b6('0xc9')],{'as':_0xd9b6('0x1b7'),'onDelete':'cascade','foreignKey':_0xd9b6('0x1af')});db['Dynamics365Configuration'][_0xd9b6('0x114')](db['Dynamics365Field'],{'as':_0xd9b6('0x1b0'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xc9')][_0xd9b6('0x114')](db[_0xd9b6('0xcb')],{'as':_0xd9b6('0x1b8'),'onDelete':_0xd9b6('0x118'),'foreignKey':'DescriptionId'});db[_0xd9b6('0xc9')]['hasMany'](db[_0xd9b6('0xcb')],{'as':_0xd9b6('0x1ab'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xc9')][_0xd9b6('0x122')](db[_0xd9b6('0xc8')],{'as':_0xd9b6('0x169'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xd9b6('0x114')](db[_0xd9b6('0xcb')],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xcb')][_0xd9b6('0x114')](db['Dynamics365Field'],{'as':_0xd9b6('0x1b4'),'foreignKey':_0xd9b6('0x1b1')});db[_0xd9b6('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xcb')][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':_0xd9b6('0x1ba')});db[_0xd9b6('0xcd')][_0xd9b6('0x114')](db['FreshsalesConfiguration'],{'as':_0xd9b6('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd9b6('0xcf')]['hasMany'](db[_0xd9b6('0x1be')],{'as':'Subjects','foreignKey':_0xd9b6('0x1b3')});db[_0xd9b6('0xcf')][_0xd9b6('0x114')](db[_0xd9b6('0x1be')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xd9b6('0xcf')][_0xd9b6('0x114')](db[_0xd9b6('0x1be')],{'as':'Fields','foreignKey':_0xd9b6('0x1b9')});db[_0xd9b6('0xcf')][_0xd9b6('0x122')](db[_0xd9b6('0xcd')],{'as':_0xd9b6('0x169'),'foreignKey':_0xd9b6('0x1af')});db[_0xd9b6('0x1be')]['hasMany'](db[_0xd9b6('0x1be')],{'as':_0xd9b6('0x1b2'),'foreignKey':_0xd9b6('0x1b3')});db['FreshsalesField'][_0xd9b6('0x114')](db[_0xd9b6('0x1be')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xd9b6('0x1be')][_0xd9b6('0x114')](db['FreshsalesField'],{'as':_0xd9b6('0x1b5'),'foreignKey':_0xd9b6('0x1b9')});db['FreshsalesField'][_0xd9b6('0x122')](db[_0xd9b6('0x93')],{'as':_0xd9b6('0x93'),'foreignKey':_0xd9b6('0x1ba')});db[_0xd9b6('0xd4')][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{});db['ChatQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0xd4')][_0xd9b6('0x122')](db['CmContact'],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db['ChatQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x189')],{});db[_0xd9b6('0xd4')][_0xd9b6('0x122')](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0xd9b6('0x111')],{});db[_0xd9b6('0xd4')][_0xd9b6('0x122')](db[_0xd9b6('0x6e')],{});db[_0xd9b6('0xd5')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xd9b6('0xd5')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1bf')});db['JscriptySessionReport']['hasMany'](db[_0xd9b6('0xd9')],{'foreignKey':_0xd9b6('0x1c0'),'onDelete':'cascade'});db[_0xd9b6('0x14e')]['hasMany'](db[_0xd9b6('0xd7')],{'foreignKey':_0xd9b6('0x1c0'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0xdb')][_0xd9b6('0x122')](db[_0xd9b6('0x54')],{});db[_0xd9b6('0xdb')][_0xd9b6('0x122')](db['CmList'],{'as':'List','foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0xdb')]['belongsTo'](db['CmContact'],{'as':_0xd9b6('0x15c'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x57')],{});db[_0xd9b6('0xdb')][_0xd9b6('0x122')](db[_0xd9b6('0x59')],{});db['SmsQueueReport'][_0xd9b6('0x122')](db['User'],{});db['SmsQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x5a')],{});db[_0xd9b6('0x1c1')][_0xd9b6('0x114')](db[_0xd9b6('0x14e')],{'foreignKey':_0xd9b6('0x1c2')});db[_0xd9b6('0x1c1')]['hasMany'](db[_0xd9b6('0xd9')],{'foreignKey':_0xd9b6('0x1c2')});db[_0xd9b6('0x1c1')][_0xd9b6('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0xd9b6('0x1c2')});db[_0xd9b6('0xe5')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x16d'),'through':'user_has_square_projects'});db[_0xd9b6('0xea')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':'Agents','through':_0xd9b6('0x1c3')});db['Team'][_0xd9b6('0x127')](db[_0xd9b6('0x1d')],{'through':_0xd9b6('0x1c4'),'as':_0xd9b6('0x1c5')});db[_0xd9b6('0xea')][_0xd9b6('0x127')](db[_0xd9b6('0x3e')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xd9b6('0xea')][_0xd9b6('0x127')](db[_0xd9b6('0x6e')],{'through':_0xd9b6('0x1c6'),'as':_0xd9b6('0x133')});db['Team']['belongsToMany'](db[_0xd9b6('0x51')],{'through':_0xd9b6('0x17a'),'as':_0xd9b6('0x134')});db[_0xd9b6('0xea')]['belongsToMany'](db[_0xd9b6('0x5a')],{'through':_0xd9b6('0x181'),'as':_0xd9b6('0x135')});db[_0xd9b6('0xea')][_0xd9b6('0x127')](db[_0xd9b6('0x64')],{'through':_0xd9b6('0x186'),'as':_0xd9b6('0x1c7')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xd9b6('0x1c8'),'as':_0xd9b6('0x136')});db['Campaign'][_0xd9b6('0x114')](db[_0xd9b6('0x74')],{'as':'Hoppers','foreignKey':_0xd9b6('0x197')});db[_0xd9b6('0xed')][_0xd9b6('0x114')](db['CmHopperFinal'],{'as':_0xd9b6('0x119'),'foreignKey':'CampaignId'});db[_0xd9b6('0xed')][_0xd9b6('0x114')](db[_0xd9b6('0x79')],{'as':_0xd9b6('0x14c'),'foreignKey':_0xd9b6('0x197')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0xd9b6('0x14d'),'foreignKey':'CampaignId'});db[_0xd9b6('0xed')][_0xd9b6('0x122')](db[_0xd9b6('0x2c')],{'as':_0xd9b6('0x2c'),'foreignKey':_0xd9b6('0x1c9')});db[_0xd9b6('0xed')][_0xd9b6('0x122')](db['Trunk'],{'as':_0xd9b6('0x1ca'),'foreignKey':_0xd9b6('0x1cb')});db['Campaign'][_0xd9b6('0x122')](db[_0xd9b6('0x150')],{'as':_0xd9b6('0x150'),'foreignKey':'IntervalId'});db['Campaign'][_0xd9b6('0x122')](db[_0xd9b6('0xe5')],{'as':_0xd9b6('0xe5'),'foreignKey':_0xd9b6('0x1cc')});db[_0xd9b6('0xed')][_0xd9b6('0x127')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x128'),'through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x154'),'through':'campaigns_has_cm_blacklists'});db[_0xd9b6('0xf3')][_0xd9b6('0x122')](db[_0xd9b6('0x43')],{});db['MailTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x42')],{});db[_0xd9b6('0xf3')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xd9b6('0x1cd')});db[_0xd9b6('0xf3')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':_0xd9b6('0x1cf')});db[_0xd9b6('0xf3')]['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1d0'),'as':_0xd9b6('0x1d1')});db[_0xd9b6('0xf3')][_0xd9b6('0x122')](db[_0xd9b6('0x3e')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xd9b6('0xf3')][_0xd9b6('0x122')](db[_0xd9b6('0x3c')],{'foreignKey':_0xd9b6('0x1d2'),'as':_0xd9b6('0x1d3')});db[_0xd9b6('0xf5')][_0xd9b6('0x122')](db[_0xd9b6('0x18a')],{});db[_0xd9b6('0xf5')]['belongsTo'](db['ChatInteraction'],{});db[_0xd9b6('0xf5')][_0xd9b6('0x122')](db[_0xd9b6('0x65')],{'foreignKey':_0xd9b6('0x1d4'),'as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':'ToUserId','as':_0xd9b6('0x1d1')});db['ChatTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x6e')],{'foreignKey':_0xd9b6('0x1d5'),'as':_0xd9b6('0x1d6')});db[_0xd9b6('0xf5')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xd9b6('0x1d7'),'as':_0xd9b6('0x1d3')});db[_0xd9b6('0xf7')][_0xd9b6('0x122')](db['FaxMessage'],{});db[_0xd9b6('0xf7')][_0xd9b6('0x122')](db[_0xd9b6('0x11d')],{});db[_0xd9b6('0xf7')][_0xd9b6('0x122')](db[_0xd9b6('0x4b')],{'foreignKey':_0xd9b6('0x1d8'),'as':_0xd9b6('0x1cd')});db[_0xd9b6('0xf7')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':_0xd9b6('0x1cf')});db[_0xd9b6('0xf7')]['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xd9b6('0xf7')]['belongsTo'](db[_0xd9b6('0x51')],{'foreignKey':'ToFaxQueueId','as':_0xd9b6('0x1d6')});db['FaxTransferReport'][_0xd9b6('0x122')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xd9b6('0x1d3')});db[_0xd9b6('0xf9')]['belongsTo'](db[_0xd9b6('0x62')],{});db[_0xd9b6('0xf9')]['belongsTo'](db[_0xd9b6('0x60')],{});db[_0xd9b6('0xf9')][_0xd9b6('0x122')](db['OpenchannelAccount'],{'foreignKey':_0xd9b6('0x1d9'),'as':_0xd9b6('0x1cd')});db['OpenchannelTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':_0xd9b6('0x1cf')});db['OpenchannelTransferReport']['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1d0'),'as':_0xd9b6('0x1d1')});db[_0xd9b6('0xf9')][_0xd9b6('0x122')](db[_0xd9b6('0x64')],{'foreignKey':_0xd9b6('0x1da'),'as':_0xd9b6('0x1d6')});db['OpenchannelTransferReport'][_0xd9b6('0x122')](db['OpenchannelAccount'],{'foreignKey':_0xd9b6('0x1db'),'as':_0xd9b6('0x1d3')});db['SmsTransferReport'][_0xd9b6('0x122')](db['SmsMessage'],{});db[_0xd9b6('0xfb')][_0xd9b6('0x122')](db[_0xd9b6('0x57')],{});db[_0xd9b6('0xfb')][_0xd9b6('0x122')](db[_0xd9b6('0x54')],{'foreignKey':_0xd9b6('0x1dc'),'as':_0xd9b6('0x1cd')});db['SmsTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':_0xd9b6('0x1cf')});db[_0xd9b6('0xfb')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1d0'),'as':'ToAgent'});db[_0xd9b6('0xfb')][_0xd9b6('0x122')](db[_0xd9b6('0x5a')],{'foreignKey':_0xd9b6('0x1dd'),'as':_0xd9b6('0x1d6')});db[_0xd9b6('0xfb')][_0xd9b6('0x122')](db[_0xd9b6('0x54')],{'foreignKey':'ToSmsAccountId','as':_0xd9b6('0x1d3')});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x83')],{'as':_0xd9b6('0x161'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x7c')],{'as':_0xd9b6('0x1de'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x126'),'onDelete':_0xd9b6('0x118'),'foreignKey':'ListId'});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x77')],{'as':_0xd9b6('0x119'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x79')],{'as':_0xd9b6('0x11a'),'foreignKey':'ListId'});db[_0xd9b6('0x137')][_0xd9b6('0x114')](db[_0xd9b6('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x137')][_0xd9b6('0x127')](db[_0xd9b6('0x1d')],{'as':_0xd9b6('0x1df'),'through':_0xd9b6('0x1e0')});db['CmList'][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x138')});db[_0xd9b6('0xfe')]['hasMany'](db[_0xd9b6('0x1a')],{'as':_0xd9b6('0x117'),'onDelete':_0xd9b6('0x118')});db[_0xd9b6('0xfe')][_0xd9b6('0x127')](db['User'],{'as':_0xd9b6('0x152'),'through':'user_has_voice_prefixes'});db[_0xd9b6('0x100')]['hasMany'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x16d'),'foreignKey':_0xd9b6('0x123')});db[_0xd9b6('0x100')][_0xd9b6('0x114')](db['UserProfileSection'],{'as':_0xd9b6('0x1e1'),'foreignKey':_0xd9b6('0x123'),'onDelete':_0xd9b6('0x118')});db['UserProfileSection']['hasMany'](db[_0xd9b6('0x104')],{'as':_0xd9b6('0x1e2'),'foreignKey':'sectionId','onDelete':_0xd9b6('0x118')});db['WhatsappAccount'][_0xd9b6('0x114')](db[_0xd9b6('0x83')],{'as':_0xd9b6('0x161'),'foreignKey':_0xd9b6('0x1e3')});db[_0xd9b6('0x1e4')][_0xd9b6('0x114')](db[_0xd9b6('0x82')],{'as':_0xd9b6('0x162'),'foreignKey':_0xd9b6('0x1e3')});db[_0xd9b6('0x1e4')][_0xd9b6('0x114')](db[_0xd9b6('0x108')],{'as':_0xd9b6('0x155'),'foreignKey':_0xd9b6('0x1e3')});db['WhatsappAccount'][_0xd9b6('0x114')](db['WhatsappInteraction'],{'as':_0xd9b6('0x163')});db[_0xd9b6('0x1e4')][_0xd9b6('0x114')](db[_0xd9b6('0x107')],{'as':'Applications'});db[_0xd9b6('0x1e4')][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x1e4')][_0xd9b6('0x122')](db[_0xd9b6('0x87')],{'as':_0xd9b6('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db['User'],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x141')});db[_0xd9b6('0x107')][_0xd9b6('0x122')](db['User'],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x107')][_0xd9b6('0x122')](db[_0xd9b6('0x10d')],{'onDelete':_0xd9b6('0x16f')});db['WhatsappApplication']['belongsTo'](db['WhatsappAccount'],{'onDelete':_0xd9b6('0x16f')});db[_0xd9b6('0x107')]['belongsTo'](db[_0xd9b6('0x150')],{'onDelete':_0xd9b6('0x16f'),'foreignKey':_0xd9b6('0x151')});db[_0xd9b6('0x107')]['belongsTo'](db[_0xd9b6('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xd9b6('0x12f')][_0xd9b6('0x114')](db[_0xd9b6('0x108')],{'as':_0xd9b6('0x155'),'onDelete':_0xd9b6('0x118'),'foreignKey':_0xd9b6('0x1e5')});db[_0xd9b6('0x12f')]['belongsTo'](db[_0xd9b6('0x1e4')],{'as':'Account','foreignKey':_0xd9b6('0x1e3')});db[_0xd9b6('0x12f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9b6('0x12f')]['belongsTo'](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x176'),'foreignKey':_0xd9b6('0x113')});db['WhatsappInteraction'][_0xd9b6('0x127')](db[_0xd9b6('0x90')],{'through':_0xd9b6('0x1a6'),'as':_0xd9b6('0x16b')});db[_0xd9b6('0x12f')]['belongsToMany'](db['Tag'],{'through':_0xd9b6('0x1a6'),'as':_0xd9b6('0x16c')});db[_0xd9b6('0x12f')][_0xd9b6('0x127')](db[_0xd9b6('0x111')],{'as':_0xd9b6('0x16d'),'through':_0xd9b6('0x131'),'foreignKey':_0xd9b6('0x1e5')});db[_0xd9b6('0x108')][_0xd9b6('0x122')](db['User'],{'as':_0xd9b6('0x111')});db[_0xd9b6('0x108')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'onDelete':_0xd9b6('0x118'),'as':_0xd9b6('0x15c')});db[_0xd9b6('0x108')][_0xd9b6('0x122')](db[_0xd9b6('0x12f')],{'onDelete':'cascade','as':_0xd9b6('0x16e'),'foreignKey':_0xd9b6('0x1e5')});db[_0xd9b6('0x108')][_0xd9b6('0x122')](db[_0xd9b6('0x1e4')],{'as':_0xd9b6('0x169'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x1e4')],{});db['WhatsappQueueReport'][_0xd9b6('0x122')](db[_0xd9b6('0x137')],{'as':_0xd9b6('0x171'),'foreignKey':_0xd9b6('0x164')});db[_0xd9b6('0x10a')][_0xd9b6('0x122')](db[_0xd9b6('0x125')],{'as':_0xd9b6('0x15c'),'foreignKey':_0xd9b6('0x15d')});db[_0xd9b6('0x10a')][_0xd9b6('0x122')](db[_0xd9b6('0x12f')],{});db['WhatsappQueueReport'][_0xd9b6('0x122')](db['WhatsappQueue'],{});db[_0xd9b6('0x10a')][_0xd9b6('0x122')](db[_0xd9b6('0x108')],{});db[_0xd9b6('0x10a')][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{});db['WhatsappTransferReport'][_0xd9b6('0x122')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0xd9b6('0x12f')],{});db[_0xd9b6('0x1e6')]['belongsTo'](db[_0xd9b6('0x1e4')],{'foreignKey':_0xd9b6('0x1e7'),'as':'FromAccount'});db['WhatsappTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x1e4')],{'foreignKey':'ToWhatsappAccountId','as':_0xd9b6('0x1d3')});db['WhatsappTransferReport'][_0xd9b6('0x122')](db['WhatsappQueue'],{'foreignKey':_0xd9b6('0x1e8'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xd9b6('0x122')](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1ce'),'as':_0xd9b6('0x1cf')});db[_0xd9b6('0x1e6')]['belongsTo'](db[_0xd9b6('0x111')],{'foreignKey':_0xd9b6('0x1d0'),'as':_0xd9b6('0x1d1')});db[_0xd9b6('0x10d')][_0xd9b6('0x127')](db['User'],{'as':_0xd9b6('0x152'),'through':_0xd9b6('0x37'),'foreignKey':_0xd9b6('0x1e9')});db[_0xd9b6('0x10d')][_0xd9b6('0x127')](db[_0xd9b6('0xea')],{'through':_0xd9b6('0x1c8'),'as':_0xd9b6('0x153')});module[_0xd9b6('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2caf=['UserSmsQueue','OpenchannelAccountId','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','cm_contact_has_tags','Agent','CampaignId','Queue','All','OneAll','OneAny','Actions','AutomationId','MailApplications','ChatApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','SalesforceConfiguration','Subjects','SubjectId','DescriptionId','FieldId','AccountId','Field','Variable','Subject','Description','VariableId','Descriptions','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FreshsalesConfiguration','FreshsalesField','ChatQueueReport','SessionId','JscriptyProject','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','lodash','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','sequelizeHistory','127.0.0.1','utf8','utf8_general_ci','database','password','username','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','VoiceMail','cascade','hasMany','UserId','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','UserMailQueue','UserChatQueue','FaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','cm_user_has_lists','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','ChanSpyId','VoiceContext','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','CmHopperHistory','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','MailAccount','MailAccountId','hasOne','Imap','Smtp','Dispositions','Answers','MailMessage','Applications','List','ListId','TemplateId','Pause','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Users','Attachment','Attachments','Interaction','MailInteractionId','MailApplication','restrict','IntervalId','FaxAccountId','Interactions','mandatoryDispositionPause','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','TagId','SmsInteractionId','sms_interaction_has_tags'];(function(_0x47e51c,_0xd719a0){var _0x201e96=function(_0x498c8b){while(--_0x498c8b){_0x47e51c['push'](_0x47e51c['shift']());}};_0x201e96(++_0xd719a0);}(_0x2caf,0x6a));var _0xf2ca=function(_0x4df619,_0x593bd7){_0x4df619=_0x4df619-0x0;var _0x3771db=_0x2caf[_0x4df619];return _0x3771db;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xf2ca('0x0'));var jstz=require('jstz');var timezone=jstz[_0xf2ca('0x1')]();config[_0xf2ca('0x2')]=_[_0xf2ca('0x3')](config[_0xf2ca('0x2')],{'database':_0xf2ca('0x4'),'username':_0xf2ca('0x5'),'password':_0xf2ca('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xf2ca('0x7'),'dialectOptions':{'charset':_0xf2ca('0x8')},'logging':![],'timezone':timezone[_0xf2ca('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xf2ca('0xa')]=_[_0xf2ca('0x3')](config[_0xf2ca('0xa')],{'database':_0xf2ca('0x4'),'username':_0xf2ca('0x5'),'password':'xC@LL1234','options':{'host':_0xf2ca('0xb'),'port':0xcea,'dialect':_0xf2ca('0x7'),'dialectOptions':{'charset':_0xf2ca('0x8')},'logging':![],'timezone':timezone[_0xf2ca('0x9')](),'define':{'charset':_0xf2ca('0xc'),'collate':_0xf2ca('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xf2ca('0xe')],config[_0xf2ca('0x2')]['username'],config[_0xf2ca('0x2')][_0xf2ca('0xf')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf2ca('0xa')]['database'],config[_0xf2ca('0xa')][_0xf2ca('0x10')],config[_0xf2ca('0xa')][_0xf2ca('0xf')],config[_0xf2ca('0xa')][_0xf2ca('0x11')])};db[_0xf2ca('0x12')]=db['sequelize'][_0xf2ca('0x13')]('../api/user/user.model');db[_0xf2ca('0x14')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x15'));db['VoiceContext']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x16'));db[_0xf2ca('0x17')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x18'));db[_0xf2ca('0x19')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x1a'));db['VoiceQueue']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x1b'));db[_0xf2ca('0x1c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x1d'));db[_0xf2ca('0x1e')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x1f'));db['VoiceMail']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x20'));db['VoiceMailMessage']=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x21'));db[_0xf2ca('0x22')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x23'));db[_0xf2ca('0x24')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x25'));db[_0xf2ca('0x26')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x27'));db[_0xf2ca('0x28')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x29'));db[_0xf2ca('0x2a')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x2b'));db[_0xf2ca('0x2c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x2d'));db[_0xf2ca('0x2e')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x2f'));db[_0xf2ca('0x30')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x31'));db[_0xf2ca('0x32')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x33'));db['UserChatQueue']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x34'));db['UserMailQueue']=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x35'));db[_0xf2ca('0x36')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x37'));db['UserSmsQueue']=db['sequelize'][_0xf2ca('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xf2ca('0x38')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x39'));db[_0xf2ca('0x3a')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x3b'));db[_0xf2ca('0x3c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x3d'));db[_0xf2ca('0x3e')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x3f'));db['MailAccount']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x40'));db[_0xf2ca('0x41')]=db['sequelize'][_0xf2ca('0x13')]('../api/mailQueue/mailQueue.model');db[_0xf2ca('0x42')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x43'));db[_0xf2ca('0x44')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x45'));db['MailMessage']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x46'));db['MailApplication']=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x47'));db[_0xf2ca('0x48')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x49'));db[_0xf2ca('0x4a')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x4b'));db[_0xf2ca('0x4c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x4d'));db[_0xf2ca('0x4e')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x4f'));db[_0xf2ca('0x50')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x51'));db[_0xf2ca('0x52')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x53'));db[_0xf2ca('0x54')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x55'));db['FaxQueue']=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x56'));db['FaxQueueReport']=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x57'));db[_0xf2ca('0x58')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x59'));db[_0xf2ca('0x5a')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x5b'));db[_0xf2ca('0x5c')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x5d'));db[_0xf2ca('0x5e')]=db[_0xf2ca('0x2')]['import']('../api/smsMessage/smsMessage.model');db[_0xf2ca('0x5f')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x60'));db[_0xf2ca('0x61')]=db[_0xf2ca('0x2')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xf2ca('0x62')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x63'));db['OpenchannelInteraction']=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x64'));db['OpenchannelMessage']=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x65'));db['OpenchannelQueue']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x66'));db[_0xf2ca('0x67')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xf2ca('0x68')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x69'));db[_0xf2ca('0x6a')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x6b'));db['ChatInteraction']=db['sequelize']['import'](_0xf2ca('0x6c'));db[_0xf2ca('0x6d')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/chatMessage/chatMessage.model');db[_0xf2ca('0x6e')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x6f'));db[_0xf2ca('0x70')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/chatQueue/chatQueue.model');db[_0xf2ca('0x71')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/chatGroup/chatGroup.model');db[_0xf2ca('0x72')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x73'));db[_0xf2ca('0x74')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x75'));db[_0xf2ca('0x76')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x77'));db[_0xf2ca('0x78')]=db['sequelize'][_0xf2ca('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf2ca('0x79')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x7a'));db['CmHopperHistory']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x7b'));db[_0xf2ca('0x7c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xf2ca('0x7d')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x7e'));db[_0xf2ca('0x7f')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x80'));db[_0xf2ca('0x81')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x82'));db[_0xf2ca('0x83')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x84'));db[_0xf2ca('0x85')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0xf2ca('0x86')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x87'));db[_0xf2ca('0x88')]=db['sequelize']['import'](_0xf2ca('0x89'));db['Pause']=db[_0xf2ca('0x2')]['import']('../api/pause/pause.model');db['Cdr']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x8a'));db[_0xf2ca('0x8b')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x8c'));db[_0xf2ca('0x8d')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x8e'));db[_0xf2ca('0x8f')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x90'));db[_0xf2ca('0x91')]=db['sequelize'][_0xf2ca('0x13')]('../api/tag/tag.model');db[_0xf2ca('0x92')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x93'));db[_0xf2ca('0x94')]=db['sequelize'][_0xf2ca('0x13')]('../api/trigger/trigger.model');db['Variable']=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x95'));db[_0xf2ca('0x96')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x97'));db[_0xf2ca('0x98')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0x99'));db['AnalyticCustomReport']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x9a'));db[_0xf2ca('0x9b')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf2ca('0x9c')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x9d'));db[_0xf2ca('0x9e')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xf2ca('0x9f')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xa0'));db['AnalyticTreeReport']=db['sequelize'][_0xf2ca('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xa1'));db['SalesforceConfiguration']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xa2'));db[_0xf2ca('0xa3')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0xa4'));db[_0xf2ca('0xa5')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xa6'));db[_0xf2ca('0xa7')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xa8'));db[_0xf2ca('0xa9')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xf2ca('0xaa')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xab'));db[_0xf2ca('0xac')]=db[_0xf2ca('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xf2ca('0xad')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xae'));db[_0xf2ca('0xaf')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xb0'));db['ZohoConfiguration']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xb1'));db['ZohoField']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xb2'));db[_0xf2ca('0xb3')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xb4'));db[_0xf2ca('0xb5')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xf2ca('0xb6')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xb7'));db[_0xf2ca('0xb8')]=db[_0xf2ca('0x2')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xf2ca('0xb9')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xba'));db[_0xf2ca('0xbb')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xbc'));db['VtigerAccount']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xbd'));db[_0xf2ca('0xbe')]=db['sequelize']['import'](_0xf2ca('0xbf'));db['VtigerField']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xc0'));db[_0xf2ca('0xc1')]=db['sequelize'][_0xf2ca('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xf2ca('0xc2')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xf2ca('0xc3')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xc4'));db[_0xf2ca('0xc5')]=db['sequelize']['import'](_0xf2ca('0xc6'));db[_0xf2ca('0xc7')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xc8'));db[_0xf2ca('0xc9')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xca'));db[_0xf2ca('0xcb')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xcc'));db['FreshsalesConfiguration']=db[_0xf2ca('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xcd'));db[_0xf2ca('0x96')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x97'));db[_0xf2ca('0xce')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xcf'));db['ChatQueueReport']=db['sequelize']['import'](_0xf2ca('0xd0'));db[_0xf2ca('0xd1')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xf2ca('0xd2')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0xd3'));db[_0xf2ca('0xd4')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xd5'));db[_0xf2ca('0xd6')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xd7'));db[_0xf2ca('0xd8')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0xd9'));db[_0xf2ca('0xda')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xdb'));db[_0xf2ca('0xdc')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xdd'));db['JscriptyProject']=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xde'));db[_0xf2ca('0xdf')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xe0'));db[_0xf2ca('0xe1')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xe2'));db[_0xf2ca('0xe3')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xe4'));db[_0xf2ca('0xe5')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xe6'));db[_0xf2ca('0xe7')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xe8'));db[_0xf2ca('0xe9')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0xea'));db[_0xf2ca('0xeb')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xec'));db[_0xf2ca('0xed')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xee'));db[_0xf2ca('0xef')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xf0'));db['Attachment']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xf1'));db[_0xf2ca('0xf2')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/plugin/plugin.model');db[_0xf2ca('0xf3')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xf4'));db[_0xf2ca('0xf5')]=db['sequelize'][_0xf2ca('0x13')](_0xf2ca('0xf6'));db[_0xf2ca('0xf7')]=db[_0xf2ca('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xf8'));db[_0xf2ca('0xf9')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xfa'));db['CmList']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xfb'));db[_0xf2ca('0xfc')]=db['sequelize'][_0xf2ca('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xf2ca('0xfd')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')]('../api/userProfile/userProfile.model');db[_0xf2ca('0xfe')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0xff'));db['UserProfileResource']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x100'));db[_0xf2ca('0x101')]=db['sequelize']['import'](_0xf2ca('0x102'));db[_0xf2ca('0x103')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x104'));db['WhatsappApplication']=db['sequelize']['import'](_0xf2ca('0x105'));db[_0xf2ca('0x106')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x107'));db[_0xf2ca('0x108')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x109'));db['WhatsappQueueReport']=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x10a'));db[_0xf2ca('0x10b')]=db[_0xf2ca('0x2')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xf2ca('0x10c')]=db[_0xf2ca('0x2')]['import'](_0xf2ca('0x10d'));db[_0xf2ca('0x10e')]=db[_0xf2ca('0x2')][_0xf2ca('0x13')](_0xf2ca('0x10f'));db[_0xf2ca('0x12')]['hasOne'](db[_0xf2ca('0x110')],{'as':_0xf2ca('0x110'),'onDelete':_0xf2ca('0x111'),'foreignKey':'UserId'});db['User'][_0xf2ca('0x112')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db[_0xf2ca('0x30')],{'as':_0xf2ca('0x114'),'foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db[_0xf2ca('0x17')],{'as':_0xf2ca('0x115'),'onDelete':_0xf2ca('0x111'),'hooks':!![]});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db['CmHopperFinal'],{'as':_0xf2ca('0x116'),'foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db[_0xf2ca('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db['OpenchannelInteraction'],{'as':_0xf2ca('0x117'),'foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db[_0xf2ca('0x118')],{'as':'ChatInteractions','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')]['hasMany'](db[_0xf2ca('0x5c')],{'as':_0xf2ca('0x119'),'foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0xf2ca('0x11a'),'foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')]['hasMany'](db[_0xf2ca('0x44')],{'as':'MailInteractions','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x12')][_0xf2ca('0x112')](db['WhatsappInteraction'],{'as':_0xf2ca('0x11b'),'foreignKey':_0xf2ca('0x113')});db['User']['hasMany'](db['Notification'],{'as':_0xf2ca('0x11c'),'foreignKey':_0xf2ca('0x11d')});db['User'][_0xf2ca('0x11e')](db[_0xf2ca('0xfd')],{'as':'UserProfile','foreignKey':_0xf2ca('0x11f')});db['User'][_0xf2ca('0x120')](db[_0xf2ca('0x71')],{'as':_0xf2ca('0x121'),'through':'chat_group_has_users'});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x122'),'through':_0xf2ca('0x123')});db['User'][_0xf2ca('0x120')](db[_0xf2ca('0x124')],{'as':'Lists','through':'cm_user_has_lists'});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0xe9')],{'through':_0xf2ca('0x125')});db[_0xf2ca('0x12')]['belongsToMany'](db[_0xf2ca('0x44')],{'as':_0xf2ca('0x126'),'through':_0xf2ca('0x127')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x118')],{'as':_0xf2ca('0x128'),'through':_0xf2ca('0x129')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x52')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x5c')],{'as':_0xf2ca('0x119'),'through':_0xf2ca('0x12a')});db['User'][_0xf2ca('0x120')](db['OpenchannelInteraction'],{'as':_0xf2ca('0x117'),'through':'user_has_openchannel_interactions'});db['User'][_0xf2ca('0x120')](db['WhatsappInteraction'],{'as':_0xf2ca('0x11b'),'through':_0xf2ca('0x12b')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x12c')],{'as':_0xf2ca('0x12d'),'through':'UserVoiceQueue','required':![]});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x41')],{'as':_0xf2ca('0x12e'),'through':_0xf2ca('0x12f'),'required':![]});db[_0xf2ca('0x12')]['belongsToMany'](db['ChatQueue'],{'as':'ChatQueues','through':_0xf2ca('0x130'),'required':![],'hooks':!![]});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x131')],{'as':'FaxQueues','through':_0xf2ca('0x36'),'required':![]});db[_0xf2ca('0x12')]['belongsToMany'](db[_0xf2ca('0x5f')],{'as':_0xf2ca('0x132'),'through':'UserSmsQueue','required':![]});db['User']['belongsToMany'](db[_0xf2ca('0x133')],{'as':_0xf2ca('0x134'),'through':_0xf2ca('0x38'),'required':![]});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xf2ca('0x3a'),'required':![]});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x124')],{'through':_0xf2ca('0x135')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db['VoicePrefix'],{'as':_0xf2ca('0x136'),'through':'user_has_voice_prefixes','required':![]});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x67')],{'as':_0xf2ca('0x137'),'through':_0xf2ca('0x138')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x4e')],{'as':_0xf2ca('0x139'),'through':_0xf2ca('0x13a')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db['MailAccount'],{'as':_0xf2ca('0x13b'),'through':_0xf2ca('0x13c')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db[_0xf2ca('0x61')],{'as':_0xf2ca('0x13d'),'through':_0xf2ca('0x13e')});db['User'][_0xf2ca('0x120')](db['SmsAccount'],{'as':_0xf2ca('0x13f'),'through':_0xf2ca('0x140')});db[_0xf2ca('0x12')][_0xf2ca('0x120')](db['WhatsappAccount'],{'as':_0xf2ca('0x141'),'through':_0xf2ca('0x142')});db['User'][_0xf2ca('0x120')](db['SquareProject'],{'as':_0xf2ca('0x143'),'through':'user_has_square_projects'});db[_0xf2ca('0x14')]['hasMany'](db[_0xf2ca('0x17')],{'as':'SpiedAgents','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x144')});db[_0xf2ca('0x145')][_0xf2ca('0x112')](db[_0xf2ca('0x17')],{'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x17')][_0xf2ca('0x112')](db[_0xf2ca('0x17')],{'as':'Applications','onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x19')][_0xf2ca('0x120')](db[_0xf2ca('0x8f')],{'as':_0xf2ca('0x146'),'through':_0xf2ca('0x147')});db['VoiceQueue'][_0xf2ca('0x112')](db[_0xf2ca('0x30')],{'as':_0xf2ca('0x148'),'foreignKey':_0xf2ca('0x149')});db[_0xf2ca('0x12c')]['hasMany'](db[_0xf2ca('0x14a')],{'as':_0xf2ca('0x14b'),'foreignKey':_0xf2ca('0x149')});db[_0xf2ca('0x12c')]['hasMany'](db[_0xf2ca('0x79')],{'as':'HopperFinals','foreignKey':_0xf2ca('0x149')});db[_0xf2ca('0x12c')][_0xf2ca('0x112')](db[_0xf2ca('0x14c')],{'as':_0xf2ca('0x14d'),'foreignKey':_0xf2ca('0x149')});db[_0xf2ca('0x12c')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf2ca('0x149')});db[_0xf2ca('0x12c')][_0xf2ca('0x112')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xf2ca('0x149')});db['VoiceQueue']['hasMany'](db[_0xf2ca('0xd6')],{'as':_0xf2ca('0x14e'),'foreignKey':_0xf2ca('0x149')});db['VoiceQueue'][_0xf2ca('0x11e')](db[_0xf2ca('0x2c')],{'as':_0xf2ca('0x2c'),'foreignKey':_0xf2ca('0x14f')});db[_0xf2ca('0x12c')][_0xf2ca('0x11e')](db[_0xf2ca('0x2c')],{'as':_0xf2ca('0x150'),'foreignKey':_0xf2ca('0x151')});db[_0xf2ca('0x12c')][_0xf2ca('0x11e')](db[_0xf2ca('0x88')],{'as':_0xf2ca('0x88'),'foreignKey':'IntervalId'});db[_0xf2ca('0x12c')][_0xf2ca('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xf2ca('0x152')});db['VoiceQueue'][_0xf2ca('0x120')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x153'),'through':_0xf2ca('0x154')});db[_0xf2ca('0x12c')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x32')});db[_0xf2ca('0x12c')]['belongsToMany'](db[_0xf2ca('0xe9')],{'as':_0xf2ca('0x156'),'through':_0xf2ca('0x157')});db[_0xf2ca('0x12c')][_0xf2ca('0x120')](db['CmList'],{'as':_0xf2ca('0x158'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x12'),'foreignKey':'UserId'});db[_0xf2ca('0x1e')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0xf2ca('0x113')});db[_0xf2ca('0x110')]['hasMany'](db['VoiceMailMessage'],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x15a'),'sourceKey':_0xf2ca('0x15b')});db['VoiceMailMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x110')],{'foreignKey':_0xf2ca('0x15a'),'targetKey':'mailbox'});db[_0xf2ca('0x22')][_0xf2ca('0x112')](db['VoiceQueueReport'],{'as':_0xf2ca('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0xf2ca('0x22')][_0xf2ca('0x112')](db[_0xf2ca('0x26')],{'as':_0xf2ca('0x15d'),'foreignKey':_0xf2ca('0x15e'),'constraints':![]});db['VoiceCallReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':'User','foreignKey':'UserId'});db[_0xf2ca('0x22')][_0xf2ca('0x11e')](db['CmContact'],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db[_0xf2ca('0x3c')][_0xf2ca('0x11e')](db['MailAccount'],{'as':_0xf2ca('0x160'),'foreignKey':_0xf2ca('0x161')});db[_0xf2ca('0x3e')][_0xf2ca('0x11e')](db[_0xf2ca('0x160')],{'as':_0xf2ca('0x160'),'foreignKey':_0xf2ca('0x161')});db['MailAccount'][_0xf2ca('0x162')](db[_0xf2ca('0x3c')],{'as':_0xf2ca('0x163'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x160')][_0xf2ca('0x162')](db['MailServerOut'],{'as':_0xf2ca('0x164'),'onDelete':_0xf2ca('0x111')});db['MailAccount']['hasMany'](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':_0xf2ca('0x161')});db[_0xf2ca('0x160')][_0xf2ca('0x112')](db[_0xf2ca('0x83')],{'as':_0xf2ca('0x166'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x167')],{'as':_0xf2ca('0x159'),'foreignKey':_0xf2ca('0x161')});db[_0xf2ca('0x160')][_0xf2ca('0x112')](db['MailInteraction'],{'as':'Interactions'});db[_0xf2ca('0x160')]['hasMany'](db['MailApplication'],{'as':_0xf2ca('0x168')});db['MailAccount'][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x160')][_0xf2ca('0x11e')](db['Template'],{'as':_0xf2ca('0x92'),'foreignKey':_0xf2ca('0x16b')});db[_0xf2ca('0x160')]['belongsTo'](db[_0xf2ca('0x16c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf2ca('0x160')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':'Agents','through':_0xf2ca('0x13c')});db['MailQueue'][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x12f')});db['MailQueue'][_0xf2ca('0x120')](db['Team'],{'through':_0xf2ca('0x16d'),'as':_0xf2ca('0x156')});db[_0xf2ca('0x44')][_0xf2ca('0x112')](db[_0xf2ca('0x167')],{'as':'Messages','onDelete':_0xf2ca('0x111'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xf2ca('0x11e')](db[_0xf2ca('0x160')],{'as':_0xf2ca('0x16e'),'foreignKey':'MailAccountId'});db[_0xf2ca('0x44')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x44')][_0xf2ca('0x11e')](db['User'],{'as':_0xf2ca('0x170'),'foreignKey':_0xf2ca('0x113')});db['MailInteraction'][_0xf2ca('0x120')](db['Tag'],{'through':_0xf2ca('0x171'),'as':_0xf2ca('0x172')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0xf2ca('0x171'),'as':'ThroughTags'});db['MailInteraction']['belongsToMany'](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage'][_0xf2ca('0x112')](db[_0xf2ca('0x174')],{'as':_0xf2ca('0x175'),'onDelete':_0xf2ca('0x111')});db['MailMessage'][_0xf2ca('0x11e')](db['User'],{'as':_0xf2ca('0x12')});db[_0xf2ca('0x167')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'onDelete':_0xf2ca('0x111'),'as':'Contact'});db['MailMessage']['belongsTo'](db[_0xf2ca('0x44')],{'as':_0xf2ca('0x176'),'foreignKey':_0xf2ca('0x177')});db[_0xf2ca('0x167')][_0xf2ca('0x11e')](db[_0xf2ca('0x160')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x161')});db[_0xf2ca('0x178')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x178')][_0xf2ca('0x11e')](db[_0xf2ca('0x41')],{'onDelete':_0xf2ca('0x179')});db['MailApplication'][_0xf2ca('0x11e')](db['MailAccount'],{'onDelete':'restrict'});db[_0xf2ca('0x178')][_0xf2ca('0x11e')](db['Interval'],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x178')]['belongsTo'](db[_0xf2ca('0x91')],{'onDelete':_0xf2ca('0x179'),'foreignKey':'TagId'});db['MailQueueReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x160')],{});db[_0xf2ca('0x48')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x48')]['belongsTo'](db[_0xf2ca('0x76')],{'as':'Contact','foreignKey':'ContactId'});db[_0xf2ca('0x48')][_0xf2ca('0x11e')](db[_0xf2ca('0x44')],{});db[_0xf2ca('0x48')][_0xf2ca('0x11e')](db[_0xf2ca('0x167')],{});db[_0xf2ca('0x48')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{});db[_0xf2ca('0x48')][_0xf2ca('0x11e')](db[_0xf2ca('0x41')],{});db['Dashboard']['hasMany'](db[_0xf2ca('0x4c')],{'as':'Items','onDelete':'cascade'});db['FaxAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':_0xf2ca('0x17b')});db[_0xf2ca('0x4e')][_0xf2ca('0x112')](db[_0xf2ca('0x83')],{'as':_0xf2ca('0x166'),'foreignKey':_0xf2ca('0x17b')});db['FaxAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x52')],{'as':_0xf2ca('0x17c')});db[_0xf2ca('0x4e')][_0xf2ca('0x112')](db[_0xf2ca('0x50')],{'as':_0xf2ca('0x168')});db[_0xf2ca('0x4e')][_0xf2ca('0x112')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x4e')]['hasMany'](db[_0xf2ca('0x54')],{'as':_0xf2ca('0x159')});db[_0xf2ca('0x4e')][_0xf2ca('0x11e')](db['Trunk'],{'as':_0xf2ca('0x2c')});db[_0xf2ca('0x4e')][_0xf2ca('0x11e')](db['CmList'],{'as':_0xf2ca('0x169'),'foreignKey':'ListId'});db[_0xf2ca('0x4e')]['belongsTo'](db['Pause'],{'as':_0xf2ca('0x17d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf2ca('0x4e')]['belongsToMany'](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x13a')});db[_0xf2ca('0x50')]['belongsTo'](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x50')]['belongsTo'](db[_0xf2ca('0x131')],{'onDelete':_0xf2ca('0x179')});db['FaxApplication'][_0xf2ca('0x11e')](db[_0xf2ca('0x4e')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x50')][_0xf2ca('0x11e')](db[_0xf2ca('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xf2ca('0x52')][_0xf2ca('0x112')](db[_0xf2ca('0x54')],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x17e')});db[_0xf2ca('0x52')][_0xf2ca('0x11e')](db[_0xf2ca('0x4e')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x17b')});db[_0xf2ca('0x52')]['belongsTo'](db[_0xf2ca('0x76')],{'as':'Contact','foreignKey':_0xf2ca('0x16f')});db['FaxInteraction'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x170'),'foreignKey':_0xf2ca('0x113')});db['FaxInteraction']['belongsToMany'](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x17f'),'as':'Tags'});db[_0xf2ca('0x52')][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':'fax_interaction_has_tags','as':_0xf2ca('0x180')});db[_0xf2ca('0x52')]['belongsToMany'](db[_0xf2ca('0x12')],{'as':'Users','through':_0xf2ca('0x181'),'foreignKey':'FaxInteractionId'});db[_0xf2ca('0x54')][_0xf2ca('0x11e')](db['User'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x12')});db['FaxMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x52')],{'as':_0xf2ca('0x176'),'foreignKey':_0xf2ca('0x17e')});db[_0xf2ca('0x54')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'onDelete':'cascade','as':_0xf2ca('0x15f')});db[_0xf2ca('0x54')][_0xf2ca('0x11e')](db[_0xf2ca('0x174')],{'as':_0xf2ca('0x174'),'foreignKey':_0xf2ca('0x182')});db['FaxMessage'][_0xf2ca('0x11e')](db['FaxAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x17b')});db[_0xf2ca('0x131')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x36')});db[_0xf2ca('0x131')][_0xf2ca('0x120')](db[_0xf2ca('0xe9')],{'through':_0xf2ca('0x183'),'as':_0xf2ca('0x156')});db[_0xf2ca('0x184')][_0xf2ca('0x11e')](db[_0xf2ca('0x4e')],{});db[_0xf2ca('0x184')]['belongsTo'](db['CmList'],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x184')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db[_0xf2ca('0x184')][_0xf2ca('0x11e')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x54')],{});db[_0xf2ca('0x184')][_0xf2ca('0x11e')](db['User'],{});db[_0xf2ca('0x184')][_0xf2ca('0x11e')](db['FaxQueue'],{});db[_0xf2ca('0x58')][_0xf2ca('0x112')](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':_0xf2ca('0x185')});db[_0xf2ca('0x58')]['hasMany'](db[_0xf2ca('0x83')],{'as':_0xf2ca('0x166'),'foreignKey':'SmsAccountId'});db[_0xf2ca('0x58')][_0xf2ca('0x112')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xf2ca('0x185')});db[_0xf2ca('0x58')][_0xf2ca('0x112')](db[_0xf2ca('0x5c')],{'as':_0xf2ca('0x17c')});db['SmsAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x5a')],{'as':_0xf2ca('0x168')});db[_0xf2ca('0x58')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':'ListId'});db[_0xf2ca('0x58')][_0xf2ca('0x11e')](db[_0xf2ca('0x16c')],{'as':_0xf2ca('0x17d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf2ca('0x58')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':'Agents','through':_0xf2ca('0x140')});db[_0xf2ca('0x5a')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':'restrict'});db[_0xf2ca('0x5a')]['belongsTo'](db[_0xf2ca('0x5f')],{'onDelete':'restrict'});db[_0xf2ca('0x5a')]['belongsTo'](db[_0xf2ca('0x58')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x5a')][_0xf2ca('0x11e')](db[_0xf2ca('0x88')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x17a')});db['SmsApplication']['belongsTo'](db[_0xf2ca('0x91')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x186')});db[_0xf2ca('0x5c')]['hasMany'](db[_0xf2ca('0x5e')],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x187')});db['SmsInteraction'][_0xf2ca('0x11e')](db[_0xf2ca('0x58')],{'as':_0xf2ca('0x16e'),'foreignKey':'SmsAccountId'});db[_0xf2ca('0x5c')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x5c')][_0xf2ca('0x11e')](db['User'],{'as':_0xf2ca('0x170'),'foreignKey':_0xf2ca('0x113')});db['SmsInteraction'][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':'sms_interaction_has_tags','as':_0xf2ca('0x172')});db[_0xf2ca('0x5c')][_0xf2ca('0x120')](db['Tag'],{'through':_0xf2ca('0x188'),'as':'ThroughTags'});db['SmsInteraction'][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':'Users','through':_0xf2ca('0x12a'),'foreignKey':_0xf2ca('0x187')});db[_0xf2ca('0x5e')][_0xf2ca('0x11e')](db['User'],{'as':_0xf2ca('0x12')});db['SmsMessage']['belongsTo'](db[_0xf2ca('0x76')],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x15f')});db['SmsMessage'][_0xf2ca('0x11e')](db['SmsInteraction'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x176'),'foreignKey':_0xf2ca('0x187')});db['SmsMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x58')],{'as':_0xf2ca('0x16e'),'foreignKey':'SmsAccountId'});db[_0xf2ca('0x5f')]['belongsToMany'](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x189'),'foreignKey':'SmsQueueId'});db[_0xf2ca('0x5f')]['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0xf2ca('0x156')});db['OpenchannelAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x85')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db[_0xf2ca('0x61')][_0xf2ca('0x112')](db[_0xf2ca('0x83')],{'as':_0xf2ca('0x166'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x61')][_0xf2ca('0x112')](db[_0xf2ca('0x18b')],{'as':_0xf2ca('0x17c'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x61')][_0xf2ca('0x112')](db[_0xf2ca('0x18c')],{'as':_0xf2ca('0x159'),'foreignKey':_0xf2ca('0x18a')});db['OpenchannelAccount'][_0xf2ca('0x112')](db[_0xf2ca('0x62')],{'as':_0xf2ca('0x168'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x61')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x61')]['belongsTo'](db[_0xf2ca('0x16c')],{'as':_0xf2ca('0x17d'),'foreignKey':_0xf2ca('0x152')});db[_0xf2ca('0x61')]['belongsToMany'](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x13e')});db['OpenchannelApplication'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x62')]['belongsTo'](db[_0xf2ca('0x133')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x18d')});db[_0xf2ca('0x62')][_0xf2ca('0x11e')](db[_0xf2ca('0x61')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x62')][_0xf2ca('0x11e')](db['Interval'],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x62')]['belongsTo'](db[_0xf2ca('0x91')],{'onDelete':'restrict','foreignKey':_0xf2ca('0x186')});db[_0xf2ca('0x18b')][_0xf2ca('0x112')](db[_0xf2ca('0x18c')],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':'OpenchannelInteractionId'});db[_0xf2ca('0x18b')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x18b')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db[_0xf2ca('0x18b')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':'Owner','foreignKey':_0xf2ca('0x113')});db['OpenchannelInteraction'][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':'openchannel_interaction_has_tags','as':_0xf2ca('0x172')});db['OpenchannelInteraction'][_0xf2ca('0x120')](db['Tag'],{'through':_0xf2ca('0x18e'),'as':_0xf2ca('0x180')});db[_0xf2ca('0x18b')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':_0xf2ca('0x18f'),'foreignKey':_0xf2ca('0x190')});db[_0xf2ca('0x18c')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x12')});db[_0xf2ca('0x18c')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x15f')});db[_0xf2ca('0x18c')][_0xf2ca('0x11e')](db[_0xf2ca('0x18b')],{'onDelete':'cascade','as':_0xf2ca('0x176'),'foreignKey':_0xf2ca('0x190')});db[_0xf2ca('0x18c')][_0xf2ca('0x11e')](db[_0xf2ca('0x174')],{'as':_0xf2ca('0x174'),'foreignKey':_0xf2ca('0x182')});db[_0xf2ca('0x18c')][_0xf2ca('0x11e')](db[_0xf2ca('0x61')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x18a')});db[_0xf2ca('0x133')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x38'),'foreignKey':_0xf2ca('0x18d')});db[_0xf2ca('0x133')][_0xf2ca('0x120')](db[_0xf2ca('0xe9')],{'through':'team_has_openchannel_queues','as':_0xf2ca('0x156')});db[_0xf2ca('0x67')]['hasMany'](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':'ChatWebsiteId'});db[_0xf2ca('0x67')][_0xf2ca('0x112')](db[_0xf2ca('0x83')],{'as':_0xf2ca('0x166'),'foreignKey':_0xf2ca('0x191')});db['ChatWebsite'][_0xf2ca('0x112')](db[_0xf2ca('0x72')],{'as':_0xf2ca('0x192')});db[_0xf2ca('0x67')][_0xf2ca('0x112')](db[_0xf2ca('0x118')],{'as':_0xf2ca('0x17c')});db[_0xf2ca('0x67')][_0xf2ca('0x112')](db['ChatApplication'],{'as':_0xf2ca('0x168')});db[_0xf2ca('0x67')][_0xf2ca('0x112')](db[_0xf2ca('0x6d')],{'as':_0xf2ca('0x159')});db[_0xf2ca('0x67')][_0xf2ca('0x11e')](db['CmList'],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x67')][_0xf2ca('0x11e')](db[_0xf2ca('0x88')],{'as':_0xf2ca('0x88'),'foreignKey':_0xf2ca('0x17a')});db['ChatWebsite']['belongsTo'](db[_0xf2ca('0x16c')],{'as':'mandatoryDispositionPause','foreignKey':_0xf2ca('0x152')});db[_0xf2ca('0x67')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':'Agents','through':_0xf2ca('0x138')});db[_0xf2ca('0x68')][_0xf2ca('0x11e')](db[_0xf2ca('0x61')],{});db[_0xf2ca('0x68')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':'ListId'});db[_0xf2ca('0x68')][_0xf2ca('0x11e')](db['CmContact'],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x18b')],{});db[_0xf2ca('0x68')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xf2ca('0x68')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{});db[_0xf2ca('0x68')][_0xf2ca('0x11e')](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0xf2ca('0x113'),'onDelete':_0xf2ca('0x179')});db['ChatApplication']['belongsTo'](db[_0xf2ca('0x70')],{'as':'Queue','foreignKey':_0xf2ca('0x193'),'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x6a')][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'as':'Website','foreignKey':_0xf2ca('0x191'),'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x6a')]['belongsTo'](db[_0xf2ca('0x91')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x186')});db[_0xf2ca('0x118')]['hasMany'](db['ChatMessage'],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x194')});db[_0xf2ca('0x118')]['belongsTo'](db[_0xf2ca('0x67')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x191')});db[_0xf2ca('0x118')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x118')][_0xf2ca('0x11e')](db['User'],{'as':_0xf2ca('0x170'),'foreignKey':'UserId'});db[_0xf2ca('0x118')][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x195'),'as':'Tags'});db[_0xf2ca('0x118')]['belongsToMany'](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x195'),'as':_0xf2ca('0x180')});db[_0xf2ca('0x118')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':_0xf2ca('0x129'),'foreignKey':_0xf2ca('0x194')});db[_0xf2ca('0x6d')]['belongsTo'](db['User'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x12')});db[_0xf2ca('0x6d')][_0xf2ca('0x11e')](db['CmContact'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x6d')][_0xf2ca('0x11e')](db['ChatInteraction'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x176'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x174')],{'as':'Attachment','foreignKey':_0xf2ca('0x182')});db['ChatMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x191')});db[_0xf2ca('0x6e')][_0xf2ca('0x11e')](db['CmContact'],{'onDelete':_0xf2ca('0x111'),'as':'Contact','foreignKey':_0xf2ca('0x16f')});db['ChatOfflineMessage'][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x191')});db[_0xf2ca('0x70')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x130'),'hooks':!![]});db['ChatQueue'][_0xf2ca('0x120')](db[_0xf2ca('0xe9')],{'through':_0xf2ca('0x196'),'as':_0xf2ca('0x156')});db[_0xf2ca('0x71')][_0xf2ca('0x112')](db[_0xf2ca('0xd1')],{'as':_0xf2ca('0x159'),'foreignKey':_0xf2ca('0x197'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x71')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x148'),'through':'chat_group_has_users'});db[_0xf2ca('0x72')][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'as':_0xf2ca('0x198'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x122'),'foreignKey':_0xf2ca('0x199')});db[_0xf2ca('0x76')]['hasMany'](db['CmHopper'],{'as':_0xf2ca('0x14b'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x76')][_0xf2ca('0x112')](db[_0xf2ca('0x79')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xf2ca('0x76')][_0xf2ca('0x112')](db['CmHopperHistory'],{'as':_0xf2ca('0x14d'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x76')][_0xf2ca('0x112')](db[_0xf2ca('0x7c')],{'as':_0xf2ca('0x7c'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x76')]['hasMany'](db[_0xf2ca('0xd6')],{'as':_0xf2ca('0x14e'),'foreignKey':'ContactId'});db[_0xf2ca('0x76')][_0xf2ca('0x112')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xf2ca('0x76')]['hasMany'](db[_0xf2ca('0x118')],{'as':_0xf2ca('0x128'),'foreignKey':_0xf2ca('0x16f'),'onDelete':'restrict'});db['CmContact'][_0xf2ca('0x112')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xf2ca('0x16f'),'onDelete':_0xf2ca('0x179')});db['CmContact'][_0xf2ca('0x112')](db[_0xf2ca('0x52')],{'as':_0xf2ca('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xf2ca('0x76')][_0xf2ca('0x112')](db[_0xf2ca('0x44')],{'as':_0xf2ca('0x126'),'foreignKey':_0xf2ca('0x16f'),'onDelete':'restrict'});db[_0xf2ca('0x76')]['belongsTo'](db[_0xf2ca('0x74')],{'as':'Company','foreignKey':_0xf2ca('0x199')});db[_0xf2ca('0x76')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':'ListId','onDelete':_0xf2ca('0x111')});db['CmContact'][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':_0xf2ca('0x123')});db[_0xf2ca('0x76')][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'as':'Tags','through':_0xf2ca('0x19a')});db[_0xf2ca('0x76')][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xf2ca('0x14a')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x14a')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x19b'),'foreignKey':_0xf2ca('0x113')});db['CmHopper']['belongsTo'](db[_0xf2ca('0x12c')],{'as':'Queue','foreignKey':_0xf2ca('0x149'),'onDelete':'cascade'});db[_0xf2ca('0x14a')]['belongsTo'](db[_0xf2ca('0xed')],{'as':_0xf2ca('0xed'),'foreignKey':_0xf2ca('0x19c'),'onDelete':_0xf2ca('0x111')});db['CmHopper'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x170'),'foreignKey':'OwnerId'});db[_0xf2ca('0x78')][_0xf2ca('0x11e')](db['CmContact'],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0xf2ca('0x124')],{'as':'List','foreignKey':'ListId','onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x78')][_0xf2ca('0x11e')](db['VoiceQueue'],{'as':_0xf2ca('0x19d'),'foreignKey':_0xf2ca('0x149'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x78')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0xf2ca('0x19c'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x81')]['hasMany'](db[_0xf2ca('0x86')],{'as':{'plural':_0xf2ca('0x19e'),'singular':_0xf2ca('0x19f')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xf2ca('0x81')][_0xf2ca('0x112')](db['Condition'],{'as':{'plural':'Any','singular':_0xf2ca('0x1a0')},'foreignKey':'AutomationAnyId','onDelete':_0xf2ca('0x111'),'hooks':!![]});db[_0xf2ca('0x81')][_0xf2ca('0x112')](db[_0xf2ca('0x7f')],{'as':_0xf2ca('0x1a1'),'foreignKey':_0xf2ca('0x1a2'),'onDelete':_0xf2ca('0x111'),'hooks':!![]});db[_0xf2ca('0x88')]['hasMany'](db[_0xf2ca('0x88')],{'as':'Intervals','foreignKey':_0xf2ca('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xf2ca('0x88')]['hasMany'](db[_0xf2ca('0x17')],{'as':_0xf2ca('0x115'),'foreignKey':_0xf2ca('0x17a'),'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x88')][_0xf2ca('0x112')](db['MailApplication'],{'as':_0xf2ca('0x1a3'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x88')]['hasMany'](db['ChatApplication'],{'as':_0xf2ca('0x1a4'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x88')]['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0xf2ca('0x112')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x8d')]['belongsTo'](db[_0xf2ca('0x160')],{});db[_0xf2ca('0x8d')][_0xf2ca('0x11e')](db['AnalyticDefaultReport'],{'foreignKey':_0xf2ca('0x1a5')});db[_0xf2ca('0x8d')]['belongsTo'](db[_0xf2ca('0x1a6')],{'foreignKey':_0xf2ca('0x1a7')});db[_0xf2ca('0x8f')][_0xf2ca('0x120')](db[_0xf2ca('0x19')],{'as':_0xf2ca('0x1a8'),'through':_0xf2ca('0x147'),'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x91')][_0xf2ca('0x120')](db[_0xf2ca('0x76')],{'through':_0xf2ca('0x19a')});db[_0xf2ca('0x91')][_0xf2ca('0x120')](db['ChatInteraction'],{'through':_0xf2ca('0x195')});db[_0xf2ca('0x91')]['belongsToMany'](db[_0xf2ca('0x44')],{'through':_0xf2ca('0x171')});db[_0xf2ca('0x91')][_0xf2ca('0x120')](db['SmsInteraction'],{'through':_0xf2ca('0x188')});db[_0xf2ca('0x91')]['belongsToMany'](db[_0xf2ca('0x52')],{'through':_0xf2ca('0x17f')});db[_0xf2ca('0x91')][_0xf2ca('0x120')](db[_0xf2ca('0x18b')],{'through':_0xf2ca('0x18e')});db[_0xf2ca('0x91')][_0xf2ca('0x120')](db['WhatsappInteraction'],{'through':_0xf2ca('0x1a9')});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0xf2ca('0x1aa'),'singular':'AllCondition'},'foreignKey':_0xf2ca('0x1ab'),'onDelete':_0xf2ca('0x111'),'hooks':!![]});db[_0xf2ca('0x94')]['hasMany'](db[_0xf2ca('0x86')],{'as':{'plural':_0xf2ca('0x1ac'),'singular':_0xf2ca('0x1ad')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xf2ca('0x94')][_0xf2ca('0x112')](db['Action'],{'as':'Actions','foreignKey':_0xf2ca('0x1ae'),'onDelete':_0xf2ca('0x111'),'hooks':!![]});db[_0xf2ca('0x1a6')][_0xf2ca('0x112')](db[_0xf2ca('0x9f')],{'as':'Fields','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1a7'),'hooks':!![]});db[_0xf2ca('0x9b')][_0xf2ca('0x112')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1a5')});db['AnalyticMetric']['hasMany'](db[_0xf2ca('0x9f')],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b0')});db[_0xf2ca('0x9f')][_0xf2ca('0x11e')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xf2ca('0x1b1')][_0xf2ca('0x112')](db['SalesforceConfiguration'],{'as':_0xf2ca('0x1b2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xf2ca('0x1b3')][_0xf2ca('0x112')](db['SalesforceField'],{'as':_0xf2ca('0x1b4'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0x1b3')]['hasMany'](db[_0xf2ca('0xa3')],{'as':'Descriptions','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0x1b3')]['hasMany'](db['SalesforceField'],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b7')});db['SalesforceConfiguration'][_0xf2ca('0x11e')](db['SalesforceAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db['SalesforceField'][_0xf2ca('0x112')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xf2ca('0x1b5')});db['SalesforceField'][_0xf2ca('0x112')](db[_0xf2ca('0xa3')],{'as':'Description','foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xa3')][_0xf2ca('0x112')](db[_0xf2ca('0xa3')],{'as':_0xf2ca('0x1b9'),'foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xa3')][_0xf2ca('0x11e')](db['Variable'],{'as':_0xf2ca('0x1ba'),'foreignKey':'VariableId'});db[_0xf2ca('0xa5')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xf2ca('0x1b4'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xa7')][_0xf2ca('0x112')](db[_0xf2ca('0xa9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xf2ca('0xa7')][_0xf2ca('0x112')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xa7')][_0xf2ca('0x11e')](db[_0xf2ca('0xa5')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xa9')]['hasMany'](db[_0xf2ca('0xa9')],{'as':_0xf2ca('0x1bb'),'foreignKey':'SubjectId'});db[_0xf2ca('0xa9')][_0xf2ca('0x112')](db['SugarcrmField'],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xa9')][_0xf2ca('0x112')](db[_0xf2ca('0xa9')],{'as':_0xf2ca('0x1b9'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':_0xf2ca('0x1bd')});db[_0xf2ca('0xaa')][_0xf2ca('0x112')](db[_0xf2ca('0xac')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db['DeskConfiguration'][_0xf2ca('0x112')](db['DeskField'],{'as':_0xf2ca('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xf2ca('0xad')],{'as':_0xf2ca('0x1be'),'onDelete':_0xf2ca('0x111'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xf2ca('0x112')](db[_0xf2ca('0xad')],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b7')});db['DeskConfiguration'][_0xf2ca('0x11e')](db[_0xf2ca('0xaa')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xac')]['belongsToMany'](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x1bf')});db[_0xf2ca('0xad')][_0xf2ca('0x112')](db['DeskField'],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db['DeskField']['hasMany'](db[_0xf2ca('0xad')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xad')][_0xf2ca('0x112')](db[_0xf2ca('0xad')],{'as':_0xf2ca('0x1b9'),'foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xad')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':_0xf2ca('0x1bd')});db[_0xf2ca('0xaf')][_0xf2ca('0x112')](db[_0xf2ca('0x1c0')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db['ZohoConfiguration'][_0xf2ca('0x112')](db[_0xf2ca('0x1c1')],{'as':'Subjects','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0x1c0')][_0xf2ca('0x112')](db[_0xf2ca('0x1c1')],{'as':_0xf2ca('0x1be'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xf2ca('0x112')](db['ZohoField'],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b7')});db['ZohoConfiguration'][_0xf2ca('0x11e')](db['ZohoAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db['ZohoField']['hasMany'](db[_0xf2ca('0x1c1')],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0x1c1')]['hasMany'](db[_0xf2ca('0x1c1')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0x1c1')][_0xf2ca('0x112')](db[_0xf2ca('0x1c1')],{'as':'Field','foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0x1c1')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':_0xf2ca('0x1bd')});db['ZendeskAccount']['hasMany'](db[_0xf2ca('0xb5')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xb5')][_0xf2ca('0x112')](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1b4'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xb5')][_0xf2ca('0x112')](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1be'),'foreignKey':_0xf2ca('0x1b6')});db['ZendeskConfiguration']['hasMany'](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1af'),'foreignKey':'FieldId'});db[_0xf2ca('0xb5')][_0xf2ca('0x11e')](db[_0xf2ca('0xb3')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xb5')]['belongsToMany'](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x1c2')});db[_0xf2ca('0xb6')][_0xf2ca('0x112')](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1bb'),'foreignKey':'SubjectId'});db['ZendeskField'][_0xf2ca('0x112')](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xb6')][_0xf2ca('0x112')](db[_0xf2ca('0xb6')],{'as':_0xf2ca('0x1b9'),'foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xb6')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':_0xf2ca('0x1bd')});db[_0xf2ca('0xb8')][_0xf2ca('0x112')](db[_0xf2ca('0xb9')],{'as':_0xf2ca('0x1b2'),'onDelete':'cascade','foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xb9')]['hasMany'](db[_0xf2ca('0xbb')],{'as':_0xf2ca('0x1b4'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xb9')][_0xf2ca('0x112')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xb9')][_0xf2ca('0x112')](db['FreshdeskField'],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xb9')][_0xf2ca('0x11e')](db[_0xf2ca('0xb8')],{'as':_0xf2ca('0x16e'),'foreignKey':'AccountId'});db[_0xf2ca('0xb9')][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x1c3')});db[_0xf2ca('0xbb')][_0xf2ca('0x112')](db[_0xf2ca('0xbb')],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xbb')][_0xf2ca('0x112')](db['FreshdeskField'],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db['FreshdeskField'][_0xf2ca('0x112')](db['FreshdeskField'],{'as':_0xf2ca('0x1b9'),'foreignKey':'FieldId'});db[_0xf2ca('0xbb')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':'Variable','foreignKey':_0xf2ca('0x1bd')});db[_0xf2ca('0x1c4')][_0xf2ca('0x112')](db[_0xf2ca('0xbe')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xbe')]['hasMany'](db[_0xf2ca('0x1c5')],{'as':_0xf2ca('0x1b4'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xbe')][_0xf2ca('0x112')](db[_0xf2ca('0x1c5')],{'as':'Descriptions','foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xbe')][_0xf2ca('0x112')](db[_0xf2ca('0x1c5')],{'as':'Fields','foreignKey':_0xf2ca('0x1b7')});db[_0xf2ca('0xbe')][_0xf2ca('0x11e')](db[_0xf2ca('0x1c4')],{'as':_0xf2ca('0x16e'),'foreignKey':'AccountId'});db[_0xf2ca('0x1c5')][_0xf2ca('0x112')](db[_0xf2ca('0x1c5')],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0x1c5')]['hasMany'](db[_0xf2ca('0x1c5')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0x1c5')][_0xf2ca('0x112')](db[_0xf2ca('0x1c5')],{'as':_0xf2ca('0x1b9'),'foreignKey':'FieldId'});db[_0xf2ca('0x1c5')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':'VariableId'});db[_0xf2ca('0xc1')][_0xf2ca('0x112')](db[_0xf2ca('0xc2')],{'as':'Configurations','onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xc2')][_0xf2ca('0x112')](db['ServicenowField'],{'as':_0xf2ca('0x1b4'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xc2')][_0xf2ca('0x112')](db[_0xf2ca('0xc3')],{'as':_0xf2ca('0x1be'),'foreignKey':'DescriptionId'});db[_0xf2ca('0xc2')][_0xf2ca('0x112')](db[_0xf2ca('0xc3')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf2ca('0xc2')][_0xf2ca('0x11e')](db[_0xf2ca('0xc1')],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xc3')][_0xf2ca('0x112')](db[_0xf2ca('0xc3')],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xc3')][_0xf2ca('0x112')](db[_0xf2ca('0xc3')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xc3')]['hasMany'](db[_0xf2ca('0xc3')],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db[_0xf2ca('0x1ba')],{'as':'Variable','foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0xf2ca('0xc7')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0xc7')][_0xf2ca('0x112')](db[_0xf2ca('0xc9')],{'as':_0xf2ca('0x1b4'),'onDelete':'cascade','foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0xc7')][_0xf2ca('0x112')](db[_0xf2ca('0xc9')],{'as':_0xf2ca('0x1be'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xc7')][_0xf2ca('0x112')](db['Dynamics365Field'],{'as':_0xf2ca('0x1af'),'onDelete':_0xf2ca('0x111'),'foreignKey':'FieldId'});db[_0xf2ca('0xc7')][_0xf2ca('0x11e')](db[_0xf2ca('0xc5')],{'as':'Account','foreignKey':'AccountId'});db[_0xf2ca('0xc9')][_0xf2ca('0x112')](db[_0xf2ca('0xc9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xf2ca('0xc9')][_0xf2ca('0x112')](db[_0xf2ca('0xc9')],{'as':_0xf2ca('0x1bc'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0xc9')][_0xf2ca('0x112')](db['Dynamics365Field'],{'as':_0xf2ca('0x1b9'),'foreignKey':'FieldId'});db[_0xf2ca('0xc9')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':'VariableId'});db[_0xf2ca('0xcb')][_0xf2ca('0x112')](db[_0xf2ca('0x1c6')],{'as':_0xf2ca('0x1b2'),'onDelete':_0xf2ca('0x111'),'foreignKey':'AccountId'});db[_0xf2ca('0x1c6')]['hasMany'](db[_0xf2ca('0x1c7')],{'as':_0xf2ca('0x1b4'),'foreignKey':_0xf2ca('0x1b5')});db[_0xf2ca('0x1c6')][_0xf2ca('0x112')](db[_0xf2ca('0x1c7')],{'as':_0xf2ca('0x1be'),'foreignKey':_0xf2ca('0x1b6')});db[_0xf2ca('0x1c6')]['hasMany'](db['FreshsalesField'],{'as':_0xf2ca('0x1af'),'foreignKey':_0xf2ca('0x1b7')});db['FreshsalesConfiguration'][_0xf2ca('0x11e')](db[_0xf2ca('0xcb')],{'as':'Account','foreignKey':_0xf2ca('0x1b8')});db[_0xf2ca('0x1c7')][_0xf2ca('0x112')](db[_0xf2ca('0x1c7')],{'as':_0xf2ca('0x1bb'),'foreignKey':_0xf2ca('0x1b5')});db['FreshsalesField'][_0xf2ca('0x112')](db[_0xf2ca('0x1c7')],{'as':_0xf2ca('0x1bc'),'foreignKey':'DescriptionId'});db[_0xf2ca('0x1c7')]['hasMany'](db['FreshsalesField'],{'as':_0xf2ca('0x1b9'),'foreignKey':'FieldId'});db[_0xf2ca('0x1c7')][_0xf2ca('0x11e')](db[_0xf2ca('0x1ba')],{'as':_0xf2ca('0x1ba'),'foreignKey':_0xf2ca('0x1bd')});db[_0xf2ca('0x1c8')]['belongsTo'](db[_0xf2ca('0x67')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x1c8')]['belongsTo'](db[_0xf2ca('0x76')],{'as':'Contact','foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x1c8')][_0xf2ca('0x11e')](db[_0xf2ca('0x118')],{});db[_0xf2ca('0x1c8')][_0xf2ca('0x11e')](db['ChatMessage'],{});db[_0xf2ca('0x1c8')]['belongsTo'](db[_0xf2ca('0x12')],{});db['ChatQueueReport']['belongsTo'](db[_0xf2ca('0x70')],{});db[_0xf2ca('0xd1')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x111'),'foreignKey':'FromId'});db[_0xf2ca('0xd1')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':_0xf2ca('0x111'),'foreignKey':'ToId'});db[_0xf2ca('0xd6')][_0xf2ca('0x112')](db['JscriptyQuestionReport'],{'foreignKey':_0xf2ca('0x1c9'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0xd6')][_0xf2ca('0x112')](db[_0xf2ca('0xd2')],{'foreignKey':_0xf2ca('0x1c9'),'onDelete':'cascade'});db['SmsQueueReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x58')],{});db[_0xf2ca('0xd8')]['belongsTo'](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0xd8')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db[_0xf2ca('0xd8')][_0xf2ca('0x11e')](db[_0xf2ca('0x5c')],{});db[_0xf2ca('0xd8')][_0xf2ca('0x11e')](db[_0xf2ca('0x5e')],{});db[_0xf2ca('0xd8')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{});db['SmsQueueReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x5f')],{});db[_0xf2ca('0x1ca')][_0xf2ca('0x112')](db[_0xf2ca('0xd6')],{'foreignKey':'ProjectId'});db[_0xf2ca('0x1ca')][_0xf2ca('0x112')](db[_0xf2ca('0xd4')],{'foreignKey':_0xf2ca('0x1cb')});db[_0xf2ca('0x1ca')][_0xf2ca('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0xf2ca('0x1cb')});db[_0xf2ca('0xe3')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':'user_has_square_projects'});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':'user_has_teams'});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x12c')],{'through':_0xf2ca('0x157'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db[_0xf2ca('0x41')],{'through':_0xf2ca('0x16d'),'as':_0xf2ca('0x12e')});db['Team'][_0xf2ca('0x120')](db[_0xf2ca('0x70')],{'through':_0xf2ca('0x196'),'as':'ChatQueues'});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x131')],{'through':_0xf2ca('0x183'),'as':_0xf2ca('0x1cc')});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x5f')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x133')],{'through':_0xf2ca('0x1cd'),'as':_0xf2ca('0x134')});db[_0xf2ca('0xe9')][_0xf2ca('0x120')](db[_0xf2ca('0x10c')],{'through':_0xf2ca('0x1ce'),'as':_0xf2ca('0x1cf')});db[_0xf2ca('0xed')][_0xf2ca('0x112')](db[_0xf2ca('0x14a')],{'as':_0xf2ca('0x14b'),'foreignKey':_0xf2ca('0x19c')});db['Campaign'][_0xf2ca('0x112')](db['CmHopperFinal'],{'as':_0xf2ca('0x116'),'foreignKey':_0xf2ca('0x19c')});db['Campaign'][_0xf2ca('0x112')](db['CmHopperHistory'],{'as':_0xf2ca('0x14d'),'foreignKey':_0xf2ca('0x19c')});db[_0xf2ca('0xed')]['hasMany'](db[_0xf2ca('0x78')],{'as':'HopperBlacks','foreignKey':_0xf2ca('0x19c')});db[_0xf2ca('0xed')][_0xf2ca('0x11e')](db[_0xf2ca('0x2c')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xf2ca('0xed')][_0xf2ca('0x11e')](db[_0xf2ca('0x2c')],{'as':_0xf2ca('0x150'),'foreignKey':'TrunkBackupId'});db[_0xf2ca('0xed')]['belongsTo'](db[_0xf2ca('0x88')],{'as':_0xf2ca('0x88'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0xed')][_0xf2ca('0x11e')](db[_0xf2ca('0xe3')],{'as':_0xf2ca('0xe3'),'foreignKey':_0xf2ca('0x1d0')});db['Campaign'][_0xf2ca('0x120')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x153'),'through':_0xf2ca('0x1d1')});db[_0xf2ca('0xed')][_0xf2ca('0x120')](db['CmList'],{'as':_0xf2ca('0x158'),'through':_0xf2ca('0x1d2')});db[_0xf2ca('0xf3')][_0xf2ca('0x11e')](db[_0xf2ca('0x167')],{});db[_0xf2ca('0xf3')][_0xf2ca('0x11e')](db['MailInteraction'],{});db[_0xf2ca('0xf3')]['belongsTo'](db[_0xf2ca('0x160')],{'foreignKey':_0xf2ca('0x1d3'),'as':_0xf2ca('0x1d4')});db['MailTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d5'),'as':_0xf2ca('0x1d6')});db[_0xf2ca('0xf3')][_0xf2ca('0x11e')](db['User'],{'foreignKey':_0xf2ca('0x1d7'),'as':_0xf2ca('0x1d8')});db[_0xf2ca('0xf3')][_0xf2ca('0x11e')](db[_0xf2ca('0x41')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xf2ca('0xf3')][_0xf2ca('0x11e')](db[_0xf2ca('0x160')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xf2ca('0xf5')][_0xf2ca('0x11e')](db[_0xf2ca('0x6d')],{});db['ChatTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x118')],{});db[_0xf2ca('0xf5')][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'foreignKey':_0xf2ca('0x1d9'),'as':'FromAccount'});db[_0xf2ca('0xf5')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d5'),'as':'FromAgent'});db['ChatTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d7'),'as':_0xf2ca('0x1d8')});db[_0xf2ca('0xf5')][_0xf2ca('0x11e')](db[_0xf2ca('0x70')],{'foreignKey':_0xf2ca('0x1da'),'as':_0xf2ca('0x1db')});db[_0xf2ca('0xf5')][_0xf2ca('0x11e')](db[_0xf2ca('0x67')],{'foreignKey':_0xf2ca('0x1dc'),'as':_0xf2ca('0x1dd')});db[_0xf2ca('0xf7')][_0xf2ca('0x11e')](db['FaxMessage'],{});db[_0xf2ca('0xf7')]['belongsTo'](db[_0xf2ca('0x52')],{});db[_0xf2ca('0xf7')][_0xf2ca('0x11e')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xf2ca('0x1d4')});db[_0xf2ca('0xf7')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d5'),'as':_0xf2ca('0x1d6')});db[_0xf2ca('0xf7')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d7'),'as':_0xf2ca('0x1d8')});db[_0xf2ca('0xf7')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xf2ca('0x1de'),'as':_0xf2ca('0x1db')});db[_0xf2ca('0xf7')][_0xf2ca('0x11e')](db[_0xf2ca('0x4e')],{'foreignKey':_0xf2ca('0x1df'),'as':_0xf2ca('0x1dd')});db[_0xf2ca('0x1e0')]['belongsTo'](db[_0xf2ca('0x18c')],{});db[_0xf2ca('0x1e0')][_0xf2ca('0x11e')](db[_0xf2ca('0x18b')],{});db[_0xf2ca('0x1e0')][_0xf2ca('0x11e')](db[_0xf2ca('0x61')],{'foreignKey':'FromOpenchannelAccountId','as':_0xf2ca('0x1d4')});db[_0xf2ca('0x1e0')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d5'),'as':_0xf2ca('0x1d6')});db['OpenchannelTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':'ToUserId','as':_0xf2ca('0x1d8')});db[_0xf2ca('0x1e0')][_0xf2ca('0x11e')](db[_0xf2ca('0x133')],{'foreignKey':_0xf2ca('0x1e1'),'as':_0xf2ca('0x1db')});db['OpenchannelTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x61')],{'foreignKey':_0xf2ca('0x1e2'),'as':_0xf2ca('0x1dd')});db[_0xf2ca('0xf9')][_0xf2ca('0x11e')](db[_0xf2ca('0x5e')],{});db[_0xf2ca('0xf9')][_0xf2ca('0x11e')](db[_0xf2ca('0x5c')],{});db['SmsTransferReport']['belongsTo'](db[_0xf2ca('0x58')],{'foreignKey':_0xf2ca('0x1e3'),'as':_0xf2ca('0x1d4')});db[_0xf2ca('0xf9')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d5'),'as':_0xf2ca('0x1d6')});db[_0xf2ca('0xf9')][_0xf2ca('0x11e')](db['User'],{'foreignKey':_0xf2ca('0x1d7'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0xf2ca('0x1e4'),'as':_0xf2ca('0x1db')});db['SmsTransferReport'][_0xf2ca('0x11e')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xf2ca('0x1dd')});db[_0xf2ca('0x124')][_0xf2ca('0x112')](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x124')]['hasMany'](db['CmCustomField'],{'as':_0xf2ca('0x1e5'),'foreignKey':_0xf2ca('0x16a')});db['CmList']['hasMany'](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x122'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x16a')});db['CmList'][_0xf2ca('0x112')](db[_0xf2ca('0x79')],{'as':_0xf2ca('0x116'),'foreignKey':_0xf2ca('0x16a')});db['CmList'][_0xf2ca('0x112')](db[_0xf2ca('0x14c')],{'as':_0xf2ca('0x1e6'),'foreignKey':'ListId'});db[_0xf2ca('0x124')][_0xf2ca('0x112')](db[_0xf2ca('0x7c')],{'as':_0xf2ca('0x7c'),'foreignKey':'ListId'});db[_0xf2ca('0x124')][_0xf2ca('0x120')](db['VoiceQueue'],{'as':_0xf2ca('0x1e7'),'through':_0xf2ca('0x154')});db[_0xf2ca('0x124')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x135')});db[_0xf2ca('0xfc')]['hasMany'](db[_0xf2ca('0x17')],{'as':_0xf2ca('0x115'),'onDelete':_0xf2ca('0x111')});db['VoicePrefix'][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x1e8')});db['UserProfile'][_0xf2ca('0x112')](db[_0xf2ca('0x12')],{'as':'Users','foreignKey':_0xf2ca('0x11f')});db['UserProfile'][_0xf2ca('0x112')](db[_0xf2ca('0xfe')],{'as':_0xf2ca('0x1e9'),'foreignKey':_0xf2ca('0x11f'),'onDelete':_0xf2ca('0x111')});db['UserProfileSection'][_0xf2ca('0x112')](db[_0xf2ca('0x1ea')],{'as':_0xf2ca('0x1eb'),'foreignKey':_0xf2ca('0x1ec'),'onDelete':_0xf2ca('0x111')});db[_0xf2ca('0x103')][_0xf2ca('0x112')](db[_0xf2ca('0x85')],{'as':_0xf2ca('0x165'),'foreignKey':_0xf2ca('0x1ed')});db[_0xf2ca('0x103')]['hasMany'](db[_0xf2ca('0x83')],{'as':'Answers','foreignKey':_0xf2ca('0x1ed')});db[_0xf2ca('0x103')][_0xf2ca('0x112')](db[_0xf2ca('0x108')],{'as':_0xf2ca('0x159'),'foreignKey':_0xf2ca('0x1ed')});db[_0xf2ca('0x103')][_0xf2ca('0x112')](db[_0xf2ca('0x106')],{'as':_0xf2ca('0x17c')});db[_0xf2ca('0x103')][_0xf2ca('0x112')](db[_0xf2ca('0x1ee')],{'as':_0xf2ca('0x168')});db['WhatsappAccount']['belongsTo'](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xf2ca('0x11e')](db[_0xf2ca('0x16c')],{'as':_0xf2ca('0x17d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf2ca('0x103')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':_0xf2ca('0x142')});db[_0xf2ca('0x1ee')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'onDelete':'restrict'});db[_0xf2ca('0x1ee')][_0xf2ca('0x11e')](db[_0xf2ca('0x10c')],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x1ee')][_0xf2ca('0x11e')](db['WhatsappAccount'],{'onDelete':_0xf2ca('0x179')});db[_0xf2ca('0x1ee')][_0xf2ca('0x11e')](db['Interval'],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x17a')});db[_0xf2ca('0x1ee')][_0xf2ca('0x11e')](db[_0xf2ca('0x91')],{'onDelete':_0xf2ca('0x179'),'foreignKey':_0xf2ca('0x186')});db[_0xf2ca('0x106')][_0xf2ca('0x112')](db[_0xf2ca('0x108')],{'as':_0xf2ca('0x159'),'onDelete':_0xf2ca('0x111'),'foreignKey':_0xf2ca('0x1ef')});db[_0xf2ca('0x106')][_0xf2ca('0x11e')](db['WhatsappAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':_0xf2ca('0x1ed')});db[_0xf2ca('0x106')][_0xf2ca('0x11e')](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':'ContactId'});db[_0xf2ca('0x106')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x170'),'foreignKey':'UserId'});db[_0xf2ca('0x106')][_0xf2ca('0x120')](db['Tag'],{'through':_0xf2ca('0x1a9'),'as':'Tags'});db['WhatsappInteraction'][_0xf2ca('0x120')](db[_0xf2ca('0x91')],{'through':_0xf2ca('0x1a9'),'as':_0xf2ca('0x180')});db[_0xf2ca('0x106')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x173'),'through':_0xf2ca('0x12b'),'foreignKey':_0xf2ca('0x1ef')});db['WhatsappMessage']['belongsTo'](db[_0xf2ca('0x12')],{'as':'User'});db[_0xf2ca('0x108')][_0xf2ca('0x11e')](db['CmContact'],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x15f')});db[_0xf2ca('0x108')]['belongsTo'](db[_0xf2ca('0x106')],{'onDelete':_0xf2ca('0x111'),'as':_0xf2ca('0x176'),'foreignKey':_0xf2ca('0x1ef')});db[_0xf2ca('0x108')][_0xf2ca('0x11e')](db['WhatsappAccount'],{'as':_0xf2ca('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0xf2ca('0x1f0')][_0xf2ca('0x11e')](db[_0xf2ca('0x103')],{});db[_0xf2ca('0x1f0')][_0xf2ca('0x11e')](db[_0xf2ca('0x124')],{'as':_0xf2ca('0x169'),'foreignKey':_0xf2ca('0x16a')});db[_0xf2ca('0x1f0')]['belongsTo'](db[_0xf2ca('0x76')],{'as':_0xf2ca('0x15f'),'foreignKey':_0xf2ca('0x16f')});db[_0xf2ca('0x1f0')][_0xf2ca('0x11e')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0xf2ca('0x11e')](db['WhatsappQueue'],{});db[_0xf2ca('0x1f0')][_0xf2ca('0x11e')](db[_0xf2ca('0x108')],{});db[_0xf2ca('0x1f0')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{});db[_0xf2ca('0x10b')][_0xf2ca('0x11e')](db[_0xf2ca('0x108')],{});db[_0xf2ca('0x10b')]['belongsTo'](db[_0xf2ca('0x106')],{});db[_0xf2ca('0x10b')][_0xf2ca('0x11e')](db[_0xf2ca('0x103')],{'foreignKey':_0xf2ca('0x1f1'),'as':_0xf2ca('0x1d4')});db[_0xf2ca('0x10b')][_0xf2ca('0x11e')](db[_0xf2ca('0x103')],{'foreignKey':'ToWhatsappAccountId','as':_0xf2ca('0x1dd')});db[_0xf2ca('0x10b')][_0xf2ca('0x11e')](db[_0xf2ca('0x10c')],{'foreignKey':_0xf2ca('0x1f2'),'as':_0xf2ca('0x1db')});db['WhatsappTransferReport'][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':'FromUserId','as':_0xf2ca('0x1d6')});db[_0xf2ca('0x10b')][_0xf2ca('0x11e')](db[_0xf2ca('0x12')],{'foreignKey':_0xf2ca('0x1d7'),'as':_0xf2ca('0x1d8')});db[_0xf2ca('0x10c')][_0xf2ca('0x120')](db[_0xf2ca('0x12')],{'as':_0xf2ca('0x155'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xf2ca('0x10c')][_0xf2ca('0x120')](db[_0xf2ca('0xe9')],{'through':_0xf2ca('0x1ce'),'as':_0xf2ca('0x156')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b33451b..67718a1 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf14=['./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./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/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','sendFile','resolve','get','appPath','express','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','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue'];(function(_0x8ea4a5,_0x35ba05){var _0x35dc6a=function(_0x50de65){while(--_0x50de65){_0x8ea4a5['push'](_0x8ea4a5['shift']());}};_0x35dc6a(++_0x35ba05);}(_0xdf14,0xc6));var _0x4df1=function(_0xca0a5e,_0x634b61){_0xca0a5e=_0xca0a5e-0x0;var _0x38e865=_0xdf14[_0xca0a5e];return _0x38e865;};'use strict';var path=require('path');var express=require(_0x4df1('0x0'));var ewinston=require('express-winston');var util=require(_0x4df1('0x1'));var errors=require(_0x4df1('0x2'));var config=require(_0x4df1('0x3'));var logger=require(_0x4df1('0x4'))(_0x4df1('0x5'));var authLogger=require(_0x4df1('0x4'))(_0x4df1('0x6'));exports[_0x4df1('0x7')]=function(_0x21c347){_0x21c347[_0x4df1('0x8')](ewinston[_0x4df1('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5b3db5,_0x7d977c){return util[_0x4df1('0xa')](_0x4df1('0xb'),_0x5b3db5[_0x4df1('0xc')],_0x5b3db5[_0x4df1('0xd')][_0x4df1('0xe')]?_0x5b3db5[_0x4df1('0xd')][_0x4df1('0xe')]:_0x5b3db5['connection'][_0x4df1('0xf')]||_0x5b3db5['ip'],_0x5b3db5[_0x4df1('0x10')],_0x7d977c[_0x4df1('0x11')],_0x7d977c[_0x4df1('0x12')],_0x5b3db5[_0x4df1('0x13')]?_0x5b3db5[_0x4df1('0x13')]['id']:null,_0x5b3db5[_0x4df1('0x13')]?_0x5b3db5[_0x4df1('0x13')][_0x4df1('0x14')]:null,_0x5b3db5['user']?_0x5b3db5['user'][_0x4df1('0x15')]:null);}}));_0x21c347[_0x4df1('0x8')](ewinston[_0x4df1('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x584620,_0xcd6bcf){var _0x9df3a7=_0x4df1('0x16');if(_0x584620[_0x4df1('0x17')]&&_0x584620[_0x4df1('0x17')]['device']&&_0x584620[_0x4df1('0x17')]['agent_id']){_0x9df3a7=_0x4df1('0x18');}return util[_0x4df1('0xa')](_0x9df3a7,_0x584620[_0x4df1('0xc')],_0x584620['headers'][_0x4df1('0xe')]?_0x584620['headers'][_0x4df1('0xe')]:_0x584620['connection'][_0x4df1('0xf')]||_0x584620['ip'],_0x584620[_0x4df1('0x10')],_0xcd6bcf[_0x4df1('0x11')],_0xcd6bcf[_0x4df1('0x12')],_0x584620['user']?_0x584620['user']['id']:null,_0x584620[_0x4df1('0x13')]?_0x584620[_0x4df1('0x13')]['name']:null,_0x584620[_0x4df1('0x13')]?_0x584620['user'][_0x4df1('0x15')]:null,_0x584620[_0x4df1('0x17')]&&_0x584620['body']['device']?_0x584620[_0x4df1('0x17')][_0x4df1('0x19')]:_0x4df1('0x1a'),_0x584620[_0x4df1('0x17')]&&_0x584620['body'][_0x4df1('0x1b')]?_0x584620['body'][_0x4df1('0x1b')]:'',_0x584620[_0x4df1('0x17')]&&_0x584620[_0x4df1('0x17')][_0x4df1('0x1c')]?_0x584620['body']['agent_name']:'');},'ignoreRoute':function(_0x10bbc0){var _0x2cea41=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2cea41['test'](_0x10bbc0['url']);}}));_0x21c347[_0x4df1('0x8')](_0x4df1('0x1d'),require(_0x4df1('0x1e')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x1f'),require(_0x4df1('0x20')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x21'),require('./api/voiceContext'));_0x21c347[_0x4df1('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x22'),require(_0x4df1('0x23')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x24'),require(_0x4df1('0x25')));_0x21c347['use']('/api/voice/recordings',require(_0x4df1('0x26')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x27'),require('./api/screenRecording'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x28'),require(_0x4df1('0x29')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x2a'),require(_0x4df1('0x2b')));_0x21c347[_0x4df1('0x8')]('/api/voice/calls/reports',require(_0x4df1('0x2c')));_0x21c347[_0x4df1('0x8')]('/api/voice/dials/reports',require(_0x4df1('0x2d')));_0x21c347[_0x4df1('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x21c347['use'](_0x4df1('0x2e'),require(_0x4df1('0x2f')));_0x21c347[_0x4df1('0x8')]('/api/members/reports',require(_0x4df1('0x30')));_0x21c347[_0x4df1('0x8')]('/api/trunks',require(_0x4df1('0x31')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x32'),require(_0x4df1('0x33')));_0x21c347['use'](_0x4df1('0x34'),require(_0x4df1('0x35')));_0x21c347[_0x4df1('0x8')]('/api/mail/accounts',require(_0x4df1('0x36')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x37'),require(_0x4df1('0x38')));_0x21c347['use'](_0x4df1('0x39'),require(_0x4df1('0x3a')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x3b'),require(_0x4df1('0x3c')));_0x21c347['use'](_0x4df1('0x3d'),require(_0x4df1('0x3e')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x3f'),require(_0x4df1('0x40')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x41'),require(_0x4df1('0x42')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x43'),require(_0x4df1('0x44')));_0x21c347['use'](_0x4df1('0x45'),require('./api/dashboardItem'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x46'),require(_0x4df1('0x47')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x48'),require(_0x4df1('0x49')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x4a'),require(_0x4df1('0x4b')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x4c'),require(_0x4df1('0x4d')));_0x21c347['use'](_0x4df1('0x4e'),require(_0x4df1('0x4f')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x50'),require('./api/faxQueueReport'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x51'),require(_0x4df1('0x52')));_0x21c347['use']('/api/sms/applications',require(_0x4df1('0x53')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x54'),require(_0x4df1('0x55')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x56'),require('./api/smsMessage'));_0x21c347['use'](_0x4df1('0x57'),require(_0x4df1('0x58')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x59'),require(_0x4df1('0x5a')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x5b'),require('./api/openchannelApplication'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x5c'),require(_0x4df1('0x5d')));_0x21c347[_0x4df1('0x8')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x21c347['use'](_0x4df1('0x5e'),require(_0x4df1('0x5f')));_0x21c347['use'](_0x4df1('0x60'),require(_0x4df1('0x61')));_0x21c347['use'](_0x4df1('0x62'),require(_0x4df1('0x63')));_0x21c347['use'](_0x4df1('0x64'),require(_0x4df1('0x65')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x66'),require(_0x4df1('0x67')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x68'),require('./api/chatMessage'));_0x21c347[_0x4df1('0x8')]('/api/chat/offline_messages',require(_0x4df1('0x69')));_0x21c347[_0x4df1('0x8')]('/api/chat/queues',require(_0x4df1('0x6a')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x6b'),require('./api/chatGroup'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x6c'),require(_0x4df1('0x6d')));_0x21c347['use'](_0x4df1('0x6e'),require(_0x4df1('0x6f')));_0x21c347['use'](_0x4df1('0x70'),require(_0x4df1('0x71')));_0x21c347['use'](_0x4df1('0x72'),require('./api/cmHopper'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x73'),require(_0x4df1('0x74')));_0x21c347[_0x4df1('0x8')]('/api/cm/hopper_final',require(_0x4df1('0x75')));_0x21c347[_0x4df1('0x8')]('/api/cm/hopper_history',require(_0x4df1('0x76')));_0x21c347['use'](_0x4df1('0x77'),require(_0x4df1('0x78')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x79'),require('./api/action'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x7a'),require('./api/automation'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x7b'),require(_0x4df1('0x7c')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x7d'),require(_0x4df1('0x7e')));_0x21c347['use'](_0x4df1('0x7f'),require(_0x4df1('0x80')));_0x21c347[_0x4df1('0x8')]('/api/intervals',require(_0x4df1('0x81')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x82'),require(_0x4df1('0x83')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x84'),require(_0x4df1('0x85')));_0x21c347['use'](_0x4df1('0x86'),require(_0x4df1('0x87')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x88'),require('./api/schedule'));_0x21c347['use'](_0x4df1('0x89'),require(_0x4df1('0x8a')));_0x21c347['use'](_0x4df1('0x8b'),require(_0x4df1('0x8c')));_0x21c347['use'](_0x4df1('0x8d'),require(_0x4df1('0x8e')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x8f'),require(_0x4df1('0x90')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x91'),require(_0x4df1('0x92')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x93'),require(_0x4df1('0x94')));_0x21c347['use']('/api/integrations/reports',require(_0x4df1('0x95')));_0x21c347[_0x4df1('0x8')]('/api/analytics/custom_reports',require(_0x4df1('0x96')));_0x21c347['use'](_0x4df1('0x97'),require(_0x4df1('0x98')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x99'),require('./api/analyticExtractedReport'));_0x21c347['use'](_0x4df1('0x9a'),require(_0x4df1('0x9b')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x9c'),require(_0x4df1('0x9d')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x9e'),require(_0x4df1('0x9f')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xa0'),require('./api/intSalesforceAccount'));_0x21c347[_0x4df1('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xa1'),require('./api/intSalesforceField'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xa2'),require('./api/intSugarcrmAccount'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xa3'),require(_0x4df1('0xa4')));_0x21c347['use'](_0x4df1('0xa5'),require(_0x4df1('0xa6')));_0x21c347['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x21c347['use'](_0x4df1('0xa7'),require(_0x4df1('0xa8')));_0x21c347[_0x4df1('0x8')]('/api/integrations/desk/fields',require(_0x4df1('0xa9')));_0x21c347[_0x4df1('0x8')]('/api/integrations/zoho/accounts',require(_0x4df1('0xaa')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xab'),require(_0x4df1('0xac')));_0x21c347[_0x4df1('0x8')]('/api/integrations/zoho/fields',require(_0x4df1('0xad')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xae'),require('./api/intZendeskAccount'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xaf'),require('./api/intZendeskConfiguration'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xb0'),require(_0x4df1('0xb1')));_0x21c347['use'](_0x4df1('0xb2'),require(_0x4df1('0xb3')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xb4'),require(_0x4df1('0xb5')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xb6'),require(_0x4df1('0xb7')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xb8'),require('./api/intVtigerAccount'));_0x21c347['use']('/api/integrations/vtiger/configurations',require(_0x4df1('0xb9')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xba'),require(_0x4df1('0xbb')));_0x21c347['use']('/api/integrations/servicenow/accounts',require(_0x4df1('0xbc')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xbd'),require(_0x4df1('0xbe')));_0x21c347['use'](_0x4df1('0xbf'),require(_0x4df1('0xc0')));_0x21c347['use']('/api/integrations/dynamics365/accounts',require(_0x4df1('0xc1')));_0x21c347['use']('/api/integrations/dynamics365/configurations',require(_0x4df1('0xc2')));_0x21c347['use'](_0x4df1('0xc3'),require(_0x4df1('0xc4')));_0x21c347[_0x4df1('0x8')]('/api/integrations/freshsales/accounts',require(_0x4df1('0xc5')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xc6'),require(_0x4df1('0xc7')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xc8'),require('./api/intFreshsalesField'));_0x21c347['use'](_0x4df1('0xc9'),require(_0x4df1('0xca')));_0x21c347['use']('/api/chat/reports/queue',require(_0x4df1('0xcb')));_0x21c347['use'](_0x4df1('0xcc'),require('./api/chatInternalMessage'));_0x21c347['use'](_0x4df1('0xcd'),require(_0x4df1('0xce')));_0x21c347['use'](_0x4df1('0xcf'),require(_0x4df1('0xd0')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd1'),require(_0x4df1('0xd2')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd3'),require('./api/smsQueueReport'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd4'),require(_0x4df1('0xd5')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd6'),require(_0x4df1('0xd7')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd8'),require('./api/jscriptyProject'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xd9'),require(_0x4df1('0xda')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xdb'),require(_0x4df1('0xdc')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xdd'),require(_0x4df1('0xde')));_0x21c347['use'](_0x4df1('0xdf'),require(_0x4df1('0xe0')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xe1'),require(_0x4df1('0xe2')));_0x21c347['use'](_0x4df1('0xe3'),require(_0x4df1('0xe4')));_0x21c347[_0x4df1('0x8')]('/api/license',require(_0x4df1('0xe5')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xe6'),require(_0x4df1('0xe7')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xe8'),require(_0x4df1('0xe9')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xea'),require(_0x4df1('0xeb')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xec'),require(_0x4df1('0xed')));_0x21c347['use'](_0x4df1('0xee'),require(_0x4df1('0xef')));_0x21c347['use'](_0x4df1('0xf0'),require(_0x4df1('0xf1')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xf2'),require(_0x4df1('0xf3')));_0x21c347['use'](_0x4df1('0xf4'),require('./api/openchannelTransferReport'));_0x21c347[_0x4df1('0x8')]('/api/sms/reports/transfer',require(_0x4df1('0xf5')));_0x21c347['use'](_0x4df1('0xf6'),require('./api/cmList'));_0x21c347[_0x4df1('0x8')]('/api/voice/prefixes',require(_0x4df1('0xf7')));_0x21c347['use'](_0x4df1('0xf8'),require('./api/userProfile'));_0x21c347[_0x4df1('0x8')](_0x4df1('0xf9'),require(_0x4df1('0xfa')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xfb'),require(_0x4df1('0xfc')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xfd'),require(_0x4df1('0xfe')));_0x21c347[_0x4df1('0x8')](_0x4df1('0xff'),require(_0x4df1('0x100')));_0x21c347['use']('/api/whatsapp/applications',require(_0x4df1('0x101')));_0x21c347[_0x4df1('0x8')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x102'),require(_0x4df1('0x103')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x104'),require(_0x4df1('0x105')));_0x21c347['use'](_0x4df1('0x106'),require(_0x4df1('0x107')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x108'),require(_0x4df1('0x109')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x10a'),require('./api/cloudProvider'));_0x21c347[_0x4df1('0x8')](_0x4df1('0x10b'),require(_0x4df1('0x10c')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x10d'),require(_0x4df1('0x10e')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x10f'),require(_0x4df1('0x110')));_0x21c347['use'](_0x4df1('0x111'),require(_0x4df1('0x112')));_0x21c347[_0x4df1('0x8')]('/api/version',require(_0x4df1('0x113')));_0x21c347['use'](_0x4df1('0x114'),require(_0x4df1('0x115')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x116'),require(_0x4df1('0x117')));_0x21c347[_0x4df1('0x8')](_0x4df1('0x118'),require(_0x4df1('0x119')));_0x21c347['use'](_0x4df1('0x11a'),express[_0x4df1('0x11b')](path[_0x4df1('0x11c')](config[_0x4df1('0x11d')],_0x4df1('0x11a'))));_0x21c347[_0x4df1('0x8')]('/www',express[_0x4df1('0x11b')](path[_0x4df1('0x11c')](config[_0x4df1('0x11d')],_0x4df1('0x11e'))));_0x21c347['use'](_0x4df1('0x11f'),express[_0x4df1('0x11b')](path[_0x4df1('0x11c')](config[_0x4df1('0x11d')],_0x4df1('0x11f'))));_0x21c347[_0x4df1('0x8')](_0x4df1('0x120'),express[_0x4df1('0x11b')](path['join'](config[_0x4df1('0x11d')],_0x4df1('0x121'),_0x4df1('0x122'))));_0x21c347[_0x4df1('0x8')](_0x4df1('0x123'),express[_0x4df1('0x11b')](path[_0x4df1('0x11c')](config['root'],_0x4df1('0x124'))));_0x21c347['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x21c347['route']('/*')['get'](function(_0x41b49f,_0x445de9){_0x445de9[_0x4df1('0x125')](path[_0x4df1('0x126')](_0x21c347[_0x4df1('0x127')](_0x4df1('0x128'))+'/index.html'));});}; \ No newline at end of file +var _0x582f=['/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/fields','/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/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/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/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/apidoc','static','root','/www','join','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./config/environment','./config/logger','api','auth','use','logger','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','role','agent_name','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication'];(function(_0x840106,_0x59c538){var _0x41edcd=function(_0x4c1dc1){while(--_0x4c1dc1){_0x840106['push'](_0x840106['shift']());}};_0x41edcd(++_0x59c538);}(_0x582f,0x1ee));var _0xf582=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x582f[_0x254081];return _0x5d1e2a;};'use strict';var path=require(_0xf582('0x0'));var express=require(_0xf582('0x1'));var ewinston=require(_0xf582('0x2'));var util=require(_0xf582('0x3'));var errors=require('./errors');var config=require(_0xf582('0x4'));var logger=require(_0xf582('0x5'))(_0xf582('0x6'));var authLogger=require('./config/logger')(_0xf582('0x7'));exports['default']=function(_0x3771f6){_0x3771f6[_0xf582('0x8')](ewinston[_0xf582('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xf2bc08,_0x2d55b5){return util[_0xf582('0xa')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0xf2bc08[_0xf582('0xb')],_0xf2bc08['headers']['x-forwarded-for']?_0xf2bc08[_0xf582('0xc')][_0xf582('0xd')]:_0xf2bc08[_0xf582('0xe')][_0xf582('0xf')]||_0xf2bc08['ip'],_0xf2bc08[_0xf582('0x10')],_0x2d55b5[_0xf582('0x11')],_0x2d55b5[_0xf582('0x12')],_0xf2bc08[_0xf582('0x13')]?_0xf2bc08['user']['id']:null,_0xf2bc08[_0xf582('0x13')]?_0xf2bc08['user'][_0xf582('0x14')]:null,_0xf2bc08[_0xf582('0x13')]?_0xf2bc08[_0xf582('0x13')]['role']:null);}}));_0x3771f6[_0xf582('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x490d48,_0x3dc8cf){var _0x260b87=_0xf582('0x15');if(_0x490d48[_0xf582('0x16')]&&_0x490d48[_0xf582('0x16')][_0xf582('0x17')]&&_0x490d48[_0xf582('0x16')][_0xf582('0x18')]){_0x260b87='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xf582('0xa')](_0x260b87,_0x490d48[_0xf582('0xb')],_0x490d48['headers'][_0xf582('0xd')]?_0x490d48[_0xf582('0xc')][_0xf582('0xd')]:_0x490d48[_0xf582('0xe')][_0xf582('0xf')]||_0x490d48['ip'],_0x490d48[_0xf582('0x10')],_0x3dc8cf[_0xf582('0x11')],_0x3dc8cf[_0xf582('0x12')],_0x490d48['user']?_0x490d48[_0xf582('0x13')]['id']:null,_0x490d48[_0xf582('0x13')]?_0x490d48[_0xf582('0x13')]['name']:null,_0x490d48[_0xf582('0x13')]?_0x490d48['user'][_0xf582('0x19')]:null,_0x490d48[_0xf582('0x16')]&&_0x490d48[_0xf582('0x16')][_0xf582('0x17')]?_0x490d48[_0xf582('0x16')][_0xf582('0x17')]:'other',_0x490d48[_0xf582('0x16')]&&_0x490d48[_0xf582('0x16')]['agent_id']?_0x490d48[_0xf582('0x16')][_0xf582('0x18')]:'',_0x490d48['body']&&_0x490d48[_0xf582('0x16')][_0xf582('0x1a')]?_0x490d48[_0xf582('0x16')][_0xf582('0x1a')]:'');},'ignoreRoute':function(_0x22cf60){var _0x3cac4f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3cac4f[_0xf582('0x1b')](_0x22cf60['url']);}}));_0x3771f6[_0xf582('0x8')](_0xf582('0x1c'),require(_0xf582('0x1d')));_0x3771f6[_0xf582('0x8')]('/api/voice/chanspy',require(_0xf582('0x1e')));_0x3771f6[_0xf582('0x8')](_0xf582('0x1f'),require('./api/voiceContext'));_0x3771f6[_0xf582('0x8')](_0xf582('0x20'),require(_0xf582('0x21')));_0x3771f6[_0xf582('0x8')]('/api/voice/mohs',require(_0xf582('0x22')));_0x3771f6[_0xf582('0x8')]('/api/voice/queues',require(_0xf582('0x23')));_0x3771f6[_0xf582('0x8')](_0xf582('0x24'),require(_0xf582('0x25')));_0x3771f6[_0xf582('0x8')]('/api/screen/recordings',require('./api/screenRecording'));_0x3771f6[_0xf582('0x8')](_0xf582('0x26'),require(_0xf582('0x27')));_0x3771f6[_0xf582('0x8')](_0xf582('0x28'),require('./api/voiceMailMessage'));_0x3771f6[_0xf582('0x8')]('/api/voice/calls/reports',require(_0xf582('0x29')));_0x3771f6[_0xf582('0x8')](_0xf582('0x2a'),require('./api/voiceDialReport'));_0x3771f6['use'](_0xf582('0x2b'),require(_0xf582('0x2c')));_0x3771f6[_0xf582('0x8')](_0xf582('0x2d'),require('./api/voiceQueueReport'));_0x3771f6[_0xf582('0x8')]('/api/members/reports',require(_0xf582('0x2e')));_0x3771f6['use']('/api/trunks',require(_0xf582('0x2f')));_0x3771f6[_0xf582('0x8')](_0xf582('0x30'),require('./api/voiceTransferReport'));_0x3771f6[_0xf582('0x8')](_0xf582('0x31'),require('./api/mailServerOut'));_0x3771f6['use'](_0xf582('0x32'),require(_0xf582('0x33')));_0x3771f6[_0xf582('0x8')]('/api/mail/queues',require(_0xf582('0x34')));_0x3771f6[_0xf582('0x8')](_0xf582('0x35'),require(_0xf582('0x36')));_0x3771f6[_0xf582('0x8')](_0xf582('0x37'),require(_0xf582('0x38')));_0x3771f6[_0xf582('0x8')](_0xf582('0x39'),require('./api/mailMessage'));_0x3771f6[_0xf582('0x8')](_0xf582('0x3a'),require(_0xf582('0x3b')));_0x3771f6[_0xf582('0x8')](_0xf582('0x3c'),require(_0xf582('0x3d')));_0x3771f6[_0xf582('0x8')](_0xf582('0x3e'),require('./api/dashboard'));_0x3771f6[_0xf582('0x8')](_0xf582('0x3f'),require(_0xf582('0x40')));_0x3771f6['use'](_0xf582('0x41'),require('./api/faxAccount'));_0x3771f6[_0xf582('0x8')](_0xf582('0x42'),require(_0xf582('0x43')));_0x3771f6[_0xf582('0x8')](_0xf582('0x44'),require('./api/faxInteraction'));_0x3771f6[_0xf582('0x8')](_0xf582('0x45'),require(_0xf582('0x46')));_0x3771f6['use'](_0xf582('0x47'),require('./api/faxQueue'));_0x3771f6[_0xf582('0x8')](_0xf582('0x48'),require(_0xf582('0x49')));_0x3771f6['use']('/api/sms/accounts',require(_0xf582('0x4a')));_0x3771f6[_0xf582('0x8')](_0xf582('0x4b'),require(_0xf582('0x4c')));_0x3771f6[_0xf582('0x8')](_0xf582('0x4d'),require(_0xf582('0x4e')));_0x3771f6[_0xf582('0x8')](_0xf582('0x4f'),require(_0xf582('0x50')));_0x3771f6[_0xf582('0x8')](_0xf582('0x51'),require(_0xf582('0x52')));_0x3771f6[_0xf582('0x8')]('/api/openchannel/accounts',require(_0xf582('0x53')));_0x3771f6[_0xf582('0x8')](_0xf582('0x54'),require(_0xf582('0x55')));_0x3771f6['use'](_0xf582('0x56'),require(_0xf582('0x57')));_0x3771f6['use'](_0xf582('0x58'),require(_0xf582('0x59')));_0x3771f6[_0xf582('0x8')]('/api/openchannel/queues',require(_0xf582('0x5a')));_0x3771f6[_0xf582('0x8')](_0xf582('0x5b'),require(_0xf582('0x5c')));_0x3771f6['use']('/api/openchannel/reports/queue',require(_0xf582('0x5d')));_0x3771f6[_0xf582('0x8')]('/api/chat/applications',require(_0xf582('0x5e')));_0x3771f6[_0xf582('0x8')]('/api/chat/interactions',require(_0xf582('0x5f')));_0x3771f6[_0xf582('0x8')](_0xf582('0x60'),require('./api/chatMessage'));_0x3771f6['use']('/api/chat/offline_messages',require(_0xf582('0x61')));_0x3771f6[_0xf582('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x3771f6['use'](_0xf582('0x62'),require(_0xf582('0x63')));_0x3771f6[_0xf582('0x8')]('/api/chat/proactive_actions',require(_0xf582('0x64')));_0x3771f6[_0xf582('0x8')]('/api/cm/companies',require(_0xf582('0x65')));_0x3771f6['use'](_0xf582('0x66'),require(_0xf582('0x67')));_0x3771f6[_0xf582('0x8')](_0xf582('0x68'),require(_0xf582('0x69')));_0x3771f6[_0xf582('0x8')]('/api/cm/hopper_black',require(_0xf582('0x6a')));_0x3771f6[_0xf582('0x8')](_0xf582('0x6b'),require('./api/cmHopperFinal'));_0x3771f6[_0xf582('0x8')](_0xf582('0x6c'),require('./api/cmHopperHistory'));_0x3771f6['use'](_0xf582('0x6d'),require(_0xf582('0x6e')));_0x3771f6[_0xf582('0x8')](_0xf582('0x6f'),require(_0xf582('0x70')));_0x3771f6[_0xf582('0x8')](_0xf582('0x71'),require(_0xf582('0x72')));_0x3771f6[_0xf582('0x8')]('/api/canned_answers',require(_0xf582('0x73')));_0x3771f6['use'](_0xf582('0x74'),require(_0xf582('0x75')));_0x3771f6[_0xf582('0x8')](_0xf582('0x76'),require(_0xf582('0x77')));_0x3771f6['use']('/api/intervals',require(_0xf582('0x78')));_0x3771f6[_0xf582('0x8')](_0xf582('0x79'),require('./api/pause'));_0x3771f6[_0xf582('0x8')]('/api/cdr',require(_0xf582('0x7a')));_0x3771f6[_0xf582('0x8')](_0xf582('0x7b'),require('./api/voiceQueuesLog'));_0x3771f6[_0xf582('0x8')]('/api/schedules',require(_0xf582('0x7c')));_0x3771f6[_0xf582('0x8')](_0xf582('0x7d'),require(_0xf582('0x7e')));_0x3771f6['use'](_0xf582('0x7f'),require(_0xf582('0x80')));_0x3771f6[_0xf582('0x8')](_0xf582('0x81'),require(_0xf582('0x82')));_0x3771f6[_0xf582('0x8')](_0xf582('0x83'),require(_0xf582('0x84')));_0x3771f6[_0xf582('0x8')](_0xf582('0x85'),require(_0xf582('0x86')));_0x3771f6[_0xf582('0x8')](_0xf582('0x87'),require('./api/integration'));_0x3771f6['use'](_0xf582('0x88'),require(_0xf582('0x89')));_0x3771f6[_0xf582('0x8')](_0xf582('0x8a'),require(_0xf582('0x8b')));_0x3771f6['use'](_0xf582('0x8c'),require('./api/analyticDefaultReport'));_0x3771f6[_0xf582('0x8')](_0xf582('0x8d'),require('./api/analyticExtractedReport'));_0x3771f6['use'](_0xf582('0x8e'),require(_0xf582('0x8f')));_0x3771f6['use'](_0xf582('0x90'),require(_0xf582('0x91')));_0x3771f6[_0xf582('0x8')](_0xf582('0x92'),require('./api/analyticTreeReport'));_0x3771f6[_0xf582('0x8')](_0xf582('0x93'),require(_0xf582('0x94')));_0x3771f6[_0xf582('0x8')]('/api/integrations/salesforce/configurations',require(_0xf582('0x95')));_0x3771f6['use'](_0xf582('0x96'),require('./api/intSalesforceField'));_0x3771f6[_0xf582('0x8')](_0xf582('0x97'),require(_0xf582('0x98')));_0x3771f6[_0xf582('0x8')](_0xf582('0x99'),require(_0xf582('0x9a')));_0x3771f6[_0xf582('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x3771f6[_0xf582('0x8')](_0xf582('0x9b'),require(_0xf582('0x9c')));_0x3771f6[_0xf582('0x8')](_0xf582('0x9d'),require(_0xf582('0x9e')));_0x3771f6[_0xf582('0x8')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x3771f6[_0xf582('0x8')](_0xf582('0x9f'),require(_0xf582('0xa0')));_0x3771f6['use'](_0xf582('0xa1'),require(_0xf582('0xa2')));_0x3771f6[_0xf582('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3771f6[_0xf582('0x8')](_0xf582('0xa3'),require(_0xf582('0xa4')));_0x3771f6[_0xf582('0x8')](_0xf582('0xa5'),require('./api/intZendeskConfiguration'));_0x3771f6['use']('/api/integrations/zendesk/fields',require(_0xf582('0xa6')));_0x3771f6[_0xf582('0x8')](_0xf582('0xa7'),require(_0xf582('0xa8')));_0x3771f6[_0xf582('0x8')](_0xf582('0xa9'),require('./api/intFreshdeskConfiguration'));_0x3771f6[_0xf582('0x8')](_0xf582('0xaa'),require(_0xf582('0xab')));_0x3771f6[_0xf582('0x8')](_0xf582('0xac'),require('./api/intVtigerAccount'));_0x3771f6['use'](_0xf582('0xad'),require(_0xf582('0xae')));_0x3771f6['use'](_0xf582('0xaf'),require(_0xf582('0xb0')));_0x3771f6['use'](_0xf582('0xb1'),require('./api/intServicenowAccount'));_0x3771f6[_0xf582('0x8')](_0xf582('0xb2'),require(_0xf582('0xb3')));_0x3771f6[_0xf582('0x8')](_0xf582('0xb4'),require(_0xf582('0xb5')));_0x3771f6[_0xf582('0x8')](_0xf582('0xb6'),require('./api/intDynamics365Account'));_0x3771f6[_0xf582('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x3771f6[_0xf582('0x8')](_0xf582('0xb7'),require('./api/intDynamics365Field'));_0x3771f6['use'](_0xf582('0xb8'),require(_0xf582('0xb9')));_0x3771f6[_0xf582('0x8')](_0xf582('0xba'),require(_0xf582('0xbb')));_0x3771f6[_0xf582('0x8')](_0xf582('0xbc'),require(_0xf582('0xbd')));_0x3771f6[_0xf582('0x8')](_0xf582('0xbe'),require(_0xf582('0xbf')));_0x3771f6[_0xf582('0x8')](_0xf582('0xc0'),require(_0xf582('0xc1')));_0x3771f6[_0xf582('0x8')](_0xf582('0xc2'),require(_0xf582('0xc3')));_0x3771f6[_0xf582('0x8')](_0xf582('0xc4'),require(_0xf582('0xc5')));_0x3771f6[_0xf582('0x8')]('/api/jscripty/questions/reports',require(_0xf582('0xc6')));_0x3771f6[_0xf582('0x8')](_0xf582('0xc7'),require('./api/jscriptySessionReport'));_0x3771f6['use'](_0xf582('0xc8'),require(_0xf582('0xc9')));_0x3771f6[_0xf582('0x8')]('/api/square/reports',require(_0xf582('0xca')));_0x3771f6[_0xf582('0x8')](_0xf582('0xcb'),require('./api/squareReportDetail'));_0x3771f6[_0xf582('0x8')](_0xf582('0xcc'),require('./api/jscriptyProject'));_0x3771f6['use'](_0xf582('0xcd'),require(_0xf582('0xce')));_0x3771f6[_0xf582('0x8')](_0xf582('0xcf'),require('./api/squareOdbc'));_0x3771f6[_0xf582('0x8')](_0xf582('0xd0'),require(_0xf582('0xd1')));_0x3771f6[_0xf582('0x8')](_0xf582('0xd2'),require(_0xf582('0xd3')));_0x3771f6['use'](_0xf582('0xd4'),require(_0xf582('0xd5')));_0x3771f6[_0xf582('0x8')]('/api/teams',require(_0xf582('0xd6')));_0x3771f6['use'](_0xf582('0xd7'),require('./api/license'));_0x3771f6[_0xf582('0x8')](_0xf582('0xd8'),require(_0xf582('0xd9')));_0x3771f6[_0xf582('0x8')](_0xf582('0xda'),require(_0xf582('0xdb')));_0x3771f6[_0xf582('0x8')]('/api/attachments',require(_0xf582('0xdc')));_0x3771f6[_0xf582('0x8')](_0xf582('0xdd'),require('./api/plugin'));_0x3771f6[_0xf582('0x8')](_0xf582('0xde'),require(_0xf582('0xdf')));_0x3771f6['use'](_0xf582('0xe0'),require(_0xf582('0xe1')));_0x3771f6[_0xf582('0x8')](_0xf582('0xe2'),require(_0xf582('0xe3')));_0x3771f6[_0xf582('0x8')](_0xf582('0xe4'),require(_0xf582('0xe5')));_0x3771f6[_0xf582('0x8')]('/api/sms/reports/transfer',require(_0xf582('0xe6')));_0x3771f6[_0xf582('0x8')](_0xf582('0xe7'),require(_0xf582('0xe8')));_0x3771f6[_0xf582('0x8')](_0xf582('0xe9'),require(_0xf582('0xea')));_0x3771f6[_0xf582('0x8')](_0xf582('0xeb'),require(_0xf582('0xec')));_0x3771f6[_0xf582('0x8')](_0xf582('0xed'),require('./api/userProfileSection'));_0x3771f6['use']('/api/userProfile/resources',require(_0xf582('0xee')));_0x3771f6['use']('/api/notifications',require(_0xf582('0xef')));_0x3771f6['use'](_0xf582('0xf0'),require(_0xf582('0xf1')));_0x3771f6[_0xf582('0x8')](_0xf582('0xf2'),require(_0xf582('0xf3')));_0x3771f6[_0xf582('0x8')]('/api/whatsapp/interactions',require(_0xf582('0xf4')));_0x3771f6[_0xf582('0x8')]('/api/whatsapp/messages',require(_0xf582('0xf5')));_0x3771f6[_0xf582('0x8')](_0xf582('0xf6'),require(_0xf582('0xf7')));_0x3771f6['use']('/api/whatsapp/reports/transfer',require(_0xf582('0xf8')));_0x3771f6['use'](_0xf582('0xf9'),require(_0xf582('0xfa')));_0x3771f6[_0xf582('0x8')](_0xf582('0xfb'),require(_0xf582('0xfc')));_0x3771f6[_0xf582('0x8')](_0xf582('0xfd'),require(_0xf582('0xfe')));_0x3771f6['use'](_0xf582('0xff'),require(_0xf582('0x100')));_0x3771f6[_0xf582('0x8')](_0xf582('0x101'),require(_0xf582('0x102')));_0x3771f6[_0xf582('0x8')]('/api/rpc',require('./api/rpc'));_0x3771f6[_0xf582('0x8')](_0xf582('0x103'),require(_0xf582('0x104')));_0x3771f6['use'](_0xf582('0x105'),require(_0xf582('0x106')));_0x3771f6['use'](_0xf582('0x107'),require('./api/pm2'));_0x3771f6[_0xf582('0x8')]('/api/webbar',require(_0xf582('0x108')));_0x3771f6[_0xf582('0x8')](_0xf582('0x109'),express[_0xf582('0x10a')](path['join'](config[_0xf582('0x10b')],_0xf582('0x109'))));_0x3771f6[_0xf582('0x8')](_0xf582('0x10c'),express[_0xf582('0x10a')](path[_0xf582('0x10d')](config[_0xf582('0x10b')],'/www')));_0x3771f6[_0xf582('0x8')]('/demo',express[_0xf582('0x10a')](path[_0xf582('0x10d')](config[_0xf582('0x10b')],_0xf582('0x10e'))));_0x3771f6[_0xf582('0x8')]('/snippet',express[_0xf582('0x10a')](path['join'](config[_0xf582('0x10b')],_0xf582('0x10f'),_0xf582('0x110'))));_0x3771f6['use'](_0xf582('0x111'),express['static'](path[_0xf582('0x10d')](config[_0xf582('0x10b')],_0xf582('0x112'))));_0x3771f6[_0xf582('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xf582('0x114')](errors[0x194]);_0x3771f6[_0xf582('0x113')]('/*')[_0xf582('0x114')](function(_0x27e87c,_0x32423e){_0x32423e[_0xf582('0x115')](path[_0xf582('0x116')](_0x3771f6[_0xf582('0x114')](_0xf582('0x117'))+_0xf582('0x118')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b5fa57f..26c692a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf428=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.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/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x3391bd,_0x4ff127){var _0x2954d3=function(_0x2de99b){while(--_0x2de99b){_0x3391bd['push'](_0x3391bd['shift']());}};_0x2954d3(++_0x4ff127);}(_0xf428,0xbe));var _0x8f42=function(_0x40097d,_0x16ea32){_0x40097d=_0x40097d-0x0;var _0x341ed9=_0xf428[_0x40097d];return _0x341ed9;};'use strict';var jayson=require(_0x8f42('0x0'));var BPromise=require(_0x8f42('0x1'));var _=require('lodash');var config=require(_0x8f42('0x2'));exports[_0x8f42('0x3')]=function(){return new BPromise(function(_0xc21ec5,_0x3a9b37){var _0x4a1614={};_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/user/user.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x5')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x6')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x7')));_0x4a1614=_['merge'](_0x4a1614,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x8')));_0x4a1614=_['merge'](_0x4a1614,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x9')));_0x4a1614=_['merge'](_0x4a1614,require('../api/memberReport/memberReport.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/trunk/trunk.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0xa')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0xb')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0xc')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0xd')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0xe')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/mailInteraction/mailInteraction.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/mailMessage/mailMessage.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0xf')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x10')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x11')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x12')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x13')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x14')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x15')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x16')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x17')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x18')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/smsMessage/smsMessage.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/smsQueue/smsQueue.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x19')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x1a')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x1b')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x1c')));_0x4a1614=_['merge'](_0x4a1614,require('../api/chatInteraction/chatInteraction.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x1d')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x1e')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x1f')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x20')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x21')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x22')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x23')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x24')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x25')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x26')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x27')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x28')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x29')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/variable/variable.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x2a')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x2b')));_0x4a1614=_['merge'](_0x4a1614,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x2c')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x2d')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x2e')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x2f')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x30')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x31')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x32')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x33')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x34')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x35')));_0x4a1614=_['merge'](_0x4a1614,require('../api/squareMessage/squareMessage.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x36')));_0x4a1614=_['merge'](_0x4a1614,require(_0x8f42('0x37')));_0x4a1614=_['merge'](_0x4a1614,require('../api/plugin/plugin.rpc'));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x38')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x39')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x3a')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require(_0x8f42('0x3b')));_0x4a1614=_[_0x8f42('0x4')](_0x4a1614,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2cff8c=jayson[_0x8f42('0x3c')](_0x4a1614)[_0x8f42('0x3d')]();var _0x270fea=config[_0x8f42('0x3e')]['port']||config['port']+0x1;var _0x1390ed=config[_0x8f42('0x3e')]['ip']||_0x8f42('0x3f');_0x2cff8c['on']('error',function(_0x243b4d){return _0x3a9b37(_0x243b4d);});_0x2cff8c[_0x8f42('0x3')](_0x270fea,_0x1390ed,function(){console[_0x8f42('0x40')](_0x8f42('0x41'),_0x1390ed,_0x270fea);require('../config/triggers')['default']();return _0xc21ec5(_0x8f42('0x42')+_0x1390ed+':'+_0x270fea);});});}; \ No newline at end of file +var _0x3579=['lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird'];(function(_0x130700,_0x241485){var _0x3ba324=function(_0x377495){while(--_0x377495){_0x130700['push'](_0x130700['shift']());}};_0x3ba324(++_0x241485);}(_0x3579,0x94));var _0x9357=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3579[_0x2a6809];return _0x11c371;};'use strict';var jayson=require(_0x9357('0x0'));var BPromise=require(_0x9357('0x1'));var _=require(_0x9357('0x2'));var config=require(_0x9357('0x3'));exports[_0x9357('0x4')]=function(){return new BPromise(function(_0x2c96c6,_0x19d626){var _0x3f6325={};_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x5')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x7')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x8')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x9')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0xa')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0xb')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0xc')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0xd')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0xe')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/trunk/trunk.rpc'));_0x3f6325=_['merge'](_0x3f6325,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0xf')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x10')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x11')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x12')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x13')));_0x3f6325=_['merge'](_0x3f6325,require('../api/mailMessage/mailMessage.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x14')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x15')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/faxAccount/faxAccount.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x16')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x17')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/faxMessage/faxMessage.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x18')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x19')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/smsAccount/smsAccount.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x1a')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x1b')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x1c')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x1d')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x1e')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x1f')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x20')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x21')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x22')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x23')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x24')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x25')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x26')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3f6325=_['merge'](_0x3f6325,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x27')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x28')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x29')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x2a')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x2b')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x2c')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x2d')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/variable/variable.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x2e')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x2f')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x30')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x31')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x32')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x33')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3f6325=_['merge'](_0x3f6325,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x34')));_0x3f6325=_['merge'](_0x3f6325,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x35')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x36')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x37')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x38')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x39')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x3a')));_0x3f6325=_[_0x9357('0x6')](_0x3f6325,require(_0x9357('0x3b')));_0x3f6325=_['merge'](_0x3f6325,require('../api/attachment/attachment.rpc'));_0x3f6325=_['merge'](_0x3f6325,require('../api/plugin/plugin.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x3c')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x3d')));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x3e')));_0x3f6325=_['merge'](_0x3f6325,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3f6325=_['merge'](_0x3f6325,require(_0x9357('0x3f')));var _0x2cf430=jayson[_0x9357('0x40')](_0x3f6325)[_0x9357('0x41')]();var _0x1ceeb5=config[_0x9357('0x42')][_0x9357('0x43')]||config['port']+0x1;var _0x2102ed=config[_0x9357('0x42')]['ip']||_0x9357('0x44');_0x2cf430['on'](_0x9357('0x45'),function(_0xadc12d){return _0x19d626(_0xadc12d);});_0x2cf430[_0x9357('0x4')](_0x1ceeb5,_0x2102ed,function(){console[_0x9357('0x46')](_0x9357('0x47'),_0x2102ed,_0x1ceeb5);require(_0x9357('0x48'))[_0x9357('0x49')]();return _0x2c96c6(_0x9357('0x4a')+_0x2102ed+':'+_0x1ceeb5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bfb47f9..d94aaaf 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 _0xbf88=['setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','replace','result=','substr','indexOf','startsWith','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','log','function','write','destroy','inherits','prototype','sendRequest','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension'];(function(_0xf22365,_0x3bfb87){var _0x3c7388=function(_0x3f0654){while(--_0x3f0654){_0xf22365['push'](_0xf22365['shift']());}};_0x3c7388(++_0x3bfb87);}(_0xbf88,0x1d7));var _0x8bf8=function(_0x2c8c7b,_0x3c787d){_0x2c8c7b=_0x2c8c7b-0x0;var _0x58a161=_0xbf88[_0x2c8c7b];return _0x58a161;};'use strict';var util=require(_0x8bf8('0x0'));var _=require(_0x8bf8('0x1'));var EventEmitter=require(_0x8bf8('0x2'))[_0x8bf8('0x3')];var AGIReply=require(_0x8bf8('0x4'));var AGIError=require(_0x8bf8('0x5'));function AGIChannel(_0x58f9a3){var _0x15de94=this,_0x4b3a9c=new AGIReply(),_0x1bf59a=![],_0x6aecbc={};EventEmitter[_0x8bf8('0x6')](_0x15de94);_0x58f9a3['setEncoding'](_0x8bf8('0x7'));_0x58f9a3[_0x8bf8('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4b3a9c[_0x8bf8('0x9')](_0x8bf8('0x7'));_0x4b3a9c['on'](_0x8bf8('0xa'),function(_0x37656c){for(var _0x43e966 in _0x37656c){_0x15de94[_0x43e966]=_0x37656c[_0x43e966];}_0x15de94[_0x8bf8('0xb')]('ready');});_0x4b3a9c['on']('line',function(_0x558309){if(_0x558309[_0x8bf8('0xc')]()==_0x8bf8('0xd')){_0x15de94['emit'](_0x8bf8('0xd'));return;}if(_0x558309[_0x8bf8('0xe')](0x0,0xb)==_0x8bf8('0xf')){_0x1bf59a=!![];}if(_0x1bf59a){_0x6aecbc['rx']+=_0x558309+'\x0a';if(_0x558309[_0x8bf8('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x1bf59a=![];}}else{_0x6aecbc['rx']=_0x558309;}if(_0x1bf59a){return;}if(typeof _0x6aecbc['cb']=='function'){var _0x5534b1=_0x6aecbc['rx']['substring'](0x0,0x3),_0x2062aa=null,_0xa42e4d=null;_0x5534b1=parseInt(_0x5534b1);if(isNaN(_0x5534b1)){_0x6aecbc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8bf8('0x11')});return;}if(_0x5534b1!=0xc8){_0x6aecbc['cb'](null,{'code':_0x5534b1,'result':-0x1,'extra':'KO'});return;}_0x2062aa=_0x6aecbc['rx'][_0x8bf8('0xe')](0x4)[_0x8bf8('0x12')](_0x8bf8('0x13'),'');if(_0x2062aa['indexOf']('\x20')!=-0x1){_0x2062aa=_0x2062aa[_0x8bf8('0x14')](0x0,_0x2062aa[_0x8bf8('0x15')]('\x20'));}if(_[_0x8bf8('0x16')](_0x2062aa,'-1')){_0x2062aa=parseInt(_0x2062aa);}_0xa42e4d=_0x6aecbc['rx']['split']('\x20');if(_0xa42e4d['length']==0x3){_0xa42e4d=_0xa42e4d[0x2][_0x8bf8('0xe')](0x1,_0xa42e4d[0x2][_0x8bf8('0x17')]-0x1);}else if(_0xa42e4d[_0x8bf8('0x17')]>0x3){var _0x1dc717=/\((.+)\)/;var _0x3b84c4=_0x6aecbc['rx']['match'](_0x1dc717);if(_0x3b84c4){_0xa42e4d=_0x3b84c4[0x1];}else{_0xa42e4d=null;}}else{_0xa42e4d=null;}_0x6aecbc['cb'](null,{'code':_0x5534b1,'result':_0x2062aa,'extra':_0xa42e4d});}});_0x58f9a3['on'](_0x8bf8('0x18'),function(_0x2fc28e){_0x15de94[_0x8bf8('0xb')](_0x8bf8('0x18'),new AGIError(_0x8bf8('0x19'),_0x2fc28e['code']));});_0x58f9a3['on'](_0x8bf8('0x1a'),function(){_0x15de94[_0x8bf8('0xb')](_0x8bf8('0x1a'),new AGIError(_0x8bf8('0x1b')));});_0x58f9a3['on'](_0x8bf8('0x1c'),function(){_0x15de94[_0x8bf8('0xb')](_0x8bf8('0x1c'),new AGIError(_0x8bf8('0x1d')));_0x58f9a3['destroy']();});_0x58f9a3[_0x8bf8('0x1e')](_0x4b3a9c);this[_0x8bf8('0x1f')]=function(_0x477891,_0x1a955f){console[_0x8bf8('0x20')]('command=',_0x477891);var _0x477891=_0x477891||'',_0x1a955f=typeof _0x1a955f==_0x8bf8('0x21')?_0x1a955f:new Function();_0x6aecbc={'tx':_0x477891,'rx':'','cb':_0x1a955f};_0x58f9a3[_0x8bf8('0x22')](_0x477891+'\x0a');},this[_0x8bf8('0x1a')]=function(){_0x58f9a3[_0x8bf8('0x23')]();};}util[_0x8bf8('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x26')]=function(_0x16de0e){return this[_0x8bf8('0x1f')]['sync'](this,_0x16de0e);};AGIChannel['prototype']['answer']=function(){return this[_0x8bf8('0x26')]('ANSWER');};AGIChannel[_0x8bf8('0x25')]['getData']=function(_0x197a07,_0x11049f,_0x25ca13){_0x197a07=_0x197a07===undefined?_0x8bf8('0x27'):_0x197a07;_0x11049f=_0x11049f===undefined?'5':_0x11049f;_0x25ca13=_0x25ca13===undefined?'1':_0x25ca13;return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x197a07,_0x11049f*0x3e8,_0x25ca13));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x29')]=function(_0x457818){_0x457818=_0x457818||_0x8bf8('0x2a');return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')](_0x8bf8('0x2b'),_0x457818));};AGIChannel[_0x8bf8('0x25')]['exec']=function(_0x1a234b,_0x52ef0c){if(_[_0x8bf8('0x2c')](_0x52ef0c)){return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')]('EXEC\x20%s\x20%s',_0x1a234b,_0x52ef0c[_0x8bf8('0x2d')](',')));}return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')]('EXEC\x20%s\x20%s',_0x1a234b,_0x52ef0c));};AGIChannel['prototype'][_0x8bf8('0x2e')]=function(_0x2de5c1){return this['sendRequest'](util[_0x8bf8('0x28')](_0x8bf8('0x2f'),_0x2de5c1));};AGIChannel[_0x8bf8('0x25')]['setExtension']=function(_0x44c21d){return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')](_0x8bf8('0x30'),_0x44c21d));};AGIChannel['prototype']['setPriority']=function(_0x487a6e){return this['sendRequest'](util[_0x8bf8('0x28')](_0x8bf8('0x31'),_0x487a6e));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0xd')]=function(){return this['sendRequest'](_0x8bf8('0x32'));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x33')]=function(_0x3bd154,_0x2f378d){var _0x519e5f=_['isBoolean'](_0x2f378d)||_[_0x8bf8('0x34')](_0x2f378d)?_0x2f378d[_0x8bf8('0x35')]():_0x2f378d;return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3bd154,_0x519e5f?_0x519e5f['toString']()[_0x8bf8('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x36')]=function(_0x4b9411,_0x19b471){return this[_0x8bf8('0x26')](util['format'](_0x8bf8('0x37'),_0x4b9411,_0x19b471));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x38')]=function(_0x3eb164,_0x390d50){return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')](_0x8bf8('0x39'),_0x3eb164,_0x390d50));};AGIChannel[_0x8bf8('0x25')]['sayPhonetic']=function(_0x1245b7,_0x36d6c2){return this['sendRequest'](util[_0x8bf8('0x28')](_0x8bf8('0x3a'),_0x1245b7,_0x36d6c2));};AGIChannel['prototype'][_0x8bf8('0x3b')]=function(_0x23a19f,_0x48c7f1,_0x18db0e){_0x48c7f1=_0x48c7f1||this[_0x8bf8('0x3c')];_0x18db0e=_0x18db0e||0x1;this[_0x8bf8('0x2e')](_0x23a19f);this[_0x8bf8('0x3d')](_0x48c7f1);this[_0x8bf8('0x3e')](_0x18db0e);return this['noop'](util[_0x8bf8('0x28')](_0x8bf8('0x3f'),_0x23a19f,_0x48c7f1,_0x18db0e));};AGIChannel['prototype'][_0x8bf8('0x40')]=function(_0xb9693c){console[_0x8bf8('0x20')](_0x8bf8('0x41'),_0xb9693c);return this[_0x8bf8('0x26')](util['format'](_0x8bf8('0x42'),_0xb9693c));};AGIChannel['prototype']['recordFile']=function(_0x5a8361,_0x153114,_0x4d2527,_0x3889ad,_0x56daf6,_0x49153b){_0x153114=_0x153114||_0x8bf8('0x43');_0x4d2527=_0x4d2527||'';_0x3889ad=_0x3889ad===undefined?-0x1:_0x3889ad==='-1'?-0x1:_0x3889ad*0x3e8;_0x56daf6=_0x56daf6===undefined?'':'s='+_0x56daf6;_0x49153b=_0x49153b?'BEEP':'';return this[_0x8bf8('0x26')](util[_0x8bf8('0x28')](_0x8bf8('0x44'),_0x5a8361,_0x153114,_0x4d2527,_0x3889ad,_0x49153b,_0x56daf6));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x45')]=function(_0x5c95c4,_0x29f56b){_0x29f56b=_0x29f56b||'';return this[_0x8bf8('0x26')](util['format'](_0x8bf8('0x46'),_0x5c95c4,_0x29f56b));};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x47')]=function(_0x2c52a0){return this[_0x8bf8('0x48')]('AGI',_0x2c52a0);};AGIChannel['prototype'][_0x8bf8('0x49')]=function(_0xa46c4c){return this[_0x8bf8('0x48')]('WAIT',_0xa46c4c);};AGIChannel[_0x8bf8('0x25')][_0x8bf8('0x18')]=function(_0x211e78,_0x14687f){this[_0x8bf8('0x29')](util[_0x8bf8('0x28')](_0x8bf8('0x4a'),_0x211e78['id'],_0x211e78['label'],_0x14687f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8bf8('0x4b')]=AGIChannel; \ No newline at end of file +var _0xc55f=['exports','util','lodash','events','EventEmitter','./error','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','pipe','command','log','command=','destroy','sync','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label'];(function(_0x387a73,_0x3cd2a4){var _0x2383a9=function(_0x4343ae){while(--_0x4343ae){_0x387a73['push'](_0x387a73['shift']());}};_0x2383a9(++_0x3cd2a4);}(_0xc55f,0x9f));var _0xfc55=function(_0xac0841,_0xd8de7c){_0xac0841=_0xac0841-0x0;var _0x46a9a6=_0xc55f[_0xac0841];return _0x46a9a6;};'use strict';var util=require(_0xfc55('0x0'));var _=require(_0xfc55('0x1'));var EventEmitter=require(_0xfc55('0x2'))[_0xfc55('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xfc55('0x4'));function AGIChannel(_0x1bbf81){var _0x5416ed=this,_0x5e596f=new AGIReply(),_0xdfeab5=![],_0x158111={};EventEmitter['call'](_0x5416ed);_0x1bbf81[_0xfc55('0x5')](_0xfc55('0x6'));_0x1bbf81[_0xfc55('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5e596f[_0xfc55('0x5')](_0xfc55('0x6'));_0x5e596f['on'](_0xfc55('0x8'),function(_0xb935fd){for(var _0x47e704 in _0xb935fd){_0x5416ed[_0x47e704]=_0xb935fd[_0x47e704];}_0x5416ed[_0xfc55('0x9')](_0xfc55('0xa'));});_0x5e596f['on']('line',function(_0x5518ba){if(_0x5518ba[_0xfc55('0xb')]()==_0xfc55('0xc')){_0x5416ed['emit']('hangup');return;}if(_0x5518ba[_0xfc55('0xd')](0x0,0xb)=='520-Invalid'){_0xdfeab5=!![];}if(_0xdfeab5){_0x158111['rx']+=_0x5518ba+'\x0a';if(_0x5518ba['search'](_0xfc55('0xe'))!=-0x1){_0xdfeab5=![];}}else{_0x158111['rx']=_0x5518ba;}if(_0xdfeab5){return;}if(typeof _0x158111['cb']==_0xfc55('0xf')){var _0x1df4b9=_0x158111['rx']['substring'](0x0,0x3),_0x256c76=null,_0x10b0d3=null;_0x1df4b9=parseInt(_0x1df4b9);if(isNaN(_0x1df4b9)){_0x158111['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xfc55('0x10')});return;}if(_0x1df4b9!=0xc8){_0x158111['cb'](null,{'code':_0x1df4b9,'result':-0x1,'extra':'KO'});return;}_0x256c76=_0x158111['rx']['substring'](0x4)[_0xfc55('0x11')](_0xfc55('0x12'),'');if(_0x256c76['indexOf']('\x20')!=-0x1){_0x256c76=_0x256c76['substr'](0x0,_0x256c76[_0xfc55('0x13')]('\x20'));}if(_[_0xfc55('0x14')](_0x256c76,'-1')){_0x256c76=parseInt(_0x256c76);}_0x10b0d3=_0x158111['rx'][_0xfc55('0x15')]('\x20');if(_0x10b0d3['length']==0x3){_0x10b0d3=_0x10b0d3[0x2]['substring'](0x1,_0x10b0d3[0x2][_0xfc55('0x16')]-0x1);}else if(_0x10b0d3['length']>0x3){var _0x4fe50b=/\((.+)\)/;var _0x4e3650=_0x158111['rx'][_0xfc55('0x17')](_0x4fe50b);if(_0x4e3650){_0x10b0d3=_0x4e3650[0x1];}else{_0x10b0d3=null;}}else{_0x10b0d3=null;}_0x158111['cb'](null,{'code':_0x1df4b9,'result':_0x256c76,'extra':_0x10b0d3});}});_0x1bbf81['on']('error',function(_0x4ac6c8){_0x5416ed['emit'](_0xfc55('0x18'),new AGIError(_0xfc55('0x19'),_0x4ac6c8[_0xfc55('0x1a')]));});_0x1bbf81['on'](_0xfc55('0x1b'),function(){_0x5416ed['emit'](_0xfc55('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1bbf81['on'](_0xfc55('0x1c'),function(){_0x5416ed['emit'](_0xfc55('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1bbf81['destroy']();});_0x1bbf81[_0xfc55('0x1d')](_0x5e596f);this[_0xfc55('0x1e')]=function(_0x32f610,_0x154071){console[_0xfc55('0x1f')](_0xfc55('0x20'),_0x32f610);var _0x32f610=_0x32f610||'',_0x154071=typeof _0x154071=='function'?_0x154071:new Function();_0x158111={'tx':_0x32f610,'rx':'','cb':_0x154071};_0x1bbf81['write'](_0x32f610+'\x0a');},this[_0xfc55('0x1b')]=function(){_0x1bbf81[_0xfc55('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4411d9){return this[_0xfc55('0x1e')][_0xfc55('0x22')](this,_0x4411d9);};AGIChannel[_0xfc55('0x23')][_0xfc55('0x24')]=function(){return this[_0xfc55('0x25')](_0xfc55('0x26'));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x27')]=function(_0x437a8a,_0x1bba49,_0x531833){_0x437a8a=_0x437a8a===undefined?_0xfc55('0x28'):_0x437a8a;_0x1bba49=_0x1bba49===undefined?'5':_0x1bba49;_0x531833=_0x531833===undefined?'1':_0x531833;return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x2a'),_0x437a8a,_0x1bba49*0x3e8,_0x531833));};AGIChannel[_0xfc55('0x23')]['noop']=function(_0x2f6071){_0x2f6071=_0x2f6071||_0xfc55('0x2b');return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x2c'),_0x2f6071));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x2d')]=function(_0xb481bd,_0x434e95){if(_['isArray'](_0x434e95)){return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x2e'),_0xb481bd,_0x434e95['join'](',')));}return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x2e'),_0xb481bd,_0x434e95));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x2f')]=function(_0x23be40){return this[_0xfc55('0x25')](util['format']('SET\x20CONTEXT\x20%s',_0x23be40));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x30')]=function(_0x52a486){return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x31'),_0x52a486));};AGIChannel[_0xfc55('0x23')]['setPriority']=function(_0x421295){return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x32'),_0x421295));};AGIChannel['prototype'][_0xfc55('0xc')]=function(){return this[_0xfc55('0x25')]('HANGUP');};AGIChannel[_0xfc55('0x23')][_0xfc55('0x33')]=function(_0x41e61a,_0x4c67d5){var _0x284437=_[_0xfc55('0x34')](_0x4c67d5)||_[_0xfc55('0x35')](_0x4c67d5)?_0x4c67d5[_0xfc55('0x36')]():_0x4c67d5;return this[_0xfc55('0x25')](util['format'](_0xfc55('0x37'),_0x41e61a,_0x284437?_0x284437['toString']()[_0xfc55('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfc55('0x23')]['sayNumber']=function(_0x59ba08,_0x2a9ed9){return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x38'),_0x59ba08,_0x2a9ed9));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x39')]=function(_0x4c9bf8,_0x9d0894){return this[_0xfc55('0x25')](util[_0xfc55('0x29')](_0xfc55('0x3a'),_0x4c9bf8,_0x9d0894));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x3b')]=function(_0x5764f7,_0x1a5cc5){return this['sendRequest'](util[_0xfc55('0x29')](_0xfc55('0x3c'),_0x5764f7,_0x1a5cc5));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x3d')]=function(_0x7cc826,_0x5e4d0e,_0x853cbb){_0x5e4d0e=_0x5e4d0e||this[_0xfc55('0x3e')];_0x853cbb=_0x853cbb||0x1;this[_0xfc55('0x2f')](_0x7cc826);this[_0xfc55('0x30')](_0x5e4d0e);this[_0xfc55('0x3f')](_0x853cbb);return this[_0xfc55('0x40')](util[_0xfc55('0x29')](_0xfc55('0x41'),_0x7cc826,_0x5e4d0e,_0x853cbb));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x42')]=function(_0x3e65b9){console[_0xfc55('0x1f')](_0xfc55('0x43'),_0x3e65b9);return this['sendRequest'](util[_0xfc55('0x29')](_0xfc55('0x44'),_0x3e65b9));};AGIChannel['prototype'][_0xfc55('0x45')]=function(_0x530c3f,_0x35d5a4,_0x81e668,_0x47343f,_0x154da2,_0x381477){_0x35d5a4=_0x35d5a4||_0xfc55('0x46');_0x81e668=_0x81e668||'';_0x47343f=_0x47343f===undefined?-0x1:_0x47343f==='-1'?-0x1:_0x47343f*0x3e8;_0x154da2=_0x154da2===undefined?'':'s='+_0x154da2;_0x381477=_0x381477?_0xfc55('0x47'):'';return this['sendRequest'](util[_0xfc55('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x530c3f,_0x35d5a4,_0x81e668,_0x47343f,_0x381477,_0x154da2));};AGIChannel[_0xfc55('0x23')]['streamFile']=function(_0xb56d0b,_0x379f90){_0x379f90=_0x379f90||'';return this[_0xfc55('0x25')](util[_0xfc55('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xb56d0b,_0x379f90));};AGIChannel[_0xfc55('0x23')][_0xfc55('0x48')]=function(_0x3f370b){return this[_0xfc55('0x2d')](_0xfc55('0x49'),_0x3f370b);};AGIChannel[_0xfc55('0x23')][_0xfc55('0x4a')]=function(_0xfa8a2e){return this[_0xfc55('0x2d')](_0xfc55('0x4b'),_0xfa8a2e);};AGIChannel[_0xfc55('0x23')][_0xfc55('0x18')]=function(_0x1bf8cc,_0x4e0534){this[_0xfc55('0x40')](util[_0xfc55('0x29')](_0xfc55('0x4c'),_0x1bf8cc['id'],_0x1bf8cc[_0xfc55('0x4d')],_0x4e0534));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfc55('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index b3ec55e..e79308b 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 _0x6b6d=['Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x6b6d[_0x420b24];return _0x4da552;};'use strict';var util=require(_0xd6b6('0x0'));var error={'E_AGI_UNDEFINED':_0xd6b6('0x1'),'E_AGI_ARGUMENT_PORT':_0xd6b6('0x2'),'E_AGI_SERVER_ERROR':_0xd6b6('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd6b6('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd6b6('0x5'),'E_AGI_SOCKET_ERROR':_0xd6b6('0x6'),'E_AGI_SOCKET_CLOSE':_0xd6b6('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xd6b6('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd6b6('0x9'),'E_AGI_IVR_ENTRY':_0xd6b6('0xa')};function AGIError(_0x5aa677){var _0x5aa677=_0x5aa677||null,_0x151300=_0x151300||[],_0xee52b3=0x1,_0xb796b4='';if(!error[_0x5aa677]){_0x5aa677=_0xd6b6('0xb');}_0x151300[_0xd6b6('0xc')](error[_0x5aa677]);while(arguments[_0xee52b3]){_0x151300['push'](arguments[_0xee52b3]);_0xee52b3++;}_0xb796b4=util['format'][_0xd6b6('0xd')](util,_0x151300);this[_0xd6b6('0xe')]=_0xb796b4;this['name']=_0x5aa677;}module[_0xd6b6('0xf')]=AGIError; \ No newline at end of file +var _0xdffe=['E_AGI_UNDEFINED','push','format','apply','message','name','exports','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1cfb7a,_0x44db42){var _0x4ce83b=function(_0x2d6cca){while(--_0x2d6cca){_0x1cfb7a['push'](_0x1cfb7a['shift']());}};_0x4ce83b(++_0x44db42);}(_0xdffe,0x1d2));var _0xedff=function(_0x479691,_0x1002be){_0x479691=_0x479691-0x0;var _0x32a5c1=_0xdffe[_0x479691];return _0x32a5c1;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xedff('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xedff('0x1'),'E_AGI_SERVER_CLOSE':_0xedff('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xedff('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xedff('0x4'),'E_AGI_SOCKET_ERROR':_0xedff('0x5'),'E_AGI_SOCKET_CLOSE':_0xedff('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xedff('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xedff('0x8'),'E_AGI_IVR_ENTRY':_0xedff('0x9')};function AGIError(_0x3601fb){var _0x3601fb=_0x3601fb||null,_0x18b784=_0x18b784||[],_0x207b40=0x1,_0x2b7152='';if(!error[_0x3601fb]){_0x3601fb=_0xedff('0xa');}_0x18b784[_0xedff('0xb')](error[_0x3601fb]);while(arguments[_0x207b40]){_0x18b784[_0xedff('0xb')](arguments[_0x207b40]);_0x207b40++;}_0x2b7152=util[_0xedff('0xc')][_0xedff('0xd')](util,_0x18b784);this[_0xedff('0xe')]=_0x2b7152;this[_0xedff('0xf')]=_0x3601fb;}module[_0xedff('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 3cabb50..e366486 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 _0x253d=['vertices','edges','numberOfEdges','prototype','addEdge','push','relations','getVertex','info','no\x20edge/s\x20available','length','condition','vswitch','target','default','menu','invalid','traverseBFS','agicommand','condition\x20not\x20found','exports','lodash','getsecretdigits'];(function(_0x5899e5,_0x84d997){var _0x320653=function(_0x3b577f){while(--_0x3b577f){_0x5899e5['push'](_0x5899e5['shift']());}};_0x320653(++_0x84d997);}(_0x253d,0x1b3));var _0xd253=function(_0x30354c,_0xd67b24){_0x30354c=_0x30354c-0x0;var _0x190228=_0x253d[_0x30354c];return _0x190228;};'use strict';var _=require(_0xd253('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0xd253('0x1')];var Graph=function(){this[_0xd253('0x2')]={};this[_0xd253('0x3')]={};this[_0xd253('0x4')]=0x0;};Graph[_0xd253('0x5')]['addVertex']=function(_0x2d03f8){this[_0xd253('0x2')][_0x2d03f8['id']]=_0x2d03f8;this[_0xd253('0x3')][_0x2d03f8['id']]=[];};Graph[_0xd253('0x5')][_0xd253('0x6')]=function(_0x487f4e,_0x2c4de4,_0x712c81){this[_0xd253('0x3')][_0x487f4e][_0xd253('0x7')]({'target':_0x2c4de4,'condition':_0x712c81});this[_0xd253('0x4')]+=0x1;};Graph[_0xd253('0x5')]['size']=function(){return _['size'](this[_0xd253('0x2')]);};Graph['prototype'][_0xd253('0x8')]=function(){return this[_0xd253('0x4')];};Graph[_0xd253('0x5')][_0xd253('0x9')]=function(_0xe041e7){return this[_0xd253('0x2')][_0xe041e7];};Graph['prototype']['traverseBFS']=function(_0x195cdd,_0x1f6480){if(!this[_0xd253('0x2')][_0x195cdd]){return logger['info']('no\x20vertex\x20found');}var _0x3a4c2e=_0x1f6480(this[_0xd253('0x2')][_0x195cdd]);if(!_0x3a4c2e){return logger[_0xd253('0xa')]('stop\x20traverse');}if(this[_0xd253('0x3')][_0x195cdd]['length']===0x0){return logger[_0xd253('0xa')](_0xd253('0xb'));}for(var _0x24fa24=0x0,_0x5196a3=[],_0x1b7ed1=![];_0x24fa24\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','clear','vertex','VERTEX','context','extension','priority','vresponse','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','[ERROR]\x20%s','uniqueid','arg_1','calleridname','dnid','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','agi_','substring','stringify','callerid','close','timeout','hangup','sync','production'];(function(_0x3ba07a,_0x1666c1){var _0x41316e=function(_0x439807){while(--_0x439807){_0x3ba07a['push'](_0x3ba07a['shift']());}};_0x41316e(++_0x1666c1);}(_0x18c9,0x13c));var _0x918c=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x18c9[_0x37a79c];return _0x561d89;};'use strict';var parser=require(_0x918c('0x0'));var _=require(_0x918c('0x1'));var syncho=require(_0x918c('0x2'));var util=require(_0x918c('0x3'));var moment=require(_0x918c('0x4'));var config=require(_0x918c('0x5'));var logger=require('../../config/logger')(_0x918c('0x6'));var utilLicense=require(_0x918c('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x918c('0x8'));var Graph=require('./graph');var Vertices=require(_0x918c('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x918c('0x6')]=_[_0x918c('0xa')](config[_0x918c('0x6')],{'ip':_0x918c('0xb'),'port':0x11dd});function connectionHandler(_0x4ad426){process[_0x918c('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4ad426);agiHandler(_0x4ad426);}catch(_0x542f92){logger['error'](_0x542f92[_0x918c('0xd')]);}});});}function listeningHandler(){console[_0x918c('0xe')](_0x918c('0xf'),config[_0x918c('0x6')][_0x918c('0x10')]);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x13'),config['agi']['ip'],config['agi'][_0x918c('0x10')]));}function errorHandler(_0x114f0c){if(_0x114f0c&&_0x114f0c[_0x918c('0x14')]&&_0x114f0c[_0x918c('0x15')]){logger[_0x918c('0x16')](util['format'](_0x918c('0x17'),_0x114f0c[_0x918c('0x14')],_0x114f0c[_0x918c('0x15')]));}else{logger[_0x918c('0x16')](util[_0x918c('0x12')](_0x918c('0x18'),_0x114f0c[_0x918c('0xd')]));}}function closeHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x918c('0x19')]));try{createSquareReport(this);}catch(_0x54f9fa){logger[_0x918c('0x16')](_0x54f9fa[_0x918c('0xd')]);}}function timeoutHandler(){logger[_0x918c('0x11')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this[_0x918c('0x1c')],this[_0x918c('0x19')]));}function hangupHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this['dnid'],this[_0x918c('0x19')]));this['evtHangup']=!![];}function getRoot(_0x5c27d1){return parser[_0x918c('0x1d')](_0x5c27d1,{'object':!![]})['mxGraphModel'][_0x918c('0x1e')];}function addVertex(_0xf3252,_0x4f97be,_0x3780db){_0x4f97be[_0x918c('0x1f')]=_0x3780db;if(_0x4f97be[_0x918c('0x20')](_0x918c('0x21'))){_0x4f97be['maxRetry']=parseInt(_0x4f97be[_0x918c('0x21')],0xa);}_0xf3252[_0x918c('0x22')](_[_0x918c('0x23')](_0x4f97be,_0x918c('0x24')));}function initGraph(_0x124e3d,_0xebf958){var _0x4cf95c=new Graph();for(var _0xed8db9 in _0x124e3d){if(_0x124e3d[_0x918c('0x20')](_0xed8db9)){if(_[_0x918c('0x25')](_0x124e3d[_0xed8db9])){for(var _0x11e8bf=0x0;_0x11e8bf<_0x124e3d[_0xed8db9]['length'];_0x11e8bf+=0x1){addVertex(_0x4cf95c,_0x124e3d[_0xed8db9][_0x11e8bf],_0xed8db9);}}else{addVertex(_0x4cf95c,_0x124e3d[_0xed8db9],_0xed8db9);}}}for(var _0x194e7e=0x0;_0x194e7e<_0xebf958[_0x918c('0x26')];_0x194e7e+=0x1){if(_0xebf958[_0x194e7e]['source']&&_0xebf958[_0x194e7e][_0x918c('0x27')]){_0x4cf95c[_0x918c('0x28')](_0xebf958[_0x194e7e][_0x918c('0x29')],_0xebf958[_0x194e7e][_0x918c('0x27')],_0xebf958[_0x194e7e][_0x918c('0x2a')]);}}return _0x4cf95c;}function getSquareProject(_0x2a1a7e,_0xdf5735){rpc[_0x918c('0x2b')](_0x2a1a7e)[_0x918c('0x2c')](function(_0x344bbb){_0xdf5735(null,_0x344bbb);})['catch'](function(_0x183d31){_0xdf5735(null,_0x183d31);});}function createSquareReport(_0x38c253,_0x4e7981){rpc['createSquareReport'](_0x38c253)[_0x918c('0x2c')](function(_0x2cba74){if(_0x4e7981){_0x4e7981(null,_0x2cba74);}})[_0x918c('0x2d')](function(_0x4ba726){if(_0x4e7981){_0x4e7981(null,_0x4ba726);}});}function setChannelVariables(_0x1c9341){for(var _0x551f56 in _0x1c9341){if(_0x1c9341[_0x918c('0x20')](_0x551f56)){if(_0x551f56[_0x918c('0x2e')](_0x918c('0x2f'))===0x0){_0x1c9341[_0x551f56[_0x918c('0x30')](0x4)]=_0x1c9341[_0x551f56];delete _0x1c9341[_0x551f56];}}}}function getLogFromObject(_0x1476cb){return util['inspect'](_0x1476cb,{'showHidden':![],'depth':null});}function agiHandler(_0x18b46a){var _0x593c0e,_0x46555a,_0x132ccd,_0x90222e,_0x1cff82;logger['debug']('variables',JSON[_0x918c('0x31')](_0x18b46a,null,0x2));logger['info'](util[_0x918c('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a['uniqueid']));_0x18b46a['on']('error',errorHandler);_0x18b46a['on'](_0x918c('0x33'),closeHandler);_0x18b46a['on'](_0x918c('0x34'),timeoutHandler);_0x18b46a['evtHangup']=![];_0x18b46a['on'](_0x918c('0x35'),hangupHandler);var _0x1f10a3=getSquareProject[_0x918c('0x36')](null,_0x18b46a[_0x918c('0x1a')]);if(_0x1f10a3){if(_0x1f10a3[_0x918c('0x37')]){_0x593c0e=getRoot(_0x1f10a3['production']);console[_0x918c('0xe')](_0x918c('0x38'),_0x593c0e);if(_0x593c0e&&_0x593c0e['start']){logger[_0x918c('0x39')]('root',JSON[_0x918c('0x31')](_0x593c0e,null,0x2));_0x18b46a[_0x918c('0x3a')]=moment()['format'](_0x918c('0x3b'));_0x46555a=initGraph(_[_0x918c('0x23')](_0x593c0e,_0x918c('0x24')),_0x593c0e[_0x918c('0x24')]);_0x132ccd=new Vertices(_0x18b46a,rpc,mailRpc);console[_0x918c('0xe')](_0x918c('0x3c'),_0x132ccd);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x3d'),_0x18b46a[_0x918c('0x1a')],_0x18b46a['calleridname'],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));console[_0x918c('0xe')](_0x918c('0x3e'));_0x46555a['traverseBFS'](_0x593c0e[_0x918c('0x3f')]['id'],function(_0x3b39e2){try{_0x3b39e2=_0x132ccd[_0x918c('0x40')](_0x3b39e2);logger[_0x918c('0x39')](_0x918c('0x41'),JSON['stringify'](_0x3b39e2,null,0x2));console[_0x918c('0xe')](_0x918c('0x42'),_0x3b39e2);if(_0x3b39e2[_0x918c('0x1f')]==='gotoc'){logger[_0x918c('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x18b46a[_0x918c('0x43')]=_0x3b39e2[_0x918c('0x43')]||_0x18b46a[_0x918c('0x43')];_0x18b46a[_0x918c('0x44')]=_0x3b39e2['extension'];_0x18b46a[_0x918c('0x45')]=_0x3b39e2[_0x918c('0x45')]?_0x3b39e2[_0x918c('0x45')]-0x1:0x1;return null;}else if(_0x3b39e2&&_0x132ccd[_0x3b39e2[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x3b39e2['agicommand']](_0x3b39e2);console[_0x918c('0xe')](_0x918c('0x46'),_0x1cff82);logger[_0x918c('0x11')]('response',JSON[_0x918c('0x31')](_0x1cff82,null,0x2));if(_0x1cff82&&_0x1cff82['code']===AGI_CODE_SUCCESS&&_0x1cff82[_0x918c('0x47')]!==AGI_RESULT_ERROR&&!_0x18b46a[_0x918c('0x48')]){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')][_0x918c('0x4b')]();}else{logger[_0x918c('0x16')]('response',getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x3d363f){logger[_0x918c('0x16')](_0x3d363f[_0x918c('0xd')]);return null;}});if(_0x593c0e[_0x918c('0x4d')]){logger['info'](util[_0x918c('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a[_0x918c('0x1a')],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));_0x46555a[_0x918c('0x4e')](_0x593c0e[_0x918c('0x4d')]['id'],function(_0x23bc40){try{_0x23bc40=_0x132ccd[_0x918c('0x40')](_0x23bc40);logger[_0x918c('0x39')]('vertex',JSON[_0x918c('0x31')](_0x23bc40,null,0x2));if(_0x23bc40&&_0x132ccd[_0x23bc40[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x23bc40['agicommand']](_0x23bc40);if(_0x1cff82){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')]['toString']();}else{logger['error'](_0x918c('0x49'),getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x44a0de){logger['error'](_0x44a0de[_0x918c('0xd')]);return null;}});}logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x4f'),_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a['callerid'],_0x18b46a['dnid'],_0x18b46a[_0x918c('0x19')]));logger['info'](util[_0x918c('0x12')](_0x918c('0x50'),_0x18b46a['context'],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1));_0x18b46a['continueAt'](_0x18b46a[_0x918c('0x43')],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util[_0x918c('0x12')]('Project\x20%s\x20not\x20published',_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a['context'],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util['format'](_0x918c('0x52'),_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a[_0x918c('0x43')],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}function main(){var _0x1d194f;return utilLicense[_0x918c('0x53')]()['then'](function(_0x291eb0){if(_0x291eb0){if(_0x291eb0[_0x918c('0x54')]){if(_0x291eb0[_0x918c('0x55')]&&_0x291eb0['callysquare']>0x0){logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x56'),_0x291eb0[_0x918c('0x55')]));_0x1d194f=_0x291eb0[_0x918c('0x55')];}else{logger[_0x918c('0x11')](_0x918c('0x57'));}}else{logger['info'](_0x918c('0x58'));_0x1d194f=-0x1;}}})['catch'](function(_0x50fdda){logger[_0x918c('0x16')](_0x918c('0x59'),_0x50fdda[_0x918c('0xd')]);})['finally'](function(){var _0x190c3e=require(_0x918c('0x5a'))(config['agi'][_0x918c('0x10')],config[_0x918c('0x6')]['ip'],_0x1d194f);_0x190c3e['on']('error',errorHandler);_0x190c3e['on'](_0x918c('0x5b'),listeningHandler);_0x190c3e['on'](_0x918c('0x5c'),connectionHandler);_0x190c3e['on'](_0x918c('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0xdf0e=['sync','production','SQUAREROOT','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','traverseBFS','clear','vertex','VERTEX','gotoc','context','extension','priority','response','code','result','evtHangup','finally','isUndefined','toString','agicommand\x20not\x20found','[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','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','./rpc','./mailRpc','./vertices','agi','defaults','127.0.0.1','error','stack','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','debug','variables','stringify','close','timeout'];(function(_0x4513e5,_0x249427){var _0x23e988=function(_0x2d36b4){while(--_0x2d36b4){_0x4513e5['push'](_0x4513e5['shift']());}};_0x23e988(++_0x249427);}(_0xdf0e,0xd5));var _0xedf0=function(_0x19c1c8,_0x2f0b5d){_0x19c1c8=_0x19c1c8-0x0;var _0x39a68a=_0xdf0e[_0x19c1c8];return _0x39a68a;};'use strict';var parser=require(_0xedf0('0x0'));var _=require(_0xedf0('0x1'));var syncho=require(_0xedf0('0x2'));var util=require(_0xedf0('0x3'));var moment=require(_0xedf0('0x4'));var config=require(_0xedf0('0x5'));var logger=require(_0xedf0('0x6'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xedf0('0x7'));var mailRpc=require(_0xedf0('0x8'));var Graph=require('./graph');var Vertices=require(_0xedf0('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xedf0('0xa')]=_[_0xedf0('0xb')](config['agi'],{'ip':_0xedf0('0xc'),'port':0x11dd});function connectionHandler(_0xe81135){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xe81135);agiHandler(_0xe81135);}catch(_0x5a5017){logger[_0xedf0('0xd')](_0x5a5017[_0xedf0('0xe')]);}});});}function listeningHandler(){console[_0xedf0('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xedf0('0xa')]['port']);logger[_0xedf0('0x10')](util[_0xedf0('0x11')](_0xedf0('0x12'),config[_0xedf0('0xa')]['ip'],config[_0xedf0('0xa')][_0xedf0('0x13')]));}function errorHandler(_0x25c21a){if(_0x25c21a&&_0x25c21a[_0xedf0('0x14')]&&_0x25c21a[_0xedf0('0x15')]){logger['error'](util[_0xedf0('0x11')]('[%s]\x20%s',_0x25c21a['name'],_0x25c21a[_0xedf0('0x15')]));}else{logger[_0xedf0('0xd')](util['format'](_0xedf0('0x16'),_0x25c21a[_0xedf0('0xe')]));}}function closeHandler(){logger[_0xedf0('0x10')](util[_0xedf0('0x11')](_0xedf0('0x17'),this[_0xedf0('0x18')],this[_0xedf0('0x19')],this[_0xedf0('0x1a')],this[_0xedf0('0x1b')],this[_0xedf0('0x1c')]));try{createSquareReport(this);}catch(_0x51a824){logger[_0xedf0('0xd')](_0x51a824['stack']);}}function timeoutHandler(){logger[_0xedf0('0x10')](util['format'](_0xedf0('0x1d'),this['arg_1'],this['calleridname'],this[_0xedf0('0x1a')],this[_0xedf0('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xedf0('0x11')](_0xedf0('0x1e'),this[_0xedf0('0x18')],this[_0xedf0('0x19')],this[_0xedf0('0x1a')],this[_0xedf0('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x42fb7b){return parser['toJson'](_0x42fb7b,{'object':!![]})[_0xedf0('0x1f')][_0xedf0('0x20')];}function addVertex(_0x3c5099,_0x346bd9,_0x586645){_0x346bd9[_0xedf0('0x21')]=_0x586645;if(_0x346bd9[_0xedf0('0x22')]('retry')){_0x346bd9[_0xedf0('0x23')]=parseInt(_0x346bd9[_0xedf0('0x24')],0xa);}_0x3c5099[_0xedf0('0x25')](_[_0xedf0('0x26')](_0x346bd9,_0xedf0('0x27')));}function initGraph(_0x2afe79,_0x36a676){var _0xbaf207=new Graph();for(var _0x40fc2c in _0x2afe79){if(_0x2afe79[_0xedf0('0x22')](_0x40fc2c)){if(_[_0xedf0('0x28')](_0x2afe79[_0x40fc2c])){for(var _0xebfcb7=0x0;_0xebfcb7<_0x2afe79[_0x40fc2c]['length'];_0xebfcb7+=0x1){addVertex(_0xbaf207,_0x2afe79[_0x40fc2c][_0xebfcb7],_0x40fc2c);}}else{addVertex(_0xbaf207,_0x2afe79[_0x40fc2c],_0x40fc2c);}}}for(var _0xae9e0d=0x0;_0xae9e0d<_0x36a676[_0xedf0('0x29')];_0xae9e0d+=0x1){if(_0x36a676[_0xae9e0d][_0xedf0('0x2a')]&&_0x36a676[_0xae9e0d][_0xedf0('0x2b')]){_0xbaf207['addEdge'](_0x36a676[_0xae9e0d][_0xedf0('0x2a')],_0x36a676[_0xae9e0d]['target'],_0x36a676[_0xae9e0d][_0xedf0('0x2c')]);}}return _0xbaf207;}function getSquareProject(_0xf41fe1,_0xfdcb50){rpc[_0xedf0('0x2d')](_0xf41fe1)[_0xedf0('0x2e')](function(_0x8abd32){_0xfdcb50(null,_0x8abd32);})[_0xedf0('0x2f')](function(_0x5d1a9d){_0xfdcb50(null,_0x5d1a9d);});}function createSquareReport(_0x19fb8e,_0x25620b){rpc[_0xedf0('0x30')](_0x19fb8e)['then'](function(_0x81eb2){if(_0x25620b){_0x25620b(null,_0x81eb2);}})[_0xedf0('0x2f')](function(_0x174a7c){if(_0x25620b){_0x25620b(null,_0x174a7c);}});}function setChannelVariables(_0x34b1fb){for(var _0x522323 in _0x34b1fb){if(_0x34b1fb[_0xedf0('0x22')](_0x522323)){if(_0x522323[_0xedf0('0x31')](_0xedf0('0x32'))===0x0){_0x34b1fb[_0x522323[_0xedf0('0x33')](0x4)]=_0x34b1fb[_0x522323];delete _0x34b1fb[_0x522323];}}}}function getLogFromObject(_0x1680e2){return util['inspect'](_0x1680e2,{'showHidden':![],'depth':null});}function agiHandler(_0x2cbafa){var _0x1af74a,_0x48b2f2,_0x2d7c91,_0x2f70a2,_0x5b78dd;logger[_0xedf0('0x34')](_0xedf0('0x35'),JSON[_0xedf0('0x36')](_0x2cbafa,null,0x2));logger[_0xedf0('0x10')](util[_0xedf0('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2cbafa[_0xedf0('0x18')],_0x2cbafa[_0xedf0('0x19')],_0x2cbafa['callerid'],_0x2cbafa['dnid'],_0x2cbafa[_0xedf0('0x1c')]));_0x2cbafa['on'](_0xedf0('0xd'),errorHandler);_0x2cbafa['on'](_0xedf0('0x37'),closeHandler);_0x2cbafa['on'](_0xedf0('0x38'),timeoutHandler);_0x2cbafa['evtHangup']=![];_0x2cbafa['on']('hangup',hangupHandler);var _0x4a8500=getSquareProject[_0xedf0('0x39')](null,_0x2cbafa['arg_1']);if(_0x4a8500){if(_0x4a8500[_0xedf0('0x3a')]){_0x1af74a=getRoot(_0x4a8500[_0xedf0('0x3a')]);console[_0xedf0('0xf')](_0xedf0('0x3b'),_0x1af74a);if(_0x1af74a&&_0x1af74a[_0xedf0('0x3c')]){logger[_0xedf0('0x34')](_0xedf0('0x20'),JSON[_0xedf0('0x36')](_0x1af74a,null,0x2));_0x2cbafa[_0xedf0('0x3d')]=moment()['format'](_0xedf0('0x3e'));_0x48b2f2=initGraph(_[_0xedf0('0x26')](_0x1af74a,_0xedf0('0x27')),_0x1af74a['mxCell']);_0x2d7c91=new Vertices(_0x2cbafa,rpc,mailRpc);console[_0xedf0('0xf')](_0xedf0('0x3f'),_0x2d7c91);logger[_0xedf0('0x10')](util[_0xedf0('0x11')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2cbafa[_0xedf0('0x18')],_0x2cbafa[_0xedf0('0x19')],_0x2cbafa[_0xedf0('0x1a')],_0x2cbafa['dnid'],_0x2cbafa['uniqueid']));console[_0xedf0('0xf')]('LOOP\x20through\x20graph');_0x48b2f2[_0xedf0('0x40')](_0x1af74a[_0xedf0('0x3c')]['id'],function(_0xc8dd4c){try{_0xc8dd4c=_0x2d7c91[_0xedf0('0x41')](_0xc8dd4c);logger[_0xedf0('0x34')](_0xedf0('0x42'),JSON[_0xedf0('0x36')](_0xc8dd4c,null,0x2));console[_0xedf0('0xf')](_0xedf0('0x43'),_0xc8dd4c);if(_0xc8dd4c[_0xedf0('0x21')]===_0xedf0('0x44')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2cbafa[_0xedf0('0x45')]=_0xc8dd4c[_0xedf0('0x45')]||_0x2cbafa[_0xedf0('0x45')];_0x2cbafa[_0xedf0('0x46')]=_0xc8dd4c[_0xedf0('0x46')];_0x2cbafa[_0xedf0('0x47')]=_0xc8dd4c['priority']?_0xc8dd4c[_0xedf0('0x47')]-0x1:0x1;return null;}else if(_0xc8dd4c&&_0x2d7c91[_0xc8dd4c[_0xedf0('0x21')]]){_0x5b78dd=_0x2d7c91[_0xc8dd4c[_0xedf0('0x21')]](_0xc8dd4c);console[_0xedf0('0xf')]('vresponse',_0x5b78dd);logger[_0xedf0('0x10')](_0xedf0('0x48'),JSON[_0xedf0('0x36')](_0x5b78dd,null,0x2));if(_0x5b78dd&&_0x5b78dd[_0xedf0('0x49')]===AGI_CODE_SUCCESS&&_0x5b78dd[_0xedf0('0x4a')]!==AGI_RESULT_ERROR&&!_0x2cbafa[_0xedf0('0x4b')]){logger[_0xedf0('0x34')](_0xedf0('0x48'),getLogFromObject(_0x5b78dd));return _['isUndefined'](_0x5b78dd['result'])?null:_0x5b78dd[_0xedf0('0x4a')]['toString']();}else{logger['error'](_0xedf0('0x48'),getLogFromObject(_0x5b78dd));return null;}}else{logger[_0xedf0('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x55900d){logger['error'](_0x55900d[_0xedf0('0xe')]);return null;}});if(_0x1af74a[_0xedf0('0x4c')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2cbafa[_0xedf0('0x18')],_0x2cbafa[_0xedf0('0x19')],_0x2cbafa[_0xedf0('0x1a')],_0x2cbafa[_0xedf0('0x1b')],_0x2cbafa[_0xedf0('0x1c')]));_0x48b2f2['traverseBFS'](_0x1af74a[_0xedf0('0x4c')]['id'],function(_0x13d26b){try{_0x13d26b=_0x2d7c91[_0xedf0('0x41')](_0x13d26b);logger[_0xedf0('0x34')](_0xedf0('0x42'),JSON[_0xedf0('0x36')](_0x13d26b,null,0x2));if(_0x13d26b&&_0x2d7c91[_0x13d26b[_0xedf0('0x21')]]){_0x5b78dd=_0x2d7c91[_0x13d26b[_0xedf0('0x21')]](_0x13d26b);if(_0x5b78dd){logger['debug'](_0xedf0('0x48'),getLogFromObject(_0x5b78dd));return _[_0xedf0('0x4d')](_0x5b78dd['result'])?null:_0x5b78dd['result'][_0xedf0('0x4e')]();}else{logger[_0xedf0('0xd')](_0xedf0('0x48'),getLogFromObject(_0x5b78dd));return null;}}else{logger[_0xedf0('0xd')](_0xedf0('0x4f'));return null;}}catch(_0x2d7b96){logger[_0xedf0('0xd')](_0x2d7b96[_0xedf0('0xe')]);return null;}});}logger[_0xedf0('0x10')](util[_0xedf0('0x11')](_0xedf0('0x50'),_0x2cbafa['arg_1'],_0x2cbafa[_0xedf0('0x19')],_0x2cbafa[_0xedf0('0x1a')],_0x2cbafa[_0xedf0('0x1b')],_0x2cbafa[_0xedf0('0x1c')]));logger[_0xedf0('0x10')](util[_0xedf0('0x11')](_0xedf0('0x51'),_0x2cbafa[_0xedf0('0x45')],_0x2cbafa['extension'],parseInt(_0x2cbafa[_0xedf0('0x47')],0xa)+0x1));_0x2cbafa[_0xedf0('0x52')](_0x2cbafa[_0xedf0('0x45')],_0x2cbafa[_0xedf0('0x46')],parseInt(_0x2cbafa[_0xedf0('0x47')],0xa)+0x1);_0x2cbafa[_0xedf0('0x37')]();}}else{logger['error'](util[_0xedf0('0x11')](_0xedf0('0x53'),_0x2cbafa[_0xedf0('0x18')]));_0x2cbafa[_0xedf0('0x52')](_0x2cbafa['context'],_0x2cbafa[_0xedf0('0x46')],parseInt(_0x2cbafa[_0xedf0('0x47')],0xa)+0x1);_0x2cbafa[_0xedf0('0x37')]();}}else{logger[_0xedf0('0xd')](util[_0xedf0('0x11')]('Project\x20%s\x20not\x20found',_0x2cbafa[_0xedf0('0x18')]));_0x2cbafa[_0xedf0('0x52')](_0x2cbafa[_0xedf0('0x45')],_0x2cbafa[_0xedf0('0x46')],parseInt(_0x2cbafa[_0xedf0('0x47')],0xa)+0x1);_0x2cbafa[_0xedf0('0x37')]();}}function main(){var _0x7d07f5;return utilLicense['getLicense']()[_0xedf0('0x2e')](function(_0x30a7ff){if(_0x30a7ff){if(_0x30a7ff[_0xedf0('0x54')]){if(_0x30a7ff['callysquare']&&_0x30a7ff[_0xedf0('0x55')]>0x0){logger[_0xedf0('0x10')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x30a7ff[_0xedf0('0x55')]));_0x7d07f5=_0x30a7ff[_0xedf0('0x55')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xedf0('0x10')](_0xedf0('0x56'));_0x7d07f5=-0x1;}}})[_0xedf0('0x2f')](function(_0x5a4818){logger[_0xedf0('0xd')](_0xedf0('0x57'),_0x5a4818['stack']);})[_0xedf0('0x4c')](function(){var _0x246b8b=require('./server')(config[_0xedf0('0xa')][_0xedf0('0x13')],config['agi']['ip'],_0x7d07f5);_0x246b8b['on'](_0xedf0('0xd'),errorHandler);_0x246b8b['on'](_0xedf0('0x58'),listeningHandler);_0x246b8b['on'](_0xedf0('0x59'),connectionHandler);_0x246b8b['on'](_0xedf0('0x37'),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 db0d73a..70581ca 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x4a5f85,_0x417ea5){var _0xef9c32=function(_0x2b39fb){while(--_0x2b39fb){_0x4a5f85['push'](_0x4a5f85['shift']());}};_0xef9c32(++_0x417ea5);}(_0x814b,0x1a2));var _0xb814=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x814b[_0x2ec5b9];return _0x10dcea;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x32b96b,_0x5c7e0c){var _0x3dc743=function(_0x32eecc){while(--_0x32eecc){_0x32b96b['push'](_0x32b96b['shift']());}};_0x3dc743(++_0x5c7e0c);}(_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/agi/reply.js b/server/services/agi/reply.js index 891b8b9..b50a2cd 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3a5ce5,_0x501ad8){var _0x45ab6c=function(_0x28e523){while(--_0x28e523){_0x3a5ce5['push'](_0x3a5ce5['shift']());}};_0x45ab6c(++_0x501ad8);}(_0x7a54,0x106));var _0x47a5=function(_0x15f196,_0x3b21dc){_0x15f196=_0x15f196-0x0;var _0x4841fd=_0x7a54[_0x15f196];return _0x4841fd;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xb10b[_0x2300c7];return _0x23f720;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 83bb1d2..1345807 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 _0x98de=['ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById'];(function(_0x43862e,_0x4a9e13){var _0x255562=function(_0xd6157){while(--_0xd6157){_0x43862e['push'](_0x43862e['shift']());}};_0x255562(++_0x4a9e13);}(_0x98de,0x114));var _0xe98d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x98de[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0xe98d('0x0'));var moment=require(_0xe98d('0x1'));var _=require(_0xe98d('0x2'));var util=require('util');var jayson=require(_0xe98d('0x3'));var client=jayson['client'][_0xe98d('0x4')]({'port':0x2329});function request(_0x23de9c,_0x396c62){return new BPromise(function(_0x325f55,_0x255776){return client[_0xe98d('0x5')](_0x23de9c,_0x396c62)[_0xe98d('0x6')](function(_0x480432){if(_0x480432[_0xe98d('0x7')]){return _0x255776(_0x480432[_0xe98d('0x7')][_0xe98d('0x8')]);}else{return _0x325f55(_0x480432[_0xe98d('0x9')]);}})[_0xe98d('0xa')](function(_0x57532f){return _0x255776(_0x57532f);});});}exports[_0xe98d('0xb')]=function(_0xc936f5){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xc936f5},'attributes':[_0xe98d('0xc')]}});};exports[_0xe98d('0xd')]=function(_0x1b88b7){return request(_0xe98d('0xe'),{'options':{'raw':![],'where':{'id':_0x1b88b7},'include':[{'model':_0xe98d('0xf'),'as':_0xe98d('0x10')}],'attributes':['id',_0xe98d('0x11'),_0xe98d('0x12')]}});};exports[_0xe98d('0x13')]=function(_0x2f5422){return request(_0xe98d('0x14'),{'options':{'where':{'id':_0x2f5422},'attributes':['name']}});};exports[_0xe98d('0x15')]=function(_0x4163d8){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4163d8},'attributes':['name']}});};exports[_0xe98d('0x16')]=function(_0x11ad38){return request(_0xe98d('0x17'),{'options':{'where':{'id':_0x11ad38},'attributes':[_0xe98d('0x11')]}});};exports['getSquareOdbcById']=function(_0xa58310){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xa58310},'attributes':[_0xe98d('0x18')]}});};exports[_0xe98d('0x19')]=function(_0x5280c9){return request(_0xe98d('0x1a'),{'options':{'where':{'id':_0x5280c9},'attributes':['name']}});};exports[_0xe98d('0x1b')]=function(_0x1b89ce){return request(_0xe98d('0x1c'),{'options':{'where':{'id':_0x1b89ce},'attributes':['name']}});};exports[_0xe98d('0x1d')]=function(_0x3b3c52){return request(_0xe98d('0x1e'),{'options':{'where':{'id':_0x3b3c52},'attributes':['save_name']}});};exports[_0xe98d('0x1f')]=function(_0x1c8cf0){return request(_0xe98d('0x20'),{'options':{'raw':![],'where':{'id':_0x1c8cf0},'include':[{'model':_0xe98d('0x21'),'as':_0xe98d('0x22')}]}});};exports[_0xe98d('0x23')]=function(_0x591603){return request('ShowSmsAccount',{'options':{'where':{'id':_0x591603},'attributes':['id',_0xe98d('0x11')]}});};exports[_0xe98d('0x24')]=function(_0x21dca9){return request('CreateSmsMessage',{'body':_0x21dca9});};exports['createSquareDetailsReport']=function(_0x4d6c49){return request(_0xe98d('0x25'),{'body':_0x4d6c49});};exports[_0xe98d('0x26')]=function(_0x437258){return request(_0xe98d('0x27'),{'body':_[_0xe98d('0x28')](_0x437258,{'project_name':_0x437258['arg_1'],'prev_project_name':_0x437258['arg_2']||'','is_subproject':_0x437258[_0xe98d('0x29')]?!![]:![],'leaveAt':moment()[_0xe98d('0x2a')](_0xe98d('0x2b'))})});};exports[_0xe98d('0x2c')]=function(_0x56a68f){return request(_0xe98d('0x2d'),{'body':_0x56a68f});};exports[_0xe98d('0x2e')]=function(_0x99f608){return request(_0xe98d('0x2f'),{'body':_0x99f608});};exports['createCmContact']=function(_0x5695cb){return request(_0xe98d('0x30'),{'options':{'raw':![],'where':{'phone':_0x5695cb['phone'],'ListId':_0x5695cb['ListId']}}})[_0xe98d('0x6')](function(_0x7a1ac7){if(_0x7a1ac7){return _0x7a1ac7;}return request(_0xe98d('0x31'),{'body':_0x5695cb});});};exports['getPauseById']=function(_0x50847f){return request(_0xe98d('0x32'),{'options':{'where':{'id':_0x50847f},'attributes':['name']}});};exports['agentLogin']=function(_0x1b518c,_0x1a3626){return request(_0xe98d('0x33'),{'body':{'interface':_0x1a3626},'options':{'where':_0x1b518c}});};exports[_0xe98d('0x34')]=function(_0x37b0e9,_0x55b49a,_0x3b1b5e){return request(_0xe98d('0x35'),{'body':{'type':_0x55b49a,'uniqueid':_0x3b1b5e},'options':{'where':_0x37b0e9}});};exports[_0xe98d('0x36')]=function(_0x15734e){return request(_0xe98d('0x37'),{'body':{},'options':{'where':_0x15734e}});};exports[_0xe98d('0x38')]=function(_0x5ce194){return request(_0xe98d('0x39'),{'body':{},'options':{'where':_0x5ce194}});}; \ No newline at end of file +var _0x7161=['save_name','Interval','Intervals','ShowSmsAccount','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','http','request','then','error','message','catch','production','getMailAccountById','ShowMailAccount','MailServerOut','email','getVoiceQueueById','name','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','log','rpcreq','getTrunkById','ShowTrunk','ShowSound'];(function(_0x333220,_0x2d7896){var _0x3b1ad1=function(_0x1a5130){while(--_0x1a5130){_0x333220['push'](_0x333220['shift']());}};_0x3b1ad1(++_0x2d7896);}(_0x7161,0xc4));var _0x1716=function(_0x4287d1,_0x42528e){_0x4287d1=_0x4287d1-0x0;var _0x57ae0a=_0x7161[_0x4287d1];return _0x57ae0a;};'use strict';var BPromise=require(_0x1716('0x0'));var moment=require(_0x1716('0x1'));var _=require(_0x1716('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson['client'][_0x1716('0x3')]({'port':0x2329});function request(_0x5da3b6,_0x164bf8){return new BPromise(function(_0x1b160b,_0x40f00d){return client[_0x1716('0x4')](_0x5da3b6,_0x164bf8)[_0x1716('0x5')](function(_0x1f5893){if(_0x1f5893[_0x1716('0x6')]){return _0x40f00d(_0x1f5893[_0x1716('0x6')][_0x1716('0x7')]);}else{return _0x1b160b(_0x1f5893['result']);}})[_0x1716('0x8')](function(_0x84828){return _0x40f00d(_0x84828);});});}exports['getSquareProject']=function(_0xa4aaae){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xa4aaae},'attributes':[_0x1716('0x9')]}});};exports[_0x1716('0xa')]=function(_0x968ba6){return request(_0x1716('0xb'),{'options':{'raw':![],'where':{'id':_0x968ba6},'include':[{'model':_0x1716('0xc'),'as':'Smtp'}],'attributes':['id','name',_0x1716('0xd')]}});};exports['getSquareProjectById']=function(_0xeead5d){return request('ShowSquareProject',{'options':{'where':{'id':_0xeead5d},'attributes':['name']}});};exports[_0x1716('0xe')]=function(_0x5c3132){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5c3132},'attributes':[_0x1716('0xf')]}});};exports['getVariableById']=function(_0x3ffe54){return request(_0x1716('0x10'),{'options':{'where':{'id':_0x3ffe54},'attributes':[_0x1716('0xf')]}});};exports[_0x1716('0x11')]=function(_0x174cbb){return request(_0x1716('0x12'),{'options':{'where':{'id':_0x174cbb},'attributes':[_0x1716('0x13')]}});};exports[_0x1716('0x14')]=function(_0x2a4195){return request(_0x1716('0x15'),{'options':{'where':{'id':_0x2a4195},'attributes':[_0x1716('0xf')]}});};exports[_0x1716('0x16')]=function(_0x58bfec){console[_0x1716('0x17')](_0x1716('0x18'),_0x58bfec);return request(_0x1716('0x16'),{'options':{'where':{'phone':_0x58bfec},'attributes':['id']}});};exports[_0x1716('0x19')]=function(_0x565723){return request(_0x1716('0x1a'),{'options':{'where':{'id':_0x565723},'attributes':[_0x1716('0xf')]}});};exports['getSoundById']=function(_0x564965){return request(_0x1716('0x1b'),{'options':{'where':{'id':_0x564965},'attributes':[_0x1716('0x1c')]}});};exports['getIntervalById']=function(_0x21e8f8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x21e8f8},'include':[{'model':_0x1716('0x1d'),'as':_0x1716('0x1e')}]}});};exports['getSmsAccountById']=function(_0x32c58f){return request(_0x1716('0x1f'),{'options':{'where':{'id':_0x32c58f},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x3f85d2){return request('CreateSmsMessage',{'body':_0x3f85d2});};exports[_0x1716('0x20')]=function(_0x32d12e){return request('CreateSquareDetailsReport',{'body':_0x32d12e});};exports[_0x1716('0x21')]=function(_0x44130f){return request(_0x1716('0x22'),{'body':_[_0x1716('0x23')](_0x44130f,{'project_name':_0x44130f[_0x1716('0x24')],'prev_project_name':_0x44130f['arg_2']||'','is_subproject':_0x44130f[_0x1716('0x25')]?!![]:![],'leaveAt':moment()['format'](_0x1716('0x26'))})});};exports[_0x1716('0x27')]=function(_0x4f3ec5){return request('CreateSquareRecording',{'body':_0x4f3ec5});};exports[_0x1716('0x28')]=function(_0x4f169b){return request('CreateSquareMessage',{'body':_0x4f169b});};exports[_0x1716('0x29')]=function(_0x2b917c){return request(_0x1716('0x2a'),{'options':{'raw':![],'where':{'phone':_0x2b917c[_0x1716('0x2b')],'ListId':_0x2b917c[_0x1716('0x2c')]}}})[_0x1716('0x5')](function(_0x3a4ce7){if(_0x3a4ce7){return _0x3a4ce7;}return request(_0x1716('0x2d'),{'body':_0x2b917c});});};exports[_0x1716('0x2e')]=function(_0x19c64e){return request(_0x1716('0x2f'),{'options':{'where':{'id':_0x19c64e},'attributes':[_0x1716('0xf')]}});};exports[_0x1716('0x30')]=function(_0x6e23aa,_0x4aec05){return request(_0x1716('0x31'),{'body':{'interface':_0x4aec05},'options':{'where':_0x6e23aa}});};exports[_0x1716('0x32')]=function(_0x475544,_0x53de97,_0x3a88c9){return request(_0x1716('0x33'),{'body':{'type':_0x53de97,'uniqueid':_0x3a88c9},'options':{'where':_0x475544}});};exports[_0x1716('0x34')]=function(_0x2eaea5){return request(_0x1716('0x35'),{'body':{},'options':{'where':_0x2eaea5}});};exports[_0x1716('0x36')]=function(_0x888d89){return request(_0x1716('0x37'),{'body':{},'options':{'where':_0x888d89}});}; \ 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 a5e1ccf..d5d508b 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 _0xf3cd=['./lex','exports','./polly'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xf3cd[_0x599c94];return _0x34e215;};var polly=require(_0xdf3c('0x0'));var lex=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x80d9=['./polly','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x80d9,0x15c));var _0x980d=function(_0x5b0b10,_0x42b62e){_0x5b0b10=_0x5b0b10-0x0;var _0x581ae2=_0x80d9[_0x5b0b10];return _0x581ae2;};var polly=require(_0x980d('0x0'));var lex=require('./lex');module[_0x980d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 71329d0..7b385e1 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 _0x2356=['exports'];(function(_0x442a76,_0x2ad2ff){var _0x474fab=function(_0x2b52c7){while(--_0x2b52c7){_0x442a76['push'](_0x442a76['shift']());}};_0x474fab(++_0x2ad2ff);}(_0x2356,0x14f));var _0x6235=function(_0x339458,_0x345ea5){_0x339458=_0x339458-0x0;var _0x241a7d=_0x2356[_0x339458];return _0x241a7d;};'use strict';var lex=require('./lib/api');module[_0x6235('0x0')]=function(_0xbfa2ed,_0x590910,_0x49b0d5,_0x18ce63,_0x32930d,_0x5c536f){return lex(_0xbfa2ed,_0x590910,_0x49b0d5,_0x18ce63,_0x32930d,_0x5c536f);}; \ No newline at end of file +var _0x41bb=['exports','./lib/api'];(function(_0x27c4c5,_0x178a48){var _0x5ab4d5=function(_0x4f382c){while(--_0x4f382c){_0x27c4c5['push'](_0x27c4c5['shift']());}};_0x5ab4d5(++_0x178a48);}(_0x41bb,0xc5));var _0xb41b=function(_0x2e4ca1,_0x371286){_0x2e4ca1=_0x2e4ca1-0x0;var _0x206c57=_0x41bb[_0x2e4ca1];return _0x206c57;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ 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 ecf2130..3277952 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 _0xb6a3=['LexRuntime','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','exports'];(function(_0x1c0c4f,_0x4971fa){var _0x45aa40=function(_0x46dc2a){while(--_0x46dc2a){_0x1c0c4f['push'](_0x1c0c4f['shift']());}};_0x45aa40(++_0x4971fa);}(_0xb6a3,0x8e));var _0x3b6a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb6a3[_0x5d6456];return _0x4d66c1;};'use strict';var BPromise=require(_0x3b6a('0x0'));var AWS=require(_0x3b6a('0x1'));function lexResult(_0xb93142,_0x49d8d4){return new BPromise(function(_0x3f5807,_0x3bd763){_0xb93142['postText'](_0x49d8d4,function(_0x4d1b15,_0x3a3ede){if(_0x4d1b15){_0x3bd763(_0x4d1b15);}if(_0x3a3ede[_0x3b6a('0x2')]){for(const _0xa93798 in _0x3a3ede[_0x3b6a('0x2')]){if(_0x3a3ede[_0x3b6a('0x2')][_0x3b6a('0x3')](_0xa93798)){var _0x5c4d5a=_0x3a3ede[_0x3b6a('0x2')][_0xa93798];_0x3a3ede['slot_'+_0xa93798]=_0x5c4d5a;}}}_0x3f5807(_0x3a3ede);});});}module[_0x3b6a('0x4')]=function(_0x463163,_0x2b14fb,_0x113356,_0x15d977,_0x2ae309,_0x5a5270){var _0x49bea3=new AWS[(_0x3b6a('0x5'))]({'accessKeyId':_0x2b14fb,'secretAccessKey':_0x113356,'region':_0x15d977});var _0x1421ff={'botAlias':_0x3b6a('0x6'),'botName':_0x5a5270,'inputText':_0x2ae309,'userId':_0x463163};return lexResult(_0x49bea3,_0x1421ff);}; \ No newline at end of file +var _0xcac9=['bluebird','aws-sdk','slots','slot_'];(function(_0x64daf7,_0x3ce579){var _0x11d8d8=function(_0x3d986b){while(--_0x3d986b){_0x64daf7['push'](_0x64daf7['shift']());}};_0x11d8d8(++_0x3ce579);}(_0xcac9,0x1a4));var _0x9cac=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcac9[_0x5d7227];return _0x15ac55;};'use strict';var BPromise=require(_0x9cac('0x0'));var AWS=require(_0x9cac('0x1'));function lexResult(_0x502842,_0x24f8ac){return new BPromise(function(_0x2943ad,_0x500080){_0x502842['postText'](_0x24f8ac,function(_0xe3c088,_0xbab3f2){if(_0xe3c088){_0x500080(_0xe3c088);}if(_0xbab3f2[_0x9cac('0x2')]){for(const _0x5cb052 in _0xbab3f2[_0x9cac('0x2')]){if(_0xbab3f2['slots']['hasOwnProperty'](_0x5cb052)){var _0x1a23d7=_0xbab3f2[_0x9cac('0x2')][_0x5cb052];_0xbab3f2[_0x9cac('0x3')+_0x5cb052]=_0x1a23d7;}}}_0x2943ad(_0xbab3f2);});});}module['exports']=function(_0x365040,_0x4103d0,_0x39f738,_0x141b59,_0xcd283e,_0x552791){var _0x537665=new AWS['LexRuntime']({'accessKeyId':_0x4103d0,'secretAccessKey':_0x39f738,'region':_0x141b59});var _0x10c6df={'botAlias':'$LATEST','botName':_0x552791,'inputText':_0xcd283e,'userId':_0x365040};return lexResult(_0x537665,_0x10c6df);}; \ 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 2322d21..f95364f 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 _0xa5ea=['./lib/api','exports'];(function(_0x1948b1,_0x3ffc82){var _0x190c87=function(_0x5d3035){while(--_0x5d3035){_0x1948b1['push'](_0x1948b1['shift']());}};_0x190c87(++_0x3ffc82);}(_0xa5ea,0xb8));var _0xaa5e=function(_0x10b3d7,_0x2903cb){_0x10b3d7=_0x10b3d7-0x0;var _0x374fc4=_0xa5ea[_0x10b3d7];return _0x374fc4;};'use strict';var polly=require(_0xaa5e('0x0'));module[_0xaa5e('0x1')]=function(_0x40c691,_0x519df2,_0x49b1f6,_0x34b8f7,_0x2cda6a,_0x2becc5,_0x31ed47){return polly(_0x40c691,_0x519df2,_0x49b1f6,_0x34b8f7,_0x2cda6a,_0x2becc5,_0x31ed47);}; \ No newline at end of file +var _0x0a0a=['./lib/api','exports'];(function(_0x1a8cda,_0x31d5d3){var _0x1bd298=function(_0x3f33c0){while(--_0x3f33c0){_0x1a8cda['push'](_0x1a8cda['shift']());}};_0x1bd298(++_0x31d5d3);}(_0x0a0a,0x11c));var _0xa0a0=function(_0x21777c,_0x236968){_0x21777c=_0x21777c-0x0;var _0x38a7ac=_0x0a0a[_0x21777c];return _0x38a7ac;};'use strict';var polly=require(_0xa0a0('0x0'));module[_0xa0a0('0x1')]=function(_0x2b17e9,_0x4d830d,_0x36ba2e,_0x14b1ed,_0xe104aa,_0x55e932,_0x1bdb27){return polly(_0x2b17e9,_0x4d830d,_0x36ba2e,_0x14b1ed,_0xe104aa,_0x55e932,_0x1bdb27);}; \ 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 b9d0b43..aeaef56 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 _0x2f66=['randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','path'];(function(_0x46b8aa,_0x246d21){var _0x5a3d61=function(_0x5c748d){while(--_0x5c748d){_0x46b8aa['push'](_0x46b8aa['shift']());}};_0x5a3d61(++_0x246d21);}(_0x2f66,0xfb));var _0x62f6=function(_0x30c3c2,_0x330cca){_0x30c3c2=_0x30c3c2-0x0;var _0x738110=_0x2f66[_0x30c3c2];return _0x738110;};'use strict';var fs=require('fs');var path=require(_0x62f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x62f6('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x87070f,_0x57c2c5,_0x1861db){return new BPromise(function(_0x225724,_0xd2213e){_0x87070f[_0x62f6('0x2')](_0x57c2c5,function(_0x36aca4,_0x5754ca){if(_0x36aca4){_0xd2213e(_0x36aca4);}else if(_0x5754ca){if(_0x5754ca[_0x62f6('0x3')]instanceof Buffer){fs['writeFile'](_0x1861db,_0x5754ca[_0x62f6('0x3')],function(_0x4a6a1c){if(_0x4a6a1c){_0xd2213e(_0x4a6a1c);}else{_0x225724();}});}else{_0xd2213e(new Error(_0x62f6('0x4')));}}else{_0xd2213e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x62f6('0x5')]=function(_0x51993a,_0x117bba,_0x25894a,_0x56ade7,_0x493cb3,_0x2a4384,_0x11619a){var _0x39ca96=new AWS['Polly']({'accessKeyId':_0x51993a,'secretAccessKey':_0x117bba,'region':_0x25894a});var _0x3ca0c3={'Text':_0x493cb3,'TextType':_0x2a4384||_0x62f6('0x6'),'OutputFormat':'mp3','VoiceId':_0x56ade7};return pollyResult(_0x39ca96,_0x3ca0c3,_0x11619a);}; \ No newline at end of file +var _0x55bf=['exports','Polly','mp3','path','bluebird','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0xa0d6e8,_0x41e320){var _0x4ba300=function(_0x5ad796){while(--_0x5ad796){_0xa0d6e8['push'](_0xa0d6e8['shift']());}};_0x4ba300(++_0x41e320);}(_0x55bf,0x1f2));var _0xf55b=function(_0x2791b9,_0x3c8db3){_0x2791b9=_0x2791b9-0x0;var _0x1810b9=_0x55bf[_0x2791b9];return _0x1810b9;};'use strict';var fs=require('fs');var path=require(_0xf55b('0x0'));var BPromise=require(_0xf55b('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x2571ff,_0x2960c4,_0x55b317){return new BPromise(function(_0x55f1c5,_0xdb1dd6){_0x2571ff[_0xf55b('0x2')](_0x2960c4,function(_0x46b161,_0x2998fd){if(_0x46b161){_0xdb1dd6(_0x46b161);}else if(_0x2998fd){if(_0x2998fd['AudioStream']instanceof Buffer){fs[_0xf55b('0x3')](_0x55b317,_0x2998fd[_0xf55b('0x4')],function(_0x3af113){if(_0x3af113){_0xdb1dd6(_0x3af113);}else{_0x55f1c5();}});}else{_0xdb1dd6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xdb1dd6(new Error(_0xf55b('0x5')));}});});}module[_0xf55b('0x6')]=function(_0x455910,_0x338078,_0x2c6f78,_0x1da135,_0x2eabdb,_0x263252,_0x577708){var _0x49d9e4=new AWS[(_0xf55b('0x7'))]({'accessKeyId':_0x455910,'secretAccessKey':_0x338078,'region':_0x2c6f78});var _0x446c52={'Text':_0x2eabdb,'TextType':_0x263252||'text','OutputFormat':_0xf55b('0x8'),'VoiceId':_0x1da135};return pollyResult(_0x49d9e4,_0x446c52,_0x577708);}; \ 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 40a32d0..b6cfaf2 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 _0x59fc=['./lib/api'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x59fc,0x131));var _0xc59f=function(_0xd9b22c,_0x2abc5e){_0xd9b22c=_0xd9b22c-0x0;var _0xb088ed=_0x59fc[_0xd9b22c];return _0xb088ed;};'use strict';var asr=require(_0xc59f('0x0'));module['exports']=function(_0x587665,_0x5c2417,_0x3bb35b,_0x5240a1){return asr(_0x587665,_0x5c2417,_0x3bb35b);}; \ No newline at end of file +var _0x9aeb=['./lib/api','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9aeb,0x158));var _0xb9ae=function(_0xb3b97c,_0xc95060){_0xb3b97c=_0xb3b97c-0x0;var _0x34f38b=_0x9aeb[_0xb3b97c];return _0x34f38b;};'use strict';var asr=require(_0xb9ae('0x0'));module[_0xb9ae('0x1')]=function(_0x50012e,_0x537e53,_0xc8a1eb,_0x4e3e77){return asr(_0x50012e,_0x537e53,_0xc8a1eb);}; \ 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 e7170ed..52a8831 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 _0xed92=['length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','exports','string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x138ec3,_0x5c1f4e){var _0x574718=function(_0x2edf7c){while(--_0x2edf7c){_0x138ec3['push'](_0x138ec3['shift']());}};_0x574718(++_0x5c1f4e);}(_0xed92,0x1ba));var _0x2ed9=function(_0x54dec7,_0x1a40ca){_0x54dec7=_0x54dec7-0x0;var _0x2d19a3=_0xed92[_0x54dec7];return _0x2d19a3;};'use strict';var url=require(_0x2ed9('0x0'));var BPromise=require(_0x2ed9('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x2ed9('0x2')]=function(_0x46d153,_0x1c8090,_0x85eb3a){return new BPromise(function(_0x8bb7fc,_0x2f9594){var _0x223f0b;if(typeof _0x46d153!=='string'||_0x46d153['length']===0x0){return _0x2f9594('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x1c8090!==_0x2ed9('0x3')||_0x1c8090['length']===0x0){return _0x2f9594(_0x2ed9('0x4'));}if(typeof _0x85eb3a!==_0x2ed9('0x5')&&(typeof _0x85eb3a!==_0x2ed9('0x3')||_0x85eb3a[_0x2ed9('0x6')]===0x0)){return _0x2f9594(_0x2ed9('0x7'));}try{_0x223f0b=fs[_0x2ed9('0x8')](_0x46d153)[_0x2ed9('0x9')](_0x2ed9('0xa'));}catch(_0x5ce8cb){return _0x2f9594(_0x5ce8cb);}return _0x8bb7fc({'method':_0x2ed9('0xb'),'uri':host+_0x2ed9('0xc')+_0x1c8090,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x2ed9('0xd'),'languageCode':_0x85eb3a},'audio':{'content':_0x223f0b}},'json':!![]});});}; \ No newline at end of file +var _0xc9f8=['readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xc9f8,0x1f0));var _0x8c9f=function(_0x2eb264,_0x4308a9){_0x2eb264=_0x2eb264-0x0;var _0x394a98=_0xc9f8[_0x2eb264];return _0x394a98;};'use strict';var url=require(_0x8c9f('0x0'));var BPromise=require(_0x8c9f('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x2fa738,_0x1b8bac,_0xc608da){return new BPromise(function(_0x221650,_0x5bcfac){var _0x1909b7;if(typeof _0x2fa738!=='string'||_0x2fa738[_0x8c9f('0x2')]===0x0){return _0x5bcfac(_0x8c9f('0x3'));}if(typeof _0x1b8bac!==_0x8c9f('0x4')||_0x1b8bac[_0x8c9f('0x2')]===0x0){return _0x5bcfac(_0x8c9f('0x5'));}if(typeof _0xc608da!==_0x8c9f('0x6')&&(typeof _0xc608da!=='string'||_0xc608da[_0x8c9f('0x2')]===0x0)){return _0x5bcfac(_0x8c9f('0x7'));}try{_0x1909b7=fs[_0x8c9f('0x8')](_0x2fa738)[_0x8c9f('0x9')](_0x8c9f('0xa'));}catch(_0x12832e){return _0x5bcfac(_0x12832e);}return _0x221650({'method':_0x8c9f('0xb'),'uri':host+_0x8c9f('0xc')+_0x1b8bac,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x8c9f('0xd'),'languageCode':_0xc608da},'audio':{'content':_0x1909b7}},'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 fa7e904..10cb4be 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 _0xc6df=['exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc6df,0x65));var _0xfc6d=function(_0x5b2891,_0x4d8436){_0x5b2891=_0x5b2891-0x0;var _0x2cec56=_0xc6df[_0x5b2891];return _0x2cec56;};var asr=require('./asr');module[_0xfc6d('0x0')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index b151234..8a30366 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 _0xd93b=['wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','info','.mp3','goggleTTS\x20path','googleASR','alternatives','transcript','join','results','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','stringify','result','source','resolvedQuery','action','score','status','code','endConversation','metadata','isFallbackIntent','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','Data','dirName','path','http','https','url','parse','bluebird','randomstring','sox','request-promise','util','google-tts-api','md5','./sestek','../../../config/logger','agi','https:','host','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','WHAT_EVER','get','data','transcode'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xd93b,0x1e6));var _0xbd93=function(_0x23daee,_0x13f2ca){_0x23daee=_0x23daee-0x0;var _0x530a19=_0xd93b[_0x23daee];return _0x530a19;};'use strict';var fs=require('fs');var path=require(_0xbd93('0x0'));var http=require(_0xbd93('0x1'));var https=require(_0xbd93('0x2'));var urlParse=require(_0xbd93('0x3'))[_0xbd93('0x4')];var BPromise=require(_0xbd93('0x5'));var rs=require(_0xbd93('0x6'));var sox=require(_0xbd93('0x7'));var rp=require(_0xbd93('0x8'));var util=require(_0xbd93('0x9'));var querystring=require('querystring');var tts=require(_0xbd93('0xa'));var apiai=require('apiai-promise');var md5=require(_0xbd93('0xb'));var google=require('./google');var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0xbd93('0xc'));var logger=require(_0xbd93('0xd'))(_0xbd93('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x52fcad,_0x96fd40){return new BPromise(function(_0x1d93ed,_0x2c6dbf){var _0x210ad7=urlParse(_0x52fcad);var _0x303140=_0x210ad7['protocol']===_0xbd93('0xf')?https:http;var _0x5e8bd3={'host':_0x210ad7[_0xbd93('0x10')],'path':_0x210ad7[_0xbd93('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x303140['get'](_0x5e8bd3,function(_0x7aef21){if(_0x7aef21[_0xbd93('0x11')]!==0xc8){logger[_0xbd93('0x12')](_0xbd93('0x13')+_0x52fcad+'\x20failed,\x20status\x20code\x20=\x20'+_0x7aef21['statusCode']+'\x20('+_0x7aef21[_0xbd93('0x14')]+')');_0x2c6dbf(new Error(_0xbd93('0x13')+_0x52fcad+'\x20failed,\x20status\x20code\x20=\x20'+_0x7aef21[_0xbd93('0x11')]+'\x20('+_0x7aef21['statusMessage']+')'));return;}var _0x5ecb81=fs[_0xbd93('0x15')](_0x96fd40);_0x5ecb81['on'](_0xbd93('0x16'),function(){logger['info'](_0xbd93('0x17'));_0x5ecb81[_0xbd93('0x18')](_0x1d93ed);});_0x5ecb81['on'](_0xbd93('0x12'),function(_0x3c3276){fs[_0xbd93('0x19')](_0x96fd40);logger['error'](_0xbd93('0x1a'),_0x3c3276);_0x2c6dbf(_0x3c3276);});_0x7aef21[_0xbd93('0x1b')](_0x5ecb81);})['on'](_0xbd93('0x12'),function(_0x2d750a){logger['error'](_0x2d750a);_0x2c6dbf(_0x2d750a);})[_0xbd93('0x1c')]();});}function uploadFile(_0xfdc2f2){return new BPromise(function(_0x1a1ae6,_0x4694c3){var _0xc24212=urlParse(_0xfdc2f2);var _0x32f3de=_0xc24212[_0xbd93('0x1d')]===_0xbd93('0xf')?https:http;var _0x1d5014={'host':_0xc24212['host'],'path':_0xc24212[_0xbd93('0x0')],'headers':{'user-agent':_0xbd93('0x1e')}};_0x32f3de[_0xbd93('0x1f')](_0x1d5014,function(_0x261366){if(_0x261366['statusCode']!==0xc8){_0x4694c3(new Error(_0xbd93('0x13')+_0xfdc2f2+'\x20failed,\x20status\x20code\x20=\x20'+_0x261366[_0xbd93('0x11')]+'\x20('+_0x261366['statusMessage']+')'));return;}var _0x4a26d1='';_0x261366['on'](_0xbd93('0x20'),function(_0xd6acec){_0x4a26d1+=_0xd6acec;});_0x261366['on'](_0xbd93('0x1c'),function(){_0x1a1ae6(_0x4a26d1);});})['on'](_0xbd93('0x12'),function(_0x268c94){_0x4694c3(_0x268c94);})['end']();});}function convertFile(_0x4c2987,_0x325934){return new BPromise(function(_0x1e7bc8,_0x197915){var _0x493de9=sox[_0xbd93('0x21')](_0x4c2987,_0x325934,{'sampleRate':0x1f40,'format':_0xbd93('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x493de9['on'](_0xbd93('0x12'),function(_0x4a1538){logger[_0xbd93('0x12')](_0xbd93('0x23'),_0x4a1538);_0x197915(_0x4a1538);});_0x493de9['on']('end',function(){logger['info'](_0xbd93('0x24'));_0x1e7bc8();});_0x493de9['start']();});}function base64Decode(_0x1d3383,_0xdaef3d){var _0x57ce7b=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs[_0xbd93('0x27')](0x4)+_0xbd93('0x28'));fs[_0xbd93('0x29')](_0x57ce7b,_0x1d3383,_0xbd93('0x2a'));return convertFile(_0x57ce7b,_0xdaef3d)[_0xbd93('0x2b')](function(){try{fs[_0xbd93('0x19')](_0x57ce7b);fs[_0xbd93('0x2c')](_0xdaef3d,_0xbd93('0x2d'));}catch(_0x36e7a1){logger['error'](_0x36e7a1);}return _0xdaef3d[_0xbd93('0x2e')]('.')[0x0];});}function base64Encode(_0x3ed18b){var _0xa23f16=fs['readFileSync'](_0x3ed18b);return new Buffer(_0xa23f16)['toString'](_0xbd93('0x2a'));}exports[_0xbd93('0x2f')]=function(_0x324c05,_0x215bfc,_0x34d362,_0x1fb83d,_0x357468,_0x134d7d){var _0x457396,_0x5c054d;var _0x38590f=_0xbd93('0x30');var _0x3df3ab=_0xbd93('0x31')+_0x324c05;var _0x92862a={};if(_0x215bfc===_0xbd93('0x32')){_0x92862a[_0xbd93('0x33')]={'ssml':_0x34d362};}else{_0x92862a['input']={'text':_0x34d362};};_0x92862a[_0xbd93('0x34')]={'languageCode':_0x1fb83d,'ssmlGender':_0x357468};_0x92862a['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xf1065f={'url':_0x38590f+_0xbd93('0x35')+_0x3df3ab,'method':_0xbd93('0x36'),'json':!![],'body':_0x92862a};return rp(_0xf1065f)[_0xbd93('0x2b')](function(_0x2fd518){return new BPromise(function(_0x5b942e,_0xe11e62){_0x457396=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs[_0xbd93('0x27')](0x4)+'.mp3');var _0x476bae=Buffer[_0xbd93('0x37')](_0x2fd518[_0xbd93('0x38')],_0xbd93('0x2a'));return fs[_0xbd93('0x39')](_0x457396,_0x476bae,function(_0x8c4475){_0xe11e62(_0x8c4475);},function(_0x611ffc){fs[_0xbd93('0x2c')](_0x457396,_0xbd93('0x2d'));_0x5b942e(_0x611ffc);});});})['then'](function(_0x5e7342){_0x5c054d=path[_0xbd93('0x25')](__dirname,'tmp',rs[_0xbd93('0x27')](0x4)+'.wav');return convertFile(_0x457396,_0x5c054d);})[_0xbd93('0x2b')](function(){try{fs[_0xbd93('0x19')](_0x457396);fs[_0xbd93('0x2c')](_0x5c054d,_0xbd93('0x2d'));}catch(_0x371300){logger[_0xbd93('0x12')](_0x371300);}logger['info'](_0xbd93('0x3a'),_0x5c054d[_0xbd93('0x2e')]('.')[0x0]);return _0x5c054d[_0xbd93('0x2e')]('.')[0x0];});};exports[_0xbd93('0x3b')]=function(_0x269b29,_0x52d030){var _0x587d27,_0x2b63bf;return tts(_0x269b29,_0x52d030||'en',0x1)[_0xbd93('0x2b')](function(_0x85f911){logger[_0xbd93('0x3c')](_0x85f911);_0x587d27=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs[_0xbd93('0x27')](0x4)+_0xbd93('0x3d'));return downloadFile(_0x85f911,_0x587d27);})[_0xbd93('0x2b')](function(){_0x2b63bf=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs[_0xbd93('0x27')](0x4)+_0xbd93('0x28'));return convertFile(_0x587d27,_0x2b63bf);})['then'](function(){try{fs[_0xbd93('0x19')](_0x587d27);fs[_0xbd93('0x2c')](_0x2b63bf,_0xbd93('0x2d'));}catch(_0x5d0764){logger[_0xbd93('0x12')](_0x5d0764);}logger[_0xbd93('0x3c')](_0xbd93('0x3e'),_0x2b63bf['split']('.')[0x0]);return _0x2b63bf[_0xbd93('0x2e')]('.')[0x0];});};exports[_0xbd93('0x3f')]=function(_0x5b9154,_0x40150,_0x5ef3a2){return google['asr'](_0x5b9154,_0x40150,_0x5ef3a2)['then'](function(_0x3ab124){logger['info'](_0x3ab124['uri']);return rp(_0x3ab124);})[_0xbd93('0x2b')](function(_0x43d237){var _0x377942='';var _0x5a0c8c=0x0;try{fs['unlink'](_0x5b9154);}catch(_0x19fd9c){logger['error'](_0x19fd9c);}if(_0x43d237&&_0x43d237['results']){_0x377942=_0x43d237['results']['map'](function(_0x3826a8){return _0x3826a8&&_0x3826a8[_0xbd93('0x40')][0x0]&&_0x3826a8[_0xbd93('0x40')][0x0]['transcript']?_0x3826a8[_0xbd93('0x40')][0x0][_0xbd93('0x41')]:'';})[_0xbd93('0x42')]('\x0a');_0x5a0c8c=_0x43d237[_0xbd93('0x43')]['map'](function(_0xb36e27){return _0xb36e27&&_0xb36e27[_0xbd93('0x40')][0x0]&&_0xb36e27['alternatives'][0x0][_0xbd93('0x44')]?_0xb36e27['alternatives'][0x0][_0xbd93('0x44')]:0x0;})[_0xbd93('0x42')]('\x0a');}logger[_0xbd93('0x3c')](_0xbd93('0x45'),_0x377942);logger['info']('googleASR\x20confidence',_0x5a0c8c);return{'transcript':_0x377942,'confidence':_0x5a0c8c};})[_0xbd93('0x46')](function(_0x5f05ca){logger[_0xbd93('0x12')]('[%s]\x20%s:%s',_0x5f05ca['statusCode'],_0x5f05ca[_0xbd93('0x47')],_0x5f05ca[_0xbd93('0x48')]);});};exports[_0xbd93('0x49')]=function(_0x5203ed,_0x26e817,_0xbffc50,_0x474ba2){var _0x4a66cf=apiai(_0x26e817,{'language':_0x474ba2||'en'});return _0x4a66cf['textRequest'](_0xbffc50,{'sessionId':md5(_0x5203ed)})[_0xbd93('0x2b')](function(_0x286898){logger[_0xbd93('0x3c')](JSON[_0xbd93('0x4a')](_0x286898));return{'source':_0x286898[_0xbd93('0x4b')][_0xbd93('0x4c')],'resolvedQuery':_0x286898[_0xbd93('0x4b')][_0xbd93('0x4d')],'action':_0x286898[_0xbd93('0x4b')][_0xbd93('0x4e')],'actionIncomplete':_0x286898[_0xbd93('0x4b')]['actionIncomplete'],'speech':_0x286898['result']['fulfillment']['speech'],'score':_0x286898[_0xbd93('0x4b')][_0xbd93('0x4f')],'statusCode':_0x286898[_0xbd93('0x50')][_0xbd93('0x51')],'endConversation':_0x286898['result']['metadata'][_0xbd93('0x52')]||![],'isFallbackIntent':_0x286898[_0xbd93('0x4b')][_0xbd93('0x53')][_0xbd93('0x54')]};});};exports['tildeASR']=function(_0x4b87a1,_0x3af6d4,_0x1eaa57,_0x264bd0){return tilde[_0xbd93('0x55')](_0x4b87a1,_0x3af6d4,_0x1eaa57,_0x264bd0)[_0xbd93('0x2b')](function(_0x2816e3){try{fs[_0xbd93('0x19')](_0x4b87a1);}catch(_0x420dd6){logger[_0xbd93('0x12')](_0x420dd6);}logger[_0xbd93('0x3c')](_0xbd93('0x56'),_0x2816e3[_0xbd93('0x41')]);logger[_0xbd93('0x3c')]('Tilde\x20ASR\x20confidence',_0x2816e3[_0xbd93('0x44')]);return _0x2816e3;});};exports[_0xbd93('0x57')]=function(_0x3d7187,_0x2c40f8,_0x106dea,_0x2b6d9f,_0x320c62,_0x2674dc){var _0x28ace6=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs[_0xbd93('0x27')](0x4)+_0xbd93('0x3d'));var _0xfd7904;return aws[_0xbd93('0x58')](_0x3d7187,_0x2c40f8,_0x106dea,_0x2b6d9f,_0x320c62,_0x2674dc,_0x28ace6)[_0xbd93('0x2b')](function(){_0xfd7904=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x28ace6,_0xfd7904);})[_0xbd93('0x2b')](function(){try{fs[_0xbd93('0x19')](_0x28ace6);fs[_0xbd93('0x2c')](_0xfd7904,_0xbd93('0x2d'));}catch(_0x674fb5){logger['error'](_0x674fb5);}return _0xfd7904[_0xbd93('0x2e')]('.')[0x0];});};exports[_0xbd93('0x59')]=function(_0x31d73b,_0x5489f3,_0x4b6c16,_0x186d75,_0x12607e,_0x435e4f){return aws[_0xbd93('0x5a')](_0x31d73b,_0x5489f3,_0x4b6c16,_0x186d75,_0x12607e,_0x435e4f)[_0xbd93('0x2b')](function(_0x1bac62){logger[_0xbd93('0x3c')](JSON['stringify'](_0x1bac62));return _0x1bac62;});};exports[_0xbd93('0x5b')]=function(_0x5156ba,_0x4bda92,_0x2a3b61,_0x4e728b){var _0x4978e0=util[_0xbd93('0x5c')](_0xbd93('0x5d'),ISPEECH_API,_0x5156ba,encodeURIComponent(_0x4bda92),_0x2a3b61,_0x4e728b);var _0x503e00=path[_0xbd93('0x25')](__dirname,_0xbd93('0x26'),rs['generate'](0x4)+_0xbd93('0x3d'));var _0x3639a1;return downloadFile(_0x4978e0,_0x503e00)[_0xbd93('0x2b')](function(){_0x3639a1=path[_0xbd93('0x25')](__dirname,'tmp',rs[_0xbd93('0x27')](0x4)+_0xbd93('0x28'));return convertFile(_0x503e00,_0x3639a1);})['then'](function(){try{fs[_0xbd93('0x19')](_0x503e00);fs[_0xbd93('0x2c')](_0x3639a1,_0xbd93('0x2d'));}catch(_0x40eec6){logger[_0xbd93('0x12')](_0x40eec6);}return _0x3639a1[_0xbd93('0x2e')]('.')[0x0];});};exports[_0xbd93('0x5e')]=function(_0x1a4b0d,_0x466cfe,_0x7c9bff,_0x261538){var _0x6fe9d3=util['format'](_0xbd93('0x5f'),ISPEECH_API,_0x466cfe,_0x7c9bff,base64Encode(_0x1a4b0d),_0x261538?util[_0xbd93('0x5c')](_0xbd93('0x60'),encodeURIComponent(_0x261538)):_0xbd93('0x61'));return uploadFile(_0x6fe9d3)[_0xbd93('0x2b')](function(_0x2dd3d0){return querystring['parse'](_0x2dd3d0);});};exports[_0xbd93('0x62')]=function(_0x1a63da,_0x1b86c5){return sestek['nda'](_0x1a63da,_0x1b86c5)[_0xbd93('0x2b')](function(_0x5727fa){logger[_0xbd93('0x3c')](JSON[_0xbd93('0x4a')](_0x5727fa));var _0x511091={'speech':_0x5727fa[_0xbd93('0x63')],'action':_0x5727fa[_0xbd93('0x64')]?_0x5727fa[_0xbd93('0x64')][_0xbd93('0x65')]:undefined,'actiondata':_0x5727fa['channelData']?_0x5727fa[_0xbd93('0x64')]['CustomActionData']:undefined};if(_0x5727fa[_0xbd93('0x64')]&&_0x5727fa['channelData']['AudioFromTts']){return base64Decode(_0x5727fa[_0xbd93('0x64')]['AudioFromTts'][_0xbd93('0x66')],path[_0xbd93('0x25')](__dirname,'tmp',rs[_0xbd93('0x27')](0x4)+_0xbd93('0x28')))[_0xbd93('0x2b')](function(_0x31fe6d){_0x511091['audiofile']=_0x31fe6d;return _0x511091;});}return _0x511091;});};exports[_0xbd93('0x67')]=function(){return __dirname;}; \ No newline at end of file +var _0x8014=['textRequest','result','source','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','stringify','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','http','https','url','parse','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','finish','info','close','error','download\x20error','pipe','end','path','\x20failed,\x20status\x20code\x20=\x20','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','unlink','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','audioContent','chmodSync','googleCloudTTS\x20path','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','name','googleDialogflow'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8014,0x88));var _0x4801=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x8014[_0x3b5ad9];return _0x611ae9;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x4801('0x0'));var https=require(_0x4801('0x1'));var urlParse=require(_0x4801('0x2'))[_0x4801('0x3')];var BPromise=require('bluebird');var rs=require(_0x4801('0x4'));var sox=require(_0x4801('0x5'));var rp=require(_0x4801('0x6'));var util=require(_0x4801('0x7'));var querystring=require(_0x4801('0x8'));var tts=require(_0x4801('0x9'));var apiai=require(_0x4801('0xa'));var md5=require(_0x4801('0xb'));var google=require('./google');var aws=require(_0x4801('0xc'));var tilde=require(_0x4801('0xd'));var sestek=require(_0x4801('0xe'));var logger=require(_0x4801('0xf'))('agi');var ISPEECH_API=_0x4801('0x10');function downloadFile(_0x2c0aae,_0x57d30c){return new BPromise(function(_0x1a9524,_0x18fc63){var _0x1c2fbb=urlParse(_0x2c0aae);var _0x6d755f=_0x1c2fbb[_0x4801('0x11')]===_0x4801('0x12')?https:http;var _0x331cc3={'host':_0x1c2fbb[_0x4801('0x13')],'path':_0x1c2fbb['path'],'headers':{'user-agent':_0x4801('0x14')}};_0x6d755f[_0x4801('0x15')](_0x331cc3,function(_0x8dbadf){if(_0x8dbadf[_0x4801('0x16')]!==0xc8){logger['error'](_0x4801('0x17')+_0x2c0aae+'\x20failed,\x20status\x20code\x20=\x20'+_0x8dbadf[_0x4801('0x16')]+'\x20('+_0x8dbadf[_0x4801('0x18')]+')');_0x18fc63(new Error(_0x4801('0x17')+_0x2c0aae+'\x20failed,\x20status\x20code\x20=\x20'+_0x8dbadf[_0x4801('0x16')]+'\x20('+_0x8dbadf[_0x4801('0x18')]+')'));return;}var _0x594167=fs['createWriteStream'](_0x57d30c);_0x594167['on'](_0x4801('0x19'),function(){logger[_0x4801('0x1a')]('finish\x20download\x20file');_0x594167[_0x4801('0x1b')](_0x1a9524);});_0x594167['on']('error',function(_0x2da81e){fs['unlink'](_0x57d30c);logger[_0x4801('0x1c')](_0x4801('0x1d'),_0x2da81e);_0x18fc63(_0x2da81e);});_0x8dbadf[_0x4801('0x1e')](_0x594167);})['on'](_0x4801('0x1c'),function(_0x17a997){logger[_0x4801('0x1c')](_0x17a997);_0x18fc63(_0x17a997);})[_0x4801('0x1f')]();});}function uploadFile(_0x4f5c6d){return new BPromise(function(_0x49c313,_0x168992){var _0x110e63=urlParse(_0x4f5c6d);var _0x40bc01=_0x110e63[_0x4801('0x11')]===_0x4801('0x12')?https:http;var _0x567937={'host':_0x110e63['host'],'path':_0x110e63[_0x4801('0x20')],'headers':{'user-agent':_0x4801('0x14')}};_0x40bc01[_0x4801('0x15')](_0x567937,function(_0x313dfc){if(_0x313dfc[_0x4801('0x16')]!==0xc8){_0x168992(new Error(_0x4801('0x17')+_0x4f5c6d+_0x4801('0x21')+_0x313dfc[_0x4801('0x16')]+'\x20('+_0x313dfc[_0x4801('0x18')]+')'));return;}var _0x35f578='';_0x313dfc['on']('data',function(_0xa7ea34){_0x35f578+=_0xa7ea34;});_0x313dfc['on'](_0x4801('0x1f'),function(){_0x49c313(_0x35f578);});})['on'](_0x4801('0x1c'),function(_0x148295){_0x168992(_0x148295);})[_0x4801('0x1f')]();});}function convertFile(_0x38da45,_0x3c2ce1){return new BPromise(function(_0x8e1c30,_0x35b837){var _0x33520e=sox['transcode'](_0x38da45,_0x3c2ce1,{'sampleRate':0x1f40,'format':_0x4801('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33520e['on']('error',function(_0x4d9744){logger[_0x4801('0x1c')](_0x4801('0x23'),_0x4d9744);_0x35b837(_0x4d9744);});_0x33520e['on'](_0x4801('0x1f'),function(){logger['info'](_0x4801('0x24'));_0x8e1c30();});_0x33520e[_0x4801('0x25')]();});}function base64Decode(_0x3be47f,_0x772acc){var _0x179cb7=path[_0x4801('0x26')](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+_0x4801('0x29'));fs[_0x4801('0x2a')](_0x179cb7,_0x3be47f,'base64');return convertFile(_0x179cb7,_0x772acc)[_0x4801('0x2b')](function(){try{fs[_0x4801('0x2c')](_0x179cb7);fs['chmodSync'](_0x772acc,_0x4801('0x2d'));}catch(_0x5794a7){logger[_0x4801('0x1c')](_0x5794a7);}return _0x772acc[_0x4801('0x2e')]('.')[0x0];});}function base64Encode(_0x29590d){var _0x391854=fs['readFileSync'](_0x29590d);return new Buffer(_0x391854)[_0x4801('0x2f')](_0x4801('0x30'));}exports[_0x4801('0x31')]=function(_0x3878c3,_0x2b4741,_0x47fe56,_0x7c2d58,_0x485c40,_0x16b578){var _0x74c710,_0x586a79;var _0x502429=_0x4801('0x32');var _0x5fd24b=_0x4801('0x33')+_0x3878c3;var _0xb16995={};if(_0x2b4741===_0x4801('0x34')){_0xb16995[_0x4801('0x35')]={'ssml':_0x47fe56};}else{_0xb16995[_0x4801('0x35')]={'text':_0x47fe56};};_0xb16995['voice']={'languageCode':_0x7c2d58,'ssmlGender':_0x485c40};_0xb16995[_0x4801('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x516cc2={'url':_0x502429+_0x4801('0x37')+_0x5fd24b,'method':_0x4801('0x38'),'json':!![],'body':_0xb16995};return rp(_0x516cc2)[_0x4801('0x2b')](function(_0x479734){return new BPromise(function(_0x2c7c1a,_0x64daa){_0x74c710=path[_0x4801('0x26')](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+'.mp3');var _0x2ee3d2=Buffer['from'](_0x479734[_0x4801('0x39')],_0x4801('0x30'));return fs['writeFile'](_0x74c710,_0x2ee3d2,function(_0x14db75){_0x64daa(_0x14db75);},function(_0xb1dba5){fs[_0x4801('0x3a')](_0x74c710,_0x4801('0x2d'));_0x2c7c1a(_0xb1dba5);});});})[_0x4801('0x2b')](function(_0xb019d0){_0x586a79=path['resolve'](__dirname,_0x4801('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x74c710,_0x586a79);})[_0x4801('0x2b')](function(){try{fs[_0x4801('0x2c')](_0x74c710);fs[_0x4801('0x3a')](_0x586a79,_0x4801('0x2d'));}catch(_0x7e8753){logger['error'](_0x7e8753);}logger[_0x4801('0x1a')](_0x4801('0x3b'),_0x586a79['split']('.')[0x0]);return _0x586a79['split']('.')[0x0];});};exports['googleTTS']=function(_0x1c5151,_0xac8180){var _0x383586,_0x3f7b9b;return tts(_0x1c5151,_0xac8180||'en',0x1)[_0x4801('0x2b')](function(_0x4c5cb6){logger['info'](_0x4c5cb6);_0x383586=path['resolve'](__dirname,_0x4801('0x27'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x4c5cb6,_0x383586);})['then'](function(){_0x3f7b9b=path[_0x4801('0x26')](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+_0x4801('0x29'));return convertFile(_0x383586,_0x3f7b9b);})[_0x4801('0x2b')](function(){try{fs['unlink'](_0x383586);fs[_0x4801('0x3a')](_0x3f7b9b,'777');}catch(_0x3e7d23){logger[_0x4801('0x1c')](_0x3e7d23);}logger[_0x4801('0x1a')](_0x4801('0x3c'),_0x3f7b9b[_0x4801('0x2e')]('.')[0x0]);return _0x3f7b9b[_0x4801('0x2e')]('.')[0x0];});};exports[_0x4801('0x3d')]=function(_0x5a29d4,_0x10597e,_0x311372){return google['asr'](_0x5a29d4,_0x10597e,_0x311372)[_0x4801('0x2b')](function(_0x42dffd){logger[_0x4801('0x1a')](_0x42dffd[_0x4801('0x3e')]);return rp(_0x42dffd);})[_0x4801('0x2b')](function(_0xa46f7){var _0x4f72ad='';var _0x22ec67=0x0;try{fs[_0x4801('0x2c')](_0x5a29d4);}catch(_0x54ddad){logger[_0x4801('0x1c')](_0x54ddad);}if(_0xa46f7&&_0xa46f7['results']){_0x4f72ad=_0xa46f7[_0x4801('0x3f')][_0x4801('0x40')](function(_0x8a649){return _0x8a649&&_0x8a649['alternatives'][0x0]&&_0x8a649[_0x4801('0x41')][0x0][_0x4801('0x42')]?_0x8a649[_0x4801('0x41')][0x0][_0x4801('0x42')]:'';})[_0x4801('0x43')]('\x0a');_0x22ec67=_0xa46f7[_0x4801('0x3f')][_0x4801('0x40')](function(_0x908548){return _0x908548&&_0x908548[_0x4801('0x41')][0x0]&&_0x908548[_0x4801('0x41')][0x0][_0x4801('0x44')]?_0x908548[_0x4801('0x41')][0x0][_0x4801('0x44')]:0x0;})[_0x4801('0x43')]('\x0a');}logger[_0x4801('0x1a')](_0x4801('0x45'),_0x4f72ad);logger['info']('googleASR\x20confidence',_0x22ec67);return{'transcript':_0x4f72ad,'confidence':_0x22ec67};})['catch'](function(_0x2b5587){logger[_0x4801('0x1c')]('[%s]\x20%s:%s',_0x2b5587[_0x4801('0x16')],_0x2b5587[_0x4801('0x46')],_0x2b5587['message']);});};exports[_0x4801('0x47')]=function(_0x23dfc2,_0x4f1dd7,_0x242388,_0x246fd1){var _0x323ec5=apiai(_0x4f1dd7,{'language':_0x246fd1||'en'});return _0x323ec5[_0x4801('0x48')](_0x242388,{'sessionId':md5(_0x23dfc2)})['then'](function(_0x3d5baa){logger['info'](JSON['stringify'](_0x3d5baa));return{'source':_0x3d5baa[_0x4801('0x49')][_0x4801('0x4a')],'resolvedQuery':_0x3d5baa['result']['resolvedQuery'],'action':_0x3d5baa[_0x4801('0x49')]['action'],'actionIncomplete':_0x3d5baa[_0x4801('0x49')][_0x4801('0x4b')],'speech':_0x3d5baa[_0x4801('0x49')][_0x4801('0x4c')][_0x4801('0x4d')],'score':_0x3d5baa[_0x4801('0x49')]['score'],'statusCode':_0x3d5baa[_0x4801('0x4e')][_0x4801('0x4f')],'endConversation':_0x3d5baa[_0x4801('0x49')][_0x4801('0x50')][_0x4801('0x51')]||![],'isFallbackIntent':_0x3d5baa['result']['metadata'][_0x4801('0x52')]};});};exports[_0x4801('0x53')]=function(_0xe42e7f,_0x28a86e,_0x2e93db,_0x22ea1f){return tilde[_0x4801('0x54')](_0xe42e7f,_0x28a86e,_0x2e93db,_0x22ea1f)[_0x4801('0x2b')](function(_0x1bf819){try{fs[_0x4801('0x2c')](_0xe42e7f);}catch(_0xa5a510){logger[_0x4801('0x1c')](_0xa5a510);}logger[_0x4801('0x1a')](_0x4801('0x55'),_0x1bf819[_0x4801('0x42')]);logger[_0x4801('0x1a')](_0x4801('0x56'),_0x1bf819[_0x4801('0x44')]);return _0x1bf819;});};exports[_0x4801('0x57')]=function(_0x8b9857,_0x5d9477,_0x3ac765,_0x5acbf8,_0x4b3b55,_0x311ddb){var _0x6a9e31=path[_0x4801('0x26')](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+'.mp3');var _0x3e2892;return aws['polly'](_0x8b9857,_0x5d9477,_0x3ac765,_0x5acbf8,_0x4b3b55,_0x311ddb,_0x6a9e31)[_0x4801('0x2b')](function(){_0x3e2892=path['resolve'](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+_0x4801('0x29'));return convertFile(_0x6a9e31,_0x3e2892);})[_0x4801('0x2b')](function(){try{fs[_0x4801('0x2c')](_0x6a9e31);fs[_0x4801('0x3a')](_0x3e2892,_0x4801('0x2d'));}catch(_0xd4943d){logger[_0x4801('0x1c')](_0xd4943d);}return _0x3e2892[_0x4801('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x72ac,_0x5661fb,_0x51e185,_0x43842e,_0x51cd96,_0x59d29f){return aws[_0x4801('0x58')](_0x72ac,_0x5661fb,_0x51e185,_0x43842e,_0x51cd96,_0x59d29f)[_0x4801('0x2b')](function(_0x4a25d6){logger['info'](JSON[_0x4801('0x59')](_0x4a25d6));return _0x4a25d6;});};exports[_0x4801('0x5a')]=function(_0x167aed,_0x20e930,_0x1bfb9d,_0x36f0b9){var _0x1c73e5=util['format'](_0x4801('0x5b'),ISPEECH_API,_0x167aed,encodeURIComponent(_0x20e930),_0x1bfb9d,_0x36f0b9);var _0x502cf8=path['resolve'](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+'.mp3');var _0x3d865c;return downloadFile(_0x1c73e5,_0x502cf8)[_0x4801('0x2b')](function(){_0x3d865c=path[_0x4801('0x26')](__dirname,_0x4801('0x27'),rs['generate'](0x4)+_0x4801('0x29'));return convertFile(_0x502cf8,_0x3d865c);})[_0x4801('0x2b')](function(){try{fs[_0x4801('0x2c')](_0x502cf8);fs[_0x4801('0x3a')](_0x3d865c,_0x4801('0x2d'));}catch(_0x25f9cb){logger[_0x4801('0x1c')](_0x25f9cb);}return _0x3d865c[_0x4801('0x2e')]('.')[0x0];});};exports['ispeechASR']=function(_0x564745,_0x5d75f4,_0x3b80fd,_0x4b3492){var _0x93d717=util[_0x4801('0x5c')](_0x4801('0x5d'),ISPEECH_API,_0x5d75f4,_0x3b80fd,base64Encode(_0x564745),_0x4b3492?util[_0x4801('0x5c')](_0x4801('0x5e'),encodeURIComponent(_0x4b3492)):_0x4801('0x5f'));return uploadFile(_0x93d717)[_0x4801('0x2b')](function(_0x3a080f){return querystring['parse'](_0x3a080f);});};exports['sestekNDA']=function(_0x8157f1,_0x4b676b){return sestek[_0x4801('0x60')](_0x8157f1,_0x4b676b)[_0x4801('0x2b')](function(_0x266a8e){logger[_0x4801('0x1a')](JSON[_0x4801('0x59')](_0x266a8e));var _0x478b8f={'speech':_0x266a8e['text'],'action':_0x266a8e['channelData']?_0x266a8e['channelData'][_0x4801('0x61')]:undefined,'actiondata':_0x266a8e[_0x4801('0x62')]?_0x266a8e['channelData'][_0x4801('0x63')]:undefined};if(_0x266a8e[_0x4801('0x62')]&&_0x266a8e[_0x4801('0x62')]['AudioFromTts']){return base64Decode(_0x266a8e[_0x4801('0x62')][_0x4801('0x64')][_0x4801('0x65')],path['resolve'](__dirname,_0x4801('0x27'),rs[_0x4801('0x28')](0x4)+_0x4801('0x29')))['then'](function(_0x36f1b8){_0x478b8f[_0x4801('0x66')]=_0x36f1b8;return _0x478b8f;});}return _0x478b8f;});};exports[_0x4801('0x67')]=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 54a6307..00d0033 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 _0xc4f5=['./nda'];(function(_0x475175,_0x8e0739){var _0x24286c=function(_0xbb863){while(--_0xbb863){_0x475175['push'](_0x475175['shift']());}};_0x24286c(++_0x8e0739);}(_0xc4f5,0x18a));var _0x5c4f=function(_0x1fd6b0,_0x5a40a0){_0x1fd6b0=_0x1fd6b0-0x0;var _0x202a08=_0xc4f5[_0x1fd6b0];return _0x202a08;};var nda=require(_0x5c4f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x6369=['./nda'];(function(_0x5be4af,_0x1180d1){var _0x35036f=function(_0x49364c){while(--_0x49364c){_0x5be4af['push'](_0x5be4af['shift']());}};_0x35036f(++_0x1180d1);}(_0x6369,0xf7));var _0x9636=function(_0x5b45f3,_0x492be0){_0x5b45f3=_0x5b45f3-0x0;var _0x55cf31=_0x6369[_0x5b45f3];return _0x55cf31;};var nda=require(_0x9636('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 a6e68a5..5fb1eb6 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 _0xfcc7=['ProjectName','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','/token','username','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','channelData'];(function(_0x40fab7,_0x241202){var _0x1c7887=function(_0x33432b){while(--_0x33432b){_0x40fab7['push'](_0x40fab7['shift']());}};_0x1c7887(++_0x241202);}(_0xfcc7,0x13d));var _0x7fcc=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0xfcc7[_0x2118ad];return _0x4b5715;};'use strict';var rp=require(_0x7fcc('0x0'));var url=require(_0x7fcc('0x1'));var logger=require('../../../../../config/logger')(_0x7fcc('0x2'));module[_0x7fcc('0x3')]=function(_0x57a195,_0x301555){var _0x5a6c97={'method':_0x7fcc('0x4'),'uri':url[_0x7fcc('0x5')](_0x301555[_0x7fcc('0x6')],_0x7fcc('0x7')),'form':{'grant_type':'password','username':_0x301555[_0x7fcc('0x8')],'password':_0x301555[_0x7fcc('0x9')]},'json':!![]};return rp(_0x5a6c97)[_0x7fcc('0xa')](function(_0x44e37c){var _0x22d031={'method':_0x7fcc('0x4'),'uri':url[_0x7fcc('0x5')](_0x301555['ndassistant_url'],_0x7fcc('0xb')),'body':{'type':_0x301555[_0x7fcc('0xc')]||'message','channelId':_0x7fcc('0xd'),'conversation':{'id':_0x57a195[_0x7fcc('0xe')]},'from':{'id':_0x57a195[_0x7fcc('0xf')],'name':_0x57a195[_0x7fcc('0x10')]},'recipient':{'id':_0x57a195[_0x7fcc('0x11')],'name':_0x57a195[_0x7fcc('0x12')]},'text':_0x301555[_0x7fcc('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x44e37c[_0x7fcc('0x14')]},'json':!![]};if(_0x301555[_0x7fcc('0x15')]){_0x22d031[_0x7fcc('0x16')][_0x7fcc('0x17')][_0x7fcc('0x18')]=_0x301555[_0x7fcc('0x15')];}if(_0x301555['ndagenerate_audio']=='1'){_0x22d031[_0x7fcc('0x16')]['channelData'][_0x7fcc('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x301555[_0x7fcc('0x1a')]){_0x22d031[_0x7fcc('0x16')][_0x7fcc('0x17')]['CustomAction']=_0x301555[_0x7fcc('0x1a')];if(_0x301555[_0x7fcc('0x1b')]){_0x22d031[_0x7fcc('0x16')]['channelData'][_0x7fcc('0x1c')]=_0x301555['custom_action_data'];}}logger[_0x7fcc('0x1d')](JSON[_0x7fcc('0x1e')](_0x22d031));return rp(_0x22d031);});}; \ No newline at end of file +var _0xc37e=['ndaactivity_type','message','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','channelData','info','stringify','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url'];(function(_0x497fce,_0x5c436e){var _0xa353f8=function(_0x5b6da1){while(--_0x5b6da1){_0x497fce['push'](_0x497fce['shift']());}};_0xa353f8(++_0x5c436e);}(_0xc37e,0xcf));var _0xec37=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc37e[_0x19950b];return _0x3c6b41;};'use strict';var rp=require('request-promise');var url=require(_0xec37('0x0'));var logger=require(_0xec37('0x1'))('agi');module[_0xec37('0x2')]=function(_0x4ea211,_0x197bed){var _0x73f005={'method':_0xec37('0x3'),'uri':url[_0xec37('0x4')](_0x197bed[_0xec37('0x5')],_0xec37('0x6')),'form':{'grant_type':_0xec37('0x7'),'username':_0x197bed[_0xec37('0x8')],'password':_0x197bed['password']},'json':!![]};return rp(_0x73f005)['then'](function(_0x29fafe){var _0x5de323={'method':_0xec37('0x3'),'uri':url[_0xec37('0x4')](_0x197bed[_0xec37('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x197bed[_0xec37('0xa')]||_0xec37('0xb'),'channelId':'Nda','conversation':{'id':_0x4ea211[_0xec37('0xc')]},'from':{'id':_0x4ea211['callerid'],'name':_0x4ea211[_0xec37('0xd')]},'recipient':{'id':_0x4ea211[_0xec37('0xe')],'name':_0x4ea211[_0xec37('0xf')]},'text':_0x197bed[_0xec37('0x10')],'channelData':{}},'headers':{'Authorization':_0xec37('0x11')+_0x29fafe[_0xec37('0x12')]},'json':!![]};if(_0x197bed[_0xec37('0x13')]){_0x5de323[_0xec37('0x14')]['channelData'][_0xec37('0x15')]=_0x197bed[_0xec37('0x13')];}if(_0x197bed[_0xec37('0x16')]=='1'){_0x5de323[_0xec37('0x14')]['channelData'][_0xec37('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xec37('0x18')};}if(_0x197bed[_0xec37('0x19')]){_0x5de323[_0xec37('0x14')]['channelData'][_0xec37('0x1a')]=_0x197bed['custom_action'];if(_0x197bed[_0xec37('0x1b')]){_0x5de323[_0xec37('0x14')][_0xec37('0x1c')]['CustomActionData']=_0x197bed['custom_action_data'];}}logger[_0xec37('0x1d')](JSON[_0xec37('0x1e')](_0x5de323));return rp(_0x5de323);});}; \ 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 059247e..4b6e98d 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 _0x2612=['./lib/api','exports'];(function(_0x4ba02f,_0x1bf794){var _0x3fdcd4=function(_0x145994){while(--_0x145994){_0x4ba02f['push'](_0x4ba02f['shift']());}};_0x3fdcd4(++_0x1bf794);}(_0x2612,0xd6));var _0x2261=function(_0xf886c0,_0x5bc381){_0xf886c0=_0xf886c0-0x0;var _0x45da8f=_0x2612[_0xf886c0];return _0x45da8f;};'use strict';var asr=require(_0x2261('0x0'));module[_0x2261('0x1')]=function(_0xb71100,_0x40f59e,_0x5afb1f,_0xa70138){return asr(_0xb71100,_0x40f59e,_0x5afb1f,_0xa70138);}; \ No newline at end of file +var _0x2446=['exports','./lib/api'];(function(_0x1e1114,_0x2aa204){var _0x45427a=function(_0x27f08a){while(--_0x27f08a){_0x1e1114['push'](_0x1e1114['shift']());}};_0x45427a(++_0x2aa204);}(_0x2446,0x109));var _0x6244=function(_0x50855c,_0x24fbfc){_0x50855c=_0x50855c-0x0;var _0x4bc9ac=_0x2446[_0x50855c];return _0x4bc9ac;};'use strict';var asr=require(_0x6244('0x0'));module[_0x6244('0x1')]=function(_0x37a3a5,_0x3f53f1,_0x393d15,_0x584950){return asr(_0x37a3a5,_0x3f53f1,_0x393d15,_0x584950);}; \ 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 b359f65..f4bd56d 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 _0xf0de=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','agi','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','info','unix','send','stringify','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xf0de,0x76));var _0xef0d=function(_0xf5f36a,_0x2205d3){_0xf5f36a=_0xf5f36a-0x0;var _0xfba9b2=_0xf0de[_0xf5f36a];return _0xfba9b2;};'use strict';var BPromise=require(_0xef0d('0x0'));var _=require(_0xef0d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xef0d('0x2'));var crypto=require(_0xef0d('0x3'));var logger=require('../../../../../../config/logger')(_0xef0d('0x4'));module['exports']=function(_0x1cd950,_0x56ad1b,_0x31251a,_0x38d277){return new BPromise(function(_0x2a10f0,_0x1ce169){logger['info']('Tilde\x20URI',_0x38d277||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4087ce=new WebSocket(_0x38d277||_0xef0d('0x5'),{'perMessageDeflate':![]});var _0x5a921a='';var _0x3483ae='0';var _0x2e81de='1';var _0x2a2389='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x166028(_0x59ad39){var _0x42aad8=crypto[_0xef0d('0x6')](_0xef0d('0x7'));_0x42aad8[_0xef0d('0x8')](_0x59ad39);return _0x42aad8['digest'](_0xef0d('0x9'));}function _0x124aec(){try{logger[_0xef0d('0xa')]('Open\x20Tilde\x20ASR\x20socket');var _0x227fef=moment()[_0xef0d('0xb')]();var _0x48d515=_0x166028(_0x227fef+_0x56ad1b+_0x31251a);_0x4087ce[_0xef0d('0xc')](JSON[_0xef0d('0xd')]({'appID':_0x56ad1b,'timestamp':_0x227fef,'appKey':_0x48d515}));var _0x10c604=fs['createReadStream'](_0x1cd950);_0x10c604['on']('data',function(_0x15958d){_0x4087ce[_0xef0d('0xc')](_0x15958d);});_0x10c604['on'](_0xef0d('0xe'),function(){_0x4087ce[_0xef0d('0xc')](_0xef0d('0xf'));});}catch(_0x317454){logger[_0xef0d('0x10')]('Tilde\x20ASR\x20send\x20error',JSON[_0xef0d('0xd')](_0x317454));_0x4087ce[_0xef0d('0x11')]();}}function _0x1e602e(_0x4fd27e){try{if(_0x4fd27e){var _0x3cd791=JSON[_0xef0d('0x12')](_0x4fd27e);switch(_0x3cd791[_0xef0d('0x13')]){case 0x0:if(_0x3cd791['result']){if(_0x3cd791[_0xef0d('0x14')][_0xef0d('0x15')]){logger[_0xef0d('0xa')](_0xef0d('0x16'),JSON['stringify'](_0x3cd791[_0xef0d('0x14')][_0xef0d('0x17')]));_0x5a921a=_0x3cd791[_0xef0d('0x14')]['hypotheses'][0x0][_0xef0d('0x18')];_0x3483ae=_0x3cd791[_0xef0d('0x14')][_0xef0d('0x17')][0x0]['likelihood'];_0x2e81de='0';_0x2a2389=_0xef0d('0x19');_0x4087ce[_0xef0d('0x11')]();}}break;case 0x1:logger[_0xef0d('0xa')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2e81de='1';_0x2a2389=_0xef0d('0x1a');break;case 0x2:logger[_0xef0d('0xa')](_0xef0d('0x1b'));_0x2e81de='2';_0x2a2389=_0xef0d('0x1b');break;case 0x9:logger[_0xef0d('0xa')](_0xef0d('0x1c'));_0x2e81de='9';_0x2a2389=_0xef0d('0x1c');break;case 0xa:logger[_0xef0d('0xa')](_0xef0d('0x1d'));_0x2e81de='10';_0x2a2389=_0xef0d('0x1d');break;case 0xb:logger['info'](_0xef0d('0x1e'));_0x2e81de='11';_0x2a2389=_0xef0d('0x1e');}}}catch(_0x3ee210){logger['error'](_0xef0d('0x1f'),JSON['stringify'](_0x3ee210));_0x4087ce['terminate']();}}function _0x43c24a(){logger[_0xef0d('0xa')](_0xef0d('0x20'));_0x2a10f0({'transcript':_0x5a921a,'confidence':_0x3483ae,'status':_0x2e81de,'status_message':_0x2a2389});}function _0x3369f4(_0x1adce4){logger[_0xef0d('0x10')](_0xef0d('0x21'));if(!_[_0xef0d('0x22')](_0x1adce4)){logger[_0xef0d('0x10')](_['isObject'](_0x1adce4)?JSON[_0xef0d('0xd')](_0x1adce4):_0x1adce4);}}_0x4087ce['on'](_0xef0d('0x23'),_0x124aec);_0x4087ce['on'](_0xef0d('0x24'),_0x1e602e);_0x4087ce['on'](_0xef0d('0xe'),_0x43c24a);_0x4087ce['on'](_0xef0d('0x10'),_0x3369f4);});}; \ No newline at end of file +var _0x84e3=['stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix'];(function(_0x119722,_0x3ae79c){var _0x4b0e0e=function(_0xcf7283){while(--_0xcf7283){_0x119722['push'](_0x119722['shift']());}};_0x4b0e0e(++_0x3ae79c);}(_0x84e3,0x1c0));var _0x384e=function(_0x5f1fe5,_0x48e260){_0x5f1fe5=_0x5f1fe5-0x0;var _0x4169be=_0x84e3[_0x5f1fe5];return _0x4169be;};'use strict';var BPromise=require(_0x384e('0x0'));var _=require(_0x384e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x384e('0x2'));var crypto=require(_0x384e('0x3'));var logger=require(_0x384e('0x4'))(_0x384e('0x5'));module['exports']=function(_0x2029cd,_0x5cf296,_0x568888,_0x41d7a1){return new BPromise(function(_0x141500,_0x419958){logger[_0x384e('0x6')](_0x384e('0x7'),_0x41d7a1||_0x384e('0x8'));var _0x521ca8=new WebSocket(_0x41d7a1||_0x384e('0x8'),{'perMessageDeflate':![]});var _0x34138d='';var _0x418859='0';var _0x48dc2b='1';var _0x58dd2f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5081ba(_0x1bf2f0){var _0x4562d4=crypto[_0x384e('0x9')](_0x384e('0xa'));_0x4562d4['update'](_0x1bf2f0);return _0x4562d4[_0x384e('0xb')]('hex');}function _0x82cf26(){try{logger[_0x384e('0x6')](_0x384e('0xc'));var _0x3528cf=moment()[_0x384e('0xd')]();var _0x21ed7c=_0x5081ba(_0x3528cf+_0x5cf296+_0x568888);_0x521ca8['send'](JSON[_0x384e('0xe')]({'appID':_0x5cf296,'timestamp':_0x3528cf,'appKey':_0x21ed7c}));var _0x1dd406=fs[_0x384e('0xf')](_0x2029cd);_0x1dd406['on'](_0x384e('0x10'),function(_0x8814a3){_0x521ca8['send'](_0x8814a3);});_0x1dd406['on']('close',function(){_0x521ca8['send'](_0x384e('0x11'));});}catch(_0x3d3902){logger[_0x384e('0x12')](_0x384e('0x13'),JSON['stringify'](_0x3d3902));_0x521ca8['terminate']();}}function _0x5678fe(_0x5b942c){try{if(_0x5b942c){var _0x3dcebc=JSON[_0x384e('0x14')](_0x5b942c);switch(_0x3dcebc[_0x384e('0x15')]){case 0x0:if(_0x3dcebc[_0x384e('0x16')]){if(_0x3dcebc[_0x384e('0x16')][_0x384e('0x17')]){logger[_0x384e('0x6')](_0x384e('0x18'),JSON[_0x384e('0xe')](_0x3dcebc['result']['hypotheses']));_0x34138d=_0x3dcebc[_0x384e('0x16')][_0x384e('0x19')][0x0][_0x384e('0x1a')];_0x418859=_0x3dcebc['result'][_0x384e('0x19')][0x0][_0x384e('0x1b')];_0x48dc2b='0';_0x58dd2f=_0x384e('0x1c');_0x521ca8[_0x384e('0x1d')]();}}break;case 0x1:logger[_0x384e('0x6')](_0x384e('0x1e'));_0x48dc2b='1';_0x58dd2f=_0x384e('0x1e');break;case 0x2:logger[_0x384e('0x6')](_0x384e('0x1f'));_0x48dc2b='2';_0x58dd2f=_0x384e('0x1f');break;case 0x9:logger[_0x384e('0x6')](_0x384e('0x20'));_0x48dc2b='9';_0x58dd2f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x384e('0x6')](_0x384e('0x21'));_0x48dc2b='10';_0x58dd2f=_0x384e('0x21');break;case 0xb:logger[_0x384e('0x6')](_0x384e('0x22'));_0x48dc2b='11';_0x58dd2f=_0x384e('0x22');}}}catch(_0x1d3868){logger['error'](_0x384e('0x23'),JSON[_0x384e('0xe')](_0x1d3868));_0x521ca8[_0x384e('0x1d')]();}}function _0x19b7f8(){logger['info'](_0x384e('0x24'));_0x141500({'transcript':_0x34138d,'confidence':_0x418859,'status':_0x48dc2b,'status_message':_0x58dd2f});}function _0x1bfc98(_0x4134b0){logger[_0x384e('0x12')](_0x384e('0x25'));if(!_[_0x384e('0x26')](_0x4134b0)){logger[_0x384e('0x12')](_['isObject'](_0x4134b0)?JSON[_0x384e('0xe')](_0x4134b0):_0x4134b0);}}_0x521ca8['on'](_0x384e('0x27'),_0x82cf26);_0x521ca8['on'](_0x384e('0x28'),_0x5678fe);_0x521ca8['on'](_0x384e('0x29'),_0x19b7f8);_0x521ca8['on'](_0x384e('0x12'),_0x1bfc98);});}; \ 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 f338d32..a8696d7 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 _0xab75=['exports','./asr'];(function(_0x4ab9f0,_0x548c3c){var _0x364cbc=function(_0x193c1c){while(--_0x193c1c){_0x4ab9f0['push'](_0x4ab9f0['shift']());}};_0x364cbc(++_0x548c3c);}(_0xab75,0x11f));var _0x5ab7=function(_0x5f5c01,_0x3cac19){_0x5f5c01=_0x5f5c01-0x0;var _0x3119c7=_0xab75[_0x5f5c01];return _0x3119c7;};var asr=require(_0x5ab7('0x0'));module[_0x5ab7('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbdd4=['./asr'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xbdd4[_0x5c351c];return _0x26f3b3;};var asr=require(_0x4bdd('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b1b1b62..e785147 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 _0x710e=['nextTick','inherits','util','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE'];(function(_0x16154c,_0x29b943){var _0x4a2bb8=function(_0x4a5a28){while(--_0x4a5a28){_0x16154c['push'](_0x16154c['shift']());}};_0x4a2bb8(++_0x29b943);}(_0x710e,0xb6));var _0xe710=function(_0x25f71c,_0x107d8b){_0x25f71c=_0x25f71c-0x0;var _0x500838=_0x710e[_0x25f71c];return _0x500838;};'use strict';var util=require(_0xe710('0x0'));var net=require('net');var EventEmitter=require('events')[_0xe710('0x1')];var AGIError=require(_0xe710('0x2'));var AGIChannel=require(_0xe710('0x3'));var AGIServer=function(_0x17e478,_0x2f9eab,_0x4c22aa){var _0x17600b=this,_0x17e478=_0x17e478||0x11dd,_0x2f9eab=_0x2f9eab||_0xe710('0x4'),_0x5a9e4c=null,_0xd8271b=0x0;EventEmitter[_0xe710('0x5')](_0x17600b);function _0x211a33(){if(!_0x17e478){_0x17600b[_0xe710('0x6')](_0xe710('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x5a9e4c=net['createServer']();_0x5a9e4c['listen'](_0x17e478,_0x2f9eab);_0x5a9e4c['on'](_0xe710('0x8'),function(){_0x17600b[_0xe710('0x6')](_0xe710('0x8'));});_0x5a9e4c['on'](_0xe710('0x9'),function(_0x26e786){_0x5a9e4c[_0xe710('0xa')](function(_0x2e4a3c,_0x31a77e){if(_0x2e4a3c){_0x17600b[_0xe710('0x6')](_0xe710('0x7'),new AGIError(_0xe710('0xb'),_0x2e4a3c));}else if(_0x4c22aa&&_0x4c22aa<0x0){_0x17600b[_0xe710('0x6')](_0xe710('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x26e786['destroy']();}else if(_0x4c22aa&&_0x4c22aa>0x0&&_0x4c22aa<_0x31a77e){_0xd8271b+=0x1;_0x17600b[_0xe710('0x6')](_0xe710('0x7'),new AGIError(_0xe710('0xc'),_0xd8271b));_0x26e786[_0xe710('0xd')]();}else{var _0x422a84=new AGIChannel(_0x26e786);_0x422a84['on'](_0xe710('0xe'),function(){_0x17600b['emit'](_0xe710('0x9'),_0x422a84);});}});});_0x5a9e4c['on'](_0xe710('0x7'),function(_0x329590){_0x17600b[_0xe710('0x6')](_0xe710('0x7'),new AGIError(_0xe710('0xb'),_0x329590[_0xe710('0xf')]));});_0x5a9e4c['on'](_0xe710('0x10'),function(){_0x17600b[_0xe710('0x6')](_0xe710('0x10'),new AGIError(_0xe710('0x11')));});}process[_0xe710('0x12')](function(){_0x211a33();});};util[_0xe710('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x4677eb,_0x4a3029,_0x496b3a){return new AGIServer(_0x4677eb,_0x4a3029,_0x496b3a);}; \ No newline at end of file +var _0x1c42=['connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x58601c,_0x13d36e){var _0x99cc71=function(_0x32e9f0){while(--_0x32e9f0){_0x58601c['push'](_0x58601c['shift']());}};_0x99cc71(++_0x13d36e);}(_0x1c42,0x13a));var _0x21c4=function(_0x1230a5,_0x39256a){_0x1230a5=_0x1230a5-0x0;var _0x45f074=_0x1c42[_0x1230a5];return _0x45f074;};'use strict';var util=require('util');var net=require(_0x21c4('0x0'));var EventEmitter=require(_0x21c4('0x1'))[_0x21c4('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21c4('0x3'));var AGIServer=function(_0x40bc3e,_0x1512d2,_0xd7340){var _0x435179=this,_0x40bc3e=_0x40bc3e||0x11dd,_0x1512d2=_0x1512d2||_0x21c4('0x4'),_0x8d4312=null,_0x4fc4da=0x0;EventEmitter[_0x21c4('0x5')](_0x435179);function _0x54b2ea(){if(!_0x40bc3e){_0x435179[_0x21c4('0x6')]('error',new AGIError(_0x21c4('0x7')));return![];}_0x8d4312=net[_0x21c4('0x8')]();_0x8d4312[_0x21c4('0x9')](_0x40bc3e,_0x1512d2);_0x8d4312['on'](_0x21c4('0xa'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xa'));});_0x8d4312['on'](_0x21c4('0xb'),function(_0x3d147a){_0x8d4312[_0x21c4('0xc')](function(_0x50fc66,_0xa58fa5){if(_0x50fc66){_0x435179['emit'](_0x21c4('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x50fc66));}else if(_0xd7340&&_0xd7340<0x0){_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0xe')));_0x3d147a[_0x21c4('0xf')]();}else if(_0xd7340&&_0xd7340>0x0&&_0xd7340<_0xa58fa5){_0x4fc4da+=0x1;_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0x10'),_0x4fc4da));_0x3d147a[_0x21c4('0xf')]();}else{var _0xade6a9=new AGIChannel(_0x3d147a);_0xade6a9['on'](_0x21c4('0x11'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xb'),_0xade6a9);});}});});_0x8d4312['on'](_0x21c4('0xd'),function(_0x5ab3a1){_0x435179['emit'](_0x21c4('0xd'),new AGIError(_0x21c4('0x12'),_0x5ab3a1[_0x21c4('0x13')]));});_0x8d4312['on'](_0x21c4('0x14'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0x14'),new AGIError(_0x21c4('0x15')));});}process[_0x21c4('0x16')](function(){_0x54b2ea();});};util[_0x21c4('0x17')](AGIServer,EventEmitter);module[_0x21c4('0x18')]=function(_0x373e83,_0x122cf3,_0x2b627a){return new AGIServer(_0x373e83,_0x122cf3,_0x2b627a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index de3ca4f..3cab64b 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 _0x307e=['audiofile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','goal','goalname','GOAL\x20%s','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','aws_access_key_id','no\x20valid\x20credentials\x20configured','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','no\x20key\x20configured','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','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','intKey','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','email','user','bcc','service','host','port','secure','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','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','has','dialTimezone','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','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','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','nextbracket','replaceAll','extra','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','sestektts','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','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','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s'];(function(_0x32d655,_0x252a9c){var _0x4110e0=function(_0x58943c){while(--_0x58943c){_0x32d655['push'](_0x32d655['shift']());}};_0x4110e0(++_0x252a9c);}(_0x307e,0xc9));var _0xe307=function(_0x33c88c,_0x4b1843){_0x33c88c=_0x33c88c-0x0;var _0xb64f89=_0x307e[_0x33c88c];return _0xb64f89;};'use strict';var fs=require('fs');var path=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var _=require(_0xe307('0x2'));var sh=require(_0xe307('0x3'));var odbc=require(_0xe307('0x4'))();var rs=require('randomstring');var moment=require(_0xe307('0x5'));var Mustache=require(_0xe307('0x6'));var rp=require('request-promise');var logger=require(_0xe307('0x7'))('agi');var config=require(_0xe307('0x8'));var scripts=require(_0xe307('0x9'));var FILES_PATH=_0xe307('0xa');var recursiveMapAttributes=['rawHeaders',_0xe307('0xb')];var verticesWithRetry=[_0xe307('0xc'),_0xe307('0xd'),_0xe307('0xe')];var AGIVertices=function(_0x304363,_0x2097b1,_0x26d257){this[_0xe307('0xf')]=_0x304363;this[_0xe307('0x10')]=_0x2097b1;this[_0xe307('0x11')]=_0x26d257;};AGIVertices[_0xe307('0x12')][_0xe307('0x13')]=function(_0x2d8f3d,_0x3b67c5){this[_0xe307('0x10')][_0xe307('0x14')](_0x2d8f3d)[_0xe307('0x15')](function(_0x3455f7){_0x3b67c5(null,_0x3455f7?_0x3455f7[_0xe307('0x16')]:![]);})[_0xe307('0x17')](function(_0x51b237){_0x3b67c5(_0x51b237);});};AGIVertices[_0xe307('0x12')][_0xe307('0x18')]=function(_0x4e04a7,_0x3faac5){this[_0xe307('0x10')][_0xe307('0x19')](_0x4e04a7)[_0xe307('0x15')](function(_0x23b5b8){_0x3faac5(null,_0x23b5b8?_0x23b5b8[_0xe307('0x16')]:![]);})[_0xe307('0x17')](function(_0x58f715){_0x3faac5(_0x58f715);});};AGIVertices[_0xe307('0x12')][_0xe307('0x1a')]=function(_0x46f63a,_0x2a48e9){this[_0xe307('0x10')]['getSquareProjectById'](_0x46f63a)['then'](function(_0xbc07f){_0x2a48e9(null,_0xbc07f?_0xbc07f['name']:![]);})[_0xe307('0x17')](function(_0x3b2e66){_0x2a48e9(_0x3b2e66);});};AGIVertices[_0xe307('0x12')][_0xe307('0x1b')]=function(_0x40e290,_0x7778c6){this[_0xe307('0x10')][_0xe307('0x1c')](_0x40e290)[_0xe307('0x15')](function(_0x155208){_0x7778c6(null,_0x155208?_0x155208[_0xe307('0x1d')]:![]);})[_0xe307('0x17')](function(_0x394bde){_0x7778c6(_0x394bde);});};AGIVertices[_0xe307('0x12')][_0xe307('0x1e')]=function(_0x48ab0e,_0x269e06){this[_0xe307('0x10')][_0xe307('0x1f')](_0x48ab0e)[_0xe307('0x15')](function(_0x4fdf45){_0x269e06(null,_0x4fdf45?_0x4fdf45[_0xe307('0x16')]:![]);})[_0xe307('0x17')](function(_0x9c9503){_0x269e06(_0x9c9503);});};AGIVertices[_0xe307('0x12')][_0xe307('0x20')]=function(_0x51c015,_0x47b2d4){this[_0xe307('0x10')][_0xe307('0x21')](_0x51c015)[_0xe307('0x15')](function(_0x188f14){_0x47b2d4(null,_0x188f14?_0x188f14[_0xe307('0x16')]:![]);})[_0xe307('0x17')](function(_0x2651ec){_0x47b2d4(_0x2651ec);});};AGIVertices[_0xe307('0x12')][_0xe307('0x22')]=function(_0x47b075,_0x6b9643){var _0x1590bd=this;this['rpc'][_0xe307('0x23')](_0x47b075)['then'](function(_0x51586d){_0x6b9643(null,_0x51586d?_0x1590bd[_0xe307('0x24')](_0x51586d[_0xe307('0x25')]):![]);})[_0xe307('0x17')](function(_0x5758a4){_0x6b9643(_0x5758a4);});};AGIVertices[_0xe307('0x12')]['getMailAccount']=function(_0x3fa6e5,_0x4b17ce){this['rpc']['getMailAccountById'](_0x3fa6e5)['then'](function(_0xcb39ca){_0x4b17ce(null,_0xcb39ca?_0xcb39ca:![]);})[_0xe307('0x17')](function(_0x51c759){_0x4b17ce(_0x51c759);});};AGIVertices[_0xe307('0x12')][_0xe307('0x26')]=function(_0x2c0d66,_0x3c85ef,_0x4b8490){this[_0xe307('0x11')]['sendMailMessage'](_0x2c0d66,_0x3c85ef)['then'](function(){_0x4b8490(null);})[_0xe307('0x17')](function(_0x1649a4){_0x4b8490(_0x1649a4);});};AGIVertices[_0xe307('0x12')][_0xe307('0x27')]=function(_0x504d0b,_0x17b834){this['rpc'][_0xe307('0x28')](_0x504d0b)[_0xe307('0x15')](function(_0x5d6290){if(_0x5d6290){if(_0x5d6290[_0xe307('0x29')]){_0x17b834(null,[_0x5d6290[_0xe307('0x2a')]]);}else{_0x17b834(null,_[_0xe307('0x2b')](_0x5d6290[_0xe307('0x2c')],'interval'));}}else{_0x17b834(null,![]);}})['catch'](function(_0xe0da0a){_0x17b834(_0xe0da0a);});};AGIVertices[_0xe307('0x12')]['getSoundPath']=function(_0x293cd2){return util[_0xe307('0x2d')](_0xe307('0x2e'),FILES_PATH,_0x293cd2);};AGIVertices['prototype'][_0xe307('0x2f')]=function(_0x29b3b9,_0x4e7f46,_0x541110){odbc['open'](_0x29b3b9,function(_0x300ce0){if(_0x300ce0){logger['error'](_0xe307('0x30'),_0x300ce0);_0x541110(_0x300ce0);}else{logger[_0xe307('0x31')](_0xe307('0x32'));odbc[_0xe307('0x33')](_0x4e7f46,function(_0x5b2d91,_0x600b40){if(_0x5b2d91){logger[_0xe307('0x31')]('Error\x20executing\x20query\x20%s',_0x4e7f46);_0x541110(_0x5b2d91);}else{logger['info'](_0xe307('0x34'),_0x4e7f46);odbc['close'](function(_0x59f9e7){if(_0x59f9e7){logger[_0xe307('0x35')](_0xe307('0x36'),_0x59f9e7);}_0x541110(null,_0x600b40);});}});}});};AGIVertices[_0xe307('0x12')][_0xe307('0x37')]=function(_0x36c192,_0x55ee39){this['rpc'][_0xe307('0x38')](_0x36c192)[_0xe307('0x15')](function(_0x28aa4b){_0x55ee39(null,_0x28aa4b?_0x28aa4b:![]);})['catch'](function(_0x366e8c){_0x55ee39(_0x366e8c);});};AGIVertices[_0xe307('0x12')]['createSmsMessage']=function(_0x2c06c5,_0x4ea326){this[_0xe307('0x10')]['createSmsMessage'](_0x2c06c5)['then'](function(_0x128d30){_0x4ea326(null,_0x128d30);})['catch'](function(_0xc8468e){_0x4ea326(_0xc8468e);});};AGIVertices[_0xe307('0x12')][_0xe307('0x39')]=function(_0xc81c05,_0x2073bd,_0x187373){this[_0xe307('0x10')][_0xe307('0x39')]({'uniqueid':this['channel'][_0xe307('0x3a')],'node':_0xc81c05[_0xe307('0x3b')],'application':_0xc81c05[_0xe307('0x3c')],'data':_0x2073bd||null,'project_name':this[_0xe307('0xf')][_0xe307('0x3d')],'callerid':this[_0xe307('0xf')][_0xe307('0x3e')]})[_0xe307('0x15')](function(_0x197e6a){if(_0x187373){_0x187373(null,_0x197e6a);}})['catch'](function(_0x601cdb){if(_0x187373){_0x187373(_0x601cdb);}});};AGIVertices[_0xe307('0x12')][_0xe307('0x3f')]=function(_0x3757b4,_0x3453b1,_0x1c082a,_0x16393e){this['rpc'][_0xe307('0x3f')]({'uniqueid':this['channel'][_0xe307('0x3a')],'callerid':this[_0xe307('0xf')]['callerid'],'calleridname':this['channel'][_0xe307('0x40')],'context':this[_0xe307('0xf')][_0xe307('0x41')],'extension':this[_0xe307('0xf')]['extension'],'priority':this[_0xe307('0xf')][_0xe307('0x42')],'accountcode':this[_0xe307('0xf')][_0xe307('0x43')],'dnid':this[_0xe307('0xf')][_0xe307('0x44')],'projectName':this['channel'][_0xe307('0x3d')],'saveName':_0x3453b1,'filename':_0x3757b4[_0xe307('0x45')]||_0x3453b1,'savePath':_0x1c082a})[_0xe307('0x15')](function(_0x199086){_0x16393e(null,_0x199086);})[_0xe307('0x17')](function(_0x18884d){_0x16393e(_0x18884d);});};AGIVertices[_0xe307('0x12')][_0xe307('0x46')]=function(_0x143b7e,_0x439e92,_0x5d9c34){this[_0xe307('0x10')]['createSquareMessage']({'uniqueid':this[_0xe307('0xf')][_0xe307('0x3a')],'body':_0x143b7e,'direction':_0x439e92})[_0xe307('0x15')](function(_0x3d7e3c){if(_0x5d9c34){_0x5d9c34(null,_0x3d7e3c);}})[_0xe307('0x17')](function(_0x369ca5){if(_0x5d9c34){_0x5d9c34(_0x369ca5);}});};AGIVertices['prototype'][_0xe307('0x47')]=function(_0x58cc00,_0x283535){console[_0xe307('0x48')](_0xe307('0x49'),_0x58cc00);console['log']('in\x20createcmcontact\x20callback',_0x283535);var _0x3d0271=0x0;if(_[_0xe307('0x4a')](_0x58cc00,_0xe307('0x4b'))){var _0x379ecd=_0x58cc00['dialTimezone'];if(_0x58cc00[_0xe307('0x4b')]=='CALLERID(dialTimezone)'){}}this[_0xe307('0x10')][_0xe307('0x47')]({'firstName':_[_0xe307('0x4c')](_0x58cc00['name'])||_[_0xe307('0x4d')](_0x58cc00[_0xe307('0x16')])?_0xe307('0x4e')+Math[_0xe307('0x4f')]():_0x58cc00['name'],'lastName':_[_0xe307('0x4c')](_0x58cc00[_0xe307('0x50')])||_[_0xe307('0x4d')](_0x58cc00[_0xe307('0x50')])?null:_0x58cc00['lastName'],'phone':_0x58cc00[_0xe307('0x51')],'ListId':_0x58cc00[_0xe307('0x52')],'scheduledat':_0x58cc00[_0xe307('0x53')],'callbackUniqueid':this[_0xe307('0xf')]['uniqueid'],'tags':_0xe307('0x54'),'description':_0xe307('0x55')+_0x58cc00[_0xe307('0x53')][_0xe307('0x56')](),'priority':_0x58cc00[_0xe307('0x57')]})['then'](function(_0x32a251){_0x283535(null,_0x32a251);})['catch'](function(_0x27339c){_0x283535(_0x27339c);});};AGIVertices[_0xe307('0x12')]['getPause']=function(_0x2de7a4,_0xb7ae0c){this[_0xe307('0x10')][_0xe307('0x58')](_0x2de7a4)[_0xe307('0x15')](function(_0x44afe5){_0xb7ae0c(null,_0x44afe5?_0x44afe5[_0xe307('0x16')]:![]);})[_0xe307('0x17')](function(_0x43aa79){_0xb7ae0c(_0x43aa79);});};AGIVertices[_0xe307('0x12')][_0xe307('0x59')]=function(_0x53313c,_0x3c4db8,_0x5de0c1){var _0x2fe049={'role':'agent'};_0x2fe049[_0x53313c]=this['channel'][_0xe307('0x3e')];this[_0xe307('0x10')][_0xe307('0x59')](_0x2fe049,_0x3c4db8,this['channel'][_0xe307('0x3a')])[_0xe307('0x15')](function(_0x2b13f8){_0x5de0c1(null,_[_0xe307('0x4d')](_0x2b13f8)?![]:!![]);})['catch'](function(_0x509f6f){logger[_0xe307('0x35')](_0x509f6f);_0x5de0c1(null,![]);});};AGIVertices[_0xe307('0x12')][_0xe307('0x5a')]=function(_0x42f6c6,_0x3d0df8){var _0x2ccb25={'role':_0xe307('0x5b')};_0x2ccb25[_0x42f6c6]=this[_0xe307('0xf')][_0xe307('0x3e')];this[_0xe307('0x10')][_0xe307('0x5a')](_0x2ccb25)[_0xe307('0x15')](function(_0x4d2c97){_0x3d0df8(null,_[_0xe307('0x4d')](_0x4d2c97)?![]:!![]);})[_0xe307('0x17')](function(_0x4e12a8){logger[_0xe307('0x35')](_0x4e12a8);_0x3d0df8(null,![]);});};AGIVertices[_0xe307('0x12')][_0xe307('0x5c')]=function(_0x5686bb,_0x7824ac){var _0x305bf8={'role':_0xe307('0x5b')};_0x305bf8[_0x5686bb]=this['channel']['callerid'];this[_0xe307('0x10')][_0xe307('0x5c')](_0x305bf8)[_0xe307('0x15')](function(_0x3e3aa6){_0x7824ac(null,_[_0xe307('0x4d')](_0x3e3aa6)?![]:!![]);})['catch'](function(_0x7de49e){logger[_0xe307('0x35')](_0x7de49e);_0x7824ac(null,![]);});};AGIVertices[_0xe307('0x12')][_0xe307('0x5d')]=function(_0x24109c,_0x3ba0fa){var _0x1b5bbe={'role':_0xe307('0x5b')};_0x1b5bbe[_0x24109c]=this['channel'][_0xe307('0x3e')];var _0x4147d8=_0x24109c!='internal'?util[_0xe307('0x2d')](_0xe307('0x5e'),'LOCAL',this['channel'][_0xe307('0x3e')]):undefined;this[_0xe307('0x10')][_0xe307('0x5d')](_0x1b5bbe,_0x4147d8)[_0xe307('0x15')](function(_0x20228e){_0x3ba0fa(null,_[_0xe307('0x4d')](_0x20228e)?![]:!![]);})['catch'](function(_0x56cf0a){logger[_0xe307('0x35')](_0x56cf0a);_0x3ba0fa(null,![]);});};AGIVertices[_0xe307('0x12')]['shellCommand']=function(_0x3eed89,_0xc1eaf4){sh['exec'](_[_0xe307('0x5f')](_0x3eed89),function(_0x100394,_0x231256){var _0x2e5c89=_0x231256[_0xe307('0x60')](/(\r\n|\n|\r)/gm,'');_0xc1eaf4(null,_0x2e5c89);});};AGIVertices[_0xe307('0x12')]['googleCloudTTS']=function(_0x4c5476,_0x414b3e){scripts[_0xe307('0x61')](_0x4c5476[_0xe307('0x62')],_0x4c5476[_0xe307('0x63')]||'text',_0x4c5476[_0xe307('0x64')],_0x4c5476[_0xe307('0x65')]||_0xe307('0x66'),_0x4c5476[_0xe307('0x67')]||_0xe307('0x68'),_0x4c5476[_0xe307('0x69')]||_0xe307('0x6a'))['then'](function(_0x4f2b6f){_0x414b3e(null,_0x4f2b6f);})['catch'](function(_0x9e1395){_0x414b3e(_0x9e1395);});};AGIVertices[_0xe307('0x12')][_0xe307('0x6b')]=function(_0x2c5b5b,_0x45d1a4){scripts[_0xe307('0x6b')](_0x2c5b5b[_0xe307('0x64')],_0x2c5b5b[_0xe307('0x6c')]||'en',0x1)[_0xe307('0x15')](function(_0x505d90){_0x45d1a4(null,_0x505d90);})[_0xe307('0x17')](function(_0x27316a){_0x45d1a4(_0x27316a);});};AGIVertices[_0xe307('0x12')][_0xe307('0x6d')]=function(_0x228c74,_0x5dab85){var _0x3163f6={'uri':_0x228c74[_0xe307('0x6e')],'method':_0x228c74[_0xe307('0x6f')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x228c74['timeout'])===_0xe307('0x70')&&parseInt(_0x228c74[_0xe307('0x71')])>=0x1?parseInt(_0x228c74['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xe307('0x72')]([_0xe307('0x73'),_0xe307('0x74')],_0x3163f6['method'][_0xe307('0x75')]())){try{_0x3163f6[_0xe307('0x76')]=_0x228c74['rawBody']?JSON[_0xe307('0x77')](_0x228c74['rawBody']):{};}catch(_0x4501d5){logger[_0xe307('0x35')](_0xe307('0x78'),_0x4501d5);}}try{_0x3163f6[_0xe307('0x79')]=_0x228c74[_0xe307('0x7a')]?JSON[_0xe307('0x77')](_0x228c74[_0xe307('0x7a')]):{};}catch(_0x2cbc2a){logger[_0xe307('0x35')](_0xe307('0x7b'),_0x2cbc2a);}if(_0x228c74['computedVariables']){try{var _0x36b7f1=require(_0x228c74['computedVariables'])[_0xe307('0x7c')](this,_0x3163f6);_0x3163f6['uri']=Mustache[_0xe307('0x7d')](_0x228c74['url'],_0x36b7f1,{},['$$','$$']);if(_0x3163f6[_0xe307('0x79')]){_0x3163f6[_0xe307('0x79')]=JSON['parse'](Mustache[_0xe307('0x7d')](JSON[_0xe307('0x7e')](_0x3163f6[_0xe307('0x79')]),_0x36b7f1,{},['$$','$$']));}if(_0x3163f6[_0xe307('0x76')]){_0x3163f6['body']=JSON[_0xe307('0x77')](Mustache[_0xe307('0x7d')](JSON[_0xe307('0x7e')](_0x3163f6[_0xe307('0x76')]),_0x36b7f1,{},['$$','$$']));}}catch(_0x218db4){logger[_0xe307('0x35')](_0xe307('0x7f'),_0x218db4);}}rp(_0x3163f6)[_0xe307('0x15')](function(_0x4545a9){var _0x1cd514={'statusCode':_0x4545a9[_0xe307('0x80')]||0xc8,'statusMessage':_0x4545a9[_0xe307('0x81')]||'OK','headers':_0x4545a9[_0xe307('0x79')]||{},'body':_0x4545a9['body']||{}};_0x5dab85(null,_0x1cd514);})[_0xe307('0x17')](function(_0x5acdf8){var _0x39915a={'statusCode':_0x5acdf8[_0xe307('0x80')]||0x1f4,'statusMessage':_0x5acdf8[_0xe307('0x82')]||_0xe307('0x83'),'headers':_0x5acdf8['options']['headers']||{},'body':_0x5acdf8[_0xe307('0x84')][_0xe307('0x76')]||{}};_0x5dab85(null,_0x39915a);});};AGIVertices['prototype'][_0xe307('0x85')]=function(_0x4f6071,_0x377727){scripts[_0xe307('0x85')](this['channel'][_0xe307('0x3a')],_0x4f6071[_0xe307('0x86')],_0x4f6071['text'],_0x4f6071[_0xe307('0x87')]||'en')[_0xe307('0x15')](function(_0xca9547){_0x377727(null,_0xca9547);})[_0xe307('0x17')](function(_0x3296cc){_0x377727(_0x3296cc);});};AGIVertices['prototype'][_0xe307('0x88')]=function(_0x111336,_0x29c9ce){scripts[_0xe307('0x88')](this[_0xe307('0xf')],_0x111336)[_0xe307('0x15')](function(_0x34af49){_0x29c9ce(null,_0x34af49);})[_0xe307('0x17')](function(_0x31f0a2){_0x29c9ce(_0x31f0a2);});};AGIVertices[_0xe307('0x12')][_0xe307('0x89')]=function(_0xd96ba4,_0x393267){scripts[_0xe307('0x89')](_0xd96ba4['key'],_0xd96ba4[_0xe307('0x64')],_0xd96ba4['ispeech_tts_language']||_0xe307('0x66'),_0xd96ba4[_0xe307('0x8a')])[_0xe307('0x15')](function(_0x56a218){_0x393267(null,_0x56a218);})['catch'](function(_0x256484){_0x393267(_0x256484);});};AGIVertices[_0xe307('0x12')][_0xe307('0x8b')]=function(_0x1791f6,_0x3e9a12,_0x4572cb){scripts['ispeechASR'](_0x3e9a12,_0x1791f6[_0xe307('0x86')],_0x1791f6[_0xe307('0x8c')]||'en-US',this[_0xe307('0x8d')](_0x1791f6[_0xe307('0x8e')])?_0x1791f6[_0xe307('0x8e')]:undefined)['then'](function(_0x4db7f9){_0x4572cb(null,_0x4db7f9);})[_0xe307('0x17')](function(_0x578bb6){_0x4572cb(_0x578bb6);});};AGIVertices['prototype'][_0xe307('0x8f')]=function(_0x14567d,_0x485283){scripts[_0xe307('0x8f')](_0x14567d['aws_access_key_id'],_0x14567d['aws_secret_access_key'],_0x14567d[_0xe307('0x90')],_0x14567d[_0xe307('0x91')]||_0xe307('0x92'),_0x14567d[_0xe307('0x64')],_0x14567d[_0xe307('0x93')]||_0xe307('0x64'))[_0xe307('0x15')](function(_0x13e8a5){_0x485283(null,_0x13e8a5);})[_0xe307('0x17')](function(_0xf1fb40){_0x485283(_0xf1fb40);});};AGIVertices['prototype'][_0xe307('0x94')]=function(_0x1b047f,_0x16e611){scripts['awsLex'](this[_0xe307('0xf')][_0xe307('0x3a')],_0x1b047f['aws_access_key_id'],_0x1b047f[_0xe307('0x95')],_0x1b047f[_0xe307('0x96')],_0x1b047f[_0xe307('0x64')],_0x1b047f[_0xe307('0x97')])[_0xe307('0x15')](function(_0x30535d){_0x16e611(null,_0x30535d);})[_0xe307('0x17')](function(_0x396cac){_0x16e611(_0x396cac);});};AGIVertices[_0xe307('0x12')]['googleASR']=function(_0x56867b,_0x4ef67b,_0x277762){scripts[_0xe307('0x98')](_0x4ef67b,_0x56867b[_0xe307('0x86')],_0x56867b[_0xe307('0x99')]||_0xe307('0x66'))[_0xe307('0x15')](function(_0x3f2f5d){_0x277762(null,_0x3f2f5d);})['catch'](function(_0xe57ea5){_0x277762(_0xe57ea5);});};AGIVertices['prototype']['tildeASR']=function(_0x338846,_0x136368,_0x5c8d26){scripts[_0xe307('0x9a')](_0x136368,_0x338846[_0xe307('0x9b')],_0x338846[_0xe307('0x9c')],_0x338846['uri'])[_0xe307('0x15')](function(_0xd7f0cb){_0x5c8d26(null,_0xd7f0cb);})['catch'](function(_0xb59b13){_0x5c8d26(_0xb59b13);});};AGIVertices[_0xe307('0x12')][_0xe307('0x9d')]=function(_0x321aec){var _0x398856=_['includes'](verticesWithRetry,_0x321aec[_0xe307('0x3c')])?_0x321aec:_[_0xe307('0x9e')](_0x321aec);for(var _0x5eedbd in _0x398856){if(_0x398856[_0xe307('0x9f')](_0x5eedbd)){if(_0x398856[_0x5eedbd]&&_[_0xe307('0xa0')](_0x398856[_0x5eedbd])){if(_[_0xe307('0x72')](recursiveMapAttributes,_0x5eedbd)){_0x398856[_0x5eedbd]=this[_0xe307('0xa1')](_0x398856[_0x5eedbd]);}else{_0x398856[_0x5eedbd]=this[_0xe307('0xa2')](_0x398856[_0x5eedbd]);}}}}return _0x398856;};AGIVertices[_0xe307('0x12')]['recursiveNodeIndex']=function(_0x3c52e4){for(var _0x32000e in _0x3c52e4){if(_0x3c52e4[_0xe307('0x9f')](_0x32000e)){if(_[_0xe307('0xa3')](_0x3c52e4[_0x32000e])){this[_0xe307('0xa4')](_0x3c52e4[_0x32000e]);}else if(_[_0xe307('0xa5')](_0x3c52e4[_0x32000e])){for(var _0x17305c=0x0;_0x17305c<_0x3c52e4[_0x32000e][_0xe307('0xa6')];_0x17305c++){this[_0xe307('0xa4')](_0x3c52e4[_0x32000e][_0x17305c]);}}else if(_[_0xe307('0xa0')](_0x3c52e4[_0x32000e])){_0x3c52e4[_0x32000e]=this['replaceAllVariables'](_0x3c52e4[_0x32000e]);}}}};AGIVertices['prototype'][_0xe307('0xa7')]=function(_0x4b8459,_0x563ba9){for(var _0x40c74b in _0x4b8459){if(_0x4b8459[_0xe307('0x9f')](_0x40c74b)){if(_['isPlainObject'](_0x4b8459[_0x40c74b])){if(!_['isEmpty'](_0x4b8459[_0x40c74b])){this[_0xe307('0xa7')](_0x4b8459[_0x40c74b],util['format'](_0xe307('0xa8'),_0x563ba9,_0x40c74b));}}else if(_['isArray'](_0x4b8459[_0x40c74b])){for(var _0x2476b7=0x0;_0x2476b7<_0x4b8459[_0x40c74b][_0xe307('0xa6')];_0x2476b7++){this['saveRestApiResult'](_0x4b8459[_0x40c74b][_0x2476b7],util[_0xe307('0x2d')](_0xe307('0xa8'),_0x563ba9,_0x40c74b+'['+_0x2476b7+']'));}}else{if(!_[_0xe307('0x4d')](_0x4b8459[_0x40c74b])){this[_0xe307('0xf')][_0xe307('0xa9')](util['format']('%s.%s',_0x563ba9,_0x40c74b),_0x4b8459[_0x40c74b]);}}}}};AGIVertices[_0xe307('0x12')]['replaceObjectAllVariables']=function(_0x2b8708){try{var _0xd68d25=JSON[_0xe307('0x77')](_0x2b8708);this[_0xe307('0xa4')](_0xd68d25);return JSON['stringify'](_0xd68d25);}catch(_0x34e266){return this[_0xe307('0xa2')](_0x2b8708);}};AGIVertices[_0xe307('0x12')][_0xe307('0xa2')]=function(_0x3bbcc7){console[_0xe307('0x48')](_0xe307('0xaa'),_0x3bbcc7);var _0x514ca2=_0x3bbcc7[_0xe307('0xab')]('{');for(var _0x4f8718=0x1;_0x4f8718<_0x514ca2[_0xe307('0xa6')];_0x4f8718+=0x1){var _0x1b62e7=_0x514ca2[_0x4f8718][_0xe307('0xab')]('}');console[_0xe307('0x48')](_0xe307('0xac'),_0x1b62e7);if(_0x1b62e7['length']>0x1){_0x3bbcc7=_0x3bbcc7[_0xe307('0xad')]('{'+_0x1b62e7[0x0]+'}',this['channel'][_0xe307('0x13')](_0x1b62e7[0x0])[_0xe307('0xae')]||_0x1b62e7[0x0]);}}if(_0x514ca2[_0xe307('0xa6')]===0x1){return _0x3bbcc7['toString']();}console[_0xe307('0x48')](_0xe307('0xaf'),_0x3bbcc7);return this['replaceAllVariables'](_0x3bbcc7);};AGIVertices[_0xe307('0x12')]['getAndSetVariable']=function(_0x5cdc1a,_0x23919d){var _0x382b70=this['channel'][_0xe307('0x13')](_0x5cdc1a);if(_0x382b70[_0xe307('0xb0')]===-0x1){return _0x382b70;}logger['info'](util[_0xe307('0x2d')](_0xe307('0xb1'),_0x23919d,_0x382b70[_0xe307('0xae')]));return this[_0xe307('0xf')][_0xe307('0xa9')](_0x23919d,_0x382b70[_0xe307('0xae')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x8d')]=function(_0x1a3053){return _0x1a3053&&_0x1a3053!=='0'&&_0x1a3053!=='-1'&&_0x1a3053!=='';};AGIVertices[_0xe307('0x12')][_0xe307('0xb2')]=function(_0x25eca9){this[_0xe307('0x39')]['sync'](this,_0x25eca9,'-');_0x25eca9[_0xe307('0xb3')]=_0x25eca9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe307('0x12')][_0xe307('0xb4')]=function(_0x14e3b3){logger['info'](util[_0xe307('0x2d')](_0xe307('0xb5'),_0x14e3b3[_0xe307('0x3b')]));if(!this['isConfigured'](_0x14e3b3[_0xe307('0x64')])){return this[_0xe307('0xf')]['noop']('no\x20text\x20configured');}var _0x3c4ebe='\x22'+_0x14e3b3[_0xe307('0x64')]+'\x22';if(this[_0xe307('0x8d')](_0x14e3b3['options'])){_0x3c4ebe+=','+_0x14e3b3[_0xe307('0x84')];}var _0x407adc=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xb7'),_0x3c4ebe);if(_0x407adc[_0xe307('0xb0')]===-0x1){return _0x407adc;}return this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0xb9'),_0x3c4ebe));};AGIVertices[_0xe307('0x12')][_0xe307('0xba')]=function(_0x2df2e0){logger['info'](util[_0xe307('0x2d')](_0xe307('0xbb'),_0x2df2e0[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x2df2e0['grammar'])){return this[_0xe307('0xf')]['noop']('no\x20grammar\x20configured');}var _0x7bc4b4=_0x2df2e0[_0xe307('0xbc')];if(this['isConfigured'](_0x2df2e0['options'])){_0x7bc4b4+=','+_0x2df2e0[_0xe307('0x84')];}var _0x2c7db5=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xbd'),_0x7bc4b4);if(_0x2c7db5['result']===-0x1){return _0x2c7db5;}var _0x5b61b9=this[_0xe307('0xbe')](_0xe307('0xbf'),_0xe307('0xc0'));if(_0x5b61b9[_0xe307('0xb0')]===-0x1){return _0x5b61b9;}var _0x3a3424=this[_0xe307('0xbe')](_0xe307('0xc1'),_0xe307('0xc2'));if(_0x3a3424[_0xe307('0xb0')]===-0x1){return _0x3a3424;}var _0x260686=this['getAndSetVariable'](_0xe307('0xc3'),_0xe307('0xc4'));if(_0x260686[_0xe307('0xb0')]===-0x1){return _0x260686;}return this['channel']['noop'](util[_0xe307('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x7bc4b4));};AGIVertices['prototype'][_0xe307('0xc5')]=function(_0x2e0915){logger['info'](util[_0xe307('0x2d')](_0xe307('0xc6'),_0x2e0915[_0xe307('0x3b')]));return this[_0xe307('0xf')][_0xe307('0xc5')]([_0x2e0915['command'],_0x2e0915[_0xe307('0xc7')]]);};AGIVertices[_0xe307('0x12')]['answer']=function(_0x322f9c){logger['info'](util[_0xe307('0x2d')](_0xe307('0xc8'),_0x322f9c[_0xe307('0x3b')]));if(this[_0xe307('0x8d')](_0x322f9c[_0xe307('0x71')])){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0xc9'),_0x322f9c[_0xe307('0x71')]));var _0x14e353=this[_0xe307('0xf')]['wait'](_0x322f9c[_0xe307('0x71')]);if(_0x14e353['result']===-0x1){return _0x14e353;}}return this[_0xe307('0xf')][_0xe307('0xca')]();};AGIVertices[_0xe307('0x12')][_0xe307('0x54')]=function(_0x4a5b19){console[_0xe307('0x48')](_0xe307('0xcb'),_0x4a5b19);logger['info'](util[_0xe307('0x2d')](_0xe307('0xcc'),_0x4a5b19[_0xe307('0x3b')]));if(!this['isConfigured'](_0x4a5b19['list_id'])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x4a5b19,'no\x20list\x20selected');}_0x4a5b19['scheduledAt']=moment();if(this['isConfigured'](_0x4a5b19[_0xe307('0xcd')])){_0x4a5b19['scheduledAt']=moment()[_0xe307('0xce')](_0x4a5b19[_0xe307('0xcd')],_0xe307('0xcf'));}if(!this[_0xe307('0x8d')](_0x4a5b19['callback_priority'])){_0x4a5b19['callback_priority']=0x2;}console[_0xe307('0x48')]('before\x20createcmcontact',_0x4a5b19);this['createCmContact']['sync'](this,_0x4a5b19);return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xd0'),_0x4a5b19[_0xe307('0x51')],_0x4a5b19[_0xe307('0x52')],_0x4a5b19['scheduledAt']));};AGIVertices[_0xe307('0x12')][_0xe307('0xd1')]=function(_0x2bcab1){logger[_0xe307('0x31')](util['format'](_0xe307('0xd2'),_0x2bcab1['label']));var _0x1fa2ca=this[_0xe307('0xf')][_0xe307('0xb6')](_0x2bcab1[_0xe307('0xd3')],_0x2bcab1[_0xe307('0x84')]);if(_0x1fa2ca[_0xe307('0xb0')]===-0x1){return _0x1fa2ca;}return this['channel']['noop'](util['format'](_0xe307('0xd4'),_0x2bcab1[_0xe307('0xd3')],_0x2bcab1['options']));};AGIVertices[_0xe307('0x12')]['lumenvoxtts']=function(_0x4e8d83){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4e8d83[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x4e8d83['text'])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20text\x20configured');}var _0x13cc38='\x22'+_0x4e8d83['text']+'\x22';if(this[_0xe307('0x8d')](_0x4e8d83[_0xe307('0x84')])){_0x13cc38+=','+_0x4e8d83['options'];}var _0x59182d=this['channel']['exec']('MRCPSynth',_0x13cc38);if(_0x59182d[_0xe307('0xb0')]===-0x1){return _0x59182d;}return this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0xb9'),_0x13cc38));};AGIVertices[_0xe307('0x12')][_0xe307('0xd5')]=function(_0x26336b){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x26336b[_0xe307('0x3b')]));if(!this['isConfigured'](_0x26336b['text'])){return this[_0xe307('0xf')]['noop'](_0xe307('0xd6'));}var _0x43e81e='\x22'+_0x26336b[_0xe307('0x64')]+'\x22';if(this[_0xe307('0x8d')](_0x26336b[_0xe307('0x84')])){_0x43e81e+=','+_0x26336b[_0xe307('0x84')];}var _0x3b0c4f=this[_0xe307('0xf')][_0xe307('0xb6')]('MRCPSynth',_0x43e81e);if(_0x3b0c4f[_0xe307('0xb0')]===-0x1){return _0x3b0c4f;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x43e81e));};AGIVertices[_0xe307('0x12')][_0xe307('0xd7')]=function(_0x1a842f){logger[_0xe307('0x31')](util['format'](_0xe307('0xd8'),_0x1a842f[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x1a842f[_0xe307('0xbc')])){return this['channel'][_0xe307('0xb8')](_0xe307('0xd9'));}var _0x20715e=_0x1a842f[_0xe307('0xbc')];if(this[_0xe307('0x8d')](_0x1a842f[_0xe307('0x84')])){_0x20715e+=','+_0x1a842f[_0xe307('0x84')];}var _0xf7c03=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xbd'),_0x20715e);if(_0xf7c03['result']===-0x1){return _0xf7c03;}var _0x41da39=this[_0xe307('0xbe')]('RECOG_CONFIDENCE()',_0xe307('0xda'));if(_0x41da39[_0xe307('0xb0')]===-0x1){return _0x41da39;}var _0x4d41c5=this[_0xe307('0xbe')](_0xe307('0xc1'),_0xe307('0xdb'));if(_0x4d41c5[_0xe307('0xb0')]===-0x1){return _0x4d41c5;}var _0x5dba2b=this[_0xe307('0xbe')](_0xe307('0xc3'),_0xe307('0xdc'));if(_0x5dba2b['result']===-0x1){return _0x5dba2b;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xdd'),_0x20715e));};AGIVertices[_0xe307('0x12')][_0xe307('0xde')]=function(_0x4b1712){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4b1712[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x4b1712['grammar'])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xd9'));}var _0xa905e8=_0x4b1712[_0xe307('0xbc')];if(this[_0xe307('0x8d')](_0x4b1712[_0xe307('0x84')])){_0xa905e8+=','+_0x4b1712[_0xe307('0x84')];}var _0x2e2f12=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xbd'),_0xa905e8);if(_0x2e2f12[_0xe307('0xb0')]===-0x1){return _0x2e2f12;}var _0x5a4463=this[_0xe307('0xbe')](_0xe307('0xbf'),_0xe307('0xdf'));if(_0x5a4463[_0xe307('0xb0')]===-0x1){return _0x5a4463;}var _0x541e64=this['getAndSetVariable'](_0xe307('0xc1'),'SESTEK_ASR_TRANSCRIPT');if(_0x541e64[_0xe307('0xb0')]===-0x1){return _0x541e64;}var _0x78bffe=this['getAndSetVariable'](_0xe307('0xc3'),_0xe307('0xe0'));if(_0x78bffe[_0xe307('0xb0')]===-0x1){return _0x78bffe;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa905e8));};AGIVertices[_0xe307('0x12')][_0xe307('0xe1')]=function(_0x2796d7){logger['info'](util[_0xe307('0x2d')](_0xe307('0xe2'),_0x2796d7[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x2796d7[_0xe307('0xe3')])){return this['channel'][_0xe307('0x35')](_0x2796d7,_0xe307('0xe4'));}var _0x18c2ae=this[_0xe307('0x1b')][_0xe307('0x7c')](this,_0x2796d7[_0xe307('0xe3')]);if(!_0x18c2ae){return this['channel']['error'](_0x2796d7,_0xe307('0xe5'));}if(!this[_0xe307('0x8d')](_0x2796d7[_0xe307('0x33')])){return this[_0xe307('0xf')]['error'](_0x2796d7,_0xe307('0xe6'));}var _0x5ac29c=_0x2796d7[_0xe307('0x33')][_0xe307('0x60')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0xe7'),_0x5ac29c));var _0x34d5e7=this[_0xe307('0x2f')][_0xe307('0x7c')](this,_0x18c2ae,_0x5ac29c);this[_0xe307('0x39')]['sync'](this,_0x2796d7,_0x5ac29c);if(!this[_0xe307('0x8d')](_0x2796d7[_0xe307('0xe8')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xe9'));}var _0x1aa830=this[_0xe307('0x13')][_0xe307('0x7c')](this,_0x2796d7[_0xe307('0xe8')]);if(!_0x1aa830){return this['channel']['error'](_0x2796d7,_0xe307('0xea'));}var _0x508f7b=this;_0x34d5e7['forEach'](function(_0xd27bac,_0x2f9451){Object[_0xe307('0xeb')](_0xd27bac)[_0xe307('0xec')](function(_0x160787){_0x508f7b[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0xed'),_0x1aa830,_0x2f9451,_0x160787),_0xd27bac[_0x160787]);});});this['channel']['setVariable'](util[_0xe307('0x2d')](_0xe307('0xee'),_0x1aa830),_0x34d5e7[_0xe307('0xa6')]);return this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xef'),_0x1aa830));};AGIVertices[_0xe307('0x12')][_0xe307('0xf0')]=function(_0x2087fd){logger[_0xe307('0xf1')](util[_0xe307('0x2d')](_0xe307('0xf2'),_0x2087fd[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x2087fd[_0xe307('0xf3')])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x2087fd,_0xe307('0xf4'));}var _0x58184d=this[_0xe307('0x1e')][_0xe307('0x7c')](this,_0x2087fd[_0xe307('0xf3')]);if(!_0x58184d){return this[_0xe307('0xf')]['error'](_0x2087fd,'no\x20user\x20found');}var _0x3a8217=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xf5'),[util[_0xe307('0x2d')]('SIP/%s',_0x58184d),_0x2087fd[_0xe307('0x71')],_0x2087fd[_0xe307('0xf6')],_0x2087fd[_0xe307('0x6e')]]);if(_0x3a8217[_0xe307('0xb0')]===-0x1){return _0x3a8217;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xf7'),_0xe307('0xf5')));};AGIVertices[_0xe307('0x12')][_0xe307('0xf8')]=function(_0x19a0f3){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x19a0f3[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x19a0f3[_0xe307('0x86')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x19a0f3[_0xe307('0x64')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xd6'));}this[_0xe307('0xf')][_0xe307('0xf9')]=!![];this[_0xe307('0x39')](_0x19a0f3);this[_0xe307('0x46')](_0x19a0f3[_0xe307('0x64')],'in');this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0xfa'),_0x19a0f3[_0xe307('0x64')]));var _0x237afe=this['googleDialogflow'][_0xe307('0x7c')](this,_0x19a0f3);if(_0x237afe){for(var _0x10fdd2 in _0x237afe){if(_0x237afe[_0xe307('0x9f')](_0x10fdd2)){this[_0xe307('0xf')]['setVariable'](util['format'](_0xe307('0xfb'),_0x10fdd2[_0xe307('0x75')]()),_0x237afe[_0x10fdd2]);}}this['createSquareMessage'](_0x237afe[_0xe307('0xfc')],_0xe307('0xfd'));return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Dialogflow\x20Result\x20%s',_0x237afe[_0xe307('0xfc')]));}return this[_0xe307('0xf')][_0xe307('0x35')](_0x19a0f3,_0xe307('0xfe'));};AGIVertices[_0xe307('0x12')][_0xe307('0xff')]=function(_0x2c39cf){logger[_0xe307('0x31')](util['format'](_0xe307('0x100'),_0x2c39cf[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x2c39cf[_0xe307('0x101')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xe307('0x8d')](_0x2c39cf[_0xe307('0x102')])){return this['channel'][_0xe307('0xb8')]('no\x20username\x20configured');}if(!this[_0xe307('0x8d')](_0x2c39cf[_0xe307('0x103')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20password\x20configured');}if(!this[_0xe307('0x8d')](_0x2c39cf['ndassistant_url'])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xd6'));}this[_0xe307('0xf')]['bot']=!![];this[_0xe307('0x39')](_0x2c39cf);this[_0xe307('0x46')](_0x2c39cf[_0xe307('0x64')],'in');this['channel']['noop'](util['format'](_0xe307('0x104'),_0x2c39cf[_0xe307('0x64')]));var _0x52219d=this[_0xe307('0x88')][_0xe307('0x7c')](this,_0x2c39cf);if(_0x52219d){for(var _0x4c86a7 in _0x52219d){if(_0x52219d[_0xe307('0x9f')](_0x4c86a7)){this[_0xe307('0xf')][_0xe307('0xa9')](util['format'](_0xe307('0x105'),_0x4c86a7[_0xe307('0x75')]()),_0x52219d[_0x4c86a7]);}}this[_0xe307('0x46')](_0x52219d[_0xe307('0xfc')],'out');if(_0x52219d[_0xe307('0x106')]){this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x52219d[_0xe307('0x106')]));var _0x53bbf7=this[_0xe307('0xf')]['streamFile'](_0x52219d['audiofile']);try{fs[_0xe307('0x107')](_0x52219d['audiofile']+'.wav');}catch(_0x57a0bb){logger[_0xe307('0x35')](_0x57a0bb);}return _0x53bbf7;}else{return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x108'),_0x52219d['speech']));}}return this['channel'][_0xe307('0x35')](_0x2c39cf,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xe307('0x109')]=function(_0x2bee1e){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x10a'),_0x2bee1e['label']));return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x109'));};AGIVertices['prototype'][_0xe307('0x10b')]=function(_0x134e58){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x10c'),_0x134e58[_0xe307('0x3b')]));var _0x3385b0='';if(_0x134e58[_0xe307('0x10d')]){if(!this[_0xe307('0x8d')](_0x134e58[_0xe307('0x10d')])){return this['channel'][_0xe307('0x35')](_0x134e58,'no\x20trunk\x20selected');}else{var _0x25e7e4=parseInt(_0x134e58[_0xe307('0x10d')],0xa);if(isNaN(_0x25e7e4)){_0x3385b0=_0x134e58[_0xe307('0x10d')];}else{_0x3385b0=this[_0xe307('0x20')]['sync'](this,_0x134e58['trunk_id']);if(!_0x3385b0){return this[_0xe307('0xf')][_0xe307('0x35')](_0x134e58,'no\x20trunk\x20found');}}}}else if(_0x134e58['trunk_name']){_0x3385b0=_0x134e58['trunk_name'];}else{return this[_0xe307('0xf')][_0xe307('0x35')](_0x134e58,_0xe307('0x10e'));}var _0x465ae7=this[_0xe307('0xf')][_0xe307('0xb6')](_0xe307('0xf5'),[util[_0xe307('0x2d')](_0xe307('0x10f'),_0x3385b0,_0x134e58[_0xe307('0x51')]),_0x134e58[_0xe307('0x71')],_0x134e58[_0xe307('0xf6')],_0x134e58[_0xe307('0x6e')]]);if(_0x465ae7['result']===-0x1){return _0x465ae7;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xe307('0x12')][_0xe307('0x110')]=function(_0x341078){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x111'),_0x341078[_0xe307('0x3b')]));return this['channel'][_0xe307('0xb8')](_0xe307('0x110'));};AGIVertices['prototype'][_0xe307('0xd')]=function(_0x40f205){logger['info'](util['format'](_0xe307('0x112'),_0x40f205['label']));if(_0x40f205['retry']===0x0){return this[_0xe307('0xb2')](_0x40f205);}_0x40f205[_0xe307('0xb3')]-=0x1;if(!this[_0xe307('0x8d')](_0x40f205['file_id'])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x40f205,_0xe307('0x113'));}var _0x1fbc07=this[_0xe307('0x22')][_0xe307('0x7c')](this,_0x40f205[_0xe307('0x114')]);if(!_0x1fbc07){return this[_0xe307('0xf')][_0xe307('0x35')](_0x40f205,_0xe307('0x115'));}if(!this[_0xe307('0x8d')](_0x40f205[_0xe307('0xe8')])){return this[_0xe307('0xf')][_0xe307('0x35')](_0xe307('0xe9'));}var _0x5aaa8f=this[_0xe307('0xf')][_0xe307('0x116')](_0x1fbc07,_0x40f205[_0xe307('0x117')],_0x40f205[_0xe307('0x118')]);var _0x1d54e4=_0x5aaa8f[_0xe307('0xb0')]?_0x5aaa8f[_0xe307('0xb0')][_0xe307('0x56')]():'';logger[_0xe307('0x31')](_0xe307('0x119'),JSON[_0xe307('0x7e')](_0x5aaa8f));if(_0x5aaa8f[_0xe307('0xb0')]===-0x1){this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x40f205,_0x1d54e4);return _0x5aaa8f;}else if(_0x5aaa8f['extra']===_0xe307('0x71')){_0x5aaa8f[_0xe307('0xb0')]=_0x1d54e4['length']>=parseInt(_0x40f205[_0xe307('0x11a')])?'x':'i';}else{_0x5aaa8f[_0xe307('0xb0')]=_0x1d54e4['length']>=parseInt(_0x40f205['mindigit'])&&_0x1d54e4['length']<=parseInt(_0x40f205[_0xe307('0x118')])?'x':'i';}var _0x5de084=this[_0xe307('0x13')]['sync'](this,_0x40f205[_0xe307('0xe8')]);if(!_0x5de084){return this['channel']['error'](_0x40f205,_0xe307('0xea'));}this[_0xe307('0xf')]['setVariable'](_0x5de084,_0x1d54e4);if(this[_0xe307('0x8d')](_0x40f205[_0xe307('0x11b')])){var _0x105b37=parseInt(_0x40f205[_0xe307('0x11b')],0xa);var _0x5cca46=rs[_0xe307('0x11c')]({'charset':'*','length':_0x105b37});var _0x2afe9a=_0x1d54e4[_0xe307('0xa6')];if(_0x2afe9a>0x0){if(_0x2afe9a>_0x105b37){this['createSquareDetailsReport'][_0xe307('0x7c')](this,_0x40f205,_0x40f205['hiddendigitspos']===_0xe307('0x11d')?_0x5cca46+_0x1d54e4[_0xe307('0x11e')](_0x105b37):_0x1d54e4[_0xe307('0x11e')](0x0,_0x2afe9a-_0x105b37)+_0x5cca46);}else{this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x40f205,rs['generate']({'charset':'*','length':_0x2afe9a}));}}else{this[_0xe307('0x39')]['sync'](this,_0x40f205,'');}}else{this['createSquareDetailsReport'][_0xe307('0x7c')](this,_0x40f205,_0x1d54e4);}return _0x5aaa8f;};AGIVertices['prototype']['getsecretdigits']=function(_0x44d1e5){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x44d1e5[_0xe307('0x3b')]));return this[_0xe307('0xd')](_0x44d1e5);};AGIVertices[_0xe307('0x12')][_0xe307('0x11f')]=function(_0x1ac8a8){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1ac8a8['label']));this['createSquareDetailsReport'][_0xe307('0x7c')](this,_0x1ac8a8,_0x1ac8a8[_0xe307('0x120')]);return this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0x121'),_0x1ac8a8[_0xe307('0x120')]));};AGIVertices[_0xe307('0x12')][_0xe307('0x122')]=function(_0x4bd1a5){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4bd1a5['label']));if(!this[_0xe307('0x8d')](_0x4bd1a5['aws_access_key_id'])||!this[_0xe307('0x8d')](_0x4bd1a5[_0xe307('0x95')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe307('0x8d')](_0x4bd1a5[_0xe307('0x64')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xd6'));}this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x123'),_0x4bd1a5[_0xe307('0x64')]));var _0x1fcdd2=this[_0xe307('0x8f')][_0xe307('0x7c')](this,_0x4bd1a5);if(_0x1fcdd2){this[_0xe307('0xf')]['noop'](util['format'](_0xe307('0x124'),_0x1fcdd2));var _0x539efe=this['channel'][_0xe307('0x125')](_0x1fcdd2);try{fs[_0xe307('0x107')](_0x1fcdd2+'.wav');}catch(_0x349275){logger[_0xe307('0x35')](_0x349275);}return _0x539efe;}return this[_0xe307('0xf')][_0xe307('0x35')](_0x4bd1a5,_0xe307('0x126'));};AGIVertices[_0xe307('0x12')][_0xe307('0x127')]=function(_0x3881f6){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3881f6['label']));if(!this['isConfigured'](_0x3881f6[_0xe307('0x128')])||!this[_0xe307('0x8d')](_0x3881f6[_0xe307('0x95')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x129'));}if(!this[_0xe307('0x8d')](_0x3881f6[_0xe307('0x97')])){return this['channel'][_0xe307('0xb8')](_0xe307('0x12a'));}if(!this['isConfigured'](_0x3881f6[_0xe307('0x64')])){return this[_0xe307('0xf')]['noop'](_0xe307('0xd6'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3881f6);this[_0xe307('0x46')](_0x3881f6['text'],'in');this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x12b'),_0x3881f6['text']));var _0x199ed1=this[_0xe307('0x94')]['sync'](this,_0x3881f6);if(_0x199ed1){for(var _0xdf1189 in _0x199ed1){if(_0x199ed1['hasOwnProperty'](_0xdf1189)&&_[_0xe307('0xa0')](_0x199ed1[_0xdf1189])){this[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0x12c'),_0xdf1189['toUpperCase']()),_0x199ed1[_0xdf1189]);}}if(_['isNil'](_0x199ed1['message'])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x12d'));}else{this[_0xe307('0x46')](_0x199ed1[_0xe307('0x82')],_0xe307('0xfd'));return this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x12e'),_0x199ed1[_0xe307('0x82')]));}}return this[_0xe307('0xf')][_0xe307('0x35')](_0x3881f6,_0xe307('0x12f'));};AGIVertices[_0xe307('0x12')]['googleasr']=function(_0x17b5a9){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x17b5a9[_0xe307('0x3b')],_0x17b5a9[_0xe307('0x71')]));if(!this[_0xe307('0x8d')](_0x17b5a9[_0xe307('0x86')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x130'));}var _0x5e4dfc='wav';var _0x5a3c72=util[_0xe307('0x2d')](_0xe307('0x131'),FILES_PATH,rs[_0xe307('0x11c')](0x4));var _0x3da439=util[_0xe307('0x2d')](_0xe307('0xa8'),_0x5a3c72,_0x5e4dfc);var _0x45ae68=!![];if(_0x17b5a9[_0xe307('0x132')]==='NOBEEP'){_0x45ae68=![];}var _0x1e0917=this[_0xe307('0xf')][_0xe307('0x133')](_0x5a3c72,_0x5e4dfc,_0x17b5a9['intKey'],_0x17b5a9[_0xe307('0x71')],undefined,_0x45ae68);if(_0x1e0917[_0xe307('0xb0')]!==-0x1){this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')](_0xe307('0x134'),_0x3da439));var _0x2f9070=this[_0xe307('0x98')][_0xe307('0x7c')](this,_0x17b5a9,_0x3da439);if(_0x2f9070){for(var _0x1c10d6 in _0x2f9070){if(_0x2f9070[_0xe307('0x9f')](_0x1c10d6)){this[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0x135'),_0x1c10d6['toUpperCase']()),_0x2f9070[_0x1c10d6]);}}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x136'),JSON['stringify'](_0x2f9070)));}}return _0x1e0917;};AGIVertices[_0xe307('0x12')][_0xe307('0x137')]=function(_0x388031){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x138'),_0x388031[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x388031[_0xe307('0x9b')])){return this[_0xe307('0xf')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x388031['appsecret'])){return this['channel'][_0xe307('0xb8')](_0xe307('0x139'));}var _0x213490=_0xe307('0x13a');var _0x4c36f7=util[_0xe307('0x2d')](_0xe307('0x131'),FILES_PATH,rs[_0xe307('0x11c')](0x4));var _0x13f150=util[_0xe307('0x2d')](_0xe307('0xa8'),_0x4c36f7,_0x213490);var _0x205513=!![];if(_0x388031[_0xe307('0x132')]===_0xe307('0x13b')){_0x205513=![];}var _0x114a28=this['channel'][_0xe307('0x133')](_0x4c36f7,_0x213490,_0x388031['intKey'],_0x388031['timeout'],undefined,_0x205513);if(_0x114a28[_0xe307('0xb0')]!==-0x1){this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x13c'),_0x13f150));var _0x4eff16=this[_0xe307('0x9a')][_0xe307('0x7c')](this,_0x388031,_0x13f150);if(_0x4eff16){for(var _0x50af23 in _0x4eff16){if(_0x4eff16[_0xe307('0x9f')](_0x50af23)){this[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0x13d'),_0x50af23['toUpperCase']()),_0x4eff16[_0x50af23]);}}return this[_0xe307('0xf')][_0xe307('0xb8')](util['format'](_0xe307('0x13e'),JSON['stringify'](_0x4eff16)));}}return _0x114a28;};AGIVertices[_0xe307('0x12')][_0xe307('0x13f')]=function(_0x17b3f2){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x17b3f2[_0xe307('0x3b')]));return this['channel']['continueAt'](_0x17b3f2['context'],_0x17b3f2[_0xe307('0x140')],_0x17b3f2[_0xe307('0x42')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x141')]=function(_0x2d552b){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x142'),_0x2d552b['label']));if(!this[_0xe307('0x8d')](_0x2d552b[_0xe307('0x143')])){return this['channel']['error'](_0x2d552b,_0xe307('0x144'));}try{var _0xc1391f=eval(_0x2d552b[_0xe307('0x143')])?_0xe307('0x145'):_0xe307('0x146');this['channel'][_0xe307('0xb8')](util['format'](_0xe307('0x147'),_0x2d552b[_0xe307('0x143')],_0xc1391f));return{'code':0xc8,'result':_0xc1391f};}catch(_0x1d4536){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xe307('0x12')][_0xe307('0x148')]=function(_0x3cd8c6){logger[_0xe307('0x31')](util['format'](_0xe307('0x149'),_0x3cd8c6['label']));if(!this['isConfigured'](_0x3cd8c6[_0xe307('0x14a')])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x3cd8c6,_0xe307('0x14b'));}var _0x2ac3ed=this['getIntervals'][_0xe307('0x7c')](this,_0x3cd8c6['interval_id']);if(!_0x2ac3ed){return this[_0xe307('0xf')]['error'](_0x3cd8c6,_0xe307('0x14c'));}for(var _0x1e89ba=0x0;_0x1e89ba<_0x2ac3ed[_0xe307('0xa6')];_0x1e89ba+=0x1){var _0x4214ba=this['channel'][_0xe307('0x13')](util[_0xe307('0x2d')](_0xe307('0x14d'),_0x2ac3ed[_0x1e89ba]));if(_0x4214ba[_0xe307('0xb0')]===-0x1){return _0x4214ba;}logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x14e'),_0x2ac3ed[_0x1e89ba],_0x4214ba[_0xe307('0xae')]));if(_0x4214ba[_0xe307('0xae')]===_0xe307('0x145')){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('IFTIME\x20%s\x20%s',_0x2ac3ed[_0x1e89ba],_0xe307('0x145')));this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x14e'),_0x2ac3ed[_0x1e89ba],_0xe307('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x14e'),_0x2ac3ed[_0x1e89ba],_0xe307('0x146')));this[_0xe307('0xf')]['noop'](util['format'](_0xe307('0x14e'),_0x2ac3ed[_0x1e89ba],_0xe307('0x146')));}}return{'code':0xc8,'result':_0xe307('0x146')};};AGIVertices[_0xe307('0x12')][_0xe307('0x14f')]=function(_0x504b33){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x150'),_0x504b33[_0xe307('0x3b')]));return this[_0xe307('0xf')][_0xe307('0x14f')]();};AGIVertices['prototype'][_0xe307('0x151')]=function(_0x34f35b){logger[_0xe307('0x31')](util['format'](_0xe307('0x152'),_0x34f35b[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x34f35b['key'])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x130'));}var _0x410f54=_0xe307('0x13a');var _0x24fed3=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x542f45=util[_0xe307('0x2d')](_0xe307('0xa8'),_0x24fed3,_0x410f54);var _0x3b3c21=!![];if(_0x34f35b[_0xe307('0x132')]===_0xe307('0x13b')){_0x3b3c21=![];}var _0x5f39d9=this[_0xe307('0xf')][_0xe307('0x133')](_0x24fed3,_0x410f54,_0x34f35b[_0xe307('0x153')],_0x34f35b['timeout'],undefined,_0x3b3c21);if(_0x5f39d9[_0xe307('0xb0')]!==-0x1){this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x154'),_0x542f45));var _0x516569=this[_0xe307('0x8b')][_0xe307('0x7c')](this,_0x34f35b,_0x542f45);if(_0x516569){for(var _0x2da321 in _0x516569){if(_0x516569['hasOwnProperty'](_0x2da321)){this['channel'][_0xe307('0xa9')](util[_0xe307('0x2d')]('ISPEECH_ASR_%s',_0x2da321[_0xe307('0x75')]()),_0x516569[_0x2da321]);}}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0xe307('0x7e')](_0x516569)));}}return _0x5f39d9;};AGIVertices[_0xe307('0x12')][_0xe307('0x155')]=function(_0x11a373){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x156'),_0x11a373[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x11a373[_0xe307('0x86')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20key\x20configured');}if(!this[_0xe307('0x8d')](_0x11a373['text'])){return this['channel']['noop'](_0xe307('0xd6'));}this[_0xe307('0xf')][_0xe307('0xb8')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x11a373[_0xe307('0x64')]));var _0x47b012=this[_0xe307('0x89')][_0xe307('0x7c')](this,_0x11a373);if(_0x47b012){this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')]('ispeech\x20%s\x20file\x20created',_0x47b012));var _0x5d47b5=this['channel']['streamFile'](_0x47b012,_0x11a373[_0xe307('0x153')]);try{fs[_0xe307('0x107')](_0x47b012+_0xe307('0x157'));}catch(_0x57d0c4){logger[_0xe307('0x35')](_0x57d0c4);}return _0x5d47b5;}return this[_0xe307('0xf')]['error'](_0x11a373,_0xe307('0x158'));};AGIVertices[_0xe307('0x12')][_0xe307('0x159')]=function(_0x81db2f){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15a'),_0x81db2f[_0xe307('0x3b')]));if(!this['isConfigured'](_0x81db2f['findBy'])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x81db2f,_0xe307('0x15b'));}logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15c'),this[_0xe307('0xf')]['callerid'],_0x81db2f['findBy']));var _0x7ba9a1=this[_0xe307('0x5d')][_0xe307('0x7c')](this,_0x81db2f[_0xe307('0x15d')]);if(_0x7ba9a1){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15e'),this[_0xe307('0xf')][_0xe307('0x3e')],_0x81db2f[_0xe307('0x15d')]));this['channel']['noop'](util[_0xe307('0x2d')](_0xe307('0x15e'),this['channel'][_0xe307('0x3e')],_0x81db2f['findBy']));return{'code':0xc8,'result':_0xe307('0x15f')};}else{logger[_0xe307('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe307('0xf')]['callerid'],_0x81db2f[_0xe307('0x15d')]));this['channel'][_0xe307('0xb8')](util['format'](_0xe307('0x160'),this[_0xe307('0xf')][_0xe307('0x3e')],_0x81db2f[_0xe307('0x15d')]));return{'code':0xc8,'result':_0xe307('0x161')};}};AGIVertices[_0xe307('0x12')][_0xe307('0x162')]=function(_0x16d7c8){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x163'),_0x16d7c8[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x16d7c8[_0xe307('0x15d')])){return this[_0xe307('0xf')]['error'](_0x16d7c8,'no\x20find\x20by\x20configured');}logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15c'),this[_0xe307('0xf')][_0xe307('0x3e')],_0x16d7c8[_0xe307('0x15d')]));var _0x1a25ab=this[_0xe307('0x5c')]['sync'](this,_0x16d7c8[_0xe307('0x15d')]);if(_0x1a25ab){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15e'),this['channel'][_0xe307('0x3e')],_0x16d7c8[_0xe307('0x15d')]));this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x15e'),this['channel'][_0xe307('0x3e')],_0x16d7c8[_0xe307('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x160'),this[_0xe307('0xf')][_0xe307('0x3e')],_0x16d7c8[_0xe307('0x15d')]));this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x160'),this['channel'][_0xe307('0x3e')],_0x16d7c8['findBy']));return{'code':0xc8,'result':_0xe307('0x161')};}};AGIVertices['prototype'][_0xe307('0x164')]=function(_0x25fc77){logger[_0xe307('0x31')](util['format'](_0xe307('0x165'),_0x25fc77['label']));if(!this[_0xe307('0x8d')](_0x25fc77[_0xe307('0x166')])){return this[_0xe307('0xf')]['error'](_0x25fc77,_0xe307('0x167'));}this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('math\x20%s',_0x25fc77[_0xe307('0x166')]));var _0x4e1803=eval(_0x25fc77[_0xe307('0x166')]);if(!this[_0xe307('0x8d')](_0x25fc77[_0xe307('0xe8')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xe9'));}var _0x169923=this['getVariable']['sync'](this,_0x25fc77[_0xe307('0xe8')]);if(!_0x169923){return this[_0xe307('0xf')][_0xe307('0x35')](_0x25fc77,_0xe307('0xea'));}if(_[_0xe307('0xa5')](_0x4e1803)){var _0x2c1e0c=this;_0x4e1803[_0xe307('0xec')](function(_0x428f5f,_0x5e40e6){_0x2c1e0c[_0xe307('0xf')]['setVariable'](util[_0xe307('0x2d')]('%s[%s]',_0x169923,_0x5e40e6),_0x428f5f);});return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x168'),_0x169923));}else{return this[_0xe307('0xf')][_0xe307('0xa9')](_0x169923,_0x4e1803);}};AGIVertices[_0xe307('0x12')]['menu']=function(_0x559327){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x169'),_0x559327[_0xe307('0x3b')]));if(_0x559327[_0xe307('0xb3')]===0x0){return this[_0xe307('0xb2')](_0x559327);}_0x559327[_0xe307('0xb3')]-=0x1;if(!this[_0xe307('0x8d')](_0x559327[_0xe307('0x114')])){return this['channel'][_0xe307('0x35')](_0x559327,_0xe307('0x113'));}var _0x11b07b=this[_0xe307('0x22')][_0xe307('0x7c')](this,_0x559327[_0xe307('0x114')]);if(!_0x11b07b){return this[_0xe307('0xf')][_0xe307('0x35')](_0x559327,'no\x20file\x20audio\x20found');}var _0x13414b=this[_0xe307('0xf')][_0xe307('0x116')](_0x11b07b,_0x559327[_0xe307('0x117')],_0x559327[_0xe307('0x16a')]);var _0x49c132=_0x13414b[_0xe307('0xb0')];if(_0x13414b[_0xe307('0xb0')]===-0x1){this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x559327,'-1');return _0x13414b;}else if(_0x13414b[_0xe307('0xae')]===_0xe307('0x71')){_0x13414b[_0xe307('0xb0')]=_0x13414b[_0xe307('0xb0')]['length']>0x0?_0x13414b[_0xe307('0xb0')]:'t';}else if(_[_0xe307('0x4c')](_0x13414b[_0xe307('0xb0')])){_0x13414b['result']='#';_0x49c132='#';}if(!this[_0xe307('0x8d')](_0x559327['variable_id'])){this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x133b66=this['getVariable']['sync'](this,_0x559327[_0xe307('0xe8')]);if(!_0x133b66){return this[_0xe307('0xf')]['error'](_0x559327,_0xe307('0xea'));}this[_0xe307('0xf')]['setVariable'](_0x133b66,_0x49c132);}this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x559327,_0x49c132);return _0x13414b;};AGIVertices['prototype']['noop']=function(_0x46f269){logger[_0xe307('0x31')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x46f269[_0xe307('0x3b')]));return this[_0xe307('0xf')][_0xe307('0xb8')](_0x46f269[_0xe307('0x16b')]||_0x46f269[_0xe307('0x3b')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x16c')]=function(_0x9d6026){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x16d'),_0x9d6026[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x9d6026[_0xe307('0x15d')])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x9d6026,_0xe307('0x15b'));}logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15c'),this[_0xe307('0xf')][_0xe307('0x3e')],_0x9d6026[_0xe307('0x15d')]));var _0x296677=this['getPause'][_0xe307('0x7c')](this,_0x9d6026[_0xe307('0x16e')]);var _0x39c2f1=this[_0xe307('0x59')]['sync'](this,_0x9d6026[_0xe307('0x15d')],_0x296677);if(_0x39c2f1){logger[_0xe307('0x31')](util['format'](_0xe307('0x15e'),this['channel'][_0xe307('0x3e')],_0x9d6026[_0xe307('0x15d')]));this['channel']['noop'](util[_0xe307('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe307('0xf')]['callerid'],_0x9d6026[_0xe307('0x15d')]));return{'code':0xc8,'result':_0xe307('0x15f')};}else{logger[_0xe307('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x9d6026[_0xe307('0x15d')]));this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x9d6026['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['playback']=function(_0x182daa){logger[_0xe307('0x31')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x182daa[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x182daa[_0xe307('0x114')])){return this[_0xe307('0xf')]['error'](_0x182daa,_0xe307('0x113'));}var _0x54916e=this['getSound'][_0xe307('0x7c')](this,_0x182daa[_0xe307('0x114')]);if(!_0x54916e){return this[_0xe307('0xf')][_0xe307('0x35')](_0x182daa,_0xe307('0x115'));}var _0x4ace14=this['channel'][_0xe307('0xb6')](_0xe307('0x16f'),[_0x54916e,_0x182daa[_0xe307('0xf6')]]);if(_0x4ace14[_0xe307('0xb0')]===-0x1){return _0x4ace14;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xd4'),_0xe307('0x16f'),_0x54916e));};AGIVertices[_0xe307('0x12')]['queue']=function(_0x4a0f05){logger[_0xe307('0x31')](util['format'](_0xe307('0x170'),_0x4a0f05[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x4a0f05[_0xe307('0x171')])){return this['channel'][_0xe307('0x35')](_0x4a0f05,_0xe307('0x172'));}var _0x465cff='';var _0x4dc3d8=parseInt(_0x4a0f05[_0xe307('0x171')],0xa);if(isNaN(_0x4dc3d8)){_0x465cff=_0x4a0f05[_0xe307('0x171')];}else{_0x465cff=this[_0xe307('0x18')]['sync'](this,_0x4a0f05[_0xe307('0x171')]);if(!_0x465cff){return this[_0xe307('0xf')]['error'](_0x4a0f05,_0xe307('0x173'));}}var _0x12e056='';if(this['isConfigured'](_0x4a0f05[_0xe307('0x114')])){var _0x39a040=this[_0xe307('0x22')][_0xe307('0x7c')](this,_0x4a0f05[_0xe307('0x114')]);if(_0x39a040){_0x12e056=_0x39a040;}}this[_0xe307('0x39')]['sync'](this,_0x4a0f05,_0x465cff);if(_0x4a0f05['opts'][_0xe307('0x174')]('x')<0x0){_0x4a0f05[_0xe307('0xf6')]+='x';}if(_0x4a0f05[_0xe307('0xf6')][_0xe307('0x174')]('X')<0x0){_0x4a0f05[_0xe307('0xf6')]+='X';}this['channel'][_0xe307('0xa9')](_0xe307('0x175'),_0x465cff?_0x465cff[_0xe307('0x176')]():'');var _0x21ea9a=this[_0xe307('0xf')]['exec'](_0xe307('0x177'),[_0x465cff,_0x4a0f05[_0xe307('0xf6')],_0x4a0f05[_0xe307('0x6e')],_0x12e056,_0x4a0f05['timeout'],_0x4a0f05[_0xe307('0xc5')],_0x4a0f05[_0xe307('0x178')],_0x4a0f05[_0xe307('0x179')],'',_0x4a0f05[_0xe307('0x17a')]]);if(_0x21ea9a[_0xe307('0xb0')]===-0x1){return _0x21ea9a;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Executed\x20command\x20%s\x20%s',_0xe307('0x177'),_0x465cff));};AGIVertices[_0xe307('0x12')][_0xe307('0x17b')]=function(_0x37083a){logger[_0xe307('0x31')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x37083a[_0xe307('0x3b')]));var _0x4deb2a=_0x37083a[_0xe307('0x17c')]||'wav';var _0x267aaa=util['format'](_0xe307('0x17d'),this[_0xe307('0xf')][_0xe307('0x3a')],rs['generate'](0x5));var _0x3b7b37=util['format'](_0xe307('0x17e'),FILES_PATH,_0x267aaa,_0x4deb2a);var _0x3daa44=util[_0xe307('0x2d')]('%s/recordings/%s',FILES_PATH,_0x267aaa);this[_0xe307('0x3f')][_0xe307('0x7c')](this,_0x37083a,_0x267aaa,_0x3b7b37);this[_0xe307('0xf')][_0xe307('0xa9')](_0xe307('0x17f'),_0x267aaa);logger[_0xe307('0x31')](_0xe307('0x180'),_0x3daa44,_0x4deb2a,_0x37083a['escape_digits'],_0x37083a[_0xe307('0x71')]);return this[_0xe307('0xf')]['recordFile'](_0x3daa44,_0x4deb2a,_0x37083a[_0xe307('0x181')],_0x37083a[_0xe307('0x71')],undefined,!![]);};AGIVertices[_0xe307('0x12')][_0xe307('0x182')]=function(_0x2e80e2){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2e80e2[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x2e80e2[_0xe307('0x6e')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20url\x20configured');}var _0x55437b=this[_0xe307('0x6d')]['sync'](this,_0x2e80e2);logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Response:',util[_0xe307('0x183')](_0x55437b,{'showHidden':![],'depth':null})));if(!this[_0xe307('0x8d')](_0x2e80e2[_0xe307('0xe8')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x416a87=this[_0xe307('0x13')][_0xe307('0x7c')](this,_0x2e80e2[_0xe307('0xe8')]);if(!_0x416a87){return this['channel'][_0xe307('0x35')](_0x2e80e2,'no\x20variable\x20found');}this[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0x184'),_0x416a87),_0x55437b[_0xe307('0x80')]?_0x55437b[_0xe307('0x80')]:'200');this[_0xe307('0xf')][_0xe307('0xa9')](util[_0xe307('0x2d')](_0xe307('0x185'),_0x416a87),_0x55437b[_0xe307('0x81')]?_0x55437b[_0xe307('0x81')]:'OK');if(_0x55437b[_0xe307('0x76')]){try{this['saveRestApiResult'](_0x55437b[_0xe307('0x76')],_0x416a87);}catch(_0x2e851c){logger['error'](util['format'](_0xe307('0x186'),_0x416a87));}}return this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')](_0xe307('0xef'),_0x416a87));};AGIVertices[_0xe307('0x12')][_0xe307('0x187')]=function(_0x4234e0){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x188'),_0x4234e0['label']));return this[_0xe307('0xf')][_0xe307('0x189')](_0x4234e0[_0xe307('0x18a')][_0xe307('0x60')](/\s+/g,''),_0x4234e0['escape_digits']);};AGIVertices[_0xe307('0x12')][_0xe307('0x18b')]=function(_0x274798){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x18c'),_0x274798[_0xe307('0x3b')]));return this['channel'][_0xe307('0x18d')](_0x274798[_0xe307('0x70')][_0xe307('0x60')](/\s+/g,''),_0x274798[_0xe307('0x181')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x18e')]=function(_0x2d0b83){logger['info'](util[_0xe307('0x2d')](_0xe307('0x18f'),_0x2d0b83[_0xe307('0x3b')]));return this[_0xe307('0xf')][_0xe307('0x190')](_0x2d0b83[_0xe307('0x64')],_0x2d0b83[_0xe307('0x181')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x191')]=function(_0x17a712){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x192'),_0x17a712[_0xe307('0x3b')]));if(!this['isConfigured'](_0x17a712[_0xe307('0x193')])){return this[_0xe307('0xf')][_0xe307('0xb8')]('no\x20mail\x20account\x20configured');}var _0x176c06=this[_0xe307('0x194')][_0xe307('0x7c')](this,_0x17a712[_0xe307('0x193')]);if(!_0x176c06||!_0x176c06[_0xe307('0x195')]){return this['channel'][_0xe307('0x35')](_0x17a712,'no\x20mail\x20account\x20found');}var _0x23a8fe={'from':util[_0xe307('0x2d')]('\x22%s\x22\x20<%s>',_0x176c06[_0xe307('0x16')],_0x176c06[_0xe307('0x196')]||_0x176c06['Smtp'][_0xe307('0x197')]),'to':_0x17a712['to']||'','cc':_0x17a712['cc']||'','bcc':_0x17a712[_0xe307('0x198')]||'','subject':_0x17a712['subject'],'html':_0x17a712[_0xe307('0x64')],'text':_0x17a712[_0xe307('0x64')]};var _0x2d060d={'tls':{'rejectUnauthorized':![]}};if(_0x176c06[_0xe307('0x195')][_0xe307('0x199')]){_0x2d060d[_0xe307('0x199')]=_0x176c06['Smtp'][_0xe307('0x199')];}else{_0x2d060d[_0xe307('0x19a')]=_0x176c06[_0xe307('0x195')][_0xe307('0x19a')];_0x2d060d[_0xe307('0x19b')]=_0x176c06[_0xe307('0x195')][_0xe307('0x19b')];_0x2d060d[_0xe307('0x19c')]=_0x176c06['Smtp'][_0xe307('0x19c')];}if(_0x176c06[_0xe307('0x195')]['authentication']){_0x2d060d['auth']={'user':_0x176c06[_0xe307('0x195')]['user'],'pass':_0x176c06[_0xe307('0x195')][_0xe307('0x19d')]};}if(this[_0xe307('0x8d')](_0x17a712['template_id'])){}logger[_0xe307('0xf1')](_0xe307('0x19e'),JSON[_0xe307('0x7e')](_0x23a8fe));this[_0xe307('0x39')]['sync'](this,_0x17a712,_0x17a712[_0xe307('0x193')]);this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')](_0xe307('0x19f'),_0x176c06[_0xe307('0x16')]));this[_0xe307('0x26')][_0xe307('0x7c')](this,_0x2d060d,_0x23a8fe);return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x1a0'));};AGIVertices[_0xe307('0x12')][_0xe307('0x1a1')]=function(_0x5f3158){logger[_0xe307('0x31')](util['format'](_0xe307('0x1a2'),_0x5f3158[_0xe307('0x3b')]));return this['channel']['noop'](_0xe307('0x1a3'));};AGIVertices[_0xe307('0x12')]['sendSMS']=function(_0x352fde){logger['info'](util[_0xe307('0x2d')](_0xe307('0x1a4'),_0x352fde[_0xe307('0x3b')]));if(!this['isConfigured'](_0x352fde[_0xe307('0x1a5')])){return this['channel'][_0xe307('0xb8')](_0xe307('0x1a6'));}var _0x7e0460=this[_0xe307('0x37')][_0xe307('0x7c')](this,_0x352fde['sms_account_id']);if(!_0x7e0460){return this[_0xe307('0xf')][_0xe307('0x35')](_0x352fde,'no\x20sms\x20account\x20found');}var _0x3d5584={'body':_0x352fde['sms_text'],'phone':_0x352fde['to']||'','SmsAccountId':_0x7e0460['id']};logger[_0xe307('0xf1')](_0xe307('0x1a7'),JSON[_0xe307('0x7e')](_0x3d5584));this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x352fde,_0x352fde[_0xe307('0x1a5')]);this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x1a8'),_0x7e0460[_0xe307('0x16')]));this[_0xe307('0x1a9')][_0xe307('0x7c')](this,_0x3d5584);return this[_0xe307('0xf')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xe307('0x12')][_0xe307('0x1aa')]=function(_0x508ad8){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x1ab'),_0x508ad8[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x508ad8[_0xe307('0xe8')])){return this[_0xe307('0xf')][_0xe307('0x35')](_0x508ad8,_0xe307('0x1ac'));}var _0x1f2590=this[_0xe307('0x13')][_0xe307('0x7c')](this,_0x508ad8['variable_id']);if(!_0x1f2590){return this['channel'][_0xe307('0x35')](_0x508ad8,'no\x20variable\x20found');}return this[_0xe307('0xf')]['setVariable'](_0x1f2590,_0x508ad8[_0xe307('0x1ad')]);};AGIVertices[_0xe307('0x12')][_0xe307('0x1ae')]=function(_0x31a2d8){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x31a2d8[_0xe307('0x3b')]));this['channel'][_0xe307('0xb8')](_0xe307('0x1af'));if(_0x31a2d8[_0xe307('0xca')]===_0xe307('0x1b0')){this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0x1b1'));return this[_0xe307('0xf')][_0xe307('0xca')]();}return this['channel'][_0xe307('0xb8')](_0xe307('0x1b2'));};AGIVertices['prototype'][_0xe307('0x1b3')]=function(_0x666a97){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x1b4'),_0x666a97[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0x666a97[_0xe307('0x1b5')])){return this[_0xe307('0xf')]['error'](_0x666a97,'no\x20subproject\x20selected');}var _0x2b5365=this[_0xe307('0x1a')][_0xe307('0x7c')](this,_0x666a97[_0xe307('0x1b5')]);if(!this[_0xe307('0x8d')](_0x2b5365)){return this[_0xe307('0xf')][_0xe307('0x35')](_0x666a97,util[_0xe307('0x2d')](_0xe307('0x1b6'),_0x666a97[_0xe307('0x1b5')]));}if(_0x2b5365===this[_0xe307('0xf')]['arg_1']){return this[_0xe307('0xf')][_0xe307('0x35')](_0x666a97,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x666a97,_0x2b5365);var _0x418daf=this['channel'][_0xe307('0xb6')](_0xe307('0x1b7'),util[_0xe307('0x2d')](_0xe307('0x1b8'),config[_0xe307('0xc5')]['host']||_0xe307('0x1b9'),_0x2b5365,this['channel'][_0xe307('0x3d')]));if(_0x418daf[_0xe307('0xb0')]===-0x1){return _0x418daf;}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0xd4'),'AGI',_0x2b5365));};AGIVertices[_0xe307('0x12')][_0xe307('0x1ba')]=function(_0x3844cc){logger[_0xe307('0x31')](util[_0xe307('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3844cc['label']));var _0x1282ff=this[_0xe307('0x1bb')]['sync'](this,_0x3844cc[_0xe307('0x1bc')]);this[_0xe307('0x39')][_0xe307('0x7c')](this,_0x3844cc,_0x3844cc[_0xe307('0x1bc')]);if(this['isConfigured'](_0x3844cc[_0xe307('0xe8')])){var _0x42fae6=this[_0xe307('0x13')][_0xe307('0x7c')](this,_0x3844cc[_0xe307('0xe8')]);if(_0x42fae6){this[_0xe307('0xf')][_0xe307('0xa9')](_0x42fae6,_0x1282ff);return this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')](_0xe307('0x1bd'),_0x3844cc['command'],_0x42fae6));}}return this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x1be'),_0x3844cc[_0xe307('0x1bc')]));};AGIVertices[_0xe307('0x12')][_0xe307('0x1bf')]=function(_0x4cc2ba){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4cc2ba['label']));_0x4cc2ba[_0xe307('0x64')]=_0x4cc2ba[_0xe307('0x64')][_0xe307('0x60')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe307('0x8d')](_0x4cc2ba['apiKey'])){return this['channel']['noop'](_0xe307('0x1c0'));}if(!this[_0xe307('0x8d')](_0x4cc2ba[_0xe307('0x64')])){return this[_0xe307('0xf')][_0xe307('0xb8')](_0xe307('0xd6'));}this['channel'][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x1c1'),_0x4cc2ba['text']));var _0x30b4ab=this[_0xe307('0x61')][_0xe307('0x7c')](this,_0x4cc2ba);if(_0x30b4ab){this['channel']['noop'](util[_0xe307('0x2d')](_0xe307('0x1c2'),_0x30b4ab));var _0x112631=this[_0xe307('0xf')][_0xe307('0x125')](_0x30b4ab);try{fs[_0xe307('0x107')](_0x30b4ab+_0xe307('0x157'));}catch(_0x4cc721){logger[_0xe307('0x35')](_0x4cc721);}return _0x112631;}return this[_0xe307('0xf')][_0xe307('0x35')](_0x4cc2ba,_0xe307('0x1c3'));};AGIVertices[_0xe307('0x12')][_0xe307('0x1c4')]=function(_0x4d62af){logger[_0xe307('0x31')](util['format'](_0xe307('0x1c5'),_0x4d62af[_0xe307('0x3b')]));_0x4d62af[_0xe307('0x64')]=_0x4d62af[_0xe307('0x64')][_0xe307('0x60')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4d62af[_0xe307('0x64')])){return this['channel'][_0xe307('0xb8')]('no\x20text\x20configured');}this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')](_0xe307('0x1c6'),_0x4d62af[_0xe307('0x64')]));var _0xc484cf=this[_0xe307('0x6b')]['sync'](this,_0x4d62af);if(_0xc484cf){this[_0xe307('0xf')][_0xe307('0xb8')](util[_0xe307('0x2d')]('Google\x20TTS\x20%s\x20file\x20created',_0xc484cf));var _0x1c028d=this[_0xe307('0xf')]['streamFile'](_0xc484cf);try{fs[_0xe307('0x107')](_0xc484cf+'.wav');}catch(_0x371713){logger[_0xe307('0x35')](_0x371713);}return _0x1c028d;}return this[_0xe307('0xf')]['error'](_0x4d62af,_0xe307('0x1c7'));};AGIVertices[_0xe307('0x12')][_0xe307('0x1c8')]=function(_0xe070fe){logger[_0xe307('0x31')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xe070fe[_0xe307('0x3b')]));if(!this[_0xe307('0x8d')](_0xe070fe['findBy'])){return this['channel'][_0xe307('0x35')](_0xe070fe,_0xe307('0x15b'));}logger['info'](util[_0xe307('0x2d')](_0xe307('0x15c'),this['channel'][_0xe307('0x3e')],_0xe070fe['findBy']));var _0x11e73c=this[_0xe307('0x5a')][_0xe307('0x7c')](this,_0xe070fe['findBy']);if(_0x11e73c){logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x15e'),this['channel'][_0xe307('0x3e')],_0xe070fe[_0xe307('0x15d')]));this[_0xe307('0xf')]['noop'](util[_0xe307('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe307('0xf')][_0xe307('0x3e')],_0xe070fe[_0xe307('0x15d')]));return{'code':0xc8,'result':_0xe307('0x15f')};}else{logger[_0xe307('0x31')](util[_0xe307('0x2d')](_0xe307('0x160'),this[_0xe307('0xf')][_0xe307('0x3e')],_0xe070fe['findBy']));this[_0xe307('0xf')][_0xe307('0xb8')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe307('0xf')][_0xe307('0x3e')],_0xe070fe[_0xe307('0x15d')]));return{'code':0xc8,'result':_0xe307('0x161')};}};AGIVertices[_0xe307('0x12')][_0xe307('0x1c9')]=function(_0x1efdd7){logger['info'](util[_0xe307('0x2d')](_0xe307('0x1ca'),_0x1efdd7[_0xe307('0x3b')]));var _0x1f3798=this['channel'][_0xe307('0xb6')]('VOICEMAIL',[_0x1efdd7['mailbox'],_0x1efdd7[_0xe307('0x84')]]);if(_0x1f3798['result']===-0x1){return _0x1f3798;}return this[_0xe307('0xf')][_0xe307('0xb8')](util['format']('Executed\x20command\x20%s\x20%s',_0xe307('0x1cb'),_0x1efdd7[_0xe307('0x1cc')]));};AGIVertices[_0xe307('0x12')]['vswitch']=function(_0x1950f6){logger['info'](util[_0xe307('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1950f6[_0xe307('0x3b')]));if(!this['isConfigured'](_0x1950f6[_0xe307('0xe8')])){return this['channel'][_0xe307('0x35')](_0x1950f6,_0xe307('0x1ac'));}var _0x2cd01b=this[_0xe307('0x13')][_0xe307('0x7c')](this,_0x1950f6[_0xe307('0xe8')]);if(!_0x2cd01b){return this['channel'][_0xe307('0x35')](_0x1950f6,'no\x20variable\x20found');}var _0x2aa128=this['channel'][_0xe307('0x13')](_0x2cd01b);return{'code':0xc8,'result':_0x2aa128[_0xe307('0xae')]?_0x2aa128[_0xe307('0xae')]:'-'};};String[_0xe307('0x12')][_0xe307('0xad')]=function(_0x4ef033,_0x2fe23e){return this[_0xe307('0xab')](_0x4ef033)[_0xe307('0x1cd')](_0x2fe23e);};module[_0xe307('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x12c9=['odbc','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','getVariable','rpc','then','name','catch','getVoiceQueue','prototype','getSquareProject','getSquareOdbc','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','log','in\x20createcmcontact','has','isNil','VALUE\x20TZ','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','RETVALRPC','TZ\x20found\x20in\x20shared:','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isString','replaceAllVariables','saveRestApiResult','%s.%s','isArray','length','setVariable','split','nextbracket','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','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','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','context','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','service','host','port','secure','authentication','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','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','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','unpause','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','path','util','lodash','shelljs'];(function(_0x2169ce,_0x5268b0){var _0x74dda=function(_0x15beba){while(--_0x15beba){_0x2169ce['push'](_0x2169ce['shift']());}};_0x74dda(++_0x5268b0);}(_0x12c9,0x1c9));var _0x912c=function(_0x162a24,_0x58094c){_0x162a24=_0x162a24-0x0;var _0x3cc79b=_0x12c9[_0x162a24];return _0x3cc79b;};'use strict';var fs=require('fs');var path=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var _=require(_0x912c('0x2'));var sh=require(_0x912c('0x3'));var odbc=require(_0x912c('0x4'))();var rs=require('randomstring');var moment=require(_0x912c('0x5'));var Mustache=require(_0x912c('0x6'));var rp=require(_0x912c('0x7'));var logger=require(_0x912c('0x8'))(_0x912c('0x9'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0x912c('0xa'));var FILES_PATH=_0x912c('0xb');var recursiveMapAttributes=[_0x912c('0xc'),_0x912c('0xd')];var verticesWithRetry=[_0x912c('0xe'),'getdigits',_0x912c('0xf')];var AGIVertices=function(_0x54da06,_0x1c074a,_0x56f7ba){this[_0x912c('0x10')]=_0x54da06;this['rpc']=_0x1c074a;this[_0x912c('0x11')]=_0x56f7ba;};AGIVertices['prototype'][_0x912c('0x12')]=function(_0x4f16b0,_0x52bbf3){this[_0x912c('0x13')]['getVariableById'](_0x4f16b0)[_0x912c('0x14')](function(_0x401501){_0x52bbf3(null,_0x401501?_0x401501[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0x325880){_0x52bbf3(_0x325880);});};AGIVertices['prototype'][_0x912c('0x17')]=function(_0x5cc804,_0x28cdb4){this[_0x912c('0x13')]['getVoiceQueueById'](_0x5cc804)[_0x912c('0x14')](function(_0xc48e52){_0x28cdb4(null,_0xc48e52?_0xc48e52[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0xf102be){_0x28cdb4(_0xf102be);});};AGIVertices[_0x912c('0x18')][_0x912c('0x19')]=function(_0x124eae,_0x11bf1d){this[_0x912c('0x13')]['getSquareProjectById'](_0x124eae)[_0x912c('0x14')](function(_0x32fb2e){_0x11bf1d(null,_0x32fb2e?_0x32fb2e[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0xa18263){_0x11bf1d(_0xa18263);});};AGIVertices[_0x912c('0x18')][_0x912c('0x1a')]=function(_0x272010,_0x37f075){this['rpc']['getSquareOdbcById'](_0x272010)[_0x912c('0x14')](function(_0xbb397d){_0x37f075(null,_0xbb397d?_0xbb397d['dsn']:![]);})['catch'](function(_0x5f2577){_0x37f075(_0x5f2577);});};AGIVertices[_0x912c('0x18')][_0x912c('0x1b')]=function(_0x5adca9,_0x5afd32){this['rpc'][_0x912c('0x1c')](_0x5adca9)[_0x912c('0x14')](function(_0x4293f2){_0x5afd32(null,_0x4293f2?_0x4293f2[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0x11ea1c){_0x5afd32(_0x11ea1c);});};AGIVertices[_0x912c('0x18')]['getTrunk']=function(_0x18b398,_0x5c539d){this[_0x912c('0x13')][_0x912c('0x1d')](_0x18b398)[_0x912c('0x14')](function(_0x121865){_0x5c539d(null,_0x121865?_0x121865[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0x18a188){_0x5c539d(_0x18a188);});};AGIVertices[_0x912c('0x18')]['getSound']=function(_0x55d094,_0x302687){var _0x4ac07b=this;this[_0x912c('0x13')][_0x912c('0x1e')](_0x55d094)['then'](function(_0xefc100){_0x302687(null,_0xefc100?_0x4ac07b[_0x912c('0x1f')](_0xefc100[_0x912c('0x20')]):![]);})[_0x912c('0x16')](function(_0x4a3708){_0x302687(_0x4a3708);});};AGIVertices['prototype'][_0x912c('0x21')]=function(_0x4e1c38,_0x20b4ae){this[_0x912c('0x13')][_0x912c('0x22')](_0x4e1c38)[_0x912c('0x14')](function(_0x1b9a68){_0x20b4ae(null,_0x1b9a68?_0x1b9a68:![]);})['catch'](function(_0x41366f){_0x20b4ae(_0x41366f);});};AGIVertices[_0x912c('0x18')][_0x912c('0x23')]=function(_0x4d9e75,_0x2d9963,_0x5973ba){this['mailRpc']['sendMailMessage'](_0x4d9e75,_0x2d9963)[_0x912c('0x14')](function(){_0x5973ba(null);})['catch'](function(_0x464b30){_0x5973ba(_0x464b30);});};AGIVertices[_0x912c('0x18')]['getIntervals']=function(_0xcdb28e,_0x57779d){this[_0x912c('0x13')][_0x912c('0x24')](_0xcdb28e)[_0x912c('0x14')](function(_0x22c77e){if(_0x22c77e){if(_0x22c77e[_0x912c('0x25')]){_0x57779d(null,[_0x22c77e[_0x912c('0x26')]]);}else{_0x57779d(null,_['map'](_0x22c77e[_0x912c('0x27')],_0x912c('0x26')));}}else{_0x57779d(null,![]);}})[_0x912c('0x16')](function(_0x5c2c6c){_0x57779d(_0x5c2c6c);});};AGIVertices['prototype'][_0x912c('0x1f')]=function(_0xa2ac7f){return util[_0x912c('0x28')](_0x912c('0x29'),FILES_PATH,_0xa2ac7f);};AGIVertices[_0x912c('0x18')][_0x912c('0x2a')]=function(_0x354329,_0x579457,_0x561be0){odbc['open'](_0x354329,function(_0x182313){if(_0x182313){logger[_0x912c('0x2b')](_0x912c('0x2c'),_0x182313);_0x561be0(_0x182313);}else{logger[_0x912c('0x2d')](_0x912c('0x2e'));odbc[_0x912c('0x2f')](_0x579457,function(_0x9c3df2,_0x5c2554){if(_0x9c3df2){logger[_0x912c('0x2d')](_0x912c('0x30'),_0x579457);_0x561be0(_0x9c3df2);}else{logger[_0x912c('0x2d')]('Query\x20executed\x20correctly\x20%s',_0x579457);odbc['close'](function(_0xe98a7b){if(_0xe98a7b){logger[_0x912c('0x2b')](_0x912c('0x31'),_0xe98a7b);}_0x561be0(null,_0x5c2554);});}});}});};AGIVertices[_0x912c('0x18')][_0x912c('0x32')]=function(_0x26b45c,_0x31464f){this['rpc']['getSmsAccountById'](_0x26b45c)['then'](function(_0x1834d9){_0x31464f(null,_0x1834d9?_0x1834d9:![]);})[_0x912c('0x16')](function(_0x38dab2){_0x31464f(_0x38dab2);});};AGIVertices[_0x912c('0x18')][_0x912c('0x33')]=function(_0x17a692,_0xd1f9f9){this[_0x912c('0x13')][_0x912c('0x33')](_0x17a692)[_0x912c('0x14')](function(_0xa3d346){_0xd1f9f9(null,_0xa3d346);})[_0x912c('0x16')](function(_0x1b83c4){_0xd1f9f9(_0x1b83c4);});};AGIVertices[_0x912c('0x18')]['createSquareDetailsReport']=function(_0x1f0d7c,_0x1512ed,_0x186053){this[_0x912c('0x13')][_0x912c('0x34')]({'uniqueid':this[_0x912c('0x10')][_0x912c('0x35')],'node':_0x1f0d7c['label'],'application':_0x1f0d7c['agicommand'],'data':_0x1512ed||null,'project_name':this[_0x912c('0x10')]['arg_1'],'callerid':this[_0x912c('0x10')][_0x912c('0x36')]})[_0x912c('0x14')](function(_0x79a950){if(_0x186053){_0x186053(null,_0x79a950);}})[_0x912c('0x16')](function(_0x40d04b){if(_0x186053){_0x186053(_0x40d04b);}});};AGIVertices[_0x912c('0x18')][_0x912c('0x37')]=function(_0x534c3d,_0x4e009e,_0x380eb6,_0x393335){this[_0x912c('0x13')][_0x912c('0x37')]({'uniqueid':this[_0x912c('0x10')][_0x912c('0x35')],'callerid':this[_0x912c('0x10')]['callerid'],'calleridname':this[_0x912c('0x10')][_0x912c('0x38')],'context':this[_0x912c('0x10')]['context'],'extension':this['channel'][_0x912c('0x39')],'priority':this[_0x912c('0x10')][_0x912c('0x3a')],'accountcode':this[_0x912c('0x10')][_0x912c('0x3b')],'dnid':this[_0x912c('0x10')][_0x912c('0x3c')],'projectName':this['channel'][_0x912c('0x3d')],'saveName':_0x4e009e,'filename':_0x534c3d[_0x912c('0x3e')]||_0x4e009e,'savePath':_0x380eb6})[_0x912c('0x14')](function(_0x1ed4a5){_0x393335(null,_0x1ed4a5);})['catch'](function(_0x15248d){_0x393335(_0x15248d);});};AGIVertices['prototype'][_0x912c('0x3f')]=function(_0x557b31,_0x4a844f,_0x1d32af){this[_0x912c('0x13')]['createSquareMessage']({'uniqueid':this[_0x912c('0x10')][_0x912c('0x35')],'body':_0x557b31,'direction':_0x4a844f})['then'](function(_0x518892){if(_0x1d32af){_0x1d32af(null,_0x518892);}})[_0x912c('0x16')](function(_0x465572){if(_0x1d32af){_0x1d32af(_0x465572);}});};AGIVertices[_0x912c('0x18')]['createCmContact']=function(_0x410fe1,_0x2b14af){console[_0x912c('0x40')](_0x912c('0x41'),_0x410fe1);console[_0x912c('0x40')]('in\x20createcmcontact\x20callback',_0x2b14af);var _0xfc9754=0x0;if(_[_0x912c('0x42')](_0x410fe1,'dialTimezone')){if(!_[_0x912c('0x43')](_0x410fe1['dialTimezone'])){var _0xd7cdb5=_0x410fe1['dialTimezone'];console[_0x912c('0x40')](_0x912c('0x44'),_0xd7cdb5);if(_0x410fe1[_0x912c('0x45')]==_0x912c('0x46')){this[_0x912c('0x13')][_0x912c('0x47')]({'phone':_0x410fe1['phone']})[_0x912c('0x14')](function(_0x381e81){console['log'](_0x912c('0x48'),_0x381e81);_0x2b14af(null,_0x381e81);});}else{console['log'](_0x912c('0x49'),shared[_0xd7cdb5]);}}}this['rpc'][_0x912c('0x4a')]({'firstName':_[_0x912c('0x4b')](_0x410fe1[_0x912c('0x15')])||_['isNil'](_0x410fe1['name'])?_0x912c('0x4c')+Math[_0x912c('0x4d')]():_0x410fe1[_0x912c('0x15')],'lastName':_[_0x912c('0x4b')](_0x410fe1[_0x912c('0x4e')])||_[_0x912c('0x43')](_0x410fe1['lastName'])?null:_0x410fe1['lastName'],'phone':_0x410fe1[_0x912c('0x4f')],'ListId':_0x410fe1[_0x912c('0x50')],'scheduledat':_0x410fe1[_0x912c('0x51')],'callbackUniqueid':this['channel'][_0x912c('0x35')],'tags':_0x912c('0x52'),'description':_0x912c('0x53')+_0x410fe1[_0x912c('0x51')][_0x912c('0x54')](),'priority':_0x410fe1[_0x912c('0x55')]})['then'](function(_0x2acdc8){_0x2b14af(null,_0x2acdc8);})[_0x912c('0x16')](function(_0x251694){_0x2b14af(_0x251694);});};AGIVertices[_0x912c('0x18')]['getPause']=function(_0x4a197c,_0x21d5dc){this[_0x912c('0x13')][_0x912c('0x56')](_0x4a197c)['then'](function(_0x3dd04d){_0x21d5dc(null,_0x3dd04d?_0x3dd04d[_0x912c('0x15')]:![]);})[_0x912c('0x16')](function(_0x2f250a){_0x21d5dc(_0x2f250a);});};AGIVertices['prototype'][_0x912c('0x57')]=function(_0x2153f4,_0xc365dd,_0x2332e7){var _0x2afc13={'role':_0x912c('0x58')};_0x2afc13[_0x2153f4]=this[_0x912c('0x10')]['callerid'];this[_0x912c('0x13')][_0x912c('0x57')](_0x2afc13,_0xc365dd,this[_0x912c('0x10')][_0x912c('0x35')])[_0x912c('0x14')](function(_0x345f97){_0x2332e7(null,_[_0x912c('0x43')](_0x345f97)?![]:!![]);})['catch'](function(_0x59c43e){logger[_0x912c('0x2b')](_0x59c43e);_0x2332e7(null,![]);});};AGIVertices[_0x912c('0x18')]['agentUnpause']=function(_0x5e9735,_0x5cf8d9){var _0x1d4228={'role':_0x912c('0x58')};_0x1d4228[_0x5e9735]=this[_0x912c('0x10')][_0x912c('0x36')];this[_0x912c('0x13')][_0x912c('0x59')](_0x1d4228)[_0x912c('0x14')](function(_0x44acb6){_0x5cf8d9(null,_[_0x912c('0x43')](_0x44acb6)?![]:!![]);})[_0x912c('0x16')](function(_0x2c495d){logger['error'](_0x2c495d);_0x5cf8d9(null,![]);});};AGIVertices['prototype'][_0x912c('0x5a')]=function(_0x2d0bca,_0x2753d5){var _0x4253d9={'role':_0x912c('0x58')};_0x4253d9[_0x2d0bca]=this[_0x912c('0x10')][_0x912c('0x36')];this[_0x912c('0x13')]['agentLogout'](_0x4253d9)[_0x912c('0x14')](function(_0x4b12ea){_0x2753d5(null,_[_0x912c('0x43')](_0x4b12ea)?![]:!![]);})[_0x912c('0x16')](function(_0x4f61b1){logger[_0x912c('0x2b')](_0x4f61b1);_0x2753d5(null,![]);});};AGIVertices[_0x912c('0x18')][_0x912c('0x5b')]=function(_0x1467b9,_0x4bc105){var _0x1cba54={'role':_0x912c('0x58')};_0x1cba54[_0x1467b9]=this[_0x912c('0x10')][_0x912c('0x36')];var _0x43f909=_0x1467b9!=_0x912c('0x5c')?util[_0x912c('0x28')]('%s/%s@from-sip/n',_0x912c('0x5d'),this[_0x912c('0x10')][_0x912c('0x36')]):undefined;this[_0x912c('0x13')][_0x912c('0x5b')](_0x1cba54,_0x43f909)[_0x912c('0x14')](function(_0x327948){_0x4bc105(null,_[_0x912c('0x43')](_0x327948)?![]:!![]);})[_0x912c('0x16')](function(_0x182e8c){logger['error'](_0x182e8c);_0x4bc105(null,![]);});};AGIVertices[_0x912c('0x18')][_0x912c('0x5e')]=function(_0x2a1399,_0x362e01){sh[_0x912c('0x5f')](_['trim'](_0x2a1399),function(_0x2bc70a,_0x17112a){var _0x291be6=_0x17112a['replace'](/(\r\n|\n|\r)/gm,'');_0x362e01(null,_0x291be6);});};AGIVertices[_0x912c('0x18')][_0x912c('0x60')]=function(_0x5c1d38,_0x1748a7){scripts[_0x912c('0x60')](_0x5c1d38['apiKey'],_0x5c1d38[_0x912c('0x61')]||_0x912c('0x62'),_0x5c1d38[_0x912c('0x62')],_0x5c1d38['languageCode']||_0x912c('0x63'),_0x5c1d38[_0x912c('0x64')]||_0x912c('0x65'),_0x5c1d38[_0x912c('0x66')]||'MP3')[_0x912c('0x14')](function(_0x5a40fd){_0x1748a7(null,_0x5a40fd);})[_0x912c('0x16')](function(_0x22fc3d){_0x1748a7(_0x22fc3d);});};AGIVertices['prototype'][_0x912c('0x67')]=function(_0x399edd,_0x2f93c8){scripts['googleTTS'](_0x399edd[_0x912c('0x62')],_0x399edd[_0x912c('0x68')]||'en',0x1)[_0x912c('0x14')](function(_0x12abee){_0x2f93c8(null,_0x12abee);})[_0x912c('0x16')](function(_0x29b89c){_0x2f93c8(_0x29b89c);});};AGIVertices[_0x912c('0x18')][_0x912c('0x69')]=function(_0x41050a,_0x2a8659){var _0x45d115={'uri':_0x41050a[_0x912c('0x6a')],'method':_0x41050a[_0x912c('0x6b')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x41050a[_0x912c('0x6c')])===_0x912c('0x6d')&&parseInt(_0x41050a['timeout'])>=0x1?parseInt(_0x41050a[_0x912c('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0x912c('0x6e')]([_0x912c('0x6f'),_0x912c('0x70')],_0x45d115['method'][_0x912c('0x71')]())){try{_0x45d115[_0x912c('0x72')]=_0x41050a[_0x912c('0xd')]?JSON[_0x912c('0x73')](_0x41050a[_0x912c('0xd')]):{};}catch(_0x1cb05d){logger[_0x912c('0x2b')](_0x912c('0x74'),_0x1cb05d);}}try{_0x45d115[_0x912c('0x75')]=_0x41050a[_0x912c('0xc')]?JSON[_0x912c('0x73')](_0x41050a['rawHeaders']):{};}catch(_0x545a42){logger[_0x912c('0x2b')](_0x912c('0x76'),_0x545a42);}if(_0x41050a[_0x912c('0x77')]){try{var _0x41bb3f=require(_0x41050a[_0x912c('0x77')])[_0x912c('0x78')](this,_0x45d115);_0x45d115[_0x912c('0x79')]=Mustache[_0x912c('0x7a')](_0x41050a[_0x912c('0x6a')],_0x41bb3f,{},['$$','$$']);if(_0x45d115[_0x912c('0x75')]){_0x45d115[_0x912c('0x75')]=JSON['parse'](Mustache[_0x912c('0x7a')](JSON[_0x912c('0x7b')](_0x45d115['headers']),_0x41bb3f,{},['$$','$$']));}if(_0x45d115[_0x912c('0x72')]){_0x45d115[_0x912c('0x72')]=JSON[_0x912c('0x73')](Mustache[_0x912c('0x7a')](JSON[_0x912c('0x7b')](_0x45d115['body']),_0x41bb3f,{},['$$','$$']));}}catch(_0x2439ab){logger[_0x912c('0x2b')](_0x912c('0x7c'),_0x2439ab);}}rp(_0x45d115)[_0x912c('0x14')](function(_0x1a4c4b){var _0x270d4e={'statusCode':_0x1a4c4b[_0x912c('0x7d')]||0xc8,'statusMessage':_0x1a4c4b['statusMessage']||'OK','headers':_0x1a4c4b[_0x912c('0x75')]||{},'body':_0x1a4c4b['body']||{}};_0x2a8659(null,_0x270d4e);})[_0x912c('0x16')](function(_0x4cd97b){var _0x44faf4={'statusCode':_0x4cd97b[_0x912c('0x7d')]||0x1f4,'statusMessage':_0x4cd97b[_0x912c('0x7e')]||_0x912c('0x7f'),'headers':_0x4cd97b['options'][_0x912c('0x75')]||{},'body':_0x4cd97b[_0x912c('0x80')][_0x912c('0x72')]||{}};_0x2a8659(null,_0x44faf4);});};AGIVertices['prototype'][_0x912c('0x81')]=function(_0x676927,_0x291b08){scripts[_0x912c('0x81')](this[_0x912c('0x10')][_0x912c('0x35')],_0x676927[_0x912c('0x82')],_0x676927['text'],_0x676927[_0x912c('0x83')]||'en')[_0x912c('0x14')](function(_0x26b969){_0x291b08(null,_0x26b969);})[_0x912c('0x16')](function(_0x529e92){_0x291b08(_0x529e92);});};AGIVertices['prototype'][_0x912c('0x84')]=function(_0x35892d,_0x5a5c86){scripts[_0x912c('0x84')](this['channel'],_0x35892d)[_0x912c('0x14')](function(_0x117bd0){_0x5a5c86(null,_0x117bd0);})[_0x912c('0x16')](function(_0x3bac89){_0x5a5c86(_0x3bac89);});};AGIVertices[_0x912c('0x18')][_0x912c('0x85')]=function(_0x592641,_0x36e509){scripts['ispeechTTS'](_0x592641[_0x912c('0x82')],_0x592641[_0x912c('0x62')],_0x592641[_0x912c('0x86')]||_0x912c('0x63'),_0x592641[_0x912c('0x87')])[_0x912c('0x14')](function(_0x4ac690){_0x36e509(null,_0x4ac690);})[_0x912c('0x16')](function(_0x3138cc){_0x36e509(_0x3138cc);});};AGIVertices[_0x912c('0x18')][_0x912c('0x88')]=function(_0x450e31,_0x5edc51,_0x1a9273){scripts['ispeechASR'](_0x5edc51,_0x450e31[_0x912c('0x82')],_0x450e31['ispeech_asr_language']||_0x912c('0x63'),this[_0x912c('0x89')](_0x450e31[_0x912c('0x8a')])?_0x450e31[_0x912c('0x8a')]:undefined)['then'](function(_0x4a4f29){_0x1a9273(null,_0x4a4f29);})[_0x912c('0x16')](function(_0x44a849){_0x1a9273(_0x44a849);});};AGIVertices[_0x912c('0x18')][_0x912c('0x8b')]=function(_0x391246,_0xa9daa4){scripts['awsPolly'](_0x391246[_0x912c('0x8c')],_0x391246['aws_secret_access_key'],_0x391246[_0x912c('0x8d')],_0x391246['aws_polly_voice']||_0x912c('0x8e'),_0x391246[_0x912c('0x62')],_0x391246[_0x912c('0x8f')]||'text')[_0x912c('0x14')](function(_0x309385){_0xa9daa4(null,_0x309385);})[_0x912c('0x16')](function(_0x53ed12){_0xa9daa4(_0x53ed12);});};AGIVertices['prototype'][_0x912c('0x90')]=function(_0x54641b,_0x126d3e){scripts[_0x912c('0x90')](this[_0x912c('0x10')][_0x912c('0x35')],_0x54641b[_0x912c('0x8c')],_0x54641b[_0x912c('0x91')],_0x54641b[_0x912c('0x92')],_0x54641b[_0x912c('0x62')],_0x54641b[_0x912c('0x93')])[_0x912c('0x14')](function(_0x22afa6){_0x126d3e(null,_0x22afa6);})[_0x912c('0x16')](function(_0x3df915){_0x126d3e(_0x3df915);});};AGIVertices[_0x912c('0x18')][_0x912c('0x94')]=function(_0x292a59,_0x391fc0,_0x22407a){scripts[_0x912c('0x94')](_0x391fc0,_0x292a59[_0x912c('0x82')],_0x292a59[_0x912c('0x95')]||_0x912c('0x63'))['then'](function(_0x20044f){_0x22407a(null,_0x20044f);})['catch'](function(_0x496014){_0x22407a(_0x496014);});};AGIVertices['prototype'][_0x912c('0x96')]=function(_0x2563f5,_0x9242f4,_0x2a026b){scripts[_0x912c('0x96')](_0x9242f4,_0x2563f5['appid'],_0x2563f5['appsecret'],_0x2563f5[_0x912c('0x79')])[_0x912c('0x14')](function(_0x204e21){_0x2a026b(null,_0x204e21);})[_0x912c('0x16')](function(_0x3bad36){_0x2a026b(_0x3bad36);});};AGIVertices[_0x912c('0x18')][_0x912c('0x97')]=function(_0x3e6882){var _0x2582c0=_[_0x912c('0x6e')](verticesWithRetry,_0x3e6882[_0x912c('0x98')])?_0x3e6882:_[_0x912c('0x99')](_0x3e6882);for(var _0x5f1929 in _0x2582c0){if(_0x2582c0[_0x912c('0x9a')](_0x5f1929)){if(_0x2582c0[_0x5f1929]&&_['isString'](_0x2582c0[_0x5f1929])){if(_['includes'](recursiveMapAttributes,_0x5f1929)){_0x2582c0[_0x5f1929]=this[_0x912c('0x9b')](_0x2582c0[_0x5f1929]);}else{_0x2582c0[_0x5f1929]=this['replaceAllVariables'](_0x2582c0[_0x5f1929]);}}}}return _0x2582c0;};AGIVertices['prototype'][_0x912c('0x9c')]=function(_0x23f435){for(var _0x4733df in _0x23f435){if(_0x23f435['hasOwnProperty'](_0x4733df)){if(_[_0x912c('0x9d')](_0x23f435[_0x4733df])){this[_0x912c('0x9c')](_0x23f435[_0x4733df]);}else if(_['isArray'](_0x23f435[_0x4733df])){for(var _0x5ebf73=0x0;_0x5ebf73<_0x23f435[_0x4733df]['length'];_0x5ebf73++){this[_0x912c('0x9c')](_0x23f435[_0x4733df][_0x5ebf73]);}}else if(_[_0x912c('0x9e')](_0x23f435[_0x4733df])){_0x23f435[_0x4733df]=this[_0x912c('0x9f')](_0x23f435[_0x4733df]);}}}};AGIVertices[_0x912c('0x18')][_0x912c('0xa0')]=function(_0x5031c9,_0x341ada){for(var _0xb41f8a in _0x5031c9){if(_0x5031c9['hasOwnProperty'](_0xb41f8a)){if(_['isPlainObject'](_0x5031c9[_0xb41f8a])){if(!_[_0x912c('0x4b')](_0x5031c9[_0xb41f8a])){this[_0x912c('0xa0')](_0x5031c9[_0xb41f8a],util[_0x912c('0x28')](_0x912c('0xa1'),_0x341ada,_0xb41f8a));}}else if(_[_0x912c('0xa2')](_0x5031c9[_0xb41f8a])){for(var _0xa85842=0x0;_0xa85842<_0x5031c9[_0xb41f8a][_0x912c('0xa3')];_0xa85842++){this[_0x912c('0xa0')](_0x5031c9[_0xb41f8a][_0xa85842],util[_0x912c('0x28')]('%s.%s',_0x341ada,_0xb41f8a+'['+_0xa85842+']'));}}else{if(!_[_0x912c('0x43')](_0x5031c9[_0xb41f8a])){this['channel'][_0x912c('0xa4')](util[_0x912c('0x28')]('%s.%s',_0x341ada,_0xb41f8a),_0x5031c9[_0xb41f8a]);}}}}};AGIVertices[_0x912c('0x18')][_0x912c('0x9b')]=function(_0x53f63d){try{var _0x29219d=JSON[_0x912c('0x73')](_0x53f63d);this[_0x912c('0x9c')](_0x29219d);return JSON[_0x912c('0x7b')](_0x29219d);}catch(_0x1d4b17){return this[_0x912c('0x9f')](_0x53f63d);}};AGIVertices[_0x912c('0x18')][_0x912c('0x9f')]=function(_0x516335){console[_0x912c('0x40')]('replaceall\x20init',_0x516335);var _0x2b3ccf=_0x516335[_0x912c('0xa5')]('{');for(var _0x1bf7f1=0x1;_0x1bf7f1<_0x2b3ccf[_0x912c('0xa3')];_0x1bf7f1+=0x1){var _0x43422c=_0x2b3ccf[_0x1bf7f1][_0x912c('0xa5')]('}');console[_0x912c('0x40')](_0x912c('0xa6'),_0x43422c);if(_0x43422c[_0x912c('0xa3')]>0x1){_0x516335=_0x516335[_0x912c('0xa7')]('{'+_0x43422c[0x0]+'}',this[_0x912c('0x10')][_0x912c('0x12')](_0x43422c[0x0])[_0x912c('0xa8')]||_0x43422c[0x0]);}}if(_0x2b3ccf[_0x912c('0xa3')]===0x1){return _0x516335[_0x912c('0x54')]();}console['log'](_0x912c('0xa9'),_0x516335);return this['replaceAllVariables'](_0x516335);};AGIVertices[_0x912c('0x18')][_0x912c('0xaa')]=function(_0x37748d,_0x1aba0c){var _0x35e576=this['channel'][_0x912c('0x12')](_0x37748d);if(_0x35e576[_0x912c('0xab')]===-0x1){return _0x35e576;}logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xac'),_0x1aba0c,_0x35e576[_0x912c('0xa8')]));return this[_0x912c('0x10')][_0x912c('0xa4')](_0x1aba0c,_0x35e576[_0x912c('0xa8')]);};AGIVertices['prototype']['isConfigured']=function(_0x319733){return _0x319733&&_0x319733!=='0'&&_0x319733!=='-1'&&_0x319733!=='';};AGIVertices[_0x912c('0x18')][_0x912c('0xad')]=function(_0x35fc8f){this['createSquareDetailsReport'][_0x912c('0x78')](this,_0x35fc8f,'-');_0x35fc8f[_0x912c('0xae')]=_0x35fc8f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x912c('0x18')][_0x912c('0xaf')]=function(_0x173558){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xb0'),_0x173558[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x173558[_0x912c('0x62')])){return this['channel'][_0x912c('0xb2')](_0x912c('0xb3'));}var _0x571094='\x22'+_0x173558[_0x912c('0x62')]+'\x22';if(this[_0x912c('0x89')](_0x173558[_0x912c('0x80')])){_0x571094+=','+_0x173558[_0x912c('0x80')];}var _0x232f18=this[_0x912c('0x10')][_0x912c('0x5f')](_0x912c('0xb4'),_0x571094);if(_0x232f18[_0x912c('0xab')]===-0x1){return _0x232f18;}return this[_0x912c('0x10')]['noop'](util['format'](_0x912c('0xb5'),_0x571094));};AGIVertices[_0x912c('0x18')][_0x912c('0xb6')]=function(_0x65c6c9){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x65c6c9[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x65c6c9['grammar'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb7'));}var _0xa47265=_0x65c6c9[_0x912c('0xb8')];if(this[_0x912c('0x89')](_0x65c6c9[_0x912c('0x80')])){_0xa47265+=','+_0x65c6c9['options'];}var _0x1fe120=this['channel']['exec'](_0x912c('0xb9'),_0xa47265);if(_0x1fe120[_0x912c('0xab')]===-0x1){return _0x1fe120;}var _0x29fc29=this['getAndSetVariable'](_0x912c('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0x29fc29['result']===-0x1){return _0x29fc29;}var _0x4cdd2d=this['getAndSetVariable'](_0x912c('0xbb'),_0x912c('0xbc'));if(_0x4cdd2d[_0x912c('0xab')]===-0x1){return _0x4cdd2d;}var _0x2e21a8=this[_0x912c('0xaa')](_0x912c('0xbd'),'MRCP_RECOG_INSTANCE');if(_0x2e21a8['result']===-0x1){return _0x2e21a8;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xbe'),_0xa47265));};AGIVertices[_0x912c('0x18')][_0x912c('0x9')]=function(_0x44ace5){logger['info'](util[_0x912c('0x28')](_0x912c('0xbf'),_0x44ace5[_0x912c('0xb1')]));return this[_0x912c('0x10')][_0x912c('0x9')]([_0x44ace5[_0x912c('0xc0')],_0x44ace5['args']]);};AGIVertices['prototype']['answer']=function(_0x39e899){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xc1'),_0x39e899[_0x912c('0xb1')]));if(this[_0x912c('0x89')](_0x39e899[_0x912c('0x6c')])){logger['info'](util[_0x912c('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x39e899[_0x912c('0x6c')]));var _0x266716=this[_0x912c('0x10')][_0x912c('0xc2')](_0x39e899['timeout']);if(_0x266716[_0x912c('0xab')]===-0x1){return _0x266716;}}return this['channel'][_0x912c('0xc3')]();};AGIVertices[_0x912c('0x18')][_0x912c('0x52')]=function(_0x149921){console[_0x912c('0x40')]('enter\x20in\x20callbackblock',_0x149921);logger['info'](util[_0x912c('0x28')](_0x912c('0xc4'),_0x149921['label']));if(!this['isConfigured'](_0x149921[_0x912c('0x50')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x149921,_0x912c('0xc5'));}_0x149921['scheduledAt']=moment();if(this[_0x912c('0x89')](_0x149921[_0x912c('0xc6')])){_0x149921['scheduledAt']=moment()[_0x912c('0xc7')](_0x149921[_0x912c('0xc6')],'minutes');}if(!this[_0x912c('0x89')](_0x149921['callback_priority'])){_0x149921[_0x912c('0x55')]=0x2;}console[_0x912c('0x40')]('before\x20createcmcontact',_0x149921);this['createCmContact'][_0x912c('0x78')](this,_0x149921);return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x149921[_0x912c('0x4f')],_0x149921[_0x912c('0x50')],_0x149921[_0x912c('0x51')]));};AGIVertices[_0x912c('0x18')]['custom_app']=function(_0x15317e){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xc8'),_0x15317e['label']));var _0x23ae83=this['channel']['exec'](_0x15317e[_0x912c('0xc9')],_0x15317e['options']);if(_0x23ae83[_0x912c('0xab')]===-0x1){return _0x23ae83;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xca'),_0x15317e[_0x912c('0xc9')],_0x15317e[_0x912c('0x80')]));};AGIVertices['prototype'][_0x912c('0xcb')]=function(_0x12239f){logger['info'](util['format'](_0x912c('0xcc'),_0x12239f[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x12239f[_0x912c('0x62')])){return this[_0x912c('0x10')][_0x912c('0xb2')]('no\x20text\x20configured');}var _0x856194='\x22'+_0x12239f['text']+'\x22';if(this[_0x912c('0x89')](_0x12239f['options'])){_0x856194+=','+_0x12239f[_0x912c('0x80')];}var _0xf91c9a=this['channel'][_0x912c('0x5f')]('MRCPSynth',_0x856194);if(_0xf91c9a[_0x912c('0xab')]===-0x1){return _0xf91c9a;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xb5'),_0x856194));};AGIVertices['prototype']['sestektts']=function(_0x17cfbe){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xcd'),_0x17cfbe[_0x912c('0xb1')]));if(!this['isConfigured'](_0x17cfbe[_0x912c('0x62')])){return this['channel']['noop'](_0x912c('0xb3'));}var _0x29adb8='\x22'+_0x17cfbe[_0x912c('0x62')]+'\x22';if(this[_0x912c('0x89')](_0x17cfbe[_0x912c('0x80')])){_0x29adb8+=','+_0x17cfbe[_0x912c('0x80')];}var _0x2ed8ad=this[_0x912c('0x10')]['exec'](_0x912c('0xb4'),_0x29adb8);if(_0x2ed8ad[_0x912c('0xab')]===-0x1){return _0x2ed8ad;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xb5'),_0x29adb8));};AGIVertices[_0x912c('0x18')][_0x912c('0xce')]=function(_0x2fc521){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xcf'),_0x2fc521[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x2fc521[_0x912c('0xb8')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb7'));}var _0xfa0bf4=_0x2fc521[_0x912c('0xb8')];if(this[_0x912c('0x89')](_0x2fc521[_0x912c('0x80')])){_0xfa0bf4+=','+_0x2fc521[_0x912c('0x80')];}var _0x4e5d35=this[_0x912c('0x10')][_0x912c('0x5f')](_0x912c('0xb9'),_0xfa0bf4);if(_0x4e5d35['result']===-0x1){return _0x4e5d35;}var _0x5a91da=this[_0x912c('0xaa')]('RECOG_CONFIDENCE()',_0x912c('0xd0'));if(_0x5a91da['result']===-0x1){return _0x5a91da;}var _0xc16c3b=this['getAndSetVariable'](_0x912c('0xbb'),_0x912c('0xd1'));if(_0xc16c3b[_0x912c('0xab')]===-0x1){return _0xc16c3b;}var _0x42579f=this[_0x912c('0xaa')](_0x912c('0xbd'),'LUMENVOX_ASR_INSTANCE');if(_0x42579f[_0x912c('0xab')]===-0x1){return _0x42579f;}return this['channel']['noop'](util['format'](_0x912c('0xbe'),_0xfa0bf4));};AGIVertices[_0x912c('0x18')][_0x912c('0xd2')]=function(_0x104f73){logger[_0x912c('0x2d')](util['format'](_0x912c('0xd3'),_0x104f73['label']));if(!this[_0x912c('0x89')](_0x104f73[_0x912c('0xb8')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb7'));}var _0x5f01be=_0x104f73[_0x912c('0xb8')];if(this[_0x912c('0x89')](_0x104f73['options'])){_0x5f01be+=','+_0x104f73['options'];}var _0x3e5a6a=this[_0x912c('0x10')]['exec']('MRCPRecog',_0x5f01be);if(_0x3e5a6a[_0x912c('0xab')]===-0x1){return _0x3e5a6a;}var _0x4e51e2=this[_0x912c('0xaa')](_0x912c('0xba'),_0x912c('0xd4'));if(_0x4e51e2['result']===-0x1){return _0x4e51e2;}var _0x14955f=this[_0x912c('0xaa')]('RECOG_INPUT()',_0x912c('0xd5'));if(_0x14955f[_0x912c('0xab')]===-0x1){return _0x14955f;}var _0x1d9eef=this[_0x912c('0xaa')](_0x912c('0xbd'),_0x912c('0xd6'));if(_0x1d9eef[_0x912c('0xab')]===-0x1){return _0x1d9eef;}return this[_0x912c('0x10')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x5f01be));};AGIVertices[_0x912c('0x18')]['database']=function(_0x40b435){logger['info'](util[_0x912c('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x40b435[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x40b435['odbc_id'])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x40b435,_0x912c('0xd7'));}var _0x2dcb3b=this[_0x912c('0x1a')][_0x912c('0x78')](this,_0x40b435[_0x912c('0xd8')]);if(!_0x2dcb3b){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x40b435,_0x912c('0xd9'));}if(!this[_0x912c('0x89')](_0x40b435[_0x912c('0x2f')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x40b435,_0x912c('0xda'));}var _0x4f6b51=_0x40b435['query'][_0x912c('0xdb')](/(\r\n|\n|\r)/gm,'\x20');this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xdc'),_0x4f6b51));var _0x5a5273=this[_0x912c('0x2a')]['sync'](this,_0x2dcb3b,_0x4f6b51);this[_0x912c('0x34')][_0x912c('0x78')](this,_0x40b435,_0x4f6b51);if(!this[_0x912c('0x89')](_0x40b435['variable_id'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xdd'));}var _0x177d05=this[_0x912c('0x12')][_0x912c('0x78')](this,_0x40b435[_0x912c('0xde')]);if(!_0x177d05){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x40b435,'no\x20variable\x20found');}var _0x5d8420=this;_0x5a5273['forEach'](function(_0x2e07dd,_0x1e0d90){Object[_0x912c('0xdf')](_0x2e07dd)['forEach'](function(_0x21b5f2){_0x5d8420[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')]('%s[%s][%s]',_0x177d05,_0x1e0d90,_0x21b5f2),_0x2e07dd[_0x21b5f2]);});});this[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')]('%s_ROWS_COUNT',_0x177d05),_0x5a5273['length']);return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')]('variable\x20%s\x20set',_0x177d05));};AGIVertices[_0x912c('0x18')]['dial']=function(_0x295651){logger[_0x912c('0xe0')](util['format'](_0x912c('0xe1'),_0x295651['label']));if(!this['isConfigured'](_0x295651[_0x912c('0xe2')])){return this['channel'][_0x912c('0x2b')](_0x295651,'no\x20user\x20selected');}var _0x55f836=this['getUser'][_0x912c('0x78')](this,_0x295651[_0x912c('0xe2')]);if(!_0x55f836){return this['channel']['error'](_0x295651,'no\x20user\x20found');}var _0x6ebf3a=this['channel'][_0x912c('0x5f')](_0x912c('0xe3'),[util['format']('SIP/%s',_0x55f836),_0x295651[_0x912c('0x6c')],_0x295651[_0x912c('0xe4')],_0x295651[_0x912c('0x6a')]]);if(_0x6ebf3a[_0x912c('0xab')]===-0x1){return _0x6ebf3a;}return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0xe5'),_0x912c('0xe3')));};AGIVertices[_0x912c('0x18')][_0x912c('0xe6')]=function(_0x4ce2da){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4ce2da[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x4ce2da[_0x912c('0x82')])){return this[_0x912c('0x10')]['noop'](_0x912c('0xe7'));}if(!this[_0x912c('0x89')](_0x4ce2da['text'])){return this['channel'][_0x912c('0xb2')](_0x912c('0xb3'));}this[_0x912c('0x10')]['bot']=!![];this[_0x912c('0x34')](_0x4ce2da);this['createSquareMessage'](_0x4ce2da['text'],'in');this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')]('Trying\x20Dialogflow:\x20%s',_0x4ce2da['text']));var _0x3ef0d2=this[_0x912c('0x81')][_0x912c('0x78')](this,_0x4ce2da);if(_0x3ef0d2){for(var _0x3afaf9 in _0x3ef0d2){if(_0x3ef0d2[_0x912c('0x9a')](_0x3afaf9)){this['channel'][_0x912c('0xa4')](util[_0x912c('0x28')]('DIALOGFLOW_%s',_0x3afaf9['toUpperCase']()),_0x3ef0d2[_0x3afaf9]);}}this['createSquareMessage'](_0x3ef0d2['speech'],'out');return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xe8'),_0x3ef0d2[_0x912c('0xe9')]));}return this[_0x912c('0x10')][_0x912c('0x2b')](_0x4ce2da,_0x912c('0xea'));};AGIVertices[_0x912c('0x18')][_0x912c('0xeb')]=function(_0xb4f7a7){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xec'),_0xb4f7a7[_0x912c('0xb1')]));if(!this['isConfigured'](_0xb4f7a7[_0x912c('0xed')])){return this[_0x912c('0x10')][_0x912c('0xb2')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0xb4f7a7[_0x912c('0xee')])){return this[_0x912c('0x10')]['noop']('no\x20username\x20configured');}if(!this[_0x912c('0x89')](_0xb4f7a7[_0x912c('0xef')])){return this[_0x912c('0x10')]['noop'](_0x912c('0xf0'));}if(!this[_0x912c('0x89')](_0xb4f7a7[_0x912c('0xf1')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb3'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xb4f7a7);this[_0x912c('0x3f')](_0xb4f7a7[_0x912c('0x62')],'in');this['channel']['noop'](util['format'](_0x912c('0xf2'),_0xb4f7a7[_0x912c('0x62')]));var _0x35c67c=this[_0x912c('0x84')][_0x912c('0x78')](this,_0xb4f7a7);if(_0x35c67c){for(var _0x11ee4c in _0x35c67c){if(_0x35c67c['hasOwnProperty'](_0x11ee4c)){this[_0x912c('0x10')]['setVariable'](util[_0x912c('0x28')](_0x912c('0xf3'),_0x11ee4c[_0x912c('0x71')]()),_0x35c67c[_0x11ee4c]);}}this[_0x912c('0x3f')](_0x35c67c[_0x912c('0xe9')],_0x912c('0xf4'));if(_0x35c67c[_0x912c('0xf5')]){this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0xf6'),_0x35c67c[_0x912c('0xf5')]));var _0x135110=this[_0x912c('0x10')][_0x912c('0xf7')](_0x35c67c[_0x912c('0xf5')]);try{fs[_0x912c('0xf8')](_0x35c67c['audiofile']+_0x912c('0xf9'));}catch(_0xd2d1e9){logger[_0x912c('0x2b')](_0xd2d1e9);}return _0x135110;}else{return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')]('SestekNDA\x20Result\x20%s',_0x35c67c[_0x912c('0xe9')]));}}return this[_0x912c('0x10')][_0x912c('0x2b')](_0xb4f7a7,_0x912c('0xfa'));};AGIVertices[_0x912c('0x18')]['end']=function(_0x39a923){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0xfb'),_0x39a923[_0x912c('0xb1')]));return this['channel'][_0x912c('0xb2')](_0x912c('0xfc'));};AGIVertices[_0x912c('0x18')][_0x912c('0xfd')]=function(_0x4fe448){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4fe448[_0x912c('0xb1')]));var _0x291268='';if(_0x4fe448[_0x912c('0xfe')]){if(!this[_0x912c('0x89')](_0x4fe448[_0x912c('0xfe')])){return this[_0x912c('0x10')]['error'](_0x4fe448,_0x912c('0xff'));}else{var _0x98f019=parseInt(_0x4fe448[_0x912c('0xfe')],0xa);if(isNaN(_0x98f019)){_0x291268=_0x4fe448[_0x912c('0xfe')];}else{_0x291268=this[_0x912c('0x100')]['sync'](this,_0x4fe448['trunk_id']);if(!_0x291268){return this['channel'][_0x912c('0x2b')](_0x4fe448,_0x912c('0x101'));}}}}else if(_0x4fe448[_0x912c('0x102')]){_0x291268=_0x4fe448['trunk_name'];}else{return this[_0x912c('0x10')][_0x912c('0x2b')](_0x4fe448,_0x912c('0xff'));}var _0x30b7ef=this[_0x912c('0x10')][_0x912c('0x5f')](_0x912c('0xe3'),[util[_0x912c('0x28')](_0x912c('0x103'),_0x291268,_0x4fe448[_0x912c('0x4f')]),_0x4fe448['timeout'],_0x4fe448[_0x912c('0xe4')],_0x4fe448[_0x912c('0x6a')]]);if(_0x30b7ef[_0x912c('0xab')]===-0x1){return _0x30b7ef;}return this[_0x912c('0x10')][_0x912c('0xb2')](util['format'](_0x912c('0xe5'),_0x912c('0xe3')));};AGIVertices['prototype'][_0x912c('0x104')]=function(_0x4b772c){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x105'),_0x4b772c[_0x912c('0xb1')]));return this[_0x912c('0x10')]['noop']('finally');};AGIVertices['prototype'][_0x912c('0x106')]=function(_0x3048ce){logger[_0x912c('0x2d')](util['format'](_0x912c('0x107'),_0x3048ce['label']));if(_0x3048ce[_0x912c('0xae')]===0x0){return this[_0x912c('0xad')](_0x3048ce);}_0x3048ce['retry']-=0x1;if(!this['isConfigured'](_0x3048ce[_0x912c('0x108')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x3048ce,_0x912c('0x109'));}var _0x5c147b=this[_0x912c('0x10a')]['sync'](this,_0x3048ce[_0x912c('0x108')]);if(!_0x5c147b){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x3048ce,_0x912c('0x10b'));}if(!this[_0x912c('0x89')](_0x3048ce[_0x912c('0xde')])){return this['channel'][_0x912c('0x2b')](_0x912c('0xdd'));}var _0x249e77=this['channel'][_0x912c('0x10c')](_0x5c147b,_0x3048ce[_0x912c('0x10d')],_0x3048ce[_0x912c('0x10e')]);var _0x5aa4ec=_0x249e77['result']?_0x249e77[_0x912c('0xab')][_0x912c('0x54')]():'';logger[_0x912c('0x2d')]('test',JSON[_0x912c('0x7b')](_0x249e77));if(_0x249e77['result']===-0x1){this[_0x912c('0x34')][_0x912c('0x78')](this,_0x3048ce,_0x5aa4ec);return _0x249e77;}else if(_0x249e77[_0x912c('0xa8')]===_0x912c('0x6c')){_0x249e77[_0x912c('0xab')]=_0x5aa4ec[_0x912c('0xa3')]>=parseInt(_0x3048ce[_0x912c('0x10f')])?'x':'i';}else{_0x249e77[_0x912c('0xab')]=_0x5aa4ec[_0x912c('0xa3')]>=parseInt(_0x3048ce[_0x912c('0x10f')])&&_0x5aa4ec[_0x912c('0xa3')]<=parseInt(_0x3048ce['maxdigit'])?'x':'i';}var _0x358287=this['getVariable'][_0x912c('0x78')](this,_0x3048ce[_0x912c('0xde')]);if(!_0x358287){return this[_0x912c('0x10')]['error'](_0x3048ce,_0x912c('0x110'));}this[_0x912c('0x10')][_0x912c('0xa4')](_0x358287,_0x5aa4ec);if(this['isConfigured'](_0x3048ce['hiddendigitsnum'])){var _0x52a8cf=parseInt(_0x3048ce[_0x912c('0x111')],0xa);var _0x5bb315=rs[_0x912c('0x112')]({'charset':'*','length':_0x52a8cf});var _0x3657ce=_0x5aa4ec[_0x912c('0xa3')];if(_0x3657ce>0x0){if(_0x3657ce>_0x52a8cf){this['createSquareDetailsReport'][_0x912c('0x78')](this,_0x3048ce,_0x3048ce[_0x912c('0x113')]===_0x912c('0x114')?_0x5bb315+_0x5aa4ec[_0x912c('0x115')](_0x52a8cf):_0x5aa4ec[_0x912c('0x115')](0x0,_0x3657ce-_0x52a8cf)+_0x5bb315);}else{this['createSquareDetailsReport'][_0x912c('0x78')](this,_0x3048ce,rs[_0x912c('0x112')]({'charset':'*','length':_0x3657ce}));}}else{this[_0x912c('0x34')][_0x912c('0x78')](this,_0x3048ce,'');}}else{this[_0x912c('0x34')][_0x912c('0x78')](this,_0x3048ce,_0x5aa4ec);}return _0x249e77;};AGIVertices['prototype'][_0x912c('0xf')]=function(_0x49279d){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x116'),_0x49279d[_0x912c('0xb1')]));return this[_0x912c('0x106')](_0x49279d);};AGIVertices[_0x912c('0x18')][_0x912c('0x117')]=function(_0x21950f){logger[_0x912c('0x2d')](util['format'](_0x912c('0x118'),_0x21950f['label']));this[_0x912c('0x34')][_0x912c('0x78')](this,_0x21950f,_0x21950f[_0x912c('0x119')]);return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x11a'),_0x21950f[_0x912c('0x119')]));};AGIVertices[_0x912c('0x18')][_0x912c('0x11b')]=function(_0x40bf1e){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x11c'),_0x40bf1e[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x40bf1e['aws_access_key_id'])||!this[_0x912c('0x89')](_0x40bf1e['aws_secret_access_key'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x11d'));}if(!this[_0x912c('0x89')](_0x40bf1e[_0x912c('0x62')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb3'));}this['channel'][_0x912c('0xb2')](util['format'](_0x912c('0x11e'),_0x40bf1e[_0x912c('0x62')]));var _0x26fce9=this['awsPolly'][_0x912c('0x78')](this,_0x40bf1e);if(_0x26fce9){this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x26fce9));var _0x4e6b68=this['channel'][_0x912c('0xf7')](_0x26fce9);try{fs[_0x912c('0xf8')](_0x26fce9+_0x912c('0xf9'));}catch(_0x435f02){logger[_0x912c('0x2b')](_0x435f02);}return _0x4e6b68;}return this[_0x912c('0x10')]['error'](_0x40bf1e,_0x912c('0x11f'));};AGIVertices[_0x912c('0x18')][_0x912c('0x120')]=function(_0x406168){logger[_0x912c('0x2d')](util['format'](_0x912c('0x121'),_0x406168['label']));if(!this[_0x912c('0x89')](_0x406168[_0x912c('0x8c')])||!this[_0x912c('0x89')](_0x406168['aws_secret_access_key'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x11d'));}if(!this[_0x912c('0x89')](_0x406168['aws_bot_name'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x122'));}if(!this[_0x912c('0x89')](_0x406168[_0x912c('0x62')])){return this['channel'][_0x912c('0xb2')](_0x912c('0xb3'));}this[_0x912c('0x10')][_0x912c('0x123')]=!![];this[_0x912c('0x34')](_0x406168);this[_0x912c('0x3f')](_0x406168['text'],'in');this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x124'),_0x406168['text']));var _0x223b4e=this[_0x912c('0x90')]['sync'](this,_0x406168);if(_0x223b4e){for(var _0x1c09b0 in _0x223b4e){if(_0x223b4e[_0x912c('0x9a')](_0x1c09b0)&&_[_0x912c('0x9e')](_0x223b4e[_0x1c09b0])){this[_0x912c('0x10')][_0x912c('0xa4')](util['format'](_0x912c('0x125'),_0x1c09b0['toUpperCase']()),_0x223b4e[_0x1c09b0]);}}if(_[_0x912c('0x43')](_0x223b4e[_0x912c('0x7e')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x126'));}else{this[_0x912c('0x3f')](_0x223b4e['message'],_0x912c('0xf4'));return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0x127'),_0x223b4e[_0x912c('0x7e')]));}}return this['channel'][_0x912c('0x2b')](_0x406168,_0x912c('0x128'));};AGIVertices[_0x912c('0x18')]['googleasr']=function(_0x3a0d9a){logger['info'](util[_0x912c('0x28')](_0x912c('0x129'),_0x3a0d9a['label'],_0x3a0d9a['timeout']));if(!this[_0x912c('0x89')](_0x3a0d9a['key'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xe7'));}var _0x9b7dfa='wav';var _0x3bb86c=util[_0x912c('0x28')](_0x912c('0x12a'),FILES_PATH,rs[_0x912c('0x112')](0x4));var _0x2cfaab=util[_0x912c('0x28')]('%s.%s',_0x3bb86c,_0x9b7dfa);var _0x3d077=!![];if(_0x3a0d9a['beep']===_0x912c('0x12b')){_0x3d077=![];}var _0x5ca86f=this['channel'][_0x912c('0x12c')](_0x3bb86c,_0x9b7dfa,_0x3a0d9a[_0x912c('0x12d')],_0x3a0d9a[_0x912c('0x6c')],undefined,_0x3d077);if(_0x5ca86f[_0x912c('0xab')]!==-0x1){this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x12e'),_0x2cfaab));var _0x403136=this['googleASR'][_0x912c('0x78')](this,_0x3a0d9a,_0x2cfaab);if(_0x403136){for(var _0x351544 in _0x403136){if(_0x403136[_0x912c('0x9a')](_0x351544)){this[_0x912c('0x10')]['setVariable'](util['format'](_0x912c('0x12f'),_0x351544[_0x912c('0x71')]()),_0x403136[_0x351544]);}}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x130'),JSON[_0x912c('0x7b')](_0x403136)));}}return _0x5ca86f;};AGIVertices[_0x912c('0x18')][_0x912c('0x131')]=function(_0x1e5926){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x132'),_0x1e5926['label']));if(!this[_0x912c('0x89')](_0x1e5926[_0x912c('0x133')])){return this['channel'][_0x912c('0xb2')](_0x912c('0x134'));}if(!this[_0x912c('0x89')](_0x1e5926['appsecret'])){return this['channel']['noop'](_0x912c('0x135'));}var _0x3b5ab2=_0x912c('0x136');var _0x5256f1=util[_0x912c('0x28')](_0x912c('0x12a'),FILES_PATH,rs[_0x912c('0x112')](0x4));var _0x9839b4=util[_0x912c('0x28')](_0x912c('0xa1'),_0x5256f1,_0x3b5ab2);var _0x2c6025=!![];if(_0x1e5926[_0x912c('0x137')]===_0x912c('0x12b')){_0x2c6025=![];}var _0x1b103f=this[_0x912c('0x10')][_0x912c('0x12c')](_0x5256f1,_0x3b5ab2,_0x1e5926[_0x912c('0x12d')],_0x1e5926[_0x912c('0x6c')],undefined,_0x2c6025);if(_0x1b103f[_0x912c('0xab')]!==-0x1){this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x138'),_0x9839b4));var _0x17a4fe=this[_0x912c('0x96')]['sync'](this,_0x1e5926,_0x9839b4);if(_0x17a4fe){for(var _0x30e531 in _0x17a4fe){if(_0x17a4fe['hasOwnProperty'](_0x30e531)){this[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')]('TILDE_ASR_%s',_0x30e531[_0x912c('0x71')]()),_0x17a4fe[_0x30e531]);}}return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0x139'),JSON[_0x912c('0x7b')](_0x17a4fe)));}}return _0x1b103f;};AGIVertices[_0x912c('0x18')][_0x912c('0x13a')]=function(_0x15baf5){logger['info'](util[_0x912c('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x15baf5[_0x912c('0xb1')]));return this[_0x912c('0x10')][_0x912c('0x13b')](_0x15baf5[_0x912c('0x13c')],_0x15baf5[_0x912c('0x39')],_0x15baf5['priority']);};AGIVertices['prototype'][_0x912c('0x13d')]=function(_0x4dfa36){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4dfa36[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x4dfa36[_0x912c('0x13e')])){return this['channel'][_0x912c('0x2b')](_0x4dfa36,_0x912c('0x13f'));}try{var _0x208261=eval(_0x4dfa36[_0x912c('0x13e')])?_0x912c('0x140'):_0x912c('0x141');this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0x142'),_0x4dfa36[_0x912c('0x13e')],_0x208261));return{'code':0xc8,'result':_0x208261};}catch(_0x1d5f30){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x912c('0x18')][_0x912c('0x143')]=function(_0x10066c){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x10066c[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x10066c[_0x912c('0x144')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x10066c,'no\x20interval\x20configured');}var _0xdb2c3c=this[_0x912c('0x145')]['sync'](this,_0x10066c['interval_id']);if(!_0xdb2c3c){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x10066c,'no\x20intervals\x20found');}for(var _0x507142=0x0;_0x507142<_0xdb2c3c[_0x912c('0xa3')];_0x507142+=0x1){var _0x4298ea=this[_0x912c('0x10')][_0x912c('0x12')](util[_0x912c('0x28')](_0x912c('0x146'),_0xdb2c3c[_0x507142]));if(_0x4298ea['result']===-0x1){return _0x4298ea;}logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x147'),_0xdb2c3c[_0x507142],_0x4298ea[_0x912c('0xa8')]));if(_0x4298ea['extra']===_0x912c('0x140')){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x147'),_0xdb2c3c[_0x507142],'true'));this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x147'),_0xdb2c3c[_0x507142],_0x912c('0x140')));return{'code':0xc8,'result':_0x912c('0x140')};}else{logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x147'),_0xdb2c3c[_0x507142],'false'));this[_0x912c('0x10')][_0x912c('0xb2')](util['format'](_0x912c('0x147'),_0xdb2c3c[_0x507142],_0x912c('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x912c('0x18')]['hangup']=function(_0x3ea1ec){logger['info'](util['format'](_0x912c('0x148'),_0x3ea1ec['label']));return this[_0x912c('0x10')][_0x912c('0x149')]();};AGIVertices[_0x912c('0x18')][_0x912c('0x14a')]=function(_0x38ebe9){logger['info'](util['format'](_0x912c('0x14b'),_0x38ebe9[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x38ebe9[_0x912c('0x82')])){return this[_0x912c('0x10')]['noop'](_0x912c('0xe7'));}var _0x2e1547=_0x912c('0x136');var _0x13f1ad=util[_0x912c('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x912c('0x112')](0x4));var _0x3882c3=util[_0x912c('0x28')](_0x912c('0xa1'),_0x13f1ad,_0x2e1547);var _0xd76a81=!![];if(_0x38ebe9[_0x912c('0x137')]===_0x912c('0x12b')){_0xd76a81=![];}var _0x21d4d7=this['channel'][_0x912c('0x12c')](_0x13f1ad,_0x2e1547,_0x38ebe9['intKey'],_0x38ebe9[_0x912c('0x6c')],undefined,_0xd76a81);if(_0x21d4d7['result']!==-0x1){this[_0x912c('0x10')][_0x912c('0xb2')](util['format']('ispeech\x20%s\x20file\x20created',_0x3882c3));var _0x805e56=this[_0x912c('0x88')][_0x912c('0x78')](this,_0x38ebe9,_0x3882c3);if(_0x805e56){for(var _0x3eeb48 in _0x805e56){if(_0x805e56['hasOwnProperty'](_0x3eeb48)){this[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')]('ISPEECH_ASR_%s',_0x3eeb48[_0x912c('0x71')]()),_0x805e56[_0x3eeb48]);}}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x14c'),JSON['stringify'](_0x805e56)));}}return _0x21d4d7;};AGIVertices[_0x912c('0x18')][_0x912c('0x14d')]=function(_0x305ad8){logger['info'](util[_0x912c('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x305ad8[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x305ad8['key'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xe7'));}if(!this[_0x912c('0x89')](_0x305ad8[_0x912c('0x62')])){return this['channel'][_0x912c('0xb2')]('no\x20text\x20configured');}this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x14e'),_0x305ad8[_0x912c('0x62')]));var _0x28e0a2=this[_0x912c('0x85')][_0x912c('0x78')](this,_0x305ad8);if(_0x28e0a2){this['channel']['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x28e0a2));var _0x59906e=this[_0x912c('0x10')][_0x912c('0xf7')](_0x28e0a2,_0x305ad8[_0x912c('0x12d')]);try{fs['unlink'](_0x28e0a2+_0x912c('0xf9'));}catch(_0x43ae9a){logger[_0x912c('0x2b')](_0x43ae9a);}return _0x59906e;}return this[_0x912c('0x10')][_0x912c('0x2b')](_0x305ad8,_0x912c('0x14f'));};AGIVertices[_0x912c('0x18')][_0x912c('0x150')]=function(_0x429b43){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x151'),_0x429b43['label']));if(!this['isConfigured'](_0x429b43[_0x912c('0x152')])){return this[_0x912c('0x10')]['error'](_0x429b43,_0x912c('0x153'));}logger[_0x912c('0x2d')](util[_0x912c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x429b43[_0x912c('0x152')]));var _0x537f26=this[_0x912c('0x5b')][_0x912c('0x78')](this,_0x429b43[_0x912c('0x152')]);if(_0x537f26){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x154'),this[_0x912c('0x10')]['callerid'],_0x429b43[_0x912c('0x152')]));this['channel']['noop'](util[_0x912c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x912c('0x10')][_0x912c('0x36')],_0x429b43[_0x912c('0x152')]));return{'code':0xc8,'result':_0x912c('0x155')};}else{logger[_0x912c('0x2d')](util[_0x912c('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x912c('0x10')]['callerid'],_0x429b43[_0x912c('0x152')]));this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x156'),this[_0x912c('0x10')][_0x912c('0x36')],_0x429b43[_0x912c('0x152')]));return{'code':0xc8,'result':_0x912c('0x157')};}};AGIVertices['prototype'][_0x912c('0x158')]=function(_0x184b5c){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x184b5c[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x184b5c[_0x912c('0x152')])){return this['channel'][_0x912c('0x2b')](_0x184b5c,_0x912c('0x153'));}logger[_0x912c('0x2d')](util[_0x912c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x912c('0x10')]['callerid'],_0x184b5c[_0x912c('0x152')]));var _0x16b751=this[_0x912c('0x5a')][_0x912c('0x78')](this,_0x184b5c[_0x912c('0x152')]);if(_0x16b751){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x154'),this[_0x912c('0x10')][_0x912c('0x36')],_0x184b5c[_0x912c('0x152')]));this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x912c('0x10')][_0x912c('0x36')],_0x184b5c[_0x912c('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x156'),this[_0x912c('0x10')][_0x912c('0x36')],_0x184b5c[_0x912c('0x152')]));this[_0x912c('0x10')][_0x912c('0xb2')](util['format'](_0x912c('0x156'),this[_0x912c('0x10')][_0x912c('0x36')],_0x184b5c[_0x912c('0x152')]));return{'code':0xc8,'result':_0x912c('0x157')};}};AGIVertices['prototype'][_0x912c('0x159')]=function(_0x315674){logger['info'](util[_0x912c('0x28')](_0x912c('0x15a'),_0x315674[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x315674['operation'])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x315674,_0x912c('0x15b'));}this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x15c'),_0x315674[_0x912c('0x15d')]));var _0x53ef08=eval(_0x315674[_0x912c('0x15d')]);if(!this[_0x912c('0x89')](_0x315674[_0x912c('0xde')])){return this['channel'][_0x912c('0xb2')](_0x912c('0xdd'));}var _0x2cdbaf=this[_0x912c('0x12')][_0x912c('0x78')](this,_0x315674[_0x912c('0xde')]);if(!_0x2cdbaf){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x315674,'no\x20variable\x20found');}if(_[_0x912c('0xa2')](_0x53ef08)){var _0xd6a4b8=this;_0x53ef08[_0x912c('0x15e')](function(_0x520fbb,_0x49ee3c){_0xd6a4b8[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')](_0x912c('0x15f'),_0x2cdbaf,_0x49ee3c),_0x520fbb);});return this['channel']['noop'](util[_0x912c('0x28')](_0x912c('0x160'),_0x2cdbaf));}else{return this[_0x912c('0x10')][_0x912c('0xa4')](_0x2cdbaf,_0x53ef08);}};AGIVertices[_0x912c('0x18')][_0x912c('0xe')]=function(_0xe1ea8e){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x161'),_0xe1ea8e[_0x912c('0xb1')]));if(_0xe1ea8e[_0x912c('0xae')]===0x0){return this[_0x912c('0xad')](_0xe1ea8e);}_0xe1ea8e['retry']-=0x1;if(!this[_0x912c('0x89')](_0xe1ea8e['file_id'])){return this['channel']['error'](_0xe1ea8e,_0x912c('0x109'));}var _0xc16e35=this[_0x912c('0x10a')][_0x912c('0x78')](this,_0xe1ea8e[_0x912c('0x108')]);if(!_0xc16e35){return this[_0x912c('0x10')]['error'](_0xe1ea8e,_0x912c('0x10b'));}var _0x37cead=this[_0x912c('0x10')][_0x912c('0x10c')](_0xc16e35,_0xe1ea8e[_0x912c('0x10d')],_0xe1ea8e[_0x912c('0x162')]);var _0x564f60=_0x37cead[_0x912c('0xab')];if(_0x37cead[_0x912c('0xab')]===-0x1){this[_0x912c('0x34')][_0x912c('0x78')](this,_0xe1ea8e,'-1');return _0x37cead;}else if(_0x37cead[_0x912c('0xa8')]===_0x912c('0x6c')){_0x37cead[_0x912c('0xab')]=_0x37cead['result'][_0x912c('0xa3')]>0x0?_0x37cead[_0x912c('0xab')]:'t';}else if(_[_0x912c('0x4b')](_0x37cead[_0x912c('0xab')])){_0x37cead[_0x912c('0xab')]='#';_0x564f60='#';}if(!this[_0x912c('0x89')](_0xe1ea8e[_0x912c('0xde')])){this['channel']['noop'](_0x912c('0xdd'));}else{var _0x468fb5=this[_0x912c('0x12')][_0x912c('0x78')](this,_0xe1ea8e[_0x912c('0xde')]);if(!_0x468fb5){return this[_0x912c('0x10')]['error'](_0xe1ea8e,_0x912c('0x110'));}this[_0x912c('0x10')][_0x912c('0xa4')](_0x468fb5,_0x564f60);}this['createSquareDetailsReport'][_0x912c('0x78')](this,_0xe1ea8e,_0x564f60);return _0x37cead;};AGIVertices[_0x912c('0x18')]['noop']=function(_0x17aeda){logger[_0x912c('0x2d')](util['format'](_0x912c('0x163'),_0x17aeda[_0x912c('0xb1')]));return this[_0x912c('0x10')]['noop'](_0x17aeda[_0x912c('0x164')]||_0x17aeda[_0x912c('0xb1')]);};AGIVertices['prototype'][_0x912c('0x165')]=function(_0x7523ab){logger[_0x912c('0x2d')](util['format'](_0x912c('0x166'),_0x7523ab[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x7523ab[_0x912c('0x152')])){return this['channel'][_0x912c('0x2b')](_0x7523ab,_0x912c('0x153'));}logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x167'),this[_0x912c('0x10')][_0x912c('0x36')],_0x7523ab[_0x912c('0x152')]));var _0x14bfbc=this['getPause'][_0x912c('0x78')](this,_0x7523ab[_0x912c('0x168')]);var _0xe8471f=this[_0x912c('0x57')][_0x912c('0x78')](this,_0x7523ab['findBy'],_0x14bfbc);if(_0xe8471f){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x912c('0x10')][_0x912c('0x36')],_0x7523ab[_0x912c('0x152')]));this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x154'),this[_0x912c('0x10')]['callerid'],_0x7523ab['findBy']));return{'code':0xc8,'result':_0x912c('0x155')};}else{logger['info'](util[_0x912c('0x28')](_0x912c('0x156'),this[_0x912c('0x10')][_0x912c('0x36')],_0x7523ab[_0x912c('0x152')]));this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x154'),this['channel'][_0x912c('0x36')],_0x7523ab['findBy']));return{'code':0xc8,'result':_0x912c('0x157')};}};AGIVertices[_0x912c('0x18')][_0x912c('0x169')]=function(_0x3f7888){logger[_0x912c('0x2d')](util['format'](_0x912c('0x16a'),_0x3f7888[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x3f7888[_0x912c('0x108')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x3f7888,_0x912c('0x109'));}var _0x35353f=this['getSound'][_0x912c('0x78')](this,_0x3f7888[_0x912c('0x108')]);if(!_0x35353f){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x3f7888,_0x912c('0x10b'));}var _0x3ae800=this[_0x912c('0x10')][_0x912c('0x5f')]('PLAYBACK',[_0x35353f,_0x3f7888[_0x912c('0xe4')]]);if(_0x3ae800[_0x912c('0xab')]===-0x1){return _0x3ae800;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xca'),_0x912c('0x16b'),_0x35353f));};AGIVertices[_0x912c('0x18')][_0x912c('0x16c')]=function(_0x417d55){logger[_0x912c('0x2d')](util['format'](_0x912c('0x16d'),_0x417d55[_0x912c('0xb1')]));if(!this['isConfigured'](_0x417d55[_0x912c('0x16e')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x417d55,_0x912c('0x16f'));}var _0x6f2d39='';var _0x578efa=parseInt(_0x417d55[_0x912c('0x16e')],0xa);if(isNaN(_0x578efa)){_0x6f2d39=_0x417d55[_0x912c('0x16e')];}else{_0x6f2d39=this[_0x912c('0x17')][_0x912c('0x78')](this,_0x417d55[_0x912c('0x16e')]);if(!_0x6f2d39){return this['channel']['error'](_0x417d55,_0x912c('0x170'));}}var _0xed4f1d='';if(this['isConfigured'](_0x417d55[_0x912c('0x108')])){var _0xebb777=this[_0x912c('0x10a')][_0x912c('0x78')](this,_0x417d55['file_id']);if(_0xebb777){_0xed4f1d=_0xebb777;}}this[_0x912c('0x34')][_0x912c('0x78')](this,_0x417d55,_0x6f2d39);if(_0x417d55[_0x912c('0xe4')][_0x912c('0x171')]('x')<0x0){_0x417d55[_0x912c('0xe4')]+='x';}if(_0x417d55[_0x912c('0xe4')][_0x912c('0x171')]('X')<0x0){_0x417d55[_0x912c('0xe4')]+='X';}this['channel'][_0x912c('0xa4')]('XMCS-QUEUE',_0x6f2d39?_0x6f2d39[_0x912c('0x172')]():'');var _0x8336ea=this['channel']['exec'](_0x912c('0x173'),[_0x6f2d39,_0x417d55[_0x912c('0xe4')],_0x417d55[_0x912c('0x6a')],_0xed4f1d,_0x417d55['timeout'],_0x417d55[_0x912c('0x9')],_0x417d55[_0x912c('0x174')],_0x417d55[_0x912c('0x175')],'',_0x417d55['position']]);if(_0x8336ea['result']===-0x1){return _0x8336ea;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x6f2d39));};AGIVertices['prototype'][_0x912c('0x176')]=function(_0x3d8d11){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x177'),_0x3d8d11[_0x912c('0xb1')]));var _0x5b1834=_0x3d8d11[_0x912c('0x178')]||_0x912c('0x136');var _0xcd582a=util[_0x912c('0x28')](_0x912c('0x179'),this[_0x912c('0x10')]['uniqueid'],rs[_0x912c('0x112')](0x5));var _0x34e4e1=util['format'](_0x912c('0x17a'),FILES_PATH,_0xcd582a,_0x5b1834);var _0x32355d=util['format'](_0x912c('0x12a'),FILES_PATH,_0xcd582a);this[_0x912c('0x37')][_0x912c('0x78')](this,_0x3d8d11,_0xcd582a,_0x34e4e1);this[_0x912c('0x10')][_0x912c('0xa4')](_0x912c('0x17b'),_0xcd582a);logger[_0x912c('0x2d')](_0x912c('0x17c'),_0x32355d,_0x5b1834,_0x3d8d11[_0x912c('0x17d')],_0x3d8d11[_0x912c('0x6c')]);return this[_0x912c('0x10')]['recordFile'](_0x32355d,_0x5b1834,_0x3d8d11[_0x912c('0x17d')],_0x3d8d11['timeout'],undefined,!![]);};AGIVertices[_0x912c('0x18')][_0x912c('0x17e')]=function(_0x55d650){logger[_0x912c('0x2d')](util['format'](_0x912c('0x17f'),_0x55d650['label']));if(!this[_0x912c('0x89')](_0x55d650[_0x912c('0x6a')])){return this[_0x912c('0x10')]['noop'](_0x912c('0x180'));}var _0xb9e9f5=this[_0x912c('0x69')][_0x912c('0x78')](this,_0x55d650);logger[_0x912c('0x2d')](util['format'](_0x912c('0x181'),util[_0x912c('0x182')](_0xb9e9f5,{'showHidden':![],'depth':null})));if(!this[_0x912c('0x89')](_0x55d650[_0x912c('0xde')])){return this['channel'][_0x912c('0xb2')](_0x912c('0x183'));}var _0xa4f8f6=this[_0x912c('0x12')][_0x912c('0x78')](this,_0x55d650[_0x912c('0xde')]);if(!_0xa4f8f6){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x55d650,_0x912c('0x110'));}this[_0x912c('0x10')][_0x912c('0xa4')](util[_0x912c('0x28')](_0x912c('0x184'),_0xa4f8f6),_0xb9e9f5[_0x912c('0x7d')]?_0xb9e9f5['statusCode']:_0x912c('0x185'));this['channel']['setVariable'](util[_0x912c('0x28')](_0x912c('0x186'),_0xa4f8f6),_0xb9e9f5[_0x912c('0x187')]?_0xb9e9f5[_0x912c('0x187')]:'OK');if(_0xb9e9f5['body']){try{this[_0x912c('0xa0')](_0xb9e9f5[_0x912c('0x72')],_0xa4f8f6);}catch(_0x56405b){logger[_0x912c('0x2b')](util[_0x912c('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xa4f8f6));}}return this['channel']['noop'](util['format'](_0x912c('0x188'),_0xa4f8f6));};AGIVertices[_0x912c('0x18')][_0x912c('0x189')]=function(_0x352eab){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x18a'),_0x352eab['label']));return this[_0x912c('0x10')][_0x912c('0x18b')](_0x352eab[_0x912c('0x18c')][_0x912c('0xdb')](/\s+/g,''),_0x352eab[_0x912c('0x17d')]);};AGIVertices[_0x912c('0x18')][_0x912c('0x18d')]=function(_0x1570ad){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1570ad[_0x912c('0xb1')]));return this[_0x912c('0x10')][_0x912c('0x18e')](_0x1570ad[_0x912c('0x6d')]['replace'](/\s+/g,''),_0x1570ad['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x4a287e){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x18f'),_0x4a287e[_0x912c('0xb1')]));return this[_0x912c('0x10')][_0x912c('0x190')](_0x4a287e[_0x912c('0x62')],_0x4a287e[_0x912c('0x17d')]);};AGIVertices[_0x912c('0x18')][_0x912c('0x191')]=function(_0x263a98){logger[_0x912c('0x2d')](util['format'](_0x912c('0x192'),_0x263a98['label']));if(!this[_0x912c('0x89')](_0x263a98[_0x912c('0x193')])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x194'));}var _0x16ad90=this['getMailAccount'][_0x912c('0x78')](this,_0x263a98[_0x912c('0x193')]);if(!_0x16ad90||!_0x16ad90[_0x912c('0x195')]){return this[_0x912c('0x10')]['error'](_0x263a98,_0x912c('0x196'));}var _0x48f4d1={'from':util[_0x912c('0x28')]('\x22%s\x22\x20<%s>',_0x16ad90[_0x912c('0x15')],_0x16ad90[_0x912c('0x197')]||_0x16ad90[_0x912c('0x195')][_0x912c('0x198')]),'to':_0x263a98['to']||'','cc':_0x263a98['cc']||'','bcc':_0x263a98['bcc']||'','subject':_0x263a98['subject'],'html':_0x263a98['text'],'text':_0x263a98[_0x912c('0x62')]};var _0x4c42e7={'tls':{'rejectUnauthorized':![]}};if(_0x16ad90['Smtp'][_0x912c('0x199')]){_0x4c42e7['service']=_0x16ad90[_0x912c('0x195')][_0x912c('0x199')];}else{_0x4c42e7[_0x912c('0x19a')]=_0x16ad90[_0x912c('0x195')][_0x912c('0x19a')];_0x4c42e7[_0x912c('0x19b')]=_0x16ad90[_0x912c('0x195')][_0x912c('0x19b')];_0x4c42e7[_0x912c('0x19c')]=_0x16ad90[_0x912c('0x195')][_0x912c('0x19c')];}if(_0x16ad90[_0x912c('0x195')][_0x912c('0x19d')]){_0x4c42e7['auth']={'user':_0x16ad90['Smtp']['user'],'pass':_0x16ad90[_0x912c('0x195')][_0x912c('0x19e')]};}if(this[_0x912c('0x89')](_0x263a98['template_id'])){}logger[_0x912c('0xe0')](_0x912c('0x19f'),JSON[_0x912c('0x7b')](_0x48f4d1));this[_0x912c('0x34')]['sync'](this,_0x263a98,_0x263a98['account_id']);this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x1a0'),_0x16ad90['name']));this['sendMailMessage'][_0x912c('0x78')](this,_0x4c42e7,_0x48f4d1);return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x1a1'));};AGIVertices[_0x912c('0x18')]['sendFax']=function(_0x49fb2b){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x49fb2b[_0x912c('0xb1')]));return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x1a2'));};AGIVertices[_0x912c('0x18')]['sendSMS']=function(_0x27080e){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x1a3'),_0x27080e[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x27080e['sms_account_id'])){return this['channel'][_0x912c('0xb2')](_0x912c('0x1a4'));}var _0x29f37f=this[_0x912c('0x32')]['sync'](this,_0x27080e[_0x912c('0x1a5')]);if(!_0x29f37f){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x27080e,_0x912c('0x1a6'));}var _0xad0a7b={'body':_0x27080e[_0x912c('0x1a7')],'phone':_0x27080e['to']||'','SmsAccountId':_0x29f37f['id']};logger[_0x912c('0xe0')]('sendSMS\x20message',JSON[_0x912c('0x7b')](_0xad0a7b));this[_0x912c('0x34')][_0x912c('0x78')](this,_0x27080e,_0x27080e['sms_account_id']);this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x1a8'),_0x29f37f[_0x912c('0x15')]));this[_0x912c('0x33')][_0x912c('0x78')](this,_0xad0a7b);return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x1a9'));};AGIVertices['prototype'][_0x912c('0x1aa')]=function(_0x636bbf){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x636bbf[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x636bbf[_0x912c('0xde')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x636bbf,_0x912c('0x1ab'));}var _0x23ce9b=this[_0x912c('0x12')]['sync'](this,_0x636bbf[_0x912c('0xde')]);if(!_0x23ce9b){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x636bbf,'no\x20variable\x20found');}return this[_0x912c('0x10')][_0x912c('0xa4')](_0x23ce9b,_0x636bbf[_0x912c('0x1ac')]);};AGIVertices['prototype'][_0x912c('0x1ad')]=function(_0x5a459a){logger[_0x912c('0x2d')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x5a459a['label']));this['channel']['noop'](_0x912c('0x1ae'));if(_0x5a459a[_0x912c('0xc3')]===_0x912c('0x1af')){this['channel'][_0x912c('0xb2')]('Answer');return this[_0x912c('0x10')][_0x912c('0xc3')]();}return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0x1b0'));};AGIVertices[_0x912c('0x18')][_0x912c('0x1b1')]=function(_0x4cff75){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x1b2'),_0x4cff75[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x4cff75[_0x912c('0x1b3')])){return this[_0x912c('0x10')]['error'](_0x4cff75,_0x912c('0x1b4'));}var _0x57a9d1=this['getSquareProject'][_0x912c('0x78')](this,_0x4cff75[_0x912c('0x1b3')]);if(!this[_0x912c('0x89')](_0x57a9d1)){return this['channel']['error'](_0x4cff75,util[_0x912c('0x28')](_0x912c('0x1b5'),_0x4cff75[_0x912c('0x1b3')]));}if(_0x57a9d1===this[_0x912c('0x10')][_0x912c('0x3d')]){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x4cff75,_0x912c('0x1b6'));}this[_0x912c('0x34')][_0x912c('0x78')](this,_0x4cff75,_0x57a9d1);var _0x1a6ffa=this[_0x912c('0x10')][_0x912c('0x5f')]('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x912c('0x19a')]||_0x912c('0x1b7'),_0x57a9d1,this[_0x912c('0x10')][_0x912c('0x3d')]));if(_0x1a6ffa[_0x912c('0xab')]===-0x1){return _0x1a6ffa;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xca'),_0x912c('0x1b8'),_0x57a9d1));};AGIVertices[_0x912c('0x18')][_0x912c('0x1b9')]=function(_0x455cec){logger[_0x912c('0x2d')](util['format'](_0x912c('0x1ba'),_0x455cec[_0x912c('0xb1')]));var _0x48b2f8=this[_0x912c('0x5e')][_0x912c('0x78')](this,_0x455cec[_0x912c('0xc0')]);this[_0x912c('0x34')][_0x912c('0x78')](this,_0x455cec,_0x455cec['command']);if(this['isConfigured'](_0x455cec[_0x912c('0xde')])){var _0x3cfdb3=this['getVariable'][_0x912c('0x78')](this,_0x455cec[_0x912c('0xde')]);if(_0x3cfdb3){this[_0x912c('0x10')][_0x912c('0xa4')](_0x3cfdb3,_0x48b2f8);return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x1bb'),_0x455cec[_0x912c('0xc0')],_0x3cfdb3));}}return this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0x1bc'),_0x455cec[_0x912c('0xc0')]));};AGIVertices[_0x912c('0x18')][_0x912c('0x1bd')]=function(_0x25668b){logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x1be'),_0x25668b[_0x912c('0xb1')]));_0x25668b[_0x912c('0x62')]=_0x25668b[_0x912c('0x62')][_0x912c('0xdb')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x912c('0x89')](_0x25668b[_0x912c('0x1bf')])){return this['channel'][_0x912c('0xb2')](_0x912c('0x1c0'));}if(!this['isConfigured'](_0x25668b['text'])){return this[_0x912c('0x10')][_0x912c('0xb2')](_0x912c('0xb3'));}this[_0x912c('0x10')]['noop'](util['format'](_0x912c('0x1c1'),_0x25668b[_0x912c('0x62')]));var _0x3785cc=this['googleCloudTTS']['sync'](this,_0x25668b);if(_0x3785cc){this[_0x912c('0x10')]['noop'](util[_0x912c('0x28')](_0x912c('0x1c2'),_0x3785cc));var _0x3eb97b=this[_0x912c('0x10')][_0x912c('0xf7')](_0x3785cc);try{fs[_0x912c('0xf8')](_0x3785cc+_0x912c('0xf9'));}catch(_0x4365e3){logger['error'](_0x4365e3);}return _0x3eb97b;}return this['channel'][_0x912c('0x2b')](_0x25668b,_0x912c('0x1c3'));};AGIVertices['prototype'][_0x912c('0x1c4')]=function(_0x3f8af3){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3f8af3[_0x912c('0xb1')]));_0x3f8af3[_0x912c('0x62')]=_0x3f8af3[_0x912c('0x62')][_0x912c('0xdb')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x912c('0x89')](_0x3f8af3['text'])){return this['channel']['noop'](_0x912c('0xb3'));}this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0x1c5'),_0x3f8af3['text']));var _0x56e83b=this[_0x912c('0x67')][_0x912c('0x78')](this,_0x3f8af3);if(_0x56e83b){this[_0x912c('0x10')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x56e83b));var _0x2396df=this[_0x912c('0x10')][_0x912c('0xf7')](_0x56e83b);try{fs['unlink'](_0x56e83b+'.wav');}catch(_0x480476){logger[_0x912c('0x2b')](_0x480476);}return _0x2396df;}return this[_0x912c('0x10')][_0x912c('0x2b')](_0x3f8af3,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x912c('0x18')][_0x912c('0x1c6')]=function(_0x93aed){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x93aed[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x93aed[_0x912c('0x152')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x93aed,_0x912c('0x153'));}logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x167'),this['channel'][_0x912c('0x36')],_0x93aed[_0x912c('0x152')]));var _0x537a1f=this[_0x912c('0x59')][_0x912c('0x78')](this,_0x93aed[_0x912c('0x152')]);if(_0x537a1f){logger['info'](util[_0x912c('0x28')](_0x912c('0x154'),this[_0x912c('0x10')][_0x912c('0x36')],_0x93aed[_0x912c('0x152')]));this['channel'][_0x912c('0xb2')](util['format'](_0x912c('0x154'),this[_0x912c('0x10')]['callerid'],_0x93aed[_0x912c('0x152')]));return{'code':0xc8,'result':_0x912c('0x155')};}else{logger[_0x912c('0x2d')](util[_0x912c('0x28')](_0x912c('0x156'),this[_0x912c('0x10')]['callerid'],_0x93aed[_0x912c('0x152')]));this['channel'][_0x912c('0xb2')](util[_0x912c('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x912c('0x10')][_0x912c('0x36')],_0x93aed[_0x912c('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x912c('0x18')][_0x912c('0x1c7')]=function(_0x4f1741){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4f1741['label']));var _0x13e1f6=this[_0x912c('0x10')][_0x912c('0x5f')](_0x912c('0x1c8'),[_0x4f1741[_0x912c('0x1c9')],_0x4f1741[_0x912c('0x80')]]);if(_0x13e1f6['result']===-0x1){return _0x13e1f6;}return this[_0x912c('0x10')][_0x912c('0xb2')](util[_0x912c('0x28')](_0x912c('0xca'),_0x912c('0x1c8'),_0x4f1741['mailbox']));};AGIVertices[_0x912c('0x18')][_0x912c('0x1ca')]=function(_0x5db02f){logger[_0x912c('0x2d')](util[_0x912c('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5db02f[_0x912c('0xb1')]));if(!this[_0x912c('0x89')](_0x5db02f[_0x912c('0xde')])){return this[_0x912c('0x10')][_0x912c('0x2b')](_0x5db02f,_0x912c('0x1ab'));}var _0x4e8531=this[_0x912c('0x12')][_0x912c('0x78')](this,_0x5db02f[_0x912c('0xde')]);if(!_0x4e8531){return this[_0x912c('0x10')]['error'](_0x5db02f,_0x912c('0x110'));}var _0xe1194f=this[_0x912c('0x10')][_0x912c('0x12')](_0x4e8531);return{'code':0xc8,'result':_0xe1194f[_0x912c('0xa8')]?_0xe1194f[_0x912c('0xa8')]:'-'};};String[_0x912c('0x18')][_0x912c('0xa7')]=function(_0x5b76ab,_0x429004){return this[_0x912c('0xa5')](_0x5b76ab)[_0x912c('0x1cb')](_0x429004);};module[_0x912c('0x1cc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 62124a0..725823e 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 _0xedd9=['Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','stopAcw','[TIMER][STOP][AGENT:%s]','stringify','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x28ddc1,_0x340a0a){var _0x115d3e=function(_0x45ee18){while(--_0x45ee18){_0x28ddc1['push'](_0x28ddc1['shift']());}};_0x115d3e(++_0x340a0a);}(_0xedd9,0xfc));var _0x9edd=function(_0x16de1f,_0x38bb41){_0x16de1f=_0x16de1f-0x0;var _0x4477cd=_0xedd9[_0x16de1f];return _0x4477cd;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var ami=require(_0x9edd('0x2'));var logger=require(_0x9edd('0x3'))(_0x9edd('0x4'));var RpcUser=require(_0x9edd('0x5'));var RpcVoiceAgentReport=require(_0x9edd('0x6'));function Acw(_0x36b53f){this['voiceQueues']=_0x36b53f[_0x9edd('0x7')];this[_0x9edd('0x8')]=_0x36b53f[_0x9edd('0x8')];this[_0x9edd('0x9')]=_0x36b53f['timers'];this[_0x9edd('0xa')]={};ami['on']('agentconnect',this[_0x9edd('0xb')][_0x9edd('0xc')](this));ami['on'](_0x9edd('0xd'),this[_0x9edd('0xe')]['bind'](this));ami['on'](_0x9edd('0xf'),this['syncHangup'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x10'),this['syncAgentRingNoAnswer'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x11'),this['syncAttendedTransfer'][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x12'),this[_0x9edd('0x13')][_0x9edd('0xc')](this));ami['on'](_0x9edd('0x14'),this[_0x9edd('0x15')][_0x9edd('0xc')](this));}function getDiff(_0xef5498){var _0x47eb64=moment()[_0x9edd('0x16')](0x0);var _0x44fc7c=moment(_0xef5498)[_0x9edd('0x16')](0x0);return _0x47eb64[_0x9edd('0x17')](_0x44fc7c,_0x9edd('0x18'));}Acw[_0x9edd('0x19')][_0x9edd('0x1a')]=function(_0x75a4ab){try{var _0x4ea60f=this;var _0x5f5bf4=this[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x1b')];var _0x5acf65=this[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x1c')];var _0x40ba32=this['voiceQueues'][_0x5acf65];var _0x43dc70=![];var _0x5d879c=_0x9edd('0x1d');if(_0x40ba32[_0x9edd('0x1e')]){if(_0x40ba32['mandatoryDispositionPause']['name']){_0x43dc70=!![];_0x5d879c=_0x40ba32[_0x9edd('0x1f')]['name'];}}ami[_0x9edd('0x20')]({'action':'QueuePause','interface':_0x5f5bf4,'paused':!![],'reason':_0x5d879c})['then'](function(_0x356751){if(_0x4ea60f[_0x9edd('0x8')][_0x5f5bf4]){return RpcUser['getAgent'](_0x4ea60f['agents'][_0x5f5bf4]['id'])[_0x9edd('0x21')](function(_0x186186){if(_0x186186&&!_0x186186[_0x9edd('0x22')]){logger['info'](_0x9edd('0x23'),_0x75a4ab,_0x5f5bf4,_0x5acf65);var _0x1dca43=_0x4ea60f[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x24')]&&_0x4ea60f[_0x9edd('0xa')][_0x75a4ab]['destlinkedid']?_0x4ea60f[_0x9edd('0xa')][_0x75a4ab][_0x9edd('0x25')]:_0x75a4ab;return RpcUser[_0x9edd('0x26')](_0x4ea60f[_0x9edd('0x8')][_0x5f5bf4],_0x5d879c,_0x1dca43)[_0x9edd('0x21')](function(_0x4d507f){if(!_0x43dc70){_0x4ea60f['timers'][_0x5f5bf4]={};logger[_0x9edd('0x27')](_0x9edd('0x28'),_0x75a4ab,_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')],_0x5f5bf4,_0x5acf65);_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4]['timer']=setTimeout(_0x4ea60f['stopAcw'][_0x9edd('0xc')](_0x4ea60f,_0x5f5bf4),_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')]*0x3e8);_0x4ea60f['timers'][_0x5f5bf4][_0x9edd('0x2a')]=moment()[_0x9edd('0x2b')](_0x9edd('0x2c'));_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4]['uniqueid']=_0x75a4ab;_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x1c')]=_0x5acf65;_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2d')]=function(){var _0xbbf08f=getDiff(_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2a')]);clearTimeout(_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2e')]);_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x2e')]=![];RpcVoiceAgentReport[_0x9edd('0x2f')]({'acwtime':_0xbbf08f},_0x4ea60f[_0x9edd('0x9')][_0x5f5bf4][_0x9edd('0x30')],_0x5f5bf4)[_0x9edd('0x21')](function(_0x5af178){logger[_0x9edd('0x27')](_0x9edd('0x31'),_0x75a4ab,_0xbbf08f,_0x5af178);})[_0x9edd('0x32')](function(_0x5d1707){logger[_0x9edd('0x33')](_0x9edd('0x34'),_0x75a4ab,_0x5d1707);});delete _0x4ea60f[_0x9edd('0x9')][_0x5f5bf4];};}});}else{logger[_0x9edd('0x27')](_0x9edd('0x35'),_0x75a4ab,_0x5f5bf4,_0x5acf65);}});}})[_0x9edd('0x32')](function(_0x473068){logger[_0x9edd('0x33')](_0x9edd('0x28'),_0x75a4ab,_0x4ea60f[_0x9edd('0x7')][_0x5acf65][_0x9edd('0x29')],_0x5f5bf4,_0x5acf65);})[_0x9edd('0x36')](function(){delete _0x4ea60f[_0x9edd('0xa')][_0x75a4ab];});}catch(_0x14f780){logger['error'](_0x9edd('0x37'),_0x14f780['message']);}};Acw[_0x9edd('0x19')][_0x9edd('0x38')]=function(_0x10d6fd){try{var _0x434d26=this;if(_0x434d26[_0x9edd('0x9')][_0x10d6fd]){_0x434d26['timers'][_0x10d6fd][_0x9edd('0x2e')]=![];var _0x44dbfc=_0x434d26[_0x9edd('0x9')][_0x10d6fd][_0x9edd('0x30')];var _0x1be77f=_0x434d26[_0x9edd('0x9')][_0x10d6fd][_0x9edd('0x1c')];var _0x1cbbac=_0x434d26[_0x9edd('0x7')][_0x1be77f][_0x9edd('0x29')];logger['info'](_0x9edd('0x39'),_0x10d6fd);RpcUser['saveUnpause'](this[_0x9edd('0x8')][_0x10d6fd]);RpcVoiceAgentReport['update']({'acwtime':_0x1cbbac,'agentacw':!![]},_0x44dbfc,_0x10d6fd)[_0x9edd('0x21')](function(_0x2858b5){logger[_0x9edd('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0x44dbfc,_0x1cbbac,_0x2858b5);})[_0x9edd('0x32')](function(_0xcbd0ef){logger[_0x9edd('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x44dbfc,_0xcbd0ef);});}else{logger[_0x9edd('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x10d6fd);if(_0x434d26[_0x9edd('0x9')]){logger[_0x9edd('0x27')]('[ACW][TIMERS]',JSON[_0x9edd('0x3a')](_0x434d26[_0x9edd('0x9')]));}}}catch(_0x389f51){logger[_0x9edd('0x33')]('[ACW][STOP]\x20%s',_0x389f51[_0x9edd('0x3b')]);}};Acw['prototype'][_0x9edd('0xb')]=function(_0xc1e657){try{if(this['voiceQueues'][_0xc1e657[_0x9edd('0x1c')]]&&(this['voiceQueues'][_0xc1e657['queue']][_0x9edd('0x4')]||this[_0x9edd('0x7')][_0xc1e657[_0x9edd('0x1c')]][_0x9edd('0x1e')])){if(this[_0x9edd('0x8')][_0xc1e657[_0x9edd('0x1b')]]){this[_0x9edd('0xa')][_0xc1e657[_0x9edd('0x30')]]={'queue':_0xc1e657[_0x9edd('0x1c')],'interface':_0xc1e657[_0x9edd('0x1b')],'destlinkedid':_0xc1e657[_0x9edd('0x25')]};}}}catch(_0x3be90c){logger[_0x9edd('0x33')](_0x9edd('0x3c'),_0x3be90c[_0x9edd('0x3b')]);}};Acw['prototype'][_0x9edd('0x15')]=function(_0x2570e3){try{if(this[_0x9edd('0x7')][_0x2570e3[_0x9edd('0x1c')]]&&(this[_0x9edd('0x7')][_0x2570e3[_0x9edd('0x1c')]][_0x9edd('0x4')]||this['voiceQueues'][_0x2570e3['queue']]['mandatoryDisposition'])){if(this[_0x9edd('0x8')][_0x2570e3['interface']]){this[_0x9edd('0xa')][_0x2570e3[_0x9edd('0x30')]]={'queue':_0x2570e3[_0x9edd('0x1c')],'interface':_0x2570e3[_0x9edd('0x1b')]};}}}catch(_0x367791){logger['error'](_0x9edd('0x3d'),_0x367791[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncHangupRequest']=function(_0x3626bc){try{if(this[_0x9edd('0xa')][_0x3626bc[_0x9edd('0x30')]]&&_[_0x9edd('0x3e')](this[_0x9edd('0xa')][_0x3626bc[_0x9edd('0x30')]]['attended'])){logger[_0x9edd('0x27')](_0x9edd('0x3f'),_0x3626bc['uniqueid']);this[_0x9edd('0x1a')](_0x3626bc[_0x9edd('0x30')]);}else if(this['channels'][_0x3626bc[_0x9edd('0x40')]]&&_[_0x9edd('0x3e')](this[_0x9edd('0xa')][_0x3626bc['linkedid']][_0x9edd('0x24')])){logger[_0x9edd('0x27')](_0x9edd('0x41'),_0x3626bc[_0x9edd('0x40')]);this['startAcw'](_0x3626bc[_0x9edd('0x40')]);}}catch(_0x527727){logger[_0x9edd('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x527727[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncHangup']=function(_0x8e59bd){try{if(this['channels'][_0x8e59bd[_0x9edd('0x30')]]&&this[_0x9edd('0xa')][_0x8e59bd[_0x9edd('0x30')]][_0x9edd('0x24')]){logger[_0x9edd('0x27')](_0x9edd('0x42'),_0x8e59bd[_0x9edd('0x30')]);this[_0x9edd('0x1a')](_0x8e59bd[_0x9edd('0x30')]);}else if(this[_0x9edd('0xa')][_0x8e59bd[_0x9edd('0x40')]]&&this['channels'][_0x8e59bd[_0x9edd('0x40')]][_0x9edd('0x24')]){logger[_0x9edd('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x8e59bd[_0x9edd('0x40')]);this['startAcw'](_0x8e59bd['linkedid']);}}catch(_0x54ecfa){logger[_0x9edd('0x33')](_0x9edd('0x43'),_0x54ecfa[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncAttendedTransfer']=function(_0x56b38b){try{if(!_['isNil'](this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x44')]])){this[_0x9edd('0x1a')](_0x56b38b[_0x9edd('0x44')]);if(this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]]){this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]]['attended']=!![];this[_0x9edd('0xa')][_0x56b38b['transfertargetuniqueid']]=this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x45')]];delete this['channels'][_0x56b38b[_0x9edd('0x45')]];}}else if(!_[_0x9edd('0x46')](this[_0x9edd('0xa')][_0x56b38b['transfertargetuniqueid']])){this[_0x9edd('0x1a')](_0x56b38b[_0x9edd('0x47')]);if(this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]]){this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]]['attended']=!![];this['channels'][_0x56b38b[_0x9edd('0x44')]]=this['channels'][_0x56b38b[_0x9edd('0x48')]];delete this[_0x9edd('0xa')][_0x56b38b[_0x9edd('0x48')]];}}}catch(_0x17d2f2){logger['error'](_0x9edd('0x49'),_0x17d2f2['message']);}};Acw[_0x9edd('0x19')][_0x9edd('0x13')]=function(_0xc6bde6){try{if(this['channels'][_0xc6bde6[_0x9edd('0x4a')]]){logger['info'](_0x9edd('0x4b'),JSON[_0x9edd('0x3a')](_0xc6bde6['transfereruniqueid']));this[_0x9edd('0x1a')](_0xc6bde6['transfereruniqueid']);}else if(this[_0x9edd('0xa')][_0xc6bde6[_0x9edd('0x4c')]]){logger[_0x9edd('0x27')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x9edd('0x3a')](_0xc6bde6[_0x9edd('0x4c')]));this[_0x9edd('0x1a')](_0xc6bde6[_0x9edd('0x4c')]);}}catch(_0x467512){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x467512[_0x9edd('0x3b')]);}};Acw[_0x9edd('0x19')]['syncAgentRingNoAnswer']=function(_0x5496e9){try{if(this['voiceQueues'][_0x5496e9[_0x9edd('0x1c')]]&&this['voiceQueues'][_0x5496e9['queue']][_0x9edd('0x4d')]===_0x9edd('0x4e')){if(this['agents'][_0x5496e9[_0x9edd('0x1b')]]){logger[_0x9edd('0x27')](_0x9edd('0x4f'),_0x5496e9['uniqueid'],_0x5496e9[_0x9edd('0x1b')],_0x5496e9['queue']);return RpcUser[_0x9edd('0x26')](this[_0x9edd('0x8')][_0x5496e9['interface']],_0x9edd('0x50'),_0x5496e9[_0x9edd('0x30')]);}}}catch(_0x5c1746){logger[_0x9edd('0x33')](_0x9edd('0x51'),_0x5c1746[_0x9edd('0x3b')]);}};module[_0x9edd('0x52')]=Acw; \ No newline at end of file +var _0x4c4e=['hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','lastPauseAt','timer','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','uniqueid','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','destlinkedid','[ACW][syncAgentConnect]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','exports','util','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest'];(function(_0x5f25b8,_0x1c14ad){var _0x3eedd1=function(_0x5abf04){while(--_0x5abf04){_0x5f25b8['push'](_0x5f25b8['shift']());}};_0x3eedd1(++_0x1c14ad);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2ff867,_0x8a57e6){_0x2ff867=_0x2ff867-0x0;var _0x3ccb0a=_0x4c4e[_0x2ff867];return _0x3ccb0a;};'use strict';var util=require(_0xe4c4('0x0'));var _=require('lodash');var moment=require(_0xe4c4('0x1'));var ami=require(_0xe4c4('0x2'));var logger=require(_0xe4c4('0x3'))('acw');var RpcUser=require(_0xe4c4('0x4'));var RpcVoiceAgentReport=require(_0xe4c4('0x5'));function Acw(_0x1a4483){this['voiceQueues']=_0x1a4483[_0xe4c4('0x6')];this['agents']=_0x1a4483[_0xe4c4('0x7')];this[_0xe4c4('0x8')]=_0x1a4483[_0xe4c4('0x8')];this[_0xe4c4('0x9')]={};ami['on'](_0xe4c4('0xa'),this[_0xe4c4('0xb')][_0xe4c4('0xc')](this));ami['on'](_0xe4c4('0xd'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe4c4('0xe'),this[_0xe4c4('0xf')][_0xe4c4('0xc')](this));ami['on'](_0xe4c4('0x10'),this[_0xe4c4('0x11')][_0xe4c4('0xc')](this));ami['on']('attendedtransfer',this[_0xe4c4('0x12')][_0xe4c4('0xc')](this));ami['on'](_0xe4c4('0x13'),this[_0xe4c4('0x14')]['bind'](this));ami['on'](_0xe4c4('0x15'),this[_0xe4c4('0x16')]['bind'](this));}function getDiff(_0xe485ca){var _0x1a44e5=moment()['milliseconds'](0x0);var _0x42ce9e=moment(_0xe485ca)[_0xe4c4('0x17')](0x0);return _0x1a44e5['diff'](_0x42ce9e,_0xe4c4('0x18'));}Acw[_0xe4c4('0x19')][_0xe4c4('0x1a')]=function(_0x40a36e){try{var _0x19e59b=this;var _0x882be2=this[_0xe4c4('0x9')][_0x40a36e][_0xe4c4('0x1b')];var _0x34ecbe=this[_0xe4c4('0x9')][_0x40a36e][_0xe4c4('0x1c')];var _0x42242c=this[_0xe4c4('0x6')][_0x34ecbe];var _0x43a9ce=![];var _0x376585='ACW';if(_0x42242c[_0xe4c4('0x1d')]){if(_0x42242c[_0xe4c4('0x1e')][_0xe4c4('0x1f')]){_0x43a9ce=!![];_0x376585=_0x42242c[_0xe4c4('0x1e')]['name'];}}ami[_0xe4c4('0x20')]({'action':_0xe4c4('0x21'),'interface':_0x882be2,'paused':!![],'reason':_0x376585})[_0xe4c4('0x22')](function(_0x30d56a){if(_0x19e59b[_0xe4c4('0x7')][_0x882be2]){return RpcUser[_0xe4c4('0x23')](_0x19e59b[_0xe4c4('0x7')][_0x882be2]['id'])[_0xe4c4('0x22')](function(_0x21bbb1){if(_0x21bbb1&&!_0x21bbb1[_0xe4c4('0x24')]){logger[_0xe4c4('0x25')](_0xe4c4('0x26'),_0x40a36e,_0x882be2,_0x34ecbe);var _0x138ead=_0x19e59b[_0xe4c4('0x9')][_0x40a36e][_0xe4c4('0x27')]&&_0x19e59b['channels'][_0x40a36e]['destlinkedid']?_0x19e59b[_0xe4c4('0x9')][_0x40a36e]['destlinkedid']:_0x40a36e;return RpcUser[_0xe4c4('0x28')](_0x19e59b['agents'][_0x882be2],_0x376585,_0x138ead)[_0xe4c4('0x22')](function(_0x5efc4c){if(!_0x43a9ce){_0x19e59b[_0xe4c4('0x8')][_0x882be2]={};logger['info'](_0xe4c4('0x29'),_0x40a36e,_0x19e59b['voiceQueues'][_0x34ecbe]['acwTimeout'],_0x882be2,_0x34ecbe);_0x19e59b['timers'][_0x882be2]['timer']=setTimeout(_0x19e59b[_0xe4c4('0x2a')]['bind'](_0x19e59b,_0x882be2),_0x19e59b['voiceQueues'][_0x34ecbe][_0xe4c4('0x2b')]*0x3e8);_0x19e59b[_0xe4c4('0x8')][_0x882be2]['lastPauseAt']=moment()['format'](_0xe4c4('0x2c'));_0x19e59b[_0xe4c4('0x8')][_0x882be2]['uniqueid']=_0x40a36e;_0x19e59b[_0xe4c4('0x8')][_0x882be2][_0xe4c4('0x1c')]=_0x34ecbe;_0x19e59b[_0xe4c4('0x8')][_0x882be2]['updateAcw']=function(){var _0x5d49fd=getDiff(_0x19e59b[_0xe4c4('0x8')][_0x882be2][_0xe4c4('0x2d')]);clearTimeout(_0x19e59b[_0xe4c4('0x8')][_0x882be2][_0xe4c4('0x2e')]);_0x19e59b['timers'][_0x882be2]['timer']=![];RpcVoiceAgentReport[_0xe4c4('0x2f')]({'acwtime':_0x5d49fd},_0x19e59b[_0xe4c4('0x8')][_0x882be2]['uniqueid'],_0x882be2)[_0xe4c4('0x22')](function(_0x1ad3e6){logger[_0xe4c4('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x40a36e,_0x5d49fd,_0x1ad3e6);})[_0xe4c4('0x30')](function(_0x5976bc){logger[_0xe4c4('0x31')](_0xe4c4('0x32'),_0x40a36e,_0x5976bc);});delete _0x19e59b[_0xe4c4('0x8')][_0x882be2];};}});}else{logger[_0xe4c4('0x25')](_0xe4c4('0x33'),_0x40a36e,_0x882be2,_0x34ecbe);}});}})[_0xe4c4('0x30')](function(_0xb801c8){logger[_0xe4c4('0x31')](_0xe4c4('0x29'),_0x40a36e,_0x19e59b[_0xe4c4('0x6')][_0x34ecbe][_0xe4c4('0x2b')],_0x882be2,_0x34ecbe);})[_0xe4c4('0x34')](function(){delete _0x19e59b['channels'][_0x40a36e];});}catch(_0x21fce3){logger[_0xe4c4('0x31')](_0xe4c4('0x35'),_0x21fce3['message']);}};Acw[_0xe4c4('0x19')][_0xe4c4('0x2a')]=function(_0x38644c){try{var _0x53eb5b=this;if(_0x53eb5b[_0xe4c4('0x8')][_0x38644c]){_0x53eb5b[_0xe4c4('0x8')][_0x38644c][_0xe4c4('0x2e')]=![];var _0x1de955=_0x53eb5b[_0xe4c4('0x8')][_0x38644c][_0xe4c4('0x36')];var _0x2f8a21=_0x53eb5b[_0xe4c4('0x8')][_0x38644c][_0xe4c4('0x1c')];var _0x8b5bf3=_0x53eb5b['voiceQueues'][_0x2f8a21][_0xe4c4('0x2b')];logger[_0xe4c4('0x25')](_0xe4c4('0x37'),_0x38644c);RpcUser[_0xe4c4('0x38')](this['agents'][_0x38644c]);RpcVoiceAgentReport[_0xe4c4('0x2f')]({'acwtime':_0x8b5bf3,'agentacw':!![]},_0x1de955,_0x38644c)[_0xe4c4('0x22')](function(_0x4e6bd9){logger[_0xe4c4('0x25')](_0xe4c4('0x39'),_0x1de955,_0x8b5bf3,_0x4e6bd9);})['catch'](function(_0x433f0c){logger[_0xe4c4('0x31')](_0xe4c4('0x32'),_0x1de955,_0x433f0c);});}else{logger[_0xe4c4('0x31')](_0xe4c4('0x3a'),_0x38644c);if(_0x53eb5b[_0xe4c4('0x8')]){logger[_0xe4c4('0x25')](_0xe4c4('0x3b'),JSON[_0xe4c4('0x3c')](_0x53eb5b[_0xe4c4('0x8')]));}}}catch(_0x221a50){logger[_0xe4c4('0x31')]('[ACW][STOP]\x20%s',_0x221a50[_0xe4c4('0x3d')]);}};Acw[_0xe4c4('0x19')][_0xe4c4('0xb')]=function(_0x2e4c44){try{if(this[_0xe4c4('0x6')][_0x2e4c44[_0xe4c4('0x1c')]]&&(this['voiceQueues'][_0x2e4c44[_0xe4c4('0x1c')]]['acw']||this[_0xe4c4('0x6')][_0x2e4c44[_0xe4c4('0x1c')]][_0xe4c4('0x1d')])){if(this[_0xe4c4('0x7')][_0x2e4c44[_0xe4c4('0x1b')]]){this['channels'][_0x2e4c44['uniqueid']]={'queue':_0x2e4c44[_0xe4c4('0x1c')],'interface':_0x2e4c44[_0xe4c4('0x1b')],'destlinkedid':_0x2e4c44[_0xe4c4('0x3e')]};}}}catch(_0x5ab715){logger[_0xe4c4('0x31')](_0xe4c4('0x3f'),_0x5ab715[_0xe4c4('0x3d')]);}};Acw[_0xe4c4('0x19')]['syncAgentConnectPreview']=function(_0x18c9ad){try{if(this[_0xe4c4('0x6')][_0x18c9ad[_0xe4c4('0x1c')]]&&(this[_0xe4c4('0x6')][_0x18c9ad[_0xe4c4('0x1c')]][_0xe4c4('0x40')]||this[_0xe4c4('0x6')][_0x18c9ad[_0xe4c4('0x1c')]][_0xe4c4('0x1d')])){if(this['agents'][_0x18c9ad[_0xe4c4('0x1b')]]){this['channels'][_0x18c9ad[_0xe4c4('0x36')]]={'queue':_0x18c9ad[_0xe4c4('0x1c')],'interface':_0x18c9ad[_0xe4c4('0x1b')]};}}}catch(_0x15e595){logger[_0xe4c4('0x31')](_0xe4c4('0x41'),_0x15e595[_0xe4c4('0x3d')]);}};Acw[_0xe4c4('0x19')][_0xe4c4('0x42')]=function(_0x18fb82){try{if(this[_0xe4c4('0x9')][_0x18fb82[_0xe4c4('0x36')]]&&_[_0xe4c4('0x43')](this[_0xe4c4('0x9')][_0x18fb82['uniqueid']]['attended'])){logger[_0xe4c4('0x25')](_0xe4c4('0x44'),_0x18fb82['uniqueid']);this[_0xe4c4('0x1a')](_0x18fb82[_0xe4c4('0x36')]);}else if(this[_0xe4c4('0x9')][_0x18fb82[_0xe4c4('0x45')]]&&_[_0xe4c4('0x43')](this['channels'][_0x18fb82[_0xe4c4('0x45')]][_0xe4c4('0x27')])){logger['info'](_0xe4c4('0x46'),_0x18fb82[_0xe4c4('0x45')]);this['startAcw'](_0x18fb82[_0xe4c4('0x45')]);}}catch(_0x53699d){logger[_0xe4c4('0x31')](_0xe4c4('0x47'),_0x53699d[_0xe4c4('0x3d')]);}};Acw[_0xe4c4('0x19')][_0xe4c4('0xf')]=function(_0x525534){try{if(this[_0xe4c4('0x9')][_0x525534[_0xe4c4('0x36')]]&&this[_0xe4c4('0x9')][_0x525534[_0xe4c4('0x36')]][_0xe4c4('0x27')]){logger[_0xe4c4('0x25')](_0xe4c4('0x48'),_0x525534[_0xe4c4('0x36')]);this[_0xe4c4('0x1a')](_0x525534[_0xe4c4('0x36')]);}else if(this[_0xe4c4('0x9')][_0x525534[_0xe4c4('0x45')]]&&this[_0xe4c4('0x9')][_0x525534[_0xe4c4('0x45')]][_0xe4c4('0x27')]){logger[_0xe4c4('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x525534[_0xe4c4('0x45')]);this[_0xe4c4('0x1a')](_0x525534[_0xe4c4('0x45')]);}}catch(_0x4ad6ac){logger[_0xe4c4('0x31')](_0xe4c4('0x49'),_0x4ad6ac[_0xe4c4('0x3d')]);}};Acw['prototype'][_0xe4c4('0x12')]=function(_0x485c50){try{if(!_[_0xe4c4('0x4a')](this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4b')]])){this['startAcw'](_0x485c50['transfereeuniqueid']);if(this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4c')]]){this[_0xe4c4('0x9')][_0x485c50['secondtransfereruniqueid']][_0xe4c4('0x27')]=!![];this['channels'][_0x485c50['transfertargetuniqueid']]=this['channels'][_0x485c50['secondtransfereruniqueid']];delete this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4c')]];}}else if(!_[_0xe4c4('0x4a')](this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4d')]])){this[_0xe4c4('0x1a')](_0x485c50['transfertargetuniqueid']);if(this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4e')]]){this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4e')]][_0xe4c4('0x27')]=!![];this[_0xe4c4('0x9')][_0x485c50['transfereeuniqueid']]=this['channels'][_0x485c50[_0xe4c4('0x4e')]];delete this[_0xe4c4('0x9')][_0x485c50[_0xe4c4('0x4e')]];}}}catch(_0x3c8e44){logger[_0xe4c4('0x31')](_0xe4c4('0x4f'),_0x3c8e44[_0xe4c4('0x3d')]);}};Acw[_0xe4c4('0x19')][_0xe4c4('0x14')]=function(_0x5a0cbd){try{if(this['channels'][_0x5a0cbd[_0xe4c4('0x50')]]){logger['info'](_0xe4c4('0x51'),JSON[_0xe4c4('0x3c')](_0x5a0cbd[_0xe4c4('0x50')]));this['startAcw'](_0x5a0cbd[_0xe4c4('0x50')]);}else if(this['channels'][_0x5a0cbd[_0xe4c4('0x52')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe4c4('0x3c')](_0x5a0cbd[_0xe4c4('0x52')]));this[_0xe4c4('0x1a')](_0x5a0cbd['transfererlinkedid']);}}catch(_0x57e38e){logger['error'](_0xe4c4('0x53'),_0x57e38e[_0xe4c4('0x3d')]);}};Acw['prototype'][_0xe4c4('0x11')]=function(_0x3850da){try{if(this[_0xe4c4('0x6')][_0x3850da['queue']]&&this['voiceQueues'][_0x3850da[_0xe4c4('0x1c')]][_0xe4c4('0x54')]===_0xe4c4('0x55')){if(this[_0xe4c4('0x7')][_0x3850da[_0xe4c4('0x1b')]]){logger[_0xe4c4('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3850da[_0xe4c4('0x36')],_0x3850da[_0xe4c4('0x1b')],_0x3850da[_0xe4c4('0x1c')]);return RpcUser['savePause'](this[_0xe4c4('0x7')][_0x3850da[_0xe4c4('0x1b')]],_0xe4c4('0x56'),_0x3850da['uniqueid']);}}}catch(_0x5bb0cf){logger[_0xe4c4('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5bb0cf['message']);}};module[_0xe4c4('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 61e402b..5b1ee55 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 _0x9c2e=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','exports','asterisk-manager','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9c2e,0xda));var _0xe9c2=function(_0x41e6e7,_0x48b1e3){_0x41e6e7=_0x41e6e7-0x0;var _0x17d8f9=_0x9c2e[_0x41e6e7];return _0x17d8f9;};'use strict';var Manager=require(_0xe9c2('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0xe9c2('0x1'));var _=require(_0xe9c2('0x2'));var logger=require(_0xe9c2('0x3'))(_0xe9c2('0x4'));var config=require(_0xe9c2('0x5'));var ami=new Manager(config[_0xe9c2('0x6')][_0xe9c2('0x7')],config[_0xe9c2('0x6')]['ip'],config[_0xe9c2('0x6')][_0xe9c2('0x8')],config[_0xe9c2('0x6')][_0xe9c2('0x9')],!![]);ami['keepConnected']();ami[_0xe9c2('0xa')]=BPromise[_0xe9c2('0xb')](ami[_0xe9c2('0xc')]);function error(_0x5ea207){logger[_0xe9c2('0xd')](util[_0xe9c2('0xe')](_0xe9c2('0xf'),config[_0xe9c2('0x6')][_0xe9c2('0x8')],config[_0xe9c2('0x6')]['ip'],config[_0xe9c2('0x6')][_0xe9c2('0x7')],util['inspect'](_0x5ea207,![],null)));}function close(){logger[_0xe9c2('0xd')](util[_0xe9c2('0xe')](_0xe9c2('0x10'),config[_0xe9c2('0x6')][_0xe9c2('0x8')],config[_0xe9c2('0x6')]['ip'],config[_0xe9c2('0x6')][_0xe9c2('0x7')]));}ami[_0xe9c2('0x11')]=function(){return function(){return ami[_0xe9c2('0xa')]({'action':_0xe9c2('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xe9c2('0xa')]({'action':_0xe9c2('0x13')});};};ami[_0xe9c2('0x14')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xe9c2('0x15')]=function(){return function(){return ami['Action']({'action':_0xe9c2('0x16')});};};ami[_0xe9c2('0x17')]=function(){return function(){return ami[_0xe9c2('0xa')]({'action':_0xe9c2('0x18')});};};function connect(_0x89016d){logger[_0xe9c2('0x19')](util['format'](_0xe9c2('0x1a'),config['asterisk']['username'],config[_0xe9c2('0x6')]['ip'],config[_0xe9c2('0x6')]['port']));ami['once'](_0xe9c2('0xd'),error);ami[_0xe9c2('0x1b')](_0xe9c2('0x1c'),close);}ami['on'](_0xe9c2('0x1d'),connect);ami['on'](_0xe9c2('0x1e'),function(_0x96a4dd){logger[_0xe9c2('0x19')](util['format'](_0xe9c2('0x1f'),config['asterisk'][_0xe9c2('0x8')],config['asterisk']['ip'],config['asterisk'][_0xe9c2('0x7')],util[_0xe9c2('0x20')](_0x96a4dd,![],null)));});ami['on'](_0xe9c2('0x21'),function(_0x1a2181){logger[_0xe9c2('0x19')](util[_0xe9c2('0xe')](_0xe9c2('0x22'),config['asterisk'][_0xe9c2('0x8')],config['asterisk']['ip'],config[_0xe9c2('0x6')][_0xe9c2('0x7')]));return BPromise[_0xe9c2('0x23')]()[_0xe9c2('0x24')](ami['actionSipShowRegistry']())[_0xe9c2('0x24')](ami[_0xe9c2('0x25')]())[_0xe9c2('0x24')](ami[_0xe9c2('0x14')]())[_0xe9c2('0x24')](ami[_0xe9c2('0x15')]())[_0xe9c2('0x24')](ami[_0xe9c2('0x17')]())['catch'](function(_0x3e5fc5){console['log'](_0x3e5fc5);});});ami[_0xe9c2('0x1b')](_0xe9c2('0xd'),error);ami[_0xe9c2('0x1b')](_0xe9c2('0x1c'),close);module[_0xe9c2('0x26')]=ami; \ No newline at end of file +var _0x7fe7=['Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','error','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','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','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','close','exports','asterisk-manager','bluebird','moment','lodash','ami','../../config/environment','asterisk'];(function(_0x5d6c80,_0x13e6fc){var _0x1176b5=function(_0x3ebfce){while(--_0x3ebfce){_0x5d6c80['push'](_0x5d6c80['shift']());}};_0x1176b5(++_0x13e6fc);}(_0x7fe7,0x103));var _0x77fe=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x7fe7[_0x2726ad];return _0xd87993;};'use strict';var Manager=require(_0x77fe('0x0'));var BPromise=require(_0x77fe('0x1'));var moment=require(_0x77fe('0x2'));var util=require('util');var _=require(_0x77fe('0x3'));var logger=require('../../config/logger')(_0x77fe('0x4'));var config=require(_0x77fe('0x5'));var ami=new Manager(config[_0x77fe('0x6')]['port'],config[_0x77fe('0x6')]['ip'],config[_0x77fe('0x6')]['username'],config[_0x77fe('0x6')]['password'],!![]);ami['keepConnected']();ami[_0x77fe('0x7')]=BPromise[_0x77fe('0x8')](ami[_0x77fe('0x9')]);function error(_0x47ae92){logger['error'](util[_0x77fe('0xa')](_0x77fe('0xb'),config[_0x77fe('0x6')][_0x77fe('0xc')],config[_0x77fe('0x6')]['ip'],config['asterisk']['port'],util['inspect'](_0x47ae92,![],null)));}function close(){logger[_0x77fe('0xd')](util[_0x77fe('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x77fe('0x6')][_0x77fe('0xe')]));}ami[_0x77fe('0xf')]=function(){return function(){return ami[_0x77fe('0x7')]({'action':_0x77fe('0x10')});};};ami[_0x77fe('0x11')]=function(){return function(){return ami[_0x77fe('0x7')]({'action':_0x77fe('0x12')});};};ami[_0x77fe('0x13')]=function(){return function(){return ami[_0x77fe('0x7')]({'action':_0x77fe('0x14')});};};ami[_0x77fe('0x15')]=function(){return function(){return ami[_0x77fe('0x7')]({'action':'queuesummary'});};};ami[_0x77fe('0x16')]=function(){return function(){return ami[_0x77fe('0x7')]({'action':'coreshowchannels'});};};function connect(_0x248200){logger[_0x77fe('0x17')](util['format'](_0x77fe('0x18'),config['asterisk']['username'],config[_0x77fe('0x6')]['ip'],config[_0x77fe('0x6')][_0x77fe('0xe')]));ami[_0x77fe('0x19')](_0x77fe('0xd'),error);ami['once']('close',close);}ami['on'](_0x77fe('0x1a'),connect);ami['on'](_0x77fe('0x1b'),function(_0x15cdba){logger[_0x77fe('0x17')](util[_0x77fe('0xa')](_0x77fe('0x1c'),config[_0x77fe('0x6')][_0x77fe('0xc')],config[_0x77fe('0x6')]['ip'],config[_0x77fe('0x6')][_0x77fe('0xe')],util[_0x77fe('0x1d')](_0x15cdba,![],null)));});ami['on'](_0x77fe('0x1e'),function(_0xd51229){logger['info'](util[_0x77fe('0xa')](_0x77fe('0x1f'),config[_0x77fe('0x6')]['username'],config[_0x77fe('0x6')]['ip'],config[_0x77fe('0x6')][_0x77fe('0xe')]));return BPromise[_0x77fe('0x20')]()[_0x77fe('0x21')](ami[_0x77fe('0xf')]())[_0x77fe('0x21')](ami['actionDeviceStateList']())[_0x77fe('0x21')](ami['actionSipPeerStatus']())[_0x77fe('0x21')](ami['actionQueueSummary']())[_0x77fe('0x21')](ami['actionCoreShowChannels']())[_0x77fe('0x22')](function(_0x37ba6c){console[_0x77fe('0x23')](_0x37ba6c);});});ami[_0x77fe('0x19')](_0x77fe('0xd'),error);ami[_0x77fe('0x19')](_0x77fe('0x24'),close);module[_0x77fe('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f5fb5b8..d969d7e 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 _0x1ab6=['error','memberReport','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','request','then','debug','rpc'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0x1ab6,0x104));var _0x61ab=function(_0x5eae7d,_0x2619d5){_0x5eae7d=_0x5eae7d-0x0;var _0x25b6b7=_0x1ab6[_0x5eae7d];return _0x25b6b7;};'use strict';var jayson=require(_0x61ab('0x0'));var BPromise=require('bluebird');var logger=require(_0x61ab('0x1'))(_0x61ab('0x2'));var client=jayson[_0x61ab('0x3')][_0x61ab('0x4')]({'port':0x2329});client[_0x61ab('0x5')]=function(_0x4bdfc3,_0x101580){return new BPromise(function(_0x3a7432,_0x4e31f9){return client[_0x61ab('0x6')](_0x4bdfc3,_0x101580)[_0x61ab('0x7')](function(_0x52086f){logger[_0x61ab('0x8')](_0x61ab('0x9'),'memberReport',_0x4bdfc3,_0x101580,_0x52086f);if(_0x52086f[_0x61ab('0xa')]){logger['error'](_0x61ab('0x9'),_0x61ab('0xb'),_0x4bdfc3,_0x52086f[_0x61ab('0xa')]['message'],_0x101580);return _0x4e31f9(_0x52086f[_0x61ab('0xa')]['message']);}else{return _0x3a7432(_0x52086f[_0x61ab('0xc')]);}})[_0x61ab('0xd')](function(_0x3ebab3){logger[_0x61ab('0xa')](_0x61ab('0x9'),_0x61ab('0xb'),_0x4bdfc3,_0x3ebab3,_0x101580);return _0x4e31f9(_0x3ebab3);});});};module[_0x61ab('0xe')]=client; \ No newline at end of file +var _0x5f51=['http','Request','request','then','rpc','error','message','catch','memberReport','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0x5f51,0x1d1));var _0x15f5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5f51[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x15f5('0x0'));var BPromise=require(_0x15f5('0x1'));var logger=require(_0x15f5('0x2'))('ami');var client=jayson['client'][_0x15f5('0x3')]({'port':0x2329});client[_0x15f5('0x4')]=function(_0x56212e,_0x34ec6e){return new BPromise(function(_0x5d387c,_0x3d865c){return client[_0x15f5('0x5')](_0x56212e,_0x34ec6e)[_0x15f5('0x6')](function(_0x117e8b){logger['debug'](_0x15f5('0x7'),'memberReport',_0x56212e,_0x34ec6e,_0x117e8b);if(_0x117e8b[_0x15f5('0x8')]){logger['error'](_0x15f5('0x7'),'memberReport',_0x56212e,_0x117e8b[_0x15f5('0x8')][_0x15f5('0x9')],_0x34ec6e);return _0x3d865c(_0x117e8b[_0x15f5('0x8')]['message']);}else{return _0x5d387c(_0x117e8b['result']);}})[_0x15f5('0xa')](function(_0xd6e7b3){logger[_0x15f5('0x8')](_0x15f5('0x7'),_0x15f5('0xb'),_0x56212e,_0xd6e7b3,_0x34ec6e);return _0x3d865c(_0xd6e7b3);});});};module[_0x15f5('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 219ae5c..1391d91 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 _0x83e1=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','substring','prototype','getQueue','exports','util','lodash','string','isNil','voiceQueue','uniqueid','Contact','phone','lastName','number','name','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x4254ca,_0x428eee){var _0x12f693=function(_0x5408ef){while(--_0x5408ef){_0x4254ca['push'](_0x4254ca['shift']());}};_0x12f693(++_0x428eee);}(_0x83e1,0x1ad));var _0x183e=function(_0x363bca,_0x4893ab){_0x363bca=_0x363bca-0x0;var _0x27f1ec=_0x83e1[_0x363bca];return _0x27f1ec;};'use strict';var util=require(_0x183e('0x0'));var _=require(_0x183e('0x1'));var moment=require('moment');function checkNameSurname(_0x2abee1,_0x5ee015,_0x2deafb){var _0x59d53f='';if(!_['isNil'](_0x5ee015)&&_0x183e('0x2')===typeof _0x5ee015){_0x59d53f+=_0x5ee015;}if(!_[_0x183e('0x3')](_0x2deafb)&&'string'===typeof _0x2deafb){_0x59d53f+='\x20'+_0x2deafb;}if(_0x59d53f!==''){return _0x59d53f;}return _0x2abee1;}function Action(_0x51cc9c,_0x4d7710,_0x2e3bbd){this[_0x183e('0x4')]=_0x51cc9c;this[_0x183e('0x5')]=_0x2e3bbd||undefined;this['name']=checkNameSurname(_0x4d7710[_0x183e('0x6')][_0x183e('0x7')],_0x4d7710[_0x183e('0x6')]['firstName'],_0x4d7710[_0x183e('0x6')][_0x183e('0x8')]);this[_0x183e('0x9')]=_0x4d7710['Contact'][_0x183e('0x7')];this['queue']=_0x51cc9c[_0x183e('0xa')];this[_0x183e('0xb')]=_0x4d7710[_0x183e('0xb')]||![];this[_0x183e('0xc')]=_0x51cc9c[_0x183e('0xc')];this[_0x183e('0xd')]=_0x51cc9c[_0x183e('0xd')]||0x3;this['scheduledat']=_0x4d7710['scheduledat'];this['countbusyretry']=_0x4d7710[_0x183e('0xe')];this[_0x183e('0xf')]=_0x4d7710[_0x183e('0xf')];this['countnoanswerretry']=_0x4d7710[_0x183e('0x10')];this[_0x183e('0x11')]=_0x4d7710[_0x183e('0x11')];this['countdropretry']=_0x4d7710[_0x183e('0x12')];this[_0x183e('0x13')]=_0x4d7710[_0x183e('0x13')];this[_0x183e('0x14')]=_0x4d7710[_0x183e('0x14')];this[_0x183e('0x15')]=_0x4d7710[_0x183e('0x15')];this[_0x183e('0x16')]=_0x4d7710['ContactId'];this[_0x183e('0x17')]=_0x4d7710[_0x183e('0x17')];this[_0x183e('0x18')]=_0x4d7710[_0x183e('0x18')];this[_0x183e('0x19')]=_0x4d7710[_0x183e('0x19')];this['CampaignId']=_0x4d7710[_0x183e('0x1a')];this[_0x183e('0x1b')]=_0x4d7710['id'];this[_0x183e('0x1c')]=_0x4d7710[_0x183e('0x6')]['firstName']||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x183e('0x1d')]=_0x4d7710['callback'];this['callbackuniqueid']=_0x4d7710[_0x183e('0x1e')];this[_0x183e('0x1f')]=_0x4d7710[_0x183e('0x1f')];this[_0x183e('0x20')]=_0x4d7710[_0x183e('0x20')];this['originatecalleridnum']='';this[_0x183e('0x21')]='';}Action['prototype'][_0x183e('0x22')]=function(){return util[_0x183e('0x23')](_0x183e('0x24'),this[_0x183e('0xa')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x183e('0x9')][_0x183e('0x25')](this['voiceQueue']['dialCutDigit']):this[_0x183e('0x9')]);};Action[_0x183e('0x26')][_0x183e('0x27')]=function(){return this['queue'];};module[_0x183e('0x28')]=Action; \ No newline at end of file +var _0x4af8=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','isNil','string','uniqueid','name','Contact','firstName','lastName','phone','queue','active','type'];(function(_0x42d7f2,_0x4d8bd1){var _0x5a455b=function(_0x5cdbb3){while(--_0x5cdbb3){_0x42d7f2['push'](_0x42d7f2['shift']());}};_0x5a455b(++_0x4d8bd1);}(_0x4af8,0x1ad));var _0x84af=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x4af8[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x5a96c6,_0x10d2d2,_0xd9cfa1){var _0x1b876a='';if(!_[_0x84af('0x0')](_0x10d2d2)&&'string'===typeof _0x10d2d2){_0x1b876a+=_0x10d2d2;}if(!_[_0x84af('0x0')](_0xd9cfa1)&&_0x84af('0x1')===typeof _0xd9cfa1){_0x1b876a+='\x20'+_0xd9cfa1;}if(_0x1b876a!==''){return _0x1b876a;}return _0x5a96c6;}function Action(_0x59ad7b,_0x37c4f9,_0x3971f1){this['voiceQueue']=_0x59ad7b;this[_0x84af('0x2')]=_0x3971f1||undefined;this[_0x84af('0x3')]=checkNameSurname(_0x37c4f9['Contact']['phone'],_0x37c4f9[_0x84af('0x4')][_0x84af('0x5')],_0x37c4f9['Contact'][_0x84af('0x6')]);this['number']=_0x37c4f9[_0x84af('0x4')][_0x84af('0x7')];this[_0x84af('0x8')]=_0x59ad7b[_0x84af('0x3')];this['active']=_0x37c4f9[_0x84af('0x9')]||![];this['type']=_0x59ad7b[_0x84af('0xa')];this[_0x84af('0xb')]=_0x59ad7b['dialQueueTimeout']||0x3;this[_0x84af('0xc')]=_0x37c4f9[_0x84af('0xc')];this[_0x84af('0xd')]=_0x37c4f9[_0x84af('0xd')];this['countcongestionretry']=_0x37c4f9[_0x84af('0xe')];this['countnoanswerretry']=_0x37c4f9[_0x84af('0xf')];this[_0x84af('0x10')]=_0x37c4f9['countnosuchnumberretry'];this[_0x84af('0x11')]=_0x37c4f9[_0x84af('0x11')];this['countabandonedretry']=_0x37c4f9[_0x84af('0x12')];this['countmachineretry']=_0x37c4f9[_0x84af('0x13')];this[_0x84af('0x14')]=_0x37c4f9['countagentrejectretry'];this['ContactId']=_0x37c4f9[_0x84af('0x15')];this[_0x84af('0x16')]=_0x37c4f9[_0x84af('0x16')];this['UserId']=_0x37c4f9['UserId'];this[_0x84af('0x17')]=_0x37c4f9[_0x84af('0x17')];this[_0x84af('0x18')]=_0x37c4f9[_0x84af('0x18')];this[_0x84af('0x19')]=_0x37c4f9['id'];this[_0x84af('0x1a')]=_0x37c4f9[_0x84af('0x4')][_0x84af('0x5')]||'';this[_0x84af('0x1b')]=moment()['format'](_0x84af('0x1c'));this[_0x84af('0x1d')]=_0x37c4f9[_0x84af('0x1d')];this['callbackuniqueid']=_0x37c4f9[_0x84af('0x1e')];this[_0x84af('0x1f')]=_0x37c4f9[_0x84af('0x1f')];this['recallme']=_0x37c4f9['recallme'];this[_0x84af('0x20')]='';this[_0x84af('0x21')]='';}Action[_0x84af('0x22')][_0x84af('0x23')]=function(){return util[_0x84af('0x24')](_0x84af('0x25'),this[_0x84af('0x3')],this[_0x84af('0x26')][_0x84af('0x27')]>0x0?this[_0x84af('0x28')][_0x84af('0x29')](this['voiceQueue'][_0x84af('0x27')]):this[_0x84af('0x28')]);};Action[_0x84af('0x22')][_0x84af('0x2a')]=function(){return this[_0x84af('0x8')];};module[_0x84af('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 75be0fb..d57178d 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb51=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','uniqueid'];(function(_0x198f64,_0x58ba1b){var _0x777e4b=function(_0x29c179){while(--_0x29c179){_0x198f64['push'](_0x198f64['shift']());}};_0x777e4b(++_0x58ba1b);}(_0xfb51,0xeb));var _0x1fb5=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xfb51[_0x2caaef];return _0xd011f8;};'use strict';var util=require(_0x1fb5('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x3bb228,_0x10a762){var _0x205f7b=moment(_0x3bb228)[_0x1fb5('0x1')](0x0);var _0x42abb2=moment(_0x10a762)[_0x1fb5('0x1')](0x0);return _0x205f7b['diff'](_0x42abb2,'seconds');}function AdditionalPhone(_0x48770a){this[_0x1fb5('0x2')]=_0x48770a[_0x1fb5('0x2')];this[_0x1fb5('0x3')]=_0x48770a[_0x1fb5('0x3')]||undefined;this['type']=_0x48770a[_0x1fb5('0x4')];this[_0x1fb5('0x5')]=_0x48770a[_0x1fb5('0x4')]==='outbound'?_0x1fb5('0x6'):_0x48770a[_0x1fb5('0x4')];this[_0x1fb5('0x7')]=_0x48770a[_0x1fb5('0x7')];this[_0x1fb5('0x8')]=_0x48770a[_0x1fb5('0x8')];this[_0x1fb5('0x9')]=_0x48770a[_0x1fb5('0x9')];this[_0x1fb5('0xa')]=_0x48770a[_0x1fb5('0x7')]+_0x48770a[_0x1fb5('0x8')]+_0x48770a[_0x1fb5('0x9')]+_0x48770a['countnosuchnumberretry']+_0x48770a[_0x1fb5('0xb')]+_0x48770a['countabandonedretry']+_0x48770a[_0x1fb5('0xc')]+_0x48770a[_0x1fb5('0xd')];this[_0x1fb5('0xe')]=_0x48770a[_0x1fb5('0xe')];this[_0x1fb5('0xb')]=_0x48770a[_0x1fb5('0xb')];this[_0x1fb5('0xf')]=_0x48770a[_0x1fb5('0xf')];this['countmachineretry']=_0x48770a[_0x1fb5('0xc')];this[_0x1fb5('0xd')]=_0x48770a[_0x1fb5('0xd')];this[_0x1fb5('0x6')]=_0x48770a[_0x1fb5('0x6')];this[_0x1fb5('0x10')]=_0x48770a['name'];this['calleridnum']=_0x48770a['number'];this[_0x1fb5('0x11')]=_0x48770a['starttime'];this['responsetime']=_0x48770a[_0x1fb5('0x12')];this['endtime']=_0x48770a['responsetime'];this[_0x1fb5('0x13')]=getSeconds(_0x48770a[_0x1fb5('0x12')],_0x48770a['starttime']);this[_0x1fb5('0x14')]=0x0;this[_0x1fb5('0x15')]=0x0;this['callback']=_0x48770a[_0x1fb5('0x16')];this[_0x1fb5('0x17')]=_0x48770a[_0x1fb5('0x17')];this[_0x1fb5('0x18')]=_0x48770a[_0x1fb5('0x18')];this[_0x1fb5('0x19')]=_0x48770a['recallme'];this[_0x1fb5('0x1a')]=_0x48770a['ContactId'];this[_0x1fb5('0x1b')]=_0x48770a[_0x1fb5('0x1b')];this['UserId']=_0x48770a[_0x1fb5('0x1c')];this['VoiceQueueId']=_0x48770a[_0x1fb5('0x1d')];this[_0x1fb5('0x1e')]=_0x48770a[_0x1fb5('0x1e')];this[_0x1fb5('0x1f')]=_0x48770a[_0x1fb5('0x1f')]||'';this[_0x1fb5('0x20')]=_0x48770a[_0x1fb5('0x20')]||'';}module[_0x1fb5('0x21')]=History; \ No newline at end of file +var _0x2226=['milliseconds','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment'];(function(_0x2ba6ce,_0x29c0c2){var _0x1a46a=function(_0x293c6a){while(--_0x293c6a){_0x2ba6ce['push'](_0x2ba6ce['shift']());}};_0x1a46a(++_0x29c0c2);}(_0x2226,0x1de));var _0x6222=function(_0x335bb1,_0x5aa97e){_0x335bb1=_0x335bb1-0x0;var _0x4c2fc7=_0x2226[_0x335bb1];return _0x4c2fc7;};'use strict';var util=require(_0x6222('0x0'));var _=require(_0x6222('0x1'));var moment=require(_0x6222('0x2'));function getSeconds(_0x2e9d5f,_0x2f65dc){var _0x18f32b=moment(_0x2e9d5f)[_0x6222('0x3')](0x0);var _0x308cdd=moment(_0x2f65dc)[_0x6222('0x3')](0x0);return _0x18f32b['diff'](_0x308cdd,_0x6222('0x4'));}function AdditionalPhone(_0x440e8a){this[_0x6222('0x5')]=_0x440e8a[_0x6222('0x5')];this['scheduledat']=_0x440e8a['scheduledat']||undefined;this[_0x6222('0x6')]=_0x440e8a['type'];this[_0x6222('0x7')]=_0x440e8a[_0x6222('0x6')]===_0x6222('0x8')?_0x6222('0x9'):_0x440e8a[_0x6222('0x6')];this[_0x6222('0xa')]=_0x440e8a[_0x6222('0xa')];this[_0x6222('0xb')]=_0x440e8a[_0x6222('0xb')];this[_0x6222('0xc')]=_0x440e8a[_0x6222('0xc')];this[_0x6222('0xd')]=_0x440e8a['countbusyretry']+_0x440e8a[_0x6222('0xb')]+_0x440e8a[_0x6222('0xc')]+_0x440e8a[_0x6222('0xe')]+_0x440e8a[_0x6222('0xf')]+_0x440e8a[_0x6222('0x10')]+_0x440e8a[_0x6222('0x11')]+_0x440e8a[_0x6222('0x12')];this[_0x6222('0xe')]=_0x440e8a[_0x6222('0xe')];this[_0x6222('0xf')]=_0x440e8a[_0x6222('0xf')];this[_0x6222('0x10')]=_0x440e8a[_0x6222('0x10')];this[_0x6222('0x11')]=_0x440e8a[_0x6222('0x11')];this['countagentrejectretry']=_0x440e8a[_0x6222('0x12')];this[_0x6222('0x9')]=_0x440e8a[_0x6222('0x9')];this[_0x6222('0x13')]=_0x440e8a[_0x6222('0x14')];this['calleridnum']=_0x440e8a[_0x6222('0x15')];this[_0x6222('0x16')]=_0x440e8a[_0x6222('0x16')];this[_0x6222('0x17')]=_0x440e8a['responsetime'];this[_0x6222('0x18')]=_0x440e8a[_0x6222('0x17')];this['ringtime']=getSeconds(_0x440e8a[_0x6222('0x17')],_0x440e8a[_0x6222('0x16')]);this[_0x6222('0x19')]=0x0;this[_0x6222('0x1a')]=0x0;this['callback']=_0x440e8a[_0x6222('0x1b')];this[_0x6222('0x1c')]=_0x440e8a[_0x6222('0x1c')];this['callbackat']=_0x440e8a[_0x6222('0x1d')];this['recallme']=_0x440e8a['recallme'];this[_0x6222('0x1e')]=_0x440e8a[_0x6222('0x1e')];this[_0x6222('0x1f')]=_0x440e8a[_0x6222('0x1f')];this[_0x6222('0x20')]=_0x440e8a['UserId'];this[_0x6222('0x21')]=_0x440e8a['VoiceQueueId'];this[_0x6222('0x22')]=_0x440e8a[_0x6222('0x22')];this['originatecalleridnum']=_0x440e8a['originatecalleridnum']||'';this[_0x6222('0x23')]=_0x440e8a['originatecalleridname']||'';}module[_0x6222('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 982fe81..066b7f8 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 _0x8822=['Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','statedesc'];(function(_0x298806,_0x56a532){var _0x58ca43=function(_0x37f391){while(--_0x37f391){_0x298806['push'](_0x298806['shift']());}};_0x58ca43(++_0x56a532);}(_0x8822,0x1a8));var _0x2882=function(_0x1967ac,_0x2038da){_0x1967ac=_0x1967ac-0x0;var _0x44c948=_0x8822[_0x1967ac];return _0x44c948;};'use strict';var util=require(_0x2882('0x0'));var _=require(_0x2882('0x1'));var moment=require(_0x2882('0x2'));function getSeconds(_0x2a9c48,_0x46b03e){var _0x524402=moment(_0x2a9c48)[_0x2882('0x3')](0x0);var _0x46f1a2=moment(_0x46b03e)[_0x2882('0x3')](0x0);return _0x524402['diff'](_0x46f1a2,_0x2882('0x4'));}function AgentComplete(_0x8fcefb,_0x83d1b){this['state']=0x4;this[_0x2882('0x5')]=_0x2882('0x6');this[_0x2882('0x7')]=_0x8fcefb[_0x2882('0x7')];this['type']=_0x8fcefb[_0x2882('0x8')];this[_0x2882('0x9')]=_0x8fcefb[_0x2882('0x8')]===_0x2882('0xa')?'queue':_0x8fcefb[_0x2882('0x8')];this[_0x2882('0xb')]=_0x8fcefb['countbusyretry'];this[_0x2882('0xc')]=_0x8fcefb[_0x2882('0xc')];this[_0x2882('0xd')]=_0x8fcefb[_0x2882('0xd')];this[_0x2882('0xe')]=_0x8fcefb['countbusyretry']+_0x8fcefb[_0x2882('0xc')]+_0x8fcefb[_0x2882('0xd')]+_0x8fcefb[_0x2882('0xf')]+_0x8fcefb['countdropretry']+_0x8fcefb['countabandonedretry']+_0x8fcefb[_0x2882('0x10')]+_0x8fcefb[_0x2882('0x11')];this['countnosuchnumberretry']=_0x8fcefb['countnosuchnumberretry'];this[_0x2882('0x12')]=_0x8fcefb[_0x2882('0x12')];this[_0x2882('0x13')]=_0x8fcefb[_0x2882('0x13')];this[_0x2882('0x10')]=_0x8fcefb[_0x2882('0x10')];this[_0x2882('0x11')]=_0x8fcefb[_0x2882('0x11')];this['uniqueid']=_0x83d1b[_0x2882('0x14')];this['calleridname']=_0x8fcefb[_0x2882('0x15')];this[_0x2882('0x16')]=_0x8fcefb[_0x2882('0x17')];this[_0x2882('0x18')]=_0x8fcefb[_0x2882('0x18')];this[_0x2882('0x19')]=_0x8fcefb[_0x2882('0x19')];this['answertime']=_0x8fcefb[_0x2882('0x1a')];this[_0x2882('0x1b')]=moment()[_0x2882('0x1c')](_0x2882('0x1d'));this['ringtime']=getSeconds(_0x8fcefb[_0x2882('0x19')],_0x8fcefb[_0x2882('0x18')]);this[_0x2882('0x1e')]=getSeconds(_0x8fcefb[_0x2882('0x1a')],_0x8fcefb[_0x2882('0x19')]);this[_0x2882('0x1f')]=getSeconds(this[_0x2882('0x1b')],_0x8fcefb[_0x2882('0x1a')]);this['queue']=_0x83d1b['queue'];this['membername']=_0x83d1b[_0x2882('0x20')];this['reason']=_0x83d1b['reason'];this[_0x2882('0x21')]=_0x8fcefb[_0x2882('0x21')];this['callbackuniqueid']=_0x8fcefb[_0x2882('0x22')];this[_0x2882('0x23')]=_0x8fcefb[_0x2882('0x23')];this[_0x2882('0x24')]=_0x8fcefb[_0x2882('0x24')];this['ContactId']=_0x8fcefb[_0x2882('0x25')];this[_0x2882('0x26')]=_0x8fcefb[_0x2882('0x26')];this['UserId']=_0x8fcefb['UserId'];this['VoiceQueueId']=_0x8fcefb[_0x2882('0x27')];this['CampaignId']=_0x8fcefb[_0x2882('0x28')];this[_0x2882('0x29')]=_0x8fcefb['originatecalleridnum']||'';this[_0x2882('0x2a')]=_0x8fcefb[_0x2882('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x70e9=['milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0xe936f4,_0x5833d4){var _0x45690d=function(_0xf29d1f){while(--_0xf29d1f){_0xe936f4['push'](_0xe936f4['shift']());}};_0x45690d(++_0x5833d4);}(_0x70e9,0x176));var _0x970e=function(_0xd1e64b,_0x4724a3){_0xd1e64b=_0xd1e64b-0x0;var _0x465266=_0x70e9[_0xd1e64b];return _0x465266;};'use strict';var util=require(_0x970e('0x0'));var _=require(_0x970e('0x1'));var moment=require('moment');function getSeconds(_0x30511f,_0x5115f9){var _0x41803e=moment(_0x30511f)[_0x970e('0x2')](0x0);var _0x1d5dd4=moment(_0x5115f9)[_0x970e('0x2')](0x0);return _0x41803e[_0x970e('0x3')](_0x1d5dd4,_0x970e('0x4'));}function AgentComplete(_0x10fca4,_0x487e28){this[_0x970e('0x5')]=0x4;this[_0x970e('0x6')]=_0x970e('0x7');this[_0x970e('0x8')]=_0x10fca4['scheduledat'];this[_0x970e('0x9')]=_0x10fca4[_0x970e('0x9')];this['campaigntype']=_0x10fca4[_0x970e('0x9')]===_0x970e('0xa')?_0x970e('0xb'):_0x10fca4[_0x970e('0x9')];this[_0x970e('0xc')]=_0x10fca4[_0x970e('0xc')];this['countcongestionretry']=_0x10fca4['countcongestionretry'];this['countnoanswerretry']=_0x10fca4[_0x970e('0xd')];this[_0x970e('0xe')]=_0x10fca4['countbusyretry']+_0x10fca4[_0x970e('0xf')]+_0x10fca4[_0x970e('0xd')]+_0x10fca4[_0x970e('0x10')]+_0x10fca4[_0x970e('0x11')]+_0x10fca4[_0x970e('0x12')]+_0x10fca4[_0x970e('0x13')]+_0x10fca4[_0x970e('0x14')];this[_0x970e('0x10')]=_0x10fca4['countnosuchnumberretry'];this[_0x970e('0x11')]=_0x10fca4[_0x970e('0x11')];this[_0x970e('0x12')]=_0x10fca4['countabandonedretry'];this[_0x970e('0x13')]=_0x10fca4[_0x970e('0x13')];this[_0x970e('0x14')]=_0x10fca4['countagentrejectretry'];this[_0x970e('0x15')]=_0x487e28[_0x970e('0x15')];this[_0x970e('0x16')]=_0x10fca4[_0x970e('0x17')];this[_0x970e('0x18')]=_0x10fca4[_0x970e('0x19')];this[_0x970e('0x1a')]=_0x10fca4['starttime'];this[_0x970e('0x1b')]=_0x10fca4[_0x970e('0x1b')];this[_0x970e('0x1c')]=_0x10fca4[_0x970e('0x1c')];this['endtime']=moment()[_0x970e('0x1d')](_0x970e('0x1e'));this[_0x970e('0x1f')]=getSeconds(_0x10fca4[_0x970e('0x1b')],_0x10fca4['starttime']);this[_0x970e('0x20')]=getSeconds(_0x10fca4[_0x970e('0x1c')],_0x10fca4[_0x970e('0x1b')]);this[_0x970e('0x21')]=getSeconds(this['endtime'],_0x10fca4[_0x970e('0x1c')]);this['queue']=_0x487e28[_0x970e('0xb')];this[_0x970e('0x22')]=_0x487e28[_0x970e('0x22')];this[_0x970e('0x23')]=_0x487e28[_0x970e('0x23')];this[_0x970e('0x24')]=_0x10fca4[_0x970e('0x24')];this[_0x970e('0x25')]=_0x10fca4[_0x970e('0x25')];this[_0x970e('0x26')]=_0x10fca4[_0x970e('0x26')];this[_0x970e('0x27')]=_0x10fca4[_0x970e('0x27')];this[_0x970e('0x28')]=_0x10fca4[_0x970e('0x28')];this[_0x970e('0x29')]=_0x10fca4[_0x970e('0x29')];this[_0x970e('0x2a')]=_0x10fca4[_0x970e('0x2a')];this['VoiceQueueId']=_0x10fca4['VoiceQueueId'];this[_0x970e('0x2b')]=_0x10fca4[_0x970e('0x2b')];this[_0x970e('0x2c')]=_0x10fca4[_0x970e('0x2c')]||'';this[_0x970e('0x2d')]=_0x10fca4['originatecalleridname']||'';}module[_0x970e('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 55c6f43..2ed4d37 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 _0x0df7=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0df7,0x18c));var _0x70df=function(_0xa65309,_0x109948){_0xa65309=_0xa65309-0x0;var _0x48a38f=_0x0df7[_0xa65309];return _0x48a38f;};'use strict';var util=require('util');var _=require(_0x70df('0x0'));var moment=require(_0x70df('0x1'));function getSeconds(_0x548273,_0x32da15){var _0x19b8bf=moment(_0x548273)[_0x70df('0x2')](0x0);var _0x57ed43=moment(_0x32da15)[_0x70df('0x2')](0x0);return _0x19b8bf[_0x70df('0x3')](_0x57ed43,'seconds');}function Final(_0x1cc969){this[_0x70df('0x4')]=_0x1cc969['uniqueid'];this[_0x70df('0x5')]=_0x1cc969[_0x70df('0x5')];this[_0x70df('0x6')]=_0x1cc969['type'];this['campaigntype']=_0x1cc969['type']===_0x70df('0x7')?'queue':_0x1cc969[_0x70df('0x6')];this[_0x70df('0x8')]=_0x1cc969[_0x70df('0x8')];this['countcongestionretry']=_0x1cc969[_0x70df('0x9')];this[_0x70df('0xa')]=_0x1cc969[_0x70df('0xa')];this['countglobal']=_0x1cc969['countbusyretry']+_0x1cc969['countcongestionretry']+_0x1cc969['countnoanswerretry']+_0x1cc969[_0x70df('0xb')]+_0x1cc969[_0x70df('0xc')]+_0x1cc969[_0x70df('0xd')]+_0x1cc969[_0x70df('0xe')]+_0x1cc969['countagentrejectretry'];this[_0x70df('0xb')]=_0x1cc969[_0x70df('0xb')];this[_0x70df('0xc')]=_0x1cc969[_0x70df('0xc')];this[_0x70df('0xd')]=_0x1cc969[_0x70df('0xd')];this[_0x70df('0xe')]=_0x1cc969[_0x70df('0xe')];this[_0x70df('0xf')]=_0x1cc969[_0x70df('0xf')];this[_0x70df('0x10')]=_0x1cc969[_0x70df('0x10')];this[_0x70df('0x11')]=_0x1cc969[_0x70df('0x11')];this[_0x70df('0x12')]=_0x1cc969[_0x70df('0x12')];this[_0x70df('0x13')]=_0x1cc969[_0x70df('0x13')];this[_0x70df('0x14')]=_0x1cc969[_0x70df('0x14')];this['endtime']=_0x1cc969[_0x70df('0x14')];this['ringtime']=_0x1cc969['ringtime']||0x0;this['holdtime']=_0x1cc969[_0x70df('0x15')]||0x0;this[_0x70df('0x16')]=_0x1cc969[_0x70df('0x16')]||0x0;this[_0x70df('0x17')]=_0x1cc969[_0x70df('0x17')];this['callbackuniqueid']=_0x1cc969[_0x70df('0x18')];this[_0x70df('0x19')]=_0x1cc969['callbackat'];this[_0x70df('0x1a')]=_0x1cc969[_0x70df('0x1a')];this[_0x70df('0x1b')]=_0x1cc969[_0x70df('0x1b')];this['ListId']=_0x1cc969[_0x70df('0x1c')];this[_0x70df('0x1d')]=_0x1cc969[_0x70df('0x1d')];this[_0x70df('0x1e')]=_0x1cc969[_0x70df('0x1e')];this['CampaignId']=_0x1cc969['CampaignId'];this[_0x70df('0x1f')]=_0x1cc969[_0x70df('0x1f')]||'';this[_0x70df('0x20')]=_0x1cc969[_0x70df('0x20')]||'';}module[_0x70df('0x21')]=Final; \ No newline at end of file +var _0x5593=['recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x36c89b,_0x7fc772){var _0x13a947=function(_0x46cf6c){while(--_0x46cf6c){_0x36c89b['push'](_0x36c89b['shift']());}};_0x13a947(++_0x7fc772);}(_0x5593,0x111));var _0x3559=function(_0x4bf926,_0x3bf9cb){_0x4bf926=_0x4bf926-0x0;var _0x5b6e62=_0x5593[_0x4bf926];return _0x5b6e62;};'use strict';var util=require(_0x3559('0x0'));var _=require(_0x3559('0x1'));var moment=require(_0x3559('0x2'));function getSeconds(_0x3faafc,_0x52458a){var _0x489de5=moment(_0x3faafc)[_0x3559('0x3')](0x0);var _0x2362b3=moment(_0x52458a)[_0x3559('0x3')](0x0);return _0x489de5[_0x3559('0x4')](_0x2362b3,_0x3559('0x5'));}function Final(_0x5496f0){this[_0x3559('0x6')]=_0x5496f0['uniqueid'];this[_0x3559('0x7')]=_0x5496f0[_0x3559('0x7')];this[_0x3559('0x8')]=_0x5496f0[_0x3559('0x8')];this[_0x3559('0x9')]=_0x5496f0[_0x3559('0x8')]==='outbound'?_0x3559('0xa'):_0x5496f0[_0x3559('0x8')];this[_0x3559('0xb')]=_0x5496f0['countbusyretry'];this[_0x3559('0xc')]=_0x5496f0[_0x3559('0xc')];this[_0x3559('0xd')]=_0x5496f0[_0x3559('0xd')];this[_0x3559('0xe')]=_0x5496f0[_0x3559('0xb')]+_0x5496f0[_0x3559('0xc')]+_0x5496f0['countnoanswerretry']+_0x5496f0['countnosuchnumberretry']+_0x5496f0[_0x3559('0xf')]+_0x5496f0['countabandonedretry']+_0x5496f0[_0x3559('0x10')]+_0x5496f0[_0x3559('0x11')];this[_0x3559('0x12')]=_0x5496f0[_0x3559('0x12')];this['countdropretry']=_0x5496f0[_0x3559('0xf')];this[_0x3559('0x13')]=_0x5496f0[_0x3559('0x13')];this['countmachineretry']=_0x5496f0[_0x3559('0x10')];this[_0x3559('0x11')]=_0x5496f0[_0x3559('0x11')];this[_0x3559('0xa')]=_0x5496f0[_0x3559('0xa')];this[_0x3559('0x14')]=_0x5496f0[_0x3559('0x14')];this[_0x3559('0x15')]=_0x5496f0['calleridnum'];this[_0x3559('0x16')]=_0x5496f0['starttime'];this[_0x3559('0x17')]=_0x5496f0['responsetime'];this[_0x3559('0x18')]=_0x5496f0[_0x3559('0x17')];this['ringtime']=_0x5496f0[_0x3559('0x19')]||0x0;this[_0x3559('0x1a')]=_0x5496f0['holdtime']||0x0;this[_0x3559('0x1b')]=_0x5496f0[_0x3559('0x1b')]||0x0;this[_0x3559('0x1c')]=_0x5496f0['callback'];this['callbackuniqueid']=_0x5496f0[_0x3559('0x1d')];this[_0x3559('0x1e')]=_0x5496f0['callbackat'];this[_0x3559('0x1f')]=_0x5496f0[_0x3559('0x1f')];this['ContactId']=_0x5496f0['ContactId'];this[_0x3559('0x20')]=_0x5496f0[_0x3559('0x20')];this[_0x3559('0x21')]=_0x5496f0[_0x3559('0x21')];this['VoiceQueueId']=_0x5496f0[_0x3559('0x22')];this[_0x3559('0x23')]=_0x5496f0[_0x3559('0x23')];this[_0x3559('0x24')]=_0x5496f0[_0x3559('0x24')]||'';this[_0x3559('0x25')]=_0x5496f0['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4149d88..4a94dd9 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 _0xd60e=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0xad2024,_0x24c930){var _0x420050=function(_0xca6cd){while(--_0xca6cd){_0xad2024['push'](_0xad2024['shift']());}};_0x420050(++_0x24c930);}(_0xd60e,0x10a));var _0xed60=function(_0x52a76e,_0x5276a2){_0x52a76e=_0x52a76e-0x0;var _0x3c2395=_0xd60e[_0x52a76e];return _0x3c2395;};'use strict';var util=require(_0xed60('0x0'));var _=require(_0xed60('0x1'));var moment=require(_0xed60('0x2'));function getSeconds(_0x553082,_0x44a8c1){var _0x72698b=moment(_0x553082)[_0xed60('0x3')](0x0);var _0x35c8f4=moment(_0x44a8c1)[_0xed60('0x3')](0x0);return _0x72698b[_0xed60('0x4')](_0x35c8f4,'seconds');}function Hangup(_0x150a3e,_0x1e4bf2){this[_0xed60('0x5')]=0x4;this[_0xed60('0x6')]=_0xed60('0x7');this[_0xed60('0x8')]=_0x150a3e[_0xed60('0x8')];this[_0xed60('0x9')]=_0x150a3e['type'];this[_0xed60('0xa')]=_0x150a3e[_0xed60('0x9')]==='outbound'?_0xed60('0xb'):_0x150a3e[_0xed60('0x9')];this['countbusyretry']=_0x150a3e['countbusyretry'];this[_0xed60('0xc')]=_0x150a3e[_0xed60('0xc')];this[_0xed60('0xd')]=_0x150a3e[_0xed60('0xd')];this[_0xed60('0xe')]=_0x150a3e['countbusyretry']+_0x150a3e[_0xed60('0xc')]+_0x150a3e['countnoanswerretry']+_0x150a3e[_0xed60('0xf')]+_0x150a3e['countdropretry']+_0x150a3e[_0xed60('0x10')]+_0x150a3e['countmachineretry']+_0x150a3e[_0xed60('0x11')];this['countnosuchnumberretry']=_0x150a3e[_0xed60('0xf')];this[_0xed60('0x12')]=_0x150a3e[_0xed60('0x12')];this[_0xed60('0x10')]=_0x150a3e[_0xed60('0x10')];this[_0xed60('0x13')]=_0x150a3e['countmachineretry'];this[_0xed60('0x11')]=_0x150a3e[_0xed60('0x11')];this[_0xed60('0x14')]=_0x1e4bf2['uniqueid'];this[_0xed60('0x15')]=_0x150a3e[_0xed60('0x16')];this[_0xed60('0x17')]=_0x150a3e[_0xed60('0x18')];this[_0xed60('0x19')]=_0x150a3e['starttime'];this[_0xed60('0x1a')]=_0x150a3e[_0xed60('0x1a')];this[_0xed60('0x1b')]=moment()[_0xed60('0x1c')](_0xed60('0x1d'));this[_0xed60('0x1e')]=getSeconds(_0x150a3e[_0xed60('0x1a')],_0x150a3e['starttime']);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0x150a3e['responsetime']);this['queue']=_0x150a3e['queue'];this['membername']=_0xed60('0x1f');this['reason']=_0x1e4bf2[_0xed60('0x20')];this['callback']=_0x150a3e['callback'];this[_0xed60('0x21')]=_0x150a3e[_0xed60('0x21')];this[_0xed60('0x22')]=_0x150a3e[_0xed60('0x22')];this[_0xed60('0x23')]=_0x150a3e[_0xed60('0x23')];this[_0xed60('0x24')]=_0x150a3e[_0xed60('0x24')];this[_0xed60('0x25')]=_0x150a3e[_0xed60('0x25')];this['UserId']=_0x150a3e[_0xed60('0x26')];this['VoiceQueueId']=_0x150a3e[_0xed60('0x27')];this[_0xed60('0x28')]=_0x150a3e[_0xed60('0x28')];}module[_0xed60('0x29')]=Hangup; \ No newline at end of file +var _0x05d5=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','statedesc','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR'];(function(_0x4d911f,_0x18daf8){var _0x5cb626=function(_0x2f1bce){while(--_0x2f1bce){_0x4d911f['push'](_0x4d911f['shift']());}};_0x5cb626(++_0x18daf8);}(_0x05d5,0x1d2));var _0x505d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x05d5[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0x505d('0x0'));var _=require('lodash');var moment=require(_0x505d('0x1'));function getSeconds(_0x50e9f7,_0x27863c){var _0x4bc1dd=moment(_0x50e9f7)[_0x505d('0x2')](0x0);var _0x3e677d=moment(_0x27863c)[_0x505d('0x2')](0x0);return _0x4bc1dd['diff'](_0x3e677d,'seconds');}function Hangup(_0x49e35f,_0x4f3ef8){this['state']=0x4;this[_0x505d('0x3')]='Answer';this['scheduledat']=_0x49e35f['scheduledat'];this[_0x505d('0x4')]=_0x49e35f['type'];this['campaigntype']=_0x49e35f[_0x505d('0x4')]==='outbound'?_0x505d('0x5'):_0x49e35f['type'];this[_0x505d('0x6')]=_0x49e35f[_0x505d('0x6')];this[_0x505d('0x7')]=_0x49e35f[_0x505d('0x7')];this[_0x505d('0x8')]=_0x49e35f['countnoanswerretry'];this[_0x505d('0x9')]=_0x49e35f['countbusyretry']+_0x49e35f[_0x505d('0x7')]+_0x49e35f['countnoanswerretry']+_0x49e35f[_0x505d('0xa')]+_0x49e35f[_0x505d('0xb')]+_0x49e35f['countabandonedretry']+_0x49e35f[_0x505d('0xc')]+_0x49e35f[_0x505d('0xd')];this[_0x505d('0xa')]=_0x49e35f[_0x505d('0xa')];this['countdropretry']=_0x49e35f[_0x505d('0xb')];this[_0x505d('0xe')]=_0x49e35f[_0x505d('0xe')];this[_0x505d('0xc')]=_0x49e35f['countmachineretry'];this['countagentrejectretry']=_0x49e35f[_0x505d('0xd')];this['uniqueid']=_0x4f3ef8['uniqueid'];this[_0x505d('0xf')]=_0x49e35f[_0x505d('0x10')];this[_0x505d('0x11')]=_0x49e35f[_0x505d('0x12')];this[_0x505d('0x13')]=_0x49e35f[_0x505d('0x13')];this[_0x505d('0x14')]=_0x49e35f[_0x505d('0x14')];this[_0x505d('0x15')]=moment()[_0x505d('0x16')](_0x505d('0x17'));this['ringtime']=getSeconds(_0x49e35f[_0x505d('0x14')],_0x49e35f['starttime']);this[_0x505d('0x18')]=0x0;this[_0x505d('0x19')]=getSeconds(this[_0x505d('0x15')],_0x49e35f[_0x505d('0x14')]);this[_0x505d('0x5')]=_0x49e35f[_0x505d('0x5')];this[_0x505d('0x1a')]=_0x505d('0x1b');this[_0x505d('0x1c')]=_0x4f3ef8[_0x505d('0x1d')];this[_0x505d('0x1e')]=_0x49e35f[_0x505d('0x1e')];this[_0x505d('0x1f')]=_0x49e35f[_0x505d('0x1f')];this[_0x505d('0x20')]=_0x49e35f[_0x505d('0x20')];this[_0x505d('0x21')]=_0x49e35f['recallme'];this[_0x505d('0x22')]=_0x49e35f[_0x505d('0x22')];this['ListId']=_0x49e35f['ListId'];this[_0x505d('0x23')]=_0x49e35f[_0x505d('0x23')];this[_0x505d('0x24')]=_0x49e35f[_0x505d('0x24')];this[_0x505d('0x25')]=_0x49e35f[_0x505d('0x25')];}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 9f72fb4..4f1d1b0 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 _0xe4c3=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0xe4c3,0xcb));var _0x3e4c=function(_0x388502,_0x3f94f7){_0x388502=_0x388502-0x0;var _0x564d75=_0xe4c3[_0x388502];return _0x564d75;};'use strict';var util=require('util');var _=require(_0x3e4c('0x0'));var moment=require('moment');function getSeconds(_0xf83443,_0x53faae){var _0x2e18c8=moment(_0xf83443)['milliseconds'](0x0);var _0x1a2959=moment(_0x53faae)[_0x3e4c('0x1')](0x0);return _0x2e18c8[_0x3e4c('0x2')](_0x1a2959,'seconds');}function History(_0x350708){this[_0x3e4c('0x3')]=_0x350708[_0x3e4c('0x3')];this[_0x3e4c('0x4')]=_0x350708[_0x3e4c('0x4')]||undefined;this['type']=_0x350708[_0x3e4c('0x5')];this['campaigntype']=_0x350708[_0x3e4c('0x5')]===_0x3e4c('0x6')?_0x3e4c('0x7'):_0x350708[_0x3e4c('0x5')];this[_0x3e4c('0x8')]=_0x350708[_0x3e4c('0x8')];this[_0x3e4c('0x9')]=_0x350708['countcongestionretry'];this[_0x3e4c('0xa')]=_0x350708[_0x3e4c('0xa')];this[_0x3e4c('0xb')]=_0x350708[_0x3e4c('0x8')]+_0x350708[_0x3e4c('0x9')]+_0x350708['countnoanswerretry']+_0x350708['countnosuchnumberretry']+_0x350708[_0x3e4c('0xc')]+_0x350708[_0x3e4c('0xd')]+_0x350708[_0x3e4c('0xe')]+_0x350708[_0x3e4c('0xf')];this[_0x3e4c('0x10')]=_0x350708[_0x3e4c('0x10')];this[_0x3e4c('0xc')]=_0x350708['countdropretry'];this[_0x3e4c('0xd')]=_0x350708[_0x3e4c('0xd')];this['countmachineretry']=_0x350708[_0x3e4c('0xe')];this[_0x3e4c('0xf')]=_0x350708[_0x3e4c('0xf')];this['queue']=_0x350708[_0x3e4c('0x7')];this[_0x3e4c('0x11')]=_0x350708[_0x3e4c('0x12')];this[_0x3e4c('0x13')]=_0x350708['number'];this[_0x3e4c('0x14')]=_0x350708[_0x3e4c('0x14')];this[_0x3e4c('0x15')]=_0x350708[_0x3e4c('0x15')];this[_0x3e4c('0x16')]=_0x350708[_0x3e4c('0x15')];this[_0x3e4c('0x17')]=getSeconds(_0x350708['responsetime'],_0x350708[_0x3e4c('0x14')]);this[_0x3e4c('0x18')]=0x0;this[_0x3e4c('0x19')]=0x0;this[_0x3e4c('0x1a')]=_0x350708[_0x3e4c('0x1a')];this['callbackuniqueid']=_0x350708[_0x3e4c('0x1b')];this[_0x3e4c('0x1c')]=_0x350708[_0x3e4c('0x1c')];this['recallme']=_0x350708[_0x3e4c('0x1d')];this[_0x3e4c('0x1e')]=_0x350708[_0x3e4c('0x1e')];this['ListId']=_0x350708[_0x3e4c('0x1f')];this[_0x3e4c('0x20')]=_0x350708[_0x3e4c('0x20')];this[_0x3e4c('0x21')]=_0x350708[_0x3e4c('0x21')];this['CampaignId']=_0x350708[_0x3e4c('0x22')];this[_0x3e4c('0x23')]=_0x350708['originatecalleridnum']||'';this[_0x3e4c('0x24')]=_0x350708[_0x3e4c('0x24')]||'';}module[_0x3e4c('0x25')]=History; \ No newline at end of file +var _0x8c52=['ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x4a1526,_0x48980c){var _0x4b50f7=function(_0x5770ba){while(--_0x5770ba){_0x4a1526['push'](_0x4a1526['shift']());}};_0x4b50f7(++_0x48980c);}(_0x8c52,0x7e));var _0x28c5=function(_0x1d38e0,_0x23dcaf){_0x1d38e0=_0x1d38e0-0x0;var _0x26e31b=_0x8c52[_0x1d38e0];return _0x26e31b;};'use strict';var util=require(_0x28c5('0x0'));var _=require('lodash');var moment=require(_0x28c5('0x1'));function getSeconds(_0x3c5d74,_0x3d994a){var _0x37c10f=moment(_0x3c5d74)[_0x28c5('0x2')](0x0);var _0x41668f=moment(_0x3d994a)[_0x28c5('0x2')](0x0);return _0x37c10f[_0x28c5('0x3')](_0x41668f,_0x28c5('0x4'));}function History(_0x7f67){this[_0x28c5('0x5')]=_0x7f67[_0x28c5('0x5')];this['scheduledat']=_0x7f67['scheduledat']||undefined;this['type']=_0x7f67['type'];this[_0x28c5('0x6')]=_0x7f67[_0x28c5('0x7')]===_0x28c5('0x8')?'queue':_0x7f67[_0x28c5('0x7')];this[_0x28c5('0x9')]=_0x7f67['countbusyretry'];this[_0x28c5('0xa')]=_0x7f67[_0x28c5('0xa')];this[_0x28c5('0xb')]=_0x7f67[_0x28c5('0xb')];this[_0x28c5('0xc')]=_0x7f67[_0x28c5('0x9')]+_0x7f67[_0x28c5('0xa')]+_0x7f67[_0x28c5('0xb')]+_0x7f67[_0x28c5('0xd')]+_0x7f67[_0x28c5('0xe')]+_0x7f67['countabandonedretry']+_0x7f67[_0x28c5('0xf')]+_0x7f67[_0x28c5('0x10')];this[_0x28c5('0xd')]=_0x7f67[_0x28c5('0xd')];this['countdropretry']=_0x7f67[_0x28c5('0xe')];this[_0x28c5('0x11')]=_0x7f67[_0x28c5('0x11')];this[_0x28c5('0xf')]=_0x7f67[_0x28c5('0xf')];this[_0x28c5('0x10')]=_0x7f67[_0x28c5('0x10')];this[_0x28c5('0x12')]=_0x7f67['queue'];this[_0x28c5('0x13')]=_0x7f67[_0x28c5('0x14')];this[_0x28c5('0x15')]=_0x7f67[_0x28c5('0x16')];this[_0x28c5('0x17')]=_0x7f67['starttime'];this['responsetime']=_0x7f67[_0x28c5('0x18')];this[_0x28c5('0x19')]=_0x7f67['responsetime'];this[_0x28c5('0x1a')]=getSeconds(_0x7f67[_0x28c5('0x18')],_0x7f67['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0x28c5('0x1b')]=_0x7f67[_0x28c5('0x1b')];this[_0x28c5('0x1c')]=_0x7f67[_0x28c5('0x1c')];this[_0x28c5('0x1d')]=_0x7f67[_0x28c5('0x1d')];this[_0x28c5('0x1e')]=_0x7f67[_0x28c5('0x1e')];this[_0x28c5('0x1f')]=_0x7f67['ContactId'];this[_0x28c5('0x20')]=_0x7f67[_0x28c5('0x20')];this[_0x28c5('0x21')]=_0x7f67[_0x28c5('0x21')];this[_0x28c5('0x22')]=_0x7f67['VoiceQueueId'];this['CampaignId']=_0x7f67['CampaignId'];this[_0x28c5('0x23')]=_0x7f67[_0x28c5('0x23')]||'';this[_0x28c5('0x24')]=_0x7f67[_0x28c5('0x24')]||'';}module[_0x28c5('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d3b21a3..6aa90e4 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 _0x35f6=['outboundCongestionCallsDay','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','log','Contact\x20updated','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','loggerHandler','[getContactCampaign2]','dialLimitQueue','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','type','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','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','prototype','[uniqueid]','clearZombieChannels','actions','[actions]','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','saveInDb','merge','ContactId','UserId','VoiceQueueId','CampaignId','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countglobal','countcongestionretry','countagentrejectretry','add','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','rrmemory','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','isArray','push','iftime\x20%s,%s','interval','timezones','content','indexOf','true','command','all','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','replace','match','actionOriginate','voiceQueue\x20is\x20undefine','Contact','originate','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','dialer','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','phone','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildObj','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy'];(function(_0x425e5c,_0x494e22){var _0xa72d04=function(_0x26f81e){while(--_0x26f81e){_0x425e5c['push'](_0x425e5c['shift']());}};_0xa72d04(++_0x494e22);}(_0x35f6,0x67));var _0x635f=function(_0xc43927,_0x26a2d2){_0xc43927=_0xc43927-0x0;var _0x2bf27=_0x35f6[_0xc43927];return _0x2bf27;};'use strict';var util=require(_0x635f('0x0'));var _=require(_0x635f('0x1'));var BPromise=require(_0x635f('0x2'));var uuid=require(_0x635f('0x3'));var moment=require(_0x635f('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x635f('0x5'));var ut=require(_0x635f('0x6'));var config=require(_0x635f('0x7'));var logger=require(_0x635f('0x8'))('dialer');var loggerBooked=require('../../../config/logger')(_0x635f('0x9'));var loggerPredictive=require(_0x635f('0x8'))(_0x635f('0xa'));var loggerPredictiveCalls=require(_0x635f('0x8'))(_0x635f('0xb'));var loggerSyncQueueSummary=require(_0x635f('0x8'))('syncQueueSummary');var ami=require(_0x635f('0xc'));config['redis']=_[_0x635f('0xd')](config[_0x635f('0xe')],{'host':_0x635f('0xf'),'port':0x18eb});var io=require(_0x635f('0x10'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x635f('0x11'));var cmHopperHistory=require(_0x635f('0x12'));var cmHopperBlack=require(_0x635f('0x13'));var voiceQueueRt=require(_0x635f('0x14'));var Action=require('./action');var History=require(_0x635f('0x15'));var Final=require('./final');var AgentComplete=require(_0x635f('0x16'));var QueueCallerAbandon=require(_0x635f('0x17'));var Hangup=require(_0x635f('0x18'));var ipAgi=process[_0x635f('0x19')][_0x635f('0x1a')]||_0x635f('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0x635f('0x1c')};var Sequence=function(){};Sequence['prototype'][_0x635f('0x1d')]=function(_0x5530c6){this[_0x635f('0x1e')]=this[_0x635f('0x1e')]?this[_0x635f('0x1e')]['finally'](_0x5530c6):_0x5530c6();};function Dialer(_0x1e63c7,_0xd76b16){this[_0x635f('0x1f')]=new Sequence();this[_0x635f('0x20')]=_0xd76b16;this[_0x635f('0x21')]=_0x1e63c7[_0x635f('0x21')];this[_0x635f('0x22')]=_0x1e63c7[_0x635f('0x22')];this[_0x635f('0x23')]=_0x1e63c7[_0x635f('0x23')];this[_0x635f('0x24')]=_0x1e63c7[_0x635f('0x24')];this[_0x635f('0x25')]=config[_0x635f('0x25')]||0x2;this[_0x635f('0x26')]={};this['actions']={};this[_0x635f('0x27')]={};this[_0x635f('0x28')]={};this[_0x635f('0x29')]={};this[_0x635f('0x2a')]={};this[_0x635f('0x2b')]={};this[_0x635f('0x2c')]={};this[_0x635f('0x2d')]={};this['queueBookedRR']={};ami['on'](_0x635f('0x2e'),this[_0x635f('0x2f')][_0x635f('0x30')](this));ami['on'](_0x635f('0x31'),this['syncQueueCallerAbandon'][_0x635f('0x30')](this));ami['on'](_0x635f('0x32'),this[_0x635f('0x33')][_0x635f('0x30')](this));ami['on'](_0x635f('0x34'),this[_0x635f('0x35')][_0x635f('0x30')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x635f('0x30')](this));ami['on'](_0x635f('0x36'),this[_0x635f('0x37')]['bind'](this));ami['on'](_0x635f('0x38'),this[_0x635f('0x39')]['bind'](this));ami['on'](_0x635f('0x3a'),this[_0x635f('0x3b')][_0x635f('0x30')](this));ami['on'](_0x635f('0x3c'),this[_0x635f('0x3d')][_0x635f('0x30')](this));ami['on']('queuestatuscomplete',this[_0x635f('0x3e')][_0x635f('0x30')](this));this[_0x635f('0x3f')]();this[_0x635f('0x40')]();}function isNotNull(_0x2955a0){return _0x2955a0!==null&&!_[_0x635f('0x41')](_0x2955a0);}function checkIsLoggedIn(_0x5c472f,_0x8cc1a3){return function(){if(_0x8cc1a3<=0x0){_0x5c472f[_0x635f('0x42')]='AGENTS_NOT_LOGGED';throw _0x5c472f[_0x635f('0x43')]+_0x635f('0x44');}};}function isActive(_0x5b452c){return _0x5b452c;}function checkIsActive(_0x5264cb,_0x3086d9){return function(){if(!isActive(_0x3086d9)){_0x5264cb[_0x635f('0x42')]=_0x635f('0x45');throw _0x5264cb['name']+_0x635f('0x46');}};}function checkInterval(_0x2d262a){return function(){if(!isNotNull(_0x2d262a[_0x635f('0x47')])){_0x2d262a['message']='INTERVAL_IS_NULL';throw _0x2d262a[_0x635f('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2d262a['Interval']['Intervals'])){_0x2d262a[_0x635f('0x42')]=_0x635f('0x48');throw _0x2d262a[_0x635f('0x43')]+_0x635f('0x49');}if(!isNotNull(_['isEmpty'](_0x2d262a['Interval']['Intervals']))){_0x2d262a[_0x635f('0x42')]=_0x635f('0x48');throw _0x2d262a[_0x635f('0x43')]+_0x635f('0x49');}};}function msgResponse(_0x265300,_0x4c3075,_0x3ee48e){return{'action':_0x265300,'response':_0x4c3075,'message':_0x3ee48e,'stack':_0x3ee48e};}function myreject(_0x334fe4){return function(_0x141bd2){return _0x334fe4(msgResponse(_0x635f('0x4a'),_0x635f('0x4b'),JSON[_0x635f('0x4c')](_0x141bd2)));};}function getSeconds(_0x5cd81d,_0x566e41){var _0xf330b=moment(_0x5cd81d)[_0x635f('0x4d')](0x0);var _0x41198e=moment(_0x566e41)[_0x635f('0x4d')](0x0);return _0xf330b[_0x635f('0x4e')](_0x41198e,_0x635f('0x4f'));}function emit(_0x42ceb6,_0x48d6b2,_0x1f2d2c){io['to'](_0x42ceb6)[_0x635f('0x50')](_0x48d6b2,_0x1f2d2c);}function emitVoiceQueueSummary(_0x155ff2){if(_0x155ff2['type']===_0x635f('0x51')){var _0x221a28={'id':_0x155ff2['id'],'name':_0x155ff2[_0x635f('0x43')],'strategy':_0x155ff2['strategy'],'answered':_0x155ff2[_0x635f('0x52')],'available':_0x155ff2[_0x635f('0x53')],'loggedIn':_0x155ff2['loggedIn'],'pTalking':_0x155ff2[_0x635f('0x54')],'sumBillable':_0x155ff2[_0x635f('0x55')],'sumDuration':_0x155ff2[_0x635f('0x56')],'sumHoldTime':_0x155ff2[_0x635f('0x57')]||0x0,'talking':_0x155ff2[_0x635f('0x58')],'total':_0x155ff2[_0x635f('0x59')],'type':_0x155ff2['type'],'unmanaged':_0x155ff2[_0x635f('0x5a')],'abandoned':_0x155ff2[_0x635f('0x5b')],'waiting':_0x155ff2[_0x635f('0x5c')],'loggedInDb':_0x155ff2[_0x635f('0x5d')],'dialActive':_0x155ff2[_0x635f('0x5e')],'dialMethod':_0x155ff2[_0x635f('0x5f')],'dialOriginateCallerIdName':_0x155ff2[_0x635f('0x60')],'dialOriginateCallerIdNumber':_0x155ff2[_0x635f('0x61')],'dialOriginateTimeout':_0x155ff2['dialOriginateTimeout'],'dialPrefix':_0x155ff2[_0x635f('0x62')],'outboundAnswerAgiCallsDay':_0x155ff2[_0x635f('0x63')],'outboundAnswerCallsDay':_0x155ff2[_0x635f('0x64')],'outboundBlacklistCallsDay':_0x155ff2[_0x635f('0x65')],'outboundBusyCallsDay':_0x155ff2[_0x635f('0x66')],'outboundCongestionCallsDay':_0x155ff2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x155ff2[_0x635f('0x67')],'outboundDropCallsDayCallersExit':_0x155ff2['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x155ff2[_0x635f('0x68')],'outboundNoAnswerCallsDay':_0x155ff2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x155ff2[_0x635f('0x69')],'outboundOriginateFailureCallsDay':_0x155ff2[_0x635f('0x6a')],'outboundReCallsDay':_0x155ff2[_0x635f('0x6b')],'outboundRejectCallsDay':_0x155ff2[_0x635f('0x6c')],'outboundUnknownCallsDay':_0x155ff2[_0x635f('0x6d')],'predictiveIntervalAnsweredCalls':_0x155ff2[_0x635f('0x6e')],'predictiveIntervalAvgHoldtime':_0x155ff2[_0x635f('0x6f')],'predictiveIntervalAvgTalktime':_0x155ff2[_0x635f('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x155ff2[_0x635f('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x155ff2[_0x635f('0x72')],'predictiveIntervalErlangCalls':_0x155ff2[_0x635f('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x155ff2[_0x635f('0x74')],'predictiveIntervalHitRate':_0x155ff2[_0x635f('0x75')],'predictiveIntervalMultiplicativeFactor':_0x155ff2[_0x635f('0x76')],'predictiveIntervalPauses':_0x155ff2[_0x635f('0x77')],'predictiveIntervalAvailable':_0x155ff2[_0x635f('0x78')],'predictiveIntervalTotalCalls':_0x155ff2[_0x635f('0x79')],'message':_0x155ff2[_0x635f('0x42')],'originated':_0x155ff2['originated'],'erlangCalls':_0x155ff2[_0x635f('0x7a')],'erlangCallToSecond':_0x155ff2['erlangCallToSecond'],'erlangAbandonmentRate':_0x155ff2[_0x635f('0x7b')],'erlangBusyFactor':_0x155ff2[_0x635f('0x7c')],'startPredictive':_0x155ff2[_0x635f('0x2a')],'startProgressive':_0x155ff2[_0x635f('0x2b')]};if(_0x155ff2['Trunk']){_0x221a28['Trunk']={'id':_0x155ff2[_0x635f('0x7d')]['id'],'name':_0x155ff2[_0x635f('0x7d')][_0x635f('0x43')],'active':_0x155ff2['Trunk'][_0x635f('0x7e')],'callerid':_0x155ff2[_0x635f('0x7d')][_0x635f('0x7f')]};}if(_0x155ff2[_0x635f('0x47')]){_0x221a28[_0x635f('0x47')]={'id':_0x155ff2[_0x635f('0x47')]['id'],'name':_0x155ff2[_0x635f('0x47')]['name']};}var _0x39ecb1=md5(JSON[_0x635f('0x4c')](_0x221a28));if(_0x155ff2[_0x635f('0x80')]!==_0x39ecb1){_0x155ff2['md5']=_0x39ecb1;emit(util[_0x635f('0x81')](_0x635f('0x82'),_0x221a28[_0x635f('0x43')]),'voice_queue:save',_0x221a28);}}}function emitCampaignSummary(_0x3e9816){if(_0x3e9816[_0x635f('0x83')]===_0x635f('0x84')){emit(util[_0x635f('0x81')](_0x635f('0x85'),_0x3e9816[_0x635f('0x43')]),'campaign:save',_0x3e9816);}}function checkGetDataPredictive(_0x257367){if(isNotNull(_0x257367)){if(!_['isEmpty'](_0x257367)){loggerPredictive[_0x635f('0x86')](_0x635f('0x87'));loggerPredictive[_0x635f('0x86')](_0x635f('0x88'),_0x257367[_0x635f('0x79')]);loggerPredictive[_0x635f('0x86')](_0x635f('0x89'),_0x257367[_0x635f('0x6e')]);loggerPredictive[_0x635f('0x86')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x257367[_0x635f('0x72')]);loggerPredictive[_0x635f('0x86')](_0x635f('0x8a'),_0x257367[_0x635f('0x71')]);loggerPredictive[_0x635f('0x86')](_0x635f('0x8b'),_0x257367['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x635f('0x86')](_0x635f('0x8c'),_0x257367['predictiveIntervalAvgTalktime']);loggerPredictive[_0x635f('0x86')](_0x635f('0x8d'));if(_0x257367[_0x635f('0x79')]>0x0){if(!_[_0x635f('0x41')](_0x257367[_0x635f('0x70')])&&_0x257367[_0x635f('0x70')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0x257367[_0x635f('0x6f')])&&_0x257367[_0x635f('0x6f')]>0x0){return!![];}else{loggerPredictive[_0x635f('0x86')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x635f('0x86')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x635f('0x86')](_0x635f('0x8e'));}return![];}function mergeDataErlangB(_0x1a3fba){return function(_0x26d7f4){loggerPredictive[_0x635f('0x86')](_0x635f('0x8f'));loggerPredictive['info'](_0x635f('0x90'),_0x26d7f4['erlangCalls']);loggerPredictive[_0x635f('0x86')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d7f4[_0x635f('0x91')]);loggerPredictive[_0x635f('0x86')](_0x635f('0x92'),_0x26d7f4[_0x635f('0x7b')]);loggerPredictive['info'](_0x635f('0x93'),_0x26d7f4[_0x635f('0x7c')]);loggerPredictive[_0x635f('0x86')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d7f4[_0x635f('0x7b')]);loggerPredictive[_0x635f('0x86')](_0x635f('0x8d'));_['merge'](_0x1a3fba,_0x26d7f4);};}function getDiff(_0x49eee9){var _0x40c136=moment()[_0x635f('0x4d')](0x0);var _0x3cce82=moment(_0x49eee9)[_0x635f('0x4d')](0x0);return _0x40c136[_0x635f('0x4e')](_0x3cce82,'seconds');}function ifInterval(_0x26d82b,_0x54ad92){if(_['isUndefined'](_0x54ad92)){return![];}if(getDiff(_0x54ad92)<_0x26d82b*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2e387f){if(isNotNull(_0x2e387f)){if(!_[_0x635f('0x41')](_0x2e387f[_0x635f('0x2b')])){_0x2e387f[_0x635f('0x2b')]=undefined;loggerPredictive['info'](_0x2e387f[_0x635f('0x43')],_0x635f('0x94'));}if(!_[_0x635f('0x41')](_0x2e387f[_0x635f('0x2a')])){_0x2e387f['startPredictive']=undefined;loggerPredictive['info'](_0x2e387f[_0x635f('0x43')],_0x635f('0x95'));}if(!_[_0x635f('0x41')](_0x2e387f['handlePredictive'])){clearInterval(_0x2e387f[_0x635f('0x96')]);_0x2e387f['handlePredictive']=undefined;loggerPredictive[_0x635f('0x86')](_0x2e387f['name'],_0x635f('0x97'));}}}function erlangb(_0xbfa16,_0x167258){if(_0x167258===0x0){return 0x0;}var _0xd40da3=0x1;for(var _0x25c266=0x1;_0x25c266<=_0x167258;_0x25c266+=0x1){_0xd40da3=0x1+_0xd40da3*_0x25c266/_0xbfa16;}return 0x1/_0xd40da3;}function isVoiceQueueOutbound(_0x979434){return _0x979434==='outbound';}function isNotPreview(_0x446102){return _0x446102!==_0x635f('0x20');}function isCampaignIvr(_0x39ff3){return _0x39ff3==='ivr';}function getCallerId(_0x74f291,_0x33c202,_0x358ed4){if(!_[_0x635f('0x41')](_0x358ed4)&&_0x635f('0x98')===typeof _0x358ed4&&!_['isEmpty'](_0x358ed4)){if(!_[_0x635f('0x41')](_0x33c202)&&_0x635f('0x98')===typeof _0x33c202&&!_[_0x635f('0x99')](_0x33c202)){return util[_0x635f('0x81')](_0x635f('0x9a'),_0x33c202,_0x358ed4);}return util[_0x635f('0x81')](_0x635f('0x9a'),_0x358ed4,_0x358ed4);}if(!_[_0x635f('0x41')](_0x74f291)&&_0x635f('0x98')===typeof _0x74f291&&!_['isEmpty'](_0x74f291)){return _0x74f291;}return _0x635f('0x9b');}function loggerCatchQueueSummary(_0x13e5f3,_0x56bad2){return function(_0xfa6860){freeVariablesPredictive(_0x56bad2);emitVoiceQueueSummary(_0x56bad2);emitCampaignSummary(_0x56bad2);loggerSyncQueueSummary[_0x635f('0x9c')](_0x13e5f3,util[_0x635f('0x9d')](_0xfa6860,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4b08a3,_0xa6548c){return function(_0x269423){loggerPredictive[_0x635f('0x9c')](_0xa6548c[_0x635f('0x43')],_0x4b08a3);loggerPredictive['error'](_0x269423[_0x635f('0x9e')]);freeVariablesPredictive(_0xa6548c);};}function loggerCatch(_0x287f31){return function(_0x55d1ad){logger['error'](_0x287f31,util[_0x635f('0x9d')](_0x55d1ad,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3243a9){return _0x3243a9&&!_[_0x635f('0x41')](_0x3243a9)&&_0x3243a9[_0x635f('0x9f')]>0x0;}function decremetOriginate(_0x57aed7){if(!_[_0x635f('0x41')](_0x57aed7)&&_0x57aed7!==null){if(_0x57aed7[_0x635f('0xa0')](_0x635f('0xa1'))){if(_0x57aed7['originated']>0x0){_0x57aed7[_0x635f('0xa1')]-=0x1;}else{logger['error'](_0x635f('0xa2'));}}}else{logger[_0x635f('0x9c')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x18a9fa,_0x386915,_0x49c960){if(_0x386915>_0x49c960){for(var _0x45b69e=0x0;_0x45b69e<_0x386915-_0x49c960;_0x45b69e+=0x1){decremetOriginate(_0x18a9fa);}}}function loggerGetContactDialer(_0x4d50fc,_0x369668,_0x1ab575){return function(_0x4b4a25){checkContactLowerLimitOriginate(_0x369668,_0x1ab575,0x0);logger[_0x635f('0x9c')](_0x4d50fc,util['inspect'](_0x4b4a25,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1f2b13){return function(_0x39c122){if(isNotNull(_0x39c122)&&isNotNull(_0x39c122[0x0])){if(_0x39c122[0x0][_0x635f('0xa3')]>0x0){_0x1f2b13[_0x635f('0x42')]='RESCHEDULED_CONTACTS';logger['info'](_0x635f('0xa4')+_0x1f2b13[_0x635f('0x43')],_0x39c122[0x0][_0x635f('0xa3')],'contacts');}else{_0x1f2b13['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x635f('0x86')](_0x635f('0xa5')+_0x1f2b13['name']);}}};}function notSendMessagesQueue(_0x5eccd3){if(_0x5eccd3[_0x635f('0xa6')]){freeVariablesPredictive(_0x5eccd3);if(_0x5eccd3[_0x635f('0xa1')]===0x0&&_0x5eccd3[_0x635f('0x58')]===0x0&&_0x5eccd3['waiting']===0x0&&(_0x5eccd3[_0x635f('0x54')]||0x0)===0x0){_0x5eccd3[_0x635f('0xa6')]=![];_0x5eccd3[_0x635f('0x53')]=0x0;_0x5eccd3[_0x635f('0x42')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x635f('0x9c')](_0x635f('0xa7'),_0x5eccd3[_0x635f('0x43')],'is\x20not\x20active');}else{_0x5eccd3['message']=_0x635f('0xa8');loggerSyncQueueSummary['error'](_0x635f('0xa7'),_0x5eccd3['name'],_0x635f('0xa9'));}emitVoiceQueueSummary(_0x5eccd3);}}function notSendMessagesCampaign(_0x29b0ee){if(_0x29b0ee[_0x635f('0xa6')]){if(_0x29b0ee[_0x635f('0xa1')]===0x0){_0x29b0ee[_0x635f('0xa6')]=![];_0x29b0ee['message']=_0x635f('0x45');loggerSyncQueueSummary['error'](_0x635f('0xaa'),_0x29b0ee[_0x635f('0x43')],'is\x20not\x20active');}else{_0x29b0ee[_0x635f('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x635f('0x9c')](_0x635f('0xaa'),_0x29b0ee[_0x635f('0x43')],_0x635f('0xa9'));}emitCampaignSummary(_0x29b0ee);}}function createObjHistory(_0x1cac42,_0xdf3353,_0x3f2432,_0x48c7ca,_0x11974d){_0x1cac42['message']=_0x3f2432;var _0x823494=new Action(_0x1cac42,_0xdf3353);var _0xfd611d=new History(_0x823494);_0xfd611d[_0x635f('0xab')]=_0x48c7ca;_0xfd611d[_0x635f('0xac')]=_0x11974d;_0xfd611d['endtime']=_0x823494['starttime'];return _0xfd611d;}Dialer[_0x635f('0xad')]['loopClearZombieChannels']=function(){var _0x1f8758=this;setInterval(function(){_0x1f8758['clearZombieChannels'](_0x1f8758[_0x635f('0x28')],_0x635f('0xae'));_0x1f8758[_0x635f('0xaf')](_0x1f8758[_0x635f('0xb0')],_0x635f('0xb1'));},0x32c8);};Dialer['prototype'][_0x635f('0xaf')]=function(_0x14aa5e,_0x5b1f81){var _0x588f95=this;for(var _0x4ba6df in _0x14aa5e){if(_0x14aa5e[_0x635f('0xa0')](_0x4ba6df)){this[_0x635f('0x1f')][_0x635f('0x1d')](function(){if(!_['isNil'](_0x14aa5e[_0x4ba6df])){return ami[_0x635f('0xb2')]({'action':_0x635f('0xb3'),'channel':_0x14aa5e[_0x4ba6df][_0x635f('0xb4')]})['catch'](function(_0x3c67b4){if(_0x3c67b4['message']===_0x635f('0xb5')){setTimeout(function(){if(_0x14aa5e[_0x4ba6df]&&_0x14aa5e[_0x4ba6df][_0x635f('0x83')]!==_0x635f('0x84')){_0x588f95[_0x635f('0xb6')](_0x588f95[_0x635f('0x21')][_0x14aa5e[_0x4ba6df][_0x635f('0xb7')]]);logger[_0x635f('0x9c')](_0x635f('0xb8'),_0x5b1f81,_0x4ba6df,_0x14aa5e[_0x4ba6df]['queue']);delete _0x14aa5e[_0x4ba6df];}if(_0x14aa5e[_0x4ba6df]&&_0x14aa5e[_0x4ba6df][_0x635f('0x83')]===_0x635f('0x84')){_0x588f95[_0x635f('0xb6')](_0x588f95['campaigns'][_0x14aa5e[_0x4ba6df][_0x635f('0xb7')]]);logger[_0x635f('0x9c')](_0x635f('0xb9'),_0x5b1f81,_0x4ba6df,_0x14aa5e[_0x4ba6df][_0x635f('0xb7')]);delete _0x14aa5e[_0x4ba6df];}},0x2328);}});}});}}};Dialer[_0x635f('0xad')][_0x635f('0xba')]=function(_0x399334){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopper[_0x635f('0xba')](_0x399334))[_0x635f('0xbd')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x635f('0xad')][_0x635f('0xbe')]=function(_0x23d95a){return BPromise[_0x635f('0xbb')]()['then'](cmHopperBlack[_0x635f('0xbe')](_0x23d95a))[_0x635f('0xbd')](loggerCatch(_0x635f('0xbf')));};Dialer[_0x635f('0xad')][_0x635f('0xc0')]=function(_0x436074){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopperBlack[_0x635f('0xc0')](_0x436074))[_0x635f('0xbd')](loggerCatch(_0x635f('0xc1')));};Dialer[_0x635f('0xad')]['averageHandleTime']=function(_0x54f6f8){return BPromise[_0x635f('0xbb')]()['then'](cmHopperHistory[_0x635f('0xc2')](_0x54f6f8))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x635f('0xc3')]=function(_0x2beeb2){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopper[_0x635f('0xc3')](_0x2beeb2))[_0x635f('0xbd')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x635f('0xad')][_0x635f('0xc4')]=function(_0x5c50ea,_0x27e1d0,_0x3fd31e){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopper[_0x635f('0xc4')](_0x5c50ea,_0x27e1d0,_0x3fd31e))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer['prototype'][_0x635f('0xc5')]=function(_0x2f101b,_0x3d1fd9,_0x3ddfbd,_0xa0e977){return BPromise['resolve']()[_0x635f('0xbc')](cmHopper[_0x635f('0xc5')](_0x2f101b,_0x3d1fd9,_0x3ddfbd,_0xa0e977))['catch'](loggerCatch(_0x635f('0xc6')));};Dialer[_0x635f('0xad')]['getContactDialerIvr']=function(_0x3ad943,_0x2b50dc,_0x52fcee){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopper[_0x635f('0xc7')](_0x3ad943,_0x2b50dc,_0x52fcee))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x635f('0xad')][_0x635f('0xc8')]=function(_0x460005){return BPromise['resolve']()[_0x635f('0xbc')](voiceQueueRt[_0x635f('0xc8')](_0x460005))['catch'](loggerCatch(_0x635f('0xc9')));};Dialer['prototype'][_0x635f('0xca')]=function(_0x29bc1b){return BPromise[_0x635f('0xbb')]()['then'](cmHopper[_0x635f('0xca')](_0x29bc1b))[_0x635f('0xbd')](loggerCatch(_0x635f('0xcb')));};Dialer[_0x635f('0xad')]['createHistory']=function(_0x503a57){return BPromise[_0x635f('0xbb')]()[_0x635f('0xbc')](cmHopperHistory[_0x635f('0xcc')](_0x503a57))[_0x635f('0xbd')](loggerCatch(_0x635f('0xcd')));};Dialer['prototype'][_0x635f('0xb6')]=function(_0x491d63){if(!_['isUndefined'](_0x491d63)&&_0x491d63!==null){if(_0x491d63[_0x635f('0xa0')](_0x635f('0xa1'))){if(_0x491d63[_0x635f('0xa1')]>0x0){_0x491d63[_0x635f('0xa1')]-=0x1;}else{logger[_0x635f('0x9c')](_0x635f('0xce'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x635f('0xad')]['loggerHandler']=function(_0x9708af,_0x4cdf23){var _0x66e019=this;return function(_0x274358){_0x66e019[_0x635f('0xb6')](_0x4cdf23);logger[_0x635f('0x9c')](_0x9708af,util['inspect'](_0x274358,{'showHidden':![],'depth':null}));};};Dialer[_0x635f('0xad')]['emptyContact']=function(_0x2328d3,_0x1ae863,_0x17b08c){var _0x5dd676={'state':0x19,'statedesc':'notFound'};this[_0x635f('0xb6')](_0x1ae863);this[_0x635f('0xcf')](_[_0x635f('0xd0')](_0x5dd676,_['pick'](_0x17b08c,[_0x635f('0xd1'),'ListId',_0x635f('0xd2'),_0x635f('0xd3'),_0x635f('0xd4')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x635f('0x9c')](_0x2328d3);};Dialer[_0x635f('0xad')]['isSuccess']=function(_0x1b3c99){return _0x1b3c99==='Success';};Dialer[_0x635f('0xad')][_0x635f('0xd5')]=function(_0xa275e3){return!_[_0x635f('0x41')](_0xa275e3)&&_0xa275e3&&!_[_0x635f('0x41')](_0xa275e3[_0x635f('0x43')])&&!_[_0x635f('0x41')](_0xa275e3[_0x635f('0x7e')])&&_0xa275e3[_0x635f('0x7e')]&&(this[_0x635f('0x24')][util['format']('SIP/%s',_0xa275e3[_0x635f('0x43')])][_0x635f('0xb3')]===_0x635f('0xd6')||this[_0x635f('0x24')][util[_0x635f('0x81')](_0x635f('0xd7'),_0xa275e3[_0x635f('0x43')])]['status']===_0x635f('0xd8'));};Dialer[_0x635f('0xad')][_0x635f('0xcf')]=function(_0x33d4af,_0x1890cf,_0x20820c){this['createHistory'](_0x33d4af)['catch'](loggerCatch(_0x1890cf));this[_0x635f('0xca')](_0x33d4af)[_0x635f('0xbd')](loggerCatch(_0x20820c));};Dialer[_0x635f('0xad')][_0x635f('0x3b')]=function(_0x164911){var _0x5391e8=this['uniqueId'][_0x164911[_0x635f('0xd9')]];var _0x547ce2;if(!_[_0x635f('0xda')](_0x164911)&&!_[_0x635f('0xda')](_0x164911[_0x635f('0xdb')])&&!_[_0x635f('0xda')](_0x164911[_0x635f('0xdb')][_0x635f('0xdc')])&&_0x164911[_0x635f('0xdd')]===_0x635f('0xde')&&_0x5391e8){if(_0x5391e8[_0x635f('0x83')]!==_0x635f('0x84')&&this[_0x635f('0x21')][_0x5391e8['queue']][_0x635f('0xdf')]&&_0x164911['value']===_0x635f('0xe0')){delete this[_0x635f('0x28')][_0x164911[_0x635f('0xd9')]];this['updateOriginated'](this[_0x635f('0x21')][_0x5391e8['queue']]);this[_0x635f('0x21')][_0x5391e8[_0x635f('0xb7')]][_0x635f('0x64')]+=0x1;this['voiceQueues'][_0x5391e8['queue']][_0x635f('0x63')]+=0x1;_0x547ce2=new Hangup(_0x5391e8,_0x164911);_0x547ce2[_0x635f('0xab')]=0x12;_0x547ce2[_0x635f('0xac')]=_0x635f('0xe1');_0x547ce2[_0x635f('0xe2')]=_0x635f('0xe3');this[_0x635f('0xcf')](_0x547ce2,_0x635f('0xe4'),_0x635f('0xe5'));}if(_0x5391e8[_0x635f('0x83')]!=='ivr'&&this[_0x635f('0x21')][_0x5391e8[_0x635f('0xb7')]][_0x635f('0xdf')]&&_0x164911[_0x635f('0xe6')]==='MACHINE'){var _0x22be64=this;return new BPromise(function(_0x58cb7f,_0x10c249){delete _0x22be64[_0x635f('0x28')][_0x164911[_0x635f('0xd9')]];_0x22be64['updateOriginated'](_0x22be64[_0x635f('0x21')][_0x5391e8[_0x635f('0xb7')]]);_0x22be64[_0x635f('0x21')][_0x5391e8[_0x635f('0xb7')]][_0x635f('0x64')]+=0x1;_0x22be64['voiceQueues'][_0x5391e8[_0x635f('0xb7')]][_0x635f('0x63')]+=0x1;var _0x5b2001=_0x22be64[_0x635f('0x21')][_0x5391e8[_0x635f('0xb7')]];var _0x205d4b=new Hangup(_0x5391e8,_0x164911);_0x205d4b['state']=0x13;_0x205d4b[_0x635f('0xac')]='Machine';_0x205d4b[_0x635f('0xe2')]=_0x635f('0xe3');_0x205d4b['countmachineretry']+=0x1;_0x205d4b['countglobal']+=0x1;_0x205d4b[_0x635f('0xe7')]=!![];_0x22be64[_0x635f('0xcc')](_0x205d4b)[_0x635f('0xbd')](loggerCatch(_0x635f('0xe8')));if(_0x205d4b[_0x635f('0xe9')]+_0x205d4b['countcongestionretry']+_0x205d4b[_0x635f('0xea')]+_0x205d4b[_0x635f('0xeb')]+_0x205d4b[_0x635f('0xec')]+_0x205d4b['countabandonedretry']+_0x205d4b[_0x635f('0xed')]+_0x205d4b['countagentrejectretry']>=_0x5b2001[_0x635f('0xee')]){_0x22be64[_0x635f('0xef')](_0x205d4b,_0x58cb7f,_0x10c249,_0x635f('0xf0'));}else{if(_0x205d4b[_0x635f('0xed')]>=_0x5b2001['dialMachineMaxRetry']){_0x22be64[_0x635f('0xf1')](_0x205d4b,_0x58cb7f,_0x10c249,_0x635f('0xf2'));}else{_0x22be64[_0x635f('0xc3')]({'active':![],'countmachineretry':_0x205d4b[_0x635f('0xed')],'scheduledat':moment()['add'](_0x5b2001[_0x635f('0xf3')],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x205d4b[_0x635f('0xd1')],'ListId':_0x205d4b[_0x635f('0xf6')],'VoiceQueueId':_0x205d4b[_0x635f('0xd3')]||undefined,'CampaignId':_0x205d4b[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0xf7')));_0x58cb7f({'reschedule':0x1});}}});}if(_0x5391e8[_0x635f('0x83')]===_0x635f('0x84')&&this['campaigns'][_0x5391e8[_0x635f('0xb7')]][_0x635f('0xdf')]&&_0x164911[_0x635f('0xe6')]===_0x635f('0xe0')){delete this[_0x635f('0x28')][_0x164911[_0x635f('0xd9')]];this[_0x635f('0xb6')](this['campaigns'][_0x5391e8[_0x635f('0xb7')]]);_0x547ce2=new Hangup(_0x5391e8,_0x164911);_0x547ce2[_0x635f('0xab')]=0x12;_0x547ce2[_0x635f('0xac')]='HangupInAMD';_0x547ce2['membername']='AMD';this[_0x635f('0xcf')](_0x547ce2,_0x635f('0xf8'),'[syncHangupInAMDIvr]');}if(_0x5391e8[_0x635f('0x83')]==='ivr'&&this['campaigns'][_0x5391e8[_0x635f('0xb7')]][_0x635f('0xdf')]&&_0x164911['value']===_0x635f('0xf9')){var _0x22be64=this;return new BPromise(function(_0x5405ff,_0x119c7d){delete _0x22be64[_0x635f('0x28')][_0x164911[_0x635f('0xd9')]];_0x22be64[_0x635f('0xb6')](_0x22be64[_0x635f('0x22')][_0x5391e8[_0x635f('0xb7')]]);_0x22be64['campaigns'][_0x5391e8[_0x635f('0xb7')]][_0x635f('0x64')]+=0x1;_0x22be64[_0x635f('0x22')][_0x5391e8['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x41b253=_0x22be64[_0x635f('0x22')][_0x5391e8['queue']];var _0x4efe81=new Hangup(_0x5391e8,_0x164911);_0x4efe81[_0x635f('0xab')]=0x13;_0x4efe81[_0x635f('0xac')]='Machine';_0x4efe81[_0x635f('0xe2')]=_0x635f('0xe3');_0x4efe81[_0x635f('0xed')]+=0x1;_0x4efe81[_0x635f('0xfa')]+=0x1;_0x4efe81[_0x635f('0xe7')]=!![];_0x22be64[_0x635f('0xcc')](_0x4efe81)[_0x635f('0xbd')](loggerCatch(_0x635f('0xe8')));if(_0x4efe81[_0x635f('0xe9')]+_0x4efe81[_0x635f('0xfb')]+_0x4efe81[_0x635f('0xea')]+_0x4efe81['countnosuchnumberretry']+_0x4efe81[_0x635f('0xec')]+_0x4efe81['countabandonedretry']+_0x4efe81[_0x635f('0xed')]+_0x4efe81[_0x635f('0xfc')]>=_0x41b253[_0x635f('0xee')]){_0x22be64['stateGlobal'](_0x4efe81,_0x5405ff,_0x119c7d,_0x635f('0xf0'));}else{if(_0x4efe81[_0x635f('0xed')]>=_0x41b253['dialMachineMaxRetry']){_0x22be64[_0x635f('0xf1')](_0x4efe81,_0x5405ff,_0x119c7d,_0x635f('0xf2'));}else{_0x22be64['rescheduleContact']({'active':![],'countmachineretry':_0x4efe81[_0x635f('0xed')],'scheduledat':moment()[_0x635f('0xfd')](_0x41b253[_0x635f('0xf3')],_0x635f('0xf4'))[_0x635f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4efe81[_0x635f('0xd1')],'ListId':_0x4efe81['ListId'],'VoiceQueueId':_0x4efe81[_0x635f('0xd3')]||undefined,'CampaignId':_0x4efe81[_0x635f('0xd4')]||undefined})['catch'](loggerCatch(_0x635f('0xf7')));_0x5405ff({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x635f('0x37')]=function(_0x607a82){var _0x131485=this[_0x635f('0x28')][_0x607a82[_0x635f('0xd9')]];var _0xdf7ea5=this;var _0x2a8c6e;if(_0x131485&&_0x131485['type']===_0x635f('0x84')){delete this[_0x635f('0x28')][_0x607a82[_0x635f('0xd9')]];this['updateOriginated'](this[_0x635f('0x22')][_0x131485['queue']]);this[_0x635f('0x22')][_0x131485[_0x635f('0xb7')]][_0x635f('0xfe')]+=0x1;_0x2a8c6e=new Hangup(_0x131485,_0x607a82);this[_0x635f('0xcc')](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch(_0x635f('0xff')));this[_0x635f('0xca')](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch(_0x635f('0x100')));}if(_0x131485&&_0x131485['type']!==_0x635f('0x84')&&isNotNull(this[_0x635f('0x21')][_0x131485[_0x635f('0xb7')]][_0x635f('0x101')])){delete this['uniqueId'][_0x607a82['uniqueid']];this[_0x635f('0xb6')](this['voiceQueues'][_0x131485[_0x635f('0xb7')]]);this[_0x635f('0x21')][_0x131485[_0x635f('0xb7')]][_0x635f('0x64')]+=0x1;this[_0x635f('0x21')][_0x131485['queue']][_0x635f('0x63')]+=0x1;_0x2a8c6e=new Hangup(_0x131485,_0x607a82);_0x2a8c6e[_0x635f('0xab')]=0x10;_0x2a8c6e[_0x635f('0xac')]=_0x635f('0x102');_0x2a8c6e[_0x635f('0xe2')]='AGI';this['createHistory'](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch(_0x635f('0xff')));this[_0x635f('0xca')](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch(_0x635f('0x100')));}if(_0x131485&&_0x131485[_0x635f('0x83')]!=='ivr'&&!isNotNull(this[_0x635f('0x21')][_0x131485[_0x635f('0xb7')]][_0x635f('0x101')])){delete this[_0x635f('0x28')][_0x607a82[_0x635f('0xd9')]];this[_0x635f('0xb6')](this[_0x635f('0x21')][_0x131485[_0x635f('0xb7')]]);this[_0x635f('0x21')][_0x131485[_0x635f('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x2a8c6e=new Hangup(_0x131485,_0x607a82);_0x2a8c6e[_0x635f('0xab')]=0xc;_0x2a8c6e['statedesc']=_0x607a82['cause-txt'];_0x2a8c6e[_0x635f('0xe2')]=_0x635f('0x103');this[_0x635f('0xcc')](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x635f('0xca')](_0x2a8c6e)[_0x635f('0xbd')](loggerCatch(_0x635f('0x100')));}};Dialer[_0x635f('0xad')]['syncAgentComplete']=function(_0x1c329c){var _0x3e32fd=this['uniqueId'][_0x1c329c['uniqueid']];var _0x2b6080=this;if(this['voiceQueues'][_0x1c329c[_0x635f('0xb7')]]){if(_0x3e32fd&&_0x3e32fd['type']!==_0x635f('0x84')){delete this[_0x635f('0x28')][_0x1c329c[_0x635f('0xd9')]];this[_0x635f('0x21')][_0x1c329c[_0x635f('0xb7')]][_0x635f('0x64')]+=0x1;var _0x2ee8c8=new AgentComplete(_0x3e32fd,_0x1c329c);if(_0x1c329c[_0x635f('0x104')]===_0x635f('0x105')){_0x2ee8c8[_0x635f('0x106')]=this[_0x635f('0x21')][_0x1c329c[_0x635f('0xb7')]][_0x635f('0x107')]&&this['voiceQueues'][_0x1c329c[_0x635f('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x635f('0x81')](_0x635f('0xf5')):undefined;}this[_0x635f('0xcc')](_0x2ee8c8)[_0x635f('0xbd')](loggerCatch(_0x635f('0x108')));this[_0x635f('0xca')](_0x2ee8c8)[_0x635f('0xbd')](loggerCatch(_0x635f('0x109')));}}};Dialer[_0x635f('0xad')][_0x635f('0x2f')]=function(_0x28d5e1){if(this[_0x635f('0x21')][_0x28d5e1['queue']]){if(this[_0x635f('0x28')][_0x28d5e1[_0x635f('0xd9')]]&&this[_0x635f('0x28')][_0x28d5e1[_0x635f('0xd9')]]['type']!==_0x635f('0x84')){this['updateOriginated'](this[_0x635f('0x21')][_0x28d5e1['queue']]);this[_0x635f('0x28')][_0x28d5e1[_0x635f('0xd9')]][_0x635f('0x10a')]=moment()['format'](_0x635f('0xf5'));}}};Dialer[_0x635f('0xad')][_0x635f('0x10b')]=function(_0x468eda){this['createHistory'](_0x468eda)[_0x635f('0xbd')](loggerCatch(_0x635f('0x108')));this['moveContactManagedDialer'](_0x468eda)[_0x635f('0xbd')](loggerCatch(_0x635f('0x10c')));};Dialer['prototype'][_0x635f('0x10d')]=function(_0x422bf5){var _0x30a258=this[_0x635f('0x28')][_0x422bf5['uniqueid']];var _0xf2b9a4=this;if(this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]]){if(_0x30a258&&_0x30a258[_0x635f('0x83')]!==_0x635f('0x84')){delete this[_0x635f('0x28')][_0x422bf5[_0x635f('0xd9')]];this['updateOriginated'](this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]]);_0x30a258[_0x635f('0x10e')]=moment()[_0x635f('0x81')](_0x635f('0xf5'));var _0x1d4562=new QueueCallerAbandon(_0x30a258,_0x422bf5);if(getSeconds(_0x30a258['droptime'],_0x30a258[_0x635f('0x10f')])>=_0x30a258['dialQueueTimeout']){this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x72')]+=0x1;this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x68')]+=0x1;this['voiceQueues'][_0x422bf5['queue']][_0x635f('0x74')]+=0x1;_0x1d4562[_0x635f('0xab')]=0xa;_0x1d4562['statedesc']=_0x635f('0x110');_0x1d4562[_0x635f('0x111')]=_0x635f('0x112');_0x1d4562['agiafterat']=this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x107')]?moment()[_0x635f('0x81')](_0x635f('0xf5')):undefined;_0x1d4562[_0x635f('0xec')]+=0x1;_0x1d4562['countglobal']+=0x1;if(_0x1d4562[_0x635f('0xec')]>=this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x113')]){this[_0x635f('0x10b')](_0x1d4562);}else{this[_0x635f('0xc3')]({'active':![],'countdropretry':_0x1d4562['countdropretry'],'scheduledat':moment()[_0x635f('0xfd')](this['voiceQueues'][_0x422bf5[_0x635f('0xb7')]]['dialDropRetryFrequency'],_0x635f('0xf4'))['format'](_0x635f('0xf5')),'ContactId':_0x30a258[_0x635f('0xd1')],'ListId':_0x30a258[_0x635f('0xf6')],'VoiceQueueId':_0x30a258['VoiceQueueId']||undefined,'CampaignId':_0x30a258[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x114')));var _0x4304e3=new History(_0x1d4562);_0x4304e3[_0x635f('0xab')]=0xa;_0x4304e3[_0x635f('0xac')]='Drop';_0x4304e3[_0x635f('0x115')]=moment()[_0x635f('0x81')](_0x635f('0xf5'));_0x4304e3[_0x635f('0x116')]=_0x4304e3[_0x635f('0x115')];_0x4304e3['calleridname']=_0x1d4562[_0x635f('0x117')];_0x4304e3[_0x635f('0x118')]=_0x1d4562[_0x635f('0x118')];this[_0x635f('0xcc')](_0x4304e3)[_0x635f('0xbd')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x71')]+=0x1;this['voiceQueues'][_0x422bf5['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x1d4562[_0x635f('0xab')]=0xb;_0x1d4562['statedesc']=_0x635f('0x119');_0x1d4562['dropreason']=_0x635f('0x11a');_0x1d4562[_0x635f('0x11b')]+=0x1;_0x1d4562[_0x635f('0xfa')]+=0x1;if(_0x1d4562[_0x635f('0x11b')]>=this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x11c')]){this['queueCallerAbandonCreateState'](_0x1d4562);}else{this[_0x635f('0xc3')]({'active':![],'countabandonedretry':_0x1d4562[_0x635f('0x11b')],'scheduledat':moment()[_0x635f('0xfd')](this[_0x635f('0x21')][_0x422bf5[_0x635f('0xb7')]][_0x635f('0x11d')],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x30a258[_0x635f('0xd1')],'ListId':_0x30a258[_0x635f('0xf6')],'VoiceQueueId':_0x30a258[_0x635f('0xd3')]||undefined,'CampaignId':_0x30a258['CampaignId']||undefined})[_0x635f('0xbd')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4304e3=new History(_0x1d4562);_0x4304e3[_0x635f('0xab')]=0xb;_0x4304e3[_0x635f('0xac')]=_0x635f('0x119');_0x4304e3[_0x635f('0x115')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4304e3[_0x635f('0x116')]=_0x4304e3[_0x635f('0x115')];_0x4304e3[_0x635f('0x117')]=_0x1d4562[_0x635f('0x117')];_0x4304e3[_0x635f('0x118')]=_0x1d4562['calleridnum'];this[_0x635f('0xcc')](_0x4304e3)[_0x635f('0xbd')](loggerCatch(_0x635f('0x11e')));}}}}};Dialer[_0x635f('0xad')][_0x635f('0x39')]=function(_0x5c4970){if(this['actions'][_0x5c4970['uniqueid']]){this[_0x635f('0xb0')][_0x5c4970[_0x635f('0xd9')]][_0x635f('0xb4')]=_0x5c4970['channel'];}if(this[_0x635f('0x28')][_0x5c4970[_0x635f('0xd9')]]){this['uniqueId'][_0x5c4970[_0x635f('0xd9')]]['channel']=_0x5c4970[_0x635f('0xb4')];}};Dialer[_0x635f('0xad')][_0x635f('0x3d')]=function(_0x433ffc){if(strategy[this[_0x635f('0x21')][this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]][_0x635f('0xb7')]][_0x635f('0x120')]]===_0x635f('0x1c')){if(this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]]&&_[_0x635f('0xda')](this['actions'][_0x433ffc[_0x635f('0x11f')]][_0x635f('0x121')])&&_0x433ffc[_0x635f('0xb3')]==='1'&&_0x433ffc[_0x635f('0x122')]==='0'){if(this[_0x635f('0x23')][_0x433ffc[_0x635f('0x123')]]){if(!this['agents'][_0x433ffc[_0x635f('0x123')]]['locked']){this[_0x635f('0x23')][_0x433ffc[_0x635f('0x123')]]['locked']=!![];this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]][_0x635f('0x121')]=!![];this['actions'][_0x433ffc[_0x635f('0x11f')]][_0x635f('0x123')]=_0x433ffc['stateinterface'];}}}}else if((strategy[this[_0x635f('0x21')][this[_0x635f('0xb0')][_0x433ffc['actionid']][_0x635f('0xb7')]]['strategy']]||_0x635f('0x124'))===_0x635f('0x124')){if(this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]]){if(this[_0x635f('0x23')][_0x433ffc[_0x635f('0x123')]]){this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]][_0x635f('0x123')]=_0x433ffc[_0x635f('0x123')];if(_[_0x635f('0xda')](this['queueBooked'][this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]]['queue']])){this[_0x635f('0x2d')][this['actions'][_0x433ffc[_0x635f('0x11f')]]['queue']]=[];}this[_0x635f('0x2d')][this[_0x635f('0xb0')][_0x433ffc[_0x635f('0x11f')]][_0x635f('0xb7')]]['push'](_[_0x635f('0xd0')](_[_0x635f('0x125')](this['actions'][_0x433ffc[_0x635f('0x11f')]],[_0x635f('0x126'),_0x635f('0x123')]),{'status':_0x433ffc[_0x635f('0xb3')],'paused':_0x433ffc[_0x635f('0x122')]}));}}}};function unlockQueueStatus(_0x1016c0,_0x402766){setTimeout(function(){if(_['isUndefined'](_0x1016c0[_0x635f('0x127')])){loggerBooked[_0x635f('0x9c')](_0x635f('0x128'),_0x402766);}_0x1016c0[_0x635f('0x127')]=!![];loggerBooked[_0x635f('0x86')](_0x635f('0x129'),_0x402766,JSON[_0x635f('0x4c')](_[_0x635f('0x125')](_0x1016c0,[_0x635f('0x43'),_0x635f('0x127')])));},0x1f3);}Dialer[_0x635f('0xad')]['syncQueueStatusComplete']=function(_0x32ba59){var _0x1458bd=this;var _0x163b33=_0x1458bd[_0x635f('0x21')][_0x1458bd[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]];if(strategy[this[_0x635f('0x21')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]['queue']][_0x635f('0x120')]]===_0x635f('0x1c')){if(this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]&&this['actions'][_0x32ba59['actionid']][_0x635f('0x123')]){this[_0x635f('0x20')][_0x635f('0x12a')](this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0x126')],this[_0x635f('0xb0')][_0x32ba59['actionid']][_0x635f('0x123')])[_0x635f('0xbd')](function(_0x81fb9f){logger[_0x635f('0x9c')](_0x635f('0x12b'),util[_0x635f('0x9d')](_0x81fb9f,{'showHidden':![],'depth':null}));})[_0x635f('0x12c')](function(){_0x1458bd[_0x635f('0xb6')](_0x1458bd[_0x635f('0x21')][_0x1458bd[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]);_0x1458bd[_0x635f('0x23')][_0x1458bd[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]['stateinterface']][_0x635f('0x121')]=![];delete _0x1458bd[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]];unlockQueueStatus(_0x163b33);});}else{this[_0x635f('0xb6')](this[_0x635f('0x21')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]);this[_0x635f('0xc3')]({'active':![],'ContactId':this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]['ContactId'],'ListId':this[_0x635f('0xb0')][_0x32ba59['actionid']][_0x635f('0xf6')],'VoiceQueueId':this[_0x635f('0xb0')][_0x32ba59['actionid']][_0x635f('0xd3')]||undefined,'CampaignId':this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x12d')));delete this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]];unlockQueueStatus(_0x163b33);}}else if((strategy[this[_0x635f('0x21')][this['actions'][_0x32ba59['actionid']]['queue']][_0x635f('0x120')]]||_0x635f('0x124'))===_0x635f('0x124')){var _0x42d23d;if(this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]&&!_[_0x635f('0x99')](this['queueBooked'][this[_0x635f('0xb0')][_0x32ba59['actionid']][_0x635f('0xb7')]])){if(this[_0x635f('0x12e')][_0x1458bd['actions'][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]){this[_0x635f('0x12e')][_0x1458bd[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]=this[_0x635f('0x12e')][this[_0x635f('0xb0')][_0x32ba59['actionid']]['queue']]?this[_0x635f('0x12e')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]['queue']]:this[_0x635f('0x2d')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]?this[_0x635f('0x2d')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]][_0x635f('0xb7')]]['_rr']||0x0:0x0;}this[_0x635f('0x2d')][this[_0x635f('0xb0')][_0x32ba59[_0x635f('0x11f')]]['queue']]['_rr']=this['queueBookedRR'][this[_0x635f('0xb0')][_0x32ba59['actionid']][_0x635f('0xb7')]];for(var _0x252ef3=0x0;_0x252ef3=0x0?!![]:![];})[_0x635f('0xbd')](myreject(_0x47ffab)));}}else{_0x4741c0[_0x635f('0x147')](ami[_0x635f('0xb2')]({'action':_0x635f('0x14e'),'command':util[_0x635f('0x81')](_0x635f('0x148'),_0x3afbdd,!_['isUndefined'](config[_0x635f('0x14a')][_0x469b42])?_0x469b42:'')})[_0x635f('0xbc')](function(_0x1d0b73){return _0x1d0b73[_0x635f('0x14b')][_0x635f('0x14c')](_0x635f('0x14d'))>=0x0?!![]:![];})[_0x635f('0xbd')](myreject(_0x47ffab)));}BPromise[_0x635f('0x14f')](_0x4741c0)['then'](function(_0x5e8c96){var _0x568ff5=_['some'](_0x5e8c96);if(_0x568ff5){return _0x16f2c9(_0x568ff5);}else{_0x4f303a[_0x635f('0x42')]=_0x3a8a71?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x47ffab(msgResponse(_0x635f('0x150'),'Failure',_0x635f('0x151')+_0x3a8a71+'\x20'+_0x11ad95+'\x20Interval\x20is\x20overtime:\x20'+util[_0x635f('0x9d')](_0x3afbdd,{'showHidden':![],'depth':null})+_0x635f('0x152')+_0x469b42));}})[_0x635f('0xbd')](function(_0x115be3){return _0x47ffab(msgResponse(_0x635f('0x13e'),'Failure',JSON['stringify'](_0x115be3)));});});};Dialer[_0x635f('0xad')]['checkDialMethod']=function(_0x2bb729){var _0x5e4346=this;return function(){switch(_0x2bb729[_0x635f('0x5f')]){case _0x635f('0x153'):freeVariablesPredictive(_0x2bb729);_0x5e4346[_0x635f('0x154')](_0x2bb729,0x1);break;case _0x635f('0x155'):freeVariablesPredictive(_0x2bb729);_0x5e4346[_0x635f('0x154')](_0x2bb729,_0x2bb729[_0x635f('0x156')]);break;case _0x635f('0xa'):_0x5e4346[_0x635f('0xa')](_0x2bb729);break;case _0x635f('0x9'):freeVariablesPredictive(_0x2bb729);_0x5e4346['handlePower'](_0x2bb729,0x1);break;default:freeVariablesPredictive(_0x2bb729);logger['error']('Queue',_0x2bb729[_0x635f('0x43')],_0x635f('0x157'));}};};Dialer[_0x635f('0xad')][_0x635f('0x158')]=function(_0x3f0d7b){var _0x528c4e=this;return function(){_0x528c4e[_0x635f('0x159')](_0x3f0d7b);};};Dialer['prototype'][_0x635f('0x15a')]=function(_0x3ea6c9){var _0x47b8b1=this;if(isNotPreview(_0x3ea6c9[_0x635f('0x5f')])){if(isVoiceQueueOutbound(_0x3ea6c9[_0x635f('0x83')])&&isActive(_0x3ea6c9[_0x635f('0x5e')])){_0x3ea6c9[_0x635f('0xa6')]=!![];BPromise['resolve']()[_0x635f('0xbc')](checkIsLoggedIn(_0x3ea6c9,_0x3ea6c9['loggedIn']))['then'](checkIsActive(_0x3ea6c9,_0x3ea6c9[_0x635f('0x5e')]))['then'](checkInterval(_0x3ea6c9))[_0x635f('0xbc')](_0x47b8b1[_0x635f('0x13b')](_0x3ea6c9))[_0x635f('0xbc')](_0x47b8b1['checkIfTime'](_0x3ea6c9[_0x635f('0x15b')],_0x3ea6c9[_0x635f('0x15c')],_0x3ea6c9['name'],_0x3ea6c9))['then'](_0x47b8b1[_0x635f('0x13f')](_0x3ea6c9[_0x635f('0x47')],_0x3ea6c9[_0x635f('0x15c')],_0x3ea6c9[_0x635f('0x43')],_0x3ea6c9))[_0x635f('0xbc')](_0x47b8b1[_0x635f('0x15d')](_0x3ea6c9))[_0x635f('0xbd')](loggerCatchQueueSummary(_0x635f('0x15e'),_0x3ea6c9));}else{notSendMessagesQueue(_0x3ea6c9);}}else{freeVariablesPredictive(_0x3ea6c9);}};Dialer[_0x635f('0xad')][_0x635f('0x13a')]=function(){var _0x4e972b=this;var _0x2e4cbc;for(var _0x21eceb in this['campaigns']){if(this[_0x635f('0x22')][_0x635f('0xa0')](_0x21eceb)){_0x2e4cbc=this[_0x635f('0x22')][_0x21eceb];if(isCampaignIvr(_0x2e4cbc[_0x635f('0x83')])&&isActive(_0x2e4cbc[_0x635f('0x7e')])){_0x2e4cbc[_0x635f('0xa6')]=!![];BPromise['resolve']()[_0x635f('0xbc')](checkIsActive(_0x2e4cbc,_0x2e4cbc[_0x635f('0x7e')]))[_0x635f('0xbc')](checkInterval(_0x2e4cbc))[_0x635f('0xbc')](_0x4e972b[_0x635f('0x13b')](_0x2e4cbc))[_0x635f('0xbc')](_0x4e972b['checkIfTime'](_0x2e4cbc[_0x635f('0x15b')],_0x2e4cbc['dialTimezone'],_0x2e4cbc[_0x635f('0x43')],_0x2e4cbc))[_0x635f('0xbc')](_0x4e972b['checkIfTimeIntervals'](_0x2e4cbc[_0x635f('0x47')],_0x2e4cbc[_0x635f('0x15c')],_0x2e4cbc[_0x635f('0x43')],_0x2e4cbc))[_0x635f('0xbc')](_0x4e972b[_0x635f('0x158')](_0x2e4cbc))[_0x635f('0xbd')](loggerCatchQueueSummary(_0x635f('0x15f'),_0x2e4cbc));}else{notSendMessagesCampaign(_0x2e4cbc);}}}};function getCallerIdRandom(_0x268827,_0x420a4b){var _0x5657fa,_0x51f338,_0x52c96e;if(_0x420a4b<=0x0){_0x420a4b=0x1;}_0x5657fa=new RegExp('\x5cw{0,'+_0x420a4b+'}$');_0x51f338=Math['pow'](0xa,_0x420a4b-0x1);_0x52c96e=Math['pow'](0xa,_0x420a4b)-0x1;return util[_0x635f('0x81')]('%s',_[_0x635f('0x160')](_0x268827,_0x5657fa,_['random'](_0x51f338,_0x52c96e)));}function extractCalleridName(_0x512d97){var _0x32f1d1=_0x512d97[_0x635f('0x161')](/"(.*?)"/);return _0x32f1d1?_0x32f1d1[0x1]:_0x512d97;}function extractCalleridNumber(_0x1df5d0){var _0xd54470=_0x1df5d0['match'](/<(.*?)>/);return _0xd54470?_0xd54470[0x1]:_0x1df5d0;}Dialer[_0x635f('0xad')][_0x635f('0x162')]=function(_0x160c9c,_0x3d1502){var _0x177e48=this;var _0x338125=uuid['v4']();this[_0x635f('0xb0')][_0x338125]=new Action(_0x160c9c,_0x3d1502,_0x338125);return new BPromise(function(_0x1e78a3,_0x3def4c){if(_[_0x635f('0x41')](_0x160c9c)&&'object'!==typeof _0x160c9c){return _0x3def4c(msgResponse('originate',_0x635f('0x144'),_0x635f('0x163')));}if(_[_0x635f('0x41')](_0x3d1502[_0x635f('0x164')]['phone'])||_0x3d1502['Contact']['phone']===null){return _0x3def4c(msgResponse(_0x635f('0x165'),_0x635f('0x144'),'contact\x20is\x20undefine'));}var _0x275d2c={'XMD-CALLERID':_0x177e48[_0x635f('0xb0')][_0x338125]['getCaller'](),'XMD-AGI':_0x160c9c[_0x635f('0x101')]?util[_0x635f('0x81')](_0x635f('0x166'),ipAgi,_0x160c9c[_0x635f('0x101')]):'NONE','XMD-AGIAFTER':_0x160c9c['dialQueueProject2']?util[_0x635f('0x81')]('\x22agi://%s/square,%s\x22',ipAgi,_0x160c9c[_0x635f('0x107')]):_0x635f('0x167'),'XMD-QUEUE':_0x160c9c[_0x635f('0x83')]===_0x635f('0x51')?util['format'](_0x635f('0x168'),_0x160c9c[_0x635f('0x43')],_0x160c9c[_0x635f('0x169')]||'',_0x160c9c[_0x635f('0x16a')]?'c':'',_0x160c9c[_0x635f('0x16b')]||0x3):_0x635f('0x167'),'XMD-CONTACTID':_0x3d1502[_0x635f('0xd1')],'XMD-CDRTYPE':_0x635f('0x16c'),'CALLERID(all)':_0x177e48['actions'][_0x338125][_0x635f('0x16d')](),'XMD-AMD':_0x160c9c[_0x635f('0xdf')]?_0x635f('0x16e'):_0x635f('0x167'),'XMD-DESTINATION':_0x635f('0xde')};if(_0x160c9c['dialAMDActive']){_0x275d2c[_0x635f('0x16f')]=_0x160c9c[_0x635f('0x170')]||0x9c4;_0x275d2c['XMD-AMDGREETING']=_0x160c9c[_0x635f('0x171')]||0x5dc;_0x275d2c[_0x635f('0x172')]=_0x160c9c[_0x635f('0x173')]||0x320;_0x275d2c[_0x635f('0x174')]=_0x160c9c[_0x635f('0x175')]||0x1388;_0x275d2c[_0x635f('0x176')]=_0x160c9c[_0x635f('0x177')]||0x64;_0x275d2c[_0x635f('0x178')]=_0x160c9c['dialAMDBetweenWordsSilence']||0x32;_0x275d2c[_0x635f('0x179')]=_0x160c9c['dialAMDMaximumNumberOfWords']||0x3;_0x275d2c['XMD-AMDSILENCETHRESHOLD']=_0x160c9c['dialAMDSilenceThreshold']||0x100;_0x275d2c[_0x635f('0x17a')]=_0x160c9c['dialAMDMaximumWordLength']||0x1388;}if(_0x160c9c['type']===_0x635f('0x51')){_0x275d2c[_0x635f('0x17b')]=_0x3d1502[_0x635f('0xd3')];}else{_0x275d2c[_0x635f('0x17c')]=_0x3d1502[_0x635f('0xd4')];}for(var _0x336d85 in _0x3d1502[_0x635f('0x164')]){if(_0x3d1502['Contact'][_0x635f('0xa0')](_0x336d85)){if(isNotNull(_0x3d1502[_0x635f('0x164')][_0x336d85])&&_0x336d85!=='id'&&_0x336d85!==_0x635f('0x17d')&&_0x336d85!==_0x635f('0x17e')&&_0x336d85!==_0x635f('0x17f')){_0x275d2c[util['format']('%s%s',_0x635f('0x180'),_[_0x635f('0x181')](_0x336d85))]=_0x3d1502[_0x635f('0x164')][_0x336d85];}}}var _0xec22fa=_0x177e48[_0x635f('0xd5')](_0x160c9c[_0x635f('0x7d')])?getCallerId(_0x160c9c[_0x635f('0x7d')]['callerid'],_0x160c9c[_0x635f('0x60')],_0x160c9c[_0x635f('0x182')]>0x0?getCallerIdRandom(_0x160c9c[_0x635f('0x61')],_0x160c9c['dialRandomLastDigitCallerIdNumber']):_0x160c9c[_0x635f('0x61')]):getCallerId(_[_0x635f('0xda')](_0x160c9c[_0x635f('0x183')])?_0x160c9c[_0x635f('0x7d')]['callerid']:_0x160c9c['TrunkBackup'][_0x635f('0x7f')],_0x160c9c[_0x635f('0x60')],_0x160c9c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x160c9c[_0x635f('0x61')],_0x160c9c[_0x635f('0x182')]):_0x160c9c['dialOriginateCallerIdNumber']);if(_0xec22fa){_0x275d2c[_0x635f('0x184')]=_0x177e48[_0x635f('0xb0')][_0x338125][_0x635f('0x185')]=extractCalleridName(_0xec22fa);_0x275d2c[_0x635f('0x186')]=_0x177e48[_0x635f('0xb0')][_0x338125][_0x635f('0x187')]=extractCalleridNumber(_0xec22fa);}return ami[_0x635f('0xb2')]({'actionid':_0x338125,'action':_0x635f('0x165'),'channel':_0x177e48[_0x635f('0xd5')](_0x160c9c[_0x635f('0x7d')])?util[_0x635f('0x81')](_0x635f('0x188'),_0x160c9c[_0x635f('0x7d')][_0x635f('0x43')],isNotNull(_0x160c9c[_0x635f('0x62')])?_0x160c9c[_0x635f('0x62')][_0x635f('0x189')]()||'':'',_0x160c9c[_0x635f('0x18a')]>0x0?_0x3d1502[_0x635f('0x164')]['phone'][_0x635f('0x18b')](_0x160c9c[_0x635f('0x18a')]):_0x3d1502[_0x635f('0x164')][_0x635f('0x18c')]):util[_0x635f('0x81')]('SIP/%s/%s%s',_['isNil'](_0x160c9c[_0x635f('0x183')])?_0x160c9c[_0x635f('0x7d')][_0x635f('0x43')]:_0x160c9c[_0x635f('0x183')][_0x635f('0x43')],isNotNull(_0x160c9c[_0x635f('0x62')])?_0x160c9c[_0x635f('0x62')][_0x635f('0x189')]()||'':'',_0x160c9c['dialCutDigit']>0x0?_0x3d1502[_0x635f('0x164')][_0x635f('0x18c')][_0x635f('0x18b')](_0x160c9c[_0x635f('0x18a')]):_0x3d1502[_0x635f('0x164')][_0x635f('0x18c')]),'callerid':_0xec22fa,'Exten':_0x635f('0xde'),'Context':_0x635f('0x18d'),'Priority':'1','variable':_0x275d2c,'timeout':(_0x160c9c[_0x635f('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x338125})['then'](function(_0x305c12){return _0x1e78a3(_0x305c12);})[_0x635f('0xbd')](function(_0x1db87b){_0x160c9c[_0x635f('0x6a')]+=0x1;var _0x40d427=new History(_0x177e48[_0x635f('0xb0')][_0x338125]);logger['error'](util[_0x635f('0x81')]('[originateError]:\x20%s',JSON['stringify'](_0x1db87b)));_0x40d427[_0x635f('0xab')]=0xe;_0x40d427[_0x635f('0xac')]=_0x635f('0x18f');_0x40d427[_0x635f('0x115')]=moment()['format'](_0x635f('0xf5'));_0x40d427['endtime']=_0x40d427[_0x635f('0x115')];_0x177e48['createHistory'](_0x40d427)[_0x635f('0xbd')](loggerCatch(_0x635f('0x190')));_0x177e48[_0x635f('0xca')](_0x40d427)[_0x635f('0xbd')](loggerCatch(_0x635f('0x190')))[_0x635f('0x12c')](function(){delete _0x177e48[_0x635f('0xb0')][_0x338125];return _0x3def4c(msgResponse(_0x635f('0x165'),'Error',_0x635f('0x191')));});});});};Dialer[_0x635f('0xad')][_0x635f('0x33')]=function(_0xbc86d8){var _0x10e72b=this[_0x635f('0xb0')][_0xbc86d8[_0x635f('0x11f')]];var _0x8bf1e1=this;if(_0x10e72b){delete this[_0x635f('0xb0')][_0xbc86d8[_0x635f('0x11f')]];_0x10e72b[_0x635f('0x10f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x59fc1b=_0x10e72b['type']===_0x635f('0x84')?this['campaigns'][_0x10e72b['queue']]:this['voiceQueues'][_0x10e72b[_0x635f('0x192')]()];if(!this[_0x635f('0x193')](_0xbc86d8[_0x635f('0x194')])){this[_0x635f('0xb6')](_0x59fc1b);return this[_0x635f('0x195')](_0x10e72b,_0x59fc1b,_0xbc86d8)[_0x635f('0xbc')](function(_0x3db265){})['catch'](loggerCatch(_0x635f('0x196')));}else{this['uniqueId'][_0xbc86d8['uniqueid']]=_0x10e72b;}}};Dialer[_0x635f('0xad')][_0x635f('0x197')]=function(_0x23339f,_0x5b5369,_0x92677){var _0x20902a=new History(_0x5b5369);if(_0x20902a[_0x635f('0xe9')]+_0x20902a[_0x635f('0xfb')]+_0x20902a['countnoanswerretry']+_0x20902a[_0x635f('0xeb')]+_0x20902a[_0x635f('0xec')]+_0x20902a[_0x635f('0x11b')]+_0x20902a[_0x635f('0xed')]+_0x20902a[_0x635f('0xfc')]>=_0x92677['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x23339f){case 0x3:if(_0x20902a[_0x635f('0xea')]>=_0x92677[_0x635f('0x198')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countnoanswerretry':_0x20902a[_0x635f('0xea')]+=0x1,'scheduledat':moment()['add'](_0x92677[_0x635f('0x199')],'minutes')['format'](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x19a')));}break;case 0x5:if(_0x20902a[_0x635f('0xe9')]>=_0x92677[_0x635f('0x19b')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countbusyretry':_0x20902a[_0x635f('0xe9')]+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677[_0x635f('0x19c')],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a['CampaignId']||undefined})[_0x635f('0xbd')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x20902a['countcongestionretry']>=_0x92677[_0x635f('0x19d')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countcongestionretry':_0x20902a[_0x635f('0xfb')]+=0x1,'scheduledat':moment()['add'](_0x92677['dialCongestionRetryFrequency'],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x19e')));}break;case 0x0:if(_0x20902a[_0x635f('0xeb')]>=_0x92677[_0x635f('0x19f')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countnosuchnumberretry':_0x20902a[_0x635f('0xeb')]+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677['dialNoSuchNumberRetryFrequency'],_0x635f('0xf4'))['format'](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x1a0')));}break;case 0xa:if(_0x20902a[_0x635f('0xec')]>=_0x92677[_0x635f('0x113')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countdropretry':_0x20902a[_0x635f('0xec')]+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677[_0x635f('0x1a1')],'minutes')[_0x635f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x114')));}break;case 0xb:if(_0x20902a['countabandonedretry']>=_0x92677['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countabandonedretry':_0x20902a['countabandonedretry']+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677[_0x635f('0x11d')],'minutes')[_0x635f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a['VoiceQueueId']||undefined,'CampaignId':_0x20902a['CampaignId']||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x1a2')));}break;case 0x13:if(_0x20902a[_0x635f('0xed')]>=_0x92677[_0x635f('0x1a3')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countmachineretry':_0x20902a[_0x635f('0xed')]+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677[_0x635f('0xf3')],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a['CampaignId']||undefined})[_0x635f('0xbd')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x20902a[_0x635f('0xfc')]>=_0x92677[_0x635f('0x1a4')]-0x1){return!![];}else{this[_0x635f('0xc3')]({'active':![],'countagentrejectretry':_0x20902a[_0x635f('0xfc')]+=0x1,'scheduledat':moment()[_0x635f('0xfd')](_0x92677[_0x635f('0x1a5')],_0x635f('0xf4'))[_0x635f('0x81')](_0x635f('0xf5')),'ContactId':_0x20902a[_0x635f('0xd1')],'ListId':_0x20902a[_0x635f('0xf6')],'VoiceQueueId':_0x20902a[_0x635f('0xd3')]||undefined,'CampaignId':_0x20902a[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x1a6')));}break;default:return!![];}};Dialer['prototype'][_0x635f('0x195')]=function(_0x171c81,_0x552e5c,_0x2cbf1d){var _0x23f8da=this;var _0x22172f=new History(_0x171c81);return new BPromise(function(_0x2878e9,_0x52dc1e){if(_[_0x635f('0x41')](_0x552e5c)&&'object'!==typeof _0x552e5c){return _0x52dc1e(msgResponse(_0x635f('0x1a7'),_0x635f('0x144'),_0x635f('0x1a8')));}if(_[_0x635f('0x41')](_0x2cbf1d)&&_0x635f('0x1a9')!==typeof _0x2cbf1d){return _0x52dc1e(msgResponse('[callProgressDetecting]',_0x635f('0x144'),_0x635f('0x1aa')));}switch(_0x2cbf1d['reason']){case'0':_0x552e5c[_0x635f('0x69')]+=0x1;_0x22172f[_0x635f('0xab')]=0x0;_0x22172f[_0x635f('0xac')]='NoSuchNumber';_0x22172f[_0x635f('0xeb')]+=0x1;_0x22172f[_0x635f('0xfa')]+=0x1;ami[_0x635f('0x50')](_0x635f('0x1ab'),ut['buildObj'](_0x171c81,_0x635f('0x1ac')));_0x23f8da[_0x635f('0xcc')](_0x22172f)['catch'](loggerCatch(_0x635f('0xe8')));if(_0x23f8da[_0x635f('0x197')](0x0,_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0xeb')]>=_0x552e5c['dialNoSuchNumberMaxRetry']){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1ad'));}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1ad'));}}break;case'3':_0x552e5c['outboundNoAnswerCallsDay']+=0x1;_0x22172f[_0x635f('0xab')]=0x3;_0x22172f[_0x635f('0xac')]=_0x635f('0x1ae');_0x22172f[_0x635f('0xea')]+=0x1;_0x22172f[_0x635f('0xfa')]+=0x1;ami[_0x635f('0x50')]('custom:agentnoanswer',ut[_0x635f('0x1af')](_0x171c81,_0x635f('0x1b0')));_0x23f8da['createHistory'](_0x22172f)[_0x635f('0xbd')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x23f8da[_0x635f('0x197')](0x3,_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0xea')]>=_0x552e5c['dialNoAnswerMaxRetry']){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1b1'));}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1b1'));}}break;case'5':_0x552e5c['outboundBusyCallsDay']+=0x1;_0x22172f['state']=0x5;_0x22172f['statedesc']=_0x635f('0x1b2');_0x22172f['countbusyretry']+=0x1;_0x22172f[_0x635f('0xfa')]+=0x1;ami[_0x635f('0x50')]('custom:agentbusy',ut[_0x635f('0x1af')](_0x171c81,_0x635f('0x1b3')));_0x23f8da['createHistory'](_0x22172f)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x23f8da['checkRetriveMax'](0x5,_0x171c81,_0x552e5c)){if(_0x22172f['countbusyretry']>=_0x552e5c['dialBusyMaxRetry']){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,'reason\x205\x20busy');}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1b4'));}}break;case'8':_0x552e5c[_0x635f('0x1b5')]+=0x1;_0x22172f[_0x635f('0xab')]=0x8;_0x22172f[_0x635f('0xac')]=_0x635f('0x1b6');_0x22172f[_0x635f('0xfb')]+=0x1;_0x22172f['countglobal']+=0x1;ami[_0x635f('0x50')](_0x635f('0x1b7'),ut[_0x635f('0x1af')](_0x171c81,'congestion'));_0x23f8da[_0x635f('0xcc')](_0x22172f)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x23f8da['checkRetriveMax'](0x8,_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0xfb')]>=_0x552e5c['dialCongestionMaxRetry']){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1b8'));}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1b8'));}}break;case'11':_0x552e5c[_0x635f('0x1b9')]+=0x1;_0x22172f[_0x635f('0xab')]=0xb;_0x22172f[_0x635f('0xac')]=_0x635f('0x119');_0x22172f[_0x635f('0x11b')]+=0x1;_0x22172f[_0x635f('0xfa')]+=0x1;_0x23f8da['createHistory'](_0x22172f)[_0x635f('0xbd')](loggerCatch(_0x635f('0x11e')));if(_0x23f8da[_0x635f('0x197')](0xb,_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0x11b')]>=_0x552e5c[_0x635f('0x11c')]){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,'reason\x2011\x20abandoned');}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1ba'));}}break;case'20':_0x552e5c[_0x635f('0x6c')]+=0x1;_0x22172f[_0x635f('0xab')]=0x14;_0x22172f[_0x635f('0xac')]=_0x635f('0x1bb');_0x22172f['countagentrejectretry']+=0x1;_0x22172f[_0x635f('0xfa')]+=0x1;ami[_0x635f('0x50')]('custom:agentreject',ut[_0x635f('0x1af')](_0x171c81,_0x635f('0x1bc')));_0x23f8da['createHistory'](_0x22172f)[_0x635f('0xbd')](loggerCatch(_0x635f('0x1bd')));if(_0x23f8da[_0x635f('0x197')](0x14,_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0xfc')]>=_0x552e5c[_0x635f('0x1a4')]){_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1be'));}else{_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x635f('0x1be'));}}break;default:_0x552e5c[_0x635f('0x6d')]+=0x1;_0x22172f[_0x635f('0xab')]=0xc;_0x22172f[_0x635f('0xac')]=_0x2cbf1d[_0x635f('0x104')];_0x23f8da[_0x635f('0xcc')](_0x22172f)[_0x635f('0xbd')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x23f8da[_0x635f('0x197')](_0x2cbf1d[_0x635f('0x104')],_0x171c81,_0x552e5c)){if(_0x22172f[_0x635f('0xe9')]+_0x22172f[_0x635f('0xfb')]+_0x22172f[_0x635f('0xea')]+_0x22172f['countnosuchnumberretry']+_0x22172f['countdropretry']+_0x22172f['countabandonedretry']+_0x22172f[_0x635f('0xed')]+_0x22172f[_0x635f('0xfc')]>=_0x552e5c[_0x635f('0xee')]){_0x23f8da[_0x635f('0xef')](_0x22172f,_0x2878e9,_0x52dc1e,_0x2cbf1d[_0x635f('0x104')]);}else{_0x23f8da[_0x635f('0xf1')](_0x22172f,_0x2878e9,_0x52dc1e,_0x2cbf1d[_0x635f('0x104')]);}}}});};Dialer[_0x635f('0xad')][_0x635f('0xef')]=function(_0x1f74a2,_0x33e5aa,_0x1f7800,_0x401d68){var _0x587d31=new Final(_0x1f74a2);_0x587d31[_0x635f('0xab')]=0xf;_0x587d31[_0x635f('0xac')]=_0x635f('0x1bf');this[_0x635f('0xf1')](_0x587d31,_0x33e5aa,_0x1f7800,_0x401d68);};Dialer[_0x635f('0xad')]['createStateFinal']=function(_0x5000cd,_0x98ccd0,_0x2f5c7b,_0x30e5b6){this['moveContactManagedDialer'](_0x5000cd)[_0x635f('0xbc')](function(_0x1f261c){return _0x98ccd0(msgResponse(_0x635f('0x1a7'),_0x635f('0x1c0'),_0x30e5b6));})[_0x635f('0xbd')](function(_0x2835b8){return _0x2f5c7b(msgResponse(_0x635f('0x1c1'),_0x635f('0x144'),_0x635f('0x1c2')));});};Dialer[_0x635f('0xad')][_0x635f('0xa')]=function(_0xfc059a){var _0x318e08=this;var _0x3ce697=_0xfc059a[_0x635f('0x1c3')]/0x64;var _0x527b98=_0xfc059a[_0x635f('0x68')]/(_0xfc059a['outboundDropCallsDayTimeout']+_0xfc059a[_0x635f('0x64')]);var _0x1993dc=Math[_0x635f('0x1c4')](_0xfc059a['predictiveIntervalAvailable']*(_0xfc059a[_0x635f('0x1c5')]/0x64));var _0x4a2e90=Math[_0x635f('0x1c4')](_0xfc059a[_0x635f('0x78')]*(_0xfc059a['predictiveIntervalMinThreshold']/0x64));var _0x55538f=_0xfc059a[_0x635f('0x53')]+_0xfc059a[_0x635f('0x58')];var _0x45c92f=Math[_0x635f('0x1c6')](_0xfc059a[_0x635f('0x7a')]*_0xfc059a[_0x635f('0x7b')]*_0xfc059a[_0x635f('0x75')]*_0xfc059a[_0x635f('0x76')]);if(_[_0x635f('0x41')](_0xfc059a['startProgressive'])){if(!_[_0x635f('0x41')](_0xfc059a[_0x635f('0x2a')])){_0xfc059a['startPredictive']=undefined;loggerPredictive[_0x635f('0x9c')]('[startMethodPredictive][StartProgressive]',_0x635f('0x1c7'));}if(!_[_0x635f('0x41')](_0xfc059a[_0x635f('0x96')])){loggerPredictive[_0x635f('0x9c')](_0x635f('0x1c8'),_0x635f('0x1c9'));clearInterval(_0xfc059a[_0x635f('0x96')]);_0xfc059a[_0x635f('0x96')]=undefined;}_0xfc059a['startProgressive']=moment()[_0x635f('0x81')](_0x635f('0xf5'));loggerPredictive[_0x635f('0x86')](_0xfc059a[_0x635f('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0xfc059a[_0x635f('0x2b')]);this[_0x635f('0x154')](_0xfc059a,0x1);}else if(ifInterval(_0xfc059a[_0x635f('0x1ca')],_0xfc059a['startProgressive'])){this[_0x635f('0x154')](_0xfc059a,0x1);loggerPredictiveCalls[_0x635f('0x86')](_0x635f('0x1cb'),_0xfc059a['startProgressive'],_0xfc059a[_0x635f('0x43')]);_0xfc059a['erlangCalls']=0x0;_0xfc059a[_0x635f('0x74')]=0x0;}else if(_0x3ce697<_0x527b98&&_0xfc059a['dialPredictiveOptimization']===_0x635f('0x1cc')){freeVariablesPredictive(_0xfc059a);loggerPredictive[_0x635f('0x86')](_0x635f('0x1cd'),_0x635f('0x1ce'),_0x527b98,_0x635f('0x2b'),_0xfc059a[_0x635f('0x43')]);}else if(_0x45c92f<_0xfc059a[_0x635f('0x74')]&&_0xfc059a[_0x635f('0x1cf')]===_0x635f('0x1cc')){freeVariablesPredictive(_0xfc059a);loggerPredictive['info'](_0x635f('0x1d0'),'Max\x20Drop\x20',_0x45c92f,_0x635f('0x1d1'),_0xfc059a[_0x635f('0x74')],_0x635f('0x2b'),_0xfc059a[_0x635f('0x43')]);}else if(!ifInterval(_0xfc059a[_0x635f('0x1ca')],_0xfc059a[_0x635f('0x2b')])&&_[_0x635f('0x41')](_0xfc059a[_0x635f('0x2a')])&&!_['isUndefined'](_0xfc059a[_0x635f('0x2b')])){_0xfc059a[_0x635f('0x2a')]=moment()[_0x635f('0x81')](_0x635f('0xf5'));loggerPredictive[_0x635f('0x86')](_0xfc059a[_0x635f('0x43')],_0x635f('0x1d2'),_0xfc059a[_0x635f('0x2a')]);this['averageHandleTime'](_0xfc059a[_0x635f('0x1ca')])['then'](this[_0x635f('0x1d3')](_0xfc059a))['then'](mergeDataErlangB(_0xfc059a))[_0x635f('0xbc')](this['startMethodPredictive'](_0xfc059a))[_0x635f('0xbd')](loggerCatchPredictive(_0x635f('0x1d4'),_0xfc059a));}else if(!ifInterval(_0xfc059a[_0x635f('0x1ca')],_0xfc059a['startPredictive'])){_0xfc059a['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xfc059a['startPredictive']=moment()[_0x635f('0x81')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x635f('0x86')](_0xfc059a[_0x635f('0x43')],_0x635f('0x1d5'),_0xfc059a[_0x635f('0x2a')]);clearInterval(_0xfc059a[_0x635f('0x96')]);_0xfc059a[_0x635f('0x96')]=undefined;this[_0x635f('0x1d6')](_0xfc059a[_0x635f('0x1ca')])[_0x635f('0xbc')](this[_0x635f('0x1d3')](_0xfc059a))[_0x635f('0xbc')](mergeDataErlangB(_0xfc059a))[_0x635f('0xbc')](this[_0x635f('0x1d7')](_0xfc059a))[_0x635f('0xbd')](loggerCatchPredictive(_0x635f('0x1d8'),_0xfc059a));}else if(_0xfc059a['predictiveIntervalAvailable']&&_0x55538f<_0xfc059a[_0x635f('0x78')]-_0x4a2e90){freeVariablesPredictive(_0xfc059a);loggerPredictive['info'](_0xfc059a['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x55538f,')\x20are\x20less\x20than\x20threshold\x20(',_0xfc059a['predictiveIntervalAvailable'],'-',_0x4a2e90,'=',_0xfc059a[_0x635f('0x78')]-_0x4a2e90,')');}else if(_0xfc059a[_0x635f('0x78')]&&_0x55538f>_0xfc059a[_0x635f('0x78')]+_0x1993dc){freeVariablesPredictive(_0xfc059a);loggerPredictive['info'](_0xfc059a[_0x635f('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x55538f,_0x635f('0x1d9'),_0xfc059a[_0x635f('0x78')],'+',_0x1993dc,'=',_0xfc059a[_0x635f('0x78')]+_0x1993dc,')');}};Dialer[_0x635f('0xad')][_0x635f('0x1d3')]=function(_0x27c0ec){var _0x1474b0=this;return function(_0x302bfa){return new BPromise(function(_0x383228,_0x20b147){_[_0x635f('0xd0')](_0x27c0ec,_0x302bfa[0x0]);if(checkGetDataPredictive(_0x302bfa[0x0])){var _0x183988=_0x27c0ec['predictiveIntervalAvailable']=_0x27c0ec[_0x635f('0x58')]+_0x27c0ec[_0x635f('0x53')];var _0x842451=_0x27c0ec[_0x635f('0x1ca')]*0x3c;var _0xe7b422=_0x302bfa[0x0][_0x635f('0x70')]+_0x302bfa[0x0][_0x635f('0x6f')];var _0x42f12e=(_0x302bfa[0x0][_0x635f('0x6e')]+_0x302bfa[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x302bfa[0x0][_0x635f('0x71')])/_0x302bfa[0x0][_0x635f('0x79')];_0x27c0ec['predictiveIntervalHitRate']=_0x42f12e>0x0?_0x42f12e:0x1;switch(_0x27c0ec['dialPredictiveOptimization']){case _0x635f('0x1cc'):var _0x4d08a3=_0x27c0ec[_0x635f('0x1c3')]/0x64;return _0x1474b0[_0x635f('0x1da')](_0x183988,_0x842451,_0xe7b422,_0x42f12e,_0x4d08a3)[_0x635f('0xbc')](function(_0x15215a){return _0x383228(_0x15215a);});case'agentBusyFactor':var _0x4ccb3f=_0x27c0ec['dialPredictiveOptimizationPercentage']/0x64;return _0x1474b0[_0x635f('0x1db')](_0x183988,_0x842451,_0xe7b422,_0x42f12e,_0x4ccb3f)[_0x635f('0xbc')](function(_0x136003){return _0x383228(_0x136003);});default:return _0x20b147(msgResponse(_0x635f('0x1dc'),'Failure','Unknown\x20Predictive'));}}else{return _0x20b147(msgResponse(_0x635f('0x1dc'),_0x635f('0x144'),_0x635f('0x1dd')));}});};};Dialer[_0x635f('0xad')][_0x635f('0x1de')]=function(_0x315590){var _0x2e4dc2=this;return function(_0x3069fc){return new BPromise(function(_0x51a0bb,_0x113782){_[_0x635f('0xd0')](_0x315590,_0x3069fc[0x0]);if(checkGetDataPredictive(_0x3069fc[0x0])){loggerPredictive['info'](JSON[_0x635f('0x4c')](_0x3069fc[0x0]));if(_0x315590[_0x635f('0x1cf')]===_0x635f('0x1cc')){return _0x2e4dc2['getVoiceQueueRtPauses'](_0x315590['id'])[_0x635f('0xbc')](function(_0x2c2618){var _0xabec35=_0x315590[_0x635f('0x1df')]-_0x2c2618[0x0]['outboundQueuePauses'];var _0x55ecf1=_0x315590[_0x635f('0x1ca')]*0x3c;var _0x35d030=_0x3069fc[0x0]['predictiveIntervalAvgTalktime']+_0x3069fc[0x0][_0x635f('0x6f')];var _0x28b459=(_0x3069fc[0x0][_0x635f('0x6e')]+_0x3069fc[0x0][_0x635f('0x72')]+_0x3069fc[0x0][_0x635f('0x71')])/_0x3069fc[0x0][_0x635f('0x79')];var _0x46f773=_0x315590[_0x635f('0x1c3')]/0x64;_0x315590['predictiveIntervalPauses']=_0x2c2618[0x0][_0x635f('0x1e0')]||0x0;_0x315590[_0x635f('0x75')]=_0x28b459>0x0?_0x28b459:0x1;return _0x2e4dc2['abandonmentRate'](_0xabec35,_0x55ecf1,_0x35d030,_0x28b459,_0x46f773);})[_0x635f('0xbc')](function(_0x3b8354){return _0x51a0bb(_0x3b8354);})[_0x635f('0xbd')](function(_0xbc2c23){return _0x113782(msgResponse(_0x635f('0x1e1'),'Failure',JSON[_0x635f('0x4c')](_0xbc2c23)));});}if(_0x315590[_0x635f('0x1cf')]==='agentBusyFactor'){return _0x2e4dc2['getVoiceQueueRtPauses'](_0x315590['id'])[_0x635f('0xbc')](function(_0x54c7bd){var _0x4c8231=_0x315590[_0x635f('0x1df')]-_0x54c7bd[0x0]['outboundQueuePauses'];var _0x535fad=_0x315590[_0x635f('0x1ca')]*0x3c;var _0x40737f=_0x3069fc[0x0][_0x635f('0x70')]+_0x3069fc[0x0][_0x635f('0x6f')];var _0x241cb0=(_0x3069fc[0x0][_0x635f('0x6e')]+_0x3069fc[0x0][_0x635f('0x72')]+_0x3069fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3069fc[0x0]['predictiveIntervalTotalCalls'];var _0x21718b=_0x315590[_0x635f('0x1c3')]/0x64;_0x315590[_0x635f('0x77')]=_0x54c7bd[0x0]['outboundQueuePauses']||0x0;_0x315590[_0x635f('0x75')]=_0x241cb0>0x0?_0x241cb0:0x1;return _0x2e4dc2[_0x635f('0x1db')](_0x4c8231,_0x535fad,_0x40737f,_0x241cb0,_0x21718b);})[_0x635f('0xbc')](function(_0x3adbad){return _0x51a0bb(_0x3adbad);})[_0x635f('0xbd')](function(_0x289597){return _0x113782(msgResponse(_0x635f('0x1e1'),'Failure',JSON[_0x635f('0x4c')](_0x289597)));});}}else{return _0x113782(msgResponse(_0x635f('0x1dc'),_0x635f('0x144'),_0x635f('0x1dd')));}});};};Dialer[_0x635f('0xad')][_0x635f('0x1d7')]=function(_0xceefe8){var _0x353782=this;return function(){var _0x40bb37=0x0;var _0x23c49d=Math['floor'](_0xceefe8[_0x635f('0x91')]*0x3e8);if(_0x23c49d>0x0){_0x23c49d=_0x23c49d<0x64?0x64:_0x23c49d;loggerPredictive[_0x635f('0x86')](_0xceefe8[_0x635f('0x43')],_0x635f('0x1e2'),_0x23c49d,'milliseconds');_0xceefe8[_0x635f('0x96')]=setInterval(function(){_0x353782[_0x635f('0x96')](_0xceefe8);loggerPredictiveCalls['info']('[handlePredictive]',_0x40bb37+=0x1);},_0x23c49d);}else{loggerPredictive['info'](_0xceefe8[_0x635f('0x43')],_0x635f('0x1e3'));}};};Dialer[_0x635f('0xad')][_0x635f('0x1e4')]=function(_0x3c735a,_0x4e9796){var _0x4b9b86=this;return function(_0x41ad2d){if(_[_0x635f('0x99')](_0x41ad2d)){if(_[_0x635f('0xda')](_0x4e9796[_0x635f('0xd2')])||!_0x4e9796[_0x635f('0x1e5')]){if(_0x3c735a[_0x635f('0x5f')]===_0x635f('0x9')){_0x3c735a[_0x635f('0x127')]=_[_0x635f('0x41')](_0x3c735a[_0x635f('0x127')])?!![]:_0x3c735a['queueStatusComplete'];var _0x416373=uuid['v4']();_0x4b9b86['actions'][_0x416373]=new Action(_0x3c735a,_0x4e9796,_0x416373);loggerBooked[_0x635f('0x86')](_0x635f('0x1e6'),_0x416373,_0x635f('0x1e7'),JSON[_0x635f('0x4c')](_0x3c735a[_0x635f('0x127')]),_0x635f('0x1e8'),_0x3c735a[_0x635f('0x43')]);if(_0x3c735a[_0x635f('0x127')]){_0x3c735a['queueStatusComplete']=![];_0x4b9b86['queueBooked'][_0x4b9b86[_0x635f('0xb0')][_0x416373]['queue']]=[];ami[_0x635f('0xb2')]({'actionid':_0x416373,'action':_0x635f('0x1e9'),'queue':_0x3c735a[_0x635f('0x43')]})[_0x635f('0xbd')](function(_0x15217d){_0x4b9b86['updateOriginated'](_0x3c735a);_0x4b9b86[_0x635f('0xc3')]({'active':![],'ContactId':_0x4b9b86[_0x635f('0xb0')][_0x416373][_0x635f('0xd1')],'ListId':_0x4b9b86[_0x635f('0xb0')][_0x416373][_0x635f('0xf6')],'VoiceQueueId':_0x4b9b86[_0x635f('0xb0')][_0x416373][_0x635f('0xd3')]||undefined,'CampaignId':_0x4b9b86['actions'][_0x416373]['CampaignId']||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x1ea')));delete _0x4b9b86['actions'][_0x416373];});}else{loggerBooked[_0x635f('0x86')]('[booked][checkContactBlack][else]',JSON[_0x635f('0x4c')](_0x3c735a[_0x635f('0x127')]),_0x635f('0x1e8'),_0x3c735a[_0x635f('0x43')]);_0x4b9b86[_0x635f('0xb6')](_0x3c735a);_0x4b9b86[_0x635f('0xc3')]({'active':![],'ContactId':_0x4b9b86[_0x635f('0xb0')][_0x416373]['ContactId'],'ListId':_0x4b9b86[_0x635f('0xb0')][_0x416373][_0x635f('0xf6')],'VoiceQueueId':_0x4b9b86[_0x635f('0xb0')][_0x416373]['VoiceQueueId']||undefined,'CampaignId':_0x4b9b86[_0x635f('0xb0')][_0x416373][_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch(_0x635f('0x1ea')));delete _0x4b9b86[_0x635f('0xb0')][_0x416373];}}else{return _0x4b9b86[_0x635f('0x162')](_0x3c735a,_0x4e9796);}}else{if(getDiff(_0x4e9796[_0x635f('0x1eb')])<_0x3c735a['dialRecallMeTimeout']*0x3c){if(_0x4e9796['Agent']&&!_0x4e9796[_0x635f('0x1ec')][_0x635f('0x1ed')]){_0x4b9b86[_0x635f('0x20')][_0x635f('0x12a')](_0x4e9796['id'])['finally'](function(){_0x4b9b86[_0x635f('0xb6')](_0x3c735a);});}else{_0x4b9b86[_0x635f('0xc4')]({'active':![]},_0x4e9796['id'],0x1)['finally'](function(){console[_0x635f('0x1ee')](_0x635f('0x1ef'));_0x4b9b86[_0x635f('0xb6')](_0x3c735a);});}}else{_0x3c735a[_0x635f('0x6b')]+=0x1;_0x4b9b86[_0x635f('0xb6')](_0x3c735a);if(_0x3c735a['dialRecallInQueue']){_0x4b9b86[_0x635f('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e9796['ContactId'],'ListId':_0x4e9796['ListId'],'VoiceQueueId':_0x4e9796['VoiceQueueId']||undefined,'CampaignId':_0x4e9796[_0x635f('0xd4')]||undefined})[_0x635f('0xbd')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x4b9b86[_0x635f('0xcc')](createObjHistory(_0x3c735a,_0x4e9796,_0x635f('0x1f0'),0x17,_0x635f('0x1f1')))[_0x635f('0xbd')](loggerCatch(_0x635f('0x1f2')));}else{_0x4b9b86[_0x635f('0xcf')](createObjHistory(_0x3c735a,_0x4e9796,_0x635f('0x1f3'),0x16,_0x635f('0x1f4')),'[Originate][HistoryRecallClose][historyCatch]',_0x635f('0x1f5'));}}}}else{_0x3c735a['outboundBlacklistCallsDay']+=0x1;_0x4b9b86[_0x635f('0xcf')](createObjHistory(_0x3c735a,_0x4e9796,_0x635f('0x1f6'),0xd,_0x635f('0x1f7')),_0x635f('0x1f8'),_0x635f('0x1f9'));throw _0x635f('0x1fa');}};};Dialer[_0x635f('0xad')][_0x635f('0x159')]=function(_0x1fa77d){var _0x55eb0a=this;var _0x59811f=[];var _0x51dcc8=_0x1fa77d[_0x635f('0x1fb')]-_0x1fa77d[_0x635f('0xa1')]-_0x1fa77d[_0x635f('0x1fc')];emitCampaignSummary(_0x1fa77d);if(_0x51dcc8>0x0){if(_0x51dcc8>this[_0x635f('0x25')]){_0x51dcc8=this[_0x635f('0x25')];}_0x1fa77d[_0x635f('0x1fc')]+=_0x51dcc8;this[_0x635f('0xc7')](_0x1fa77d['id'],_0x51dcc8,_0x1fa77d[_0x635f('0x1fd')])['then'](function(_0x347f79){_0x1fa77d[_0x635f('0x1fc')]-=_0x51dcc8;_0x1fa77d[_0x635f('0x1fc')]=_0x1fa77d[_0x635f('0x1fc')]>0x0?_0x1fa77d['temp']:0x0;if(!checkContactEmpty(_0x347f79)){_0x1fa77d['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x635f('0x86')]('[getContactCampaign2][Empty]'+_0x1fa77d[_0x635f('0x43')]);}else{_0x1fa77d[_0x635f('0xa1')]+=_0x347f79[_0x635f('0x9f')];_0x1fa77d[_0x635f('0x42')]='RUNNING';for(var _0x1e8019=0x0;_0x1e8019<_0x347f79['length'];_0x1e8019+=0x1){_0x1fa77d[_0x635f('0x1fe')]+=0x1;if(_['isNil'](_0x347f79[_0x1e8019])||_[_0x635f('0xda')](_0x347f79[_0x1e8019][_0x635f('0x164')])||_[_0x635f('0xda')](_0x347f79[_0x1e8019]['Contact']['phone'])){_0x55eb0a[_0x635f('0x1ff')](_0x635f('0x200'),_0x1fa77d,_0x347f79[_0x1e8019]);}else{_0x55eb0a['checkIsBlackListIvr'](_[_0x635f('0x125')](_0x347f79[_0x1e8019],['CampaignId',_0x635f('0x201')]))[_0x635f('0xbc')](_0x55eb0a[_0x635f('0x1e4')](_0x1fa77d,_0x347f79[_0x1e8019]))['catch'](_0x55eb0a[_0x635f('0x202')]('[actionOriginateIvr]\x20',_0x1fa77d));}}}})[_0x635f('0xbd')](loggerGetContactDialer(_0x635f('0x203'),_0x1fa77d,_0x51dcc8));}};Dialer[_0x635f('0xad')]['handlePower']=function(_0x21b494,_0x53e463){var _0x47b049=this;var _0x15aecf=[];var _0xb95dbc=_0x53e463>=0x1?_0x53e463:0x1;var _0x534855=[];if(_0x21b494['dialMethod']===_0x635f('0x9')){_0xb95dbc=0x1;}var _0x12c0b=Math['floor'](_0x21b494['available']*_0xb95dbc)-_0x21b494['originated']-_0x21b494[_0x635f('0x1fc')];emitVoiceQueueSummary(_0x21b494);if(_0x21b494['dialLimitQueue']>0x0){var _0x4117d0=_0x21b494[_0x635f('0x204')]-_0x21b494[_0x635f('0xa1')]-_0x21b494[_0x635f('0x58')]-_0x21b494['temp']-_0x21b494['pTalking'];if(_0x12c0b>_0x4117d0){_0x12c0b=_0x4117d0;}}if(_0x12c0b>0x0){if(_0x21b494['dialMethod']===_0x635f('0x9')){_0x12c0b=0x1;}if(_0x12c0b>this['maxNumberOriginate']){_0x12c0b=this[_0x635f('0x25')];}_0x21b494[_0x635f('0x1fc')]+=_0x12c0b;for(var _0x5a4234 in this[_0x635f('0x23')]){if(this[_0x635f('0x23')][_0x635f('0xa0')](_0x5a4234)){if(this[_0x635f('0x23')][_0x5a4234][_0x635f('0xab')]==='not_inuse'&&this[_0x635f('0x23')][_0x5a4234][_0x635f('0xb3')]===_0x635f('0xd6')){_0x15aecf['push'](this[_0x635f('0x23')][_0x5a4234]['id']);}}}this[_0x635f('0xc5')](_0x21b494['id'],_0x15aecf,_0x12c0b,_0x21b494[_0x635f('0x1fd')])[_0x635f('0xbc')](function(_0x2e4d87){_0x21b494[_0x635f('0x1fc')]-=_0x12c0b;_0x21b494[_0x635f('0x1fc')]=_0x21b494[_0x635f('0x1fc')]>0x0?_0x21b494[_0x635f('0x1fc')]:0x0;if(!checkContactEmpty(_0x2e4d87)){_0x47b049[_0x635f('0xba')](_0x21b494)[_0x635f('0xbc')](sendMessageReschedule(_0x21b494))[_0x635f('0xbd')](loggerCatch('[countReScheduled]\x20'));}else{_0x21b494[_0x635f('0xa1')]+=_0x2e4d87[_0x635f('0x9f')];_0x21b494[_0x635f('0x42')]=_0x21b494[_0x635f('0x5f')]===_0x635f('0x9')?'ACTIVE':_0x635f('0x205');for(var _0x38c2cb=0x0;_0x38c2cb<_0x2e4d87['length'];_0x38c2cb+=0x1){if(_[_0x635f('0xda')](_0x2e4d87[_0x38c2cb])||_[_0x635f('0xda')](_0x2e4d87[_0x38c2cb][_0x635f('0x164')])||_['isNil'](_0x2e4d87[_0x38c2cb][_0x635f('0x164')][_0x635f('0x18c')])){_0x47b049[_0x635f('0x1ff')]('[actionOriginate]\x20',_0x21b494,_0x2e4d87[_0x38c2cb]);}else{_0x47b049[_0x635f('0xbe')](_[_0x635f('0x125')](_0x2e4d87[_0x38c2cb],[_0x635f('0xd3'),_0x635f('0x201')]))[_0x635f('0xbc')](_0x47b049[_0x635f('0x1e4')](_0x21b494,_0x2e4d87[_0x38c2cb]))[_0x635f('0xbd')](_0x47b049[_0x635f('0x202')](_0x635f('0x200'),_0x21b494));}}}})[_0x635f('0xbd')](loggerGetContactDialer(_0x635f('0x206'),_0x21b494,_0x12c0b));}};Dialer[_0x635f('0xad')][_0x635f('0x96')]=function(_0x5c7499){var _0x4d66ea=this;if(_0x5c7499[_0x635f('0x204')]>0x0){var _0x20fda6=_0x5c7499[_0x635f('0x204')]-_0x5c7499[_0x635f('0xa1')]-_0x5c7499[_0x635f('0x58')];if(_0x20fda6>0x0){this[_0x635f('0x207')](_0x5c7499);}else{loggerPredictiveCalls['info'](_0x635f('0x208'));}}else{this[_0x635f('0x207')](_0x5c7499);}};Dialer[_0x635f('0xad')][_0x635f('0x207')]=function(_0x5b3b4c){var _0x443c42=this;var _0x4fa8aa=[];_0x5b3b4c['originated']+=0x1;for(var _0x407f02 in this[_0x635f('0x23')]){if(this[_0x635f('0x23')][_0x635f('0xa0')](_0x407f02)){if(this[_0x635f('0x23')][_0x407f02][_0x635f('0xab')]==='not_inuse'&&this[_0x635f('0x23')][_0x407f02][_0x635f('0xb3')]===_0x635f('0xd6')){_0x4fa8aa[_0x635f('0x147')](this[_0x635f('0x23')][_0x407f02]['id']);}}}this[_0x635f('0xc5')](_0x5b3b4c['id'],_0x4fa8aa,0x1,_0x5b3b4c[_0x635f('0x1fd')])[_0x635f('0xbc')](function(_0x532f6c){if(!checkContactEmpty(_0x532f6c)){checkContactLowerLimitOriginate(_0x5b3b4c,0x1,0x0);_0x443c42['countReScheduled'](_0x5b3b4c)[_0x635f('0xbc')](sendMessageReschedule(_0x5b3b4c))[_0x635f('0xbd')](loggerCatch(_0x635f('0x209')));}else{_0x5b3b4c[_0x635f('0x42')]=_0x635f('0x205');if(_[_0x635f('0xda')](_0x532f6c[0x0])||_['isNil'](_0x532f6c[0x0][_0x635f('0x164')])||_[_0x635f('0xda')](_0x532f6c[0x0]['Contact']['phone'])){_0x443c42[_0x635f('0x1ff')](_0x635f('0x200'),_0x5b3b4c,_0x532f6c[0x0]);}else{_0x443c42[_0x635f('0xbe')](_['pick'](_0x532f6c[0x0],[_0x635f('0xd3'),'Contact.phone']))[_0x635f('0xbc')](_0x443c42[_0x635f('0x1e4')](_0x5b3b4c,_0x532f6c[0x0]))[_0x635f('0xbd')](_0x443c42[_0x635f('0x202')](_0x635f('0x20a'),_0x5b3b4c));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x5b3b4c,0x1));emitVoiceQueueSummary(_0x5b3b4c);};Dialer[_0x635f('0xad')][_0x635f('0x1da')]=function(_0x28e7c8,_0x8db9e5,_0x4066aa,_0x13cb68,_0x4516e7,_0x4c3ab8){loggerPredictive[_0x635f('0x86')](_0x635f('0x20b'));loggerPredictive[_0x635f('0x86')]('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',_0x28e7c8);loggerPredictive[_0x635f('0x86')](_0x635f('0x20c'),_0x8db9e5);loggerPredictive['info'](_0x635f('0x20d'),_0x4066aa);loggerPredictive[_0x635f('0x86')](_0x635f('0x20e'),_0x13cb68);loggerPredictive[_0x635f('0x86')](_0x635f('0x20f'),_0x4516e7);loggerPredictive[_0x635f('0x86')](_0x635f('0x8d'));return new BPromise(function(_0xdbc29d,_0x4499e9){if(_0x28e7c8<=0x0||isNaN(_0x28e7c8)){return _0x4499e9(msgResponse(_0x635f('0x210'),_0x635f('0x4b'),_0x635f('0x211')+_0x28e7c8));}if(_0x4066aa<=0x0||isNaN(_0x4066aa)){return _0x4499e9(msgResponse(_0x635f('0x210'),_0x635f('0x4b'),_0x635f('0x212')+_0x4066aa));}if(_0x13cb68<=0x0||isNaN(_0x13cb68)){return _0x4499e9(msgResponse(_0x635f('0x210'),_0x635f('0x4b'),_0x635f('0x213')+_0x13cb68));}if(_0x8db9e5<=0x0||isNaN(_0x8db9e5)){return _0x4499e9(msgResponse('[abandonmentRate]','Error',_0x635f('0x214')+_0x8db9e5));}if(_0x4516e7<=0x0||isNaN(_0x4516e7)){return _0x4499e9(msgResponse(_0x635f('0x210'),_0x635f('0x4b'),_0x635f('0x215')+_0x4516e7));}_0x4c3ab8=_0x4c3ab8||0x0;var _0x19fbeb=0x1/_0x4066aa;var _0x216fdf=0x0;var _0x3e30d6=0x0;var _0x51504e=0x0;var _0x47b202=0x0;for(var _0x2a4008=0x0;_0x51504e<_0x4516e7;_0x2a4008+=0x1){_0x3e30d6=_0x2a4008/_0x8db9e5;_0x216fdf=(_0x13cb68*_0x3e30d6+_0x4c3ab8)/_0x19fbeb;_0x51504e=erlangb(_0x216fdf,_0x28e7c8);_0x47b202=_0x216fdf/_0x28e7c8*(0x1-erlangb(_0x216fdf,_0x28e7c8));}return _0xdbc29d({'erlangCalls':_0x2a4008,'erlangCallToSecond':_0x8db9e5/_0x2a4008,'erlangAbandonmentRate':_0x51504e,'erlangBusyFactor':_0x47b202});});};Dialer[_0x635f('0xad')][_0x635f('0x1db')]=function(_0x15bf51,_0x5c17ee,_0x2e102f,_0x509514,_0x4bda6f,_0xacc688){loggerPredictive[_0x635f('0x86')](_0x635f('0x216'));loggerPredictive[_0x635f('0x86')](_0x635f('0x217'),_0x15bf51);loggerPredictive[_0x635f('0x86')](_0x635f('0x20c'),_0x5c17ee);loggerPredictive['info'](_0x635f('0x20d'),_0x2e102f);loggerPredictive['info'](_0x635f('0x20e'),_0x509514);loggerPredictive[_0x635f('0x86')](_0x635f('0x218'),_0x4bda6f);loggerPredictive[_0x635f('0x86')](_0x635f('0x8d'));return new BPromise(function(_0x27dcb2,_0x2037f1){if(_0x15bf51<=0x0||isNaN(_0x15bf51)){return _0x2037f1(msgResponse(_0x635f('0x219'),_0x635f('0x4b'),_0x635f('0x211')+_0x15bf51));}if(_0x2e102f<=0x0||isNaN(_0x2e102f)){return _0x2037f1(msgResponse(_0x635f('0x219'),'Error',_0x635f('0x212')+_0x2e102f));}if(_0x509514<=0x0||isNaN(_0x509514)){return _0x2037f1(msgResponse('[busyFactor]',_0x635f('0x4b'),_0x635f('0x213')+_0x509514));}if(_0x5c17ee<=0x0||isNaN(_0x5c17ee)){return _0x2037f1(msgResponse('[busyFactor]',_0x635f('0x4b'),_0x635f('0x214')+_0x5c17ee));}if(_0x4bda6f<=0x0||isNaN(_0x4bda6f)){return _0x2037f1(msgResponse('[busyFactor]',_0x635f('0x4b'),_0x635f('0x21a')+_0x4bda6f));}_0xacc688=_0xacc688||0x0;var _0x14b65c=0x1/_0x2e102f;var _0x1d02c8=0x0;var _0x5b8915=0x0;var _0x35dc89=0x0;var _0x19d44b=0x0;for(var _0x32e068=0x0;_0x19d44b<_0x4bda6f;_0x32e068+=0x1){_0x5b8915=_0x32e068/_0x5c17ee;_0x1d02c8=(_0x509514*_0x5b8915+_0xacc688)/_0x14b65c;_0x35dc89=erlangb(_0x1d02c8,_0x15bf51);_0x19d44b=_0x1d02c8/_0x15bf51*(0x1-erlangb(_0x1d02c8,_0x15bf51));}return _0x27dcb2({'erlangCalls':_0x32e068,'erlangCallToSecond':_0x5c17ee/_0x32e068,'erlangAbandonmentRate':_0x35dc89,'erlangBusyFactor':_0x19d44b});});};module[_0x635f('0x21b')]=Dialer; \ No newline at end of file +var _0xfd23=['outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','agents','stateinterface','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','paused','unlockRR','[booked][RR]','Agent:\x20','finally','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdNumber','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','startMethodPredictive','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','RUNNING','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./agentComplete','./hangup','env','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','stringify','milliseconds','diff','seconds','type','outbound','available','sumBillable','talking','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x4cdf87,_0x200caf){var _0x14d49d=function(_0xf7eced){while(--_0xf7eced){_0x4cdf87['push'](_0x4cdf87['shift']());}};_0x14d49d(++_0x200caf);}(_0xfd23,0x1cf));var _0x3fd2=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xfd23[_0x209ec9];return _0x129b1b;};'use strict';var util=require(_0x3fd2('0x0'));var _=require(_0x3fd2('0x1'));var BPromise=require(_0x3fd2('0x2'));var uuid=require('uuid');var moment=require(_0x3fd2('0x3'));var rr=require('rr');var md5=require(_0x3fd2('0x4'));var Redis=require(_0x3fd2('0x5'));var ut=require(_0x3fd2('0x6'));var config=require(_0x3fd2('0x7'));var logger=require(_0x3fd2('0x8'))(_0x3fd2('0x9'));var loggerBooked=require(_0x3fd2('0x8'))(_0x3fd2('0xa'));var loggerPredictive=require(_0x3fd2('0x8'))(_0x3fd2('0xb'));var loggerPredictiveCalls=require(_0x3fd2('0x8'))(_0x3fd2('0xc'));var loggerSyncQueueSummary=require(_0x3fd2('0x8'))('syncQueueSummary');var ami=require(_0x3fd2('0xd'));config[_0x3fd2('0xe')]=_[_0x3fd2('0xf')](config['redis'],{'host':_0x3fd2('0x10'),'port':0x18eb});var io=require(_0x3fd2('0x11'))(new Redis(config[_0x3fd2('0xe')]));var cmHopper=require(_0x3fd2('0x12'));var cmHopperFinal=require(_0x3fd2('0x13'));var cmHopperHistory=require(_0x3fd2('0x14'));var cmHopperBlack=require(_0x3fd2('0x15'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x3fd2('0x16'));var Final=require('./final');var AgentComplete=require(_0x3fd2('0x17'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x3fd2('0x18'));var ipAgi=process[_0x3fd2('0x19')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x3fd2('0x1a'),'roundrobin':_0x3fd2('0x1b')};var Sequence=function(){};Sequence[_0x3fd2('0x1c')][_0x3fd2('0x1d')]=function(_0x5b9fac){this[_0x3fd2('0x1e')]=this[_0x3fd2('0x1e')]?this['tail']['finally'](_0x5b9fac):_0x5b9fac();};function Dialer(_0x3068f3,_0x1a5fcf){this[_0x3fd2('0x1f')]=new Sequence();this[_0x3fd2('0x20')]=_0x1a5fcf;this[_0x3fd2('0x21')]=_0x3068f3[_0x3fd2('0x21')];this[_0x3fd2('0x22')]=_0x3068f3[_0x3fd2('0x22')];this['agents']=_0x3068f3['agents'];this[_0x3fd2('0x23')]=_0x3068f3[_0x3fd2('0x23')];this['maxNumberOriginate']=config[_0x3fd2('0x24')]||0x2;this[_0x3fd2('0x25')]={};this[_0x3fd2('0x26')]={};this[_0x3fd2('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x3fd2('0x28')]={};this['startProgressive']={};this[_0x3fd2('0x29')]={};this['queueBooked']={};this[_0x3fd2('0x2a')]={};ami['on']('agentconnect',this[_0x3fd2('0x2b')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x2d'),this[_0x3fd2('0x2e')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x2f'),this['syncOriginateResponse'][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x30'),this[_0x3fd2('0x31')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x32'),this[_0x3fd2('0x33')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x34'),this[_0x3fd2('0x35')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x36'),this[_0x3fd2('0x37')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x38'),this[_0x3fd2('0x39')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x3a'),this[_0x3fd2('0x3b')][_0x3fd2('0x2c')](this));ami['on'](_0x3fd2('0x3c'),this[_0x3fd2('0x3d')][_0x3fd2('0x2c')](this));this[_0x3fd2('0x3e')]();this['loopClearZombieChannels']();}function isNotNull(_0x491768){return _0x491768!==null&&!_[_0x3fd2('0x3f')](_0x491768);}function checkIsLoggedIn(_0x35c4c2,_0x479dc5){return function(){if(_0x479dc5<=0x0){_0x35c4c2[_0x3fd2('0x40')]=_0x3fd2('0x41');throw _0x35c4c2[_0x3fd2('0x42')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x254f75){return _0x254f75;}function checkIsActive(_0x3cb7a4,_0x38046f){return function(){if(!isActive(_0x38046f)){_0x3cb7a4[_0x3fd2('0x40')]=_0x3fd2('0x43');throw _0x3cb7a4['name']+_0x3fd2('0x44');}};}function checkInterval(_0x3fb18e){return function(){if(!isNotNull(_0x3fb18e[_0x3fd2('0x45')])){_0x3fb18e[_0x3fd2('0x40')]='INTERVAL_IS_NULL';throw _0x3fb18e['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3fb18e[_0x3fd2('0x45')]['Intervals'])){_0x3fb18e['message']='INTERVAL_IS_NULL';throw _0x3fb18e['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x3fb18e[_0x3fd2('0x45')][_0x3fd2('0x46')]))){_0x3fb18e[_0x3fd2('0x40')]=_0x3fd2('0x47');throw _0x3fb18e['name']+_0x3fd2('0x48');}};}function msgResponse(_0x2d2432,_0x49485c,_0xace515){return{'action':_0x2d2432,'response':_0x49485c,'message':_0xace515,'stack':_0xace515};}function myreject(_0x2bc3e6){return function(_0x2240e0){return _0x2bc3e6(msgResponse('[ifTime][Action]','Error',JSON[_0x3fd2('0x49')](_0x2240e0)));};}function getSeconds(_0x33ab48,_0x31bedd){var _0x3b7e55=moment(_0x33ab48)[_0x3fd2('0x4a')](0x0);var _0x2d7fa4=moment(_0x31bedd)['milliseconds'](0x0);return _0x3b7e55[_0x3fd2('0x4b')](_0x2d7fa4,_0x3fd2('0x4c'));}function emit(_0x1beba8,_0xb7dc6e,_0x30f920){io['to'](_0x1beba8)['emit'](_0xb7dc6e,_0x30f920);}function emitVoiceQueueSummary(_0x311193){if(_0x311193[_0x3fd2('0x4d')]===_0x3fd2('0x4e')){var _0x2f83e1={'id':_0x311193['id'],'name':_0x311193[_0x3fd2('0x42')],'strategy':_0x311193['strategy'],'answered':_0x311193['answered'],'available':_0x311193[_0x3fd2('0x4f')],'loggedIn':_0x311193['loggedIn'],'pTalking':_0x311193['pTalking'],'sumBillable':_0x311193[_0x3fd2('0x50')],'sumDuration':_0x311193['sumDuration'],'sumHoldTime':_0x311193['sumHoldTime']||0x0,'talking':_0x311193[_0x3fd2('0x51')],'total':_0x311193['total'],'type':_0x311193['type'],'unmanaged':_0x311193['unmanaged'],'abandoned':_0x311193[_0x3fd2('0x52')],'waiting':_0x311193[_0x3fd2('0x53')],'loggedInDb':_0x311193[_0x3fd2('0x54')],'dialActive':_0x311193['dialActive'],'dialMethod':_0x311193[_0x3fd2('0x55')],'dialOriginateCallerIdName':_0x311193[_0x3fd2('0x56')],'dialOriginateCallerIdNumber':_0x311193['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x311193['dialOriginateTimeout'],'dialPrefix':_0x311193[_0x3fd2('0x57')],'outboundAnswerAgiCallsDay':_0x311193[_0x3fd2('0x58')],'outboundAnswerCallsDay':_0x311193[_0x3fd2('0x59')],'outboundBlacklistCallsDay':_0x311193[_0x3fd2('0x5a')],'outboundBusyCallsDay':_0x311193['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x311193[_0x3fd2('0x5b')],'outboundDropCallsDayACS':_0x311193[_0x3fd2('0x5c')],'outboundDropCallsDayCallersExit':_0x311193['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x311193[_0x3fd2('0x5d')],'outboundNoAnswerCallsDay':_0x311193[_0x3fd2('0x5e')],'outboundNoSuchCallsDay':_0x311193['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x311193['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x311193[_0x3fd2('0x5f')],'outboundRejectCallsDay':_0x311193[_0x3fd2('0x60')],'outboundUnknownCallsDay':_0x311193[_0x3fd2('0x61')],'predictiveIntervalAnsweredCalls':_0x311193[_0x3fd2('0x62')],'predictiveIntervalAvgHoldtime':_0x311193[_0x3fd2('0x63')],'predictiveIntervalAvgTalktime':_0x311193[_0x3fd2('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x311193['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x311193[_0x3fd2('0x65')],'predictiveIntervalErlangCalls':_0x311193[_0x3fd2('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x311193['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x311193[_0x3fd2('0x67')],'predictiveIntervalMultiplicativeFactor':_0x311193['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x311193[_0x3fd2('0x68')],'predictiveIntervalAvailable':_0x311193[_0x3fd2('0x69')],'predictiveIntervalTotalCalls':_0x311193[_0x3fd2('0x6a')],'message':_0x311193[_0x3fd2('0x40')],'originated':_0x311193[_0x3fd2('0x6b')],'erlangCalls':_0x311193[_0x3fd2('0x6c')],'erlangCallToSecond':_0x311193[_0x3fd2('0x6d')],'erlangAbandonmentRate':_0x311193[_0x3fd2('0x6e')],'erlangBusyFactor':_0x311193[_0x3fd2('0x6f')],'startPredictive':_0x311193['startPredictive'],'startProgressive':_0x311193[_0x3fd2('0x70')]};if(_0x311193[_0x3fd2('0x71')]){_0x2f83e1[_0x3fd2('0x71')]={'id':_0x311193[_0x3fd2('0x71')]['id'],'name':_0x311193[_0x3fd2('0x71')][_0x3fd2('0x42')],'active':_0x311193[_0x3fd2('0x71')][_0x3fd2('0x72')],'callerid':_0x311193[_0x3fd2('0x71')]['callerid']};}if(_0x311193['Interval']){_0x2f83e1[_0x3fd2('0x45')]={'id':_0x311193[_0x3fd2('0x45')]['id'],'name':_0x311193[_0x3fd2('0x45')][_0x3fd2('0x42')]};}var _0x4de29b=md5(JSON[_0x3fd2('0x49')](_0x2f83e1));if(_0x311193['md5']!==_0x4de29b){_0x311193[_0x3fd2('0x4')]=_0x4de29b;emit(util['format'](_0x3fd2('0x73'),_0x2f83e1[_0x3fd2('0x42')]),_0x3fd2('0x74'),_0x2f83e1);}}}function emitCampaignSummary(_0x256493){if(_0x256493[_0x3fd2('0x4d')]===_0x3fd2('0x75')){emit(util[_0x3fd2('0x76')](_0x3fd2('0x77'),_0x256493[_0x3fd2('0x42')]),_0x3fd2('0x78'),_0x256493);}}function checkGetDataPredictive(_0x45cbed){if(isNotNull(_0x45cbed)){if(!_[_0x3fd2('0x79')](_0x45cbed)){loggerPredictive['info'](_0x3fd2('0x7a'));loggerPredictive[_0x3fd2('0x7b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45cbed[_0x3fd2('0x6a')]);loggerPredictive[_0x3fd2('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45cbed[_0x3fd2('0x62')]);loggerPredictive[_0x3fd2('0x7b')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45cbed['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x7c'),_0x45cbed['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3fd2('0x7b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45cbed[_0x3fd2('0x63')]);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x7d'),_0x45cbed[_0x3fd2('0x64')]);loggerPredictive['info'](_0x3fd2('0x7e'));if(_0x45cbed[_0x3fd2('0x6a')]>0x0){if(!_[_0x3fd2('0x3f')](_0x45cbed['predictiveIntervalAvgTalktime'])&&_0x45cbed[_0x3fd2('0x64')]>0x0){return!![];}else{loggerPredictive[_0x3fd2('0x7b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x3fd2('0x3f')](_0x45cbed[_0x3fd2('0x63')])&&_0x45cbed['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x3fd2('0x7b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x7f'));}}else{loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x80'));}}else{loggerPredictive[_0x3fd2('0x7b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x324e4e){return function(_0x18ca0b){loggerPredictive[_0x3fd2('0x7b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x81'),_0x18ca0b['erlangCalls']);loggerPredictive[_0x3fd2('0x7b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ca0b[_0x3fd2('0x6d')]);loggerPredictive['info'](_0x3fd2('0x82'),_0x18ca0b['erlangAbandonmentRate']);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x83'),_0x18ca0b[_0x3fd2('0x6f')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ca0b['erlangAbandonmentRate']);loggerPredictive['info'](_0x3fd2('0x7e'));_[_0x3fd2('0x84')](_0x324e4e,_0x18ca0b);};}function getDiff(_0x56d04a){var _0x1188b6=moment()[_0x3fd2('0x4a')](0x0);var _0x48b227=moment(_0x56d04a)[_0x3fd2('0x4a')](0x0);return _0x1188b6['diff'](_0x48b227,_0x3fd2('0x4c'));}function ifInterval(_0x26c404,_0x5d5482){if(_['isUndefined'](_0x5d5482)){return![];}if(getDiff(_0x5d5482)<_0x26c404*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1093bc){if(isNotNull(_0x1093bc)){if(!_['isUndefined'](_0x1093bc[_0x3fd2('0x70')])){_0x1093bc[_0x3fd2('0x70')]=undefined;loggerPredictive[_0x3fd2('0x7b')](_0x1093bc[_0x3fd2('0x42')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x3fd2('0x3f')](_0x1093bc[_0x3fd2('0x28')])){_0x1093bc[_0x3fd2('0x28')]=undefined;loggerPredictive[_0x3fd2('0x7b')](_0x1093bc[_0x3fd2('0x42')],_0x3fd2('0x85'));}if(!_[_0x3fd2('0x3f')](_0x1093bc[_0x3fd2('0x86')])){clearInterval(_0x1093bc[_0x3fd2('0x86')]);_0x1093bc[_0x3fd2('0x86')]=undefined;loggerPredictive[_0x3fd2('0x7b')](_0x1093bc[_0x3fd2('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x15a31f,_0x4a03ab){if(_0x4a03ab===0x0){return 0x0;}var _0x3f0107=0x1;for(var _0x49aea5=0x1;_0x49aea5<=_0x4a03ab;_0x49aea5+=0x1){_0x3f0107=0x1+_0x3f0107*_0x49aea5/_0x15a31f;}return 0x1/_0x3f0107;}function isVoiceQueueOutbound(_0x3c0eda){return _0x3c0eda===_0x3fd2('0x4e');}function isNotPreview(_0x536187){return _0x536187!=='preview';}function isCampaignIvr(_0x3783f9){return _0x3783f9===_0x3fd2('0x75');}function getCallerId(_0xa3b234,_0x403089,_0x1057e3){if(!_[_0x3fd2('0x3f')](_0x1057e3)&&_0x3fd2('0x87')===typeof _0x1057e3&&!_[_0x3fd2('0x79')](_0x1057e3)){if(!_['isUndefined'](_0x403089)&&'string'===typeof _0x403089&&!_['isEmpty'](_0x403089)){return util[_0x3fd2('0x76')](_0x3fd2('0x88'),_0x403089,_0x1057e3);}return util[_0x3fd2('0x76')]('\x22%s\x22\x20<%s>',_0x1057e3,_0x1057e3);}if(!_['isUndefined'](_0xa3b234)&&_0x3fd2('0x87')===typeof _0xa3b234&&!_[_0x3fd2('0x79')](_0xa3b234)){return _0xa3b234;}return _0x3fd2('0x89');}function loggerCatchQueueSummary(_0x35c332,_0x2d6631){return function(_0x50c365){freeVariablesPredictive(_0x2d6631);emitVoiceQueueSummary(_0x2d6631);emitCampaignSummary(_0x2d6631);loggerSyncQueueSummary[_0x3fd2('0x8a')](_0x35c332,util[_0x3fd2('0x8b')](_0x50c365,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1954f3,_0x23c768){return function(_0x1a7cac){loggerPredictive[_0x3fd2('0x8a')](_0x23c768[_0x3fd2('0x42')],_0x1954f3);loggerPredictive[_0x3fd2('0x8a')](_0x1a7cac[_0x3fd2('0x8c')]);freeVariablesPredictive(_0x23c768);};}function loggerCatch(_0x44066a){return function(_0x5a3fef){logger[_0x3fd2('0x8a')](_0x44066a,util['inspect'](_0x5a3fef,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5d6a2e){return _0x5d6a2e&&!_[_0x3fd2('0x3f')](_0x5d6a2e)&&_0x5d6a2e['length']>0x0;}function decremetOriginate(_0x8bc04a){if(!_[_0x3fd2('0x3f')](_0x8bc04a)&&_0x8bc04a!==null){if(_0x8bc04a[_0x3fd2('0x8d')](_0x3fd2('0x6b'))){if(_0x8bc04a[_0x3fd2('0x6b')]>0x0){_0x8bc04a['originated']-=0x1;}else{logger[_0x3fd2('0x8a')](_0x3fd2('0x8e'));}}}else{logger[_0x3fd2('0x8a')](_0x3fd2('0x8f'));}}function checkContactLowerLimitOriginate(_0x2813fb,_0x731e9c,_0x566048){if(_0x731e9c>_0x566048){for(var _0xc39ce9=0x0;_0xc39ce9<_0x731e9c-_0x566048;_0xc39ce9+=0x1){decremetOriginate(_0x2813fb);}}}function loggerGetContactDialer(_0x5c3f88,_0x1405a3,_0x1e7c74){return function(_0x3e35fe){checkContactLowerLimitOriginate(_0x1405a3,_0x1e7c74,0x0);logger[_0x3fd2('0x8a')](_0x5c3f88,util[_0x3fd2('0x8b')](_0x3e35fe,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x12a219){return function(_0x2d62f8){if(isNotNull(_0x2d62f8)&&isNotNull(_0x2d62f8[0x0])){if(_0x2d62f8[0x0]['contactsRescheduled']>0x0){_0x12a219['message']=_0x3fd2('0x90');logger[_0x3fd2('0x7b')](_0x3fd2('0x91')+_0x12a219[_0x3fd2('0x42')],_0x2d62f8[0x0][_0x3fd2('0x92')],_0x3fd2('0x93'));}else{_0x12a219['message']=_0x3fd2('0x94');logger[_0x3fd2('0x7b')](_0x3fd2('0x95')+_0x12a219[_0x3fd2('0x42')]);}}};}function notSendMessagesQueue(_0x6d9044){if(_0x6d9044[_0x3fd2('0x96')]){freeVariablesPredictive(_0x6d9044);if(_0x6d9044[_0x3fd2('0x6b')]===0x0&&_0x6d9044['talking']===0x0&&_0x6d9044['waiting']===0x0&&(_0x6d9044[_0x3fd2('0x97')]||0x0)===0x0){_0x6d9044['sendMessageOneNotActive']=![];_0x6d9044[_0x3fd2('0x4f')]=0x0;_0x6d9044[_0x3fd2('0x40')]=_0x3fd2('0x43');loggerSyncQueueSummary['error'](_0x3fd2('0x98'),_0x6d9044[_0x3fd2('0x42')],_0x3fd2('0x99'));}else{_0x6d9044['message']=_0x3fd2('0x9a');loggerSyncQueueSummary[_0x3fd2('0x8a')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x6d9044['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x6d9044);}}function notSendMessagesCampaign(_0x4c9874){if(_0x4c9874['sendMessageOneNotActive']){if(_0x4c9874['originated']===0x0){_0x4c9874[_0x3fd2('0x96')]=![];_0x4c9874[_0x3fd2('0x40')]=_0x3fd2('0x43');loggerSyncQueueSummary[_0x3fd2('0x8a')](_0x3fd2('0x9b'),_0x4c9874[_0x3fd2('0x42')],_0x3fd2('0x99'));}else{_0x4c9874[_0x3fd2('0x40')]=_0x3fd2('0x9a');loggerSyncQueueSummary[_0x3fd2('0x8a')](_0x3fd2('0x9b'),_0x4c9874[_0x3fd2('0x42')],'is\x20disactive');}emitCampaignSummary(_0x4c9874);}}function createObjHistory(_0x4c6648,_0xc571d8,_0x57a46b,_0x2738f6,_0x3c6b05){_0x4c6648[_0x3fd2('0x40')]=_0x57a46b;var _0x3a9680=new Action(_0x4c6648,_0xc571d8);var _0x41abbc=new History(_0x3a9680);_0x41abbc[_0x3fd2('0x9c')]=_0x2738f6;_0x41abbc[_0x3fd2('0x9d')]=_0x3c6b05;_0x41abbc[_0x3fd2('0x9e')]=_0x3a9680[_0x3fd2('0x9f')];return _0x41abbc;}Dialer['prototype'][_0x3fd2('0xa0')]=function(){var _0x231194=this;setInterval(function(){_0x231194[_0x3fd2('0xa1')](_0x231194[_0x3fd2('0xa2')],_0x3fd2('0xa3'));_0x231194[_0x3fd2('0xa1')](_0x231194[_0x3fd2('0x26')],_0x3fd2('0xa4'));},0x32c8);};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xa1')]=function(_0x5d171c,_0x132d69){var _0x290dae=this;for(var _0x3752ea in _0x5d171c){if(_0x5d171c[_0x3fd2('0x8d')](_0x3752ea)){this[_0x3fd2('0x1f')]['enqueue'](function(){if(!_['isNil'](_0x5d171c[_0x3752ea])){return ami[_0x3fd2('0xa5')]({'action':_0x3fd2('0xa6'),'channel':_0x5d171c[_0x3752ea][_0x3fd2('0xa7')]})['catch'](function(_0x2d419d){if(_0x2d419d[_0x3fd2('0x40')]===_0x3fd2('0xa8')){setTimeout(function(){if(_0x5d171c[_0x3752ea]&&_0x5d171c[_0x3752ea][_0x3fd2('0x4d')]!=='ivr'){_0x290dae[_0x3fd2('0xa9')](_0x290dae[_0x3fd2('0x21')][_0x5d171c[_0x3752ea][_0x3fd2('0xaa')]]);logger[_0x3fd2('0x8a')]('[Dialer][checkChannel]',_0x132d69,_0x3752ea,_0x5d171c[_0x3752ea][_0x3fd2('0xaa')]);delete _0x5d171c[_0x3752ea];}if(_0x5d171c[_0x3752ea]&&_0x5d171c[_0x3752ea][_0x3fd2('0x4d')]==='ivr'){_0x290dae[_0x3fd2('0xa9')](_0x290dae[_0x3fd2('0x22')][_0x5d171c[_0x3752ea][_0x3fd2('0xaa')]]);logger[_0x3fd2('0x8a')]('[Dialer][checkChannel][ivr]',_0x132d69,_0x3752ea,_0x5d171c[_0x3752ea][_0x3fd2('0xaa')]);delete _0x5d171c[_0x3752ea];}},0x2328);}});}});}}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xab')]=function(_0x57b0b5){return BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](cmHopper[_0x3fd2('0xab')](_0x57b0b5))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xaf')));};Dialer['prototype']['checkIsBlackList']=function(_0x480492){return BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](cmHopperBlack[_0x3fd2('0xb0')](_0x480492))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xb1')));};Dialer[_0x3fd2('0x1c')]['checkIsBlackListIvr']=function(_0x5601b4){return BPromise['resolve']()[_0x3fd2('0xad')](cmHopperBlack['checkIsBlackListIvr'](_0x5601b4))[_0x3fd2('0xae')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xb2')]=function(_0x22c7b2){return BPromise['resolve']()[_0x3fd2('0xad')](cmHopperHistory['avgHandleTime'](_0x22c7b2))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xb3')));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xb4')]=function(_0x5199f4){return BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](cmHopper['rescheduleContact'](_0x5199f4))[_0x3fd2('0xae')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3fd2('0x1c')]['unlockContact']=function(_0xf0421c,_0x1cc228,_0x553931){return BPromise['resolve']()['then'](cmHopper[_0x3fd2('0xb5')](_0xf0421c,_0x1cc228,_0x553931))['catch'](loggerCatch(_0x3fd2('0xb6')));};Dialer[_0x3fd2('0x1c')]['getContactDialer']=function(_0x23bb51,_0x5abdbf,_0x29bad1,_0x47bf7f){return BPromise['resolve']()[_0x3fd2('0xad')](cmHopper[_0x3fd2('0xb7')](_0x23bb51,_0x5abdbf,_0x29bad1,_0x47bf7f))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0x3fd2('0xb8')]=function(_0x274eb3,_0x200363,_0x25be81){return BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](cmHopper[_0x3fd2('0xb8')](_0x274eb3,_0x200363,_0x25be81))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xb9')));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xba')]=function(_0x2d9a9f){return BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](voiceQueueRt[_0x3fd2('0xba')](_0x2d9a9f))['catch'](loggerCatch(_0x3fd2('0xbb')));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xbc')]=function(_0x37cf46){return BPromise[_0x3fd2('0xac')]()['then'](cmHopper['moveContactManagedDialer'](_0x37cf46))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xbd')));};Dialer['prototype'][_0x3fd2('0xbe')]=function(_0x50507d){return BPromise['resolve']()[_0x3fd2('0xad')](cmHopperHistory['createHistory'](_0x50507d))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xbf')));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xa9')]=function(_0x3b1290){if(!_['isUndefined'](_0x3b1290)&&_0x3b1290!==null){if(_0x3b1290[_0x3fd2('0x8d')]('originated')){if(_0x3b1290[_0x3fd2('0x6b')]>0x0){_0x3b1290['originated']-=0x1;}else{logger[_0x3fd2('0x8a')](_0x3fd2('0xc0'));}}}else{logger['error'](_0x3fd2('0xc1'));}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xc2')]=function(_0x11069f,_0x22d213){var _0x40f6a6=this;return function(_0x4e98ef){_0x40f6a6['updateOriginated'](_0x22d213);logger[_0x3fd2('0x8a')](_0x11069f,util[_0x3fd2('0x8b')](_0x4e98ef,{'showHidden':![],'depth':null}));};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xc3')]=function(_0x45c100,_0x49e529,_0x40a711){var _0x2ccfa9={'state':0x19,'statedesc':_0x3fd2('0xc4')};this[_0x3fd2('0xa9')](_0x49e529);this[_0x3fd2('0xc5')](_[_0x3fd2('0x84')](_0x2ccfa9,_[_0x3fd2('0xc6')](_0x40a711,[_0x3fd2('0xc7'),_0x3fd2('0xc8'),_0x3fd2('0xc9'),'VoiceQueueId',_0x3fd2('0xca')])),_0x3fd2('0xcb'),_0x3fd2('0xcc'));logger[_0x3fd2('0x8a')](_0x45c100);};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xcd')]=function(_0x4256bb){return _0x4256bb===_0x3fd2('0xce');};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xcf')]=function(_0x28c7ee){return!_[_0x3fd2('0x3f')](_0x28c7ee)&&_0x28c7ee&&!_['isUndefined'](_0x28c7ee['name'])&&!_[_0x3fd2('0x3f')](_0x28c7ee[_0x3fd2('0x72')])&&_0x28c7ee[_0x3fd2('0x72')]&&(this[_0x3fd2('0x23')][util['format'](_0x3fd2('0xd0'),_0x28c7ee[_0x3fd2('0x42')])][_0x3fd2('0xa6')]===_0x3fd2('0xd1')||this[_0x3fd2('0x23')][util[_0x3fd2('0x76')](_0x3fd2('0xd0'),_0x28c7ee['name'])][_0x3fd2('0xa6')]===_0x3fd2('0xd2'));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xc5')]=function(_0x3b6dec,_0x38a318,_0x3286a1){this[_0x3fd2('0xbe')](_0x3b6dec)[_0x3fd2('0xae')](loggerCatch(_0x38a318));this[_0x3fd2('0xbc')](_0x3b6dec)[_0x3fd2('0xae')](loggerCatch(_0x3286a1));};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x39')]=function(_0x270297){var _0x2b25be=this['uniqueId'][_0x270297[_0x3fd2('0xd3')]];var _0x102c4b;if(!_[_0x3fd2('0xd4')](_0x270297)&&!_[_0x3fd2('0xd4')](_0x270297[_0x3fd2('0xd5')])&&!_[_0x3fd2('0xd4')](_0x270297[_0x3fd2('0xd5')][_0x3fd2('0xd6')])&&_0x270297[_0x3fd2('0xd7')]==='xcally-motion-dialer'&&_0x2b25be){if(_0x2b25be['type']!==_0x3fd2('0x75')&&this[_0x3fd2('0x21')][_0x2b25be[_0x3fd2('0xaa')]][_0x3fd2('0xd8')]&&_0x270297[_0x3fd2('0xd9')]===_0x3fd2('0xda')){delete this[_0x3fd2('0xa2')][_0x270297[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x21')][_0x2b25be[_0x3fd2('0xaa')]]);this[_0x3fd2('0x21')][_0x2b25be[_0x3fd2('0xaa')]][_0x3fd2('0x59')]+=0x1;this[_0x3fd2('0x21')][_0x2b25be['queue']][_0x3fd2('0x58')]+=0x1;_0x102c4b=new Hangup(_0x2b25be,_0x270297);_0x102c4b[_0x3fd2('0x9c')]=0x12;_0x102c4b[_0x3fd2('0x9d')]=_0x3fd2('0xdb');_0x102c4b[_0x3fd2('0xdc')]='AMD';this[_0x3fd2('0xc5')](_0x102c4b,_0x3fd2('0xdd'),_0x3fd2('0xde'));}if(_0x2b25be['type']!==_0x3fd2('0x75')&&this['voiceQueues'][_0x2b25be['queue']]['dialAMDActive']&&_0x270297[_0x3fd2('0xd9')]===_0x3fd2('0xdf')){var _0x2049d4=this;return new BPromise(function(_0x2a5e40,_0x2a33b0){delete _0x2049d4['uniqueId'][_0x270297['uniqueid']];_0x2049d4['updateOriginated'](_0x2049d4[_0x3fd2('0x21')][_0x2b25be[_0x3fd2('0xaa')]]);_0x2049d4['voiceQueues'][_0x2b25be['queue']]['outboundAnswerCallsDay']+=0x1;_0x2049d4[_0x3fd2('0x21')][_0x2b25be[_0x3fd2('0xaa')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3e1aa8=_0x2049d4['voiceQueues'][_0x2b25be[_0x3fd2('0xaa')]];var _0x4967b6=new Hangup(_0x2b25be,_0x270297);_0x4967b6[_0x3fd2('0x9c')]=0x13;_0x4967b6[_0x3fd2('0x9d')]='Machine';_0x4967b6[_0x3fd2('0xdc')]=_0x3fd2('0xe0');_0x4967b6['countmachineretry']+=0x1;_0x4967b6[_0x3fd2('0xe1')]+=0x1;_0x4967b6[_0x3fd2('0xe2')]=!![];_0x2049d4[_0x3fd2('0xbe')](_0x4967b6)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xe3')));if(_0x4967b6[_0x3fd2('0xe4')]+_0x4967b6[_0x3fd2('0xe5')]+_0x4967b6[_0x3fd2('0xe6')]+_0x4967b6[_0x3fd2('0xe7')]+_0x4967b6['countdropretry']+_0x4967b6['countabandonedretry']+_0x4967b6[_0x3fd2('0xe8')]+_0x4967b6['countagentrejectretry']>=_0x3e1aa8[_0x3fd2('0xe9')]){_0x2049d4[_0x3fd2('0xea')](_0x4967b6,_0x2a5e40,_0x2a33b0,_0x3fd2('0xeb'));}else{if(_0x4967b6['countmachineretry']>=_0x3e1aa8[_0x3fd2('0xec')]){_0x2049d4[_0x3fd2('0xed')](_0x4967b6,_0x2a5e40,_0x2a33b0,_0x3fd2('0xee'));}else{_0x2049d4[_0x3fd2('0xb4')]({'active':![],'countmachineretry':_0x4967b6[_0x3fd2('0xe8')],'scheduledat':moment()[_0x3fd2('0xef')](_0x3e1aa8['dialMachineRetryFrequency'],_0x3fd2('0xf0'))[_0x3fd2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4967b6[_0x3fd2('0xc7')],'ListId':_0x4967b6[_0x3fd2('0xc8')],'VoiceQueueId':_0x4967b6[_0x3fd2('0xf1')]||undefined,'CampaignId':_0x4967b6[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xf2')));_0x2a5e40({'reschedule':0x1});}}});}if(_0x2b25be[_0x3fd2('0x4d')]===_0x3fd2('0x75')&&this[_0x3fd2('0x22')][_0x2b25be[_0x3fd2('0xaa')]]['dialAMDActive']&&_0x270297[_0x3fd2('0xd9')]===_0x3fd2('0xda')){delete this[_0x3fd2('0xa2')][_0x270297[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x22')][_0x2b25be['queue']]);_0x102c4b=new Hangup(_0x2b25be,_0x270297);_0x102c4b[_0x3fd2('0x9c')]=0x12;_0x102c4b['statedesc']=_0x3fd2('0xdb');_0x102c4b[_0x3fd2('0xdc')]=_0x3fd2('0xe0');this[_0x3fd2('0xc5')](_0x102c4b,_0x3fd2('0xf3'),_0x3fd2('0xf4'));}if(_0x2b25be[_0x3fd2('0x4d')]===_0x3fd2('0x75')&&this['campaigns'][_0x2b25be[_0x3fd2('0xaa')]][_0x3fd2('0xd8')]&&_0x270297['value']===_0x3fd2('0xdf')){var _0x2049d4=this;return new BPromise(function(_0x10a1b2,_0x369074){delete _0x2049d4['uniqueId'][_0x270297[_0x3fd2('0xd3')]];_0x2049d4['updateOriginated'](_0x2049d4[_0x3fd2('0x22')][_0x2b25be[_0x3fd2('0xaa')]]);_0x2049d4[_0x3fd2('0x22')][_0x2b25be[_0x3fd2('0xaa')]]['outboundAnswerCallsDay']+=0x1;_0x2049d4[_0x3fd2('0x22')][_0x2b25be[_0x3fd2('0xaa')]][_0x3fd2('0x58')]+=0x1;var _0x199179=_0x2049d4[_0x3fd2('0x22')][_0x2b25be[_0x3fd2('0xaa')]];var _0x26395e=new Hangup(_0x2b25be,_0x270297);_0x26395e['state']=0x13;_0x26395e[_0x3fd2('0x9d')]='Machine';_0x26395e['membername']=_0x3fd2('0xe0');_0x26395e[_0x3fd2('0xe8')]+=0x1;_0x26395e[_0x3fd2('0xe1')]+=0x1;_0x26395e[_0x3fd2('0xe2')]=!![];_0x2049d4[_0x3fd2('0xbe')](_0x26395e)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xe3')));if(_0x26395e[_0x3fd2('0xe4')]+_0x26395e[_0x3fd2('0xe5')]+_0x26395e[_0x3fd2('0xe6')]+_0x26395e[_0x3fd2('0xe7')]+_0x26395e['countdropretry']+_0x26395e['countabandonedretry']+_0x26395e['countmachineretry']+_0x26395e[_0x3fd2('0xf5')]>=_0x199179[_0x3fd2('0xe9')]){_0x2049d4['stateGlobal'](_0x26395e,_0x10a1b2,_0x369074,_0x3fd2('0xeb'));}else{if(_0x26395e['countmachineretry']>=_0x199179[_0x3fd2('0xec')]){_0x2049d4[_0x3fd2('0xed')](_0x26395e,_0x10a1b2,_0x369074,_0x3fd2('0xee'));}else{_0x2049d4[_0x3fd2('0xb4')]({'active':![],'countmachineretry':_0x26395e[_0x3fd2('0xe8')],'scheduledat':moment()[_0x3fd2('0xef')](_0x199179[_0x3fd2('0xf6')],_0x3fd2('0xf0'))[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0x26395e[_0x3fd2('0xc7')],'ListId':_0x26395e[_0x3fd2('0xc8')],'VoiceQueueId':_0x26395e[_0x3fd2('0xf1')]||undefined,'CampaignId':_0x26395e[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x10a1b2({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x33f710){var _0x167413=this[_0x3fd2('0xa2')][_0x33f710[_0x3fd2('0xd3')]];var _0x257da6=this;var _0x40fc47;if(_0x167413&&_0x167413[_0x3fd2('0x4d')]===_0x3fd2('0x75')){delete this[_0x3fd2('0xa2')][_0x33f710[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x22')][_0x167413['queue']]);this['campaigns'][_0x167413[_0x3fd2('0xaa')]][_0x3fd2('0xf8')]+=0x1;_0x40fc47=new Hangup(_0x167413,_0x33f710);this['createHistory'](_0x40fc47)[_0x3fd2('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3fd2('0xbc')](_0x40fc47)['catch'](loggerCatch(_0x3fd2('0xf9')));}if(_0x167413&&_0x167413[_0x3fd2('0x4d')]!==_0x3fd2('0x75')&&isNotNull(this[_0x3fd2('0x21')][_0x167413[_0x3fd2('0xaa')]]['dialQueueProject'])){delete this['uniqueId'][_0x33f710[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x21')][_0x167413[_0x3fd2('0xaa')]]);this['voiceQueues'][_0x167413[_0x3fd2('0xaa')]][_0x3fd2('0x59')]+=0x1;this[_0x3fd2('0x21')][_0x167413[_0x3fd2('0xaa')]]['outboundAnswerAgiCallsDay']+=0x1;_0x40fc47=new Hangup(_0x167413,_0x33f710);_0x40fc47['state']=0x10;_0x40fc47['statedesc']=_0x3fd2('0xfa');_0x40fc47[_0x3fd2('0xdc')]=_0x3fd2('0xfb');this['createHistory'](_0x40fc47)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xfc')));this[_0x3fd2('0xbc')](_0x40fc47)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xf9')));}if(_0x167413&&_0x167413['type']!==_0x3fd2('0x75')&&!isNotNull(this[_0x3fd2('0x21')][_0x167413[_0x3fd2('0xaa')]][_0x3fd2('0xfd')])){delete this['uniqueId'][_0x33f710[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x21')][_0x167413[_0x3fd2('0xaa')]]);this['voiceQueues'][_0x167413['queue']][_0x3fd2('0x61')]+=0x1;_0x40fc47=new Hangup(_0x167413,_0x33f710);_0x40fc47[_0x3fd2('0x9c')]=0xc;_0x40fc47[_0x3fd2('0x9d')]=_0x33f710['cause-txt'];_0x40fc47[_0x3fd2('0xdc')]=_0x3fd2('0xfe');this[_0x3fd2('0xbe')](_0x40fc47)[_0x3fd2('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3fd2('0xbc')](_0x40fc47)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xf9')));}};Dialer[_0x3fd2('0x1c')]['syncAgentComplete']=function(_0x540e56){var _0xdbb0cb=this[_0x3fd2('0xa2')][_0x540e56['uniqueid']];var _0x1b2aeb=this;if(this['voiceQueues'][_0x540e56[_0x3fd2('0xaa')]]){if(_0xdbb0cb&&_0xdbb0cb[_0x3fd2('0x4d')]!=='ivr'){delete this[_0x3fd2('0xa2')][_0x540e56['uniqueid']];this['voiceQueues'][_0x540e56[_0x3fd2('0xaa')]]['outboundAnswerCallsDay']+=0x1;var _0x1d38aa=new AgentComplete(_0xdbb0cb,_0x540e56);if(_0x540e56['reason']===_0x3fd2('0xff')){_0x1d38aa[_0x3fd2('0x100')]=this[_0x3fd2('0x21')][_0x540e56[_0x3fd2('0xaa')]][_0x3fd2('0x101')]&&this['voiceQueues'][_0x540e56[_0x3fd2('0xaa')]][_0x3fd2('0x102')]?moment()['format'](_0x3fd2('0xf7')):undefined;}this[_0x3fd2('0xbe')](_0x1d38aa)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x103')));this[_0x3fd2('0xbc')](_0x1d38aa)[_0x3fd2('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype']['syncAgentConnect']=function(_0x94e70a){if(this[_0x3fd2('0x21')][_0x94e70a['queue']]){if(this['uniqueId'][_0x94e70a[_0x3fd2('0xd3')]]&&this['uniqueId'][_0x94e70a['uniqueid']][_0x3fd2('0x4d')]!==_0x3fd2('0x75')){this['updateOriginated'](this[_0x3fd2('0x21')][_0x94e70a[_0x3fd2('0xaa')]]);this[_0x3fd2('0xa2')][_0x94e70a['uniqueid']][_0x3fd2('0x104')]=moment()[_0x3fd2('0x76')](_0x3fd2('0xf7'));}}};Dialer[_0x3fd2('0x1c')]['queueCallerAbandonCreateState']=function(_0x3ec598){this['createHistory'](_0x3ec598)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x103')));this[_0x3fd2('0xbc')](_0x3ec598)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x105')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0xcfcbef){var _0x4f28a6=this[_0x3fd2('0xa2')][_0xcfcbef[_0x3fd2('0xd3')]];var _0x3b8445=this;if(this['voiceQueues'][_0xcfcbef[_0x3fd2('0xaa')]]){if(_0x4f28a6&&_0x4f28a6[_0x3fd2('0x4d')]!==_0x3fd2('0x75')){delete this[_0x3fd2('0xa2')][_0xcfcbef[_0x3fd2('0xd3')]];this[_0x3fd2('0xa9')](this[_0x3fd2('0x21')][_0xcfcbef['queue']]);_0x4f28a6[_0x3fd2('0x106')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x11c4ad=new QueueCallerAbandon(_0x4f28a6,_0xcfcbef);if(getSeconds(_0x4f28a6[_0x3fd2('0x106')],_0x4f28a6[_0x3fd2('0x107')])>=_0x4f28a6[_0x3fd2('0x108')]){this['voiceQueues'][_0xcfcbef[_0x3fd2('0xaa')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x3fd2('0x21')][_0xcfcbef[_0x3fd2('0xaa')]][_0x3fd2('0x5d')]+=0x1;this[_0x3fd2('0x21')][_0xcfcbef[_0x3fd2('0xaa')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x11c4ad[_0x3fd2('0x9c')]=0xa;_0x11c4ad[_0x3fd2('0x9d')]=_0x3fd2('0x109');_0x11c4ad[_0x3fd2('0x10a')]=_0x3fd2('0x10b');_0x11c4ad[_0x3fd2('0x100')]=this[_0x3fd2('0x21')][_0xcfcbef[_0x3fd2('0xaa')]][_0x3fd2('0x101')]?moment()[_0x3fd2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x11c4ad[_0x3fd2('0x10c')]+=0x1;_0x11c4ad[_0x3fd2('0xe1')]+=0x1;if(_0x11c4ad['countdropretry']>=this['voiceQueues'][_0xcfcbef[_0x3fd2('0xaa')]][_0x3fd2('0x10d')]){this[_0x3fd2('0x10e')](_0x11c4ad);}else{this[_0x3fd2('0xb4')]({'active':![],'countdropretry':_0x11c4ad['countdropretry'],'scheduledat':moment()[_0x3fd2('0xef')](this[_0x3fd2('0x21')][_0xcfcbef['queue']][_0x3fd2('0x10f')],_0x3fd2('0xf0'))[_0x3fd2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f28a6[_0x3fd2('0xc7')],'ListId':_0x4f28a6[_0x3fd2('0xc8')],'VoiceQueueId':_0x4f28a6['VoiceQueueId']||undefined,'CampaignId':_0x4f28a6['CampaignId']||undefined})[_0x3fd2('0xae')](loggerCatch('[rescheduleContact][Drop]'));var _0x4928a7=new History(_0x11c4ad);_0x4928a7['state']=0xa;_0x4928a7[_0x3fd2('0x9d')]=_0x3fd2('0x109');_0x4928a7['starttime']=moment()[_0x3fd2('0x76')](_0x3fd2('0xf7'));_0x4928a7['endtime']=_0x4928a7['starttime'];_0x4928a7[_0x3fd2('0x110')]=_0x11c4ad[_0x3fd2('0x110')];_0x4928a7['calleridnum']=_0x11c4ad[_0x3fd2('0x111')];this[_0x3fd2('0xbe')](_0x4928a7)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x112')));}}else{this[_0x3fd2('0x21')][_0xcfcbef[_0x3fd2('0xaa')]][_0x3fd2('0x113')]+=0x1;this[_0x3fd2('0x21')][_0xcfcbef['queue']][_0x3fd2('0x114')]+=0x1;_0x11c4ad[_0x3fd2('0x9c')]=0xb;_0x11c4ad[_0x3fd2('0x9d')]='Abandoned';_0x11c4ad[_0x3fd2('0x10a')]='CALLEREXIT';_0x11c4ad[_0x3fd2('0x115')]+=0x1;_0x11c4ad['countglobal']+=0x1;if(_0x11c4ad[_0x3fd2('0x115')]>=this[_0x3fd2('0x21')][_0xcfcbef['queue']][_0x3fd2('0x116')]){this[_0x3fd2('0x10e')](_0x11c4ad);}else{this[_0x3fd2('0xb4')]({'active':![],'countabandonedretry':_0x11c4ad['countabandonedretry'],'scheduledat':moment()[_0x3fd2('0xef')](this[_0x3fd2('0x21')][_0xcfcbef[_0x3fd2('0xaa')]][_0x3fd2('0x117')],'minutes')[_0x3fd2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f28a6['ContactId'],'ListId':_0x4f28a6[_0x3fd2('0xc8')],'VoiceQueueId':_0x4f28a6[_0x3fd2('0xf1')]||undefined,'CampaignId':_0x4f28a6[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x118')));var _0x4928a7=new History(_0x11c4ad);_0x4928a7[_0x3fd2('0x9c')]=0xb;_0x4928a7[_0x3fd2('0x9d')]='Abandoned';_0x4928a7[_0x3fd2('0x9f')]=moment()[_0x3fd2('0x76')](_0x3fd2('0xf7'));_0x4928a7['endtime']=_0x4928a7[_0x3fd2('0x9f')];_0x4928a7[_0x3fd2('0x110')]=_0x11c4ad[_0x3fd2('0x110')];_0x4928a7[_0x3fd2('0x111')]=_0x11c4ad[_0x3fd2('0x111')];this['createHistory'](_0x4928a7)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x119')));}}}}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x37')]=function(_0x3ae243){if(this['actions'][_0x3ae243[_0x3fd2('0xd3')]]){this[_0x3fd2('0x26')][_0x3ae243['uniqueid']][_0x3fd2('0xa7')]=_0x3ae243[_0x3fd2('0xa7')];}if(this[_0x3fd2('0xa2')][_0x3ae243['uniqueid']]){this[_0x3fd2('0xa2')][_0x3ae243[_0x3fd2('0xd3')]][_0x3fd2('0xa7')]=_0x3ae243[_0x3fd2('0xa7')];}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x3b')]=function(_0x4d3209){if(strategy[this[_0x3fd2('0x21')][this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]]['queue']][_0x3fd2('0x11b')]]===_0x3fd2('0x1b')){if(this['actions'][_0x4d3209[_0x3fd2('0x11a')]]&&_['isNil'](this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]][_0x3fd2('0x11c')])&&_0x4d3209['status']==='1'&&_0x4d3209['paused']==='0'){if(this[_0x3fd2('0x11d')][_0x4d3209[_0x3fd2('0x11e')]]){if(!this['agents'][_0x4d3209[_0x3fd2('0x11e')]][_0x3fd2('0x11c')]){this[_0x3fd2('0x11d')][_0x4d3209[_0x3fd2('0x11e')]][_0x3fd2('0x11c')]=!![];this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]]['locked']=!![];this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]][_0x3fd2('0x11e')]=_0x4d3209[_0x3fd2('0x11e')];}}}}else if((strategy[this[_0x3fd2('0x21')][this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]][_0x3fd2('0x11b')]]||_0x3fd2('0x1a'))===_0x3fd2('0x1a')){if(this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]]){if(this[_0x3fd2('0x11d')][_0x4d3209[_0x3fd2('0x11e')]]){this['actions'][_0x4d3209['actionid']][_0x3fd2('0x11e')]=_0x4d3209[_0x3fd2('0x11e')];if(_[_0x3fd2('0xd4')](this[_0x3fd2('0x11f')][this['actions'][_0x4d3209[_0x3fd2('0x11a')]]['queue']])){this[_0x3fd2('0x11f')][this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]]['queue']]=[];}this['queueBooked'][this[_0x3fd2('0x26')][_0x4d3209['actionid']]['queue']][_0x3fd2('0x120')](_['merge'](_[_0x3fd2('0xc6')](this[_0x3fd2('0x26')][_0x4d3209[_0x3fd2('0x11a')]],['idHopper',_0x3fd2('0x11e')]),{'status':_0x4d3209['status'],'paused':_0x4d3209['paused']}));}}}};function unlockQueueStatus(_0x5d1e6c,_0x37ee1b){setTimeout(function(){if(_[_0x3fd2('0x3f')](_0x5d1e6c[_0x3fd2('0x121')])){loggerBooked['error'](_0x3fd2('0x122'),_0x37ee1b);}_0x5d1e6c[_0x3fd2('0x121')]=!![];loggerBooked[_0x3fd2('0x7b')](_0x3fd2('0x123'),_0x37ee1b,JSON[_0x3fd2('0x49')](_['pick'](_0x5d1e6c,['name',_0x3fd2('0x121')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2b3238){var _0x42bdab=this;var _0x4af4e6=_0x42bdab[_0x3fd2('0x21')][_0x42bdab['actions'][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]];if(strategy[this[_0x3fd2('0x21')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]['queue']][_0x3fd2('0x11b')]]===_0x3fd2('0x1b')){if(this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]&&this['actions'][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0x11e')]){this[_0x3fd2('0x20')][_0x3fd2('0x124')](this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0x125')],this['actions'][_0x2b3238['actionid']][_0x3fd2('0x11e')])[_0x3fd2('0xae')](function(_0x2abdb7){logger[_0x3fd2('0x8a')](_0x3fd2('0x126'),util[_0x3fd2('0x8b')](_0x2abdb7,{'showHidden':![],'depth':null}));})['finally'](function(){_0x42bdab[_0x3fd2('0xa9')](_0x42bdab['voiceQueues'][_0x42bdab[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]['queue']]);_0x42bdab[_0x3fd2('0x11d')][_0x42bdab[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0x11e')]][_0x3fd2('0x11c')]=![];delete _0x42bdab[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]];unlockQueueStatus(_0x4af4e6);});}else{this[_0x3fd2('0xa9')](this['voiceQueues'][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]['queue']]);this[_0x3fd2('0xb4')]({'active':![],'ContactId':this[_0x3fd2('0x26')][_0x2b3238['actionid']][_0x3fd2('0xc7')],'ListId':this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xc8')],'VoiceQueueId':this[_0x3fd2('0x26')][_0x2b3238['actionid']][_0x3fd2('0xf1')]||undefined,'CampaignId':this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x127')));delete this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]];unlockQueueStatus(_0x4af4e6);}}else if((strategy[this[_0x3fd2('0x21')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]][_0x3fd2('0x11b')]]||_0x3fd2('0x1a'))===_0x3fd2('0x1a')){var _0x46efb8;if(this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]&&!_[_0x3fd2('0x79')](this[_0x3fd2('0x11f')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]])){if(this[_0x3fd2('0x2a')][_0x42bdab[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]]){this[_0x3fd2('0x2a')][_0x42bdab[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]]=this['queueBookedRR'][this['actions'][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]]?this['queueBookedRR'][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]]:this[_0x3fd2('0x11f')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]]?this[_0x3fd2('0x11f')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]][_0x3fd2('0x128')]||0x0:0x0;}this[_0x3fd2('0x11f')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]]['queue']][_0x3fd2('0x128')]=this[_0x3fd2('0x2a')][this[_0x3fd2('0x26')][_0x2b3238[_0x3fd2('0x11a')]][_0x3fd2('0xaa')]];for(var _0x4951b8=0x0;_0x4951b8=0x0?!![]:![];})['catch'](myreject(_0x26d3f4)));}}else{_0x3b1b43['push'](ami[_0x3fd2('0xa5')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x430d0c,!_[_0x3fd2('0x3f')](config['timezones'][_0x3a1036])?_0x3a1036:'')})[_0x3fd2('0xad')](function(_0x4849af){return _0x4849af[_0x3fd2('0x144')][_0x3fd2('0x146')]('true')>=0x0?!![]:![];})[_0x3fd2('0xae')](myreject(_0x26d3f4)));}BPromise[_0x3fd2('0x147')](_0x3b1b43)[_0x3fd2('0xad')](function(_0x12ae2f){var _0x5dfd0e=_[_0x3fd2('0x148')](_0x12ae2f);if(_0x5dfd0e){return _0xa613bb(_0x5dfd0e);}else{_0xc4fea0[_0x3fd2('0x40')]=_0x2038e7?_0x3fd2('0x149'):_0x3fd2('0x14a');return _0x26d3f4(msgResponse(_0x3fd2('0x14b'),_0x3fd2('0x13b'),_0x3fd2('0x14c')+_0x2038e7+'\x20'+_0x2c0d81+_0x3fd2('0x14d')+util[_0x3fd2('0x8b')](_0x430d0c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a1036));}})[_0x3fd2('0xae')](function(_0x42f37){return _0x26d3f4(msgResponse(_0x3fd2('0x13a'),_0x3fd2('0x13b'),JSON['stringify'](_0x42f37)));});});};Dialer['prototype'][_0x3fd2('0x14e')]=function(_0x10fe8c){var _0x196a57=this;return function(){switch(_0x10fe8c[_0x3fd2('0x55')]){case _0x3fd2('0x14f'):freeVariablesPredictive(_0x10fe8c);_0x196a57[_0x3fd2('0x150')](_0x10fe8c,0x1);break;case _0x3fd2('0x151'):freeVariablesPredictive(_0x10fe8c);_0x196a57[_0x3fd2('0x150')](_0x10fe8c,_0x10fe8c[_0x3fd2('0x152')]);break;case _0x3fd2('0xb'):_0x196a57[_0x3fd2('0xb')](_0x10fe8c);break;case'booked':freeVariablesPredictive(_0x10fe8c);_0x196a57[_0x3fd2('0x150')](_0x10fe8c,0x1);break;default:freeVariablesPredictive(_0x10fe8c);logger['error'](_0x3fd2('0x153'),_0x10fe8c[_0x3fd2('0x42')],_0x3fd2('0x154'));}};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x155')]=function(_0xa6a9dc){var _0x2d865c=this;return function(){_0x2d865c[_0x3fd2('0x156')](_0xa6a9dc);};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x33')]=function(_0x5edbf6){var _0xd118d1=this;if(isNotPreview(_0x5edbf6[_0x3fd2('0x55')])){if(isVoiceQueueOutbound(_0x5edbf6[_0x3fd2('0x4d')])&&isActive(_0x5edbf6[_0x3fd2('0x157')])){_0x5edbf6[_0x3fd2('0x96')]=!![];BPromise['resolve']()[_0x3fd2('0xad')](checkIsLoggedIn(_0x5edbf6,_0x5edbf6[_0x3fd2('0x158')]))[_0x3fd2('0xad')](checkIsActive(_0x5edbf6,_0x5edbf6['dialActive']))[_0x3fd2('0xad')](checkInterval(_0x5edbf6))['then'](_0xd118d1[_0x3fd2('0x135')](_0x5edbf6))[_0x3fd2('0xad')](_0xd118d1[_0x3fd2('0x139')](_0x5edbf6['dialGlobalInterval'],_0x5edbf6[_0x3fd2('0x159')],_0x5edbf6[_0x3fd2('0x42')],_0x5edbf6))['then'](_0xd118d1[_0x3fd2('0x15a')](_0x5edbf6[_0x3fd2('0x45')],_0x5edbf6['dialTimezone'],_0x5edbf6[_0x3fd2('0x42')],_0x5edbf6))['then'](_0xd118d1['checkDialMethod'](_0x5edbf6))[_0x3fd2('0xae')](loggerCatchQueueSummary(_0x3fd2('0x15b'),_0x5edbf6));}else{notSendMessagesQueue(_0x5edbf6);}}else{freeVariablesPredictive(_0x5edbf6);}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x15c')]=function(){var _0x496934=this;var _0x418479;for(var _0x3f12f7 in this['campaigns']){if(this[_0x3fd2('0x22')]['hasOwnProperty'](_0x3f12f7)){_0x418479=this[_0x3fd2('0x22')][_0x3f12f7];if(isCampaignIvr(_0x418479[_0x3fd2('0x4d')])&&isActive(_0x418479[_0x3fd2('0x72')])){_0x418479[_0x3fd2('0x96')]=!![];BPromise[_0x3fd2('0xac')]()[_0x3fd2('0xad')](checkIsActive(_0x418479,_0x418479[_0x3fd2('0x72')]))[_0x3fd2('0xad')](checkInterval(_0x418479))[_0x3fd2('0xad')](_0x496934[_0x3fd2('0x135')](_0x418479))[_0x3fd2('0xad')](_0x496934['checkIfTime'](_0x418479[_0x3fd2('0x15d')],_0x418479['dialTimezone'],_0x418479[_0x3fd2('0x42')],_0x418479))['then'](_0x496934[_0x3fd2('0x15a')](_0x418479[_0x3fd2('0x45')],_0x418479[_0x3fd2('0x159')],_0x418479[_0x3fd2('0x42')],_0x418479))['then'](_0x496934['launchHandleIvr'](_0x418479))[_0x3fd2('0xae')](loggerCatchQueueSummary(_0x3fd2('0x15e'),_0x418479));}else{notSendMessagesCampaign(_0x418479);}}}};function getCallerIdRandom(_0xda946e,_0x2adc57){var _0x28a5bd,_0x34d3d9,_0x26872d;if(_0x2adc57<=0x0){_0x2adc57=0x1;}_0x28a5bd=new RegExp(_0x3fd2('0x15f')+_0x2adc57+'}$');_0x34d3d9=Math['pow'](0xa,_0x2adc57-0x1);_0x26872d=Math[_0x3fd2('0x160')](0xa,_0x2adc57)-0x1;return util['format']('%s',_[_0x3fd2('0x161')](_0xda946e,_0x28a5bd,_[_0x3fd2('0x162')](_0x34d3d9,_0x26872d)));}function extractCalleridName(_0x9ec19f){var _0x2427fb=_0x9ec19f[_0x3fd2('0x163')](/"(.*?)"/);return _0x2427fb?_0x2427fb[0x1]:_0x9ec19f;}function extractCalleridNumber(_0x50200c){var _0x29514c=_0x50200c['match'](/<(.*?)>/);return _0x29514c?_0x29514c[0x1]:_0x50200c;}Dialer['prototype']['actionOriginate']=function(_0x32e660,_0x5d3bad){var _0x31c709=this;var _0x51b2a5=uuid['v4']();this[_0x3fd2('0x26')][_0x51b2a5]=new Action(_0x32e660,_0x5d3bad,_0x51b2a5);return new BPromise(function(_0x28563c,_0x140873){if(_['isUndefined'](_0x32e660)&&_0x3fd2('0x164')!==typeof _0x32e660){return _0x140873(msgResponse(_0x3fd2('0x165'),_0x3fd2('0x13b'),_0x3fd2('0x166')));}if(_[_0x3fd2('0x3f')](_0x5d3bad[_0x3fd2('0x167')]['phone'])||_0x5d3bad[_0x3fd2('0x167')][_0x3fd2('0x168')]===null){return _0x140873(msgResponse(_0x3fd2('0x165'),_0x3fd2('0x13b'),_0x3fd2('0x169')));}var _0x54581d={'XMD-CALLERID':_0x31c709[_0x3fd2('0x26')][_0x51b2a5][_0x3fd2('0x16a')](),'XMD-AGI':_0x32e660[_0x3fd2('0xfd')]?util['format'](_0x3fd2('0x16b'),ipAgi,_0x32e660[_0x3fd2('0xfd')]):_0x3fd2('0x16c'),'XMD-AGIAFTER':_0x32e660[_0x3fd2('0x101')]?util[_0x3fd2('0x76')](_0x3fd2('0x16b'),ipAgi,_0x32e660[_0x3fd2('0x101')]):'NONE','XMD-QUEUE':_0x32e660[_0x3fd2('0x4d')]===_0x3fd2('0x4e')?util['format'](_0x3fd2('0x16d'),_0x32e660[_0x3fd2('0x42')],_0x32e660[_0x3fd2('0x16e')]||'',_0x32e660[_0x3fd2('0x102')]?'c':'',_0x32e660[_0x3fd2('0x108')]||0x3):_0x3fd2('0x16c'),'XMD-CONTACTID':_0x5d3bad['ContactId'],'XMD-CDRTYPE':_0x3fd2('0x9'),'CALLERID(all)':_0x31c709['actions'][_0x51b2a5][_0x3fd2('0x16a')](),'XMD-AMD':_0x32e660[_0x3fd2('0xd8')]?_0x3fd2('0x16f'):'NONE','XMD-DESTINATION':_0x3fd2('0x170')};if(_0x32e660[_0x3fd2('0xd8')]){_0x54581d['XMD-AMDINITIALSILENCE']=_0x32e660[_0x3fd2('0x171')]||0x9c4;_0x54581d['XMD-AMDGREETING']=_0x32e660[_0x3fd2('0x172')]||0x5dc;_0x54581d[_0x3fd2('0x173')]=_0x32e660['dialAMDAfterGreetingSilence']||0x320;_0x54581d['XMD-AMDTOTALANALYSISTIME']=_0x32e660['dialAMDTotalAnalysisTime']||0x1388;_0x54581d[_0x3fd2('0x174')]=_0x32e660[_0x3fd2('0x175')]||0x64;_0x54581d[_0x3fd2('0x176')]=_0x32e660[_0x3fd2('0x177')]||0x32;_0x54581d[_0x3fd2('0x178')]=_0x32e660[_0x3fd2('0x179')]||0x3;_0x54581d[_0x3fd2('0x17a')]=_0x32e660[_0x3fd2('0x17b')]||0x100;_0x54581d[_0x3fd2('0x17c')]=_0x32e660[_0x3fd2('0x17d')]||0x1388;}if(_0x32e660[_0x3fd2('0x4d')]===_0x3fd2('0x4e')){_0x54581d[_0x3fd2('0x17e')]=_0x5d3bad[_0x3fd2('0xf1')];}else{_0x54581d[_0x3fd2('0x17f')]=_0x5d3bad[_0x3fd2('0xca')];}for(var _0x3f4a5c in _0x5d3bad[_0x3fd2('0x167')]){if(_0x5d3bad[_0x3fd2('0x167')][_0x3fd2('0x8d')](_0x3f4a5c)){if(isNotNull(_0x5d3bad['Contact'][_0x3f4a5c])&&_0x3f4a5c!=='id'&&_0x3f4a5c!==_0x3fd2('0x180')&&_0x3f4a5c!==_0x3fd2('0x181')&&_0x3f4a5c!==_0x3fd2('0x182')){_0x54581d[util[_0x3fd2('0x76')](_0x3fd2('0x183'),_0x3fd2('0x184'),_['toUpper'](_0x3f4a5c))]=_0x5d3bad[_0x3fd2('0x167')][_0x3f4a5c];}}}var _0x44c7e0=_0x31c709[_0x3fd2('0xcf')](_0x32e660[_0x3fd2('0x71')])?getCallerId(_0x32e660['Trunk']['callerid'],_0x32e660[_0x3fd2('0x56')],_0x32e660['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x32e660[_0x3fd2('0x185')],_0x32e660['dialRandomLastDigitCallerIdNumber']):_0x32e660[_0x3fd2('0x185')]):getCallerId(_[_0x3fd2('0xd4')](_0x32e660[_0x3fd2('0x136')])?_0x32e660['Trunk'][_0x3fd2('0x186')]:_0x32e660[_0x3fd2('0x136')][_0x3fd2('0x186')],_0x32e660[_0x3fd2('0x56')],_0x32e660[_0x3fd2('0x187')]>0x0?getCallerIdRandom(_0x32e660['dialOriginateCallerIdNumber'],_0x32e660['dialRandomLastDigitCallerIdNumber']):_0x32e660[_0x3fd2('0x185')]);if(_0x44c7e0){_0x54581d[_0x3fd2('0x188')]=_0x31c709[_0x3fd2('0x26')][_0x51b2a5][_0x3fd2('0x189')]=extractCalleridName(_0x44c7e0);_0x54581d[_0x3fd2('0x18a')]=_0x31c709[_0x3fd2('0x26')][_0x51b2a5][_0x3fd2('0x18b')]=extractCalleridNumber(_0x44c7e0);}return ami[_0x3fd2('0xa5')]({'actionid':_0x51b2a5,'action':_0x3fd2('0x165'),'channel':_0x31c709[_0x3fd2('0xcf')](_0x32e660[_0x3fd2('0x71')])?util[_0x3fd2('0x76')]('SIP/%s/%s%s',_0x32e660[_0x3fd2('0x71')][_0x3fd2('0x42')],isNotNull(_0x32e660[_0x3fd2('0x57')])?_0x32e660[_0x3fd2('0x57')][_0x3fd2('0x18c')]()||'':'',_0x32e660[_0x3fd2('0x18d')]>0x0?_0x5d3bad[_0x3fd2('0x167')][_0x3fd2('0x168')]['substring'](_0x32e660[_0x3fd2('0x18d')]):_0x5d3bad[_0x3fd2('0x167')][_0x3fd2('0x168')]):util[_0x3fd2('0x76')](_0x3fd2('0x18e'),_[_0x3fd2('0xd4')](_0x32e660[_0x3fd2('0x136')])?_0x32e660[_0x3fd2('0x71')]['name']:_0x32e660[_0x3fd2('0x136')][_0x3fd2('0x42')],isNotNull(_0x32e660['dialPrefix'])?_0x32e660[_0x3fd2('0x57')]['trim']()||'':'',_0x32e660[_0x3fd2('0x18d')]>0x0?_0x5d3bad[_0x3fd2('0x167')][_0x3fd2('0x168')]['substring'](_0x32e660[_0x3fd2('0x18d')]):_0x5d3bad[_0x3fd2('0x167')]['phone']),'callerid':_0x44c7e0,'Exten':'xcally-motion-dialer','Context':_0x3fd2('0x18f'),'Priority':'1','variable':_0x54581d,'timeout':(_0x32e660[_0x3fd2('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x51b2a5})[_0x3fd2('0xad')](function(_0x11202a){return _0x28563c(_0x11202a);})[_0x3fd2('0xae')](function(_0x1a7789){_0x32e660['outboundOriginateFailureCallsDay']+=0x1;var _0x6c91a7=new History(_0x31c709[_0x3fd2('0x26')][_0x51b2a5]);logger[_0x3fd2('0x8a')](util[_0x3fd2('0x76')](_0x3fd2('0x191'),JSON[_0x3fd2('0x49')](_0x1a7789)));_0x6c91a7[_0x3fd2('0x9c')]=0xe;_0x6c91a7['statedesc']=_0x3fd2('0x192');_0x6c91a7[_0x3fd2('0x9f')]=moment()['format'](_0x3fd2('0xf7'));_0x6c91a7[_0x3fd2('0x9e')]=_0x6c91a7[_0x3fd2('0x9f')];_0x31c709[_0x3fd2('0xbe')](_0x6c91a7)[_0x3fd2('0xae')](loggerCatch('[originate][error]'));_0x31c709['moveContactManagedDialer'](_0x6c91a7)['catch'](loggerCatch(_0x3fd2('0x193')))[_0x3fd2('0x12e')](function(){delete _0x31c709[_0x3fd2('0x26')][_0x51b2a5];return _0x140873(msgResponse(_0x3fd2('0x165'),_0x3fd2('0x194'),_0x3fd2('0x195')));});});});};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x196')]=function(_0x214d37){var _0x575868=this['actions'][_0x214d37['actionid']];var _0x53c87b=this;if(_0x575868){delete this[_0x3fd2('0x26')][_0x214d37[_0x3fd2('0x11a')]];_0x575868[_0x3fd2('0x107')]=moment()['format'](_0x3fd2('0xf7'));var _0xb5b737=_0x575868['type']===_0x3fd2('0x75')?this[_0x3fd2('0x22')][_0x575868['queue']]:this[_0x3fd2('0x21')][_0x575868['getQueue']()];if(!this[_0x3fd2('0xcd')](_0x214d37[_0x3fd2('0x197')])){this[_0x3fd2('0xa9')](_0xb5b737);return this[_0x3fd2('0x198')](_0x575868,_0xb5b737,_0x214d37)[_0x3fd2('0xad')](function(_0x4da3f4){})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x199')));}else{this[_0x3fd2('0xa2')][_0x214d37[_0x3fd2('0xd3')]]=_0x575868;}}};Dialer['prototype']['checkRetriveMax']=function(_0x284e1b,_0x4927ae,_0x4e651d){var _0xc92d82=new History(_0x4927ae);if(_0xc92d82[_0x3fd2('0xe4')]+_0xc92d82['countcongestionretry']+_0xc92d82['countnoanswerretry']+_0xc92d82[_0x3fd2('0xe7')]+_0xc92d82[_0x3fd2('0x10c')]+_0xc92d82[_0x3fd2('0x115')]+_0xc92d82[_0x3fd2('0xe8')]+_0xc92d82[_0x3fd2('0xf5')]>=_0x4e651d['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x284e1b){case 0x3:if(_0xc92d82[_0x3fd2('0xe6')]>=_0x4e651d['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x3fd2('0xb4')]({'active':![],'countnoanswerretry':_0xc92d82[_0x3fd2('0xe6')]+=0x1,'scheduledat':moment()[_0x3fd2('0xef')](_0x4e651d[_0x3fd2('0x19a')],_0x3fd2('0xf0'))[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0xc92d82['ContactId'],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82['VoiceQueueId']||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x19b')));}break;case 0x5:if(_0xc92d82['countbusyretry']>=_0x4e651d[_0x3fd2('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0xc92d82['countbusyretry']+=0x1,'scheduledat':moment()[_0x3fd2('0xef')](_0x4e651d[_0x3fd2('0x19d')],_0x3fd2('0xf0'))[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x19e')));}break;case 0x8:if(_0xc92d82[_0x3fd2('0xe5')]>=_0x4e651d[_0x3fd2('0x19f')]-0x1){return!![];}else{this[_0x3fd2('0xb4')]({'active':![],'countcongestionretry':_0xc92d82[_0x3fd2('0xe5')]+=0x1,'scheduledat':moment()['add'](_0x4e651d[_0x3fd2('0x1a0')],'minutes')[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1a1')));}break;case 0x0:if(_0xc92d82[_0x3fd2('0xe7')]>=_0x4e651d[_0x3fd2('0x1a2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xc92d82['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x3fd2('0xef')](_0x4e651d[_0x3fd2('0x1a3')],_0x3fd2('0xf0'))[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1a4')));}break;case 0xa:if(_0xc92d82[_0x3fd2('0x10c')]>=_0x4e651d[_0x3fd2('0x10d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0xc92d82[_0x3fd2('0x10c')]+=0x1,'scheduledat':moment()[_0x3fd2('0xef')](_0x4e651d[_0x3fd2('0x10f')],_0x3fd2('0xf0'))[_0x3fd2('0x76')](_0x3fd2('0xf7')),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1a5')));}break;case 0xb:if(_0xc92d82['countabandonedretry']>=_0x4e651d[_0x3fd2('0x116')]-0x1){return!![];}else{this[_0x3fd2('0xb4')]({'active':![],'countabandonedretry':_0xc92d82[_0x3fd2('0x115')]+=0x1,'scheduledat':moment()['add'](_0x4e651d[_0x3fd2('0x117')],_0x3fd2('0xf0'))['format'](_0x3fd2('0xf7')),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82['ListId'],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x118')));}break;case 0x13:if(_0xc92d82[_0x3fd2('0xe8')]>=_0x4e651d[_0x3fd2('0xec')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0xc92d82[_0x3fd2('0xe8')]+=0x1,'scheduledat':moment()[_0x3fd2('0xef')](_0x4e651d[_0x3fd2('0xf6')],_0x3fd2('0xf0'))[_0x3fd2('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0xc92d82[_0x3fd2('0xf5')]>=_0x4e651d[_0x3fd2('0x1a6')]-0x1){return!![];}else{this[_0x3fd2('0xb4')]({'active':![],'countagentrejectretry':_0xc92d82[_0x3fd2('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x4e651d[_0x3fd2('0x1a7')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc92d82[_0x3fd2('0xc7')],'ListId':_0xc92d82[_0x3fd2('0xc8')],'VoiceQueueId':_0xc92d82[_0x3fd2('0xf1')]||undefined,'CampaignId':_0xc92d82[_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x198')]=function(_0x496a8d,_0xf417c6,_0x432d29){var _0x5a01b6=this;var _0x4e0961=new History(_0x496a8d);return new BPromise(function(_0x44f5ad,_0x38c909){if(_[_0x3fd2('0x3f')](_0xf417c6)&&'object'!==typeof _0xf417c6){return _0x38c909(msgResponse(_0x3fd2('0x1a8'),_0x3fd2('0x13b'),_0x3fd2('0x1a9')));}if(_[_0x3fd2('0x3f')](_0x432d29)&&'object'!==typeof _0x432d29){return _0x38c909(msgResponse(_0x3fd2('0x1a8'),'Failure',_0x3fd2('0x1aa')));}switch(_0x432d29[_0x3fd2('0x1ab')]){case'0':_0xf417c6[_0x3fd2('0x1ac')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0x0;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1ad');_0x4e0961[_0x3fd2('0xe7')]+=0x1;_0x4e0961[_0x3fd2('0xe1')]+=0x1;ami[_0x3fd2('0x1ae')](_0x3fd2('0x1af'),ut[_0x3fd2('0x1b0')](_0x496a8d,_0x3fd2('0x1b1')));_0x5a01b6['createHistory'](_0x4e0961)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xe3')));if(_0x5a01b6[_0x3fd2('0x1b2')](0x0,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xe7')]>=_0xf417c6[_0x3fd2('0x1a2')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1b3'));}else{_0x5a01b6[_0x3fd2('0xea')](_0x4e0961,_0x44f5ad,_0x38c909,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xf417c6[_0x3fd2('0x5e')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0x3;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1b4');_0x4e0961['countnoanswerretry']+=0x1;_0x4e0961[_0x3fd2('0xe1')]+=0x1;ami[_0x3fd2('0x1ae')]('custom:agentnoanswer',ut[_0x3fd2('0x1b0')](_0x496a8d,_0x3fd2('0x1b5')));_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1b6')));if(_0x5a01b6[_0x3fd2('0x1b2')](0x3,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xe6')]>=_0xf417c6[_0x3fd2('0x1b7')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5a01b6['stateGlobal'](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1b8'));}}break;case'5':_0xf417c6[_0x3fd2('0x1b9')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0x5;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1ba');_0x4e0961[_0x3fd2('0xe4')]+=0x1;_0x4e0961['countglobal']+=0x1;ami[_0x3fd2('0x1ae')]('custom:agentbusy',ut[_0x3fd2('0x1b0')](_0x496a8d,_0x3fd2('0x1bb')));_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5a01b6[_0x3fd2('0x1b2')](0x5,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xe4')]>=_0xf417c6[_0x3fd2('0x19c')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1bc'));}else{_0x5a01b6[_0x3fd2('0xea')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1bc'));}}break;case'8':_0xf417c6[_0x3fd2('0x5b')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0x8;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1bd');_0x4e0961[_0x3fd2('0xe5')]+=0x1;_0x4e0961['countglobal']+=0x1;ami['emit'](_0x3fd2('0x1be'),ut['buildObj'](_0x496a8d,_0x3fd2('0x1bf')));_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1c0')));if(_0x5a01b6['checkRetriveMax'](0x8,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xe5')]>=_0xf417c6[_0x3fd2('0x19f')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1c1'));}else{_0x5a01b6[_0x3fd2('0xea')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1c1'));}}break;case'11':_0xf417c6[_0x3fd2('0x1c2')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0xb;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1c3');_0x4e0961['countabandonedretry']+=0x1;_0x4e0961[_0x3fd2('0xe1')]+=0x1;_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5a01b6[_0x3fd2('0x1b2')](0xb,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0x115')]>=_0xf417c6[_0x3fd2('0x116')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1c4'));}else{_0x5a01b6['stateGlobal'](_0x4e0961,_0x44f5ad,_0x38c909,'reason\x2011\x20abandoned');}}break;case'20':_0xf417c6[_0x3fd2('0x60')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0x14;_0x4e0961[_0x3fd2('0x9d')]=_0x3fd2('0x1c5');_0x4e0961[_0x3fd2('0xf5')]+=0x1;_0x4e0961[_0x3fd2('0xe1')]+=0x1;ami[_0x3fd2('0x1ae')](_0x3fd2('0x1c6'),ut['buildObj'](_0x496a8d,_0x3fd2('0x1c7')));_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)[_0x3fd2('0xae')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5a01b6[_0x3fd2('0x1b2')](0x14,_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xf5')]>=_0xf417c6[_0x3fd2('0x1a6')]){_0x5a01b6[_0x3fd2('0xed')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1c8'));}else{_0x5a01b6[_0x3fd2('0xea')](_0x4e0961,_0x44f5ad,_0x38c909,_0x3fd2('0x1c8'));}}break;default:_0xf417c6[_0x3fd2('0x61')]+=0x1;_0x4e0961[_0x3fd2('0x9c')]=0xc;_0x4e0961[_0x3fd2('0x9d')]=_0x432d29[_0x3fd2('0x1ab')];_0x5a01b6[_0x3fd2('0xbe')](_0x4e0961)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5a01b6[_0x3fd2('0x1b2')](_0x432d29[_0x3fd2('0x1ab')],_0x496a8d,_0xf417c6)){if(_0x4e0961[_0x3fd2('0xe4')]+_0x4e0961[_0x3fd2('0xe5')]+_0x4e0961[_0x3fd2('0xe6')]+_0x4e0961[_0x3fd2('0xe7')]+_0x4e0961[_0x3fd2('0x10c')]+_0x4e0961[_0x3fd2('0x115')]+_0x4e0961['countmachineretry']+_0x4e0961[_0x3fd2('0xf5')]>=_0xf417c6['dialGlobalMaxRetry']){_0x5a01b6[_0x3fd2('0xea')](_0x4e0961,_0x44f5ad,_0x38c909,_0x432d29[_0x3fd2('0x1ab')]);}else{_0x5a01b6['createStateFinal'](_0x4e0961,_0x44f5ad,_0x38c909,_0x432d29[_0x3fd2('0x1ab')]);}}}});};Dialer[_0x3fd2('0x1c')][_0x3fd2('0xea')]=function(_0x1b2bc3,_0x3f4fb2,_0x2099a1,_0x2b2a2b){var _0xe98076=new Final(_0x1b2bc3);_0xe98076['state']=0xf;_0xe98076['statedesc']=_0x3fd2('0x1c9');this['createStateFinal'](_0xe98076,_0x3f4fb2,_0x2099a1,_0x2b2a2b);};Dialer['prototype'][_0x3fd2('0xed')]=function(_0x19c0ed,_0x16d895,_0x2babfa,_0x556fe6){this['moveContactManagedDialer'](_0x19c0ed)[_0x3fd2('0xad')](function(_0x2c6f4c){return _0x16d895(msgResponse(_0x3fd2('0x1a8'),'Success',_0x556fe6));})[_0x3fd2('0xae')](function(_0x5d2391){return _0x2babfa(msgResponse(_0x3fd2('0x1ca'),_0x3fd2('0x13b'),'contact\x20not\x20moved'));});};Dialer[_0x3fd2('0x1c')]['predictive']=function(_0x2428d0){var _0x12e9d4=this;var _0x1589ce=_0x2428d0[_0x3fd2('0x1cb')]/0x64;var _0x3c1d6b=_0x2428d0[_0x3fd2('0x5d')]/(_0x2428d0[_0x3fd2('0x5d')]+_0x2428d0[_0x3fd2('0x59')]);var _0x500666=Math[_0x3fd2('0x1cc')](_0x2428d0[_0x3fd2('0x69')]*(_0x2428d0[_0x3fd2('0x1cd')]/0x64));var _0x3e39c9=Math[_0x3fd2('0x1cc')](_0x2428d0[_0x3fd2('0x69')]*(_0x2428d0[_0x3fd2('0x1ce')]/0x64));var _0x3cc070=_0x2428d0[_0x3fd2('0x4f')]+_0x2428d0[_0x3fd2('0x51')];var _0x237f9b=Math['floor'](_0x2428d0[_0x3fd2('0x6c')]*_0x2428d0[_0x3fd2('0x6e')]*_0x2428d0[_0x3fd2('0x67')]*_0x2428d0['predictiveIntervalMultiplicativeFactor']);if(_[_0x3fd2('0x3f')](_0x2428d0[_0x3fd2('0x70')])){if(!_[_0x3fd2('0x3f')](_0x2428d0['startPredictive'])){_0x2428d0[_0x3fd2('0x28')]=undefined;loggerPredictive[_0x3fd2('0x8a')](_0x3fd2('0x1cf'),_0x3fd2('0x1d0'));}if(!_[_0x3fd2('0x3f')](_0x2428d0[_0x3fd2('0x86')])){loggerPredictive[_0x3fd2('0x8a')]('[startMethodPredictive][StartProgressive]',_0x3fd2('0x1d1'));clearInterval(_0x2428d0['handlePredictive']);_0x2428d0[_0x3fd2('0x86')]=undefined;}_0x2428d0[_0x3fd2('0x70')]=moment()[_0x3fd2('0x76')](_0x3fd2('0xf7'));loggerPredictive[_0x3fd2('0x7b')](_0x2428d0[_0x3fd2('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x2428d0[_0x3fd2('0x70')]);this[_0x3fd2('0x150')](_0x2428d0,0x1);}else if(ifInterval(_0x2428d0[_0x3fd2('0x1d2')],_0x2428d0[_0x3fd2('0x70')])){this[_0x3fd2('0x150')](_0x2428d0,0x1);loggerPredictiveCalls[_0x3fd2('0x7b')](_0x3fd2('0x1d3'),_0x2428d0[_0x3fd2('0x70')],_0x2428d0[_0x3fd2('0x42')]);_0x2428d0[_0x3fd2('0x6c')]=0x0;_0x2428d0[_0x3fd2('0x1d4')]=0x0;}else if(_0x1589ce<_0x3c1d6b&&_0x2428d0[_0x3fd2('0x1d5')]===_0x3fd2('0x1d6')){freeVariablesPredictive(_0x2428d0);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x1d7'),_0x3fd2('0x1d8'),_0x3c1d6b,_0x3fd2('0x70'),_0x2428d0[_0x3fd2('0x42')]);}else if(_0x237f9b<_0x2428d0['predictiveIntervalErlangCallsDroppedCalls']&&_0x2428d0['dialPredictiveOptimization']===_0x3fd2('0x1d6')){freeVariablesPredictive(_0x2428d0);loggerPredictive[_0x3fd2('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x237f9b,_0x3fd2('0x1d9'),_0x2428d0[_0x3fd2('0x1d4')],_0x3fd2('0x70'),_0x2428d0[_0x3fd2('0x42')]);}else if(!ifInterval(_0x2428d0[_0x3fd2('0x1d2')],_0x2428d0[_0x3fd2('0x70')])&&_['isUndefined'](_0x2428d0[_0x3fd2('0x28')])&&!_[_0x3fd2('0x3f')](_0x2428d0[_0x3fd2('0x70')])){_0x2428d0['startPredictive']=moment()['format'](_0x3fd2('0xf7'));loggerPredictive[_0x3fd2('0x7b')](_0x2428d0[_0x3fd2('0x42')],_0x3fd2('0x1da'),_0x2428d0[_0x3fd2('0x28')]);this[_0x3fd2('0xb2')](_0x2428d0[_0x3fd2('0x1d2')])[_0x3fd2('0xad')](this[_0x3fd2('0x1db')](_0x2428d0))[_0x3fd2('0xad')](mergeDataErlangB(_0x2428d0))[_0x3fd2('0xad')](this['startMethodPredictive'](_0x2428d0))[_0x3fd2('0xae')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2428d0));}else if(!ifInterval(_0x2428d0[_0x3fd2('0x1d2')],_0x2428d0[_0x3fd2('0x28')])){_0x2428d0['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2428d0['startPredictive']=moment()[_0x3fd2('0x76')](_0x3fd2('0xf7'));loggerPredictive['info'](_0x2428d0['name'],'recalculate\x20predictive\x20at',_0x2428d0['startPredictive']);clearInterval(_0x2428d0[_0x3fd2('0x86')]);_0x2428d0['handlePredictive']=undefined;this[_0x3fd2('0xb2')](_0x2428d0[_0x3fd2('0x1d2')])['then'](this[_0x3fd2('0x1db')](_0x2428d0))[_0x3fd2('0xad')](mergeDataErlangB(_0x2428d0))[_0x3fd2('0xad')](this['startMethodPredictive'](_0x2428d0))[_0x3fd2('0xae')](loggerCatchPredictive(_0x3fd2('0x1dc'),_0x2428d0));}else if(_0x2428d0[_0x3fd2('0x69')]&&_0x3cc070<_0x2428d0[_0x3fd2('0x69')]-_0x3e39c9){freeVariablesPredictive(_0x2428d0);loggerPredictive[_0x3fd2('0x7b')](_0x2428d0[_0x3fd2('0x42')],_0x3fd2('0x1dd'),_0x3cc070,_0x3fd2('0x1de'),_0x2428d0[_0x3fd2('0x69')],'-',_0x3e39c9,'=',_0x2428d0[_0x3fd2('0x69')]-_0x3e39c9,')');}else if(_0x2428d0[_0x3fd2('0x69')]&&_0x3cc070>_0x2428d0['predictiveIntervalAvailable']+_0x500666){freeVariablesPredictive(_0x2428d0);loggerPredictive[_0x3fd2('0x7b')](_0x2428d0[_0x3fd2('0x42')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3cc070,_0x3fd2('0x1df'),_0x2428d0[_0x3fd2('0x69')],'+',_0x500666,'=',_0x2428d0[_0x3fd2('0x69')]+_0x500666,')');}};Dialer['prototype'][_0x3fd2('0x1db')]=function(_0x9b062b){var _0x4e5f5e=this;return function(_0x21f0c3){return new BPromise(function(_0xa1683b,_0x3c1b60){_[_0x3fd2('0x84')](_0x9b062b,_0x21f0c3[0x0]);if(checkGetDataPredictive(_0x21f0c3[0x0])){var _0x1517af=_0x9b062b['predictiveIntervalAvailable']=_0x9b062b[_0x3fd2('0x51')]+_0x9b062b[_0x3fd2('0x4f')];var _0x43e40c=_0x9b062b['dialPredictiveInterval']*0x3c;var _0x2856bf=_0x21f0c3[0x0][_0x3fd2('0x64')]+_0x21f0c3[0x0][_0x3fd2('0x63')];var _0x4027e9=(_0x21f0c3[0x0][_0x3fd2('0x62')]+_0x21f0c3[0x0][_0x3fd2('0x65')]+_0x21f0c3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x21f0c3[0x0]['predictiveIntervalTotalCalls'];_0x9b062b['predictiveIntervalHitRate']=_0x4027e9>0x0?_0x4027e9:0x1;switch(_0x9b062b[_0x3fd2('0x1d5')]){case'dropRate':var _0x11579c=_0x9b062b[_0x3fd2('0x1cb')]/0x64;return _0x4e5f5e['abandonmentRate'](_0x1517af,_0x43e40c,_0x2856bf,_0x4027e9,_0x11579c)[_0x3fd2('0xad')](function(_0x54cc91){return _0xa1683b(_0x54cc91);});case _0x3fd2('0x1e0'):var _0x6cd334=_0x9b062b[_0x3fd2('0x1cb')]/0x64;return _0x4e5f5e[_0x3fd2('0x1e1')](_0x1517af,_0x43e40c,_0x2856bf,_0x4027e9,_0x6cd334)[_0x3fd2('0xad')](function(_0x2d5bae){return _0xa1683b(_0x2d5bae);});default:return _0x3c1b60(msgResponse(_0x3fd2('0x1e2'),'Failure',_0x3fd2('0x1e3')));}}else{return _0x3c1b60(msgResponse(_0x3fd2('0x1e2'),'Failure',_0x3fd2('0x1e4')));}});};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x1e5')]=function(_0xa1710b){var _0xf2ee1e=this;return function(_0x151f94){return new BPromise(function(_0x1a751a,_0x273042){_[_0x3fd2('0x84')](_0xa1710b,_0x151f94[0x0]);if(checkGetDataPredictive(_0x151f94[0x0])){loggerPredictive[_0x3fd2('0x7b')](JSON[_0x3fd2('0x49')](_0x151f94[0x0]));if(_0xa1710b[_0x3fd2('0x1d5')]===_0x3fd2('0x1d6')){return _0xf2ee1e['getVoiceQueueRtPauses'](_0xa1710b['id'])[_0x3fd2('0xad')](function(_0x10aa75){var _0x4776da=_0xa1710b[_0x3fd2('0x158')]-_0x10aa75[0x0][_0x3fd2('0x1e6')];var _0x45b430=_0xa1710b['dialPredictiveInterval']*0x3c;var _0x398f50=_0x151f94[0x0][_0x3fd2('0x64')]+_0x151f94[0x0][_0x3fd2('0x63')];var _0x44bc52=(_0x151f94[0x0]['predictiveIntervalAnsweredCalls']+_0x151f94[0x0][_0x3fd2('0x65')]+_0x151f94[0x0][_0x3fd2('0x113')])/_0x151f94[0x0][_0x3fd2('0x6a')];var _0x2296e4=_0xa1710b[_0x3fd2('0x1cb')]/0x64;_0xa1710b['predictiveIntervalPauses']=_0x10aa75[0x0][_0x3fd2('0x1e6')]||0x0;_0xa1710b[_0x3fd2('0x67')]=_0x44bc52>0x0?_0x44bc52:0x1;return _0xf2ee1e[_0x3fd2('0x1e7')](_0x4776da,_0x45b430,_0x398f50,_0x44bc52,_0x2296e4);})[_0x3fd2('0xad')](function(_0x10895a){return _0x1a751a(_0x10895a);})[_0x3fd2('0xae')](function(_0x1205ae){return _0x273042(msgResponse('[CatchErlangB]','Failure',JSON[_0x3fd2('0x49')](_0x1205ae)));});}if(_0xa1710b[_0x3fd2('0x1d5')]===_0x3fd2('0x1e0')){return _0xf2ee1e[_0x3fd2('0xba')](_0xa1710b['id'])[_0x3fd2('0xad')](function(_0xe6d77a){var _0x34f6f8=_0xa1710b['loggedIn']-_0xe6d77a[0x0][_0x3fd2('0x1e6')];var _0x3930b9=_0xa1710b[_0x3fd2('0x1d2')]*0x3c;var _0x3157d8=_0x151f94[0x0][_0x3fd2('0x64')]+_0x151f94[0x0][_0x3fd2('0x63')];var _0x15c63c=(_0x151f94[0x0]['predictiveIntervalAnsweredCalls']+_0x151f94[0x0][_0x3fd2('0x65')]+_0x151f94[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x151f94[0x0]['predictiveIntervalTotalCalls'];var _0x4e70df=_0xa1710b[_0x3fd2('0x1cb')]/0x64;_0xa1710b['predictiveIntervalPauses']=_0xe6d77a[0x0][_0x3fd2('0x1e6')]||0x0;_0xa1710b[_0x3fd2('0x67')]=_0x15c63c>0x0?_0x15c63c:0x1;return _0xf2ee1e[_0x3fd2('0x1e1')](_0x34f6f8,_0x3930b9,_0x3157d8,_0x15c63c,_0x4e70df);})[_0x3fd2('0xad')](function(_0xbc327a){return _0x1a751a(_0xbc327a);})[_0x3fd2('0xae')](function(_0x2d65db){return _0x273042(msgResponse(_0x3fd2('0x1e8'),_0x3fd2('0x13b'),JSON[_0x3fd2('0x49')](_0x2d65db)));});}}else{return _0x273042(msgResponse('[getDataPredictive]',_0x3fd2('0x13b'),_0x3fd2('0x1e4')));}});};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x1e9')]=function(_0x2d9107){var _0x4b9472=this;return function(){var _0x373f00=0x0;var _0x57b9bd=Math[_0x3fd2('0x1ea')](_0x2d9107[_0x3fd2('0x6d')]*0x3e8);if(_0x57b9bd>0x0){_0x57b9bd=_0x57b9bd<0x64?0x64:_0x57b9bd;loggerPredictive[_0x3fd2('0x7b')](_0x2d9107[_0x3fd2('0x42')],_0x3fd2('0x1eb'),_0x57b9bd,_0x3fd2('0x4a'));_0x2d9107[_0x3fd2('0x86')]=setInterval(function(){_0x4b9472['handlePredictive'](_0x2d9107);loggerPredictiveCalls['info'](_0x3fd2('0x1ec'),_0x373f00+=0x1);},_0x57b9bd);}else{loggerPredictive[_0x3fd2('0x7b')](_0x2d9107[_0x3fd2('0x42')],_0x3fd2('0x1ed'));}};};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x1ee')]=function(_0x25d13d,_0x18aa33){var _0x5f3f8a=this;return function(_0x5b8e81){if(_['isEmpty'](_0x5b8e81)){if(_['isNil'](_0x18aa33[_0x3fd2('0xc9')])||!_0x18aa33[_0x3fd2('0x1ef')]){if(_0x25d13d[_0x3fd2('0x55')]===_0x3fd2('0xa')){_0x25d13d[_0x3fd2('0x121')]=_[_0x3fd2('0x3f')](_0x25d13d[_0x3fd2('0x121')])?!![]:_0x25d13d[_0x3fd2('0x121')];var _0x3d4d98=uuid['v4']();_0x5f3f8a['actions'][_0x3d4d98]=new Action(_0x25d13d,_0x18aa33,_0x3d4d98);loggerBooked[_0x3fd2('0x7b')](_0x3fd2('0x1f0'),_0x3d4d98,_0x3fd2('0x1f1'),JSON[_0x3fd2('0x49')](_0x25d13d['queueStatusComplete']),_0x3fd2('0x1f2'),_0x25d13d['name']);if(_0x25d13d[_0x3fd2('0x121')]){_0x25d13d[_0x3fd2('0x121')]=![];_0x5f3f8a[_0x3fd2('0x11f')][_0x5f3f8a['actions'][_0x3d4d98][_0x3fd2('0xaa')]]=[];ami[_0x3fd2('0xa5')]({'actionid':_0x3d4d98,'action':_0x3fd2('0x1f3'),'queue':_0x25d13d[_0x3fd2('0x42')]})[_0x3fd2('0xae')](function(_0xa3365a){_0x5f3f8a[_0x3fd2('0xa9')](_0x25d13d);_0x5f3f8a[_0x3fd2('0xb4')]({'active':![],'ContactId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98]['ContactId'],'ListId':_0x5f3f8a['actions'][_0x3d4d98]['ListId'],'VoiceQueueId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98]['VoiceQueueId']||undefined,'CampaignId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98][_0x3fd2('0xca')]||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1f4')));delete _0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98];});}else{loggerBooked['info'](_0x3fd2('0x1f5'),JSON[_0x3fd2('0x49')](_0x25d13d[_0x3fd2('0x121')]),_0x3fd2('0x1f2'),_0x25d13d['name']);_0x5f3f8a[_0x3fd2('0xa9')](_0x25d13d);_0x5f3f8a[_0x3fd2('0xb4')]({'active':![],'ContactId':_0x5f3f8a['actions'][_0x3d4d98][_0x3fd2('0xc7')],'ListId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98][_0x3fd2('0xc8')],'VoiceQueueId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98][_0x3fd2('0xf1')]||undefined,'CampaignId':_0x5f3f8a[_0x3fd2('0x26')][_0x3d4d98]['CampaignId']||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1f4')));delete _0x5f3f8a['actions'][_0x3d4d98];}}else{return _0x5f3f8a[_0x3fd2('0x1f6')](_0x25d13d,_0x18aa33);}}else{if(getDiff(_0x18aa33[_0x3fd2('0x1f7')])<_0x25d13d[_0x3fd2('0x1f8')]*0x3c){if(_0x18aa33[_0x3fd2('0x1f9')]&&!_0x18aa33[_0x3fd2('0x1f9')][_0x3fd2('0x1fa')]){_0x5f3f8a[_0x3fd2('0x20')][_0x3fd2('0x124')](_0x18aa33['id'])[_0x3fd2('0x12e')](function(){_0x5f3f8a[_0x3fd2('0xa9')](_0x25d13d);});}else{_0x5f3f8a[_0x3fd2('0xb5')]({'active':![]},_0x18aa33['id'],0x1)['finally'](function(){console['log'](_0x3fd2('0x1fb'));_0x5f3f8a[_0x3fd2('0xa9')](_0x25d13d);});}}else{_0x25d13d[_0x3fd2('0x5f')]+=0x1;_0x5f3f8a[_0x3fd2('0xa9')](_0x25d13d);if(_0x25d13d[_0x3fd2('0x1fc')]){_0x5f3f8a[_0x3fd2('0xb4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x18aa33['ContactId'],'ListId':_0x18aa33[_0x3fd2('0xc8')],'VoiceQueueId':_0x18aa33[_0x3fd2('0xf1')]||undefined,'CampaignId':_0x18aa33['CampaignId']||undefined})[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0x1fd')));_0x5f3f8a['createHistory'](createObjHistory(_0x25d13d,_0x18aa33,_0x3fd2('0x1fe'),0x17,_0x3fd2('0x1ff')))['catch'](loggerCatch(_0x3fd2('0x200')));}else{_0x5f3f8a['saveInDb'](createObjHistory(_0x25d13d,_0x18aa33,'RECALLFAILEDTIMEOUT',0x16,_0x3fd2('0x201')),_0x3fd2('0x202'),_0x3fd2('0x203'));}}}}else{_0x25d13d[_0x3fd2('0x5a')]+=0x1;_0x5f3f8a['saveInDb'](createObjHistory(_0x25d13d,_0x18aa33,'BLACKLIST',0xd,'Blacklist'),_0x3fd2('0x204'),_0x3fd2('0x205'));throw _0x3fd2('0x206');}};};Dialer['prototype'][_0x3fd2('0x156')]=function(_0x2c2706){var _0x1d7584=this;var _0x538633=[];var _0x3e234f=_0x2c2706[_0x3fd2('0x207')]-_0x2c2706['originated']-_0x2c2706[_0x3fd2('0x208')];emitCampaignSummary(_0x2c2706);if(_0x3e234f>0x0){if(_0x3e234f>this[_0x3fd2('0x24')]){_0x3e234f=this['maxNumberOriginate'];}_0x2c2706['temp']+=_0x3e234f;this[_0x3fd2('0xb8')](_0x2c2706['id'],_0x3e234f,_0x2c2706[_0x3fd2('0x209')])['then'](function(_0x435b60){_0x2c2706[_0x3fd2('0x208')]-=_0x3e234f;_0x2c2706[_0x3fd2('0x208')]=_0x2c2706[_0x3fd2('0x208')]>0x0?_0x2c2706['temp']:0x0;if(!checkContactEmpty(_0x435b60)){_0x2c2706[_0x3fd2('0x40')]=_0x3fd2('0x94');logger['info'](_0x3fd2('0x20a')+_0x2c2706[_0x3fd2('0x42')]);}else{_0x2c2706['originated']+=_0x435b60[_0x3fd2('0x129')];_0x2c2706['message']='RUNNING';for(var _0x481767=0x0;_0x481767<_0x435b60[_0x3fd2('0x129')];_0x481767+=0x1){_0x2c2706[_0x3fd2('0x20b')]+=0x1;if(_[_0x3fd2('0xd4')](_0x435b60[_0x481767])||_[_0x3fd2('0xd4')](_0x435b60[_0x481767][_0x3fd2('0x167')])||_[_0x3fd2('0xd4')](_0x435b60[_0x481767][_0x3fd2('0x167')][_0x3fd2('0x168')])){_0x1d7584[_0x3fd2('0xc3')](_0x3fd2('0x20c'),_0x2c2706,_0x435b60[_0x481767]);}else{_0x1d7584[_0x3fd2('0x20d')](_[_0x3fd2('0xc6')](_0x435b60[_0x481767],['CampaignId',_0x3fd2('0x20e')]))['then'](_0x1d7584[_0x3fd2('0x1ee')](_0x2c2706,_0x435b60[_0x481767]))[_0x3fd2('0xae')](_0x1d7584[_0x3fd2('0xc2')](_0x3fd2('0x20f'),_0x2c2706));}}}})['catch'](loggerGetContactDialer(_0x3fd2('0x210'),_0x2c2706,_0x3e234f));}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x150')]=function(_0x2c6fad,_0x26c730){var _0x18b1c8=this;var _0x403931=[];var _0x5174c8=_0x26c730>=0x1?_0x26c730:0x1;var _0x2288e2=[];if(_0x2c6fad[_0x3fd2('0x55')]===_0x3fd2('0xa')){_0x5174c8=0x1;}var _0x30df5c=Math[_0x3fd2('0x1ea')](_0x2c6fad['available']*_0x5174c8)-_0x2c6fad[_0x3fd2('0x6b')]-_0x2c6fad[_0x3fd2('0x208')];emitVoiceQueueSummary(_0x2c6fad);if(_0x2c6fad[_0x3fd2('0x211')]>0x0){var _0x11bc1e=_0x2c6fad[_0x3fd2('0x211')]-_0x2c6fad[_0x3fd2('0x6b')]-_0x2c6fad[_0x3fd2('0x51')]-_0x2c6fad['temp']-_0x2c6fad[_0x3fd2('0x97')];if(_0x30df5c>_0x11bc1e){_0x30df5c=_0x11bc1e;}}if(_0x30df5c>0x0){if(_0x2c6fad['dialMethod']==='booked'){_0x30df5c=0x1;}if(_0x30df5c>this['maxNumberOriginate']){_0x30df5c=this[_0x3fd2('0x24')];}_0x2c6fad[_0x3fd2('0x208')]+=_0x30df5c;for(var _0x196262 in this['agents']){if(this[_0x3fd2('0x11d')][_0x3fd2('0x8d')](_0x196262)){if(this[_0x3fd2('0x11d')][_0x196262]['state']===_0x3fd2('0x212')&&this[_0x3fd2('0x11d')][_0x196262][_0x3fd2('0xa6')]===_0x3fd2('0xd1')){_0x403931['push'](this[_0x3fd2('0x11d')][_0x196262]['id']);}}}this[_0x3fd2('0xb7')](_0x2c6fad['id'],_0x403931,_0x30df5c,_0x2c6fad[_0x3fd2('0x209')])['then'](function(_0x12781a){_0x2c6fad[_0x3fd2('0x208')]-=_0x30df5c;_0x2c6fad['temp']=_0x2c6fad[_0x3fd2('0x208')]>0x0?_0x2c6fad[_0x3fd2('0x208')]:0x0;if(!checkContactEmpty(_0x12781a)){_0x18b1c8['countReScheduled'](_0x2c6fad)[_0x3fd2('0xad')](sendMessageReschedule(_0x2c6fad))['catch'](loggerCatch(_0x3fd2('0xaf')));}else{_0x2c6fad['originated']+=_0x12781a[_0x3fd2('0x129')];_0x2c6fad[_0x3fd2('0x40')]=_0x2c6fad[_0x3fd2('0x55')]==='booked'?_0x3fd2('0x16f'):'RUNNING';for(var _0x50f0fb=0x0;_0x50f0fb<_0x12781a[_0x3fd2('0x129')];_0x50f0fb+=0x1){if(_['isNil'](_0x12781a[_0x50f0fb])||_[_0x3fd2('0xd4')](_0x12781a[_0x50f0fb][_0x3fd2('0x167')])||_[_0x3fd2('0xd4')](_0x12781a[_0x50f0fb][_0x3fd2('0x167')][_0x3fd2('0x168')])){_0x18b1c8[_0x3fd2('0xc3')](_0x3fd2('0x20c'),_0x2c6fad,_0x12781a[_0x50f0fb]);}else{_0x18b1c8['checkIsBlackList'](_['pick'](_0x12781a[_0x50f0fb],['VoiceQueueId',_0x3fd2('0x20e')]))['then'](_0x18b1c8[_0x3fd2('0x1ee')](_0x2c6fad,_0x12781a[_0x50f0fb]))[_0x3fd2('0xae')](_0x18b1c8['loggerHandler']('[actionOriginate]\x20',_0x2c6fad));}}}})[_0x3fd2('0xae')](loggerGetContactDialer(_0x3fd2('0x213'),_0x2c6fad,_0x30df5c));}};Dialer['prototype'][_0x3fd2('0x86')]=function(_0x24074b){var _0x336bc1=this;if(_0x24074b['dialLimitQueue']>0x0){var _0x453520=_0x24074b[_0x3fd2('0x211')]-_0x24074b['originated']-_0x24074b['talking'];if(_0x453520>0x0){this[_0x3fd2('0x214')](_0x24074b);}else{loggerPredictiveCalls[_0x3fd2('0x7b')](_0x3fd2('0x215'));}}else{this[_0x3fd2('0x214')](_0x24074b);}};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x214')]=function(_0x4433f7){var _0xb70972=this;var _0x44dbef=[];_0x4433f7[_0x3fd2('0x6b')]+=0x1;for(var _0x5a5892 in this['agents']){if(this[_0x3fd2('0x11d')][_0x3fd2('0x8d')](_0x5a5892)){if(this[_0x3fd2('0x11d')][_0x5a5892][_0x3fd2('0x9c')]===_0x3fd2('0x212')&&this[_0x3fd2('0x11d')][_0x5a5892][_0x3fd2('0xa6')]==='reachable'){_0x44dbef['push'](this[_0x3fd2('0x11d')][_0x5a5892]['id']);}}}this[_0x3fd2('0xb7')](_0x4433f7['id'],_0x44dbef,0x1,_0x4433f7['dialOrderByScheduledAt'])[_0x3fd2('0xad')](function(_0x4aed3b){if(!checkContactEmpty(_0x4aed3b)){checkContactLowerLimitOriginate(_0x4433f7,0x1,0x0);_0xb70972['countReScheduled'](_0x4433f7)[_0x3fd2('0xad')](sendMessageReschedule(_0x4433f7))[_0x3fd2('0xae')](loggerCatch(_0x3fd2('0xaf')));}else{_0x4433f7[_0x3fd2('0x40')]=_0x3fd2('0x216');if(_[_0x3fd2('0xd4')](_0x4aed3b[0x0])||_[_0x3fd2('0xd4')](_0x4aed3b[0x0][_0x3fd2('0x167')])||_[_0x3fd2('0xd4')](_0x4aed3b[0x0][_0x3fd2('0x167')][_0x3fd2('0x168')])){_0xb70972['emptyContact'](_0x3fd2('0x20c'),_0x4433f7,_0x4aed3b[0x0]);}else{_0xb70972['checkIsBlackList'](_[_0x3fd2('0xc6')](_0x4aed3b[0x0],[_0x3fd2('0xf1'),'Contact.phone']))[_0x3fd2('0xad')](_0xb70972[_0x3fd2('0x1ee')](_0x4433f7,_0x4aed3b[0x0]))[_0x3fd2('0xae')](_0xb70972[_0x3fd2('0xc2')]('[actionOriginatePredictive]\x20',_0x4433f7));}}})[_0x3fd2('0xae')](loggerGetContactDialer(_0x3fd2('0x217'),_0x4433f7,0x1));emitVoiceQueueSummary(_0x4433f7);};Dialer[_0x3fd2('0x1c')][_0x3fd2('0x1e7')]=function(_0x4684cd,_0x4b2c5c,_0x3a4097,_0x4a79fc,_0x57329e,_0x287448){loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x218'));loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x219'),_0x4684cd);loggerPredictive['info'](_0x3fd2('0x21a'),_0x4b2c5c);loggerPredictive['info'](_0x3fd2('0x21b'),_0x3a4097);loggerPredictive[_0x3fd2('0x7b')]('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',_0x4a79fc);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x21c'),_0x57329e);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x7e'));return new BPromise(function(_0x538992,_0x1c268c){if(_0x4684cd<=0x0||isNaN(_0x4684cd)){return _0x1c268c(msgResponse(_0x3fd2('0x21d'),'Error','m\x20=\x20'+_0x4684cd));}if(_0x3a4097<=0x0||isNaN(_0x3a4097)){return _0x1c268c(msgResponse('[abandonmentRate]',_0x3fd2('0x194'),_0x3fd2('0x21e')+_0x3a4097));}if(_0x4a79fc<=0x0||isNaN(_0x4a79fc)){return _0x1c268c(msgResponse(_0x3fd2('0x21d'),_0x3fd2('0x194'),_0x3fd2('0x21f')+_0x4a79fc));}if(_0x4b2c5c<=0x0||isNaN(_0x4b2c5c)){return _0x1c268c(msgResponse(_0x3fd2('0x21d'),_0x3fd2('0x194'),_0x3fd2('0x220')+_0x4b2c5c));}if(_0x57329e<=0x0||isNaN(_0x57329e)){return _0x1c268c(msgResponse(_0x3fd2('0x21d'),_0x3fd2('0x194'),_0x3fd2('0x221')+_0x57329e));}_0x287448=_0x287448||0x0;var _0x16d3c9=0x1/_0x3a4097;var _0x431f1d=0x0;var _0x222e4d=0x0;var _0x1c07c7=0x0;var _0x22eada=0x0;for(var _0x509f43=0x0;_0x1c07c7<_0x57329e;_0x509f43+=0x1){_0x222e4d=_0x509f43/_0x4b2c5c;_0x431f1d=(_0x4a79fc*_0x222e4d+_0x287448)/_0x16d3c9;_0x1c07c7=erlangb(_0x431f1d,_0x4684cd);_0x22eada=_0x431f1d/_0x4684cd*(0x1-erlangb(_0x431f1d,_0x4684cd));}return _0x538992({'erlangCalls':_0x509f43,'erlangCallToSecond':_0x4b2c5c/_0x509f43,'erlangAbandonmentRate':_0x1c07c7,'erlangBusyFactor':_0x22eada});});};Dialer[_0x3fd2('0x1c')]['busyFactor']=function(_0x6cd48f,_0x3dc9c4,_0x391ba2,_0x27c282,_0x454634,_0x3e2cee){loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x222'));loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x219'),_0x6cd48f);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x21a'),_0x3dc9c4);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x21b'),_0x391ba2);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x223'),_0x27c282);loggerPredictive['info'](_0x3fd2('0x224'),_0x454634);loggerPredictive[_0x3fd2('0x7b')](_0x3fd2('0x7e'));return new BPromise(function(_0x5afe84,_0x1d4889){if(_0x6cd48f<=0x0||isNaN(_0x6cd48f)){return _0x1d4889(msgResponse(_0x3fd2('0x225'),'Error',_0x3fd2('0x226')+_0x6cd48f));}if(_0x391ba2<=0x0||isNaN(_0x391ba2)){return _0x1d4889(msgResponse('[busyFactor]','Error',_0x3fd2('0x21e')+_0x391ba2));}if(_0x27c282<=0x0||isNaN(_0x27c282)){return _0x1d4889(msgResponse(_0x3fd2('0x225'),'Error','p\x20=\x20'+_0x27c282));}if(_0x3dc9c4<=0x0||isNaN(_0x3dc9c4)){return _0x1d4889(msgResponse('[busyFactor]',_0x3fd2('0x194'),_0x3fd2('0x220')+_0x3dc9c4));}if(_0x454634<=0x0||isNaN(_0x454634)){return _0x1d4889(msgResponse(_0x3fd2('0x225'),_0x3fd2('0x194'),_0x3fd2('0x227')+_0x454634));}_0x3e2cee=_0x3e2cee||0x0;var _0x296b48=0x1/_0x391ba2;var _0x51d3f5=0x0;var _0x37e488=0x0;var _0x4adf3a=0x0;var _0x9d0a48=0x0;for(var _0x1e01b5=0x0;_0x9d0a48<_0x454634;_0x1e01b5+=0x1){_0x37e488=_0x1e01b5/_0x3dc9c4;_0x51d3f5=(_0x27c282*_0x37e488+_0x3e2cee)/_0x296b48;_0x4adf3a=erlangb(_0x51d3f5,_0x6cd48f);_0x9d0a48=_0x51d3f5/_0x6cd48f*(0x1-erlangb(_0x51d3f5,_0x6cd48f));}return _0x5afe84({'erlangCalls':_0x1e01b5,'erlangCallToSecond':_0x3dc9c4/_0x1e01b5,'erlangAbandonmentRate':_0x4adf3a,'erlangBusyFactor':_0x9d0a48});});};module[_0x3fd2('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 559418f..42f4c4f 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 _0x3351=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','droptime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0xfff77a,_0x1540be){var _0x311912=function(_0xad891c){while(--_0xad891c){_0xfff77a['push'](_0xfff77a['shift']());}};_0x311912(++_0x1540be);}(_0x3351,0x1f1));var _0x1335=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x3351[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x1335('0x0'));var _=require(_0x1335('0x1'));var moment=require('moment');function getSeconds(_0x360e9f,_0x348850){var _0x24c5e5=moment(_0x360e9f)[_0x1335('0x2')](0x0);var _0x5083ff=moment(_0x348850)[_0x1335('0x2')](0x0);return _0x24c5e5[_0x1335('0x3')](_0x5083ff,_0x1335('0x4'));}function QueueCallerAbandon(_0x3f5e23,_0x29a8c9){this['scheduledat']=_0x3f5e23[_0x1335('0x5')];this[_0x1335('0x6')]=_0x3f5e23[_0x1335('0x6')];this[_0x1335('0x7')]=_0x3f5e23['type']==='outbound'?'queue':_0x3f5e23['type'];this['countbusyretry']=_0x3f5e23['countbusyretry'];this[_0x1335('0x8')]=_0x3f5e23['countcongestionretry'];this[_0x1335('0x9')]=_0x3f5e23['countnoanswerretry'];this[_0x1335('0xa')]=_0x3f5e23[_0x1335('0xb')]+_0x3f5e23['countcongestionretry']+_0x3f5e23['countnoanswerretry']+_0x3f5e23[_0x1335('0xc')]+_0x3f5e23[_0x1335('0xd')]+_0x3f5e23[_0x1335('0xe')]+_0x3f5e23['countmachineretry']+_0x3f5e23[_0x1335('0xf')];this['countnosuchnumberretry']=_0x3f5e23['countnosuchnumberretry'];this[_0x1335('0xd')]=_0x3f5e23[_0x1335('0xd')];this[_0x1335('0xe')]=_0x3f5e23[_0x1335('0xe')];this['countmachineretry']=_0x3f5e23[_0x1335('0x10')];this[_0x1335('0xf')]=_0x3f5e23[_0x1335('0xf')];this[_0x1335('0x11')]=_0x29a8c9[_0x1335('0x11')];this[_0x1335('0x12')]=_0x3f5e23[_0x1335('0x13')];this['calleridnum']=_0x3f5e23['number'];this[_0x1335('0x14')]=_0x3f5e23[_0x1335('0x14')];this[_0x1335('0x15')]=_0x3f5e23['responsetime'];this['droptime']=_0x3f5e23['droptime'];this['endtime']=this[_0x1335('0x16')];this[_0x1335('0x17')]=getSeconds(_0x3f5e23[_0x1335('0x15')],_0x3f5e23[_0x1335('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x3f5e23[_0x1335('0x15')]);this[_0x1335('0x18')]=0x0;this['queue']=_0x29a8c9[_0x1335('0x19')];this[_0x1335('0x1a')]=_0x29a8c9[_0x1335('0x1b')];this[_0x1335('0x1c')]=_0x29a8c9[_0x1335('0x1c')];this[_0x1335('0x1d')]=_0x3f5e23[_0x1335('0x1d')];this[_0x1335('0x1e')]=_0x3f5e23['callbackuniqueid'];this[_0x1335('0x1f')]=_0x3f5e23[_0x1335('0x1f')];this['recallme']=_0x3f5e23[_0x1335('0x20')];this[_0x1335('0x21')]=_0x3f5e23['ContactId'];this['ListId']=_0x3f5e23[_0x1335('0x22')];this[_0x1335('0x23')]=_0x3f5e23['UserId'];this[_0x1335('0x24')]=_0x3f5e23[_0x1335('0x24')];this['CampaignId']=_0x3f5e23[_0x1335('0x25')];this[_0x1335('0x26')]=_0x3f5e23[_0x1335('0x26')]||'';this[_0x1335('0x27')]=_0x3f5e23[_0x1335('0x27')]||'';}module[_0x1335('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xcf3b=['responsetime','droptime','endtime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','number','starttime'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcf3b,0x1d9));var _0xbcf3=function(_0x237f52,_0x149845){_0x237f52=_0x237f52-0x0;var _0x4ec2a5=_0xcf3b[_0x237f52];return _0x4ec2a5;};'use strict';var util=require('util');var _=require(_0xbcf3('0x0'));var moment=require(_0xbcf3('0x1'));function getSeconds(_0x4ea831,_0x399d7b){var _0x5ce719=moment(_0x4ea831)['milliseconds'](0x0);var _0x2fe904=moment(_0x399d7b)[_0xbcf3('0x2')](0x0);return _0x5ce719[_0xbcf3('0x3')](_0x2fe904,'seconds');}function QueueCallerAbandon(_0x2767ef,_0x571b5a){this['scheduledat']=_0x2767ef['scheduledat'];this['type']=_0x2767ef[_0xbcf3('0x4')];this[_0xbcf3('0x5')]=_0x2767ef[_0xbcf3('0x4')]===_0xbcf3('0x6')?_0xbcf3('0x7'):_0x2767ef[_0xbcf3('0x4')];this[_0xbcf3('0x8')]=_0x2767ef[_0xbcf3('0x8')];this[_0xbcf3('0x9')]=_0x2767ef['countcongestionretry'];this[_0xbcf3('0xa')]=_0x2767ef[_0xbcf3('0xa')];this[_0xbcf3('0xb')]=_0x2767ef['countbusyretry']+_0x2767ef[_0xbcf3('0x9')]+_0x2767ef['countnoanswerretry']+_0x2767ef['countnosuchnumberretry']+_0x2767ef['countdropretry']+_0x2767ef[_0xbcf3('0xc')]+_0x2767ef[_0xbcf3('0xd')]+_0x2767ef[_0xbcf3('0xe')];this[_0xbcf3('0xf')]=_0x2767ef[_0xbcf3('0xf')];this[_0xbcf3('0x10')]=_0x2767ef[_0xbcf3('0x10')];this[_0xbcf3('0xc')]=_0x2767ef[_0xbcf3('0xc')];this[_0xbcf3('0xd')]=_0x2767ef[_0xbcf3('0xd')];this[_0xbcf3('0xe')]=_0x2767ef['countagentrejectretry'];this[_0xbcf3('0x11')]=_0x571b5a[_0xbcf3('0x11')];this[_0xbcf3('0x12')]=_0x2767ef['name'];this['calleridnum']=_0x2767ef[_0xbcf3('0x13')];this['starttime']=_0x2767ef[_0xbcf3('0x14')];this[_0xbcf3('0x15')]=_0x2767ef[_0xbcf3('0x15')];this[_0xbcf3('0x16')]=_0x2767ef[_0xbcf3('0x16')];this[_0xbcf3('0x17')]=this[_0xbcf3('0x16')];this[_0xbcf3('0x18')]=getSeconds(_0x2767ef[_0xbcf3('0x15')],_0x2767ef[_0xbcf3('0x14')]);this['holdtime']=getSeconds(this[_0xbcf3('0x16')],_0x2767ef[_0xbcf3('0x15')]);this[_0xbcf3('0x19')]=0x0;this[_0xbcf3('0x7')]=_0x571b5a['queue'];this['membername']=_0x571b5a[_0xbcf3('0x1a')];this[_0xbcf3('0x1b')]=_0x571b5a['reason'];this[_0xbcf3('0x1c')]=_0x2767ef[_0xbcf3('0x1c')];this[_0xbcf3('0x1d')]=_0x2767ef['callbackuniqueid'];this['callbackat']=_0x2767ef[_0xbcf3('0x1e')];this['recallme']=_0x2767ef[_0xbcf3('0x1f')];this[_0xbcf3('0x20')]=_0x2767ef['ContactId'];this[_0xbcf3('0x21')]=_0x2767ef['ListId'];this['UserId']=_0x2767ef['UserId'];this['VoiceQueueId']=_0x2767ef['VoiceQueueId'];this['CampaignId']=_0x2767ef[_0xbcf3('0x22')];this[_0xbcf3('0x23')]=_0x2767ef[_0xbcf3('0x23')]||'';this[_0xbcf3('0x24')]=_0x2767ef[_0xbcf3('0x24')]||'';}module[_0xbcf3('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6e9773b..9f70641 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 _0x0985=['fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x0985,0x13a));var _0x5098=function(_0x15efea,_0x58b10b){_0x15efea=_0x15efea-0x0;var _0x3b9178=_0x0985[_0x15efea];return _0x3b9178;};'use strict';var util=require(_0x5098('0x0'));var _=require(_0x5098('0x1'));var moment=require(_0x5098('0x2'));function Action(_0x1cb0e8,_0x33297f,_0x417a21){this[_0x5098('0x3')]=_0x1cb0e8||undefined;this[_0x5098('0x4')]=util['format'](_0x5098('0x5'),_0x33297f[_0x5098('0x6')],_0x33297f[_0x5098('0x7')]['name'],_0x417a21[_0x5098('0x8')]);this[_0x5098('0x9')]=_0x33297f['localstationid'];this[_0x5098('0xa')]=_0x33297f['headerinfo'];this[_0x5098('0xb')]=_0x417a21[_0x5098('0xb')];this['AttachmentId']=_0x417a21[_0x5098('0xc')];}module[_0x5098('0xd')]=Action; \ No newline at end of file +var _0x7f1e=['tech','name','fax','localstationid','headerinfo','path','AttachmentId','util','lodash','moment','%s/%s/%s'];(function(_0xc3f753,_0xc6e6a4){var _0x195645=function(_0x478c0a){while(--_0x478c0a){_0xc3f753['push'](_0xc3f753['shift']());}};_0x195645(++_0xc6e6a4);}(_0x7f1e,0xa1));var _0xe7f1=function(_0x473407,_0x218f1c){_0x473407=_0x473407-0x0;var _0xab8104=_0x7f1e[_0x473407];return _0xab8104;};'use strict';var util=require(_0xe7f1('0x0'));var _=require(_0xe7f1('0x1'));var moment=require(_0xe7f1('0x2'));function Action(_0x55f5fb,_0x4faff9,_0x55be70){this['uniqueid']=_0x55f5fb||undefined;this['channel']=util['format'](_0xe7f1('0x3'),_0x4faff9[_0xe7f1('0x4')],_0x4faff9['Trunk'][_0xe7f1('0x5')],_0x55be70[_0xe7f1('0x6')]);this[_0xe7f1('0x7')]=_0x4faff9['localstationid'];this['headerinfo']=_0x4faff9[_0xe7f1('0x8')];this[_0xe7f1('0x9')]=_0x55be70[_0xe7f1('0x9')];this[_0xe7f1('0xa')]=_0x55be70[_0xe7f1('0xa')];}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 f8e11df..10ce61f 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 _0xaf73=['lodash','bluebird','uuid','path','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','.pdf','application/pdf','then','parse','error','stringify','catch','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','message','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaf73,0x144));var _0x3af7=function(_0x3fd70a,_0x12bd42){_0x3fd70a=_0x3fd70a-0x0;var _0x198bdb=_0xaf73[_0x3fd70a];return _0x198bdb;};'use strict';var util=require('util');var _=require(_0x3af7('0x0'));var BPromise=require(_0x3af7('0x1'));var uuid=require(_0x3af7('0x2'));var moment=require('moment');var path=require(_0x3af7('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x3af7('0x4'));var logger=require('../../../config/logger')(_0x3af7('0x5'));var ami=require(_0x3af7('0x6'));var rpcDb=require(_0x3af7('0x7'));var Channel=require('./channel');var ut=require(_0x3af7('0x8'));var Action=require(_0x3af7('0x9'));var faxAccount=require(_0x3af7('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x3af7('0xb'));function Fax(_0x3c5059){this[_0x3af7('0xc')]={};this[_0x3af7('0xd')]=_0x3c5059[_0x3af7('0xd')];this[_0x3af7('0xe')]=_0x3c5059[_0x3af7('0xe')];this[_0x3af7('0xf')]={};ami['on'](_0x3af7('0x10'),this[_0x3af7('0x11')][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x13'),this[_0x3af7('0x14')][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x15'),this['syncNewState'][_0x3af7('0x12')](this));ami['on']('newexten',this[_0x3af7('0x16')][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x17'),this['syncFaxStatus'][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x18'),this[_0x3af7('0x19')][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x1a'),this[_0x3af7('0x1b')][_0x3af7('0x12')](this));ami['on'](_0x3af7('0x1c'),this[_0x3af7('0x1d')][_0x3af7('0x12')](this));}Fax[_0x3af7('0x1e')]['syncNewchannel']=function(_0x29e0f4){if(_0x29e0f4[_0x3af7('0x1f')]==='from-voip-provider'){for(var _0x25e107 in this[_0x3af7('0xd')]){if(this['faxAccounts'][_0x3af7('0x20')](_0x25e107)){if(_0x29e0f4[_0x3af7('0x21')]===this[_0x3af7('0xd')][_0x25e107][_0x3af7('0x22')]){this['channels'][_0x29e0f4[_0x3af7('0x23')]]={};this['channels'][_0x29e0f4[_0x3af7('0x23')]]['channel']=_0x29e0f4[_0x3af7('0x24')];this[_0x3af7('0xc')][_0x29e0f4[_0x3af7('0x23')]]['id']=this['faxAccounts'][_0x25e107]['id'];this['channels'][_0x29e0f4['uniqueid']][_0x3af7('0x25')]=this[_0x3af7('0xd')][_0x25e107][_0x3af7('0x25')];logger['info'](_0x29e0f4[_0x3af7('0x23')],_0x3af7('0x26'));}}}}if(this[_0x3af7('0xf')][_0x29e0f4[_0x3af7('0x23')]]){this[_0x3af7('0xc')][_0x29e0f4[_0x3af7('0x23')]]={};this[_0x3af7('0xc')][_0x29e0f4[_0x3af7('0x23')]][_0x3af7('0x24')]=_0x29e0f4[_0x3af7('0x24')];logger[_0x3af7('0x27')](_0x29e0f4[_0x3af7('0x23')],_0x3af7('0x26'));}};Fax[_0x3af7('0x1e')]['syncVarSet']=function(_0x51da14){if(this[_0x3af7('0xc')][_0x51da14[_0x3af7('0x23')]]){for(var _0x120426 in _0x51da14['variable']){if(_0x51da14[_0x3af7('0x28')][_0x3af7('0x20')](_0x120426)){this['channels'][_0x51da14['uniqueid']][_0x120426]=_0x51da14['value'];}}}};Fax[_0x3af7('0x1e')][_0x3af7('0x29')]=function(_0x4349c9){if(this[_0x3af7('0xc')][_0x4349c9[_0x3af7('0x23')]]){this[_0x3af7('0xc')][_0x4349c9['uniqueid']][_0x3af7('0x2a')]=_0x4349c9[_0x3af7('0x2a')];this[_0x3af7('0xc')][_0x4349c9['uniqueid']][_0x3af7('0x2b')]=_0x4349c9[_0x3af7('0x2b')];}};Fax['prototype'][_0x3af7('0x16')]=function(_0x117559){if(this[_0x3af7('0xc')][_0x117559['uniqueid']]){for(var _0x35ed68 in _0x117559[_0x3af7('0x28')]){if(_0x117559['variable'][_0x3af7('0x20')](_0x35ed68)){this[_0x3af7('0xc')][_0x117559[_0x3af7('0x23')]][_0x35ed68]=_0x117559[_0x3af7('0x2c')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x2bd8da){if(this['channels'][_0x2bd8da[_0x3af7('0x23')]]){this[_0x3af7('0xc')][_0x2bd8da[_0x3af7('0x23')]]['operation']=_0x2bd8da[_0x3af7('0x2d')];this[_0x3af7('0xc')][_0x2bd8da[_0x3af7('0x23')]][_0x3af7('0x2e')]=_0x2bd8da[_0x3af7('0x2e')];this[_0x3af7('0xc')][_0x2bd8da[_0x3af7('0x23')]]['localstationid']=_0x2bd8da[_0x3af7('0x22')];this[_0x3af7('0xc')][_0x2bd8da[_0x3af7('0x23')]][_0x3af7('0x2f')]=_0x2bd8da['filename'];logger['info'](_0x2bd8da[_0x3af7('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x3af7('0x1e')][_0x3af7('0x19')]=function(_0x9e167a){var _0x1488e9=this;if(this[_0x3af7('0xc')][_0x9e167a['uniqueid']]){var _0x57c440=this[_0x3af7('0xc')][_0x9e167a[_0x3af7('0x23')]]['id'];this[_0x3af7('0xc')][_0x9e167a[_0x3af7('0x23')]][_0x3af7('0x30')]=_0x9e167a['remotestationid'];this[_0x3af7('0xc')][_0x9e167a[_0x3af7('0x23')]][_0x3af7('0x31')]=_0x9e167a[_0x3af7('0x31')];this[_0x3af7('0xc')][_0x9e167a[_0x3af7('0x23')]]['localstationid']=_0x9e167a['localstationid'];this['channels'][_0x9e167a[_0x3af7('0x23')]][_0x3af7('0x32')]=_0x9e167a[_0x3af7('0x32')];this['channels'][_0x9e167a['uniqueid']][_0x3af7('0x33')]=_0x9e167a[_0x3af7('0x33')];this[_0x3af7('0xc')][_0x9e167a[_0x3af7('0x23')]]['filename']=_0x9e167a[_0x3af7('0x2f')];this[_0x3af7('0xc')][_0x9e167a['uniqueid']]['calleridnum']=_0x9e167a[_0x3af7('0x34')];if(this[_0x3af7('0xc')][_0x9e167a['uniqueid']][_0x3af7('0x31')]>0x0){tiff2pdf(_0x9e167a[_0x3af7('0x2f')],_0x3af7('0x35'),function(_0x1ded8b){logger[_0x3af7('0x27')](_0x9e167a[_0x3af7('0x23')],_0x3af7('0x36'),_0x1ded8b['message']);attachment[_0x3af7('0x37')]({'name':path['parse'](_0x9e167a[_0x3af7('0x2f')])[_0x3af7('0x25')],'basename':path['parse'](_0x9e167a[_0x3af7('0x2f')])[_0x3af7('0x25')]+_0x3af7('0x38'),'type':_0x3af7('0x39')})[_0x3af7('0x3a')](function(_0x3ab0bf){faxAccount['notify'](_0x57c440,{'from':_0x9e167a[_0x3af7('0x34')],'mapKey':_0x3af7('0x5'),'body':path[_0x3af7('0x3b')](_0x9e167a[_0x3af7('0x2f')])['name']+'.pdf','AttachmentId':_0x3ab0bf['id']})['catch'](function(_0x3b59f7){logger[_0x3af7('0x3c')](_0x9e167a['uniqueid'],'\x20notify\x20',JSON[_0x3af7('0x3d')](_0x3b59f7));});})[_0x3af7('0x3e')](function(_0x504210){logger[_0x3af7('0x3c')](_0x9e167a[_0x3af7('0x23')],'\x20receiveFax\x20',JSON[_0x3af7('0x3d')](_0x504210));});});}logger[_0x3af7('0x27')](_0x9e167a[_0x3af7('0x23')],_0x3af7('0x3f'));}};Fax['prototype'][_0x3af7('0x1d')]=function(_0x8e7f3a){if(this[_0x3af7('0xf')][_0x8e7f3a[_0x3af7('0x23')]]){_['merge'](this[_0x3af7('0xc')][_0x8e7f3a['uniqueid']],_[_0x3af7('0x40')](_0x8e7f3a,[_0x3af7('0x41'),_0x3af7('0x42')]));}};function updateStatus(_0x3b42b3){if(_0x3b42b3[_0x3af7('0x43')]){faxMessage[_0x3af7('0x44')](_0x3b42b3[_0x3af7('0x43')],{'failMessage':_0x3af7('0x45')})[_0x3af7('0x3a')](function(_0x8b996b){ut[_0x3af7('0x46')](_0x3af7('0x47'),_0x8b996b);})['catch'](function(_0x5dc496){ut[_0x3af7('0x46')](_0x3af7('0x48'),_0x5dc496);});}else{ut[_0x3af7('0x46')](_0x3af7('0x49'));}}Fax[_0x3af7('0x1e')][_0x3af7('0x4a')]=function(_0x530d32,_0x363b7d,_0x110760){var _0x2a178b=this;var _0x566220={};if(_0x363b7d){_0x566220={'read':_0x363b7d};}else{_0x566220={'failMessage':_0x110760};}if(this[_0x3af7('0xf')][_0x530d32][_0x3af7('0x43')]){faxMessage[_0x3af7('0x44')](this[_0x3af7('0xf')][_0x530d32][_0x3af7('0x43')],_0x566220)[_0x3af7('0x3a')](function(_0x429391){ut[_0x3af7('0x46')](_0x3af7('0x4b'),_0x429391);})[_0x3af7('0x3e')](function(_0x578e3f){ut[_0x3af7('0x46')]('[Fax][Message][NoUpdate1]',_0x578e3f);})[_0x3af7('0x4c')](function(){delete _0x2a178b[_0x3af7('0xc')][_0x530d32];delete _0x2a178b[_0x3af7('0xf')][_0x530d32];});}else{ut[_0x3af7('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x3af7('0xc')][_0x530d32];delete this['actions'][_0x530d32];}};Fax[_0x3af7('0x1e')][_0x3af7('0x1b')]=function(_0x2f74ce){var _0x144ffb=this;if(this['channels'][_0x2f74ce[_0x3af7('0x23')]]){if(this[_0x3af7('0xf')][_0x2f74ce['uniqueid']]){this['channels'][_0x2f74ce['uniqueid']]['id']=this[_0x3af7('0xf')][_0x2f74ce[_0x3af7('0x23')]]['id'];this[_0x3af7('0xc')][_0x2f74ce[_0x3af7('0x23')]][_0x3af7('0x25')]=this[_0x3af7('0xf')][_0x2f74ce[_0x3af7('0x23')]]['name'];}logger[_0x3af7('0x27')](_0x2f74ce['uniqueid'],this[_0x3af7('0xf')][_0x2f74ce[_0x3af7('0x23')]]?_0x3af7('0x4d'):_0x3af7('0x4e'),JSON[_0x3af7('0x3d')](this['channels'][_0x2f74ce[_0x3af7('0x23')]]));if(this[_0x3af7('0xf')][_0x2f74ce[_0x3af7('0x23')]]){if(this['channels'][_0x2f74ce[_0x3af7('0x23')]][_0x3af7('0x4f')]>0x0&&this[_0x3af7('0xc')][_0x2f74ce[_0x3af7('0x23')]][_0x3af7('0x17')]==='SUCCESS'){this[_0x3af7('0x4a')](_0x2f74ce[_0x3af7('0x23')],!![]);}else{this['updateStatus'](_0x2f74ce[_0x3af7('0x23')],![],this[_0x3af7('0xc')][_0x2f74ce[_0x3af7('0x23')]][_0x3af7('0x50')]?_0x3af7('0x51')+this[_0x3af7('0xc')][_0x2f74ce[_0x3af7('0x23')]][_0x3af7('0x50')]:_0x3af7('0x52'));}}}};Fax[_0x3af7('0x1e')]['send']=function(_0x6a94f){var _0x16e68c=this;return new BPromise(function(_0x39fe2f,_0xf2fd52){_0x16e68c[_0x3af7('0x53')](_0x6a94f,_0x16e68c[_0x3af7('0xd')][_0x6a94f[_0x3af7('0x54')]])[_0x3af7('0x3a')](function(_0x26ff2d){ut[_0x3af7('0x46')]('[Fax][execOriginate][success]',_0x26ff2d);_0x39fe2f(ut[_0x3af7('0x55')]('Fax\x20received'));})[_0x3af7('0x3e')](function(_0x58cb8c){ut[_0x3af7('0x46')](_0x3af7('0x56'),_0x58cb8c);updateStatus(_0x6a94f);_0xf2fd52(ut[_0x3af7('0x55')]('Fax\x20failed'));});});};Fax[_0x3af7('0x1e')][_0x3af7('0x57')]=function(_0x5a6718){var _0x5a1a2e=this;return new BPromise(function(_0x501221,_0x50f5b1){var _0x1a7567=_0x5a1a2e[_0x3af7('0x58')](_0x5a1a2e[_0x3af7('0xd')][_0x5a6718[_0x3af7('0x54')]][_0x3af7('0x59')],_0x5a6718);if(_0x1a7567['isValid']){_0x501221(ut[_0x3af7('0x55')]('Trunk\x20Reachable'));}else{_0x50f5b1(ut[_0x3af7('0x55')](_0x1a7567[_0x3af7('0x55')]));}});};function originate(_0x1b7a7a,_0x1d21c7,_0x459aa6){return new BPromise(function(_0x15c81d,_0x1085cd){if(_0x459aa6){var _0x4f4b9e=util[_0x3af7('0x5a')]('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[_0x3af7('0x3b')](_0x1b7a7a['path'])[_0x3af7('0x25')],_0x1b7a7a['path']);gs['execute'](_0x4f4b9e)[_0x3af7('0x3a')](function(){_0x1b7a7a[_0x3af7('0x3')]=util[_0x3af7('0x5a')](_0x3af7('0x5b'),path['parse'](_0x1b7a7a['path'])[_0x3af7('0x5c')],path['parse'](_0x1b7a7a[_0x3af7('0x3')])['name']);_0x1d21c7['XMF-PATH']=_0x1b7a7a[_0x3af7('0x3')];ut[_0x3af7('0x46')](_0x3af7('0x5d'),'');ami['Action'](ut[_0x3af7('0x5e')](_0x1b7a7a,_0x1d21c7))[_0x3af7('0x3a')](function(_0xa3ee5e){_0x15c81d(_0xa3ee5e);})[_0x3af7('0x3e')](function(_0x599bba){_0x1085cd(_0x599bba);});})[_0x3af7('0x3e')](function(_0x5eab41){_0x1085cd(_0x5eab41);});}else{ami[_0x3af7('0x5f')](ut['variablesAction'](_0x1b7a7a,_0x1d21c7))[_0x3af7('0x3a')](function(_0x5101a7){_0x15c81d(_0x5101a7);})[_0x3af7('0x3e')](function(_0x165dc5){_0x1085cd(_0x165dc5);});}});}Fax[_0x3af7('0x1e')][_0x3af7('0x53')]=function(_0x4c542f,_0x425f17){var _0xde59f6=this;return new BPromise(function(_0x5a1a91,_0x1f1de1){var _0x3c8bdd=uuid['v4']();var _0xd54560=ut[_0x3af7('0x60')](_0x4c542f,_0x425f17);_0xde59f6[_0x3af7('0xf')][_0x3c8bdd]=new Action(_0x3c8bdd,_0x425f17,_0x4c542f);var _0x2a0c11=_0xde59f6['actions'][_0x3c8bdd];if(path[_0x3af7('0x3b')](_0x4c542f[_0x3af7('0x3')])[_0x3af7('0x61')]===_0x3af7('0x38')){originate(_0x2a0c11,_0xd54560,!![])[_0x3af7('0x3a')](function(_0x53110c){_0x5a1a91(_0x53110c);})['catch'](function(_0x11c08a){_0x1f1de1(_0x11c08a);});}else{originate(_0x2a0c11,_0xd54560,![])['then'](function(_0x56aded){_0x5a1a91(_0x56aded);})[_0x3af7('0x3e')](function(_0x12c2f5){_0x1f1de1(_0x12c2f5);});}});};Fax[_0x3af7('0x1e')][_0x3af7('0x62')]=function(_0x38b83d){return!_[_0x3af7('0x63')](_0x38b83d)&&!_[_0x3af7('0x63')](_0x38b83d[_0x3af7('0x25')])&&!_['isNil'](_0x38b83d[_0x3af7('0x64')])&&_0x38b83d['active']&&!_[_0x3af7('0x63')](this[_0x3af7('0xe')][util[_0x3af7('0x5a')](_0x3af7('0x65'),_0x38b83d[_0x3af7('0x25')])])&&!_[_0x3af7('0x63')](this[_0x3af7('0xe')][util['format'](_0x3af7('0x65'),_0x38b83d['name'])][_0x3af7('0x2e')])&&(this['trunks'][util[_0x3af7('0x5a')](_0x3af7('0x65'),_0x38b83d['name'])][_0x3af7('0x2e')]==='reachable'||this['trunks'][util['format'](_0x3af7('0x65'),_0x38b83d[_0x3af7('0x25')])][_0x3af7('0x2e')]===_0x3af7('0x66'));};Fax[_0x3af7('0x1e')]['checkTrunk']=function(_0x59943a,_0x372e6f){if(!this[_0x3af7('0x62')](_0x59943a)){ut[_0x3af7('0x46')](_0x3af7('0x67'),_[_0x3af7('0x63')](_0x59943a)?'':_0x59943a[_0x3af7('0x25')]+_0x3af7('0x68'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x372e6f[_0x3af7('0x5')])){ut[_0x3af7('0x46')](_0x3af7('0x69'),JSON[_0x3af7('0x3d')](_0x372e6f));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3af7('0x63')](_0x372e6f['path'])){ut[_0x3af7('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x3af7('0x3d')](_0x372e6f));return{'isValid':![],'message':_0x3af7('0x6a')};}return{'isValid':!![],'message':_0x3af7('0x6b')};};module['exports']=Fax; \ No newline at end of file +var _0x3dde=['variablesAction','addVariables','ext','isTrunkReachable','active','SIP/%s','isNil','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','Action'];(function(_0x475ea4,_0x26ed37){var _0x539188=function(_0xc68bbe){while(--_0xc68bbe){_0x475ea4['push'](_0x475ea4['shift']());}};_0x539188(++_0x26ed37);}(_0x3dde,0x7f));var _0xe3dd=function(_0x40c760,_0x156f78){_0x40c760=_0x40c760-0x0;var _0x3fa39a=_0x3dde[_0x40c760];return _0x3fa39a;};'use strict';var util=require('util');var _=require(_0xe3dd('0x0'));var BPromise=require('bluebird');var uuid=require(_0xe3dd('0x1'));var moment=require(_0xe3dd('0x2'));var path=require(_0xe3dd('0x3'));var tiff2pdf=require(_0xe3dd('0x4'));var gs=require(_0xe3dd('0x5'));var logger=require(_0xe3dd('0x6'))(_0xe3dd('0x7'));var ami=require('../ami');var rpcDb=require(_0xe3dd('0x8'));var Channel=require(_0xe3dd('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xe3dd('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x2e5c2f){this['channels']={};this[_0xe3dd('0xb')]=_0x2e5c2f[_0xe3dd('0xb')];this[_0xe3dd('0xc')]=_0x2e5c2f['trunks'];this[_0xe3dd('0xd')]={};ami['on'](_0xe3dd('0xe'),this[_0xe3dd('0xf')][_0xe3dd('0x10')](this));ami['on'](_0xe3dd('0x11'),this['syncVarSet'][_0xe3dd('0x10')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on'](_0xe3dd('0x12'),this[_0xe3dd('0x13')][_0xe3dd('0x10')](this));ami['on']('faxstatus',this[_0xe3dd('0x14')][_0xe3dd('0x10')](this));ami['on']('receivefax',this[_0xe3dd('0x15')][_0xe3dd('0x10')](this));ami['on'](_0xe3dd('0x16'),this[_0xe3dd('0x17')][_0xe3dd('0x10')](this));ami['on'](_0xe3dd('0x18'),this[_0xe3dd('0x19')][_0xe3dd('0x10')](this));}Fax[_0xe3dd('0x1a')][_0xe3dd('0xf')]=function(_0x4659cd){if(_0x4659cd[_0xe3dd('0x1b')]===_0xe3dd('0x1c')){for(var _0x126139 in this[_0xe3dd('0xb')]){if(this[_0xe3dd('0xb')][_0xe3dd('0x1d')](_0x126139)){if(_0x4659cd[_0xe3dd('0x1e')]===this[_0xe3dd('0xb')][_0x126139]['localstationid']){this[_0xe3dd('0x1f')][_0x4659cd[_0xe3dd('0x20')]]={};this[_0xe3dd('0x1f')][_0x4659cd[_0xe3dd('0x20')]][_0xe3dd('0x21')]=_0x4659cd[_0xe3dd('0x21')];this[_0xe3dd('0x1f')][_0x4659cd['uniqueid']]['id']=this[_0xe3dd('0xb')][_0x126139]['id'];this['channels'][_0x4659cd[_0xe3dd('0x20')]]['name']=this[_0xe3dd('0xb')][_0x126139][_0xe3dd('0x22')];logger['info'](_0x4659cd[_0xe3dd('0x20')],_0xe3dd('0x23'));}}}}if(this[_0xe3dd('0xd')][_0x4659cd[_0xe3dd('0x20')]]){this[_0xe3dd('0x1f')][_0x4659cd[_0xe3dd('0x20')]]={};this[_0xe3dd('0x1f')][_0x4659cd[_0xe3dd('0x20')]][_0xe3dd('0x21')]=_0x4659cd[_0xe3dd('0x21')];logger[_0xe3dd('0x24')](_0x4659cd[_0xe3dd('0x20')],_0xe3dd('0x23'));}};Fax[_0xe3dd('0x1a')][_0xe3dd('0x25')]=function(_0x4794fe){if(this[_0xe3dd('0x1f')][_0x4794fe['uniqueid']]){for(var _0x5231ea in _0x4794fe[_0xe3dd('0x26')]){if(_0x4794fe[_0xe3dd('0x26')]['hasOwnProperty'](_0x5231ea)){this[_0xe3dd('0x1f')][_0x4794fe[_0xe3dd('0x20')]][_0x5231ea]=_0x4794fe[_0xe3dd('0x27')];}}}};Fax[_0xe3dd('0x1a')][_0xe3dd('0x28')]=function(_0x32e52e){if(this['channels'][_0x32e52e['uniqueid']]){this[_0xe3dd('0x1f')][_0x32e52e[_0xe3dd('0x20')]][_0xe3dd('0x29')]=_0x32e52e['channelstate'];this['channels'][_0x32e52e[_0xe3dd('0x20')]][_0xe3dd('0x2a')]=_0x32e52e['channelstatedesc'];}};Fax[_0xe3dd('0x1a')][_0xe3dd('0x13')]=function(_0x1c135a){if(this[_0xe3dd('0x1f')][_0x1c135a[_0xe3dd('0x20')]]){for(var _0x3953c4 in _0x1c135a[_0xe3dd('0x26')]){if(_0x1c135a['variable'][_0xe3dd('0x1d')](_0x3953c4)){this[_0xe3dd('0x1f')][_0x1c135a[_0xe3dd('0x20')]][_0x3953c4]=_0x1c135a['value'];}}}};Fax[_0xe3dd('0x1a')]['syncFaxStatus']=function(_0x289f9e){if(this[_0xe3dd('0x1f')][_0x289f9e['uniqueid']]){this['channels'][_0x289f9e[_0xe3dd('0x20')]][_0xe3dd('0x2b')]=_0x289f9e[_0xe3dd('0x2b')];this['channels'][_0x289f9e[_0xe3dd('0x20')]][_0xe3dd('0x2c')]=_0x289f9e['status'];this[_0xe3dd('0x1f')][_0x289f9e[_0xe3dd('0x20')]][_0xe3dd('0x2d')]=_0x289f9e['localstationid'];this['channels'][_0x289f9e[_0xe3dd('0x20')]][_0xe3dd('0x2e')]=_0x289f9e['filename'];logger[_0xe3dd('0x24')](_0x289f9e[_0xe3dd('0x20')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xe3dd('0x15')]=function(_0x2d0000){var _0x5ec4bf=this;if(this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]]){var _0x50e024=this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]]['id'];this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x2f')]=_0x2d0000[_0xe3dd('0x2f')];this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x30')]=_0x2d0000[_0xe3dd('0x30')];this['channels'][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x2d')]=_0x2d0000[_0xe3dd('0x2d')];this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x31')]=_0x2d0000['resolution'];this[_0xe3dd('0x1f')][_0x2d0000['uniqueid']]['transferrate']=_0x2d0000[_0xe3dd('0x32')];this['channels'][_0x2d0000['uniqueid']][_0xe3dd('0x2e')]=_0x2d0000[_0xe3dd('0x2e')];this['channels'][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x33')]=_0x2d0000[_0xe3dd('0x33')];if(this[_0xe3dd('0x1f')][_0x2d0000[_0xe3dd('0x20')]][_0xe3dd('0x30')]>0x0){tiff2pdf(_0x2d0000[_0xe3dd('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x4e2159){logger[_0xe3dd('0x24')](_0x2d0000[_0xe3dd('0x20')],_0xe3dd('0x34'),_0x4e2159['message']);attachment['create']({'name':path[_0xe3dd('0x35')](_0x2d0000[_0xe3dd('0x2e')])[_0xe3dd('0x22')],'basename':path[_0xe3dd('0x35')](_0x2d0000[_0xe3dd('0x2e')])[_0xe3dd('0x22')]+_0xe3dd('0x36'),'type':_0xe3dd('0x37')})[_0xe3dd('0x38')](function(_0x2a87ac){faxAccount[_0xe3dd('0x39')](_0x50e024,{'from':_0x2d0000[_0xe3dd('0x33')],'mapKey':'fax','body':path['parse'](_0x2d0000['filename'])[_0xe3dd('0x22')]+'.pdf','AttachmentId':_0x2a87ac['id']})[_0xe3dd('0x3a')](function(_0x12e795){logger[_0xe3dd('0x3b')](_0x2d0000[_0xe3dd('0x20')],_0xe3dd('0x3c'),JSON[_0xe3dd('0x3d')](_0x12e795));});})[_0xe3dd('0x3a')](function(_0x9775e4){logger[_0xe3dd('0x3b')](_0x2d0000[_0xe3dd('0x20')],_0xe3dd('0x3e'),JSON[_0xe3dd('0x3d')](_0x9775e4));});});}logger['info'](_0x2d0000['uniqueid'],_0xe3dd('0x3e'));}};Fax[_0xe3dd('0x1a')]['syncOriginateResponse']=function(_0x49d72e){if(this[_0xe3dd('0xd')][_0x49d72e[_0xe3dd('0x20')]]){_[_0xe3dd('0x3f')](this[_0xe3dd('0x1f')][_0x49d72e[_0xe3dd('0x20')]],_[_0xe3dd('0x40')](_0x49d72e,[_0xe3dd('0x41'),_0xe3dd('0x42')]));}};function updateStatus(_0x13bea4){if(_0x13bea4[_0xe3dd('0x43')]){faxMessage[_0xe3dd('0x44')](_0x13bea4[_0xe3dd('0x43')],{'failMessage':_0xe3dd('0x45')})[_0xe3dd('0x38')](function(_0x28b1a4){ut[_0xe3dd('0x46')](_0xe3dd('0x47'),_0x28b1a4);})['catch'](function(_0x278a9d){ut[_0xe3dd('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x278a9d);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xe3dd('0x1a')][_0xe3dd('0x48')]=function(_0x2c323a,_0x8a8d74,_0x507c11){var _0x5cff64=this;var _0x4bb700={};if(_0x8a8d74){_0x4bb700={'read':_0x8a8d74};}else{_0x4bb700={'failMessage':_0x507c11};}if(this[_0xe3dd('0xd')][_0x2c323a][_0xe3dd('0x43')]){faxMessage['update'](this[_0xe3dd('0xd')][_0x2c323a][_0xe3dd('0x43')],_0x4bb700)['then'](function(_0x14bb13){ut[_0xe3dd('0x46')]('[Fax][Message][Updated]',_0x14bb13);})[_0xe3dd('0x3a')](function(_0x58d6ec){ut[_0xe3dd('0x46')](_0xe3dd('0x49'),_0x58d6ec);})[_0xe3dd('0x4a')](function(){delete _0x5cff64[_0xe3dd('0x1f')][_0x2c323a];delete _0x5cff64[_0xe3dd('0xd')][_0x2c323a];});}else{ut[_0xe3dd('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0xe3dd('0x1f')][_0x2c323a];delete this[_0xe3dd('0xd')][_0x2c323a];}};Fax[_0xe3dd('0x1a')][_0xe3dd('0x17')]=function(_0x2b702d){var _0x5126b3=this;if(this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]]){if(this[_0xe3dd('0xd')][_0x2b702d[_0xe3dd('0x20')]]){this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]]['id']=this[_0xe3dd('0xd')][_0x2b702d['uniqueid']]['id'];this[_0xe3dd('0x1f')][_0x2b702d['uniqueid']][_0xe3dd('0x22')]=this[_0xe3dd('0xd')][_0x2b702d[_0xe3dd('0x20')]]['name'];}logger[_0xe3dd('0x24')](_0x2b702d[_0xe3dd('0x20')],this[_0xe3dd('0xd')][_0x2b702d['uniqueid']]?_0xe3dd('0x4b'):_0xe3dd('0x4c'),JSON[_0xe3dd('0x3d')](this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]]));if(this[_0xe3dd('0xd')][_0x2b702d['uniqueid']]){if(this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]][_0xe3dd('0x4d')]>0x0&&this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]][_0xe3dd('0x4e')]==='SUCCESS'){this[_0xe3dd('0x48')](_0x2b702d[_0xe3dd('0x20')],!![]);}else{this[_0xe3dd('0x48')](_0x2b702d[_0xe3dd('0x20')],![],this[_0xe3dd('0x1f')][_0x2b702d[_0xe3dd('0x20')]][_0xe3dd('0x4f')]?_0xe3dd('0x50')+this[_0xe3dd('0x1f')][_0x2b702d['uniqueid']][_0xe3dd('0x4f')]:'SENDING\x20FAILED');}}}};Fax[_0xe3dd('0x1a')][_0xe3dd('0x51')]=function(_0x3d95c5){var _0x590191=this;return new BPromise(function(_0x4bf664,_0x50af7b){_0x590191[_0xe3dd('0x52')](_0x3d95c5,_0x590191[_0xe3dd('0xb')][_0x3d95c5[_0xe3dd('0x53')]])['then'](function(_0x2ab4fd){ut[_0xe3dd('0x46')](_0xe3dd('0x54'),_0x2ab4fd);_0x4bf664(ut[_0xe3dd('0x55')]('Fax\x20received'));})[_0xe3dd('0x3a')](function(_0x4c56d2){ut['logger'](_0xe3dd('0x56'),_0x4c56d2);updateStatus(_0x3d95c5);_0x50af7b(ut[_0xe3dd('0x55')]('Fax\x20failed'));});});};Fax[_0xe3dd('0x1a')][_0xe3dd('0x57')]=function(_0x3a76f7){var _0x355923=this;return new BPromise(function(_0x5eec61,_0x354614){var _0x299b46=_0x355923[_0xe3dd('0x58')](_0x355923[_0xe3dd('0xb')][_0x3a76f7[_0xe3dd('0x53')]][_0xe3dd('0x59')],_0x3a76f7);if(_0x299b46[_0xe3dd('0x5a')]){_0x5eec61(ut[_0xe3dd('0x55')](_0xe3dd('0x5b')));}else{_0x354614(ut['message'](_0x299b46[_0xe3dd('0x55')]));}});};function originate(_0x5aecc1,_0x3e82b8,_0x2d3316){return new BPromise(function(_0x5a5c7b,_0x2dbe1b){if(_0x2d3316){var _0x435338=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xe3dd('0x35')](_0x5aecc1[_0xe3dd('0x3')])[_0xe3dd('0x22')],_0x5aecc1[_0xe3dd('0x3')]);gs[_0xe3dd('0x5c')](_0x435338)[_0xe3dd('0x38')](function(){_0x5aecc1['path']=util[_0xe3dd('0x5d')](_0xe3dd('0x5e'),path[_0xe3dd('0x35')](_0x5aecc1[_0xe3dd('0x3')])[_0xe3dd('0x5f')],path[_0xe3dd('0x35')](_0x5aecc1[_0xe3dd('0x3')])[_0xe3dd('0x22')]);_0x3e82b8['XMF-PATH']=_0x5aecc1['path'];ut[_0xe3dd('0x46')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x5aecc1,_0x3e82b8))[_0xe3dd('0x38')](function(_0x4f5433){_0x5a5c7b(_0x4f5433);})['catch'](function(_0x346957){_0x2dbe1b(_0x346957);});})[_0xe3dd('0x3a')](function(_0x298f8d){_0x2dbe1b(_0x298f8d);});}else{ami[_0xe3dd('0x60')](ut[_0xe3dd('0x61')](_0x5aecc1,_0x3e82b8))['then'](function(_0x25f0db){_0x5a5c7b(_0x25f0db);})['catch'](function(_0x2cabcb){_0x2dbe1b(_0x2cabcb);});}});}Fax[_0xe3dd('0x1a')][_0xe3dd('0x52')]=function(_0x3585fb,_0x55a18b){var _0x5d92d9=this;return new BPromise(function(_0x5bb65e,_0x428d04){var _0x3a5b65=uuid['v4']();var _0x1e13b5=ut[_0xe3dd('0x62')](_0x3585fb,_0x55a18b);_0x5d92d9[_0xe3dd('0xd')][_0x3a5b65]=new Action(_0x3a5b65,_0x55a18b,_0x3585fb);var _0xdebaf=_0x5d92d9[_0xe3dd('0xd')][_0x3a5b65];if(path[_0xe3dd('0x35')](_0x3585fb[_0xe3dd('0x3')])[_0xe3dd('0x63')]===_0xe3dd('0x36')){originate(_0xdebaf,_0x1e13b5,!![])['then'](function(_0x27028f){_0x5bb65e(_0x27028f);})[_0xe3dd('0x3a')](function(_0x3f8bc8){_0x428d04(_0x3f8bc8);});}else{originate(_0xdebaf,_0x1e13b5,![])['then'](function(_0x5afa02){_0x5bb65e(_0x5afa02);})[_0xe3dd('0x3a')](function(_0x4ecf0c){_0x428d04(_0x4ecf0c);});}});};Fax[_0xe3dd('0x1a')][_0xe3dd('0x64')]=function(_0x523ea8){return!_['isNil'](_0x523ea8)&&!_['isNil'](_0x523ea8[_0xe3dd('0x22')])&&!_['isNil'](_0x523ea8['active'])&&_0x523ea8[_0xe3dd('0x65')]&&!_['isNil'](this[_0xe3dd('0xc')][util[_0xe3dd('0x5d')](_0xe3dd('0x66'),_0x523ea8[_0xe3dd('0x22')])])&&!_[_0xe3dd('0x67')](this[_0xe3dd('0xc')][util['format'](_0xe3dd('0x66'),_0x523ea8['name'])][_0xe3dd('0x2c')])&&(this[_0xe3dd('0xc')][util[_0xe3dd('0x5d')](_0xe3dd('0x66'),_0x523ea8[_0xe3dd('0x22')])][_0xe3dd('0x2c')]==='reachable'||this['trunks'][util[_0xe3dd('0x5d')]('SIP/%s',_0x523ea8[_0xe3dd('0x22')])][_0xe3dd('0x2c')]===_0xe3dd('0x68'));};Fax[_0xe3dd('0x1a')][_0xe3dd('0x58')]=function(_0x1fb12b,_0xe5d23d){if(!this[_0xe3dd('0x64')](_0x1fb12b)){ut[_0xe3dd('0x46')](_0xe3dd('0x69'),_['isNil'](_0x1fb12b)?'':_0x1fb12b[_0xe3dd('0x22')]+_0xe3dd('0x6a'));return{'isValid':![],'message':_0xe3dd('0x6b')};}if(_['isNil'](_0xe5d23d['fax'])){ut['logger'](_0xe3dd('0x6c'),JSON[_0xe3dd('0x3d')](_0xe5d23d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xe3dd('0x67')](_0xe5d23d[_0xe3dd('0x3')])){ut[_0xe3dd('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xe3dd('0x3d')](_0xe5d23d));return{'isValid':![],'message':_0xe3dd('0x6d')};}return{'isValid':!![],'message':_0xe3dd('0x6e')};};module[_0xe3dd('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 21f0109..d3098ed 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 _0xaa39=['inspect','resolve','then','[Notify]\x20','preview','lodash','../rpc/faxAccount','error'];(function(_0x3b4e3f,_0x36e83b){var _0x59dcf4=function(_0x923c4a){while(--_0x923c4a){_0x3b4e3f['push'](_0x3b4e3f['shift']());}};_0x59dcf4(++_0x36e83b);}(_0xaa39,0x154));var _0x9aa3=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0xaa39[_0x19115e];return _0x45bbd4;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x9aa3('0x0'));var _=require(_0x9aa3('0x1'));var faxAccount=require(_0x9aa3('0x2'));function loggerCatch(_0x34a21d){return function(_0x48983b){logger[_0x9aa3('0x3')](_0x34a21d,util[_0x9aa3('0x4')](_0x48983b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2837c1,_0x5d2cf8){return BPromise[_0x9aa3('0x5')]()[_0x9aa3('0x6')](faxAccount['notify'](_0x2837c1,_0x5d2cf8))['catch'](loggerCatch(_0x9aa3('0x7')));}; \ No newline at end of file +var _0xc349=['then','[Notify]\x20','util','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0xe4e88f,_0x521ba8){var _0x310b04=function(_0x447b56){while(--_0x447b56){_0xe4e88f['push'](_0xe4e88f['shift']());}};_0x310b04(++_0x521ba8);}(_0xc349,0x1df));var _0x9c34=function(_0x5da35e,_0x2f687d){_0x5da35e=_0x5da35e-0x0;var _0x19d7bc=_0xc349[_0x5da35e];return _0x19d7bc;};'use strict';var util=require(_0x9c34('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0x9c34('0x1'));var faxAccount=require(_0x9c34('0x2'));function loggerCatch(_0x49abf2){return function(_0x4cd8f7){logger[_0x9c34('0x3')](_0x49abf2,util[_0x9c34('0x4')](_0x4cd8f7,{'showHidden':![],'depth':null}));};}exports[_0x9c34('0x5')]=function(_0x109b4b,_0x279565){return BPromise[_0x9c34('0x6')]()[_0x9c34('0x7')](faxAccount[_0x9c34('0x5')](_0x109b4b,_0x279565))['catch'](loggerCatch(_0x9c34('0x8')));}; \ 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 588a1de..8f08648 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 _0xe676=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x8aefda,_0x5a5fe7){var _0x55e586=function(_0x3b193f){while(--_0x3b193f){_0x8aefda['push'](_0x8aefda['shift']());}};_0x55e586(++_0x5a5fe7);}(_0xe676,0x122));var _0x6e67=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe676[_0x30182f];return _0x5207db;};'use strict';var util=require(_0x6e67('0x0'));var logger=require(_0x6e67('0x1'))(_0x6e67('0x2'));var BPromise=require(_0x6e67('0x3'));var exec=require(_0x6e67('0x4'))[_0x6e67('0x5')];exports[_0x6e67('0x6')]=function(_0x5bde52){return new BPromise(function(_0x102089,_0x40366f){exec(_0x5bde52,function(_0x20323a,_0x3d27a8,_0x2a5622){logger[_0x6e67('0x7')](_0x6e67('0x8'),_0x3d27a8);if(_0x20323a){logger[_0x6e67('0x7')](_0x6e67('0x8'),_0x6e67('0x9'),util[_0x6e67('0xa')](_0x20323a,{'showHidden':![],'depth':null}),_0x3d27a8,_0x2a5622);_0x40366f(_0x20323a);}_0x102089(_0x3d27a8);});});}; \ No newline at end of file +var _0xb270=['util','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','inspect'];(function(_0x19ae21,_0x142506){var _0x13e6ca=function(_0x13571b){while(--_0x13571b){_0x19ae21['push'](_0x19ae21['shift']());}};_0x13e6ca(++_0x142506);}(_0xb270,0x128));var _0x0b27=function(_0x12ff2c,_0x4cab86){_0x12ff2c=_0x12ff2c-0x0;var _0x2467a3=_0xb270[_0x12ff2c];return _0x2467a3;};'use strict';var util=require(_0x0b27('0x0'));var logger=require(_0x0b27('0x1'))(_0x0b27('0x2'));var BPromise=require(_0x0b27('0x3'));var exec=require('child_process')[_0x0b27('0x4')];exports[_0x0b27('0x5')]=function(_0x4060ba){return new BPromise(function(_0x51ec52,_0x3fea00){exec(_0x4060ba,function(_0xbaa1c,_0x2cc952,_0x52f0cf){logger['info'](_0x0b27('0x6'),_0x2cc952);if(_0xbaa1c){logger['info'](_0x0b27('0x6'),'\x20Error\x20:',util[_0x0b27('0x7')](_0xbaa1c,{'showHidden':![],'depth':null}),_0x2cc952,_0x52f0cf);_0x3fea00(_0xbaa1c);}_0x51ec52(_0x2cc952);});});}; \ 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 343fb90..e9dd05f 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 _0x0bb5=['headerinfo','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','info','inspect','ecm'];(function(_0x2f68a0,_0x2e7b85){var _0x4ca062=function(_0x4c20c1){while(--_0x4c20c1){_0x2f68a0['push'](_0x2f68a0['shift']());}};_0x4ca062(++_0x2e7b85);}(_0x0bb5,0x148));var _0x50bb=function(_0xd8f968,_0x19dc78){_0xd8f968=_0xd8f968-0x0;var _0x56d828=_0x0bb5[_0xd8f968];return _0x56d828;};'use strict';var util=require(_0x50bb('0x0'));var _=require(_0x50bb('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x50bb('0x2'));exports[_0x50bb('0x3')]=function(_0x6b7575){return{'message':_0x6b7575};};exports[_0x50bb('0x4')]=function(_0x29c72b,_0xfdc9d4){logger[_0x50bb('0x5')](_0x29c72b,util[_0x50bb('0x6')](_0xfdc9d4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4a105c,_0xfd7aeb){var _0x35de5d={'XMF-ECM':_0xfd7aeb[_0x50bb('0x7')],'XMF-HEADERINFO':_0xfd7aeb[_0x50bb('0x8')],'XMF-MINRATE':_0xfd7aeb['minrate'],'XMF-MAXRATE':_0xfd7aeb['maxrate'],'XMF-MODEM':util[_0x50bb('0x9')](_0x50bb('0xa'),_0xfd7aeb[_0x50bb('0xb')]),'XMF-GATEWAY':_0xfd7aeb[_0x50bb('0xc')],'XMF-FAXDETECT':_0xfd7aeb['faxdetect'],'XMF-T38TIMEOUT':_0xfd7aeb[_0x50bb('0xd')],'XMF-LOCALSTATIONID':_0xfd7aeb[_0x50bb('0xe')],'XMF-PATH':_0x4a105c[_0x50bb('0xf')]};return _0x35de5d;};exports[_0x50bb('0x10')]=function(_0x346422,_0x304c3a){return{'actionid':_0x346422[_0x50bb('0x11')],'action':'originate','channel':_0x346422[_0x50bb('0x12')],'Exten':'xcally-motion-fax','Context':_0x50bb('0x13'),'Priority':'1','callerid':util[_0x50bb('0x9')](_0x50bb('0x14'),_0x346422['headerinfo']?_0x346422[_0x50bb('0x8')]:'',_0x346422[_0x50bb('0xe')]),'variable':_0x304c3a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x346422[_0x50bb('0x11')]};}; \ No newline at end of file +var _0x878f=['inspect','maxrate','modem','gateway','faxdetect','localstationid','path','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x878f,0x173));var _0xf878=function(_0x54982a,_0xd53ea6){_0x54982a=_0x54982a-0x0;var _0x32f883=_0x878f[_0x54982a];return _0x32f883;};'use strict';var util=require('util');var _=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var logger=require(_0xf878('0x2'))(_0xf878('0x3'));exports[_0xf878('0x4')]=function(_0x3d74cf){return{'message':_0x3d74cf};};exports[_0xf878('0x5')]=function(_0x45a37b,_0x240b48){logger[_0xf878('0x6')](_0x45a37b,util[_0xf878('0x7')](_0x240b48,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ac8d8,_0x3c5f5c){var _0x62b420={'XMF-ECM':_0x3c5f5c['ecm'],'XMF-HEADERINFO':_0x3c5f5c['headerinfo'],'XMF-MINRATE':_0x3c5f5c['minrate'],'XMF-MAXRATE':_0x3c5f5c[_0xf878('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x3c5f5c[_0xf878('0x9')]),'XMF-GATEWAY':_0x3c5f5c[_0xf878('0xa')],'XMF-FAXDETECT':_0x3c5f5c[_0xf878('0xb')],'XMF-T38TIMEOUT':_0x3c5f5c['t38timeout'],'XMF-LOCALSTATIONID':_0x3c5f5c[_0xf878('0xc')],'XMF-PATH':_0x4ac8d8[_0xf878('0xd')]};return _0x62b420;};exports['variablesAction']=function(_0xdf76,_0x4f7e7f){return{'actionid':_0xdf76[_0xf878('0xe')],'action':_0xf878('0xf'),'channel':_0xdf76[_0xf878('0x10')],'Exten':'xcally-motion-fax','Context':_0xf878('0x11'),'Priority':'1','callerid':util[_0xf878('0x12')](_0xf878('0x13'),_0xdf76['headerinfo']?_0xdf76[_0xf878('0x14')]:'',_0xdf76[_0xf878('0xc')]),'variable':_0x4f7e7f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xdf76[_0xf878('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6b1ae77..73e368c 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 _0x400f=['initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','util','moment','./server','./realtime','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts'];(function(_0x14db12,_0x440b12){var _0x3fc276=function(_0xa04997){while(--_0xa04997){_0x14db12['push'](_0x14db12['shift']());}};_0x3fc276(++_0x440b12);}(_0x400f,0x197));var _0xf400=function(_0x13425b,_0x509118){_0x13425b=_0x13425b-0x0;var _0x3917cb=_0x400f[_0x13425b];return _0x3917cb;};'use strict';var BPromise=require(_0xf400('0x0'));var util=require(_0xf400('0x1'));var moment=require(_0xf400('0x2'));var server=require(_0xf400('0x3'));var Realtime=require(_0xf400('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xf400('0x5'));var Dialer=require(_0xf400('0x6'));var Preview=require('./preview');var Fax=require(_0xf400('0x7'));var user=require(_0xf400('0x8'));var voiceQueue=require(_0xf400('0x9'));var voiceQueueReport=require(_0xf400('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xf400('0xb'));var trigger=require(_0xf400('0xc'));var template=require(_0xf400('0xd'));var cmHopperHistory=require(_0xf400('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xf400('0xf'));var faxAccount=require(_0xf400('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf400('0x11'));var freshdesk=require(_0xf400('0x12'));var desk=require(_0xf400('0x13'));var zoho=require(_0xf400('0x14'));var vtiger=require(_0xf400('0x15'));var freshsales=require(_0xf400('0x16'));var servicenow=require(_0xf400('0x17'));var dynamics365=require(_0xf400('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf400('0x19')](_0xf400('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xf400('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf400('0x1b')](user['getAgents']())[_0xf400('0x1b')](realtime[_0xf400('0x1c')]())[_0xf400('0x1b')](user[_0xf400('0x1d')]())[_0xf400('0x1b')](realtime[_0xf400('0x1e')]())[_0xf400('0x1b')](trunk[_0xf400('0x1f')]())['then'](realtime[_0xf400('0x20')]())[_0xf400('0x1b')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xf400('0x21')]())[_0xf400('0x1b')](trigger[_0xf400('0x22')]())[_0xf400('0x1b')](realtime['initTriggers']())[_0xf400('0x1b')](template['getTemplates']())['then'](realtime['initTemplates']())[_0xf400('0x1b')](zendesk['getZendeskAccounts']())[_0xf400('0x1b')](realtime[_0xf400('0x23')]())[_0xf400('0x1b')](salesforce[_0xf400('0x24')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xf400('0x25')]())[_0xf400('0x1b')](realtime[_0xf400('0x26')]())[_0xf400('0x1b')](freshdesk['getFreshdeskAccounts']())[_0xf400('0x1b')](realtime[_0xf400('0x27')]())[_0xf400('0x1b')](desk[_0xf400('0x28')]())[_0xf400('0x1b')](realtime[_0xf400('0x29')]())[_0xf400('0x1b')](zoho[_0xf400('0x2a')]())['then'](realtime['initZohoAccounts']())[_0xf400('0x1b')](vtiger[_0xf400('0x2b')]())[_0xf400('0x1b')](realtime[_0xf400('0x2c')]())[_0xf400('0x1b')](freshsales['getFreshsalesAccounts']())[_0xf400('0x1b')](realtime['initFreshsalesAccounts']())[_0xf400('0x1b')](servicenow[_0xf400('0x2d')]())[_0xf400('0x1b')](realtime[_0xf400('0x2e')]())[_0xf400('0x1b')](dynamics365[_0xf400('0x2f')]())['then'](realtime[_0xf400('0x30')]())[_0xf400('0x1b')](campaign[_0xf400('0x31')]())['then'](realtime['initCampaigns']())[_0xf400('0x1b')](voiceExtension[_0xf400('0x32')]())[_0xf400('0x1b')](realtime[_0xf400('0x33')]())['then'](faxAccount[_0xf400('0x34')]())[_0xf400('0x1b')](realtime['initFaxAccounts']())[_0xf400('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xf400('0x35')]()[_0xf400('0x1b')](voiceQueueReport[_0xf400('0x36')]())[_0xf400('0x1b')](realtime[_0xf400('0x37')]())['then'](cmHopperHistory[_0xf400('0x38')]())[_0xf400('0x1b')](realtime[_0xf400('0x39')]())[_0xf400('0x1b')](cmHopperHistory[_0xf400('0x3a')]())[_0xf400('0x1b')](realtime['initCampaignHopperHistory']())[_0xf400('0x1b')](voiceCallReport[_0xf400('0x3b')]())[_0xf400('0x1b')](realtime[_0xf400('0x3c')]())['then'](function(_0x1bcb2e){})[_0xf400('0x3d')](function(_0x359891){console[_0xf400('0x3e')](_0x359891);});}function main(){return server[_0xf400('0x3f')](realtime,preview,fax)[_0xf400('0x1b')](function(_0x3a91ad){return initRealtime();})[_0xf400('0x1b')](function(){return initParams();})[_0xf400('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xf400('0x3d')](function(_0x2e8cb5){console[_0xf400('0x3e')](_0x2e8cb5);});}main(); \ No newline at end of file +var _0x8a2e=['./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','getAgents','then','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x8a2e,0x1c5));var _0xe8a2=function(_0x44ff83,_0x2c6f9d){_0x44ff83=_0x44ff83-0x0;var _0x4798ff=_0x8a2e[_0x44ff83];return _0x4798ff;};'use strict';var BPromise=require('bluebird');var util=require(_0xe8a2('0x0'));var moment=require('moment');var server=require(_0xe8a2('0x1'));var Realtime=require(_0xe8a2('0x2'));var Report=require(_0xe8a2('0x3'));var Acw=require(_0xe8a2('0x4'));var Trigger=require(_0xe8a2('0x5'));var Dialer=require('./dialer');var Preview=require(_0xe8a2('0x6'));var Fax=require(_0xe8a2('0x7'));var user=require(_0xe8a2('0x8'));var voiceQueue=require(_0xe8a2('0x9'));var voiceQueueReport=require(_0xe8a2('0xa'));var voiceCallReport=require(_0xe8a2('0xb'));var trunk=require(_0xe8a2('0xc'));var trigger=require(_0xe8a2('0xd'));var template=require(_0xe8a2('0xe'));var cmHopperHistory=require(_0xe8a2('0xf'));var campaign=require(_0xe8a2('0x10'));var voiceExtension=require(_0xe8a2('0x11'));var faxAccount=require(_0xe8a2('0x12'));var zendesk=require(_0xe8a2('0x13'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe8a2('0x14'));var freshdesk=require(_0xe8a2('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xe8a2('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xe8a2('0x17'));var dynamics365=require(_0xe8a2('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xe8a2('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xe8a2('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe8a2('0x1a')]()['then'](user[_0xe8a2('0x1b')]())[_0xe8a2('0x1c')](realtime['initAgents']())['then'](user[_0xe8a2('0x1d')]())[_0xe8a2('0x1c')](realtime['initTelephones']())[_0xe8a2('0x1c')](trunk[_0xe8a2('0x1e')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x1f')]())[_0xe8a2('0x1c')](voiceQueue[_0xe8a2('0x20')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x21')]())[_0xe8a2('0x1c')](trigger['getTriggers']())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x22')]())[_0xe8a2('0x1c')](template[_0xe8a2('0x23')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x24')]())[_0xe8a2('0x1c')](zendesk[_0xe8a2('0x25')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x26')]())[_0xe8a2('0x1c')](salesforce[_0xe8a2('0x27')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x28')]())['then'](sugarcrm[_0xe8a2('0x29')]())['then'](realtime[_0xe8a2('0x2a')]())[_0xe8a2('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xe8a2('0x2b')]())[_0xe8a2('0x1c')](desk[_0xe8a2('0x2c')]())[_0xe8a2('0x1c')](realtime['initDeskAccounts']())[_0xe8a2('0x1c')](zoho[_0xe8a2('0x2d')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x2e')]())[_0xe8a2('0x1c')](vtiger[_0xe8a2('0x2f')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x30')]())[_0xe8a2('0x1c')](freshsales[_0xe8a2('0x31')]())['then'](realtime[_0xe8a2('0x32')]())[_0xe8a2('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0xe8a2('0x33')]())[_0xe8a2('0x1c')](dynamics365[_0xe8a2('0x34')]())['then'](realtime[_0xe8a2('0x35')]())[_0xe8a2('0x1c')](campaign[_0xe8a2('0x36')]())[_0xe8a2('0x1c')](realtime['initCampaigns']())[_0xe8a2('0x1c')](voiceExtension[_0xe8a2('0x37')]())['then'](realtime[_0xe8a2('0x38')]())[_0xe8a2('0x1c')](faxAccount['getFaxAccounts']())[_0xe8a2('0x1c')](realtime['initFaxAccounts']())[_0xe8a2('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0xe8a2('0x39')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x3a')]())[_0xe8a2('0x1c')](cmHopperHistory[_0xe8a2('0x3b')]())[_0xe8a2('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xe8a2('0x1c')](cmHopperHistory[_0xe8a2('0x3c')]())['then'](realtime[_0xe8a2('0x3d')]())['then'](voiceCallReport[_0xe8a2('0x3e')]())[_0xe8a2('0x1c')](realtime[_0xe8a2('0x3f')]())['then'](function(_0x366c4e){})[_0xe8a2('0x40')](function(_0xd812e){console[_0xe8a2('0x41')](_0xd812e);});}function main(){return server['listen'](realtime,preview,fax)[_0xe8a2('0x1c')](function(_0xe5517f){return initRealtime();})[_0xe8a2('0x1c')](function(){return initParams();})['then'](function(){report[_0xe8a2('0x42')]();setInterval(initRealtime,0x1388);})[_0xe8a2('0x40')](function(_0x568563){console[_0xe8a2('0x41')](_0x568563);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 624e8d7..b174fa2 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 _0x653d=['online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','format','stateTime','status','stringify','user:%s','emit','user:save','exports','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','address','phone','interface'];(function(_0x44a162,_0x3caeab){var _0x37add4=function(_0x212217){while(--_0x212217){_0x44a162['push'](_0x44a162['shift']());}};_0x37add4(++_0x3caeab);}(_0x653d,0x64));var _0xd653=function(_0x3a3473,_0x56a37e){_0x3a3473=_0x3a3473-0x0;var _0x11ab5c=_0x653d[_0x3a3473];return _0x11ab5c;};'use strict';var _=require(_0xd653('0x0'));var util=require(_0xd653('0x1'));var moment=require(_0xd653('0x2'));var md5=require('md5');var Redis=require(_0xd653('0x3'));var config=require(_0xd653('0x4'));config[_0xd653('0x5')]=_[_0xd653('0x6')](config[_0xd653('0x5')],{'host':_0xd653('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x41a54c){this['id']=_0x41a54c['id']||0x0;this[_0xd653('0x8')]=_0x41a54c[_0xd653('0x8')]||'';this[_0xd653('0x9')]=_0x41a54c['email']||'';this[_0xd653('0xa')]=_0x41a54c[_0xd653('0xa')]||'';this[_0xd653('0xb')]=_0x41a54c[_0xd653('0xb')]||'';this[_0xd653('0xc')]=_0xd653('0xd');this['stateTime']=0x0;this['status']='unknown';this[_0xd653('0xe')]='';this[_0xd653('0xf')]='';this['mobile']='';this[_0xd653('0x10')]='';this[_0xd653('0x11')]=_0x41a54c[_0xd653('0x11')]||![];this[_0xd653('0x12')]=_0xd653('0xd');this[_0xd653('0x13')]=0x0;this[_0xd653('0x14')]='';this[_0xd653('0x15')]='';this[_0xd653('0x16')]=![];this[_0xd653('0x17')]=![];this[_0xd653('0x18')]='';}Agent[_0xd653('0x19')][_0xd653('0x1a')]=function(_0x2986b2){var _0x545fd0;if(_0x2986b2&&_0x2986b2[_0xd653('0xc')]){_0x545fd0=_0x2986b2[_0xd653('0xc')]['toLowerCase']();switch(_0x545fd0){case _0xd653('0x1b'):_0x545fd0=_0xd653('0x1c');break;case _0xd653('0x1d'):_0x545fd0=_0xd653('0x1e');break;}}if(_0x545fd0&&this[_0xd653('0x12')]!==_0x545fd0||_0x2986b2['statePause']){this[_0xd653('0x13')]=_['toNumber'](moment()[_0xd653('0x1f')]('x'));}if(_0x545fd0){this[_0xd653('0x12')]=_0x545fd0;}var _0x354a95={'id':this['id'],'name':this[_0xd653('0x8')],'email':this[_0xd653('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xd653('0xb')],'state':this[_0xd653('0xc')],'stateTime':this[_0xd653('0x20')],'status':this[_0xd653('0x21')],'address':this[_0xd653('0xe')],'online':this[_0xd653('0x11')],'voiceStatus':this[_0xd653('0x12')],'voiceStatusTime':this[_0xd653('0x13')],'voiceStatusCallerIdNumber':this[_0xd653('0x14')],'voiceStatusQueue':this[_0xd653('0x15')],'interface':this[_0xd653('0x10')],'onhold':this['onhold']};var _0xde622=md5(JSON[_0xd653('0x22')](_0x354a95));if(this[_0xd653('0x18')]!==_0xde622){this[_0xd653('0x18')]=_0xde622;io['to'](util[_0xd653('0x1f')](_0xd653('0x23'),_0x354a95[_0xd653('0x8')]))[_0xd653('0x24')](_0xd653('0x25'),_0x354a95);}};module[_0xd653('0x26')]=Agent; \ No newline at end of file +var _0xb838=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','unknown','stateTime','status','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','fullname','voiceStatusQueue','stringify','format','user:%s','emit','user:save','exports','lodash','util'];(function(_0x149dde,_0x593694){var _0xdfe1bf=function(_0xa38b19){while(--_0xa38b19){_0x149dde['push'](_0x149dde['shift']());}};_0xdfe1bf(++_0x593694);}(_0xb838,0x184));var _0x8b83=function(_0x236781,_0x6e96c){_0x236781=_0x236781-0x0;var _0x47fb35=_0xb838[_0x236781];return _0x47fb35;};'use strict';var _=require(_0x8b83('0x0'));var util=require(_0x8b83('0x1'));var moment=require('moment');var md5=require(_0x8b83('0x2'));var Redis=require(_0x8b83('0x3'));var config=require(_0x8b83('0x4'));config[_0x8b83('0x5')]=_[_0x8b83('0x6')](config['redis'],{'host':_0x8b83('0x7'),'port':0x18eb});var io=require(_0x8b83('0x8'))(new Redis(config[_0x8b83('0x5')]));function Agent(_0x21da6b){this['id']=_0x21da6b['id']||0x0;this[_0x8b83('0x9')]=_0x21da6b[_0x8b83('0x9')]||'';this[_0x8b83('0xa')]=_0x21da6b[_0x8b83('0xa')]||'';this[_0x8b83('0xb')]=_0x21da6b[_0x8b83('0xb')]||'';this['fullname']=_0x21da6b['fullname']||'';this['state']=_0x8b83('0xc');this[_0x8b83('0xd')]=0x0;this[_0x8b83('0xe')]=_0x8b83('0xc');this['address']='';this[_0x8b83('0xf')]='';this[_0x8b83('0x10')]='';this[_0x8b83('0x11')]='';this['online']=_0x21da6b[_0x8b83('0x12')]||![];this['voiceStatus']=_0x8b83('0xc');this[_0x8b83('0x13')]=0x0;this[_0x8b83('0x14')]='';this['voiceStatusQueue']='';this[_0x8b83('0x15')]=![];this['local']=![];this[_0x8b83('0x2')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x396093){var _0x46ee06;if(_0x396093&&_0x396093[_0x8b83('0x16')]){_0x46ee06=_0x396093[_0x8b83('0x16')][_0x8b83('0x17')]();switch(_0x46ee06){case _0x8b83('0x18'):_0x46ee06=_0x8b83('0x19');break;case _0x8b83('0x1a'):_0x46ee06=_0x8b83('0x1b');break;}}if(_0x46ee06&&this[_0x8b83('0x1c')]!==_0x46ee06||_0x396093[_0x8b83('0x1d')]){this[_0x8b83('0x13')]=_[_0x8b83('0x1e')](moment()['format']('x'));}if(_0x46ee06){this['voiceStatus']=_0x46ee06;}var _0x4fc45d={'id':this['id'],'name':this[_0x8b83('0x9')],'email':this[_0x8b83('0xa')],'accountcode':this[_0x8b83('0xb')],'fullname':this[_0x8b83('0x1f')],'state':this[_0x8b83('0x16')],'stateTime':this[_0x8b83('0xd')],'status':this['status'],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x8b83('0x1c')],'voiceStatusTime':this[_0x8b83('0x13')],'voiceStatusCallerIdNumber':this[_0x8b83('0x14')],'voiceStatusQueue':this[_0x8b83('0x20')],'interface':this[_0x8b83('0x11')],'onhold':this[_0x8b83('0x15')]};var _0x28b339=md5(JSON[_0x8b83('0x21')](_0x4fc45d));if(this[_0x8b83('0x2')]!==_0x28b339){this[_0x8b83('0x2')]=_0x28b339;io['to'](util[_0x8b83('0x22')](_0x8b83('0x23'),_0x4fc45d['name']))[_0x8b83('0x24')](_0x8b83('0x25'),_0x4fc45d);}};module[_0x8b83('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 08f0384..8afecda 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 _0xa6eb=['message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays'];(function(_0xd9115a,_0x274810){var _0x174e91=function(_0x5830e5){while(--_0x5830e5){_0xd9115a['push'](_0xd9115a['shift']());}};_0x174e91(++_0x274810);}(_0xa6eb,0xc6));var _0xba6e=function(_0x332801,_0x42dd7e){_0x332801=_0x332801-0x0;var _0x32d1b5=_0xa6eb[_0x332801];return _0x32d1b5;};'use strict';function Campaign(_0x4db012){this['id']=_0x4db012['id']||0x0;this[_0xba6e('0x0')]=_0x4db012[_0xba6e('0x0')]||'';this[_0xba6e('0x1')]=_0x4db012[_0xba6e('0x1')]||_0xba6e('0x2');this[_0xba6e('0x3')]=0x0;this['temp']=0x0;this[_0xba6e('0x4')]=0x0;this[_0xba6e('0x5')]=0x0;this[_0xba6e('0x6')]='';this[_0xba6e('0x7')]=!![];this[_0xba6e('0x8')]=_0x4db012[_0xba6e('0x8')];this[_0xba6e('0x9')]=_0x4db012['limitCalls'];this[_0xba6e('0xa')]=_0x4db012[_0xba6e('0xa')]||null;this[_0xba6e('0xb')]=_0x4db012[_0xba6e('0xb')]?_0x4db012[_0xba6e('0xb')]:null;this[_0xba6e('0xc')]=_0x4db012[_0xba6e('0xc')];this['dialOriginateCallerIdNumber']=_0x4db012[_0xba6e('0xd')];this[_0xba6e('0xe')]=_0x4db012[_0xba6e('0xe')]||0x1e;this[_0xba6e('0xf')]=_0x4db012['dialCongestionMaxRetry'];this[_0xba6e('0x10')]=_0x4db012['dialCongestionRetryFrequency'];this[_0xba6e('0x11')]=_0x4db012['dialBusyMaxRetry'];this[_0xba6e('0x12')]=_0x4db012['dialBusyRetryFrequency'];this[_0xba6e('0x13')]=_0x4db012[_0xba6e('0x13')];this[_0xba6e('0x14')]=_0x4db012[_0xba6e('0x14')];this[_0xba6e('0x15')]=_0x4db012[_0xba6e('0x15')];this[_0xba6e('0x16')]=_0x4db012[_0xba6e('0x16')]||0x3;this[_0xba6e('0x17')]=_0x4db012['dialNoSuchNumberRetryFrequency']||0x96;this[_0xba6e('0x18')]=_0x4db012[_0xba6e('0x18')]||0x3;this['dialDropRetryFrequency']=_0x4db012[_0xba6e('0x19')]||0x96;this[_0xba6e('0x1a')]=_0x4db012['dialAbandonedMaxRetry']||0x3;this[_0xba6e('0x1b')]=_0x4db012['dialAbandonedRetryFrequency']||0x96;this[_0xba6e('0x1c')]=_0x4db012[_0xba6e('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4db012[_0xba6e('0x1d')]||0x96;this[_0xba6e('0x1e')]=_0x4db012[_0xba6e('0x1e')]||0x3;this[_0xba6e('0x1f')]=_0x4db012[_0xba6e('0x1f')]||0x96;this[_0xba6e('0x20')]=_0x4db012[_0xba6e('0x20')]||_0xba6e('0x21');this[_0xba6e('0x22')]=_0x4db012[_0xba6e('0x22')]||undefined;this[_0xba6e('0x23')]=_0x4db012[_0xba6e('0x23')]||undefined;this[_0xba6e('0x24')]=_0x4db012[_0xba6e('0x24')]||undefined;this[_0xba6e('0x25')]=_0x4db012['TrunkBackup']?_0x4db012[_0xba6e('0x25')]:undefined;this[_0xba6e('0x26')]=_0x4db012[_0xba6e('0x26')]?_0x4db012[_0xba6e('0x26')]:undefined;this[_0xba6e('0x27')]=_0x4db012[_0xba6e('0x27')]?_0x4db012[_0xba6e('0x27')]:undefined;this[_0xba6e('0x28')]=_0x4db012[_0xba6e('0x28')]?_0x4db012[_0xba6e('0x28')]:undefined;this['dialQueueProject']=_0x4db012[_0xba6e('0x28')]?_0x4db012['SquareProject'][_0xba6e('0x0')]:undefined;this[_0xba6e('0x29')]=_0x4db012[_0xba6e('0x29')]||![];this[_0xba6e('0x2a')]=_0x4db012['dialAMDInitialSilence'];this[_0xba6e('0x2b')]=_0x4db012['dialAMDGreeting'];this[_0xba6e('0x2c')]=_0x4db012['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x4db012[_0xba6e('0x2d')];this['dialAMDMinWordLength']=_0x4db012[_0xba6e('0x2e')];this['dialAMDBetweenWordsSilence']=_0x4db012[_0xba6e('0x2f')];this[_0xba6e('0x30')]=_0x4db012[_0xba6e('0x30')];this['dialAMDSilenceThreshold']=_0x4db012[_0xba6e('0x31')];this[_0xba6e('0x32')]=_0x4db012[_0xba6e('0x32')];}module['exports']=Campaign; \ No newline at end of file +var _0x0b3e=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x0b3e,0x14c));var _0xe0b3=function(_0xe3f1cd,_0x86f92f){_0xe3f1cd=_0xe3f1cd-0x0;var _0x3e7de0=_0x0b3e[_0xe3f1cd];return _0x3e7de0;};'use strict';function Campaign(_0xa725d1){this['id']=_0xa725d1['id']||0x0;this['name']=_0xa725d1[_0xe0b3('0x0')]||'';this['type']=_0xa725d1[_0xe0b3('0x1')]||_0xe0b3('0x2');this['originated']=0x0;this[_0xe0b3('0x3')]=0x0;this[_0xe0b3('0x4')]=0x0;this[_0xe0b3('0x5')]=0x0;this[_0xe0b3('0x6')]='';this[_0xe0b3('0x7')]=!![];this[_0xe0b3('0x8')]=_0xa725d1['active'];this[_0xe0b3('0x9')]=_0xa725d1[_0xe0b3('0x9')];this['dialTimezone']=_0xa725d1['dialTimezone']||null;this[_0xe0b3('0xa')]=_0xa725d1[_0xe0b3('0xa')]?_0xa725d1[_0xe0b3('0xa')]:null;this[_0xe0b3('0xb')]=_0xa725d1['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0xa725d1[_0xe0b3('0xc')];this['dialOriginateTimeout']=_0xa725d1['dialOriginateTimeout']||0x1e;this[_0xe0b3('0xd')]=_0xa725d1[_0xe0b3('0xd')];this[_0xe0b3('0xe')]=_0xa725d1[_0xe0b3('0xe')];this[_0xe0b3('0xf')]=_0xa725d1[_0xe0b3('0xf')];this[_0xe0b3('0x10')]=_0xa725d1[_0xe0b3('0x10')];this[_0xe0b3('0x11')]=_0xa725d1[_0xe0b3('0x11')];this[_0xe0b3('0x12')]=_0xa725d1['dialNoAnswerRetryFrequency'];this[_0xe0b3('0x13')]=_0xa725d1['dialGlobalMaxRetry'];this[_0xe0b3('0x14')]=_0xa725d1[_0xe0b3('0x14')]||0x3;this[_0xe0b3('0x15')]=_0xa725d1[_0xe0b3('0x15')]||0x96;this[_0xe0b3('0x16')]=_0xa725d1[_0xe0b3('0x16')]||0x3;this[_0xe0b3('0x17')]=_0xa725d1[_0xe0b3('0x17')]||0x96;this[_0xe0b3('0x18')]=_0xa725d1[_0xe0b3('0x18')]||0x3;this[_0xe0b3('0x19')]=_0xa725d1[_0xe0b3('0x19')]||0x96;this[_0xe0b3('0x1a')]=_0xa725d1[_0xe0b3('0x1a')]||0x3;this[_0xe0b3('0x1b')]=_0xa725d1[_0xe0b3('0x1b')]||0x96;this[_0xe0b3('0x1c')]=_0xa725d1[_0xe0b3('0x1c')]||0x3;this[_0xe0b3('0x1d')]=_0xa725d1['dialAgentRejectRetryFrequency']||0x96;this[_0xe0b3('0x1e')]=_0xa725d1[_0xe0b3('0x1e')]||_0xe0b3('0x1f');this['dialPrefix']=_0xa725d1[_0xe0b3('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xa725d1[_0xe0b3('0x21')]||undefined;this['dialCutDigit']=_0xa725d1['dialCutDigit']||undefined;this[_0xe0b3('0x22')]=_0xa725d1['TrunkBackup']?_0xa725d1[_0xe0b3('0x22')]:undefined;this[_0xe0b3('0x23')]=_0xa725d1[_0xe0b3('0x23')]?_0xa725d1[_0xe0b3('0x23')]:undefined;this[_0xe0b3('0x24')]=_0xa725d1['Interval']?_0xa725d1[_0xe0b3('0x24')]:undefined;this[_0xe0b3('0x25')]=_0xa725d1[_0xe0b3('0x25')]?_0xa725d1['SquareProject']:undefined;this[_0xe0b3('0x26')]=_0xa725d1[_0xe0b3('0x25')]?_0xa725d1[_0xe0b3('0x25')][_0xe0b3('0x0')]:undefined;this[_0xe0b3('0x27')]=_0xa725d1[_0xe0b3('0x27')]||![];this['dialAMDInitialSilence']=_0xa725d1[_0xe0b3('0x28')];this['dialAMDGreeting']=_0xa725d1[_0xe0b3('0x29')];this[_0xe0b3('0x2a')]=_0xa725d1['dialAMDAfterGreetingSilence'];this[_0xe0b3('0x2b')]=_0xa725d1[_0xe0b3('0x2b')];this[_0xe0b3('0x2c')]=_0xa725d1[_0xe0b3('0x2c')];this['dialAMDBetweenWordsSilence']=_0xa725d1[_0xe0b3('0x2d')];this[_0xe0b3('0x2e')]=_0xa725d1[_0xe0b3('0x2e')];this[_0xe0b3('0x2f')]=_0xa725d1[_0xe0b3('0x2f')];this[_0xe0b3('0x30')]=_0xa725d1[_0xe0b3('0x30')];}module[_0xe0b3('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 4bd1b4d..2fa6a32 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 _0xaa5e=['answered','unmanaged','abandoned','lastdata','duration','holdtime','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten'];(function(_0xf00cf4,_0xfb1b71){var _0x51914c=function(_0x164acb){while(--_0x164acb){_0xf00cf4['push'](_0xf00cf4['shift']());}};_0x51914c(++_0xfb1b71);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x18b77a,_0x325f5a){_0x18b77a=_0x18b77a-0x0;var _0x10000e=_0xaa5e[_0x18b77a];return _0x10000e;};'use strict';function Channel(){this[_0xeaa5('0x0')]=null;this[_0xeaa5('0x1')]='';this['destinationchannel']='';this[_0xeaa5('0x2')]=0x0;this[_0xeaa5('0x3')]='';this[_0xeaa5('0x4')]=undefined;this[_0xeaa5('0x5')]=undefined;this[_0xeaa5('0x6')]=0x0;this['context']='';this[_0xeaa5('0x7')]=0x0;this[_0xeaa5('0x8')]=0x0;this[_0xeaa5('0x9')]=0x0;this[_0xeaa5('0xa')]=![];this['answertime']=null;this['endtime']=null;this[_0xeaa5('0xb')]=![];this[_0xeaa5('0xc')]=![];this['lastapplication']='';this[_0xeaa5('0xd')]='';this[_0xeaa5('0xe')]=0x0;this['billableseconds']=0x0;this[_0xeaa5('0xf')]=0x0;this['type']=null;this[_0xeaa5('0x10')]=null;this[_0xeaa5('0x11')]=null;this['monitor']=![];this[_0xeaa5('0x12')]=null;this[_0xeaa5('0x13')]=null;this[_0xeaa5('0x14')]=[];this[_0xeaa5('0x15')]=undefined;this[_0xeaa5('0x16')]=undefined;this[_0xeaa5('0x17')]=0x0;}module[_0xeaa5('0x18')]=Channel; \ No newline at end of file +var _0xb515=['holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x69b65a,_0x527df9){var _0x5456d4=function(_0x450b18){while(--_0x450b18){_0x69b65a['push'](_0x69b65a['shift']());}};_0x5456d4(++_0x527df9);}(_0xb515,0x1b8));var _0x5b51=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0xb515[_0x5dee2a];return _0x31e98e;};'use strict';function Channel(){this[_0x5b51('0x0')]=null;this['channel']='';this[_0x5b51('0x1')]='';this[_0x5b51('0x2')]=0x0;this[_0x5b51('0x3')]='';this[_0x5b51('0x4')]=undefined;this[_0x5b51('0x5')]=undefined;this[_0x5b51('0x6')]=0x0;this[_0x5b51('0x7')]='';this[_0x5b51('0x8')]=0x0;this['linkedid']=0x0;this[_0x5b51('0x9')]=0x0;this[_0x5b51('0xa')]=![];this[_0x5b51('0xb')]=null;this[_0x5b51('0xc')]=null;this[_0x5b51('0xd')]=![];this[_0x5b51('0xe')]=![];this[_0x5b51('0xf')]='';this[_0x5b51('0x10')]='';this[_0x5b51('0x11')]=0x0;this[_0x5b51('0x12')]=0x0;this[_0x5b51('0x13')]=0x0;this[_0x5b51('0x14')]=null;this['tag']=null;this[_0x5b51('0x15')]=null;this[_0x5b51('0x16')]=![];this[_0x5b51('0x17')]=null;this[_0x5b51('0x18')]=null;this[_0x5b51('0x19')]=[];this[_0x5b51('0x1a')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0004e66..1c9b411 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 _0xb715=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x27bba6,_0x27ded3){var _0x15354a=function(_0x3fbd2f){while(--_0x3fbd2f){_0x27bba6['push'](_0x27bba6['shift']());}};_0x15354a(++_0x27ded3);}(_0xb715,0x16d));var _0x5b71=function(_0x4bf6d1,_0x55ed7c){_0x4bf6d1=_0x4bf6d1-0x0;var _0x36b84b=_0xb715[_0x4bf6d1];return _0x36b84b;};'use strict';function DeskAccount(_0xb0918f){this['id']=_0xb0918f['id']||0x0;this[_0x5b71('0x0')]=_0xb0918f['name']||'';this[_0x5b71('0x1')]=_0xb0918f[_0x5b71('0x1')]||'';this['remoteUri']=_0xb0918f[_0x5b71('0x2')]||'';this['authType']=_0xb0918f[_0x5b71('0x3')]||'';this[_0x5b71('0x4')]=_0xb0918f['password']||'';this['consumerKey']=_0xb0918f[_0x5b71('0x5')]||'';this[_0x5b71('0x6')]=_0xb0918f['consumerSecret']||'';this['token']=_0xb0918f[_0x5b71('0x7')]||'';this[_0x5b71('0x8')]=_0xb0918f[_0x5b71('0x8')]||'';this[_0x5b71('0x9')]=_0xb0918f[_0x5b71('0x9')]||'';this[_0x5b71('0xa')]=_0xb0918f[_0x5b71('0xa')]||'';this[_0x5b71('0xb')]=_0xb0918f[_0x5b71('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xe3c5=['authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x119ded,_0x497e72){_0x119ded=_0x119ded-0x0;var _0x22108b=_0xe3c5[_0x119ded];return _0x22108b;};'use strict';function DeskAccount(_0x388a87){this['id']=_0x388a87['id']||0x0;this[_0x5e3c('0x0')]=_0x388a87[_0x5e3c('0x0')]||'';this[_0x5e3c('0x1')]=_0x388a87[_0x5e3c('0x1')]||'';this[_0x5e3c('0x2')]=_0x388a87['remoteUri']||'';this[_0x5e3c('0x3')]=_0x388a87[_0x5e3c('0x3')]||'';this[_0x5e3c('0x4')]=_0x388a87[_0x5e3c('0x4')]||'';this[_0x5e3c('0x5')]=_0x388a87[_0x5e3c('0x5')]||'';this[_0x5e3c('0x6')]=_0x388a87[_0x5e3c('0x6')]||'';this[_0x5e3c('0x7')]=_0x388a87[_0x5e3c('0x7')]||'';this[_0x5e3c('0x8')]=_0x388a87[_0x5e3c('0x8')]||'';this['type']=_0x388a87['type']||'';this[_0x5e3c('0x9')]=_0x388a87[_0x5e3c('0x9')]||'';this[_0x5e3c('0xa')]=_0x388a87[_0x5e3c('0xa')]||{};}module[_0x5e3c('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0bee178..9e8ddeb 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 _0x9a21=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x56ada6,_0x2f9105){var _0x237c39=function(_0x22380f){while(--_0x22380f){_0x56ada6['push'](_0x56ada6['shift']());}};_0x237c39(++_0x2f9105);}(_0x9a21,0x8b));var _0x19a2=function(_0x350561,_0x4d3be3){_0x350561=_0x350561-0x0;var _0x54bfa9=_0x9a21[_0x350561];return _0x54bfa9;};'use strict';function Dynamics365Account(_0x1b40bd){this['id']=_0x1b40bd['id']||0x0;this['name']=_0x1b40bd[_0x19a2('0x0')]||'';this[_0x19a2('0x1')]=_0x1b40bd[_0x19a2('0x1')]||'';this[_0x19a2('0x2')]=_0x1b40bd[_0x19a2('0x2')]||'';this[_0x19a2('0x3')]=_0x1b40bd[_0x19a2('0x3')]||'';this[_0x19a2('0x4')]=_0x1b40bd[_0x19a2('0x4')]||'';this['clientId']=_0x1b40bd[_0x19a2('0x5')]||'';this[_0x19a2('0x6')]=_0x1b40bd['clientSecret']||{};this['serverUrl']=_0x1b40bd[_0x19a2('0x7')]||'';this[_0x19a2('0x8')]=_0x1b40bd[_0x19a2('0x8')]||{};}module[_0x19a2('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x73f1=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1bca78,_0x465c28){var _0x3d1214=function(_0x513727){while(--_0x513727){_0x1bca78['push'](_0x1bca78['shift']());}};_0x3d1214(++_0x465c28);}(_0x73f1,0xad));var _0x173f=function(_0x1ef7d2,_0x2cee75){_0x1ef7d2=_0x1ef7d2-0x0;var _0x126760=_0x73f1[_0x1ef7d2];return _0x126760;};'use strict';function Dynamics365Account(_0x5d8271){this['id']=_0x5d8271['id']||0x0;this['name']=_0x5d8271[_0x173f('0x0')]||'';this[_0x173f('0x1')]=_0x5d8271[_0x173f('0x1')]||'';this[_0x173f('0x2')]=_0x5d8271[_0x173f('0x2')]||'';this['remoteUri']=_0x5d8271[_0x173f('0x3')]||'';this[_0x173f('0x4')]=_0x5d8271[_0x173f('0x4')]||'';this[_0x173f('0x5')]=_0x5d8271[_0x173f('0x5')]||'';this[_0x173f('0x6')]=_0x5d8271['clientSecret']||{};this[_0x173f('0x7')]=_0x5d8271[_0x173f('0x7')]||'';this['Configurations']=_0x5d8271['Configurations']||{};}module[_0x173f('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0bf6a6c..7a47607 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 _0xea2d=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0xd70056,_0x5ad1ca){var _0x932495=function(_0x21cad0){while(--_0x21cad0){_0xd70056['push'](_0xd70056['shift']());}};_0x932495(++_0x5ad1ca);}(_0xea2d,0xfb));var _0xdea2=function(_0xda812,_0x41e8c3){_0xda812=_0xda812-0x0;var _0x382924=_0xea2d[_0xda812];return _0x382924;};'use strict';function FaxAccount(_0x42c988){this['id']=_0x42c988['id']||0x0;this[_0xdea2('0x0')]=_0x42c988[_0xdea2('0x0')]||'';this[_0xdea2('0x1')]=_0x42c988[_0xdea2('0x1')];this[_0xdea2('0x2')]=_0x42c988[_0xdea2('0x2')];this[_0xdea2('0x3')]=_0x42c988[_0xdea2('0x3')];this[_0xdea2('0x4')]=_0x42c988[_0xdea2('0x4')];this[_0xdea2('0x5')]=_0x42c988[_0xdea2('0x5')]||0x960;this[_0xdea2('0x6')]=_0x42c988[_0xdea2('0x6')]||0x3840;this[_0xdea2('0x7')]=_0x42c988['modem']||_0xdea2('0x8');this['gateway']=_0x42c988[_0xdea2('0x9')]||'no';this[_0xdea2('0xa')]=_0x42c988[_0xdea2('0xa')]||'no';this[_0xdea2('0xb')]=_0x42c988[_0xdea2('0xb')]||0x1388;this['tech']=_0x42c988[_0xdea2('0xc')]||'SIP';this[_0xdea2('0xd')]=_0x42c988[_0xdea2('0xd')]?_0x42c988[_0xdea2('0xd')]:undefined;this[_0xdea2('0xe')]=_0x42c988[_0xdea2('0xe')];this['key']=_0x42c988[_0xdea2('0xf')];}module[_0xdea2('0x10')]=FaxAccount; \ No newline at end of file +var _0xcf50=['gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x1545fd,_0x2c6a2f){var _0x3182f6=function(_0x290377){while(--_0x290377){_0x1545fd['push'](_0x1545fd['shift']());}};_0x3182f6(++_0x2c6a2f);}(_0xcf50,0xe5));var _0x0cf5=function(_0x2ee827,_0x2d5c2f){_0x2ee827=_0x2ee827-0x0;var _0x3ace63=_0xcf50[_0x2ee827];return _0x3ace63;};'use strict';function FaxAccount(_0x322144){this['id']=_0x322144['id']||0x0;this['name']=_0x322144[_0x0cf5('0x0')]||'';this[_0x0cf5('0x1')]=_0x322144[_0x0cf5('0x1')];this[_0x0cf5('0x2')]=_0x322144['ecm'];this[_0x0cf5('0x3')]=_0x322144[_0x0cf5('0x3')];this[_0x0cf5('0x4')]=_0x322144[_0x0cf5('0x4')];this[_0x0cf5('0x5')]=_0x322144[_0x0cf5('0x5')]||0x960;this[_0x0cf5('0x6')]=_0x322144[_0x0cf5('0x6')]||0x3840;this[_0x0cf5('0x7')]=_0x322144[_0x0cf5('0x7')]||_0x0cf5('0x8');this[_0x0cf5('0x9')]=_0x322144[_0x0cf5('0x9')]||'no';this['faxdetect']=_0x322144[_0x0cf5('0xa')]||'no';this['t38timeout']=_0x322144['t38timeout']||0x1388;this['tech']=_0x322144[_0x0cf5('0xb')]||_0x0cf5('0xc');this[_0x0cf5('0xd')]=_0x322144[_0x0cf5('0xd')]?_0x322144['Trunk']:undefined;this[_0x0cf5('0xe')]=_0x322144[_0x0cf5('0xe')];this[_0x0cf5('0xf')]=_0x322144[_0x0cf5('0xf')];}module[_0x0cf5('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 78efff1..58d4d7d 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 _0xa6ab=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa6ab,0x13b));var _0xba6a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa6ab[_0x122ef9];return _0x42fba0;};'use strict';function FreshdeskAccount(_0x4a2680){this['id']=_0x4a2680['id']||0x0;this[_0xba6a('0x0')]=_0x4a2680[_0xba6a('0x0')]||'';this[_0xba6a('0x1')]=_0x4a2680[_0xba6a('0x1')]||'';this['apiKey']=_0x4a2680['token']||'';this['remoteUri']=_0x4a2680[_0xba6a('0x2')]||'';this[_0xba6a('0x3')]=_0x4a2680[_0xba6a('0x3')]||'';this[_0xba6a('0x4')]=_0x4a2680[_0xba6a('0x4')]||{};}module[_0xba6a('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xd75f=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xd8c434,_0x289621){var _0x246841=function(_0x42e045){while(--_0x42e045){_0xd8c434['push'](_0xd8c434['shift']());}};_0x246841(++_0x289621);}(_0xd75f,0xd6));var _0xfd75=function(_0x40fb01,_0x5d2584){_0x40fb01=_0x40fb01-0x0;var _0x1bd859=_0xd75f[_0x40fb01];return _0x1bd859;};'use strict';function FreshdeskAccount(_0x4e3355){this['id']=_0x4e3355['id']||0x0;this[_0xfd75('0x0')]=_0x4e3355[_0xfd75('0x0')]||'';this[_0xfd75('0x1')]=_0x4e3355[_0xfd75('0x1')]||'';this['apiKey']=_0x4e3355['token']||'';this[_0xfd75('0x2')]=_0x4e3355[_0xfd75('0x2')]||'';this[_0xfd75('0x3')]=_0x4e3355['serverUrl']||'';this[_0xfd75('0x4')]=_0x4e3355[_0xfd75('0x4')]||{};}module[_0xfd75('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f28ea4a..60923e9 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 _0x0c57=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c57,0x159));var _0x70c5=function(_0xe47de1,_0x5401c3){_0xe47de1=_0xe47de1-0x0;var _0x5ac686=_0x0c57[_0xe47de1];return _0x5ac686;};'use strict';function FreshsalesAccount(_0x3042a7){this['id']=_0x3042a7['id']||0x0;this[_0x70c5('0x0')]=_0x3042a7[_0x70c5('0x0')]||'';this[_0x70c5('0x1')]=_0x3042a7[_0x70c5('0x1')]||'';this['apiKey']=_0x3042a7['token']||'';this[_0x70c5('0x2')]=_0x3042a7['remoteUri']||'';this[_0x70c5('0x3')]=_0x3042a7[_0x70c5('0x3')]||'';this[_0x70c5('0x4')]=_0x3042a7[_0x70c5('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xa65a=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3537d2,_0x1b34b0){var _0x150a79=function(_0x100870){while(--_0x100870){_0x3537d2['push'](_0x3537d2['shift']());}};_0x150a79(++_0x1b34b0);}(_0xa65a,0x19b));var _0xaa65=function(_0x4466ef,_0x53cc40){_0x4466ef=_0x4466ef-0x0;var _0x12214d=_0xa65a[_0x4466ef];return _0x12214d;};'use strict';function FreshsalesAccount(_0x426bb5){this['id']=_0x426bb5['id']||0x0;this[_0xaa65('0x0')]=_0x426bb5[_0xaa65('0x0')]||'';this[_0xaa65('0x1')]=_0x426bb5['username']||'';this[_0xaa65('0x2')]=_0x426bb5[_0xaa65('0x3')]||'';this[_0xaa65('0x4')]=_0x426bb5['remoteUri']||'';this[_0xaa65('0x5')]=_0x426bb5[_0xaa65('0x5')]||'';this[_0xaa65('0x6')]=_0x426bb5[_0xaa65('0x6')]||{};}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 0809b0b..d1272d1 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 _0x6a37=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallerexit','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','exports','type','inbound','uniqueid'];(function(_0x4cf4fd,_0x101bbe){var _0x2f0654=function(_0x595bfc){while(--_0x595bfc){_0x4cf4fd['push'](_0x4cf4fd['shift']());}};_0x2f0654(++_0x101bbe);}(_0x6a37,0xbb));var _0x76a3=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x6a37[_0x5a6644];return _0x3a2a5d;};'use strict';function QueueReport(){this[_0x76a3('0x0')]=_0x76a3('0x1');this[_0x76a3('0x2')]='';this[_0x76a3('0x3')]='';this[_0x76a3('0x4')]='';this[_0x76a3('0x5')]='';this[_0x76a3('0x6')]=null;this[_0x76a3('0x7')]=null;this['position']=0x1;this['count']=0x1;this[_0x76a3('0x8')]=![];this[_0x76a3('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x76a3('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x76a3('0xb')]='';this[_0x76a3('0xc')]='';this[_0x76a3('0xd')]='';this[_0x76a3('0xe')]='';this[_0x76a3('0xf')]='';this[_0x76a3('0x10')]=0x0;this[_0x76a3('0x11')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this['variables']={};}module[_0x76a3('0x12')]=QueueReport; \ No newline at end of file +var _0xa495=['priority','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten'];(function(_0x4b7c7d,_0x3f8f0c){var _0x10feae=function(_0x32df8f){while(--_0x32df8f){_0x4b7c7d['push'](_0x4b7c7d['shift']());}};_0x10feae(++_0x3f8f0c);}(_0xa495,0x186));var _0x5a49=function(_0x191b2d,_0x15f3d9){_0x191b2d=_0x191b2d-0x0;var _0x364d36=_0xa495[_0x191b2d];return _0x364d36;};'use strict';function QueueReport(){this[_0x5a49('0x0')]=_0x5a49('0x1');this[_0x5a49('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x5a49('0x3')]='';this[_0x5a49('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x5a49('0x5')]=0x1;this['count']=0x1;this[_0x5a49('0x6')]=![];this[_0x5a49('0x7')]=null;this[_0x5a49('0x8')]=![];this[_0x5a49('0x9')]=null;this[_0x5a49('0xa')]=![];this[_0x5a49('0xb')]=null;this[_0x5a49('0xc')]=0x1;this[_0x5a49('0xd')]='';this['connectedlinenum']='';this[_0x5a49('0xe')]='';this[_0x5a49('0xf')]='';this[_0x5a49('0x10')]='';this[_0x5a49('0x11')]='';this[_0x5a49('0x12')]='';this['holdtime']=0x0;this[_0x5a49('0x13')]=![];this[_0x5a49('0x14')]='';this[_0x5a49('0x15')]=0x0;this[_0x5a49('0x16')]={};}module[_0x5a49('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f8c1abe..aa1c21f 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 _0xec63=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3ba2d8,_0xcc5af7){var _0x2a58a2=function(_0x3922da){while(--_0x3922da){_0x3ba2d8['push'](_0x3ba2d8['shift']());}};_0x2a58a2(++_0xcc5af7);}(_0xec63,0x12b));var _0x3ec6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec63[_0x321bb2];return _0x9c12ed;};'use strict';function SalesforceAccount(_0x316135){this['id']=_0x316135['id']||0x0;this[_0x3ec6('0x0')]=_0x316135[_0x3ec6('0x0')]||'';this[_0x3ec6('0x1')]=_0x316135[_0x3ec6('0x1')]||'';this[_0x3ec6('0x2')]=_0x316135[_0x3ec6('0x2')]||'';this[_0x3ec6('0x3')]=_0x316135[_0x3ec6('0x3')]||'';this[_0x3ec6('0x4')]=_0x316135['clientId']||'';this[_0x3ec6('0x5')]=_0x316135[_0x3ec6('0x5')]||'';this['securityToken']=_0x316135[_0x3ec6('0x6')]||'';this[_0x3ec6('0x7')]=_0x316135[_0x3ec6('0x7')]||_0x3ec6('0x8');this[_0x3ec6('0x9')]=_0x316135[_0x3ec6('0x9')]||'';this[_0x3ec6('0xa')]=_0x316135[_0x3ec6('0xa')]||{};}module[_0x3ec6('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xf4d8=['username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xf4d8,0x149));var _0x8f4d=function(_0x5d3386,_0x2f0b2e){_0x5d3386=_0x5d3386-0x0;var _0x3feee9=_0xf4d8[_0x5d3386];return _0x3feee9;};'use strict';function SalesforceAccount(_0x5d8136){this['id']=_0x5d8136['id']||0x0;this['name']=_0x5d8136[_0x8f4d('0x0')]||'';this['username']=_0x5d8136[_0x8f4d('0x1')]||'';this['remoteUri']=_0x5d8136[_0x8f4d('0x2')]||'';this[_0x8f4d('0x3')]=_0x5d8136[_0x8f4d('0x3')]||'';this[_0x8f4d('0x4')]=_0x5d8136[_0x8f4d('0x4')]||'';this['clientSecret']=_0x5d8136['clientSecret']||'';this[_0x8f4d('0x5')]=_0x5d8136[_0x8f4d('0x5')]||'';this[_0x8f4d('0x6')]=_0x5d8136[_0x8f4d('0x6')]||_0x8f4d('0x7');this[_0x8f4d('0x8')]=_0x5d8136['serverUrl']||'';this[_0x8f4d('0x9')]=_0x5d8136[_0x8f4d('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b01830e..ac2ed6a 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 _0xa399=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa399,0x18e));var _0x9a39=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xa399[_0xc67528];return _0x38e26d;};'use strict';function ServicenowAccount(_0xffc795){this['id']=_0xffc795['id']||0x0;this[_0x9a39('0x0')]=_0xffc795['name']||'';this[_0x9a39('0x1')]=_0xffc795['username']||'';this[_0x9a39('0x2')]=_0xffc795['password']||'';this[_0x9a39('0x3')]=_0xffc795[_0x9a39('0x3')]||'';this['serverUrl']=_0xffc795[_0x9a39('0x4')]||'';this[_0x9a39('0x5')]=_0xffc795[_0x9a39('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x23ca=['remoteUri','Configurations','name','password'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x23ca,0x18e));var _0xa23c=function(_0x3a799d,_0x36f890){_0x3a799d=_0x3a799d-0x0;var _0x20fe69=_0x23ca[_0x3a799d];return _0x20fe69;};'use strict';function ServicenowAccount(_0x9eaed){this['id']=_0x9eaed['id']||0x0;this[_0xa23c('0x0')]=_0x9eaed[_0xa23c('0x0')]||'';this['username']=_0x9eaed['username']||'';this[_0xa23c('0x1')]=_0x9eaed[_0xa23c('0x1')]||'';this[_0xa23c('0x2')]=_0x9eaed[_0xa23c('0x2')]||'';this['serverUrl']=_0x9eaed['serverUrl']||'';this[_0xa23c('0x3')]=_0x9eaed['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 4188816..1d6214d 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 _0x0d82=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x464eac,_0x2aa49e){var _0xb8656f=function(_0x3d0e31){while(--_0x3d0e31){_0x464eac['push'](_0x464eac['shift']());}};_0xb8656f(++_0x2aa49e);}(_0x0d82,0x8d));var _0x20d8=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x0d82[_0x1e7b16];return _0x37fadc;};'use strict';function SugarcrmAccount(_0x42af40){this['id']=_0x42af40['id']||0x0;this['name']=_0x42af40[_0x20d8('0x0')]||'';this[_0x20d8('0x1')]=_0x42af40[_0x20d8('0x1')]||'';this[_0x20d8('0x2')]=_0x42af40['password']||'';this[_0x20d8('0x3')]=_0x42af40[_0x20d8('0x3')]||'';this[_0x20d8('0x4')]=_0x42af40['serverUrl']||'';this['Configurations']=_0x42af40[_0x20d8('0x5')]||{};}module[_0x20d8('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x3803=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x175910,_0x2085d0){var _0x294555=function(_0x14cc49){while(--_0x14cc49){_0x175910['push'](_0x175910['shift']());}};_0x294555(++_0x2085d0);}(_0x3803,0x1f0));var _0x3380=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x3803[_0x3e5086];return _0xfeb102;};'use strict';function SugarcrmAccount(_0xb62b19){this['id']=_0xb62b19['id']||0x0;this[_0x3380('0x0')]=_0xb62b19[_0x3380('0x0')]||'';this[_0x3380('0x1')]=_0xb62b19[_0x3380('0x1')]||'';this[_0x3380('0x2')]=_0xb62b19[_0x3380('0x2')]||'';this['remoteUri']=_0xb62b19[_0x3380('0x3')]||'';this[_0x3380('0x4')]=_0xb62b19['serverUrl']||'';this[_0x3380('0x5')]=_0xb62b19[_0x3380('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index dae1892..a7f369a 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 _0x3150=['name','accountcode','state','unknown','stateTime','status','address'];(function(_0x515c92,_0x536b2d){var _0x4cce49=function(_0x4f0289){while(--_0x4f0289){_0x515c92['push'](_0x515c92['shift']());}};_0x4cce49(++_0x536b2d);}(_0x3150,0xb6));var _0x0315=function(_0x46c318,_0x3a5b3f){_0x46c318=_0x46c318-0x0;var _0x143050=_0x3150[_0x46c318];return _0x143050;};'use strict';function Telephone(_0x124430){this['id']=_0x124430['id']||0x0;this['name']=_0x124430[_0x0315('0x0')]||'';this[_0x0315('0x1')]=_0x124430[_0x0315('0x1')]||'';this[_0x0315('0x2')]=_0x0315('0x3');this[_0x0315('0x4')]=0x0;this[_0x0315('0x5')]=_0x0315('0x3');this[_0x0315('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x3ae1=['exports','name','accountcode','unknown','status'];(function(_0x47d804,_0x5cc88f){var _0x284c47=function(_0x271c22){while(--_0x271c22){_0x47d804['push'](_0x47d804['shift']());}};_0x284c47(++_0x5cc88f);}(_0x3ae1,0x1a5));var _0x13ae=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3ae1[_0x433a86];return _0x23000c;};'use strict';function Telephone(_0x8faf3f){this['id']=_0x8faf3f['id']||0x0;this[_0x13ae('0x0')]=_0x8faf3f[_0x13ae('0x0')]||'';this['accountcode']=_0x8faf3f[_0x13ae('0x1')]||'';this['state']=_0x13ae('0x2');this['stateTime']=0x0;this[_0x13ae('0x3')]=_0x13ae('0x2');this['address']='';}module[_0x13ae('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a6a51c3..697c24c 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 _0x321e=['name','html','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x321e,0xba));var _0xe321=function(_0x3590a3,_0x3e3a93){_0x3590a3=_0x3590a3-0x0;var _0xeb6461=_0x321e[_0x3590a3];return _0xeb6461;};'use strict';function template(_0x585a32){this['id']=_0x585a32['id']||0x0;this[_0xe321('0x0')]=_0x585a32[_0xe321('0x0')]||'';this[_0xe321('0x1')]=_0x585a32[_0xe321('0x1')]||'';}module[_0xe321('0x2')]=template; \ No newline at end of file +var _0x7006=['name','html','exports'];(function(_0x22c250,_0x4fbc3c){var _0x249589=function(_0x4ec136){while(--_0x4ec136){_0x22c250['push'](_0x22c250['shift']());}};_0x249589(++_0x4fbc3c);}(_0x7006,0x1a7));var _0x6700=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x7006[_0x25fa5c];return _0x1bade2;};'use strict';function template(_0x2e75a8){this['id']=_0x2e75a8['id']||0x0;this[_0x6700('0x0')]=_0x2e75a8[_0x6700('0x0')]||'';this[_0x6700('0x1')]=_0x2e75a8['html']||'';}module[_0x6700('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 c501b21..53026a2 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 _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x3ef7d2,_0x2bcd3e){var _0x4dae24=function(_0x5494dd){while(--_0x5494dd){_0x3ef7d2['push'](_0x3ef7d2['shift']());}};_0x4dae24(++_0x2bcd3e);}(_0x6aa7,0x178));var _0x76aa=function(_0x347a6a,_0x353c64){_0x347a6a=_0x347a6a-0x0;var _0x4a07d8=_0x6aa7[_0x347a6a];return _0x4a07d8;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x3d9d40,_0x4a430a){var _0x5be242=function(_0x2afba4){while(--_0x2afba4){_0x3d9d40['push'](_0x3d9d40['shift']());}};_0x5be242(++_0x4a430a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4b2ddb,_0x37ac26){_0x4b2ddb=_0x4b2ddb-0x0;var _0x2d0030=_0x8ef6[_0x4b2ddb];return _0x2d0030;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b543bbb..43d0c5e 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 _0x4bd6=['registry','indexOf','port','domain','domainport','refresh','registrationtime','address','exports','name','state','unknown','stateTime'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x4bd6,0x168));var _0x64bd=function(_0x5deb9f,_0x49793d){_0x5deb9f=_0x5deb9f-0x0;var _0x4c3885=_0x4bd6[_0x5deb9f];return _0x4c3885;};'use strict';function Trunk(_0x39f7fa){this['id']=_0x39f7fa['id']||0x0;this['active']=_0x39f7fa['active']||![];this['name']=_0x39f7fa[_0x64bd('0x0')]||'';this[_0x64bd('0x1')]=_0x64bd('0x2');this[_0x64bd('0x3')]=0x0;this['status']=_0x64bd('0x2');this['registry']=_0x39f7fa[_0x64bd('0x4')]&&_0x39f7fa[_0x64bd('0x4')][_0x64bd('0x5')](':')?_0x39f7fa['registry']['split'](':')[0x0]:'';this['host']='';this[_0x64bd('0x6')]='';this[_0x64bd('0x7')]='';this[_0x64bd('0x8')]='';this[_0x64bd('0x9')]='';this['stateRegistry']=_0x64bd('0x2');this[_0x64bd('0xa')]='';this[_0x64bd('0xb')]='';}module[_0x64bd('0xc')]=Trunk; \ No newline at end of file +var _0xd57a=['address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime'];(function(_0x554047,_0x46ec41){var _0x5d11e4=function(_0x5a026e){while(--_0x5a026e){_0x554047['push'](_0x554047['shift']());}};_0x5d11e4(++_0x46ec41);}(_0xd57a,0xdf));var _0xad57=function(_0xab55b4,_0x593c73){_0xab55b4=_0xab55b4-0x0;var _0x613da3=_0xd57a[_0xab55b4];return _0x613da3;};'use strict';function Trunk(_0x4e1cdd){this['id']=_0x4e1cdd['id']||0x0;this[_0xad57('0x0')]=_0x4e1cdd[_0xad57('0x0')]||![];this['name']=_0x4e1cdd[_0xad57('0x1')]||'';this[_0xad57('0x2')]=_0xad57('0x3');this[_0xad57('0x4')]=0x0;this[_0xad57('0x5')]='unknown';this['registry']=_0x4e1cdd[_0xad57('0x6')]&&_0x4e1cdd[_0xad57('0x6')][_0xad57('0x7')](':')?_0x4e1cdd[_0xad57('0x6')][_0xad57('0x8')](':')[0x0]:'';this[_0xad57('0x9')]='';this[_0xad57('0xa')]='';this['domain']='';this[_0xad57('0xb')]='';this[_0xad57('0xc')]='';this[_0xad57('0xd')]=_0xad57('0x3');this[_0xad57('0xe')]='';this[_0xad57('0xf')]='';}module[_0xad57('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e49b031..96f3dca 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 _0xe322=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x156d30,_0x41a1b0){var _0x53c581=function(_0x554e03){while(--_0x554e03){_0x156d30['push'](_0x156d30['shift']());}};_0x53c581(++_0x41a1b0);}(_0xe322,0xcd));var _0x2e32=function(_0x618be4,_0x15c66c){_0x618be4=_0x618be4-0x0;var _0x5c8924=_0xe322[_0x618be4];return _0x5c8924;};'use strict';function voiceExtension(_0x45bf20){this['id']=_0x45bf20['id']||0x0;this[_0x2e32('0x0')]=_0x45bf20[_0x2e32('0x0')]||'';this[_0x2e32('0x1')]=_0x45bf20['recordingFormat']||_0x2e32('0x2');this[_0x2e32('0x3')]=_0x45bf20[_0x2e32('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x9ddb=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0xf59b32,_0xf5fcc6){var _0x144d74=function(_0x4f2774){while(--_0x4f2774){_0xf59b32['push'](_0xf59b32['shift']());}};_0x144d74(++_0xf5fcc6);}(_0x9ddb,0x111));var _0xb9dd=function(_0x21ab66,_0x15696b){_0x21ab66=_0x21ab66-0x0;var _0x476ab7=_0x9ddb[_0x21ab66];return _0x476ab7;};'use strict';function voiceExtension(_0x35f761){this['id']=_0x35f761['id']||0x0;this[_0xb9dd('0x0')]=_0x35f761[_0xb9dd('0x0')]||'';this[_0xb9dd('0x1')]=_0x35f761[_0xb9dd('0x1')]||_0xb9dd('0x2');this['mandatoryDisposition']=_0x35f761[_0xb9dd('0x3')]||![];}module[_0xb9dd('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 c67e60d..fbd999a 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 _0xea85=['acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','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','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','invalid','ringing','ringinuse','onhold','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','loggedIn','available','acw'];(function(_0x54266b,_0x479df5){var _0x29c02b=function(_0x3d87b7){while(--_0x3d87b7){_0x54266b['push'](_0x54266b['shift']());}};_0x29c02b(++_0x479df5);}(_0xea85,0x12f));var _0x5ea8=function(_0x267b38,_0x268505){_0x267b38=_0x267b38-0x0;var _0xcbb367=_0xea85[_0x267b38];return _0xcbb367;};'use strict';var statusDesc=['unknown','not_inuse',_0x5ea8('0x0'),'busy',_0x5ea8('0x1'),'unavailable',_0x5ea8('0x2'),_0x5ea8('0x3'),_0x5ea8('0x4')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x5ea8('0x5'),'roundrobin':_0x5ea8('0x6')};function VoiceQueue(_0x1e433a){this['id']=_0x1e433a['id']||0x0;this[_0x5ea8('0x7')]=_0x1e433a[_0x5ea8('0x7')]||'';this['monitor_format']=_0x1e433a[_0x5ea8('0x8')]||'';this[_0x5ea8('0x9')]=_0x1e433a['type']||'inbound';this[_0x5ea8('0xa')]=0x0;this[_0x5ea8('0xb')]=0x0;this[_0x5ea8('0xc')]=0x0;this[_0x5ea8('0xd')]=0x0;this[_0x5ea8('0xe')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x5ea8('0xf')]=0x0;this[_0x5ea8('0x10')]=0x0;this[_0x5ea8('0x11')]=_0x1e433a['acw']||![];this[_0x5ea8('0x12')]=_0x1e433a[_0x5ea8('0x12')]||0xa;this[_0x5ea8('0x13')]=_0x1e433a[_0x5ea8('0x13')]||'no';this[_0x5ea8('0x14')]=!![];this['message']='';this[_0x5ea8('0x15')]=0x0;this[_0x5ea8('0x16')]=0x0;this[_0x5ea8('0x17')]=_0x1e433a['dialTimezone']||null;this['dialGlobalInterval']=_0x1e433a['dialGlobalInterval']?_0x1e433a[_0x5ea8('0x18')]:null;this[_0x5ea8('0x19')]=_0x1e433a[_0x5ea8('0x19')];this[_0x5ea8('0x1a')]=_0x1e433a['dialMethod']||'progressive';this[_0x5ea8('0x1b')]=_0x1e433a[_0x5ea8('0x1b')]||0x0;this[_0x5ea8('0x1c')]=_0x1e433a[_0x5ea8('0x1c')]||0x0;this[_0x5ea8('0x1d')]=_0x1e433a['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x1e433a[_0x5ea8('0x1e')]||_0x5ea8('0x1f');this['dialPredictiveOptimizationPercentage']=_0x1e433a[_0x5ea8('0x20')]||0.03;this[_0x5ea8('0x21')]=_0x1e433a[_0x5ea8('0x21')]||0x258;this[_0x5ea8('0x22')]=_0x1e433a[_0x5ea8('0x22')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1e433a[_0x5ea8('0x23')]||_0x5ea8('0x24');this[_0x5ea8('0x25')]=_0x1e433a[_0x5ea8('0x25')]||0x1e;this[_0x5ea8('0x26')]=_0x1e433a['dialQueueOptions']||_0x5ea8('0x27');this[_0x5ea8('0x28')]=_0x1e433a[_0x5ea8('0x28')]||0x3;this[_0x5ea8('0x29')]=_0x1e433a[_0x5ea8('0x29')]||undefined;this[_0x5ea8('0x2a')]=_0x1e433a[_0x5ea8('0x2a')]||0x3;this[_0x5ea8('0x2b')]=_0x1e433a['dialCongestionRetryFrequency']||0x96;this[_0x5ea8('0x2c')]=_0x1e433a[_0x5ea8('0x2c')]||0x3;this['dialBusyRetryFrequency']=_0x1e433a[_0x5ea8('0x2d')]||0x96;this[_0x5ea8('0x2e')]=_0x1e433a[_0x5ea8('0x2e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x1e433a[_0x5ea8('0x2f')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1e433a[_0x5ea8('0x30')]||0x3;this[_0x5ea8('0x31')]=_0x1e433a[_0x5ea8('0x31')]||0x96;this[_0x5ea8('0x32')]=_0x1e433a['dialDropMaxRetry']||0x3;this[_0x5ea8('0x33')]=_0x1e433a['dialDropRetryFrequency']||0x96;this[_0x5ea8('0x34')]=_0x1e433a[_0x5ea8('0x34')]||0x3;this[_0x5ea8('0x35')]=_0x1e433a['dialAbandonedRetryFrequency']||0x96;this[_0x5ea8('0x36')]=_0x1e433a[_0x5ea8('0x36')]||0x3;this[_0x5ea8('0x37')]=_0x1e433a[_0x5ea8('0x37')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e433a[_0x5ea8('0x38')]||0x3;this[_0x5ea8('0x39')]=_0x1e433a[_0x5ea8('0x39')]||0x96;this[_0x5ea8('0x3a')]=_0x1e433a['dialGlobalMaxRetry']||0x4;this[_0x5ea8('0x3b')]=_0x1e433a[_0x5ea8('0x3b')]?_0x1e433a[_0x5ea8('0x3b')]:undefined;this['TrunkBackup']=_0x1e433a['TrunkBackup']?_0x1e433a[_0x5ea8('0x3c')]:undefined;this[_0x5ea8('0x3d')]=_0x1e433a[_0x5ea8('0x3d')]||undefined;this['Interval']=_0x1e433a[_0x5ea8('0x3e')]?_0x1e433a[_0x5ea8('0x3e')]:undefined;this[_0x5ea8('0x3f')]=_0x1e433a[_0x5ea8('0x3f')]||_0x5ea8('0x40');this['dialRandomLastDigitCallerIdNumber']=_0x1e433a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5ea8('0x41')]=_0x1e433a[_0x5ea8('0x41')]||undefined;this[_0x5ea8('0x42')]=strategy[_0x1e433a[_0x5ea8('0x42')]]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x1e433a['dialAMDActive']||![];this[_0x5ea8('0x43')]=_0x1e433a[_0x5ea8('0x43')];this[_0x5ea8('0x44')]=_0x1e433a[_0x5ea8('0x44')];this[_0x5ea8('0x45')]=_0x1e433a['dialAMDAfterGreetingSilence'];this[_0x5ea8('0x46')]=_0x1e433a['dialAMDTotalAnalysisTime'];this[_0x5ea8('0x47')]=_0x1e433a[_0x5ea8('0x47')];this['dialAMDBetweenWordsSilence']=_0x1e433a['dialAMDBetweenWordsSilence'];this[_0x5ea8('0x48')]=_0x1e433a[_0x5ea8('0x48')];this[_0x5ea8('0x49')]=_0x1e433a[_0x5ea8('0x49')];this[_0x5ea8('0x4a')]=_0x1e433a[_0x5ea8('0x4a')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x5ea8('0x4b')]=_0x1e433a[_0x5ea8('0x4b')];this[_0x5ea8('0x4c')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5ea8('0x4d')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x5ea8('0x4e')]=0x0;this[_0x5ea8('0x4f')]=0x0;this[_0x5ea8('0x50')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x5ea8('0x51')]=0x0;this[_0x5ea8('0x52')]=0x0;this[_0x5ea8('0x53')]=0x0;this[_0x5ea8('0x54')]=0x0;this[_0x5ea8('0x55')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x5ea8('0x56')]=1.05;this[_0x5ea8('0x57')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5ea8('0x58')]=0x0;this[_0x5ea8('0x59')]=0x0;this[_0x5ea8('0x5a')]=0x0;this[_0x5ea8('0x5b')]=0x0;this[_0x5ea8('0x5c')]=0x0;this[_0x5ea8('0x5d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e433a[_0x5ea8('0x5e')]||0x14;this[_0x5ea8('0x5f')]=_0x1e433a['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x5ea8('0x60')]=0x0;this[_0x5ea8('0x61')]=0x1;this['erlangCalls']=0x0;this[_0x5ea8('0x62')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5ea8('0x63')]=0x0;this[_0x5ea8('0x64')]=_0x1e433a[_0x5ea8('0x64')]||0x1e;this[_0x5ea8('0x65')]=_0x1e433a['dialRecallInQueue']||![];this['dialQueueProject2']=_0x1e433a['dialQueueProject2']||undefined;this[_0x5ea8('0x66')]=_0x1e433a[_0x5ea8('0x66')]||![];this[_0x5ea8('0x67')]=_0x1e433a['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1e433a[_0x5ea8('0x8')]]?monitorFormat[_0x1e433a[_0x5ea8('0x8')]]:undefined;this['mandatoryDisposition']=_0x1e433a[_0x5ea8('0x68')]||![];this[_0x5ea8('0x69')]=_0x1e433a[_0x5ea8('0x69')]?_0x1e433a[_0x5ea8('0x69')]:undefined;}module[_0x5ea8('0x6a')]=VoiceQueue; \ No newline at end of file +var _0xa0ea=['dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','type','inbound','talking','total','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa0ea,0xb1));var _0xaa0e=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xa0ea[_0x286726];return _0xcd4fe9;};'use strict';var statusDesc=['unknown','not_inuse',_0xaa0e('0x0'),_0xaa0e('0x1'),_0xaa0e('0x2'),_0xaa0e('0x3'),_0xaa0e('0x4'),_0xaa0e('0x5'),_0xaa0e('0x6')];var monitorFormat={'wav':_0xaa0e('0x7'),'wav49':'wav49','gsm':_0xaa0e('0x8')};var strategy={'rrmemory':_0xaa0e('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x563988){this['id']=_0x563988['id']||0x0;this['name']=_0x563988[_0xaa0e('0xa')]||'';this['monitor_format']=_0x563988[_0xaa0e('0xb')]||'';this[_0xaa0e('0xc')]=_0x563988[_0xaa0e('0xc')]||_0xaa0e('0xd');this['waiting']=0x0;this[_0xaa0e('0xe')]=0x0;this[_0xaa0e('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xaa0e('0x10')]=0x0;this[_0xaa0e('0x11')]=0x0;this[_0xaa0e('0x12')]=0x0;this[_0xaa0e('0x13')]=0x0;this[_0xaa0e('0x14')]=0x0;this[_0xaa0e('0x15')]=0x0;this[_0xaa0e('0x16')]=_0x563988['acw']||![];this[_0xaa0e('0x17')]=_0x563988['acwTimeout']||0xa;this[_0xaa0e('0x18')]=_0x563988['autopause']||'no';this[_0xaa0e('0x19')]=!![];this[_0xaa0e('0x1a')]='';this[_0xaa0e('0x1b')]=0x0;this['temp']=0x0;this[_0xaa0e('0x1c')]=_0x563988[_0xaa0e('0x1c')]||null;this['dialGlobalInterval']=_0x563988[_0xaa0e('0x1d')]?_0x563988[_0xaa0e('0x1d')]:null;this['dialActive']=_0x563988['dialActive'];this[_0xaa0e('0x1e')]=_0x563988['dialMethod']||_0xaa0e('0x1f');this['dialLimitChannel']=_0x563988[_0xaa0e('0x20')]||0x0;this[_0xaa0e('0x21')]=_0x563988[_0xaa0e('0x21')]||0x0;this[_0xaa0e('0x22')]=_0x563988[_0xaa0e('0x22')]||0x1;this[_0xaa0e('0x23')]=_0x563988[_0xaa0e('0x23')]||_0xaa0e('0x24');this['dialPredictiveOptimizationPercentage']=_0x563988['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x563988[_0xaa0e('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x563988[_0xaa0e('0x26')]||'anonymous';this[_0xaa0e('0x27')]=_0x563988[_0xaa0e('0x27')]||_0xaa0e('0x28');this[_0xaa0e('0x29')]=_0x563988[_0xaa0e('0x29')]||0x1e;this[_0xaa0e('0x2a')]=_0x563988[_0xaa0e('0x2a')]||_0xaa0e('0x2b');this[_0xaa0e('0x2c')]=_0x563988[_0xaa0e('0x2c')]||0x3;this[_0xaa0e('0x2d')]=_0x563988[_0xaa0e('0x2d')]||undefined;this[_0xaa0e('0x2e')]=_0x563988[_0xaa0e('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x563988[_0xaa0e('0x2f')]||0x96;this[_0xaa0e('0x30')]=_0x563988[_0xaa0e('0x30')]||0x3;this[_0xaa0e('0x31')]=_0x563988[_0xaa0e('0x31')]||0x96;this[_0xaa0e('0x32')]=_0x563988[_0xaa0e('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x563988[_0xaa0e('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x563988[_0xaa0e('0x34')]||0x3;this[_0xaa0e('0x35')]=_0x563988[_0xaa0e('0x35')]||0x96;this[_0xaa0e('0x36')]=_0x563988[_0xaa0e('0x36')]||0x3;this[_0xaa0e('0x37')]=_0x563988['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x563988[_0xaa0e('0x38')]||0x3;this[_0xaa0e('0x39')]=_0x563988['dialAbandonedRetryFrequency']||0x96;this[_0xaa0e('0x3a')]=_0x563988[_0xaa0e('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x563988[_0xaa0e('0x3b')]||0x96;this[_0xaa0e('0x3c')]=_0x563988[_0xaa0e('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x563988['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x563988[_0xaa0e('0x3d')]||0x4;this['Trunk']=_0x563988[_0xaa0e('0x3e')]?_0x563988['Trunk']:undefined;this[_0xaa0e('0x3f')]=_0x563988[_0xaa0e('0x3f')]?_0x563988['TrunkBackup']:undefined;this['dialPrefix']=_0x563988['dialPrefix']||undefined;this[_0xaa0e('0x40')]=_0x563988['Interval']?_0x563988[_0xaa0e('0x40')]:undefined;this[_0xaa0e('0x41')]=_0x563988[_0xaa0e('0x41')]||_0xaa0e('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x563988[_0xaa0e('0x43')]||undefined;this[_0xaa0e('0x44')]=_0x563988['dialCutDigit']||undefined;this[_0xaa0e('0x45')]=strategy[_0x563988[_0xaa0e('0x45')]]||_0xaa0e('0x9');this[_0xaa0e('0x46')]=!![];this['dialAMDActive']=_0x563988[_0xaa0e('0x47')]||![];this[_0xaa0e('0x48')]=_0x563988[_0xaa0e('0x48')];this[_0xaa0e('0x49')]=_0x563988[_0xaa0e('0x49')];this[_0xaa0e('0x4a')]=_0x563988['dialAMDAfterGreetingSilence'];this[_0xaa0e('0x4b')]=_0x563988[_0xaa0e('0x4b')];this['dialAMDMinWordLength']=_0x563988[_0xaa0e('0x4c')];this['dialAMDBetweenWordsSilence']=_0x563988[_0xaa0e('0x4d')];this[_0xaa0e('0x4e')]=_0x563988[_0xaa0e('0x4e')];this[_0xaa0e('0x4f')]=_0x563988[_0xaa0e('0x4f')];this['dialAMDMaximumWordLength']=_0x563988['dialAMDMaximumWordLength'];this[_0xaa0e('0x50')]=0x0;this[_0xaa0e('0x51')]=0x0;this[_0xaa0e('0x52')]=_0x563988[_0xaa0e('0x52')];this[_0xaa0e('0x53')]=0x0;this[_0xaa0e('0x54')]=0x0;this[_0xaa0e('0x55')]=0x0;this[_0xaa0e('0x56')]=0x0;this[_0xaa0e('0x57')]=0x0;this[_0xaa0e('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xaa0e('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xaa0e('0x5a')]=0x0;this[_0xaa0e('0x5b')]=0x0;this[_0xaa0e('0x5c')]=0x0;this[_0xaa0e('0x5d')]=0x0;this[_0xaa0e('0x5e')]=0x0;this[_0xaa0e('0x5f')]=undefined;this[_0xaa0e('0x60')]=undefined;this[_0xaa0e('0x61')]=undefined;this[_0xaa0e('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xaa0e('0x63')]=0x0;this[_0xaa0e('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xaa0e('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xaa0e('0x66')]=0x0;this[_0xaa0e('0x67')]=0x0;this[_0xaa0e('0x68')]=_0x563988[_0xaa0e('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0x563988[_0xaa0e('0x69')]||0xa;this[_0xaa0e('0x6a')]=0x0;this[_0xaa0e('0x6b')]=0x0;this[_0xaa0e('0x6c')]=0x1;this[_0xaa0e('0x6d')]=0x0;this[_0xaa0e('0x6e')]=0x0;this[_0xaa0e('0x6f')]=0x0;this[_0xaa0e('0x70')]=0x0;this['dialRecallMeTimeout']=_0x563988['dialRecallMeTimeout']||0x1e;this[_0xaa0e('0x71')]=_0x563988['dialRecallInQueue']||![];this[_0xaa0e('0x72')]=_0x563988['dialQueueProject2']||undefined;this[_0xaa0e('0x73')]=_0x563988[_0xaa0e('0x73')]||![];this[_0xaa0e('0x74')]=_0x563988[_0xaa0e('0x74')]||![];this['monitor_format']=monitorFormat[_0x563988[_0xaa0e('0xb')]]?monitorFormat[_0x563988[_0xaa0e('0xb')]]:undefined;this['mandatoryDisposition']=_0x563988[_0xaa0e('0x75')]||![];this['mandatoryDispositionPause']=_0x563988['mandatoryDispositionPause']?_0x563988[_0xaa0e('0x76')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dd0cd1f..4991059 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 _0x8282=['username','accessKey','remoteUri','serverUrl','exports','name'];(function(_0x3648fc,_0x246391){var _0x4a25e3=function(_0x18cda0){while(--_0x18cda0){_0x3648fc['push'](_0x3648fc['shift']());}};_0x4a25e3(++_0x246391);}(_0x8282,0x1b5));var _0x2828=function(_0x2b6425,_0x495d41){_0x2b6425=_0x2b6425-0x0;var _0x59ed9f=_0x8282[_0x2b6425];return _0x59ed9f;};'use strict';function VtigerAccount(_0x1e9f5c){this['id']=_0x1e9f5c['id']||0x0;this['name']=_0x1e9f5c[_0x2828('0x0')]||'';this[_0x2828('0x1')]=_0x1e9f5c[_0x2828('0x1')]||'';this['accessKey']=_0x1e9f5c[_0x2828('0x2')]||'';this[_0x2828('0x3')]=_0x1e9f5c['remoteUri']||'';this[_0x2828('0x4')]=_0x1e9f5c[_0x2828('0x4')]||'';this['Configurations']=_0x1e9f5c['Configurations']||{};}module[_0x2828('0x5')]=VtigerAccount; \ No newline at end of file +var _0x10fa=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x28d03c,_0x32fbcf){var _0xd4c542=function(_0x55b2d3){while(--_0x55b2d3){_0x28d03c['push'](_0x28d03c['shift']());}};_0xd4c542(++_0x32fbcf);}(_0x10fa,0x105));var _0xa10f=function(_0x56dbdf,_0x165419){_0x56dbdf=_0x56dbdf-0x0;var _0xd8cabf=_0x10fa[_0x56dbdf];return _0xd8cabf;};'use strict';function VtigerAccount(_0x452099){this['id']=_0x452099['id']||0x0;this[_0xa10f('0x0')]=_0x452099[_0xa10f('0x0')]||'';this[_0xa10f('0x1')]=_0x452099[_0xa10f('0x1')]||'';this[_0xa10f('0x2')]=_0x452099[_0xa10f('0x2')]||'';this[_0xa10f('0x3')]=_0x452099[_0xa10f('0x3')]||'';this['serverUrl']=_0x452099[_0xa10f('0x4')]||'';this[_0xa10f('0x5')]=_0x452099[_0xa10f('0x5')]||{};}module[_0xa10f('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 8e9c165..9d6c2ff 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0xb90a9a,_0x3a76fe){var _0x503084=function(_0x2bdff4){while(--_0x2bdff4){_0xb90a9a['push'](_0xb90a9a['shift']());}};_0x503084(++_0x3a76fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x167971,_0xdaf84a){_0x167971=_0x167971-0x0;var _0x1a7451=_0x5f2f[_0x167971];return _0x1a7451;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x1c7af1,_0x3afbe6){var _0x46b8ab=function(_0x27a21d){while(--_0x27a21d){_0x1c7af1['push'](_0x1c7af1['shift']());}};_0x46b8ab(++_0x3afbe6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a8842ec..a4a964e 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 _0x56bd=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x17eec6,_0x54a955){var _0x1e4d32=function(_0x3d2e36){while(--_0x3d2e36){_0x17eec6['push'](_0x17eec6['shift']());}};_0x1e4d32(++_0x54a955);}(_0x56bd,0xe9));var _0xd56b=function(_0x1557cd,_0x10e953){_0x1557cd=_0x1557cd-0x0;var _0x1af4ff=_0x56bd[_0x1557cd];return _0x1af4ff;};'use strict';function ZohoAccount(_0x468322){this['id']=_0x468322['id']||0x0;this[_0xd56b('0x0')]=_0x468322[_0xd56b('0x0')]||'';this[_0xd56b('0x1')]=_0x468322['description']||'';this[_0xd56b('0x2')]=_0x468322[_0xd56b('0x2')]||'';this[_0xd56b('0x3')]=_0x468322[_0xd56b('0x3')]||'';this['clientId']=_0x468322[_0xd56b('0x4')]||'';this[_0xd56b('0x5')]=_0x468322[_0xd56b('0x5')]||'';this[_0xd56b('0x6')]=_0x468322[_0xd56b('0x6')]||'';this[_0xd56b('0x7')]=_0x468322[_0xd56b('0x7')]||'';this['refreshToken']=_0x468322[_0xd56b('0x8')]||'';this[_0xd56b('0x9')]=_0x468322[_0xd56b('0x9')]||{};}module[_0xd56b('0xa')]=ZohoAccount; \ No newline at end of file +var _0x3cd0=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','description','host'];(function(_0x20c139,_0x1676c4){var _0x49723e=function(_0x3c43c7){while(--_0x3c43c7){_0x20c139['push'](_0x20c139['shift']());}};_0x49723e(++_0x1676c4);}(_0x3cd0,0x8a));var _0x03cd=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0x3cd0[_0x5e2152];return _0x5ddcf6;};'use strict';function ZohoAccount(_0x330627){this['id']=_0x330627['id']||0x0;this['name']=_0x330627['name']||'';this[_0x03cd('0x0')]=_0x330627['description']||'';this[_0x03cd('0x1')]=_0x330627[_0x03cd('0x1')]||'';this[_0x03cd('0x2')]=_0x330627[_0x03cd('0x2')]||'';this[_0x03cd('0x3')]=_0x330627['clientId']||'';this[_0x03cd('0x4')]=_0x330627[_0x03cd('0x4')]||'';this[_0x03cd('0x5')]=_0x330627[_0x03cd('0x5')]||'';this[_0x03cd('0x6')]=_0x330627['code']||'';this[_0x03cd('0x7')]=_0x330627['refreshToken']||'';this[_0x03cd('0x8')]=_0x330627[_0x03cd('0x8')]||{};}module[_0x03cd('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ebc9b9c..58f44da 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 _0x1d93=['type','queue','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','number','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x1d93,0x1f1));var _0x31d9=function(_0x5db8b4,_0x54cbda){_0x5db8b4=_0x5db8b4-0x0;var _0x1af747=_0x1d93[_0x5db8b4];return _0x1af747;};'use strict';var util=require(_0x31d9('0x0'));var _=require(_0x31d9('0x1'));var moment=require(_0x31d9('0x2'));function checkNameSurname(_0x5948c2,_0x264788,_0x1b4136){var _0x2fc07b='';if(!_[_0x31d9('0x3')](_0x264788)&&_0x31d9('0x4')===typeof _0x264788){_0x2fc07b+=_0x264788;}if(!_[_0x31d9('0x3')](_0x1b4136)&&_0x31d9('0x4')===typeof _0x1b4136){_0x2fc07b+='\x20'+_0x1b4136;}if(_0x2fc07b!==''){return _0x2fc07b;}return _0x5948c2;}function Action(_0x13d1f8,_0x52cf2c,_0x308643,_0x37ae1a,_0x426b8d){this[_0x31d9('0x5')]=_0x308643||undefined;this[_0x31d9('0x6')]=_0x13d1f8['id'];this['queue']=_0x52cf2c['name'];this[_0x31d9('0x7')]=_0x52cf2c['type'];this['campaigntype']=_0x31d9('0x8');this[_0x31d9('0x9')]=![];this[_0x31d9('0xa')]=_[_0x31d9('0x3')](_0x13d1f8[_0x31d9('0xb')])?undefined:_0x13d1f8['Agent'][_0x31d9('0xc')];this[_0x31d9('0xd')]=this[_0x31d9('0xa')]?util[_0x31d9('0xe')](_0x31d9('0xf'),this['membername']):_0x37ae1a||undefined;this['calleridname']=checkNameSurname(_0x13d1f8[_0x31d9('0x10')][_0x31d9('0x11')],_0x13d1f8[_0x31d9('0x10')][_0x31d9('0x12')],_0x13d1f8['Contact'][_0x31d9('0x13')]);this[_0x31d9('0x14')]=_0x13d1f8['active']||![];this[_0x31d9('0x15')]=_0x13d1f8[_0x31d9('0x10')][_0x31d9('0x11')];this[_0x31d9('0x16')]=_0x13d1f8[_0x31d9('0x16')];this[_0x31d9('0x17')]=_0x13d1f8[_0x31d9('0x17')]||0x0;this[_0x31d9('0x18')]=_0x13d1f8[_0x31d9('0x18')]||0x0;this[_0x31d9('0x19')]=_0x13d1f8['countnoanswerretry']||0x0;this[_0x31d9('0x1a')]=(_0x13d1f8[_0x31d9('0x17')]||0x0)+(_0x13d1f8[_0x31d9('0x18')]||0x0)+(_0x13d1f8[_0x31d9('0x19')]||0x0)+(_0x13d1f8[_0x31d9('0x1b')]||0x0)+(_0x13d1f8[_0x31d9('0x1c')]||0x0)+(_0x13d1f8[_0x31d9('0x1d')]||0x0)+(_0x13d1f8[_0x31d9('0x1e')]||0x0)+(_0x13d1f8[_0x31d9('0x1f')]||0x0);this[_0x31d9('0x1b')]=_0x13d1f8[_0x31d9('0x1b')]||0x0;this[_0x31d9('0x1c')]=_0x13d1f8[_0x31d9('0x1c')]||0x0;this[_0x31d9('0x1d')]=_0x13d1f8[_0x31d9('0x1d')]||0x0;this[_0x31d9('0x1e')]=_0x13d1f8[_0x31d9('0x1e')]||0x0;this[_0x31d9('0x1f')]=_0x13d1f8[_0x31d9('0x1f')]||0x0;this['callback']=_0x13d1f8[_0x31d9('0x20')];this[_0x31d9('0x21')]=_0x13d1f8[_0x31d9('0x21')];this['callbackat']=_0x13d1f8['callbackat'];this[_0x31d9('0x22')]=_0x13d1f8[_0x31d9('0x22')];this[_0x31d9('0x23')]=_0x13d1f8[_0x31d9('0x23')];this[_0x31d9('0x24')]=_0x13d1f8[_0x31d9('0x24')];this[_0x31d9('0x25')]=_[_0x31d9('0x3')](_0x13d1f8[_0x31d9('0xb')])?_0x13d1f8[_0x31d9('0x25')]:_0x13d1f8[_0x31d9('0xb')]['id'];this[_0x31d9('0x26')]=_0x13d1f8[_0x31d9('0x26')];this['originatecalleridnum']='';this[_0x31d9('0x27')]='';}Action[_0x31d9('0x28')]['getCaller']=function(){return util[_0x31d9('0xe')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x31d9('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0xeeaf=['countbusyretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry'];(function(_0x4f0f27,_0x51deba){var _0x2ce661=function(_0x52a20f){while(--_0x52a20f){_0x4f0f27['push'](_0x4f0f27['shift']());}};_0x2ce661(++_0x51deba);}(_0xeeaf,0x69));var _0xfeea=function(_0x430d4f,_0x3415aa){_0x430d4f=_0x430d4f-0x0;var _0x336e76=_0xeeaf[_0x430d4f];return _0x336e76;};'use strict';var util=require(_0xfeea('0x0'));var _=require(_0xfeea('0x1'));var moment=require(_0xfeea('0x2'));function checkNameSurname(_0x5afa2c,_0x2b5f22,_0x54c3cf){var _0x34a7f0='';if(!_[_0xfeea('0x3')](_0x2b5f22)&&_0xfeea('0x4')===typeof _0x2b5f22){_0x34a7f0+=_0x2b5f22;}if(!_[_0xfeea('0x3')](_0x54c3cf)&&'string'===typeof _0x54c3cf){_0x34a7f0+='\x20'+_0x54c3cf;}if(_0x34a7f0!==''){return _0x34a7f0;}return _0x5afa2c;}function Action(_0x47e27d,_0x44941c,_0x2fe96b,_0x2b21ff,_0x4f4eb9){this[_0xfeea('0x5')]=_0x2fe96b||undefined;this[_0xfeea('0x6')]=_0x47e27d['id'];this[_0xfeea('0x7')]=_0x44941c[_0xfeea('0x8')];this[_0xfeea('0x9')]=_0x44941c[_0xfeea('0x9')];this[_0xfeea('0xa')]=_0xfeea('0x7');this[_0xfeea('0xb')]=![];this[_0xfeea('0xc')]=_[_0xfeea('0x3')](_0x47e27d[_0xfeea('0xd')])?undefined:_0x47e27d[_0xfeea('0xd')][_0xfeea('0x8')];this['channelAgent']=this[_0xfeea('0xc')]?util[_0xfeea('0xe')](_0xfeea('0xf'),this[_0xfeea('0xc')]):_0x2b21ff||undefined;this[_0xfeea('0x10')]=checkNameSurname(_0x47e27d[_0xfeea('0x11')]['phone'],_0x47e27d[_0xfeea('0x11')][_0xfeea('0x12')],_0x47e27d['Contact']['lastName']);this[_0xfeea('0x13')]=_0x47e27d['active']||![];this[_0xfeea('0x14')]=_0x47e27d['Contact']['phone'];this[_0xfeea('0x15')]=_0x47e27d['scheduledat'];this['countbusyretry']=_0x47e27d['countbusyretry']||0x0;this[_0xfeea('0x16')]=_0x47e27d[_0xfeea('0x16')]||0x0;this[_0xfeea('0x17')]=_0x47e27d[_0xfeea('0x17')]||0x0;this['countglobal']=(_0x47e27d[_0xfeea('0x18')]||0x0)+(_0x47e27d[_0xfeea('0x16')]||0x0)+(_0x47e27d[_0xfeea('0x17')]||0x0)+(_0x47e27d[_0xfeea('0x19')]||0x0)+(_0x47e27d['countdropretry']||0x0)+(_0x47e27d[_0xfeea('0x1a')]||0x0)+(_0x47e27d['countmachineretry']||0x0)+(_0x47e27d[_0xfeea('0x1b')]||0x0);this[_0xfeea('0x19')]=_0x47e27d[_0xfeea('0x19')]||0x0;this[_0xfeea('0x1c')]=_0x47e27d[_0xfeea('0x1c')]||0x0;this[_0xfeea('0x1a')]=_0x47e27d['countabandonedretry']||0x0;this[_0xfeea('0x1d')]=_0x47e27d[_0xfeea('0x1d')]||0x0;this['countagentrejectretry']=_0x47e27d[_0xfeea('0x1b')]||0x0;this[_0xfeea('0x1e')]=_0x47e27d['callback'];this[_0xfeea('0x1f')]=_0x47e27d[_0xfeea('0x1f')];this[_0xfeea('0x20')]=_0x47e27d[_0xfeea('0x20')];this[_0xfeea('0x21')]=_0x47e27d[_0xfeea('0x21')];this[_0xfeea('0x22')]=_0x47e27d[_0xfeea('0x22')];this[_0xfeea('0x23')]=_0x47e27d[_0xfeea('0x23')];this[_0xfeea('0x24')]=_[_0xfeea('0x3')](_0x47e27d['Agent'])?_0x47e27d['UserId']:_0x47e27d[_0xfeea('0xd')]['id'];this[_0xfeea('0x25')]=_0x47e27d[_0xfeea('0x25')];this[_0xfeea('0x26')]='';this[_0xfeea('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0xfeea('0xe')](_0xfeea('0x28'),this['calleridname'],this[_0xfeea('0x29')]);};module[_0xfeea('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 bc8c302..6d72160 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 _0x7ba2=['dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','responsetime','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','clearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pick','contactId','UserId','status','channel','No\x20such\x20channel','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','then','isNil','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]'];(function(_0x59b105,_0x370066){var _0x5b2ac5=function(_0xe4f0f5){while(--_0xe4f0f5){_0x59b105['push'](_0x59b105['shift']());}};_0x5b2ac5(++_0x370066);}(_0x7ba2,0xad));var _0x27ba=function(_0x596102,_0xf1607b){_0x596102=_0x596102-0x0;var _0x560896=_0x7ba2[_0x596102];return _0x560896;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x27ba('0x0'));var moment=require(_0x27ba('0x1'));var md5=require(_0x27ba('0x2'));var Redis=require(_0x27ba('0x3'));var config=require(_0x27ba('0x4'));var logger=require(_0x27ba('0x5'))(_0x27ba('0x6'));var loggerAction=require(_0x27ba('0x5'))(_0x27ba('0x7'));var ami=require(_0x27ba('0x8'));var rpcDb=require(_0x27ba('0x9'));var Action=require(_0x27ba('0xa'));var ut=require(_0x27ba('0xb'));config['redis']=_['defaults'](config[_0x27ba('0xc')],{'host':_0x27ba('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27ba('0xc')]));var Sequence=function(){};Sequence[_0x27ba('0xe')][_0x27ba('0xf')]=function(_0x2a2ea4){this[_0x27ba('0x10')]=this['tail']?this[_0x27ba('0x10')][_0x27ba('0x11')](_0x2a2ea4):_0x2a2ea4();};function Preview(_0x4b80c8){this[_0x27ba('0x12')]=new Sequence();this[_0x27ba('0x13')]=_0x4b80c8['voiceQueues'];this[_0x27ba('0x14')]=_0x4b80c8[_0x27ba('0x14')];this['actions']={};this[_0x27ba('0x15')]=_0x4b80c8['agents'];this[_0x27ba('0x16')]=0x0;ami['on'](_0x27ba('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x27ba('0x18'),this[_0x27ba('0x19')][_0x27ba('0x1a')](this));ami['on']('hanguprequest',this[_0x27ba('0x1b')][_0x27ba('0x1a')](this));ami['on'](_0x27ba('0x1c'),this[_0x27ba('0x1d')][_0x27ba('0x1a')](this));ami['on'](_0x27ba('0x1e'),this[_0x27ba('0x1f')]['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x27ba('0x20'),this['syncAttendedTransfer'][_0x27ba('0x1a')](this));ami['on'](_0x27ba('0x21'),this[_0x27ba('0x22')][_0x27ba('0x1a')](this));this[_0x27ba('0x23')](this['campaignsPreview']);}function emit(_0x436db6,_0xa284ef,_0x5ee4c1){io['to'](_0x436db6)[_0x27ba('0x24')](_0xa284ef,_0x5ee4c1);}function emitCampaignPreview(_0x68a0bb){if(_0x68a0bb[_0x27ba('0x25')]===_0x27ba('0x26')){var _0x2d26ab={'id':_0x68a0bb['id'],'name':_0x68a0bb[_0x27ba('0x27')],'strategy':_0x68a0bb[_0x27ba('0x28')],'answered':_0x68a0bb['answered'],'available':_0x68a0bb[_0x27ba('0x29')],'loggedIn':_0x68a0bb[_0x27ba('0x2a')],'pTalking':_0x68a0bb[_0x27ba('0x2b')],'sumBillable':_0x68a0bb[_0x27ba('0x2c')],'sumDuration':_0x68a0bb[_0x27ba('0x2d')],'sumHoldTime':_0x68a0bb[_0x27ba('0x2e')]||0x0,'talking':_0x68a0bb['talking'],'total':_0x68a0bb[_0x27ba('0x2f')],'type':_0x68a0bb[_0x27ba('0x25')],'unmanaged':_0x68a0bb['unmanaged'],'abandoned':_0x68a0bb['abandoned'],'waiting':_0x68a0bb[_0x27ba('0x30')],'loggedInDb':_0x68a0bb['loggedInDb'],'dialActive':_0x68a0bb[_0x27ba('0x31')],'dialMethod':_0x68a0bb[_0x27ba('0x32')],'dialOriginateCallerIdName':_0x68a0bb[_0x27ba('0x33')],'dialOriginateCallerIdNumber':_0x68a0bb[_0x27ba('0x34')],'dialOriginateTimeout':_0x68a0bb[_0x27ba('0x35')],'dialPrefix':_0x68a0bb['dialPrefix'],'outboundAnswerAgiCallsDay':_0x68a0bb[_0x27ba('0x36')],'outboundAnswerCallsDay':_0x68a0bb['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x68a0bb[_0x27ba('0x37')],'outboundBusyCallsDay':_0x68a0bb[_0x27ba('0x38')],'outboundCongestionCallsDay':_0x68a0bb[_0x27ba('0x39')],'outboundDropCallsDayACS':_0x68a0bb['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x68a0bb[_0x27ba('0x3a')],'outboundDropCallsDayTimeout':_0x68a0bb[_0x27ba('0x3b')],'outboundNoAnswerCallsDay':_0x68a0bb[_0x27ba('0x3c')],'outboundNoSuchCallsDay':_0x68a0bb['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x68a0bb[_0x27ba('0x3d')],'outboundReCallsDay':_0x68a0bb[_0x27ba('0x3e')],'outboundRejectCallsDay':_0x68a0bb[_0x27ba('0x3f')],'outboundUnknownCallsDay':_0x68a0bb['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x68a0bb[_0x27ba('0x40')],'predictiveIntervalAnsweredCalls':_0x68a0bb[_0x27ba('0x41')],'predictiveIntervalAvgHoldtime':_0x68a0bb[_0x27ba('0x42')],'predictiveIntervalAvgTalktime':_0x68a0bb[_0x27ba('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x68a0bb[_0x27ba('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x68a0bb[_0x27ba('0x45')],'predictiveIntervalErlangCalls':_0x68a0bb[_0x27ba('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x68a0bb[_0x27ba('0x47')],'predictiveIntervalHitRate':_0x68a0bb[_0x27ba('0x48')],'predictiveIntervalMultiplicativeFactor':_0x68a0bb['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x68a0bb[_0x27ba('0x49')],'predictiveIntervalAvailable':_0x68a0bb['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x68a0bb[_0x27ba('0x4a')],'message':_0x68a0bb[_0x27ba('0x4b')],'originated':_0x68a0bb[_0x27ba('0x4c')],'erlangCalls':_0x68a0bb[_0x27ba('0x4d')],'erlangCallToSecond':_0x68a0bb[_0x27ba('0x4e')],'erlangAbandonmentRate':_0x68a0bb[_0x27ba('0x4f')],'erlangBusyFactor':_0x68a0bb[_0x27ba('0x50')],'startPredictive':_0x68a0bb['startPredictive'],'startProgressive':_0x68a0bb['startProgressive']};if(_0x68a0bb[_0x27ba('0x51')]){_0x2d26ab[_0x27ba('0x51')]={'id':_0x68a0bb[_0x27ba('0x51')]['id'],'name':_0x68a0bb['Trunk'][_0x27ba('0x27')],'active':_0x68a0bb[_0x27ba('0x51')][_0x27ba('0x52')],'callerid':_0x68a0bb[_0x27ba('0x51')][_0x27ba('0x53')]};}if(_0x68a0bb[_0x27ba('0x54')]){_0x2d26ab[_0x27ba('0x54')]={'id':_0x68a0bb[_0x27ba('0x54')]['id'],'name':_0x68a0bb[_0x27ba('0x54')]['name']};}var _0x3a2cd2=md5(JSON[_0x27ba('0x55')](_0x2d26ab));if(_0x68a0bb[_0x27ba('0x2')]!==_0x3a2cd2){_0x68a0bb[_0x27ba('0x2')]=_0x3a2cd2;emit(util['format']('voice:queue:%s',_0x2d26ab['name']),_0x27ba('0x56'),_0x2d26ab);}}}function emitVoiceQueueChannelRemove(_0x1e7638){logger[_0x27ba('0x57')](_0x27ba('0x58'),JSON[_0x27ba('0x55')](_0x1e7638));emit(util['format'](_0x27ba('0x59'),_0x1e7638[_0x27ba('0x27')]),_0x27ba('0x5a'),_0x1e7638);}function notSendMessagesQueue(_0x53ca4a){if(_0x53ca4a['sendMessageOneNotActive']){if(_0x53ca4a['originated']===0x0&&_0x53ca4a[_0x27ba('0x2b')]===0x0){_0x53ca4a[_0x27ba('0x5b')]=![];_0x53ca4a[_0x27ba('0x29')]=0x0;_0x53ca4a[_0x27ba('0x5c')]=0x0;_0x53ca4a['message']=_0x27ba('0x5d');ut[_0x27ba('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x53ca4a['name']+_0x27ba('0x5f'));}else{_0x53ca4a[_0x27ba('0x4b')]=_0x27ba('0x60');ut['logger'](_0x27ba('0x61'),_0x53ca4a[_0x27ba('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x53ca4a);}}Preview[_0x27ba('0xe')][_0x27ba('0x23')]=function(){var _0x39467c=this;setInterval(function(){_0x39467c[_0x27ba('0x62')]();},0x7cf);};Preview[_0x27ba('0xe')][_0x27ba('0x62')]=function(){var _0x17e32e=this['campaignsPreview'];this[_0x27ba('0x16')]+=0x1;for(var _0x59eaba in _0x17e32e){if(_0x17e32e['hasOwnProperty'](_0x59eaba)&&(_0x17e32e[_0x59eaba][_0x27ba('0x32')]===_0x27ba('0x6')||_0x17e32e[_0x59eaba][_0x27ba('0x32')]==='booked')&&_0x17e32e[_0x59eaba][_0x27ba('0x25')]===_0x27ba('0x26')){if(this[_0x27ba('0x16')]>0x7){this[_0x27ba('0x16')]=0x0;this[_0x27ba('0x63')]();}}if(_0x17e32e[_0x27ba('0x64')](_0x59eaba)&&_0x17e32e[_0x59eaba]['dialMethod']===_0x27ba('0x6')&&_0x17e32e[_0x59eaba]['type']===_0x27ba('0x26')){if(_0x17e32e[_0x59eaba][_0x27ba('0x31')]){this[_0x27ba('0x65')](_0x17e32e[_0x59eaba]);this[_0x27ba('0x66')](_0x17e32e[_0x59eaba]);}else{notSendMessagesQueue(_0x17e32e[_0x59eaba]);}}}};Preview[_0x27ba('0xe')][_0x27ba('0x67')]=function(_0xbf6531){var _0x28ffe6=this;this['sequence'][_0x27ba('0xf')](function(){if(!_['isNil'](_0x28ffe6[_0x27ba('0x68')][_0xbf6531])){loggerAction[_0x27ba('0x57')](_0x27ba('0x69'),_0xbf6531,_0x27ba('0x6a'),_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x6b')],'originated:\x20',JSON['stringify'](_0x28ffe6[_0x27ba('0x13')][_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x6b')]][_0x27ba('0x4c')]),'pTalking:\x20',JSON[_0x27ba('0x55')](_0x28ffe6['campaignsPreview'][_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x6b')]][_0x27ba('0x2b')]),JSON[_0x27ba('0x55')](_0x28ffe6[_0x27ba('0x68')][_0xbf6531]['dialAnswer']),JSON['stringify'](_[_0x27ba('0x6c')](_0x28ffe6[_0x27ba('0x68')][_0xbf6531],[_0x27ba('0x6d'),_0x27ba('0x6e'),'VoiceQueueId','ListId'])));return ami['Action']({'action':_0x27ba('0x6f'),'channel':_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x70')]})['catch'](function(_0x14417b){if(_0x14417b[_0x27ba('0x4b')]===_0x27ba('0x71')){setTimeout(function(){if(_0x28ffe6[_0x27ba('0x68')][_0xbf6531]){ut['updateOriginated'](_0x28ffe6[_0x27ba('0x13')][_0x28ffe6['actions'][_0xbf6531][_0x27ba('0x6b')]],_0x27ba('0x72'));if(_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x73')]===!![]){ut[_0x27ba('0x74')](_0x28ffe6[_0x27ba('0x13')][_0x28ffe6['actions'][_0xbf6531]['queue']],_0x27ba('0x72'));ut[_0x27ba('0x75')](_0x27ba('0x76')+_0xbf6531,_0x28ffe6[_0x27ba('0x68')][_0xbf6531][_0x27ba('0x6b')]);}ut['loggerError'](_0x27ba('0x77')+_0xbf6531,_0x28ffe6['actions'][_0xbf6531][_0x27ba('0x6b')]);delete _0x28ffe6[_0x27ba('0x68')][_0xbf6531];}},0x2328);}});}});};Preview[_0x27ba('0xe')][_0x27ba('0x63')]=function(){var _0x547d0e=this;loggerAction[_0x27ba('0x57')](_0x27ba('0x78'),_['size'](this['actions']));for(var _0xf93048 in this[_0x27ba('0x68')]){if(_0x547d0e[_0x27ba('0x68')]['hasOwnProperty'](_0xf93048)){_0x547d0e[_0x27ba('0x67')](_0xf93048);}}};Preview[_0x27ba('0xe')][_0x27ba('0x66')]=function(_0xe6c473){var _0x2f07d6=this;rpcDb[_0x27ba('0x79')](_0xe6c473['id'],ut['agentReadyId'](this[_0x27ba('0x15')]))[_0x27ba('0x7a')](function(_0x43f92f){if(!_[_0x27ba('0x7b')](_0x43f92f)){for(var _0x181cd4=0x0;_0x181cd4<_0x43f92f[_0x27ba('0x7c')];_0x181cd4+=0x1){if(ut['getDiff'](_0x43f92f[_0x181cd4][_0x27ba('0x7d')])<_0xe6c473[_0x27ba('0x7e')]*0x3c){if(_0x43f92f[_0x181cd4][_0x27ba('0x7f')]&&!_0x43f92f[_0x181cd4][_0x27ba('0x7f')][_0x27ba('0x80')]){_0x2f07d6[_0x27ba('0x81')](_0x43f92f[_0x181cd4]['id'])[_0x27ba('0x7a')](ut['logger2'](_0x27ba('0x82')))[_0x27ba('0x83')](ut[_0x27ba('0x84')](_0x27ba('0x82')));}else{rpcDb[_0x27ba('0x85')](_0x43f92f[_0x181cd4]['id']);}}else{var _0x1db24a=new Action(_0x43f92f[_0x181cd4],_0xe6c473);_0x1db24a[_0x27ba('0x86')]=moment()[_0x27ba('0x87')](_0x27ba('0x88'));_0xe6c473[_0x27ba('0x3e')]+=0x1;ut['logCustomer'](_0x1db24a,0x17,_0x27ba('0x89'));if(_0xe6c473[_0x27ba('0x8a')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x43f92f[_0x181cd4]));rpcDb['createCustomerHistory'](_0x1db24a,_0x27ba('0x8b'));}else{ut['logCustomer'](_0x1db24a,0x16,_0x27ba('0x8c'));rpcDb[_0x27ba('0x8d')](_0x1db24a,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x1db24a,_0x27ba('0x8e'));}}}}})[_0x27ba('0x83')](ut[_0x27ba('0x84')]('[getContactRecallMe]'));};Preview[_0x27ba('0xe')][_0x27ba('0x65')]=function(_0x115351){_0x115351[_0x27ba('0x5b')]=!![];if(ut['IsNotLoggedIn'](_0x115351[_0x27ba('0x2a')])){_0x115351[_0x27ba('0x4b')]=_0x27ba('0x8f');}else if(!ut[_0x27ba('0x90')](_0x115351[_0x27ba('0x31')])){_0x115351[_0x27ba('0x4b')]=_0x27ba('0x5d');}else if(!this[_0x27ba('0x91')](_0x115351[_0x27ba('0x51')])){if(!this[_0x27ba('0x91')](_0x115351[_0x27ba('0x92')])){_0x115351[_0x27ba('0x4b')]=_0x27ba('0x93');}else{_0x115351[_0x27ba('0x4b')]='ACTIVE';}}else{_0x115351[_0x27ba('0x4b')]=_0x27ba('0x94');}emitCampaignPreview(_0x115351);};Preview[_0x27ba('0xe')][_0x27ba('0x95')]=function(_0xabc642,_0x1aa3c7,_0x544975){var _0x1c521c=this;var _0x2cf5db=this[_0x27ba('0x68')][_0x1aa3c7];var _0xe368b5=this['campaignsPreview'][_0x2cf5db[_0x27ba('0x6b')]];var _0x8140d6;if(_0xe368b5){switch(_0x544975){case'1':_0xe368b5[_0x27ba('0x96')]+=0x1;_0x2cf5db[_0x27ba('0x97')]+=0x1;_0x2cf5db[_0x27ba('0x98')]=ut[_0x27ba('0x99')](_0x2cf5db);ut[_0x27ba('0x9a')](_0x2cf5db,0x0,_0x27ba('0x9b'));ami[_0x27ba('0x24')]('custom:agentnosuchnumber',ut[_0x27ba('0x9c')](_0x2cf5db,_0x27ba('0x9d')));rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0x9e'));if(ut['totalGlobal'](_0x2cf5db)>=_0xe368b5[_0x27ba('0x9f')]){_0x8140d6=ut[_0x27ba('0xa0')](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb[_0x27ba('0xa2')](_0x8140d6,_0x27ba('0xa3'));}else{if(_0x2cf5db[_0x27ba('0x97')]>=_0xe368b5[_0x27ba('0xa4')]){rpcDb[_0x27ba('0xa2')](_0x2cf5db,_0x27ba('0xa3'));}else{rpcDb[_0x27ba('0xa5')](ut[_0x27ba('0xa6')](_0x2cf5db,_0x27ba('0x97'),_0xe368b5[_0x27ba('0xa7')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db['activeContact']);}}delete this[_0x27ba('0x68')][_0xabc642[_0x27ba('0xa9')]];break;case _0x27ba('0xaa'):var _0x330a5c=moment()[_0x27ba('0x87')](_0x27ba('0x88'));_0x2cf5db['responsetime']=_0x330a5c;_0x2cf5db['answertime']=_0x330a5c;_0x2cf5db['dialAnswer']=!![];_0xe368b5[_0x27ba('0x2b')]+=0x1;logger[_0x27ba('0x57')](_0x27ba('0xab'),_0x2cf5db[_0x27ba('0xac')],_0x27ba('0xad'),_0xe368b5[_0x27ba('0x27')],_0x27ba('0xae'),_0xe368b5[_0x27ba('0x2b')]);ami[_0x27ba('0x24')](_0x27ba('0xaf'),ut[_0x27ba('0x9c')](_0x2cf5db,'connect'));if(_0xe368b5[_0x27ba('0xb0')]){ami[_0x27ba('0x24')](_0x27ba('0xb1'),ut[_0x27ba('0xb2')](_0x2cf5db));}break;case'16':ami['emit'](_0x27ba('0xb3'),ut[_0x27ba('0x9c')](_0x2cf5db,'complete'));emitVoiceQueueChannelRemove(ut[_0x27ba('0x9c')](_0x2cf5db,_0x27ba('0xb4')));_0xe368b5['outboundAnswerCallsDay']+=0x1;_0xe368b5[_0x27ba('0x2f')]+=0x1;_0xe368b5[_0x27ba('0xb5')]+=0x1;ut['decrementTalkink'](_0xe368b5,_0x27ba('0xb6'));_0x2cf5db[_0x27ba('0x98')]=ut['totalGlobal'](_0x2cf5db);ut[_0x27ba('0x9a')](_0x2cf5db,0x4,_0x27ba('0xb7'));rpcDb['createCustomerHistory'](_0x2cf5db,_0x27ba('0xb8'));rpcDb[_0x27ba('0xa2')](_0x2cf5db,_0x27ba('0xb9'));rpcDb['crateCustomerReportQueue'](_0x2cf5db);_0xe368b5['sumDuration']+=_0x2cf5db[_0x27ba('0xba')];_0xe368b5[_0x27ba('0x2c')]+=_0x2cf5db['talktime'];logger[_0x27ba('0x57')](_0x27ba('0xbb'),_0x2cf5db['uniqueid'],'\x20Queue',_0xe368b5[_0x27ba('0x27')],'pTalking:\x20',_0xe368b5[_0x27ba('0x2b')]);delete this[_0x27ba('0x68')][_0xabc642[_0x27ba('0xa9')]];break;case'BUSY':_0xe368b5[_0x27ba('0x38')]+=0x1;_0x2cf5db['countbusyretry']+=0x1;_0x2cf5db['countglobal']=ut[_0x27ba('0x99')](_0x2cf5db);ut[_0x27ba('0x9a')](_0x2cf5db,0x5,_0x27ba('0xbc'));ami[_0x27ba('0x24')](_0x27ba('0xbd'),ut[_0x27ba('0x9c')](_0x2cf5db,_0x27ba('0xbe')));rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0xbf'));if(ut['totalGlobal'](_0x2cf5db)>=_0xe368b5['dialGlobalMaxRetry']){_0x8140d6=ut['cloneAction'](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb['createCustomerFinal'](_0x8140d6,_0x27ba('0xc0'));}else{if(_0x2cf5db[_0x27ba('0xc1')]>=_0xe368b5[_0x27ba('0xc2')]){rpcDb[_0x27ba('0xa2')](_0x2cf5db,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x27ba('0xa5')](ut['scheduledAt'](_0x2cf5db,_0x27ba('0xc1'),_0xe368b5[_0x27ba('0xc3')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db[_0x27ba('0xc4')]);}}break;case _0x27ba('0xc5'):_0xe368b5[_0x27ba('0x3c')]+=0x1;_0x2cf5db['countnoanswerretry']+=0x1;_0x2cf5db[_0x27ba('0x98')]=ut['totalGlobal'](_0x2cf5db);ut[_0x27ba('0x9a')](_0x2cf5db,0x3,_0x27ba('0xc6'));ami[_0x27ba('0x24')](_0x27ba('0xc7'),ut['buildObj'](_0x2cf5db,'noanswer'));rpcDb['createCustomerHistory'](_0x2cf5db,_0x27ba('0xc8'));if(ut[_0x27ba('0x99')](_0x2cf5db)>=_0xe368b5['dialGlobalMaxRetry']){_0x8140d6=ut[_0x27ba('0xa0')](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb[_0x27ba('0xa2')](_0x8140d6,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2cf5db[_0x27ba('0xc9')]>=_0xe368b5['dialNoAnswerMaxRetry']){rpcDb[_0x27ba('0xa2')](_0x2cf5db,_0x27ba('0xc8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2cf5db,_0x27ba('0xc9'),_0xe368b5[_0x27ba('0xca')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db[_0x27ba('0xc4')]);}}break;case _0x27ba('0xcb'):_0xe368b5[_0x27ba('0x39')]+=0x1;_0x2cf5db['countcongestionretry']+=0x1;_0x2cf5db[_0x27ba('0x98')]=ut[_0x27ba('0x99')](_0x2cf5db);ut[_0x27ba('0x9a')](_0x2cf5db,0x8,_0x27ba('0xcc'));ami[_0x27ba('0x24')](_0x27ba('0xcd'),ut[_0x27ba('0x9c')](_0x2cf5db,_0x27ba('0xce')));rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0xcf'));if(ut[_0x27ba('0x99')](_0x2cf5db)>=_0xe368b5['dialGlobalMaxRetry']){_0x8140d6=ut['cloneAction'](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb[_0x27ba('0xa2')](_0x8140d6,_0x27ba('0xd0'));}else{if(_0x2cf5db[_0x27ba('0xd1')]>=_0xe368b5['dialCongestionMaxRetry']){rpcDb[_0x27ba('0xa2')](_0x2cf5db,_0x27ba('0xcf'));}else{rpcDb[_0x27ba('0xa5')](ut[_0x27ba('0xa6')](_0x2cf5db,_0x27ba('0xd1'),_0xe368b5[_0x27ba('0xc3')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db[_0x27ba('0xc4')]);}}break;case'CANCEL':_0xe368b5[_0x27ba('0x3f')]+=0x1;_0x2cf5db[_0x27ba('0xd2')]+=0x1;_0x2cf5db[_0x27ba('0x98')]=ut[_0x27ba('0x99')](_0x2cf5db);ut['logCustomer'](_0x2cf5db,0x14,'AgentReject');ami[_0x27ba('0x24')](_0x27ba('0xd3'),ut[_0x27ba('0x9c')](_0x2cf5db,_0x27ba('0xd4')));rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0xd5'));if(ut[_0x27ba('0x99')](_0x2cf5db)>=_0xe368b5[_0x27ba('0x9f')]){_0x8140d6=ut[_0x27ba('0xa0')](_0x2cf5db,0x14,_0x27ba('0xd6'));rpcDb[_0x27ba('0xa2')](_0x8140d6,_0x27ba('0xd7'));}else{if(_0x2cf5db[_0x27ba('0xd2')]>=_0xe368b5['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x2cf5db,_0x27ba('0xd7'));}else{rpcDb['rescheduleContact'](ut[_0x27ba('0xa6')](_0x2cf5db,_0x27ba('0xd2'),_0xe368b5[_0x27ba('0xd8')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db[_0x27ba('0xc4')]);}}break;case'ABANDONED':_0xe368b5[_0x27ba('0x40')]+=0x1;_0x2cf5db['countabandonedretry']+=0x1;_0x2cf5db['countglobal']=ut[_0x27ba('0x99')](_0x2cf5db);ut['logCustomer'](_0x2cf5db,0xb,_0x27ba('0xd9'));rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0xda'));if(ut[_0x27ba('0x99')](_0x2cf5db)>=_0xe368b5[_0x27ba('0x9f')]){_0x8140d6=ut[_0x27ba('0xa0')](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb['createCustomerFinal'](_0x8140d6,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2cf5db[_0x27ba('0xdb')]>=_0xe368b5[_0x27ba('0xdc')]){rpcDb['createCustomerFinal'](_0x2cf5db,_0x27ba('0xda'));}else{rpcDb[_0x27ba('0xa5')](ut[_0x27ba('0xa6')](_0x2cf5db,_0x27ba('0xdd'),_0xe368b5[_0x27ba('0xde')]),_0x2cf5db[_0x27ba('0xa8')],_0x2cf5db[_0x27ba('0xc4')]);}}break;default:if(_0x2cf5db[_0x27ba('0x73')]){ut['decrementTalkink'](_0xe368b5,_0x27ba('0xdf'));ut[_0x27ba('0x75')](_0x27ba('0xe0')+_0xe368b5[_0x27ba('0x27')],_0xabc642);}_0xe368b5['outboundUnknownCallsDay']+=0x1;_0x2cf5db[_0x27ba('0x98')]=ut[_0x27ba('0x99')](_0x2cf5db);ut['logCustomer'](_0x2cf5db,0xc,_0xabc642[_0x27ba('0xe1')]||_0xabc642['dialstatus']);rpcDb[_0x27ba('0x8d')](_0x2cf5db,_0x27ba('0xe2'));if(ut[_0x27ba('0x99')](_0x2cf5db)>=_0xe368b5['dialGlobalMaxRetry']){_0x8140d6=ut['cloneAction'](_0x2cf5db,0xf,_0x27ba('0xa1'));rpcDb[_0x27ba('0xa2')](_0x8140d6,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x27ba('0xa2')](_0x2cf5db,_0x27ba('0xe3'));}delete this[_0x27ba('0x68')][_0xabc642[_0x27ba('0xa9')]];}if(!(_0x2cf5db[_0x27ba('0x73')]&&_0x544975==='16')){ut[_0x27ba('0xe4')](_0xe368b5,_0x27ba('0xe5'));logger[_0x27ba('0x57')]('[originated][decrement][callProgressDetectingCustomer]',_0x2cf5db[_0x27ba('0xac')],_0x27ba('0xad'),_0xe368b5[_0x27ba('0x27')],_0x27ba('0xe6'),_0xe368b5[_0x27ba('0x4c')]);}if(_0x544975!==_0x27ba('0xaa')){delete this['actions'][_0xabc642[_0x27ba('0xa9')]];delete this[_0x27ba('0x68')][_0xabc642[_0x27ba('0xe7')]];}}};Preview[_0x27ba('0xe')][_0x27ba('0xe8')]=function(_0xc5c01,_0x5f5917,_0x127e58){if(_[_0x27ba('0xe9')](_0x5f5917)&&'object'!==typeof _0x5f5917){return;}if(_['isUndefined'](_0x127e58)&&_0x27ba('0xea')!==typeof _0x127e58){return;}switch(_0x127e58[_0x27ba('0xeb')]){case'0':ut['logAgent'](_0xc5c01,0x0,_0x27ba('0x9b'));rpcDb['createAgentHistory'](_0xc5c01,_0x27ba('0xec'));break;case'3':ut[_0x27ba('0xed')](_0xc5c01,0x3,_0x27ba('0xc6'));rpcDb[_0x27ba('0xee')](_0xc5c01,_0x27ba('0xef'));break;case'5':ut[_0x27ba('0xed')](_0xc5c01,0x5,_0x27ba('0xbc'));rpcDb['createAgentHistory'](_0xc5c01,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x27ba('0xed')](_0xc5c01,0x8,_0x27ba('0xcc'));rpcDb['createAgentHistory'](_0xc5c01,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x27ba('0xed')](_0xc5c01,0x16,_0x27ba('0xf0'));rpcDb[_0x27ba('0xee')](_0xc5c01,_0x27ba('0xf1'));break;default:ut['logAgent'](_0xc5c01,0xc,_0x127e58[_0x27ba('0xeb')]);rpcDb[_0x27ba('0xee')](_0xc5c01,_0x27ba('0xf2'));}ut['updateOriginated'](_0x5f5917,'[callProgressDetectingAgent]');logger[_0x27ba('0x57')](_0x27ba('0xf3'),_0xc5c01[_0x27ba('0xac')],_0x27ba('0xad'),_0x5f5917[_0x27ba('0x27')],_0x27ba('0xe6'),_0x5f5917['originated']);delete this[_0x27ba('0x68')][_0xc5c01[_0x27ba('0xac')]];};Preview['prototype'][_0x27ba('0xf4')]=function(_0x466a0e,_0xcc55c8,_0x4fa7d7,_0x23e010,_0x1e9bf3){var _0x3bc447=this;return new BPromise(function(_0x43feed,_0x4fd6fd){if(_[_0x27ba('0x7b')](_0xcc55c8)||_[_0x27ba('0x7b')](_0xcc55c8['Contact'])||_[_0x27ba('0x7b')](_0xcc55c8[_0x27ba('0xf5')][_0x27ba('0xf6')])||_[_0x27ba('0x7b')](_0xcc55c8[_0x27ba('0xf7')])){_0x4fd6fd(ut[_0x27ba('0x4b')]('Contact\x20is\x20undefined',_0x23e010,_0x1e9bf3));return;}var _0x4f6e17=uuid['v4']();var _0x5d8b16=_0x3bc447['campaignsPreview'][_0xcc55c8[_0x27ba('0x6a')]['name']];var _0x3ba56f=_0x4fa7d7?_0x3bc447[_0x27ba('0x15')][_0x4fa7d7]['id']:undefined;_0x3bc447['actions'][_0x4f6e17]=new Action(_0xcc55c8,_0x5d8b16,_0x4f6e17,_0x4fa7d7,_0x3ba56f);var _0x1d4049=_0x3bc447['actions'][_0x4f6e17];_0x1d4049['unlockAgent']=_0x23e010;_0x1d4049['activeContact']=_0x1e9bf3;_0x1d4049[_0x27ba('0xf8')]=_0x4fa7d7;if(_[_0x27ba('0xf9')](_0x466a0e)){_0x3bc447[_0x27ba('0xfa')](_0x1d4049,_0x5d8b16,_0xcc55c8,_0x4fa7d7)[_0x27ba('0x7a')](function(_0x3adfa7){logger['info'](_0x27ba('0xfb'),_0x27ba('0xfc')+_0x1d4049[_0x27ba('0x6b')]+_0x27ba('0xfd')+_0x1d4049[_0x27ba('0xfe')],JSON[_0x27ba('0x55')](_0x3adfa7));ami[_0x27ba('0x24')](_0x27ba('0xff'),ut[_0x27ba('0x9c')](_0x1d4049,_0x27ba('0x100')));_0x43feed(ut[_0x27ba('0x4b')](_0x27ba('0x101')));})[_0x27ba('0x83')](function(_0x57e89c){ut[_0x27ba('0x5e')](_0x27ba('0x102'),_0x57e89c);_0x4fd6fd(ut[_0x27ba('0x4b')](_0x27ba('0x103'),_0x23e010,_0x1e9bf3));});}else{_0x5d8b16['outboundBlacklistCallsDay']+=0x1;ut[_0x27ba('0x104')](_0x1d4049);rpcDb['createHistory'](_0x1d4049,_0x27ba('0x105'));delete _0x3bc447[_0x27ba('0x68')][_0x4f6e17];_0x4fd6fd(ut['message'](_0x27ba('0x106'),_0x23e010,_0x1e9bf3));}});};Preview[_0x27ba('0xe')][_0x27ba('0x91')]=function(_0x19fe74){return!_['isNil'](_0x19fe74)&&!_[_0x27ba('0x7b')](_0x19fe74[_0x27ba('0x27')])&&!_[_0x27ba('0x7b')](_0x19fe74[_0x27ba('0x52')])&&_0x19fe74[_0x27ba('0x52')]&&!_[_0x27ba('0x7b')](this[_0x27ba('0x14')][util[_0x27ba('0x87')](_0x27ba('0x107'),_0x19fe74[_0x27ba('0x27')])])&&!_[_0x27ba('0x7b')](this['trunks'][util[_0x27ba('0x87')](_0x27ba('0x107'),_0x19fe74[_0x27ba('0x27')])][_0x27ba('0x6f')])&&(this['trunks'][util['format']('SIP/%s',_0x19fe74[_0x27ba('0x27')])][_0x27ba('0x6f')]===_0x27ba('0x108')||this[_0x27ba('0x14')][util['format'](_0x27ba('0x107'),_0x19fe74[_0x27ba('0x27')])][_0x27ba('0x6f')]===_0x27ba('0x109'));};Preview[_0x27ba('0xe')]['run']=function(_0x308c68,_0x42eea2){var _0x469389=this;return new BPromise(function(_0x25489b,_0x22546b){_0x469389[_0x27ba('0x10a')](_0x308c68,_0x42eea2)[_0x27ba('0x7a')](function(_0x31a755){_0x25489b(_[_0x27ba('0x6c')](_0x31a755,['message']));})['catch'](function(_0x241058){if(_0x241058[_0x27ba('0x10b')]){rpcDb[_0x27ba('0x10c')](_0x308c68);}if(_0x241058[_0x27ba('0x52')]){rpcDb[_0x27ba('0x85')](_0x308c68);}_0x22546b(_[_0x27ba('0x6c')](_0x241058,[_0x27ba('0x4b')]));});});};Preview[_0x27ba('0xe')]['execRun']=function(_0x131e26,_0x57a559){var _0x335cdf=this;return new BPromise(function(_0x16f827,_0xa473b){var _0x5e4281,_0x42f847;rpcDb[_0x27ba('0x10d')](_0x131e26)[_0x27ba('0x7a')](function(_0x21f021){if(!_[_0x27ba('0x7b')](_0x21f021[0x0])){_0x42f847=_0x21f021[0x0]['recallme']?![]:!![];_0x5e4281=_0x21f021[0x0][_0x27ba('0x10e')]?!![]:![];_0x5e4281=_0x57a559?!![]:_0x5e4281;}var _0x4e572a=_0x335cdf[_0x27ba('0x10f')](_0x21f021);if(_0x4e572a[_0x27ba('0x110')]){rpcDb[_0x27ba('0x111')](_[_0x27ba('0x6c')](_0x21f021[0x0],[_0x27ba('0xf7'),'Contact.phone']))[_0x27ba('0x7a')](function(_0x16b3f0){_0x335cdf[_0x27ba('0xf4')](_0x16b3f0,_0x21f021[0x0],_0x57a559,_0x42f847,_0x5e4281)[_0x27ba('0x7a')](function(_0x12d047){_0x16f827(_0x12d047);})['catch'](function(_0x3ed723){_0xa473b(_0x3ed723);});})['catch'](function(_0x1812fd){ut[_0x27ba('0x5e')](_0x27ba('0x112'),_0x1812fd);_0xa473b(ut['message'](_0x27ba('0x113'),_0x42f847,_0x5e4281));});}else{_0xa473b(ut[_0x27ba('0x4b')](_0x4e572a['message'],_0x42f847,_0x5e4281));}})[_0x27ba('0x83')](function(_0x42a843){ut['logger'](_0x27ba('0x114'),_0x42a843);_0xa473b(ut[_0x27ba('0x4b')](_0x27ba('0x113'),![],!![]));});});};Preview['prototype'][_0x27ba('0x10f')]=function(_0x24f63a){if(_[_0x27ba('0x7b')](_0x24f63a)||_['isEmpty'](_0x24f63a)||!_[_0x27ba('0x7b')](_0x24f63a[0x0][_0x27ba('0x7f')])&&_[_0x27ba('0x7b')](_0x24f63a[0x0][_0x27ba('0x7f')][_0x27ba('0x27')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x24f63a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x59ddce=this[_0x27ba('0x13')][_0x24f63a[0x0][_0x27ba('0x6a')][_0x27ba('0x27')]];_0x59ddce[_0x27ba('0x4b')]='ACTIVE';if(_[_0x27ba('0x7b')](_0x59ddce)){ut[_0x27ba('0x5e')](_0x27ba('0x115'),_0x59ddce);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x27ba('0x91')](_0x59ddce[_0x27ba('0x51')])){ut[_0x27ba('0x5e')](_0x27ba('0x116'),'campaign\x20Name:\x20'+_0x59ddce[_0x27ba('0x27')]+_0x27ba('0x117'));if(!this[_0x27ba('0x91')](_0x59ddce[_0x27ba('0x92')])){ut[_0x27ba('0x5e')](_0x27ba('0x116'),_0x59ddce[_0x27ba('0x27')]+_0x27ba('0x118'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x59ddce[_0x27ba('0x31')])){ut[_0x27ba('0x5e')](_0x27ba('0x119'),_0x59ddce[_0x27ba('0x27')]+_0x27ba('0x11a'));return{'isValid':![],'message':_0x27ba('0x11b')+_0x59ddce[_0x27ba('0x27')]+_0x27ba('0x11a')};}return{'isValid':!![],'message':_0x27ba('0x11c')};};Preview['prototype'][_0x27ba('0xfa')]=function(_0x3c29aa,_0xce773e,_0x2e9b85,_0x306d06){var _0x3d921c=this;return new BPromise(function(_0x411811,_0x588c31){var _0x112967=_0x3c29aa[_0x27ba('0xac')];var _0x288607=_0x3d921c[_0x27ba('0x91')](_0xce773e['Trunk'])?util['format'](_0x27ba('0x11d'),_0xce773e[_0x27ba('0x51')][_0x27ba('0x27')],_[_0x27ba('0x7b')](_0xce773e[_0x27ba('0x11e')])?'':_0xce773e['dialPrefix'][_0x27ba('0x11f')]()||'',_0xce773e[_0x27ba('0x120')]>0x0?_0x2e9b85[_0x27ba('0xf5')][_0x27ba('0xf6')]['substring'](_0xce773e[_0x27ba('0x120')]):_0x2e9b85[_0x27ba('0xf5')][_0x27ba('0xf6')]):util[_0x27ba('0x87')](_0x27ba('0x11d'),_[_0x27ba('0x7b')](_0xce773e[_0x27ba('0x92')])?_0xce773e[_0x27ba('0x51')][_0x27ba('0x27')]:_0xce773e[_0x27ba('0x92')][_0x27ba('0x27')],_[_0x27ba('0x7b')](_0xce773e[_0x27ba('0x11e')])?'':_0xce773e[_0x27ba('0x11e')][_0x27ba('0x11f')]()||'',_0xce773e[_0x27ba('0x120')]>0x0?_0x2e9b85['Contact']['phone'][_0x27ba('0x121')](_0xce773e['dialCutDigit']):_0x2e9b85[_0x27ba('0xf5')]['phone']);var _0x1b5403=_0x3d921c['isTrunkReachable'](_0xce773e[_0x27ba('0x51')])?ut[_0x27ba('0x122')](_0xce773e[_0x27ba('0x51')][_0x27ba('0x53')],_0xce773e[_0x27ba('0x33')],_0xce773e[_0x27ba('0x123')]>0x0?ut[_0x27ba('0x124')](_0xce773e['dialOriginateCallerIdNumber'],_0xce773e[_0x27ba('0x123')]):_0xce773e[_0x27ba('0x34')]):ut[_0x27ba('0x122')](_[_0x27ba('0x7b')](_0xce773e[_0x27ba('0x92')])?_0xce773e[_0x27ba('0x51')][_0x27ba('0x53')]:_0xce773e[_0x27ba('0x92')]['callerid'],_0xce773e[_0x27ba('0x33')],_0xce773e[_0x27ba('0x123')]>0x0?ut[_0x27ba('0x124')](_0xce773e['dialOriginateCallerIdNumber'],_0xce773e['dialRandomLastDigitCallerIdNumber']):_0xce773e[_0x27ba('0x34')]);if(_0x1b5403){_0x3c29aa[_0x27ba('0x125')]=ut[_0x27ba('0x126')](_0x1b5403);_0x3c29aa[_0x27ba('0x127')]=ut[_0x27ba('0x128')](_0x1b5403);}var _0x2f62c6=ut[_0x27ba('0x129')](_0xce773e,_0x2e9b85,_0x288607,_0x1b5403,_0x112967,_0x3c29aa);_[_0x27ba('0x12a')](_0x3c29aa,ut[_0x27ba('0x12b')](_0x2f62c6));_0x3c29aa['starttime']=moment()[_0x27ba('0x87')](_0x27ba('0x88'));ami[_0x27ba('0x12c')](ut[_0x27ba('0x12d')](_0x3c29aa,_0xce773e,_0x2f62c6,_0x3c29aa[_0x27ba('0xc4')],_0x306d06))[_0x27ba('0x7a')](function(_0x449574){_0xce773e['originated']+=0x1;logger['info'](_0x27ba('0x12e'),_0x112967,'\x20Queue',_0xce773e[_0x27ba('0x27')],_0x27ba('0xe6'),_0xce773e['originated']);_0x411811(_0x449574);})['catch'](function(_0x812d43){ut[_0x27ba('0xed')](_0x3c29aa,0xe,_0x27ba('0x12f'));rpcDb['createAgentHistory'](_0x3c29aa,_0x27ba('0x130'));_0x588c31(_0x812d43);});});};Preview[_0x27ba('0xe')][_0x27ba('0x1f')]=function(_0x153c31){if(this['actions'][_0x153c31[_0x27ba('0xa9')]]){this[_0x27ba('0x68')][_0x153c31[_0x27ba('0xa9')]][_0x27ba('0x70')]=_0x153c31[_0x27ba('0x70')];}};Preview['prototype'][_0x27ba('0x131')]=function(_0x5cda3d){var _0x100b16=this;var _0x57668d=this[_0x27ba('0x68')][_0x5cda3d[_0x27ba('0x132')]];if(_0x57668d){if(_0x57668d[_0x27ba('0xf8')]&&this[_0x27ba('0x15')][_0x57668d[_0x27ba('0xf8')]]){ut[_0x27ba('0x133')](_0x57668d,this['agents'][_0x57668d['lookAgent']][_0x27ba('0x27')],this[_0x27ba('0x15')][_0x57668d[_0x27ba('0xf8')]]['id']);}var _0x4fe5b7=_['clone'](_0x57668d);_0x4fe5b7[_0x27ba('0x134')]=moment()[_0x27ba('0x87')](_0x27ba('0x88'));var _0x1dc0f4=_0x100b16['campaignsPreview'][_0x57668d[_0x27ba('0x6b')]];if(ut[_0x27ba('0x135')](_0x5cda3d['response'])){if(_0x57668d['unlockAgent']){rpcDb[_0x27ba('0x10c')](_0x57668d['idContact']);}if(_0x57668d['activeContact']){rpcDb[_0x27ba('0x85')](_0x57668d['idContact']);}ami[_0x27ba('0x24')]('custom:agentringnoanswer',ut['buildObj'](_0x57668d,_0x27ba('0x136')));this[_0x27ba('0xe8')](_0x4fe5b7,_0x1dc0f4,_0x5cda3d);}else{_0x57668d[_0x27ba('0x86')]=moment()['format'](_0x27ba('0x88'));ut['logAgent'](_0x4fe5b7,0x4,_0x27ba('0xb7'));rpcDb[_0x27ba('0xee')](_0x4fe5b7,_0x27ba('0x137'));}}};Preview[_0x27ba('0xe')]['syncHangup']=function(_0x23c9d4){var _0x5715b8=this;var _0x3b0807=this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]];var _0x59b040;if(_0x3b0807){_0x59b040=this[_0x27ba('0x13')][_0x3b0807['queue']];logger[_0x27ba('0x57')](_0x27ba('0x138'),_0x23c9d4[_0x27ba('0xa9')],_0x27ba('0xad'),_0x59b040['name'],_0x27ba('0xae'),_0x59b040[_0x27ba('0x2b')]);}if(this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]]&&_0x23c9d4[_0x27ba('0xa9')]!==_0x23c9d4[_0x27ba('0xac')]){if(_0x23c9d4[_0x27ba('0x139')]==='16'&&this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]][_0x27ba('0x73')]){this[_0x27ba('0x95')](_0x23c9d4,_0x23c9d4[_0x27ba('0xa9')],_0x23c9d4[_0x27ba('0x139')]);}else if(this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]]['dialAnswer']){logger['info'](_0x27ba('0x13a'),_0x23c9d4['linkedid'],_0x23c9d4[_0x27ba('0x139')],_0x27ba('0xad'),_0x59b040['name'],_0x27ba('0xae'),_0x59b040['pTalking']);this[_0x27ba('0x95')](_0x23c9d4,_0x23c9d4['linkedid'],_0x23c9d4[_0x27ba('0x139')]);}}else if(_0x3b0807&&_['isNil'](_0x3b0807[_0x27ba('0x13b')])&&_0x59b040[_0x27ba('0x13c')]&&_0x23c9d4['linkedid']===_0x23c9d4[_0x27ba('0xac')]&&_[_0x27ba('0x7b')](_0x23c9d4[_0x27ba('0xeb')])&&_0x23c9d4['cause']==='16'&&_0x23c9d4['channelstate']==='6'&&_['isUndefined'](_0x3b0807['transfer'])){if(_0x3b0807['unlockAgent']){rpcDb[_0x27ba('0x10c')](_0x3b0807[_0x27ba('0xfe')]);}if(_0x3b0807[_0x27ba('0xc4')]){rpcDb['disableContact'](_0x3b0807['idContact']);}_0x23c9d4[_0x27ba('0xeb')]='22';this[_0x27ba('0xe8')](_0x3b0807,_0x59b040,_0x23c9d4);}else if(_0x3b0807&&_0x3b0807[_0x27ba('0x13d')]){if(_0x23c9d4[_0x27ba('0x139')]==='16'&&this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]]['dialAnswer']){logger[_0x27ba('0x57')](_0x27ba('0x13e'),_0x23c9d4['linkedid'],_0x23c9d4[_0x27ba('0x139')],'\x20Queue',_0x59b040['name'],'pTalking:\x20',_0x59b040[_0x27ba('0x2b')]);this[_0x27ba('0x95')](_0x23c9d4,_0x23c9d4['linkedid'],_0x23c9d4[_0x27ba('0x139')]);}else if(this[_0x27ba('0x68')][_0x23c9d4[_0x27ba('0xa9')]][_0x27ba('0x73')]){logger[_0x27ba('0x57')](_0x27ba('0x13a'),_0x23c9d4[_0x27ba('0xa9')],_0x23c9d4[_0x27ba('0x139')],_0x27ba('0xad'),_0x59b040[_0x27ba('0x27')],_0x27ba('0xae'),_0x59b040[_0x27ba('0x2b')]);this['callProgressDetectingCustomer'](_0x23c9d4,_0x23c9d4[_0x27ba('0xa9')],_0x23c9d4[_0x27ba('0x139')]);}}};Preview[_0x27ba('0xe')][_0x27ba('0x1d')]=function(_0x27acee){if(this[_0x27ba('0x68')][_0x27acee[_0x27ba('0xe7')]]&&_0x27acee['destlinkedid']!==_0x27acee[_0x27ba('0x13f')]){this[_0x27ba('0x95')](_0x27acee,_0x27acee[_0x27ba('0xe7')],_0x27acee[_0x27ba('0x140')]);}};Preview[_0x27ba('0xe')]['syncHangupRequest']=function(_0x216d69){if(this[_0x27ba('0x68')][_0x216d69['linkedid']]&&_0x216d69[_0x27ba('0xa9')]!==_0x216d69['uniqueid']&&!this[_0x27ba('0x68')][_0x216d69[_0x27ba('0xa9')]][_0x27ba('0x73')]){if(_0x216d69[_0x27ba('0x139')]==='1'){this[_0x27ba('0x95')](_0x216d69,_0x216d69[_0x27ba('0xa9')],_0x216d69[_0x27ba('0x139')]);}}};Preview[_0x27ba('0xe')][_0x27ba('0x141')]=function(_0x9153ce,_0x19c0bd,_0x147f79){if(this[_0x27ba('0x68')][_0x9153ce]){if(_['isNil'](this[_0x27ba('0x68')][_0x9153ce]['variables'])){this[_0x27ba('0x68')][_0x9153ce][_0x27ba('0x142')]={};}this[_0x27ba('0x68')][_0x9153ce][_0x27ba('0x142')][_0x19c0bd]=_0x147f79;}};Preview[_0x27ba('0xe')]['syncVarSet']=function(_0x2e74d4){try{if(!_[_0x27ba('0x7b')](_0x2e74d4)){if(ut[_0x27ba('0x143')](_[_0x27ba('0x144')](_0x2e74d4[_0x27ba('0x145')])[0x0])){this[_0x27ba('0x141')](_0x2e74d4['uniqueid'],_[_0x27ba('0x144')](_0x2e74d4[_0x27ba('0x145')])[0x0],_0x2e74d4[_0x27ba('0x146')]);}}}catch(_0x459445){logger['error'](_0x27ba('0x147'),util['inspect'](_0x459445,{'showHidden':![],'depth':null}));}};Preview[_0x27ba('0xe')][_0x27ba('0x148')]=function(_0xfd205f){if(_0xfd205f){if(this[_0x27ba('0x68')][_0xfd205f[_0x27ba('0x149')]]){this[_0x27ba('0x68')][_0xfd205f[_0x27ba('0x149')]][_0x27ba('0x13d')]=!![];}}};Preview['prototype'][_0x27ba('0x22')]=function(_0x10179d){if(_0x10179d){if(this['actions'][_0x10179d['transfererlinkedid']]){this['actions'][_0x10179d[_0x27ba('0x14a')]][_0x27ba('0x13d')]=!![];}}};module[_0x27ba('0x14b')]=Preview; \ No newline at end of file +var _0x2b98=['../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','voice:queue:%s','info','format','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','then','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','complete','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','uniqueid','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','value','error','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','lodash','bluebird','uuid','moment','md5','ioredis','preview'];(function(_0x38bdde,_0x171733){var _0x5dedb9=function(_0x26cd3f){while(--_0x26cd3f){_0x38bdde['push'](_0x38bdde['shift']());}};_0x5dedb9(++_0x171733);}(_0x2b98,0x141));var _0x82b9=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x2b98[_0x3b5250];return _0xc844a1;};'use strict';var util=require('util');var _=require(_0x82b9('0x0'));var BPromise=require(_0x82b9('0x1'));var uuid=require(_0x82b9('0x2'));var moment=require(_0x82b9('0x3'));var md5=require(_0x82b9('0x4'));var Redis=require(_0x82b9('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x82b9('0x6'));var loggerAction=require(_0x82b9('0x7'))(_0x82b9('0x8'));var ami=require(_0x82b9('0x9'));var rpcDb=require(_0x82b9('0xa'));var Action=require(_0x82b9('0xb'));var ut=require(_0x82b9('0xc'));config[_0x82b9('0xd')]=_[_0x82b9('0xe')](config['redis'],{'host':_0x82b9('0xf'),'port':0x18eb});var io=require(_0x82b9('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x82b9('0x11')]['enqueue']=function(_0x2e9254){this[_0x82b9('0x12')]=this[_0x82b9('0x12')]?this[_0x82b9('0x12')]['finally'](_0x2e9254):_0x2e9254();};function Preview(_0x5bb192){this['sequence']=new Sequence();this[_0x82b9('0x13')]=_0x5bb192[_0x82b9('0x14')];this[_0x82b9('0x15')]=_0x5bb192[_0x82b9('0x15')];this[_0x82b9('0x16')]={};this['agents']=_0x5bb192[_0x82b9('0x17')];this[_0x82b9('0x18')]=0x0;ami['on'](_0x82b9('0x19'),this[_0x82b9('0x1a')][_0x82b9('0x1b')](this));ami['on'](_0x82b9('0x1c'),this[_0x82b9('0x1d')][_0x82b9('0x1b')](this));ami['on'](_0x82b9('0x1e'),this['syncHangupRequest'][_0x82b9('0x1b')](this));ami['on'](_0x82b9('0x1f'),this[_0x82b9('0x20')][_0x82b9('0x1b')](this));ami['on']('newexten',this[_0x82b9('0x21')]['bind'](this));ami['on'](_0x82b9('0x22'),this[_0x82b9('0x23')][_0x82b9('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x82b9('0x1b')](this));ami['on'](_0x82b9('0x24'),this['syncBlindTransfer'][_0x82b9('0x1b')](this));this[_0x82b9('0x25')](this[_0x82b9('0x13')]);}function emit(_0x298847,_0x2d2aca,_0x274876){io['to'](_0x298847)[_0x82b9('0x26')](_0x2d2aca,_0x274876);}function emitCampaignPreview(_0x32a221){if(_0x32a221[_0x82b9('0x27')]===_0x82b9('0x28')){var _0x1357c3={'id':_0x32a221['id'],'name':_0x32a221[_0x82b9('0x29')],'strategy':_0x32a221[_0x82b9('0x2a')],'answered':_0x32a221[_0x82b9('0x2b')],'available':_0x32a221[_0x82b9('0x2c')],'loggedIn':_0x32a221['loggedIn'],'pTalking':_0x32a221[_0x82b9('0x2d')],'sumBillable':_0x32a221['sumBillable'],'sumDuration':_0x32a221[_0x82b9('0x2e')],'sumHoldTime':_0x32a221[_0x82b9('0x2f')]||0x0,'talking':_0x32a221['talking'],'total':_0x32a221[_0x82b9('0x30')],'type':_0x32a221['type'],'unmanaged':_0x32a221[_0x82b9('0x31')],'abandoned':_0x32a221[_0x82b9('0x32')],'waiting':_0x32a221[_0x82b9('0x33')],'loggedInDb':_0x32a221[_0x82b9('0x34')],'dialActive':_0x32a221[_0x82b9('0x35')],'dialMethod':_0x32a221[_0x82b9('0x36')],'dialOriginateCallerIdName':_0x32a221[_0x82b9('0x37')],'dialOriginateCallerIdNumber':_0x32a221['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x32a221[_0x82b9('0x38')],'dialPrefix':_0x32a221[_0x82b9('0x39')],'outboundAnswerAgiCallsDay':_0x32a221[_0x82b9('0x3a')],'outboundAnswerCallsDay':_0x32a221[_0x82b9('0x3b')],'outboundBlacklistCallsDay':_0x32a221[_0x82b9('0x3c')],'outboundBusyCallsDay':_0x32a221[_0x82b9('0x3d')],'outboundCongestionCallsDay':_0x32a221[_0x82b9('0x3e')],'outboundDropCallsDayACS':_0x32a221[_0x82b9('0x3f')],'outboundDropCallsDayCallersExit':_0x32a221['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x32a221['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x32a221[_0x82b9('0x40')],'outboundNoSuchCallsDay':_0x32a221[_0x82b9('0x41')],'outboundOriginateFailureCallsDay':_0x32a221[_0x82b9('0x42')],'outboundReCallsDay':_0x32a221[_0x82b9('0x43')],'outboundRejectCallsDay':_0x32a221[_0x82b9('0x44')],'outboundUnknownCallsDay':_0x32a221[_0x82b9('0x45')],'outboundAbandonedCallsDay':_0x32a221[_0x82b9('0x46')],'predictiveIntervalAnsweredCalls':_0x32a221[_0x82b9('0x47')],'predictiveIntervalAvgHoldtime':_0x32a221[_0x82b9('0x48')],'predictiveIntervalAvgTalktime':_0x32a221[_0x82b9('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x32a221['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x32a221['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x32a221['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x32a221[_0x82b9('0x4a')],'predictiveIntervalHitRate':_0x32a221[_0x82b9('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x32a221[_0x82b9('0x4c')],'predictiveIntervalPauses':_0x32a221['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x32a221[_0x82b9('0x4d')],'predictiveIntervalTotalCalls':_0x32a221[_0x82b9('0x4e')],'message':_0x32a221['message'],'originated':_0x32a221[_0x82b9('0x4f')],'erlangCalls':_0x32a221[_0x82b9('0x50')],'erlangCallToSecond':_0x32a221['erlangCallToSecond'],'erlangAbandonmentRate':_0x32a221[_0x82b9('0x51')],'erlangBusyFactor':_0x32a221[_0x82b9('0x52')],'startPredictive':_0x32a221[_0x82b9('0x53')],'startProgressive':_0x32a221[_0x82b9('0x54')]};if(_0x32a221[_0x82b9('0x55')]){_0x1357c3[_0x82b9('0x55')]={'id':_0x32a221['Trunk']['id'],'name':_0x32a221[_0x82b9('0x55')][_0x82b9('0x29')],'active':_0x32a221[_0x82b9('0x55')]['active'],'callerid':_0x32a221['Trunk'][_0x82b9('0x56')]};}if(_0x32a221['Interval']){_0x1357c3[_0x82b9('0x57')]={'id':_0x32a221['Interval']['id'],'name':_0x32a221[_0x82b9('0x57')][_0x82b9('0x29')]};}var _0x2c298a=md5(JSON[_0x82b9('0x58')](_0x1357c3));if(_0x32a221[_0x82b9('0x4')]!==_0x2c298a){_0x32a221[_0x82b9('0x4')]=_0x2c298a;emit(util['format'](_0x82b9('0x59'),_0x1357c3[_0x82b9('0x29')]),'voice_queue:save',_0x1357c3);}}}function emitVoiceQueueChannelRemove(_0x4f5c8f){logger[_0x82b9('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x82b9('0x58')](_0x4f5c8f));emit(util[_0x82b9('0x5b')]('voice:queue:%s',_0x4f5c8f[_0x82b9('0x29')]),_0x82b9('0x5c'),_0x4f5c8f);}function notSendMessagesQueue(_0x4fd9a7){if(_0x4fd9a7[_0x82b9('0x5d')]){if(_0x4fd9a7[_0x82b9('0x4f')]===0x0&&_0x4fd9a7[_0x82b9('0x2d')]===0x0){_0x4fd9a7[_0x82b9('0x5d')]=![];_0x4fd9a7[_0x82b9('0x2c')]=0x0;_0x4fd9a7[_0x82b9('0x5e')]=0x0;_0x4fd9a7[_0x82b9('0x5f')]=_0x82b9('0x60');ut['logger'](_0x82b9('0x61'),_0x4fd9a7[_0x82b9('0x29')]+_0x82b9('0x62'));}else{_0x4fd9a7['message']='IS_DISACTIVED';ut[_0x82b9('0x63')](_0x82b9('0x61'),_0x4fd9a7[_0x82b9('0x29')]+_0x82b9('0x64'));}emitCampaignPreview(_0x4fd9a7);}}Preview[_0x82b9('0x11')]['loopCampaigns']=function(){var _0x434171=this;setInterval(function(){_0x434171[_0x82b9('0x65')]();},0x7cf);};Preview[_0x82b9('0x11')][_0x82b9('0x65')]=function(){var _0x23ddc4=this[_0x82b9('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x2bb6a1 in _0x23ddc4){if(_0x23ddc4[_0x82b9('0x66')](_0x2bb6a1)&&(_0x23ddc4[_0x2bb6a1][_0x82b9('0x36')]===_0x82b9('0x6')||_0x23ddc4[_0x2bb6a1][_0x82b9('0x36')]===_0x82b9('0x67'))&&_0x23ddc4[_0x2bb6a1][_0x82b9('0x27')]===_0x82b9('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0x82b9('0x18')]=0x0;this[_0x82b9('0x68')]();}}if(_0x23ddc4['hasOwnProperty'](_0x2bb6a1)&&_0x23ddc4[_0x2bb6a1]['dialMethod']==='preview'&&_0x23ddc4[_0x2bb6a1][_0x82b9('0x27')]==='outbound'){if(_0x23ddc4[_0x2bb6a1][_0x82b9('0x35')]){this[_0x82b9('0x69')](_0x23ddc4[_0x2bb6a1]);this[_0x82b9('0x6a')](_0x23ddc4[_0x2bb6a1]);}else{notSendMessagesQueue(_0x23ddc4[_0x2bb6a1]);}}}};Preview[_0x82b9('0x11')]['clearZombieChannel']=function(_0x49dbce){var _0x341a7d=this;this[_0x82b9('0x6b')]['enqueue'](function(){if(!_[_0x82b9('0x6c')](_0x341a7d['actions'][_0x49dbce])){loggerAction[_0x82b9('0x5a')](_0x82b9('0x6d'),_0x49dbce,_0x82b9('0x6e'),_0x341a7d['actions'][_0x49dbce][_0x82b9('0x6f')],_0x82b9('0x70'),JSON[_0x82b9('0x58')](_0x341a7d[_0x82b9('0x13')][_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x6f')]][_0x82b9('0x4f')]),_0x82b9('0x71'),JSON[_0x82b9('0x58')](_0x341a7d[_0x82b9('0x13')][_0x341a7d[_0x82b9('0x16')][_0x49dbce]['queue']][_0x82b9('0x2d')]),JSON['stringify'](_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x72')]),JSON[_0x82b9('0x58')](_['pick'](_0x341a7d[_0x82b9('0x16')][_0x49dbce],[_0x82b9('0x73'),_0x82b9('0x74'),_0x82b9('0x75'),_0x82b9('0x76')])));return ami[_0x82b9('0x77')]({'action':_0x82b9('0x78'),'channel':_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x79')]})['catch'](function(_0x2d5dbd){if(_0x2d5dbd['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x341a7d[_0x82b9('0x16')][_0x49dbce]){ut['updateOriginated'](_0x341a7d[_0x82b9('0x13')][_0x341a7d['actions'][_0x49dbce][_0x82b9('0x6f')]],'[clearZombieChannel]');if(_0x341a7d['actions'][_0x49dbce]['dialAnswer']===!![]){ut[_0x82b9('0x7a')](_0x341a7d[_0x82b9('0x13')][_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x6f')]],_0x82b9('0x7b'));ut[_0x82b9('0x7c')](_0x82b9('0x7d')+_0x49dbce,_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x6f')]);}ut[_0x82b9('0x7c')]('[Dialer][checkChannel][Preview]'+_0x49dbce,_0x341a7d[_0x82b9('0x16')][_0x49dbce][_0x82b9('0x6f')]);delete _0x341a7d[_0x82b9('0x16')][_0x49dbce];}},0x2328);}});}});};Preview[_0x82b9('0x11')][_0x82b9('0x68')]=function(){var _0x3bb1f0=this;loggerAction[_0x82b9('0x5a')](_0x82b9('0x7e'),_[_0x82b9('0x7f')](this[_0x82b9('0x16')]));for(var _0x2bed14 in this['actions']){if(_0x3bb1f0[_0x82b9('0x16')][_0x82b9('0x66')](_0x2bed14)){_0x3bb1f0[_0x82b9('0x80')](_0x2bed14);}}};Preview[_0x82b9('0x11')][_0x82b9('0x6a')]=function(_0x2d3209){var _0x11d0c0=this;rpcDb[_0x82b9('0x81')](_0x2d3209['id'],ut['agentReadyId'](this['agents']))[_0x82b9('0x82')](function(_0x302cbd){if(!_[_0x82b9('0x6c')](_0x302cbd)){for(var _0x2ec76b=0x0;_0x2ec76b<_0x302cbd['length'];_0x2ec76b+=0x1){if(ut['getDiff'](_0x302cbd[_0x2ec76b]['scheduledat'])<_0x2d3209[_0x82b9('0x83')]*0x3c){if(_0x302cbd[_0x2ec76b]['Agent']&&!_0x302cbd[_0x2ec76b][_0x82b9('0x84')][_0x82b9('0x85')]){_0x11d0c0[_0x82b9('0x86')](_0x302cbd[_0x2ec76b]['id'])[_0x82b9('0x82')](ut[_0x82b9('0x87')](_0x82b9('0x88')))[_0x82b9('0x89')](ut[_0x82b9('0x87')](_0x82b9('0x88')));}else{rpcDb[_0x82b9('0x8a')](_0x302cbd[_0x2ec76b]['id']);}}else{var _0x3d7bb6=new Action(_0x302cbd[_0x2ec76b],_0x2d3209);_0x3d7bb6[_0x82b9('0x8b')]=moment()[_0x82b9('0x5b')](_0x82b9('0x8c'));_0x2d3209['outboundReCallsDay']+=0x1;ut[_0x82b9('0x8d')](_0x3d7bb6,0x17,_0x82b9('0x8e'));if(_0x2d3209['dialRecallInQueue']){rpcDb[_0x82b9('0x8f')](ut[_0x82b9('0x90')](_0x302cbd[_0x2ec76b]));rpcDb[_0x82b9('0x91')](_0x3d7bb6,_0x82b9('0x92'));}else{ut[_0x82b9('0x8d')](_0x3d7bb6,0x16,'RecallFailedTimeout');rpcDb[_0x82b9('0x91')](_0x3d7bb6,_0x82b9('0x93'));rpcDb[_0x82b9('0x94')](_0x3d7bb6,_0x82b9('0x93'));}}}}})[_0x82b9('0x89')](ut[_0x82b9('0x87')](_0x82b9('0x95')));};Preview[_0x82b9('0x11')]['setMessage']=function(_0x52d00f){_0x52d00f['sendMessageOneNotActive']=!![];if(ut[_0x82b9('0x96')](_0x52d00f[_0x82b9('0x97')])){_0x52d00f[_0x82b9('0x5f')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x82b9('0x98')](_0x52d00f[_0x82b9('0x35')])){_0x52d00f[_0x82b9('0x5f')]=_0x82b9('0x60');}else if(!this[_0x82b9('0x99')](_0x52d00f[_0x82b9('0x55')])){if(!this[_0x82b9('0x99')](_0x52d00f[_0x82b9('0x9a')])){_0x52d00f[_0x82b9('0x5f')]=_0x82b9('0x9b');}else{_0x52d00f[_0x82b9('0x5f')]=_0x82b9('0x9c');}}else{_0x52d00f[_0x82b9('0x5f')]='ACTIVE';}emitCampaignPreview(_0x52d00f);};Preview[_0x82b9('0x11')][_0x82b9('0x9d')]=function(_0x7cdf2d,_0x29119b,_0x3d44b0){var _0x5695df=this;var _0x17d074=this[_0x82b9('0x16')][_0x29119b];var _0x568eb1=this[_0x82b9('0x13')][_0x17d074[_0x82b9('0x6f')]];var _0xb9dbe5;if(_0x568eb1){switch(_0x3d44b0){case'1':_0x568eb1['outboundNoSuchCallsDay']+=0x1;_0x17d074['countnosuchnumberretry']+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0x0,_0x82b9('0xa0'));ami[_0x82b9('0x26')](_0x82b9('0xa1'),ut[_0x82b9('0xa2')](_0x17d074,_0x82b9('0xa3')));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xa4'));if(ut[_0x82b9('0x9f')](_0x17d074)>=_0x568eb1['dialGlobalMaxRetry']){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x17d074[_0x82b9('0xa7')]>=_0x568eb1[_0x82b9('0xa8')]){rpcDb[_0x82b9('0x94')](_0x17d074,_0x82b9('0xa9'));}else{rpcDb[_0x82b9('0xaa')](ut[_0x82b9('0xab')](_0x17d074,'countnosuchnumberretry',_0x568eb1['dialNoSuchNumberRetryFrequency']),_0x17d074['unlockAgent'],_0x17d074['activeContact']);}}delete this['actions'][_0x7cdf2d[_0x82b9('0xac')]];break;case'ANSWER':var _0x197a3d=moment()[_0x82b9('0x5b')](_0x82b9('0x8c'));_0x17d074[_0x82b9('0xad')]=_0x197a3d;_0x17d074['answertime']=_0x197a3d;_0x17d074['dialAnswer']=!![];_0x568eb1['pTalking']+=0x1;logger['info'](_0x82b9('0xae'),_0x17d074['uniqueid'],_0x82b9('0xaf'),_0x568eb1[_0x82b9('0x29')],'pTalking:\x20',_0x568eb1[_0x82b9('0x2d')]);ami['emit'](_0x82b9('0xb0'),ut['buildObj'](_0x17d074,_0x82b9('0xb1')));if(_0x568eb1[_0x82b9('0xb2')]){ami[_0x82b9('0x26')](_0x82b9('0xb3'),ut['buildAcw'](_0x17d074));}break;case'16':ami[_0x82b9('0x26')]('custom:agentcomplete',ut[_0x82b9('0xa2')](_0x17d074,'complete'));emitVoiceQueueChannelRemove(ut[_0x82b9('0xa2')](_0x17d074,_0x82b9('0xb4')));_0x568eb1[_0x82b9('0x3b')]+=0x1;_0x568eb1[_0x82b9('0x30')]+=0x1;_0x568eb1[_0x82b9('0x2b')]+=0x1;ut[_0x82b9('0x7a')](_0x568eb1,'[16]');_0x17d074[_0x82b9('0x9e')]=ut['totalGlobal'](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0x4,_0x82b9('0xb5'));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xb6'));rpcDb['createCustomerFinal'](_0x17d074,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x82b9('0xb7')](_0x17d074);_0x568eb1['sumDuration']+=_0x17d074[_0x82b9('0xb8')];_0x568eb1[_0x82b9('0xb9')]+=_0x17d074['talktime'];logger['info']('[syncHangup][talking][decrement]',_0x17d074[_0x82b9('0xba')],_0x82b9('0xaf'),_0x568eb1[_0x82b9('0x29')],_0x82b9('0x71'),_0x568eb1['pTalking']);delete this[_0x82b9('0x16')][_0x7cdf2d[_0x82b9('0xac')]];break;case'BUSY':_0x568eb1[_0x82b9('0x3d')]+=0x1;_0x17d074[_0x82b9('0xbb')]+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0x5,_0x82b9('0xbc'));ami['emit']('custom:agentbusy',ut[_0x82b9('0xa2')](_0x17d074,'busy'));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xbd'));if(ut[_0x82b9('0x9f')](_0x17d074)>=_0x568eb1[_0x82b9('0xbe')]){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,_0x82b9('0xbf'));}else{if(_0x17d074['countbusyretry']>=_0x568eb1[_0x82b9('0xc0')]){rpcDb[_0x82b9('0x94')](_0x17d074,_0x82b9('0xbd'));}else{rpcDb['rescheduleContact'](ut[_0x82b9('0xab')](_0x17d074,_0x82b9('0xbb'),_0x568eb1[_0x82b9('0xc1')]),_0x17d074['unlockAgent'],_0x17d074[_0x82b9('0xc2')]);}}break;case _0x82b9('0xc3'):_0x568eb1[_0x82b9('0x40')]+=0x1;_0x17d074[_0x82b9('0xc4')]+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0x3,_0x82b9('0xc5'));ami[_0x82b9('0x26')](_0x82b9('0xc6'),ut['buildObj'](_0x17d074,_0x82b9('0xc7')));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xc8'));if(ut[_0x82b9('0x9f')](_0x17d074)>=_0x568eb1[_0x82b9('0xbe')]){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,_0x82b9('0xc9'));}else{if(_0x17d074['countnoanswerretry']>=_0x568eb1[_0x82b9('0xca')]){rpcDb[_0x82b9('0x94')](_0x17d074,_0x82b9('0xc8'));}else{rpcDb[_0x82b9('0xaa')](ut[_0x82b9('0xab')](_0x17d074,'countnoanswerretry',_0x568eb1[_0x82b9('0xcb')]),_0x17d074[_0x82b9('0xcc')],_0x17d074[_0x82b9('0xc2')]);}}break;case _0x82b9('0xcd'):_0x568eb1[_0x82b9('0x3e')]+=0x1;_0x17d074[_0x82b9('0xce')]+=0x1;_0x17d074[_0x82b9('0x9e')]=ut['totalGlobal'](_0x17d074);ut['logCustomer'](_0x17d074,0x8,_0x82b9('0xcf'));ami['emit'](_0x82b9('0xd0'),ut[_0x82b9('0xa2')](_0x17d074,_0x82b9('0xd1')));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xd2'));if(ut['totalGlobal'](_0x17d074)>=_0x568eb1[_0x82b9('0xbe')]){_0xb9dbe5=ut['cloneAction'](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x17d074[_0x82b9('0xce')]>=_0x568eb1[_0x82b9('0xd3')]){rpcDb[_0x82b9('0x94')](_0x17d074,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x82b9('0xaa')](ut[_0x82b9('0xab')](_0x17d074,_0x82b9('0xce'),_0x568eb1[_0x82b9('0xc1')]),_0x17d074[_0x82b9('0xcc')],_0x17d074[_0x82b9('0xc2')]);}}break;case'CANCEL':_0x568eb1[_0x82b9('0x44')]+=0x1;_0x17d074['countagentrejectretry']+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0x14,_0x82b9('0xd4'));ami[_0x82b9('0x26')](_0x82b9('0xd5'),ut[_0x82b9('0xa2')](_0x17d074,_0x82b9('0xd6')));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xd7'));if(ut[_0x82b9('0x9f')](_0x17d074)>=_0x568eb1[_0x82b9('0xbe')]){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0x14,_0x82b9('0xd4'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,_0x82b9('0xd8'));}else{if(_0x17d074[_0x82b9('0xd9')]>=_0x568eb1[_0x82b9('0xda')]){rpcDb['createCustomerFinal'](_0x17d074,_0x82b9('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x82b9('0xab')](_0x17d074,_0x82b9('0xd9'),_0x568eb1[_0x82b9('0xdb')]),_0x17d074[_0x82b9('0xcc')],_0x17d074['activeContact']);}}break;case _0x82b9('0xdc'):_0x568eb1[_0x82b9('0x46')]+=0x1;_0x17d074[_0x82b9('0xdd')]+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut[_0x82b9('0x8d')](_0x17d074,0xb,_0x82b9('0xde'));rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xdf'));if(ut['totalGlobal'](_0x17d074)>=_0x568eb1['dialGlobalMaxRetry']){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb[_0x82b9('0x94')](_0xb9dbe5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x17d074[_0x82b9('0xe0')]>=_0x568eb1[_0x82b9('0xe1')]){rpcDb[_0x82b9('0x94')](_0x17d074,_0x82b9('0xdf'));}else{rpcDb[_0x82b9('0xaa')](ut['scheduledAt'](_0x17d074,_0x82b9('0xdd'),_0x568eb1[_0x82b9('0xe2')]),_0x17d074[_0x82b9('0xcc')],_0x17d074[_0x82b9('0xc2')]);}}break;default:if(_0x17d074[_0x82b9('0x72')]){ut[_0x82b9('0x7a')](_0x568eb1,_0x82b9('0xe3'));ut[_0x82b9('0x7c')](_0x82b9('0xe4')+_0x568eb1[_0x82b9('0x29')],_0x7cdf2d);}_0x568eb1[_0x82b9('0x45')]+=0x1;_0x17d074[_0x82b9('0x9e')]=ut[_0x82b9('0x9f')](_0x17d074);ut['logCustomer'](_0x17d074,0xc,_0x7cdf2d['cause-txt']||_0x7cdf2d[_0x82b9('0xe5')]);rpcDb[_0x82b9('0x91')](_0x17d074,_0x82b9('0xe6'));if(ut['totalGlobal'](_0x17d074)>=_0x568eb1[_0x82b9('0xbe')]){_0xb9dbe5=ut[_0x82b9('0xa5')](_0x17d074,0xf,_0x82b9('0xa6'));rpcDb['createCustomerFinal'](_0xb9dbe5,_0x82b9('0xe7'));}else{rpcDb[_0x82b9('0x94')](_0x17d074,_0x82b9('0xe7'));}delete this[_0x82b9('0x16')][_0x7cdf2d[_0x82b9('0xac')]];}if(!(_0x17d074[_0x82b9('0x72')]&&_0x3d44b0==='16')){ut[_0x82b9('0xe8')](_0x568eb1,_0x82b9('0xe9'));logger['info'](_0x82b9('0xea'),_0x17d074[_0x82b9('0xba')],'\x20Queue',_0x568eb1[_0x82b9('0x29')],'originated:\x20',_0x568eb1[_0x82b9('0x4f')]);}if(_0x3d44b0!==_0x82b9('0xeb')){delete this[_0x82b9('0x16')][_0x7cdf2d[_0x82b9('0xac')]];delete this[_0x82b9('0x16')][_0x7cdf2d[_0x82b9('0xec')]];}}};Preview[_0x82b9('0x11')]['callProgressDetectingAgent']=function(_0x5609e2,_0x5f0183,_0x53963f){if(_['isUndefined'](_0x5f0183)&&'object'!==typeof _0x5f0183){return;}if(_['isUndefined'](_0x53963f)&&_0x82b9('0xed')!==typeof _0x53963f){return;}switch(_0x53963f[_0x82b9('0xee')]){case'0':ut[_0x82b9('0xef')](_0x5609e2,0x0,_0x82b9('0xa0'));rpcDb[_0x82b9('0xf0')](_0x5609e2,_0x82b9('0xf1'));break;case'3':ut[_0x82b9('0xef')](_0x5609e2,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x5609e2,_0x82b9('0xf2'));break;case'5':ut[_0x82b9('0xef')](_0x5609e2,0x5,'Busy');rpcDb['createAgentHistory'](_0x5609e2,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x82b9('0xef')](_0x5609e2,0x8,_0x82b9('0xcf'));rpcDb['createAgentHistory'](_0x5609e2,_0x82b9('0xf3'));break;case'22':ut['logAgent'](_0x5609e2,0x16,_0x82b9('0xf4'));rpcDb[_0x82b9('0xf0')](_0x5609e2,_0x82b9('0xf5'));break;default:ut['logAgent'](_0x5609e2,0xc,_0x53963f['reason']);rpcDb[_0x82b9('0xf0')](_0x5609e2,'[callProgressDetectingAgent][logCongestion]');}ut[_0x82b9('0xe8')](_0x5f0183,'[callProgressDetectingAgent]');logger[_0x82b9('0x5a')](_0x82b9('0xf6'),_0x5609e2[_0x82b9('0xba')],'\x20Queue',_0x5f0183[_0x82b9('0x29')],_0x82b9('0x70'),_0x5f0183[_0x82b9('0x4f')]);delete this[_0x82b9('0x16')][_0x5609e2['uniqueid']];};Preview[_0x82b9('0x11')]['checkInBlack']=function(_0x1e7355,_0x1798cb,_0x6de8de,_0x262314,_0x1bc0bb){var _0x472349=this;return new BPromise(function(_0x47ea71,_0x333343){if(_[_0x82b9('0x6c')](_0x1798cb)||_[_0x82b9('0x6c')](_0x1798cb[_0x82b9('0xf7')])||_['isNil'](_0x1798cb['Contact'][_0x82b9('0xf8')])||_[_0x82b9('0x6c')](_0x1798cb[_0x82b9('0x75')])){_0x333343(ut[_0x82b9('0x5f')]('Contact\x20is\x20undefined',_0x262314,_0x1bc0bb));return;}var _0x5d650a=uuid['v4']();var _0x2107c9=_0x472349['campaignsPreview'][_0x1798cb[_0x82b9('0x6e')]['name']];var _0x1e8a26=_0x6de8de?_0x472349[_0x82b9('0x17')][_0x6de8de]['id']:undefined;_0x472349[_0x82b9('0x16')][_0x5d650a]=new Action(_0x1798cb,_0x2107c9,_0x5d650a,_0x6de8de,_0x1e8a26);var _0x350a10=_0x472349[_0x82b9('0x16')][_0x5d650a];_0x350a10['unlockAgent']=_0x262314;_0x350a10[_0x82b9('0xc2')]=_0x1bc0bb;_0x350a10[_0x82b9('0xf9')]=_0x6de8de;if(_[_0x82b9('0xfa')](_0x1e7355)){_0x472349[_0x82b9('0xfb')](_0x350a10,_0x2107c9,_0x1798cb,_0x6de8de)['then'](function(_0x7dcec3){logger['info'](_0x82b9('0xfc'),_0x82b9('0xfd')+_0x350a10[_0x82b9('0x6f')]+_0x82b9('0xfe')+_0x350a10[_0x82b9('0xff')],JSON[_0x82b9('0x58')](_0x7dcec3));ami[_0x82b9('0x26')](_0x82b9('0x100'),ut[_0x82b9('0xa2')](_0x350a10,_0x82b9('0x101')));_0x47ea71(ut['message']('Calling'));})[_0x82b9('0x89')](function(_0x2b43ff){ut[_0x82b9('0x63')]('[Preview][execCall][failure]',_0x2b43ff);_0x333343(ut[_0x82b9('0x5f')]('Call\x20failed',_0x262314,_0x1bc0bb));});}else{_0x2107c9[_0x82b9('0x3c')]+=0x1;ut[_0x82b9('0x102')](_0x350a10);rpcDb['createHistory'](_0x350a10,_0x82b9('0x103'));delete _0x472349['actions'][_0x5d650a];_0x333343(ut['message'](_0x82b9('0x104'),_0x262314,_0x1bc0bb));}});};Preview[_0x82b9('0x11')][_0x82b9('0x99')]=function(_0x3e1cae){return!_[_0x82b9('0x6c')](_0x3e1cae)&&!_[_0x82b9('0x6c')](_0x3e1cae[_0x82b9('0x29')])&&!_[_0x82b9('0x6c')](_0x3e1cae[_0x82b9('0x105')])&&_0x3e1cae[_0x82b9('0x105')]&&!_[_0x82b9('0x6c')](this[_0x82b9('0x15')][util[_0x82b9('0x5b')](_0x82b9('0x106'),_0x3e1cae[_0x82b9('0x29')])])&&!_[_0x82b9('0x6c')](this[_0x82b9('0x15')][util[_0x82b9('0x5b')](_0x82b9('0x106'),_0x3e1cae[_0x82b9('0x29')])][_0x82b9('0x78')])&&(this[_0x82b9('0x15')][util[_0x82b9('0x5b')]('SIP/%s',_0x3e1cae[_0x82b9('0x29')])]['status']===_0x82b9('0x107')||this['trunks'][util[_0x82b9('0x5b')](_0x82b9('0x106'),_0x3e1cae[_0x82b9('0x29')])]['status']==='unmonitored');};Preview['prototype'][_0x82b9('0x86')]=function(_0x162538,_0x2e41b4){var _0x4db863=this;return new BPromise(function(_0xe0096,_0x2e06fa){_0x4db863[_0x82b9('0x108')](_0x162538,_0x2e41b4)['then'](function(_0x3d1319){_0xe0096(_[_0x82b9('0x109')](_0x3d1319,[_0x82b9('0x5f')]));})[_0x82b9('0x89')](function(_0x1d1ee3){if(_0x1d1ee3[_0x82b9('0x10a')]){rpcDb[_0x82b9('0x10b')](_0x162538);}if(_0x1d1ee3[_0x82b9('0x105')]){rpcDb['disableContact'](_0x162538);}_0x2e06fa(_[_0x82b9('0x109')](_0x1d1ee3,[_0x82b9('0x5f')]));});});};Preview[_0x82b9('0x11')]['execRun']=function(_0x473cd7,_0x42b626){var _0x4e8eea=this;return new BPromise(function(_0x5e9434,_0x5dd57a){var _0xf592e4,_0x3488df;rpcDb[_0x82b9('0x10c')](_0x473cd7)[_0x82b9('0x82')](function(_0x373e84){if(!_[_0x82b9('0x6c')](_0x373e84[0x0])){_0x3488df=_0x373e84[0x0][_0x82b9('0x10d')]?![]:!![];_0xf592e4=_0x373e84[0x0][_0x82b9('0x10d')]?!![]:![];_0xf592e4=_0x42b626?!![]:_0xf592e4;}var _0x4f7ca8=_0x4e8eea[_0x82b9('0x10e')](_0x373e84);if(_0x4f7ca8[_0x82b9('0x10f')]){rpcDb['checkIsBlackList'](_[_0x82b9('0x109')](_0x373e84[0x0],[_0x82b9('0x75'),'Contact.phone']))['then'](function(_0x514101){_0x4e8eea[_0x82b9('0x110')](_0x514101,_0x373e84[0x0],_0x42b626,_0x3488df,_0xf592e4)[_0x82b9('0x82')](function(_0x16da3f){_0x5e9434(_0x16da3f);})[_0x82b9('0x89')](function(_0x63443b){_0x5dd57a(_0x63443b);});})[_0x82b9('0x89')](function(_0x665f27){ut[_0x82b9('0x63')](_0x82b9('0x111'),_0x665f27);_0x5dd57a(ut[_0x82b9('0x5f')](_0x82b9('0x112'),_0x3488df,_0xf592e4));});}else{_0x5dd57a(ut[_0x82b9('0x5f')](_0x4f7ca8['message'],_0x3488df,_0xf592e4));}})[_0x82b9('0x89')](function(_0x3bbb47){ut[_0x82b9('0x63')](_0x82b9('0x113'),_0x3bbb47);_0x5dd57a(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x82b9('0x10e')]=function(_0xe9c372){if(_[_0x82b9('0x6c')](_0xe9c372)||_[_0x82b9('0xfa')](_0xe9c372)||!_[_0x82b9('0x6c')](_0xe9c372[0x0][_0x82b9('0x84')])&&_[_0x82b9('0x6c')](_0xe9c372[0x0]['Agent']['name'])){ut[_0x82b9('0x63')](_0x82b9('0x114'),_0xe9c372);return{'isValid':![],'message':_0x82b9('0x115')};}var _0x93d0d1=this[_0x82b9('0x13')][_0xe9c372[0x0]['Queue'][_0x82b9('0x29')]];_0x93d0d1[_0x82b9('0x5f')]=_0x82b9('0x9c');if(_[_0x82b9('0x6c')](_0x93d0d1)){ut[_0x82b9('0x63')](_0x82b9('0x116'),_0x93d0d1);return{'isValid':![],'message':_0x82b9('0x117')};}if(!this[_0x82b9('0x99')](_0x93d0d1[_0x82b9('0x55')])){ut[_0x82b9('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x82b9('0x118')+_0x93d0d1[_0x82b9('0x29')]+_0x82b9('0x119'));if(!this[_0x82b9('0x99')](_0x93d0d1[_0x82b9('0x9a')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x93d0d1[_0x82b9('0x29')]+_0x82b9('0x11a'));return{'isValid':![],'message':_0x82b9('0x11b')};}}if(!ut[_0x82b9('0x98')](_0x93d0d1[_0x82b9('0x35')])){ut[_0x82b9('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x93d0d1[_0x82b9('0x29')]+_0x82b9('0x11c'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x93d0d1[_0x82b9('0x29')]+_0x82b9('0x11c')};}return{'isValid':!![],'message':_0x82b9('0x11d')};};Preview['prototype']['execCall']=function(_0x461938,_0x3eb381,_0x4cef39,_0x106174){var _0xb524bf=this;return new BPromise(function(_0xa9152a,_0x245aec){var _0x1173e8=_0x461938['uniqueid'];var _0x4e21c7=_0xb524bf[_0x82b9('0x99')](_0x3eb381[_0x82b9('0x55')])?util[_0x82b9('0x5b')](_0x82b9('0x11e'),_0x3eb381['Trunk'][_0x82b9('0x29')],_[_0x82b9('0x6c')](_0x3eb381[_0x82b9('0x39')])?'':_0x3eb381[_0x82b9('0x39')][_0x82b9('0x11f')]()||'',_0x3eb381[_0x82b9('0x120')]>0x0?_0x4cef39[_0x82b9('0xf7')][_0x82b9('0xf8')][_0x82b9('0x121')](_0x3eb381[_0x82b9('0x120')]):_0x4cef39[_0x82b9('0xf7')][_0x82b9('0xf8')]):util[_0x82b9('0x5b')](_0x82b9('0x11e'),_[_0x82b9('0x6c')](_0x3eb381[_0x82b9('0x9a')])?_0x3eb381['Trunk'][_0x82b9('0x29')]:_0x3eb381[_0x82b9('0x9a')]['name'],_['isNil'](_0x3eb381[_0x82b9('0x39')])?'':_0x3eb381[_0x82b9('0x39')][_0x82b9('0x11f')]()||'',_0x3eb381[_0x82b9('0x120')]>0x0?_0x4cef39[_0x82b9('0xf7')][_0x82b9('0xf8')][_0x82b9('0x121')](_0x3eb381[_0x82b9('0x120')]):_0x4cef39[_0x82b9('0xf7')][_0x82b9('0xf8')]);var _0x26395e=_0xb524bf[_0x82b9('0x99')](_0x3eb381[_0x82b9('0x55')])?ut['getCallerId'](_0x3eb381[_0x82b9('0x55')][_0x82b9('0x56')],_0x3eb381[_0x82b9('0x37')],_0x3eb381[_0x82b9('0x122')]>0x0?ut[_0x82b9('0x123')](_0x3eb381[_0x82b9('0x124')],_0x3eb381['dialRandomLastDigitCallerIdNumber']):_0x3eb381[_0x82b9('0x124')]):ut[_0x82b9('0x125')](_[_0x82b9('0x6c')](_0x3eb381[_0x82b9('0x9a')])?_0x3eb381[_0x82b9('0x55')][_0x82b9('0x56')]:_0x3eb381[_0x82b9('0x9a')][_0x82b9('0x56')],_0x3eb381['dialOriginateCallerIdName'],_0x3eb381[_0x82b9('0x122')]>0x0?ut[_0x82b9('0x123')](_0x3eb381[_0x82b9('0x124')],_0x3eb381[_0x82b9('0x122')]):_0x3eb381[_0x82b9('0x124')]);if(_0x26395e){_0x461938[_0x82b9('0x126')]=ut[_0x82b9('0x127')](_0x26395e);_0x461938[_0x82b9('0x128')]=ut[_0x82b9('0x129')](_0x26395e);}var _0x2dba33=ut['addVariables'](_0x3eb381,_0x4cef39,_0x4e21c7,_0x26395e,_0x1173e8,_0x461938);_['merge'](_0x461938,ut[_0x82b9('0x12a')](_0x2dba33));_0x461938[_0x82b9('0x8b')]=moment()[_0x82b9('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x82b9('0x77')](ut[_0x82b9('0x12b')](_0x461938,_0x3eb381,_0x2dba33,_0x461938[_0x82b9('0xc2')],_0x106174))[_0x82b9('0x82')](function(_0x28bde5){_0x3eb381[_0x82b9('0x4f')]+=0x1;logger[_0x82b9('0x5a')](_0x82b9('0x12c'),_0x1173e8,'\x20Queue',_0x3eb381[_0x82b9('0x29')],_0x82b9('0x70'),_0x3eb381[_0x82b9('0x4f')]);_0xa9152a(_0x28bde5);})[_0x82b9('0x89')](function(_0xd54864){ut[_0x82b9('0xef')](_0x461938,0xe,_0x82b9('0x12d'));rpcDb[_0x82b9('0xf0')](_0x461938,_0x82b9('0x12e'));_0x245aec(_0xd54864);});});};Preview['prototype'][_0x82b9('0x21')]=function(_0x1a39e9){if(this[_0x82b9('0x16')][_0x1a39e9[_0x82b9('0xac')]]){this[_0x82b9('0x16')][_0x1a39e9['linkedid']][_0x82b9('0x79')]=_0x1a39e9[_0x82b9('0x79')];}};Preview['prototype'][_0x82b9('0x1a')]=function(_0xa1616e){var _0x387439=this;var _0x34b7c0=this['actions'][_0xa1616e[_0x82b9('0x12f')]];if(_0x34b7c0){if(_0x34b7c0[_0x82b9('0xf9')]&&this[_0x82b9('0x17')][_0x34b7c0[_0x82b9('0xf9')]]){ut['logLookAgent'](_0x34b7c0,this[_0x82b9('0x17')][_0x34b7c0[_0x82b9('0xf9')]][_0x82b9('0x29')],this['agents'][_0x34b7c0[_0x82b9('0xf9')]]['id']);}var _0x2b8c67=_[_0x82b9('0x130')](_0x34b7c0);_0x2b8c67[_0x82b9('0xad')]=moment()[_0x82b9('0x5b')](_0x82b9('0x8c'));var _0x24b418=_0x387439['campaignsPreview'][_0x34b7c0[_0x82b9('0x6f')]];if(ut[_0x82b9('0x131')](_0xa1616e['response'])){if(_0x34b7c0[_0x82b9('0xcc')]){rpcDb[_0x82b9('0x10b')](_0x34b7c0['idContact']);}if(_0x34b7c0[_0x82b9('0xc2')]){rpcDb[_0x82b9('0x8a')](_0x34b7c0[_0x82b9('0xff')]);}ami['emit'](_0x82b9('0x132'),ut['buildObj'](_0x34b7c0,'rejected'));this[_0x82b9('0x133')](_0x2b8c67,_0x24b418,_0xa1616e);}else{_0x34b7c0[_0x82b9('0x8b')]=moment()[_0x82b9('0x5b')](_0x82b9('0x8c'));ut[_0x82b9('0xef')](_0x2b8c67,0x4,_0x82b9('0xb5'));rpcDb[_0x82b9('0xf0')](_0x2b8c67,_0x82b9('0x134'));}}};Preview[_0x82b9('0x11')][_0x82b9('0x1d')]=function(_0x6a7470){var _0x28fda4=this;var _0x213817=this[_0x82b9('0x16')][_0x6a7470[_0x82b9('0xac')]];var _0x11a794;if(_0x213817){_0x11a794=this[_0x82b9('0x13')][_0x213817[_0x82b9('0x6f')]];logger[_0x82b9('0x5a')](_0x82b9('0x135'),_0x6a7470['linkedid'],_0x82b9('0xaf'),_0x11a794[_0x82b9('0x29')],_0x82b9('0x71'),_0x11a794[_0x82b9('0x2d')]);}if(this[_0x82b9('0x16')][_0x6a7470[_0x82b9('0xac')]]&&_0x6a7470[_0x82b9('0xac')]!==_0x6a7470[_0x82b9('0xba')]){if(_0x6a7470[_0x82b9('0x136')]==='16'&&this[_0x82b9('0x16')][_0x6a7470['linkedid']]['dialAnswer']){this[_0x82b9('0x9d')](_0x6a7470,_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')]);}else if(this[_0x82b9('0x16')][_0x6a7470[_0x82b9('0xac')]][_0x82b9('0x72')]){logger[_0x82b9('0x5a')](_0x82b9('0x137'),_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')],_0x82b9('0xaf'),_0x11a794[_0x82b9('0x29')],_0x82b9('0x71'),_0x11a794[_0x82b9('0x2d')]);this['callProgressDetectingCustomer'](_0x6a7470,_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')]);}}else if(_0x213817&&_[_0x82b9('0x6c')](_0x213817[_0x82b9('0x138')])&&_0x11a794['dialQueueProject']&&_0x6a7470[_0x82b9('0xac')]===_0x6a7470[_0x82b9('0xba')]&&_[_0x82b9('0x6c')](_0x6a7470['reason'])&&_0x6a7470[_0x82b9('0x136')]==='16'&&_0x6a7470[_0x82b9('0x139')]==='6'&&_[_0x82b9('0x13a')](_0x213817[_0x82b9('0x13b')])){if(_0x213817[_0x82b9('0xcc')]){rpcDb['unlockContact'](_0x213817['idContact']);}if(_0x213817[_0x82b9('0xc2')]){rpcDb[_0x82b9('0x8a')](_0x213817[_0x82b9('0xff')]);}_0x6a7470[_0x82b9('0xee')]='22';this[_0x82b9('0x133')](_0x213817,_0x11a794,_0x6a7470);}else if(_0x213817&&_0x213817['transfer']){if(_0x6a7470[_0x82b9('0x136')]==='16'&&this[_0x82b9('0x16')][_0x6a7470[_0x82b9('0xac')]]['dialAnswer']){logger[_0x82b9('0x5a')](_0x82b9('0x13c'),_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')],_0x82b9('0xaf'),_0x11a794[_0x82b9('0x29')],'pTalking:\x20',_0x11a794[_0x82b9('0x2d')]);this['callProgressDetectingCustomer'](_0x6a7470,_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')]);}else if(this[_0x82b9('0x16')][_0x6a7470[_0x82b9('0xac')]][_0x82b9('0x72')]){logger[_0x82b9('0x5a')](_0x82b9('0x137'),_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')],_0x82b9('0xaf'),_0x11a794['name'],_0x82b9('0x71'),_0x11a794[_0x82b9('0x2d')]);this[_0x82b9('0x9d')](_0x6a7470,_0x6a7470[_0x82b9('0xac')],_0x6a7470[_0x82b9('0x136')]);}}};Preview[_0x82b9('0x11')][_0x82b9('0x20')]=function(_0xae5029){if(this[_0x82b9('0x16')][_0xae5029['destlinkedid']]&&_0xae5029[_0x82b9('0xec')]!==_0xae5029[_0x82b9('0x13d')]){this[_0x82b9('0x9d')](_0xae5029,_0xae5029[_0x82b9('0xec')],_0xae5029[_0x82b9('0xe5')]);}};Preview[_0x82b9('0x11')]['syncHangupRequest']=function(_0x59bbd4){if(this['actions'][_0x59bbd4['linkedid']]&&_0x59bbd4[_0x82b9('0xac')]!==_0x59bbd4['uniqueid']&&!this['actions'][_0x59bbd4[_0x82b9('0xac')]][_0x82b9('0x72')]){if(_0x59bbd4[_0x82b9('0x136')]==='1'){this[_0x82b9('0x9d')](_0x59bbd4,_0x59bbd4[_0x82b9('0xac')],_0x59bbd4[_0x82b9('0x136')]);}}};Preview['prototype'][_0x82b9('0x13e')]=function(_0x1d21a0,_0x49bd55,_0x2fdb80){if(this[_0x82b9('0x16')][_0x1d21a0]){if(_['isNil'](this[_0x82b9('0x16')][_0x1d21a0][_0x82b9('0x13f')])){this[_0x82b9('0x16')][_0x1d21a0]['variables']={};}this[_0x82b9('0x16')][_0x1d21a0][_0x82b9('0x13f')][_0x49bd55]=_0x2fdb80;}};Preview[_0x82b9('0x11')]['syncVarSet']=function(_0x2cd2b1){try{if(!_[_0x82b9('0x6c')](_0x2cd2b1)){if(ut[_0x82b9('0x140')](_[_0x82b9('0x141')](_0x2cd2b1['variable'])[0x0])){this[_0x82b9('0x13e')](_0x2cd2b1[_0x82b9('0xba')],_[_0x82b9('0x141')](_0x2cd2b1['variable'])[0x0],_0x2cd2b1[_0x82b9('0x142')]);}}}catch(_0x1df526){logger[_0x82b9('0x143')]('[syncVarSet][Preview]',util['inspect'](_0x1df526,{'showHidden':![],'depth':null}));}};Preview[_0x82b9('0x11')][_0x82b9('0x144')]=function(_0x5b037e){if(_0x5b037e){if(this[_0x82b9('0x16')][_0x5b037e[_0x82b9('0x145')]]){this[_0x82b9('0x16')][_0x5b037e[_0x82b9('0x145')]][_0x82b9('0x13b')]=!![];}}};Preview[_0x82b9('0x11')][_0x82b9('0x146')]=function(_0x3b876b){if(_0x3b876b){if(this['actions'][_0x3b876b[_0x82b9('0x147')]]){this[_0x82b9('0x16')][_0x3b876b[_0x82b9('0x147')]][_0x82b9('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 89e1bc4..6d79db3 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 _0xfb65=['membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xfb65,0x82));var _0x5fb6=function(_0x39a968,_0x364d93){_0x39a968=_0x39a968-0x0;var _0x47b0a5=_0xfb65[_0x39a968];return _0x47b0a5;};'use strict';var util=require('util');var BPromise=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('preview');var _=require(_0x5fb6('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x5fb6('0x3'));var cmHopperHistory=require(_0x5fb6('0x4'));var cmHopperBlack=require(_0x5fb6('0x5'));var voiceQueueRt=require(_0x5fb6('0x6'));var agentReportPreview=require(_0x5fb6('0x7'));var voiceQueueReport=require(_0x5fb6('0x8'));function loggerCatch(_0x4dec8f){return function(_0x50782b){logger[_0x5fb6('0x9')](_0x4dec8f,util[_0x5fb6('0xa')](_0x50782b,{'showHidden':![],'depth':null}));};}function create(_0x1f99b8){return BPromise[_0x5fb6('0xb')]()['then'](cmHopperHistory[_0x5fb6('0xc')](_0x1f99b8))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0xe')));}function createAgent(_0x21e613){return BPromise['resolve']()[_0x5fb6('0xf')](agentReportPreview[_0x5fb6('0xc')](_0x21e613))['catch'](loggerCatch(_0x5fb6('0xe')));}function moveContact(_0x19387c){return BPromise[_0x5fb6('0xb')]()[_0x5fb6('0xf')](cmHopper[_0x5fb6('0x10')](_0x19387c,!![]))['catch'](loggerCatch(_0x5fb6('0x11')));}exports[_0x5fb6('0x12')]=function(_0x42285b){return BPromise[_0x5fb6('0xb')]()[_0x5fb6('0xf')](cmHopperBlack[_0x5fb6('0x12')](_0x42285b))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x13')));};exports['getContactPreview']=function(_0x47a197){return BPromise[_0x5fb6('0xb')]()[_0x5fb6('0xf')](cmHopper['getContactPreview'](_0x47a197))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x14')));};exports[_0x5fb6('0xc')]=function(_0x5d71c0,_0x48f94d){create(_0x5d71c0)[_0x5fb6('0xd')](loggerCatch(_0x48f94d));moveContact(_0x5d71c0)[_0x5fb6('0xd')](loggerCatch(_0x48f94d));};exports[_0x5fb6('0x15')]=function(_0x167354,_0x226c61){createAgent(_0x167354)['catch'](loggerCatch(_0x226c61));};exports[_0x5fb6('0x16')]=function(_0x5aeb08,_0x32f58a){create(_0x5aeb08)['catch'](loggerCatch(_0x32f58a));};exports[_0x5fb6('0x17')]=function(_0x3ec3b0,_0x402e8a){moveContact(_0x3ec3b0)[_0x5fb6('0xd')](loggerCatch(_0x402e8a));};exports[_0x5fb6('0x18')]=function(_0x418f58,_0x11c21b,_0x50a414){if(_0x11c21b){_0x418f58['UserId']=null;}if(_0x50a414){_0x418f58[_0x5fb6('0x19')]=![];}return BPromise[_0x5fb6('0xb')]()['then'](cmHopper[_0x5fb6('0x18')](_0x418f58))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x1a')));};exports[_0x5fb6('0x1b')]=function(_0x582f60){return BPromise[_0x5fb6('0xb')]()[_0x5fb6('0xf')](cmHopper[_0x5fb6('0x1b')](_0x582f60))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x1c')));};exports[_0x5fb6('0x1d')]=function(_0x4e2bff){return BPromise['resolve']()[_0x5fb6('0xf')](cmHopper[_0x5fb6('0x1d')]({'UserId':null},_0x4e2bff,0x1))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x1e')));};exports[_0x5fb6('0x1f')]=function(_0x1c3b0f){return BPromise[_0x5fb6('0xb')]()['then'](cmHopper[_0x5fb6('0x1d')]({'active':![]},_0x1c3b0f,0x1))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x20')));};exports['crateCustomerReportQueue']=function(_0x2afc08){var _0x1b4ae4={};_0x1b4ae4['type']=_0x2afc08[_0x5fb6('0x21')];_0x1b4ae4[_0x5fb6('0x22')]=_0x2afc08['uniqueid'];_0x1b4ae4[_0x5fb6('0x23')]=_0x2afc08['calleridnum'];_0x1b4ae4[_0x5fb6('0x24')]=_0x2afc08['calleridname'];_0x1b4ae4['queue']=_0x2afc08[_0x5fb6('0x25')];_0x1b4ae4[_0x5fb6('0x26')]=_0x2afc08[_0x5fb6('0x27')];_0x1b4ae4[_0x5fb6('0x28')]=_0x2afc08[_0x5fb6('0x27')];_0x1b4ae4[_0x5fb6('0x29')]=0x1;_0x1b4ae4['queuecallercompleteAt']=_0x2afc08[_0x5fb6('0x2a')];_0x1b4ae4[_0x5fb6('0x2b')]=_0x2afc08[_0x5fb6('0x2c')];_0x1b4ae4[_0x5fb6('0x2d')]=_0x5fb6('0x2e');_0x1b4ae4[_0x5fb6('0x2f')]=_0x5fb6('0x30');_0x1b4ae4[_0x5fb6('0x31')]=0x0;_0x1b4ae4[_0x5fb6('0x32')]=0x1;_0x1b4ae4[_0x5fb6('0x33')]=_0x2afc08[_0x5fb6('0x2c')];_0x1b4ae4['queuecallerexitreason']=_0x5fb6('0x34');return BPromise[_0x5fb6('0xb')]()['then'](voiceQueueReport[_0x5fb6('0x35')](_0x1b4ae4))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x5fb6('0x36')]=function(_0x1fc7c9,_0x1e40fe){return BPromise['resolve']()[_0x5fb6('0xf')](cmHopper['getContactRecallMe'](_0x1fc7c9,_0x1e40fe))['catch'](loggerCatch(_0x5fb6('0x37')));};exports[_0x5fb6('0x38')]=function(_0x1b4709){return BPromise[_0x5fb6('0xb')]()[_0x5fb6('0xf')](cmHopper[_0x5fb6('0x18')](_0x1b4709,!![],!![]))[_0x5fb6('0xd')](loggerCatch(_0x5fb6('0x39')));}; \ No newline at end of file +var _0x5fd1=['[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact'];(function(_0x393ad5,_0x3a2814){var _0x362ad0=function(_0x2b4cf6){while(--_0x2b4cf6){_0x393ad5['push'](_0x393ad5['shift']());}};_0x362ad0(++_0x3a2814);}(_0x5fd1,0x155));var _0x15fd=function(_0x5a7340,_0x509d3a){_0x5a7340=_0x5a7340-0x0;var _0x56361e=_0x5fd1[_0x5a7340];return _0x56361e;};'use strict';var util=require(_0x15fd('0x0'));var BPromise=require('bluebird');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var _=require(_0x15fd('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x15fd('0x4'));var cmHopperBlack=require(_0x15fd('0x5'));var voiceQueueRt=require(_0x15fd('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x15fd('0x7'));function loggerCatch(_0x386441){return function(_0x18450c){logger[_0x15fd('0x8')](_0x386441,util[_0x15fd('0x9')](_0x18450c,{'showHidden':![],'depth':null}));};}function create(_0x534e63){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopperHistory[_0x15fd('0xc')](_0x534e63))['catch'](loggerCatch(_0x15fd('0xd')));}function createAgent(_0x5c9c63){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](agentReportPreview['createHistory'](_0x5c9c63))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3dd2af){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0xe')](_0x3dd2af,!![]))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x10')));}exports[_0x15fd('0x11')]=function(_0x2660db){return BPromise[_0x15fd('0xa')]()['then'](cmHopperBlack['checkIsBlackList'](_0x2660db))['catch'](loggerCatch(_0x15fd('0x12')));};exports[_0x15fd('0x13')]=function(_0x624e9b){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x13')](_0x624e9b))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x14')));};exports['createHistory']=function(_0x4c7080,_0x25f139){create(_0x4c7080)['catch'](loggerCatch(_0x25f139));moveContact(_0x4c7080)[_0x15fd('0xf')](loggerCatch(_0x25f139));};exports['createAgentHistory']=function(_0x917fe4,_0x318f47){createAgent(_0x917fe4)[_0x15fd('0xf')](loggerCatch(_0x318f47));};exports['createCustomerHistory']=function(_0x367c36,_0x2ad0de){create(_0x367c36)[_0x15fd('0xf')](loggerCatch(_0x2ad0de));};exports[_0x15fd('0x15')]=function(_0x2fb919,_0x36a90e){moveContact(_0x2fb919)[_0x15fd('0xf')](loggerCatch(_0x36a90e));};exports[_0x15fd('0x16')]=function(_0x1b8b9f,_0x1eab55,_0x3ff307){if(_0x1eab55){_0x1b8b9f['UserId']=null;}if(_0x3ff307){_0x1b8b9f['active']=![];}return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x16')](_0x1b8b9f))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x17')));};exports[_0x15fd('0x18')]=function(_0x2073da){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper[_0x15fd('0x18')](_0x2073da))[_0x15fd('0xf')](loggerCatch('[countReScheduled]\x20'));};exports[_0x15fd('0x19')]=function(_0x49062f){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x19')]({'UserId':null},_0x49062f,0x1))['catch'](loggerCatch(_0x15fd('0x1a')));};exports[_0x15fd('0x1b')]=function(_0x24c541){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper['unlockContact']({'active':![]},_0x24c541,0x1))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x1c')));};exports[_0x15fd('0x1d')]=function(_0x27d2c4){var _0x233ed3={};_0x233ed3[_0x15fd('0x1e')]=_0x27d2c4[_0x15fd('0x1e')];_0x233ed3[_0x15fd('0x1f')]=_0x27d2c4[_0x15fd('0x1f')];_0x233ed3[_0x15fd('0x20')]=_0x27d2c4[_0x15fd('0x20')];_0x233ed3['calleridname']=_0x27d2c4[_0x15fd('0x21')];_0x233ed3[_0x15fd('0x22')]=_0x27d2c4['queue'];_0x233ed3[_0x15fd('0x23')]=_0x27d2c4[_0x15fd('0x24')];_0x233ed3['queuecallerleaveAt']=_0x27d2c4[_0x15fd('0x24')];_0x233ed3[_0x15fd('0x25')]=0x1;_0x233ed3['queuecallercompleteAt']=_0x27d2c4[_0x15fd('0x26')];_0x233ed3[_0x15fd('0x27')]=_0x27d2c4[_0x15fd('0x28')];_0x233ed3[_0x15fd('0x29')]=_0x15fd('0x2a');_0x233ed3[_0x15fd('0x2b')]='xcally-motion-preview';_0x233ed3[_0x15fd('0x2c')]=0x0;_0x233ed3[_0x15fd('0x2d')]=0x1;_0x233ed3[_0x15fd('0x2e')]=_0x27d2c4[_0x15fd('0x28')];_0x233ed3['queuecallerexitreason']=_0x15fd('0x2f');return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](voiceQueueReport[_0x15fd('0x30')](_0x233ed3))[_0x15fd('0xf')](loggerCatch(_0x15fd('0x31')));};exports['getContactRecallMe']=function(_0x3b80a6,_0xaae2d0){return BPromise['resolve']()[_0x15fd('0xb')](cmHopper[_0x15fd('0x32')](_0x3b80a6,_0xaae2d0))[_0x15fd('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x15fd('0x33')]=function(_0x309851){return BPromise[_0x15fd('0xa')]()[_0x15fd('0xb')](cmHopper[_0x15fd('0x16')](_0x309851,!![],!![]))[_0x15fd('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 3dadcf3..7875ad9 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 _0x8383=['xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','timeout','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','buildAcw','agentReadyId','push','getDiff','createBody','filterKey','type','campaigntype','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions'];(function(_0x150ccc,_0x31903e){var _0x5171a6=function(_0x3a3182){while(--_0x3a3182){_0x150ccc['push'](_0x150ccc['shift']());}};_0x5171a6(++_0x31903e);}(_0x8383,0x98));var _0x3838=function(_0x1f73e0,_0x2c54b9){_0x1f73e0=_0x1f73e0-0x0;var _0x43cd3b=_0x8383[_0x1f73e0];return _0x43cd3b;};'use strict';var util=require(_0x3838('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x3838('0x1'))(_0x3838('0x2'));var ipAgi=process[_0x3838('0x3')][_0x3838('0x4')]||_0x3838('0x5');function getSeconds(_0xcbcef6,_0x37f2a5){var _0x3c3043=moment(_0xcbcef6)[_0x3838('0x6')](0x0);var _0x7a4cc0=moment(_0x37f2a5)['milliseconds'](0x0);return _0x3c3043[_0x3838('0x7')](_0x7a4cc0,_0x3838('0x8'));}exports['loggerCatch']=function(_0x2abbda){return function(_0x5e2e42){logger[_0x3838('0x9')](_0x2abbda,util[_0x3838('0xa')](_0x5e2e42,{'showHidden':![],'depth':null}));};};exports[_0x3838('0xb')]=function(_0x550a5c,_0x2af70d){logger[_0x3838('0xc')](_0x550a5c,util[_0x3838('0xa')](_0x2af70d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x252715,_0xdad018){logger[_0x3838('0x9')](_0x252715,util[_0x3838('0xa')](_0xdad018,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3572d6){return function(_0x276d98){logger[_0x3838('0xc')](_0x3572d6,util['inspect'](_0x276d98,{'showHidden':![],'depth':null}));};};exports[_0x3838('0xd')]=function(_0x59cfd7,_0x38e779,_0x2cfc06){return{'message':_0x59cfd7,'unlock':_0x38e779,'active':_0x2cfc06};};exports[_0x3838('0xe')]=function(_0x17e0c4,_0x8855eb,_0x5793af){if(!_[_0x3838('0xf')](_0x5793af)&&_0x3838('0x10')===typeof _0x5793af&&!_[_0x3838('0x11')](_0x5793af)){if(!_[_0x3838('0xf')](_0x8855eb)&&_0x3838('0x10')===typeof _0x8855eb&&!_['isEmpty'](_0x8855eb)){return util[_0x3838('0x12')](_0x3838('0x13'),_0x8855eb,_0x5793af);}return util[_0x3838('0x12')]('\x22%s\x22\x20<%s>',_0x5793af,_0x5793af);}if(!_[_0x3838('0xf')](_0x17e0c4)&&_0x3838('0x10')===typeof _0x17e0c4&&!_['isEmpty'](_0x17e0c4)){return _0x17e0c4;}return _0x3838('0x14');};exports[_0x3838('0x15')]=function(_0x50c9a1){if(_[_0x3838('0x16')](_0x50c9a1)){return![];}return _0x50c9a1;};exports['addVariables']=function(_0x26580,_0x37f607,_0x1ae6c9,_0x2f9965,_0x31a4b8,_0x58175e){var _0x5d7dd0={'XMD-QUEUE':_0x37f607[_0x3838('0x17')]?_0x37f607['Queue'][_0x3838('0x18')]:'','XMD-CALLERID':_0x2f9965,'XMD-CALLERID-PREVIEW':_0x58175e?util[_0x3838('0x12')](_0x3838('0x13'),_0x58175e[_0x3838('0x19')],_0x58175e[_0x3838('0x1a')]):_0x2f9965,'XMD-DIALID':_0x31a4b8,'XMD-CONTACTID':_0x37f607[_0x3838('0x1b')],'XMD-CDRTYPE':_0x3838('0x1c'),'CALLERID(all)':_0x2f9965,'XMD-VOICEQUEUEID':_0x37f607[_0x3838('0x1d')],'XMD-DIALCHANNEL':_0x1ae6c9,'XMD-DIALTIMEOUT':_0x26580['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x3838('0x12')]('\x22rtTxX%s%s\x22',_0x26580[_0x3838('0x1e')]?'g':'',_[_0x3838('0x11')](_0x26580['monitor_format'])?'':_0x3838('0x1f')),'XMD-DIALURL':_0x26580[_0x3838('0x20')]||'','XMD-AGI':_0x26580['dialQueueProject']?util[_0x3838('0x12')](_0x3838('0x21'),ipAgi,_0x26580['dialQueueProject']):_0x3838('0x22'),'XMD-AGIAFTER':_0x26580['dialQueueProject2']?util[_0x3838('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x26580['dialQueueProject2']):_0x3838('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x58175e?_0x58175e[_0x3838('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x58175e?_0x58175e[_0x3838('0x24')]:'','XMD-DESTINATION':_0x3838('0x25')};if(!_[_0x3838('0x11')](_0x26580['monitor_format'])){_0x5d7dd0[util[_0x3838('0x12')]('%s',_0x3838('0x26'))]=_0x26580[_0x3838('0x27')];_0x5d7dd0[util['format']('%s',_0x3838('0x28'))]=_0x31a4b8;}if(_0x37f607&&_0x37f607['Contact']){for(var _0x2549bd in _0x37f607['Contact']){if(_0x37f607[_0x3838('0x29')][_0x3838('0x2a')](_0x2549bd)){if(!_['isNil'](_0x37f607[_0x3838('0x29')][_0x2549bd])&&_0x2549bd!=='id'&&_0x2549bd!=='tags'&&_0x2549bd!=='createdAt'&&_0x2549bd!==_0x3838('0x2b')){_0x5d7dd0[util[_0x3838('0x12')]('%s%s','XMD-',_[_0x3838('0x2c')](_0x2549bd))]=_0x37f607['Contact'][_0x2549bd];}}}}return _0x5d7dd0;};exports[_0x3838('0x2d')]=function(_0x2fc1c7){var _0x32c34a={};for(var _0x36d129 in _0x2fc1c7){if(_0x2fc1c7[_0x3838('0x2a')](_0x36d129)){_0x32c34a[util[_0x3838('0x12')]('%s',_['toLower'](_0x36d129))]=_0x2fc1c7[_0x36d129];}}return{'variables':_0x32c34a};};exports[_0x3838('0x2e')]=function(_0x1c6301,_0x476d54){if(!_[_0x3838('0x16')](_0x1c6301)){if(_0x1c6301[_0x3838('0x2a')](_0x3838('0x2f'))){if(_0x1c6301[_0x3838('0x2f')]>0x0){_0x1c6301[_0x3838('0x2f')]-=0x1;}else{logger[_0x3838('0x9')](_0x3838('0x30'),_0x476d54);}}}else{logger[_0x3838('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x476d54);}};exports[_0x3838('0x31')]=function(_0x3eeb87){var _0x3518c9=moment()[_0x3838('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eeb87[_0x3838('0x32')]=0xd;_0x3eeb87[_0x3838('0x33')]=_0x3838('0x34');_0x3eeb87[_0x3838('0x35')]=_0x3518c9;_0x3eeb87['responsetime']=_0x3518c9;_0x3eeb87[_0x3838('0x36')]=_0x3518c9;};exports[_0x3838('0x37')]=function(_0x1c752e,_0x5784a9,_0x5ea658){var _0x29be80=moment()[_0x3838('0x12')](_0x3838('0x38'));_0x1c752e['state']=_0x5784a9;_0x1c752e['statedesc']=_0x5ea658;_0x1c752e[_0x3838('0x39')]=_0x29be80;_0x1c752e[_0x3838('0x3a')]=getSeconds(_0x1c752e[_0x3838('0x39')],_0x1c752e[_0x3838('0x35')]);};exports[_0x3838('0x3b')]=function(_0x45e0e8,_0x29c159,_0x235232){_0x45e0e8[_0x3838('0x3c')]=_0x29c159;_0x45e0e8['UserId']=_0x235232;};exports[_0x3838('0x3d')]=function(_0x303d26,_0x247a60,_0x390455){var _0x43a8d6=moment()[_0x3838('0x12')](_0x3838('0x38'));_0x303d26[_0x3838('0x32')]=_0x247a60;_0x303d26['statedesc']=_0x390455;_0x303d26[_0x3838('0x39')]=_0x303d26[_0x3838('0x39')]?_0x303d26['responsetime']:_0x43a8d6;_0x303d26[_0x3838('0x36')]=_0x303d26['endtime']?_0x303d26[_0x3838('0x36')]:_0x43a8d6;_0x303d26[_0x3838('0x3a')]=getSeconds(_0x303d26['responsetime']||0x0,_0x303d26['starttime']||0x0);_0x303d26['talktime']=_0x303d26[_0x3838('0x3e')]?getSeconds(_0x303d26[_0x3838('0x36')],_0x303d26[_0x3838('0x3e')]):0x0;};exports[_0x3838('0x3f')]=function(_0x5824c9){return _0x5824c9===_0x3838('0x40');};exports[_0x3838('0x41')]=function(_0x2b60ef,_0x36baca,_0x37e7f4,_0x4461e1,_0x3e9e7b){var _0x1fb44c=_0x4461e1?_0x3838('0x42'):_0x2b60ef[_0x3838('0x19')];_0x1fb44c=_0x3e9e7b?'BOOKED':_0x1fb44c;return{'actionid':_0x2b60ef[_0x3838('0x43')],'action':_0x3838('0x44'),'channel':_0x2b60ef[_0x3838('0x45')],'callerid':util[_0x3838('0x12')](_0x3838('0x13'),_0x1fb44c,_0x2b60ef[_0x3838('0x1a')]),'Exten':_0x3838('0x25'),'Context':'from-sip','Priority':'1','variable':_0x37e7f4,'timeout':(_0x36baca[_0x3838('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2b60ef['uniqueid']};};exports['totalGlobal']=function(_0x1f6503){return _0x1f6503[_0x3838('0x47')]+_0x1f6503[_0x3838('0x48')]+_0x1f6503['countnoanswerretry']+_0x1f6503[_0x3838('0x49')]+_0x1f6503['countnosuchnumberretry'];};exports[_0x3838('0x4a')]=function(_0x3f52fd){var _0x120791=_[_0x3838('0x4b')](_0x3f52fd);_0x120791[_0x3838('0x32')]=0xf;_0x120791[_0x3838('0x33')]=_0x3838('0x4c');return _0x120791;};exports[_0x3838('0x4d')]=function(_0x415af0,_0x18b817,_0x503de7){var _0x4bcbba={};_0x4bcbba[_0x18b817]=_0x415af0[_0x18b817];_0x4bcbba['active']=![];_0x4bcbba[_0x3838('0x4e')]=moment()[_0x3838('0x4f')](_0x503de7,_0x3838('0x50'))[_0x3838('0x12')](_0x3838('0x38'));_0x4bcbba[_0x3838('0x1b')]=_0x415af0[_0x3838('0x1b')];_0x4bcbba[_0x3838('0x51')]=_0x415af0[_0x3838('0x51')];_0x4bcbba[_0x3838('0x1d')]=_0x415af0[_0x3838('0x1d')]||undefined;return _0x4bcbba;};exports[_0x3838('0x52')]=function(_0x196e2d,_0xb8d91f){if(!_[_0x3838('0x16')](_0x196e2d)){if(_0x196e2d[_0x3838('0x53')]>0x0){_0x196e2d[_0x3838('0x53')]-=0x1;}else{logger[_0x3838('0x9')](_0xb8d91f,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3838('0x9')](_0xb8d91f,_0x3838('0x54'));}};exports['IsNotLoggedIn']=function(_0x2051e4){if(_0x2051e4<=0x0){return!![];}return![];};exports['buildObj']=function(_0x41c671,_0x22930d){_0x41c671[_0x3838('0x55')]=_0x22930d;_0x41c671[_0x3838('0x18')]=_0x41c671[_0x3838('0x56')];_0x41c671[_0x3838('0x57')]=_0x41c671[_0x3838('0x45')];return _0x41c671;};exports[_0x3838('0x58')]=function(_0x47a370){var _0x4b4cd4={};_0x4b4cd4[_0x3838('0x56')]=_0x47a370[_0x3838('0x56')];_0x4b4cd4['interface']=_0x47a370[_0x3838('0x45')];_0x4b4cd4[_0x3838('0x43')]=_0x47a370['uniqueid'];return _0x4b4cd4;};exports[_0x3838('0x59')]=function(_0x78db42){var _0x176643=[];for(var _0x387386 in _0x78db42){if(_0x78db42[_0x3838('0x2a')](_0x387386)){if(!_[_0x3838('0x16')](_0x78db42[_0x387386])&&_0x78db42[_0x387386][_0x3838('0x32')]==='not_inuse'&&_0x78db42[_0x387386]['status']==='reachable'){_0x176643[_0x3838('0x5a')](_0x78db42[_0x387386]['id']);}}}return _0x176643;};exports[_0x3838('0x5b')]=function(_0x39d583){var _0x4bc684=moment()[_0x3838('0x6')](0x0);var _0xcc9ba1=moment(_0x39d583)[_0x3838('0x6')](0x0);return _0x4bc684[_0x3838('0x7')](_0xcc9ba1,_0x3838('0x8'));};exports[_0x3838('0x5c')]=function(_0x2e352e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e352e[_0x3838('0x1b')],'ListId':_0x2e352e[_0x3838('0x51')],'VoiceQueueId':_0x2e352e[_0x3838('0x1d')]||undefined,'CampaignId':_0x2e352e['CampaignId']||undefined};};exports[_0x3838('0x5d')]=function(_0x2fb492){if(_0x2fb492===_0x3838('0x43')||_0x2fb492==='idContact'||_0x2fb492==='queue'||_0x2fb492===_0x3838('0x5e')||_0x2fb492===_0x3838('0x5f')||_0x2fb492===_0x3838('0x60')||_0x2fb492===_0x3838('0x3c')||_0x2fb492==='channelAgent'||_0x2fb492===_0x3838('0x19')||_0x2fb492===_0x3838('0x61')||_0x2fb492===_0x3838('0x1a')||_0x2fb492===_0x3838('0x4e')||_0x2fb492===_0x3838('0x47')||_0x2fb492==='countcongestionretry'||_0x2fb492===_0x3838('0x62')||_0x2fb492===_0x3838('0x63')||_0x2fb492===_0x3838('0x64')||_0x2fb492===_0x3838('0x65')||_0x2fb492==='callbackat'||_0x2fb492===_0x3838('0x66')||_0x2fb492===_0x3838('0x1b')||_0x2fb492==='ListId'||_0x2fb492==='UserId'||_0x2fb492===_0x3838('0x1d')||_0x2fb492===_0x3838('0x67')||_0x2fb492===_0x3838('0x68')||_0x2fb492==='xmd-queue'||_0x2fb492===_0x3838('0x69')||_0x2fb492===_0x3838('0x6a')||_0x2fb492===_0x3838('0x6b')||_0x2fb492===_0x3838('0x6c')||_0x2fb492===_0x3838('0x6d')||_0x2fb492===_0x3838('0x6e')||_0x2fb492===_0x3838('0x6f')||_0x2fb492===_0x3838('0x70')||_0x2fb492==='xmd-cdrtype'||_0x2fb492==='xmd-callerid'||_0x2fb492===_0x3838('0x71')||_0x2fb492==='xmd-agi'||_0x2fb492===_0x3838('0x72')||_0x2fb492===_0x3838('0x73')||_0x2fb492===_0x3838('0x74')||_0x2fb492===_0x3838('0x75')||_0x2fb492===_0x3838('0x76')||_0x2fb492===_0x3838('0x77')||_0x2fb492===_0x3838('0x78')||_0x2fb492==='rtpaudioqosrttbridged'||_0x2fb492===_0x3838('0x72')||_0x2fb492===_0x3838('0x73')||_0x2fb492===_0x3838('0x74')||_0x2fb492===_0x3838('0x75')||_0x2fb492===_0x3838('0x76')||_0x2fb492==='rtpaudioqoslossbridged'||_0x2fb492===_0x3838('0x78')||_0x2fb492===_0x3838('0x79')||_0x2fb492===_0x3838('0x7a')||_0x2fb492===_0x3838('0x7b')||_0x2fb492==='state'||_0x2fb492===_0x3838('0x33')){return![];}return!![];};exports[_0x3838('0x7c')]=function(_0x4b2636,_0xe43827){var _0x19f103,_0x5e30b9,_0x1a8844;if(_0xe43827<=0x0){_0xe43827=0x1;}_0x19f103=new RegExp('\x5cw{0,'+_0xe43827+'}$');_0x5e30b9=Math[_0x3838('0x7d')](0xa,_0xe43827-0x1);_0x1a8844=Math[_0x3838('0x7d')](0xa,_0xe43827)-0x1;return util[_0x3838('0x12')]('%s',_[_0x3838('0x7e')](_0x4b2636,_0x19f103,_[_0x3838('0x7f')](_0x5e30b9,_0x1a8844)));};exports[_0x3838('0x80')]=function(_0x1f1ad5){var _0x43ef91=_0x1f1ad5[_0x3838('0x81')](/"(.*?)"/);return _0x43ef91?_0x43ef91[0x1]:_0x1f1ad5;};exports[_0x3838('0x82')]=function(_0x245d7e){var _0x4e5065=_0x245d7e[_0x3838('0x81')](/<(.*?)>/);return _0x4e5065?_0x4e5065[0x1]:_0x245d7e;}; \ No newline at end of file +var _0x723c=['lastevent','queue','interface','buildAcw','agentReadyId','push','createBody','CampaignId','filterKey','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','UserId','logCustomer','endtime','talktime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn'];(function(_0x5540ea,_0xb04554){var _0x4922d5=function(_0x195d78){while(--_0x195d78){_0x5540ea['push'](_0x5540ea['shift']());}};_0x4922d5(++_0xb04554);}(_0x723c,0x1ad));var _0xc723=function(_0x36c390,_0x49e4a8){_0x36c390=_0x36c390-0x0;var _0x9d677a=_0x723c[_0x36c390];return _0x9d677a;};'use strict';var util=require('util');var _=require(_0xc723('0x0'));var moment=require(_0xc723('0x1'));var logger=require('../../../../config/logger')(_0xc723('0x2'));var ipAgi=process['env'][_0xc723('0x3')]||_0xc723('0x4');function getSeconds(_0x1013bb,_0x1f1a05){var _0x171018=moment(_0x1013bb)[_0xc723('0x5')](0x0);var _0xa08b3=moment(_0x1f1a05)['milliseconds'](0x0);return _0x171018[_0xc723('0x6')](_0xa08b3,_0xc723('0x7'));}exports['loggerCatch']=function(_0x199e04){return function(_0xe4e485){logger[_0xc723('0x8')](_0x199e04,util[_0xc723('0x9')](_0xe4e485,{'showHidden':![],'depth':null}));};};exports[_0xc723('0xa')]=function(_0x53a326,_0x5ca320){logger[_0xc723('0xb')](_0x53a326,util[_0xc723('0x9')](_0x5ca320,{'showHidden':![],'depth':null}));};exports[_0xc723('0xc')]=function(_0x20a96d,_0x5cc2d6){logger[_0xc723('0x8')](_0x20a96d,util[_0xc723('0x9')](_0x5cc2d6,{'showHidden':![],'depth':null}));};exports[_0xc723('0xd')]=function(_0x82379b){return function(_0x3f4842){logger['info'](_0x82379b,util[_0xc723('0x9')](_0x3f4842,{'showHidden':![],'depth':null}));};};exports[_0xc723('0xe')]=function(_0x3d988b,_0x1e3e0a,_0x2c7596){return{'message':_0x3d988b,'unlock':_0x1e3e0a,'active':_0x2c7596};};exports['getCallerId']=function(_0x2e8be7,_0x5426f8,_0x5e37c1){if(!_[_0xc723('0xf')](_0x5e37c1)&&_0xc723('0x10')===typeof _0x5e37c1&&!_[_0xc723('0x11')](_0x5e37c1)){if(!_[_0xc723('0xf')](_0x5426f8)&&_0xc723('0x10')===typeof _0x5426f8&&!_[_0xc723('0x11')](_0x5426f8)){return util[_0xc723('0x12')](_0xc723('0x13'),_0x5426f8,_0x5e37c1);}return util['format'](_0xc723('0x13'),_0x5e37c1,_0x5e37c1);}if(!_[_0xc723('0xf')](_0x2e8be7)&&_0xc723('0x10')===typeof _0x2e8be7&&!_[_0xc723('0x11')](_0x2e8be7)){return _0x2e8be7;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x1984ab){if(_[_0xc723('0x14')](_0x1984ab)){return![];}return _0x1984ab;};exports[_0xc723('0x15')]=function(_0xcae217,_0x1fbfe0,_0x5478ec,_0x341584,_0x23988a,_0x27638c){var _0x172cf0={'XMD-QUEUE':_0x1fbfe0[_0xc723('0x16')]?_0x1fbfe0[_0xc723('0x16')][_0xc723('0x17')]:'','XMD-CALLERID':_0x341584,'XMD-CALLERID-PREVIEW':_0x27638c?util[_0xc723('0x12')](_0xc723('0x13'),_0x27638c[_0xc723('0x18')],_0x27638c[_0xc723('0x19')]):_0x341584,'XMD-DIALID':_0x23988a,'XMD-CONTACTID':_0x1fbfe0[_0xc723('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x341584,'XMD-VOICEQUEUEID':_0x1fbfe0[_0xc723('0x1b')],'XMD-DIALCHANNEL':_0x5478ec,'XMD-DIALTIMEOUT':_0xcae217['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc723('0x12')](_0xc723('0x1c'),_0xcae217[_0xc723('0x1d')]?'g':'',_['isEmpty'](_0xcae217[_0xc723('0x1e')])?'':_0xc723('0x1f')),'XMD-DIALURL':_0xcae217['dialPreviewUrl']||'','XMD-AGI':_0xcae217['dialQueueProject']?util[_0xc723('0x12')](_0xc723('0x20'),ipAgi,_0xcae217[_0xc723('0x21')]):_0xc723('0x22'),'XMD-AGIAFTER':_0xcae217[_0xc723('0x1d')]?util[_0xc723('0x12')](_0xc723('0x20'),ipAgi,_0xcae217[_0xc723('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x27638c?_0x27638c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x27638c?_0x27638c[_0xc723('0x23')]:'','XMD-DESTINATION':_0xc723('0x24')};if(!_[_0xc723('0x11')](_0xcae217['monitor_format'])){_0x172cf0[util[_0xc723('0x12')]('%s',_0xc723('0x25'))]=_0xcae217[_0xc723('0x1e')];_0x172cf0[util[_0xc723('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x23988a;}if(_0x1fbfe0&&_0x1fbfe0[_0xc723('0x26')]){for(var _0x13407b in _0x1fbfe0[_0xc723('0x26')]){if(_0x1fbfe0['Contact'][_0xc723('0x27')](_0x13407b)){if(!_[_0xc723('0x14')](_0x1fbfe0[_0xc723('0x26')][_0x13407b])&&_0x13407b!=='id'&&_0x13407b!=='tags'&&_0x13407b!==_0xc723('0x28')&&_0x13407b!=='updatedAt'){_0x172cf0[util['format']('%s%s',_0xc723('0x29'),_[_0xc723('0x2a')](_0x13407b))]=_0x1fbfe0['Contact'][_0x13407b];}}}}return _0x172cf0;};exports[_0xc723('0x2b')]=function(_0x17b6fb){var _0x8f9eba={};for(var _0x2c66e3 in _0x17b6fb){if(_0x17b6fb[_0xc723('0x27')](_0x2c66e3)){_0x8f9eba[util[_0xc723('0x12')]('%s',_[_0xc723('0x2c')](_0x2c66e3))]=_0x17b6fb[_0x2c66e3];}}return{'variables':_0x8f9eba};};exports[_0xc723('0x2d')]=function(_0x1a8272,_0x145da7){if(!_[_0xc723('0x14')](_0x1a8272)){if(_0x1a8272[_0xc723('0x27')]('originated')){if(_0x1a8272[_0xc723('0x2e')]>0x0){_0x1a8272['originated']-=0x1;}else{logger['error'](_0xc723('0x2f'),_0x145da7);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x145da7);}};exports[_0xc723('0x30')]=function(_0x264234){var _0x22565d=moment()[_0xc723('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x264234[_0xc723('0x31')]=0xd;_0x264234[_0xc723('0x32')]=_0xc723('0x33');_0x264234[_0xc723('0x34')]=_0x22565d;_0x264234[_0xc723('0x35')]=_0x22565d;_0x264234['endtime']=_0x22565d;};exports[_0xc723('0x36')]=function(_0x17babb,_0x109089,_0x2b988f){var _0x44177d=moment()['format'](_0xc723('0x37'));_0x17babb['state']=_0x109089;_0x17babb[_0xc723('0x32')]=_0x2b988f;_0x17babb[_0xc723('0x35')]=_0x44177d;_0x17babb[_0xc723('0x38')]=getSeconds(_0x17babb[_0xc723('0x35')],_0x17babb[_0xc723('0x34')]);};exports['logLookAgent']=function(_0x41e738,_0x1cdb09,_0x8208e5){_0x41e738[_0xc723('0x39')]=_0x1cdb09;_0x41e738[_0xc723('0x3a')]=_0x8208e5;};exports[_0xc723('0x3b')]=function(_0x5cfd20,_0x5c6ee0,_0xe495bd){var _0x17926b=moment()[_0xc723('0x12')](_0xc723('0x37'));_0x5cfd20[_0xc723('0x31')]=_0x5c6ee0;_0x5cfd20['statedesc']=_0xe495bd;_0x5cfd20[_0xc723('0x35')]=_0x5cfd20[_0xc723('0x35')]?_0x5cfd20[_0xc723('0x35')]:_0x17926b;_0x5cfd20[_0xc723('0x3c')]=_0x5cfd20[_0xc723('0x3c')]?_0x5cfd20[_0xc723('0x3c')]:_0x17926b;_0x5cfd20[_0xc723('0x38')]=getSeconds(_0x5cfd20[_0xc723('0x35')]||0x0,_0x5cfd20[_0xc723('0x34')]||0x0);_0x5cfd20[_0xc723('0x3d')]=_0x5cfd20['answertime']?getSeconds(_0x5cfd20['endtime'],_0x5cfd20['answertime']):0x0;};exports[_0xc723('0x3e')]=function(_0x50f4b7){return _0x50f4b7===_0xc723('0x3f');};exports[_0xc723('0x40')]=function(_0xcc18d5,_0x5cc27c,_0x4bd66c,_0x553ece,_0x3e5744){var _0x26f830=_0x553ece?_0xc723('0x41'):_0xcc18d5[_0xc723('0x18')];_0x26f830=_0x3e5744?'BOOKED':_0x26f830;return{'actionid':_0xcc18d5[_0xc723('0x42')],'action':_0xc723('0x43'),'channel':_0xcc18d5[_0xc723('0x44')],'callerid':util[_0xc723('0x12')](_0xc723('0x13'),_0x26f830,_0xcc18d5['calleridnum']),'Exten':_0xc723('0x24'),'Context':_0xc723('0x45'),'Priority':'1','variable':_0x4bd66c,'timeout':(_0x5cc27c[_0xc723('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcc18d5[_0xc723('0x42')]};};exports[_0xc723('0x47')]=function(_0x646632){return _0x646632[_0xc723('0x48')]+_0x646632['countcongestionretry']+_0x646632[_0xc723('0x49')]+_0x646632[_0xc723('0x4a')]+_0x646632[_0xc723('0x4b')];};exports['cloneAction']=function(_0x2397e8){var _0xf7bb41=_[_0xc723('0x4c')](_0x2397e8);_0xf7bb41[_0xc723('0x31')]=0xf;_0xf7bb41[_0xc723('0x32')]=_0xc723('0x4d');return _0xf7bb41;};exports[_0xc723('0x4e')]=function(_0x306b59,_0x21b2d3,_0x1ba868){var _0xa06e37={};_0xa06e37[_0x21b2d3]=_0x306b59[_0x21b2d3];_0xa06e37[_0xc723('0x4f')]=![];_0xa06e37['scheduledat']=moment()['add'](_0x1ba868,_0xc723('0x50'))['format'](_0xc723('0x37'));_0xa06e37[_0xc723('0x1a')]=_0x306b59[_0xc723('0x1a')];_0xa06e37[_0xc723('0x51')]=_0x306b59['ListId'];_0xa06e37[_0xc723('0x1b')]=_0x306b59[_0xc723('0x1b')]||undefined;return _0xa06e37;};exports[_0xc723('0x52')]=function(_0x2c2278,_0xd645e8){if(!_[_0xc723('0x14')](_0x2c2278)){if(_0x2c2278[_0xc723('0x53')]>0x0){_0x2c2278['pTalking']-=0x1;}else{logger[_0xc723('0x8')](_0xd645e8,_0xc723('0x54'));}}else{logger[_0xc723('0x8')](_0xd645e8,_0xc723('0x55'));}};exports[_0xc723('0x56')]=function(_0x1ee759){if(_0x1ee759<=0x0){return!![];}return![];};exports['buildObj']=function(_0x4ab440,_0x8e0ef7){_0x4ab440[_0xc723('0x57')]=_0x8e0ef7;_0x4ab440['name']=_0x4ab440[_0xc723('0x58')];_0x4ab440[_0xc723('0x59')]=_0x4ab440[_0xc723('0x44')];return _0x4ab440;};exports[_0xc723('0x5a')]=function(_0x3c0dfa){var _0x3a5fc2={};_0x3a5fc2[_0xc723('0x58')]=_0x3c0dfa[_0xc723('0x58')];_0x3a5fc2['interface']=_0x3c0dfa[_0xc723('0x44')];_0x3a5fc2[_0xc723('0x42')]=_0x3c0dfa['uniqueid'];return _0x3a5fc2;};exports[_0xc723('0x5b')]=function(_0x195357){var _0x2ca8ad=[];for(var _0x4aa9c2 in _0x195357){if(_0x195357['hasOwnProperty'](_0x4aa9c2)){if(!_[_0xc723('0x14')](_0x195357[_0x4aa9c2])&&_0x195357[_0x4aa9c2][_0xc723('0x31')]==='not_inuse'&&_0x195357[_0x4aa9c2]['status']==='reachable'){_0x2ca8ad[_0xc723('0x5c')](_0x195357[_0x4aa9c2]['id']);}}}return _0x2ca8ad;};exports['getDiff']=function(_0x4d99c2){var _0x50b77e=moment()[_0xc723('0x5')](0x0);var _0x33c962=moment(_0x4d99c2)[_0xc723('0x5')](0x0);return _0x50b77e[_0xc723('0x6')](_0x33c962,'seconds');};exports[_0xc723('0x5d')]=function(_0x64beb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x64beb['ContactId'],'ListId':_0x64beb['ListId'],'VoiceQueueId':_0x64beb[_0xc723('0x1b')]||undefined,'CampaignId':_0x64beb[_0xc723('0x5e')]||undefined};};exports[_0xc723('0x5f')]=function(_0x3309c6){if(_0x3309c6===_0xc723('0x42')||_0x3309c6==='idContact'||_0x3309c6===_0xc723('0x58')||_0x3309c6==='type'||_0x3309c6===_0xc723('0x60')||_0x3309c6===_0xc723('0x61')||_0x3309c6==='membername'||_0x3309c6==='channelAgent'||_0x3309c6===_0xc723('0x18')||_0x3309c6===_0xc723('0x4f')||_0x3309c6==='calleridnum'||_0x3309c6==='scheduledat'||_0x3309c6===_0xc723('0x48')||_0x3309c6==='countcongestionretry'||_0x3309c6===_0xc723('0x49')||_0x3309c6===_0xc723('0x62')||_0x3309c6===_0xc723('0x63')||_0x3309c6===_0xc723('0x64')||_0x3309c6===_0xc723('0x65')||_0x3309c6===_0xc723('0x66')||_0x3309c6===_0xc723('0x1a')||_0x3309c6===_0xc723('0x51')||_0x3309c6===_0xc723('0x3a')||_0x3309c6===_0xc723('0x1b')||_0x3309c6===_0xc723('0x67')||_0x3309c6==='xmd-voicequeueid'||_0x3309c6===_0xc723('0x68')||_0x3309c6==='xmd-phone'||_0x3309c6==='xmd-listid'||_0x3309c6===_0xc723('0x69')||_0x3309c6===_0xc723('0x6a')||_0x3309c6==='xmd-dialoptions'||_0x3309c6==='xmd-dialid'||_0x3309c6===_0xc723('0x6b')||_0x3309c6===_0xc723('0x6c')||_0x3309c6===_0xc723('0x6d')||_0x3309c6===_0xc723('0x6e')||_0x3309c6==='xmd-agiafter'||_0x3309c6===_0xc723('0x6f')||_0x3309c6===_0xc723('0x70')||_0x3309c6===_0xc723('0x71')||_0x3309c6===_0xc723('0x72')||_0x3309c6===_0xc723('0x73')||_0x3309c6===_0xc723('0x74')||_0x3309c6===_0xc723('0x75')||_0x3309c6===_0xc723('0x76')||_0x3309c6===_0xc723('0x77')||_0x3309c6==='rtpaudioqos'||_0x3309c6===_0xc723('0x71')||_0x3309c6===_0xc723('0x72')||_0x3309c6==='rtpaudioqosjitterbridged'||_0x3309c6===_0xc723('0x74')||_0x3309c6===_0xc723('0x75')||_0x3309c6===_0xc723('0x76')||_0x3309c6===_0xc723('0x77')||_0x3309c6===_0xc723('0x78')||_0x3309c6===_0xc723('0x79')||_0x3309c6==='state'||_0x3309c6===_0xc723('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0xdcae23,_0x4126e7){var _0x161c6e,_0x3cbf88,_0xfc5900;if(_0x4126e7<=0x0){_0x4126e7=0x1;}_0x161c6e=new RegExp(_0xc723('0x7a')+_0x4126e7+'}$');_0x3cbf88=Math[_0xc723('0x7b')](0xa,_0x4126e7-0x1);_0xfc5900=Math['pow'](0xa,_0x4126e7)-0x1;return util[_0xc723('0x12')]('%s',_[_0xc723('0x7c')](_0xdcae23,_0x161c6e,_[_0xc723('0x7d')](_0x3cbf88,_0xfc5900)));};exports[_0xc723('0x7e')]=function(_0x2f22be){var _0x3d4fb5=_0x2f22be['match'](/"(.*?)"/);return _0x3d4fb5?_0x3d4fb5[0x1]:_0x2f22be;};exports[_0xc723('0x7f')]=function(_0x14e1d0){var _0xd5d9ce=_0x14e1d0[_0xc723('0x80')](/<(.*?)>/);return _0xd5d9ce?_0xd5d9ce[0x1]:_0x14e1d0;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 37933b5..2a9d735 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x1eaa72,_0x321dd6){var _0x516be4=function(_0x21f8c7){while(--_0x21f8c7){_0x1eaa72['push'](_0x1eaa72['shift']());}};_0x516be4(++_0x321dd6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1abb3f,_0x3fca05){_0x1abb3f=_0x1abb3f-0x0;var _0x1181ca=_0x5f2f[_0x1abb3f];return _0x1181ca;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x2199fd,_0x30c86f){var _0x4b3afd=function(_0x223d20){while(--_0x223d20){_0x2199fd['push'](_0x2199fd['shift']());}};_0x4b3afd(++_0x30c86f);}(_0xb10b,0x12a));var _0xbb10=function(_0x34d6bd,_0x55b744){_0x34d6bd=_0x34d6bd-0x0;var _0x248396=_0xb10b[_0x34d6bd];return _0x248396;};'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 22dfa58..5d9b95f 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 _0xef0d=['../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','mergeFromDatabase','initTelephones','isUndefined','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','merge','initFaxAccounts','faxAccounts','exports','bluebird','util','moment','../model/agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef0d,0x6a));var _0xdef0=function(_0x531add,_0x261f9c){_0x531add=_0x531add-0x0;var _0x228566=_0xef0d[_0x531add];return _0x228566;};'use strict';var BPromise=require(_0xdef0('0x0'));var util=require(_0xdef0('0x1'));var _=require('lodash');var moment=require(_0xdef0('0x2'));var Agent=require(_0xdef0('0x3'));var Telephone=require(_0xdef0('0x4'));var Trunk=require(_0xdef0('0x5'));var VoiceQueue=require(_0xdef0('0x6'));var Trigger=require(_0xdef0('0x7'));var Template=require(_0xdef0('0x8'));var Campaign=require(_0xdef0('0x9'));var VoiceExtension=require(_0xdef0('0xa'));var ZendeskAccount=require(_0xdef0('0xb'));var SalesforceAccount=require(_0xdef0('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xdef0('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xdef0('0xe'));var VtigerAccount=require(_0xdef0('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xdef0('0x10'));var FreshsalesAccount=require(_0xdef0('0x11'));var FaxAccount=require(_0xdef0('0x12'));var Realtime=function(){this[_0xdef0('0x13')]={};this[_0xdef0('0x14')]={};this[_0xdef0('0x15')]={};this[_0xdef0('0x16')]={};this[_0xdef0('0x17')]={};this[_0xdef0('0x18')]={};this['templates']={};this[_0xdef0('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdef0('0x1a')]={};this[_0xdef0('0x1b')]={};this[_0xdef0('0x1c')]={};this[_0xdef0('0x1d')]={};this[_0xdef0('0x1e')]={};this['zendeskAccounts']={};this[_0xdef0('0x1f')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xdef0('0x20')]={};this[_0xdef0('0x21')]={};this[_0xdef0('0x22')]={};this[_0xdef0('0x23')]={};this[_0xdef0('0x24')]={};this[_0xdef0('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2cb289,_0x109945,_0x534f5a){var _0x5b502d=_[_0xdef0('0x26')](_0x2cb289,function(_0xfb4ccd,_0x520c65){return _0xfb4ccd[_0x534f5a];});for(var _0x2f6d82 in _0x109945){if(_0x109945[_0xdef0('0x27')](_0x2f6d82)){if(!_0x5b502d[_0x2f6d82]){delete _0x109945[_0x2f6d82];}}}}function freeIsNotKeySip(_0x237509,_0x2e64f0){var _0x27c4c4=_['mapKeys'](_0x237509,function(_0x57a01e,_0x5b6f7d){return util['format'](_0xdef0('0x28'),_0x57a01e[_0xdef0('0x29')]);});for(var _0x309011 in _0x2e64f0){if(_0x2e64f0[_0xdef0('0x27')](_0x309011)){if(!_0x27c4c4[_0x309011]){delete _0x2e64f0[_0x309011];}}}}function freeIsNotKeyAgent(_0xfcbfca,_0x2ccece){var _0x1a0a64=_[_0xdef0('0x26')](_0xfcbfca,function(_0x414773,_0x190be2){var _0x26dd1a=_[_0xdef0('0x2a')](_0x414773[_0xdef0('0x2b')])?util[_0xdef0('0x2c')](_0xdef0('0x28'),_0x414773[_0xdef0('0x29')]):_0x414773['interface'];return _0x26dd1a;});for(var _0x3d8e1c in _0x2ccece){if(_0x2ccece[_0xdef0('0x27')](_0x3d8e1c)){if(!_0x1a0a64[_0x3d8e1c]){delete _0x2ccece[_0x3d8e1c];}}}}function clearVoiceCallReports(_0x143075){_0x143075[_0xdef0('0x2d')]=0x0;_0x143075[_0xdef0('0x2e')]=0x0;_0x143075[_0xdef0('0x2f')]=0x0;_0x143075[_0xdef0('0x30')]=0x0;_0x143075[_0xdef0('0x31')]=0x0;}function clearCampaigns(_0x459eb3){if(!_[_0xdef0('0x32')](_0x459eb3)){for(var _0x5010e9 in _0x459eb3){if(_0x459eb3['hasOwnProperty'](_0x5010e9)){_0x459eb3[_0x5010e9][_0xdef0('0x33')]=0x0;_0x459eb3[_0x5010e9][_0xdef0('0x34')]=0x0;}}}}function clearVoiceQueues(_0x5295f1){if(!_['isEmpty'](_0x5295f1)){for(var _0x51d393 in _0x5295f1){if(_0x5295f1[_0xdef0('0x27')](_0x51d393)){_0x5295f1[_0x51d393][_0xdef0('0x2d')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x2e')]=0x0;_0x5295f1[_0x51d393]['unmanaged']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x35')]=0x0;_0x5295f1[_0x51d393]['sumHoldTime']=0x0;_0x5295f1[_0x51d393]['sumDuration']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x31')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x36')]=0x0;_0x5295f1[_0x51d393]['outboundNoAnswerCallsDay']=0x0;_0x5295f1[_0x51d393]['outboundBusyCallsDay']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x37')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x38')]=0x0;_0x5295f1[_0x51d393]['outboundUnknownCallsDay']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x39')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x3a')]=0x0;_0x5295f1[_0x51d393]['outboundBlacklistCallsDay']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x3b')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x3c')]=0x0;_0x5295f1[_0x51d393]['outboundReCallsDay']=0x0;_0x5295f1[_0x51d393][_0xdef0('0x36')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x3d')]=0x0;_0x5295f1[_0x51d393][_0xdef0('0x3e')]=!![];}}}}Realtime[_0xdef0('0x3f')]['mergeFromDatabase']=function(_0x483666,_0x40af45){for(var _0x8ae5eb in _0x40af45){if(_0x483666['hasOwnProperty'](_0x8ae5eb)){_0x483666[_0x8ae5eb]=_0x40af45[_0x8ae5eb];}}};Realtime[_0xdef0('0x3f')][_0xdef0('0x40')]=function(){var _0x302141=this;return function(_0x47cebd){if(_0x47cebd){freeIsNotKeyAgent(_0x47cebd,_0x302141['agents']);for(var _0x3269cc=0x0,_0x2a50c7={},_0x5f384a={};_0x3269cc<_0x47cebd[_0xdef0('0x41')];_0x3269cc+=0x1){_0x2a50c7=_0x47cebd[_0x3269cc];var _0x4186a8=_[_0xdef0('0x2a')](_0x2a50c7[_0xdef0('0x2b')])?util['format'](_0xdef0('0x28'),_0x2a50c7[_0xdef0('0x29')]):_0x2a50c7[_0xdef0('0x2b')];if(_['isUndefined'](_0x302141[_0xdef0('0x13')][_0x4186a8])){_0x302141[_0xdef0('0x13')][_0x4186a8]=new Agent(_0x2a50c7);}else{_0x302141[_0xdef0('0x42')](_0x302141[_0xdef0('0x13')][_0x4186a8],_0x2a50c7);}}}return _0x302141['agents'];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x43')]=function(){var _0x445c5d=this;return function(_0x33db17){if(_0x33db17){freeIsNotKeySip(_0x33db17,_0x445c5d['telephones']);for(var _0x536ce9=0x0,_0x4b1fcc={},_0x3f78a9={};_0x536ce9<_0x33db17[_0xdef0('0x41')];_0x536ce9+=0x1){_0x4b1fcc=_0x33db17[_0x536ce9];if(_[_0xdef0('0x44')](_0x445c5d[_0xdef0('0x14')][util[_0xdef0('0x2c')](_0xdef0('0x28'),_0x4b1fcc[_0xdef0('0x29')])])){_0x445c5d[_0xdef0('0x14')][util[_0xdef0('0x2c')]('SIP/%s',_0x4b1fcc[_0xdef0('0x29')])]=new Telephone(_0x4b1fcc);}else{_0x445c5d[_0xdef0('0x42')](_0x445c5d[_0xdef0('0x14')][util[_0xdef0('0x2c')]('SIP/%s',_0x4b1fcc[_0xdef0('0x29')])],_0x4b1fcc);}}}return _0x445c5d[_0xdef0('0x14')];};};Realtime[_0xdef0('0x3f')]['initTrunks']=function(){var _0x8e9b2e=this;return function(_0x54f89e){if(_0x54f89e){freeIsNotKeySip(_0x54f89e,_0x8e9b2e['trunks']);for(var _0x271251=0x0,_0x3d0f4b={},_0x573d4d={};_0x271251<_0x54f89e[_0xdef0('0x41')];_0x271251+=0x1){_0x3d0f4b=_0x54f89e[_0x271251];if(_[_0xdef0('0x44')](_0x8e9b2e[_0xdef0('0x15')][util[_0xdef0('0x2c')](_0xdef0('0x28'),_0x3d0f4b[_0xdef0('0x29')])])){_0x8e9b2e['trunks'][util['format']('SIP/%s',_0x3d0f4b['name'])]=new Trunk(_0x3d0f4b);}else{_0x8e9b2e['mergeFromDatabase'](_0x8e9b2e['trunks'][util[_0xdef0('0x2c')](_0xdef0('0x28'),_0x3d0f4b['name'])],_0x3d0f4b);}}}return _0x8e9b2e['trunks'];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x45')]=function(){var _0x1c88f0=this;return function(_0x2147c7){if(_0x2147c7){freeIsNotKey(_0x2147c7,_0x1c88f0['voiceQueues'],_0xdef0('0x29'));for(var _0x123930=0x0,_0x4c50a0={},_0x1b144e={};_0x123930<_0x2147c7[_0xdef0('0x41')];_0x123930+=0x1){_0x4c50a0=_0x2147c7[_0x123930];if(_[_0xdef0('0x44')](_0x1c88f0[_0xdef0('0x16')][_0x4c50a0[_0xdef0('0x29')]])){_0x1c88f0[_0xdef0('0x16')][_0x4c50a0[_0xdef0('0x29')]]=new VoiceQueue(_0x4c50a0);}else{_0x1c88f0['mergeFromDatabase'](_0x1c88f0[_0xdef0('0x16')][_0x4c50a0[_0xdef0('0x29')]],_0x4c50a0);}}}return _0x1c88f0[_0xdef0('0x16')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x46')]=function(){var _0x521618=this;return function(_0x53b4b5){if(_0x53b4b5){freeIsNotKey(_0x53b4b5,_0x521618[_0xdef0('0x17')],'id');for(var _0x4b7e23=0x0,_0x358a1d={},_0x108fcd={};_0x4b7e23<_0x53b4b5[_0xdef0('0x41')];_0x4b7e23+=0x1){_0x358a1d=_0x53b4b5[_0x4b7e23];if(_[_0xdef0('0x44')](_0x521618[_0xdef0('0x17')][_0x358a1d['id']])){_0x521618['triggers'][_0x358a1d['id']]=new Trigger(_0x358a1d);}else{_0x521618[_0xdef0('0x42')](_0x521618[_0xdef0('0x17')][_0x358a1d['id']],_0x358a1d);}}}return _0x521618['triggers'];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x47')]=function(){var _0x516ffd=this;return function(_0x32dd56){if(_0x32dd56){freeIsNotKey(_0x32dd56,_0x516ffd['templates'],'id');for(var _0x2d5a0c=0x0,_0x32fa75={},_0x5ed1bd={};_0x2d5a0c<_0x32dd56[_0xdef0('0x41')];_0x2d5a0c+=0x1){_0x32fa75=_0x32dd56[_0x2d5a0c];if(_[_0xdef0('0x44')](_0x516ffd['templates'][_0x32fa75['id']])){_0x516ffd['templates'][_0x32fa75['id']]=new Template(_0x32fa75);}else{_0x516ffd[_0xdef0('0x42')](_0x516ffd['templates'][_0x32fa75['id']],_0x32fa75);}}}return _0x516ffd[_0xdef0('0x48')];};};Realtime['prototype'][_0xdef0('0x49')]=function(){var _0x2cd30d=this;return function(_0x28cd16){if(_0x28cd16){freeIsNotKey(_0x28cd16,_0x2cd30d[_0xdef0('0x4a')],'id');for(var _0x54ec33=0x0,_0x3012c3={},_0x3bf3d5={};_0x54ec33<_0x28cd16[_0xdef0('0x41')];_0x54ec33+=0x1){_0x3012c3=_0x28cd16[_0x54ec33];if(_[_0xdef0('0x44')](_0x2cd30d[_0xdef0('0x4a')][_0x3012c3['id']])){_0x2cd30d['zendeskAccounts'][_0x3012c3['id']]=new ZendeskAccount(_0x3012c3);}else{_0x2cd30d['mergeFromDatabase'](_0x2cd30d[_0xdef0('0x4a')][_0x3012c3['id']],_0x3012c3);}}}return _0x2cd30d[_0xdef0('0x4a')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x4b')]=function(){var _0x3e0847=this;return function(_0x58bb64){if(_0x58bb64){freeIsNotKey(_0x58bb64,_0x3e0847[_0xdef0('0x1f')],'id');for(var _0x3a38e7=0x0,_0x40f11a={},_0x4d98b3={};_0x3a38e7<_0x58bb64[_0xdef0('0x41')];_0x3a38e7+=0x1){_0x40f11a=_0x58bb64[_0x3a38e7];if(_[_0xdef0('0x44')](_0x3e0847[_0xdef0('0x1f')][_0x40f11a['id']])){_0x3e0847[_0xdef0('0x1f')][_0x40f11a['id']]=new SalesforceAccount(_0x40f11a);}else{_0x3e0847['mergeFromDatabase'](_0x3e0847[_0xdef0('0x1f')][_0x40f11a['id']],_0x40f11a);}}}return _0x3e0847[_0xdef0('0x1f')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x4c')]=function(){var _0x327e8a=this;return function(_0x189fd3){if(_0x189fd3){freeIsNotKey(_0x189fd3,_0x327e8a[_0xdef0('0x4d')],'id');for(var _0x38688e=0x0,_0x2262bc={},_0x1c2fdb={};_0x38688e<_0x189fd3[_0xdef0('0x41')];_0x38688e+=0x1){_0x2262bc=_0x189fd3[_0x38688e];if(_[_0xdef0('0x44')](_0x327e8a[_0xdef0('0x4d')][_0x2262bc['id']])){_0x327e8a[_0xdef0('0x4d')][_0x2262bc['id']]=new FreshdeskAccount(_0x2262bc);}else{_0x327e8a[_0xdef0('0x42')](_0x327e8a[_0xdef0('0x4d')][_0x2262bc['id']],_0x2262bc);}}}return _0x327e8a['freshdeskAccounts'];};};Realtime['prototype'][_0xdef0('0x4e')]=function(){var _0x411917=this;return function(_0x49961a){if(_0x49961a){freeIsNotKey(_0x49961a,_0x411917['zohoAccounts'],'id');for(var _0x397e35=0x0,_0x29b41a={},_0x473363={};_0x397e35<_0x49961a[_0xdef0('0x41')];_0x397e35+=0x1){_0x29b41a=_0x49961a[_0x397e35];if(_[_0xdef0('0x44')](_0x411917[_0xdef0('0x20')][_0x29b41a['id']])){_0x411917[_0xdef0('0x20')][_0x29b41a['id']]=new ZohoAccount(_0x29b41a);}else{_0x411917[_0xdef0('0x42')](_0x411917[_0xdef0('0x20')][_0x29b41a['id']],_0x29b41a);}}}return _0x411917[_0xdef0('0x20')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x4f')]=function(){var _0x538621=this;return function(_0x3886d5){if(_0x3886d5){freeIsNotKey(_0x3886d5,_0x538621[_0xdef0('0x21')],'id');for(var _0xa66325=0x0,_0x428872={},_0x3d57e5={};_0xa66325<_0x3886d5[_0xdef0('0x41')];_0xa66325+=0x1){_0x428872=_0x3886d5[_0xa66325];if(_[_0xdef0('0x44')](_0x538621[_0xdef0('0x21')][_0x428872['id']])){_0x538621['deskAccounts'][_0x428872['id']]=new DeskAccount(_0x428872);}else{_0x538621[_0xdef0('0x42')](_0x538621['deskAccounts'][_0x428872['id']],_0x428872);}}}return _0x538621[_0xdef0('0x21')];};};Realtime[_0xdef0('0x3f')]['initSugarcrmAccounts']=function(){var _0x72d50a=this;return function(_0x473fee){if(_0x473fee){freeIsNotKey(_0x473fee,_0x72d50a[_0xdef0('0x50')],'id');for(var _0x48806d=0x0,_0x4b03d9={},_0x3ed77c={};_0x48806d<_0x473fee[_0xdef0('0x41')];_0x48806d+=0x1){_0x4b03d9=_0x473fee[_0x48806d];if(_[_0xdef0('0x44')](_0x72d50a[_0xdef0('0x50')][_0x4b03d9['id']])){_0x72d50a[_0xdef0('0x50')][_0x4b03d9['id']]=new SugarcrmAccount(_0x4b03d9);}else{_0x72d50a[_0xdef0('0x42')](_0x72d50a['sugarcrmAccounts'][_0x4b03d9['id']],_0x4b03d9);}}}return _0x72d50a[_0xdef0('0x50')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x51')]=function(){var _0x163aa3=this;return function(_0x1b7c45){if(_0x1b7c45){freeIsNotKey(_0x1b7c45,_0x163aa3[_0xdef0('0x22')],'id');for(var _0x1dc161=0x0,_0x49089f={},_0x25c8f7={};_0x1dc161<_0x1b7c45[_0xdef0('0x41')];_0x1dc161+=0x1){_0x49089f=_0x1b7c45[_0x1dc161];if(_['isUndefined'](_0x163aa3[_0xdef0('0x22')][_0x49089f['id']])){_0x163aa3[_0xdef0('0x22')][_0x49089f['id']]=new VtigerAccount(_0x49089f);}else{_0x163aa3['mergeFromDatabase'](_0x163aa3['vtigerAccounts'][_0x49089f['id']],_0x49089f);}}}return _0x163aa3['vtigerAccounts'];};};Realtime['prototype'][_0xdef0('0x52')]=function(){var _0x42d41d=this;return function(_0x125041){if(_0x125041){freeIsNotKey(_0x125041,_0x42d41d[_0xdef0('0x23')],'id');for(var _0x587992=0x0,_0xc0935e={},_0x4810b6={};_0x587992<_0x125041[_0xdef0('0x41')];_0x587992+=0x1){_0xc0935e=_0x125041[_0x587992];if(_[_0xdef0('0x44')](_0x42d41d[_0xdef0('0x23')][_0xc0935e['id']])){_0x42d41d[_0xdef0('0x23')][_0xc0935e['id']]=new ServicenowAccount(_0xc0935e);}else{_0x42d41d[_0xdef0('0x42')](_0x42d41d[_0xdef0('0x23')][_0xc0935e['id']],_0xc0935e);}}}return _0x42d41d['servicenowAccounts'];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x53')]=function(){var _0x31bf40=this;return function(_0x9e310a){if(_0x9e310a){freeIsNotKey(_0x9e310a,_0x31bf40[_0xdef0('0x24')],'id');for(var _0x11902a=0x0,_0x1adf3a={},_0x5a270a={};_0x11902a<_0x9e310a['length'];_0x11902a+=0x1){_0x1adf3a=_0x9e310a[_0x11902a];if(_[_0xdef0('0x44')](_0x31bf40['dynamics365Accounts'][_0x1adf3a['id']])){_0x31bf40['dynamics365Accounts'][_0x1adf3a['id']]=new Dynamics365Account(_0x1adf3a);}else{_0x31bf40['mergeFromDatabase'](_0x31bf40[_0xdef0('0x24')][_0x1adf3a['id']],_0x1adf3a);}}}return _0x31bf40[_0xdef0('0x24')];};};Realtime[_0xdef0('0x3f')]['initFreshsalesAccounts']=function(){var _0x5b21a0=this;return function(_0x453fba){if(_0x453fba){freeIsNotKey(_0x453fba,_0x5b21a0[_0xdef0('0x25')],'id');for(var _0x462eec=0x0,_0x42cdb6={},_0x3045a7={};_0x462eec<_0x453fba[_0xdef0('0x41')];_0x462eec+=0x1){_0x42cdb6=_0x453fba[_0x462eec];if(_['isUndefined'](_0x5b21a0[_0xdef0('0x25')][_0x42cdb6['id']])){_0x5b21a0[_0xdef0('0x25')][_0x42cdb6['id']]=new FreshsalesAccount(_0x42cdb6);}else{_0x5b21a0[_0xdef0('0x42')](_0x5b21a0['freshsalesAccounts'][_0x42cdb6['id']],_0x42cdb6);}}}return _0x5b21a0[_0xdef0('0x25')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x54')]=function(){var _0x4da90f=this;return function(_0x1685e1){for(var _0x36cb1c=0x0;_0x36cb1c<_0x1685e1[_0xdef0('0x41')];_0x36cb1c+=0x1){_['merge'](_0x4da90f[_0xdef0('0x16')][_0x1685e1[_0x36cb1c][_0xdef0('0x29')]],_0x1685e1[_0x36cb1c]);}return _0x4da90f[_0xdef0('0x16')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x55')]=function(){var _0x3b89d2=this;return function(_0xf7cf97){clearVoiceQueues(_0x3b89d2['voiceQueues']);if(_0xf7cf97){_0xf7cf97=_['groupBy'](_0xf7cf97,_0xdef0('0x56'));for(var _0x5c6764 in _0xf7cf97){if(_0xf7cf97[_0xdef0('0x27')](_0x5c6764)){var _0x56c110={};for(var _0x157737=0x0;_0x157737<_0xf7cf97[_0x5c6764][_0xdef0('0x41')];_0x157737+=0x1){var _0x39bddc=_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x57')];if(_0x3b89d2[_0xdef0('0x16')][_0x39bddc]){if(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x58')]){_0x3b89d2[_0xdef0('0x16')][_0x39bddc][_0xdef0('0x59')]+=0x1;}if(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5a')]){_0x3b89d2[_0xdef0('0x16')][_0x39bddc][_0xdef0('0x35')]+=0x1;}_0x3b89d2[_0xdef0('0x16')][_0x39bddc][_0xdef0('0x2f')]+=moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5b')])['diff'](moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5c')]),_0xdef0('0x5d'))||0x0;if(_0x157737===_0xf7cf97[_0x5c6764]['length']-0x1){_0x3b89d2['voiceQueues'][_0x39bddc]['sumDuration']+=moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5e')]||_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5f')]||_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x60')])[_0xdef0('0x61')](moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5c')]),_0xdef0('0x5d'))||0x0;_0x3b89d2['voiceQueues'][_0x39bddc]['total']+=0x1;if(_0xf7cf97[_0x5c6764][_0x157737]['queuecallercomplete']){_0x3b89d2[_0xdef0('0x16')][_0x39bddc][_0xdef0('0x2e')]+=0x1;_0x3b89d2[_0xdef0('0x16')][_0x39bddc][_0xdef0('0x31')]+=moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5e')])[_0xdef0('0x61')](moment(_0xf7cf97[_0x5c6764][_0x157737][_0xdef0('0x5b')]),_0xdef0('0x5d'))||0x0;}}else{_0x3b89d2['voiceQueues'][_0x39bddc][_0xdef0('0x30')]+=_0x3b89d2[_0xdef0('0x16')][_0x39bddc]['sumHoldTime']||0x0;}}}}}}return _0x3b89d2['voiceQueues'];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x62')]=function(){var _0x4595f0=this;return function(_0x1f1e45){clearVoiceCallReports(_0x4595f0[_0xdef0('0x19')]);if(_0x1f1e45){for(var _0x574712=0x0;_0x574712<_0x1f1e45['length'];_0x574712+=0x1){_0x4595f0['outbound'][_0xdef0('0x2d')]+=0x1;_0x4595f0[_0xdef0('0x19')][_0xdef0('0x30')]+=_0x1f1e45[_0x574712][_0xdef0('0x63')];if(_0x1f1e45[_0x574712][_0xdef0('0x64')]===_0xdef0('0x65')){_0x4595f0[_0xdef0('0x19')][_0xdef0('0x2e')]+=0x1;_0x4595f0['outbound'][_0xdef0('0x2f')]+=_0x1f1e45[_0x574712]['duration']-_0x1f1e45[_0x574712][_0xdef0('0x66')]||0x0;_0x4595f0[_0xdef0('0x19')][_0xdef0('0x31')]+=_0x1f1e45[_0x574712][_0xdef0('0x66')];}}}return _0x4595f0[_0xdef0('0x19')];};};Realtime['prototype'][_0xdef0('0x67')]=function(){var _0x5b8ef5=this;return function(_0x466052){if(_0x466052){freeIsNotKey(_0x466052,_0x5b8ef5[_0xdef0('0x18')],_0xdef0('0x29'));for(var _0xa0c555=0x0,_0x278c43={};_0xa0c555<_0x466052['length'];_0xa0c555+=0x1){_0x278c43=_0x466052[_0xa0c555];if(_[_0xdef0('0x44')](_0x5b8ef5[_0xdef0('0x18')][_0x278c43[_0xdef0('0x29')]])){_0x5b8ef5[_0xdef0('0x18')][_0x278c43[_0xdef0('0x29')]]=new Campaign(_0x278c43);}else{_0x5b8ef5['mergeFromDatabase'](_0x5b8ef5['campaigns'][_0x278c43[_0xdef0('0x29')]],_0x278c43);_0x5b8ef5['campaigns'][_0x278c43[_0xdef0('0x29')]][_0xdef0('0x68')]=_0x278c43[_0xdef0('0x69')]?_0x278c43[_0xdef0('0x69')][_0xdef0('0x29')]:undefined;}}}return _0x5b8ef5[_0xdef0('0x18')];};};Realtime[_0xdef0('0x3f')]['initVoiceExtensions']=function(){var _0x365b11=this;return function(_0x232f7b){if(_0x232f7b){freeIsNotKey(_0x232f7b,_0x365b11[_0xdef0('0x1a')],'id');for(var _0x2c8e48=0x0,_0x3eaee2={};_0x2c8e48<_0x232f7b[_0xdef0('0x41')];_0x2c8e48+=0x1){_0x3eaee2=_0x232f7b[_0x2c8e48];if(_['isUndefined'](_0x365b11[_0xdef0('0x1a')][_0x3eaee2['id']])){_0x365b11['voiceExtensions'][_0x3eaee2['id']]=new VoiceExtension(_0x3eaee2);}else{_0x365b11[_0xdef0('0x42')](_0x365b11[_0xdef0('0x1a')][_0x3eaee2['id']],_0x3eaee2);}}}return _0x365b11[_0xdef0('0x1a')];};};Realtime[_0xdef0('0x3f')]['initCampaignHopperHistory']=function(){var _0x189ab0=this;return function(_0x1af996){clearCampaigns(_0x189ab0[_0xdef0('0x18')]);for(var _0x3cdc1c=0x0;_0x3cdc1c<_0x1af996[_0xdef0('0x41')];_0x3cdc1c+=0x1){_[_0xdef0('0x6a')](_0x189ab0[_0xdef0('0x18')][_0x1af996[_0x3cdc1c][_0xdef0('0x29')]],_0x1af996[_0x3cdc1c]);}return _0x189ab0[_0xdef0('0x18')];};};Realtime[_0xdef0('0x3f')][_0xdef0('0x6b')]=function(){var _0x4fd158=this;return function(_0x1a6a4d){if(_0x1a6a4d){freeIsNotKey(_0x1a6a4d,_0x4fd158[_0xdef0('0x6c')],'id');for(var _0x4a687f=0x0,_0xb32d5={},_0x2babd7={};_0x4a687f<_0x1a6a4d[_0xdef0('0x41')];_0x4a687f+=0x1){_0xb32d5=_0x1a6a4d[_0x4a687f];if(_[_0xdef0('0x44')](_0x4fd158[_0xdef0('0x6c')][_0xb32d5['id']])){_0x4fd158[_0xdef0('0x6c')][_0xb32d5['id']]=new FaxAccount(_0xb32d5);}else{_0x4fd158[_0xdef0('0x42')](_0x4fd158[_0xdef0('0x6c')][_0xb32d5['id']],_0xb32d5);}}}return _0x4fd158[_0xdef0('0x6c')];};};module[_0xdef0('0x6d')]=Realtime; \ No newline at end of file +var _0xd83b=['queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','SIP/%s','initTelephones','isUndefined','format','initVoiceQueues','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','diff','seconds'];(function(_0x5b8a39,_0x18eb9c){var _0x12394d=function(_0x1f646a){while(--_0x1f646a){_0x5b8a39['push'](_0x5b8a39['shift']());}};_0x12394d(++_0x18eb9c);}(_0xd83b,0x79));var _0xbd83=function(_0x48f8ac,_0x556e00){_0x48f8ac=_0x48f8ac-0x0;var _0x235f4e=_0xd83b[_0x48f8ac];return _0x235f4e;};'use strict';var BPromise=require(_0xbd83('0x0'));var util=require(_0xbd83('0x1'));var _=require('lodash');var moment=require(_0xbd83('0x2'));var Agent=require(_0xbd83('0x3'));var Telephone=require(_0xbd83('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbd83('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xbd83('0x6'));var Campaign=require(_0xbd83('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xbd83('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbd83('0x9'));var SugarcrmAccount=require(_0xbd83('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbd83('0xb'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xbd83('0xc'));var Dynamics365Account=require(_0xbd83('0xd'));var FreshsalesAccount=require(_0xbd83('0xe'));var FaxAccount=require(_0xbd83('0xf'));var Realtime=function(){this[_0xbd83('0x10')]={};this[_0xbd83('0x11')]={};this[_0xbd83('0x12')]={};this[_0xbd83('0x13')]={};this['triggers']={};this[_0xbd83('0x14')]={};this[_0xbd83('0x15')]={};this[_0xbd83('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbd83('0x17')]={};this[_0xbd83('0x18')]={};this[_0xbd83('0x19')]={};this['outboundChannels']={};this[_0xbd83('0x1a')]={};this[_0xbd83('0x1b')]={};this[_0xbd83('0x1c')]={};this[_0xbd83('0x1d')]={};this[_0xbd83('0x1e')]={};this['zohoAccounts']={};this[_0xbd83('0x1f')]={};this[_0xbd83('0x20')]={};this[_0xbd83('0x21')]={};this['dynamics365Accounts']={};this[_0xbd83('0x22')]={};this[_0xbd83('0x23')]={};};function freeIsNotKey(_0x4782c3,_0x243725,_0x27c5c5){var _0x558c13=_[_0xbd83('0x24')](_0x4782c3,function(_0x4cdc54,_0x463623){return _0x4cdc54[_0x27c5c5];});for(var _0x42c9c7 in _0x243725){if(_0x243725[_0xbd83('0x25')](_0x42c9c7)){if(!_0x558c13[_0x42c9c7]){delete _0x243725[_0x42c9c7];}}}}function freeIsNotKeySip(_0x381691,_0x5ec2de){var _0x19eed0=_[_0xbd83('0x24')](_0x381691,function(_0x4d550b,_0x127ef8){return util['format']('SIP/%s',_0x4d550b[_0xbd83('0x26')]);});for(var _0x4ca7c5 in _0x5ec2de){if(_0x5ec2de[_0xbd83('0x25')](_0x4ca7c5)){if(!_0x19eed0[_0x4ca7c5]){delete _0x5ec2de[_0x4ca7c5];}}}}function freeIsNotKeyAgent(_0x4a8caa,_0x5e40da){var _0x51f875=_[_0xbd83('0x24')](_0x4a8caa,function(_0x11a6bc,_0x4fdc90){var _0x4f76b8=_['isNil'](_0x11a6bc[_0xbd83('0x27')])?util['format']('SIP/%s',_0x11a6bc[_0xbd83('0x26')]):_0x11a6bc[_0xbd83('0x27')];return _0x4f76b8;});for(var _0x438279 in _0x5e40da){if(_0x5e40da[_0xbd83('0x25')](_0x438279)){if(!_0x51f875[_0x438279]){delete _0x5e40da[_0x438279];}}}}function clearVoiceCallReports(_0x548f4e){_0x548f4e[_0xbd83('0x28')]=0x0;_0x548f4e[_0xbd83('0x29')]=0x0;_0x548f4e[_0xbd83('0x2a')]=0x0;_0x548f4e[_0xbd83('0x2b')]=0x0;_0x548f4e[_0xbd83('0x2c')]=0x0;}function clearCampaigns(_0x4749e7){if(!_[_0xbd83('0x2d')](_0x4749e7)){for(var _0x223e14 in _0x4749e7){if(_0x4749e7[_0xbd83('0x25')](_0x223e14)){_0x4749e7[_0x223e14][_0xbd83('0x2e')]=0x0;_0x4749e7[_0x223e14][_0xbd83('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x18c698){if(!_['isEmpty'](_0x18c698)){for(var _0x1b93c2 in _0x18c698){if(_0x18c698[_0xbd83('0x25')](_0x1b93c2)){_0x18c698[_0x1b93c2][_0xbd83('0x28')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x29')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x30')]=0x0;_0x18c698[_0x1b93c2]['abandoned']=0x0;_0x18c698[_0x1b93c2]['sumHoldTime']=0x0;_0x18c698[_0x1b93c2]['sumDuration']=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x2c')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x31')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x32')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x33')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x34')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x35')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x36')]=0x0;_0x18c698[_0x1b93c2]['outboundDropCallsDayTimeout']=0x0;_0x18c698[_0x1b93c2]['outboundDropCallsDayCallersExit']=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x37')]=0x0;_0x18c698[_0x1b93c2]['outboundOriginateFailureCallsDay']=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x38')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x39')]=0x0;_0x18c698[_0x1b93c2]['outboundAnswerAgiCallsDay']=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x3a')]=0x0;_0x18c698[_0x1b93c2][_0xbd83('0x3b')]=!![];}}}}Realtime[_0xbd83('0x3c')][_0xbd83('0x3d')]=function(_0x22ac4c,_0x561c12){for(var _0x358961 in _0x561c12){if(_0x22ac4c['hasOwnProperty'](_0x358961)){_0x22ac4c[_0x358961]=_0x561c12[_0x358961];}}};Realtime[_0xbd83('0x3c')]['initAgents']=function(){var _0x123b0e=this;return function(_0x211175){if(_0x211175){freeIsNotKeyAgent(_0x211175,_0x123b0e[_0xbd83('0x10')]);for(var _0x539b3c=0x0,_0x5328e4={},_0x4c27af={};_0x539b3c<_0x211175[_0xbd83('0x3e')];_0x539b3c+=0x1){_0x5328e4=_0x211175[_0x539b3c];var _0x3da2c0=_[_0xbd83('0x3f')](_0x5328e4[_0xbd83('0x27')])?util['format'](_0xbd83('0x40'),_0x5328e4[_0xbd83('0x26')]):_0x5328e4[_0xbd83('0x27')];if(_['isUndefined'](_0x123b0e[_0xbd83('0x10')][_0x3da2c0])){_0x123b0e[_0xbd83('0x10')][_0x3da2c0]=new Agent(_0x5328e4);}else{_0x123b0e[_0xbd83('0x3d')](_0x123b0e[_0xbd83('0x10')][_0x3da2c0],_0x5328e4);}}}return _0x123b0e['agents'];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x41')]=function(){var _0x259c44=this;return function(_0x5b6ed2){if(_0x5b6ed2){freeIsNotKeySip(_0x5b6ed2,_0x259c44[_0xbd83('0x11')]);for(var _0x29d85b=0x0,_0x1559de={},_0x1eb54e={};_0x29d85b<_0x5b6ed2[_0xbd83('0x3e')];_0x29d85b+=0x1){_0x1559de=_0x5b6ed2[_0x29d85b];if(_[_0xbd83('0x42')](_0x259c44[_0xbd83('0x11')][util[_0xbd83('0x43')](_0xbd83('0x40'),_0x1559de[_0xbd83('0x26')])])){_0x259c44['telephones'][util['format'](_0xbd83('0x40'),_0x1559de[_0xbd83('0x26')])]=new Telephone(_0x1559de);}else{_0x259c44['mergeFromDatabase'](_0x259c44['telephones'][util[_0xbd83('0x43')](_0xbd83('0x40'),_0x1559de[_0xbd83('0x26')])],_0x1559de);}}}return _0x259c44[_0xbd83('0x11')];};};Realtime[_0xbd83('0x3c')]['initTrunks']=function(){var _0x3cade2=this;return function(_0x7e10d6){if(_0x7e10d6){freeIsNotKeySip(_0x7e10d6,_0x3cade2[_0xbd83('0x12')]);for(var _0x5e7623=0x0,_0xba5c66={},_0x35584e={};_0x5e7623<_0x7e10d6[_0xbd83('0x3e')];_0x5e7623+=0x1){_0xba5c66=_0x7e10d6[_0x5e7623];if(_[_0xbd83('0x42')](_0x3cade2[_0xbd83('0x12')][util['format'](_0xbd83('0x40'),_0xba5c66[_0xbd83('0x26')])])){_0x3cade2[_0xbd83('0x12')][util['format'](_0xbd83('0x40'),_0xba5c66[_0xbd83('0x26')])]=new Trunk(_0xba5c66);}else{_0x3cade2[_0xbd83('0x3d')](_0x3cade2[_0xbd83('0x12')][util[_0xbd83('0x43')]('SIP/%s',_0xba5c66['name'])],_0xba5c66);}}}return _0x3cade2[_0xbd83('0x12')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x44')]=function(){var _0x41e1e6=this;return function(_0x527dad){if(_0x527dad){freeIsNotKey(_0x527dad,_0x41e1e6[_0xbd83('0x13')],_0xbd83('0x26'));for(var _0x495e38=0x0,_0x3befef={},_0x2bebcf={};_0x495e38<_0x527dad[_0xbd83('0x3e')];_0x495e38+=0x1){_0x3befef=_0x527dad[_0x495e38];if(_[_0xbd83('0x42')](_0x41e1e6['voiceQueues'][_0x3befef[_0xbd83('0x26')]])){_0x41e1e6[_0xbd83('0x13')][_0x3befef[_0xbd83('0x26')]]=new VoiceQueue(_0x3befef);}else{_0x41e1e6['mergeFromDatabase'](_0x41e1e6['voiceQueues'][_0x3befef[_0xbd83('0x26')]],_0x3befef);}}}return _0x41e1e6['voiceQueues'];};};Realtime[_0xbd83('0x3c')]['initTriggers']=function(){var _0x52a6d8=this;return function(_0x53edb0){if(_0x53edb0){freeIsNotKey(_0x53edb0,_0x52a6d8[_0xbd83('0x45')],'id');for(var _0x304e25=0x0,_0x59e472={},_0xdf3064={};_0x304e25<_0x53edb0[_0xbd83('0x3e')];_0x304e25+=0x1){_0x59e472=_0x53edb0[_0x304e25];if(_['isUndefined'](_0x52a6d8['triggers'][_0x59e472['id']])){_0x52a6d8[_0xbd83('0x45')][_0x59e472['id']]=new Trigger(_0x59e472);}else{_0x52a6d8['mergeFromDatabase'](_0x52a6d8[_0xbd83('0x45')][_0x59e472['id']],_0x59e472);}}}return _0x52a6d8[_0xbd83('0x45')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x46')]=function(){var _0x4bb031=this;return function(_0x1f70c3){if(_0x1f70c3){freeIsNotKey(_0x1f70c3,_0x4bb031[_0xbd83('0x15')],'id');for(var _0x4edb88=0x0,_0x166c87={},_0x96e12b={};_0x4edb88<_0x1f70c3[_0xbd83('0x3e')];_0x4edb88+=0x1){_0x166c87=_0x1f70c3[_0x4edb88];if(_[_0xbd83('0x42')](_0x4bb031[_0xbd83('0x15')][_0x166c87['id']])){_0x4bb031['templates'][_0x166c87['id']]=new Template(_0x166c87);}else{_0x4bb031['mergeFromDatabase'](_0x4bb031[_0xbd83('0x15')][_0x166c87['id']],_0x166c87);}}}return _0x4bb031[_0xbd83('0x15')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x47')]=function(){var _0x588c3c=this;return function(_0x1465e8){if(_0x1465e8){freeIsNotKey(_0x1465e8,_0x588c3c['zendeskAccounts'],'id');for(var _0x1e0767=0x0,_0x142351={},_0x4fe507={};_0x1e0767<_0x1465e8[_0xbd83('0x3e')];_0x1e0767+=0x1){_0x142351=_0x1465e8[_0x1e0767];if(_[_0xbd83('0x42')](_0x588c3c[_0xbd83('0x1b')][_0x142351['id']])){_0x588c3c[_0xbd83('0x1b')][_0x142351['id']]=new ZendeskAccount(_0x142351);}else{_0x588c3c[_0xbd83('0x3d')](_0x588c3c[_0xbd83('0x1b')][_0x142351['id']],_0x142351);}}}return _0x588c3c[_0xbd83('0x1b')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x48')]=function(){var _0x462bb2=this;return function(_0xddb13b){if(_0xddb13b){freeIsNotKey(_0xddb13b,_0x462bb2['salesforceAccounts'],'id');for(var _0x46ce55=0x0,_0x3824c7={},_0x3bcdf3={};_0x46ce55<_0xddb13b[_0xbd83('0x3e')];_0x46ce55+=0x1){_0x3824c7=_0xddb13b[_0x46ce55];if(_[_0xbd83('0x42')](_0x462bb2[_0xbd83('0x1c')][_0x3824c7['id']])){_0x462bb2['salesforceAccounts'][_0x3824c7['id']]=new SalesforceAccount(_0x3824c7);}else{_0x462bb2[_0xbd83('0x3d')](_0x462bb2[_0xbd83('0x1c')][_0x3824c7['id']],_0x3824c7);}}}return _0x462bb2[_0xbd83('0x1c')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x49')]=function(){var _0x3b406d=this;return function(_0x4ab2b1){if(_0x4ab2b1){freeIsNotKey(_0x4ab2b1,_0x3b406d[_0xbd83('0x1e')],'id');for(var _0x2c56f4=0x0,_0xbbec37={},_0x289950={};_0x2c56f4<_0x4ab2b1[_0xbd83('0x3e')];_0x2c56f4+=0x1){_0xbbec37=_0x4ab2b1[_0x2c56f4];if(_[_0xbd83('0x42')](_0x3b406d['freshdeskAccounts'][_0xbbec37['id']])){_0x3b406d[_0xbd83('0x1e')][_0xbbec37['id']]=new FreshdeskAccount(_0xbbec37);}else{_0x3b406d[_0xbd83('0x3d')](_0x3b406d['freshdeskAccounts'][_0xbbec37['id']],_0xbbec37);}}}return _0x3b406d['freshdeskAccounts'];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x4a')]=function(){var _0x115b7c=this;return function(_0x301d6b){if(_0x301d6b){freeIsNotKey(_0x301d6b,_0x115b7c['zohoAccounts'],'id');for(var _0x450f3f=0x0,_0x385d0c={},_0x403e02={};_0x450f3f<_0x301d6b['length'];_0x450f3f+=0x1){_0x385d0c=_0x301d6b[_0x450f3f];if(_[_0xbd83('0x42')](_0x115b7c[_0xbd83('0x4b')][_0x385d0c['id']])){_0x115b7c[_0xbd83('0x4b')][_0x385d0c['id']]=new ZohoAccount(_0x385d0c);}else{_0x115b7c[_0xbd83('0x3d')](_0x115b7c[_0xbd83('0x4b')][_0x385d0c['id']],_0x385d0c);}}}return _0x115b7c[_0xbd83('0x4b')];};};Realtime[_0xbd83('0x3c')]['initDeskAccounts']=function(){var _0x4dbca=this;return function(_0x5f1750){if(_0x5f1750){freeIsNotKey(_0x5f1750,_0x4dbca[_0xbd83('0x1f')],'id');for(var _0x525988=0x0,_0x38c071={},_0x3d5a2e={};_0x525988<_0x5f1750[_0xbd83('0x3e')];_0x525988+=0x1){_0x38c071=_0x5f1750[_0x525988];if(_[_0xbd83('0x42')](_0x4dbca['deskAccounts'][_0x38c071['id']])){_0x4dbca[_0xbd83('0x1f')][_0x38c071['id']]=new DeskAccount(_0x38c071);}else{_0x4dbca[_0xbd83('0x3d')](_0x4dbca[_0xbd83('0x1f')][_0x38c071['id']],_0x38c071);}}}return _0x4dbca['deskAccounts'];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x4c')]=function(){var _0x12b9ac=this;return function(_0x2382a7){if(_0x2382a7){freeIsNotKey(_0x2382a7,_0x12b9ac[_0xbd83('0x1d')],'id');for(var _0xf634f4=0x0,_0x4c0606={},_0x124964={};_0xf634f4<_0x2382a7[_0xbd83('0x3e')];_0xf634f4+=0x1){_0x4c0606=_0x2382a7[_0xf634f4];if(_[_0xbd83('0x42')](_0x12b9ac[_0xbd83('0x1d')][_0x4c0606['id']])){_0x12b9ac[_0xbd83('0x1d')][_0x4c0606['id']]=new SugarcrmAccount(_0x4c0606);}else{_0x12b9ac[_0xbd83('0x3d')](_0x12b9ac[_0xbd83('0x1d')][_0x4c0606['id']],_0x4c0606);}}}return _0x12b9ac[_0xbd83('0x1d')];};};Realtime[_0xbd83('0x3c')]['initVtigerAccounts']=function(){var _0x10d102=this;return function(_0x1fe8d0){if(_0x1fe8d0){freeIsNotKey(_0x1fe8d0,_0x10d102[_0xbd83('0x20')],'id');for(var _0x28f471=0x0,_0x5e9974={},_0x228d2b={};_0x28f471<_0x1fe8d0['length'];_0x28f471+=0x1){_0x5e9974=_0x1fe8d0[_0x28f471];if(_['isUndefined'](_0x10d102[_0xbd83('0x20')][_0x5e9974['id']])){_0x10d102[_0xbd83('0x20')][_0x5e9974['id']]=new VtigerAccount(_0x5e9974);}else{_0x10d102['mergeFromDatabase'](_0x10d102[_0xbd83('0x20')][_0x5e9974['id']],_0x5e9974);}}}return _0x10d102[_0xbd83('0x20')];};};Realtime['prototype'][_0xbd83('0x4d')]=function(){var _0x501aa4=this;return function(_0x32a331){if(_0x32a331){freeIsNotKey(_0x32a331,_0x501aa4[_0xbd83('0x21')],'id');for(var _0x2d3d83=0x0,_0x2ace2b={},_0x83f11b={};_0x2d3d83<_0x32a331[_0xbd83('0x3e')];_0x2d3d83+=0x1){_0x2ace2b=_0x32a331[_0x2d3d83];if(_['isUndefined'](_0x501aa4[_0xbd83('0x21')][_0x2ace2b['id']])){_0x501aa4['servicenowAccounts'][_0x2ace2b['id']]=new ServicenowAccount(_0x2ace2b);}else{_0x501aa4['mergeFromDatabase'](_0x501aa4[_0xbd83('0x21')][_0x2ace2b['id']],_0x2ace2b);}}}return _0x501aa4[_0xbd83('0x21')];};};Realtime['prototype'][_0xbd83('0x4e')]=function(){var _0x10372=this;return function(_0x45c4d5){if(_0x45c4d5){freeIsNotKey(_0x45c4d5,_0x10372['dynamics365Accounts'],'id');for(var _0x4e0da7=0x0,_0x3af95b={},_0x249bc9={};_0x4e0da7<_0x45c4d5[_0xbd83('0x3e')];_0x4e0da7+=0x1){_0x3af95b=_0x45c4d5[_0x4e0da7];if(_['isUndefined'](_0x10372[_0xbd83('0x4f')][_0x3af95b['id']])){_0x10372['dynamics365Accounts'][_0x3af95b['id']]=new Dynamics365Account(_0x3af95b);}else{_0x10372[_0xbd83('0x3d')](_0x10372['dynamics365Accounts'][_0x3af95b['id']],_0x3af95b);}}}return _0x10372[_0xbd83('0x4f')];};};Realtime[_0xbd83('0x3c')]['initFreshsalesAccounts']=function(){var _0x4bc407=this;return function(_0xe1bf30){if(_0xe1bf30){freeIsNotKey(_0xe1bf30,_0x4bc407[_0xbd83('0x22')],'id');for(var _0x5dd1c8=0x0,_0x52f364={},_0xe6e67a={};_0x5dd1c8<_0xe1bf30[_0xbd83('0x3e')];_0x5dd1c8+=0x1){_0x52f364=_0xe1bf30[_0x5dd1c8];if(_[_0xbd83('0x42')](_0x4bc407[_0xbd83('0x22')][_0x52f364['id']])){_0x4bc407[_0xbd83('0x22')][_0x52f364['id']]=new FreshsalesAccount(_0x52f364);}else{_0x4bc407[_0xbd83('0x3d')](_0x4bc407[_0xbd83('0x22')][_0x52f364['id']],_0x52f364);}}}return _0x4bc407[_0xbd83('0x22')];};};Realtime[_0xbd83('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x4dbdac=this;return function(_0x3f4498){for(var _0x2aad2e=0x0;_0x2aad2e<_0x3f4498['length'];_0x2aad2e+=0x1){_[_0xbd83('0x50')](_0x4dbdac[_0xbd83('0x13')][_0x3f4498[_0x2aad2e][_0xbd83('0x26')]],_0x3f4498[_0x2aad2e]);}return _0x4dbdac[_0xbd83('0x13')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x51')]=function(){var _0x3cb2ef=this;return function(_0x30f57d){clearVoiceQueues(_0x3cb2ef[_0xbd83('0x13')]);if(_0x30f57d){_0x30f57d=_[_0xbd83('0x52')](_0x30f57d,_0xbd83('0x53'));for(var _0x5c833b in _0x30f57d){if(_0x30f57d['hasOwnProperty'](_0x5c833b)){var _0x57b912={};for(var _0x2ae610=0x0;_0x2ae610<_0x30f57d[_0x5c833b][_0xbd83('0x3e')];_0x2ae610+=0x1){var _0x5a3588=_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x54')];if(_0x3cb2ef[_0xbd83('0x13')][_0x5a3588]){if(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x55')]){_0x3cb2ef[_0xbd83('0x13')][_0x5a3588]['unmanaged']+=0x1;}if(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x56')]){_0x3cb2ef['voiceQueues'][_0x5a3588][_0xbd83('0x57')]+=0x1;}_0x3cb2ef[_0xbd83('0x13')][_0x5a3588][_0xbd83('0x2a')]+=moment(_0x30f57d[_0x5c833b][_0x2ae610]['queuecallerleaveAt'])['diff'](moment(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x58')]),'seconds')||0x0;if(_0x2ae610===_0x30f57d[_0x5c833b][_0xbd83('0x3e')]-0x1){_0x3cb2ef['voiceQueues'][_0x5a3588][_0xbd83('0x2b')]+=moment(_0x30f57d[_0x5c833b][_0x2ae610]['queuecallercompleteAt']||_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x59')]||_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x5a')])[_0xbd83('0x5b')](moment(_0x30f57d[_0x5c833b][_0x2ae610]['queuecallerjoinAt']),_0xbd83('0x5c'))||0x0;_0x3cb2ef[_0xbd83('0x13')][_0x5a3588][_0xbd83('0x28')]+=0x1;if(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x5d')]){_0x3cb2ef['voiceQueues'][_0x5a3588][_0xbd83('0x29')]+=0x1;_0x3cb2ef[_0xbd83('0x13')][_0x5a3588][_0xbd83('0x2c')]+=moment(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x5e')])[_0xbd83('0x5b')](moment(_0x30f57d[_0x5c833b][_0x2ae610][_0xbd83('0x5f')]),_0xbd83('0x5c'))||0x0;}}else{_0x3cb2ef[_0xbd83('0x13')][_0x5a3588]['sumDuration']+=_0x3cb2ef[_0xbd83('0x13')][_0x5a3588]['sumHoldTime']||0x0;}}}}}}return _0x3cb2ef[_0xbd83('0x13')];};};Realtime['prototype'][_0xbd83('0x60')]=function(){var _0x1fead0=this;return function(_0x4fa0b8){clearVoiceCallReports(_0x1fead0[_0xbd83('0x16')]);if(_0x4fa0b8){for(var _0x31e6f2=0x0;_0x31e6f2<_0x4fa0b8[_0xbd83('0x3e')];_0x31e6f2+=0x1){_0x1fead0['outbound'][_0xbd83('0x28')]+=0x1;_0x1fead0[_0xbd83('0x16')][_0xbd83('0x2b')]+=_0x4fa0b8[_0x31e6f2][_0xbd83('0x61')];if(_0x4fa0b8[_0x31e6f2][_0xbd83('0x62')]===_0xbd83('0x63')){_0x1fead0[_0xbd83('0x16')][_0xbd83('0x29')]+=0x1;_0x1fead0['outbound'][_0xbd83('0x2a')]+=_0x4fa0b8[_0x31e6f2][_0xbd83('0x61')]-_0x4fa0b8[_0x31e6f2][_0xbd83('0x64')]||0x0;_0x1fead0[_0xbd83('0x16')][_0xbd83('0x2c')]+=_0x4fa0b8[_0x31e6f2][_0xbd83('0x64')];}}}return _0x1fead0['outbound'];};};Realtime['prototype'][_0xbd83('0x65')]=function(){var _0x176954=this;return function(_0x232c68){if(_0x232c68){freeIsNotKey(_0x232c68,_0x176954[_0xbd83('0x14')],_0xbd83('0x26'));for(var _0x4381df=0x0,_0x2ed6b9={};_0x4381df<_0x232c68[_0xbd83('0x3e')];_0x4381df+=0x1){_0x2ed6b9=_0x232c68[_0x4381df];if(_[_0xbd83('0x42')](_0x176954[_0xbd83('0x14')][_0x2ed6b9[_0xbd83('0x26')]])){_0x176954['campaigns'][_0x2ed6b9['name']]=new Campaign(_0x2ed6b9);}else{_0x176954[_0xbd83('0x3d')](_0x176954[_0xbd83('0x14')][_0x2ed6b9[_0xbd83('0x26')]],_0x2ed6b9);_0x176954[_0xbd83('0x14')][_0x2ed6b9['name']][_0xbd83('0x66')]=_0x2ed6b9[_0xbd83('0x67')]?_0x2ed6b9[_0xbd83('0x67')]['name']:undefined;}}}return _0x176954['campaigns'];};};Realtime[_0xbd83('0x3c')]['initVoiceExtensions']=function(){var _0x313766=this;return function(_0xb97e69){if(_0xb97e69){freeIsNotKey(_0xb97e69,_0x313766[_0xbd83('0x17')],'id');for(var _0x85357d=0x0,_0x232b08={};_0x85357d<_0xb97e69[_0xbd83('0x3e')];_0x85357d+=0x1){_0x232b08=_0xb97e69[_0x85357d];if(_[_0xbd83('0x42')](_0x313766[_0xbd83('0x17')][_0x232b08['id']])){_0x313766[_0xbd83('0x17')][_0x232b08['id']]=new VoiceExtension(_0x232b08);}else{_0x313766[_0xbd83('0x3d')](_0x313766[_0xbd83('0x17')][_0x232b08['id']],_0x232b08);}}}return _0x313766[_0xbd83('0x17')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x68')]=function(){var _0x9c9d24=this;return function(_0x86e699){clearCampaigns(_0x9c9d24[_0xbd83('0x14')]);for(var _0x6999b3=0x0;_0x6999b3<_0x86e699[_0xbd83('0x3e')];_0x6999b3+=0x1){_[_0xbd83('0x50')](_0x9c9d24['campaigns'][_0x86e699[_0x6999b3][_0xbd83('0x26')]],_0x86e699[_0x6999b3]);}return _0x9c9d24[_0xbd83('0x14')];};};Realtime[_0xbd83('0x3c')][_0xbd83('0x69')]=function(){var _0xba2e11=this;return function(_0x4e0884){if(_0x4e0884){freeIsNotKey(_0x4e0884,_0xba2e11[_0xbd83('0x23')],'id');for(var _0x29aec9=0x0,_0x2fc1c9={},_0x554e01={};_0x29aec9<_0x4e0884[_0xbd83('0x3e')];_0x29aec9+=0x1){_0x2fc1c9=_0x4e0884[_0x29aec9];if(_[_0xbd83('0x42')](_0xba2e11[_0xbd83('0x23')][_0x2fc1c9['id']])){_0xba2e11[_0xbd83('0x23')][_0x2fc1c9['id']]=new FaxAccount(_0x2fc1c9);}else{_0xba2e11[_0xbd83('0x3d')](_0xba2e11[_0xbd83('0x23')][_0x2fc1c9['id']],_0x2fc1c9);}}}return _0xba2e11[_0xbd83('0x23')];};};module[_0xbd83('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7d984db..902a604 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 _0xa31b=['dialer','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','createdAt','monitors','exten','connectedlinenum','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','bluebird','lodash','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination'];(function(_0x2f0d3b,_0x21ebd3){var _0x1b5414=function(_0x578281){while(--_0x578281){_0x2f0d3b['push'](_0x2f0d3b['shift']());}};_0x1b5414(++_0x21ebd3);}(_0xa31b,0x169));var _0xba31=function(_0xe4d2d,_0x460f22){_0xe4d2d=_0xe4d2d-0x0;var _0x387319=_0xa31b[_0xe4d2d];return _0x387319;};'use strict';var BPromise=require(_0xba31('0x0'));var _=require(_0xba31('0x1'));var moment=require('moment');var util=require(_0xba31('0x2'));var config=require(_0xba31('0x3'));var logger=require(_0xba31('0x4'))('ami');var ami=require(_0xba31('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xba31('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xba31('0x7'));var RpcVoiceQueueReport=require(_0xba31('0x8'));var RpcVoiceRecording=require(_0xba31('0x9'));var RpcVoiceTransferReport=require(_0xba31('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xba31('0xb'));var VoiceAgentReport=require(_0xba31('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x4f5c51){this[_0xba31('0xd')]=_0x4f5c51;this[_0xba31('0xe')]=_0x4f5c51[_0xba31('0xe')];this['telephones']=_0x4f5c51[_0xba31('0xf')];}Report[_0xba31('0x10')][_0xba31('0x11')]=function(_0x5f47d1){var _0x1738f3=new VoiceQueueReport(this[_0xba31('0xd')]);var _0x48a640=new VoiceAgentReport(this['realtime']);var _0x9a5930=new VoiceDialReport(this[_0xba31('0xd')]);var _0x451f71=new VoiceCallReport(this['realtime']);var _0x3ef9f8=new UserReport(this[_0xba31('0xd')]);if(config['xdr']&&config[_0xba31('0x12')][_0xba31('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xba31('0x14')][_0xba31('0x15')](this));ami['on'](_0xba31('0x16'),this['voiceCallReport'][_0xba31('0x15')](this));ami['on'](_0xba31('0x17'),this[_0xba31('0x18')]['bind'](this));ami['on'](_0xba31('0x19'),this[_0xba31('0x1a')][_0xba31('0x15')](this));ami['on'](_0xba31('0x1b'),this['blindTransfer'][_0xba31('0x15')](this));ami['on'](_0xba31('0x1c'),this[_0xba31('0x1d')][_0xba31('0x15')](this));}};Report[_0xba31('0x10')][_0xba31('0x1e')]=function(_0x3869ea){var _0x1aef4f=undefined;_0x1aef4f=_[_0xba31('0x1f')](this[_0xba31('0xe')],function(_0x1ec996){return _0x1ec996[_0xba31('0x20')]==_0x3869ea||_0x1ec996['name']==_0x3869ea;});if(_['isNil'](_0x1aef4f)){var _0x381cb0=_[_0xba31('0x1f')](this[_0xba31('0xf')],function(_0x302e9e){return _0x302e9e[_0xba31('0x20')]==_0x3869ea||_0x302e9e[_0xba31('0x21')]==_0x3869ea;});if(_0x381cb0){_0x1aef4f=_[_0xba31('0x1f')](this[_0xba31('0xe')],function(_0x348c89){return _0x348c89[_0xba31('0x22')]==util[_0xba31('0x23')](_0xba31('0x24'),_0x381cb0[_0xba31('0x21')]);});}}return _0x1aef4f;};Report[_0xba31('0x10')][_0xba31('0x14')]=function(_0x2b23bd){for(var _0x23493e=0x0;_0x23493e<_0x2b23bd[_0xba31('0x25')];_0x23493e+=0x1){var _0x3726bd=this[_0xba31('0x1e')](_0x2b23bd[_0x23493e]['connectedlinenum']);if(_0x3726bd){_0x2b23bd[_0x23493e][_0xba31('0x20')]=_0x3726bd['accountcode'];_0x2b23bd[_0x23493e]['assigned']=!![];_0x2b23bd[_0x23493e][_0xba31('0x26')]=_0x3726bd[_0xba31('0x21')];_0x2b23bd[_0x23493e]['interface']=_[_0xba31('0x27')](_0x3726bd['interface'])?util[_0xba31('0x23')]('SIP/%s',_0x3726bd[_0xba31('0x21')]):_0x3726bd[_0xba31('0x22')];if(_0x2b23bd[_0x23493e][_0xba31('0x28')]){_0x2b23bd[_0x23493e][_0xba31('0x29')]=moment()[_0xba31('0x23')](_0xba31('0x2a'));}if(_0x2b23bd[_0x23493e][_0xba31('0x2b')]){_0x2b23bd[_0x23493e][_0xba31('0x2c')]=moment()[_0xba31('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xba31('0x14')](_0x2b23bd[_0x23493e]);}RpcVoiceQueueReport[_0xba31('0x2d')](_0x2b23bd[_0x23493e]);}};function extractCalleridNumber(_0x59dde1){var _0x14a2db=_0x59dde1[_0xba31('0x2e')](/<(.*?)>/);return _0x14a2db?_0x14a2db[0x1]:_0x59dde1;}Report[_0xba31('0x10')][_0xba31('0x2f')]=function(_0x5be841){_0x5be841['destination']=_0x5be841[_0xba31('0x30')]||_0x5be841['exten'];if(_0x5be841['type']==_0xba31('0x31')){_0x5be841['lastapplication']='queue';_0x5be841[_0xba31('0x32')]=_0x5be841[_0xba31('0x33')];if(_0x5be841['context']==_0xba31('0x34')){_0x5be841[_0xba31('0x20')]='';_0x5be841[_0xba31('0x30')]=extractCalleridNumber(_0x5be841[_0xba31('0x35')]);}else if(_0x5be841[_0xba31('0x36')]==_0xba31('0x37')){if(_0x5be841['destination']==_0xba31('0x38')){_0x5be841['destination']=extractCalleridNumber(_0x5be841[_0xba31('0x39')]);_0x5be841[_0xba31('0x3a')]=_0x5be841[_0xba31('0x3b')];_0x5be841['destinationchannel']=[_0x5be841['channel'],_0x5be841[_0xba31('0x3c')]=_0x5be841[_0xba31('0x3d')]][0x0];_0x5be841[_0xba31('0x35')]=_0x5be841['calleridpreview'];}else{_0x5be841['destination']=_0x5be841['calleridnum'];_0x5be841[_0xba31('0x3a')]=_0x5be841[_0xba31('0x3b')];if(_0x5be841[_0xba31('0x3e')]=='ANSWERED'){_0x5be841[_0xba31('0x20')]=_0x5be841['connectedlinenum'];}else{_0x5be841['accountcode']='';}}}}else{_0x5be841[_0xba31('0x35')]=util[_0xba31('0x23')](_0xba31('0x3f'),_0x5be841[_0xba31('0x40')],_0x5be841[_0xba31('0x3a')]);}RpcVoiceCallReport[_0xba31('0x2d')](_0x5be841);if(_0x5be841[_0xba31('0x41')]){for(var _0x17b202=0x0;_0x17b202<_0x5be841['monitors'][_0xba31('0x25')];_0x17b202+=0x1){_0x5be841[_0xba31('0x42')]=_0x5be841['monitors'][_0x17b202]['filename'];_0x5be841[_0xba31('0x43')]=_0x5be841[_0xba31('0x44')][_0x17b202]['createdAt'];if(_0x5be841[_0xba31('0x45')]==_0xba31('0x38')){_0x5be841['calleridnum']=_0x5be841[_0xba31('0x46')];_0x5be841[_0xba31('0x40')]=_0x5be841[_0xba31('0x47')];_0x5be841[_0xba31('0x46')]=_0x5be841['accountcode'];_0x5be841[_0xba31('0x47')]=_0x5be841[_0xba31('0x48')];_0x5be841[_0xba31('0x45')]=_0x5be841['originatecalleridnum'];}else if(_0x5be841[_0xba31('0x45')]=='xcally-motion-dialer'){_0x5be841[_0xba31('0x3a')]=_0x5be841[_0xba31('0x30')];_0x5be841['exten']=_0x5be841['originatecalleridnum'];}RpcVoiceRecording[_0xba31('0x2d')](_0x5be841);}}};Report['prototype']['voiceAgentReport']=function(_0x5506b1){if(_[_0xba31('0x49')](_0x5506b1)){_0x5506b1[_0xba31('0x4a')](function(_0x1b26e6){RpcVoiceAgentReport[_0xba31('0x2d')](_0x1b26e6);});}else{RpcVoiceAgentReport[_0xba31('0x2d')](_0x5506b1);}};Report[_0xba31('0x10')][_0xba31('0x1a')]=function(_0x5ddcf2){RpcVoiceDialReport[_0xba31('0x2d')](_0x5ddcf2);var _0x260b1e=undefined;var _0x5e438b=_0x5ddcf2['channel'];if(_[_0xba31('0x4b')](_0x5e438b,_0xba31('0x4c'))){var _0xf0e60d=_0x5e438b[_0xba31('0x4d')](_0x5e438b['indexOf']('/')+0x1,_0x5e438b['indexOf']('@'));_0x260b1e=_[_0xba31('0x1f')](this[_0xba31('0xe')],function(_0x30026d){return _0x30026d[_0xba31('0x4e')]==_0xf0e60d||_0x30026d[_0xba31('0x4f')]==_0xf0e60d||_0x30026d[_0xba31('0x20')]==_0xf0e60d;});}else{var _0xf0e60d=_0x5e438b[_0xba31('0x4d')](_0x5e438b[_0xba31('0x50')]('/')+0x1,_0x5e438b[_0xba31('0x51')]('-'));_0x260b1e=this[_0xba31('0x1e')](_0xf0e60d);}if(_0x260b1e){_0x5ddcf2[_0xba31('0x22')]=_['isNil'](_0x260b1e[_0xba31('0x22')])?util[_0xba31('0x23')](_0xba31('0x24'),_0x260b1e[_0xba31('0x21')]):_0x260b1e['interface'];_0x5ddcf2['membername']=_0x260b1e['name'];_0x5ddcf2[_0xba31('0x20')]=_0x260b1e['accountcode'];RpcMemberReport[_0xba31('0x1a')](_0x5ddcf2);}};Report['prototype']['blindTransfer']=function(_0x144678){RpcVoiceTransferReport['blindTransfer'](_0x144678);};Report['prototype'][_0xba31('0x1d')]=function(_0x5405b5){RpcVoiceTransferReport[_0xba31('0x1d')](_0x5405b5);};module['exports']=Report; \ No newline at end of file +var _0x1425=['attendedTransfer','exports','lodash','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','name','accountcode','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','queue','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','callerid','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','length','monitorFilename','createdAt','connectedlinename','membername','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf'];(function(_0x74b135,_0xd60199){var _0x2c9a55=function(_0x4981f2){while(--_0x4981f2){_0x74b135['push'](_0x74b135['shift']());}};_0x2c9a55(++_0xd60199);}(_0x1425,0x1a1));var _0x5142=function(_0x13222b,_0x15b470){_0x13222b=_0x13222b-0x0;var _0x12b8b2=_0x1425[_0x13222b];return _0x12b8b2;};'use strict';var BPromise=require('bluebird');var _=require(_0x5142('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var logger=require(_0x5142('0x1'))(_0x5142('0x2'));var ami=require(_0x5142('0x3'));var RpcVoiceAgentReport=require(_0x5142('0x4'));var RpcVoiceCallReport=require(_0x5142('0x5'));var RpcVoiceDialReport=require(_0x5142('0x6'));var RpcMemberReport=require(_0x5142('0x7'));var RpcVoiceQueueReport=require(_0x5142('0x8'));var RpcVoiceRecording=require(_0x5142('0x9'));var RpcVoiceTransferReport=require(_0x5142('0xa'));var VoiceQueueReport=require(_0x5142('0xb'));var VoiceCallReport=require(_0x5142('0xc'));var VoiceAgentReport=require(_0x5142('0xd'));var VoiceDialReport=require(_0x5142('0xe'));var UserReport=require(_0x5142('0xf'));function Report(_0x55be02){this[_0x5142('0x10')]=_0x55be02;this[_0x5142('0x11')]=_0x55be02[_0x5142('0x11')];this[_0x5142('0x12')]=_0x55be02[_0x5142('0x12')];}Report[_0x5142('0x13')]['sync']=function(_0x142965){var _0x474f6b=new VoiceQueueReport(this[_0x5142('0x10')]);var _0x14f3f5=new VoiceAgentReport(this[_0x5142('0x10')]);var _0x26fabe=new VoiceDialReport(this[_0x5142('0x10')]);var _0x1a16df=new VoiceCallReport(this[_0x5142('0x10')]);var _0x4f1a99=new UserReport(this[_0x5142('0x10')]);if(config[_0x5142('0x14')]&&config['xdr']['disabled']){ami['on'](_0x5142('0x15'),this[_0x5142('0x16')][_0x5142('0x17')](this));ami['on'](_0x5142('0x18'),this[_0x5142('0x19')][_0x5142('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x5142('0x1a')]['bind'](this));ami['on'](_0x5142('0x1b'),this[_0x5142('0x1c')][_0x5142('0x17')](this));ami['on'](_0x5142('0x1d'),this[_0x5142('0x1e')][_0x5142('0x17')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x5142('0x17')](this));}};Report[_0x5142('0x13')][_0x5142('0x1f')]=function(_0x1d56a9){var _0x45f096=undefined;_0x45f096=_[_0x5142('0x20')](this[_0x5142('0x11')],function(_0x1d6f7a){return _0x1d6f7a['accountcode']==_0x1d56a9||_0x1d6f7a[_0x5142('0x21')]==_0x1d56a9;});if(_['isNil'](_0x45f096)){var _0x2fe015=_[_0x5142('0x20')](this[_0x5142('0x12')],function(_0x33136d){return _0x33136d[_0x5142('0x22')]==_0x1d56a9||_0x33136d[_0x5142('0x21')]==_0x1d56a9;});if(_0x2fe015){_0x45f096=_[_0x5142('0x20')](this[_0x5142('0x11')],function(_0x434a7c){return _0x434a7c[_0x5142('0x23')]==util[_0x5142('0x24')](_0x5142('0x25'),_0x2fe015[_0x5142('0x21')]);});}}return _0x45f096;};Report[_0x5142('0x13')][_0x5142('0x16')]=function(_0x3020ed){for(var _0x37d596=0x0;_0x37d596<_0x3020ed['length'];_0x37d596+=0x1){var _0x2ddaf3=this['findAgent'](_0x3020ed[_0x37d596][_0x5142('0x26')]);if(_0x2ddaf3){_0x3020ed[_0x37d596][_0x5142('0x22')]=_0x2ddaf3[_0x5142('0x22')];_0x3020ed[_0x37d596][_0x5142('0x27')]=!![];_0x3020ed[_0x37d596][_0x5142('0x28')]=_0x2ddaf3['name'];_0x3020ed[_0x37d596][_0x5142('0x23')]=_[_0x5142('0x29')](_0x2ddaf3['interface'])?util['format'](_0x5142('0x25'),_0x2ddaf3[_0x5142('0x21')]):_0x2ddaf3[_0x5142('0x23')];if(_0x3020ed[_0x37d596][_0x5142('0x2a')]){_0x3020ed[_0x37d596][_0x5142('0x2b')]=moment()[_0x5142('0x24')](_0x5142('0x2c'));}if(_0x3020ed[_0x37d596][_0x5142('0x2d')]){_0x3020ed[_0x37d596][_0x5142('0x2e')]=moment()[_0x5142('0x24')](_0x5142('0x2c'));}RpcMemberReport[_0x5142('0x16')](_0x3020ed[_0x37d596]);}RpcVoiceQueueReport[_0x5142('0x2f')](_0x3020ed[_0x37d596]);}};function extractCalleridNumber(_0x2d4181){var _0x789c3e=_0x2d4181[_0x5142('0x30')](/<(.*?)>/);return _0x789c3e?_0x789c3e[0x1]:_0x2d4181;}Report['prototype']['voiceCallReport']=function(_0x15b747){_0x15b747[_0x5142('0x31')]=_0x15b747[_0x5142('0x31')]||_0x15b747[_0x5142('0x32')];if(_0x15b747[_0x5142('0x33')]=='dialer'){_0x15b747['lastapplication']=_0x5142('0x34');_0x15b747['lastdata']=_0x15b747[_0x5142('0x34')];if(_0x15b747[_0x5142('0x35')]==_0x5142('0x36')){_0x15b747[_0x5142('0x22')]='';_0x15b747[_0x5142('0x31')]=extractCalleridNumber(_0x15b747['callerid']);}else if(_0x15b747[_0x5142('0x35')]==_0x5142('0x37')){if(_0x15b747[_0x5142('0x31')]==_0x5142('0x38')){_0x15b747[_0x5142('0x31')]=extractCalleridNumber(_0x15b747[_0x5142('0x39')]);_0x15b747[_0x5142('0x3a')]=_0x15b747['originatecalleridnum'];_0x15b747['destinationchannel']=[_0x15b747[_0x5142('0x3b')],_0x15b747[_0x5142('0x3b')]=_0x15b747['destinationchannel']][0x0];_0x15b747[_0x5142('0x3c')]=_0x15b747['calleridpreview'];}else{_0x15b747[_0x5142('0x31')]=_0x15b747[_0x5142('0x3a')];_0x15b747[_0x5142('0x3a')]=_0x15b747[_0x5142('0x3d')];if(_0x15b747[_0x5142('0x3e')]==_0x5142('0x3f')){_0x15b747[_0x5142('0x22')]=_0x15b747['connectedlinenum'];}else{_0x15b747[_0x5142('0x22')]='';}}}}else{_0x15b747[_0x5142('0x3c')]=util[_0x5142('0x24')](_0x5142('0x40'),_0x15b747[_0x5142('0x41')],_0x15b747['calleridnum']);}RpcVoiceCallReport[_0x5142('0x2f')](_0x15b747);if(_0x15b747[_0x5142('0x42')]){for(var _0x32ab30=0x0;_0x32ab30<_0x15b747[_0x5142('0x43')][_0x5142('0x44')];_0x32ab30+=0x1){_0x15b747[_0x5142('0x45')]=_0x15b747[_0x5142('0x43')][_0x32ab30]['filename'];_0x15b747[_0x5142('0x46')]=_0x15b747[_0x5142('0x43')][_0x32ab30][_0x5142('0x46')];if(_0x15b747[_0x5142('0x32')]==_0x5142('0x38')){_0x15b747[_0x5142('0x3a')]=_0x15b747[_0x5142('0x26')];_0x15b747[_0x5142('0x41')]=_0x15b747[_0x5142('0x47')];_0x15b747[_0x5142('0x26')]=_0x15b747[_0x5142('0x22')];_0x15b747[_0x5142('0x47')]=_0x15b747[_0x5142('0x48')];_0x15b747[_0x5142('0x32')]=_0x15b747[_0x5142('0x3d')];}else if(_0x15b747[_0x5142('0x32')]=='xcally-motion-dialer'){_0x15b747['calleridnum']=_0x15b747[_0x5142('0x31')];_0x15b747['exten']=_0x15b747['originatecalleridnum'];}RpcVoiceRecording[_0x5142('0x2f')](_0x15b747);}}};Report[_0x5142('0x13')][_0x5142('0x1a')]=function(_0xcc53db){if(_[_0x5142('0x49')](_0xcc53db)){_0xcc53db[_0x5142('0x4a')](function(_0x54938d){RpcVoiceAgentReport['create'](_0x54938d);});}else{RpcVoiceAgentReport[_0x5142('0x2f')](_0xcc53db);}};Report['prototype'][_0x5142('0x1c')]=function(_0x344bae){RpcVoiceDialReport[_0x5142('0x2f')](_0x344bae);var _0x110aa9=undefined;var _0x49ce1a=_0x344bae[_0x5142('0x3b')];if(_[_0x5142('0x4b')](_0x49ce1a,'Local')){var _0x20bb77=_0x49ce1a[_0x5142('0x4c')](_0x49ce1a[_0x5142('0x4d')]('/')+0x1,_0x49ce1a[_0x5142('0x4d')]('@'));_0x110aa9=_[_0x5142('0x20')](this[_0x5142('0x11')],function(_0x51ae52){return _0x51ae52[_0x5142('0x4e')]==_0x20bb77||_0x51ae52[_0x5142('0x4f')]==_0x20bb77||_0x51ae52['accountcode']==_0x20bb77;});}else{var _0x20bb77=_0x49ce1a[_0x5142('0x4c')](_0x49ce1a[_0x5142('0x4d')]('/')+0x1,_0x49ce1a[_0x5142('0x50')]('-'));_0x110aa9=this['findAgent'](_0x20bb77);}if(_0x110aa9){_0x344bae[_0x5142('0x23')]=_[_0x5142('0x29')](_0x110aa9[_0x5142('0x23')])?util[_0x5142('0x24')](_0x5142('0x25'),_0x110aa9['name']):_0x110aa9[_0x5142('0x23')];_0x344bae[_0x5142('0x48')]=_0x110aa9[_0x5142('0x21')];_0x344bae[_0x5142('0x22')]=_0x110aa9['accountcode'];RpcMemberReport['voiceDialReport'](_0x344bae);}};Report[_0x5142('0x13')][_0x5142('0x1e')]=function(_0x3a41df){RpcVoiceTransferReport[_0x5142('0x1e')](_0x3a41df);};Report[_0x5142('0x13')][_0x5142('0x51')]=function(_0x5e7d22){RpcVoiceTransferReport[_0x5142('0x51')](_0x5e7d22);};module[_0x5142('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 79bcb13..18b07dc 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 _0x3008=['omit','event','actionid','state','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','inspect','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','name','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','registered','status','address','telephone:%s','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','then','actionSipShowRegistry','actionDeviceStateList','catch','[loopSyncRealTimeShow]','error','prototype','loopSyncRealTimeShow','resolve','actionSipPeerStatus','isNotNull','isUndefined','emit','find','username','merge'];(function(_0x2c5bdf,_0x308f46){var _0x536acf=function(_0x9d5f4c){while(--_0x9d5f4c){_0x2c5bdf['push'](_0x2c5bdf['shift']());}};_0x536acf(++_0x308f46);}(_0x3008,0x1bf));var _0x8300=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x3008[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x8300('0x0'));var moment=require(_0x8300('0x1'));var BPromise=require(_0x8300('0x2'));var util=require(_0x8300('0x3'));var Redis=require(_0x8300('0x4'));var config=require('../../../config/environment');var logger=require(_0x8300('0x5'))(_0x8300('0x6'));var ami=require(_0x8300('0x7'));config[_0x8300('0x8')]=_[_0x8300('0x9')](config[_0x8300('0x8')],{'host':_0x8300('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x1800e1){this[_0x8300('0xb')]=_0x1800e1[_0x8300('0xb')];this['agents']=_0x1800e1[_0x8300('0xc')];this['telephones']=_0x1800e1[_0x8300('0xd')];ami['on'](_0x8300('0xe'),this[_0x8300('0xf')][_0x8300('0x10')](this));ami['on'](_0x8300('0x11'),this[_0x8300('0xf')]['bind'](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x8300('0x10')](this));ami['on'](_0x8300('0x12'),this[_0x8300('0x13')][_0x8300('0x10')](this));this['loopSyncRealTimeShow']();return BPromise['resolve']()[_0x8300('0x14')](ami[_0x8300('0x15')]())['then'](ami[_0x8300('0x16')]())['then'](ami['actionSipPeerStatus']())[_0x8300('0x17')](loggerCatch(_0x8300('0x18')));}function loggerCatch(_0x47a1c8){return function(_0x4abb2c){logger[_0x8300('0x19')](_0x47a1c8,util['inspect'](_0x4abb2c,{'showHidden':![],'depth':null}));};}UserReport[_0x8300('0x1a')][_0x8300('0x1b')]=function(){setInterval(function(){BPromise[_0x8300('0x1c')]()['then'](ami[_0x8300('0x15')]())['then'](ami[_0x8300('0x16')]())['then'](ami[_0x8300('0x1d')]())[_0x8300('0x17')](loggerCatch(_0x8300('0x18')));},0x32c8);};UserReport[_0x8300('0x1a')][_0x8300('0x1e')]=function(_0x2836ee){return _0x2836ee!==null&&!_[_0x8300('0x1f')](_0x2836ee);};UserReport['prototype'][_0x8300('0x20')]=function(_0x26aedc,_0x196dd3,_0x846c55){io['to'](_0x26aedc)[_0x8300('0x20')](_0x196dd3,_0x846c55);};UserReport[_0x8300('0x1a')][_0x8300('0xf')]=function(_0x24caed){try{if(this[_0x8300('0x1e')](_0x24caed)){var _0x4e116e=_[_0x8300('0x21')](this[_0x8300('0xb')],{'registry':_0x24caed[_0x8300('0x22')]});if(_0x4e116e){_0x24caed['stateRegistry']=_0x24caed['state'];_[_0x8300('0x23')](_0x4e116e,_[_0x8300('0x24')](_0x24caed,[_0x8300('0x25'),_0x8300('0x26'),_0x8300('0x22'),_0x8300('0x27')]));this[_0x8300('0x20')](util[_0x8300('0x28')](_0x8300('0x29'),_0x4e116e['name']),_0x8300('0x2a'),_0x4e116e);}}}catch(_0x46abd5){logger['error'](_0x8300('0x2b'),util[_0x8300('0x2c')](_0x46abd5,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x8300('0x2d')]=function(_0x22aa00){try{if(this[_0x8300('0x1e')](_0x22aa00)){if(this['agents'][_0x22aa00[_0x8300('0x2e')]]){if(!this['agents'][_0x22aa00['device']][_0x8300('0x2f')]||_0x22aa00[_0x8300('0x27')][_0x8300('0x30')]()==_0x8300('0x31')){this[_0x8300('0xc')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x2f')]=![];if(this[_0x8300('0xc')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x27')]!==_0x22aa00['state'][_0x8300('0x30')]()){this[_0x8300('0xc')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x32')]=_[_0x8300('0x33')](moment()['format']('x'));}this[_0x8300('0xc')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x27')]=_0x22aa00[_0x8300('0x27')]['toLowerCase']();this[_0x8300('0xc')][_0x22aa00['device']][_0x8300('0x34')](_0x22aa00);}}else if(this[_0x8300('0xd')][_0x22aa00[_0x8300('0x2e')]]){if(this['telephones'][_0x22aa00['device']][_0x8300('0x27')]!==_0x22aa00[_0x8300('0x27')]['toLowerCase']()){this[_0x8300('0xd')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x32')]=_['toNumber'](moment()['format']('x'));}this[_0x8300('0xd')][_0x22aa00[_0x8300('0x2e')]]['state']=_0x22aa00[_0x8300('0x27')]['toLowerCase']();this[_0x8300('0x20')](util['format']('telephone:%s',this[_0x8300('0xd')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x35')]),_0x8300('0x36'),this[_0x8300('0xd')][_0x22aa00['device']]);}else if(this[_0x8300('0xb')][_0x22aa00[_0x8300('0x2e')]]){if(this[_0x8300('0xb')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x27')]!==_0x22aa00[_0x8300('0x27')][_0x8300('0x30')]()){this['trunks'][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x32')]=_[_0x8300('0x33')](moment()[_0x8300('0x28')]('x'));}this[_0x8300('0xb')][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x27')]=_0x22aa00[_0x8300('0x27')][_0x8300('0x30')]();this['emit'](util['format']('trunk:%s',this['trunks'][_0x22aa00[_0x8300('0x2e')]][_0x8300('0x35')]),'trunk:save',this[_0x8300('0xb')][_0x22aa00[_0x8300('0x2e')]]);}else if(_[_0x8300('0x37')](_0x22aa00[_0x8300('0x2e')],'Queue')){}else if(_[_0x8300('0x37')](_0x22aa00[_0x8300('0x2e')],_0x8300('0x38'))){var _0x47b231=_0x22aa00[_0x8300('0x2e')];var _0x9cce98=_0x47b231[_0x8300('0x39')](_0x47b231[_0x8300('0x3a')]('/')+0x1,_0x47b231[_0x8300('0x3a')]('@'));var _0x58139f=_['find'](this[_0x8300('0xc')],function(_0x1f7512){return _0x1f7512[_0x8300('0x3b')]==_0x9cce98||_0x1f7512[_0x8300('0x3c')]==_0x9cce98||_0x1f7512[_0x8300('0x3d')]==_0x9cce98;});if(_0x58139f){if(_0x58139f[_0x8300('0x27')]!==_0x22aa00[_0x8300('0x27')][_0x8300('0x30')]()){_0x58139f[_0x8300('0x32')]=_[_0x8300('0x33')](moment()[_0x8300('0x28')]('x'));}_0x58139f[_0x8300('0x27')]=_0x22aa00['state'][_0x8300('0x30')]();_0x58139f[_0x8300('0x2f')]=!![];_0x58139f[_0x8300('0x34')](_0x22aa00);}}else{}}}catch(_0xf55b4a){logger[_0x8300('0x19')]('[syncDeviceState][UserReport]',util['inspect'](_0xf55b4a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x8300('0x13')]=function(_0x289eb3){try{if(this['isNotNull'](_0x289eb3)&&this[_0x8300('0x1e')](_0x289eb3[_0x8300('0x12')])){if(this['agents'][_0x289eb3['peer']]){if(!this[_0x8300('0xc')][_0x289eb3[_0x8300('0x3e')]][_0x8300('0x2f')]||_0x289eb3[_0x8300('0x12')][_0x8300('0x30')]()==_0x8300('0x3f')){this['agents'][_0x289eb3['peer']][_0x8300('0x2f')]=![];this['agents'][_0x289eb3['peer']][_0x8300('0x40')]=_0x289eb3[_0x8300('0x12')][_0x8300('0x30')]();this[_0x8300('0xc')][_0x289eb3['peer']]['address']=_0x289eb3['address'];this[_0x8300('0xc')][_0x289eb3['peer']][_0x8300('0x34')](_0x289eb3);}}else if(this[_0x8300('0xd')][_0x289eb3[_0x8300('0x3e')]]){this['telephones'][_0x289eb3[_0x8300('0x3e')]][_0x8300('0x40')]=_0x289eb3[_0x8300('0x12')][_0x8300('0x30')]();this['telephones'][_0x289eb3[_0x8300('0x3e')]]['address']=_0x289eb3[_0x8300('0x41')];this[_0x8300('0x20')](util['format'](_0x8300('0x42'),this[_0x8300('0xd')][_0x289eb3[_0x8300('0x3e')]][_0x8300('0x35')]),_0x8300('0x36'),this['telephones'][_0x289eb3[_0x8300('0x3e')]]);}else if(this[_0x8300('0xb')][_0x289eb3[_0x8300('0x3e')]]){this[_0x8300('0xb')][_0x289eb3[_0x8300('0x3e')]]['status']=_0x289eb3[_0x8300('0x12')][_0x8300('0x30')]();this[_0x8300('0xb')][_0x289eb3[_0x8300('0x3e')]][_0x8300('0x41')]=_0x289eb3[_0x8300('0x41')];this['emit'](util[_0x8300('0x28')](_0x8300('0x29'),this[_0x8300('0xb')][_0x289eb3[_0x8300('0x3e')]][_0x8300('0x35')]),_0x8300('0x2a'),this[_0x8300('0xb')][_0x289eb3[_0x8300('0x3e')]]);}else{}}}catch(_0x56709b){logger[_0x8300('0x19')](_0x8300('0x43'),util['inspect'](_0x56709b,{'showHidden':![],'depth':null}));}};module[_0x8300('0x44')]=UserReport; \ No newline at end of file +var _0xaece=['defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','resolve','then','isNotNull','isUndefined','emit','username','stateRegistry','state','merge','omit','actionid','name','trunk:save','device','local','toLowerCase','inuse','stateTime','format','updateStatusRealtime','telephone:save','toNumber','startsWith','substring','indexOf','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','peerstatus','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis'];(function(_0x5a446e,_0x14c23c){var _0x3f4c83=function(_0xc7c5cf){while(--_0xc7c5cf){_0x5a446e['push'](_0x5a446e['shift']());}};_0x3f4c83(++_0x14c23c);}(_0xaece,0x14f));var _0xeaec=function(_0x2f4f82,_0x2b4098){_0x2f4f82=_0x2f4f82-0x0;var _0x18a116=_0xaece[_0x2f4f82];return _0x18a116;};'use strict';var _=require(_0xeaec('0x0'));var moment=require(_0xeaec('0x1'));var BPromise=require(_0xeaec('0x2'));var util=require(_0xeaec('0x3'));var Redis=require(_0xeaec('0x4'));var config=require(_0xeaec('0x5'));var logger=require(_0xeaec('0x6'))(_0xeaec('0x7'));var ami=require(_0xeaec('0x8'));config[_0xeaec('0x9')]=_[_0xeaec('0xa')](config['redis'],{'host':_0xeaec('0xb'),'port':0x18eb});var io=require(_0xeaec('0xc'))(new Redis(config[_0xeaec('0x9')]));function UserReport(_0x29377f){this[_0xeaec('0xd')]=_0x29377f[_0xeaec('0xd')];this[_0xeaec('0xe')]=_0x29377f[_0xeaec('0xe')];this[_0xeaec('0xf')]=_0x29377f['telephones'];ami['on'](_0xeaec('0x10'),this['syncRegistry'][_0xeaec('0x11')](this));ami['on'](_0xeaec('0x12'),this[_0xeaec('0x13')][_0xeaec('0x11')](this));ami['on'](_0xeaec('0x14'),this[_0xeaec('0x15')][_0xeaec('0x11')](this));ami['on']('peerstatus',this[_0xeaec('0x16')][_0xeaec('0x11')](this));this[_0xeaec('0x17')]();return BPromise['resolve']()['then'](ami[_0xeaec('0x18')]())['then'](ami[_0xeaec('0x19')]())['then'](ami[_0xeaec('0x1a')]())[_0xeaec('0x1b')](loggerCatch(_0xeaec('0x1c')));}function loggerCatch(_0xb798c1){return function(_0x4b22ff){logger[_0xeaec('0x1d')](_0xb798c1,util[_0xeaec('0x1e')](_0x4b22ff,{'showHidden':![],'depth':null}));};}UserReport[_0xeaec('0x1f')][_0xeaec('0x17')]=function(){setInterval(function(){BPromise[_0xeaec('0x20')]()['then'](ami[_0xeaec('0x18')]())[_0xeaec('0x21')](ami['actionDeviceStateList']())[_0xeaec('0x21')](ami[_0xeaec('0x1a')]())[_0xeaec('0x1b')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xeaec('0x1f')][_0xeaec('0x22')]=function(_0x557b6c){return _0x557b6c!==null&&!_[_0xeaec('0x23')](_0x557b6c);};UserReport[_0xeaec('0x1f')][_0xeaec('0x24')]=function(_0x1c65d3,_0x1ec744,_0x30c995){io['to'](_0x1c65d3)[_0xeaec('0x24')](_0x1ec744,_0x30c995);};UserReport['prototype'][_0xeaec('0x13')]=function(_0x1b9bf9){try{if(this[_0xeaec('0x22')](_0x1b9bf9)){var _0x425822=_['find'](this['trunks'],{'registry':_0x1b9bf9[_0xeaec('0x25')]});if(_0x425822){_0x1b9bf9[_0xeaec('0x26')]=_0x1b9bf9[_0xeaec('0x27')];_[_0xeaec('0x28')](_0x425822,_[_0xeaec('0x29')](_0x1b9bf9,['event',_0xeaec('0x2a'),_0xeaec('0x25'),_0xeaec('0x27')]));this[_0xeaec('0x24')](util['format']('trunk:%s',_0x425822[_0xeaec('0x2b')]),_0xeaec('0x2c'),_0x425822);}}}catch(_0x5cc757){logger[_0xeaec('0x1d')]('[syncRegistry][UserReport]',util[_0xeaec('0x1e')](_0x5cc757,{'showHidden':![],'depth':null}));}};UserReport[_0xeaec('0x1f')][_0xeaec('0x15')]=function(_0x546bc9){try{if(this[_0xeaec('0x22')](_0x546bc9)){if(this[_0xeaec('0xe')][_0x546bc9['device']]){if(!this['agents'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x2e')]||_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]()==_0xeaec('0x30')){this['agents'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x2e')]=![];if(this['agents'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x27')]!==_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]()){this[_0xeaec('0xe')][_0x546bc9['device']][_0xeaec('0x31')]=_['toNumber'](moment()[_0xeaec('0x32')]('x'));}this['agents'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x27')]=_0x546bc9[_0xeaec('0x27')]['toLowerCase']();this['agents'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x33')](_0x546bc9);}}else if(this[_0xeaec('0xf')][_0x546bc9[_0xeaec('0x2d')]]){if(this['telephones'][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x27')]!==_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]()){this['telephones'][_0x546bc9[_0xeaec('0x2d')]]['stateTime']=_['toNumber'](moment()[_0xeaec('0x32')]('x'));}this[_0xeaec('0xf')][_0x546bc9['device']]['state']=_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]();this[_0xeaec('0x24')](util['format']('telephone:%s',this[_0xeaec('0xf')][_0x546bc9['device']][_0xeaec('0x2b')]),_0xeaec('0x34'),this['telephones'][_0x546bc9[_0xeaec('0x2d')]]);}else if(this['trunks'][_0x546bc9['device']]){if(this[_0xeaec('0xd')][_0x546bc9[_0xeaec('0x2d')]]['state']!==_0x546bc9['state'][_0xeaec('0x2f')]()){this[_0xeaec('0xd')][_0x546bc9[_0xeaec('0x2d')]]['stateTime']=_[_0xeaec('0x35')](moment()[_0xeaec('0x32')]('x'));}this[_0xeaec('0xd')][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x27')]=_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]();this[_0xeaec('0x24')](util[_0xeaec('0x32')]('trunk:%s',this[_0xeaec('0xd')][_0x546bc9[_0xeaec('0x2d')]][_0xeaec('0x2b')]),_0xeaec('0x2c'),this[_0xeaec('0xd')][_0x546bc9['device']]);}else if(_[_0xeaec('0x36')](_0x546bc9['device'],'Queue')){}else if(_[_0xeaec('0x36')](_0x546bc9[_0xeaec('0x2d')],'Local')){var _0x33bbce=_0x546bc9[_0xeaec('0x2d')];var _0x43ad23=_0x33bbce[_0xeaec('0x37')](_0x33bbce['indexOf']('/')+0x1,_0x33bbce[_0xeaec('0x38')]('@'));var _0xb2389d=_[_0xeaec('0x39')](this['agents'],function(_0x2cda0b){return _0x2cda0b[_0xeaec('0x3a')]==_0x43ad23||_0x2cda0b[_0xeaec('0x3b')]==_0x43ad23||_0x2cda0b[_0xeaec('0x3c')]==_0x43ad23;});if(_0xb2389d){if(_0xb2389d[_0xeaec('0x27')]!==_0x546bc9[_0xeaec('0x27')][_0xeaec('0x2f')]()){_0xb2389d['stateTime']=_[_0xeaec('0x35')](moment()['format']('x'));}_0xb2389d[_0xeaec('0x27')]=_0x546bc9['state']['toLowerCase']();_0xb2389d[_0xeaec('0x2e')]=!![];_0xb2389d[_0xeaec('0x33')](_0x546bc9);}}else{}}}catch(_0x21df5f){logger[_0xeaec('0x1d')](_0xeaec('0x3d'),util[_0xeaec('0x1e')](_0x21df5f,{'showHidden':![],'depth':null}));}};UserReport[_0xeaec('0x1f')][_0xeaec('0x16')]=function(_0xa34ea2){try{if(this[_0xeaec('0x22')](_0xa34ea2)&&this[_0xeaec('0x22')](_0xa34ea2['peerstatus'])){if(this[_0xeaec('0xe')][_0xa34ea2[_0xeaec('0x3e')]]){if(!this['agents'][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x2e')]||_0xa34ea2[_0xeaec('0x3f')][_0xeaec('0x2f')]()==_0xeaec('0x40')){this[_0xeaec('0xe')][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x2e')]=![];this[_0xeaec('0xe')][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x41')]=_0xa34ea2['peerstatus'][_0xeaec('0x2f')]();this[_0xeaec('0xe')][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x42')]=_0xa34ea2[_0xeaec('0x42')];this[_0xeaec('0xe')][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x33')](_0xa34ea2);}}else if(this[_0xeaec('0xf')][_0xa34ea2[_0xeaec('0x3e')]]){this[_0xeaec('0xf')][_0xa34ea2[_0xeaec('0x3e')]]['status']=_0xa34ea2[_0xeaec('0x3f')][_0xeaec('0x2f')]();this['telephones'][_0xa34ea2[_0xeaec('0x3e')]]['address']=_0xa34ea2[_0xeaec('0x42')];this[_0xeaec('0x24')](util[_0xeaec('0x32')]('telephone:%s',this['telephones'][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x2b')]),_0xeaec('0x34'),this[_0xeaec('0xf')][_0xa34ea2['peer']]);}else if(this[_0xeaec('0xd')][_0xa34ea2[_0xeaec('0x3e')]]){this[_0xeaec('0xd')][_0xa34ea2['peer']][_0xeaec('0x41')]=_0xa34ea2['peerstatus'][_0xeaec('0x2f')]();this[_0xeaec('0xd')][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x42')]=_0xa34ea2['address'];this[_0xeaec('0x24')](util[_0xeaec('0x32')]('trunk:%s',this['trunks'][_0xa34ea2[_0xeaec('0x3e')]][_0xeaec('0x2b')]),_0xeaec('0x2c'),this[_0xeaec('0xd')][_0xa34ea2[_0xeaec('0x3e')]]);}else{}}}catch(_0x3432b7){logger[_0xeaec('0x1d')](_0xeaec('0x43'),util['inspect'](_0x3432b7,{'showHidden':![],'depth':null}));}};module[_0xeaec('0x44')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d39f182..abbd983 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 _0x0f31=['interface','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','custom:agentansweredelsewhere','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentconnectAt','complete','agent','acw','agentacw','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberpenalty','isNil','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','talktime','diff','seconds','secondtransfereruniqueid','transfereruniqueid','transfer','[syncBlindTransfer][VoiceAgentReport]','channel','substring','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','redis','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','queue','inbound','merge','event','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','syncAgentConnect','hasOwnProperty','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc'];(function(_0x382ca6,_0x1aaf79){var _0x295a6c=function(_0x294a0b){while(--_0x294a0b){_0x382ca6['push'](_0x382ca6['shift']());}};_0x295a6c(++_0x1aaf79);}(_0x0f31,0x129));var _0x10f3=function(_0x20ffe3,_0x5465b8){_0x20ffe3=_0x20ffe3-0x0;var _0x4c0bee=_0x0f31[_0x20ffe3];return _0x4c0bee;};'use strict';var _=require(_0x10f3('0x0'));var moment=require(_0x10f3('0x1'));var util=require(_0x10f3('0x2'));var Redis=require(_0x10f3('0x3'));var config=require(_0x10f3('0x4'));var logger=require('../../../config/logger')(_0x10f3('0x5'));var ami=require('../ami');config[_0x10f3('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x10f3('0x6')]));function VoiceAgentReport(_0x2dd937){this[_0x10f3('0x7')]={};this[_0x10f3('0x8')]=_0x2dd937[_0x10f3('0x8')];this['agents']=_0x2dd937[_0x10f3('0x9')];this[_0x10f3('0xa')]={};ami['on'](_0x10f3('0xb'),this[_0x10f3('0xc')][_0x10f3('0xd')](this));ami['on'](_0x10f3('0xe'),this['syncAgentConnect'][_0x10f3('0xd')](this));ami['on'](_0x10f3('0xf'),this[_0x10f3('0x10')][_0x10f3('0xd')](this));ami['on'](_0x10f3('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x10f3('0x12'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0x10f3('0x13')][_0x10f3('0xd')](this));ami['on'](_0x10f3('0x14'),this[_0x10f3('0x15')][_0x10f3('0xd')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x10f3('0xd')](this));ami['on'](_0x10f3('0x16'),this[_0x10f3('0x17')]['bind'](this));ami['on'](_0x10f3('0x18'),this[_0x10f3('0x19')][_0x10f3('0xd')](this));ami['on'](_0x10f3('0x1a'),this[_0x10f3('0x1b')][_0x10f3('0xd')](this));}VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0x1d')]=function(_0x29e9dc,_0x599160,_0x3a329e){io['to'](_0x29e9dc)['emit'](_0x599160,_0x3a329e);};VoiceAgentReport[_0x10f3('0x1c')]['isNotNull']=function(_0x49f735){return _0x49f735!==null&&!_[_0x10f3('0x1e')](_0x49f735);};VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0xc')]=function(_0x20c0a6){try{if(this[_0x10f3('0x1f')](_0x20c0a6)){if(_[_0x10f3('0x1e')](this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]])){this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]]={};}if(_[_0x10f3('0x1e')](this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]][_0x20c0a6[_0x10f3('0x21')]])){this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]][_0x20c0a6[_0x10f3('0x21')]]={'agentcalledAt':moment()[_0x10f3('0x22')](_0x10f3('0x23')),'lastevent':'called','variables':this['variables'][_0x20c0a6[_0x10f3('0x20')]],'type':this[_0x10f3('0x8')][_0x20c0a6[_0x10f3('0x24')]]?this[_0x10f3('0x8')][_0x20c0a6[_0x10f3('0x24')]]['type']||'inbound':_0x10f3('0x25')};}_[_0x10f3('0x26')](this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]][_0x20c0a6[_0x10f3('0x21')]],_['omit'](_0x20c0a6,[_0x10f3('0x27'),_0x10f3('0x28')]));ami[_0x10f3('0x1d')](_0x10f3('0x29'),this[_0x10f3('0x7')][_0x20c0a6['uniqueid']][_0x20c0a6[_0x10f3('0x21')]]);this['emit'](util[_0x10f3('0x22')](_0x10f3('0x2a'),_0x20c0a6[_0x10f3('0x2b')]),_0x10f3('0x2c'),this[_0x10f3('0x7')][_0x20c0a6[_0x10f3('0x20')]][_0x20c0a6[_0x10f3('0x21')]]);}}catch(_0x21eadc){logger[_0x10f3('0x2d')](_0x10f3('0x2e'),util[_0x10f3('0x2f')](_0x21eadc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10f3('0x30')]=function(_0x46db07){try{if(this[_0x10f3('0x1f')](_0x46db07)){if(this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]]){for(var _0xbb6400 in this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]]){if(this['channels'][_0x46db07[_0x10f3('0x20')]][_0x10f3('0x31')](_0xbb6400)){if(_0x46db07[_0x10f3('0x21')]===_0xbb6400){this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400]['agentconnectAt']=moment()[_0x10f3('0x22')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x32')]=_0x10f3('0x33');this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x34')]=_0x46db07[_0x10f3('0x34')];this['channels'][_0x46db07['uniqueid']][_0xbb6400][_0x10f3('0x35')]=_0x46db07[_0x10f3('0x35')];this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x36')]=_0x46db07[_0x10f3('0x36')];this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x37')]=_0x46db07[_0x10f3('0x37')];this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x38')]=_0x46db07[_0x10f3('0x38')];_[_0x10f3('0x26')](this['agents'][_0x46db07[_0x10f3('0x39')]],_['pick'](_0x46db07,[_0x10f3('0x24'),_0x10f3('0x3a')]));this[_0x10f3('0x1d')](util[_0x10f3('0x22')](_0x10f3('0x2a'),_0x46db07[_0x10f3('0x2b')]),_0x10f3('0x3b'),this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0x46db07[_0x10f3('0x21')]]);ami[_0x10f3('0x1d')](_0x10f3('0x3c'),this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400]);}else if(!this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0xf')]&&!this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400]['agentcomplete']){this[_0x10f3('0x7')][_0x46db07['uniqueid']][_0xbb6400][_0x10f3('0xf')]=!![];this['channels'][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x3d')]=moment()[_0x10f3('0x22')](_0x10f3('0x23'));this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x3e')]=_0x10f3('0x3f');this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400][_0x10f3('0x32')]=_0x10f3('0x3f');this['channels'][_0x46db07[_0x10f3('0x20')]][_0xbb6400]['answeredelsewheredestinationuniqueid']=_0x46db07[_0x10f3('0x21')];this['channels'][_0x46db07['uniqueid']][_0xbb6400]['answeredelsewheremembername']=_0x46db07['membername'];ami[_0x10f3('0x1d')](_0x10f3('0x40'),this[_0x10f3('0x7')][_0x46db07[_0x10f3('0x20')]][_0xbb6400]);}}}}}}catch(_0x5958e){logger[_0x10f3('0x2d')]('[syncAgentConnect][VoiceAgentReport]',util[_0x10f3('0x2f')](_0x5958e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10f3('0x1c')]['syncAgentRingNoAnswer']=function(_0x564bb2){try{if(this[_0x10f3('0x1f')](_0x564bb2)){if(this['channels'][_0x564bb2['uniqueid']]&&this['channels'][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]]){this[_0x10f3('0x7')][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]]['agentringnoanswer']=!![];this[_0x10f3('0x7')][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]][_0x10f3('0x3d')]=moment()[_0x10f3('0x22')](_0x10f3('0x23'));this[_0x10f3('0x7')][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]][_0x10f3('0x3e')]='rejected';this[_0x10f3('0x7')][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]][_0x10f3('0x32')]=_0x10f3('0x41');ami[_0x10f3('0x1d')]('custom:agentringnoanswer',this[_0x10f3('0x7')][_0x564bb2[_0x10f3('0x20')]][_0x564bb2[_0x10f3('0x21')]]);}}}catch(_0x1d2dc6){logger[_0x10f3('0x2d')](_0x10f3('0x42'),util[_0x10f3('0x2f')](_0x1d2dc6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0x43')]=function(_0x38732e){try{if(this['isNotNull'](_0x38732e)){if(this[_0x10f3('0x7')][_0x38732e[_0x10f3('0x20')]]){for(var _0x589de0 in this[_0x10f3('0x7')][_0x38732e['uniqueid']]){if(this[_0x10f3('0x7')][_0x38732e[_0x10f3('0x20')]][_0x10f3('0x31')](_0x589de0)&&!this[_0x10f3('0x7')][_0x38732e[_0x10f3('0x20')]][_0x589de0][_0x10f3('0xf')]&&!this['channels'][_0x38732e[_0x10f3('0x20')]][_0x589de0][_0x10f3('0x12')]){this['channels'][_0x38732e['uniqueid']][_0x589de0][_0x10f3('0xf')]=!![];this['channels'][_0x38732e[_0x10f3('0x20')]][_0x589de0]['agentringnoanswerAt']=moment()[_0x10f3('0x22')](_0x10f3('0x23'));this['channels'][_0x38732e['uniqueid']][_0x589de0]['reason']='abandoned';this[_0x10f3('0x7')][_0x38732e[_0x10f3('0x20')]][_0x589de0]['lastevent']=_0x10f3('0x44');ami[_0x10f3('0x1d')](_0x10f3('0x45'),this[_0x10f3('0x7')][_0x38732e[_0x10f3('0x20')]][_0x589de0]);}}}}}catch(_0x1d7300){logger[_0x10f3('0x2d')](_0x10f3('0x46'),util[_0x10f3('0x2f')](_0x1d7300,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0x47')]=function(_0xe4348d){try{if(this['isNotNull'](_0xe4348d)){if(this['channels'][_0xe4348d['uniqueid']]){for(var _0x148828 in this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]]){if(this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x10f3('0x31')](_0x148828)){if(this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828][_0x10f3('0x48')]&&!this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828][_0x10f3('0x12')]){this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828][_0x10f3('0x12')]=!![];this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828]['agentcompleteAt']=moment()[_0x10f3('0x22')](_0x10f3('0x23'));this['channels'][_0xe4348d['uniqueid']][_0x148828][_0x10f3('0x32')]=_0x10f3('0x49');this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828]['talktime']=_0xe4348d['talktime'];this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828]['reason']=_0xe4348d[_0x10f3('0x3e')]=='transfer'?_0x10f3('0x4a'):_0xe4348d[_0x10f3('0x3e')];if(this[_0x10f3('0x8')][_0xe4348d[_0x10f3('0x24')]]&&this[_0x10f3('0x8')][_0xe4348d['queue']][_0x10f3('0x4b')]){this[_0x10f3('0x7')][_0xe4348d['uniqueid']][_0x148828][_0x10f3('0x4c')]=!![];this[_0x10f3('0x7')][_0xe4348d['uniqueid']][_0x148828]['acwtime']=this[_0x10f3('0x8')][_0xe4348d['queue']][_0x10f3('0x4d')];}this[_0x10f3('0x9')][_0xe4348d[_0x10f3('0x39')]]=_[_0x10f3('0x4e')](this[_0x10f3('0x9')][_0xe4348d['interface']],[_0x10f3('0x24'),_0x10f3('0x3a')]);this[_0x10f3('0x1d')](util[_0x10f3('0x22')](_0x10f3('0x2a'),_0xe4348d[_0x10f3('0x2b')]),_0x10f3('0x4f'),this[_0x10f3('0x7')][_0xe4348d[_0x10f3('0x20')]][_0x148828]);ami[_0x10f3('0x1d')](_0x10f3('0x50'),this[_0x10f3('0x7')][_0xe4348d['uniqueid']][_0x148828]);}}}}}}catch(_0x1d04a6){logger['error'](_0x10f3('0x51'),util['inspect'](_0x1d04a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x1888d0){try{if(this['isNotNull'](_0x1888d0)){this['addVariable'](_0x1888d0[_0x10f3('0x20')],_[_0x10f3('0x52')](_0x1888d0[_0x10f3('0x53')])[0x0],_0x1888d0[_0x10f3('0x54')]);if(this[_0x10f3('0x7')][_0x1888d0['uniqueid']]){for(var _0x234f94 in this[_0x10f3('0x7')][_0x1888d0[_0x10f3('0x20')]]){if(this[_0x10f3('0x7')][_0x1888d0['uniqueid']][_0x10f3('0x31')](_0x234f94)){if(_['isUndefined'](this[_0x10f3('0x7')][_0x1888d0[_0x10f3('0x20')]][_0x234f94]['variables'])){this[_0x10f3('0x7')][_0x1888d0[_0x10f3('0x20')]][_0x234f94][_0x10f3('0xa')]={};}this[_0x10f3('0x7')][_0x1888d0[_0x10f3('0x20')]][_0x234f94][_0x10f3('0xa')]=this['variables'][_0x1888d0[_0x10f3('0x20')]];}}}}}catch(_0x2a94d6){logger['error'](_0x10f3('0x55'),util[_0x10f3('0x2f')](_0x2a94d6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0x56')]=function(_0x4545ca,_0x16ed2a,_0x2f628e){var _0x41ed6d=[_0x10f3('0x57'),_0x10f3('0x58'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x10f3('0x59'),_0x10f3('0x5a'),_0x10f3('0x5b'),'rtpaudioqosrttbridged',_0x10f3('0x5c'),'sipuri',_0x10f3('0x5d'),_0x10f3('0x5e'),_0x10f3('0x5f'),'memberdynamic',_0x10f3('0x60'),'memberlastcall',_0x10f3('0x2b'),_0x10f3('0x61'),'memberrealtime'];if(!_[_0x10f3('0x62')](_0x16ed2a)&&!_[_0x10f3('0x63')](_0x41ed6d,_0x16ed2a)){if(_[_0x10f3('0x1e')](this[_0x10f3('0xa')][_0x4545ca])){this[_0x10f3('0xa')][_0x4545ca]={};}this[_0x10f3('0xa')][_0x4545ca][_0x16ed2a]=_0x2f628e;}};VoiceAgentReport[_0x10f3('0x1c')][_0x10f3('0x15')]=function(_0x4856dc){try{if(this['isNotNull'](_0x4856dc)){if(this[_0x10f3('0x7')][_0x4856dc[_0x10f3('0x20')]]){for(var _0x556450 in this[_0x10f3('0x7')][_0x4856dc[_0x10f3('0x20')]]){if(this[_0x10f3('0x7')][_0x4856dc['uniqueid']][_0x10f3('0x31')](_0x556450)){if(this[_0x10f3('0x7')][_0x4856dc['uniqueid']][_0x556450][_0x10f3('0x3e')]=='transfer'&&this['channels'][_0x4856dc[_0x10f3('0x20')]][_0x556450][_0x10f3('0x12')]){this[_0x10f3('0x7')][_0x4856dc[_0x10f3('0x20')]][_0x556450]['agentcompleteAt']=moment()[_0x10f3('0x22')](_0x10f3('0x23'));}}}ami['emit'](_0x10f3('0x64'),_[_0x10f3('0x65')](this['channels'][_0x4856dc[_0x10f3('0x20')]]));delete this['channels'][_0x4856dc[_0x10f3('0x20')]];}if(this[_0x10f3('0xa')][_0x4856dc[_0x10f3('0x20')]]){delete this['variables'][_0x4856dc[_0x10f3('0x20')]];}}}catch(_0x2d1982){logger[_0x10f3('0x2d')]('[syncHangup][VoiceAgentReport]',util[_0x10f3('0x2f')](_0x2d1982,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10f3('0x19')]=function(_0x53f0ca){try{if(this[_0x10f3('0x1f')](_0x53f0ca)){if(this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]]){for(var _0x1fe3c8 in this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]]){if(this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]]['hasOwnProperty'](_0x1fe3c8)){if(_0x53f0ca[_0x10f3('0x67')]===_0x1fe3c8){var _0x171112=moment();this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]][_0x1fe3c8]['agentcomplete']=!![];this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]][_0x1fe3c8][_0x10f3('0x68')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x53f0ca[_0x10f3('0x66')]][_0x1fe3c8][_0x10f3('0x3e')]='transfer';this['channels'][_0x53f0ca['transfereeuniqueid']][_0x1fe3c8][_0x10f3('0x32')]=_0x10f3('0x49');this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]][_0x1fe3c8][_0x10f3('0x69')]=_0x171112[_0x10f3('0x6a')](this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]][_0x1fe3c8][_0x10f3('0x48')],_0x10f3('0x6b'));}}}}if(this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x6c')]]){var _0xf076ba=this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x6c')]];this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x6c')]]=this['channels'][_0x53f0ca[_0x10f3('0x66')]];this[_0x10f3('0x7')][_0x53f0ca[_0x10f3('0x66')]]=_0xf076ba;}}}catch(_0xe4aac6){logger[_0x10f3('0x2d')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0x10f3('0x2f')](_0xe4aac6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x10f3('0x1b')]=function(_0x184448){try{if(this[_0x10f3('0x1f')](_0x184448)){if(this[_0x10f3('0x7')][_0x184448['transfereeuniqueid']]){for(var _0xe8c28d in this['channels'][_0x184448[_0x10f3('0x66')]]){if(this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0x10f3('0x31')](_0xe8c28d)){if(_0x184448[_0x10f3('0x6d')]===_0xe8c28d){var _0x5b6376=moment();this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0xe8c28d][_0x10f3('0x12')]=!![];this[_0x10f3('0x7')][_0x184448['transfereeuniqueid']][_0xe8c28d][_0x10f3('0x68')]=_0x5b6376;this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0xe8c28d][_0x10f3('0x3e')]=_0x10f3('0x6e');this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0xe8c28d][_0x10f3('0x32')]=_0x10f3('0x49');this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0xe8c28d][_0x10f3('0x69')]=_0x5b6376[_0x10f3('0x6a')](this[_0x10f3('0x7')][_0x184448[_0x10f3('0x66')]][_0xe8c28d][_0x10f3('0x48')],_0x10f3('0x6b'));}}}}}}catch(_0x2360de){logger[_0x10f3('0x2d')](_0x10f3('0x6f'),util[_0x10f3('0x2f')](_0x2360de,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x10f3('0x1c')]['syncMusicOnHoldStart']=function(_0x5f387c){var _0x34407c='';try{if(this[_0x10f3('0x1f')](_0x5f387c)){if(_0x5f387c[_0x10f3('0x70')]){_0x34407c=_0x5f387c[_0x10f3('0x70')][_0x10f3('0x71')](0x0,_0x5f387c[_0x10f3('0x70')]['lastIndexOf']('-'));if(this['agents'][_0x34407c]){this[_0x10f3('0x9')][_0x34407c]['onhold']=!![];}}}}catch(_0x1aa2b3){logger['error'](_0x10f3('0x72'),util['inspect'](_0x1aa2b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x47ca70){var _0xd52bf7='';try{if(this[_0x10f3('0x1f')](_0x47ca70)){if(_0x47ca70[_0x10f3('0x70')]){_0xd52bf7=_0x47ca70[_0x10f3('0x70')][_0x10f3('0x71')](0x0,_0x47ca70[_0x10f3('0x70')]['lastIndexOf']('-'));if(this['agents'][_0xd52bf7]){this[_0x10f3('0x9')][_0xd52bf7][_0x10f3('0x73')]=![];}}}}catch(_0x14d303){logger[_0x10f3('0x2d')](_0x10f3('0x74'),util['inspect'](_0x14d303,{'showHidden':![],'depth':null}));}};module[_0x10f3('0x75')]=VoiceAgentReport; \ No newline at end of file +var _0x6a78=['util','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','called','variables','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentcomplete','agentringnoanswerAt','YYYY-MM-DD\x20HH:mm:ss','reason','answered_elsewhere','lastevent','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','inspect','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','variable','value','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','diff','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6a78,0x1f3));var _0x86a7=function(_0x4259fb,_0x5e707b){_0x4259fb=_0x4259fb-0x0;var _0x39b86c=_0x6a78[_0x4259fb];return _0x39b86c;};'use strict';var _=require('lodash');var moment=require(_0x86a7('0x0'));var util=require(_0x86a7('0x1'));var Redis=require('ioredis');var config=require(_0x86a7('0x2'));var logger=require(_0x86a7('0x3'))('ami');var ami=require('../ami');config['redis']=_[_0x86a7('0x4')](config[_0x86a7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x86a7('0x6'))(new Redis(config['redis']));function VoiceAgentReport(_0x107f29){this[_0x86a7('0x7')]={};this['voiceQueues']=_0x107f29[_0x86a7('0x8')];this[_0x86a7('0x9')]=_0x107f29[_0x86a7('0x9')];this['variables']={};ami['on'](_0x86a7('0xa'),this[_0x86a7('0xb')][_0x86a7('0xc')](this));ami['on'](_0x86a7('0xd'),this[_0x86a7('0xe')]['bind'](this));ami['on'](_0x86a7('0xf'),this[_0x86a7('0x10')][_0x86a7('0xc')](this));ami['on'](_0x86a7('0x11'),this[_0x86a7('0x12')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x86a7('0x13'),this['syncVarSet'][_0x86a7('0xc')](this));ami['on'](_0x86a7('0x14'),this['syncHangup']['bind'](this));ami['on'](_0x86a7('0x15'),this[_0x86a7('0x16')][_0x86a7('0xc')](this));ami['on'](_0x86a7('0x17'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x86a7('0x18'),this[_0x86a7('0x19')][_0x86a7('0xc')](this));ami['on'](_0x86a7('0x1a'),this['syncBlindTransfer'][_0x86a7('0xc')](this));}VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0x1c')]=function(_0x459e8d,_0x5349c6,_0x1adb9c){io['to'](_0x459e8d)['emit'](_0x5349c6,_0x1adb9c);};VoiceAgentReport['prototype']['isNotNull']=function(_0x3142a1){return _0x3142a1!==null&&!_[_0x86a7('0x1d')](_0x3142a1);};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0xb')]=function(_0x13ea66){try{if(this[_0x86a7('0x1e')](_0x13ea66)){if(_['isUndefined'](this[_0x86a7('0x7')][_0x13ea66[_0x86a7('0x1f')]])){this[_0x86a7('0x7')][_0x13ea66[_0x86a7('0x1f')]]={};}if(_['isUndefined'](this['channels'][_0x13ea66[_0x86a7('0x1f')]][_0x13ea66[_0x86a7('0x20')]])){this['channels'][_0x13ea66[_0x86a7('0x1f')]][_0x13ea66[_0x86a7('0x20')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x86a7('0x21'),'variables':this[_0x86a7('0x22')][_0x13ea66[_0x86a7('0x1f')]],'type':this['voiceQueues'][_0x13ea66[_0x86a7('0x23')]]?this[_0x86a7('0x8')][_0x13ea66['queue']][_0x86a7('0x24')]||'inbound':_0x86a7('0x25')};}_[_0x86a7('0x26')](this[_0x86a7('0x7')][_0x13ea66['uniqueid']][_0x13ea66[_0x86a7('0x20')]],_[_0x86a7('0x27')](_0x13ea66,[_0x86a7('0x28'),_0x86a7('0x29')]));ami['emit'](_0x86a7('0x2a'),this['channels'][_0x13ea66[_0x86a7('0x1f')]][_0x13ea66[_0x86a7('0x20')]]);this['emit'](util[_0x86a7('0x2b')](_0x86a7('0x2c'),_0x13ea66[_0x86a7('0x2d')]),_0x86a7('0x2e'),this[_0x86a7('0x7')][_0x13ea66[_0x86a7('0x1f')]][_0x13ea66[_0x86a7('0x20')]]);}}catch(_0x305388){logger[_0x86a7('0x2f')](_0x86a7('0x30'),util['inspect'](_0x305388,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0xe')]=function(_0x5187e4){try{if(this['isNotNull'](_0x5187e4)){if(this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]]){for(var _0xb61940 in this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]]){if(this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0x86a7('0x31')](_0xb61940)){if(_0x5187e4[_0x86a7('0x20')]===_0xb61940){this['channels'][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x32')]=moment()[_0x86a7('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x86a7('0x7')][_0x5187e4['uniqueid']][_0xb61940]['lastevent']=_0x86a7('0x33');this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x34')]=_0x5187e4[_0x86a7('0x34')];this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x35')]=_0x5187e4[_0x86a7('0x35')];this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x36')]=_0x5187e4[_0x86a7('0x36')];this[_0x86a7('0x7')][_0x5187e4['uniqueid']][_0xb61940][_0x86a7('0x37')]=_0x5187e4[_0x86a7('0x37')];this['channels'][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x38')]=_0x5187e4[_0x86a7('0x38')];_[_0x86a7('0x26')](this[_0x86a7('0x9')][_0x5187e4[_0x86a7('0x39')]],_[_0x86a7('0x3a')](_0x5187e4,['queue',_0x86a7('0x3b')]));this[_0x86a7('0x1c')](util[_0x86a7('0x2b')]('user:%s',_0x5187e4[_0x86a7('0x2d')]),_0x86a7('0x3c'),this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0x5187e4[_0x86a7('0x20')]]);ami['emit'](_0x86a7('0x3d'),this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940]);}else if(!this['channels'][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0xf')]&&!this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x3e')]){this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940]['agentringnoanswer']=!![];this[_0x86a7('0x7')][_0x5187e4['uniqueid']][_0xb61940][_0x86a7('0x3f')]=moment()['format'](_0x86a7('0x40'));this['channels'][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x41')]=_0x86a7('0x42');this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x43')]=_0x86a7('0x42');this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940][_0x86a7('0x44')]=_0x5187e4[_0x86a7('0x20')];this[_0x86a7('0x7')][_0x5187e4['uniqueid']][_0xb61940][_0x86a7('0x45')]=_0x5187e4[_0x86a7('0x2d')];ami[_0x86a7('0x1c')](_0x86a7('0x46'),this[_0x86a7('0x7')][_0x5187e4[_0x86a7('0x1f')]][_0xb61940]);}}}}}}catch(_0x3de581){logger['error'](_0x86a7('0x47'),util['inspect'](_0x3de581,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')]['syncAgentRingNoAnswer']=function(_0x532958){try{if(this[_0x86a7('0x1e')](_0x532958)){if(this[_0x86a7('0x7')][_0x532958[_0x86a7('0x1f')]]&&this[_0x86a7('0x7')][_0x532958['uniqueid']][_0x532958[_0x86a7('0x20')]]){this[_0x86a7('0x7')][_0x532958[_0x86a7('0x1f')]][_0x532958[_0x86a7('0x20')]][_0x86a7('0xf')]=!![];this[_0x86a7('0x7')][_0x532958[_0x86a7('0x1f')]][_0x532958[_0x86a7('0x20')]][_0x86a7('0x3f')]=moment()[_0x86a7('0x2b')](_0x86a7('0x40'));this['channels'][_0x532958['uniqueid']][_0x532958['destuniqueid']][_0x86a7('0x41')]=_0x86a7('0x48');this[_0x86a7('0x7')][_0x532958[_0x86a7('0x1f')]][_0x532958['destuniqueid']]['lastevent']=_0x86a7('0x48');ami['emit'](_0x86a7('0x49'),this[_0x86a7('0x7')][_0x532958[_0x86a7('0x1f')]][_0x532958[_0x86a7('0x20')]]);}}}catch(_0x3f5d49){logger[_0x86a7('0x2f')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x86a7('0x4a')](_0x3f5d49,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x2dcead){try{if(this[_0x86a7('0x1e')](_0x2dcead)){if(this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]]){for(var _0x139881 in this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]]){if(this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]]['hasOwnProperty'](_0x139881)&&!this[_0x86a7('0x7')][_0x2dcead['uniqueid']][_0x139881][_0x86a7('0xf')]&&!this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]][_0x139881][_0x86a7('0x3e')]){this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]][_0x139881][_0x86a7('0xf')]=!![];this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]][_0x139881]['agentringnoanswerAt']=moment()[_0x86a7('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x86a7('0x7')][_0x2dcead['uniqueid']][_0x139881][_0x86a7('0x41')]=_0x86a7('0x4b');this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]][_0x139881][_0x86a7('0x43')]=_0x86a7('0x4b');ami[_0x86a7('0x1c')](_0x86a7('0x4c'),this[_0x86a7('0x7')][_0x2dcead[_0x86a7('0x1f')]][_0x139881]);}}}}}catch(_0x1fb95d){logger[_0x86a7('0x2f')](_0x86a7('0x4d'),util[_0x86a7('0x4a')](_0x1fb95d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0x4e')]=function(_0x38f9cc){try{if(this[_0x86a7('0x1e')](_0x38f9cc)){if(this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]]){for(var _0x441053 in this[_0x86a7('0x7')][_0x38f9cc['uniqueid']]){if(this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]]['hasOwnProperty'](_0x441053)){if(this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053][_0x86a7('0x32')]&&!this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053][_0x86a7('0x3e')]){this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053]['agentcomplete']=!![];this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053][_0x86a7('0x4f')]=moment()[_0x86a7('0x2b')](_0x86a7('0x40'));this['channels'][_0x38f9cc['uniqueid']][_0x441053][_0x86a7('0x43')]=_0x86a7('0x50');this['channels'][_0x38f9cc[_0x86a7('0x1f')]][_0x441053][_0x86a7('0x51')]=_0x38f9cc[_0x86a7('0x51')];this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053][_0x86a7('0x41')]=_0x38f9cc['reason']==_0x86a7('0x52')?'agent':_0x38f9cc[_0x86a7('0x41')];if(this[_0x86a7('0x8')][_0x38f9cc[_0x86a7('0x23')]]&&this['voiceQueues'][_0x38f9cc[_0x86a7('0x23')]][_0x86a7('0x53')]){this[_0x86a7('0x7')][_0x38f9cc['uniqueid']][_0x441053][_0x86a7('0x54')]=!![];this[_0x86a7('0x7')][_0x38f9cc['uniqueid']][_0x441053]['acwtime']=this[_0x86a7('0x8')][_0x38f9cc['queue']][_0x86a7('0x55')];}this[_0x86a7('0x9')][_0x38f9cc[_0x86a7('0x39')]]=_[_0x86a7('0x27')](this[_0x86a7('0x9')][_0x38f9cc[_0x86a7('0x39')]],['queue',_0x86a7('0x3b')]);this[_0x86a7('0x1c')](util['format'](_0x86a7('0x2c'),_0x38f9cc['membername']),_0x86a7('0x56'),this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053]);ami[_0x86a7('0x1c')](_0x86a7('0x57'),this[_0x86a7('0x7')][_0x38f9cc[_0x86a7('0x1f')]][_0x441053]);}}}}}}catch(_0x29b7c0){logger['error'](_0x86a7('0x58'),util['inspect'](_0x29b7c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x86a7('0x59')]=function(_0x23a20f){try{if(this['isNotNull'](_0x23a20f)){this[_0x86a7('0x5a')](_0x23a20f['uniqueid'],_['keys'](_0x23a20f[_0x86a7('0x5b')])[0x0],_0x23a20f[_0x86a7('0x5c')]);if(this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]]){for(var _0x55cc45 in this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]]){if(this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]][_0x86a7('0x31')](_0x55cc45)){if(_['isUndefined'](this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]][_0x55cc45]['variables'])){this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]][_0x55cc45][_0x86a7('0x22')]={};}this[_0x86a7('0x7')][_0x23a20f[_0x86a7('0x1f')]][_0x55cc45][_0x86a7('0x22')]=this[_0x86a7('0x22')][_0x23a20f[_0x86a7('0x1f')]];}}}}}catch(_0x3ec8bd){logger[_0x86a7('0x2f')]('[syncVarSet][VoiceAgentReport]',util[_0x86a7('0x4a')](_0x3ec8bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')]['addVariable']=function(_0x52ba19,_0x3fc257,_0x5ca83f){var _0x521432=[_0x86a7('0x5d'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x86a7('0x5e'),'rtpaudioqosloss',_0x86a7('0x5f'),_0x86a7('0x60'),_0x86a7('0x61'),_0x86a7('0x62'),_0x86a7('0x63'),_0x86a7('0x64'),_0x86a7('0x65'),'membercalls','memberdynamic',_0x86a7('0x66'),_0x86a7('0x67'),_0x86a7('0x2d'),_0x86a7('0x68'),_0x86a7('0x69')];if(!_['isNil'](_0x3fc257)&&!_['includes'](_0x521432,_0x3fc257)){if(_[_0x86a7('0x1d')](this[_0x86a7('0x22')][_0x52ba19])){this[_0x86a7('0x22')][_0x52ba19]={};}this['variables'][_0x52ba19][_0x3fc257]=_0x5ca83f;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x433d8d){try{if(this['isNotNull'](_0x433d8d)){if(this['channels'][_0x433d8d[_0x86a7('0x1f')]]){for(var _0x31d37 in this[_0x86a7('0x7')][_0x433d8d[_0x86a7('0x1f')]]){if(this['channels'][_0x433d8d[_0x86a7('0x1f')]]['hasOwnProperty'](_0x31d37)){if(this[_0x86a7('0x7')][_0x433d8d[_0x86a7('0x1f')]][_0x31d37][_0x86a7('0x41')]==_0x86a7('0x52')&&this[_0x86a7('0x7')][_0x433d8d['uniqueid']][_0x31d37]['agentcomplete']){this['channels'][_0x433d8d[_0x86a7('0x1f')]][_0x31d37][_0x86a7('0x4f')]=moment()[_0x86a7('0x2b')](_0x86a7('0x40'));}}}ami[_0x86a7('0x1c')](_0x86a7('0x6a'),_[_0x86a7('0x6b')](this['channels'][_0x433d8d[_0x86a7('0x1f')]]));delete this['channels'][_0x433d8d[_0x86a7('0x1f')]];}if(this[_0x86a7('0x22')][_0x433d8d[_0x86a7('0x1f')]]){delete this['variables'][_0x433d8d[_0x86a7('0x1f')]];}}}catch(_0x594371){logger[_0x86a7('0x2f')](_0x86a7('0x6c'),util[_0x86a7('0x4a')](_0x594371,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x86a7('0x19')]=function(_0x1eea4c){try{if(this[_0x86a7('0x1e')](_0x1eea4c)){if(this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]]){for(var _0x3a37bc in this['channels'][_0x1eea4c[_0x86a7('0x6d')]]){if(this[_0x86a7('0x7')][_0x1eea4c['transfereeuniqueid']][_0x86a7('0x31')](_0x3a37bc)){if(_0x1eea4c[_0x86a7('0x6e')]===_0x3a37bc){var _0xa0ad71=moment();this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]][_0x3a37bc][_0x86a7('0x3e')]=!![];this['channels'][_0x1eea4c[_0x86a7('0x6d')]][_0x3a37bc]['agentcompleteAt']=moment()['format'](_0x86a7('0x40'));this[_0x86a7('0x7')][_0x1eea4c['transfereeuniqueid']][_0x3a37bc][_0x86a7('0x41')]=_0x86a7('0x52');this[_0x86a7('0x7')][_0x1eea4c['transfereeuniqueid']][_0x3a37bc]['lastevent']=_0x86a7('0x50');this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]][_0x3a37bc][_0x86a7('0x51')]=_0xa0ad71['diff'](this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]][_0x3a37bc]['agentconnectAt'],_0x86a7('0x6f'));}}}}if(this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x70')]]){var _0x5ac101=this['channels'][_0x1eea4c[_0x86a7('0x70')]];this['channels'][_0x1eea4c[_0x86a7('0x70')]]=this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]];this[_0x86a7('0x7')][_0x1eea4c[_0x86a7('0x6d')]]=_0x5ac101;}}}catch(_0x40f89a){logger['error'](_0x86a7('0x71'),util[_0x86a7('0x4a')](_0x40f89a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0x72')]=function(_0x420e9f){try{if(this[_0x86a7('0x1e')](_0x420e9f)){if(this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]]){for(var _0x1b44ae in this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]]){if(this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]]['hasOwnProperty'](_0x1b44ae)){if(_0x420e9f[_0x86a7('0x73')]===_0x1b44ae){var _0x3e79cc=moment();this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae]['agentcomplete']=!![];this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae][_0x86a7('0x4f')]=_0x3e79cc;this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae][_0x86a7('0x41')]='transfer';this['channels'][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae][_0x86a7('0x43')]=_0x86a7('0x50');this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae][_0x86a7('0x51')]=_0x3e79cc[_0x86a7('0x74')](this[_0x86a7('0x7')][_0x420e9f[_0x86a7('0x6d')]][_0x1b44ae][_0x86a7('0x32')],_0x86a7('0x6f'));}}}}}}catch(_0x2dc10a){logger[_0x86a7('0x2f')](_0x86a7('0x75'),util[_0x86a7('0x4a')](_0x2dc10a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0x16')]=function(_0x25ef08){var _0x14e98b='';try{if(this[_0x86a7('0x1e')](_0x25ef08)){if(_0x25ef08['channel']){_0x14e98b=_0x25ef08[_0x86a7('0x76')][_0x86a7('0x77')](0x0,_0x25ef08[_0x86a7('0x76')][_0x86a7('0x78')]('-'));if(this[_0x86a7('0x9')][_0x14e98b]){this[_0x86a7('0x9')][_0x14e98b][_0x86a7('0x79')]=!![];}}}}catch(_0x4b26d4){logger['error']('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x86a7('0x4a')](_0x4b26d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86a7('0x1b')][_0x86a7('0x7a')]=function(_0x3c5ffe){var _0x303a9b='';try{if(this[_0x86a7('0x1e')](_0x3c5ffe)){if(_0x3c5ffe[_0x86a7('0x76')]){_0x303a9b=_0x3c5ffe['channel'][_0x86a7('0x77')](0x0,_0x3c5ffe['channel'][_0x86a7('0x78')]('-'));if(this[_0x86a7('0x9')][_0x303a9b]){this['agents'][_0x303a9b][_0x86a7('0x79')]=![];}}}}catch(_0x4a99b7){logger[_0x86a7('0x2f')](_0x86a7('0x7b'),util[_0x86a7('0x4a')](_0x4a99b7,{'showHidden':![],'depth':null}));}};module[_0x86a7('0x7c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index c14d93f..bdaac70 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 _0x8ad5=['linkedid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','isNotNull','channel','OutgoingSpoolFailed','starttime','format','disposition','channelstate','from-sip','split','destconnectedlinenum','exten','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','monitor','replace','.wav49','.WAV','monitors','isNil','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','billableseconds','context','user:%s','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfercalleridnum','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','catch','log','isUndefined','prototype','emit','uniqueid'];(function(_0x4ef26f,_0x2067ac){var _0x15141a=function(_0x4abcc2){while(--_0x4abcc2){_0x4ef26f['push'](_0x4ef26f['shift']());}};_0x15141a(++_0x2067ac);}(_0x8ad5,0xf1));var _0x58ad=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x8ad5[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0x58ad('0x0'));var _=require(_0x58ad('0x1'));var moment=require(_0x58ad('0x2'));var util=require(_0x58ad('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0x58ad('0x4'));var logger=require(_0x58ad('0x5'))(_0x58ad('0x6'));var ami=require(_0x58ad('0x7'));var Channel=require(_0x58ad('0x8'));var statusDesc=[_0x58ad('0x9'),'not_inuse','inuse',_0x58ad('0xa'),_0x58ad('0xb'),_0x58ad('0xc'),_0x58ad('0xd'),_0x58ad('0xe'),_0x58ad('0xf')];var applications=[_0x58ad('0x10'),_0x58ad('0x11'),_0x58ad('0x12'),'dial',_0x58ad('0x13'),_0x58ad('0x14')];var dispositions=[_0x58ad('0x15'),_0x58ad('0x16'),_0x58ad('0x16'),_0x58ad('0x15'),_0x58ad('0x15'),_0x58ad('0x15'),'ANSWERED',_0x58ad('0x17'),_0x58ad('0x16'),_0x58ad('0x16'),_0x58ad('0x16')];var actions={};config[_0x58ad('0x18')]=_[_0x58ad('0x19')](config[_0x58ad('0x18')],{'host':_0x58ad('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x52fc31){this['channels']=_0x52fc31[_0x58ad('0x1b')];this['agents']=_0x52fc31[_0x58ad('0x1c')];ami['on'](_0x58ad('0x1d'),this[_0x58ad('0x1e')][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x20'),this['syncNewExten'][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x21'),this[_0x58ad('0x22')][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x23'),this[_0x58ad('0x24')][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x25'),this['syncVarSet'][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x26'),this[_0x58ad('0x27')]['bind'](this));ami['on'](_0x58ad('0x28'),this[_0x58ad('0x29')][_0x58ad('0x1f')](this));ami['on']('attendedtransfer',this[_0x58ad('0x2a')][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x2b'),this[_0x58ad('0x2c')]['bind'](this));ami['on'](_0x58ad('0x2d'),this[_0x58ad('0x2e')][_0x58ad('0x1f')](this));ami['on'](_0x58ad('0x2f'),this[_0x58ad('0x30')][_0x58ad('0x1f')](this));return BPromise[_0x58ad('0x31')]()[_0x58ad('0x32')](ami['actionCoreShowChannels']())[_0x58ad('0x33')](function(_0x4ec837){console[_0x58ad('0x34')](_0x4ec837);});}VoiceCallReport['prototype']['isNotNull']=function(_0x139149){return _0x139149!==null&&!_[_0x58ad('0x35')](_0x139149);};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x37')]=function(_0x20611c,_0x4332c,_0x2ec203){io['to'](_0x20611c)[_0x58ad('0x37')](_0x4332c,_0x2ec203);};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x29')]=function(_0x230880){try{if(this['isNotNull'](_0x230880)){if(_0x230880[_0x58ad('0x38')]===_0x230880[_0x58ad('0x39')]){if(!_[_0x58ad('0x35')](this[_0x58ad('0x1b')][_0x230880[_0x58ad('0x38')]])){_['merge'](this[_0x58ad('0x1b')][_0x230880[_0x58ad('0x38')]],_[_0x58ad('0x3a')](_0x230880,_[_0x58ad('0x3b')](this[_0x58ad('0x1b')][_0x230880['uniqueid']])));}}}}catch(_0x51f456){logger[_0x58ad('0x3c')](_0x58ad('0x3d'),util[_0x58ad('0x3e')](_0x51f456,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x22')]=function(_0x2aa6df){try{if(this[_0x58ad('0x3f')](_0x2aa6df)){if(_0x2aa6df[_0x58ad('0x38')]===_0x2aa6df['linkedid']&&_0x2aa6df[_0x58ad('0x40')]!=_0x58ad('0x41')){if(_[_0x58ad('0x35')](this['channels'][_0x2aa6df[_0x58ad('0x38')]])){this['channels'][_0x2aa6df[_0x58ad('0x38')]]=new Channel();this[_0x58ad('0x1b')][_0x2aa6df['uniqueid']][_0x58ad('0x42')]=moment()[_0x58ad('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2aa6df[_0x58ad('0x38')]][_0x58ad('0x44')]=dispositions[_['toNumber'](_0x2aa6df[_0x58ad('0x45')])];_['merge'](this['channels'][_0x2aa6df[_0x58ad('0x38')]],_[_0x58ad('0x3a')](_0x2aa6df,_[_0x58ad('0x3b')](this[_0x58ad('0x1b')][_0x2aa6df[_0x58ad('0x38')]])));if(_0x2aa6df['context']===_0x58ad('0x46')){if(this[_0x58ad('0x1c')][_0x2aa6df[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]]){this[_0x58ad('0x1c')][_0x2aa6df['channel'][_0x58ad('0x47')]('-')[0x0]][_0x58ad('0x48')]=_0x2aa6df[_0x58ad('0x49')];this['emit'](util['format']('user:%s',this[_0x58ad('0x1c')][_0x2aa6df['channel'][_0x58ad('0x47')]('-')[0x0]][_0x58ad('0x4a')]),_0x58ad('0x4b'),{'destaccountcode':this[_0x58ad('0x1c')][_0x2aa6df['channel'][_0x58ad('0x47')]('-')[0x0]][_0x58ad('0x4c')],'destconnectedlinenum':_0x2aa6df[_0x58ad('0x49')]});}}}}}}catch(_0x5f1fb6){logger['error'](_0x58ad('0x4d'),util[_0x58ad('0x3e')](_0x5f1fb6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x58ad('0x36')]['syncNewExten']=function(_0x1fd695){try{if(this['isNotNull'](_0x1fd695)){if(_0x1fd695[_0x58ad('0x38')]===_0x1fd695[_0x58ad('0x39')]&&_0x1fd695[_0x58ad('0x49')]!='h'&&_0x1fd695[_0x58ad('0x40')]!=_0x58ad('0x41')){_0x1fd695[_0x58ad('0x4e')]=_0x1fd695['application'][_0x58ad('0x4f')]();_0x1fd695['applicationdata']=(_0x1fd695[_0x58ad('0x50')]||_0x1fd695[_0x58ad('0x51')])['toLowerCase']();if(_[_0x58ad('0x35')](this[_0x58ad('0x1b')][_0x1fd695['uniqueid']])){this['channels'][_0x1fd695[_0x58ad('0x38')]]=new Channel();this['channels'][_0x1fd695[_0x58ad('0x38')]][_0x58ad('0x42')]=_0x1fd695['duration']?moment()['subtract'](moment[_0x58ad('0x52')](_0x1fd695[_0x58ad('0x52')])[_0x58ad('0x53')](),_0x58ad('0x53'))[_0x58ad('0x43')](_0x58ad('0x54')):moment()[_0x58ad('0x43')](_0x58ad('0x54'));this[_0x58ad('0x1b')][_0x1fd695[_0x58ad('0x38')]][_0x58ad('0x44')]=_0x58ad('0x15');}_[_0x58ad('0x55')](this['channels'][_0x1fd695[_0x58ad('0x38')]],_[_0x58ad('0x3a')](_0x1fd695,_['keys'](this[_0x58ad('0x1b')][_0x1fd695['uniqueid']])));if(_[_0x58ad('0x56')](applications,_0x1fd695[_0x58ad('0x4e')])){this[_0x58ad('0x1b')][_0x1fd695['uniqueid']][_0x58ad('0x57')]=_0x1fd695['application'];this[_0x58ad('0x1b')][_0x1fd695[_0x58ad('0x38')]]['lastdata']=_0x1fd695[_0x58ad('0x51')];if(_0x1fd695[_0x58ad('0x4e')]==='set'&&_[_0x58ad('0x58')](_0x1fd695[_0x58ad('0x51')],_0x58ad('0x59'))){var _0x42462b=_0x1fd695[_0x58ad('0x51')][_0x58ad('0x47')]('=');var _0x171c92=_0x42462b[0x0][_0x58ad('0x5a')](/cdr\((.*)\)/);if(_0x171c92){this[_0x58ad('0x1b')][_0x1fd695[_0x58ad('0x38')]][_0x171c92[0x1]]=_0x42462b[0x1];}}else if(_0x1fd695['application']===_0x58ad('0x11')){this[_0x58ad('0x1b')][_0x1fd695[_0x58ad('0x38')]][_0x58ad('0x11')]=_0x1fd695[_0x58ad('0x51')][_0x58ad('0x47')](',')[0x0];}}}}}catch(_0x3c1989){logger[_0x58ad('0x3c')](_0x58ad('0x5b'),util[_0x58ad('0x3e')](_0x3c1989,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x24')]=function(_0x4fbf4c){try{if(this[_0x58ad('0x3f')](_0x4fbf4c)){if(_0x4fbf4c[_0x58ad('0x38')]!==_0x4fbf4c['linkedid']){if(this['channels'][_0x4fbf4c[_0x58ad('0x39')]]){if(_0x4fbf4c[_0x58ad('0x45')]==='6'){if(!this['channels'][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x5c')]){var _0x3be621=moment();this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]]['answered']=!![];this[_0x58ad('0x1b')][_0x4fbf4c['linkedid']][_0x58ad('0x5d')]=_0x3be621[_0x58ad('0x43')](_0x58ad('0x54'));if(this['channels'][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x42')]){this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x5e')]=_0x3be621[_0x58ad('0x5f')](this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x42')],'seconds');}}this[_0x58ad('0x1b')][_0x4fbf4c['linkedid']][_0x58ad('0x39')]=_0x4fbf4c[_0x58ad('0x38')];if(_0x4fbf4c[_0x58ad('0x60')]!==_0x58ad('0x61')){this['channels'][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x62')]=_0x4fbf4c['calleridnum'];}this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x63')]=_0x4fbf4c['calleridname'];this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x64')]=_0x4fbf4c[_0x58ad('0x40')];this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x44')]=dispositions[_['toNumber'](_0x4fbf4c[_0x58ad('0x45')])];if(this[_0x58ad('0x1c')][_0x4fbf4c[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]]){this[_0x58ad('0x1b')][_0x4fbf4c['linkedid']]['UserId']=this[_0x58ad('0x1c')][_0x4fbf4c[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]]['id'];this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x39')]][_0x58ad('0x65')]=this[_0x58ad('0x1c')][_0x4fbf4c[_0x58ad('0x40')]['split']('-')[0x0]][_0x58ad('0x4a')];}}}}else{if(this[_0x58ad('0x1b')][_0x4fbf4c[_0x58ad('0x38')]]){if(_0x4fbf4c[_0x58ad('0x45')]==='6'){if(this[_0x58ad('0x1c')][_0x4fbf4c[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]]){this[_0x58ad('0x1b')][_0x4fbf4c['uniqueid']][_0x58ad('0x66')]=this[_0x58ad('0x1c')][_0x4fbf4c['channel'][_0x58ad('0x47')]('-')[0x0]]['id'];this[_0x58ad('0x1b')][_0x4fbf4c['uniqueid']][_0x58ad('0x65')]=this[_0x58ad('0x1c')][_0x4fbf4c['channel'][_0x58ad('0x47')]('-')[0x0]][_0x58ad('0x4a')];}}}}}}catch(_0x2897d5){logger[_0x58ad('0x3c')](_0x58ad('0x67'),util[_0x58ad('0x3e')](_0x2897d5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x42a41f,_0x3440ed){if(this[_0x58ad('0x1b')][_0x42a41f]){this[_0x58ad('0x1b')][_0x42a41f][_0x58ad('0x68')]=!![];if(_['endsWith'](_0x3440ed,'.wav49')){_0x3440ed=_0x3440ed[_0x58ad('0x69')](_0x58ad('0x6a'),_0x58ad('0x6b'));}this['channels'][_0x42a41f]['monitorFilename']=_0x3440ed;var _0x450153=_['find'](this[_0x58ad('0x1b')][_0x42a41f][_0x58ad('0x6c')],{'filename':_0x3440ed});if(_[_0x58ad('0x6d')](_0x450153)){this['channels'][_0x42a41f][_0x58ad('0x6c')]['push']({'filename':_0x3440ed,'createdAt':moment()[_0x58ad('0x43')](_0x58ad('0x54')),'mixmonitorid':'','status':_0x58ad('0x6e')});}}};VoiceCallReport['prototype']['syncVarSet']=function(_0x9df727){try{if(this[_0x58ad('0x3f')](_0x9df727)){if(this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]]&&_0x9df727[_0x58ad('0x40')]!=_0x58ad('0x41')){if(this['isNotNull'](_0x9df727[_0x58ad('0x6f')])){if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x70')])){this[_0x58ad('0x71')](_0x9df727[_0x58ad('0x38')],_0x9df727[_0x58ad('0x72')]);}else if(this[_0x58ad('0x3f')](_0x9df727['variable'][_0x58ad('0x73')])){this['channels'][_0x9df727[_0x58ad('0x38')]]['calleridnum']=_0x9df727['value'];}else if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x74')])){this['channels'][_0x9df727[_0x58ad('0x38')]]['callerid']=_0x9df727[_0x58ad('0x72')];}else if(this['isNotNull'](_0x9df727[_0x58ad('0x6f')]['xmd-cdrtype'])){this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]]['type']=_0x9df727['value'];}else if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x75')])){this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]][_0x58ad('0x11')]=_0x9df727[_0x58ad('0x72')][_0x58ad('0x47')](',')[0x0];}else if(this['isNotNull'](_0x9df727['variable'][_0x58ad('0x76')])){this['channels'][_0x9df727[_0x58ad('0x38')]][_0x58ad('0x77')]=_0x9df727[_0x58ad('0x72')];}else if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x78')])){this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]][_0x58ad('0x79')]=_0x9df727[_0x58ad('0x72')];}else if(this[_0x58ad('0x3f')](_0x9df727['variable'][_0x58ad('0x7a')])){this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]][_0x58ad('0x7b')]=_0x9df727[_0x58ad('0x72')];}else if(this['isNotNull'](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x7c')])){this[_0x58ad('0x1b')][_0x9df727['uniqueid']][_0x58ad('0x11')]=_0x9df727['value'];}else if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x7d')])){this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x38')]][_0x58ad('0x7e')]=_0x9df727[_0x58ad('0x72')];}}}else if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')][_0x58ad('0x70')])){if(_0x9df727[_0x58ad('0x72')]){var _0x34ed9b=path[_0x58ad('0x7f')](_0x9df727[_0x58ad('0x72')])[_0x58ad('0x4a')];this[_0x58ad('0x71')](_0x34ed9b,_0x9df727[_0x58ad('0x72')]);}}else if(this[_0x58ad('0x1b')][_0x9df727[_0x58ad('0x39')]]){if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')])){if(this[_0x58ad('0x3f')](_0x9df727[_0x58ad('0x6f')]['sipcallid'])){this[_0x58ad('0x1b')][_0x9df727['linkedid']][_0x58ad('0x80')]=_0x9df727['value'];}}}}}catch(_0x3bed05){logger[_0x58ad('0x3c')]('[syncVarSet][VoiceCallReport]',util[_0x58ad('0x3e')](_0x3bed05,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x58ad('0x27')]=function(_0x84eaea){try{if(this[_0x58ad('0x3f')](_0x84eaea)){if(this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]]){var _0x464d69=moment();this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]]['endtime']=_0x464d69[_0x58ad('0x43')](_0x58ad('0x54'));this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]][_0x58ad('0x52')]=_0x464d69[_0x58ad('0x5f')](this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]][_0x58ad('0x42')],_0x58ad('0x53'));if(this[_0x58ad('0x1b')][_0x84eaea['uniqueid']][_0x58ad('0x5c')]){this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]][_0x58ad('0x81')]=_0x464d69[_0x58ad('0x5f')](this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]][_0x58ad('0x5d')],_0x58ad('0x53'));this[_0x58ad('0x1b')][_0x84eaea['uniqueid']][_0x58ad('0x5e')]=this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]]['duration']-this[_0x58ad('0x1b')][_0x84eaea['uniqueid']]['billableseconds'];}if(_0x84eaea[_0x58ad('0x82')]===_0x58ad('0x46')){if(this[_0x58ad('0x1c')][_0x84eaea[_0x58ad('0x40')]['split']('-')[0x0]]){this['agents'][_0x84eaea[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]]=_['omit'](this[_0x58ad('0x1c')][_0x84eaea[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]],['destconnectedlinenum']);this[_0x58ad('0x37')](util['format'](_0x58ad('0x83'),this['agents'][_0x84eaea[_0x58ad('0x40')][_0x58ad('0x47')]('-')[0x0]][_0x58ad('0x4a')]),_0x58ad('0x84'),{'destaccountcode':this['agents'][_0x84eaea[_0x58ad('0x40')]['split']('-')[0x0]][_0x58ad('0x4c')]});}}ami[_0x58ad('0x37')](_0x58ad('0x85'),this[_0x58ad('0x1b')][_0x84eaea[_0x58ad('0x38')]]);delete this['channels'][_0x84eaea[_0x58ad('0x38')]];}}}catch(_0x2cc46e){logger[_0x58ad('0x3c')](_0x58ad('0x86'),util[_0x58ad('0x3e')](_0x2cc46e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x2a')]=function(_0x15da05){try{if(this[_0x58ad('0x3f')](_0x15da05)){if(this['channels'][_0x15da05[_0x58ad('0x87')]]){this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x87')]]['transfercalleridnum']=_0x15da05[_0x58ad('0x88')];this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x87')]][_0x58ad('0x89')]=_0x15da05[_0x58ad('0x8a')];if(this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x8b')]]){var _0x29c790=this['channels'][_0x15da05['secondtransfereruniqueid']];this['channels'][_0x15da05[_0x58ad('0x8b')]]=this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x87')]];this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x87')]]=_0x29c790;}}else if(this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x8c')]]){this['channels'][_0x15da05[_0x58ad('0x8c')]]['transfercalleridnum']=_0x15da05[_0x58ad('0x88')];this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x8c')]]['transferconnectedlinenum']=_0x15da05[_0x58ad('0x8a')];if(this[_0x58ad('0x1b')][_0x15da05['origtransfereruniqueid']]){var _0x29c790=this[_0x58ad('0x1b')][_0x15da05['origtransfereruniqueid']];this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x8d')]]=this['channels'][_0x15da05[_0x58ad('0x8c')]];this[_0x58ad('0x1b')][_0x15da05[_0x58ad('0x8c')]]=_0x29c790;}}}}catch(_0x44e6b8){logger[_0x58ad('0x3c')](_0x58ad('0x8e'),util[_0x58ad('0x3e')](_0x44e6b8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x58ad('0x2c')]=function(_0x34153e){try{if(this['isNotNull'](_0x34153e)){if(this[_0x58ad('0x1b')][_0x34153e[_0x58ad('0x87')]]){this[_0x58ad('0x1b')][_0x34153e['transfereeuniqueid']][_0x58ad('0x8f')]=_0x34153e['transfereecalleridnum'];this[_0x58ad('0x1b')][_0x34153e[_0x58ad('0x87')]][_0x58ad('0x89')]=_0x34153e['extension'];this[_0x58ad('0x27')]({'event':'BlindTransfer','uniqueid':_0x34153e[_0x58ad('0x87')],'context':_0x34153e['context'],'channel':_0x34153e['transfererchannel']});}}}catch(_0x58cdf3){logger[_0x58ad('0x3c')](_0x58ad('0x90'),util[_0x58ad('0x3e')](_0x58cdf3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x4b2c00){try{if(this[_0x58ad('0x3f')](_0x4b2c00)){if(this['channels'][_0x4b2c00[_0x58ad('0x38')]]){if(!_[_0x58ad('0x6d')](this[_0x58ad('0x1b')][_0x4b2c00[_0x58ad('0x38')]][_0x58ad('0x5d')])){this[_0x58ad('0x1b')][_0x4b2c00[_0x58ad('0x38')]][_0x58ad('0x91')]=moment()[_0x58ad('0x43')](_0x58ad('0x54'));}}}}catch(_0x51ddc9){logger[_0x58ad('0x3c')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x58ad('0x3e')](_0x51ddc9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x58ad('0x36')][_0x58ad('0x30')]=function(_0x145f61){try{if(this[_0x58ad('0x3f')](_0x145f61)){if(this[_0x58ad('0x1b')][_0x145f61[_0x58ad('0x38')]]){if(!_[_0x58ad('0x6d')](this[_0x58ad('0x1b')][_0x145f61[_0x58ad('0x38')]][_0x58ad('0x91')])){this[_0x58ad('0x1b')][_0x145f61['uniqueid']]['mohtime']+=moment()[_0x58ad('0x92')](0x0)[_0x58ad('0x5f')](this[_0x58ad('0x1b')][_0x145f61[_0x58ad('0x38')]][_0x58ad('0x91')],_0x58ad('0x53'));delete this[_0x58ad('0x1b')][_0x145f61[_0x58ad('0x38')]][_0x58ad('0x91')];}}}}catch(_0x199ea3){logger['error'](_0x58ad('0x93'),util[_0x58ad('0x3e')](_0x199ea3,{'showHidden':![],'depth':null}));}};module[_0x58ad('0x94')]=VoiceCallReport; \ No newline at end of file +var _0x67e8=['onhold','set','agi','playback','voicemail','NO\x20ANSWER','FAILED','redis','localhost','channels','agents','coreshowchannel','syncNewExten','newchannel','newstate','bind','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','error','[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','channel','split','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','includes','lastapplication','lastdata','startsWith','cdr(','queue','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','diff','seconds','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','variable','mixmonitor_filename','xmd-phone','xmd-callerid','callerid','value','xmd-cdrtype','type','xmd-queue','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','holdtime','omit','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','ioredis','../../../config/environment','../ami','unknown','not_inuse','busy','invalid','unavailable','ringing'];(function(_0x5d3a90,_0x5b310c){var _0x3150f0=function(_0x697f01){while(--_0x697f01){_0x5d3a90['push'](_0x5d3a90['shift']());}};_0x3150f0(++_0x5b310c);}(_0x67e8,0x86));var _0x867e=function(_0x105e46,_0x5a1f57){_0x105e46=_0x105e46-0x0;var _0xa4fe16=_0x67e8[_0x105e46];return _0xa4fe16;};'use strict';var BPromise=require(_0x867e('0x0'));var _=require(_0x867e('0x1'));var moment=require(_0x867e('0x2'));var util=require('util');var path=require('path');var Redis=require(_0x867e('0x3'));var config=require(_0x867e('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x867e('0x5'));var Channel=require('../model/channel');var statusDesc=[_0x867e('0x6'),_0x867e('0x7'),'inuse',_0x867e('0x8'),_0x867e('0x9'),_0x867e('0xa'),_0x867e('0xb'),'ringinuse',_0x867e('0xc')];var applications=[_0x867e('0xd'),'queue',_0x867e('0xe'),'dial',_0x867e('0xf'),_0x867e('0x10')];var dispositions=[_0x867e('0x11'),_0x867e('0x12'),_0x867e('0x12'),_0x867e('0x11'),_0x867e('0x11'),'NO\x20ANSWER','ANSWERED','BUSY',_0x867e('0x12'),_0x867e('0x12'),_0x867e('0x12')];var actions={};config[_0x867e('0x13')]=_['defaults'](config[_0x867e('0x13')],{'host':_0x867e('0x14'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x867e('0x13')]));function VoiceCallReport(_0x5dbda4){this[_0x867e('0x15')]=_0x5dbda4[_0x867e('0x15')];this[_0x867e('0x16')]=_0x5dbda4[_0x867e('0x16')];ami['on'](_0x867e('0x17'),this[_0x867e('0x18')]['bind'](this));ami['on']('newexten',this[_0x867e('0x18')]['bind'](this));ami['on'](_0x867e('0x19'),this['syncNewChannel']['bind'](this));ami['on'](_0x867e('0x1a'),this['syncNewState'][_0x867e('0x1b')](this));ami['on'](_0x867e('0x1c'),this[_0x867e('0x1d')]['bind'](this));ami['on'](_0x867e('0x1e'),this[_0x867e('0x1f')][_0x867e('0x1b')](this));ami['on']('newcallerid',this[_0x867e('0x20')][_0x867e('0x1b')](this));ami['on'](_0x867e('0x21'),this[_0x867e('0x22')][_0x867e('0x1b')](this));ami['on'](_0x867e('0x23'),this[_0x867e('0x24')]['bind'](this));ami['on'](_0x867e('0x25'),this[_0x867e('0x26')][_0x867e('0x1b')](this));ami['on'](_0x867e('0x27'),this[_0x867e('0x28')][_0x867e('0x1b')](this));return BPromise['resolve']()[_0x867e('0x29')](ami[_0x867e('0x2a')]())[_0x867e('0x2b')](function(_0x45c088){console[_0x867e('0x2c')](_0x45c088);});}VoiceCallReport[_0x867e('0x2d')][_0x867e('0x2e')]=function(_0x3b2d3b){return _0x3b2d3b!==null&&!_[_0x867e('0x2f')](_0x3b2d3b);};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x30')]=function(_0x8c7603,_0x345ef0,_0x467e9c){io['to'](_0x8c7603)[_0x867e('0x30')](_0x345ef0,_0x467e9c);};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x20')]=function(_0x3ea31b){try{if(this[_0x867e('0x2e')](_0x3ea31b)){if(_0x3ea31b[_0x867e('0x31')]===_0x3ea31b[_0x867e('0x32')]){if(!_[_0x867e('0x2f')](this[_0x867e('0x15')][_0x3ea31b[_0x867e('0x31')]])){_[_0x867e('0x33')](this[_0x867e('0x15')][_0x3ea31b['uniqueid']],_[_0x867e('0x34')](_0x3ea31b,_['keys'](this[_0x867e('0x15')][_0x3ea31b[_0x867e('0x31')]])));}}}}catch(_0x4e6348){logger[_0x867e('0x35')](_0x867e('0x36'),util[_0x867e('0x37')](_0x4e6348,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x867e('0x38')]=function(_0x5e59a3){try{if(this['isNotNull'](_0x5e59a3)){if(_0x5e59a3[_0x867e('0x31')]===_0x5e59a3[_0x867e('0x32')]&&_0x5e59a3['channel']!=_0x867e('0x39')){if(_[_0x867e('0x2f')](this[_0x867e('0x15')][_0x5e59a3[_0x867e('0x31')]])){this[_0x867e('0x15')][_0x5e59a3[_0x867e('0x31')]]=new Channel();this[_0x867e('0x15')][_0x5e59a3[_0x867e('0x31')]][_0x867e('0x3a')]=moment()['format'](_0x867e('0x3b'));this[_0x867e('0x15')][_0x5e59a3['uniqueid']][_0x867e('0x3c')]=dispositions[_['toNumber'](_0x5e59a3[_0x867e('0x3d')])];_['merge'](this[_0x867e('0x15')][_0x5e59a3['uniqueid']],_[_0x867e('0x34')](_0x5e59a3,_[_0x867e('0x3e')](this['channels'][_0x5e59a3[_0x867e('0x31')]])));if(_0x5e59a3['context']===_0x867e('0x3f')){if(this[_0x867e('0x16')][_0x5e59a3[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]]){this[_0x867e('0x16')][_0x5e59a3[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]][_0x867e('0x42')]=_0x5e59a3[_0x867e('0x43')];this[_0x867e('0x30')](util[_0x867e('0x44')](_0x867e('0x45'),this[_0x867e('0x16')][_0x5e59a3[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]][_0x867e('0x46')]),_0x867e('0x47'),{'destaccountcode':this['agents'][_0x5e59a3['channel'][_0x867e('0x41')]('-')[0x0]][_0x867e('0x48')],'destconnectedlinenum':_0x5e59a3[_0x867e('0x43')]});}}}}}}catch(_0x8c084f){logger[_0x867e('0x35')](_0x867e('0x49'),util[_0x867e('0x37')](_0x8c084f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x18')]=function(_0x5839eb){try{if(this[_0x867e('0x2e')](_0x5839eb)){if(_0x5839eb[_0x867e('0x31')]===_0x5839eb['linkedid']&&_0x5839eb[_0x867e('0x43')]!='h'&&_0x5839eb[_0x867e('0x40')]!='OutgoingSpoolFailed'){_0x5839eb[_0x867e('0x4a')]=_0x5839eb['application'][_0x867e('0x4b')]();_0x5839eb[_0x867e('0x4c')]=(_0x5839eb[_0x867e('0x4d')]||_0x5839eb[_0x867e('0x4c')])[_0x867e('0x4b')]();if(_[_0x867e('0x2f')](this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]])){this['channels'][_0x5839eb['uniqueid']]=new Channel();this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]][_0x867e('0x3a')]=_0x5839eb['duration']?moment()['subtract'](moment[_0x867e('0x4e')](_0x5839eb['duration'])['seconds'](),'seconds')[_0x867e('0x44')](_0x867e('0x3b')):moment()[_0x867e('0x44')](_0x867e('0x3b'));this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]][_0x867e('0x3c')]=_0x867e('0x11');}_['merge'](this[_0x867e('0x15')][_0x5839eb['uniqueid']],_[_0x867e('0x34')](_0x5839eb,_[_0x867e('0x3e')](this['channels'][_0x5839eb[_0x867e('0x31')]])));if(_[_0x867e('0x4f')](applications,_0x5839eb[_0x867e('0x4a')])){this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]][_0x867e('0x50')]=_0x5839eb[_0x867e('0x4a')];this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]][_0x867e('0x51')]=_0x5839eb['applicationdata'];if(_0x5839eb[_0x867e('0x4a')]==='set'&&_[_0x867e('0x52')](_0x5839eb[_0x867e('0x4c')],_0x867e('0x53'))){var _0xee80ce=_0x5839eb[_0x867e('0x4c')]['split']('=');var _0x5bca70=_0xee80ce[0x0]['match'](/cdr\((.*)\)/);if(_0x5bca70){this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]][_0x5bca70[0x1]]=_0xee80ce[0x1];}}else if(_0x5839eb[_0x867e('0x4a')]===_0x867e('0x54')){this[_0x867e('0x15')][_0x5839eb[_0x867e('0x31')]]['queue']=_0x5839eb[_0x867e('0x4c')][_0x867e('0x41')](',')[0x0];}}}}}catch(_0x182fca){logger[_0x867e('0x35')](_0x867e('0x55'),util[_0x867e('0x37')](_0x182fca,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x867e('0x56')]=function(_0x46db1b){try{if(this['isNotNull'](_0x46db1b)){if(_0x46db1b[_0x867e('0x31')]!==_0x46db1b['linkedid']){if(this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]]){if(_0x46db1b[_0x867e('0x3d')]==='6'){if(!this['channels'][_0x46db1b[_0x867e('0x32')]][_0x867e('0x57')]){var _0x24dd77=moment();this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]][_0x867e('0x57')]=!![];this['channels'][_0x46db1b[_0x867e('0x32')]][_0x867e('0x58')]=_0x24dd77[_0x867e('0x44')](_0x867e('0x3b'));if(this['channels'][_0x46db1b[_0x867e('0x32')]][_0x867e('0x3a')]){this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]]['holdtime']=_0x24dd77[_0x867e('0x59')](this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]][_0x867e('0x3a')],_0x867e('0x5a'));}}this['channels'][_0x46db1b[_0x867e('0x32')]][_0x867e('0x32')]=_0x46db1b[_0x867e('0x31')];if(_0x46db1b[_0x867e('0x5b')]!==_0x867e('0x5c')){this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]]['connectedlinenum']=_0x46db1b[_0x867e('0x5b')];}this['channels'][_0x46db1b['linkedid']][_0x867e('0x5d')]=_0x46db1b[_0x867e('0x5e')];this[_0x867e('0x15')][_0x46db1b['linkedid']][_0x867e('0x5f')]=_0x46db1b[_0x867e('0x40')];this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]][_0x867e('0x3c')]=dispositions[_['toNumber'](_0x46db1b[_0x867e('0x3d')])];if(this['agents'][_0x46db1b[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]]){this[_0x867e('0x15')][_0x46db1b[_0x867e('0x32')]][_0x867e('0x60')]=this[_0x867e('0x16')][_0x46db1b[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]]['id'];this['channels'][_0x46db1b[_0x867e('0x32')]][_0x867e('0x61')]=this[_0x867e('0x16')][_0x46db1b[_0x867e('0x40')]['split']('-')[0x0]][_0x867e('0x46')];}}}}else{if(this[_0x867e('0x15')][_0x46db1b[_0x867e('0x31')]]){if(_0x46db1b[_0x867e('0x3d')]==='6'){if(this[_0x867e('0x16')][_0x46db1b[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]]){this[_0x867e('0x15')][_0x46db1b['uniqueid']][_0x867e('0x60')]=this['agents'][_0x46db1b['channel'][_0x867e('0x41')]('-')[0x0]]['id'];this[_0x867e('0x15')][_0x46db1b['uniqueid']][_0x867e('0x61')]=this[_0x867e('0x16')][_0x46db1b[_0x867e('0x40')][_0x867e('0x41')]('-')[0x0]][_0x867e('0x46')];}}}}}}catch(_0x98c408){logger[_0x867e('0x35')](_0x867e('0x62'),util[_0x867e('0x37')](_0x98c408,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x63')]=function(_0x239365,_0xb5c1da){if(this[_0x867e('0x15')][_0x239365]){this['channels'][_0x239365]['monitor']=!![];if(_['endsWith'](_0xb5c1da,_0x867e('0x64'))){_0xb5c1da=_0xb5c1da[_0x867e('0x65')](_0x867e('0x64'),_0x867e('0x66'));}this[_0x867e('0x15')][_0x239365][_0x867e('0x67')]=_0xb5c1da;var _0x19df13=_[_0x867e('0x68')](this[_0x867e('0x15')][_0x239365][_0x867e('0x69')],{'filename':_0xb5c1da});if(_[_0x867e('0x6a')](_0x19df13)){this['channels'][_0x239365][_0x867e('0x69')]['push']({'filename':_0xb5c1da,'createdAt':moment()[_0x867e('0x44')](_0x867e('0x3b')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x867e('0x2d')]['syncVarSet']=function(_0x5cc158){try{if(this['isNotNull'](_0x5cc158)){if(this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]]&&_0x5cc158[_0x867e('0x40')]!=_0x867e('0x39')){if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')])){if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x6c')])){this['syncMixMonitorFilename'](_0x5cc158[_0x867e('0x31')],_0x5cc158['value']);}else if(this['isNotNull'](_0x5cc158['variable'][_0x867e('0x6d')])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]]['calleridnum']=_0x5cc158['value'];}else if(this['isNotNull'](_0x5cc158['variable'][_0x867e('0x6e')])){this['channels'][_0x5cc158['uniqueid']][_0x867e('0x6f')]=_0x5cc158[_0x867e('0x70')];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x71')])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]][_0x867e('0x72')]=_0x5cc158[_0x867e('0x70')];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x73')])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]][_0x867e('0x54')]=_0x5cc158['value'][_0x867e('0x41')](',')[0x0];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')]['xmd-originatecalleridnum'])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]]['originatecalleridnum']=_0x5cc158['value'];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')]['xmd-destination'])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]][_0x867e('0x74')]=_0x5cc158['value'];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x75')])){this[_0x867e('0x15')][_0x5cc158['uniqueid']][_0x867e('0x76')]=_0x5cc158[_0x867e('0x70')];}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x77')])){this['channels'][_0x5cc158[_0x867e('0x31')]][_0x867e('0x54')]=_0x5cc158[_0x867e('0x70')];}else if(this['isNotNull'](_0x5cc158['variable'][_0x867e('0x78')])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x31')]]['sipcalluniqueid']=_0x5cc158['value'];}}}else if(this[_0x867e('0x2e')](_0x5cc158[_0x867e('0x6b')][_0x867e('0x6c')])){if(_0x5cc158[_0x867e('0x70')]){var _0x7bece3=path['parse'](_0x5cc158[_0x867e('0x70')])[_0x867e('0x46')];this[_0x867e('0x63')](_0x7bece3,_0x5cc158[_0x867e('0x70')]);}}else if(this[_0x867e('0x15')][_0x5cc158['linkedid']]){if(this['isNotNull'](_0x5cc158['variable'])){if(this[_0x867e('0x2e')](_0x5cc158['variable'][_0x867e('0x78')])){this[_0x867e('0x15')][_0x5cc158[_0x867e('0x32')]][_0x867e('0x79')]=_0x5cc158[_0x867e('0x70')];}}}}}catch(_0x5c5cd2){logger['error'](_0x867e('0x7a'),util[_0x867e('0x37')](_0x5c5cd2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x1f')]=function(_0x2473ac){try{if(this[_0x867e('0x2e')](_0x2473ac)){if(this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]]){var _0x227a26=moment();this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]]['endtime']=_0x227a26[_0x867e('0x44')](_0x867e('0x3b'));this['channels'][_0x2473ac[_0x867e('0x31')]][_0x867e('0x4e')]=_0x227a26[_0x867e('0x59')](this['channels'][_0x2473ac[_0x867e('0x31')]][_0x867e('0x3a')],'seconds');if(this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]][_0x867e('0x57')]){this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]][_0x867e('0x7b')]=_0x227a26['diff'](this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]][_0x867e('0x58')],_0x867e('0x5a'));this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]][_0x867e('0x7c')]=this[_0x867e('0x15')][_0x2473ac[_0x867e('0x31')]][_0x867e('0x4e')]-this['channels'][_0x2473ac[_0x867e('0x31')]][_0x867e('0x7b')];}if(_0x2473ac['context']===_0x867e('0x3f')){if(this[_0x867e('0x16')][_0x2473ac[_0x867e('0x40')]['split']('-')[0x0]]){this['agents'][_0x2473ac['channel'][_0x867e('0x41')]('-')[0x0]]=_[_0x867e('0x7d')](this['agents'][_0x2473ac[_0x867e('0x40')]['split']('-')[0x0]],[_0x867e('0x42')]);this[_0x867e('0x30')](util[_0x867e('0x44')](_0x867e('0x45'),this[_0x867e('0x16')][_0x2473ac[_0x867e('0x40')]['split']('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0x867e('0x16')][_0x2473ac[_0x867e('0x40')]['split']('-')[0x0]][_0x867e('0x48')]});}}ami[_0x867e('0x30')]('custom:voiceCallReport',this[_0x867e('0x15')][_0x2473ac['uniqueid']]);delete this['channels'][_0x2473ac['uniqueid']];}}}catch(_0x854e79){logger[_0x867e('0x35')](_0x867e('0x7e'),util['inspect'](_0x854e79,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x867e('0x22')]=function(_0x48fe4a){try{if(this[_0x867e('0x2e')](_0x48fe4a)){if(this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x7f')]]){this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x7f')]][_0x867e('0x80')]=_0x48fe4a[_0x867e('0x81')];this['channels'][_0x48fe4a['transfereeuniqueid']]['transferconnectedlinenum']=_0x48fe4a[_0x867e('0x82')];if(this[_0x867e('0x15')][_0x48fe4a['secondtransfereruniqueid']]){var _0x4339d5=this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x83')]];this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x83')]]=this['channels'][_0x48fe4a[_0x867e('0x7f')]];this['channels'][_0x48fe4a[_0x867e('0x7f')]]=_0x4339d5;}}else if(this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x84')]]){this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x84')]][_0x867e('0x80')]=_0x48fe4a[_0x867e('0x81')];this['channels'][_0x48fe4a[_0x867e('0x84')]][_0x867e('0x85')]=_0x48fe4a[_0x867e('0x82')];if(this['channels'][_0x48fe4a[_0x867e('0x86')]]){var _0x4339d5=this['channels'][_0x48fe4a['origtransfereruniqueid']];this['channels'][_0x48fe4a[_0x867e('0x86')]]=this['channels'][_0x48fe4a['transfertargetuniqueid']];this[_0x867e('0x15')][_0x48fe4a[_0x867e('0x84')]]=_0x4339d5;}}}}catch(_0x28ab2e){logger['error'](_0x867e('0x87'),util['inspect'](_0x28ab2e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')][_0x867e('0x24')]=function(_0x11c445){try{if(this[_0x867e('0x2e')](_0x11c445)){if(this['channels'][_0x11c445[_0x867e('0x7f')]]){this[_0x867e('0x15')][_0x11c445[_0x867e('0x7f')]][_0x867e('0x80')]=_0x11c445['transfereecalleridnum'];this['channels'][_0x11c445['transfereeuniqueid']]['transferconnectedlinenum']=_0x11c445[_0x867e('0x88')];this[_0x867e('0x1f')]({'event':_0x867e('0x89'),'uniqueid':_0x11c445['transfereeuniqueid'],'context':_0x11c445[_0x867e('0x8a')],'channel':_0x11c445[_0x867e('0x8b')]});}}}catch(_0x2d6e1f){logger['error'](_0x867e('0x8c'),util[_0x867e('0x37')](_0x2d6e1f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')]['syncMusicOnHoldStart']=function(_0x42bbda){try{if(this[_0x867e('0x2e')](_0x42bbda)){if(this[_0x867e('0x15')][_0x42bbda[_0x867e('0x31')]]){if(!_[_0x867e('0x6a')](this['channels'][_0x42bbda[_0x867e('0x31')]]['answertime'])){this['channels'][_0x42bbda['uniqueid']][_0x867e('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x507b4a){logger[_0x867e('0x35')](_0x867e('0x8e'),util['inspect'](_0x507b4a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x867e('0x2d')]['syncMusicOnHoldStop']=function(_0x4b3090){try{if(this[_0x867e('0x2e')](_0x4b3090)){if(this[_0x867e('0x15')][_0x4b3090[_0x867e('0x31')]]){if(!_[_0x867e('0x6a')](this[_0x867e('0x15')][_0x4b3090[_0x867e('0x31')]][_0x867e('0x8d')])){this[_0x867e('0x15')][_0x4b3090[_0x867e('0x31')]][_0x867e('0x8f')]+=moment()[_0x867e('0x90')](0x0)[_0x867e('0x59')](this[_0x867e('0x15')][_0x4b3090[_0x867e('0x31')]][_0x867e('0x8d')],_0x867e('0x5a'));delete this['channels'][_0x4b3090[_0x867e('0x31')]][_0x867e('0x8d')];}}}}catch(_0x32e9b5){logger[_0x867e('0x35')](_0x867e('0x91'),util['inspect'](_0x32e9b5,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index e570a79..abab95c 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 _0x0cc2=['syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','duration','seconds','complete','answered','holdtime','diff','starttime','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','lodash','moment','ioredis','ami','redis','defaults','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncVarSet','hangup','isNotNull','prototype','emit','channels','uniqueid','merge','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect'];(function(_0x116927,_0x315e84){var _0x393752=function(_0x16aaa1){while(--_0x16aaa1){_0x116927['push'](_0x116927['shift']());}};_0x393752(++_0x315e84);}(_0x0cc2,0x87));var _0x20cc=function(_0x441590,_0x37ed5e){_0x441590=_0x441590-0x0;var _0x307a0f=_0x0cc2[_0x441590];return _0x307a0f;};'use strict';var _=require(_0x20cc('0x0'));var moment=require(_0x20cc('0x1'));var util=require('util');var Redis=require(_0x20cc('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x20cc('0x3'));var ami=require('../ami');config[_0x20cc('0x4')]=_[_0x20cc('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x42479c){this['channels']=_0x42479c[_0x20cc('0x6')];this['outbound']=_0x42479c[_0x20cc('0x7')];this[_0x20cc('0x8')]={};ami['on'](_0x20cc('0x9'),this[_0x20cc('0xa')][_0x20cc('0xb')](this));ami['on']('dialend',this['syncDialEnd'][_0x20cc('0xb')](this));ami['on']('varset',this[_0x20cc('0xc')]['bind'](this));ami['on'](_0x20cc('0xd'),this['syncHangup'][_0x20cc('0xb')](this));}VoiceDialReport['prototype'][_0x20cc('0xe')]=function(_0x3e4dd){return _0x3e4dd!==null&&!_['isUndefined'](_0x3e4dd);};VoiceDialReport[_0x20cc('0xf')][_0x20cc('0x10')]=function(_0x174aeb,_0x19e3de,_0x1b33c7){io['to'](_0x174aeb)['emit'](_0x19e3de,_0x1b33c7);};VoiceDialReport['prototype'][_0x20cc('0xa')]=function(_0x1c6714){try{if(this[_0x20cc('0xe')](_0x1c6714)){if(this[_0x20cc('0x11')][_0x1c6714[_0x20cc('0x12')]]){_[_0x20cc('0x13')](this['channels'][_0x1c6714[_0x20cc('0x12')]],{'starttime':moment()[_0x20cc('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x20cc('0x15'),'interface':_0x1c6714[_0x20cc('0x16')][_0x20cc('0x17')](0x0,_0x1c6714[_0x20cc('0x16')][_0x20cc('0x18')]('-')),'membername':_0x1c6714['channel']['substring'](_0x1c6714[_0x20cc('0x16')][_0x20cc('0x18')]('/')+0x1,_0x1c6714['channel']['lastIndexOf']('-'))},_[_0x20cc('0x19')](_0x1c6714,[_0x20cc('0x1a'),_0x20cc('0x1b')]));this[_0x20cc('0x10')](_0x20cc('0x1c'),'voice_outbound_channel:save',this[_0x20cc('0x11')][_0x1c6714[_0x20cc('0x12')]]);ami[_0x20cc('0x10')](_0x20cc('0x1d'),this[_0x20cc('0x11')][_0x1c6714[_0x20cc('0x12')]]);}}}catch(_0x583d1f){logger[_0x20cc('0x1e')](_0x20cc('0x1f'),util[_0x20cc('0x20')](_0x583d1f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x20cc('0xf')][_0x20cc('0x21')]=function(_0x1861ba){try{if(this[_0x20cc('0xe')](_0x1861ba)){if(this['channels'][_0x1861ba[_0x20cc('0x12')]]){this['channels'][_0x1861ba['uniqueid']]['dialstatus']=_0x1861ba[_0x20cc('0x22')];if(_0x1861ba[_0x20cc('0x22')]===_0x20cc('0x23')){this[_0x20cc('0x11')][_0x1861ba[_0x20cc('0x12')]][_0x20cc('0x24')]=_0x1861ba['connectedlinenum'];this[_0x20cc('0x11')][_0x1861ba[_0x20cc('0x12')]][_0x20cc('0x25')]=_0x1861ba[_0x20cc('0x25')];this['channels'][_0x1861ba[_0x20cc('0x12')]][_0x20cc('0x26')]=moment()['format'](_0x20cc('0x27'));this['channels'][_0x1861ba[_0x20cc('0x12')]][_0x20cc('0x28')]=_0x20cc('0x29');ami[_0x20cc('0x10')]('custom:dialconnect',this[_0x20cc('0x11')][_0x1861ba[_0x20cc('0x12')]]);}this['emit']('voice:outbound',_0x20cc('0x2a'),this[_0x20cc('0x11')][_0x1861ba['uniqueid']]);}}}catch(_0x5252b2){logger[_0x20cc('0x1e')](_0x20cc('0x2b'),util['inspect'](_0x5252b2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x20cc('0xf')][_0x20cc('0xc')]=function(_0x430a41){try{if(this['isNotNull'](_0x430a41)){this[_0x20cc('0x2c')](_0x430a41[_0x20cc('0x12')],_[_0x20cc('0x2d')](_0x430a41[_0x20cc('0x2e')])[0x0],_0x430a41[_0x20cc('0x2f')]);if(this[_0x20cc('0xe')](_0x430a41['variable'])&&this[_0x20cc('0xe')](_0x430a41[_0x20cc('0x2e')][_0x20cc('0x30')])){if(_[_0x20cc('0x31')](this[_0x20cc('0x11')][_0x430a41[_0x20cc('0x12')]])){this[_0x20cc('0x11')][_0x430a41[_0x20cc('0x12')]]={'routeId':_0x430a41['value'],'variables':this[_0x20cc('0x8')][_0x430a41[_0x20cc('0x12')]]};this[_0x20cc('0x10')](_0x20cc('0x1c'),_0x20cc('0x2a'),this['channels'][_0x430a41[_0x20cc('0x12')]]);}}}}catch(_0x377dbc){logger['error'](_0x20cc('0x32'),util[_0x20cc('0x20')](_0x377dbc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x20cc('0xf')]['addVariable']=function(_0x46d439,_0xf95e6d,_0x30abc2){var _0x2ff8ec=[_0x20cc('0x33'),_0x20cc('0x34'),_0x20cc('0x35'),_0x20cc('0x36'),'rtpaudioqosloss',_0x20cc('0x37'),_0x20cc('0x38'),'rtpaudioqosrttbridged',_0x20cc('0x39'),'sipuri','bridgepeer',_0x20cc('0x3a'),_0x20cc('0x3b'),_0x20cc('0x3c'),_0x20cc('0x3d'),_0x20cc('0x3e'),_0x20cc('0x3f'),_0x20cc('0x40'),_0x20cc('0x41')];if(!_[_0x20cc('0x42')](_0xf95e6d)&&!_[_0x20cc('0x43')](_0x2ff8ec,_0xf95e6d)){if(_['isUndefined'](this[_0x20cc('0x8')][_0x46d439])){this[_0x20cc('0x8')][_0x46d439]={};}this[_0x20cc('0x8')][_0x46d439][_0xf95e6d]=_0x30abc2;}};VoiceDialReport['prototype'][_0x20cc('0x44')]=function(_0x2b8994){try{if(this[_0x20cc('0xe')](_0x2b8994)){if(this[_0x20cc('0x11')][_0x2b8994['uniqueid']]){this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]['endtime']=moment()[_0x20cc('0x14')](_0x20cc('0x27'));this[_0x20cc('0x11')][_0x2b8994['uniqueid']][_0x20cc('0x45')]=moment(this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]['endtime'])['diff'](this[_0x20cc('0x11')][_0x2b8994['uniqueid']]['starttime'],_0x20cc('0x46'));this[_0x20cc('0x11')][_0x2b8994['uniqueid']][_0x20cc('0x28')]=_0x20cc('0x47');this['outbound']['total']+=0x1;if(this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x26')]){this[_0x20cc('0x7')][_0x20cc('0x48')]+=0x1;this[_0x20cc('0x11')][_0x2b8994['uniqueid']][_0x20cc('0x49')]=moment(this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x26')])[_0x20cc('0x4a')](this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x4b')],_0x20cc('0x46'));this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x4c')]=moment(this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]['endtime'])['diff'](this['channels'][_0x2b8994[_0x20cc('0x12')]]['answertime'],_0x20cc('0x46'));this['outbound']['sumHoldTime']+=this['channels'][_0x2b8994['uniqueid']][_0x20cc('0x49')]||0x0;this[_0x20cc('0x7')][_0x20cc('0x4d')]+=this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x4c')];}this[_0x20cc('0x7')][_0x20cc('0x4e')]+=this['channels'][_0x2b8994[_0x20cc('0x12')]][_0x20cc('0x45')];ami[_0x20cc('0x10')](_0x20cc('0x4f'),this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]);ami[_0x20cc('0x10')](_0x20cc('0x50'),this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]);this[_0x20cc('0x10')](_0x20cc('0x1c'),'voice_outbound:save',this[_0x20cc('0x7')]);logger[_0x20cc('0x51')](_0x20cc('0x52'),JSON[_0x20cc('0x53')](this[_0x20cc('0x11')][_0x2b8994['uniqueid']]));this[_0x20cc('0x10')]('voice:outbound','voice_outbound_channel:remove',this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]]);delete this[_0x20cc('0x11')][_0x2b8994[_0x20cc('0x12')]];}if(this[_0x20cc('0x8')][_0x2b8994[_0x20cc('0x12')]]){delete this[_0x20cc('0x8')][_0x2b8994['uniqueid']];}}}catch(_0x174967){logger[_0x20cc('0x1e')]('[syncHangup][VoiceDialReport]',util[_0x20cc('0x20')](_0x174967,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xfb0b=['sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','util','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','privilege','voice_outbound_channel:save','channels','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt'];(function(_0x2ce1cb,_0x2a4ca0){var _0x3465de=function(_0x518da8){while(--_0x518da8){_0x2ce1cb['push'](_0x2ce1cb['shift']());}};_0x3465de(++_0x2a4ca0);}(_0xfb0b,0x1d8));var _0xbfb0=function(_0x516ff3,_0x2fbaec){_0x516ff3=_0x516ff3-0x0;var _0x44361e=_0xfb0b[_0x516ff3];return _0x44361e;};'use strict';var _=require(_0xbfb0('0x0'));var moment=require('moment');var util=require(_0xbfb0('0x1'));var Redis=require('ioredis');var config=require(_0xbfb0('0x2'));var logger=require(_0xbfb0('0x3'))('ami');var ami=require(_0xbfb0('0x4'));config[_0xbfb0('0x5')]=_['defaults'](config[_0xbfb0('0x5')],{'host':_0xbfb0('0x6'),'port':0x18eb});var io=require(_0xbfb0('0x7'))(new Redis(config[_0xbfb0('0x5')]));function VoiceDialReport(_0x224c2a){this['channels']=_0x224c2a[_0xbfb0('0x8')];this['outbound']=_0x224c2a[_0xbfb0('0x9')];this[_0xbfb0('0xa')]={};ami['on'](_0xbfb0('0xb'),this[_0xbfb0('0xc')][_0xbfb0('0xd')](this));ami['on']('dialend',this[_0xbfb0('0xe')][_0xbfb0('0xd')](this));ami['on']('varset',this[_0xbfb0('0xf')][_0xbfb0('0xd')](this));ami['on'](_0xbfb0('0x10'),this[_0xbfb0('0x11')][_0xbfb0('0xd')](this));}VoiceDialReport[_0xbfb0('0x12')]['isNotNull']=function(_0x5a369e){return _0x5a369e!==null&&!_[_0xbfb0('0x13')](_0x5a369e);};VoiceDialReport['prototype'][_0xbfb0('0x14')]=function(_0x41cbf1,_0x7fd5cf,_0x4ea122){io['to'](_0x41cbf1)[_0xbfb0('0x14')](_0x7fd5cf,_0x4ea122);};VoiceDialReport[_0xbfb0('0x12')][_0xbfb0('0xc')]=function(_0x362a41){try{if(this['isNotNull'](_0x362a41)){if(this['channels'][_0x362a41[_0xbfb0('0x15')]]){_[_0xbfb0('0x16')](this['channels'][_0x362a41[_0xbfb0('0x15')]],{'starttime':moment()[_0xbfb0('0x17')](_0xbfb0('0x18')),'lastevent':'called','interface':_0x362a41[_0xbfb0('0x19')][_0xbfb0('0x1a')](0x0,_0x362a41[_0xbfb0('0x19')][_0xbfb0('0x1b')]('-')),'membername':_0x362a41[_0xbfb0('0x19')][_0xbfb0('0x1a')](_0x362a41[_0xbfb0('0x19')][_0xbfb0('0x1b')]('/')+0x1,_0x362a41[_0xbfb0('0x19')][_0xbfb0('0x1b')]('-'))},_['omit'](_0x362a41,['event',_0xbfb0('0x1c')]));this['emit']('voice:outbound',_0xbfb0('0x1d'),this[_0xbfb0('0x1e')][_0x362a41[_0xbfb0('0x15')]]);ami['emit'](_0xbfb0('0x1f'),this[_0xbfb0('0x1e')][_0x362a41[_0xbfb0('0x15')]]);}}}catch(_0x22175c){logger[_0xbfb0('0x20')](_0xbfb0('0x21'),util[_0xbfb0('0x22')](_0x22175c,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbfb0('0xe')]=function(_0x21116c){try{if(this[_0xbfb0('0x23')](_0x21116c)){if(this[_0xbfb0('0x1e')][_0x21116c[_0xbfb0('0x15')]]){this[_0xbfb0('0x1e')][_0x21116c['uniqueid']][_0xbfb0('0x24')]=_0x21116c[_0xbfb0('0x24')];if(_0x21116c[_0xbfb0('0x24')]===_0xbfb0('0x25')){this[_0xbfb0('0x1e')][_0x21116c[_0xbfb0('0x15')]][_0xbfb0('0x26')]=_0x21116c[_0xbfb0('0x26')];this[_0xbfb0('0x1e')][_0x21116c['uniqueid']][_0xbfb0('0x27')]=_0x21116c[_0xbfb0('0x27')];this[_0xbfb0('0x1e')][_0x21116c['uniqueid']][_0xbfb0('0x28')]=moment()[_0xbfb0('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x21116c[_0xbfb0('0x15')]][_0xbfb0('0x29')]=_0xbfb0('0x2a');ami[_0xbfb0('0x14')](_0xbfb0('0x2b'),this[_0xbfb0('0x1e')][_0x21116c[_0xbfb0('0x15')]]);}this[_0xbfb0('0x14')](_0xbfb0('0x2c'),_0xbfb0('0x1d'),this['channels'][_0x21116c[_0xbfb0('0x15')]]);}}}catch(_0x2a8f6f){logger['error'](_0xbfb0('0x2d'),util['inspect'](_0x2a8f6f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbfb0('0xf')]=function(_0x2300f9){try{if(this[_0xbfb0('0x23')](_0x2300f9)){this[_0xbfb0('0x2e')](_0x2300f9['uniqueid'],_[_0xbfb0('0x2f')](_0x2300f9[_0xbfb0('0x30')])[0x0],_0x2300f9[_0xbfb0('0x31')]);if(this['isNotNull'](_0x2300f9['variable'])&&this[_0xbfb0('0x23')](_0x2300f9[_0xbfb0('0x30')]['outboundrouteid'])){if(_[_0xbfb0('0x13')](this[_0xbfb0('0x1e')][_0x2300f9['uniqueid']])){this[_0xbfb0('0x1e')][_0x2300f9['uniqueid']]={'routeId':_0x2300f9['value'],'variables':this[_0xbfb0('0xa')][_0x2300f9[_0xbfb0('0x15')]]};this[_0xbfb0('0x14')]('voice:outbound',_0xbfb0('0x1d'),this['channels'][_0x2300f9[_0xbfb0('0x15')]]);}}}}catch(_0x2eae7d){logger[_0xbfb0('0x20')]('[syncVarSet][VoiceDialReport]',util[_0xbfb0('0x22')](_0x2eae7d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbfb0('0x12')]['addVariable']=function(_0x56f7d1,_0x4f7d55,_0x19a72b){var _0x2a8b18=[_0xbfb0('0x32'),_0xbfb0('0x33'),_0xbfb0('0x34'),_0xbfb0('0x35'),_0xbfb0('0x36'),'rtpaudioqoslossbridged',_0xbfb0('0x37'),'rtpaudioqosrttbridged',_0xbfb0('0x38'),_0xbfb0('0x39'),_0xbfb0('0x3a'),_0xbfb0('0x3b'),_0xbfb0('0x3c'),_0xbfb0('0x3d'),'memberinterface',_0xbfb0('0x3e'),_0xbfb0('0x3f'),_0xbfb0('0x40'),_0xbfb0('0x41')];if(!_['isNil'](_0x4f7d55)&&!_[_0xbfb0('0x42')](_0x2a8b18,_0x4f7d55)){if(_[_0xbfb0('0x13')](this['variables'][_0x56f7d1])){this[_0xbfb0('0xa')][_0x56f7d1]={};}this[_0xbfb0('0xa')][_0x56f7d1][_0x4f7d55]=_0x19a72b;}};VoiceDialReport['prototype']['syncHangup']=function(_0x4c4f37){try{if(this[_0xbfb0('0x23')](_0x4c4f37)){if(this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]]){this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x43')]=moment()[_0xbfb0('0x17')](_0xbfb0('0x18'));this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x44')]=moment(this['channels'][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x43')])[_0xbfb0('0x45')](this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x46')],_0xbfb0('0x47'));this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x29')]=_0xbfb0('0x48');this[_0xbfb0('0x9')][_0xbfb0('0x49')]+=0x1;if(this[_0xbfb0('0x1e')][_0x4c4f37['uniqueid']]['answertime']){this[_0xbfb0('0x9')][_0xbfb0('0x4a')]+=0x1;this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x4b')]=moment(this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x28')])[_0xbfb0('0x45')](this['channels'][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x46')],_0xbfb0('0x47'));this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x4c')]=moment(this['channels'][_0x4c4f37['uniqueid']][_0xbfb0('0x43')])[_0xbfb0('0x45')](this['channels'][_0x4c4f37[_0xbfb0('0x15')]]['answertime'],'seconds');this['outbound'][_0xbfb0('0x4d')]+=this['channels'][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x4b')]||0x0;this['outbound']['sumBillable']+=this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x4c')];}this[_0xbfb0('0x9')][_0xbfb0('0x4e')]+=this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]][_0xbfb0('0x44')];ami[_0xbfb0('0x14')](_0xbfb0('0x4f'),this['channels'][_0x4c4f37[_0xbfb0('0x15')]]);ami[_0xbfb0('0x14')](_0xbfb0('0x50'),this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]]);this[_0xbfb0('0x14')](_0xbfb0('0x2c'),_0xbfb0('0x51'),this[_0xbfb0('0x9')]);logger[_0xbfb0('0x52')](_0xbfb0('0x53'),JSON[_0xbfb0('0x54')](this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]]));this[_0xbfb0('0x14')](_0xbfb0('0x2c'),_0xbfb0('0x55'),this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]]);delete this[_0xbfb0('0x1e')][_0x4c4f37[_0xbfb0('0x15')]];}if(this['variables'][_0x4c4f37['uniqueid']]){delete this[_0xbfb0('0xa')][_0x4c4f37[_0xbfb0('0x15')]];}}}catch(_0x3a530e){logger['error'](_0xbfb0('0x56'),util[_0xbfb0('0x22')](_0x3a530e,{'showHidden':![],'depth':null}));}};module[_0xbfb0('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index bbd9026..6d811c3 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 _0xc8d9=['connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','local/','seconds','transfertype','transferexten','destexten','transferuniqueid','linkedid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','variable','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerleaveAt','value','queueposition','EXITWITHKEY','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','syncHangup','unmanaged','length','milliseconds','diff','queuecallercompleteAt','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','syncBlindTransfer','BLIND','BlindTransfer','transfererchannel','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','answered','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','Trunk','active','callerid','Interval','md5','voice_queue:save','isNotNull','loopQueueSummary','[queuesummary]','queue','countBy','callers','toNumber','available','loggedIn','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','syncQueueCallerLeave','last'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xc8d9,0x11c));var _0x9c8d=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xc8d9[_0x5235a6];return _0x1cf37e;};'use strict';var _=require(_0x9c8d('0x0'));var moment=require(_0x9c8d('0x1'));var BPromise=require(_0x9c8d('0x2'));var util=require(_0x9c8d('0x3'));var md5=require('md5');var Redis=require(_0x9c8d('0x4'));var config=require(_0x9c8d('0x5'));var logger=require(_0x9c8d('0x6'))('ami');var ami=require(_0x9c8d('0x7'));var QueueReport=require(_0x9c8d('0x8'));config[_0x9c8d('0x9')]=_[_0x9c8d('0xa')](config[_0x9c8d('0x9')],{'host':_0x9c8d('0xb'),'port':0x18eb});var io=require(_0x9c8d('0xc'))(new Redis(config[_0x9c8d('0x9')]));var Sequence=function(){};Sequence[_0x9c8d('0xd')][_0x9c8d('0xe')]=function(_0x5c2353){this['tail']=this['tail']?this[_0x9c8d('0xf')]['finally'](_0x5c2353):_0x5c2353();};function VoiceQueueReport(_0x494c34){this[_0x9c8d('0x10')]=new Sequence();this[_0x9c8d('0x11')]={};this[_0x9c8d('0x12')]=_0x494c34[_0x9c8d('0x12')];this[_0x9c8d('0x13')]=_0x494c34[_0x9c8d('0x14')];this[_0x9c8d('0x15')]=_0x494c34[_0x9c8d('0x15')];this[_0x9c8d('0x16')]=!![];this[_0x9c8d('0x17')]=_0x494c34[_0x9c8d('0x17')];this[_0x9c8d('0x18')]={};ami['on'](_0x9c8d('0x19'),this[_0x9c8d('0x1a')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x1c'),this[_0x9c8d('0x1d')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x1e'),this[_0x9c8d('0x1f')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x20'),this[_0x9c8d('0x21')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x22'),this['syncQueueCallerLeave']['bind'](this));ami['on'](_0x9c8d('0x23'),this[_0x9c8d('0x24')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x25'),this[_0x9c8d('0x26')]['bind'](this));ami['on'](_0x9c8d('0x27'),this[_0x9c8d('0x28')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x29'),this['syncHangup']['bind'](this));ami['on'](_0x9c8d('0x2a'),this['syncFullyBooted'][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x2b'),this[_0x9c8d('0x2c')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x2d'),this[_0x9c8d('0x2e')][_0x9c8d('0x1b')](this));ami['on'](_0x9c8d('0x2f'),this[_0x9c8d('0x30')][_0x9c8d('0x1b')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x9c8d('0x1b')](this));this['loopQueueSummary']();this[_0x9c8d('0x31')]();}function isNotNull(_0x4aab8e){return _0x4aab8e!==null&&!_[_0x9c8d('0x32')](_0x4aab8e);}function clearChannels(_0x3c3046){if(!_[_0x9c8d('0x33')](_0x3c3046)){for(var _0x14229b in _0x3c3046){if(_0x3c3046[_0x9c8d('0x34')](_0x14229b)){delete _0x3c3046[_0x14229b];}}}}function clearCampaigns(_0x432cc0){if(!_[_0x9c8d('0x33')](_0x432cc0)){for(var _0x4a03a8 in _0x432cc0){if(_0x432cc0['hasOwnProperty'](_0x4a03a8)){_0x432cc0[_0x4a03a8][_0x9c8d('0x35')]=0x0;}}}}function clearVoiceQueues(_0x638ca8){if(!_[_0x9c8d('0x33')](_0x638ca8)){for(var _0x19f5cd in _0x638ca8){if(_0x638ca8[_0x9c8d('0x34')](_0x19f5cd)){_0x638ca8[_0x19f5cd][_0x9c8d('0x35')]=0x0;_0x638ca8[_0x19f5cd]['talking']=0x0;_0x638ca8[_0x19f5cd][_0x9c8d('0x36')]=0x0;_0x638ca8[_0x19f5cd]['waiting']=0x0;_0x638ca8[_0x19f5cd][_0x9c8d('0x37')]=!![];}}}}function clearAgentBooked(_0x588ac0){if(!_[_0x9c8d('0x33')](_0x588ac0)){for(var _0x4b3b79 in _0x588ac0){if(_0x588ac0['hasOwnProperty'](_0x4b3b79)){_0x588ac0[_0x4b3b79][_0x9c8d('0x38')]=!![];}}}}VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x39')]=function(){var _0x4f39b6=this;for(var _0x884261 in this[_0x9c8d('0x13')]){if(this[_0x9c8d('0x13')][_0x9c8d('0x34')](_0x884261)&&!this['channels'][_0x884261][_0x9c8d('0x3a')]){this['sequence']['enqueue'](function(){if(!_[_0x9c8d('0x3b')](_0x4f39b6[_0x9c8d('0x13')][_0x884261])){return ami[_0x9c8d('0x3c')]({'action':_0x9c8d('0x3d'),'channel':_0x4f39b6['channels'][_0x884261][_0x9c8d('0x3e')]})[_0x9c8d('0x3f')](function(_0x190900){if(_0x190900['message']===_0x9c8d('0x40')){setTimeout(function(){if(_0x4f39b6[_0x9c8d('0x13')][_0x884261]){delete _0x4f39b6[_0x9c8d('0x13')][_0x884261];logger[_0x9c8d('0x41')]('[voiceQueueReport][checkChannel]',_0x884261);}if(_0x4f39b6['queueReports'][_0x884261]){delete _0x4f39b6[_0x9c8d('0x11')][_0x884261];logger[_0x9c8d('0x41')](_0x9c8d('0x42'),_0x884261);}if(_0x4f39b6['variables'][_0x884261]){delete _0x4f39b6[_0x9c8d('0x18')][_0x884261];logger['error'](_0x9c8d('0x43'),_0x884261);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x9c8d('0x44')]=function(){logger[_0x9c8d('0x41')](_0x9c8d('0x45'));clearChannels(this[_0x9c8d('0x13')]);this[_0x9c8d('0x46')](this['queueReports']);clearAgentBooked(this[_0x9c8d('0x12')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x46')]=function(_0x277bb3){var _0x26bb82=this;if(!_[_0x9c8d('0x33')](_0x277bb3)){for(var _0x3b8b05 in _0x277bb3){if(_0x277bb3[_0x9c8d('0x34')](_0x3b8b05)){_0x26bb82[_0x9c8d('0x47')](_0x277bb3[_0x3b8b05]);delete _0x277bb3[_0x3b8b05];}}}};function loggerCatch(_0xf51644){return function(_0x6cb203){logger[_0x9c8d('0x41')](_0xf51644,util[_0x9c8d('0x48')](_0x6cb203,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x49')]=function(_0x5d5fc4,_0x2e856d,_0x11f8c5){io['to'](_0x5d5fc4)[_0x9c8d('0x49')](_0x2e856d,_0x11f8c5);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x4a')]=function(_0x4af236){this['emit'](util['format'](_0x9c8d('0x4b'),_0x4af236[_0x9c8d('0x4c')]),_0x9c8d('0x4d'),_0x4af236);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x47')]=function(_0x5b6b8f){logger[_0x9c8d('0x4e')](_0x9c8d('0x4f'),JSON[_0x9c8d('0x50')](_0x5b6b8f));this[_0x9c8d('0x49')](util[_0x9c8d('0x51')](_0x9c8d('0x4b'),_0x5b6b8f[_0x9c8d('0x4c')]),_0x9c8d('0x52'),_0x5b6b8f);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x53')]=function(_0x1508c7){if(_0x1508c7[_0x9c8d('0x54')]===_0x9c8d('0x55')){var _0x5a0571={'id':_0x1508c7['id'],'name':_0x1508c7[_0x9c8d('0x4c')],'strategy':_0x1508c7['strategy'],'answered':_0x1508c7[_0x9c8d('0x56')],'available':_0x1508c7['available'],'loggedIn':_0x1508c7['loggedIn'],'pTalking':_0x1508c7[_0x9c8d('0x36')],'sumBillable':_0x1508c7[_0x9c8d('0x57')],'sumDuration':_0x1508c7[_0x9c8d('0x58')],'sumHoldTime':_0x1508c7[_0x9c8d('0x59')]||0x0,'talking':_0x1508c7[_0x9c8d('0x5a')],'total':_0x1508c7[_0x9c8d('0x5b')],'type':_0x1508c7['type'],'unmanaged':_0x1508c7['unmanaged'],'abandoned':_0x1508c7[_0x9c8d('0x5c')],'waiting':_0x1508c7[_0x9c8d('0x5d')]};if(_0x1508c7[_0x9c8d('0x5e')]){_0x5a0571[_0x9c8d('0x5e')]={'id':_0x1508c7['Trunk']['id'],'name':_0x1508c7['Trunk'][_0x9c8d('0x4c')],'active':_0x1508c7[_0x9c8d('0x5e')][_0x9c8d('0x5f')],'callerid':_0x1508c7[_0x9c8d('0x5e')][_0x9c8d('0x60')]};}if(_0x1508c7[_0x9c8d('0x61')]){_0x5a0571[_0x9c8d('0x61')]={'id':_0x1508c7['Interval']['id'],'name':_0x1508c7[_0x9c8d('0x61')]['name']};}var _0x55b2d8=md5(JSON[_0x9c8d('0x50')](_0x5a0571));if(_0x1508c7['md5']!==_0x55b2d8){_0x1508c7[_0x9c8d('0x62')]=_0x55b2d8;this['emit'](util['format'](_0x9c8d('0x4b'),_0x5a0571[_0x9c8d('0x4c')]),_0x9c8d('0x63'),_0x5a0571);}}};VoiceQueueReport['prototype'][_0x9c8d('0x64')]=function(_0x21f6d3){return _0x21f6d3!==null&&!_[_0x9c8d('0x32')](_0x21f6d3);};VoiceQueueReport['prototype'][_0x9c8d('0x31')]=function(){var _0x1fc38d=this;setInterval(function(){_0x1fc38d[_0x9c8d('0x39')]();ami[_0x9c8d('0x3c')]({'action':'queues'})['catch'](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x65')]=function(){var _0x9879eb=this;setInterval(function(){if(_0x9879eb[_0x9c8d('0x16')]){return ami[_0x9c8d('0x3c')]({'action':_0x9c8d('0x19')})['then'](function(_0x59baf6){_0x9879eb[_0x9c8d('0x16')]=![];})[_0x9c8d('0x3f')](loggerCatch(_0x9c8d('0x66')));}},0x3e8);};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x1a')]=function(_0x6ed51b){try{if(this[_0x9c8d('0x64')](_0x6ed51b)&&this[_0x9c8d('0x64')](_0x6ed51b[_0x9c8d('0x67')])){if(this['voiceQueues'][_0x6ed51b[_0x9c8d('0x67')]]){var _0x3c4295=_[_0x9c8d('0x68')](this[_0x9c8d('0x13')],'queue')[_0x6ed51b[_0x9c8d('0x67')]]||0x0;var _0x22100e=_0x3c4295-_0x6ed51b[_0x9c8d('0x69')];if(this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]]['waiting']!==_['toNumber'](_0x6ed51b[_0x9c8d('0x69')])||this['voiceQueues'][_0x6ed51b[_0x9c8d('0x67')]]['loggedIn']!==_[_0x9c8d('0x6a')](_0x6ed51b['loggedin'])||this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]]['available']!==_[_0x9c8d('0x6a')](_0x6ed51b[_0x9c8d('0x6b')])||this['voiceQueues'][_0x6ed51b['queue']][_0x9c8d('0x5a')]!==_0x22100e){this['voiceQueues'][_0x6ed51b['queue']][_0x9c8d('0x5d')]=_[_0x9c8d('0x6a')](_0x6ed51b[_0x9c8d('0x69')]);this['voiceQueues'][_0x6ed51b[_0x9c8d('0x67')]][_0x9c8d('0x6c')]=_[_0x9c8d('0x6a')](_0x6ed51b[_0x9c8d('0x6d')]);this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]][_0x9c8d('0x6b')]=_[_0x9c8d('0x6a')](_0x6ed51b['available']);this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]]['talking']=_0x22100e>0x0?_0x22100e:0x0;this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]][_0x9c8d('0x5a')]=this['voiceQueues'][_0x6ed51b['queue']][_0x9c8d('0x5a')]>_[_0x9c8d('0x6a')](_0x6ed51b['loggedin'])?_[_0x9c8d('0x6a')](_0x6ed51b[_0x9c8d('0x6d')]):this[_0x9c8d('0x15')][_0x6ed51b[_0x9c8d('0x67')]][_0x9c8d('0x5a')];this['emitVoiceQueueSummary'](this[_0x9c8d('0x15')][_0x6ed51b['queue']]);}ami[_0x9c8d('0x49')](_0x9c8d('0x6e'),this['voiceQueues'][_0x6ed51b[_0x9c8d('0x67')]]);}}}catch(_0x34dcca){logger['error'](_0x9c8d('0x6f'),util[_0x9c8d('0x48')](_0x34dcca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x1d')]=function(_0x2d7c6d){this[_0x9c8d('0x16')]=!![];};VoiceQueueReport[_0x9c8d('0xd')]['syncNewExten']=function(_0x59f2e4){};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x1f')]=function(_0x37201b){try{if(this['isNotNull'](_0x37201b)){if(_[_0x9c8d('0x32')](this['queueReports'][_0x37201b[_0x9c8d('0x70')]])){this[_0x9c8d('0x11')][_0x37201b[_0x9c8d('0x70')]]=[];this[_0x9c8d('0x13')][_0x37201b['uniqueid']]={};}var _0x2b03d9=new QueueReport();_0x2b03d9[_0x9c8d('0x4c')]=_0x37201b[_0x9c8d('0x67')];_0x2b03d9[_0x9c8d('0x54')]=this[_0x9c8d('0x15')][_0x2b03d9['name']]&&this[_0x9c8d('0x15')][_0x2b03d9[_0x9c8d('0x4c')]][_0x9c8d('0x54')]?this[_0x9c8d('0x15')][_0x2b03d9[_0x9c8d('0x4c')]]['type']||_0x9c8d('0x55'):_0x9c8d('0x55');_0x2b03d9[_0x9c8d('0x67')]=_0x37201b[_0x9c8d('0x67')];_0x2b03d9[_0x9c8d('0x71')]=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x2b03d9['position']=_0x37201b[_0x9c8d('0x73')];_0x2b03d9[_0x9c8d('0x74')]=_0x37201b[_0x9c8d('0x74')];_[_0x9c8d('0x75')](_0x2b03d9,_['pick'](_0x37201b,_[_0x9c8d('0x76')](_0x2b03d9)));this[_0x9c8d('0x11')][_0x37201b[_0x9c8d('0x70')]][_0x9c8d('0x77')](_0x2b03d9);this[_0x9c8d('0x13')][_0x37201b[_0x9c8d('0x70')]]=_0x2b03d9;this[_0x9c8d('0x4a')](_0x2b03d9);}}catch(_0x4a4beb){logger[_0x9c8d('0x41')](_0x9c8d('0x78'),util[_0x9c8d('0x48')](_0x4a4beb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x21')]=function(_0x1af8a2){try{if(this['isNotNull'](_0x1af8a2)){if(this[_0x9c8d('0x11')][_0x1af8a2['uniqueid']]){var _0x33c607=_['last'](this[_0x9c8d('0x11')][_0x1af8a2[_0x9c8d('0x70')]]);_0x33c607[_0x9c8d('0x79')]=![];_0x33c607['queuecallercompleteAt']=null;_0x33c607[_0x9c8d('0x7a')]=_0x1af8a2[_0x9c8d('0x7a')];_0x33c607[_0x9c8d('0x7b')]=_0x1af8a2['originalposition'];_0x33c607[_0x9c8d('0x20')]=!![];_0x33c607[_0x9c8d('0x7c')]=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x33c607['queuecallerexitreason']=_0x9c8d('0x7d');_0x33c607[_0x9c8d('0x7e')]=null;this[_0x9c8d('0x13')][_0x1af8a2[_0x9c8d('0x70')]]=_0x33c607;this['emitVoiceQueueChannelRemove'](_0x33c607);}}}catch(_0xb8e895){logger[_0x9c8d('0x41')](_0x9c8d('0x7f'),util[_0x9c8d('0x48')](_0xb8e895,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x80')]=function(_0x24b18d){try{if(this[_0x9c8d('0x64')](_0x24b18d)){if(this[_0x9c8d('0x11')][_0x24b18d[_0x9c8d('0x70')]]){var _0x58837b=_[_0x9c8d('0x81')](this[_0x9c8d('0x11')][_0x24b18d[_0x9c8d('0x70')]]);_0x58837b['queuecallerleaveAt']=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x58837b['connectedlinenum']=_0x24b18d[_0x9c8d('0x82')];_0x58837b[_0x9c8d('0x83')]=_0x24b18d['connectedlinename'];this[_0x9c8d('0x13')][_0x24b18d[_0x9c8d('0x70')]]=_0x58837b;this[_0x9c8d('0x4a')](_0x58837b);}}}catch(_0x1de432){logger['error'](_0x9c8d('0x84'),util[_0x9c8d('0x48')](_0x1de432,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x26')]=function(_0x2fce9d){try{if(this[_0x9c8d('0x64')](_0x2fce9d)){if(this[_0x9c8d('0x11')][_0x2fce9d[_0x9c8d('0x70')]]){var _0x543808=_[_0x9c8d('0x81')](this[_0x9c8d('0x11')][_0x2fce9d[_0x9c8d('0x70')]]);_0x543808[_0x9c8d('0x79')]=!![];_0x543808[_0x9c8d('0x85')]=_0x9c8d('0x86');}}}catch(_0x5932f4){logger[_0x9c8d('0x41')](_0x9c8d('0x87'),util[_0x9c8d('0x48')](_0x5932f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c8d('0x24')]=function(_0x5580a2){try{if(this[_0x9c8d('0x64')](_0x5580a2)){if(this[_0x9c8d('0x11')][_0x5580a2[_0x9c8d('0x70')]]){var _0x139ab5=_['last'](this['queueReports'][_0x5580a2['uniqueid']]);_0x139ab5['queuecallerabandon']=![];_0x139ab5['queuecallerabandonAt']=null;_0x139ab5[_0x9c8d('0x88')]=!![];_0x139ab5[_0x9c8d('0x7e')]=_0x5580a2['membername'];_0x139ab5[_0x9c8d('0x7a')]=_0x5580a2[_0x9c8d('0x7a')];_0x139ab5[_0x9c8d('0x79')]=!![];_0x139ab5[_0x9c8d('0x89')]=![];_0x139ab5[_0x9c8d('0x8a')]=null;if(!_0x139ab5[_0x9c8d('0x8b')]){if(_0x5580a2['reason']=='transfer'){_0x139ab5[_0x9c8d('0x85')]=_0x9c8d('0x8c');}else{if(_[_0x9c8d('0x8d')](_0x5580a2[_0x9c8d('0x3e')][_0x9c8d('0x8e')](),_0x9c8d('0x8f'))){if(this[_0x9c8d('0x11')][_0x5580a2['linkedid']]){var _0x2330ee=_[_0x9c8d('0x81')](this[_0x9c8d('0x11')][_0x5580a2['linkedid']]);_0x2330ee['queuecallercomplete']=![];_0x2330ee[_0x9c8d('0x89')]=!![];_0x2330ee['queuecallerexitAt']=moment(_0x139ab5[_0x9c8d('0x71')])['add'](_0x5580a2[_0x9c8d('0x7a')],_0x9c8d('0x90'))[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x2330ee[_0x9c8d('0x85')]='FORWARDTRANSFER';_0x2330ee[_0x9c8d('0x8b')]=!![];_0x2330ee[_0x9c8d('0x91')]='FORWARD';_0x2330ee[_0x9c8d('0x92')]=_0x5580a2[_0x9c8d('0x93')];_0x2330ee[_0x9c8d('0x94')]=_0x5580a2[_0x9c8d('0x70')];var _0x1a17ac=this[_0x9c8d('0x11')][_0x5580a2[_0x9c8d('0x95')]];this[_0x9c8d('0x11')][_0x5580a2[_0x9c8d('0x95')]]=this['queueReports'][_0x5580a2[_0x9c8d('0x70')]];this[_0x9c8d('0x11')][_0x5580a2[_0x9c8d('0x70')]]=_0x1a17ac;}}else{_0x139ab5[_0x9c8d('0x85')]=_0x9c8d('0x96')+_0x5580a2['reason'][_0x9c8d('0x97')]();}}}this[_0x9c8d('0x13')][_0x5580a2[_0x9c8d('0x70')]]=_0x139ab5;this[_0x9c8d('0x47')](_0x139ab5);}}}catch(_0x3ef383){logger[_0x9c8d('0x41')](_0x9c8d('0x98'),util[_0x9c8d('0x48')](_0x3ef383,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0x28')]=function(_0x58c003){try{if(this['isNotNull'](_0x58c003)){this['addVariable'](_0x58c003[_0x9c8d('0x70')],_[_0x9c8d('0x76')](_0x58c003['variable'])[0x0],_0x58c003['value']);if(this[_0x9c8d('0x11')][_0x58c003[_0x9c8d('0x70')]]){var _0x30ca09=_[_0x9c8d('0x81')](this['queueReports'][_0x58c003[_0x9c8d('0x70')]]);if(_0x30ca09){if(this[_0x9c8d('0x64')](_0x58c003[_0x9c8d('0x99')])&&this[_0x9c8d('0x64')](_0x58c003[_0x9c8d('0x99')]['queuestatus'])){switch(_0x58c003['value']){case'CONTINUE':_0x30ca09['queuecallerexit']=![];_0x30ca09[_0x9c8d('0x8a')]=null;break;case _0x9c8d('0x9a'):_0x30ca09[_0x9c8d('0x9b')]=_0x9c8d('0x9c');ami['emit'](_0x9c8d('0x9d'),_0x30ca09);break;default:_0x30ca09[_0x9c8d('0x89')]=!![];_0x30ca09[_0x9c8d('0x8a')]=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x30ca09[_0x9c8d('0x9e')]=moment()['format'](_0x9c8d('0x72'));}_0x30ca09[_0x9c8d('0x20')]=![];_0x30ca09[_0x9c8d('0x7c')]=null;_0x30ca09[_0x9c8d('0x85')]=_0x58c003[_0x9c8d('0x9f')];this[_0x9c8d('0x13')][_0x58c003[_0x9c8d('0x70')]]=_0x30ca09;this['emitVoiceQueueChannelRemove'](_0x30ca09);}else if(this[_0x9c8d('0x64')](_0x58c003['variable'])&&this[_0x9c8d('0x64')](_0x58c003['variable'][_0x9c8d('0xa0')])){if(!_0x30ca09[_0x9c8d('0x20')]){_0x30ca09['queuecallerexit']=!![];_0x30ca09[_0x9c8d('0x8a')]=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));_0x30ca09['queuecallerexitreason']=_0x9c8d('0xa1');_0x30ca09[_0x9c8d('0x9e')]=moment()[_0x9c8d('0x51')](_0x9c8d('0x72'));this[_0x9c8d('0x13')][_0x58c003[_0x9c8d('0x70')]]=_0x30ca09;}}_0x30ca09[_0x9c8d('0x18')]=this[_0x9c8d('0x18')][_0x58c003[_0x9c8d('0x70')]];}}}}catch(_0x1ee32c){logger[_0x9c8d('0x41')]('[syncVarSet][VoiceQueueReport]',util[_0x9c8d('0x48')](_0x1ee32c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0xa2')]=function(_0x17f6da,_0xd53b73,_0x2f6006){var _0xec2505=[_0x9c8d('0xa3'),_0x9c8d('0xa4'),_0x9c8d('0xa5'),_0x9c8d('0xa6'),_0x9c8d('0xa7'),'rtpaudioqoslossbridged',_0x9c8d('0xa8'),_0x9c8d('0xa9'),_0x9c8d('0xaa'),'sipuri',_0x9c8d('0xab'),_0x9c8d('0xac'),_0x9c8d('0xad'),_0x9c8d('0xae'),_0x9c8d('0xaf'),_0x9c8d('0xb0'),_0x9c8d('0xb1'),_0x9c8d('0xb2'),_0x9c8d('0xb3')];if(!_[_0x9c8d('0x3b')](_0xd53b73)&&!_[_0x9c8d('0xb4')](_0xec2505,_0xd53b73)){if(_[_0x9c8d('0x32')](this['variables'][_0x17f6da])){this['variables'][_0x17f6da]={};}this[_0x9c8d('0x18')][_0x17f6da][_0xd53b73]=_0x2f6006;}};VoiceQueueReport[_0x9c8d('0xd')][_0x9c8d('0xb5')]=function(_0xe4ba5c){try{if(this[_0x9c8d('0x64')](_0xe4ba5c)){if(this[_0x9c8d('0x11')][_0xe4ba5c[_0x9c8d('0x70')]]){for(var _0x48c9d2=0x0,_0x5696c8={};_0x48c9d20x0?_0x2c5316:0x0;this[_0x9c7f('0x14')][_0x2204c1[_0x9c7f('0x60')]][_0x9c7f('0x31')]=this[_0x9c7f('0x14')][_0x2204c1[_0x9c7f('0x60')]][_0x9c7f('0x31')]>_[_0x9c7f('0x62')](_0x2204c1[_0x9c7f('0x64')])?_['toNumber'](_0x2204c1[_0x9c7f('0x64')]):this[_0x9c7f('0x14')][_0x2204c1[_0x9c7f('0x60')]]['talking'];this['emitVoiceQueueSummary'](this[_0x9c7f('0x14')][_0x2204c1[_0x9c7f('0x60')]]);}ami[_0x9c7f('0x42')](_0x9c7f('0x65'),this['voiceQueues'][_0x2204c1[_0x9c7f('0x60')]]);}}}catch(_0x4a1271){logger[_0x9c7f('0x3b')]('[syncQueueSummary][VoiceQueueReport]',util[_0x9c7f('0x41')](_0x4a1271,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x74f0d2){this[_0x9c7f('0x15')]=!![];};VoiceQueueReport['prototype'][_0x9c7f('0x66')]=function(_0x91a916){};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0x67')]=function(_0x47800c){try{if(this[_0x9c7f('0x5a')](_0x47800c)){if(_[_0x9c7f('0x2d')](this[_0x9c7f('0x10')][_0x47800c['uniqueid']])){this[_0x9c7f('0x10')][_0x47800c[_0x9c7f('0x68')]]=[];this['channels'][_0x47800c[_0x9c7f('0x68')]]={};}var _0x296a2c=new QueueReport();_0x296a2c[_0x9c7f('0x45')]=_0x47800c[_0x9c7f('0x60')];_0x296a2c[_0x9c7f('0x4c')]=this[_0x9c7f('0x14')][_0x296a2c[_0x9c7f('0x45')]]&&this[_0x9c7f('0x14')][_0x296a2c[_0x9c7f('0x45')]]['type']?this['voiceQueues'][_0x296a2c['name']]['type']||_0x9c7f('0x4d'):_0x9c7f('0x4d');_0x296a2c[_0x9c7f('0x60')]=_0x47800c[_0x9c7f('0x60')];_0x296a2c[_0x9c7f('0x69')]=moment()[_0x9c7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x296a2c['position']=_0x47800c[_0x9c7f('0x6a')];_0x296a2c[_0x9c7f('0x6b')]=_0x47800c[_0x9c7f('0x6b')];_[_0x9c7f('0x6c')](_0x296a2c,_['pick'](_0x47800c,_['keys'](_0x296a2c)));this[_0x9c7f('0x10')][_0x47800c[_0x9c7f('0x68')]][_0x9c7f('0x6d')](_0x296a2c);this[_0x9c7f('0x12')][_0x47800c[_0x9c7f('0x68')]]=_0x296a2c;this[_0x9c7f('0x43')](_0x296a2c);}}catch(_0x2d7abe){logger[_0x9c7f('0x3b')](_0x9c7f('0x6e'),util['inspect'](_0x2d7abe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0x6f')]=function(_0x194674){try{if(this[_0x9c7f('0x5a')](_0x194674)){if(this['queueReports'][_0x194674['uniqueid']]){var _0x28c1eb=_[_0x9c7f('0x70')](this['queueReports'][_0x194674[_0x9c7f('0x68')]]);_0x28c1eb['queuecallercomplete']=![];_0x28c1eb[_0x9c7f('0x71')]=null;_0x28c1eb['holdtime']=_0x194674[_0x9c7f('0x72')];_0x28c1eb[_0x9c7f('0x73')]=_0x194674[_0x9c7f('0x73')];_0x28c1eb['queuecallerabandon']=!![];_0x28c1eb[_0x9c7f('0x74')]=moment()[_0x9c7f('0x4a')](_0x9c7f('0x75'));_0x28c1eb[_0x9c7f('0x76')]=_0x9c7f('0x77');_0x28c1eb[_0x9c7f('0x78')]=null;this[_0x9c7f('0x12')][_0x194674[_0x9c7f('0x68')]]=_0x28c1eb;this[_0x9c7f('0x40')](_0x28c1eb);}}}catch(_0x15db22){logger[_0x9c7f('0x3b')](_0x9c7f('0x79'),util[_0x9c7f('0x41')](_0x15db22,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0x20')]=function(_0x3e8139){try{if(this[_0x9c7f('0x5a')](_0x3e8139)){if(this['queueReports'][_0x3e8139[_0x9c7f('0x68')]]){var _0x3603d3=_[_0x9c7f('0x70')](this[_0x9c7f('0x10')][_0x3e8139['uniqueid']]);_0x3603d3[_0x9c7f('0x7a')]=moment()[_0x9c7f('0x4a')](_0x9c7f('0x75'));_0x3603d3['connectedlinenum']=_0x3e8139[_0x9c7f('0x7b')];_0x3603d3[_0x9c7f('0x7c')]=_0x3e8139['connectedlinename'];this[_0x9c7f('0x12')][_0x3e8139[_0x9c7f('0x68')]]=_0x3603d3;this[_0x9c7f('0x43')](_0x3603d3);}}}catch(_0x42ebb9){logger[_0x9c7f('0x3b')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x9c7f('0x41')](_0x42ebb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0x7d')]=function(_0x4730d6){try{if(this['isNotNull'](_0x4730d6)){if(this[_0x9c7f('0x10')][_0x4730d6[_0x9c7f('0x68')]]){var _0x1e7d23=_[_0x9c7f('0x70')](this[_0x9c7f('0x10')][_0x4730d6[_0x9c7f('0x68')]]);_0x1e7d23[_0x9c7f('0x7e')]=!![];_0x1e7d23[_0x9c7f('0x76')]='COMPLETEDBYAGENT';}}}catch(_0x20e5eb){logger[_0x9c7f('0x3b')]('[syncAgentConnect][VoiceQueueReport]',util[_0x9c7f('0x41')](_0x20e5eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c7f('0x21')]=function(_0xc6b4c5){try{if(this['isNotNull'](_0xc6b4c5)){if(this[_0x9c7f('0x10')][_0xc6b4c5[_0x9c7f('0x68')]]){var _0x14a35f=_[_0x9c7f('0x70')](this[_0x9c7f('0x10')][_0xc6b4c5[_0x9c7f('0x68')]]);_0x14a35f['queuecallerabandon']=![];_0x14a35f[_0x9c7f('0x74')]=null;_0x14a35f['assigned']=!![];_0x14a35f[_0x9c7f('0x78')]=_0xc6b4c5['membername'];_0x14a35f['holdtime']=_0xc6b4c5[_0x9c7f('0x72')];_0x14a35f[_0x9c7f('0x7e')]=!![];_0x14a35f['queuecallerexit']=![];_0x14a35f['queuecallerexitAt']=null;if(!_0x14a35f[_0x9c7f('0x7f')]){if(_0xc6b4c5[_0x9c7f('0x80')]==_0x9c7f('0x7f')){_0x14a35f['queuecallerexitreason']=_0x9c7f('0x81');}else{if(_[_0x9c7f('0x82')](_0xc6b4c5[_0x9c7f('0x38')]['toLowerCase'](),_0x9c7f('0x83'))){if(this[_0x9c7f('0x10')][_0xc6b4c5[_0x9c7f('0x84')]]){var _0x1c4ebe=_['last'](this[_0x9c7f('0x10')][_0xc6b4c5['linkedid']]);_0x1c4ebe[_0x9c7f('0x7e')]=![];_0x1c4ebe[_0x9c7f('0x85')]=!![];_0x1c4ebe[_0x9c7f('0x86')]=moment(_0x14a35f[_0x9c7f('0x69')])[_0x9c7f('0x87')](_0xc6b4c5[_0x9c7f('0x72')],_0x9c7f('0x88'))[_0x9c7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c4ebe[_0x9c7f('0x76')]=_0x9c7f('0x89');_0x1c4ebe[_0x9c7f('0x7f')]=!![];_0x1c4ebe['transfertype']=_0x9c7f('0x8a');_0x1c4ebe[_0x9c7f('0x8b')]=_0xc6b4c5[_0x9c7f('0x8c')];_0x1c4ebe['transferuniqueid']=_0xc6b4c5['uniqueid'];var _0x14977a=this[_0x9c7f('0x10')][_0xc6b4c5[_0x9c7f('0x84')]];this[_0x9c7f('0x10')][_0xc6b4c5['linkedid']]=this[_0x9c7f('0x10')][_0xc6b4c5[_0x9c7f('0x68')]];this[_0x9c7f('0x10')][_0xc6b4c5['uniqueid']]=_0x14977a;}}else{_0x14a35f[_0x9c7f('0x76')]=_0x9c7f('0x8d')+_0xc6b4c5[_0x9c7f('0x80')][_0x9c7f('0x8e')]();}}}this[_0x9c7f('0x12')][_0xc6b4c5[_0x9c7f('0x68')]]=_0x14a35f;this[_0x9c7f('0x40')](_0x14a35f);}}}catch(_0x31da19){logger[_0x9c7f('0x3b')]('[syncAgentComplete][VoiceQueueReport]',util[_0x9c7f('0x41')](_0x31da19,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9c7f('0x24')]=function(_0x52062d){try{if(this['isNotNull'](_0x52062d)){this[_0x9c7f('0x8f')](_0x52062d[_0x9c7f('0x68')],_[_0x9c7f('0x90')](_0x52062d[_0x9c7f('0x91')])[0x0],_0x52062d[_0x9c7f('0x92')]);if(this['queueReports'][_0x52062d['uniqueid']]){var _0x39b067=_['last'](this[_0x9c7f('0x10')][_0x52062d[_0x9c7f('0x68')]]);if(_0x39b067){if(this['isNotNull'](_0x52062d[_0x9c7f('0x91')])&&this[_0x9c7f('0x5a')](_0x52062d[_0x9c7f('0x91')][_0x9c7f('0x93')])){switch(_0x52062d[_0x9c7f('0x92')]){case'CONTINUE':_0x39b067['queuecallerexit']=![];_0x39b067[_0x9c7f('0x86')]=null;break;case _0x9c7f('0x94'):_0x39b067[_0x9c7f('0x95')]=_0x9c7f('0x96');ami[_0x9c7f('0x42')](_0x9c7f('0x97'),_0x39b067);break;default:_0x39b067[_0x9c7f('0x85')]=!![];_0x39b067[_0x9c7f('0x86')]=moment()[_0x9c7f('0x4a')](_0x9c7f('0x75'));_0x39b067[_0x9c7f('0x7a')]=moment()['format'](_0x9c7f('0x75'));}_0x39b067[_0x9c7f('0x1e')]=![];_0x39b067[_0x9c7f('0x74')]=null;_0x39b067['queuecallerexitreason']=_0x52062d[_0x9c7f('0x92')];this[_0x9c7f('0x12')][_0x52062d[_0x9c7f('0x68')]]=_0x39b067;this[_0x9c7f('0x40')](_0x39b067);}else if(this[_0x9c7f('0x5a')](_0x52062d[_0x9c7f('0x91')])&&this[_0x9c7f('0x5a')](_0x52062d[_0x9c7f('0x91')][_0x9c7f('0x98')])){if(!_0x39b067['queuecallerabandon']){_0x39b067['queuecallerexit']=!![];_0x39b067[_0x9c7f('0x86')]=moment()[_0x9c7f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x39b067['queuecallerexitreason']=_0x9c7f('0x99');_0x39b067[_0x9c7f('0x7a')]=moment()[_0x9c7f('0x4a')](_0x9c7f('0x75'));this[_0x9c7f('0x12')][_0x52062d['uniqueid']]=_0x39b067;}}_0x39b067[_0x9c7f('0x17')]=this[_0x9c7f('0x17')][_0x52062d['uniqueid']];}}}}catch(_0x25581f){logger[_0x9c7f('0x3b')](_0x9c7f('0x9a'),util[_0x9c7f('0x41')](_0x25581f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0x8f')]=function(_0x9411e9,_0x5a5e61,_0x190fbd){var _0x1bed8d=[_0x9c7f('0x9b'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x9c7f('0x9c'),_0x9c7f('0x9d'),_0x9c7f('0x9e'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x9c7f('0x9f'),_0x9c7f('0xa0'),_0x9c7f('0xa1'),_0x9c7f('0xa2'),'membercalls',_0x9c7f('0xa3'),_0x9c7f('0xa4'),_0x9c7f('0xa5'),_0x9c7f('0xa6'),'memberpenalty',_0x9c7f('0xa7')];if(!_['isNil'](_0x5a5e61)&&!_['includes'](_0x1bed8d,_0x5a5e61)){if(_[_0x9c7f('0x2d')](this[_0x9c7f('0x17')][_0x9411e9])){this[_0x9c7f('0x17')][_0x9411e9]={};}this['variables'][_0x9411e9][_0x5a5e61]=_0x190fbd;}};VoiceQueueReport[_0x9c7f('0xb')][_0x9c7f('0xa8')]=function(_0x86135c){try{if(this[_0x9c7f('0x5a')](_0x86135c)){if(this['queueReports'][_0x86135c[_0x9c7f('0x68')]]){for(var _0x197068=0x0,_0x26dc7f={};_0x197068=0x0?moment(_0x1ad19e[_0x134e('0x18')])[_0x134e('0xe')](_0x1ad19e[_0x134e('0x19')],'seconds'):null,'data1':_0x134e('0x1a'),'data2':_0x1ad19e['accountcode'],'data3':_0x1ad19e['exten'],'data4':_0x1ad19e[_0x134e('0x1b')]||null,'role':_0x134e('0x12'),'internal':_0x1ad19e[_0x134e('0x14')]?_[_0x134e('0x13')](_0x1ad19e[_0x134e('0x14')]):undefined,'uniqueid':_0x1ad19e[_0x134e('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xba6f=['CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','exten','queue','agent','uniqueid','membername','starttime','endtime','outbound','accountcode','dialstring','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallerexitAt','Request'];(function(_0x178b4e,_0x3810c2){var _0x176a81=function(_0x490fc4){while(--_0x490fc4){_0x178b4e['push'](_0x178b4e['shift']());}};_0x176a81(++_0x3810c2);}(_0xba6f,0x17f));var _0xfba6=function(_0x24d8db,_0x2392c6){_0x24d8db=_0x24d8db-0x0;var _0x13d20d=_0xba6f[_0x24d8db];return _0x13d20d;};'use strict';var moment=require(_0xfba6('0x0'));var _=require(_0xfba6('0x1'));var util=require(_0xfba6('0x2'));var client=require(_0xfba6('0x3'));exports[_0xfba6('0x4')]=function(_0x3b05da){var _0x18c5ad=_0x3b05da['queuecallercompleteAt']||_0x3b05da[_0xfba6('0x5')];return client[_0xfba6('0x6')](_0xfba6('0x7'),{'body':{'channel':_0xfba6('0x8'),'membername':_0x3b05da[_0xfba6('0x9')],'interface':_[_0xfba6('0xa')](_0x3b05da[_0xfba6('0xb')])?util[_0xfba6('0xc')](_0xfba6('0xd'),_0x3b05da[_0xfba6('0x9')]):_0x3b05da[_0xfba6('0xb')],'type':_0xfba6('0xe'),'enterAt':_0x3b05da['queuecallerleaveAt'],'exitAt':_0x18c5ad,'duration':moment(_0x18c5ad)[_0xfba6('0xf')](_0x3b05da[_0xfba6('0x10')],_0xfba6('0x11')),'data1':_0xfba6('0x12'),'data2':_0x3b05da['calleridnum'],'data3':_0x3b05da[_0xfba6('0x13')],'data4':null,'data5':_0x3b05da[_0xfba6('0x14')],'role':_0xfba6('0x15'),'internal':_0x3b05da['accountcode']?_['toNumber'](_0x3b05da['accountcode']):undefined,'uniqueid':_0x3b05da[_0xfba6('0x16')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x2aef70){return client[_0xfba6('0x6')]('CreateMemberReport',{'body':{'channel':_0xfba6('0x8'),'membername':_0x2aef70[_0xfba6('0x17')],'interface':_0x2aef70[_0xfba6('0xb')],'type':_0xfba6('0xe'),'enterAt':_0x2aef70[_0xfba6('0x18')],'exitAt':_0x2aef70[_0xfba6('0x19')],'duration':moment(_0x2aef70[_0xfba6('0x19')])['diff'](_0x2aef70[_0xfba6('0x18')],'seconds')>=0x0?moment(_0x2aef70[_0xfba6('0x19')])[_0xfba6('0xf')](_0x2aef70[_0xfba6('0x18')],_0xfba6('0x11')):null,'data1':_0xfba6('0x1a'),'data2':_0x2aef70[_0xfba6('0x1b')],'data3':_0x2aef70[_0xfba6('0x13')],'data4':_0x2aef70[_0xfba6('0x1c')]||null,'role':_0xfba6('0x15'),'internal':_0x2aef70[_0xfba6('0x1b')]?_[_0xfba6('0x1d')](_0x2aef70[_0xfba6('0x1b')]):undefined,'uniqueid':_0x2aef70[_0xfba6('0x16')]},'log':_0xfba6('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ee409ef..a807c5f 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 _0x9c2c=['../client','getTemplates','GetTemplate','html'];(function(_0x4d55a5,_0x19c663){var _0x32339c=function(_0x41c541){while(--_0x41c541){_0x4d55a5['push'](_0x4d55a5['shift']());}};_0x32339c(++_0x19c663);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(_0x4ac695){return function(_0x507004){return client['Request'](_0xc9c2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xc9c2('0x3')]},'log':_0xc9c2('0x2')});};}; \ No newline at end of file +var _0x5eb1=['getTemplates','Request','GetTemplate','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x5eb1[_0x2cdf41];return _0x39a70e;};'use strict';var client=require('../client');exports[_0x15eb('0x0')]=function(_0x18927a){return function(_0x231f58){return client[_0x15eb('0x1')](_0x15eb('0x2'),{'options':{'raw':!![],'attributes':['id',_0x15eb('0x3'),'html']},'log':_0x15eb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ce1712e..18316b9 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 _0x64f2=['data7','GetTrigger','../client','getTriggers','name','channel','status','AllConditions','field','operator','Condition','Actions','action','data1','data2','data3','data4','data5','data6'];(function(_0x4d270e,_0x409796){var _0x377f75=function(_0x276518){while(--_0x276518){_0x4d270e['push'](_0x4d270e['shift']());}};_0x377f75(++_0x409796);}(_0x64f2,0x1b7));var _0x264f=function(_0x4d7853,_0x1fbe99){_0x4d7853=_0x4d7853-0x0;var _0x2c910e=_0x64f2[_0x4d7853];return _0x2c910e;};'use strict';var client=require(_0x264f('0x0'));exports[_0x264f('0x1')]=function(_0x3b3819){return function(_0x12d87b){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x264f('0x2'),_0x264f('0x3'),_0x264f('0x4')],'include':[{'model':'Condition','as':_0x264f('0x5'),'attributes':['id',_0x264f('0x6'),_0x264f('0x7'),'value']},{'model':_0x264f('0x8'),'as':'AnyConditions','attributes':['id',_0x264f('0x6'),_0x264f('0x7'),'value']},{'model':'Action','as':_0x264f('0x9'),'attributes':['id',_0x264f('0xa'),_0x264f('0xb'),_0x264f('0xc'),_0x264f('0xd'),_0x264f('0xe'),_0x264f('0xf'),_0x264f('0x10'),_0x264f('0x11')]}]},'log':_0x264f('0x12')});};}; \ No newline at end of file +var _0xade3=['name','channel','status','Condition','field','value','AnyConditions','Action','Actions','action','data1','data2','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x49098f,_0x11c394){var _0x571686=function(_0x56a1bb){while(--_0x56a1bb){_0x49098f['push'](_0x49098f['shift']());}};_0x571686(++_0x11c394);}(_0xade3,0x1b1));var _0x3ade=function(_0x5d1514,_0x214044){_0x5d1514=_0x5d1514-0x0;var _0x1bc437=_0xade3[_0x5d1514];return _0x1bc437;};'use strict';var client=require(_0x3ade('0x0'));exports[_0x3ade('0x1')]=function(_0x24a45d){return function(_0x37d742){return client[_0x3ade('0x2')](_0x3ade('0x3'),{'options':{'raw':![],'attributes':['id',_0x3ade('0x4'),_0x3ade('0x5'),_0x3ade('0x6')],'include':[{'model':_0x3ade('0x7'),'as':'AllConditions','attributes':['id',_0x3ade('0x8'),'operator',_0x3ade('0x9')]},{'model':_0x3ade('0x7'),'as':_0x3ade('0xa'),'attributes':['id',_0x3ade('0x8'),'operator',_0x3ade('0x9')]},{'model':_0x3ade('0xb'),'as':_0x3ade('0xc'),'attributes':['id',_0x3ade('0xd'),_0x3ade('0xe'),_0x3ade('0xf'),'data3','data4',_0x3ade('0x10'),_0x3ade('0x11'),_0x3ade('0x12')]}]},'log':_0x3ade('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e5a54e7..cc00630 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 _0x56cc=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0x4af3ea,_0x3a2cde){var _0x28f9ae=function(_0x28f383){while(--_0x28f383){_0x4af3ea['push'](_0x4af3ea['shift']());}};_0x28f9ae(++_0x3a2cde);}(_0x56cc,0x1ee));var _0xc56c=function(_0x1bdbd1,_0x22340f){_0x1bdbd1=_0x1bdbd1-0x0;var _0x375a5d=_0x56cc[_0x1bdbd1];return _0x375a5d;};'use strict';var client=require(_0xc56c('0x0'));exports[_0xc56c('0x1')]=function(_0x3ec40c){return function(_0x5a4a8d){return client[_0xc56c('0x2')](_0xc56c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc56c('0x4'),_0xc56c('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x7f1e=['../client','getTrunks','Request','registry','GetTrunk'];(function(_0x3f6d3c,_0x3f57c4){var _0x3edd13=function(_0x5136a2){while(--_0x5136a2){_0x3f6d3c['push'](_0x3f6d3c['shift']());}};_0x3edd13(++_0x3f57c4);}(_0x7f1e,0xe6));var _0xe7f1=function(_0x3a55c6,_0x3138d2){_0x3a55c6=_0x3a55c6-0x0;var _0x5c69c1=_0x7f1e[_0x3a55c6];return _0x5c69c1;};'use strict';var client=require(_0xe7f1('0x0'));exports[_0xe7f1('0x1')]=function(_0x46b979){return function(_0x2df43a){return client[_0xe7f1('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xe7f1('0x3')]},'log':_0xe7f1('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 11ccc6e..1a6886e 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 _0xd9fc=['accountcode','internal','savePause','PauseUser','saveUnpause','getAgent','email','online','../client','getAgents','Request','GetUser','agent','name','fullname','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone'];(function(_0x368d9e,_0x49b238){var _0x38d52b=function(_0x2e2de5){while(--_0x2e2de5){_0x368d9e['push'](_0x368d9e['shift']());}};_0x38d52b(++_0x49b238);}(_0xd9fc,0x1eb));var _0xcd9f=function(_0x37f0c0,_0x3073d8){_0x37f0c0=_0x37f0c0-0x0;var _0x484f3a=_0xd9fc[_0x37f0c0];return _0x484f3a;};'use strict';var client=require(_0xcd9f('0x0'));exports[_0xcd9f('0x1')]=function(){return function(){return client[_0xcd9f('0x2')](_0xcd9f('0x3'),{'options':{'raw':![],'where':{'role':_0xcd9f('0x4')},'attributes':['id',_0xcd9f('0x5'),'email','accountcode',_0xcd9f('0x6'),'online',_0xcd9f('0x7'),'pauseType',_0xcd9f('0x8'),_0xcd9f('0x9'),_0xcd9f('0xa'),_0xcd9f('0xb'),_0xcd9f('0xc')]},'log':'getAgents'});};};exports[_0xcd9f('0xd')]=function(){return function(){return client['Request'](_0xcd9f('0x3'),{'options':{'raw':!![],'where':{'role':_0xcd9f('0xe')},'attributes':['id',_0xcd9f('0x5'),_0xcd9f('0xf'),_0xcd9f('0x10')]},'log':_0xcd9f('0xd')});};};exports[_0xcd9f('0x11')]=function(_0x18de2a,_0xde25a5,_0x482a1a){return client[_0xcd9f('0x2')](_0xcd9f('0x12'),{'body':{'type':_0xde25a5,'uniqueid':_0x482a1a},'options':{'where':{'id':_0x18de2a['id']}},'log':_0xcd9f('0x11')});};exports[_0xcd9f('0x13')]=function(_0x5e002f){return client[_0xcd9f('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5e002f['id']}},'log':'savePause'});};exports[_0xcd9f('0x14')]=function(_0x4d0785){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0xcd9f('0x4'),'id':_0x4d0785},'attributes':['id',_0xcd9f('0x5'),_0xcd9f('0x15'),_0xcd9f('0xf'),_0xcd9f('0x6'),_0xcd9f('0x16'),'lastLoginAt','pauseType',_0xcd9f('0x8'),_0xcd9f('0x9'),_0xcd9f('0xc')]},'log':'getAgent'});}; \ No newline at end of file +var _0xba83=['ShowUser','lastPauseAt','../client','getAgents','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','interface','Request','telephone','accountcode','savePause','saveUnpause','UnpauseUser'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0xba83,0x120));var _0x3ba8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xba83[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x3ba8('0x0'));exports[_0x3ba8('0x1')]=function(){return function(){return client['Request'](_0x3ba8('0x2'),{'options':{'raw':![],'where':{'role':_0x3ba8('0x3')},'attributes':['id',_0x3ba8('0x4'),_0x3ba8('0x5'),'accountcode',_0x3ba8('0x6'),_0x3ba8('0x7'),_0x3ba8('0x8'),_0x3ba8('0x9'),'lastPauseAt',_0x3ba8('0xa'),_0x3ba8('0xb'),_0x3ba8('0xc'),_0x3ba8('0xd')]},'log':_0x3ba8('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0x3ba8('0xe')](_0x3ba8('0x2'),{'options':{'raw':!![],'where':{'role':_0x3ba8('0xf')},'attributes':['id',_0x3ba8('0x4'),_0x3ba8('0x10'),'internal']},'log':'getTelephones'});};};exports[_0x3ba8('0x11')]=function(_0x379671,_0x2ecfc5,_0x2ce790){return client[_0x3ba8('0xe')]('PauseUser',{'body':{'type':_0x2ecfc5,'uniqueid':_0x2ce790},'options':{'where':{'id':_0x379671['id']}},'log':'savePause'});};exports[_0x3ba8('0x12')]=function(_0x5c575f){return client[_0x3ba8('0xe')](_0x3ba8('0x13'),{'body':{},'options':{'where':{'id':_0x5c575f['id']}},'log':'savePause'});};exports['getAgent']=function(_0x279a30){return client['Request'](_0x3ba8('0x14'),{'options':{'raw':![],'where':{'role':_0x3ba8('0x3'),'id':_0x279a30},'attributes':['id',_0x3ba8('0x4'),_0x3ba8('0x5'),_0x3ba8('0x10'),_0x3ba8('0x6'),_0x3ba8('0x7'),_0x3ba8('0x8'),_0x3ba8('0x9'),_0x3ba8('0x15'),_0x3ba8('0xa'),'interface']},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index dcc1b14..84e02ca 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 _0x8962=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x3d9050,_0x104589){var _0x3a344e=function(_0x38e924){while(--_0x38e924){_0x3d9050['push'](_0x3d9050['shift']());}};_0x3a344e(++_0x104589);}(_0x8962,0x1e2));var _0x2896=function(_0xf8980,_0x229d12){_0xf8980=_0xf8980-0x0;var _0x8630a2=_0x8962[_0xf8980];return _0x8630a2;};'use strict';var client=require('../client');exports[_0x2896('0x0')]=function(_0xf7a537){return client[_0x2896('0x1')](_0x2896('0x2'),{'body':_0xf7a537,'log':'CreateVoiceAgentReport'});};exports[_0x2896('0x3')]=function(_0x1e4d49,_0x44a4a6,_0x336693){return client[_0x2896('0x1')](_0x2896('0x4'),{'body':_0x1e4d49,'options':{'where':{'uniqueid':_0x44a4a6,'interface':_0x336693,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5c2e=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x8bf471,_0x2e9da0){var _0x3d93d7=function(_0x14b46f){while(--_0x14b46f){_0x8bf471['push'](_0x8bf471['shift']());}};_0x3d93d7(++_0x2e9da0);}(_0x5c2e,0x140));var _0xe5c2=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x5c2e[_0x4a6cf8];return _0x22205e;};'use strict';var client=require('../client');exports[_0xe5c2('0x0')]=function(_0x383823){return client[_0xe5c2('0x1')]('CreateVoiceAgentReport',{'body':_0x383823,'log':_0xe5c2('0x2')});};exports[_0xe5c2('0x3')]=function(_0x339e1e,_0x51ad35,_0x278b1b){return client[_0xe5c2('0x1')](_0xe5c2('0x4'),{'body':_0x339e1e,'options':{'where':{'uniqueid':_0x51ad35,'interface':_0x278b1b,'agentcomplete':!![]}},'log':_0xe5c2('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cf99ab7..bb42eba 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 _0xc0ee=['disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4e2560,_0x150f28){var _0x263411=function(_0x30a648){while(--_0x30a648){_0x4e2560['push'](_0x4e2560['shift']());}};_0x263411(++_0x150f28);}(_0xc0ee,0x1ea));var _0xec0e=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xc0ee[_0x541ea6];return _0x3c3e84;};'use strict';var moment=require('moment');var util=require(_0xec0e('0x0'));var _=require(_0xec0e('0x1'));var client=require(_0xec0e('0x2'));exports[_0xec0e('0x3')]=function(_0x56a8b4){return client['Request'](_0xec0e('0x4'),{'body':_[_0xec0e('0x5')](_0x56a8b4,{'source':_0x56a8b4[_0xec0e('0x6')],'destinationcontext':_0x56a8b4[_0xec0e('0x7')],'callerid':_0x56a8b4[_0xec0e('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xec0e('0x4')});};exports[_0xec0e('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xec0e('0xa')],'createdAt':{'$between':[moment()[_0xec0e('0xb')](_0xec0e('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xec0e('0xc'))['format'](_0xec0e('0xd'))]}},'attributes':['type',_0xec0e('0xe'),_0xec0e('0xf'),_0xec0e('0x10')]},'log':_0xec0e('0x11')});};}; \ No newline at end of file +var _0xfb75=['calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','Request','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb75,0x1d6));var _0x5fb7=function(_0x35966a,_0xe98fa6){_0x35966a=_0x35966a-0x0;var _0xf3a383=_0xfb75[_0x35966a];return _0xf3a383;};'use strict';var moment=require(_0x5fb7('0x0'));var util=require(_0x5fb7('0x1'));var _=require(_0x5fb7('0x2'));var client=require(_0x5fb7('0x3'));exports['create']=function(_0x77ca80){return client['Request']('CreateVoiceCallReport',{'body':_[_0x5fb7('0x4')](_0x77ca80,{'source':_0x77ca80[_0x5fb7('0x5')],'destinationcontext':_0x77ca80[_0x5fb7('0x6')],'callerid':_0x77ca80['callerid'],'amaflags':_0x5fb7('0x7')}),'log':_0x5fb7('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x5fb7('0x9')](_0x5fb7('0xa'),{'options':{'where':{'type':[_0x5fb7('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x5fb7('0xc'))['format'](_0x5fb7('0xd')),moment()[_0x5fb7('0xe')](_0x5fb7('0xc'))['format'](_0x5fb7('0xd'))]}},'attributes':[_0x5fb7('0xf'),'disposition',_0x5fb7('0x10'),_0x5fb7('0x11')]},'log':_0x5fb7('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 864c6fd..8c2de69 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 _0x9153=['Request','CreateVoiceDialReport','../client'];(function(_0x3ccc12,_0x58fc80){var _0x513086=function(_0x4155f6){while(--_0x4155f6){_0x3ccc12['push'](_0x3ccc12['shift']());}};_0x513086(++_0x58fc80);}(_0x9153,0x18e));var _0x3915=function(_0x1459ef,_0x1cff13){_0x1459ef=_0x1459ef-0x0;var _0x44543d=_0x9153[_0x1459ef];return _0x44543d;};'use strict';var client=require(_0x3915('0x0'));exports['create']=function(_0x241daa){return client[_0x3915('0x1')](_0x3915('0x2'),{'body':_0x241daa,'log':_0x3915('0x2')});}; \ No newline at end of file +var _0xf265=['create','Request','CreateVoiceDialReport'];(function(_0x1beed1,_0x166e72){var _0x248552=function(_0x555983){while(--_0x555983){_0x1beed1['push'](_0x1beed1['shift']());}};_0x248552(++_0x166e72);}(_0xf265,0x16b));var _0x5f26=function(_0x215775,_0x15bc76){_0x215775=_0x215775-0x0;var _0x2c189d=_0xf265[_0x215775];return _0x2c189d;};'use strict';var client=require('../client');exports[_0x5f26('0x0')]=function(_0x549236){return client[_0x5f26('0x1')](_0x5f26('0x2'),{'body':_0x549236,'log':_0x5f26('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2d6a8de..624c220 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 _0x6da1=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x6da1,0x1b8));var _0x16da=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x6da1[_0x4953da];return _0x2d3780;};'use strict';var client=require('../client');exports[_0x16da('0x0')]=function(){return function(){return client['Request'](_0x16da('0x1'),{'options':{'raw':!![],'attributes':['id',_0x16da('0x2'),_0x16da('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x30fe=['GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x363c85,_0x10a67e){var _0x462da0=function(_0x3a3a0a){while(--_0x3a3a0a){_0x363c85['push'](_0x363c85['shift']());}};_0x462da0(++_0x10a67e);}(_0x30fe,0x149));var _0xe30f=function(_0x19f2b3,_0x5590bc){_0x19f2b3=_0x19f2b3-0x0;var _0x29e0d6=_0x30fe[_0x19f2b3];return _0x29e0d6;};'use strict';var client=require('../client');exports[_0xe30f('0x0')]=function(){return function(){return client['Request'](_0xe30f('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0xe30f('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xe30f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3845774..2ad45df 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 _0x6fa7=['dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0x6fa7,0x130));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x76fa('0x0'));exports[_0x76fa('0x1')]=function(){return function(){return client[_0x76fa('0x2')](_0x76fa('0x3'),{'options':{'raw':![],'attributes':['id',_0x76fa('0x4'),_0x76fa('0x5'),_0x76fa('0x6'),_0x76fa('0x7'),_0x76fa('0x8'),_0x76fa('0x9'),_0x76fa('0xa'),_0x76fa('0xb'),_0x76fa('0xc'),_0x76fa('0xd'),_0x76fa('0xe'),'dialPredictiveOptimization',_0x76fa('0xf'),'dialPredictiveInterval',_0x76fa('0x10'),_0x76fa('0x11'),_0x76fa('0x12'),_0x76fa('0x13'),'dialQueueTimeout',_0x76fa('0x14'),_0x76fa('0x15'),_0x76fa('0x16'),_0x76fa('0x17'),_0x76fa('0x18'),_0x76fa('0x19'),_0x76fa('0x1a'),_0x76fa('0x1b'),'dialTimezone','dialGlobalInterval',_0x76fa('0x1c'),'dialCheckDuplicateType',_0x76fa('0x1d'),_0x76fa('0x1e'),_0x76fa('0x1f'),_0x76fa('0x20'),_0x76fa('0x21'),_0x76fa('0x22'),_0x76fa('0x23'),_0x76fa('0x24'),'dialAMDSilenceThreshold',_0x76fa('0x25'),_0x76fa('0x26'),'dialRecallMeTimeout','dialRecallInQueue',_0x76fa('0x27'),_0x76fa('0x28'),_0x76fa('0x29'),_0x76fa('0x2a'),_0x76fa('0x8'),_0x76fa('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x76fa('0x2c'),_0x76fa('0x2d'),'dialDropMaxRetry',_0x76fa('0x2e'),_0x76fa('0x2f'),_0x76fa('0x30'),_0x76fa('0x31'),_0x76fa('0x32'),_0x76fa('0x33'),_0x76fa('0x34'),_0x76fa('0x35'),_0x76fa('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x76fa('0x37'),'as':_0x76fa('0x37'),'attributes':['id',_0x76fa('0x4'),_0x76fa('0x38'),_0x76fa('0x39')]},{'model':_0x76fa('0x3a'),'as':_0x76fa('0x3b'),'attributes':['id',_0x76fa('0x4')]},{'model':_0x76fa('0x37'),'as':_0x76fa('0x3c'),'attributes':['id',_0x76fa('0x4'),'callerid',_0x76fa('0x39')]},{'model':'Interval','as':_0x76fa('0x3d'),'attributes':['id',_0x76fa('0x4')],'include':[{'model':_0x76fa('0x3d'),'as':'Intervals','attributes':['id','name',_0x76fa('0x3e')]}]}]},'log':_0x76fa('0x1')});};}; \ No newline at end of file +var _0x1673=['dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency'];(function(_0x50dd2d,_0x2ed7d5){var _0x7b56fc=function(_0x48ce66){while(--_0x48ce66){_0x50dd2d['push'](_0x50dd2d['shift']());}};_0x7b56fc(++_0x2ed7d5);}(_0x1673,0x13e));var _0x3167=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1673[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3167('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x3167('0x1'),{'options':{'raw':![],'attributes':['id',_0x3167('0x2'),_0x3167('0x3'),_0x3167('0x4'),_0x3167('0x5'),'monitor_format',_0x3167('0x6'),_0x3167('0x7'),'dialMethod',_0x3167('0x8'),_0x3167('0x9'),_0x3167('0xa'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x3167('0xb'),_0x3167('0xc'),'dialQueueTimeout',_0x3167('0xd'),'dialCongestionMaxRetry',_0x3167('0xe'),_0x3167('0xf'),_0x3167('0x10'),'dialNoAnswerMaxRetry',_0x3167('0x11'),'dialGlobalMaxRetry',_0x3167('0x12'),'dialGlobalInterval',_0x3167('0x13'),_0x3167('0x14'),'dialAMDActive',_0x3167('0x15'),_0x3167('0x16'),'dialAMDAfterGreetingSilence',_0x3167('0x17'),_0x3167('0x18'),'dialAMDBetweenWordsSilence',_0x3167('0x19'),_0x3167('0x1a'),_0x3167('0x1b'),_0x3167('0x1c'),_0x3167('0x1d'),_0x3167('0x1e'),_0x3167('0x1f'),'dialAgiAfterHangupAgent',_0x3167('0x20'),_0x3167('0x21'),_0x3167('0x22'),_0x3167('0x23'),_0x3167('0x24'),_0x3167('0x25'),_0x3167('0x26'),_0x3167('0x27'),'dialDropMaxRetry',_0x3167('0x28'),_0x3167('0x29'),_0x3167('0x2a'),_0x3167('0x2b'),'dialMachineRetryFrequency',_0x3167('0x2c'),_0x3167('0x2d'),_0x3167('0x2e'),_0x3167('0x2f'),_0x3167('0x30')],'include':[{'model':_0x3167('0x31'),'as':_0x3167('0x31'),'attributes':['id',_0x3167('0x2'),_0x3167('0x32'),_0x3167('0x33')]},{'model':_0x3167('0x34'),'as':_0x3167('0x35'),'attributes':['id',_0x3167('0x2')]},{'model':_0x3167('0x31'),'as':'TrunkBackup','attributes':['id','name',_0x3167('0x32'),_0x3167('0x33')]},{'model':_0x3167('0x36'),'as':'Interval','attributes':['id',_0x3167('0x2')],'include':[{'model':_0x3167('0x36'),'as':_0x3167('0x37'),'attributes':['id',_0x3167('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1a70242..f3e8304 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 _0xb5fb=['format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day'];(function(_0x585092,_0x4cdb5f){var _0x1e3023=function(_0x5039d4){while(--_0x5039d4){_0x585092['push'](_0x585092['shift']());}};_0x1e3023(++_0x4cdb5f);}(_0xb5fb,0x172));var _0xbb5f=function(_0x4f501a,_0x4cfe43){_0x4f501a=_0x4f501a-0x0;var _0x22d3ac=_0xb5fb[_0x4f501a];return _0x22d3ac;};'use strict';var moment=require(_0xbb5f('0x0'));var _=require(_0xbb5f('0x1'));var client=require(_0xbb5f('0x2'));exports[_0xbb5f('0x3')]=function(_0x44b5b0){return client[_0xbb5f('0x4')](_0xbb5f('0x5'),{'body':_0x44b5b0,'log':_0xbb5f('0x5')});};exports[_0xbb5f('0x6')]=function(){return function(){return client[_0xbb5f('0x4')](_0xbb5f('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xbb5f('0x8')](_0xbb5f('0x9'))[_0xbb5f('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xbb5f('0x9'))['format'](_0xbb5f('0xb'))]}},'attributes':[_0xbb5f('0xc'),'queue','queuecallerjoinAt',_0xbb5f('0xd'),'queuecallercomplete',_0xbb5f('0xe'),_0xbb5f('0xf'),_0xbb5f('0x10'),_0xbb5f('0x11'),_0xbb5f('0x12')]},'log':_0xbb5f('0x13')});};}; \ No newline at end of file +var _0x38d1=['queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon'];(function(_0x25db49,_0x28f4f5){var _0x5163ba=function(_0x34b6ec){while(--_0x34b6ec){_0x25db49['push'](_0x25db49['shift']());}};_0x5163ba(++_0x28f4f5);}(_0x38d1,0xf2));var _0x138d=function(_0x5e5721,_0x1f4275){_0x5e5721=_0x5e5721-0x0;var _0x2dc843=_0x38d1[_0x5e5721];return _0x2dc843;};'use strict';var moment=require(_0x138d('0x0'));var _=require(_0x138d('0x1'));var client=require(_0x138d('0x2'));exports[_0x138d('0x3')]=function(_0x501cbd){return client[_0x138d('0x4')](_0x138d('0x5'),{'body':_0x501cbd,'log':'CreateVoiceQueueReport'});};exports[_0x138d('0x6')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x138d('0x7')](_0x138d('0x8')),moment()[_0x138d('0x9')](_0x138d('0xa'))[_0x138d('0x7')](_0x138d('0x8'))]}},'attributes':[_0x138d('0xb'),'queue',_0x138d('0xc'),'queuecallerleaveAt',_0x138d('0xd'),_0x138d('0xe'),_0x138d('0xf'),_0x138d('0x10'),_0x138d('0x11'),_0x138d('0x12')]},'log':_0x138d('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index b42badd..3ec5b8a 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 _0x00a3=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x00a3,0x18f));var _0x300a=function(_0x259d6c,_0x51c027){_0x259d6c=_0x259d6c-0x0;var _0x23c636=_0x00a3[_0x259d6c];return _0x23c636;};'use strict';var client=require(_0x300a('0x0'));exports[_0x300a('0x1')]=function(_0x213aad){return function(){return client[_0x300a('0x2')](_0x300a('0x3'),{'options':{'where':{'VoiceQueueId':_0x213aad,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x53f0=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x53f0,0x130));var _0x053f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x53f0[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x053f('0x0'));exports[_0x053f('0x1')]=function(_0x4ff06a){return function(){return client[_0x053f('0x2')](_0x053f('0x3'),{'options':{'where':{'VoiceQueueId':_0x4ff06a,'paused':!![]},'raw':!![]},'log':_0x053f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index cb88ef0..57bf045 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 _0x6740=['../client','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0xa1cd20,_0x2b9e73){var _0x52c40d=function(_0x2dfedc){while(--_0x2dfedc){_0xa1cd20['push'](_0xa1cd20['shift']());}};_0x52c40d(++_0x2b9e73);}(_0x6740,0xb9));var _0x0674=function(_0x1667e8,_0x369eaf){_0x1667e8=_0x1667e8-0x0;var _0x4be155=_0x6740[_0x1667e8];return _0x4be155;};'use strict';var _=require(_0x0674('0x0'));var client=require(_0x0674('0x1'));exports['create']=function(_0xb091f5){return client[_0x0674('0x2')](_0x0674('0x3'),{'body':_[_0x0674('0x4')](_0xb091f5,{'value':_0xb091f5[_0x0674('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x0f86=['create','Request','CreateVoiceRecording','lodash'];(function(_0x31e7f4,_0x2b1c07){var _0x27cf27=function(_0x1fa4d4){while(--_0x1fa4d4){_0x31e7f4['push'](_0x31e7f4['shift']());}};_0x27cf27(++_0x2b1c07);}(_0x0f86,0x87));var _0x60f8=function(_0x5283db,_0x29490d){_0x5283db=_0x5283db-0x0;var _0x11c0cf=_0x0f86[_0x5283db];return _0x11c0cf;};'use strict';var _=require(_0x60f8('0x0'));var client=require('../client');exports[_0x60f8('0x1')]=function(_0x47d50c){return client[_0x60f8('0x2')]('CreateVoiceRecording',{'body':_['merge'](_0x47d50c,{'value':_0x47d50c['monitorFilename']}),'log':_0x60f8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 526de30..67696ed 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 _0x6fb2=['transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x1989ec,_0x2b3626){var _0x10e2a0=function(_0x1917a8){while(--_0x1917a8){_0x1989ec['push'](_0x1989ec['shift']());}};_0x10e2a0(++_0x2b3626);}(_0x6fb2,0x6a));var _0x26fb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6fb2[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x26fb('0x0'));exports[_0x26fb('0x1')]=function(_0x237595){return client[_0x26fb('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x237595[_0x26fb('0x3')],'transfererchannel':_0x237595['transfererchannel'],'transferercalleridnum':_0x237595[_0x26fb('0x4')],'transferercalleridname':_0x237595[_0x26fb('0x5')],'transfererconnectedlinenum':_0x237595['transfererconnectedlinenum'],'transfererconnectedlinename':_0x237595[_0x26fb('0x6')],'transfereraccountcode':_0x237595[_0x26fb('0x7')],'transferercontext':_0x237595[_0x26fb('0x8')],'transfererexten':_0x237595[_0x26fb('0x9')],'transfererlinkedid':_0x237595[_0x26fb('0xa')],'transfereechannel':_0x237595['transfereechannel'],'transfereecalleridnum':_0x237595[_0x26fb('0xb')],'transfereecalleridname':_0x237595['transfereecalleridname'],'transfereeconnectedlinenum':_0x237595[_0x26fb('0xc')],'transfereeconnectedlinename':_0x237595[_0x26fb('0xd')],'transfereeaccountcode':_0x237595[_0x26fb('0xe')],'transfereecontext':_0x237595[_0x26fb('0xf')],'transfereeexten':_0x237595[_0x26fb('0x10')],'transfereelinkedid':_0x237595[_0x26fb('0x11')],'isexternal':_0x237595[_0x26fb('0x12')],'context':_0x237595['context'],'extension':_0x237595[_0x26fb('0x13')],'type':_0x26fb('0x14')},'log':_0x26fb('0x15')});};exports[_0x26fb('0x16')]=function(_0x2a5e26){return client['Request'](_0x26fb('0x15'),{'body':{'result':_0x2a5e26['result'],'transfererchannel':_0x2a5e26[_0x26fb('0x17')],'transferercalleridnum':_0x2a5e26[_0x26fb('0x18')],'transferercalleridname':_0x2a5e26[_0x26fb('0x19')],'transfererconnectedlinenum':_0x2a5e26[_0x26fb('0x1a')],'transfererconnectedlinename':_0x2a5e26[_0x26fb('0x1b')],'transfereraccountcode':_0x2a5e26[_0x26fb('0x1c')],'transferercontext':_0x2a5e26[_0x26fb('0x1d')],'transfererexten':_0x2a5e26['secondtransfererexten'],'transfererlinkedid':_0x2a5e26[_0x26fb('0x1e')],'transfereechannel':_0x2a5e26[_0x26fb('0x1f')],'transfereecalleridnum':_0x2a5e26['transfertargetcalleridnum'],'transfereecalleridname':_0x2a5e26[_0x26fb('0x20')],'transfereeconnectedlinenum':_0x2a5e26[_0x26fb('0x21')],'transfereeconnectedlinename':_0x2a5e26[_0x26fb('0x22')],'transfereeaccountcode':_0x2a5e26['transfertargetaccountcode'],'transfereecontext':_0x2a5e26['transfertargetcontext'],'transfereeexten':_0x2a5e26[_0x26fb('0x23')],'transfereelinkedid':_0x2a5e26[_0x26fb('0x24')],'isexternal':_0x2a5e26[_0x26fb('0x12')],'context':_0x2a5e26[_0x26fb('0x25')],'extension':_0x2a5e26[_0x26fb('0x26')],'type':_0x26fb('0x27')},'log':_0x26fb('0x15')});}; \ No newline at end of file +var _0x8b81=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','blindTransfer','Request','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x8b81,0x84));var _0x18b8=function(_0x3d7cf8,_0x25c202){_0x3d7cf8=_0x3d7cf8-0x0;var _0x2d21e2=_0x8b81[_0x3d7cf8];return _0x2d21e2;};'use strict';var client=require(_0x18b8('0x0'));exports[_0x18b8('0x1')]=function(_0x508d5e){return client[_0x18b8('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x508d5e[_0x18b8('0x3')],'transfererchannel':_0x508d5e['transfererchannel'],'transferercalleridnum':_0x508d5e[_0x18b8('0x4')],'transferercalleridname':_0x508d5e['transferercalleridname'],'transfererconnectedlinenum':_0x508d5e[_0x18b8('0x5')],'transfererconnectedlinename':_0x508d5e[_0x18b8('0x6')],'transfereraccountcode':_0x508d5e[_0x18b8('0x7')],'transferercontext':_0x508d5e[_0x18b8('0x8')],'transfererexten':_0x508d5e[_0x18b8('0x9')],'transfererlinkedid':_0x508d5e['transfererlinkedid'],'transfereechannel':_0x508d5e[_0x18b8('0xa')],'transfereecalleridnum':_0x508d5e[_0x18b8('0xb')],'transfereecalleridname':_0x508d5e[_0x18b8('0xc')],'transfereeconnectedlinenum':_0x508d5e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x508d5e[_0x18b8('0xd')],'transfereeaccountcode':_0x508d5e[_0x18b8('0xe')],'transfereecontext':_0x508d5e[_0x18b8('0xf')],'transfereeexten':_0x508d5e['transfereeexten'],'transfereelinkedid':_0x508d5e[_0x18b8('0x10')],'isexternal':_0x508d5e['isexternal'],'context':_0x508d5e[_0x18b8('0x11')],'extension':_0x508d5e[_0x18b8('0x12')],'type':_0x18b8('0x13')},'log':_0x18b8('0x14')});};exports[_0x18b8('0x15')]=function(_0xea36e7){return client[_0x18b8('0x2')](_0x18b8('0x14'),{'body':{'result':_0xea36e7[_0x18b8('0x3')],'transfererchannel':_0xea36e7[_0x18b8('0x16')],'transferercalleridnum':_0xea36e7[_0x18b8('0x17')],'transferercalleridname':_0xea36e7[_0x18b8('0x18')],'transfererconnectedlinenum':_0xea36e7[_0x18b8('0x19')],'transfererconnectedlinename':_0xea36e7[_0x18b8('0x1a')],'transfereraccountcode':_0xea36e7[_0x18b8('0x1b')],'transferercontext':_0xea36e7[_0x18b8('0x1c')],'transfererexten':_0xea36e7['secondtransfererexten'],'transfererlinkedid':_0xea36e7['origtransfererlinkedid'],'transfereechannel':_0xea36e7[_0x18b8('0x1d')],'transfereecalleridnum':_0xea36e7[_0x18b8('0x1e')],'transfereecalleridname':_0xea36e7[_0x18b8('0x1f')],'transfereeconnectedlinenum':_0xea36e7[_0x18b8('0x20')],'transfereeconnectedlinename':_0xea36e7[_0x18b8('0x21')],'transfereeaccountcode':_0xea36e7[_0x18b8('0x22')],'transfereecontext':_0xea36e7[_0x18b8('0x23')],'transfereeexten':_0xea36e7[_0x18b8('0x24')],'transfereelinkedid':_0xea36e7[_0x18b8('0x25')],'isexternal':_0xea36e7[_0x18b8('0x26')],'context':_0xea36e7[_0x18b8('0x27')],'extension':_0xea36e7['origtransfererexten'],'type':_0x18b8('0x28')},'log':_0x18b8('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5dff439..449f332 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 _0x4ec9=['Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','campaigns','run','event','emit','custom:','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','bluebird','moment','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','action','catch','message','ami\x20disconnected','Command','then','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','length','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','Action','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','toLowerCase','Channel\x20doesn\x27t\x20exist','find','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup'];(function(_0x2b85d5,_0x3115b7){var _0xe8c96f=function(_0x4bc25b){while(--_0x4bc25b){_0x2b85d5['push'](_0x2b85d5['shift']());}};_0xe8c96f(++_0x3115b7);}(_0x4ec9,0x113));var _0x94ec=function(_0x335d63,_0x5d8378){_0x335d63=_0x335d63-0x0;var _0x49bcda=_0x4ec9[_0x335d63];return _0x49bcda;};'use strict';var _=require('lodash');var util=require(_0x94ec('0x0'));var jayson=require(_0x94ec('0x1'));var schema=require(_0x94ec('0x2'));var BPromise=require(_0x94ec('0x3'));var moment=require(_0x94ec('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x94ec('0x5'));exports[_0x94ec('0x6')]=function(_0x96b572,_0x5f3e21,_0x3e2d96){return new BPromise(function(_0x3c9465,_0x463d9f){var _0x396fe1={'QueuePause':function(_0x2c34f4){return new Promise(function(_0xd24560,_0x52ee74){var _0xe9009f=util[_0x94ec('0x7')](_0x94ec('0x8'),_0x94ec('0x9'),_0x2c34f4['name']);if(_0x96b572['timers']&&_0x96b572[_0x94ec('0xa')][_0xe9009f]&&_0x96b572[_0x94ec('0xa')][_0xe9009f][_0x94ec('0xb')]){_0x96b572[_0x94ec('0xa')][_0xe9009f][_0x94ec('0xc')]();}if(_0x96b572[_0x94ec('0xd')][_0xe9009f]){_0x96b572['agents'][_0xe9009f][_0x94ec('0xe')]({'statePause':_0x2c34f4[_0x94ec('0xf')]?!![]:![]});}_0xd24560({'code':0xc8,'message':_0x94ec('0x10')});});},'Reload':function(_0x1601ce){var _0x29fce4=this;return new Promise(function(_0x5e453b,_0x4bce05){if(ami[_0x94ec('0x11')]()==![]){return _0x4bce05(_0x29fce4[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')][_0x94ec('0x14')],'ami\x20disconnected'][_0x94ec('0x15')]('\x20')));}_0x1601ce=_[_0x94ec('0x16')](_0x1601ce,_[_0x94ec('0x17')](properties['module']));_0x1601ce[_0x94ec('0x18')]='Reload';return ami['Action'](_0x1601ce)['then'](function(_0x4e12a8){_0x5e453b({'code':0xc8,'message':_0x4e12a8['message']});})[_0x94ec('0x19')](function(_0x57b6cc){_0x4bce05(_0x29fce4[_0x94ec('0x12')](0x1f5,_0x57b6cc[_0x94ec('0x1a')]));});});},'Command':function(_0x412a50){var _0x251601=this;return new Promise(function(_0x53f44e,_0x182c71){if(ami['isConnected']()==![]){return _0x182c71(_0x251601[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')][_0x94ec('0x14')],_0x94ec('0x1b')][_0x94ec('0x15')]('\x20')));}_0x412a50=_[_0x94ec('0x16')](_0x412a50,'command');_0x412a50[_0x94ec('0x18')]=_0x94ec('0x1c');return ami['Action'](_0x412a50)[_0x94ec('0x1d')](function(_0xc38ad5){_0x53f44e({'code':0xc8,'message':_0xc38ad5[_0x94ec('0x1e')]});})[_0x94ec('0x19')](function(_0x166c4c){_0x182c71(_0x251601['error'](0x1f5,_0x166c4c['message']));});});},'VoiceQueues':function(_0x54ad41){return new Promise(function(_0x298547,_0x2de64e){var _0x1fd88f=[];for(var _0x5c81ac in _0x96b572[_0x94ec('0x1f')]){if(_0x96b572[_0x94ec('0x1f')][_0x94ec('0x20')](_0x5c81ac)){var _0x103f81=_0x96b572[_0x94ec('0x1f')][_0x5c81ac];var _0x34d689={'id':_0x103f81['id'],'name':_0x103f81[_0x94ec('0x21')],'strategy':_0x103f81[_0x94ec('0x22')],'answered':_0x103f81[_0x94ec('0x23')],'available':_0x103f81[_0x94ec('0x24')],'loggedIn':_0x103f81[_0x94ec('0x25')],'pTalking':_0x103f81['pTalking'],'sumBillable':_0x103f81['sumBillable'],'sumDuration':_0x103f81[_0x94ec('0x26')],'sumHoldTime':_0x103f81[_0x94ec('0x27')]||0x0,'talking':_0x103f81[_0x94ec('0x28')],'total':_0x103f81['total'],'type':_0x103f81[_0x94ec('0x29')],'unmanaged':_0x103f81[_0x94ec('0x2a')],'abandoned':_0x103f81[_0x94ec('0x2b')],'waiting':_0x103f81[_0x94ec('0x2c')],'loggedInDb':_0x103f81['loggedInDb']};if(_0x103f81[_0x94ec('0x29')]==='outbound'){_0x34d689['dialActive']=_0x103f81[_0x94ec('0x2d')];_0x34d689[_0x94ec('0x2e')]=_0x103f81[_0x94ec('0x2e')];_0x34d689[_0x94ec('0x2f')]=_0x103f81[_0x94ec('0x2f')];_0x34d689[_0x94ec('0x30')]=_0x103f81[_0x94ec('0x30')];_0x34d689[_0x94ec('0x31')]=_0x103f81[_0x94ec('0x31')];_0x34d689[_0x94ec('0x32')]=_0x103f81[_0x94ec('0x32')];_0x34d689[_0x94ec('0x33')]=_0x103f81[_0x94ec('0x33')];_0x34d689[_0x94ec('0x34')]=_0x103f81[_0x94ec('0x34')];_0x34d689[_0x94ec('0x35')]=_0x103f81[_0x94ec('0x35')];_0x34d689[_0x94ec('0x36')]=_0x103f81[_0x94ec('0x36')];_0x34d689[_0x94ec('0x37')]=_0x103f81['outboundCongestionCallsDay'];_0x34d689[_0x94ec('0x38')]=_0x103f81[_0x94ec('0x38')];_0x34d689[_0x94ec('0x39')]=_0x103f81[_0x94ec('0x39')];_0x34d689[_0x94ec('0x3a')]=_0x103f81[_0x94ec('0x3a')];_0x34d689[_0x94ec('0x3b')]=_0x103f81[_0x94ec('0x3b')];_0x34d689[_0x94ec('0x3c')]=_0x103f81[_0x94ec('0x3c')];_0x34d689['outboundOriginateFailureCallsDay']=_0x103f81['outboundOriginateFailureCallsDay'];_0x34d689[_0x94ec('0x3d')]=_0x103f81['outboundReCallsDay'];_0x34d689[_0x94ec('0x3e')]=_0x103f81[_0x94ec('0x3e')];_0x34d689[_0x94ec('0x3f')]=_0x103f81[_0x94ec('0x3f')];_0x34d689[_0x94ec('0x40')]=_0x103f81[_0x94ec('0x40')];_0x34d689['predictiveIntervalAvgHoldtime']=_0x103f81[_0x94ec('0x41')];_0x34d689[_0x94ec('0x42')]=_0x103f81[_0x94ec('0x42')];_0x34d689[_0x94ec('0x43')]=_0x103f81[_0x94ec('0x43')];_0x34d689[_0x94ec('0x44')]=_0x103f81[_0x94ec('0x44')];_0x34d689['predictiveIntervalErlangCalls']=_0x103f81[_0x94ec('0x45')];_0x34d689[_0x94ec('0x46')]=_0x103f81[_0x94ec('0x46')];_0x34d689['predictiveIntervalHitRate']=_0x103f81['predictiveIntervalHitRate'];_0x34d689['predictiveIntervalMultiplicativeFactor']=_0x103f81[_0x94ec('0x47')];_0x34d689[_0x94ec('0x48')]=_0x103f81[_0x94ec('0x48')];_0x34d689[_0x94ec('0x49')]=_0x103f81['predictiveIntervalAvailable'];_0x34d689[_0x94ec('0x4a')]=_0x103f81['predictiveIntervalTotalCalls'];_0x34d689['message']=_0x103f81[_0x94ec('0x1a')];_0x34d689[_0x94ec('0x4b')]=_0x103f81[_0x94ec('0x4b')];_0x34d689['erlangCalls']=_0x103f81[_0x94ec('0x4c')];_0x34d689[_0x94ec('0x4d')]=_0x103f81[_0x94ec('0x4d')];_0x34d689[_0x94ec('0x4e')]=_0x103f81['erlangAbandonmentRate'];_0x34d689['erlangBusyFactor']=_0x103f81['erlangBusyFactor'];_0x34d689['startPredictive']=_0x103f81[_0x94ec('0x4f')];_0x34d689[_0x94ec('0x50')]=_0x103f81[_0x94ec('0x50')];}if(_0x103f81[_0x94ec('0x51')]){_0x34d689[_0x94ec('0x51')]={'id':_0x103f81['Trunk']['id'],'name':_0x103f81[_0x94ec('0x51')][_0x94ec('0x21')],'active':_0x103f81[_0x94ec('0x51')][_0x94ec('0x52')],'callerid':_0x103f81['Trunk']['callerid']};}if(_0x103f81['Interval']){_0x34d689['Interval']={'id':_0x103f81[_0x94ec('0x53')]['id'],'name':_0x103f81[_0x94ec('0x53')]['name']};}_0x1fd88f['push'](_0x34d689);}}_0x298547({'count':_0x1fd88f[_0x94ec('0x54')],'rows':_0x1fd88f});});},'VoiceChannels':function(_0xeff0d2){return new Promise(function(_0x27a112,_0x2ebf34){var _0x1cc348=_[_0x94ec('0x55')](_0x96b572[_0x94ec('0x56')]);_0x27a112({'count':_0x1cc348['length'],'rows':_0x1cc348});});},'VoiceChannelMixMonitor':function(_0xec6aea){var _0x8cdd3e=this;return new Promise(function(_0x44b179,_0x38180b){if(ami[_0x94ec('0x11')]()==![]){return _0x38180b(_0x8cdd3e[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')][_0x94ec('0x14')],_0x94ec('0x1b')]['join']('\x20')));}var _0x4a9a68=schema(properties[_0x94ec('0x57')])[_0x94ec('0x2')](_0xec6aea);if(_0x4a9a68[_0x94ec('0x54')]>0x0){return _0x38180b(_0x8cdd3e[_0x94ec('0x12')](0x1f4,_[_0x94ec('0x58')](_0x4a9a68,'message')['join'](',\x20')));}var _0x32c34a=_['find'](_0x96b572[_0x94ec('0x56')],{'uniqueid':_0xec6aea[_0x94ec('0x59')]});if(_0x32c34a&&_0x32c34a[_0x94ec('0x5a')]){var _0x38be86=util[_0x94ec('0x7')](_0x94ec('0x5b'),_0xec6aea[_0x94ec('0x5c')]||_0xec6aea['uniqueid'],_0xec6aea[_0x94ec('0x7')]||_0x94ec('0x5d'));return ami[_0x94ec('0x5e')]({'action':_0x94ec('0x5f'),'channel':_0x32c34a['channel'],'file':_0x38be86,'options':_0x94ec('0x60')})[_0x94ec('0x1d')](function(_0x4766c6){var _0xd39c88=_['find'](_0x32c34a['monitors'],{'filename':_0x94ec('0x61')+_0x38be86['toLowerCase']()});if(_[_0x94ec('0x62')](_0xd39c88)){_0x32c34a[_0x94ec('0x63')]['push']({'filename':_0x94ec('0x61')+_0x38be86['toLowerCase'](),'createdAt':moment()[_0x94ec('0x7')](_0x94ec('0x64')),'mixmonitorid':_0x4766c6[_0x94ec('0x65')],'status':_0x94ec('0x66')});}else{_0xd39c88[_0x94ec('0x65')]=_0x4766c6['mixmonitorid'];_0xd39c88[_0x94ec('0x67')]='rec';}_0x44b179({'code':0xc8,'message':[_0xec6aea[_0x94ec('0x59')],'MixMonitor\x20Success',_0x4766c6['mixmonitorid']][_0x94ec('0x15')]('\x20'),'mixmonitorid':_0x4766c6[_0x94ec('0x65')]});})[_0x94ec('0x19')](function(_0x27b948){_0x38180b(_0x8cdd3e[_0x94ec('0x12')](0x1f5,[_0xec6aea[_0x94ec('0x59')],_0x27b948[_0x94ec('0x1a')][_0x94ec('0x68')]()][_0x94ec('0x15')]('\x20')));});}else{return _0x38180b(_0x8cdd3e[_0x94ec('0x12')](0x1f5,_0x94ec('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x4cabb9){var _0x229bad=this;return new Promise(function(_0x430393,_0x5786a8){if(ami[_0x94ec('0x11')]()==![]){return _0x5786a8(_0x229bad[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')][_0x94ec('0x14')],_0x94ec('0x1b')][_0x94ec('0x15')]('\x20')));}var _0x18a8e8=schema(properties[_0x94ec('0x57')])['validate'](_0x4cabb9);if(_0x18a8e8[_0x94ec('0x54')]>0x0){return _0x5786a8(_0x229bad[_0x94ec('0x12')](0x1f4,_[_0x94ec('0x58')](_0x18a8e8,_0x94ec('0x1a'))['join'](',\x20')));}var _0x47dd9e=_[_0x94ec('0x6a')](_0x96b572[_0x94ec('0x56')],{'uniqueid':_0x4cabb9['uniqueid']});if(_0x47dd9e){return BPromise['resolve']()[_0x94ec('0x1d')](function(){if(_0x47dd9e['channel']){return ami[_0x94ec('0x5e')]({'action':'StopMixMonitor','channel':_0x47dd9e['channel'],'mixmonitorid':_0x4cabb9['mixmonitorid']})[_0x94ec('0x19')](function(_0xbf3b41){});}})['then'](function(){if(_0x47dd9e['destinationchannel']){return ami['Action']({'action':_0x94ec('0x6b'),'channel':_0x47dd9e['destinationchannel'],'mixmonitorid':_0x4cabb9[_0x94ec('0x65')]})[_0x94ec('0x19')](function(_0x3b324){});}})[_0x94ec('0x1d')](function(_0x3deda5){var _0x29bdcf=_[_0x94ec('0x6a')](_0x47dd9e['monitors'],{'mixmonitorid':_0x4cabb9[_0x94ec('0x65')]});if(_0x29bdcf){_0x29bdcf[_0x94ec('0x67')]=_0x94ec('0x6c');}})[_0x94ec('0x1d')](function(){var _0x311efe=util[_0x94ec('0x7')](_0x94ec('0x5b'),_0x4cabb9[_0x94ec('0x5c')]||_0x4cabb9[_0x94ec('0x59')],_0x4cabb9[_0x94ec('0x7')]||'wav');var _0x345f1c=_[_0x94ec('0x6a')](_0x47dd9e['monitors'],{'filename':_0x94ec('0x61')+_0x311efe['toLowerCase']()});if(_0x345f1c){_0x345f1c['status']=_0x94ec('0x6c');}})['then'](function(){_0x430393({'code':0xc8,'message':[_0x4cabb9['uniqueid'],_0x94ec('0x6d')][_0x94ec('0x15')]('\x20')});})[_0x94ec('0x19')](function(_0x533d9a){_0x5786a8(_0x229bad[_0x94ec('0x12')](0x1f5,[_0x4cabb9[_0x94ec('0x59')],_0x533d9a[_0x94ec('0x1a')][_0x94ec('0x68')]()][_0x94ec('0x15')]('\x20')));});}else{return _0x5786a8(_0x229bad[_0x94ec('0x12')](0x1f5,_0x94ec('0x69')));}});},'VoiceQueuesChannels':function(_0x15b04e){return new Promise(function(_0x42b0bd,_0x2674ee){var _0x3d146a=_['values'](_0x96b572[_0x94ec('0x6e')]);_0x42b0bd({'count':_0x3d146a[_0x94ec('0x54')],'rows':_0x3d146a});});},'VoiceQueuesChannel':function(_0x34dac2){var _0x1facf9=this;return new Promise(function(_0x5ada7e,_0x20f2ad){var _0x5c19e7=schema(properties['voicequeuechannel'])[_0x94ec('0x2')](_0x34dac2);if(_0x5c19e7[_0x94ec('0x54')]>0x0){return _0x20f2ad(_0x1facf9['error'](0x1f4,_[_0x94ec('0x58')](_0x5c19e7,_0x94ec('0x1a'))[_0x94ec('0x15')](',\x20')));}var _0x3976f3=_[_0x94ec('0x6a')](_0x96b572[_0x94ec('0x6e')],{'uniqueid':_0x34dac2[_0x94ec('0x59')]});if(_0x3976f3){_0x5ada7e(_0x3976f3);}else{return _0x20f2ad(_0x1facf9[_0x94ec('0x12')](0x1f5,_0x94ec('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x9005e4){var _0x16abb8=this;return new Promise(function(_0x2102d9,_0x518b79){if(ami[_0x94ec('0x11')]()==![]){return _0x518b79(_0x16abb8[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')][_0x94ec('0x14')],_0x94ec('0x1b')][_0x94ec('0x15')]('\x20')));}var _0x5640a4=schema(properties[_0x94ec('0x6f')])[_0x94ec('0x2')](_0x9005e4);if(_0x5640a4[_0x94ec('0x54')]>0x0){return _0x518b79(_0x16abb8['error'](0x1f4,_[_0x94ec('0x58')](_0x5640a4,_0x94ec('0x1a'))[_0x94ec('0x15')](',\x20')));}var _0x44a91e=_[_0x94ec('0x6a')](_0x96b572['queueChannels'],{'uniqueid':_0x9005e4[_0x94ec('0x59')]});if(_0x44a91e&&_0x44a91e[_0x94ec('0x5a')]){return ami['Action']({'action':_0x94ec('0x70'),'channel':_0x44a91e['channel']})[_0x94ec('0x1d')](function(_0x5dd39e){_0x2102d9({'code':0xc8,'message':[_0x9005e4[_0x94ec('0x59')],_0x5dd39e[_0x94ec('0x1a')][_0x94ec('0x68')]()][_0x94ec('0x15')]('\x20')});})[_0x94ec('0x19')](function(_0x15d2d7){_0x518b79(_0x16abb8[_0x94ec('0x12')](0x1f5,[_0x9005e4['uniqueid'],_0x15d2d7[_0x94ec('0x1a')][_0x94ec('0x68')]()]['join']('\x20')));});}else{return _0x518b79(_0x16abb8[_0x94ec('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x458d6e){var _0x1f562c=this;return new Promise(function(_0x38b3b8,_0x36fea3){if(ami[_0x94ec('0x11')]()==![]){return _0x36fea3(_0x1f562c[_0x94ec('0x12')](0x1f4,[config[_0x94ec('0x13')]['ip'],config[_0x94ec('0x13')]['username'],_0x94ec('0x1b')][_0x94ec('0x15')]('\x20')));}var _0x3bf996=schema(properties[_0x94ec('0x71')])[_0x94ec('0x2')](_0x458d6e);if(_0x3bf996['length']>0x0){return _0x36fea3(_0x1f562c[_0x94ec('0x12')](0x1f4,_[_0x94ec('0x58')](_0x3bf996,'message')[_0x94ec('0x15')](',\x20')));}var _0x49fba1=_[_0x94ec('0x6a')](_0x96b572[_0x94ec('0x6e')],{'uniqueid':_0x458d6e[_0x94ec('0x59')]});if(_0x49fba1&&_0x49fba1['channel']){return ami[_0x94ec('0x5e')]({'action':'Redirect','channel':_0x49fba1['channel'],'exten':_0x458d6e[_0x94ec('0x72')],'context':_0x458d6e[_0x94ec('0x73')]||_0x49fba1['context'],'priority':0x1})[_0x94ec('0x1d')](function(_0x462638){_0x38b3b8({'code':0xc8,'message':[_0x458d6e[_0x94ec('0x59')],_0x462638['message'][_0x94ec('0x68')]()][_0x94ec('0x15')]('\x20')});})[_0x94ec('0x19')](function(_0xc57940){_0x36fea3(_0x1f562c[_0x94ec('0x12')](0x1f5,[_0x458d6e[_0x94ec('0x59')],_0xc57940[_0x94ec('0x1a')][_0x94ec('0x68')]()][_0x94ec('0x15')]('\x20')));});}else{return _0x36fea3(_0x1f562c[_0x94ec('0x12')](0x1f5,_0x94ec('0x69')));}});},'Agents':function(_0xa65219){return new Promise(function(_0x5b31c4,_0x394c56){var _0xe8c2b1=_[_0x94ec('0x55')](_0x96b572[_0x94ec('0xd')]);_0x5b31c4({'count':_0xe8c2b1[_0x94ec('0x54')],'rows':_0xe8c2b1});});},'Telephones':function(_0x41bfa2){return new Promise(function(_0x3912e9,_0x4e6d51){var _0x4b5a2a=_[_0x94ec('0x55')](_0x96b572[_0x94ec('0x74')]);_0x3912e9({'count':_0x4b5a2a[_0x94ec('0x54')],'rows':_0x4b5a2a});});},'Trunks':function(_0xf78186){return new Promise(function(_0xc0f3f2,_0x4aee2f){var _0x59e093=_[_0x94ec('0x55')](_0x96b572[_0x94ec('0x75')]);_0xc0f3f2({'count':_0x59e093[_0x94ec('0x54')],'rows':_0x59e093});});},'OutboundChannels':function(_0x1c5888){return new Promise(function(_0x333aff,_0xfa0938){var _0x5521fa=_[_0x94ec('0x55')](_0x96b572['outboundChannels']);_0x333aff({'count':_0x5521fa[_0x94ec('0x54')],'rows':_0x5521fa});});},'Outbound':function(_0x58bba5){return new Promise(function(_0x153371,_0x5f5ca0){_0x153371(_0x96b572['outbound']);});},'Campaigns':function(_0x458edc){return new Promise(function(_0x349267,_0x4bfc04){var _0x3f819f=_[_0x94ec('0x55')](_0x96b572[_0x94ec('0x76')]);_0x349267({'count':_0x3f819f[_0x94ec('0x54')],'rows':_0x3f819f});});},'VoiceQueuesPreview':function(_0x304851){var _0xf5f87c=this;return new Promise(function(_0x581e4b,_0x4d5e25){_0x5f3e21[_0x94ec('0x77')](_0x304851['id'])[_0x94ec('0x1d')](function(_0x135acb){_0x581e4b({'code':0xc8,'message':_0x135acb[_0x94ec('0x1a')]});})[_0x94ec('0x19')](function(_0x5201fe){_0x4d5e25(_0xf5f87c[_0x94ec('0x12')](0x1f4,_0x5201fe['message']));});});},'EventManager':function(_0x27a46d){var _0x3fd288=this;return new Promise(function(_0x4bb354,_0x548ef3){if(!_0x27a46d[_0x94ec('0x78')]){return _0x548ef3(_0x3fd288[_0x94ec('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x94ec('0x79')](_0x94ec('0x7a')+_0x27a46d['event'],_0x27a46d['message']);_0x4bb354({'code':0xc8,'message':_0x27a46d});});},'FaxAccounts':function(_0x84971a){return new Promise(function(_0x291610,_0x4e499d){var _0x4f3b0f=_[_0x94ec('0x55')](_0x96b572['faxAccounts']);_0x291610({'count':_0x4f3b0f[_0x94ec('0x54')],'rows':_0x4f3b0f});});},'SendFax':function(_0x5d1361){var _0x1e1023=this;return new Promise(function(_0x2549a6,_0x240106){_0x3e2d96[_0x94ec('0x7b')](_0x5d1361)['then'](function(_0x14d628){_0x2549a6({'code':0xc8,'message':_0x14d628[_0x94ec('0x1a')]});})[_0x94ec('0x19')](function(_0x446c2e){_0x240106(_0x1e1023[_0x94ec('0x12')](0x1f4,_0x446c2e['message']));});});},'CheckAfterSend':function(_0x42edac){var _0x2846d4=this;return new Promise(function(_0x5c4228,_0x5da124){_0x3e2d96['checkAfterSend'](_0x42edac)[_0x94ec('0x1d')](function(_0x10971d){_0x5c4228({'code':0xc8,'message':_0x10971d[_0x94ec('0x1a')]});})[_0x94ec('0x19')](function(_0x29bb7d){_0x5da124(_0x2846d4[_0x94ec('0x12')](0x1f4,_0x29bb7d[_0x94ec('0x1a')]));});});}};var _0x26cfdb=jayson[_0x94ec('0x7c')](_0x396fe1)[_0x94ec('0x7d')]();_0x26cfdb['on']('error',function(_0x851022){return _0x463d9f(_0x851022);});_0x26cfdb[_0x94ec('0x6')](0x232a,_0x94ec('0x7e'),function(){console[_0x94ec('0x7f')](_0x94ec('0x80'),0x232a);return _0x3c9465('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x5a1e=['Trunk','active','callerid','Interval','push','length','values','channels','map','find','uniqueid','format','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','voicechannel','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','then','message','catch','join','command','action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x268352,_0x3bfe67){var _0x80a285=function(_0x5a780d){while(--_0x5a780d){_0x268352['push'](_0x268352['shift']());}};_0x80a285(++_0x3bfe67);}(_0x5a1e,0xc7));var _0xe5a1=function(_0x4f75a3,_0x2c4ec4){_0x4f75a3=_0x4f75a3-0x0;var _0x45ca11=_0x5a1e[_0x4f75a3];return _0x45ca11;};'use strict';var _=require(_0xe5a1('0x0'));var util=require(_0xe5a1('0x1'));var jayson=require(_0xe5a1('0x2'));var schema=require(_0xe5a1('0x3'));var BPromise=require(_0xe5a1('0x4'));var moment=require('moment');var config=require(_0xe5a1('0x5'));var properties=require('../properties');var ami=require(_0xe5a1('0x6'));exports[_0xe5a1('0x7')]=function(_0x13f6d9,_0x3d3541,_0x3cb774){return new BPromise(function(_0x5531b3,_0x2669c0){var _0x8d5f9d={'QueuePause':function(_0x34f893){return new Promise(function(_0x11ccd1,_0x50b244){var _0x9c7d4d=util['format'](_0xe5a1('0x8'),_0xe5a1('0x9'),_0x34f893[_0xe5a1('0xa')]);if(_0x13f6d9[_0xe5a1('0xb')]&&_0x13f6d9['timers'][_0x9c7d4d]&&_0x13f6d9[_0xe5a1('0xb')][_0x9c7d4d][_0xe5a1('0xc')]){_0x13f6d9['timers'][_0x9c7d4d][_0xe5a1('0xd')]();}if(_0x13f6d9[_0xe5a1('0xe')][_0x9c7d4d]){_0x13f6d9[_0xe5a1('0xe')][_0x9c7d4d][_0xe5a1('0xf')]({'statePause':_0x34f893[_0xe5a1('0x10')]?!![]:![]});}_0x11ccd1({'code':0xc8,'message':_0xe5a1('0x11')});});},'Reload':function(_0x1fbdf4){var _0x2d4194=this;return new Promise(function(_0x4decaa,_0x35e588){if(ami[_0xe5a1('0x12')]()==![]){return _0x35e588(_0x2d4194[_0xe5a1('0x13')](0x1f4,[config['asterisk']['ip'],config[_0xe5a1('0x14')][_0xe5a1('0x15')],_0xe5a1('0x16')]['join']('\x20')));}_0x1fbdf4=_[_0xe5a1('0x17')](_0x1fbdf4,_[_0xe5a1('0x18')](properties[_0xe5a1('0x19')]));_0x1fbdf4['action']=_0xe5a1('0x1a');return ami[_0xe5a1('0x1b')](_0x1fbdf4)[_0xe5a1('0x1c')](function(_0x57a0f8){_0x4decaa({'code':0xc8,'message':_0x57a0f8[_0xe5a1('0x1d')]});})[_0xe5a1('0x1e')](function(_0x4c4824){_0x35e588(_0x2d4194[_0xe5a1('0x13')](0x1f5,_0x4c4824[_0xe5a1('0x1d')]));});});},'Command':function(_0x49a8b9){var _0x603586=this;return new Promise(function(_0x7b7e5d,_0x2afedc){if(ami[_0xe5a1('0x12')]()==![]){return _0x2afedc(_0x603586['error'](0x1f4,[config[_0xe5a1('0x14')]['ip'],config[_0xe5a1('0x14')]['username'],'ami\x20disconnected'][_0xe5a1('0x1f')]('\x20')));}_0x49a8b9=_[_0xe5a1('0x17')](_0x49a8b9,_0xe5a1('0x20'));_0x49a8b9[_0xe5a1('0x21')]='Command';return ami[_0xe5a1('0x1b')](_0x49a8b9)['then'](function(_0x29e712){_0x7b7e5d({'code':0xc8,'message':_0x29e712[_0xe5a1('0x22')]});})[_0xe5a1('0x1e')](function(_0x4ee69d){_0x2afedc(_0x603586['error'](0x1f5,_0x4ee69d[_0xe5a1('0x1d')]));});});},'VoiceQueues':function(_0x24ee23){return new Promise(function(_0x2a1619,_0x27a378){var _0x531145=[];for(var _0x463733 in _0x13f6d9[_0xe5a1('0x23')]){if(_0x13f6d9['voiceQueues'][_0xe5a1('0x24')](_0x463733)){var _0x3d2fe4=_0x13f6d9[_0xe5a1('0x23')][_0x463733];var _0x205f32={'id':_0x3d2fe4['id'],'name':_0x3d2fe4[_0xe5a1('0xa')],'strategy':_0x3d2fe4[_0xe5a1('0x25')],'answered':_0x3d2fe4[_0xe5a1('0x26')],'available':_0x3d2fe4[_0xe5a1('0x27')],'loggedIn':_0x3d2fe4[_0xe5a1('0x28')],'pTalking':_0x3d2fe4['pTalking'],'sumBillable':_0x3d2fe4[_0xe5a1('0x29')],'sumDuration':_0x3d2fe4[_0xe5a1('0x2a')],'sumHoldTime':_0x3d2fe4[_0xe5a1('0x2b')]||0x0,'talking':_0x3d2fe4['talking'],'total':_0x3d2fe4[_0xe5a1('0x2c')],'type':_0x3d2fe4[_0xe5a1('0x2d')],'unmanaged':_0x3d2fe4[_0xe5a1('0x2e')],'abandoned':_0x3d2fe4[_0xe5a1('0x2f')],'waiting':_0x3d2fe4[_0xe5a1('0x30')],'loggedInDb':_0x3d2fe4[_0xe5a1('0x31')]};if(_0x3d2fe4[_0xe5a1('0x2d')]===_0xe5a1('0x32')){_0x205f32['dialActive']=_0x3d2fe4[_0xe5a1('0x33')];_0x205f32['dialMethod']=_0x3d2fe4[_0xe5a1('0x34')];_0x205f32[_0xe5a1('0x35')]=_0x3d2fe4[_0xe5a1('0x35')];_0x205f32['dialOriginateCallerIdNumber']=_0x3d2fe4[_0xe5a1('0x36')];_0x205f32['dialOriginateTimeout']=_0x3d2fe4['dialOriginateTimeout'];_0x205f32[_0xe5a1('0x37')]=_0x3d2fe4[_0xe5a1('0x37')];_0x205f32[_0xe5a1('0x38')]=_0x3d2fe4['outboundAnswerAgiCallsDay'];_0x205f32[_0xe5a1('0x39')]=_0x3d2fe4[_0xe5a1('0x39')];_0x205f32[_0xe5a1('0x3a')]=_0x3d2fe4[_0xe5a1('0x3a')];_0x205f32[_0xe5a1('0x3b')]=_0x3d2fe4[_0xe5a1('0x3b')];_0x205f32['outboundCongestionCallsDay']=_0x3d2fe4[_0xe5a1('0x3c')];_0x205f32[_0xe5a1('0x3d')]=_0x3d2fe4['outboundDropCallsDayACS'];_0x205f32[_0xe5a1('0x3e')]=_0x3d2fe4[_0xe5a1('0x3e')];_0x205f32[_0xe5a1('0x3f')]=_0x3d2fe4[_0xe5a1('0x3f')];_0x205f32[_0xe5a1('0x40')]=_0x3d2fe4['outboundNoAnswerCallsDay'];_0x205f32[_0xe5a1('0x41')]=_0x3d2fe4['outboundNoSuchCallsDay'];_0x205f32[_0xe5a1('0x42')]=_0x3d2fe4[_0xe5a1('0x42')];_0x205f32[_0xe5a1('0x43')]=_0x3d2fe4[_0xe5a1('0x43')];_0x205f32[_0xe5a1('0x44')]=_0x3d2fe4[_0xe5a1('0x44')];_0x205f32[_0xe5a1('0x45')]=_0x3d2fe4[_0xe5a1('0x45')];_0x205f32[_0xe5a1('0x46')]=_0x3d2fe4[_0xe5a1('0x46')];_0x205f32[_0xe5a1('0x47')]=_0x3d2fe4[_0xe5a1('0x47')];_0x205f32[_0xe5a1('0x48')]=_0x3d2fe4[_0xe5a1('0x48')];_0x205f32[_0xe5a1('0x49')]=_0x3d2fe4[_0xe5a1('0x49')];_0x205f32[_0xe5a1('0x4a')]=_0x3d2fe4[_0xe5a1('0x4a')];_0x205f32['predictiveIntervalErlangCalls']=_0x3d2fe4[_0xe5a1('0x4b')];_0x205f32[_0xe5a1('0x4c')]=_0x3d2fe4[_0xe5a1('0x4c')];_0x205f32[_0xe5a1('0x4d')]=_0x3d2fe4[_0xe5a1('0x4d')];_0x205f32[_0xe5a1('0x4e')]=_0x3d2fe4[_0xe5a1('0x4e')];_0x205f32[_0xe5a1('0x4f')]=_0x3d2fe4[_0xe5a1('0x4f')];_0x205f32['predictiveIntervalAvailable']=_0x3d2fe4[_0xe5a1('0x50')];_0x205f32['predictiveIntervalTotalCalls']=_0x3d2fe4[_0xe5a1('0x51')];_0x205f32[_0xe5a1('0x1d')]=_0x3d2fe4[_0xe5a1('0x1d')];_0x205f32[_0xe5a1('0x52')]=_0x3d2fe4[_0xe5a1('0x52')];_0x205f32[_0xe5a1('0x53')]=_0x3d2fe4['erlangCalls'];_0x205f32[_0xe5a1('0x54')]=_0x3d2fe4[_0xe5a1('0x54')];_0x205f32[_0xe5a1('0x55')]=_0x3d2fe4[_0xe5a1('0x55')];_0x205f32[_0xe5a1('0x56')]=_0x3d2fe4[_0xe5a1('0x56')];_0x205f32[_0xe5a1('0x57')]=_0x3d2fe4['startPredictive'];_0x205f32[_0xe5a1('0x58')]=_0x3d2fe4['startProgressive'];}if(_0x3d2fe4[_0xe5a1('0x59')]){_0x205f32['Trunk']={'id':_0x3d2fe4[_0xe5a1('0x59')]['id'],'name':_0x3d2fe4[_0xe5a1('0x59')][_0xe5a1('0xa')],'active':_0x3d2fe4[_0xe5a1('0x59')][_0xe5a1('0x5a')],'callerid':_0x3d2fe4[_0xe5a1('0x59')][_0xe5a1('0x5b')]};}if(_0x3d2fe4[_0xe5a1('0x5c')]){_0x205f32[_0xe5a1('0x5c')]={'id':_0x3d2fe4[_0xe5a1('0x5c')]['id'],'name':_0x3d2fe4[_0xe5a1('0x5c')][_0xe5a1('0xa')]};}_0x531145[_0xe5a1('0x5d')](_0x205f32);}}_0x2a1619({'count':_0x531145[_0xe5a1('0x5e')],'rows':_0x531145});});},'VoiceChannels':function(_0x3f9410){return new Promise(function(_0xd3292,_0x21b141){var _0x233ead=_[_0xe5a1('0x5f')](_0x13f6d9[_0xe5a1('0x60')]);_0xd3292({'count':_0x233ead[_0xe5a1('0x5e')],'rows':_0x233ead});});},'VoiceChannelMixMonitor':function(_0x38c1c8){var _0x20e803=this;return new Promise(function(_0x295695,_0x234b19){if(ami[_0xe5a1('0x12')]()==![]){return _0x234b19(_0x20e803[_0xe5a1('0x13')](0x1f4,[config['asterisk']['ip'],config[_0xe5a1('0x14')]['username'],_0xe5a1('0x16')][_0xe5a1('0x1f')]('\x20')));}var _0x5c32e=schema(properties['voicechannel'])[_0xe5a1('0x3')](_0x38c1c8);if(_0x5c32e[_0xe5a1('0x5e')]>0x0){return _0x234b19(_0x20e803[_0xe5a1('0x13')](0x1f4,_[_0xe5a1('0x61')](_0x5c32e,'message')[_0xe5a1('0x1f')](',\x20')));}var _0xf10512=_[_0xe5a1('0x62')](_0x13f6d9['channels'],{'uniqueid':_0x38c1c8[_0xe5a1('0x63')]});if(_0xf10512&&_0xf10512['channel']){var _0x47e0df=util[_0xe5a1('0x64')](_0xe5a1('0x65'),_0x38c1c8[_0xe5a1('0x66')]||_0x38c1c8[_0xe5a1('0x63')],_0x38c1c8[_0xe5a1('0x64')]||_0xe5a1('0x67'));return ami[_0xe5a1('0x1b')]({'action':_0xe5a1('0x68'),'channel':_0xf10512[_0xe5a1('0x69')],'file':_0x47e0df,'options':_0xe5a1('0x6a')})[_0xe5a1('0x1c')](function(_0x363f78){var _0x59cefa=_[_0xe5a1('0x62')](_0xf10512[_0xe5a1('0x6b')],{'filename':_0xe5a1('0x6c')+_0x47e0df[_0xe5a1('0x6d')]()});if(_['isNil'](_0x59cefa)){_0xf10512[_0xe5a1('0x6b')][_0xe5a1('0x5d')]({'filename':_0xe5a1('0x6c')+_0x47e0df[_0xe5a1('0x6d')](),'createdAt':moment()['format'](_0xe5a1('0x6e')),'mixmonitorid':_0x363f78[_0xe5a1('0x6f')],'status':_0xe5a1('0x70')});}else{_0x59cefa[_0xe5a1('0x6f')]=_0x363f78['mixmonitorid'];_0x59cefa[_0xe5a1('0x71')]=_0xe5a1('0x70');}_0x295695({'code':0xc8,'message':[_0x38c1c8[_0xe5a1('0x63')],_0xe5a1('0x72'),_0x363f78[_0xe5a1('0x6f')]]['join']('\x20'),'mixmonitorid':_0x363f78[_0xe5a1('0x6f')]});})[_0xe5a1('0x1e')](function(_0x3da584){_0x234b19(_0x20e803[_0xe5a1('0x13')](0x1f5,[_0x38c1c8['uniqueid'],_0x3da584[_0xe5a1('0x1d')]['toLowerCase']()][_0xe5a1('0x1f')]('\x20')));});}else{return _0x234b19(_0x20e803[_0xe5a1('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x44a2e6){var _0x2a12f7=this;return new Promise(function(_0x45e259,_0x4a31fc){if(ami[_0xe5a1('0x12')]()==![]){return _0x4a31fc(_0x2a12f7[_0xe5a1('0x13')](0x1f4,[config[_0xe5a1('0x14')]['ip'],config[_0xe5a1('0x14')]['username'],'ami\x20disconnected'][_0xe5a1('0x1f')]('\x20')));}var _0x2d1b22=schema(properties[_0xe5a1('0x73')])['validate'](_0x44a2e6);if(_0x2d1b22[_0xe5a1('0x5e')]>0x0){return _0x4a31fc(_0x2a12f7[_0xe5a1('0x13')](0x1f4,_['map'](_0x2d1b22,_0xe5a1('0x1d'))[_0xe5a1('0x1f')](',\x20')));}var _0x398ad7=_[_0xe5a1('0x62')](_0x13f6d9[_0xe5a1('0x60')],{'uniqueid':_0x44a2e6[_0xe5a1('0x63')]});if(_0x398ad7){return BPromise['resolve']()[_0xe5a1('0x1c')](function(){if(_0x398ad7['channel']){return ami[_0xe5a1('0x1b')]({'action':'StopMixMonitor','channel':_0x398ad7[_0xe5a1('0x69')],'mixmonitorid':_0x44a2e6[_0xe5a1('0x6f')]})['catch'](function(_0x1c6332){});}})[_0xe5a1('0x1c')](function(){if(_0x398ad7['destinationchannel']){return ami[_0xe5a1('0x1b')]({'action':_0xe5a1('0x74'),'channel':_0x398ad7[_0xe5a1('0x75')],'mixmonitorid':_0x44a2e6[_0xe5a1('0x6f')]})[_0xe5a1('0x1e')](function(_0x1d9155){});}})[_0xe5a1('0x1c')](function(_0x2ac575){var _0x3503cf=_[_0xe5a1('0x62')](_0x398ad7['monitors'],{'mixmonitorid':_0x44a2e6[_0xe5a1('0x6f')]});if(_0x3503cf){_0x3503cf[_0xe5a1('0x71')]=_0xe5a1('0x76');}})['then'](function(){var _0x57b373=util[_0xe5a1('0x64')](_0xe5a1('0x65'),_0x44a2e6[_0xe5a1('0x66')]||_0x44a2e6[_0xe5a1('0x63')],_0x44a2e6[_0xe5a1('0x64')]||'wav');var _0x1612ed=_[_0xe5a1('0x62')](_0x398ad7[_0xe5a1('0x6b')],{'filename':_0xe5a1('0x6c')+_0x57b373['toLowerCase']()});if(_0x1612ed){_0x1612ed['status']=_0xe5a1('0x76');}})[_0xe5a1('0x1c')](function(){_0x45e259({'code':0xc8,'message':[_0x44a2e6[_0xe5a1('0x63')],_0xe5a1('0x77')][_0xe5a1('0x1f')]('\x20')});})[_0xe5a1('0x1e')](function(_0x1b38d1){_0x4a31fc(_0x2a12f7['error'](0x1f5,[_0x44a2e6[_0xe5a1('0x63')],_0x1b38d1[_0xe5a1('0x1d')][_0xe5a1('0x6d')]()][_0xe5a1('0x1f')]('\x20')));});}else{return _0x4a31fc(_0x2a12f7[_0xe5a1('0x13')](0x1f5,_0xe5a1('0x78')));}});},'VoiceQueuesChannels':function(_0x1e85df){return new Promise(function(_0x2e56b2,_0x4e530e){var _0x4ae474=_[_0xe5a1('0x5f')](_0x13f6d9[_0xe5a1('0x79')]);_0x2e56b2({'count':_0x4ae474[_0xe5a1('0x5e')],'rows':_0x4ae474});});},'VoiceQueuesChannel':function(_0x583c31){var _0x4c550d=this;return new Promise(function(_0x40c574,_0x2d3e2e){var _0x3835c4=schema(properties[_0xe5a1('0x7a')])[_0xe5a1('0x3')](_0x583c31);if(_0x3835c4['length']>0x0){return _0x2d3e2e(_0x4c550d[_0xe5a1('0x13')](0x1f4,_[_0xe5a1('0x61')](_0x3835c4,'message')[_0xe5a1('0x1f')](',\x20')));}var _0x140bdc=_[_0xe5a1('0x62')](_0x13f6d9[_0xe5a1('0x79')],{'uniqueid':_0x583c31['uniqueid']});if(_0x140bdc){_0x40c574(_0x140bdc);}else{return _0x2d3e2e(_0x4c550d['error'](0x1f5,_0xe5a1('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x310fe0){var _0x1a0a43=this;return new Promise(function(_0x42ab42,_0x1e79ce){if(ami[_0xe5a1('0x12')]()==![]){return _0x1e79ce(_0x1a0a43[_0xe5a1('0x13')](0x1f4,[config[_0xe5a1('0x14')]['ip'],config[_0xe5a1('0x14')]['username'],_0xe5a1('0x16')][_0xe5a1('0x1f')]('\x20')));}var _0x1e362e=schema(properties[_0xe5a1('0x7b')])[_0xe5a1('0x3')](_0x310fe0);if(_0x1e362e[_0xe5a1('0x5e')]>0x0){return _0x1e79ce(_0x1a0a43[_0xe5a1('0x13')](0x1f4,_[_0xe5a1('0x61')](_0x1e362e,_0xe5a1('0x1d'))['join'](',\x20')));}var _0x9a54d2=_[_0xe5a1('0x62')](_0x13f6d9[_0xe5a1('0x79')],{'uniqueid':_0x310fe0['uniqueid']});if(_0x9a54d2&&_0x9a54d2[_0xe5a1('0x69')]){return ami[_0xe5a1('0x1b')]({'action':_0xe5a1('0x7c'),'channel':_0x9a54d2[_0xe5a1('0x69')]})[_0xe5a1('0x1c')](function(_0x2b5a63){_0x42ab42({'code':0xc8,'message':[_0x310fe0['uniqueid'],_0x2b5a63[_0xe5a1('0x1d')][_0xe5a1('0x6d')]()][_0xe5a1('0x1f')]('\x20')});})[_0xe5a1('0x1e')](function(_0x531f9d){_0x1e79ce(_0x1a0a43[_0xe5a1('0x13')](0x1f5,[_0x310fe0['uniqueid'],_0x531f9d[_0xe5a1('0x1d')][_0xe5a1('0x6d')]()][_0xe5a1('0x1f')]('\x20')));});}else{return _0x1e79ce(_0x1a0a43[_0xe5a1('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2d9b02){var _0x2954af=this;return new Promise(function(_0x14dffd,_0x3a8f70){if(ami[_0xe5a1('0x12')]()==![]){return _0x3a8f70(_0x2954af['error'](0x1f4,[config[_0xe5a1('0x14')]['ip'],config[_0xe5a1('0x14')][_0xe5a1('0x15')],_0xe5a1('0x16')][_0xe5a1('0x1f')]('\x20')));}var _0x34b7cd=schema(properties[_0xe5a1('0x7d')])[_0xe5a1('0x3')](_0x2d9b02);if(_0x34b7cd[_0xe5a1('0x5e')]>0x0){return _0x3a8f70(_0x2954af[_0xe5a1('0x13')](0x1f4,_[_0xe5a1('0x61')](_0x34b7cd,_0xe5a1('0x1d'))[_0xe5a1('0x1f')](',\x20')));}var _0x794354=_[_0xe5a1('0x62')](_0x13f6d9[_0xe5a1('0x79')],{'uniqueid':_0x2d9b02[_0xe5a1('0x63')]});if(_0x794354&&_0x794354['channel']){return ami[_0xe5a1('0x1b')]({'action':_0xe5a1('0x7e'),'channel':_0x794354[_0xe5a1('0x69')],'exten':_0x2d9b02[_0xe5a1('0x7f')],'context':_0x2d9b02[_0xe5a1('0x80')]||_0x794354[_0xe5a1('0x80')],'priority':0x1})[_0xe5a1('0x1c')](function(_0x2aeaec){_0x14dffd({'code':0xc8,'message':[_0x2d9b02[_0xe5a1('0x63')],_0x2aeaec[_0xe5a1('0x1d')][_0xe5a1('0x6d')]()][_0xe5a1('0x1f')]('\x20')});})[_0xe5a1('0x1e')](function(_0x24320a){_0x3a8f70(_0x2954af[_0xe5a1('0x13')](0x1f5,[_0x2d9b02[_0xe5a1('0x63')],_0x24320a[_0xe5a1('0x1d')][_0xe5a1('0x6d')]()]['join']('\x20')));});}else{return _0x3a8f70(_0x2954af[_0xe5a1('0x13')](0x1f5,_0xe5a1('0x78')));}});},'Agents':function(_0x278944){return new Promise(function(_0x171f8a,_0xf8c4cd){var _0x25c631=_[_0xe5a1('0x5f')](_0x13f6d9['agents']);_0x171f8a({'count':_0x25c631[_0xe5a1('0x5e')],'rows':_0x25c631});});},'Telephones':function(_0x1902d4){return new Promise(function(_0x489f51,_0x4d9ae8){var _0x23f906=_[_0xe5a1('0x5f')](_0x13f6d9['telephones']);_0x489f51({'count':_0x23f906['length'],'rows':_0x23f906});});},'Trunks':function(_0x1bba48){return new Promise(function(_0x1e6a1f,_0xe3ac2e){var _0x4fdd82=_[_0xe5a1('0x5f')](_0x13f6d9['trunks']);_0x1e6a1f({'count':_0x4fdd82[_0xe5a1('0x5e')],'rows':_0x4fdd82});});},'OutboundChannels':function(_0x473fd6){return new Promise(function(_0x52df77,_0x59115c){var _0x270079=_['values'](_0x13f6d9[_0xe5a1('0x81')]);_0x52df77({'count':_0x270079[_0xe5a1('0x5e')],'rows':_0x270079});});},'Outbound':function(_0x537cc4){return new Promise(function(_0x1fa211,_0x111069){_0x1fa211(_0x13f6d9[_0xe5a1('0x32')]);});},'Campaigns':function(_0x5147e2){return new Promise(function(_0x392448,_0x13a827){var _0x2672f9=_[_0xe5a1('0x5f')](_0x13f6d9[_0xe5a1('0x82')]);_0x392448({'count':_0x2672f9[_0xe5a1('0x5e')],'rows':_0x2672f9});});},'VoiceQueuesPreview':function(_0x2b6621){var _0x456db6=this;return new Promise(function(_0x531106,_0x4575de){_0x3d3541['run'](_0x2b6621['id'])[_0xe5a1('0x1c')](function(_0x3834c0){_0x531106({'code':0xc8,'message':_0x3834c0[_0xe5a1('0x1d')]});})[_0xe5a1('0x1e')](function(_0xcae5e7){_0x4575de(_0x456db6[_0xe5a1('0x13')](0x1f4,_0xcae5e7[_0xe5a1('0x1d')]));});});},'EventManager':function(_0x5de09d){var _0x574bb6=this;return new Promise(function(_0x4a68d0,_0x58b5a4){if(!_0x5de09d[_0xe5a1('0x83')]){return _0x58b5a4(_0x574bb6['error'](0x1f4,_0xe5a1('0x84')));}ami[_0xe5a1('0x85')](_0xe5a1('0x86')+_0x5de09d[_0xe5a1('0x83')],_0x5de09d[_0xe5a1('0x1d')]);_0x4a68d0({'code':0xc8,'message':_0x5de09d});});},'FaxAccounts':function(_0x48fbf2){return new Promise(function(_0x5d5f9a,_0x303d87){var _0x3b3fbd=_[_0xe5a1('0x5f')](_0x13f6d9[_0xe5a1('0x87')]);_0x5d5f9a({'count':_0x3b3fbd[_0xe5a1('0x5e')],'rows':_0x3b3fbd});});},'SendFax':function(_0x18fa5a){var _0x323f98=this;return new Promise(function(_0x48ba1e,_0xf978b2){_0x3cb774[_0xe5a1('0x88')](_0x18fa5a)[_0xe5a1('0x1c')](function(_0x4d5624){_0x48ba1e({'code':0xc8,'message':_0x4d5624['message']});})[_0xe5a1('0x1e')](function(_0x825b13){_0xf978b2(_0x323f98[_0xe5a1('0x13')](0x1f4,_0x825b13[_0xe5a1('0x1d')]));});});},'CheckAfterSend':function(_0x1cd3eb){var _0x340dab=this;return new Promise(function(_0x2b8405,_0x7428ce){_0x3cb774[_0xe5a1('0x89')](_0x1cd3eb)['then'](function(_0x123ec0){_0x2b8405({'code':0xc8,'message':_0x123ec0[_0xe5a1('0x1d')]});})[_0xe5a1('0x1e')](function(_0x214f8d){_0x7428ce(_0x340dab[_0xe5a1('0x13')](0x1f4,_0x214f8d['message']));});});}};var _0xc3ecaa=jayson[_0xe5a1('0x8a')](_0x8d5f9d)[_0xe5a1('0x8b')]();_0xc3ecaa['on']('error',function(_0x5400ba){return _0x2669c0(_0x5400ba);});_0xc3ecaa[_0xe5a1('0x7')](0x232a,_0xe5a1('0x8c'),function(){console[_0xe5a1('0x8d')](_0xe5a1('0x8e'),0x232a);return _0x5531b3(_0xe5a1('0x8f')+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 7c4b3af..a91b920 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 _0x4bd3=['phone','resolve','then','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','user:%s','name','format','trigger:%s','action','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','toLowerCase','bluebird','lodash','ioredis','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','routeId','firstName','calleridname','','calleridnum','uniqueid','destcalleridname','destcalleridnum'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x4bd3,0x174));var _0x34bd=function(_0x467fa3,_0x4a99f1){_0x467fa3=_0x467fa3-0x0;var _0x4e12e1=_0x4bd3[_0x467fa3];return _0x4e12e1;};'use strict';var BPromise=require(_0x34bd('0x0'));var util=require('util');var _=require(_0x34bd('0x1'));var Redis=require(_0x34bd('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x34bd('0x3'));config[_0x34bd('0x4')]=_[_0x34bd('0x5')](config['redis'],{'host':_0x34bd('0x6'),'port':0x18eb});var io=require(_0x34bd('0x7'))(new Redis(config['redis']));function emit(_0x3e8744,_0x213716,_0x51a4d7,_0xd600e1){logger[_0x34bd('0x8')](_0x34bd('0x9'),_0x3e8744,'',_0x213716,_0x51a4d7,JSON[_0x34bd('0xa')](_0xd600e1));io['to'](_0x213716)[_0x34bd('0xb')](_0x51a4d7,_0xd600e1);}exports[_0x34bd('0xc')]=function(_0x4db0ba,_0x4102c1,_0x45322f){_0x45322f[_0x34bd('0xd')]=0x0;if(_0x4102c1[_0x34bd('0xe')]&&parseInt(_0x4102c1['data2'],0xa)){var _0x4a8622={'ListId':parseInt(_0x4102c1[_0x34bd('0xf')],0xa),'phone':_0x45322f['calleridnum']};if(_['isNil'](_0x45322f[_0x34bd('0x10')])){_0x4a8622[_0x34bd('0x11')]=_0x45322f[_0x34bd('0x12')]&&_0x45322f[_0x34bd('0x12')]!==_0x34bd('0x13')?_0x45322f[_0x34bd('0x12')]:_0x45322f[_0x34bd('0x14')]||_0x45322f[_0x34bd('0x15')];}else{_0x4a8622[_0x34bd('0x11')]=_0x45322f['destcalleridname']&&_0x45322f[_0x34bd('0x16')]!==''?_0x45322f['destcalleridname']:_0x45322f[_0x34bd('0x17')]||_0x45322f[_0x34bd('0x15')];_0x4a8622[_0x34bd('0x18')]=_0x45322f[_0x34bd('0x16')]&&_0x45322f[_0x34bd('0x16')]!==_0x34bd('0x13')?_0x45322f[_0x34bd('0x16')]:_0x45322f[_0x34bd('0x17')]||_0x45322f[_0x34bd('0x15')];}BPromise[_0x34bd('0x19')]()[_0x34bd('0x1a')](cmContactRpc['showContact']({'where':_[_0x34bd('0x1b')](_0x4a8622,[_0x34bd('0x11')])}))[_0x34bd('0x1a')](function(_0x220666){if(_0x220666){logger[_0x34bd('0x8')](_0x34bd('0x1c'),_0x45322f[_0x34bd('0x15')],'',_0x220666['id']);if(_0x4db0ba){_0x45322f[_0x34bd('0x1d')]=_0x220666['id'];emit(_0x45322f[_0x34bd('0x15')],util['format'](_0x34bd('0x1e'),_0x4db0ba[_0x34bd('0x1f')]),util[_0x34bd('0x20')](_0x34bd('0x21'),_0x4102c1[_0x34bd('0x22')]['toLowerCase']()),_['merge'](_0x45322f,{'ListId':parseInt(_0x4102c1['data1'],0xa)}));}return;}else{logger['info'](_0x34bd('0x23'),_0x45322f['uniqueid'],'');return BPromise[_0x34bd('0x19')]()[_0x34bd('0x1a')](cmContactRpc[_0x34bd('0x24')](_0x4a8622));}})['then'](function(_0x41bffd){if(_0x41bffd){logger[_0x34bd('0x8')](_0x34bd('0x25'),_0x45322f[_0x34bd('0x15')],'',_0x41bffd['id']);if(_0x4db0ba){_0x45322f['xmd-contactid2']=_0x41bffd['id'];emit(_0x45322f[_0x34bd('0x15')],util[_0x34bd('0x20')](_0x34bd('0x1e'),_0x4db0ba[_0x34bd('0x1f')]),util['format'](_0x34bd('0x21'),_0x4102c1[_0x34bd('0x22')]['toLowerCase']()),_[_0x34bd('0x26')](_0x45322f,{'ListId':parseInt(_0x4102c1[_0x34bd('0xf')],0xa)}));}}})[_0x34bd('0x27')](function(_0x3f675c){logger[_0x34bd('0x28')](_0x34bd('0x29'),_0x45322f[_0x34bd('0x15')],'',JSON['stringify'](_0x3f675c));});}else{if(_0x4db0ba){logger[_0x34bd('0x8')](_0x34bd('0x2a'),_0x45322f['uniqueid'],'');emit(_0x45322f['uniqueid'],util[_0x34bd('0x20')](_0x34bd('0x1e'),_0x4db0ba[_0x34bd('0x1f')]),util['format']('trigger:%s',_0x4102c1[_0x34bd('0x22')][_0x34bd('0x2b')]()),_[_0x34bd('0x26')]({'ListId':parseInt(_0x4102c1[_0x34bd('0xf')],0xa)},_0x45322f));}}}; \ No newline at end of file +var _0xe04a=['defaults','localhost','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','resolve','showContact','omit','then','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','name','trigger:%s','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','[%s][%s]\x20Contact\x20created:%s','action','catch','[%s][%s]\x20Error\x20creating\x20contact','bluebird','lodash','trigger','redis'];(function(_0x206302,_0xbb45ff){var _0x5c386b=function(_0x2bc236){while(--_0x2bc236){_0x206302['push'](_0x206302['shift']());}};_0x5c386b(++_0xbb45ff);}(_0xe04a,0x196));var _0xae04=function(_0x5e9799,_0x48dc79){_0x5e9799=_0x5e9799-0x0;var _0x4c4a25=_0xe04a[_0x5e9799];return _0x4c4a25;};'use strict';var BPromise=require(_0xae04('0x0'));var util=require('util');var _=require(_0xae04('0x1'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xae04('0x2'));var cmContactRpc=require('../../rpc/cmContact');config[_0xae04('0x3')]=_[_0xae04('0x4')](config['redis'],{'host':_0xae04('0x5'),'port':0x18eb});var io=require(_0xae04('0x6'))(new Redis(config[_0xae04('0x3')]));function emit(_0x1b499d,_0x1665fd,_0x195b87,_0x3fd94f){logger[_0xae04('0x7')]('[%s][%s]',_0x1b499d,'',_0x1665fd,_0x195b87,JSON[_0xae04('0x8')](_0x3fd94f));io['to'](_0x1665fd)[_0xae04('0x9')](_0x195b87,_0x3fd94f);}exports[_0xae04('0xa')]=function(_0x3ab45e,_0x1b863a,_0xf27e54){_0xf27e54[_0xae04('0xb')]=0x0;if(_0x1b863a['data2']&&parseInt(_0x1b863a[_0xae04('0xc')],0xa)){var _0x4c0a67={'ListId':parseInt(_0x1b863a[_0xae04('0xd')],0xa),'phone':_0xf27e54[_0xae04('0xe')]};if(_[_0xae04('0xf')](_0xf27e54[_0xae04('0x10')])){_0x4c0a67['firstName']=_0xf27e54['calleridname']&&_0xf27e54[_0xae04('0x11')]!==_0xae04('0x12')?_0xf27e54[_0xae04('0x11')]:_0xf27e54['calleridnum']||_0xf27e54[_0xae04('0x13')];}else{_0x4c0a67[_0xae04('0x14')]=_0xf27e54['destcalleridname']&&_0xf27e54[_0xae04('0x15')]!==''?_0xf27e54['destcalleridname']:_0xf27e54[_0xae04('0x16')]||_0xf27e54[_0xae04('0x13')];_0x4c0a67[_0xae04('0x17')]=_0xf27e54[_0xae04('0x15')]&&_0xf27e54[_0xae04('0x15')]!==_0xae04('0x12')?_0xf27e54[_0xae04('0x15')]:_0xf27e54[_0xae04('0x16')]||_0xf27e54[_0xae04('0x13')];}BPromise[_0xae04('0x18')]()['then'](cmContactRpc[_0xae04('0x19')]({'where':_[_0xae04('0x1a')](_0x4c0a67,[_0xae04('0x14')])}))[_0xae04('0x1b')](function(_0x528c24){if(_0x528c24){logger[_0xae04('0x7')](_0xae04('0x1c'),_0xf27e54[_0xae04('0x13')],'',_0x528c24['id']);if(_0x3ab45e){_0xf27e54[_0xae04('0x1d')]=_0x528c24['id'];emit(_0xf27e54[_0xae04('0x13')],util[_0xae04('0x1e')](_0xae04('0x1f'),_0x3ab45e[_0xae04('0x20')]),util[_0xae04('0x1e')](_0xae04('0x21'),_0x1b863a['action'][_0xae04('0x22')]()),_[_0xae04('0x23')](_0xf27e54,{'ListId':parseInt(_0x1b863a[_0xae04('0xd')],0xa)}));}return;}else{logger[_0xae04('0x7')](_0xae04('0x24'),_0xf27e54['uniqueid'],'');return BPromise[_0xae04('0x18')]()['then'](cmContactRpc['createContact'](_0x4c0a67));}})[_0xae04('0x1b')](function(_0x1ef3b5){if(_0x1ef3b5){logger['info'](_0xae04('0x25'),_0xf27e54['uniqueid'],'',_0x1ef3b5['id']);if(_0x3ab45e){_0xf27e54[_0xae04('0x1d')]=_0x1ef3b5['id'];emit(_0xf27e54[_0xae04('0x13')],util[_0xae04('0x1e')](_0xae04('0x1f'),_0x3ab45e[_0xae04('0x20')]),util[_0xae04('0x1e')](_0xae04('0x21'),_0x1b863a[_0xae04('0x26')][_0xae04('0x22')]()),_[_0xae04('0x23')](_0xf27e54,{'ListId':parseInt(_0x1b863a[_0xae04('0xd')],0xa)}));}}})[_0xae04('0x27')](function(_0x29214a){logger['error'](_0xae04('0x28'),_0xf27e54[_0xae04('0x13')],'',JSON['stringify'](_0x29214a));});}else{if(_0x3ab45e){logger[_0xae04('0x7')]('[%s][%s]\x20Autocreate\x20disabled',_0xf27e54[_0xae04('0x13')],'');emit(_0xf27e54['uniqueid'],util['format'](_0xae04('0x1f'),_0x3ab45e['name']),util['format'](_0xae04('0x21'),_0x1b863a[_0xae04('0x26')][_0xae04('0x22')]()),_['merge']({'ListId':parseInt(_0x1b863a[_0xae04('0xd')],0xa)},_0xf27e54));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9815d5c..3052c97 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 _0x24e4=['800','data5','data6','winApplication','format','name','trigger:%s:%s','user:%s','data1','exec','queue','routeId','script','parse','query','search','replace','checkTrigger','AllConditions','length','every','checkConditions','AnyConditions','channel','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','info','emit','clone','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','action','toLowerCase','contactmanager','browser','popup','TemplateId','data2','render','html','uri','buildUri','isNil','data3','location','data4'];(function(_0x3ffd67,_0x25ed4d){var _0x5d3f57=function(_0x22aaa9){while(--_0x22aaa9){_0x3ffd67['push'](_0x3ffd67['shift']());}};_0x5d3f57(++_0x25ed4d);}(_0x24e4,0x10e));var _0x424e=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x24e4[_0x1e3671];return _0x48d5f5;};'use strict';var util=require(_0x424e('0x0'));var _=require(_0x424e('0x1'));var url=require(_0x424e('0x2'));var Mustache=require(_0x424e('0x3'));var Redis=require(_0x424e('0x4'));var urlforward=require(_0x424e('0x5'));var integration=require(_0x424e('0x6'));var cmContact=require('./cmContact');var script=require(_0x424e('0x7'));var cmContactRpc=require(_0x424e('0x8'));var config=require(_0x424e('0x9'));var logger=require(_0x424e('0xa'))(_0x424e('0xb'));var ami=require(_0x424e('0xc'));config[_0x424e('0xd')]=_[_0x424e('0xe')](config[_0x424e('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x424e('0xf'))(new Redis(config['redis']));var operators={'equals':function(_0xfacb11,_0x1d26e7){return _0xfacb11==_0x1d26e7;},'not_equals':function(_0x5295b8,_0xbb329e){return _0x5295b8!=_0xbb329e;}};var barAndWebActions=['popup',_0x424e('0x2'),_0x424e('0x10')];function Trigger(_0x3dda80){this[_0x424e('0x11')]=_0x3dda80['triggers'];this[_0x424e('0x12')]=_0x3dda80[_0x424e('0x12')];this[_0x424e('0x13')]=_0x3dda80[_0x424e('0x13')];this['templates']=_0x3dda80[_0x424e('0x14')];this[_0x424e('0x15')]=_0x3dda80[_0x424e('0x15')];this[_0x424e('0x16')]=_0x3dda80[_0x424e('0x16')];this[_0x424e('0x17')]=_0x3dda80[_0x424e('0x17')];this['salesforceAccounts']=_0x3dda80[_0x424e('0x18')];this[_0x424e('0x19')]=_0x3dda80[_0x424e('0x19')];this['zohoAccounts']=_0x3dda80[_0x424e('0x1a')];this[_0x424e('0x1b')]=_0x3dda80['deskAccounts'];this['vtigerAccounts']=_0x3dda80[_0x424e('0x1c')];this[_0x424e('0x1d')]=_0x3dda80[_0x424e('0x1d')];this['dynamics365Accounts']=_0x3dda80[_0x424e('0x1e')];this[_0x424e('0x1f')]=_0x3dda80[_0x424e('0x1f')];this[_0x424e('0x20')]={'zendesk':this[_0x424e('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x424e('0x17')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x424e('0x1a')],'desk':this[_0x424e('0x1b')],'vtiger':this[_0x424e('0x1c')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x424e('0x1f')],'servicenow':this[_0x424e('0x1d')]};ami['on'](_0x424e('0x21'),this[_0x424e('0x22')]['bind'](this));ami['on']('custom:agentconnect',this[_0x424e('0x22')]['bind'](this));ami['on'](_0x424e('0x23'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x25'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x26'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on']('custom:agentnoanswer',this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x27'),this[_0x424e('0x22')]['bind'](this));ami['on'](_0x424e('0x28'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x29'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x2a'),this['syncCustomEvent'][_0x424e('0x24')](this));ami['on'](_0x424e('0x2b'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x2c'),this[_0x424e('0x2d')][_0x424e('0x24')](this));ami['on'](_0x424e('0x2e'),this[_0x424e('0x2d')][_0x424e('0x24')](this));ami['on']('custom:dialend',this[_0x424e('0x2d')][_0x424e('0x24')](this));ami['on'](_0x424e('0x2f'),this[_0x424e('0x22')]['bind'](this));ami['on'](_0x424e('0x30'),this['syncCustomEvent'][_0x424e('0x24')](this));ami['on'](_0x424e('0x31'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x32'),this[_0x424e('0x22')][_0x424e('0x24')](this));ami['on'](_0x424e('0x33'),this['syncCustomEvent'][_0x424e('0x24')](this));ami['on']('custom:rejectmessage',this[_0x424e('0x22')][_0x424e('0x24')](this));}Trigger[_0x424e('0x34')]['emit']=function(_0x31e449,_0x408113,_0x13f122){logger[_0x424e('0x35')](_0x31e449,_0x408113,JSON['stringify'](_0x13f122));io['to'](_0x31e449)[_0x424e('0x36')](_0x408113,_0x13f122);};Trigger['prototype'][_0x424e('0x22')]=function(_0x189b41){var _0x5be239=_[_0x424e('0x37')](_0x189b41);this[_0x424e('0x38')](_0x5be239);};Trigger['prototype'][_0x424e('0x2d')]=function(_0x1b7d37){if(this[_0x424e('0x12')][_0x1b7d37[_0x424e('0x39')]]){this[_0x424e('0x22')](_0x1b7d37);}};Trigger[_0x424e('0x34')][_0x424e('0x38')]=function(_0x25044f){var _0x5d20d6;for(var _0xda5b7b in this[_0x424e('0x11')]){if(this['triggers'][_0x424e('0x3a')](_0xda5b7b)){if(this[_0x424e('0x11')][_0xda5b7b][_0x424e('0x3b')]){_0x5d20d6=this['checkTrigger'](this[_0x424e('0x11')][_0xda5b7b],_0x25044f);if(_0x5d20d6){_[_0x424e('0x3c')](_0x25044f,_0x25044f[_0x424e('0x3d')]);for(var _0x389601=0x0,_0x1a6ebe,_0x1ae13e,_0x3694db;_0x3896010x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 91f81eb..383d9ed 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 _0x3bdc=['lodash','bluebird','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','POST','headers','odata-entityid','substring','lastIndexOf','enduserId','message','4.0','calleridnum',']\x20Enduser\x20created!','forEach','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecalls','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3bdc,0xc2));var _0xc3bd=function(_0x1b846d,_0x54219e){_0x1b846d=_0x1b846d-0x0;var _0x37bebd=_0x3bdc[_0x1b846d];return _0x37bebd;};'use strict';var _=require(_0xc3bd('0x0'));var BPromise=require(_0xc3bd('0x1'));var rp=require('request-promise');var util=require(_0xc3bd('0x2'));var intUtil=require(_0xc3bd('0x3'));var md5=require(_0xc3bd('0x4'));var Redis=require('ioredis');var logger=require(_0xc3bd('0x5'))(_0xc3bd('0x6'));var config=require(_0xc3bd('0x7'));config[_0xc3bd('0x8')]=_[_0xc3bd('0x9')](config[_0xc3bd('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc3bd('0xa'))(new Redis(config[_0xc3bd('0x8')]));function getAuthToken(_0x3aee24,_0x380849,_0x7a7dbd){var _0x35d621={'method':'POST','uri':_0x380849,'form':{'client_id':_0x3aee24[_0xc3bd('0xb')],'resource':_0x3aee24[_0xc3bd('0xc')],'username':_0x3aee24[_0xc3bd('0xd')],'password':_0x3aee24[_0xc3bd('0xe')],'grant_type':_0xc3bd('0xe'),'client_secret':_0x3aee24[_0xc3bd('0xf')]},'json':!![]};return rp(_0x35d621)[_0xc3bd('0x10')](function(_0x3015af){return _0x3015af[_0xc3bd('0x11')];})[_0xc3bd('0x12')](function(_0x59f9e1){logger[_0xc3bd('0x13')]('['+[_0x7a7dbd['toUpperCase']()]+_0xc3bd('0x14'));return _0x59f9e1['message'];});}function getUser(_0x1e9e4e,_0x5a7e9f,_0x2c56b5,_0x5b4e8c,_0x19e843,_0x1b4e14){return new BPromise(function(_0x439cb5,_0x2348b9){return getAuthToken(_0x5a7e9f,_0x5b4e8c,_0x1b4e14)['then'](function(_0x615484){var _0x603a15={'method':_0xc3bd('0x15'),'uri':_0x19e843+_0xc3bd('0x16'),'headers':{'Authorization':_0xc3bd('0x17')+_0x615484,'OData-Version':'4.0'},'json':!![]};return rp(_0x603a15);})[_0xc3bd('0x10')](function(_0x3fec33){var _0x1f9cb5=_0x3fec33[_0xc3bd('0x18')];var _0x9cb6fa=![];var _0x3e4bed=null;if(!_[_0xc3bd('0x19')](_0x2c56b5)){if(intUtil[_0xc3bd('0x1a')](_0x2c56b5[_0xc3bd('0x1b')])){_0x1e9e4e[_0xc3bd('0x1c')]=_0x2c56b5[_0xc3bd('0x1b')];for(_0x3e4bed=0x0;_0x3e4bed<_0x1f9cb5[_0xc3bd('0x1d')];_0x3e4bed++){if(_0x1f9cb5[_0x3e4bed][_0xc3bd('0x1e')]===_0x2c56b5[_0xc3bd('0x1b')]&&!_0x1f9cb5[_0x3e4bed]['isdisabled']){_0x9cb6fa=!![];logger[_0xc3bd('0x1f')]('['+[_0x1b4e14[_0xc3bd('0x20')]()]+_0xc3bd('0x21')+_0x1f9cb5[_0x3e4bed][_0xc3bd('0x22')]+'!');_0x1e9e4e[_0xc3bd('0x23')]=_0x1f9cb5[_0x3e4bed]['systemuserid'];}}}}if(!_0x9cb6fa){logger[_0xc3bd('0x1f')]('['+[_0x1b4e14[_0xc3bd('0x20')]()]+_0xc3bd('0x24'));_0x1e9e4e[_0xc3bd('0x1c')]=_0x5a7e9f[_0xc3bd('0xd')];for(_0x3e4bed=0x0;_0x3e4bed<_0x1f9cb5['length'];_0x3e4bed++){if(_0x1f9cb5[_0x3e4bed]['internalemailaddress']===_0x5a7e9f['username']){_0x1e9e4e[_0xc3bd('0x23')]=_0x1f9cb5[_0x3e4bed][_0xc3bd('0x22')];}}}_0x439cb5(_0x1e9e4e);})['catch'](function(_0x3e768c){_0x2348b9(_0x3e768c['message']);});});}function createEndUser(_0x2cc451,_0xcd20c4,_0x31d464,_0x145cc,_0x347ec7,_0x5beacb){return new BPromise(function(_0x79ce28,_0x3303df){return getAuthToken(_0xcd20c4,_0x31d464,_0x5beacb)['then'](function(_0x4bb527){var _0x13f225=_0x5beacb[_0xc3bd('0x25')]()===_0xc3bd('0x26')?_0x347ec7[_0xc3bd('0x27')]:_0x347ec7['calleridnum'];var _0x4e1103={'method':_0xc3bd('0x28'),'uri':_0x145cc+'contacts','body':{'telephone1':_0x13f225,'fullname':_0x13f225,'firstname':_0x13f225,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2cc451[_0xc3bd('0x23')]+')'},'headers':{'Authorization':_0xc3bd('0x17')+_0x4bb527,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4e1103);})[_0xc3bd('0x10')](function(_0x119e46){var _0x5c35c7=_0x119e46[_0xc3bd('0x29')][_0xc3bd('0x2a')];var _0x366985=_0x5c35c7[_0xc3bd('0x2b')](_0x5c35c7[_0xc3bd('0x2c')]('(')+0x1,_0x5c35c7[_0xc3bd('0x2c')](')'));_0x2cc451[_0xc3bd('0x2d')]=_0x366985;_0x79ce28(_0x2cc451);})[_0xc3bd('0x12')](function(_0x3d32da){_0x3303df(_0x3d32da[_0xc3bd('0x2e')]);});});}function getEndUser(_0x4b49a0,_0x6b372e,_0x46c0e2,_0x5b437e,_0x111eb9,_0x3095e9){return new BPromise(function(_0x1adecf,_0x5c7924){return getAuthToken(_0x6b372e,_0x46c0e2,_0x3095e9)[_0xc3bd('0x10')](function(_0x387603){var _0xc94dd5={'method':_0xc3bd('0x15'),'uri':_0x5b437e+'contacts?$select=telephone1','headers':{'Authorization':_0xc3bd('0x17')+_0x387603,'If-None-Match':null,'OData-Version':_0xc3bd('0x2f')},'json':!![]};return rp(_0xc94dd5);})[_0xc3bd('0x10')](function(_0x1fe23c){var _0x1803b6=null;if(_0x1fe23c){var _0x3873ed=_0x1fe23c[_0xc3bd('0x18')];var _0x2d493b=![];for(_0x1803b6=0x0;_0x1803b6<_0x3873ed['length'];_0x1803b6++){var _0x35b156=_0x3095e9['toLowerCase']()==='outbound'?_0x111eb9[_0xc3bd('0x27')]:_0x111eb9[_0xc3bd('0x30')];if(_0x3873ed[_0x1803b6]['telephone1']===_0x35b156){_0x2d493b=!![];_0x4b49a0[_0xc3bd('0x2d')]=_0x3873ed[_0x1803b6]['contactid'];}}if(_0x2d493b){_0x1adecf(_0x4b49a0);}else{return createEndUser(_0x4b49a0,_0x6b372e,_0x46c0e2,_0x5b437e,_0x111eb9,_0x3095e9)[_0xc3bd('0x10')](function(_0x286505){logger[_0xc3bd('0x1f')]('['+[_0x3095e9[_0xc3bd('0x20')]()]+_0xc3bd('0x31'),_0x286505['enduserId']);_0x1adecf(_0x286505);});}}else{return createEndUser(_0x4b49a0,_0x6b372e,_0x46c0e2,_0x5b437e,_0x111eb9,_0x3095e9)[_0xc3bd('0x10')](function(_0x58641a){logger[_0xc3bd('0x1f')]('['+[_0x3095e9[_0xc3bd('0x20')]()]+']\x20Enduser\x20Created!',_0x58641a[_0xc3bd('0x2d')]);_0x1adecf(_0x58641a);});}});});}function getCustomFields(_0x4fb191,_0x54d132,_0x2f50bd){var _0x3f8c98={};if(_0x4fb191[_0xc3bd('0x1d')]>0x0){_[_0xc3bd('0x32')](_0x4fb191,function(_0x2f8a30){if(_0x2f8a30['type']==='string'&&_0x2f8a30[_0xc3bd('0x33')]&&!_0x2f8a30[_0xc3bd('0x34')]){var _0x3e38cd=_0x2f8a30[_0xc3bd('0x35')][_0xc3bd('0x25')]();var _0xaa5503=_0x3e38cd[_0xc3bd('0x2b')](0x0,_0x3e38cd[_0xc3bd('0x36')]('_'));var _0x4531dd=_0x3e38cd[_0xc3bd('0x2b')](_0x3e38cd['indexOf']('_')+0x1);if(_0xaa5503===_0x2f50bd){_0x3f8c98[_0x4531dd]=_0x2f8a30[_0xc3bd('0x37')];}}});}return _0x3f8c98;}function getTicket(_0x5469e5,_0x4d6660,_0x23dedb,_0x2e95ed,_0x23c73f,_0x1a0cba,_0x57fe0f){return new BPromise(function(_0x3f56c5,_0x575df2){var _0x200e0f;return getAuthToken(_0x4d6660,_0x23dedb,_0x57fe0f)[_0xc3bd('0x10')](function(_0x158065){if(_0x1a0cba[_0xc3bd('0x38')]===_0xc3bd('0x39')){_0x200e0f={'method':'POST','uri':_0x2e95ed+_0xc3bd('0x3a'),'body':Object['assign']({},{'title':intUtil[_0xc3bd('0x3b')](_0x1a0cba[_0xc3bd('0x3c')],_0x23c73f,'\x20'),'description':intUtil[_0xc3bd('0x3b')](_0x1a0cba[_0xc3bd('0x3d')],_0x23c73f,'\x0a'),'customerid_contact@odata.bind':_0xc3bd('0x3e')+_0x5469e5['enduserId']+')','ownerid@odata.bind':_0xc3bd('0x3f')+_0x5469e5[_0xc3bd('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x1a0cba[_0xc3bd('0x40')],_0x23c73f,_0x1a0cba['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x158065,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1a0cba[_0xc3bd('0x38')]==='phonecall'){_0x200e0f={'method':_0xc3bd('0x28'),'uri':_0x2e95ed+_0xc3bd('0x41'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x1a0cba['Subjects'],_0x23c73f,'\x20'),'phonenumber':String(_0x23c73f[_0xc3bd('0x30')]),'description':intUtil['getString'](_0x1a0cba[_0xc3bd('0x3d')],_0x23c73f,'\x0a'),'regardingobjectid_contact@odata.bind':_0xc3bd('0x3e')+_0x5469e5['enduserId']+')','ownerid@odata.bind':_0xc3bd('0x3f')+_0x5469e5[_0xc3bd('0x23')]+')','directioncode':_0x5469e5[_0xc3bd('0x42')]===_0xc3bd('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xc3bd('0x3f')+_0x5469e5[_0xc3bd('0x23')]+')','participationtypemask':_0x5469e5[_0xc3bd('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5469e5[_0xc3bd('0x2d')]+')','participationtypemask':_0x5469e5[_0xc3bd('0x42')]==='queue'?0x1:0x2}]},getCustomFields(_0x1a0cba[_0xc3bd('0x40')],_0x23c73f,_0x1a0cba['ticketType'])),'headers':{'Authorization':_0xc3bd('0x17')+_0x158065,'OData-Version':_0xc3bd('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x200e0f);})['then'](function(_0xa2a895){var _0x20be9a=_0xa2a895[_0xc3bd('0x29')][_0xc3bd('0x2a')];var _0x31101d=_0x20be9a[_0xc3bd('0x2b')](_0x20be9a['lastIndexOf']('(')+0x1,_0x20be9a[_0xc3bd('0x2c')](')'));_0x5469e5['ticketId']=_0x31101d;_0x3f56c5(_0x5469e5);})[_0xc3bd('0x12')](function(_0x54a513){_0x575df2(_0x54a513['message']);});});}function emit(_0x35c561,_0x3f7ae9,_0x1391c1,_0x475cad){var _0x2c9c5c={'uri':util[_0xc3bd('0x44')](_0xc3bd('0x45'),_0x35c561,_0x1391c1,_0x475cad)};io['to'](util[_0xc3bd('0x44')](_0xc3bd('0x46'),_0x3f7ae9))[_0xc3bd('0x47')](_0xc3bd('0x48'),_0x2c9c5c);}exports['cs']=function(_0x4d6d0c,_0x3f2797,_0x43c95b,_0x210ee6,_0x369e3a,_0x20a6e0,_0x483b6f,_0x9334e1){var _0xa5b71c={};_0x20a6e0[_0xc3bd('0xc')]=intUtil[_0xc3bd('0x49')](_0x20a6e0[_0xc3bd('0xc')]);_0x20a6e0['serverUrl']=intUtil['stripTrailingSlash'](_0x20a6e0[_0xc3bd('0x4a')]);_0xa5b71c[_0xc3bd('0x42')]=_0x9334e1==='queue'||_0x9334e1===_0xc3bd('0x4b')?'queue':_0xc3bd('0x26');var _0x33bf14=util[_0xc3bd('0x44')](_0xc3bd('0x4c'),_0x20a6e0[_0xc3bd('0xc')]);var _0x4263cc=util['format'](_0xc3bd('0x4d'),_0x20a6e0[_0xc3bd('0x4e')]);var _0xfe7d7b=util[_0xc3bd('0x44')](_0xc3bd('0x4f'),_0x20a6e0['serverUrl'],_0x3f2797['uniqueid'],md5(_0x3f2797[_0xc3bd('0x50')]));if(_0x369e3a&&_0x369e3a[_0xc3bd('0x51')]){logger['info']('[QUEUE]',_0xc3bd('0x52'));_0x3f2797[_0xc3bd('0x53')]=_0xfe7d7b;}else if(_0x483b6f&&_0x483b6f[_0xc3bd('0x54')]&&_0x483b6f[_0xc3bd('0x54')]!=='none'){logger['info'](_0xc3bd('0x55'),_0xc3bd('0x52'));_0x3f2797[_0xc3bd('0x53')]=_0xfe7d7b;}else{_0x3f2797['recordingURL']='';}return getUser(_0xa5b71c,_0x20a6e0,_0x210ee6,_0x4263cc,_0x33bf14,_0x9334e1)[_0xc3bd('0x10')](function(_0x1c4edd){logger[_0xc3bd('0x1f')]('['+_0x9334e1[_0xc3bd('0x20')]()+_0xc3bd('0x56'),_0x1c4edd[_0xc3bd('0x23')]);logger[_0xc3bd('0x1f')]('['+_0x9334e1[_0xc3bd('0x20')]()+_0xc3bd('0x57'),_0x1c4edd[_0xc3bd('0x1c')]);return getEndUser(_0x1c4edd,_0x20a6e0,_0x4263cc,_0x33bf14,_0x3f2797,_0x9334e1);})['then'](function(_0x4da11c){logger[_0xc3bd('0x1f')]('['+_0x9334e1['toUpperCase']()+_0xc3bd('0x58'),_0x4da11c[_0xc3bd('0x2d')]);logger[_0xc3bd('0x1f')]('['+_0x9334e1[_0xc3bd('0x20')]()+_0xc3bd('0x59'),_0x3f2797[_0xc3bd('0x30')]);return getTicket(_0x4da11c,_0x20a6e0,_0x4263cc,_0x33bf14,_0x3f2797,_0x43c95b,_0x9334e1);})[_0xc3bd('0x10')](function(_0x208e07){logger[_0xc3bd('0x1f')](util[_0xc3bd('0x44')]('['+_0x9334e1['toUpperCase']()+_0xc3bd('0x5a'),_0x43c95b[_0xc3bd('0x38')],_0x208e07[_0xc3bd('0x5b')]));logger['info'](util[_0xc3bd('0x44')]('['+_0x9334e1[_0xc3bd('0x20')]()+_0xc3bd('0x5c'),_0x9334e1));if(_0x9334e1!==_0xc3bd('0x4b')){logger[_0xc3bd('0x1f')]('['+_0x9334e1[_0xc3bd('0x20')]()+']',_0xc3bd('0x5d'));emit(_0x20a6e0[_0xc3bd('0xc')],_0x210ee6[_0xc3bd('0x5e')],_0x43c95b[_0xc3bd('0x38')],_0x208e07['ticketId']);}})[_0xc3bd('0x12')](function(_0x58e5b8){logger[_0xc3bd('0x13')]('['+_0x9334e1[_0xc3bd('0x20')]()+_0xc3bd('0x5f'),util[_0xc3bd('0x60')](_0x58e5b8,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa81a=['phonecalls','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','username','clientSecret','then','access_token','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','userId','headers','substring','lastIndexOf','enduserId','catch','value','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','nameField','customField','idField','indexOf','content','ticketType','incident','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','POST'];(function(_0x10910c,_0x3c241c){var _0x264910=function(_0xbd610e){while(--_0xbd610e){_0x10910c['push'](_0x10910c['shift']());}};_0x264910(++_0x3c241c);}(_0xa81a,0xdd));var _0xaa81=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0xa81a[_0x4b6507];return _0x2001ec;};'use strict';var _=require(_0xaa81('0x0'));var BPromise=require(_0xaa81('0x1'));var rp=require(_0xaa81('0x2'));var util=require('util');var intUtil=require(_0xaa81('0x3'));var md5=require(_0xaa81('0x4'));var Redis=require(_0xaa81('0x5'));var logger=require(_0xaa81('0x6'))(_0xaa81('0x7'));var config=require(_0xaa81('0x8'));config[_0xaa81('0x9')]=_[_0xaa81('0xa')](config['redis'],{'host':_0xaa81('0xb'),'port':0x18eb});var io=require(_0xaa81('0xc'))(new Redis(config['redis']));function getAuthToken(_0x59baef,_0x5643d4,_0x59e549){var _0x327752={'method':'POST','uri':_0x5643d4,'form':{'client_id':_0x59baef[_0xaa81('0xd')],'resource':_0x59baef[_0xaa81('0xe')],'username':_0x59baef[_0xaa81('0xf')],'password':_0x59baef['password'],'grant_type':'password','client_secret':_0x59baef[_0xaa81('0x10')]},'json':!![]};return rp(_0x327752)[_0xaa81('0x11')](function(_0x12e2bf){return _0x12e2bf[_0xaa81('0x12')];})['catch'](function(_0x5df4f9){logger[_0xaa81('0x13')]('['+[_0x59e549[_0xaa81('0x14')]()]+']\x20Wrong\x20credentials!');return _0x5df4f9['message'];});}function getUser(_0x4c5ca2,_0x1485e5,_0x2ccb70,_0x5e612a,_0x5a5752,_0x2ecd78){return new BPromise(function(_0x3b25ed,_0x14fb07){return getAuthToken(_0x1485e5,_0x5e612a,_0x2ecd78)[_0xaa81('0x11')](function(_0x8ecf5b){var _0x531ba6={'method':_0xaa81('0x15'),'uri':_0x5a5752+_0xaa81('0x16'),'headers':{'Authorization':_0xaa81('0x17')+_0x8ecf5b,'OData-Version':_0xaa81('0x18')},'json':!![]};return rp(_0x531ba6);})[_0xaa81('0x11')](function(_0x34db42){var _0x57f8a6=_0x34db42['value'];var _0x1dd71e=![];var _0x5106c6=null;if(!_[_0xaa81('0x19')](_0x2ccb70)){if(intUtil[_0xaa81('0x1a')](_0x2ccb70[_0xaa81('0x1b')])){_0x4c5ca2[_0xaa81('0x1c')]=_0x2ccb70[_0xaa81('0x1b')];for(_0x5106c6=0x0;_0x5106c6<_0x57f8a6['length'];_0x5106c6++){if(_0x57f8a6[_0x5106c6][_0xaa81('0x1d')]===_0x2ccb70[_0xaa81('0x1b')]&&!_0x57f8a6[_0x5106c6]['isdisabled']){_0x1dd71e=!![];logger[_0xaa81('0x1e')]('['+[_0x2ecd78[_0xaa81('0x14')]()]+_0xaa81('0x1f')+_0x57f8a6[_0x5106c6][_0xaa81('0x20')]+'!');_0x4c5ca2['userId']=_0x57f8a6[_0x5106c6][_0xaa81('0x20')];}}}}if(!_0x1dd71e){logger[_0xaa81('0x1e')]('['+[_0x2ecd78[_0xaa81('0x14')]()]+_0xaa81('0x21'));_0x4c5ca2['userEmail']=_0x1485e5[_0xaa81('0xf')];for(_0x5106c6=0x0;_0x5106c6<_0x57f8a6[_0xaa81('0x22')];_0x5106c6++){if(_0x57f8a6[_0x5106c6][_0xaa81('0x1d')]===_0x1485e5[_0xaa81('0xf')]){_0x4c5ca2['userId']=_0x57f8a6[_0x5106c6][_0xaa81('0x20')];}}}_0x3b25ed(_0x4c5ca2);})['catch'](function(_0x287a04){_0x14fb07(_0x287a04[_0xaa81('0x23')]);});});}function createEndUser(_0x51aaa0,_0x33bbcf,_0x10160f,_0x4fefa2,_0x26d225,_0x1888d6){return new BPromise(function(_0x8f161f,_0x364e2d){return getAuthToken(_0x33bbcf,_0x10160f,_0x1888d6)[_0xaa81('0x11')](function(_0x3b9760){var _0x15a08e=_0x1888d6[_0xaa81('0x24')]()===_0xaa81('0x25')?_0x26d225[_0xaa81('0x26')]:_0x26d225[_0xaa81('0x27')];var _0x591205={'method':'POST','uri':_0x4fefa2+_0xaa81('0x28'),'body':{'telephone1':_0x15a08e,'fullname':_0x15a08e,'firstname':_0x15a08e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xaa81('0x29')+_0x51aaa0[_0xaa81('0x2a')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x3b9760,'OData-Version':_0xaa81('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x591205);})[_0xaa81('0x11')](function(_0x45943f){var _0x463b32=_0x45943f[_0xaa81('0x2b')]['odata-entityid'];var _0x2b8709=_0x463b32[_0xaa81('0x2c')](_0x463b32[_0xaa81('0x2d')]('(')+0x1,_0x463b32[_0xaa81('0x2d')](')'));_0x51aaa0[_0xaa81('0x2e')]=_0x2b8709;_0x8f161f(_0x51aaa0);})[_0xaa81('0x2f')](function(_0x131b99){_0x364e2d(_0x131b99[_0xaa81('0x23')]);});});}function getEndUser(_0x18f741,_0x24ed14,_0x2903c9,_0x45d213,_0x54108d,_0x3875f0){return new BPromise(function(_0x5b28b8,_0x44f3e0){return getAuthToken(_0x24ed14,_0x2903c9,_0x3875f0)['then'](function(_0x78549f){var _0x50f438={'method':_0xaa81('0x15'),'uri':_0x45d213+'contacts?$select=telephone1','headers':{'Authorization':_0xaa81('0x17')+_0x78549f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x50f438);})[_0xaa81('0x11')](function(_0x4371dd){var _0x50df01=null;if(_0x4371dd){var _0x1343bb=_0x4371dd[_0xaa81('0x30')];var _0x43bf6a=![];for(_0x50df01=0x0;_0x50df01<_0x1343bb[_0xaa81('0x22')];_0x50df01++){var _0x1587c5=_0x3875f0[_0xaa81('0x24')]()===_0xaa81('0x25')?_0x54108d[_0xaa81('0x26')]:_0x54108d[_0xaa81('0x27')];if(_0x1343bb[_0x50df01][_0xaa81('0x31')]===_0x1587c5){_0x43bf6a=!![];_0x18f741['enduserId']=_0x1343bb[_0x50df01]['contactid'];}}if(_0x43bf6a){_0x5b28b8(_0x18f741);}else{return createEndUser(_0x18f741,_0x24ed14,_0x2903c9,_0x45d213,_0x54108d,_0x3875f0)[_0xaa81('0x11')](function(_0x2f7245){logger[_0xaa81('0x1e')]('['+[_0x3875f0[_0xaa81('0x14')]()]+_0xaa81('0x32'),_0x2f7245[_0xaa81('0x2e')]);_0x5b28b8(_0x2f7245);});}}else{return createEndUser(_0x18f741,_0x24ed14,_0x2903c9,_0x45d213,_0x54108d,_0x3875f0)['then'](function(_0x2c006e){logger[_0xaa81('0x1e')]('['+[_0x3875f0['toUpperCase']()]+_0xaa81('0x33'),_0x2c006e['enduserId']);_0x5b28b8(_0x2c006e);});}});});}function getCustomFields(_0x581f28,_0x501945,_0x23ee8b){var _0x12ea4e={};if(_0x581f28[_0xaa81('0x22')]>0x0){_[_0xaa81('0x34')](_0x581f28,function(_0x440b81){if(_0x440b81['type']==='string'&&_0x440b81[_0xaa81('0x35')]&&!_0x440b81[_0xaa81('0x36')]){var _0x209367=_0x440b81[_0xaa81('0x37')][_0xaa81('0x24')]();var _0x4faff3=_0x209367[_0xaa81('0x2c')](0x0,_0x209367[_0xaa81('0x38')]('_'));var _0x14dadc=_0x209367['substring'](_0x209367[_0xaa81('0x38')]('_')+0x1);if(_0x4faff3===_0x23ee8b){_0x12ea4e[_0x14dadc]=_0x440b81[_0xaa81('0x39')];}}});}return _0x12ea4e;}function getTicket(_0x1b63a1,_0x3e1b14,_0x3640f8,_0x24a303,_0x2cbc29,_0x1dd04e,_0x41ce93){return new BPromise(function(_0x41e37e,_0x50dcb2){var _0x1b8421;return getAuthToken(_0x3e1b14,_0x3640f8,_0x41ce93)[_0xaa81('0x11')](function(_0x51dfec){if(_0x1dd04e[_0xaa81('0x3a')]===_0xaa81('0x3b')){_0x1b8421={'method':'POST','uri':_0x24a303+'incidents','body':Object['assign']({},{'title':intUtil[_0xaa81('0x3c')](_0x1dd04e[_0xaa81('0x3d')],_0x2cbc29,'\x20'),'description':intUtil['getString'](_0x1dd04e[_0xaa81('0x3e')],_0x2cbc29,'\x0a'),'customerid_contact@odata.bind':_0xaa81('0x3f')+_0x1b63a1[_0xaa81('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x1b63a1[_0xaa81('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x1dd04e[_0xaa81('0x40')],_0x2cbc29,_0x1dd04e[_0xaa81('0x3a')])),'headers':{'Authorization':_0xaa81('0x17')+_0x51dfec,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1dd04e[_0xaa81('0x3a')]===_0xaa81('0x41')){_0x1b8421={'method':_0xaa81('0x42'),'uri':_0x24a303+_0xaa81('0x43'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x1dd04e[_0xaa81('0x3d')],_0x2cbc29,'\x20'),'phonenumber':String(_0x2cbc29[_0xaa81('0x27')]),'description':intUtil[_0xaa81('0x3c')](_0x1dd04e[_0xaa81('0x3e')],_0x2cbc29,'\x0a'),'regardingobjectid_contact@odata.bind':_0xaa81('0x3f')+_0x1b63a1[_0xaa81('0x2e')]+')','ownerid@odata.bind':_0xaa81('0x29')+_0x1b63a1[_0xaa81('0x2a')]+')','directioncode':_0x1b63a1[_0xaa81('0x44')]===_0xaa81('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xaa81('0x29')+_0x1b63a1[_0xaa81('0x2a')]+')','participationtypemask':_0x1b63a1[_0xaa81('0x44')]===_0xaa81('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xaa81('0x3f')+_0x1b63a1['enduserId']+')','participationtypemask':_0x1b63a1['callDirection']===_0xaa81('0x45')?0x1:0x2}]},getCustomFields(_0x1dd04e['Fields'],_0x2cbc29,_0x1dd04e[_0xaa81('0x3a')])),'headers':{'Authorization':_0xaa81('0x17')+_0x51dfec,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b8421);})['then'](function(_0x2eda06){var _0xd41f91=_0x2eda06[_0xaa81('0x2b')]['odata-entityid'];var _0x1c83ff=_0xd41f91[_0xaa81('0x2c')](_0xd41f91[_0xaa81('0x2d')]('(')+0x1,_0xd41f91['lastIndexOf'](')'));_0x1b63a1[_0xaa81('0x46')]=_0x1c83ff;_0x41e37e(_0x1b63a1);})['catch'](function(_0x1aaf46){_0x50dcb2(_0x1aaf46[_0xaa81('0x23')]);});});}function emit(_0x54f4e8,_0x27ba16,_0x24ff1a,_0x2d731d){var _0x427aa7={'uri':util[_0xaa81('0x47')](_0xaa81('0x48'),_0x54f4e8,_0x24ff1a,_0x2d731d)};io['to'](util[_0xaa81('0x47')](_0xaa81('0x49'),_0x27ba16))[_0xaa81('0x4a')](_0xaa81('0x4b'),_0x427aa7);}exports['cs']=function(_0x514910,_0x38806b,_0x5da518,_0x540613,_0x17e201,_0x10e0e4,_0x3e05fb,_0x51abb8){var _0x241558={};_0x10e0e4[_0xaa81('0xe')]=intUtil['stripTrailingSlash'](_0x10e0e4[_0xaa81('0xe')]);_0x10e0e4[_0xaa81('0x4c')]=intUtil[_0xaa81('0x4d')](_0x10e0e4['serverUrl']);_0x241558['callDirection']=_0x51abb8===_0xaa81('0x45')||_0x51abb8===_0xaa81('0x4e')?_0xaa81('0x45'):_0xaa81('0x25');var _0x10b26b=util[_0xaa81('0x47')](_0xaa81('0x4f'),_0x10e0e4['remoteUri']);var _0x11c6f8=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x10e0e4[_0xaa81('0x50')]);var _0x16057b=util[_0xaa81('0x47')](_0xaa81('0x51'),_0x10e0e4[_0xaa81('0x4c')],_0x38806b['uniqueid'],md5(_0x38806b[_0xaa81('0x52')]));if(_0x17e201&&_0x17e201['monitor_format']){logger[_0xaa81('0x1e')](_0xaa81('0x53'),_0xaa81('0x54'));_0x38806b['recordingURL']=_0x16057b;}else if(_0x3e05fb&&_0x3e05fb[_0xaa81('0x55')]&&_0x3e05fb[_0xaa81('0x55')]!=='none'){logger['info']('[OUTBOUND]',_0xaa81('0x54'));_0x38806b['recordingURL']=_0x16057b;}else{_0x38806b[_0xaa81('0x56')]='';}return getUser(_0x241558,_0x10e0e4,_0x540613,_0x11c6f8,_0x10b26b,_0x51abb8)[_0xaa81('0x11')](function(_0x15aa14){logger[_0xaa81('0x1e')]('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x57'),_0x15aa14[_0xaa81('0x2a')]);logger[_0xaa81('0x1e')]('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x58'),_0x15aa14[_0xaa81('0x1c')]);return getEndUser(_0x15aa14,_0x10e0e4,_0x11c6f8,_0x10b26b,_0x38806b,_0x51abb8);})[_0xaa81('0x11')](function(_0x52768f){logger[_0xaa81('0x1e')]('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x59'),_0x52768f[_0xaa81('0x2e')]);logger[_0xaa81('0x1e')]('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x5a'),_0x38806b[_0xaa81('0x27')]);return getTicket(_0x52768f,_0x10e0e4,_0x11c6f8,_0x10b26b,_0x38806b,_0x5da518,_0x51abb8);})[_0xaa81('0x11')](function(_0x28094e){logger[_0xaa81('0x1e')](util['format']('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x5b'),_0x5da518[_0xaa81('0x3a')],_0x28094e[_0xaa81('0x46')]));logger[_0xaa81('0x1e')](util[_0xaa81('0x47')]('['+_0x51abb8[_0xaa81('0x14')]()+_0xaa81('0x5c'),_0x51abb8));if(_0x51abb8!==_0xaa81('0x4e')){logger[_0xaa81('0x1e')]('['+_0x51abb8[_0xaa81('0x14')]()+']',_0xaa81('0x5d'));emit(_0x10e0e4[_0xaa81('0xe')],_0x540613[_0xaa81('0x5e')],_0x5da518['ticketType'],_0x28094e[_0xaa81('0x46')]);}})[_0xaa81('0x2f')](function(_0x3f08e1){logger[_0xaa81('0x13')]('['+_0x51abb8['toUpperCase']()+_0xaa81('0x5f'),util['inspect'](_0x3f08e1,{'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 dfc2a09..6cd28a5 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 _0xd864=['push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','find','POST','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','forEach','string','nameField','customField','toLowerCase','content','toString','idField','type','variable','variableName'];(function(_0xc5582d,_0x37057a){var _0x4a1ec7=function(_0x5ddce9){while(--_0x5ddce9){_0xc5582d['push'](_0xc5582d['shift']());}};_0x4a1ec7(++_0x37057a);}(_0xd864,0x7b));var _0x4d86=function(_0x4adda9,_0x3f8398){_0x4adda9=_0x4adda9-0x0;var _0x6b7a06=_0xd864[_0x4adda9];return _0x6b7a06;};'use strict';var _=require(_0x4d86('0x0'));var rp=require(_0x4d86('0x1'));var md5=require('md5');var util=require(_0x4d86('0x2'));var Redis=require(_0x4d86('0x3'));var intUtil=require(_0x4d86('0x4'));var config=require(_0x4d86('0x5'));var logger=require(_0x4d86('0x6'))('freshdesk');config[_0x4d86('0x7')]=_[_0x4d86('0x8')](config[_0x4d86('0x7')],{'host':_0x4d86('0x9'),'port':0x18eb});var io=require(_0x4d86('0xa'))(new Redis(config[_0x4d86('0x7')]));var headers={'Content-Type':_0x4d86('0xb'),'Accept':'application/json'};function emit(_0x5dd561,_0x12f56f,_0x3e76fc){io['to'](_0x5dd561)[_0x4d86('0xc')](_0x12f56f,_0x3e76fc);}function getTicket(_0xfa9b87,_0x3123d4,_0x328b3d,_0x1a5749,_0x2d3dc1){logger[_0x4d86('0xd')](_0x4d86('0xe'));var _0x17e058=_['merge']({'responder_id':_0x3123d4['id'],'requester_id':_0x328b3d['id'],'name':util[_0x4d86('0xf')](_0x4d86('0x10'),_0x2d3dc1[_0x4d86('0x11')]),'phone':_0x2d3dc1['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4d86('0x12')](_0x1a5749[_0x4d86('0x13')],_0x2d3dc1,'\x20'),'description':intUtil['getString'](_0x1a5749[_0x4d86('0x14')],_0x2d3dc1,_0x4d86('0x15')),'tags':getTags(_0x1a5749[_0x4d86('0x16')],_0x4d86('0x17'))},getCustomFields(_0x1a5749[_0x4d86('0x18')],_0x2d3dc1));_0x17e058[_0x4d86('0x19')]=_[_0x4d86('0x1a')](_[_0x4d86('0x1b')](_0x17e058[_0x4d86('0x19')],'id'),_0x4d86('0x1c'));return request({'uri':util['format'](_0x4d86('0x1d'),_0xfa9b87[_0x4d86('0x1e')]),'method':'POST','body':_0x17e058})[_0x4d86('0x1f')](function(_0x3c557c){logger[_0x4d86('0xd')]('Ticket\x20created!');return _0x3c557c;});}function getUser(_0x1d2591,_0x3eb964){if(intUtil[_0x4d86('0x20')](_0x3eb964)){return request({'uri':util['format'](_0x4d86('0x21'),_0x1d2591[_0x4d86('0x1e')]),'qs':{'email':_0x3eb964}})[_0x4d86('0x1f')](function(_0x5c3a02){if(_0x5c3a02[_0x4d86('0x22')]){logger['info'](_0x4d86('0x23'));return _['find'](_0x5c3a02,function(_0x29ae66){return _0x29ae66['contact'][_0x4d86('0x24')]===_0x3eb964;});}else{logger[_0x4d86('0xd')](_0x4d86('0x25'));return request({'uri':util[_0x4d86('0xf')](_0x4d86('0x26'),_0x1d2591[_0x4d86('0x1e')])})[_0x4d86('0x1f')](function(_0xb68b15){logger[_0x4d86('0xd')](_0x4d86('0x27'));return _0xb68b15;});}});}else{logger[_0x4d86('0xd')](_0x4d86('0x28'));return request({'uri':util[_0x4d86('0xf')]('%s/api/v2/agents/me',_0x1d2591[_0x4d86('0x1e')])})['then'](function(_0xb0ab1){logger['info'](_0x4d86('0x27'));return _0xb0ab1;});}}function getEndUser(_0x173e3c,_0x1e2633,_0x394b2e){logger[_0x4d86('0xd')]('Searching\x20enduser\x20with\x20phone',_0x394b2e);return request({'uri':util[_0x4d86('0xf')](_0x4d86('0x29'),_0x173e3c['remoteUri']),'qs':{'phone':_0x394b2e}})[_0x4d86('0x1f')](function(_0x5550db){if(_0x5550db['length']){logger['info'](_0x4d86('0x2a'));return _[_0x4d86('0x2b')](_0x5550db,{'phone':_0x394b2e});}else{logger[_0x4d86('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x4d86('0x29'),_0x173e3c[_0x4d86('0x1e')]),'method':_0x4d86('0x2c'),'body':{'name':_0x1e2633,'phone':_0x394b2e}})[_0x4d86('0x1f')](function(_0x100164){logger[_0x4d86('0xd')]('Enduser\x20created.');return _0x100164;});}});}function getAuth(_0x17a335){return util[_0x4d86('0xf')](_0x4d86('0x2d'),new Buffer(_0x17a335[_0x4d86('0x2e')]+':X')['toString'](_0x4d86('0x2f')));}function request(_0xd37bfb){logger[_0x4d86('0x30')](_0x4d86('0x31'),JSON[_0x4d86('0x32')](_0xd37bfb));return rp(_[_0x4d86('0x8')](_0xd37bfb,{'method':_0x4d86('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x115063,_0x14475d){var _0x42027b=[];if(_0x115063&&_0x115063[_0x4d86('0x22')]>0x0){_0x42027b=_['map'](_0x115063,_0x14475d);}return _0x42027b;}function getCustomFields(_0x2013f7,_0x402a21){var _0x52f6a4=[];var _0x1b31c8={'custom_fields':[]};if(_0x2013f7['length']>0x0){_[_0x4d86('0x34')](_0x2013f7,function(_0x1099cc){if(_0x1099cc['type']===_0x4d86('0x35')&&_0x1099cc[_0x4d86('0x36')]&&!_0x1099cc[_0x4d86('0x37')]){_0x1b31c8[_0x1099cc['nameField'][_0x4d86('0x38')]()]=_0x1099cc[_0x4d86('0x39')][_0x4d86('0x3a')]();}else if(_0x1099cc['type']===_0x4d86('0x35')&&_0x1099cc[_0x4d86('0x3b')]&&_0x1099cc[_0x4d86('0x37')]){_0x1b31c8['custom_fields']['push']({'id':_0x1099cc[_0x4d86('0x3b')],'value':_0x1099cc[_0x4d86('0x39')]['toString']()});}else if(_0x1099cc[_0x4d86('0x3c')]===_0x4d86('0x3d')&&_0x1099cc[_0x4d86('0x3e')]&&_0x1099cc[_0x4d86('0x3b')]&&_0x1099cc['customField']){_0x402a21[_0x1099cc[_0x4d86('0x3e')]]&&_0x1b31c8['custom_fields'][_0x4d86('0x3f')]({'id':_0x1099cc[_0x4d86('0x3b')],'value':_0x402a21[_0x1099cc['variableName']][_0x4d86('0x3a')]()});}else if(_0x1099cc[_0x4d86('0x3c')]==='customVariable'&&_0x1099cc[_0x4d86('0x40')]&&_0x1099cc[_0x4d86('0x40')][_0x4d86('0x17')]&&_0x1099cc[_0x4d86('0x3b')]&&_0x1099cc[_0x4d86('0x37')]){_0x402a21[_0x1099cc[_0x4d86('0x40')][_0x4d86('0x17')]['toLowerCase']()]&&_0x1b31c8[_0x4d86('0x19')]['push']({'id':_0x1099cc['idField'],'value':_0x402a21[_0x1099cc[_0x4d86('0x40')]['name']['toLowerCase']()]['toString']()});}});}return _0x1b31c8;}exports[_0x4d86('0x41')]=function(_0x4e0f08,_0x198787,_0x4ce714,_0x4a176e,_0x5baa99,_0x59e224){var _0x126f7f,_0x26219a;_0x59e224[_0x4d86('0x1e')]=intUtil[_0x4d86('0x42')](_0x59e224[_0x4d86('0x1e')]);_0x59e224[_0x4d86('0x43')]=intUtil[_0x4d86('0x42')](_0x59e224['serverUrl']);if(_0x5baa99&&_0x5baa99[_0x4d86('0x44')]){logger[_0x4d86('0xd')](_0x4d86('0x45'),_0x4d86('0x46'));_0x198787[_0x4d86('0x47')]=util[_0x4d86('0xf')](_0x4d86('0x48'),_0x59e224[_0x4d86('0x43')],_0x198787[_0x4d86('0x49')],md5(_0x198787[_0x4d86('0x49')]));}else{_0x198787[_0x4d86('0x47')]='';}headers[_0x4d86('0x4a')]=getAuth(_0x59e224);return getUser(_0x59e224,_0x4a176e[_0x4d86('0x24')])[_0x4d86('0x1f')](function(_0x1a1e42){_0x126f7f=_0x1a1e42;logger[_0x4d86('0xd')]('The\x20User\x20ID\x20is:',_0x126f7f['id']);return getEndUser(_0x59e224,_0x198787[_0x4d86('0x11')],_0x198787['calleridnum']);})[_0x4d86('0x1f')](function(_0xa9bc27){_0x26219a=_0xa9bc27;logger['info'](_0x4d86('0x4b'),_0x26219a['id']);return getTicket(_0x59e224,_0x126f7f,_0x26219a,_0x4ce714,_0x198787);})[_0x4d86('0x1f')](function(_0x5a3fc8){if(_0x5a3fc8&&_0x5a3fc8['id']){logger[_0x4d86('0xd')](_0x4d86('0x4c'));logger[_0x4d86('0xd')](_0x4d86('0x4d'),_0x5a3fc8['id']);logger['info'](_0x4d86('0x45'),_0x4d86('0x4e'));emit(util[_0x4d86('0xf')](_0x4d86('0x4f'),_0x4a176e[_0x4d86('0x17')]),_0x4d86('0x50'),{'uri':util['format'](_0x4d86('0x51'),_0x59e224[_0x4d86('0x1e')],_0x5a3fc8['id'])});}})[_0x4d86('0x52')](function(_0x3d1e65){logger[_0x4d86('0x53')]('[QUEUE]',JSON[_0x4d86('0x32')](_0x3d1e65));});};exports[_0x4d86('0x54')]=function(_0x4fecf7,_0x50f354,_0x68dde2,_0x4f8aab,_0x1ae050,_0x683b09,_0x161cd3){var _0x1280bd,_0x2d6d5a;_0x683b09[_0x4d86('0x1e')]=intUtil[_0x4d86('0x42')](_0x683b09[_0x4d86('0x1e')]);_0x683b09[_0x4d86('0x43')]=intUtil[_0x4d86('0x42')](_0x683b09[_0x4d86('0x43')]);if(_0x161cd3&&_0x161cd3[_0x4d86('0x55')]&&_0x161cd3[_0x4d86('0x55')]!=='none'){logger[_0x4d86('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x50f354['recordingURL']=util[_0x4d86('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x683b09[_0x4d86('0x43')],_0x50f354[_0x4d86('0x49')],md5(_0x50f354[_0x4d86('0x49')]));}headers[_0x4d86('0x4a')]=getAuth(_0x683b09);return getUser(_0x683b09,_0x4f8aab[_0x4d86('0x24')])[_0x4d86('0x1f')](function(_0x3c9068){_0x1280bd=_0x3c9068;logger[_0x4d86('0xd')](_0x4d86('0x56'),_0x1280bd['id']);return getEndUser(_0x683b09,_0x50f354[_0x4d86('0x57')],_0x50f354[_0x4d86('0x58')]);})[_0x4d86('0x1f')](function(_0x4d3fc9){_0x2d6d5a=_0x4d3fc9;logger[_0x4d86('0xd')](_0x4d86('0x4b'),_0x2d6d5a['id']);return getTicket(_0x683b09,_0x1280bd,_0x2d6d5a,_0x68dde2,_0x50f354);})['then'](function(_0x16f08c){if(_0x16f08c&&_0x16f08c['id']){logger['info']('Ticket\x20created!');logger[_0x4d86('0xd')](_0x4d86('0x4d'),_0x16f08c['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4d86('0x4f'),_0x4f8aab[_0x4d86('0x17')]),_0x4d86('0x50'),{'uri':util[_0x4d86('0xf')]('%s/helpdesk/tickets/%d',_0x683b09[_0x4d86('0x1e')],_0x16f08c['id'])});}})[_0x4d86('0x52')](function(_0x1626a8){logger[_0x4d86('0x53')](_0x4d86('0x59'),JSON['stringify'](_0x1626a8));});};exports[_0x4d86('0x5a')]=function(_0x406b8a,_0x2b34a9,_0x10526b,_0x35d8ad,_0x42f4a2,_0x28c3b0){var _0x50f270,_0x51e1a6;_0x28c3b0[_0x4d86('0x1e')]=intUtil[_0x4d86('0x42')](_0x28c3b0[_0x4d86('0x1e')]);_0x28c3b0[_0x4d86('0x43')]=intUtil[_0x4d86('0x42')](_0x28c3b0[_0x4d86('0x43')]);if(_0x42f4a2&&_0x42f4a2['monitor_format']){logger['info']('['+_0x2b34a9['lastevent'][_0x4d86('0x5b')]()+']',_0x4d86('0x46'));_0x2b34a9[_0x4d86('0x47')]=util[_0x4d86('0xf')](_0x4d86('0x48'),_0x28c3b0[_0x4d86('0x43')],_0x2b34a9[_0x4d86('0x49')],md5(_0x2b34a9['uniqueid']));}else{_0x2b34a9[_0x4d86('0x47')]='';}headers[_0x4d86('0x4a')]=getAuth(_0x28c3b0);return getUser(_0x28c3b0,'')[_0x4d86('0x1f')](function(_0x142408){_0x50f270=_0x142408;logger[_0x4d86('0xd')]('The\x20User\x20ID\x20is:',_0x50f270['id']);return getEndUser(_0x28c3b0,_0x2b34a9[_0x4d86('0x11')],_0x2b34a9[_0x4d86('0x5c')]);})['then'](function(_0x12dbb8){_0x51e1a6=_0x12dbb8;logger['info'](_0x4d86('0x4b'),_0x51e1a6['id']);return getTicket(_0x28c3b0,_0x50f270,_0x51e1a6,_0x10526b,_0x2b34a9);})[_0x4d86('0x1f')](function(_0x369179){if(_0x369179){logger[_0x4d86('0xd')]('Ticket\x20created!');logger[_0x4d86('0xd')]('The\x20Ticket\x20ID\x20is:',_0x369179['id']);}})[_0x4d86('0x52')](function(_0x7195b6){logger['error']('['+_0x2b34a9['lastevent'][_0x4d86('0x5b')]()+']',JSON[_0x4d86('0x32')](_0x7195b6));});}; \ No newline at end of file +var _0x937d=['[HTTP]','stringify','GET','forEach','type','string','nameField','toLowerCase','push','variable','idField','customField','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug'];(function(_0x292786,_0x34e62e){var _0x5909d5=function(_0xebf3d0){while(--_0xebf3d0){_0x292786['push'](_0x292786['shift']());}};_0x5909d5(++_0x34e62e);}(_0x937d,0x81));var _0xd937=function(_0x30a068,_0x5bcb0b){_0x30a068=_0x30a068-0x0;var _0x9c6b60=_0x937d[_0x30a068];return _0x9c6b60;};'use strict';var _=require(_0xd937('0x0'));var rp=require(_0xd937('0x1'));var md5=require(_0xd937('0x2'));var util=require(_0xd937('0x3'));var Redis=require(_0xd937('0x4'));var intUtil=require(_0xd937('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd937('0x6'))('freshdesk');config['redis']=_[_0xd937('0x7')](config[_0xd937('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd937('0x9'))(new Redis(config[_0xd937('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xd937('0xa')};function emit(_0x557171,_0x58fc56,_0xe0346f){io['to'](_0x557171)[_0xd937('0xb')](_0x58fc56,_0xe0346f);}function getTicket(_0x3699f1,_0x11761c,_0x537d89,_0x1d8be7,_0xafaa5c){logger[_0xd937('0xc')](_0xd937('0xd'));var _0xf44c7a=_[_0xd937('0xe')]({'responder_id':_0x11761c['id'],'requester_id':_0x537d89['id'],'name':util[_0xd937('0xf')](_0xd937('0x10'),_0xafaa5c[_0xd937('0x11')]),'phone':_0xafaa5c[_0xd937('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd937('0x13')](_0x1d8be7[_0xd937('0x14')],_0xafaa5c,'\x20'),'description':intUtil[_0xd937('0x13')](_0x1d8be7['Descriptions'],_0xafaa5c,_0xd937('0x15')),'tags':getTags(_0x1d8be7[_0xd937('0x16')],_0xd937('0x17'))},getCustomFields(_0x1d8be7[_0xd937('0x18')],_0xafaa5c));_0xf44c7a['custom_fields']=_[_0xd937('0x19')](_[_0xd937('0x1a')](_0xf44c7a[_0xd937('0x1b')],'id'),_0xd937('0x1c'));return request({'uri':util[_0xd937('0xf')]('%s/api/v2/tickets',_0x3699f1['remoteUri']),'method':_0xd937('0x1d'),'body':_0xf44c7a})[_0xd937('0x1e')](function(_0x3a1f17){logger[_0xd937('0xc')](_0xd937('0x1f'));return _0x3a1f17;});}function getUser(_0x46b276,_0x4301d3){if(intUtil[_0xd937('0x20')](_0x4301d3)){return request({'uri':util[_0xd937('0xf')](_0xd937('0x21'),_0x46b276[_0xd937('0x22')]),'qs':{'email':_0x4301d3}})[_0xd937('0x1e')](function(_0x430f30){if(_0x430f30[_0xd937('0x23')]){logger[_0xd937('0xc')](_0xd937('0x24'));return _[_0xd937('0x25')](_0x430f30,function(_0x3c26da){return _0x3c26da['contact'][_0xd937('0x26')]===_0x4301d3;});}else{logger['info'](_0xd937('0x27'));return request({'uri':util[_0xd937('0xf')](_0xd937('0x28'),_0x46b276[_0xd937('0x22')])})[_0xd937('0x1e')](function(_0x3099be){logger[_0xd937('0xc')](_0xd937('0x29'));return _0x3099be;});}});}else{logger['info'](_0xd937('0x2a'));return request({'uri':util[_0xd937('0xf')](_0xd937('0x28'),_0x46b276[_0xd937('0x22')])})['then'](function(_0x4cc068){logger[_0xd937('0xc')](_0xd937('0x29'));return _0x4cc068;});}}function getEndUser(_0x49d310,_0x38c69a,_0x4309e9){logger[_0xd937('0xc')](_0xd937('0x2b'),_0x4309e9);return request({'uri':util[_0xd937('0xf')](_0xd937('0x2c'),_0x49d310['remoteUri']),'qs':{'phone':_0x4309e9}})[_0xd937('0x1e')](function(_0x327f52){if(_0x327f52['length']){logger[_0xd937('0xc')](_0xd937('0x2d'));return _[_0xd937('0x25')](_0x327f52,{'phone':_0x4309e9});}else{logger['info'](_0xd937('0x2e'));return request({'uri':util[_0xd937('0xf')](_0xd937('0x2c'),_0x49d310['remoteUri']),'method':_0xd937('0x1d'),'body':{'name':_0x38c69a,'phone':_0x4309e9}})['then'](function(_0x36589a){logger[_0xd937('0xc')](_0xd937('0x2f'));return _0x36589a;});}});}function getAuth(_0x25c839){return util[_0xd937('0xf')](_0xd937('0x30'),new Buffer(_0x25c839[_0xd937('0x31')]+':X')[_0xd937('0x32')](_0xd937('0x33')));}function request(_0x45ac1b){logger[_0xd937('0x34')](_0xd937('0x35'),JSON[_0xd937('0x36')](_0x45ac1b));return rp(_[_0xd937('0x7')](_0x45ac1b,{'method':_0xd937('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x406153,_0x196dcc){var _0x28df91=[];if(_0x406153&&_0x406153[_0xd937('0x23')]>0x0){_0x28df91=_['map'](_0x406153,_0x196dcc);}return _0x28df91;}function getCustomFields(_0x46c9e7,_0x33ddd4){var _0x44bec2=[];var _0x577632={'custom_fields':[]};if(_0x46c9e7[_0xd937('0x23')]>0x0){_[_0xd937('0x38')](_0x46c9e7,function(_0x19969b){if(_0x19969b[_0xd937('0x39')]===_0xd937('0x3a')&&_0x19969b[_0xd937('0x3b')]&&!_0x19969b['customField']){_0x577632[_0x19969b['nameField'][_0xd937('0x3c')]()]=_0x19969b['content']['toString']();}else if(_0x19969b[_0xd937('0x39')]===_0xd937('0x3a')&&_0x19969b['idField']&&_0x19969b['customField']){_0x577632[_0xd937('0x1b')][_0xd937('0x3d')]({'id':_0x19969b['idField'],'value':_0x19969b['content']['toString']()});}else if(_0x19969b[_0xd937('0x39')]===_0xd937('0x3e')&&_0x19969b['variableName']&&_0x19969b[_0xd937('0x3f')]&&_0x19969b[_0xd937('0x40')]){_0x33ddd4[_0x19969b[_0xd937('0x41')]]&&_0x577632[_0xd937('0x1b')]['push']({'id':_0x19969b['idField'],'value':_0x33ddd4[_0x19969b[_0xd937('0x41')]]['toString']()});}else if(_0x19969b[_0xd937('0x39')]===_0xd937('0x42')&&_0x19969b[_0xd937('0x43')]&&_0x19969b['Variable'][_0xd937('0x17')]&&_0x19969b['idField']&&_0x19969b[_0xd937('0x40')]){_0x33ddd4[_0x19969b[_0xd937('0x43')][_0xd937('0x17')][_0xd937('0x3c')]()]&&_0x577632[_0xd937('0x1b')][_0xd937('0x3d')]({'id':_0x19969b[_0xd937('0x3f')],'value':_0x33ddd4[_0x19969b[_0xd937('0x43')][_0xd937('0x17')][_0xd937('0x3c')]()][_0xd937('0x32')]()});}});}return _0x577632;}exports['queue']=function(_0xa7cb76,_0x198f49,_0x4b94ee,_0x23b3ff,_0x7ffb6c,_0xeb0404){var _0x85f2d4,_0x71137f;_0xeb0404['remoteUri']=intUtil[_0xd937('0x44')](_0xeb0404[_0xd937('0x22')]);_0xeb0404[_0xd937('0x45')]=intUtil[_0xd937('0x44')](_0xeb0404['serverUrl']);if(_0x7ffb6c&&_0x7ffb6c[_0xd937('0x46')]){logger[_0xd937('0xc')](_0xd937('0x47'),'Recording\x20is\x20enabled!');_0x198f49[_0xd937('0x48')]=util[_0xd937('0xf')](_0xd937('0x49'),_0xeb0404['serverUrl'],_0x198f49[_0xd937('0x4a')],md5(_0x198f49[_0xd937('0x4a')]));}else{_0x198f49['recordingURL']='';}headers[_0xd937('0x4b')]=getAuth(_0xeb0404);return getUser(_0xeb0404,_0x23b3ff[_0xd937('0x26')])['then'](function(_0x1b9c59){_0x85f2d4=_0x1b9c59;logger[_0xd937('0xc')](_0xd937('0x4c'),_0x85f2d4['id']);return getEndUser(_0xeb0404,_0x198f49[_0xd937('0x11')],_0x198f49[_0xd937('0x12')]);})['then'](function(_0x508888){_0x71137f=_0x508888;logger['info'](_0xd937('0x4d'),_0x71137f['id']);return getTicket(_0xeb0404,_0x85f2d4,_0x71137f,_0x4b94ee,_0x198f49);})['then'](function(_0x1d235e){if(_0x1d235e&&_0x1d235e['id']){logger[_0xd937('0xc')](_0xd937('0x1f'));logger[_0xd937('0xc')](_0xd937('0x4e'),_0x1d235e['id']);logger[_0xd937('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd937('0xf')]('user:%s',_0x23b3ff[_0xd937('0x17')]),_0xd937('0x4f'),{'uri':util[_0xd937('0xf')]('%s/helpdesk/tickets/%d',_0xeb0404[_0xd937('0x22')],_0x1d235e['id'])});}})[_0xd937('0x50')](function(_0x3baf38){logger[_0xd937('0x51')]('[QUEUE]',JSON[_0xd937('0x36')](_0x3baf38));});};exports[_0xd937('0x52')]=function(_0x9a0d39,_0x2a4e3f,_0xacd63d,_0x4c150d,_0x3ec149,_0x527d8f,_0x2c1ea7){var _0x3311b2,_0x20b634;_0x527d8f[_0xd937('0x22')]=intUtil['stripTrailingSlash'](_0x527d8f[_0xd937('0x22')]);_0x527d8f['serverUrl']=intUtil[_0xd937('0x44')](_0x527d8f['serverUrl']);if(_0x2c1ea7&&_0x2c1ea7[_0xd937('0x53')]&&_0x2c1ea7[_0xd937('0x53')]!==_0xd937('0x54')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2a4e3f['recordingURL']=util['format'](_0xd937('0x49'),_0x527d8f[_0xd937('0x45')],_0x2a4e3f[_0xd937('0x4a')],md5(_0x2a4e3f[_0xd937('0x4a')]));}headers[_0xd937('0x4b')]=getAuth(_0x527d8f);return getUser(_0x527d8f,_0x4c150d['email'])[_0xd937('0x1e')](function(_0x7a4c96){_0x3311b2=_0x7a4c96;logger[_0xd937('0xc')]('The\x20User\x20ID\x20is:',_0x3311b2['id']);return getEndUser(_0x527d8f,_0x2a4e3f[_0xd937('0x55')],_0x2a4e3f[_0xd937('0x56')]);})[_0xd937('0x1e')](function(_0x3f4d77){_0x20b634=_0x3f4d77;logger[_0xd937('0xc')]('The\x20Enduser\x20ID\x20is:',_0x20b634['id']);return getTicket(_0x527d8f,_0x3311b2,_0x20b634,_0xacd63d,_0x2a4e3f);})[_0xd937('0x1e')](function(_0x36c4de){if(_0x36c4de&&_0x36c4de['id']){logger[_0xd937('0xc')](_0xd937('0x1f'));logger[_0xd937('0xc')](_0xd937('0x4e'),_0x36c4de['id']);logger[_0xd937('0xc')](_0xd937('0x57'),_0xd937('0x58'));emit(util[_0xd937('0xf')](_0xd937('0x59'),_0x4c150d['name']),_0xd937('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x527d8f[_0xd937('0x22')],_0x36c4de['id'])});}})[_0xd937('0x50')](function(_0x1d80ec){logger['error']('[OUTBOUND]',JSON[_0xd937('0x36')](_0x1d80ec));});};exports['unmanaged']=function(_0x81e9be,_0x59ed82,_0x517588,_0x40f4c1,_0x4a9c0b,_0x465293){var _0x4c6144,_0x146782;_0x465293['remoteUri']=intUtil[_0xd937('0x44')](_0x465293[_0xd937('0x22')]);_0x465293[_0xd937('0x45')]=intUtil[_0xd937('0x44')](_0x465293[_0xd937('0x45')]);if(_0x4a9c0b&&_0x4a9c0b[_0xd937('0x46')]){logger[_0xd937('0xc')]('['+_0x59ed82['lastevent'][_0xd937('0x5a')]()+']','Recording\x20is\x20enabled!');_0x59ed82[_0xd937('0x48')]=util[_0xd937('0xf')](_0xd937('0x49'),_0x465293[_0xd937('0x45')],_0x59ed82[_0xd937('0x4a')],md5(_0x59ed82[_0xd937('0x4a')]));}else{_0x59ed82[_0xd937('0x48')]='';}headers['Authorization']=getAuth(_0x465293);return getUser(_0x465293,'')[_0xd937('0x1e')](function(_0x285e25){_0x4c6144=_0x285e25;logger['info'](_0xd937('0x4c'),_0x4c6144['id']);return getEndUser(_0x465293,_0x59ed82[_0xd937('0x11')],_0x59ed82[_0xd937('0x12')]);})[_0xd937('0x1e')](function(_0x58b9d6){_0x146782=_0x58b9d6;logger[_0xd937('0xc')]('The\x20Enduser\x20ID\x20is:',_0x146782['id']);return getTicket(_0x465293,_0x4c6144,_0x146782,_0x517588,_0x59ed82);})[_0xd937('0x1e')](function(_0x2e3450){if(_0x2e3450){logger[_0xd937('0xc')](_0xd937('0x1f'));logger[_0xd937('0xc')](_0xd937('0x4e'),_0x2e3450['id']);}})[_0xd937('0x50')](function(_0x4f6a86){logger[_0xd937('0x51')]('['+_0x59ed82['lastevent'][_0xd937('0x5a')]()+']',JSON[_0xd937('0x36')](_0x4f6a86));});}; \ 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 c39f051..eeb676b 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 _0x77f7=['recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','adminEmail','userId','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','Searching\x20contact\x20with\x20phone','contactNumber','contacts','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','message','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x5360aa,_0x5b840d){var _0x198de6=function(_0x440da6){while(--_0x440da6){_0x5360aa['push'](_0x5360aa['shift']());}};_0x198de6(++_0x5b840d);}(_0x77f7,0xbd));var _0x777f=function(_0x5e475d,_0x198b2b){_0x5e475d=_0x5e475d-0x0;var _0x53e10e=_0x77f7[_0x5e475d];return _0x53e10e;};'use strict';var _=require(_0x777f('0x0'));var rp=require(_0x777f('0x1'));var md5=require(_0x777f('0x2'));var util=require(_0x777f('0x3'));var moment=require(_0x777f('0x4'));var Promise=require(_0x777f('0x5'));var Redis=require(_0x777f('0x6'));var intUtil=require(_0x777f('0x7'));var config=require(_0x777f('0x8'));var logger=require('../../../../config/logger')('freshsales');config[_0x777f('0x9')]=_[_0x777f('0xa')](config[_0x777f('0x9')],{'host':_0x777f('0xb'),'port':0x18eb});var io=require(_0x777f('0xc'))(new Redis(config[_0x777f('0x9')]));function getAdminId(_0x12bff6,_0x27e9ee,_0x2ba1a5,_0x478e59){return new Promise(function(_0x4edde5,_0xd2273){var _0x5c218b=![];var _0x26e215={'method':_0x777f('0xd'),'uri':_0x478e59+'/api/selector/owners','json':!![]};_0x26e215[_0x777f('0xe')]=_0x2ba1a5;logger[_0x777f('0xf')](_0x777f('0x10'));return rp(_0x26e215)['then'](function(_0x4f6746){if(_0x4f6746){var _0xaa421a=_0x4f6746[_0x777f('0x11')];var _0x30f31b=null;for(_0x30f31b=0x0;_0x30f31b<_0xaa421a[_0x777f('0x12')];_0x30f31b++){if(_0xaa421a[_0x30f31b][_0x777f('0x13')]===_0x12bff6['adminEmail']){_0x12bff6[_0x777f('0x14')]=_0xaa421a[_0x30f31b]['id'];_0x5c218b=!![];}}if(_0x5c218b){logger[_0x777f('0xf')]('Admin\x20found:',_0x12bff6[_0x777f('0x14')]);_0x4edde5(_0x12bff6);}else{_0xd2273({'statusCode':0x194,'message':_0x777f('0x15')});}}else{_0xd2273({'statusCode':0x194,'message':_0x777f('0x15')});}})[_0x777f('0x16')](function(_0xf4d60b){logger[_0x777f('0x17')]('['+[_0x27e9ee[_0x777f('0x18')]()]+']',_0xf4d60b['message']);_0xd2273(_0xf4d60b);});});}function getUser(_0x856923,_0x3f6143,_0x1e2af5){return function(_0x1ef1c5){return new Promise(function(_0x361759,_0x3aeb58){var _0x4038e2={'method':'GET','uri':_0x1e2af5+'/api/selector/owners','json':!![]};_0x4038e2[_0x777f('0xe')]=_0x3f6143;logger[_0x777f('0xf')](_0x777f('0x19'));return rp(_0x4038e2)[_0x777f('0x1a')](function(_0xa0c7f1){if(_0xa0c7f1){var _0x1c4b0f=_0xa0c7f1[_0x777f('0x11')];var _0x143f3d=![];var _0x5d31f1=null;if(_0x1ef1c5[_0x777f('0x1b')]!==null){logger['info'](_0x777f('0x1c'),_0x1ef1c5[_0x777f('0x1b')]);_0x1ef1c5[_0x777f('0x1d')]=_0x1ef1c5[_0x777f('0x1b')];for(_0x5d31f1=0x0;_0x5d31f1<_0x1c4b0f[_0x777f('0x12')];_0x5d31f1++){if(_0x1c4b0f[_0x5d31f1][_0x777f('0x13')]===_0x1ef1c5[_0x777f('0x1b')]){_0x143f3d=!![];_0x1ef1c5['userId']=_0x1c4b0f[_0x5d31f1]['id'];logger[_0x777f('0xf')](_0x777f('0x1e'),_0x1ef1c5['userId']);}}}if(!_0x143f3d){logger[_0x777f('0xf')]('Admin\x20selected');_0x1ef1c5[_0x777f('0x1d')]=_0x1ef1c5[_0x777f('0x1f')];_0x1ef1c5[_0x777f('0x20')]=_0x1ef1c5[_0x777f('0x14')];_0x143f3d=!![];}if(_0x143f3d){_0x361759(_0x1ef1c5);}else{_0x3aeb58({'statusCode':0x194,'message':_0x777f('0x15')});}}else{_0x3aeb58({'statusCode':0x194,'message':_0x777f('0x15')});}})[_0x777f('0x16')](function(_0x1c0984){logger[_0x777f('0x17')]('['+[_0x856923['toUpperCase']()]+']',_0x1c0984['message']);_0x3aeb58(_0x1c0984);});});};}function getEndUser(_0x16ca18,_0x37655d,_0x419735){return function(_0x1e7a4b){return new Promise(function(_0x16222c,_0x32007e){var _0x221dda=0x0;var _0x5b0504={'method':_0x777f('0xd'),'uri':_0x419735+_0x777f('0x21'),'json':!![]};_0x5b0504['headers']=_0x37655d;logger[_0x777f('0xf')](_0x777f('0x22'));return rp(_0x5b0504)['then'](function(_0x502924){_0x502924[_0x777f('0x23')][_0x777f('0x24')](function(_0x164792){if(_0x164792[_0x777f('0x25')]===_0x777f('0x26')){_0x221dda=_0x164792['id'];}});})[_0x777f('0x1a')](function(){logger[_0x777f('0xf')](_0x777f('0x27'));var _0x428577={'method':_0x777f('0xd'),'uri':_0x419735+'/api/contacts/view/'+_0x221dda,'json':!![]};_0x428577[_0x777f('0xe')]=_0x37655d;return rp(_0x428577);})[_0x777f('0x1a')](function(_0x38f032){logger[_0x777f('0xf')](_0x777f('0x28'),_0x1e7a4b[_0x777f('0x29')]);if(_0x38f032['contacts'][_0x777f('0x12')]>0x0){var _0x3c19af=_['find'](_0x38f032[_0x777f('0x2a')],function(_0x4e3d35){if(_0x4e3d35['work_number']===_0x1e7a4b[_0x777f('0x29')]||_0x4e3d35[_0x777f('0x2b')]===_0x1e7a4b[_0x777f('0x29')]){return _0x4e3d35;}});if(_0x3c19af){_0x1e7a4b[_0x777f('0x2c')]=_0x3c19af['id'];logger[_0x777f('0xf')](_0x777f('0x2d'),_0x1e7a4b[_0x777f('0x2c')]);_0x16222c(_0x1e7a4b);}else{return createEndUser(_0x1e7a4b,_0x16ca18,_0x37655d,_0x419735)[_0x777f('0x1a')](function(_0x4cd252){logger['info'](_0x777f('0x2e'),_0x1e7a4b[_0x777f('0x2c')]);_0x16222c(_0x4cd252);});}}else{return createEndUser(_0x1e7a4b,_0x16ca18,_0x37655d,_0x419735)[_0x777f('0x1a')](function(_0x23d1e5){logger[_0x777f('0xf')](_0x777f('0x2e'),_0x1e7a4b[_0x777f('0x2c')]);_0x16222c(_0x23d1e5);});}})[_0x777f('0x16')](function(_0x5f33e6){throw new Error(_0x5f33e6[_0x777f('0x2f')]);});});};}function createEndUser(_0x2f7007,_0x3e3780,_0x2975a3,_0x18f6a5){return new Promise(function(_0x351912,_0x2faf9e){var _0x1f32ad=moment();var _0x4d1a32={'method':'POST','uri':_0x18f6a5+_0x777f('0x30'),'body':{'contact':{'last_name':_0x2f7007['contactNumber'],'work_number':_0x2f7007[_0x777f('0x29')],'mobile_number':_0x2f7007[_0x777f('0x29')],'owner_id':_0x2f7007[_0x777f('0x20')],'created_at':_0x1f32ad[_0x777f('0x31')](_0x777f('0x32'))}},'json':!![]};_0x4d1a32['headers']=_0x2975a3;logger[_0x777f('0xf')](_0x777f('0x33'));return rp(_0x4d1a32)[_0x777f('0x1a')](function(_0x3a5d34){_0x2f7007[_0x777f('0x2c')]=_0x3a5d34['contact']['id'];_0x351912(_0x2f7007);})[_0x777f('0x16')](function(_0x26cefc){logger[_0x777f('0x17')]('['+[_0x3e3780[_0x777f('0x18')]()]+']',_0x26cefc[_0x777f('0x2f')]);_0x2faf9e(_0x26cefc[_0x777f('0x2f')]);});});}function getTicket(_0xd81621,_0x2f3464,_0x5e4fc2,_0x4bf42e,_0x2924e9){return function(_0x4a4eb6){logger['info'](_0x777f('0x34'));return new Promise(function(_0x1ce6b4,_0x26caff){var _0x5a94c9=moment();var _0x5aa4bb={'method':_0x777f('0x35'),'uri':_0x5e4fc2+_0x777f('0x36'),'body':{'title':intUtil[_0x777f('0x37')](_0x4bf42e[_0x777f('0x38')],_0x2924e9,'\x20'),'description':intUtil['getString'](_0x4bf42e[_0x777f('0x39')],_0x2924e9,'\x0a'),'owner_id':_0x4a4eb6[_0x777f('0x20')],'creater_id':_0x4a4eb6[_0x777f('0x14')],'targetable_id':_0x4a4eb6[_0x777f('0x2c')],'targetable_type':_0x777f('0x3a'),'created_at':_0x5a94c9[_0x777f('0x31')](_0x777f('0x32')),'due_date':_0x5a94c9[_0x777f('0x3b')](0x1e,'m')[_0x777f('0x31')](_0x777f('0x32'))},'json':!![]};_0x5aa4bb[_0x777f('0xe')]=_0x2f3464;return rp(_0x5aa4bb)[_0x777f('0x1a')](function(_0x3e82c3){_0x4a4eb6[_0x777f('0x3c')]=_0x3e82c3[_0x777f('0x3d')]['id'];logger['info'](_0x777f('0x3e'),_0x4a4eb6[_0x777f('0x3c')]);_0x1ce6b4(_0x4a4eb6);})[_0x777f('0x16')](function(_0x317d5e){logger['error']('['+[_0xd81621[_0x777f('0x18')]()]+']',_0x317d5e[_0x777f('0x2f')]);_0x26caff(_0x317d5e[_0x777f('0x2f')]);});});};}function emit(_0x5bf137,_0x486664,_0x364d41){var _0x521d62={'uri':_0x5bf137+'/contacts/'+_0x364d41};io['to'](util[_0x777f('0x31')](_0x777f('0x3f'),_0x486664))[_0x777f('0x40')](_0x777f('0x41'),_0x521d62);}exports['cs']=function(_0x3ba76d,_0x45ea24,_0x5d428,_0x366a8c,_0x510fba,_0x85e724,_0xc5e862,_0x20d57c){var _0x318ed3={};var _0xc76983={'Authorization':_0x777f('0x42')+_0x85e724[_0x777f('0x43')]};_0x85e724[_0x777f('0x44')]=intUtil[_0x777f('0x45')](_0x85e724[_0x777f('0x44')]);_0x85e724[_0x777f('0x46')]=intUtil[_0x777f('0x45')](_0x85e724[_0x777f('0x46')]);var _0x9e1545=_0x85e724[_0x777f('0x44')];_0x318ed3[_0x777f('0x1f')]=_0x85e724[_0x777f('0x47')];_0x318ed3['contactNumber']=_0x20d57c[_0x777f('0x48')]()==='outbound'?_0x45ea24[_0x777f('0x49')]:_0x45ea24[_0x777f('0x4a')];_0x318ed3[_0x777f('0x4b')]=_0x20d57c===_0x777f('0x4c')||_0x20d57c===_0x777f('0x4d')?_0x777f('0x4c'):_0x777f('0x4e');if(_0x366a8c){_0x318ed3[_0x777f('0x1b')]=_0x366a8c[_0x777f('0x13')];}var _0xcab481=util[_0x777f('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x85e724[_0x777f('0x46')],_0x45ea24['uniqueid'],md5(_0x45ea24[_0x777f('0x4f')]));if(_0x510fba&&_0x510fba[_0x777f('0x50')]){logger[_0x777f('0xf')](_0x777f('0x51'),_0x777f('0x52'));_0x45ea24[_0x777f('0x53')]=_0xcab481;}else if(_0xc5e862&&_0xc5e862[_0x777f('0x54')]&&_0xc5e862[_0x777f('0x54')]!==_0x777f('0x55')){logger[_0x777f('0xf')](_0x777f('0x56'),_0x777f('0x52'));_0x45ea24['recordingURL']=_0xcab481;}else{_0x45ea24[_0x777f('0x53')]='';}return getAdminId(_0x318ed3,_0x20d57c,_0xc76983,_0x9e1545)['then'](getUser(_0x20d57c,_0xc76983,_0x9e1545))[_0x777f('0x1a')](getEndUser(_0x20d57c,_0xc76983,_0x9e1545))['then'](getTicket(_0x20d57c,_0xc76983,_0x9e1545,_0x5d428,_0x45ea24))['then'](function(_0x533492){logger[_0x777f('0xf')](util[_0x777f('0x31')](_0x777f('0x57'),_0x533492[_0x777f('0x3c')]));if(_0x20d57c!=='unmanaged'){logger[_0x777f('0xf')]('['+[_0x20d57c['toUpperCase']()]+']',_0x777f('0x58'));emit(_0x9e1545,_0x366a8c[_0x777f('0x25')],_0x533492[_0x777f('0x2c')]);}})[_0x777f('0x16')](function(_0x3cd815){logger[_0x777f('0x17')]('['+[_0x20d57c[_0x777f('0x18')]()]+_0x777f('0x59'),util[_0x777f('0x5a')](_0x3cd815,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcfc7=['Admin\x20found:','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','Requested\x20Resource\x20not\x20Found','Getting\x20contacts\x20filter','filters','forEach','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%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','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminId','info'];(function(_0x25c0aa,_0x34dd4a){var _0x28a1ab=function(_0x147466){while(--_0x147466){_0x25c0aa['push'](_0x25c0aa['shift']());}};_0x28a1ab(++_0x34dd4a);}(_0xcfc7,0x13d));var _0x7cfc=function(_0x524fc0,_0x1544f6){_0x524fc0=_0x524fc0-0x0;var _0x2469f2=_0xcfc7[_0x524fc0];return _0x2469f2;};'use strict';var _=require('lodash');var rp=require(_0x7cfc('0x0'));var md5=require(_0x7cfc('0x1'));var util=require(_0x7cfc('0x2'));var moment=require(_0x7cfc('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x7cfc('0x4'));var logger=require(_0x7cfc('0x5'))('freshsales');config[_0x7cfc('0x6')]=_['defaults'](config[_0x7cfc('0x6')],{'host':_0x7cfc('0x7'),'port':0x18eb});var io=require(_0x7cfc('0x8'))(new Redis(config[_0x7cfc('0x6')]));function getAdminId(_0x582a02,_0x59632c,_0x428628,_0x5b87fc){return new Promise(function(_0x103642,_0x2bc01a){var _0x164441=![];var _0x317a09={'method':_0x7cfc('0x9'),'uri':_0x5b87fc+_0x7cfc('0xa'),'json':!![]};_0x317a09[_0x7cfc('0xb')]=_0x428628;logger['info'](_0x7cfc('0xc'));return rp(_0x317a09)[_0x7cfc('0xd')](function(_0x522de0){if(_0x522de0){var _0x1ffe98=_0x522de0[_0x7cfc('0xe')];var _0x2fd14a=null;for(_0x2fd14a=0x0;_0x2fd14a<_0x1ffe98[_0x7cfc('0xf')];_0x2fd14a++){if(_0x1ffe98[_0x2fd14a][_0x7cfc('0x10')]===_0x582a02['adminEmail']){_0x582a02[_0x7cfc('0x11')]=_0x1ffe98[_0x2fd14a]['id'];_0x164441=!![];}}if(_0x164441){logger[_0x7cfc('0x12')](_0x7cfc('0x13'),_0x582a02[_0x7cfc('0x11')]);_0x103642(_0x582a02);}else{_0x2bc01a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2bc01a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7cfc('0x14')](function(_0x2c2a28){logger[_0x7cfc('0x15')]('['+[_0x59632c[_0x7cfc('0x16')]()]+']',_0x2c2a28[_0x7cfc('0x17')]);_0x2bc01a(_0x2c2a28);});});}function getUser(_0x864256,_0x1eb04c,_0x15b49a){return function(_0x3904a7){return new Promise(function(_0x2f2320,_0x17d21a){var _0x592a42={'method':_0x7cfc('0x9'),'uri':_0x15b49a+_0x7cfc('0xa'),'json':!![]};_0x592a42[_0x7cfc('0xb')]=_0x1eb04c;logger[_0x7cfc('0x12')]('Getting\x20user\x20list');return rp(_0x592a42)[_0x7cfc('0xd')](function(_0x3edaba){if(_0x3edaba){var _0x4528ac=_0x3edaba['users'];var _0x234e09=![];var _0x3e0a60=null;if(_0x3904a7[_0x7cfc('0x18')]!==null){logger[_0x7cfc('0x12')](_0x7cfc('0x19'),_0x3904a7['agentEmail']);_0x3904a7[_0x7cfc('0x1a')]=_0x3904a7[_0x7cfc('0x18')];for(_0x3e0a60=0x0;_0x3e0a60<_0x4528ac[_0x7cfc('0xf')];_0x3e0a60++){if(_0x4528ac[_0x3e0a60]['email']===_0x3904a7[_0x7cfc('0x18')]){_0x234e09=!![];_0x3904a7[_0x7cfc('0x1b')]=_0x4528ac[_0x3e0a60]['id'];logger['info'](_0x7cfc('0x1c'),_0x3904a7['userId']);}}}if(!_0x234e09){logger[_0x7cfc('0x12')](_0x7cfc('0x1d'));_0x3904a7[_0x7cfc('0x1a')]=_0x3904a7[_0x7cfc('0x1e')];_0x3904a7[_0x7cfc('0x1b')]=_0x3904a7[_0x7cfc('0x11')];_0x234e09=!![];}if(_0x234e09){_0x2f2320(_0x3904a7);}else{_0x17d21a({'statusCode':0x194,'message':_0x7cfc('0x1f')});}}else{_0x17d21a({'statusCode':0x194,'message':_0x7cfc('0x1f')});}})['catch'](function(_0x42957d){logger['error']('['+[_0x864256[_0x7cfc('0x16')]()]+']',_0x42957d['message']);_0x17d21a(_0x42957d);});});};}function getEndUser(_0x32d7fd,_0x5a3e56,_0x476bb2){return function(_0x22db89){return new Promise(function(_0x5056c0,_0x279353){var _0x3194e3=0x0;var _0x2a5173={'method':_0x7cfc('0x9'),'uri':_0x476bb2+'/api/contacts/filters','json':!![]};_0x2a5173[_0x7cfc('0xb')]=_0x5a3e56;logger[_0x7cfc('0x12')](_0x7cfc('0x20'));return rp(_0x2a5173)[_0x7cfc('0xd')](function(_0x1c9211){_0x1c9211[_0x7cfc('0x21')][_0x7cfc('0x22')](function(_0x28d10a){if(_0x28d10a['name']==='All\x20Contacts'){_0x3194e3=_0x28d10a['id'];}});})[_0x7cfc('0xd')](function(){logger[_0x7cfc('0x12')]('Getting\x20contact\x20list');var _0x29cda1={'method':'GET','uri':_0x476bb2+'/api/contacts/view/'+_0x3194e3,'json':!![]};_0x29cda1[_0x7cfc('0xb')]=_0x5a3e56;return rp(_0x29cda1);})[_0x7cfc('0xd')](function(_0x329cbd){logger[_0x7cfc('0x12')](_0x7cfc('0x23'),_0x22db89[_0x7cfc('0x24')]);if(_0x329cbd[_0x7cfc('0x25')]['length']>0x0){var _0x3304e4=_[_0x7cfc('0x26')](_0x329cbd[_0x7cfc('0x25')],function(_0x59da36){if(_0x59da36[_0x7cfc('0x27')]===_0x22db89[_0x7cfc('0x24')]||_0x59da36[_0x7cfc('0x28')]===_0x22db89[_0x7cfc('0x24')]){return _0x59da36;}});if(_0x3304e4){_0x22db89[_0x7cfc('0x29')]=_0x3304e4['id'];logger[_0x7cfc('0x12')]('Contact\x20found:',_0x22db89[_0x7cfc('0x29')]);_0x5056c0(_0x22db89);}else{return createEndUser(_0x22db89,_0x32d7fd,_0x5a3e56,_0x476bb2)['then'](function(_0x41c253){logger[_0x7cfc('0x12')](_0x7cfc('0x2a'),_0x22db89[_0x7cfc('0x29')]);_0x5056c0(_0x41c253);});}}else{return createEndUser(_0x22db89,_0x32d7fd,_0x5a3e56,_0x476bb2)['then'](function(_0x8d6c02){logger['info'](_0x7cfc('0x2a'),_0x22db89['endUserId']);_0x5056c0(_0x8d6c02);});}})[_0x7cfc('0x14')](function(_0x367a15){throw new Error(_0x367a15[_0x7cfc('0x17')]);});});};}function createEndUser(_0x417ccf,_0x1a5bc2,_0x17fe54,_0x1753e1){return new Promise(function(_0x3b2b58,_0x1a4168){var _0x50529e=moment();var _0x2a6423={'method':_0x7cfc('0x2b'),'uri':_0x1753e1+_0x7cfc('0x2c'),'body':{'contact':{'last_name':_0x417ccf['contactNumber'],'work_number':_0x417ccf[_0x7cfc('0x24')],'mobile_number':_0x417ccf[_0x7cfc('0x24')],'owner_id':_0x417ccf['userId'],'created_at':_0x50529e[_0x7cfc('0x2d')](_0x7cfc('0x2e'))}},'json':!![]};_0x2a6423[_0x7cfc('0xb')]=_0x17fe54;logger['info'](_0x7cfc('0x2f'));return rp(_0x2a6423)[_0x7cfc('0xd')](function(_0x2e6728){_0x417ccf[_0x7cfc('0x29')]=_0x2e6728[_0x7cfc('0x30')]['id'];_0x3b2b58(_0x417ccf);})[_0x7cfc('0x14')](function(_0x4dc36c){logger[_0x7cfc('0x15')]('['+[_0x1a5bc2[_0x7cfc('0x16')]()]+']',_0x4dc36c['message']);_0x1a4168(_0x4dc36c[_0x7cfc('0x17')]);});});}function getTicket(_0x5a7b16,_0x476b69,_0x4f4bba,_0x4529c5,_0x582d19){return function(_0x2b219d){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x1fdfa6,_0x3136cc){var _0x508f1d=moment();var _0x1b3d0a={'method':_0x7cfc('0x2b'),'uri':_0x4f4bba+_0x7cfc('0x31'),'body':{'title':intUtil[_0x7cfc('0x32')](_0x4529c5[_0x7cfc('0x33')],_0x582d19,'\x20'),'description':intUtil['getString'](_0x4529c5[_0x7cfc('0x34')],_0x582d19,'\x0a'),'owner_id':_0x2b219d[_0x7cfc('0x1b')],'creater_id':_0x2b219d[_0x7cfc('0x11')],'targetable_id':_0x2b219d['endUserId'],'targetable_type':_0x7cfc('0x35'),'created_at':_0x508f1d[_0x7cfc('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x508f1d[_0x7cfc('0x36')](0x1e,'m')[_0x7cfc('0x2d')](_0x7cfc('0x2e'))},'json':!![]};_0x1b3d0a[_0x7cfc('0xb')]=_0x476b69;return rp(_0x1b3d0a)[_0x7cfc('0xd')](function(_0x22a6f1){_0x2b219d[_0x7cfc('0x37')]=_0x22a6f1['task']['id'];logger[_0x7cfc('0x12')](_0x7cfc('0x38'),_0x2b219d['ticketId']);_0x1fdfa6(_0x2b219d);})[_0x7cfc('0x14')](function(_0x2299ab){logger['error']('['+[_0x5a7b16['toUpperCase']()]+']',_0x2299ab[_0x7cfc('0x17')]);_0x3136cc(_0x2299ab[_0x7cfc('0x17')]);});});};}function emit(_0x33e4d2,_0x50cd05,_0x3b18f9){var _0x586199={'uri':_0x33e4d2+_0x7cfc('0x39')+_0x3b18f9};io['to'](util[_0x7cfc('0x2d')](_0x7cfc('0x3a'),_0x50cd05))['emit'](_0x7cfc('0x3b'),_0x586199);}exports['cs']=function(_0x5555bd,_0x29f043,_0xdbf849,_0x26b70d,_0x2b6286,_0x47931b,_0x504072,_0x131e3a){var _0x5a10c1={};var _0x210ebb={'Authorization':'Token\x20token='+_0x47931b['apiKey']};_0x47931b[_0x7cfc('0x3c')]=intUtil[_0x7cfc('0x3d')](_0x47931b['remoteUri']);_0x47931b[_0x7cfc('0x3e')]=intUtil[_0x7cfc('0x3d')](_0x47931b[_0x7cfc('0x3e')]);var _0x41d5d5=_0x47931b[_0x7cfc('0x3c')];_0x5a10c1[_0x7cfc('0x1e')]=_0x47931b[_0x7cfc('0x3f')];_0x5a10c1[_0x7cfc('0x24')]=_0x131e3a[_0x7cfc('0x40')]()===_0x7cfc('0x41')?_0x29f043[_0x7cfc('0x42')]:_0x29f043[_0x7cfc('0x43')];_0x5a10c1['callDirection']=_0x131e3a==='queue'||_0x131e3a==='unmanaged'?_0x7cfc('0x44'):'outbound';if(_0x26b70d){_0x5a10c1['agentEmail']=_0x26b70d[_0x7cfc('0x10')];}var _0x540172=util[_0x7cfc('0x2d')](_0x7cfc('0x45'),_0x47931b[_0x7cfc('0x3e')],_0x29f043[_0x7cfc('0x46')],md5(_0x29f043['uniqueid']));if(_0x2b6286&&_0x2b6286[_0x7cfc('0x47')]){logger[_0x7cfc('0x12')](_0x7cfc('0x48'),_0x7cfc('0x49'));_0x29f043['recordingURL']=_0x540172;}else if(_0x504072&&_0x504072[_0x7cfc('0x4a')]&&_0x504072['recordingFormat']!==_0x7cfc('0x4b')){logger['info'](_0x7cfc('0x4c'),_0x7cfc('0x49'));_0x29f043['recordingURL']=_0x540172;}else{_0x29f043[_0x7cfc('0x4d')]='';}return getAdminId(_0x5a10c1,_0x131e3a,_0x210ebb,_0x41d5d5)[_0x7cfc('0xd')](getUser(_0x131e3a,_0x210ebb,_0x41d5d5))['then'](getEndUser(_0x131e3a,_0x210ebb,_0x41d5d5))[_0x7cfc('0xd')](getTicket(_0x131e3a,_0x210ebb,_0x41d5d5,_0xdbf849,_0x29f043))[_0x7cfc('0xd')](function(_0x3b692c){logger[_0x7cfc('0x12')](util['format'](_0x7cfc('0x4e'),_0x3b692c[_0x7cfc('0x37')]));if(_0x131e3a!==_0x7cfc('0x4f')){logger[_0x7cfc('0x12')]('['+[_0x131e3a['toUpperCase']()]+']',_0x7cfc('0x50'));emit(_0x41d5d5,_0x26b70d[_0x7cfc('0x51')],_0x3b692c[_0x7cfc('0x29')]);}})[_0x7cfc('0x14')](function(_0x1a6b38){logger[_0x7cfc('0x15')]('['+[_0x131e3a[_0x7cfc('0x16')]()]+_0x7cfc('0x52'),util[_0x7cfc('0x53')](_0x1a6b38,{'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 5a331ec..bd8b5f5 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 _0xb62e=['./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','lodash','util','./zendesk'];(function(_0x27cc35,_0x3bca75){var _0x5d94c5=function(_0x24aa20){while(--_0x24aa20){_0x27cc35['push'](_0x27cc35['shift']());}};_0x5d94c5(++_0x3bca75);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var zendesk=require(_0xeb62('0x2'));var salesforce=require(_0xeb62('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xeb62('0x4'));var zoho=require(_0xeb62('0x5'));var desk=require(_0xeb62('0x6'));var vtiger=require(_0xeb62('0x7'));var servicenow=require(_0xeb62('0x8'));var dynamics365=require(_0xeb62('0x9'));var freshsales=require('./freshsales');var integrations=[_0xeb62('0xa'),_0xeb62('0xb'),_0xeb62('0xc'),'freshdesk',_0xeb62('0xd'),_0xeb62('0xe'),_0xeb62('0xf'),_0xeb62('0x10'),'freshsales','servicenow'];exports[_0xeb62('0x11')]=function(_0x40584b,_0x6d5e94,_0xf93c21,_0x2fe923,_0xc91abc,_0x35afc3){if(_0xf93c21){if(_[_0xeb62('0x12')](integrations,_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]())){try{var _0x4a493c=null;var _0x422daf='';var _0xcc11c4=_0xf93c21[_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()];if(_0xcc11c4){var _0x55a629=_0xcc11c4[_0x40584b[_0xeb62('0x15')]];if(_0x55a629){var _0x2fbad2=_[_0xeb62('0x16')](_0x55a629['Configurations'],{'id':parseInt(_0x40584b[_0xeb62('0x17')],0xa)});if(_0x2fbad2){if(_0x2fe923){if(_0xc91abc&&_0x6d5e94[_0xeb62('0x18')]){_0x422daf=_0xeb62('0x18');}else if(_0x6d5e94['routeId']){_0x422daf=_0xeb62('0x19');}else{console[_0xeb62('0x1a')](_0xeb62('0x1b'),_0x6d5e94);}}else{_0x422daf=_0xeb62('0x1c');}switch(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()){case _0xeb62('0xa'):zendesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xb'):salesforce[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xc'):sugarcrm[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0x1d'):freshdesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xd'):zoho[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xe'):desk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xf'):vtiger[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case'freshsales':freshsales['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x1e'):servicenow['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x10'):dynamics365['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;default:console[_0xeb62('0x1a')](_0xeb62('0x1f'));}}else{_0x4a493c=require(_0xeb62('0x20'))(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]());_0x4a493c['error']('[EXEC]',util[_0xeb62('0x21')](_0xeb62('0x22'),_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')](),_0x40584b[_0xeb62('0x17')]));}}else{_0x4a493c=require('../../../../config/logger')(_0x40584b['data1'][_0xeb62('0x14')]());_0x4a493c[_0xeb62('0x23')](_0xeb62('0x24'),util[_0xeb62('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x40584b['data1'][_0xeb62('0x14')](),_0x40584b['data2']));}}else{}}catch(_0x448327){console['error'](_0x448327);}}}}; \ No newline at end of file +var _0x5f66=['dynamics365','freshsales','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger'];(function(_0x3cbf7f,_0x8ca86a){var _0x2019b2=function(_0x8a60a9){while(--_0x8a60a9){_0x3cbf7f['push'](_0x3cbf7f['shift']());}};_0x2019b2(++_0x8ca86a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x65f6('0x1'));var sugarcrm=require(_0x65f6('0x2'));var freshdesk=require(_0x65f6('0x3'));var zoho=require(_0x65f6('0x4'));var desk=require(_0x65f6('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x65f6('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x65f6('0x7'));var integrations=[_0x65f6('0x8'),'salesforce','sugarcrm',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'servicenow'];exports['exec']=function(_0x18fea1,_0x2f6d5b,_0x264647,_0x25c416,_0x50d26d,_0x41a7fd){if(_0x264647){if(_['includes'](integrations,_0x18fea1['data1'][_0x65f6('0xf')]())){try{var _0x576875=null;var _0x419819='';var _0x4862a5=_0x264647[_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()];if(_0x4862a5){var _0x2c4ee5=_0x4862a5[_0x18fea1[_0x65f6('0x11')]];if(_0x2c4ee5){var _0x369f96=_[_0x65f6('0x12')](_0x2c4ee5[_0x65f6('0x13')],{'id':parseInt(_0x18fea1[_0x65f6('0x14')],0xa)});if(_0x369f96){if(_0x25c416){if(_0x50d26d&&_0x2f6d5b[_0x65f6('0x15')]){_0x419819=_0x65f6('0x15');}else if(_0x2f6d5b['routeId']){_0x419819=_0x65f6('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x2f6d5b);}}else{_0x419819=_0x65f6('0x17');}switch(_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()){case _0x65f6('0x8'):zendesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x18'):salesforce[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x19'):sugarcrm[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x9'):freshdesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xa'):zoho[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'desk':desk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'vtiger':vtiger[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xe'):freshsales['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'servicenow':servicenow['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'dynamics365':dynamics365['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;default:console['log'](_0x65f6('0x1a'));}}else{_0x576875=require(_0x65f6('0x1b'))(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')](_0x65f6('0x1d'),util[_0x65f6('0x1e')](_0x65f6('0x1f'),_0x18fea1[_0x65f6('0x10')]['toLowerCase'](),_0x18fea1[_0x65f6('0x14')]));}}else{_0x576875=require('../../../../config/logger')(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')]('[EXEC]',util[_0x65f6('0x1e')](_0x65f6('0x20'),_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')](),_0x18fea1['data2']));}}else{}}catch(_0x9d7bb0){console[_0x65f6('0x1c')](_0x9d7bb0);}}}}; \ 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 dbe6519..5653005 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 _0xe7ba=['Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','string','content','toString','type','variable','variableName','customVariable','Variable','name','idField','toLowerCase','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','uniqueid','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','calleridname','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','find','execute','Email','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','Lead','contact','lead'];(function(_0x3b51ad,_0x4fe357){var _0x5051d8=function(_0x115bc2){while(--_0x115bc2){_0x3b51ad['push'](_0x3b51ad['shift']());}};_0x5051d8(++_0x4fe357);}(_0xe7ba,0x18d));var _0xae7b=function(_0x418f7e,_0x4314c7){_0x418f7e=_0x418f7e-0x0;var _0x2c9d63=_0xe7ba[_0x418f7e];return _0x2c9d63;};'use strict';var _=require(_0xae7b('0x0'));var rp=require(_0xae7b('0x1'));var moment=require(_0xae7b('0x2'));var BPromise=require(_0xae7b('0x3'));var md5=require('md5');var jsforce=require(_0xae7b('0x4'));var util=require(_0xae7b('0x5'));var Redis=require('ioredis');var intUtil=require(_0xae7b('0x6'));var config=require(_0xae7b('0x7'));var logger=require(_0xae7b('0x8'))(_0xae7b('0x9'));config[_0xae7b('0xa')]=_['defaults'](config['redis'],{'host':_0xae7b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xae7b('0xa')]));function emit(_0x3db6ee,_0x1e41d4,_0x3074ac){io['to'](_0x3db6ee)[_0xae7b('0xc')](_0x1e41d4,_0x3074ac);}function getTicket(_0x2528ae,_0x339a9c,_0x6b1d78,_0x1c1171,_0x3f8145,_0x484a58,_0x55fd5e,_0x2ddaf4){var _0x490caa={};if(_0x1c1171[_0xae7b('0xd')]===_0xae7b('0xe')){_0x490caa=Object[_0xae7b('0xf')]({},{'OwnerId':_0x339a9c['id'],'ActivityDate':moment[_0xae7b('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xae7b('0x11')](_0x1c1171[_0xae7b('0x12')],_0x3f8145,'\x20'),'Description':intUtil[_0xae7b('0x11')](_0x1c1171[_0xae7b('0x13')],_0x3f8145,'\x0a')},getCustomFields(_0x484a58,_0x3f8145));if(_0x6b1d78){_0x490caa[_0xae7b('0x14')]=_0x6b1d78['id'];}}else if(_0x1c1171[_0xae7b('0xd')]===_0xae7b('0x15')){_0x490caa=Object[_0xae7b('0xf')]({},{'OwnerId':_0x339a9c['id'],'Subject':intUtil['getString'](_0x1c1171[_0xae7b('0x12')],_0x3f8145,'\x20'),'Description':intUtil['getString'](_0x1c1171['Descriptions'],_0x3f8145,'\x0a')},getCustomFields(_0x484a58,_0x3f8145));if(_0x6b1d78){_0x490caa[_0xae7b('0x16')]=_0x6b1d78['id'];}}return _0x55fd5e[_0xae7b('0x17')](_0x1c1171['ticketType'])['create'](_0x490caa);}function getUser(_0x325f5e,_0xb93dbc,_0x4f5bf0){if(!_['isNil'](_0xb93dbc)&&intUtil['validateEmail'](_0xb93dbc)){var _0x183095={'Email':_0xb93dbc};var _0x4fb6e1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4f5bf0[_0xae7b('0x17')]('User')[_0xae7b('0x18')](_0x183095,_0x4fb6e1)[_0xae7b('0x19')]()['then'](function(_0x41b4c7){if(_0x41b4c7['length']){var _0x472a35=_['find'](_0x41b4c7,function(_0x2ab82f){return _0x2ab82f[_0xae7b('0x1a')]===_0xb93dbc;});if(_0x472a35){logger[_0xae7b('0x1b')](_0xae7b('0x1c'),_0xb93dbc);return BPromise[_0xae7b('0x1d')]({'id':_0x472a35['Id'],'name':_0x472a35['Name']});}}else{logger[_0xae7b('0x1b')](_0xae7b('0x1e'),_0xb93dbc);return _0x4f5bf0[_0xae7b('0x1f')]()['then'](function(_0x20f46){return BPromise['resolve']({'id':_0x20f46['user_id'],'name':_0x20f46[_0xae7b('0x20')]});});}});}else{logger[_0xae7b('0x1b')](_0xae7b('0x1e'),_0xb93dbc);return _0x4f5bf0[_0xae7b('0x1f')]()['then'](function(_0x1b4dd3){return BPromise[_0xae7b('0x1d')]({'id':_0x1b4dd3[_0xae7b('0x21')],'name':_0x1b4dd3['display_name']});});}}function getEndUser(_0x33c454,_0x1e9bd6,_0x22689d,_0x2cefde,_0x104a2c){var _0x21483a={'Phone':_0x2cefde};var _0x2dfc5a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xae7b('0x1d')]()[_0xae7b('0x22')](function(){if(_0x1e9bd6['ticketType']===_0xae7b('0xe')){logger[_0xae7b('0x1b')](_0xae7b('0x23'),_0x2cefde,_0x1e9bd6['moduleSearch']);switch(_0x1e9bd6[_0xae7b('0x24')]){case _0xae7b('0x25'):return _0x104a2c[_0xae7b('0x17')](_0xae7b('0x26'))[_0xae7b('0x18')](_0x21483a,_0x2dfc5a)[_0xae7b('0x19')]()[_0xae7b('0x22')](function(_0x19b17c){if(_0x19b17c&&_0x19b17c[_0xae7b('0x27')]){return _0x19b17c;}else{return _0x104a2c[_0xae7b('0x17')](_0xae7b('0x28'))[_0xae7b('0x18')](_0x21483a,_0x2dfc5a);}});case _0xae7b('0x29'):return _0x104a2c[_0xae7b('0x17')](_0xae7b('0x26'))['find'](_0x21483a,_0x2dfc5a)['execute']();case _0xae7b('0x2a'):return _0x104a2c[_0xae7b('0x17')](_0xae7b('0x28'))[_0xae7b('0x18')](_0x21483a,_0x2dfc5a);default:return null;}}else if(_0x1e9bd6['ticketType']==='Case'){logger[_0xae7b('0x1b')](_0xae7b('0x23'),_0x2cefde,_0xae7b('0x29'));return _0x104a2c[_0xae7b('0x17')]('Contact')[_0xae7b('0x18')](_0x21483a,_0x2dfc5a)['execute']();}})[_0xae7b('0x22')](function(_0x3a516b){if(_0x3a516b&&_0x3a516b[_0xae7b('0x27')]){var _0x147517=_[_0xae7b('0x18')](_0x3a516b,function(_0xb39b50){return _0xb39b50[_0xae7b('0x2b')]===_0x2cefde;});if(_0x147517){return BPromise[_0xae7b('0x1d')]({'id':_0x147517['Id'],'name':_0x147517[_0xae7b('0x2c')],'phone':_0x147517[_0xae7b('0x2b')]});}}})[_0xae7b('0x22')](function(_0xdab3){if(_0xdab3){logger[_0xae7b('0x1b')](_0xae7b('0x2d'),_0x2cefde);return BPromise[_0xae7b('0x1d')](_0xdab3);}else{logger[_0xae7b('0x1b')](_0xae7b('0x2e'),_0x2cefde);var _0x2f22f5={'LastName':_0x22689d!==_0xae7b('0x2f')?_0x22689d:util['format'](_0xae7b('0x30'),_0x2cefde),'Phone':_0x2cefde};if(_0x1e9bd6['moduleCreate']){if(_0x1e9bd6['moduleCreate']==='contact'){logger[_0xae7b('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2cefde,_0x1e9bd6[_0xae7b('0x31')]);}else if(_0x1e9bd6[_0xae7b('0x31')]==='lead'&&_0x1e9bd6[_0xae7b('0xd')]==='Task'){logger['info'](_0xae7b('0x32'),_0x2cefde,_0x1e9bd6['moduleCreate']);_0x2f22f5[_0xae7b('0x33')]=_0xae7b('0x34');}else{return null;}}return _0x104a2c['sobject'](_[_0xae7b('0x35')](_0x1e9bd6['moduleCreate']))[_0xae7b('0x36')](_0x2f22f5);}});}function getCustomFields(_0x11d55e,_0x7e806d){var _0x84ea83={};if(_0x11d55e[_0xae7b('0x27')]>0x0){_[_0xae7b('0x37')](_0x11d55e,function(_0x596088){if(_0x596088['type']===_0xae7b('0x38')&&_0x596088['idField']){_0x84ea83[_0x596088['idField']]=_0x596088[_0xae7b('0x39')][_0xae7b('0x3a')]();}else if(_0x596088[_0xae7b('0x3b')]===_0xae7b('0x3c')&&_0x596088[_0xae7b('0x3d')]&&_0x596088['idField']){_0x7e806d[_0x596088[_0xae7b('0x3d')]]&&(_0x84ea83[_0x596088['idField']]=_0x7e806d[_0x596088[_0xae7b('0x3d')]][_0xae7b('0x3a')]());}else if(_0x596088[_0xae7b('0x3b')]===_0xae7b('0x3e')&&_0x596088[_0xae7b('0x3f')]&&_0x596088['Variable'][_0xae7b('0x40')]&&_0x596088[_0xae7b('0x41')]){_0x7e806d[_0x596088[_0xae7b('0x3f')][_0xae7b('0x40')]['toLowerCase']()]&&(_0x84ea83[_0x596088[_0xae7b('0x41')]]=_0x7e806d[_0x596088[_0xae7b('0x3f')][_0xae7b('0x40')][_0xae7b('0x42')]()]['toString']());}});}return _0x84ea83;}function getConnection(_0xb8af48){var _0x5058b3=_0xb8af48['password'][_0xae7b('0x43')](_0xb8af48[_0xae7b('0x44')]);var _0x1e99cf=new jsforce[(_0xae7b('0x45'))]({'oauth2':{'loginUrl':_0xb8af48[_0xae7b('0x46')]||'https://login.salesforce.com','clientId':_0xb8af48['clientId'],'clientSecret':_0xb8af48[_0xae7b('0x47')]}});return _0x1e99cf[_0xae7b('0x48')](_0xb8af48[_0xae7b('0x49')],_0x5058b3)[_0xae7b('0x22')](function(){logger[_0xae7b('0x1b')](_0xae7b('0x4a'));return _0x1e99cf;});}exports[_0xae7b('0x4b')]=function(_0x32b272,_0x436248,_0x3489ef,_0x5416cf,_0x12e865,_0xcf88c){var _0x2ae4d7,_0x552498,_0x27a0f1,_0x2f9ded;_0xcf88c[_0xae7b('0x4c')]=intUtil['stripTrailingSlash'](_0xcf88c[_0xae7b('0x4c')]);_0xcf88c['remoteUri']=intUtil[_0xae7b('0x4d')](_0xcf88c[_0xae7b('0x46')]);if(_0x12e865&&_0x12e865[_0xae7b('0x4e')]){logger[_0xae7b('0x1b')]('[QUEUE]',_0xae7b('0x4f'));_0x436248[_0xae7b('0x50')]=util[_0xae7b('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xcf88c[_0xae7b('0x4c')],_0x436248[_0xae7b('0x52')],md5(_0x436248[_0xae7b('0x52')]));}else{_0x436248[_0xae7b('0x50')]='';}return getConnection(_0xcf88c)[_0xae7b('0x22')](function(_0x12045f){_0x2f9ded=_0x12045f;return getUser(_0xcf88c,_0x5416cf['email'],_0x2f9ded);})[_0xae7b('0x22')](function(_0x4d0e3c){_0x2ae4d7=_0x4d0e3c;return getEndUser(_0xcf88c,_0x3489ef,_0x436248['calleridname'],_0x436248[_0xae7b('0x53')],_0x2f9ded);})[_0xae7b('0x22')](function(_0x1b3001){_0x552498=_0x1b3001;return getTicket(_0xcf88c,_0x2ae4d7,_0x552498,_0x3489ef,_0x436248,_0x3489ef[_0xae7b('0x54')],_0x2f9ded,_0xae7b('0x4b'));})['then'](function(_0x4f8a49){_0x27a0f1=_0x4f8a49;logger['info'](_0xae7b('0x55'),_0x27a0f1['id']);logger[_0xae7b('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x27a0f1['id'],_0x5416cf['name'],_0xcf88c['type']);switch(_0xcf88c[_0xae7b('0x3b')]){case'integrationTab':emit(util[_0xae7b('0x51')](_0xae7b('0x56'),_0x5416cf[_0xae7b('0x40')]),_0xae7b('0x57'),{'recordId':_0x27a0f1['id']});break;case'newTab':emit(util['format'](_0xae7b('0x56'),_0x5416cf[_0xae7b('0x40')]),'trigger:browser:url',{'uri':util[_0xae7b('0x51')]('%s/%s/e',_0x2f9ded['instanceUrl'],_0x27a0f1['id'])});break;default:logger[_0xae7b('0x58')](_0xae7b('0x59'));}})[_0xae7b('0x5a')](function(_0x44884b){logger[_0xae7b('0x58')](_0xae7b('0x5b'),JSON[_0xae7b('0x5c')](_0x44884b));});};exports[_0xae7b('0x5d')]=function(_0x1c277a,_0x5fb9cd,_0x3f2687,_0x371c99,_0x4b2496,_0x5831fd,_0x16dc1f){var _0x30de01,_0x32a045,_0x592a54,_0x27c0d;_0x5831fd[_0xae7b('0x4c')]=intUtil[_0xae7b('0x4d')](_0x5831fd['serverUrl']);_0x5831fd[_0xae7b('0x46')]=intUtil[_0xae7b('0x4d')](_0x5831fd['remoteUri']);if(_0x16dc1f&&_0x16dc1f[_0xae7b('0x5e')]&&_0x16dc1f[_0xae7b('0x5e')]!==_0xae7b('0x5f')){logger[_0xae7b('0x1b')]('[OUTBOUND]',_0xae7b('0x4f'));_0x5fb9cd[_0xae7b('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5831fd['serverUrl'],_0x5fb9cd['uniqueid'],md5(_0x5fb9cd['uniqueid']));}return getConnection(_0x5831fd)[_0xae7b('0x22')](function(_0x3f0dde){_0x27c0d=_0x3f0dde;return getUser(_0x5831fd,_0x371c99['email'],_0x27c0d);})[_0xae7b('0x22')](function(_0x315d39){_0x30de01=_0x315d39;return getEndUser(_0x5831fd,_0x3f2687,_0x5fb9cd[_0xae7b('0x60')],_0x5fb9cd['destcalleridnum'],_0x27c0d);})[_0xae7b('0x22')](function(_0x527cc6){_0x32a045=_0x527cc6;return getTicket(_0x5831fd,_0x30de01,_0x32a045,_0x3f2687,_0x5fb9cd,_0x3f2687[_0xae7b('0x54')],_0x27c0d,_0xae7b('0x5d'));})[_0xae7b('0x22')](function(_0x530edd){_0x592a54=_0x530edd;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x592a54['id']);logger['info'](_0xae7b('0x61'),_0x592a54['id'],_0x371c99['name'],_0x5831fd['type']);switch(_0x5831fd['type']){case'integrationTab':emit(util[_0xae7b('0x51')](_0xae7b('0x56'),_0x371c99[_0xae7b('0x40')]),_0xae7b('0x57'),{'recordId':_0x592a54['id']});break;case _0xae7b('0x62'):emit(util[_0xae7b('0x51')](_0xae7b('0x56'),_0x371c99['name']),_0xae7b('0x63'),{'uri':util[_0xae7b('0x51')]('%s/%s/e',_0x27c0d[_0xae7b('0x64')],_0x592a54['id'])});break;default:logger[_0xae7b('0x58')](_0xae7b('0x65'),_0xae7b('0x66'));}})[_0xae7b('0x5a')](function(_0x119ea0){logger[_0xae7b('0x58')](_0xae7b('0x65'),JSON['stringify'](_0x119ea0));});};exports[_0xae7b('0x67')]=function(_0x169e6b,_0x4d1e4f,_0x508858,_0x4d7b55,_0x251ba4,_0x49910a){var _0x335508,_0x3fbaff,_0x15887c,_0x3d1b65;_0x49910a[_0xae7b('0x4c')]=intUtil[_0xae7b('0x4d')](_0x49910a[_0xae7b('0x4c')]);_0x49910a['remoteUri']=intUtil[_0xae7b('0x4d')](_0x49910a[_0xae7b('0x46')]);if(_0x251ba4&&_0x251ba4[_0xae7b('0x4e')]){logger['info']('['+_0x4d1e4f['lastevent']['toUpperCase']()+']',_0xae7b('0x4f'));_0x4d1e4f[_0xae7b('0x50')]=util[_0xae7b('0x51')](_0xae7b('0x68'),_0x49910a[_0xae7b('0x4c')],_0x4d1e4f[_0xae7b('0x52')],md5(_0x4d1e4f[_0xae7b('0x52')]));}else{_0x4d1e4f[_0xae7b('0x50')]='';}return getConnection(_0x49910a)[_0xae7b('0x22')](function(_0x526775){_0x3d1b65=_0x526775;if(!_[_0xae7b('0x69')](_0x4d7b55)){return getUser(_0x49910a,_0x4d7b55[_0xae7b('0x40')],_0x3d1b65);}else{return getUser(_0x49910a,null,_0x3d1b65);}})['then'](function(_0x2c8772){_0x335508=_0x2c8772;return getEndUser(_0x49910a,_0x508858,_0x4d1e4f[_0xae7b('0x6a')],_0x4d1e4f['calleridnum'],_0x3d1b65);})[_0xae7b('0x22')](function(_0xbaac9b){_0x3fbaff=_0xbaac9b;return getTicket(_0x49910a,_0x335508,_0x3fbaff,_0x508858,_0x4d1e4f,_0x508858[_0xae7b('0x54')],_0x3d1b65);})[_0xae7b('0x22')](function(_0x1dfd2b){_0x15887c=_0x1dfd2b;logger['info']('['+_0x4d1e4f[_0xae7b('0x6b')][_0xae7b('0x6c')]()+_0xae7b('0x6d'),_0x15887c['id']);logger[_0xae7b('0x1b')]('['+_0x4d1e4f['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x49910a[_0xae7b('0x3b')]);})['catch'](function(_0x495c58){logger[_0xae7b('0x58')]('['+_0x4d1e4f[_0xae7b('0x6b')]['toUpperCase']()+']',JSON[_0xae7b('0x5c')](_0x495c58));});}; \ No newline at end of file +var _0x8b41=['uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','Subjects','getString','Descriptions','Case','ContactId','isNil','validateEmail','sobject','User','find','execute','then','length','Email','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','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','No\x20Company','upperFirst','create','forEach','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x2b4c00,_0x1b426b){var _0x4fc4e5=function(_0xef824e){while(--_0xef824e){_0x2b4c00['push'](_0x2b4c00['shift']());}};_0x4fc4e5(++_0x1b426b);}(_0x8b41,0x8b));var _0x18b4=function(_0x520c96,_0x2fbf53){_0x520c96=_0x520c96-0x0;var _0x1c27d5=_0x8b41[_0x520c96];return _0x1c27d5;};'use strict';var _=require('lodash');var rp=require(_0x18b4('0x0'));var moment=require('moment');var BPromise=require(_0x18b4('0x1'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x18b4('0x2'));var Redis=require(_0x18b4('0x3'));var intUtil=require(_0x18b4('0x4'));var config=require(_0x18b4('0x5'));var logger=require(_0x18b4('0x6'))(_0x18b4('0x7'));config[_0x18b4('0x8')]=_[_0x18b4('0x9')](config[_0x18b4('0x8')],{'host':_0x18b4('0xa'),'port':0x18eb});var io=require(_0x18b4('0xb'))(new Redis(config[_0x18b4('0x8')]));function emit(_0x4ca262,_0x132aed,_0x261b99){io['to'](_0x4ca262)[_0x18b4('0xc')](_0x132aed,_0x261b99);}function getTicket(_0x274878,_0x3e5d03,_0x2f2958,_0x542f77,_0x1b7c56,_0x8b45c8,_0x3c4a56,_0xb4724b){var _0xf24c3c={};if(_0x542f77[_0x18b4('0xd')]===_0x18b4('0xe')){_0xf24c3c=Object[_0x18b4('0xf')]({},{'OwnerId':_0x3e5d03['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x542f77[_0x18b4('0x10')],_0x1b7c56,'\x20'),'Description':intUtil[_0x18b4('0x11')](_0x542f77[_0x18b4('0x12')],_0x1b7c56,'\x0a')},getCustomFields(_0x8b45c8,_0x1b7c56));if(_0x2f2958){_0xf24c3c['WhoId']=_0x2f2958['id'];}}else if(_0x542f77[_0x18b4('0xd')]===_0x18b4('0x13')){_0xf24c3c=Object[_0x18b4('0xf')]({},{'OwnerId':_0x3e5d03['id'],'Subject':intUtil[_0x18b4('0x11')](_0x542f77['Subjects'],_0x1b7c56,'\x20'),'Description':intUtil[_0x18b4('0x11')](_0x542f77['Descriptions'],_0x1b7c56,'\x0a')},getCustomFields(_0x8b45c8,_0x1b7c56));if(_0x2f2958){_0xf24c3c[_0x18b4('0x14')]=_0x2f2958['id'];}}return _0x3c4a56['sobject'](_0x542f77['ticketType'])['create'](_0xf24c3c);}function getUser(_0x1f18e7,_0x5ab417,_0xecf56b){if(!_[_0x18b4('0x15')](_0x5ab417)&&intUtil[_0x18b4('0x16')](_0x5ab417)){var _0x160d71={'Email':_0x5ab417};var _0x26f067={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xecf56b[_0x18b4('0x17')](_0x18b4('0x18'))[_0x18b4('0x19')](_0x160d71,_0x26f067)[_0x18b4('0x1a')]()[_0x18b4('0x1b')](function(_0x4b5411){if(_0x4b5411[_0x18b4('0x1c')]){var _0x4e1a56=_[_0x18b4('0x19')](_0x4b5411,function(_0x175792){return _0x175792[_0x18b4('0x1d')]===_0x5ab417;});if(_0x4e1a56){logger[_0x18b4('0x1e')]('Agent\x20%s\x20found.',_0x5ab417);return BPromise['resolve']({'id':_0x4e1a56['Id'],'name':_0x4e1a56[_0x18b4('0x1f')]});}}else{logger[_0x18b4('0x1e')](_0x18b4('0x20'),_0x5ab417);return _0xecf56b[_0x18b4('0x21')]()['then'](function(_0x1a1a23){return BPromise['resolve']({'id':_0x1a1a23[_0x18b4('0x22')],'name':_0x1a1a23[_0x18b4('0x23')]});});}});}else{logger[_0x18b4('0x1e')](_0x18b4('0x20'),_0x5ab417);return _0xecf56b[_0x18b4('0x21')]()[_0x18b4('0x1b')](function(_0x29e47e){return BPromise[_0x18b4('0x24')]({'id':_0x29e47e[_0x18b4('0x22')],'name':_0x29e47e[_0x18b4('0x23')]});});}}function getEndUser(_0x4ec6fa,_0x3e93e3,_0x363476,_0xcc2cbb,_0x3efa30){var _0x45a388={'Phone':_0xcc2cbb};var _0x1ef414={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x18b4('0x24')]()[_0x18b4('0x1b')](function(){if(_0x3e93e3['ticketType']===_0x18b4('0xe')){logger['info'](_0x18b4('0x25'),_0xcc2cbb,_0x3e93e3[_0x18b4('0x26')]);switch(_0x3e93e3[_0x18b4('0x26')]){case _0x18b4('0x27'):return _0x3efa30['sobject'](_0x18b4('0x28'))[_0x18b4('0x19')](_0x45a388,_0x1ef414)[_0x18b4('0x1a')]()[_0x18b4('0x1b')](function(_0x663df8){if(_0x663df8&&_0x663df8[_0x18b4('0x1c')]){return _0x663df8;}else{return _0x3efa30[_0x18b4('0x17')](_0x18b4('0x29'))[_0x18b4('0x19')](_0x45a388,_0x1ef414);}});case _0x18b4('0x2a'):return _0x3efa30['sobject']('Contact')[_0x18b4('0x19')](_0x45a388,_0x1ef414)[_0x18b4('0x1a')]();case _0x18b4('0x2b'):return _0x3efa30[_0x18b4('0x17')](_0x18b4('0x29'))[_0x18b4('0x19')](_0x45a388,_0x1ef414);default:return null;}}else if(_0x3e93e3[_0x18b4('0xd')]===_0x18b4('0x13')){logger[_0x18b4('0x1e')](_0x18b4('0x25'),_0xcc2cbb,_0x18b4('0x2a'));return _0x3efa30[_0x18b4('0x17')](_0x18b4('0x28'))[_0x18b4('0x19')](_0x45a388,_0x1ef414)[_0x18b4('0x1a')]();}})['then'](function(_0x33a09f){if(_0x33a09f&&_0x33a09f[_0x18b4('0x1c')]){var _0x53f447=_['find'](_0x33a09f,function(_0x256500){return _0x256500[_0x18b4('0x2c')]===_0xcc2cbb;});if(_0x53f447){return BPromise[_0x18b4('0x24')]({'id':_0x53f447['Id'],'name':_0x53f447['Name'],'phone':_0x53f447[_0x18b4('0x2c')]});}}})[_0x18b4('0x1b')](function(_0x29171c){if(_0x29171c){logger[_0x18b4('0x1e')](_0x18b4('0x2d'),_0xcc2cbb);return BPromise[_0x18b4('0x24')](_0x29171c);}else{logger[_0x18b4('0x1e')](_0x18b4('0x2e'),_0xcc2cbb);var _0x83ca96={'LastName':_0x363476!==_0x18b4('0x2f')?_0x363476:util[_0x18b4('0x30')](_0x18b4('0x31'),_0xcc2cbb),'Phone':_0xcc2cbb};if(_0x3e93e3['moduleCreate']){if(_0x3e93e3[_0x18b4('0x32')]==='contact'){logger[_0x18b4('0x1e')](_0x18b4('0x33'),_0xcc2cbb,_0x3e93e3[_0x18b4('0x32')]);}else if(_0x3e93e3[_0x18b4('0x32')]===_0x18b4('0x2b')&&_0x3e93e3['ticketType']===_0x18b4('0xe')){logger['info'](_0x18b4('0x33'),_0xcc2cbb,_0x3e93e3[_0x18b4('0x32')]);_0x83ca96[_0x18b4('0x34')]=_0x18b4('0x35');}else{return null;}}return _0x3efa30[_0x18b4('0x17')](_[_0x18b4('0x36')](_0x3e93e3[_0x18b4('0x32')]))[_0x18b4('0x37')](_0x83ca96);}});}function getCustomFields(_0x5c1152,_0x4bd0f9){var _0x30e65a={};if(_0x5c1152[_0x18b4('0x1c')]>0x0){_[_0x18b4('0x38')](_0x5c1152,function(_0xc37da3){if(_0xc37da3['type']===_0x18b4('0x39')&&_0xc37da3[_0x18b4('0x3a')]){_0x30e65a[_0xc37da3['idField']]=_0xc37da3[_0x18b4('0x3b')][_0x18b4('0x3c')]();}else if(_0xc37da3[_0x18b4('0x3d')]===_0x18b4('0x3e')&&_0xc37da3['variableName']&&_0xc37da3[_0x18b4('0x3a')]){_0x4bd0f9[_0xc37da3['variableName']]&&(_0x30e65a[_0xc37da3[_0x18b4('0x3a')]]=_0x4bd0f9[_0xc37da3[_0x18b4('0x3f')]][_0x18b4('0x3c')]());}else if(_0xc37da3['type']===_0x18b4('0x40')&&_0xc37da3[_0x18b4('0x41')]&&_0xc37da3[_0x18b4('0x41')][_0x18b4('0x42')]&&_0xc37da3[_0x18b4('0x3a')]){_0x4bd0f9[_0xc37da3[_0x18b4('0x41')][_0x18b4('0x42')]['toLowerCase']()]&&(_0x30e65a[_0xc37da3['idField']]=_0x4bd0f9[_0xc37da3['Variable'][_0x18b4('0x42')][_0x18b4('0x43')]()][_0x18b4('0x3c')]());}});}return _0x30e65a;}function getConnection(_0x38db07){var _0x557a91=_0x38db07[_0x18b4('0x44')][_0x18b4('0x45')](_0x38db07[_0x18b4('0x46')]);var _0x348f76=new jsforce[(_0x18b4('0x47'))]({'oauth2':{'loginUrl':_0x38db07[_0x18b4('0x48')]||_0x18b4('0x49'),'clientId':_0x38db07[_0x18b4('0x4a')],'clientSecret':_0x38db07[_0x18b4('0x4b')]}});return _0x348f76['login'](_0x38db07[_0x18b4('0x4c')],_0x557a91)['then'](function(){logger['info'](_0x18b4('0x4d'));return _0x348f76;});}exports[_0x18b4('0x4e')]=function(_0x192702,_0x3cc8a9,_0xfbb431,_0x507c79,_0x480792,_0x273d30){var _0x300f06,_0x5b08ca,_0x3dcbb9,_0x3c18f8;_0x273d30[_0x18b4('0x4f')]=intUtil[_0x18b4('0x50')](_0x273d30[_0x18b4('0x4f')]);_0x273d30[_0x18b4('0x48')]=intUtil['stripTrailingSlash'](_0x273d30[_0x18b4('0x48')]);if(_0x480792&&_0x480792[_0x18b4('0x51')]){logger[_0x18b4('0x1e')](_0x18b4('0x52'),'Recording\x20is\x20enabled!');_0x3cc8a9[_0x18b4('0x53')]=util[_0x18b4('0x30')](_0x18b4('0x54'),_0x273d30[_0x18b4('0x4f')],_0x3cc8a9[_0x18b4('0x55')],md5(_0x3cc8a9[_0x18b4('0x55')]));}else{_0x3cc8a9[_0x18b4('0x53')]='';}return getConnection(_0x273d30)['then'](function(_0x5af90b){_0x3c18f8=_0x5af90b;return getUser(_0x273d30,_0x507c79[_0x18b4('0x56')],_0x3c18f8);})[_0x18b4('0x1b')](function(_0x22d6b8){_0x300f06=_0x22d6b8;return getEndUser(_0x273d30,_0xfbb431,_0x3cc8a9[_0x18b4('0x57')],_0x3cc8a9[_0x18b4('0x58')],_0x3c18f8);})[_0x18b4('0x1b')](function(_0x4c0e7e){_0x5b08ca=_0x4c0e7e;return getTicket(_0x273d30,_0x300f06,_0x5b08ca,_0xfbb431,_0x3cc8a9,_0xfbb431['Fields'],_0x3c18f8,_0x18b4('0x4e'));})[_0x18b4('0x1b')](function(_0x1c68c7){_0x3dcbb9=_0x1c68c7;logger[_0x18b4('0x1e')](_0x18b4('0x59'),_0x3dcbb9['id']);logger['info'](_0x18b4('0x5a'),_0x3dcbb9['id'],_0x507c79[_0x18b4('0x42')],_0x273d30[_0x18b4('0x3d')]);switch(_0x273d30[_0x18b4('0x3d')]){case'integrationTab':emit(util['format'](_0x18b4('0x5b'),_0x507c79[_0x18b4('0x42')]),'trigger:salesforce:display',{'recordId':_0x3dcbb9['id']});break;case _0x18b4('0x5c'):emit(util[_0x18b4('0x30')](_0x18b4('0x5b'),_0x507c79[_0x18b4('0x42')]),_0x18b4('0x5d'),{'uri':util[_0x18b4('0x30')](_0x18b4('0x5e'),_0x3c18f8[_0x18b4('0x5f')],_0x3dcbb9['id'])});break;default:logger[_0x18b4('0x60')](_0x18b4('0x61'));}})['catch'](function(_0x2963dd){logger[_0x18b4('0x60')]('[QUEUE]',JSON[_0x18b4('0x62')](_0x2963dd));});};exports[_0x18b4('0x63')]=function(_0x32f080,_0x56f60a,_0x3e8988,_0x50858a,_0x46ea75,_0x33f9d7,_0x73aa7c){var _0x37927c,_0x6cd78a,_0x5dbd7b,_0x2d37ce;_0x33f9d7[_0x18b4('0x4f')]=intUtil[_0x18b4('0x50')](_0x33f9d7['serverUrl']);_0x33f9d7[_0x18b4('0x48')]=intUtil['stripTrailingSlash'](_0x33f9d7['remoteUri']);if(_0x73aa7c&&_0x73aa7c[_0x18b4('0x64')]&&_0x73aa7c[_0x18b4('0x64')]!==_0x18b4('0x65')){logger['info'](_0x18b4('0x66'),'Recording\x20is\x20enabled!');_0x56f60a[_0x18b4('0x53')]=util[_0x18b4('0x30')](_0x18b4('0x54'),_0x33f9d7[_0x18b4('0x4f')],_0x56f60a['uniqueid'],md5(_0x56f60a[_0x18b4('0x55')]));}return getConnection(_0x33f9d7)['then'](function(_0x2ca83f){_0x2d37ce=_0x2ca83f;return getUser(_0x33f9d7,_0x50858a[_0x18b4('0x56')],_0x2d37ce);})[_0x18b4('0x1b')](function(_0x27db57){_0x37927c=_0x27db57;return getEndUser(_0x33f9d7,_0x3e8988,_0x56f60a[_0x18b4('0x67')],_0x56f60a['destcalleridnum'],_0x2d37ce);})[_0x18b4('0x1b')](function(_0x129731){_0x6cd78a=_0x129731;return getTicket(_0x33f9d7,_0x37927c,_0x6cd78a,_0x3e8988,_0x56f60a,_0x3e8988[_0x18b4('0x68')],_0x2d37ce,_0x18b4('0x63'));})[_0x18b4('0x1b')](function(_0x584fa5){_0x5dbd7b=_0x584fa5;logger[_0x18b4('0x1e')](_0x18b4('0x69'),_0x5dbd7b['id']);logger[_0x18b4('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5dbd7b['id'],_0x50858a[_0x18b4('0x42')],_0x33f9d7[_0x18b4('0x3d')]);switch(_0x33f9d7[_0x18b4('0x3d')]){case'integrationTab':emit(util[_0x18b4('0x30')](_0x18b4('0x5b'),_0x50858a[_0x18b4('0x42')]),_0x18b4('0x6a'),{'recordId':_0x5dbd7b['id']});break;case'newTab':emit(util[_0x18b4('0x30')](_0x18b4('0x5b'),_0x50858a[_0x18b4('0x42')]),_0x18b4('0x5d'),{'uri':util[_0x18b4('0x30')](_0x18b4('0x5e'),_0x2d37ce['instanceUrl'],_0x5dbd7b['id'])});break;default:logger[_0x18b4('0x60')](_0x18b4('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x18b4('0x6b')](function(_0x4f32d2){logger[_0x18b4('0x60')](_0x18b4('0x66'),JSON[_0x18b4('0x62')](_0x4f32d2));});};exports[_0x18b4('0x6c')]=function(_0x5d9388,_0x272c80,_0x1b2f9d,_0xcfd23e,_0x331614,_0x4ed586){var _0x3f991c,_0x432dc3,_0x2e05fa,_0x5f33c9;_0x4ed586[_0x18b4('0x4f')]=intUtil[_0x18b4('0x50')](_0x4ed586[_0x18b4('0x4f')]);_0x4ed586[_0x18b4('0x48')]=intUtil['stripTrailingSlash'](_0x4ed586[_0x18b4('0x48')]);if(_0x331614&&_0x331614[_0x18b4('0x51')]){logger[_0x18b4('0x1e')]('['+_0x272c80[_0x18b4('0x6d')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x272c80[_0x18b4('0x53')]=util[_0x18b4('0x30')](_0x18b4('0x54'),_0x4ed586[_0x18b4('0x4f')],_0x272c80[_0x18b4('0x55')],md5(_0x272c80['uniqueid']));}else{_0x272c80[_0x18b4('0x53')]='';}return getConnection(_0x4ed586)[_0x18b4('0x1b')](function(_0xce257a){_0x5f33c9=_0xce257a;if(!_[_0x18b4('0x15')](_0xcfd23e)){return getUser(_0x4ed586,_0xcfd23e['name'],_0x5f33c9);}else{return getUser(_0x4ed586,null,_0x5f33c9);}})['then'](function(_0x3e837d){_0x3f991c=_0x3e837d;return getEndUser(_0x4ed586,_0x1b2f9d,_0x272c80[_0x18b4('0x57')],_0x272c80['calleridnum'],_0x5f33c9);})['then'](function(_0x270b75){_0x432dc3=_0x270b75;return getTicket(_0x4ed586,_0x3f991c,_0x432dc3,_0x1b2f9d,_0x272c80,_0x1b2f9d['Fields'],_0x5f33c9);})[_0x18b4('0x1b')](function(_0x4d45df){_0x2e05fa=_0x4d45df;logger[_0x18b4('0x1e')]('['+_0x272c80[_0x18b4('0x6d')][_0x18b4('0x6e')]()+']\x20Ticket\x20%s\x20created.',_0x2e05fa['id']);logger[_0x18b4('0x1e')]('['+_0x272c80[_0x18b4('0x6d')][_0x18b4('0x6e')]()+_0x18b4('0x6f'),_0x4ed586[_0x18b4('0x3d')]);})['catch'](function(_0x3c2fa1){logger[_0x18b4('0x60')]('['+_0x272c80[_0x18b4('0x6d')][_0x18b4('0x6e')]()+']',JSON['stringify'](_0x3c2fa1));});}; \ 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 a6532c1..f99bd4b 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 _0xadb5=['endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','forEach','push','length','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xadb5,0xad));var _0x5adb=function(_0x330aa4,_0xfc6432){_0x330aa4=_0x330aa4-0x0;var _0xb257f0=_0xadb5[_0x330aa4];return _0xb257f0;};'use strict';var _=require('lodash');var Promise=require(_0x5adb('0x0'));var rp=require('request-promise');var util=require(_0x5adb('0x1'));var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));function getAdminUser(_0x353885,_0x47228a,_0x6d1b45,_0x41261c,_0x7293ab,_0x34f59d){return new Promise(function(_0x336bad,_0x129f5a){var _0x275428={'method':'GET','uri':_0x41261c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7293ab+'&'+_0x34f59d,'auth':_0x47228a,'json':!![]};return rp(_0x275428)[_0x5adb('0xb')](function(_0x1ea238){if(_0x1ea238[_0x5adb('0xc')]['length']>0x0){_0x6d1b45[_0x5adb('0xd')]=_0x1ea238['result'][0x0][_0x5adb('0xe')];}logger['info']('['+[_0x353885[_0x5adb('0xf')]()]+_0x5adb('0x10'),_0x6d1b45);_0x336bad(_0x6d1b45);})[_0x5adb('0x11')](function(_0x5c929a){logger[_0x5adb('0x12')]('['+[_0x353885[_0x5adb('0xf')]()]+']',_0x5c929a[_0x5adb('0x13')]);_0x129f5a(_0x5c929a['message']);});});}function getUser(_0x2312de,_0x518823,_0x367d82,_0x42a482,_0x30614e){return function(_0x304784){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x15'),_0x304784);return new Promise(function(_0x42f4c6,_0xb953a6){if(intUtil['validateEmail'](_0x304784[_0x5adb('0x16')])){var _0x5de028={'method':_0x5adb('0x17'),'uri':_0x367d82+'sys_user?sysparm_query=email%3D'+_0x304784[_0x5adb('0x16')]+'&'+_0x42a482+'&'+_0x30614e,'auth':_0x518823,'json':!![]};logger['info']('['+[_0x2312de['toUpperCase']()]+_0x5adb('0x18'),_0x5de028);return rp(_0x5de028)[_0x5adb('0xb')](function(_0x438671){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+'],\x20getUser\x20entity',_0x438671);if(_0x438671[_0x5adb('0xc')]['length']>0x0&&String(_0x438671['result'][0x0][_0x5adb('0x19')])===_0x5adb('0x1a')){_0x304784[_0x5adb('0x1b')]=_0x438671[_0x5adb('0xc')][0x0][_0x5adb('0xe')];}else{_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784['userEmail']=_0x304784[_0x5adb('0x1c')];}logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x1d'),_0x304784);_0x42f4c6(_0x304784);})[_0x5adb('0x11')](function(_0x49f203){logger[_0x5adb('0x12')]('['+[_0x2312de[_0x5adb('0xf')]()]+']',_0x49f203['message']);_0xb953a6(_0x49f203[_0x5adb('0x13')]);});}else{logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+']\x20using\x20admin\x20profile');_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784[_0x5adb('0x16')]=_0x304784[_0x5adb('0x1c')];_0x42f4c6(_0x304784);}});};}function createEndUser(_0x36459b,_0x1c06c4,_0x4a5d46,_0x49992e,_0x5d457e){logger[_0x5adb('0x14')]('['+[_0x36459b[_0x5adb('0xf')]()]+_0x5adb('0x1e'),_0x4a5d46);return new Promise(function(_0x512bab,_0x137a5c){var _0x4de310={'method':_0x5adb('0x1f'),'uri':_0x49992e+_0x5adb('0x20')+_0x5d457e,'body':{'user_name':_0x4a5d46[_0x5adb('0x21')],'roles':_0x5adb('0x22'),'first_name':_0x4a5d46[_0x5adb('0x21')],'active':_0x5adb('0x1a'),'date_format':_0x5adb('0x23'),'phone':_0x4a5d46[_0x5adb('0x21')]},'auth':_0x1c06c4,'json':!![]};return rp(_0x4de310)[_0x5adb('0xb')](function(_0x260295){logger['info']('['+[_0x36459b[_0x5adb('0xf')]()]+'],\x20EndUser\x20schema',_0x260295[_0x5adb('0xc')]);_0x4a5d46[_0x5adb('0x24')]=_0x260295['result'][_0x5adb('0xe')];_0x512bab(_0x4a5d46);})[_0x5adb('0x11')](function(_0x461a39){logger['error']('['+[_0x36459b[_0x5adb('0xf')]()]+']',_0x461a39[_0x5adb('0x13')]);_0x137a5c(_0x461a39['message']);});});}function getEndUser(_0x5bb227,_0x1ed9ea,_0x49dd03,_0x663ea0,_0x222568){return function(_0x3c2b07){logger[_0x5adb('0x14')]('['+[_0x5bb227[_0x5adb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x3c2b07);return new Promise(function(_0x2f7abe,_0x215b88){var _0x1c3a5c={'method':'GET','uri':_0x49dd03+'sys_user?sysparm_query=phone%3D'+_0x3c2b07[_0x5adb('0x21')]+'&'+_0x663ea0+'&'+_0x222568,'auth':_0x1ed9ea,'json':!![]};return rp(_0x1c3a5c)[_0x5adb('0xb')](function(_0x586820){if(_0x586820[_0x5adb('0xc')]['length']>0x0){_0x3c2b07[_0x5adb('0x24')]=_0x586820['result'][0x0][_0x5adb('0xe')];logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x25'),_0x3c2b07);_0x2f7abe(_0x3c2b07);}else{return createEndUser(_0x5bb227,_0x1ed9ea,_0x3c2b07,_0x49dd03,_0x663ea0)['then'](function(_0x4761e3){logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x26'),_0x4761e3);_0x2f7abe(_0x4761e3);});}})[_0x5adb('0x11')](function(_0x50edd1){logger[_0x5adb('0x12')]('['+[_0x5bb227[_0x5adb('0xf')]()]+']',_0x50edd1[_0x5adb('0x13')]);_0x215b88(_0x50edd1[_0x5adb('0x13')]);});});};}function getCustomFields(_0x22aa95,_0x52d74f){var _0x50fe99={};if(_0x22aa95['length']>0x0){_['forEach'](_0x22aa95,function(_0x427c71){if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x28')&&_0x427c71[_0x5adb('0x29')]&&!_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')]['toString']();}else if(_0x427c71['type']===_0x5adb('0x28')&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')][_0x5adb('0x2e')]();}else if(_0x427c71['type']===_0x5adb('0x2f')&&_0x427c71[_0x5adb('0x30')]&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')]['toLowerCase']()]=_0x52d74f[_0x427c71[_0x5adb('0x30')]][_0x5adb('0x2e')]();}else if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x31')&&_0x427c71[_0x5adb('0x32')]&&_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]&&_0x427c71['idField']&&_0x427c71['customField']){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x52d74f[_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]['toLowerCase']()]['toString']();}});}return _0x50fe99;}function getTicket(_0xaa32e4,_0x4d7d86,_0x264dfd,_0x72218,_0x1713bc,_0x5358c0){return function(_0x182cbc){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x34'),_0x182cbc);return new Promise(function(_0x251f45,_0x1cdb03){var _0x24758f=_0xaa32e4[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x182cbc[_0x5adb('0x1b')]:_0x182cbc[_0x5adb('0x24')];var _0x49e1a1={'method':_0x5adb('0x1f'),'uri':_0x264dfd+'incident'+'?'+_0x5358c0,'body':Object['assign']({},{'active':'true','caller_id':_0x24758f,'assigned_to':_0x182cbc[_0x5adb('0x1b')],'short_description':intUtil[_0x5adb('0x36')](_0x72218[_0x5adb('0x37')],_0x1713bc,'\x20'),'description':intUtil['getString'](_0x72218[_0x5adb('0x38')],_0x1713bc,'\x0a')},getCustomFields(_0x72218['Fields'],_0x1713bc)),'auth':_0x4d7d86,'json':!![]};return rp(_0x49e1a1)[_0x5adb('0xb')](function(_0x2c3f21){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x39'),_0x2c3f21['result']);_0x182cbc[_0x5adb('0x3a')]=_0x2c3f21[_0x5adb('0xc')]['sys_id'];_0x182cbc[_0x5adb('0x3b')]=_0x2c3f21[_0x5adb('0xc')][_0x5adb('0x3c')];logger[_0x5adb('0x14')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']\x20getTicket\x20crm',_0x182cbc);_0x251f45(_0x182cbc);})[_0x5adb('0x11')](function(_0x3a5703){logger[_0x5adb('0x12')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']',_0x3a5703['message']);_0x1cdb03(_0x3a5703[_0x5adb('0x13')]);});});};}function createRemoteTag(_0x14a46f,_0x3b4794,_0x4d98d0,_0x2b34a8){return new Promise(function(_0xd0e5b7,_0x444a6c){var _0xfd3471={'method':'POST','uri':_0x4d98d0+_0x5adb('0x3d')+'?'+_0x2b34a8,'body':{'short_description':_0x14a46f,'global':!![],'active':!![],'name':_0x14a46f},'auth':_0x3b4794,'json':!![]};return rp(_0xfd3471)[_0x5adb('0xb')](function(_0x28b291){var _0x2cee37=_0x28b291[_0x5adb('0xc')]['sys_id'];_0xd0e5b7(_0x2cee37);});});}function getRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227,_0x31ae72){return new Promise(function(_0x35df22,_0x1a9358){var _0x42f6d9={'method':'GET','uri':_0x2b790d+_0x5adb('0x3d')+_0x5adb('0x3e')+_0x378938+'&'+_0x4f7227,'auth':_0x4b8d28,'json':!![]};return rp(_0x42f6d9)[_0x5adb('0xb')](function(_0x53d262){if(_0x53d262['result']['length']>0x0){var _0x18ee9a=_0x53d262[_0x5adb('0xc')][0x0][_0x5adb('0xe')];_0x35df22(_0x18ee9a);}else{return createRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227)[_0x5adb('0xb')](function(_0xa833f4){_0x35df22(_0xa833f4);});}});});}function assignTagToIncident(_0xb06bee,_0x204b9b,_0x8d7810,_0xc880af,_0x380d76){return new Promise(function(_0x452767,_0x1df439){var _0x2c2357={'method':'POST','uri':_0x8d7810+'label_entry'+'?'+_0x380d76,'body':{'label':_0xb06bee,'table':_0x5adb('0x3f'),'id_type':_0x5adb('0x40'),'table_key':_0xc880af[_0x5adb('0x3a')],'title':_0x5adb('0x41')+_0xc880af['ticketNumber'],'id_display':_0xc880af[_0x5adb('0x3b')]},'auth':_0x204b9b,'json':!![]};return rp(_0x2c2357)[_0x5adb('0xb')](function(_0x5d2d2f){_0x452767();})[_0x5adb('0x11')](function(){_0x452767();});});}function manageTags(_0x476e62,_0x1505f7,_0x5edd60,_0x30d185,_0x409357,_0x19df2f,_0x30c92c){return new Promise(function(_0x330290,_0x428019){var _0x513f26=[];_0x1505f7[_0x5adb('0x42')](function(_0x1f042f){_0x513f26[_0x5adb('0x43')](getRemoteTag(_0x1f042f,_0x5edd60,_0x30d185,_0x19df2f,_0x30c92c));});return Promise['all'](_0x513f26)[_0x5adb('0xb')](function(_0x239862){if(_0x239862[_0x5adb('0x44')]){logger['info']('['+[_0x476e62[_0x5adb('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x239862);var _0xa8ff64=[];_0x239862[_0x5adb('0x42')](function(_0x24e1ab){_0xa8ff64['push'](assignTagToIncident(_0x24e1ab,_0x5edd60,_0x30d185,_0x409357,_0x19df2f));});return Promise[_0x5adb('0x45')](_0xa8ff64)[_0x5adb('0xb')](function(){_0x330290();})['catch'](function(){_0x330290();});}else{_0x330290();}});});}function getTags(_0x12711e,_0x432a3e,_0x248739,_0x3fcad5,_0x55cd0a,_0x4290bb){return function(_0x2b8298){return new Promise(function(_0x307f07,_0x16716e){var _0x5b7556=[];var _0x53a4bc=_0x3fcad5[_0x5adb('0x46')];if(_0x53a4bc&&_0x53a4bc['length']>0x0){_0x5b7556=_['map'](_0x53a4bc,'name');}if(_0x5b7556[_0x5adb('0x44')]>0x0){return manageTags(_0x12711e,_0x5b7556,_0x432a3e,_0x248739,_0x2b8298,_0x55cd0a,_0x4290bb)[_0x5adb('0xb')](function(){_0x307f07(_0x2b8298);});}else{_0x307f07(_0x2b8298);}});};}function emit(_0x48bb5c,_0x395350,_0x91e023){var _0xcdde17=_0x5adb('0x47')+_0x5adb('0x48')+_0x5adb('0x49')+_0x5adb('0x4a');var _0x1ffcd3={'uri':_0x48bb5c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x91e023+_0xcdde17};io['to'](util['format']('user:%s',_0x395350))[_0x5adb('0x4b')](_0x5adb('0x4c'),_0x1ffcd3);}exports['cs']=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb,_0x2f6ef7,_0x386c76,_0x25f761,_0x58455b,_0x5e55c2){var _0x1fc73b={};var _0x56df90={'user':_0x25f761[_0x5adb('0x4d')],'pass':_0x25f761[_0x5adb('0x4e')]};var _0x2146f0=_0x5adb('0x4f');var _0x40140f=_0x5adb('0x50');_0x25f761[_0x5adb('0x51')]=intUtil[_0x5adb('0x52')](_0x25f761['remoteUri']);_0x25f761[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x25f761[_0x5adb('0x53')]);var _0x5d3aa4=util[_0x5adb('0x54')](_0x5adb('0x55'),_0x25f761['remoteUri']);_0x1fc73b[_0x5adb('0x16')]=!_['isNil'](_0x2f6ef7)?_0x2f6ef7[_0x5adb('0x56')]:null;_0x1fc73b[_0x5adb('0x1c')]=_0x25f761['email'];_0x1fc73b[_0x5adb('0x21')]=_0x5e55c2[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x2a55a3[_0x5adb('0x57')]:_0x2a55a3[_0x5adb('0x58')];_0x1fc73b[_0x5adb('0x59')]=_0x5e55c2===_0x5adb('0x5a')||_0x5e55c2===_0x5adb('0x5b')?'queue':_0x5adb('0x35');var _0x31345d=util[_0x5adb('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25f761['serverUrl'],_0x2a55a3[_0x5adb('0x5c')],md5(_0x2a55a3['uniqueid']));if(_0x386c76&&_0x386c76[_0x5adb('0x5d')]){logger[_0x5adb('0x14')](_0x5adb('0x5e'),'Recording\x20is\x20enabled!');_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else if(_0x58455b&&_0x58455b[_0x5adb('0x60')]&&_0x58455b[_0x5adb('0x60')]!==_0x5adb('0x61')){logger[_0x5adb('0x14')]('[OUTBOUND]',_0x5adb('0x62'));_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else{_0x2a55a3[_0x5adb('0x5f')]='';}return getAdminUser(_0x5e55c2,_0x56df90,_0x1fc73b,_0x5d3aa4,_0x40140f,_0x2146f0)[_0x5adb('0xb')](getUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))['then'](getEndUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))[_0x5adb('0xb')](getTicket(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x1f59bb,_0x2a55a3,_0x40140f))[_0x5adb('0xb')](function(_0x182873){logger[_0x5adb('0x14')](util[_0x5adb('0x54')](_0x5adb('0x63'),_0x182873[_0x5adb('0x3a')]));logger['info'](util[_0x5adb('0x54')](_0x5adb('0x64'),_0x5e55c2));if(_0x5e55c2!=='unmanaged'){logger[_0x5adb('0x14')]('['+[_0x5e55c2[_0x5adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25f761[_0x5adb('0x51')],_0x2f6ef7['name'],_0x182873[_0x5adb('0x3a')]);}})[_0x5adb('0x11')](function(_0x4a2ebc){logger[_0x5adb('0x12')]('['+[_0x5e55c2['toUpperCase']()]+_0x5adb('0x65'),util[_0x5adb('0x66')](_0x4a2ebc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x331d14,_0x5af293){var _0x3f39ab=function(_0x4db8db){while(--_0x4db8db){_0x331d14['push'](_0x331d14['shift']());}};_0x3f39ab(++_0x5af293);}(_0x326f,0xd1));var _0xf326=function(_0x59cd1b,_0x3bfeff){_0x59cd1b=_0x59cd1b-0x0;var _0x82e8a8=_0x326f[_0x59cd1b];return _0x82e8a8;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 5df502e..cf08d45 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 _0x63d4=['username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','charAt','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','type','string','nameField','customField','content','custom_fields','customVariable','Variable','toLowerCase','login'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x63d4,0x117));var _0x463d=function(_0x1b39a1,_0x3e885c){_0x1b39a1=_0x1b39a1-0x0;var _0x2fbcec=_0x63d4[_0x1b39a1];return _0x2fbcec;};'use strict';var _=require(_0x463d('0x0'));var rp=require(_0x463d('0x1'));var BPromise=require(_0x463d('0x2'));var md5=require('md5');var util=require(_0x463d('0x3'));var Redis=require(_0x463d('0x4'));var intUtil=require(_0x463d('0x5'));var config=require(_0x463d('0x6'));var logger=require(_0x463d('0x7'))('sugarcrm');config[_0x463d('0x8')]=_[_0x463d('0x9')](config['redis'],{'host':_0x463d('0xa'),'port':0x18eb});var io=require(_0x463d('0xb'))(new Redis(config[_0x463d('0x8')]));var def={'method':_0x463d('0xc'),'json':!![]};function emit(_0x218286,_0x4d32fb,_0x24ac84){io['to'](_0x218286)['emit'](_0x4d32fb,_0x24ac84);}function getTicket(_0x42b27e,_0x2d714b,_0x1f5d4a,_0xecad46,_0x4c7bcc,_0x4c7afd,_0x1d4661,_0x48aff3){logger[_0x463d('0xd')](_0x463d('0xe'));var _0x15e87f=new Date();var _0x2f0039=[{'name':_0x463d('0xf'),'value':intUtil[_0x463d('0x10')](_0xecad46[_0x463d('0x11')],_0x4c7bcc,'\x20')},{'name':'assigned_user_id','value':_0x2d714b['id']},{'name':_0x463d('0x12'),'value':_0x2d714b['id']},{'name':_0x463d('0x13'),'value':intUtil[_0x463d('0x10')](_0xecad46['Descriptions'],_0x4c7bcc,'\x0a')},{'name':_0x463d('0x14'),'value':_0x15e87f[_0x463d('0x15')]()[_0x463d('0x16')](0x0,0x13)[_0x463d('0x17')]('T','\x20')},{'name':_0x463d('0x18'),'value':'0'},{'name':_0x463d('0x19'),'value':'15'},{'name':'parent_id','value':_0x1f5d4a['id']},{'name':_0x463d('0x1a'),'value':'Contacts'},{'name':_0x463d('0x1b'),'value':_0x1f5d4a[_0x463d('0xf')]},{'name':_0x463d('0x1c'),'value':_0x48aff3}];if(_0x4c7afd[_0x463d('0x1d')]){_[_0x463d('0x1e')](_0x4c7afd,function(_0x36ea11){if(_0x4c7bcc[_0x36ea11['variableName']]){_0x2f0039[_0x463d('0x1f')]({'name':_0x36ea11[_0x463d('0x20')],'value':_0x4c7bcc[_0x36ea11[_0x463d('0x21')]]});}});}return request({'form':{'method':_0x463d('0x22'),'input_type':_0x463d('0x23'),'response_type':_0x463d('0x23'),'rest_data':JSON[_0x463d('0x24')]({'session':_0x1d4661['id'],'module_name':_0x463d('0x25'),'name_value_list':_0x2f0039})}});}function getAuth(_0x27c4a3){return util[_0x463d('0x26')](_0x463d('0x27'),new Buffer(_0x27c4a3[_0x463d('0x28')]+':X')[_0x463d('0x29')](_0x463d('0x2a')));}function getServerInfo(_0x458789){return request({'form':{'method':'get_server_info','input_type':_0x463d('0x23'),'response_type':'JSON','rest_data':JSON[_0x463d('0x24')]({'session':_0x458789['id']})}});}function getUser(_0x1a2756,_0x541aa9,_0x5d16ad){if(!_[_0x463d('0x2b')](_0x541aa9)){logger[_0x463d('0xd')]('Getting\x20agent\x20with\x20name',_0x541aa9);return request({'form':{'method':_0x463d('0x2c'),'input_type':'JSON','response_type':_0x463d('0x23'),'rest_data':JSON[_0x463d('0x24')]({'session':_0x5d16ad['id'],'module_name':_0x463d('0x2d'),'query':util['format'](_0x463d('0x2e'),_0x541aa9),'order_by':'','offset':'0','select_fields':['id',_0x463d('0xf'),_0x463d('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x463d('0x30')](function(_0x1f01dd){if(_0x1f01dd[_0x463d('0x31')][_0x463d('0x1d')]){var _0x5e2caa=_['find'](_0x1f01dd[_0x463d('0x31')],function(_0x5cf437){return _0x5cf437[_0x463d('0x32')][_0x463d('0x2f')][_0x463d('0x33')]===_0x541aa9;});if(_0x5e2caa){logger[_0x463d('0xd')]('Agent\x20found!');return BPromise[_0x463d('0x34')]({'id':_0x5e2caa[_0x463d('0x32')]['id'][_0x463d('0x33')],'name':_0x5e2caa[_0x463d('0x32')][_0x463d('0xf')]['value']});}}logger[_0x463d('0xd')](_0x463d('0x35'));return BPromise['resolve']({'id':_0x5d16ad[_0x463d('0x32')]['user_id'][_0x463d('0x33')],'name':_0x5d16ad[_0x463d('0x32')][_0x463d('0x2f')][_0x463d('0x33')]});});}else{logger[_0x463d('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x463d('0x34')]({'id':_0x5d16ad[_0x463d('0x32')][_0x463d('0x36')][_0x463d('0x33')],'name':_0x5d16ad[_0x463d('0x32')][_0x463d('0x2f')][_0x463d('0x33')]});}}function getEndUser(_0xc5b9b0,_0x2e007f,_0x2a0a17,_0x118b08){logger[_0x463d('0xd')](_0x463d('0x37'),_0x2a0a17);return request({'form':{'method':_0x463d('0x2c'),'input_type':_0x463d('0x23'),'response_type':'JSON','rest_data':JSON[_0x463d('0x24')]({'session':_0x118b08['id'],'module_name':_0x463d('0x38'),'query':util[_0x463d('0x26')](_0x463d('0x39'),_0x2a0a17),'order_by':'','offset':'0','select_fields':['id',_0x463d('0xf'),_0x463d('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x463d('0x30')](function(_0x2e1e49){if(_0x2e1e49[_0x463d('0x31')][_0x463d('0x1d')]){var _0x11beb0=_['find'](_0x2e1e49['entry_list'],function(_0x2a43dd){return _0x2a43dd[_0x463d('0x32')]['phone_home'][_0x463d('0x33')]===_0x2a0a17;});if(_0x11beb0){logger['info']('Enduser\x20found!');return BPromise[_0x463d('0x34')]({'id':_0x11beb0['name_value_list']['id'][_0x463d('0x33')],'name':_0x11beb0[_0x463d('0x32')]['name'][_0x463d('0x33')],'phone':_0x11beb0[_0x463d('0x32')][_0x463d('0x3a')][_0x463d('0x33')]});}}else{logger[_0x463d('0xd')](_0x463d('0x3b'));return request({'form':{'method':_0x463d('0x22'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x463d('0x24')]({'session':_0x118b08['id'],'module_name':_0x463d('0x38'),'name_value_list':[{'name':_0x463d('0x3c'),'value':_0x2e007f!==''?_0x2e007f:util['format'](_0x463d('0x3d'),_0x2a0a17)},{'name':'phone_home','value':_0x2a0a17}]})}})[_0x463d('0x30')](function(_0x42263b){logger[_0x463d('0xd')](_0x463d('0x3e'));return BPromise[_0x463d('0x34')]({'id':_0x42263b['id'],'name':_0x42263b[_0x463d('0x31')]['first_name'][_0x463d('0x33')],'phone':_0x42263b['entry_list'][_0x463d('0x3a')][_0x463d('0x33')]});});}});}function request(_0x5e4976){logger['debug'](_0x463d('0x3f'),JSON[_0x463d('0x24')](_0x5e4976));return rp(_['merge'](def,_0x5e4976));}function getTags(_0x4f1cbb,_0x2379af){var _0x4e8dd1=[];if(_0x4f1cbb&&_0x4f1cbb[_0x463d('0x1d')]>0x0){_0x4e8dd1=_[_0x463d('0x40')](_0x4f1cbb,_0x2379af);}return _0x4e8dd1;}function getCustomFields(_0xf1113d,_0x229446){var _0x131b66=[];var _0x4f5e01={'custom_fields':[]};if(_0xf1113d[_0x463d('0x1d')]>0x0){_[_0x463d('0x1e')](_0xf1113d,function(_0x486b1c){if(_0x486b1c[_0x463d('0x41')]===_0x463d('0x42')&&_0x486b1c[_0x463d('0x43')]&&!_0x486b1c[_0x463d('0x44')]){_0x4f5e01[_0x486b1c[_0x463d('0x43')]['toLowerCase']()]=_0x486b1c[_0x463d('0x45')]['toString']();}else if(_0x486b1c['type']==='string'&&_0x486b1c['idField']&&_0x486b1c[_0x463d('0x44')]){_0x4f5e01[_0x463d('0x46')][_0x463d('0x1f')]({'id':_0x486b1c[_0x463d('0x20')],'value':_0x486b1c[_0x463d('0x45')][_0x463d('0x29')]()});}else if(_0x486b1c[_0x463d('0x41')]==='variable'&&_0x486b1c[_0x463d('0x21')]&&_0x486b1c['idField']&&_0x486b1c[_0x463d('0x44')]){_0x229446[_0x486b1c[_0x463d('0x21')]]&&_0x4f5e01[_0x463d('0x46')][_0x463d('0x1f')]({'id':_0x486b1c[_0x463d('0x20')],'value':_0x229446[_0x486b1c[_0x463d('0x21')]][_0x463d('0x29')]()});}else if(_0x486b1c[_0x463d('0x41')]===_0x463d('0x47')&&_0x486b1c['Variable']&&_0x486b1c[_0x463d('0x48')][_0x463d('0xf')]&&_0x486b1c[_0x463d('0x20')]&&_0x486b1c['customField']){_0x229446[_0x486b1c['Variable'][_0x463d('0xf')]['toLowerCase']()]&&_0x4f5e01[_0x463d('0x46')][_0x463d('0x1f')]({'id':_0x486b1c[_0x463d('0x20')],'value':_0x229446[_0x486b1c['Variable'][_0x463d('0xf')][_0x463d('0x49')]()]['toString']()});}});}return _0x4f5e01;}function getConnection(_0x47c541){return request({'method':_0x463d('0xc'),'form':{'method':_0x463d('0x4a'),'input_type':_0x463d('0x23'),'response_type':_0x463d('0x23'),'rest_data':JSON[_0x463d('0x24')]({'user_auth':{'user_name':_0x47c541[_0x463d('0x4b')],'password':_0x47c541[_0x463d('0x4c')],'encryption':_0x463d('0x4d')},'application':_0x463d('0x4e')})}})[_0x463d('0x30')](function(_0x519726){var _0x52dc25=_0x519726;if(_0x52dc25['id']){def[_0x463d('0x4f')]=_0x52dc25['id'];return BPromise['resolve'](_0x52dc25);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x47c541['id']));}});}function setRelationship(_0x3ede11,_0x94984f,_0x23d84a,_0x5510b0){return request({'form':{'method':_0x463d('0x50'),'input_type':_0x463d('0x23'),'response_type':'JSON','rest_data':JSON[_0x463d('0x24')]({'session':_0x3ede11['id'],'module_name':_0x463d('0x25'),'module_id':_0x23d84a['id'],'link_field_name':_0x5510b0,'related_ids':[_0x94984f['id']]})}});}exports['queue']=function(_0x56e896,_0x32e0ca,_0x115599,_0x58d2b5,_0x510733,_0x233bf2){var _0x12b840,_0x46aa8a,_0x3a3b97,_0x1c87c4;_0x233bf2['remoteUri']=intUtil[_0x463d('0x51')](_0x233bf2[_0x463d('0x52')]);_0x233bf2[_0x463d('0x53')]=intUtil[_0x463d('0x51')](_0x233bf2[_0x463d('0x53')]);def[_0x463d('0x54')]=util['format'](_0x463d('0x55'),_0x233bf2['remoteUri']);if(_0x510733&&_0x510733[_0x463d('0x56')]){logger['info'](_0x463d('0x57'),'Recording\x20is\x20enabled!');_0x32e0ca['recordingURL']=util[_0x463d('0x26')](_0x463d('0x58'),_0x233bf2['serverUrl'],_0x32e0ca[_0x463d('0x59')],md5(_0x32e0ca[_0x463d('0x59')]));}else{_0x32e0ca[_0x463d('0x5a')]='';}return getConnection(_0x233bf2)['then'](function(_0x41dd68){_0x1c87c4=_0x41dd68;return getUser(_0x233bf2,_0x58d2b5['name'],_0x1c87c4);})[_0x463d('0x30')](function(_0x54e0d1){_0x12b840=_0x54e0d1;logger[_0x463d('0xd')](_0x463d('0x5b'),_0x12b840['id']);return getEndUser(_0x233bf2,_0x32e0ca[_0x463d('0x5c')],_0x32e0ca['calleridnum'],_0x1c87c4);})['then'](function(_0x51b0f1){_0x46aa8a=_0x51b0f1;logger['info']('The\x20Enduser\x20ID\x20is:',_0x46aa8a['id']);return getTicket(_0x233bf2,_0x12b840,_0x46aa8a,_0x115599,_0x32e0ca,_0x115599['Fields'],_0x1c87c4,_0x463d('0x5d'));})['then'](function(_0x3cac1d){_0x3a3b97=_0x3cac1d;logger[_0x463d('0xd')](_0x463d('0x5e'));logger['info'](_0x463d('0x5f'),_0x3a3b97['id']);return setRelationship(_0x1c87c4,_0x12b840,_0x3a3b97,_0x463d('0x60'));})[_0x463d('0x30')](function(){return setRelationship(_0x1c87c4,_0x46aa8a,_0x3a3b97,_0x463d('0x61'));})[_0x463d('0x30')](function(){return getServerInfo(_0x1c87c4);})[_0x463d('0x30')](function(_0xdbee4c){var _0x42688b=parseInt(_0xdbee4c['version']['charAt'](0x0));var _0x461962=util[_0x463d('0x26')](_0x463d('0x62'),_0x233bf2['remoteUri'],_0x3a3b97['id']);if(_0x42688b>0x6){_0x461962=util[_0x463d('0x26')](_0x463d('0x63'),_0x233bf2['remoteUri'],_0x3a3b97['id']);}logger[_0x463d('0xd')](_0x463d('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x463d('0x26')](_0x463d('0x64'),_0x58d2b5[_0x463d('0xf')]),_0x463d('0x65'),{'uri':_0x461962});})[_0x463d('0x66')](function(_0x545c33){logger[_0x463d('0x67')](_0x463d('0x57'),JSON[_0x463d('0x24')](_0x545c33));});};exports[_0x463d('0x68')]=function(_0xc1e53d,_0x142791,_0xd222cc,_0x180ca5,_0x4d52fb,_0xae5c82,_0x388ed5){var _0x178b49,_0x58a994,_0x328a50,_0x2cf828;_0xae5c82[_0x463d('0x52')]=intUtil['stripTrailingSlash'](_0xae5c82[_0x463d('0x52')]);_0xae5c82[_0x463d('0x53')]=intUtil[_0x463d('0x51')](_0xae5c82['serverUrl']);def[_0x463d('0x54')]=util[_0x463d('0x26')]('%s/service/v4_1/rest.php',_0xae5c82['remoteUri']);if(_0x388ed5&&_0x388ed5['recordingFormat']&&_0x388ed5[_0x463d('0x69')]!=='none'){logger['info']('[OUTBOUND]',_0x463d('0x6a'));_0x142791[_0x463d('0x5a')]=util['format'](_0x463d('0x58'),_0xae5c82[_0x463d('0x53')],_0x142791['uniqueid'],md5(_0x142791[_0x463d('0x59')]));}return getConnection(_0xae5c82)['then'](function(_0x56e860){_0x2cf828=_0x56e860;return getUser(_0xae5c82,_0x180ca5[_0x463d('0xf')],_0x2cf828);})[_0x463d('0x30')](function(_0x4929e4){_0x178b49=_0x4929e4;logger['info']('The\x20User\x20ID\x20is:',_0x178b49['id']);return getEndUser(_0xae5c82,_0x142791[_0x463d('0x6b')],_0x142791['destcalleridnum'],_0x2cf828);})[_0x463d('0x30')](function(_0x3a38ed){_0x58a994=_0x3a38ed;logger[_0x463d('0xd')](_0x463d('0x6c'),_0x58a994['id']);return getTicket(_0xae5c82,_0x178b49,_0x58a994,_0xd222cc,_0x142791,_0xd222cc[_0x463d('0x6d')],_0x2cf828,_0x463d('0x6e'));})['then'](function(_0x29dc14){_0x328a50=_0x29dc14;logger['info'](_0x463d('0x5e'));logger['info'](_0x463d('0x5f'),_0x328a50['id']);return setRelationship(_0x2cf828,_0x178b49,_0x328a50,_0x463d('0x60'));})['then'](function(){return setRelationship(_0x2cf828,_0x58a994,_0x328a50,_0x463d('0x61'));})[_0x463d('0x30')](function(){return getServerInfo(_0x2cf828);})[_0x463d('0x30')](function(_0x295c30){var _0x447af1=parseInt(_0x295c30['version'][_0x463d('0x6f')](0x0));var _0x334c18=util[_0x463d('0x26')](_0x463d('0x62'),_0xae5c82['remoteUri'],_0x328a50['id']);if(_0x447af1>0x6){_0x334c18=util[_0x463d('0x26')](_0x463d('0x63'),_0xae5c82[_0x463d('0x52')],_0x328a50['id']);}logger['info'](_0x463d('0x70'),_0x463d('0x71'));emit(util[_0x463d('0x26')](_0x463d('0x64'),_0x180ca5[_0x463d('0xf')]),'trigger:browser:url',{'uri':_0x334c18});})['catch'](function(_0x2afaa9){logger[_0x463d('0x67')]('[OUTBOUND]',JSON[_0x463d('0x24')](_0x2afaa9));});};exports[_0x463d('0x72')]=function(_0x5f4666,_0x2df4c9,_0x4639a8,_0x4b1d27,_0x3cf9a5,_0xc2cfec){var _0x3bfbf4,_0x288658,_0x52bf5e,_0x481d86;_0xc2cfec['remoteUri']=intUtil[_0x463d('0x51')](_0xc2cfec['remoteUri']);_0xc2cfec[_0x463d('0x53')]=intUtil[_0x463d('0x51')](_0xc2cfec[_0x463d('0x53')]);def[_0x463d('0x54')]=util['format']('%s/service/v4_1/rest.php',_0xc2cfec['remoteUri']);if(_0x3cf9a5&&_0x3cf9a5['monitor_format']){logger[_0x463d('0xd')]('['+_0x2df4c9[_0x463d('0x73')][_0x463d('0x74')]()+']','Recording\x20is\x20enabled!');_0x2df4c9['recordingURL']=util[_0x463d('0x26')](_0x463d('0x58'),_0xc2cfec[_0x463d('0x53')],_0x2df4c9[_0x463d('0x59')],md5(_0x2df4c9[_0x463d('0x59')]));}else{_0x2df4c9['recordingURL']='';}return getConnection(_0xc2cfec)[_0x463d('0x30')](function(_0x567b5b){_0x481d86=_0x567b5b;if(!_[_0x463d('0x2b')](_0x4b1d27)){return getUser(_0xc2cfec,_0x4b1d27[_0x463d('0xf')],_0x481d86);}else{return getUser(_0xc2cfec,null,_0x481d86);}})[_0x463d('0x30')](function(_0x4a3d36){_0x3bfbf4=_0x4a3d36;logger[_0x463d('0xd')](_0x463d('0x5b'),_0x3bfbf4['id']);return getEndUser(_0xc2cfec,_0x2df4c9[_0x463d('0x5c')],_0x2df4c9[_0x463d('0x75')],_0x481d86);})[_0x463d('0x30')](function(_0x1a7ea3){_0x288658=_0x1a7ea3;logger[_0x463d('0xd')](_0x463d('0x6c'),_0x288658['id']);return getTicket(_0xc2cfec,_0x3bfbf4,_0x288658,_0x4639a8,_0x2df4c9,_0x4639a8[_0x463d('0x6d')],_0x481d86,_0x463d('0x5d'));})[_0x463d('0x30')](function(_0x15a5f1){_0x52bf5e=_0x15a5f1;logger['info'](_0x463d('0x5e'));logger['info'](_0x463d('0x5f'),_0x52bf5e['id']);return setRelationship(_0x481d86,_0x3bfbf4,_0x52bf5e,_0x463d('0x60'));})[_0x463d('0x30')](function(){return setRelationship(_0x481d86,_0x288658,_0x52bf5e,_0x463d('0x61'));})['then'](function(){return getServerInfo(_0x481d86);})[_0x463d('0x66')](function(_0x2abb69){logger[_0x463d('0x67')]('['+_0x2df4c9[_0x463d('0x73')][_0x463d('0x74')]()+']',JSON['stringify'](_0x2abb69));});}; \ No newline at end of file +var _0x8a5c=['uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','lastevent','isNil','calleridnum','toUpperCase','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','login','username','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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x2e4d08,_0x4548b8){var _0x45b64c=function(_0x4683bf){while(--_0x4683bf){_0x2e4d08['push'](_0x2e4d08['shift']());}};_0x45b64c(++_0x4548b8);}(_0x8a5c,0x112));var _0xc8a5=function(_0x335f90,_0x4a17b0){_0x335f90=_0x335f90-0x0;var _0x1347ab=_0x8a5c[_0x335f90];return _0x1347ab;};'use strict';var _=require('lodash');var rp=require(_0xc8a5('0x0'));var BPromise=require(_0xc8a5('0x1'));var md5=require(_0xc8a5('0x2'));var util=require(_0xc8a5('0x3'));var Redis=require(_0xc8a5('0x4'));var intUtil=require('./util');var config=require(_0xc8a5('0x5'));var logger=require(_0xc8a5('0x6'))('sugarcrm');config[_0xc8a5('0x7')]=_['defaults'](config[_0xc8a5('0x7')],{'host':_0xc8a5('0x8'),'port':0x18eb});var io=require(_0xc8a5('0x9'))(new Redis(config[_0xc8a5('0x7')]));var def={'method':_0xc8a5('0xa'),'json':!![]};function emit(_0x3a03af,_0x1de487,_0x1f07eb){io['to'](_0x3a03af)[_0xc8a5('0xb')](_0x1de487,_0x1f07eb);}function getTicket(_0xb1c7f4,_0x1b6dbc,_0x1a5d79,_0xa5f1f6,_0xb75c77,_0x270030,_0x4ba7b2,_0x1f9e37){logger[_0xc8a5('0xc')](_0xc8a5('0xd'));var _0xf84048=new Date();var _0x4d9a06=[{'name':_0xc8a5('0xe'),'value':intUtil['getString'](_0xa5f1f6[_0xc8a5('0xf')],_0xb75c77,'\x20')},{'name':_0xc8a5('0x10'),'value':_0x1b6dbc['id']},{'name':'created_by','value':_0x1b6dbc['id']},{'name':_0xc8a5('0x11'),'value':intUtil['getString'](_0xa5f1f6['Descriptions'],_0xb75c77,'\x0a')},{'name':'date_start','value':_0xf84048[_0xc8a5('0x12')]()['slice'](0x0,0x13)[_0xc8a5('0x13')]('T','\x20')},{'name':_0xc8a5('0x14'),'value':'0'},{'name':_0xc8a5('0x15'),'value':'15'},{'name':_0xc8a5('0x16'),'value':_0x1a5d79['id']},{'name':_0xc8a5('0x17'),'value':_0xc8a5('0x18')},{'name':_0xc8a5('0x19'),'value':_0x1a5d79[_0xc8a5('0xe')]},{'name':_0xc8a5('0x1a'),'value':_0x1f9e37}];if(_0x270030[_0xc8a5('0x1b')]){_[_0xc8a5('0x1c')](_0x270030,function(_0x8a53fa){if(_0xb75c77[_0x8a53fa[_0xc8a5('0x1d')]]){_0x4d9a06[_0xc8a5('0x1e')]({'name':_0x8a53fa['idField'],'value':_0xb75c77[_0x8a53fa[_0xc8a5('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xc8a5('0x1f'),'rest_data':JSON[_0xc8a5('0x20')]({'session':_0x4ba7b2['id'],'module_name':_0xc8a5('0x21'),'name_value_list':_0x4d9a06})}});}function getAuth(_0x43ba3e){return util[_0xc8a5('0x22')](_0xc8a5('0x23'),new Buffer(_0x43ba3e[_0xc8a5('0x24')]+':X')[_0xc8a5('0x25')](_0xc8a5('0x26')));}function getServerInfo(_0x19217c){return request({'form':{'method':_0xc8a5('0x27'),'input_type':'JSON','response_type':_0xc8a5('0x1f'),'rest_data':JSON[_0xc8a5('0x20')]({'session':_0x19217c['id']})}});}function getUser(_0x22c10d,_0x27dea3,_0x417f7f){if(!_['isNil'](_0x27dea3)){logger[_0xc8a5('0xc')](_0xc8a5('0x28'),_0x27dea3);return request({'form':{'method':_0xc8a5('0x29'),'input_type':_0xc8a5('0x1f'),'response_type':'JSON','rest_data':JSON[_0xc8a5('0x20')]({'session':_0x417f7f['id'],'module_name':_0xc8a5('0x2a'),'query':util[_0xc8a5('0x22')](_0xc8a5('0x2b'),_0x27dea3),'order_by':'','offset':'0','select_fields':['id',_0xc8a5('0xe'),_0xc8a5('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8a5('0x2d')](function(_0x13ed95){if(_0x13ed95[_0xc8a5('0x2e')][_0xc8a5('0x1b')]){var _0x5c61e4=_['find'](_0x13ed95['entry_list'],function(_0x2aa7eb){return _0x2aa7eb[_0xc8a5('0x2f')][_0xc8a5('0x2c')][_0xc8a5('0x30')]===_0x27dea3;});if(_0x5c61e4){logger['info'](_0xc8a5('0x31'));return BPromise[_0xc8a5('0x32')]({'id':_0x5c61e4[_0xc8a5('0x2f')]['id']['value'],'name':_0x5c61e4['name_value_list'][_0xc8a5('0xe')][_0xc8a5('0x30')]});}}logger[_0xc8a5('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc8a5('0x32')]({'id':_0x417f7f[_0xc8a5('0x2f')]['user_id'][_0xc8a5('0x30')],'name':_0x417f7f[_0xc8a5('0x2f')]['user_name'][_0xc8a5('0x30')]});});}else{logger[_0xc8a5('0xc')](_0xc8a5('0x33'));return BPromise[_0xc8a5('0x32')]({'id':_0x417f7f[_0xc8a5('0x2f')][_0xc8a5('0x34')][_0xc8a5('0x30')],'name':_0x417f7f[_0xc8a5('0x2f')]['user_name'][_0xc8a5('0x30')]});}}function getEndUser(_0x467901,_0x30c167,_0x4de6f6,_0x15aa05){logger[_0xc8a5('0xc')]('Searching\x20enduser\x20with\x20phone',_0x4de6f6);return request({'form':{'method':_0xc8a5('0x29'),'input_type':'JSON','response_type':_0xc8a5('0x1f'),'rest_data':JSON['stringify']({'session':_0x15aa05['id'],'module_name':'Contacts','query':util[_0xc8a5('0x22')](_0xc8a5('0x35'),_0x4de6f6),'order_by':'','offset':'0','select_fields':['id',_0xc8a5('0xe'),_0xc8a5('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xb3c1b3){if(_0xb3c1b3[_0xc8a5('0x2e')][_0xc8a5('0x1b')]){var _0x349c57=_[_0xc8a5('0x37')](_0xb3c1b3[_0xc8a5('0x2e')],function(_0x10c7c9){return _0x10c7c9[_0xc8a5('0x2f')][_0xc8a5('0x36')][_0xc8a5('0x30')]===_0x4de6f6;});if(_0x349c57){logger[_0xc8a5('0xc')](_0xc8a5('0x38'));return BPromise[_0xc8a5('0x32')]({'id':_0x349c57['name_value_list']['id'][_0xc8a5('0x30')],'name':_0x349c57['name_value_list'][_0xc8a5('0xe')][_0xc8a5('0x30')],'phone':_0x349c57[_0xc8a5('0x2f')][_0xc8a5('0x36')][_0xc8a5('0x30')]});}}else{logger[_0xc8a5('0xc')](_0xc8a5('0x39'));return request({'form':{'method':_0xc8a5('0x3a'),'input_type':_0xc8a5('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x15aa05['id'],'module_name':_0xc8a5('0x18'),'name_value_list':[{'name':_0xc8a5('0x3b'),'value':_0x30c167!==_0xc8a5('0x3c')?_0x30c167:util[_0xc8a5('0x22')]('Caller\x20-\x20%s',_0x4de6f6)},{'name':_0xc8a5('0x36'),'value':_0x4de6f6}]})}})[_0xc8a5('0x2d')](function(_0x3e2956){logger[_0xc8a5('0xc')](_0xc8a5('0x3d'));return BPromise[_0xc8a5('0x32')]({'id':_0x3e2956['id'],'name':_0x3e2956[_0xc8a5('0x2e')][_0xc8a5('0x3b')][_0xc8a5('0x30')],'phone':_0x3e2956[_0xc8a5('0x2e')][_0xc8a5('0x36')]['value']});});}});}function request(_0x274c3b){logger[_0xc8a5('0x3e')](_0xc8a5('0x3f'),JSON['stringify'](_0x274c3b));return rp(_[_0xc8a5('0x40')](def,_0x274c3b));}function getTags(_0x327c8d,_0x14c6ad){var _0x25eaad=[];if(_0x327c8d&&_0x327c8d[_0xc8a5('0x1b')]>0x0){_0x25eaad=_[_0xc8a5('0x41')](_0x327c8d,_0x14c6ad);}return _0x25eaad;}function getCustomFields(_0x188e9d,_0x5defdb){var _0x44ff64=[];var _0x31be46={'custom_fields':[]};if(_0x188e9d['length']>0x0){_['forEach'](_0x188e9d,function(_0x447053){if(_0x447053[_0xc8a5('0x42')]===_0xc8a5('0x43')&&_0x447053[_0xc8a5('0x44')]&&!_0x447053[_0xc8a5('0x45')]){_0x31be46[_0x447053[_0xc8a5('0x44')][_0xc8a5('0x46')]()]=_0x447053[_0xc8a5('0x47')][_0xc8a5('0x25')]();}else if(_0x447053[_0xc8a5('0x42')]===_0xc8a5('0x43')&&_0x447053[_0xc8a5('0x48')]&&_0x447053[_0xc8a5('0x45')]){_0x31be46[_0xc8a5('0x49')]['push']({'id':_0x447053[_0xc8a5('0x48')],'value':_0x447053['content'][_0xc8a5('0x25')]()});}else if(_0x447053[_0xc8a5('0x42')]===_0xc8a5('0x4a')&&_0x447053[_0xc8a5('0x1d')]&&_0x447053[_0xc8a5('0x48')]&&_0x447053['customField']){_0x5defdb[_0x447053[_0xc8a5('0x1d')]]&&_0x31be46['custom_fields']['push']({'id':_0x447053[_0xc8a5('0x48')],'value':_0x5defdb[_0x447053[_0xc8a5('0x1d')]][_0xc8a5('0x25')]()});}else if(_0x447053[_0xc8a5('0x42')]===_0xc8a5('0x4b')&&_0x447053[_0xc8a5('0x4c')]&&_0x447053[_0xc8a5('0x4c')][_0xc8a5('0xe')]&&_0x447053['idField']&&_0x447053[_0xc8a5('0x45')]){_0x5defdb[_0x447053[_0xc8a5('0x4c')][_0xc8a5('0xe')][_0xc8a5('0x46')]()]&&_0x31be46[_0xc8a5('0x49')][_0xc8a5('0x1e')]({'id':_0x447053['idField'],'value':_0x5defdb[_0x447053[_0xc8a5('0x4c')]['name'][_0xc8a5('0x46')]()]['toString']()});}});}return _0x31be46;}function getConnection(_0x45cc60){return request({'method':_0xc8a5('0xa'),'form':{'method':_0xc8a5('0x4d'),'input_type':_0xc8a5('0x1f'),'response_type':_0xc8a5('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x45cc60[_0xc8a5('0x4e')],'password':_0x45cc60[_0xc8a5('0x4f')],'encryption':_0xc8a5('0x50')},'application':_0xc8a5('0x51')})}})[_0xc8a5('0x2d')](function(_0x1ecce2){var _0x4f1936=_0x1ecce2;if(_0x4f1936['id']){def[_0xc8a5('0x52')]=_0x4f1936['id'];return BPromise[_0xc8a5('0x32')](_0x4f1936);}else{throw new Error(util[_0xc8a5('0x22')](_0xc8a5('0x53'),_0x45cc60['id']));}});}function setRelationship(_0x471f25,_0x2f9031,_0x274160,_0x275e73){return request({'form':{'method':_0xc8a5('0x54'),'input_type':_0xc8a5('0x1f'),'response_type':_0xc8a5('0x1f'),'rest_data':JSON['stringify']({'session':_0x471f25['id'],'module_name':'Calls','module_id':_0x274160['id'],'link_field_name':_0x275e73,'related_ids':[_0x2f9031['id']]})}});}exports[_0xc8a5('0x55')]=function(_0x477339,_0x4423c6,_0x8eb8c1,_0x4b18bd,_0x3fb2f6,_0x3fc8ce){var _0x30fa9f,_0x3dc273,_0xdc42f8,_0x26c677;_0x3fc8ce[_0xc8a5('0x56')]=intUtil[_0xc8a5('0x57')](_0x3fc8ce[_0xc8a5('0x56')]);_0x3fc8ce[_0xc8a5('0x58')]=intUtil[_0xc8a5('0x57')](_0x3fc8ce[_0xc8a5('0x58')]);def[_0xc8a5('0x59')]=util[_0xc8a5('0x22')](_0xc8a5('0x5a'),_0x3fc8ce['remoteUri']);if(_0x3fb2f6&&_0x3fb2f6['monitor_format']){logger[_0xc8a5('0xc')](_0xc8a5('0x5b'),_0xc8a5('0x5c'));_0x4423c6[_0xc8a5('0x5d')]=util[_0xc8a5('0x22')](_0xc8a5('0x5e'),_0x3fc8ce[_0xc8a5('0x58')],_0x4423c6[_0xc8a5('0x5f')],md5(_0x4423c6[_0xc8a5('0x5f')]));}else{_0x4423c6[_0xc8a5('0x5d')]='';}return getConnection(_0x3fc8ce)[_0xc8a5('0x2d')](function(_0x167309){_0x26c677=_0x167309;return getUser(_0x3fc8ce,_0x4b18bd[_0xc8a5('0xe')],_0x26c677);})[_0xc8a5('0x2d')](function(_0xd872e1){_0x30fa9f=_0xd872e1;logger[_0xc8a5('0xc')](_0xc8a5('0x60'),_0x30fa9f['id']);return getEndUser(_0x3fc8ce,_0x4423c6[_0xc8a5('0x61')],_0x4423c6['calleridnum'],_0x26c677);})[_0xc8a5('0x2d')](function(_0x42ba1e){_0x3dc273=_0x42ba1e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3dc273['id']);return getTicket(_0x3fc8ce,_0x30fa9f,_0x3dc273,_0x8eb8c1,_0x4423c6,_0x8eb8c1[_0xc8a5('0x62')],_0x26c677,_0xc8a5('0x63'));})[_0xc8a5('0x2d')](function(_0x522bdb){_0xdc42f8=_0x522bdb;logger[_0xc8a5('0xc')]('Ticket\x20created!');logger[_0xc8a5('0xc')](_0xc8a5('0x64'),_0xdc42f8['id']);return setRelationship(_0x26c677,_0x30fa9f,_0xdc42f8,_0xc8a5('0x65'));})[_0xc8a5('0x2d')](function(){return setRelationship(_0x26c677,_0x3dc273,_0xdc42f8,_0xc8a5('0x66'));})['then'](function(){return getServerInfo(_0x26c677);})[_0xc8a5('0x2d')](function(_0x3d3740){var _0x18b0bc=parseInt(_0x3d3740[_0xc8a5('0x67')][_0xc8a5('0x68')](0x0));var _0x47426e=util[_0xc8a5('0x22')](_0xc8a5('0x69'),_0x3fc8ce[_0xc8a5('0x56')],_0xdc42f8['id']);if(_0x18b0bc>0x6){_0x47426e=util[_0xc8a5('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3fc8ce[_0xc8a5('0x56')],_0xdc42f8['id']);}logger[_0xc8a5('0xc')](_0xc8a5('0x5b'),_0xc8a5('0x6a'));emit(util[_0xc8a5('0x22')]('user:%s',_0x4b18bd[_0xc8a5('0xe')]),_0xc8a5('0x6b'),{'uri':_0x47426e});})[_0xc8a5('0x6c')](function(_0x5eec25){logger['error'](_0xc8a5('0x5b'),JSON[_0xc8a5('0x20')](_0x5eec25));});};exports[_0xc8a5('0x6d')]=function(_0x4ba3d1,_0x533241,_0x2ebfc,_0x10925a,_0x47e421,_0x32f08c,_0x11b17e){var _0x46d668,_0x9730a0,_0x1207e9,_0x211898;_0x32f08c['remoteUri']=intUtil[_0xc8a5('0x57')](_0x32f08c[_0xc8a5('0x56')]);_0x32f08c[_0xc8a5('0x58')]=intUtil[_0xc8a5('0x57')](_0x32f08c[_0xc8a5('0x58')]);def['uri']=util[_0xc8a5('0x22')]('%s/service/v4_1/rest.php',_0x32f08c[_0xc8a5('0x56')]);if(_0x11b17e&&_0x11b17e[_0xc8a5('0x6e')]&&_0x11b17e[_0xc8a5('0x6e')]!==_0xc8a5('0x6f')){logger[_0xc8a5('0xc')]('[OUTBOUND]',_0xc8a5('0x5c'));_0x533241[_0xc8a5('0x5d')]=util[_0xc8a5('0x22')](_0xc8a5('0x5e'),_0x32f08c[_0xc8a5('0x58')],_0x533241[_0xc8a5('0x5f')],md5(_0x533241[_0xc8a5('0x5f')]));}return getConnection(_0x32f08c)[_0xc8a5('0x2d')](function(_0x48783c){_0x211898=_0x48783c;return getUser(_0x32f08c,_0x10925a[_0xc8a5('0xe')],_0x211898);})[_0xc8a5('0x2d')](function(_0x312df3){_0x46d668=_0x312df3;logger[_0xc8a5('0xc')]('The\x20User\x20ID\x20is:',_0x46d668['id']);return getEndUser(_0x32f08c,_0x533241[_0xc8a5('0x70')],_0x533241[_0xc8a5('0x71')],_0x211898);})[_0xc8a5('0x2d')](function(_0x477d0f){_0x9730a0=_0x477d0f;logger[_0xc8a5('0xc')](_0xc8a5('0x72'),_0x9730a0['id']);return getTicket(_0x32f08c,_0x46d668,_0x9730a0,_0x2ebfc,_0x533241,_0x2ebfc['Fields'],_0x211898,_0xc8a5('0x73'));})[_0xc8a5('0x2d')](function(_0x5d88d9){_0x1207e9=_0x5d88d9;logger[_0xc8a5('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1207e9['id']);return setRelationship(_0x211898,_0x46d668,_0x1207e9,_0xc8a5('0x65'));})['then'](function(){return setRelationship(_0x211898,_0x9730a0,_0x1207e9,_0xc8a5('0x66'));})[_0xc8a5('0x2d')](function(){return getServerInfo(_0x211898);})[_0xc8a5('0x2d')](function(_0x4c5dc0){var _0x5a6c3f=parseInt(_0x4c5dc0[_0xc8a5('0x67')]['charAt'](0x0));var _0x32ea9c=util['format'](_0xc8a5('0x69'),_0x32f08c[_0xc8a5('0x56')],_0x1207e9['id']);if(_0x5a6c3f>0x6){_0x32ea9c=util['format'](_0xc8a5('0x74'),_0x32f08c[_0xc8a5('0x56')],_0x1207e9['id']);}logger['info']('[OUTBOUND]',_0xc8a5('0x6a'));emit(util[_0xc8a5('0x22')](_0xc8a5('0x75'),_0x10925a[_0xc8a5('0xe')]),_0xc8a5('0x6b'),{'uri':_0x32ea9c});})['catch'](function(_0x467996){logger[_0xc8a5('0x76')]('[OUTBOUND]',JSON[_0xc8a5('0x20')](_0x467996));});};exports['unmanaged']=function(_0x2c24aa,_0x16d438,_0x3855e0,_0x115213,_0x320a2f,_0x491dbe){var _0x928f11,_0x2279b0,_0x2b8f80,_0x575c1f;_0x491dbe['remoteUri']=intUtil[_0xc8a5('0x57')](_0x491dbe[_0xc8a5('0x56')]);_0x491dbe[_0xc8a5('0x58')]=intUtil[_0xc8a5('0x57')](_0x491dbe[_0xc8a5('0x58')]);def[_0xc8a5('0x59')]=util['format'](_0xc8a5('0x5a'),_0x491dbe[_0xc8a5('0x56')]);if(_0x320a2f&&_0x320a2f['monitor_format']){logger[_0xc8a5('0xc')]('['+_0x16d438[_0xc8a5('0x77')]['toUpperCase']()+']',_0xc8a5('0x5c'));_0x16d438[_0xc8a5('0x5d')]=util['format'](_0xc8a5('0x5e'),_0x491dbe[_0xc8a5('0x58')],_0x16d438['uniqueid'],md5(_0x16d438['uniqueid']));}else{_0x16d438['recordingURL']='';}return getConnection(_0x491dbe)[_0xc8a5('0x2d')](function(_0x4ca9af){_0x575c1f=_0x4ca9af;if(!_[_0xc8a5('0x78')](_0x115213)){return getUser(_0x491dbe,_0x115213[_0xc8a5('0xe')],_0x575c1f);}else{return getUser(_0x491dbe,null,_0x575c1f);}})[_0xc8a5('0x2d')](function(_0x46b679){_0x928f11=_0x46b679;logger[_0xc8a5('0xc')](_0xc8a5('0x60'),_0x928f11['id']);return getEndUser(_0x491dbe,_0x16d438[_0xc8a5('0x61')],_0x16d438[_0xc8a5('0x79')],_0x575c1f);})['then'](function(_0x39378f){_0x2279b0=_0x39378f;logger['info'](_0xc8a5('0x72'),_0x2279b0['id']);return getTicket(_0x491dbe,_0x928f11,_0x2279b0,_0x3855e0,_0x16d438,_0x3855e0[_0xc8a5('0x62')],_0x575c1f,'Inbound');})[_0xc8a5('0x2d')](function(_0x90ff76){_0x2b8f80=_0x90ff76;logger[_0xc8a5('0xc')]('Ticket\x20created!');logger['info'](_0xc8a5('0x64'),_0x2b8f80['id']);return setRelationship(_0x575c1f,_0x928f11,_0x2b8f80,_0xc8a5('0x65'));})[_0xc8a5('0x2d')](function(){return setRelationship(_0x575c1f,_0x2279b0,_0x2b8f80,_0xc8a5('0x66'));})['then'](function(){return getServerInfo(_0x575c1f);})[_0xc8a5('0x6c')](function(_0x59a9ab){logger['error']('['+_0x16d438[_0xc8a5('0x77')][_0xc8a5('0x7a')]()+']',JSON[_0xc8a5('0x20')](_0x59a9ab));});}; \ 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 608d00e..4eae731 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 _0xc676=['stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','Variable','name','toLowerCase','toString','keyValue','key','%s:\x20%s','keyContent','keyType','format','customVariable','join'];(function(_0xe96af2,_0x45eb95){var _0x5c0928=function(_0x4b9723){while(--_0x4b9723){_0xe96af2['push'](_0xe96af2['shift']());}};_0x5c0928(++_0x45eb95);}(_0xc676,0x7a));var _0x6c67=function(_0x76ea9f,_0x100307){_0x76ea9f=_0x76ea9f-0x0;var _0x242ce0=_0xc676[_0x76ea9f];return _0x242ce0;};'use strict';var _=require(_0x6c67('0x0'));var util=require(_0x6c67('0x1'));exports[_0x6c67('0x2')]=function(_0x397b60,_0x21dfc1,_0xb9e422){var _0x23f70c=[];if(_0x397b60[_0x6c67('0x3')]>0x0){var _0x1b5d36=_[_0x6c67('0x4')](_0x397b60,['id']);for(var _0xcd4389=0x0;_0xcd4389<_0x1b5d36[_0x6c67('0x3')];_0xcd4389++){var _0x5544ee=_0x1b5d36[_0xcd4389];if(_0x5544ee['type']===_0x6c67('0x5')){_0x23f70c[_0x6c67('0x6')](_0x5544ee[_0x6c67('0x7')]);}else if(_0x5544ee[_0x6c67('0x8')]===_0x6c67('0x9')&&_0x5544ee['variableName']){_0x21dfc1[_0x5544ee[_0x6c67('0xa')]]&&_0x23f70c['push'](_0x21dfc1[_0x5544ee[_0x6c67('0xa')]]['toString']());}else if(_0x5544ee[_0x6c67('0x8')]==='customVariable'&&_0x5544ee[_0x6c67('0xb')]&&_0x5544ee['Variable']['name']){_0x21dfc1[_0x5544ee[_0x6c67('0xb')][_0x6c67('0xc')][_0x6c67('0xd')]()]&&_0x23f70c['push'](_0x21dfc1[_0x5544ee['Variable'][_0x6c67('0xc')][_0x6c67('0xd')]()][_0x6c67('0xe')]());}else if(_0x5544ee['type']===_0x6c67('0xf')){if(_0x5544ee['keyType']===_0x6c67('0x5')&&_0x5544ee[_0x6c67('0x10')]){_0x23f70c[_0x6c67('0x6')](util['format'](_0x6c67('0x11'),_0x5544ee['key'],_0x5544ee[_0x6c67('0x12')]));}else if(_0x5544ee[_0x6c67('0x13')]===_0x6c67('0x9')&&_0x5544ee[_0x6c67('0xa')]&&_0x5544ee[_0x6c67('0x10')]){_0x21dfc1[_0x5544ee['variableName']]&&_0x23f70c[_0x6c67('0x6')](util[_0x6c67('0x14')](_0x6c67('0x11'),_0x5544ee[_0x6c67('0x10')],_0x21dfc1[_0x5544ee[_0x6c67('0xa')]]));}else if(_0x5544ee[_0x6c67('0x13')]===_0x6c67('0x15')&&_0x5544ee[_0x6c67('0xb')]&&_0x5544ee[_0x6c67('0xb')][_0x6c67('0xc')]&&_0x5544ee['key']){_0x21dfc1[_0x5544ee[_0x6c67('0xb')][_0x6c67('0xc')][_0x6c67('0xd')]()]&&_0x23f70c[_0x6c67('0x6')](util[_0x6c67('0x14')](_0x6c67('0x11'),_0x5544ee[_0x6c67('0x10')],_0x21dfc1[_0x5544ee[_0x6c67('0xb')][_0x6c67('0xc')][_0x6c67('0xd')]()]));}}}}return _0x23f70c[_0x6c67('0x16')](_0xb9e422);};exports[_0x6c67('0x17')]=function(_0xa50004){var _0xe9ce7a=_0xa50004[_0x6c67('0x18')](-0x1);if(_0xe9ce7a==='/'){_0xa50004=_0xa50004[_0x6c67('0x19')](0x0,_0xa50004[_0x6c67('0x1a')](_0xe9ce7a));}return _0xa50004;};exports['validateEmail']=function(_0x4773c6){if(!_[_0x6c67('0x1b')](_0x4773c6)&&_0x4773c6!==''){var _0x879bb3=/^(([^<>()\[\]\\.,;:\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 _0x879bb3[_0x6c67('0x1c')](String(_0x4773c6)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x1500=['type','customVariable','Variable','toLowerCase','toString','string','key','format','keyContent','keyType','variable','%s:\x20%s','name','substring','lastIndexOf','validateEmail','isNil','test','getString','sortBy','push','variableName'];(function(_0xd12626,_0x2099c7){var _0x109f0a=function(_0x230e49){while(--_0x230e49){_0xd12626['push'](_0xd12626['shift']());}};_0x109f0a(++_0x2099c7);}(_0x1500,0x188));var _0x0150=function(_0x56e636,_0x2f02ce){_0x56e636=_0x56e636-0x0;var _0x32f244=_0x1500[_0x56e636];return _0x32f244;};'use strict';var _=require('lodash');var util=require('util');exports[_0x0150('0x0')]=function(_0x26de65,_0xe6134b,_0x345c29){var _0x363871=[];if(_0x26de65['length']>0x0){var _0x5287de=_[_0x0150('0x1')](_0x26de65,['id']);for(var _0x350aa6=0x0;_0x350aa6<_0x5287de['length'];_0x350aa6++){var _0x3ef856=_0x5287de[_0x350aa6];if(_0x3ef856['type']==='string'){_0x363871[_0x0150('0x2')](_0x3ef856['content']);}else if(_0x3ef856['type']==='variable'&&_0x3ef856['variableName']){_0xe6134b[_0x3ef856['variableName']]&&_0x363871[_0x0150('0x2')](_0xe6134b[_0x3ef856[_0x0150('0x3')]]['toString']());}else if(_0x3ef856[_0x0150('0x4')]===_0x0150('0x5')&&_0x3ef856[_0x0150('0x6')]&&_0x3ef856['Variable']['name']){_0xe6134b[_0x3ef856['Variable']['name'][_0x0150('0x7')]()]&&_0x363871[_0x0150('0x2')](_0xe6134b[_0x3ef856['Variable']['name']['toLowerCase']()][_0x0150('0x8')]());}else if(_0x3ef856['type']==='keyValue'){if(_0x3ef856['keyType']===_0x0150('0x9')&&_0x3ef856[_0x0150('0xa')]){_0x363871[_0x0150('0x2')](util[_0x0150('0xb')]('%s:\x20%s',_0x3ef856[_0x0150('0xa')],_0x3ef856[_0x0150('0xc')]));}else if(_0x3ef856[_0x0150('0xd')]===_0x0150('0xe')&&_0x3ef856[_0x0150('0x3')]&&_0x3ef856[_0x0150('0xa')]){_0xe6134b[_0x3ef856['variableName']]&&_0x363871[_0x0150('0x2')](util[_0x0150('0xb')](_0x0150('0xf'),_0x3ef856['key'],_0xe6134b[_0x3ef856[_0x0150('0x3')]]));}else if(_0x3ef856['keyType']===_0x0150('0x5')&&_0x3ef856[_0x0150('0x6')]&&_0x3ef856['Variable']['name']&&_0x3ef856[_0x0150('0xa')]){_0xe6134b[_0x3ef856['Variable'][_0x0150('0x10')][_0x0150('0x7')]()]&&_0x363871[_0x0150('0x2')](util[_0x0150('0xb')](_0x0150('0xf'),_0x3ef856[_0x0150('0xa')],_0xe6134b[_0x3ef856[_0x0150('0x6')][_0x0150('0x10')][_0x0150('0x7')]()]));}}}}return _0x363871['join'](_0x345c29);};exports['stripTrailingSlash']=function(_0xdb290f){var _0x505746=_0xdb290f['slice'](-0x1);if(_0x505746==='/'){_0xdb290f=_0xdb290f[_0x0150('0x11')](0x0,_0xdb290f[_0x0150('0x12')](_0x505746));}return _0xdb290f;};exports[_0x0150('0x13')]=function(_0x3ccc10){if(!_[_0x0150('0x14')](_0x3ccc10)&&_0x3ccc10!==''){var _0x43897b=/^(([^<>()\[\]\\.,;:\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 _0x43897b[_0x0150('0x15')](String(_0x3ccc10)[_0x0150('0x7')]());}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 1e35e12..4aff077 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 _0x286b=['getUser','Searching\x20end\x20user\x20with\x20phone','username','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','POST','Contacts','Enduser\x20created.','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','outbound','serverUrl','recordingFormat','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname','lodash','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','emit','length','type','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','%s/webservice.php','create','sessionName','stringify','then','resolve','result','format','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch'];(function(_0x50cc7c,_0x1309e5){var _0x518012=function(_0x222b1d){while(--_0x222b1d){_0x50cc7c['push'](_0x50cc7c['shift']());}};_0x518012(++_0x1309e5);}(_0x286b,0xf7));var _0xb286=function(_0x245cac,_0x41119a){_0x245cac=_0x245cac-0x0;var _0x5d28a3=_0x286b[_0x245cac];return _0x5d28a3;};'use strict';var _=require(_0xb286('0x0'));var rp=require('request-promise');var BPromise=require(_0xb286('0x1'));var md5=require(_0xb286('0x2'));var util=require(_0xb286('0x3'));var Redis=require(_0xb286('0x4'));var intUtil=require(_0xb286('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb286('0x6'))(_0xb286('0x7'));config['redis']=_[_0xb286('0x8')](config[_0xb286('0x9')],{'host':_0xb286('0xa'),'port':0x18eb});var io=require(_0xb286('0xb'))(new Redis(config[_0xb286('0x9')]));function emit(_0x2f699b,_0x15a7ba,_0x75d996){io['to'](_0x2f699b)[_0xb286('0xc')](_0x15a7ba,_0x75d996);}function getCustomFields(_0x4417af,_0x48e6ee){var _0x52bac6={};if(_0x4417af[_0xb286('0xd')]>0x0){_['forEach'](_0x4417af,function(_0x29e5b8){if(_0x29e5b8[_0xb286('0xe')]==='string'&&_0x29e5b8[_0xb286('0xf')]){_0x52bac6[_0x29e5b8[_0xb286('0xf')]]=_0x29e5b8[_0xb286('0x10')]['toString']();}else if(_0x29e5b8[_0xb286('0xe')]==='variable'&&_0x29e5b8[_0xb286('0x11')]&&_0x29e5b8[_0xb286('0xf')]&&_0x48e6ee[_0x29e5b8[_0xb286('0x11')]]){_0x52bac6[_0x29e5b8[_0xb286('0xf')]]=_0x48e6ee[_0x29e5b8[_0xb286('0x11')]][_0xb286('0x12')]();}else if(_0x29e5b8[_0xb286('0xe')]===_0xb286('0x13')&&_0x29e5b8[_0xb286('0x14')]&&_0x29e5b8['Variable'][_0xb286('0x15')]&&_0x29e5b8[_0xb286('0xf')]&&_0x48e6ee[_0x29e5b8[_0xb286('0x14')][_0xb286('0x15')][_0xb286('0x16')]()]){_0x52bac6[_0x29e5b8['idField']]=_0x48e6ee[_0x29e5b8['Variable'][_0xb286('0x15')][_0xb286('0x16')]()]['toString']();}});}return _0x52bac6;}function createTicket(_0x3c7599,_0x3bce9a,_0x2a0b63,_0x3651ff,_0x475d19,_0x149096,_0x38d086){logger[_0xb286('0x17')](_0xb286('0x18'));var _0x5a5634=_['merge']({'parent_id':'','assigned_user_id':_0x3bce9a['id'],'ticketpriorities':_0xb286('0x19'),'ticketstatus':_0xb286('0x1a'),'ticket_title':intUtil['getString'](_0x3651ff['Subjects'],_0x475d19,'\x20'),'description':intUtil[_0xb286('0x1b')](_0x3651ff[_0xb286('0x1c')],_0x475d19,'\x0a'),'contact_id':_0x2a0b63['id']},getCustomFields(_0x149096,_0x475d19));var _0x2d6e53={'method':'POST','uri':util['format'](_0xb286('0x1d'),_0x3c7599['remoteUri']),'form':{'operation':_0xb286('0x1e'),'username':_0x3c7599['username'],'sessionName':_0x38d086[_0xb286('0x1f')],'elementType':'HelpDesk','element':JSON[_0xb286('0x20')](_0x5a5634)},'json':!![]};return request(_0x2d6e53)[_0xb286('0x21')](function(_0x157e14){if(_0x157e14['success']){return BPromise[_0xb286('0x22')]({'id':_0x157e14[_0xb286('0x23')]['id']});}else{throw new Error(util[_0xb286('0x24')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0xb286('0x20')](_0x157e14[_0xb286('0x25')])));}})['catch'](function(_0xfa1b00){var _0x2a3ece=_0xfa1b00[_0xb286('0x26')]||0x1f4;logger['error'](_0xb286('0x27'),_0xb286('0x28'),_0x2a3ece,JSON[_0xb286('0x20')](_0xfa1b00));});}function getUser(_0x1b0fd6,_0x40e100,_0x189c93){if(intUtil[_0xb286('0x29')](_0x40e100)){logger[_0xb286('0x17')](_0xb286('0x2a'),_0x40e100);return request({'method':_0xb286('0x2b'),'uri':util['format']('%s/webservice.php',_0x1b0fd6[_0xb286('0x2c')]),'qs':{'operation':_0xb286('0x2d'),'username':_0x1b0fd6['username'],'sessionName':_0x189c93[_0xb286('0x1f')],'query':util[_0xb286('0x24')](_0xb286('0x2e'),_0x40e100)},'json':!![]})[_0xb286('0x21')](function(_0x394500){if(_0x394500[_0xb286('0x2f')]&&_0x394500['result'][_0xb286('0xd')]){logger[_0xb286('0x17')](_0xb286('0x30'));return BPromise[_0xb286('0x22')]({'id':_0x394500['result'][0x0]['id'],'email':_0x394500[_0xb286('0x23')][0x0][_0xb286('0x31')],'name':_0x394500[_0xb286('0x23')][0x0][_0xb286('0x32')]+'\x20'+_0x394500[_0xb286('0x23')][_0xb286('0x33')]});}else{logger[_0xb286('0x17')](_0xb286('0x34'));return BPromise[_0xb286('0x22')]({'id':_0x189c93[_0xb286('0x35')],'email':_0x1b0fd6['username'],'name':_0xb286('0x36')});}})[_0xb286('0x37')](function(_0x52ca48){var _0x2e0906=_0x52ca48[_0xb286('0x26')]||0x1f4;logger[_0xb286('0x25')](_0xb286('0x27'),_0xb286('0x38'),_0x2e0906,JSON['stringify'](_0x52ca48));});}else{logger[_0xb286('0x17')](_0xb286('0x34'));return BPromise[_0xb286('0x22')]({'id':_0x189c93['userId'],'email':_0x1b0fd6['username'],'name':_0xb286('0x36')})[_0xb286('0x37')](function(_0x40c085){var _0x2a3d11=_0x40c085['statusCode']||0x1f4;logger[_0xb286('0x25')](_0xb286('0x27'),'getUser',_0x2a3d11,JSON[_0xb286('0x20')](_0x40c085));});}}function getEndUser(_0x20f840,_0x4b47c8,_0x4a7c91,_0x28c895){logger[_0xb286('0x17')](_0xb286('0x39'),_0x4a7c91);return request({'method':_0xb286('0x2b'),'uri':util['format']('%s/webservice.php',_0x20f840[_0xb286('0x2c')]),'qs':{'operation':_0xb286('0x2d'),'username':_0x20f840[_0xb286('0x3a')],'sessionName':_0x28c895[_0xb286('0x1f')],'query':util[_0xb286('0x24')](_0xb286('0x3b'),_0x4a7c91,_0x4a7c91,_0x4a7c91,_0x4a7c91,_0x4a7c91)},'json':!![]})[_0xb286('0x21')](function(_0x117d24){if(_0x117d24[_0xb286('0x2f')]&&_0x117d24[_0xb286('0x23')][_0xb286('0xd')]){logger[_0xb286('0x17')](_0xb286('0x3c'));return BPromise[_0xb286('0x22')]({'id':_0x117d24[_0xb286('0x23')][0x0]['id'],'name':_0x117d24[_0xb286('0x23')][0x0][_0xb286('0x3d')]+'\x20'+_0x117d24[_0xb286('0x23')][0x0][_0xb286('0x3e')],'phone':_0x4a7c91});}else{logger[_0xb286('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xb286('0x3f'),'uri':util[_0xb286('0x24')](_0xb286('0x1d'),_0x20f840[_0xb286('0x2c')]),'form':{'operation':_0xb286('0x1e'),'sessionName':_0x28c895[_0xb286('0x1f')],'elementType':_0xb286('0x40'),'element':JSON[_0xb286('0x20')]({'lastname':_0x4b47c8,'phone':_0x4a7c91,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x391dea){logger[_0xb286('0x17')](_0xb286('0x41'));return BPromise['resolve']({'id':_0x391dea['result']['id'],'name':_0x391dea['result'][_0xb286('0x3e')],'phone':_0x391dea[_0xb286('0x23')]['phone']});})[_0xb286('0x37')](function(_0x40fc2b){var _0x422958=_0x40fc2b['statusCode']||0x1f4;logger[_0xb286('0x25')](_0xb286('0x27'),_0xb286('0x42'),_0x422958,JSON[_0xb286('0x20')](_0x40fc2b));});}});}function getConnection(_0x4a1889){var _0x34a58b=_0x4a1889[_0xb286('0x3a')];var _0x2fa245=_0x4a1889['accessKey'];return request({'method':_0xb286('0x2b'),'uri':util[_0xb286('0x24')]('%s/webservice.php',_0x4a1889[_0xb286('0x2c')]),'qs':{'operation':_0xb286('0x43'),'username':_0x34a58b},'json':!![]})[_0xb286('0x21')](function(_0x54052d){if(_0x54052d[_0xb286('0x2f')]){return request({'method':_0xb286('0x3f'),'uri':util['format'](_0xb286('0x1d'),_0x4a1889[_0xb286('0x2c')]),'form':{'operation':_0xb286('0x44'),'username':_0x34a58b,'accessKey':md5(_0x54052d['result'][_0xb286('0x45')]+_0x2fa245)},'json':!![]});}})[_0xb286('0x21')](function(_0x2f3e9f){if(_0x2f3e9f[_0xb286('0x2f')]){return BPromise[_0xb286('0x22')](_0x2f3e9f[_0xb286('0x23')]);}else{throw new Error(util['format'](_0xb286('0x46'),_0x4a1889['id']));}})['catch'](function(_0x2b30e0){var _0x4713b9=_0x2b30e0[_0xb286('0x26')]||0x1f4;logger[_0xb286('0x25')](_0xb286('0x27'),_0xb286('0x47'),_0x4713b9,JSON[_0xb286('0x20')](_0x2b30e0));});}function request(_0x4dab38){logger[_0xb286('0x17')](_0xb286('0x48'),JSON[_0xb286('0x20')](_0x4dab38));return rp(_0x4dab38);}exports[_0xb286('0x49')]=function(_0x14f328,_0x466058,_0x15d498,_0x504777,_0x5270b3,_0x12b8c8){var _0x567e9a,_0xbf120e,_0x299008,_0x58cfda;_0x12b8c8[_0xb286('0x2c')]=intUtil[_0xb286('0x4a')](_0x12b8c8[_0xb286('0x2c')]);if(_0x5270b3&&_0x5270b3[_0xb286('0x4b')]){logger['info'](_0xb286('0x4c'),_0xb286('0x4d'));_0x466058['recordingURL']=util[_0xb286('0x24')](_0xb286('0x4e'),_0x12b8c8['serverUrl'],_0x466058[_0xb286('0x4f')],md5(_0x466058[_0xb286('0x4f')]));}else{_0x466058[_0xb286('0x50')]='';}return getConnection(_0x12b8c8)[_0xb286('0x21')](function(_0x36f14b){_0x58cfda=_0x36f14b;return getUser(_0x12b8c8,_0x504777[_0xb286('0x51')],_0x58cfda);})[_0xb286('0x21')](function(_0x5b5bdd){_0x567e9a=_0x5b5bdd;logger[_0xb286('0x17')](_0xb286('0x52'),_0x567e9a['id']);return getEndUser(_0x12b8c8,_0x466058['calleridname'],_0x466058[_0xb286('0x53')],_0x58cfda);})['then'](function(_0x1088db){_0xbf120e=_0x1088db;logger['info'](_0xb286('0x54'),_0xbf120e['id']);return createTicket(_0x12b8c8,_0x567e9a,_0xbf120e,_0x15d498,_0x466058,_0x15d498[_0xb286('0x55')],_0x58cfda);})['then'](function(_0x4d7d22){_0x299008=_0x4d7d22;logger[_0xb286('0x17')](_0xb286('0x56'));logger[_0xb286('0x17')](_0xb286('0x57'),_0x299008['id']);var _0x5ef8eb=util['format'](_0xb286('0x58'),_0x12b8c8[_0xb286('0x2c')],_[_0xb286('0x59')](_0x299008['id'],'x')[0x1]);logger['info'](_0xb286('0x4c'),_0xb286('0x5a'));emit(util[_0xb286('0x24')]('user:%s',_0x504777[_0xb286('0x15')]),'trigger:browser:url',{'uri':_0x5ef8eb});})[_0xb286('0x37')](function(_0x2e7cc7){logger[_0xb286('0x25')](_0xb286('0x4c'),JSON[_0xb286('0x20')](_0x2e7cc7));});};exports[_0xb286('0x5b')]=function(_0x4e8152,_0x375006,_0x2b9260,_0x5f336b,_0x5d9b32,_0x372af6,_0xf6ecbb){var _0x3a4b89,_0x17f07f,_0x2546e8,_0x51b0fa;_0x372af6[_0xb286('0x2c')]=intUtil[_0xb286('0x4a')](_0x372af6[_0xb286('0x2c')]);_0x372af6[_0xb286('0x5c')]=intUtil[_0xb286('0x4a')](_0x372af6['serverUrl']);if(_0xf6ecbb&&_0xf6ecbb[_0xb286('0x5d')]&&_0xf6ecbb[_0xb286('0x5d')]!=='none'){logger[_0xb286('0x17')]('[OUTBOUND]',_0xb286('0x4d'));_0x375006[_0xb286('0x50')]=util['format'](_0xb286('0x4e'),_0x372af6[_0xb286('0x5c')],_0x375006[_0xb286('0x4f')],md5(_0x375006[_0xb286('0x4f')]));}return getConnection(_0x372af6)[_0xb286('0x21')](function(_0x1b4783){_0x51b0fa=_0x1b4783;return getUser(_0x372af6,_0x5f336b[_0xb286('0x51')],_0x51b0fa);})[_0xb286('0x21')](function(_0xbb6264){_0x3a4b89=_0xbb6264;logger['info']('The\x20User\x20ID\x20is:',_0x3a4b89['id']);return getEndUser(_0x372af6,_0x375006['destcalleridname'],_0x375006['destcalleridnum'],_0x51b0fa);})[_0xb286('0x21')](function(_0x530dfa){_0x17f07f=_0x530dfa;logger['info'](_0xb286('0x54'),_0x17f07f['id']);return createTicket(_0x372af6,_0x3a4b89,_0x17f07f,_0x2b9260,_0x375006,_0x2b9260['Fields'],_0x51b0fa);})[_0xb286('0x21')](function(_0x24ef23){_0x2546e8=_0x24ef23;logger[_0xb286('0x17')]('Ticket\x20created!');logger[_0xb286('0x17')](_0xb286('0x57'),_0x2546e8['id']);var _0x517efb=util[_0xb286('0x24')](_0xb286('0x58'),_0x372af6['remoteUri'],_[_0xb286('0x59')](_0x2546e8['id'],'x')[0x1]);logger[_0xb286('0x17')](_0xb286('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb286('0x5f'),_0x5f336b[_0xb286('0x15')]),_0xb286('0x60'),{'uri':_0x517efb});})['catch'](function(_0x126597){logger[_0xb286('0x25')](_0xb286('0x5e'),JSON['stringify'](_0x126597));});};exports[_0xb286('0x61')]=function(_0xaab49c,_0x228f20,_0x753e01,_0x143166,_0x2e06c1,_0x17be0){var _0x887f96,_0x58d557,_0x554fba,_0x224761;_0x17be0['remoteUri']=intUtil[_0xb286('0x4a')](_0x17be0[_0xb286('0x2c')]);_0x17be0[_0xb286('0x5c')]=intUtil[_0xb286('0x4a')](_0x17be0[_0xb286('0x5c')]);if(_0x2e06c1&&_0x2e06c1[_0xb286('0x4b')]){logger[_0xb286('0x17')]('['+_0x228f20[_0xb286('0x62')][_0xb286('0x63')]()+']',_0xb286('0x4d'));_0x228f20['recordingURL']=util[_0xb286('0x24')](_0xb286('0x4e'),_0x17be0['serverUrl'],_0x228f20[_0xb286('0x4f')],md5(_0x228f20['uniqueid']));}else{_0x228f20[_0xb286('0x50')]='';}return getConnection(_0x17be0)[_0xb286('0x21')](function(_0xd94b33){_0x224761=_0xd94b33;return getUser(_0x17be0,'',_0x224761);})[_0xb286('0x21')](function(_0x1cbbaa){_0x887f96=_0x1cbbaa;logger[_0xb286('0x17')]('The\x20User\x20ID\x20is:',_0x887f96['id']);return getEndUser(_0x17be0,_0x228f20[_0xb286('0x64')],_0x228f20[_0xb286('0x53')],_0x224761);})[_0xb286('0x21')](function(_0x26a7e9){_0x58d557=_0x26a7e9;logger[_0xb286('0x17')]('The\x20Enduser\x20ID\x20is:',_0x58d557['id']);return createTicket(_0x17be0,_0x887f96,_0x58d557,_0x753e01,_0x228f20,_0x753e01['Fields'],_0x224761);})[_0xb286('0x21')](function(_0x5b1ef3){_0x554fba=_0x5b1ef3;logger['info']('Ticket\x20created!');logger['info'](_0xb286('0x57'),_0x554fba['id']);})['catch'](function(_0x1ae2ec){logger[_0xb286('0x25')]('['+_0x228f20['lastevent'][_0xb286('0x63')]()+']',JSON[_0xb286('0x20')](_0x1ae2ec));});}; \ No newline at end of file +var _0xeee0=['accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','lodash','bluebird','md5','util','ioredis','./util','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','string','idField','content','variable','variableName','type','customVariable','Variable','name','toLowerCase','toString','info','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','username','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','getEndUser'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xeee0,0x8b));var _0x0eee=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0xeee0[_0x585ee5];return _0x470808;};'use strict';var _=require(_0x0eee('0x0'));var rp=require('request-promise');var BPromise=require(_0x0eee('0x1'));var md5=require(_0x0eee('0x2'));var util=require(_0x0eee('0x3'));var Redis=require(_0x0eee('0x4'));var intUtil=require(_0x0eee('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x0eee('0x6'));config[_0x0eee('0x7')]=_[_0x0eee('0x8')](config[_0x0eee('0x7')],{'host':_0x0eee('0x9'),'port':0x18eb});var io=require(_0x0eee('0xa'))(new Redis(config[_0x0eee('0x7')]));function emit(_0x440390,_0xa2be94,_0x247ed3){io['to'](_0x440390)[_0x0eee('0xb')](_0xa2be94,_0x247ed3);}function getCustomFields(_0x405ade,_0xfb5c4b){var _0x2c39f8={};if(_0x405ade[_0x0eee('0xc')]>0x0){_[_0x0eee('0xd')](_0x405ade,function(_0x57ed89){if(_0x57ed89['type']===_0x0eee('0xe')&&_0x57ed89[_0x0eee('0xf')]){_0x2c39f8[_0x57ed89[_0x0eee('0xf')]]=_0x57ed89[_0x0eee('0x10')]['toString']();}else if(_0x57ed89['type']===_0x0eee('0x11')&&_0x57ed89[_0x0eee('0x12')]&&_0x57ed89[_0x0eee('0xf')]&&_0xfb5c4b[_0x57ed89[_0x0eee('0x12')]]){_0x2c39f8[_0x57ed89[_0x0eee('0xf')]]=_0xfb5c4b[_0x57ed89['variableName']]['toString']();}else if(_0x57ed89[_0x0eee('0x13')]===_0x0eee('0x14')&&_0x57ed89[_0x0eee('0x15')]&&_0x57ed89['Variable'][_0x0eee('0x16')]&&_0x57ed89[_0x0eee('0xf')]&&_0xfb5c4b[_0x57ed89['Variable'][_0x0eee('0x16')][_0x0eee('0x17')]()]){_0x2c39f8[_0x57ed89[_0x0eee('0xf')]]=_0xfb5c4b[_0x57ed89[_0x0eee('0x15')][_0x0eee('0x16')]['toLowerCase']()][_0x0eee('0x18')]();}});}return _0x2c39f8;}function createTicket(_0x2c57c3,_0x3b5dd6,_0x2f3657,_0x2dab0c,_0x548d92,_0x5ac3b3,_0x4f95ac){logger[_0x0eee('0x19')]('Creating\x20new\x20ticket...');var _0x2f3d70=_[_0x0eee('0x1a')]({'parent_id':'','assigned_user_id':_0x3b5dd6['id'],'ticketpriorities':_0x0eee('0x1b'),'ticketstatus':_0x0eee('0x1c'),'ticket_title':intUtil[_0x0eee('0x1d')](_0x2dab0c[_0x0eee('0x1e')],_0x548d92,'\x20'),'description':intUtil[_0x0eee('0x1d')](_0x2dab0c[_0x0eee('0x1f')],_0x548d92,'\x0a'),'contact_id':_0x2f3657['id']},getCustomFields(_0x5ac3b3,_0x548d92));var _0x1c6108={'method':_0x0eee('0x20'),'uri':util[_0x0eee('0x21')](_0x0eee('0x22'),_0x2c57c3[_0x0eee('0x23')]),'form':{'operation':_0x0eee('0x24'),'username':_0x2c57c3['username'],'sessionName':_0x4f95ac[_0x0eee('0x25')],'elementType':_0x0eee('0x26'),'element':JSON[_0x0eee('0x27')](_0x2f3d70)},'json':!![]};return request(_0x1c6108)[_0x0eee('0x28')](function(_0x3354fd){if(_0x3354fd[_0x0eee('0x29')]){return BPromise[_0x0eee('0x2a')]({'id':_0x3354fd['result']['id']});}else{throw new Error(util[_0x0eee('0x21')](_0x0eee('0x2b'),JSON['stringify'](_0x3354fd['error'])));}})[_0x0eee('0x2c')](function(_0x18c9fe){var _0x3aaf0a=_0x18c9fe['statusCode']||0x1f4;logger[_0x0eee('0x2d')](_0x0eee('0x2e'),_0x0eee('0x2f'),_0x3aaf0a,JSON[_0x0eee('0x27')](_0x18c9fe));});}function getUser(_0x3f8ae3,_0x5c8439,_0x30ecc6){if(intUtil[_0x0eee('0x30')](_0x5c8439)){logger[_0x0eee('0x19')](_0x0eee('0x31'),_0x5c8439);return request({'method':_0x0eee('0x32'),'uri':util[_0x0eee('0x21')](_0x0eee('0x22'),_0x3f8ae3['remoteUri']),'qs':{'operation':_0x0eee('0x33'),'username':_0x3f8ae3['username'],'sessionName':_0x30ecc6[_0x0eee('0x25')],'query':util[_0x0eee('0x21')](_0x0eee('0x34'),_0x5c8439)},'json':!![]})[_0x0eee('0x28')](function(_0x250fe1){if(_0x250fe1[_0x0eee('0x29')]&&_0x250fe1[_0x0eee('0x35')][_0x0eee('0xc')]){logger['info']('Agent\x20found!');return BPromise[_0x0eee('0x2a')]({'id':_0x250fe1[_0x0eee('0x35')][0x0]['id'],'email':_0x250fe1['result'][0x0][_0x0eee('0x36')],'name':_0x250fe1[_0x0eee('0x35')][0x0][_0x0eee('0x37')]+'\x20'+_0x250fe1[_0x0eee('0x35')][_0x0eee('0x38')]});}else{logger['info'](_0x0eee('0x39'));return BPromise[_0x0eee('0x2a')]({'id':_0x30ecc6[_0x0eee('0x3a')],'email':_0x3f8ae3['username'],'name':_0x0eee('0x3b')});}})['catch'](function(_0x3728dc){var _0x3b159b=_0x3728dc[_0x0eee('0x3c')]||0x1f4;logger[_0x0eee('0x2d')](_0x0eee('0x2e'),_0x0eee('0x3d'),_0x3b159b,JSON[_0x0eee('0x27')](_0x3728dc));});}else{logger[_0x0eee('0x19')](_0x0eee('0x39'));return BPromise[_0x0eee('0x2a')]({'id':_0x30ecc6[_0x0eee('0x3a')],'email':_0x3f8ae3[_0x0eee('0x3e')],'name':'admin'})[_0x0eee('0x2c')](function(_0x24d505){var _0xa0ed5e=_0x24d505[_0x0eee('0x3c')]||0x1f4;logger['error'](_0x0eee('0x2e'),_0x0eee('0x3d'),_0xa0ed5e,JSON[_0x0eee('0x27')](_0x24d505));});}}function getEndUser(_0x2b431b,_0xc8b6da,_0x170d35,_0x2dfeec){logger[_0x0eee('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x170d35);return request({'method':'GET','uri':util[_0x0eee('0x21')]('%s/webservice.php',_0x2b431b[_0x0eee('0x23')]),'qs':{'operation':'query','username':_0x2b431b['username'],'sessionName':_0x2dfeec[_0x0eee('0x25')],'query':util[_0x0eee('0x21')]('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;',_0x170d35,_0x170d35,_0x170d35,_0x170d35,_0x170d35)},'json':!![]})['then'](function(_0x3822bc){if(_0x3822bc[_0x0eee('0x29')]&&_0x3822bc[_0x0eee('0x35')][_0x0eee('0xc')]){logger[_0x0eee('0x19')](_0x0eee('0x3f'));return BPromise[_0x0eee('0x2a')]({'id':_0x3822bc[_0x0eee('0x35')][0x0]['id'],'name':_0x3822bc[_0x0eee('0x35')][0x0][_0x0eee('0x40')]+'\x20'+_0x3822bc[_0x0eee('0x35')][0x0][_0x0eee('0x41')],'phone':_0x170d35});}else{logger[_0x0eee('0x19')](_0x0eee('0x42'));return request({'method':_0x0eee('0x20'),'uri':util[_0x0eee('0x21')](_0x0eee('0x22'),_0x2b431b[_0x0eee('0x23')]),'form':{'operation':_0x0eee('0x24'),'sessionName':_0x2dfeec[_0x0eee('0x25')],'elementType':_0x0eee('0x43'),'element':JSON['stringify']({'lastname':_0xc8b6da,'phone':_0x170d35,'assigned_user_id':'\x20'})},'json':!![]})[_0x0eee('0x28')](function(_0x1bca17){logger[_0x0eee('0x19')]('Enduser\x20created.');return BPromise[_0x0eee('0x2a')]({'id':_0x1bca17[_0x0eee('0x35')]['id'],'name':_0x1bca17[_0x0eee('0x35')][_0x0eee('0x41')],'phone':_0x1bca17[_0x0eee('0x35')]['phone']});})['catch'](function(_0x1708d8){var _0xe1b6c5=_0x1708d8[_0x0eee('0x3c')]||0x1f4;logger[_0x0eee('0x2d')](_0x0eee('0x2e'),_0x0eee('0x44'),_0xe1b6c5,JSON[_0x0eee('0x27')](_0x1708d8));});}});}function getConnection(_0x237827){var _0x7d3656=_0x237827[_0x0eee('0x3e')];var _0x150883=_0x237827[_0x0eee('0x45')];return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x237827[_0x0eee('0x23')]),'qs':{'operation':_0x0eee('0x46'),'username':_0x7d3656},'json':!![]})['then'](function(_0x52f491){if(_0x52f491['success']){return request({'method':'POST','uri':util[_0x0eee('0x21')](_0x0eee('0x22'),_0x237827[_0x0eee('0x23')]),'form':{'operation':_0x0eee('0x47'),'username':_0x7d3656,'accessKey':md5(_0x52f491['result'][_0x0eee('0x48')]+_0x150883)},'json':!![]});}})[_0x0eee('0x28')](function(_0x48d446){if(_0x48d446[_0x0eee('0x29')]){return BPromise[_0x0eee('0x2a')](_0x48d446[_0x0eee('0x35')]);}else{throw new Error(util[_0x0eee('0x21')](_0x0eee('0x49'),_0x237827['id']));}})['catch'](function(_0x203dc1){var _0x3c9004=_0x203dc1[_0x0eee('0x3c')]||0x1f4;logger['error'](_0x0eee('0x2e'),_0x0eee('0x4a'),_0x3c9004,JSON[_0x0eee('0x27')](_0x203dc1));});}function request(_0x338dc4){logger['info'](_0x0eee('0x4b'),JSON[_0x0eee('0x27')](_0x338dc4));return rp(_0x338dc4);}exports['queue']=function(_0x54c89b,_0xc9ffac,_0x189eaf,_0x28641d,_0x30da98,_0x1d25cd){var _0x246987,_0x82fd9f,_0x40087c,_0x5eb59a;_0x1d25cd['remoteUri']=intUtil[_0x0eee('0x4c')](_0x1d25cd[_0x0eee('0x23')]);if(_0x30da98&&_0x30da98[_0x0eee('0x4d')]){logger[_0x0eee('0x19')](_0x0eee('0x4e'),'Recording\x20is\x20enabled!');_0xc9ffac['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d25cd[_0x0eee('0x4f')],_0xc9ffac[_0x0eee('0x50')],md5(_0xc9ffac[_0x0eee('0x50')]));}else{_0xc9ffac['recordingURL']='';}return getConnection(_0x1d25cd)[_0x0eee('0x28')](function(_0x4ef3c0){_0x5eb59a=_0x4ef3c0;return getUser(_0x1d25cd,_0x28641d[_0x0eee('0x51')],_0x5eb59a);})[_0x0eee('0x28')](function(_0x2580ac){_0x246987=_0x2580ac;logger[_0x0eee('0x19')](_0x0eee('0x52'),_0x246987['id']);return getEndUser(_0x1d25cd,_0xc9ffac[_0x0eee('0x53')],_0xc9ffac[_0x0eee('0x54')],_0x5eb59a);})[_0x0eee('0x28')](function(_0x63180){_0x82fd9f=_0x63180;logger['info']('The\x20Enduser\x20ID\x20is:',_0x82fd9f['id']);return createTicket(_0x1d25cd,_0x246987,_0x82fd9f,_0x189eaf,_0xc9ffac,_0x189eaf[_0x0eee('0x55')],_0x5eb59a);})['then'](function(_0x1bb904){_0x40087c=_0x1bb904;logger[_0x0eee('0x19')]('Ticket\x20created!');logger['info'](_0x0eee('0x56'),_0x40087c['id']);var _0x523ff6=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1d25cd[_0x0eee('0x23')],_[_0x0eee('0x57')](_0x40087c['id'],'x')[0x1]);logger[_0x0eee('0x19')](_0x0eee('0x4e'),_0x0eee('0x58'));emit(util[_0x0eee('0x21')](_0x0eee('0x59'),_0x28641d[_0x0eee('0x16')]),'trigger:browser:url',{'uri':_0x523ff6});})['catch'](function(_0x46f0ec){logger[_0x0eee('0x2d')](_0x0eee('0x4e'),JSON[_0x0eee('0x27')](_0x46f0ec));});};exports[_0x0eee('0x5a')]=function(_0x295981,_0x1227f2,_0x53221d,_0x1036b5,_0x5ebef5,_0x4671d1,_0x86e796){var _0x59b3b0,_0x387094,_0x1b427b,_0x5bab06;_0x4671d1[_0x0eee('0x23')]=intUtil['stripTrailingSlash'](_0x4671d1[_0x0eee('0x23')]);_0x4671d1[_0x0eee('0x4f')]=intUtil[_0x0eee('0x4c')](_0x4671d1[_0x0eee('0x4f')]);if(_0x86e796&&_0x86e796[_0x0eee('0x5b')]&&_0x86e796['recordingFormat']!==_0x0eee('0x5c')){logger[_0x0eee('0x19')]('[OUTBOUND]',_0x0eee('0x5d'));_0x1227f2[_0x0eee('0x5e')]=util[_0x0eee('0x21')](_0x0eee('0x5f'),_0x4671d1[_0x0eee('0x4f')],_0x1227f2['uniqueid'],md5(_0x1227f2['uniqueid']));}return getConnection(_0x4671d1)[_0x0eee('0x28')](function(_0x5cc7d4){_0x5bab06=_0x5cc7d4;return getUser(_0x4671d1,_0x1036b5[_0x0eee('0x51')],_0x5bab06);})[_0x0eee('0x28')](function(_0x183167){_0x59b3b0=_0x183167;logger[_0x0eee('0x19')](_0x0eee('0x52'),_0x59b3b0['id']);return getEndUser(_0x4671d1,_0x1227f2[_0x0eee('0x60')],_0x1227f2['destcalleridnum'],_0x5bab06);})[_0x0eee('0x28')](function(_0x236807){_0x387094=_0x236807;logger[_0x0eee('0x19')]('The\x20Enduser\x20ID\x20is:',_0x387094['id']);return createTicket(_0x4671d1,_0x59b3b0,_0x387094,_0x53221d,_0x1227f2,_0x53221d[_0x0eee('0x55')],_0x5bab06);})[_0x0eee('0x28')](function(_0x4d85e5){_0x1b427b=_0x4d85e5;logger[_0x0eee('0x19')]('Ticket\x20created!');logger['info'](_0x0eee('0x56'),_0x1b427b['id']);var _0x4961f5=util[_0x0eee('0x21')](_0x0eee('0x61'),_0x4671d1[_0x0eee('0x23')],_[_0x0eee('0x57')](_0x1b427b['id'],'x')[0x1]);logger[_0x0eee('0x19')](_0x0eee('0x62'),_0x0eee('0x58'));emit(util['format'](_0x0eee('0x59'),_0x1036b5[_0x0eee('0x16')]),_0x0eee('0x63'),{'uri':_0x4961f5});})[_0x0eee('0x2c')](function(_0x5d66b3){logger[_0x0eee('0x2d')]('[OUTBOUND]',JSON[_0x0eee('0x27')](_0x5d66b3));});};exports['unmanaged']=function(_0x2c81ac,_0x3db2e5,_0x148997,_0x198e52,_0x1e8a36,_0x1c813e){var _0x225611,_0x2af970,_0x19c5ad,_0x18f2e6;_0x1c813e[_0x0eee('0x23')]=intUtil[_0x0eee('0x4c')](_0x1c813e[_0x0eee('0x23')]);_0x1c813e[_0x0eee('0x4f')]=intUtil[_0x0eee('0x4c')](_0x1c813e[_0x0eee('0x4f')]);if(_0x1e8a36&&_0x1e8a36[_0x0eee('0x4d')]){logger[_0x0eee('0x19')]('['+_0x3db2e5[_0x0eee('0x64')][_0x0eee('0x65')]()+']',_0x0eee('0x5d'));_0x3db2e5[_0x0eee('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c813e[_0x0eee('0x4f')],_0x3db2e5['uniqueid'],md5(_0x3db2e5[_0x0eee('0x50')]));}else{_0x3db2e5[_0x0eee('0x5e')]='';}return getConnection(_0x1c813e)[_0x0eee('0x28')](function(_0x3f9d2a){_0x18f2e6=_0x3f9d2a;return getUser(_0x1c813e,'',_0x18f2e6);})[_0x0eee('0x28')](function(_0x2d1500){_0x225611=_0x2d1500;logger['info'](_0x0eee('0x52'),_0x225611['id']);return getEndUser(_0x1c813e,_0x3db2e5[_0x0eee('0x53')],_0x3db2e5[_0x0eee('0x54')],_0x18f2e6);})[_0x0eee('0x28')](function(_0x35032e){_0x2af970=_0x35032e;logger[_0x0eee('0x19')](_0x0eee('0x66'),_0x2af970['id']);return createTicket(_0x1c813e,_0x225611,_0x2af970,_0x148997,_0x3db2e5,_0x148997[_0x0eee('0x55')],_0x18f2e6);})[_0x0eee('0x28')](function(_0x59ba53){_0x19c5ad=_0x59ba53;logger[_0x0eee('0x19')](_0x0eee('0x67'));logger[_0x0eee('0x19')](_0x0eee('0x56'),_0x19c5ad['id']);})['catch'](function(_0x212f55){logger[_0x0eee('0x2d')]('['+_0x3db2e5[_0x0eee('0x64')]['toUpperCase']()+']',JSON['stringify'](_0x212f55));});}; \ 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 ee8d020..714ebec 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 _0xec56=['redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','first','Enduser\x20found!','end-user','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk'];(function(_0x42e7ce,_0x375d2e){var _0x3d5428=function(_0x5bcd4b){while(--_0x5bcd4b){_0x42e7ce['push'](_0x42e7ce['shift']());}};_0x3d5428(++_0x375d2e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x24c14a,_0x38e53b){_0x24c14a=_0x24c14a-0x0;var _0x2cc879=_0xec56[_0x24c14a];return _0x2cc879;};'use strict';var _=require(_0x6ec5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x6ec5('0x1'));var Redis=require(_0x6ec5('0x2'));var intUtil=require(_0x6ec5('0x3'));var config=require(_0x6ec5('0x4'));var logger=require(_0x6ec5('0x5'))(_0x6ec5('0x6'));config[_0x6ec5('0x7')]=_[_0x6ec5('0x8')](config[_0x6ec5('0x7')],{'host':_0x6ec5('0x9'),'port':0x18eb});var io=require(_0x6ec5('0xa'))(new Redis(config[_0x6ec5('0x7')]));function emit(_0x35be4e,_0x1f59cd,_0x3dd891){io['to'](_0x35be4e)[_0x6ec5('0xb')](_0x1f59cd,_0x3dd891);}var headers={'Content-Type':_0x6ec5('0xc'),'Accept':_0x6ec5('0xc')};function getTicket(_0x3ff17c,_0x4a23b6,_0x2e880d,_0x3ef4f6,_0x444093){logger[_0x6ec5('0xd')](_0x6ec5('0xe'));return request({'uri':util[_0x6ec5('0xf')](_0x6ec5('0x10'),_0x3ff17c['remoteUri']),'method':_0x6ec5('0x11'),'body':{'ticket':_[_0x6ec5('0x12')]({'requester_id':_0x2e880d['id'],'submitter_id':_0x4a23b6?_0x4a23b6['id']:undefined,'assignee_id':_0x4a23b6?_0x4a23b6['id']:undefined,'tags':getTags(_0x3ef4f6[_0x6ec5('0x13')],_0x6ec5('0x14')),'subject':intUtil[_0x6ec5('0x15')](_0x3ef4f6[_0x6ec5('0x16')],_0x444093,'\x20'),'description':intUtil[_0x6ec5('0x15')](_0x3ef4f6[_0x6ec5('0x17')],_0x444093,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3ef4f6[_0x6ec5('0x17')],_0x444093,'\x0a')}},getCustomFields(_0x3ef4f6['Fields'],_0x444093))}})[_0x6ec5('0x18')](function(_0x287542){logger[_0x6ec5('0xd')](_0x6ec5('0x19'));return _0x287542[_0x6ec5('0x1a')];});}function getUser(_0x4d09fe,_0x13b725){if(intUtil[_0x6ec5('0x1b')](_0x13b725)){logger[_0x6ec5('0xd')](_0x6ec5('0x1c'),_0x13b725);return request({'uri':util[_0x6ec5('0xf')](_0x6ec5('0x1d'),_0x4d09fe[_0x6ec5('0x1e')]),'qs':{'query':util[_0x6ec5('0xf')](_0x6ec5('0x1f'),_0x13b725)}})[_0x6ec5('0x18')](function(_0x17f7a2){if(_0x17f7a2[_0x6ec5('0x20')]){logger[_0x6ec5('0xd')](_0x6ec5('0x21'));return _[_0x6ec5('0x22')](_0x17f7a2[_0x6ec5('0x23')],{'email':_0x13b725,'role':_0x6ec5('0x24')});}else{logger['info'](_0x6ec5('0x25'));return request({'uri':util[_0x6ec5('0xf')](_0x6ec5('0x26'),_0x4d09fe[_0x6ec5('0x1e')])})[_0x6ec5('0x18')](function(_0x38a821){logger[_0x6ec5('0xd')]('Admin\x20account\x20selected.');return _0x38a821[_0x6ec5('0x27')];});}});}else{logger[_0x6ec5('0xd')](_0x6ec5('0x25'));return request({'uri':util[_0x6ec5('0xf')]('%s/users/me.json',_0x4d09fe[_0x6ec5('0x1e')])})[_0x6ec5('0x18')](function(_0x5be80f){logger[_0x6ec5('0xd')](_0x6ec5('0x28'));return _0x5be80f[_0x6ec5('0x27')];});}}function getEndUser(_0x5078e8,_0x1b779a,_0xd0e8d7){logger[_0x6ec5('0xd')](_0x6ec5('0x29'),_0xd0e8d7);return request({'uri':util[_0x6ec5('0xf')]('%s/search.json',_0x5078e8[_0x6ec5('0x1e')]),'qs':{'query':util[_0x6ec5('0xf')]('type:user\x20role:end-user\x20phone:%s',_0xd0e8d7)}})[_0x6ec5('0x18')](function(_0x3f5ee0){var _0x5c8c7d;if(_0x3f5ee0[_0x6ec5('0x23')][_0x6ec5('0x2a')]){_0x3f5ee0[_0x6ec5('0x23')]=_[_0x6ec5('0x2b')](_0x3f5ee0[_0x6ec5('0x23')],{'suspended':![],'role':'end-user'});if(_0x3f5ee0[_0x6ec5('0x23')][_0x6ec5('0x2a')]){_0x5c8c7d=_[_0x6ec5('0x2c')](_0x3f5ee0[_0x6ec5('0x23')]);}}if(_0x5c8c7d){logger[_0x6ec5('0xd')](_0x6ec5('0x2d'));return _0x5c8c7d;}else{logger[_0x6ec5('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x6ec5('0xf')]('%s/users.json',_0x5078e8[_0x6ec5('0x1e')]),'method':'POST','body':{'user':{'role':_0x6ec5('0x2e'),'name':util[_0x6ec5('0xf')]('Caller\x20-\x20%s',_0x1b779a||_0xd0e8d7),'phone':_0xd0e8d7}}})['then'](function(_0x3bfab4){logger[_0x6ec5('0xd')]('Enduser\x20created.');return _0x3bfab4[_0x6ec5('0x27')];});}});}function getAuth(_0x251bcf){var _0x54ab73;if(_0x251bcf[_0x6ec5('0x2f')]===_0x6ec5('0x30')){_0x54ab73=util[_0x6ec5('0xf')](_0x6ec5('0x31'),_0x251bcf[_0x6ec5('0x32')],_0x251bcf[_0x6ec5('0x30')]);}else if(_0x251bcf[_0x6ec5('0x2f')]===_0x6ec5('0x33')){_0x54ab73=util['format'](_0x6ec5('0x34'),_0x251bcf['username'],_0x251bcf[_0x6ec5('0x33')]);}return util[_0x6ec5('0xf')](_0x6ec5('0x35'),new Buffer(_0x54ab73)[_0x6ec5('0x36')](_0x6ec5('0x37')));}function request(_0xd501c4){logger[_0x6ec5('0x38')](_0x6ec5('0x39'),JSON[_0x6ec5('0x3a')](_0xd501c4));return rp(_[_0x6ec5('0x8')](_0xd501c4,{'method':_0x6ec5('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x496246,_0x5a5cf7){var _0x30465b=[];if(_0x496246&&_0x496246['length']>0x0){_0x30465b=_[_0x6ec5('0x3c')](_0x496246,_0x5a5cf7);}return _0x30465b;}function getCustomFields(_0x370e18,_0xfa8414){var _0x134d2e=[];var _0x2b47ab={'custom_fields':[]};if(_0x370e18[_0x6ec5('0x2a')]>0x0){_[_0x6ec5('0x3d')](_0x370e18,function(_0x5a0a8c){if(_0x5a0a8c[_0x6ec5('0x3e')]===_0x6ec5('0x3f')&&_0x5a0a8c[_0x6ec5('0x40')]&&!_0x5a0a8c[_0x6ec5('0x41')]){_0x2b47ab[_0x5a0a8c[_0x6ec5('0x40')][_0x6ec5('0x42')]()]=_0x5a0a8c[_0x6ec5('0x43')][_0x6ec5('0x36')]();}else if(_0x5a0a8c[_0x6ec5('0x3e')]==='string'&&_0x5a0a8c[_0x6ec5('0x44')]&&_0x5a0a8c['customField']){_0x2b47ab[_0x6ec5('0x45')]['push']({'id':_0x5a0a8c[_0x6ec5('0x44')],'value':_0x5a0a8c[_0x6ec5('0x43')]['toString']()});}else if(_0x5a0a8c[_0x6ec5('0x3e')]===_0x6ec5('0x46')&&_0x5a0a8c[_0x6ec5('0x47')]&&_0x5a0a8c['idField']&&_0x5a0a8c[_0x6ec5('0x41')]){_0xfa8414[_0x5a0a8c[_0x6ec5('0x47')]]&&_0x2b47ab['custom_fields'][_0x6ec5('0x48')]({'id':_0x5a0a8c[_0x6ec5('0x44')],'value':_0xfa8414[_0x5a0a8c[_0x6ec5('0x47')]][_0x6ec5('0x36')]()});}else if(_0x5a0a8c[_0x6ec5('0x3e')]===_0x6ec5('0x49')&&_0x5a0a8c[_0x6ec5('0x4a')]&&_0x5a0a8c[_0x6ec5('0x4a')][_0x6ec5('0x14')]&&_0x5a0a8c[_0x6ec5('0x44')]&&_0x5a0a8c[_0x6ec5('0x41')]){_0xfa8414[_0x5a0a8c['Variable'][_0x6ec5('0x14')][_0x6ec5('0x42')]()]&&_0x2b47ab[_0x6ec5('0x45')][_0x6ec5('0x48')]({'id':_0x5a0a8c['idField'],'value':_0xfa8414[_0x5a0a8c[_0x6ec5('0x4a')][_0x6ec5('0x14')]['toLowerCase']()][_0x6ec5('0x36')]()});}});}return _0x2b47ab;}exports['queue']=function(_0x7f9560,_0x1de4f7,_0x24722c,_0xeac39e,_0x51f2ef,_0x5b0656){var _0x1bbe7f,_0x56dc23;_0x5b0656[_0x6ec5('0x1e')]=intUtil[_0x6ec5('0x4b')](_0x5b0656[_0x6ec5('0x1e')]);_0x5b0656[_0x6ec5('0x4c')]=intUtil[_0x6ec5('0x4b')](_0x5b0656['serverUrl']);if(_0x51f2ef&&_0x51f2ef['monitor_format']){logger[_0x6ec5('0xd')](_0x6ec5('0x4d'),_0x6ec5('0x4e'));_0x1de4f7[_0x6ec5('0x4f')]=util[_0x6ec5('0xf')](_0x6ec5('0x50'),_0x5b0656[_0x6ec5('0x4c')],_0x1de4f7[_0x6ec5('0x51')],md5(_0x1de4f7[_0x6ec5('0x51')]));}else{_0x1de4f7[_0x6ec5('0x4f')]='';}headers[_0x6ec5('0x52')]=getAuth(_0x5b0656);return getUser(_0x5b0656,_0xeac39e[_0x6ec5('0x53')])[_0x6ec5('0x18')](function(_0x2c055c){_0x1bbe7f=_0x2c055c;logger['info'](_0x6ec5('0x54'),_0x1bbe7f['id']);return getEndUser(_0x5b0656,_0x1de4f7['calleridname'],_0x1de4f7[_0x6ec5('0x55')]);})[_0x6ec5('0x18')](function(_0x5295e4){_0x56dc23=_0x5295e4;logger[_0x6ec5('0xd')](_0x6ec5('0x56'),_0x56dc23['id']);return getTicket(_0x5b0656,_0x1bbe7f,_0x56dc23,_0x24722c,_0x1de4f7);})['then'](function(_0x23a64d){if(_0x23a64d){logger[_0x6ec5('0xd')]('The\x20Ticket\x20ID\x20is:',_0x23a64d['id']);switch(_0x5b0656['type']){case _0x6ec5('0x57'):logger['info']('[QUEUE]',_0x6ec5('0x58'));return request({'uri':util[_0x6ec5('0xf')](_0x6ec5('0x59'),_0x5b0656[_0x6ec5('0x1e')],_0x1bbe7f['id'],_0x23a64d['id']),'method':'POST'});case _0x6ec5('0x5a'):logger[_0x6ec5('0xd')](_0x6ec5('0x4d'),_0x6ec5('0x5b'));emit(util[_0x6ec5('0xf')](_0x6ec5('0x5c'),_0xeac39e[_0x6ec5('0x14')]),_0x6ec5('0x5d'),{'uri':util[_0x6ec5('0xf')](_0x6ec5('0x5e'),_0x5b0656[_0x6ec5('0x1e')],_0x23a64d['id'])});break;default:logger[_0x6ec5('0x5f')](_0x6ec5('0x4d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6ec5('0x60')](function(_0x3ba190){logger['error'](_0x6ec5('0x61'),util[_0x6ec5('0x62')](_0x3ba190,{'showHidden':!![],'depth':null}));});};exports[_0x6ec5('0x63')]=function(_0x1e80bc,_0x1e96a2,_0x4fab8b,_0x5f3d3f,_0x282cbc,_0x5f056d,_0x13383a){var _0x2af432,_0x16ce99;_0x5f056d[_0x6ec5('0x1e')]=intUtil[_0x6ec5('0x4b')](_0x5f056d['remoteUri']);_0x5f056d[_0x6ec5('0x4c')]=intUtil['stripTrailingSlash'](_0x5f056d['serverUrl']);if(_0x13383a&&_0x13383a['recordingFormat']&&_0x13383a[_0x6ec5('0x64')]!==_0x6ec5('0x65')){logger['info']('[OUTBOUND]',_0x6ec5('0x4e'));_0x1e96a2[_0x6ec5('0x4f')]=util[_0x6ec5('0xf')](_0x6ec5('0x50'),_0x5f056d[_0x6ec5('0x4c')],_0x1e96a2['uniqueid'],md5(_0x1e96a2[_0x6ec5('0x51')]));}headers[_0x6ec5('0x52')]=getAuth(_0x5f056d);return getUser(_0x5f056d,_0x5f3d3f[_0x6ec5('0x53')])[_0x6ec5('0x18')](function(_0x156964){_0x2af432=_0x156964;logger['info'](_0x6ec5('0x54'),_0x2af432['id']);return getEndUser(_0x5f056d,_0x1e96a2[_0x6ec5('0x66')],_0x1e96a2[_0x6ec5('0x67')]);})[_0x6ec5('0x18')](function(_0x2a5a1){_0x16ce99=_0x2a5a1;logger[_0x6ec5('0xd')](_0x6ec5('0x56'),_0x16ce99['id']);return getTicket(_0x5f056d,_0x2af432,_0x16ce99,_0x4fab8b,_0x1e96a2);})[_0x6ec5('0x18')](function(_0x46c46d){if(_0x46c46d){logger[_0x6ec5('0xd')](_0x6ec5('0x68'),_0x46c46d['id']);switch(_0x5f056d[_0x6ec5('0x3e')]){case _0x6ec5('0x57'):logger[_0x6ec5('0xd')](_0x6ec5('0x69'),_0x6ec5('0x58'));return request({'uri':util[_0x6ec5('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5f056d[_0x6ec5('0x1e')],_0x2af432['id'],_0x46c46d['id']),'method':'POST'});case _0x6ec5('0x5a'):logger['info']('[OUTBOUND]',_0x6ec5('0x5b'));emit(util[_0x6ec5('0xf')](_0x6ec5('0x5c'),_0x5f3d3f[_0x6ec5('0x14')]),_0x6ec5('0x5d'),{'uri':util['format'](_0x6ec5('0x5e'),_0x5f056d[_0x6ec5('0x1e')],_0x46c46d['id'])});break;default:logger[_0x6ec5('0x5f')](_0x6ec5('0x69'),_0x6ec5('0x6a'));}}})['catch'](function(_0x43453f){logger[_0x6ec5('0x5f')](_0x6ec5('0x6b'),util[_0x6ec5('0x62')](_0x43453f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xb7e429,_0x39f48a,_0x566605,_0x530689,_0x12f741,_0x18a10f){var _0x7fd652,_0xe8aef4;_0x18a10f[_0x6ec5('0x1e')]=intUtil[_0x6ec5('0x4b')](_0x18a10f[_0x6ec5('0x1e')]);_0x18a10f[_0x6ec5('0x4c')]=intUtil[_0x6ec5('0x4b')](_0x18a10f[_0x6ec5('0x4c')]);if(_0x12f741&&_0x12f741[_0x6ec5('0x6c')]){logger['info']('['+_0x39f48a[_0x6ec5('0x6d')][_0x6ec5('0x6e')]()+']',_0x6ec5('0x4e'));_0x39f48a[_0x6ec5('0x4f')]=util['format'](_0x6ec5('0x50'),_0x18a10f[_0x6ec5('0x4c')],_0x39f48a[_0x6ec5('0x51')],md5(_0x39f48a[_0x6ec5('0x51')]));}else{_0x39f48a['recordingURL']='';}headers[_0x6ec5('0x52')]=getAuth(_0x18a10f);return getUser(_0x18a10f)[_0x6ec5('0x18')](function(_0x37fb7b){_0x7fd652=_0x37fb7b;logger['info']('The\x20User\x20ID\x20is:',_0x7fd652['id']);return getEndUser(_0x18a10f,_0x39f48a[_0x6ec5('0x6f')],_0x39f48a[_0x6ec5('0x55')]);})['then'](function(_0x1ac5a5){_0xe8aef4=_0x1ac5a5;logger[_0x6ec5('0xd')](_0x6ec5('0x56'),_0xe8aef4['id']);return getTicket(_0x18a10f,_0x7fd652,_0xe8aef4,_0x566605,_0x39f48a);})[_0x6ec5('0x18')](function(_0x4baeb6){if(_0x4baeb6){logger[_0x6ec5('0xd')](_0x6ec5('0x68'),_0x4baeb6['id']);}})[_0x6ec5('0x60')](function(_0x488642){logger[_0x6ec5('0x5f')]('['+_0x39f48a[_0x6ec5('0x6d')][_0x6ec5('0x6e')]()+']'+_0x6ec5('0x70'),util[_0x6ec5('0x62')](_0x488642,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2bc6=['authType','token','Basic\x20%s','debug','[HTTP]','GET','map','string','nameField','customField','content','toString','type','idField','custom_fields','push','variableName','customVariable','toLowerCase','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x2bc6,0x163));var _0x62bc=function(_0x335da8,_0x5d6143){_0x335da8=_0x335da8-0x0;var _0x826664=_0x2bc6[_0x335da8];return _0x826664;};'use strict';var _=require(_0x62bc('0x0'));var rp=require(_0x62bc('0x1'));var md5=require(_0x62bc('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x62bc('0x3'))('zendesk');config[_0x62bc('0x4')]=_[_0x62bc('0x5')](config['redis'],{'host':_0x62bc('0x6'),'port':0x18eb});var io=require(_0x62bc('0x7'))(new Redis(config[_0x62bc('0x4')]));function emit(_0x3f3dc9,_0x3ed6ad,_0x3f625c){io['to'](_0x3f3dc9)['emit'](_0x3ed6ad,_0x3f625c);}var headers={'Content-Type':_0x62bc('0x8'),'Accept':_0x62bc('0x8')};function getTicket(_0x1917e1,_0x306bac,_0x481da1,_0x436d03,_0x107bf9){logger[_0x62bc('0x9')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x62bc('0xa')](_0x62bc('0xb'),_0x1917e1[_0x62bc('0xc')]),'method':_0x62bc('0xd'),'body':{'ticket':_[_0x62bc('0xe')]({'requester_id':_0x481da1['id'],'submitter_id':_0x306bac?_0x306bac['id']:undefined,'assignee_id':_0x306bac?_0x306bac['id']:undefined,'tags':getTags(_0x436d03[_0x62bc('0xf')],_0x62bc('0x10')),'subject':intUtil['getString'](_0x436d03[_0x62bc('0x11')],_0x107bf9,'\x20'),'description':intUtil[_0x62bc('0x12')](_0x436d03['Descriptions'],_0x107bf9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x62bc('0x12')](_0x436d03[_0x62bc('0x13')],_0x107bf9,'\x0a')}},getCustomFields(_0x436d03[_0x62bc('0x14')],_0x107bf9))}})['then'](function(_0x263424){logger[_0x62bc('0x9')]('Ticket\x20created!');return _0x263424['ticket'];});}function getUser(_0x39c5e0,_0x2d6820){if(intUtil['validateEmail'](_0x2d6820)){logger[_0x62bc('0x9')](_0x62bc('0x15'),_0x2d6820);return request({'uri':util[_0x62bc('0xa')](_0x62bc('0x16'),_0x39c5e0[_0x62bc('0xc')]),'qs':{'query':util[_0x62bc('0xa')](_0x62bc('0x17'),_0x2d6820)}})[_0x62bc('0x18')](function(_0x13857a){if(_0x13857a['count']){logger['info'](_0x62bc('0x19'));return _[_0x62bc('0x1a')](_0x13857a[_0x62bc('0x1b')],{'email':_0x2d6820,'role':'agent'});}else{logger[_0x62bc('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x62bc('0xa')](_0x62bc('0x1c'),_0x39c5e0[_0x62bc('0xc')])})['then'](function(_0x3b8644){logger[_0x62bc('0x9')](_0x62bc('0x1d'));return _0x3b8644[_0x62bc('0x1e')];});}});}else{logger[_0x62bc('0x9')](_0x62bc('0x1f'));return request({'uri':util['format'](_0x62bc('0x1c'),_0x39c5e0[_0x62bc('0xc')])})[_0x62bc('0x18')](function(_0x3957c9){logger[_0x62bc('0x9')]('Admin\x20account\x20selected.');return _0x3957c9['user'];});}}function getEndUser(_0xcd4b0,_0x58e76a,_0x32e749){logger[_0x62bc('0x9')](_0x62bc('0x20'),_0x32e749);return request({'uri':util['format'](_0x62bc('0x16'),_0xcd4b0[_0x62bc('0xc')]),'qs':{'query':util[_0x62bc('0xa')]('type:user\x20role:end-user\x20phone:%s',_0x32e749)}})['then'](function(_0x641626){var _0x410c36;if(_0x641626[_0x62bc('0x1b')]['length']){_0x641626[_0x62bc('0x1b')]=_[_0x62bc('0x21')](_0x641626[_0x62bc('0x1b')],{'suspended':![],'role':_0x62bc('0x22')});if(_0x641626['results'][_0x62bc('0x23')]){_0x410c36=_['first'](_0x641626[_0x62bc('0x1b')]);}}if(_0x410c36){logger[_0x62bc('0x9')](_0x62bc('0x24'));return _0x410c36;}else{logger[_0x62bc('0x9')](_0x62bc('0x25'));return request({'uri':util[_0x62bc('0xa')](_0x62bc('0x26'),_0xcd4b0[_0x62bc('0xc')]),'method':_0x62bc('0xd'),'body':{'user':{'role':_0x62bc('0x22'),'name':util[_0x62bc('0xa')](_0x62bc('0x27'),_0x58e76a||_0x32e749),'phone':_0x32e749}}})[_0x62bc('0x18')](function(_0x115883){logger[_0x62bc('0x9')](_0x62bc('0x28'));return _0x115883[_0x62bc('0x1e')];});}});}function getAuth(_0x49625b){var _0x32e3a9;if(_0x49625b['authType']==='password'){_0x32e3a9=util[_0x62bc('0xa')]('%s:%s',_0x49625b['username'],_0x49625b['password']);}else if(_0x49625b[_0x62bc('0x29')]===_0x62bc('0x2a')){_0x32e3a9=util[_0x62bc('0xa')]('%s/token:%s',_0x49625b['username'],_0x49625b['token']);}return util[_0x62bc('0xa')](_0x62bc('0x2b'),new Buffer(_0x32e3a9)['toString']('base64'));}function request(_0x33d0f7){logger[_0x62bc('0x2c')](_0x62bc('0x2d'),JSON['stringify'](_0x33d0f7));return rp(_[_0x62bc('0x5')](_0x33d0f7,{'method':_0x62bc('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x3ff9e3,_0x9482f7){var _0x4ff691=[];if(_0x3ff9e3&&_0x3ff9e3[_0x62bc('0x23')]>0x0){_0x4ff691=_[_0x62bc('0x2f')](_0x3ff9e3,_0x9482f7);}return _0x4ff691;}function getCustomFields(_0x4d4f88,_0x2e8114){var _0x475319=[];var _0x24dbbe={'custom_fields':[]};if(_0x4d4f88[_0x62bc('0x23')]>0x0){_['forEach'](_0x4d4f88,function(_0x1dec2b){if(_0x1dec2b['type']===_0x62bc('0x30')&&_0x1dec2b[_0x62bc('0x31')]&&!_0x1dec2b[_0x62bc('0x32')]){_0x24dbbe[_0x1dec2b[_0x62bc('0x31')]['toLowerCase']()]=_0x1dec2b[_0x62bc('0x33')][_0x62bc('0x34')]();}else if(_0x1dec2b[_0x62bc('0x35')]===_0x62bc('0x30')&&_0x1dec2b[_0x62bc('0x36')]&&_0x1dec2b[_0x62bc('0x32')]){_0x24dbbe[_0x62bc('0x37')][_0x62bc('0x38')]({'id':_0x1dec2b[_0x62bc('0x36')],'value':_0x1dec2b[_0x62bc('0x33')][_0x62bc('0x34')]()});}else if(_0x1dec2b['type']==='variable'&&_0x1dec2b[_0x62bc('0x39')]&&_0x1dec2b[_0x62bc('0x36')]&&_0x1dec2b['customField']){_0x2e8114[_0x1dec2b[_0x62bc('0x39')]]&&_0x24dbbe[_0x62bc('0x37')][_0x62bc('0x38')]({'id':_0x1dec2b[_0x62bc('0x36')],'value':_0x2e8114[_0x1dec2b[_0x62bc('0x39')]]['toString']()});}else if(_0x1dec2b[_0x62bc('0x35')]===_0x62bc('0x3a')&&_0x1dec2b['Variable']&&_0x1dec2b['Variable'][_0x62bc('0x10')]&&_0x1dec2b[_0x62bc('0x36')]&&_0x1dec2b[_0x62bc('0x32')]){_0x2e8114[_0x1dec2b['Variable'][_0x62bc('0x10')][_0x62bc('0x3b')]()]&&_0x24dbbe[_0x62bc('0x37')][_0x62bc('0x38')]({'id':_0x1dec2b[_0x62bc('0x36')],'value':_0x2e8114[_0x1dec2b[_0x62bc('0x3c')]['name'][_0x62bc('0x3b')]()]['toString']()});}});}return _0x24dbbe;}exports[_0x62bc('0x3d')]=function(_0x36328d,_0x2929d4,_0x59e389,_0x5f029e,_0x4dfd5e,_0x338a3f){var _0x5983e9,_0x10ea2e;_0x338a3f[_0x62bc('0xc')]=intUtil['stripTrailingSlash'](_0x338a3f['remoteUri']);_0x338a3f['serverUrl']=intUtil[_0x62bc('0x3e')](_0x338a3f[_0x62bc('0x3f')]);if(_0x4dfd5e&&_0x4dfd5e[_0x62bc('0x40')]){logger[_0x62bc('0x9')](_0x62bc('0x41'),'Recording\x20is\x20enabled!');_0x2929d4[_0x62bc('0x42')]=util[_0x62bc('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x338a3f[_0x62bc('0x3f')],_0x2929d4['uniqueid'],md5(_0x2929d4[_0x62bc('0x43')]));}else{_0x2929d4[_0x62bc('0x42')]='';}headers[_0x62bc('0x44')]=getAuth(_0x338a3f);return getUser(_0x338a3f,_0x5f029e[_0x62bc('0x45')])[_0x62bc('0x18')](function(_0x28747b){_0x5983e9=_0x28747b;logger[_0x62bc('0x9')]('The\x20User\x20ID\x20is:',_0x5983e9['id']);return getEndUser(_0x338a3f,_0x2929d4[_0x62bc('0x46')],_0x2929d4[_0x62bc('0x47')]);})['then'](function(_0x38b9a2){_0x10ea2e=_0x38b9a2;logger['info'](_0x62bc('0x48'),_0x10ea2e['id']);return getTicket(_0x338a3f,_0x5983e9,_0x10ea2e,_0x59e389,_0x2929d4);})[_0x62bc('0x18')](function(_0x4bec08){if(_0x4bec08){logger[_0x62bc('0x9')](_0x62bc('0x49'),_0x4bec08['id']);switch(_0x338a3f[_0x62bc('0x35')]){case'integrationTab':logger[_0x62bc('0x9')](_0x62bc('0x41'),_0x62bc('0x4a'));return request({'uri':util[_0x62bc('0xa')](_0x62bc('0x4b'),_0x338a3f[_0x62bc('0xc')],_0x5983e9['id'],_0x4bec08['id']),'method':_0x62bc('0xd')});case _0x62bc('0x4c'):logger[_0x62bc('0x9')](_0x62bc('0x41'),_0x62bc('0x4d'));emit(util[_0x62bc('0xa')](_0x62bc('0x4e'),_0x5f029e[_0x62bc('0x10')]),_0x62bc('0x4f'),{'uri':util[_0x62bc('0xa')]('%s/agent/tickets/%s',_0x338a3f[_0x62bc('0xc')],_0x4bec08['id'])});break;default:logger[_0x62bc('0x50')](_0x62bc('0x41'),_0x62bc('0x51'));}}})[_0x62bc('0x52')](function(_0x25342c){logger[_0x62bc('0x50')](_0x62bc('0x53'),util[_0x62bc('0x54')](_0x25342c,{'showHidden':!![],'depth':null}));});};exports[_0x62bc('0x55')]=function(_0x2f2322,_0x2c9ecd,_0x5ebee0,_0x378047,_0x50d761,_0xf8c4d5,_0x477b52){var _0x268681,_0x34a8ed;_0xf8c4d5[_0x62bc('0xc')]=intUtil[_0x62bc('0x3e')](_0xf8c4d5[_0x62bc('0xc')]);_0xf8c4d5[_0x62bc('0x3f')]=intUtil['stripTrailingSlash'](_0xf8c4d5['serverUrl']);if(_0x477b52&&_0x477b52[_0x62bc('0x56')]&&_0x477b52[_0x62bc('0x56')]!==_0x62bc('0x57')){logger['info'](_0x62bc('0x58'),_0x62bc('0x59'));_0x2c9ecd[_0x62bc('0x42')]=util[_0x62bc('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf8c4d5[_0x62bc('0x3f')],_0x2c9ecd[_0x62bc('0x43')],md5(_0x2c9ecd[_0x62bc('0x43')]));}headers[_0x62bc('0x44')]=getAuth(_0xf8c4d5);return getUser(_0xf8c4d5,_0x378047[_0x62bc('0x45')])[_0x62bc('0x18')](function(_0x223f56){_0x268681=_0x223f56;logger['info'](_0x62bc('0x5a'),_0x268681['id']);return getEndUser(_0xf8c4d5,_0x2c9ecd[_0x62bc('0x5b')],_0x2c9ecd[_0x62bc('0x5c')]);})['then'](function(_0x4a56b7){_0x34a8ed=_0x4a56b7;logger[_0x62bc('0x9')](_0x62bc('0x48'),_0x34a8ed['id']);return getTicket(_0xf8c4d5,_0x268681,_0x34a8ed,_0x5ebee0,_0x2c9ecd);})[_0x62bc('0x18')](function(_0x54860f){if(_0x54860f){logger[_0x62bc('0x9')]('The\x20Ticket\x20ID\x20is:',_0x54860f['id']);switch(_0xf8c4d5[_0x62bc('0x35')]){case _0x62bc('0x5d'):logger['info'](_0x62bc('0x58'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x62bc('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xf8c4d5[_0x62bc('0xc')],_0x268681['id'],_0x54860f['id']),'method':_0x62bc('0xd')});case _0x62bc('0x4c'):logger[_0x62bc('0x9')](_0x62bc('0x58'),_0x62bc('0x4d'));emit(util['format'](_0x62bc('0x4e'),_0x378047[_0x62bc('0x10')]),_0x62bc('0x4f'),{'uri':util['format'](_0x62bc('0x5e'),_0xf8c4d5[_0x62bc('0xc')],_0x54860f['id'])});break;default:logger[_0x62bc('0x50')](_0x62bc('0x58'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x62bc('0x52')](function(_0x38c171){logger[_0x62bc('0x50')](_0x62bc('0x5f'),util[_0x62bc('0x54')](_0x38c171,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x48439f,_0x280f73,_0x5515bb,_0xf55012,_0x18779a,_0x4dc4c8){var _0x166ee3,_0x585ae0;_0x4dc4c8[_0x62bc('0xc')]=intUtil['stripTrailingSlash'](_0x4dc4c8[_0x62bc('0xc')]);_0x4dc4c8['serverUrl']=intUtil[_0x62bc('0x3e')](_0x4dc4c8[_0x62bc('0x3f')]);if(_0x18779a&&_0x18779a[_0x62bc('0x40')]){logger['info']('['+_0x280f73[_0x62bc('0x60')][_0x62bc('0x61')]()+']',_0x62bc('0x59'));_0x280f73[_0x62bc('0x42')]=util[_0x62bc('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dc4c8[_0x62bc('0x3f')],_0x280f73[_0x62bc('0x43')],md5(_0x280f73[_0x62bc('0x43')]));}else{_0x280f73[_0x62bc('0x42')]='';}headers[_0x62bc('0x44')]=getAuth(_0x4dc4c8);return getUser(_0x4dc4c8)[_0x62bc('0x18')](function(_0x3ee94c){_0x166ee3=_0x3ee94c;logger[_0x62bc('0x9')](_0x62bc('0x5a'),_0x166ee3['id']);return getEndUser(_0x4dc4c8,_0x280f73[_0x62bc('0x46')],_0x280f73[_0x62bc('0x47')]);})['then'](function(_0x31abe4){_0x585ae0=_0x31abe4;logger[_0x62bc('0x9')](_0x62bc('0x48'),_0x585ae0['id']);return getTicket(_0x4dc4c8,_0x166ee3,_0x585ae0,_0x5515bb,_0x280f73);})[_0x62bc('0x18')](function(_0x591a62){if(_0x591a62){logger[_0x62bc('0x9')](_0x62bc('0x49'),_0x591a62['id']);}})[_0x62bc('0x52')](function(_0x1c2db4){logger[_0x62bc('0x50')]('['+_0x280f73[_0x62bc('0x60')][_0x62bc('0x61')]()+']'+_0x62bc('0x62'),util['inspect'](_0x1c2db4,{'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 ff2a866..40faf3d 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 _0xf8ff=['calleridnum','md5','./util','moment','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','email','Agent\x20found!','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','Creating\x20new\x20call...','Owner','profile','administrator','getString','Subjects','Description','Who_Id','First_Name','Last_Name','Full_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','stack','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','unmanaged','monitor_format','toUpperCase','calleridname'];(function(_0x2fe4b5,_0x439480){var _0x2b9c0b=function(_0x5bfca9){while(--_0x5bfca9){_0x2fe4b5['push'](_0x2fe4b5['shift']());}};_0x2b9c0b(++_0x439480);}(_0xf8ff,0x127));var _0xff8f=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xf8ff[_0x3f3f06];return _0x140feb;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xff8f('0x0'));var util=require('util');var intUtil=require(_0xff8f('0x1'));var moment=require(_0xff8f('0x2'));var Redis=require(_0xff8f('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xff8f('0x4'))('zoho');config[_0xff8f('0x5')]=_[_0xff8f('0x6')](config[_0xff8f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xff8f('0x7'))(new Redis(config[_0xff8f('0x5')]));function emit(_0x2898af,_0x5ba0fc,_0x3d111f){io['to'](_0x2898af)['emit'](_0x5ba0fc,_0x3d111f);}function request(_0x5a090a){logger[_0xff8f('0x8')](_0xff8f('0x9'),JSON[_0xff8f('0xa')](_0x5a090a));return rp(_0x5a090a);}function getCustomFields(_0x3ac3ac,_0x578e53){var _0x44f84c={};if(_0x3ac3ac[_0xff8f('0xb')]>0x0){_[_0xff8f('0xc')](_0x3ac3ac,function(_0x5963af){if(_0x5963af[_0xff8f('0xd')]==='string'&&_0x5963af[_0xff8f('0xe')]){_0x44f84c[_0x5963af[_0xff8f('0xe')]]=_0x5963af[_0xff8f('0xf')][_0xff8f('0x10')]();}else if(_0x5963af[_0xff8f('0xd')]===_0xff8f('0x11')&&_0x5963af['variableName']&&_0x5963af[_0xff8f('0xe')]&&_0x578e53[_0x5963af[_0xff8f('0x12')]]){_0x44f84c[_0x5963af['idField']]=_0x578e53[_0x5963af['variableName']][_0xff8f('0x10')]();}else if(_0x5963af['type']===_0xff8f('0x13')&&_0x5963af['Variable']&&_0x5963af[_0xff8f('0x14')]['name']&&_0x5963af[_0xff8f('0xe')]&&_0x578e53[_0x5963af[_0xff8f('0x14')][_0xff8f('0x15')][_0xff8f('0x16')]()]){_0x44f84c[_0x5963af[_0xff8f('0xe')]]=_0x578e53[_0x5963af[_0xff8f('0x14')][_0xff8f('0x15')]['toLowerCase']()][_0xff8f('0x10')]();}});}return _0x44f84c;}function getName(_0x24bc57){if(_0x24bc57[_0xff8f('0x17')]('\x20')>0x0){var _0x2ed392=_0x24bc57[_0xff8f('0x18')](/ (.+)/);if(_0x2ed392[0x1]){return _0x2ed392;}}return[_0x24bc57,_0x24bc57];}var accountsTokens={};function getAccessToken(_0x5a6228){return new Promise(function(_0x5948fa,_0x3a6c4b){if(!_['isNil'](accountsTokens[_0x5a6228['id']])&&!_[_0xff8f('0x19')](accountsTokens[_0x5a6228['id']]['access_token'])){if(moment()[_0xff8f('0x1a')](accountsTokens[_0x5a6228['id']][_0xff8f('0x1b')])){_0x5948fa(accountsTokens[_0x5a6228['id']][_0xff8f('0x1c')]);}}var _0x44fb06;switch(_0x5a6228[_0xff8f('0x1d')]){case'US':_0x44fb06=_0xff8f('0x1e');break;case'AU':_0x44fb06='https://accounts.zoho.com.au';break;case'EU':_0x44fb06=_0xff8f('0x1f');break;case'IN':_0x44fb06=_0xff8f('0x20');break;case'CN':_0x44fb06=_0xff8f('0x21');break;default:_0x44fb06=_0xff8f('0x1f');break;}var _0x3a9244={'method':_0xff8f('0x22'),'uri':_0x44fb06+'/oauth/v2/token','qs':{'refresh_token':_0x5a6228['refreshToken'],'client_id':_0x5a6228['clientId'],'client_secret':_0x5a6228[_0xff8f('0x23')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3a9244)['then'](function(_0x5871b6){accountsTokens[_0x5a6228['id']]={'access_token':_0x5871b6['access_token'],'expires_in':moment()[_0xff8f('0x24')](_0x5871b6['expires_in'],_0xff8f('0x25'))};_0x5948fa(_0x5871b6['access_token']);})[_0xff8f('0x26')](function(_0x22372d){logger[_0xff8f('0x27')](_0xff8f('0x28'),_0x22372d['stack']);_0x3a6c4b(_0x22372d);});});}function getUser(_0xd5d7c,_0x3977fa,_0x447ad8,_0x37ff3b){logger[_0xff8f('0x29')]('Search\x20user');return request({'method':_0xff8f('0x2a'),'uri':util[_0xff8f('0x2b')](_0xff8f('0x2c'),_0x3977fa),'qs':{'type':_0xff8f('0x2d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd5d7c},'json':!![]})[_0xff8f('0x2e')](function(_0x5e3e71){if(_0x5e3e71['users']){var _0x179a10=-0x1;if(_['isArrayLikeObject'](_0x5e3e71[_0xff8f('0x2f')])){if(!_[_0xff8f('0x19')](_0x37ff3b)){_0x179a10=_['findIndex'](_0x5e3e71[_0xff8f('0x2f')],function(_0x599efc){return _0x599efc[_0xff8f('0x30')]===_0x37ff3b;});}if(_0x179a10>=0x0){logger[_0xff8f('0x29')](_0xff8f('0x31'));}else{logger[_0xff8f('0x29')]('Using\x20the\x20admin\x20account!');_0x179a10=_['findIndex'](_0x5e3e71[_0xff8f('0x2f')],function(_0x5418d1){return _0x5418d1['profile'][_0xff8f('0x15')]===_0xff8f('0x32');});}return _0x5e3e71[_0xff8f('0x2f')][_0x179a10];}else{if(_0x5e3e71['user']['profile'][_0xff8f('0x15')]===_0xff8f('0x32')){logger['info'](_0xff8f('0x33'));user=_0x5e3e71[_0xff8f('0x34')];return user;}else{logger[_0xff8f('0x27')](_0xff8f('0x35'),JSON['stringify'](_0x5e3e71));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5e3e71));}}}else{logger['error'](_0xff8f('0x35'),JSON[_0xff8f('0xa')](_0x5e3e71));throw new Error(_0xff8f('0x36')+JSON[_0xff8f('0xa')](_0x5e3e71));}})[_0xff8f('0x26')](function(_0x2ef82c){console[_0xff8f('0x27')](_0x2ef82c);});}function getZohoUser(_0x698c98,_0x1303aa){return new BPromise(function(_0x5069f6,_0x2aea46){request(_0x698c98)[_0xff8f('0x2e')](function(_0x9b4dc0){var _0x4618aa=null;if(_0x9b4dc0){_0x4618aa=_0x9b4dc0[_0xff8f('0x37')][0x0];_0x4618aa[_0xff8f('0x38')]=_0x1303aa;}_0x5069f6(_0x4618aa);})[_0xff8f('0x26')](function(_0x16d275){_0x2aea46(_0x16d275);});});}function createEndUser(_0x953e1c,_0x4e1d3f,_0x559799,_0x5b9f72,_0x4df218,_0x19fcd0){var _0x559799=getName(_0x559799);return request({'method':_0xff8f('0x22'),'uri':_0xff8f('0x39')+_0x4e1d3f+_0xff8f('0x3a')+_[_0xff8f('0x3b')](_0x19fcd0[_0xff8f('0x3c')])+'s','body':{'data':[{'Last_Name':_0x559799[0x1],'First_Name':_0x559799[0x0],'Phone':_0x5b9f72,'Owner':{'name':!_['isNil'](_0x4df218[_0xff8f('0x3d')][_0xff8f('0x15')])?_0x4df218['role']['name']:!_[_0xff8f('0x19')](_0x4df218[_0xff8f('0x3e')])?_0x4df218[_0xff8f('0x3e')]+'\x20'+_0x4df218[_0xff8f('0x3f')]:_0x4df218[_0xff8f('0x3f')],'id':_0x4df218['id']}}]},'headers':{'Authorization':_0xff8f('0x40')+_0x953e1c},'json':!![]})[_0xff8f('0x2e')](function(_0x26c280){if(_0x26c280&&_0x26c280['data'][0x0][_0xff8f('0x41')]===_0xff8f('0x42')){var _0x4186f9=_0x26c280[_0xff8f('0x37')][0x0][_0xff8f('0x43')];_0x4186f9['enduserType']=_[_0xff8f('0x3b')](_0x19fcd0[_0xff8f('0x3c')])+'s';return _0x4186f9;}logger[_0xff8f('0x27')](_0xff8f('0x35'),JSON[_0xff8f('0xa')](data));throw new Error('Error:\x20'+JSON[_0xff8f('0xa')](data));})['catch'](function(_0x23579b){console[_0xff8f('0x44')](_0xff8f('0x45'),_0x23579b);});}function getEndUser(_0xa6d9b0,_0x19fcfd,_0x2098cf,_0x28dd86,_0x33609e,_0x2224a1,_0x4af38e){var _0x1d10dc={'method':_0xff8f('0x2a'),'uri':'','headers':{'Authorization':_0xff8f('0x40')+_0xa6d9b0},'json':!![]};switch(_0x4af38e[_0xff8f('0x46')]){case _0xff8f('0x47'):_0x1d10dc[_0xff8f('0x48')]='https://www.zohoapis.'+_0x19fcfd+_0xff8f('0x49')+_0x33609e+'))';return getZohoUser(_0x1d10dc,'Contacts')[_0xff8f('0x2e')](function(_0x16081b){if(_0x16081b)return _0x16081b;_0x1d10dc[_0xff8f('0x48')]=_0xff8f('0x39')+_0x19fcfd+_0xff8f('0x4a')+_0x33609e+'))';return getZohoUser(_0x1d10dc,_0xff8f('0x4b'))[_0xff8f('0x2e')](function(_0x304277){if(_0x304277)return _0x304277;if(_0x4af38e[_0xff8f('0x3c')]!=_0xff8f('0x4c')){return createEndUser(_0xa6d9b0,_0x19fcfd,_0x28dd86,_0x33609e,_0x2224a1,_0x4af38e);}else{return{};}});});break;case _0xff8f('0x4d'):_0x1d10dc[_0xff8f('0x48')]=_0xff8f('0x39')+_0x19fcfd+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x33609e+'))';return getZohoUser(_0x1d10dc,_0xff8f('0x4e'))['then'](function(_0xa4ed9e){if(_0xa4ed9e)return _0xa4ed9e;if(_0x4af38e['moduleCreate']!=_0xff8f('0x4c')){return createEndUser(_0xa6d9b0,_0x19fcfd,_0x28dd86,_0x33609e,_0x2224a1,_0x4af38e);}else{return{};}});break;case'lead':_0x1d10dc[_0xff8f('0x48')]=_0xff8f('0x39')+_0x19fcfd+_0xff8f('0x4a')+_0x33609e+'))';return getZohoUser(_0x1d10dc,_0xff8f('0x4b'))[_0xff8f('0x2e')](function(_0xd6a278){if(_0xd6a278)return _0xd6a278;if(_0x4af38e[_0xff8f('0x3c')]!=_0xff8f('0x4c')){return createEndUser(_0xa6d9b0,_0x19fcfd,_0x28dd86,_0x33609e,_0x2224a1,_0x4af38e);}else{return{};}});break;}}function getCall(_0x586578,_0x597e9,_0x3f27cc,_0x2cf95e,_0x812464,_0x571926,_0x18d7e4,_0x3977d3){logger[_0xff8f('0x29')](_0xff8f('0x4f'));var _0x415e95={};_0x415e95[_0xff8f('0x50')]={'name':!_[_0xff8f('0x19')](_0x2cf95e[_0xff8f('0x3d')][_0xff8f('0x15')])&&!_[_0xff8f('0x19')](_0x2cf95e[_0xff8f('0x51')][_0xff8f('0x15')])&&_0x2cf95e[_0xff8f('0x51')]['name']===_0xff8f('0x52')?_0x2cf95e[_0xff8f('0x3d')]['name']:!_[_0xff8f('0x19')](_0x2cf95e[_0xff8f('0x3e')])?_0x2cf95e[_0xff8f('0x3e')]+'\x20'+_0x2cf95e[_0xff8f('0x3f')]:_0x2cf95e[_0xff8f('0x3f')],'id':_0x2cf95e['id']};_0x415e95['Subject']=intUtil[_0xff8f('0x53')](_0x571926[_0xff8f('0x54')],_0x18d7e4,'\x20');_0x415e95[_0xff8f('0x55')]=intUtil['getString'](_0x571926['Descriptions'],_0x18d7e4,'\x0a');if(_0x812464[_0xff8f('0x38')]===_0xff8f('0x4e')){_0x415e95[_0xff8f('0x56')]={'name':!_['isNil'](_0x812464['Full_Name'])?_0x812464['Full_Name']:!_[_0xff8f('0x19')](_0x812464[_0xff8f('0x57')])?_0x812464[_0xff8f('0x57')]+'\x20'+_0x812464['Last_Name']:_0x812464[_0xff8f('0x58')],'id':_0x812464['id']};}if(_0x812464[_0xff8f('0x38')]===_0xff8f('0x4b')){_0x415e95['What_Id']={'name':!_[_0xff8f('0x19')](_0x812464[_0xff8f('0x59')])?_0x812464[_0xff8f('0x59')]:!_['isNil'](_0x812464[_0xff8f('0x57')])?_0x812464[_0xff8f('0x57')]+'\x20'+_0x812464[_0xff8f('0x58')]:_0x812464['Last_Name'],'id':_0x812464['id']};_0x415e95[_0xff8f('0x5a')]=_[_0xff8f('0x3b')](_0x812464[_0xff8f('0x38')]);}if(_0x18d7e4[_0xff8f('0x5b')]){_0x415e95[_0xff8f('0x5c')]=moment['utc'](parseInt(_0x18d7e4[_0xff8f('0x5b')])*0x3e8)[_0xff8f('0x2b')](_0xff8f('0x5d'));}else if(_0x18d7e4[_0xff8f('0x5e')]&&_0x18d7e4[_0xff8f('0x5f')]){_0x415e95['Call_Duration']=moment[_0xff8f('0x60')](moment(_0x18d7e4['endtime'],_0xff8f('0x61'))[_0xff8f('0x62')](moment(_0x18d7e4[_0xff8f('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0xff8f('0x2b')](_0xff8f('0x5d'));}switch(_0x18d7e4[_0xff8f('0x64')]){case _0xff8f('0x65'):_0x415e95[_0xff8f('0x66')]=_0xff8f('0x67');break;case _0xff8f('0x68'):case'connect':_0x415e95[_0xff8f('0x66')]='Answered';break;case _0xff8f('0x69'):_0x415e95[_0xff8f('0x66')]=_0xff8f('0x6a');break;case _0xff8f('0x6b'):_0x415e95[_0xff8f('0x66')]='Abandoned';break;case _0xff8f('0x6c'):_0x415e95[_0xff8f('0x66')]=_0xff8f('0x6d');default:}_0x415e95[_0xff8f('0x6e')]=(_0x3977d3===_0xff8f('0x6f')?moment(_0x18d7e4[_0xff8f('0x63')])[_0xff8f('0x2b')](_0xff8f('0x61')):moment(_0x18d7e4['agentcalledAt'])[_0xff8f('0x2b')](_0xff8f('0x61')))||moment()[_0xff8f('0x2b')](_0xff8f('0x61'));_0x415e95[_0xff8f('0x70')]=_0x3977d3||_0xff8f('0x71');_0x415e95=_[_0xff8f('0x72')](_0x415e95,getCustomFields(_0x571926[_0xff8f('0x73')],_0x18d7e4));return request({'method':_0xff8f('0x22'),'uri':_0xff8f('0x39')+_0x597e9+_0xff8f('0x74'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x586578},'body':{'data':[_0x415e95]},'json':!![]})[_0xff8f('0x2e')](function(_0x13b99c){if(_0x13b99c&&_0x13b99c[_0xff8f('0x37')][0x0][_0xff8f('0x41')]===_0xff8f('0x42')){logger[_0xff8f('0x29')]('Call\x20created!');return{'id':_0x13b99c[_0xff8f('0x37')][0x0]['details']['id']};}})[_0xff8f('0x26')](function(_0x2b8bcd){logger[_0xff8f('0x29')]('err',_0x2b8bcd[_0xff8f('0x75')]);console[_0xff8f('0x44')](_0xff8f('0x76'),_0x2b8bcd);});}exports['queue']=function(_0x2f6d24,_0x16c385,_0x582ad9,_0xfd8b33,_0x1add61,_0x2a9134){var _0x22618f,_0x4f3950,_0x38c11f;_0x2a9134[_0xff8f('0x77')]=intUtil[_0xff8f('0x78')](_0x2a9134[_0xff8f('0x77')]);_0x2a9134[_0xff8f('0x79')]=intUtil[_0xff8f('0x78')](_0x2a9134[_0xff8f('0x79')]);if(_0x1add61&&_0x1add61['monitor_format']){logger[_0xff8f('0x29')](_0xff8f('0x7a'),_0xff8f('0x7b'));_0x16c385[_0xff8f('0x7c')]=_0x2a9134['serverUrl']+'/api/voice/recordings/'+_0x16c385[_0xff8f('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x16c385[_0xff8f('0x7d')]);}else{_0x16c385[_0xff8f('0x7c')]='';}var _0x1eaa6f=_0x2a9134[_0xff8f('0x77')]===_0xff8f('0x7e')?'eu':'com';return getAccessToken(_0x2a9134)[_0xff8f('0x2e')](function(_0x2cb4b3){_0x38c11f=_0x2cb4b3;return getUser(_0x38c11f,_0x1eaa6f,_0x2a9134,_0xfd8b33[_0xff8f('0x30')]);})[_0xff8f('0x2e')](function(_0x2a3c4a){_0x22618f=_0x2a3c4a;logger[_0xff8f('0x29')](_0xff8f('0x7f'),_0x22618f['id']);return getEndUser(_0x38c11f,_0x1eaa6f,_0x2a9134,_0x16c385['calleridname'],_0x16c385['calleridnum'],_0x22618f,_0x582ad9);})[_0xff8f('0x2e')](function(_0x58d217){_0x4f3950=_0x58d217;return getCall(_0x38c11f,_0x1eaa6f,_0x2a9134,_0x22618f,_0x4f3950,_0x582ad9,_0x16c385,_0xff8f('0x71'));})[_0xff8f('0x2e')](function(_0x5370f2){if(_0x5370f2){logger['info'](_0xff8f('0x80'),_0x5370f2['id']);logger[_0xff8f('0x29')](_0xff8f('0x7a'),_0xff8f('0x81'));emit(util['format'](_0xff8f('0x82'),_0xfd8b33[_0xff8f('0x15')]),_0xff8f('0x83'),{'uri':_0xff8f('0x84')+_0x2a9134['host']+_0xff8f('0x85')+_0x5370f2['id']});}})[_0xff8f('0x26')](function(_0x2011cd){logger[_0xff8f('0x27')](_0xff8f('0x7a'),JSON['stringify'](_0x2011cd));});};exports[_0xff8f('0x6f')]=function(_0x279d33,_0x30c279,_0x55fc4e,_0x4494d6,_0x552db7,_0x4f31c4,_0x417ed1){var _0x12ff21,_0x5028c2,_0x57001b;_0x4f31c4[_0xff8f('0x77')]=intUtil[_0xff8f('0x78')](_0x4f31c4['host']);_0x4f31c4[_0xff8f('0x79')]=intUtil[_0xff8f('0x78')](_0x4f31c4[_0xff8f('0x79')]);if(_0x417ed1&&_0x417ed1[_0xff8f('0x86')]&&_0x417ed1[_0xff8f('0x86')]!==_0xff8f('0x87')){logger[_0xff8f('0x29')](_0xff8f('0x88'),_0xff8f('0x7b'));_0x30c279[_0xff8f('0x7c')]=_0x4f31c4[_0xff8f('0x79')]+_0xff8f('0x89')+_0x30c279[_0xff8f('0x7d')]+_0xff8f('0x8a')+md5(_0x30c279[_0xff8f('0x7d')]);}var _0x146d24=_0x4f31c4[_0xff8f('0x77')]===_0xff8f('0x7e')?'eu':_0xff8f('0x8b');return getAccessToken(_0x4f31c4)[_0xff8f('0x2e')](function(_0x4a13e1){_0x57001b=_0x4a13e1;return getUser(_0x57001b,_0x146d24,_0x4f31c4,_0x4494d6[_0xff8f('0x30')]);})[_0xff8f('0x2e')](function(_0x311d43){_0x12ff21=_0x311d43;logger['info']('The\x20User\x20ID\x20is:',_0x12ff21['id']);return getEndUser(_0x57001b,_0x146d24,_0x4f31c4,_0x30c279[_0xff8f('0x8c')],_0x30c279[_0xff8f('0x8d')],_0x12ff21,_0x55fc4e);})[_0xff8f('0x2e')](function(_0x13e7ea){_0x5028c2=_0x13e7ea;return getCall(_0x57001b,_0x146d24,_0x4f31c4,_0x12ff21,_0x5028c2,_0x55fc4e,_0x30c279,'Outbound');})['then'](function(_0x9f5c7e){if(_0x9f5c7e){logger['info'](_0xff8f('0x80'),_0x9f5c7e['id']);logger['info'](_0xff8f('0x88'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xff8f('0x82'),_0x4494d6['name']),_0xff8f('0x83'),{'uri':'https://crm.'+_0x4f31c4[_0xff8f('0x77')]+'/crm/EntityInfo.do?module=Calls&id='+_0x9f5c7e['id']});}})[_0xff8f('0x26')](function(_0x3b82c4){logger[_0xff8f('0x27')]('[OUTBOUND]',JSON[_0xff8f('0xa')](_0x3b82c4));});};exports[_0xff8f('0x8e')]=function(_0x1ad5d2,_0x3924f7,_0x26c567,_0x1aff1d,_0x961879,_0x1dc705){var _0x57f270,_0x3ba74a,_0x23092a;_0x1dc705['host']=intUtil[_0xff8f('0x78')](_0x1dc705['host']);_0x1dc705[_0xff8f('0x79')]=intUtil[_0xff8f('0x78')](_0x1dc705[_0xff8f('0x79')]);if(_0x961879&&_0x961879[_0xff8f('0x8f')]){logger[_0xff8f('0x29')]('['+_0x3924f7[_0xff8f('0x64')][_0xff8f('0x90')]()+']',_0xff8f('0x7b'));_0x3924f7['recordingURL']=_0x1dc705[_0xff8f('0x79')]+_0xff8f('0x89')+_0x3924f7['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3924f7[_0xff8f('0x7d')]);}else{_0x3924f7[_0xff8f('0x7c')]='';}var _0x2defc0=_0x1dc705[_0xff8f('0x77')]===_0xff8f('0x7e')?'eu':_0xff8f('0x8b');return getAccessToken(_0x1dc705)[_0xff8f('0x2e')](function(_0x539974){_0x23092a=_0x539974;return getUser(_0x23092a,_0x2defc0,_0x1dc705);})[_0xff8f('0x2e')](function(_0x120f12){_0x57f270=_0x120f12;logger[_0xff8f('0x29')]('The\x20User\x20ID\x20is:',_0x57f270['id']);return getEndUser(_0x23092a,_0x2defc0,_0x1dc705,_0x3924f7[_0xff8f('0x91')],_0x3924f7[_0xff8f('0x92')],_0x57f270,_0x26c567);})['then'](function(_0x1ce33b){_0x3ba74a=_0x1ce33b;return getCall(_0x23092a,_0x2defc0,_0x1dc705,_0x57f270,_0x3ba74a,_0x26c567,_0x3924f7,_0xff8f('0x71'));})[_0xff8f('0x2e')](function(_0x1da75f){if(_0x1da75f){logger[_0xff8f('0x29')]('The\x20Call\x20ID\x20is:',_0x1da75f['id']);}})[_0xff8f('0x26')](function(_0x2bd7d1){logger[_0xff8f('0x27')]('['+_0x3924f7[_0xff8f('0x64')][_0xff8f('0x90')]()+']',JSON[_0xff8f('0xa')](_0x2bd7d1));});}; \ No newline at end of file +var _0xae59=['localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','details','moduleCreate','Error:\x20','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Contacts','Who_Id','First_Name','Last_Name','Full_Name','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','err','log','host','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','com','email','Outbound','unmanaged','toUpperCase','lodash','md5','util','moment','bluebird','../../../../config/logger','zoho','redis','defaults'];(function(_0x310bc5,_0x864a8a){var _0x39626a=function(_0x5831f4){while(--_0x5831f4){_0x310bc5['push'](_0x310bc5['shift']());}};_0x39626a(++_0x864a8a);}(_0xae59,0x8d));var _0x9ae5=function(_0x5a6f9b,_0x3f0261){_0x5a6f9b=_0x5a6f9b-0x0;var _0x5e583a=_0xae59[_0x5a6f9b];return _0x5e583a;};'use strict';var _=require(_0x9ae5('0x0'));var rp=require('request-promise');var md5=require(_0x9ae5('0x1'));var util=require(_0x9ae5('0x2'));var intUtil=require('./util');var moment=require(_0x9ae5('0x3'));var Redis=require('ioredis');var BPromise=require(_0x9ae5('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9ae5('0x5'))(_0x9ae5('0x6'));config[_0x9ae5('0x7')]=_[_0x9ae5('0x8')](config[_0x9ae5('0x7')],{'host':_0x9ae5('0x9'),'port':0x18eb});var io=require(_0x9ae5('0xa'))(new Redis(config[_0x9ae5('0x7')]));function emit(_0x1e0e69,_0x53f27d,_0x562413){io['to'](_0x1e0e69)['emit'](_0x53f27d,_0x562413);}function request(_0xa0d932){logger[_0x9ae5('0xb')](_0x9ae5('0xc'),JSON[_0x9ae5('0xd')](_0xa0d932));return rp(_0xa0d932);}function getCustomFields(_0x2e0557,_0x27684b){var _0x8f099d={};if(_0x2e0557[_0x9ae5('0xe')]>0x0){_[_0x9ae5('0xf')](_0x2e0557,function(_0x561b2f){if(_0x561b2f[_0x9ae5('0x10')]==='string'&&_0x561b2f['idField']){_0x8f099d[_0x561b2f[_0x9ae5('0x11')]]=_0x561b2f[_0x9ae5('0x12')]['toString']();}else if(_0x561b2f[_0x9ae5('0x10')]===_0x9ae5('0x13')&&_0x561b2f[_0x9ae5('0x14')]&&_0x561b2f[_0x9ae5('0x11')]&&_0x27684b[_0x561b2f[_0x9ae5('0x14')]]){_0x8f099d[_0x561b2f[_0x9ae5('0x11')]]=_0x27684b[_0x561b2f[_0x9ae5('0x14')]][_0x9ae5('0x15')]();}else if(_0x561b2f[_0x9ae5('0x10')]===_0x9ae5('0x16')&&_0x561b2f[_0x9ae5('0x17')]&&_0x561b2f[_0x9ae5('0x17')][_0x9ae5('0x18')]&&_0x561b2f[_0x9ae5('0x11')]&&_0x27684b[_0x561b2f[_0x9ae5('0x17')]['name'][_0x9ae5('0x19')]()]){_0x8f099d[_0x561b2f[_0x9ae5('0x11')]]=_0x27684b[_0x561b2f[_0x9ae5('0x17')][_0x9ae5('0x18')]['toLowerCase']()]['toString']();}});}return _0x8f099d;}function getName(_0x382191){if(_0x382191[_0x9ae5('0x1a')]('\x20')>0x0){var _0x219621=_0x382191['split'](/ (.+)/);if(_0x219621[0x1]){return _0x219621;}}return[_0x382191,_0x382191];}var accountsTokens={};function getAccessToken(_0x1c42f2){return new Promise(function(_0xc086de,_0x69855d){if(!_[_0x9ae5('0x1b')](accountsTokens[_0x1c42f2['id']])&&!_[_0x9ae5('0x1b')](accountsTokens[_0x1c42f2['id']]['access_token'])){if(moment()[_0x9ae5('0x1c')](accountsTokens[_0x1c42f2['id']][_0x9ae5('0x1d')])){_0xc086de(accountsTokens[_0x1c42f2['id']][_0x9ae5('0x1e')]);}}var _0x4d9a23;switch(_0x1c42f2['zone']){case'US':_0x4d9a23=_0x9ae5('0x1f');break;case'AU':_0x4d9a23=_0x9ae5('0x20');break;case'EU':_0x4d9a23='https://accounts.zoho.eu';break;case'IN':_0x4d9a23=_0x9ae5('0x21');break;case'CN':_0x4d9a23='https://accounts.zoho.com.cn';break;default:_0x4d9a23='https://accounts.zoho.eu';break;}var _0x535734={'method':_0x9ae5('0x22'),'uri':_0x4d9a23+'/oauth/v2/token','qs':{'refresh_token':_0x1c42f2[_0x9ae5('0x23')],'client_id':_0x1c42f2[_0x9ae5('0x24')],'client_secret':_0x1c42f2[_0x9ae5('0x25')],'grant_type':_0x9ae5('0x26')},'json':!![]};return rp(_0x535734)[_0x9ae5('0x27')](function(_0x11c509){accountsTokens[_0x1c42f2['id']]={'access_token':_0x11c509['access_token'],'expires_in':moment()['add'](_0x11c509[_0x9ae5('0x1d')],_0x9ae5('0x28'))};_0xc086de(_0x11c509[_0x9ae5('0x1e')]);})[_0x9ae5('0x29')](function(_0x3e9257){logger[_0x9ae5('0x2a')](_0x9ae5('0x2b'),_0x3e9257[_0x9ae5('0x2c')]);_0x69855d(_0x3e9257);});});}function getUser(_0x729754,_0x496b44,_0x477249,_0x8fbae0){logger[_0x9ae5('0x2d')]('Search\x20user');return request({'method':_0x9ae5('0x2e'),'uri':util[_0x9ae5('0x2f')](_0x9ae5('0x30'),_0x496b44),'qs':{'type':_0x9ae5('0x31')},'headers':{'Authorization':_0x9ae5('0x32')+_0x729754},'json':!![]})[_0x9ae5('0x27')](function(_0x5ca9b9){if(_0x5ca9b9[_0x9ae5('0x33')]){var _0x43aba4=-0x1;if(_[_0x9ae5('0x34')](_0x5ca9b9[_0x9ae5('0x33')])){if(!_[_0x9ae5('0x1b')](_0x8fbae0)){_0x43aba4=_[_0x9ae5('0x35')](_0x5ca9b9['users'],function(_0x54bd77){return _0x54bd77['email']===_0x8fbae0;});}if(_0x43aba4>=0x0){logger[_0x9ae5('0x2d')]('Agent\x20found!');}else{logger[_0x9ae5('0x2d')](_0x9ae5('0x36'));_0x43aba4=_[_0x9ae5('0x35')](_0x5ca9b9[_0x9ae5('0x33')],function(_0xc80208){return _0xc80208[_0x9ae5('0x37')][_0x9ae5('0x18')]===_0x9ae5('0x38');});}return _0x5ca9b9[_0x9ae5('0x33')][_0x43aba4];}else{if(_0x5ca9b9[_0x9ae5('0x39')][_0x9ae5('0x37')]['name']===_0x9ae5('0x38')){logger[_0x9ae5('0x2d')](_0x9ae5('0x36'));user=_0x5ca9b9['user'];return user;}else{logger['error'](_0x9ae5('0x3a'),JSON[_0x9ae5('0xd')](_0x5ca9b9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5ca9b9));}}}else{logger['error'](_0x9ae5('0x3a'),JSON[_0x9ae5('0xd')](_0x5ca9b9));throw new Error(_0x9ae5('0x3b')+JSON[_0x9ae5('0xd')](_0x5ca9b9));}})[_0x9ae5('0x29')](function(_0x1e7264){console['error'](_0x1e7264);});}function getZohoUser(_0x64bf0a,_0x591889){return new BPromise(function(_0x59f2d2,_0x451378){request(_0x64bf0a)['then'](function(_0x5cf1aa){var _0x4c661f=null;if(_0x5cf1aa){_0x4c661f=_0x5cf1aa[_0x9ae5('0x3c')][0x0];_0x4c661f[_0x9ae5('0x3d')]=_0x591889;}_0x59f2d2(_0x4c661f);})['catch'](function(_0x2cad97){_0x451378(_0x2cad97);});});}function createEndUser(_0x2101e7,_0x4e713c,_0x247363,_0x5c2d76,_0x4a2ec5,_0x19174e){var _0x247363=getName(_0x247363);return request({'method':_0x9ae5('0x22'),'uri':'https://www.zohoapis.'+_0x4e713c+_0x9ae5('0x3e')+_[_0x9ae5('0x3f')](_0x19174e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x247363[0x1],'First_Name':_0x247363[0x0],'Phone':_0x5c2d76,'Owner':{'name':!_[_0x9ae5('0x1b')](_0x4a2ec5[_0x9ae5('0x40')][_0x9ae5('0x18')])?_0x4a2ec5[_0x9ae5('0x40')][_0x9ae5('0x18')]:!_[_0x9ae5('0x1b')](_0x4a2ec5[_0x9ae5('0x41')])?_0x4a2ec5[_0x9ae5('0x41')]+'\x20'+_0x4a2ec5[_0x9ae5('0x42')]:_0x4a2ec5[_0x9ae5('0x42')],'id':_0x4a2ec5['id']}}]},'headers':{'Authorization':_0x9ae5('0x32')+_0x2101e7},'json':!![]})[_0x9ae5('0x27')](function(_0x192277){if(_0x192277&&_0x192277['data'][0x0]['code']===_0x9ae5('0x43')){var _0x492f37=_0x192277['data'][0x0][_0x9ae5('0x44')];_0x492f37[_0x9ae5('0x3d')]=_['startCase'](_0x19174e[_0x9ae5('0x45')])+'s';return _0x492f37;}logger[_0x9ae5('0x2a')](_0x9ae5('0x3a'),JSON['stringify'](data));throw new Error(_0x9ae5('0x46')+JSON[_0x9ae5('0xd')](data));})[_0x9ae5('0x29')](function(_0x431027){console['log']('CREATE\x20ERROR',_0x431027);});}function getEndUser(_0xcfa1a5,_0x203ad0,_0x5db278,_0x24473a,_0x4ee1c1,_0x47bd7a,_0x470dfc){var _0x496852={'method':_0x9ae5('0x2e'),'uri':'','headers':{'Authorization':_0x9ae5('0x32')+_0xcfa1a5},'json':!![]};switch(_0x470dfc[_0x9ae5('0x47')]){case _0x9ae5('0x48'):_0x496852[_0x9ae5('0x49')]=_0x9ae5('0x4a')+_0x203ad0+_0x9ae5('0x4b')+_0x4ee1c1+'))';return getZohoUser(_0x496852,'Contacts')['then'](function(_0x302010){if(_0x302010)return _0x302010;_0x496852['uri']=_0x9ae5('0x4a')+_0x203ad0+_0x9ae5('0x4c')+_0x4ee1c1+'))';return getZohoUser(_0x496852,_0x9ae5('0x4d'))['then'](function(_0x75a41f){if(_0x75a41f)return _0x75a41f;if(_0x470dfc[_0x9ae5('0x45')]!=_0x9ae5('0x4e')){return createEndUser(_0xcfa1a5,_0x203ad0,_0x24473a,_0x4ee1c1,_0x47bd7a,_0x470dfc);}else{return{};}});});break;case'contact':_0x496852[_0x9ae5('0x49')]=_0x9ae5('0x4a')+_0x203ad0+_0x9ae5('0x4b')+_0x4ee1c1+'))';return getZohoUser(_0x496852,'Contacts')[_0x9ae5('0x27')](function(_0x228833){if(_0x228833)return _0x228833;if(_0x470dfc[_0x9ae5('0x45')]!=_0x9ae5('0x4e')){return createEndUser(_0xcfa1a5,_0x203ad0,_0x24473a,_0x4ee1c1,_0x47bd7a,_0x470dfc);}else{return{};}});break;case _0x9ae5('0x4f'):_0x496852[_0x9ae5('0x49')]=_0x9ae5('0x4a')+_0x203ad0+_0x9ae5('0x4c')+_0x4ee1c1+'))';return getZohoUser(_0x496852,'Leads')[_0x9ae5('0x27')](function(_0x3e22c9){if(_0x3e22c9)return _0x3e22c9;if(_0x470dfc[_0x9ae5('0x45')]!=_0x9ae5('0x4e')){return createEndUser(_0xcfa1a5,_0x203ad0,_0x24473a,_0x4ee1c1,_0x47bd7a,_0x470dfc);}else{return{};}});break;}}function getCall(_0x3303d2,_0xad46a6,_0x193864,_0x43e78e,_0x450fdd,_0x55e0ff,_0x67bfbd,_0x38e39e){logger['info'](_0x9ae5('0x50'));var _0xa9f82c={};_0xa9f82c[_0x9ae5('0x51')]={'name':!_['isNil'](_0x43e78e[_0x9ae5('0x40')][_0x9ae5('0x18')])&&!_['isNil'](_0x43e78e['profile'][_0x9ae5('0x18')])&&_0x43e78e['profile'][_0x9ae5('0x18')]===_0x9ae5('0x52')?_0x43e78e['role']['name']:!_['isNil'](_0x43e78e[_0x9ae5('0x41')])?_0x43e78e[_0x9ae5('0x41')]+'\x20'+_0x43e78e['last_name']:_0x43e78e[_0x9ae5('0x42')],'id':_0x43e78e['id']};_0xa9f82c['Subject']=intUtil[_0x9ae5('0x53')](_0x55e0ff[_0x9ae5('0x54')],_0x67bfbd,'\x20');_0xa9f82c[_0x9ae5('0x55')]=intUtil[_0x9ae5('0x53')](_0x55e0ff[_0x9ae5('0x56')],_0x67bfbd,'\x0a');if(_0x450fdd[_0x9ae5('0x3d')]===_0x9ae5('0x57')){_0xa9f82c[_0x9ae5('0x58')]={'name':!_[_0x9ae5('0x1b')](_0x450fdd['Full_Name'])?_0x450fdd['Full_Name']:!_['isNil'](_0x450fdd[_0x9ae5('0x59')])?_0x450fdd[_0x9ae5('0x59')]+'\x20'+_0x450fdd[_0x9ae5('0x5a')]:_0x450fdd[_0x9ae5('0x5a')],'id':_0x450fdd['id']};}if(_0x450fdd['enduserType']===_0x9ae5('0x4d')){_0xa9f82c['What_Id']={'name':!_[_0x9ae5('0x1b')](_0x450fdd[_0x9ae5('0x5b')])?_0x450fdd[_0x9ae5('0x5b')]:!_[_0x9ae5('0x1b')](_0x450fdd['First_Name'])?_0x450fdd[_0x9ae5('0x59')]+'\x20'+_0x450fdd['Last_Name']:_0x450fdd['Last_Name'],'id':_0x450fdd['id']};_0xa9f82c['$se_module']=_[_0x9ae5('0x3f')](_0x450fdd['enduserType']);}if(_0x67bfbd['talktime']){_0xa9f82c[_0x9ae5('0x5c')]=moment[_0x9ae5('0x5d')](parseInt(_0x67bfbd[_0x9ae5('0x5e')])*0x3e8)['format'](_0x9ae5('0x5f'));}else if(_0x67bfbd[_0x9ae5('0x60')]&&_0x67bfbd[_0x9ae5('0x61')]){_0xa9f82c[_0x9ae5('0x5c')]=moment[_0x9ae5('0x5d')](moment(_0x67bfbd[_0x9ae5('0x61')],_0x9ae5('0x62'))[_0x9ae5('0x63')](moment(_0x67bfbd[_0x9ae5('0x64')],_0x9ae5('0x62'))))[_0x9ae5('0x2f')](_0x9ae5('0x5f'));}switch(_0x67bfbd[_0x9ae5('0x65')]){case _0x9ae5('0x66'):_0xa9f82c[_0x9ae5('0x67')]=_0x9ae5('0x68');break;case _0x9ae5('0x69'):case _0x9ae5('0x6a'):_0xa9f82c[_0x9ae5('0x67')]='Answered';break;case _0x9ae5('0x6b'):_0xa9f82c['Call_Result']=_0x9ae5('0x6c');break;case _0x9ae5('0x6d'):_0xa9f82c[_0x9ae5('0x67')]='Abandoned';break;case _0x9ae5('0x6e'):_0xa9f82c[_0x9ae5('0x67')]='Timeout';default:}_0xa9f82c[_0x9ae5('0x6f')]=(_0x38e39e===_0x9ae5('0x70')?moment(_0x67bfbd['starttime'])[_0x9ae5('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x67bfbd[_0x9ae5('0x71')])[_0x9ae5('0x2f')](_0x9ae5('0x62')))||moment()[_0x9ae5('0x2f')](_0x9ae5('0x62'));_0xa9f82c[_0x9ae5('0x72')]=_0x38e39e||_0x9ae5('0x73');_0xa9f82c=_[_0x9ae5('0x74')](_0xa9f82c,getCustomFields(_0x55e0ff['Fields'],_0x67bfbd));return request({'method':_0x9ae5('0x22'),'uri':_0x9ae5('0x4a')+_0xad46a6+_0x9ae5('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3303d2},'body':{'data':[_0xa9f82c]},'json':!![]})[_0x9ae5('0x27')](function(_0x909997){if(_0x909997&&_0x909997['data'][0x0][_0x9ae5('0x76')]===_0x9ae5('0x43')){logger['info'](_0x9ae5('0x77'));return{'id':_0x909997[_0x9ae5('0x3c')][0x0][_0x9ae5('0x44')]['id']};}})[_0x9ae5('0x29')](function(_0x419004){logger[_0x9ae5('0x2d')](_0x9ae5('0x78'),_0x419004[_0x9ae5('0x2c')]);console[_0x9ae5('0x79')](_0x9ae5('0x78'),_0x419004);});}exports['queue']=function(_0x4f3046,_0x20e0d5,_0xa72fbd,_0x445256,_0x5a8dcd,_0x4f7e84){var _0x2c0f0e,_0x2ba46f,_0x120d53;_0x4f7e84[_0x9ae5('0x7a')]=intUtil['stripTrailingSlash'](_0x4f7e84[_0x9ae5('0x7a')]);_0x4f7e84['serverUrl']=intUtil[_0x9ae5('0x7b')](_0x4f7e84['serverUrl']);if(_0x5a8dcd&&_0x5a8dcd[_0x9ae5('0x7c')]){logger['info'](_0x9ae5('0x7d'),'Recording\x20is\x20enabled!');_0x20e0d5[_0x9ae5('0x7e')]=_0x4f7e84[_0x9ae5('0x7f')]+_0x9ae5('0x80')+_0x20e0d5[_0x9ae5('0x81')]+_0x9ae5('0x82')+md5(_0x20e0d5[_0x9ae5('0x81')]);}else{_0x20e0d5[_0x9ae5('0x7e')]='';}var _0x3862d1=_0x4f7e84[_0x9ae5('0x7a')]===_0x9ae5('0x83')?'eu':'com';return getAccessToken(_0x4f7e84)[_0x9ae5('0x27')](function(_0x2bfed5){_0x120d53=_0x2bfed5;return getUser(_0x120d53,_0x3862d1,_0x4f7e84,_0x445256['email']);})[_0x9ae5('0x27')](function(_0x4df5de){_0x2c0f0e=_0x4df5de;logger[_0x9ae5('0x2d')](_0x9ae5('0x84'),_0x2c0f0e['id']);return getEndUser(_0x120d53,_0x3862d1,_0x4f7e84,_0x20e0d5[_0x9ae5('0x85')],_0x20e0d5[_0x9ae5('0x86')],_0x2c0f0e,_0xa72fbd);})['then'](function(_0x15ef4b){_0x2ba46f=_0x15ef4b;return getCall(_0x120d53,_0x3862d1,_0x4f7e84,_0x2c0f0e,_0x2ba46f,_0xa72fbd,_0x20e0d5,_0x9ae5('0x73'));})[_0x9ae5('0x27')](function(_0x3da54e){if(_0x3da54e){logger[_0x9ae5('0x2d')](_0x9ae5('0x87'),_0x3da54e['id']);logger['info']('[QUEUE]',_0x9ae5('0x88'));emit(util[_0x9ae5('0x2f')](_0x9ae5('0x89'),_0x445256[_0x9ae5('0x18')]),_0x9ae5('0x8a'),{'uri':_0x9ae5('0x8b')+_0x4f7e84[_0x9ae5('0x7a')]+_0x9ae5('0x8c')+_0x3da54e['id']});}})[_0x9ae5('0x29')](function(_0x5e1deb){logger['error'](_0x9ae5('0x7d'),JSON[_0x9ae5('0xd')](_0x5e1deb));});};exports[_0x9ae5('0x70')]=function(_0x369c7b,_0xbcd282,_0x26e93c,_0x5b37dc,_0x2df353,_0x2e4373,_0x179470){var _0x24cb60,_0x1a38df,_0x51905e;_0x2e4373['host']=intUtil[_0x9ae5('0x7b')](_0x2e4373[_0x9ae5('0x7a')]);_0x2e4373[_0x9ae5('0x7f')]=intUtil[_0x9ae5('0x7b')](_0x2e4373[_0x9ae5('0x7f')]);if(_0x179470&&_0x179470['recordingFormat']&&_0x179470[_0x9ae5('0x8d')]!==_0x9ae5('0x8e')){logger[_0x9ae5('0x2d')](_0x9ae5('0x8f'),_0x9ae5('0x90'));_0xbcd282['recordingURL']=_0x2e4373['serverUrl']+'/api/voice/recordings/'+_0xbcd282[_0x9ae5('0x81')]+'/downloads?type=uniqueid&token='+md5(_0xbcd282['uniqueid']);}var _0x30f834=_0x2e4373[_0x9ae5('0x7a')]===_0x9ae5('0x83')?'eu':_0x9ae5('0x91');return getAccessToken(_0x2e4373)[_0x9ae5('0x27')](function(_0x17aeba){_0x51905e=_0x17aeba;return getUser(_0x51905e,_0x30f834,_0x2e4373,_0x5b37dc[_0x9ae5('0x92')]);})[_0x9ae5('0x27')](function(_0xc6f385){_0x24cb60=_0xc6f385;logger['info']('The\x20User\x20ID\x20is:',_0x24cb60['id']);return getEndUser(_0x51905e,_0x30f834,_0x2e4373,_0xbcd282['destcalleridname'],_0xbcd282['destcalleridnum'],_0x24cb60,_0x26e93c);})[_0x9ae5('0x27')](function(_0x3281bf){_0x1a38df=_0x3281bf;return getCall(_0x51905e,_0x30f834,_0x2e4373,_0x24cb60,_0x1a38df,_0x26e93c,_0xbcd282,_0x9ae5('0x93'));})[_0x9ae5('0x27')](function(_0x2773aa){if(_0x2773aa){logger[_0x9ae5('0x2d')]('The\x20Call\x20ID\x20is:',_0x2773aa['id']);logger[_0x9ae5('0x2d')](_0x9ae5('0x8f'),_0x9ae5('0x88'));emit(util[_0x9ae5('0x2f')](_0x9ae5('0x89'),_0x5b37dc[_0x9ae5('0x18')]),_0x9ae5('0x8a'),{'uri':'https://crm.'+_0x2e4373[_0x9ae5('0x7a')]+_0x9ae5('0x8c')+_0x2773aa['id']});}})[_0x9ae5('0x29')](function(_0x2ffef9){logger[_0x9ae5('0x2a')]('[OUTBOUND]',JSON[_0x9ae5('0xd')](_0x2ffef9));});};exports[_0x9ae5('0x94')]=function(_0x5363a7,_0x41f0cb,_0x205bad,_0x3f24de,_0x1b4747,_0x4b8b36){var _0x5aab0c,_0x281f70,_0x578a54;_0x4b8b36['host']=intUtil['stripTrailingSlash'](_0x4b8b36['host']);_0x4b8b36[_0x9ae5('0x7f')]=intUtil[_0x9ae5('0x7b')](_0x4b8b36[_0x9ae5('0x7f')]);if(_0x1b4747&&_0x1b4747[_0x9ae5('0x7c')]){logger[_0x9ae5('0x2d')]('['+_0x41f0cb[_0x9ae5('0x65')][_0x9ae5('0x95')]()+']',_0x9ae5('0x90'));_0x41f0cb['recordingURL']=_0x4b8b36['serverUrl']+_0x9ae5('0x80')+_0x41f0cb['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x41f0cb[_0x9ae5('0x81')]);}else{_0x41f0cb[_0x9ae5('0x7e')]='';}var _0x5529b0=_0x4b8b36[_0x9ae5('0x7a')]==='zoho.eu'?'eu':_0x9ae5('0x91');return getAccessToken(_0x4b8b36)[_0x9ae5('0x27')](function(_0x3cd10f){_0x578a54=_0x3cd10f;return getUser(_0x578a54,_0x5529b0,_0x4b8b36);})[_0x9ae5('0x27')](function(_0x1abffd){_0x5aab0c=_0x1abffd;logger[_0x9ae5('0x2d')](_0x9ae5('0x84'),_0x5aab0c['id']);return getEndUser(_0x578a54,_0x5529b0,_0x4b8b36,_0x41f0cb[_0x9ae5('0x85')],_0x41f0cb[_0x9ae5('0x86')],_0x5aab0c,_0x205bad);})[_0x9ae5('0x27')](function(_0x29192f){_0x281f70=_0x29192f;return getCall(_0x578a54,_0x5529b0,_0x4b8b36,_0x5aab0c,_0x281f70,_0x205bad,_0x41f0cb,'Inbound');})[_0x9ae5('0x27')](function(_0x224efc){if(_0x224efc){logger['info'](_0x9ae5('0x87'),_0x224efc['id']);}})[_0x9ae5('0x29')](function(_0x444be7){logger['error']('['+_0x41f0cb[_0x9ae5('0x65')][_0x9ae5('0x95')]()+']',JSON[_0x9ae5('0xd')](_0x444be7));});}; \ 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 b698b9f..e9b179e 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(_0x3c3ae5,_0x5c8745){var _0x1e4266=function(_0x2accd5){while(--_0x2accd5){_0x3c3ae5['push'](_0x3c3ae5['shift']());}};_0x1e4266(++_0x5c8745);}(_0x7a54,0x106));var _0x47a5=function(_0xa85abb,_0x2151ac){_0xa85abb=_0xa85abb-0x0;var _0xa874cf=_0x7a54[_0xa85abb];return _0xa874cf;};'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(_0x274cc6,_0x49f088){var _0x4fdc3d=function(_0x3d1d14){while(--_0x3d1d14){_0x274cc6['push'](_0x274cc6['shift']());}};_0x4fdc3d(++_0x49f088);}(_0x7a54,0x106));var _0x47a5=function(_0x2efa3b,_0x47fa2d){_0x2efa3b=_0x2efa3b-0x0;var _0x305c82=_0x7a54[_0x2efa3b];return _0x305c82;};'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 4d7cf13..67a6f53 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(_0xb82e9e,_0x10b8c4){var _0x572b7c=function(_0x30dda1){while(--_0x30dda1){_0xb82e9e['push'](_0xb82e9e['shift']());}};_0x572b7c(++_0x10b8c4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c1e0a,_0x2fbe21){_0x4c1e0a=_0x4c1e0a-0x0;var _0x526833=_0x5f2f[_0x4c1e0a];return _0x526833;};'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 _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(_0x1df274,_0x2bf733){var _0x37d24d=function(_0x1bd8f1){while(--_0x1bd8f1){_0x1df274['push'](_0x1df274['shift']());}};_0x37d24d(++_0x2bf733);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c17f1,_0x22a531){_0x5c17f1=_0x5c17f1-0x0;var _0x20deae=_0x5f2f[_0x5c17f1];return _0x20deae;};'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 diff --git a/server/services/email/client.js b/server/services/email/client.js index 2430a38..6fe9e8b 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 _0xd04b=['jayson/promise','bluebird','../../config/logger','client','Request','request','then','debug','rpc','routing','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd04b,0x145));var _0xbd04=function(_0xf7eac4,_0x49d4d2){_0xf7eac4=_0xf7eac4-0x0;var _0x17b326=_0xd04b[_0xf7eac4];return _0x17b326;};'use strict';var jayson=require(_0xbd04('0x0'));var BPromise=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('routing');var client=jayson[_0xbd04('0x3')]['http']({'port':0x2329});client[_0xbd04('0x4')]=function(_0x382393,_0xc1c02f){return new BPromise(function(_0xe948b3,_0x36218a){return client[_0xbd04('0x5')](_0x382393,_0xc1c02f)[_0xbd04('0x6')](function(_0x2d8811){logger[_0xbd04('0x7')](_0xbd04('0x8'),_0xbd04('0x9'),_0x382393,_0xc1c02f,_0x2d8811);if(_0x2d8811['error']){logger[_0xbd04('0xa')](_0xbd04('0x8'),_0xbd04('0x9'),_0x382393,_0x2d8811[_0xbd04('0xa')][_0xbd04('0xb')],_0xc1c02f);return _0x36218a(_0x2d8811[_0xbd04('0xa')][_0xbd04('0xb')]);}else{return _0xe948b3(_0x2d8811[_0xbd04('0xc')]);}})['catch'](function(_0x41ad12){logger[_0xbd04('0xa')](_0xbd04('0x8'),_0xbd04('0x9'),_0x382393,_0x41ad12,_0xc1c02f);return _0x36218a(_0x41ad12);});});};module['exports']=client; \ No newline at end of file +var _0x6bff=['http','Request','request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','routing'];(function(_0x19b15a,_0xd60cb5){var _0x284bca=function(_0x1c645d){while(--_0x1c645d){_0x19b15a['push'](_0x19b15a['shift']());}};_0x284bca(++_0xd60cb5);}(_0x6bff,0xa6));var _0xf6bf=function(_0x4f7ca5,_0x13102b){_0x4f7ca5=_0x4f7ca5-0x0;var _0x3c8e02=_0x6bff[_0x4f7ca5];return _0x3c8e02;};'use strict';var jayson=require(_0xf6bf('0x0'));var BPromise=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var client=jayson['client'][_0xf6bf('0x3')]({'port':0x2329});client[_0xf6bf('0x4')]=function(_0x3ab762,_0x14a2d8){return new BPromise(function(_0x4cc8b6,_0x1f3e2c){return client[_0xf6bf('0x5')](_0x3ab762,_0x14a2d8)[_0xf6bf('0x6')](function(_0x239d17){logger[_0xf6bf('0x7')](_0xf6bf('0x8'),_0xf6bf('0x2'),_0x3ab762,_0x14a2d8,_0x239d17);if(_0x239d17[_0xf6bf('0x9')]){logger['error']('rpc','routing',_0x3ab762,_0x239d17[_0xf6bf('0x9')][_0xf6bf('0xa')],_0x14a2d8);return _0x1f3e2c(_0x239d17[_0xf6bf('0x9')][_0xf6bf('0xa')]);}else{return _0x4cc8b6(_0x239d17[_0xf6bf('0xb')]);}})['catch'](function(_0x2c8ad1){logger[_0xf6bf('0x9')]('rpc','routing',_0x3ab762,_0x2c8ad1,_0x14a2d8);return _0x1f3e2c(_0x2c8ad1);});});};module[_0xf6bf('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0be17df..7192f45 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 _0xd101=['log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x42b06c,_0x272349){var _0x110896=function(_0x4f9dee){while(--_0x4f9dee){_0x42b06c['push'](_0x42b06c['shift']());}};_0x110896(++_0x272349);}(_0xd101,0xc1));var _0x1d10=function(_0x3ff09d,_0x3934f8){_0x3ff09d=_0x3ff09d-0x0;var _0xbf5a64=_0xd101[_0x3ff09d];return _0xbf5a64;};'use strict';var BPromise=require(_0x1d10('0x0'));var server=require('./server');var Realtime=require(_0x1d10('0x1'));var EmailChannel=require(_0x1d10('0x2'));var mailAccount=require(_0x1d10('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x1d10('0x4'))['db'];function initRealtime(){return BPromise[_0x1d10('0x5')]()[_0x1d10('0x6')](mailAccount[_0x1d10('0x7')]())[_0x1d10('0x6')](realtime['initMailAccounts']())[_0x1d10('0x6')](function(){email[_0x1d10('0x8')](realtime[_0x1d10('0x9')]);return realtime;});}function main(){return server[_0x1d10('0xa')](realtime,email)[_0x1d10('0x6')](function(_0x36335e){return initRealtime();})[_0x1d10('0x6')](function(_0x43df2c){return db[_0x1d10('0xb')][_0x1d10('0xc')]({'attributes':['id',_0x1d10('0xd')],'raw':!![]});})[_0x1d10('0x6')](function(_0x1610b4){return setInterval(initRealtime,_0x1610b4[_0x1d10('0xd')]*0x3e8);})[_0x1d10('0xe')](function(_0x5ff1df){console[_0x1d10('0xf')](_0x5ff1df);});}main(); \ No newline at end of file +var _0x2975=['findOne','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','initMailAccounts','then','refresh','mailAccounts','listen','Setting'];(function(_0x1d2c58,_0x455cc5){var _0x28f6f1=function(_0x15c485){while(--_0x15c485){_0x1d2c58['push'](_0x1d2c58['shift']());}};_0x28f6f1(++_0x455cc5);}(_0x2975,0x1c5));var _0x5297=function(_0x5a0892,_0x397edf){_0x5a0892=_0x5a0892-0x0;var _0x47bc44=_0x2975[_0x5a0892];return _0x47bc44;};'use strict';var BPromise=require('bluebird');var server=require(_0x5297('0x0'));var Realtime=require(_0x5297('0x1'));var EmailChannel=require(_0x5297('0x2'));var mailAccount=require(_0x5297('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5297('0x4'))['db'];function initRealtime(){return BPromise[_0x5297('0x5')]()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0x5297('0x6')]())[_0x5297('0x7')](function(){email[_0x5297('0x8')](realtime[_0x5297('0x9')]);return realtime;});}function main(){return server[_0x5297('0xa')](realtime,email)[_0x5297('0x7')](function(_0x1b72a7){return initRealtime();})['then'](function(_0x2c015c){return db[_0x5297('0xb')][_0x5297('0xc')]({'attributes':['id',_0x5297('0xd')],'raw':!![]});})[_0x5297('0x7')](function(_0x4fd97b){return setInterval(initRealtime,_0x4fd97b[_0x5297('0xd')]*0x3e8);})[_0x5297('0xe')](function(_0x1857d5){console['log'](_0x1857d5);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1ee550e..3a8eca1 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 _0x2862=['imapAccounts','smtp','prototype','name','active','Imap','status','isNil','stringify','md5','emit','refresh','hasOwnProperty','email','box','handleImapBox','bind','handleImapEnd','error','handleImapError','messageStatus','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','then','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2862,0xc1));var _0x2286=function(_0x380ffe,_0x557b7b){_0x380ffe=_0x380ffe-0x0;var _0x5075ef=_0x2862[_0x380ffe];return _0x5075ef;};'use strict';var _=require(_0x2286('0x0'));var moment=require(_0x2286('0x1'));var BPromise=require(_0x2286('0x2'));var md5=require('md5');var Redis=require(_0x2286('0x3'));var config=require(_0x2286('0x4'));var logger=require(_0x2286('0x5'))('email');config['redis']=_[_0x2286('0x6')](config[_0x2286('0x7')],{'host':_0x2286('0x8'),'port':0x18eb});var io=require(_0x2286('0x9'))(new Redis(config[_0x2286('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x2286('0xa'));var mailAccount=require(_0x2286('0xb'));var md5Accounts={};function EmailChannel(_0x4a6584){logger[_0x2286('0xc')](_0x2286('0xd'));this[_0x2286('0xe')]=_0x4a6584['mailAccounts'];this[_0x2286('0xf')]={};this[_0x2286('0x10')]=new EmailSmtp();}EmailChannel[_0x2286('0x11')]['emit']=function(_0x4a9c3d){var _0x2b391c=this[_0x2286('0xe')][_0x4a9c3d];var _0x3124a6={'id':_0x2b391c['id'],'name':_0x2b391c[_0x2286('0x12')],'key':_0x2b391c['key'],'active':_0x2b391c[_0x2286('0x13')],'Imap':{'status':_0x2b391c[_0x2286('0x14')][_0x2286('0x15')],'messageStatus':_0x2b391c[_0x2286('0x14')]['messageStatus'],'total':_0x2b391c[_0x2286('0x14')]['total']}};if(_[_0x2286('0x16')](md5Accounts[_0x4a9c3d])){md5Accounts[_0x4a9c3d]={};}var _0x38fab6=md5(JSON[_0x2286('0x17')](_0x3124a6));if(md5Accounts[_0x4a9c3d][_0x2286('0x18')]!==_0x38fab6){md5Accounts[_0x4a9c3d][_0x2286('0x18')]=_0x38fab6;io[_0x2286('0x19')]('mailAccount:update',_0x3124a6);}};EmailChannel['prototype'][_0x2286('0x1a')]=function(_0x9413aa){for(var _0x8a305d in _0x9413aa){if(_0x9413aa[_0x2286('0x1b')](_0x8a305d)){if(_0x9413aa[_0x8a305d][_0x2286('0x14')]&&_0x9413aa[_0x8a305d]['active']){var _0x3a1dbf=_0x9413aa[_0x8a305d]['Imap'];if(!this['imapAccounts'][_0x2286('0x1b')](_0x3a1dbf['id'])){this[_0x2286('0xf')][_0x3a1dbf['id']]=new EmailImap(_0x3a1dbf,_0x9413aa[_0x8a305d][_0x2286('0x1c')]);this[_0x2286('0xf')][_0x3a1dbf['id']]['on'](_0x2286('0x1d'),this[_0x2286('0x1e')]['bind'](this,_0x8a305d));this[_0x2286('0xf')][_0x3a1dbf['id']]['on']('email',this['handleImapEmail'][_0x2286('0x1f')](this,_0x8a305d));this['imapAccounts'][_0x3a1dbf['id']]['on']('end',this[_0x2286('0x20')][_0x2286('0x1f')](this,_0x8a305d));this['imapAccounts'][_0x3a1dbf['id']]['on'](_0x2286('0x21'),this[_0x2286('0x22')][_0x2286('0x1f')](this,_0x8a305d));}}else{if(_[_0x2286('0x16')](this[_0x2286('0xe')][_0x8a305d][_0x2286('0x14')])){this[_0x2286('0xe')][_0x8a305d][_0x2286('0x14')]={};}this[_0x2286('0xe')][_0x8a305d][_0x2286('0x14')][_0x2286('0x15')]='disabled';this['mailAccounts'][_0x8a305d][_0x2286('0x14')][_0x2286('0x23')]='';this[_0x2286('0x19')](_0x8a305d);}}}};EmailChannel[_0x2286('0x11')][_0x2286('0x1e')]=function(_0x316995,_0x5b221c){if(this[_0x2286('0xe')][_0x316995]){this['mailAccounts'][_0x316995][_0x2286('0x14')]['status']=_0x2286('0x24');this[_0x2286('0xe')][_0x316995][_0x2286('0x14')][_0x2286('0x23')]=_0x5b221c[_0x2286('0x12')];if(_0x5b221c[_0x2286('0x25')]){this['mailAccounts'][_0x316995][_0x2286('0x14')][_0x2286('0x26')]=_0x5b221c[_0x2286('0x25')][_0x2286('0x26')];}return this[_0x2286('0x19')](_0x316995);}};EmailChannel[_0x2286('0x11')]['handleImapEmail']=function(_0x33e773,_0x50a921){logger['info'](_0x2286('0x27'),_0x50a921[_0x2286('0x28')],_0x50a921[_0x2286('0x29')],_0x50a921['from'],_0x33e773);if(this[_0x2286('0xe')][_0x33e773]){return mailAccount['notify'](_0x33e773,_0x50a921)['then'](function(_0x264953){if(_0x264953){logger['info'](_0x2286('0x2a'));}})[_0x2286('0x2b')](function(_0x4e890e){logger[_0x2286('0x21')](_0x2286('0x2c'),JSON['stringify'](_0x4e890e));});}};EmailChannel[_0x2286('0x11')][_0x2286('0x20')]=function(_0x165e48){if(this[_0x2286('0xe')][_0x165e48]&&this['mailAccounts'][_0x165e48][_0x2286('0x14')]){if(this[_0x2286('0xf')][this[_0x2286('0xe')][_0x165e48][_0x2286('0x14')]['id']]){delete this[_0x2286('0xf')][this['mailAccounts'][_0x165e48]['Imap']['id']];}this[_0x2286('0xe')][_0x165e48]['Imap'][_0x2286('0x2d')]=moment();this[_0x2286('0x19')](_0x165e48);}};EmailChannel[_0x2286('0x11')][_0x2286('0x22')]=function(_0x1c3495,_0x23d1c2){if(this[_0x2286('0xe')][_0x1c3495]){this[_0x2286('0xe')][_0x1c3495]['Imap'][_0x2286('0x15')]=_0x2286('0x21');this['mailAccounts'][_0x1c3495][_0x2286('0x14')][_0x2286('0x23')]=_0x23d1c2;return this[_0x2286('0x19')](_0x1c3495);}};EmailChannel[_0x2286('0x11')][_0x2286('0x2e')]=function(_0x12a859,_0x1923d1){return this['smtp']['send'](_0x12a859,_0x1923d1);};EmailChannel[_0x2286('0x11')][_0x2286('0x2f')]=function(_0x8399d2){var _0x2e61ca=this;if(this['mailAccounts'][_0x8399d2['id']]){if(_['isNil'](this[_0x2286('0xe')][_0x8399d2['id']][_0x2286('0x30')])){this[_0x2286('0xe')][_0x8399d2['id']]['Smtp']={};}this[_0x2286('0xe')][_0x8399d2['id']][_0x2286('0x30')][_0x2286('0x2d')]=moment();return new BPromise(function(_0x14aed3,_0x1af3ad){return _0x2e61ca['smtp']['verify'](_0x8399d2)[_0x2286('0x31')](function(_0x394577){_0x2e61ca[_0x2286('0xe')][_0x8399d2['id']][_0x2286('0x30')][_0x2286('0x15')]='verified';_0x2e61ca[_0x2286('0xe')][_0x8399d2['id']][_0x2286('0x30')][_0x2286('0x23')]='';_0x2e61ca[_0x2286('0x19')](_0x8399d2['id']);_0x14aed3(_0x394577);})[_0x2286('0x2b')](function(_0x313a72){_0x2e61ca[_0x2286('0xe')][_0x8399d2['id']]['Smtp'][_0x2286('0x15')]=_0x2286('0x21');_0x2e61ca[_0x2286('0xe')][_0x8399d2['id']][_0x2286('0x30')][_0x2286('0x23')]=_0x313a72;_0x2e61ca['emit'](_0x8399d2['id']);_0x1af3ad(_0x313a72);});});}return this[_0x2286('0x10')][_0x2286('0x32')](_0x8399d2);};module[_0x2286('0x33')]=EmailChannel; \ No newline at end of file +var _0xc604=['refresh','hasOwnProperty','box','handleImapBox','bind','end','handleImapError','disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','error','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update'];(function(_0x4da09a,_0x254cbe){var _0xdb67e0=function(_0x5d18d4){while(--_0x5d18d4){_0x4da09a['push'](_0x4da09a['shift']());}};_0xdb67e0(++_0x254cbe);}(_0xc604,0xbe));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c60('0x0'));var moment=require(_0x4c60('0x1'));var BPromise=require('bluebird');var md5=require(_0x4c60('0x2'));var Redis=require('ioredis');var config=require(_0x4c60('0x3'));var logger=require(_0x4c60('0x4'))(_0x4c60('0x5'));config[_0x4c60('0x6')]=_['defaults'](config['redis'],{'host':_0x4c60('0x7'),'port':0x18eb});var io=require(_0x4c60('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x4c60('0x9'));var mailAccount=require(_0x4c60('0xa'));var md5Accounts={};function EmailChannel(_0x532c6f){logger[_0x4c60('0xb')](_0x4c60('0xc'));this[_0x4c60('0xd')]=_0x532c6f['mailAccounts'];this[_0x4c60('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4c60('0xf')][_0x4c60('0x10')]=function(_0xeb167d){var _0x2b00de=this[_0x4c60('0xd')][_0xeb167d];var _0x14d7db={'id':_0x2b00de['id'],'name':_0x2b00de['name'],'key':_0x2b00de[_0x4c60('0x11')],'active':_0x2b00de[_0x4c60('0x12')],'Imap':{'status':_0x2b00de[_0x4c60('0x13')][_0x4c60('0x14')],'messageStatus':_0x2b00de[_0x4c60('0x13')][_0x4c60('0x15')],'total':_0x2b00de[_0x4c60('0x13')][_0x4c60('0x16')]}};if(_[_0x4c60('0x17')](md5Accounts[_0xeb167d])){md5Accounts[_0xeb167d]={};}var _0x215056=md5(JSON[_0x4c60('0x18')](_0x14d7db));if(md5Accounts[_0xeb167d][_0x4c60('0x2')]!==_0x215056){md5Accounts[_0xeb167d][_0x4c60('0x2')]=_0x215056;io[_0x4c60('0x10')](_0x4c60('0x19'),_0x14d7db);}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x1a')]=function(_0xadd14d){for(var _0x335959 in _0xadd14d){if(_0xadd14d[_0x4c60('0x1b')](_0x335959)){if(_0xadd14d[_0x335959]['Imap']&&_0xadd14d[_0x335959][_0x4c60('0x12')]){var _0x505975=_0xadd14d[_0x335959]['Imap'];if(!this[_0x4c60('0xe')][_0x4c60('0x1b')](_0x505975['id'])){this[_0x4c60('0xe')][_0x505975['id']]=new EmailImap(_0x505975,_0xadd14d[_0x335959][_0x4c60('0x5')]);this[_0x4c60('0xe')][_0x505975['id']]['on'](_0x4c60('0x1c'),this[_0x4c60('0x1d')][_0x4c60('0x1e')](this,_0x335959));this['imapAccounts'][_0x505975['id']]['on'](_0x4c60('0x5'),this['handleImapEmail']['bind'](this,_0x335959));this[_0x4c60('0xe')][_0x505975['id']]['on'](_0x4c60('0x1f'),this['handleImapEnd']['bind'](this,_0x335959));this['imapAccounts'][_0x505975['id']]['on']('error',this[_0x4c60('0x20')]['bind'](this,_0x335959));}}else{if(_[_0x4c60('0x17')](this[_0x4c60('0xd')][_0x335959][_0x4c60('0x13')])){this[_0x4c60('0xd')][_0x335959]['Imap']={};}this['mailAccounts'][_0x335959][_0x4c60('0x13')]['status']=_0x4c60('0x21');this[_0x4c60('0xd')][_0x335959][_0x4c60('0x13')][_0x4c60('0x15')]='';this[_0x4c60('0x10')](_0x335959);}}}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x1d')]=function(_0x26910b,_0x4fc252){if(this[_0x4c60('0xd')][_0x26910b]){this[_0x4c60('0xd')][_0x26910b]['Imap'][_0x4c60('0x14')]=_0x4c60('0x22');this[_0x4c60('0xd')][_0x26910b][_0x4c60('0x13')][_0x4c60('0x15')]=_0x4fc252[_0x4c60('0x23')];if(_0x4fc252[_0x4c60('0x24')]){this[_0x4c60('0xd')][_0x26910b]['Imap'][_0x4c60('0x16')]=_0x4fc252[_0x4c60('0x24')][_0x4c60('0x16')];}return this[_0x4c60('0x10')](_0x26910b);}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x25')]=function(_0x101476,_0x471a29){logger[_0x4c60('0xb')](_0x4c60('0x26'),_0x471a29[_0x4c60('0x27')],_0x471a29['lastName'],_0x471a29['from'],_0x101476);if(this['mailAccounts'][_0x101476]){return mailAccount['notify'](_0x101476,_0x471a29)[_0x4c60('0x28')](function(_0x275d00){if(_0x275d00){logger[_0x4c60('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x4c60('0x29')](function(_0x347fcf){logger['error'](_0x4c60('0x2a'),JSON['stringify'](_0x347fcf));});}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x2b')]=function(_0x3579d4){if(this[_0x4c60('0xd')][_0x3579d4]&&this['mailAccounts'][_0x3579d4][_0x4c60('0x13')]){if(this[_0x4c60('0xe')][this[_0x4c60('0xd')][_0x3579d4][_0x4c60('0x13')]['id']]){delete this[_0x4c60('0xe')][this[_0x4c60('0xd')][_0x3579d4][_0x4c60('0x13')]['id']];}this['mailAccounts'][_0x3579d4][_0x4c60('0x13')]['lastSync']=moment();this[_0x4c60('0x10')](_0x3579d4);}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x20')]=function(_0x367036,_0x36ced9){if(this['mailAccounts'][_0x367036]){this[_0x4c60('0xd')][_0x367036]['Imap'][_0x4c60('0x14')]=_0x4c60('0x2c');this[_0x4c60('0xd')][_0x367036][_0x4c60('0x13')][_0x4c60('0x15')]=_0x36ced9;return this[_0x4c60('0x10')](_0x367036);}};EmailChannel[_0x4c60('0xf')][_0x4c60('0x2d')]=function(_0xd51ff9,_0x1f67ba){return this[_0x4c60('0x2e')][_0x4c60('0x2f')](_0xd51ff9,_0x1f67ba);};EmailChannel[_0x4c60('0xf')][_0x4c60('0x30')]=function(_0x4b9657){var _0x34fd1e=this;if(this['mailAccounts'][_0x4b9657['id']]){if(_[_0x4c60('0x17')](this[_0x4c60('0xd')][_0x4b9657['id']]['Smtp'])){this['mailAccounts'][_0x4b9657['id']][_0x4c60('0x31')]={};}this[_0x4c60('0xd')][_0x4b9657['id']]['Smtp'][_0x4c60('0x32')]=moment();return new BPromise(function(_0x25ba94,_0x3003e1){return _0x34fd1e['smtp'][_0x4c60('0x33')](_0x4b9657)['then'](function(_0x1957d5){_0x34fd1e[_0x4c60('0xd')][_0x4b9657['id']][_0x4c60('0x31')]['status']=_0x4c60('0x34');_0x34fd1e[_0x4c60('0xd')][_0x4b9657['id']][_0x4c60('0x31')][_0x4c60('0x15')]='';_0x34fd1e[_0x4c60('0x10')](_0x4b9657['id']);_0x25ba94(_0x1957d5);})[_0x4c60('0x29')](function(_0x3f173a){_0x34fd1e[_0x4c60('0xd')][_0x4b9657['id']][_0x4c60('0x31')][_0x4c60('0x14')]=_0x4c60('0x2c');_0x34fd1e['mailAccounts'][_0x4b9657['id']]['Smtp'][_0x4c60('0x15')]=_0x3f173a;_0x34fd1e['emit'](_0x4b9657['id']);_0x3003e1(_0x3f173a);});});}return this[_0x4c60('0x2e')][_0x4c60('0x33')](_0x4b9657);};module[_0x4c60('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b044ae2..09b8080 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 _0xd8c0=['mailparser','simpleParser','Iconv','EventEmitter','./utils','email','mailbox','INBOX','account','once','ready','handleReady','end','handleEnd','handleError','bind','prototype','connTimeout','authTimeout','service','user','password','host','tls','autotls','required','getHost','port','anonymous@xcally.com','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','exports','util','imap','lodash'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0xd8c0,0x147));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0d8c('0x0'));var Imap=require(_0x0d8c('0x1'));var _=require(_0x0d8c('0x2'));var rs=require('randomstring');var simpleParser=require(_0x0d8c('0x3'))[_0x0d8c('0x4')];var Iconv=require('iconv')[_0x0d8c('0x5')];var EventEmitter=require('events')[_0x0d8c('0x6')];var utils=require(_0x0d8c('0x7'));var logger=require('../../../config/logger')(_0x0d8c('0x8'));function EmailImap(_0x1366a5,_0x4a2136){this[_0x0d8c('0x9')]=_0x0d8c('0xa');this[_0x0d8c('0xb')]=this['getAccount'](_0x1366a5,_0x4a2136);this[_0x0d8c('0x1')]=new Imap(this[_0x0d8c('0xb')]);this[_0x0d8c('0x1')][_0x0d8c('0xc')](_0x0d8c('0xd'),this[_0x0d8c('0xe')]['bind'](this));this[_0x0d8c('0x1')][_0x0d8c('0xc')](_0x0d8c('0xf'),this[_0x0d8c('0x10')]['bind'](this));this[_0x0d8c('0x1')]['on']('error',this[_0x0d8c('0x11')][_0x0d8c('0x12')](this));this[_0x0d8c('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x0d8c('0x13')]['getAccount']=function(_0x56919a,_0x22373b){var _0x58c5df={'connTimeout':_0x56919a[_0x0d8c('0x14')]?_0x56919a[_0x0d8c('0x14')]*0x3e8:0x2710,'authTimeout':_0x56919a[_0x0d8c('0x15')]?_0x56919a[_0x0d8c('0x15')]*0x3e8:0x1388};if(_['isNil'](_0x56919a[_0x0d8c('0x16')])){if(_0x56919a['authentication']){_0x58c5df['user']=_0x56919a[_0x0d8c('0x17')];_0x58c5df[_0x0d8c('0x18')]=_0x56919a[_0x0d8c('0x18')];}_0x58c5df[_0x0d8c('0x19')]=_0x56919a[_0x0d8c('0x19')];_0x58c5df['port']=_0x56919a['port']||0x3e1;if(_0x56919a[_0x0d8c('0x1a')]){_0x58c5df['tls']=!![];}else{_0x58c5df['tls']=![];_0x58c5df[_0x0d8c('0x1b')]=_0x0d8c('0x1c');}}else{_0x58c5df['user']=_0x56919a['user'];_0x58c5df[_0x0d8c('0x18')]=_0x56919a[_0x0d8c('0x18')];_0x58c5df[_0x0d8c('0x19')]=utils[_0x0d8c('0x1d')](_0x56919a[_0x0d8c('0x16')]);_0x58c5df[_0x0d8c('0x1e')]=0x3e1;_0x58c5df[_0x0d8c('0x1a')]=!![];}_0x58c5df[_0x0d8c('0x8')]=_0x22373b||_0x56919a[_0x0d8c('0x17')]||_0x0d8c('0x1f');return _0x58c5df;};EmailImap[_0x0d8c('0x13')][_0x0d8c('0xe')]=function(){this[_0x0d8c('0x1')]['openBox'](this['mailbox'],![],this[_0x0d8c('0x20')]['bind'](this));};EmailImap[_0x0d8c('0x13')]['handleOpenBox']=function(_0x7b4d96,_0x4f0575){if(_0x7b4d96){this[_0x0d8c('0x11')](_0x7b4d96,!![]);}else{this[_0x0d8c('0x21')]('box',_0x4f0575);this[_0x0d8c('0x22')]();}};EmailImap['prototype'][_0x0d8c('0x23')]=function(_0x573b79){if(_0x573b79){this[_0x0d8c('0x11')](_0x573b79,!![]);}else{this[_0x0d8c('0x1')][_0x0d8c('0xf')]();}};EmailImap[_0x0d8c('0x13')]['readUnseen']=function(){this[_0x0d8c('0x1')][_0x0d8c('0x24')](['UNSEEN'],this['handleReadUnseen'][_0x0d8c('0x12')](this));};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x25')]=function(_0x55e70a,_0x10200e){if(_0x55e70a){this[_0x0d8c('0x11')](_0x55e70a,!![]);}else{if(_0x10200e[_0x0d8c('0x26')]){try{var _0x7cb51b=this[_0x0d8c('0x1')][_0x0d8c('0x27')](_0x10200e,{'bodies':'','markSeen':!![]});_0x7cb51b['on']('message',this[_0x0d8c('0x28')][_0x0d8c('0x12')](this));_0x7cb51b[_0x0d8c('0xc')]('error',this[_0x0d8c('0x29')]['bind'](this));_0x7cb51b[_0x0d8c('0xc')]('end',this[_0x0d8c('0x2a')][_0x0d8c('0x12')](this));}catch(_0x353000){logger[_0x0d8c('0x2b')](_0x353000);}}else{this[_0x0d8c('0x1')][_0x0d8c('0x2c')](!![],this['handleCloseBox'][_0x0d8c('0x12')](this));}}};EmailImap[_0x0d8c('0x13')]['handleFetchMessage']=function(_0x1beb36,_0x1fdb02){_0x1beb36['on'](_0x0d8c('0x2d'),this[_0x0d8c('0x2e')]['bind'](this));_0x1beb36[_0x0d8c('0xc')]('attributes',this['handleMessageAttributes'][_0x0d8c('0x12')](this));_0x1beb36[_0x0d8c('0xc')](_0x0d8c('0xf'),this[_0x0d8c('0x2f')][_0x0d8c('0x12')](this));};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x2e')]=function(_0x568ece,_0x2f4c38){simpleParser(_0x568ece,{'Iconv':Iconv},this[_0x0d8c('0x30')][_0x0d8c('0x12')](this));};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x31')]=function(_0x3ab99a){};EmailImap[_0x0d8c('0x13')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x0d8c('0x30')]=function(_0x157411,_0x4356ab){if(_0x157411){logger[_0x0d8c('0x2b')](_0x157411);}else{var _0x18e465=this;utils[_0x0d8c('0x32')](this[_0x0d8c('0xb')],_0x4356ab,function(_0x4fdfa4){_0x18e465[_0x0d8c('0x21')](_0x0d8c('0x8'),_0x4fdfa4);});}};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x2a')]=function(){this[_0x0d8c('0x1')][_0x0d8c('0x2c')](!![],this[_0x0d8c('0x23')][_0x0d8c('0x12')](this));};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x29')]=function(_0x3aa90d){this[_0x0d8c('0x11')](_0x3aa90d);this['imap'][_0x0d8c('0x2c')](!![],this[_0x0d8c('0x23')][_0x0d8c('0x12')](this));};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x10')]=function(){this[_0x0d8c('0x21')]('end');};EmailImap[_0x0d8c('0x13')][_0x0d8c('0x11')]=function(_0x4fe51a,_0x3c44c2){logger[_0x0d8c('0x2b')]('handleError',this[_0x0d8c('0xb')][_0x0d8c('0x8')],JSON[_0x0d8c('0x33')](_0x4fe51a));var _0x2cef29='';if(_0x4fe51a){if(_0x4fe51a[_0x0d8c('0x34')]){_0x2cef29=_0x4fe51a[_0x0d8c('0x34')];}else{for(var _0x3830cf in _0x4fe51a){if(_0x4fe51a[_0x0d8c('0x35')](_0x3830cf)){_0x2cef29+=_['upperFirst'](_0x3830cf)+':\x20'+_0x4fe51a[_0x3830cf]+'\x0a';}}}}if(_0x3c44c2){this[_0x0d8c('0x1')]['end']();}else{this[_0x0d8c('0x21')](_0x0d8c('0x2b'),_0x2cef29);this['emit'](_0x0d8c('0xf'));}};module[_0x0d8c('0x36')]=EmailImap; \ No newline at end of file +var _0x2094=['bind','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','handleReady','openBox','mailbox','handleOpenBox','prototype','emit','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageAttributes','handleMessageBody','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','randomstring','mailparser','Iconv','EventEmitter','./utils','../../../config/logger','email','account','getAccount','ready','once','end','handleEnd'];(function(_0x31e3b5,_0xea88f8){var _0xe51502=function(_0x5c70c9){while(--_0x5c70c9){_0x31e3b5['push'](_0x31e3b5['shift']());}};_0xe51502(++_0xea88f8);}(_0x2094,0x180));var _0x4209=function(_0x1b1746,_0x2ad0f4){_0x1b1746=_0x1b1746-0x0;var _0x340e28=_0x2094[_0x1b1746];return _0x340e28;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4209('0x0'));var Imap=require(_0x4209('0x1'));var _=require('lodash');var rs=require(_0x4209('0x2'));var simpleParser=require(_0x4209('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x4209('0x4')];var EventEmitter=require('events')[_0x4209('0x5')];var utils=require(_0x4209('0x6'));var logger=require(_0x4209('0x7'))(_0x4209('0x8'));function EmailImap(_0x26307f,_0x4c7dc4){this['mailbox']='INBOX';this[_0x4209('0x9')]=this[_0x4209('0xa')](_0x26307f,_0x4c7dc4);this[_0x4209('0x1')]=new Imap(this[_0x4209('0x9')]);this[_0x4209('0x1')]['once'](_0x4209('0xb'),this['handleReady']['bind'](this));this[_0x4209('0x1')][_0x4209('0xc')](_0x4209('0xd'),this[_0x4209('0xe')][_0x4209('0xf')](this));this['imap']['on'](_0x4209('0x10'),this[_0x4209('0x11')][_0x4209('0xf')](this));this[_0x4209('0x1')][_0x4209('0x12')]();}util[_0x4209('0x13')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x545597,_0x5d60c){var _0x39736a={'connTimeout':_0x545597[_0x4209('0x14')]?_0x545597[_0x4209('0x14')]*0x3e8:0x2710,'authTimeout':_0x545597[_0x4209('0x15')]?_0x545597[_0x4209('0x15')]*0x3e8:0x1388};if(_[_0x4209('0x16')](_0x545597[_0x4209('0x17')])){if(_0x545597['authentication']){_0x39736a[_0x4209('0x18')]=_0x545597[_0x4209('0x18')];_0x39736a[_0x4209('0x19')]=_0x545597['password'];}_0x39736a['host']=_0x545597[_0x4209('0x1a')];_0x39736a[_0x4209('0x1b')]=_0x545597['port']||0x3e1;if(_0x545597[_0x4209('0x1c')]){_0x39736a[_0x4209('0x1c')]=!![];}else{_0x39736a[_0x4209('0x1c')]=![];_0x39736a[_0x4209('0x1d')]=_0x4209('0x1e');}}else{_0x39736a['user']=_0x545597[_0x4209('0x18')];_0x39736a[_0x4209('0x19')]=_0x545597[_0x4209('0x19')];_0x39736a[_0x4209('0x1a')]=utils[_0x4209('0x1f')](_0x545597[_0x4209('0x17')]);_0x39736a[_0x4209('0x1b')]=0x3e1;_0x39736a[_0x4209('0x1c')]=!![];}_0x39736a[_0x4209('0x8')]=_0x5d60c||_0x545597[_0x4209('0x18')]||'anonymous@xcally.com';return _0x39736a;};EmailImap['prototype'][_0x4209('0x20')]=function(){this[_0x4209('0x1')][_0x4209('0x21')](this[_0x4209('0x22')],![],this[_0x4209('0x23')][_0x4209('0xf')](this));};EmailImap[_0x4209('0x24')][_0x4209('0x23')]=function(_0x52f7e2,_0x5eac9a){if(_0x52f7e2){this[_0x4209('0x11')](_0x52f7e2,!![]);}else{this[_0x4209('0x25')]('box',_0x5eac9a);this['readUnseen']();}};EmailImap[_0x4209('0x24')]['handleCloseBox']=function(_0x1f3219){if(_0x1f3219){this[_0x4209('0x11')](_0x1f3219,!![]);}else{this[_0x4209('0x1')][_0x4209('0xd')]();}};EmailImap[_0x4209('0x24')]['readUnseen']=function(){this[_0x4209('0x1')][_0x4209('0x26')]([_0x4209('0x27')],this[_0x4209('0x28')][_0x4209('0xf')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x3e8158,_0x1d12e3){if(_0x3e8158){this[_0x4209('0x11')](_0x3e8158,!![]);}else{if(_0x1d12e3['length']){try{var _0x339f68=this[_0x4209('0x1')][_0x4209('0x29')](_0x1d12e3,{'bodies':'','markSeen':!![]});_0x339f68['on'](_0x4209('0x2a'),this[_0x4209('0x2b')][_0x4209('0xf')](this));_0x339f68[_0x4209('0xc')]('error',this[_0x4209('0x2c')]['bind'](this));_0x339f68[_0x4209('0xc')](_0x4209('0xd'),this[_0x4209('0x2d')][_0x4209('0xf')](this));}catch(_0x4d7b8b){logger['error'](_0x4d7b8b);}}else{this[_0x4209('0x1')][_0x4209('0x2e')](!![],this[_0x4209('0x2f')][_0x4209('0xf')](this));}}};EmailImap[_0x4209('0x24')][_0x4209('0x2b')]=function(_0x3a8afe,_0x2ca622){_0x3a8afe['on'](_0x4209('0x30'),this['handleMessageBody'][_0x4209('0xf')](this));_0x3a8afe[_0x4209('0xc')]('attributes',this[_0x4209('0x31')][_0x4209('0xf')](this));_0x3a8afe[_0x4209('0xc')]('end',this['handleMessageEnd'][_0x4209('0xf')](this));};EmailImap[_0x4209('0x24')][_0x4209('0x32')]=function(_0x108682,_0x2d6325){simpleParser(_0x108682,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x4209('0x31')]=function(_0x48445a){};EmailImap[_0x4209('0x24')]['handleMessageEnd']=function(){};EmailImap[_0x4209('0x24')][_0x4209('0x33')]=function(_0x34fb51,_0x712fac){if(_0x34fb51){logger[_0x4209('0x10')](_0x34fb51);}else{var _0x1c20b7=this;utils['parser'](this[_0x4209('0x9')],_0x712fac,function(_0x79f7c2){_0x1c20b7[_0x4209('0x25')](_0x4209('0x8'),_0x79f7c2);});}};EmailImap[_0x4209('0x24')][_0x4209('0x2d')]=function(){this[_0x4209('0x1')][_0x4209('0x2e')](!![],this[_0x4209('0x2f')]['bind'](this));};EmailImap[_0x4209('0x24')][_0x4209('0x2c')]=function(_0x1afea8){this['handleError'](_0x1afea8);this['imap'][_0x4209('0x2e')](!![],this[_0x4209('0x2f')][_0x4209('0xf')](this));};EmailImap[_0x4209('0x24')][_0x4209('0xe')]=function(){this['emit']('end');};EmailImap[_0x4209('0x24')][_0x4209('0x11')]=function(_0x2606dd,_0x3ebdbc){logger[_0x4209('0x10')](_0x4209('0x11'),this[_0x4209('0x9')][_0x4209('0x8')],JSON[_0x4209('0x34')](_0x2606dd));var _0xad0729='';if(_0x2606dd){if(_0x2606dd[_0x4209('0x35')]){_0xad0729=_0x2606dd[_0x4209('0x35')];}else{for(var _0x2bf31e in _0x2606dd){if(_0x2606dd[_0x4209('0x36')](_0x2bf31e)){_0xad0729+=_[_0x4209('0x37')](_0x2bf31e)+':\x20'+_0x2606dd[_0x2bf31e]+'\x0a';}}}}if(_0x3ebdbc){this['imap'][_0x4209('0xd')]();}else{this[_0x4209('0x25')]('error',_0xad0729);this['emit'](_0x4209('0xd'));}};module[_0x4209('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 888806a..29b6614 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 _0xc5f0=['Not\x20verifired','exports','nodemailer','prototype','send','createTransport','sendMail','toString','verify'];(function(_0x14f7b6,_0x57455d){var _0xbc99ef=function(_0xb01de3){while(--_0xb01de3){_0x14f7b6['push'](_0x14f7b6['shift']());}};_0xbc99ef(++_0x57455d);}(_0xc5f0,0x134));var _0x0c5f=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0xc5f0[_0x5dfc2a];return _0x3f1a71;};'use strict';var nodemailer=require(_0x0c5f('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x0c5f('0x1')][_0x0c5f('0x2')]=function(_0x1215df,_0x4662de){return new BPromise(function(_0x39a9df,_0xab97cd){var _0x17e787=nodemailer[_0x0c5f('0x3')](_0x1215df);_0x17e787['use']('compile',inlineBase64());_0x17e787[_0x0c5f('0x4')](_0x4662de,function(_0x13ad3a,_0x7dedba){if(_0x13ad3a){_0xab97cd(_0x13ad3a[_0x0c5f('0x5')]());}else{_0x39a9df(_0x7dedba);}});});};EmailSmtp['prototype'][_0x0c5f('0x6')]=function(_0xf11cf8){return new BPromise(function(_0x402e0c,_0x593344){var _0x14aa37=nodemailer['createTransport'](_0xf11cf8);_0x14aa37[_0x0c5f('0x6')](function(_0x24b1d2,_0x359ef6){if(_0x24b1d2){_0x593344(_0x24b1d2[_0x0c5f('0x5')]());}else{if(_0x359ef6){_0x402e0c(_0x359ef6);}else{_0x593344(_0x0c5f('0x7'));}}});});};module[_0x0c5f('0x8')]=EmailSmtp; \ No newline at end of file +var _0x9928=['compile','toString','nodemailer','prototype','send'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9928,0x1dd));var _0x8992=function(_0x1bd411,_0x2b2ca2){_0x1bd411=_0x1bd411-0x0;var _0x5dcc9f=_0x9928[_0x1bd411];return _0x5dcc9f;};'use strict';var nodemailer=require(_0x8992('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x8992('0x1')][_0x8992('0x2')]=function(_0x1a538b,_0x246141){return new BPromise(function(_0x2e8923,_0x36c6d8){var _0x36df82=nodemailer['createTransport'](_0x1a538b);_0x36df82['use'](_0x8992('0x3'),inlineBase64());_0x36df82['sendMail'](_0x246141,function(_0x1753d1,_0x45788b){if(_0x1753d1){_0x36c6d8(_0x1753d1['toString']());}else{_0x2e8923(_0x45788b);}});});};EmailSmtp['prototype']['verify']=function(_0x4c6a38){return new BPromise(function(_0x3751c2,_0x3ddcb7){var _0x5e845e=nodemailer['createTransport'](_0x4c6a38);_0x5e845e['verify'](function(_0x1bbd62,_0x3d8109){if(_0x1bbd62){_0x3ddcb7(_0x1bbd62[_0x8992('0x4')]());}else{if(_0x3d8109){_0x3751c2(_0x3d8109);}else{_0x3ddcb7('Not\x20verifired');}}});});};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 d68c2ed..d35e485 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 _0x87f9=['format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','push','Title','

Empty\x20message

','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','pop','html','test','replace','body','textAsHtml','0x1?_0x4bc08a[_0x987f('0x12')]():'';}return'';}function getMails(_0xcac1c,_0x4c49f9){var _0x3f8371='';for(var _0x1e248f=0x0;_0x1e248f<_0x4c49f9[_0x987f('0x8')]['length'];_0x1e248f+=0x1){if(_0x4c49f9['value'][_0x1e248f]['address']!==_0xcac1c){if(!_['isEmpty'](_0x3f8371)){_0x3f8371+=',';}_0x3f8371+=_0x4c49f9[_0x987f('0x8')][_0x1e248f][_0x987f('0xd')]||_0x4c49f9[_0x987f('0x8')][_0x1e248f][_0x987f('0x9')]||'';_0x3f8371+='\x20<';_0x3f8371+=_0x4c49f9['value'][_0x1e248f][_0x987f('0x9')]?_0x4c49f9[_0x987f('0x8')][_0x1e248f]['address']:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x3f8371+='>';}}return _0x3f8371;}function parseEmail(_0x533022,_0x1d72a1,_0x5b29aa){if(_0x1d72a1[_0x987f('0x13')]){var _0x366d75=/)<[^<]*)*<\/script>/gi;while(_0x366d75[_0x987f('0x14')](_0x1d72a1[_0x987f('0x13')])){_0x1d72a1[_0x987f('0x13')]=_0x1d72a1[_0x987f('0x13')][_0x987f('0x15')](_0x366d75,'');}_0x5b29aa[_0x987f('0x16')]=_0x1d72a1[_0x987f('0x13')];}else{_0x5b29aa[_0x987f('0x16')]=_0x1d72a1[_0x987f('0x17')];}if(_0x5b29aa[_0x987f('0x16')]){_0x5b29aa[_0x987f('0x16')]=_0x5b29aa[_0x987f('0x16')]['replace'](/Empty\x20message

';if(_0xaedf26[_0x987f('0x36')]){for(var _0x5bcd1a=0x0;_0x5bcd1a<_0xaedf26[_0x987f('0x36')]['length'];_0x5bcd1a++){var _0x13d0d0=_0xaedf26[_0x987f('0x36')][_0x5bcd1a];_0x42944e[_0x987f('0x19')][_0x987f('0x20')][_0x987f('0x37')]({'filename':_0x13d0d0[_0x987f('0x38')],'content':new Buffer(_0x13d0d0['Data'])});}}}_0x4933c8(parseEmail(_0x3b9b9a,_0x87857d,_0x42944e));});}else{_0x87857d[_0x987f('0x13')]=_0x987f('0x39');_0x4933c8(parseEmail(_0x3b9b9a,_0x87857d,_0x42944e));}}else{_0x4933c8(parseEmail(_0x3b9b9a,_0x87857d,_0x42944e));}};exports['getHost']=function(_0x114c94){switch(_0x114c94){case _0x987f('0x3a'):return _0x987f('0x3b');case'yahoo':return _0x987f('0x3c');case _0x987f('0x3d'):return _0x987f('0x3e');case _0x987f('0x3f'):return _0x987f('0x40');}return _0x987f('0x41');}; \ No newline at end of file +var _0x2ec7=['generate','@xcally.com','name','split','length','join','Anonymous','pop','isEmpty','html','test','body','textAsHtml','replace','Empty\x20message

','Attachments','Title','Data','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous'];(function(_0x5cf3a7,_0x3b44ae){var _0x11a06d=function(_0x34df9b){while(--_0x34df9b){_0x5cf3a7['push'](_0x5cf3a7['shift']());}};_0x11a06d(++_0x3b44ae);}(_0x2ec7,0x15c));var _0x72ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2ec7[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var moment=require(_0x72ec('0x0'));var random=require(_0x72ec('0x1'));var fs=require('fs');var path=require(_0x72ec('0x2'));var util=require(_0x72ec('0x3'));var tnef=require(_0x72ec('0x4'));var logger=require(_0x72ec('0x5'))(_0x72ec('0x6'));var config=require(_0x72ec('0x7'));function getAddress(_0xb5a3a0){var _0x5133a6=_[_0x72ec('0x8')](_0xb5a3a0[_0x72ec('0x9')]);return _0x5133a6&&_0x5133a6[_0x72ec('0xa')]?_0x5133a6[_0x72ec('0xa')]:_0x72ec('0xb')+random[_0x72ec('0xc')](0x6)+_0x72ec('0xd');}function getFirstName(_0xdf4373){var _0x242c0=_[_0x72ec('0x8')](_0xdf4373[_0x72ec('0x9')]);if(_0x242c0&&_0x242c0[_0x72ec('0xe')]){var _0x272332=_0x242c0[_0x72ec('0xe')][_0x72ec('0xf')](/\s+/);return _0x272332[_0x72ec('0x10')]?_0x272332['slice'](0x0,-0x1)[_0x72ec('0x11')]('\x20'):_0x242c0[_0x72ec('0xe')];}return _0x72ec('0x12');}function getLastName(_0x1bc42a){var _0xa8352d=_['head'](_0x1bc42a[_0x72ec('0x9')]);if(_0xa8352d&&_0xa8352d['name']){var _0x759d9d=_0xa8352d[_0x72ec('0xe')][_0x72ec('0xf')](/\s+/);return _0x759d9d['length']>0x1?_0x759d9d[_0x72ec('0x13')]():'';}return'';}function getMails(_0x4b7f6d,_0x1dafab){var _0x453ba5='';for(var _0x355be7=0x0;_0x355be7<_0x1dafab['value'][_0x72ec('0x10')];_0x355be7+=0x1){if(_0x1dafab['value'][_0x355be7][_0x72ec('0xa')]!==_0x4b7f6d){if(!_[_0x72ec('0x14')](_0x453ba5)){_0x453ba5+=',';}_0x453ba5+=_0x1dafab[_0x72ec('0x9')][_0x355be7]['name']||_0x1dafab[_0x72ec('0x9')][_0x355be7][_0x72ec('0xa')]||'';_0x453ba5+='\x20<';_0x453ba5+=_0x1dafab[_0x72ec('0x9')][_0x355be7][_0x72ec('0xa')]?_0x1dafab[_0x72ec('0x9')][_0x355be7][_0x72ec('0xa')]:_0x72ec('0xb')+random[_0x72ec('0xc')](0x6)+_0x72ec('0xd');_0x453ba5+='>';}}return _0x453ba5;}function parseEmail(_0x583288,_0x19e356,_0x51e716){if(_0x19e356[_0x72ec('0x15')]){var _0x84b8f3=/)<[^<]*)*<\/script>/gi;while(_0x84b8f3[_0x72ec('0x16')](_0x19e356[_0x72ec('0x15')])){_0x19e356[_0x72ec('0x15')]=_0x19e356[_0x72ec('0x15')]['replace'](_0x84b8f3,'');}_0x51e716[_0x72ec('0x17')]=_0x19e356[_0x72ec('0x15')];}else{_0x51e716[_0x72ec('0x17')]=_0x19e356[_0x72ec('0x18')];}if(_0x51e716[_0x72ec('0x17')]){_0x51e716[_0x72ec('0x17')]=_0x51e716[_0x72ec('0x17')][_0x72ec('0x19')](/0x0){if(this[_0x28957d+_0xdf6e('0x22')]>0x0&&this[_0x28957d+'CurrentCapacity']>=this[_0x28957d+_0xdf6e('0x22')]){return _0xdf6e('0x23');}else{return'working';}}else{return _0xdf6e('0x24');}};Agent[_0xdf6e('0x20')][_0xdf6e('0x25')]=function(){var _0x44caed=['mail','chat',_0xdf6e('0x26'),'fax',_0xdf6e('0x27'),_0xdf6e('0x28')];for(var _0x70ef58=0x0;_0x70ef58<_0x44caed[_0xdf6e('0x29')];_0x70ef58+=0x1){var _0x5d4897=this[_0xdf6e('0x21')](_0x44caed[_0x70ef58]);if(this[_0x44caed[_0x70ef58]+_0xdf6e('0x2a')]!==_0x5d4897){this[_0x44caed[_0x70ef58]+_0xdf6e('0x2b')]=_['toNumber'](moment()[_0xdf6e('0x2c')]('x'));}this[_0x44caed[_0x70ef58]+_0xdf6e('0x2a')]=_0x5d4897;}var _0x2d198d={'id':this['id'],'name':this[_0xdf6e('0x5')],'online':this['online'],'voicePause':this[_0xdf6e('0x7')],'chatPause':this[_0xdf6e('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0xdf6e('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xdf6e('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xdf6e('0x2d')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xdf6e('0x2e')],'mailStatus':this[_0xdf6e('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xdf6e('0x11')],'mailCurrentCapacity':this[_0xdf6e('0x12')],'faxStatus':this[_0xdf6e('0x2f')],'faxStatusTime':this[_0xdf6e('0x30')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xdf6e('0x14')],'smsStatus':this[_0xdf6e('0x15')],'smsStatusTime':this[_0xdf6e('0x16')],'smsCapacity':this[_0xdf6e('0x17')],'smsCurrentCapacity':this[_0xdf6e('0x18')],'whatsappStatus':this[_0xdf6e('0x31')],'whatsappStatusTime':this[_0xdf6e('0x19')],'whatsappCapacity':this[_0xdf6e('0x32')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xdf6e('0x33')],'openchannelCapacity':this[_0xdf6e('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xdf6e('0x1f')]};var _0x4038e5=md5(JSON[_0xdf6e('0x34')](_0x2d198d));if(this[_0xdf6e('0x1')]!==_0x4038e5){this[_0xdf6e('0x1')]=_0x4038e5;io[_0xdf6e('0x35')](_0xdf6e('0x36'),_0x2d198d);}};module[_0xdf6e('0x37')]=Agent; \ No newline at end of file +var _0x81cb=['mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatusTime','smsStatus','whatsappCurrentCapacity','busyQueue','stringify','emit','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb81c('0x0'));var moment=require(_0xb81c('0x1'));var md5=require('md5');var Redis=require(_0xb81c('0x2'));var config=require(_0xb81c('0x3'));config['redis']=_[_0xb81c('0x4')](config[_0xb81c('0x5')],{'host':_0xb81c('0x6'),'port':0x18eb});var io=require(_0xb81c('0x7'))(new Redis(config['redis']));function Agent(_0x4533ba){this['id']=_0x4533ba['id']||0x0;this['name']=_0x4533ba['name']||'';this[_0xb81c('0x8')]=_0x4533ba[_0xb81c('0x8')]||!![];this[_0xb81c('0x9')]=_0x4533ba[_0xb81c('0x9')]||![];this[_0xb81c('0xa')]=_0x4533ba[_0xb81c('0xa')]||![];this[_0xb81c('0xb')]=_0x4533ba[_0xb81c('0xb')]||![];this[_0xb81c('0xc')]=_0x4533ba[_0xb81c('0xc')]||![];this[_0xb81c('0xd')]=_0x4533ba[_0xb81c('0xd')]||![];this[_0xb81c('0xe')]=_0x4533ba[_0xb81c('0xe')]||![];this['chatStatus']=_0xb81c('0xf');this[_0xb81c('0x10')]=0x0;this[_0xb81c('0x11')]=_0x4533ba[_0xb81c('0x11')]||0x0;this[_0xb81c('0x12')]=0x0;this['mailStatus']=_0xb81c('0xf');this['mailStatusTime']=0x0;this[_0xb81c('0x13')]=_0x4533ba[_0xb81c('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xb81c('0x14')]=_0xb81c('0xf');this['faxStatusTime']=0x0;this[_0xb81c('0x15')]=_0x4533ba[_0xb81c('0x15')]||0x0;this[_0xb81c('0x16')]=0x0;this['smsStatus']=_0xb81c('0xf');this[_0xb81c('0x17')]=0x0;this['smsCapacity']=_0x4533ba[_0xb81c('0x18')]||0x0;this[_0xb81c('0x19')]=0x0;this[_0xb81c('0x1a')]='unknown';this[_0xb81c('0x1b')]=0x0;this[_0xb81c('0x1c')]=_0x4533ba[_0xb81c('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xb81c('0x1d')]=_0xb81c('0xf');this[_0xb81c('0x1e')]=0x0;this[_0xb81c('0x1f')]=_0x4533ba[_0xb81c('0x1f')]||0x0;this[_0xb81c('0x20')]=0x0;this[_0xb81c('0x21')]=![];this['busyQueue']=undefined;this[_0xb81c('0x22')]='';this[_0xb81c('0x23')]();}Agent[_0xb81c('0x24')][_0xb81c('0x25')]=function(_0x4dab47){if(this[_0x4dab47+_0xb81c('0x26')]>0x0){if(this[_0x4dab47+'Capacity']>0x0&&this[_0x4dab47+_0xb81c('0x26')]>=this[_0x4dab47+_0xb81c('0x27')]){return _0xb81c('0x28');}else{return _0xb81c('0x29');}}else{return'idle';}};Agent['prototype'][_0xb81c('0x23')]=function(){var _0xff4c94=[_0xb81c('0x2a'),_0xb81c('0x2b'),_0xb81c('0x2c'),_0xb81c('0x2d'),_0xb81c('0x2e'),_0xb81c('0x2f')];for(var _0x1db33d=0x0;_0x1db33d<_0xff4c94[_0xb81c('0x30')];_0x1db33d+=0x1){var _0x253333=this[_0xb81c('0x25')](_0xff4c94[_0x1db33d]);if(this[_0xff4c94[_0x1db33d]+_0xb81c('0x31')]!==_0x253333){this[_0xff4c94[_0x1db33d]+_0xb81c('0x32')]=_[_0xb81c('0x33')](moment()[_0xb81c('0x34')]('x'));}this[_0xff4c94[_0x1db33d]+_0xb81c('0x31')]=_0x253333;}var _0x4ca99e={'id':this['id'],'name':this['name'],'online':this[_0xb81c('0x8')],'voicePause':this[_0xb81c('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xb81c('0xb')],'smsPause':this[_0xb81c('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xb81c('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xb81c('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xb81c('0x12')],'mailStatus':this[_0xb81c('0x35')],'mailStatusTime':this[_0xb81c('0x36')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xb81c('0x37')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb81c('0x38')],'faxCapacity':this[_0xb81c('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xb81c('0x39')],'smsStatusTime':this[_0xb81c('0x17')],'smsCapacity':this[_0xb81c('0x18')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xb81c('0x1a')],'whatsappStatusTime':this[_0xb81c('0x1b')],'whatsappCapacity':this[_0xb81c('0x1c')],'whatsappCurrentCapacity':this[_0xb81c('0x3a')],'openchannelStatus':this[_0xb81c('0x1d')],'openchannelStatusTime':this[_0xb81c('0x1e')],'openchannelCapacity':this[_0xb81c('0x1f')],'openchannelCurrentCapacity':this[_0xb81c('0x20')],'busy':this[_0xb81c('0x21')],'busyQueue':this[_0xb81c('0x3b')]};var _0x478b56=md5(JSON[_0xb81c('0x3c')](_0x4ca99e));if(this['md5']!==_0x478b56){this['md5']=_0x478b56;io[_0xb81c('0x3d')]('user:save',_0x4ca99e);}};module[_0xb81c('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index bb42b3e..0ff7f12 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 _0x9571=['online','chatPause','available','waiting','stringify','format','emit','chat_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','md5','updateRouting','prototype','_rr','Agents','updateRealtime','loggedIn','paused','length'];(function(_0x1d2520,_0x105606){var _0x22fd54=function(_0x2c3123){while(--_0x2c3123){_0x1d2520['push'](_0x1d2520['shift']());}};_0x22fd54(++_0x105606);}(_0x9571,0x10e));var _0x1957=function(_0x254761,_0x550307){_0x254761=_0x254761-0x0;var _0x4236de=_0x9571[_0x254761];return _0x4236de;};'use strict';var _=require(_0x1957('0x0'));var md5=require('md5');var util=require(_0x1957('0x1'));var Redis=require(_0x1957('0x2'));var config=require('../../../config/environment');config[_0x1957('0x3')]=_[_0x1957('0x4')](config[_0x1957('0x3')],{'host':_0x1957('0x5'),'port':0x18eb});var io=require(_0x1957('0x6'))(new Redis(config[_0x1957('0x3')]));function ChatQueue(_0x8f4363){this['id']=_0x8f4363['id']||0x0;this[_0x1957('0x7')]=_0x8f4363[_0x1957('0x7')]||'';this[_0x1957('0x8')]=_0x8f4363[_0x1957('0x8')]||0xa;this[_0x1957('0x9')]=_0x8f4363[_0x1957('0x9')]||'beepall';this['Agents']=_0x8f4363['Agents'];this[_0x1957('0xa')]={};this['waiting']=0x0;this[_0x1957('0xb')]='';this[_0x1957('0xc')]();this['updateRealtime']();}ChatQueue[_0x1957('0xd')][_0x1957('0xc')]=function(){var _0x4e4415=this[_0x1957('0xa')][_0x1957('0xe')];this[_0x1957('0xa')]=_['map'](this[_0x1957('0xf')],'id');this[_0x1957('0xa')][_0x1957('0xe')]=_0x4e4415;};ChatQueue['prototype'][_0x1957('0x10')]=function(){this[_0x1957('0x11')]=0x0;this[_0x1957('0x12')]=0x0;for(var _0x247275=0x0;_0x247275=0x0?this['available']:0x0;var _0x352520={'id':this['id'],'available':this[_0x1957('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1957('0x12')],'waiting':this[_0x1957('0x17')]};var _0x4a7ff3=md5(JSON[_0x1957('0x18')](_0x352520));if(this['md5']!==_0x4a7ff3){this[_0x1957('0xb')]=_0x4a7ff3;io['to'](util[_0x1957('0x19')]('chat:queue:%s',_0x352520['name']))[_0x1957('0x1a')](_0x1957('0x1b'),_0x352520);}};module[_0x1957('0x1c')]=ChatQueue; \ No newline at end of file +var _0xba10=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x3c51dc,_0x3580b8){var _0x1c69a1=function(_0x5398e6){while(--_0x5398e6){_0x3c51dc['push'](_0x3c51dc['shift']());}};_0x1c69a1(++_0x3580b8);}(_0xba10,0x1e4));var _0x0ba1=function(_0xee60e9,_0x3c51e1){_0xee60e9=_0xee60e9-0x0;var _0x42143d=_0xba10[_0xee60e9];return _0x42143d;};'use strict';var _=require(_0x0ba1('0x0'));var md5=require(_0x0ba1('0x1'));var util=require(_0x0ba1('0x2'));var Redis=require('ioredis');var config=require(_0x0ba1('0x3'));config['redis']=_[_0x0ba1('0x4')](config[_0x0ba1('0x5')],{'host':_0x0ba1('0x6'),'port':0x18eb});var io=require(_0x0ba1('0x7'))(new Redis(config[_0x0ba1('0x5')]));function ChatQueue(_0x358005){this['id']=_0x358005['id']||0x0;this[_0x0ba1('0x8')]=_0x358005[_0x0ba1('0x8')]||'';this[_0x0ba1('0x9')]=_0x358005[_0x0ba1('0x9')]||0xa;this[_0x0ba1('0xa')]=_0x358005['strategy']||_0x0ba1('0xb');this['Agents']=_0x358005[_0x0ba1('0xc')];this[_0x0ba1('0xd')]={};this[_0x0ba1('0xe')]=0x0;this[_0x0ba1('0x1')]='';this[_0x0ba1('0xf')]();this[_0x0ba1('0x10')]();}ChatQueue[_0x0ba1('0x11')][_0x0ba1('0xf')]=function(){var _0x4299b1=this[_0x0ba1('0xd')][_0x0ba1('0x12')];this[_0x0ba1('0xd')]=_[_0x0ba1('0x13')](this[_0x0ba1('0xc')],'id');this['mapAgentsId'][_0x0ba1('0x12')]=_0x4299b1;};ChatQueue['prototype'][_0x0ba1('0x10')]=function(){this[_0x0ba1('0x14')]=0x0;this[_0x0ba1('0x15')]=0x0;for(var _0x75fbfa=0x0;_0x75fbfa=0x0?this['available']:0x0;var _0x204925={'id':this['id'],'available':this[_0x0ba1('0x19')],'loggedIn':this[_0x0ba1('0x14')],'name':this[_0x0ba1('0x8')],'paused':this[_0x0ba1('0x15')],'waiting':this[_0x0ba1('0xe')]};var _0x54647e=md5(JSON[_0x0ba1('0x1a')](_0x204925));if(this[_0x0ba1('0x1')]!==_0x54647e){this['md5']=_0x54647e;io['to'](util['format'](_0x0ba1('0x1b'),_0x204925[_0x0ba1('0x8')]))[_0x0ba1('0x1c')](_0x0ba1('0x1d'),_0x204925);}};module[_0x0ba1('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index bdff7a7..62daaba 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(_0x2554f0,_0x838532){var _0x591ecb=function(_0x289c4a){while(--_0x289c4a){_0x2554f0['push'](_0x2554f0['shift']());}};_0x591ecb(++_0x838532);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x285a13,_0x341409){var _0x3a1069=function(_0x350587){while(--_0x350587){_0x285a13['push'](_0x285a13['shift']());}};_0x3a1069(++_0x341409);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 2653b06..ddd38d4 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 _0x7b68=['name','Intervals','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7b68,0x15c));var _0x87b6=function(_0x549c1d,_0x3d3159){_0x549c1d=_0x549c1d-0x0;var _0x301095=_0x7b68[_0x549c1d];return _0x301095;};'use strict';function Interval(_0x40be16){this['id']=_0x40be16['id']||0x0;this[_0x87b6('0x0')]=_0x40be16[_0x87b6('0x0')]||'';this[_0x87b6('0x1')]=_0x40be16['Intervals']||{};}module[_0x87b6('0x2')]=Interval; \ No newline at end of file +var _0xf379=['Intervals','name'];(function(_0xc1af0b,_0x2cf7c0){var _0x13df62=function(_0x278028){while(--_0x278028){_0xc1af0b['push'](_0xc1af0b['shift']());}};_0x13df62(++_0x2cf7c0);}(_0xf379,0xab));var _0x9f37=function(_0x26128e,_0x34dcc4){_0x26128e=_0x26128e-0x0;var _0x1c532a=_0xf379[_0x26128e];return _0x1c532a;};'use strict';function Interval(_0x1d9f2c){this['id']=_0x1d9f2c['id']||0x0;this[_0x9f37('0x0')]=_0x1d9f2c[_0x9f37('0x0')]||'';this[_0x9f37('0x1')]=_0x1d9f2c[_0x9f37('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 8036852..ec18b01 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 _0x6dd3=['md5','util','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0x6dd3,0x16b));var _0x36dd=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x6dd3[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0x36dd('0x0'));var md5=require(_0x36dd('0x1'));var util=require(_0x36dd('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x36dd('0x3')]=_[_0x36dd('0x4')](config[_0x36dd('0x3')],{'host':_0x36dd('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x2ec5fe){this['id']=_0x2ec5fe['id']||0x0;this[_0x36dd('0x6')]=_0x2ec5fe[_0x36dd('0x6')]||'';this['timeout']=_0x2ec5fe[_0x36dd('0x7')]||0xa;this[_0x36dd('0x8')]=_0x2ec5fe[_0x36dd('0x8')]||'beepall';this[_0x36dd('0x9')]=_0x2ec5fe[_0x36dd('0x9')];this['mapAgentsId']={};this[_0x36dd('0xa')]=0x0;this[_0x36dd('0x1')]='';this[_0x36dd('0xb')]();this['updateRealtime']();}MailQueue[_0x36dd('0xc')]['updateRouting']=function(){var _0x54d1bd=this[_0x36dd('0xd')]['_rr'];this[_0x36dd('0xd')]=_[_0x36dd('0xe')](this['Agents'],'id');this[_0x36dd('0xd')][_0x36dd('0xf')]=_0x54d1bd;};MailQueue[_0x36dd('0xc')][_0x36dd('0x10')]=function(){this[_0x36dd('0x11')]=0x0;this['paused']=0x0;for(var _0x32230e=0x0;_0x32230e=0x0?this['available']:0x0;var _0x12fc19={'id':this['id'],'available':this[_0x36dd('0x16')],'loggedIn':this[_0x36dd('0x11')],'name':this['name'],'paused':this[_0x36dd('0x15')],'waiting':this[_0x36dd('0xa')]};var _0x149b85=md5(JSON['stringify'](_0x12fc19));if(this[_0x36dd('0x1')]!==_0x149b85){this[_0x36dd('0x1')]=_0x149b85;io['to'](util[_0x36dd('0x17')](_0x36dd('0x18'),_0x12fc19[_0x36dd('0x6')]))[_0x36dd('0x19')](_0x36dd('0x1a'),_0x12fc19);}};module[_0x36dd('0x1b')]=MailQueue; \ No newline at end of file +var _0xdd4e=['paused','length','online','mailPause','available','name','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','map','_rr','updateRealtime','loggedIn'];(function(_0x5569a0,_0x454dff){var _0x30bba7=function(_0x14ac2d){while(--_0x14ac2d){_0x5569a0['push'](_0x5569a0['shift']());}};_0x30bba7(++_0x454dff);}(_0xdd4e,0x1af));var _0xedd4=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xdd4e[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0xedd4('0x0'));var md5=require(_0xedd4('0x1'));var util=require('util');var Redis=require(_0xedd4('0x2'));var config=require(_0xedd4('0x3'));config[_0xedd4('0x4')]=_['defaults'](config[_0xedd4('0x4')],{'host':_0xedd4('0x5'),'port':0x18eb});var io=require(_0xedd4('0x6'))(new Redis(config[_0xedd4('0x4')]));function MailQueue(_0x5a2fd9){this['id']=_0x5a2fd9['id']||0x0;this['name']=_0x5a2fd9['name']||'';this[_0xedd4('0x7')]=_0x5a2fd9['timeout']||0xa;this[_0xedd4('0x8')]=_0x5a2fd9[_0xedd4('0x8')]||_0xedd4('0x9');this['Agents']=_0x5a2fd9[_0xedd4('0xa')];this[_0xedd4('0xb')]={};this[_0xedd4('0xc')]=0x0;this[_0xedd4('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xedd4('0xd')][_0xedd4('0xe')]=function(){var _0x5ac380=this[_0xedd4('0xb')]['_rr'];this['mapAgentsId']=_[_0xedd4('0xf')](this[_0xedd4('0xa')],'id');this[_0xedd4('0xb')][_0xedd4('0x10')]=_0x5ac380;};MailQueue[_0xedd4('0xd')][_0xedd4('0x11')]=function(){this[_0xedd4('0x12')]=0x0;this[_0xedd4('0x13')]=0x0;for(var _0x554be5=0x0;_0x554be5=0x0?this[_0xedd4('0x17')]:0x0;var _0x397289={'id':this['id'],'available':this['available'],'loggedIn':this[_0xedd4('0x12')],'name':this[_0xedd4('0x18')],'paused':this[_0xedd4('0x13')],'waiting':this[_0xedd4('0xc')]};var _0x305492=md5(JSON[_0xedd4('0x19')](_0x397289));if(this[_0xedd4('0x1')]!==_0x305492){this['md5']=_0x305492;io['to'](util['format'](_0xedd4('0x1a'),_0x397289['name']))[_0xedd4('0x1b')](_0xedd4('0x1c'),_0x397289);}};module[_0xedd4('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 31ee885..5be9a75 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 _0x0375=['waiting','stringify','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','available'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x0375,0x1be));var _0x5037=function(_0x33a13c,_0x2ef29d){_0x33a13c=_0x33a13c-0x0;var _0x3397ac=_0x0375[_0x33a13c];return _0x3397ac;};'use strict';var _=require(_0x5037('0x0'));var md5=require('md5');var util=require(_0x5037('0x1'));var Redis=require(_0x5037('0x2'));var config=require(_0x5037('0x3'));config[_0x5037('0x4')]=_[_0x5037('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5037('0x6'))(new Redis(config[_0x5037('0x4')]));function OpenchannelQueue(_0x19e6c5){this['id']=_0x19e6c5['id']||0x0;this[_0x5037('0x7')]=_0x19e6c5[_0x5037('0x7')]||'';this[_0x5037('0x8')]=_0x19e6c5[_0x5037('0x8')]||0xa;this[_0x5037('0x9')]=_0x19e6c5['strategy']||_0x5037('0xa');this[_0x5037('0xb')]=_0x19e6c5[_0x5037('0xb')];this[_0x5037('0xc')]={};this['waiting']=0x0;this[_0x5037('0xd')]='';this['updateRouting']();this[_0x5037('0xe')]();}OpenchannelQueue[_0x5037('0xf')][_0x5037('0x10')]=function(){var _0x38737b=this['mapAgentsId'][_0x5037('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x5037('0x11')]=_0x38737b;};OpenchannelQueue[_0x5037('0xf')]['updateRealtime']=function(){this[_0x5037('0x12')]=0x0;this[_0x5037('0x13')]=0x0;for(var _0x249a82=0x0;_0x249a82=0x0?this[_0x5037('0x15')]:0x0;var _0x3a3fda={'id':this['id'],'available':this[_0x5037('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x5037('0x7')],'paused':this['paused'],'waiting':this[_0x5037('0x16')]};var _0x155d83=md5(JSON[_0x5037('0x17')](_0x3a3fda));if(this[_0x5037('0xd')]!==_0x155d83){this[_0x5037('0xd')]=_0x155d83;io['to'](util['format']('openchannel:queue:%s',_0x3a3fda[_0x5037('0x7')]))[_0x5037('0x18')]('openchannel_queue:save',_0x3a3fda);}};module[_0x5037('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x7224=['strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','paused','online','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','name','timeout'];(function(_0x436e31,_0x525f1c){var _0xd86955=function(_0x739238){while(--_0x739238){_0x436e31['push'](_0x436e31['shift']());}};_0xd86955(++_0x525f1c);}(_0x7224,0x12c));var _0x4722=function(_0x335e20,_0x3b998c){_0x335e20=_0x335e20-0x0;var _0x410b0f=_0x7224[_0x335e20];return _0x410b0f;};'use strict';var _=require(_0x4722('0x0'));var md5=require(_0x4722('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4722('0x2'));config[_0x4722('0x3')]=_[_0x4722('0x4')](config[_0x4722('0x3')],{'host':_0x4722('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4722('0x3')]));function OpenchannelQueue(_0x181682){this['id']=_0x181682['id']||0x0;this[_0x4722('0x6')]=_0x181682[_0x4722('0x6')]||'';this[_0x4722('0x7')]=_0x181682[_0x4722('0x7')]||0xa;this['strategy']=_0x181682[_0x4722('0x8')]||_0x4722('0x9');this['Agents']=_0x181682[_0x4722('0xa')];this['mapAgentsId']={};this[_0x4722('0xb')]=0x0;this[_0x4722('0x1')]='';this[_0x4722('0xc')]();this[_0x4722('0xd')]();}OpenchannelQueue[_0x4722('0xe')][_0x4722('0xc')]=function(){var _0x12ae3b=this[_0x4722('0xf')]['_rr'];this[_0x4722('0xf')]=_['map'](this[_0x4722('0xa')],'id');this[_0x4722('0xf')][_0x4722('0x10')]=_0x12ae3b;};OpenchannelQueue[_0x4722('0xe')][_0x4722('0xd')]=function(){this['loggedIn']=0x0;this[_0x4722('0x11')]=0x0;for(var _0xa5c0cd=0x0;_0xa5c0cd=0x0?this[_0x4722('0x15')]:0x0;var _0x5db72e={'id':this['id'],'available':this[_0x4722('0x15')],'loggedIn':this[_0x4722('0x13')],'name':this[_0x4722('0x6')],'paused':this[_0x4722('0x11')],'waiting':this[_0x4722('0xb')]};var _0x45a2e3=md5(JSON[_0x4722('0x16')](_0x5db72e));if(this['md5']!==_0x45a2e3){this['md5']=_0x45a2e3;io['to'](util[_0x4722('0x17')](_0x4722('0x18'),_0x5db72e['name']))[_0x4722('0x19')](_0x4722('0x1a'),_0x5db72e);}};module[_0x4722('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 891059c..e12bfda 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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb10b,0x12a));var _0xbb10=function(_0x8fc9d1,_0x55be5e){_0x8fc9d1=_0x8fc9d1-0x0;var _0x445c72=_0xb10b[_0x8fc9d1];return _0x445c72;};'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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0xd240a2,_0x4537b1){var _0x4625f4=function(_0x5113d0){while(--_0x5113d0){_0xd240a2['push'](_0xd240a2['shift']());}};_0x4625f4(++_0x4537b1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 73620a7..abcd047 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 _0x21d4=['_rr','prototype','loggedIn','length','online','whatsappPause','paused','available','stringify','whatsapp:queue:%s','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x103f96,_0x2871f3){var _0x4d4f81=function(_0x42237f){while(--_0x42237f){_0x103f96['push'](_0x103f96['shift']());}};_0x4d4f81(++_0x2871f3);}(_0x21d4,0xeb));var _0x421d=function(_0x46604d,_0x4461a0){_0x46604d=_0x46604d-0x0;var _0x45b960=_0x21d4[_0x46604d];return _0x45b960;};'use strict';var _=require('lodash');var md5=require(_0x421d('0x0'));var util=require(_0x421d('0x1'));var Redis=require(_0x421d('0x2'));var config=require(_0x421d('0x3'));config[_0x421d('0x4')]=_['defaults'](config[_0x421d('0x4')],{'host':_0x421d('0x5'),'port':0x18eb});var io=require(_0x421d('0x6'))(new Redis(config[_0x421d('0x4')]));function WhatsappQueue(_0x5e10f4){this['id']=_0x5e10f4['id']||0x0;this['name']=_0x5e10f4[_0x421d('0x7')]||'';this[_0x421d('0x8')]=_0x5e10f4[_0x421d('0x8')]||0xa;this[_0x421d('0x9')]=_0x5e10f4[_0x421d('0x9')]||'beepall';this['Agents']=_0x5e10f4[_0x421d('0xa')];this[_0x421d('0xb')]={};this[_0x421d('0xc')]=0x0;this['md5']='';this[_0x421d('0xd')]();this[_0x421d('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x5742c5=this[_0x421d('0xb')]['_rr'];this[_0x421d('0xb')]=_['map'](this['Agents'],'id');this[_0x421d('0xb')][_0x421d('0xf')]=_0x5742c5;};WhatsappQueue[_0x421d('0x10')][_0x421d('0xe')]=function(){this[_0x421d('0x11')]=0x0;this['paused']=0x0;for(var _0x11939c=0x0;_0x11939c=0x0?this[_0x421d('0x16')]:0x0;var _0xc1156={'id':this['id'],'available':this[_0x421d('0x16')],'loggedIn':this[_0x421d('0x11')],'name':this['name'],'paused':this[_0x421d('0x15')],'waiting':this['waiting']};var _0x496f15=md5(JSON[_0x421d('0x17')](_0xc1156));if(this['md5']!==_0x496f15){this[_0x421d('0x0')]=_0x496f15;io['to'](util['format'](_0x421d('0x18'),_0xc1156[_0x421d('0x7')]))['emit']('whatsapp_queue:save',_0xc1156);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x27cb=['map','_rr','updateRealtime','loggedIn','paused','length','online','available','format','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype'];(function(_0x599d86,_0x1121f8){var _0x5bdb62=function(_0x11f60f){while(--_0x11f60f){_0x599d86['push'](_0x599d86['shift']());}};_0x5bdb62(++_0x1121f8);}(_0x27cb,0x73));var _0xb27c=function(_0x1c967e,_0x1a7f45){_0x1c967e=_0x1c967e-0x0;var _0x4a843e=_0x27cb[_0x1c967e];return _0x4a843e;};'use strict';var _=require(_0xb27c('0x0'));var md5=require('md5');var util=require(_0xb27c('0x1'));var Redis=require(_0xb27c('0x2'));var config=require(_0xb27c('0x3'));config[_0xb27c('0x4')]=_['defaults'](config[_0xb27c('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x2a63b6){this['id']=_0x2a63b6['id']||0x0;this[_0xb27c('0x5')]=_0x2a63b6[_0xb27c('0x5')]||'';this[_0xb27c('0x6')]=_0x2a63b6['timeout']||0xa;this[_0xb27c('0x7')]=_0x2a63b6[_0xb27c('0x7')]||_0xb27c('0x8');this[_0xb27c('0x9')]=_0x2a63b6[_0xb27c('0x9')];this[_0xb27c('0xa')]={};this[_0xb27c('0xb')]=0x0;this[_0xb27c('0xc')]='';this[_0xb27c('0xd')]();this['updateRealtime']();}WhatsappQueue[_0xb27c('0xe')][_0xb27c('0xd')]=function(){var _0x41f308=this[_0xb27c('0xa')]['_rr'];this['mapAgentsId']=_[_0xb27c('0xf')](this['Agents'],'id');this[_0xb27c('0xa')][_0xb27c('0x10')]=_0x41f308;};WhatsappQueue[_0xb27c('0xe')][_0xb27c('0x11')]=function(){this[_0xb27c('0x12')]=0x0;this[_0xb27c('0x13')]=0x0;for(var _0x2b32e3=0x0;_0x2b32e3=0x0?this[_0xb27c('0x16')]:0x0;var _0x1bd501={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb27c('0x12')],'name':this[_0xb27c('0x5')],'paused':this[_0xb27c('0x13')],'waiting':this[_0xb27c('0xb')]};var _0x387c66=md5(JSON['stringify'](_0x1bd501));if(this[_0xb27c('0xc')]!==_0x387c66){this[_0xb27c('0xc')]=_0x387c66;io['to'](util[_0xb27c('0x17')]('whatsapp:queue:%s',_0x1bd501[_0xb27c('0x5')]))['emit'](_0xb27c('0x18'),_0x1bd501);}};module[_0xb27c('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5a1277f..1dbc323 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 _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x46f43b,_0x1d632d){var _0x193b14=function(_0x11bb27){while(--_0x11bb27){_0x46f43b['push'](_0x46f43b['shift']());}};_0x193b14(++_0x1d632d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x4b84[_0x2a2166];return _0x3bcf50;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0xf51edd,_0x194dac){var _0x28800b=function(_0x1ecfd6){while(--_0x1ecfd6){_0xf51edd['push'](_0xf51edd['shift']());}};_0x28800b(++_0x194dac);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x8db99e,_0x37a394){_0x8db99e=_0x8db99e-0x0;var _0x136c57=_0x7fbe[_0x8db99e];return _0x136c57;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9d021e6..8bf6813 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 _0x7617=['addTags','../client','update','Request','updateChatInteraction'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x7617,0xfb));var _0x7761=function(_0x35f3e8,_0x30663e){_0x35f3e8=_0x35f3e8-0x0;var _0x6144ce=_0x7617[_0x35f3e8];return _0x6144ce;};'use strict';var client=require(_0x7761('0x0'));exports[_0x7761('0x1')]=function(_0x173aeb,_0x319b12){return client[_0x7761('0x2')]('UpdateChatInteraction',{'body':_0x319b12,'options':{'where':{'id':_0x173aeb}},'log':_0x7761('0x3')});};exports[_0x7761('0x4')]=function(_0x29295a,_0x456cd0){return client[_0x7761('0x2')]('AddTagsToChatInteraction',{'body':_0x456cd0,'options':{'where':{'id':_0x29295a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9ae8=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','addTags'];(function(_0x1a97e0,_0x404ff0){var _0x26e90a=function(_0x39c732){while(--_0x39c732){_0x1a97e0['push'](_0x1a97e0['shift']());}};_0x26e90a(++_0x404ff0);}(_0x9ae8,0x6b));var _0x89ae=function(_0xbed554,_0x5ecfc5){_0xbed554=_0xbed554-0x0;var _0x5b19c6=_0x9ae8[_0xbed554];return _0x5b19c6;};'use strict';var client=require(_0x89ae('0x0'));exports['update']=function(_0x5c615f,_0x12a03d){return client[_0x89ae('0x1')]('UpdateChatInteraction',{'body':_0x12a03d,'options':{'where':{'id':_0x5c615f}},'log':'updateChatInteraction'});};exports[_0x89ae('0x2')]=function(_0x485556,_0x3c3c8a){return client[_0x89ae('0x1')](_0x89ae('0x3'),{'body':_0x3c3c8a,'options':{'where':{'id':_0x485556}},'log':_0x89ae('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 43c2781..13ae30b 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 _0xfe00=['../client','create','Request','createChatMessage'];(function(_0x21ec31,_0x893de0){var _0x2ebd45=function(_0x56ac11){while(--_0x56ac11){_0x21ec31['push'](_0x21ec31['shift']());}};_0x2ebd45(++_0x893de0);}(_0xfe00,0x7c));var _0x0fe0=function(_0x3520d0,_0x32b2cf){_0x3520d0=_0x3520d0-0x0;var _0x1d2118=_0xfe00[_0x3520d0];return _0x1d2118;};'use strict';var client=require(_0x0fe0('0x0'));exports[_0x0fe0('0x1')]=function(_0x31b952){return client[_0x0fe0('0x2')]('CreateChatMessage',{'body':_0x31b952,'log':_0x0fe0('0x3')});}; \ No newline at end of file +var _0x6cb1=['CreateChatMessage','createChatMessage'];(function(_0x5b8b9f,_0x3deee0){var _0x2fe20d=function(_0x583ad4){while(--_0x583ad4){_0x5b8b9f['push'](_0x5b8b9f['shift']());}};_0x2fe20d(++_0x3deee0);}(_0x6cb1,0x84));var _0x16cb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6cb1[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['create']=function(_0xa67d0b){return client['Request'](_0x16cb('0x0'),{'body':_0xa67d0b,'log':_0x16cb('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6094b22..a56d1be 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 _0xcd33=['getChatQueues','Request','GetChatQueue','name','User','Agents','online','chatPause'];(function(_0x482e8a,_0x1131ed){var _0x4f4764=function(_0x575bdc){while(--_0x575bdc){_0x482e8a['push'](_0x482e8a['shift']());}};_0x4f4764(++_0x1131ed);}(_0xcd33,0xb1));var _0x3cd3=function(_0x8d06f4,_0x51bbfc){_0x8d06f4=_0x8d06f4-0x0;var _0xce16d5=_0xcd33[_0x8d06f4];return _0xce16d5;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x3cd3('0x0')](_0x3cd3('0x1'),{'options':{'raw':![],'attributes':['id',_0x3cd3('0x2'),'timeout','strategy'],'include':[{'model':_0x3cd3('0x3'),'as':_0x3cd3('0x4'),'attributes':['id',_0x3cd3('0x2'),_0x3cd3('0x5'),_0x3cd3('0x6')]}]},'log':_0x3cd3('0x7')});};}; \ No newline at end of file +var _0xe851=['strategy','Agents','chatPause','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x333400,_0x262399){var _0x5cfca7=function(_0x525e49){while(--_0x525e49){_0x333400['push'](_0x333400['shift']());}};_0x5cfca7(++_0x262399);}(_0xe851,0xfc));var _0x1e85=function(_0x21c74b,_0xa5aafc){_0x21c74b=_0x21c74b-0x0;var _0x4feba0=_0xe851[_0x21c74b];return _0x4feba0;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x1e85('0x0')](_0x1e85('0x1'),{'options':{'raw':![],'attributes':['id',_0x1e85('0x2'),_0x1e85('0x3'),_0x1e85('0x4')],'include':[{'model':'User','as':_0x1e85('0x5'),'attributes':['id','name','online',_0x1e85('0x6')]}]},'log':_0x1e85('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 83cc6d9..fa62196 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 _0x3645=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x3645,0x154));var _0x5364=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x3645[_0x1ff575];return _0x48fc9e;};'use strict';var client=require('../client');exports[_0x5364('0x0')]=function(_0x12217b){return client[_0x5364('0x1')](_0x5364('0x2'),{'body':_0x12217b,'log':_0x5364('0x2')});};exports[_0x5364('0x3')]=function(_0x3c0f77,_0x5a63bf){return client[_0x5364('0x1')](_0x5364('0x4'),{'body':_0x5a63bf,'options':{'where':{'uniqueid':_0x3c0f77},'order':[['id',_0x5364('0x5')]],'limit':0x1},'log':_0x5364('0x4')});}; \ No newline at end of file +var _0x202c=['../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x202c,0x178));var _0xc202=function(_0x182753,_0x3d6b8c){_0x182753=_0x182753-0x0;var _0xe9ede6=_0x202c[_0x182753];return _0xe9ede6;};'use strict';var client=require(_0xc202('0x0'));exports['create']=function(_0x5c306e){return client[_0xc202('0x1')](_0xc202('0x2'),{'body':_0x5c306e,'log':_0xc202('0x2')});};exports['update']=function(_0x215161,_0x155c3b){return client[_0xc202('0x1')](_0xc202('0x3'),{'body':_0x155c3b,'options':{'where':{'uniqueid':_0x215161},'order':[['id','DESC']],'limit':0x1},'log':_0xc202('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2f7f9c5..19ca9b4 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 _0x51fc=['UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','Request'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x51fc,0x125));var _0xc51f=function(_0x1e48b3,_0x3150bc){_0x1e48b3=_0x1e48b3-0x0;var _0x295fae=_0x51fc[_0x1e48b3];return _0x295fae;};'use strict';var client=require('../client');exports['update']=function(_0x1c540d,_0xbea97e){return client[_0xc51f('0x0')](_0xc51f('0x1'),{'body':_0xbea97e,'options':{'where':{'id':_0x1c540d}},'log':_0xc51f('0x2')});};exports[_0xc51f('0x3')]=function(_0x17412c,_0x375b56){return client[_0xc51f('0x0')](_0xc51f('0x4'),{'body':_0x375b56,'options':{'where':{'id':_0x17412c}},'log':_0xc51f('0x5')});}; \ No newline at end of file +var _0x58b3=['addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','addTags'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x58b3,0x1e6));var _0x358b=function(_0x5a3fba,_0x1adddf){_0x5a3fba=_0x5a3fba-0x0;var _0x2680fd=_0x58b3[_0x5a3fba];return _0x2680fd;};'use strict';var client=require('../client');exports[_0x358b('0x0')]=function(_0xc9c5ae,_0x54df37){return client[_0x358b('0x1')](_0x358b('0x2'),{'body':_0x54df37,'options':{'where':{'id':_0xc9c5ae}},'log':'updateFaxInteraction'});};exports[_0x358b('0x3')]=function(_0x4c2886,_0x353cf2){return client[_0x358b('0x1')]('AddTagsToFaxInteraction',{'body':_0x353cf2,'options':{'where':{'id':_0x4c2886}},'log':_0x358b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3635a66..f8618c0 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 _0xb1f6=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb1f6,0x129));var _0x6b1f=function(_0x343023,_0xe2c7de){_0x343023=_0x343023-0x0;var _0x49cb24=_0xb1f6[_0x343023];return _0x49cb24;};'use strict';var client=require(_0x6b1f('0x0'));exports[_0x6b1f('0x1')]=function(_0x535220){return client[_0x6b1f('0x2')](_0x6b1f('0x3'),{'body':_0x535220,'log':_0x6b1f('0x4')});}; \ No newline at end of file +var _0x56ea=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x2f3924,_0x759737){var _0x344f89=function(_0x356f89){while(--_0x356f89){_0x2f3924['push'](_0x2f3924['shift']());}};_0x344f89(++_0x759737);}(_0x56ea,0x1a7));var _0xa56e=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0x56ea[_0xb68772];return _0x4189bb;};'use strict';var client=require('../client');exports['create']=function(_0x3ff314){return client[_0xa56e('0x0')](_0xa56e('0x1'),{'body':_0x3ff314,'log':_0xa56e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 7169cc4..17c49b0 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 _0x4e5c=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','faxPause'];(function(_0x13525a,_0x3d7406){var _0x4c1121=function(_0x10c339){while(--_0x10c339){_0x13525a['push'](_0x13525a['shift']());}};_0x4c1121(++_0x3d7406);}(_0x4e5c,0x1dd));var _0xc4e5=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x4e5c[_0x4ae829];return _0x256b31;};'use strict';var client=require(_0xc4e5('0x0'));exports[_0xc4e5('0x1')]=function(){return function(){return client[_0xc4e5('0x2')](_0xc4e5('0x3'),{'options':{'raw':![],'attributes':['id',_0xc4e5('0x4'),_0xc4e5('0x5'),_0xc4e5('0x6')],'include':[{'model':_0xc4e5('0x7'),'as':'Agents','attributes':['id',_0xc4e5('0x4'),'online',_0xc4e5('0x8')]}]},'log':_0xc4e5('0x1')});};}; \ No newline at end of file +var _0x3db3=['Request','GetFaxQueue','name','timeout','User','Agents','faxPause','../client'];(function(_0x17772e,_0x3d4d93){var _0x21e766=function(_0x474f74){while(--_0x474f74){_0x17772e['push'](_0x17772e['shift']());}};_0x21e766(++_0x3d4d93);}(_0x3db3,0x77));var _0x33db=function(_0x1d4d2e,_0x2b02f4){_0x1d4d2e=_0x1d4d2e-0x0;var _0x261b89=_0x3db3[_0x1d4d2e];return _0x261b89;};'use strict';var client=require(_0x33db('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x33db('0x1')](_0x33db('0x2'),{'options':{'raw':![],'attributes':['id',_0x33db('0x3'),_0x33db('0x4'),'strategy'],'include':[{'model':_0x33db('0x5'),'as':_0x33db('0x6'),'attributes':['id','name','online',_0x33db('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0d40172..2113679 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 _0xac8f=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x211dde,_0x1c7195){var _0x10979a=function(_0x3ef167){while(--_0x3ef167){_0x211dde['push'](_0x211dde['shift']());}};_0x10979a(++_0x1c7195);}(_0xac8f,0x1d6));var _0xfac8=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0xac8f[_0x838813];return _0x2bd32d;};'use strict';var client=require(_0xfac8('0x0'));exports[_0xfac8('0x1')]=function(_0x21562f){return client[_0xfac8('0x2')](_0xfac8('0x3'),{'body':_0x21562f,'log':_0xfac8('0x3')});};exports[_0xfac8('0x4')]=function(_0xf8d993,_0x23ff35){return client[_0xfac8('0x2')](_0xfac8('0x5'),{'body':_0x23ff35,'options':{'where':{'uniqueid':_0xf8d993},'order':[['id',_0xfac8('0x6')]],'limit':0x1},'log':_0xfac8('0x5')});}; \ No newline at end of file +var _0xa408=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0xa408,0x1ea));var _0x8a40=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xa408[_0x216799];return _0x3661c3;};'use strict';var client=require('../client');exports[_0x8a40('0x0')]=function(_0x349178){return client[_0x8a40('0x1')](_0x8a40('0x2'),{'body':_0x349178,'log':'CreateFaxQueueReport'});};exports[_0x8a40('0x3')]=function(_0x29319e,_0x509b99){return client[_0x8a40('0x1')](_0x8a40('0x4'),{'body':_0x509b99,'options':{'where':{'uniqueid':_0x29319e},'order':[['id',_0x8a40('0x5')]],'limit':0x1},'log':_0x8a40('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index eb77950..44d3cff 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 _0x757a=['name','interval','getIntervals','Request','Intervals'];(function(_0x33a4ae,_0x4566dc){var _0x29aeb7=function(_0xfd8d5a){while(--_0xfd8d5a){_0x33a4ae['push'](_0x33a4ae['shift']());}};_0x29aeb7(++_0x4566dc);}(_0x757a,0xde));var _0xa757=function(_0x497d27,_0x4f6c13){_0x497d27=_0x497d27-0x0;var _0x3a6f18=_0x757a[_0x497d27];return _0x3a6f18;};'use strict';var client=require('../client');exports[_0xa757('0x0')]=function(){return function(){return client[_0xa757('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xa757('0x2'),'attributes':['id',_0xa757('0x3'),_0xa757('0x4')]}]},'log':_0xa757('0x0')});};}; \ No newline at end of file +var _0x55f1=['interval','../client','Request','GetInterval','name','Interval','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55f1,0x9b));var _0x155f=function(_0x1f671a,_0x4e0725){_0x1f671a=_0x1f671a-0x0;var _0x33ea8b=_0x55f1[_0x1f671a];return _0x33ea8b;};'use strict';var client=require(_0x155f('0x0'));exports['getIntervals']=function(){return function(){return client[_0x155f('0x1')](_0x155f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x155f('0x3')],'include':[{'model':_0x155f('0x4'),'as':_0x155f('0x5'),'attributes':['id',_0x155f('0x3'),_0x155f('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index bc6790c..4e9c1f4 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 _0xf6e0=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x5b6092,_0x5563bd){var _0x3de6aa=function(_0x22732d){while(--_0x22732d){_0x5b6092['push'](_0x5b6092['shift']());}};_0x3de6aa(++_0x5563bd);}(_0xf6e0,0x179));var _0x0f6e=function(_0x47f499,_0x5ae028){_0x47f499=_0x47f499-0x0;var _0x254d29=_0xf6e0[_0x47f499];return _0x254d29;};'use strict';var client=require(_0x0f6e('0x0'));exports[_0x0f6e('0x1')]=function(_0x5b76b0,_0x54cfaf){return client[_0x0f6e('0x2')](_0x0f6e('0x3'),{'body':_0x54cfaf,'options':{'where':{'id':_0x5b76b0}},'log':_0x0f6e('0x4')});};exports[_0x0f6e('0x5')]=function(_0x89b1e1,_0x14c3d3){return client[_0x0f6e('0x2')](_0x0f6e('0x6'),{'body':_0x14c3d3,'options':{'where':{'id':_0x89b1e1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe82b=['Request','UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x489250,_0x5e9468){var _0x1283e5=function(_0x2559d9){while(--_0x2559d9){_0x489250['push'](_0x489250['shift']());}};_0x1283e5(++_0x5e9468);}(_0xe82b,0x1e4));var _0xbe82=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe82b[_0x42245d];return _0x4b211a;};'use strict';var client=require('../client');exports[_0xbe82('0x0')]=function(_0x2f464a,_0x35e874){return client[_0xbe82('0x1')](_0xbe82('0x2'),{'body':_0x35e874,'options':{'where':{'id':_0x2f464a}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x3c3aeb,_0x1ebe50){return client[_0xbe82('0x1')](_0xbe82('0x3'),{'body':_0x1ebe50,'options':{'where':{'id':_0x3c3aeb}},'log':_0xbe82('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a80f347..d731d31 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 _0x89e4=['../client','create','createMailMessage'];(function(_0x396b44,_0x53777a){var _0x170b96=function(_0x17e8eb){while(--_0x17e8eb){_0x396b44['push'](_0x396b44['shift']());}};_0x170b96(++_0x53777a);}(_0x89e4,0x111));var _0x489e=function(_0x5713c6,_0x23f631){_0x5713c6=_0x5713c6-0x0;var _0x4f7009=_0x89e4[_0x5713c6];return _0x4f7009;};'use strict';var client=require(_0x489e('0x0'));exports[_0x489e('0x1')]=function(_0x3bf7be){return client['Request']('CreateMailMessage',{'body':_0x3bf7be,'log':_0x489e('0x2')});}; \ No newline at end of file +var _0x26d4=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x4113ab,_0x156dcc){var _0x380b3d=function(_0x3f8c0f){while(--_0x3f8c0f){_0x4113ab['push'](_0x4113ab['shift']());}};_0x380b3d(++_0x156dcc);}(_0x26d4,0x146));var _0x426d=function(_0x4bf1d5,_0x4e7c0f){_0x4bf1d5=_0x4bf1d5-0x0;var _0x5ab76a=_0x26d4[_0x4bf1d5];return _0x5ab76a;};'use strict';var client=require(_0x426d('0x0'));exports[_0x426d('0x1')]=function(_0x1cbf98){return client[_0x426d('0x2')](_0x426d('0x3'),{'body':_0x1cbf98,'log':_0x426d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e436e38..ce1c80b 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 _0x3a80=['../client','Request','GetMailQueue','strategy','User','name','mailPause','getMailQueues'];(function(_0x409b87,_0x5ef488){var _0x46fa68=function(_0x2ddda7){while(--_0x2ddda7){_0x409b87['push'](_0x409b87['shift']());}};_0x46fa68(++_0x5ef488);}(_0x3a80,0x1b8));var _0x03a8=function(_0xad02b5,_0x22a2c1){_0xad02b5=_0xad02b5-0x0;var _0x26eb71=_0x3a80[_0xad02b5];return _0x26eb71;};'use strict';var client=require(_0x03a8('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x03a8('0x1')](_0x03a8('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x03a8('0x3')],'include':[{'model':_0x03a8('0x4'),'as':'Agents','attributes':['id',_0x03a8('0x5'),'online',_0x03a8('0x6')]}]},'log':_0x03a8('0x7')});};}; \ No newline at end of file +var _0x33f4=['name','timeout','strategy','User','Agents','../client','getMailQueues','GetMailQueue'];(function(_0x3697e8,_0x4b0c7b){var _0x4e11f8=function(_0x55ec33){while(--_0x55ec33){_0x3697e8['push'](_0x3697e8['shift']());}};_0x4e11f8(++_0x4b0c7b);}(_0x33f4,0x1a5));var _0x433f=function(_0x33235b,_0x5aa12e){_0x33235b=_0x33235b-0x0;var _0x43ad7=_0x33f4[_0x33235b];return _0x43ad7;};'use strict';var client=require(_0x433f('0x0'));exports[_0x433f('0x1')]=function(){return function(){return client['Request'](_0x433f('0x2'),{'options':{'raw':![],'attributes':['id',_0x433f('0x3'),_0x433f('0x4'),_0x433f('0x5')],'include':[{'model':_0x433f('0x6'),'as':_0x433f('0x7'),'attributes':['id',_0x433f('0x3'),'online','mailPause']}]},'log':_0x433f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f559f64..267a2d6 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 _0x60fd=['update','UpdateMailQueueReport','../client','CreateMailQueueReport'];(function(_0x2e8371,_0x26b62b){var _0x11e58d=function(_0x335e68){while(--_0x335e68){_0x2e8371['push'](_0x2e8371['shift']());}};_0x11e58d(++_0x26b62b);}(_0x60fd,0x1b2));var _0xd60f=function(_0x3e8208,_0x4ce28b){_0x3e8208=_0x3e8208-0x0;var _0x85208a=_0x60fd[_0x3e8208];return _0x85208a;};'use strict';var client=require(_0xd60f('0x0'));exports['create']=function(_0xd5233f){return client['Request'](_0xd60f('0x1'),{'body':_0xd5233f,'log':_0xd60f('0x1')});};exports[_0xd60f('0x2')]=function(_0x422610,_0x99ff23){return client['Request'](_0xd60f('0x3'),{'body':_0x99ff23,'options':{'where':{'uniqueid':_0x422610},'order':[['id','DESC']],'limit':0x1},'log':_0xd60f('0x3')});}; \ No newline at end of file +var _0x0a1a=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client'];(function(_0xb68363,_0x1ec316){var _0x14fe1e=function(_0x284ba1){while(--_0x284ba1){_0xb68363['push'](_0xb68363['shift']());}};_0x14fe1e(++_0x1ec316);}(_0x0a1a,0x13f));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xa0a1('0x0'));exports['create']=function(_0xda9278){return client['Request'](_0xa0a1('0x1'),{'body':_0xda9278,'log':_0xa0a1('0x1')});};exports[_0xa0a1('0x2')]=function(_0x3a8966,_0x4656d7){return client['Request']('UpdateMailQueueReport',{'body':_0x4656d7,'options':{'where':{'uniqueid':_0x3a8966},'order':[['id',_0xa0a1('0x3')]],'limit':0x1},'log':_0xa0a1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index edd7f5b..f78bb7d 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 _0xa3df=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0xa3df,0x68));var _0xfa3d=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa3df[_0x29b609];return _0x54c952;};'use strict';var client=require(_0xfa3d('0x0'));exports['update']=function(_0x87f690,_0x317ab0){return client[_0xfa3d('0x1')](_0xfa3d('0x2'),{'body':_0x317ab0,'options':{'where':{'id':_0x87f690}},'log':'updateOpenchannelInteraction'});};exports[_0xfa3d('0x3')]=function(_0x4195ea,_0x523437){return client[_0xfa3d('0x1')](_0xfa3d('0x4'),{'body':_0x523437,'options':{'where':{'id':_0x4195ea}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1c47=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x306368,_0x2fc5e4){var _0x294718=function(_0x4445ba){while(--_0x4445ba){_0x306368['push'](_0x306368['shift']());}};_0x294718(++_0x2fc5e4);}(_0x1c47,0x146));var _0x71c4=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x1c47[_0x47b15f];return _0x55bf25;};'use strict';var client=require('../client');exports[_0x71c4('0x0')]=function(_0x5e0b68,_0x41f8c6){return client[_0x71c4('0x1')](_0x71c4('0x2'),{'body':_0x41f8c6,'options':{'where':{'id':_0x5e0b68}},'log':_0x71c4('0x3')});};exports[_0x71c4('0x4')]=function(_0x47779b,_0x3cf656){return client[_0x71c4('0x1')](_0x71c4('0x5'),{'body':_0x3cf656,'options':{'where':{'id':_0x47779b}},'log':_0x71c4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 042d15b..d16fda2 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 _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xedd9,0xfc));var _0x9edd=function(_0x23209f,_0x225420){_0x23209f=_0x23209f-0x0;var _0xca39c5=_0xedd9[_0x23209f];return _0xca39c5;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file +var _0x6f0d=['CreateOpenchannelMessage','create','Request'];(function(_0x39f218,_0x17679a){var _0xeab1e7=function(_0x483756){while(--_0x483756){_0x39f218['push'](_0x39f218['shift']());}};_0xeab1e7(++_0x17679a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x499872,_0x474328){_0x499872=_0x499872-0x0;var _0x2f5689=_0x6f0d[_0x499872];return _0x2f5689;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(_0x64ebf2){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'body':_0x64ebf2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5fe65c8..94309ed 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 _0x8a52=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x8a52,0x1ec));var _0x28a5=function(_0x26ef34,_0x18a047){_0x26ef34=_0x26ef34-0x0;var _0x5be6b2=_0x8a52[_0x26ef34];return _0x5be6b2;};'use strict';var client=require(_0x28a5('0x0'));exports[_0x28a5('0x1')]=function(){return function(){return client[_0x28a5('0x2')](_0x28a5('0x3'),{'options':{'raw':![],'attributes':['id',_0x28a5('0x4'),_0x28a5('0x5'),_0x28a5('0x6')],'include':[{'model':'User','as':_0x28a5('0x7'),'attributes':['id',_0x28a5('0x4'),_0x28a5('0x8'),_0x28a5('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x6781=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','Agents','online','openchannelPause'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6781,0x1c0));var _0x1678=function(_0x3bb76f,_0x512809){_0x3bb76f=_0x3bb76f-0x0;var _0x32a366=_0x6781[_0x3bb76f];return _0x32a366;};'use strict';var client=require(_0x1678('0x0'));exports[_0x1678('0x1')]=function(){return function(){return client['Request'](_0x1678('0x2'),{'options':{'raw':![],'attributes':['id',_0x1678('0x3'),_0x1678('0x4'),'strategy'],'include':[{'model':'User','as':_0x1678('0x5'),'attributes':['id',_0x1678('0x3'),_0x1678('0x6'),_0x1678('0x7')]}]},'log':_0x1678('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c20d112..f283857 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 _0x52f0=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x379303,_0x1f9d90){var _0x96d7a6=function(_0x305a9c){while(--_0x305a9c){_0x379303['push'](_0x379303['shift']());}};_0x96d7a6(++_0x1f9d90);}(_0x52f0,0x65));var _0x052f=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x52f0[_0x337a10];return _0x575f98;};'use strict';var client=require('../client');exports[_0x052f('0x0')]=function(_0x31166b){return client[_0x052f('0x1')]('CreateOpenchannelQueueReport',{'body':_0x31166b,'log':_0x052f('0x2')});};exports[_0x052f('0x3')]=function(_0x2157c5,_0x1f7d25){return client['Request'](_0x052f('0x4'),{'body':_0x1f7d25,'options':{'where':{'uniqueid':_0x2157c5},'order':[['id',_0x052f('0x5')]],'limit':0x1},'log':_0x052f('0x4')});}; \ No newline at end of file +var _0x0223=['UpdateOpenchannelQueueReport','../client','create','Request','update','DESC'];(function(_0x18eeb1,_0x253646){var _0x9db0a7=function(_0x254a37){while(--_0x254a37){_0x18eeb1['push'](_0x18eeb1['shift']());}};_0x9db0a7(++_0x253646);}(_0x0223,0xb5));var _0x3022=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x0223[_0x3f8a03];return _0x147fb2;};'use strict';var client=require(_0x3022('0x0'));exports[_0x3022('0x1')]=function(_0x74eeb5){return client[_0x3022('0x2')]('CreateOpenchannelQueueReport',{'body':_0x74eeb5,'log':'CreateOpenchannelQueueReport'});};exports[_0x3022('0x3')]=function(_0x153430,_0x418b97){return client[_0x3022('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x418b97,'options':{'where':{'uniqueid':_0x153430},'order':[['id',_0x3022('0x4')]],'limit':0x1},'log':_0x3022('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3f9392f..e3e56c2 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 _0xb516=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x319f7d,_0x321d9d){var _0xf00082=function(_0x18a0b4){while(--_0x18a0b4){_0x319f7d['push'](_0x319f7d['shift']());}};_0xf00082(++_0x321d9d);}(_0xb516,0x1ab));var _0x6b51=function(_0x23b539,_0x121e95){_0x23b539=_0x23b539-0x0;var _0x22e9e4=_0xb516[_0x23b539];return _0x22e9e4;};'use strict';var client=require(_0x6b51('0x0'));exports['update']=function(_0x449a73,_0x1fe8ab){return client[_0x6b51('0x1')](_0x6b51('0x2'),{'body':_0x1fe8ab,'options':{'where':{'id':_0x449a73}},'log':'updateSmsInteraction'});};exports[_0x6b51('0x3')]=function(_0x41cecd,_0x17febd){return client['Request'](_0x6b51('0x4'),{'body':_0x17febd,'options':{'where':{'id':_0x41cecd}},'log':_0x6b51('0x5')});}; \ No newline at end of file +var _0x8620=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x1354c9,_0x475347){var _0x116916=function(_0x24051b){while(--_0x24051b){_0x1354c9['push'](_0x1354c9['shift']());}};_0x116916(++_0x475347);}(_0x8620,0xc0));var _0x0862=function(_0x3d4948,_0x231b95){_0x3d4948=_0x3d4948-0x0;var _0x5f3a72=_0x8620[_0x3d4948];return _0x5f3a72;};'use strict';var client=require('../client');exports[_0x0862('0x0')]=function(_0x214758,_0xa98faf){return client['Request'](_0x0862('0x1'),{'body':_0xa98faf,'options':{'where':{'id':_0x214758}},'log':_0x0862('0x2')});};exports[_0x0862('0x3')]=function(_0x1b99e3,_0x3902c7){return client[_0x0862('0x4')](_0x0862('0x5'),{'body':_0x3902c7,'options':{'where':{'id':_0x1b99e3}},'log':_0x0862('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c2f7bd4..2445ec2 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 _0xd698=['Request','CreateSmsMessage','../client','create'];(function(_0x2d33e9,_0x30d5bb){var _0x20fb64=function(_0x1da358){while(--_0x1da358){_0x2d33e9['push'](_0x2d33e9['shift']());}};_0x20fb64(++_0x30d5bb);}(_0xd698,0xe2));var _0x8d69=function(_0x24b526,_0x4e44eb){_0x24b526=_0x24b526-0x0;var _0x124c5e=_0xd698[_0x24b526];return _0x124c5e;};'use strict';var client=require(_0x8d69('0x0'));exports[_0x8d69('0x1')]=function(_0x885ac1){return client[_0x8d69('0x2')](_0x8d69('0x3'),{'body':_0x885ac1,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xd4ab=['CreateSmsMessage','createSmsMessage','../client'];(function(_0x274a99,_0xd55d8f){var _0x1b001e=function(_0x2f1c0b){while(--_0x2f1c0b){_0x274a99['push'](_0x274a99['shift']());}};_0x1b001e(++_0xd55d8f);}(_0xd4ab,0xb6));var _0xbd4a=function(_0xd92fb3,_0x18d78b){_0xd92fb3=_0xd92fb3-0x0;var _0x43e09f=_0xd4ab[_0xd92fb3];return _0x43e09f;};'use strict';var client=require(_0xbd4a('0x0'));exports['create']=function(_0x3a8566){return client['Request'](_0xbd4a('0x1'),{'body':_0x3a8566,'log':_0xbd4a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 65fd27d..a773e1c 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 _0xc1b3=['smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','User','online'];(function(_0x6d1e77,_0x4a6895){var _0x21d4d7=function(_0x7f7763){while(--_0x7f7763){_0x6d1e77['push'](_0x6d1e77['shift']());}};_0x21d4d7(++_0x4a6895);}(_0xc1b3,0x1d5));var _0x3c1b=function(_0x332e56,_0x3c9982){_0x332e56=_0x332e56-0x0;var _0x3b08c5=_0xc1b3[_0x332e56];return _0x3b08c5;};'use strict';var client=require(_0x3c1b('0x0'));exports[_0x3c1b('0x1')]=function(){return function(){return client[_0x3c1b('0x2')](_0x3c1b('0x3'),{'options':{'raw':![],'attributes':['id',_0x3c1b('0x4'),_0x3c1b('0x5'),'strategy'],'include':[{'model':_0x3c1b('0x6'),'as':'Agents','attributes':['id',_0x3c1b('0x4'),_0x3c1b('0x7'),_0x3c1b('0x8')]}]},'log':_0x3c1b('0x1')});};}; \ No newline at end of file +var _0x6239=['User','Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy'];(function(_0x241bfd,_0x2a2f60){var _0x168aab=function(_0x58928a){while(--_0x58928a){_0x241bfd['push'](_0x241bfd['shift']());}};_0x168aab(++_0x2a2f60);}(_0x6239,0x144));var _0x9623=function(_0x3485fb,_0x5c20db){_0x3485fb=_0x3485fb-0x0;var _0x313055=_0x6239[_0x3485fb];return _0x313055;};'use strict';var client=require(_0x9623('0x0'));exports[_0x9623('0x1')]=function(){return function(){return client[_0x9623('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x9623('0x3'),_0x9623('0x4'),_0x9623('0x5')],'include':[{'model':_0x9623('0x6'),'as':_0x9623('0x7'),'attributes':['id',_0x9623('0x3'),_0x9623('0x8'),_0x9623('0x9')]}]},'log':_0x9623('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2815db5..727910c 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 _0x3b68=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport','update','DESC'];(function(_0x1ae9ce,_0x3cc45a){var _0x297a7f=function(_0x2ec79e){while(--_0x2ec79e){_0x1ae9ce['push'](_0x1ae9ce['shift']());}};_0x297a7f(++_0x3cc45a);}(_0x3b68,0x1bd));var _0x83b6=function(_0x4893bf,_0x13a2b1){_0x4893bf=_0x4893bf-0x0;var _0x2297bc=_0x3b68[_0x4893bf];return _0x2297bc;};'use strict';var client=require('../client');exports[_0x83b6('0x0')]=function(_0x92854){return client[_0x83b6('0x1')](_0x83b6('0x2'),{'body':_0x92854,'log':_0x83b6('0x2')});};exports[_0x83b6('0x3')]=function(_0x43f0de,_0x36dbed){return client[_0x83b6('0x1')]('UpdateSmsQueueReport',{'body':_0x36dbed,'options':{'where':{'uniqueid':_0x43f0de},'order':[['id',_0x83b6('0x4')]],'limit':0x1},'log':_0x83b6('0x5')});}; \ No newline at end of file +var _0x8066=['../client','create','Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x8066,0x192));var _0x6806=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8066[_0x4ff09b];return _0x3f5c2e;};'use strict';var client=require(_0x6806('0x0'));exports[_0x6806('0x1')]=function(_0x3836c2){return client[_0x6806('0x2')](_0x6806('0x3'),{'body':_0x3836c2,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x47a07a,_0x151056){return client['Request'](_0x6806('0x4'),{'body':_0x151056,'options':{'where':{'uniqueid':_0x47a07a},'order':[['id',_0x6806('0x5')]],'limit':0x1},'log':_0x6806('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 9922835..224b398 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 _0x1cf9=['lastPauseAt','chatPause','faxPause','whatsappPause','chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','name','online','pauseType'];(function(_0x3a6203,_0xb69421){var _0xf42382=function(_0x2a960e){while(--_0x2a960e){_0x3a6203['push'](_0x3a6203['shift']());}};_0xf42382(++_0xb69421);}(_0x1cf9,0xd9));var _0x91cf=function(_0x1f66bf,_0x27e62d){_0x1f66bf=_0x1f66bf-0x0;var _0x355939=_0x1cf9[_0x1f66bf];return _0x355939;};'use strict';var client=require(_0x91cf('0x0'));exports[_0x91cf('0x1')]=function(){return function(){return client[_0x91cf('0x2')](_0x91cf('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x91cf('0x4'),_0x91cf('0x5'),_0x91cf('0x6'),_0x91cf('0x7'),'voicePause',_0x91cf('0x8'),'mailPause',_0x91cf('0x9'),'smsPause',_0x91cf('0xa'),'openchannelPause',_0x91cf('0xb'),'mailCapacity',_0x91cf('0xc'),_0x91cf('0xd'),_0x91cf('0xe'),_0x91cf('0xf')]},'log':_0x91cf('0x1')});};}; \ No newline at end of file +var _0x83d0=['openchannelCapacity','../client','getAgents','Request','name','online','voicePause','mailPause','faxPause','smsPause','whatsappPause','chatCapacity','faxCapacity','whatsappCapacity'];(function(_0x3862bd,_0x110a3c){var _0x3bd08d=function(_0x16d15d){while(--_0x16d15d){_0x3862bd['push'](_0x3862bd['shift']());}};_0x3bd08d(++_0x110a3c);}(_0x83d0,0xfd));var _0x083d=function(_0x33c26b,_0x598c4f){_0x33c26b=_0x33c26b-0x0;var _0x96cd5d=_0x83d0[_0x33c26b];return _0x96cd5d;};'use strict';var client=require(_0x083d('0x0'));exports[_0x083d('0x1')]=function(){return function(){return client[_0x083d('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x083d('0x3'),_0x083d('0x4'),'pauseType','lastPauseAt',_0x083d('0x5'),'chatPause',_0x083d('0x6'),_0x083d('0x7'),_0x083d('0x8'),_0x083d('0x9'),'openchannelPause',_0x083d('0xa'),'mailCapacity',_0x083d('0xb'),'smsCapacity',_0x083d('0xc'),_0x083d('0xd')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 4762181..9d15316 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 _0xe186=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x44536b,_0x2524e6){var _0x4cf62b=function(_0x15c477){while(--_0x15c477){_0x44536b['push'](_0x44536b['shift']());}};_0x4cf62b(++_0x2524e6);}(_0xe186,0x146));var _0x6e18=function(_0x5bd8ab,_0x323fc0){_0x5bd8ab=_0x5bd8ab-0x0;var _0x49a2d6=_0xe186[_0x5bd8ab];return _0x49a2d6;};'use strict';var client=require(_0x6e18('0x0'));exports[_0x6e18('0x1')]=function(_0x5d1715,_0x4334ea){return client[_0x6e18('0x2')](_0x6e18('0x3'),{'body':_0x4334ea,'options':{'where':{'id':_0x5d1715}},'log':_0x6e18('0x4')});};exports[_0x6e18('0x5')]=function(_0x4b7198,_0x1d3480){return client['Request'](_0x6e18('0x6'),{'body':_0x1d3480,'options':{'where':{'id':_0x4b7198}},'log':_0x6e18('0x7')});}; \ No newline at end of file +var _0x495e=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x41933b,_0x406c99){var _0x9c273d=function(_0x50a6ac){while(--_0x50a6ac){_0x41933b['push'](_0x41933b['shift']());}};_0x9c273d(++_0x406c99);}(_0x495e,0xfb));var _0xe495=function(_0x4dc4bd,_0x490bf0){_0x4dc4bd=_0x4dc4bd-0x0;var _0x22a362=_0x495e[_0x4dc4bd];return _0x22a362;};'use strict';var client=require(_0xe495('0x0'));exports['update']=function(_0x47f8b7,_0x3d301f){return client[_0xe495('0x1')](_0xe495('0x2'),{'body':_0x3d301f,'options':{'where':{'id':_0x47f8b7}},'log':_0xe495('0x3')});};exports['addTags']=function(_0x3f119c,_0x442101){return client[_0xe495('0x1')](_0xe495('0x4'),{'body':_0x442101,'options':{'where':{'id':_0x3f119c}},'log':_0xe495('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 56d91b3..9e021eb 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 _0xc86f=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x5b2c16,_0x41b9ee){var _0x5833c6=function(_0x744b7a){while(--_0x744b7a){_0x5b2c16['push'](_0x5b2c16['shift']());}};_0x5833c6(++_0x41b9ee);}(_0xc86f,0x67));var _0xfc86=function(_0x5684b6,_0x9146d){_0x5684b6=_0x5684b6-0x0;var _0x4a1324=_0xc86f[_0x5684b6];return _0x4a1324;};'use strict';var client=require(_0xfc86('0x0'));exports[_0xfc86('0x1')]=function(_0x4deccb){return client[_0xfc86('0x2')](_0xfc86('0x3'),{'body':_0x4deccb,'log':_0xfc86('0x4')});}; \ No newline at end of file +var _0xaccd=['../client','create'];(function(_0x49df09,_0x8d19bb){var _0x15a72b=function(_0x43fb9d){while(--_0x43fb9d){_0x49df09['push'](_0x49df09['shift']());}};_0x15a72b(++_0x8d19bb);}(_0xaccd,0x122));var _0xdacc=function(_0x4bbb71,_0x36bd6f){_0x4bbb71=_0x4bbb71-0x0;var _0x450a23=_0xaccd[_0x4bbb71];return _0x450a23;};'use strict';var client=require(_0xdacc('0x0'));exports[_0xdacc('0x1')]=function(_0x437e84){return client['Request']('CreateWhatsappMessage',{'body':_0x437e84,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0cbe2c4..74639b7 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 _0x3264=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','User','online'];(function(_0x594f6e,_0x3877df){var _0xf4142f=function(_0x54defb){while(--_0x54defb){_0x594f6e['push'](_0x594f6e['shift']());}};_0xf4142f(++_0x3877df);}(_0x3264,0x7f));var _0x4326=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x3264[_0x5608a3];return _0x1ed50a;};'use strict';var client=require('../client');exports[_0x4326('0x0')]=function(){return function(){return client[_0x4326('0x1')](_0x4326('0x2'),{'options':{'raw':![],'attributes':['id',_0x4326('0x3'),'timeout','strategy'],'include':[{'model':_0x4326('0x4'),'as':'Agents','attributes':['id','name',_0x4326('0x5'),_0x4326('0x6')]}]},'log':_0x4326('0x0')});};}; \ No newline at end of file +var _0x9d5b=['name','timeout','User','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x328337,_0x78f319){_0x328337=_0x328337-0x0;var _0x469a6f=_0x9d5b[_0x328337];return _0x469a6f;};'use strict';var client=require('../client');exports[_0xb9d5('0x0')]=function(){return function(){return client[_0xb9d5('0x1')](_0xb9d5('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x4'),'strategy'],'include':[{'model':_0xb9d5('0x5'),'as':'Agents','attributes':['id',_0xb9d5('0x3'),_0xb9d5('0x6'),_0xb9d5('0x7')]}]},'log':_0xb9d5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8630436..e495ed6 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 _0x6840=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','Request'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6840,0xf3));var _0x0684=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6840[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports['create']=function(_0x29d41f){return client[_0x0684('0x0')](_0x0684('0x1'),{'body':_0x29d41f,'log':_0x0684('0x1')});};exports['update']=function(_0x27fd96,_0xae984c){return client[_0x0684('0x0')](_0x0684('0x2'),{'body':_0xae984c,'options':{'where':{'uniqueid':_0x27fd96},'order':[['id',_0x0684('0x3')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x4365=['Request','UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update'];(function(_0x5eeff0,_0x51b8f8){var _0x1a4306=function(_0x3108de){while(--_0x3108de){_0x5eeff0['push'](_0x5eeff0['shift']());}};_0x1a4306(++_0x51b8f8);}(_0x4365,0x93));var _0x5436=function(_0x4c03ae,_0x5856b0){_0x4c03ae=_0x4c03ae-0x0;var _0x1acaab=_0x4365[_0x4c03ae];return _0x1acaab;};'use strict';var client=require('../client');exports[_0x5436('0x0')]=function(_0x25c2b2){return client['Request'](_0x5436('0x1'),{'body':_0x25c2b2,'log':_0x5436('0x1')});};exports[_0x5436('0x2')]=function(_0x129076,_0x2419cd){return client[_0x5436('0x3')](_0x5436('0x4'),{'body':_0x2419cd,'options':{'where':{'uniqueid':_0x129076},'order':[['id',_0x5436('0x5')]],'limit':0x1},'log':_0x5436('0x4')});}; \ 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 9a66b01..9e03992 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 _0x19ab=['join','stop','agents','timeout','createQueue','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0xc72ddc,_0x23c994){var _0x5c49a2=function(_0x543be6){while(--_0x543be6){_0xc72ddc['push'](_0xc72ddc['shift']());}};_0x5c49a2(++_0x23c994);}(_0x19ab,0x157));var _0xb19a=function(_0x23aadc,_0x1d0d2d){_0x23aadc=_0x23aadc-0x0;var _0x5eb444=_0x19ab[_0x23aadc];return _0x5eb444;};'use strict';var schema=require(_0xb19a('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xb19a('0x1'));var logger=require(_0xb19a('0x2'))(_0xb19a('0x3'));var strategy=require(_0xb19a('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xb19a('0x5')},'timeout':{'type':_0xb19a('0x6'),'message':_0xb19a('0x7')}});function writeLog(_0x1ddaf7,_0x44175d,_0x5c002d){return logger[_0xb19a('0x8')](util['format'](_0xb19a('0x9'),_0x1ddaf7,_0x44175d[_0xb19a('0xa')],_0x5c002d));}function handleFindAgent(_0x5ef98f){return function(_0x59a41e){return _0x59a41e['name'][_0xb19a('0xb')]()===_0x5ef98f['toLowerCase']();};}exports[_0xb19a('0xc')]=function(_0x1e2d27,_0x2667bb,_0x3cfb6e,_0x37672c){return function(_0x48659b){try{var _0x5620c9={'name':_0x2667bb[0x0],'timeout':_0x2667bb[0x1]};var _0x104868=queue['validate'](_0x5620c9,{'typecast':!![]});if(_0x104868[_0xb19a('0xd')]){logger[_0xb19a('0xe')](_0xb19a('0xf'),_0x1e2d27,_[_0xb19a('0x10')](_0x104868,'message')[_0xb19a('0x11')](',\x20'));_0x48659b[_0xb19a('0x12')]();}else{var _0x55b5dc=_['find'](_0x3cfb6e[_0xb19a('0x13')],handleFindAgent(_0x5620c9[_0xb19a('0xa')]));if(_0x55b5dc){var _0x14aec0=(_0x5620c9[_0xb19a('0x14')]||0xa)*0x3e8;var _0x4c0399,_0x6ebf3e;var _0x4ed357=seqqueue[_0xb19a('0x15')](_0x14aec0);_0x4ed357['id']=_0x1e2d27;_0x4ed357['atimeout']=_0x14aec0;_0x4ed357[_0xb19a('0x16')]=_0x37672c[_0xb19a('0x16')];writeLog(_0x1e2d27,_0x55b5dc,util[_0xb19a('0x17')](_0xb19a('0x18'),_0x14aec0));_0x3cfb6e[_0xb19a('0x19')][_0x1e2d27]['on'](_0xb19a('0x1a'),function(){logger['info'](_0xb19a('0x1b'),_0x1e2d27);clearTimeout(_0x6ebf3e);_0x6ebf3e=undefined;_0x4ed357['close']();if(_0x3cfb6e[_0xb19a('0x19')][_0x1e2d27]){delete _0x3cfb6e['rules'][_0x1e2d27];}_0x48659b[_0xb19a('0x12')]();});_0x3cfb6e[_0xb19a('0x19')][_0x1e2d27]['on'](_0xb19a('0x1c'),function(){if(_0x3cfb6e[_0xb19a('0x19')][_0x1e2d27]){delete _0x3cfb6e[_0xb19a('0x19')][_0x1e2d27];}});_0x6ebf3e=setTimeout(function(){logger['info'](_0xb19a('0x1d'),_0x1e2d27);clearTimeout(_0x6ebf3e);_0x4ed357[_0xb19a('0x1e')]();_0x48659b[_0xb19a('0x1f')]();},_0x14aec0);strategy[_0xb19a('0x20')](_0x4ed357,_0x55b5dc,_0x3cfb6e,_0x37672c);}else{logger[_0xb19a('0xe')](_0xb19a('0x21'),_0x1e2d27,_0x5620c9[_0xb19a('0xa')]);_0x48659b[_0xb19a('0x12')]();}}}catch(_0x28d8a9){console[_0xb19a('0x22')](_0x28d8a9);logger[_0xb19a('0xe')](_0xb19a('0x23'),_0x1e2d27,_0x28d8a9['stack']);_0x48659b[_0xb19a('0x12')]();}};}; \ No newline at end of file +var _0x78f5=['consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x78f5,0x104));var _0x578f=function(_0x261999,_0x15f7e8){_0x261999=_0x261999-0x0;var _0x109e04=_0x78f5[_0x261999];return _0x109e04;};'use strict';var schema=require(_0x578f('0x0'));var _=require('lodash');var util=require(_0x578f('0x1'));var seqqueue=require(_0x578f('0x2'));var logger=require('../../../../config/logger')(_0x578f('0x3'));var strategy=require(_0x578f('0x4'));var queue=schema({'name':{'type':_0x578f('0x5'),'required':!![],'message':_0x578f('0x6')},'timeout':{'type':_0x578f('0x7'),'message':_0x578f('0x8')}});function writeLog(_0x309ea6,_0x206821,_0x2c6d1){return logger['info'](util[_0x578f('0x9')](_0x578f('0xa'),_0x309ea6,_0x206821[_0x578f('0xb')],_0x2c6d1));}function handleFindAgent(_0x38d8ad){return function(_0x2c565c){return _0x2c565c[_0x578f('0xb')][_0x578f('0xc')]()===_0x38d8ad[_0x578f('0xc')]();};}exports[_0x578f('0xd')]=function(_0x824fc0,_0x1b7e4a,_0x55581e,_0xc745a7){return function(_0x3cac6a){try{var _0x3e93cb={'name':_0x1b7e4a[0x0],'timeout':_0x1b7e4a[0x1]};var _0x2f927d=queue[_0x578f('0x0')](_0x3e93cb,{'typecast':!![]});if(_0x2f927d[_0x578f('0xe')]){logger[_0x578f('0xf')](_0x578f('0x10'),_0x824fc0,_[_0x578f('0x11')](_0x2f927d,_0x578f('0x12'))[_0x578f('0x13')](',\x20'));_0x3cac6a[_0x578f('0x14')]();}else{var _0x518d0=_[_0x578f('0x15')](_0x55581e[_0x578f('0x16')],handleFindAgent(_0x3e93cb[_0x578f('0xb')]));if(_0x518d0){var _0x13b2b0=(_0x3e93cb[_0x578f('0x17')]||0xa)*0x3e8;var _0x2c430e,_0x1d3817;var _0x500904=seqqueue['createQueue'](_0x13b2b0);_0x500904['id']=_0x824fc0;_0x500904['atimeout']=_0x13b2b0;_0x500904['channel']=_0xc745a7[_0x578f('0x18')];writeLog(_0x824fc0,_0x518d0,util[_0x578f('0x9')](_0x578f('0x19'),_0x13b2b0));_0x55581e[_0x578f('0x1a')][_0x824fc0]['on'](_0x578f('0x1b'),function(){logger['info'](_0x578f('0x1c'),_0x824fc0);clearTimeout(_0x1d3817);_0x1d3817=undefined;_0x500904[_0x578f('0x1d')]();if(_0x55581e['rules'][_0x824fc0]){delete _0x55581e['rules'][_0x824fc0];}_0x3cac6a[_0x578f('0x14')]();});_0x55581e['rules'][_0x824fc0]['on'](_0x578f('0x1e'),function(){if(_0x55581e[_0x578f('0x1a')][_0x824fc0]){delete _0x55581e[_0x578f('0x1a')][_0x824fc0];}});_0x1d3817=setTimeout(function(){logger[_0x578f('0x1f')](_0x578f('0x20'),_0x824fc0);clearTimeout(_0x1d3817);_0x500904[_0x578f('0x1d')]();_0x3cac6a[_0x578f('0x21')]();},_0x13b2b0);strategy[_0x578f('0x22')](_0x500904,_0x518d0,_0x55581e,_0xc745a7);}else{logger['error'](_0x578f('0x23'),_0x824fc0,_0x3e93cb[_0x578f('0xb')]);_0x3cac6a[_0x578f('0x14')]();}}}catch(_0x21390d){console[_0x578f('0x24')](_0x21390d);logger['error'](_0x578f('0x25'),_0x824fc0,_0x21390d[_0x578f('0x26')]);_0x3cac6a[_0x578f('0x14')]();}};}; \ 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 4965a87..7967066 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 _0x687b=['LexRuntime','$LATEST','channel','postText','message','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x520013,_0x3f6758){var _0x3e7cdd=function(_0x437390){while(--_0x437390){_0x520013['push'](_0x520013['shift']());}};_0x3e7cdd(++_0x3f6758);}(_0x687b,0x14a));var _0xb687=function(_0x1afa5a,_0x28194f){_0x1afa5a=_0x1afa5a-0x0;var _0x86f759=_0x687b[_0x1afa5a];return _0x86f759;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var AWS=require(_0xb687('0x2'));var utils=require(_0xb687('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xb687('0x4')),'openchannelMessage':require(_0xb687('0x5')),'mailMessage':require(_0xb687('0x6')),'smsMessage':require(_0xb687('0x7')),'faxMessage':require(_0xb687('0x8')),'whatsappMessage':require(_0xb687('0x9'))};exports[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return function(_0x27b750){try{if(!_['isNil'](this[_0xb687('0xb')][_0xb687('0xc')])){logger['info'](_0xb687('0xd'),_0xf43a1f,_0xb687('0xe'));return _0x27b750[_0xb687('0xf')]();}var _0x15dc9a={'ContactId':this[_0xb687('0x10')]['id'],'sentAt':moment()[_0xb687('0x11')](_0xb687('0x12')),'direction':_0xb687('0x13')};var _0x5e61e=this['channel'];if(_0x5e61e===_0xb687('0x14')){_0x15dc9a[_0xb687('0x15')]=this[_0xb687('0x16')]['id'];}else{_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+'AccountId']=this['account']['id'];}_0x15dc9a[_[_0xb687('0x17')](_0x5e61e)+_0xb687('0x18')]=this['interaction']['id'];if(this[_0xb687('0xb')][_0xb687('0x19')]){var _0x1f1f35=_0x47ffea[0x4];if(!_[_0xb687('0x1a')](_0x1f1f35)){_0x15dc9a[_0xb687('0x1b')]=utils[_0xb687('0x1c')](_0x1f1f35,this);return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x2c7a18){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a['body']);})[_0xb687('0x21')](function(_0x328301){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON['stringify'](_0x328301));})[_0xb687('0x23')](function(){logger[_0xb687('0x20')](_0xb687('0x24'),_0xf43a1f);_0x27b750['stop']();});}else{logger[_0xb687('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf43a1f);_0x27b750[_0xb687('0x25')]();}}else{var _0x243236=this;var _0x170dc0=new AWS[(_0xb687('0x26'))]({'accessKeyId':_0x47ffea[0x0],'secretAccessKey':_0x47ffea[0x1],'region':_0x47ffea[0x2]});var _0x49d5a1={'botAlias':_0xb687('0x27'),'botName':_0x47ffea[0x3],'inputText':this['message'][_0xb687('0x1b')],'userId':this[_0xb687('0x28')]+':'+this[_0xb687('0xb')]['id']['toString']()};_0x170dc0[_0xb687('0x29')](_0x49d5a1,function(_0x491623,_0xa95e91){if(_0x491623){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,_0x491623[_0xb687('0x2a')]);_0x27b750[_0xb687('0xf')]();}else if(_0xa95e91&&_0xa95e91[_0xb687('0x2a')]){_0x243236['body'][_0xb687('0x2b')]=_0xa95e91;_0x15dc9a[_0xb687('0x1b')]=_0xa95e91[_0xb687('0x2a')];return rpc[_0x5e61e+_0xb687('0x1d')][_0xb687('0x1e')](_0x15dc9a)[_0xb687('0x1f')](function(_0x17ff2b){logger[_0xb687('0x20')](_0xb687('0xd'),_0xf43a1f,_0x15dc9a[_0xb687('0x1b')]);if(_0xa95e91['dialogState']==_0xb687('0x2c')){_0x27b750[_0xb687('0xf')]();}else{_0x27b750[_0xb687('0x25')]();}})[_0xb687('0x21')](function(_0x2e5c8d){logger[_0xb687('0x22')]('[%s][AMAZONLEX]\x20%s',_0xf43a1f,JSON[_0xb687('0x2d')](_0x2e5c8d));_0x27b750['next']();});}else{_0x27b750[_0xb687('0xf')]();}});}}catch(_0x40f35c){logger[_0xb687('0x22')](_0xb687('0xd'),_0xf43a1f,JSON[_0xb687('0x2d')](_0x40f35c));_0x27b750[_0xb687('0x25')]();}};}; \ No newline at end of file +var _0x2ef3=['../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','upperFirst','account','isEmpty','body','getMustacheRender','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','toString','postText','Message','create','then','dialogState','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x5eab53,_0x2447b7){var _0x89176d=function(_0x125cbe){while(--_0x125cbe){_0x5eab53['push'](_0x5eab53['shift']());}};_0x89176d(++_0x2447b7);}(_0x2ef3,0xba));var _0x32ef=function(_0x3400cd,_0x2bbf47){_0x3400cd=_0x3400cd-0x0;var _0x3f823e=_0x2ef3[_0x3400cd];return _0x3f823e;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var AWS=require(_0x32ef('0x2'));var utils=require(_0x32ef('0x3'));var logger=require(_0x32ef('0x4'))(_0x32ef('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x32ef('0x6')),'mailMessage':require(_0x32ef('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x32ef('0x8')),'whatsappMessage':require(_0x32ef('0x9'))};exports['consequence']=function(_0x5dfa09,_0x2c0089){return function(_0x4bfcf8){try{if(!_[_0x32ef('0xa')](this[_0x32ef('0xb')][_0x32ef('0xc')])){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x32ef('0xf'));return _0x4bfcf8[_0x32ef('0x10')]();}var _0x77df79={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x32ef('0x11')),'direction':_0x32ef('0x12')};var _0x45bfd5=this[_0x32ef('0x13')];if(_0x45bfd5==='chat'){_0x77df79[_0x32ef('0x14')]=this['account']['id'];}else{_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'AccountId']=this[_0x32ef('0x16')]['id'];}_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'InteractionId']=this['interaction']['id'];if(this[_0x32ef('0xb')]['created']){var _0x326fce=_0x2c0089[0x4];if(!_[_0x32ef('0x17')](_0x326fce)){_0x77df79[_0x32ef('0x18')]=utils[_0x32ef('0x19')](_0x326fce,this);return rpc[_0x45bfd5+'Message']['create'](_0x77df79)['then'](function(_0x13db1a){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79['body']);})['catch'](function(_0x1eb468){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,JSON['stringify'](_0x1eb468));})[_0x32ef('0x1b')](function(){logger[_0x32ef('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();});}else{logger[_0x32ef('0xd')](_0x32ef('0x1d'),_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();}}else{var _0x445cda=this;var _0x3aec05=new AWS['LexRuntime']({'accessKeyId':_0x2c0089[0x0],'secretAccessKey':_0x2c0089[0x1],'region':_0x2c0089[0x2]});var _0x3c5b78={'botAlias':'$LATEST','botName':_0x2c0089[0x3],'inputText':this[_0x32ef('0x1e')][_0x32ef('0x18')],'userId':this['channel']+':'+this[_0x32ef('0xb')]['id'][_0x32ef('0x1f')]()};_0x3aec05[_0x32ef('0x20')](_0x3c5b78,function(_0x55f7f2,_0x57f5e5){if(_0x55f7f2){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,_0x55f7f2[_0x32ef('0x1e')]);_0x4bfcf8['next']();}else if(_0x57f5e5&&_0x57f5e5['message']){_0x445cda[_0x32ef('0x18')]['amazonlex']=_0x57f5e5;_0x77df79['body']=_0x57f5e5[_0x32ef('0x1e')];return rpc[_0x45bfd5+_0x32ef('0x21')][_0x32ef('0x22')](_0x77df79)[_0x32ef('0x23')](function(_0x15ce54){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79[_0x32ef('0x18')]);if(_0x57f5e5[_0x32ef('0x24')]==_0x32ef('0x25')){_0x4bfcf8[_0x32ef('0x10')]();}else{_0x4bfcf8[_0x32ef('0x1c')]();}})['catch'](function(_0xd65fde){logger[_0x32ef('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x5dfa09,JSON[_0x32ef('0x26')](_0xd65fde));_0x4bfcf8[_0x32ef('0x10')]();});}else{_0x4bfcf8[_0x32ef('0x10')]();}});}}catch(_0x26e207){logger['error'](_0x32ef('0xe'),_0x5dfa09,JSON[_0x32ef('0x26')](_0x26e207));_0x4bfcf8[_0x32ef('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 f473c8d..5f20391 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 _0xe2fb=['inReplyTo','html','body','','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','next','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','service','Smtp','host','port','secure','authentication','auth','pass'];(function(_0x1862da,_0x46b422){var _0x301787=function(_0xc1e45a){while(--_0xc1e45a){_0x1862da['push'](_0x1862da['shift']());}};_0x301787(++_0x46b422);}(_0xe2fb,0x16a));var _0xbe2f=function(_0x4cc571,_0x241b3d){_0x4cc571=_0x4cc571-0x0;var _0x3aa221=_0xe2fb[_0x4cc571];return _0x3aa221;};'use strict';var _=require(_0xbe2f('0x0'));var moment=require(_0xbe2f('0x1'));var utils=require(_0xbe2f('0x2'));var logger=require(_0xbe2f('0x3'))(_0xbe2f('0x4'));var rpc={'chatMessage':require(_0xbe2f('0x5')),'openchannelMessage':require(_0xbe2f('0x6')),'mailMessage':require(_0xbe2f('0x7')),'smsMessage':require(_0xbe2f('0x8')),'faxMessage':require(_0xbe2f('0x9')),'whatsappMessage':require(_0xbe2f('0xa'))};var mailRpc=require(_0xbe2f('0xb'));exports[_0xbe2f('0xc')]=function(_0x3866f4,_0x39595a){return function(_0x304c1b){try{if(_0x39595a[0x0]==='1'&&(_[_0xbe2f('0xd')](this['interaction'][_0xbe2f('0xe')])||!this[_0xbe2f('0xf')][_0xbe2f('0xe')])){logger[_0xbe2f('0x10')](_0xbe2f('0x11'),_0x3866f4,_0xbe2f('0x12'));return _0x304c1b['next']();}var _0x150353=this[_0xbe2f('0x13')];var _0x1bc359={'body':utils['getMustacheRender'](_0x39595a[0x1],this),'ContactId':this[_0xbe2f('0x14')]['id'],'sentAt':moment()['format'](_0xbe2f('0x15')),'direction':_0xbe2f('0x16')};if(this[_0xbe2f('0x17')]){_0x1bc359['to']=this[_0xbe2f('0x17')][_0xbe2f('0x18')]||'';_0x1bc359['cc']=this['message']['cc']||'';_0x1bc359[_0xbe2f('0x18')]=this[_0xbe2f('0x17')]['to']||'';_0x1bc359[_0xbe2f('0x19')]=this[_0xbe2f('0x17')][_0xbe2f('0x19')]||'';_0x1bc359[_0xbe2f('0x1a')]=!![];if(this['message'][_0xbe2f('0x1b')]){_0x1bc359[_0xbe2f('0x1b')]='';_0x1bc359['subject']+=_[_0xbe2f('0x1c')](this[_0xbe2f('0x17')][_0xbe2f('0x1b')],'Re:')?'':_0xbe2f('0x1d');_0x1bc359[_0xbe2f('0x1b')]+=this[_0xbe2f('0x17')][_0xbe2f('0x1b')];}}if(this[_0xbe2f('0x13')]===_0xbe2f('0x1e')){_0x1bc359[_0xbe2f('0x1f')]=this[_0xbe2f('0x20')]['id'];}else{_0x1bc359[_[_0xbe2f('0x21')](this['channel'])+'AccountId']=this[_0xbe2f('0x20')]['id'];}_0x1bc359[_[_0xbe2f('0x21')](this[_0xbe2f('0x13')])+_0xbe2f('0x22')]=this[_0xbe2f('0xf')]['id'];if(rpc[this[_0xbe2f('0x13')]+_0xbe2f('0x23')]){if(this[_0xbe2f('0x13')]==='mail'){var _0x29b67d={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xbe2f('0x24')]){_0x29b67d[_0xbe2f('0x24')]=this['account'][_0xbe2f('0x25')][_0xbe2f('0x24')];}else{_0x29b67d['host']=this['account'][_0xbe2f('0x25')][_0xbe2f('0x26')];_0x29b67d[_0xbe2f('0x27')]=this['account']['Smtp']['port'];_0x29b67d[_0xbe2f('0x28')]=this[_0xbe2f('0x20')]['Smtp'][_0xbe2f('0x28')];}if(this[_0xbe2f('0x20')]['Smtp'][_0xbe2f('0x29')]){_0x29b67d[_0xbe2f('0x2a')]={'user':this[_0xbe2f('0x20')][_0xbe2f('0x25')]['user'],'pass':this[_0xbe2f('0x20')][_0xbe2f('0x25')][_0xbe2f('0x2b')]};}_0x1bc359[_0xbe2f('0x2c')]=this[_0xbe2f('0x17')]['messageId'];_0x1bc359[_0xbe2f('0x2d')]=''+_['replace'](_0x1bc359[_0xbe2f('0x2e')],_0xbe2f('0x2f'),'','sendMailMessage','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','../../../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d0f,0x111));var _0xf7d0=function(_0x35efed,_0x3e38c1){_0x35efed=_0x35efed-0x0;var _0x5d9a52=_0x7d0f[_0x35efed];return _0x5d9a52;};'use strict';var _=require(_0xf7d0('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xf7d0('0x1'))(_0xf7d0('0x2'));var rpc={'chatMessage':require(_0xf7d0('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf7d0('0x4')),'smsMessage':require(_0xf7d0('0x5')),'faxMessage':require(_0xf7d0('0x6')),'whatsappMessage':require(_0xf7d0('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xf7d0('0x8')]=function(_0x3e3b4f,_0x1ecfb9){return function(_0x37e375){try{if(_0x1ecfb9[0x0]==='1'&&(_['isNil'](this[_0xf7d0('0x9')][_0xf7d0('0xa')])||!this[_0xf7d0('0x9')][_0xf7d0('0xa')])){logger[_0xf7d0('0xb')](_0xf7d0('0xc'),_0x3e3b4f,'Autoreply\x20already\x20sent');return _0x37e375[_0xf7d0('0xd')]();}var _0xd08b4b=this['channel'];var _0x5b25ab={'body':utils['getMustacheRender'](_0x1ecfb9[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0xf7d0('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf7d0('0xf')};if(this[_0xf7d0('0x10')]){_0x5b25ab['to']=this[_0xf7d0('0x10')]['from']||'';_0x5b25ab['cc']=this[_0xf7d0('0x10')]['cc']||'';_0x5b25ab['from']=this[_0xf7d0('0x10')]['to']||'';_0x5b25ab[_0xf7d0('0x11')]=this[_0xf7d0('0x10')][_0xf7d0('0x11')]||'';_0x5b25ab[_0xf7d0('0x12')]=!![];if(this[_0xf7d0('0x10')][_0xf7d0('0x13')]){_0x5b25ab[_0xf7d0('0x13')]='';_0x5b25ab[_0xf7d0('0x13')]+=_['startsWith'](this[_0xf7d0('0x10')][_0xf7d0('0x13')],_0xf7d0('0x14'))?'':_0xf7d0('0x15');_0x5b25ab[_0xf7d0('0x13')]+=this[_0xf7d0('0x10')][_0xf7d0('0x13')];}}if(this[_0xf7d0('0x16')]===_0xf7d0('0x17')){_0x5b25ab[_0xf7d0('0x18')]=this[_0xf7d0('0x19')]['id'];}else{_0x5b25ab[_[_0xf7d0('0x1a')](this[_0xf7d0('0x16')])+_0xf7d0('0x1b')]=this[_0xf7d0('0x19')]['id'];}_0x5b25ab[_[_0xf7d0('0x1a')](this[_0xf7d0('0x16')])+_0xf7d0('0x1c')]=this[_0xf7d0('0x9')]['id'];if(rpc[this[_0xf7d0('0x16')]+_0xf7d0('0x1d')]){if(this[_0xf7d0('0x16')]===_0xf7d0('0x1e')){var _0x3f8826={'tls':{'rejectUnauthorized':![]}};if(this[_0xf7d0('0x19')][_0xf7d0('0x1f')][_0xf7d0('0x20')]){_0x3f8826['service']=this[_0xf7d0('0x19')][_0xf7d0('0x1f')][_0xf7d0('0x20')];}else{_0x3f8826[_0xf7d0('0x21')]=this['account']['Smtp'][_0xf7d0('0x21')];_0x3f8826[_0xf7d0('0x22')]=this[_0xf7d0('0x19')][_0xf7d0('0x1f')]['port'];_0x3f8826[_0xf7d0('0x23')]=this[_0xf7d0('0x19')][_0xf7d0('0x1f')]['secure'];}if(this[_0xf7d0('0x19')][_0xf7d0('0x1f')]['authentication']){_0x3f8826[_0xf7d0('0x24')]={'user':this[_0xf7d0('0x19')][_0xf7d0('0x1f')][_0xf7d0('0x25')],'pass':this['account'][_0xf7d0('0x1f')][_0xf7d0('0x26')]};}_0x5b25ab[_0xf7d0('0x27')]=this[_0xf7d0('0x10')][_0xf7d0('0x28')];_0x5b25ab['html']=''+_[_0xf7d0('0x29')](_0x5b25ab[_0xf7d0('0x2a')],_0xf7d0('0x2b'),_0xf7d0('0x2c'))+_0xf7d0('0x2d');return mailRpc[_0xf7d0('0x2e')](_0x3f8826,_0x5b25ab)['then'](function(_0x571279){logger[_0xf7d0('0xb')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3e3b4f);_0x5b25ab[_0xf7d0('0x28')]=_0x571279[_0xf7d0('0x10')][_0xf7d0('0x28')];return rpc[_0xd08b4b+_0xf7d0('0x1d')][_0xf7d0('0x2f')](_0x5b25ab);})[_0xf7d0('0x30')](function(_0x1d9d9b){logger[_0xf7d0('0xb')](_0xf7d0('0xc'),_0x3e3b4f,JSON[_0xf7d0('0x31')](_0x1d9d9b));})[_0xf7d0('0x32')](function(_0x53b91c){logger[_0xf7d0('0x33')](_0xf7d0('0x34'),_0x3e3b4f,JSON[_0xf7d0('0x31')](_0x53b91c));})['finally'](function(){_0x37e375[_0xf7d0('0xd')]();});}else{return rpc[this[_0xf7d0('0x16')]+_0xf7d0('0x1d')][_0xf7d0('0x2f')](_0x5b25ab)[_0xf7d0('0x30')](function(_0x5da14d){logger['info'](_0xf7d0('0xc'),_0x3e3b4f,_0x5b25ab['body']);})[_0xf7d0('0x32')](function(_0x4416f1){logger[_0xf7d0('0x33')](_0xf7d0('0xc'),_0x3e3b4f,JSON['stringify'](_0x4416f1));})[_0xf7d0('0x35')](function(){_0x37e375[_0xf7d0('0xd')]();});}}}catch(_0x1ecf46){logger[_0xf7d0('0x33')](_0xf7d0('0xc'),_0x3e3b4f,JSON[_0xf7d0('0x31')](_0x1ecf46));_0x37e375[_0xf7d0('0x36')]();}};}; \ 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 4a07e22..6e0f362 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 _0x7923=['channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1d58ed,_0x520f5a){var _0xa4d106=function(_0x3385db){while(--_0x3385db){_0x1d58ed['push'](_0x1d58ed['shift']());}};_0xa4d106(++_0x520f5a);}(_0x7923,0x8f));var _0x3792=function(_0x51b557,_0x58babd){_0x51b557=_0x51b557-0x0;var _0x3498d2=_0x7923[_0x51b557];return _0x3498d2;};'use strict';var moment=require(_0x3792('0x0'));var logger=require(_0x3792('0x1'))(_0x3792('0x2'));var rpc={'chatInteraction':require(_0x3792('0x3')),'openchannelInteraction':require(_0x3792('0x4')),'smsInteraction':require(_0x3792('0x5')),'mailInteraction':require(_0x3792('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3792('0x7'))};exports['consequence']=function(_0x490a18,_0x3fc684,_0x4f98c6,_0x326cc2){return function(_0x18b993){try{logger[_0x3792('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x490a18,_0x3fc684[0x0]);var _0x5b453a={'closed':0x1,'closedAt':moment()[_0x3792('0x9')](_0x3792('0xa')),'closeReason':'system','disposition':_0x3fc684[0x0]};if(rpc[_0x326cc2[_0x3792('0xb')]+_0x3792('0xc')]){rpc[_0x326cc2['channel']+_0x3792('0xc')][_0x3792('0xd')](_0x326cc2[_0x3792('0xe')]['id'],_0x5b453a)['then'](function(_0x5b159f){logger[_0x3792('0x8')](_0x3792('0xf'),_0x490a18,_0x326cc2[_0x3792('0xe')]['id']);})[_0x3792('0x10')](function(_0x5a6d8e){logger['error'](_0x3792('0x11'),_0x490a18,JSON[_0x3792('0x12')](_0x5a6d8e));})[_0x3792('0x13')](function(){_0x18b993[_0x3792('0x14')]();});}}catch(_0x10913e){logger[_0x3792('0x15')](_0x3792('0x11'),_0x490a18,JSON[_0x3792('0x12')](_0x10913e));_0x18b993[_0x3792('0x14')]();}};}; \ No newline at end of file +var _0x4819=['format','YYYY-MM-DD\x20HH:mm:ss','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x3a9b67,_0x161d4c){var _0xe08e99=function(_0x1bce85){while(--_0x1bce85){_0x3a9b67['push'](_0x3a9b67['shift']());}};_0xe08e99(++_0x161d4c);}(_0x4819,0xcd));var _0x9481=function(_0x29a7a9,_0x46c742){_0x29a7a9=_0x29a7a9-0x0;var _0x53713b=_0x4819[_0x29a7a9];return _0x53713b;};'use strict';var moment=require('moment');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var rpc={'chatInteraction':require(_0x9481('0x2')),'openchannelInteraction':require(_0x9481('0x3')),'smsInteraction':require(_0x9481('0x4')),'mailInteraction':require(_0x9481('0x5')),'faxInteraction':require(_0x9481('0x6')),'whatsappInteraction':require(_0x9481('0x7'))};exports[_0x9481('0x8')]=function(_0x16c617,_0x5ac51c,_0x4d9e3a,_0x5def07){return function(_0x54cc78){try{logger[_0x9481('0x9')](_0x9481('0xa'),_0x16c617,_0x5ac51c[0x0]);var _0x27c033={'closed':0x1,'closedAt':moment()[_0x9481('0xb')](_0x9481('0xc')),'closeReason':'system','disposition':_0x5ac51c[0x0]};if(rpc[_0x5def07[_0x9481('0xd')]+'Interaction']){rpc[_0x5def07[_0x9481('0xd')]+'Interaction'][_0x9481('0xe')](_0x5def07[_0x9481('0xf')]['id'],_0x27c033)[_0x9481('0x10')](function(_0x3ffe85){logger[_0x9481('0x9')](_0x9481('0x11'),_0x16c617,_0x5def07[_0x9481('0xf')]['id']);})[_0x9481('0x12')](function(_0xed8e9){logger['error']('[%s][CLOSE]\x20%s',_0x16c617,JSON[_0x9481('0x13')](_0xed8e9));})[_0x9481('0x14')](function(){_0x54cc78[_0x9481('0x15')]();});}}catch(_0x28fcb6){logger[_0x9481('0x16')](_0x9481('0x17'),_0x16c617,JSON[_0x9481('0x13')](_0x28fcb6));_0x54cc78['stop']();}};}; \ 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 e4811f2..fe85463 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 _0xff10=['getMustacheRender','Message','create','then','catch','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','metadata','endConversation','error','lodash','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','account','upperFirst','AccountId','created','isEmpty','body'];(function(_0x2fdf77,_0x153156){var _0x1b3e84=function(_0x60fd6){while(--_0x60fd6){_0x2fdf77['push'](_0x2fdf77['shift']());}};_0x1b3e84(++_0x153156);}(_0xff10,0x1e9));var _0x0ff1=function(_0xcce8b,_0x51499e){_0xcce8b=_0xcce8b-0x0;var _0x46f138=_0xff10[_0xcce8b];return _0x46f138;};'use strict';var _=require(_0x0ff1('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x0ff1('0x1'));var utils=require(_0x0ff1('0x2'));var logger=require(_0x0ff1('0x3'))('routing');var rpc={'chatMessage':require(_0x0ff1('0x4')),'openchannelMessage':require(_0x0ff1('0x5')),'mailMessage':require(_0x0ff1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0ff1('0x7')),'whatsappMessage':require(_0x0ff1('0x8'))};exports[_0x0ff1('0x9')]=function(_0x491bc6,_0x17167e){return function(_0x3cc334){try{if(!_[_0x0ff1('0xa')](this[_0x0ff1('0xb')][_0x0ff1('0xc')])){logger[_0x0ff1('0xd')](_0x0ff1('0xe'),_0x491bc6,_0x0ff1('0xf'));return _0x3cc334[_0x0ff1('0x10')]();}var _0x44efae={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0ff1('0x11')](_0x0ff1('0x12')),'direction':_0x0ff1('0x13')};var _0x1bc972=this['channel'];if(_0x1bc972===_0x0ff1('0x14')){_0x44efae['ChatWebsiteId']=this[_0x0ff1('0x15')]['id'];}else{_0x44efae[_[_0x0ff1('0x16')](_0x1bc972)+_0x0ff1('0x17')]=this['account']['id'];}_0x44efae[_[_0x0ff1('0x16')](_0x1bc972)+'InteractionId']=this[_0x0ff1('0xb')]['id'];if(this[_0x0ff1('0xb')][_0x0ff1('0x18')]){var _0xd47a15=_0x17167e[0x2];if(!_[_0x0ff1('0x19')](_0xd47a15)){_0x44efae[_0x0ff1('0x1a')]=utils[_0x0ff1('0x1b')](_0xd47a15,this);return rpc[_0x1bc972+_0x0ff1('0x1c')][_0x0ff1('0x1d')](_0x44efae)[_0x0ff1('0x1e')](function(_0x3262c8){logger['info'](_0x0ff1('0xe'),_0x491bc6,_0x44efae[_0x0ff1('0x1a')]);})[_0x0ff1('0x1f')](function(_0x279331){logger['error'](_0x0ff1('0xe'),_0x491bc6,JSON['stringify'](_0x279331));})['finally'](function(){logger[_0x0ff1('0xd')](_0x0ff1('0x20'),_0x491bc6);_0x3cc334[_0x0ff1('0x21')]();});}else{logger[_0x0ff1('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x491bc6);_0x3cc334[_0x0ff1('0x21')]();}}else{var _0x357752=this;var _0x36dfe3=apiai(_0x17167e[0x0],{'language':_0x17167e[0x1]||'en'});return _0x36dfe3[_0x0ff1('0x22')](this[_0x0ff1('0x23')]['body'],{'sessionId':md5(this[_0x0ff1('0xb')]['id'])})[_0x0ff1('0x1e')](function(_0x250a3d){_0x357752[_0x0ff1('0x1a')][_0x0ff1('0x24')]=_0x250a3d;_0x44efae[_0x0ff1('0x1a')]=_0x250a3d[_0x0ff1('0x25')][_0x0ff1('0x26')][_0x0ff1('0x27')];return rpc[_0x1bc972+_0x0ff1('0x1c')]['create'](_0x44efae)['then'](function(_0x58ce8e){logger['info'](_0x0ff1('0xe'),_0x491bc6,_0x44efae['body']);if(_0x250a3d['result'][_0x0ff1('0x28')][_0x0ff1('0x29')]){_0x3cc334[_0x0ff1('0x10')]();}else{_0x3cc334[_0x0ff1('0x21')]();}})[_0x0ff1('0x1f')](function(_0x496329){logger[_0x0ff1('0x2a')](_0x0ff1('0xe'),_0x491bc6,JSON['stringify'](_0x496329));_0x3cc334[_0x0ff1('0x10')]();});})[_0x0ff1('0x1f')](function(_0x322611){logger['error'](_0x0ff1('0xe'),_0x491bc6,_0x322611[_0x0ff1('0x23')]);_0x3cc334[_0x0ff1('0x10')]();});}}catch(_0x547cf0){logger['error'](_0x0ff1('0xe'),_0x491bc6,JSON['stringify'](_0x547cf0));_0x3cc334[_0x0ff1('0x21')]();}};}; \ No newline at end of file +var _0x1b61=['YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','fulfillment','result','metadata','endConversation','next','message','lodash','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format'];(function(_0x5dfbdf,_0x413174){var _0x2b2ef2=function(_0x36e6fe){while(--_0x36e6fe){_0x5dfbdf['push'](_0x5dfbdf['shift']());}};_0x2b2ef2(++_0x413174);}(_0x1b61,0x157));var _0x11b6=function(_0x589afa,_0x3837c3){_0x589afa=_0x589afa-0x0;var _0x316264=_0x1b61[_0x589afa];return _0x316264;};'use strict';var _=require(_0x11b6('0x0'));var moment=require('moment');var apiai=require(_0x11b6('0x1'));var md5=require('md5');var utils=require(_0x11b6('0x2'));var logger=require(_0x11b6('0x3'))(_0x11b6('0x4'));var rpc={'chatMessage':require(_0x11b6('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x11b6('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x11b6('0x7')),'whatsappMessage':require(_0x11b6('0x8'))};exports[_0x11b6('0x9')]=function(_0x122f8c,_0x4f329e){return function(_0x545994){try{if(!_[_0x11b6('0xa')](this[_0x11b6('0xb')][_0x11b6('0xc')])){logger[_0x11b6('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x122f8c,_0x11b6('0xe'));return _0x545994['next']();}var _0x16e0a6={'ContactId':this[_0x11b6('0xf')]['id'],'sentAt':moment()[_0x11b6('0x10')](_0x11b6('0x11')),'direction':_0x11b6('0x12')};var _0x29b53d=this[_0x11b6('0x13')];if(_0x29b53d===_0x11b6('0x14')){_0x16e0a6['ChatWebsiteId']=this[_0x11b6('0x15')]['id'];}else{_0x16e0a6[_[_0x11b6('0x16')](_0x29b53d)+_0x11b6('0x17')]=this[_0x11b6('0x15')]['id'];}_0x16e0a6[_['upperFirst'](_0x29b53d)+_0x11b6('0x18')]=this[_0x11b6('0xb')]['id'];if(this['interaction'][_0x11b6('0x19')]){var _0x245efc=_0x4f329e[0x2];if(!_['isEmpty'](_0x245efc)){_0x16e0a6[_0x11b6('0x1a')]=utils[_0x11b6('0x1b')](_0x245efc,this);return rpc[_0x29b53d+_0x11b6('0x1c')][_0x11b6('0x1d')](_0x16e0a6)[_0x11b6('0x1e')](function(_0x11cdd5){logger[_0x11b6('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x122f8c,_0x16e0a6['body']);})[_0x11b6('0x1f')](function(_0x1afc27){logger[_0x11b6('0x20')](_0x11b6('0x21'),_0x122f8c,JSON['stringify'](_0x1afc27));})[_0x11b6('0x22')](function(){logger['info'](_0x11b6('0x23'),_0x122f8c);_0x545994[_0x11b6('0x24')]();});}else{logger[_0x11b6('0xd')](_0x11b6('0x25'),_0x122f8c);_0x545994['stop']();}}else{var _0x2f73ea=this;var _0x96b108=apiai(_0x4f329e[0x0],{'language':_0x4f329e[0x1]||'en'});return _0x96b108[_0x11b6('0x26')](this['message']['body'],{'sessionId':md5(this[_0x11b6('0xb')]['id'])})[_0x11b6('0x1e')](function(_0xfc0c9c){_0x2f73ea[_0x11b6('0x1a')]['dialogflow']=_0xfc0c9c;_0x16e0a6[_0x11b6('0x1a')]=_0xfc0c9c['result'][_0x11b6('0x27')]['speech'];return rpc[_0x29b53d+'Message'][_0x11b6('0x1d')](_0x16e0a6)[_0x11b6('0x1e')](function(_0x29e825){logger[_0x11b6('0xd')](_0x11b6('0x21'),_0x122f8c,_0x16e0a6[_0x11b6('0x1a')]);if(_0xfc0c9c[_0x11b6('0x28')][_0x11b6('0x29')][_0x11b6('0x2a')]){_0x545994[_0x11b6('0x2b')]();}else{_0x545994[_0x11b6('0x24')]();}})[_0x11b6('0x1f')](function(_0x3b6b06){logger[_0x11b6('0x20')](_0x11b6('0x21'),_0x122f8c,JSON['stringify'](_0x3b6b06));_0x545994[_0x11b6('0x2b')]();});})[_0x11b6('0x1f')](function(_0x29b9da){logger['error'](_0x11b6('0x21'),_0x122f8c,_0x29b9da[_0x11b6('0x2c')]);_0x545994[_0x11b6('0x2b')]();});}}catch(_0x153c1b){logger[_0x11b6('0x20')](_0x11b6('0x21'),_0x122f8c,JSON['stringify'](_0x153c1b));_0x545994[_0x11b6('0x24')]();}};}; \ 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 06eb757..d4f14cd 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 _0xabf3=['error','map','message','join','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xabf3,0x100));var _0x3abf=function(_0x40989d,_0xa5a838){_0x40989d=_0x40989d-0x0;var _0x584a3c=_0xabf3[_0x40989d];return _0x584a3c;};'use strict';var schema=require('validate');var _=require(_0x3abf('0x0'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x3abf('0x1'))(_0x3abf('0x2'));var gotoif=schema({'condition':{'type':_0x3abf('0x3'),'required':!![],'message':_0x3abf('0x4')},'priorityTrue':{'type':'number','message':_0x3abf('0x5')},'priorityFalse':{'type':_0x3abf('0x6'),'message':_0x3abf('0x7')}});exports[_0x3abf('0x8')]=function(_0x447673,_0x104e82){return function(_0x5085cc){try{var _0x52595c={'condition':htmlToText[_0x3abf('0x9')](utils[_0x3abf('0xa')](_0x104e82[0x0],this),{'wordwrap':![]})[_0x3abf('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x104e82[0x1],'priorityFalse':_0x104e82[0x2]};var _0x4ff69a=gotoif[_0x3abf('0xc')](_0x52595c,{'typecast':!![]});if(_0x4ff69a[_0x3abf('0xd')]){logger[_0x3abf('0xe')]('[%s][GOTOIF]\x20%s',_0x447673,_[_0x3abf('0xf')](_0x4ff69a,_0x3abf('0x10'))[_0x3abf('0x11')](',\x20'));_0x5085cc['stop']();}else{try{var _0x236719=eval('('+_0x52595c[_0x3abf('0x12')]+')');var _0x86b0a=_0x236719?_0x52595c['priorityTrue']:_0x52595c['priorityFalse'];logger[_0x3abf('0x13')](_0x3abf('0x14'),_0x447673,_0x52595c[_0x3abf('0x12')],_0x236719,_0x86b0a||_0x3abf('0x15'));if(_0x86b0a){var _0x3397bf=_[_0x3abf('0x16')](_0x5085cc['rules'](),{'p':_0x86b0a});if(_0x3397bf>=0x0){logger[_0x3abf('0x13')](_0x3abf('0x17'),_0x447673,_0x86b0a||'next',_0x3397bf);_0x5085cc[_0x3abf('0x15')](_0x3397bf);}else{logger[_0x3abf('0x13')](_0x3abf('0x18'),_0x447673,_0x86b0a||'next');_0x5085cc[_0x3abf('0x19')]();}}else{_0x5085cc[_0x3abf('0x15')]();}}catch(_0x639446){logger[_0x3abf('0xe')](_0x3abf('0x1a'),_0x447673,_0x639446[_0x3abf('0x10')]);_0x5085cc['stop']();}}}catch(_0x1583f6){logger['error']('[%s][GOTOIF]\x20%s',_0x447673,JSON['stringify'](_0x1583f6));_0x5085cc[_0x3abf('0x19')]();}};}; \ No newline at end of file +var _0xd608=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','map','message','join','stop','condition','priorityTrue','priorityFalse'];(function(_0x5a53bc,_0x455752){var _0x224dba=function(_0x3eab01){while(--_0x3eab01){_0x5a53bc['push'](_0x5a53bc['shift']());}};_0x224dba(++_0x455752);}(_0xd608,0x1bb));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x8d60('0x0'));var _=require(_0x8d60('0x1'));var htmlToText=require(_0x8d60('0x2'));var utils=require(_0x8d60('0x3'));var logger=require(_0x8d60('0x4'))(_0x8d60('0x5'));var gotoif=schema({'condition':{'type':_0x8d60('0x6'),'required':!![],'message':_0x8d60('0x7')},'priorityTrue':{'type':_0x8d60('0x8'),'message':_0x8d60('0x9')},'priorityFalse':{'type':_0x8d60('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x8d60('0xa')]=function(_0x1b3b06,_0x1ef6c7){return function(_0x550d59){try{var _0x4e69ee={'condition':htmlToText[_0x8d60('0xb')](utils['getMustacheRender'](_0x1ef6c7[0x0],this),{'wordwrap':![]})[_0x8d60('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ef6c7[0x1],'priorityFalse':_0x1ef6c7[0x2]};var _0x5f1cb2=gotoif[_0x8d60('0x0')](_0x4e69ee,{'typecast':!![]});if(_0x5f1cb2[_0x8d60('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0x1b3b06,_[_0x8d60('0xe')](_0x5f1cb2,_0x8d60('0xf'))[_0x8d60('0x10')](',\x20'));_0x550d59[_0x8d60('0x11')]();}else{try{var _0x4f456f=eval('('+_0x4e69ee[_0x8d60('0x12')]+')');var _0xdb3aaf=_0x4f456f?_0x4e69ee[_0x8d60('0x13')]:_0x4e69ee[_0x8d60('0x14')];logger['info'](_0x8d60('0x15'),_0x1b3b06,_0x4e69ee[_0x8d60('0x12')],_0x4f456f,_0xdb3aaf||_0x8d60('0x16'));if(_0xdb3aaf){var _0x51196d=_[_0x8d60('0x17')](_0x550d59[_0x8d60('0x18')](),{'p':_0xdb3aaf});if(_0x51196d>=0x0){logger[_0x8d60('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1b3b06,_0xdb3aaf||'next',_0x51196d);_0x550d59[_0x8d60('0x16')](_0x51196d);}else{logger[_0x8d60('0x19')](_0x8d60('0x1a'),_0x1b3b06,_0xdb3aaf||_0x8d60('0x16'));_0x550d59[_0x8d60('0x11')]();}}else{_0x550d59[_0x8d60('0x16')]();}}catch(_0x242e4d){logger[_0x8d60('0x1b')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1b3b06,_0x242e4d[_0x8d60('0xf')]);_0x550d59[_0x8d60('0x11')]();}}}catch(_0x15c11b){logger['error']('[%s][GOTOIF]\x20%s',_0x1b3b06,JSON[_0x8d60('0x1c')](_0x15c11b));_0x550d59[_0x8d60('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index fb2ca5d..2b5badd 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 _0xc8bc=['validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','join','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify'];(function(_0x3ddccb,_0x1ae1aa){var _0x426cdd=function(_0x42eb9b){while(--_0x42eb9b){_0x3ddccb['push'](_0x3ddccb['shift']());}};_0x426cdd(++_0x1ae1aa);}(_0xc8bc,0x121));var _0xcc8b=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xc8bc[_0x51b0dc];return _0x13fa89;};'use strict';var schema=require(_0xcc8b('0x0'));var _=require('lodash');var logger=require(_0xcc8b('0x1'))(_0xcc8b('0x2'));var gotop=schema({'priority':{'type':_0xcc8b('0x3'),'required':!![],'message':_0xcc8b('0x4')}});exports[_0xcc8b('0x5')]=function(_0x26ad82,_0xa36a33){return function(_0x5cb62a){try{var _0x49aa19={'priority':_0xa36a33[0x0]};var _0x2d6bbf=gotop[_0xcc8b('0x0')](_0x49aa19,{'typecast':!![]});if(_0x2d6bbf['length']){logger['error']('[%s][GOTOP]\x20%s',_0x26ad82,_[_0xcc8b('0x6')](_0x2d6bbf,'message')[_0xcc8b('0x7')](',\x20'));_0x5cb62a[_0xcc8b('0x8')]();}else{logger[_0xcc8b('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x26ad82,_0x49aa19[_0xcc8b('0xa')]);if(_0x49aa19['priority']){var _0x4dd84a=_['findIndex'](_0x5cb62a['rules'](),{'p':_0x49aa19['priority']});if(_0x4dd84a>=0x0){logger[_0xcc8b('0x9')](_0xcc8b('0xb'),_0x26ad82,_0x49aa19[_0xcc8b('0xa')]||'next',_0x4dd84a);_0x5cb62a[_0xcc8b('0xc')](_0x4dd84a);}else{logger[_0xcc8b('0x9')](_0xcc8b('0xd'),_0x26ad82,_0x49aa19['priority']||'next');_0x5cb62a[_0xcc8b('0x8')]();}}else{_0x5cb62a[_0xcc8b('0xc')]();}}}catch(_0x541777){logger[_0xcc8b('0xe')](_0xcc8b('0xf'),_0x26ad82,JSON[_0xcc8b('0x10')](_0x541777));_0x5cb62a[_0xcc8b('0x8')]();}};}; \ No newline at end of file +var _0xa0bc=['priority','info','next','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0bc,0x8a));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xca0b('0x0'));var _=require(_0xca0b('0x1'));var logger=require(_0xca0b('0x2'))(_0xca0b('0x3'));var gotop=schema({'priority':{'type':_0xca0b('0x4'),'required':!![],'message':_0xca0b('0x5')}});exports[_0xca0b('0x6')]=function(_0x123351,_0x4c844){return function(_0x230627){try{var _0x526203={'priority':_0x4c844[0x0]};var _0x2cdccd=gotop[_0xca0b('0x0')](_0x526203,{'typecast':!![]});if(_0x2cdccd[_0xca0b('0x7')]){logger['error'](_0xca0b('0x8'),_0x123351,_[_0xca0b('0x9')](_0x2cdccd,_0xca0b('0xa'))[_0xca0b('0xb')](',\x20'));_0x230627[_0xca0b('0xc')]();}else{logger['info'](_0xca0b('0xd'),_0x123351,_0x526203['priority']);if(_0x526203['priority']){var _0x1975fd=_['findIndex'](_0x230627['rules'](),{'p':_0x526203[_0xca0b('0xe')]});if(_0x1975fd>=0x0){logger[_0xca0b('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x123351,_0x526203[_0xca0b('0xe')]||_0xca0b('0x10'),_0x1975fd);_0x230627[_0xca0b('0x10')](_0x1975fd);}else{logger[_0xca0b('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x123351,_0x526203[_0xca0b('0xe')]||_0xca0b('0x10'));_0x230627[_0xca0b('0xc')]();}}else{_0x230627[_0xca0b('0x10')]();}}}catch(_0x5af605){logger[_0xca0b('0x11')](_0xca0b('0x8'),_0x123351,JSON[_0xca0b('0x12')](_0x5af605));_0x230627[_0xca0b('0xc')]();}};}; \ 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 7df1888..aa11988 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 _0x7947=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','Message','then','info','[%s][MESSAGE]\x20%s','body','next','stop','error','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x7947,0x188));var _0x7794=function(_0x2d26f4,_0x515b8f){_0x2d26f4=_0x2d26f4-0x0;var _0x59ece8=_0x7947[_0x2d26f4];return _0x59ece8;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x7794('0x0'))(_0x7794('0x1'));var rpc={'chatMessage':require(_0x7794('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7794('0x3')),'smsMessage':require(_0x7794('0x4')),'faxMessage':require(_0x7794('0x5')),'whatsappMessage':require(_0x7794('0x6'))};exports['consequence']=function(_0xe4091b,_0x55babe){return function(_0xddf98b){try{var _0x355807={'body':utils[_0x7794('0x7')](_0x55babe[0x0],this),'ContactId':this[_0x7794('0x8')]['id']};if(this[_0x7794('0x9')]===_0x7794('0xa')){_0x355807[_0x7794('0xb')]=this[_0x7794('0xc')]['id'];}else{_0x355807[_[_0x7794('0xd')](this['channel'])+'AccountId']=this[_0x7794('0xc')]['id'];}_0x355807[_['upperFirst'](this[_0x7794('0x9')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x7794('0x9')]+_0x7794('0xe')]){return rpc[this[_0x7794('0x9')]+'Message']['create'](_0x355807)[_0x7794('0xf')](function(_0x574d52){logger[_0x7794('0x10')](_0x7794('0x11'),_0xe4091b,_0x355807[_0x7794('0x12')]);_0xddf98b[_0x7794('0x13')]();})['catch'](function(_0x48e59e){logger['error'](_0x7794('0x11'),_0xe4091b,JSON['stringify'](_0x48e59e));_0xddf98b[_0x7794('0x14')]();});}}catch(_0x1dcccd){logger[_0x7794('0x15')](_0x7794('0x11'),_0xe4091b,JSON['stringify'](_0x1dcccd));_0xddf98b['stop']();}};}; \ No newline at end of file +var _0xc652=['then','info','next','catch','error','stringify','[%s][MESSAGE]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','create'];(function(_0x3653aa,_0x3b47c0){var _0x21b3d2=function(_0xbf67c1){while(--_0xbf67c1){_0x3653aa['push'](_0x3653aa['shift']());}};_0x21b3d2(++_0x3b47c0);}(_0xc652,0x8a));var _0x2c65=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0xc652[_0x5517c0];return _0x33803b;};'use strict';var _=require('lodash');var utils=require(_0x2c65('0x0'));var logger=require(_0x2c65('0x1'))(_0x2c65('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2c65('0x3')),'mailMessage':require(_0x2c65('0x4')),'smsMessage':require(_0x2c65('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2c65('0x6'))};exports[_0x2c65('0x7')]=function(_0x5c1a96,_0x430e44){return function(_0x472c29){try{var _0x5cd7a6={'body':utils[_0x2c65('0x8')](_0x430e44[0x0],this),'ContactId':this[_0x2c65('0x9')]['id']};if(this[_0x2c65('0xa')]===_0x2c65('0xb')){_0x5cd7a6[_0x2c65('0xc')]=this[_0x2c65('0xd')]['id'];}else{_0x5cd7a6[_[_0x2c65('0xe')](this[_0x2c65('0xa')])+'AccountId']=this['account']['id'];}_0x5cd7a6[_[_0x2c65('0xe')](this[_0x2c65('0xa')])+'InteractionId']=this[_0x2c65('0xf')]['id'];if(rpc[this[_0x2c65('0xa')]+'Message']){return rpc[this[_0x2c65('0xa')]+_0x2c65('0x10')][_0x2c65('0x11')](_0x5cd7a6)[_0x2c65('0x12')](function(_0x47c60b){logger[_0x2c65('0x13')]('[%s][MESSAGE]\x20%s',_0x5c1a96,_0x5cd7a6['body']);_0x472c29[_0x2c65('0x14')]();})[_0x2c65('0x15')](function(_0x361328){logger[_0x2c65('0x16')]('[%s][MESSAGE]\x20%s',_0x5c1a96,JSON[_0x2c65('0x17')](_0x361328));_0x472c29['stop']();});}}catch(_0x1509b1){logger['error'](_0x2c65('0x18'),_0x5c1a96,JSON[_0x2c65('0x17')](_0x1509b1));_0x472c29[_0x2c65('0x19')]();}};}; \ 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 55166d0..bd46c63 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 _0x7c14=['info','[%s][NOOP]\x20%s','error','stringify','../../../../config/logger','routing','consequence'];(function(_0x57a01b,_0x174e7b){var _0x252fd6=function(_0x3ded47){while(--_0x3ded47){_0x57a01b['push'](_0x57a01b['shift']());}};_0x252fd6(++_0x174e7b);}(_0x7c14,0xc8));var _0x47c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7c14[_0x40a045];return _0x1a687c;};'use strict';var utils=require('./utils');var logger=require(_0x47c1('0x0'))(_0x47c1('0x1'));exports[_0x47c1('0x2')]=function(_0x21ac73,_0x4f0cdc){return function(_0x3b6724){try{logger[_0x47c1('0x3')](_0x47c1('0x4'),_0x21ac73,utils['getMustacheRender'](_0x4f0cdc[0x0],this));_0x3b6724['next']();}catch(_0x4d8c74){logger[_0x47c1('0x5')](_0x47c1('0x4'),_0x21ac73,JSON[_0x47c1('0x6')](_0x4d8c74));_0x3b6724['stop']();}};}; \ No newline at end of file +var _0xd606=['stringify','stop','./utils','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x37f614,_0xc94b50){var _0x487bac=function(_0x5671c7){while(--_0x5671c7){_0x37f614['push'](_0x37f614['shift']());}};_0x487bac(++_0xc94b50);}(_0xd606,0x1bb));var _0x6d60=function(_0x3c9313,_0x5219f6){_0x3c9313=_0x3c9313-0x0;var _0x2898d6=_0xd606[_0x3c9313];return _0x2898d6;};'use strict';var utils=require(_0x6d60('0x0'));var logger=require('../../../../config/logger')(_0x6d60('0x1'));exports['consequence']=function(_0xe0e992,_0x1e84c9){return function(_0x56427a){try{logger[_0x6d60('0x2')](_0x6d60('0x3'),_0xe0e992,utils[_0x6d60('0x4')](_0x1e84c9[0x0],this));_0x56427a[_0x6d60('0x5')]();}catch(_0x2334da){logger[_0x6d60('0x6')](_0x6d60('0x3'),_0xe0e992,JSON[_0x6d60('0x7')](_0x2334da));_0x56427a[_0x6d60('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 9cf6346..eba52d5 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 _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x431c5a,_0xc5d3b4){var _0x1396db=function(_0x281d30){while(--_0x281d30){_0x431c5a['push'](_0x431c5a['shift']());}};_0x1396db(++_0xc5d3b4);}(_0x55ca,0x126));var _0xa55c=function(_0x16e73a,_0x146629){_0x16e73a=_0x16e73a-0x0;var _0x187aa1=_0x55ca[_0x16e73a];return _0x187aa1;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file +var _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x426d1,_0x188aba){var _0x732e88=function(_0x237a66){while(--_0x237a66){_0x426d1['push'](_0x426d1['shift']());}};_0x732e88(++_0x188aba);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index db68a03..cb6c7b8 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 _0x69ea=['bind','handleTimeout','timeout','handleDrained','prototype','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId','squeue','agent','realtime','push','handleRun'];(function(_0x20c59f,_0x583d0a){var _0x2b6df8=function(_0x303e11){while(--_0x303e11){_0x20c59f['push'](_0x20c59f['shift']());}};_0x2b6df8(++_0x583d0a);}(_0x69ea,0x1d3));var _0xa69e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x69ea[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var uuid=require(_0xa69e('0x0'));var util=require(_0xa69e('0x1'));var logger=require('../../../../../config/logger')(_0xa69e('0x2'));var Agent=function(_0x3af509,_0x2143b7,_0x170dfb,_0x124611){this[_0xa69e('0x3')]=uuid['v4']();this[_0xa69e('0x4')]=_0x3af509;this[_0xa69e('0x5')]=_0x2143b7;this[_0xa69e('0x6')]=_0x170dfb;this[_0xa69e('0x2')]=_0x124611;this[_0xa69e('0x4')][_0xa69e('0x7')](this[_0xa69e('0x8')][_0xa69e('0x9')](this),this[_0xa69e('0xa')][_0xa69e('0x9')](this));this[_0xa69e('0x4')]['on'](_0xa69e('0xb'),this[_0xa69e('0xa')]['bind'](this));this[_0xa69e('0x4')]['on']('drained',this[_0xa69e('0xc')][_0xa69e('0x9')](this));};Agent[_0xa69e('0xd')][_0xa69e('0x7')]=function(){this[_0xa69e('0x4')][_0xa69e('0x7')](this[_0xa69e('0x8')][_0xa69e('0x9')](this),this[_0xa69e('0xa')][_0xa69e('0x9')](this));};Agent[_0xa69e('0xd')][_0xa69e('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xa69e('0xd')][_0xa69e('0x8')]=function(_0x1e91c2){logger[_0xa69e('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xa69e('0x4')]['id'],this[_0xa69e('0x5')]['id']);if(_['isNil'](this['realtime'][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']])){logger[_0xa69e('0xe')](_0xa69e('0x10'),this[_0xa69e('0x4')]['id'],this[_0xa69e('0x5')]['id']);setTimeout(this[_0xa69e('0x7')][_0xa69e('0x9')](this),0x3e8);}else{if(this[_0xa69e('0x2')][_0xa69e('0x11')]||util[_0xa69e('0x12')](this[_0xa69e('0x4')]['id'],this[_0xa69e('0x6')][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']],this[_0xa69e('0x4')][_0xa69e('0x13')],![])){this['realtime'][_0xa69e('0xf')][this['agent']['id']]['busy']=!![];this['realtime']['agents'][this[_0xa69e('0x5')]['id']][_0xa69e('0x14')]=undefined;util[_0xa69e('0x15')](this[_0xa69e('0x3')],this[_0xa69e('0x4')]['id'],this['realtime'][_0xa69e('0xf')][this['agent']['id']],null,this[_0xa69e('0x2')]);util['writeLog'](this[_0xa69e('0x4')]['id'],this[_0xa69e('0x6')][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']],'RINGING'+(this[_0xa69e('0x2')][_0xa69e('0x11')]?':FORCED':''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa69e('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xa69e('0x7')][_0xa69e('0x9')](this),0x3e8);}}};Agent['prototype'][_0xa69e('0xa')]=function(_0x2eb5c2){if(_['isNil'](this[_0xa69e('0x6')][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']])){return logger[_0xa69e('0xe')](_0xa69e('0x10'),this[_0xa69e('0x4')]['id'],this[_0xa69e('0x5')]['id']);}else{logger[_0xa69e('0xe')](_0xa69e('0x16'),this[_0xa69e('0x4')]['id'],this['agent']['id']);util[_0xa69e('0x17')](this[_0xa69e('0x3')],this[_0xa69e('0x4')]['id'],this['realtime'][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']],null,this[_0xa69e('0x2')]);this[_0xa69e('0x6')][_0xa69e('0xf')][this[_0xa69e('0x5')]['id']][_0xa69e('0x18')]=![];this[_0xa69e('0x6')][_0xa69e('0xf')][this['agent']['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0xa69e('0x6')][_0xa69e('0xf')][this['agent']['id']],_0x2eb5c2?_0xa69e('0x19'):_0xa69e('0x1a'));}if(!_0x2eb5c2){setTimeout(this[_0xa69e('0x7')][_0xa69e('0x9')](this),0x3e8);}};function agent(_0x124633,_0x2b06e6,_0x26c936,_0x3f20a0){return new Agent(_0x124633,_0x2b06e6,_0x26c936,_0x3f20a0);}module[_0xa69e('0x1b')]=agent; \ No newline at end of file +var _0xf7cb=['notificationId','squeue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf7cb,0x1a9));var _0xbf7c=function(_0x178646,_0xeca02b){_0x178646=_0x178646-0x0;var _0x3c2b3e=_0xf7cb[_0x178646];return _0x3c2b3e;};'use strict';var _=require('lodash');var uuid=require(_0xbf7c('0x0'));var util=require(_0xbf7c('0x1'));var logger=require(_0xbf7c('0x2'))(_0xbf7c('0x3'));var Agent=function(_0x2b90f4,_0x4319ec,_0x2635d3,_0x5b8cf7){this[_0xbf7c('0x4')]=uuid['v4']();this[_0xbf7c('0x5')]=_0x2b90f4;this['agent']=_0x4319ec;this[_0xbf7c('0x6')]=_0x2635d3;this[_0xbf7c('0x3')]=_0x5b8cf7;this[_0xbf7c('0x5')]['push'](this[_0xbf7c('0x7')][_0xbf7c('0x8')](this),this[_0xbf7c('0x9')][_0xbf7c('0x8')](this));this[_0xbf7c('0x5')]['on'](_0xbf7c('0xa'),this[_0xbf7c('0x9')][_0xbf7c('0x8')](this));this[_0xbf7c('0x5')]['on'](_0xbf7c('0xb'),this[_0xbf7c('0xc')][_0xbf7c('0x8')](this));};Agent['prototype'][_0xbf7c('0xd')]=function(){this[_0xbf7c('0x5')]['push'](this[_0xbf7c('0x7')][_0xbf7c('0x8')](this),this[_0xbf7c('0x9')]['bind'](this));};Agent['prototype'][_0xbf7c('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbf7c('0xe')][_0xbf7c('0x7')]=function(_0x224f03){logger[_0xbf7c('0xf')](_0xbf7c('0x10'),this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x11')]['id']);if(_[_0xbf7c('0x12')](this[_0xbf7c('0x6')]['agents'][this[_0xbf7c('0x11')]['id']])){logger[_0xbf7c('0xf')](_0xbf7c('0x13'),this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x11')]['id']);setTimeout(this['push'][_0xbf7c('0x8')](this),0x3e8);}else{if(this[_0xbf7c('0x3')][_0xbf7c('0x14')]||util['isAgentAvailable'](this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x6')]['agents'][this[_0xbf7c('0x11')]['id']],this[_0xbf7c('0x5')]['channel'],![])){this[_0xbf7c('0x6')][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']][_0xbf7c('0x16')]=!![];this['realtime'][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']][_0xbf7c('0x17')]=undefined;util[_0xbf7c('0x18')](this[_0xbf7c('0x4')],this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x6')]['agents'][this[_0xbf7c('0x11')]['id']],null,this[_0xbf7c('0x3')]);util[_0xbf7c('0x19')](this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x6')][_0xbf7c('0x15')][this['agent']['id']],_0xbf7c('0x1a')+(this[_0xbf7c('0x3')][_0xbf7c('0x14')]?_0xbf7c('0x1b'):''));}else{logger[_0xbf7c('0xf')](_0xbf7c('0x1c'),this['squeue']['id'],this[_0xbf7c('0x11')]['id']);setTimeout(this[_0xbf7c('0xd')][_0xbf7c('0x8')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x47d023){if(_[_0xbf7c('0x12')](this[_0xbf7c('0x6')][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']])){return logger[_0xbf7c('0xf')](_0xbf7c('0x13'),this[_0xbf7c('0x5')]['id'],this['agent']['id']);}else{logger[_0xbf7c('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xbf7c('0x5')]['id'],this[_0xbf7c('0x11')]['id']);util[_0xbf7c('0x1d')](this['notificationId'],this['squeue']['id'],this[_0xbf7c('0x6')][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']],null,this[_0xbf7c('0x3')]);this[_0xbf7c('0x6')][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']][_0xbf7c('0x16')]=![];this['realtime']['agents'][this[_0xbf7c('0x11')]['id']]['busyQueue']=undefined;util[_0xbf7c('0x19')](this[_0xbf7c('0x5')]['id'],this['realtime'][_0xbf7c('0x15')][this[_0xbf7c('0x11')]['id']],_0x47d023?_0xbf7c('0x1e'):_0xbf7c('0x1f'));}if(!_0x47d023){setTimeout(this[_0xbf7c('0xd')][_0xbf7c('0x8')](this),0x3e8);}};function agent(_0x5e429e,_0x19e1a9,_0x2b083e,_0x14f988){return new Agent(_0x5e429e,_0x19e1a9,_0x2b083e,_0x14f988);}module[_0xbf7c('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index b06bdd0..9812207 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 _0x05e5=['[%s][QUEUE]\x20EMPTY','writeLog','TIMEOUT','uuid','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleTimeout','bind','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','name'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x05e5,0x1df));var _0x505e=function(_0x4f492c,_0x2f5d87){_0x4f492c=_0x4f492c-0x0;var _0x347ea5=_0x05e5[_0x4f492c];return _0x347ea5;};'use strict';var _=require('lodash');var uuid=require(_0x505e('0x0'));var util=require('./util');var logger=require(_0x505e('0x1'))('routing');var Beepall=function(_0x5917be,_0x28fb3b,_0x19cb6d,_0x185631){this[_0x505e('0x2')]=uuid['v4']();this[_0x505e('0x3')]=_0x5917be;this[_0x505e('0x4')]=_0x28fb3b;this[_0x505e('0x5')]=_0x19cb6d;this[_0x505e('0x6')]=_0x185631;this[_0x505e('0x3')][_0x505e('0x7')](this['handleRun']['bind'](this),this[_0x505e('0x8')][_0x505e('0x9')](this));this[_0x505e('0x3')]['on']('timeout',this[_0x505e('0x8')]['bind'](this));this['squeue']['on'](_0x505e('0xa'),this[_0x505e('0xb')][_0x505e('0x9')](this));};Beepall[_0x505e('0xc')][_0x505e('0x7')]=function(){this[_0x505e('0x3')][_0x505e('0x7')](this[_0x505e('0xd')][_0x505e('0x9')](this),this[_0x505e('0x8')][_0x505e('0x9')](this));};Beepall[_0x505e('0xc')][_0x505e('0xb')]=function(_0x22145a){this[_0x505e('0x8')](!![]);};Beepall[_0x505e('0xc')][_0x505e('0xd')]=function(_0x259297){var _0x4fa72e=!![];if(!_[_0x505e('0xe')](this[_0x505e('0x4')])&&!_['isNil'](this['queue'][_0x505e('0xf')])&&this[_0x505e('0x4')][_0x505e('0xf')][_0x505e('0x10')]>0x0){for(var _0x58494d=0x0,_0x65d5d6;_0x58494d0x0){for(var _0x444e81=0x0,_0x4b931a;_0x444e810x0&&_0x144808[_0x34e98d+_0x5e60('0x25')]>=_0x144808[_0x34e98d+'Capacity']){writeLog(_0x2b0bae,_0x144808,_0x34e98d[_0x5e60('0x26')]()+_0x5e60('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x46691f,_0x19e5ab,_0x5b1b46,_0x1ee931,_0xac9c7a){return sendNotification(!![],_0x46691f,_0x19e5ab,_0x5b1b46,_0x1ee931,_0xac9c7a);};exports['hideNotification']=function(_0x5431a8,_0x52f668,_0xf25956,_0x235cc7,_0x2e8e9e){return sendNotification(![],_0x5431a8,_0x52f668,_0xf25956,_0x235cc7,_0x2e8e9e);};exports[_0x5e60('0x28')]=writeLog; \ No newline at end of file +var _0x5076=['socket.io-emitter','emit','user:%s','name','user:save','split','\x20interaction','notificationSound','body','queue','getMustacheRender','account','msg','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','save','remove','info','isAgentAvailable','busy','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost'];(function(_0x3bbe89,_0x2e1ba3){var _0x32842b=function(_0x22678f){while(--_0x22678f){_0x3bbe89['push'](_0x3bbe89['shift']());}};_0x32842b(++_0x2e1ba3);}(_0x5076,0x168));var _0x6507=function(_0x310e1b,_0x4e5cfe){_0x310e1b=_0x310e1b-0x0;var _0x29c586=_0x5076[_0x310e1b];return _0x29c586;};'use strict';var _=require(_0x6507('0x0'));var util=require('util');var utils=require(_0x6507('0x1'));var Mustache=require('mustache');var Redis=require(_0x6507('0x2'));var config=require(_0x6507('0x3'));var logger=require(_0x6507('0x4'))(_0x6507('0x5'));config['redis']=_[_0x6507('0x6')](config[_0x6507('0x7')],{'host':_0x6507('0x8'),'port':0x18eb});var io=require(_0x6507('0x9'))(new Redis(config[_0x6507('0x7')]));function emit(_0x40b66f,_0x55ed42,_0x261d55){io['to'](_0x40b66f)[_0x6507('0xa')](_0x55ed42,_0x261d55);}function sendNotification(_0x44734c,_0x1721e3,_0x502a13,_0x1641ad,_0x172add,_0x301d5d){io['to'](util['format'](_0x6507('0xb'),_0x1641ad[_0x6507('0xc')]))[_0x6507('0xa')](_0x6507('0xd'),_0x1641ad);var _0x2fbd3d=_0x301d5d||{};var _0xebbac0=_0x502a13[_0x6507('0xe')]('.');var _0x60d17c={'uniqueid':_0x1721e3,'channel':_0xebbac0[0x0],'id':_0xebbac0[0x1],'title':_0xebbac0[0x0]+_0x6507('0xf'),'interactionId':_0xebbac0[0x2],'queue':_0x172add?_0x172add[_0x6507('0xc')]:null,'sound':_0x2fbd3d['account'][_0x6507('0x10')],'shake':_0x2fbd3d['account']['notificationShake']};try{if(!_0x2fbd3d[_0x6507('0x11')]){_0x2fbd3d[_0x6507('0x11')]={};}if(_0x172add){_0x2fbd3d[_0x6507('0x11')][_0x6507('0x12')]=_0x172add;}else if(_0x2fbd3d['body']['queue']){delete _0x2fbd3d['body'][_0x6507('0x12')];}_0x60d17c['msg']=utils[_0x6507('0x13')](_0x2fbd3d[_0x6507('0x14')]['notificationTemplate'],_0x2fbd3d);}catch(_0x269473){_0x60d17c[_0x6507('0x15')]=_0x6507('0x16');logger['error'](util[_0x6507('0x17')](_0x6507('0x18'),_0x1721e3,_0x269473[_0x6507('0x19')]));}io['to'](util[_0x6507('0x17')]('user:%s',_0x1641ad[_0x6507('0xc')]))[_0x6507('0xa')](util[_0x6507('0x17')]('notification:%s',_0x44734c?_0x6507('0x1a'):_0x6507('0x1b')),_0x60d17c);}function writeLog(_0x2a8a20,_0x43856a,_0x1ba8c2){return logger[_0x6507('0x1c')](util[_0x6507('0x17')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2a8a20,_0x43856a[_0x6507('0xc')],_0x1ba8c2));}exports[_0x6507('0x1d')]=function(_0x110438,_0x602ca9,_0x5c8ca1,_0x134d16){if(_0x602ca9[_0x6507('0x1e')]){writeLog(_0x110438,_0x602ca9,'BUSY');return![];}if(!_0x602ca9[_0x6507('0x1f')]){writeLog(_0x110438,_0x602ca9,_0x6507('0x20'));return![];}if(_0x602ca9[_0x5c8ca1+'Pause']){writeLog(_0x110438,_0x602ca9,_0x6507('0x21'));return![];}if(_0x134d16&&_0x602ca9[_0x6507('0x22')](_0x5c8ca1+'Capacity')&&_0x602ca9['hasOwnProperty'](_0x5c8ca1+_0x6507('0x23'))){if(_0x602ca9[_0x5c8ca1+_0x6507('0x24')]>0x0&&_0x602ca9[_0x5c8ca1+'CurrentCapacity']>=_0x602ca9[_0x5c8ca1+_0x6507('0x24')]){writeLog(_0x110438,_0x602ca9,_0x5c8ca1[_0x6507('0x25')]()+_0x6507('0x26'));return![];}}return!![];};exports[_0x6507('0x27')]=function(_0x287c33,_0x3b46b2,_0x9940b3,_0x1e8a13,_0x438755){return sendNotification(!![],_0x287c33,_0x3b46b2,_0x9940b3,_0x1e8a13,_0x438755);};exports['hideNotification']=function(_0x33e90d,_0x40bccb,_0x3900a9,_0x42a364,_0x4bb45b){return sendNotification(![],_0x33e90d,_0x40bccb,_0x3900a9,_0x42a364,_0x4bb45b);};exports[_0x6507('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 5d73731..cc73240 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 _0x7d3d=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','shelljs','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x4090c7,_0x3edd62){var _0x2b9dd9=function(_0x4d3acf){while(--_0x4d3acf){_0x4090c7['push'](_0x4090c7['shift']());}};_0x2b9dd9(++_0x3edd62);}(_0x7d3d,0x168));var _0xd7d3=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x7d3d[_0x2ca9d4];return _0x258956;};'use strict';var schema=require(_0xd7d3('0x0'));var sh=require(_0xd7d3('0x1'));var _=require(_0xd7d3('0x2'));var utils=require('./utils');var logger=require(_0xd7d3('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xd7d3('0x4')}});exports['consequence']=function(_0x264bd9,_0x32c31f){return function(_0x57a1e1){try{var _0x5eb357={'command':_0x32c31f[0x0]};var _0x395d41=system[_0xd7d3('0x0')](_0x5eb357,{'typecast':!![]});if(_0x395d41[_0xd7d3('0x5')]){logger['error'](_0xd7d3('0x6'),_0x264bd9,_['map'](_0x395d41,_0xd7d3('0x7'))[_0xd7d3('0x8')](',\x20'));logger[_0xd7d3('0x9')](_0xd7d3('0xa'),_0x264bd9);_0x57a1e1[_0xd7d3('0xb')]();}else{var _0x56eb72=this;var _0x530ec5=utils['getMustacheRender'](_0x32c31f[0x0],this);logger[_0xd7d3('0x9')](_0xd7d3('0xc'),_0x264bd9,_0x530ec5);sh[_0xd7d3('0xd')](_['trim'](_0x530ec5),function(_0x162873,_0x32e448){logger[_0xd7d3('0x9')](_0xd7d3('0xe'),_0x264bd9,_0x162873);if(_0x162873==0x0){var _0x259141=_0x32e448['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xd7d3('0xf')](_0x32c31f[0x1])||_['isEmpty'](_0x32c31f[0x1])){logger['info'](_0xd7d3('0x10'),_0x264bd9);_0x56eb72[_0xd7d3('0x11')][_0x32c31f[0x1]]=_0x259141;}else{logger[_0xd7d3('0x9')](_0xd7d3('0x12'),_0x264bd9,_0x32c31f[0x1],_0x259141);_0x56eb72['body'][_0x32c31f[0x1]]=_0x259141;}}_0x57a1e1['next']();});}}catch(_0x376a30){logger[_0xd7d3('0x13')](_0xd7d3('0x6'),_0x264bd9,_[_0xd7d3('0x14')](_0x376a30)?JSON['stringify'](_0x376a30):_0x376a30);logger[_0xd7d3('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x264bd9);_0x57a1e1[_0xd7d3('0xb')]();}};}; \ No newline at end of file +var _0x3c34=['validate','shelljs','lodash','../../../../config/logger','routing','string','consequence','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','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0x3c34,0x10e));var _0x43c3=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x3c34[_0x3e25c1];return _0x52e7f2;};'use strict';var schema=require(_0x43c3('0x0'));var sh=require(_0x43c3('0x1'));var _=require(_0x43c3('0x2'));var utils=require('./utils');var logger=require(_0x43c3('0x3'))(_0x43c3('0x4'));var system=schema({'command':{'type':_0x43c3('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x43c3('0x6')]=function(_0x2c665b,_0x4baa2e){return function(_0x7f6ed4){try{var _0x139e25={'command':_0x4baa2e[0x0]};var _0x192b7b=system[_0x43c3('0x0')](_0x139e25,{'typecast':!![]});if(_0x192b7b[_0x43c3('0x7')]){logger[_0x43c3('0x8')](_0x43c3('0x9'),_0x2c665b,_[_0x43c3('0xa')](_0x192b7b,_0x43c3('0xb'))[_0x43c3('0xc')](',\x20'));logger[_0x43c3('0xd')](_0x43c3('0xe'),_0x2c665b);_0x7f6ed4[_0x43c3('0xf')]();}else{var _0x2c4500=this;var _0x28da13=utils[_0x43c3('0x10')](_0x4baa2e[0x0],this);logger[_0x43c3('0xd')](_0x43c3('0x11'),_0x2c665b,_0x28da13);sh[_0x43c3('0x12')](_[_0x43c3('0x13')](_0x28da13),function(_0x2c6c95,_0x9bfc22){logger[_0x43c3('0xd')](_0x43c3('0x14'),_0x2c665b,_0x2c6c95);if(_0x2c6c95==0x0){var _0x56f306=_0x9bfc22['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x43c3('0x15')](_0x4baa2e[0x1])||_[_0x43c3('0x16')](_0x4baa2e[0x1])){logger[_0x43c3('0xd')](_0x43c3('0x17'),_0x2c665b);_0x2c4500['body'][_0x4baa2e[0x1]]=_0x56f306;}else{logger[_0x43c3('0xd')](_0x43c3('0x18'),_0x2c665b,_0x4baa2e[0x1],_0x56f306);_0x2c4500['body'][_0x4baa2e[0x1]]=_0x56f306;}}_0x7f6ed4[_0x43c3('0xf')]();});}}catch(_0x278872){logger[_0x43c3('0x8')](_0x43c3('0x9'),_0x2c665b,_[_0x43c3('0x19')](_0x278872)?JSON[_0x43c3('0x1a')](_0x278872):_0x278872);logger[_0x43c3('0xd')](_0x43c3('0xe'),_0x2c665b);_0x7f6ed4[_0x43c3('0xf')]();}};}; \ 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 3412381..5e18e33 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 _0xa9a6=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xa9a6,0xad));var _0x6a9a=function(_0x53f3fa,_0x46064a){_0x53f3fa=_0x53f3fa-0x0;var _0x217176=_0xa9a6[_0x53f3fa];return _0x217176;};'use strict';var schema=require('validate');var _=require(_0x6a9a('0x0'));var rpc={'chatInteraction':require(_0x6a9a('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6a9a('0x2')),'mailInteraction':require(_0x6a9a('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6a9a('0x4'))};var logger=require(_0x6a9a('0x5'))(_0x6a9a('0x6'));var tag=schema({'tag':{'type':_0x6a9a('0x7'),'required':!![],'message':_0x6a9a('0x8')}});exports[_0x6a9a('0x9')]=function(_0x301a10,_0x31ab1f,_0x38e2da,_0x39ace8){return function(_0xdc24ce){try{var _0xd362b8={'tag':_0x31ab1f[0x0]};var _0x54e270=tag[_0x6a9a('0xa')](_0xd362b8,{'typecast':!![]});if(_0x54e270[_0x6a9a('0xb')]){logger[_0x6a9a('0xc')](_0x6a9a('0xd'),_0x301a10,_[_0x6a9a('0xe')](_0x54e270,_0x6a9a('0xf'))[_0x6a9a('0x10')](',\x20'));logger['info'](_0x6a9a('0x11'),_0x301a10);_0xdc24ce[_0x6a9a('0x12')]();}else{var _0x2c2527={'ids':[_0x31ab1f[0x0]]};if(rpc[_0x39ace8['channel']+_0x6a9a('0x13')]){rpc[_0x39ace8[_0x6a9a('0x14')]+_0x6a9a('0x13')][_0x6a9a('0x15')](_0x39ace8[_0x6a9a('0x16')]['id'],_0x2c2527)[_0x6a9a('0x17')](function(_0x1687e3){logger[_0x6a9a('0x18')](_0x6a9a('0x19'),_0x301a10,_0x31ab1f[0x1],_0x39ace8[_0x6a9a('0x14')],_0x39ace8[_0x6a9a('0x16')]['id']);})[_0x6a9a('0x1a')](function(_0x4d65e2){logger[_0x6a9a('0xc')](_0x6a9a('0xd'),_0x301a10,JSON[_0x6a9a('0x1b')](_0x4d65e2));logger['info'](_0x6a9a('0x11'),_0x301a10);})[_0x6a9a('0x1c')](function(){_0xdc24ce[_0x6a9a('0x12')]();});}}}catch(_0x1ed7fe){logger[_0x6a9a('0xc')](_0x6a9a('0xd'),_0x301a10,_[_0x6a9a('0x1d')](_0x1ed7fe)?JSON[_0x6a9a('0x1b')](_0x1ed7fe):_0x1ed7fe);logger['info'](_0x6a9a('0x11'),_0x301a10);_0xdc24ce[_0x6a9a('0x12')]();}};}; \ No newline at end of file +var _0x8c8e=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8c8e,0x179));var _0xe8c8=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0x8c8e[_0x44f974];return _0x805dbd;};'use strict';var schema=require(_0xe8c8('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xe8c8('0x1')),'smsInteraction':require(_0xe8c8('0x2')),'mailInteraction':require(_0xe8c8('0x3')),'faxInteraction':require(_0xe8c8('0x4')),'whatsappInteraction':require(_0xe8c8('0x5'))};var logger=require(_0xe8c8('0x6'))(_0xe8c8('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xe8c8('0x8')}});exports[_0xe8c8('0x9')]=function(_0x1ec3d0,_0x1f3358,_0x5ee285,_0x3a9a9f){return function(_0xc8561f){try{var _0x4b74ee={'tag':_0x1f3358[0x0]};var _0x2bf916=tag[_0xe8c8('0x0')](_0x4b74ee,{'typecast':!![]});if(_0x2bf916[_0xe8c8('0xa')]){logger[_0xe8c8('0xb')](_0xe8c8('0xc'),_0x1ec3d0,_[_0xe8c8('0xd')](_0x2bf916,_0xe8c8('0xe'))[_0xe8c8('0xf')](',\x20'));logger[_0xe8c8('0x10')](_0xe8c8('0x11'),_0x1ec3d0);_0xc8561f[_0xe8c8('0x12')]();}else{var _0x3823e8={'ids':[_0x1f3358[0x0]]};if(rpc[_0x3a9a9f[_0xe8c8('0x13')]+_0xe8c8('0x14')]){rpc[_0x3a9a9f[_0xe8c8('0x13')]+_0xe8c8('0x14')][_0xe8c8('0x15')](_0x3a9a9f[_0xe8c8('0x16')]['id'],_0x3823e8)['then'](function(_0x1d5cf3){logger[_0xe8c8('0x10')](_0xe8c8('0x17'),_0x1ec3d0,_0x1f3358[0x1],_0x3a9a9f[_0xe8c8('0x13')],_0x3a9a9f[_0xe8c8('0x16')]['id']);})['catch'](function(_0x54254a){logger[_0xe8c8('0xb')](_0xe8c8('0xc'),_0x1ec3d0,JSON[_0xe8c8('0x18')](_0x54254a));logger['info'](_0xe8c8('0x11'),_0x1ec3d0);})[_0xe8c8('0x19')](function(){_0xc8561f[_0xe8c8('0x12')]();});}}}catch(_0x26135f){logger[_0xe8c8('0xb')](_0xe8c8('0xc'),_0x1ec3d0,_[_0xe8c8('0x1a')](_0x26135f)?JSON[_0xe8c8('0x18')](_0x26135f):_0x26135f);logger[_0xe8c8('0x10')](_0xe8c8('0x11'),_0x1ec3d0);_0xc8561f['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 e4ce767..fd06256 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 _0xc6ab=['exports','body','contact','message','account','interaction','mustache','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc6ab,0x96));var _0xbc6a=function(_0x3df49a,_0x58a027){_0x3df49a=_0x3df49a-0x0;var _0x31d7fa=_0xc6ab[_0x3df49a];return _0x31d7fa;};'use strict';var Mustache=require(_0xbc6a('0x0'));var _=require(_0xbc6a('0x1'));module[_0xbc6a('0x2')]={'getMustacheRender':function(_0xc21d43,_0x3d445d){return Mustache['render'](_0xc21d43,_['merge'](_0x3d445d[_0xbc6a('0x3')],{'contact':_0x3d445d[_0xbc6a('0x4')],'message':_0x3d445d[_0xbc6a('0x5')],'account':_0x3d445d[_0xbc6a('0x6')],'interaction':_0x3d445d[_0xbc6a('0x7')],'list':_0x3d445d['list']}))||'';}}; \ No newline at end of file +var _0x9e9b=['message','interaction','list','mustache','render','merge','contact'];(function(_0x20eb9c,_0x43efd3){var _0x4e3758=function(_0xb1b2e2){while(--_0xb1b2e2){_0x20eb9c['push'](_0x20eb9c['shift']());}};_0x4e3758(++_0x43efd3);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x9e9b[_0x10b317];return _0x1e3054;};'use strict';var Mustache=require(_0xb9e9('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x39a0db,_0x3d68be){return Mustache[_0xb9e9('0x1')](_0x39a0db,_[_0xb9e9('0x2')](_0x3d68be['body'],{'contact':_0x3d68be[_0xb9e9('0x3')],'message':_0x3d68be[_0xb9e9('0x4')],'account':_0x3d68be['account'],'interaction':_0x3d68be[_0xb9e9('0x5')],'list':_0x3d68be[_0xb9e9('0x6')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 08d178b..aa071c9 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 _0x9822=['listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','appdata','split','push','slice','dialogflow','TagId','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','stack','routing\x20is\x20empty','rules','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server'];(function(_0x1fcf88,_0x45ccf6){var _0x47472c=function(_0x1ffb1d){while(--_0x1ffb1d){_0x1fcf88['push'](_0x1fcf88['shift']());}};_0x47472c(++_0x45ccf6);}(_0x9822,0xbf));var _0x2982=function(_0x3bc325,_0x454e48){_0x3bc325=_0x3bc325-0x0;var _0x1e92cb=_0x9822[_0x3bc325];return _0x1e92cb;};'use strict';var _=require(_0x2982('0x0'));var util=require(_0x2982('0x1'));var path=require(_0x2982('0x2'));var fs=require('fs');var jayson=require(_0x2982('0x3'));var BPromise=require(_0x2982('0x4'));var uuid=require(_0x2982('0x5'));var config=require(_0x2982('0x6'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x2982('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x2982('0x8')),'smsQueueReport':require(_0x2982('0x9')),'faxQueueReport':require(_0x2982('0xa')),'whatsappQueueReport':require(_0x2982('0xb'))};var RuleEngine=require(_0x2982('0xc'));function getId(_0x52b5c2,_0x10e59a,_0x3e5440){return util[_0x2982('0xd')](_0x2982('0xe'),_0x52b5c2,_0x10e59a||0x0,_0x3e5440||0x0);}function getIntervals(_0x68f814,_0x95d651){var _0x3c8c98=[];if(!_[_0x2982('0xf')](_0x95d651['IntervalId'])&&!_[_0x2982('0xf')](_0x68f814[_0x95d651[_0x2982('0x10')]])&&!_[_0x2982('0xf')](_0x68f814[_0x95d651[_0x2982('0x10')]][_0x2982('0x11')])){_0x3c8c98=_[_0x2982('0x12')](_0x68f814[_0x95d651[_0x2982('0x10')]][_0x2982('0x11')],_0x2982('0x13'));}else if(!_[_0x2982('0xf')](_0x95d651[_0x2982('0x13')])){_0x3c8c98=[_0x95d651['interval']];}return _0x3c8c98;}exports['listen']=function(_0x489dec){_0x489dec['rules']={};return new BPromise(function(_0x552ab1,_0x469bbb){var _0x51db1a={'Start':function(_0x4068d7){var _0x48a9b4=this;return new Promise(function(_0x1bf79d,_0x27cf54){if(_0x4068d7){try{var _0x12a042=[];var _0x2d8ebf=getId(_0x4068d7[_0x2982('0x14')],_0x4068d7[_0x2982('0x15')]?_0x4068d7['message']['id']:0x0,_0x4068d7['interaction']?_0x4068d7[_0x2982('0x16')]['id']:0x0);if(_0x4068d7[_0x2982('0x17')]&&_[_0x2982('0x18')](_0x4068d7[_0x2982('0x17')])&&_0x4068d7[_0x2982('0x17')][_0x2982('0x19')]){for(var _0x19ca39=0x0;_0x19ca39<_0x4068d7[_0x2982('0x17')][_0x2982('0x19')];_0x19ca39+=0x1){var _0x110bdf=_0x4068d7[_0x2982('0x17')][_0x19ca39];if(fs[_0x2982('0x1a')](path[_0x2982('0x1b')](__dirname,_0x2982('0x17'),_0x110bdf[_0x2982('0x1c')]+'.js'))){var _0x46543e=[];switch(_0x110bdf[_0x2982('0x1c')][_0x2982('0x1d')]()){case'autoreply':var _0x6f7826=_0x110bdf[_0x2982('0x1e')][_0x2982('0x1f')](',');_0x46543e[_0x2982('0x20')](_0x6f7826[0x0]);_0x46543e[_0x2982('0x20')](_0x6f7826[_0x2982('0x21')](0x1,_0x6f7826[_0x2982('0x19')])[_0x2982('0x1b')](','));break;case _0x2982('0x22'):var _0x1f1aa0=_0x110bdf[_0x2982('0x1e')][_0x2982('0x1f')](',');_0x46543e[_0x2982('0x20')](_0x1f1aa0[0x0]);_0x46543e[_0x2982('0x20')](_0x1f1aa0[0x1]);_0x46543e[_0x2982('0x20')](_0x1f1aa0[_0x2982('0x21')](0x2,_0x1f1aa0[_0x2982('0x19')])[_0x2982('0x1b')](','));break;case'amazonlex':var _0x5d3a96=_0x110bdf[_0x2982('0x1e')][_0x2982('0x1f')](',');_0x46543e[_0x2982('0x20')](_0x5d3a96[0x0]);_0x46543e[_0x2982('0x20')](_0x5d3a96[0x1]);_0x46543e[_0x2982('0x20')](_0x5d3a96[0x2]);_0x46543e['push'](_0x5d3a96[0x3]);_0x46543e[_0x2982('0x20')](_0x5d3a96[_0x2982('0x21')](0x4,_0x5d3a96[_0x2982('0x19')])[_0x2982('0x1b')](','));break;case _0x2982('0x15'):_0x46543e[_0x2982('0x20')](_0x110bdf[_0x2982('0x1e')]);break;case'tag':_0x46543e[_0x2982('0x20')](_0x110bdf[_0x2982('0x23')]);_0x46543e[_0x2982('0x20')](_0x110bdf[_0x2982('0x1e')]);break;default:_0x46543e=_['isNil'](_0x110bdf[_0x2982('0x1e')])?[]:_0x110bdf[_0x2982('0x1e')]['split'](',');}var _0x2fca9a={'id':util[_0x2982('0xd')]('%s:%s:%s',_0x2d8ebf,_0x110bdf['id'],_0x110bdf[_0x2982('0x1c')]),'condition':require(_0x2982('0x24'))[_0x2982('0x25')](_0x2d8ebf,getIntervals(_0x489dec[_0x2982('0x26')],_0x110bdf),_0x489dec),'consequence':require(_0x2982('0x27')+_0x110bdf['app'])[_0x2982('0x28')](_0x2d8ebf,_0x46543e,_0x489dec,_0x4068d7),'p':_0x110bdf[_0x2982('0x29')]||0x0};logger[_0x2982('0x2a')](_0x2982('0x2b'),_0x2fca9a['id'],_0x2982('0x2c'),getIntervals(_0x489dec['intervals'],_0x110bdf)[_0x2982('0x1b')](_0x2982('0x2d')));_0x12a042[_0x2982('0x20')](_0x2fca9a);}else{logger[_0x2982('0x2e')](_0x2982('0x2f'),path[_0x2982('0x1b')](__dirname,_0x2982('0x17'),_0x110bdf[_0x2982('0x1c')]+'.js'));}}_0x489dec['rules'][_0x2d8ebf]=new RuleEngine(_0x12a042);_0x489dec['rules'][_0x2d8ebf][_0x2982('0x30')](_0x4068d7,function(_0x44a83a){logger[_0x2982('0x2a')](_0x2982('0x31'),JSON['stringify'](_0x44a83a[_0x2982('0x32')]));if(_0x489dec['rules'][_0x2d8ebf]){_0x489dec['rules'][_0x2d8ebf][_0x2982('0x33')](_0x2982('0x34'));}});return _0x1bf79d({'code':0xc8,'message':_0x4068d7});}else{logger[_0x2982('0x2a')]('No\x20applications\x20to\x20execute');return _0x1bf79d({'code':0xc8,'message':_0x4068d7});}}catch(_0x4ea9d4){logger[_0x2982('0x2e')](_0x4ea9d4[_0x2982('0x35')]);return _0x27cf54(_0x48a9b4[_0x2982('0x2e')](0x1f4,_0x4ea9d4));}}return _0x27cf54(_0x2982('0x36'));});},'AcceptMessage':function(_0x40c48a){var _0x15a224=this;return new Promise(function(_0x42ea90,_0x5845b8){if(_0x40c48a[_0x2982('0x15')]&&_0x40c48a[_0x2982('0x15')]['id']){try{var _0x420150=getId(_0x40c48a['channel'],_0x40c48a[_0x2982('0x15')]?_0x40c48a[_0x2982('0x15')]['id']:0x0,_0x40c48a[_0x2982('0x16')]?_0x40c48a[_0x2982('0x16')]['id']:0x0);if(_0x489dec[_0x2982('0x37')][_0x420150]){_0x489dec[_0x2982('0x37')][_0x420150][_0x2982('0x33')]('end');if(rpc[_0x40c48a['channel']+_0x2982('0x38')]){rpc[_0x40c48a['channel']+_0x2982('0x38')][_0x2982('0x39')](_0x420150,{'UserId':_0x40c48a[_0x2982('0x15')][_0x2982('0x3a')]})[_0x2982('0x3b')](function(_0x556a23){logger[_0x2982('0x2e')](_0x2982('0x3c'));});}}return _0x42ea90({'code':0xc8,'message':_0x40c48a});}catch(_0x48f972){logger[_0x2982('0x2e')](_0x48f972[_0x2982('0x35')]);return _0x5845b8(_0x15a224[_0x2982('0x2e')](0x1f4,_0x48f972));}}logger[_0x2982('0x2e')](_0x2982('0x3d'));return _0x5845b8(_0x15a224[_0x2982('0x2e')](0x1f4,_0x2982('0x3d')));});},'RejectMessage':function(_0x346eb6){var _0x22b143=this;return new Promise(function(_0x1282b4,_0x1b6e8a){if(_0x346eb6[_0x2982('0x3e')]&&_0x346eb6[_0x2982('0x3e')]['id']){try{if(_0x489dec['agents'][_0x346eb6[_0x2982('0x3e')]['id']]){_0x489dec[_0x2982('0x3f')][_0x346eb6[_0x2982('0x3e')]['id']]['busy']=![];_0x489dec[_0x2982('0x3f')][_0x346eb6[_0x2982('0x3e')]['id']][_0x2982('0x40')]=undefined;}return _0x1282b4({'code':0xc8,'message':_0x346eb6});}catch(_0x46bb4d){logger[_0x2982('0x2e')](_0x46bb4d[_0x2982('0x35')]);return _0x1b6e8a(_0x22b143['error'](0x1f4,_0x46bb4d));}}logger['error'](_0x2982('0x3d'));return _0x1b6e8a(_0x22b143['error'](0x1f4,_0x2982('0x3d')));});},'AbandonInteraction':function(_0x2b1a67){var _0x384214=this;return new Promise(function(_0x26f16e,_0x55faf0){if(_0x2b1a67[_0x2982('0x14')]&&_0x2b1a67[_0x2982('0x16')]&&_0x2b1a67[_0x2982('0x16')]['id']){try{var _0x583c22=getId(_0x2b1a67['channel'],_0x2b1a67[_0x2982('0x15')]?_0x2b1a67['message']['id']:0x0,_0x2b1a67[_0x2982('0x16')]?_0x2b1a67[_0x2982('0x16')]['id']:0x0);if(_0x489dec[_0x2982('0x37')][_0x583c22]){_0x489dec[_0x2982('0x37')][_0x583c22][_0x2982('0x33')](_0x2982('0x41'));}return _0x26f16e({'code':0xc8,'message':_0x2b1a67});}catch(_0x142ca4){logger[_0x2982('0x2e')](_0x142ca4[_0x2982('0x35')]);return _0x55faf0(_0x384214[_0x2982('0x2e')](0x1f4,_0x142ca4));}}logger[_0x2982('0x2e')](_0x2982('0x3d'));return _0x55faf0(_0x384214[_0x2982('0x2e')](0x1f4,_0x2982('0x3d')));});},'AgentCapacity':function(_0x14bf80){var _0x306d17=this;return new Promise(function(_0x1e3e5a,_0x35b5b2){if(_0x489dec[_0x2982('0x3f')][_0x2982('0x42')](_0x14bf80['id'])){for(var _0x5c0bc8 in _0x14bf80[_0x2982('0x43')]){if(_0x14bf80[_0x2982('0x43')][_0x2982('0x42')](_0x5c0bc8)){if(_0x489dec['agents'][_0x14bf80['id']]['hasOwnProperty'](_0x5c0bc8+'CurrentCapacity')){_0x489dec[_0x2982('0x3f')][_0x14bf80['id']][_0x5c0bc8+_0x2982('0x44')]=parseInt(_0x14bf80[_0x2982('0x43')][_0x5c0bc8],0xa);}}}_0x489dec[_0x2982('0x3f')][_0x14bf80['id']][_0x2982('0x45')]();return _0x1e3e5a({'code':0xc8,'message':_0x489dec[_0x2982('0x3f')][_0x14bf80['id']]});}else{return _0x35b5b2(_0x306d17[_0x2982('0x2e')](0x1f4,_0x2982('0x46')));}});},'Agents':function(_0x254b2a){return new Promise(function(_0x5f5d78,_0x5c6568){var _0x4f0f83=_[_0x2982('0x47')](_0x489dec['agents']);_0x5f5d78({'count':_0x4f0f83[_0x2982('0x19')],'rows':_0x4f0f83});});},'ChatQueues':function(_0x1d8c4d){return new Promise(function(_0x1e4400,_0x810cad){var _0x3cc4a7=[];for(var _0x4dbb2d in _0x489dec[_0x2982('0x48')]){if(_0x489dec['chatQueues']['hasOwnProperty'](_0x4dbb2d)){var _0x5f407b=_0x489dec[_0x2982('0x48')][_0x4dbb2d];var _0x59eec8={'id':_0x5f407b['id'],'available':_0x5f407b['available'],'loggedIn':_0x5f407b[_0x2982('0x49')],'name':_0x5f407b['name'],'paused':_0x5f407b[_0x2982('0x4a')],'waiting':_0x5f407b[_0x2982('0x4b')]};_0x3cc4a7[_0x2982('0x20')](_0x59eec8);}}_0x1e4400({'count':_0x3cc4a7[_0x2982('0x19')],'rows':_0x3cc4a7});});},'MailQueues':function(_0x1bfad4){return new Promise(function(_0x3ef0a2,_0x2838ac){var _0x4f9825=[];for(var _0x2dc729 in _0x489dec[_0x2982('0x4c')]){if(_0x489dec[_0x2982('0x4c')][_0x2982('0x42')](_0x2dc729)){var _0x36fece=_0x489dec['mailQueues'][_0x2dc729];var _0x318ca7={'id':_0x36fece['id'],'available':_0x36fece[_0x2982('0x4d')],'loggedIn':_0x36fece[_0x2982('0x49')],'name':_0x36fece[_0x2982('0x4e')],'paused':_0x36fece[_0x2982('0x4a')],'waiting':_0x36fece[_0x2982('0x4b')]};_0x4f9825[_0x2982('0x20')](_0x318ca7);}}_0x3ef0a2({'count':_0x4f9825[_0x2982('0x19')],'rows':_0x4f9825});});},'OpenchannelQueues':function(_0x5e58a4){return new Promise(function(_0x31b243,_0x5b6b06){var _0x59e005=[];for(var _0x147bf6 in _0x489dec['openchannelQueues']){if(_0x489dec[_0x2982('0x4f')][_0x2982('0x42')](_0x147bf6)){var _0x3fc132=_0x489dec[_0x2982('0x4f')][_0x147bf6];var _0x3c580b={'id':_0x3fc132['id'],'available':_0x3fc132[_0x2982('0x4d')],'loggedIn':_0x3fc132[_0x2982('0x49')],'name':_0x3fc132[_0x2982('0x4e')],'paused':_0x3fc132[_0x2982('0x4a')],'waiting':_0x3fc132[_0x2982('0x4b')]};_0x59e005[_0x2982('0x20')](_0x3c580b);}}_0x31b243({'count':_0x59e005['length'],'rows':_0x59e005});});},'SmsQueues':function(_0x4b1fb1){return new Promise(function(_0x6b4594,_0x501d24){var _0x16ba8c=[];for(var _0x76297e in _0x489dec[_0x2982('0x50')]){if(_0x489dec[_0x2982('0x50')][_0x2982('0x42')](_0x76297e)){var _0x22a74e=_0x489dec['smsQueues'][_0x76297e];var _0x154d56={'id':_0x22a74e['id'],'available':_0x22a74e[_0x2982('0x4d')],'loggedIn':_0x22a74e[_0x2982('0x49')],'name':_0x22a74e[_0x2982('0x4e')],'paused':_0x22a74e[_0x2982('0x4a')],'waiting':_0x22a74e['waiting']};_0x16ba8c[_0x2982('0x20')](_0x154d56);}}_0x6b4594({'count':_0x16ba8c[_0x2982('0x19')],'rows':_0x16ba8c});});},'FaxQueues':function(_0x59f692){return new Promise(function(_0xb75134,_0x2ddec3){var _0x216f00=[];for(var _0x23af5b in _0x489dec[_0x2982('0x51')]){if(_0x489dec[_0x2982('0x51')][_0x2982('0x42')](_0x23af5b)){var _0x292e04=_0x489dec[_0x2982('0x51')][_0x23af5b];var _0x47125a={'id':_0x292e04['id'],'available':_0x292e04['available'],'loggedIn':_0x292e04[_0x2982('0x49')],'name':_0x292e04[_0x2982('0x4e')],'paused':_0x292e04[_0x2982('0x4a')],'waiting':_0x292e04[_0x2982('0x4b')]};_0x216f00['push'](_0x47125a);}}_0xb75134({'count':_0x216f00['length'],'rows':_0x216f00});});},'WhatsappQueues':function(_0x144a27){return new Promise(function(_0x29dfb1,_0x2d42cd){var _0x6b821b=[];for(var _0x34894b in _0x489dec['whatsappQueues']){if(_0x489dec[_0x2982('0x52')][_0x2982('0x42')](_0x34894b)){var _0x2c52ae=_0x489dec[_0x2982('0x52')][_0x34894b];var _0x490011={'id':_0x2c52ae['id'],'available':_0x2c52ae['available'],'loggedIn':_0x2c52ae[_0x2982('0x49')],'name':_0x2c52ae['name'],'paused':_0x2c52ae[_0x2982('0x4a')],'waiting':_0x2c52ae[_0x2982('0x4b')]};_0x6b821b[_0x2982('0x20')](_0x490011);}}_0x29dfb1({'count':_0x6b821b[_0x2982('0x19')],'rows':_0x6b821b});});},'ChatQueuesWaitingInteractions':function(_0x4ca4d4){return new Promise(function(_0x5d4e6d,_0x420ee4){var _0x585684=_[_0x2982('0x47')](_0x489dec[_0x2982('0x53')]);_0x5d4e6d({'count':_0x585684['length'],'rows':_0x585684});});},'MailQueuesWaitingInteractions':function(_0x307b15){return new Promise(function(_0x11ae43,_0x15b41b){var _0xa633e3=_[_0x2982('0x47')](_0x489dec[_0x2982('0x54')]);_0x11ae43({'count':_0xa633e3[_0x2982('0x19')],'rows':_0xa633e3});});},'OpenchannelQueuesWaitingInteractions':function(_0xc1622a){return new Promise(function(_0x4dec4e,_0x3a629f){var _0x3650ea=_[_0x2982('0x47')](_0x489dec[_0x2982('0x55')]);_0x4dec4e({'count':_0x3650ea[_0x2982('0x19')],'rows':_0x3650ea});});},'SmsQueuesWaitingInteractions':function(_0x44712d){return new Promise(function(_0x4c4bf4,_0x696487){var _0x3e4b99=_[_0x2982('0x47')](_0x489dec[_0x2982('0x56')]);_0x4c4bf4({'count':_0x3e4b99[_0x2982('0x19')],'rows':_0x3e4b99});});},'FaxQueuesWaitingInteractions':function(_0x2a80c0){return new Promise(function(_0x10d609,_0x413516){var _0x46d69e=_[_0x2982('0x47')](_0x489dec['faxQueuesWaitingInteractions']);_0x10d609({'count':_0x46d69e[_0x2982('0x19')],'rows':_0x46d69e});});},'WhatsappQueuesWaitingInteractions':function(_0x16ddcf){return new Promise(function(_0x1ec5c4,_0x120475){var _0x534024=_[_0x2982('0x47')](_0x489dec['whatsappQueuesWaitingInteractions']);_0x1ec5c4({'count':_0x534024[_0x2982('0x19')],'rows':_0x534024});});}};var _0x474665=jayson[_0x2982('0x57')](_0x51db1a)['http']();_0x474665['on'](_0x2982('0x2e'),function(_0x218aa3){logger[_0x2982('0x2e')](JSON['stringify'](_0x218aa3));return _0x469bbb(_0x218aa3);});_0x474665[_0x2982('0x58')](0x232c,_0x2982('0x59'),function(){console[_0x2982('0x5a')](_0x2982('0x5b'),0x232c);return _0x552ab1(_0x2982('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x8350=['app','.js','toLowerCase','autoreply','push','slice','length','dialogflow','appdata','split','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','end','QueueReport','UserId','error\x20update\x20queue\x20report','agent','agents','busyQueue','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','existsSync','join'];(function(_0x7fcbbd,_0x1ac9a6){var _0x57270f=function(_0x21ca61){while(--_0x21ca61){_0x7fcbbd['push'](_0x7fcbbd['shift']());}};_0x57270f(++_0x1ac9a6);}(_0x8350,0x1b8));var _0x0835=function(_0x2ce444,_0x4924dd){_0x2ce444=_0x2ce444-0x0;var _0x8f4d15=_0x8350[_0x2ce444];return _0x8f4d15;};'use strict';var _=require(_0x0835('0x0'));var util=require(_0x0835('0x1'));var path=require(_0x0835('0x2'));var fs=require('fs');var jayson=require(_0x0835('0x3'));var BPromise=require(_0x0835('0x4'));var uuid=require('uuid');var config=require(_0x0835('0x5'));var logger=require(_0x0835('0x6'))(_0x0835('0x7'));var rpc={'openchannelQueueReport':require(_0x0835('0x8')),'mailQueueReport':require(_0x0835('0x9')),'chatQueueReport':require(_0x0835('0xa')),'smsQueueReport':require(_0x0835('0xb')),'faxQueueReport':require(_0x0835('0xc')),'whatsappQueueReport':require(_0x0835('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x13c442,_0x53fcd5,_0x1c5d58){return util[_0x0835('0xe')](_0x0835('0xf'),_0x13c442,_0x53fcd5||0x0,_0x1c5d58||0x0);}function getIntervals(_0xeccd45,_0xabf9bc){var _0x2bb1b3=[];if(!_['isNil'](_0xabf9bc[_0x0835('0x10')])&&!_[_0x0835('0x11')](_0xeccd45[_0xabf9bc[_0x0835('0x10')]])&&!_[_0x0835('0x11')](_0xeccd45[_0xabf9bc['IntervalId']][_0x0835('0x12')])){_0x2bb1b3=_[_0x0835('0x13')](_0xeccd45[_0xabf9bc[_0x0835('0x10')]][_0x0835('0x12')],'interval');}else if(!_[_0x0835('0x11')](_0xabf9bc[_0x0835('0x14')])){_0x2bb1b3=[_0xabf9bc['interval']];}return _0x2bb1b3;}exports[_0x0835('0x15')]=function(_0x290bd2){_0x290bd2[_0x0835('0x16')]={};return new BPromise(function(_0xa3a867,_0x3bdd8d){var _0x5328e5={'Start':function(_0x16b840){var _0x1448a4=this;return new Promise(function(_0x3b0350,_0x23664d){if(_0x16b840){try{var _0x10f8c3=[];var _0x206343=getId(_0x16b840[_0x0835('0x17')],_0x16b840['message']?_0x16b840[_0x0835('0x18')]['id']:0x0,_0x16b840['interaction']?_0x16b840[_0x0835('0x19')]['id']:0x0);if(_0x16b840[_0x0835('0x1a')]&&_[_0x0835('0x1b')](_0x16b840[_0x0835('0x1a')])&&_0x16b840[_0x0835('0x1a')]['length']){for(var _0x5fd9fa=0x0;_0x5fd9fa<_0x16b840[_0x0835('0x1a')]['length'];_0x5fd9fa+=0x1){var _0x3f2f22=_0x16b840[_0x0835('0x1a')][_0x5fd9fa];if(fs[_0x0835('0x1c')](path[_0x0835('0x1d')](__dirname,_0x0835('0x1a'),_0x3f2f22[_0x0835('0x1e')]+_0x0835('0x1f')))){var _0x33193c=[];switch(_0x3f2f22[_0x0835('0x1e')][_0x0835('0x20')]()){case _0x0835('0x21'):var _0x13a1b8=_0x3f2f22['appdata']['split'](',');_0x33193c[_0x0835('0x22')](_0x13a1b8[0x0]);_0x33193c['push'](_0x13a1b8[_0x0835('0x23')](0x1,_0x13a1b8[_0x0835('0x24')])[_0x0835('0x1d')](','));break;case _0x0835('0x25'):var _0x5625bb=_0x3f2f22[_0x0835('0x26')][_0x0835('0x27')](',');_0x33193c[_0x0835('0x22')](_0x5625bb[0x0]);_0x33193c[_0x0835('0x22')](_0x5625bb[0x1]);_0x33193c[_0x0835('0x22')](_0x5625bb[_0x0835('0x23')](0x2,_0x5625bb['length'])['join'](','));break;case _0x0835('0x28'):var _0x3c795a=_0x3f2f22[_0x0835('0x26')][_0x0835('0x27')](',');_0x33193c[_0x0835('0x22')](_0x3c795a[0x0]);_0x33193c[_0x0835('0x22')](_0x3c795a[0x1]);_0x33193c[_0x0835('0x22')](_0x3c795a[0x2]);_0x33193c[_0x0835('0x22')](_0x3c795a[0x3]);_0x33193c[_0x0835('0x22')](_0x3c795a['slice'](0x4,_0x3c795a[_0x0835('0x24')])[_0x0835('0x1d')](','));break;case _0x0835('0x18'):_0x33193c['push'](_0x3f2f22[_0x0835('0x26')]);break;case _0x0835('0x29'):_0x33193c['push'](_0x3f2f22['TagId']);_0x33193c[_0x0835('0x22')](_0x3f2f22[_0x0835('0x26')]);break;default:_0x33193c=_[_0x0835('0x11')](_0x3f2f22[_0x0835('0x26')])?[]:_0x3f2f22[_0x0835('0x26')][_0x0835('0x27')](',');}var _0x1f7c40={'id':util['format'](_0x0835('0x2a'),_0x206343,_0x3f2f22['id'],_0x3f2f22[_0x0835('0x1e')]),'condition':require(_0x0835('0x2b'))[_0x0835('0x2c')](_0x206343,getIntervals(_0x290bd2[_0x0835('0x2d')],_0x3f2f22),_0x290bd2),'consequence':require(_0x0835('0x2e')+_0x3f2f22['app'])[_0x0835('0x2f')](_0x206343,_0x33193c,_0x290bd2,_0x16b840),'p':_0x3f2f22[_0x0835('0x30')]||0x0};logger[_0x0835('0x31')](_0x0835('0x32'),_0x1f7c40['id'],_0x0835('0x33'),getIntervals(_0x290bd2[_0x0835('0x2d')],_0x3f2f22)['join'](_0x0835('0x34')));_0x10f8c3[_0x0835('0x22')](_0x1f7c40);}else{logger['error'](_0x0835('0x35'),path['join'](__dirname,'applications',_0x3f2f22[_0x0835('0x1e')]+_0x0835('0x1f')));}}_0x290bd2[_0x0835('0x16')][_0x206343]=new RuleEngine(_0x10f8c3);_0x290bd2[_0x0835('0x16')][_0x206343][_0x0835('0x36')](_0x16b840,function(_0x24f9a0){logger[_0x0835('0x31')]('Applications\x20executed',JSON[_0x0835('0x37')](_0x24f9a0[_0x0835('0x38')]));if(_0x290bd2['rules'][_0x206343]){_0x290bd2['rules'][_0x206343][_0x0835('0x39')](_0x0835('0x3a'));}});return _0x3b0350({'code':0xc8,'message':_0x16b840});}else{logger[_0x0835('0x31')](_0x0835('0x3b'));return _0x3b0350({'code':0xc8,'message':_0x16b840});}}catch(_0x3ad893){logger[_0x0835('0x3c')](_0x3ad893[_0x0835('0x3d')]);return _0x23664d(_0x1448a4[_0x0835('0x3c')](0x1f4,_0x3ad893));}}return _0x23664d(_0x0835('0x3e'));});},'AcceptMessage':function(_0x250705){var _0x1a8429=this;return new Promise(function(_0x247069,_0x16c5f9){if(_0x250705[_0x0835('0x18')]&&_0x250705[_0x0835('0x18')]['id']){try{var _0x548187=getId(_0x250705['channel'],_0x250705[_0x0835('0x18')]?_0x250705[_0x0835('0x18')]['id']:0x0,_0x250705[_0x0835('0x19')]?_0x250705[_0x0835('0x19')]['id']:0x0);if(_0x290bd2[_0x0835('0x16')][_0x548187]){_0x290bd2[_0x0835('0x16')][_0x548187][_0x0835('0x39')](_0x0835('0x3f'));if(rpc[_0x250705[_0x0835('0x17')]+_0x0835('0x40')]){rpc[_0x250705[_0x0835('0x17')]+'QueueReport']['update'](_0x548187,{'UserId':_0x250705[_0x0835('0x18')][_0x0835('0x41')]})['catch'](function(_0x1ad32d){logger[_0x0835('0x3c')](_0x0835('0x42'));});}}return _0x247069({'code':0xc8,'message':_0x250705});}catch(_0x42676e){logger[_0x0835('0x3c')](_0x42676e[_0x0835('0x3d')]);return _0x16c5f9(_0x1a8429[_0x0835('0x3c')](0x1f4,_0x42676e));}}logger['error']('message\x20is\x20empty');return _0x16c5f9(_0x1a8429['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3d6cea){var _0x46fbca=this;return new Promise(function(_0x18a7c1,_0x2c8c3b){if(_0x3d6cea[_0x0835('0x43')]&&_0x3d6cea[_0x0835('0x43')]['id']){try{if(_0x290bd2[_0x0835('0x44')][_0x3d6cea['agent']['id']]){_0x290bd2[_0x0835('0x44')][_0x3d6cea[_0x0835('0x43')]['id']]['busy']=![];_0x290bd2['agents'][_0x3d6cea['agent']['id']][_0x0835('0x45')]=undefined;}return _0x18a7c1({'code':0xc8,'message':_0x3d6cea});}catch(_0x5f215d){logger[_0x0835('0x3c')](_0x5f215d[_0x0835('0x3d')]);return _0x2c8c3b(_0x46fbca[_0x0835('0x3c')](0x1f4,_0x5f215d));}}logger[_0x0835('0x3c')](_0x0835('0x46'));return _0x2c8c3b(_0x46fbca[_0x0835('0x3c')](0x1f4,_0x0835('0x46')));});},'AbandonInteraction':function(_0x506c47){var _0x233858=this;return new Promise(function(_0x52ca07,_0x369eef){if(_0x506c47[_0x0835('0x17')]&&_0x506c47[_0x0835('0x19')]&&_0x506c47[_0x0835('0x19')]['id']){try{var _0x2581ee=getId(_0x506c47[_0x0835('0x17')],_0x506c47['message']?_0x506c47[_0x0835('0x18')]['id']:0x0,_0x506c47[_0x0835('0x19')]?_0x506c47[_0x0835('0x19')]['id']:0x0);if(_0x290bd2[_0x0835('0x16')][_0x2581ee]){_0x290bd2['rules'][_0x2581ee][_0x0835('0x39')](_0x0835('0x3f'));}return _0x52ca07({'code':0xc8,'message':_0x506c47});}catch(_0x3fa8b2){logger[_0x0835('0x3c')](_0x3fa8b2[_0x0835('0x3d')]);return _0x369eef(_0x233858[_0x0835('0x3c')](0x1f4,_0x3fa8b2));}}logger[_0x0835('0x3c')](_0x0835('0x46'));return _0x369eef(_0x233858['error'](0x1f4,_0x0835('0x46')));});},'AgentCapacity':function(_0x5ca39e){var _0x4dd57c=this;return new Promise(function(_0x50e069,_0x1601ab){if(_0x290bd2[_0x0835('0x44')][_0x0835('0x47')](_0x5ca39e['id'])){for(var _0x38dcd6 in _0x5ca39e['capacity']){if(_0x5ca39e['capacity'][_0x0835('0x47')](_0x38dcd6)){if(_0x290bd2[_0x0835('0x44')][_0x5ca39e['id']][_0x0835('0x47')](_0x38dcd6+_0x0835('0x48'))){_0x290bd2[_0x0835('0x44')][_0x5ca39e['id']][_0x38dcd6+_0x0835('0x48')]=parseInt(_0x5ca39e[_0x0835('0x49')][_0x38dcd6],0xa);}}}_0x290bd2[_0x0835('0x44')][_0x5ca39e['id']][_0x0835('0x4a')]();return _0x50e069({'code':0xc8,'message':_0x290bd2[_0x0835('0x44')][_0x5ca39e['id']]});}else{return _0x1601ab(_0x4dd57c['error'](0x1f4,_0x0835('0x4b')));}});},'Agents':function(_0x3f2ce3){return new Promise(function(_0x2ceae7,_0x270562){var _0x4b95f4=_[_0x0835('0x4c')](_0x290bd2['agents']);_0x2ceae7({'count':_0x4b95f4[_0x0835('0x24')],'rows':_0x4b95f4});});},'ChatQueues':function(_0x1812fa){return new Promise(function(_0x2f2dd2,_0x354f64){var _0x49a345=[];for(var _0x3d6454 in _0x290bd2[_0x0835('0x4d')]){if(_0x290bd2[_0x0835('0x4d')][_0x0835('0x47')](_0x3d6454)){var _0x373cf6=_0x290bd2[_0x0835('0x4d')][_0x3d6454];var _0x32527d={'id':_0x373cf6['id'],'available':_0x373cf6['available'],'loggedIn':_0x373cf6[_0x0835('0x4e')],'name':_0x373cf6[_0x0835('0x4f')],'paused':_0x373cf6[_0x0835('0x50')],'waiting':_0x373cf6[_0x0835('0x51')]};_0x49a345[_0x0835('0x22')](_0x32527d);}}_0x2f2dd2({'count':_0x49a345[_0x0835('0x24')],'rows':_0x49a345});});},'MailQueues':function(_0x25dee7){return new Promise(function(_0x41677d,_0x2daf28){var _0x2e2526=[];for(var _0x18e138 in _0x290bd2[_0x0835('0x52')]){if(_0x290bd2[_0x0835('0x52')][_0x0835('0x47')](_0x18e138)){var _0xdb08a6=_0x290bd2[_0x0835('0x52')][_0x18e138];var _0x2e0ce1={'id':_0xdb08a6['id'],'available':_0xdb08a6[_0x0835('0x53')],'loggedIn':_0xdb08a6[_0x0835('0x4e')],'name':_0xdb08a6[_0x0835('0x4f')],'paused':_0xdb08a6[_0x0835('0x50')],'waiting':_0xdb08a6[_0x0835('0x51')]};_0x2e2526[_0x0835('0x22')](_0x2e0ce1);}}_0x41677d({'count':_0x2e2526['length'],'rows':_0x2e2526});});},'OpenchannelQueues':function(_0x1a9f8b){return new Promise(function(_0x3d31f4,_0x94aa89){var _0xd896e2=[];for(var _0x2a683b in _0x290bd2[_0x0835('0x54')]){if(_0x290bd2[_0x0835('0x54')][_0x0835('0x47')](_0x2a683b)){var _0x4a27da=_0x290bd2[_0x0835('0x54')][_0x2a683b];var _0x21fd57={'id':_0x4a27da['id'],'available':_0x4a27da[_0x0835('0x53')],'loggedIn':_0x4a27da['loggedIn'],'name':_0x4a27da[_0x0835('0x4f')],'paused':_0x4a27da[_0x0835('0x50')],'waiting':_0x4a27da['waiting']};_0xd896e2[_0x0835('0x22')](_0x21fd57);}}_0x3d31f4({'count':_0xd896e2[_0x0835('0x24')],'rows':_0xd896e2});});},'SmsQueues':function(_0x5d9e74){return new Promise(function(_0x2af29b,_0x15e80e){var _0x59518c=[];for(var _0x4b97be in _0x290bd2[_0x0835('0x55')]){if(_0x290bd2['smsQueues'][_0x0835('0x47')](_0x4b97be)){var _0x55e66b=_0x290bd2['smsQueues'][_0x4b97be];var _0x25fc98={'id':_0x55e66b['id'],'available':_0x55e66b['available'],'loggedIn':_0x55e66b['loggedIn'],'name':_0x55e66b['name'],'paused':_0x55e66b[_0x0835('0x50')],'waiting':_0x55e66b[_0x0835('0x51')]};_0x59518c['push'](_0x25fc98);}}_0x2af29b({'count':_0x59518c[_0x0835('0x24')],'rows':_0x59518c});});},'FaxQueues':function(_0x44ef73){return new Promise(function(_0x709160,_0x113434){var _0x357490=[];for(var _0x183933 in _0x290bd2[_0x0835('0x56')]){if(_0x290bd2[_0x0835('0x56')][_0x0835('0x47')](_0x183933)){var _0x3e5a08=_0x290bd2[_0x0835('0x56')][_0x183933];var _0x48fe72={'id':_0x3e5a08['id'],'available':_0x3e5a08[_0x0835('0x53')],'loggedIn':_0x3e5a08[_0x0835('0x4e')],'name':_0x3e5a08['name'],'paused':_0x3e5a08['paused'],'waiting':_0x3e5a08['waiting']};_0x357490[_0x0835('0x22')](_0x48fe72);}}_0x709160({'count':_0x357490[_0x0835('0x24')],'rows':_0x357490});});},'WhatsappQueues':function(_0x495cb0){return new Promise(function(_0x3c8cb9,_0x933021){var _0x46f407=[];for(var _0x5b7edc in _0x290bd2[_0x0835('0x57')]){if(_0x290bd2[_0x0835('0x57')][_0x0835('0x47')](_0x5b7edc)){var _0x1902eb=_0x290bd2[_0x0835('0x57')][_0x5b7edc];var _0x5030be={'id':_0x1902eb['id'],'available':_0x1902eb['available'],'loggedIn':_0x1902eb['loggedIn'],'name':_0x1902eb[_0x0835('0x4f')],'paused':_0x1902eb[_0x0835('0x50')],'waiting':_0x1902eb[_0x0835('0x51')]};_0x46f407[_0x0835('0x22')](_0x5030be);}}_0x3c8cb9({'count':_0x46f407[_0x0835('0x24')],'rows':_0x46f407});});},'ChatQueuesWaitingInteractions':function(_0x396259){return new Promise(function(_0x4e2c1d,_0x3a16ee){var _0x598607=_['values'](_0x290bd2[_0x0835('0x58')]);_0x4e2c1d({'count':_0x598607[_0x0835('0x24')],'rows':_0x598607});});},'MailQueuesWaitingInteractions':function(_0x15cf5d){return new Promise(function(_0x92cdec,_0x51c6ef){var _0xfbdade=_[_0x0835('0x4c')](_0x290bd2['mailQueuesWaitingInteractions']);_0x92cdec({'count':_0xfbdade[_0x0835('0x24')],'rows':_0xfbdade});});},'OpenchannelQueuesWaitingInteractions':function(_0xae293f){return new Promise(function(_0x810889,_0x55174a){var _0x53f0d1=_[_0x0835('0x4c')](_0x290bd2[_0x0835('0x59')]);_0x810889({'count':_0x53f0d1['length'],'rows':_0x53f0d1});});},'SmsQueuesWaitingInteractions':function(_0x16112d){return new Promise(function(_0x55e4a7,_0x3a6168){var _0x5517ed=_[_0x0835('0x4c')](_0x290bd2['smsQueuesWaitingInteractions']);_0x55e4a7({'count':_0x5517ed['length'],'rows':_0x5517ed});});},'FaxQueuesWaitingInteractions':function(_0x32be7a){return new Promise(function(_0x38ef7e,_0x24aa52){var _0x59d010=_[_0x0835('0x4c')](_0x290bd2['faxQueuesWaitingInteractions']);_0x38ef7e({'count':_0x59d010['length'],'rows':_0x59d010});});},'WhatsappQueuesWaitingInteractions':function(_0x121a79){return new Promise(function(_0x37a6e8,_0x462f1a){var _0x5bf7bf=_[_0x0835('0x4c')](_0x290bd2[_0x0835('0x5a')]);_0x37a6e8({'count':_0x5bf7bf[_0x0835('0x24')],'rows':_0x5bf7bf});});}};var _0x13dd4e=jayson[_0x0835('0x5b')](_0x5328e5)[_0x0835('0x5c')]();_0x13dd4e['on'](_0x0835('0x3c'),function(_0x399512){logger['error'](JSON[_0x0835('0x37')](_0x399512));return _0x3bdd8d(_0x399512);});_0x13dd4e['listen'](0x232c,_0x0835('0x5d'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xa3a867('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 b734736..1e5f712 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 _0x38e2=['then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','bluebird','jayson/promise','routing','client','request'];(function(_0x8c30c4,_0xfc5563){var _0xe34985=function(_0x15a0c5){while(--_0x15a0c5){_0x8c30c4['push'](_0x8c30c4['shift']());}};_0xe34985(++_0xfc5563);}(_0x38e2,0xff));var _0x238e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x38e2[_0x40a045];return _0x1a687c;};'use strict';var util=require('util');var BPromise=require(_0x238e('0x0'));var jayson=require(_0x238e('0x1'));var _=require('lodash');var logger=require('../../../config/logger')(_0x238e('0x2'));var client=jayson[_0x238e('0x3')]['http']({'port':0x232a});function request(_0x4c7381,_0x2ad3da){return new BPromise(function(_0x3b44bb,_0x34006b){return client[_0x238e('0x4')](_0x4c7381,_0x2ad3da)[_0x238e('0x5')](function(_0x5d1ac1){if(_0x5d1ac1[_0x238e('0x6')]){return _0x34006b(_0x5d1ac1[_0x238e('0x6')][_0x238e('0x7')]);}else{return _0x3b44bb(_0x5d1ac1['result']);}})[_0x238e('0x8')](function(_0x5ddfd0){return _0x34006b(_0x5ddfd0);});});}exports[_0x238e('0x9')]=function(_0x494b88,_0x57ac35,_0x681dc0){return function(_0x2b4487){if(_0x681dc0[_0x238e('0xa')]&&!_0x681dc0['rules'][_0x494b88]){logger[_0x238e('0xb')](_0x238e('0xc'),_0x494b88);return _0x2b4487[_0x238e('0xd')]();}var _0x2a5a6a=[];for(var _0x38963c=0x0;_0x38963c<_0x57ac35['length'];_0x38963c+=0x1){_0x2a5a6a[_0x238e('0xe')](request('Command',{'command':util[_0x238e('0xf')](_0x238e('0x10'),_0x57ac35[_0x38963c])})[_0x238e('0x5')](function(_0x164131){return _0x164131&&_0x164131[_0x238e('0x7')]&&_0x164131['message'][_0x238e('0x11')](_0x238e('0x12'))>=0x0?!![]:![];})['catch'](function(_0x52c321){logger[_0x238e('0x6')](_0x238e('0x13'),_0x494b88,_0x57ac35[_0x38963c]);}));}BPromise['all'](_0x2a5a6a)[_0x238e('0x5')](function(_0x8034f2){var _0x3184fb=_[_0x238e('0x14')](_0x8034f2);logger[_0x238e('0xb')](_0x238e('0x15'),_0x494b88,_0x57ac35[_0x238e('0x16')](_0x238e('0x17')),_0x3184fb);_0x2b4487['when'](_0x3184fb);})[_0x238e('0x8')](function(_0x2c701d){console[_0x238e('0x18')](_0x2c701d);logger[_0x238e('0x6')](_0x238e('0x15'),_0x494b88,_0x57ac35[_0x238e('0x16')](_0x238e('0x17')),_0x2c701d[_0x238e('0x19')]);_0x2b4487['stop']();});};}; \ No newline at end of file +var _0xc1db=['jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird'];(function(_0x14f2a5,_0x3b924a){var _0x36538c=function(_0x185199){while(--_0x185199){_0x14f2a5['push'](_0x14f2a5['shift']());}};_0x36538c(++_0x3b924a);}(_0xc1db,0xfe));var _0xbc1d=function(_0x1981bf,_0x3e1836){_0x1981bf=_0x1981bf-0x0;var _0x3b3287=_0xc1db[_0x1981bf];return _0x3b3287;};'use strict';var util=require(_0xbc1d('0x0'));var BPromise=require(_0xbc1d('0x1'));var jayson=require(_0xbc1d('0x2'));var _=require(_0xbc1d('0x3'));var logger=require(_0xbc1d('0x4'))(_0xbc1d('0x5'));var client=jayson[_0xbc1d('0x6')][_0xbc1d('0x7')]({'port':0x232a});function request(_0x135d31,_0xb5f752){return new BPromise(function(_0x3a0369,_0x4dc7e8){return client[_0xbc1d('0x8')](_0x135d31,_0xb5f752)[_0xbc1d('0x9')](function(_0x124866){if(_0x124866[_0xbc1d('0xa')]){return _0x4dc7e8(_0x124866[_0xbc1d('0xa')][_0xbc1d('0xb')]);}else{return _0x3a0369(_0x124866['result']);}})[_0xbc1d('0xc')](function(_0x418148){return _0x4dc7e8(_0x418148);});});}exports[_0xbc1d('0xd')]=function(_0x36be4d,_0xae8311,_0x43250b){return function(_0x4270af){if(_0x43250b[_0xbc1d('0xe')]&&!_0x43250b[_0xbc1d('0xe')][_0x36be4d]){logger[_0xbc1d('0xf')](_0xbc1d('0x10'),_0x36be4d);return _0x4270af[_0xbc1d('0x11')]();}var _0x408729=[];for(var _0x5dbaeb=0x0;_0x5dbaeb<_0xae8311[_0xbc1d('0x12')];_0x5dbaeb+=0x1){_0x408729['push'](request(_0xbc1d('0x13'),{'command':util[_0xbc1d('0x14')](_0xbc1d('0x15'),_0xae8311[_0x5dbaeb])})[_0xbc1d('0x9')](function(_0x1d6eda){return _0x1d6eda&&_0x1d6eda[_0xbc1d('0xb')]&&_0x1d6eda[_0xbc1d('0xb')][_0xbc1d('0x16')](_0xbc1d('0x17'))>=0x0?!![]:![];})['catch'](function(_0x1f33ec){logger['error'](_0xbc1d('0x18'),_0x36be4d,_0xae8311[_0x5dbaeb]);}));}BPromise[_0xbc1d('0x19')](_0x408729)[_0xbc1d('0x9')](function(_0x245ad7){var _0x327504=_['some'](_0x245ad7);logger[_0xbc1d('0xf')](_0xbc1d('0x1a'),_0x36be4d,_0xae8311[_0xbc1d('0x1b')](_0xbc1d('0x1c')),_0x327504);_0x4270af[_0xbc1d('0x1d')](_0x327504);})[_0xbc1d('0xc')](function(_0x43cf3a){console[_0xbc1d('0x1e')](_0x43cf3a);logger['error'](_0xbc1d('0x1a'),_0x36be4d,_0xae8311[_0xbc1d('0x1b')]('\x20|\x20'),_0x43cf3a[_0xbc1d('0x1f')]);_0x4270af[_0xbc1d('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fcbdfa9..43c57a5 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 _0xa403=['clone','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','agent','complete','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','connectedlinenum','connectedlinename','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','now','abandoned','holdtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','agentcompleteAt','diffTime','agentconnectAt','stack','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfereeuniqueid'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0xa403,0xa2));var _0x3a40=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xa403[_0x453e2b];return _0x50f306;};'use strict';var _=require('lodash');var util=require(_0x3a40('0x0'));var utils=require(_0x3a40('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x505a3e,_0x4c12e0){utils[_0x3a40('0x2')](util[_0x3a40('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x505a3e[_0x3a40('0x4')],_0x505a3e[_0x3a40('0x5')],_0x505a3e[_0x3a40('0x6')],_0x505a3e[_0x3a40('0x7')],_0x505a3e[_0x3a40('0x8')],_0x505a3e[_0x3a40('0x9')],_0x505a3e['connectedlinenum'],_0x505a3e[_0x3a40('0xa')]));if(_0x505a3e['queue']){utils[_0x3a40('0xb')](_0x505a3e[_0x3a40('0x6')])[_0x3a40('0xc')](function(_0x5b8866){if(_0x5b8866){_0x505a3e['type']=_0x5b8866[_0x3a40('0xd')];_0x505a3e['agentacw']=_0x505a3e['agentcomplete']?_0x5b8866[_0x3a40('0xe')]:![];_0x505a3e[_0x3a40('0xf')]=_0x505a3e[_0x3a40('0x10')]?_0x5b8866['acwTimeout']:0x0;}utils[_0x3a40('0x11')]('CreateVoiceAgentReport',_0x505a3e);});}else{utils[_0x3a40('0x11')](_0x3a40('0x12'),_0x505a3e);}if(_0x4c12e0){delete transfers[_0x505a3e[_0x3a40('0x4')]];}else{delete agents[_0x505a3e[_0x3a40('0x13')]];}}exports[_0x3a40('0x14')]=function(_0xe97d88){try{agents[_0xe97d88[_0x3a40('0x13')]]=_0xe97d88;agents[_0xe97d88[_0x3a40('0x13')]]['agentcalledAt']=utils['now']();agents[_0xe97d88[_0x3a40('0x13')]][_0x3a40('0xa')]=_0x3a40('0x15');agents[_0xe97d88[_0x3a40('0x13')]][_0x3a40('0x16')]=null;agents[_0xe97d88[_0x3a40('0x13')]][_0x3a40('0x17')]=null;}catch(_0x32151f){utils[_0x3a40('0x18')](_0x32151f['stack']);}};exports[_0x3a40('0x19')]=function(_0x4a35b4){try{if(!_[_0x3a40('0x1a')](agents[_0x4a35b4[_0x3a40('0x13')]])){agents[_0x4a35b4['destuniqueid']][_0x3a40('0x19')]=!![];agents[_0x4a35b4[_0x3a40('0x13')]][_0x3a40('0x1b')]=utils['now']();agents[_0x4a35b4[_0x3a40('0x13')]][_0x3a40('0xa')]=_0x3a40('0x1c');agents[_0x4a35b4[_0x3a40('0x13')]][_0x3a40('0x1d')]='timeout';agents[_0x4a35b4[_0x3a40('0x13')]]['holdtime']=_0x4a35b4[_0x3a40('0x1e')]?parseInt(_0x4a35b4[_0x3a40('0x1e')])/0x3e8:0x0;agents[_0x4a35b4[_0x3a40('0x13')]][_0x3a40('0x1f')]=0x0;unanswered[_0x3a40('0x20')](_0x4a35b4[_0x3a40('0x13')]);}}catch(_0x455fd4){utils['error'](_0x455fd4['stack']);}};exports[_0x3a40('0x21')]=function(_0x4518ae){try{_[_0x3a40('0x22')](agents,function(_0x36c386,_0x1c3b58){if(_0x36c386[_0x3a40('0x4')]==_0x4518ae[_0x3a40('0x4')]&&!_[_0x3a40('0x23')](unanswered,_0x36c386[_0x3a40('0x13')])){_0x36c386['agentringnoanswer']=!![];_0x36c386[_0x3a40('0x1b')]=utils[_0x3a40('0x24')]();_0x36c386['lastevent']=_0x3a40('0x25');_0x36c386[_0x3a40('0x1d')]='abandoned';_0x36c386[_0x3a40('0x26')]=_0x4518ae[_0x3a40('0x26')];_0x36c386[_0x3a40('0x1f')]=0x0;writeDB(_0x36c386);}});}catch(_0x33a650){utils['error'](_0x33a650['stack']);}};exports['agentconnect']=function(_0x446b9e){try{if(agents[_0x446b9e[_0x3a40('0x13')]]){agents[_0x446b9e[_0x3a40('0x13')]]['agentconnectAt']=utils[_0x3a40('0x24')]();agents[_0x446b9e[_0x3a40('0x13')]]['connectedlinenum']=_0x446b9e['connectedlinenum'];agents[_0x446b9e['destuniqueid']]['connectedlinename']=_0x446b9e[_0x3a40('0x17')];agents[_0x446b9e[_0x3a40('0x13')]][_0x3a40('0x26')]=_0x446b9e[_0x3a40('0x1e')];agents[_0x446b9e['destuniqueid']]['lastevent']=_0x3a40('0x27');_[_0x3a40('0x22')](agents,function(_0x10a9db,_0x7baaba){if(_0x10a9db[_0x3a40('0x13')]!=_0x446b9e['destuniqueid']&&_0x10a9db[_0x3a40('0x4')]==_0x446b9e[_0x3a40('0x4')]){_0x10a9db['talktime']=0x0;_0x10a9db[_0x3a40('0x26')]=_0x446b9e['ringtime'];_0x10a9db[_0x3a40('0x19')]=!![];_0x10a9db[_0x3a40('0x1b')]=utils[_0x3a40('0x24')]();_0x10a9db['lastevent']=_0x3a40('0x28');_0x10a9db['reason']=_0x3a40('0x28');_0x10a9db[_0x3a40('0x29')]=_0x446b9e[_0x3a40('0x13')];_0x10a9db['answeredelsewheremembername']=_0x446b9e[_0x3a40('0x7')];writeDB(_0x10a9db);}});}}catch(_0x5c620b){utils[_0x3a40('0x18')](_0x5c620b['stack']);}};exports['agentcomplete']=function(_0x5220d7){try{if(!_['isNil'](agents[_0x5220d7['destuniqueid']])){agents[_0x5220d7[_0x3a40('0x13')]][_0x3a40('0x2a')]=!![];agents[_0x5220d7[_0x3a40('0x13')]][_0x3a40('0x2b')]=utils['now']();agents[_0x5220d7[_0x3a40('0x13')]][_0x3a40('0x1f')]=utils[_0x3a40('0x2c')](agents[_0x5220d7[_0x3a40('0x13')]][_0x3a40('0x2b')],agents[_0x5220d7[_0x3a40('0x13')]][_0x3a40('0x2d')]);agents[_0x5220d7['destuniqueid']][_0x3a40('0x1d')]=_0x5220d7['reason'];agents[_0x5220d7['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x5220d7[_0x3a40('0x13')]]);}}catch(_0x42bd80){utils['error'](_0x42bd80[_0x3a40('0x2e')]);}};exports[_0x3a40('0x2f')]=function(_0x4e61fb){try{if(!_[_0x3a40('0x1a')](agents[_0x4e61fb[_0x3a40('0x30')]])){agents[_0x4e61fb[_0x3a40('0x30')]][_0x3a40('0x31')]=!![];agents[_0x4e61fb[_0x3a40('0x30')]][_0x3a40('0x32')]=_0x3a40('0x33');agents[_0x4e61fb['transfereruniqueid']][_0x3a40('0x34')]=_0x4e61fb[_0x3a40('0x35')];agents[_0x4e61fb['transfereruniqueid']][_0x3a40('0x36')]=agents[_0x4e61fb[_0x3a40('0x30')]]['uniqueid'];}}catch(_0x1b1c6d){utils[_0x3a40('0x18')](_0x1b1c6d['stack']);}};exports[_0x3a40('0x37')]=function(_0x560398){try{if(_0x560398[_0x3a40('0x38')]==_0x560398[_0x3a40('0x39')]){if(!_['isNil'](agents[_0x560398[_0x3a40('0x3a')]])){agents[_0x560398[_0x3a40('0x3a')]][_0x3a40('0x31')]=!![];agents[_0x560398['secondtransfereruniqueid']][_0x3a40('0x32')]='ATTENDED';agents[_0x560398[_0x3a40('0x3a')]][_0x3a40('0x34')]=_0x560398['origtransfererexten'];agents[_0x560398['secondtransfereruniqueid']][_0x3a40('0x36')]=_0x560398['origtransfereruniqueid'];}if(_0x560398[_0x3a40('0x3b')]&&agents[_0x560398[_0x3a40('0x3b')]]){agents[_0x560398[_0x3a40('0x3b')]]['agententerreason']=0x1;transfers[_0x560398[_0x3a40('0x3b')]]=_[_0x3a40('0x3c')](agents[_0x560398['transfereeuniqueid']]);transfers[_0x560398['transfereeuniqueid']]['calleridnum']=agents[_0x560398[_0x3a40('0x3a')]][_0x3a40('0x9')];transfers[_0x560398['transfereeuniqueid']][_0x3a40('0x3d')]=agents[_0x560398[_0x3a40('0x3a')]][_0x3a40('0x3d')];transfers[_0x560398[_0x3a40('0x3b')]][_0x3a40('0x3e')]=utils[_0x3a40('0x24')]();transfers[_0x560398[_0x3a40('0x3b')]][_0x3a40('0x2d')]=utils[_0x3a40('0x24')]();transfers[_0x560398[_0x3a40('0x3b')]][_0x3a40('0x26')]=0x0;transfers[_0x560398[_0x3a40('0x3b')]][_0x3a40('0x3f')]=0x2;}}else if(_0x560398['secondtransfereruniqueid']==_0x560398[_0x3a40('0x40')]){if(!_[_0x3a40('0x1a')](agents[_0x560398[_0x3a40('0x38')]])){agents[_0x560398[_0x3a40('0x38')]][_0x3a40('0x31')]=!![];agents[_0x560398[_0x3a40('0x38')]][_0x3a40('0x32')]=_0x3a40('0x41');agents[_0x560398[_0x3a40('0x38')]][_0x3a40('0x34')]=_0x560398[_0x3a40('0x42')];agents[_0x560398[_0x3a40('0x38')]][_0x3a40('0x36')]=_0x560398[_0x3a40('0x3a')];}if(_0x560398[_0x3a40('0x43')]&&agents[_0x560398[_0x3a40('0x43')]]){agents[_0x560398[_0x3a40('0x43')]][_0x3a40('0x3f')]=0x1;transfers[_0x560398['transfertargetuniqueid']]=_['clone'](agents[_0x560398['transfertargetuniqueid']]);transfers[_0x560398[_0x3a40('0x43')]][_0x3a40('0x9')]=agents[_0x560398[_0x3a40('0x38')]]['calleridnum'];transfers[_0x560398[_0x3a40('0x43')]][_0x3a40('0x3d')]=agents[_0x560398[_0x3a40('0x38')]][_0x3a40('0x3d')];transfers[_0x560398[_0x3a40('0x43')]][_0x3a40('0x3e')]=utils['now']();transfers[_0x560398[_0x3a40('0x43')]][_0x3a40('0x2d')]=utils[_0x3a40('0x24')]();transfers[_0x560398['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x560398[_0x3a40('0x43')]]['agententerreason']=0x2;}}}catch(_0x203423){utils['error'](_0x203423[_0x3a40('0x2e')]);}};exports[_0x3a40('0x44')]=function(_0x31da3e){try{if(agents[_0x31da3e[_0x3a40('0x4')]]&&agents[_0x31da3e[_0x3a40('0x4')]]['reason']===_0x3a40('0x1c')){if(_0x31da3e[_0x3a40('0x45')]==='21'){agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x1d')]='rejected';agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0xa')]=_0x3a40('0x46');}writeDB(agents[_0x31da3e[_0x3a40('0x4')]]);var _0x5e4239=unanswered[_0x3a40('0x47')](_0x31da3e['uniqueid']);if(_0x5e4239>-0x1)unanswered['splice'](_0x5e4239,0x1);}if(transfers[_0x31da3e['uniqueid']]){transfers[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2a')]=!![];transfers[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2b')]=utils[_0x3a40('0x24')]();transfers[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x1f')]=utils[_0x3a40('0x2c')](transfers[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2b')],transfers[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2d')]);transfers[_0x31da3e[_0x3a40('0x4')]]['reason']=_0x3a40('0x48');transfers[_0x31da3e['uniqueid']]['lastevent']='complete';writeDB(transfers[_0x31da3e['uniqueid']],!![]);}if(agents[_0x31da3e[_0x3a40('0x4')]]&&agents[_0x31da3e[_0x3a40('0x4')]]['agentconnectAt']){agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2a')]=!![];agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2b')]=utils['now']();agents[_0x31da3e['uniqueid']][_0x3a40('0x1f')]=utils[_0x3a40('0x2c')](agents[_0x31da3e[_0x3a40('0x4')]]['agentcompleteAt'],agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x2d')]);agents[_0x31da3e[_0x3a40('0x4')]][_0x3a40('0x1d')]=agents[_0x31da3e['uniqueid']][_0x3a40('0x31')]?_0x3a40('0x31'):_0x3a40('0x48');agents[_0x31da3e['uniqueid']][_0x3a40('0xa')]=_0x3a40('0x49');writeDB(agents[_0x31da3e[_0x3a40('0x4')]]);}}catch(_0x389ec7){utils['error'](_0x389ec7[_0x3a40('0x2e')]);}}; \ No newline at end of file +var _0x864f=['transfereeuniqueid','clone','calleridname','secondtransfererexten','transferuniqueid','transfertargetuniqueid','agententerreason','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','uniqueid','agentcalled','agentcalledAt','called','destuniqueid','connectedlinename','error','stack','agentringnoanswer','agentringnoanswerAt','now','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','reason','abandoned','holdtime','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','membername','isNil','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten'];(function(_0x5e0247,_0x5d4066){var _0x1f5d2c=function(_0x113361){while(--_0x113361){_0x5e0247['push'](_0x5e0247['shift']());}};_0x1f5d2c(++_0x5d4066);}(_0x864f,0xa1));var _0xf864=function(_0x409802,_0x529afe){_0x409802=_0x409802-0x0;var _0x33930d=_0x864f[_0x409802];return _0x33930d;};'use strict';var _=require(_0xf864('0x0'));var util=require(_0xf864('0x1'));var utils=require(_0xf864('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x20065f,_0xf69176){utils[_0xf864('0x3')](util[_0xf864('0x4')](_0xf864('0x5'),_0x20065f['uniqueid'],_0x20065f['channel'],_0x20065f['queue'],_0x20065f['membername'],_0x20065f[_0xf864('0x6')],_0x20065f[_0xf864('0x7')],_0x20065f[_0xf864('0x8')],_0x20065f[_0xf864('0x9')]));if(_0x20065f[_0xf864('0xa')]){utils[_0xf864('0xb')](_0x20065f[_0xf864('0xa')])[_0xf864('0xc')](function(_0x4c16ce){if(_0x4c16ce){_0x20065f[_0xf864('0xd')]=_0x4c16ce[_0xf864('0xd')];_0x20065f[_0xf864('0xe')]=_0x20065f[_0xf864('0xf')]?_0x4c16ce['acw']:![];_0x20065f[_0xf864('0x10')]=_0x20065f[_0xf864('0xe')]?_0x4c16ce[_0xf864('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x20065f);});}else{utils['request']('CreateVoiceAgentReport',_0x20065f);}if(_0xf69176){delete transfers[_0x20065f[_0xf864('0x12')]];}else{delete agents[_0x20065f['destuniqueid']];}}exports[_0xf864('0x13')]=function(_0x54c3f3){try{agents[_0x54c3f3['destuniqueid']]=_0x54c3f3;agents[_0x54c3f3['destuniqueid']][_0xf864('0x14')]=utils['now']();agents[_0x54c3f3['destuniqueid']]['lastevent']=_0xf864('0x15');agents[_0x54c3f3[_0xf864('0x16')]][_0xf864('0x8')]=null;agents[_0x54c3f3['destuniqueid']][_0xf864('0x17')]=null;}catch(_0x1de007){utils[_0xf864('0x18')](_0x1de007[_0xf864('0x19')]);}};exports[_0xf864('0x1a')]=function(_0x30d3d6){try{if(!_['isNil'](agents[_0x30d3d6['destuniqueid']])){agents[_0x30d3d6['destuniqueid']]['agentringnoanswer']=!![];agents[_0x30d3d6[_0xf864('0x16')]][_0xf864('0x1b')]=utils[_0xf864('0x1c')]();agents[_0x30d3d6[_0xf864('0x16')]][_0xf864('0x9')]=_0xf864('0x1d');agents[_0x30d3d6[_0xf864('0x16')]]['reason']='timeout';agents[_0x30d3d6['destuniqueid']]['holdtime']=_0x30d3d6[_0xf864('0x1e')]?parseInt(_0x30d3d6[_0xf864('0x1e')])/0x3e8:0x0;agents[_0x30d3d6[_0xf864('0x16')]][_0xf864('0x1f')]=0x0;unanswered[_0xf864('0x20')](_0x30d3d6[_0xf864('0x16')]);}}catch(_0xd53967){utils[_0xf864('0x18')](_0xd53967['stack']);}};exports[_0xf864('0x21')]=function(_0x537795){try{_[_0xf864('0x22')](agents,function(_0x41d71f,_0x12327c){if(_0x41d71f[_0xf864('0x12')]==_0x537795['uniqueid']&&!_[_0xf864('0x23')](unanswered,_0x41d71f['destuniqueid'])){_0x41d71f[_0xf864('0x1a')]=!![];_0x41d71f[_0xf864('0x1b')]=utils[_0xf864('0x1c')]();_0x41d71f[_0xf864('0x9')]='abandoned';_0x41d71f[_0xf864('0x24')]=_0xf864('0x25');_0x41d71f[_0xf864('0x26')]=_0x537795[_0xf864('0x26')];_0x41d71f[_0xf864('0x1f')]=0x0;writeDB(_0x41d71f);}});}catch(_0x455d3d){utils[_0xf864('0x18')](_0x455d3d['stack']);}};exports[_0xf864('0x27')]=function(_0xd0d65f){try{if(agents[_0xd0d65f[_0xf864('0x16')]]){agents[_0xd0d65f[_0xf864('0x16')]][_0xf864('0x28')]=utils[_0xf864('0x1c')]();agents[_0xd0d65f['destuniqueid']]['connectedlinenum']=_0xd0d65f[_0xf864('0x8')];agents[_0xd0d65f[_0xf864('0x16')]][_0xf864('0x17')]=_0xd0d65f[_0xf864('0x17')];agents[_0xd0d65f[_0xf864('0x16')]]['holdtime']=_0xd0d65f[_0xf864('0x1e')];agents[_0xd0d65f['destuniqueid']]['lastevent']=_0xf864('0x29');_[_0xf864('0x22')](agents,function(_0x19dabf,_0x530461){if(_0x19dabf[_0xf864('0x16')]!=_0xd0d65f[_0xf864('0x16')]&&_0x19dabf[_0xf864('0x12')]==_0xd0d65f[_0xf864('0x12')]){_0x19dabf[_0xf864('0x1f')]=0x0;_0x19dabf[_0xf864('0x26')]=_0xd0d65f[_0xf864('0x1e')];_0x19dabf['agentringnoanswer']=!![];_0x19dabf['agentringnoanswerAt']=utils['now']();_0x19dabf['lastevent']=_0xf864('0x2a');_0x19dabf[_0xf864('0x24')]=_0xf864('0x2a');_0x19dabf['answeredelsewheredestinationuniqueid']=_0xd0d65f[_0xf864('0x16')];_0x19dabf[_0xf864('0x2b')]=_0xd0d65f[_0xf864('0x2c')];writeDB(_0x19dabf);}});}}catch(_0xae897c){utils['error'](_0xae897c[_0xf864('0x19')]);}};exports[_0xf864('0xf')]=function(_0x45cdbb){try{if(!_[_0xf864('0x2d')](agents[_0x45cdbb[_0xf864('0x16')]])){agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0xf')]=!![];agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0x2e')]=utils[_0xf864('0x1c')]();agents[_0x45cdbb['destuniqueid']][_0xf864('0x1f')]=utils[_0xf864('0x2f')](agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0x2e')],agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0x28')]);agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0x24')]=_0x45cdbb[_0xf864('0x24')];agents[_0x45cdbb[_0xf864('0x16')]][_0xf864('0x9')]=_0xf864('0x30');writeDB(agents[_0x45cdbb[_0xf864('0x16')]]);}}catch(_0x599cf4){utils['error'](_0x599cf4[_0xf864('0x19')]);}};exports[_0xf864('0x31')]=function(_0x1f04fe){try{if(!_[_0xf864('0x2d')](agents[_0x1f04fe[_0xf864('0x32')]])){agents[_0x1f04fe[_0xf864('0x32')]][_0xf864('0x33')]=!![];agents[_0x1f04fe[_0xf864('0x32')]][_0xf864('0x34')]=_0xf864('0x35');agents[_0x1f04fe['transfereruniqueid']][_0xf864('0x36')]=_0x1f04fe[_0xf864('0x37')];agents[_0x1f04fe[_0xf864('0x32')]]['transferuniqueid']=agents[_0x1f04fe[_0xf864('0x32')]]['uniqueid'];}}catch(_0x149daa){utils['error'](_0x149daa[_0xf864('0x19')]);}};exports[_0xf864('0x38')]=function(_0x134b62){try{if(_0x134b62[_0xf864('0x39')]==_0x134b62['origtransfererlinkedid']){if(!_[_0xf864('0x2d')](agents[_0x134b62['secondtransfereruniqueid']])){agents[_0x134b62[_0xf864('0x3a')]][_0xf864('0x33')]=!![];agents[_0x134b62[_0xf864('0x3a')]][_0xf864('0x34')]=_0xf864('0x3b');agents[_0x134b62['secondtransfereruniqueid']]['transferexten']=_0x134b62[_0xf864('0x3c')];agents[_0x134b62[_0xf864('0x3a')]]['transferuniqueid']=_0x134b62[_0xf864('0x39')];}if(_0x134b62[_0xf864('0x3d')]&&agents[_0x134b62[_0xf864('0x3d')]]){agents[_0x134b62[_0xf864('0x3d')]]['agententerreason']=0x1;transfers[_0x134b62[_0xf864('0x3d')]]=_[_0xf864('0x3e')](agents[_0x134b62[_0xf864('0x3d')]]);transfers[_0x134b62[_0xf864('0x3d')]][_0xf864('0x7')]=agents[_0x134b62['secondtransfereruniqueid']][_0xf864('0x7')];transfers[_0x134b62[_0xf864('0x3d')]]['calleridname']=agents[_0x134b62[_0xf864('0x3a')]][_0xf864('0x3f')];transfers[_0x134b62[_0xf864('0x3d')]][_0xf864('0x14')]=utils[_0xf864('0x1c')]();transfers[_0x134b62[_0xf864('0x3d')]]['agentconnectAt']=utils[_0xf864('0x1c')]();transfers[_0x134b62[_0xf864('0x3d')]][_0xf864('0x26')]=0x0;transfers[_0x134b62[_0xf864('0x3d')]]['agententerreason']=0x2;}}else if(_0x134b62[_0xf864('0x3a')]==_0x134b62['secondtransfererlinkedid']){if(!_[_0xf864('0x2d')](agents[_0x134b62['origtransfereruniqueid']])){agents[_0x134b62[_0xf864('0x39')]][_0xf864('0x33')]=!![];agents[_0x134b62[_0xf864('0x39')]][_0xf864('0x34')]=_0xf864('0x3b');agents[_0x134b62[_0xf864('0x39')]][_0xf864('0x36')]=_0x134b62[_0xf864('0x40')];agents[_0x134b62[_0xf864('0x39')]][_0xf864('0x41')]=_0x134b62[_0xf864('0x3a')];}if(_0x134b62[_0xf864('0x42')]&&agents[_0x134b62[_0xf864('0x42')]]){agents[_0x134b62['transfertargetuniqueid']][_0xf864('0x43')]=0x1;transfers[_0x134b62[_0xf864('0x42')]]=_[_0xf864('0x3e')](agents[_0x134b62[_0xf864('0x42')]]);transfers[_0x134b62['transfertargetuniqueid']][_0xf864('0x7')]=agents[_0x134b62[_0xf864('0x39')]][_0xf864('0x7')];transfers[_0x134b62[_0xf864('0x42')]][_0xf864('0x3f')]=agents[_0x134b62['origtransfereruniqueid']][_0xf864('0x3f')];transfers[_0x134b62[_0xf864('0x42')]]['agentcalledAt']=utils['now']();transfers[_0x134b62[_0xf864('0x42')]][_0xf864('0x28')]=utils['now']();transfers[_0x134b62[_0xf864('0x42')]][_0xf864('0x26')]=0x0;transfers[_0x134b62[_0xf864('0x42')]][_0xf864('0x43')]=0x2;}}}catch(_0x32fa36){utils[_0xf864('0x18')](_0x32fa36[_0xf864('0x19')]);}};exports[_0xf864('0x44')]=function(_0x2bbb83){try{if(agents[_0x2bbb83['uniqueid']]&&agents[_0x2bbb83['uniqueid']][_0xf864('0x24')]==='timeout'){if(_0x2bbb83[_0xf864('0x45')]==='21'){agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x24')]=_0xf864('0x46');agents[_0x2bbb83[_0xf864('0x12')]]['lastevent']=_0xf864('0x46');}writeDB(agents[_0x2bbb83[_0xf864('0x12')]]);var _0x27f590=unanswered[_0xf864('0x47')](_0x2bbb83[_0xf864('0x12')]);if(_0x27f590>-0x1)unanswered[_0xf864('0x48')](_0x27f590,0x1);}if(transfers[_0x2bbb83[_0xf864('0x12')]]){transfers[_0x2bbb83[_0xf864('0x12')]][_0xf864('0xf')]=!![];transfers[_0x2bbb83['uniqueid']][_0xf864('0x2e')]=utils['now']();transfers[_0x2bbb83['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x2bbb83[_0xf864('0x12')]]['agentcompleteAt'],transfers[_0x2bbb83['uniqueid']][_0xf864('0x28')]);transfers[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x24')]=_0xf864('0x49');transfers[_0x2bbb83[_0xf864('0x12')]]['lastevent']=_0xf864('0x30');writeDB(transfers[_0x2bbb83['uniqueid']],!![]);}if(agents[_0x2bbb83[_0xf864('0x12')]]&&agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x28')]){agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0xf')]=!![];agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x2e')]=utils[_0xf864('0x1c')]();agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x1f')]=utils[_0xf864('0x2f')](agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x2e')],agents[_0x2bbb83['uniqueid']]['agentconnectAt']);agents[_0x2bbb83[_0xf864('0x12')]]['reason']=agents[_0x2bbb83['uniqueid']][_0xf864('0x33')]?'transfer':_0xf864('0x49');agents[_0x2bbb83[_0xf864('0x12')]][_0xf864('0x9')]='complete';writeDB(agents[_0x2bbb83[_0xf864('0x12')]]);}}catch(_0x539b45){utils[_0xf864('0x18')](_0x539b45[_0xf864('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1959078..6fcb3f7 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 _0x888c=['request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','DOCUMENTATION','error','stack','isNil','systemanswertime','channelstate','context','destinationchannel','answertime','hangup','callerid','calleridname','endtime','diffTime','billableseconds','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','outboundrouteid','routeid','newexten','application','startsWith','appdata','toLowerCase','split','substring','includes','execif','set','gotoif','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','destination','disposition','accountcode','then','UserId'];(function(_0x5b0b7e,_0x426f5f){var _0x12e0f2=function(_0x4b430f){while(--_0x4b430f){_0x5b0b7e['push'](_0x5b0b7e['shift']());}};_0x12e0f2(++_0x426f5f);}(_0x888c,0x1be));var _0xc888=function(_0x1a8f75,_0x48f63f){_0x1a8f75=_0x1a8f75-0x0;var _0x369651=_0x888c[_0x1a8f75];return _0x369651;};'use strict';var _=require(_0xc888('0x0'));var util=require(_0xc888('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0xc888('0x2'),_0xc888('0x2'),_0xc888('0x3'),_0xc888('0x3'),_0xc888('0x3'),_0xc888('0x4'),'BUSY','FAILED',_0xc888('0x2'),_0xc888('0x2')];var channels={};function writeDB(_0x478d72){utils['info'](util[_0xc888('0x5')](_0xc888('0x6'),_0x478d72[_0xc888('0x7')],_0x478d72[_0xc888('0x8')],_0x478d72[_0xc888('0x9')],_0x478d72['accountcode'],_0x478d72[_0xc888('0xa')],_0x478d72[_0xc888('0xb')],_0x478d72['callerid'],_0x478d72[_0xc888('0xc')]));if(_0x478d72['accountcode']){utils['getUserByInternal'](_0x478d72[_0xc888('0xd')])[_0xc888('0xe')](function(_0x9a071b){if(_0x9a071b){_0x478d72[_0xc888('0xf')]=_0x9a071b['id'];}utils[_0xc888('0x10')](_0xc888('0x11'),_0x478d72);});}else{utils['request']('CreateVoiceCallReport',_0x478d72);}if(channels[_0x478d72['uniqueid']]){delete channels[_0x478d72[_0xc888('0x7')]];}}exports[_0xc888('0x12')]=function(_0x4f35e8){try{if(_0x4f35e8[_0xc888('0x7')]==_0x4f35e8[_0xc888('0x13')]&&_0x4f35e8[_0xc888('0x8')]!=_0xc888('0x14')){channels[_0x4f35e8[_0xc888('0x7')]]={'uniqueid':_0x4f35e8[_0xc888('0x7')],'accountcode':_0x4f35e8[_0xc888('0xd')],'source':_0x4f35e8[_0xc888('0x15')],'destination':_0x4f35e8[_0xc888('0x16')],'destinationcontext':_0x4f35e8['context'],'channel':_0x4f35e8[_0xc888('0x8')],'starttime':utils[_0xc888('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc888('0x3'),'amaflags':_0xc888('0x18')};}}catch(_0x45b54c){utils[_0xc888('0x19')](_0x45b54c[_0xc888('0x1a')]);}};exports['newstate']=function(_0x5a926d){try{if(!_[_0xc888('0x1b')](channels[_0x5a926d['uniqueid']])&&_0x5a926d['channelstate']==0x6){if(_['isNil'](channels[_0x5a926d[_0xc888('0x7')]][_0xc888('0x1c')])){channels[_0x5a926d[_0xc888('0x7')]]['systemanswertime']=utils[_0xc888('0x17')]();}}else if(!_[_0xc888('0x1b')](channels[_0x5a926d[_0xc888('0x13')]])&&_0x5a926d[_0xc888('0x1d')]==0x6&&_0x5a926d[_0xc888('0x1e')]!='transfer'){channels[_0x5a926d[_0xc888('0x13')]][_0xc888('0xd')]=_0x5a926d[_0xc888('0xd')];channels[_0x5a926d['linkedid']][_0xc888('0x1f')]=_0x5a926d['channel'];if(_[_0xc888('0x1b')](channels[_0x5a926d[_0xc888('0x13')]][_0xc888('0x20')])){channels[_0x5a926d[_0xc888('0x13')]][_0xc888('0x20')]=utils['now']();}channels[_0x5a926d[_0xc888('0x13')]]['disposition']=dispositions[_['toNumber'](_0x5a926d[_0xc888('0x1d')])]||_0xc888('0x4');}}catch(_0x1a29cb){utils[_0xc888('0x19')](_0x1a29cb[_0xc888('0x1a')]);}};exports[_0xc888('0x21')]=function(_0x3db571){try{if(!_[_0xc888('0x1b')](channels[_0x3db571['uniqueid']])){if(_[_0xc888('0x1b')](channels[_0x3db571[_0xc888('0x7')]][_0xc888('0x22')])){channels[_0x3db571[_0xc888('0x7')]][_0xc888('0x22')]=_0x3db571[_0xc888('0x23')]+'\x20<'+_0x3db571[_0xc888('0x15')]+'>';}channels[_0x3db571['uniqueid']][_0xc888('0x24')]=utils[_0xc888('0x17')]();channels[_0x3db571[_0xc888('0x7')]]['duration']=utils[_0xc888('0x25')](channels[_0x3db571[_0xc888('0x7')]][_0xc888('0x24')],channels[_0x3db571[_0xc888('0x7')]]['starttime']);channels[_0x3db571['uniqueid']][_0xc888('0x26')]=channels[_0x3db571[_0xc888('0x7')]][_0xc888('0x20')]?utils[_0xc888('0x25')](channels[_0x3db571[_0xc888('0x7')]][_0xc888('0x24')],channels[_0x3db571[_0xc888('0x7')]]['answertime']):0x0;writeDB(channels[_0x3db571[_0xc888('0x7')]]);}}catch(_0x46191c){utils[_0xc888('0x19')](_0x46191c[_0xc888('0x1a')]);}};exports[_0xc888('0x27')]=function(_0x133f08){try{if(!_[_0xc888('0x1b')](channels[_0x133f08[_0xc888('0x28')]])){if(channels[_0x133f08[_0xc888('0x28')]][_0xc888('0x8')]==_0x133f08['transfereechannel']){channels[_0x133f08['localtwolinkedid']][_0xc888('0x1f')]=_0x133f08[_0xc888('0x29')];channels[_0x133f08[_0xc888('0x28')]][_0xc888('0x2a')]=_0xc888('0x2b');}else if(channels[_0x133f08[_0xc888('0x28')]][_0xc888('0x8')]=_0x133f08[_0xc888('0x2c')]){channels[_0x133f08[_0xc888('0x28')]][_0xc888('0x1f')]=_0x133f08[_0xc888('0x2d')];channels[_0x133f08[_0xc888('0x28')]]['userfield']=_0xc888('0x2b');}}}catch(_0x20b526){utils[_0xc888('0x19')](_0x20b526[_0xc888('0x1a')]);}};exports[_0xc888('0x2e')]=function(_0x4b3d4c){try{if(!_[_0xc888('0x1b')](channels[_0x4b3d4c[_0xc888('0x7')]])){channels[_0x4b3d4c[_0xc888('0x7')]][_0xc888('0x2f')]=utils[_0xc888('0x17')]();}}catch(_0x5586f1){utils[_0xc888('0x19')](_0x5586f1[_0xc888('0x1a')]);}};exports[_0xc888('0x30')]=function(_0x462c2b){try{if(!_[_0xc888('0x1b')](channels[_0x462c2b[_0xc888('0x7')]])){if(!_[_0xc888('0x1b')](channels[_0x462c2b['uniqueid']][_0xc888('0x2f')])){channels[_0x462c2b[_0xc888('0x7')]][_0xc888('0x31')]+=utils['diffTime'](utils[_0xc888('0x17')](),channels[_0x462c2b['uniqueid']]['musiconholdstartAt']);delete channels[_0x462c2b[_0xc888('0x7')]][_0xc888('0x2f')];}}}catch(_0x46acb5){utils[_0xc888('0x19')](_0x46acb5['stack']);}};exports[_0xc888('0x32')]=function(_0x5dc362){try{if(!_['isNil'](channels[_0x5dc362[_0xc888('0x7')]])){if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')][_0xc888('0x34')])){channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0xa')]=_0x5dc362[_0xc888('0x35')];}if(!_['isNil'](_0x5dc362[_0xc888('0x33')][_0xc888('0x36')])){channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0xb')]=_0x5dc362[_0xc888('0x35')];channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0x22')]='\x22'+_0x5dc362[_0xc888('0x35')]+_0xc888('0x37')+_0x5dc362[_0xc888('0x35')]+'>';}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')]['xmd-callerid-preview'])||!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')][_0xc888('0x38')])){channels[_0x5dc362['uniqueid']][_0xc888('0x22')]=_0x5dc362[_0xc888('0x35')];}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')][_0xc888('0x39')])||!_[_0xc888('0x1b')](_0x5dc362['variable'][_0xc888('0x3a')])){channels[_0x5dc362['uniqueid']][_0xc888('0x3b')]=_0xc888('0x3c');channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0x3d')]=_0x5dc362[_0xc888('0x35')];channels[_0x5dc362[_0xc888('0x7')]]['queue']=!![];}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')]['xmd-contactid'])){channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0x3e')]=_0x5dc362[_0xc888('0x35')];}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')][_0xc888('0x3f')])){channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0x9')]=_0x5dc362[_0xc888('0x35')];}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')][_0xc888('0x40')])){channels[_0x5dc362[_0xc888('0x7')]][_0xc888('0x41')]=_0x5dc362[_0xc888('0x35')];}if(!_[_0xc888('0x1b')](_0x5dc362[_0xc888('0x33')]['sipcallid'])){channels[_0x5dc362[_0xc888('0x7')]]['sipcallid']=_0x5dc362[_0xc888('0x35')];}}}catch(_0x44ab04){utils[_0xc888('0x19')](_0x44ab04[_0xc888('0x1a')]);}};exports[_0xc888('0x42')]=function(_0x271b54){try{if(!_[_0xc888('0x1b')](channels[_0x271b54[_0xc888('0x7')]])){if(_0x271b54[_0xc888('0x43')]['toLowerCase']()=='set'&&_[_0xc888('0x44')](_0x271b54[_0xc888('0x45')][_0xc888('0x46')](),'cdr')){var _0x252275=_0x271b54[_0xc888('0x45')][_0xc888('0x47')]('=');var _0x521bc5=_0x252275[0x0][_0xc888('0x48')](_0x252275[0x0]['lastIndexOf']('(')+0x1,_0x252275[0x0]['lastIndexOf'](')'));var _0x2e9e47=_0x252275[0x1];channels[_0x271b54[_0xc888('0x7')]][_0x521bc5]=_0x2e9e47;}if(!_[_0xc888('0x49')]([_0xc888('0x21'),'noop',_0xc888('0x4a'),_0xc888('0x4b'),_0xc888('0x4c')],_0x271b54[_0xc888('0x43')][_0xc888('0x46')]())){channels[_0x271b54[_0xc888('0x7')]][_0xc888('0x3b')]=_0x271b54[_0xc888('0x43')];channels[_0x271b54[_0xc888('0x7')]][_0xc888('0x3d')]=_0x271b54[_0xc888('0x45')];}}}catch(_0x4edceb){utils[_0xc888('0x19')](_0x4edceb[_0xc888('0x1a')]);}}; \ No newline at end of file +var _0x4be6=['disposition','toNumber','ANSWERED','hangup','callerid','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-phone','destination','value','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','queue','ContactId','outboundrouteid','routeid','sipcallid','application','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','./utils','FAILED','NO\x20ANSWER','BUSY','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','linkedid','calleridnum','exten','DOCUMENTATION','error','stack','channelstate','systemanswertime','now','isNil','context','destinationchannel','answertime'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0x4be6,0x17c));var _0x64be=function(_0x16eb13,_0x3d592f){_0x16eb13=_0x16eb13-0x0;var _0x2b6230=_0x4be6[_0x16eb13];return _0x2b6230;};'use strict';var _=require(_0x64be('0x0'));var util=require('util');var utils=require(_0x64be('0x1'));var dispositions=['NO\x20ANSWER',_0x64be('0x2'),_0x64be('0x2'),'NO\x20ANSWER',_0x64be('0x3'),_0x64be('0x3'),'ANSWERED',_0x64be('0x4'),_0x64be('0x2'),'FAILED',_0x64be('0x2')];var channels={};function writeDB(_0x524262){utils['info'](util[_0x64be('0x5')](_0x64be('0x6'),_0x524262[_0x64be('0x7')],_0x524262[_0x64be('0x8')],_0x524262[_0x64be('0x9')],_0x524262['accountcode'],_0x524262[_0x64be('0xa')],_0x524262['destination'],_0x524262['callerid'],_0x524262['disposition']));if(_0x524262[_0x64be('0xb')]){utils[_0x64be('0xc')](_0x524262[_0x64be('0xb')])[_0x64be('0xd')](function(_0x2b41db){if(_0x2b41db){_0x524262['UserId']=_0x2b41db['id'];}utils[_0x64be('0xe')](_0x64be('0xf'),_0x524262);});}else{utils[_0x64be('0xe')](_0x64be('0xf'),_0x524262);}if(channels[_0x524262[_0x64be('0x7')]]){delete channels[_0x524262[_0x64be('0x7')]];}}exports[_0x64be('0x10')]=function(_0x4dfaeb){try{if(_0x4dfaeb[_0x64be('0x7')]==_0x4dfaeb[_0x64be('0x11')]&&_0x4dfaeb[_0x64be('0x8')]!='OutgoingSpoolFailed'){channels[_0x4dfaeb['uniqueid']]={'uniqueid':_0x4dfaeb['uniqueid'],'accountcode':_0x4dfaeb[_0x64be('0xb')],'source':_0x4dfaeb[_0x64be('0x12')],'destination':_0x4dfaeb[_0x64be('0x13')],'destinationcontext':_0x4dfaeb['context'],'channel':_0x4dfaeb[_0x64be('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x64be('0x3'),'amaflags':_0x64be('0x14')};}}catch(_0x538c82){utils[_0x64be('0x15')](_0x538c82[_0x64be('0x16')]);}};exports['newstate']=function(_0xbb7da7){try{if(!_['isNil'](channels[_0xbb7da7[_0x64be('0x7')]])&&_0xbb7da7[_0x64be('0x17')]==0x6){if(_['isNil'](channels[_0xbb7da7[_0x64be('0x7')]][_0x64be('0x18')])){channels[_0xbb7da7[_0x64be('0x7')]][_0x64be('0x18')]=utils[_0x64be('0x19')]();}}else if(!_[_0x64be('0x1a')](channels[_0xbb7da7['linkedid']])&&_0xbb7da7[_0x64be('0x17')]==0x6&&_0xbb7da7[_0x64be('0x1b')]!='transfer'){channels[_0xbb7da7[_0x64be('0x11')]][_0x64be('0xb')]=_0xbb7da7['accountcode'];channels[_0xbb7da7[_0x64be('0x11')]][_0x64be('0x1c')]=_0xbb7da7[_0x64be('0x8')];if(_[_0x64be('0x1a')](channels[_0xbb7da7[_0x64be('0x11')]][_0x64be('0x1d')])){channels[_0xbb7da7[_0x64be('0x11')]][_0x64be('0x1d')]=utils[_0x64be('0x19')]();}channels[_0xbb7da7[_0x64be('0x11')]][_0x64be('0x1e')]=dispositions[_[_0x64be('0x1f')](_0xbb7da7[_0x64be('0x17')])]||_0x64be('0x20');}}catch(_0x5af9d2){utils[_0x64be('0x15')](_0x5af9d2[_0x64be('0x16')]);}};exports[_0x64be('0x21')]=function(_0x5de49a){try{if(!_['isNil'](channels[_0x5de49a['uniqueid']])){if(_[_0x64be('0x1a')](channels[_0x5de49a['uniqueid']][_0x64be('0x22')])){channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x22')]=_0x5de49a[_0x64be('0x23')]+'\x20<'+_0x5de49a[_0x64be('0x12')]+'>';}channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x24')]=utils[_0x64be('0x19')]();channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x25')]=utils[_0x64be('0x26')](channels[_0x5de49a[_0x64be('0x7')]]['endtime'],channels[_0x5de49a['uniqueid']][_0x64be('0x27')]);channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x28')]=channels[_0x5de49a['uniqueid']][_0x64be('0x1d')]?utils[_0x64be('0x26')](channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x24')],channels[_0x5de49a[_0x64be('0x7')]][_0x64be('0x1d')]):0x0;writeDB(channels[_0x5de49a[_0x64be('0x7')]]);}}catch(_0x30b3d3){utils[_0x64be('0x15')](_0x30b3d3[_0x64be('0x16')]);}};exports[_0x64be('0x29')]=function(_0x5d5b22){try{if(!_[_0x64be('0x1a')](channels[_0x5d5b22[_0x64be('0x2a')]])){if(channels[_0x5d5b22[_0x64be('0x2a')]][_0x64be('0x8')]==_0x5d5b22[_0x64be('0x2b')]){channels[_0x5d5b22[_0x64be('0x2a')]][_0x64be('0x1c')]=_0x5d5b22[_0x64be('0x2c')];channels[_0x5d5b22[_0x64be('0x2a')]]['userfield']='_attended';}else if(channels[_0x5d5b22['localtwolinkedid']][_0x64be('0x8')]=_0x5d5b22[_0x64be('0x2d')]){channels[_0x5d5b22['localtwolinkedid']][_0x64be('0x1c')]=_0x5d5b22[_0x64be('0x2e')];channels[_0x5d5b22[_0x64be('0x2a')]][_0x64be('0x2f')]=_0x64be('0x30');}}}catch(_0x1915d5){utils['error'](_0x1915d5['stack']);}};exports[_0x64be('0x31')]=function(_0x401dcb){try{if(!_['isNil'](channels[_0x401dcb[_0x64be('0x7')]])){channels[_0x401dcb[_0x64be('0x7')]][_0x64be('0x32')]=utils[_0x64be('0x19')]();}}catch(_0x1d0a8c){utils[_0x64be('0x15')](_0x1d0a8c[_0x64be('0x16')]);}};exports[_0x64be('0x33')]=function(_0x5d6cca){try{if(!_[_0x64be('0x1a')](channels[_0x5d6cca[_0x64be('0x7')]])){if(!_['isNil'](channels[_0x5d6cca['uniqueid']][_0x64be('0x32')])){channels[_0x5d6cca[_0x64be('0x7')]]['mohtime']+=utils['diffTime'](utils[_0x64be('0x19')](),channels[_0x5d6cca[_0x64be('0x7')]][_0x64be('0x32')]);delete channels[_0x5d6cca[_0x64be('0x7')]][_0x64be('0x32')];}}}catch(_0x5dfc3e){utils[_0x64be('0x15')](_0x5dfc3e['stack']);}};exports[_0x64be('0x34')]=function(_0x1f5a01){try{if(!_[_0x64be('0x1a')](channels[_0x1f5a01[_0x64be('0x7')]])){if(!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')]['xmd-originatecalleridnum'])){channels[_0x1f5a01['uniqueid']][_0x64be('0xa')]=_0x1f5a01['value'];}if(!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')][_0x64be('0x36')])){channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x37')]=_0x1f5a01[_0x64be('0x38')];channels[_0x1f5a01['uniqueid']]['callerid']='\x22'+_0x1f5a01['value']+_0x64be('0x39')+_0x1f5a01[_0x64be('0x38')]+'>';}if(!_['isNil'](_0x1f5a01[_0x64be('0x35')][_0x64be('0x3a')])||!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')]['xmd-callerid'])){channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x22')]=_0x1f5a01[_0x64be('0x38')];}if(!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')][_0x64be('0x3b')])||!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')][_0x64be('0x3c')])){channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x3d')]=_0x64be('0x3e');channels[_0x1f5a01['uniqueid']]['lastdata']=_0x1f5a01[_0x64be('0x38')];channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x3f')]=!![];}if(!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')]['xmd-contactid'])){channels[_0x1f5a01['uniqueid']][_0x64be('0x40')]=_0x1f5a01[_0x64be('0x38')];}if(!_['isNil'](_0x1f5a01[_0x64be('0x35')]['xmd-cdrtype'])){channels[_0x1f5a01['uniqueid']]['type']=_0x1f5a01['value'];}if(!_[_0x64be('0x1a')](_0x1f5a01[_0x64be('0x35')][_0x64be('0x41')])){channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x42')]=_0x1f5a01[_0x64be('0x38')];}if(!_[_0x64be('0x1a')](_0x1f5a01['variable'][_0x64be('0x43')])){channels[_0x1f5a01[_0x64be('0x7')]][_0x64be('0x43')]=_0x1f5a01[_0x64be('0x38')];}}}catch(_0x5b369c){utils['error'](_0x5b369c['stack']);}};exports['newexten']=function(_0x5cfe5b){try{if(!_[_0x64be('0x1a')](channels[_0x5cfe5b['uniqueid']])){if(_0x5cfe5b[_0x64be('0x44')]['toLowerCase']()==_0x64be('0x45')&&_[_0x64be('0x46')](_0x5cfe5b['appdata'][_0x64be('0x47')](),_0x64be('0x48'))){var _0x453b7f=_0x5cfe5b[_0x64be('0x49')][_0x64be('0x4a')]('=');var _0x3862dd=_0x453b7f[0x0][_0x64be('0x4b')](_0x453b7f[0x0][_0x64be('0x4c')]('(')+0x1,_0x453b7f[0x0][_0x64be('0x4c')](')'));var _0x1c2a0a=_0x453b7f[0x1];channels[_0x5cfe5b['uniqueid']][_0x3862dd]=_0x1c2a0a;}if(!_[_0x64be('0x4d')]([_0x64be('0x21'),_0x64be('0x4e'),_0x64be('0x4f'),_0x64be('0x45'),_0x64be('0x50')],_0x5cfe5b['application'][_0x64be('0x47')]())){channels[_0x5cfe5b[_0x64be('0x7')]]['lastapplication']=_0x5cfe5b[_0x64be('0x44')];channels[_0x5cfe5b[_0x64be('0x7')]][_0x64be('0x51')]=_0x5cfe5b[_0x64be('0x49')];}}}catch(_0x2998c0){utils[_0x64be('0x15')](_0x2998c0['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8351c5b..459f0b4 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 _0x7ee1=['info','fullybooted','FULLYBOOTED','error','close','CLOSE','./utils','CONNECTED','shutdown'];(function(_0x83c1d2,_0xb86398){var _0x25d10a=function(_0x1f8a69){while(--_0x1f8a69){_0x83c1d2['push'](_0x83c1d2['shift']());}};_0x25d10a(++_0xb86398);}(_0x7ee1,0x8d));var _0x17ee=function(_0x4c061b,_0x2b83f5){_0x4c061b=_0x4c061b-0x0;var _0x4bc4d0=_0x7ee1[_0x4c061b];return _0x4bc4d0;};'use strict';var utils=require(_0x17ee('0x0'));var _=require('lodash');exports['connect']=function(){utils['info'](_0x17ee('0x1'));};exports[_0x17ee('0x2')]=function(){utils[_0x17ee('0x3')]('SHUTDOWN');};exports[_0x17ee('0x4')]=function(){utils[_0x17ee('0x3')](_0x17ee('0x5'));};exports[_0x17ee('0x6')]=function(_0x5c0617){utils[_0x17ee('0x6')](_0x5c0617);};exports[_0x17ee('0x7')]=function(){utils['info'](_0x17ee('0x8'));};exports['managerevent']=function(_0x3d767b){}; \ No newline at end of file +var _0x323f=['info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','lodash'];(function(_0xc4d642,_0x38c28d){var _0x2ede40=function(_0x1428b0){while(--_0x1428b0){_0xc4d642['push'](_0xc4d642['shift']());}};_0x2ede40(++_0x38c28d);}(_0x323f,0x1ee));var _0xf323=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x323f[_0x501510];return _0x1e6ee5;};'use strict';var utils=require('./utils');var _=require(_0xf323('0x0'));exports['connect']=function(){utils[_0xf323('0x1')](_0xf323('0x2'));};exports[_0xf323('0x3')]=function(){utils[_0xf323('0x1')](_0xf323('0x4'));};exports[_0xf323('0x5')]=function(){utils[_0xf323('0x1')](_0xf323('0x6'));};exports[_0xf323('0x7')]=function(_0x371707){utils['error'](_0x371707);};exports[_0xf323('0x8')]=function(){utils[_0xf323('0x1')](_0xf323('0x9'));};exports[_0xf323('0xa')]=function(_0x8abeac){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9c43f36..ec93f54 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 _0x5308=['format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','now','lastevent','dialend','ANSWER','answertime','connect','hangup','complete','duration','endtime','starttime','holdtime','diffTime','util','./utils','info'];(function(_0x49a982,_0x129a07){var _0x2a0bc9=function(_0x385cb2){while(--_0x385cb2){_0x49a982['push'](_0x49a982['shift']());}};_0x2a0bc9(++_0x129a07);}(_0x5308,0x11c));var _0x8530=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x5308[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var utils=require(_0x8530('0x1'));var dials={};function writeDB(_0x19fe09){utils[_0x8530('0x2')](util[_0x8530('0x3')](_0x8530('0x4'),_0x19fe09[_0x8530('0x5')],_0x19fe09[_0x8530('0x6')],_0x19fe09['dialstring'],_0x19fe09[_0x8530('0x7')],_0x19fe09[_0x8530('0x8')],_0x19fe09[_0x8530('0x9')]));utils[_0x8530('0xa')](_0x8530('0xb'),_0x19fe09);delete dials[_0x19fe09[_0x8530('0x5')]];}exports['newexten']=function(_0x41dd67){try{if(_0x41dd67[_0x8530('0xc')][_0x8530('0xd')]()==_0x8530('0xe')&&_[_0x8530('0xf')](_0x41dd67[_0x8530('0x10')][_0x8530('0xd')](),_0x8530('0x11'))){var _0x5eea0f=_0x41dd67[_0x8530('0x10')][_0x8530('0x12')]('=');dials[_0x41dd67[_0x8530('0x5')]]={'routeId':_0x5eea0f[0x1]};}}catch(_0x3cd68f){utils[_0x8530('0x13')](_0x3cd68f[_0x8530('0x14')]);}};exports[_0x8530('0x15')]=function(_0x583ced){try{if(!_[_0x8530('0x16')](_0x583ced[_0x8530('0x17')][_0x8530('0x18')])){dials[_0x583ced['uniqueid']]={'routeId':_0x583ced[_0x8530('0x19')]};}}catch(_0x1ad35a){utils[_0x8530('0x13')](_0x1ad35a[_0x8530('0x14')]);}};exports[_0x8530('0x1a')]=function(_0x3e1ba2){try{if(!_[_0x8530('0x16')](dials[_0x3e1ba2[_0x8530('0x5')]])){dials[_0x3e1ba2[_0x8530('0x5')]]=_[_0x8530('0x1b')](dials[_0x3e1ba2[_0x8530('0x5')]],_0x3e1ba2);dials[_0x3e1ba2[_0x8530('0x5')]]['starttime']=utils[_0x8530('0x1c')]();dials[_0x3e1ba2[_0x8530('0x5')]][_0x8530('0x1d')]='called';}}catch(_0x1f2b38){utils['error'](_0x1f2b38[_0x8530('0x14')]);}};exports[_0x8530('0x1e')]=function(_0x1b6241){try{if(!_[_0x8530('0x16')](dials[_0x1b6241[_0x8530('0x5')]])){dials[_0x1b6241[_0x8530('0x5')]][_0x8530('0x9')]=_0x1b6241[_0x8530('0x9')];if(_0x1b6241[_0x8530('0x9')]==_0x8530('0x1f')){dials[_0x1b6241[_0x8530('0x5')]]=_['assign'](dials[_0x1b6241[_0x8530('0x5')]],_0x1b6241);dials[_0x1b6241[_0x8530('0x5')]][_0x8530('0x20')]=utils[_0x8530('0x1c')]();dials[_0x1b6241[_0x8530('0x5')]][_0x8530('0x1d')]=_0x8530('0x21');}}}catch(_0x205219){utils['error'](_0x205219[_0x8530('0x14')]);}};exports[_0x8530('0x22')]=function(_0x4d0ddc){try{if(!_[_0x8530('0x16')](dials[_0x4d0ddc[_0x8530('0x5')]])){dials[_0x4d0ddc[_0x8530('0x5')]]=_[_0x8530('0x1b')](dials[_0x4d0ddc[_0x8530('0x5')]],{'endtime':utils[_0x8530('0x1c')](),'lastevent':_0x8530('0x23')});dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x24')]=utils['diffTime'](dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x25')],dials[_0x4d0ddc['uniqueid']][_0x8530('0x26')]);dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x27')]=utils[_0x8530('0x28')](dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x20')]||dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x25')],dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x26')]);dials[_0x4d0ddc[_0x8530('0x5')]]['billableseconds']=dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x20')]?utils[_0x8530('0x28')](dials[_0x4d0ddc['uniqueid']][_0x8530('0x25')],dials[_0x4d0ddc[_0x8530('0x5')]][_0x8530('0x20')]):0x0;writeDB(dials[_0x4d0ddc[_0x8530('0x5')]]);}}catch(_0x55b2af){utils[_0x8530('0x13')](_0x55b2af['stack']);}}; \ No newline at end of file +var _0xd527=['stack','dialend','dialstatus','answertime','hangup','duration','diffTime','endtime','holdtime','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','newexten','application','toLowerCase','startsWith','cdr(routeid)','split','error','isNil','variable','outboundrouteid','assign','starttime','now','lastevent'];(function(_0x5446d0,_0x23d52e){var _0x349254=function(_0x53d9f0){while(--_0x53d9f0){_0x5446d0['push'](_0x5446d0['shift']());}};_0x349254(++_0x23d52e);}(_0xd527,0x195));var _0x7d52=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0xd527[_0x45977c];return _0x399413;};'use strict';var _=require('lodash');var util=require(_0x7d52('0x0'));var utils=require(_0x7d52('0x1'));var dials={};function writeDB(_0x1168d0){utils[_0x7d52('0x2')](util[_0x7d52('0x3')](_0x7d52('0x4'),_0x1168d0[_0x7d52('0x5')],_0x1168d0[_0x7d52('0x6')],_0x1168d0[_0x7d52('0x7')],_0x1168d0[_0x7d52('0x8')],_0x1168d0[_0x7d52('0x9')],_0x1168d0['dialstatus']));utils['request']('CreateVoiceDialReport',_0x1168d0);delete dials[_0x1168d0['uniqueid']];}exports[_0x7d52('0xa')]=function(_0xb2b79e){try{if(_0xb2b79e[_0x7d52('0xb')][_0x7d52('0xc')]()=='set'&&_[_0x7d52('0xd')](_0xb2b79e['appdata'][_0x7d52('0xc')](),_0x7d52('0xe'))){var _0x1c9d26=_0xb2b79e['appdata'][_0x7d52('0xf')]('=');dials[_0xb2b79e[_0x7d52('0x5')]]={'routeId':_0x1c9d26[0x1]};}}catch(_0x3d6eed){utils[_0x7d52('0x10')](_0x3d6eed['stack']);}};exports['varset']=function(_0x542745){try{if(!_[_0x7d52('0x11')](_0x542745[_0x7d52('0x12')][_0x7d52('0x13')])){dials[_0x542745['uniqueid']]={'routeId':_0x542745['value']};}}catch(_0x5cf551){utils['error'](_0x5cf551['stack']);}};exports['dialbegin']=function(_0x70496d){try{if(!_[_0x7d52('0x11')](dials[_0x70496d[_0x7d52('0x5')]])){dials[_0x70496d[_0x7d52('0x5')]]=_[_0x7d52('0x14')](dials[_0x70496d['uniqueid']],_0x70496d);dials[_0x70496d[_0x7d52('0x5')]][_0x7d52('0x15')]=utils[_0x7d52('0x16')]();dials[_0x70496d[_0x7d52('0x5')]][_0x7d52('0x17')]='called';}}catch(_0x51b1df){utils[_0x7d52('0x10')](_0x51b1df[_0x7d52('0x18')]);}};exports[_0x7d52('0x19')]=function(_0x1f9600){try{if(!_[_0x7d52('0x11')](dials[_0x1f9600[_0x7d52('0x5')]])){dials[_0x1f9600[_0x7d52('0x5')]][_0x7d52('0x1a')]=_0x1f9600[_0x7d52('0x1a')];if(_0x1f9600[_0x7d52('0x1a')]=='ANSWER'){dials[_0x1f9600['uniqueid']]=_[_0x7d52('0x14')](dials[_0x1f9600['uniqueid']],_0x1f9600);dials[_0x1f9600[_0x7d52('0x5')]][_0x7d52('0x1b')]=utils['now']();dials[_0x1f9600['uniqueid']][_0x7d52('0x17')]='connect';}}}catch(_0x52ee49){utils[_0x7d52('0x10')](_0x52ee49[_0x7d52('0x18')]);}};exports[_0x7d52('0x1c')]=function(_0x1a5472){try{if(!_[_0x7d52('0x11')](dials[_0x1a5472[_0x7d52('0x5')]])){dials[_0x1a5472['uniqueid']]=_[_0x7d52('0x14')](dials[_0x1a5472['uniqueid']],{'endtime':utils[_0x7d52('0x16')](),'lastevent':'complete'});dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x1d')]=utils[_0x7d52('0x1e')](dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x1f')],dials[_0x1a5472['uniqueid']][_0x7d52('0x15')]);dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x20')]=utils[_0x7d52('0x1e')](dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x1b')]||dials[_0x1a5472['uniqueid']][_0x7d52('0x1f')],dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x15')]);dials[_0x1a5472['uniqueid']]['billableseconds']=dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x1b')]?utils[_0x7d52('0x1e')](dials[_0x1a5472[_0x7d52('0x5')]][_0x7d52('0x1f')],dials[_0x1a5472['uniqueid']][_0x7d52('0x1b')]):0x0;writeDB(dials[_0x1a5472[_0x7d52('0x5')]]);}}catch(_0x59ec41){utils[_0x7d52('0x10')](_0x59ec41[_0x7d52('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d8d1a27..13a44d4 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 _0x219a=['disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.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','dialend','asterisk-manager','../../config/environment','./utils','port','username','password','keepConnected','xdr'];(function(_0x48228d,_0x25ef8f){var _0x35264a=function(_0x5ee8dc){while(--_0x5ee8dc){_0x48228d['push'](_0x48228d['shift']());}};_0x35264a(++_0x25ef8f);}(_0x219a,0x79));var _0xa219=function(_0x36f86a,_0x180092){_0x36f86a=_0x36f86a-0x0;var _0x160f34=_0x219a[_0x36f86a];return _0x160f34;};var AsteriskManager=require(_0xa219('0x0'));var config=require(_0xa219('0x1'));var utils=require(_0xa219('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xa219('0x3')],config['asterisk']['ip'],config['asterisk'][_0xa219('0x4')],config['asterisk'][_0xa219('0x5')],!![]);ami[_0xa219('0x6')]();if(config[_0xa219('0x7')]&&config[_0xa219('0x7')][_0xa219('0x8')]){utils[_0xa219('0x9')](_0xa219('0xa'));}else{var agents=require(_0xa219('0xb'));var calls=require('./calls.controller');var queues=require(_0xa219('0xc'));var recordings=require(_0xa219('0xd'));var members=require(_0xa219('0xe'));var dials=require(_0xa219('0xf'));var transfers=require(_0xa219('0x10'));var core=require('./core.controller');ami['on'](_0xa219('0x11'),core[_0xa219('0x11')]);ami['on'](_0xa219('0x12'),core[_0xa219('0x12')]);ami['on']('fullybooted',core[_0xa219('0x13')]);ami['on'](_0xa219('0x14'),core[_0xa219('0x14')]);ami['on']('close',core[_0xa219('0x15')]);ami['on'](_0xa219('0x16'),core[_0xa219('0x16')]);ami['on'](_0xa219('0x17'),function(_0xbef6ae){try{members[_0xa219('0x17')](_0xbef6ae);}catch(_0x1ec19c){utils[_0xa219('0x14')](_0x1ec19c);}});ami['on'](_0xa219('0x18'),function(_0x5338da){try{agents['agentcalled'](_0x5338da);}catch(_0x147c57){utils[_0xa219('0x14')](_0x147c57);}});ami['on'](_0xa219('0x19'),function(_0x4b43f6){try{agents['agentringnoanswer'](_0x4b43f6);}catch(_0x5a61ba){utils[_0xa219('0x14')](_0x5a61ba);}});ami['on'](_0xa219('0x1a'),function(_0x566f38){try{agents[_0xa219('0x1a')](_0x566f38);queues['agentconnect'](_0x566f38);}catch(_0x58c850){utils[_0xa219('0x14')](_0x58c850);}});ami['on'](_0xa219('0x1b'),function(_0x273116){try{agents[_0xa219('0x1b')](_0x273116);queues['agentcomplete'](_0x273116);members[_0xa219('0x1b')](_0x273116);}catch(_0x2d6a21){utils[_0xa219('0x14')](_0x2d6a21);}});ami['on'](_0xa219('0x1c'),function(_0xd20a36){try{agents[_0xa219('0x1c')](_0xd20a36);queues[_0xa219('0x1c')](_0xd20a36);}catch(_0x43b127){utils[_0xa219('0x14')](_0x43b127);}});ami['on']('queuecallerjoin',function(_0x47e3cb){try{queues[_0xa219('0x1d')](_0x47e3cb);recordings['queuecallerjoin'](_0x47e3cb);}catch(_0x261b4b){utils['error'](_0x261b4b);}});ami['on'](_0xa219('0x1e'),function(_0x2d6589){try{queues[_0xa219('0x1e')](_0x2d6589);}catch(_0x4355e1){utils['error'](_0x4355e1);}});ami['on']('musiconholdstart',function(_0xee2edc){try{queues[_0xa219('0x1f')](_0xee2edc);calls['musiconholdstart'](_0xee2edc);}catch(_0x86dd6e){utils['error'](_0x86dd6e);}});ami['on'](_0xa219('0x20'),function(_0x19aa5b){try{queues[_0xa219('0x20')](_0x19aa5b);calls['musiconholdstop'](_0x19aa5b);}catch(_0x12d7e2){utils[_0xa219('0x14')](_0x12d7e2);}});ami['on'](_0xa219('0x21'),function(_0x3ba962){try{calls['newstate'](_0x3ba962);recordings[_0xa219('0x21')](_0x3ba962);}catch(_0x34f800){utils[_0xa219('0x14')](_0x34f800);}});ami['on']('hangup',function(_0x11b896){try{calls[_0xa219('0x22')](_0x11b896);recordings[_0xa219('0x22')](_0x11b896);dials[_0xa219('0x22')](_0x11b896);agents[_0xa219('0x22')](_0x11b896);queues[_0xa219('0x22')](_0x11b896);}catch(_0x1105f4){utils['error'](_0x1105f4);}});ami['on'](_0xa219('0x23'),function(_0x23809f){try{members['cdr'](_0x23809f);}catch(_0x7fb7d3){utils[_0xa219('0x14')](_0x7fb7d3);}});ami['on'](_0xa219('0x24'),function(_0x23f703){try{queues[_0xa219('0x24')](_0x23f703);agents[_0xa219('0x24')](_0x23f703);transfers['blindtransfer'](_0x23f703);}catch(_0x43f625){utils[_0xa219('0x14')](_0x43f625);}});ami['on'](_0xa219('0x25'),function(_0x329fbf){try{queues[_0xa219('0x25')](_0x329fbf);transfers['attendedtransfer'](_0x329fbf);agents[_0xa219('0x25')](_0x329fbf);calls[_0xa219('0x25')](_0x329fbf);}catch(_0x589031){utils[_0xa219('0x14')](_0x589031);}});ami['on'](_0xa219('0x26'),function(_0x593fd2){try{queues[_0xa219('0x26')](_0x593fd2);recordings[_0xa219('0x26')](_0x593fd2);calls['varset'](_0x593fd2);dials['varset'](_0x593fd2);}catch(_0x5b3c47){utils['error'](_0x5b3c47);}});ami['on']('newexten',function(_0x1d07cf){try{calls['newexten'](_0x1d07cf);recordings[_0xa219('0x27')](_0x1d07cf);dials[_0xa219('0x27')](_0x1d07cf);}catch(_0xfa8c6a){utils[_0xa219('0x14')](_0xfa8c6a);}});ami['on'](_0xa219('0x28'),function(_0x338c7e){try{calls[_0xa219('0x28')](_0x338c7e);recordings[_0xa219('0x28')](_0x338c7e);}catch(_0x38a72c){utils[_0xa219('0x14')](_0x38a72c);}});ami['on'](_0xa219('0x29'),function(_0x3a283e){try{dials[_0xa219('0x29')](_0x3a283e);}catch(_0x174dd7){utils[_0xa219('0x14')](_0x174dd7);}});ami['on'](_0xa219('0x2a'),function(_0x150bd8){try{dials[_0xa219('0x2a')](_0x150bd8);}catch(_0xebb7b){utils[_0xa219('0x14')](_0xebb7b);}});} \ No newline at end of file +var _0x18e6=['varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','username','asterisk','password','xdr','disabled','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer'];(function(_0x3452f0,_0x5d5806){var _0x2d33c7=function(_0x7ee104){while(--_0x7ee104){_0x3452f0['push'](_0x3452f0['shift']());}};_0x2d33c7(++_0x5d5806);}(_0x18e6,0x188));var _0x618e=function(_0x2b1088,_0x55b265){_0x2b1088=_0x2b1088-0x0;var _0x48c0e0=_0x18e6[_0x2b1088];return _0x48c0e0;};var AsteriskManager=require(_0x618e('0x0'));var config=require(_0x618e('0x1'));var utils=require(_0x618e('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x618e('0x3')],config['asterisk']['ip'],config['asterisk'][_0x618e('0x4')],config[_0x618e('0x5')][_0x618e('0x6')],!![]);ami['keepConnected']();if(config[_0x618e('0x7')]&&config[_0x618e('0x7')][_0x618e('0x8')]){utils[_0x618e('0x9')](_0x618e('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x618e('0xb'));var recordings=require(_0x618e('0xc'));var members=require(_0x618e('0xd'));var dials=require(_0x618e('0xe'));var transfers=require(_0x618e('0xf'));var core=require(_0x618e('0x10'));ami['on'](_0x618e('0x11'),core[_0x618e('0x11')]);ami['on']('shutdown',core[_0x618e('0x12')]);ami['on']('fullybooted',core[_0x618e('0x13')]);ami['on'](_0x618e('0x14'),core['error']);ami['on']('close',core[_0x618e('0x15')]);ami['on'](_0x618e('0x16'),core[_0x618e('0x16')]);ami['on'](_0x618e('0x17'),function(_0x5172e0){try{members[_0x618e('0x17')](_0x5172e0);}catch(_0x3f86a1){utils['error'](_0x3f86a1);}});ami['on'](_0x618e('0x18'),function(_0x1bcfb2){try{agents[_0x618e('0x18')](_0x1bcfb2);}catch(_0x35439e){utils['error'](_0x35439e);}});ami['on'](_0x618e('0x19'),function(_0x43c389){try{agents[_0x618e('0x19')](_0x43c389);}catch(_0x4af129){utils[_0x618e('0x14')](_0x4af129);}});ami['on'](_0x618e('0x1a'),function(_0x4fa532){try{agents['agentconnect'](_0x4fa532);queues[_0x618e('0x1a')](_0x4fa532);}catch(_0x27ceb3){utils['error'](_0x27ceb3);}});ami['on']('agentcomplete',function(_0x22a83b){try{agents[_0x618e('0x1b')](_0x22a83b);queues[_0x618e('0x1b')](_0x22a83b);members[_0x618e('0x1b')](_0x22a83b);}catch(_0x27d296){utils['error'](_0x27d296);}});ami['on'](_0x618e('0x1c'),function(_0x56a9c6){try{agents[_0x618e('0x1c')](_0x56a9c6);queues[_0x618e('0x1c')](_0x56a9c6);}catch(_0x1f034a){utils[_0x618e('0x14')](_0x1f034a);}});ami['on'](_0x618e('0x1d'),function(_0xa10e34){try{queues[_0x618e('0x1d')](_0xa10e34);recordings[_0x618e('0x1d')](_0xa10e34);}catch(_0x4011ef){utils['error'](_0x4011ef);}});ami['on'](_0x618e('0x1e'),function(_0x33ab1f){try{queues['queuecallerleave'](_0x33ab1f);}catch(_0x4fe86e){utils[_0x618e('0x14')](_0x4fe86e);}});ami['on'](_0x618e('0x1f'),function(_0x4793d0){try{queues[_0x618e('0x1f')](_0x4793d0);calls[_0x618e('0x1f')](_0x4793d0);}catch(_0x3b1b38){utils[_0x618e('0x14')](_0x3b1b38);}});ami['on'](_0x618e('0x20'),function(_0x5d5e70){try{queues['musiconholdstop'](_0x5d5e70);calls[_0x618e('0x20')](_0x5d5e70);}catch(_0x50ef30){utils[_0x618e('0x14')](_0x50ef30);}});ami['on'](_0x618e('0x21'),function(_0x176eee){try{calls['newstate'](_0x176eee);recordings[_0x618e('0x21')](_0x176eee);}catch(_0x579385){utils[_0x618e('0x14')](_0x579385);}});ami['on'](_0x618e('0x22'),function(_0x1d16eb){try{calls[_0x618e('0x22')](_0x1d16eb);recordings[_0x618e('0x22')](_0x1d16eb);dials[_0x618e('0x22')](_0x1d16eb);agents['hangup'](_0x1d16eb);queues['hangup'](_0x1d16eb);}catch(_0x351cd7){utils[_0x618e('0x14')](_0x351cd7);}});ami['on'](_0x618e('0x23'),function(_0xb6f6e4){try{members[_0x618e('0x23')](_0xb6f6e4);}catch(_0x59f56f){utils[_0x618e('0x14')](_0x59f56f);}});ami['on'](_0x618e('0x24'),function(_0x24df73){try{queues[_0x618e('0x24')](_0x24df73);agents['blindtransfer'](_0x24df73);transfers[_0x618e('0x24')](_0x24df73);}catch(_0x19ab68){utils[_0x618e('0x14')](_0x19ab68);}});ami['on'](_0x618e('0x25'),function(_0x56556a){try{queues[_0x618e('0x25')](_0x56556a);transfers['attendedtransfer'](_0x56556a);agents[_0x618e('0x25')](_0x56556a);calls[_0x618e('0x25')](_0x56556a);}catch(_0x5de623){utils[_0x618e('0x14')](_0x5de623);}});ami['on'](_0x618e('0x26'),function(_0x2a00aa){try{queues['varset'](_0x2a00aa);recordings[_0x618e('0x26')](_0x2a00aa);calls[_0x618e('0x26')](_0x2a00aa);dials[_0x618e('0x26')](_0x2a00aa);}catch(_0x34b61e){utils[_0x618e('0x14')](_0x34b61e);}});ami['on'](_0x618e('0x27'),function(_0x57da7c){try{calls[_0x618e('0x27')](_0x57da7c);recordings[_0x618e('0x27')](_0x57da7c);dials[_0x618e('0x27')](_0x57da7c);}catch(_0x4019af){utils['error'](_0x4019af);}});ami['on'](_0x618e('0x28'),function(_0x4d5a37){try{calls[_0x618e('0x28')](_0x4d5a37);recordings[_0x618e('0x28')](_0x4d5a37);}catch(_0x12945f){utils[_0x618e('0x14')](_0x12945f);}});ami['on'](_0x618e('0x29'),function(_0x102b82){try{dials[_0x618e('0x29')](_0x102b82);}catch(_0x5cf36e){utils[_0x618e('0x14')](_0x5cf36e);}});ami['on'](_0x618e('0x2a'),function(_0x3d35a8){try{dials[_0x618e('0x2a')](_0x3d35a8);}catch(_0x1b1df4){utils['error'](_0x1b1df4);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ad1f07b..cfd16c9 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 _0xc004=['device','voice','TALKING','now','agent','exitAt','duration','enterAt','uniqueid','agentcomplete','assign','queue','cdr','channel','isNil','data1','source','data3','destinationchannel','destination','lodash','util','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','some','devicestatechange','INUSE','BUSY'];(function(_0x5a7fca,_0x4afb87){var _0x594ec5=function(_0x1689f1){while(--_0x1689f1){_0x5a7fca['push'](_0x5a7fca['shift']());}};_0x594ec5(++_0x4afb87);}(_0xc004,0x15c));var _0x4c00=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0xc004[_0x5e6fe1];return _0x5a6018;};'use strict';var _=require(_0x4c00('0x0'));var util=require(_0x4c00('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x22234a){utils['info'](util[_0x4c00('0x2')](_0x4c00('0x3'),_0x22234a['uniqueid'],_0x22234a[_0x4c00('0x4')],_0x22234a['channel'],_0x22234a[_0x4c00('0x5')],_0x22234a[_0x4c00('0x6')],_0x22234a[_0x4c00('0x7')]));if(_0x22234a[_0x4c00('0x4')]){utils[_0x4c00('0x8')](_0x22234a['interface'])[_0x4c00('0x9')](function(_0x42d3f9){if(_0x42d3f9){_0x22234a[_0x4c00('0x6')]=_0x42d3f9[_0x4c00('0xa')];_0x22234a[_0x4c00('0xb')]=_0x42d3f9['internal'];utils[_0x4c00('0xc')](_0x4c00('0xd'),_0x22234a);}else{utils['getUserByName'](_0x22234a[_0x4c00('0x4')][_0x4c00('0xe')]('/')[0x1])[_0x4c00('0x9')](function(_0x5707dc){if(_0x5707dc){_0x22234a[_0x4c00('0x6')]=_0x5707dc[_0x4c00('0xa')];_0x22234a[_0x4c00('0xb')]=_0x5707dc[_0x4c00('0xb')];utils[_0x4c00('0xc')]('CreateMemberReport',_0x22234a);}});}})[_0x4c00('0xf')](function(_0x3a5161){utils[_0x4c00('0x10')](_0x3a5161);});}delete members[_0x22234a['interface']];}function startsWith(_0x151e2f,_0x47e064){return _[_0x4c00('0x11')](_0x151e2f,function(_0x4a6f0c){return _['startsWith'](_0x47e064,_0x4a6f0c);});}exports[_0x4c00('0x12')]=function(_0x23e781){switch(_0x23e781['state']){case _0x4c00('0x13'):case _0x4c00('0x14'):if(!startsWith(exclude,_0x23e781['device'])){members[_0x23e781[_0x4c00('0x15')]]={'channel':_0x4c00('0x16'),'interface':_0x23e781[_0x4c00('0x15')],'type':_0x4c00('0x17'),'enterAt':utils[_0x4c00('0x18')](),'role':_0x4c00('0x19')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x23e781[_0x4c00('0x15')]])){members[_0x23e781[_0x4c00('0x15')]][_0x4c00('0x1a')]=utils[_0x4c00('0x18')]();members[_0x23e781[_0x4c00('0x15')]][_0x4c00('0x1b')]=utils['diffTime'](members[_0x23e781['device']][_0x4c00('0x1a')],members[_0x23e781[_0x4c00('0x15')]][_0x4c00('0x1c')]);if(members[_0x23e781[_0x4c00('0x15')]][_0x4c00('0x1d')]){writeDB(members[_0x23e781[_0x4c00('0x15')]]);}}default:break;}};exports[_0x4c00('0x1e')]=function(_0x1cf1ff){if(!_['isNil'](members[_0x1cf1ff[_0x4c00('0x4')]])){members[_0x1cf1ff[_0x4c00('0x4')]]=_[_0x4c00('0x1f')](members[_0x1cf1ff[_0x4c00('0x4')]],{'data4':_0x1cf1ff[_0x4c00('0x20')],'uniqueid':_0x1cf1ff[_0x4c00('0x1d')]});}};exports[_0x4c00('0x21')]=function(_0x3ea269){if(_0x3ea269[_0x4c00('0x22')]){var _0x124cc1=_0x3ea269[_0x4c00('0x22')][_0x4c00('0xe')]('-')[0x0];if(!_[_0x4c00('0x23')](members[_0x124cc1])){members[_0x124cc1]=_[_0x4c00('0x1f')](members[_0x124cc1],{'data1':members[_0x124cc1][_0x4c00('0x24')]||_0x3ea269[_0x4c00('0x7')],'data2':members[_0x124cc1][_0x4c00('0x5')]||_0x3ea269[_0x4c00('0x25')],'data3':members[_0x124cc1][_0x4c00('0x26')]||_0x3ea269['destination'],'uniqueid':members[_0x124cc1][_0x4c00('0x1d')]||_0x3ea269[_0x4c00('0x1d')]});if(members[_0x124cc1]['exitAt']){writeDB(members[_0x124cc1]);}}}if(_0x3ea269[_0x4c00('0x27')]){var _0x1c6ba5=_0x3ea269[_0x4c00('0x27')][_0x4c00('0xe')]('-')[0x0];if(!_[_0x4c00('0x23')](members[_0x1c6ba5])){members[_0x1c6ba5]=_[_0x4c00('0x1f')](members[_0x1c6ba5],{'data1':members[_0x1c6ba5][_0x4c00('0x24')]||_0x3ea269['type'],'data2':members[_0x1c6ba5]['data2']||_0x3ea269[_0x4c00('0x25')],'data3':members[_0x1c6ba5][_0x4c00('0x26')]||_0x3ea269[_0x4c00('0x28')],'uniqueid':members[_0x1c6ba5][_0x4c00('0x1d')]||_0x3ea269[_0x4c00('0x1d')]});if(members[_0x1c6ba5][_0x4c00('0x1a')]){writeDB(members[_0x1c6ba5]);}}}}; \ No newline at end of file +var _0xd91c=['data2','membername','type','interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','some','startsWith','devicestatechange','state','INUSE','BUSY','device','TALKING','now','agent','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','assign','queue','cdr','channel','data1','source','data3','destinationchannel','Local/_attended@transfer','Queue:','format','uniqueid'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xd91c,0x7a));var _0xcd91=function(_0x3bfe49,_0x52979){_0x3bfe49=_0x3bfe49-0x0;var _0x153323=_0xd91c[_0x3bfe49];return _0x153323;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xcd91('0x0'),_0xcd91('0x1')];function writeDB(_0x37d6dd){utils['info'](util[_0xcd91('0x2')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x37d6dd[_0xcd91('0x3')],_0x37d6dd['interface'],_0x37d6dd['channel'],_0x37d6dd[_0xcd91('0x4')],_0x37d6dd[_0xcd91('0x5')],_0x37d6dd[_0xcd91('0x6')]));if(_0x37d6dd[_0xcd91('0x7')]){utils[_0xcd91('0x8')](_0x37d6dd[_0xcd91('0x7')])['then'](function(_0x5eba80){if(_0x5eba80){_0x37d6dd['membername']=_0x5eba80[_0xcd91('0x9')];_0x37d6dd[_0xcd91('0xa')]=_0x5eba80[_0xcd91('0xa')];utils[_0xcd91('0xb')](_0xcd91('0xc'),_0x37d6dd);}else{utils[_0xcd91('0xd')](_0x37d6dd[_0xcd91('0x7')][_0xcd91('0xe')]('/')[0x1])[_0xcd91('0xf')](function(_0x35fd5a){if(_0x35fd5a){_0x37d6dd[_0xcd91('0x5')]=_0x35fd5a[_0xcd91('0x9')];_0x37d6dd[_0xcd91('0xa')]=_0x35fd5a[_0xcd91('0xa')];utils['request']('CreateMemberReport',_0x37d6dd);}});}})[_0xcd91('0x10')](function(_0x297d55){utils[_0xcd91('0x11')](_0x297d55);});}delete members[_0x37d6dd['interface']];}function startsWith(_0x394128,_0x4b24b4){return _[_0xcd91('0x12')](_0x394128,function(_0x59255d){return _[_0xcd91('0x13')](_0x4b24b4,_0x59255d);});}exports[_0xcd91('0x14')]=function(_0x380df5){switch(_0x380df5[_0xcd91('0x15')]){case _0xcd91('0x16'):case _0xcd91('0x17'):if(!startsWith(exclude,_0x380df5[_0xcd91('0x18')])){members[_0x380df5['device']]={'channel':'voice','interface':_0x380df5['device'],'type':_0xcd91('0x19'),'enterAt':utils[_0xcd91('0x1a')](),'role':_0xcd91('0x1b')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x380df5[_0xcd91('0x18')]])){members[_0x380df5[_0xcd91('0x18')]][_0xcd91('0x1c')]=utils['now']();members[_0x380df5[_0xcd91('0x18')]][_0xcd91('0x1d')]=utils[_0xcd91('0x1e')](members[_0x380df5['device']][_0xcd91('0x1c')],members[_0x380df5['device']][_0xcd91('0x1f')]);if(members[_0x380df5['device']][_0xcd91('0x3')]){writeDB(members[_0x380df5[_0xcd91('0x18')]]);}}default:break;}};exports[_0xcd91('0x20')]=function(_0x975642){if(!_[_0xcd91('0x21')](members[_0x975642[_0xcd91('0x7')]])){members[_0x975642[_0xcd91('0x7')]]=_[_0xcd91('0x22')](members[_0x975642[_0xcd91('0x7')]],{'data4':_0x975642[_0xcd91('0x23')],'uniqueid':_0x975642[_0xcd91('0x3')]});}};exports[_0xcd91('0x24')]=function(_0x892cef){if(_0x892cef['channel']){var _0x28f042=_0x892cef[_0xcd91('0x25')][_0xcd91('0xe')]('-')[0x0];if(!_[_0xcd91('0x21')](members[_0x28f042])){members[_0x28f042]=_['assign'](members[_0x28f042],{'data1':members[_0x28f042][_0xcd91('0x26')]||_0x892cef['type'],'data2':members[_0x28f042][_0xcd91('0x4')]||_0x892cef[_0xcd91('0x27')],'data3':members[_0x28f042][_0xcd91('0x28')]||_0x892cef['destination'],'uniqueid':members[_0x28f042][_0xcd91('0x3')]||_0x892cef[_0xcd91('0x3')]});if(members[_0x28f042][_0xcd91('0x1c')]){writeDB(members[_0x28f042]);}}}if(_0x892cef[_0xcd91('0x29')]){var _0x425868=_0x892cef['destinationchannel']['split']('-')[0x0];if(!_[_0xcd91('0x21')](members[_0x425868])){members[_0x425868]=_[_0xcd91('0x22')](members[_0x425868],{'data1':members[_0x425868][_0xcd91('0x26')]||_0x892cef['type'],'data2':members[_0x425868]['data2']||_0x892cef[_0xcd91('0x27')],'data3':members[_0x425868][_0xcd91('0x28')]||_0x892cef['destination'],'uniqueid':members[_0x425868][_0xcd91('0x3')]||_0x892cef['uniqueid']});if(members[_0x425868][_0xcd91('0x1c')]){writeDB(members[_0x425868]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b0fb62a..c47c304 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 _0xe926=['membername','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstartAt','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','variable','toUpperCase','queuecallerexit','queuecallerexitAt','queuecallerexitreason','value','queueposition','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','agentcomplete','queuecallerabandonAt'];(function(_0xd39f36,_0x10604c){var _0x36b99e=function(_0x5ab0dd){while(--_0x5ab0dd){_0xd39f36['push'](_0xd39f36['shift']());}};_0x36b99e(++_0x10604c);}(_0xe926,0x151));var _0x6e92=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe926[_0x39d544];return _0x5a5ff2;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0xfd2bb1){utils[_0x6e92('0x0')](util[_0x6e92('0x1')](_0x6e92('0x2'),_0xfd2bb1[_0x6e92('0x3')],_0xfd2bb1[_0x6e92('0x4')],_0xfd2bb1[_0x6e92('0x5')],_0xfd2bb1['lastAssignedTo'],_0xfd2bb1['calleridnum'],_0xfd2bb1['accountcode'],_0xfd2bb1['queuecallerexitreason']));if(_0xfd2bb1[_0x6e92('0x5')]){utils[_0x6e92('0x6')](_0xfd2bb1[_0x6e92('0x5')])[_0x6e92('0x7')](function(_0x49cf56){if(_0x49cf56){_0xfd2bb1[_0x6e92('0x8')]=_0x49cf56[_0x6e92('0x8')];}utils['request'](_0x6e92('0x9'),_0xfd2bb1);});}else{utils[_0x6e92('0xa')](_0x6e92('0x9'),_0xfd2bb1);}if(_0xfd2bb1[_0x6e92('0xb')]){delete queues[_0xfd2bb1['transfereduniqueid']];}else{delete queues[_0xfd2bb1[_0x6e92('0x3')]];}}exports[_0x6e92('0xc')]=function(_0x4874fd){queues[_0x4874fd[_0x6e92('0x3')]]=_[_0x6e92('0xd')](_0x4874fd,{'originalposition':_0x4874fd[_0x6e92('0xe')],'queuecallerjoinAt':utils[_0x6e92('0xf')](),'mohtime':0x0});};exports[_0x6e92('0x10')]=function(_0x1dc14f){if(!_[_0x6e92('0x11')](queues[_0x1dc14f[_0x6e92('0x3')]])){if(queues[_0x1dc14f[_0x6e92('0x3')]][_0x6e92('0x12')]){if(!queues[_0x1dc14f[_0x6e92('0x3')]][_0x6e92('0x13')]&&!queues[_0x1dc14f[_0x6e92('0x3')]]['queuecallerexit']){queues[_0x1dc14f[_0x6e92('0x3')]]['queuecallercomplete']=!![];queues[_0x1dc14f[_0x6e92('0x3')]][_0x6e92('0x14')]=utils[_0x6e92('0xf')]();queues[_0x1dc14f['uniqueid']]['queuecallerexitreason']=_0x6e92('0x15');}writeDB(queues[_0x1dc14f[_0x6e92('0x3')]]);}else{if(queues[_0x1dc14f[_0x6e92('0x3')]][_0x6e92('0xb')]){queues[queues[_0x1dc14f[_0x6e92('0x3')]]['transfereduniqueid']]=queues[_0x1dc14f[_0x6e92('0x3')]];queues[queues[_0x1dc14f[_0x6e92('0x3')]][_0x6e92('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x1dc14f[_0x6e92('0x3')]];}}}};exports['varset']=function(_0x3b4f53){if(!_[_0x6e92('0x11')](_0x3b4f53[_0x6e92('0x16')]['queuestatus'])&&_0x3b4f53['value'][_0x6e92('0x17')]()!=='CONTINUE'){if(!_[_0x6e92('0x11')](queues[_0x3b4f53['uniqueid']])){queues[_0x3b4f53[_0x6e92('0x3')]][_0x6e92('0x13')]=![];queues[_0x3b4f53['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3b4f53['uniqueid']][_0x6e92('0x18')]=!![];queues[_0x3b4f53[_0x6e92('0x3')]][_0x6e92('0x19')]=utils[_0x6e92('0xf')]();queues[_0x3b4f53[_0x6e92('0x3')]][_0x6e92('0x1a')]=_0x3b4f53[_0x6e92('0x1b')][_0x6e92('0x17')]();writeDB(queues[_0x3b4f53[_0x6e92('0x3')]]);}}else if(!_[_0x6e92('0x11')](_0x3b4f53[_0x6e92('0x16')][_0x6e92('0x1c')])){if(!_[_0x6e92('0x11')](queues[_0x3b4f53['uniqueid']])&&!queues[_0x3b4f53['uniqueid']][_0x6e92('0x13')]){queues[_0x3b4f53['uniqueid']][_0x6e92('0x13')]=![];queues[_0x3b4f53[_0x6e92('0x3')]]['queuecallerabandonAt']=null;queues[_0x3b4f53[_0x6e92('0x3')]]['queuecallerexit']=!![];queues[_0x3b4f53[_0x6e92('0x3')]][_0x6e92('0x19')]=utils[_0x6e92('0xf')]();queues[_0x3b4f53[_0x6e92('0x3')]]['queuecallerexitreason']=_0x6e92('0x1d');}}};exports[_0x6e92('0x13')]=function(_0xad4b8a){if(!_[_0x6e92('0x11')](queues[_0xad4b8a[_0x6e92('0x3')]])){queues[_0xad4b8a[_0x6e92('0x3')]]['queuecallerexit']=![];queues[_0xad4b8a[_0x6e92('0x3')]][_0x6e92('0x19')]=null;queues[_0xad4b8a['uniqueid']][_0x6e92('0x13')]=!![];queues[_0xad4b8a[_0x6e92('0x3')]]['queuecallerabandonAt']=utils[_0x6e92('0xf')]();queues[_0xad4b8a['uniqueid']][_0x6e92('0x1a')]='ABANDONED';}};exports[_0x6e92('0x1e')]=function(_0x46d9b8){if(!_[_0x6e92('0x11')](queues[_0x46d9b8['uniqueid']])){queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0x1e')]=!![];queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0x12')]=utils[_0x6e92('0xf')]();queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0x1f')]=utils[_0x6e92('0x20')](queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0x12')],queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0x21')]);queues[_0x46d9b8[_0x6e92('0x3')]][_0x6e92('0xe')]=_0x46d9b8[_0x6e92('0xe')];queues[_0x46d9b8['uniqueid']]['count']=_0x46d9b8['count'];queues[_0x46d9b8['uniqueid']][_0x6e92('0x22')]=_0x46d9b8[_0x6e92('0x22')];queues[_0x46d9b8[_0x6e92('0x3')]]['connectedlinename']=_0x46d9b8[_0x6e92('0x23')];}};exports[_0x6e92('0x24')]=function(_0x153bd1){if(!_[_0x6e92('0x11')](queues[_0x153bd1['uniqueid']])){queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x13')]=![];queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x13')]=![];queues[_0x153bd1[_0x6e92('0x3')]]['queuecallerabandonAt']=null;queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x18')]=![];queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x1a')]=null;queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x19')]=null;queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x25')]=!![];queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x26')]=_0x153bd1[_0x6e92('0x27')];queues[_0x153bd1[_0x6e92('0x3')]][_0x6e92('0x28')]=_0x153bd1['membername'];}};exports[_0x6e92('0x29')]=function(_0x3b0868){if(!_[_0x6e92('0x11')](queues[_0x3b0868[_0x6e92('0x3')]])){if(queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x12')]){queues[_0x3b0868[_0x6e92('0x3')]]['queuecallerabandon']=![];queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x13')]=![];queues[_0x3b0868['uniqueid']][_0x6e92('0x2a')]=null;queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x18')]=![];queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x19')]=null;queues[_0x3b0868[_0x6e92('0x3')]]['assigned']=!![];queues[_0x3b0868['uniqueid']][_0x6e92('0x28')]=_0x3b0868[_0x6e92('0x2b')];queues[_0x3b0868[_0x6e92('0x3')]]['queuecallercomplete']=!![];queues[_0x3b0868['uniqueid']][_0x6e92('0x14')]=utils[_0x6e92('0xf')]();if(_0x3b0868[_0x6e92('0x2c')]==_0x6e92('0x2d')){if(!queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x2d')]){queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x1a')]=_0x6e92('0x2e');}}else{queues[_0x3b0868[_0x6e92('0x3')]][_0x6e92('0x1a')]=_0x6e92('0x2f')+_0x3b0868[_0x6e92('0x2c')][_0x6e92('0x17')]();}writeDB(queues[_0x3b0868[_0x6e92('0x3')]]);}}};exports[_0x6e92('0x30')]=function(_0x17ac61){if(!_[_0x6e92('0x11')](queues[_0x17ac61['transfereeuniqueid']])){queues[_0x17ac61[_0x6e92('0x31')]][_0x6e92('0x2d')]=!![];queues[_0x17ac61['transfereeuniqueid']][_0x6e92('0x32')]=_0x6e92('0x33');queues[_0x17ac61[_0x6e92('0x31')]][_0x6e92('0x34')]=_0x17ac61[_0x6e92('0x35')];queues[_0x17ac61['transfereeuniqueid']]['transferuniqueid']=_0x17ac61['transfereeuniqueid'];queues[_0x17ac61[_0x6e92('0x31')]][_0x6e92('0x1a')]=_0x6e92('0x36');}};exports[_0x6e92('0x37')]=function(_0x169f42){try{if(_0x169f42[_0x6e92('0x38')]==_0x169f42[_0x6e92('0x39')]){if(!_[_0x6e92('0x11')](queues[_0x169f42[_0x6e92('0x3a')]])){queues[_0x169f42[_0x6e92('0x3a')]]['transfer']=!![];queues[_0x169f42['secondtransfererlinkedid']][_0x6e92('0x32')]='ATTENDED';queues[_0x169f42[_0x6e92('0x3a')]][_0x6e92('0x34')]=_0x169f42[_0x6e92('0x3b')];queues[_0x169f42[_0x6e92('0x3a')]][_0x6e92('0x3c')]=_0x169f42['origtransfereruniqueid'];queues[_0x169f42[_0x6e92('0x3a')]][_0x6e92('0x1a')]=_0x6e92('0x3d');}if(!_[_0x6e92('0x11')](queues[_0x169f42[_0x6e92('0x39')]])){if(_0x169f42['transfereelinkedid']&&queues[_0x169f42[_0x6e92('0x3e')]]){queues[_0x169f42[_0x6e92('0x3e')]][_0x6e92('0x3f')]=0x1;queues[_0x169f42[_0x6e92('0x31')]]=_[_0x6e92('0x40')](queues[_0x169f42[_0x6e92('0x3e')]]);queues[_0x169f42[_0x6e92('0x31')]][_0x6e92('0xb')]=_0x169f42[_0x6e92('0x41')];queues[_0x169f42['transfereeuniqueid']][_0x6e92('0x3f')]=0x2;queues[_0x169f42[_0x6e92('0x31')]][_0x6e92('0x42')]=queues[_0x169f42[_0x6e92('0x3a')]][_0x6e92('0x42')];queues[_0x169f42['transfereeuniqueid']][_0x6e92('0x43')]=queues[_0x169f42[_0x6e92('0x3a')]][_0x6e92('0x43')];queues[_0x169f42[_0x6e92('0x31')]][_0x6e92('0x21')]=utils[_0x6e92('0xf')]();queues[_0x169f42['transfereeuniqueid']][_0x6e92('0x12')]=utils[_0x6e92('0xf')]();queues[_0x169f42[_0x6e92('0x31')]]['holdtime']=0x0;queues[_0x169f42['transfereeuniqueid']][_0x6e92('0x44')]=0x0;}else{queues[_0x169f42['origtransfererlinkedid']]['transfereduniqueid']=_0x169f42[_0x6e92('0x3a')];}}}else if(_0x169f42[_0x6e92('0x45')]==_0x169f42[_0x6e92('0x3a')]){if(!_['isNil'](queues[_0x169f42['origtransfererlinkedid']])){queues[_0x169f42['origtransfererlinkedid']]['transfer']=!![];queues[_0x169f42['origtransfererlinkedid']]['transfertype']=_0x6e92('0x46');queues[_0x169f42[_0x6e92('0x39')]][_0x6e92('0x34')]=_0x169f42[_0x6e92('0x47')];queues[_0x169f42[_0x6e92('0x39')]][_0x6e92('0x3c')]=_0x169f42[_0x6e92('0x45')];queues[_0x169f42['origtransfererlinkedid']][_0x6e92('0x1a')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x169f42[_0x6e92('0x3a')]])){if(_0x169f42[_0x6e92('0x48')]&&queues[_0x169f42[_0x6e92('0x48')]]){queues[_0x169f42[_0x6e92('0x48')]]['queuecallerenterreason']=0x1;queues[_0x169f42[_0x6e92('0x41')]]=_[_0x6e92('0x40')](queues[_0x169f42[_0x6e92('0x48')]]);queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0xb')]=_0x169f42[_0x6e92('0x41')];queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x3f')]=0x2;queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x42')]=queues[_0x169f42[_0x6e92('0x39')]][_0x6e92('0x42')];queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x43')]=queues[_0x169f42[_0x6e92('0x39')]][_0x6e92('0x43')];queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x21')]=utils[_0x6e92('0xf')]();queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x12')]=utils[_0x6e92('0xf')]();queues[_0x169f42[_0x6e92('0x41')]][_0x6e92('0x1f')]=0x0;queues[_0x169f42['transfertargetuniqueid']][_0x6e92('0x44')]=0x0;}else{queues[_0x169f42['secondtransfererlinkedid']]['transfereduniqueid']=_0x169f42[_0x6e92('0x39')];}}}}catch(_0x11c53b){utils[_0x6e92('0x49')](_0x11c53b['stack']);}};exports[_0x6e92('0x4a')]=function(_0x5e10d6){if(!_[_0x6e92('0x11')](queues[_0x5e10d6['uniqueid']])){queues[_0x5e10d6[_0x6e92('0x3')]][_0x6e92('0x4b')]=utils[_0x6e92('0xf')]();}};exports['musiconholdstop']=function(_0x8514fb){if(!_[_0x6e92('0x11')](queues[_0x8514fb[_0x6e92('0x3')]])){if(!_[_0x6e92('0x11')](queues[_0x8514fb[_0x6e92('0x3')]]['musiconholdstartAt'])){queues[_0x8514fb[_0x6e92('0x3')]]['mohtime']+=utils[_0x6e92('0x20')](utils['now'](),queues[_0x8514fb[_0x6e92('0x3')]][_0x6e92('0x4b')]);delete queues[_0x8514fb[_0x6e92('0x3')]][_0x6e92('0x4b')];}}}; \ No newline at end of file +var _0x59c1=['diffTime','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','now','hangup','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','varset','value','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','queuecallerleave','holdtime','queuecallerleaveAt','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','queuecallercomplete','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfereruniqueid','transfereelinkedid','queuecallerenterreason','clone','calleridname','mohtime','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','stack','musiconholdstart','musiconholdstartAt','musiconholdstop'];(function(_0x2a82bb,_0x1aa9aa){var _0x29f4b0=function(_0x5937d7){while(--_0x5937d7){_0x2a82bb['push'](_0x2a82bb['shift']());}};_0x29f4b0(++_0x1aa9aa);}(_0x59c1,0x18c));var _0x159c=function(_0x4375dc,_0x1a24a7){_0x4375dc=_0x4375dc-0x0;var _0xc14e80=_0x59c1[_0x4375dc];return _0xc14e80;};'use strict';var _=require(_0x159c('0x0'));var util=require(_0x159c('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4c340a){utils[_0x159c('0x2')](util[_0x159c('0x3')](_0x159c('0x4'),_0x4c340a[_0x159c('0x5')],_0x4c340a[_0x159c('0x6')],_0x4c340a[_0x159c('0x7')],_0x4c340a[_0x159c('0x8')],_0x4c340a[_0x159c('0x9')],_0x4c340a[_0x159c('0xa')],_0x4c340a['queuecallerexitreason']));if(_0x4c340a[_0x159c('0x7')]){utils[_0x159c('0xb')](_0x4c340a[_0x159c('0x7')])[_0x159c('0xc')](function(_0x44461d){if(_0x44461d){_0x4c340a[_0x159c('0xd')]=_0x44461d['type'];}utils['request'](_0x159c('0xe'),_0x4c340a);});}else{utils[_0x159c('0xf')](_0x159c('0xe'),_0x4c340a);}if(_0x4c340a[_0x159c('0x10')]){delete queues[_0x4c340a[_0x159c('0x10')]];}else{delete queues[_0x4c340a[_0x159c('0x5')]];}}exports[_0x159c('0x11')]=function(_0x521e55){queues[_0x521e55['uniqueid']]=_['assign'](_0x521e55,{'originalposition':_0x521e55['position'],'queuecallerjoinAt':utils[_0x159c('0x12')](),'mohtime':0x0});};exports[_0x159c('0x13')]=function(_0x3b5a0a){if(!_['isNil'](queues[_0x3b5a0a[_0x159c('0x5')]])){if(queues[_0x3b5a0a[_0x159c('0x5')]]['queuecallerleaveAt']){if(!queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x14')]&&!queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x15')]){queues[_0x3b5a0a[_0x159c('0x5')]]['queuecallercomplete']=!![];queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x16')]=utils[_0x159c('0x12')]();queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x17')]=_0x159c('0x18');}writeDB(queues[_0x3b5a0a[_0x159c('0x5')]]);}else{if(queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x10')]){queues[queues[_0x3b5a0a[_0x159c('0x5')]][_0x159c('0x10')]]=queues[_0x3b5a0a[_0x159c('0x5')]];queues[queues[_0x3b5a0a['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x3b5a0a['uniqueid']];}}}};exports[_0x159c('0x19')]=function(_0x33f904){if(!_['isNil'](_0x33f904['variable']['queuestatus'])&&_0x33f904[_0x159c('0x1a')][_0x159c('0x1b')]()!==_0x159c('0x1c')){if(!_[_0x159c('0x1d')](queues[_0x33f904[_0x159c('0x5')]])){queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x14')]=![];queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x1e')]=null;queues[_0x33f904['uniqueid']]['queuecallerexit']=!![];queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x1f')]=utils['now']();queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x17')]=_0x33f904[_0x159c('0x1a')][_0x159c('0x1b')]();writeDB(queues[_0x33f904['uniqueid']]);}}else if(!_['isNil'](_0x33f904[_0x159c('0x20')][_0x159c('0x21')])){if(!_[_0x159c('0x1d')](queues[_0x33f904['uniqueid']])&&!queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x14')]){queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x14')]=![];queues[_0x33f904['uniqueid']][_0x159c('0x1e')]=null;queues[_0x33f904[_0x159c('0x5')]]['queuecallerexit']=!![];queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x1f')]=utils[_0x159c('0x12')]();queues[_0x33f904[_0x159c('0x5')]][_0x159c('0x17')]=_0x159c('0x22');}}};exports[_0x159c('0x14')]=function(_0x4d516a){if(!_[_0x159c('0x1d')](queues[_0x4d516a[_0x159c('0x5')]])){queues[_0x4d516a[_0x159c('0x5')]][_0x159c('0x15')]=![];queues[_0x4d516a['uniqueid']][_0x159c('0x1f')]=null;queues[_0x4d516a[_0x159c('0x5')]]['queuecallerabandon']=!![];queues[_0x4d516a[_0x159c('0x5')]][_0x159c('0x1e')]=utils[_0x159c('0x12')]();queues[_0x4d516a[_0x159c('0x5')]][_0x159c('0x17')]='ABANDONED';}};exports[_0x159c('0x23')]=function(_0xabbbc3){if(!_[_0x159c('0x1d')](queues[_0xabbbc3[_0x159c('0x5')]])){queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x23')]=!![];queues[_0xabbbc3[_0x159c('0x5')]]['queuecallerleaveAt']=utils[_0x159c('0x12')]();queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x24')]=utils['diffTime'](queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x25')],queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x26')]);queues[_0xabbbc3[_0x159c('0x5')]]['position']=_0xabbbc3[_0x159c('0x27')];queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x28')]=_0xabbbc3[_0x159c('0x28')];queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x29')]=_0xabbbc3[_0x159c('0x29')];queues[_0xabbbc3[_0x159c('0x5')]][_0x159c('0x2a')]=_0xabbbc3[_0x159c('0x2a')];}};exports[_0x159c('0x2b')]=function(_0x1d86e6){if(!_['isNil'](queues[_0x1d86e6[_0x159c('0x5')]])){queues[_0x1d86e6[_0x159c('0x5')]][_0x159c('0x14')]=![];queues[_0x1d86e6['uniqueid']]['queuecallerabandon']=![];queues[_0x1d86e6['uniqueid']][_0x159c('0x1e')]=null;queues[_0x1d86e6[_0x159c('0x5')]][_0x159c('0x15')]=![];queues[_0x1d86e6[_0x159c('0x5')]]['queuecallerexitreason']=null;queues[_0x1d86e6['uniqueid']][_0x159c('0x1f')]=null;queues[_0x1d86e6[_0x159c('0x5')]][_0x159c('0x2c')]=!![];queues[_0x1d86e6[_0x159c('0x5')]][_0x159c('0xa')]=_0x1d86e6[_0x159c('0x2d')];queues[_0x1d86e6['uniqueid']]['lastAssignedTo']=_0x1d86e6[_0x159c('0x2e')];}};exports[_0x159c('0x2f')]=function(_0x2de106){if(!_[_0x159c('0x1d')](queues[_0x2de106[_0x159c('0x5')]])){if(queues[_0x2de106['uniqueid']][_0x159c('0x25')]){queues[_0x2de106['uniqueid']][_0x159c('0x14')]=![];queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x14')]=![];queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x1e')]=null;queues[_0x2de106[_0x159c('0x5')]]['queuecallerexit']=![];queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x1f')]=null;queues[_0x2de106['uniqueid']][_0x159c('0x2c')]=!![];queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x8')]=_0x2de106[_0x159c('0x2e')];queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x30')]=!![];queues[_0x2de106['uniqueid']][_0x159c('0x16')]=utils[_0x159c('0x12')]();if(_0x2de106['reason']==_0x159c('0x31')){if(!queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x31')]){queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x17')]=_0x159c('0x32');}}else{queues[_0x2de106[_0x159c('0x5')]][_0x159c('0x17')]='COMPLETEDBY'+_0x2de106['reason'][_0x159c('0x1b')]();}writeDB(queues[_0x2de106[_0x159c('0x5')]]);}}};exports[_0x159c('0x33')]=function(_0x3459e9){if(!_[_0x159c('0x1d')](queues[_0x3459e9[_0x159c('0x34')]])){queues[_0x3459e9['transfereeuniqueid']][_0x159c('0x31')]=!![];queues[_0x3459e9['transfereeuniqueid']][_0x159c('0x35')]=_0x159c('0x36');queues[_0x3459e9[_0x159c('0x34')]][_0x159c('0x37')]=_0x3459e9[_0x159c('0x38')];queues[_0x3459e9[_0x159c('0x34')]][_0x159c('0x39')]=_0x3459e9[_0x159c('0x34')];queues[_0x3459e9[_0x159c('0x34')]][_0x159c('0x17')]=_0x159c('0x3a');}};exports[_0x159c('0x3b')]=function(_0x41f123){try{if(_0x41f123['origtransfereruniqueid']==_0x41f123[_0x159c('0x3c')]){if(!_[_0x159c('0x1d')](queues[_0x41f123['secondtransfererlinkedid']])){queues[_0x41f123[_0x159c('0x3d')]]['transfer']=!![];queues[_0x41f123[_0x159c('0x3d')]][_0x159c('0x35')]=_0x159c('0x3e');queues[_0x41f123['secondtransfererlinkedid']][_0x159c('0x37')]=_0x41f123['origtransfererexten'];queues[_0x41f123[_0x159c('0x3d')]][_0x159c('0x39')]=_0x41f123[_0x159c('0x3f')];queues[_0x41f123[_0x159c('0x3d')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x159c('0x1d')](queues[_0x41f123[_0x159c('0x3c')]])){if(_0x41f123[_0x159c('0x40')]&&queues[_0x41f123[_0x159c('0x40')]]){queues[_0x41f123[_0x159c('0x40')]][_0x159c('0x41')]=0x1;queues[_0x41f123[_0x159c('0x34')]]=_[_0x159c('0x42')](queues[_0x41f123[_0x159c('0x40')]]);queues[_0x41f123['transfereeuniqueid']][_0x159c('0x10')]=_0x41f123['transfertargetuniqueid'];queues[_0x41f123[_0x159c('0x34')]]['queuecallerenterreason']=0x2;queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x9')]=queues[_0x41f123[_0x159c('0x3d')]]['calleridnum'];queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x43')]=queues[_0x41f123['secondtransfererlinkedid']][_0x159c('0x43')];queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x26')]=utils[_0x159c('0x12')]();queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x25')]=utils[_0x159c('0x12')]();queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x24')]=0x0;queues[_0x41f123[_0x159c('0x34')]][_0x159c('0x44')]=0x0;}else{queues[_0x41f123[_0x159c('0x3c')]][_0x159c('0x10')]=_0x41f123['secondtransfererlinkedid'];}}}else if(_0x41f123['secondtransfereruniqueid']==_0x41f123['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x41f123[_0x159c('0x3c')]])){queues[_0x41f123[_0x159c('0x3c')]]['transfer']=!![];queues[_0x41f123[_0x159c('0x3c')]][_0x159c('0x35')]=_0x159c('0x3e');queues[_0x41f123['origtransfererlinkedid']][_0x159c('0x37')]=_0x41f123[_0x159c('0x45')];queues[_0x41f123[_0x159c('0x3c')]][_0x159c('0x39')]=_0x41f123[_0x159c('0x46')];queues[_0x41f123[_0x159c('0x3c')]][_0x159c('0x17')]=_0x159c('0x47');}if(!_[_0x159c('0x1d')](queues[_0x41f123[_0x159c('0x3d')]])){if(_0x41f123[_0x159c('0x48')]&&queues[_0x41f123[_0x159c('0x48')]]){queues[_0x41f123[_0x159c('0x48')]][_0x159c('0x41')]=0x1;queues[_0x41f123[_0x159c('0x49')]]=_[_0x159c('0x42')](queues[_0x41f123[_0x159c('0x48')]]);queues[_0x41f123['transfertargetuniqueid']]['transfereduniqueid']=_0x41f123['transfertargetuniqueid'];queues[_0x41f123['transfertargetuniqueid']][_0x159c('0x41')]=0x2;queues[_0x41f123[_0x159c('0x49')]][_0x159c('0x9')]=queues[_0x41f123[_0x159c('0x3c')]]['calleridnum'];queues[_0x41f123['transfertargetuniqueid']][_0x159c('0x43')]=queues[_0x41f123[_0x159c('0x3c')]][_0x159c('0x43')];queues[_0x41f123[_0x159c('0x49')]][_0x159c('0x26')]=utils[_0x159c('0x12')]();queues[_0x41f123[_0x159c('0x49')]][_0x159c('0x25')]=utils[_0x159c('0x12')]();queues[_0x41f123[_0x159c('0x49')]]['holdtime']=0x0;queues[_0x41f123[_0x159c('0x49')]]['mohtime']=0x0;}else{queues[_0x41f123[_0x159c('0x3d')]][_0x159c('0x10')]=_0x41f123[_0x159c('0x3c')];}}}}catch(_0x489679){utils['error'](_0x489679[_0x159c('0x4a')]);}};exports[_0x159c('0x4b')]=function(_0x46c3d3){if(!_[_0x159c('0x1d')](queues[_0x46c3d3['uniqueid']])){queues[_0x46c3d3['uniqueid']][_0x159c('0x4c')]=utils[_0x159c('0x12')]();}};exports[_0x159c('0x4d')]=function(_0x269fdd){if(!_[_0x159c('0x1d')](queues[_0x269fdd['uniqueid']])){if(!_['isNil'](queues[_0x269fdd['uniqueid']]['musiconholdstartAt'])){queues[_0x269fdd['uniqueid']]['mohtime']+=utils[_0x159c('0x4e')](utils[_0x159c('0x12')](),queues[_0x269fdd[_0x159c('0x5')]][_0x159c('0x4c')]);delete queues[_0x269fdd['uniqueid']][_0x159c('0x4c')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a8ceab2..b786550 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 _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0xe6843b,_0x294125){var _0x28f3a1=function(_0x5153b4){while(--_0x5153b4){_0xe6843b['push'](_0xe6843b['shift']());}};_0x28f3a1(++_0x294125);}(_0xe706,0xa3));var _0x6e70=function(_0x204e52,_0x1d553a){_0x204e52=_0x204e52-0x0;var _0xe5dd25=_0xe706[_0x204e52];return _0xe5dd25;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ 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(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x008c,0x188));var _0xc008=function(_0x52cc68,_0x440163){_0x52cc68=_0x52cc68-0x0;var _0x572cd4=_0x008c[_0x52cc68];return _0x572cd4;};'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 00589d6..1608ba6 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 _0x1801=['lodash','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','error','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','stack'];(function(_0xa3b7c1,_0x37a6b5){var _0xecf0f0=function(_0x3c7a0f){while(--_0x3c7a0f){_0xa3b7c1['push'](_0xa3b7c1['shift']());}};_0xecf0f0(++_0x37a6b5);}(_0x1801,0xc6));var _0x1180=function(_0x12b401,_0x252519){_0x12b401=_0x12b401-0x0;var _0xbfe938=_0x1801[_0x12b401];return _0xbfe938;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var utils=require(_0x1180('0x2'));function writeDB(_0x1db775){utils[_0x1180('0x3')](util[_0x1180('0x4')](_0x1180('0x5'),_0x1db775[_0x1180('0x6')]));utils[_0x1180('0x7')](_0x1180('0x8'),_0x1db775);}exports[_0x1180('0x9')]=function(_0x16cdc8){try{_0x16cdc8[_0x1180('0x6')]='blind';writeDB(_0x16cdc8);}catch(_0x2f12f5){utils[_0x1180('0xa')](_0x2f12f5['stack']);}};exports['attendedtransfer']=function(_0x2b74b0){try{_0x2b74b0=_[_0x1180('0xb')](_0x2b74b0,{'transfererchannel':_0x2b74b0[_0x1180('0xc')],'transferercalleridnum':_0x2b74b0[_0x1180('0xd')],'transferercalleridname':_0x2b74b0[_0x1180('0xe')],'transfererconnectedlinenum':_0x2b74b0[_0x1180('0xf')],'transfererconnectedlinename':_0x2b74b0[_0x1180('0x10')],'transfereraccountcode':_0x2b74b0[_0x1180('0x11')],'transferercontext':_0x2b74b0['secondtransferercontext'],'transfererexten':_0x2b74b0[_0x1180('0x12')],'transfererlinkedid':_0x2b74b0[_0x1180('0x13')],'context':_0x2b74b0[_0x1180('0x14')],'extension':_0x2b74b0[_0x1180('0x15')],'type':_0x1180('0x16')});if(_['isNil'](_0x2b74b0['transfereechannel'])){_0x2b74b0=_[_0x1180('0xb')](_0x2b74b0,{'transfereechannel':_0x2b74b0[_0x1180('0x17')],'transfereecalleridnum':_0x2b74b0[_0x1180('0x18')],'transfereecalleridname':_0x2b74b0[_0x1180('0x19')],'transfereeconnectedlinenum':_0x2b74b0[_0x1180('0x1a')],'transfereeconnectedlinename':_0x2b74b0[_0x1180('0x1b')],'transfereeaccountcode':_0x2b74b0[_0x1180('0x1c')],'transfereecontext':_0x2b74b0[_0x1180('0x1d')],'transfereeexten':_0x2b74b0[_0x1180('0x1e')],'transfereelinkedid':_0x2b74b0[_0x1180('0x1f')]});}writeDB(_0x2b74b0);}catch(_0xabec4e){utils[_0x1180('0xa')](_0xabec4e[_0x1180('0x20')]);}}; \ No newline at end of file +var _0xe8a4=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','format','TRANSFER|%s','request','CreateVoiceTransferReport','type','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0xe8a4,0x158));var _0x4e8a=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe8a4[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x4e8a('0x0'));var util=require('util');var utils=require(_0x4e8a('0x1'));function writeDB(_0x5737b5){utils[_0x4e8a('0x2')](util[_0x4e8a('0x3')](_0x4e8a('0x4'),_0x5737b5['type']));utils[_0x4e8a('0x5')](_0x4e8a('0x6'),_0x5737b5);}exports['blindtransfer']=function(_0xcfabc9){try{_0xcfabc9[_0x4e8a('0x7')]=_0x4e8a('0x8');writeDB(_0xcfabc9);}catch(_0x2ab997){utils[_0x4e8a('0x9')](_0x2ab997[_0x4e8a('0xa')]);}};exports[_0x4e8a('0xb')]=function(_0x14bbb3){try{_0x14bbb3=_[_0x4e8a('0xc')](_0x14bbb3,{'transfererchannel':_0x14bbb3[_0x4e8a('0xd')],'transferercalleridnum':_0x14bbb3['origtransferercalleridnum'],'transferercalleridname':_0x14bbb3[_0x4e8a('0xe')],'transfererconnectedlinenum':_0x14bbb3[_0x4e8a('0xf')],'transfererconnectedlinename':_0x14bbb3[_0x4e8a('0x10')],'transfereraccountcode':_0x14bbb3[_0x4e8a('0x11')],'transferercontext':_0x14bbb3['secondtransferercontext'],'transfererexten':_0x14bbb3[_0x4e8a('0x12')],'transfererlinkedid':_0x14bbb3[_0x4e8a('0x13')],'context':_0x14bbb3['origtransferercontext'],'extension':_0x14bbb3[_0x4e8a('0x14')],'type':_0x4e8a('0x15')});if(_[_0x4e8a('0x16')](_0x14bbb3[_0x4e8a('0x17')])){_0x14bbb3=_['assign'](_0x14bbb3,{'transfereechannel':_0x14bbb3[_0x4e8a('0x18')],'transfereecalleridnum':_0x14bbb3['transfertargetcalleridnum'],'transfereecalleridname':_0x14bbb3[_0x4e8a('0x19')],'transfereeconnectedlinenum':_0x14bbb3[_0x4e8a('0x1a')],'transfereeconnectedlinename':_0x14bbb3[_0x4e8a('0x1b')],'transfereeaccountcode':_0x14bbb3['transfertargetaccountcode'],'transfereecontext':_0x14bbb3[_0x4e8a('0x1c')],'transfereeexten':_0x14bbb3['transfertargetexten'],'transfereelinkedid':_0x14bbb3[_0x4e8a('0x1d')]});}writeDB(_0x14bbb3);}catch(_0x4305a9){utils[_0x4e8a('0x9')](_0x4305a9['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index cdbd028..3f57a31 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 _0xce56=['seconds','diffTime','diff','isAfter','isBefore','jayson/promise','bluebird','client','../../config/logger','xdr','info','debug','stringify','error','stack','request','catch','GetUser','name','interface','then','GETUSER|','result','length','FOUND','getUserByInternal','getUserByName','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract'];(function(_0x56cc8a,_0x2f38eb){var _0x43a5f2=function(_0x550b09){while(--_0x550b09){_0x56cc8a['push'](_0x56cc8a['shift']());}};_0x43a5f2(++_0x2f38eb);}(_0xce56,0x181));var _0x6ce5=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xce56[_0x59162a];return _0x35e50d;};'use strict';var jayson=require(_0x6ce5('0x0'));var moment=require('moment');var BPromise=require(_0x6ce5('0x1'));var client=jayson[_0x6ce5('0x2')]['http']({'port':0x2329});var logger=require(_0x6ce5('0x3'))(_0x6ce5('0x4'));exports[_0x6ce5('0x5')]=function(_0x3f6beb){logger['info'](_0x3f6beb);};exports[_0x6ce5('0x6')]=function(_0x3861ff){logger[_0x6ce5('0x6')](JSON[_0x6ce5('0x7')](_0x3861ff));};exports[_0x6ce5('0x8')]=function(_0x4ce222){logger['error'](_0x4ce222[_0x6ce5('0x9')]);};exports[_0x6ce5('0xa')]=function(_0x3689cc,_0x4d7c8b){return client[_0x6ce5('0xa')](_0x3689cc,{'body':_0x4d7c8b})['then'](function(_0x335c7a){logger[_0x6ce5('0x6')](JSON['stringify'](_0x335c7a));})[_0x6ce5('0xb')](function(_0x601444){logger['error'](_0x601444[_0x6ce5('0x9')]);});};function getUser(_0x3ce679){return client['request'](_0x6ce5('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x6ce5('0xd'),_0x6ce5('0xe')],'where':_0x3ce679,'limit':0x1}})[_0x6ce5('0xf')](function(_0x4db5ae){logger[_0x6ce5('0x5')](_0x6ce5('0x10')+JSON[_0x6ce5('0x7')](_0x3ce679)+'|'+(_0x4db5ae[_0x6ce5('0x11')][_0x6ce5('0x12')]?_0x6ce5('0x13'):'NOTFOUND'));return _0x4db5ae[_0x6ce5('0x11')]['length']?_0x4db5ae[_0x6ce5('0x11')][0x0]:null;});}exports[_0x6ce5('0x14')]=function(_0x1fd05a){return new BPromise(function(_0x2e409e,_0x1edc59){if(_0x1fd05a){return getUser({'internal':_0x1fd05a})[_0x6ce5('0xf')](function(_0x23261e){return _0x2e409e(_0x23261e);})['catch'](function(_0x39ecd6){logger['error'](_0x39ecd6[_0x6ce5('0x9')]);return _0x2e409e(null);});}else{return _0x2e409e(null);}});};exports['getUserByInterface']=function(_0x30c120){return new BPromise(function(_0x1aa6ac,_0x2cfd5d){if(_0x30c120){return getUser({'interface':_0x30c120})[_0x6ce5('0xf')](function(_0x53a122){return _0x1aa6ac(_0x53a122);})[_0x6ce5('0xb')](function(_0x10eee8){logger['error'](_0x10eee8['stack']);return _0x1aa6ac(null);});}else{return _0x1aa6ac(null);}});};exports[_0x6ce5('0x15')]=function(_0x38815b){return new BPromise(function(_0x4fde6d,_0x3524ad){if(_0x38815b){return getUser({'name':_0x38815b})[_0x6ce5('0xf')](function(_0x343d5a){return _0x4fde6d(_0x343d5a);})['catch'](function(_0x2a1dab){logger[_0x6ce5('0x8')](_0x2a1dab[_0x6ce5('0x9')]);return _0x4fde6d(null);});}else{return _0x4fde6d(null);}});};exports[_0x6ce5('0x16')]=function(_0x581d57){return new BPromise(function(_0x5af93f,_0x338add){if(_0x581d57){return client[_0x6ce5('0xa')](_0x6ce5('0x17'),{'options':{'raw':!![],'attributes':['id',_0x6ce5('0xd'),'type',_0x6ce5('0x18'),_0x6ce5('0x19')],'where':{'name':_0x581d57},'limit':0x1}})[_0x6ce5('0xf')](function(_0x5d6ef2){logger[_0x6ce5('0x5')](_0x6ce5('0x1a')+_0x581d57+'|'+(_0x5d6ef2[_0x6ce5('0x11')][_0x6ce5('0x12')]?_0x6ce5('0x13'):_0x6ce5('0x1b')));return _0x5af93f(_0x5d6ef2['result'][_0x6ce5('0x12')]?_0x5d6ef2['result'][0x0]:null);})[_0x6ce5('0xb')](function(_0x52109b){logger[_0x6ce5('0x8')](_0x52109b[_0x6ce5('0x9')]);return _0x5af93f(null);});}else{return _0x5af93f(null);}});};exports[_0x6ce5('0x1c')]=function(_0x85acd0,_0x20a428){return moment(_0x85acd0)['add'](_0x20a428,'seconds')[_0x6ce5('0x1d')](_0x6ce5('0x1e'));};exports[_0x6ce5('0x1f')]=function(_0xb03e16,_0x4866cc){return moment(_0xb03e16)[_0x6ce5('0x20')](_0x4866cc,_0x6ce5('0x21'))[_0x6ce5('0x1d')](_0x6ce5('0x1e'));};exports[_0x6ce5('0x22')]=function(_0x116391,_0x585a6f){return moment(_0x116391)[_0x6ce5('0x23')](moment(_0x585a6f),'seconds');};exports['sumTime']=function(_0x45ad56,_0x459c76){return parseInt(_0x45ad56,0xa)+parseInt(_0x459c76,0xa);};exports['now']=function(){return moment()[_0x6ce5('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6ce5('0x24')]=function(_0x5d55d7,_0x2aa8e7){if(_0x2aa8e7){return moment(_0x5d55d7)['isAfter'](_0x2aa8e7);}else{return!![];}};exports[_0x6ce5('0x25')]=function(_0x35c484,_0x1f5007){if(_0x1f5007){return moment(_0x35c484)[_0x6ce5('0x25')](_0x1f5007);}else if(_0x35c484){return!![];}else{return![];}}; \ No newline at end of file +var _0xc68f=['client','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','interface','result','NOTFOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','FOUND','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird'];(function(_0x520f31,_0x59494){var _0x49063f=function(_0x5964e1){while(--_0x5964e1){_0x520f31['push'](_0x520f31['shift']());}};_0x49063f(++_0x59494);}(_0xc68f,0x95));var _0xfc68=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc68f[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0xfc68('0x0'));var moment=require(_0xfc68('0x1'));var BPromise=require(_0xfc68('0x2'));var client=jayson[_0xfc68('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0xfc68('0x4'));exports[_0xfc68('0x5')]=function(_0x1a4f93){logger['info'](_0x1a4f93);};exports[_0xfc68('0x6')]=function(_0x17f0c2){logger[_0xfc68('0x6')](JSON[_0xfc68('0x7')](_0x17f0c2));};exports[_0xfc68('0x8')]=function(_0x2616b2){logger[_0xfc68('0x8')](_0x2616b2[_0xfc68('0x9')]);};exports[_0xfc68('0xa')]=function(_0x58de30,_0x557348){return client['request'](_0x58de30,{'body':_0x557348})[_0xfc68('0xb')](function(_0x588ec7){logger[_0xfc68('0x6')](JSON[_0xfc68('0x7')](_0x588ec7));})[_0xfc68('0xc')](function(_0x23dcde){logger['error'](_0x23dcde[_0xfc68('0x9')]);});};function getUser(_0x43d0e8){return client[_0xfc68('0xa')](_0xfc68('0xd'),{'options':{'raw':!![],'attributes':['id',_0xfc68('0xe'),'name',_0xfc68('0xf')],'where':_0x43d0e8,'limit':0x1}})[_0xfc68('0xb')](function(_0x3679c6){logger['info']('GETUSER|'+JSON[_0xfc68('0x7')](_0x43d0e8)+'|'+(_0x3679c6[_0xfc68('0x10')]['length']?'FOUND':_0xfc68('0x11')));return _0x3679c6[_0xfc68('0x10')][_0xfc68('0x12')]?_0x3679c6[_0xfc68('0x10')][0x0]:null;});}exports[_0xfc68('0x13')]=function(_0x32bf45){return new BPromise(function(_0x3491f3,_0x1aba0b){if(_0x32bf45){return getUser({'internal':_0x32bf45})[_0xfc68('0xb')](function(_0x457b34){return _0x3491f3(_0x457b34);})['catch'](function(_0x3b4d86){logger[_0xfc68('0x8')](_0x3b4d86['stack']);return _0x3491f3(null);});}else{return _0x3491f3(null);}});};exports[_0xfc68('0x14')]=function(_0x3dacef){return new BPromise(function(_0x41ead4,_0x37e939){if(_0x3dacef){return getUser({'interface':_0x3dacef})['then'](function(_0x23b132){return _0x41ead4(_0x23b132);})['catch'](function(_0x5dcf2f){logger['error'](_0x5dcf2f[_0xfc68('0x9')]);return _0x41ead4(null);});}else{return _0x41ead4(null);}});};exports[_0xfc68('0x15')]=function(_0x1bad7b){return new BPromise(function(_0x1898a4,_0x1580b6){if(_0x1bad7b){return getUser({'name':_0x1bad7b})[_0xfc68('0xb')](function(_0x15139d){return _0x1898a4(_0x15139d);})[_0xfc68('0xc')](function(_0x5cf96d){logger['error'](_0x5cf96d[_0xfc68('0x9')]);return _0x1898a4(null);});}else{return _0x1898a4(null);}});};exports[_0xfc68('0x16')]=function(_0x10a583){return new BPromise(function(_0x343b31,_0x2004f9){if(_0x10a583){return client[_0xfc68('0xa')](_0xfc68('0x17'),{'options':{'raw':!![],'attributes':['id',_0xfc68('0x18'),_0xfc68('0x19'),'acw','acwTimeout'],'where':{'name':_0x10a583},'limit':0x1}})['then'](function(_0x4a335e){logger[_0xfc68('0x5')]('GETVOICEQUEUEBYNAME|'+_0x10a583+'|'+(_0x4a335e[_0xfc68('0x10')][_0xfc68('0x12')]?_0xfc68('0x1a'):'NOTFOUND'));return _0x343b31(_0x4a335e[_0xfc68('0x10')][_0xfc68('0x12')]?_0x4a335e[_0xfc68('0x10')][0x0]:null);})[_0xfc68('0xc')](function(_0x2d32b0){logger[_0xfc68('0x8')](_0x2d32b0[_0xfc68('0x9')]);return _0x343b31(null);});}else{return _0x343b31(null);}});};exports[_0xfc68('0x1b')]=function(_0x574180,_0x167257){return moment(_0x574180)['add'](_0x167257,_0xfc68('0x1c'))[_0xfc68('0x1d')](_0xfc68('0x1e'));};exports[_0xfc68('0x1f')]=function(_0x4c5d40,_0x4a2f90){return moment(_0x4c5d40)[_0xfc68('0x20')](_0x4a2f90,_0xfc68('0x1c'))[_0xfc68('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0xa065cd,_0x576998){return moment(_0xa065cd)[_0xfc68('0x21')](moment(_0x576998),_0xfc68('0x1c'));};exports[_0xfc68('0x22')]=function(_0x171452,_0x1e8ac6){return parseInt(_0x171452,0xa)+parseInt(_0x1e8ac6,0xa);};exports[_0xfc68('0x23')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfc68('0x24')]=function(_0x1bc47c,_0x56d87d){if(_0x56d87d){return moment(_0x1bc47c)[_0xfc68('0x24')](_0x56d87d);}else{return!![];}};exports['isBefore']=function(_0x404eb3,_0x1ddb95){if(_0x1ddb95){return moment(_0x404eb3)[_0xfc68('0x25')](_0x1ddb95);}else if(_0x404eb3){return!![];}else{return![];}}; \ No newline at end of file